From: support Date: Tue, 5 Apr 2022 12:35:46 +0000 (+0000) Subject: Built motion from commit b1bdb64d.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/wiki.xcallymotion.com/display/XMV/%C3%90%C2%9D%C3%90%C2%BE%C3%90%C2%B2%C3%91%C2%8B%C3%90%C2%B5?a=commitdiff_plain;h=3df28cc7f420bb5b873dae4e7cd23520063f33a6;p=motion2.git Built motion from commit b1bdb64d.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 85e100c..32495ec 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-04-05T12:11:46.613Z", + "time": "2022-04-05T12:27:55.732Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index f430c60..f403d28 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-05T12:11:46.613Z", + "time": "2022-04-05T12:27:55.732Z", "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 8e35492..9dd332a 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 _0xd60d=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','action','STRING','contactManager','integration','motionbar','urlForward','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[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x39696e,_0x1eda1e){var _0x4211ce=function(_0x558455){while(--_0x558455){_0x39696e['push'](_0x39696e['shift']());}};_0x4211ce(++_0x1eda1e);}(_0xd60d,0xff));var _0xdd60=function(_0x4ae56a,_0x20d5d8){_0x4ae56a=_0x4ae56a-0x0;var _0x297744=_0xd60d[_0x4ae56a];return _0x297744;};'use strict';var Sequelize=require(_0xdd60('0x0'));module[_0xdd60('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xb194be){return this['getDataValue'](_0xdd60('0x2'));}},'action':{'type':Sequelize[_0xdd60('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xdd60('0x4'),_0xdd60('0x5'),_0xdd60('0x6'),'jscripty',_0xdd60('0x7'),_0xdd60('0x8'),_0xdd60('0x9'),_0xdd60('0xa')]],'msg':_0xdd60('0xb')}},'comment':_0xdd60('0xb')},'data1':{'type':Sequelize[_0xdd60('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[_0xdd60('0x3')](0x1000),'comment':_0xdd60('0xc')},'data3':{'type':Sequelize[_0xdd60('0x3')](0x1000),'comment':_0xdd60('0xd')},'data4':{'type':Sequelize[_0xdd60('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xdd60('0x3')](0x1000),'comments':_0xdd60('0xe')},'data6':{'type':Sequelize[_0xdd60('0x3')],'comments':_0xdd60('0xf')},'data7':{'type':Sequelize[_0xdd60('0x10')],'comments':_0xdd60('0x11')}}; \ No newline at end of file +var _0x1eb1=['contactManager','integration','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','action'];(function(_0x4e0894,_0x15c499){var _0x301041=function(_0x3cfaec){while(--_0x3cfaec){_0x4e0894['push'](_0x4e0894['shift']());}};_0x301041(++_0x15c499);}(_0x1eb1,0xa2));var _0x11eb=function(_0x290fa4,_0x18dbf1){_0x290fa4=_0x290fa4-0x0;var _0x8f4532=_0x1eb1[_0x290fa4];return _0x8f4532;};'use strict';var Sequelize=require(_0x11eb('0x0'));module[_0x11eb('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4eba6a){return this['getDataValue'](_0x11eb('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x11eb('0x3'),_0x11eb('0x4'),'motionbar','jscripty',_0x11eb('0x5'),'browser','bot',_0x11eb('0x6')]],'msg':_0x11eb('0x7')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x11eb('0x8')](0x1000),'comment':_0x11eb('0x9')},'data2':{'type':Sequelize[_0x11eb('0x8')](0x1000),'comment':_0x11eb('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x11eb('0xb')},'data4':{'type':Sequelize[_0x11eb('0x8')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x11eb('0x8')](0x1000),'comments':_0x11eb('0xc')},'data6':{'type':Sequelize[_0x11eb('0x8')],'comments':_0x11eb('0xd')},'data7':{'type':Sequelize[_0x11eb('0xe')],'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 942e3bf..ea4a939 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 _0x0240=['then','error','stack','name','params','Action','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','reject','update'];(function(_0x1b7d3e,_0xa4cadf){var _0xe9147f=function(_0x4a5dad){while(--_0x4a5dad){_0x1b7d3e['push'](_0x1b7d3e['shift']());}};_0xe9147f(++_0xa4cadf);}(_0x0240,0x15d));var _0x0024=function(_0x44fc70,_0x1c92d4){_0x44fc70=_0x44fc70-0x0;var _0x4db768=_0x0240[_0x44fc70];return _0x4db768;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0024('0x0'));var zipdir=require(_0x0024('0x1'));var jsonpatch=require(_0x0024('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0024('0x3'));var Mustache=require(_0x0024('0x4'));var util=require('util');var path=require(_0x0024('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0024('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0024('0x7'));var squel=require(_0x0024('0x8'));var crypto=require(_0x0024('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0024('0xa'));var toCsv=require(_0x0024('0xb'));var querystring=require(_0x0024('0xc'));var Papa=require(_0x0024('0xd'));var Redis=require('ioredis');var authService=require(_0x0024('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0024('0xf'));var logger=require(_0x0024('0x10'))(_0x0024('0x11'));var utils=require(_0x0024('0x12'));var config=require(_0x0024('0x13'));var licenseUtil=require(_0x0024('0x14'));var db=require(_0x0024('0x15'))['db'];function respondWithStatusCode(_0x316b2e,_0x3dd798){_0x3dd798=_0x3dd798||0xcc;return function(_0x25703b){if(_0x25703b){return _0x316b2e[_0x0024('0x16')](_0x3dd798);}return _0x316b2e[_0x0024('0x17')](_0x3dd798)[_0x0024('0x18')]();};}function respondWithResult(_0x506416,_0x56896b){_0x56896b=_0x56896b||0xc8;return function(_0x1c80c2){if(_0x1c80c2){return _0x506416[_0x0024('0x17')](_0x56896b)['json'](_0x1c80c2);}};}function respondWithFilteredResult(_0x2d2d83,_0x1ef791){return function(_0x42a701){if(_0x42a701){var _0x1f78f9=typeof _0x1ef791[_0x0024('0x19')]===_0x0024('0x1a')&&typeof _0x1ef791['limit']===_0x0024('0x1a');var _0x27b91f=_0x42a701['count'];var _0x29f96f=_0x1f78f9?0x0:_0x1ef791[_0x0024('0x19')];var _0x306ea0=_0x1f78f9?_0x42a701[_0x0024('0x1b')]:_0x1ef791[_0x0024('0x19')]+_0x1ef791['limit'];var _0x416787;if(_0x306ea0>=_0x27b91f){_0x306ea0=_0x27b91f;_0x416787=0xc8;}else{_0x416787=0xce;}_0x2d2d83[_0x0024('0x17')](_0x416787);return _0x2d2d83[_0x0024('0x1c')]('Content-Range',_0x29f96f+'-'+_0x306ea0+'/'+_0x27b91f)['json'](_0x42a701);}return null;};}function patchUpdates(_0x37774a){return function(_0x58c2bd){try{jsonpatch['apply'](_0x58c2bd,_0x37774a,!![]);}catch(_0x5cbecc){return BPromise[_0x0024('0x1d')](_0x5cbecc);}return _0x58c2bd['save']();};}function saveUpdates(_0x5caf28,_0xef560b){return function(_0x258a04){if(_0x258a04){return _0x258a04[_0x0024('0x1e')](_0x5caf28)[_0x0024('0x1f')](function(_0x17bb2e){return _0x17bb2e;});}return null;};}function removeEntity(_0x3ab728,_0xd64d90){return function(_0x4dee1d){if(_0x4dee1d){return _0x4dee1d['destroy']()['then'](function(){_0x3ab728[_0x0024('0x17')](0xcc)[_0x0024('0x18')]();});}};}function handleEntityNotFound(_0x56ce93,_0x5c627f){return function(_0x36a3a1){if(!_0x36a3a1){_0x56ce93[_0x0024('0x16')](0x194);}return _0x36a3a1;};}function handleError(_0x267ffa,_0x124e56){_0x124e56=_0x124e56||0x1f4;return function(_0x578845){logger[_0x0024('0x20')](_0x578845[_0x0024('0x21')]);if(_0x578845['name']){delete _0x578845[_0x0024('0x22')];}_0x267ffa['status'](_0x124e56)['send'](_0x578845);};}exports[_0x0024('0x1e')]=function(_0xceeb93,_0x853abf){if(_0xceeb93['body']['id']){delete _0xceeb93['body']['id'];}return db['Action']['find']({'where':{'id':_0xceeb93[_0x0024('0x23')]['id']}})[_0x0024('0x1f')](handleEntityNotFound(_0x853abf,null))['then'](saveUpdates(_0xceeb93['body'],null))[_0x0024('0x1f')](respondWithResult(_0x853abf,null))['catch'](handleError(_0x853abf,null));};exports['destroy']=function(_0x1daae6,_0x447b53){return db[_0x0024('0x24')]['find']({'where':{'id':_0x1daae6[_0x0024('0x23')]['id']}})[_0x0024('0x1f')](handleEntityNotFound(_0x447b53,null))['then'](removeEntity(_0x447b53,null))[_0x0024('0x25')](handleError(_0x447b53,null));}; \ No newline at end of file +var _0x453c=['../../mysqldb','sendStatus','status','json','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','body','Action','find','params','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x389949,_0x7d88aa){var _0x476e19=function(_0x2a733f){while(--_0x2a733f){_0x389949['push'](_0x389949['shift']());}};_0x476e19(++_0x7d88aa);}(_0x453c,0x1b9));var _0xc453=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x453c[_0x1064bc];return _0x5edc45;};'use strict';var emlformat=require(_0xc453('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc453('0x1'));var jsonpatch=require(_0xc453('0x2'));var rp=require('request-promise');var moment=require(_0xc453('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc453('0x4'));var util=require('util');var path=require(_0xc453('0x5'));var sox=require('sox');var csv=require(_0xc453('0x6'));var ejs=require(_0xc453('0x7'));var fs=require('fs');var fs_extra=require(_0xc453('0x8'));var _=require('lodash');var squel=require(_0xc453('0x9'));var crypto=require(_0xc453('0xa'));var jsforce=require(_0xc453('0xb'));var deskjs=require(_0xc453('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc453('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc453('0xe'));var as=require(_0xc453('0xf'));var hardwareService=require(_0xc453('0x10'));var logger=require(_0xc453('0x11'))(_0xc453('0x12'));var utils=require(_0xc453('0x13'));var config=require(_0xc453('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc453('0x15'))['db'];function respondWithStatusCode(_0x34e888,_0x59ca68){_0x59ca68=_0x59ca68||0xcc;return function(_0x189482){if(_0x189482){return _0x34e888[_0xc453('0x16')](_0x59ca68);}return _0x34e888[_0xc453('0x17')](_0x59ca68)['end']();};}function respondWithResult(_0x211eb8,_0x322681){_0x322681=_0x322681||0xc8;return function(_0x5c6605){if(_0x5c6605){return _0x211eb8[_0xc453('0x17')](_0x322681)[_0xc453('0x18')](_0x5c6605);}};}function respondWithFilteredResult(_0x286666,_0xedecb4){return function(_0x2c7b47){if(_0x2c7b47){var _0x54bfb0=typeof _0xedecb4['offset']===_0xc453('0x19')&&typeof _0xedecb4['limit']===_0xc453('0x19');var _0x52dc32=_0x2c7b47[_0xc453('0x1a')];var _0x217b05=_0x54bfb0?0x0:_0xedecb4['offset'];var _0x40245b=_0x54bfb0?_0x2c7b47['count']:_0xedecb4['offset']+_0xedecb4['limit'];var _0xa8372f;if(_0x40245b>=_0x52dc32){_0x40245b=_0x52dc32;_0xa8372f=0xc8;}else{_0xa8372f=0xce;}_0x286666[_0xc453('0x17')](_0xa8372f);return _0x286666[_0xc453('0x1b')](_0xc453('0x1c'),_0x217b05+'-'+_0x40245b+'/'+_0x52dc32)[_0xc453('0x18')](_0x2c7b47);}return null;};}function patchUpdates(_0x1c986c){return function(_0x22ade8){try{jsonpatch['apply'](_0x22ade8,_0x1c986c,!![]);}catch(_0xad7dad){return BPromise[_0xc453('0x1d')](_0xad7dad);}return _0x22ade8[_0xc453('0x1e')]();};}function saveUpdates(_0x14a59f,_0x429ef6){return function(_0x334554){if(_0x334554){return _0x334554[_0xc453('0x1f')](_0x14a59f)[_0xc453('0x20')](function(_0x4fcd88){return _0x4fcd88;});}return null;};}function removeEntity(_0x1bdb76,_0x2988e5){return function(_0x29ee72){if(_0x29ee72){return _0x29ee72[_0xc453('0x21')]()[_0xc453('0x20')](function(){_0x1bdb76[_0xc453('0x17')](0xcc)[_0xc453('0x22')]();});}};}function handleEntityNotFound(_0x3b3886,_0x2db12d){return function(_0x22f6d3){if(!_0x22f6d3){_0x3b3886[_0xc453('0x16')](0x194);}return _0x22f6d3;};}function handleError(_0x57f527,_0xfbf6c5){_0xfbf6c5=_0xfbf6c5||0x1f4;return function(_0x1a823d){logger[_0xc453('0x23')](_0x1a823d['stack']);if(_0x1a823d[_0xc453('0x24')]){delete _0x1a823d['name'];}_0x57f527[_0xc453('0x17')](_0xfbf6c5)[_0xc453('0x25')](_0x1a823d);};}exports[_0xc453('0x1f')]=function(_0x1e132c,_0x522aa0){if(_0x1e132c[_0xc453('0x26')]['id']){delete _0x1e132c['body']['id'];}return db[_0xc453('0x27')][_0xc453('0x28')]({'where':{'id':_0x1e132c['params']['id']}})[_0xc453('0x20')](handleEntityNotFound(_0x522aa0,null))['then'](saveUpdates(_0x1e132c['body'],null))[_0xc453('0x20')](respondWithResult(_0x522aa0,null))['catch'](handleError(_0x522aa0,null));};exports[_0xc453('0x21')]=function(_0x351763,_0x246c20){return db['Action'][_0xc453('0x28')]({'where':{'id':_0x351763[_0xc453('0x29')]['id']}})[_0xc453('0x20')](handleEntityNotFound(_0x246c20,null))[_0xc453('0x20')](removeEntity(_0x246c20,null))['catch'](handleError(_0x246c20,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 09e4a45..93bda66 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 _0x2315=['exports','define','tools_actions','lodash','../../config/logger','moment','request-promise','path','rimraf','./action.attributes'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x2315,0xfd));var _0x5231=function(_0x23808c,_0x3b032b){_0x23808c=_0x23808c-0x0;var _0x39d835=_0x2315[_0x23808c];return _0x39d835;};'use strict';var _=require(_0x5231('0x0'));var util=require('util');var logger=require(_0x5231('0x1'))('api');var moment=require(_0x5231('0x2'));var BPromise=require('bluebird');var rp=require(_0x5231('0x3'));var fs=require('fs');var path=require(_0x5231('0x4'));var rimraf=require(_0x5231('0x5'));var config=require('../../config/environment');var attributes=require(_0x5231('0x6'));module[_0x5231('0x7')]=function(_0x5b3e33,_0x50141c){return _0x5b3e33[_0x5231('0x8')]('Action',attributes,{'tableName':_0x5231('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98f1=['Action','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports','define'];(function(_0x1a79c6,_0x5bad0b){var _0x301647=function(_0x9d3817){while(--_0x9d3817){_0x1a79c6['push'](_0x1a79c6['shift']());}};_0x301647(++_0x5bad0b);}(_0x98f1,0x1cf));var _0x198f=function(_0x4d51cb,_0x12df1b){_0x4d51cb=_0x4d51cb-0x0;var _0x7a9f54=_0x98f1[_0x4d51cb];return _0x7a9f54;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x198f('0x0'))(_0x198f('0x1'));var moment=require(_0x198f('0x2'));var BPromise=require(_0x198f('0x3'));var rp=require(_0x198f('0x4'));var fs=require('fs');var path=require(_0x198f('0x5'));var rimraf=require('rimraf');var config=require(_0x198f('0x6'));var attributes=require(_0x198f('0x7'));module[_0x198f('0x8')]=function(_0x589abf,_0x3b9901){return _0x589abf[_0x198f('0x9')](_0x198f('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 1db898c..9629566 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4f03ad,_0x1921e3){_0x4f03ad=_0x4f03ad-0x0;var _0x26d793=_0x1cb9[_0x4f03ad];return _0x26d793;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1f76a4,_0x433129){var _0x1f515a=function(_0x3384c3){while(--_0x3384c3){_0x1f76a4['push'](_0x1f76a4['shift']());}};_0x1f515a(++_0x433129);}(_0x5fab,0x177));var _0xb5fa=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x5fab[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2f42aaf..03d9f7b 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 _0x5e7a=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e7a,0x1e2));var _0xa5e7=function(_0x3e6f1e,_0x305234){_0x3e6f1e=_0x3e6f1e-0x0;var _0x941ad1=_0x5e7a[_0x3e6f1e];return _0x941ad1;};'use strict';var multer=require(_0xa5e7('0x0'));var util=require(_0xa5e7('0x1'));var path=require(_0xa5e7('0x2'));var timeout=require(_0xa5e7('0x3'));var express=require('express');var router=express[_0xa5e7('0x4')]();var fs_extra=require(_0xa5e7('0x5'));var auth=require(_0xa5e7('0x6'));var interaction=require(_0xa5e7('0x7'));var config=require(_0xa5e7('0x8'));var controller=require(_0xa5e7('0x9'));router[_0xa5e7('0xa')](_0xa5e7('0xb'),auth[_0xa5e7('0xc')](),controller[_0xa5e7('0xd')]);router[_0xa5e7('0xe')](_0xa5e7('0xb'),auth[_0xa5e7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3ea3=['../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x46f9ac,_0x5c6930){var _0x1b5742=function(_0x2abf6d){while(--_0x2abf6d){_0x46f9ac['push'](_0x46f9ac['shift']());}};_0x1b5742(++_0x5c6930);}(_0x3ea3,0xf7));var _0x33ea=function(_0x1383ec,_0x188bf4){_0x1383ec=_0x1383ec-0x0;var _0x163548=_0x3ea3[_0x1383ec];return _0x163548;};'use strict';var multer=require(_0x33ea('0x0'));var util=require(_0x33ea('0x1'));var path=require('path');var timeout=require(_0x33ea('0x2'));var express=require(_0x33ea('0x3'));var router=express['Router']();var fs_extra=require(_0x33ea('0x4'));var auth=require(_0x33ea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x33ea('0x6'));var controller=require(_0x33ea('0x7'));router[_0x33ea('0x8')](_0x33ea('0x9'),auth[_0x33ea('0xa')](),controller['update']);router[_0x33ea('0xb')](_0x33ea('0x9'),auth[_0x33ea('0xa')](),controller[_0x33ea('0xc')]);module[_0x33ea('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 819f8f5..9c50164 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 _0x7c09=['exports','STRING','TEXT'];(function(_0x1d3a20,_0x23998e){var _0x535677=function(_0x46c21e){while(--_0x46c21e){_0x1d3a20['push'](_0x1d3a20['shift']());}};_0x535677(++_0x23998e);}(_0x7c09,0x102));var _0x97c0=function(_0x3d0096,_0x5f3cd3){_0x3d0096=_0x3d0096-0x0;var _0xa620c7=_0x7c09[_0x3d0096];return _0xa620c7;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file +var _0x8958=['TEXT','exports'];(function(_0xfb9aaa,_0x37935d){var _0x103bf7=function(_0x1e9f2a){while(--_0x1e9f2a){_0xfb9aaa['push'](_0xfb9aaa['shift']());}};_0x103bf7(++_0x37935d);}(_0x8958,0x93));var _0x8895=function(_0x3f1f59,_0x5ebceb){_0x3f1f59=_0x3f1f59-0x0;var _0xd0a450=_0x8958[_0x3f1f59];return _0xd0a450;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index dc149b8..ed64be0 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 _0x70b7=['child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','operator','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','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','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','field','function','replace','format','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','MAX(%s)','ROUND(%s)','getFields','ValidationErrorItem','from','MetricId','metric','groupBy','%s.%s\x20=\x20%s.%s','output','web','%s-%s.%s','randomstring','custom','cdr','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:'];(function(_0x429e26,_0x573537){var _0x48268e=function(_0x26553e){while(--_0x26553e){_0x429e26['push'](_0x429e26['shift']());}};_0x48268e(++_0x573537);}(_0x70b7,0x1e9));var _0x770b=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x70b7[_0x5e4b85];return _0x5cd3cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x770b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x770b('0x1'));var rp=require(_0x770b('0x2'));var moment=require(_0x770b('0x3'));var BPromise=require(_0x770b('0x4'));var Mustache=require(_0x770b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x770b('0x6'));var csv=require(_0x770b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x770b('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x770b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x770b('0xa'));var toCsv=require(_0x770b('0x7'));var querystring=require(_0x770b('0xb'));var Papa=require(_0x770b('0xc'));var Redis=require(_0x770b('0xd'));var authService=require(_0x770b('0xe'));var qs=require(_0x770b('0xf'));var as=require(_0x770b('0x10'));var hardwareService=require(_0x770b('0x11'));var logger=require(_0x770b('0x12'))(_0x770b('0x13'));var utils=require(_0x770b('0x14'));var config=require(_0x770b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x770b('0x16'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x42c21a,_0x5186f7){_0x5186f7=_0x5186f7||0xcc;return function(_0x45d31d){if(_0x45d31d){return _0x42c21a[_0x770b('0x17')](_0x5186f7);}return _0x42c21a[_0x770b('0x18')](_0x5186f7)['end']();};}function respondWithResult(_0x15baf3,_0x45fcc0){_0x45fcc0=_0x45fcc0||0xc8;return function(_0x558f15){if(_0x558f15){return _0x15baf3[_0x770b('0x18')](_0x45fcc0)['json'](_0x558f15);}};}function respondWithFilteredResult(_0x2eb231,_0x298a70){return function(_0x5929a0){if(_0x5929a0){var _0x6648c3=typeof _0x298a70[_0x770b('0x19')]===_0x770b('0x1a')&&typeof _0x298a70[_0x770b('0x1b')]===_0x770b('0x1a');var _0xd29578=_0x5929a0[_0x770b('0x1c')];var _0xfd54ff=_0x6648c3?0x0:_0x298a70[_0x770b('0x19')];var _0x4a7727=_0x6648c3?_0x5929a0['count']:_0x298a70['offset']+_0x298a70[_0x770b('0x1b')];var _0x135297;if(_0x4a7727>=_0xd29578){_0x4a7727=_0xd29578;_0x135297=0xc8;}else{_0x135297=0xce;}_0x2eb231['status'](_0x135297);return _0x2eb231[_0x770b('0x1d')]('Content-Range',_0xfd54ff+'-'+_0x4a7727+'/'+_0xd29578)[_0x770b('0x1e')](_0x5929a0);}return null;};}function patchUpdates(_0xcda6fe){return function(_0x4bd65c){try{jsonpatch[_0x770b('0x1f')](_0x4bd65c,_0xcda6fe,!![]);}catch(_0x5bf654){return BPromise[_0x770b('0x20')](_0x5bf654);}return _0x4bd65c[_0x770b('0x21')]();};}function saveUpdates(_0x3fa38c,_0x3c9900){return function(_0x5512ef){if(_0x5512ef){return _0x5512ef[_0x770b('0x22')](_0x3fa38c)[_0x770b('0x23')](function(_0x575eb2){return _0x575eb2;});}return null;};}function removeEntity(_0x5f3197,_0x4eafb0){return function(_0x3b72f6){if(_0x3b72f6){return _0x3b72f6['destroy']()['then'](function(){var _0x891193=_0x3b72f6[_0x770b('0x24')]({'plain':!![]});var _0x23be5a=_0x770b('0x25');return db[_0x770b('0x26')]['destroy']({'where':{'type':_0x23be5a,'resourceId':_0x891193['id']}})['then'](function(){return _0x3b72f6;});})['then'](function(){_0x5f3197[_0x770b('0x18')](0xcc)[_0x770b('0x27')]();});}};}function handleEntityNotFound(_0x3e36b8,_0x33ff06){return function(_0x18c393){if(!_0x18c393){_0x3e36b8[_0x770b('0x17')](0x194);}return _0x18c393;};}function handleError(_0x3cc9b9,_0x50ee4c){_0x50ee4c=_0x50ee4c||0x1f4;return function(_0x458ef5){logger[_0x770b('0x28')](_0x458ef5[_0x770b('0x29')]);if(_0x458ef5[_0x770b('0x2a')]){delete _0x458ef5['name'];}_0x3cc9b9['status'](_0x50ee4c)[_0x770b('0x2b')](_0x458ef5);};}exports[_0x770b('0x2c')]=function(_0x13da2e,_0x168089){var _0x38af54={},_0x4d5257={},_0x2af88c={'count':0x0,'rows':[]};var _0x523edb=_[_0x770b('0x2d')](db[_0x770b('0x2e')][_0x770b('0x2f')],function(_0x351540){return{'name':_0x351540[_0x770b('0x30')],'type':_0x351540['type'][_0x770b('0x31')]};});_0x4d5257[_0x770b('0x32')]=_[_0x770b('0x2d')](_0x523edb,_0x770b('0x2a'));_0x4d5257[_0x770b('0x33')]=_[_0x770b('0x34')](_0x13da2e[_0x770b('0x33')]);_0x4d5257[_0x770b('0x35')]=_[_0x770b('0x36')](_0x4d5257[_0x770b('0x32')],_0x4d5257[_0x770b('0x33')]);_0x38af54[_0x770b('0x37')]=_[_0x770b('0x36')](_0x4d5257[_0x770b('0x32')],qs['fields'](_0x13da2e['query'][_0x770b('0x38')]));_0x38af54[_0x770b('0x37')]=_0x38af54['attributes'][_0x770b('0x39')]?_0x38af54[_0x770b('0x37')]:_0x4d5257[_0x770b('0x32')];if(!_0x13da2e[_0x770b('0x33')]['hasOwnProperty'](_0x770b('0x3a'))){_0x38af54[_0x770b('0x1b')]=qs[_0x770b('0x1b')](_0x13da2e[_0x770b('0x33')]['limit']);_0x38af54[_0x770b('0x19')]=qs['offset'](_0x13da2e[_0x770b('0x33')][_0x770b('0x19')]);}_0x38af54[_0x770b('0x3b')]=qs['sort'](_0x13da2e[_0x770b('0x33')][_0x770b('0x3c')]);_0x38af54[_0x770b('0x3d')]=qs[_0x770b('0x35')](_[_0x770b('0x3e')](_0x13da2e['query'],_0x4d5257[_0x770b('0x35')]),_0x523edb);if(_0x13da2e[_0x770b('0x33')][_0x770b('0x3f')]){_0x38af54[_0x770b('0x3d')]=_[_0x770b('0x40')](_0x38af54[_0x770b('0x3d')],{'$or':_[_0x770b('0x2d')](_0x523edb,function(_0x3bf38e){if(_0x3bf38e[_0x770b('0x41')]!==_0x770b('0x42')){var _0x322269={};_0x322269[_0x3bf38e[_0x770b('0x2a')]]={'$like':'%'+_0x13da2e[_0x770b('0x33')]['filter']+'%'};return _0x322269;}})});}_0x38af54=_[_0x770b('0x40')]({},_0x38af54,_0x13da2e[_0x770b('0x43')]);var _0xb94b1a={'where':_0x38af54[_0x770b('0x3d')]};return db[_0x770b('0x2e')][_0x770b('0x1c')](_0xb94b1a)['then'](function(_0x415168){_0x2af88c[_0x770b('0x1c')]=_0x415168;if(_0x13da2e[_0x770b('0x33')][_0x770b('0x44')]){_0x38af54[_0x770b('0x45')]=[{'all':!![]}];}return db[_0x770b('0x2e')][_0x770b('0x46')](_0x38af54);})[_0x770b('0x23')](function(_0x16f853){_0x2af88c['rows']=_0x16f853;return _0x2af88c;})[_0x770b('0x23')](respondWithFilteredResult(_0x168089,_0x38af54))['catch'](handleError(_0x168089,null));};exports[_0x770b('0x47')]=function(_0x4b024d,_0x14f2af){var _0x293d5e={'raw':![],'where':{'id':_0x4b024d[_0x770b('0x48')]['id']}},_0x46952a={};_0x46952a[_0x770b('0x32')]=_['keys'](db['AnalyticCustomReport'][_0x770b('0x2f')]);_0x46952a[_0x770b('0x33')]=_[_0x770b('0x34')](_0x4b024d[_0x770b('0x33')]);_0x46952a[_0x770b('0x35')]=_[_0x770b('0x36')](_0x46952a[_0x770b('0x32')],_0x46952a[_0x770b('0x33')]);_0x293d5e[_0x770b('0x37')]=_['intersection'](_0x46952a[_0x770b('0x32')],qs[_0x770b('0x38')](_0x4b024d['query'][_0x770b('0x38')]));_0x293d5e[_0x770b('0x37')]=_0x293d5e[_0x770b('0x37')][_0x770b('0x39')]?_0x293d5e['attributes']:_0x46952a[_0x770b('0x32')];if(_0x4b024d[_0x770b('0x33')][_0x770b('0x44')]){_0x293d5e[_0x770b('0x45')]=[{'all':!![]}];}_0x293d5e=_['merge']({},_0x293d5e,_0x4b024d[_0x770b('0x43')]);return db[_0x770b('0x2e')][_0x770b('0x49')](_0x293d5e)['then'](handleEntityNotFound(_0x14f2af,null))['then'](respondWithResult(_0x14f2af,null))[_0x770b('0x4a')](handleError(_0x14f2af,null));};exports['create']=function(_0x1b9804,_0x50f300){return db[_0x770b('0x2e')][_0x770b('0x4b')](_0x1b9804['body'],{})[_0x770b('0x23')](function(_0x2fafee){var _0x1c7483=_0x1b9804['user']['get']({'plain':!![]});if(!_0x1c7483)throw new Error(_0x770b('0x4c'));if(_0x1c7483[_0x770b('0x4d')]===_0x770b('0x4e')){var _0x215121=_0x2fafee[_0x770b('0x24')]({'plain':!![]});var _0x1efe13=_0x770b('0x4f');return db[_0x770b('0x50')]['find']({'where':{'name':_0x1efe13,'userProfileId':_0x1c7483[_0x770b('0x51')]},'raw':!![]})['then'](function(_0x25aa85){if(_0x25aa85&&_0x25aa85['autoAssociation']===0x0){return db['UserProfileResource'][_0x770b('0x4b')]({'name':_0x215121[_0x770b('0x2a')],'resourceId':_0x215121['id'],'type':_0x770b('0x25'),'sectionId':_0x25aa85['id']},{})[_0x770b('0x23')](function(){return _0x2fafee;});}else{return _0x2fafee;}})['catch'](function(_0x468dd0){logger[_0x770b('0x28')](_0x770b('0x52'),_0x468dd0);throw _0x468dd0;});}return _0x2fafee;})['then'](respondWithResult(_0x50f300,0xc9))[_0x770b('0x4a')](handleError(_0x50f300,null));};exports[_0x770b('0x22')]=function(_0x528a7a,_0x4bc451){if(_0x528a7a[_0x770b('0x53')]['id']){delete _0x528a7a['body']['id'];}return db[_0x770b('0x2e')][_0x770b('0x49')]({'where':{'id':_0x528a7a[_0x770b('0x48')]['id']}})[_0x770b('0x23')](handleEntityNotFound(_0x4bc451,null))[_0x770b('0x23')](saveUpdates(_0x528a7a[_0x770b('0x53')],null))['then'](respondWithResult(_0x4bc451,null))['catch'](handleError(_0x4bc451,null));};exports[_0x770b('0x54')]=function(_0x1b2b01,_0x5c0fbb){return db['AnalyticCustomReport']['find']({'where':{'id':_0x1b2b01[_0x770b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c0fbb,null))[_0x770b('0x23')](removeEntity(_0x5c0fbb,null))[_0x770b('0x4a')](handleError(_0x5c0fbb,null));};exports['preview']=function(_0x4b2382,_0x5191c3){var _0x348c37=0xa;var _0x5701a2=[_0x770b('0x55'),_0x770b('0x56'),_0x770b('0x57'),_0x770b('0x58')];var _0xd75208={'SUM':_0x770b('0x59'),'COUNT':_0x770b('0x5a'),'COUNT DISTINCT':_0x770b('0x5b'),'MAX':'MAX(%s)','MIN':_0x770b('0x5c'),'AVG':_0x770b('0x5d'),'GROUP_CONCAT':_0x770b('0x5e'),'GROUP_CONCAT ASC':_0x770b('0x5f'),'GROUP_CONCAT DESC':_0x770b('0x60')};var _0x232713={'SEC_TO_TIME':_0x770b('0x61'),'DATE':_0x770b('0x62'),'HOUR':_0x770b('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x770b('0x64')};var _0x5eb021=function(_0x4e664c){return!_['includes']([_0x770b('0x65'),'IS\x20NOT\x20NULL',_0x770b('0x66'),_0x770b('0x67')],_0x4e664c);};var _0x578364=function(_0x50736f){if(!_0x50736f||!_0x50736f['rules'][_0x770b('0x39')]){return'';}for(var _0x2c338f='(',_0x5f14e5=0x0;_0x5f14e5<_0x50736f[_0x770b('0x68')][_0x770b('0x39')];_0x5f14e5+=0x1){_0x5f14e5>0x0&&(_0x2c338f+='\x20'+_0x50736f['operator']+'\x20');_0x2c338f+=_0x50736f['rules'][_0x5f14e5][_0x770b('0x69')]?_0x578364(_0x50736f[_0x770b('0x68')][_0x5f14e5][_0x770b('0x69')]):_0x50736f[_0x770b('0x68')][_0x5f14e5]['field']+'\x20'+_0x50736f[_0x770b('0x68')][_0x5f14e5][_0x770b('0x6a')]+(_0x5eb021(_0x50736f[_0x770b('0x68')][_0x5f14e5][_0x770b('0x6a')])?'\x20'+_0x50736f[_0x770b('0x68')][_0x5f14e5]['value']:'');}return _0x2c338f+')';};var _0x574b3b={'where':{'id':_0x4b2382[_0x770b('0x48')]['id']}},_0xb94d62,_0x23f1f0,_0x5881b2,_0x596e0f,_0x2395de;_0x574b3b=_[_0x770b('0x40')]({},_0x574b3b,_0x4b2382[_0x770b('0x43')]);return db[_0x770b('0x2e')][_0x770b('0x49')](_0x574b3b)[_0x770b('0x23')](function(_0x5b651a){if(_0x5b651a){_0xb94d62=_0x5b651a;return _0x5b651a['getFields']();}return null;})[_0x770b('0x23')](function(_0x3f0825){if(_0x3f0825){if(!_0x3f0825[_0x770b('0x39')]){throw new db[(_0x770b('0x6b'))]['ValidationErrorItem'](_0x770b('0x6c'),0x193);}_0x23f1f0=_0x3f0825;return db[_0x770b('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x770b('0x23')](function(_0x12fb34){if(_0x12fb34){_0x5881b2=_[_0x770b('0x6e')](_0x12fb34,'id');var _0x570132;var _0x3a0f12=squel[_0x770b('0x6f')]();_0x3a0f12['from'](_0xb94d62[_0x770b('0x70')]);for(var _0x1563f3=0x0;_0x1563f3<_0x23f1f0[_0x770b('0x39')];_0x1563f3+=0x1){_0x570132=_0x23f1f0[_0x1563f3]['MetricId']?_0x5881b2[_0x23f1f0[_0x1563f3]['MetricId']]['metric']:_0x23f1f0[_0x1563f3][_0x770b('0x71')];_0x570132=_0x23f1f0[_0x1563f3][_0x770b('0x72')]?_[_0x770b('0x73')](_0xd75208[_0x23f1f0[_0x1563f3][_0x770b('0x72')]],'%s',_0x570132):_0x570132;_0x570132=_0x23f1f0[_0x1563f3]['format']?_[_0x770b('0x73')](_0x232713[_0x23f1f0[_0x1563f3][_0x770b('0x74')]],'%s',_0x570132):_0x570132;if(_0x23f1f0[_0x1563f3]['groupBy']){_0x3a0f12[_0x770b('0x69')](_0x570132);}_0x23f1f0[_0x1563f3][_0x770b('0x75')]&&_0x3a0f12[_0x770b('0x3b')](_0x570132,_0x23f1f0[_0x1563f3][_0x770b('0x75')]===_0x770b('0x76')?![]:!![]);_0x3a0f12[_0x770b('0x71')](_0x570132,_0x23f1f0[_0x1563f3][_0x770b('0x77')]||_0x570132);}if(_0xb94d62[_0x770b('0x78')]){_0xb94d62['joins']=JSON[_0x770b('0x79')](_0xb94d62[_0x770b('0x78')]);for(var _0x38b0d1=0x0;_0x38b0d1<_0xb94d62[_0x770b('0x78')][_0x770b('0x39')];_0x38b0d1+=0x1){if(_0xb94d62[_0x770b('0x78')][_0x38b0d1]['type']&&_[_0x770b('0x7a')](_0x5701a2,_0xb94d62[_0x770b('0x78')][_0x38b0d1]['type'])&&_0xb94d62[_0x770b('0x78')][_0x38b0d1][_0x770b('0x7b')]&&_0xb94d62[_0x770b('0x78')][_0x38b0d1][_0x770b('0x7c')]&&_0xb94d62['joins'][_0x38b0d1]['foreignKey']){_0x3a0f12[_0xb94d62['joins'][_0x38b0d1][_0x770b('0x41')]](_0xb94d62[_0x770b('0x78')][_0x38b0d1][_0x770b('0x7c')],null,util[_0x770b('0x74')]('%s.%s\x20=\x20%s.%s',_0xb94d62['table'],_0xb94d62['joins'][_0x38b0d1][_0x770b('0x7b')],_0xb94d62[_0x770b('0x78')][_0x38b0d1]['foreignTable'],_0xb94d62[_0x770b('0x78')][_0x38b0d1][_0x770b('0x7d')]));}}}if(_0xb94d62[_0x770b('0x7e')]){_0xb94d62[_0x770b('0x7e')]=JSON[_0x770b('0x79')](_0xb94d62[_0x770b('0x7e')]);_0x3a0f12[_0x770b('0x3d')](_0x578364(_0xb94d62[_0x770b('0x7e')]['group']));}_0x2395de=_0x3a0f12[_0x770b('0x7f')]();_0x3a0f12[_0x770b('0x1b')](_0x348c37);_0x3a0f12[_0x770b('0x19')](0x0);logger[_0x770b('0x80')]('Limited\x20Query:',_0x3a0f12[_0x770b('0x81')]());return dbH['sequelize'][_0x770b('0x33')](_0x3a0f12[_0x770b('0x81')](),{'type':dbH[_0x770b('0x82')][_0x770b('0x83')][_0x770b('0x84')]});}})[_0x770b('0x23')](respondWithResult(_0x5191c3,null))[_0x770b('0x4a')](handleError(_0x5191c3,null));};function runReport(_0x35b04c,_0x55cdb5,_0x474c17){var _0x22041c=_0x55cdb5[_0x770b('0x2a')];var _0xe484f8=0xa;var _0xed7c9=[_0x770b('0x55'),_0x770b('0x56'),_0x770b('0x57'),'cross_join'];var _0x22fcc5={'SUM':_0x770b('0x59'),'COUNT':_0x770b('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x770b('0x85'),'MIN':'MIN(%s)','AVG':_0x770b('0x5d'),'GROUP_CONCAT':_0x770b('0x5e'),'GROUP_CONCAT ASC':_0x770b('0x5f'),'GROUP_CONCAT DESC':_0x770b('0x60')};var _0x20d444={'SEC_TO_TIME':_0x770b('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x770b('0x86'),'UNIX_TIMESTAMP':_0x770b('0x64')};var _0x68efc=function(_0xd57067){return!_[_0x770b('0x7a')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x770b('0x66'),_0x770b('0x67')],_0xd57067);};var _0x2922e9=function(_0x2b2269){if(!_0x2b2269||!_0x2b2269['rules'][_0x770b('0x39')]){return'';}for(var _0x1b7c2c='(',_0x20ad84=0x0;_0x20ad84<_0x2b2269[_0x770b('0x68')]['length'];_0x20ad84+=0x1){_0x20ad84>0x0&&(_0x1b7c2c+='\x20'+_0x2b2269['operator']+'\x20');_0x1b7c2c+=_0x2b2269[_0x770b('0x68')][_0x20ad84]['group']?_0x2922e9(_0x2b2269['rules'][_0x20ad84][_0x770b('0x69')]):_0x2b2269[_0x770b('0x68')][_0x20ad84][_0x770b('0x71')]+'\x20'+_0x2b2269[_0x770b('0x68')][_0x20ad84][_0x770b('0x6a')]+(_0x68efc(_0x2b2269['rules'][_0x20ad84][_0x770b('0x6a')])?'\x20'+_0x2b2269[_0x770b('0x68')][_0x20ad84]['value']:'');}return _0x1b7c2c+')';};var _0x385b0b={'where':{'id':_0x35b04c['id']}},_0x2fb89c,_0x2a7430,_0x566929,_0x2589f1,_0x2b6a51;_0x385b0b=_['merge']({},_0x385b0b,_0x474c17);return db['AnalyticCustomReport'][_0x770b('0x49')](_0x385b0b)[_0x770b('0x23')](function(_0x4d16e2){if(_0x4d16e2){_0x2fb89c=_0x4d16e2;return _0x4d16e2[_0x770b('0x87')]();}return null;})[_0x770b('0x23')](function(_0x3372e6){if(_0x3372e6){if(!_0x3372e6[_0x770b('0x39')]){throw new db['Sequelize'][(_0x770b('0x88'))](_0x770b('0x6c'),0x193);}_0x2a7430=_0x3372e6;return db[_0x770b('0x6d')][_0x770b('0x46')]({'raw':!![]});}return null;})[_0x770b('0x23')](function(_0x186253){if(_0x186253){_0x566929=_[_0x770b('0x6e')](_0x186253,'id');var _0x41d34f;var _0x6af2cc=squel[_0x770b('0x6f')]();_0x6af2cc[_0x770b('0x89')](_0x2fb89c['table']);for(var _0xcc03d=0x0;_0xcc03d<_0x2a7430[_0x770b('0x39')];_0xcc03d+=0x1){_0x41d34f=_0x2a7430[_0xcc03d][_0x770b('0x8a')]?_0x566929[_0x2a7430[_0xcc03d][_0x770b('0x8a')]][_0x770b('0x8b')]:_0x2a7430[_0xcc03d][_0x770b('0x71')];_0x41d34f=_0x2a7430[_0xcc03d][_0x770b('0x72')]?_[_0x770b('0x73')](_0x22fcc5[_0x2a7430[_0xcc03d][_0x770b('0x72')]],'%s',_0x41d34f):_0x41d34f;_0x41d34f=_0x2a7430[_0xcc03d][_0x770b('0x74')]?_['replace'](_0x20d444[_0x2a7430[_0xcc03d]['format']],'%s',_0x41d34f):_0x41d34f;if(_0x2a7430[_0xcc03d][_0x770b('0x8c')]){_0x6af2cc[_0x770b('0x69')](_0x41d34f);}_0x2a7430[_0xcc03d][_0x770b('0x75')]&&_0x6af2cc['order'](_0x41d34f,_0x2a7430[_0xcc03d][_0x770b('0x75')]==='DESC'?![]:!![]);_0x6af2cc['field'](_0x41d34f,_0x2a7430[_0xcc03d][_0x770b('0x77')]||_0x41d34f);}if(_0x2fb89c[_0x770b('0x78')]){_0x2fb89c[_0x770b('0x78')]=JSON[_0x770b('0x79')](_0x2fb89c[_0x770b('0x78')]);for(var _0x2bb459=0x0;_0x2bb459<_0x2fb89c[_0x770b('0x78')]['length'];_0x2bb459+=0x1){if(_0x2fb89c[_0x770b('0x78')][_0x2bb459][_0x770b('0x41')]&&_[_0x770b('0x7a')](_0xed7c9,_0x2fb89c['joins'][_0x2bb459][_0x770b('0x41')])&&_0x2fb89c[_0x770b('0x78')][_0x2bb459][_0x770b('0x7b')]&&_0x2fb89c[_0x770b('0x78')][_0x2bb459][_0x770b('0x7c')]&&_0x2fb89c[_0x770b('0x78')][_0x2bb459][_0x770b('0x7d')]){_0x6af2cc[_0x2fb89c[_0x770b('0x78')][_0x2bb459]['type']](_0x2fb89c[_0x770b('0x78')][_0x2bb459][_0x770b('0x7c')],null,util[_0x770b('0x74')](_0x770b('0x8d'),_0x2fb89c[_0x770b('0x70')],_0x2fb89c['joins'][_0x2bb459]['parentKey'],_0x2fb89c['joins'][_0x2bb459]['foreignTable'],_0x2fb89c[_0x770b('0x78')][_0x2bb459][_0x770b('0x7d')]));}}}if(_0x2fb89c[_0x770b('0x7e')]){_0x2fb89c[_0x770b('0x7e')]=JSON['parse'](_0x2fb89c['conditions']);_0x6af2cc[_0x770b('0x3d')](_0x2922e9(_0x2fb89c['conditions']['group']));}_0x2b6a51=_0x6af2cc[_0x770b('0x7f')]();_0x6af2cc[_0x770b('0x1b')](_0xe484f8);_0x6af2cc[_0x770b('0x19')](0x0);return;}})[_0x770b('0x23')](function(){if(_0x55cdb5[_0x770b('0x8e')]===_0x770b('0x8f')){return null;}var _0xae9a62=_[_0x770b('0x40')](_0x55cdb5,{'name':_0x55cdb5['fullPath']||_0x55cdb5[_0x770b('0x2a')]||_0x2fb89c[_0x770b('0x2a')],'basename':_0x22041c,'savename':util[_0x770b('0x74')](_0x770b('0x90'),_0x55cdb5[_0x770b('0x2a')]||_0x2fb89c[_0x770b('0x2a')],require(_0x770b('0x91'))['generate'](0x4),_0x55cdb5['output']||'csv'),'reportId':_0x2fb89c['id'],'reportType':_0x770b('0x92')});return db['AnalyticExtractedReport'][_0x770b('0x4b')](_0xae9a62,{'raw':!![]});})[_0x770b('0x23')](function(_0x5e8084){if(_0x2fb89c[_0x770b('0x70')]===_0x770b('0x93')){_0x2b6a51['where'](_0x2fb89c[_0x770b('0x70')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x55cdb5['startDate'],_0x55cdb5['endDate']);}else{_0x2b6a51['where'](_0x2fb89c[_0x770b('0x70')]+_0x770b('0x94'),_0x55cdb5['startDate'],_0x55cdb5[_0x770b('0x95')]);}if(_0x5e8084){logger['info'](_0x770b('0x96'),_0x2b6a51[_0x770b('0x81')]());require(_0x770b('0x97'))[_0x770b('0x98')](path[_0x770b('0x55')](__dirname,'../../components/export/',_0x5e8084[_0x770b('0x8e')]),[_0x5e8084['id'],_0x2b6a51[_0x770b('0x81')](),path['join'](__dirname,_0x770b('0x99'),_0x5e8084[_0x770b('0x9a')]),_0x22041c]);return _0x5e8084;}else{var _0x52f082=squel[_0x770b('0x6f')]();_0x52f082[_0x770b('0x89')]('('+_0x2b6a51[_0x770b('0x81')]()+')',_0x770b('0x9b'));_0x52f082[_0x770b('0x71')](_0x770b('0x9c'),_0x770b('0x1c'));_0x2b6a51[_0x770b('0x1b')](_0x55cdb5[_0x770b('0x1b')]||_0xe484f8);_0x2b6a51['offset'](_0x55cdb5[_0x770b('0x19')]||0x0);return dbH['sequelize'][_0x770b('0x33')](_0x52f082['toString'](),{'type':dbH[_0x770b('0x82')][_0x770b('0x83')][_0x770b('0x84')]})[_0x770b('0x23')](function(_0xc1aa13){if(!_0xc1aa13[_0x770b('0x39')]){_0x2589f1=0x0;}else{_0x2589f1=_0xc1aa13[0x0][_0x770b('0x1c')]||0x0;}return dbH[_0x770b('0x82')][_0x770b('0x33')](_0x2b6a51[_0x770b('0x81')](),{'type':dbH['sequelize'][_0x770b('0x83')][_0x770b('0x84')]});})[_0x770b('0x23')](function(_0x94aeb2){return{'rows':_0x94aeb2||[],'count':_0x2589f1};});}});}exports[_0x770b('0x9d')]=function(_0x1f00f6,_0x253d29){return runReport(_0x1f00f6[_0x770b('0x48')],_0x1f00f6[_0x770b('0x33')],_0x1f00f6['options'])[_0x770b('0x23')](respondWithResult(_0x253d29,null))[_0x770b('0x4a')](handleError(_0x253d29,null));};exports[_0x770b('0x9e')]=runReport;exports['query']=function(_0x613684,_0x20d24e){var _0x4cf296=0xa;var _0x3885a9=[_0x770b('0x55'),_0x770b('0x56'),_0x770b('0x57'),_0x770b('0x58')];var _0x4e866b={'SUM':'SUM(%s)','COUNT':_0x770b('0x5a'),'COUNT DISTINCT':_0x770b('0x5b'),'MAX':_0x770b('0x85'),'MIN':'MIN(%s)','AVG':_0x770b('0x5d'),'GROUP_CONCAT':_0x770b('0x5e'),'GROUP_CONCAT ASC':_0x770b('0x5f'),'GROUP_CONCAT DESC':_0x770b('0x60')};var _0x37f7e6={'SEC_TO_TIME':_0x770b('0x61'),'DATE':_0x770b('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x770b('0x64')};var _0x6176bb=function(_0xa2ac9){return!_['includes']([_0x770b('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x770b('0x67')],_0xa2ac9);};var _0x3c9858=function(_0xefb9cc){if(!_0xefb9cc||!_0xefb9cc[_0x770b('0x68')][_0x770b('0x39')]){return'';}for(var _0x2924d4='(',_0x49dc60=0x0;_0x49dc60<_0xefb9cc[_0x770b('0x68')][_0x770b('0x39')];_0x49dc60+=0x1){_0x49dc60>0x0&&(_0x2924d4+='\x20'+_0xefb9cc[_0x770b('0x9f')]+'\x20');_0x2924d4+=_0xefb9cc[_0x770b('0x68')][_0x49dc60][_0x770b('0x69')]?_0x3c9858(_0xefb9cc[_0x770b('0x68')][_0x49dc60][_0x770b('0x69')]):_0xefb9cc[_0x770b('0x68')][_0x49dc60]['field']+'\x20'+_0xefb9cc['rules'][_0x49dc60][_0x770b('0x6a')]+(_0x6176bb(_0xefb9cc[_0x770b('0x68')][_0x49dc60]['condition'])?'\x20'+_0xefb9cc[_0x770b('0x68')][_0x49dc60]['value']:'');}return _0x2924d4+')';};var _0xdcca37={'where':{'id':_0x613684[_0x770b('0x48')]['id']}},_0x2fc808,_0x4f493f,_0x94cda9,_0x24583f,_0x2d55e9;_0xdcca37=_['merge']({},_0xdcca37,_0x613684['options']);return db[_0x770b('0x2e')][_0x770b('0x49')](_0xdcca37)[_0x770b('0x23')](function(_0x14465b){if(_0x14465b){_0x2fc808=_0x14465b;return _0x14465b[_0x770b('0x87')]();}return null;})[_0x770b('0x23')](function(_0x212b7e){if(_0x212b7e){if(!_0x212b7e[_0x770b('0x39')]){throw new db[(_0x770b('0x6b'))][(_0x770b('0x88'))](_0x770b('0x6c'),0x193);}_0x4f493f=_0x212b7e;return db[_0x770b('0x6d')][_0x770b('0x46')]({'raw':!![]});}return null;})[_0x770b('0x23')](function(_0x26c4dc){if(_0x26c4dc){_0x94cda9=_[_0x770b('0x6e')](_0x26c4dc,'id');var _0x4450e2;var _0x53f3b1=squel[_0x770b('0x6f')]();_0x53f3b1[_0x770b('0x89')](_0x2fc808[_0x770b('0x70')]);for(var _0x20c286=0x0;_0x20c286<_0x4f493f[_0x770b('0x39')];_0x20c286+=0x1){_0x4450e2=_0x4f493f[_0x20c286][_0x770b('0x8a')]?_0x94cda9[_0x4f493f[_0x20c286]['MetricId']][_0x770b('0x8b')]:_0x4f493f[_0x20c286][_0x770b('0x71')];_0x4450e2=_0x4f493f[_0x20c286][_0x770b('0x72')]?_['replace'](_0x4e866b[_0x4f493f[_0x20c286][_0x770b('0x72')]],'%s',_0x4450e2):_0x4450e2;_0x4450e2=_0x4f493f[_0x20c286][_0x770b('0x74')]?_[_0x770b('0x73')](_0x37f7e6[_0x4f493f[_0x20c286][_0x770b('0x74')]],'%s',_0x4450e2):_0x4450e2;if(_0x4f493f[_0x20c286][_0x770b('0x8c')]){_0x53f3b1['group'](_0x4450e2);}_0x4f493f[_0x20c286][_0x770b('0x75')]&&_0x53f3b1[_0x770b('0x3b')](_0x4450e2,_0x4f493f[_0x20c286]['orderBy']===_0x770b('0x76')?![]:!![]);_0x53f3b1[_0x770b('0x71')](_0x4450e2,_0x4f493f[_0x20c286][_0x770b('0x77')]||_0x4450e2);}if(_0x2fc808[_0x770b('0x78')]){_0x2fc808[_0x770b('0x78')]=JSON['parse'](_0x2fc808[_0x770b('0x78')]);for(var _0x316c1a=0x0;_0x316c1a<_0x2fc808['joins'][_0x770b('0x39')];_0x316c1a+=0x1){if(_0x2fc808[_0x770b('0x78')][_0x316c1a][_0x770b('0x41')]&&_[_0x770b('0x7a')](_0x3885a9,_0x2fc808[_0x770b('0x78')][_0x316c1a][_0x770b('0x41')])&&_0x2fc808[_0x770b('0x78')][_0x316c1a][_0x770b('0x7b')]&&_0x2fc808[_0x770b('0x78')][_0x316c1a][_0x770b('0x7c')]&&_0x2fc808[_0x770b('0x78')][_0x316c1a]['foreignKey']){_0x53f3b1[_0x2fc808['joins'][_0x316c1a][_0x770b('0x41')]](_0x2fc808[_0x770b('0x78')][_0x316c1a][_0x770b('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2fc808[_0x770b('0x70')],_0x2fc808[_0x770b('0x78')][_0x316c1a]['parentKey'],_0x2fc808[_0x770b('0x78')][_0x316c1a][_0x770b('0x7c')],_0x2fc808['joins'][_0x316c1a][_0x770b('0x7d')]));}}}if(_0x2fc808[_0x770b('0x7e')]){_0x2fc808[_0x770b('0x7e')]=JSON[_0x770b('0x79')](_0x2fc808['conditions']);_0x53f3b1[_0x770b('0x3d')](_0x3c9858(_0x2fc808[_0x770b('0x7e')][_0x770b('0x69')]));}_0x2d55e9=_0x53f3b1[_0x770b('0x7f')]();_0x53f3b1[_0x770b('0x1b')](_0x4cf296);_0x53f3b1[_0x770b('0x19')](0x0);logger[_0x770b('0x80')]('Limited\x20Query:',_0x53f3b1[_0x770b('0x81')]());return dbH['sequelize'][_0x770b('0x33')](_0x53f3b1['toString'](),{'type':dbH[_0x770b('0x82')][_0x770b('0x83')][_0x770b('0x84')]});}})['then'](function(){return{'sql':_0x2d55e9[_0x770b('0x81')]()};})[_0x770b('0x23')](respondWithResult(_0x20d24e,null))[_0x770b('0x4a')](handleError(_0x20d24e,null));}; \ No newline at end of file +var _0x26e4=['operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','parse','joins','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','getFields','Please\x20insert\x20at\x20least\x20one\x20field','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','CustomReports','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','then','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','DATE(%s)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules'];(function(_0x4d27c0,_0x555ad3){var _0x4c948e=function(_0xdaaa3e){while(--_0xdaaa3e){_0x4d27c0['push'](_0x4d27c0['shift']());}};_0x4c948e(++_0x555ad3);}(_0x26e4,0xec));var _0x426e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x26e4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x426e('0x0'));var zipdir=require(_0x426e('0x1'));var jsonpatch=require(_0x426e('0x2'));var rp=require(_0x426e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x426e('0x4'));var util=require(_0x426e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x426e('0x6'));var ejs=require(_0x426e('0x7'));var fs=require('fs');var fs_extra=require(_0x426e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x426e('0x9'));var deskjs=require(_0x426e('0xa'));var toCsv=require(_0x426e('0x6'));var querystring=require(_0x426e('0xb'));var Papa=require('papaparse');var Redis=require(_0x426e('0xc'));var authService=require(_0x426e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x426e('0xe'));var hardwareService=require(_0x426e('0xf'));var logger=require(_0x426e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x426e('0x11'));var db=require(_0x426e('0x12'))['db'];var dbH=require(_0x426e('0x12'))[_0x426e('0x13')];function respondWithStatusCode(_0x870370,_0x3ee646){_0x3ee646=_0x3ee646||0xcc;return function(_0x42b9a2){if(_0x42b9a2){return _0x870370[_0x426e('0x14')](_0x3ee646);}return _0x870370[_0x426e('0x15')](_0x3ee646)[_0x426e('0x16')]();};}function respondWithResult(_0x5d1113,_0x128ea1){_0x128ea1=_0x128ea1||0xc8;return function(_0x21d12d){if(_0x21d12d){return _0x5d1113[_0x426e('0x15')](_0x128ea1)['json'](_0x21d12d);}};}function respondWithFilteredResult(_0x263a6e,_0x5e5a15){return function(_0x2981d6){if(_0x2981d6){var _0x4ea621=typeof _0x5e5a15[_0x426e('0x17')]===_0x426e('0x18')&&typeof _0x5e5a15[_0x426e('0x19')]===_0x426e('0x18');var _0x59e6d6=_0x2981d6['count'];var _0x3cd9b5=_0x4ea621?0x0:_0x5e5a15['offset'];var _0x2c2a05=_0x4ea621?_0x2981d6[_0x426e('0x1a')]:_0x5e5a15[_0x426e('0x17')]+_0x5e5a15['limit'];var _0x2df9da;if(_0x2c2a05>=_0x59e6d6){_0x2c2a05=_0x59e6d6;_0x2df9da=0xc8;}else{_0x2df9da=0xce;}_0x263a6e[_0x426e('0x15')](_0x2df9da);return _0x263a6e[_0x426e('0x1b')](_0x426e('0x1c'),_0x3cd9b5+'-'+_0x2c2a05+'/'+_0x59e6d6)[_0x426e('0x1d')](_0x2981d6);}return null;};}function patchUpdates(_0x3ad2e1){return function(_0x53020f){try{jsonpatch[_0x426e('0x1e')](_0x53020f,_0x3ad2e1,!![]);}catch(_0x602e50){return BPromise['reject'](_0x602e50);}return _0x53020f[_0x426e('0x1f')]();};}function saveUpdates(_0x5df0f1,_0x42ad88){return function(_0x2cae41){if(_0x2cae41){return _0x2cae41['update'](_0x5df0f1)['then'](function(_0x5e6108){return _0x5e6108;});}return null;};}function removeEntity(_0x2cdc76,_0x3beac3){return function(_0x478d2e){if(_0x478d2e){return _0x478d2e[_0x426e('0x20')]()['then'](function(){var _0x51c730=_0x478d2e['get']({'plain':!![]});var _0x28cac6=_0x426e('0x21');return db['UserProfileResource'][_0x426e('0x20')]({'where':{'type':_0x28cac6,'resourceId':_0x51c730['id']}})['then'](function(){return _0x478d2e;});})['then'](function(){_0x2cdc76[_0x426e('0x15')](0xcc)[_0x426e('0x16')]();});}};}function handleEntityNotFound(_0x58223b,_0x3de0a6){return function(_0x5d6252){if(!_0x5d6252){_0x58223b[_0x426e('0x14')](0x194);}return _0x5d6252;};}function handleError(_0x91fde4,_0x50c510){_0x50c510=_0x50c510||0x1f4;return function(_0x582d91){logger['error'](_0x582d91[_0x426e('0x22')]);if(_0x582d91['name']){delete _0x582d91[_0x426e('0x23')];}_0x91fde4[_0x426e('0x15')](_0x50c510)[_0x426e('0x24')](_0x582d91);};}exports[_0x426e('0x25')]=function(_0x56b09a,_0x2a337b){var _0x2e9330={},_0x447160={},_0xa14e20={'count':0x0,'rows':[]};var _0x38170c=_[_0x426e('0x26')](db[_0x426e('0x27')]['rawAttributes'],function(_0x3c5592){return{'name':_0x3c5592[_0x426e('0x28')],'type':_0x3c5592[_0x426e('0x29')]['key']};});_0x447160[_0x426e('0x2a')]=_[_0x426e('0x26')](_0x38170c,_0x426e('0x23'));_0x447160[_0x426e('0x2b')]=_[_0x426e('0x2c')](_0x56b09a[_0x426e('0x2b')]);_0x447160[_0x426e('0x2d')]=_[_0x426e('0x2e')](_0x447160['model'],_0x447160[_0x426e('0x2b')]);_0x2e9330['attributes']=_[_0x426e('0x2e')](_0x447160[_0x426e('0x2a')],qs[_0x426e('0x2f')](_0x56b09a[_0x426e('0x2b')][_0x426e('0x2f')]));_0x2e9330[_0x426e('0x30')]=_0x2e9330[_0x426e('0x30')][_0x426e('0x31')]?_0x2e9330['attributes']:_0x447160[_0x426e('0x2a')];if(!_0x56b09a[_0x426e('0x2b')][_0x426e('0x32')]('nolimit')){_0x2e9330['limit']=qs['limit'](_0x56b09a['query']['limit']);_0x2e9330[_0x426e('0x17')]=qs[_0x426e('0x17')](_0x56b09a[_0x426e('0x2b')]['offset']);}_0x2e9330['order']=qs['sort'](_0x56b09a[_0x426e('0x2b')]['sort']);_0x2e9330[_0x426e('0x33')]=qs[_0x426e('0x2d')](_[_0x426e('0x34')](_0x56b09a['query'],_0x447160[_0x426e('0x2d')]),_0x38170c);if(_0x56b09a[_0x426e('0x2b')][_0x426e('0x35')]){_0x2e9330[_0x426e('0x33')]=_['merge'](_0x2e9330[_0x426e('0x33')],{'$or':_['map'](_0x38170c,function(_0x2fd673){if(_0x2fd673[_0x426e('0x29')]!==_0x426e('0x36')){var _0x337d0b={};_0x337d0b[_0x2fd673['name']]={'$like':'%'+_0x56b09a[_0x426e('0x2b')][_0x426e('0x35')]+'%'};return _0x337d0b;}})});}_0x2e9330=_[_0x426e('0x37')]({},_0x2e9330,_0x56b09a[_0x426e('0x38')]);var _0x19cdef={'where':_0x2e9330[_0x426e('0x33')]};return db[_0x426e('0x27')][_0x426e('0x1a')](_0x19cdef)['then'](function(_0x5cfd96){_0xa14e20['count']=_0x5cfd96;if(_0x56b09a[_0x426e('0x2b')][_0x426e('0x39')]){_0x2e9330[_0x426e('0x3a')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x426e('0x3b')](_0x2e9330);})['then'](function(_0x28d05e){_0xa14e20[_0x426e('0x3c')]=_0x28d05e;return _0xa14e20;})[_0x426e('0x3d')](respondWithFilteredResult(_0x2a337b,_0x2e9330))[_0x426e('0x3e')](handleError(_0x2a337b,null));};exports[_0x426e('0x3f')]=function(_0x2f05ad,_0x160c5f){var _0xa4dd05={'raw':![],'where':{'id':_0x2f05ad['params']['id']}},_0x1ebe7={};_0x1ebe7[_0x426e('0x2a')]=_['keys'](db[_0x426e('0x27')][_0x426e('0x40')]);_0x1ebe7['query']=_[_0x426e('0x2c')](_0x2f05ad[_0x426e('0x2b')]);_0x1ebe7[_0x426e('0x2d')]=_[_0x426e('0x2e')](_0x1ebe7[_0x426e('0x2a')],_0x1ebe7['query']);_0xa4dd05['attributes']=_['intersection'](_0x1ebe7[_0x426e('0x2a')],qs[_0x426e('0x2f')](_0x2f05ad[_0x426e('0x2b')][_0x426e('0x2f')]));_0xa4dd05[_0x426e('0x30')]=_0xa4dd05[_0x426e('0x30')][_0x426e('0x31')]?_0xa4dd05[_0x426e('0x30')]:_0x1ebe7[_0x426e('0x2a')];if(_0x2f05ad[_0x426e('0x2b')][_0x426e('0x39')]){_0xa4dd05[_0x426e('0x3a')]=[{'all':!![]}];}_0xa4dd05=_[_0x426e('0x37')]({},_0xa4dd05,_0x2f05ad['options']);return db[_0x426e('0x27')][_0x426e('0x41')](_0xa4dd05)[_0x426e('0x3d')](handleEntityNotFound(_0x160c5f,null))[_0x426e('0x3d')](respondWithResult(_0x160c5f,null))[_0x426e('0x3e')](handleError(_0x160c5f,null));};exports[_0x426e('0x42')]=function(_0x411ba6,_0x22c152){return db[_0x426e('0x27')]['create'](_0x411ba6[_0x426e('0x43')],{})[_0x426e('0x3d')](function(_0x2c479c){var _0x4747ee=_0x411ba6[_0x426e('0x44')][_0x426e('0x45')]({'plain':!![]});if(!_0x4747ee)throw new Error(_0x426e('0x46'));if(_0x4747ee[_0x426e('0x47')]===_0x426e('0x44')){var _0x316f8c=_0x2c479c[_0x426e('0x45')]({'plain':!![]});var _0x2ff1e3='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x2ff1e3,'userProfileId':_0x4747ee[_0x426e('0x48')]},'raw':!![]})['then'](function(_0x3373ca){if(_0x3373ca&&_0x3373ca[_0x426e('0x49')]===0x0){return db[_0x426e('0x4a')][_0x426e('0x42')]({'name':_0x316f8c['name'],'resourceId':_0x316f8c['id'],'type':_0x426e('0x21'),'sectionId':_0x3373ca['id']},{})['then'](function(){return _0x2c479c;});}else{return _0x2c479c;}})['catch'](function(_0x36db5e){logger[_0x426e('0x4b')](_0x426e('0x4c'),_0x36db5e);throw _0x36db5e;});}return _0x2c479c;})['then'](respondWithResult(_0x22c152,0xc9))[_0x426e('0x3e')](handleError(_0x22c152,null));};exports[_0x426e('0x4d')]=function(_0x48a53b,_0x453180){if(_0x48a53b[_0x426e('0x43')]['id']){delete _0x48a53b['body']['id'];}return db[_0x426e('0x27')][_0x426e('0x41')]({'where':{'id':_0x48a53b['params']['id']}})[_0x426e('0x3d')](handleEntityNotFound(_0x453180,null))[_0x426e('0x3d')](saveUpdates(_0x48a53b[_0x426e('0x43')],null))[_0x426e('0x3d')](respondWithResult(_0x453180,null))[_0x426e('0x3e')](handleError(_0x453180,null));};exports[_0x426e('0x20')]=function(_0x5dc98d,_0x34b866){return db[_0x426e('0x27')]['find']({'where':{'id':_0x5dc98d[_0x426e('0x4e')]['id']}})[_0x426e('0x3d')](handleEntityNotFound(_0x34b866,null))[_0x426e('0x3d')](removeEntity(_0x34b866,null))[_0x426e('0x3e')](handleError(_0x34b866,null));};exports[_0x426e('0x4f')]=function(_0x2ea407,_0x5b5084){var _0x30befc=0xa;var _0x290474=[_0x426e('0x50'),_0x426e('0x51'),_0x426e('0x52'),_0x426e('0x53')];var _0x3067cb={'SUM':'SUM(%s)','COUNT':_0x426e('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x426e('0x55'),'MIN':_0x426e('0x56'),'AVG':_0x426e('0x57'),'GROUP_CONCAT':_0x426e('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x33d0ef={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x426e('0x59'),'HOUR':_0x426e('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x19d524=function(_0xdd7d62){return!_['includes']([_0x426e('0x5b'),_0x426e('0x5c'),_0x426e('0x5d'),_0x426e('0x5e')],_0xdd7d62);};var _0x5c732c=function(_0x4b0257){if(!_0x4b0257||!_0x4b0257[_0x426e('0x5f')][_0x426e('0x31')]){return'';}for(var _0x56791f='(',_0x25d65c=0x0;_0x25d65c<_0x4b0257[_0x426e('0x5f')]['length'];_0x25d65c+=0x1){_0x25d65c>0x0&&(_0x56791f+='\x20'+_0x4b0257[_0x426e('0x60')]+'\x20');_0x56791f+=_0x4b0257['rules'][_0x25d65c]['group']?_0x5c732c(_0x4b0257[_0x426e('0x5f')][_0x25d65c][_0x426e('0x61')]):_0x4b0257['rules'][_0x25d65c][_0x426e('0x62')]+'\x20'+_0x4b0257['rules'][_0x25d65c][_0x426e('0x63')]+(_0x19d524(_0x4b0257[_0x426e('0x5f')][_0x25d65c]['condition'])?'\x20'+_0x4b0257[_0x426e('0x5f')][_0x25d65c][_0x426e('0x64')]:'');}return _0x56791f+')';};var _0x28c29c={'where':{'id':_0x2ea407['params']['id']}},_0x2900cc,_0x27dd8b,_0x52f8a2,_0x361c90,_0x5b8388;_0x28c29c=_[_0x426e('0x37')]({},_0x28c29c,_0x2ea407['options']);return db['AnalyticCustomReport'][_0x426e('0x41')](_0x28c29c)[_0x426e('0x3d')](function(_0x90f53a){if(_0x90f53a){_0x2900cc=_0x90f53a;return _0x90f53a['getFields']();}return null;})[_0x426e('0x3d')](function(_0x460c18){if(_0x460c18){if(!_0x460c18['length']){throw new db[(_0x426e('0x65'))][(_0x426e('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x27dd8b=_0x460c18;return db[_0x426e('0x67')][_0x426e('0x3b')]({'raw':!![]});}return null;})[_0x426e('0x3d')](function(_0x1d0586){if(_0x1d0586){_0x52f8a2=_[_0x426e('0x68')](_0x1d0586,'id');var _0x4fdcb6;var _0x346585=squel[_0x426e('0x69')]();_0x346585[_0x426e('0x6a')](_0x2900cc[_0x426e('0x6b')]);for(var _0x4ed96c=0x0;_0x4ed96c<_0x27dd8b['length'];_0x4ed96c+=0x1){_0x4fdcb6=_0x27dd8b[_0x4ed96c]['MetricId']?_0x52f8a2[_0x27dd8b[_0x4ed96c][_0x426e('0x6c')]][_0x426e('0x6d')]:_0x27dd8b[_0x4ed96c][_0x426e('0x62')];_0x4fdcb6=_0x27dd8b[_0x4ed96c][_0x426e('0x6e')]?_[_0x426e('0x6f')](_0x3067cb[_0x27dd8b[_0x4ed96c][_0x426e('0x6e')]],'%s',_0x4fdcb6):_0x4fdcb6;_0x4fdcb6=_0x27dd8b[_0x4ed96c]['format']?_[_0x426e('0x6f')](_0x33d0ef[_0x27dd8b[_0x4ed96c][_0x426e('0x70')]],'%s',_0x4fdcb6):_0x4fdcb6;if(_0x27dd8b[_0x4ed96c][_0x426e('0x71')]){_0x346585[_0x426e('0x61')](_0x4fdcb6);}_0x27dd8b[_0x4ed96c]['orderBy']&&_0x346585[_0x426e('0x72')](_0x4fdcb6,_0x27dd8b[_0x4ed96c][_0x426e('0x73')]===_0x426e('0x74')?![]:!![]);_0x346585['field'](_0x4fdcb6,_0x27dd8b[_0x4ed96c][_0x426e('0x75')]||_0x4fdcb6);}if(_0x2900cc['joins']){_0x2900cc['joins']=JSON[_0x426e('0x76')](_0x2900cc[_0x426e('0x77')]);for(var _0x357a79=0x0;_0x357a79<_0x2900cc[_0x426e('0x77')][_0x426e('0x31')];_0x357a79+=0x1){if(_0x2900cc[_0x426e('0x77')][_0x357a79][_0x426e('0x29')]&&_[_0x426e('0x78')](_0x290474,_0x2900cc[_0x426e('0x77')][_0x357a79][_0x426e('0x29')])&&_0x2900cc[_0x426e('0x77')][_0x357a79][_0x426e('0x79')]&&_0x2900cc['joins'][_0x357a79][_0x426e('0x7a')]&&_0x2900cc['joins'][_0x357a79][_0x426e('0x7b')]){_0x346585[_0x2900cc[_0x426e('0x77')][_0x357a79][_0x426e('0x29')]](_0x2900cc[_0x426e('0x77')][_0x357a79][_0x426e('0x7a')],null,util[_0x426e('0x70')](_0x426e('0x7c'),_0x2900cc['table'],_0x2900cc[_0x426e('0x77')][_0x357a79]['parentKey'],_0x2900cc[_0x426e('0x77')][_0x357a79]['foreignTable'],_0x2900cc[_0x426e('0x77')][_0x357a79][_0x426e('0x7b')]));}}}if(_0x2900cc['conditions']){_0x2900cc[_0x426e('0x7d')]=JSON[_0x426e('0x76')](_0x2900cc['conditions']);_0x346585[_0x426e('0x33')](_0x5c732c(_0x2900cc[_0x426e('0x7d')][_0x426e('0x61')]));}_0x5b8388=_0x346585[_0x426e('0x7e')]();_0x346585[_0x426e('0x19')](_0x30befc);_0x346585[_0x426e('0x17')](0x0);logger[_0x426e('0x7f')](_0x426e('0x80'),_0x346585[_0x426e('0x81')]());return dbH[_0x426e('0x82')][_0x426e('0x2b')](_0x346585[_0x426e('0x81')](),{'type':dbH[_0x426e('0x82')][_0x426e('0x83')][_0x426e('0x84')]});}})[_0x426e('0x3d')](respondWithResult(_0x5b5084,null))['catch'](handleError(_0x5b5084,null));};function runReport(_0x133dfc,_0x1be878,_0x3e3ff5){var _0x3fd390=_0x1be878['name'];var _0x1005e5=0xa;var _0x3af486=['join',_0x426e('0x51'),_0x426e('0x52'),_0x426e('0x53')];var _0x46ef68={'SUM':_0x426e('0x85'),'COUNT':_0x426e('0x54'),'COUNT DISTINCT':_0x426e('0x86'),'MAX':_0x426e('0x55'),'MIN':_0x426e('0x56'),'AVG':_0x426e('0x57'),'GROUP_CONCAT':_0x426e('0x58'),'GROUP_CONCAT ASC':_0x426e('0x87'),'GROUP_CONCAT DESC':_0x426e('0x88')};var _0x3efffb={'SEC_TO_TIME':_0x426e('0x89'),'DATE':_0x426e('0x59'),'HOUR':_0x426e('0x5a'),'ROUND':_0x426e('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4c23a4=function(_0x406462){return!_['includes'](['IS\x20NULL',_0x426e('0x5c'),_0x426e('0x5d'),'IS\x20NOT\x20EMPTY'],_0x406462);};var _0xc6885=function(_0x22ae68){if(!_0x22ae68||!_0x22ae68['rules'][_0x426e('0x31')]){return'';}for(var _0x316766='(',_0x29f1a9=0x0;_0x29f1a9<_0x22ae68[_0x426e('0x5f')]['length'];_0x29f1a9+=0x1){_0x29f1a9>0x0&&(_0x316766+='\x20'+_0x22ae68['operator']+'\x20');_0x316766+=_0x22ae68['rules'][_0x29f1a9][_0x426e('0x61')]?_0xc6885(_0x22ae68[_0x426e('0x5f')][_0x29f1a9][_0x426e('0x61')]):_0x22ae68[_0x426e('0x5f')][_0x29f1a9][_0x426e('0x62')]+'\x20'+_0x22ae68[_0x426e('0x5f')][_0x29f1a9][_0x426e('0x63')]+(_0x4c23a4(_0x22ae68[_0x426e('0x5f')][_0x29f1a9][_0x426e('0x63')])?'\x20'+_0x22ae68['rules'][_0x29f1a9][_0x426e('0x64')]:'');}return _0x316766+')';};var _0x2862d6={'where':{'id':_0x133dfc['id']}},_0x27c0ca,_0x3e04dd,_0x53bb59,_0x1becec,_0x403bb5;_0x2862d6=_[_0x426e('0x37')]({},_0x2862d6,_0x3e3ff5);return db[_0x426e('0x27')]['find'](_0x2862d6)[_0x426e('0x3d')](function(_0x4cc5d9){if(_0x4cc5d9){_0x27c0ca=_0x4cc5d9;return _0x4cc5d9[_0x426e('0x8b')]();}return null;})['then'](function(_0x1a50b2){if(_0x1a50b2){if(!_0x1a50b2[_0x426e('0x31')]){throw new db[(_0x426e('0x65'))]['ValidationErrorItem'](_0x426e('0x8c'),0x193);}_0x3e04dd=_0x1a50b2;return db[_0x426e('0x67')][_0x426e('0x3b')]({'raw':!![]});}return null;})['then'](function(_0x9e0bc5){if(_0x9e0bc5){_0x53bb59=_[_0x426e('0x68')](_0x9e0bc5,'id');var _0x3bac0d;var _0xec0149=squel[_0x426e('0x69')]();_0xec0149['from'](_0x27c0ca['table']);for(var _0x503567=0x0;_0x503567<_0x3e04dd[_0x426e('0x31')];_0x503567+=0x1){_0x3bac0d=_0x3e04dd[_0x503567]['MetricId']?_0x53bb59[_0x3e04dd[_0x503567]['MetricId']][_0x426e('0x6d')]:_0x3e04dd[_0x503567][_0x426e('0x62')];_0x3bac0d=_0x3e04dd[_0x503567][_0x426e('0x6e')]?_['replace'](_0x46ef68[_0x3e04dd[_0x503567]['function']],'%s',_0x3bac0d):_0x3bac0d;_0x3bac0d=_0x3e04dd[_0x503567]['format']?_[_0x426e('0x6f')](_0x3efffb[_0x3e04dd[_0x503567][_0x426e('0x70')]],'%s',_0x3bac0d):_0x3bac0d;if(_0x3e04dd[_0x503567][_0x426e('0x71')]){_0xec0149[_0x426e('0x61')](_0x3bac0d);}_0x3e04dd[_0x503567]['orderBy']&&_0xec0149['order'](_0x3bac0d,_0x3e04dd[_0x503567][_0x426e('0x73')]===_0x426e('0x74')?![]:!![]);_0xec0149['field'](_0x3bac0d,_0x3e04dd[_0x503567][_0x426e('0x75')]||_0x3bac0d);}if(_0x27c0ca[_0x426e('0x77')]){_0x27c0ca[_0x426e('0x77')]=JSON[_0x426e('0x76')](_0x27c0ca[_0x426e('0x77')]);for(var _0x2bed88=0x0;_0x2bed88<_0x27c0ca[_0x426e('0x77')][_0x426e('0x31')];_0x2bed88+=0x1){if(_0x27c0ca[_0x426e('0x77')][_0x2bed88][_0x426e('0x29')]&&_[_0x426e('0x78')](_0x3af486,_0x27c0ca[_0x426e('0x77')][_0x2bed88][_0x426e('0x29')])&&_0x27c0ca[_0x426e('0x77')][_0x2bed88][_0x426e('0x79')]&&_0x27c0ca[_0x426e('0x77')][_0x2bed88][_0x426e('0x7a')]&&_0x27c0ca[_0x426e('0x77')][_0x2bed88][_0x426e('0x7b')]){_0xec0149[_0x27c0ca['joins'][_0x2bed88][_0x426e('0x29')]](_0x27c0ca[_0x426e('0x77')][_0x2bed88]['foreignTable'],null,util[_0x426e('0x70')](_0x426e('0x7c'),_0x27c0ca[_0x426e('0x6b')],_0x27c0ca[_0x426e('0x77')][_0x2bed88][_0x426e('0x79')],_0x27c0ca['joins'][_0x2bed88][_0x426e('0x7a')],_0x27c0ca[_0x426e('0x77')][_0x2bed88][_0x426e('0x7b')]));}}}if(_0x27c0ca[_0x426e('0x7d')]){_0x27c0ca['conditions']=JSON[_0x426e('0x76')](_0x27c0ca[_0x426e('0x7d')]);_0xec0149[_0x426e('0x33')](_0xc6885(_0x27c0ca['conditions'][_0x426e('0x61')]));}_0x403bb5=_0xec0149[_0x426e('0x7e')]();_0xec0149[_0x426e('0x19')](_0x1005e5);_0xec0149[_0x426e('0x17')](0x0);return;}})[_0x426e('0x3d')](function(){if(_0x1be878['output']===_0x426e('0x8d')){return null;}var _0x575889=_[_0x426e('0x37')](_0x1be878,{'name':_0x1be878[_0x426e('0x8e')]||_0x1be878[_0x426e('0x23')]||_0x27c0ca[_0x426e('0x23')],'basename':_0x3fd390,'savename':util[_0x426e('0x70')](_0x426e('0x8f'),_0x1be878['name']||_0x27c0ca[_0x426e('0x23')],require(_0x426e('0x90'))[_0x426e('0x91')](0x4),_0x1be878[_0x426e('0x92')]||_0x426e('0x93')),'reportId':_0x27c0ca['id'],'reportType':_0x426e('0x94')});return db['AnalyticExtractedReport']['create'](_0x575889,{'raw':!![]});})[_0x426e('0x3d')](function(_0x5ab5e3){if(_0x27c0ca[_0x426e('0x6b')]===_0x426e('0x95')){_0x403bb5[_0x426e('0x33')](_0x27c0ca['table']+_0x426e('0x96'),_0x1be878[_0x426e('0x97')],_0x1be878[_0x426e('0x98')]);}else{_0x403bb5['where'](_0x27c0ca[_0x426e('0x6b')]+_0x426e('0x99'),_0x1be878[_0x426e('0x97')],_0x1be878[_0x426e('0x98')]);}if(_0x5ab5e3){logger[_0x426e('0x9a')](_0x426e('0x9b'),_0x403bb5[_0x426e('0x81')]());require(_0x426e('0x9c'))[_0x426e('0x9d')](path[_0x426e('0x50')](__dirname,_0x426e('0x9e'),_0x5ab5e3[_0x426e('0x92')]),[_0x5ab5e3['id'],_0x403bb5[_0x426e('0x81')](),path[_0x426e('0x50')](__dirname,_0x426e('0x9f'),_0x5ab5e3[_0x426e('0xa0')]),_0x3fd390]);return _0x5ab5e3;}else{var _0x18275f=squel['select']();_0x18275f[_0x426e('0x6a')]('('+_0x403bb5[_0x426e('0x81')]()+')',_0x426e('0xa1'));_0x18275f['field'](_0x426e('0xa2'),_0x426e('0x1a'));_0x403bb5[_0x426e('0x19')](_0x1be878[_0x426e('0x19')]||_0x1005e5);_0x403bb5['offset'](_0x1be878['offset']||0x0);return dbH['sequelize'][_0x426e('0x2b')](_0x18275f['toString'](),{'type':dbH[_0x426e('0x82')][_0x426e('0x83')][_0x426e('0x84')]})['then'](function(_0x1c33aa){if(!_0x1c33aa[_0x426e('0x31')]){_0x1becec=0x0;}else{_0x1becec=_0x1c33aa[0x0][_0x426e('0x1a')]||0x0;}return dbH[_0x426e('0x82')][_0x426e('0x2b')](_0x403bb5[_0x426e('0x81')](),{'type':dbH[_0x426e('0x82')]['QueryTypes'][_0x426e('0x84')]});})[_0x426e('0x3d')](function(_0x35a435){return{'rows':_0x35a435||[],'count':_0x1becec};});}});}exports[_0x426e('0xa3')]=function(_0x22c3bd,_0x4af756){return runReport(_0x22c3bd[_0x426e('0x4e')],_0x22c3bd[_0x426e('0x2b')],_0x22c3bd[_0x426e('0x38')])[_0x426e('0x3d')](respondWithResult(_0x4af756,null))['catch'](handleError(_0x4af756,null));};exports[_0x426e('0xa4')]=runReport;exports[_0x426e('0x2b')]=function(_0xe6c293,_0x367572){var _0x438514=0xa;var _0x2fe6ba=[_0x426e('0x50'),_0x426e('0x51'),'right_join',_0x426e('0x53')];var _0x5de816={'SUM':_0x426e('0x85'),'COUNT':_0x426e('0x54'),'COUNT DISTINCT':_0x426e('0x86'),'MAX':_0x426e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x426e('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x509e9b={'SEC_TO_TIME':_0x426e('0x89'),'DATE':_0x426e('0x59'),'HOUR':_0x426e('0x5a'),'ROUND':_0x426e('0x8a'),'UNIX_TIMESTAMP':_0x426e('0xa5')};var _0x5b3c15=function(_0x4f64ad){return!_[_0x426e('0x78')](['IS\x20NULL',_0x426e('0x5c'),_0x426e('0x5d'),'IS\x20NOT\x20EMPTY'],_0x4f64ad);};var _0x234695=function(_0x2eb42c){if(!_0x2eb42c||!_0x2eb42c['rules'][_0x426e('0x31')]){return'';}for(var _0x7ea6a6='(',_0x23c870=0x0;_0x23c870<_0x2eb42c[_0x426e('0x5f')][_0x426e('0x31')];_0x23c870+=0x1){_0x23c870>0x0&&(_0x7ea6a6+='\x20'+_0x2eb42c[_0x426e('0x60')]+'\x20');_0x7ea6a6+=_0x2eb42c[_0x426e('0x5f')][_0x23c870]['group']?_0x234695(_0x2eb42c[_0x426e('0x5f')][_0x23c870][_0x426e('0x61')]):_0x2eb42c[_0x426e('0x5f')][_0x23c870]['field']+'\x20'+_0x2eb42c[_0x426e('0x5f')][_0x23c870][_0x426e('0x63')]+(_0x5b3c15(_0x2eb42c[_0x426e('0x5f')][_0x23c870][_0x426e('0x63')])?'\x20'+_0x2eb42c[_0x426e('0x5f')][_0x23c870][_0x426e('0x64')]:'');}return _0x7ea6a6+')';};var _0x439b38={'where':{'id':_0xe6c293[_0x426e('0x4e')]['id']}},_0x574051,_0x215564,_0x3cd233,_0x2d959b,_0x3f6d8d;_0x439b38=_[_0x426e('0x37')]({},_0x439b38,_0xe6c293[_0x426e('0x38')]);return db[_0x426e('0x27')]['find'](_0x439b38)[_0x426e('0x3d')](function(_0x9e1ad8){if(_0x9e1ad8){_0x574051=_0x9e1ad8;return _0x9e1ad8[_0x426e('0x8b')]();}return null;})[_0x426e('0x3d')](function(_0x400602){if(_0x400602){if(!_0x400602[_0x426e('0x31')]){throw new db['Sequelize'][(_0x426e('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x215564=_0x400602;return db[_0x426e('0x67')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x58d797){if(_0x58d797){_0x3cd233=_[_0x426e('0x68')](_0x58d797,'id');var _0x352aba;var _0xb6064c=squel[_0x426e('0x69')]();_0xb6064c[_0x426e('0x6a')](_0x574051['table']);for(var _0x545f6a=0x0;_0x545f6a<_0x215564[_0x426e('0x31')];_0x545f6a+=0x1){_0x352aba=_0x215564[_0x545f6a][_0x426e('0x6c')]?_0x3cd233[_0x215564[_0x545f6a][_0x426e('0x6c')]][_0x426e('0x6d')]:_0x215564[_0x545f6a][_0x426e('0x62')];_0x352aba=_0x215564[_0x545f6a][_0x426e('0x6e')]?_[_0x426e('0x6f')](_0x5de816[_0x215564[_0x545f6a]['function']],'%s',_0x352aba):_0x352aba;_0x352aba=_0x215564[_0x545f6a][_0x426e('0x70')]?_[_0x426e('0x6f')](_0x509e9b[_0x215564[_0x545f6a][_0x426e('0x70')]],'%s',_0x352aba):_0x352aba;if(_0x215564[_0x545f6a]['groupBy']){_0xb6064c['group'](_0x352aba);}_0x215564[_0x545f6a]['orderBy']&&_0xb6064c[_0x426e('0x72')](_0x352aba,_0x215564[_0x545f6a][_0x426e('0x73')]==='DESC'?![]:!![]);_0xb6064c['field'](_0x352aba,_0x215564[_0x545f6a][_0x426e('0x75')]||_0x352aba);}if(_0x574051[_0x426e('0x77')]){_0x574051[_0x426e('0x77')]=JSON[_0x426e('0x76')](_0x574051[_0x426e('0x77')]);for(var _0x4d6f3f=0x0;_0x4d6f3f<_0x574051[_0x426e('0x77')][_0x426e('0x31')];_0x4d6f3f+=0x1){if(_0x574051['joins'][_0x4d6f3f]['type']&&_[_0x426e('0x78')](_0x2fe6ba,_0x574051[_0x426e('0x77')][_0x4d6f3f][_0x426e('0x29')])&&_0x574051[_0x426e('0x77')][_0x4d6f3f][_0x426e('0x79')]&&_0x574051['joins'][_0x4d6f3f]['foreignTable']&&_0x574051['joins'][_0x4d6f3f]['foreignKey']){_0xb6064c[_0x574051[_0x426e('0x77')][_0x4d6f3f][_0x426e('0x29')]](_0x574051[_0x426e('0x77')][_0x4d6f3f]['foreignTable'],null,util[_0x426e('0x70')](_0x426e('0x7c'),_0x574051[_0x426e('0x6b')],_0x574051['joins'][_0x4d6f3f][_0x426e('0x79')],_0x574051[_0x426e('0x77')][_0x4d6f3f][_0x426e('0x7a')],_0x574051[_0x426e('0x77')][_0x4d6f3f][_0x426e('0x7b')]));}}}if(_0x574051[_0x426e('0x7d')]){_0x574051[_0x426e('0x7d')]=JSON[_0x426e('0x76')](_0x574051[_0x426e('0x7d')]);_0xb6064c[_0x426e('0x33')](_0x234695(_0x574051['conditions'][_0x426e('0x61')]));}_0x3f6d8d=_0xb6064c[_0x426e('0x7e')]();_0xb6064c[_0x426e('0x19')](_0x438514);_0xb6064c[_0x426e('0x17')](0x0);logger[_0x426e('0x7f')](_0x426e('0x80'),_0xb6064c[_0x426e('0x81')]());return dbH[_0x426e('0x82')][_0x426e('0x2b')](_0xb6064c['toString'](),{'type':dbH[_0x426e('0x82')][_0x426e('0x83')][_0x426e('0x84')]});}})[_0x426e('0x3d')](function(){return{'sql':_0x3f6d8d[_0x426e('0x81')]()};})[_0x426e('0x3d')](respondWithResult(_0x367572,null))[_0x426e('0x3e')](handleError(_0x367572,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index aac3b96..bedf821 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 _0x56a0=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util','api','moment','bluebird'];(function(_0x5ba5ca,_0x13b6e5){var _0x80d75e=function(_0x21f1d8){while(--_0x21f1d8){_0x5ba5ca['push'](_0x5ba5ca['shift']());}};_0x80d75e(++_0x13b6e5);}(_0x56a0,0x100));var _0x056a=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0x56a0[_0x4dcecc];return _0x2aa658;};'use strict';var _=require('lodash');var util=require(_0x056a('0x0'));var logger=require('../../config/logger')(_0x056a('0x1'));var moment=require(_0x056a('0x2'));var BPromise=require(_0x056a('0x3'));var rp=require(_0x056a('0x4'));var fs=require('fs');var path=require(_0x056a('0x5'));var rimraf=require(_0x056a('0x6'));var config=require(_0x056a('0x7'));var attributes=require(_0x056a('0x8'));module[_0x056a('0x9')]=function(_0x3bf532,_0x4cd2af){return _0x3bf532[_0x056a('0xa')](_0x056a('0xb'),attributes,{'tableName':_0x056a('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x799b=['../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x799b,0x164));var _0xb799=function(_0x4596de,_0x49e8e7){_0x4596de=_0x4596de-0x0;var _0x3f2a40=_0x799b[_0x4596de];return _0x3f2a40;};'use strict';var _=require(_0xb799('0x0'));var util=require(_0xb799('0x1'));var logger=require(_0xb799('0x2'))(_0xb799('0x3'));var moment=require(_0xb799('0x4'));var BPromise=require(_0xb799('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb799('0x6'));var rimraf=require(_0xb799('0x7'));var config=require(_0xb799('0x8'));var attributes=require(_0xb799('0x9'));module[_0xb799('0xa')]=function(_0x111dad,_0x1e98b1){return _0x111dad[_0xb799('0xb')]('AnalyticCustomReport',attributes,{'tableName':_0xb799('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 950a647..d7a40ad 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 _0x3382=['util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x427da7,_0x51f105){var _0x1bd435=function(_0x381249){while(--_0x381249){_0x427da7['push'](_0x427da7['shift']());}};_0x1bd435(++_0x51f105);}(_0x3382,0xfb));var _0x2338=function(_0x5e6666,_0x1a5bdf){_0x5e6666=_0x5e6666-0x0;var _0x1869b7=_0x3382[_0x5e6666];return _0x1869b7;};'use strict';var _=require(_0x2338('0x0'));var util=require(_0x2338('0x1'));var moment=require('moment');var BPromise=require(_0x2338('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2338('0x3'));var db=require(_0x2338('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2338('0x5'))(_0x2338('0x6'));var config=require(_0x2338('0x7'));var jayson=require(_0x2338('0x8'));var client=jayson[_0x2338('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4619f0,_0x3b9021,_0x565305){return new BPromise(function(_0x15c237,_0x53e7b9){return client[_0x2338('0xa')](_0x4619f0,_0x565305)[_0x2338('0xb')](function(_0x1b9b5b){logger[_0x2338('0xc')](_0x2338('0xd'),_0x3b9021,_0x2338('0xe'));logger[_0x2338('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3b9021,_0x2338('0xe'),JSON[_0x2338('0x10')](_0x1b9b5b));if(_0x1b9b5b['error']){if(_0x1b9b5b[_0x2338('0x11')][_0x2338('0x12')]===0x1f4){logger[_0x2338('0x11')](_0x2338('0xd'),_0x3b9021,_0x1b9b5b[_0x2338('0x11')][_0x2338('0x13')]);return _0x53e7b9(_0x1b9b5b[_0x2338('0x11')][_0x2338('0x13')]);}logger[_0x2338('0x11')](_0x2338('0xd'),_0x3b9021,_0x1b9b5b[_0x2338('0x11')]['message']);return _0x15c237(_0x1b9b5b['error'][_0x2338('0x13')]);}else{logger[_0x2338('0xc')](_0x2338('0xd'),_0x3b9021,_0x2338('0xe'));_0x15c237(_0x1b9b5b['result'][_0x2338('0x13')]);}})[_0x2338('0x14')](function(_0x58674f){logger[_0x2338('0x11')](_0x2338('0xd'),_0x3b9021,_0x58674f);_0x53e7b9(_0x58674f);});});} \ No newline at end of file +var _0x6eb7=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','http','request','then'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x6eb7,0x16f));var _0x76eb=function(_0x365720,_0x315cb5){_0x365720=_0x365720-0x0;var _0x5d5890=_0x6eb7[_0x365720];return _0x5d5890;};'use strict';var _=require(_0x76eb('0x0'));var util=require(_0x76eb('0x1'));var moment=require(_0x76eb('0x2'));var BPromise=require(_0x76eb('0x3'));var rs=require(_0x76eb('0x4'));var fs=require('fs');var Redis=require(_0x76eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76eb('0x6'));var config=require(_0x76eb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf34cef,_0x45eb05,_0x5949a5){return new BPromise(function(_0x3ff71b,_0x540246){return client[_0x76eb('0x9')](_0xf34cef,_0x5949a5)[_0x76eb('0xa')](function(_0x43f98f){logger['info'](_0x76eb('0xb'),_0x45eb05,_0x76eb('0xc'));logger[_0x76eb('0xd')](_0x76eb('0xe'),_0x45eb05,_0x76eb('0xc'),JSON[_0x76eb('0xf')](_0x43f98f));if(_0x43f98f[_0x76eb('0x10')]){if(_0x43f98f[_0x76eb('0x10')][_0x76eb('0x11')]===0x1f4){logger['error'](_0x76eb('0xb'),_0x45eb05,_0x43f98f[_0x76eb('0x10')][_0x76eb('0x12')]);return _0x540246(_0x43f98f[_0x76eb('0x10')][_0x76eb('0x12')]);}logger[_0x76eb('0x10')](_0x76eb('0xb'),_0x45eb05,_0x43f98f['error'][_0x76eb('0x12')]);return _0x3ff71b(_0x43f98f[_0x76eb('0x10')][_0x76eb('0x12')]);}else{logger[_0x76eb('0x13')](_0x76eb('0xb'),_0x45eb05,_0x76eb('0xc'));_0x3ff71b(_0x43f98f[_0x76eb('0x14')][_0x76eb('0x12')]);}})['catch'](function(_0x9bda96){logger['error'](_0x76eb('0xb'),_0x45eb05,_0x9bda96);_0x540246(_0x9bda96);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 537829b..28d8738 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 _0xe330=['show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x4edb7f,_0x3b68c0){var _0x52a707=function(_0x59bc62){while(--_0x59bc62){_0x4edb7f['push'](_0x4edb7f['shift']());}};_0x52a707(++_0x3b68c0);}(_0xe330,0x1ce));var _0x0e33=function(_0x5198c7,_0x410fa0){_0x5198c7=_0x5198c7-0x0;var _0x5b2166=_0xe330[_0x5198c7];return _0x5b2166;};'use strict';var multer=require(_0x0e33('0x0'));var util=require(_0x0e33('0x1'));var path=require(_0x0e33('0x2'));var timeout=require(_0x0e33('0x3'));var express=require(_0x0e33('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0e33('0x5'));var interaction=require(_0x0e33('0x6'));var config=require(_0x0e33('0x7'));var controller=require(_0x0e33('0x8'));router[_0x0e33('0x9')]('/',auth[_0x0e33('0xa')](),controller[_0x0e33('0xb')]);router['get'](_0x0e33('0xc'),auth[_0x0e33('0xa')](),controller[_0x0e33('0xd')]);router['get'](_0x0e33('0xe'),auth['isAuthenticated'](),controller[_0x0e33('0xf')]);router[_0x0e33('0x9')](_0x0e33('0x10'),auth[_0x0e33('0xa')](),controller[_0x0e33('0x11')]);router[_0x0e33('0x9')]('/:id/query',auth[_0x0e33('0xa')](),controller[_0x0e33('0x12')]);router[_0x0e33('0x13')]('/',auth[_0x0e33('0xa')](),controller[_0x0e33('0x14')]);router[_0x0e33('0x15')](_0x0e33('0xc'),auth[_0x0e33('0xa')](),controller[_0x0e33('0x16')]);router[_0x0e33('0x17')](_0x0e33('0xc'),auth[_0x0e33('0xa')](),controller[_0x0e33('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0cf6=['post','create','put','/:id','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x4eddd7,_0x13fd4e){var _0x4a8af5=function(_0x579dfe){while(--_0x579dfe){_0x4eddd7['push'](_0x4eddd7['shift']());}};_0x4a8af5(++_0x13fd4e);}(_0x0cf6,0xd6));var _0x60cf=function(_0x590ef9,_0x2cbc10){_0x590ef9=_0x590ef9-0x0;var _0x5c7eb3=_0x0cf6[_0x590ef9];return _0x5c7eb3;};'use strict';var multer=require(_0x60cf('0x0'));var util=require(_0x60cf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60cf('0x2'));var router=express[_0x60cf('0x3')]();var fs_extra=require(_0x60cf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x60cf('0x5'));var config=require('../../config/environment');var controller=require(_0x60cf('0x6'));router[_0x60cf('0x7')]('/',auth[_0x60cf('0x8')](),controller[_0x60cf('0x9')]);router[_0x60cf('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x60cf('0xa')]);router[_0x60cf('0x7')](_0x60cf('0xb'),auth[_0x60cf('0x8')](),controller[_0x60cf('0xc')]);router[_0x60cf('0x7')](_0x60cf('0xd'),auth[_0x60cf('0x8')](),controller[_0x60cf('0xe')]);router['get'](_0x60cf('0xf'),auth[_0x60cf('0x8')](),controller['query']);router[_0x60cf('0x10')]('/',auth[_0x60cf('0x8')](),controller[_0x60cf('0x11')]);router[_0x60cf('0x12')](_0x60cf('0x13'),auth[_0x60cf('0x8')](),controller[_0x60cf('0x14')]);router['delete'](_0x60cf('0x13'),auth['isAuthenticated'](),controller[_0x60cf('0x15')]);module[_0x60cf('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 204d04d..522d853 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 _0x038b=['exports','STRING','TEXT'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x038b,0x114));var _0xb038=function(_0x1a83fc,_0x4623be){_0x1a83fc=_0x1a83fc-0x0;var _0x47cf3e=_0x038b[_0x1a83fc];return _0x47cf3e;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0xfdbd[_0x2b0bc2];return _0x56e5b9;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8a1865a..0231ed7 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x3591c8,_0x460d82){var _0x1512bc=function(_0x1f5bd0){while(--_0x1f5bd0){_0x3591c8['push'](_0x3591c8['shift']());}};_0x1512bc(++_0x460d82);}(_0x53ec,0x192));var _0xc53e=function(_0xd204b0,_0x4c7d1d){_0xd204b0=_0xd204b0-0x0;var _0xfc8310=_0x53ec[_0xd204b0];return _0xfc8310;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%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','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x1e1c0b,_0x591d01){var _0x33241b=function(_0x3a8aea){while(--_0x3a8aea){_0x1e1c0b['push'](_0x1e1c0b['shift']());}};_0x33241b(++_0x591d01);}(_0x5fab,0x177));var _0xb5fa=function(_0x3566d0,_0x34a49f){_0x3566d0=_0x3566d0-0x0;var _0x3fd4da=_0x5fab[_0x3566d0];return _0x3fd4da;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index c49fbdf..f7909d8 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 _0xaed6=['bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api'];(function(_0x340e24,_0xde71e){var _0x1808a=function(_0x2a602e){while(--_0x2a602e){_0x340e24['push'](_0x340e24['shift']());}};_0x1808a(++_0xde71e);}(_0xaed6,0x1d1));var _0x6aed=function(_0x4e138a,_0x28ce99){_0x4e138a=_0x4e138a-0x0;var _0x17f686=_0xaed6[_0x4e138a];return _0x17f686;};'use strict';var _=require('lodash');var util=require(_0x6aed('0x0'));var logger=require(_0x6aed('0x1'))(_0x6aed('0x2'));var moment=require('moment');var BPromise=require(_0x6aed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6aed('0x4'));var rimraf=require(_0x6aed('0x5'));var config=require(_0x6aed('0x6'));var attributes=require(_0x6aed('0x7'));module[_0x6aed('0x8')]=function(_0x1b396c,_0x36f77e){return _0x1b396c[_0x6aed('0x9')](_0x6aed('0xa'),attributes,{'tableName':_0x6aed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3347=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports'];(function(_0x4491a7,_0x4215e1){var _0x23fc95=function(_0x1decf4){while(--_0x1decf4){_0x4491a7['push'](_0x4491a7['shift']());}};_0x23fc95(++_0x4215e1);}(_0x3347,0x168));var _0x7334=function(_0x283152,_0x162a4d){_0x283152=_0x283152-0x0;var _0x3319e8=_0x3347[_0x283152];return _0x3319e8;};'use strict';var _=require(_0x7334('0x0'));var util=require('util');var logger=require(_0x7334('0x1'))(_0x7334('0x2'));var moment=require(_0x7334('0x3'));var BPromise=require(_0x7334('0x4'));var rp=require(_0x7334('0x5'));var fs=require('fs');var path=require(_0x7334('0x6'));var rimraf=require(_0x7334('0x7'));var config=require('../../config/environment');var attributes=require(_0x7334('0x8'));module[_0x7334('0x9')]=function(_0x39c216,_0x31ba06){return _0x39c216['define'](_0x7334('0xa'),attributes,{'tableName':_0x7334('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index e77d9af..1954a26 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 _0x9447=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x135ad5,_0x3036b7){var _0x500007=function(_0x4d81a1){while(--_0x4d81a1){_0x135ad5['push'](_0x135ad5['shift']());}};_0x500007(++_0x3036b7);}(_0x9447,0x176));var _0x7944=function(_0xbf6d10,_0x33369b){_0xbf6d10=_0xbf6d10-0x0;var _0x8c8ad3=_0x9447[_0xbf6d10];return _0x8c8ad3;};'use strict';var _=require(_0x7944('0x0'));var util=require('util');var moment=require(_0x7944('0x1'));var BPromise=require(_0x7944('0x2'));var rs=require(_0x7944('0x3'));var fs=require('fs');var Redis=require(_0x7944('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7944('0x5'));var logger=require(_0x7944('0x6'))(_0x7944('0x7'));var config=require('../../config/environment');var jayson=require(_0x7944('0x8'));var client=jayson[_0x7944('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x571e91,_0x26e21b,_0x3d73b4){return new BPromise(function(_0x435f30,_0x5dbe6b){return client[_0x7944('0xa')](_0x571e91,_0x3d73b4)[_0x7944('0xb')](function(_0x545073){logger[_0x7944('0xc')](_0x7944('0xd'),_0x26e21b,_0x7944('0xe'));logger['debug'](_0x7944('0xf'),_0x26e21b,_0x7944('0xe'),JSON[_0x7944('0x10')](_0x545073));if(_0x545073[_0x7944('0x11')]){if(_0x545073['error']['code']===0x1f4){logger[_0x7944('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x26e21b,_0x545073[_0x7944('0x11')][_0x7944('0x12')]);return _0x5dbe6b(_0x545073[_0x7944('0x11')][_0x7944('0x12')]);}logger[_0x7944('0x11')](_0x7944('0xd'),_0x26e21b,_0x545073['error']['message']);return _0x435f30(_0x545073[_0x7944('0x11')][_0x7944('0x12')]);}else{logger[_0x7944('0xc')](_0x7944('0xd'),_0x26e21b,_0x7944('0xe'));_0x435f30(_0x545073[_0x7944('0x13')][_0x7944('0x12')]);}})[_0x7944('0x14')](function(_0x366471){logger[_0x7944('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x26e21b,_0x366471);_0x5dbe6b(_0x366471);});});} \ No newline at end of file +var _0x4455=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird'];(function(_0x545bc7,_0x2d1099){var _0x1204e6=function(_0x1aaca8){while(--_0x1aaca8){_0x545bc7['push'](_0x545bc7['shift']());}};_0x1204e6(++_0x2d1099);}(_0x4455,0xe3));var _0x5445=function(_0x498afe,_0x4b2585){_0x498afe=_0x498afe-0x0;var _0x428049=_0x4455[_0x498afe];return _0x428049;};'use strict';var _=require(_0x5445('0x0'));var util=require(_0x5445('0x1'));var moment=require(_0x5445('0x2'));var BPromise=require(_0x5445('0x3'));var rs=require(_0x5445('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5445('0x5'))['db'];var utils=require(_0x5445('0x6'));var logger=require(_0x5445('0x7'))(_0x5445('0x8'));var config=require(_0x5445('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5445('0xa')][_0x5445('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cadd5,_0x3d4818,_0x14ef37){return new BPromise(function(_0xcba4ef,_0x387d91){return client[_0x5445('0xc')](_0x5cadd5,_0x14ef37)['then'](function(_0x3fa909){logger[_0x5445('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d4818,_0x5445('0xe'));logger[_0x5445('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3d4818,_0x5445('0xe'),JSON[_0x5445('0x10')](_0x3fa909));if(_0x3fa909[_0x5445('0x11')]){if(_0x3fa909[_0x5445('0x11')][_0x5445('0x12')]===0x1f4){logger[_0x5445('0x11')](_0x5445('0x13'),_0x3d4818,_0x3fa909[_0x5445('0x11')][_0x5445('0x14')]);return _0x387d91(_0x3fa909[_0x5445('0x11')][_0x5445('0x14')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d4818,_0x3fa909[_0x5445('0x11')][_0x5445('0x14')]);return _0xcba4ef(_0x3fa909[_0x5445('0x11')][_0x5445('0x14')]);}else{logger[_0x5445('0xd')](_0x5445('0x13'),_0x3d4818,'request\x20sent');_0xcba4ef(_0x3fa909['result'][_0x5445('0x14')]);}})['catch'](function(_0x5eb68a){logger[_0x5445('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d4818,_0x5eb68a);_0x387d91(_0x5eb68a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e1df8e5..3383d98 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 _0x9271=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id/run','run','/:id/query','post','create','put','/:id','update'];(function(_0x1afd25,_0xee6014){var _0x80da5e=function(_0x51e830){while(--_0x51e830){_0x1afd25['push'](_0x1afd25['shift']());}};_0x80da5e(++_0xee6014);}(_0x9271,0x1e3));var _0x1927=function(_0x27e94f,_0x369fe1){_0x27e94f=_0x27e94f-0x0;var _0x1436f5=_0x9271[_0x27e94f];return _0x1436f5;};'use strict';var multer=require(_0x1927('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1927('0x1'));var express=require(_0x1927('0x2'));var router=express[_0x1927('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1927('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1927('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0x1927('0x6')]('/',auth[_0x1927('0x7')](),controller[_0x1927('0x8')]);router['get']('/:id',auth[_0x1927('0x7')](),controller['show']);router[_0x1927('0x6')]('/:id/preview',auth[_0x1927('0x7')](),controller['preview']);router[_0x1927('0x6')](_0x1927('0x9'),auth[_0x1927('0x7')](),controller[_0x1927('0xa')]);router['get'](_0x1927('0xb'),auth[_0x1927('0x7')](),controller['query']);router[_0x1927('0xc')]('/',auth['isAuthenticated'](),controller[_0x1927('0xd')]);router[_0x1927('0xe')](_0x1927('0xf'),auth['isAuthenticated'](),controller[_0x1927('0x10')]);router[_0x1927('0x11')](_0x1927('0xf'),auth[_0x1927('0x7')](),controller[_0x1927('0x12')]);module[_0x1927('0x13')]=router; \ No newline at end of file +var _0x3408=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','exports'];(function(_0x20d892,_0x167fcd){var _0x5b2867=function(_0x512ea6){while(--_0x512ea6){_0x20d892['push'](_0x20d892['shift']());}};_0x5b2867(++_0x167fcd);}(_0x3408,0x177));var _0x8340=function(_0x1ea5db,_0xa6fb22){_0x1ea5db=_0x1ea5db-0x0;var _0x25c0bf=_0x3408[_0x1ea5db];return _0x25c0bf;};'use strict';var multer=require(_0x8340('0x0'));var util=require(_0x8340('0x1'));var path=require(_0x8340('0x2'));var timeout=require(_0x8340('0x3'));var express=require(_0x8340('0x4'));var router=express[_0x8340('0x5')]();var fs_extra=require(_0x8340('0x6'));var auth=require(_0x8340('0x7'));var interaction=require(_0x8340('0x8'));var config=require(_0x8340('0x9'));var controller=require(_0x8340('0xa'));router[_0x8340('0xb')]('/',auth[_0x8340('0xc')](),controller[_0x8340('0xd')]);router[_0x8340('0xb')](_0x8340('0xe'),auth[_0x8340('0xc')](),controller['show']);router[_0x8340('0xb')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x8340('0xb')](_0x8340('0xf'),auth[_0x8340('0xc')](),controller[_0x8340('0x10')]);router[_0x8340('0xb')](_0x8340('0x11'),auth['isAuthenticated'](),controller[_0x8340('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8340('0x13')]);router[_0x8340('0x14')]('/:id',auth[_0x8340('0xc')](),controller[_0x8340('0x15')]);router[_0x8340('0x16')](_0x8340('0xe'),auth[_0x8340('0xc')](),controller[_0x8340('0x17')]);module[_0x8340('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 db0fd6e..e9aad17 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 _0x2c44=['DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf','xlsx'];(function(_0x495c2b,_0x5044b0){var _0x370520=function(_0x57c87f){while(--_0x57c87f){_0x495c2b['push'](_0x495c2b['shift']());}};_0x370520(++_0x5044b0);}(_0x2c44,0xf0));var _0x42c4=function(_0x2ecaf6,_0x60d2f5){_0x2ecaf6=_0x2ecaf6-0x0;var _0x29004f=_0x2c44[_0x2ecaf6];return _0x29004f;};'use strict';var Sequelize=require(_0x42c4('0x0'));var moment=require(_0x42c4('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x42c4('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x42c4('0x3')](_0x42c4('0x4'),_0x42c4('0x5'),_0x42c4('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x42c4('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x42c4('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x42c4('0x2')],'defaultValue':_0x42c4('0x8')},'type':{'type':Sequelize[_0x42c4('0x3')](_0x42c4('0x9'),_0x42c4('0xa')),'allowNull':![],'defaultValue':_0x42c4('0x9')},'reportId':{'type':Sequelize[_0x42c4('0xb')](0xb)[_0x42c4('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x079c=['manual','scheduled','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x2017bf,_0x2ec352){var _0x138cda=function(_0x351c87){while(--_0x351c87){_0x2017bf['push'](_0x2017bf['shift']());}};_0x138cda(++_0x2ec352);}(_0x079c,0x1d7));var _0xc079=function(_0x797a70,_0x466e0b){_0x797a70=_0x797a70-0x0;var _0x53d9fd=_0x079c[_0x797a70];return _0x53d9fd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc079('0x0'));module[_0xc079('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xc079('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xc079('0x3')](_0xc079('0x4'),_0xc079('0x5'),_0xc079('0x6')),'allowNull':![],'defaultValue':_0xc079('0x4')},'savename':{'type':Sequelize[_0xc079('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc079('0x7')]},'endDate':{'type':Sequelize[_0xc079('0x7')]},'status':{'type':Sequelize[_0xc079('0x2')],'defaultValue':_0xc079('0x8')},'type':{'type':Sequelize[_0xc079('0x3')](_0xc079('0x9'),_0xc079('0xa')),'allowNull':![],'defaultValue':_0xc079('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xc079('0xb')]},'reportType':{'type':Sequelize[_0xc079('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 3355280..da6e081 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 _0x1419=['hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','output','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','apply','reject','save','update','destroy','then','get','ExtractedReports','sendStatus','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields'];(function(_0x358634,_0x3d8e70){var _0x3d0ef7=function(_0x4fd949){while(--_0x4fd949){_0x358634['push'](_0x358634['shift']());}};_0x3d0ef7(++_0x3d8e70);}(_0x1419,0xe3));var _0x9141=function(_0x23b3c8,_0x685dde){_0x23b3c8=_0x23b3c8-0x0;var _0x31c27c=_0x1419[_0x23b3c8];return _0x31c27c;};'use strict';var emlformat=require(_0x9141('0x0'));var rimraf=require(_0x9141('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9141('0x2'));var rp=require(_0x9141('0x3'));var moment=require(_0x9141('0x4'));var BPromise=require(_0x9141('0x5'));var Mustache=require('mustache');var util=require(_0x9141('0x6'));var path=require(_0x9141('0x7'));var sox=require('sox');var csv=require(_0x9141('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9141('0x9'));var _=require('lodash');var squel=require(_0x9141('0xa'));var crypto=require('crypto');var jsforce=require(_0x9141('0xb'));var deskjs=require(_0x9141('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9141('0xd'));var Redis=require(_0x9141('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9141('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9141('0x10'))('api');var utils=require(_0x9141('0x11'));var config=require(_0x9141('0x12'));var licenseUtil=require(_0x9141('0x13'));var db=require(_0x9141('0x14'))['db'];function respondWithStatusCode(_0x369ce0,_0x3b198c){_0x3b198c=_0x3b198c||0xcc;return function(_0xdba496){if(_0xdba496){return _0x369ce0['sendStatus'](_0x3b198c);}return _0x369ce0[_0x9141('0x15')](_0x3b198c)[_0x9141('0x16')]();};}function respondWithResult(_0x346866,_0x20ee91){_0x20ee91=_0x20ee91||0xc8;return function(_0x5b9e50){if(_0x5b9e50){return _0x346866[_0x9141('0x15')](_0x20ee91)[_0x9141('0x17')](_0x5b9e50);}};}function respondWithFilteredResult(_0x3ae46e,_0x218f41){return function(_0x287509){if(_0x287509){var _0x52118e=typeof _0x218f41[_0x9141('0x18')]==='undefined'&&typeof _0x218f41[_0x9141('0x19')]===_0x9141('0x1a');var _0x39fcc7=_0x287509[_0x9141('0x1b')];var _0x29e998=_0x52118e?0x0:_0x218f41['offset'];var _0x4b4d15=_0x52118e?_0x287509[_0x9141('0x1b')]:_0x218f41['offset']+_0x218f41['limit'];var _0x3de2cc;if(_0x4b4d15>=_0x39fcc7){_0x4b4d15=_0x39fcc7;_0x3de2cc=0xc8;}else{_0x3de2cc=0xce;}_0x3ae46e[_0x9141('0x15')](_0x3de2cc);return _0x3ae46e['set']('Content-Range',_0x29e998+'-'+_0x4b4d15+'/'+_0x39fcc7)['json'](_0x287509);}return null;};}function patchUpdates(_0x56f636){return function(_0x9d6cf){try{jsonpatch[_0x9141('0x1c')](_0x9d6cf,_0x56f636,!![]);}catch(_0x48a7d1){return BPromise[_0x9141('0x1d')](_0x48a7d1);}return _0x9d6cf[_0x9141('0x1e')]();};}function saveUpdates(_0x2e4e60,_0x11d9d3){return function(_0x7ffa84){if(_0x7ffa84){return _0x7ffa84[_0x9141('0x1f')](_0x2e4e60)['then'](function(_0x243842){return _0x243842;});}return null;};}function removeEntity(_0x331e0d,_0x1a42e1){return function(_0x36bc44){if(_0x36bc44){return _0x36bc44[_0x9141('0x20')]()[_0x9141('0x21')](function(){var _0x133cee=_0x36bc44[_0x9141('0x22')]({'plain':!![]});var _0xab4c7b=_0x9141('0x23');return db['UserProfileResource'][_0x9141('0x20')]({'where':{'type':_0xab4c7b,'resourceId':_0x133cee['id']}})['then'](function(){return _0x36bc44;});})[_0x9141('0x21')](function(){_0x331e0d['status'](0xcc)[_0x9141('0x16')]();});}};}function handleEntityNotFound(_0x8c1fec,_0x11a499){return function(_0xd78912){if(!_0xd78912){_0x8c1fec[_0x9141('0x24')](0x194);}return _0xd78912;};}function handleError(_0x4d7275,_0x18d065){_0x18d065=_0x18d065||0x1f4;return function(_0x80e391){logger[_0x9141('0x25')](_0x80e391[_0x9141('0x26')]);if(_0x80e391['name']){delete _0x80e391[_0x9141('0x27')];}_0x4d7275['status'](_0x18d065)['send'](_0x80e391);};}exports[_0x9141('0x28')]=function(_0x50b660,_0x5f4de9){var _0x253b4a={},_0x5cc97e={},_0x50f953={'count':0x0,'rows':[]};var _0x4d742c=_[_0x9141('0x29')](db[_0x9141('0x2a')][_0x9141('0x2b')],function(_0x3f6c83){return{'name':_0x3f6c83[_0x9141('0x2c')],'type':_0x3f6c83['type'][_0x9141('0x2d')]};});_0x5cc97e['model']=_[_0x9141('0x29')](_0x4d742c,'name');_0x5cc97e[_0x9141('0x2e')]=_['keys'](_0x50b660['query']);_0x5cc97e[_0x9141('0x2f')]=_[_0x9141('0x30')](_0x5cc97e[_0x9141('0x31')],_0x5cc97e[_0x9141('0x2e')]);_0x253b4a[_0x9141('0x32')]=_[_0x9141('0x30')](_0x5cc97e[_0x9141('0x31')],qs[_0x9141('0x33')](_0x50b660[_0x9141('0x2e')][_0x9141('0x33')]));_0x253b4a['attributes']=_0x253b4a[_0x9141('0x32')]['length']?_0x253b4a[_0x9141('0x32')]:_0x5cc97e[_0x9141('0x31')];if(!_0x50b660[_0x9141('0x2e')][_0x9141('0x34')](_0x9141('0x35'))){_0x253b4a[_0x9141('0x19')]=qs[_0x9141('0x19')](_0x50b660[_0x9141('0x2e')][_0x9141('0x19')]);_0x253b4a[_0x9141('0x18')]=qs[_0x9141('0x18')](_0x50b660[_0x9141('0x2e')][_0x9141('0x18')]);}_0x253b4a[_0x9141('0x36')]=qs[_0x9141('0x37')](_0x50b660[_0x9141('0x2e')][_0x9141('0x37')]);_0x253b4a[_0x9141('0x38')]=qs[_0x9141('0x2f')](_['pick'](_0x50b660[_0x9141('0x2e')],_0x5cc97e['filters']),_0x4d742c);if(_0x50b660[_0x9141('0x2e')][_0x9141('0x39')]){_0x253b4a['where']=_[_0x9141('0x3a')](_0x253b4a['where'],{'$or':_[_0x9141('0x29')](_0x4d742c,function(_0x438b6d){if(_0x438b6d[_0x9141('0x3b')]!==_0x9141('0x3c')){var _0x28154b={};_0x28154b[_0x438b6d[_0x9141('0x27')]]={'$like':'%'+_0x50b660['query']['filter']+'%'};return _0x28154b;}})});}_0x253b4a=_[_0x9141('0x3a')]({},_0x253b4a,_0x50b660[_0x9141('0x3d')]);var _0x192f1a={'where':_0x253b4a[_0x9141('0x38')]};return db[_0x9141('0x2a')][_0x9141('0x1b')](_0x192f1a)['then'](function(_0x3dcc75){_0x50f953[_0x9141('0x1b')]=_0x3dcc75;if(_0x50b660[_0x9141('0x2e')][_0x9141('0x3e')]){_0x253b4a[_0x9141('0x3f')]=[{'all':!![]}];}return db[_0x9141('0x2a')][_0x9141('0x40')](_0x253b4a);})[_0x9141('0x21')](function(_0xfa40f8){_0x50f953[_0x9141('0x41')]=_0xfa40f8;return _0x50f953;})[_0x9141('0x21')](respondWithFilteredResult(_0x5f4de9,_0x253b4a))[_0x9141('0x42')](handleError(_0x5f4de9,null));};exports[_0x9141('0x43')]=function(_0x4000d6,_0x1a108b){var _0x38306a={'raw':!![],'where':{'id':_0x4000d6[_0x9141('0x44')]['id']}},_0x1d16cb={};_0x1d16cb[_0x9141('0x31')]=_[_0x9141('0x45')](db[_0x9141('0x2a')][_0x9141('0x2b')]);_0x1d16cb[_0x9141('0x2e')]=_['keys'](_0x4000d6[_0x9141('0x2e')]);_0x1d16cb['filters']=_['intersection'](_0x1d16cb[_0x9141('0x31')],_0x1d16cb['query']);_0x38306a['attributes']=_[_0x9141('0x30')](_0x1d16cb[_0x9141('0x31')],qs[_0x9141('0x33')](_0x4000d6['query']['fields']));_0x38306a[_0x9141('0x32')]=_0x38306a['attributes'][_0x9141('0x46')]?_0x38306a['attributes']:_0x1d16cb[_0x9141('0x31')];if(_0x4000d6[_0x9141('0x2e')][_0x9141('0x3e')]){_0x38306a[_0x9141('0x3f')]=[{'all':!![]}];}_0x38306a=_[_0x9141('0x3a')]({},_0x38306a,_0x4000d6[_0x9141('0x3d')]);return db[_0x9141('0x2a')][_0x9141('0x47')](_0x38306a)[_0x9141('0x21')](handleEntityNotFound(_0x1a108b,null))['then'](respondWithResult(_0x1a108b,null))[_0x9141('0x42')](handleError(_0x1a108b,null));};exports['create']=function(_0x40a16a,_0x1ee9a5){return db[_0x9141('0x2a')][_0x9141('0x48')](_0x40a16a[_0x9141('0x49')],{})[_0x9141('0x21')](function(_0x9add77){var _0x1682a9=_0x40a16a[_0x9141('0x4a')][_0x9141('0x22')]({'plain':!![]});if(!_0x1682a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1682a9[_0x9141('0x4b')]===_0x9141('0x4a')){var _0xf04bdc=_0x9add77[_0x9141('0x22')]({'plain':!![]});var _0x12efbc='ExtractedReports';return db[_0x9141('0x4c')][_0x9141('0x47')]({'where':{'name':_0x12efbc,'userProfileId':_0x1682a9[_0x9141('0x4d')]},'raw':!![]})['then'](function(_0x3645fa){if(_0x3645fa&&_0x3645fa[_0x9141('0x4e')]===0x0){return db['UserProfileResource'][_0x9141('0x48')]({'name':_0xf04bdc['name'],'resourceId':_0xf04bdc['id'],'type':_0x3645fa['name'],'sectionId':_0x3645fa['id']},{})[_0x9141('0x21')](function(){return _0x9add77;});}else{return _0x9add77;}})[_0x9141('0x42')](function(_0x36e8c7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36e8c7);throw _0x36e8c7;});}return _0x9add77;})[_0x9141('0x21')](respondWithResult(_0x1ee9a5,0xc9))[_0x9141('0x42')](handleError(_0x1ee9a5,null));};exports['update']=function(_0x113d47,_0x498f06){if(_0x113d47[_0x9141('0x49')]['id']){delete _0x113d47[_0x9141('0x49')]['id'];}return db['AnalyticExtractedReport'][_0x9141('0x47')]({'where':{'id':_0x113d47[_0x9141('0x44')]['id']}})['then'](handleEntityNotFound(_0x498f06,null))['then'](saveUpdates(_0x113d47[_0x9141('0x49')],null))[_0x9141('0x21')](respondWithResult(_0x498f06,null))[_0x9141('0x42')](handleError(_0x498f06,null));};exports[_0x9141('0x20')]=function(_0x14d9bd,_0x4a94d7){return db[_0x9141('0x2a')][_0x9141('0x47')]({'where':{'id':_0x14d9bd[_0x9141('0x44')]['id']}})[_0x9141('0x21')](handleEntityNotFound(_0x4a94d7,null))['then'](removeEntity(_0x4a94d7,null))[_0x9141('0x42')](handleError(_0x4a94d7,null));};exports[_0x9141('0x4f')]=function(_0x1b5c20,_0x1fa180,_0x25fde9){return db[_0x9141('0x2a')]['find']({'where':{'id':_0x1b5c20[_0x9141('0x44')]['id']},'attributes':[_0x9141('0x27'),_0x9141('0x50'),_0x9141('0x51'),'output'],'raw':!![]})[_0x9141('0x21')](handleEntityNotFound(_0x1fa180,null))['then'](function(_0xeffda6){if(_0xeffda6){if(!fs[_0x9141('0x52')](path[_0x9141('0x53')](config[_0x9141('0x54')],_0x9141('0x55'),_0xeffda6[_0x9141('0x51')]))){throw new db['Sequelize'][(_0x9141('0x56'))](_0x9141('0x57'));}if(_0x1b5c20['query'][_0x9141('0x58')]){return _0x1fa180[_0x9141('0x24')](0xc8);}return _0x1fa180['download'](path['join'](config['root'],'server/files/reports',_0xeffda6[_0x9141('0x51')]),util[_0x9141('0x59')](_0x9141('0x5a'),_0xeffda6[_0x9141('0x50')]||_0xeffda6[_0x9141('0x27')],_0xeffda6[_0x9141('0x5b')][_0x9141('0x5c')]()));}})[_0x9141('0x42')](handleError(_0x1fa180,null));}; \ No newline at end of file +var _0x99e1=['%s.%s','basename','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','error','stack','name','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','join','root','server/files/reports','exists','format'];(function(_0x3893f5,_0x207595){var _0x5cf9d0=function(_0x452928){while(--_0x452928){_0x3893f5['push'](_0x3893f5['shift']());}};_0x5cf9d0(++_0x207595);}(_0x99e1,0x12c));var _0x199e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x99e1[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x199e('0x0'));var zipdir=require(_0x199e('0x1'));var jsonpatch=require(_0x199e('0x2'));var rp=require(_0x199e('0x3'));var moment=require('moment');var BPromise=require(_0x199e('0x4'));var Mustache=require(_0x199e('0x5'));var util=require(_0x199e('0x6'));var path=require(_0x199e('0x7'));var sox=require(_0x199e('0x8'));var csv=require(_0x199e('0x9'));var ejs=require(_0x199e('0xa'));var fs=require('fs');var fs_extra=require(_0x199e('0xb'));var _=require('lodash');var squel=require(_0x199e('0xc'));var crypto=require(_0x199e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x199e('0xe'));var toCsv=require(_0x199e('0x9'));var querystring=require(_0x199e('0xf'));var Papa=require(_0x199e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x199e('0x11'));var as=require(_0x199e('0x12'));var hardwareService=require(_0x199e('0x13'));var logger=require(_0x199e('0x14'))(_0x199e('0x15'));var utils=require(_0x199e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x199e('0x17'));var db=require(_0x199e('0x18'))['db'];function respondWithStatusCode(_0xfcc8c6,_0x35a2d3){_0x35a2d3=_0x35a2d3||0xcc;return function(_0x5bd895){if(_0x5bd895){return _0xfcc8c6[_0x199e('0x19')](_0x35a2d3);}return _0xfcc8c6['status'](_0x35a2d3)['end']();};}function respondWithResult(_0x518f55,_0x1bacaa){_0x1bacaa=_0x1bacaa||0xc8;return function(_0x7eefc0){if(_0x7eefc0){return _0x518f55[_0x199e('0x1a')](_0x1bacaa)[_0x199e('0x1b')](_0x7eefc0);}};}function respondWithFilteredResult(_0x2e1ce2,_0x1cb8f3){return function(_0x32caf1){if(_0x32caf1){var _0x1b2ff1=typeof _0x1cb8f3[_0x199e('0x1c')]===_0x199e('0x1d')&&typeof _0x1cb8f3[_0x199e('0x1e')]==='undefined';var _0x498aff=_0x32caf1[_0x199e('0x1f')];var _0x5b9865=_0x1b2ff1?0x0:_0x1cb8f3[_0x199e('0x1c')];var _0x5c1528=_0x1b2ff1?_0x32caf1['count']:_0x1cb8f3[_0x199e('0x1c')]+_0x1cb8f3['limit'];var _0x5e0dfb;if(_0x5c1528>=_0x498aff){_0x5c1528=_0x498aff;_0x5e0dfb=0xc8;}else{_0x5e0dfb=0xce;}_0x2e1ce2[_0x199e('0x1a')](_0x5e0dfb);return _0x2e1ce2[_0x199e('0x20')](_0x199e('0x21'),_0x5b9865+'-'+_0x5c1528+'/'+_0x498aff)[_0x199e('0x1b')](_0x32caf1);}return null;};}function patchUpdates(_0x4648ea){return function(_0x5327b6){try{jsonpatch['apply'](_0x5327b6,_0x4648ea,!![]);}catch(_0x54739a){return BPromise[_0x199e('0x22')](_0x54739a);}return _0x5327b6[_0x199e('0x23')]();};}function saveUpdates(_0x39e33b,_0xd114d1){return function(_0x12d7d1){if(_0x12d7d1){return _0x12d7d1[_0x199e('0x24')](_0x39e33b)[_0x199e('0x25')](function(_0x53b356){return _0x53b356;});}return null;};}function removeEntity(_0x457767,_0x2e4142){return function(_0x303e84){if(_0x303e84){return _0x303e84[_0x199e('0x26')]()[_0x199e('0x25')](function(){var _0x27741c=_0x303e84[_0x199e('0x27')]({'plain':!![]});var _0x3e036b=_0x199e('0x28');return db[_0x199e('0x29')][_0x199e('0x26')]({'where':{'type':_0x3e036b,'resourceId':_0x27741c['id']}})[_0x199e('0x25')](function(){return _0x303e84;});})[_0x199e('0x25')](function(){_0x457767[_0x199e('0x1a')](0xcc)[_0x199e('0x2a')]();});}};}function handleEntityNotFound(_0x409e6d,_0x48b27c){return function(_0x20a293){if(!_0x20a293){_0x409e6d[_0x199e('0x19')](0x194);}return _0x20a293;};}function handleError(_0xd40447,_0x32ded9){_0x32ded9=_0x32ded9||0x1f4;return function(_0x4b9047){logger[_0x199e('0x2b')](_0x4b9047[_0x199e('0x2c')]);if(_0x4b9047[_0x199e('0x2d')]){delete _0x4b9047[_0x199e('0x2d')];}_0xd40447['status'](_0x32ded9)['send'](_0x4b9047);};}exports[_0x199e('0x2e')]=function(_0x234df0,_0x4461ae){var _0x3800a9={},_0x3dcc50={},_0x59fe6b={'count':0x0,'rows':[]};var _0x1c59cc=_['map'](db[_0x199e('0x2f')][_0x199e('0x30')],function(_0x5b8aa7){return{'name':_0x5b8aa7[_0x199e('0x31')],'type':_0x5b8aa7[_0x199e('0x32')][_0x199e('0x33')]};});_0x3dcc50[_0x199e('0x34')]=_[_0x199e('0x35')](_0x1c59cc,_0x199e('0x2d'));_0x3dcc50[_0x199e('0x36')]=_[_0x199e('0x37')](_0x234df0[_0x199e('0x36')]);_0x3dcc50[_0x199e('0x38')]=_['intersection'](_0x3dcc50[_0x199e('0x34')],_0x3dcc50[_0x199e('0x36')]);_0x3800a9[_0x199e('0x39')]=_[_0x199e('0x3a')](_0x3dcc50[_0x199e('0x34')],qs[_0x199e('0x3b')](_0x234df0[_0x199e('0x36')][_0x199e('0x3b')]));_0x3800a9['attributes']=_0x3800a9[_0x199e('0x39')][_0x199e('0x3c')]?_0x3800a9['attributes']:_0x3dcc50[_0x199e('0x34')];if(!_0x234df0[_0x199e('0x36')][_0x199e('0x3d')]('nolimit')){_0x3800a9[_0x199e('0x1e')]=qs['limit'](_0x234df0[_0x199e('0x36')][_0x199e('0x1e')]);_0x3800a9[_0x199e('0x1c')]=qs['offset'](_0x234df0['query'][_0x199e('0x1c')]);}_0x3800a9[_0x199e('0x3e')]=qs['sort'](_0x234df0[_0x199e('0x36')][_0x199e('0x3f')]);_0x3800a9[_0x199e('0x40')]=qs[_0x199e('0x38')](_[_0x199e('0x41')](_0x234df0[_0x199e('0x36')],_0x3dcc50['filters']),_0x1c59cc);if(_0x234df0['query'][_0x199e('0x42')]){_0x3800a9[_0x199e('0x40')]=_[_0x199e('0x43')](_0x3800a9['where'],{'$or':_[_0x199e('0x35')](_0x1c59cc,function(_0x19f644){if(_0x19f644[_0x199e('0x32')]!==_0x199e('0x44')){var _0x198b21={};_0x198b21[_0x19f644['name']]={'$like':'%'+_0x234df0[_0x199e('0x36')]['filter']+'%'};return _0x198b21;}})});}_0x3800a9=_['merge']({},_0x3800a9,_0x234df0[_0x199e('0x45')]);var _0x3ec04c={'where':_0x3800a9[_0x199e('0x40')]};return db[_0x199e('0x2f')][_0x199e('0x1f')](_0x3ec04c)['then'](function(_0x1671c8){_0x59fe6b[_0x199e('0x1f')]=_0x1671c8;if(_0x234df0['query'][_0x199e('0x46')]){_0x3800a9[_0x199e('0x47')]=[{'all':!![]}];}return db[_0x199e('0x2f')][_0x199e('0x48')](_0x3800a9);})[_0x199e('0x25')](function(_0x61276a){_0x59fe6b[_0x199e('0x49')]=_0x61276a;return _0x59fe6b;})[_0x199e('0x25')](respondWithFilteredResult(_0x4461ae,_0x3800a9))[_0x199e('0x4a')](handleError(_0x4461ae,null));};exports[_0x199e('0x4b')]=function(_0x4c52e5,_0x5c3e6b){var _0x4d0835={'raw':!![],'where':{'id':_0x4c52e5[_0x199e('0x4c')]['id']}},_0x114db7={};_0x114db7[_0x199e('0x34')]=_[_0x199e('0x37')](db[_0x199e('0x2f')][_0x199e('0x30')]);_0x114db7[_0x199e('0x36')]=_[_0x199e('0x37')](_0x4c52e5[_0x199e('0x36')]);_0x114db7[_0x199e('0x38')]=_[_0x199e('0x3a')](_0x114db7[_0x199e('0x34')],_0x114db7[_0x199e('0x36')]);_0x4d0835['attributes']=_['intersection'](_0x114db7['model'],qs[_0x199e('0x3b')](_0x4c52e5[_0x199e('0x36')][_0x199e('0x3b')]));_0x4d0835[_0x199e('0x39')]=_0x4d0835[_0x199e('0x39')][_0x199e('0x3c')]?_0x4d0835[_0x199e('0x39')]:_0x114db7['model'];if(_0x4c52e5[_0x199e('0x36')][_0x199e('0x46')]){_0x4d0835[_0x199e('0x47')]=[{'all':!![]}];}_0x4d0835=_['merge']({},_0x4d0835,_0x4c52e5[_0x199e('0x45')]);return db['AnalyticExtractedReport'][_0x199e('0x4d')](_0x4d0835)['then'](handleEntityNotFound(_0x5c3e6b,null))[_0x199e('0x25')](respondWithResult(_0x5c3e6b,null))[_0x199e('0x4a')](handleError(_0x5c3e6b,null));};exports['create']=function(_0x9f249a,_0x198600){return db[_0x199e('0x2f')]['create'](_0x9f249a[_0x199e('0x4e')],{})[_0x199e('0x25')](function(_0x405e37){var _0xc09f32=_0x9f249a[_0x199e('0x4f')][_0x199e('0x27')]({'plain':!![]});if(!_0xc09f32)throw new Error(_0x199e('0x50'));if(_0xc09f32[_0x199e('0x51')]===_0x199e('0x4f')){var _0x446c96=_0x405e37['get']({'plain':!![]});var _0x32cdca=_0x199e('0x28');return db[_0x199e('0x52')][_0x199e('0x4d')]({'where':{'name':_0x32cdca,'userProfileId':_0xc09f32[_0x199e('0x53')]},'raw':!![]})[_0x199e('0x25')](function(_0x2bf593){if(_0x2bf593&&_0x2bf593[_0x199e('0x54')]===0x0){return db[_0x199e('0x29')][_0x199e('0x55')]({'name':_0x446c96[_0x199e('0x2d')],'resourceId':_0x446c96['id'],'type':_0x2bf593[_0x199e('0x2d')],'sectionId':_0x2bf593['id']},{})['then'](function(){return _0x405e37;});}else{return _0x405e37;}})[_0x199e('0x4a')](function(_0x414868){logger[_0x199e('0x2b')](_0x199e('0x56'),_0x414868);throw _0x414868;});}return _0x405e37;})['then'](respondWithResult(_0x198600,0xc9))[_0x199e('0x4a')](handleError(_0x198600,null));};exports[_0x199e('0x24')]=function(_0x58fbc7,_0x242e6c){if(_0x58fbc7['body']['id']){delete _0x58fbc7[_0x199e('0x4e')]['id'];}return db[_0x199e('0x2f')][_0x199e('0x4d')]({'where':{'id':_0x58fbc7[_0x199e('0x4c')]['id']}})[_0x199e('0x25')](handleEntityNotFound(_0x242e6c,null))['then'](saveUpdates(_0x58fbc7[_0x199e('0x4e')],null))[_0x199e('0x25')](respondWithResult(_0x242e6c,null))[_0x199e('0x4a')](handleError(_0x242e6c,null));};exports[_0x199e('0x26')]=function(_0x530545,_0x574590){return db[_0x199e('0x2f')][_0x199e('0x4d')]({'where':{'id':_0x530545[_0x199e('0x4c')]['id']}})[_0x199e('0x25')](handleEntityNotFound(_0x574590,null))['then'](removeEntity(_0x574590,null))[_0x199e('0x4a')](handleError(_0x574590,null));};exports[_0x199e('0x57')]=function(_0x3e00d0,_0x4fbdc7,_0x29019d){return db['AnalyticExtractedReport'][_0x199e('0x4d')]({'where':{'id':_0x3e00d0[_0x199e('0x4c')]['id']},'attributes':[_0x199e('0x2d'),'basename',_0x199e('0x58'),_0x199e('0x59')],'raw':!![]})[_0x199e('0x25')](handleEntityNotFound(_0x4fbdc7,null))[_0x199e('0x25')](function(_0x168ca6){if(_0x168ca6){if(!fs[_0x199e('0x5a')](path[_0x199e('0x5b')](config[_0x199e('0x5c')],_0x199e('0x5d'),_0x168ca6['savename']))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3e00d0[_0x199e('0x36')][_0x199e('0x5e')]){return _0x4fbdc7[_0x199e('0x19')](0xc8);}return _0x4fbdc7[_0x199e('0x57')](path[_0x199e('0x5b')](config[_0x199e('0x5c')],_0x199e('0x5d'),_0x168ca6[_0x199e('0x58')]),util[_0x199e('0x5f')](_0x199e('0x60'),_0x168ca6[_0x199e('0x61')]||_0x168ca6[_0x199e('0x2d')],_0x168ca6[_0x199e('0x59')][_0x199e('0x62')]()));}})[_0x199e('0x4a')](handleError(_0x4fbdc7,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 44043c6..93d2244 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 _0xfdfa=['AnalyticExtractedReport','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define'];(function(_0xcc97f3,_0x53ad64){var _0x25bd0c=function(_0x482225){while(--_0x482225){_0xcc97f3['push'](_0xcc97f3['shift']());}};_0x25bd0c(++_0x53ad64);}(_0xfdfa,0x88));var _0xafdf=function(_0x524f0e,_0x2e6801){_0x524f0e=_0x524f0e-0x0;var _0x630076=_0xfdfa[_0x524f0e];return _0x630076;};'use strict';var _=require(_0xafdf('0x0'));var util=require('util');var logger=require(_0xafdf('0x1'))(_0xafdf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xafdf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafdf('0x4'));var config=require(_0xafdf('0x5'));var attributes=require(_0xafdf('0x6'));module['exports']=function(_0x2bb4bd,_0xb8d8ad){return _0x2bb4bd[_0xafdf('0x7')](_0xafdf('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5852=['analytics_extracted_reports','lodash','util','api','bluebird','path','rimraf','./analyticExtractedReport.attributes','define'];(function(_0x488037,_0x338c3e){var _0x53aa99=function(_0x192a6c){while(--_0x192a6c){_0x488037['push'](_0x488037['shift']());}};_0x53aa99(++_0x338c3e);}(_0x5852,0x157));var _0x2585=function(_0x2ed08e,_0x31e039){_0x2ed08e=_0x2ed08e-0x0;var _0x5d98cb=_0x5852[_0x2ed08e];return _0x5d98cb;};'use strict';var _=require(_0x2585('0x0'));var util=require(_0x2585('0x1'));var logger=require('../../config/logger')(_0x2585('0x2'));var moment=require('moment');var BPromise=require(_0x2585('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2585('0x4'));var rimraf=require(_0x2585('0x5'));var config=require('../../config/environment');var attributes=require(_0x2585('0x6'));module['exports']=function(_0x2a9830,_0x16ed85){return _0x2a9830[_0x2585('0x7')]('AnalyticExtractedReport',attributes,{'tableName':_0x2585('0x8'),'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 824d1d3..8bff319 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 _0xea89=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','lodash','util','moment'];(function(_0x20c1e3,_0x3cdcde){var _0x55bd75=function(_0x29d8dd){while(--_0x29d8dd){_0x20c1e3['push'](_0x20c1e3['shift']());}};_0x55bd75(++_0x3cdcde);}(_0xea89,0xfa));var _0x9ea8=function(_0x51d70b,_0x17c1b1){_0x51d70b=_0x51d70b-0x0;var _0x3f5334=_0xea89[_0x51d70b];return _0x3f5334;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var moment=require(_0x9ea8('0x2'));var BPromise=require(_0x9ea8('0x3'));var rs=require(_0x9ea8('0x4'));var fs=require('fs');var Redis=require(_0x9ea8('0x5'));var db=require(_0x9ea8('0x6'))['db'];var utils=require(_0x9ea8('0x7'));var logger=require('../../config/logger')(_0x9ea8('0x8'));var config=require(_0x9ea8('0x9'));var jayson=require(_0x9ea8('0xa'));var client=jayson[_0x9ea8('0xb')][_0x9ea8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f7b38,_0x36c15e,_0x4875d2){return new BPromise(function(_0xcc54cb,_0x47e20f){return client[_0x9ea8('0xd')](_0x2f7b38,_0x4875d2)[_0x9ea8('0xe')](function(_0xd2435){logger[_0x9ea8('0xf')](_0x9ea8('0x10'),_0x36c15e,_0x9ea8('0x11'));logger[_0x9ea8('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x36c15e,_0x9ea8('0x11'),JSON['stringify'](_0xd2435));if(_0xd2435['error']){if(_0xd2435['error'][_0x9ea8('0x13')]===0x1f4){logger[_0x9ea8('0x14')](_0x9ea8('0x10'),_0x36c15e,_0xd2435[_0x9ea8('0x14')][_0x9ea8('0x15')]);return _0x47e20f(_0xd2435[_0x9ea8('0x14')]['message']);}logger[_0x9ea8('0x14')](_0x9ea8('0x10'),_0x36c15e,_0xd2435[_0x9ea8('0x14')]['message']);return _0xcc54cb(_0xd2435[_0x9ea8('0x14')][_0x9ea8('0x15')]);}else{logger[_0x9ea8('0xf')](_0x9ea8('0x10'),_0x36c15e,_0x9ea8('0x11'));_0xcc54cb(_0xd2435['result'][_0x9ea8('0x15')]);}})[_0x9ea8('0x16')](function(_0x46d12c){logger[_0x9ea8('0x14')](_0x9ea8('0x10'),_0x36c15e,_0x46d12c);_0x47e20f(_0x46d12c);});});} \ No newline at end of file +var _0x7035=['request','info','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xfc505d,_0x625d3b){var _0x2000c8=function(_0x1b34d0){while(--_0x1b34d0){_0xfc505d['push'](_0xfc505d['shift']());}};_0x2000c8(++_0x625d3b);}(_0x7035,0x15e));var _0x5703=function(_0x15a3e6,_0xe05732){_0x15a3e6=_0x15a3e6-0x0;var _0x4ad02d=_0x7035[_0x15a3e6];return _0x4ad02d;};'use strict';var _=require(_0x5703('0x0'));var util=require('util');var moment=require(_0x5703('0x1'));var BPromise=require(_0x5703('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5703('0x3'));var db=require(_0x5703('0x4'))['db'];var utils=require(_0x5703('0x5'));var logger=require(_0x5703('0x6'))(_0x5703('0x7'));var config=require('../../config/environment');var jayson=require(_0x5703('0x8'));var client=jayson[_0x5703('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2e90,_0x1b1ee9,_0x401d33){return new BPromise(function(_0x291988,_0x1afe73){return client[_0x5703('0xa')](_0x2e2e90,_0x401d33)['then'](function(_0x58a04c){logger[_0x5703('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b1ee9,_0x5703('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1b1ee9,_0x5703('0xc'),JSON[_0x5703('0xd')](_0x58a04c));if(_0x58a04c[_0x5703('0xe')]){if(_0x58a04c['error'][_0x5703('0xf')]===0x1f4){logger['error'](_0x5703('0x10'),_0x1b1ee9,_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);return _0x1afe73(_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);}logger[_0x5703('0xe')](_0x5703('0x10'),_0x1b1ee9,_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);return _0x291988(_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);}else{logger['info'](_0x5703('0x10'),_0x1b1ee9,_0x5703('0xc'));_0x291988(_0x58a04c[_0x5703('0x12')][_0x5703('0x11')]);}})[_0x5703('0x13')](function(_0x4576d4){logger[_0x5703('0xe')](_0x5703('0x10'),_0x1b1ee9,_0x4576d4);_0x1afe73(_0x4576d4);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 41164b9..da1d8c7 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 _0x84a3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x32dcd8,_0x23fa22){var _0x3e9868=function(_0x4f9a58){while(--_0x4f9a58){_0x32dcd8['push'](_0x32dcd8['shift']());}};_0x3e9868(++_0x23fa22);}(_0x84a3,0x1b4));var _0x384a=function(_0xfd7b9e,_0x431fbf){_0xfd7b9e=_0xfd7b9e-0x0;var _0x2ff2c3=_0x84a3[_0xfd7b9e];return _0x2ff2c3;};'use strict';var multer=require(_0x384a('0x0'));var util=require('util');var path=require(_0x384a('0x1'));var timeout=require(_0x384a('0x2'));var express=require(_0x384a('0x3'));var router=express[_0x384a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x384a('0x5'));var interaction=require(_0x384a('0x6'));var config=require(_0x384a('0x7'));var controller=require(_0x384a('0x8'));router['get']('/',auth[_0x384a('0x9')](),controller[_0x384a('0xa')]);router[_0x384a('0xb')](_0x384a('0xc'),auth['isAuthenticated'](),controller[_0x384a('0xd')]);router[_0x384a('0xb')](_0x384a('0xe'),auth[_0x384a('0x9')](),controller[_0x384a('0xf')]);router[_0x384a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x384a('0x11')]('/:id',auth[_0x384a('0x9')](),controller[_0x384a('0x12')]);router['delete'](_0x384a('0xc'),auth[_0x384a('0x9')](),controller[_0x384a('0x13')]);module[_0x384a('0x14')]=router; \ No newline at end of file +var _0xd9a2=['./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd9a2,0x142));var _0x2d9a=function(_0x40dd64,_0x55fda1){_0x40dd64=_0x40dd64-0x0;var _0x213898=_0xd9a2[_0x40dd64];return _0x213898;};'use strict';var multer=require(_0x2d9a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d9a('0x1'));var express=require(_0x2d9a('0x2'));var router=express[_0x2d9a('0x3')]();var fs_extra=require(_0x2d9a('0x4'));var auth=require(_0x2d9a('0x5'));var interaction=require(_0x2d9a('0x6'));var config=require(_0x2d9a('0x7'));var controller=require(_0x2d9a('0x8'));router[_0x2d9a('0x9')]('/',auth[_0x2d9a('0xa')](),controller[_0x2d9a('0xb')]);router['get']('/:id',auth[_0x2d9a('0xa')](),controller[_0x2d9a('0xc')]);router[_0x2d9a('0x9')](_0x2d9a('0xd'),auth['isAuthenticated'](),controller[_0x2d9a('0xe')]);router[_0x2d9a('0xf')]('/',auth[_0x2d9a('0xa')](),controller[_0x2d9a('0x10')]);router[_0x2d9a('0x11')](_0x2d9a('0x12'),auth[_0x2d9a('0xa')](),controller[_0x2d9a('0x13')]);router['delete'](_0x2d9a('0x12'),auth[_0x2d9a('0xa')](),controller[_0x2d9a('0x14')]);module[_0x2d9a('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9f1b01b..357a49c 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 _0xeac7=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0xc350,_0x2fb0f8){var _0x126021=function(_0x3f0b9e){while(--_0x3f0b9e){_0xc350['push'](_0xc350['shift']());}};_0x126021(++_0x2fb0f8);}(_0xeac7,0x88));var _0x7eac=function(_0x188b01,_0x2eb36b){_0x188b01=_0x188b01-0x0;var _0x40e1e8=_0xeac7[_0x188b01];return _0x40e1e8;};'use strict';var Sequelize=require(_0x7eac('0x0'));module[_0x7eac('0x1')]={'field':{'type':Sequelize[_0x7eac('0x2')]},'alias':{'type':Sequelize[_0x7eac('0x3')]},'function':{'type':Sequelize[_0x7eac('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x7eac('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xcc4a=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x1fcb67,_0x70fb6c){var _0x17a001=function(_0x43ae93){while(--_0x43ae93){_0x1fcb67['push'](_0x1fcb67['shift']());}};_0x17a001(++_0x70fb6c);}(_0xcc4a,0x16d));var _0xacc4=function(_0x232088,_0x580098){_0x232088=_0x232088-0x0;var _0x313f41=_0xcc4a[_0x232088];return _0x313f41;};'use strict';var Sequelize=require(_0xacc4('0x0'));module['exports']={'field':{'type':Sequelize[_0xacc4('0x1')]},'alias':{'type':Sequelize[_0xacc4('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xacc4('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 367ba6b..0615a00 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 _0x58b6=['include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','AnalyticFieldReport','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','options'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x58b6,0x102));var _0x658b=function(_0x372914,_0x53a9ba){_0x372914=_0x372914-0x0;var _0x198ffb=_0x58b6[_0x372914];return _0x198ffb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x658b('0x0'));var jsonpatch=require(_0x658b('0x1'));var rp=require(_0x658b('0x2'));var moment=require(_0x658b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x658b('0x4'));var sox=require(_0x658b('0x5'));var csv=require(_0x658b('0x6'));var ejs=require(_0x658b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x658b('0x8'));var crypto=require(_0x658b('0x9'));var jsforce=require(_0x658b('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x658b('0xb'));var Papa=require(_0x658b('0xc'));var Redis=require('ioredis');var authService=require(_0x658b('0xd'));var qs=require(_0x658b('0xe'));var as=require(_0x658b('0xf'));var hardwareService=require(_0x658b('0x10'));var logger=require(_0x658b('0x11'))(_0x658b('0x12'));var utils=require('../../config/utils');var config=require(_0x658b('0x13'));var licenseUtil=require(_0x658b('0x14'));var db=require(_0x658b('0x15'))['db'];function respondWithStatusCode(_0x15fdca,_0x4ac2fb){_0x4ac2fb=_0x4ac2fb||0xcc;return function(_0x5b7842){if(_0x5b7842){return _0x15fdca[_0x658b('0x16')](_0x4ac2fb);}return _0x15fdca['status'](_0x4ac2fb)['end']();};}function respondWithResult(_0x13b32a,_0x5c470f){_0x5c470f=_0x5c470f||0xc8;return function(_0x42e773){if(_0x42e773){return _0x13b32a['status'](_0x5c470f)[_0x658b('0x17')](_0x42e773);}};}function respondWithFilteredResult(_0x1831a8,_0x38b49e){return function(_0x3b0c45){if(_0x3b0c45){var _0x5a117a=typeof _0x38b49e[_0x658b('0x18')]===_0x658b('0x19')&&typeof _0x38b49e['limit']===_0x658b('0x19');var _0x273671=_0x3b0c45[_0x658b('0x1a')];var _0x21540d=_0x5a117a?0x0:_0x38b49e[_0x658b('0x18')];var _0x549ae3=_0x5a117a?_0x3b0c45[_0x658b('0x1a')]:_0x38b49e['offset']+_0x38b49e['limit'];var _0x40466c;if(_0x549ae3>=_0x273671){_0x549ae3=_0x273671;_0x40466c=0xc8;}else{_0x40466c=0xce;}_0x1831a8['status'](_0x40466c);return _0x1831a8[_0x658b('0x1b')](_0x658b('0x1c'),_0x21540d+'-'+_0x549ae3+'/'+_0x273671)[_0x658b('0x17')](_0x3b0c45);}return null;};}function patchUpdates(_0x44bce2){return function(_0x40e797){try{jsonpatch[_0x658b('0x1d')](_0x40e797,_0x44bce2,!![]);}catch(_0x156dcf){return BPromise[_0x658b('0x1e')](_0x156dcf);}return _0x40e797[_0x658b('0x1f')]();};}function saveUpdates(_0x5bc89a,_0x14f4de){return function(_0x5d7b4b){if(_0x5d7b4b){return _0x5d7b4b[_0x658b('0x20')](_0x5bc89a)['then'](function(_0x32c28d){return _0x32c28d;});}return null;};}function removeEntity(_0xf20119,_0x2486a0){return function(_0x4e38c6){if(_0x4e38c6){return _0x4e38c6[_0x658b('0x21')]()[_0x658b('0x22')](function(){_0xf20119['status'](0xcc)[_0x658b('0x23')]();});}};}function handleEntityNotFound(_0x53f5a0,_0xfb3651){return function(_0x4a8186){if(!_0x4a8186){_0x53f5a0[_0x658b('0x16')](0x194);}return _0x4a8186;};}function handleError(_0x3e08f7,_0xfaeaaa){_0xfaeaaa=_0xfaeaaa||0x1f4;return function(_0x14dfa8){logger[_0x658b('0x24')](_0x14dfa8[_0x658b('0x25')]);if(_0x14dfa8[_0x658b('0x26')]){delete _0x14dfa8[_0x658b('0x26')];}_0x3e08f7['status'](_0xfaeaaa)['send'](_0x14dfa8);};}exports[_0x658b('0x27')]=function(_0x58663a,_0x558b84){var _0x21b2f8={},_0x56554e={},_0x14f940={'count':0x0,'rows':[]};var _0x2f24b1=_['map'](db[_0x658b('0x28')]['rawAttributes'],function(_0x26acfe){return{'name':_0x26acfe[_0x658b('0x29')],'type':_0x26acfe[_0x658b('0x2a')]['key']};});_0x56554e[_0x658b('0x2b')]=_[_0x658b('0x2c')](_0x2f24b1,_0x658b('0x26'));_0x56554e[_0x658b('0x2d')]=_[_0x658b('0x2e')](_0x58663a[_0x658b('0x2d')]);_0x56554e['filters']=_[_0x658b('0x2f')](_0x56554e[_0x658b('0x2b')],_0x56554e['query']);_0x21b2f8[_0x658b('0x30')]=_['intersection'](_0x56554e['model'],qs[_0x658b('0x31')](_0x58663a['query']['fields']));_0x21b2f8[_0x658b('0x30')]=_0x21b2f8['attributes'][_0x658b('0x32')]?_0x21b2f8['attributes']:_0x56554e[_0x658b('0x2b')];if(!_0x58663a[_0x658b('0x2d')][_0x658b('0x33')](_0x658b('0x34'))){_0x21b2f8[_0x658b('0x35')]=qs[_0x658b('0x35')](_0x58663a[_0x658b('0x2d')][_0x658b('0x35')]);_0x21b2f8['offset']=qs[_0x658b('0x18')](_0x58663a[_0x658b('0x2d')][_0x658b('0x18')]);}_0x21b2f8[_0x658b('0x36')]=qs[_0x658b('0x37')](_0x58663a[_0x658b('0x2d')][_0x658b('0x37')]);_0x21b2f8[_0x658b('0x38')]=qs['filters'](_[_0x658b('0x39')](_0x58663a[_0x658b('0x2d')],_0x56554e[_0x658b('0x3a')]),_0x2f24b1);if(_0x58663a[_0x658b('0x2d')][_0x658b('0x3b')]){_0x21b2f8['where']=_['merge'](_0x21b2f8[_0x658b('0x38')],{'$or':_['map'](_0x2f24b1,function(_0x7cd337){if(_0x7cd337[_0x658b('0x2a')]!==_0x658b('0x3c')){var _0x15bf32={};_0x15bf32[_0x7cd337['name']]={'$like':'%'+_0x58663a['query'][_0x658b('0x3b')]+'%'};return _0x15bf32;}})});}_0x21b2f8=_['merge']({},_0x21b2f8,_0x58663a[_0x658b('0x3d')]);var _0x42ea74={'where':_0x21b2f8['where']};return db[_0x658b('0x28')][_0x658b('0x1a')](_0x42ea74)[_0x658b('0x22')](function(_0x1fa318){_0x14f940['count']=_0x1fa318;if(_0x58663a[_0x658b('0x2d')]['includeAll']){_0x21b2f8[_0x658b('0x3e')]=[{'all':!![]}];}return db[_0x658b('0x28')][_0x658b('0x3f')](_0x21b2f8);})['then'](function(_0x28ceff){_0x14f940[_0x658b('0x40')]=_0x28ceff;return _0x14f940;})[_0x658b('0x22')](respondWithFilteredResult(_0x558b84,_0x21b2f8))[_0x658b('0x41')](handleError(_0x558b84,null));};exports[_0x658b('0x42')]=function(_0x615260,_0x189097){var _0x40a080={'raw':![],'where':{'id':_0x615260[_0x658b('0x43')]['id']}},_0x3eb524={};_0x3eb524[_0x658b('0x2b')]=_[_0x658b('0x2e')](db[_0x658b('0x28')][_0x658b('0x44')]);_0x3eb524['query']=_[_0x658b('0x2e')](_0x615260[_0x658b('0x2d')]);_0x3eb524[_0x658b('0x3a')]=_['intersection'](_0x3eb524[_0x658b('0x2b')],_0x3eb524[_0x658b('0x2d')]);_0x40a080['attributes']=_[_0x658b('0x2f')](_0x3eb524['model'],qs[_0x658b('0x31')](_0x615260[_0x658b('0x2d')]['fields']));_0x40a080[_0x658b('0x30')]=_0x40a080[_0x658b('0x30')][_0x658b('0x32')]?_0x40a080[_0x658b('0x30')]:_0x3eb524[_0x658b('0x2b')];if(_0x615260[_0x658b('0x2d')][_0x658b('0x45')]){_0x40a080[_0x658b('0x3e')]=[{'all':!![]}];}_0x40a080=_['merge']({},_0x40a080,_0x615260[_0x658b('0x3d')]);return db['AnalyticFieldReport'][_0x658b('0x46')](_0x40a080)['then'](handleEntityNotFound(_0x189097,null))[_0x658b('0x22')](respondWithResult(_0x189097,null))[_0x658b('0x41')](handleError(_0x189097,null));};exports[_0x658b('0x47')]=function(_0x3c592c,_0x406f41){return db['AnalyticFieldReport'][_0x658b('0x47')](_0x3c592c[_0x658b('0x48')],{})[_0x658b('0x22')](respondWithResult(_0x406f41,0xc9))[_0x658b('0x41')](handleError(_0x406f41,null));};exports[_0x658b('0x49')]=function(_0x3c12fa,_0x5ab707){return db[_0x658b('0x28')][_0x658b('0x49')](_0x3c12fa[_0x658b('0x48')],{'raw':![],'individualHooks':!![]})[_0x658b('0x22')](respondWithResult(_0x5ab707,0xc9))[_0x658b('0x41')](handleError(_0x5ab707,null));};exports[_0x658b('0x20')]=function(_0x23bf09,_0xed118c){if(_0x23bf09[_0x658b('0x48')]['id']){delete _0x23bf09['body']['id'];}return db[_0x658b('0x28')][_0x658b('0x46')]({'where':{'id':_0x23bf09[_0x658b('0x43')]['id']}})[_0x658b('0x22')](handleEntityNotFound(_0xed118c,null))[_0x658b('0x22')](saveUpdates(_0x23bf09[_0x658b('0x48')],null))['then'](respondWithResult(_0xed118c,null))['catch'](handleError(_0xed118c,null));};exports['destroy']=function(_0x186a24,_0x1720db){return db[_0x658b('0x28')]['find']({'where':{'id':_0x186a24['params']['id']}})['then'](handleEntityNotFound(_0x1720db,null))[_0x658b('0x22')](removeEntity(_0x1720db,null))[_0x658b('0x41')](handleError(_0x1720db,null));};exports['bulkDestroy']=function(_0x2dabba,_0x35b575){return db[_0x658b('0x28')]['destroy']({'where':{'id':_0x2dabba[_0x658b('0x2d')][_0x658b('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x35b575,0xcc))['catch'](handleError(_0x35b575,null));};exports[_0x658b('0x4b')]=function(_0x51431e,_0x1ebb54,_0x33e2a3){return db[_0x658b('0x4c')][_0x658b('0x4d')]({'where':{'id':_0x51431e[_0x658b('0x43')]['id']}})[_0x658b('0x22')](handleEntityNotFound(_0x1ebb54,null))[_0x658b('0x22')](function(_0x3fdc28){if(_0x3fdc28){return db[_0x658b('0x4e')][_0x658b('0x4f')](function(_0x4ad98a){return db['AnalyticFieldReport'][_0x658b('0x21')]({'where':{'CustomReportId':_0x51431e[_0x658b('0x43')]['id']},'transaction':_0x4ad98a})['then'](function(_0x415ebb){var _0x8dec55=_[_0x658b('0x2c')](_0x51431e[_0x658b('0x48')],function(_0x195809){delete _0x195809['id'];_0x195809['CustomReportId']=_0x51431e[_0x658b('0x43')]['id'];return _0x195809;});return db[_0x658b('0x28')]['bulkCreate'](_0x8dec55,{'transaction':_0x4ad98a});});})[_0x658b('0x22')](function(){return db[_0x658b('0x28')]['findAll']({'where':{'CustomReportId':_0x51431e['params']['id']}});});}})[_0x658b('0x22')](respondWithResult(_0x1ebb54,null))[_0x658b('0x41')](handleError(_0x1ebb54,null));}; \ No newline at end of file +var _0xe7e3=['util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','rows','catch','show','rawAttributes','includeAll','options','create','bulkCreate','body','find','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','findAll','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xe7e3,0x1e0));var _0x3e7e=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xe7e3[_0x425716];return _0x2d39af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e7e('0x0'));var zipdir=require(_0x3e7e('0x1'));var jsonpatch=require(_0x3e7e('0x2'));var rp=require(_0x3e7e('0x3'));var moment=require('moment');var BPromise=require(_0x3e7e('0x4'));var Mustache=require(_0x3e7e('0x5'));var util=require(_0x3e7e('0x6'));var path=require('path');var sox=require(_0x3e7e('0x7'));var csv=require(_0x3e7e('0x8'));var ejs=require(_0x3e7e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e7e('0xa'));var squel=require(_0x3e7e('0xb'));var crypto=require(_0x3e7e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3e7e('0xd'));var toCsv=require(_0x3e7e('0x8'));var querystring=require('querystring');var Papa=require(_0x3e7e('0xe'));var Redis=require(_0x3e7e('0xf'));var authService=require(_0x3e7e('0x10'));var qs=require(_0x3e7e('0x11'));var as=require(_0x3e7e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e7e('0x13'))(_0x3e7e('0x14'));var utils=require(_0x3e7e('0x15'));var config=require(_0x3e7e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e7e('0x17'))['db'];function respondWithStatusCode(_0x3c181c,_0x55385f){_0x55385f=_0x55385f||0xcc;return function(_0x4a9281){if(_0x4a9281){return _0x3c181c[_0x3e7e('0x18')](_0x55385f);}return _0x3c181c[_0x3e7e('0x19')](_0x55385f)[_0x3e7e('0x1a')]();};}function respondWithResult(_0xd0ea33,_0x478996){_0x478996=_0x478996||0xc8;return function(_0x24d441){if(_0x24d441){return _0xd0ea33[_0x3e7e('0x19')](_0x478996)[_0x3e7e('0x1b')](_0x24d441);}};}function respondWithFilteredResult(_0x40f8f6,_0xa68846){return function(_0x3e4e53){if(_0x3e4e53){var _0x2a1bf7=typeof _0xa68846[_0x3e7e('0x1c')]===_0x3e7e('0x1d')&&typeof _0xa68846[_0x3e7e('0x1e')]===_0x3e7e('0x1d');var _0xeae54f=_0x3e4e53['count'];var _0x40c7f9=_0x2a1bf7?0x0:_0xa68846['offset'];var _0x57bb98=_0x2a1bf7?_0x3e4e53[_0x3e7e('0x1f')]:_0xa68846[_0x3e7e('0x1c')]+_0xa68846['limit'];var _0x4b3cb6;if(_0x57bb98>=_0xeae54f){_0x57bb98=_0xeae54f;_0x4b3cb6=0xc8;}else{_0x4b3cb6=0xce;}_0x40f8f6['status'](_0x4b3cb6);return _0x40f8f6[_0x3e7e('0x20')]('Content-Range',_0x40c7f9+'-'+_0x57bb98+'/'+_0xeae54f)['json'](_0x3e4e53);}return null;};}function patchUpdates(_0x38711e){return function(_0x34a53d){try{jsonpatch[_0x3e7e('0x21')](_0x34a53d,_0x38711e,!![]);}catch(_0x31e8b8){return BPromise[_0x3e7e('0x22')](_0x31e8b8);}return _0x34a53d[_0x3e7e('0x23')]();};}function saveUpdates(_0x36c823,_0x58b9eb){return function(_0x34ac97){if(_0x34ac97){return _0x34ac97[_0x3e7e('0x24')](_0x36c823)[_0x3e7e('0x25')](function(_0x5ec167){return _0x5ec167;});}return null;};}function removeEntity(_0x26dc78,_0x5ccddf){return function(_0x435a12){if(_0x435a12){return _0x435a12[_0x3e7e('0x26')]()['then'](function(){_0x26dc78[_0x3e7e('0x19')](0xcc)[_0x3e7e('0x1a')]();});}};}function handleEntityNotFound(_0x2154d2,_0x3dc98d){return function(_0x464c98){if(!_0x464c98){_0x2154d2[_0x3e7e('0x18')](0x194);}return _0x464c98;};}function handleError(_0x329563,_0x5bc56b){_0x5bc56b=_0x5bc56b||0x1f4;return function(_0x8080c4){logger[_0x3e7e('0x27')](_0x8080c4[_0x3e7e('0x28')]);if(_0x8080c4[_0x3e7e('0x29')]){delete _0x8080c4[_0x3e7e('0x29')];}_0x329563[_0x3e7e('0x19')](_0x5bc56b)[_0x3e7e('0x2a')](_0x8080c4);};}exports[_0x3e7e('0x2b')]=function(_0x11e703,_0x57c41){var _0x149f37={},_0x4062e0={},_0x48a4a0={'count':0x0,'rows':[]};var _0x45f98b=_[_0x3e7e('0x2c')](db[_0x3e7e('0x2d')]['rawAttributes'],function(_0x2e8cbf){return{'name':_0x2e8cbf[_0x3e7e('0x2e')],'type':_0x2e8cbf['type']['key']};});_0x4062e0['model']=_[_0x3e7e('0x2c')](_0x45f98b,_0x3e7e('0x29'));_0x4062e0[_0x3e7e('0x2f')]=_[_0x3e7e('0x30')](_0x11e703['query']);_0x4062e0[_0x3e7e('0x31')]=_[_0x3e7e('0x32')](_0x4062e0['model'],_0x4062e0[_0x3e7e('0x2f')]);_0x149f37[_0x3e7e('0x33')]=_[_0x3e7e('0x32')](_0x4062e0['model'],qs[_0x3e7e('0x34')](_0x11e703[_0x3e7e('0x2f')][_0x3e7e('0x34')]));_0x149f37[_0x3e7e('0x33')]=_0x149f37[_0x3e7e('0x33')][_0x3e7e('0x35')]?_0x149f37['attributes']:_0x4062e0[_0x3e7e('0x36')];if(!_0x11e703[_0x3e7e('0x2f')][_0x3e7e('0x37')](_0x3e7e('0x38'))){_0x149f37[_0x3e7e('0x1e')]=qs[_0x3e7e('0x1e')](_0x11e703['query']['limit']);_0x149f37[_0x3e7e('0x1c')]=qs['offset'](_0x11e703[_0x3e7e('0x2f')]['offset']);}_0x149f37[_0x3e7e('0x39')]=qs['sort'](_0x11e703[_0x3e7e('0x2f')][_0x3e7e('0x3a')]);_0x149f37[_0x3e7e('0x3b')]=qs['filters'](_['pick'](_0x11e703[_0x3e7e('0x2f')],_0x4062e0[_0x3e7e('0x31')]),_0x45f98b);if(_0x11e703[_0x3e7e('0x2f')][_0x3e7e('0x3c')]){_0x149f37[_0x3e7e('0x3b')]=_[_0x3e7e('0x3d')](_0x149f37[_0x3e7e('0x3b')],{'$or':_[_0x3e7e('0x2c')](_0x45f98b,function(_0x53840e){if(_0x53840e['type']!=='VIRTUAL'){var _0x41c4d4={};_0x41c4d4[_0x53840e[_0x3e7e('0x29')]]={'$like':'%'+_0x11e703[_0x3e7e('0x2f')][_0x3e7e('0x3c')]+'%'};return _0x41c4d4;}})});}_0x149f37=_[_0x3e7e('0x3d')]({},_0x149f37,_0x11e703['options']);var _0x127608={'where':_0x149f37[_0x3e7e('0x3b')]};return db[_0x3e7e('0x2d')][_0x3e7e('0x1f')](_0x127608)['then'](function(_0x47f37b){_0x48a4a0[_0x3e7e('0x1f')]=_0x47f37b;if(_0x11e703['query']['includeAll']){_0x149f37[_0x3e7e('0x3e')]=[{'all':!![]}];}return db[_0x3e7e('0x2d')]['findAll'](_0x149f37);})[_0x3e7e('0x25')](function(_0x11c0be){_0x48a4a0[_0x3e7e('0x3f')]=_0x11c0be;return _0x48a4a0;})['then'](respondWithFilteredResult(_0x57c41,_0x149f37))[_0x3e7e('0x40')](handleError(_0x57c41,null));};exports[_0x3e7e('0x41')]=function(_0x1217f,_0x570d56){var _0x317463={'raw':![],'where':{'id':_0x1217f['params']['id']}},_0x44903d={};_0x44903d[_0x3e7e('0x36')]=_[_0x3e7e('0x30')](db[_0x3e7e('0x2d')][_0x3e7e('0x42')]);_0x44903d['query']=_[_0x3e7e('0x30')](_0x1217f[_0x3e7e('0x2f')]);_0x44903d['filters']=_[_0x3e7e('0x32')](_0x44903d[_0x3e7e('0x36')],_0x44903d['query']);_0x317463[_0x3e7e('0x33')]=_['intersection'](_0x44903d[_0x3e7e('0x36')],qs[_0x3e7e('0x34')](_0x1217f[_0x3e7e('0x2f')]['fields']));_0x317463[_0x3e7e('0x33')]=_0x317463['attributes'][_0x3e7e('0x35')]?_0x317463[_0x3e7e('0x33')]:_0x44903d[_0x3e7e('0x36')];if(_0x1217f[_0x3e7e('0x2f')][_0x3e7e('0x43')]){_0x317463[_0x3e7e('0x3e')]=[{'all':!![]}];}_0x317463=_['merge']({},_0x317463,_0x1217f[_0x3e7e('0x44')]);return db[_0x3e7e('0x2d')]['find'](_0x317463)[_0x3e7e('0x25')](handleEntityNotFound(_0x570d56,null))[_0x3e7e('0x25')](respondWithResult(_0x570d56,null))[_0x3e7e('0x40')](handleError(_0x570d56,null));};exports[_0x3e7e('0x45')]=function(_0x1145e2,_0x3fce43){return db['AnalyticFieldReport'][_0x3e7e('0x45')](_0x1145e2['body'],{})[_0x3e7e('0x25')](respondWithResult(_0x3fce43,0xc9))[_0x3e7e('0x40')](handleError(_0x3fce43,null));};exports[_0x3e7e('0x46')]=function(_0x2adfc5,_0x53acfa){return db[_0x3e7e('0x2d')][_0x3e7e('0x46')](_0x2adfc5[_0x3e7e('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x53acfa,0xc9))[_0x3e7e('0x40')](handleError(_0x53acfa,null));};exports[_0x3e7e('0x24')]=function(_0x431e0,_0x4956b1){if(_0x431e0[_0x3e7e('0x47')]['id']){delete _0x431e0[_0x3e7e('0x47')]['id'];}return db[_0x3e7e('0x2d')][_0x3e7e('0x48')]({'where':{'id':_0x431e0[_0x3e7e('0x49')]['id']}})[_0x3e7e('0x25')](handleEntityNotFound(_0x4956b1,null))[_0x3e7e('0x25')](saveUpdates(_0x431e0[_0x3e7e('0x47')],null))[_0x3e7e('0x25')](respondWithResult(_0x4956b1,null))['catch'](handleError(_0x4956b1,null));};exports['destroy']=function(_0x4c7cd1,_0x52f22f){return db[_0x3e7e('0x2d')][_0x3e7e('0x48')]({'where':{'id':_0x4c7cd1['params']['id']}})['then'](handleEntityNotFound(_0x52f22f,null))[_0x3e7e('0x25')](removeEntity(_0x52f22f,null))['catch'](handleError(_0x52f22f,null));};exports[_0x3e7e('0x4a')]=function(_0x236c7e,_0x114b64){return db[_0x3e7e('0x2d')][_0x3e7e('0x26')]({'where':{'id':_0x236c7e['query'][_0x3e7e('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x3e7e('0x25')](respondWithResult(_0x114b64,0xcc))[_0x3e7e('0x40')](handleError(_0x114b64,null));};exports[_0x3e7e('0x4c')]=function(_0x43a553,_0x1b5dd5,_0xa3f8f8){return db[_0x3e7e('0x4d')][_0x3e7e('0x4e')]({'where':{'id':_0x43a553[_0x3e7e('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b5dd5,null))[_0x3e7e('0x25')](function(_0x28615d){if(_0x28615d){return db[_0x3e7e('0x4f')]['transaction'](function(_0x347399){return db[_0x3e7e('0x2d')][_0x3e7e('0x26')]({'where':{'CustomReportId':_0x43a553['params']['id']},'transaction':_0x347399})[_0x3e7e('0x25')](function(_0x1a55ff){var _0x2efadb=_[_0x3e7e('0x2c')](_0x43a553[_0x3e7e('0x47')],function(_0x298a50){delete _0x298a50['id'];_0x298a50['CustomReportId']=_0x43a553[_0x3e7e('0x49')]['id'];return _0x298a50;});return db[_0x3e7e('0x2d')]['bulkCreate'](_0x2efadb,{'transaction':_0x347399});});})[_0x3e7e('0x25')](function(){return db['AnalyticFieldReport'][_0x3e7e('0x50')]({'where':{'CustomReportId':_0x43a553[_0x3e7e('0x49')]['id']}});});}})[_0x3e7e('0x25')](respondWithResult(_0x1b5dd5,null))[_0x3e7e('0x40')](handleError(_0x1b5dd5,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index cc9916a..2bc7135 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 _0x406d=['moment','path','rimraf','./analyticFieldReport.attributes','exports','analytics_report_fields','util','../../config/logger','api'];(function(_0x247506,_0x5e364b){var _0x2f17d4=function(_0x48c6d2){while(--_0x48c6d2){_0x247506['push'](_0x247506['shift']());}};_0x2f17d4(++_0x5e364b);}(_0x406d,0x7b));var _0xd406=function(_0x3db58d,_0x3f0c01){_0x3db58d=_0x3db58d-0x0;var _0x17158d=_0x406d[_0x3db58d];return _0x17158d;};'use strict';var _=require('lodash');var util=require(_0xd406('0x0'));var logger=require(_0xd406('0x1'))(_0xd406('0x2'));var moment=require(_0xd406('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd406('0x4'));var rimraf=require(_0xd406('0x5'));var config=require('../../config/environment');var attributes=require(_0xd406('0x6'));module[_0xd406('0x7')]=function(_0x5e0f2d,_0x2e43f3){return _0x5e0f2d['define']('AnalyticFieldReport',attributes,{'tableName':_0xd406('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa45=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x5c027f,_0xa40135){var _0x5392f3=function(_0x581c3b){while(--_0x581c3b){_0x5c027f['push'](_0x5c027f['shift']());}};_0x5392f3(++_0xa40135);}(_0xfa45,0x1be));var _0x5fa4=function(_0xc48309,_0x452c9f){_0xc48309=_0xc48309-0x0;var _0x45880f=_0xfa45[_0xc48309];return _0x45880f;};'use strict';var _=require(_0x5fa4('0x0'));var util=require('util');var logger=require(_0x5fa4('0x1'))(_0x5fa4('0x2'));var moment=require(_0x5fa4('0x3'));var BPromise=require('bluebird');var rp=require(_0x5fa4('0x4'));var fs=require('fs');var path=require(_0x5fa4('0x5'));var rimraf=require(_0x5fa4('0x6'));var config=require(_0x5fa4('0x7'));var attributes=require(_0x5fa4('0x8'));module[_0x5fa4('0x9')]=function(_0x524b77,_0x392112){return _0x524b77[_0x5fa4('0xa')](_0x5fa4('0xb'),attributes,{'tableName':_0x5fa4('0xc'),'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 f5aa9ba..bcbb9fc 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 _0x5a3e=['../../config/utils','../../config/logger','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','result','lodash','util','moment','ioredis','../../mysqldb'];(function(_0xf46a3a,_0x2186e1){var _0x47c2ee=function(_0x4df476){while(--_0x4df476){_0xf46a3a['push'](_0xf46a3a['shift']());}};_0x47c2ee(++_0x2186e1);}(_0x5a3e,0x177));var _0xe5a3=function(_0xf692d8,_0x1060a2){_0xf692d8=_0xf692d8-0x0;var _0x2765cd=_0x5a3e[_0xf692d8];return _0x2765cd;};'use strict';var _=require(_0xe5a3('0x0'));var util=require(_0xe5a3('0x1'));var moment=require(_0xe5a3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5a3('0x3'));var db=require(_0xe5a3('0x4'))['db'];var utils=require(_0xe5a3('0x5'));var logger=require(_0xe5a3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe5a3('0x7')][_0xe5a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x155ee6,_0xc51179,_0x518f80){return new BPromise(function(_0x33e2ff,_0x25d834){return client[_0xe5a3('0x9')](_0x155ee6,_0x518f80)[_0xe5a3('0xa')](function(_0x7e5355){logger[_0xe5a3('0xb')](_0xe5a3('0xc'),_0xc51179,_0xe5a3('0xd'));logger[_0xe5a3('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xc51179,_0xe5a3('0xd'),JSON[_0xe5a3('0xf')](_0x7e5355));if(_0x7e5355['error']){if(_0x7e5355['error']['code']===0x1f4){logger['error'](_0xe5a3('0xc'),_0xc51179,_0x7e5355['error'][_0xe5a3('0x10')]);return _0x25d834(_0x7e5355[_0xe5a3('0x11')]['message']);}logger[_0xe5a3('0x11')](_0xe5a3('0xc'),_0xc51179,_0x7e5355[_0xe5a3('0x11')][_0xe5a3('0x10')]);return _0x33e2ff(_0x7e5355[_0xe5a3('0x11')][_0xe5a3('0x10')]);}else{logger['info'](_0xe5a3('0xc'),_0xc51179,'request\x20sent');_0x33e2ff(_0x7e5355[_0xe5a3('0x12')][_0xe5a3('0x10')]);}})['catch'](function(_0x4c57c1){logger[_0xe5a3('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0xc51179,_0x4c57c1);_0x25d834(_0x4c57c1);});});} \ No newline at end of file +var _0x6794=['rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6794,0x16f));var _0x4679=function(_0x23536e,_0x1f35a2){_0x23536e=_0x23536e-0x0;var _0x70f515=_0x6794[_0x23536e];return _0x70f515;};'use strict';var _=require(_0x4679('0x0'));var util=require(_0x4679('0x1'));var moment=require(_0x4679('0x2'));var BPromise=require(_0x4679('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4679('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4679('0x5'));var logger=require(_0x4679('0x6'))(_0x4679('0x7'));var config=require(_0x4679('0x8'));var jayson=require(_0x4679('0x9'));var client=jayson[_0x4679('0xa')][_0x4679('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x410600,_0x2960fc,_0x2686b6){return new BPromise(function(_0x2a12fd,_0x3b665f){return client['request'](_0x410600,_0x2686b6)[_0x4679('0xc')](function(_0x47dc9){logger[_0x4679('0xd')](_0x4679('0xe'),_0x2960fc,'request\x20sent');logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2960fc,'request\x20sent',JSON[_0x4679('0xf')](_0x47dc9));if(_0x47dc9['error']){if(_0x47dc9[_0x4679('0x10')][_0x4679('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2960fc,_0x47dc9['error'][_0x4679('0x12')]);return _0x3b665f(_0x47dc9[_0x4679('0x10')][_0x4679('0x12')]);}logger[_0x4679('0x10')](_0x4679('0xe'),_0x2960fc,_0x47dc9[_0x4679('0x10')][_0x4679('0x12')]);return _0x2a12fd(_0x47dc9[_0x4679('0x10')][_0x4679('0x12')]);}else{logger[_0x4679('0xd')](_0x4679('0xe'),_0x2960fc,_0x4679('0x13'));_0x2a12fd(_0x47dc9[_0x4679('0x14')][_0x4679('0x12')]);}})[_0x4679('0x15')](function(_0x3e6f09){logger[_0x4679('0x10')](_0x4679('0xe'),_0x2960fc,_0x3e6f09);_0x3b665f(_0x3e6f09);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4e853d0..209fc1f 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(_0x8cb724,_0x5e78d5){var _0x348d6f=function(_0x7b70ea){while(--_0x7b70ea){_0x8cb724['push'](_0x8cb724['shift']());}};_0x348d6f(++_0x5e78d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x4875e8,_0x30267d){var _0x54942e=function(_0x5a340f){while(--_0x5a340f){_0x4875e8['push'](_0x4875e8['shift']());}};_0x54942e(++_0x30267d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 5e9d135..de376f1 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 _0x6594=['TEXT','STRING'];(function(_0x47bcf7,_0x43d5aa){var _0x2efd4e=function(_0x566095){while(--_0x566095){_0x47bcf7['push'](_0x47bcf7['shift']());}};_0x2efd4e(++_0x43d5aa);}(_0x6594,0xcb));var _0x4659=function(_0x5e8c0f,_0x1f20d9){_0x5e8c0f=_0x5e8c0f-0x0;var _0x568dbe=_0x6594[_0x5e8c0f];return _0x568dbe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x4659('0x0')]},'metric':{'type':Sequelize[_0x4659('0x1')]},'description':{'type':Sequelize[_0x4659('0x0')]}}; \ No newline at end of file +var _0x7df3=['sequelize','exports','name','TEXT'];(function(_0x35bf25,_0xff9266){var _0x472a0e=function(_0x286a3f){while(--_0x286a3f){_0x35bf25['push'](_0x35bf25['shift']());}};_0x472a0e(++_0xff9266);}(_0x7df3,0x1cc));var _0x37df=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7df3[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x37df('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x37df('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b5dec17..a05d547 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 _0x9957=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,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(_0x83338,_0x1834bc){var _0x27aca9=function(_0x5588f7){while(--_0x5588f7){_0x83338['push'](_0x83338['shift']());}};_0x27aca9(++_0x1834bc);}(_0x24ca,0x1bc));var _0xa24c=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x24ca[_0x25a42a];return _0x1129b1;};'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 4ac7e38..a94dcba 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 _0xf88f=['analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric'];(function(_0x108442,_0x4359df){var _0x450b63=function(_0x3216ad){while(--_0x3216ad){_0x108442['push'](_0x108442['shift']());}};_0x450b63(++_0x4359df);}(_0xf88f,0x1bb));var _0xff88=function(_0x154c66,_0x9ba0f2){_0x154c66=_0x154c66-0x0;var _0x1c68be=_0xf88f[_0x154c66];return _0x1c68be;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var logger=require(_0xff88('0x2'))(_0xff88('0x3'));var moment=require(_0xff88('0x4'));var BPromise=require(_0xff88('0x5'));var rp=require(_0xff88('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff88('0x7'));var config=require(_0xff88('0x8'));var attributes=require(_0xff88('0x9'));module['exports']=function(_0x38e1df,_0x406a2e){return _0x38e1df[_0xff88('0xa')](_0xff88('0xb'),attributes,{'tableName':_0xff88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1203=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x1203,0x8c));var _0x3120=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var logger=require(_0x3120('0x2'))(_0x3120('0x3'));var moment=require(_0x3120('0x4'));var BPromise=require(_0x3120('0x5'));var rp=require(_0x3120('0x6'));var fs=require('fs');var path=require(_0x3120('0x7'));var rimraf=require(_0x3120('0x8'));var config=require(_0x3120('0x9'));var attributes=require(_0x3120('0xa'));module[_0x3120('0xb')]=function(_0x24de12,_0x835eba){return _0x24de12[_0x3120('0xc')](_0x3120('0xd'),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 bd38193..8f0dc65 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 _0x6e5c=['jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x147694,_0x3e5dc8){var _0x127d3a=function(_0x4bfe80){while(--_0x4bfe80){_0x147694['push'](_0x147694['shift']());}};_0x127d3a(++_0x3e5dc8);}(_0x6e5c,0x178));var _0xc6e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc6e5('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6e5('0x1'));var db=require(_0xc6e5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6e5('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc6e5('0x4'));var client=jayson[_0xc6e5('0x5')][_0xc6e5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26692a,_0x54f17d,_0x345098){return new BPromise(function(_0x599fc5,_0x5c11c7){return client[_0xc6e5('0x7')](_0x26692a,_0x345098)[_0xc6e5('0x8')](function(_0x5ed201){logger['info'](_0xc6e5('0x9'),_0x54f17d,_0xc6e5('0xa'));logger[_0xc6e5('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x54f17d,'request\x20sent',JSON[_0xc6e5('0xc')](_0x5ed201));if(_0x5ed201[_0xc6e5('0xd')]){if(_0x5ed201[_0xc6e5('0xd')][_0xc6e5('0xe')]===0x1f4){logger[_0xc6e5('0xd')](_0xc6e5('0x9'),_0x54f17d,_0x5ed201[_0xc6e5('0xd')]['message']);return _0x5c11c7(_0x5ed201[_0xc6e5('0xd')]['message']);}logger[_0xc6e5('0xd')](_0xc6e5('0x9'),_0x54f17d,_0x5ed201[_0xc6e5('0xd')][_0xc6e5('0xf')]);return _0x599fc5(_0x5ed201[_0xc6e5('0xd')][_0xc6e5('0xf')]);}else{logger[_0xc6e5('0x10')](_0xc6e5('0x9'),_0x54f17d,_0xc6e5('0xa'));_0x599fc5(_0x5ed201[_0xc6e5('0x11')][_0xc6e5('0xf')]);}})[_0xc6e5('0x12')](function(_0x4ac952){logger[_0xc6e5('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x54f17d,_0x4ac952);_0x5c11c7(_0x4ac952);});});} \ No newline at end of file +var _0x1652=['AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x1652,0x137));var _0x2165=function(_0x23600c,_0x31d165){_0x23600c=_0x23600c-0x0;var _0x57f2a2=_0x1652[_0x23600c];return _0x57f2a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2165('0x0'));var BPromise=require(_0x2165('0x1'));var rs=require(_0x2165('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2165('0x3'));var logger=require('../../config/logger')(_0x2165('0x4'));var config=require('../../config/environment');var jayson=require(_0x2165('0x5'));var client=jayson[_0x2165('0x6')][_0x2165('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3768fa,_0x3d5f0f,_0x190024){return new BPromise(function(_0x2a05bf,_0x226f6b){return client[_0x2165('0x8')](_0x3768fa,_0x190024)[_0x2165('0x9')](function(_0x504a5c){logger[_0x2165('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x3d5f0f,_0x2165('0xb'));logger['debug'](_0x2165('0xc'),_0x3d5f0f,_0x2165('0xb'),JSON['stringify'](_0x504a5c));if(_0x504a5c[_0x2165('0xd')]){if(_0x504a5c[_0x2165('0xd')][_0x2165('0xe')]===0x1f4){logger['error'](_0x2165('0xf'),_0x3d5f0f,_0x504a5c['error'][_0x2165('0x10')]);return _0x226f6b(_0x504a5c[_0x2165('0xd')]['message']);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3d5f0f,_0x504a5c[_0x2165('0xd')][_0x2165('0x10')]);return _0x2a05bf(_0x504a5c[_0x2165('0xd')][_0x2165('0x10')]);}else{logger[_0x2165('0xa')](_0x2165('0xf'),_0x3d5f0f,_0x2165('0xb'));_0x2a05bf(_0x504a5c[_0x2165('0x11')]['message']);}})[_0x2165('0x12')](function(_0x4a615a){logger[_0x2165('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x3d5f0f,_0x4a615a);_0x226f6b(_0x4a615a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 95db50c..9ab6296 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 _0xeecc=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xeecc,0x12d));var _0xceec=function(_0x21ce09,_0x80e5e6){_0x21ce09=_0x21ce09-0x0;var _0x4dfa41=_0xeecc[_0x21ce09];return _0x4dfa41;};'use strict';var multer=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var path=require(_0xceec('0x2'));var timeout=require(_0xceec('0x3'));var express=require('express');var router=express[_0xceec('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xceec('0x5'));var controller=require(_0xceec('0x6'));router[_0xceec('0x7')]('/',auth[_0xceec('0x8')](),controller['index']);router[_0xceec('0x7')]('/:id',auth[_0xceec('0x8')](),controller[_0xceec('0x9')]);router[_0xceec('0xa')]('/',auth[_0xceec('0x8')](),controller[_0xceec('0xb')]);router[_0xceec('0xc')](_0xceec('0xd'),auth['isAuthenticated'](),controller[_0xceec('0xe')]);router[_0xceec('0xf')](_0xceec('0xd'),auth[_0xceec('0x8')](),controller[_0xceec('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3561=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','put','/:id','update','exports','multer','path','connect-timeout','express'];(function(_0x262966,_0x17911e){var _0x40b6b9=function(_0x59aec7){while(--_0x59aec7){_0x262966['push'](_0x262966['shift']());}};_0x40b6b9(++_0x17911e);}(_0x3561,0x94));var _0x1356=function(_0x5247b8,_0x5ca75e){_0x5247b8=_0x5247b8-0x0;var _0x362acd=_0x3561[_0x5247b8];return _0x362acd;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/:id',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1356('0xf')](_0x1356('0x10'),auth['isAuthenticated'](),controller[_0x1356('0x11')]);router['delete'](_0x1356('0x10'),auth[_0x1356('0xb')](),controller['destroy']);module[_0x1356('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 0db49f7..f1e6c16 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 _0x2ebc=['exports','TEXT','sequelize'];(function(_0x15b9b9,_0x81f07f){var _0x1a8d00=function(_0x31c8db){while(--_0x31c8db){_0x15b9b9['push'](_0x15b9b9['shift']());}};_0x1a8d00(++_0x81f07f);}(_0x2ebc,0xa4));var _0xc2eb=function(_0x177d5b,_0xf666a5){_0x177d5b=_0x177d5b-0x0;var _0x4c64d5=_0x2ebc[_0x177d5b];return _0x4c64d5;};'use strict';var Sequelize=require(_0xc2eb('0x0'));module[_0xc2eb('0x1')]={'tree':{'type':Sequelize[_0xc2eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x96c8=['TEXT','exports'];(function(_0x4979ad,_0x36df48){var _0x3e8c8e=function(_0x4f90b2){while(--_0x4f90b2){_0x4979ad['push'](_0x4979ad['shift']());}};_0x3e8c8e(++_0x36df48);}(_0x96c8,0xa3));var _0x896c=function(_0x3503ee,_0x4498fb){_0x3503ee=_0x3503ee-0x0;var _0x4d62ae=_0x96c8[_0x3503ee];return _0x4d62ae;};'use strict';var Sequelize=require('sequelize');module[_0x896c('0x0')]={'tree':{'type':Sequelize[_0x896c('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 e9f60e0..31131f6 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 _0x7dab=['filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','AnalyticTreeReport','fieldName','type','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5a9111,_0x362938){var _0x4ff060=function(_0x42faba){while(--_0x42faba){_0x5a9111['push'](_0x5a9111['shift']());}};_0x4ff060(++_0x362938);}(_0x7dab,0x9f));var _0xb7da=function(_0x599cc1,_0x35652){_0x599cc1=_0x599cc1-0x0;var _0x128dc0=_0x7dab[_0x599cc1];return _0x128dc0;};'use strict';var emlformat=require(_0xb7da('0x0'));var rimraf=require(_0xb7da('0x1'));var zipdir=require(_0xb7da('0x2'));var jsonpatch=require(_0xb7da('0x3'));var rp=require(_0xb7da('0x4'));var moment=require(_0xb7da('0x5'));var BPromise=require(_0xb7da('0x6'));var Mustache=require(_0xb7da('0x7'));var util=require('util');var path=require(_0xb7da('0x8'));var sox=require(_0xb7da('0x9'));var csv=require(_0xb7da('0xa'));var ejs=require(_0xb7da('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7da('0xc'));var squel=require(_0xb7da('0xd'));var crypto=require(_0xb7da('0xe'));var jsforce=require(_0xb7da('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb7da('0xa'));var querystring=require('querystring');var Papa=require(_0xb7da('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb7da('0x11'));var as=require(_0xb7da('0x12'));var hardwareService=require(_0xb7da('0x13'));var logger=require(_0xb7da('0x14'))('api');var utils=require(_0xb7da('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb7da('0x16'));var db=require(_0xb7da('0x17'))['db'];function respondWithStatusCode(_0x1b6fef,_0x4fca4b){_0x4fca4b=_0x4fca4b||0xcc;return function(_0x2fff87){if(_0x2fff87){return _0x1b6fef[_0xb7da('0x18')](_0x4fca4b);}return _0x1b6fef[_0xb7da('0x19')](_0x4fca4b)[_0xb7da('0x1a')]();};}function respondWithResult(_0x2bf327,_0x49d612){_0x49d612=_0x49d612||0xc8;return function(_0x575f92){if(_0x575f92){return _0x2bf327[_0xb7da('0x19')](_0x49d612)[_0xb7da('0x1b')](_0x575f92);}};}function respondWithFilteredResult(_0x2980d3,_0x28a506){return function(_0x3ae033){if(_0x3ae033){var _0x519e28=typeof _0x28a506[_0xb7da('0x1c')]===_0xb7da('0x1d')&&typeof _0x28a506[_0xb7da('0x1e')]===_0xb7da('0x1d');var _0x4ad279=_0x3ae033[_0xb7da('0x1f')];var _0x244811=_0x519e28?0x0:_0x28a506['offset'];var _0x4813b4=_0x519e28?_0x3ae033[_0xb7da('0x1f')]:_0x28a506['offset']+_0x28a506[_0xb7da('0x1e')];var _0x507b15;if(_0x4813b4>=_0x4ad279){_0x4813b4=_0x4ad279;_0x507b15=0xc8;}else{_0x507b15=0xce;}_0x2980d3[_0xb7da('0x19')](_0x507b15);return _0x2980d3[_0xb7da('0x20')](_0xb7da('0x21'),_0x244811+'-'+_0x4813b4+'/'+_0x4ad279)['json'](_0x3ae033);}return null;};}function patchUpdates(_0x495386){return function(_0x28aabd){try{jsonpatch[_0xb7da('0x22')](_0x28aabd,_0x495386,!![]);}catch(_0x521341){return BPromise[_0xb7da('0x23')](_0x521341);}return _0x28aabd[_0xb7da('0x24')]();};}function saveUpdates(_0x34fcf2,_0x5be661){return function(_0x3919af){if(_0x3919af){return _0x3919af['update'](_0x34fcf2)[_0xb7da('0x25')](function(_0x53a1a4){return _0x53a1a4;});}return null;};}function removeEntity(_0x75e501,_0x1bcbf2){return function(_0x4ae86d){if(_0x4ae86d){return _0x4ae86d[_0xb7da('0x26')]()['then'](function(){_0x75e501[_0xb7da('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x938d56,_0x5dd1f2){return function(_0x2b01e2){if(!_0x2b01e2){_0x938d56[_0xb7da('0x18')](0x194);}return _0x2b01e2;};}function handleError(_0x1db9c1,_0x10d2e4){_0x10d2e4=_0x10d2e4||0x1f4;return function(_0x1c00be){logger[_0xb7da('0x27')](_0x1c00be[_0xb7da('0x28')]);if(_0x1c00be[_0xb7da('0x29')]){delete _0x1c00be[_0xb7da('0x29')];}_0x1db9c1[_0xb7da('0x19')](_0x10d2e4)[_0xb7da('0x2a')](_0x1c00be);};}exports['index']=function(_0x8c398a,_0x1e401f){var _0x52cd78={},_0x5668fb={},_0x5bc2d9={'count':0x0,'rows':[]};var _0x546352=_[_0xb7da('0x2b')](db[_0xb7da('0x2c')]['rawAttributes'],function(_0x48c2d9){return{'name':_0x48c2d9[_0xb7da('0x2d')],'type':_0x48c2d9[_0xb7da('0x2e')]['key']};});_0x5668fb[_0xb7da('0x2f')]=_['map'](_0x546352,_0xb7da('0x29'));_0x5668fb[_0xb7da('0x30')]=_['keys'](_0x8c398a[_0xb7da('0x30')]);_0x5668fb['filters']=_[_0xb7da('0x31')](_0x5668fb[_0xb7da('0x2f')],_0x5668fb['query']);_0x52cd78['attributes']=_['intersection'](_0x5668fb[_0xb7da('0x2f')],qs['fields'](_0x8c398a['query']['fields']));_0x52cd78[_0xb7da('0x32')]=_0x52cd78['attributes']['length']?_0x52cd78[_0xb7da('0x32')]:_0x5668fb['model'];if(!_0x8c398a['query'][_0xb7da('0x33')](_0xb7da('0x34'))){_0x52cd78[_0xb7da('0x1e')]=qs[_0xb7da('0x1e')](_0x8c398a['query'][_0xb7da('0x1e')]);_0x52cd78[_0xb7da('0x1c')]=qs[_0xb7da('0x1c')](_0x8c398a[_0xb7da('0x30')][_0xb7da('0x1c')]);}_0x52cd78[_0xb7da('0x35')]=qs['sort'](_0x8c398a['query'][_0xb7da('0x36')]);_0x52cd78[_0xb7da('0x37')]=qs['filters'](_[_0xb7da('0x38')](_0x8c398a[_0xb7da('0x30')],_0x5668fb[_0xb7da('0x39')]),_0x546352);if(_0x8c398a[_0xb7da('0x30')][_0xb7da('0x3a')]){_0x52cd78['where']=_[_0xb7da('0x3b')](_0x52cd78[_0xb7da('0x37')],{'$or':_['map'](_0x546352,function(_0x135516){if(_0x135516[_0xb7da('0x2e')]!=='VIRTUAL'){var _0x32f57c={};_0x32f57c[_0x135516[_0xb7da('0x29')]]={'$like':'%'+_0x8c398a['query'][_0xb7da('0x3a')]+'%'};return _0x32f57c;}})});}_0x52cd78=_[_0xb7da('0x3b')]({},_0x52cd78,_0x8c398a[_0xb7da('0x3c')]);var _0x1b5aab={'where':_0x52cd78[_0xb7da('0x37')]};return db['AnalyticTreeReport'][_0xb7da('0x1f')](_0x1b5aab)['then'](function(_0x32a042){_0x5bc2d9['count']=_0x32a042;if(_0x8c398a[_0xb7da('0x30')][_0xb7da('0x3d')]){_0x52cd78[_0xb7da('0x3e')]=[{'all':!![]}];}return db[_0xb7da('0x2c')][_0xb7da('0x3f')](_0x52cd78);})['then'](function(_0x2c6897){_0x5bc2d9[_0xb7da('0x40')]=_0x2c6897;return _0x5bc2d9;})[_0xb7da('0x25')](respondWithFilteredResult(_0x1e401f,_0x52cd78))[_0xb7da('0x41')](handleError(_0x1e401f,null));};exports[_0xb7da('0x42')]=function(_0x2bb8d9,_0x30e6e5){var _0x5e2389={'raw':!![],'where':{'id':_0x2bb8d9[_0xb7da('0x43')]['id']}},_0x2e9c31={};_0x2e9c31['model']=_[_0xb7da('0x44')](db[_0xb7da('0x2c')]['rawAttributes']);_0x2e9c31['query']=_['keys'](_0x2bb8d9[_0xb7da('0x30')]);_0x2e9c31[_0xb7da('0x39')]=_['intersection'](_0x2e9c31['model'],_0x2e9c31['query']);_0x5e2389[_0xb7da('0x32')]=_['intersection'](_0x2e9c31[_0xb7da('0x2f')],qs[_0xb7da('0x45')](_0x2bb8d9['query']['fields']));_0x5e2389['attributes']=_0x5e2389[_0xb7da('0x32')]['length']?_0x5e2389['attributes']:_0x2e9c31['model'];if(_0x2bb8d9[_0xb7da('0x30')]['includeAll']){_0x5e2389[_0xb7da('0x3e')]=[{'all':!![]}];}_0x5e2389=_['merge']({},_0x5e2389,_0x2bb8d9[_0xb7da('0x3c')]);return db[_0xb7da('0x2c')][_0xb7da('0x46')](_0x5e2389)[_0xb7da('0x25')](handleEntityNotFound(_0x30e6e5,null))[_0xb7da('0x25')](respondWithResult(_0x30e6e5,null))['catch'](handleError(_0x30e6e5,null));};exports[_0xb7da('0x47')]=function(_0x22e710,_0x17b41e){return db['AnalyticTreeReport'][_0xb7da('0x47')](_0x22e710['body'],{})[_0xb7da('0x25')](respondWithResult(_0x17b41e,0xc9))['catch'](handleError(_0x17b41e,null));};exports['update']=function(_0x3bbdd3,_0x3c03e8){if(_0x3bbdd3['body']['id']){delete _0x3bbdd3['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x3bbdd3[_0xb7da('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c03e8,null))[_0xb7da('0x25')](saveUpdates(_0x3bbdd3['body'],null))[_0xb7da('0x25')](respondWithResult(_0x3c03e8,null))['catch'](handleError(_0x3c03e8,null));};exports[_0xb7da('0x26')]=function(_0x451c04,_0x5d9d5d){return db[_0xb7da('0x2c')][_0xb7da('0x46')]({'where':{'id':_0x451c04[_0xb7da('0x43')]['id']}})[_0xb7da('0x25')](handleEntityNotFound(_0x5d9d5d,null))[_0xb7da('0x25')](removeEntity(_0x5d9d5d,null))[_0xb7da('0x41')](handleError(_0x5d9d5d,null));}; \ No newline at end of file +var _0x3d38=['api','../../config/utils','../../config/license/util','end','status','json','offset','limit','count','set','Content-Range','apply','save','then','sendStatus','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','catch','params','keys','includeAll','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x47177a,_0x44684f){var _0x3c0208=function(_0x58d6e5){while(--_0x58d6e5){_0x47177a['push'](_0x47177a['shift']());}};_0x3c0208(++_0x44684f);}(_0x3d38,0xb7));var _0x83d3=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0x3d38[_0x193ddf];return _0x5bc6df;};'use strict';var emlformat=require(_0x83d3('0x0'));var rimraf=require(_0x83d3('0x1'));var zipdir=require(_0x83d3('0x2'));var jsonpatch=require(_0x83d3('0x3'));var rp=require(_0x83d3('0x4'));var moment=require('moment');var BPromise=require(_0x83d3('0x5'));var Mustache=require(_0x83d3('0x6'));var util=require(_0x83d3('0x7'));var path=require(_0x83d3('0x8'));var sox=require('sox');var csv=require(_0x83d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x83d3('0xa'));var deskjs=require(_0x83d3('0xb'));var toCsv=require(_0x83d3('0x9'));var querystring=require(_0x83d3('0xc'));var Papa=require('papaparse');var Redis=require(_0x83d3('0xd'));var authService=require(_0x83d3('0xe'));var qs=require(_0x83d3('0xf'));var as=require(_0x83d3('0x10'));var hardwareService=require(_0x83d3('0x11'));var logger=require('../../config/logger')(_0x83d3('0x12'));var utils=require(_0x83d3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x83d3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7aaf,_0x396bc4){_0x396bc4=_0x396bc4||0xcc;return function(_0x492617){if(_0x492617){return _0x4f7aaf['sendStatus'](_0x396bc4);}return _0x4f7aaf['status'](_0x396bc4)[_0x83d3('0x15')]();};}function respondWithResult(_0x3d923c,_0x29d364){_0x29d364=_0x29d364||0xc8;return function(_0x569471){if(_0x569471){return _0x3d923c[_0x83d3('0x16')](_0x29d364)[_0x83d3('0x17')](_0x569471);}};}function respondWithFilteredResult(_0x52db1e,_0x1ceb65){return function(_0x35ab27){if(_0x35ab27){var _0x2661f0=typeof _0x1ceb65[_0x83d3('0x18')]==='undefined'&&typeof _0x1ceb65[_0x83d3('0x19')]==='undefined';var _0x2f9943=_0x35ab27[_0x83d3('0x1a')];var _0x22b171=_0x2661f0?0x0:_0x1ceb65['offset'];var _0x565311=_0x2661f0?_0x35ab27['count']:_0x1ceb65[_0x83d3('0x18')]+_0x1ceb65[_0x83d3('0x19')];var _0x139ce0;if(_0x565311>=_0x2f9943){_0x565311=_0x2f9943;_0x139ce0=0xc8;}else{_0x139ce0=0xce;}_0x52db1e[_0x83d3('0x16')](_0x139ce0);return _0x52db1e[_0x83d3('0x1b')](_0x83d3('0x1c'),_0x22b171+'-'+_0x565311+'/'+_0x2f9943)['json'](_0x35ab27);}return null;};}function patchUpdates(_0x3fa541){return function(_0x3cccae){try{jsonpatch[_0x83d3('0x1d')](_0x3cccae,_0x3fa541,!![]);}catch(_0x46b3f6){return BPromise['reject'](_0x46b3f6);}return _0x3cccae[_0x83d3('0x1e')]();};}function saveUpdates(_0x2f9ef9,_0x216b90){return function(_0x56b993){if(_0x56b993){return _0x56b993['update'](_0x2f9ef9)[_0x83d3('0x1f')](function(_0x134bef){return _0x134bef;});}return null;};}function removeEntity(_0x55d012,_0x5ea22b){return function(_0x2a4d3f){if(_0x2a4d3f){return _0x2a4d3f['destroy']()['then'](function(){_0x55d012[_0x83d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x623efe,_0x2df3f0){return function(_0x1dc4ce){if(!_0x1dc4ce){_0x623efe[_0x83d3('0x20')](0x194);}return _0x1dc4ce;};}function handleError(_0x50e29c,_0x342a75){_0x342a75=_0x342a75||0x1f4;return function(_0x36cd5c){logger['error'](_0x36cd5c[_0x83d3('0x21')]);if(_0x36cd5c[_0x83d3('0x22')]){delete _0x36cd5c[_0x83d3('0x22')];}_0x50e29c['status'](_0x342a75)[_0x83d3('0x23')](_0x36cd5c);};}exports['index']=function(_0x33314d,_0x554bef){var _0x2303bd={},_0x51202d={},_0x2eab72={'count':0x0,'rows':[]};var _0x1efb5a=_['map'](db[_0x83d3('0x24')][_0x83d3('0x25')],function(_0x79f40d){return{'name':_0x79f40d[_0x83d3('0x26')],'type':_0x79f40d[_0x83d3('0x27')][_0x83d3('0x28')]};});_0x51202d[_0x83d3('0x29')]=_[_0x83d3('0x2a')](_0x1efb5a,_0x83d3('0x22'));_0x51202d[_0x83d3('0x2b')]=_['keys'](_0x33314d[_0x83d3('0x2b')]);_0x51202d[_0x83d3('0x2c')]=_[_0x83d3('0x2d')](_0x51202d[_0x83d3('0x29')],_0x51202d[_0x83d3('0x2b')]);_0x2303bd[_0x83d3('0x2e')]=_[_0x83d3('0x2d')](_0x51202d[_0x83d3('0x29')],qs['fields'](_0x33314d[_0x83d3('0x2b')][_0x83d3('0x2f')]));_0x2303bd[_0x83d3('0x2e')]=_0x2303bd[_0x83d3('0x2e')][_0x83d3('0x30')]?_0x2303bd[_0x83d3('0x2e')]:_0x51202d['model'];if(!_0x33314d[_0x83d3('0x2b')][_0x83d3('0x31')]('nolimit')){_0x2303bd[_0x83d3('0x19')]=qs[_0x83d3('0x19')](_0x33314d[_0x83d3('0x2b')][_0x83d3('0x19')]);_0x2303bd[_0x83d3('0x18')]=qs['offset'](_0x33314d[_0x83d3('0x2b')]['offset']);}_0x2303bd[_0x83d3('0x32')]=qs[_0x83d3('0x33')](_0x33314d['query'][_0x83d3('0x33')]);_0x2303bd[_0x83d3('0x34')]=qs[_0x83d3('0x2c')](_[_0x83d3('0x35')](_0x33314d[_0x83d3('0x2b')],_0x51202d['filters']),_0x1efb5a);if(_0x33314d['query'][_0x83d3('0x36')]){_0x2303bd[_0x83d3('0x34')]=_[_0x83d3('0x37')](_0x2303bd[_0x83d3('0x34')],{'$or':_['map'](_0x1efb5a,function(_0x1714fb){if(_0x1714fb['type']!=='VIRTUAL'){var _0x51d8bb={};_0x51d8bb[_0x1714fb['name']]={'$like':'%'+_0x33314d['query'][_0x83d3('0x36')]+'%'};return _0x51d8bb;}})});}_0x2303bd=_[_0x83d3('0x37')]({},_0x2303bd,_0x33314d[_0x83d3('0x38')]);var _0x337b80={'where':_0x2303bd['where']};return db['AnalyticTreeReport'][_0x83d3('0x1a')](_0x337b80)[_0x83d3('0x1f')](function(_0x485b0a){_0x2eab72[_0x83d3('0x1a')]=_0x485b0a;if(_0x33314d[_0x83d3('0x2b')]['includeAll']){_0x2303bd['include']=[{'all':!![]}];}return db[_0x83d3('0x24')][_0x83d3('0x39')](_0x2303bd);})['then'](function(_0x53ad19){_0x2eab72['rows']=_0x53ad19;return _0x2eab72;})[_0x83d3('0x1f')](respondWithFilteredResult(_0x554bef,_0x2303bd))[_0x83d3('0x3a')](handleError(_0x554bef,null));};exports['show']=function(_0x45225e,_0x55552d){var _0x597df7={'raw':!![],'where':{'id':_0x45225e[_0x83d3('0x3b')]['id']}},_0x15c513={};_0x15c513[_0x83d3('0x29')]=_[_0x83d3('0x3c')](db[_0x83d3('0x24')][_0x83d3('0x25')]);_0x15c513['query']=_['keys'](_0x45225e['query']);_0x15c513[_0x83d3('0x2c')]=_[_0x83d3('0x2d')](_0x15c513[_0x83d3('0x29')],_0x15c513['query']);_0x597df7[_0x83d3('0x2e')]=_[_0x83d3('0x2d')](_0x15c513[_0x83d3('0x29')],qs[_0x83d3('0x2f')](_0x45225e[_0x83d3('0x2b')][_0x83d3('0x2f')]));_0x597df7[_0x83d3('0x2e')]=_0x597df7[_0x83d3('0x2e')][_0x83d3('0x30')]?_0x597df7[_0x83d3('0x2e')]:_0x15c513[_0x83d3('0x29')];if(_0x45225e['query'][_0x83d3('0x3d')]){_0x597df7[_0x83d3('0x3e')]=[{'all':!![]}];}_0x597df7=_[_0x83d3('0x37')]({},_0x597df7,_0x45225e[_0x83d3('0x38')]);return db['AnalyticTreeReport'][_0x83d3('0x3f')](_0x597df7)[_0x83d3('0x1f')](handleEntityNotFound(_0x55552d,null))[_0x83d3('0x1f')](respondWithResult(_0x55552d,null))[_0x83d3('0x3a')](handleError(_0x55552d,null));};exports[_0x83d3('0x40')]=function(_0x2ccc6b,_0x2f2bde){return db[_0x83d3('0x24')][_0x83d3('0x40')](_0x2ccc6b[_0x83d3('0x41')],{})[_0x83d3('0x1f')](respondWithResult(_0x2f2bde,0xc9))[_0x83d3('0x3a')](handleError(_0x2f2bde,null));};exports['update']=function(_0x32dcc2,_0x5ead29){if(_0x32dcc2['body']['id']){delete _0x32dcc2[_0x83d3('0x41')]['id'];}return db['AnalyticTreeReport'][_0x83d3('0x3f')]({'where':{'id':_0x32dcc2[_0x83d3('0x3b')]['id']}})[_0x83d3('0x1f')](handleEntityNotFound(_0x5ead29,null))[_0x83d3('0x1f')](saveUpdates(_0x32dcc2[_0x83d3('0x41')],null))[_0x83d3('0x1f')](respondWithResult(_0x5ead29,null))[_0x83d3('0x3a')](handleError(_0x5ead29,null));};exports[_0x83d3('0x42')]=function(_0x20acf4,_0x10e53e){return db[_0x83d3('0x24')][_0x83d3('0x3f')]({'where':{'id':_0x20acf4[_0x83d3('0x3b')]['id']}})[_0x83d3('0x1f')](handleEntityNotFound(_0x10e53e,null))[_0x83d3('0x1f')](removeEntity(_0x10e53e,null))[_0x83d3('0x3a')](handleError(_0x10e53e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a88a299..15fcbde 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 _0xc4a8=['path','rimraf','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','request-promise'];(function(_0x18afd1,_0x15e563){var _0x78ac02=function(_0x4bb56a){while(--_0x4bb56a){_0x18afd1['push'](_0x18afd1['shift']());}};_0x78ac02(++_0x15e563);}(_0xc4a8,0xed));var _0x8c4a=function(_0x197cc5,_0x388869){_0x197cc5=_0x197cc5-0x0;var _0x5d89f1=_0xc4a8[_0x197cc5];return _0x5d89f1;};'use strict';var _=require('lodash');var util=require(_0x8c4a('0x0'));var logger=require(_0x8c4a('0x1'))(_0x8c4a('0x2'));var moment=require('moment');var BPromise=require(_0x8c4a('0x3'));var rp=require(_0x8c4a('0x4'));var fs=require('fs');var path=require(_0x8c4a('0x5'));var rimraf=require(_0x8c4a('0x6'));var config=require(_0x8c4a('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x8c4a('0x8')]=function(_0x3cc29d,_0xbd70a4){return _0x3cc29d['define'](_0x8c4a('0x9'),attributes,{'tableName':_0x8c4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cca=['bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','util','api','moment'];(function(_0x13f1e4,_0x4101cc){var _0x48671f=function(_0x3fa46d){while(--_0x3fa46d){_0x13f1e4['push'](_0x13f1e4['shift']());}};_0x48671f(++_0x4101cc);}(_0x9cca,0x147));var _0xa9cc=function(_0x1c497c,_0x13a6cb){_0x1c497c=_0x1c497c-0x0;var _0x37b5e6=_0x9cca[_0x1c497c];return _0x37b5e6;};'use strict';var _=require('lodash');var util=require(_0xa9cc('0x0'));var logger=require('../../config/logger')(_0xa9cc('0x1'));var moment=require(_0xa9cc('0x2'));var BPromise=require(_0xa9cc('0x3'));var rp=require(_0xa9cc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9cc('0x5'));var config=require(_0xa9cc('0x6'));var attributes=require(_0xa9cc('0x7'));module['exports']=function(_0x2a3a60,_0x1c5769){return _0x2a3a60[_0xa9cc('0x8')](_0xa9cc('0x9'),attributes,{'tableName':_0xa9cc('0xa'),'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 31d57c2..5c638ef 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x21f2cf,_0x1417ea){var _0x50d69c=function(_0x325021){while(--_0x325021){_0x21f2cf['push'](_0x21f2cf['shift']());}};_0x50d69c(++_0x1417ea);}(_0x2ef3,0xba));var _0x32ef=function(_0x57efee,_0x545eff){_0x57efee=_0x57efee-0x0;var _0x281d0b=_0x2ef3[_0x57efee];return _0x281d0b;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4819e1,_0x44d88e){var _0xca4f58=function(_0x494088){while(--_0x494088){_0x4819e1['push'](_0x4819e1['shift']());}};_0xca4f58(++_0x44d88e);}(_0xadb5,0xad));var _0x5adb=function(_0xaf343d,_0x38a76b){_0xaf343d=_0xaf343d-0x0;var _0x1e2d84=_0xadb5[_0xaf343d];return _0x1e2d84;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index fbb06e8..7d982a6 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 _0x8ad1=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4ade0a,_0x49be85){var _0xe8bfa5=function(_0x135b9a){while(--_0x135b9a){_0x4ade0a['push'](_0x4ade0a['shift']());}};_0xe8bfa5(++_0x49be85);}(_0x8ad1,0xb5));var _0x18ad=function(_0x304e8c,_0x2ee660){_0x304e8c=_0x304e8c-0x0;var _0x114389=_0x8ad1[_0x304e8c];return _0x114389;};'use strict';var multer=require(_0x18ad('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x18ad('0x1'));var router=express[_0x18ad('0x2')]();var fs_extra=require(_0x18ad('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x18ad('0x4'));var config=require(_0x18ad('0x5'));var controller=require(_0x18ad('0x6'));router[_0x18ad('0x7')]('/',auth[_0x18ad('0x8')](),controller[_0x18ad('0x9')]);router['get'](_0x18ad('0xa'),auth[_0x18ad('0x8')](),controller[_0x18ad('0xb')]);router[_0x18ad('0xc')]('/',auth[_0x18ad('0x8')](),controller[_0x18ad('0xd')]);router['put'](_0x18ad('0xa'),auth[_0x18ad('0x8')](),controller['update']);router[_0x18ad('0xe')]('/:id',auth[_0x18ad('0x8')](),controller[_0x18ad('0xf')]);module[_0x18ad('0x10')]=router; \ No newline at end of file +var _0x1939=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','path'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x1939,0x12f));var _0x9193=function(_0x1fdff9,_0x4c4bf4){_0x1fdff9=_0x1fdff9-0x0;var _0x3d1b6e=_0x1939[_0x1fdff9];return _0x3d1b6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9193('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9193('0x1')]();var fs_extra=require(_0x9193('0x2'));var auth=require(_0x9193('0x3'));var interaction=require(_0x9193('0x4'));var config=require(_0x9193('0x5'));var controller=require(_0x9193('0x6'));router[_0x9193('0x7')]('/',auth[_0x9193('0x8')](),controller[_0x9193('0x9')]);router['get'](_0x9193('0xa'),auth[_0x9193('0x8')](),controller[_0x9193('0xb')]);router[_0x9193('0xc')]('/',auth[_0x9193('0x8')](),controller[_0x9193('0xd')]);router[_0x9193('0xe')](_0x9193('0xa'),auth[_0x9193('0x8')](),controller[_0x9193('0xf')]);router[_0x9193('0x10')](_0x9193('0xa'),auth['isAuthenticated'](),controller[_0x9193('0x11')]);module[_0x9193('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f9dcc09..844a97a 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 _0x6f7f=['STRING','exports'];(function(_0x377ddf,_0x102e9a){var _0x5b8465=function(_0x3e0ed3){while(--_0x3e0ed3){_0x377ddf['push'](_0x377ddf['shift']());}};_0x5b8465(++_0x102e9a);}(_0x6f7f,0x177));var _0xf6f7=function(_0x35f3f8,_0xba35a0){_0x35f3f8=_0x35f3f8-0x0;var _0x4102d8=_0x6f7f[_0x35f3f8];return _0x4102d8;};'use strict';var Sequelize=require('sequelize');module[_0xf6f7('0x0')]={'name':{'type':Sequelize[_0xf6f7('0x1')]},'basename':{'type':Sequelize[_0xf6f7('0x1')]},'type':{'type':Sequelize[_0xf6f7('0x1')]}}; \ No newline at end of file +var _0xf1e1=['sequelize','STRING'];(function(_0x3bbc50,_0x22d9ec){var _0x997935=function(_0x552142){while(--_0x552142){_0x3bbc50['push'](_0x3bbc50['shift']());}};_0x997935(++_0x22d9ec);}(_0xf1e1,0x102));var _0x1f1e=function(_0x213ed5,_0x26712a){_0x213ed5=_0x213ed5-0x0;var _0x191514=_0xf1e1[_0x213ed5];return _0x191514;};'use strict';var Sequelize=require(_0x1f1e('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f1e('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1f1e('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ed3f058..d388254 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 _0x64fe=['include','findAll','rows','show','params','includeAll','clone','find','get','omit','updatedAt','body','createdAt','catch','file','originalname','basename','filename','mimetype','create','download','join','root','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','Attachment','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x41ffff,_0xf804b0){var _0x199ef7=function(_0x7b364f){while(--_0x7b364f){_0x41ffff['push'](_0x41ffff['shift']());}};_0x199ef7(++_0xf804b0);}(_0x64fe,0x187));var _0xe64f=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x64fe[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0xe64f('0x0'));var rimraf=require(_0xe64f('0x1'));var zipdir=require(_0xe64f('0x2'));var jsonpatch=require(_0xe64f('0x3'));var rp=require(_0xe64f('0x4'));var moment=require(_0xe64f('0x5'));var BPromise=require(_0xe64f('0x6'));var Mustache=require(_0xe64f('0x7'));var util=require(_0xe64f('0x8'));var path=require(_0xe64f('0x9'));var sox=require(_0xe64f('0xa'));var csv=require(_0xe64f('0xb'));var ejs=require(_0xe64f('0xc'));var fs=require('fs');var fs_extra=require(_0xe64f('0xd'));var _=require(_0xe64f('0xe'));var squel=require(_0xe64f('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe64f('0x10'));var toCsv=require(_0xe64f('0xb'));var querystring=require(_0xe64f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe64f('0x12'));var qs=require(_0xe64f('0x13'));var as=require(_0xe64f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe64f('0x15'))(_0xe64f('0x16'));var utils=require(_0xe64f('0x17'));var config=require(_0xe64f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe64f('0x19'))['db'];function respondWithStatusCode(_0x4a8be2,_0x37f23b){_0x37f23b=_0x37f23b||0xcc;return function(_0x55ee98){if(_0x55ee98){return _0x4a8be2[_0xe64f('0x1a')](_0x37f23b);}return _0x4a8be2[_0xe64f('0x1b')](_0x37f23b)[_0xe64f('0x1c')]();};}function respondWithResult(_0x229ef9,_0x20a3c9){_0x20a3c9=_0x20a3c9||0xc8;return function(_0x251c22){if(_0x251c22){return _0x229ef9[_0xe64f('0x1b')](_0x20a3c9)[_0xe64f('0x1d')](_0x251c22);}};}function respondWithFilteredResult(_0x6ab0ee,_0x381a4b){return function(_0x13dca9){if(_0x13dca9){var _0x2e1d4c=typeof _0x381a4b[_0xe64f('0x1e')]===_0xe64f('0x1f')&&typeof _0x381a4b[_0xe64f('0x20')]===_0xe64f('0x1f');var _0x557ca6=_0x13dca9[_0xe64f('0x21')];var _0x3add78=_0x2e1d4c?0x0:_0x381a4b['offset'];var _0x2cc71f=_0x2e1d4c?_0x13dca9['count']:_0x381a4b[_0xe64f('0x1e')]+_0x381a4b[_0xe64f('0x20')];var _0x47f21d;if(_0x2cc71f>=_0x557ca6){_0x2cc71f=_0x557ca6;_0x47f21d=0xc8;}else{_0x47f21d=0xce;}_0x6ab0ee[_0xe64f('0x1b')](_0x47f21d);return _0x6ab0ee[_0xe64f('0x22')](_0xe64f('0x23'),_0x3add78+'-'+_0x2cc71f+'/'+_0x557ca6)['json'](_0x13dca9);}return null;};}function patchUpdates(_0x2b4bf8){return function(_0x32e861){try{jsonpatch[_0xe64f('0x24')](_0x32e861,_0x2b4bf8,!![]);}catch(_0x2ab31e){return BPromise[_0xe64f('0x25')](_0x2ab31e);}return _0x32e861[_0xe64f('0x26')]();};}function saveUpdates(_0x29222c,_0x4e207a){return function(_0x45bf0c){if(_0x45bf0c){return _0x45bf0c[_0xe64f('0x27')](_0x29222c)[_0xe64f('0x28')](function(_0x4c17c0){return _0x4c17c0;});}return null;};}function removeEntity(_0x5c808f,_0x101572){return function(_0x4686bd){if(_0x4686bd){return _0x4686bd[_0xe64f('0x29')]()['then'](function(){_0x5c808f[_0xe64f('0x1b')](0xcc)[_0xe64f('0x1c')]();});}};}function handleEntityNotFound(_0x1dc4fa,_0xf16ad2){return function(_0x51d242){if(!_0x51d242){_0x1dc4fa[_0xe64f('0x1a')](0x194);}return _0x51d242;};}function handleError(_0x55931c,_0x9229a0){_0x9229a0=_0x9229a0||0x1f4;return function(_0x43b492){logger[_0xe64f('0x2a')](_0x43b492[_0xe64f('0x2b')]);if(_0x43b492['name']){delete _0x43b492[_0xe64f('0x2c')];}_0x55931c[_0xe64f('0x1b')](_0x9229a0)['send'](_0x43b492);};}exports['index']=function(_0x76dc1e,_0x291b69){var _0x361f48={},_0x5d32f4={},_0x189d43={'count':0x0,'rows':[]};var _0x5e10e6=_[_0xe64f('0x2d')](db[_0xe64f('0x2e')][_0xe64f('0x2f')],function(_0x1f0b13){return{'name':_0x1f0b13[_0xe64f('0x30')],'type':_0x1f0b13[_0xe64f('0x31')][_0xe64f('0x32')]};});_0x5d32f4['model']=_[_0xe64f('0x2d')](_0x5e10e6,'name');_0x5d32f4['query']=_[_0xe64f('0x33')](_0x76dc1e['query']);_0x5d32f4[_0xe64f('0x34')]=_[_0xe64f('0x35')](_0x5d32f4[_0xe64f('0x36')],_0x5d32f4['query']);_0x361f48[_0xe64f('0x37')]=_[_0xe64f('0x35')](_0x5d32f4[_0xe64f('0x36')],qs[_0xe64f('0x38')](_0x76dc1e[_0xe64f('0x39')][_0xe64f('0x38')]));_0x361f48[_0xe64f('0x37')]=_0x361f48[_0xe64f('0x37')][_0xe64f('0x3a')]?_0x361f48['attributes']:_0x5d32f4[_0xe64f('0x36')];if(!_0x76dc1e[_0xe64f('0x39')][_0xe64f('0x3b')](_0xe64f('0x3c'))){_0x361f48[_0xe64f('0x20')]=qs[_0xe64f('0x20')](_0x76dc1e[_0xe64f('0x39')][_0xe64f('0x20')]);_0x361f48[_0xe64f('0x1e')]=qs['offset'](_0x76dc1e['query']['offset']);}_0x361f48[_0xe64f('0x3d')]=qs[_0xe64f('0x3e')](_0x76dc1e['query'][_0xe64f('0x3e')]);_0x361f48['where']=qs[_0xe64f('0x34')](_[_0xe64f('0x3f')](_0x76dc1e[_0xe64f('0x39')],_0x5d32f4[_0xe64f('0x34')]),_0x5e10e6);if(_0x76dc1e['query'][_0xe64f('0x40')]){_0x361f48[_0xe64f('0x41')]=_[_0xe64f('0x42')](_0x361f48[_0xe64f('0x41')],{'$or':_[_0xe64f('0x2d')](_0x5e10e6,function(_0x471d2f){if(_0x471d2f[_0xe64f('0x31')]!==_0xe64f('0x43')){var _0x1371fb={};_0x1371fb[_0x471d2f[_0xe64f('0x2c')]]={'$like':'%'+_0x76dc1e['query']['filter']+'%'};return _0x1371fb;}})});}_0x361f48=_[_0xe64f('0x42')]({},_0x361f48,_0x76dc1e[_0xe64f('0x44')]);var _0x436863={'where':_0x361f48[_0xe64f('0x41')]};return db['Attachment'][_0xe64f('0x21')](_0x436863)[_0xe64f('0x28')](function(_0x9427c4){_0x189d43[_0xe64f('0x21')]=_0x9427c4;if(_0x76dc1e[_0xe64f('0x39')]['includeAll']){_0x361f48[_0xe64f('0x45')]=[{'all':!![]}];}return db[_0xe64f('0x2e')][_0xe64f('0x46')](_0x361f48);})[_0xe64f('0x28')](function(_0xc0e628){_0x189d43[_0xe64f('0x47')]=_0xc0e628;return _0x189d43;})['then'](respondWithFilteredResult(_0x291b69,_0x361f48))['catch'](handleError(_0x291b69,null));};exports[_0xe64f('0x48')]=function(_0x232149,_0x54f5f4){var _0x37e878={'raw':!![],'where':{'id':_0x232149[_0xe64f('0x49')]['id']}},_0x3cc485={};_0x3cc485['model']=_[_0xe64f('0x33')](db[_0xe64f('0x2e')]['rawAttributes']);_0x3cc485['query']=_[_0xe64f('0x33')](_0x232149[_0xe64f('0x39')]);_0x3cc485[_0xe64f('0x34')]=_['intersection'](_0x3cc485[_0xe64f('0x36')],_0x3cc485['query']);_0x37e878[_0xe64f('0x37')]=_[_0xe64f('0x35')](_0x3cc485[_0xe64f('0x36')],qs[_0xe64f('0x38')](_0x232149[_0xe64f('0x39')]['fields']));_0x37e878['attributes']=_0x37e878['attributes'][_0xe64f('0x3a')]?_0x37e878[_0xe64f('0x37')]:_0x3cc485[_0xe64f('0x36')];if(_0x232149[_0xe64f('0x39')][_0xe64f('0x4a')]){_0x37e878[_0xe64f('0x45')]=[{'all':!![]}];}_0x37e878=_['merge']({},_0x37e878,_0x232149[_0xe64f('0x44')]);return db[_0xe64f('0x2e')]['find'](_0x37e878)[_0xe64f('0x28')](handleEntityNotFound(_0x54f5f4,null))[_0xe64f('0x28')](respondWithResult(_0x54f5f4,null))['catch'](handleError(_0x54f5f4,null));};exports[_0xe64f('0x4b')]=function(_0x3a44bf,_0x21a375){var _0x14ffc8={'where':{'id':_0x3a44bf[_0xe64f('0x49')]['id']}},_0x431bdc={};_0x431bdc[_0xe64f('0x36')]=_['keys'](db[_0xe64f('0x2e')][_0xe64f('0x2f')]);_0x14ffc8[_0xe64f('0x37')]=_[_0xe64f('0x35')](_0x431bdc[_0xe64f('0x36')],qs[_0xe64f('0x38')](_0x3a44bf[_0xe64f('0x39')]['fields']));_0x14ffc8['attributes']=_0x14ffc8[_0xe64f('0x37')][_0xe64f('0x3a')]?_0x14ffc8['attributes']:_0x431bdc[_0xe64f('0x36')];if(_0x3a44bf[_0xe64f('0x39')][_0xe64f('0x4a')]){_0x14ffc8[_0xe64f('0x45')]=[{'all':!![]}];}_0x14ffc8=_[_0xe64f('0x42')]({},_0x14ffc8,_0x3a44bf[_0xe64f('0x44')]);return db[_0xe64f('0x2e')][_0xe64f('0x4c')](_0x14ffc8)[_0xe64f('0x28')](handleEntityNotFound(_0x21a375,null))[_0xe64f('0x28')](function(_0x41742e){if(_0x41742e){var _0x3fee21=_0x41742e[_0xe64f('0x4d')]({'plain':!![]});_0x3fee21=qs[_0xe64f('0x4e')](_0x3fee21,['id','createdAt',_0xe64f('0x4f')]);_0x3a44bf['body']=_[_0xe64f('0x4e')](_0x3a44bf[_0xe64f('0x50')],['id',_0xe64f('0x51'),_0xe64f('0x4f')]);return db['Attachment']['create'](_[_0xe64f('0x42')](_0x3fee21,_0x3a44bf[_0xe64f('0x50')]),{'include':_0x3a44bf[_0xe64f('0x39')][_0xe64f('0x4a')]?[{'all':!![]}]:undefined});}})[_0xe64f('0x28')](respondWithResult(_0x21a375,0xc9))[_0xe64f('0x52')](handleError(_0x21a375,null));};exports[_0xe64f('0x27')]=function(_0x5578fb,_0x45b2aa){if(_0x5578fb[_0xe64f('0x50')]['id']){delete _0x5578fb[_0xe64f('0x50')]['id'];}return db[_0xe64f('0x2e')][_0xe64f('0x4c')]({'where':{'id':_0x5578fb[_0xe64f('0x49')]['id']}})[_0xe64f('0x28')](handleEntityNotFound(_0x45b2aa,null))['then'](saveUpdates(_0x5578fb[_0xe64f('0x50')],null))[_0xe64f('0x28')](respondWithResult(_0x45b2aa,null))[_0xe64f('0x52')](handleError(_0x45b2aa,null));};exports[_0xe64f('0x29')]=function(_0x315833,_0x5c33aa){return db['Attachment']['find']({'where':{'id':_0x315833['params']['id']}})[_0xe64f('0x28')](handleEntityNotFound(_0x5c33aa,null))[_0xe64f('0x28')](removeEntity(_0x5c33aa,null))[_0xe64f('0x52')](handleError(_0x5c33aa,null));};exports['create']=function(_0x39d741,_0x3e1b8b,_0x5e8545){_0x39d741[_0xe64f('0x50')]['name']=_0x39d741[_0xe64f('0x53')][_0xe64f('0x54')];_0x39d741['body'][_0xe64f('0x55')]=_0x39d741['file'][_0xe64f('0x56')];_0x39d741[_0xe64f('0x50')][_0xe64f('0x31')]=_0x39d741['file'][_0xe64f('0x57')];return db[_0xe64f('0x2e')][_0xe64f('0x58')](_0x39d741[_0xe64f('0x50')])['then'](respondWithResult(_0x3e1b8b,0xc9))['catch'](handleError(_0x3e1b8b,null));};exports[_0xe64f('0x59')]=function(_0x518dfb,_0x1e7986,_0x55708c){return db[_0xe64f('0x2e')]['findOne']({'where':{'id':_0x518dfb[_0xe64f('0x49')]['id']},'raw':!![]})[_0xe64f('0x28')](handleEntityNotFound(_0x1e7986,null))[_0xe64f('0x28')](function(_0x24dba0){if(_0x24dba0){var _0xc4f7d9=_0x24dba0['ChatOfflineMessageId']!==null;var _0x3350d1=path[_0xe64f('0x5a')](config[_0xe64f('0x5b')],'server/files/attachments/');if(_0xc4f7d9){_0x3350d1=path[_0xe64f('0x5a')](_0x3350d1,'offline-chat/');}var _0x31dd37=path[_0xe64f('0x5a')](_0x3350d1,_0x24dba0[_0xe64f('0x55')]);return _0x1e7986[_0xe64f('0x59')](_0x31dd37);}})[_0xe64f('0x52')](handleError(_0x1e7986,null));}; \ No newline at end of file +var _0xddbe=['name','send','index','map','Attachment','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','catch','show','include','clone','find','get','omit','createdAt','updatedAt','body','update','params','create','file','originalname','basename','filename','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','destroy','then','error','stack'];(function(_0x262ea6,_0x5820c5){var _0x46f6ea=function(_0x40fb02){while(--_0x40fb02){_0x262ea6['push'](_0x262ea6['shift']());}};_0x46f6ea(++_0x5820c5);}(_0xddbe,0x1c9));var _0xeddb=function(_0x4e5adc,_0x10133c){_0x4e5adc=_0x4e5adc-0x0;var _0x12fd35=_0xddbe[_0x4e5adc];return _0x12fd35;};'use strict';var emlformat=require(_0xeddb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeddb('0x1'));var jsonpatch=require(_0xeddb('0x2'));var rp=require(_0xeddb('0x3'));var moment=require('moment');var BPromise=require(_0xeddb('0x4'));var Mustache=require(_0xeddb('0x5'));var util=require(_0xeddb('0x6'));var path=require(_0xeddb('0x7'));var sox=require(_0xeddb('0x8'));var csv=require('to-csv');var ejs=require(_0xeddb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeddb('0xa'));var jsforce=require(_0xeddb('0xb'));var deskjs=require(_0xeddb('0xc'));var toCsv=require(_0xeddb('0xd'));var querystring=require('querystring');var Papa=require(_0xeddb('0xe'));var Redis=require(_0xeddb('0xf'));var authService=require(_0xeddb('0x10'));var qs=require(_0xeddb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeddb('0x12'));var logger=require('../../config/logger')(_0xeddb('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeddb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a042e,_0x3fc132){_0x3fc132=_0x3fc132||0xcc;return function(_0x575788){if(_0x575788){return _0x1a042e[_0xeddb('0x15')](_0x3fc132);}return _0x1a042e['status'](_0x3fc132)[_0xeddb('0x16')]();};}function respondWithResult(_0x45b36e,_0xdb7455){_0xdb7455=_0xdb7455||0xc8;return function(_0x313f1d){if(_0x313f1d){return _0x45b36e[_0xeddb('0x17')](_0xdb7455)['json'](_0x313f1d);}};}function respondWithFilteredResult(_0x2b4de9,_0x36276d){return function(_0x25b594){if(_0x25b594){var _0xad1dc=typeof _0x36276d['offset']==='undefined'&&typeof _0x36276d['limit']===_0xeddb('0x18');var _0x352c7b=_0x25b594[_0xeddb('0x19')];var _0x2ef91f=_0xad1dc?0x0:_0x36276d['offset'];var _0x363ab6=_0xad1dc?_0x25b594[_0xeddb('0x19')]:_0x36276d[_0xeddb('0x1a')]+_0x36276d[_0xeddb('0x1b')];var _0x518400;if(_0x363ab6>=_0x352c7b){_0x363ab6=_0x352c7b;_0x518400=0xc8;}else{_0x518400=0xce;}_0x2b4de9[_0xeddb('0x17')](_0x518400);return _0x2b4de9[_0xeddb('0x1c')]('Content-Range',_0x2ef91f+'-'+_0x363ab6+'/'+_0x352c7b)[_0xeddb('0x1d')](_0x25b594);}return null;};}function patchUpdates(_0x19675a){return function(_0x2ccabb){try{jsonpatch[_0xeddb('0x1e')](_0x2ccabb,_0x19675a,!![]);}catch(_0x4e214d){return BPromise['reject'](_0x4e214d);}return _0x2ccabb['save']();};}function saveUpdates(_0x806559,_0x19b7af){return function(_0x4770ad){if(_0x4770ad){return _0x4770ad['update'](_0x806559)['then'](function(_0xf2bc29){return _0xf2bc29;});}return null;};}function removeEntity(_0x7f76a6,_0x38074b){return function(_0x516ca3){if(_0x516ca3){return _0x516ca3[_0xeddb('0x1f')]()[_0xeddb('0x20')](function(){_0x7f76a6['status'](0xcc)[_0xeddb('0x16')]();});}};}function handleEntityNotFound(_0x4d4dae,_0x837095){return function(_0x4757b3){if(!_0x4757b3){_0x4d4dae[_0xeddb('0x15')](0x194);}return _0x4757b3;};}function handleError(_0x1636d6,_0x4834dc){_0x4834dc=_0x4834dc||0x1f4;return function(_0x2b5328){logger[_0xeddb('0x21')](_0x2b5328[_0xeddb('0x22')]);if(_0x2b5328[_0xeddb('0x23')]){delete _0x2b5328[_0xeddb('0x23')];}_0x1636d6[_0xeddb('0x17')](_0x4834dc)[_0xeddb('0x24')](_0x2b5328);};}exports[_0xeddb('0x25')]=function(_0x5a6a94,_0x15533c){var _0x52bba2={},_0x4f4ec1={},_0x293049={'count':0x0,'rows':[]};var _0x2eb245=_[_0xeddb('0x26')](db[_0xeddb('0x27')][_0xeddb('0x28')],function(_0x4a9071){return{'name':_0x4a9071['fieldName'],'type':_0x4a9071['type'][_0xeddb('0x29')]};});_0x4f4ec1[_0xeddb('0x2a')]=_[_0xeddb('0x26')](_0x2eb245,_0xeddb('0x23'));_0x4f4ec1[_0xeddb('0x2b')]=_[_0xeddb('0x2c')](_0x5a6a94[_0xeddb('0x2b')]);_0x4f4ec1[_0xeddb('0x2d')]=_[_0xeddb('0x2e')](_0x4f4ec1['model'],_0x4f4ec1[_0xeddb('0x2b')]);_0x52bba2[_0xeddb('0x2f')]=_[_0xeddb('0x2e')](_0x4f4ec1[_0xeddb('0x2a')],qs[_0xeddb('0x30')](_0x5a6a94['query']['fields']));_0x52bba2[_0xeddb('0x2f')]=_0x52bba2[_0xeddb('0x2f')][_0xeddb('0x31')]?_0x52bba2[_0xeddb('0x2f')]:_0x4f4ec1[_0xeddb('0x2a')];if(!_0x5a6a94[_0xeddb('0x2b')]['hasOwnProperty'](_0xeddb('0x32'))){_0x52bba2[_0xeddb('0x1b')]=qs['limit'](_0x5a6a94[_0xeddb('0x2b')][_0xeddb('0x1b')]);_0x52bba2[_0xeddb('0x1a')]=qs['offset'](_0x5a6a94[_0xeddb('0x2b')]['offset']);}_0x52bba2[_0xeddb('0x33')]=qs[_0xeddb('0x34')](_0x5a6a94[_0xeddb('0x2b')][_0xeddb('0x34')]);_0x52bba2[_0xeddb('0x35')]=qs['filters'](_['pick'](_0x5a6a94['query'],_0x4f4ec1[_0xeddb('0x2d')]),_0x2eb245);if(_0x5a6a94['query'][_0xeddb('0x36')]){_0x52bba2[_0xeddb('0x35')]=_[_0xeddb('0x37')](_0x52bba2[_0xeddb('0x35')],{'$or':_[_0xeddb('0x26')](_0x2eb245,function(_0x3d7545){if(_0x3d7545[_0xeddb('0x38')]!=='VIRTUAL'){var _0x4eafe1={};_0x4eafe1[_0x3d7545[_0xeddb('0x23')]]={'$like':'%'+_0x5a6a94[_0xeddb('0x2b')][_0xeddb('0x36')]+'%'};return _0x4eafe1;}})});}_0x52bba2=_['merge']({},_0x52bba2,_0x5a6a94[_0xeddb('0x39')]);var _0x52fb43={'where':_0x52bba2[_0xeddb('0x35')]};return db['Attachment'][_0xeddb('0x19')](_0x52fb43)[_0xeddb('0x20')](function(_0x3691af){_0x293049[_0xeddb('0x19')]=_0x3691af;if(_0x5a6a94['query'][_0xeddb('0x3a')]){_0x52bba2['include']=[{'all':!![]}];}return db[_0xeddb('0x27')]['findAll'](_0x52bba2);})['then'](function(_0xc2b0c0){_0x293049['rows']=_0xc2b0c0;return _0x293049;})[_0xeddb('0x20')](respondWithFilteredResult(_0x15533c,_0x52bba2))[_0xeddb('0x3b')](handleError(_0x15533c,null));};exports[_0xeddb('0x3c')]=function(_0x3c91fd,_0x4d4c6c){var _0x309ef8={'raw':!![],'where':{'id':_0x3c91fd['params']['id']}},_0x4ff1cd={};_0x4ff1cd[_0xeddb('0x2a')]=_[_0xeddb('0x2c')](db['Attachment'][_0xeddb('0x28')]);_0x4ff1cd[_0xeddb('0x2b')]=_['keys'](_0x3c91fd[_0xeddb('0x2b')]);_0x4ff1cd[_0xeddb('0x2d')]=_[_0xeddb('0x2e')](_0x4ff1cd['model'],_0x4ff1cd[_0xeddb('0x2b')]);_0x309ef8['attributes']=_[_0xeddb('0x2e')](_0x4ff1cd[_0xeddb('0x2a')],qs[_0xeddb('0x30')](_0x3c91fd[_0xeddb('0x2b')][_0xeddb('0x30')]));_0x309ef8['attributes']=_0x309ef8[_0xeddb('0x2f')]['length']?_0x309ef8[_0xeddb('0x2f')]:_0x4ff1cd[_0xeddb('0x2a')];if(_0x3c91fd[_0xeddb('0x2b')][_0xeddb('0x3a')]){_0x309ef8[_0xeddb('0x3d')]=[{'all':!![]}];}_0x309ef8=_[_0xeddb('0x37')]({},_0x309ef8,_0x3c91fd[_0xeddb('0x39')]);return db[_0xeddb('0x27')]['find'](_0x309ef8)[_0xeddb('0x20')](handleEntityNotFound(_0x4d4c6c,null))[_0xeddb('0x20')](respondWithResult(_0x4d4c6c,null))[_0xeddb('0x3b')](handleError(_0x4d4c6c,null));};exports[_0xeddb('0x3e')]=function(_0x47c93d,_0x449b5e){var _0xe7998={'where':{'id':_0x47c93d['params']['id']}},_0x4e4b6a={};_0x4e4b6a[_0xeddb('0x2a')]=_['keys'](db['Attachment'][_0xeddb('0x28')]);_0xe7998[_0xeddb('0x2f')]=_[_0xeddb('0x2e')](_0x4e4b6a['model'],qs[_0xeddb('0x30')](_0x47c93d[_0xeddb('0x2b')][_0xeddb('0x30')]));_0xe7998[_0xeddb('0x2f')]=_0xe7998[_0xeddb('0x2f')][_0xeddb('0x31')]?_0xe7998[_0xeddb('0x2f')]:_0x4e4b6a[_0xeddb('0x2a')];if(_0x47c93d['query'][_0xeddb('0x3a')]){_0xe7998[_0xeddb('0x3d')]=[{'all':!![]}];}_0xe7998=_[_0xeddb('0x37')]({},_0xe7998,_0x47c93d[_0xeddb('0x39')]);return db[_0xeddb('0x27')][_0xeddb('0x3f')](_0xe7998)[_0xeddb('0x20')](handleEntityNotFound(_0x449b5e,null))['then'](function(_0x2ccae1){if(_0x2ccae1){var _0x5dc7ba=_0x2ccae1[_0xeddb('0x40')]({'plain':!![]});_0x5dc7ba=qs[_0xeddb('0x41')](_0x5dc7ba,['id',_0xeddb('0x42'),_0xeddb('0x43')]);_0x47c93d[_0xeddb('0x44')]=_[_0xeddb('0x41')](_0x47c93d[_0xeddb('0x44')],['id',_0xeddb('0x42'),'updatedAt']);return db['Attachment']['create'](_['merge'](_0x5dc7ba,_0x47c93d[_0xeddb('0x44')]),{'include':_0x47c93d['query'][_0xeddb('0x3a')]?[{'all':!![]}]:undefined});}})[_0xeddb('0x20')](respondWithResult(_0x449b5e,0xc9))['catch'](handleError(_0x449b5e,null));};exports[_0xeddb('0x45')]=function(_0x5b3acc,_0x54b30e){if(_0x5b3acc[_0xeddb('0x44')]['id']){delete _0x5b3acc[_0xeddb('0x44')]['id'];}return db[_0xeddb('0x27')][_0xeddb('0x3f')]({'where':{'id':_0x5b3acc[_0xeddb('0x46')]['id']}})[_0xeddb('0x20')](handleEntityNotFound(_0x54b30e,null))['then'](saveUpdates(_0x5b3acc['body'],null))[_0xeddb('0x20')](respondWithResult(_0x54b30e,null))[_0xeddb('0x3b')](handleError(_0x54b30e,null));};exports[_0xeddb('0x1f')]=function(_0xacc4aa,_0x8bdaf9){return db[_0xeddb('0x27')][_0xeddb('0x3f')]({'where':{'id':_0xacc4aa[_0xeddb('0x46')]['id']}})[_0xeddb('0x20')](handleEntityNotFound(_0x8bdaf9,null))[_0xeddb('0x20')](removeEntity(_0x8bdaf9,null))[_0xeddb('0x3b')](handleError(_0x8bdaf9,null));};exports[_0xeddb('0x47')]=function(_0x15a4fd,_0x2bc493,_0x37ffec){_0x15a4fd['body']['name']=_0x15a4fd[_0xeddb('0x48')][_0xeddb('0x49')];_0x15a4fd[_0xeddb('0x44')][_0xeddb('0x4a')]=_0x15a4fd[_0xeddb('0x48')][_0xeddb('0x4b')];_0x15a4fd[_0xeddb('0x44')][_0xeddb('0x38')]=_0x15a4fd['file']['mimetype'];return db['Attachment'][_0xeddb('0x47')](_0x15a4fd[_0xeddb('0x44')])['then'](respondWithResult(_0x2bc493,0xc9))['catch'](handleError(_0x2bc493,null));};exports[_0xeddb('0x4c')]=function(_0x4b1bbe,_0xa7f051,_0x48e479){return db[_0xeddb('0x27')]['findOne']({'where':{'id':_0x4b1bbe[_0xeddb('0x46')]['id']},'raw':!![]})[_0xeddb('0x20')](handleEntityNotFound(_0xa7f051,null))[_0xeddb('0x20')](function(_0x542e9a){if(_0x542e9a){var _0x39f7f3=_0x542e9a[_0xeddb('0x4d')]!==null;var _0x219d59=path[_0xeddb('0x4e')](config[_0xeddb('0x4f')],_0xeddb('0x50'));if(_0x39f7f3){_0x219d59=path[_0xeddb('0x4e')](_0x219d59,_0xeddb('0x51'));}var _0x2bfe21=path[_0xeddb('0x4e')](_0x219d59,_0x542e9a[_0xeddb('0x4a')]);return _0xa7f051[_0xeddb('0x4c')](_0x2bfe21);}})[_0xeddb('0x3b')](handleError(_0xa7f051,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3e1fd00..5f0617a 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 _0xcbb3=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments'];(function(_0x35bf34,_0x34b15e){var _0x2be0e9=function(_0x399626){while(--_0x399626){_0x35bf34['push'](_0x35bf34['shift']());}};_0x2be0e9(++_0x34b15e);}(_0xcbb3,0xd1));var _0x3cbb=function(_0x2271a9,_0x30e282){_0x2271a9=_0x2271a9-0x0;var _0x3d8840=_0xcbb3[_0x2271a9];return _0x3d8840;};'use strict';var _=require('lodash');var util=require(_0x3cbb('0x0'));var logger=require(_0x3cbb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3cbb('0x2'));var rp=require(_0x3cbb('0x3'));var fs=require('fs');var path=require(_0x3cbb('0x4'));var rimraf=require(_0x3cbb('0x5'));var config=require(_0x3cbb('0x6'));var attributes=require(_0x3cbb('0x7'));module['exports']=function(_0x4c5f7e,_0x28f80a){return _0x4c5f7e[_0x3cbb('0x8')](_0x3cbb('0x9'),attributes,{'tableName':_0x3cbb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6319=['request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger','api','bluebird'];(function(_0x273c98,_0x48b6c3){var _0x4df9ea=function(_0x4b90f9){while(--_0x4b90f9){_0x273c98['push'](_0x273c98['shift']());}};_0x4df9ea(++_0x48b6c3);}(_0x6319,0x1cf));var _0x9631=function(_0x1a2156,_0x1833ff){_0x1a2156=_0x1a2156-0x0;var _0x282b37=_0x6319[_0x1a2156];return _0x282b37;};'use strict';var _=require(_0x9631('0x0'));var util=require(_0x9631('0x1'));var logger=require(_0x9631('0x2'))(_0x9631('0x3'));var moment=require('moment');var BPromise=require(_0x9631('0x4'));var rp=require(_0x9631('0x5'));var fs=require('fs');var path=require(_0x9631('0x6'));var rimraf=require(_0x9631('0x7'));var config=require('../../config/environment');var attributes=require(_0x9631('0x8'));module[_0x9631('0x9')]=function(_0x2d184d,_0x3c6591){return _0x2d184d[_0x9631('0xa')](_0x9631('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 0eec513..04755e6 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 _0xaaa2=['code','Attachment,\x20%s,\x20%s','message','info','result','CreateAttachment','create','body','options','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error'];(function(_0x1abae8,_0x164f63){var _0x329e9b=function(_0x1bc1a9){while(--_0x1bc1a9){_0x1abae8['push'](_0x1abae8['shift']());}};_0x329e9b(++_0x164f63);}(_0xaaa2,0xac));var _0x2aaa=function(_0x5c57b7,_0x74a588){_0x5c57b7=_0x5c57b7-0x0;var _0xa39d85=_0xaaa2[_0x5c57b7];return _0xa39d85;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106af9,_0x4f51e6,_0x2f16d7){return new BPromise(function(_0x514c32,_0x505fe8){return client[_0x2aaa('0xc')](_0x106af9,_0x2f16d7)['then'](function(_0x1ad6e9){logger['info']('Attachment,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));logger[_0x2aaa('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x1ad6e9));if(_0x1ad6e9[_0x2aaa('0x10')]){if(_0x1ad6e9['error'][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x505fe8(_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x514c32(_0x1ad6e9[_0x2aaa('0x10')]['message']);}else{logger[_0x2aaa('0x14')]('Attachment,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));_0x514c32(_0x1ad6e9[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x50a767){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x50a767);_0x505fe8(_0x50a767);});});}exports[_0x2aaa('0x16')]=function(_0x3b94bf){var _0x1cae3e=this;return new Promise(function(_0xdaa445,_0x38a049){return db['Attachment'][_0x2aaa('0x17')](_0x3b94bf[_0x2aaa('0x18')],{'raw':_0x3b94bf['options']?_0x3b94bf[_0x2aaa('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1ec32e){logger[_0x2aaa('0x14')](_0x2aaa('0x16'),_0x3b94bf);logger[_0x2aaa('0xe')](_0x2aaa('0x16'),_0x3b94bf,JSON[_0x2aaa('0xf')](_0x1ec32e));_0xdaa445(_0x1ec32e);})[_0x2aaa('0x1a')](function(_0x24da1e){logger['error'](_0x2aaa('0x16'),_0x24da1e[_0x2aaa('0x13')],_0x3b94bf);_0x38a049(_0x1cae3e['error'](0x1f4,_0x24da1e['message']));});});}; \ No newline at end of file +var _0xbf6e=['error','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x10cb77,_0x2e8faa){var _0x21dd3a=function(_0x58a2ad){while(--_0x58a2ad){_0x10cb77['push'](_0x10cb77['shift']());}};_0x21dd3a(++_0x2e8faa);}(_0xbf6e,0x149));var _0xebf6=function(_0x5a2c3d,_0x39b944){_0x5a2c3d=_0x5a2c3d-0x0;var _0x3e799a=_0xbf6e[_0x5a2c3d];return _0x3e799a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf6('0x0'));var BPromise=require(_0xebf6('0x1'));var rs=require(_0xebf6('0x2'));var fs=require('fs');var Redis=require(_0xebf6('0x3'));var db=require(_0xebf6('0x4'))['db'];var utils=require(_0xebf6('0x5'));var logger=require(_0xebf6('0x6'))('rpc');var config=require(_0xebf6('0x7'));var jayson=require(_0xebf6('0x8'));var client=jayson[_0xebf6('0x9')][_0xebf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143344,_0x1e02b3,_0x137e39){return new BPromise(function(_0x548e9e,_0x1d8035){return client[_0xebf6('0xb')](_0x143344,_0x137e39)[_0xebf6('0xc')](function(_0x591132){logger[_0xebf6('0xd')](_0xebf6('0xe'),_0x1e02b3,'request\x20sent');logger[_0xebf6('0xf')](_0xebf6('0x10'),_0x1e02b3,_0xebf6('0x11'),JSON[_0xebf6('0x12')](_0x591132));if(_0x591132[_0xebf6('0x13')]){if(_0x591132[_0xebf6('0x13')]['code']===0x1f4){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error'][_0xebf6('0x14')]);return _0x1d8035(_0x591132[_0xebf6('0x13')][_0xebf6('0x14')]);}logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error']['message']);return _0x548e9e(_0x591132['error'][_0xebf6('0x14')]);}else{logger[_0xebf6('0xd')]('Attachment,\x20%s,\x20%s',_0x1e02b3,_0xebf6('0x11'));_0x548e9e(_0x591132[_0xebf6('0x15')][_0xebf6('0x14')]);}})[_0xebf6('0x16')](function(_0x3100ee){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x3100ee);_0x1d8035(_0x3100ee);});});}exports[_0xebf6('0x17')]=function(_0x2d3984){var _0x308480=this;return new Promise(function(_0x55fa31,_0x496dea){return db[_0xebf6('0x18')][_0xebf6('0x19')](_0x2d3984[_0xebf6('0x1a')],{'raw':_0x2d3984[_0xebf6('0x1b')]?_0x2d3984[_0xebf6('0x1b')][_0xebf6('0x1c')]===undefined?!![]:![]:!![]})[_0xebf6('0xc')](function(_0x80f523){logger['info'](_0xebf6('0x17'),_0x2d3984);logger[_0xebf6('0xf')](_0xebf6('0x17'),_0x2d3984,JSON[_0xebf6('0x12')](_0x80f523));_0x55fa31(_0x80f523);})[_0xebf6('0x16')](function(_0x14c8ac){logger[_0xebf6('0x13')](_0xebf6('0x17'),_0x14c8ac[_0xebf6('0x14')],_0x2d3984);_0x496dea(_0x308480[_0xebf6('0x13')](0x1f4,_0x14c8ac[_0xebf6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 487377d..1129eab 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x5e3be8,_0x1da1d2){_0x5e3be8=_0x5e3be8-0x0;var _0x1f72ba=_0xdb28[_0x5e3be8];return _0x1f72ba;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x48149b,_0x1097d1){_0x48149b=_0x48149b-0x0;var _0x4b3dee=_0xdb28[_0x48149b];return _0x4b3dee;};'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 4e3719d..6cdf3d8 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 _0x4dca=['name','password','role','disabled','blocked','admin','user','blockedAt','add','minutes','getLicense','catch','status','send','login','ad-login','json','online','use','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled'];(function(_0x3c1a95,_0x55995d){var _0xb26183=function(_0x34f395){while(--_0x34f395){_0x3c1a95['push'](_0x3c1a95['shift']());}};_0xb26183(++_0x55995d);}(_0x4dca,0x14e));var _0xa4dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4dca[_0x20a584];return _0x4b41a8;};'use strict';var passport=require(_0xa4dc('0x0'));var LocalStrategy=require(_0xa4dc('0x1'))[_0xa4dc('0x2')];var moment=require(_0xa4dc('0x3'));var ActiveDirectory=require(_0xa4dc('0x4'));var BPromise=require(_0xa4dc('0x5'));var util=require(_0xa4dc('0x6'));var db=require(_0xa4dc('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xa4dc('0x8'));var config=require(_0xa4dc('0x9'));var logger=require(_0xa4dc('0xa'))(_0xa4dc('0xb'));function isActiveDirectoryConfigured(_0x6e9c8f){var _0x1ba13c=![];if(typeof _0x6e9c8f[_0xa4dc('0xc')]!==_0xa4dc('0xd')){_0x1ba13c=_0x6e9c8f[_0xa4dc('0xc')]['baseDN']&&_0x6e9c8f[_0xa4dc('0xc')]['url']&&_0x6e9c8f['activedirectory'][_0xa4dc('0xe')];}return _0x1ba13c;}function adAuthenticate(_0x2c9310,_0x2110a5,_0x373b83){return new BPromise(function(_0x4f0edf,_0x105c7e){try{var _0x5210ea=new ActiveDirectory(_0x2c9310);_0x5210ea[_0xa4dc('0xf')](_0x2110a5,_0x373b83,function(_0x546387,_0x53b1f5){if(_0x546387){logger[_0xa4dc('0x10')](_0xa4dc('0x11'),_0x2110a5,util[_0xa4dc('0x12')](_0x546387,{'showHidden':![],'depth':null}));_0x105c7e(_0xa4dc('0x13'));}else if(!_0x53b1f5){logger[_0xa4dc('0x10')](_0xa4dc('0x14'),_0x2110a5);_0x105c7e(_0xa4dc('0x13'));}else{_0x4f0edf(_0x53b1f5);}});}catch(_0x4b44bf){_0x105c7e(_0x4b44bf);}});}function ActiveDirectoryAuthenticate(_0x527f96,_0x543b8e,_0x18e49f,_0x1db777){var _0x437502,_0x35278e;if(!isActiveDirectoryConfigured(config)){logger[_0xa4dc('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x543b8e);return _0x1db777(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0xa4dc('0x15')]({'where':{'id':0x1},'attributes':[_0xa4dc('0x16'),_0xa4dc('0x17')],'raw':!![]})[_0xa4dc('0x18')](function(_0x1334ea){_0x437502=_0x1334ea;if(!_0x437502[_0xa4dc('0x16')]){logger[_0xa4dc('0x10')](_0xa4dc('0x19'),_0x543b8e);throw new Error(_0xa4dc('0x13'));}return _0x527f96[_0xa4dc('0x15')]({'attributes':['id',_0xa4dc('0x1a'),_0xa4dc('0x1b'),'salt',_0xa4dc('0x1c'),_0xa4dc('0x1d'),_0xa4dc('0x1e'),'blockedAt','online'],'where':{'name':_0x543b8e,'role':{'$or':[_0xa4dc('0x1f'),_0xa4dc('0x20'),'agent']},'adSsoEnabled':!![]}});})[_0xa4dc('0x18')](function(_0x28556c){if(!_0x28556c||_0x28556c&&_0x28556c['name']!==_0x543b8e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x35278e=_0x28556c;var _0x34e9ff=_0x35278e[_0xa4dc('0x1a')]+'@'+config[_0xa4dc('0xc')][_0xa4dc('0xe')];return adAuthenticate(config[_0xa4dc('0xc')],_0x34e9ff,_0x18e49f);})[_0xa4dc('0x18')](function(_0x3b75a6){if(_0x35278e[_0xa4dc('0x1d')]){throw new Error(_0xa4dc('0x13'));}if(_0x437502[_0xa4dc('0x17')]>0x0){if(_0x35278e['blocked']){if(moment(_0x35278e[_0xa4dc('0x21')])[_0xa4dc('0x22')](_0x437502[_0xa4dc('0x17')],_0xa4dc('0x23'))>moment()){throw new Error(_0xa4dc('0x13'));}return utils['clearBlockUser'](_0x35278e,0x0,![],null)['then'](function(){return utils[_0xa4dc('0x24')](_0x35278e);})[_0xa4dc('0x18')](function(){return _0x1db777(null,_0x35278e);});}else{return utils[_0xa4dc('0x24')](_0x35278e)[_0xa4dc('0x18')](function(){return _0x1db777(null,_0x35278e);});}}else{return utils['getLicense'](_0x35278e)['then'](function(){return _0x1db777(null,_0x35278e);});}})[_0xa4dc('0x25')](function(_0x525a38){return _0x1db777(null,![],_0x525a38);});}function handleError(_0x522ee4,_0x4f1820,_0x25ebbe){return _0x522ee4[_0xa4dc('0x26')](_0x4f1820||0x1f4)[_0xa4dc('0x27')]({'message':_0x25ebbe?_0x25ebbe['message']||_0x25ebbe:''});}exports[_0xa4dc('0x28')]=function(_0xd82e64,_0x372c8d,_0x183bb4){passport[_0xa4dc('0xf')](_0xa4dc('0x29'),function(_0x1670f4,_0x87de2e,_0x528cfb){var _0x4bfad7=_0x1670f4||_0x528cfb;if(_0x4bfad7){return handleError(_0x372c8d,0x191,_0x4bfad7);}if(!_0x87de2e){return handleError(_0x372c8d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0xa3ff8={'payload':{'id':_0x87de2e['id'],'role':_0x87de2e['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xa3ff8)['then'](function(_0x37bdcf){_0x372c8d[_0xa4dc('0x2a')]({'id':_0x87de2e['id'],'token':_0x37bdcf,'statusCall':'','isAlreadyLogged':_0x87de2e[_0xa4dc('0x2b')]});});}})(_0xd82e64,_0x372c8d,_0x183bb4);};passport[_0xa4dc('0x2c')](_0xa4dc('0x29'),new LocalStrategy({'usernameField':_0xa4dc('0x1a'),'passwordField':_0xa4dc('0x1b')},function(_0x1d5dc5,_0x4f4809,_0x2426bf){return ActiveDirectoryAuthenticate(db['User'],_0x1d5dc5,_0x4f4809,_0x2426bf);})); \ No newline at end of file +var _0x0e1e=['blockedAt','add','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','User','passport','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','undefined','activedirectory','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked','online','admin','user','agent'];(function(_0x3d9dca,_0x10508d){var _0x45c216=function(_0x5361b0){while(--_0x5361b0){_0x3d9dca['push'](_0x3d9dca['shift']());}};_0x45c216(++_0x10508d);}(_0x0e1e,0x185));var _0xe0e1=function(_0xbe2c1b,_0x15f55e){_0xbe2c1b=_0xbe2c1b-0x0;var _0x1adc30=_0x0e1e[_0xbe2c1b];return _0x1adc30;};'use strict';var passport=require(_0xe0e1('0x0'));var LocalStrategy=require('passport-local')[_0xe0e1('0x1')];var moment=require(_0xe0e1('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xe0e1('0x3'));var util=require(_0xe0e1('0x4'));var db=require(_0xe0e1('0x5'))['db'];var authService=require(_0xe0e1('0x6'));var utils=require(_0xe0e1('0x7'));var config=require('../../config/environment');var logger=require(_0xe0e1('0x8'))(_0xe0e1('0x9'));function isActiveDirectoryConfigured(_0x3f1a6e){var _0x3d9391=![];if(typeof _0x3f1a6e['activedirectory']!==_0xe0e1('0xa')){_0x3d9391=_0x3f1a6e[_0xe0e1('0xb')]['baseDN']&&_0x3f1a6e[_0xe0e1('0xb')][_0xe0e1('0xc')]&&_0x3f1a6e[_0xe0e1('0xb')][_0xe0e1('0xd')];}return _0x3d9391;}function adAuthenticate(_0x4d6bf1,_0x28755b,_0x2cb3b0){return new BPromise(function(_0x59e5c1,_0x46a0ef){try{var _0xe522c=new ActiveDirectory(_0x4d6bf1);_0xe522c[_0xe0e1('0xe')](_0x28755b,_0x2cb3b0,function(_0x3584e0,_0xde7555){if(_0x3584e0){logger[_0xe0e1('0xf')](_0xe0e1('0x10'),_0x28755b,util['inspect'](_0x3584e0,{'showHidden':![],'depth':null}));_0x46a0ef('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0xde7555){logger[_0xe0e1('0xf')](_0xe0e1('0x11'),_0x28755b);_0x46a0ef('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x59e5c1(_0xde7555);}});}catch(_0xf1db0){_0x46a0ef(_0xf1db0);}});}function ActiveDirectoryAuthenticate(_0x28cb2f,_0x3566f2,_0x526efa,_0x9a3a33){var _0x4c397c,_0x39aeb9;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3566f2);return _0x9a3a33(null,![],{'message':_0xe0e1('0x12')});}return db[_0xe0e1('0x13')][_0xe0e1('0x14')]({'where':{'id':0x1},'attributes':[_0xe0e1('0x15'),_0xe0e1('0x16')],'raw':!![]})[_0xe0e1('0x17')](function(_0x3089f0){_0x4c397c=_0x3089f0;if(!_0x4c397c[_0xe0e1('0x15')]){logger[_0xe0e1('0xf')](_0xe0e1('0x18'),_0x3566f2);throw new Error(_0xe0e1('0x12'));}return _0x28cb2f[_0xe0e1('0x14')]({'attributes':['id',_0xe0e1('0x19'),_0xe0e1('0x1a'),'salt',_0xe0e1('0x1b'),_0xe0e1('0x1c'),_0xe0e1('0x1d'),'blockedAt',_0xe0e1('0x1e')],'where':{'name':_0x3566f2,'role':{'$or':[_0xe0e1('0x1f'),_0xe0e1('0x20'),_0xe0e1('0x21')]},'adSsoEnabled':!![]}});})[_0xe0e1('0x17')](function(_0x49eda1){if(!_0x49eda1||_0x49eda1&&_0x49eda1[_0xe0e1('0x19')]!==_0x3566f2){throw new Error(_0xe0e1('0x12'));}_0x39aeb9=_0x49eda1;var _0x569f11=_0x39aeb9[_0xe0e1('0x19')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0xe0e1('0xb')],_0x569f11,_0x526efa);})[_0xe0e1('0x17')](function(_0x337a99){if(_0x39aeb9['disabled']){throw new Error(_0xe0e1('0x12'));}if(_0x4c397c['blockDuration']>0x0){if(_0x39aeb9[_0xe0e1('0x1d')]){if(moment(_0x39aeb9[_0xe0e1('0x22')])[_0xe0e1('0x23')](_0x4c397c['blockDuration'],'minutes')>moment()){throw new Error(_0xe0e1('0x12'));}return utils[_0xe0e1('0x24')](_0x39aeb9,0x0,![],null)[_0xe0e1('0x17')](function(){return utils[_0xe0e1('0x25')](_0x39aeb9);})[_0xe0e1('0x17')](function(){return _0x9a3a33(null,_0x39aeb9);});}else{return utils['getLicense'](_0x39aeb9)[_0xe0e1('0x17')](function(){return _0x9a3a33(null,_0x39aeb9);});}}else{return utils['getLicense'](_0x39aeb9)[_0xe0e1('0x17')](function(){return _0x9a3a33(null,_0x39aeb9);});}})[_0xe0e1('0x26')](function(_0x558f4c){return _0x9a3a33(null,![],_0x558f4c);});}function handleError(_0x1b8024,_0x5f23d9,_0xf3a5ad){return _0x1b8024[_0xe0e1('0x27')](_0x5f23d9||0x1f4)[_0xe0e1('0x28')]({'message':_0xf3a5ad?_0xf3a5ad[_0xe0e1('0x29')]||_0xf3a5ad:''});}exports[_0xe0e1('0x2a')]=function(_0xbab4b,_0x5d866f,_0x481c8b){passport[_0xe0e1('0xe')](_0xe0e1('0x2b'),function(_0x432682,_0x45b660,_0x59ded8){var _0x122f3e=_0x432682||_0x59ded8;if(_0x122f3e){return handleError(_0x5d866f,0x191,_0x122f3e);}if(!_0x45b660){return handleError(_0x5d866f,0x194,{'message':_0xe0e1('0x2c')});}else{var _0x2de77f={'payload':{'id':_0x45b660['id'],'role':_0x45b660['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2de77f)[_0xe0e1('0x17')](function(_0x47befd){_0x5d866f['json']({'id':_0x45b660['id'],'token':_0x47befd,'statusCall':'','isAlreadyLogged':_0x45b660[_0xe0e1('0x1e')]});});}})(_0xbab4b,_0x5d866f,_0x481c8b);};passport[_0xe0e1('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0xe0e1('0x19'),'passwordField':'password'},function(_0x56e654,_0xe6aec7,_0x5ee45a){return ActiveDirectoryAuthenticate(db[_0xe0e1('0x2e')],_0x56e654,_0xe6aec7,_0x5ee45a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index fc60d73..f243df8 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 _0x4faf=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x2df5e9,_0x3f8482){var _0x44aac3=function(_0x4fbbf4){while(--_0x4fbbf4){_0x2df5e9['push'](_0x2df5e9['shift']());}};_0x44aac3(++_0x3f8482);}(_0x4faf,0x134));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xf4fa('0x0'));var router=express[_0xf4fa('0x1')]();var controller=require(_0xf4fa('0x2'));router[_0xf4fa('0x3')]('/',controller[_0xf4fa('0x4')]);module[_0xf4fa('0x5')]=router; \ No newline at end of file +var _0xbc19=['express','Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x3d7647,_0x57491f){var _0x54bc3f=function(_0xb686e4){while(--_0xb686e4){_0x3d7647['push'](_0x3d7647['shift']());}};_0x54bc3f(++_0x57491f);}(_0xbc19,0x96));var _0x9bc1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbc19[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0x9bc1('0x0'));var router=express[_0x9bc1('0x1')]();var controller=require(_0x9bc1('0x2'));router[_0x9bc1('0x3')]('/',controller[_0x9bc1('0x4')]);module[_0x9bc1('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f1270bf..ca7177a 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x7a54,0x106));var _0x47a5=function(_0xdf002b,_0x2a619f){_0xdf002b=_0xdf002b-0x0;var _0x2f2c00=_0x7a54[_0xdf002b];return _0x2f2c00;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x282504,_0x56ebd9){var _0x35cfc3=function(_0x562bd5){while(--_0x562bd5){_0x282504['push'](_0x282504['shift']());}};_0x35cfc3(++_0x56ebd9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 906134e..25e9635 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 _0x4133=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login','setTokenCookie','exports','express','passport','Router'];(function(_0x5202f7,_0x391c1e){var _0x5de3dc=function(_0x3f0ada){while(--_0x3f0ada){_0x5202f7['push'](_0x5202f7['shift']());}};_0x5de3dc(++_0x391c1e);}(_0x4133,0x1eb));var _0x3413=function(_0x123239,_0x5d6800){_0x123239=_0x123239-0x0;var _0x527615=_0x4133[_0x123239];return _0x527615;};'use strict';var express=require(_0x3413('0x0'));var passport=require(_0x3413('0x1'));var router=express[_0x3413('0x2')]();var controller=require(_0x3413('0x3'));var userController=require(_0x3413('0x4'));var authService=require(_0x3413('0x5'));router[_0x3413('0x6')]('/',controller['login']);router[_0x3413('0x6')](_0x3413('0x7'),controller[_0x3413('0x8')],authService[_0x3413('0x9')],userController[_0x3413('0xa')],authService[_0x3413('0xb')]);module[_0x3413('0xc')]=router; \ No newline at end of file +var _0xa16a=['../../components/auth/service','get','/callback','isMiddleware','login','setTokenCookie','express','passport','Router','./authGoogle.controller'];(function(_0x29321b,_0x208284){var _0x9c92a2=function(_0x5a631f){while(--_0x5a631f){_0x29321b['push'](_0x29321b['shift']());}};_0x9c92a2(++_0x208284);}(_0xa16a,0x1aa));var _0xaa16=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0xa16a[_0x3d13bb];return _0x4b5a1b;};'use strict';var express=require(_0xaa16('0x0'));var passport=require(_0xaa16('0x1'));var router=express[_0xaa16('0x2')]();var controller=require(_0xaa16('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xaa16('0x4'));router['get']('/',controller['login']);router[_0xaa16('0x5')](_0xaa16('0x6'),controller['callback'],authService[_0xaa16('0x7')],userController[_0xaa16('0x8')],authService[_0xaa16('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index be922ff..a1a7614 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 _0x2fb9=['client','http','Setting','findOne','blockDuration','then','name','salt','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','allowedLoginAttempts','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','role','json','online','forgot','body','email','Email\x20parameter\x20is\x20missing','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','password','Password\x20reset!','passport','passport-local','Strategy','moment','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x45a682,_0x4e441f){var _0x40f7be=function(_0x57d505){while(--_0x57d505){_0x45a682['push'](_0x45a682['shift']());}};_0x40f7be(++_0x4e441f);}(_0x2fb9,0x18e));var _0x92fb=function(_0x700d5f,_0x57e309){_0x700d5f=_0x700d5f-0x0;var _0x26814f=_0x2fb9[_0x700d5f];return _0x26814f;};'use strict';var util=require('util');var passport=require(_0x92fb('0x0'));var LocalStrategy=require(_0x92fb('0x1'))[_0x92fb('0x2')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require(_0x92fb('0x3'));var db=require(_0x92fb('0x4'))['db'];var authService=require(_0x92fb('0x5'));var utils=require(_0x92fb('0x6'));var client=jayson[_0x92fb('0x7')][_0x92fb('0x8')]({'port':0x232b});function localAuthenticate(_0x55fdf7,_0x5b7615,_0x24206a,_0x453dfc){var _0x39c832,_0x12e92e;return db[_0x92fb('0x9')][_0x92fb('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x92fb('0xb')],'raw':!![]})[_0x92fb('0xc')](function(_0x53b1de){_0x39c832=_0x53b1de;return _0x55fdf7[_0x92fb('0xa')]({'attributes':['id',_0x92fb('0xd'),'password',_0x92fb('0xe'),'role','disabled','blocked',_0x92fb('0xf'),_0x92fb('0x10')],'where':{'name':_0x5b7615,'role':{'$or':[_0x92fb('0x11'),_0x92fb('0x12'),_0x92fb('0x13')]}}});})['then'](function(_0x3a31d3){if(!_0x3a31d3||_0x3a31d3&&_0x3a31d3[_0x92fb('0xd')]!==_0x5b7615){throw new Error(_0x92fb('0x14'));}else{_0x12e92e=_0x3a31d3;return _0x12e92e;}})[_0x92fb('0xc')](function(){_0x12e92e['authenticate'](_0x24206a,function(_0x17016e,_0x491fb7){var _0x2edfa2=_0x12e92e[_0x92fb('0x10')]+0x1;if(_0x17016e){return _0x453dfc(_0x17016e);}else if(!_0x491fb7){if(_0x12e92e[_0x92fb('0x15')]){return _0x453dfc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x39c832[_0x92fb('0x16')]>0x0){if(_0x12e92e[_0x92fb('0x17')]){if(_0x39c832[_0x92fb('0xb')]>0x0){if(moment(_0x12e92e['blockedAt'])[_0x92fb('0x18')](_0x39c832[_0x92fb('0xb')],_0x92fb('0x19'))>moment()){return _0x453dfc(null,![],{'message':_0x92fb('0x14')});}else{return utils['clearBlockUser'](_0x12e92e,_0x2edfa2,![],null)[_0x92fb('0xc')](function(){return _0x453dfc(null,![],{'message':_0x92fb('0x14')});});}}else{return _0x453dfc(null,![],{'message':_0x92fb('0x14')});}}else{if(_0x2edfa2>=_0x39c832[_0x92fb('0x16')]){return utils['clearBlockUser'](_0x12e92e,0x0,!![],moment())[_0x92fb('0xc')](function(){return _0x453dfc(null,![],{'message':_0x92fb('0x14')});});}else{return utils[_0x92fb('0x1a')](_0x12e92e,_0x2edfa2,![],null)['then'](function(){return _0x453dfc(null,![],{'message':_0x92fb('0x14')});});}}}else{return _0x453dfc(null,![],{'message':_0x92fb('0x14')});}}else{if(_0x12e92e[_0x92fb('0x15')]){return _0x453dfc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x39c832[_0x92fb('0x16')]>0x0){if(_0x12e92e['blocked']){if(_0x39c832[_0x92fb('0xb')]>0x0){if(moment(_0x12e92e[_0x92fb('0xf')])[_0x92fb('0x18')](_0x39c832['blockDuration'],_0x92fb('0x19'))>moment()){return _0x453dfc(null,![],{'message':_0x92fb('0x14')});}else{return utils[_0x92fb('0x1a')](_0x12e92e,0x0,![],null)[_0x92fb('0xc')](function(){return utils['getLicense'](_0x12e92e);})[_0x92fb('0xc')](function(){return _0x453dfc(null,_0x12e92e);});}}else{return _0x453dfc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x12e92e,0x0,![],null)[_0x92fb('0xc')](function(){return utils[_0x92fb('0x1b')](_0x12e92e);})['then'](function(){return _0x453dfc(null,_0x12e92e);})[_0x92fb('0x1c')](function(_0x30b6a2){return _0x453dfc(null,![],_0x30b6a2);});}}else{if(_0x12e92e[_0x92fb('0x17')]){return _0x453dfc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x92fb('0x1b')](_0x12e92e)[_0x92fb('0xc')](function(){return _0x453dfc(null,_0x12e92e);});}}}});})['catch'](function(_0x4a5ab8){return _0x453dfc(null,![],_0x4a5ab8);});}function sendServiceMail(_0x5b588f){return db[_0x92fb('0x1d')]['find']({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x92fb('0x1e')],'as':_0x92fb('0x1f'),'include':[{'model':db[_0x92fb('0x20')],'as':'CloudProvider'}]}]})['then'](function(_0x45df5f){if(!_0x45df5f){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x65448a=_0x45df5f[_0x92fb('0x21')]();var _0x4e02de={'account':_0x65448a,'message':_[_0x92fb('0x22')]({'from':util[_0x92fb('0x23')](_0x92fb('0x24'),_0x45df5f['name'],_0x45df5f['email']||_0x45df5f[_0x92fb('0x1f')][_0x92fb('0x12')])},_0x5b588f)};return client[_0x92fb('0x25')](_0x92fb('0x26'),_0x4e02de);})[_0x92fb('0xc')](function(_0x1e817c){if(_0x1e817c[_0x92fb('0x27')]){throw new Error(util[_0x92fb('0x23')](_0x92fb('0x28'),_0x1e817c[_0x92fb('0x27')][_0x92fb('0x29')]||JSON[_0x92fb('0x2a')](_0x1e817c[_0x92fb('0x27')])));}return!![];});}function handleError(_0x2123be,_0x41a044,_0x25e132){return _0x2123be[_0x92fb('0x2b')](_0x41a044||0x1f4)[_0x92fb('0x2c')]({'message':_0x25e132?_0x25e132[_0x92fb('0x29')]||_0x25e132:''});}exports[_0x92fb('0x2d')]=function(_0x20d1e6,_0x485f9f,_0x4cceb6){passport[_0x92fb('0x2e')](_0x92fb('0x2f'),function(_0x1df4e4,_0x5b4e2d,_0xf312ba){var _0xc0aa7c=_0x1df4e4||_0xf312ba;if(_0xc0aa7c){return handleError(_0x485f9f,0x191,_0xc0aa7c);}if(!_0x5b4e2d){return handleError(_0x485f9f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x20ca4d={'payload':{'id':_0x5b4e2d['id'],'role':_0x5b4e2d[_0x92fb('0x30')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x20ca4d)['then'](function(_0x414a55){_0x485f9f[_0x92fb('0x31')]({'id':_0x5b4e2d['id'],'token':_0x414a55,'statusCall':'','isAlreadyLogged':_0x5b4e2d[_0x92fb('0x32')]});});}})(_0x20d1e6,_0x485f9f,_0x4cceb6);};exports[_0x92fb('0x33')]=function(_0x1f329f,_0x48119b){if(!_0x1f329f[_0x92fb('0x34')][_0x92fb('0x35')]){return handleError(_0x48119b,0x1f4,{'message':_0x92fb('0x36')});}var _0x42d6b7=rs['generate']();_0x1f329f[_0x92fb('0x34')][_0x92fb('0x35')]=_0x1f329f[_0x92fb('0x34')]['email'][_0x92fb('0x37')]()[_0x92fb('0x38')]();var _0x40d68b;return db['Setting'][_0x92fb('0xa')]({'where':{'id':0x1},'attributes':[_0x92fb('0x16'),_0x92fb('0xb')],'raw':!![]})[_0x92fb('0xc')](function(_0x2b4007){_0x40d68b=_0x2b4007;return db['User'][_0x92fb('0x39')]({'where':{'email':_0x1f329f[_0x92fb('0x34')][_0x92fb('0x35')]}});})[_0x92fb('0xc')](function(_0xb6ba0f){if(!_0xb6ba0f){throw new Error(_0x92fb('0x3a'));}if(_0xb6ba0f[_0x92fb('0x15')]){throw new Error(_0x92fb('0x3b'));}if(_0xb6ba0f['blocked']){if(moment(_0xb6ba0f[_0x92fb('0xf')])[_0x92fb('0x18')](_0x40d68b['blockDuration'],_0x92fb('0x19'))>moment()){throw new Error(_0x92fb('0x3c'));}else{_0xb6ba0f[_0x92fb('0x17')]=![];_0xb6ba0f[_0x92fb('0xf')]=null;}}_0xb6ba0f[_0x92fb('0x3d')]=_0x42d6b7;_0xb6ba0f[_0x92fb('0x3e')]=Date[_0x92fb('0x3f')]()+0x36ee80;return _0xb6ba0f['save']();})['then'](function(){return sendServiceMail({'to':_0x1f329f['body'][_0x92fb('0x35')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x92fb('0x40')+_0x92fb('0x41')+_0x1f329f[_0x92fb('0x42')][_0x92fb('0x43')]+_0x92fb('0x44')+_0x42d6b7+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x92fb('0xc')](function(){_0x48119b[_0x92fb('0x2b')](0xc8)[_0x92fb('0x2c')]({'message':_0x92fb('0x45')});})[_0x92fb('0x1c')](function(_0x21b8ee){return handleError(_0x48119b,0x1f4,_0x21b8ee);});};exports[_0x92fb('0x46')]=function(_0x1dd548,_0x585598){return db[_0x92fb('0x47')][_0x92fb('0x39')]({'where':{'resetPasswordToken':_0x1dd548[_0x92fb('0x48')]['token'],'resetPasswordExpires':{'$gt':Date[_0x92fb('0x3f')]()}}})[_0x92fb('0xc')](function(_0x362a0d){if(!_0x362a0d){throw new Error(_0x92fb('0x49'));}return db[_0x92fb('0x9')][_0x92fb('0xa')]({'attributes':['id',_0x92fb('0x4a'),_0x92fb('0x4b'),_0x92fb('0x4c')]})[_0x92fb('0xc')](function(_0x538fb6){if(_0x538fb6[_0x92fb('0x4a')])authService[_0x92fb('0x4d')](_0x1dd548['body']['password']);if(!_0x538fb6[_0x92fb('0x4b')]||!_0x362a0d['previousPasswords'])return _0x362a0d;authService[_0x92fb('0x4e')](_0x1dd548[_0x92fb('0x34')][_0x92fb('0x4f')],_0x362a0d['previousPasswords'],_0x538fb6[_0x92fb('0x4c')]);return _0x362a0d;})[_0x92fb('0xc')](function(){_0x362a0d[_0x92fb('0x4f')]=_0x1dd548[_0x92fb('0x34')]['password'];_0x362a0d[_0x92fb('0x3d')]=null;_0x362a0d['resetPasswordExpires']=null;return _0x362a0d['save']();});})['then'](function(){_0x585598[_0x92fb('0x2b')](0xc8)['send']({'message':_0x92fb('0x50')});})[_0x92fb('0x1c')](function(_0xff8fcc){return handleError(_0x585598,0x1f4,_0xff8fcc);});};passport['use'](_0x92fb('0x2f'),new LocalStrategy({'usernameField':_0x92fb('0xd'),'passwordField':'password'},function(_0x348a03,_0x21749a,_0xf70bca){return localAuthenticate(db['User'],_0x348a03,_0x21749a,_0xf70bca);})); \ No newline at end of file +var _0x884c=['forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','merge','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x41ee64,_0x206c94){var _0x468e47=function(_0x1ff854){while(--_0x1ff854){_0x41ee64['push'](_0x41ee64['shift']());}};_0x468e47(++_0x206c94);}(_0x884c,0x6b));var _0xc884=function(_0x3699e8,_0x528bca){_0x3699e8=_0x3699e8-0x0;var _0x239877=_0x884c[_0x3699e8];return _0x239877;};'use strict';var util=require(_0xc884('0x0'));var passport=require('passport');var LocalStrategy=require(_0xc884('0x1'))[_0xc884('0x2')];var jayson=require(_0xc884('0x3'));var _=require(_0xc884('0x4'));var rs=require(_0xc884('0x5'));var moment=require(_0xc884('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xc884('0x7'));var utils=require('../../config/utils');var client=jayson[_0xc884('0x8')][_0xc884('0x9')]({'port':0x232b});function localAuthenticate(_0x562cf4,_0x213e3c,_0x3045f0,_0x4c7962){var _0x5685a3,_0x39257e;return db[_0xc884('0xa')][_0xc884('0xb')]({'where':{'id':0x1},'attributes':[_0xc884('0xc'),_0xc884('0xd')],'raw':!![]})[_0xc884('0xe')](function(_0xa55d80){_0x5685a3=_0xa55d80;return _0x562cf4['findOne']({'attributes':['id',_0xc884('0xf'),_0xc884('0x10'),'salt','role',_0xc884('0x11'),_0xc884('0x12'),_0xc884('0x13'),'loginAttempts'],'where':{'name':_0x213e3c,'role':{'$or':[_0xc884('0x14'),_0xc884('0x15'),_0xc884('0x16')]}}});})[_0xc884('0xe')](function(_0x411285){if(!_0x411285||_0x411285&&_0x411285['name']!==_0x213e3c){throw new Error(_0xc884('0x17'));}else{_0x39257e=_0x411285;return _0x39257e;}})[_0xc884('0xe')](function(){_0x39257e[_0xc884('0x18')](_0x3045f0,function(_0x599260,_0x33a7cd){var _0xfa75a5=_0x39257e[_0xc884('0x19')]+0x1;if(_0x599260){return _0x4c7962(_0x599260);}else if(!_0x33a7cd){if(_0x39257e[_0xc884('0x11')]){return _0x4c7962(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5685a3[_0xc884('0xc')]>0x0){if(_0x39257e[_0xc884('0x12')]){if(_0x5685a3['blockDuration']>0x0){if(moment(_0x39257e[_0xc884('0x13')])[_0xc884('0x1a')](_0x5685a3[_0xc884('0xd')],_0xc884('0x1b'))>moment()){return _0x4c7962(null,![],{'message':_0xc884('0x17')});}else{return utils[_0xc884('0x1c')](_0x39257e,_0xfa75a5,![],null)[_0xc884('0xe')](function(){return _0x4c7962(null,![],{'message':_0xc884('0x17')});});}}else{return _0x4c7962(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xfa75a5>=_0x5685a3[_0xc884('0xc')]){return utils[_0xc884('0x1c')](_0x39257e,0x0,!![],moment())[_0xc884('0xe')](function(){return _0x4c7962(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xc884('0x1c')](_0x39257e,_0xfa75a5,![],null)['then'](function(){return _0x4c7962(null,![],{'message':_0xc884('0x17')});});}}}else{return _0x4c7962(null,![],{'message':_0xc884('0x17')});}}else{if(_0x39257e[_0xc884('0x11')]){return _0x4c7962(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5685a3['allowedLoginAttempts']>0x0){if(_0x39257e[_0xc884('0x12')]){if(_0x5685a3[_0xc884('0xd')]>0x0){if(moment(_0x39257e['blockedAt'])[_0xc884('0x1a')](_0x5685a3[_0xc884('0xd')],_0xc884('0x1b'))>moment()){return _0x4c7962(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc884('0x1c')](_0x39257e,0x0,![],null)['then'](function(){return utils[_0xc884('0x1d')](_0x39257e);})[_0xc884('0xe')](function(){return _0x4c7962(null,_0x39257e);});}}else{return _0x4c7962(null,![],{'message':_0xc884('0x17')});}}else{return utils['clearBlockUser'](_0x39257e,0x0,![],null)['then'](function(){return utils[_0xc884('0x1d')](_0x39257e);})[_0xc884('0xe')](function(){return _0x4c7962(null,_0x39257e);})[_0xc884('0x1e')](function(_0x36d80b){return _0x4c7962(null,![],_0x36d80b);});}}else{if(_0x39257e[_0xc884('0x12')]){return _0x4c7962(null,![],{'message':_0xc884('0x17')});}else{return utils['getLicense'](_0x39257e)[_0xc884('0xe')](function(){return _0x4c7962(null,_0x39257e);});}}}});})[_0xc884('0x1e')](function(_0x45f287){return _0x4c7962(null,![],_0x45f287);});}function sendServiceMail(_0x376d07){return db[_0xc884('0x1f')][_0xc884('0x20')]({'where':{'service':!![]},'attributes':['id',_0xc884('0xf'),_0xc884('0x21')],'include':[{'model':db[_0xc884('0x22')],'as':_0xc884('0x23'),'include':[{'model':db[_0xc884('0x24')],'as':_0xc884('0x24')}]}]})[_0xc884('0xe')](function(_0x241a72){if(!_0x241a72){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x39ee65=_0x241a72['getSmtpOptions']();var _0x29011b={'account':_0x39ee65,'message':_[_0xc884('0x25')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x241a72[_0xc884('0xf')],_0x241a72[_0xc884('0x21')]||_0x241a72['Smtp'][_0xc884('0x15')])},_0x376d07)};return client[_0xc884('0x26')](_0xc884('0x27'),_0x29011b);})[_0xc884('0xe')](function(_0x545d62){if(_0x545d62[_0xc884('0x28')]){throw new Error(util[_0xc884('0x29')](_0xc884('0x2a'),_0x545d62[_0xc884('0x28')][_0xc884('0x2b')]||JSON[_0xc884('0x2c')](_0x545d62[_0xc884('0x28')])));}return!![];});}function handleError(_0x9c0747,_0x4ddb07,_0x151474){return _0x9c0747[_0xc884('0x2d')](_0x4ddb07||0x1f4)[_0xc884('0x2e')]({'message':_0x151474?_0x151474[_0xc884('0x2b')]||_0x151474:''});}exports[_0xc884('0x2f')]=function(_0x3724d9,_0x48889c,_0x1edcce){passport[_0xc884('0x18')](_0xc884('0x30'),function(_0x370299,_0xd46716,_0x2ad499){var _0x9c7de5=_0x370299||_0x2ad499;if(_0x9c7de5){return handleError(_0x48889c,0x191,_0x9c7de5);}if(!_0xd46716){return handleError(_0x48889c,0x194,{'message':_0xc884('0x31')});}else{var _0xb89d6d={'payload':{'id':_0xd46716['id'],'role':_0xd46716['role']},'options':{'expiresIn':0x15180}};return authService[_0xc884('0x32')](_0xb89d6d)[_0xc884('0xe')](function(_0x35878c){_0x48889c['json']({'id':_0xd46716['id'],'token':_0x35878c,'statusCall':'','isAlreadyLogged':_0xd46716['online']});});}})(_0x3724d9,_0x48889c,_0x1edcce);};exports[_0xc884('0x33')]=function(_0x56a838,_0x4ffc9a){if(!_0x56a838[_0xc884('0x34')][_0xc884('0x21')]){return handleError(_0x4ffc9a,0x1f4,{'message':_0xc884('0x35')});}var _0x23d927=rs['generate']();_0x56a838[_0xc884('0x34')]['email']=_0x56a838[_0xc884('0x34')][_0xc884('0x21')][_0xc884('0x36')]()[_0xc884('0x37')]();var _0x2e6bea;return db['Setting'][_0xc884('0xb')]({'where':{'id':0x1},'attributes':[_0xc884('0xc'),_0xc884('0xd')],'raw':!![]})[_0xc884('0xe')](function(_0x6d1e0c){_0x2e6bea=_0x6d1e0c;return db[_0xc884('0x38')][_0xc884('0x20')]({'where':{'email':_0x56a838['body'][_0xc884('0x21')]}});})['then'](function(_0x231188){if(!_0x231188){throw new Error(_0xc884('0x39'));}if(_0x231188[_0xc884('0x11')]){throw new Error(_0xc884('0x3a'));}if(_0x231188['blocked']){if(moment(_0x231188[_0xc884('0x13')])[_0xc884('0x1a')](_0x2e6bea['blockDuration'],_0xc884('0x1b'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x231188[_0xc884('0x12')]=![];_0x231188[_0xc884('0x13')]=null;}}_0x231188[_0xc884('0x3b')]=_0x23d927;_0x231188['resetPasswordExpires']=Date[_0xc884('0x3c')]()+0x36ee80;return _0x231188['save']();})[_0xc884('0xe')](function(){return sendServiceMail({'to':_0x56a838['body'][_0xc884('0x21')],'subject':_0xc884('0x3d'),'text':_0xc884('0x3e')+_0xc884('0x3f')+_0xc884('0x40')+_0x56a838[_0xc884('0x41')][_0xc884('0x42')]+_0xc884('0x43')+_0x23d927+'\x0a\x0a'+_0xc884('0x44')});})[_0xc884('0xe')](function(){_0x4ffc9a[_0xc884('0x2d')](0xc8)[_0xc884('0x2e')]({'message':_0xc884('0x45')});})[_0xc884('0x1e')](function(_0x1ed01a){return handleError(_0x4ffc9a,0x1f4,_0x1ed01a);});};exports['reset']=function(_0x678dd2,_0x5bb1b8){return db['User'][_0xc884('0x20')]({'where':{'resetPasswordToken':_0x678dd2['params'][_0xc884('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xc884('0xe')](function(_0x968359){if(!_0x968359){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xc884('0xa')][_0xc884('0xb')]({'attributes':['id',_0xc884('0x47'),_0xc884('0x48'),_0xc884('0x49')]})[_0xc884('0xe')](function(_0x193a26){if(_0x193a26[_0xc884('0x47')])authService[_0xc884('0x4a')](_0x678dd2[_0xc884('0x34')][_0xc884('0x10')]);if(!_0x193a26[_0xc884('0x48')]||!_0x968359[_0xc884('0x4b')])return _0x968359;authService[_0xc884('0x4c')](_0x678dd2[_0xc884('0x34')][_0xc884('0x10')],_0x968359[_0xc884('0x4b')],_0x193a26['passwordHistoryLimit']);return _0x968359;})[_0xc884('0xe')](function(){_0x968359[_0xc884('0x10')]=_0x678dd2[_0xc884('0x34')][_0xc884('0x10')];_0x968359[_0xc884('0x3b')]=null;_0x968359['resetPasswordExpires']=null;return _0x968359[_0xc884('0x4d')]();});})[_0xc884('0xe')](function(){_0x5bb1b8[_0xc884('0x2d')](0xc8)[_0xc884('0x2e')]({'message':'Password\x20reset!'});})[_0xc884('0x1e')](function(_0x5e1668){return handleError(_0x5bb1b8,0x1f4,_0x5e1668);});};passport[_0xc884('0x4e')](_0xc884('0x30'),new LocalStrategy({'usernameField':_0xc884('0xf'),'passwordField':_0xc884('0x10')},function(_0x4c65d3,_0xa605d4,_0x425c99){return localAuthenticate(db['User'],_0x4c65d3,_0xa605d4,_0x425c99);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9567798..34ae3cf 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 _0xb33e=['express','Router','post','/forgot','/reset/:token','reset','exports'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xb33e,0x11f));var _0xeb33=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb33e[_0x138adb];return _0x1b27f2;};'use strict';var express=require(_0xeb33('0x0'));var router=express[_0xeb33('0x1')]();var controller=require('./authLocal.controller');router[_0xeb33('0x2')]('/',controller['login']);router[_0xeb33('0x2')](_0xeb33('0x3'),controller['forgot']);router['post'](_0xeb33('0x4'),controller[_0xeb33('0x5')]);module[_0xeb33('0x6')]=router; \ No newline at end of file +var _0xf4a8=['./authLocal.controller','post','login','/forgot','/reset/:token','reset','exports','express','Router'];(function(_0x346cb2,_0x14a0ea){var _0x43b9cc=function(_0x339b13){while(--_0x339b13){_0x346cb2['push'](_0x346cb2['shift']());}};_0x43b9cc(++_0x14a0ea);}(_0xf4a8,0x85));var _0x8f4a=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0xf4a8[_0xca1f0e];return _0x35e4ef;};'use strict';var express=require(_0x8f4a('0x0'));var router=express[_0x8f4a('0x1')]();var controller=require(_0x8f4a('0x2'));router[_0x8f4a('0x3')]('/',controller[_0x8f4a('0x4')]);router[_0x8f4a('0x3')](_0x8f4a('0x5'),controller['forgot']);router[_0x8f4a('0x3')](_0x8f4a('0x6'),controller[_0x8f4a('0x7')]);module[_0x8f4a('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 6e34a47..d1072dd 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 _0xc461=['BOOLEAN','INTEGER','exports'];(function(_0x4e4e61,_0x38aede){var _0x5bda8e=function(_0x2c2c8d){while(--_0x2c2c8d){_0x4e4e61['push'](_0x4e4e61['shift']());}};_0x5bda8e(++_0x38aede);}(_0xc461,0x12b));var _0x1c46=function(_0x1071c6,_0xa49f0a){_0x1071c6=_0x1071c6-0x0;var _0x4edee4=_0xc461[_0x1071c6];return _0x4edee4;};'use strict';var Sequelize=require('sequelize');module[_0x1c46('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x1c46('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1c46('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x93b1=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x42a8c0,_0x36c472){var _0x426d7b=function(_0x71cca2){while(--_0x71cca2){_0x42a8c0['push'](_0x42a8c0['shift']());}};_0x426d7b(++_0x36c472);}(_0x93b1,0x1aa));var _0x193b=function(_0xd9d179,_0x27ee02){_0xd9d179=_0xd9d179-0x0;var _0x3eb4f7=_0x93b1[_0xd9d179];return _0x3eb4f7;};'use strict';var Sequelize=require(_0x193b('0x0'));module[_0x193b('0x1')]={'name':{'type':Sequelize[_0x193b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x193b('0x2')]},'description':{'type':Sequelize[_0x193b('0x2')]},'status':{'type':Sequelize[_0x193b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x193b('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9cbca8c..1ccaf49 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 _0x7a6d=['util','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','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','update','then','sendStatus','error','name','index','map','Automation','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','catch','show','params','create','body','find','destroy','addConditions','omit','findOne','Condition','getConditions','addActions','Action','ids','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x596248,_0x4c64fc){var _0x6f92d2=function(_0x85ccb0){while(--_0x85ccb0){_0x596248['push'](_0x596248['shift']());}};_0x6f92d2(++_0x4c64fc);}(_0x7a6d,0x99));var _0xd7a6=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x7a6d[_0x9cfe28];return _0x54a1d0;};'use strict';var emlformat=require(_0xd7a6('0x0'));var rimraf=require(_0xd7a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7a6('0x2'));var rp=require(_0xd7a6('0x3'));var moment=require(_0xd7a6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd7a6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd7a6('0x6'));var ejs=require(_0xd7a6('0x7'));var fs=require('fs');var fs_extra=require(_0xd7a6('0x8'));var _=require(_0xd7a6('0x9'));var squel=require(_0xd7a6('0xa'));var crypto=require(_0xd7a6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd7a6('0xc'));var toCsv=require(_0xd7a6('0x6'));var querystring=require(_0xd7a6('0xd'));var Papa=require(_0xd7a6('0xe'));var Redis=require(_0xd7a6('0xf'));var authService=require(_0xd7a6('0x10'));var qs=require(_0xd7a6('0x11'));var as=require(_0xd7a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd7a6('0x13'));var utils=require(_0xd7a6('0x14'));var config=require(_0xd7a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7a6('0x16'))['db'];function respondWithStatusCode(_0x3f7a57,_0x3bf0e7){_0x3bf0e7=_0x3bf0e7||0xcc;return function(_0x51ddc7){if(_0x51ddc7){return _0x3f7a57['sendStatus'](_0x3bf0e7);}return _0x3f7a57[_0xd7a6('0x17')](_0x3bf0e7)['end']();};}function respondWithResult(_0x51086d,_0x50373f){_0x50373f=_0x50373f||0xc8;return function(_0x500779){if(_0x500779){return _0x51086d['status'](_0x50373f)['json'](_0x500779);}};}function respondWithFilteredResult(_0x5e8585,_0x16c949){return function(_0x48087c){if(_0x48087c){var _0x9374fb=typeof _0x16c949[_0xd7a6('0x18')]==='undefined'&&typeof _0x16c949[_0xd7a6('0x19')]===_0xd7a6('0x1a');var _0x3b7ac1=_0x48087c['count'];var _0x1629d6=_0x9374fb?0x0:_0x16c949[_0xd7a6('0x18')];var _0x1e8a59=_0x9374fb?_0x48087c[_0xd7a6('0x1b')]:_0x16c949[_0xd7a6('0x18')]+_0x16c949[_0xd7a6('0x19')];var _0x1b17ce;if(_0x1e8a59>=_0x3b7ac1){_0x1e8a59=_0x3b7ac1;_0x1b17ce=0xc8;}else{_0x1b17ce=0xce;}_0x5e8585[_0xd7a6('0x17')](_0x1b17ce);return _0x5e8585[_0xd7a6('0x1c')](_0xd7a6('0x1d'),_0x1629d6+'-'+_0x1e8a59+'/'+_0x3b7ac1)[_0xd7a6('0x1e')](_0x48087c);}return null;};}function patchUpdates(_0xdf1545){return function(_0x3d4b2f){try{jsonpatch['apply'](_0x3d4b2f,_0xdf1545,!![]);}catch(_0x2a2f18){return BPromise['reject'](_0x2a2f18);}return _0x3d4b2f['save']();};}function saveUpdates(_0x2ffe61,_0x492749){return function(_0x338578){if(_0x338578){return _0x338578[_0xd7a6('0x1f')](_0x2ffe61)[_0xd7a6('0x20')](function(_0x40f758){return _0x40f758;});}return null;};}function removeEntity(_0x6d97a5,_0x30d557){return function(_0x7e97ed){if(_0x7e97ed){return _0x7e97ed['destroy']()[_0xd7a6('0x20')](function(){_0x6d97a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b72f,_0x49e65f){return function(_0x3a9caf){if(!_0x3a9caf){_0x47b72f[_0xd7a6('0x21')](0x194);}return _0x3a9caf;};}function handleError(_0xfd0902,_0x7cf498){_0x7cf498=_0x7cf498||0x1f4;return function(_0x2503f3){logger[_0xd7a6('0x22')](_0x2503f3['stack']);if(_0x2503f3['name']){delete _0x2503f3[_0xd7a6('0x23')];}_0xfd0902[_0xd7a6('0x17')](_0x7cf498)['send'](_0x2503f3);};}exports[_0xd7a6('0x24')]=function(_0x190708,_0x3aa7ce){var _0x2e7656={},_0x22ef5c={},_0xd45255={'count':0x0,'rows':[]};var _0x3fc763=_[_0xd7a6('0x25')](db[_0xd7a6('0x26')][_0xd7a6('0x27')],function(_0x50c699){return{'name':_0x50c699[_0xd7a6('0x28')],'type':_0x50c699['type'][_0xd7a6('0x29')]};});_0x22ef5c['model']=_[_0xd7a6('0x25')](_0x3fc763,'name');_0x22ef5c[_0xd7a6('0x2a')]=_[_0xd7a6('0x2b')](_0x190708[_0xd7a6('0x2a')]);_0x22ef5c[_0xd7a6('0x2c')]=_[_0xd7a6('0x2d')](_0x22ef5c[_0xd7a6('0x2e')],_0x22ef5c[_0xd7a6('0x2a')]);_0x2e7656[_0xd7a6('0x2f')]=_[_0xd7a6('0x2d')](_0x22ef5c[_0xd7a6('0x2e')],qs[_0xd7a6('0x30')](_0x190708[_0xd7a6('0x2a')][_0xd7a6('0x30')]));_0x2e7656[_0xd7a6('0x2f')]=_0x2e7656[_0xd7a6('0x2f')][_0xd7a6('0x31')]?_0x2e7656[_0xd7a6('0x2f')]:_0x22ef5c[_0xd7a6('0x2e')];if(!_0x190708['query'][_0xd7a6('0x32')](_0xd7a6('0x33'))){_0x2e7656[_0xd7a6('0x19')]=qs[_0xd7a6('0x19')](_0x190708[_0xd7a6('0x2a')]['limit']);_0x2e7656['offset']=qs[_0xd7a6('0x18')](_0x190708[_0xd7a6('0x2a')][_0xd7a6('0x18')]);}_0x2e7656[_0xd7a6('0x34')]=qs[_0xd7a6('0x35')](_0x190708['query']['sort']);_0x2e7656['where']=qs['filters'](_[_0xd7a6('0x36')](_0x190708[_0xd7a6('0x2a')],_0x22ef5c['filters']),_0x3fc763);if(_0x190708['query'][_0xd7a6('0x37')]){_0x2e7656['where']=_[_0xd7a6('0x38')](_0x2e7656[_0xd7a6('0x39')],{'$or':_[_0xd7a6('0x25')](_0x3fc763,function(_0x98572b){if(_0x98572b[_0xd7a6('0x3a')]!==_0xd7a6('0x3b')){var _0x4b1cf1={};_0x4b1cf1[_0x98572b['name']]={'$like':'%'+_0x190708[_0xd7a6('0x2a')][_0xd7a6('0x37')]+'%'};return _0x4b1cf1;}})});}_0x2e7656=_[_0xd7a6('0x38')]({},_0x2e7656,_0x190708[_0xd7a6('0x3c')]);var _0x57b4f4={'where':_0x2e7656[_0xd7a6('0x39')]};return db[_0xd7a6('0x26')][_0xd7a6('0x1b')](_0x57b4f4)[_0xd7a6('0x20')](function(_0x625350){_0xd45255['count']=_0x625350;if(_0x190708[_0xd7a6('0x2a')][_0xd7a6('0x3d')]){_0x2e7656[_0xd7a6('0x3e')]=[{'all':!![]}];}return db[_0xd7a6('0x26')]['findAll'](_0x2e7656);})['then'](function(_0x282883){_0xd45255['rows']=_0x282883;return _0xd45255;})[_0xd7a6('0x20')](respondWithFilteredResult(_0x3aa7ce,_0x2e7656))[_0xd7a6('0x3f')](handleError(_0x3aa7ce,null));};exports[_0xd7a6('0x40')]=function(_0x3b8a67,_0x276115){var _0x1e6407={'raw':![],'where':{'id':_0x3b8a67[_0xd7a6('0x41')]['id']}},_0x3b1d35={};_0x3b1d35[_0xd7a6('0x2e')]=_[_0xd7a6('0x2b')](db[_0xd7a6('0x26')]['rawAttributes']);_0x3b1d35['query']=_[_0xd7a6('0x2b')](_0x3b8a67[_0xd7a6('0x2a')]);_0x3b1d35['filters']=_['intersection'](_0x3b1d35[_0xd7a6('0x2e')],_0x3b1d35[_0xd7a6('0x2a')]);_0x1e6407[_0xd7a6('0x2f')]=_['intersection'](_0x3b1d35['model'],qs['fields'](_0x3b8a67[_0xd7a6('0x2a')][_0xd7a6('0x30')]));_0x1e6407['attributes']=_0x1e6407[_0xd7a6('0x2f')][_0xd7a6('0x31')]?_0x1e6407[_0xd7a6('0x2f')]:_0x3b1d35[_0xd7a6('0x2e')];if(_0x3b8a67[_0xd7a6('0x2a')][_0xd7a6('0x3d')]){_0x1e6407[_0xd7a6('0x3e')]=[{'all':!![]}];}_0x1e6407=_[_0xd7a6('0x38')]({},_0x1e6407,_0x3b8a67['options']);return db['Automation']['find'](_0x1e6407)[_0xd7a6('0x20')](handleEntityNotFound(_0x276115,null))[_0xd7a6('0x20')](respondWithResult(_0x276115,null))['catch'](handleError(_0x276115,null));};exports['create']=function(_0xc56036,_0x2d971e){return db[_0xd7a6('0x26')][_0xd7a6('0x42')](_0xc56036['body'],{})[_0xd7a6('0x20')](respondWithResult(_0x2d971e,0xc9))[_0xd7a6('0x3f')](handleError(_0x2d971e,null));};exports[_0xd7a6('0x1f')]=function(_0x1be632,_0x44ecde){if(_0x1be632[_0xd7a6('0x43')]['id']){delete _0x1be632[_0xd7a6('0x43')]['id'];}return db['Automation'][_0xd7a6('0x44')]({'where':{'id':_0x1be632['params']['id']}})['then'](handleEntityNotFound(_0x44ecde,null))[_0xd7a6('0x20')](saveUpdates(_0x1be632[_0xd7a6('0x43')],null))['then'](respondWithResult(_0x44ecde,null))[_0xd7a6('0x3f')](handleError(_0x44ecde,null));};exports[_0xd7a6('0x45')]=function(_0x435578,_0x3f4e12){return db[_0xd7a6('0x26')][_0xd7a6('0x44')]({'where':{'id':_0x435578[_0xd7a6('0x41')]['id']}})[_0xd7a6('0x20')](handleEntityNotFound(_0x3f4e12,null))[_0xd7a6('0x20')](removeEntity(_0x3f4e12,null))[_0xd7a6('0x3f')](handleError(_0x3f4e12,null));};exports[_0xd7a6('0x46')]=function(_0xb3a8f8,_0x22e339,_0xce3d2c){return db['Condition'][_0xd7a6('0x44')]({'where':{'id':_0xb3a8f8[_0xd7a6('0x41')]['id']}})[_0xd7a6('0x20')](handleEntityNotFound(_0x22e339,null))['then'](function(_0x352202){if(_0x352202){return _0x352202['addConditions'](_0xb3a8f8['body']['ids'],_[_0xd7a6('0x47')](_0xb3a8f8[_0xd7a6('0x43')],['ids','id'])||{});}})[_0xd7a6('0x20')](respondWithResult(_0x22e339,null))[_0xd7a6('0x3f')](handleError(_0x22e339,null));};exports['getConditions']=function(_0x5c428d,_0x3b698b,_0x1ccdcd){var _0x18220b={};var _0x5637a8={};var _0x2dd312;var _0x56ecd6;return db['Automation'][_0xd7a6('0x48')]({'where':{'id':_0x5c428d[_0xd7a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b698b,null))[_0xd7a6('0x20')](function(_0x1a8361){if(_0x1a8361){_0x2dd312=_0x1a8361;_0x5637a8[_0xd7a6('0x2e')]=_[_0xd7a6('0x2b')](db[_0xd7a6('0x49')][_0xd7a6('0x27')]);_0x5637a8[_0xd7a6('0x2a')]=_[_0xd7a6('0x2b')](_0x5c428d[_0xd7a6('0x2a')]);_0x5637a8[_0xd7a6('0x2c')]=_[_0xd7a6('0x2d')](_0x5637a8[_0xd7a6('0x2e')],_0x5637a8['query']);_0x18220b[_0xd7a6('0x2f')]=_[_0xd7a6('0x2d')](_0x5637a8[_0xd7a6('0x2e')],qs[_0xd7a6('0x30')](_0x5c428d['query'][_0xd7a6('0x30')]));_0x18220b[_0xd7a6('0x2f')]=_0x18220b[_0xd7a6('0x2f')]['length']?_0x18220b['attributes']:_0x5637a8['model'];_0x18220b[_0xd7a6('0x34')]=qs[_0xd7a6('0x35')](_0x5c428d[_0xd7a6('0x2a')][_0xd7a6('0x35')]);_0x18220b['where']=qs['filters'](_[_0xd7a6('0x36')](_0x5c428d[_0xd7a6('0x2a')],_0x5637a8[_0xd7a6('0x2c')]));if(_0x5c428d['query'][_0xd7a6('0x37')]){_0x18220b[_0xd7a6('0x39')]=_[_0xd7a6('0x38')](_0x18220b[_0xd7a6('0x39')],{'$or':_['map'](_0x18220b[_0xd7a6('0x2f')],function(_0x44bd0e){var _0x10ef30={};_0x10ef30[_0x44bd0e]={'$like':'%'+_0x5c428d['query'][_0xd7a6('0x37')]+'%'};return _0x10ef30;})});}_0x18220b=_[_0xd7a6('0x38')]({},_0x18220b,_0x5c428d['options']);return _0x2dd312[_0xd7a6('0x4a')](_0x18220b);}})[_0xd7a6('0x20')](function(_0x24849c){if(_0x24849c){_0x56ecd6=_0x24849c[_0xd7a6('0x31')];if(!_0x5c428d[_0xd7a6('0x2a')]['hasOwnProperty'](_0xd7a6('0x33'))){_0x18220b[_0xd7a6('0x19')]=qs[_0xd7a6('0x19')](_0x5c428d['query']['limit']);_0x18220b[_0xd7a6('0x18')]=qs[_0xd7a6('0x18')](_0x5c428d[_0xd7a6('0x2a')][_0xd7a6('0x18')]);}return _0x2dd312[_0xd7a6('0x4a')](_0x18220b);}})[_0xd7a6('0x20')](function(_0x1af11a){if(_0x1af11a){return _0x1af11a?{'count':_0x56ecd6,'rows':_0x1af11a}:null;}})['then'](respondWithResult(_0x3b698b,null))[_0xd7a6('0x3f')](handleError(_0x3b698b,null));};exports[_0xd7a6('0x4b')]=function(_0x1d34bf,_0x29d672,_0x58dab3){return db[_0xd7a6('0x4c')][_0xd7a6('0x44')]({'where':{'id':_0x1d34bf[_0xd7a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x29d672,null))[_0xd7a6('0x20')](function(_0x208143){if(_0x208143){return _0x208143[_0xd7a6('0x4b')](_0x1d34bf['body'][_0xd7a6('0x4d')],_[_0xd7a6('0x47')](_0x1d34bf[_0xd7a6('0x43')],['ids','id'])||{});}})[_0xd7a6('0x20')](respondWithResult(_0x29d672,null))[_0xd7a6('0x3f')](handleError(_0x29d672,null));};exports[_0xd7a6('0x4e')]=function(_0x2ba110,_0x2f49ed,_0x53cf53){var _0x2972d8={};var _0x553ec5={};var _0x147201;var _0x3a7da1;return db[_0xd7a6('0x26')][_0xd7a6('0x48')]({'where':{'id':_0x2ba110[_0xd7a6('0x41')]['id']}})[_0xd7a6('0x20')](handleEntityNotFound(_0x2f49ed,null))[_0xd7a6('0x20')](function(_0x4bc113){if(_0x4bc113){_0x147201=_0x4bc113;_0x553ec5[_0xd7a6('0x2e')]=_[_0xd7a6('0x2b')](db['Action']['rawAttributes']);_0x553ec5['query']=_[_0xd7a6('0x2b')](_0x2ba110['query']);_0x553ec5['filters']=_[_0xd7a6('0x2d')](_0x553ec5[_0xd7a6('0x2e')],_0x553ec5[_0xd7a6('0x2a')]);_0x2972d8[_0xd7a6('0x2f')]=_[_0xd7a6('0x2d')](_0x553ec5[_0xd7a6('0x2e')],qs['fields'](_0x2ba110[_0xd7a6('0x2a')][_0xd7a6('0x30')]));_0x2972d8[_0xd7a6('0x2f')]=_0x2972d8[_0xd7a6('0x2f')][_0xd7a6('0x31')]?_0x2972d8[_0xd7a6('0x2f')]:_0x553ec5[_0xd7a6('0x2e')];_0x2972d8['order']=qs[_0xd7a6('0x35')](_0x2ba110['query'][_0xd7a6('0x35')]);_0x2972d8[_0xd7a6('0x39')]=qs[_0xd7a6('0x2c')](_[_0xd7a6('0x36')](_0x2ba110['query'],_0x553ec5[_0xd7a6('0x2c')]));if(_0x2ba110['query'][_0xd7a6('0x37')]){_0x2972d8['where']=_['merge'](_0x2972d8['where'],{'$or':_[_0xd7a6('0x25')](_0x2972d8[_0xd7a6('0x2f')],function(_0x24736d){var _0x1802d0={};_0x1802d0[_0x24736d]={'$like':'%'+_0x2ba110[_0xd7a6('0x2a')][_0xd7a6('0x37')]+'%'};return _0x1802d0;})});}_0x2972d8=_[_0xd7a6('0x38')]({},_0x2972d8,_0x2ba110[_0xd7a6('0x3c')]);return _0x147201[_0xd7a6('0x4e')](_0x2972d8);}})['then'](function(_0x5178b5){if(_0x5178b5){_0x3a7da1=_0x5178b5[_0xd7a6('0x31')];if(!_0x2ba110['query']['hasOwnProperty']('nolimit')){_0x2972d8[_0xd7a6('0x19')]=qs[_0xd7a6('0x19')](_0x2ba110[_0xd7a6('0x2a')][_0xd7a6('0x19')]);_0x2972d8[_0xd7a6('0x18')]=qs[_0xd7a6('0x18')](_0x2ba110[_0xd7a6('0x2a')][_0xd7a6('0x18')]);}return _0x147201[_0xd7a6('0x4e')](_0x2972d8);}})[_0xd7a6('0x20')](function(_0x4e608c){if(_0x4e608c){return _0x4e608c?{'count':_0x3a7da1,'rows':_0x4e608c}:null;}})['then'](respondWithResult(_0x2f49ed,null))[_0xd7a6('0x3f')](handleError(_0x2f49ed,null));}; \ No newline at end of file +var _0xf16f=['sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','options','includeAll','include','findAll','catch','params','merge','find','create','body','destroy','Condition','addConditions','ids','omit','getConditions','order','sort','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0xdd598a,_0x2f4169){var _0x18c8d7=function(_0x52be9c){while(--_0x52be9c){_0xdd598a['push'](_0xdd598a['shift']());}};_0x18c8d7(++_0x2f4169);}(_0xf16f,0x1de));var _0xff16=function(_0x4f4270,_0x5bd54d){_0x4f4270=_0x4f4270-0x0;var _0x2e30de=_0xf16f[_0x4f4270];return _0x2e30de;};'use strict';var emlformat=require(_0xff16('0x0'));var rimraf=require(_0xff16('0x1'));var zipdir=require(_0xff16('0x2'));var jsonpatch=require(_0xff16('0x3'));var rp=require('request-promise');var moment=require(_0xff16('0x4'));var BPromise=require(_0xff16('0x5'));var Mustache=require(_0xff16('0x6'));var util=require('util');var path=require(_0xff16('0x7'));var sox=require(_0xff16('0x8'));var csv=require('to-csv');var ejs=require(_0xff16('0x9'));var fs=require('fs');var fs_extra=require(_0xff16('0xa'));var _=require(_0xff16('0xb'));var squel=require('squel');var crypto=require(_0xff16('0xc'));var jsforce=require(_0xff16('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff16('0xe'));var Papa=require(_0xff16('0xf'));var Redis=require(_0xff16('0x10'));var authService=require(_0xff16('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff16('0x12'));var logger=require('../../config/logger')(_0xff16('0x13'));var utils=require(_0xff16('0x14'));var config=require(_0xff16('0x15'));var licenseUtil=require(_0xff16('0x16'));var db=require(_0xff16('0x17'))['db'];function respondWithStatusCode(_0x241777,_0x25b8a1){_0x25b8a1=_0x25b8a1||0xcc;return function(_0x138483){if(_0x138483){return _0x241777[_0xff16('0x18')](_0x25b8a1);}return _0x241777['status'](_0x25b8a1)['end']();};}function respondWithResult(_0x196fb4,_0x84b96e){_0x84b96e=_0x84b96e||0xc8;return function(_0xec90e4){if(_0xec90e4){return _0x196fb4['status'](_0x84b96e)[_0xff16('0x19')](_0xec90e4);}};}function respondWithFilteredResult(_0x2ce469,_0x16d803){return function(_0x2a4fc1){if(_0x2a4fc1){var _0xb9e508=typeof _0x16d803['offset']===_0xff16('0x1a')&&typeof _0x16d803[_0xff16('0x1b')]==='undefined';var _0x406e8b=_0x2a4fc1[_0xff16('0x1c')];var _0x1af793=_0xb9e508?0x0:_0x16d803[_0xff16('0x1d')];var _0x3d992b=_0xb9e508?_0x2a4fc1[_0xff16('0x1c')]:_0x16d803[_0xff16('0x1d')]+_0x16d803[_0xff16('0x1b')];var _0x2a0acc;if(_0x3d992b>=_0x406e8b){_0x3d992b=_0x406e8b;_0x2a0acc=0xc8;}else{_0x2a0acc=0xce;}_0x2ce469[_0xff16('0x1e')](_0x2a0acc);return _0x2ce469[_0xff16('0x1f')](_0xff16('0x20'),_0x1af793+'-'+_0x3d992b+'/'+_0x406e8b)[_0xff16('0x19')](_0x2a4fc1);}return null;};}function patchUpdates(_0x78c45){return function(_0x318879){try{jsonpatch['apply'](_0x318879,_0x78c45,!![]);}catch(_0x22e407){return BPromise['reject'](_0x22e407);}return _0x318879[_0xff16('0x21')]();};}function saveUpdates(_0x26df3c,_0x5d7d56){return function(_0x10b6b0){if(_0x10b6b0){return _0x10b6b0[_0xff16('0x22')](_0x26df3c)[_0xff16('0x23')](function(_0x34035b){return _0x34035b;});}return null;};}function removeEntity(_0x4c5097,_0x37f41c){return function(_0x1d283f){if(_0x1d283f){return _0x1d283f['destroy']()[_0xff16('0x23')](function(){_0x4c5097[_0xff16('0x1e')](0xcc)[_0xff16('0x24')]();});}};}function handleEntityNotFound(_0x2b5255,_0x3b06a7){return function(_0x256cba){if(!_0x256cba){_0x2b5255[_0xff16('0x18')](0x194);}return _0x256cba;};}function handleError(_0x50fcc6,_0x4b4cf1){_0x4b4cf1=_0x4b4cf1||0x1f4;return function(_0x150087){logger[_0xff16('0x25')](_0x150087[_0xff16('0x26')]);if(_0x150087[_0xff16('0x27')]){delete _0x150087[_0xff16('0x27')];}_0x50fcc6[_0xff16('0x1e')](_0x4b4cf1)[_0xff16('0x28')](_0x150087);};}exports[_0xff16('0x29')]=function(_0x1a4821,_0x45cbe4){var _0x58b96f={},_0x422277={},_0x11becd={'count':0x0,'rows':[]};var _0xbd1b72=_[_0xff16('0x2a')](db[_0xff16('0x2b')][_0xff16('0x2c')],function(_0x1d9b73){return{'name':_0x1d9b73[_0xff16('0x2d')],'type':_0x1d9b73['type'][_0xff16('0x2e')]};});_0x422277[_0xff16('0x2f')]=_[_0xff16('0x2a')](_0xbd1b72,_0xff16('0x27'));_0x422277[_0xff16('0x30')]=_[_0xff16('0x31')](_0x1a4821['query']);_0x422277['filters']=_[_0xff16('0x32')](_0x422277[_0xff16('0x2f')],_0x422277['query']);_0x58b96f[_0xff16('0x33')]=_[_0xff16('0x32')](_0x422277[_0xff16('0x2f')],qs[_0xff16('0x34')](_0x1a4821[_0xff16('0x30')][_0xff16('0x34')]));_0x58b96f[_0xff16('0x33')]=_0x58b96f[_0xff16('0x33')][_0xff16('0x35')]?_0x58b96f[_0xff16('0x33')]:_0x422277['model'];if(!_0x1a4821['query'][_0xff16('0x36')](_0xff16('0x37'))){_0x58b96f['limit']=qs[_0xff16('0x1b')](_0x1a4821[_0xff16('0x30')]['limit']);_0x58b96f[_0xff16('0x1d')]=qs[_0xff16('0x1d')](_0x1a4821[_0xff16('0x30')][_0xff16('0x1d')]);}_0x58b96f['order']=qs['sort'](_0x1a4821[_0xff16('0x30')]['sort']);_0x58b96f[_0xff16('0x38')]=qs[_0xff16('0x39')](_[_0xff16('0x3a')](_0x1a4821[_0xff16('0x30')],_0x422277[_0xff16('0x39')]),_0xbd1b72);if(_0x1a4821['query'][_0xff16('0x3b')]){_0x58b96f[_0xff16('0x38')]=_['merge'](_0x58b96f[_0xff16('0x38')],{'$or':_[_0xff16('0x2a')](_0xbd1b72,function(_0x28de0a){if(_0x28de0a['type']!=='VIRTUAL'){var _0x3e823e={};_0x3e823e[_0x28de0a[_0xff16('0x27')]]={'$like':'%'+_0x1a4821[_0xff16('0x30')][_0xff16('0x3b')]+'%'};return _0x3e823e;}})});}_0x58b96f=_['merge']({},_0x58b96f,_0x1a4821[_0xff16('0x3c')]);var _0x186051={'where':_0x58b96f[_0xff16('0x38')]};return db[_0xff16('0x2b')][_0xff16('0x1c')](_0x186051)[_0xff16('0x23')](function(_0x1bd464){_0x11becd[_0xff16('0x1c')]=_0x1bd464;if(_0x1a4821['query'][_0xff16('0x3d')]){_0x58b96f[_0xff16('0x3e')]=[{'all':!![]}];}return db[_0xff16('0x2b')][_0xff16('0x3f')](_0x58b96f);})[_0xff16('0x23')](function(_0xa79b0a){_0x11becd['rows']=_0xa79b0a;return _0x11becd;})['then'](respondWithFilteredResult(_0x45cbe4,_0x58b96f))[_0xff16('0x40')](handleError(_0x45cbe4,null));};exports['show']=function(_0x4dc1db,_0x38966d){var _0x3bdd05={'raw':![],'where':{'id':_0x4dc1db[_0xff16('0x41')]['id']}},_0x47cb60={};_0x47cb60['model']=_[_0xff16('0x31')](db[_0xff16('0x2b')][_0xff16('0x2c')]);_0x47cb60['query']=_['keys'](_0x4dc1db[_0xff16('0x30')]);_0x47cb60[_0xff16('0x39')]=_[_0xff16('0x32')](_0x47cb60[_0xff16('0x2f')],_0x47cb60['query']);_0x3bdd05[_0xff16('0x33')]=_[_0xff16('0x32')](_0x47cb60[_0xff16('0x2f')],qs[_0xff16('0x34')](_0x4dc1db[_0xff16('0x30')][_0xff16('0x34')]));_0x3bdd05[_0xff16('0x33')]=_0x3bdd05[_0xff16('0x33')][_0xff16('0x35')]?_0x3bdd05[_0xff16('0x33')]:_0x47cb60['model'];if(_0x4dc1db['query'][_0xff16('0x3d')]){_0x3bdd05[_0xff16('0x3e')]=[{'all':!![]}];}_0x3bdd05=_[_0xff16('0x42')]({},_0x3bdd05,_0x4dc1db[_0xff16('0x3c')]);return db[_0xff16('0x2b')][_0xff16('0x43')](_0x3bdd05)[_0xff16('0x23')](handleEntityNotFound(_0x38966d,null))[_0xff16('0x23')](respondWithResult(_0x38966d,null))[_0xff16('0x40')](handleError(_0x38966d,null));};exports[_0xff16('0x44')]=function(_0x370ace,_0x34a575){return db[_0xff16('0x2b')][_0xff16('0x44')](_0x370ace[_0xff16('0x45')],{})[_0xff16('0x23')](respondWithResult(_0x34a575,0xc9))[_0xff16('0x40')](handleError(_0x34a575,null));};exports[_0xff16('0x22')]=function(_0x2d4c16,_0x23942f){if(_0x2d4c16[_0xff16('0x45')]['id']){delete _0x2d4c16['body']['id'];}return db[_0xff16('0x2b')][_0xff16('0x43')]({'where':{'id':_0x2d4c16[_0xff16('0x41')]['id']}})[_0xff16('0x23')](handleEntityNotFound(_0x23942f,null))[_0xff16('0x23')](saveUpdates(_0x2d4c16['body'],null))[_0xff16('0x23')](respondWithResult(_0x23942f,null))['catch'](handleError(_0x23942f,null));};exports[_0xff16('0x46')]=function(_0x9c7a69,_0x4e97d7){return db[_0xff16('0x2b')]['find']({'where':{'id':_0x9c7a69['params']['id']}})[_0xff16('0x23')](handleEntityNotFound(_0x4e97d7,null))[_0xff16('0x23')](removeEntity(_0x4e97d7,null))['catch'](handleError(_0x4e97d7,null));};exports['addConditions']=function(_0x5c8b4e,_0x3857d9,_0x2ea526){return db[_0xff16('0x47')][_0xff16('0x43')]({'where':{'id':_0x5c8b4e[_0xff16('0x41')]['id']}})['then'](handleEntityNotFound(_0x3857d9,null))[_0xff16('0x23')](function(_0x29bd9f){if(_0x29bd9f){return _0x29bd9f[_0xff16('0x48')](_0x5c8b4e[_0xff16('0x45')][_0xff16('0x49')],_[_0xff16('0x4a')](_0x5c8b4e[_0xff16('0x45')],['ids','id'])||{});}})['then'](respondWithResult(_0x3857d9,null))[_0xff16('0x40')](handleError(_0x3857d9,null));};exports[_0xff16('0x4b')]=function(_0x7f3c67,_0x162932,_0x487c56){var _0x22c4e0={};var _0x1f37ac={};var _0x3cbd05;var _0x30ea7b;return db[_0xff16('0x2b')]['findOne']({'where':{'id':_0x7f3c67['params']['id']}})['then'](handleEntityNotFound(_0x162932,null))[_0xff16('0x23')](function(_0x494f11){if(_0x494f11){_0x3cbd05=_0x494f11;_0x1f37ac['model']=_['keys'](db[_0xff16('0x47')][_0xff16('0x2c')]);_0x1f37ac[_0xff16('0x30')]=_[_0xff16('0x31')](_0x7f3c67[_0xff16('0x30')]);_0x1f37ac['filters']=_[_0xff16('0x32')](_0x1f37ac[_0xff16('0x2f')],_0x1f37ac['query']);_0x22c4e0[_0xff16('0x33')]=_[_0xff16('0x32')](_0x1f37ac['model'],qs[_0xff16('0x34')](_0x7f3c67[_0xff16('0x30')][_0xff16('0x34')]));_0x22c4e0['attributes']=_0x22c4e0[_0xff16('0x33')][_0xff16('0x35')]?_0x22c4e0['attributes']:_0x1f37ac[_0xff16('0x2f')];_0x22c4e0[_0xff16('0x4c')]=qs[_0xff16('0x4d')](_0x7f3c67[_0xff16('0x30')]['sort']);_0x22c4e0[_0xff16('0x38')]=qs['filters'](_[_0xff16('0x3a')](_0x7f3c67[_0xff16('0x30')],_0x1f37ac[_0xff16('0x39')]));if(_0x7f3c67['query']['filter']){_0x22c4e0[_0xff16('0x38')]=_[_0xff16('0x42')](_0x22c4e0[_0xff16('0x38')],{'$or':_['map'](_0x22c4e0['attributes'],function(_0x5355f9){var _0x2e3bd8={};_0x2e3bd8[_0x5355f9]={'$like':'%'+_0x7f3c67[_0xff16('0x30')][_0xff16('0x3b')]+'%'};return _0x2e3bd8;})});}_0x22c4e0=_[_0xff16('0x42')]({},_0x22c4e0,_0x7f3c67[_0xff16('0x3c')]);return _0x3cbd05['getConditions'](_0x22c4e0);}})[_0xff16('0x23')](function(_0x284e0d){if(_0x284e0d){_0x30ea7b=_0x284e0d[_0xff16('0x35')];if(!_0x7f3c67['query'][_0xff16('0x36')](_0xff16('0x37'))){_0x22c4e0[_0xff16('0x1b')]=qs[_0xff16('0x1b')](_0x7f3c67['query'][_0xff16('0x1b')]);_0x22c4e0[_0xff16('0x1d')]=qs[_0xff16('0x1d')](_0x7f3c67[_0xff16('0x30')]['offset']);}return _0x3cbd05[_0xff16('0x4b')](_0x22c4e0);}})[_0xff16('0x23')](function(_0xfc7699){if(_0xfc7699){return _0xfc7699?{'count':_0x30ea7b,'rows':_0xfc7699}:null;}})[_0xff16('0x23')](respondWithResult(_0x162932,null))[_0xff16('0x40')](handleError(_0x162932,null));};exports[_0xff16('0x4e')]=function(_0x363009,_0xd9fe43,_0x58c158){return db[_0xff16('0x4f')][_0xff16('0x43')]({'where':{'id':_0x363009[_0xff16('0x41')]['id']}})[_0xff16('0x23')](handleEntityNotFound(_0xd9fe43,null))['then'](function(_0x55fec8){if(_0x55fec8){return _0x55fec8['addActions'](_0x363009[_0xff16('0x45')]['ids'],_[_0xff16('0x4a')](_0x363009[_0xff16('0x45')],[_0xff16('0x49'),'id'])||{});}})[_0xff16('0x23')](respondWithResult(_0xd9fe43,null))[_0xff16('0x40')](handleError(_0xd9fe43,null));};exports[_0xff16('0x50')]=function(_0x4d12e3,_0x4b9c69,_0x29929c){var _0x3c66f8={};var _0x2fd48f={};var _0x3a86b2;var _0x3482e9;return db['Automation']['findOne']({'where':{'id':_0x4d12e3[_0xff16('0x41')]['id']}})[_0xff16('0x23')](handleEntityNotFound(_0x4b9c69,null))['then'](function(_0x1308c7){if(_0x1308c7){_0x3a86b2=_0x1308c7;_0x2fd48f[_0xff16('0x2f')]=_[_0xff16('0x31')](db[_0xff16('0x4f')]['rawAttributes']);_0x2fd48f[_0xff16('0x30')]=_[_0xff16('0x31')](_0x4d12e3[_0xff16('0x30')]);_0x2fd48f[_0xff16('0x39')]=_[_0xff16('0x32')](_0x2fd48f[_0xff16('0x2f')],_0x2fd48f[_0xff16('0x30')]);_0x3c66f8[_0xff16('0x33')]=_[_0xff16('0x32')](_0x2fd48f[_0xff16('0x2f')],qs[_0xff16('0x34')](_0x4d12e3['query'][_0xff16('0x34')]));_0x3c66f8['attributes']=_0x3c66f8[_0xff16('0x33')][_0xff16('0x35')]?_0x3c66f8['attributes']:_0x2fd48f[_0xff16('0x2f')];_0x3c66f8[_0xff16('0x4c')]=qs[_0xff16('0x4d')](_0x4d12e3['query'][_0xff16('0x4d')]);_0x3c66f8[_0xff16('0x38')]=qs[_0xff16('0x39')](_['pick'](_0x4d12e3['query'],_0x2fd48f[_0xff16('0x39')]));if(_0x4d12e3[_0xff16('0x30')]['filter']){_0x3c66f8[_0xff16('0x38')]=_['merge'](_0x3c66f8['where'],{'$or':_['map'](_0x3c66f8['attributes'],function(_0x99d153){var _0x536fe5={};_0x536fe5[_0x99d153]={'$like':'%'+_0x4d12e3[_0xff16('0x30')]['filter']+'%'};return _0x536fe5;})});}_0x3c66f8=_[_0xff16('0x42')]({},_0x3c66f8,_0x4d12e3[_0xff16('0x3c')]);return _0x3a86b2[_0xff16('0x50')](_0x3c66f8);}})[_0xff16('0x23')](function(_0x341cc2){if(_0x341cc2){_0x3482e9=_0x341cc2['length'];if(!_0x4d12e3[_0xff16('0x30')][_0xff16('0x36')](_0xff16('0x37'))){_0x3c66f8[_0xff16('0x1b')]=qs[_0xff16('0x1b')](_0x4d12e3['query']['limit']);_0x3c66f8[_0xff16('0x1d')]=qs['offset'](_0x4d12e3[_0xff16('0x30')]['offset']);}return _0x3a86b2['getActions'](_0x3c66f8);}})['then'](function(_0xec9c5b){if(_0xec9c5b){return _0xec9c5b?{'count':_0x3482e9,'rows':_0xec9c5b}:null;}})['then'](respondWithResult(_0x4b9c69,null))[_0xff16('0x40')](handleError(_0x4b9c69,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 0d81a8a..0ca6ebc 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 _0x40d8=['util','api','moment','bluebird','request-promise','path','rimraf','exports','Automation','tools_automations'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x40d8,0xfa));var _0x840d=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x40d8[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x840d('0x0'));var logger=require('../../config/logger')(_0x840d('0x1'));var moment=require(_0x840d('0x2'));var BPromise=require(_0x840d('0x3'));var rp=require(_0x840d('0x4'));var fs=require('fs');var path=require(_0x840d('0x5'));var rimraf=require(_0x840d('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x840d('0x7')]=function(_0x315c45,_0x5aca20){return _0x315c45['define'](_0x840d('0x8'),attributes,{'tableName':_0x840d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1959=['api','moment','request-promise','path','rimraf','./automation.attributes','define','Automation','tools_automations','lodash'];(function(_0x153da6,_0xc9bfde){var _0xf01a0d=function(_0x409ed5){while(--_0x409ed5){_0x153da6['push'](_0x153da6['shift']());}};_0xf01a0d(++_0xc9bfde);}(_0x1959,0x117));var _0x9195=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x1959[_0x207d2f];return _0x3c3498;};'use strict';var _=require(_0x9195('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9195('0x1'));var moment=require(_0x9195('0x2'));var BPromise=require('bluebird');var rp=require(_0x9195('0x3'));var fs=require('fs');var path=require(_0x9195('0x4'));var rimraf=require(_0x9195('0x5'));var config=require('../../config/environment');var attributes=require(_0x9195('0x6'));module['exports']=function(_0x315e86,_0x1d0766){return _0x315e86[_0x9195('0x7')](_0x9195('0x8'),attributes,{'tableName':_0x9195('0x9'),'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 c7bc70f..3720c33 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 _0x75ea=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x75ea,0x7d));var _0xa75e=function(_0x3032d4,_0x47c76b){_0x3032d4=_0x3032d4-0x0;var _0x265082=_0x75ea[_0x3032d4];return _0x265082;};'use strict';var _=require(_0xa75e('0x0'));var util=require(_0xa75e('0x1'));var moment=require('moment');var BPromise=require(_0xa75e('0x2'));var rs=require(_0xa75e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa75e('0x4'))['db'];var utils=require(_0xa75e('0x5'));var logger=require(_0xa75e('0x6'))(_0xa75e('0x7'));var config=require(_0xa75e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa75e('0x9')][_0xa75e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f666f,_0x2c71ef,_0x148a23){return new BPromise(function(_0x31a28d,_0x351164){return client['request'](_0x1f666f,_0x148a23)['then'](function(_0x560baa){logger['info'](_0xa75e('0xb'),_0x2c71ef,'request\x20sent');logger[_0xa75e('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x2c71ef,_0xa75e('0xd'),JSON[_0xa75e('0xe')](_0x560baa));if(_0x560baa['error']){if(_0x560baa[_0xa75e('0xf')][_0xa75e('0x10')]===0x1f4){logger[_0xa75e('0xf')](_0xa75e('0xb'),_0x2c71ef,_0x560baa[_0xa75e('0xf')][_0xa75e('0x11')]);return _0x351164(_0x560baa[_0xa75e('0xf')][_0xa75e('0x11')]);}logger[_0xa75e('0xf')]('Automation,\x20%s,\x20%s',_0x2c71ef,_0x560baa[_0xa75e('0xf')]['message']);return _0x31a28d(_0x560baa[_0xa75e('0xf')][_0xa75e('0x11')]);}else{logger['info'](_0xa75e('0xb'),_0x2c71ef,_0xa75e('0xd'));_0x31a28d(_0x560baa[_0xa75e('0x12')]['message']);}})[_0xa75e('0x13')](function(_0x315fde){logger[_0xa75e('0xf')](_0xa75e('0xb'),_0x2c71ef,_0x315fde);_0x351164(_0x315fde);});});} \ No newline at end of file +var _0x2deb=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var moment=require(_0xb2de('0x2'));var BPromise=require(_0xb2de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2de('0x4'))['db'];var utils=require(_0xb2de('0x5'));var logger=require(_0xb2de('0x6'))(_0xb2de('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2de('0x8')][_0xb2de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191004,_0x49307b,_0x253d0b){return new BPromise(function(_0x1a4c44,_0x53ab0e){return client[_0xb2de('0xa')](_0x191004,_0x253d0b)[_0xb2de('0xb')](function(_0x1d40ec){logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));logger[_0xb2de('0xe')](_0xb2de('0xf'),_0x49307b,'request\x20sent',JSON['stringify'](_0x1d40ec));if(_0x1d40ec[_0xb2de('0x10')]){if(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x11')]===0x1f4){logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);return _0x53ab0e(_0x1d40ec['error'][_0xb2de('0x12')]);}logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec['error'][_0xb2de('0x12')]);return _0x1a4c44(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);}else{logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));_0x1a4c44(_0x1d40ec[_0xb2de('0x13')][_0xb2de('0x12')]);}})[_0xb2de('0x14')](function(_0x2dc15c){logger[_0xb2de('0x10')](_0xb2de('0xc'),_0x49307b,_0x2dc15c);_0x53ab0e(_0x2dc15c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 866eef6..f8c37ab 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 _0x56e6=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put'];(function(_0x3f84c6,_0x10a71a){var _0x563d5a=function(_0xa7ec79){while(--_0xa7ec79){_0x3f84c6['push'](_0x3f84c6['shift']());}};_0x563d5a(++_0x10a71a);}(_0x56e6,0x6b));var _0x656e=function(_0x322483,_0x197b0d){_0x322483=_0x322483-0x0;var _0x2cbb58=_0x56e6[_0x322483];return _0x2cbb58;};'use strict';var multer=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var path=require(_0x656e('0x2'));var timeout=require(_0x656e('0x3'));var express=require(_0x656e('0x4'));var router=express[_0x656e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x656e('0x6'));var interaction=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var controller=require(_0x656e('0x9'));router[_0x656e('0xa')]('/',auth[_0x656e('0xb')](),controller[_0x656e('0xc')]);router['get'](_0x656e('0xd'),auth[_0x656e('0xb')](),controller[_0x656e('0xe')]);router[_0x656e('0xa')](_0x656e('0xf'),auth[_0x656e('0xb')](),controller[_0x656e('0x10')]);router[_0x656e('0xa')](_0x656e('0x11'),auth[_0x656e('0xb')](),controller[_0x656e('0x12')]);router[_0x656e('0x13')]('/',auth[_0x656e('0xb')](),controller[_0x656e('0x14')]);router['post']('/:id/conditions',auth[_0x656e('0xb')](),controller[_0x656e('0x15')]);router[_0x656e('0x13')](_0x656e('0x11'),auth['isAuthenticated'](),controller['addActions']);router[_0x656e('0x16')](_0x656e('0xd'),auth['isAuthenticated'](),controller[_0x656e('0x17')]);router['delete'](_0x656e('0xd'),auth[_0x656e('0xb')](),controller[_0x656e('0x18')]);module[_0x656e('0x19')]=router; \ No newline at end of file +var _0x8ebc=['get','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','/:id','show'];(function(_0x1c0f3d,_0x55a9e2){var _0x4d71a8=function(_0xeff131){while(--_0xeff131){_0x1c0f3d['push'](_0x1c0f3d['shift']());}};_0x4d71a8(++_0x55a9e2);}(_0x8ebc,0x18c));var _0xc8eb=function(_0x3ad00a,_0x11b46a){_0x3ad00a=_0x3ad00a-0x0;var _0x582dcc=_0x8ebc[_0x3ad00a];return _0x582dcc;};'use strict';var multer=require(_0xc8eb('0x0'));var util=require('util');var path=require(_0xc8eb('0x1'));var timeout=require(_0xc8eb('0x2'));var express=require('express');var router=express[_0xc8eb('0x3')]();var fs_extra=require(_0xc8eb('0x4'));var auth=require(_0xc8eb('0x5'));var interaction=require(_0xc8eb('0x6'));var config=require('../../config/environment');var controller=require(_0xc8eb('0x7'));router['get']('/',auth[_0xc8eb('0x8')](),controller[_0xc8eb('0x9')]);router['get'](_0xc8eb('0xa'),auth[_0xc8eb('0x8')](),controller[_0xc8eb('0xb')]);router[_0xc8eb('0xc')](_0xc8eb('0xd'),auth['isAuthenticated'](),controller[_0xc8eb('0xe')]);router[_0xc8eb('0xc')](_0xc8eb('0xf'),auth[_0xc8eb('0x8')](),controller[_0xc8eb('0x10')]);router['post']('/',auth[_0xc8eb('0x8')](),controller['create']);router[_0xc8eb('0x11')]('/:id/conditions',auth[_0xc8eb('0x8')](),controller[_0xc8eb('0x12')]);router[_0xc8eb('0x11')](_0xc8eb('0xf'),auth[_0xc8eb('0x8')](),controller[_0xc8eb('0x13')]);router[_0xc8eb('0x14')](_0xc8eb('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc8eb('0x15')](_0xc8eb('0xa'),auth[_0xc8eb('0x8')](),controller[_0xc8eb('0x16')]);module[_0xc8eb('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3de03dc..e034fe6 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 _0x0711=['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\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\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','INTEGER'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x0711,0x161));var _0x1071=function(_0x5f14ed,_0x5dda39){_0x5f14ed=_0x5f14ed-0x0;var _0x3c46fc=_0x0711[_0x5f14ed];return _0x3c46fc;};'use strict';var Sequelize=require(_0x1071('0x0'));module[_0x1071('0x1')]={'name':{'type':Sequelize[_0x1071('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1071('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x1071('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1071('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1071('0x6')](0x4)[_0x1071('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1071('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1071('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1071('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1071('0x6')](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'defaultValue':0x3,'comment':_0x1071('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1071('0x6')](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1071('0xe')},'dialTimezone':{'type':Sequelize[_0x1071('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1071('0x2')],'defaultValue':_0x1071('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x1071('0x3')](_0x1071('0x10'),_0x1071('0x11'),_0x1071('0x12')),'defaultValue':_0x1071('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1071('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1071('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1071('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1071('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1071('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1071('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1071('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1071('0x6')](0x9)[_0x1071('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1071('0x6')](0x9)[_0x1071('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1071('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1071('0x6')](0x9)[_0x1071('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1071('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1071('0x6')](0x9)[_0x1071('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1071('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1071('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1071('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1071('0x6')](0x9)[_0x1071('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x1071('0x1b')),'defaultValue':_0x1071('0x1c')},'dialPrefix':{'type':Sequelize[_0x1071('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1071('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1071('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1071('0x6')](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1071('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1071('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x1071('0x6')](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1071('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1071('0x6')](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1071('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1071('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1071('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1071('0x6')](0x3)[_0x1071('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1071('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1071('0x6')](0x5)[_0x1071('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1071('0x27')}}; \ No newline at end of file +var _0x3525=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','DESC','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)','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)'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3525,0x16a));var _0x5352=function(_0x1a769d,_0x4909b2){_0x1a769d=_0x1a769d-0x0;var _0x351500=_0x3525[_0x1a769d];return _0x351500;};'use strict';var Sequelize=require(_0x5352('0x0'));module[_0x5352('0x1')]={'name':{'type':Sequelize[_0x5352('0x2')],'unique':_0x5352('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5352('0x4')](_0x5352('0x5')),'allowNull':![],'defaultValue':_0x5352('0x5')},'description':{'type':Sequelize[_0x5352('0x2')]},'active':{'type':Sequelize[_0x5352('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x5352('0x7')](0x4)[_0x5352('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5352('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5352('0x7')](0x3)[_0x5352('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5352('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5352('0x7')](0x3)[_0x5352('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5352('0x7')](0x5)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5352('0x7')](0x3)[_0x5352('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5352('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5352('0x7')](0x5)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5352('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5352('0x7')](0x5)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5352('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5352('0x7')](0x3)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5352('0xe')},'dialTimezone':{'type':Sequelize[_0x5352('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5352('0x2')],'defaultValue':_0x5352('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x5352('0x10'),'onlyIfOpen'),'defaultValue':_0x5352('0x11')},'dialAMDActive':{'type':Sequelize[_0x5352('0x6')],'defaultValue':0x0,'comment':_0x5352('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x5352('0x7')](0x9)[_0x5352('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5352('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x5352('0x7')](0x9)[_0x5352('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5352('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5352('0x7')](0x9)[_0x5352('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5352('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5352('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x5352('0x7')](0x9)[_0x5352('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5352('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5352('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5352('0x7')](0x9)[_0x5352('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5352('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5352('0x7')](0x5)[_0x5352('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5352('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5352('0x4')](_0x5352('0x18'),'ASC'),'defaultValue':_0x5352('0x18')},'dialPrefix':{'type':Sequelize[_0x5352('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x5352('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5352('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5352('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5352('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5352('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5352('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x5352('0x7')](0x3)[_0x5352('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5352('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x5352('0x7')](0x5)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5352('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5352('0x7')](0x3)[_0x5352('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5352('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5352('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x5352('0x7')](0x3)[_0x5352('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5352('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5352('0x7')](0x5)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5352('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5352('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5352('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5352('0x7')](0x5)[_0x5352('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5352('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a0ac17f..ad27b06 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 _0x112f=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','keys','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','IvrCampaigns','userProfileId','getHoppers','findOne','CmHopper','order','pick','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','cm_contacts','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4da600,_0x3862a4){var _0x2a492a=function(_0x14604e){while(--_0x14604e){_0x4da600['push'](_0x4da600['shift']());}};_0x2a492a(++_0x3862a4);}(_0x112f,0x11e));var _0xf112=function(_0x406134,_0x41e277){_0x406134=_0x406134-0x0;var _0x36bd34=_0x112f[_0x406134];return _0x36bd34;};'use strict';var emlformat=require(_0xf112('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf112('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf112('0x2'));var moment=require(_0xf112('0x3'));var BPromise=require(_0xf112('0x4'));var Mustache=require(_0xf112('0x5'));var util=require('util');var path=require(_0xf112('0x6'));var sox=require('sox');var csv=require(_0xf112('0x7'));var ejs=require(_0xf112('0x8'));var fs=require('fs');var fs_extra=require(_0xf112('0x9'));var _=require(_0xf112('0xa'));var squel=require(_0xf112('0xb'));var crypto=require(_0xf112('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf112('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf112('0xe'));var Papa=require(_0xf112('0xf'));var Redis=require(_0xf112('0x10'));var authService=require(_0xf112('0x11'));var qs=require(_0xf112('0x12'));var as=require(_0xf112('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf112('0x14'));var config=require(_0xf112('0x15'));var licenseUtil=require(_0xf112('0x16'));var db=require(_0xf112('0x17'))['db'];function respondWithStatusCode(_0x350f60,_0x330f6c){_0x330f6c=_0x330f6c||0xcc;return function(_0x401344){if(_0x401344){return _0x350f60[_0xf112('0x18')](_0x330f6c);}return _0x350f60[_0xf112('0x19')](_0x330f6c)['end']();};}function respondWithResult(_0x1381f4,_0x5c32f2){_0x5c32f2=_0x5c32f2||0xc8;return function(_0x568a07){if(_0x568a07){return _0x1381f4['status'](_0x5c32f2)[_0xf112('0x1a')](_0x568a07);}};}function respondWithFilteredResult(_0x5111e9,_0xb7fc78){return function(_0x1dabb1){if(_0x1dabb1){var _0x3e5780=typeof _0xb7fc78[_0xf112('0x1b')]===_0xf112('0x1c')&&typeof _0xb7fc78['limit']===_0xf112('0x1c');var _0xae0e54=_0x1dabb1['count'];var _0x16d575=_0x3e5780?0x0:_0xb7fc78[_0xf112('0x1b')];var _0x23872c=_0x3e5780?_0x1dabb1['count']:_0xb7fc78[_0xf112('0x1b')]+_0xb7fc78[_0xf112('0x1d')];var _0x46a02c;if(_0x23872c>=_0xae0e54){_0x23872c=_0xae0e54;_0x46a02c=0xc8;}else{_0x46a02c=0xce;}_0x5111e9[_0xf112('0x19')](_0x46a02c);return _0x5111e9[_0xf112('0x1e')](_0xf112('0x1f'),_0x16d575+'-'+_0x23872c+'/'+_0xae0e54)[_0xf112('0x1a')](_0x1dabb1);}return null;};}function patchUpdates(_0x13cc44){return function(_0x2d3a1b){try{jsonpatch[_0xf112('0x20')](_0x2d3a1b,_0x13cc44,!![]);}catch(_0x240bd4){return BPromise['reject'](_0x240bd4);}return _0x2d3a1b[_0xf112('0x21')]();};}function saveUpdates(_0x5e9599,_0xaed84c){return function(_0x8e7b25){if(_0x8e7b25){return _0x8e7b25[_0xf112('0x22')](_0x5e9599)[_0xf112('0x23')](function(_0x390f4d){return _0x390f4d;});}return null;};}function removeEntity(_0x29b6fb,_0x3f9604){return function(_0x1163b6){if(_0x1163b6){return _0x1163b6[_0xf112('0x24')]()[_0xf112('0x23')](function(){var _0x27a894=_0x1163b6[_0xf112('0x25')]({'plain':!![]});var _0x48a5c9='IvrCampaigns';return db[_0xf112('0x26')][_0xf112('0x24')]({'where':{'type':_0x48a5c9,'resourceId':_0x27a894['id']}})['then'](function(){return _0x1163b6;});})[_0xf112('0x23')](function(){_0x29b6fb[_0xf112('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34ef2f,_0x5227f3){return function(_0x48adaa){if(!_0x48adaa){_0x34ef2f[_0xf112('0x18')](0x194);}return _0x48adaa;};}function handleError(_0x1967df,_0x49e07e){_0x49e07e=_0x49e07e||0x1f4;return function(_0x50ca78){logger[_0xf112('0x27')](_0x50ca78[_0xf112('0x28')]);if(_0x50ca78[_0xf112('0x29')]){delete _0x50ca78[_0xf112('0x29')];}_0x1967df[_0xf112('0x19')](_0x49e07e)[_0xf112('0x2a')](_0x50ca78);};}exports[_0xf112('0x2b')]=function(_0x4fd46a,_0x55db9d){var _0x40b519={},_0x32f538={},_0x54d0e6={'count':0x0,'rows':[]};var _0x27d49d=_['map'](db[_0xf112('0x2c')][_0xf112('0x2d')],function(_0x521072){return{'name':_0x521072[_0xf112('0x2e')],'type':_0x521072[_0xf112('0x2f')][_0xf112('0x30')]};});_0x32f538['model']=_[_0xf112('0x31')](_0x27d49d,_0xf112('0x29'));_0x32f538[_0xf112('0x32')]=_['keys'](_0x4fd46a[_0xf112('0x32')]);_0x32f538['filters']=_[_0xf112('0x33')](_0x32f538[_0xf112('0x34')],_0x32f538[_0xf112('0x32')]);_0x40b519['attributes']=_[_0xf112('0x33')](_0x32f538[_0xf112('0x34')],qs['fields'](_0x4fd46a['query'][_0xf112('0x35')]));_0x40b519[_0xf112('0x36')]=_0x40b519[_0xf112('0x36')][_0xf112('0x37')]?_0x40b519[_0xf112('0x36')]:_0x32f538[_0xf112('0x34')];if(!_0x4fd46a[_0xf112('0x32')][_0xf112('0x38')](_0xf112('0x39'))){_0x40b519[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x4fd46a[_0xf112('0x32')]['limit']);_0x40b519[_0xf112('0x1b')]=qs[_0xf112('0x1b')](_0x4fd46a[_0xf112('0x32')][_0xf112('0x1b')]);}_0x40b519['order']=qs[_0xf112('0x3a')](_0x4fd46a[_0xf112('0x32')][_0xf112('0x3a')]);_0x40b519[_0xf112('0x3b')]=qs[_0xf112('0x3c')](_['pick'](_0x4fd46a[_0xf112('0x32')],_0x32f538['filters']),_0x27d49d);if(_0x4fd46a['query'][_0xf112('0x3d')]){_0x40b519[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x40b519[_0xf112('0x3b')],{'$or':_['map'](_0x27d49d,function(_0x272d8e){if(_0x272d8e['type']!==_0xf112('0x3f')){var _0x30214f={};_0x30214f[_0x272d8e['name']]={'$like':'%'+_0x4fd46a[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x30214f;}})});}_0x40b519=_[_0xf112('0x3e')]({},_0x40b519,_0x4fd46a[_0xf112('0x40')]);var _0x4ba85d={'where':_0x40b519[_0xf112('0x3b')]};return db[_0xf112('0x2c')]['count'](_0x4ba85d)[_0xf112('0x23')](function(_0x685a5a){_0x54d0e6[_0xf112('0x41')]=_0x685a5a;if(_0x4fd46a['query'][_0xf112('0x42')]){_0x40b519[_0xf112('0x43')]=[{'all':!![]}];}return db[_0xf112('0x2c')][_0xf112('0x44')](_0x40b519);})[_0xf112('0x23')](function(_0x1c0f45){_0x54d0e6[_0xf112('0x45')]=_0x1c0f45;return _0x54d0e6;})[_0xf112('0x23')](respondWithFilteredResult(_0x55db9d,_0x40b519))['catch'](handleError(_0x55db9d,null));};exports[_0xf112('0x46')]=function(_0x27d074,_0x5b62ce){var _0x81ae92={'raw':![],'where':{'id':_0x27d074['params']['id']}},_0x1f380d={};_0x1f380d[_0xf112('0x34')]=_[_0xf112('0x47')](db['Campaign'][_0xf112('0x2d')]);_0x1f380d[_0xf112('0x32')]=_[_0xf112('0x47')](_0x27d074[_0xf112('0x32')]);_0x1f380d[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x1f380d[_0xf112('0x34')],_0x1f380d[_0xf112('0x32')]);_0x81ae92['attributes']=_['intersection'](_0x1f380d[_0xf112('0x34')],qs[_0xf112('0x35')](_0x27d074[_0xf112('0x32')][_0xf112('0x35')]));_0x81ae92[_0xf112('0x36')]=_0x81ae92[_0xf112('0x36')][_0xf112('0x37')]?_0x81ae92[_0xf112('0x36')]:_0x1f380d[_0xf112('0x34')];if(_0x27d074[_0xf112('0x32')][_0xf112('0x42')]){_0x81ae92[_0xf112('0x43')]=[{'all':!![]}];}_0x81ae92=_[_0xf112('0x3e')]({},_0x81ae92,_0x27d074[_0xf112('0x40')]);return db[_0xf112('0x2c')][_0xf112('0x48')](_0x81ae92)[_0xf112('0x23')](handleEntityNotFound(_0x5b62ce,null))['then'](respondWithResult(_0x5b62ce,null))[_0xf112('0x49')](handleError(_0x5b62ce,null));};exports[_0xf112('0x4a')]=function(_0x34c66d,_0x51a6c4){return db[_0xf112('0x2c')][_0xf112('0x4a')](_0x34c66d['body'],{})['then'](function(_0x58de11){var _0x5c8bf3=_0x34c66d['user'][_0xf112('0x25')]({'plain':!![]});if(!_0x5c8bf3)throw new Error(_0xf112('0x4b'));if(_0x5c8bf3[_0xf112('0x4c')]===_0xf112('0x4d')){var _0x5de006=_0x58de11[_0xf112('0x25')]({'plain':!![]});var _0x321469='IvrCampaigns';return db[_0xf112('0x4e')][_0xf112('0x48')]({'where':{'name':_0x321469,'userProfileId':_0x5c8bf3['userProfileId']},'raw':!![]})[_0xf112('0x23')](function(_0x5797f8){if(_0x5797f8&&_0x5797f8[_0xf112('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x5de006[_0xf112('0x29')],'resourceId':_0x5de006['id'],'type':_0x5797f8[_0xf112('0x29')],'sectionId':_0x5797f8['id']},{})[_0xf112('0x23')](function(){return _0x58de11;});}else{return _0x58de11;}})[_0xf112('0x49')](function(_0x2b4021){logger[_0xf112('0x27')](_0xf112('0x50'),_0x2b4021);throw _0x2b4021;});}return _0x58de11;})[_0xf112('0x23')](respondWithResult(_0x51a6c4,0xc9))[_0xf112('0x49')](handleError(_0x51a6c4,null));};exports[_0xf112('0x51')]=function(_0x411fa8,_0x4ab934){var _0x47e28b={'where':{'id':_0x411fa8[_0xf112('0x52')]['id']}},_0x1d8d0a={};_0x1d8d0a[_0xf112('0x34')]=_[_0xf112('0x47')](db[_0xf112('0x2c')]['rawAttributes']);_0x47e28b['attributes']=_['intersection'](_0x1d8d0a[_0xf112('0x34')],qs[_0xf112('0x35')](_0x411fa8[_0xf112('0x32')][_0xf112('0x35')]));_0x47e28b[_0xf112('0x36')]=_0x47e28b[_0xf112('0x36')]['length']?_0x47e28b[_0xf112('0x36')]:_0x1d8d0a['model'];if(_0x411fa8[_0xf112('0x32')][_0xf112('0x42')]){_0x47e28b[_0xf112('0x43')]=[{'all':!![]}];}_0x47e28b=_[_0xf112('0x3e')]({},_0x47e28b,_0x411fa8['options']);return db[_0xf112('0x2c')]['find'](_0x47e28b)[_0xf112('0x23')](handleEntityNotFound(_0x4ab934,null))[_0xf112('0x23')](function(_0x3859b7){if(_0x3859b7){var _0x475e05=_0x3859b7[_0xf112('0x25')]({'plain':!![]});_0x475e05=qs[_0xf112('0x53')](_0x475e05,['id',_0xf112('0x54'),_0xf112('0x55')]);_0x411fa8[_0xf112('0x56')]=_[_0xf112('0x53')](_0x411fa8[_0xf112('0x56')],['id',_0xf112('0x54'),_0xf112('0x55')]);return db[_0xf112('0x2c')][_0xf112('0x4a')](_[_0xf112('0x3e')](_0x475e05,_0x411fa8[_0xf112('0x56')]),{'include':_0x411fa8['query'][_0xf112('0x42')]?[{'all':!![]}]:undefined})[_0xf112('0x23')](function(_0x3d084a){var _0x242c32=_0x411fa8[_0xf112('0x4d')]['get']({'plain':!![]});if(!_0x242c32)throw new Error(_0xf112('0x4b'));if(_0x242c32[_0xf112('0x4c')]==='user'){var _0x436027=_0x3d084a['get']({'plain':!![]});var _0x483efb=_0xf112('0x57');return db[_0xf112('0x4e')]['find']({'where':{'name':_0x483efb,'userProfileId':_0x242c32[_0xf112('0x58')]},'raw':!![]})[_0xf112('0x23')](function(_0x4e2fcc){if(_0x4e2fcc&&_0x4e2fcc[_0xf112('0x4f')]===0x0){return db['UserProfileResource'][_0xf112('0x4a')]({'name':_0x436027[_0xf112('0x29')],'resourceId':_0x436027['id'],'type':_0x4e2fcc[_0xf112('0x29')],'sectionId':_0x4e2fcc['id']},{})[_0xf112('0x23')](function(){return _0x3d084a;});}else{return _0x3d084a;}})['catch'](function(_0x4aa8f2){logger[_0xf112('0x27')](_0xf112('0x50'),_0x4aa8f2);throw _0x4aa8f2;});}return _0x3d084a;});}})[_0xf112('0x23')](respondWithResult(_0x4ab934,0xc9))[_0xf112('0x49')](handleError(_0x4ab934,null));};exports[_0xf112('0x22')]=function(_0x5e5718,_0xfbd3a4){if(_0x5e5718[_0xf112('0x56')]['id']){delete _0x5e5718['body']['id'];}return db['Campaign'][_0xf112('0x48')]({'where':{'id':_0x5e5718[_0xf112('0x52')]['id']}})['then'](handleEntityNotFound(_0xfbd3a4,null))[_0xf112('0x23')](saveUpdates(_0x5e5718[_0xf112('0x56')],null))[_0xf112('0x23')](respondWithResult(_0xfbd3a4,null))['catch'](handleError(_0xfbd3a4,null));};exports[_0xf112('0x24')]=function(_0x23a966,_0x5a57f8){return db[_0xf112('0x2c')][_0xf112('0x48')]({'where':{'id':_0x23a966[_0xf112('0x52')]['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x5a57f8,null))[_0xf112('0x23')](removeEntity(_0x5a57f8,null))[_0xf112('0x49')](handleError(_0x5a57f8,null));};exports[_0xf112('0x59')]=function(_0x2cea82,_0x803707,_0x3b5ddb){var _0x2f8876={'raw':!![],'where':{}};var _0x4f898f={};var _0x4c1b1b={'count':0x0,'rows':[]};return db[_0xf112('0x2c')][_0xf112('0x5a')]({'where':{'id':_0x2cea82['params']['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x803707,null))[_0xf112('0x23')](function(_0xc88a05){if(_0xc88a05){_0x4f898f[_0xf112('0x34')]=_[_0xf112('0x47')](db[_0xf112('0x5b')][_0xf112('0x2d')]);_0x4f898f[_0xf112('0x32')]=_[_0xf112('0x47')](_0x2cea82[_0xf112('0x32')]);_0x4f898f[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x4f898f[_0xf112('0x34')],_0x4f898f[_0xf112('0x32')]);_0x2f8876['attributes']=_[_0xf112('0x33')](_0x4f898f[_0xf112('0x34')],qs[_0xf112('0x35')](_0x2cea82[_0xf112('0x32')]['fields']));_0x2f8876[_0xf112('0x36')]=_0x2f8876['attributes'][_0xf112('0x37')]?_0x2f8876[_0xf112('0x36')]:_0x4f898f[_0xf112('0x34')];if(!_0x2cea82[_0xf112('0x32')][_0xf112('0x38')]('nolimit')){_0x2f8876[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x2cea82[_0xf112('0x32')][_0xf112('0x1d')]);_0x2f8876['offset']=qs['offset'](_0x2cea82[_0xf112('0x32')]['offset']);}_0x2f8876[_0xf112('0x5c')]=qs['sort'](_0x2cea82['query']['sort']);_0x2f8876[_0xf112('0x3b')]=qs[_0xf112('0x3c')](_[_0xf112('0x5d')](_0x2cea82[_0xf112('0x32')],_0x4f898f[_0xf112('0x3c')]));_0x2f8876[_0xf112('0x3b')][_0xf112('0x5e')]=_0xc88a05['id'];if(_0x2cea82['query'][_0xf112('0x3d')]){_0x2f8876[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x2f8876[_0xf112('0x3b')],{'$or':_[_0xf112('0x31')](_0x2f8876[_0xf112('0x36')],function(_0x234736){var _0x1814fa={};_0x1814fa[_0x234736]={'$like':'%'+_0x2cea82[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x1814fa;})});}_0x2f8876=_[_0xf112('0x3e')]({},_0x2f8876,_0x2cea82[_0xf112('0x40')]);return db[_0xf112('0x5b')]['count']({'where':_0x2f8876[_0xf112('0x3b')]})['then'](function(_0x4c8fd7){_0x4c1b1b['count']=_0x4c8fd7;if(_0x2cea82[_0xf112('0x32')][_0xf112('0x42')]){_0x2f8876[_0xf112('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0xf112('0x44')](_0x2f8876);})['then'](function(_0xfe6508){_0x4c1b1b[_0xf112('0x45')]=_0xfe6508;return _0x4c1b1b;});}})[_0xf112('0x23')](respondWithFilteredResult(_0x803707,_0x2f8876))[_0xf112('0x49')](handleError(_0x803707,null));};exports[_0xf112('0x5f')]=function(_0x279e63,_0x19995b,_0x50ed7c){var _0x1a9776={'raw':!![],'where':{}};var _0x51bbfa={};var _0x11173c={'count':0x0,'rows':[]};return db[_0xf112('0x2c')][_0xf112('0x5a')]({'where':{'id':_0x279e63['params']['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x19995b,null))['then'](function(_0x370a49){if(_0x370a49){_0x51bbfa[_0xf112('0x34')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x51bbfa[_0xf112('0x32')]=_[_0xf112('0x47')](_0x279e63[_0xf112('0x32')]);_0x51bbfa[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x51bbfa['model'],_0x51bbfa['query']);_0x1a9776['attributes']=_[_0xf112('0x33')](_0x51bbfa[_0xf112('0x34')],qs['fields'](_0x279e63[_0xf112('0x32')][_0xf112('0x35')]));_0x1a9776[_0xf112('0x36')]=_0x1a9776[_0xf112('0x36')][_0xf112('0x37')]?_0x1a9776[_0xf112('0x36')]:_0x51bbfa[_0xf112('0x34')];if(!_0x279e63['query'][_0xf112('0x38')]('nolimit')){_0x1a9776[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x279e63[_0xf112('0x32')][_0xf112('0x1d')]);_0x1a9776[_0xf112('0x1b')]=qs[_0xf112('0x1b')](_0x279e63['query'][_0xf112('0x1b')]);}_0x1a9776['order']=qs[_0xf112('0x3a')](_0x279e63['query'][_0xf112('0x3a')]);_0x1a9776['where']=qs['filters'](_[_0xf112('0x5d')](_0x279e63[_0xf112('0x32')],_0x51bbfa[_0xf112('0x3c')]));_0x1a9776[_0xf112('0x3b')][_0xf112('0x5e')]=_0x370a49['id'];if(_0x279e63[_0xf112('0x32')][_0xf112('0x3d')]){_0x1a9776[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x1a9776[_0xf112('0x3b')],{'$or':_['map'](_0x1a9776['attributes'],function(_0x3c52f3){var _0x25600c={};_0x25600c[_0x3c52f3]={'$like':'%'+_0x279e63[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x25600c;})});}_0x1a9776=_[_0xf112('0x3e')]({},_0x1a9776,_0x279e63[_0xf112('0x40')]);return db[_0xf112('0x60')]['count']({'where':_0x1a9776[_0xf112('0x3b')]})['then'](function(_0x1e56d6){_0x11173c[_0xf112('0x41')]=_0x1e56d6;if(_0x279e63[_0xf112('0x32')]['includeAll']){_0x1a9776[_0xf112('0x43')]=[{'all':!![]}];}return db[_0xf112('0x60')]['findAll'](_0x1a9776);})[_0xf112('0x23')](function(_0x3d7853){_0x11173c[_0xf112('0x45')]=_0x3d7853;return _0x11173c;});}})['then'](respondWithFilteredResult(_0x19995b,_0x1a9776))[_0xf112('0x49')](handleError(_0x19995b,null));};exports['getHopperFinals']=function(_0x42d7c5,_0x154a47,_0x38d22d){var _0x3f888a={'raw':!![],'where':{}};var _0x301bb4={};var _0x4ffb5b={'count':0x0,'rows':[]};return db[_0xf112('0x2c')][_0xf112('0x5a')]({'where':{'id':_0x42d7c5[_0xf112('0x52')]['id']}})['then'](handleEntityNotFound(_0x154a47,null))[_0xf112('0x23')](function(_0x120815){if(_0x120815){_0x301bb4[_0xf112('0x34')]=_[_0xf112('0x47')](db[_0xf112('0x61')][_0xf112('0x2d')]);_0x301bb4[_0xf112('0x32')]=_['keys'](_0x42d7c5['query']);_0x301bb4[_0xf112('0x3c')]=_['intersection'](_0x301bb4[_0xf112('0x34')],_0x301bb4['query']);_0x3f888a[_0xf112('0x36')]=_[_0xf112('0x33')](_0x301bb4[_0xf112('0x34')],qs[_0xf112('0x35')](_0x42d7c5[_0xf112('0x32')][_0xf112('0x35')]));_0x3f888a[_0xf112('0x36')]=_0x3f888a['attributes'][_0xf112('0x37')]?_0x3f888a[_0xf112('0x36')]:_0x301bb4['model'];if(!_0x42d7c5[_0xf112('0x32')][_0xf112('0x38')]('nolimit')){_0x3f888a[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x42d7c5['query'][_0xf112('0x1d')]);_0x3f888a[_0xf112('0x1b')]=qs[_0xf112('0x1b')](_0x42d7c5['query'][_0xf112('0x1b')]);}_0x3f888a[_0xf112('0x5c')]=qs[_0xf112('0x3a')](_0x42d7c5[_0xf112('0x32')][_0xf112('0x3a')]);_0x3f888a['where']=qs[_0xf112('0x3c')](_[_0xf112('0x5d')](_0x42d7c5['query'],_0x301bb4[_0xf112('0x3c')]));_0x3f888a[_0xf112('0x3b')][_0xf112('0x5e')]=_0x120815['id'];if(_0x42d7c5[_0xf112('0x32')][_0xf112('0x3d')]){_0x3f888a[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x3f888a[_0xf112('0x3b')],{'$or':_[_0xf112('0x31')](_0x3f888a['attributes'],function(_0x2570f4){var _0x280c0c={};_0x280c0c[_0x2570f4]={'$like':'%'+_0x42d7c5[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x280c0c;})});}_0x3f888a=_[_0xf112('0x3e')]({},_0x3f888a,_0x42d7c5[_0xf112('0x40')]);return db[_0xf112('0x61')][_0xf112('0x41')]({'where':_0x3f888a[_0xf112('0x3b')]})[_0xf112('0x23')](function(_0x5d965b){_0x4ffb5b['count']=_0x5d965b;if(_0x42d7c5[_0xf112('0x32')][_0xf112('0x42')]){_0x3f888a[_0xf112('0x43')]=[{'all':!![]}];}return db[_0xf112('0x61')][_0xf112('0x44')](_0x3f888a);})[_0xf112('0x23')](function(_0x42b26d){_0x4ffb5b['rows']=_0x42b26d;return _0x4ffb5b;});}})[_0xf112('0x23')](respondWithFilteredResult(_0x154a47,_0x3f888a))[_0xf112('0x49')](handleError(_0x154a47,null));};exports[_0xf112('0x62')]=function(_0x385b46,_0x50f6d5,_0x2d45ec){var _0x5f3e6a={'raw':!![],'where':{}};var _0x25879e={};var _0x4cc484={'count':0x0,'rows':[]};return db[_0xf112('0x2c')][_0xf112('0x5a')]({'where':{'id':_0x385b46[_0xf112('0x52')]['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x50f6d5,null))[_0xf112('0x23')](function(_0x3e4da8){if(_0x3e4da8){_0x25879e[_0xf112('0x34')]=_[_0xf112('0x47')](db[_0xf112('0x63')][_0xf112('0x2d')]);_0x25879e[_0xf112('0x32')]=_['keys'](_0x385b46[_0xf112('0x32')]);_0x25879e[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x25879e[_0xf112('0x34')],_0x25879e[_0xf112('0x32')]);_0x5f3e6a['attributes']=_[_0xf112('0x33')](_0x25879e[_0xf112('0x34')],qs[_0xf112('0x35')](_0x385b46[_0xf112('0x32')][_0xf112('0x35')]));_0x5f3e6a[_0xf112('0x36')]=_0x5f3e6a['attributes']['length']?_0x5f3e6a['attributes']:_0x25879e['model'];if(!_0x385b46['query'][_0xf112('0x38')](_0xf112('0x39'))){_0x5f3e6a['limit']=qs['limit'](_0x385b46[_0xf112('0x32')]['limit']);_0x5f3e6a['offset']=qs[_0xf112('0x1b')](_0x385b46['query']['offset']);}_0x5f3e6a[_0xf112('0x5c')]=qs[_0xf112('0x3a')](_0x385b46[_0xf112('0x32')][_0xf112('0x3a')]);_0x5f3e6a[_0xf112('0x3b')]=qs['filters'](_['pick'](_0x385b46[_0xf112('0x32')],_0x25879e[_0xf112('0x3c')]));_0x5f3e6a['where']['CampaignId']=_0x3e4da8['id'];if(_0x385b46[_0xf112('0x32')][_0xf112('0x3d')]){_0x5f3e6a[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x5f3e6a[_0xf112('0x3b')],{'$or':_[_0xf112('0x31')](_0x5f3e6a['attributes'],function(_0x150658){var _0x1edbcc={};_0x1edbcc[_0x150658]={'$like':'%'+_0x385b46[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x1edbcc;})});}_0x5f3e6a=_[_0xf112('0x3e')]({},_0x5f3e6a,_0x385b46['options']);return db[_0xf112('0x63')][_0xf112('0x41')]({'where':_0x5f3e6a[_0xf112('0x3b')]})[_0xf112('0x23')](function(_0x5ccec5){_0x4cc484[_0xf112('0x41')]=_0x5ccec5;if(_0x385b46[_0xf112('0x32')][_0xf112('0x42')]){_0x5f3e6a[_0xf112('0x43')]=[{'all':!![]}];}return db[_0xf112('0x63')][_0xf112('0x44')](_0x5f3e6a);})[_0xf112('0x23')](function(_0x33fcb1){_0x4cc484['rows']=_0x33fcb1;return _0x4cc484;});}})[_0xf112('0x23')](respondWithFilteredResult(_0x50f6d5,_0x5f3e6a))[_0xf112('0x49')](handleError(_0x50f6d5,null));};exports['getLists']=function(_0x484294,_0x2f24be,_0x2a1892){var _0x509d8f={};var _0x42b9f0={};var _0x5e7385;var _0x6b2d2e;return db[_0xf112('0x2c')][_0xf112('0x5a')]({'where':{'id':_0x484294['params']['id']}})['then'](handleEntityNotFound(_0x2f24be,null))['then'](function(_0x6da927){if(_0x6da927){_0x5e7385=_0x6da927;_0x42b9f0[_0xf112('0x34')]=_[_0xf112('0x47')](db[_0xf112('0x64')]['rawAttributes']);_0x42b9f0['query']=_['keys'](_0x484294[_0xf112('0x32')]);_0x42b9f0[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x42b9f0['model'],_0x42b9f0[_0xf112('0x32')]);_0x509d8f['attributes']=_[_0xf112('0x33')](_0x42b9f0[_0xf112('0x34')],qs[_0xf112('0x35')](_0x484294[_0xf112('0x32')]['fields']));_0x509d8f[_0xf112('0x36')]=_0x509d8f[_0xf112('0x36')][_0xf112('0x37')]?_0x509d8f['attributes']:_0x42b9f0[_0xf112('0x34')];_0x509d8f[_0xf112('0x5c')]=qs[_0xf112('0x3a')](_0x484294[_0xf112('0x32')]['sort']);_0x509d8f[_0xf112('0x3b')]=qs[_0xf112('0x3c')](_[_0xf112('0x5d')](_0x484294[_0xf112('0x32')],_0x42b9f0[_0xf112('0x3c')]));if(_0x484294[_0xf112('0x32')][_0xf112('0x3d')]){_0x509d8f[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x509d8f[_0xf112('0x3b')],{'$or':_['map'](_0x509d8f[_0xf112('0x36')],function(_0xfe6a29){var _0x31a707={};_0x31a707[_0xfe6a29]={'$like':'%'+_0x484294[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x31a707;})});}_0x509d8f=_[_0xf112('0x3e')]({},_0x509d8f,_0x484294[_0xf112('0x40')]);return _0x5e7385[_0xf112('0x65')](_0x509d8f);}})[_0xf112('0x23')](function(_0x4ac26f){if(_0x4ac26f){_0x6b2d2e=_0x4ac26f[_0xf112('0x37')];if(!_0x484294[_0xf112('0x32')][_0xf112('0x38')]('nolimit')){_0x509d8f[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x484294[_0xf112('0x32')][_0xf112('0x1d')]);_0x509d8f[_0xf112('0x1b')]=qs[_0xf112('0x1b')](_0x484294[_0xf112('0x32')][_0xf112('0x1b')]);}return _0x5e7385[_0xf112('0x65')](_0x509d8f);}})[_0xf112('0x23')](function(_0x3040ac){if(_0x3040ac){return _0x3040ac?{'count':_0x6b2d2e,'rows':_0x3040ac}:null;}})[_0xf112('0x23')](respondWithResult(_0x2f24be,null))[_0xf112('0x49')](handleError(_0x2f24be,null));};exports[_0xf112('0x66')]=function(_0xd962e1,_0x557542,_0x1caf81){var _0x21e205,_0x577395;var _0x2140ec=[];var _0x143beb=moment()['format'](_0xf112('0x67'));return db[_0xf112('0x2c')][_0xf112('0x48')]({'where':{'id':_0xd962e1[_0xf112('0x52')]['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x557542,null))[_0xf112('0x23')](function(_0x26c454){if(_0x26c454){_0x577395=_0x26c454;return _0x26c454[_0xf112('0x66')](_0xd962e1[_0xf112('0x56')][_0xf112('0x68')],_[_0xf112('0x53')](_0xd962e1[_0xf112('0x56')],[_0xf112('0x68'),'id'])||{});}return null;})[_0xf112('0x69')](function(_0x31e071){var _0x436da7;var _0x57fa95;_0x21e205=_0x31e071||[];var _0x5bcc3b=[];if(_0x31e071){for(var _0x12f966=0x0;_0x12f966<_0x31e071['length'];_0x12f966+=0x1){var _0x467c89=_0x31e071[_0x12f966][_0xf112('0x25')]({'plain':!![]});_0x577395[_0xf112('0x6a')]=_0xd962e1[_0xf112('0x56')][_0xf112('0x6a')]?_0xd962e1[_0xf112('0x56')][_0xf112('0x6a')]:_0x577395[_0xf112('0x6a')];switch(_0x577395[_0xf112('0x6a')]){case _0xf112('0x6b'):_0x436da7=squel['insert']()[_0xf112('0x6c')](_0xf112('0x6d'))[_0xf112('0x6e')](['phone',_0xf112('0x6f'),_0xf112('0x70'),'ListId',_0xf112('0x5e'),'createdAt','updatedAt'],squel[_0xf112('0x71')]()[_0xf112('0x72')](_0xf112('0x73'),'phone')[_0xf112('0x72')](_0xf112('0x74'),_0xf112('0x6f'))['field']('id',_0xf112('0x70'))['field'](_0x467c89[_0xf112('0x75')][_0xf112('0x76')](),_0xf112('0x77'))[_0xf112('0x72')](_0xd962e1[_0xf112('0x52')]['id'][_0xf112('0x76')](),_0xf112('0x5e'))[_0xf112('0x72')]('\x27'+_0x143beb+'\x27',_0xf112('0x54'))[_0xf112('0x72')]('\x27'+_0x143beb+'\x27',_0xf112('0x55'))[_0xf112('0x78')]('cm_contacts')[_0xf112('0x3b')](_0xf112('0x79'))['where']('ListId\x20=\x20?',_0x467c89[_0xf112('0x75')][_0xf112('0x76')]())['where'](_0xf112('0x7a'))[_0xf112('0x3b')](_0xf112('0x7b'),squel[_0xf112('0x71')]()[_0xf112('0x72')](_0xf112('0x7c'))[_0xf112('0x78')]('cm_hopper_final')[_0xf112('0x3b')](_0xf112('0x7d'),_0xd962e1[_0xf112('0x52')]['id']['toString']()))[_0xf112('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf112('0x71')]()[_0xf112('0x72')]('COALESCE(phone,\x27\x27)')[_0xf112('0x78')](_0xf112('0x6d'))[_0xf112('0x3b')]('CampaignId\x20=\x20?',_0xd962e1[_0xf112('0x52')]['id']['toString']())))['toString']();break;case _0xf112('0x7e'):_0x436da7=squel[_0xf112('0x7f')]()[_0xf112('0x6c')](_0xf112('0x6d'))[_0xf112('0x6e')]([_0xf112('0x73'),_0xf112('0x6f'),_0xf112('0x70'),_0xf112('0x77'),_0xf112('0x5e'),_0xf112('0x54'),_0xf112('0x55')],squel[_0xf112('0x71')]()[_0xf112('0x72')]('phone','phone')[_0xf112('0x72')]('NOW()','scheduledAt')['field']('id',_0xf112('0x70'))[_0xf112('0x72')](_0x467c89[_0xf112('0x75')][_0xf112('0x76')](),_0xf112('0x77'))[_0xf112('0x72')](_0xd962e1['params']['id']['toString'](),_0xf112('0x5e'))[_0xf112('0x72')]('\x27'+_0x143beb+'\x27',_0xf112('0x54'))['field']('\x27'+_0x143beb+'\x27','updatedAt')[_0xf112('0x78')](_0xf112('0x80'))[_0xf112('0x3b')]('deletedAt\x20IS\x20NULL')[_0xf112('0x3b')](_0xf112('0x81'),_0x467c89[_0xf112('0x75')]['toString']())[_0xf112('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xf112('0x71')]()['field'](_0xf112('0x82'))[_0xf112('0x78')]('cm_hopper')[_0xf112('0x3b')](_0xf112('0x7d'),_0xd962e1[_0xf112('0x52')]['id'][_0xf112('0x76')]())))[_0xf112('0x76')]();break;default:_0x436da7=squel[_0xf112('0x7f')]()[_0xf112('0x6c')](_0xf112('0x6d'))[_0xf112('0x6e')]([_0xf112('0x73'),_0xf112('0x6f'),_0xf112('0x70'),_0xf112('0x77'),_0xf112('0x5e'),_0xf112('0x54'),_0xf112('0x55')],squel['select']()[_0xf112('0x72')](_0xf112('0x73'),_0xf112('0x73'))['field'](_0xf112('0x74'),'scheduledAt')[_0xf112('0x72')]('id','ContactId')[_0xf112('0x72')](_0x467c89[_0xf112('0x75')][_0xf112('0x76')](),_0xf112('0x77'))[_0xf112('0x72')](_0xd962e1[_0xf112('0x52')]['id']['toString'](),_0xf112('0x5e'))[_0xf112('0x72')]('\x27'+_0x143beb+'\x27','createdAt')[_0xf112('0x72')]('\x27'+_0x143beb+'\x27','updatedAt')[_0xf112('0x78')](_0xf112('0x80'))[_0xf112('0x3b')](_0xf112('0x79'))[_0xf112('0x3b')](_0xf112('0x81'),_0x467c89[_0xf112('0x75')][_0xf112('0x76')]())[_0xf112('0x3b')](_0xf112('0x7a')))['toString']();}_0x57fa95=squel[_0xf112('0x7f')]()['into']('cm_hopper_additional_phones')[_0xf112('0x6e')]([_0xf112('0x83'),_0xf112('0x6f'),'phone',_0xf112('0x84'),_0xf112('0x54'),_0xf112('0x55')],squel[_0xf112('0x71')]()['field'](_0xf112('0x85'),'id')['field'](_0xf112('0x74'),_0xf112('0x6f'))[_0xf112('0x72')](_0xf112('0x86'),'phone')['field'](_0xf112('0x87'),_0xf112('0x84'))[_0xf112('0x72')]('\x27'+_0x143beb+'\x27',_0xf112('0x54'))[_0xf112('0x72')]('\x27'+_0x143beb+'\x27',_0xf112('0x55'))[_0xf112('0x78')]('cm_contact_has_items','ci')[_0xf112('0x88')](_0xf112('0x6d'),'h',_0xf112('0x89'))[_0xf112('0x3b')](_0xf112('0x8a'),_0x467c89['CmListId']['toString']())[_0xf112('0x3b')](_0xf112('0x8b'),_0xd962e1[_0xf112('0x52')]['id']['toString']())[_0xf112('0x3b')](_0xf112('0x8c'),_0x143beb))['toString']();_0x5bcc3b[_0xf112('0x8d')](db[_0xf112('0x8e')][_0xf112('0x32')](_0x436da7));_0x2140ec[_0xf112('0x8d')](db[_0xf112('0x8e')][_0xf112('0x32')](_0x57fa95));}return BPromise[_0xf112('0x8f')](_0x5bcc3b);}})[_0xf112('0x23')](function(){return BPromise['all'](_0x2140ec);})[_0xf112('0x23')](function(){return _0x21e205;})[_0xf112('0x23')](respondWithResult(_0x557542,null))[_0xf112('0x49')](handleError(_0x557542,null));};exports[_0xf112('0x90')]=function(_0x498a14,_0x157f4f,_0x18cdc1){return db[_0xf112('0x2c')][_0xf112('0x48')]({'where':{'id':_0x498a14[_0xf112('0x52')]['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x157f4f,null))['then'](function(_0x2bf1c8){if(_0x2bf1c8){return _0x2bf1c8['removeLists'](_0x498a14[_0xf112('0x32')][_0xf112('0x68')]);}})['then'](function(_0x373d27){if(_0x373d27){return db['CmHopper'][_0xf112('0x24')]({'where':{'ListId':_0x498a14['query'][_0xf112('0x68')],'CampaignId':_0x498a14[_0xf112('0x52')]['id']}})['then'](function(){return _0x373d27;});}})[_0xf112('0x23')](respondWithStatusCode(_0x157f4f,null))[_0xf112('0x49')](handleError(_0x157f4f,null));};exports[_0xf112('0x91')]=function(_0x51b571,_0x47e2e1,_0x21cfd6){var _0x546adf={};var _0x32a30d={};var _0x2bf792;var _0x3c799a;return db['Campaign']['findOne']({'where':{'id':_0x51b571[_0xf112('0x52')]['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x47e2e1,null))[_0xf112('0x23')](function(_0x2deeec){if(_0x2deeec){_0x2bf792=_0x2deeec;_0x32a30d['model']=_[_0xf112('0x47')](db[_0xf112('0x64')][_0xf112('0x2d')]);_0x32a30d[_0xf112('0x32')]=_[_0xf112('0x47')](_0x51b571[_0xf112('0x32')]);_0x32a30d[_0xf112('0x3c')]=_['intersection'](_0x32a30d[_0xf112('0x34')],_0x32a30d[_0xf112('0x32')]);_0x546adf['attributes']=_[_0xf112('0x33')](_0x32a30d['model'],qs[_0xf112('0x35')](_0x51b571['query'][_0xf112('0x35')]));_0x546adf[_0xf112('0x36')]=_0x546adf[_0xf112('0x36')]['length']?_0x546adf[_0xf112('0x36')]:_0x32a30d[_0xf112('0x34')];_0x546adf[_0xf112('0x5c')]=qs[_0xf112('0x3a')](_0x51b571[_0xf112('0x32')][_0xf112('0x3a')]);_0x546adf['where']=qs[_0xf112('0x3c')](_['pick'](_0x51b571[_0xf112('0x32')],_0x32a30d['filters']));if(_0x51b571[_0xf112('0x32')][_0xf112('0x3d')]){_0x546adf[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x546adf['where'],{'$or':_[_0xf112('0x31')](_0x546adf[_0xf112('0x36')],function(_0x44e23f){var _0x41d42b={};_0x41d42b[_0x44e23f]={'$like':'%'+_0x51b571[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x41d42b;})});}_0x546adf=_[_0xf112('0x3e')]({},_0x546adf,_0x51b571['options']);return _0x2bf792[_0xf112('0x91')](_0x546adf);}})['then'](function(_0xe5e0dd){if(_0xe5e0dd){_0x3c799a=_0xe5e0dd[_0xf112('0x37')];if(!_0x51b571[_0xf112('0x32')][_0xf112('0x38')](_0xf112('0x39'))){_0x546adf[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x51b571[_0xf112('0x32')]['limit']);_0x546adf[_0xf112('0x1b')]=qs['offset'](_0x51b571['query'][_0xf112('0x1b')]);}return _0x2bf792[_0xf112('0x91')](_0x546adf);}})[_0xf112('0x23')](function(_0x45d0ee){if(_0x45d0ee){return _0x45d0ee?{'count':_0x3c799a,'rows':_0x45d0ee}:null;}})[_0xf112('0x23')](respondWithResult(_0x47e2e1,null))[_0xf112('0x49')](handleError(_0x47e2e1,null));};exports[_0xf112('0x92')]=function(_0x36a8ba,_0xdcc051,_0x2ec287){var _0x3f9929,_0x55f29a;var _0xbece0e=[];var _0x9ee581=moment()[_0xf112('0x93')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf112('0x2c')]['find']({'where':{'id':_0x36a8ba['params']['id']}})['then'](handleEntityNotFound(_0xdcc051,null))[_0xf112('0x23')](function(_0xeb40f8){if(_0xeb40f8){_0x55f29a=_0xeb40f8;return _0xeb40f8[_0xf112('0x92')](_0x36a8ba[_0xf112('0x56')][_0xf112('0x68')],_['omit'](_0x36a8ba[_0xf112('0x56')],[_0xf112('0x68'),'id'])||{});}return null;})[_0xf112('0x69')](function(_0x475d7c){var _0x3b41c2;var _0x2d505c;_0x3f9929=_0x475d7c||[];var _0x5b5035=[];if(_0x475d7c){for(var _0x24ba68=0x0;_0x24ba68<_0x475d7c[_0xf112('0x37')];_0x24ba68+=0x1){var _0x4f3988=_0x475d7c[_0x24ba68]['get']({'plain':!![]});_0x3b41c2=squel[_0xf112('0x7f')]()[_0xf112('0x6c')]('cm_hopper_black')[_0xf112('0x6e')](['phone',_0xf112('0x70'),_0xf112('0x77'),'CampaignId',_0xf112('0x54'),'updatedAt'],squel['select']()['field'](_0xf112('0x73'),_0xf112('0x73'))['field']('id',_0xf112('0x70'))[_0xf112('0x72')](_0x4f3988[_0xf112('0x75')][_0xf112('0x76')](),_0xf112('0x77'))[_0xf112('0x72')](_0x36a8ba[_0xf112('0x52')]['id']['toString'](),_0xf112('0x5e'))[_0xf112('0x72')](_0xf112('0x74'),_0xf112('0x54'))[_0xf112('0x72')](_0xf112('0x74'),'updatedAt')['from'](_0xf112('0x80'))[_0xf112('0x3b')](_0xf112('0x79'))['where'](_0xf112('0x81'),_0x4f3988['CmListId']['toString']())[_0xf112('0x3b')](_0xf112('0x7a')))[_0xf112('0x76')]();_0x5b5035[_0xf112('0x8d')](db[_0xf112('0x8e')][_0xf112('0x32')](_0x3b41c2));}return BPromise['all'](_0x5b5035);}})[_0xf112('0x23')](function(){return _0x3f9929;})[_0xf112('0x23')](respondWithResult(_0xdcc051,null))['catch'](handleError(_0xdcc051,null));};exports[_0xf112('0x94')]=function(_0x2bf13b,_0x4ed6e3,_0x154ac0){return db[_0xf112('0x2c')][_0xf112('0x48')]({'where':{'id':_0x2bf13b['params']['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x4ed6e3,null))[_0xf112('0x23')](function(_0x5a4b1f){if(_0x5a4b1f){return _0x5a4b1f['removeBlackLists'](_0x2bf13b[_0xf112('0x32')]['ids']);}})[_0xf112('0x23')](function(_0x5681fc){if(_0x5681fc){return db[_0xf112('0x63')][_0xf112('0x24')]({'where':{'ListId':_0x2bf13b[_0xf112('0x32')]['ids'],'CampaignId':_0x2bf13b[_0xf112('0x52')]['id']}})['then'](function(){return _0x5681fc;});}})[_0xf112('0x23')](respondWithStatusCode(_0x4ed6e3,null))['catch'](handleError(_0x4ed6e3,null));}; \ No newline at end of file +var _0xe860=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','Campaign','includeAll','include','rows','catch','show','keys','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','clone','params','omit','createdAt','updatedAt','error','getHoppers','findOne','pick','CmHopper','getHopperHistories','CampaignId','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','CmListId','toString','from','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0x5a66f8,_0x20ba95){var _0x41e528=function(_0x69a1af){while(--_0x69a1af){_0x5a66f8['push'](_0x5a66f8['shift']());}};_0x41e528(++_0x20ba95);}(_0xe860,0x188));var _0x0e86=function(_0x101317,_0x162be8){_0x101317=_0x101317-0x0;var _0x481e49=_0xe860[_0x101317];return _0x481e49;};'use strict';var emlformat=require(_0x0e86('0x0'));var rimraf=require(_0x0e86('0x1'));var zipdir=require(_0x0e86('0x2'));var jsonpatch=require(_0x0e86('0x3'));var rp=require('request-promise');var moment=require(_0x0e86('0x4'));var BPromise=require(_0x0e86('0x5'));var Mustache=require('mustache');var util=require(_0x0e86('0x6'));var path=require(_0x0e86('0x7'));var sox=require(_0x0e86('0x8'));var csv=require(_0x0e86('0x9'));var ejs=require(_0x0e86('0xa'));var fs=require('fs');var fs_extra=require(_0x0e86('0xb'));var _=require(_0x0e86('0xc'));var squel=require(_0x0e86('0xd'));var crypto=require(_0x0e86('0xe'));var jsforce=require(_0x0e86('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0e86('0x9'));var querystring=require('querystring');var Papa=require(_0x0e86('0x10'));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(_0x0e86('0x11'));var logger=require('../../config/logger')(_0x0e86('0x12'));var utils=require(_0x0e86('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0e86('0x14'));var db=require(_0x0e86('0x15'))['db'];function respondWithStatusCode(_0x336308,_0x731e0b){_0x731e0b=_0x731e0b||0xcc;return function(_0x2ef563){if(_0x2ef563){return _0x336308[_0x0e86('0x16')](_0x731e0b);}return _0x336308[_0x0e86('0x17')](_0x731e0b)['end']();};}function respondWithResult(_0xee30a9,_0x27e093){_0x27e093=_0x27e093||0xc8;return function(_0xbd69f4){if(_0xbd69f4){return _0xee30a9[_0x0e86('0x17')](_0x27e093)[_0x0e86('0x18')](_0xbd69f4);}};}function respondWithFilteredResult(_0x39449f,_0x9964f7){return function(_0x3e4189){if(_0x3e4189){var _0x32cd00=typeof _0x9964f7[_0x0e86('0x19')]===_0x0e86('0x1a')&&typeof _0x9964f7[_0x0e86('0x1b')]===_0x0e86('0x1a');var _0x3b7933=_0x3e4189[_0x0e86('0x1c')];var _0xee60ba=_0x32cd00?0x0:_0x9964f7[_0x0e86('0x19')];var _0x1fbcd3=_0x32cd00?_0x3e4189[_0x0e86('0x1c')]:_0x9964f7['offset']+_0x9964f7['limit'];var _0x54579d;if(_0x1fbcd3>=_0x3b7933){_0x1fbcd3=_0x3b7933;_0x54579d=0xc8;}else{_0x54579d=0xce;}_0x39449f[_0x0e86('0x17')](_0x54579d);return _0x39449f[_0x0e86('0x1d')](_0x0e86('0x1e'),_0xee60ba+'-'+_0x1fbcd3+'/'+_0x3b7933)['json'](_0x3e4189);}return null;};}function patchUpdates(_0xe30ad9){return function(_0x53ceb1){try{jsonpatch[_0x0e86('0x1f')](_0x53ceb1,_0xe30ad9,!![]);}catch(_0x13008a){return BPromise[_0x0e86('0x20')](_0x13008a);}return _0x53ceb1[_0x0e86('0x21')]();};}function saveUpdates(_0x17edb4,_0x385530){return function(_0x538ef3){if(_0x538ef3){return _0x538ef3[_0x0e86('0x22')](_0x17edb4)[_0x0e86('0x23')](function(_0x340a93){return _0x340a93;});}return null;};}function removeEntity(_0x432253,_0xa24e68){return function(_0x185354){if(_0x185354){return _0x185354[_0x0e86('0x24')]()['then'](function(){var _0x7ad308=_0x185354[_0x0e86('0x25')]({'plain':!![]});var _0x1ae6fe=_0x0e86('0x26');return db[_0x0e86('0x27')][_0x0e86('0x24')]({'where':{'type':_0x1ae6fe,'resourceId':_0x7ad308['id']}})['then'](function(){return _0x185354;});})[_0x0e86('0x23')](function(){_0x432253['status'](0xcc)[_0x0e86('0x28')]();});}};}function handleEntityNotFound(_0x13a187,_0x5b483f){return function(_0x49aea3){if(!_0x49aea3){_0x13a187[_0x0e86('0x16')](0x194);}return _0x49aea3;};}function handleError(_0x580416,_0x405643){_0x405643=_0x405643||0x1f4;return function(_0x1a7f77){logger['error'](_0x1a7f77['stack']);if(_0x1a7f77[_0x0e86('0x29')]){delete _0x1a7f77[_0x0e86('0x29')];}_0x580416[_0x0e86('0x17')](_0x405643)[_0x0e86('0x2a')](_0x1a7f77);};}exports[_0x0e86('0x2b')]=function(_0x53139c,_0x2194fd){var _0x432696={},_0x2351ca={},_0x33ea18={'count':0x0,'rows':[]};var _0x5a81dd=_[_0x0e86('0x2c')](db['Campaign'][_0x0e86('0x2d')],function(_0x244808){return{'name':_0x244808[_0x0e86('0x2e')],'type':_0x244808['type'][_0x0e86('0x2f')]};});_0x2351ca[_0x0e86('0x30')]=_[_0x0e86('0x2c')](_0x5a81dd,_0x0e86('0x29'));_0x2351ca[_0x0e86('0x31')]=_['keys'](_0x53139c[_0x0e86('0x31')]);_0x2351ca[_0x0e86('0x32')]=_[_0x0e86('0x33')](_0x2351ca[_0x0e86('0x30')],_0x2351ca['query']);_0x432696[_0x0e86('0x34')]=_['intersection'](_0x2351ca[_0x0e86('0x30')],qs[_0x0e86('0x35')](_0x53139c[_0x0e86('0x31')][_0x0e86('0x35')]));_0x432696[_0x0e86('0x34')]=_0x432696[_0x0e86('0x34')][_0x0e86('0x36')]?_0x432696[_0x0e86('0x34')]:_0x2351ca['model'];if(!_0x53139c[_0x0e86('0x31')][_0x0e86('0x37')](_0x0e86('0x38'))){_0x432696['limit']=qs['limit'](_0x53139c[_0x0e86('0x31')][_0x0e86('0x1b')]);_0x432696[_0x0e86('0x19')]=qs[_0x0e86('0x19')](_0x53139c[_0x0e86('0x31')]['offset']);}_0x432696[_0x0e86('0x39')]=qs['sort'](_0x53139c[_0x0e86('0x31')][_0x0e86('0x3a')]);_0x432696['where']=qs[_0x0e86('0x32')](_['pick'](_0x53139c[_0x0e86('0x31')],_0x2351ca[_0x0e86('0x32')]),_0x5a81dd);if(_0x53139c[_0x0e86('0x31')]['filter']){_0x432696[_0x0e86('0x3b')]=_[_0x0e86('0x3c')](_0x432696[_0x0e86('0x3b')],{'$or':_[_0x0e86('0x2c')](_0x5a81dd,function(_0xdd6fdb){if(_0xdd6fdb[_0x0e86('0x3d')]!==_0x0e86('0x3e')){var _0x1d8d42={};_0x1d8d42[_0xdd6fdb[_0x0e86('0x29')]]={'$like':'%'+_0x53139c[_0x0e86('0x31')][_0x0e86('0x3f')]+'%'};return _0x1d8d42;}})});}_0x432696=_['merge']({},_0x432696,_0x53139c[_0x0e86('0x40')]);var _0x382d94={'where':_0x432696[_0x0e86('0x3b')]};return db[_0x0e86('0x41')][_0x0e86('0x1c')](_0x382d94)[_0x0e86('0x23')](function(_0x5fa25f){_0x33ea18['count']=_0x5fa25f;if(_0x53139c[_0x0e86('0x31')][_0x0e86('0x42')]){_0x432696[_0x0e86('0x43')]=[{'all':!![]}];}return db[_0x0e86('0x41')]['findAll'](_0x432696);})[_0x0e86('0x23')](function(_0x4b4a2c){_0x33ea18[_0x0e86('0x44')]=_0x4b4a2c;return _0x33ea18;})[_0x0e86('0x23')](respondWithFilteredResult(_0x2194fd,_0x432696))[_0x0e86('0x45')](handleError(_0x2194fd,null));};exports[_0x0e86('0x46')]=function(_0x1bc5cc,_0x46de02){var _0x3e9ec3={'raw':![],'where':{'id':_0x1bc5cc['params']['id']}},_0x261899={};_0x261899[_0x0e86('0x30')]=_[_0x0e86('0x47')](db['Campaign'][_0x0e86('0x2d')]);_0x261899[_0x0e86('0x31')]=_[_0x0e86('0x47')](_0x1bc5cc[_0x0e86('0x31')]);_0x261899[_0x0e86('0x32')]=_[_0x0e86('0x33')](_0x261899[_0x0e86('0x30')],_0x261899[_0x0e86('0x31')]);_0x3e9ec3[_0x0e86('0x34')]=_[_0x0e86('0x33')](_0x261899[_0x0e86('0x30')],qs[_0x0e86('0x35')](_0x1bc5cc[_0x0e86('0x31')][_0x0e86('0x35')]));_0x3e9ec3[_0x0e86('0x34')]=_0x3e9ec3[_0x0e86('0x34')][_0x0e86('0x36')]?_0x3e9ec3[_0x0e86('0x34')]:_0x261899[_0x0e86('0x30')];if(_0x1bc5cc[_0x0e86('0x31')][_0x0e86('0x42')]){_0x3e9ec3[_0x0e86('0x43')]=[{'all':!![]}];}_0x3e9ec3=_[_0x0e86('0x3c')]({},_0x3e9ec3,_0x1bc5cc[_0x0e86('0x40')]);return db['Campaign'][_0x0e86('0x48')](_0x3e9ec3)['then'](handleEntityNotFound(_0x46de02,null))['then'](respondWithResult(_0x46de02,null))[_0x0e86('0x45')](handleError(_0x46de02,null));};exports[_0x0e86('0x49')]=function(_0x33de57,_0x334cc2){return db['Campaign']['create'](_0x33de57[_0x0e86('0x4a')],{})[_0x0e86('0x23')](function(_0x581add){var _0x3fcf2a=_0x33de57['user'][_0x0e86('0x25')]({'plain':!![]});if(!_0x3fcf2a)throw new Error(_0x0e86('0x4b'));if(_0x3fcf2a[_0x0e86('0x4c')]===_0x0e86('0x4d')){var _0x53e1b5=_0x581add['get']({'plain':!![]});var _0x119cf1='IvrCampaigns';return db[_0x0e86('0x4e')][_0x0e86('0x48')]({'where':{'name':_0x119cf1,'userProfileId':_0x3fcf2a[_0x0e86('0x4f')]},'raw':!![]})['then'](function(_0x3d792a){if(_0x3d792a&&_0x3d792a[_0x0e86('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x53e1b5[_0x0e86('0x29')],'resourceId':_0x53e1b5['id'],'type':_0x3d792a[_0x0e86('0x29')],'sectionId':_0x3d792a['id']},{})[_0x0e86('0x23')](function(){return _0x581add;});}else{return _0x581add;}})[_0x0e86('0x45')](function(_0x1a33b3){logger['error'](_0x0e86('0x51'),_0x1a33b3);throw _0x1a33b3;});}return _0x581add;})[_0x0e86('0x23')](respondWithResult(_0x334cc2,0xc9))[_0x0e86('0x45')](handleError(_0x334cc2,null));};exports[_0x0e86('0x52')]=function(_0xb80509,_0x42fb33){var _0x9049a3={'where':{'id':_0xb80509[_0x0e86('0x53')]['id']}},_0x5a813b={};_0x5a813b['model']=_[_0x0e86('0x47')](db['Campaign'][_0x0e86('0x2d')]);_0x9049a3[_0x0e86('0x34')]=_[_0x0e86('0x33')](_0x5a813b[_0x0e86('0x30')],qs['fields'](_0xb80509[_0x0e86('0x31')]['fields']));_0x9049a3[_0x0e86('0x34')]=_0x9049a3['attributes']['length']?_0x9049a3['attributes']:_0x5a813b[_0x0e86('0x30')];if(_0xb80509[_0x0e86('0x31')][_0x0e86('0x42')]){_0x9049a3[_0x0e86('0x43')]=[{'all':!![]}];}_0x9049a3=_[_0x0e86('0x3c')]({},_0x9049a3,_0xb80509[_0x0e86('0x40')]);return db['Campaign']['find'](_0x9049a3)['then'](handleEntityNotFound(_0x42fb33,null))[_0x0e86('0x23')](function(_0x1e220c){if(_0x1e220c){var _0x373ffc=_0x1e220c[_0x0e86('0x25')]({'plain':!![]});_0x373ffc=qs[_0x0e86('0x54')](_0x373ffc,['id',_0x0e86('0x55'),_0x0e86('0x56')]);_0xb80509[_0x0e86('0x4a')]=_[_0x0e86('0x54')](_0xb80509['body'],['id',_0x0e86('0x55'),_0x0e86('0x56')]);return db[_0x0e86('0x41')]['create'](_[_0x0e86('0x3c')](_0x373ffc,_0xb80509['body']),{'include':_0xb80509[_0x0e86('0x31')][_0x0e86('0x42')]?[{'all':!![]}]:undefined})[_0x0e86('0x23')](function(_0x3b3ba2){var _0x370ca6=_0xb80509[_0x0e86('0x4d')][_0x0e86('0x25')]({'plain':!![]});if(!_0x370ca6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x370ca6[_0x0e86('0x4c')]===_0x0e86('0x4d')){var _0x3424fa=_0x3b3ba2[_0x0e86('0x25')]({'plain':!![]});var _0x86558c=_0x0e86('0x26');return db[_0x0e86('0x4e')][_0x0e86('0x48')]({'where':{'name':_0x86558c,'userProfileId':_0x370ca6[_0x0e86('0x4f')]},'raw':!![]})[_0x0e86('0x23')](function(_0x3d6b76){if(_0x3d6b76&&_0x3d6b76[_0x0e86('0x50')]===0x0){return db['UserProfileResource'][_0x0e86('0x49')]({'name':_0x3424fa['name'],'resourceId':_0x3424fa['id'],'type':_0x3d6b76[_0x0e86('0x29')],'sectionId':_0x3d6b76['id']},{})[_0x0e86('0x23')](function(){return _0x3b3ba2;});}else{return _0x3b3ba2;}})[_0x0e86('0x45')](function(_0x57ee43){logger[_0x0e86('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57ee43);throw _0x57ee43;});}return _0x3b3ba2;});}})[_0x0e86('0x23')](respondWithResult(_0x42fb33,0xc9))[_0x0e86('0x45')](handleError(_0x42fb33,null));};exports[_0x0e86('0x22')]=function(_0x379a7a,_0x259cc3){if(_0x379a7a[_0x0e86('0x4a')]['id']){delete _0x379a7a[_0x0e86('0x4a')]['id'];}return db['Campaign'][_0x0e86('0x48')]({'where':{'id':_0x379a7a[_0x0e86('0x53')]['id']}})[_0x0e86('0x23')](handleEntityNotFound(_0x259cc3,null))['then'](saveUpdates(_0x379a7a[_0x0e86('0x4a')],null))[_0x0e86('0x23')](respondWithResult(_0x259cc3,null))[_0x0e86('0x45')](handleError(_0x259cc3,null));};exports[_0x0e86('0x24')]=function(_0x5e3626,_0x269bab){return db[_0x0e86('0x41')][_0x0e86('0x48')]({'where':{'id':_0x5e3626[_0x0e86('0x53')]['id']}})['then'](handleEntityNotFound(_0x269bab,null))['then'](removeEntity(_0x269bab,null))[_0x0e86('0x45')](handleError(_0x269bab,null));};exports[_0x0e86('0x58')]=function(_0x14a450,_0x2e437e,_0x4b9264){var _0x492c74={'raw':!![],'where':{}};var _0x204ed0={};var _0x2ac63f={'count':0x0,'rows':[]};return db[_0x0e86('0x41')][_0x0e86('0x59')]({'where':{'id':_0x14a450[_0x0e86('0x53')]['id']}})[_0x0e86('0x23')](handleEntityNotFound(_0x2e437e,null))[_0x0e86('0x23')](function(_0x2d8d2e){if(_0x2d8d2e){_0x204ed0[_0x0e86('0x30')]=_[_0x0e86('0x47')](db['CmHopper'][_0x0e86('0x2d')]);_0x204ed0[_0x0e86('0x31')]=_[_0x0e86('0x47')](_0x14a450[_0x0e86('0x31')]);_0x204ed0[_0x0e86('0x32')]=_[_0x0e86('0x33')](_0x204ed0[_0x0e86('0x30')],_0x204ed0['query']);_0x492c74[_0x0e86('0x34')]=_[_0x0e86('0x33')](_0x204ed0[_0x0e86('0x30')],qs['fields'](_0x14a450[_0x0e86('0x31')]['fields']));_0x492c74[_0x0e86('0x34')]=_0x492c74[_0x0e86('0x34')][_0x0e86('0x36')]?_0x492c74[_0x0e86('0x34')]:_0x204ed0['model'];if(!_0x14a450['query'][_0x0e86('0x37')](_0x0e86('0x38'))){_0x492c74[_0x0e86('0x1b')]=qs[_0x0e86('0x1b')](_0x14a450['query'][_0x0e86('0x1b')]);_0x492c74[_0x0e86('0x19')]=qs[_0x0e86('0x19')](_0x14a450['query'][_0x0e86('0x19')]);}_0x492c74[_0x0e86('0x39')]=qs[_0x0e86('0x3a')](_0x14a450[_0x0e86('0x31')][_0x0e86('0x3a')]);_0x492c74[_0x0e86('0x3b')]=qs['filters'](_[_0x0e86('0x5a')](_0x14a450['query'],_0x204ed0[_0x0e86('0x32')]));_0x492c74[_0x0e86('0x3b')]['CampaignId']=_0x2d8d2e['id'];if(_0x14a450[_0x0e86('0x31')]['filter']){_0x492c74[_0x0e86('0x3b')]=_[_0x0e86('0x3c')](_0x492c74['where'],{'$or':_[_0x0e86('0x2c')](_0x492c74['attributes'],function(_0x5ede91){var _0x4028a6={};_0x4028a6[_0x5ede91]={'$like':'%'+_0x14a450[_0x0e86('0x31')][_0x0e86('0x3f')]+'%'};return _0x4028a6;})});}_0x492c74=_['merge']({},_0x492c74,_0x14a450['options']);return db[_0x0e86('0x5b')][_0x0e86('0x1c')]({'where':_0x492c74['where']})[_0x0e86('0x23')](function(_0x474b6b){_0x2ac63f['count']=_0x474b6b;if(_0x14a450[_0x0e86('0x31')]['includeAll']){_0x492c74[_0x0e86('0x43')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x492c74);})[_0x0e86('0x23')](function(_0xec1890){_0x2ac63f[_0x0e86('0x44')]=_0xec1890;return _0x2ac63f;});}})['then'](respondWithFilteredResult(_0x2e437e,_0x492c74))['catch'](handleError(_0x2e437e,null));};exports[_0x0e86('0x5c')]=function(_0x2b8ecc,_0x1de61f,_0x2a51ee){var _0x595dab={'raw':!![],'where':{}};var _0x575a0c={};var _0x5211d6={'count':0x0,'rows':[]};return db[_0x0e86('0x41')][_0x0e86('0x59')]({'where':{'id':_0x2b8ecc['params']['id']}})['then'](handleEntityNotFound(_0x1de61f,null))[_0x0e86('0x23')](function(_0x3d52e5){if(_0x3d52e5){_0x575a0c[_0x0e86('0x30')]=_[_0x0e86('0x47')](db['CmHopperHistory'][_0x0e86('0x2d')]);_0x575a0c[_0x0e86('0x31')]=_[_0x0e86('0x47')](_0x2b8ecc[_0x0e86('0x31')]);_0x575a0c['filters']=_[_0x0e86('0x33')](_0x575a0c['model'],_0x575a0c['query']);_0x595dab[_0x0e86('0x34')]=_[_0x0e86('0x33')](_0x575a0c[_0x0e86('0x30')],qs[_0x0e86('0x35')](_0x2b8ecc[_0x0e86('0x31')]['fields']));_0x595dab[_0x0e86('0x34')]=_0x595dab[_0x0e86('0x34')][_0x0e86('0x36')]?_0x595dab[_0x0e86('0x34')]:_0x575a0c[_0x0e86('0x30')];if(!_0x2b8ecc['query'][_0x0e86('0x37')](_0x0e86('0x38'))){_0x595dab[_0x0e86('0x1b')]=qs[_0x0e86('0x1b')](_0x2b8ecc[_0x0e86('0x31')][_0x0e86('0x1b')]);_0x595dab[_0x0e86('0x19')]=qs[_0x0e86('0x19')](_0x2b8ecc[_0x0e86('0x31')][_0x0e86('0x19')]);}_0x595dab[_0x0e86('0x39')]=qs[_0x0e86('0x3a')](_0x2b8ecc[_0x0e86('0x31')][_0x0e86('0x3a')]);_0x595dab['where']=qs['filters'](_[_0x0e86('0x5a')](_0x2b8ecc[_0x0e86('0x31')],_0x575a0c[_0x0e86('0x32')]));_0x595dab[_0x0e86('0x3b')][_0x0e86('0x5d')]=_0x3d52e5['id'];if(_0x2b8ecc[_0x0e86('0x31')][_0x0e86('0x3f')]){_0x595dab[_0x0e86('0x3b')]=_[_0x0e86('0x3c')](_0x595dab[_0x0e86('0x3b')],{'$or':_[_0x0e86('0x2c')](_0x595dab['attributes'],function(_0x4ad45d){var _0x5ad0b3={};_0x5ad0b3[_0x4ad45d]={'$like':'%'+_0x2b8ecc[_0x0e86('0x31')]['filter']+'%'};return _0x5ad0b3;})});}_0x595dab=_[_0x0e86('0x3c')]({},_0x595dab,_0x2b8ecc['options']);return db[_0x0e86('0x5e')][_0x0e86('0x1c')]({'where':_0x595dab[_0x0e86('0x3b')]})['then'](function(_0x3254fb){_0x5211d6['count']=_0x3254fb;if(_0x2b8ecc['query']['includeAll']){_0x595dab['include']=[{'all':!![]}];}return db[_0x0e86('0x5e')][_0x0e86('0x5f')](_0x595dab);})[_0x0e86('0x23')](function(_0x14a189){_0x5211d6[_0x0e86('0x44')]=_0x14a189;return _0x5211d6;});}})['then'](respondWithFilteredResult(_0x1de61f,_0x595dab))['catch'](handleError(_0x1de61f,null));};exports[_0x0e86('0x60')]=function(_0x4bda62,_0x16ac42,_0x4d97f8){var _0x50818b={'raw':!![],'where':{}};var _0x573c6e={};var _0x172100={'count':0x0,'rows':[]};return db['Campaign'][_0x0e86('0x59')]({'where':{'id':_0x4bda62[_0x0e86('0x53')]['id']}})['then'](handleEntityNotFound(_0x16ac42,null))[_0x0e86('0x23')](function(_0x644f28){if(_0x644f28){_0x573c6e['model']=_[_0x0e86('0x47')](db['CmHopperFinal'][_0x0e86('0x2d')]);_0x573c6e[_0x0e86('0x31')]=_[_0x0e86('0x47')](_0x4bda62[_0x0e86('0x31')]);_0x573c6e[_0x0e86('0x32')]=_[_0x0e86('0x33')](_0x573c6e[_0x0e86('0x30')],_0x573c6e['query']);_0x50818b[_0x0e86('0x34')]=_[_0x0e86('0x33')](_0x573c6e['model'],qs[_0x0e86('0x35')](_0x4bda62[_0x0e86('0x31')][_0x0e86('0x35')]));_0x50818b[_0x0e86('0x34')]=_0x50818b[_0x0e86('0x34')][_0x0e86('0x36')]?_0x50818b['attributes']:_0x573c6e[_0x0e86('0x30')];if(!_0x4bda62['query']['hasOwnProperty'](_0x0e86('0x38'))){_0x50818b[_0x0e86('0x1b')]=qs[_0x0e86('0x1b')](_0x4bda62[_0x0e86('0x31')][_0x0e86('0x1b')]);_0x50818b['offset']=qs['offset'](_0x4bda62[_0x0e86('0x31')][_0x0e86('0x19')]);}_0x50818b[_0x0e86('0x39')]=qs['sort'](_0x4bda62[_0x0e86('0x31')][_0x0e86('0x3a')]);_0x50818b[_0x0e86('0x3b')]=qs[_0x0e86('0x32')](_['pick'](_0x4bda62[_0x0e86('0x31')],_0x573c6e[_0x0e86('0x32')]));_0x50818b[_0x0e86('0x3b')][_0x0e86('0x5d')]=_0x644f28['id'];if(_0x4bda62[_0x0e86('0x31')][_0x0e86('0x3f')]){_0x50818b['where']=_[_0x0e86('0x3c')](_0x50818b['where'],{'$or':_[_0x0e86('0x2c')](_0x50818b[_0x0e86('0x34')],function(_0x1c99f4){var _0x1be099={};_0x1be099[_0x1c99f4]={'$like':'%'+_0x4bda62[_0x0e86('0x31')][_0x0e86('0x3f')]+'%'};return _0x1be099;})});}_0x50818b=_[_0x0e86('0x3c')]({},_0x50818b,_0x4bda62[_0x0e86('0x40')]);return db[_0x0e86('0x61')]['count']({'where':_0x50818b['where']})[_0x0e86('0x23')](function(_0x1a3ef2){_0x172100[_0x0e86('0x1c')]=_0x1a3ef2;if(_0x4bda62[_0x0e86('0x31')][_0x0e86('0x42')]){_0x50818b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x50818b);})[_0x0e86('0x23')](function(_0x2532f6){_0x172100[_0x0e86('0x44')]=_0x2532f6;return _0x172100;});}})[_0x0e86('0x23')](respondWithFilteredResult(_0x16ac42,_0x50818b))['catch'](handleError(_0x16ac42,null));};exports['getHopperBlacks']=function(_0x3e64a8,_0x2cd55f,_0x152961){var _0x2ae260={'raw':!![],'where':{}};var _0x108a0c={};var _0x506230={'count':0x0,'rows':[]};return db[_0x0e86('0x41')]['findOne']({'where':{'id':_0x3e64a8['params']['id']}})['then'](handleEntityNotFound(_0x2cd55f,null))[_0x0e86('0x23')](function(_0x68fb2a){if(_0x68fb2a){_0x108a0c[_0x0e86('0x30')]=_[_0x0e86('0x47')](db['CmHopperBlack'][_0x0e86('0x2d')]);_0x108a0c[_0x0e86('0x31')]=_[_0x0e86('0x47')](_0x3e64a8['query']);_0x108a0c['filters']=_[_0x0e86('0x33')](_0x108a0c[_0x0e86('0x30')],_0x108a0c[_0x0e86('0x31')]);_0x2ae260[_0x0e86('0x34')]=_[_0x0e86('0x33')](_0x108a0c[_0x0e86('0x30')],qs[_0x0e86('0x35')](_0x3e64a8[_0x0e86('0x31')][_0x0e86('0x35')]));_0x2ae260[_0x0e86('0x34')]=_0x2ae260[_0x0e86('0x34')][_0x0e86('0x36')]?_0x2ae260[_0x0e86('0x34')]:_0x108a0c[_0x0e86('0x30')];if(!_0x3e64a8[_0x0e86('0x31')][_0x0e86('0x37')](_0x0e86('0x38'))){_0x2ae260[_0x0e86('0x1b')]=qs[_0x0e86('0x1b')](_0x3e64a8[_0x0e86('0x31')][_0x0e86('0x1b')]);_0x2ae260[_0x0e86('0x19')]=qs[_0x0e86('0x19')](_0x3e64a8['query'][_0x0e86('0x19')]);}_0x2ae260['order']=qs[_0x0e86('0x3a')](_0x3e64a8[_0x0e86('0x31')][_0x0e86('0x3a')]);_0x2ae260['where']=qs[_0x0e86('0x32')](_[_0x0e86('0x5a')](_0x3e64a8[_0x0e86('0x31')],_0x108a0c['filters']));_0x2ae260['where'][_0x0e86('0x5d')]=_0x68fb2a['id'];if(_0x3e64a8[_0x0e86('0x31')][_0x0e86('0x3f')]){_0x2ae260[_0x0e86('0x3b')]=_[_0x0e86('0x3c')](_0x2ae260['where'],{'$or':_[_0x0e86('0x2c')](_0x2ae260[_0x0e86('0x34')],function(_0x1662ad){var _0x6318ad={};_0x6318ad[_0x1662ad]={'$like':'%'+_0x3e64a8[_0x0e86('0x31')][_0x0e86('0x3f')]+'%'};return _0x6318ad;})});}_0x2ae260=_[_0x0e86('0x3c')]({},_0x2ae260,_0x3e64a8['options']);return db[_0x0e86('0x62')][_0x0e86('0x1c')]({'where':_0x2ae260['where']})[_0x0e86('0x23')](function(_0x2cd3d4){_0x506230[_0x0e86('0x1c')]=_0x2cd3d4;if(_0x3e64a8[_0x0e86('0x31')]['includeAll']){_0x2ae260[_0x0e86('0x43')]=[{'all':!![]}];}return db[_0x0e86('0x62')][_0x0e86('0x5f')](_0x2ae260);})[_0x0e86('0x23')](function(_0x806099){_0x506230[_0x0e86('0x44')]=_0x806099;return _0x506230;});}})[_0x0e86('0x23')](respondWithFilteredResult(_0x2cd55f,_0x2ae260))[_0x0e86('0x45')](handleError(_0x2cd55f,null));};exports[_0x0e86('0x63')]=function(_0x5dc45d,_0x5a52f6,_0x40741c){var _0x49064c={};var _0x3270e5={};var _0x1f3d5b;var _0x2a74e4;return db[_0x0e86('0x41')]['findOne']({'where':{'id':_0x5dc45d[_0x0e86('0x53')]['id']}})[_0x0e86('0x23')](handleEntityNotFound(_0x5a52f6,null))[_0x0e86('0x23')](function(_0x2c7653){if(_0x2c7653){_0x1f3d5b=_0x2c7653;_0x3270e5[_0x0e86('0x30')]=_[_0x0e86('0x47')](db[_0x0e86('0x64')]['rawAttributes']);_0x3270e5[_0x0e86('0x31')]=_['keys'](_0x5dc45d['query']);_0x3270e5[_0x0e86('0x32')]=_['intersection'](_0x3270e5['model'],_0x3270e5[_0x0e86('0x31')]);_0x49064c[_0x0e86('0x34')]=_[_0x0e86('0x33')](_0x3270e5[_0x0e86('0x30')],qs[_0x0e86('0x35')](_0x5dc45d[_0x0e86('0x31')][_0x0e86('0x35')]));_0x49064c[_0x0e86('0x34')]=_0x49064c[_0x0e86('0x34')]['length']?_0x49064c[_0x0e86('0x34')]:_0x3270e5[_0x0e86('0x30')];_0x49064c['order']=qs[_0x0e86('0x3a')](_0x5dc45d[_0x0e86('0x31')][_0x0e86('0x3a')]);_0x49064c[_0x0e86('0x3b')]=qs[_0x0e86('0x32')](_[_0x0e86('0x5a')](_0x5dc45d[_0x0e86('0x31')],_0x3270e5[_0x0e86('0x32')]));if(_0x5dc45d['query'][_0x0e86('0x3f')]){_0x49064c['where']=_[_0x0e86('0x3c')](_0x49064c[_0x0e86('0x3b')],{'$or':_[_0x0e86('0x2c')](_0x49064c[_0x0e86('0x34')],function(_0x419088){var _0x2adef6={};_0x2adef6[_0x419088]={'$like':'%'+_0x5dc45d['query'][_0x0e86('0x3f')]+'%'};return _0x2adef6;})});}_0x49064c=_['merge']({},_0x49064c,_0x5dc45d['options']);return _0x1f3d5b[_0x0e86('0x63')](_0x49064c);}})[_0x0e86('0x23')](function(_0x5754f2){if(_0x5754f2){_0x2a74e4=_0x5754f2['length'];if(!_0x5dc45d[_0x0e86('0x31')][_0x0e86('0x37')](_0x0e86('0x38'))){_0x49064c[_0x0e86('0x1b')]=qs['limit'](_0x5dc45d[_0x0e86('0x31')][_0x0e86('0x1b')]);_0x49064c['offset']=qs[_0x0e86('0x19')](_0x5dc45d[_0x0e86('0x31')][_0x0e86('0x19')]);}return _0x1f3d5b[_0x0e86('0x63')](_0x49064c);}})[_0x0e86('0x23')](function(_0x4fc66f){if(_0x4fc66f){return _0x4fc66f?{'count':_0x2a74e4,'rows':_0x4fc66f}:null;}})[_0x0e86('0x23')](respondWithResult(_0x5a52f6,null))[_0x0e86('0x45')](handleError(_0x5a52f6,null));};exports[_0x0e86('0x65')]=function(_0x18fc81,_0xd776db,_0x361a09){var _0x634087,_0x29051c;var _0xd3638f=[];var _0x19fe5d=moment()['format'](_0x0e86('0x66'));return db[_0x0e86('0x41')][_0x0e86('0x48')]({'where':{'id':_0x18fc81['params']['id']}})[_0x0e86('0x23')](handleEntityNotFound(_0xd776db,null))['then'](function(_0x89b797){if(_0x89b797){_0x29051c=_0x89b797;return _0x89b797[_0x0e86('0x65')](_0x18fc81['body'][_0x0e86('0x67')],_['omit'](_0x18fc81[_0x0e86('0x4a')],[_0x0e86('0x67'),'id'])||{});}return null;})[_0x0e86('0x68')](function(_0x2b21c5){var _0x4ca95c;var _0x4d46d7;_0x634087=_0x2b21c5||[];var _0x1379a3=[];if(_0x2b21c5){for(var _0x4866cc=0x0;_0x4866cc<_0x2b21c5[_0x0e86('0x36')];_0x4866cc+=0x1){var _0xdc8a00=_0x2b21c5[_0x4866cc][_0x0e86('0x25')]({'plain':!![]});_0x29051c[_0x0e86('0x69')]=_0x18fc81[_0x0e86('0x4a')][_0x0e86('0x69')]?_0x18fc81[_0x0e86('0x4a')][_0x0e86('0x69')]:_0x29051c[_0x0e86('0x69')];switch(_0x29051c[_0x0e86('0x69')]){case _0x0e86('0x6a'):_0x4ca95c=squel[_0x0e86('0x6b')]()[_0x0e86('0x6c')](_0x0e86('0x6d'))[_0x0e86('0x6e')]([_0x0e86('0x6f'),'scheduledAt',_0x0e86('0x70'),_0x0e86('0x71'),'CampaignId',_0x0e86('0x55'),_0x0e86('0x56')],squel['select']()[_0x0e86('0x72')](_0x0e86('0x6f'),'phone')['field'](_0x0e86('0x73'),_0x0e86('0x74'))['field']('id',_0x0e86('0x70'))[_0x0e86('0x72')](_0xdc8a00[_0x0e86('0x75')][_0x0e86('0x76')](),_0x0e86('0x71'))[_0x0e86('0x72')](_0x18fc81[_0x0e86('0x53')]['id'][_0x0e86('0x76')](),_0x0e86('0x5d'))[_0x0e86('0x72')]('\x27'+_0x19fe5d+'\x27',_0x0e86('0x55'))[_0x0e86('0x72')]('\x27'+_0x19fe5d+'\x27',_0x0e86('0x56'))[_0x0e86('0x77')]('cm_contacts')[_0x0e86('0x3b')](_0x0e86('0x78'))[_0x0e86('0x3b')]('ListId\x20=\x20?',_0xdc8a00[_0x0e86('0x75')][_0x0e86('0x76')]())[_0x0e86('0x3b')](_0x0e86('0x79'))[_0x0e86('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0e86('0x7a')]()[_0x0e86('0x72')](_0x0e86('0x7b'))[_0x0e86('0x77')](_0x0e86('0x7c'))['where'](_0x0e86('0x7d'),_0x18fc81[_0x0e86('0x53')]['id'][_0x0e86('0x76')]()))[_0x0e86('0x3b')](_0x0e86('0x7e'),squel[_0x0e86('0x7a')]()[_0x0e86('0x72')](_0x0e86('0x7f'))[_0x0e86('0x77')](_0x0e86('0x6d'))[_0x0e86('0x3b')](_0x0e86('0x7d'),_0x18fc81[_0x0e86('0x53')]['id'][_0x0e86('0x76')]())))[_0x0e86('0x76')]();break;case _0x0e86('0x80'):_0x4ca95c=squel['insert']()[_0x0e86('0x6c')](_0x0e86('0x6d'))[_0x0e86('0x6e')]([_0x0e86('0x6f'),_0x0e86('0x74'),_0x0e86('0x70'),_0x0e86('0x71'),_0x0e86('0x5d'),_0x0e86('0x55'),_0x0e86('0x56')],squel[_0x0e86('0x7a')]()[_0x0e86('0x72')](_0x0e86('0x6f'),_0x0e86('0x6f'))[_0x0e86('0x72')](_0x0e86('0x73'),_0x0e86('0x74'))[_0x0e86('0x72')]('id',_0x0e86('0x70'))[_0x0e86('0x72')](_0xdc8a00[_0x0e86('0x75')][_0x0e86('0x76')](),_0x0e86('0x71'))['field'](_0x18fc81[_0x0e86('0x53')]['id']['toString'](),_0x0e86('0x5d'))[_0x0e86('0x72')]('\x27'+_0x19fe5d+'\x27','createdAt')[_0x0e86('0x72')]('\x27'+_0x19fe5d+'\x27','updatedAt')[_0x0e86('0x77')](_0x0e86('0x81'))['where']('deletedAt\x20IS\x20NULL')[_0x0e86('0x3b')](_0x0e86('0x82'),_0xdc8a00[_0x0e86('0x75')]['toString']())[_0x0e86('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0e86('0x7a')]()[_0x0e86('0x72')](_0x0e86('0x7f'))['from'](_0x0e86('0x6d'))[_0x0e86('0x3b')](_0x0e86('0x7d'),_0x18fc81[_0x0e86('0x53')]['id']['toString']())))[_0x0e86('0x76')]();break;default:_0x4ca95c=squel[_0x0e86('0x6b')]()[_0x0e86('0x6c')](_0x0e86('0x6d'))[_0x0e86('0x6e')]([_0x0e86('0x6f'),'scheduledAt','ContactId',_0x0e86('0x71'),'CampaignId',_0x0e86('0x55'),_0x0e86('0x56')],squel['select']()[_0x0e86('0x72')](_0x0e86('0x6f'),_0x0e86('0x6f'))[_0x0e86('0x72')](_0x0e86('0x73'),_0x0e86('0x74'))[_0x0e86('0x72')]('id',_0x0e86('0x70'))[_0x0e86('0x72')](_0xdc8a00['CmListId']['toString'](),_0x0e86('0x71'))['field'](_0x18fc81['params']['id']['toString'](),_0x0e86('0x5d'))['field']('\x27'+_0x19fe5d+'\x27',_0x0e86('0x55'))['field']('\x27'+_0x19fe5d+'\x27',_0x0e86('0x56'))[_0x0e86('0x77')](_0x0e86('0x81'))[_0x0e86('0x3b')]('deletedAt\x20IS\x20NULL')[_0x0e86('0x3b')](_0x0e86('0x82'),_0xdc8a00[_0x0e86('0x75')][_0x0e86('0x76')]())['where'](_0x0e86('0x79')))[_0x0e86('0x76')]();}_0x4d46d7=squel['insert']()[_0x0e86('0x6c')](_0x0e86('0x83'))[_0x0e86('0x6e')]([_0x0e86('0x84'),_0x0e86('0x74'),'phone',_0x0e86('0x85'),'createdAt',_0x0e86('0x56')],squel[_0x0e86('0x7a')]()['field']('h.id','id')[_0x0e86('0x72')]('NOW()',_0x0e86('0x74'))[_0x0e86('0x72')](_0x0e86('0x86'),_0x0e86('0x6f'))[_0x0e86('0x72')]('ci.OrderBY',_0x0e86('0x85'))[_0x0e86('0x72')]('\x27'+_0x19fe5d+'\x27',_0x0e86('0x55'))[_0x0e86('0x72')]('\x27'+_0x19fe5d+'\x27',_0x0e86('0x56'))[_0x0e86('0x77')](_0x0e86('0x87'),'ci')['join']('cm_hopper','h',_0x0e86('0x88'))[_0x0e86('0x3b')](_0x0e86('0x89'),_0xdc8a00[_0x0e86('0x75')][_0x0e86('0x76')]())[_0x0e86('0x3b')](_0x0e86('0x8a'),_0x18fc81['params']['id'][_0x0e86('0x76')]())[_0x0e86('0x3b')](_0x0e86('0x8b'),_0x19fe5d))[_0x0e86('0x76')]();_0x1379a3[_0x0e86('0x8c')](db[_0x0e86('0x8d')]['query'](_0x4ca95c));_0xd3638f[_0x0e86('0x8c')](db['sequelize']['query'](_0x4d46d7));}return BPromise[_0x0e86('0x8e')](_0x1379a3);}})['then'](function(){return BPromise[_0x0e86('0x8e')](_0xd3638f);})[_0x0e86('0x23')](function(){return _0x634087;})['then'](respondWithResult(_0xd776db,null))[_0x0e86('0x45')](handleError(_0xd776db,null));};exports[_0x0e86('0x8f')]=function(_0x33134e,_0x36011d,_0x2fc9f2){return db[_0x0e86('0x41')][_0x0e86('0x48')]({'where':{'id':_0x33134e[_0x0e86('0x53')]['id']}})['then'](handleEntityNotFound(_0x36011d,null))['then'](function(_0x1d03d7){if(_0x1d03d7){return _0x1d03d7[_0x0e86('0x8f')](_0x33134e[_0x0e86('0x31')][_0x0e86('0x67')]);}})[_0x0e86('0x23')](function(_0x5e07a3){if(_0x5e07a3){return db['CmHopper'][_0x0e86('0x24')]({'where':{'ListId':_0x33134e['query'][_0x0e86('0x67')],'CampaignId':_0x33134e[_0x0e86('0x53')]['id']}})[_0x0e86('0x23')](function(){return _0x5e07a3;});}})[_0x0e86('0x23')](respondWithStatusCode(_0x36011d,null))[_0x0e86('0x45')](handleError(_0x36011d,null));};exports[_0x0e86('0x90')]=function(_0x580138,_0xb36335,_0x8aa5d){var _0x2d52af={};var _0xe18336={};var _0x43123f;var _0x52442d;return db['Campaign'][_0x0e86('0x59')]({'where':{'id':_0x580138[_0x0e86('0x53')]['id']}})[_0x0e86('0x23')](handleEntityNotFound(_0xb36335,null))[_0x0e86('0x23')](function(_0x536ed9){if(_0x536ed9){_0x43123f=_0x536ed9;_0xe18336['model']=_[_0x0e86('0x47')](db[_0x0e86('0x64')]['rawAttributes']);_0xe18336[_0x0e86('0x31')]=_[_0x0e86('0x47')](_0x580138[_0x0e86('0x31')]);_0xe18336[_0x0e86('0x32')]=_[_0x0e86('0x33')](_0xe18336[_0x0e86('0x30')],_0xe18336[_0x0e86('0x31')]);_0x2d52af['attributes']=_[_0x0e86('0x33')](_0xe18336['model'],qs[_0x0e86('0x35')](_0x580138['query'][_0x0e86('0x35')]));_0x2d52af['attributes']=_0x2d52af[_0x0e86('0x34')][_0x0e86('0x36')]?_0x2d52af[_0x0e86('0x34')]:_0xe18336[_0x0e86('0x30')];_0x2d52af[_0x0e86('0x39')]=qs[_0x0e86('0x3a')](_0x580138[_0x0e86('0x31')][_0x0e86('0x3a')]);_0x2d52af[_0x0e86('0x3b')]=qs[_0x0e86('0x32')](_[_0x0e86('0x5a')](_0x580138['query'],_0xe18336[_0x0e86('0x32')]));if(_0x580138[_0x0e86('0x31')]['filter']){_0x2d52af[_0x0e86('0x3b')]=_[_0x0e86('0x3c')](_0x2d52af[_0x0e86('0x3b')],{'$or':_[_0x0e86('0x2c')](_0x2d52af[_0x0e86('0x34')],function(_0x1df37c){var _0x1f1486={};_0x1f1486[_0x1df37c]={'$like':'%'+_0x580138['query'][_0x0e86('0x3f')]+'%'};return _0x1f1486;})});}_0x2d52af=_[_0x0e86('0x3c')]({},_0x2d52af,_0x580138[_0x0e86('0x40')]);return _0x43123f[_0x0e86('0x90')](_0x2d52af);}})[_0x0e86('0x23')](function(_0x427d8c){if(_0x427d8c){_0x52442d=_0x427d8c[_0x0e86('0x36')];if(!_0x580138[_0x0e86('0x31')][_0x0e86('0x37')]('nolimit')){_0x2d52af['limit']=qs[_0x0e86('0x1b')](_0x580138[_0x0e86('0x31')][_0x0e86('0x1b')]);_0x2d52af['offset']=qs[_0x0e86('0x19')](_0x580138[_0x0e86('0x31')]['offset']);}return _0x43123f[_0x0e86('0x90')](_0x2d52af);}})[_0x0e86('0x23')](function(_0x5544cd){if(_0x5544cd){return _0x5544cd?{'count':_0x52442d,'rows':_0x5544cd}:null;}})['then'](respondWithResult(_0xb36335,null))[_0x0e86('0x45')](handleError(_0xb36335,null));};exports['addBlackLists']=function(_0x342522,_0x369a02,_0x1564e3){var _0x4e3bc0,_0x5ddc03;var _0x470a96=[];var _0x1dfe5f=moment()[_0x0e86('0x91')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x0e86('0x41')]['find']({'where':{'id':_0x342522[_0x0e86('0x53')]['id']}})[_0x0e86('0x23')](handleEntityNotFound(_0x369a02,null))[_0x0e86('0x23')](function(_0x3b8ad0){if(_0x3b8ad0){_0x5ddc03=_0x3b8ad0;return _0x3b8ad0['addBlackLists'](_0x342522['body'][_0x0e86('0x67')],_['omit'](_0x342522[_0x0e86('0x4a')],[_0x0e86('0x67'),'id'])||{});}return null;})[_0x0e86('0x68')](function(_0x5a557a){var _0x4d9f1e;var _0x175419;_0x4e3bc0=_0x5a557a||[];var _0x1e9950=[];if(_0x5a557a){for(var _0x4e3bcb=0x0;_0x4e3bcb<_0x5a557a['length'];_0x4e3bcb+=0x1){var _0x496260=_0x5a557a[_0x4e3bcb][_0x0e86('0x25')]({'plain':!![]});_0x4d9f1e=squel['insert']()[_0x0e86('0x6c')](_0x0e86('0x92'))[_0x0e86('0x6e')]([_0x0e86('0x6f'),'ContactId',_0x0e86('0x71'),_0x0e86('0x5d'),'createdAt',_0x0e86('0x56')],squel['select']()[_0x0e86('0x72')](_0x0e86('0x6f'),_0x0e86('0x6f'))[_0x0e86('0x72')]('id',_0x0e86('0x70'))[_0x0e86('0x72')](_0x496260['CmListId']['toString'](),_0x0e86('0x71'))[_0x0e86('0x72')](_0x342522['params']['id']['toString'](),_0x0e86('0x5d'))['field']('NOW()',_0x0e86('0x55'))[_0x0e86('0x72')]('NOW()',_0x0e86('0x56'))['from'](_0x0e86('0x81'))['where']('deletedAt\x20IS\x20NULL')[_0x0e86('0x3b')](_0x0e86('0x82'),_0x496260[_0x0e86('0x75')][_0x0e86('0x76')]())[_0x0e86('0x3b')](_0x0e86('0x79')))['toString']();_0x1e9950['push'](db['sequelize'][_0x0e86('0x31')](_0x4d9f1e));}return BPromise['all'](_0x1e9950);}})[_0x0e86('0x23')](function(){return _0x4e3bc0;})[_0x0e86('0x23')](respondWithResult(_0x369a02,null))[_0x0e86('0x45')](handleError(_0x369a02,null));};exports['removeBlackLists']=function(_0x33c463,_0x56cd27,_0x51dc39){return db[_0x0e86('0x41')][_0x0e86('0x48')]({'where':{'id':_0x33c463['params']['id']}})[_0x0e86('0x23')](handleEntityNotFound(_0x56cd27,null))[_0x0e86('0x23')](function(_0x2d4e0c){if(_0x2d4e0c){return _0x2d4e0c[_0x0e86('0x93')](_0x33c463['query'][_0x0e86('0x67')]);}})[_0x0e86('0x23')](function(_0x468f4e){if(_0x468f4e){return db['CmHopperBlack'][_0x0e86('0x24')]({'where':{'ListId':_0x33c463['query'][_0x0e86('0x67')],'CampaignId':_0x33c463['params']['id']}})['then'](function(){return _0x468f4e;});}})[_0x0e86('0x23')](respondWithStatusCode(_0x56cd27,null))['catch'](handleError(_0x56cd27,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 8b09e3b..1fbde59 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(_0x92bc95,_0x2dbcc0){var _0x1d671e=function(_0x44546e){while(--_0x44546e){_0x92bc95['push'](_0x92bc95['shift']());}};_0x1d671e(++_0x2dbcc0);}(_0x7a54,0x106));var _0x47a5=function(_0x448828,_0x4b707e){_0x448828=_0x448828-0x0;var _0x621426=_0x7a54[_0x448828];return _0x621426;};'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(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 ce89f06..372f1d5 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 _0x0cfa=['options','where','attributes','limit','model','map','include','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','Campaign,\x20%s,\x20%s','message','result','GetCampaign','Campaign','findAll'];(function(_0x26bed1,_0x125f99){var _0xd51e7=function(_0x2d1587){while(--_0x2d1587){_0x26bed1['push'](_0x26bed1['shift']());}};_0xd51e7(++_0x125f99);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x3eb136,_0x1b3bce){_0x3eb136=_0x3eb136-0x0;var _0x382594=_0x0cfa[_0x3eb136];return _0x382594;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var moment=require(_0xa0cf('0x2'));var BPromise=require(_0xa0cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0cf('0x4'));var logger=require('../../config/logger')(_0xa0cf('0x5'));var config=require(_0xa0cf('0x6'));var jayson=require(_0xa0cf('0x7'));var client=jayson[_0xa0cf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27eb15,_0x5d9035,_0x232245){return new BPromise(function(_0x5f0054,_0xdee9d7){return client['request'](_0x27eb15,_0x232245)[_0xa0cf('0x9')](function(_0xaf7216){logger[_0xa0cf('0xa')]('Campaign,\x20%s,\x20%s',_0x5d9035,_0xa0cf('0xb'));logger[_0xa0cf('0xc')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5d9035,'request\x20sent',JSON[_0xa0cf('0xd')](_0xaf7216));if(_0xaf7216[_0xa0cf('0xe')]){if(_0xaf7216[_0xa0cf('0xe')]['code']===0x1f4){logger[_0xa0cf('0xe')](_0xa0cf('0xf'),_0x5d9035,_0xaf7216[_0xa0cf('0xe')][_0xa0cf('0x10')]);return _0xdee9d7(_0xaf7216[_0xa0cf('0xe')][_0xa0cf('0x10')]);}logger[_0xa0cf('0xe')]('Campaign,\x20%s,\x20%s',_0x5d9035,_0xaf7216[_0xa0cf('0xe')][_0xa0cf('0x10')]);return _0x5f0054(_0xaf7216[_0xa0cf('0xe')]['message']);}else{logger[_0xa0cf('0xa')](_0xa0cf('0xf'),_0x5d9035,_0xa0cf('0xb'));_0x5f0054(_0xaf7216[_0xa0cf('0x11')][_0xa0cf('0x10')]);}})['catch'](function(_0x19e263){logger[_0xa0cf('0xe')]('Campaign,\x20%s,\x20%s',_0x5d9035,_0x19e263);_0xdee9d7(_0x19e263);});});}exports[_0xa0cf('0x12')]=function(_0x36c524){var _0x53a186=this;return new Promise(function(_0x112ced,_0x175727){return db[_0xa0cf('0x13')][_0xa0cf('0x14')]({'raw':_0x36c524[_0xa0cf('0x15')]?_0x36c524[_0xa0cf('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x36c524[_0xa0cf('0x15')]?_0x36c524[_0xa0cf('0x15')][_0xa0cf('0x16')]||null:null,'attributes':_0x36c524[_0xa0cf('0x15')]?_0x36c524[_0xa0cf('0x15')][_0xa0cf('0x17')]||null:null,'limit':_0x36c524[_0xa0cf('0x15')]?_0x36c524[_0xa0cf('0x15')][_0xa0cf('0x18')]||null:null,'include':_0x36c524[_0xa0cf('0x15')]?_0x36c524[_0xa0cf('0x15')]['include']?_['map'](_0x36c524['options']['include'],function(_0x574085){return{'model':db[_0x574085[_0xa0cf('0x19')]],'as':_0x574085['as'],'attributes':_0x574085[_0xa0cf('0x17')],'include':_0x574085['include']?_[_0xa0cf('0x1a')](_0x574085[_0xa0cf('0x1b')],function(_0xeb9af){return{'model':db[_0xeb9af[_0xa0cf('0x19')]],'as':_0xeb9af['as'],'attributes':_0xeb9af['attributes'],'include':_0xeb9af[_0xa0cf('0x1b')]?_[_0xa0cf('0x1a')](_0xeb9af['include'],function(_0x543c66){return{'model':db[_0x543c66[_0xa0cf('0x19')]],'as':_0x543c66['as'],'attributes':_0x543c66[_0xa0cf('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa0cf('0x9')](function(_0x3d78f0){logger[_0xa0cf('0xa')](_0xa0cf('0x12'),_0x36c524);logger['debug']('GetCampaign',_0x36c524,JSON[_0xa0cf('0xd')](_0x3d78f0));_0x112ced(_0x3d78f0);})['catch'](function(_0xd627d){logger[_0xa0cf('0xe')](_0xa0cf('0x12'),_0xd627d[_0xa0cf('0x10')],_0x36c524);_0x175727(_0x53a186['error'](0x1f4,_0xd627d[_0xa0cf('0x10')]));});});}; \ No newline at end of file +var _0xc737=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','request\x20sent','debug','error','code','Campaign,\x20%s,\x20%s','message','result','catch','Campaign','findAll','options','where','limit','include','map','model','attributes','GetCampaign','stringify','lodash'];(function(_0x46ed84,_0x53381a){var _0x480b36=function(_0x158137){while(--_0x158137){_0x46ed84['push'](_0x46ed84['shift']());}};_0x480b36(++_0x53381a);}(_0xc737,0x154));var _0x7c73=function(_0x469590,_0x17dbf8){_0x469590=_0x469590-0x0;var _0x3d81a8=_0xc737[_0x469590];return _0x3d81a8;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var moment=require(_0x7c73('0x2'));var BPromise=require(_0x7c73('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c73('0x4'));var db=require(_0x7c73('0x5'))['db'];var utils=require(_0x7c73('0x6'));var logger=require('../../config/logger')(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f6f81,_0x57e442,_0x9264a9){return new BPromise(function(_0x3281fe,_0x5bf225){return client['request'](_0x3f6f81,_0x9264a9)[_0x7c73('0xa')](function(_0x8237f){logger[_0x7c73('0xb')]('Campaign,\x20%s,\x20%s',_0x57e442,_0x7c73('0xc'));logger[_0x7c73('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x57e442,_0x7c73('0xc'),JSON['stringify'](_0x8237f));if(_0x8237f[_0x7c73('0xe')]){if(_0x8237f[_0x7c73('0xe')][_0x7c73('0xf')]===0x1f4){logger['error'](_0x7c73('0x10'),_0x57e442,_0x8237f[_0x7c73('0xe')][_0x7c73('0x11')]);return _0x5bf225(_0x8237f[_0x7c73('0xe')]['message']);}logger[_0x7c73('0xe')]('Campaign,\x20%s,\x20%s',_0x57e442,_0x8237f[_0x7c73('0xe')][_0x7c73('0x11')]);return _0x3281fe(_0x8237f[_0x7c73('0xe')][_0x7c73('0x11')]);}else{logger[_0x7c73('0xb')](_0x7c73('0x10'),_0x57e442,_0x7c73('0xc'));_0x3281fe(_0x8237f[_0x7c73('0x12')]['message']);}})[_0x7c73('0x13')](function(_0x562b50){logger[_0x7c73('0xe')](_0x7c73('0x10'),_0x57e442,_0x562b50);_0x5bf225(_0x562b50);});});}exports['GetCampaign']=function(_0x534a39){var _0x1932c2=this;return new Promise(function(_0x4a2ebc,_0x5cc261){return db[_0x7c73('0x14')][_0x7c73('0x15')]({'raw':_0x534a39[_0x7c73('0x16')]?_0x534a39[_0x7c73('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x534a39[_0x7c73('0x16')]?_0x534a39[_0x7c73('0x16')][_0x7c73('0x17')]||null:null,'attributes':_0x534a39[_0x7c73('0x16')]?_0x534a39[_0x7c73('0x16')]['attributes']||null:null,'limit':_0x534a39[_0x7c73('0x16')]?_0x534a39[_0x7c73('0x16')][_0x7c73('0x18')]||null:null,'include':_0x534a39[_0x7c73('0x16')]?_0x534a39[_0x7c73('0x16')][_0x7c73('0x19')]?_[_0x7c73('0x1a')](_0x534a39[_0x7c73('0x16')][_0x7c73('0x19')],function(_0x4c8933){return{'model':db[_0x4c8933[_0x7c73('0x1b')]],'as':_0x4c8933['as'],'attributes':_0x4c8933['attributes'],'include':_0x4c8933[_0x7c73('0x19')]?_['map'](_0x4c8933[_0x7c73('0x19')],function(_0x57dd84){return{'model':db[_0x57dd84[_0x7c73('0x1b')]],'as':_0x57dd84['as'],'attributes':_0x57dd84['attributes'],'include':_0x57dd84[_0x7c73('0x19')]?_[_0x7c73('0x1a')](_0x57dd84[_0x7c73('0x19')],function(_0x5b8bc9){return{'model':db[_0x5b8bc9[_0x7c73('0x1b')]],'as':_0x5b8bc9['as'],'attributes':_0x5b8bc9[_0x7c73('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7c73('0xa')](function(_0x5ad41e){logger[_0x7c73('0xb')](_0x7c73('0x1d'),_0x534a39);logger[_0x7c73('0xd')](_0x7c73('0x1d'),_0x534a39,JSON[_0x7c73('0x1e')](_0x5ad41e));_0x4a2ebc(_0x5ad41e);})[_0x7c73('0x13')](function(_0x5800eb){logger['error']('GetCampaign',_0x5800eb[_0x7c73('0x11')],_0x534a39);_0x5cc261(_0x1932c2[_0x7c73('0xe')](0x1f4,_0x5800eb[_0x7c73('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 78f5d7a..d14f4f2 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 _0x463e=['/:id/clone','clone','addBlackLists','delete','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getBlackLists','post'];(function(_0x43d214,_0x129225){var _0x48798e=function(_0x4ac6a8){while(--_0x4ac6a8){_0x43d214['push'](_0x43d214['shift']());}};_0x48798e(++_0x129225);}(_0x463e,0x1d6));var _0xe463=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x463e[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xe463('0x0'));var util=require(_0xe463('0x1'));var path=require(_0xe463('0x2'));var timeout=require(_0xe463('0x3'));var express=require(_0xe463('0x4'));var router=express[_0xe463('0x5')]();var fs_extra=require(_0xe463('0x6'));var auth=require(_0xe463('0x7'));var interaction=require(_0xe463('0x8'));var config=require(_0xe463('0x9'));var controller=require(_0xe463('0xa'));router[_0xe463('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe463('0xc'),auth[_0xe463('0xd')](),controller[_0xe463('0xe')]);router[_0xe463('0xb')](_0xe463('0xf'),auth[_0xe463('0xd')](),controller['getHoppers']);router[_0xe463('0xb')]('/:id/hopper_histories',auth[_0xe463('0xd')](),controller[_0xe463('0x10')]);router[_0xe463('0xb')](_0xe463('0x11'),auth[_0xe463('0xd')](),controller[_0xe463('0x12')]);router[_0xe463('0xb')](_0xe463('0x13'),auth[_0xe463('0xd')](),controller['getHopperBlacks']);router[_0xe463('0xb')](_0xe463('0x14'),auth[_0xe463('0xd')](),controller['getLists']);router[_0xe463('0xb')]('/:id/blacklists',auth[_0xe463('0xd')](),controller[_0xe463('0x15')]);router[_0xe463('0x16')]('/',auth[_0xe463('0xd')](),controller['create']);router[_0xe463('0x16')](_0xe463('0x17'),auth[_0xe463('0xd')](),controller[_0xe463('0x18')]);router[_0xe463('0x16')](_0xe463('0x14'),auth[_0xe463('0xd')](),controller['addLists']);router[_0xe463('0x16')]('/:id/blacklists',auth[_0xe463('0xd')](),controller[_0xe463('0x19')]);router['put'](_0xe463('0xc'),auth[_0xe463('0xd')](),controller['update']);router[_0xe463('0x1a')]('/:id',auth[_0xe463('0xd')](),controller['destroy']);router[_0xe463('0x1a')](_0xe463('0x14'),auth[_0xe463('0xd')](),controller[_0xe463('0x1b')]);router[_0xe463('0x1a')]('/:id/blacklists',auth[_0xe463('0xd')](),controller[_0xe463('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xa67b=['get','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','clone','addBlackLists','put','update','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index'];(function(_0x5b64a4,_0x1eccd2){var _0x47c20c=function(_0x1b436f){while(--_0x1b436f){_0x5b64a4['push'](_0x5b64a4['shift']());}};_0x47c20c(++_0x1eccd2);}(_0xa67b,0x14a));var _0xba67=function(_0x3d2c5d,_0x26033c){_0x3d2c5d=_0x3d2c5d-0x0;var _0xac8077=_0xa67b[_0x3d2c5d];return _0xac8077;};'use strict';var multer=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var path=require(_0xba67('0x2'));var timeout=require(_0xba67('0x3'));var express=require(_0xba67('0x4'));var router=express[_0xba67('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xba67('0x6'));var interaction=require(_0xba67('0x7'));var config=require('../../config/environment');var controller=require(_0xba67('0x8'));router['get']('/',auth[_0xba67('0x9')](),controller[_0xba67('0xa')]);router[_0xba67('0xb')](_0xba67('0xc'),auth[_0xba67('0x9')](),controller[_0xba67('0xd')]);router[_0xba67('0xb')](_0xba67('0xe'),auth[_0xba67('0x9')](),controller['getHoppers']);router['get'](_0xba67('0xf'),auth[_0xba67('0x9')](),controller['getHopperHistories']);router[_0xba67('0xb')](_0xba67('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xba67('0xb')]('/:id/hopper_black',auth[_0xba67('0x9')](),controller[_0xba67('0x11')]);router[_0xba67('0xb')](_0xba67('0x12'),auth[_0xba67('0x9')](),controller[_0xba67('0x13')]);router['get'](_0xba67('0x14'),auth['isAuthenticated'](),controller[_0xba67('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xba67('0x16')]);router[_0xba67('0x17')]('/:id/clone',auth['isAuthenticated'](),controller[_0xba67('0x18')]);router['post'](_0xba67('0x12'),auth[_0xba67('0x9')](),controller['addLists']);router[_0xba67('0x17')](_0xba67('0x14'),auth[_0xba67('0x9')](),controller[_0xba67('0x19')]);router[_0xba67('0x1a')](_0xba67('0xc'),auth['isAuthenticated'](),controller[_0xba67('0x1b')]);router['delete']('/:id',auth[_0xba67('0x9')](),controller['destroy']);router[_0xba67('0x1c')](_0xba67('0x12'),auth[_0xba67('0x9')](),controller['removeLists']);router['delete'](_0xba67('0x14'),auth['isAuthenticated'](),controller[_0xba67('0x1d')]);module[_0xba67('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index fb249e5..38c2d74 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 _0x8b47=['STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x4e3c75,_0x31eb83){var _0x19861e=function(_0x10daef){while(--_0x10daef){_0x4e3c75['push'](_0x4e3c75['shift']());}};_0x19861e(++_0x31eb83);}(_0x8b47,0x160));var _0x78b4=function(_0x3ee500,_0x19bcf6){_0x3ee500=_0x3ee500-0x0;var _0x223dab=_0x8b47[_0x3ee500];return _0x223dab;};'use strict';var Sequelize=require(_0x78b4('0x0'));module[_0x78b4('0x1')]={'key':{'type':Sequelize[_0x78b4('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x78b4('0x3')],'get':function(){return this[_0x78b4('0x4')](_0x78b4('0x5'));}}}; \ No newline at end of file +var _0x0b37=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x22cafd,_0x3c98cc){var _0x120344=function(_0x36533a){while(--_0x36533a){_0x22cafd['push'](_0x22cafd['shift']());}};_0x120344(++_0x3c98cc);}(_0x0b37,0x1e9));var _0x70b3=function(_0x694623,_0x4dc11a){_0x694623=_0x694623-0x0;var _0x2f270e=_0x0b37[_0x694623];return _0x2f270e;};'use strict';var Sequelize=require(_0x70b3('0x0'));module[_0x70b3('0x1')]={'key':{'type':Sequelize[_0x70b3('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x70b3('0x2')]},'name':{'type':Sequelize[_0x70b3('0x3')],'get':function(){return this[_0x70b3('0x4')](_0x70b3('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d45d009..01e020a 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 _0xad6a=['send','map','CannedAnswer','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','includeAll','findAll','rows','catch','show','params','include','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','destroy','get','CannedAnswers','then','name'];(function(_0x431522,_0x4a676c){var _0x56fc1e=function(_0x278d78){while(--_0x278d78){_0x431522['push'](_0x431522['shift']());}};_0x56fc1e(++_0x4a676c);}(_0xad6a,0x81));var _0xaad6=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xad6a[_0x2faddb];return _0x273c05;};'use strict';var emlformat=require(_0xaad6('0x0'));var rimraf=require(_0xaad6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaad6('0x2'));var rp=require(_0xaad6('0x3'));var moment=require('moment');var BPromise=require(_0xaad6('0x4'));var Mustache=require(_0xaad6('0x5'));var util=require(_0xaad6('0x6'));var path=require('path');var sox=require(_0xaad6('0x7'));var csv=require(_0xaad6('0x8'));var ejs=require(_0xaad6('0x9'));var fs=require('fs');var fs_extra=require(_0xaad6('0xa'));var _=require(_0xaad6('0xb'));var squel=require('squel');var crypto=require(_0xaad6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaad6('0xd'));var toCsv=require(_0xaad6('0x8'));var querystring=require(_0xaad6('0xe'));var Papa=require(_0xaad6('0xf'));var Redis=require(_0xaad6('0x10'));var authService=require(_0xaad6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaad6('0x12'));var hardwareService=require(_0xaad6('0x13'));var logger=require(_0xaad6('0x14'))(_0xaad6('0x15'));var utils=require('../../config/utils');var config=require(_0xaad6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaad6('0x17'))['db'];function respondWithStatusCode(_0x30e7ab,_0x18a67d){_0x18a67d=_0x18a67d||0xcc;return function(_0x5a3684){if(_0x5a3684){return _0x30e7ab[_0xaad6('0x18')](_0x18a67d);}return _0x30e7ab[_0xaad6('0x19')](_0x18a67d)[_0xaad6('0x1a')]();};}function respondWithResult(_0x3378f3,_0x496528){_0x496528=_0x496528||0xc8;return function(_0x10fcaa){if(_0x10fcaa){return _0x3378f3['status'](_0x496528)[_0xaad6('0x1b')](_0x10fcaa);}};}function respondWithFilteredResult(_0x65fca1,_0x50a5e1){return function(_0xf1046b){if(_0xf1046b){var _0x433997=typeof _0x50a5e1['offset']==='undefined'&&typeof _0x50a5e1[_0xaad6('0x1c')]===_0xaad6('0x1d');var _0x29519b=_0xf1046b[_0xaad6('0x1e')];var _0x327665=_0x433997?0x0:_0x50a5e1[_0xaad6('0x1f')];var _0x37471e=_0x433997?_0xf1046b[_0xaad6('0x1e')]:_0x50a5e1['offset']+_0x50a5e1[_0xaad6('0x1c')];var _0x4e7853;if(_0x37471e>=_0x29519b){_0x37471e=_0x29519b;_0x4e7853=0xc8;}else{_0x4e7853=0xce;}_0x65fca1['status'](_0x4e7853);return _0x65fca1[_0xaad6('0x20')](_0xaad6('0x21'),_0x327665+'-'+_0x37471e+'/'+_0x29519b)[_0xaad6('0x1b')](_0xf1046b);}return null;};}function patchUpdates(_0x4181f4){return function(_0x5ed91c){try{jsonpatch[_0xaad6('0x22')](_0x5ed91c,_0x4181f4,!![]);}catch(_0x2bc662){return BPromise['reject'](_0x2bc662);}return _0x5ed91c[_0xaad6('0x23')]();};}function saveUpdates(_0x507cb3,_0x711e2f){return function(_0x1449d6){if(_0x1449d6){return _0x1449d6['update'](_0x507cb3)['then'](function(_0x35e1b){return _0x35e1b;});}return null;};}function removeEntity(_0xa36707,_0x14ff08){return function(_0x4da886){if(_0x4da886){return _0x4da886[_0xaad6('0x24')]()['then'](function(){var _0x42bf2b=_0x4da886[_0xaad6('0x25')]({'plain':!![]});var _0x2ae61e=_0xaad6('0x26');return db['UserProfileResource'][_0xaad6('0x24')]({'where':{'type':_0x2ae61e,'resourceId':_0x42bf2b['id']}})[_0xaad6('0x27')](function(){return _0x4da886;});})['then'](function(){_0xa36707[_0xaad6('0x19')](0xcc)[_0xaad6('0x1a')]();});}};}function handleEntityNotFound(_0x71a939,_0xdbd761){return function(_0x2c69cf){if(!_0x2c69cf){_0x71a939[_0xaad6('0x18')](0x194);}return _0x2c69cf;};}function handleError(_0x4eef2e,_0x1eb593){_0x1eb593=_0x1eb593||0x1f4;return function(_0x5d83cd){logger['error'](_0x5d83cd['stack']);if(_0x5d83cd['name']){delete _0x5d83cd[_0xaad6('0x28')];}_0x4eef2e['status'](_0x1eb593)[_0xaad6('0x29')](_0x5d83cd);};}exports['index']=function(_0x25a6f2,_0x3770ce){var _0x4c4a69={},_0x192461={},_0x37c86b={'count':0x0,'rows':[]};var _0x356442=_[_0xaad6('0x2a')](db[_0xaad6('0x2b')]['rawAttributes'],function(_0x5d73a3){return{'name':_0x5d73a3[_0xaad6('0x2c')],'type':_0x5d73a3['type'][_0xaad6('0x2d')]};});_0x192461['model']=_[_0xaad6('0x2a')](_0x356442,_0xaad6('0x28'));_0x192461[_0xaad6('0x2e')]=_[_0xaad6('0x2f')](_0x25a6f2[_0xaad6('0x2e')]);_0x192461[_0xaad6('0x30')]=_['intersection'](_0x192461['model'],_0x192461[_0xaad6('0x2e')]);_0x4c4a69[_0xaad6('0x31')]=_[_0xaad6('0x32')](_0x192461[_0xaad6('0x33')],qs[_0xaad6('0x34')](_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x34')]));_0x4c4a69[_0xaad6('0x31')]=_0x4c4a69[_0xaad6('0x31')][_0xaad6('0x35')]?_0x4c4a69[_0xaad6('0x31')]:_0x192461['model'];if(!_0x25a6f2['query'][_0xaad6('0x36')](_0xaad6('0x37'))){_0x4c4a69[_0xaad6('0x1c')]=qs[_0xaad6('0x1c')](_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x1c')]);_0x4c4a69[_0xaad6('0x1f')]=qs['offset'](_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x1f')]);}_0x4c4a69[_0xaad6('0x38')]=qs['sort'](_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x39')]);_0x4c4a69['where']=qs[_0xaad6('0x30')](_['pick'](_0x25a6f2[_0xaad6('0x2e')],_0x192461['filters']),_0x356442);if(_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x3a')]){_0x4c4a69['where']=_[_0xaad6('0x3b')](_0x4c4a69[_0xaad6('0x3c')],{'$or':[{'key':{'$like':'%'+_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x3a')]+'%'}},{'value':{'$like':'%'+_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x3a')]+'%'}}]});}_0x4c4a69=_[_0xaad6('0x3b')]({},_0x4c4a69,_0x25a6f2['options']);var _0xec1fa2={'where':_0x4c4a69[_0xaad6('0x3c')]};return db[_0xaad6('0x2b')][_0xaad6('0x1e')](_0xec1fa2)['then'](function(_0x3a6618){_0x37c86b[_0xaad6('0x1e')]=_0x3a6618;if(_0x25a6f2[_0xaad6('0x2e')][_0xaad6('0x3d')]){_0x4c4a69['include']=[{'all':!![]}];}return db[_0xaad6('0x2b')][_0xaad6('0x3e')](_0x4c4a69);})['then'](function(_0x38b9f2){_0x37c86b[_0xaad6('0x3f')]=_0x38b9f2;return _0x37c86b;})[_0xaad6('0x27')](respondWithFilteredResult(_0x3770ce,_0x4c4a69))[_0xaad6('0x40')](handleError(_0x3770ce,null));};exports[_0xaad6('0x41')]=function(_0x5880cc,_0x2e5cb3){var _0x34f08b={'raw':!![],'where':{'id':_0x5880cc[_0xaad6('0x42')]['id']}},_0x56c9f4={};_0x56c9f4['model']=_[_0xaad6('0x2f')](db[_0xaad6('0x2b')]['rawAttributes']);_0x56c9f4[_0xaad6('0x2e')]=_[_0xaad6('0x2f')](_0x5880cc[_0xaad6('0x2e')]);_0x56c9f4[_0xaad6('0x30')]=_[_0xaad6('0x32')](_0x56c9f4[_0xaad6('0x33')],_0x56c9f4[_0xaad6('0x2e')]);_0x34f08b[_0xaad6('0x31')]=_[_0xaad6('0x32')](_0x56c9f4[_0xaad6('0x33')],qs[_0xaad6('0x34')](_0x5880cc[_0xaad6('0x2e')][_0xaad6('0x34')]));_0x34f08b[_0xaad6('0x31')]=_0x34f08b[_0xaad6('0x31')][_0xaad6('0x35')]?_0x34f08b['attributes']:_0x56c9f4[_0xaad6('0x33')];if(_0x5880cc['query'][_0xaad6('0x3d')]){_0x34f08b[_0xaad6('0x43')]=[{'all':!![]}];}_0x34f08b=_['merge']({},_0x34f08b,_0x5880cc['options']);return db[_0xaad6('0x2b')]['find'](_0x34f08b)['then'](handleEntityNotFound(_0x2e5cb3,null))[_0xaad6('0x27')](respondWithResult(_0x2e5cb3,null))['catch'](handleError(_0x2e5cb3,null));};exports[_0xaad6('0x44')]=function(_0x480364,_0x3760a9){if(_0x480364['body']['id']){delete _0x480364['body']['id'];}return db[_0xaad6('0x2b')]['find']({'where':{'id':_0x480364[_0xaad6('0x42')]['id']}})[_0xaad6('0x27')](handleEntityNotFound(_0x3760a9,null))[_0xaad6('0x27')](saveUpdates(_0x480364[_0xaad6('0x45')],null))[_0xaad6('0x27')](respondWithResult(_0x3760a9,null))['catch'](handleError(_0x3760a9,null));};exports[_0xaad6('0x24')]=function(_0x2aa76f,_0x19f692){return db[_0xaad6('0x2b')][_0xaad6('0x46')]({'where':{'id':_0x2aa76f[_0xaad6('0x42')]['id']}})[_0xaad6('0x27')](handleEntityNotFound(_0x19f692,null))[_0xaad6('0x27')](removeEntity(_0x19f692,null))[_0xaad6('0x40')](handleError(_0x19f692,null));};exports[_0xaad6('0x47')]=function(_0x1474b5,_0x34bcfe){var _0x5ab193={'key':_0x1474b5[_0xaad6('0x45')][_0xaad6('0x2d')]};if(_0x1474b5[_0xaad6('0x45')]['MailAccountId']){_0x5ab193[_0xaad6('0x48')]=_0x1474b5[_0xaad6('0x45')][_0xaad6('0x48')];}else if(_0x1474b5[_0xaad6('0x45')][_0xaad6('0x49')]){_0x5ab193[_0xaad6('0x49')]=_0x1474b5['body'][_0xaad6('0x49')];}else if(_0x1474b5[_0xaad6('0x45')][_0xaad6('0x4a')]){_0x5ab193[_0xaad6('0x4a')]=_0x1474b5[_0xaad6('0x45')]['OpenchannelAccountId'];}else if(_0x1474b5['body'][_0xaad6('0x4b')]){_0x5ab193[_0xaad6('0x4b')]=_0x1474b5[_0xaad6('0x45')][_0xaad6('0x4b')];}return db[_0xaad6('0x2b')][_0xaad6('0x46')]({'where':_0x5ab193})[_0xaad6('0x27')](function(_0x2e827d){if(_0x2e827d){throw new db[(_0xaad6('0x4c'))][(_0xaad6('0x4d'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xaad6('0x2b')][_0xaad6('0x47')](_0x1474b5['body']);})[_0xaad6('0x27')](function(_0x5ceea5){var _0x379282=_0x1474b5['user'][_0xaad6('0x25')]({'plain':!![]});if(!_0x379282)throw new Error(_0xaad6('0x4e'));if(_0x379282[_0xaad6('0x4f')]==='user'){var _0x20dfb7=_0x5ceea5[_0xaad6('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xaad6('0x46')]({'where':{'name':_0xaad6('0x26'),'userProfileId':_0x379282[_0xaad6('0x50')]},'raw':!![]})['then'](function(_0x3455c1){if(_0x3455c1&&_0x3455c1[_0xaad6('0x51')]===0x0){return db[_0xaad6('0x52')][_0xaad6('0x47')]({'name':_0x20dfb7[_0xaad6('0x28')],'resourceId':_0x20dfb7['id'],'type':_0x3455c1[_0xaad6('0x28')],'sectionId':_0x3455c1['id']},{})[_0xaad6('0x27')](function(){return _0x5ceea5;});}else{return _0x5ceea5;}})[_0xaad6('0x40')](function(_0x50f061){logger[_0xaad6('0x53')](_0xaad6('0x54'),_0x50f061);throw _0x50f061;});}return _0x5ceea5;})[_0xaad6('0x27')](respondWithResult(_0x34bcfe,0xc9))[_0xaad6('0x40')](handleError(_0x34bcfe,null));}; \ No newline at end of file +var _0x55d6=['name','send','CannedAnswer','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','includeAll','include','rows','params','rawAttributes','length','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x55d6,0x128));var _0x655d=function(_0x142ed3,_0x4455b6){_0x142ed3=_0x142ed3-0x0;var _0x155971=_0x55d6[_0x142ed3];return _0x155971;};'use strict';var emlformat=require(_0x655d('0x0'));var rimraf=require(_0x655d('0x1'));var zipdir=require(_0x655d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x655d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x655d('0x4'));var util=require('util');var path=require(_0x655d('0x5'));var sox=require(_0x655d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x655d('0x7'));var _=require(_0x655d('0x8'));var squel=require(_0x655d('0x9'));var crypto=require('crypto');var jsforce=require(_0x655d('0xa'));var deskjs=require(_0x655d('0xb'));var toCsv=require(_0x655d('0xc'));var querystring=require(_0x655d('0xd'));var Papa=require('papaparse');var Redis=require(_0x655d('0xe'));var authService=require(_0x655d('0xf'));var qs=require(_0x655d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x655d('0x11'))(_0x655d('0x12'));var utils=require(_0x655d('0x13'));var config=require(_0x655d('0x14'));var licenseUtil=require(_0x655d('0x15'));var db=require(_0x655d('0x16'))['db'];function respondWithStatusCode(_0x16ff66,_0x54dbbf){_0x54dbbf=_0x54dbbf||0xcc;return function(_0x531745){if(_0x531745){return _0x16ff66[_0x655d('0x17')](_0x54dbbf);}return _0x16ff66[_0x655d('0x18')](_0x54dbbf)[_0x655d('0x19')]();};}function respondWithResult(_0x2f4d1f,_0x256ea6){_0x256ea6=_0x256ea6||0xc8;return function(_0x36e788){if(_0x36e788){return _0x2f4d1f[_0x655d('0x18')](_0x256ea6)['json'](_0x36e788);}};}function respondWithFilteredResult(_0x34a02a,_0x2f2a1d){return function(_0x45357a){if(_0x45357a){var _0x51b12b=typeof _0x2f2a1d[_0x655d('0x1a')]==='undefined'&&typeof _0x2f2a1d[_0x655d('0x1b')]==='undefined';var _0x5902c1=_0x45357a[_0x655d('0x1c')];var _0x44602a=_0x51b12b?0x0:_0x2f2a1d[_0x655d('0x1a')];var _0x1f2c67=_0x51b12b?_0x45357a[_0x655d('0x1c')]:_0x2f2a1d[_0x655d('0x1a')]+_0x2f2a1d[_0x655d('0x1b')];var _0x3aaf9b;if(_0x1f2c67>=_0x5902c1){_0x1f2c67=_0x5902c1;_0x3aaf9b=0xc8;}else{_0x3aaf9b=0xce;}_0x34a02a[_0x655d('0x18')](_0x3aaf9b);return _0x34a02a['set'](_0x655d('0x1d'),_0x44602a+'-'+_0x1f2c67+'/'+_0x5902c1)[_0x655d('0x1e')](_0x45357a);}return null;};}function patchUpdates(_0x955029){return function(_0x26b4de){try{jsonpatch[_0x655d('0x1f')](_0x26b4de,_0x955029,!![]);}catch(_0x14a50f){return BPromise[_0x655d('0x20')](_0x14a50f);}return _0x26b4de[_0x655d('0x21')]();};}function saveUpdates(_0x11c89e,_0x359903){return function(_0xefc4a0){if(_0xefc4a0){return _0xefc4a0[_0x655d('0x22')](_0x11c89e)[_0x655d('0x23')](function(_0x11b42d){return _0x11b42d;});}return null;};}function removeEntity(_0x25cfee,_0x587ec6){return function(_0x4cf4b8){if(_0x4cf4b8){return _0x4cf4b8[_0x655d('0x24')]()[_0x655d('0x23')](function(){var _0x5c45c5=_0x4cf4b8['get']({'plain':!![]});var _0x43b06f='CannedAnswers';return db[_0x655d('0x25')][_0x655d('0x24')]({'where':{'type':_0x43b06f,'resourceId':_0x5c45c5['id']}})[_0x655d('0x23')](function(){return _0x4cf4b8;});})[_0x655d('0x23')](function(){_0x25cfee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a478b,_0x34284f){return function(_0x232d36){if(!_0x232d36){_0x4a478b[_0x655d('0x17')](0x194);}return _0x232d36;};}function handleError(_0x1b5aa9,_0x5c919a){_0x5c919a=_0x5c919a||0x1f4;return function(_0xf18de0){logger[_0x655d('0x26')](_0xf18de0[_0x655d('0x27')]);if(_0xf18de0['name']){delete _0xf18de0[_0x655d('0x28')];}_0x1b5aa9['status'](_0x5c919a)[_0x655d('0x29')](_0xf18de0);};}exports['index']=function(_0x103b28,_0x3279a7){var _0x1a5f3b={},_0x475c81={},_0x2cfd95={'count':0x0,'rows':[]};var _0x38ed92=_['map'](db[_0x655d('0x2a')]['rawAttributes'],function(_0x4c6b47){return{'name':_0x4c6b47[_0x655d('0x2b')],'type':_0x4c6b47[_0x655d('0x2c')][_0x655d('0x2d')]};});_0x475c81[_0x655d('0x2e')]=_[_0x655d('0x2f')](_0x38ed92,_0x655d('0x28'));_0x475c81['query']=_[_0x655d('0x30')](_0x103b28[_0x655d('0x31')]);_0x475c81['filters']=_[_0x655d('0x32')](_0x475c81['model'],_0x475c81[_0x655d('0x31')]);_0x1a5f3b[_0x655d('0x33')]=_[_0x655d('0x32')](_0x475c81['model'],qs[_0x655d('0x34')](_0x103b28[_0x655d('0x31')][_0x655d('0x34')]));_0x1a5f3b[_0x655d('0x33')]=_0x1a5f3b[_0x655d('0x33')]['length']?_0x1a5f3b['attributes']:_0x475c81[_0x655d('0x2e')];if(!_0x103b28[_0x655d('0x31')][_0x655d('0x35')](_0x655d('0x36'))){_0x1a5f3b[_0x655d('0x1b')]=qs[_0x655d('0x1b')](_0x103b28[_0x655d('0x31')][_0x655d('0x1b')]);_0x1a5f3b[_0x655d('0x1a')]=qs[_0x655d('0x1a')](_0x103b28[_0x655d('0x31')]['offset']);}_0x1a5f3b[_0x655d('0x37')]=qs['sort'](_0x103b28['query'][_0x655d('0x38')]);_0x1a5f3b['where']=qs[_0x655d('0x39')](_['pick'](_0x103b28[_0x655d('0x31')],_0x475c81[_0x655d('0x39')]),_0x38ed92);if(_0x103b28['query'][_0x655d('0x3a')]){_0x1a5f3b['where']=_[_0x655d('0x3b')](_0x1a5f3b[_0x655d('0x3c')],{'$or':[{'key':{'$like':'%'+_0x103b28[_0x655d('0x31')][_0x655d('0x3a')]+'%'}},{'value':{'$like':'%'+_0x103b28['query'][_0x655d('0x3a')]+'%'}}]});}_0x1a5f3b=_[_0x655d('0x3b')]({},_0x1a5f3b,_0x103b28[_0x655d('0x3d')]);var _0x28abac={'where':_0x1a5f3b[_0x655d('0x3c')]};return db[_0x655d('0x2a')][_0x655d('0x1c')](_0x28abac)[_0x655d('0x23')](function(_0x2be058){_0x2cfd95[_0x655d('0x1c')]=_0x2be058;if(_0x103b28[_0x655d('0x31')][_0x655d('0x3e')]){_0x1a5f3b[_0x655d('0x3f')]=[{'all':!![]}];}return db[_0x655d('0x2a')]['findAll'](_0x1a5f3b);})[_0x655d('0x23')](function(_0x3edce3){_0x2cfd95[_0x655d('0x40')]=_0x3edce3;return _0x2cfd95;})[_0x655d('0x23')](respondWithFilteredResult(_0x3279a7,_0x1a5f3b))['catch'](handleError(_0x3279a7,null));};exports['show']=function(_0x51a765,_0x26fec9){var _0x53ae44={'raw':!![],'where':{'id':_0x51a765[_0x655d('0x41')]['id']}},_0x368542={};_0x368542[_0x655d('0x2e')]=_[_0x655d('0x30')](db[_0x655d('0x2a')][_0x655d('0x42')]);_0x368542[_0x655d('0x31')]=_[_0x655d('0x30')](_0x51a765['query']);_0x368542['filters']=_['intersection'](_0x368542[_0x655d('0x2e')],_0x368542[_0x655d('0x31')]);_0x53ae44[_0x655d('0x33')]=_[_0x655d('0x32')](_0x368542['model'],qs[_0x655d('0x34')](_0x51a765[_0x655d('0x31')][_0x655d('0x34')]));_0x53ae44['attributes']=_0x53ae44[_0x655d('0x33')][_0x655d('0x43')]?_0x53ae44[_0x655d('0x33')]:_0x368542[_0x655d('0x2e')];if(_0x51a765[_0x655d('0x31')][_0x655d('0x3e')]){_0x53ae44[_0x655d('0x3f')]=[{'all':!![]}];}_0x53ae44=_[_0x655d('0x3b')]({},_0x53ae44,_0x51a765['options']);return db[_0x655d('0x2a')][_0x655d('0x44')](_0x53ae44)['then'](handleEntityNotFound(_0x26fec9,null))[_0x655d('0x23')](respondWithResult(_0x26fec9,null))[_0x655d('0x45')](handleError(_0x26fec9,null));};exports['update']=function(_0x4ad791,_0x53d0f4){if(_0x4ad791[_0x655d('0x46')]['id']){delete _0x4ad791[_0x655d('0x46')]['id'];}return db[_0x655d('0x2a')][_0x655d('0x44')]({'where':{'id':_0x4ad791[_0x655d('0x41')]['id']}})[_0x655d('0x23')](handleEntityNotFound(_0x53d0f4,null))[_0x655d('0x23')](saveUpdates(_0x4ad791[_0x655d('0x46')],null))[_0x655d('0x23')](respondWithResult(_0x53d0f4,null))['catch'](handleError(_0x53d0f4,null));};exports[_0x655d('0x24')]=function(_0x53535b,_0x59a3f2){return db[_0x655d('0x2a')][_0x655d('0x44')]({'where':{'id':_0x53535b[_0x655d('0x41')]['id']}})[_0x655d('0x23')](handleEntityNotFound(_0x59a3f2,null))[_0x655d('0x23')](removeEntity(_0x59a3f2,null))[_0x655d('0x45')](handleError(_0x59a3f2,null));};exports[_0x655d('0x47')]=function(_0x2bcb3a,_0x5b5a67){var _0x240e2a={'key':_0x2bcb3a[_0x655d('0x46')][_0x655d('0x2d')]};if(_0x2bcb3a[_0x655d('0x46')][_0x655d('0x48')]){_0x240e2a[_0x655d('0x48')]=_0x2bcb3a[_0x655d('0x46')][_0x655d('0x48')];}else if(_0x2bcb3a[_0x655d('0x46')][_0x655d('0x49')]){_0x240e2a[_0x655d('0x49')]=_0x2bcb3a[_0x655d('0x46')][_0x655d('0x49')];}else if(_0x2bcb3a[_0x655d('0x46')][_0x655d('0x4a')]){_0x240e2a[_0x655d('0x4a')]=_0x2bcb3a['body'][_0x655d('0x4a')];}else if(_0x2bcb3a[_0x655d('0x46')]['ChatWebsiteId']){_0x240e2a[_0x655d('0x4b')]=_0x2bcb3a[_0x655d('0x46')][_0x655d('0x4b')];}return db[_0x655d('0x2a')][_0x655d('0x44')]({'where':_0x240e2a})[_0x655d('0x23')](function(_0x2e26c5){if(_0x2e26c5){throw new db['Sequelize'][(_0x655d('0x4c'))](_0x655d('0x4d'));}return db[_0x655d('0x2a')][_0x655d('0x47')](_0x2bcb3a[_0x655d('0x46')]);})['then'](function(_0x3e1353){var _0x548b4e=_0x2bcb3a[_0x655d('0x4e')]['get']({'plain':!![]});if(!_0x548b4e)throw new Error(_0x655d('0x4f'));if(_0x548b4e['role']===_0x655d('0x4e')){var _0x19d6ee=_0x3e1353[_0x655d('0x50')]({'plain':!![]});return db[_0x655d('0x51')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x548b4e['userProfileId']},'raw':!![]})[_0x655d('0x23')](function(_0x1e3f16){if(_0x1e3f16&&_0x1e3f16[_0x655d('0x52')]===0x0){return db[_0x655d('0x25')]['create']({'name':_0x19d6ee[_0x655d('0x28')],'resourceId':_0x19d6ee['id'],'type':_0x1e3f16[_0x655d('0x28')],'sectionId':_0x1e3f16['id']},{})[_0x655d('0x23')](function(){return _0x3e1353;});}else{return _0x3e1353;}})[_0x655d('0x45')](function(_0x1fc430){logger['error'](_0x655d('0x53'),_0x1fc430);throw _0x1fc430;});}return _0x3e1353;})[_0x655d('0x23')](respondWithResult(_0x5b5a67,0xc9))[_0x655d('0x45')](handleError(_0x5b5a67,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index cc15406..b9a852a 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 _0xa647=['define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','bluebird','request-promise','./cannedAnswer.attributes','exports'];(function(_0xcd85db,_0x2d7545){var _0x33b3c4=function(_0x51431b){while(--_0x51431b){_0xcd85db['push'](_0xcd85db['shift']());}};_0x33b3c4(++_0x2d7545);}(_0xa647,0x18a));var _0x7a64=function(_0x255881,_0x3a1d4c){_0x255881=_0x255881-0x0;var _0x4bd5da=_0xa647[_0x255881];return _0x4bd5da;};'use strict';var _=require('lodash');var util=require(_0x7a64('0x0'));var logger=require(_0x7a64('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7a64('0x2'));var rp=require(_0x7a64('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a64('0x4'));module[_0x7a64('0x5')]=function(_0x15cd4d,_0x552f60){return _0x15cd4d[_0x7a64('0x6')](_0x7a64('0x7'),attributes,{'tableName':_0x7a64('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a64('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2657=['define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x2657,0x65));var _0x7265=function(_0x11591e,_0x52781d){_0x11591e=_0x11591e-0x0;var _0x1b9037=_0x2657[_0x11591e];return _0x1b9037;};'use strict';var _=require(_0x7265('0x0'));var util=require(_0x7265('0x1'));var logger=require(_0x7265('0x2'))(_0x7265('0x3'));var moment=require('moment');var BPromise=require(_0x7265('0x4'));var rp=require(_0x7265('0x5'));var fs=require('fs');var path=require(_0x7265('0x6'));var rimraf=require(_0x7265('0x7'));var config=require(_0x7265('0x8'));var attributes=require(_0x7265('0x9'));module[_0x7265('0xa')]=function(_0x192d9e,_0x1e4cd9){return _0x192d9e[_0x7265('0xb')](_0x7265('0xc'),attributes,{'tableName':_0x7265('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7265('0xe'),'collate':_0x7265('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 83c5ead..d839c41 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(_0x315906,_0x4fbcb8){var _0x1012db=function(_0x18a151){while(--_0x18a151){_0x315906['push'](_0x315906['shift']());}};_0x1012db(++_0x4fbcb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x4c7b64,_0x423e21){var _0x5e0d2c=function(_0x594175){while(--_0x594175){_0x4c7b64['push'](_0x4c7b64['shift']());}};_0x5e0d2c(++_0x423e21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 a0691bc..7b46d80 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 _0xd516=['delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x35fe11,_0x5317e6){var _0x8b67e1=function(_0x340d3a){while(--_0x340d3a){_0x35fe11['push'](_0x35fe11['shift']());}};_0x8b67e1(++_0x5317e6);}(_0xd516,0x18a));var _0x6d51=function(_0x2f8729,_0x3ded97){_0x2f8729=_0x2f8729-0x0;var _0x449450=_0xd516[_0x2f8729];return _0x449450;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d51('0x0'));var timeout=require(_0x6d51('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6d51('0x2'));var auth=require(_0x6d51('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6d51('0x4'));var controller=require(_0x6d51('0x5'));router[_0x6d51('0x6')]('/',auth[_0x6d51('0x7')](),controller[_0x6d51('0x8')]);router[_0x6d51('0x6')](_0x6d51('0x9'),auth[_0x6d51('0x7')](),controller[_0x6d51('0xa')]);router[_0x6d51('0xb')]('/',auth[_0x6d51('0x7')](),controller[_0x6d51('0xc')]);router[_0x6d51('0xd')](_0x6d51('0x9'),auth[_0x6d51('0x7')](),controller['update']);router[_0x6d51('0xe')](_0x6d51('0x9'),auth[_0x6d51('0x7')](),controller[_0x6d51('0xf')]);module[_0x6d51('0x10')]=router; \ No newline at end of file +var _0xf5f0=['get','index','isAuthenticated','show','post','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller'];(function(_0x4620c7,_0x2927cf){var _0x5d4888=function(_0x58b904){while(--_0x58b904){_0x4620c7['push'](_0x4620c7['shift']());}};_0x5d4888(++_0x2927cf);}(_0xf5f0,0x75));var _0x0f5f=function(_0x46ef31,_0x4e5553){_0x46ef31=_0x46ef31-0x0;var _0x5f2ce7=_0xf5f0[_0x46ef31];return _0x5f2ce7;};'use strict';var multer=require(_0x0f5f('0x0'));var util=require(_0x0f5f('0x1'));var path=require(_0x0f5f('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f5f('0x3'));var router=express[_0x0f5f('0x4')]();var fs_extra=require(_0x0f5f('0x5'));var auth=require(_0x0f5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0f5f('0x7'));var controller=require(_0x0f5f('0x8'));router[_0x0f5f('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f5f('0xa')]);router[_0x0f5f('0x9')]('/:id',auth[_0x0f5f('0xb')](),controller[_0x0f5f('0xc')]);router[_0x0f5f('0xd')]('/',auth[_0x0f5f('0xb')](),controller['create']);router['put'](_0x0f5f('0xe'),auth[_0x0f5f('0xb')](),controller[_0x0f5f('0xf')]);router[_0x0f5f('0x10')](_0x0f5f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x0f5f('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 93e8263..4de76e9 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 _0xf69b=['exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0xf69b,0xc8));var _0xbf69=function(_0x45a9b8,_0x3e569d){_0x45a9b8=_0x45a9b8-0x0;var _0x35ad60=_0xf69b[_0x45a9b8];return _0x35ad60;};'use strict';var Sequelize=require('sequelize');module[_0xbf69('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xbf69('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xbf69('0x2')]},'dst':{'type':Sequelize[_0xbf69('0x2')]},'dcontext':{'type':Sequelize[_0xbf69('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xbf69('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xbf69('0x2')]},'duration':{'type':Sequelize[_0xbf69('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbf69('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbf69('0x2')]},'amaflags':{'type':Sequelize[_0xbf69('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xbf69('0x2')]},'userfield':{'type':Sequelize[_0xbf69('0x2')]},'uniqueid':{'type':Sequelize[_0xbf69('0x2')]},'linkedid':{'type':Sequelize[_0xbf69('0x2')]},'sequence':{'type':Sequelize[_0xbf69('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbf69('0x2')]},'tag':{'type':Sequelize[_0xbf69('0x2')]}}; \ No newline at end of file +var _0xc2e1=['DATE','STRING','INTEGER','sequelize'];(function(_0x31ccb5,_0x3961b8){var _0x42a464=function(_0x5e186d){while(--_0x5e186d){_0x31ccb5['push'](_0x31ccb5['shift']());}};_0x42a464(++_0x3961b8);}(_0xc2e1,0x1b3));var _0x1c2e=function(_0xd929ff,_0x47015d){_0xd929ff=_0xd929ff-0x0;var _0x57216d=_0xc2e1[_0xd929ff];return _0x57216d;};'use strict';var Sequelize=require(_0x1c2e('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x1c2e('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x1c2e('0x2')]},'dst':{'type':Sequelize[_0x1c2e('0x2')]},'dcontext':{'type':Sequelize[_0x1c2e('0x2')]},'channel':{'type':Sequelize[_0x1c2e('0x2')]},'dstchannel':{'type':Sequelize[_0x1c2e('0x2')]},'lastapp':{'type':Sequelize[_0x1c2e('0x2')]},'lastdata':{'type':Sequelize[_0x1c2e('0x2')]},'duration':{'type':Sequelize[_0x1c2e('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1c2e('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1c2e('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1c2e('0x2')]},'userfield':{'type':Sequelize[_0x1c2e('0x2')]},'uniqueid':{'type':Sequelize[_0x1c2e('0x2')]},'linkedid':{'type':Sequelize[_0x1c2e('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x1c2e('0x2')]},'type':{'type':Sequelize[_0x1c2e('0x2')]},'tag':{'type':Sequelize[_0x1c2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b4c7cd6..e87bfda 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 _0x4873=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','rawAttributes','type','key','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Cdr','catch','show','model','fields','includeAll','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x4873,0x1df));var _0x3487=function(_0x22757b,_0x3c27a3){_0x22757b=_0x22757b-0x0;var _0x365cd3=_0x4873[_0x22757b];return _0x365cd3;};'use strict';var emlformat=require(_0x3487('0x0'));var rimraf=require(_0x3487('0x1'));var zipdir=require(_0x3487('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3487('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3487('0x4'));var util=require(_0x3487('0x5'));var path=require(_0x3487('0x6'));var sox=require(_0x3487('0x7'));var csv=require(_0x3487('0x8'));var ejs=require(_0x3487('0x9'));var fs=require('fs');var fs_extra=require(_0x3487('0xa'));var _=require(_0x3487('0xb'));var squel=require('squel');var crypto=require(_0x3487('0xc'));var jsforce=require(_0x3487('0xd'));var deskjs=require(_0x3487('0xe'));var toCsv=require(_0x3487('0x8'));var querystring=require(_0x3487('0xf'));var Papa=require('papaparse');var Redis=require(_0x3487('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3487('0x11'));var as=require(_0x3487('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3487('0x13'));var utils=require(_0x3487('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3487('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557d64,_0x395774){_0x395774=_0x395774||0xcc;return function(_0x1be2e0){if(_0x1be2e0){return _0x557d64[_0x3487('0x16')](_0x395774);}return _0x557d64[_0x3487('0x17')](_0x395774)[_0x3487('0x18')]();};}function respondWithResult(_0x1e468b,_0x4fbd63){_0x4fbd63=_0x4fbd63||0xc8;return function(_0x23ce3b){if(_0x23ce3b){return _0x1e468b[_0x3487('0x17')](_0x4fbd63)[_0x3487('0x19')](_0x23ce3b);}};}function respondWithFilteredResult(_0x4f79f0,_0x156e80){return function(_0x1b19c4){if(_0x1b19c4){var _0x38c0c1=typeof _0x156e80[_0x3487('0x1a')]===_0x3487('0x1b')&&typeof _0x156e80[_0x3487('0x1c')]===_0x3487('0x1b');var _0x32ecde=_0x1b19c4[_0x3487('0x1d')];var _0x2fa630=_0x38c0c1?0x0:_0x156e80[_0x3487('0x1a')];var _0x41795b=_0x38c0c1?_0x1b19c4[_0x3487('0x1d')]:_0x156e80[_0x3487('0x1a')]+_0x156e80['limit'];var _0x320349;if(_0x41795b>=_0x32ecde){_0x41795b=_0x32ecde;_0x320349=0xc8;}else{_0x320349=0xce;}_0x4f79f0['status'](_0x320349);return _0x4f79f0[_0x3487('0x1e')](_0x3487('0x1f'),_0x2fa630+'-'+_0x41795b+'/'+_0x32ecde)[_0x3487('0x19')](_0x1b19c4);}return null;};}function patchUpdates(_0x29546f){return function(_0xd788f8){try{jsonpatch[_0x3487('0x20')](_0xd788f8,_0x29546f,!![]);}catch(_0x479354){return BPromise[_0x3487('0x21')](_0x479354);}return _0xd788f8[_0x3487('0x22')]();};}function saveUpdates(_0x28f8f7,_0x97013d){return function(_0x11437c){if(_0x11437c){return _0x11437c[_0x3487('0x23')](_0x28f8f7)['then'](function(_0x384792){return _0x384792;});}return null;};}function removeEntity(_0x3e63e8,_0x25ed9f){return function(_0x482551){if(_0x482551){return _0x482551['destroy']()[_0x3487('0x24')](function(){_0x3e63e8[_0x3487('0x17')](0xcc)[_0x3487('0x18')]();});}};}function handleEntityNotFound(_0x3a9d76,_0x4c6882){return function(_0x79a183){if(!_0x79a183){_0x3a9d76[_0x3487('0x16')](0x194);}return _0x79a183;};}function handleError(_0x5484f6,_0x1e7126){_0x1e7126=_0x1e7126||0x1f4;return function(_0x3fb245){logger['error'](_0x3fb245['stack']);if(_0x3fb245[_0x3487('0x25')]){delete _0x3fb245[_0x3487('0x25')];}_0x5484f6[_0x3487('0x17')](_0x1e7126)[_0x3487('0x26')](_0x3fb245);};}exports[_0x3487('0x27')]=function(_0x1a02d6,_0x1c5bd6){var _0x38af4a={},_0x25e123={},_0x4dada9={'count':0x0,'rows':[]};var _0x24532a=_['map'](db['Cdr'][_0x3487('0x28')],function(_0x56ee54){return{'name':_0x56ee54['fieldName'],'type':_0x56ee54[_0x3487('0x29')][_0x3487('0x2a')]};});_0x25e123['model']=_['map'](_0x24532a,_0x3487('0x25'));_0x25e123[_0x3487('0x2b')]=_[_0x3487('0x2c')](_0x1a02d6['query']);_0x25e123[_0x3487('0x2d')]=_['intersection'](_0x25e123['model'],_0x25e123['query']);_0x38af4a[_0x3487('0x2e')]=_[_0x3487('0x2f')](_0x25e123['model'],qs['fields'](_0x1a02d6[_0x3487('0x2b')]['fields']));_0x38af4a['attributes']=_0x38af4a[_0x3487('0x2e')][_0x3487('0x30')]?_0x38af4a[_0x3487('0x2e')]:_0x25e123['model'];if(!_0x1a02d6[_0x3487('0x2b')][_0x3487('0x31')](_0x3487('0x32'))){_0x38af4a[_0x3487('0x1c')]=qs['limit'](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x1c')]);_0x38af4a['offset']=qs[_0x3487('0x1a')](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x1a')]);}_0x38af4a[_0x3487('0x33')]=qs[_0x3487('0x34')](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x34')]);_0x38af4a[_0x3487('0x35')]=qs[_0x3487('0x2d')](_['pick'](_0x1a02d6[_0x3487('0x2b')],_0x25e123[_0x3487('0x2d')]),_0x24532a);if(_0x1a02d6['query']['filter']){_0x38af4a[_0x3487('0x35')]=_[_0x3487('0x36')](_0x38af4a[_0x3487('0x35')],{'$or':_['map'](_0x24532a,function(_0x58006c){if(_0x58006c['type']!==_0x3487('0x37')){var _0x268674={};_0x268674[_0x58006c['name']]={'$like':'%'+_0x1a02d6[_0x3487('0x2b')][_0x3487('0x38')]+'%'};return _0x268674;}})});}_0x38af4a=_[_0x3487('0x36')]({},_0x38af4a,_0x1a02d6[_0x3487('0x39')]);var _0x106393={'where':_0x38af4a[_0x3487('0x35')]};return db[_0x3487('0x3a')][_0x3487('0x1d')](_0x106393)[_0x3487('0x24')](function(_0x565cb2){_0x4dada9[_0x3487('0x1d')]=_0x565cb2;if(_0x1a02d6[_0x3487('0x2b')]['includeAll']){_0x38af4a['include']=[{'all':!![]}];}return db[_0x3487('0x3a')]['findAll'](_0x38af4a);})['then'](function(_0x3eb68c){_0x4dada9['rows']=_0x3eb68c;return _0x4dada9;})['then'](respondWithFilteredResult(_0x1c5bd6,_0x38af4a))[_0x3487('0x3b')](handleError(_0x1c5bd6,null));};exports[_0x3487('0x3c')]=function(_0x58a4c8,_0x51b69c){var _0xc04317={'raw':!![],'where':{'id':_0x58a4c8['params']['id']}},_0x8cd06f={};_0x8cd06f[_0x3487('0x3d')]=_[_0x3487('0x2c')](db['Cdr'][_0x3487('0x28')]);_0x8cd06f[_0x3487('0x2b')]=_[_0x3487('0x2c')](_0x58a4c8['query']);_0x8cd06f[_0x3487('0x2d')]=_[_0x3487('0x2f')](_0x8cd06f[_0x3487('0x3d')],_0x8cd06f[_0x3487('0x2b')]);_0xc04317[_0x3487('0x2e')]=_[_0x3487('0x2f')](_0x8cd06f[_0x3487('0x3d')],qs[_0x3487('0x3e')](_0x58a4c8['query'][_0x3487('0x3e')]));_0xc04317[_0x3487('0x2e')]=_0xc04317[_0x3487('0x2e')][_0x3487('0x30')]?_0xc04317[_0x3487('0x2e')]:_0x8cd06f[_0x3487('0x3d')];if(_0x58a4c8[_0x3487('0x2b')][_0x3487('0x3f')]){_0xc04317['include']=[{'all':!![]}];}_0xc04317=_['merge']({},_0xc04317,_0x58a4c8[_0x3487('0x39')]);return db[_0x3487('0x3a')][_0x3487('0x40')](_0xc04317)[_0x3487('0x24')](handleEntityNotFound(_0x51b69c,null))['then'](respondWithResult(_0x51b69c,null))['catch'](handleError(_0x51b69c,null));};exports[_0x3487('0x41')]=function(_0x122456,_0x3fe91f){return db[_0x3487('0x3a')][_0x3487('0x41')](_0x122456[_0x3487('0x42')],{})[_0x3487('0x24')](respondWithResult(_0x3fe91f,0xc9))[_0x3487('0x3b')](handleError(_0x3fe91f,null));};exports['update']=function(_0x585a44,_0x320351){if(_0x585a44[_0x3487('0x42')]['id']){delete _0x585a44['body']['id'];}return db[_0x3487('0x3a')]['find']({'where':{'id':_0x585a44['params']['id']}})[_0x3487('0x24')](handleEntityNotFound(_0x320351,null))[_0x3487('0x24')](saveUpdates(_0x585a44['body'],null))[_0x3487('0x24')](respondWithResult(_0x320351,null))[_0x3487('0x3b')](handleError(_0x320351,null));};exports[_0x3487('0x43')]=function(_0x4ab5f8,_0x761f95){return db[_0x3487('0x3a')][_0x3487('0x40')]({'where':{'id':_0x4ab5f8[_0x3487('0x44')]['id']}})['then'](handleEntityNotFound(_0x761f95,null))[_0x3487('0x24')](removeEntity(_0x761f95,null))[_0x3487('0x3b')](handleError(_0x761f95,null));};exports[_0x3487('0x45')]=function(_0x33e826,_0x11125d){return db[_0x3487('0x3a')][_0x3487('0x45')]()['then'](respondWithResult(_0x11125d,null))[_0x3487('0x3b')](handleError(_0x11125d,null));}; \ No newline at end of file +var _0x60c2=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','filters','filter','merge','where','VIRTUAL','options','includeAll','include','Cdr','findAll','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x492a80,_0x41796f){var _0x4d0941=function(_0x148c04){while(--_0x148c04){_0x492a80['push'](_0x492a80['shift']());}};_0x4d0941(++_0x41796f);}(_0x60c2,0x8f));var _0x260c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x60c2[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x260c('0x0'));var zipdir=require(_0x260c('0x1'));var jsonpatch=require(_0x260c('0x2'));var rp=require(_0x260c('0x3'));var moment=require(_0x260c('0x4'));var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require(_0x260c('0x9'));var csv=require(_0x260c('0xa'));var ejs=require(_0x260c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x260c('0xc'));var squel=require(_0x260c('0xd'));var crypto=require(_0x260c('0xe'));var jsforce=require(_0x260c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x260c('0xa'));var querystring=require(_0x260c('0x10'));var Papa=require(_0x260c('0x11'));var Redis=require(_0x260c('0x12'));var authService=require(_0x260c('0x13'));var qs=require(_0x260c('0x14'));var as=require(_0x260c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x16'))(_0x260c('0x17'));var utils=require(_0x260c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x19'));var db=require(_0x260c('0x1a'))['db'];function respondWithStatusCode(_0x191490,_0x5aed37){_0x5aed37=_0x5aed37||0xcc;return function(_0xc44e8d){if(_0xc44e8d){return _0x191490[_0x260c('0x1b')](_0x5aed37);}return _0x191490[_0x260c('0x1c')](_0x5aed37)[_0x260c('0x1d')]();};}function respondWithResult(_0x1d3775,_0x53df53){_0x53df53=_0x53df53||0xc8;return function(_0x3930b6){if(_0x3930b6){return _0x1d3775['status'](_0x53df53)[_0x260c('0x1e')](_0x3930b6);}};}function respondWithFilteredResult(_0x5a021c,_0x47edc1){return function(_0xd8b310){if(_0xd8b310){var _0x5299a4=typeof _0x47edc1[_0x260c('0x1f')]===_0x260c('0x20')&&typeof _0x47edc1[_0x260c('0x21')]===_0x260c('0x20');var _0x2bf3b8=_0xd8b310[_0x260c('0x22')];var _0x11e634=_0x5299a4?0x0:_0x47edc1[_0x260c('0x1f')];var _0x201e59=_0x5299a4?_0xd8b310[_0x260c('0x22')]:_0x47edc1[_0x260c('0x1f')]+_0x47edc1['limit'];var _0xd977b;if(_0x201e59>=_0x2bf3b8){_0x201e59=_0x2bf3b8;_0xd977b=0xc8;}else{_0xd977b=0xce;}_0x5a021c['status'](_0xd977b);return _0x5a021c[_0x260c('0x23')](_0x260c('0x24'),_0x11e634+'-'+_0x201e59+'/'+_0x2bf3b8)['json'](_0xd8b310);}return null;};}function patchUpdates(_0x1ccf81){return function(_0xe824db){try{jsonpatch[_0x260c('0x25')](_0xe824db,_0x1ccf81,!![]);}catch(_0x1c53e1){return BPromise[_0x260c('0x26')](_0x1c53e1);}return _0xe824db[_0x260c('0x27')]();};}function saveUpdates(_0x4b5b7a,_0xd5b7d8){return function(_0x158bc6){if(_0x158bc6){return _0x158bc6[_0x260c('0x28')](_0x4b5b7a)[_0x260c('0x29')](function(_0x58688c){return _0x58688c;});}return null;};}function removeEntity(_0x3f299f,_0x304961){return function(_0x461c8a){if(_0x461c8a){return _0x461c8a[_0x260c('0x2a')]()['then'](function(){_0x3f299f[_0x260c('0x1c')](0xcc)[_0x260c('0x1d')]();});}};}function handleEntityNotFound(_0x3bdfce,_0x29e10e){return function(_0x4cf0f9){if(!_0x4cf0f9){_0x3bdfce[_0x260c('0x1b')](0x194);}return _0x4cf0f9;};}function handleError(_0x2957e5,_0x480179){_0x480179=_0x480179||0x1f4;return function(_0x5def72){logger[_0x260c('0x2b')](_0x5def72[_0x260c('0x2c')]);if(_0x5def72[_0x260c('0x2d')]){delete _0x5def72[_0x260c('0x2d')];}_0x2957e5[_0x260c('0x1c')](_0x480179)[_0x260c('0x2e')](_0x5def72);};}exports['index']=function(_0xf1ad3e,_0x2e49dd){var _0x16b663={},_0x233a61={},_0x5993fd={'count':0x0,'rows':[]};var _0xc6868a=_[_0x260c('0x2f')](db['Cdr'][_0x260c('0x30')],function(_0xcb8c28){return{'name':_0xcb8c28[_0x260c('0x31')],'type':_0xcb8c28[_0x260c('0x32')][_0x260c('0x33')]};});_0x233a61[_0x260c('0x34')]=_[_0x260c('0x2f')](_0xc6868a,_0x260c('0x2d'));_0x233a61['query']=_[_0x260c('0x35')](_0xf1ad3e[_0x260c('0x36')]);_0x233a61['filters']=_[_0x260c('0x37')](_0x233a61['model'],_0x233a61['query']);_0x16b663['attributes']=_[_0x260c('0x37')](_0x233a61[_0x260c('0x34')],qs['fields'](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x38')]));_0x16b663[_0x260c('0x39')]=_0x16b663[_0x260c('0x39')][_0x260c('0x3a')]?_0x16b663[_0x260c('0x39')]:_0x233a61['model'];if(!_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3b')](_0x260c('0x3c'))){_0x16b663[_0x260c('0x21')]=qs[_0x260c('0x21')](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x21')]);_0x16b663[_0x260c('0x1f')]=qs[_0x260c('0x1f')](_0xf1ad3e['query'][_0x260c('0x1f')]);}_0x16b663['order']=qs['sort'](_0xf1ad3e['query']['sort']);_0x16b663['where']=qs['filters'](_['pick'](_0xf1ad3e[_0x260c('0x36')],_0x233a61[_0x260c('0x3d')]),_0xc6868a);if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3e')]){_0x16b663['where']=_[_0x260c('0x3f')](_0x16b663[_0x260c('0x40')],{'$or':_['map'](_0xc6868a,function(_0x35afd6){if(_0x35afd6[_0x260c('0x32')]!==_0x260c('0x41')){var _0x1dbc8a={};_0x1dbc8a[_0x35afd6[_0x260c('0x2d')]]={'$like':'%'+_0xf1ad3e['query']['filter']+'%'};return _0x1dbc8a;}})});}_0x16b663=_[_0x260c('0x3f')]({},_0x16b663,_0xf1ad3e[_0x260c('0x42')]);var _0x1de711={'where':_0x16b663[_0x260c('0x40')]};return db['Cdr'][_0x260c('0x22')](_0x1de711)[_0x260c('0x29')](function(_0x265bd8){_0x5993fd[_0x260c('0x22')]=_0x265bd8;if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x43')]){_0x16b663[_0x260c('0x44')]=[{'all':!![]}];}return db[_0x260c('0x45')][_0x260c('0x46')](_0x16b663);})[_0x260c('0x29')](function(_0x3392df){_0x5993fd[_0x260c('0x47')]=_0x3392df;return _0x5993fd;})[_0x260c('0x29')](respondWithFilteredResult(_0x2e49dd,_0x16b663))['catch'](handleError(_0x2e49dd,null));};exports['show']=function(_0x19ab59,_0x30b3f9){var _0xccd9c1={'raw':!![],'where':{'id':_0x19ab59[_0x260c('0x48')]['id']}},_0x50ed87={};_0x50ed87['model']=_['keys'](db[_0x260c('0x45')]['rawAttributes']);_0x50ed87[_0x260c('0x36')]=_[_0x260c('0x35')](_0x19ab59[_0x260c('0x36')]);_0x50ed87[_0x260c('0x3d')]=_['intersection'](_0x50ed87[_0x260c('0x34')],_0x50ed87[_0x260c('0x36')]);_0xccd9c1['attributes']=_[_0x260c('0x37')](_0x50ed87['model'],qs[_0x260c('0x38')](_0x19ab59[_0x260c('0x36')][_0x260c('0x38')]));_0xccd9c1['attributes']=_0xccd9c1[_0x260c('0x39')][_0x260c('0x3a')]?_0xccd9c1[_0x260c('0x39')]:_0x50ed87[_0x260c('0x34')];if(_0x19ab59[_0x260c('0x36')][_0x260c('0x43')]){_0xccd9c1[_0x260c('0x44')]=[{'all':!![]}];}_0xccd9c1=_[_0x260c('0x3f')]({},_0xccd9c1,_0x19ab59[_0x260c('0x42')]);return db[_0x260c('0x45')][_0x260c('0x49')](_0xccd9c1)[_0x260c('0x29')](handleEntityNotFound(_0x30b3f9,null))['then'](respondWithResult(_0x30b3f9,null))['catch'](handleError(_0x30b3f9,null));};exports[_0x260c('0x4a')]=function(_0x4517be,_0x18321f){return db[_0x260c('0x45')]['create'](_0x4517be[_0x260c('0x4b')],{})[_0x260c('0x29')](respondWithResult(_0x18321f,0xc9))[_0x260c('0x4c')](handleError(_0x18321f,null));};exports[_0x260c('0x28')]=function(_0x45175a,_0x1d0890){if(_0x45175a[_0x260c('0x4b')]['id']){delete _0x45175a[_0x260c('0x4b')]['id'];}return db[_0x260c('0x45')]['find']({'where':{'id':_0x45175a[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1d0890,null))['then'](saveUpdates(_0x45175a[_0x260c('0x4b')],null))['then'](respondWithResult(_0x1d0890,null))[_0x260c('0x4c')](handleError(_0x1d0890,null));};exports['destroy']=function(_0x4dcdca,_0x1e34fe){return db[_0x260c('0x45')][_0x260c('0x49')]({'where':{'id':_0x4dcdca[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1e34fe,null))[_0x260c('0x29')](removeEntity(_0x1e34fe,null))[_0x260c('0x4c')](handleError(_0x1e34fe,null));};exports['describe']=function(_0x12fbe5,_0x49b350){return db[_0x260c('0x45')][_0x260c('0x4d')]()[_0x260c('0x29')](respondWithResult(_0x49b350,null))[_0x260c('0x4c')](handleError(_0x49b350,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8dec25e..68e969c 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(_0xf60735,_0x35e352){var _0x2cb67b=function(_0x517812){while(--_0x517812){_0xf60735['push'](_0xf60735['shift']());}};_0x2cb67b(++_0x35e352);}(_0x7a54,0x106));var _0x47a5=function(_0xa858fb,_0x3d312c){_0xa858fb=_0xa858fb-0x0;var _0x4144c6=_0x7a54[_0xa858fb];return _0x4144c6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x24551b,_0x49b4e5){var _0x2a1b3b=function(_0x3d60a4){while(--_0x3d60a4){_0x24551b['push'](_0x24551b['shift']());}};_0x2a1b3b(++_0x49b4e5);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6fad9a6..d15a4c5 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 _0x2e7c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','randomstring','../../mysqldb'];(function(_0x2e3276,_0x38f0b7){var _0x91512e=function(_0x5e7d83){while(--_0x5e7d83){_0x2e3276['push'](_0x2e3276['shift']());}};_0x91512e(++_0x38f0b7);}(_0x2e7c,0x1a0));var _0xc2e7=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x2e7c[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var util=require(_0xc2e7('0x0'));var moment=require(_0xc2e7('0x1'));var BPromise=require('bluebird');var rs=require(_0xc2e7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2e7('0x3'))['db'];var utils=require(_0xc2e7('0x4'));var logger=require(_0xc2e7('0x5'))(_0xc2e7('0x6'));var config=require(_0xc2e7('0x7'));var jayson=require(_0xc2e7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3356f2,_0x5e6e7d,_0x473fb5){return new BPromise(function(_0x92468c,_0x3f15c1){return client[_0xc2e7('0x9')](_0x3356f2,_0x473fb5)[_0xc2e7('0xa')](function(_0x6e13ad){logger['info'](_0xc2e7('0xb'),_0x5e6e7d,_0xc2e7('0xc'));logger[_0xc2e7('0xd')](_0xc2e7('0xe'),_0x5e6e7d,'request\x20sent',JSON[_0xc2e7('0xf')](_0x6e13ad));if(_0x6e13ad[_0xc2e7('0x10')]){if(_0x6e13ad[_0xc2e7('0x10')][_0xc2e7('0x11')]===0x1f4){logger[_0xc2e7('0x10')](_0xc2e7('0xb'),_0x5e6e7d,_0x6e13ad['error'][_0xc2e7('0x12')]);return _0x3f15c1(_0x6e13ad[_0xc2e7('0x10')][_0xc2e7('0x12')]);}logger[_0xc2e7('0x10')]('Cdr,\x20%s,\x20%s',_0x5e6e7d,_0x6e13ad[_0xc2e7('0x10')][_0xc2e7('0x12')]);return _0x92468c(_0x6e13ad['error'][_0xc2e7('0x12')]);}else{logger[_0xc2e7('0x13')](_0xc2e7('0xb'),_0x5e6e7d,_0xc2e7('0xc'));_0x92468c(_0x6e13ad[_0xc2e7('0x14')][_0xc2e7('0x12')]);}})['catch'](function(_0x5a7a29){logger[_0xc2e7('0x10')](_0xc2e7('0xb'),_0x5e6e7d,_0x5a7a29);_0x3f15c1(_0x5a7a29);});});} \ No newline at end of file +var _0x5e99=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util'];(function(_0x401302,_0x5ec0ed){var _0x17980b=function(_0x1fedb2){while(--_0x1fedb2){_0x401302['push'](_0x401302['shift']());}};_0x17980b(++_0x5ec0ed);}(_0x5e99,0x19d));var _0x95e9=function(_0x3ebe63,_0x3f3270){_0x3ebe63=_0x3ebe63-0x0;var _0x5d224a=_0x5e99[_0x3ebe63];return _0x5d224a;};'use strict';var _=require('lodash');var util=require(_0x95e9('0x0'));var moment=require(_0x95e9('0x1'));var BPromise=require(_0x95e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95e9('0x3'));var db=require(_0x95e9('0x4'))['db'];var utils=require(_0x95e9('0x5'));var logger=require(_0x95e9('0x6'))(_0x95e9('0x7'));var config=require(_0x95e9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95e9('0x9')][_0x95e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ae99d,_0x483a10,_0x42bc36){return new BPromise(function(_0x57f58b,_0x2d267c){return client[_0x95e9('0xb')](_0x5ae99d,_0x42bc36)[_0x95e9('0xc')](function(_0x1e62c1){logger['info'](_0x95e9('0xd'),_0x483a10,_0x95e9('0xe'));logger[_0x95e9('0xf')](_0x95e9('0x10'),_0x483a10,_0x95e9('0xe'),JSON[_0x95e9('0x11')](_0x1e62c1));if(_0x1e62c1[_0x95e9('0x12')]){if(_0x1e62c1[_0x95e9('0x12')][_0x95e9('0x13')]===0x1f4){logger[_0x95e9('0x12')]('Cdr,\x20%s,\x20%s',_0x483a10,_0x1e62c1[_0x95e9('0x12')][_0x95e9('0x14')]);return _0x2d267c(_0x1e62c1[_0x95e9('0x12')][_0x95e9('0x14')]);}logger[_0x95e9('0x12')](_0x95e9('0xd'),_0x483a10,_0x1e62c1['error']['message']);return _0x57f58b(_0x1e62c1[_0x95e9('0x12')][_0x95e9('0x14')]);}else{logger[_0x95e9('0x15')]('Cdr,\x20%s,\x20%s',_0x483a10,_0x95e9('0xe'));_0x57f58b(_0x1e62c1[_0x95e9('0x16')][_0x95e9('0x14')]);}})['catch'](function(_0x29cb02){logger[_0x95e9('0x12')](_0x95e9('0xd'),_0x483a10,_0x29cb02);_0x2d267c(_0x29cb02);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d13a701..7625e58 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4554ad,_0x421cab){var _0x5e7a4b=function(_0x58a970){while(--_0x58a970){_0x4554ad['push'](_0x4554ad['shift']());}};_0x5e7a4b(++_0x421cab);}(_0xb10b,0x12a));var _0xbb10=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0xb10b[_0x39a04c];return _0x580cb0;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x53b67d,_0x251707){var _0xff73e7=function(_0x5bafe4){while(--_0x5bafe4){_0x53b67d['push'](_0x53b67d['shift']());}};_0xff73e7(++_0x251707);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index b8d3cc6..b03010c 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 _0xd2ca=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x41572d,_0x291843){var _0x29b3a0=function(_0x36722d){while(--_0x36722d){_0x41572d['push'](_0x41572d['shift']());}};_0x29b3a0(++_0x291843);}(_0xd2ca,0xba));var _0xad2c=function(_0xee4d62,_0x253508){_0xee4d62=_0xee4d62-0x0;var _0x5334fa=_0xd2ca[_0xee4d62];return _0x5334fa;};'use strict';var Sequelize=require('sequelize');module[_0xad2c('0x0')]={'priority':{'type':Sequelize[_0xad2c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xad2c('0x2')],'allowNull':![],'defaultValue':_0xad2c('0x3')},'appdata':{'type':Sequelize[_0xad2c('0x4')]()},'description':{'type':Sequelize[_0xad2c('0x2')]},'interval':{'type':Sequelize[_0xad2c('0x2')],'defaultValue':_0xad2c('0x5')}}; \ No newline at end of file +var _0x77bb=['exports','TEXT','STRING','sequelize'];(function(_0x28f09a,_0x21c19b){var _0x4a5c58=function(_0x3944d8){while(--_0x3944d8){_0x28f09a['push'](_0x28f09a['shift']());}};_0x4a5c58(++_0x21c19b);}(_0x77bb,0x83));var _0xb77b=function(_0xe0020b,_0x565773){_0xe0020b=_0xe0020b-0x0;var _0x21e5cb=_0x77bb[_0xe0020b];return _0x21e5cb;};'use strict';var Sequelize=require(_0xb77b('0x0'));module[_0xb77b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb77b('0x2')]()},'description':{'type':Sequelize[_0xb77b('0x3')]},'interval':{'type':Sequelize[_0xb77b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 97f5932..00d6e2d 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 _0x8482=['length','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','show','params','ChatApplication','rawAttributes','query','keys','filters','intersection','model','attributes','fields'];(function(_0x3c534a,_0x40a065){var _0x444aaa=function(_0x1753ea){while(--_0x1753ea){_0x3c534a['push'](_0x3c534a['shift']());}};_0x444aaa(++_0x40a065);}(_0x8482,0x14e));var _0x2848=function(_0x58571f,_0x4df597){_0x58571f=_0x58571f-0x0;var _0x5944d6=_0x8482[_0x58571f];return _0x5944d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2848('0x0'));var zipdir=require(_0x2848('0x1'));var jsonpatch=require(_0x2848('0x2'));var rp=require(_0x2848('0x3'));var moment=require(_0x2848('0x4'));var BPromise=require(_0x2848('0x5'));var Mustache=require(_0x2848('0x6'));var util=require(_0x2848('0x7'));var path=require(_0x2848('0x8'));var sox=require(_0x2848('0x9'));var csv=require('to-csv');var ejs=require(_0x2848('0xa'));var fs=require('fs');var fs_extra=require(_0x2848('0xb'));var _=require('lodash');var squel=require(_0x2848('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2848('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2848('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2848('0xf'));var as=require(_0x2848('0x10'));var hardwareService=require(_0x2848('0x11'));var logger=require(_0x2848('0x12'))(_0x2848('0x13'));var utils=require(_0x2848('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2848('0x15'))['db'];function respondWithStatusCode(_0x465380,_0xf0658d){_0xf0658d=_0xf0658d||0xcc;return function(_0x566a0b){if(_0x566a0b){return _0x465380[_0x2848('0x16')](_0xf0658d);}return _0x465380[_0x2848('0x17')](_0xf0658d)[_0x2848('0x18')]();};}function respondWithResult(_0x5e64c7,_0xbddd26){_0xbddd26=_0xbddd26||0xc8;return function(_0x501a0e){if(_0x501a0e){return _0x5e64c7[_0x2848('0x17')](_0xbddd26)['json'](_0x501a0e);}};}function respondWithFilteredResult(_0x1002d2,_0xeba65b){return function(_0x6600c5){if(_0x6600c5){var _0x59f39a=typeof _0xeba65b['offset']==='undefined'&&typeof _0xeba65b['limit']===_0x2848('0x19');var _0x1acd41=_0x6600c5[_0x2848('0x1a')];var _0x46755c=_0x59f39a?0x0:_0xeba65b[_0x2848('0x1b')];var _0x3b4eeb=_0x59f39a?_0x6600c5[_0x2848('0x1a')]:_0xeba65b[_0x2848('0x1b')]+_0xeba65b[_0x2848('0x1c')];var _0x193ffa;if(_0x3b4eeb>=_0x1acd41){_0x3b4eeb=_0x1acd41;_0x193ffa=0xc8;}else{_0x193ffa=0xce;}_0x1002d2[_0x2848('0x17')](_0x193ffa);return _0x1002d2['set'](_0x2848('0x1d'),_0x46755c+'-'+_0x3b4eeb+'/'+_0x1acd41)[_0x2848('0x1e')](_0x6600c5);}return null;};}function patchUpdates(_0x1a1f79){return function(_0x5748ae){try{jsonpatch[_0x2848('0x1f')](_0x5748ae,_0x1a1f79,!![]);}catch(_0x1f67a7){return BPromise[_0x2848('0x20')](_0x1f67a7);}return _0x5748ae[_0x2848('0x21')]();};}function saveUpdates(_0x3b99a2,_0x555279){return function(_0x3dd7db){if(_0x3dd7db){return _0x3dd7db[_0x2848('0x22')](_0x3b99a2)[_0x2848('0x23')](function(_0x436709){return _0x436709;});}return null;};}function removeEntity(_0xea4128,_0x40f510){return function(_0x5f38e2){if(_0x5f38e2){return _0x5f38e2[_0x2848('0x24')]()['then'](function(){_0xea4128[_0x2848('0x17')](0xcc)[_0x2848('0x18')]();});}};}function handleEntityNotFound(_0x2d936a,_0x4517d3){return function(_0x51c924){if(!_0x51c924){_0x2d936a[_0x2848('0x16')](0x194);}return _0x51c924;};}function handleError(_0xecd4f4,_0xdba069){_0xdba069=_0xdba069||0x1f4;return function(_0x2dc32e){logger[_0x2848('0x25')](_0x2dc32e[_0x2848('0x26')]);if(_0x2dc32e[_0x2848('0x27')]){delete _0x2dc32e['name'];}_0xecd4f4['status'](_0xdba069)['send'](_0x2dc32e);};}exports[_0x2848('0x28')]=function(_0x18df37,_0x3b9c0d){var _0x3f915b={'raw':!![],'where':{'id':_0x18df37[_0x2848('0x29')]['id']}},_0x189701={};_0x189701['model']=_['keys'](db[_0x2848('0x2a')][_0x2848('0x2b')]);_0x189701[_0x2848('0x2c')]=_[_0x2848('0x2d')](_0x18df37[_0x2848('0x2c')]);_0x189701[_0x2848('0x2e')]=_[_0x2848('0x2f')](_0x189701[_0x2848('0x30')],_0x189701[_0x2848('0x2c')]);_0x3f915b[_0x2848('0x31')]=_[_0x2848('0x2f')](_0x189701['model'],qs[_0x2848('0x32')](_0x18df37[_0x2848('0x2c')][_0x2848('0x32')]));_0x3f915b[_0x2848('0x31')]=_0x3f915b['attributes'][_0x2848('0x33')]?_0x3f915b[_0x2848('0x31')]:_0x189701[_0x2848('0x30')];if(_0x18df37[_0x2848('0x2c')]['includeAll']){_0x3f915b['include']=[{'all':!![]}];}_0x3f915b=_['merge']({},_0x3f915b,_0x18df37['options']);return db[_0x2848('0x2a')][_0x2848('0x34')](_0x3f915b)['then'](handleEntityNotFound(_0x3b9c0d,null))['then'](respondWithResult(_0x3b9c0d,null))[_0x2848('0x35')](handleError(_0x3b9c0d,null));};exports[_0x2848('0x22')]=function(_0x31a27d,_0x274b5a){if(_0x31a27d[_0x2848('0x36')]['id']){delete _0x31a27d['body']['id'];}return db[_0x2848('0x2a')][_0x2848('0x34')]({'where':{'id':_0x31a27d[_0x2848('0x29')]['id']}})['then'](handleEntityNotFound(_0x274b5a,null))[_0x2848('0x23')](saveUpdates(_0x31a27d[_0x2848('0x36')],null))[_0x2848('0x23')](respondWithResult(_0x274b5a,null))[_0x2848('0x35')](handleError(_0x274b5a,null));};exports[_0x2848('0x24')]=function(_0x510a53,_0x5578fe){return db[_0x2848('0x2a')][_0x2848('0x34')]({'where':{'id':_0x510a53[_0x2848('0x29')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x5578fe,null))[_0x2848('0x23')](removeEntity(_0x5578fe,null))[_0x2848('0x35')](handleError(_0x5578fe,null));}; \ No newline at end of file +var _0x3d9c=['../../config/license/util','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','destroy','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','include','options','find','then','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d9c,0x134));var _0xc3d9=function(_0x526625,_0x3b9f20){_0x526625=_0x526625-0x0;var _0x348e64=_0x3d9c[_0x526625];return _0x348e64;};'use strict';var emlformat=require(_0xc3d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3d9('0x1'));var jsonpatch=require(_0xc3d9('0x2'));var rp=require(_0xc3d9('0x3'));var moment=require('moment');var BPromise=require(_0xc3d9('0x4'));var Mustache=require(_0xc3d9('0x5'));var util=require(_0xc3d9('0x6'));var path=require(_0xc3d9('0x7'));var sox=require(_0xc3d9('0x8'));var csv=require(_0xc3d9('0x9'));var ejs=require(_0xc3d9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3d9('0xb'));var squel=require(_0xc3d9('0xc'));var crypto=require('crypto');var jsforce=require(_0xc3d9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc3d9('0x9'));var querystring=require(_0xc3d9('0xe'));var Papa=require(_0xc3d9('0xf'));var Redis=require('ioredis');var authService=require(_0xc3d9('0x10'));var qs=require(_0xc3d9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3d9('0x12'));var logger=require(_0xc3d9('0x13'))(_0xc3d9('0x14'));var utils=require(_0xc3d9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc3d9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x217c58,_0x140c1a){_0x140c1a=_0x140c1a||0xcc;return function(_0x2540a6){if(_0x2540a6){return _0x217c58['sendStatus'](_0x140c1a);}return _0x217c58[_0xc3d9('0x17')](_0x140c1a)[_0xc3d9('0x18')]();};}function respondWithResult(_0x5db23f,_0x58a361){_0x58a361=_0x58a361||0xc8;return function(_0x3571fa){if(_0x3571fa){return _0x5db23f['status'](_0x58a361)[_0xc3d9('0x19')](_0x3571fa);}};}function respondWithFilteredResult(_0x272b73,_0x2c7b04){return function(_0xd7c5de){if(_0xd7c5de){var _0x5b48f4=typeof _0x2c7b04['offset']==='undefined'&&typeof _0x2c7b04[_0xc3d9('0x1a')]===_0xc3d9('0x1b');var _0x15e429=_0xd7c5de['count'];var _0x29b9c9=_0x5b48f4?0x0:_0x2c7b04[_0xc3d9('0x1c')];var _0x46e416=_0x5b48f4?_0xd7c5de[_0xc3d9('0x1d')]:_0x2c7b04[_0xc3d9('0x1c')]+_0x2c7b04[_0xc3d9('0x1a')];var _0x21e41f;if(_0x46e416>=_0x15e429){_0x46e416=_0x15e429;_0x21e41f=0xc8;}else{_0x21e41f=0xce;}_0x272b73[_0xc3d9('0x17')](_0x21e41f);return _0x272b73['set'](_0xc3d9('0x1e'),_0x29b9c9+'-'+_0x46e416+'/'+_0x15e429)[_0xc3d9('0x19')](_0xd7c5de);}return null;};}function patchUpdates(_0x27483f){return function(_0x4a4f76){try{jsonpatch[_0xc3d9('0x1f')](_0x4a4f76,_0x27483f,!![]);}catch(_0xffa508){return BPromise[_0xc3d9('0x20')](_0xffa508);}return _0x4a4f76[_0xc3d9('0x21')]();};}function saveUpdates(_0xe163df,_0x2c0c9b){return function(_0x5465dd){if(_0x5465dd){return _0x5465dd[_0xc3d9('0x22')](_0xe163df)['then'](function(_0x49d1bb){return _0x49d1bb;});}return null;};}function removeEntity(_0x3b58a6,_0x106e9f){return function(_0x2ee926){if(_0x2ee926){return _0x2ee926[_0xc3d9('0x23')]()['then'](function(){_0x3b58a6[_0xc3d9('0x17')](0xcc)[_0xc3d9('0x18')]();});}};}function handleEntityNotFound(_0x30c357,_0x21fd30){return function(_0x2190f8){if(!_0x2190f8){_0x30c357['sendStatus'](0x194);}return _0x2190f8;};}function handleError(_0xb3ad76,_0x5103fa){_0x5103fa=_0x5103fa||0x1f4;return function(_0xe0c08f){logger['error'](_0xe0c08f[_0xc3d9('0x24')]);if(_0xe0c08f[_0xc3d9('0x25')]){delete _0xe0c08f[_0xc3d9('0x25')];}_0xb3ad76['status'](_0x5103fa)['send'](_0xe0c08f);};}exports[_0xc3d9('0x26')]=function(_0x4500d1,_0x2973d5){var _0x528326={'raw':!![],'where':{'id':_0x4500d1[_0xc3d9('0x27')]['id']}},_0x41d9c7={};_0x41d9c7[_0xc3d9('0x28')]=_[_0xc3d9('0x29')](db[_0xc3d9('0x2a')][_0xc3d9('0x2b')]);_0x41d9c7[_0xc3d9('0x2c')]=_[_0xc3d9('0x29')](_0x4500d1[_0xc3d9('0x2c')]);_0x41d9c7['filters']=_[_0xc3d9('0x2d')](_0x41d9c7[_0xc3d9('0x28')],_0x41d9c7[_0xc3d9('0x2c')]);_0x528326['attributes']=_['intersection'](_0x41d9c7['model'],qs[_0xc3d9('0x2e')](_0x4500d1[_0xc3d9('0x2c')]['fields']));_0x528326[_0xc3d9('0x2f')]=_0x528326[_0xc3d9('0x2f')][_0xc3d9('0x30')]?_0x528326[_0xc3d9('0x2f')]:_0x41d9c7[_0xc3d9('0x28')];if(_0x4500d1[_0xc3d9('0x2c')]['includeAll']){_0x528326[_0xc3d9('0x31')]=[{'all':!![]}];}_0x528326=_['merge']({},_0x528326,_0x4500d1[_0xc3d9('0x32')]);return db[_0xc3d9('0x2a')][_0xc3d9('0x33')](_0x528326)[_0xc3d9('0x34')](handleEntityNotFound(_0x2973d5,null))[_0xc3d9('0x34')](respondWithResult(_0x2973d5,null))[_0xc3d9('0x35')](handleError(_0x2973d5,null));};exports[_0xc3d9('0x22')]=function(_0xb860ec,_0x92dc19){if(_0xb860ec['body']['id']){delete _0xb860ec[_0xc3d9('0x36')]['id'];}return db[_0xc3d9('0x2a')][_0xc3d9('0x33')]({'where':{'id':_0xb860ec[_0xc3d9('0x27')]['id']}})['then'](handleEntityNotFound(_0x92dc19,null))['then'](saveUpdates(_0xb860ec[_0xc3d9('0x36')],null))['then'](respondWithResult(_0x92dc19,null))[_0xc3d9('0x35')](handleError(_0x92dc19,null));};exports[_0xc3d9('0x23')]=function(_0x20d82d,_0x189898){return db[_0xc3d9('0x2a')][_0xc3d9('0x33')]({'where':{'id':_0x20d82d[_0xc3d9('0x27')]['id']}})[_0xc3d9('0x34')](handleEntityNotFound(_0x189898,null))['then'](removeEntity(_0x189898,null))[_0xc3d9('0x35')](handleError(_0x189898,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d77ae08..bba7f74 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 _0xac65=['define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x29dd53,_0x144d41){var _0xe648cb=function(_0x3b0090){while(--_0x3b0090){_0x29dd53['push'](_0x29dd53['shift']());}};_0xe648cb(++_0x144d41);}(_0xac65,0x11d));var _0x5ac6=function(_0xd3be0c,_0x4a8727){_0xd3be0c=_0xd3be0c-0x0;var _0x8a2fd6=_0xac65[_0xd3be0c];return _0x8a2fd6;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var logger=require(_0x5ac6('0x2'))('api');var moment=require(_0x5ac6('0x3'));var BPromise=require(_0x5ac6('0x4'));var rp=require(_0x5ac6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var attributes=require(_0x5ac6('0x8'));module['exports']=function(_0x2da747,_0x38711d){return _0x2da747[_0x5ac6('0x9')](_0x5ac6('0xa'),attributes,{'tableName':_0x5ac6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ac6('0xc'),'collate':_0x5ac6('0xd')});}; \ No newline at end of file +var _0x5977=['path','../../config/environment','exports','chat_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0x5977,0xeb));var _0x7597=function(_0x58aead,_0x16459b){_0x58aead=_0x58aead-0x0;var _0x1e4538=_0x5977[_0x58aead];return _0x1e4538;};'use strict';var _=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var logger=require(_0x7597('0x2'))('api');var moment=require(_0x7597('0x3'));var BPromise=require(_0x7597('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7597('0x5'));var rimraf=require('rimraf');var config=require(_0x7597('0x6'));var attributes=require('./chatApplication.attributes');module[_0x7597('0x7')]=function(_0x3875e1,_0x5302c6){return _0x3875e1['define']('ChatApplication',attributes,{'tableName':_0x7597('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7597('0x9'),'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 9d8358d..6f9402c 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 _0x0e76=['result','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x16b994,_0x22872a){var _0xfc3e0f=function(_0x32d1d8){while(--_0x32d1d8){_0x16b994['push'](_0x16b994['shift']());}};_0xfc3e0f(++_0x22872a);}(_0x0e76,0x78));var _0x60e7=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x0e76[_0x4653f7];return _0x5454da;};'use strict';var _=require('lodash');var util=require(_0x60e7('0x0'));var moment=require(_0x60e7('0x1'));var BPromise=require(_0x60e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60e7('0x3'));var db=require(_0x60e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x60e7('0x5'));var config=require('../../config/environment');var jayson=require(_0x60e7('0x6'));var client=jayson[_0x60e7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56d914,_0xea9fe9,_0x360ddc){return new BPromise(function(_0x20b236,_0x1d1636){return client['request'](_0x56d914,_0x360ddc)['then'](function(_0x107dfa){logger[_0x60e7('0x8')](_0x60e7('0x9'),_0xea9fe9,_0x60e7('0xa'));logger['debug'](_0x60e7('0xb'),_0xea9fe9,_0x60e7('0xa'),JSON[_0x60e7('0xc')](_0x107dfa));if(_0x107dfa[_0x60e7('0xd')]){if(_0x107dfa[_0x60e7('0xd')][_0x60e7('0xe')]===0x1f4){logger[_0x60e7('0xd')](_0x60e7('0x9'),_0xea9fe9,_0x107dfa[_0x60e7('0xd')][_0x60e7('0xf')]);return _0x1d1636(_0x107dfa[_0x60e7('0xd')]['message']);}logger[_0x60e7('0xd')]('ChatApplication,\x20%s,\x20%s',_0xea9fe9,_0x107dfa[_0x60e7('0xd')][_0x60e7('0xf')]);return _0x20b236(_0x107dfa[_0x60e7('0xd')][_0x60e7('0xf')]);}else{logger[_0x60e7('0x8')](_0x60e7('0x9'),_0xea9fe9,'request\x20sent');_0x20b236(_0x107dfa[_0x60e7('0x10')][_0x60e7('0xf')]);}})['catch'](function(_0x5df500){logger[_0x60e7('0xd')]('ChatApplication,\x20%s,\x20%s',_0xea9fe9,_0x5df500);_0x1d1636(_0x5df500);});});} \ No newline at end of file +var _0xe3bd=['http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x182455,_0x162dfe){var _0x1b4bd6=function(_0x18bb58){while(--_0x18bb58){_0x182455['push'](_0x182455['shift']());}};_0x1b4bd6(++_0x162dfe);}(_0xe3bd,0x170));var _0xde3b=function(_0x699200,_0x39c101){_0x699200=_0x699200-0x0;var _0x266fd1=_0xe3bd[_0x699200];return _0x266fd1;};'use strict';var _=require('lodash');var util=require(_0xde3b('0x0'));var moment=require(_0xde3b('0x1'));var BPromise=require(_0xde3b('0x2'));var rs=require(_0xde3b('0x3'));var fs=require('fs');var Redis=require(_0xde3b('0x4'));var db=require(_0xde3b('0x5'))['db'];var utils=require(_0xde3b('0x6'));var logger=require('../../config/logger')(_0xde3b('0x7'));var config=require(_0xde3b('0x8'));var jayson=require(_0xde3b('0x9'));var client=jayson['client'][_0xde3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b06d3,_0x539177,_0x481cdc){return new BPromise(function(_0x37a01d,_0x26accc){return client[_0xde3b('0xb')](_0x4b06d3,_0x481cdc)['then'](function(_0x4af5cf){logger[_0xde3b('0xc')](_0xde3b('0xd'),_0x539177,_0xde3b('0xe'));logger['debug'](_0xde3b('0xf'),_0x539177,_0xde3b('0xe'),JSON[_0xde3b('0x10')](_0x4af5cf));if(_0x4af5cf[_0xde3b('0x11')]){if(_0x4af5cf[_0xde3b('0x11')]['code']===0x1f4){logger[_0xde3b('0x11')](_0xde3b('0xd'),_0x539177,_0x4af5cf['error'][_0xde3b('0x12')]);return _0x26accc(_0x4af5cf[_0xde3b('0x11')][_0xde3b('0x12')]);}logger[_0xde3b('0x11')](_0xde3b('0xd'),_0x539177,_0x4af5cf[_0xde3b('0x11')][_0xde3b('0x12')]);return _0x37a01d(_0x4af5cf['error'][_0xde3b('0x12')]);}else{logger['info'](_0xde3b('0xd'),_0x539177,_0xde3b('0xe'));_0x37a01d(_0x4af5cf[_0xde3b('0x13')][_0xde3b('0x12')]);}})[_0xde3b('0x14')](function(_0x46d364){logger[_0xde3b('0x11')](_0xde3b('0xd'),_0x539177,_0x46d364);_0x26accc(_0x46d364);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 2c3f028..c834a37 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 _0x0506=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','util','path','connect-timeout','express','Router'];(function(_0x3702a,_0x5520fc){var _0x376497=function(_0x561288){while(--_0x561288){_0x3702a['push'](_0x3702a['shift']());}};_0x376497(++_0x5520fc);}(_0x0506,0xa0));var _0x6050=function(_0x44e5fa,_0xfdba7){_0x44e5fa=_0x44e5fa-0x0;var _0x4911e3=_0x0506[_0x44e5fa];return _0x4911e3;};'use strict';var multer=require('multer');var util=require(_0x6050('0x0'));var path=require(_0x6050('0x1'));var timeout=require(_0x6050('0x2'));var express=require(_0x6050('0x3'));var router=express[_0x6050('0x4')]();var fs_extra=require(_0x6050('0x5'));var auth=require(_0x6050('0x6'));var interaction=require(_0x6050('0x7'));var config=require('../../config/environment');var controller=require(_0x6050('0x8'));router['get'](_0x6050('0x9'),auth[_0x6050('0xa')](),controller[_0x6050('0xb')]);router[_0x6050('0xc')]('/:id',auth[_0x6050('0xa')](),controller[_0x6050('0xd')]);router[_0x6050('0xe')](_0x6050('0x9'),auth[_0x6050('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xddc1=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','multer'];(function(_0x36494a,_0x3b4ad6){var _0x1f4695=function(_0x1a90e6){while(--_0x1a90e6){_0x36494a['push'](_0x36494a['shift']());}};_0x1f4695(++_0x3b4ad6);}(_0xddc1,0x1c6));var _0x1ddc=function(_0x5017e8,_0x44bf12){_0x5017e8=_0x5017e8-0x0;var _0x4f36f0=_0xddc1[_0x5017e8];return _0x4f36f0;};'use strict';var multer=require(_0x1ddc('0x0'));var util=require('util');var path=require(_0x1ddc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1ddc('0x2'));var auth=require(_0x1ddc('0x3'));var interaction=require(_0x1ddc('0x4'));var config=require(_0x1ddc('0x5'));var controller=require(_0x1ddc('0x6'));router[_0x1ddc('0x7')](_0x1ddc('0x8'),auth['isAuthenticated'](),controller[_0x1ddc('0x9')]);router[_0x1ddc('0xa')]('/:id',auth[_0x1ddc('0xb')](),controller[_0x1ddc('0xc')]);router['delete'](_0x1ddc('0x8'),auth['isAuthenticated'](),controller['destroy']);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 3c9962d..b12ed8f 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 _0x71b0=['STRING','sequelize','exports'];(function(_0x219b27,_0x5b3923){var _0x50a3ad=function(_0x19fb03){while(--_0x19fb03){_0x219b27['push'](_0x219b27['shift']());}};_0x50a3ad(++_0x5b3923);}(_0x71b0,0x1ba));var _0x071b=function(_0xbc2a54,_0x332598){_0xbc2a54=_0xbc2a54-0x0;var _0x1fe0f=_0x71b0[_0xbc2a54];return _0x1fe0f;};'use strict';var Sequelize=require(_0x071b('0x0'));module[_0x071b('0x1')]={'name':{'type':Sequelize[_0x071b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe6c0=['exports','STRING'];(function(_0x4b33c7,_0x4c7837){var _0x4adaff=function(_0x7eb867){while(--_0x7eb867){_0x4b33c7['push'](_0x4b33c7['shift']());}};_0x4adaff(++_0x4c7837);}(_0xe6c0,0x88));var _0x0e6c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xe6c0[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require('sequelize');module[_0x0e6c('0x0')]={'name':{'type':Sequelize[_0x0e6c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0e6c('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 113d3be..83fb69f 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 _0x27dc=['fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','send','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','ChatGroup','include','findAll','params','options','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','getMessages','$gte','eml-format','rimraf'];(function(_0x411b9e,_0x4003fb){var _0x549d96=function(_0x5e7975){while(--_0x5e7975){_0x411b9e['push'](_0x411b9e['shift']());}};_0x549d96(++_0x4003fb);}(_0x27dc,0x1ca));var _0xc27d=function(_0x2c0d2e,_0x32b789){_0x2c0d2e=_0x2c0d2e-0x0;var _0x296c6e=_0x27dc[_0x2c0d2e];return _0x296c6e;};'use strict';var emlformat=require(_0xc27d('0x0'));var rimraf=require(_0xc27d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc27d('0x2'));var rp=require(_0xc27d('0x3'));var moment=require(_0xc27d('0x4'));var BPromise=require(_0xc27d('0x5'));var Mustache=require(_0xc27d('0x6'));var util=require(_0xc27d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc27d('0x8'));var ejs=require(_0xc27d('0x9'));var fs=require('fs');var fs_extra=require(_0xc27d('0xa'));var _=require(_0xc27d('0xb'));var squel=require(_0xc27d('0xc'));var crypto=require('crypto');var jsforce=require(_0xc27d('0xd'));var deskjs=require(_0xc27d('0xe'));var toCsv=require(_0xc27d('0x8'));var querystring=require(_0xc27d('0xf'));var Papa=require(_0xc27d('0x10'));var Redis=require(_0xc27d('0x11'));var authService=require(_0xc27d('0x12'));var qs=require(_0xc27d('0x13'));var as=require(_0xc27d('0x14'));var hardwareService=require(_0xc27d('0x15'));var logger=require(_0xc27d('0x16'))(_0xc27d('0x17'));var utils=require('../../config/utils');var config=require(_0xc27d('0x18'));var licenseUtil=require(_0xc27d('0x19'));var db=require('../../mysqldb')['db'];config[_0xc27d('0x1a')]=_[_0xc27d('0x1b')](config[_0xc27d('0x1a')],{'host':_0xc27d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc27d('0x1d'))['register'](socket);function respondWithStatusCode(_0x37df05,_0x1834e5){_0x1834e5=_0x1834e5||0xcc;return function(_0x31b3fb){if(_0x31b3fb){return _0x37df05[_0xc27d('0x1e')](_0x1834e5);}return _0x37df05['status'](_0x1834e5)[_0xc27d('0x1f')]();};}function respondWithResult(_0x168f70,_0xacb475){_0xacb475=_0xacb475||0xc8;return function(_0x5131f9){if(_0x5131f9){return _0x168f70[_0xc27d('0x20')](_0xacb475)['json'](_0x5131f9);}};}function respondWithFilteredResult(_0x42ac94,_0x4bee1e){return function(_0x42f5dd){if(_0x42f5dd){var _0x402799=typeof _0x4bee1e[_0xc27d('0x21')]==='undefined'&&typeof _0x4bee1e[_0xc27d('0x22')]===_0xc27d('0x23');var _0x22fd99=_0x42f5dd[_0xc27d('0x24')];var _0x2ac515=_0x402799?0x0:_0x4bee1e[_0xc27d('0x21')];var _0x399456=_0x402799?_0x42f5dd[_0xc27d('0x24')]:_0x4bee1e[_0xc27d('0x21')]+_0x4bee1e[_0xc27d('0x22')];var _0x22a7fc;if(_0x399456>=_0x22fd99){_0x399456=_0x22fd99;_0x22a7fc=0xc8;}else{_0x22a7fc=0xce;}_0x42ac94[_0xc27d('0x20')](_0x22a7fc);return _0x42ac94[_0xc27d('0x25')](_0xc27d('0x26'),_0x2ac515+'-'+_0x399456+'/'+_0x22fd99)['json'](_0x42f5dd);}return null;};}function patchUpdates(_0x1d5c0f){return function(_0x329893){try{jsonpatch[_0xc27d('0x27')](_0x329893,_0x1d5c0f,!![]);}catch(_0x20f0d0){return BPromise['reject'](_0x20f0d0);}return _0x329893[_0xc27d('0x28')]();};}function saveUpdates(_0x47d646,_0x38ff56){return function(_0x41c140){if(_0x41c140){return _0x41c140[_0xc27d('0x29')](_0x47d646)['then'](function(_0x5016f6){return _0x5016f6;});}return null;};}function removeEntity(_0x51ee5c,_0x3b3142){return function(_0x1f48bc){if(_0x1f48bc){return _0x1f48bc[_0xc27d('0x2a')]()[_0xc27d('0x2b')](function(){_0x51ee5c[_0xc27d('0x20')](0xcc)[_0xc27d('0x1f')]();});}};}function handleEntityNotFound(_0x49a35f,_0x38cfe6){return function(_0x1ccbdb){if(!_0x1ccbdb){_0x49a35f[_0xc27d('0x1e')](0x194);}return _0x1ccbdb;};}function handleError(_0x2aaa4a,_0x434dd4){_0x434dd4=_0x434dd4||0x1f4;return function(_0x4a4da1){logger[_0xc27d('0x2c')](_0x4a4da1[_0xc27d('0x2d')]);if(_0x4a4da1['name']){delete _0x4a4da1['name'];}_0x2aaa4a['status'](_0x434dd4)[_0xc27d('0x2e')](_0x4a4da1);};}exports['index']=function(_0x439c31,_0x447bb4){var _0x16fc28={},_0x315201={},_0x45f7f9={'count':0x0,'rows':[]};var _0x2e92c9=_['map'](db['ChatGroup'][_0xc27d('0x2f')],function(_0x535247){return{'name':_0x535247[_0xc27d('0x30')],'type':_0x535247[_0xc27d('0x31')]['key']};});_0x315201[_0xc27d('0x32')]=_[_0xc27d('0x33')](_0x2e92c9,_0xc27d('0x34'));_0x315201[_0xc27d('0x35')]=_[_0xc27d('0x36')](_0x439c31['query']);_0x315201[_0xc27d('0x37')]=_[_0xc27d('0x38')](_0x315201['model'],_0x315201[_0xc27d('0x35')]);_0x16fc28[_0xc27d('0x39')]=_[_0xc27d('0x38')](_0x315201[_0xc27d('0x32')],qs['fields'](_0x439c31[_0xc27d('0x35')][_0xc27d('0x3a')]));_0x16fc28['attributes']=_0x16fc28['attributes'][_0xc27d('0x3b')]?_0x16fc28[_0xc27d('0x39')]:_0x315201[_0xc27d('0x32')];if(!_0x439c31[_0xc27d('0x35')][_0xc27d('0x3c')](_0xc27d('0x3d'))){_0x16fc28[_0xc27d('0x22')]=qs['limit'](_0x439c31[_0xc27d('0x35')][_0xc27d('0x22')]);_0x16fc28[_0xc27d('0x21')]=qs[_0xc27d('0x21')](_0x439c31[_0xc27d('0x35')][_0xc27d('0x21')]);}_0x16fc28[_0xc27d('0x3e')]=qs[_0xc27d('0x3f')](_0x439c31['query'][_0xc27d('0x3f')]);_0x16fc28['where']=qs['filters'](_[_0xc27d('0x40')](_0x439c31[_0xc27d('0x35')],_0x315201['filters']),_0x2e92c9);if(_0x439c31[_0xc27d('0x35')][_0xc27d('0x41')]){_0x16fc28[_0xc27d('0x42')]=_[_0xc27d('0x43')](_0x16fc28[_0xc27d('0x42')],{'$or':_[_0xc27d('0x33')](_0x2e92c9,function(_0x573087){if(_0x573087[_0xc27d('0x31')]!=='VIRTUAL'){var _0xa85e43={};_0xa85e43[_0x573087['name']]={'$like':'%'+_0x439c31[_0xc27d('0x35')][_0xc27d('0x41')]+'%'};return _0xa85e43;}})});}_0x16fc28=_[_0xc27d('0x43')]({},_0x16fc28,_0x439c31['options']);var _0x221f84={'where':_0x16fc28['where']};return db[_0xc27d('0x44')][_0xc27d('0x24')](_0x221f84)[_0xc27d('0x2b')](function(_0x525e34){_0x45f7f9[_0xc27d('0x24')]=_0x525e34;if(_0x439c31[_0xc27d('0x35')]['includeAll']){_0x16fc28[_0xc27d('0x45')]=[{'all':!![]}];}return db[_0xc27d('0x44')][_0xc27d('0x46')](_0x16fc28);})[_0xc27d('0x2b')](function(_0x5cc2f8){_0x45f7f9['rows']=_0x5cc2f8;return _0x45f7f9;})[_0xc27d('0x2b')](respondWithFilteredResult(_0x447bb4,_0x16fc28))['catch'](handleError(_0x447bb4,null));};exports['show']=function(_0x3246f0,_0x1e2fe8){var _0x1efa16={'raw':!![],'where':{'id':_0x3246f0[_0xc27d('0x47')]['id']}},_0x12c6f6={};_0x12c6f6[_0xc27d('0x32')]=_[_0xc27d('0x36')](db['ChatGroup'][_0xc27d('0x2f')]);_0x12c6f6[_0xc27d('0x35')]=_[_0xc27d('0x36')](_0x3246f0[_0xc27d('0x35')]);_0x12c6f6[_0xc27d('0x37')]=_[_0xc27d('0x38')](_0x12c6f6[_0xc27d('0x32')],_0x12c6f6[_0xc27d('0x35')]);_0x1efa16[_0xc27d('0x39')]=_[_0xc27d('0x38')](_0x12c6f6[_0xc27d('0x32')],qs[_0xc27d('0x3a')](_0x3246f0['query'][_0xc27d('0x3a')]));_0x1efa16[_0xc27d('0x39')]=_0x1efa16[_0xc27d('0x39')][_0xc27d('0x3b')]?_0x1efa16[_0xc27d('0x39')]:_0x12c6f6[_0xc27d('0x32')];if(_0x3246f0[_0xc27d('0x35')]['includeAll']){_0x1efa16[_0xc27d('0x45')]=[{'all':!![]}];}_0x1efa16=_[_0xc27d('0x43')]({},_0x1efa16,_0x3246f0[_0xc27d('0x48')]);return db['ChatGroup'][_0xc27d('0x49')](_0x1efa16)[_0xc27d('0x2b')](handleEntityNotFound(_0x1e2fe8,null))[_0xc27d('0x2b')](respondWithResult(_0x1e2fe8,null))[_0xc27d('0x4a')](handleError(_0x1e2fe8,null));};exports[_0xc27d('0x4b')]=function(_0x4f176b,_0x3abf87){return db['ChatGroup'][_0xc27d('0x4b')](_0x4f176b['body'],{})[_0xc27d('0x2b')](respondWithResult(_0x3abf87,0xc9))[_0xc27d('0x4a')](handleError(_0x3abf87,null));};exports[_0xc27d('0x29')]=function(_0x961d1b,_0x3a0210){if(_0x961d1b['body']['id']){delete _0x961d1b[_0xc27d('0x4c')]['id'];}return db[_0xc27d('0x44')][_0xc27d('0x49')]({'where':{'id':_0x961d1b[_0xc27d('0x47')]['id']}})[_0xc27d('0x2b')](handleEntityNotFound(_0x3a0210,null))[_0xc27d('0x2b')](saveUpdates(_0x961d1b[_0xc27d('0x4c')],null))['then'](respondWithResult(_0x3a0210,null))[_0xc27d('0x4a')](handleError(_0x3a0210,null));};exports[_0xc27d('0x2a')]=function(_0x3e5523,_0x526937){return db['ChatGroup'][_0xc27d('0x49')]({'where':{'id':_0x3e5523[_0xc27d('0x47')]['id']}})['then'](handleEntityNotFound(_0x526937,null))['then'](removeEntity(_0x526937,null))['catch'](handleError(_0x526937,null));};exports[_0xc27d('0x4d')]=function(_0x20cf62,_0x1551a9){return db[_0xc27d('0x44')][_0xc27d('0x4d')]()[_0xc27d('0x2b')](respondWithResult(_0x1551a9,null))['catch'](handleError(_0x1551a9,null));};exports[_0xc27d('0x4e')]=function(_0x471af8,_0x9b319e,_0x142ca2){return db[_0xc27d('0x4f')]['count']({'where':{'ChatGroupId':_0x471af8[_0xc27d('0x47')]['id'],'ToId':_0x471af8[_0xc27d('0x50')]['id'],'read':![]}})['then'](function(_0x21ac5f){return{'id':_[_0xc27d('0x51')](_0x471af8[_0xc27d('0x47')]['id']),'count':_0x21ac5f};})[_0xc27d('0x2b')](respondWithResult(_0x9b319e,null))[_0xc27d('0x4a')](handleError(_0x9b319e,null));};exports[_0xc27d('0x52')]=function(_0x207e60,_0x1b9faf,_0x1d76b8){return db['ChatGroup'][_0xc27d('0x49')]({'where':{'id':_0x207e60[_0xc27d('0x47')]['id']}})[_0xc27d('0x2b')](handleEntityNotFound(_0x1b9faf,null))[_0xc27d('0x2b')](function(_0x2e80b4){if(_0x2e80b4){return _0x2e80b4[_0xc27d('0x52')](_0x207e60[_0xc27d('0x4c')][_0xc27d('0x53')],_[_0xc27d('0x54')](_0x207e60[_0xc27d('0x4c')],[_0xc27d('0x53'),'id'])||{});}})[_0xc27d('0x2b')](respondWithResult(_0x1b9faf,null))[_0xc27d('0x4a')](handleError(_0x1b9faf,null));};exports[_0xc27d('0x55')]=function(_0x2bd98e,_0x498cbb,_0x39c463){var _0x468a9f={};var _0x57aa0a={};var _0x1ef6e8;var _0x1c40c8;return db['ChatGroup'][_0xc27d('0x56')]({'where':{'id':_0x2bd98e[_0xc27d('0x47')]['id']}})[_0xc27d('0x2b')](handleEntityNotFound(_0x498cbb,null))[_0xc27d('0x2b')](function(_0x1bba05){if(_0x1bba05){_0x1ef6e8=_0x1bba05;_0x57aa0a[_0xc27d('0x32')]=_['keys'](db[_0xc27d('0x57')][_0xc27d('0x2f')]);_0x57aa0a[_0xc27d('0x35')]=_[_0xc27d('0x36')](_0x2bd98e[_0xc27d('0x35')]);_0x57aa0a[_0xc27d('0x37')]=_[_0xc27d('0x38')](_0x57aa0a[_0xc27d('0x32')],_0x57aa0a[_0xc27d('0x35')]);_0x468a9f[_0xc27d('0x39')]=_['intersection'](_0x57aa0a[_0xc27d('0x32')],qs[_0xc27d('0x3a')](_0x2bd98e[_0xc27d('0x35')][_0xc27d('0x3a')]));_0x468a9f[_0xc27d('0x39')]=_0x468a9f[_0xc27d('0x39')][_0xc27d('0x3b')]?_0x468a9f[_0xc27d('0x39')]:_0x57aa0a[_0xc27d('0x32')];_0x468a9f[_0xc27d('0x3e')]=qs[_0xc27d('0x3f')](_0x2bd98e[_0xc27d('0x35')]['sort']);_0x468a9f[_0xc27d('0x42')]=qs[_0xc27d('0x37')](_[_0xc27d('0x40')](_0x2bd98e['query'],_0x57aa0a[_0xc27d('0x37')]));if(_0x2bd98e[_0xc27d('0x35')][_0xc27d('0x41')]){_0x468a9f[_0xc27d('0x42')]=_[_0xc27d('0x43')](_0x468a9f[_0xc27d('0x42')],{'$or':_[_0xc27d('0x33')](_0x468a9f[_0xc27d('0x39')],function(_0x215238){var _0x3d6811={};_0x3d6811[_0x215238]={'$like':'%'+_0x2bd98e[_0xc27d('0x35')]['filter']+'%'};return _0x3d6811;})});}_0x468a9f=_['merge']({},_0x468a9f,_0x2bd98e[_0xc27d('0x48')]);return _0x1ef6e8[_0xc27d('0x55')](_0x468a9f);}})[_0xc27d('0x2b')](function(_0x59fbbc){if(_0x59fbbc){_0x1c40c8=_0x59fbbc['length'];if(!_0x2bd98e[_0xc27d('0x35')][_0xc27d('0x3c')](_0xc27d('0x3d'))){_0x468a9f[_0xc27d('0x22')]=qs[_0xc27d('0x22')](_0x2bd98e['query']['limit']);_0x468a9f[_0xc27d('0x21')]=qs[_0xc27d('0x21')](_0x2bd98e[_0xc27d('0x35')][_0xc27d('0x21')]);}return _0x1ef6e8['getMembers'](_0x468a9f);}})['then'](function(_0x4dff46){if(_0x4dff46){return _0x4dff46?{'count':_0x1c40c8,'rows':_0x4dff46}:null;}})[_0xc27d('0x2b')](respondWithResult(_0x498cbb,null))[_0xc27d('0x4a')](handleError(_0x498cbb,null));};exports[_0xc27d('0x58')]=function(_0xfb1d75,_0xbf9361,_0x346096){return db[_0xc27d('0x44')][_0xc27d('0x49')]({'where':{'id':_0xfb1d75[_0xc27d('0x47')]['id']}})[_0xc27d('0x2b')](handleEntityNotFound(_0xbf9361,null))[_0xc27d('0x2b')](function(_0x244eec){if(_0x244eec){return _0x244eec[_0xc27d('0x58')](_0xfb1d75[_0xc27d('0x35')][_0xc27d('0x53')]);}})[_0xc27d('0x2b')](respondWithStatusCode(_0xbf9361,null))[_0xc27d('0x4a')](handleError(_0xbf9361,null));};exports[_0xc27d('0x59')]=function(_0x3a4c88,_0x2af9c5,_0xc8881b){if(_0x3a4c88[_0xc27d('0x4c')]['id']){delete _0x3a4c88[_0xc27d('0x4c')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x3a4c88[_0xc27d('0x47')]['id']}})[_0xc27d('0x2b')](handleEntityNotFound(_0x2af9c5,null))[_0xc27d('0x2b')](function(_0xe64eb5){if(_0xe64eb5){_0x3a4c88['body']['ChatGroupId']=_0xe64eb5['id'];return db[_0xc27d('0x4f')]['create'](_0x3a4c88[_0xc27d('0x4c')]);}})[_0xc27d('0x2b')](respondWithResult(_0x2af9c5,null))[_0xc27d('0x4a')](handleError(_0x2af9c5,null));};exports[_0xc27d('0x5a')]=function(_0x26a16f,_0x53c650,_0x3090cb){var _0x59cf1f={};var _0x5e2824={};var _0x4d526d;var _0x3c4df4;return db[_0xc27d('0x44')][_0xc27d('0x56')]({'where':{'id':_0x26a16f[_0xc27d('0x47')]['id']}})[_0xc27d('0x2b')](handleEntityNotFound(_0x53c650,null))['then'](function(_0x4af5f7){if(_0x4af5f7){_0x4d526d=_0x4af5f7;_0x5e2824[_0xc27d('0x32')]=_['keys'](db[_0xc27d('0x4f')]['rawAttributes']);_0x5e2824[_0xc27d('0x35')]=_[_0xc27d('0x36')](_0x26a16f[_0xc27d('0x35')]);_0x5e2824[_0xc27d('0x37')]=_[_0xc27d('0x38')](_0x5e2824[_0xc27d('0x32')],_0x5e2824[_0xc27d('0x35')]);_0x59cf1f[_0xc27d('0x39')]=_[_0xc27d('0x38')](_0x5e2824[_0xc27d('0x32')],qs[_0xc27d('0x3a')](_0x26a16f['query'][_0xc27d('0x3a')]));_0x59cf1f[_0xc27d('0x39')]=_0x59cf1f[_0xc27d('0x39')][_0xc27d('0x3b')]?_0x59cf1f[_0xc27d('0x39')]:_0x5e2824['model'];_0x59cf1f['order']=qs[_0xc27d('0x3f')](_0x26a16f[_0xc27d('0x35')][_0xc27d('0x3f')]);_0x59cf1f['where']=qs['filters'](_[_0xc27d('0x40')](_0x26a16f[_0xc27d('0x35')],_0x5e2824[_0xc27d('0x37')]));if(_0x26a16f[_0xc27d('0x35')][_0xc27d('0x41')]){_0x59cf1f[_0xc27d('0x42')]=_[_0xc27d('0x43')](_0x59cf1f[_0xc27d('0x42')],{'$or':_[_0xc27d('0x33')](_0x59cf1f[_0xc27d('0x39')],function(_0x2e5307){var _0xd94bc4={};_0xd94bc4[_0x2e5307]={'$like':'%'+_0x26a16f['query'][_0xc27d('0x41')]+'%'};return _0xd94bc4;})});}if(_0x26a16f[_0xc27d('0x35')][_0xc27d('0x5b')]){var _0x33a71b=_0x26a16f[_0xc27d('0x35')]['$gte']['split'](',');var _0x24a79d={};_0x24a79d[_0x33a71b[0x0]]={'$gte':moment(_0x33a71b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x59cf1f[_0xc27d('0x42')]=_[_0xc27d('0x43')](_0x59cf1f[_0xc27d('0x42')],_0x24a79d);}_0x59cf1f=_[_0xc27d('0x43')]({},_0x59cf1f,_0x26a16f[_0xc27d('0x48')]);return _0x4d526d[_0xc27d('0x5a')](_0x59cf1f);}})[_0xc27d('0x2b')](function(_0x11d512){if(_0x11d512){_0x3c4df4=_0x11d512[_0xc27d('0x3b')];if(!_0x26a16f[_0xc27d('0x35')][_0xc27d('0x3c')](_0xc27d('0x3d'))){_0x59cf1f['limit']=qs[_0xc27d('0x22')](_0x26a16f['query'][_0xc27d('0x22')]);_0x59cf1f[_0xc27d('0x21')]=qs[_0xc27d('0x21')](_0x26a16f['query']['offset']);}return _0x4d526d[_0xc27d('0x5a')](_0x59cf1f);}})[_0xc27d('0x2b')](function(_0x1360e2){if(_0x1360e2){return _0x1360e2?{'count':_0x3c4df4,'rows':_0x1360e2}:null;}})['then'](respondWithResult(_0x53c650,null))[_0xc27d('0x4a')](handleError(_0x53c650,null));}; \ No newline at end of file +var _0x7b5f=['update','then','destroy','error','stack','index','ChatGroup','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','getMembers','findOne','User','filter','nolimit','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','localhost','socket.io-emitter','redis','./chatGroup.socket','sendStatus','end','json','offset','undefined','count','status','Content-Range','reject'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x7b5f,0x95));var _0xf7b5=function(_0x454703,_0x1c2682){_0x454703=_0x454703-0x0;var _0x4355ab=_0x7b5f[_0x454703];return _0x4355ab;};'use strict';var emlformat=require(_0xf7b5('0x0'));var rimraf=require(_0xf7b5('0x1'));var zipdir=require(_0xf7b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7b5('0x3'));var moment=require(_0xf7b5('0x4'));var BPromise=require(_0xf7b5('0x5'));var Mustache=require('mustache');var util=require(_0xf7b5('0x6'));var path=require(_0xf7b5('0x7'));var sox=require(_0xf7b5('0x8'));var csv=require(_0xf7b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7b5('0xa'));var squel=require(_0xf7b5('0xb'));var crypto=require(_0xf7b5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf7b5('0xd'));var toCsv=require(_0xf7b5('0x9'));var querystring=require(_0xf7b5('0xe'));var Papa=require('papaparse');var Redis=require(_0xf7b5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7b5('0x10'));var logger=require(_0xf7b5('0x11'))('api');var utils=require(_0xf7b5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7b5('0x13'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf7b5('0x14'),'port':0x18eb});var socket=require(_0xf7b5('0x15'))(new Redis(config[_0xf7b5('0x16')]));require(_0xf7b5('0x17'))['register'](socket);function respondWithStatusCode(_0x3b311c,_0x1f40c0){_0x1f40c0=_0x1f40c0||0xcc;return function(_0x4ba7f5){if(_0x4ba7f5){return _0x3b311c[_0xf7b5('0x18')](_0x1f40c0);}return _0x3b311c['status'](_0x1f40c0)[_0xf7b5('0x19')]();};}function respondWithResult(_0x2f6f95,_0x27ac90){_0x27ac90=_0x27ac90||0xc8;return function(_0x42fa00){if(_0x42fa00){return _0x2f6f95['status'](_0x27ac90)[_0xf7b5('0x1a')](_0x42fa00);}};}function respondWithFilteredResult(_0x45aa6a,_0x4fb638){return function(_0x1948d3){if(_0x1948d3){var _0x3b7ccf=typeof _0x4fb638[_0xf7b5('0x1b')]===_0xf7b5('0x1c')&&typeof _0x4fb638['limit']===_0xf7b5('0x1c');var _0x303405=_0x1948d3[_0xf7b5('0x1d')];var _0x2de4b3=_0x3b7ccf?0x0:_0x4fb638[_0xf7b5('0x1b')];var _0x48e09f=_0x3b7ccf?_0x1948d3[_0xf7b5('0x1d')]:_0x4fb638['offset']+_0x4fb638['limit'];var _0x2db777;if(_0x48e09f>=_0x303405){_0x48e09f=_0x303405;_0x2db777=0xc8;}else{_0x2db777=0xce;}_0x45aa6a[_0xf7b5('0x1e')](_0x2db777);return _0x45aa6a['set'](_0xf7b5('0x1f'),_0x2de4b3+'-'+_0x48e09f+'/'+_0x303405)[_0xf7b5('0x1a')](_0x1948d3);}return null;};}function patchUpdates(_0x4847b){return function(_0x466442){try{jsonpatch['apply'](_0x466442,_0x4847b,!![]);}catch(_0x5a3801){return BPromise[_0xf7b5('0x20')](_0x5a3801);}return _0x466442['save']();};}function saveUpdates(_0x2f7716,_0xaf7943){return function(_0x39731b){if(_0x39731b){return _0x39731b[_0xf7b5('0x21')](_0x2f7716)[_0xf7b5('0x22')](function(_0x83f4b8){return _0x83f4b8;});}return null;};}function removeEntity(_0x5561ba,_0x3a709a){return function(_0x51e35f){if(_0x51e35f){return _0x51e35f[_0xf7b5('0x23')]()[_0xf7b5('0x22')](function(){_0x5561ba['status'](0xcc)[_0xf7b5('0x19')]();});}};}function handleEntityNotFound(_0x4cdf5c,_0xbddf17){return function(_0x3c075b){if(!_0x3c075b){_0x4cdf5c['sendStatus'](0x194);}return _0x3c075b;};}function handleError(_0x570c0f,_0x1f05e6){_0x1f05e6=_0x1f05e6||0x1f4;return function(_0x2b40af){logger[_0xf7b5('0x24')](_0x2b40af[_0xf7b5('0x25')]);if(_0x2b40af['name']){delete _0x2b40af['name'];}_0x570c0f[_0xf7b5('0x1e')](_0x1f05e6)['send'](_0x2b40af);};}exports[_0xf7b5('0x26')]=function(_0x4cc7a3,_0x479bac){var _0x57ae07={},_0x2115e9={},_0x48c004={'count':0x0,'rows':[]};var _0x572237=_['map'](db[_0xf7b5('0x27')][_0xf7b5('0x28')],function(_0x3023c2){return{'name':_0x3023c2[_0xf7b5('0x29')],'type':_0x3023c2[_0xf7b5('0x2a')]['key']};});_0x2115e9[_0xf7b5('0x2b')]=_[_0xf7b5('0x2c')](_0x572237,_0xf7b5('0x2d'));_0x2115e9[_0xf7b5('0x2e')]=_[_0xf7b5('0x2f')](_0x4cc7a3[_0xf7b5('0x2e')]);_0x2115e9[_0xf7b5('0x30')]=_[_0xf7b5('0x31')](_0x2115e9[_0xf7b5('0x2b')],_0x2115e9[_0xf7b5('0x2e')]);_0x57ae07[_0xf7b5('0x32')]=_[_0xf7b5('0x31')](_0x2115e9[_0xf7b5('0x2b')],qs[_0xf7b5('0x33')](_0x4cc7a3['query'][_0xf7b5('0x33')]));_0x57ae07['attributes']=_0x57ae07[_0xf7b5('0x32')][_0xf7b5('0x34')]?_0x57ae07[_0xf7b5('0x32')]:_0x2115e9[_0xf7b5('0x2b')];if(!_0x4cc7a3[_0xf7b5('0x2e')][_0xf7b5('0x35')]('nolimit')){_0x57ae07[_0xf7b5('0x36')]=qs[_0xf7b5('0x36')](_0x4cc7a3['query'][_0xf7b5('0x36')]);_0x57ae07[_0xf7b5('0x1b')]=qs['offset'](_0x4cc7a3['query'][_0xf7b5('0x1b')]);}_0x57ae07[_0xf7b5('0x37')]=qs[_0xf7b5('0x38')](_0x4cc7a3[_0xf7b5('0x2e')]['sort']);_0x57ae07[_0xf7b5('0x39')]=qs[_0xf7b5('0x30')](_[_0xf7b5('0x3a')](_0x4cc7a3['query'],_0x2115e9[_0xf7b5('0x30')]),_0x572237);if(_0x4cc7a3['query']['filter']){_0x57ae07['where']=_[_0xf7b5('0x3b')](_0x57ae07[_0xf7b5('0x39')],{'$or':_[_0xf7b5('0x2c')](_0x572237,function(_0x25699e){if(_0x25699e['type']!=='VIRTUAL'){var _0x2ce4ef={};_0x2ce4ef[_0x25699e[_0xf7b5('0x2d')]]={'$like':'%'+_0x4cc7a3[_0xf7b5('0x2e')]['filter']+'%'};return _0x2ce4ef;}})});}_0x57ae07=_[_0xf7b5('0x3b')]({},_0x57ae07,_0x4cc7a3[_0xf7b5('0x3c')]);var _0x273d41={'where':_0x57ae07['where']};return db['ChatGroup'][_0xf7b5('0x1d')](_0x273d41)[_0xf7b5('0x22')](function(_0x2a86b4){_0x48c004[_0xf7b5('0x1d')]=_0x2a86b4;if(_0x4cc7a3[_0xf7b5('0x2e')][_0xf7b5('0x3d')]){_0x57ae07['include']=[{'all':!![]}];}return db['ChatGroup'][_0xf7b5('0x3e')](_0x57ae07);})['then'](function(_0x19ea52){_0x48c004[_0xf7b5('0x3f')]=_0x19ea52;return _0x48c004;})['then'](respondWithFilteredResult(_0x479bac,_0x57ae07))[_0xf7b5('0x40')](handleError(_0x479bac,null));};exports[_0xf7b5('0x41')]=function(_0x3f9b80,_0x538116){var _0x33c1ae={'raw':!![],'where':{'id':_0x3f9b80[_0xf7b5('0x42')]['id']}},_0x1615b4={};_0x1615b4[_0xf7b5('0x2b')]=_[_0xf7b5('0x2f')](db[_0xf7b5('0x27')][_0xf7b5('0x28')]);_0x1615b4[_0xf7b5('0x2e')]=_[_0xf7b5('0x2f')](_0x3f9b80[_0xf7b5('0x2e')]);_0x1615b4[_0xf7b5('0x30')]=_['intersection'](_0x1615b4['model'],_0x1615b4['query']);_0x33c1ae['attributes']=_[_0xf7b5('0x31')](_0x1615b4[_0xf7b5('0x2b')],qs[_0xf7b5('0x33')](_0x3f9b80[_0xf7b5('0x2e')]['fields']));_0x33c1ae[_0xf7b5('0x32')]=_0x33c1ae['attributes'][_0xf7b5('0x34')]?_0x33c1ae[_0xf7b5('0x32')]:_0x1615b4['model'];if(_0x3f9b80[_0xf7b5('0x2e')]['includeAll']){_0x33c1ae[_0xf7b5('0x43')]=[{'all':!![]}];}_0x33c1ae=_[_0xf7b5('0x3b')]({},_0x33c1ae,_0x3f9b80[_0xf7b5('0x3c')]);return db[_0xf7b5('0x27')][_0xf7b5('0x44')](_0x33c1ae)['then'](handleEntityNotFound(_0x538116,null))[_0xf7b5('0x22')](respondWithResult(_0x538116,null))[_0xf7b5('0x40')](handleError(_0x538116,null));};exports[_0xf7b5('0x45')]=function(_0x512d1b,_0x2bf14b){return db[_0xf7b5('0x27')][_0xf7b5('0x45')](_0x512d1b[_0xf7b5('0x46')],{})[_0xf7b5('0x22')](respondWithResult(_0x2bf14b,0xc9))[_0xf7b5('0x40')](handleError(_0x2bf14b,null));};exports[_0xf7b5('0x21')]=function(_0x1f38b9,_0x2ab240){if(_0x1f38b9[_0xf7b5('0x46')]['id']){delete _0x1f38b9[_0xf7b5('0x46')]['id'];}return db[_0xf7b5('0x27')][_0xf7b5('0x44')]({'where':{'id':_0x1f38b9[_0xf7b5('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ab240,null))[_0xf7b5('0x22')](saveUpdates(_0x1f38b9['body'],null))[_0xf7b5('0x22')](respondWithResult(_0x2ab240,null))[_0xf7b5('0x40')](handleError(_0x2ab240,null));};exports['destroy']=function(_0x4ea39e,_0x257a49){return db[_0xf7b5('0x27')][_0xf7b5('0x44')]({'where':{'id':_0x4ea39e['params']['id']}})[_0xf7b5('0x22')](handleEntityNotFound(_0x257a49,null))[_0xf7b5('0x22')](removeEntity(_0x257a49,null))[_0xf7b5('0x40')](handleError(_0x257a49,null));};exports[_0xf7b5('0x47')]=function(_0x58785d,_0x375429){return db[_0xf7b5('0x27')][_0xf7b5('0x47')]()[_0xf7b5('0x22')](respondWithResult(_0x375429,null))[_0xf7b5('0x40')](handleError(_0x375429,null));};exports[_0xf7b5('0x48')]=function(_0x4713ff,_0x1b070b,_0x70942c){return db[_0xf7b5('0x49')]['count']({'where':{'ChatGroupId':_0x4713ff[_0xf7b5('0x42')]['id'],'ToId':_0x4713ff[_0xf7b5('0x4a')]['id'],'read':![]}})[_0xf7b5('0x22')](function(_0x28f961){return{'id':_[_0xf7b5('0x4b')](_0x4713ff['params']['id']),'count':_0x28f961};})[_0xf7b5('0x22')](respondWithResult(_0x1b070b,null))['catch'](handleError(_0x1b070b,null));};exports['addMembers']=function(_0xaaa12b,_0xa2942f,_0x4a00f4){return db[_0xf7b5('0x27')][_0xf7b5('0x44')]({'where':{'id':_0xaaa12b['params']['id']}})['then'](handleEntityNotFound(_0xa2942f,null))['then'](function(_0x4f6a06){if(_0x4f6a06){return _0x4f6a06[_0xf7b5('0x4c')](_0xaaa12b[_0xf7b5('0x46')]['ids'],_[_0xf7b5('0x4d')](_0xaaa12b[_0xf7b5('0x46')],['ids','id'])||{});}})['then'](respondWithResult(_0xa2942f,null))[_0xf7b5('0x40')](handleError(_0xa2942f,null));};exports[_0xf7b5('0x4e')]=function(_0x1db8a1,_0x179c44,_0xa122c0){var _0x1da8be={};var _0xed6b17={};var _0x58b59b;var _0x222944;return db[_0xf7b5('0x27')][_0xf7b5('0x4f')]({'where':{'id':_0x1db8a1[_0xf7b5('0x42')]['id']}})[_0xf7b5('0x22')](handleEntityNotFound(_0x179c44,null))[_0xf7b5('0x22')](function(_0x549055){if(_0x549055){_0x58b59b=_0x549055;_0xed6b17[_0xf7b5('0x2b')]=_['keys'](db[_0xf7b5('0x50')]['rawAttributes']);_0xed6b17['query']=_[_0xf7b5('0x2f')](_0x1db8a1[_0xf7b5('0x2e')]);_0xed6b17[_0xf7b5('0x30')]=_[_0xf7b5('0x31')](_0xed6b17[_0xf7b5('0x2b')],_0xed6b17[_0xf7b5('0x2e')]);_0x1da8be[_0xf7b5('0x32')]=_[_0xf7b5('0x31')](_0xed6b17[_0xf7b5('0x2b')],qs[_0xf7b5('0x33')](_0x1db8a1['query'][_0xf7b5('0x33')]));_0x1da8be[_0xf7b5('0x32')]=_0x1da8be[_0xf7b5('0x32')][_0xf7b5('0x34')]?_0x1da8be[_0xf7b5('0x32')]:_0xed6b17[_0xf7b5('0x2b')];_0x1da8be[_0xf7b5('0x37')]=qs[_0xf7b5('0x38')](_0x1db8a1[_0xf7b5('0x2e')][_0xf7b5('0x38')]);_0x1da8be[_0xf7b5('0x39')]=qs[_0xf7b5('0x30')](_['pick'](_0x1db8a1[_0xf7b5('0x2e')],_0xed6b17['filters']));if(_0x1db8a1[_0xf7b5('0x2e')][_0xf7b5('0x51')]){_0x1da8be[_0xf7b5('0x39')]=_[_0xf7b5('0x3b')](_0x1da8be[_0xf7b5('0x39')],{'$or':_[_0xf7b5('0x2c')](_0x1da8be['attributes'],function(_0x29078e){var _0x291013={};_0x291013[_0x29078e]={'$like':'%'+_0x1db8a1[_0xf7b5('0x2e')][_0xf7b5('0x51')]+'%'};return _0x291013;})});}_0x1da8be=_['merge']({},_0x1da8be,_0x1db8a1[_0xf7b5('0x3c')]);return _0x58b59b[_0xf7b5('0x4e')](_0x1da8be);}})[_0xf7b5('0x22')](function(_0x2b215a){if(_0x2b215a){_0x222944=_0x2b215a['length'];if(!_0x1db8a1[_0xf7b5('0x2e')]['hasOwnProperty'](_0xf7b5('0x52'))){_0x1da8be[_0xf7b5('0x36')]=qs[_0xf7b5('0x36')](_0x1db8a1['query'][_0xf7b5('0x36')]);_0x1da8be[_0xf7b5('0x1b')]=qs['offset'](_0x1db8a1[_0xf7b5('0x2e')]['offset']);}return _0x58b59b[_0xf7b5('0x4e')](_0x1da8be);}})[_0xf7b5('0x22')](function(_0xcd0b4d){if(_0xcd0b4d){return _0xcd0b4d?{'count':_0x222944,'rows':_0xcd0b4d}:null;}})[_0xf7b5('0x22')](respondWithResult(_0x179c44,null))[_0xf7b5('0x40')](handleError(_0x179c44,null));};exports[_0xf7b5('0x53')]=function(_0x1c6b53,_0x2531d6,_0x2d1b2a){return db['ChatGroup'][_0xf7b5('0x44')]({'where':{'id':_0x1c6b53[_0xf7b5('0x42')]['id']}})[_0xf7b5('0x22')](handleEntityNotFound(_0x2531d6,null))[_0xf7b5('0x22')](function(_0x377cf3){if(_0x377cf3){return _0x377cf3['removeMembers'](_0x1c6b53[_0xf7b5('0x2e')]['ids']);}})[_0xf7b5('0x22')](respondWithStatusCode(_0x2531d6,null))[_0xf7b5('0x40')](handleError(_0x2531d6,null));};exports[_0xf7b5('0x54')]=function(_0x573569,_0x24504c,_0x5f2a42){if(_0x573569[_0xf7b5('0x46')]['id']){delete _0x573569[_0xf7b5('0x46')]['id'];}return db[_0xf7b5('0x27')][_0xf7b5('0x44')]({'where':{'id':_0x573569['params']['id']}})[_0xf7b5('0x22')](handleEntityNotFound(_0x24504c,null))[_0xf7b5('0x22')](function(_0x11f587){if(_0x11f587){_0x573569[_0xf7b5('0x46')][_0xf7b5('0x55')]=_0x11f587['id'];return db[_0xf7b5('0x49')][_0xf7b5('0x45')](_0x573569[_0xf7b5('0x46')]);}})[_0xf7b5('0x22')](respondWithResult(_0x24504c,null))[_0xf7b5('0x40')](handleError(_0x24504c,null));};exports['getMessages']=function(_0x1b67b7,_0x1d9d6e,_0x1cfbf1){var _0x21bc17={};var _0x31adaa={};var _0x322d2f;var _0x63f9fd;return db['ChatGroup']['findOne']({'where':{'id':_0x1b67b7['params']['id']}})[_0xf7b5('0x22')](handleEntityNotFound(_0x1d9d6e,null))[_0xf7b5('0x22')](function(_0x11a99f){if(_0x11a99f){_0x322d2f=_0x11a99f;_0x31adaa[_0xf7b5('0x2b')]=_[_0xf7b5('0x2f')](db['ChatInternalMessage'][_0xf7b5('0x28')]);_0x31adaa[_0xf7b5('0x2e')]=_[_0xf7b5('0x2f')](_0x1b67b7[_0xf7b5('0x2e')]);_0x31adaa[_0xf7b5('0x30')]=_[_0xf7b5('0x31')](_0x31adaa[_0xf7b5('0x2b')],_0x31adaa[_0xf7b5('0x2e')]);_0x21bc17['attributes']=_[_0xf7b5('0x31')](_0x31adaa[_0xf7b5('0x2b')],qs[_0xf7b5('0x33')](_0x1b67b7[_0xf7b5('0x2e')][_0xf7b5('0x33')]));_0x21bc17[_0xf7b5('0x32')]=_0x21bc17[_0xf7b5('0x32')][_0xf7b5('0x34')]?_0x21bc17[_0xf7b5('0x32')]:_0x31adaa[_0xf7b5('0x2b')];_0x21bc17[_0xf7b5('0x37')]=qs['sort'](_0x1b67b7[_0xf7b5('0x2e')][_0xf7b5('0x38')]);_0x21bc17[_0xf7b5('0x39')]=qs[_0xf7b5('0x30')](_['pick'](_0x1b67b7[_0xf7b5('0x2e')],_0x31adaa[_0xf7b5('0x30')]));if(_0x1b67b7[_0xf7b5('0x2e')][_0xf7b5('0x51')]){_0x21bc17['where']=_[_0xf7b5('0x3b')](_0x21bc17['where'],{'$or':_[_0xf7b5('0x2c')](_0x21bc17[_0xf7b5('0x32')],function(_0x4b0083){var _0x1442d9={};_0x1442d9[_0x4b0083]={'$like':'%'+_0x1b67b7[_0xf7b5('0x2e')][_0xf7b5('0x51')]+'%'};return _0x1442d9;})});}if(_0x1b67b7[_0xf7b5('0x2e')]['$gte']){var _0x505cbe=_0x1b67b7[_0xf7b5('0x2e')][_0xf7b5('0x56')][_0xf7b5('0x57')](',');var _0x21ef9c={};_0x21ef9c[_0x505cbe[0x0]]={'$gte':moment(_0x505cbe[0x1])[_0xf7b5('0x58')](_0xf7b5('0x59'))};_0x21bc17[_0xf7b5('0x39')]=_[_0xf7b5('0x3b')](_0x21bc17[_0xf7b5('0x39')],_0x21ef9c);}_0x21bc17=_[_0xf7b5('0x3b')]({},_0x21bc17,_0x1b67b7[_0xf7b5('0x3c')]);return _0x322d2f[_0xf7b5('0x5a')](_0x21bc17);}})[_0xf7b5('0x22')](function(_0x16f6a9){if(_0x16f6a9){_0x63f9fd=_0x16f6a9['length'];if(!_0x1b67b7[_0xf7b5('0x2e')][_0xf7b5('0x35')](_0xf7b5('0x52'))){_0x21bc17['limit']=qs[_0xf7b5('0x36')](_0x1b67b7[_0xf7b5('0x2e')][_0xf7b5('0x36')]);_0x21bc17['offset']=qs[_0xf7b5('0x1b')](_0x1b67b7['query']['offset']);}return _0x322d2f[_0xf7b5('0x5a')](_0x21bc17);}})[_0xf7b5('0x22')](function(_0x46f239){if(_0x46f239){return _0x46f239?{'count':_0x63f9fd,'rows':_0x46f239}:null;}})[_0xf7b5('0x22')](respondWithResult(_0x1d9d6e,null))[_0xf7b5('0x40')](handleError(_0x1d9d6e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 96dc07a..2a12987 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 _0x5e36=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2cb467,_0x3c459f){var _0x3f3bde=function(_0x38090a){while(--_0x38090a){_0x2cb467['push'](_0x2cb467['shift']());}};_0x3f3bde(++_0x3c459f);}(_0x5e36,0xc8));var _0x65e3=function(_0x141dc2,_0x5463ce){_0x141dc2=_0x141dc2-0x0;var _0xe38758=_0x5e36[_0x141dc2];return _0xe38758;};'use strict';var EventEmitter=require(_0x65e3('0x0'));var ChatGroup=require(_0x65e3('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65e3('0x2')](0x0);var events={'afterCreate':_0x65e3('0x3'),'afterUpdate':_0x65e3('0x4'),'afterDestroy':_0x65e3('0x5')};function emitEvent(_0x2e5411){return function(_0x12aad3,_0x795b2d,_0x431a4f){ChatGroupEvents[_0x65e3('0x6')](_0x2e5411+':'+_0x12aad3['id'],_0x12aad3);ChatGroupEvents['emit'](_0x2e5411,_0x12aad3);_0x431a4f(null);};}for(var e in events){if(events[_0x65e3('0x7')](e)){var event=events[e];ChatGroup[_0x65e3('0x8')](e,emitEvent(event));}}module[_0x65e3('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x5ae9=['hasOwnProperty','hook','exports','events','setMaxListeners','save','remove','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5ae9,0x19b));var _0x95ae=function(_0x19cd2a,_0x52bf9e){_0x19cd2a=_0x19cd2a-0x0;var _0x41f8b7=_0x5ae9[_0x19cd2a];return _0x41f8b7;};'use strict';var EventEmitter=require(_0x95ae('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x95ae('0x1')](0x0);var events={'afterCreate':_0x95ae('0x2'),'afterUpdate':'update','afterDestroy':_0x95ae('0x3')};function emitEvent(_0x43c580){return function(_0x559cb2,_0x22469d,_0x4a965c){ChatGroupEvents[_0x95ae('0x4')](_0x43c580+':'+_0x559cb2['id'],_0x559cb2);ChatGroupEvents[_0x95ae('0x4')](_0x43c580,_0x559cb2);_0x4a965c(null);};}for(var e in events){if(events[_0x95ae('0x5')](e)){var event=events[e];ChatGroup[_0x95ae('0x6')](e,emitEvent(event));}}module[_0x95ae('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index fce6345..9aeab3a 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 _0x2caf=['api','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2caf,0x141));var _0xf2ca=function(_0x52e01b,_0x19fed3){_0x52e01b=_0x52e01b-0x0;var _0x1b4aa8=_0x2caf[_0x52e01b];return _0x1b4aa8;};'use strict';var _=require(_0xf2ca('0x0'));var util=require(_0xf2ca('0x1'));var logger=require(_0xf2ca('0x2'))(_0xf2ca('0x3'));var moment=require('moment');var BPromise=require(_0xf2ca('0x4'));var rp=require(_0xf2ca('0x5'));var fs=require('fs');var path=require(_0xf2ca('0x6'));var rimraf=require(_0xf2ca('0x7'));var config=require('../../config/environment');var attributes=require(_0xf2ca('0x8'));module[_0xf2ca('0x9')]=function(_0x240206,_0x7c684d){return _0x240206['define'](_0xf2ca('0xa'),attributes,{'tableName':_0xf2ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd957=['ChatGroup','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./chatGroup.attributes','exports'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xd957,0x1a5));var _0x7d95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd957[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d95('0x0'));var util=require(_0x7d95('0x1'));var logger=require(_0x7d95('0x2'))('api');var moment=require(_0x7d95('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d95('0x4'));var fs=require('fs');var path=require(_0x7d95('0x5'));var rimraf=require(_0x7d95('0x6'));var config=require('../../config/environment');var attributes=require(_0x7d95('0x7'));module[_0x7d95('0x8')]=function(_0x1ca64b,_0x14ac21){return _0x1ca64b['define'](_0x7d95('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 469bd83..2520240 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 _0x8bda=['http','defaults','redis','localhost','socket.io-emitter','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8bda,0x104));var _0xa8bd=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x8bda[_0xf55e73];return _0x116b99;};'use strict';var _=require(_0xa8bd('0x0'));var util=require(_0xa8bd('0x1'));var moment=require(_0xa8bd('0x2'));var BPromise=require(_0xa8bd('0x3'));var rs=require(_0xa8bd('0x4'));var fs=require('fs');var Redis=require(_0xa8bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8bd('0x6'));var logger=require(_0xa8bd('0x7'))('rpc');var config=require(_0xa8bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8bd('0x9')][_0xa8bd('0xa')]({'port':0x232a});config['redis']=_[_0xa8bd('0xb')](config[_0xa8bd('0xc')],{'host':_0xa8bd('0xd'),'port':0x18eb});var socket=require(_0xa8bd('0xe'))(new Redis(config[_0xa8bd('0xc')]));require('./chatGroup.socket')[_0xa8bd('0xf')](socket);function respondWithRpcPromise(_0x47316a,_0x8253b4,_0x3bcc02){return new BPromise(function(_0x56dba9,_0xbff49b){return client[_0xa8bd('0x10')](_0x47316a,_0x3bcc02)['then'](function(_0x141d4f){logger[_0xa8bd('0x11')](_0xa8bd('0x12'),_0x8253b4,_0xa8bd('0x13'));logger[_0xa8bd('0x14')](_0xa8bd('0x15'),_0x8253b4,_0xa8bd('0x13'),JSON[_0xa8bd('0x16')](_0x141d4f));if(_0x141d4f[_0xa8bd('0x17')]){if(_0x141d4f[_0xa8bd('0x17')][_0xa8bd('0x18')]===0x1f4){logger[_0xa8bd('0x17')](_0xa8bd('0x12'),_0x8253b4,_0x141d4f[_0xa8bd('0x17')][_0xa8bd('0x19')]);return _0xbff49b(_0x141d4f['error'][_0xa8bd('0x19')]);}logger['error'](_0xa8bd('0x12'),_0x8253b4,_0x141d4f['error']['message']);return _0x56dba9(_0x141d4f[_0xa8bd('0x17')][_0xa8bd('0x19')]);}else{logger[_0xa8bd('0x11')](_0xa8bd('0x12'),_0x8253b4,'request\x20sent');_0x56dba9(_0x141d4f[_0xa8bd('0x1a')]['message']);}})['catch'](function(_0x57bdeb){logger['error'](_0xa8bd('0x12'),_0x8253b4,_0x57bdeb);_0xbff49b(_0x57bdeb);});});} \ No newline at end of file +var _0xf9fd=['stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','defaults','redis','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x243226,_0x3c42ef){var _0x375e75=function(_0x56c7d3){while(--_0x56c7d3){_0x243226['push'](_0x243226['shift']());}};_0x375e75(++_0x3c42ef);}(_0xf9fd,0x118));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var moment=require(_0xdf9f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf9f('0x3'));var fs=require('fs');var Redis=require(_0xdf9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf9f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdf9f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdf9f('0x7')][_0xdf9f('0x8')]({'port':0x232a});config['redis']=_[_0xdf9f('0x9')](config[_0xdf9f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf9f('0xb'))(new Redis(config[_0xdf9f('0xa')]));require('./chatGroup.socket')[_0xdf9f('0xc')](socket);function respondWithRpcPromise(_0x83167b,_0x20e4a2,_0x4a6e2c){return new BPromise(function(_0x3020c4,_0x452283){return client[_0xdf9f('0xd')](_0x83167b,_0x4a6e2c)[_0xdf9f('0xe')](function(_0x178b59){logger[_0xdf9f('0xf')](_0xdf9f('0x10'),_0x20e4a2,_0xdf9f('0x11'));logger['debug'](_0xdf9f('0x12'),_0x20e4a2,'request\x20sent',JSON[_0xdf9f('0x13')](_0x178b59));if(_0x178b59[_0xdf9f('0x14')]){if(_0x178b59[_0xdf9f('0x14')][_0xdf9f('0x15')]===0x1f4){logger[_0xdf9f('0x14')](_0xdf9f('0x10'),_0x20e4a2,_0x178b59[_0xdf9f('0x14')]['message']);return _0x452283(_0x178b59[_0xdf9f('0x14')][_0xdf9f('0x16')]);}logger[_0xdf9f('0x14')](_0xdf9f('0x10'),_0x20e4a2,_0x178b59['error'][_0xdf9f('0x16')]);return _0x3020c4(_0x178b59['error'][_0xdf9f('0x16')]);}else{logger[_0xdf9f('0xf')](_0xdf9f('0x10'),_0x20e4a2,_0xdf9f('0x11'));_0x3020c4(_0x178b59['result'][_0xdf9f('0x16')]);}})['catch'](function(_0x3ee1fc){logger[_0xdf9f('0x14')](_0xdf9f('0x10'),_0x20e4a2,_0x3ee1fc);_0x452283(_0x3ee1fc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0551a42..c1f2319 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 _0x3e6e=['./chatGroup.events','save','remove','update','emit','removeListener','chatGroup:'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x3e6e,0x134));var _0xe3e6=function(_0x35d3b9,_0x35c1e6){_0x35d3b9=_0x35d3b9-0x0;var _0x13910d=_0x3e6e[_0x35d3b9];return _0x13910d;};'use strict';var ChatGroupEvents=require(_0xe3e6('0x0'));var events=[_0xe3e6('0x1'),_0xe3e6('0x2'),_0xe3e6('0x3')];function createListener(_0x3211ad,_0x59fdbc){return function(_0x513cbe){_0x59fdbc[_0xe3e6('0x4')](_0x3211ad,_0x513cbe);};}function removeListener(_0x43eb57,_0x3ea1ce){return function(){ChatGroupEvents[_0xe3e6('0x5')](_0x43eb57,_0x3ea1ce);};}exports['register']=function(_0x4fd3f4){for(var _0x4435e1=0x0,_0x2c4ce2=events['length'];_0x4435e1<_0x2c4ce2;_0x4435e1++){var _0x8b4d60=events[_0x4435e1];var _0x5ccf46=createListener(_0xe3e6('0x6')+_0x8b4d60,_0x4fd3f4);ChatGroupEvents['on'](_0x8b4d60,_0x5ccf46);}}; \ No newline at end of file +var _0x8062=['update','length','./chatGroup.events','remove'];(function(_0x52fdaf,_0x56d9b1){var _0x5cf2b0=function(_0x26eb9f){while(--_0x26eb9f){_0x52fdaf['push'](_0x52fdaf['shift']());}};_0x5cf2b0(++_0x56d9b1);}(_0x8062,0x8a));var _0x2806=function(_0xda6ad8,_0x102e5e){_0xda6ad8=_0xda6ad8-0x0;var _0x513b3f=_0x8062[_0xda6ad8];return _0x513b3f;};'use strict';var ChatGroupEvents=require(_0x2806('0x0'));var events=['save',_0x2806('0x1'),_0x2806('0x2')];function createListener(_0x4bab78,_0x4c15d0){return function(_0x51b10d){_0x4c15d0['emit'](_0x4bab78,_0x51b10d);};}function removeListener(_0x419a34,_0x4e9c19){return function(){ChatGroupEvents['removeListener'](_0x419a34,_0x4e9c19);};}exports['register']=function(_0xa2b859){for(var _0x442a2e=0x0,_0x2719cc=events[_0x2806('0x3')];_0x442a2e<_0x2719cc;_0x442a2e++){var _0x895eea=events[_0x442a2e];var _0x21d8cf=createListener('chatGroup:'+_0x895eea,_0xa2b859);ChatGroupEvents['on'](_0x895eea,_0x21d8cf);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index dac8b25..488d3bb 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 _0xe8dc=['removeMembers','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','create','/:id/members','addMembers','post','addMessage','put','update','delete'];(function(_0x55b372,_0x4aaa3d){var _0x517e0a=function(_0x45a31c){while(--_0x45a31c){_0x55b372['push'](_0x55b372['shift']());}};_0x517e0a(++_0x4aaa3d);}(_0xe8dc,0x97));var _0xce8d=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0xe8dc[_0x216799];return _0x3661c3;};'use strict';var multer=require(_0xce8d('0x0'));var util=require(_0xce8d('0x1'));var path=require(_0xce8d('0x2'));var timeout=require('connect-timeout');var express=require(_0xce8d('0x3'));var router=express[_0xce8d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xce8d('0x5'));var interaction=require(_0xce8d('0x6'));var config=require(_0xce8d('0x7'));var controller=require('./chatGroup.controller');router[_0xce8d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xce8d('0x8')]('/describe',auth[_0xce8d('0x9')](),controller['describe']);router[_0xce8d('0x8')](_0xce8d('0xa'),auth['isAuthenticated'](),controller[_0xce8d('0xb')]);router[_0xce8d('0x8')](_0xce8d('0xc'),auth[_0xce8d('0x9')](),controller[_0xce8d('0xd')]);router[_0xce8d('0x8')]('/:id/members',auth[_0xce8d('0x9')](),controller[_0xce8d('0xe')]);router[_0xce8d('0x8')](_0xce8d('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth[_0xce8d('0x9')](),controller[_0xce8d('0x10')]);router['post'](_0xce8d('0x11'),auth[_0xce8d('0x9')](),controller[_0xce8d('0x12')]);router[_0xce8d('0x13')]('/:id/messages',auth[_0xce8d('0x9')](),controller[_0xce8d('0x14')]);router[_0xce8d('0x15')](_0xce8d('0xa'),auth[_0xce8d('0x9')](),controller[_0xce8d('0x16')]);router[_0xce8d('0x17')](_0xce8d('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xce8d('0x17')](_0xce8d('0x11'),auth[_0xce8d('0x9')](),controller[_0xce8d('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4b47=['describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x1190e3,_0x195efb){var _0x54dc96=function(_0x2da9ff){while(--_0x2da9ff){_0x1190e3['push'](_0x1190e3['shift']());}};_0x54dc96(++_0x195efb);}(_0x4b47,0x15c));var _0x74b4=function(_0x41c52d,_0x1ee6cb){_0x41c52d=_0x41c52d-0x0;var _0xa7ccc9=_0x4b47[_0x41c52d];return _0xa7ccc9;};'use strict';var multer=require('multer');var util=require(_0x74b4('0x0'));var path=require(_0x74b4('0x1'));var timeout=require(_0x74b4('0x2'));var express=require(_0x74b4('0x3'));var router=express[_0x74b4('0x4')]();var fs_extra=require(_0x74b4('0x5'));var auth=require(_0x74b4('0x6'));var interaction=require(_0x74b4('0x7'));var config=require(_0x74b4('0x8'));var controller=require('./chatGroup.controller');router[_0x74b4('0x9')]('/',auth['isAuthenticated'](),controller[_0x74b4('0xa')]);router['get']('/describe',auth[_0x74b4('0xb')](),controller[_0x74b4('0xc')]);router[_0x74b4('0x9')](_0x74b4('0xd'),auth[_0x74b4('0xb')](),controller[_0x74b4('0xe')]);router[_0x74b4('0x9')](_0x74b4('0xf'),auth[_0x74b4('0xb')](),controller[_0x74b4('0x10')]);router[_0x74b4('0x9')](_0x74b4('0x11'),auth[_0x74b4('0xb')](),controller[_0x74b4('0x12')]);router[_0x74b4('0x9')](_0x74b4('0x13'),auth[_0x74b4('0xb')](),controller[_0x74b4('0x14')]);router[_0x74b4('0x15')]('/',auth[_0x74b4('0xb')](),controller[_0x74b4('0x16')]);router['post'](_0x74b4('0x11'),auth[_0x74b4('0xb')](),controller['addMembers']);router[_0x74b4('0x15')](_0x74b4('0x13'),auth[_0x74b4('0xb')](),controller[_0x74b4('0x17')]);router[_0x74b4('0x18')](_0x74b4('0xd'),auth[_0x74b4('0xb')](),controller[_0x74b4('0x19')]);router[_0x74b4('0x1a')](_0x74b4('0xd'),auth[_0x74b4('0xb')](),controller[_0x74b4('0x1b')]);router[_0x74b4('0x1a')](_0x74b4('0x11'),auth[_0x74b4('0xb')](),controller[_0x74b4('0x1c')]);module[_0x74b4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 186c177..71c3957 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 _0x74f4=['sequelize','exports','INTEGER','ENUM','thumb','TEXT','STRING','long','DATE','out'];(function(_0x7855ae,_0x28e4e3){var _0x17c7d9=function(_0xe99597){while(--_0xe99597){_0x7855ae['push'](_0x7855ae['shift']());}};_0x17c7d9(++_0x28e4e3);}(_0x74f4,0xaa));var _0x474f=function(_0x586b36,_0x3b3662){_0x586b36=_0x586b36-0x0;var _0x125189=_0x74f4[_0x586b36];return _0x125189;};'use strict';var Sequelize=require(_0x474f('0x0'));module[_0x474f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x474f('0x2')]},'ratingType':{'type':Sequelize[_0x474f('0x3')]('star',_0x474f('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x474f('0x5')]},'pathTranscript':{'type':Sequelize[_0x474f('0x5')]},'mailTranscript':{'type':Sequelize[_0x474f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x474f('0x6')]},'secondDisposition':{'type':Sequelize[_0x474f('0x6')]},'thirdDisposition':{'type':Sequelize[_0x474f('0x6')]},'note':{'type':Sequelize[_0x474f('0x6')]},'browserName':{'type':Sequelize[_0x474f('0x6')]},'browserVersion':{'type':Sequelize[_0x474f('0x6')]},'osName':{'type':Sequelize[_0x474f('0x6')]},'osVersion':{'type':Sequelize[_0x474f('0x6')]},'deviceModel':{'type':Sequelize[_0x474f('0x6')]},'deviceVendor':{'type':Sequelize[_0x474f('0x6')]},'deviceType':{'type':Sequelize[_0x474f('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x474f('0x6')]},'formData':{'type':Sequelize[_0x474f('0x5')](_0x474f('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x474f('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x474f('0x3')]('in',_0x474f('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x474f('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x474f('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe28e=['DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x25858d,_0x5d2b57){var _0x41ef82=function(_0x12f829){while(--_0x12f829){_0x25858d['push'](_0x25858d['shift']());}};_0x41ef82(++_0x5d2b57);}(_0xe28e,0x1ba));var _0xee28=function(_0x5ae9c1,_0x1ff731){_0x5ae9c1=_0x5ae9c1-0x0;var _0x42b03e=_0xe28e[_0x5ae9c1];return _0x42b03e;};'use strict';var Sequelize=require(_0xee28('0x0'));module[_0xee28('0x1')]={'closed':{'type':Sequelize[_0xee28('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xee28('0x3')]},'ratingType':{'type':Sequelize[_0xee28('0x4')](_0xee28('0x5'),_0xee28('0x6')),'defaultValue':_0xee28('0x5')},'ratingMessage':{'type':Sequelize[_0xee28('0x7')]},'pathTranscript':{'type':Sequelize[_0xee28('0x7')]},'mailTranscript':{'type':Sequelize[_0xee28('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xee28('0x9')]},'disposition':{'type':Sequelize[_0xee28('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xee28('0x8')]},'note':{'type':Sequelize[_0xee28('0x8')]},'browserName':{'type':Sequelize[_0xee28('0x8')]},'browserVersion':{'type':Sequelize[_0xee28('0x8')]},'osName':{'type':Sequelize[_0xee28('0x8')]},'osVersion':{'type':Sequelize[_0xee28('0x8')]},'deviceModel':{'type':Sequelize[_0xee28('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xee28('0x8')]},'formData':{'type':Sequelize[_0xee28('0x7')]('long')},'read1stAt':{'type':Sequelize[_0xee28('0x9')]},'lastMsgAt':{'type':Sequelize[_0xee28('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee28('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xee28('0x8')]},'customerPort':{'type':Sequelize[_0xee28('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xee28('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xee28('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index bf43fd5..d595d5a 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 _0x9f62=['findAll','getMyMessages','addTags','setTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','firstName','lastName','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','.pdf','err','zip-dir','moment','bluebird','mustache','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','stack','name','send','render','merge','body','contact','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','talking','answered','unmanaged','abandoned','total','UserId','closed','waiting','disposition','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','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','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(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','user','sequelize','toString','ChatInteraction','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','o.fullname','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','params','includeAll','include','find','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','ValidationError','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','join','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','User','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','nolimit','sort','$gte','options'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x9f62,0x154));var _0x29f6=function(_0x6b14c7,_0x593b8){_0x6b14c7=_0x6b14c7-0x0;var _0x47668c=_0x9f62[_0x6b14c7];return _0x47668c;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x0'));var rp=require('request-promise');var moment=require(_0x29f6('0x1'));var BPromise=require(_0x29f6('0x2'));var Mustache=require(_0x29f6('0x3'));var util=require('util');var path=require('path');var ejs=require(_0x29f6('0x4'));var fs=require('fs');var _=require(_0x29f6('0x5'));var squel=require(_0x29f6('0x6'));var Redis=require(_0x29f6('0x7'));var qs=require('../../components/parsers/qs');var as=require(_0x29f6('0x8'));var pdf=require(_0x29f6('0x9'));var logger=require(_0x29f6('0xa'))(_0x29f6('0xb'));var config=require(_0x29f6('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x29f6('0xd'),'port':0x18eb});var socket=require(_0x29f6('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x29f6('0xf')](socket);var jayson=require(_0x29f6('0x10'));var client=jayson['client'][_0x29f6('0x11')]({'port':0x232b});var client9004=jayson[_0x29f6('0x12')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5b9b6a,_0x559585,_0x57b2d2,_0x2ae0e4){return new BPromise(function(_0x55cf4,_0x189344){var _0x11a1fd=_0x2ae0e4||client;return _0x11a1fd[_0x29f6('0x13')](_0x5b9b6a,_0x57b2d2)[_0x29f6('0x14')](function(_0x35d2e2){logger[_0x29f6('0x15')](_0x29f6('0x16'),_0x559585,_0x29f6('0x17'));logger[_0x29f6('0x18')](_0x29f6('0x19'),_0x559585,_0x29f6('0x17'),JSON[_0x29f6('0x1a')](_0x35d2e2));if(_0x35d2e2[_0x29f6('0x1b')]){if(_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x559585,_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x189344(_0x35d2e2[_0x29f6('0x1b')]['message']);}logger[_0x29f6('0x1b')](_0x29f6('0x16'),_0x559585,_0x35d2e2['error'][_0x29f6('0x1d')]);return _0x55cf4(_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1d')]);}else{logger[_0x29f6('0x15')](_0x29f6('0x16'),_0x559585,_0x29f6('0x17'));_0x55cf4(_0x35d2e2['result'][_0x29f6('0x1d')]);}})['catch'](function(_0x4acb15){logger[_0x29f6('0x1b')](_0x29f6('0x16'),_0x559585,_0x4acb15);_0x189344(_0x4acb15);});});}function respondWithStatusCode(_0x39c6b3,_0xafb5dd){_0xafb5dd=_0xafb5dd||0xcc;return function(_0x54ddeb){if(_0x54ddeb){return _0x39c6b3[_0x29f6('0x1e')](_0xafb5dd);}return _0x39c6b3['status'](_0xafb5dd)[_0x29f6('0x1f')]();};}function respondWithResult(_0xcce041,_0x4200cc){_0x4200cc=_0x4200cc||0xc8;return function(_0x1b80aa){if(_0x1b80aa){return _0xcce041['status'](_0x4200cc)[_0x29f6('0x20')](_0x1b80aa);}};}function respondWithFilteredResult(_0x4d494f,_0x47c385){return function(_0x1401fb){if(_0x1401fb){var _0x45f792=typeof _0x47c385[_0x29f6('0x21')]===_0x29f6('0x22')&&typeof _0x47c385[_0x29f6('0x23')]===_0x29f6('0x22');var _0x23c630=_0x1401fb['count'];var _0x2183b7=_0x45f792?0x0:_0x47c385[_0x29f6('0x21')];var _0x1ab8d8=_0x45f792?_0x1401fb[_0x29f6('0x24')]:_0x47c385[_0x29f6('0x21')]+_0x47c385[_0x29f6('0x23')];var _0x3790f5;if(_0x1ab8d8>=_0x23c630){_0x1ab8d8=_0x23c630;_0x3790f5=0xc8;}else{_0x3790f5=0xce;}_0x4d494f[_0x29f6('0x25')](_0x3790f5);return _0x4d494f[_0x29f6('0x26')](_0x29f6('0x27'),_0x2183b7+'-'+_0x1ab8d8+'/'+_0x23c630)[_0x29f6('0x20')](_0x1401fb);}return null;};}function saveUpdates(_0x1c3f0b){return function(_0x40c830){if(_0x40c830){return _0x40c830[_0x29f6('0x28')](_0x1c3f0b)[_0x29f6('0x14')](function(_0x218931){return _0x218931;});}return null;};}function removeEntity(_0x3a7249){return function(_0x5492c2){if(_0x5492c2){return _0x5492c2['destroy']()[_0x29f6('0x14')](function(){_0x3a7249['status'](0xcc)[_0x29f6('0x1f')]();});}};}function handleEntityNotFound(_0xc8d2c5){return function(_0x1e1bb6){if(!_0x1e1bb6){_0xc8d2c5[_0x29f6('0x1e')](0x194);}return _0x1e1bb6;};}function handleError(_0x5e5d89,_0x53e11f){_0x53e11f=_0x53e11f||0x1f4;return function(_0x1bde69){logger[_0x29f6('0x1b')](_0x1bde69[_0x29f6('0x29')]);if(_0x1bde69[_0x29f6('0x2a')]){delete _0x1bde69[_0x29f6('0x2a')];}_0x5e5d89[_0x29f6('0x25')](_0x53e11f)[_0x29f6('0x2b')](_0x1bde69);};}function getMustacheRender(_0x1c3f0f,_0xad83a3){return Mustache[_0x29f6('0x2c')](_0x1c3f0f,_[_0x29f6('0x2d')](_0xad83a3[_0x29f6('0x2e')],{'contact':_0xad83a3[_0x29f6('0x2f')],'message':_0xad83a3[_0x29f6('0x1d')],'agent':_0xad83a3['agent'],'interaction':_0xad83a3['interaction'],'account':_0xad83a3[_0x29f6('0x30')]}))||'';}function getInteractionUsers(_0x44cf19,_0x1cd62a){return new BPromise(function(_0x5416dc,_0x3e1e25){try{if(_0x1cd62a[_0x44cf19['id']]){_0x44cf19[_0x29f6('0x31')]=_[_0x29f6('0x32')](_0x1cd62a[_0x44cf19['id']],function(_0x27d945){return{'id':_0x27d945['id'],'fullname':_0x27d945[_0x29f6('0x33')]};});}}catch(_0x48fbd1){_0x3e1e25(_0x48fbd1);}_0x5416dc(_0x44cf19);});}function getInteractionTags(_0x7695ee,_0x2ad06f){return new BPromise(function(_0x2c3441,_0x1b51cc){try{if(_0x7695ee['TagIds']){_0x7695ee[_0x29f6('0x34')]=[];_0x7695ee[_0x29f6('0x35')][_0x29f6('0x36')](',')[_0x29f6('0x37')](function(_0x5ddc09){_0x7695ee['Tags'][_0x29f6('0x38')](_0x2ad06f[_0x5ddc09]);});}delete _0x7695ee['TagIds'];}catch(_0x10f077){_0x1b51cc(_0x10f077);}_0x2c3441(_0x7695ee);});}function updateChatInteraction(_0x551411,_0x3a1a75,_0x537210){return new BPromise(function(_0x34b1ea,_0x11fb2d){return getInteractionUsers(_0x551411,_0x537210)['then'](function(_0x1431fc){return getInteractionTags(_0x1431fc,_0x3a1a75);})['then'](function(_0x3f3475){return getStateInteraction(_0x3f3475);})[_0x29f6('0x14')](function(_0x4aea11){_0x34b1ea(_0x4aea11);})[_0x29f6('0x39')](function(_0xc6a6b1){_0x11fb2d(_0xc6a6b1);});});}function getStateInteraction(_0x2cad42){return new BPromise(function(_0x1e9d5a){_0x2cad42['waiting']=0x0;_0x2cad42[_0x29f6('0x3a')]=0x0;_0x2cad42[_0x29f6('0x3b')]=0x0;_0x2cad42[_0x29f6('0x3c')]=0x0;_0x2cad42[_0x29f6('0x3d')]=0x0;_0x2cad42[_0x29f6('0x3e')]=0x0;if(!_0x2cad42['closed']&&!_0x2cad42[_0x29f6('0x3f')]){_0x2cad42['waiting']+=0x1;}if(!_0x2cad42[_0x29f6('0x40')]&&_0x2cad42['UserId']){_0x2cad42[_0x29f6('0x3a')]+=0x1;if(_0x2cad42[_0x29f6('0x41')]){_0x2cad42['waiting']-=0x1;}}if(_0x2cad42[_0x29f6('0x40')]&&_0x2cad42[_0x29f6('0x42')]===_0x29f6('0x3d')){_0x2cad42[_0x29f6('0x3d')]+=0x1;if(_0x2cad42['waiting']){_0x2cad42[_0x29f6('0x41')]-=0x1;}}else if(_0x2cad42[_0x29f6('0x40')]&&!_0x2cad42[_0x29f6('0x3f')]&&_0x2cad42['disposition']){_0x2cad42[_0x29f6('0x3c')]+=0x1;if(_0x2cad42['waiting']){_0x2cad42[_0x29f6('0x41')]-=0x1;}}else if(_0x2cad42['closed']&&_0x2cad42['UserId']){_0x2cad42['answered']+=0x1;if(_0x2cad42[_0x29f6('0x3a')]){_0x2cad42[_0x29f6('0x3a')]-=0x1;}}_0x2cad42[_0x29f6('0x3e')]+=0x1;_0x1e9d5a(_0x2cad42);});}exports[_0x29f6('0x43')]=function(_0x19fd60,_0x270842){var _0x29b3f6={},_0x155ffb={},_0x352119={'count':0x0,'rows':[]};var _0x1bde93=_['map'](db['ChatInteraction'][_0x29f6('0x44')],function(_0x450e76){return{'name':_0x450e76[_0x29f6('0x45')],'type':_0x450e76[_0x29f6('0x46')]['key']};});_0x155ffb[_0x29f6('0x47')]=_[_0x29f6('0x32')](_0x1bde93,'name');_0x155ffb[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x19fd60[_0x29f6('0x48')]);_0x155ffb[_0x29f6('0x4a')]=_[_0x29f6('0x4b')](_0x155ffb[_0x29f6('0x47')],_0x155ffb[_0x29f6('0x48')]);_0x29b3f6[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x155ffb[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x19fd60[_0x29f6('0x48')]['fields']));_0x29b3f6[_0x29f6('0x4c')]=_0x29b3f6[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x29b3f6[_0x29f6('0x4c')]:_0x155ffb[_0x29f6('0x47')];if(!_0x19fd60['query'][_0x29f6('0x4f')]('nolimit')){_0x29b3f6['limit']=qs[_0x29f6('0x23')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x23')]);_0x29b3f6[_0x29f6('0x21')]=qs[_0x29f6('0x21')](_0x19fd60['query'][_0x29f6('0x21')]);}_0x29b3f6[_0x29f6('0x50')]=qs['sort'](_0x19fd60[_0x29f6('0x48')]['sort']);_0x29b3f6[_0x29f6('0x51')]=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x19fd60[_0x29f6('0x48')],_0x155ffb['filters']),_0x1bde93);var _0x199060=[];var _0xaa915c=squel[_0x29f6('0x53')]()[_0x29f6('0x54')]('id')[_0x29f6('0x54')](_0x29f6('0x2a'))[_0x29f6('0x54')]('color')[_0x29f6('0x55')](_0x29f6('0x56'));var _0x3bca11=squel[_0x29f6('0x53')]()[_0x29f6('0x54')](_0x29f6('0x57'))[_0x29f6('0x54')](_0x29f6('0x58'))[_0x29f6('0x54')](_0x29f6('0x59'))['from']('user_has_chat_interactions','ui')[_0x29f6('0x5a')](_0x29f6('0x5b'),'u',_0x29f6('0x5c'));var _0x5ab84e=squel[_0x29f6('0x53')]()['from']('chat_interactions','i')[_0x29f6('0x5a')](_0x29f6('0x5d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x29f6('0x5b'),'o',_0x29f6('0x5e'))[_0x29f6('0x5a')]('chat_websites','a',_0x29f6('0x5f'))[_0x29f6('0x5a')](_0x29f6('0x60'),'me',_0x29f6('0x61'))[_0x29f6('0x5a')](_0x29f6('0x62'),'it',_0x29f6('0x63'))[_0x29f6('0x5a')](_0x29f6('0x56'),'t',_0x29f6('0x64'));var _0x2d4c8d=squel[_0x29f6('0x65')]();var _0x434e04=[];var _0x5078d1=squel['expr']();var _0x2bd7d9;if(_0x19fd60['query'][_0x29f6('0x66')]){_0x2bd7d9=as[_0x29f6('0x67')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x66')]);var _0x2f757b=_0x2bd7d9['sqlOperator'];for(var _0x56c442=0x0;_0x56c442<_0x2bd7d9[_0x29f6('0x68')][_0x29f6('0x4e')];_0x56c442++){var _0x293f9d=_0x2bd7d9[_0x29f6('0x68')][_0x56c442];var _0x56342e='i';var _0x32291b=_['find'](_0x1bde93,['name',_0x293f9d[_0x29f6('0x54')]]);if(!_0x32291b){switch(_0x293f9d[_0x29f6('0x54')]){case'unreadMessages':if(_0x293f9d[_0x29f6('0x69')]==0x1){_0x5ab84e[_0x29f6('0x6a')]('`'+_0x293f9d['field']+_0x29f6('0x6b'));}else{_0x5ab84e[_0x29f6('0x6a')]('`'+_0x293f9d[_0x29f6('0x54')]+_0x29f6('0x6c'));}break;case _0x29f6('0x6d'):if(_0x293f9d[_0x29f6('0x6e')]===_0x29f6('0x6f')){if(_0x293f9d['value'][_0x29f6('0x36')]('\x20')['length']>0x1){_0x2d4c8d[_0x2f757b](_0x29f6('0x70'),qs['getFullTextValue'](_0x293f9d['value']),null);}else{var _0x1a3357='%'+_0x293f9d[_0x29f6('0x69')]+'%';_0x2d4c8d[_0x2f757b](_0x29f6('0x71'),_0x1a3357,_0x1a3357,_0x1a3357);}}else{_0x32291b=_['find'](_0x1bde93,[_0x29f6('0x2a'),_0x29f6('0x72')]);_0x293f9d[_0x29f6('0x54')]='ContactId';_0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b[_0x29f6('0x46')],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}break;case _0x29f6('0x76'):var _0x56f3cb=_0x293f9d[_0x29f6('0x69')][_0x29f6('0x36')](',')[_0x29f6('0x32')](function(_0x456578){return Number(_0x456578);});_0x56f3cb[_0x29f6('0x37')](function(_0x122a1a){_0x5078d1['or'](_0x29f6('0x77'),'%,'+_0x122a1a+',%');});_0x434e04=_[_0x29f6('0x78')](_0x434e04,_0x56f3cb);break;case'User':if(_0x293f9d[_0x29f6('0x6e')]===_0x29f6('0x6f')){_0x2d4c8d[_0x2f757b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x293f9d[_0x29f6('0x69')]+'%',null);}else{_0x32291b=_['find'](_0x1bde93,[_0x29f6('0x2a'),_0x29f6('0x3f')]);_0x293f9d['field']=_0x29f6('0x3f');_0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b['type'],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e['text'],_0x411f3e['value'][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}break;case _0x29f6('0x2e'):_0x411f3e=as[_0x29f6('0x73')]('me',null,_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')]['start'],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);break;}}else{var _0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b['type'],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}}}else{var _0x478ed0=_(_0x19fd60[_0x29f6('0x48')])[_0x29f6('0x49')]()[_0x29f6('0x32')](function(_0x1f401c){return _[_0x29f6('0x79')](_0x1bde93,[_0x29f6('0x2a'),_0x1f401c])?_0x1f401c:undefined;})['compact']()[_0x29f6('0x69')]();if(!_['isEmpty'](_0x478ed0)){_0x478ed0['forEach'](function(_0x4f9907){if(_0x4f9907===_0x29f6('0x7a')){_0x5ab84e['where'](_0x29f6('0x7b'),[][_0x29f6('0x7c')](_0x19fd60[_0x29f6('0x48')][_0x4f9907]));}else if(_0x4f9907===_0x29f6('0x7d')){var _0x8a5e58=JSON[_0x29f6('0x7e')](_0x19fd60[_0x29f6('0x48')][_0x4f9907])['$gte'];var _0x3a23f3=JSON['parse'](_0x19fd60[_0x29f6('0x48')][_0x4f9907])[_0x29f6('0x7f')];_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x80'),_0x8a5e58,_0x3a23f3);}else{if(_0x19fd60[_0x29f6('0x48')][_0x4f9907]===_0x29f6('0x81')){_0x5ab84e[_0x29f6('0x51')]('i.'+_0x4f9907+_0x29f6('0x82'));}else{_0x5ab84e[_0x29f6('0x51')]('i.'+_0x4f9907+_0x29f6('0x83'),_0x19fd60[_0x29f6('0x48')][_0x4f9907]);}}});}if(_0x19fd60[_0x29f6('0x48')]['read']){if(_0x19fd60['query']['read']==0x1){_0x5ab84e[_0x29f6('0x6a')](_0x29f6('0x84'));}else{_0x5ab84e['having'](_0x29f6('0x85'));}}if(_0x19fd60['query'][_0x29f6('0x86')]){_0x434e04=_[_0x29f6('0x87')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')])?_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')]:new Array(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')]);_0x434e04[_0x29f6('0x37')](function(_0xa2ab9e){_0x5078d1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa2ab9e+',%');});}if(_0x19fd60[_0x29f6('0x48')]['filter']){var _0x16bb3c=_0x19fd60[_0x29f6('0x48')][_0x29f6('0x88')][_0x29f6('0x89')]('\x5c','\x5c\x5c')[_0x29f6('0x89')](/'/g,'\x27\x27');if(qs[_0x29f6('0x8a')](_0x16bb3c)){_0x2d4c8d['or'](_0x29f6('0x8b'),_0x16bb3c+'%');}else{_0x2d4c8d['or'](_0x29f6('0x8c'),qs['getFullTextValue'](_0x16bb3c))['or'](_0x29f6('0x8d'),_0x16bb3c+'%');}}}_0x5ab84e[_0x29f6('0x51')](_0x2d4c8d);_0x5ab84e['group']('i.id');var _0x216f51={'type':db[_0x29f6('0x8e')][_0x29f6('0x8f')][_0x29f6('0x90')],'raw':!![]};var _0x467dd2=_0x5ab84e[_0x29f6('0x91')]();_0x467dd2[_0x29f6('0x54')](_0x29f6('0x92'));_0x467dd2[_0x29f6('0x54')](_0x29f6('0x93'),_0x29f6('0x94'));if(_0x29b3f6[_0x29f6('0x50')]){_0x29b3f6['order']['forEach'](function(_0x2e2f16){var _0x180658=_0x2e2f16[0x0]==='contactName'?_0x2e2f16[0x0]:'i.'+_0x2e2f16[0x0];_0x5ab84e[_0x29f6('0x50')](_0x180658,_0x2e2f16[0x1]===_0x29f6('0x95')?![]:!![]);});}if(!_[_0x29f6('0x96')](_0x434e04)){_0x5ab84e[_0x29f6('0x6a')](_0x5078d1);_0x467dd2[_0x29f6('0x51')](_0x29f6('0x97'),_0x434e04);}BPromise[_0x29f6('0x98')]()['then'](function(){if(!_0x2bd7d9){if(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x7a')])return;_0x467dd2[_0x29f6('0x51')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x99'));return;}if(_0x19fd60['user'][_0x29f6('0x9a')]!==_0x29f6('0x9b'))return;return _0x19fd60['user'][_0x29f6('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x405124){if(_[_0x29f6('0x96')](_0x405124)){_0x467dd2[_0x29f6('0x51')](_0x29f6('0x9d'));_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x9d'));}else{_0x467dd2['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x29f6('0x32')](_0x405124,'id'));_0x5ab84e[_0x29f6('0x51')]('i.ChatWebsiteId\x20IN\x20?',_[_0x29f6('0x32')](_0x405124,'id'));}});})['then'](function(){if(_0x19fd60[_0x29f6('0x9e')][_0x29f6('0x9a')]===_0x29f6('0x9b')&&!_0x2bd7d9&&!_0x19fd60[_0x29f6('0x48')][_0x29f6('0x7a')])return[];return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x467dd2['toString'](),_0x216f51);})[_0x29f6('0x14')](function(_0x365b6d){_0x352119[_0x29f6('0x24')]=_0x365b6d['length'];if(_0x352119['count']===0x0)return[];return db['sequelize']['query'](_0xaa915c[_0x29f6('0xa0')](),_0x216f51)['then'](function(_0x537a8d){_0x199060=_['keyBy'](_0x537a8d,'id');_0x216f51=_[_0x29f6('0x2d')](_0x216f51,{'model':db[_0x29f6('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x4d')]){_0x29b3f6[_0x29f6('0x4c')]['forEach'](function(_0x28cf80){_0x5ab84e['field']('i.'+_0x28cf80);});}else{_0x5ab84e[_0x29f6('0x54')](_0x29f6('0x93'),_0x29f6('0x94'));_0x5ab84e[_0x29f6('0x54')]('a.key','Account.key');_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa2'),_0x29f6('0xa3'));_0x5ab84e['field'](_0x29f6('0xa4'),_0x29f6('0xa5'));_0x5ab84e['field'](_0x29f6('0xa6'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa7'),_0x29f6('0xa8'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa9'),_0x29f6('0xaa'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xab'),_0x29f6('0xac'));_0x5ab84e['field'](_0x29f6('0xad'),'Contact.phone');_0x5ab84e['field']('c.mobile',_0x29f6('0xae'));_0x5ab84e[_0x29f6('0x54')]('c.fax','Contact.fax');_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xaf'),'Owner.fullname');_0x5ab84e['field']('o.internal','Owner.internal');_0x5ab84e[_0x29f6('0x54')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x29f6('0x35'));}if(_0x29b3f6[_0x29f6('0x23')])_0x5ab84e['limit'](_0x29b3f6[_0x29f6('0x23')]);if(_0x29b3f6[_0x29f6('0x21')])_0x5ab84e['offset'](_0x29b3f6[_0x29f6('0x21')]);return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x5ab84e[_0x29f6('0xa0')](),_0x216f51);})[_0x29f6('0x14')](function(_0x399328){if(_0x399328[_0x29f6('0x4e')]>0x0)_0x3bca11[_0x29f6('0x51')](_0x29f6('0xb0'),_[_0x29f6('0x32')](_0x399328,'id'));return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x3bca11[_0x29f6('0xa0')](),_0x216f51)[_0x29f6('0x14')](function(_0x5076ed){var _0x24757e=_[_0x29f6('0xb1')](_0x5076ed,_0x29f6('0xb2'));var _0x264617=[];_0x399328[_0x29f6('0x37')](function(_0x3569f7){_0x264617[_0x29f6('0x38')](updateChatInteraction(_0x3569f7,_0x199060,_0x24757e));});return BPromise['all'](_0x264617);});});})[_0x29f6('0x14')](function(_0x4ec09d){_0x352119[_0x29f6('0xb3')]=_0x4ec09d;return _0x352119;})[_0x29f6('0x14')](respondWithFilteredResult(_0x270842,_0x29b3f6))[_0x29f6('0x39')](handleError(_0x270842,null));};exports[_0x29f6('0xb4')]=function(_0x43c44d,_0x63517e){var _0x2dc960={'raw':![],'where':{'id':_0x43c44d[_0x29f6('0xb5')]['id']}},_0x312a6f={};_0x312a6f['model']=_[_0x29f6('0x49')](db[_0x29f6('0xa1')]['rawAttributes']);_0x312a6f['query']=_[_0x29f6('0x49')](_0x43c44d[_0x29f6('0x48')]);_0x312a6f[_0x29f6('0x4a')]=_[_0x29f6('0x4b')](_0x312a6f['model'],_0x312a6f[_0x29f6('0x48')]);_0x2dc960[_0x29f6('0x4c')]=_['intersection'](_0x312a6f[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x43c44d[_0x29f6('0x48')][_0x29f6('0x4d')]));_0x2dc960[_0x29f6('0x4c')]=_0x2dc960[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x2dc960[_0x29f6('0x4c')]:_0x312a6f[_0x29f6('0x47')];if(_0x43c44d[_0x29f6('0x48')][_0x29f6('0xb6')]){_0x2dc960[_0x29f6('0xb7')]=[{'all':!![]}];}_0x2dc960=_[_0x29f6('0x2d')]({},_0x2dc960,_0x43c44d['options']);return db[_0x29f6('0xa1')][_0x29f6('0xb8')](_0x2dc960)[_0x29f6('0x14')](handleEntityNotFound(_0x63517e,null))[_0x29f6('0x14')](respondWithResult(_0x63517e,null))['catch'](handleError(_0x63517e,null));};exports[_0x29f6('0xb9')]=function(_0x2ffad1,_0x37ea1b){return db['ChatInteraction'][_0x29f6('0xb9')](_0x2ffad1[_0x29f6('0x2e')],{})['then'](respondWithResult(_0x37ea1b,0xc9))[_0x29f6('0x39')](handleError(_0x37ea1b,null));};exports[_0x29f6('0x28')]=function(_0x26f030,_0x247bce){if(_0x26f030[_0x29f6('0x2e')]['id']){delete _0x26f030[_0x29f6('0x2e')]['id'];}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x26f030[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x247bce,null))[_0x29f6('0x14')](saveUpdates(_0x26f030['body'],null))['then'](respondWithResult(_0x247bce,null))[_0x29f6('0x39')](handleError(_0x247bce,null));};exports[_0x29f6('0xba')]=function(_0x1621b7,_0x1f0e72){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x1621b7[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x1f0e72,null))['then'](removeEntity(_0x1f0e72,null))['catch'](handleError(_0x1f0e72,null));};exports['describe']=function(_0x1fd477,_0x45dfd1){return db[_0x29f6('0xa1')][_0x29f6('0xbb')]()['then'](respondWithResult(_0x45dfd1,null))[_0x29f6('0x39')](handleError(_0x45dfd1,null));};exports[_0x29f6('0xbc')]=function(_0x4f2471,_0x1ef540){var _0x5a51c0=_0x4f2471[_0x29f6('0xb5')]['id'];var _0x2a2e0e;var _0xaccfb7;var _0x19c10d;return db['ChatInteraction'][_0x29f6('0xbd')]({'where':{'id':_0x5a51c0}})['then'](function(_0x47785a){_0x2a2e0e=_0x47785a;return db[_0x29f6('0xbe')][_0x29f6('0xbd')]({'where':{'id':_0x47785a[_0x29f6('0x7a')]},'attributes':['id',_0x29f6('0xbf'),_0x29f6('0xc0'),'vidaooTopic','vidaooNote',_0x29f6('0xc1')],'raw':!![]});})['then'](function(_0x5db958){if(_0x5db958&&_0x5db958[_0x29f6('0xbf')]&&_0x5db958['vidaooEscalation']){_0xaccfb7=_0x5db958;var _0x67c30a={'interaction':{'id':_0x5a51c0},'agent':{'id':_0x4f2471[_0x29f6('0x9e')]['id'],'name':_0x4f2471[_0x29f6('0x9e')][_0x29f6('0x2a')],'fullname':_0x4f2471[_0x29f6('0x9e')][_0x29f6('0x33')],'email':_0x4f2471['user'][_0x29f6('0xc2')]},'contact':_0x4f2471[_0x29f6('0x2e')][_0x29f6('0x2f')],'account':_0x4f2471[_0x29f6('0x2e')][_0x29f6('0x30')]};var _0x1cec09={'rejectUnauthorized':![],'method':_0x29f6('0xc3'),'url':_0x29f6('0xc4'),'headers':{'X-APIKEY':_0x5db958[_0x29f6('0xbf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4f2471[_0x29f6('0x9e')][_0x29f6('0xc2')]],'buttons':null,'topic':_0xaccfb7['vidaooTopic'],'note':_[_0x29f6('0xc5')](_0xaccfb7[_0x29f6('0xc6')])?null:getMustacheRender(_0xaccfb7['vidaooNote'],_0x67c30a),'metadata':null},'redirect':_0x29f6('0xc7'),'json':!![]};try{if(!_[_0x29f6('0xc5')](_0xaccfb7[_0x29f6('0xc1')])){var _0x50d48d=getMustacheRender(_0xaccfb7['vidaooMetadata'],_0x67c30a);var _0x1413a5=JSON[_0x29f6('0x7e')](_0x50d48d);_0x1cec09[_0x29f6('0x2e')][_0x29f6('0xc8')]=_0x1413a5;}}catch(_0x2b6357){throw new db[(_0x29f6('0x8e'))]['ValidationError'](_0x29f6('0xc9'));}return rp(_0x1cec09);}else{throw new db[(_0x29f6('0x8e'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x231f26){_0x19c10d=_0x231f26;if(_0x19c10d['id']){var _0x578d49={'body':_0x19c10d[_0x29f6('0xca')],'ChatWebsiteId':_0xaccfb7['id'],'ChatInteractionId':_0x2a2e0e['id'],'direction':'out','UserId':_0x4f2471[_0x29f6('0x9e')]['id']};return db[_0x29f6('0xcb')][_0x29f6('0xb9')](_0x578d49,{});}else{throw new db[(_0x29f6('0x8e'))][(_0x29f6('0xcc'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x29f6('0x14')](function(){return _0x2a2e0e['updateAttributes']({'vidaooSessionId':_0x19c10d['id']});})[_0x29f6('0x14')](respondWithResult(_0x1ef540,null))[_0x29f6('0x39')](handleError(_0x1ef540,null));};exports[_0x29f6('0xcd')]=function(_0x19d1cb,_0x478660){if(_0x19d1cb[_0x29f6('0x2e')]['id']){delete _0x19d1cb[_0x29f6('0x2e')]['id'];}return db[_0x29f6('0xa1')]['find']({'where':{'id':_0x19d1cb[_0x29f6('0xb5')]['id']},'include':[{'model':db['CmContact'],'as':_0x29f6('0x6d')}]})[_0x29f6('0x14')](handleEntityNotFound(_0x478660,null))['then'](saveUpdates(_0x19d1cb[_0x29f6('0x2e')],null))['then'](respondWithResult(_0x478660,null))[_0x29f6('0x39')](handleError(_0x478660,null));};exports[_0x29f6('0xce')]=function(_0x52c66d,_0x955f7){if(_0x52c66d[_0x29f6('0x2e')]['id']){delete _0x52c66d['body']['id'];}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x52c66d[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](function(_0x352a07){if(!_0x352a07){logger[_0x29f6('0x1b')](_0x29f6('0xcf'),_0x29f6('0xce'),0x194,'entity\x20not\x20found');_0x955f7[_0x29f6('0x1e')](0x194);}else{if(_0x352a07[_0x29f6('0x3f')]){throw new db[(_0x29f6('0x8e'))][(_0x29f6('0xcc'))]('Interaction\x20already\x20assigned');}}return _0x352a07;})[_0x29f6('0x14')](function(_0x10648e){if(_0x10648e){return _0x10648e[_0x29f6('0x28')]({'closed':_0x52c66d[_0x29f6('0x2e')][_0x29f6('0x40')],'disposition':_0x52c66d['body']['disposition']})[_0x29f6('0x14')](function(_0x1b3b27){return _0x1b3b27;});}})['then'](function(){return respondWithRpcPromise(_0x29f6('0xd0'),'abandon',_0x52c66d['body'],client9004);})[_0x29f6('0x14')](respondWithResult(_0x955f7,null))['catch'](handleError(_0x955f7,null));};exports[_0x29f6('0xd1')]=function(_0x24a7fb,_0x454c4c){_0x24a7fb[_0x29f6('0x2e')]['name']=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd3')];_0x24a7fb[_0x29f6('0x2e')][_0x29f6('0xd4')]=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd5')];_0x24a7fb['body']['type']=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd6')];return db[_0x29f6('0xd7')][_0x29f6('0xb9')](_0x24a7fb[_0x29f6('0x2e')])[_0x29f6('0x14')](respondWithResult(_0x454c4c,0xc9))[_0x29f6('0x39')](handleError(_0x454c4c,null));};exports[_0x29f6('0xd8')]=function(_0x3d131a,_0x2bc181){return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x3d131a[_0x29f6('0xb5')]['id']},'raw':!![]})[_0x29f6('0x14')](handleEntityNotFound(_0x2bc181,null))[_0x29f6('0x14')](function(_0x583f5f){if(_0x583f5f){if(_0x583f5f[_0x29f6('0x40')]){return _0x2bc181[_0x29f6('0x25')](0x193)[_0x29f6('0x20')]({'status':0x193,'message':_0x29f6('0xd9')});}return db[_0x29f6('0xd7')]['findOne']({'where':{'id':_0x3d131a[_0x29f6('0x48')][_0x29f6('0xda')]},'raw':!![]})[_0x29f6('0x14')](handleEntityNotFound(_0x2bc181,null));}})['then'](function(_0x2378b8){if(_0x2378b8){var _0x2a5414=_0x2378b8[_0x29f6('0xdb')]!==null;var _0x189048=path['join'](config[_0x29f6('0xdc')],'server/files/attachments/');if(_0x2a5414){_0x189048=path[_0x29f6('0xdd')](_0x189048,'offline-chat/');}var _0x2aa18b=path[_0x29f6('0xdd')](_0x189048,_0x2378b8[_0x29f6('0xd4')]);return _0x2bc181[_0x29f6('0xde')](_0x2aa18b);}})['catch'](handleError(_0x2bc181,null));};exports[_0x29f6('0xdf')]=function(_0x2216ef,_0x4577ee){var _0x2ef994=null;var _0x28e4c5=null;var _0x168724=null;if(_0x2216ef[_0x29f6('0x2e')]['id']){delete _0x2216ef[_0x29f6('0x2e')]['id'];}if(_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe0')]){_0x168724=path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],'server/files/chat/upload/',util[_0x29f6('0xe1')](_0x29f6('0xe2'),Date[_0x29f6('0xe3')]()));_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe4')]=_0x168724;}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x2216ef[_0x29f6('0xb5')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x29f6('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x29f6('0x14')](handleEntityNotFound(_0x4577ee,null))['then'](saveUpdates(_0x2216ef[_0x29f6('0x2e')],null))[_0x29f6('0x14')](function(_0x4a3381){if(_0x4a3381){_0x2ef994=_0x4a3381;return db[_0x29f6('0xbe')][_0x29f6('0xb8')]({'where':{'id':_0x2ef994[_0x29f6('0x7a')]}});}})[_0x29f6('0x14')](function(_0xdb766a){if(_0xdb766a){_0x28e4c5=_0xdb766a;return db[_0x29f6('0xe6')][_0x29f6('0xb8')]({'where':{'id':_0x2ef994['ContactId']}});}})[_0x29f6('0x14')](function(_0x37735f){if(_0x37735f){if(_0x168724){var _0x399aed=null;for(var _0xe432b0=0x1;_0xe432b0<_0x2ef994[_0x29f6('0xe5')][_0x29f6('0x4e')];++_0xe432b0){_0x399aed=_0x2ef994['Messages'][_0xe432b0];var _0x21bc96=_0x399aed[_0x29f6('0x3f')]?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed['UserId']):_0x29f6('0xe9');var _0x46a5da=_0x2216ef['body'][_0x29f6('0xea')]||util['format']('%s%d',_0x29f6('0xeb'),_0x399aed[_0x29f6('0x72')]);switch(_0x28e4c5[_0x29f6('0xec')]){case _0x29f6('0xed'):_0x21bc96=_0x399aed['UserId']?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed[_0x29f6('0x3f')]):_0x29f6('0xe9');break;case _0x29f6('0xee'):_0x21bc96=_0x399aed[_0x29f6('0x3f')]?_0x399aed[_0x29f6('0xef')][_0x29f6('0xf0')]||_0x399aed[_0x29f6('0xef')][_0x29f6('0x33')]:_0x29f6('0xe9');break;case _0x29f6('0xf1'):_0x21bc96=_0x399aed[_0x29f6('0x3f')]?_0x399aed['User']['fullname']:_0x29f6('0xe9');break;default:_0x21bc96=_0x399aed[_0x29f6('0x3f')]?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed['UserId']):'System';}var _0x593d86=util[_0x29f6('0xe1')](_0x29f6('0xf2'),moment(_0x399aed[_0x29f6('0x7d')])[_0x29f6('0xe1')]('MM/DD/YYYY\x20HH:mm:ss'),_0x399aed[_0x29f6('0xf3')]==='in'?_0x46a5da:_0x21bc96,_0x399aed[_0x29f6('0x2e')]);if(!_0x399aed[_0x29f6('0xf4')]){fs[_0x29f6('0xf5')](_0x168724,_0x593d86);}}return db[_0x29f6('0xf6')][_0x29f6('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0x29f6('0xf7')],'as':_0x29f6('0xf8'),'raw':!![],'include':[{'model':db[_0x29f6('0xf9')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x29f6('0x14')](function(_0x294136){if(!_0x294136||!_0x294136[_0x29f6('0xf8')]||!_0x2216ef[_0x29f6('0x2e')])return _0x2ef994;var _0x59fb2a=_0x294136['getSmtpOptions']();return respondWithRpcPromise(_0x29f6('0xfa'),_0x29f6('0xfb'),{'account':_0x59fb2a,'message':{'from':util[_0x29f6('0xe1')](_0x29f6('0xfc'),_0x294136[_0x29f6('0x2a')],_0x294136['email']||_0x294136[_0x29f6('0xf8')][_0x29f6('0x9e')]),'to':_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe0')],'subject':_0x29f6('0xfd'),'text':util[_0x29f6('0xe1')](_0x29f6('0xfe'),_0x2216ef['body'][_0x29f6('0xe0')]),'attachments':[{'path':_0x168724}]}})[_0x29f6('0x14')](function(){return _0x2ef994;})[_0x29f6('0x39')](function(_0x3d027f){logger['error'](_0x3d027f);});})[_0x29f6('0x14')](respondWithStatusCode(_0x4577ee,0xc8))[_0x29f6('0x39')](handleError(_0x4577ee,null));};exports[_0x29f6('0xff')]=function(_0x2df557,_0x589222){return db[_0x29f6('0xcb')][_0x29f6('0xb8')]({'where':{'id':_0x2df557[_0x29f6('0xb5')]['id']}})['then'](handleEntityNotFound(_0x589222,null))[_0x29f6('0x14')](function(_0x318fd1){if(_0x318fd1){return _0x318fd1[_0x29f6('0xff')](_0x2df557[_0x29f6('0x2e')]['ids'],_[_0x29f6('0x100')](_0x2df557[_0x29f6('0x2e')],['ids','id'])||{});}})['then'](respondWithResult(_0x589222,null))['catch'](handleError(_0x589222,null));};exports[_0x29f6('0x101')]=function(_0x29017d,_0x5863a2){var _0x2f7729={'raw':![],'where':{}};var _0x171342={};var _0x1dafb9={'count':0x0,'rows':[]};return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x29017d['params']['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x5863a2,null))[_0x29f6('0x14')](function(_0x1207f7){if(_0x1207f7){_0x171342[_0x29f6('0x47')]=_[_0x29f6('0x49')](db[_0x29f6('0xcb')][_0x29f6('0x44')]);_0x171342[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x29017d[_0x29f6('0x48')]);_0x171342['filters']=_[_0x29f6('0x4b')](_0x171342[_0x29f6('0x47')],_0x171342['query']);_0x2f7729[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x171342[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x29017d[_0x29f6('0x48')]['fields']));_0x2f7729[_0x29f6('0x4c')]=_0x2f7729[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x2f7729['attributes']:_0x171342['model'];if(!_0x29017d[_0x29f6('0x48')][_0x29f6('0x4f')](_0x29f6('0x102'))){_0x2f7729[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x29017d[_0x29f6('0x48')]['limit']);_0x2f7729['offset']=qs[_0x29f6('0x21')](_0x29017d[_0x29f6('0x48')][_0x29f6('0x21')]);}_0x2f7729[_0x29f6('0x50')]=qs[_0x29f6('0x103')](_0x29017d[_0x29f6('0x48')]['sort']);_0x2f7729['where']=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x29017d[_0x29f6('0x48')],_0x171342['filters']));_0x2f7729['where']['ChatInteractionId']=_0x1207f7['id'];if(_0x29017d[_0x29f6('0x48')]['filter']){_0x2f7729[_0x29f6('0x51')]=_[_0x29f6('0x2d')](_0x2f7729[_0x29f6('0x51')],{'$or':_[_0x29f6('0x32')](_0x2f7729[_0x29f6('0x4c')],function(_0x25532f){var _0x31ebb3={};_0x31ebb3[_0x25532f]={'$like':'%'+_0x29017d[_0x29f6('0x48')][_0x29f6('0x88')]+'%'};return _0x31ebb3;})});}if(_0x29017d['query'][_0x29f6('0x104')]){var _0x173977=_0x29017d['query'][_0x29f6('0x104')][_0x29f6('0x36')](',');var _0x43acdc={};_0x43acdc[_0x173977[0x0]]={'$gte':moment(_0x173977[0x1])[_0x29f6('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f7729['where']=_[_0x29f6('0x2d')](_0x2f7729[_0x29f6('0x51')],_0x43acdc);}_0x2f7729=_[_0x29f6('0x2d')]({},_0x2f7729,_0x29017d[_0x29f6('0x105')]);return db[_0x29f6('0xcb')]['count']({'where':_0x2f7729['where']})[_0x29f6('0x14')](function(_0x216ad8){_0x1dafb9['count']=_0x216ad8;if(_0x29017d['query']['includeAll']){_0x2f7729[_0x29f6('0xb7')]=[{'all':!![]}];}return db[_0x29f6('0xcb')][_0x29f6('0x106')](_0x2f7729);})[_0x29f6('0x14')](function(_0x2b1808){_0x1dafb9['rows']=_0x2b1808;return _0x1dafb9;});}})[_0x29f6('0x14')](respondWithFilteredResult(_0x5863a2,_0x2f7729))[_0x29f6('0x39')](handleError(_0x5863a2,null));};exports[_0x29f6('0x107')]=function(_0x3d68f3,_0x1cb0c0){var _0x47e4e5={'where':{}},_0x3a19d2={},_0x3450c3={'count':0x0,'rows':[]};return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x3d68f3[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x1cb0c0,null))[_0x29f6('0x14')](function(_0x6a318b){if(_0x6a318b){_0x3a19d2['model']=_[_0x29f6('0x49')](db[_0x29f6('0xcb')]['rawAttributes']);_0x3a19d2[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x3d68f3[_0x29f6('0x48')]);_0x3a19d2['filters']=_['intersection'](_0x3a19d2['model'],_0x3a19d2['query']);_0x47e4e5[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x3a19d2[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x4d')]));_0x47e4e5[_0x29f6('0x4c')]=_0x47e4e5[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x47e4e5[_0x29f6('0x4c')]:_0x3a19d2['model'];if(!_0x3d68f3[_0x29f6('0x48')]['hasOwnProperty'](_0x29f6('0x102'))){_0x47e4e5[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x23')]);_0x47e4e5[_0x29f6('0x21')]=qs[_0x29f6('0x21')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x21')]);}_0x47e4e5['order']=qs['sort'](_0x3d68f3[_0x29f6('0x48')]['sort']);_0x47e4e5[_0x29f6('0x51')]=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x3d68f3[_0x29f6('0x48')],_0x3a19d2[_0x29f6('0x4a')]));_0x47e4e5['where'][_0x29f6('0xb2')]=_0x6a318b['id'];if(_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x88')]){_0x47e4e5[_0x29f6('0x51')]=_[_0x29f6('0x2d')](_0x47e4e5[_0x29f6('0x51')],{'$or':_[_0x29f6('0x32')](_0x47e4e5[_0x29f6('0x4c')],function(_0x346ece){var _0xc22605={};_0xc22605[_0x346ece]={'$like':'%'+_0x3d68f3[_0x29f6('0x48')]['filter']+'%'};return _0xc22605;})});}_0x47e4e5[_0x29f6('0x51')]['secret']=![];if(_0x3d68f3[_0x29f6('0x48')]['id']){_0x47e4e5[_0x29f6('0x51')]['id']={'$gt':_0x3d68f3['query']['id']};}_0x47e4e5=_['merge']({},_0x47e4e5,_0x3d68f3[_0x29f6('0x105')]);return db[_0x29f6('0xcb')]['count']({'where':_0x47e4e5[_0x29f6('0x51')]})[_0x29f6('0x14')](function(_0x15db8c){_0x3450c3[_0x29f6('0x24')]=_0x15db8c;_0x47e4e5[_0x29f6('0xb7')]=[];if(_0x3d68f3['query']['includeAgent']){_0x47e4e5[_0x29f6('0xb7')]['push']({'model':db[_0x29f6('0xef')],'as':_0x29f6('0xef'),'attributes':['id','fullname',_0x29f6('0xf0')]});}if(_0x3d68f3[_0x29f6('0x48')]['includeAll']){_0x47e4e5[_0x29f6('0xb7')]=[{'all':!![]}];}return db[_0x29f6('0xcb')]['findAll'](_0x47e4e5);})['then'](function(_0x37c860){_0x3450c3[_0x29f6('0xb3')]=_0x37c860;return _0x3450c3;});}})[_0x29f6('0x14')](respondWithFilteredResult(_0x1cb0c0,_0x47e4e5))[_0x29f6('0x39')](handleError(_0x1cb0c0,null));};exports[_0x29f6('0x108')]=function(_0x371548,_0x7a0ebf){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x371548[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x7a0ebf,null))[_0x29f6('0x14')](function(_0x1e05e2){if(_0x1e05e2){return _0x1e05e2[_0x29f6('0x109')](_0x371548[_0x29f6('0x2e')][_0x29f6('0x10a')],_[_0x29f6('0x100')](_0x371548[_0x29f6('0x2e')],[_0x29f6('0x10a'),'id'])||{})[_0x29f6('0x10b')](function(){return db[_0x29f6('0x76')]['findAll']({'attributes':['id',_0x29f6('0x2a'),_0x29f6('0x10c')],'where':{'id':_0x371548[_0x29f6('0x2e')][_0x29f6('0x10a')]}});})['then'](function(_0x5248ba){socket[_0x29f6('0x10d')](_0x29f6('0x10e'),{'id':Number(_0x371548[_0x29f6('0xb5')]['id']),'tags':_0x5248ba||[]});return{'id':Number(_0x371548['params']['id']),'tags':_0x5248ba||[]};});}})[_0x29f6('0x14')](respondWithResult(_0x7a0ebf,null))[_0x29f6('0x39')](handleError(_0x7a0ebf,null));};exports[_0x29f6('0x10f')]=function(_0x47028e,_0x410ab5){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x47028e[_0x29f6('0xb5')]['id']}})['then'](handleEntityNotFound(_0x410ab5,null))[_0x29f6('0x14')](function(_0x281c49){if(_0x281c49){return _0x281c49[_0x29f6('0x10f')](_0x47028e[_0x29f6('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x410ab5,null))[_0x29f6('0x39')](handleError(_0x410ab5,null));};exports['download']=function(_0x5250bc,_0x31ba94){var _0x31dcfe=moment()[_0x29f6('0x110')]()[_0x29f6('0xa0')]();var _0x5cf3d4=path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],_0x29f6('0x111'),'files',_0x29f6('0x112'));var _0x5dcaf2=path['join'](config['root'],'server',_0x29f6('0x113'),_0x29f6('0x114'));var _0xcf75fe=path[_0x29f6('0xdd')](_0x5cf3d4,_0x31dcfe);var _0x48ecb0=util['format']('transcript-%d-%s.zip',_0x5250bc[_0x29f6('0xb5')]['id'],_0x31dcfe);var _0x5de30e=path[_0x29f6('0xdd')](_0x5cf3d4,_0x48ecb0);var _0x10989a=[];_0x10989a[_0x29f6('0x38')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x10989a[_0x29f6('0x38')]({'model':db[_0x29f6('0xe6')],'as':_0x29f6('0x6d'),'attributes':['id',_0x29f6('0x115'),_0x29f6('0x116')],'raw':!![]});if(_0x5250bc['query'][_0x29f6('0x114')]){_0x10989a[_0x29f6('0x38')]({'model':db['Attachment'],'as':_0x29f6('0xd7'),'raw':!![]});}var _0x15c951=[{'model':db[_0x29f6('0xcb')],'as':'Messages','attributes':['id','body',_0x29f6('0x7d'),'direction',_0x29f6('0xf4'),_0x29f6('0x117')],'include':_0x10989a}];_0x15c951['push']({'model':db['ChatWebsite'],'as':_0x29f6('0x118'),'attributes':['id',_0x29f6('0x2a')]});_0x15c951[_0x29f6('0x38')]({'model':db['User'],'as':_0x29f6('0x119'),'attributes':['id',_0x29f6('0x33')]});return db[_0x29f6('0xa1')]['find']({'where':{'id':_0x5250bc[_0x29f6('0xb5')]['id']},'include':_0x15c951})['then'](handleEntityNotFound(_0x31ba94,null))[_0x29f6('0x14')](function(_0x4ad41d){if(_0x4ad41d){var _0x598bcd=_0x4ad41d['get']({'plain':!![]});fs['mkdirSync'](_0xcf75fe);var _0x53751c={'channel':_0x29f6('0x11a'),'account':_0x598bcd['Account'][_0x29f6('0x2a')],'agent':_0x598bcd[_0x29f6('0x119')]?_0x598bcd[_0x29f6('0x119')][_0x29f6('0x33')]:_0x29f6('0x11b'),'createdAt':moment(_0x598bcd['createdAt'])[_0x29f6('0xe1')](_0x29f6('0x11c'))[_0x29f6('0xa0')](),'closedAt':_0x598bcd['closed']?moment(_0x598bcd[_0x29f6('0x11d')])[_0x29f6('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x29f6('0xa0')]():'','disposition':_0x598bcd['disposition'],'chatInfo':{'browser':_0x598bcd[_0x29f6('0x11e')],'os':_0x598bcd[_0x29f6('0x11f')],'referer':_0x598bcd[_0x29f6('0x120')],'customerIp':_0x598bcd[_0x29f6('0x121')],'customerPort':_0x598bcd[_0x29f6('0x122')]?_0x598bcd[_0x29f6('0x122')]:_0x29f6('0x11b')},'messages':_(_0x598bcd[_0x29f6('0xe5')])[_0x29f6('0x123')]()[_0x29f6('0x88')]({'secret':![]})[_0x29f6('0x32')](function(_0x2fd414){if(_0x2fd414['Attachment']){var _0x49c5f6=path[_0x29f6('0xdd')](_0x5dcaf2,_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')]);if(fs[_0x29f6('0x124')](_0x49c5f6)){fs[_0x29f6('0x125')](_0x49c5f6)[_0x29f6('0x126')](fs[_0x29f6('0x127')](path[_0x29f6('0xdd')](_0xcf75fe,_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')])));}}return{'date':moment(_0x2fd414[_0x29f6('0x7d')])[_0x29f6('0xe1')](_0x29f6('0x11c'))[_0x29f6('0xa0')](),'sender':_0x2fd414[_0x29f6('0xf3')]===_0x29f6('0x128')?_0x2fd414[_0x29f6('0xef')]?_0x2fd414[_0x29f6('0xef')]['fullname']:_0x29f6('0xe9'):_0x2fd414[_0x29f6('0x6d')]['firstName']+(_0x2fd414['Contact'][_0x29f6('0x116')]?'\x20'+_0x2fd414[_0x29f6('0x6d')][_0x29f6('0x116')]:''),'body':_0x2fd414[_0x29f6('0xd7')]?_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')]:_0x2fd414[_0x29f6('0x2e')],'direction':_0x2fd414['direction']==='out'?'A':'C','secret':_0x2fd414['secret'],'read':_0x2fd414[_0x29f6('0x117')],'attachment':_0x2fd414[_0x29f6('0xd7')]};})[_0x29f6('0x69')]()};return ejs[_0x29f6('0x129')](path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],'server','views',_0x29f6('0x12a')),{'interaction':_0x53751c})[_0x29f6('0x14')](function(_0x3307a1){var _0x595aff=path[_0x29f6('0xdd')](_0xcf75fe,'transcript-'+_0x598bcd['id']+'-'+_0x31dcfe+_0x29f6('0x12b'));var _0x3101aa={'path':_0x595aff,'channel':'Chat','interactionId':_0x598bcd['id']};return pdf['createPdfFromHTML'](_0x3307a1,_0x3101aa);})[_0x29f6('0x14')](function(){return new Promise(function(_0x4c7b46,_0x41d45f){zipdir(_0xcf75fe,{'saveTo':_0x5de30e},function(_0x1f1679,_0x2dfc83){if(_0x1f1679)return _0x41d45f(_0x1f1679);return _0x4c7b46(_0x2dfc83);});})[_0x29f6('0x14')](function(){return new BPromise(function(_0x53cde9,_0x26eef7){rimraf(_0xcf75fe,function(_0x17b595){if(_0x17b595)_0x26eef7(_0x17b595);return _0x53cde9();});});})['then'](function(){return _0x31ba94[_0x29f6('0xde')](_0x5de30e,_0x48ecb0,function(_0x22fcde){if(_0x22fcde){logger[_0x29f6('0x1b')](_0x29f6('0x12c'),_0x22fcde);}else{fs['unlinkSync'](_0x5de30e);}});});});}else{return _0x31ba94[_0x29f6('0x1e')](0xc8);}})[_0x29f6('0x39')](handleError(_0x31ba94,null));}; \ No newline at end of file +var _0x9c44=['join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','options','addTags','spread','emit','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','sendStatus','request-promise','moment','bluebird','mustache','util','path','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','update','name','send','merge','body','contact','interaction','account','Users','map','TagIds','split','forEach','Tags','push','waiting','talking','answered','unmanaged','abandoned','total','UserId','closed','disposition','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','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?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','some','compact','isEmpty','ChatWebsiteId','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','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','contactName','i.*','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','destroy','describe','createVidaooSession','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','create','ValidationError','updateAttributes','abandon','AbandonInteraction','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x49c4('0x0'));var moment=require(_0x49c4('0x1'));var BPromise=require(_0x49c4('0x2'));var Mustache=require(_0x49c4('0x3'));var util=require(_0x49c4('0x4'));var path=require(_0x49c4('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x49c4('0x6'));var Redis=require('ioredis');var qs=require(_0x49c4('0x7'));var as=require(_0x49c4('0x8'));var pdf=require(_0x49c4('0x9'));var logger=require(_0x49c4('0xa'))(_0x49c4('0xb'));var config=require('../../config/environment');var db=require(_0x49c4('0xc'))['db'];config[_0x49c4('0xd')]=_[_0x49c4('0xe')](config[_0x49c4('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49c4('0xd')]));require(_0x49c4('0xf'))['register'](socket);var jayson=require(_0x49c4('0x10'));var client=jayson[_0x49c4('0x11')]['http']({'port':0x232b});var client9004=jayson['client'][_0x49c4('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x6d1b08,_0x5487cd,_0x7df3a9,_0x403bfb){return new BPromise(function(_0x5f2fd9,_0x1909fe){var _0x280996=_0x403bfb||client;return _0x280996[_0x49c4('0x13')](_0x6d1b08,_0x7df3a9)[_0x49c4('0x14')](function(_0x12777c){logger[_0x49c4('0x15')](_0x49c4('0x16'),_0x5487cd,_0x49c4('0x17'));logger['debug'](_0x49c4('0x18'),_0x5487cd,_0x49c4('0x17'),JSON[_0x49c4('0x19')](_0x12777c));if(_0x12777c[_0x49c4('0x1a')]){if(_0x12777c[_0x49c4('0x1a')]['code']===0x1f4){logger[_0x49c4('0x1a')](_0x49c4('0x16'),_0x5487cd,_0x12777c['error']['message']);return _0x1909fe(_0x12777c[_0x49c4('0x1a')][_0x49c4('0x1b')]);}logger[_0x49c4('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5487cd,_0x12777c[_0x49c4('0x1a')]['message']);return _0x5f2fd9(_0x12777c[_0x49c4('0x1a')][_0x49c4('0x1b')]);}else{logger[_0x49c4('0x15')](_0x49c4('0x16'),_0x5487cd,_0x49c4('0x17'));_0x5f2fd9(_0x12777c[_0x49c4('0x1c')][_0x49c4('0x1b')]);}})[_0x49c4('0x1d')](function(_0x2197d2){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5487cd,_0x2197d2);_0x1909fe(_0x2197d2);});});}function respondWithStatusCode(_0x57f502,_0x1c99b1){_0x1c99b1=_0x1c99b1||0xcc;return function(_0x4f0b62){if(_0x4f0b62){return _0x57f502['sendStatus'](_0x1c99b1);}return _0x57f502[_0x49c4('0x1e')](_0x1c99b1)[_0x49c4('0x1f')]();};}function respondWithResult(_0x26c640,_0xd335e4){_0xd335e4=_0xd335e4||0xc8;return function(_0x4811c4){if(_0x4811c4){return _0x26c640['status'](_0xd335e4)[_0x49c4('0x20')](_0x4811c4);}};}function respondWithFilteredResult(_0x9cb797,_0x565423){return function(_0x207358){if(_0x207358){var _0x43e014=typeof _0x565423[_0x49c4('0x21')]===_0x49c4('0x22')&&typeof _0x565423['limit']==='undefined';var _0x449960=_0x207358['count'];var _0x3800b7=_0x43e014?0x0:_0x565423[_0x49c4('0x21')];var _0x3f1708=_0x43e014?_0x207358[_0x49c4('0x23')]:_0x565423['offset']+_0x565423[_0x49c4('0x24')];var _0x2b2793;if(_0x3f1708>=_0x449960){_0x3f1708=_0x449960;_0x2b2793=0xc8;}else{_0x2b2793=0xce;}_0x9cb797[_0x49c4('0x1e')](_0x2b2793);return _0x9cb797[_0x49c4('0x25')](_0x49c4('0x26'),_0x3800b7+'-'+_0x3f1708+'/'+_0x449960)[_0x49c4('0x20')](_0x207358);}return null;};}function saveUpdates(_0x26ba17){return function(_0x427b26){if(_0x427b26){return _0x427b26[_0x49c4('0x27')](_0x26ba17)[_0x49c4('0x14')](function(_0x46f7ea){return _0x46f7ea;});}return null;};}function removeEntity(_0x4ea6ea){return function(_0x4f4495){if(_0x4f4495){return _0x4f4495['destroy']()[_0x49c4('0x14')](function(){_0x4ea6ea[_0x49c4('0x1e')](0xcc)[_0x49c4('0x1f')]();});}};}function handleEntityNotFound(_0x27e467){return function(_0x28eb47){if(!_0x28eb47){_0x27e467['sendStatus'](0x194);}return _0x28eb47;};}function handleError(_0x38ad77,_0x116eb4){_0x116eb4=_0x116eb4||0x1f4;return function(_0x2e7a69){logger[_0x49c4('0x1a')](_0x2e7a69['stack']);if(_0x2e7a69['name']){delete _0x2e7a69[_0x49c4('0x28')];}_0x38ad77[_0x49c4('0x1e')](_0x116eb4)[_0x49c4('0x29')](_0x2e7a69);};}function getMustacheRender(_0x13b3b4,_0xd38540){return Mustache['render'](_0x13b3b4,_[_0x49c4('0x2a')](_0xd38540[_0x49c4('0x2b')],{'contact':_0xd38540[_0x49c4('0x2c')],'message':_0xd38540['message'],'agent':_0xd38540['agent'],'interaction':_0xd38540[_0x49c4('0x2d')],'account':_0xd38540[_0x49c4('0x2e')]}))||'';}function getInteractionUsers(_0x3bec0a,_0x1238c0){return new BPromise(function(_0x2b45a1,_0x2cf897){try{if(_0x1238c0[_0x3bec0a['id']]){_0x3bec0a[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x1238c0[_0x3bec0a['id']],function(_0x3209cd){return{'id':_0x3209cd['id'],'fullname':_0x3209cd['fullname']};});}}catch(_0x2d34ca){_0x2cf897(_0x2d34ca);}_0x2b45a1(_0x3bec0a);});}function getInteractionTags(_0x5b96df,_0xdda586){return new BPromise(function(_0x349791,_0x2625a6){try{if(_0x5b96df[_0x49c4('0x31')]){_0x5b96df['Tags']=[];_0x5b96df[_0x49c4('0x31')][_0x49c4('0x32')](',')[_0x49c4('0x33')](function(_0x4e913a){_0x5b96df[_0x49c4('0x34')][_0x49c4('0x35')](_0xdda586[_0x4e913a]);});}delete _0x5b96df[_0x49c4('0x31')];}catch(_0x5e5366){_0x2625a6(_0x5e5366);}_0x349791(_0x5b96df);});}function updateChatInteraction(_0x1ba7a0,_0x24c177,_0x143916){return new BPromise(function(_0x2ba76a,_0x70e552){return getInteractionUsers(_0x1ba7a0,_0x143916)[_0x49c4('0x14')](function(_0x1e506a){return getInteractionTags(_0x1e506a,_0x24c177);})['then'](function(_0x2d2510){return getStateInteraction(_0x2d2510);})[_0x49c4('0x14')](function(_0x32b172){_0x2ba76a(_0x32b172);})[_0x49c4('0x1d')](function(_0x41ad28){_0x70e552(_0x41ad28);});});}function getStateInteraction(_0x29dd5d){return new BPromise(function(_0x1be62d){_0x29dd5d[_0x49c4('0x36')]=0x0;_0x29dd5d[_0x49c4('0x37')]=0x0;_0x29dd5d[_0x49c4('0x38')]=0x0;_0x29dd5d[_0x49c4('0x39')]=0x0;_0x29dd5d[_0x49c4('0x3a')]=0x0;_0x29dd5d[_0x49c4('0x3b')]=0x0;if(!_0x29dd5d['closed']&&!_0x29dd5d[_0x49c4('0x3c')]){_0x29dd5d['waiting']+=0x1;}if(!_0x29dd5d[_0x49c4('0x3d')]&&_0x29dd5d[_0x49c4('0x3c')]){_0x29dd5d[_0x49c4('0x37')]+=0x1;if(_0x29dd5d[_0x49c4('0x36')]){_0x29dd5d[_0x49c4('0x36')]-=0x1;}}if(_0x29dd5d[_0x49c4('0x3d')]&&_0x29dd5d['disposition']==='abandoned'){_0x29dd5d[_0x49c4('0x3a')]+=0x1;if(_0x29dd5d[_0x49c4('0x36')]){_0x29dd5d[_0x49c4('0x36')]-=0x1;}}else if(_0x29dd5d[_0x49c4('0x3d')]&&!_0x29dd5d['UserId']&&_0x29dd5d[_0x49c4('0x3e')]){_0x29dd5d[_0x49c4('0x39')]+=0x1;if(_0x29dd5d[_0x49c4('0x36')]){_0x29dd5d[_0x49c4('0x36')]-=0x1;}}else if(_0x29dd5d[_0x49c4('0x3d')]&&_0x29dd5d[_0x49c4('0x3c')]){_0x29dd5d[_0x49c4('0x38')]+=0x1;if(_0x29dd5d[_0x49c4('0x37')]){_0x29dd5d[_0x49c4('0x37')]-=0x1;}}_0x29dd5d['total']+=0x1;_0x1be62d(_0x29dd5d);});}exports[_0x49c4('0x3f')]=function(_0x4d27d0,_0x33696e){var _0x628423={},_0x301def={},_0x258abe={'count':0x0,'rows':[]};var _0x2d93d8=_['map'](db[_0x49c4('0x40')][_0x49c4('0x41')],function(_0x384862){return{'name':_0x384862[_0x49c4('0x42')],'type':_0x384862[_0x49c4('0x43')][_0x49c4('0x44')]};});_0x301def[_0x49c4('0x45')]=_['map'](_0x2d93d8,_0x49c4('0x28'));_0x301def['query']=_[_0x49c4('0x46')](_0x4d27d0[_0x49c4('0x47')]);_0x301def[_0x49c4('0x48')]=_[_0x49c4('0x49')](_0x301def[_0x49c4('0x45')],_0x301def[_0x49c4('0x47')]);_0x628423[_0x49c4('0x4a')]=_['intersection'](_0x301def[_0x49c4('0x45')],qs[_0x49c4('0x4b')](_0x4d27d0['query'][_0x49c4('0x4b')]));_0x628423[_0x49c4('0x4a')]=_0x628423[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x628423['attributes']:_0x301def['model'];if(!_0x4d27d0[_0x49c4('0x47')]['hasOwnProperty'](_0x49c4('0x4d'))){_0x628423[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x24')]);_0x628423[_0x49c4('0x21')]=qs[_0x49c4('0x21')](_0x4d27d0['query'][_0x49c4('0x21')]);}_0x628423[_0x49c4('0x4e')]=qs[_0x49c4('0x4f')](_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x4f')]);_0x628423[_0x49c4('0x50')]=qs[_0x49c4('0x48')](_[_0x49c4('0x51')](_0x4d27d0[_0x49c4('0x47')],_0x301def[_0x49c4('0x48')]),_0x2d93d8);var _0x5b822f=[];var _0x5e63f0=squel[_0x49c4('0x52')]()[_0x49c4('0x53')]('id')['field']('name')[_0x49c4('0x53')]('color')['from'](_0x49c4('0x54'));var _0x4081a5=squel[_0x49c4('0x52')]()[_0x49c4('0x53')](_0x49c4('0x55'))[_0x49c4('0x53')](_0x49c4('0x56'))['field'](_0x49c4('0x57'))[_0x49c4('0x58')](_0x49c4('0x59'),'ui')[_0x49c4('0x5a')](_0x49c4('0x5b'),'u',_0x49c4('0x5c'));var _0x5d24f3=squel['select']()[_0x49c4('0x58')](_0x49c4('0x5d'),'i')[_0x49c4('0x5a')](_0x49c4('0x5e'),'c',_0x49c4('0x5f'))[_0x49c4('0x5a')](_0x49c4('0x5b'),'o','o.id\x20=\x20i.UserId')[_0x49c4('0x5a')](_0x49c4('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x49c4('0x5a')]('chat_messages','me',_0x49c4('0x61'))[_0x49c4('0x5a')](_0x49c4('0x62'),'it',_0x49c4('0x63'))[_0x49c4('0x5a')](_0x49c4('0x54'),'t',_0x49c4('0x64'));var _0x2f520f=squel['expr']();var _0x3894e0=[];var _0x27b9c2=squel['expr']();var _0x10dec7;if(_0x4d27d0[_0x49c4('0x47')]['search']){_0x10dec7=as[_0x49c4('0x65')](_0x4d27d0[_0x49c4('0x47')]['search']);var _0x4dc54d=_0x10dec7['sqlOperator'];for(var _0x513879=0x0;_0x513879<_0x10dec7[_0x49c4('0x66')]['length'];_0x513879++){var _0xb20a5d=_0x10dec7[_0x49c4('0x66')][_0x513879];var _0x515240='i';var _0x679134=_[_0x49c4('0x67')](_0x2d93d8,['name',_0xb20a5d[_0x49c4('0x53')]]);if(!_0x679134){switch(_0xb20a5d[_0x49c4('0x53')]){case _0x49c4('0x68'):if(_0xb20a5d[_0x49c4('0x69')]==0x1){_0x5d24f3['having']('`'+_0xb20a5d[_0x49c4('0x53')]+_0x49c4('0x6a'));}else{_0x5d24f3[_0x49c4('0x6b')]('`'+_0xb20a5d[_0x49c4('0x53')]+'`\x20>\x200');}break;case _0x49c4('0x6c'):if(_0xb20a5d['operator']==='$substring'){if(_0xb20a5d['value']['split']('\x20')[_0x49c4('0x4c')]>0x1){_0x2f520f[_0x4dc54d](_0x49c4('0x6d'),qs[_0x49c4('0x6e')](_0xb20a5d[_0x49c4('0x69')]),null);}else{var _0x5b056e='%'+_0xb20a5d['value']+'%';_0x2f520f[_0x4dc54d](_0x49c4('0x6f'),_0x5b056e,_0x5b056e,_0x5b056e);}}else{_0x679134=_[_0x49c4('0x67')](_0x2d93d8,[_0x49c4('0x28'),_0x49c4('0x70')]);_0xb20a5d[_0x49c4('0x53')]=_0x49c4('0x70');_0x191afb=as[_0x49c4('0x71')](_0x515240,_0x679134[_0x49c4('0x43')],_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb['text'],_0x191afb[_0x49c4('0x69')]['start'],_0x191afb[_0x49c4('0x69')][_0x49c4('0x1f')]);}break;case _0x49c4('0x72'):var _0x1ea1b4=_0xb20a5d[_0x49c4('0x69')][_0x49c4('0x32')](',')[_0x49c4('0x30')](function(_0x3feb0b){return Number(_0x3feb0b);});_0x1ea1b4[_0x49c4('0x33')](function(_0x1743d0){_0x27b9c2['or'](_0x49c4('0x73'),'%,'+_0x1743d0+',%');});_0x3894e0=_[_0x49c4('0x74')](_0x3894e0,_0x1ea1b4);break;case _0x49c4('0x75'):if(_0xb20a5d[_0x49c4('0x76')]===_0x49c4('0x77')){_0x2f520f[_0x4dc54d](_0x49c4('0x78'),'%'+_0xb20a5d[_0x49c4('0x69')]+'%',null);}else{_0x679134=_[_0x49c4('0x67')](_0x2d93d8,['name','UserId']);_0xb20a5d[_0x49c4('0x53')]=_0x49c4('0x3c');_0x191afb=as['buildExpression'](_0x515240,_0x679134[_0x49c4('0x43')],_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb[_0x49c4('0x79')],_0x191afb[_0x49c4('0x69')][_0x49c4('0x7a')],_0x191afb['value']['end']);}break;case'body':_0x191afb=as[_0x49c4('0x71')]('me',null,_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb[_0x49c4('0x79')],_0x191afb[_0x49c4('0x69')][_0x49c4('0x7a')],_0x191afb[_0x49c4('0x69')][_0x49c4('0x1f')]);break;}}else{var _0x191afb=as[_0x49c4('0x71')](_0x515240,_0x679134[_0x49c4('0x43')],_0xb20a5d);_0x2f520f[_0x4dc54d](_0x191afb['text'],_0x191afb[_0x49c4('0x69')][_0x49c4('0x7a')],_0x191afb[_0x49c4('0x69')]['end']);}}}else{var _0x4448b9=_(_0x4d27d0[_0x49c4('0x47')])[_0x49c4('0x46')]()[_0x49c4('0x30')](function(_0x1f25be){return _[_0x49c4('0x7b')](_0x2d93d8,[_0x49c4('0x28'),_0x1f25be])?_0x1f25be:undefined;})[_0x49c4('0x7c')]()['value']();if(!_[_0x49c4('0x7d')](_0x4448b9)){_0x4448b9[_0x49c4('0x33')](function(_0x85540f){if(_0x85540f===_0x49c4('0x7e')){_0x5d24f3[_0x49c4('0x50')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x4d27d0[_0x49c4('0x47')][_0x85540f]));}else if(_0x85540f==='createdAt'){var _0x34cf49=JSON['parse'](_0x4d27d0[_0x49c4('0x47')][_0x85540f])[_0x49c4('0x7f')];var _0x3b03dd=JSON[_0x49c4('0x80')](_0x4d27d0['query'][_0x85540f])[_0x49c4('0x81')];_0x5d24f3[_0x49c4('0x50')](_0x49c4('0x82'),_0x34cf49,_0x3b03dd);}else{if(_0x4d27d0[_0x49c4('0x47')][_0x85540f]===_0x49c4('0x83')){_0x5d24f3[_0x49c4('0x50')]('i.'+_0x85540f+_0x49c4('0x84'));}else{_0x5d24f3[_0x49c4('0x50')]('i.'+_0x85540f+_0x49c4('0x85'),_0x4d27d0[_0x49c4('0x47')][_0x85540f]);}}});}if(_0x4d27d0['query'][_0x49c4('0x86')]){if(_0x4d27d0[_0x49c4('0x47')]['read']==0x1){_0x5d24f3[_0x49c4('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x5d24f3[_0x49c4('0x6b')](_0x49c4('0x87'));}}if(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x88')]){_0x3894e0=_[_0x49c4('0x89')](_0x4d27d0['query'][_0x49c4('0x88')])?_0x4d27d0[_0x49c4('0x47')]['tag']:new Array(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x88')]);_0x3894e0['forEach'](function(_0xbd12b9){_0x27b9c2['or'](_0x49c4('0x73'),'%,'+_0xbd12b9+',%');});}if(_0x4d27d0['query'][_0x49c4('0x8a')]){var _0x993d00=_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x8a')]['replace']('\x5c','\x5c\x5c')[_0x49c4('0x8b')](/'/g,'\x27\x27');if(qs[_0x49c4('0x8c')](_0x993d00)){_0x2f520f['or']('i.id\x20LIKE\x20?',_0x993d00+'%');}else{_0x2f520f['or'](_0x49c4('0x8d'),qs['getFullTextValue'](_0x993d00))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x993d00+'%');}}}_0x5d24f3[_0x49c4('0x50')](_0x2f520f);_0x5d24f3['group']('i.id');var _0x39cacf={'type':db[_0x49c4('0x8e')]['QueryTypes'][_0x49c4('0x8f')],'raw':!![]};var _0x5c3509=_0x5d24f3['clone']();_0x5c3509['field'](_0x49c4('0x90'));_0x5c3509[_0x49c4('0x53')](_0x49c4('0x91'),_0x49c4('0x68'));if(_0x628423['order']){_0x628423['order'][_0x49c4('0x33')](function(_0x48705c){var _0x2c560e=_0x48705c[0x0]==='contactName'?_0x48705c[0x0]:'i.'+_0x48705c[0x0];_0x5d24f3[_0x49c4('0x4e')](_0x2c560e,_0x48705c[0x1]===_0x49c4('0x92')?![]:!![]);});}if(!_[_0x49c4('0x7d')](_0x3894e0)){_0x5d24f3[_0x49c4('0x6b')](_0x27b9c2);_0x5c3509[_0x49c4('0x50')](_0x49c4('0x93'),_0x3894e0);}BPromise[_0x49c4('0x94')]()['then'](function(){if(!_0x10dec7){if(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x7e')])return;_0x5c3509[_0x49c4('0x50')](_0x49c4('0x95'));_0x5d24f3[_0x49c4('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x4d27d0[_0x49c4('0x96')][_0x49c4('0x97')]!==_0x49c4('0x98'))return;return _0x4d27d0['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x49c4('0x14')](function(_0x27b31d){if(_[_0x49c4('0x7d')](_0x27b31d)){_0x5c3509[_0x49c4('0x50')](_0x49c4('0x99'));_0x5d24f3['where'](_0x49c4('0x99'));}else{_0x5c3509[_0x49c4('0x50')](_0x49c4('0x9a'),_[_0x49c4('0x30')](_0x27b31d,'id'));_0x5d24f3['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x49c4('0x30')](_0x27b31d,'id'));}});})[_0x49c4('0x14')](function(){if(_0x4d27d0[_0x49c4('0x96')][_0x49c4('0x97')]===_0x49c4('0x98')&&!_0x10dec7&&!_0x4d27d0['query'][_0x49c4('0x7e')])return[];return db[_0x49c4('0x9b')][_0x49c4('0x47')](_0x5c3509[_0x49c4('0x9c')](),_0x39cacf);})[_0x49c4('0x14')](function(_0x8f37e5){_0x258abe['count']=_0x8f37e5[_0x49c4('0x4c')];if(_0x258abe[_0x49c4('0x23')]===0x0)return[];return db[_0x49c4('0x9b')][_0x49c4('0x47')](_0x5e63f0['toString'](),_0x39cacf)['then'](function(_0xa96f53){_0x5b822f=_['keyBy'](_0xa96f53,'id');_0x39cacf=_[_0x49c4('0x2a')](_0x39cacf,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4d27d0[_0x49c4('0x47')][_0x49c4('0x4b')]){_0x628423[_0x49c4('0x4a')][_0x49c4('0x33')](function(_0x4eebc9){_0x5d24f3['field']('i.'+_0x4eebc9);});}else{_0x5d24f3[_0x49c4('0x53')](_0x49c4('0x91'),_0x49c4('0x68'));_0x5d24f3['field']('a.key',_0x49c4('0x9d'));_0x5d24f3['field']('a.mandatoryDisposition',_0x49c4('0x9e'));_0x5d24f3['field'](_0x49c4('0x9f'),_0x49c4('0xa0'));_0x5d24f3['field'](_0x49c4('0xa1'));_0x5d24f3[_0x49c4('0x53')]('c.firstName','Contact.firstName');_0x5d24f3[_0x49c4('0x53')]('c.lastName',_0x49c4('0xa2'));_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xa3'),_0x49c4('0xa4'));_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xa5'),_0x49c4('0xa6'));_0x5d24f3['field'](_0x49c4('0xa7'),_0x49c4('0xa8'));_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xa9'),_0x49c4('0xaa'));_0x5d24f3['field'](_0x49c4('0xab'),'Owner.fullname');_0x5d24f3[_0x49c4('0x53')](_0x49c4('0xac'),_0x49c4('0xad'));_0x5d24f3[_0x49c4('0x53')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x49c4('0x31'));}if(_0x628423[_0x49c4('0x24')])_0x5d24f3[_0x49c4('0x24')](_0x628423[_0x49c4('0x24')]);if(_0x628423[_0x49c4('0x21')])_0x5d24f3[_0x49c4('0x21')](_0x628423['offset']);return db[_0x49c4('0x9b')]['query'](_0x5d24f3[_0x49c4('0x9c')](),_0x39cacf);})[_0x49c4('0x14')](function(_0x1db53d){if(_0x1db53d[_0x49c4('0x4c')]>0x0)_0x4081a5['where'](_0x49c4('0xae'),_[_0x49c4('0x30')](_0x1db53d,'id'));return db['sequelize'][_0x49c4('0x47')](_0x4081a5[_0x49c4('0x9c')](),_0x39cacf)['then'](function(_0x562f47){var _0x25f1c7=_[_0x49c4('0xaf')](_0x562f47,_0x49c4('0xb0'));var _0x1aa3a3=[];_0x1db53d[_0x49c4('0x33')](function(_0x15e403){_0x1aa3a3[_0x49c4('0x35')](updateChatInteraction(_0x15e403,_0x5b822f,_0x25f1c7));});return BPromise[_0x49c4('0xb1')](_0x1aa3a3);});});})[_0x49c4('0x14')](function(_0x117c64){_0x258abe[_0x49c4('0xb2')]=_0x117c64;return _0x258abe;})['then'](respondWithFilteredResult(_0x33696e,_0x628423))['catch'](handleError(_0x33696e,null));};exports[_0x49c4('0xb3')]=function(_0x1e286e,_0xccdf6d){var _0x5be042={'raw':![],'where':{'id':_0x1e286e[_0x49c4('0xb4')]['id']}},_0x1276bf={};_0x1276bf['model']=_[_0x49c4('0x46')](db['ChatInteraction'][_0x49c4('0x41')]);_0x1276bf[_0x49c4('0x47')]=_[_0x49c4('0x46')](_0x1e286e[_0x49c4('0x47')]);_0x1276bf['filters']=_[_0x49c4('0x49')](_0x1276bf[_0x49c4('0x45')],_0x1276bf[_0x49c4('0x47')]);_0x5be042[_0x49c4('0x4a')]=_[_0x49c4('0x49')](_0x1276bf['model'],qs['fields'](_0x1e286e['query'][_0x49c4('0x4b')]));_0x5be042[_0x49c4('0x4a')]=_0x5be042[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x5be042[_0x49c4('0x4a')]:_0x1276bf['model'];if(_0x1e286e[_0x49c4('0x47')][_0x49c4('0xb5')]){_0x5be042[_0x49c4('0xb6')]=[{'all':!![]}];}_0x5be042=_[_0x49c4('0x2a')]({},_0x5be042,_0x1e286e['options']);return db[_0x49c4('0x40')][_0x49c4('0x67')](_0x5be042)[_0x49c4('0x14')](handleEntityNotFound(_0xccdf6d,null))[_0x49c4('0x14')](respondWithResult(_0xccdf6d,null))[_0x49c4('0x1d')](handleError(_0xccdf6d,null));};exports['create']=function(_0x1d9e1a,_0x9b622d){return db[_0x49c4('0x40')]['create'](_0x1d9e1a[_0x49c4('0x2b')],{})[_0x49c4('0x14')](respondWithResult(_0x9b622d,0xc9))[_0x49c4('0x1d')](handleError(_0x9b622d,null));};exports['update']=function(_0x97f579,_0x491231){if(_0x97f579['body']['id']){delete _0x97f579[_0x49c4('0x2b')]['id'];}return db[_0x49c4('0x40')]['find']({'where':{'id':_0x97f579[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x491231,null))[_0x49c4('0x14')](saveUpdates(_0x97f579[_0x49c4('0x2b')],null))[_0x49c4('0x14')](respondWithResult(_0x491231,null))[_0x49c4('0x1d')](handleError(_0x491231,null));};exports[_0x49c4('0xb7')]=function(_0x219133,_0x59dbef){return db['ChatInteraction'][_0x49c4('0x67')]({'where':{'id':_0x219133[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x59dbef,null))['then'](removeEntity(_0x59dbef,null))['catch'](handleError(_0x59dbef,null));};exports[_0x49c4('0xb8')]=function(_0x3222ec,_0xd979f7){return db[_0x49c4('0x40')][_0x49c4('0xb8')]()[_0x49c4('0x14')](respondWithResult(_0xd979f7,null))[_0x49c4('0x1d')](handleError(_0xd979f7,null));};exports[_0x49c4('0xb9')]=function(_0x318008,_0x1e2dd3){var _0xa42e74=_0x318008[_0x49c4('0xb4')]['id'];var _0x352b67;var _0xbfb25b;var _0x4cc855;return db[_0x49c4('0x40')][_0x49c4('0xba')]({'where':{'id':_0xa42e74}})[_0x49c4('0x14')](function(_0x318aaf){_0x352b67=_0x318aaf;return db['ChatWebsite']['findOne']({'where':{'id':_0x318aaf[_0x49c4('0x7e')]},'attributes':['id','vidaooApiKey',_0x49c4('0xbb'),_0x49c4('0xbc'),_0x49c4('0xbd'),_0x49c4('0xbe')],'raw':!![]});})[_0x49c4('0x14')](function(_0x45a2ef){if(_0x45a2ef&&_0x45a2ef[_0x49c4('0xbf')]&&_0x45a2ef[_0x49c4('0xbb')]){_0xbfb25b=_0x45a2ef;var _0x31ba95={'interaction':{'id':_0xa42e74},'agent':{'id':_0x318008[_0x49c4('0x96')]['id'],'name':_0x318008[_0x49c4('0x96')][_0x49c4('0x28')],'fullname':_0x318008['user'][_0x49c4('0xc0')],'email':_0x318008[_0x49c4('0x96')][_0x49c4('0xc1')]},'contact':_0x318008['body'][_0x49c4('0x2c')],'account':_0x318008['body'][_0x49c4('0x2e')]};var _0x82925={'rejectUnauthorized':![],'method':_0x49c4('0xc2'),'url':_0x49c4('0xc3'),'headers':{'X-APIKEY':_0x45a2ef['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x318008[_0x49c4('0x96')]['email']],'buttons':null,'topic':_0xbfb25b['vidaooTopic'],'note':_[_0x49c4('0xc4')](_0xbfb25b[_0x49c4('0xbd')])?null:getMustacheRender(_0xbfb25b[_0x49c4('0xbd')],_0x31ba95),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0xbfb25b[_0x49c4('0xbe')])){var _0x1221de=getMustacheRender(_0xbfb25b[_0x49c4('0xbe')],_0x31ba95);var _0x330512=JSON[_0x49c4('0x80')](_0x1221de);_0x82925[_0x49c4('0x2b')][_0x49c4('0xc5')]=_0x330512;}}catch(_0x19f30b){throw new db[(_0x49c4('0x8e'))]['ValidationError'](_0x49c4('0xc6'));}return rp(_0x82925);}else{throw new db[(_0x49c4('0x8e'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x49c4('0x14')](function(_0x4d5481){_0x4cc855=_0x4d5481;if(_0x4cc855['id']){var _0xefec38={'body':_0x4cc855['join_url'],'ChatWebsiteId':_0xbfb25b['id'],'ChatInteractionId':_0x352b67['id'],'direction':_0x49c4('0xc7'),'UserId':_0x318008['user']['id']};return db[_0x49c4('0xc8')][_0x49c4('0xc9')](_0xefec38,{});}else{throw new db[(_0x49c4('0x8e'))][(_0x49c4('0xca'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x352b67[_0x49c4('0xcb')]({'vidaooSessionId':_0x4cc855['id']});})[_0x49c4('0x14')](respondWithResult(_0x1e2dd3,null))[_0x49c4('0x1d')](handleError(_0x1e2dd3,null));};exports['customUpdate']=function(_0x367d3d,_0x1814c4){if(_0x367d3d['body']['id']){delete _0x367d3d['body']['id'];}return db[_0x49c4('0x40')][_0x49c4('0x67')]({'where':{'id':_0x367d3d[_0x49c4('0xb4')]['id']},'include':[{'model':db['CmContact'],'as':_0x49c4('0x6c')}]})[_0x49c4('0x14')](handleEntityNotFound(_0x1814c4,null))[_0x49c4('0x14')](saveUpdates(_0x367d3d[_0x49c4('0x2b')],null))['then'](respondWithResult(_0x1814c4,null))[_0x49c4('0x1d')](handleError(_0x1814c4,null));};exports['abandon']=function(_0x4d0a28,_0xf5f718){if(_0x4d0a28[_0x49c4('0x2b')]['id']){delete _0x4d0a28[_0x49c4('0x2b')]['id'];}return db[_0x49c4('0x40')]['find']({'where':{'id':_0x4d0a28[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](function(_0xa6f48){if(!_0xa6f48){logger[_0x49c4('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x49c4('0xcc'),0x194,'entity\x20not\x20found');_0xf5f718['sendStatus'](0x194);}else{if(_0xa6f48[_0x49c4('0x3c')]){throw new db[(_0x49c4('0x8e'))][(_0x49c4('0xca'))]('Interaction\x20already\x20assigned');}}return _0xa6f48;})[_0x49c4('0x14')](function(_0x4a874a){if(_0x4a874a){return _0x4a874a[_0x49c4('0x27')]({'closed':_0x4d0a28[_0x49c4('0x2b')][_0x49c4('0x3d')],'disposition':_0x4d0a28[_0x49c4('0x2b')][_0x49c4('0x3e')]})[_0x49c4('0x14')](function(_0x2b31ac){return _0x2b31ac;});}})['then'](function(){return respondWithRpcPromise(_0x49c4('0xcd'),_0x49c4('0xcc'),_0x4d0a28[_0x49c4('0x2b')],client9004);})[_0x49c4('0x14')](respondWithResult(_0xf5f718,null))['catch'](handleError(_0xf5f718,null));};exports['attachmentUpload']=function(_0x4c15ff,_0x2d4f8a){_0x4c15ff[_0x49c4('0x2b')][_0x49c4('0x28')]=_0x4c15ff[_0x49c4('0xce')][_0x49c4('0xcf')];_0x4c15ff[_0x49c4('0x2b')][_0x49c4('0xd0')]=_0x4c15ff['file'][_0x49c4('0xd1')];_0x4c15ff[_0x49c4('0x2b')]['type']=_0x4c15ff['file']['mimetype'];return db[_0x49c4('0xd2')][_0x49c4('0xc9')](_0x4c15ff[_0x49c4('0x2b')])[_0x49c4('0x14')](respondWithResult(_0x2d4f8a,0xc9))[_0x49c4('0x1d')](handleError(_0x2d4f8a,null));};exports[_0x49c4('0xd3')]=function(_0x2f36c6,_0x5039fc){return db[_0x49c4('0x40')][_0x49c4('0xba')]({'where':{'id':_0x2f36c6[_0x49c4('0xb4')]['id']},'raw':!![]})[_0x49c4('0x14')](handleEntityNotFound(_0x5039fc,null))['then'](function(_0x3440ad){if(_0x3440ad){if(_0x3440ad[_0x49c4('0x3d')]){return _0x5039fc[_0x49c4('0x1e')](0x193)[_0x49c4('0x20')]({'status':0x193,'message':_0x49c4('0xd4')});}return db['Attachment'][_0x49c4('0xba')]({'where':{'id':_0x2f36c6['query']['attachId']},'raw':!![]})[_0x49c4('0x14')](handleEntityNotFound(_0x5039fc,null));}})[_0x49c4('0x14')](function(_0x113beb){if(_0x113beb){var _0x35289f=_0x113beb[_0x49c4('0xd5')]!==null;var _0x5b9591=path[_0x49c4('0xd6')](config[_0x49c4('0xd7')],_0x49c4('0xd8'));if(_0x35289f){_0x5b9591=path['join'](_0x5b9591,_0x49c4('0xd9'));}var _0x45c34a=path['join'](_0x5b9591,_0x113beb[_0x49c4('0xd0')]);return _0x5039fc[_0x49c4('0xda')](_0x45c34a);}})[_0x49c4('0x1d')](handleError(_0x5039fc,null));};exports[_0x49c4('0xdb')]=function(_0x2ef538,_0x163128){var _0x1679ca=null;var _0x4b0114=null;var _0x261d61=null;if(_0x2ef538[_0x49c4('0x2b')]['id']){delete _0x2ef538[_0x49c4('0x2b')]['id'];}if(_0x2ef538[_0x49c4('0x2b')][_0x49c4('0xdc')]){_0x261d61=path['join'](config[_0x49c4('0xd7')],_0x49c4('0xdd'),util[_0x49c4('0xde')](_0x49c4('0xdf'),Date[_0x49c4('0xe0')]()));_0x2ef538['body'][_0x49c4('0xe1')]=_0x261d61;}return db[_0x49c4('0x40')][_0x49c4('0x67')]({'where':{'id':_0x2ef538[_0x49c4('0xb4')]['id']},'include':[{'model':db[_0x49c4('0xc8')],'as':_0x49c4('0xe2'),'include':[{'model':db[_0x49c4('0x75')],'as':_0x49c4('0x75')}]}]})[_0x49c4('0x14')](handleEntityNotFound(_0x163128,null))[_0x49c4('0x14')](saveUpdates(_0x2ef538['body'],null))[_0x49c4('0x14')](function(_0x1b6966){if(_0x1b6966){_0x1679ca=_0x1b6966;return db[_0x49c4('0xe3')][_0x49c4('0x67')]({'where':{'id':_0x1679ca[_0x49c4('0x7e')]}});}})['then'](function(_0x501786){if(_0x501786){_0x4b0114=_0x501786;return db[_0x49c4('0xe4')][_0x49c4('0x67')]({'where':{'id':_0x1679ca[_0x49c4('0x70')]}});}})[_0x49c4('0x14')](function(_0xd87f7e){if(_0xd87f7e){if(_0x261d61){var _0x25d2a1=null;for(var _0x58d24f=0x1;_0x58d24f<_0x1679ca[_0x49c4('0xe2')][_0x49c4('0x4c')];++_0x58d24f){_0x25d2a1=_0x1679ca['Messages'][_0x58d24f];var _0x386595=_0x25d2a1['UserId']?util[_0x49c4('0xde')](_0x49c4('0xe5'),_0x4b0114[_0x49c4('0xe6')],_0x25d2a1['UserId']):_0x49c4('0xe7');var _0x4f431e=_0x2ef538[_0x49c4('0x2b')]['customer']||util['format'](_0x49c4('0xe5'),_0x49c4('0xe8'),_0x25d2a1[_0x49c4('0x70')]);switch(_0x4b0114[_0x49c4('0xe9')]){case _0x49c4('0xea'):_0x386595=_0x25d2a1[_0x49c4('0x3c')]?util['format']('%s%d',_0x4b0114[_0x49c4('0xe6')],_0x25d2a1[_0x49c4('0x3c')]):_0x49c4('0xe7');break;case _0x49c4('0xeb'):_0x386595=_0x25d2a1[_0x49c4('0x3c')]?_0x25d2a1[_0x49c4('0x75')][_0x49c4('0xec')]||_0x25d2a1['User']['fullname']:'System';break;case'agent_fullname':_0x386595=_0x25d2a1[_0x49c4('0x3c')]?_0x25d2a1['User'][_0x49c4('0xc0')]:_0x49c4('0xe7');break;default:_0x386595=_0x25d2a1[_0x49c4('0x3c')]?util['format']('%s%d',_0x4b0114[_0x49c4('0xe6')],_0x25d2a1[_0x49c4('0x3c')]):'System';}var _0x4323ec=util[_0x49c4('0xde')](_0x49c4('0xed'),moment(_0x25d2a1[_0x49c4('0xee')])[_0x49c4('0xde')](_0x49c4('0xef')),_0x25d2a1['direction']==='in'?_0x4f431e:_0x386595,_0x25d2a1[_0x49c4('0x2b')]);if(!_0x25d2a1[_0x49c4('0xf0')]){fs[_0x49c4('0xf1')](_0x261d61,_0x4323ec);}}return db['MailAccount'][_0x49c4('0xba')]({'where':{'service':!![]},'include':[{'model':db[_0x49c4('0xf2')],'as':_0x49c4('0xf3'),'raw':!![],'include':[{'model':db[_0x49c4('0xf4')],'as':_0x49c4('0xf4'),'raw':!![]}]}]});}}})[_0x49c4('0x14')](function(_0x82c4bf){if(!_0x82c4bf||!_0x82c4bf[_0x49c4('0xf3')]||!_0x2ef538['body'])return _0x1679ca;var _0x2fc500=_0x82c4bf[_0x49c4('0xf5')]();return respondWithRpcPromise(_0x49c4('0xf6'),_0x49c4('0xf7'),{'account':_0x2fc500,'message':{'from':util[_0x49c4('0xde')](_0x49c4('0xf8'),_0x82c4bf['name'],_0x82c4bf[_0x49c4('0xc1')]||_0x82c4bf[_0x49c4('0xf3')][_0x49c4('0x96')]),'to':_0x2ef538[_0x49c4('0x2b')][_0x49c4('0xdc')],'subject':_0x49c4('0xf9'),'text':util[_0x49c4('0xde')](_0x49c4('0xfa'),_0x2ef538[_0x49c4('0x2b')][_0x49c4('0xdc')]),'attachments':[{'path':_0x261d61}]}})[_0x49c4('0x14')](function(){return _0x1679ca;})[_0x49c4('0x1d')](function(_0x471e28){logger[_0x49c4('0x1a')](_0x471e28);});})['then'](respondWithStatusCode(_0x163128,0xc8))['catch'](handleError(_0x163128,null));};exports[_0x49c4('0xfb')]=function(_0x3b6fd2,_0x4c07b3){return db['ChatMessage'][_0x49c4('0x67')]({'where':{'id':_0x3b6fd2['params']['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x4c07b3,null))[_0x49c4('0x14')](function(_0x1ac2c0){if(_0x1ac2c0){return _0x1ac2c0[_0x49c4('0xfb')](_0x3b6fd2[_0x49c4('0x2b')][_0x49c4('0xfc')],_[_0x49c4('0xfd')](_0x3b6fd2[_0x49c4('0x2b')],['ids','id'])||{});}})[_0x49c4('0x14')](respondWithResult(_0x4c07b3,null))[_0x49c4('0x1d')](handleError(_0x4c07b3,null));};exports[_0x49c4('0xfe')]=function(_0xd2ee5e,_0x201909){var _0x5b2cc8={'raw':![],'where':{}};var _0x2bfa4f={};var _0x2b507f={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x49c4('0xba')]({'where':{'id':_0xd2ee5e[_0x49c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0x201909,null))[_0x49c4('0x14')](function(_0x3119a5){if(_0x3119a5){_0x2bfa4f[_0x49c4('0x45')]=_['keys'](db[_0x49c4('0xc8')][_0x49c4('0x41')]);_0x2bfa4f[_0x49c4('0x47')]=_[_0x49c4('0x46')](_0xd2ee5e['query']);_0x2bfa4f[_0x49c4('0x48')]=_['intersection'](_0x2bfa4f[_0x49c4('0x45')],_0x2bfa4f[_0x49c4('0x47')]);_0x5b2cc8[_0x49c4('0x4a')]=_[_0x49c4('0x49')](_0x2bfa4f['model'],qs[_0x49c4('0x4b')](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x4b')]));_0x5b2cc8[_0x49c4('0x4a')]=_0x5b2cc8[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x5b2cc8['attributes']:_0x2bfa4f['model'];if(!_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0xff')](_0x49c4('0x4d'))){_0x5b2cc8[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x24')]);_0x5b2cc8[_0x49c4('0x21')]=qs[_0x49c4('0x21')](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x21')]);}_0x5b2cc8[_0x49c4('0x4e')]=qs['sort'](_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x4f')]);_0x5b2cc8['where']=qs[_0x49c4('0x48')](_['pick'](_0xd2ee5e[_0x49c4('0x47')],_0x2bfa4f[_0x49c4('0x48')]));_0x5b2cc8['where'][_0x49c4('0xb0')]=_0x3119a5['id'];if(_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x8a')]){_0x5b2cc8[_0x49c4('0x50')]=_[_0x49c4('0x2a')](_0x5b2cc8['where'],{'$or':_[_0x49c4('0x30')](_0x5b2cc8['attributes'],function(_0x1c74ce){var _0x216896={};_0x216896[_0x1c74ce]={'$like':'%'+_0xd2ee5e[_0x49c4('0x47')]['filter']+'%'};return _0x216896;})});}if(_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0x7f')]){var _0x37ec56=_0xd2ee5e['query']['$gte'][_0x49c4('0x32')](',');var _0x590586={};_0x590586[_0x37ec56[0x0]]={'$gte':moment(_0x37ec56[0x1])[_0x49c4('0xde')](_0x49c4('0x100'))};_0x5b2cc8[_0x49c4('0x50')]=_[_0x49c4('0x2a')](_0x5b2cc8['where'],_0x590586);}_0x5b2cc8=_['merge']({},_0x5b2cc8,_0xd2ee5e['options']);return db[_0x49c4('0xc8')][_0x49c4('0x23')]({'where':_0x5b2cc8[_0x49c4('0x50')]})[_0x49c4('0x14')](function(_0x5255f7){_0x2b507f[_0x49c4('0x23')]=_0x5255f7;if(_0xd2ee5e[_0x49c4('0x47')][_0x49c4('0xb5')]){_0x5b2cc8[_0x49c4('0xb6')]=[{'all':!![]}];}return db[_0x49c4('0xc8')][_0x49c4('0x101')](_0x5b2cc8);})[_0x49c4('0x14')](function(_0x1d2931){_0x2b507f[_0x49c4('0xb2')]=_0x1d2931;return _0x2b507f;});}})[_0x49c4('0x14')](respondWithFilteredResult(_0x201909,_0x5b2cc8))[_0x49c4('0x1d')](handleError(_0x201909,null));};exports['getMyMessages']=function(_0x16e808,_0x514446){var _0x3308c4={'where':{}},_0x3683d7={},_0x4feb6f={'count':0x0,'rows':[]};return db[_0x49c4('0x40')]['findOne']({'where':{'id':_0x16e808[_0x49c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0x514446,null))['then'](function(_0x577ae6){if(_0x577ae6){_0x3683d7[_0x49c4('0x45')]=_[_0x49c4('0x46')](db[_0x49c4('0xc8')]['rawAttributes']);_0x3683d7[_0x49c4('0x47')]=_['keys'](_0x16e808[_0x49c4('0x47')]);_0x3683d7[_0x49c4('0x48')]=_[_0x49c4('0x49')](_0x3683d7['model'],_0x3683d7[_0x49c4('0x47')]);_0x3308c4[_0x49c4('0x4a')]=_[_0x49c4('0x49')](_0x3683d7[_0x49c4('0x45')],qs[_0x49c4('0x4b')](_0x16e808['query'][_0x49c4('0x4b')]));_0x3308c4[_0x49c4('0x4a')]=_0x3308c4[_0x49c4('0x4a')][_0x49c4('0x4c')]?_0x3308c4['attributes']:_0x3683d7['model'];if(!_0x16e808[_0x49c4('0x47')][_0x49c4('0xff')]('nolimit')){_0x3308c4[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0x16e808[_0x49c4('0x47')][_0x49c4('0x24')]);_0x3308c4['offset']=qs[_0x49c4('0x21')](_0x16e808[_0x49c4('0x47')]['offset']);}_0x3308c4['order']=qs[_0x49c4('0x4f')](_0x16e808[_0x49c4('0x47')][_0x49c4('0x4f')]);_0x3308c4[_0x49c4('0x50')]=qs[_0x49c4('0x48')](_['pick'](_0x16e808[_0x49c4('0x47')],_0x3683d7['filters']));_0x3308c4[_0x49c4('0x50')][_0x49c4('0xb0')]=_0x577ae6['id'];if(_0x16e808[_0x49c4('0x47')][_0x49c4('0x8a')]){_0x3308c4['where']=_['merge'](_0x3308c4['where'],{'$or':_[_0x49c4('0x30')](_0x3308c4[_0x49c4('0x4a')],function(_0x14d5ca){var _0x2cb936={};_0x2cb936[_0x14d5ca]={'$like':'%'+_0x16e808['query']['filter']+'%'};return _0x2cb936;})});}_0x3308c4[_0x49c4('0x50')]['secret']=![];if(_0x16e808[_0x49c4('0x47')]['id']){_0x3308c4[_0x49c4('0x50')]['id']={'$gt':_0x16e808['query']['id']};}_0x3308c4=_[_0x49c4('0x2a')]({},_0x3308c4,_0x16e808[_0x49c4('0x102')]);return db[_0x49c4('0xc8')]['count']({'where':_0x3308c4[_0x49c4('0x50')]})[_0x49c4('0x14')](function(_0x1a5755){_0x4feb6f['count']=_0x1a5755;_0x3308c4[_0x49c4('0xb6')]=[];if(_0x16e808[_0x49c4('0x47')]['includeAgent']){_0x3308c4[_0x49c4('0xb6')][_0x49c4('0x35')]({'model':db['User'],'as':_0x49c4('0x75'),'attributes':['id',_0x49c4('0xc0'),_0x49c4('0xec')]});}if(_0x16e808[_0x49c4('0x47')][_0x49c4('0xb5')]){_0x3308c4['include']=[{'all':!![]}];}return db[_0x49c4('0xc8')][_0x49c4('0x101')](_0x3308c4);})['then'](function(_0x5a4b35){_0x4feb6f[_0x49c4('0xb2')]=_0x5a4b35;return _0x4feb6f;});}})[_0x49c4('0x14')](respondWithFilteredResult(_0x514446,_0x3308c4))['catch'](handleError(_0x514446,null));};exports[_0x49c4('0x103')]=function(_0x55bb71,_0x4059b0){return db[_0x49c4('0x40')]['find']({'where':{'id':_0x55bb71[_0x49c4('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4059b0,null))[_0x49c4('0x14')](function(_0x17ab2c){if(_0x17ab2c){return _0x17ab2c['setTags'](_0x55bb71[_0x49c4('0x2b')][_0x49c4('0xfc')],_['omit'](_0x55bb71['body'],[_0x49c4('0xfc'),'id'])||{})[_0x49c4('0x104')](function(){return db[_0x49c4('0x72')][_0x49c4('0x101')]({'attributes':['id',_0x49c4('0x28'),'color'],'where':{'id':_0x55bb71[_0x49c4('0x2b')][_0x49c4('0xfc')]}});})[_0x49c4('0x14')](function(_0xd62ca){socket[_0x49c4('0x105')]('chatInteractionTags:save',{'id':Number(_0x55bb71[_0x49c4('0xb4')]['id']),'tags':_0xd62ca||[]});return{'id':Number(_0x55bb71[_0x49c4('0xb4')]['id']),'tags':_0xd62ca||[]};});}})[_0x49c4('0x14')](respondWithResult(_0x4059b0,null))[_0x49c4('0x1d')](handleError(_0x4059b0,null));};exports[_0x49c4('0x106')]=function(_0x39abbf,_0x3de5d8){return db[_0x49c4('0x40')]['find']({'where':{'id':_0x39abbf[_0x49c4('0xb4')]['id']}})[_0x49c4('0x14')](handleEntityNotFound(_0x3de5d8,null))[_0x49c4('0x14')](function(_0x5a4b4c){if(_0x5a4b4c){return _0x5a4b4c['removeTags'](_0x39abbf[_0x49c4('0x47')]['ids']);}})[_0x49c4('0x14')](respondWithStatusCode(_0x3de5d8,null))[_0x49c4('0x1d')](handleError(_0x3de5d8,null));};exports[_0x49c4('0xda')]=function(_0x3f0e74,_0x55f423){var _0x3ce0f9=moment()[_0x49c4('0x107')]()[_0x49c4('0x9c')]();var _0x156a4f=path['join'](config[_0x49c4('0xd7')],_0x49c4('0x108'),'files',_0x49c4('0x109'));var _0x22005f=path[_0x49c4('0xd6')](config[_0x49c4('0xd7')],_0x49c4('0x108'),_0x49c4('0x10a'),_0x49c4('0x10b'));var _0x1d3b1a=path['join'](_0x156a4f,_0x3ce0f9);var _0x4eb6ba=util['format'](_0x49c4('0x10c'),_0x3f0e74[_0x49c4('0xb4')]['id'],_0x3ce0f9);var _0x418ead=path[_0x49c4('0xd6')](_0x156a4f,_0x4eb6ba);var _0x39ff8b=[];_0x39ff8b['push']({'model':db[_0x49c4('0x75')],'as':_0x49c4('0x75'),'attributes':['id',_0x49c4('0xc0')],'raw':!![]});_0x39ff8b[_0x49c4('0x35')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x49c4('0x10d'),_0x49c4('0x10e')],'raw':!![]});if(_0x3f0e74[_0x49c4('0x47')][_0x49c4('0x10b')]){_0x39ff8b[_0x49c4('0x35')]({'model':db[_0x49c4('0xd2')],'as':'Attachment','raw':!![]});}var _0x58a5c9=[{'model':db[_0x49c4('0xc8')],'as':_0x49c4('0xe2'),'attributes':['id',_0x49c4('0x2b'),_0x49c4('0xee'),_0x49c4('0x10f'),'secret',_0x49c4('0x86')],'include':_0x39ff8b}];_0x58a5c9[_0x49c4('0x35')]({'model':db[_0x49c4('0xe3')],'as':_0x49c4('0x110'),'attributes':['id',_0x49c4('0x28')]});_0x58a5c9[_0x49c4('0x35')]({'model':db[_0x49c4('0x75')],'as':_0x49c4('0x111'),'attributes':['id',_0x49c4('0xc0')]});return db['ChatInteraction'][_0x49c4('0x67')]({'where':{'id':_0x3f0e74[_0x49c4('0xb4')]['id']},'include':_0x58a5c9})[_0x49c4('0x14')](handleEntityNotFound(_0x55f423,null))[_0x49c4('0x14')](function(_0xe5bb64){if(_0xe5bb64){var _0x5e5ca3=_0xe5bb64[_0x49c4('0x112')]({'plain':!![]});fs[_0x49c4('0x113')](_0x1d3b1a);var _0x485c2d={'channel':_0x49c4('0x114'),'account':_0x5e5ca3['Account'][_0x49c4('0x28')],'agent':_0x5e5ca3['Owner']?_0x5e5ca3[_0x49c4('0x111')][_0x49c4('0xc0')]:'N.A.','createdAt':moment(_0x5e5ca3[_0x49c4('0xee')])['format'](_0x49c4('0x100'))[_0x49c4('0x9c')](),'closedAt':_0x5e5ca3[_0x49c4('0x3d')]?moment(_0x5e5ca3[_0x49c4('0x115')])[_0x49c4('0xde')]('YYYY-MM-DD\x20HH:mm:ss')[_0x49c4('0x9c')]():'','disposition':_0x5e5ca3[_0x49c4('0x3e')],'chatInfo':{'browser':_0x5e5ca3[_0x49c4('0x116')],'os':_0x5e5ca3[_0x49c4('0x117')],'referer':_0x5e5ca3[_0x49c4('0x118')],'customerIp':_0x5e5ca3[_0x49c4('0x119')],'customerPort':_0x5e5ca3[_0x49c4('0x11a')]?_0x5e5ca3[_0x49c4('0x11a')]:'N.A.'},'messages':_(_0x5e5ca3[_0x49c4('0xe2')])[_0x49c4('0x11b')]()[_0x49c4('0x8a')]({'secret':![]})[_0x49c4('0x30')](function(_0x341528){if(_0x341528[_0x49c4('0xd2')]){var _0x2a0ef8=path[_0x49c4('0xd6')](_0x22005f,_0x341528[_0x49c4('0xd2')][_0x49c4('0xd0')]);if(fs[_0x49c4('0x11c')](_0x2a0ef8)){fs[_0x49c4('0x11d')](_0x2a0ef8)['pipe'](fs[_0x49c4('0x11e')](path['join'](_0x1d3b1a,_0x341528[_0x49c4('0xd2')][_0x49c4('0xd0')])));}}return{'date':moment(_0x341528[_0x49c4('0xee')])[_0x49c4('0xde')](_0x49c4('0x100'))[_0x49c4('0x9c')](),'sender':_0x341528[_0x49c4('0x10f')]===_0x49c4('0xc7')?_0x341528[_0x49c4('0x75')]?_0x341528[_0x49c4('0x75')][_0x49c4('0xc0')]:_0x49c4('0xe7'):_0x341528[_0x49c4('0x6c')][_0x49c4('0x10d')]+(_0x341528[_0x49c4('0x6c')]['lastName']?'\x20'+_0x341528[_0x49c4('0x6c')][_0x49c4('0x10e')]:''),'body':_0x341528['Attachment']?_0x341528[_0x49c4('0xd2')]['basename']:_0x341528[_0x49c4('0x2b')],'direction':_0x341528[_0x49c4('0x10f')]===_0x49c4('0xc7')?'A':'C','secret':_0x341528[_0x49c4('0xf0')],'read':_0x341528[_0x49c4('0x86')],'attachment':_0x341528['Attachment']};})['value']()};return ejs[_0x49c4('0x11f')](path[_0x49c4('0xd6')](config[_0x49c4('0xd7')],'server',_0x49c4('0x120'),_0x49c4('0x121')),{'interaction':_0x485c2d})['then'](function(_0x6a1d66){var _0x563f95=path['join'](_0x1d3b1a,'transcript-'+_0x5e5ca3['id']+'-'+_0x3ce0f9+_0x49c4('0x122'));var _0x442210={'path':_0x563f95,'channel':_0x49c4('0x114'),'interactionId':_0x5e5ca3['id']};return pdf[_0x49c4('0x123')](_0x6a1d66,_0x442210);})[_0x49c4('0x14')](function(){return new Promise(function(_0x547d37,_0x223fa2){zipdir(_0x1d3b1a,{'saveTo':_0x418ead},function(_0x147d5e,_0x29674d){if(_0x147d5e)return _0x223fa2(_0x147d5e);return _0x547d37(_0x29674d);});})['then'](function(){return new BPromise(function(_0x17b015,_0x724d15){rimraf(_0x1d3b1a,function(_0x3350da){if(_0x3350da)_0x724d15(_0x3350da);return _0x17b015();});});})[_0x49c4('0x14')](function(){return _0x55f423[_0x49c4('0xda')](_0x418ead,_0x4eb6ba,function(_0x146c6e){if(_0x146c6e){logger[_0x49c4('0x1a')](_0x49c4('0x124'),_0x146c6e);}else{fs[_0x49c4('0x125')](_0x418ead);}});});});}else{return _0x55f423[_0x49c4('0x126')](0xc8);}})[_0x49c4('0x1d')](handleError(_0x55f423,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 97940b3..28474b7 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 _0x7e8a=['emit','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x40b5d7,_0x222e3f){var _0x39b22e=function(_0x386243){while(--_0x386243){_0x40b5d7['push'](_0x40b5d7['shift']());}};_0x39b22e(++_0x222e3f);}(_0x7e8a,0x123));var _0xa7e8=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x7e8a[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require(_0xa7e8('0x0'));var ChatInteraction=require(_0xa7e8('0x1'))['db'][_0xa7e8('0x2')];var ChatMessage=require(_0xa7e8('0x1'))['db'][_0xa7e8('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa7e8('0x4')](0x0);var events={'afterCreate':_0xa7e8('0x5'),'afterUpdate':_0xa7e8('0x6'),'afterDestroy':_0xa7e8('0x7')};function emitEvent(_0x5cfb20){return function(_0x3e8150,_0x51e61b,_0x536a2a){_0x3e8150[_0xa7e8('0x8')]({'attributes':['id'],'raw':!![]})[_0xa7e8('0x9')](function(_0xe5f9e5){_0x3e8150[_0xa7e8('0xa')](_0xa7e8('0xb'),_0xe5f9e5[_0xa7e8('0xc')](function(_0x453bad){return{'id':_0x453bad['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3e8150['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa7e8('0x9')](function(_0x22ba2f){_0x3e8150[_0xa7e8('0xa')](_0xa7e8('0xd'),_0x22ba2f[_0xa7e8('0xe')]);ChatInteractionEvents[_0xa7e8('0xf')](_0x5cfb20+':'+_0x3e8150['id'],_0x3e8150);ChatInteractionEvents[_0xa7e8('0xf')](_0x5cfb20,_0x3e8150);_0x536a2a(null);})['catch'](_0x536a2a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xa7e8('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x29bc=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x467667,_0x1da834){var _0x22d832=function(_0x3e55a8){while(--_0x3e55a8){_0x467667['push'](_0x467667['shift']());}};_0x22d832(++_0x1da834);}(_0x29bc,0x1cd));var _0xc29b=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x29bc[_0xaa0309];return _0x5de7ce;};'use strict';var EventEmitter=require(_0xc29b('0x0'));var ChatInteraction=require(_0xc29b('0x1'))['db'][_0xc29b('0x2')];var ChatMessage=require(_0xc29b('0x1'))['db'][_0xc29b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc29b('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc29b('0x5')};function emitEvent(_0x41b61d){return function(_0x239960,_0x12ea7a,_0x391e18){_0x239960[_0xc29b('0x6')]({'attributes':['id'],'raw':!![]})[_0xc29b('0x7')](function(_0x3985b1){_0x239960[_0xc29b('0x8')](_0xc29b('0x9'),_0x3985b1[_0xc29b('0xa')](function(_0x559639){return{'id':_0x559639['id']};}));return ChatMessage[_0xc29b('0xb')]({'where':{'ChatInteractionId':_0x239960['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc29b('0x7')](function(_0xe1ba4e){_0x239960[_0xc29b('0x8')](_0xc29b('0xc'),_0xe1ba4e[_0xc29b('0xd')]);ChatInteractionEvents[_0xc29b('0xe')](_0x41b61d+':'+_0x239960['id'],_0x239960);ChatInteractionEvents['emit'](_0x41b61d,_0x239960);_0x391e18(null);})[_0xc29b('0xf')](_0x391e18(null));};}for(var e in events){if(events[_0xc29b('0x10')](e)){var event=events[e];ChatInteraction[_0xc29b('0x11')](e,emitEvent(event));}}module[_0xc29b('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b45baaf..6ca95b7 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 _0xbd5b=['bluebird','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x2f1172,_0x5f5b26){var _0x58e374=function(_0x1a61fa){while(--_0x1a61fa){_0x2f1172['push'](_0x2f1172['shift']());}};_0x58e374(++_0x5f5b26);}(_0xbd5b,0x164));var _0xbbd5=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0xbd5b[_0x225f50];return _0x19d003;};'use strict';var _=require('lodash');var util=require(_0xbbd5('0x0'));var logger=require(_0xbbd5('0x1'))(_0xbbd5('0x2'));var moment=require(_0xbbd5('0x3'));var BPromise=require(_0xbbd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbbd5('0x5'));var attributes=require(_0xbbd5('0x6'));module[_0xbbd5('0x7')]=function(_0x315dea,_0x3fcf3c){return _0x315dea[_0xbbd5('0x8')](_0xbbd5('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d1329,_0x25f6e7,_0x427abd){if(_0x3d1329[_0xbbd5('0xa')]('closed')){_0x3d1329[_0xbbd5('0xb')]=moment()[_0xbbd5('0xc')](_0xbbd5('0xd'));}_0x427abd(null,_0x3d1329);}},'charset':'utf8mb4','collate':_0xbbd5('0xe')});}; \ No newline at end of file +var _0x1fb8=['request-promise','path','../../config/environment','define','chat_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x283a2b,_0x384d7c){var _0x64f752=function(_0x3b5f58){while(--_0x3b5f58){_0x283a2b['push'](_0x283a2b['shift']());}};_0x64f752(++_0x384d7c);}(_0x1fb8,0xb1));var _0x81fb=function(_0x32be7d,_0x1e1fd6){_0x32be7d=_0x32be7d-0x0;var _0x3ddf=_0x1fb8[_0x32be7d];return _0x3ddf;};'use strict';var _=require(_0x81fb('0x0'));var util=require(_0x81fb('0x1'));var logger=require('../../config/logger')(_0x81fb('0x2'));var moment=require(_0x81fb('0x3'));var BPromise=require(_0x81fb('0x4'));var rp=require(_0x81fb('0x5'));var fs=require('fs');var path=require(_0x81fb('0x6'));var rimraf=require('rimraf');var config=require(_0x81fb('0x7'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x1c5528,_0x5aafff){return _0x1c5528[_0x81fb('0x8')]('ChatInteraction',attributes,{'tableName':_0x81fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52907d,_0x1dc3ce,_0x53207a){if(_0x52907d[_0x81fb('0xa')]('closed')){_0x52907d['closedAt']=moment()['format'](_0x81fb('0xb'));}_0x53207a(null,_0x52907d);}},'charset':'utf8mb4','collate':_0x81fb('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index cfd472c..0862f7a 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 _0x70cf=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','catch','AddTagsToChatInteraction','addTags','ids','AddTags','lodash','util'];(function(_0x962edb,_0x5dd356){var _0x359dcf=function(_0x978f40){while(--_0x978f40){_0x962edb['push'](_0x962edb['shift']());}};_0x359dcf(++_0x5dd356);}(_0x70cf,0x10f));var _0xf70c=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x70cf[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0xf70c('0x0'));var util=require(_0xf70c('0x1'));var moment=require('moment');var BPromise=require(_0xf70c('0x2'));var rs=require(_0xf70c('0x3'));var fs=require('fs');var Redis=require(_0xf70c('0x4'));var db=require(_0xf70c('0x5'))['db'];var utils=require(_0xf70c('0x6'));var logger=require('../../config/logger')(_0xf70c('0x7'));var config=require(_0xf70c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf70c('0x9')]['http']({'port':0x232a});config[_0xf70c('0xa')]=_[_0xf70c('0xb')](config[_0xf70c('0xa')],{'host':_0xf70c('0xc'),'port':0x18eb});var socket=require(_0xf70c('0xd'))(new Redis(config['redis']));require(_0xf70c('0xe'))['register'](socket);function respondWithRpcPromise(_0x20112c,_0x3312eb,_0x34a6e5){return new BPromise(function(_0x3702e2,_0x36ba97){return client[_0xf70c('0xf')](_0x20112c,_0x34a6e5)[_0xf70c('0x10')](function(_0x2ec9fc){logger[_0xf70c('0x11')](_0xf70c('0x12'),_0x3312eb,_0xf70c('0x13'));logger[_0xf70c('0x14')](_0xf70c('0x15'),_0x3312eb,'request\x20sent',JSON[_0xf70c('0x16')](_0x2ec9fc));if(_0x2ec9fc[_0xf70c('0x17')]){if(_0x2ec9fc[_0xf70c('0x17')][_0xf70c('0x18')]===0x1f4){logger[_0xf70c('0x17')](_0xf70c('0x12'),_0x3312eb,_0x2ec9fc[_0xf70c('0x17')]['message']);return _0x36ba97(_0x2ec9fc[_0xf70c('0x17')][_0xf70c('0x19')]);}logger[_0xf70c('0x17')](_0xf70c('0x12'),_0x3312eb,_0x2ec9fc[_0xf70c('0x17')]['message']);return _0x3702e2(_0x2ec9fc['error'][_0xf70c('0x19')]);}else{logger[_0xf70c('0x11')](_0xf70c('0x12'),_0x3312eb,_0xf70c('0x13'));_0x3702e2(_0x2ec9fc[_0xf70c('0x1a')][_0xf70c('0x19')]);}})['catch'](function(_0xbc8a27){logger[_0xf70c('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x3312eb,_0xbc8a27);_0x36ba97(_0xbc8a27);});});}exports[_0xf70c('0x1b')]=function(_0x2334e1){var _0x227b67=this;return new Promise(function(_0x1e2178,_0x45f5f9){return db[_0xf70c('0x1c')][_0xf70c('0x1d')](_0x2334e1[_0xf70c('0x1e')],{'raw':_0x2334e1['options']?_0x2334e1[_0xf70c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2334e1['options']?_0x2334e1['options'][_0xf70c('0x20')]||null:null,'attributes':_0x2334e1['options']?_0x2334e1['options'][_0xf70c('0x21')]||null:null,'limit':_0x2334e1[_0xf70c('0x1f')]?_0x2334e1[_0xf70c('0x1f')]['limit']||null:null})[_0xf70c('0x10')](function(_0x34212d){logger['info']('UpdateChatInteraction',_0x2334e1);logger[_0xf70c('0x14')](_0xf70c('0x1b'),_0x2334e1,JSON[_0xf70c('0x16')](_0x34212d));_0x1e2178(_0x34212d);})[_0xf70c('0x22')](function(_0xad21c){logger[_0xf70c('0x17')]('UpdateChatInteraction',_0xad21c['message'],_0x2334e1);_0x45f5f9(_0x227b67[_0xf70c('0x17')](0x1f4,_0xad21c[_0xf70c('0x19')]));});});};exports[_0xf70c('0x23')]=function(_0x55cd7f){return new Promise(function(_0x497a80,_0x2c3e67){return db['ChatInteraction']['find']({'where':_0x55cd7f[_0xf70c('0x1f')]?_0x55cd7f[_0xf70c('0x1f')][_0xf70c('0x20')]||null:null})[_0xf70c('0x10')](function(_0x3e5a8b){if(_0x3e5a8b){return _0x3e5a8b[_0xf70c('0x24')](_0x55cd7f[_0xf70c('0x1e')][_0xf70c('0x25')],_['omit'](_0x55cd7f[_0xf70c('0x1e')],[_0xf70c('0x25'),'id'])||{});}})['spread'](function(_0x4f007b){logger[_0xf70c('0x11')](_0xf70c('0x26'),_0x55cd7f);logger[_0xf70c('0x14')](_0xf70c('0x26'),_0x55cd7f,JSON[_0xf70c('0x16')](_0x4f007b));_0x497a80(_0x4f007b);})[_0xf70c('0x22')](function(_0x17d25a){logger[_0xf70c('0x17')](_0xf70c('0x26'),_0x17d25a[_0xf70c('0x19')],_0x55cd7f);_0x2c3e67(_this[_0xf70c('0x17')](0x1f4,_0x17d25a[_0xf70c('0x19')]));});});}; \ No newline at end of file +var _0xd358=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','addTags','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0xd358,0x1e4));var _0x8d35=function(_0x5f063e,_0x36171a){_0x5f063e=_0x5f063e-0x0;var _0x1c8396=_0xd358[_0x5f063e];return _0x1c8396;};'use strict';var _=require('lodash');var util=require(_0x8d35('0x0'));var moment=require(_0x8d35('0x1'));var BPromise=require(_0x8d35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d35('0x3'));var db=require(_0x8d35('0x4'))['db'];var utils=require(_0x8d35('0x5'));var logger=require(_0x8d35('0x6'))(_0x8d35('0x7'));var config=require(_0x8d35('0x8'));var jayson=require(_0x8d35('0x9'));var client=jayson[_0x8d35('0xa')][_0x8d35('0xb')]({'port':0x232a});config[_0x8d35('0xc')]=_['defaults'](config[_0x8d35('0xc')],{'host':_0x8d35('0xd'),'port':0x18eb});var socket=require(_0x8d35('0xe'))(new Redis(config[_0x8d35('0xc')]));require(_0x8d35('0xf'))[_0x8d35('0x10')](socket);function respondWithRpcPromise(_0x55c56b,_0x24a6f1,_0x44fb1a){return new BPromise(function(_0x1be5a2,_0x792b3c){return client['request'](_0x55c56b,_0x44fb1a)[_0x8d35('0x11')](function(_0x573f1f){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x24a6f1,_0x8d35('0x12'));logger[_0x8d35('0x13')](_0x8d35('0x14'),_0x24a6f1,'request\x20sent',JSON[_0x8d35('0x15')](_0x573f1f));if(_0x573f1f[_0x8d35('0x16')]){if(_0x573f1f[_0x8d35('0x16')][_0x8d35('0x17')]===0x1f4){logger[_0x8d35('0x16')](_0x8d35('0x18'),_0x24a6f1,_0x573f1f[_0x8d35('0x16')][_0x8d35('0x19')]);return _0x792b3c(_0x573f1f['error']['message']);}logger['error'](_0x8d35('0x18'),_0x24a6f1,_0x573f1f[_0x8d35('0x16')][_0x8d35('0x19')]);return _0x1be5a2(_0x573f1f['error'][_0x8d35('0x19')]);}else{logger[_0x8d35('0x1a')](_0x8d35('0x18'),_0x24a6f1,_0x8d35('0x12'));_0x1be5a2(_0x573f1f['result'][_0x8d35('0x19')]);}})[_0x8d35('0x1b')](function(_0x4e4e66){logger['error'](_0x8d35('0x18'),_0x24a6f1,_0x4e4e66);_0x792b3c(_0x4e4e66);});});}exports[_0x8d35('0x1c')]=function(_0x4ae9b6){var _0x1d773f=this;return new Promise(function(_0x2f51ce,_0x1e8380){return db[_0x8d35('0x1d')][_0x8d35('0x1e')](_0x4ae9b6[_0x8d35('0x1f')],{'raw':_0x4ae9b6['options']?_0x4ae9b6[_0x8d35('0x20')][_0x8d35('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ae9b6[_0x8d35('0x20')]?_0x4ae9b6['options'][_0x8d35('0x22')]||null:null,'attributes':_0x4ae9b6[_0x8d35('0x20')]?_0x4ae9b6['options'][_0x8d35('0x23')]||null:null,'limit':_0x4ae9b6['options']?_0x4ae9b6[_0x8d35('0x20')][_0x8d35('0x24')]||null:null})['then'](function(_0x372037){logger['info'](_0x8d35('0x1c'),_0x4ae9b6);logger['debug'](_0x8d35('0x1c'),_0x4ae9b6,JSON['stringify'](_0x372037));_0x2f51ce(_0x372037);})[_0x8d35('0x1b')](function(_0x5cbe95){logger[_0x8d35('0x16')]('UpdateChatInteraction',_0x5cbe95[_0x8d35('0x19')],_0x4ae9b6);_0x1e8380(_0x1d773f[_0x8d35('0x16')](0x1f4,_0x5cbe95[_0x8d35('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x420bd0){return new Promise(function(_0x1cd4b8,_0x153e97){return db[_0x8d35('0x1d')]['find']({'where':_0x420bd0['options']?_0x420bd0[_0x8d35('0x20')]['where']||null:null})[_0x8d35('0x11')](function(_0x31fa34){if(_0x31fa34){return _0x31fa34[_0x8d35('0x25')](_0x420bd0[_0x8d35('0x1f')]['ids'],_['omit'](_0x420bd0[_0x8d35('0x1f')],[_0x8d35('0x26'),'id'])||{});}})[_0x8d35('0x27')](function(_0x5a940c){logger['info'](_0x8d35('0x28'),_0x420bd0);logger[_0x8d35('0x13')](_0x8d35('0x28'),_0x420bd0,JSON[_0x8d35('0x15')](_0x5a940c));_0x1cd4b8(_0x5a940c);})['catch'](function(_0x5b87d6){logger[_0x8d35('0x16')](_0x8d35('0x28'),_0x5b87d6[_0x8d35('0x19')],_0x420bd0);_0x153e97(_this['error'](0x1f4,_0x5b87d6['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 14c07e5..3f0a067 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 _0xf150=['remove','update','emit','removeListener','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf150,0x196));var _0x0f15=function(_0x10b351,_0x80ac56){_0x10b351=_0x10b351-0x0;var _0xd5d408=_0xf150[_0x10b351];return _0xd5d408;};'use strict';var ChatInteractionEvents=require(_0x0f15('0x0'));var events=[_0x0f15('0x1'),_0x0f15('0x2'),_0x0f15('0x3')];function createListener(_0xfeab7,_0x4f4753){return function(_0x4a7f60){_0x4f4753[_0x0f15('0x4')](_0xfeab7,_0x4a7f60);};}function removeListener(_0x1ae882,_0x1f1d52){return function(){ChatInteractionEvents[_0x0f15('0x5')](_0x1ae882,_0x1f1d52);};}exports['register']=function(_0xd88f20){for(var _0x437b6f=0x0,_0x4ccc45=events[_0x0f15('0x6')];_0x437b6f<_0x4ccc45;_0x437b6f++){var _0x5e8dd9=events[_0x437b6f];var _0x3ab492=createListener(_0x0f15('0x7')+_0x5e8dd9,_0xd88f20);ChatInteractionEvents['on'](_0x5e8dd9,_0x3ab492);}}; \ No newline at end of file +var _0x1a1c=['removeListener','length','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x2646db,_0xb55473){var _0x3336f9=function(_0x372784){while(--_0x372784){_0x2646db['push'](_0x2646db['shift']());}};_0x3336f9(++_0xb55473);}(_0x1a1c,0x1bc));var _0xc1a1=function(_0x4b6295,_0x456ed9){_0x4b6295=_0x4b6295-0x0;var _0x5b4941=_0x1a1c[_0x4b6295];return _0x5b4941;};'use strict';var ChatInteractionEvents=require(_0xc1a1('0x0'));var events=['save',_0xc1a1('0x1'),_0xc1a1('0x2')];function createListener(_0x3dc7de,_0x32d6c5){return function(_0x53adc7){_0x32d6c5[_0xc1a1('0x3')](_0x3dc7de,_0x53adc7);};}function removeListener(_0x44b278,_0x499eb2){return function(){ChatInteractionEvents[_0xc1a1('0x4')](_0x44b278,_0x499eb2);};}exports['register']=function(_0x35284f){for(var _0x17e8a0=0x0,_0x2dafbd=events[_0xc1a1('0x5')];_0x17e8a0<_0x2dafbd;_0x17e8a0++){var _0x11a953=events[_0x17e8a0];var _0x5af133=createListener(_0xc1a1('0x6')+_0x11a953,_0x35284f);ChatInteractionEvents['on'](_0x11a953,_0x5af133);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b546a2d..1fd6e96 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 _0xfc59=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','get','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','/:id/attachment_upload','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','put','/:id/abandon','abandon','/:id/close','close','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xfc59,0xbe));var _0x9fc5=function(_0x3c11f4,_0x2d2bcb){_0x3c11f4=_0x3c11f4-0x0;var _0x432957=_0xfc59[_0x3c11f4];return _0x432957;};'use strict';var multer=require(_0x9fc5('0x0'));var util=require(_0x9fc5('0x1'));var path=require(_0x9fc5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9fc5('0x3')]();var fs_extra=require(_0x9fc5('0x4'));var auth=require(_0x9fc5('0x5'));var interaction=require(_0x9fc5('0x6'));var config=require(_0x9fc5('0x7'));var controller=require(_0x9fc5('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9fc5('0x9')]);router['get'](_0x9fc5('0xa'),auth[_0x9fc5('0xb')](),controller[_0x9fc5('0xc')]);router['get'](_0x9fc5('0xd'),auth[_0x9fc5('0xe')](),controller[_0x9fc5('0xf')]);router[_0x9fc5('0x10')](_0x9fc5('0x11'),auth[_0x9fc5('0xe')](),controller[_0x9fc5('0x12')]);router['get'](_0x9fc5('0x13'),auth['isAuthenticated'](),controller[_0x9fc5('0x14')]);router[_0x9fc5('0x10')](_0x9fc5('0x15'),auth['isChatInteractionAuthorized'](),controller[_0x9fc5('0x16')]);router[_0x9fc5('0x10')](_0x9fc5('0x17'),auth[_0x9fc5('0xb')](),controller['download']);router[_0x9fc5('0x18')]('/',auth[_0x9fc5('0xb')](),controller[_0x9fc5('0x19')]);router['post'](_0x9fc5('0x1a'),auth['isAuthenticated'](),controller[_0x9fc5('0x1b')]);var upload=multer({'storage':multer[_0x9fc5('0x1c')]({'destination':function(_0x4395f8,_0x26fa92,_0x534074){_0x534074(null,path[_0x9fc5('0x1d')](config[_0x9fc5('0x1e')],_0x9fc5('0x1f')));},'filename':function(_0x4b72bd,_0x130cec,_0xcfb089){_0xcfb089(null,util[_0x9fc5('0x20')](_0x9fc5('0x21'),Date['now'](),_0x130cec['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x9fc5('0x22'),upload['single']('file'),controller['attachmentUpload']);router[_0x9fc5('0x18')](_0x9fc5('0x13'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x9fc5('0x18')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x9fc5('0x23')](_0x9fc5('0x24'),_0x9fc5('0x25')),controller[_0x9fc5('0x26')]);router['put'](_0x9fc5('0xd'),auth['isAuthenticated'](),interaction[_0x9fc5('0x23')](_0x9fc5('0x24'),_0x9fc5('0x27')),controller[_0x9fc5('0x28')]);router['put'](_0x9fc5('0x29'),controller['customUpdate']);router[_0x9fc5('0x2a')](_0x9fc5('0x2b'),auth[_0x9fc5('0xe')](),controller[_0x9fc5('0x2c')]);router[_0x9fc5('0x2a')](_0x9fc5('0x2d'),controller[_0x9fc5('0x2e')]);router[_0x9fc5('0x2f')]('/:id',auth['isAuthenticated'](),interaction[_0x9fc5('0x23')](_0x9fc5('0x24'),'chatinteraction:destroy'),controller['destroy']);router['delete']('/:id/tags',auth[_0x9fc5('0xb')](),controller['removeTags']);module[_0x9fc5('0x30')]=router; \ No newline at end of file +var _0x970a=['isChatInteractionAuthorized','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','chatinteraction:addtags','addTags','put','tracked','chat','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/attachment_download'];(function(_0x2100a9,_0x7c25cf){var _0x44f037=function(_0x46bbf8){while(--_0x46bbf8){_0x2100a9['push'](_0x2100a9['shift']());}};_0x44f037(++_0x7c25cf);}(_0x970a,0x19a));var _0xa970=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x970a[_0x484c03];return _0x294127;};'use strict';var multer=require(_0xa970('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa970('0x1'));var router=express[_0xa970('0x2')]();var fs_extra=require(_0xa970('0x3'));var auth=require(_0xa970('0x4'));var interaction=require(_0xa970('0x5'));var config=require('../../config/environment');var controller=require(_0xa970('0x6'));router[_0xa970('0x7')]('/',auth[_0xa970('0x8')](),controller['index']);router[_0xa970('0x7')](_0xa970('0x9'),auth[_0xa970('0x8')](),controller[_0xa970('0xa')]);router[_0xa970('0x7')](_0xa970('0xb'),auth['isChatInteractionAuthorized'](),controller[_0xa970('0xc')]);router[_0xa970('0x7')](_0xa970('0xd'),auth[_0xa970('0xe')](),controller['attachmentDownload']);router[_0xa970('0x7')](_0xa970('0xf'),auth[_0xa970('0x8')](),controller['getMessages']);router['get'](_0xa970('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xa970('0x11')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xa970('0x12')]);router[_0xa970('0x13')]('/',auth[_0xa970('0x8')](),controller[_0xa970('0x14')]);router[_0xa970('0x13')](_0xa970('0x15'),auth[_0xa970('0x8')](),controller[_0xa970('0x16')]);var upload=multer({'storage':multer[_0xa970('0x17')]({'destination':function(_0x469be5,_0x47749f,_0x1ca57b){_0x1ca57b(null,path[_0xa970('0x18')](config[_0xa970('0x19')],_0xa970('0x1a')));},'filename':function(_0x22945e,_0x844cd3,_0x430bec){_0x430bec(null,util[_0xa970('0x1b')]('%s-%s',Date[_0xa970('0x1c')](),_0x844cd3[_0xa970('0x1d')][_0xa970('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa970('0x1f'),upload['single'](_0xa970('0x20')),controller[_0xa970('0x21')]);router[_0xa970('0x13')](_0xa970('0xf'),auth[_0xa970('0xe')](),controller[_0xa970('0x22')]);router[_0xa970('0x13')]('/:id/tags',auth[_0xa970('0x8')](),interaction['tracked']('chat',_0xa970('0x23')),controller[_0xa970('0x24')]);router[_0xa970('0x25')](_0xa970('0xb'),auth[_0xa970('0x8')](),interaction[_0xa970('0x26')](_0xa970('0x27'),_0xa970('0x28')),controller['update']);router[_0xa970('0x25')](_0xa970('0x29'),controller[_0xa970('0x2a')]);router['put'](_0xa970('0x2b'),auth[_0xa970('0xe')](),controller[_0xa970('0x2c')]);router[_0xa970('0x25')](_0xa970('0x2d'),controller[_0xa970('0x2e')]);router[_0xa970('0x2f')](_0xa970('0xb'),auth[_0xa970('0x8')](),interaction[_0xa970('0x26')](_0xa970('0x27'),_0xa970('0x30')),controller[_0xa970('0x31')]);router[_0xa970('0x2f')](_0xa970('0x32'),auth[_0xa970('0x8')](),controller[_0xa970('0x33')]);module[_0xa970('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f391b02..fd4333e 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 _0x60af=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x43acd6,_0x2bcc7b){var _0x3da9e5=function(_0x28170c){while(--_0x28170c){_0x43acd6['push'](_0x43acd6['shift']());}};_0x3da9e5(++_0x2bcc7b);}(_0x60af,0x64));var _0xf60a=function(_0x32eb8b,_0x5ac0b5){_0x32eb8b=_0x32eb8b-0x0;var _0x5bc68b=_0x60af[_0x32eb8b];return _0x5bc68b;};'use strict';var Sequelize=require('sequelize');module[_0xf60a('0x0')]={'body':{'type':Sequelize[_0xf60a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf60a('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf60a('0x3')]}}; \ No newline at end of file +var _0x7832=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x28656b,_0x4f773a){var _0x287965=function(_0x6be24){while(--_0x6be24){_0x28656b['push'](_0x28656b['shift']());}};_0x287965(++_0x4f773a);}(_0x7832,0x110));var _0x2783=function(_0x1b18ce,_0x4b4869){_0x1b18ce=_0x1b18ce-0x0;var _0x18c92c=_0x7832[_0x1b18ce];return _0x18c92c;};'use strict';var Sequelize=require(_0x2783('0x0'));module[_0x2783('0x1')]={'body':{'type':Sequelize[_0x2783('0x2')](_0x2783('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2783('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9fc3231..47a3e2d 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 _0x284a=['isEmpty','agent','resourceId','push','messages','ToId','-createdAt','all','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','findAll'];(function(_0x440a75,_0x1768a0){var _0x5e386d=function(_0x427fa7){while(--_0x427fa7){_0x440a75['push'](_0x440a75['shift']());}};_0x5e386d(++_0x1768a0);}(_0x284a,0x146));var _0xa284=function(_0x564434,_0x102c3f){_0x564434=_0x564434-0x0;var _0x224ccc=_0x284a[_0x564434];return _0x224ccc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa284('0x0'));var zipdir=require(_0xa284('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa284('0x2'));var moment=require(_0xa284('0x3'));var BPromise=require(_0xa284('0x4'));var Mustache=require('mustache');var util=require(_0xa284('0x5'));var path=require('path');var sox=require(_0xa284('0x6'));var csv=require(_0xa284('0x7'));var ejs=require(_0xa284('0x8'));var fs=require('fs');var fs_extra=require(_0xa284('0x9'));var _=require(_0xa284('0xa'));var squel=require(_0xa284('0xb'));var crypto=require(_0xa284('0xc'));var jsforce=require(_0xa284('0xd'));var deskjs=require(_0xa284('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa284('0xf'));var Papa=require(_0xa284('0x10'));var Redis=require(_0xa284('0x11'));var authService=require(_0xa284('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa284('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa284('0x14'));var licenseUtil=require(_0xa284('0x15'));var db=require(_0xa284('0x16'))['db'];config[_0xa284('0x17')]=_[_0xa284('0x18')](config[_0xa284('0x17')],{'host':_0xa284('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa284('0x17')]));require('./chatInternalMessage.socket')[_0xa284('0x1a')](socket);function respondWithStatusCode(_0x4191a4,_0x19de40){_0x19de40=_0x19de40||0xcc;return function(_0x5e6385){if(_0x5e6385){return _0x4191a4[_0xa284('0x1b')](_0x19de40);}return _0x4191a4[_0xa284('0x1c')](_0x19de40)['end']();};}function respondWithResult(_0x1718a2,_0x100793){_0x100793=_0x100793||0xc8;return function(_0x105c53){if(_0x105c53){return _0x1718a2[_0xa284('0x1c')](_0x100793)[_0xa284('0x1d')](_0x105c53);}};}function respondWithFilteredResult(_0x1abd1d,_0x2e1b67){return function(_0xf4962a){if(_0xf4962a){var _0x126258=typeof _0x2e1b67[_0xa284('0x1e')]===_0xa284('0x1f')&&typeof _0x2e1b67[_0xa284('0x20')]===_0xa284('0x1f');var _0x268a70=_0xf4962a[_0xa284('0x21')];var _0x57f138=_0x126258?0x0:_0x2e1b67[_0xa284('0x1e')];var _0x2d3157=_0x126258?_0xf4962a[_0xa284('0x21')]:_0x2e1b67['offset']+_0x2e1b67[_0xa284('0x20')];var _0x1c8bdd;if(_0x2d3157>=_0x268a70){_0x2d3157=_0x268a70;_0x1c8bdd=0xc8;}else{_0x1c8bdd=0xce;}_0x1abd1d[_0xa284('0x1c')](_0x1c8bdd);return _0x1abd1d[_0xa284('0x22')]('Content-Range',_0x57f138+'-'+_0x2d3157+'/'+_0x268a70)[_0xa284('0x1d')](_0xf4962a);}return null;};}function patchUpdates(_0x652119){return function(_0x2e1695){try{jsonpatch['apply'](_0x2e1695,_0x652119,!![]);}catch(_0x326cbb){return BPromise[_0xa284('0x23')](_0x326cbb);}return _0x2e1695[_0xa284('0x24')]();};}function saveUpdates(_0x3670d2,_0x2aadbe){return function(_0xcdd2c4){if(_0xcdd2c4){return _0xcdd2c4[_0xa284('0x25')](_0x3670d2)[_0xa284('0x26')](function(_0x4cabac){return _0x4cabac;});}return null;};}function removeEntity(_0x9d2928,_0x243be2){return function(_0x2f2297){if(_0x2f2297){return _0x2f2297[_0xa284('0x27')]()[_0xa284('0x26')](function(){_0x9d2928[_0xa284('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e772f,_0x1e7e5f){return function(_0xbcb394){if(!_0xbcb394){_0x5e772f['sendStatus'](0x194);}return _0xbcb394;};}function handleError(_0x11566e,_0x2d7cd9){_0x2d7cd9=_0x2d7cd9||0x1f4;return function(_0x5bd22d){logger['error'](_0x5bd22d[_0xa284('0x28')]);if(_0x5bd22d[_0xa284('0x29')]){delete _0x5bd22d['name'];}_0x11566e['status'](_0x2d7cd9)[_0xa284('0x2a')](_0x5bd22d);};}exports[_0xa284('0x2b')]=function(_0x55a44c,_0x15d282){var _0x432d80={},_0x6d4fe0={},_0x9c2ca0={'count':0x0,'rows':[]};var _0x2a6273=_[_0xa284('0x2c')](db[_0xa284('0x2d')][_0xa284('0x2e')],function(_0x25860b){return{'name':_0x25860b[_0xa284('0x2f')],'type':_0x25860b[_0xa284('0x30')][_0xa284('0x31')]};});_0x6d4fe0['model']=_[_0xa284('0x2c')](_0x2a6273,_0xa284('0x29'));_0x6d4fe0['query']=_[_0xa284('0x32')](_0x55a44c['query']);_0x6d4fe0['filters']=_[_0xa284('0x33')](_0x6d4fe0[_0xa284('0x34')],_0x6d4fe0[_0xa284('0x35')]);_0x432d80[_0xa284('0x36')]=_['intersection'](_0x6d4fe0[_0xa284('0x34')],qs[_0xa284('0x37')](_0x55a44c['query']['fields']));_0x432d80[_0xa284('0x36')]=_0x432d80[_0xa284('0x36')][_0xa284('0x38')]?_0x432d80[_0xa284('0x36')]:_0x6d4fe0[_0xa284('0x34')];if(!_0x55a44c[_0xa284('0x35')][_0xa284('0x39')](_0xa284('0x3a'))){_0x432d80[_0xa284('0x20')]=qs[_0xa284('0x20')](_0x55a44c[_0xa284('0x35')]['limit']);_0x432d80[_0xa284('0x1e')]=qs[_0xa284('0x1e')](_0x55a44c[_0xa284('0x35')]['offset']);}_0x432d80[_0xa284('0x3b')]=qs[_0xa284('0x3c')](_0x55a44c[_0xa284('0x35')][_0xa284('0x3c')]);_0x432d80['where']=qs[_0xa284('0x3d')](_['pick'](_0x55a44c[_0xa284('0x35')],_0x6d4fe0[_0xa284('0x3d')]),_0x2a6273);if(_0x55a44c['query'][_0xa284('0x3e')]){_0x432d80[_0xa284('0x3f')]=_[_0xa284('0x40')](_0x432d80[_0xa284('0x3f')],{'$or':_[_0xa284('0x2c')](_0x2a6273,function(_0x1c4eda){if(_0x1c4eda[_0xa284('0x30')]!==_0xa284('0x41')){var _0x3e8222={};_0x3e8222[_0x1c4eda[_0xa284('0x29')]]={'$like':'%'+_0x55a44c['query'][_0xa284('0x3e')]+'%'};return _0x3e8222;}})});}_0x432d80=_[_0xa284('0x40')]({},_0x432d80,_0x55a44c['options']);var _0x4e744a={'where':_0x432d80[_0xa284('0x3f')]};return db['ChatInternalMessage'][_0xa284('0x21')](_0x4e744a)[_0xa284('0x26')](function(_0x350cc4){_0x9c2ca0[_0xa284('0x21')]=_0x350cc4;if(_0x55a44c['query'][_0xa284('0x42')]){_0x432d80[_0xa284('0x43')]=[{'all':!![]}];}return db[_0xa284('0x2d')]['findAll'](_0x432d80);})[_0xa284('0x26')](function(_0x5c4d66){_0x9c2ca0[_0xa284('0x44')]=_0x5c4d66;return _0x9c2ca0;})['then'](respondWithFilteredResult(_0x15d282,_0x432d80))[_0xa284('0x45')](handleError(_0x15d282,null));};exports['show']=function(_0x3cda0c,_0xb48610){var _0xf12953={'raw':!![],'where':{'id':_0x3cda0c[_0xa284('0x46')]['id']}},_0x35050c={};_0x35050c['model']=_[_0xa284('0x32')](db[_0xa284('0x2d')][_0xa284('0x2e')]);_0x35050c['query']=_['keys'](_0x3cda0c[_0xa284('0x35')]);_0x35050c[_0xa284('0x3d')]=_[_0xa284('0x33')](_0x35050c[_0xa284('0x34')],_0x35050c[_0xa284('0x35')]);_0xf12953[_0xa284('0x36')]=_[_0xa284('0x33')](_0x35050c[_0xa284('0x34')],qs[_0xa284('0x37')](_0x3cda0c[_0xa284('0x35')][_0xa284('0x37')]));_0xf12953['attributes']=_0xf12953[_0xa284('0x36')]['length']?_0xf12953[_0xa284('0x36')]:_0x35050c[_0xa284('0x34')];if(_0x3cda0c[_0xa284('0x35')][_0xa284('0x42')]){_0xf12953[_0xa284('0x43')]=[{'all':!![]}];}_0xf12953=_['merge']({},_0xf12953,_0x3cda0c[_0xa284('0x47')]);return db['ChatInternalMessage'][_0xa284('0x48')](_0xf12953)['then'](handleEntityNotFound(_0xb48610,null))[_0xa284('0x26')](respondWithResult(_0xb48610,null))[_0xa284('0x45')](handleError(_0xb48610,null));};exports[_0xa284('0x49')]=function(_0x388c9d,_0x208286){return db['ChatInternalMessage'][_0xa284('0x49')](_0x388c9d[_0xa284('0x4a')],{})['then'](respondWithResult(_0x208286,0xc9))[_0xa284('0x45')](handleError(_0x208286,null));};exports['update']=function(_0x1bd2a8,_0x8cc69c){if(_0x1bd2a8[_0xa284('0x4a')]['id']){delete _0x1bd2a8[_0xa284('0x4a')]['id'];}return db[_0xa284('0x2d')]['find']({'where':{'id':_0x1bd2a8[_0xa284('0x46')]['id']}})[_0xa284('0x26')](handleEntityNotFound(_0x8cc69c,null))[_0xa284('0x26')](saveUpdates(_0x1bd2a8[_0xa284('0x4a')],null))[_0xa284('0x26')](respondWithResult(_0x8cc69c,null))[_0xa284('0x45')](handleError(_0x8cc69c,null));};exports[_0xa284('0x27')]=function(_0x459e6a,_0x5a23c3){return db[_0xa284('0x2d')][_0xa284('0x48')]({'where':{'id':_0x459e6a[_0xa284('0x46')]['id']}})[_0xa284('0x26')](handleEntityNotFound(_0x5a23c3,null))[_0xa284('0x26')](removeEntity(_0x5a23c3,null))['catch'](handleError(_0x5a23c3,null));};exports['describe']=function(_0x5041f3,_0x2dad11){return db['ChatInternalMessage'][_0xa284('0x4b')]()['then'](respondWithResult(_0x2dad11,null))[_0xa284('0x45')](handleError(_0x2dad11,null));};function wrapUser(_0xe9b0fb){return function(_0x40809f){var _0x5f25b1=_0xe9b0fb[_0xa284('0x4c')]({'plain':!![]});_0x5f25b1['messages']=[];if(_0x40809f){_0x5f25b1[_0xa284('0x4d')]=_0x40809f[_0xa284('0x4e')];_0x5f25b1[_0xa284('0x4f')]=_0x40809f;}else{_0x5f25b1[_0xa284('0x4d')]=moment(0x0)[_0xa284('0x50')](_0xa284('0x51'));_0x5f25b1[_0xa284('0x4f')]={};}return _0x5f25b1;};}exports[_0xa284('0x52')]=function(_0x3564ce,_0x3305c7,_0x292b22){var _0x1f91df=[];return db[_0xa284('0x53')]['findAll']({'where':{'role':['agent',_0xa284('0x54'),'user']},'attributes':['id',_0xa284('0x55'),'name',_0xa284('0x56'),'userpic',_0xa284('0x57'),'online',_0xa284('0x58'),_0xa284('0x59'),_0xa284('0x5a')],'order':qs[_0xa284('0x3c')]('-online'),'include':[{'model':db[_0xa284('0x5b')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0xa284('0x26')](function(_0x24abf3){if(_0x24abf3){var _0x3c906f=_0x3564ce[_0xa284('0x5c')][_0xa284('0x4c')]({'plain':!![]});if(!_0x3c906f)throw new Error(_0xa284('0x5d'));if(_0x3c906f[_0xa284('0x56')]===_0xa284('0x5c')){return db[_0xa284('0x5e')][_0xa284('0x48')]({'where':{'name':_0xa284('0x5f'),'userProfileId':_0x3c906f['userProfileId']},'raw':!![]})['then'](function(_0x3fc1c0){if(_0x3fc1c0){if(_0x3fc1c0[_0xa284('0x60')]===0x0){return db['UserProfileResource'][_0xa284('0x61')]({'where':{'sectionId':_0x3fc1c0['id']},'raw':!![]})[_0xa284('0x26')](function(_0x429ae8){var _0x999d61=[];if(_[_0xa284('0x62')](_0x429ae8)){_0x999d61=_[_0xa284('0x3e')](_0x24abf3,function(_0x385b10){if(_0x385b10['role']!==_0xa284('0x63')){return _0x385b10;}});return _0x999d61;}else{for(var _0x54656b=0x0;_0x54656b<_0x24abf3[_0xa284('0x38')];_0x54656b++){var _0x1effb9=_0x24abf3[_0x54656b];if(_0x1effb9[_0xa284('0x56')]===_0xa284('0x63')){var _0x2f9d0c=_[_0xa284('0x48')](_0x429ae8,function(_0x356c5c){return _0x356c5c[_0xa284('0x64')]===_0x1effb9['id'];});if(_0x2f9d0c)_0x999d61[_0xa284('0x65')](_0x1effb9);}else{_0x999d61['push'](_0x1effb9);}}return _0x999d61;}});}else{return _0x24abf3;}}else{var _0x5b5d5b=_[_0xa284('0x3e')](_0x24abf3,function(_0x2d8c86){if(_0x2d8c86[_0xa284('0x56')]!==_0xa284('0x63')){return _0x2d8c86;}});return _0x5b5d5b;}});}else{return _0x24abf3;}}})[_0xa284('0x26')](function(_0xe830c7){var _0x2befb9=[];if(_0xe830c7){_0x1f91df=_0xe830c7;for(var _0x57e144=0x0;_0x57e144<_0xe830c7[_0xa284('0x38')];_0x57e144+=0x1){_0x1f91df[_0x57e144][_0xa284('0x66')]=[];_0x2befb9[_0xa284('0x65')](db[_0xa284('0x2d')][_0xa284('0x48')]({'where':{'FromId':[_0x3564ce[_0xa284('0x5c')]['id'],_0xe830c7[_0x57e144]['id']],'ToId':[_0x3564ce[_0xa284('0x5c')]['id'],_0xe830c7[_0x57e144]['id']],'ChatGroupId':null},'attributes':['id',_0xa284('0x4e'),'FromId',_0xa284('0x67'),'read',_0xa284('0x4a')],'order':qs['sort'](_0xa284('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xe830c7[_0x57e144])));}return BPromise[_0xa284('0x69')](_0x2befb9);}return[];})[_0xa284('0x26')](function(_0x541346){return{'rows':_0x541346,'count':_0x541346['length']};})[_0xa284('0x26')](respondWithResult(_0x3305c7,null))[_0xa284('0x45')](handleError(_0x3305c7,null));}; \ No newline at end of file +var _0x09bf=['includeAll','create','body','update','find','destroy','describe','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','role','user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','map','ChatInternalMessage','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes'];(function(_0x238407,_0x4e39df){var _0x107e86=function(_0x3d8534){while(--_0x3d8534){_0x238407['push'](_0x238407['shift']());}};_0x107e86(++_0x4e39df);}(_0x09bf,0x93));var _0xf09b=function(_0x4a7c8c,_0x2cb9e5){_0x4a7c8c=_0x4a7c8c-0x0;var _0x46af56=_0x09bf[_0x4a7c8c];return _0x46af56;};'use strict';var emlformat=require(_0xf09b('0x0'));var rimraf=require(_0xf09b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf09b('0x2'));var rp=require(_0xf09b('0x3'));var moment=require(_0xf09b('0x4'));var BPromise=require(_0xf09b('0x5'));var Mustache=require(_0xf09b('0x6'));var util=require(_0xf09b('0x7'));var path=require('path');var sox=require(_0xf09b('0x8'));var csv=require(_0xf09b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf09b('0xa'));var crypto=require(_0xf09b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf09b('0xc'));var toCsv=require(_0xf09b('0x9'));var querystring=require('querystring');var Papa=require(_0xf09b('0xd'));var Redis=require('ioredis');var authService=require(_0xf09b('0xe'));var qs=require(_0xf09b('0xf'));var as=require(_0xf09b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf09b('0x11'));var utils=require('../../config/utils');var config=require(_0xf09b('0x12'));var licenseUtil=require(_0xf09b('0x13'));var db=require(_0xf09b('0x14'))['db'];config[_0xf09b('0x15')]=_[_0xf09b('0x16')](config['redis'],{'host':_0xf09b('0x17'),'port':0x18eb});var socket=require(_0xf09b('0x18'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xf09b('0x19')](socket);function respondWithStatusCode(_0x1a8a20,_0x2f2018){_0x2f2018=_0x2f2018||0xcc;return function(_0xec7d07){if(_0xec7d07){return _0x1a8a20['sendStatus'](_0x2f2018);}return _0x1a8a20[_0xf09b('0x1a')](_0x2f2018)[_0xf09b('0x1b')]();};}function respondWithResult(_0x2c617b,_0x2e86e1){_0x2e86e1=_0x2e86e1||0xc8;return function(_0x4e8f83){if(_0x4e8f83){return _0x2c617b[_0xf09b('0x1a')](_0x2e86e1)[_0xf09b('0x1c')](_0x4e8f83);}};}function respondWithFilteredResult(_0x4b1ef8,_0x1bf318){return function(_0x153c21){if(_0x153c21){var _0x337378=typeof _0x1bf318[_0xf09b('0x1d')]==='undefined'&&typeof _0x1bf318['limit']===_0xf09b('0x1e');var _0x3c2c8d=_0x153c21[_0xf09b('0x1f')];var _0x499de3=_0x337378?0x0:_0x1bf318[_0xf09b('0x1d')];var _0x36016d=_0x337378?_0x153c21[_0xf09b('0x1f')]:_0x1bf318['offset']+_0x1bf318['limit'];var _0x45acef;if(_0x36016d>=_0x3c2c8d){_0x36016d=_0x3c2c8d;_0x45acef=0xc8;}else{_0x45acef=0xce;}_0x4b1ef8['status'](_0x45acef);return _0x4b1ef8['set'](_0xf09b('0x20'),_0x499de3+'-'+_0x36016d+'/'+_0x3c2c8d)['json'](_0x153c21);}return null;};}function patchUpdates(_0x4ca408){return function(_0x16da4e){try{jsonpatch[_0xf09b('0x21')](_0x16da4e,_0x4ca408,!![]);}catch(_0x2b8257){return BPromise[_0xf09b('0x22')](_0x2b8257);}return _0x16da4e[_0xf09b('0x23')]();};}function saveUpdates(_0x3c5817,_0x1f4748){return function(_0x2c6cbb){if(_0x2c6cbb){return _0x2c6cbb['update'](_0x3c5817)[_0xf09b('0x24')](function(_0x13241d){return _0x13241d;});}return null;};}function removeEntity(_0x5b4815,_0xbc0742){return function(_0x2a7518){if(_0x2a7518){return _0x2a7518['destroy']()[_0xf09b('0x24')](function(){_0x5b4815[_0xf09b('0x1a')](0xcc)[_0xf09b('0x1b')]();});}};}function handleEntityNotFound(_0x252d32,_0x4ba311){return function(_0x3eb84c){if(!_0x3eb84c){_0x252d32['sendStatus'](0x194);}return _0x3eb84c;};}function handleError(_0x3248d9,_0x16bc55){_0x16bc55=_0x16bc55||0x1f4;return function(_0x14d6ae){logger[_0xf09b('0x25')](_0x14d6ae[_0xf09b('0x26')]);if(_0x14d6ae['name']){delete _0x14d6ae[_0xf09b('0x27')];}_0x3248d9['status'](_0x16bc55)['send'](_0x14d6ae);};}exports['index']=function(_0x1bd83e,_0x26e672){var _0x4ca626={},_0x8ba00b={},_0x13b7e7={'count':0x0,'rows':[]};var _0x23d9b5=_[_0xf09b('0x28')](db[_0xf09b('0x29')]['rawAttributes'],function(_0x511d29){return{'name':_0x511d29[_0xf09b('0x2a')],'type':_0x511d29['type'][_0xf09b('0x2b')]};});_0x8ba00b[_0xf09b('0x2c')]=_[_0xf09b('0x28')](_0x23d9b5,_0xf09b('0x27'));_0x8ba00b[_0xf09b('0x2d')]=_[_0xf09b('0x2e')](_0x1bd83e[_0xf09b('0x2d')]);_0x8ba00b[_0xf09b('0x2f')]=_['intersection'](_0x8ba00b[_0xf09b('0x2c')],_0x8ba00b['query']);_0x4ca626[_0xf09b('0x30')]=_[_0xf09b('0x31')](_0x8ba00b[_0xf09b('0x2c')],qs['fields'](_0x1bd83e[_0xf09b('0x2d')][_0xf09b('0x32')]));_0x4ca626[_0xf09b('0x30')]=_0x4ca626[_0xf09b('0x30')][_0xf09b('0x33')]?_0x4ca626[_0xf09b('0x30')]:_0x8ba00b['model'];if(!_0x1bd83e[_0xf09b('0x2d')]['hasOwnProperty'](_0xf09b('0x34'))){_0x4ca626['limit']=qs[_0xf09b('0x35')](_0x1bd83e[_0xf09b('0x2d')][_0xf09b('0x35')]);_0x4ca626[_0xf09b('0x1d')]=qs[_0xf09b('0x1d')](_0x1bd83e['query'][_0xf09b('0x1d')]);}_0x4ca626[_0xf09b('0x36')]=qs['sort'](_0x1bd83e[_0xf09b('0x2d')]['sort']);_0x4ca626[_0xf09b('0x37')]=qs[_0xf09b('0x2f')](_['pick'](_0x1bd83e[_0xf09b('0x2d')],_0x8ba00b[_0xf09b('0x2f')]),_0x23d9b5);if(_0x1bd83e[_0xf09b('0x2d')][_0xf09b('0x38')]){_0x4ca626[_0xf09b('0x37')]=_[_0xf09b('0x39')](_0x4ca626['where'],{'$or':_['map'](_0x23d9b5,function(_0x2177a1){if(_0x2177a1[_0xf09b('0x3a')]!==_0xf09b('0x3b')){var _0x1f8f7c={};_0x1f8f7c[_0x2177a1[_0xf09b('0x27')]]={'$like':'%'+_0x1bd83e[_0xf09b('0x2d')][_0xf09b('0x38')]+'%'};return _0x1f8f7c;}})});}_0x4ca626=_['merge']({},_0x4ca626,_0x1bd83e[_0xf09b('0x3c')]);var _0x12f9e2={'where':_0x4ca626[_0xf09b('0x37')]};return db[_0xf09b('0x29')][_0xf09b('0x1f')](_0x12f9e2)[_0xf09b('0x24')](function(_0xc4ae3d){_0x13b7e7[_0xf09b('0x1f')]=_0xc4ae3d;if(_0x1bd83e[_0xf09b('0x2d')]['includeAll']){_0x4ca626[_0xf09b('0x3d')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xf09b('0x3e')](_0x4ca626);})[_0xf09b('0x24')](function(_0x26e302){_0x13b7e7[_0xf09b('0x3f')]=_0x26e302;return _0x13b7e7;})[_0xf09b('0x24')](respondWithFilteredResult(_0x26e672,_0x4ca626))[_0xf09b('0x40')](handleError(_0x26e672,null));};exports['show']=function(_0x4f45e8,_0x34ceda){var _0xc2c5eb={'raw':!![],'where':{'id':_0x4f45e8[_0xf09b('0x41')]['id']}},_0x471a83={};_0x471a83[_0xf09b('0x2c')]=_[_0xf09b('0x2e')](db[_0xf09b('0x29')][_0xf09b('0x42')]);_0x471a83[_0xf09b('0x2d')]=_[_0xf09b('0x2e')](_0x4f45e8[_0xf09b('0x2d')]);_0x471a83[_0xf09b('0x2f')]=_[_0xf09b('0x31')](_0x471a83[_0xf09b('0x2c')],_0x471a83['query']);_0xc2c5eb[_0xf09b('0x30')]=_[_0xf09b('0x31')](_0x471a83['model'],qs[_0xf09b('0x32')](_0x4f45e8[_0xf09b('0x2d')][_0xf09b('0x32')]));_0xc2c5eb[_0xf09b('0x30')]=_0xc2c5eb[_0xf09b('0x30')][_0xf09b('0x33')]?_0xc2c5eb[_0xf09b('0x30')]:_0x471a83[_0xf09b('0x2c')];if(_0x4f45e8[_0xf09b('0x2d')][_0xf09b('0x43')]){_0xc2c5eb[_0xf09b('0x3d')]=[{'all':!![]}];}_0xc2c5eb=_[_0xf09b('0x39')]({},_0xc2c5eb,_0x4f45e8['options']);return db[_0xf09b('0x29')]['find'](_0xc2c5eb)[_0xf09b('0x24')](handleEntityNotFound(_0x34ceda,null))[_0xf09b('0x24')](respondWithResult(_0x34ceda,null))[_0xf09b('0x40')](handleError(_0x34ceda,null));};exports[_0xf09b('0x44')]=function(_0x20cd1b,_0x3db4cf){return db[_0xf09b('0x29')][_0xf09b('0x44')](_0x20cd1b[_0xf09b('0x45')],{})[_0xf09b('0x24')](respondWithResult(_0x3db4cf,0xc9))[_0xf09b('0x40')](handleError(_0x3db4cf,null));};exports[_0xf09b('0x46')]=function(_0x328560,_0x5d5690){if(_0x328560[_0xf09b('0x45')]['id']){delete _0x328560[_0xf09b('0x45')]['id'];}return db[_0xf09b('0x29')][_0xf09b('0x47')]({'where':{'id':_0x328560[_0xf09b('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d5690,null))['then'](saveUpdates(_0x328560[_0xf09b('0x45')],null))['then'](respondWithResult(_0x5d5690,null))[_0xf09b('0x40')](handleError(_0x5d5690,null));};exports[_0xf09b('0x48')]=function(_0x5c3c84,_0x226935){return db['ChatInternalMessage'][_0xf09b('0x47')]({'where':{'id':_0x5c3c84[_0xf09b('0x41')]['id']}})[_0xf09b('0x24')](handleEntityNotFound(_0x226935,null))[_0xf09b('0x24')](removeEntity(_0x226935,null))[_0xf09b('0x40')](handleError(_0x226935,null));};exports[_0xf09b('0x49')]=function(_0x73c752,_0x59a7d6){return db[_0xf09b('0x29')][_0xf09b('0x49')]()[_0xf09b('0x24')](respondWithResult(_0x59a7d6,null))[_0xf09b('0x40')](handleError(_0x59a7d6,null));};function wrapUser(_0x5e5c35){return function(_0x52715e){var _0xf08711=_0x5e5c35['get']({'plain':!![]});_0xf08711[_0xf09b('0x4a')]=[];if(_0x52715e){_0xf08711[_0xf09b('0x4b')]=_0x52715e[_0xf09b('0x4c')];_0xf08711['lastMessage']=_0x52715e;}else{_0xf08711[_0xf09b('0x4b')]=moment(0x0)[_0xf09b('0x4d')](_0xf09b('0x4e'));_0xf08711[_0xf09b('0x4f')]={};}return _0xf08711;};}exports['getUsers']=function(_0x3aadb7,_0x1e3601,_0x2dc46d){var _0x4f57ab=[];return db[_0xf09b('0x50')][_0xf09b('0x3e')]({'where':{'role':['agent',_0xf09b('0x51'),'user']},'attributes':['id',_0xf09b('0x52'),_0xf09b('0x27'),'role',_0xf09b('0x53'),_0xf09b('0x54'),_0xf09b('0x55'),_0xf09b('0x56'),_0xf09b('0x57'),_0xf09b('0x58')],'order':qs['sort'](_0xf09b('0x59')),'include':[{'model':db[_0xf09b('0x5a')],'as':_0xf09b('0x5b'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0xf09b('0x24')](function(_0x7ef306){if(_0x7ef306){var _0x14a24d=_0x3aadb7['user'][_0xf09b('0x5c')]({'plain':!![]});if(!_0x14a24d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14a24d[_0xf09b('0x5d')]===_0xf09b('0x5e')){return db[_0xf09b('0x5f')][_0xf09b('0x47')]({'where':{'name':_0xf09b('0x60'),'userProfileId':_0x14a24d['userProfileId']},'raw':!![]})[_0xf09b('0x24')](function(_0x1b9bea){if(_0x1b9bea){if(_0x1b9bea[_0xf09b('0x61')]===0x0){return db[_0xf09b('0x62')][_0xf09b('0x3e')]({'where':{'sectionId':_0x1b9bea['id']},'raw':!![]})[_0xf09b('0x24')](function(_0x1dc1b8){var _0x3b1e62=[];if(_[_0xf09b('0x63')](_0x1dc1b8)){_0x3b1e62=_[_0xf09b('0x38')](_0x7ef306,function(_0x13f2eb){if(_0x13f2eb['role']!==_0xf09b('0x64')){return _0x13f2eb;}});return _0x3b1e62;}else{for(var _0x3afa30=0x0;_0x3afa30<_0x7ef306[_0xf09b('0x33')];_0x3afa30++){var _0x55a6b1=_0x7ef306[_0x3afa30];if(_0x55a6b1['role']===_0xf09b('0x64')){var _0x4d8149=_[_0xf09b('0x47')](_0x1dc1b8,function(_0x1765ab){return _0x1765ab[_0xf09b('0x65')]===_0x55a6b1['id'];});if(_0x4d8149)_0x3b1e62[_0xf09b('0x66')](_0x55a6b1);}else{_0x3b1e62['push'](_0x55a6b1);}}return _0x3b1e62;}});}else{return _0x7ef306;}}else{var _0x28a2f2=_[_0xf09b('0x38')](_0x7ef306,function(_0x211f47){if(_0x211f47[_0xf09b('0x5d')]!==_0xf09b('0x64')){return _0x211f47;}});return _0x28a2f2;}});}else{return _0x7ef306;}}})['then'](function(_0x2a85b1){var _0x2ced02=[];if(_0x2a85b1){_0x4f57ab=_0x2a85b1;for(var _0x50a74f=0x0;_0x50a74f<_0x2a85b1['length'];_0x50a74f+=0x1){_0x4f57ab[_0x50a74f][_0xf09b('0x4a')]=[];_0x2ced02['push'](db[_0xf09b('0x29')]['find']({'where':{'FromId':[_0x3aadb7['user']['id'],_0x2a85b1[_0x50a74f]['id']],'ToId':[_0x3aadb7[_0xf09b('0x5e')]['id'],_0x2a85b1[_0x50a74f]['id']],'ChatGroupId':null},'attributes':['id',_0xf09b('0x4c'),_0xf09b('0x67'),'ToId',_0xf09b('0x68'),_0xf09b('0x45')],'order':qs['sort'](_0xf09b('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf09b('0x24')](wrapUser(_0x2a85b1[_0x50a74f])));}return BPromise[_0xf09b('0x6a')](_0x2ced02);}return[];})[_0xf09b('0x24')](function(_0x2cf0c4){return{'rows':_0x2cf0c4,'count':_0x2cf0c4['length']};})[_0xf09b('0x24')](respondWithResult(_0x1e3601,null))[_0xf09b('0x40')](handleError(_0x1e3601,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ea772f3..bb656a7 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 _0xcb2e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x1c9dc1,_0x4ed5b0){var _0x23747d=function(_0x5af1ae){while(--_0x5af1ae){_0x1c9dc1['push'](_0x1c9dc1['shift']());}};_0x23747d(++_0x4ed5b0);}(_0xcb2e,0x1e8));var _0xecb2=function(_0x5de34b,_0x3a0d2d){_0x5de34b=_0x5de34b-0x0;var _0x57b510=_0xcb2e[_0x5de34b];return _0x57b510;};'use strict';var EventEmitter=require(_0xecb2('0x0'));var ChatInternalMessage=require(_0xecb2('0x1'))['db'][_0xecb2('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xecb2('0x3')](0x0);var events={'afterCreate':_0xecb2('0x4'),'afterUpdate':_0xecb2('0x5'),'afterDestroy':_0xecb2('0x6')};function emitEvent(_0x557f13){return function(_0x46abe3,_0x46fd15,_0x5cc532){ChatInternalMessageEvents[_0xecb2('0x7')](_0x557f13+':'+_0x46abe3['id'],_0x46abe3);ChatInternalMessageEvents[_0xecb2('0x7')](_0x557f13,_0x46abe3);_0x5cc532(null);};}for(var e in events){if(events[_0xecb2('0x8')](e)){var event=events[e];ChatInternalMessage[_0xecb2('0x9')](e,emitEvent(event));}}module[_0xecb2('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x4792=['hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove'];(function(_0x57d546,_0x2620b3){var _0x14dada=function(_0x2abbbd){while(--_0x2abbbd){_0x57d546['push'](_0x57d546['shift']());}};_0x14dada(++_0x2620b3);}(_0x4792,0xcd));var _0x2479=function(_0x1c3281,_0x5c69a0){_0x1c3281=_0x1c3281-0x0;var _0x27588d=_0x4792[_0x1c3281];return _0x27588d;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x2479('0x0'))['db'][_0x2479('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2479('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2479('0x3'),'afterDestroy':_0x2479('0x4')};function emitEvent(_0x4a05ab){return function(_0x496c13,_0x32a674,_0x30ad86){ChatInternalMessageEvents['emit'](_0x4a05ab+':'+_0x496c13['id'],_0x496c13);ChatInternalMessageEvents['emit'](_0x4a05ab,_0x496c13);_0x30ad86(null);};}for(var e in events){if(events[_0x2479('0x5')](e)){var event=events[e];ChatInternalMessage[_0x2479('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 94a1b6a..d59db72 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 _0x8ae9=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x39dd42,_0x37b32d){var _0x5b8ef3=function(_0x5086d5){while(--_0x5086d5){_0x39dd42['push'](_0x39dd42['shift']());}};_0x5b8ef3(++_0x37b32d);}(_0x8ae9,0x92));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x98ae('0x0'));var logger=require('../../config/logger')(_0x98ae('0x1'));var moment=require(_0x98ae('0x2'));var BPromise=require(_0x98ae('0x3'));var rp=require(_0x98ae('0x4'));var fs=require('fs');var path=require(_0x98ae('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x98ae('0x6'));module[_0x98ae('0x7')]=function(_0x30fe0a,_0x4bd77e){return _0x30fe0a[_0x98ae('0x8')](_0x98ae('0x9'),attributes,{'tableName':_0x98ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x98ae('0xb'),'collate':_0x98ae('0xc')});}; \ No newline at end of file +var _0xb189=['util','bluebird','request-promise','path','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5a63ed,_0x3a7749){var _0x1b8b14=function(_0x568393){while(--_0x568393){_0x5a63ed['push'](_0x5a63ed['shift']());}};_0x1b8b14(++_0x3a7749);}(_0xb189,0x1df));var _0x9b18=function(_0x201c2f,_0x1d0eca){_0x201c2f=_0x201c2f-0x0;var _0x34dd31=_0xb189[_0x201c2f];return _0x34dd31;};'use strict';var _=require(_0x9b18('0x0'));var util=require(_0x9b18('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9b18('0x2'));var rp=require(_0x9b18('0x3'));var fs=require('fs');var path=require(_0x9b18('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9b18('0x5'));module[_0x9b18('0x6')]=function(_0x1523b6,_0x22b247){return _0x1523b6[_0x9b18('0x7')](_0x9b18('0x8'),attributes,{'tableName':_0x9b18('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b18('0xa'),'collate':_0x9b18('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2059fbc..318ca06 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 _0xb806=['code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1ab35d,_0x3f401d){var _0x133d6d=function(_0x381b41){while(--_0x381b41){_0x1ab35d['push'](_0x1ab35d['shift']());}};_0x133d6d(++_0x3f401d);}(_0xb806,0x95));var _0x6b80=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xb806[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x6b80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b80('0x1'));var rs=require(_0x6b80('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b80('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b80('0x4'));var jayson=require(_0x6b80('0x5'));var client=jayson[_0x6b80('0x6')]['http']({'port':0x232a});config[_0x6b80('0x7')]=_[_0x6b80('0x8')](config[_0x6b80('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b80('0x9'))(new Redis(config[_0x6b80('0x7')]));require(_0x6b80('0xa'))[_0x6b80('0xb')](socket);function respondWithRpcPromise(_0x415fdb,_0xbe1b37,_0x261a49){return new BPromise(function(_0x462f02,_0x189358){return client[_0x6b80('0xc')](_0x415fdb,_0x261a49)[_0x6b80('0xd')](function(_0x3cd119){logger[_0x6b80('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0xbe1b37,_0x6b80('0xf'));logger['debug'](_0x6b80('0x10'),_0xbe1b37,_0x6b80('0xf'),JSON[_0x6b80('0x11')](_0x3cd119));if(_0x3cd119['error']){if(_0x3cd119[_0x6b80('0x12')][_0x6b80('0x13')]===0x1f4){logger[_0x6b80('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0xbe1b37,_0x3cd119[_0x6b80('0x12')]['message']);return _0x189358(_0x3cd119[_0x6b80('0x12')][_0x6b80('0x14')]);}logger[_0x6b80('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0xbe1b37,_0x3cd119[_0x6b80('0x12')][_0x6b80('0x14')]);return _0x462f02(_0x3cd119[_0x6b80('0x12')][_0x6b80('0x14')]);}else{logger[_0x6b80('0xe')](_0x6b80('0x15'),_0xbe1b37,_0x6b80('0xf'));_0x462f02(_0x3cd119[_0x6b80('0x16')][_0x6b80('0x14')]);}})[_0x6b80('0x17')](function(_0x10ec8a){logger[_0x6b80('0x12')](_0x6b80('0x15'),_0xbe1b37,_0x10ec8a);_0x189358(_0x10ec8a);});});} \ No newline at end of file +var _0xf15e=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0xf15e,0xb9));var _0xef15=function(_0x50a4ca,_0x5f3797){_0x50a4ca=_0x50a4ca-0x0;var _0x211ede=_0xf15e[_0x50a4ca];return _0x211ede;};'use strict';var _=require(_0xef15('0x0'));var util=require('util');var moment=require(_0xef15('0x1'));var BPromise=require(_0xef15('0x2'));var rs=require(_0xef15('0x3'));var fs=require('fs');var Redis=require(_0xef15('0x4'));var db=require(_0xef15('0x5'))['db'];var utils=require(_0xef15('0x6'));var logger=require('../../config/logger')(_0xef15('0x7'));var config=require(_0xef15('0x8'));var jayson=require(_0xef15('0x9'));var client=jayson[_0xef15('0xa')]['http']({'port':0x232a});config[_0xef15('0xb')]=_[_0xef15('0xc')](config[_0xef15('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xef15('0xd'))(new Redis(config[_0xef15('0xb')]));require(_0xef15('0xe'))[_0xef15('0xf')](socket);function respondWithRpcPromise(_0x4989da,_0xf5c4a7,_0x2290c3){return new BPromise(function(_0x416c5c,_0x4b51ab){return client[_0xef15('0x10')](_0x4989da,_0x2290c3)[_0xef15('0x11')](function(_0x16e4ee){logger[_0xef15('0x12')](_0xef15('0x13'),_0xf5c4a7,'request\x20sent');logger['debug'](_0xef15('0x14'),_0xf5c4a7,_0xef15('0x15'),JSON[_0xef15('0x16')](_0x16e4ee));if(_0x16e4ee['error']){if(_0x16e4ee[_0xef15('0x17')]['code']===0x1f4){logger[_0xef15('0x17')](_0xef15('0x13'),_0xf5c4a7,_0x16e4ee[_0xef15('0x17')]['message']);return _0x4b51ab(_0x16e4ee[_0xef15('0x17')]['message']);}logger['error'](_0xef15('0x13'),_0xf5c4a7,_0x16e4ee['error'][_0xef15('0x18')]);return _0x416c5c(_0x16e4ee[_0xef15('0x17')][_0xef15('0x18')]);}else{logger[_0xef15('0x12')](_0xef15('0x13'),_0xf5c4a7,'request\x20sent');_0x416c5c(_0x16e4ee[_0xef15('0x19')][_0xef15('0x18')]);}})[_0xef15('0x1a')](function(_0x40b9ca){logger['error'](_0xef15('0x13'),_0xf5c4a7,_0x40b9ca);_0x4b51ab(_0x40b9ca);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 29f4cb2..bbe3bce 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 _0xa495=['register','length','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x23c262,_0x74765a){var _0x9b913f=function(_0x3ecb98){while(--_0x3ecb98){_0x23c262['push'](_0x23c262['shift']());}};_0x9b913f(++_0x74765a);}(_0xa495,0xc6));var _0x5a49=function(_0x443bdd,_0x517654){_0x443bdd=_0x443bdd-0x0;var _0x3a1e48=_0xa495[_0x443bdd];return _0x3a1e48;};'use strict';var ChatInternalMessageEvents=require(_0x5a49('0x0'));var events=[_0x5a49('0x1'),_0x5a49('0x2'),_0x5a49('0x3')];function createListener(_0x11661a,_0x3ca292){return function(_0x167e1a){_0x3ca292[_0x5a49('0x4')](_0x11661a,_0x167e1a);};}function removeListener(_0x43dbaf,_0x30adab){return function(){ChatInternalMessageEvents['removeListener'](_0x43dbaf,_0x30adab);};}exports[_0x5a49('0x5')]=function(_0x4b78b6){for(var _0xc68c73=0x0,_0xe62863=events[_0x5a49('0x6')];_0xc68c73<_0xe62863;_0xc68c73++){var _0xf10f51=events[_0xc68c73];var _0x140e51=createListener('chatInternalMessage:'+_0xf10f51,_0x4b78b6);ChatInternalMessageEvents['on'](_0xf10f51,_0x140e51);}}; \ No newline at end of file +var _0x4f45=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','emit'];(function(_0x5bcfff,_0x486d4b){var _0x402ecc=function(_0x35dd5f){while(--_0x35dd5f){_0x5bcfff['push'](_0x5bcfff['shift']());}};_0x402ecc(++_0x486d4b);}(_0x4f45,0x13c));var _0x54f4=function(_0x21dbbf,_0x14447a){_0x21dbbf=_0x21dbbf-0x0;var _0x4514bf=_0x4f45[_0x21dbbf];return _0x4514bf;};'use strict';var ChatInternalMessageEvents=require(_0x54f4('0x0'));var events=[_0x54f4('0x1'),_0x54f4('0x2'),'update'];function createListener(_0x170b95,_0x77919){return function(_0x348605){_0x77919[_0x54f4('0x3')](_0x170b95,_0x348605);};}function removeListener(_0x266f13,_0x94865b){return function(){ChatInternalMessageEvents[_0x54f4('0x4')](_0x266f13,_0x94865b);};}exports[_0x54f4('0x5')]=function(_0x4c3a5b){for(var _0xbd5410=0x0,_0x4a2685=events[_0x54f4('0x6')];_0xbd5410<_0x4a2685;_0xbd5410++){var _0x4475ba=events[_0xbd5410];var _0x59cda2=createListener(_0x54f4('0x7')+_0x4475ba,_0x4c3a5b);ChatInternalMessageEvents['on'](_0x4475ba,_0x59cda2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 258e654..22e2b85 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 _0x3fa4=['./chatInternalMessage.controller','get','isAuthenticated','describe','/users','getUsers','/:id','show','post','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3e7a6c,_0x457a08){var _0x3abdc7=function(_0x1f2bb0){while(--_0x1f2bb0){_0x3e7a6c['push'](_0x3e7a6c['shift']());}};_0x3abdc7(++_0x457a08);}(_0x3fa4,0x175));var _0x43fa=function(_0x33d5e0,_0x2ac8e7){_0x33d5e0=_0x33d5e0-0x0;var _0x5ad6d9=_0x3fa4[_0x33d5e0];return _0x5ad6d9;};'use strict';var multer=require(_0x43fa('0x0'));var util=require('util');var path=require(_0x43fa('0x1'));var timeout=require('connect-timeout');var express=require(_0x43fa('0x2'));var router=express[_0x43fa('0x3')]();var fs_extra=require(_0x43fa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x43fa('0x5'));var config=require(_0x43fa('0x6'));var controller=require(_0x43fa('0x7'));router[_0x43fa('0x8')]('/',auth[_0x43fa('0x9')](),controller['index']);router['get']('/describe',auth[_0x43fa('0x9')](),controller[_0x43fa('0xa')]);router[_0x43fa('0x8')](_0x43fa('0xb'),auth[_0x43fa('0x9')](),controller[_0x43fa('0xc')]);router[_0x43fa('0x8')](_0x43fa('0xd'),auth[_0x43fa('0x9')](),controller[_0x43fa('0xe')]);router[_0x43fa('0xf')]('/',auth['isAuthenticated'](),controller[_0x43fa('0x10')]);router[_0x43fa('0x11')]('/:id',controller[_0x43fa('0x12')]);router['delete']('/:id',auth[_0x43fa('0x9')](),controller['destroy']);module[_0x43fa('0x13')]=router; \ No newline at end of file +var _0x9f7e=['show','create','put','/:id','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers'];(function(_0x2dedf5,_0x39168e){var _0x9ce21f=function(_0x4b3465){while(--_0x4b3465){_0x2dedf5['push'](_0x2dedf5['shift']());}};_0x9ce21f(++_0x39168e);}(_0x9f7e,0x156));var _0xe9f7=function(_0x54c02e,_0x1a9233){_0x54c02e=_0x54c02e-0x0;var _0x5c5f5b=_0x9f7e[_0x54c02e];return _0x5c5f5b;};'use strict';var multer=require('multer');var util=require(_0xe9f7('0x0'));var path=require(_0xe9f7('0x1'));var timeout=require('connect-timeout');var express=require(_0xe9f7('0x2'));var router=express[_0xe9f7('0x3')]();var fs_extra=require(_0xe9f7('0x4'));var auth=require(_0xe9f7('0x5'));var interaction=require(_0xe9f7('0x6'));var config=require(_0xe9f7('0x7'));var controller=require(_0xe9f7('0x8'));router[_0xe9f7('0x9')]('/',auth[_0xe9f7('0xa')](),controller[_0xe9f7('0xb')]);router[_0xe9f7('0x9')](_0xe9f7('0xc'),auth[_0xe9f7('0xa')](),controller[_0xe9f7('0xd')]);router[_0xe9f7('0x9')]('/users',auth[_0xe9f7('0xa')](),controller[_0xe9f7('0xe')]);router[_0xe9f7('0x9')]('/:id',auth[_0xe9f7('0xa')](),controller[_0xe9f7('0xf')]);router['post']('/',auth[_0xe9f7('0xa')](),controller[_0xe9f7('0x10')]);router[_0xe9f7('0x11')](_0xe9f7('0x12'),controller[_0xe9f7('0x13')]);router['delete']('/:id',auth[_0xe9f7('0xa')](),controller[_0xe9f7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1760ca8..b1efa16 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 _0xcf2f=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x562c55,_0x141526){var _0x533dc9=function(_0x3c8d6a){while(--_0x3c8d6a){_0x562c55['push'](_0x562c55['shift']());}};_0x533dc9(++_0x141526);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x4da60e,_0x16bd7b){_0x4da60e=_0x4da60e-0x0;var _0x1a6561=_0xcf2f[_0x4da60e];return _0x1a6561;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'body':{'type':Sequelize[_0xfcf2('0x2')](_0xfcf2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfcf2('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfcf2('0x5')]('in',_0xfcf2('0x6')),'defaultValue':_0xfcf2('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfcf2('0x7')]},'providerName':{'type':Sequelize[_0xfcf2('0x8')]},'providerResponse':{'type':Sequelize[_0xfcf2('0x2')]}}; \ No newline at end of file +var _0x3c8b=['DATE','STRING','TEXT','exports','medium','BOOLEAN','out'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x3c8b,0x18b));var _0xb3c8=function(_0xd39177,_0x281a38){_0xd39177=_0xd39177-0x0;var _0x318da8=_0x3c8b[_0xd39177];return _0x318da8;};'use strict';var Sequelize=require('sequelize');module[_0xb3c8('0x0')]={'body':{'type':Sequelize['TEXT'](_0xb3c8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb3c8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb3c8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb3c8('0x3')),'defaultValue':_0xb3c8('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb3c8('0x4')]},'providerName':{'type':Sequelize[_0xb3c8('0x5')]},'providerResponse':{'type':Sequelize[_0xb3c8('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e03172e..4959e58 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 _0x8465=['Content-Range','reject','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','merge','create','find','body','describe','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','fullname','email','internal','interface','SIP/%s','motionChannel','event','EventManager','formData','ChatInteraction','ChatInteractionId','rejectMessage','ContactId','sequelize','SELECT','User','channel','parse','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','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','redis','defaults','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x25e11c,_0x144c45){var _0x2a4826=function(_0x40b1f0){while(--_0x40b1f0){_0x25e11c['push'](_0x25e11c['shift']());}};_0x2a4826(++_0x144c45);}(_0x8465,0x152));var _0x5846=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x8465[_0x41e8c4];return _0x54ffbe;};'use strict';var emlformat=require(_0x5846('0x0'));var rimraf=require(_0x5846('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5846('0x2'));var rp=require('request-promise');var moment=require(_0x5846('0x3'));var BPromise=require(_0x5846('0x4'));var Mustache=require('mustache');var util=require(_0x5846('0x5'));var path=require(_0x5846('0x6'));var sox=require('sox');var csv=require(_0x5846('0x7'));var ejs=require(_0x5846('0x8'));var fs=require('fs');var fs_extra=require(_0x5846('0x9'));var _=require('lodash');var squel=require(_0x5846('0xa'));var crypto=require('crypto');var jsforce=require(_0x5846('0xb'));var deskjs=require(_0x5846('0xc'));var toCsv=require(_0x5846('0x7'));var querystring=require(_0x5846('0xd'));var Papa=require(_0x5846('0xe'));var Redis=require(_0x5846('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5846('0x10'));var as=require(_0x5846('0x11'));var hardwareService=require(_0x5846('0x12'));var logger=require(_0x5846('0x13'))('api');var utils=require(_0x5846('0x14'));var config=require(_0x5846('0x15'));var licenseUtil=require(_0x5846('0x16'));var db=require(_0x5846('0x17'))['db'];config[_0x5846('0x18')]=_[_0x5846('0x19')](config[_0x5846('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5846('0x18')]));require(_0x5846('0x1a'))[_0x5846('0x1b')](socket);var jayson=require(_0x5846('0x1c'));var client=jayson[_0x5846('0x1d')][_0x5846('0x1e')]({'port':0x232c});var client9002=jayson[_0x5846('0x1d')][_0x5846('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2ab495,_0xa9a679,_0x1407e1,_0x5f17ad){return new BPromise(function(_0x2870a6,_0x2527e9){var _0x27877e=_0x5f17ad||client;return _0x27877e[_0x5846('0x1f')](_0x2ab495,_0x1407e1)[_0x5846('0x20')](function(_0x5616e6){logger[_0x5846('0x21')]('ChatMessage,\x20%s,\x20%s',_0xa9a679,'request\x20sent');logger[_0x5846('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xa9a679,_0x5846('0x23'),JSON[_0x5846('0x24')](_0x5616e6));if(_0x5616e6[_0x5846('0x25')]){if(_0x5616e6['error'][_0x5846('0x26')]===0x1f4){logger[_0x5846('0x25')](_0x5846('0x27'),_0xa9a679,_0x5616e6['error'][_0x5846('0x28')]);return _0x2527e9(_0x5616e6[_0x5846('0x25')][_0x5846('0x28')]);}logger[_0x5846('0x25')]('ChatMessage,\x20%s,\x20%s',_0xa9a679,_0x5616e6[_0x5846('0x25')][_0x5846('0x28')]);return _0x2870a6(_0x5616e6[_0x5846('0x25')]['message']);}else{logger[_0x5846('0x21')](_0x5846('0x27'),_0xa9a679,_0x5846('0x23'));_0x2870a6(_0x5616e6[_0x5846('0x29')][_0x5846('0x28')]);}})[_0x5846('0x2a')](function(_0x4dc9db){logger[_0x5846('0x25')](_0x5846('0x27'),_0xa9a679,_0x4dc9db);_0x2527e9(_0x4dc9db);});});}function respondWithStatusCode(_0x1724f8,_0x1d27e7){_0x1d27e7=_0x1d27e7||0xcc;return function(_0x2b4514){if(_0x2b4514){return _0x1724f8[_0x5846('0x2b')](_0x1d27e7);}return _0x1724f8['status'](_0x1d27e7)[_0x5846('0x2c')]();};}function respondWithResult(_0x3fcfab,_0x58511c){_0x58511c=_0x58511c||0xc8;return function(_0x26e446){if(_0x26e446){return _0x3fcfab[_0x5846('0x2d')](_0x58511c)[_0x5846('0x2e')](_0x26e446);}};}function respondWithFilteredResult(_0x268b92,_0x147dbe){return function(_0x2d832a){if(_0x2d832a){var _0x41d06f=typeof _0x147dbe[_0x5846('0x2f')]===_0x5846('0x30')&&typeof _0x147dbe[_0x5846('0x31')]===_0x5846('0x30');var _0x280eae=_0x2d832a[_0x5846('0x32')];var _0x4b3205=_0x41d06f?0x0:_0x147dbe[_0x5846('0x2f')];var _0x3d104d=_0x41d06f?_0x2d832a[_0x5846('0x32')]:_0x147dbe[_0x5846('0x2f')]+_0x147dbe[_0x5846('0x31')];var _0x46fe0e;if(_0x3d104d>=_0x280eae){_0x3d104d=_0x280eae;_0x46fe0e=0xc8;}else{_0x46fe0e=0xce;}_0x268b92[_0x5846('0x2d')](_0x46fe0e);return _0x268b92[_0x5846('0x33')](_0x5846('0x34'),_0x4b3205+'-'+_0x3d104d+'/'+_0x280eae)[_0x5846('0x2e')](_0x2d832a);}return null;};}function patchUpdates(_0x5b7234){return function(_0x4d2f41){try{jsonpatch['apply'](_0x4d2f41,_0x5b7234,!![]);}catch(_0x4c0f18){return BPromise[_0x5846('0x35')](_0x4c0f18);}return _0x4d2f41['save']();};}function saveUpdates(_0x3c3dba,_0x1e58b6){return function(_0x476013){if(_0x476013){return _0x476013[_0x5846('0x36')](_0x3c3dba)['then'](function(_0x3ddfa1){return _0x3ddfa1;});}return null;};}function removeEntity(_0x471761,_0x246087){return function(_0x24902e){if(_0x24902e){return _0x24902e[_0x5846('0x37')]()[_0x5846('0x20')](function(){_0x471761[_0x5846('0x2d')](0xcc)[_0x5846('0x2c')]();});}};}function handleEntityNotFound(_0x24f4fd,_0x3d922c){return function(_0x450804){if(!_0x450804){_0x24f4fd[_0x5846('0x2b')](0x194);}return _0x450804;};}function handleError(_0x519a63,_0x34360c){_0x34360c=_0x34360c||0x1f4;return function(_0x4ce30c){logger[_0x5846('0x25')](_0x4ce30c[_0x5846('0x38')]);if(_0x4ce30c[_0x5846('0x39')]){delete _0x4ce30c[_0x5846('0x39')];}_0x519a63[_0x5846('0x2d')](_0x34360c)[_0x5846('0x3a')](_0x4ce30c);};}exports[_0x5846('0x3b')]=function(_0x456dc0,_0x51f8e2){var _0x59174d={},_0x1f2aab={},_0x412493={'count':0x0,'rows':[]};var _0x50869c=_[_0x5846('0x3c')](db[_0x5846('0x3d')][_0x5846('0x3e')],function(_0xe0e81d){return{'name':_0xe0e81d['fieldName'],'type':_0xe0e81d[_0x5846('0x3f')]['key']};});_0x1f2aab[_0x5846('0x40')]=_[_0x5846('0x3c')](_0x50869c,_0x5846('0x39'));_0x1f2aab[_0x5846('0x41')]=_[_0x5846('0x42')](_0x456dc0[_0x5846('0x41')]);_0x1f2aab[_0x5846('0x43')]=_[_0x5846('0x44')](_0x1f2aab['model'],_0x1f2aab['query']);_0x59174d[_0x5846('0x45')]=_['intersection'](_0x1f2aab[_0x5846('0x40')],qs[_0x5846('0x46')](_0x456dc0[_0x5846('0x41')]['fields']));_0x59174d[_0x5846('0x45')]=_0x59174d['attributes']['length']?_0x59174d[_0x5846('0x45')]:_0x1f2aab[_0x5846('0x40')];if(!_0x456dc0['query'][_0x5846('0x47')](_0x5846('0x48'))){_0x59174d[_0x5846('0x31')]=qs['limit'](_0x456dc0[_0x5846('0x41')][_0x5846('0x31')]);_0x59174d[_0x5846('0x2f')]=qs[_0x5846('0x2f')](_0x456dc0[_0x5846('0x41')]['offset']);}_0x59174d['order']=qs[_0x5846('0x49')](_0x456dc0['query']['sort']);_0x59174d[_0x5846('0x4a')]=qs[_0x5846('0x43')](_[_0x5846('0x4b')](_0x456dc0[_0x5846('0x41')],_0x1f2aab['filters']),_0x50869c);if(_0x456dc0[_0x5846('0x41')][_0x5846('0x4c')]){_0x59174d['where']=_['merge'](_0x59174d[_0x5846('0x4a')],{'$or':_['map'](_0x50869c,function(_0x3065e4){if(_0x3065e4[_0x5846('0x3f')]!==_0x5846('0x4d')){var _0x575ac9={};_0x575ac9[_0x3065e4[_0x5846('0x39')]]={'$like':'%'+_0x456dc0[_0x5846('0x41')][_0x5846('0x4c')]+'%'};return _0x575ac9;}})});}_0x59174d=_['merge']({},_0x59174d,_0x456dc0[_0x5846('0x4e')]);var _0x2a21b7={'where':_0x59174d[_0x5846('0x4a')]};return db['ChatMessage']['count'](_0x2a21b7)[_0x5846('0x20')](function(_0x447b0e){_0x412493[_0x5846('0x32')]=_0x447b0e;if(_0x456dc0[_0x5846('0x41')][_0x5846('0x4f')]){_0x59174d['include']=[{'all':!![]}];}return db[_0x5846('0x3d')][_0x5846('0x50')](_0x59174d);})[_0x5846('0x20')](function(_0x5be23b){_0x412493[_0x5846('0x51')]=_0x5be23b;return _0x412493;})[_0x5846('0x20')](respondWithFilteredResult(_0x51f8e2,_0x59174d))[_0x5846('0x2a')](handleError(_0x51f8e2,null));};exports[_0x5846('0x52')]=function(_0x5cbf49,_0x3162bd){var _0x55bd42={'raw':!![],'where':{'id':_0x5cbf49[_0x5846('0x53')]['id']}},_0x2474c8={};_0x2474c8[_0x5846('0x40')]=_['keys'](db[_0x5846('0x3d')]['rawAttributes']);_0x2474c8[_0x5846('0x41')]=_[_0x5846('0x42')](_0x5cbf49[_0x5846('0x41')]);_0x2474c8[_0x5846('0x43')]=_[_0x5846('0x44')](_0x2474c8[_0x5846('0x40')],_0x2474c8[_0x5846('0x41')]);_0x55bd42['attributes']=_[_0x5846('0x44')](_0x2474c8[_0x5846('0x40')],qs[_0x5846('0x46')](_0x5cbf49[_0x5846('0x41')]['fields']));_0x55bd42[_0x5846('0x45')]=_0x55bd42[_0x5846('0x45')][_0x5846('0x54')]?_0x55bd42[_0x5846('0x45')]:_0x2474c8[_0x5846('0x40')];if(_0x5cbf49[_0x5846('0x41')]['includeAll']){_0x55bd42[_0x5846('0x55')]=[{'all':!![]}];}_0x55bd42=_[_0x5846('0x56')]({},_0x55bd42,_0x5cbf49[_0x5846('0x4e')]);return db[_0x5846('0x3d')]['find'](_0x55bd42)[_0x5846('0x20')](handleEntityNotFound(_0x3162bd,null))['then'](respondWithResult(_0x3162bd,null))[_0x5846('0x2a')](handleError(_0x3162bd,null));};exports['create']=function(_0x256265,_0x31068e){return db[_0x5846('0x3d')][_0x5846('0x57')](_0x256265['body'],{})[_0x5846('0x20')](respondWithResult(_0x31068e,0xc9))[_0x5846('0x2a')](handleError(_0x31068e,null));};exports['update']=function(_0x2d0fe8,_0x5c0703){if(_0x2d0fe8['body']['id']){delete _0x2d0fe8['body']['id'];}return db[_0x5846('0x3d')][_0x5846('0x58')]({'where':{'id':_0x2d0fe8[_0x5846('0x53')]['id']}})['then'](handleEntityNotFound(_0x5c0703,null))[_0x5846('0x20')](saveUpdates(_0x2d0fe8[_0x5846('0x59')],null))[_0x5846('0x20')](respondWithResult(_0x5c0703,null))[_0x5846('0x2a')](handleError(_0x5c0703,null));};exports[_0x5846('0x37')]=function(_0xb77776,_0x3649dd){return db[_0x5846('0x3d')][_0x5846('0x58')]({'where':{'id':_0xb77776[_0x5846('0x53')]['id']}})[_0x5846('0x20')](handleEntityNotFound(_0x3649dd,null))['then'](removeEntity(_0x3649dd,null))[_0x5846('0x2a')](handleError(_0x3649dd,null));};exports[_0x5846('0x5a')]=function(_0x20c906,_0x49520b){return db[_0x5846('0x3d')][_0x5846('0x5a')]()['then'](respondWithResult(_0x49520b,null))[_0x5846('0x2a')](handleError(_0x49520b,null));};var interaction_log=require('../../config/logger')(_0x5846('0x5b'));exports[_0x5846('0x5c')]=function(_0x49ab3b,_0x40837f,_0x435c91){var _0x26a449={'agent':{},'channel':'chat'};if(_0x49ab3b[_0x5846('0x59')]['id']){delete _0x49ab3b[_0x5846('0x59')]['id'];}_0x49ab3b[_0x5846('0x59')][_0x5846('0x5d')]=!![];_0x49ab3b[_0x5846('0x59')][_0x5846('0x5e')]=moment()[_0x5846('0x5f')](_0x5846('0x60'));_0x49ab3b[_0x5846('0x59')][_0x5846('0x61')]=_0x49ab3b[_0x5846('0x59')][_0x5846('0x61')]||_0x49ab3b[_0x5846('0x62')]['id'];_0x26a449[_0x5846('0x63')]['id']=_0x49ab3b[_0x5846('0x59')][_0x5846('0x61')];return db[_0x5846('0x3d')][_0x5846('0x58')]({'where':{'id':_0x49ab3b['params']['id'],'UserId':null}})[_0x5846('0x20')](handleEntityNotFound(_0x40837f,null))[_0x5846('0x20')](saveUpdates(_0x49ab3b[_0x5846('0x59')],null))[_0x5846('0x20')](function(_0x596047){if(_0x596047){_0x26a449[_0x5846('0x28')]=_0x596047[_0x5846('0x64')]({'plain':!![]});return db['ChatInteraction'][_0x5846('0x58')]({'where':{'id':_0x596047['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x40837f,null))[_0x5846('0x20')](function(_0x1f0d22){if(_0x1f0d22){return _0x1f0d22['update']({'UserId':_0x49ab3b[_0x5846('0x59')][_0x5846('0x61')],'read1stAt':_[_0x5846('0x65')](_0x1f0d22[_0x5846('0x66')])?moment()['format'](_0x5846('0x60')):undefined});}return null;})[_0x5846('0x20')](function(_0x322cfd){if(_0x322cfd){_0x26a449[_0x5846('0x67')]=_0x322cfd[_0x5846('0x64')]({'plain':!![]});interaction_log[_0x5846('0x21')](_0x5846('0x68'),_0x49ab3b[_0x5846('0x62')]['id'],_0x49ab3b['user']['name'],_0x49ab3b['user'][_0x5846('0x69')],_0x26a449[_0x5846('0x67')]['id'],_0x49ab3b[_0x5846('0x59')]?JSON[_0x5846('0x24')](_0x49ab3b[_0x5846('0x59')]):_0x5846('0x6a'));return respondWithRpcPromise(_0x5846('0x6b'),_0x5846('0x6c'),_0x26a449);}return null;})[_0x5846('0x20')](function(_0x5ec1ec){var _0x1fe1a0=_0x5846('0x6d')+_0x5ec1ec[_0x5846('0x28')]['ContactId'];return db['sequelize'][_0x5846('0x41')](_0x1fe1a0,{'type':db['Sequelize'][_0x5846('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x4867d9){return _0x4867d9;});})[_0x5846('0x20')](function(_0x1c0488){if(_0x1c0488){_0x26a449['message'][_0x5846('0x6f')]=_0x1c0488[0x0];if(!_0x49ab3b[_0x5846('0x59')][_0x5846('0x61')])return;return db['User'][_0x5846('0x58')]({'where':{'id':_0x49ab3b[_0x5846('0x59')]['UserId'],'role':_0x5846('0x63')},'attributes':['id',_0x5846('0x39'),_0x5846('0x70'),_0x5846('0x71'),_0x5846('0x72')],'raw':!![]});}return null;})[_0x5846('0x20')](function(_0x4d2dac){if(!_0x4d2dac)return null;_0x26a449['message'][_0x5846('0x63')]=_0x4d2dac;return _0x26a449;})[_0x5846('0x20')](function(_0x49b114){if(_0x49b114){if(_0x49ab3b['body']['manual']){_0x26a449[_0x5846('0x28')][_0x5846('0x73')]=util['format'](_0x5846('0x74'),_0x49ab3b[_0x5846('0x62')][_0x5846('0x39')]);_0x26a449[_0x5846('0x28')]['channel']=_0x26a449['channel'];_0x26a449[_0x5846('0x28')][_0x5846('0x75')]=_0x26a449['channel'];_0x26a449[_0x5846('0x28')][_0x5846('0x76')]=_0x5846('0x5c');return respondWithRpcPromise(_0x5846('0x77'),'EventManager',{'event':'acceptmessage','message':_[_0x5846('0x56')](_0x26a449['message'],JSON['parse'](_0x26a449[_0x5846('0x67')][_0x5846('0x78')]))},client9002)[_0x5846('0x20')](function(){return _0x26a449;});}return _0x26a449;}return null;})['then'](respondWithResult(_0x40837f,null))['catch'](handleError(_0x40837f,null));};var interaction_log=require(_0x5846('0x13'))(_0x5846('0x5b'));exports[_0x5846('0x35')]=function(_0x2a0695,_0x3cd46f,_0x8d397f){var _0x298b3f={'agent':{},'channel':'chat'};if(_0x2a0695[_0x5846('0x59')]['id']){delete _0x2a0695[_0x5846('0x59')]['id'];}_0x2a0695[_0x5846('0x59')][_0x5846('0x61')]=_0x2a0695[_0x5846('0x59')]['UserId']||_0x2a0695['user']['id'];_0x298b3f['agent']['id']=_0x2a0695[_0x5846('0x59')][_0x5846('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x2a0695[_0x5846('0x53')]['id'],'UserId':null}})[_0x5846('0x20')](handleEntityNotFound(_0x3cd46f,null))[_0x5846('0x20')](function(_0x2339c4){if(_0x2339c4){_0x298b3f['message']=_0x2339c4[_0x5846('0x64')]({'plain':!![]});return db[_0x5846('0x79')]['find']({'where':{'id':_0x2339c4[_0x5846('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x3cd46f,null))[_0x5846('0x20')](function(_0x134250){if(_0x134250){_0x298b3f['interaction']=_0x134250[_0x5846('0x64')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a0695[_0x5846('0x62')]['id'],_0x2a0695[_0x5846('0x62')]['name'],_0x2a0695[_0x5846('0x62')][_0x5846('0x69')],_0x298b3f[_0x5846('0x67')]['id'],_0x2a0695[_0x5846('0x59')]?JSON[_0x5846('0x24')](_0x2a0695[_0x5846('0x59')]):_0x5846('0x6a'));return respondWithRpcPromise('RejectMessage',_0x5846('0x7b'),_0x298b3f);}return null;})['then'](function(_0x272641){var _0x17b494='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x272641['message'][_0x5846('0x7c')];return db[_0x5846('0x7d')][_0x5846('0x41')](_0x17b494,{'type':db['Sequelize']['QueryTypes'][_0x5846('0x7e')],'raw':!![]})[_0x5846('0x20')](function(_0x4f84c0){return _0x4f84c0;});})[_0x5846('0x20')](function(_0x1c9b7a){if(_0x1c9b7a){_0x298b3f['message'][_0x5846('0x6f')]=_0x1c9b7a[0x0];if(!_0x2a0695[_0x5846('0x59')][_0x5846('0x61')])return;return db[_0x5846('0x7f')][_0x5846('0x58')]({'where':{'id':_0x2a0695[_0x5846('0x59')][_0x5846('0x61')],'role':_0x5846('0x63')},'attributes':['id',_0x5846('0x39'),'fullname',_0x5846('0x71'),'internal'],'raw':!![]});}return null;})[_0x5846('0x20')](function(_0x107518){if(!_0x107518)return null;_0x298b3f[_0x5846('0x28')][_0x5846('0x63')]=_0x107518;return _0x298b3f;})[_0x5846('0x20')](function(_0x3bff0b){if(_0x3bff0b){_0x3bff0b[_0x5846('0x28')][_0x5846('0x73')]=util[_0x5846('0x5f')](_0x5846('0x74'),_0x2a0695[_0x5846('0x62')][_0x5846('0x39')]);_0x3bff0b[_0x5846('0x28')]['channel']=_0x298b3f[_0x5846('0x80')];_0x3bff0b[_0x5846('0x28')][_0x5846('0x75')]=_0x298b3f[_0x5846('0x80')];_0x3bff0b[_0x5846('0x28')][_0x5846('0x76')]='reject';respondWithRpcPromise(_0x5846('0x77'),_0x5846('0x77'),{'event':'rejectmessage','message':_['merge'](_0x298b3f[_0x5846('0x28')],JSON[_0x5846('0x81')](_0x298b3f[_0x5846('0x67')]['formData']))},client9002);return _0x298b3f;}return null;})[_0x5846('0x20')](respondWithResult(_0x3cd46f,null))[_0x5846('0x2a')](handleError(_0x3cd46f,null));}; \ No newline at end of file +var _0x4b75=['[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','ContactId','interface','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','destroy','name','send','index','map','ChatMessage','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','../../config/logger','chat-interactions','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','ChatInteractionId','update','isNil','format','interaction'];(function(_0x3c3e3f,_0x3bdc20){var _0x2577c0=function(_0x597df2){while(--_0x597df2){_0x3c3e3f['push'](_0x3c3e3f['shift']());}};_0x2577c0(++_0x3bdc20);}(_0x4b75,0xa3));var _0x54b7=function(_0x35bc99,_0x1d3db3){_0x35bc99=_0x35bc99-0x0;var _0x5f4169=_0x4b75[_0x35bc99];return _0x5f4169;};'use strict';var emlformat=require(_0x54b7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54b7('0x1'));var rp=require(_0x54b7('0x2'));var moment=require(_0x54b7('0x3'));var BPromise=require(_0x54b7('0x4'));var Mustache=require(_0x54b7('0x5'));var util=require('util');var path=require(_0x54b7('0x6'));var sox=require(_0x54b7('0x7'));var csv=require(_0x54b7('0x8'));var ejs=require(_0x54b7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54b7('0xa'));var squel=require(_0x54b7('0xb'));var crypto=require(_0x54b7('0xc'));var jsforce=require(_0x54b7('0xd'));var deskjs=require(_0x54b7('0xe'));var toCsv=require(_0x54b7('0x8'));var querystring=require(_0x54b7('0xf'));var Papa=require(_0x54b7('0x10'));var Redis=require('ioredis');var authService=require(_0x54b7('0x11'));var qs=require(_0x54b7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54b7('0x13'));var logger=require('../../config/logger')(_0x54b7('0x14'));var utils=require(_0x54b7('0x15'));var config=require(_0x54b7('0x16'));var licenseUtil=require(_0x54b7('0x17'));var db=require(_0x54b7('0x18'))['db'];config[_0x54b7('0x19')]=_[_0x54b7('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x54b7('0x19')]));require('./chatMessage.socket')[_0x54b7('0x1b')](socket);var jayson=require(_0x54b7('0x1c'));var client=jayson[_0x54b7('0x1d')][_0x54b7('0x1e')]({'port':0x232c});var client9002=jayson[_0x54b7('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5daaa,_0x42950a,_0x40fb90,_0x5d5e06){return new BPromise(function(_0x5ba0a4,_0x4fcd8a){var _0x637d73=_0x5d5e06||client;return _0x637d73[_0x54b7('0x1f')](_0xc5daaa,_0x40fb90)[_0x54b7('0x20')](function(_0x27ecf5){logger[_0x54b7('0x21')](_0x54b7('0x22'),_0x42950a,_0x54b7('0x23'));logger[_0x54b7('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x42950a,_0x54b7('0x23'),JSON[_0x54b7('0x25')](_0x27ecf5));if(_0x27ecf5[_0x54b7('0x26')]){if(_0x27ecf5[_0x54b7('0x26')][_0x54b7('0x27')]===0x1f4){logger[_0x54b7('0x26')]('ChatMessage,\x20%s,\x20%s',_0x42950a,_0x27ecf5['error'][_0x54b7('0x28')]);return _0x4fcd8a(_0x27ecf5['error']['message']);}logger['error'](_0x54b7('0x22'),_0x42950a,_0x27ecf5[_0x54b7('0x26')][_0x54b7('0x28')]);return _0x5ba0a4(_0x27ecf5['error']['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x42950a,_0x54b7('0x23'));_0x5ba0a4(_0x27ecf5[_0x54b7('0x29')][_0x54b7('0x28')]);}})['catch'](function(_0x900dc7){logger[_0x54b7('0x26')](_0x54b7('0x22'),_0x42950a,_0x900dc7);_0x4fcd8a(_0x900dc7);});});}function respondWithStatusCode(_0x1f438c,_0x4b0c0b){_0x4b0c0b=_0x4b0c0b||0xcc;return function(_0x4ffea6){if(_0x4ffea6){return _0x1f438c[_0x54b7('0x2a')](_0x4b0c0b);}return _0x1f438c[_0x54b7('0x2b')](_0x4b0c0b)[_0x54b7('0x2c')]();};}function respondWithResult(_0x5375db,_0xd0b75a){_0xd0b75a=_0xd0b75a||0xc8;return function(_0x1c81d3){if(_0x1c81d3){return _0x5375db[_0x54b7('0x2b')](_0xd0b75a)[_0x54b7('0x2d')](_0x1c81d3);}};}function respondWithFilteredResult(_0x4b2e0d,_0x1702b4){return function(_0x6814b5){if(_0x6814b5){var _0x16e7c1=typeof _0x1702b4['offset']===_0x54b7('0x2e')&&typeof _0x1702b4['limit']===_0x54b7('0x2e');var _0xa531d9=_0x6814b5[_0x54b7('0x2f')];var _0x379142=_0x16e7c1?0x0:_0x1702b4[_0x54b7('0x30')];var _0x224b58=_0x16e7c1?_0x6814b5[_0x54b7('0x2f')]:_0x1702b4['offset']+_0x1702b4[_0x54b7('0x31')];var _0x2e3ca1;if(_0x224b58>=_0xa531d9){_0x224b58=_0xa531d9;_0x2e3ca1=0xc8;}else{_0x2e3ca1=0xce;}_0x4b2e0d[_0x54b7('0x2b')](_0x2e3ca1);return _0x4b2e0d[_0x54b7('0x32')]('Content-Range',_0x379142+'-'+_0x224b58+'/'+_0xa531d9)[_0x54b7('0x2d')](_0x6814b5);}return null;};}function patchUpdates(_0x2b2a49){return function(_0x1e7933){try{jsonpatch['apply'](_0x1e7933,_0x2b2a49,!![]);}catch(_0x192eef){return BPromise[_0x54b7('0x33')](_0x192eef);}return _0x1e7933['save']();};}function saveUpdates(_0x328190,_0x1eec60){return function(_0x56a9d3){if(_0x56a9d3){return _0x56a9d3['update'](_0x328190)[_0x54b7('0x20')](function(_0x3de573){return _0x3de573;});}return null;};}function removeEntity(_0x24ecf6,_0x1ab5a6){return function(_0xaa3d61){if(_0xaa3d61){return _0xaa3d61[_0x54b7('0x34')]()[_0x54b7('0x20')](function(){_0x24ecf6[_0x54b7('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x165b5a,_0x48b1f9){return function(_0x426771){if(!_0x426771){_0x165b5a[_0x54b7('0x2a')](0x194);}return _0x426771;};}function handleError(_0x57d683,_0x5ce4e0){_0x5ce4e0=_0x5ce4e0||0x1f4;return function(_0x25e9d3){logger[_0x54b7('0x26')](_0x25e9d3['stack']);if(_0x25e9d3[_0x54b7('0x35')]){delete _0x25e9d3[_0x54b7('0x35')];}_0x57d683[_0x54b7('0x2b')](_0x5ce4e0)[_0x54b7('0x36')](_0x25e9d3);};}exports[_0x54b7('0x37')]=function(_0x2dcb09,_0x589b6d){var _0x334030={},_0x5792dc={},_0x14f7ea={'count':0x0,'rows':[]};var _0x3f5cfd=_[_0x54b7('0x38')](db[_0x54b7('0x39')]['rawAttributes'],function(_0x47f42c){return{'name':_0x47f42c[_0x54b7('0x3a')],'type':_0x47f42c[_0x54b7('0x3b')]['key']};});_0x5792dc[_0x54b7('0x3c')]=_[_0x54b7('0x38')](_0x3f5cfd,_0x54b7('0x35'));_0x5792dc[_0x54b7('0x3d')]=_[_0x54b7('0x3e')](_0x2dcb09[_0x54b7('0x3d')]);_0x5792dc[_0x54b7('0x3f')]=_[_0x54b7('0x40')](_0x5792dc[_0x54b7('0x3c')],_0x5792dc[_0x54b7('0x3d')]);_0x334030[_0x54b7('0x41')]=_[_0x54b7('0x40')](_0x5792dc[_0x54b7('0x3c')],qs[_0x54b7('0x42')](_0x2dcb09[_0x54b7('0x3d')][_0x54b7('0x42')]));_0x334030[_0x54b7('0x41')]=_0x334030[_0x54b7('0x41')][_0x54b7('0x43')]?_0x334030['attributes']:_0x5792dc[_0x54b7('0x3c')];if(!_0x2dcb09[_0x54b7('0x3d')][_0x54b7('0x44')]('nolimit')){_0x334030[_0x54b7('0x31')]=qs['limit'](_0x2dcb09[_0x54b7('0x3d')][_0x54b7('0x31')]);_0x334030['offset']=qs[_0x54b7('0x30')](_0x2dcb09['query'][_0x54b7('0x30')]);}_0x334030[_0x54b7('0x45')]=qs[_0x54b7('0x46')](_0x2dcb09[_0x54b7('0x3d')]['sort']);_0x334030['where']=qs[_0x54b7('0x3f')](_[_0x54b7('0x47')](_0x2dcb09[_0x54b7('0x3d')],_0x5792dc[_0x54b7('0x3f')]),_0x3f5cfd);if(_0x2dcb09['query'][_0x54b7('0x48')]){_0x334030[_0x54b7('0x49')]=_[_0x54b7('0x4a')](_0x334030['where'],{'$or':_[_0x54b7('0x38')](_0x3f5cfd,function(_0x1e5715){if(_0x1e5715[_0x54b7('0x3b')]!==_0x54b7('0x4b')){var _0x2c00be={};_0x2c00be[_0x1e5715['name']]={'$like':'%'+_0x2dcb09[_0x54b7('0x3d')][_0x54b7('0x48')]+'%'};return _0x2c00be;}})});}_0x334030=_[_0x54b7('0x4a')]({},_0x334030,_0x2dcb09[_0x54b7('0x4c')]);var _0x18a959={'where':_0x334030['where']};return db[_0x54b7('0x39')]['count'](_0x18a959)['then'](function(_0x166c86){_0x14f7ea[_0x54b7('0x2f')]=_0x166c86;if(_0x2dcb09[_0x54b7('0x3d')][_0x54b7('0x4d')]){_0x334030[_0x54b7('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0x54b7('0x4f')](_0x334030);})['then'](function(_0x27068f){_0x14f7ea[_0x54b7('0x50')]=_0x27068f;return _0x14f7ea;})[_0x54b7('0x20')](respondWithFilteredResult(_0x589b6d,_0x334030))[_0x54b7('0x51')](handleError(_0x589b6d,null));};exports[_0x54b7('0x52')]=function(_0x2c2dca,_0x53cbf5){var _0xc27ac4={'raw':!![],'where':{'id':_0x2c2dca[_0x54b7('0x53')]['id']}},_0x2c7647={};_0x2c7647[_0x54b7('0x3c')]=_[_0x54b7('0x3e')](db['ChatMessage'][_0x54b7('0x54')]);_0x2c7647[_0x54b7('0x3d')]=_[_0x54b7('0x3e')](_0x2c2dca[_0x54b7('0x3d')]);_0x2c7647['filters']=_[_0x54b7('0x40')](_0x2c7647['model'],_0x2c7647[_0x54b7('0x3d')]);_0xc27ac4[_0x54b7('0x41')]=_[_0x54b7('0x40')](_0x2c7647[_0x54b7('0x3c')],qs[_0x54b7('0x42')](_0x2c2dca[_0x54b7('0x3d')][_0x54b7('0x42')]));_0xc27ac4[_0x54b7('0x41')]=_0xc27ac4['attributes'][_0x54b7('0x43')]?_0xc27ac4[_0x54b7('0x41')]:_0x2c7647[_0x54b7('0x3c')];if(_0x2c2dca[_0x54b7('0x3d')][_0x54b7('0x4d')]){_0xc27ac4[_0x54b7('0x4e')]=[{'all':!![]}];}_0xc27ac4=_[_0x54b7('0x4a')]({},_0xc27ac4,_0x2c2dca[_0x54b7('0x4c')]);return db[_0x54b7('0x39')][_0x54b7('0x55')](_0xc27ac4)[_0x54b7('0x20')](handleEntityNotFound(_0x53cbf5,null))['then'](respondWithResult(_0x53cbf5,null))[_0x54b7('0x51')](handleError(_0x53cbf5,null));};exports[_0x54b7('0x56')]=function(_0x1e66bb,_0x371208){return db[_0x54b7('0x39')]['create'](_0x1e66bb[_0x54b7('0x57')],{})[_0x54b7('0x20')](respondWithResult(_0x371208,0xc9))['catch'](handleError(_0x371208,null));};exports['update']=function(_0x1d25e7,_0x68e43d){if(_0x1d25e7[_0x54b7('0x57')]['id']){delete _0x1d25e7[_0x54b7('0x57')]['id'];}return db[_0x54b7('0x39')]['find']({'where':{'id':_0x1d25e7[_0x54b7('0x53')]['id']}})['then'](handleEntityNotFound(_0x68e43d,null))[_0x54b7('0x20')](saveUpdates(_0x1d25e7['body'],null))[_0x54b7('0x20')](respondWithResult(_0x68e43d,null))[_0x54b7('0x51')](handleError(_0x68e43d,null));};exports[_0x54b7('0x34')]=function(_0x3083df,_0x4c3021){return db[_0x54b7('0x39')][_0x54b7('0x55')]({'where':{'id':_0x3083df[_0x54b7('0x53')]['id']}})[_0x54b7('0x20')](handleEntityNotFound(_0x4c3021,null))[_0x54b7('0x20')](removeEntity(_0x4c3021,null))[_0x54b7('0x51')](handleError(_0x4c3021,null));};exports[_0x54b7('0x58')]=function(_0x4b0045,_0x196c32){return db[_0x54b7('0x39')][_0x54b7('0x58')]()['then'](respondWithResult(_0x196c32,null))[_0x54b7('0x51')](handleError(_0x196c32,null));};var interaction_log=require(_0x54b7('0x59'))(_0x54b7('0x5a'));exports['accept']=function(_0x26d1cc,_0x1cc33d,_0x5aea1c){var _0x3d7a3b={'agent':{},'channel':_0x54b7('0x5b')};if(_0x26d1cc[_0x54b7('0x57')]['id']){delete _0x26d1cc['body']['id'];}_0x26d1cc[_0x54b7('0x57')][_0x54b7('0x5c')]=!![];_0x26d1cc['body'][_0x54b7('0x5d')]=moment()['format'](_0x54b7('0x5e'));_0x26d1cc[_0x54b7('0x57')][_0x54b7('0x5f')]=_0x26d1cc[_0x54b7('0x57')][_0x54b7('0x5f')]||_0x26d1cc['user']['id'];_0x3d7a3b['agent']['id']=_0x26d1cc[_0x54b7('0x57')][_0x54b7('0x5f')];return db['ChatMessage'][_0x54b7('0x55')]({'where':{'id':_0x26d1cc[_0x54b7('0x53')]['id'],'UserId':null}})[_0x54b7('0x20')](handleEntityNotFound(_0x1cc33d,null))['then'](saveUpdates(_0x26d1cc[_0x54b7('0x57')],null))[_0x54b7('0x20')](function(_0x16e257){if(_0x16e257){_0x3d7a3b['message']=_0x16e257[_0x54b7('0x60')]({'plain':!![]});return db[_0x54b7('0x61')][_0x54b7('0x55')]({'where':{'id':_0x16e257[_0x54b7('0x62')]}});}return null;})[_0x54b7('0x20')](handleEntityNotFound(_0x1cc33d,null))[_0x54b7('0x20')](function(_0x29e5ef){if(_0x29e5ef){return _0x29e5ef[_0x54b7('0x63')]({'UserId':_0x26d1cc[_0x54b7('0x57')]['UserId'],'read1stAt':_[_0x54b7('0x64')](_0x29e5ef['read1stAt'])?moment()[_0x54b7('0x65')](_0x54b7('0x5e')):undefined});}return null;})['then'](function(_0x596604){if(_0x596604){_0x3d7a3b[_0x54b7('0x66')]=_0x596604[_0x54b7('0x60')]({'plain':!![]});interaction_log['info'](_0x54b7('0x67'),_0x26d1cc[_0x54b7('0x68')]['id'],_0x26d1cc[_0x54b7('0x68')][_0x54b7('0x35')],_0x26d1cc[_0x54b7('0x68')][_0x54b7('0x69')],_0x3d7a3b[_0x54b7('0x66')]['id'],_0x26d1cc[_0x54b7('0x57')]?JSON[_0x54b7('0x25')](_0x26d1cc[_0x54b7('0x57')]):'null');return respondWithRpcPromise(_0x54b7('0x6a'),_0x54b7('0x6b'),_0x3d7a3b);}return null;})[_0x54b7('0x20')](function(_0x2d1706){var _0x576aa5=_0x54b7('0x6c')+_0x2d1706[_0x54b7('0x28')]['ContactId'];return db[_0x54b7('0x6d')]['query'](_0x576aa5,{'type':db[_0x54b7('0x6e')][_0x54b7('0x6f')][_0x54b7('0x70')],'raw':!![]})[_0x54b7('0x20')](function(_0x52f44d){return _0x52f44d;});})['then'](function(_0x1eabb3){if(_0x1eabb3){_0x3d7a3b['message'][_0x54b7('0x71')]=_0x1eabb3[0x0];if(!_0x26d1cc[_0x54b7('0x57')][_0x54b7('0x5f')])return;return db[_0x54b7('0x72')][_0x54b7('0x55')]({'where':{'id':_0x26d1cc['body'][_0x54b7('0x5f')],'role':'agent'},'attributes':['id','name',_0x54b7('0x73'),'email',_0x54b7('0x74')],'raw':!![]});}return null;})[_0x54b7('0x20')](function(_0x4d6a89){if(!_0x4d6a89)return null;_0x3d7a3b[_0x54b7('0x28')]['agent']=_0x4d6a89;return _0x3d7a3b;})['then'](function(_0x70c9cc){if(_0x70c9cc){if(_0x26d1cc[_0x54b7('0x57')]['manual']){_0x3d7a3b[_0x54b7('0x28')]['interface']=util[_0x54b7('0x65')](_0x54b7('0x75'),_0x26d1cc[_0x54b7('0x68')][_0x54b7('0x35')]);_0x3d7a3b['message'][_0x54b7('0x76')]=_0x3d7a3b['channel'];_0x3d7a3b[_0x54b7('0x28')][_0x54b7('0x77')]=_0x3d7a3b[_0x54b7('0x76')];_0x3d7a3b[_0x54b7('0x28')][_0x54b7('0x78')]=_0x54b7('0x79');return respondWithRpcPromise(_0x54b7('0x7a'),_0x54b7('0x7a'),{'event':_0x54b7('0x7b'),'message':_['merge'](_0x3d7a3b[_0x54b7('0x28')],JSON[_0x54b7('0x7c')](_0x3d7a3b['interaction'][_0x54b7('0x7d')]))},client9002)[_0x54b7('0x20')](function(){return _0x3d7a3b;});}return _0x3d7a3b;}return null;})[_0x54b7('0x20')](respondWithResult(_0x1cc33d,null))['catch'](handleError(_0x1cc33d,null));};var interaction_log=require(_0x54b7('0x59'))('chat-interactions');exports['reject']=function(_0x47deb6,_0x25005d,_0x40ded3){var _0x50a26f={'agent':{},'channel':'chat'};if(_0x47deb6[_0x54b7('0x57')]['id']){delete _0x47deb6[_0x54b7('0x57')]['id'];}_0x47deb6[_0x54b7('0x57')]['UserId']=_0x47deb6[_0x54b7('0x57')][_0x54b7('0x5f')]||_0x47deb6['user']['id'];_0x50a26f[_0x54b7('0x7e')]['id']=_0x47deb6['body']['UserId'];return db['ChatMessage'][_0x54b7('0x55')]({'where':{'id':_0x47deb6[_0x54b7('0x53')]['id'],'UserId':null}})[_0x54b7('0x20')](handleEntityNotFound(_0x25005d,null))[_0x54b7('0x20')](function(_0x32d744){if(_0x32d744){_0x50a26f['message']=_0x32d744[_0x54b7('0x60')]({'plain':!![]});return db[_0x54b7('0x61')][_0x54b7('0x55')]({'where':{'id':_0x32d744[_0x54b7('0x62')]}});}return null;})[_0x54b7('0x20')](handleEntityNotFound(_0x25005d,null))[_0x54b7('0x20')](function(_0x3929ee){if(_0x3929ee){_0x50a26f[_0x54b7('0x66')]=_0x3929ee[_0x54b7('0x60')]({'plain':!![]});interaction_log[_0x54b7('0x21')](_0x54b7('0x7f'),_0x47deb6[_0x54b7('0x68')]['id'],_0x47deb6[_0x54b7('0x68')][_0x54b7('0x35')],_0x47deb6[_0x54b7('0x68')]['role'],_0x50a26f[_0x54b7('0x66')]['id'],_0x47deb6['body']?JSON['stringify'](_0x47deb6[_0x54b7('0x57')]):_0x54b7('0x80'));return respondWithRpcPromise('RejectMessage',_0x54b7('0x81'),_0x50a26f);}return null;})[_0x54b7('0x20')](function(_0x2d1657){var _0x4e32d=_0x54b7('0x6c')+_0x2d1657[_0x54b7('0x28')][_0x54b7('0x82')];return db['sequelize'][_0x54b7('0x3d')](_0x4e32d,{'type':db['Sequelize'][_0x54b7('0x6f')][_0x54b7('0x70')],'raw':!![]})['then'](function(_0x653478){return _0x653478;});})[_0x54b7('0x20')](function(_0x3550ef){if(_0x3550ef){_0x50a26f['message'][_0x54b7('0x71')]=_0x3550ef[0x0];if(!_0x47deb6['body']['UserId'])return;return db['User'][_0x54b7('0x55')]({'where':{'id':_0x47deb6['body'][_0x54b7('0x5f')],'role':'agent'},'attributes':['id','name',_0x54b7('0x73'),'email',_0x54b7('0x74')],'raw':!![]});}return null;})[_0x54b7('0x20')](function(_0x3b1882){if(!_0x3b1882)return null;_0x50a26f[_0x54b7('0x28')][_0x54b7('0x7e')]=_0x3b1882;return _0x50a26f;})[_0x54b7('0x20')](function(_0x1d35b1){if(_0x1d35b1){_0x1d35b1[_0x54b7('0x28')][_0x54b7('0x83')]=util[_0x54b7('0x65')](_0x54b7('0x75'),_0x47deb6[_0x54b7('0x68')][_0x54b7('0x35')]);_0x1d35b1[_0x54b7('0x28')][_0x54b7('0x76')]=_0x50a26f[_0x54b7('0x76')];_0x1d35b1[_0x54b7('0x28')][_0x54b7('0x77')]=_0x50a26f[_0x54b7('0x76')];_0x1d35b1[_0x54b7('0x28')][_0x54b7('0x78')]='reject';respondWithRpcPromise(_0x54b7('0x7a'),_0x54b7('0x7a'),{'event':_0x54b7('0x84'),'message':_['merge'](_0x50a26f[_0x54b7('0x28')],JSON[_0x54b7('0x7c')](_0x50a26f[_0x54b7('0x66')][_0x54b7('0x7d')]))},client9002);return _0x50a26f;}return null;})[_0x54b7('0x20')](respondWithResult(_0x25005d,null))[_0x54b7('0x51')](handleError(_0x25005d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 42c77aa..e9cc7fc 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 _0x6bd2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x6bd2,0x12e));var _0x26bd=function(_0x382b7a,_0x373cdf){_0x382b7a=_0x382b7a-0x0;var _0x4db5f0=_0x6bd2[_0x382b7a];return _0x4db5f0;};'use strict';var EventEmitter=require(_0x26bd('0x0'));var ChatMessage=require(_0x26bd('0x1'))['db'][_0x26bd('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x26bd('0x3')](0x0);var events={'afterCreate':_0x26bd('0x4'),'afterUpdate':_0x26bd('0x5'),'afterDestroy':_0x26bd('0x6')};function emitEvent(_0x4d1052){return function(_0x1ae9a7,_0x16d58c,_0x445c39){ChatMessageEvents['emit'](_0x4d1052+':'+_0x1ae9a7['id'],_0x1ae9a7);ChatMessageEvents[_0x26bd('0x7')](_0x4d1052,_0x1ae9a7);_0x445c39(null);};}for(var e in events){if(events[_0x26bd('0x8')](e)){var event=events[e];ChatMessage[_0x26bd('0x9')](e,emitEvent(event));}}module[_0x26bd('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0x142f=['ChatMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x6bd5d8,_0x53cf31){var _0x7863e7=function(_0x1345d8){while(--_0x1345d8){_0x6bd5d8['push'](_0x6bd5d8['shift']());}};_0x7863e7(++_0x53cf31);}(_0x142f,0x17a));var _0xf142=function(_0x2b0c2e,_0x586346){_0x2b0c2e=_0x2b0c2e-0x0;var _0xd6c0aa=_0x142f[_0x2b0c2e];return _0xd6c0aa;};'use strict';var EventEmitter=require(_0xf142('0x0'));var ChatMessage=require(_0xf142('0x1'))['db'][_0xf142('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf142('0x3'),'afterUpdate':_0xf142('0x4'),'afterDestroy':_0xf142('0x5')};function emitEvent(_0x45e3cd){return function(_0x58bae6,_0x51b149,_0x208213){ChatMessageEvents[_0xf142('0x6')](_0x45e3cd+':'+_0x58bae6['id'],_0x58bae6);ChatMessageEvents[_0xf142('0x6')](_0x45e3cd,_0x58bae6);_0x208213(null);};}for(var e in events){if(events[_0xf142('0x7')](e)){var event=events[e];ChatMessage[_0xf142('0x8')](e,emitEvent(event));}}module[_0xf142('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 728a64f..2131605 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 _0x2054=['findOne','ChatInteractionId','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x2054,0x176));var _0x4205=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0x2054[_0x3f993e];return _0x39c135;};'use strict';var _=require(_0x4205('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4205('0x1'));var BPromise=require(_0x4205('0x2'));var rp=require(_0x4205('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4205('0x4'));module[_0x4205('0x5')]=function(_0x2db8ab,_0x29e1c2){return _0x2db8ab['define'](_0x4205('0x6'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x4205('0x7'),'fields':[_0x4205('0x8')],'type':_0x4205('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1eef24,_0x463385,_0x3ab22b){var _0x10260c=_0x2db8ab[_0x4205('0xa')];var _0x3310bc=_0x1eef24[_0x4205('0xb')]({'plain':!![]});if(_0x3310bc[_0x4205('0xc')][_0x4205('0xd')]()==='in'||_0x3310bc['direction']['toLowerCase']()===_0x4205('0xe')&&!_0x3310bc[_0x4205('0xf')]&&!_['isNil'](_0x3310bc[_0x4205('0x10')])){_0x10260c['ChatInteraction'][_0x4205('0x11')]({'where':{'id':_0x3310bc[_0x4205('0x12')]}})['then'](function(_0xcc2fa1){if(_0xcc2fa1){_0xcc2fa1[_0x4205('0x13')]({'lastMsgAt':_0x3310bc['createdAt'],'lastMsgDirection':_0x3310bc['direction'][_0x4205('0xd')]()});}})['catch'](function(_0x2ef7dd){console[_0x4205('0x14')](_0x2ef7dd);});}_0x3ab22b();}},'charset':_0x4205('0x15'),'collate':_0x4205('0x16')});}; \ No newline at end of file +var _0xfd9e=['ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId'];(function(_0x2646f6,_0x287adf){var _0x577237=function(_0x4d2d6f){while(--_0x4d2d6f){_0x2646f6['push'](_0x2646f6['shift']());}};_0x577237(++_0x287adf);}(_0xfd9e,0x15d));var _0xefd9=function(_0x3ba0af,_0xccb8a1){_0x3ba0af=_0x3ba0af-0x0;var _0x650db7=_0xfd9e[_0x3ba0af];return _0x650db7;};'use strict';var _=require(_0xefd9('0x0'));var util=require(_0xefd9('0x1'));var logger=require('../../config/logger')(_0xefd9('0x2'));var moment=require(_0xefd9('0x3'));var BPromise=require(_0xefd9('0x4'));var rp=require(_0xefd9('0x5'));var fs=require('fs');var path=require(_0xefd9('0x6'));var rimraf=require(_0xefd9('0x7'));var config=require(_0xefd9('0x8'));var attributes=require(_0xefd9('0x9'));module[_0xefd9('0xa')]=function(_0x4470b8,_0x5e1557){return _0x4470b8[_0xefd9('0xb')](_0xefd9('0xc'),attributes,{'tableName':_0xefd9('0xd'),'paranoid':![],'indexes':[{'name':_0xefd9('0xe'),'fields':[_0xefd9('0xf')],'type':_0xefd9('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bee04,_0x4e5112,_0x58d49d){var _0x352f74=_0x4470b8[_0xefd9('0x11')];var _0x31a4f8=_0x2bee04['get']({'plain':!![]});if(_0x31a4f8[_0xefd9('0x12')][_0xefd9('0x13')]()==='in'||_0x31a4f8[_0xefd9('0x12')][_0xefd9('0x13')]()===_0xefd9('0x14')&&!_0x31a4f8[_0xefd9('0x15')]&&!_['isNil'](_0x31a4f8[_0xefd9('0x16')])){_0x352f74[_0xefd9('0x17')][_0xefd9('0x18')]({'where':{'id':_0x31a4f8[_0xefd9('0x19')]}})[_0xefd9('0x1a')](function(_0x5973a8){if(_0x5973a8){_0x5973a8[_0xefd9('0x1b')]({'lastMsgAt':_0x31a4f8[_0xefd9('0x1c')],'lastMsgDirection':_0x31a4f8[_0xefd9('0x12')]['toLowerCase']()});}})['catch'](function(_0x28a2f9){console['error'](_0x28a2f9);});}_0x58d49d();}},'charset':_0xefd9('0x1d'),'collate':_0xefd9('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c01de55..5f341db 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 _0xfac6=['code','message','catch','ChatMessage','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x148acb,_0x2694f7){var _0x3b9378=function(_0x5bb255){while(--_0x5bb255){_0x148acb['push'](_0x148acb['shift']());}};_0x3b9378(++_0x2694f7);}(_0xfac6,0xef));var _0x6fac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfac6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6fac('0x0'));var util=require(_0x6fac('0x1'));var moment=require(_0x6fac('0x2'));var BPromise=require(_0x6fac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6fac('0x4'));var db=require(_0x6fac('0x5'))['db'];var utils=require(_0x6fac('0x6'));var logger=require('../../config/logger')(_0x6fac('0x7'));var config=require(_0x6fac('0x8'));var jayson=require(_0x6fac('0x9'));var client=jayson['client'][_0x6fac('0xa')]({'port':0x232a});config[_0x6fac('0xb')]=_[_0x6fac('0xc')](config[_0x6fac('0xb')],{'host':_0x6fac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6fac('0xb')]));require(_0x6fac('0xe'))[_0x6fac('0xf')](socket);function respondWithRpcPromise(_0x209020,_0xfb8d3a,_0x2a906d){return new BPromise(function(_0x1be0fa,_0x3b3cdd){return client[_0x6fac('0x10')](_0x209020,_0x2a906d)[_0x6fac('0x11')](function(_0x628baf){logger[_0x6fac('0x12')](_0x6fac('0x13'),_0xfb8d3a,_0x6fac('0x14'));logger[_0x6fac('0x15')](_0x6fac('0x16'),_0xfb8d3a,_0x6fac('0x14'),JSON[_0x6fac('0x17')](_0x628baf));if(_0x628baf[_0x6fac('0x18')]){if(_0x628baf[_0x6fac('0x18')][_0x6fac('0x19')]===0x1f4){logger[_0x6fac('0x18')](_0x6fac('0x13'),_0xfb8d3a,_0x628baf['error'][_0x6fac('0x1a')]);return _0x3b3cdd(_0x628baf[_0x6fac('0x18')][_0x6fac('0x1a')]);}logger[_0x6fac('0x18')](_0x6fac('0x13'),_0xfb8d3a,_0x628baf['error'][_0x6fac('0x1a')]);return _0x1be0fa(_0x628baf[_0x6fac('0x18')]['message']);}else{logger['info'](_0x6fac('0x13'),_0xfb8d3a,_0x6fac('0x14'));_0x1be0fa(_0x628baf['result'][_0x6fac('0x1a')]);}})[_0x6fac('0x1b')](function(_0x13d4ce){logger[_0x6fac('0x18')](_0x6fac('0x13'),_0xfb8d3a,_0x13d4ce);_0x3b3cdd(_0x13d4ce);});});}exports['CreateChatMessage']=function(_0x56c890){var _0x4fa4cb=this;return new Promise(function(_0x4b751a,_0x51ed9f){return db[_0x6fac('0x1c')]['create'](_0x56c890[_0x6fac('0x1d')],{'raw':_0x56c890['options']?_0x56c890[_0x6fac('0x1e')][_0x6fac('0x1f')]===undefined?!![]:![]:!![]})[_0x6fac('0x11')](function(_0x1ae833){logger[_0x6fac('0x12')]('CreateChatMessage',_0x56c890);logger['debug'](_0x6fac('0x20'),_0x56c890,JSON['stringify'](_0x1ae833));_0x4b751a(_0x1ae833);})[_0x6fac('0x1b')](function(_0x234575){logger[_0x6fac('0x18')](_0x6fac('0x20'),_0x234575[_0x6fac('0x1a')],_0x56c890);_0x51ed9f(_0x4fa4cb[_0x6fac('0x18')](0x1f4,_0x234575[_0x6fac('0x1a')]));});});}; \ No newline at end of file +var _0x2b4d=['./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatMessage','create','body','options','raw','info','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x499a43,_0x3cbee7){var _0x4e607e=function(_0xd7f146){while(--_0xd7f146){_0x499a43['push'](_0x499a43['shift']());}};_0x4e607e(++_0x3cbee7);}(_0x2b4d,0xfa));var _0xd2b4=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x2b4d[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0xd2b4('0x0'));var util=require(_0xd2b4('0x1'));var moment=require(_0xd2b4('0x2'));var BPromise=require(_0xd2b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd2b4('0x5'))(_0xd2b4('0x6'));var config=require(_0xd2b4('0x7'));var jayson=require(_0xd2b4('0x8'));var client=jayson[_0xd2b4('0x9')]['http']({'port':0x232a});config[_0xd2b4('0xa')]=_[_0xd2b4('0xb')](config[_0xd2b4('0xa')],{'host':_0xd2b4('0xc'),'port':0x18eb});var socket=require(_0xd2b4('0xd'))(new Redis(config[_0xd2b4('0xa')]));require(_0xd2b4('0xe'))[_0xd2b4('0xf')](socket);function respondWithRpcPromise(_0x3e256c,_0x266b4e,_0x141238){return new BPromise(function(_0xf38b,_0x302902){return client[_0xd2b4('0x10')](_0x3e256c,_0x141238)[_0xd2b4('0x11')](function(_0x44aad2){logger['info'](_0xd2b4('0x12'),_0x266b4e,_0xd2b4('0x13'));logger[_0xd2b4('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x266b4e,_0xd2b4('0x13'),JSON[_0xd2b4('0x15')](_0x44aad2));if(_0x44aad2[_0xd2b4('0x16')]){if(_0x44aad2[_0xd2b4('0x16')][_0xd2b4('0x17')]===0x1f4){logger[_0xd2b4('0x16')](_0xd2b4('0x12'),_0x266b4e,_0x44aad2[_0xd2b4('0x16')][_0xd2b4('0x18')]);return _0x302902(_0x44aad2['error'][_0xd2b4('0x18')]);}logger['error'](_0xd2b4('0x12'),_0x266b4e,_0x44aad2[_0xd2b4('0x16')][_0xd2b4('0x18')]);return _0xf38b(_0x44aad2[_0xd2b4('0x16')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x266b4e,_0xd2b4('0x13'));_0xf38b(_0x44aad2[_0xd2b4('0x19')][_0xd2b4('0x18')]);}})[_0xd2b4('0x1a')](function(_0x5dd666){logger[_0xd2b4('0x16')](_0xd2b4('0x12'),_0x266b4e,_0x5dd666);_0x302902(_0x5dd666);});});}exports[_0xd2b4('0x1b')]=function(_0x2499bd){var _0x43a18d=this;return new Promise(function(_0x2a71ba,_0x1927a8){return db['ChatMessage'][_0xd2b4('0x1c')](_0x2499bd[_0xd2b4('0x1d')],{'raw':_0x2499bd[_0xd2b4('0x1e')]?_0x2499bd[_0xd2b4('0x1e')][_0xd2b4('0x1f')]===undefined?!![]:![]:!![]})[_0xd2b4('0x11')](function(_0x689c31){logger[_0xd2b4('0x20')](_0xd2b4('0x1b'),_0x2499bd);logger[_0xd2b4('0x14')](_0xd2b4('0x1b'),_0x2499bd,JSON[_0xd2b4('0x15')](_0x689c31));_0x2a71ba(_0x689c31);})[_0xd2b4('0x1a')](function(_0x3123d1){logger['error'](_0xd2b4('0x1b'),_0x3123d1[_0xd2b4('0x18')],_0x2499bd);_0x1927a8(_0x43a18d['error'](0x1f4,_0x3123d1[_0xd2b4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a2574af..0b14faa 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 _0xf006=['register','chatMessage:','remove','update','emit','removeListener'];(function(_0x196939,_0x291748){var _0x3fff3c=function(_0x4e7504){while(--_0x4e7504){_0x196939['push'](_0x196939['shift']());}};_0x3fff3c(++_0x291748);}(_0xf006,0x146));var _0x6f00=function(_0x4467c2,_0x9b2183){_0x4467c2=_0x4467c2-0x0;var _0xb79418=_0xf006[_0x4467c2];return _0xb79418;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x6f00('0x0'),_0x6f00('0x1')];function createListener(_0x5914f3,_0xbab575){return function(_0x4e9dbc){_0xbab575[_0x6f00('0x2')](_0x5914f3,_0x4e9dbc);};}function removeListener(_0x4f4466,_0x5039fb){return function(){ChatMessageEvents[_0x6f00('0x3')](_0x4f4466,_0x5039fb);};}exports[_0x6f00('0x4')]=function(_0x141e71){for(var _0x52c9a2=0x0,_0x3c29ff=events['length'];_0x52c9a2<_0x3c29ff;_0x52c9a2++){var _0x3875fb=events[_0x52c9a2];var _0x3001b1=createListener(_0x6f00('0x5')+_0x3875fb,_0x141e71);ChatMessageEvents['on'](_0x3875fb,_0x3001b1);}}; \ No newline at end of file +var _0x0ec6=['register','chatMessage:','./chatMessage.events','update','emit'];(function(_0x398a1a,_0x565533){var _0xc43fd2=function(_0x5938d1){while(--_0x5938d1){_0x398a1a['push'](_0x398a1a['shift']());}};_0xc43fd2(++_0x565533);}(_0x0ec6,0x1f1));var _0x60ec=function(_0xcfea9e,_0x529203){_0xcfea9e=_0xcfea9e-0x0;var _0xd8683e=_0x0ec6[_0xcfea9e];return _0xd8683e;};'use strict';var ChatMessageEvents=require(_0x60ec('0x0'));var events=['save','remove',_0x60ec('0x1')];function createListener(_0x21264a,_0x2ee4a3){return function(_0x13a3a5){_0x2ee4a3[_0x60ec('0x2')](_0x21264a,_0x13a3a5);};}function removeListener(_0x262ed6,_0x392a91){return function(){ChatMessageEvents['removeListener'](_0x262ed6,_0x392a91);};}exports[_0x60ec('0x3')]=function(_0xb4a258){for(var _0x1d8fb5=0x0,_0x74adc4=events['length'];_0x1d8fb5<_0x74adc4;_0x1d8fb5++){var _0xcb974c=events[_0x1d8fb5];var _0x488ab8=createListener(_0x60ec('0x4')+_0xcb974c,_0xb4a258);ChatMessageEvents['on'](_0xcb974c,_0x488ab8);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 20a08b6..9809b45 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 _0xc82c=['isAuthenticated','/describe','describe','/:id','post','tracked','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get'];(function(_0x32f649,_0x4ccb75){var _0x5009ff=function(_0x3d4d1a){while(--_0x3d4d1a){_0x32f649['push'](_0x32f649['shift']());}};_0x5009ff(++_0x4ccb75);}(_0xc82c,0x75));var _0xcc82=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc82c[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0xcc82('0x0'));var util=require(_0xcc82('0x1'));var path=require(_0xcc82('0x2'));var timeout=require(_0xcc82('0x3'));var express=require('express');var router=express[_0xcc82('0x4')]();var fs_extra=require(_0xcc82('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc82('0x6'));var controller=require('./chatMessage.controller');router[_0xcc82('0x7')]('/',auth[_0xcc82('0x8')](),controller['index']);router['get'](_0xcc82('0x9'),auth[_0xcc82('0x8')](),controller[_0xcc82('0xa')]);router['get'](_0xcc82('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xcc82('0xc')]('/',auth[_0xcc82('0x8')](),interaction[_0xcc82('0xd')]('chat',_0xcc82('0xe')),controller[_0xcc82('0xf')]);router[_0xcc82('0x10')](_0xcc82('0xb'),controller[_0xcc82('0x11')]);router['put'](_0xcc82('0x12'),auth['isAuthenticated'](),controller[_0xcc82('0x13')]);router[_0xcc82('0x10')](_0xcc82('0x14'),auth[_0xcc82('0x8')](),controller[_0xcc82('0x15')]);router[_0xcc82('0x16')](_0xcc82('0xb'),auth['isAuthenticated'](),controller[_0xcc82('0x17')]);module[_0xcc82('0x18')]=router; \ No newline at end of file +var _0xfa15=['tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1d7423,_0x23da50){var _0x455b84=function(_0x19b098){while(--_0x19b098){_0x1d7423['push'](_0x1d7423['shift']());}};_0x455b84(++_0x23da50);}(_0xfa15,0x132));var _0x5fa1=function(_0x7fadd5,_0x1a0bce){_0x7fadd5=_0x7fadd5-0x0;var _0x54916c=_0xfa15[_0x7fadd5];return _0x54916c;};'use strict';var multer=require(_0x5fa1('0x0'));var util=require(_0x5fa1('0x1'));var path=require(_0x5fa1('0x2'));var timeout=require('connect-timeout');var express=require(_0x5fa1('0x3'));var router=express[_0x5fa1('0x4')]();var fs_extra=require(_0x5fa1('0x5'));var auth=require(_0x5fa1('0x6'));var interaction=require(_0x5fa1('0x7'));var config=require(_0x5fa1('0x8'));var controller=require(_0x5fa1('0x9'));router[_0x5fa1('0xa')]('/',auth[_0x5fa1('0xb')](),controller[_0x5fa1('0xc')]);router[_0x5fa1('0xa')](_0x5fa1('0xd'),auth[_0x5fa1('0xb')](),controller[_0x5fa1('0xe')]);router[_0x5fa1('0xa')](_0x5fa1('0xf'),auth[_0x5fa1('0xb')](),controller[_0x5fa1('0x10')]);router[_0x5fa1('0x11')]('/',auth['isAuthenticated'](),interaction[_0x5fa1('0x12')](_0x5fa1('0x13'),_0x5fa1('0x14')),controller['create']);router[_0x5fa1('0x15')](_0x5fa1('0xf'),controller[_0x5fa1('0x16')]);router[_0x5fa1('0x15')](_0x5fa1('0x17'),auth['isAuthenticated'](),controller[_0x5fa1('0x18')]);router[_0x5fa1('0x15')](_0x5fa1('0x19'),auth[_0x5fa1('0xb')](),controller[_0x5fa1('0x1a')]);router['delete'](_0x5fa1('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 597b660..386a3b8 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['medium','exports','TEXT'];(function(_0x27fb22,_0xab9f66){var _0x2046fc=function(_0x1a692c){while(--_0x1a692c){_0x27fb22['push'](_0x27fb22['shift']());}};_0x2046fc(++_0xab9f66);}(_0x2032,0xd9));var _0x2203=function(_0x102cdf,_0x5b4ccc){_0x102cdf=_0x102cdf-0x0;var _0x300a44=_0x2032[_0x102cdf];return _0x300a44;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x2b04dd,_0xa39e7){var _0xf67a99=function(_0x14f7d8){while(--_0x14f7d8){_0x2b04dd['push'](_0x2b04dd['shift']());}};_0xf67a99(++_0xa39e7);}(_0x2032,0xd9));var _0x2203=function(_0x3bc95c,_0xab3023){_0x3bc95c=_0x3bc95c-0x0;var _0x36ff6b=_0x2032[_0x3bc95c];return _0x36ff6b;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index f7e92e4..f982fdf 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7a54,0x106));var _0x47a5=function(_0x4e3c4b,_0x5e4fc4){_0x4e3c4b=_0x4e3c4b-0x0;var _0xe3b56d=_0x7a54[_0x4e3c4b];return _0xe3b56d;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2f35d3,_0xf89dd9){var _0xe52a40=function(_0x399c89){while(--_0x399c89){_0x2f35d3['push'](_0x2f35d3['shift']());}};_0xe52a40(++_0xf89dd9);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 438f528..8657822 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 _0xcc66=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x47f762,_0x106ece){var _0x4d2585=function(_0x4de06b){while(--_0x4de06b){_0x47f762['push'](_0x47f762['shift']());}};_0x4d2585(++_0x106ece);}(_0xcc66,0x1f4));var _0x6cc6=function(_0x3200ea,_0x4fb38c){_0x3200ea=_0x3200ea-0x0;var _0x4b0858=_0xcc66[_0x3200ea];return _0x4b0858;};'use strict';var EventEmitter=require(_0x6cc6('0x0'));var ChatOfflineMessage=require(_0x6cc6('0x1'))['db'][_0x6cc6('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x6cc6('0x3')](0x0);var events={'afterCreate':_0x6cc6('0x4'),'afterUpdate':_0x6cc6('0x5'),'afterDestroy':_0x6cc6('0x6')};function emitEvent(_0x2afeeb){return function(_0x4828a4,_0x5187b8,_0x1a7fc9){ChatOfflineMessageEvents[_0x6cc6('0x7')](_0x2afeeb+':'+_0x4828a4['id'],_0x4828a4);ChatOfflineMessageEvents[_0x6cc6('0x7')](_0x2afeeb,_0x4828a4);_0x1a7fc9(null);};}for(var e in events){if(events[_0x6cc6('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x6cc6('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x5fa1=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x50ebdc,_0xa97455){var _0x135f61=function(_0x3f3436){while(--_0x3f3436){_0x50ebdc['push'](_0x50ebdc['shift']());}};_0x135f61(++_0xa97455);}(_0x5fa1,0xd2));var _0x15fa=function(_0xcb05d3,_0x22fe14){_0xcb05d3=_0xcb05d3-0x0;var _0x5078f7=_0x5fa1[_0xcb05d3];return _0x5078f7;};'use strict';var EventEmitter=require(_0x15fa('0x0'));var ChatOfflineMessage=require(_0x15fa('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x15fa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x15fa('0x3'),'afterDestroy':_0x15fa('0x4')};function emitEvent(_0x3a4b63){return function(_0x5df7b3,_0x5e7c3e,_0x435d84){ChatOfflineMessageEvents[_0x15fa('0x5')](_0x3a4b63+':'+_0x5df7b3['id'],_0x5df7b3);ChatOfflineMessageEvents[_0x15fa('0x5')](_0x3a4b63,_0x5df7b3);_0x435d84(null);};}for(var e in events){if(events[_0x15fa('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x15fa('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index d019f14..38a7c79 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 _0x2564=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x2564,0x1ee));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x4256('0x0'));module[_0x4256('0x1')]=function(_0x289b22){return _0x289b22[_0x4256('0x2')](_0x4256('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4256('0x4'),'collate':_0x4256('0x5')});}; \ No newline at end of file +var _0x765f=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x765f,0x181));var _0xf765=function(_0xf6cbf7,_0x5ebaca){_0xf6cbf7=_0xf6cbf7-0x0;var _0x2453b1=_0x765f[_0xf6cbf7];return _0x2453b1;};'use strict';var attributes=require(_0xf765('0x0'));module[_0xf765('0x1')]=function(_0x5ba2ba){return _0x5ba2ba[_0xf765('0x2')](_0xf765('0x3'),attributes,{'tableName':_0xf765('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf765('0x5'),'collate':_0xf765('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ac8c448..523e5a0 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 _0xfb0b=['then','info','request\x20sent','debug','stringify','error','code','message','ChatOfflineMessage,\x20%s,\x20%s','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x55804a,_0x4e3dbe){var _0x1150c8=function(_0x296043){while(--_0x296043){_0x55804a['push'](_0x55804a['shift']());}};_0x1150c8(++_0x4e3dbe);}(_0xfb0b,0x1d8));var _0xbfb0=function(_0x216dc9,_0x385e89){_0x216dc9=_0x216dc9-0x0;var _0x51f0c3=_0xfb0b[_0x216dc9];return _0x51f0c3;};'use strict';var _=require(_0xbfb0('0x0'));var util=require('util');var moment=require(_0xbfb0('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x2'));var fs=require('fs');var Redis=require(_0xbfb0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfb0('0x4'));var logger=require(_0xbfb0('0x5'))('rpc');var config=require(_0xbfb0('0x6'));var jayson=require(_0xbfb0('0x7'));var client=jayson[_0xbfb0('0x8')][_0xbfb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x224c2a,_0x527964,_0x3e15e5){return new BPromise(function(_0x573298,_0xdd2f1a){return client[_0xbfb0('0xa')](_0x224c2a,_0x3e15e5)[_0xbfb0('0xb')](function(_0x3d318d){logger[_0xbfb0('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x527964,_0xbfb0('0xd'));logger[_0xbfb0('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x527964,_0xbfb0('0xd'),JSON[_0xbfb0('0xf')](_0x3d318d));if(_0x3d318d[_0xbfb0('0x10')]){if(_0x3d318d[_0xbfb0('0x10')][_0xbfb0('0x11')]===0x1f4){logger[_0xbfb0('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x527964,_0x3d318d['error'][_0xbfb0('0x12')]);return _0xdd2f1a(_0x3d318d['error'][_0xbfb0('0x12')]);}logger[_0xbfb0('0x10')](_0xbfb0('0x13'),_0x527964,_0x3d318d['error'][_0xbfb0('0x12')]);return _0x573298(_0x3d318d[_0xbfb0('0x10')][_0xbfb0('0x12')]);}else{logger[_0xbfb0('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x527964,'request\x20sent');_0x573298(_0x3d318d[_0xbfb0('0x14')][_0xbfb0('0x12')]);}})['catch'](function(_0x214929){logger[_0xbfb0('0x10')](_0xbfb0('0x13'),_0x527964,_0x214929);_0xdd2f1a(_0x214929);});});} \ No newline at end of file +var _0xe64a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','request\x20sent','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s','result','catch'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0xe64a,0x1e0));var _0xae64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe64a[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var moment=require(_0xae64('0x2'));var BPromise=require(_0xae64('0x3'));var rs=require(_0xae64('0x4'));var fs=require('fs');var Redis=require(_0xae64('0x5'));var db=require(_0xae64('0x6'))['db'];var utils=require(_0xae64('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae64('0x8')][_0xae64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1064e3,_0x3cb2a6,_0x272ae9){return new BPromise(function(_0x65a9d1,_0x385871){return client[_0xae64('0xa')](_0x1064e3,_0x272ae9)[_0xae64('0xb')](function(_0x407543){logger[_0xae64('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3cb2a6,_0xae64('0xd'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x3cb2a6,_0xae64('0xd'),JSON[_0xae64('0xe')](_0x407543));if(_0x407543[_0xae64('0xf')]){if(_0x407543[_0xae64('0xf')]['code']===0x1f4){logger[_0xae64('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3cb2a6,_0x407543['error'][_0xae64('0x10')]);return _0x385871(_0x407543[_0xae64('0xf')][_0xae64('0x10')]);}logger['error'](_0xae64('0x11'),_0x3cb2a6,_0x407543[_0xae64('0xf')][_0xae64('0x10')]);return _0x65a9d1(_0x407543[_0xae64('0xf')][_0xae64('0x10')]);}else{logger['info'](_0xae64('0x11'),_0x3cb2a6,_0xae64('0xd'));_0x65a9d1(_0x407543[_0xae64('0x12')][_0xae64('0x10')]);}})[_0xae64('0x13')](function(_0x561408){logger[_0xae64('0xf')](_0xae64('0x11'),_0x3cb2a6,_0x561408);_0x385871(_0x561408);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index dc294f0..bf70c5c 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 _0x2527=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports'];(function(_0x639fff,_0x1678d0){var _0x535ba8=function(_0x216649){while(--_0x216649){_0x639fff['push'](_0x639fff['shift']());}};_0x535ba8(++_0x1678d0);}(_0x2527,0x1d4));var _0x7252=function(_0x493eb0,_0x24dfb9){_0x493eb0=_0x493eb0-0x0;var _0x303d5c=_0x2527[_0x493eb0];return _0x303d5c;};'use strict';var multer=require('multer');var util=require(_0x7252('0x0'));var path=require('path');var timeout=require(_0x7252('0x1'));var express=require('express');var router=express[_0x7252('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7252('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7252('0x4'));var controller=require(_0x7252('0x5'));router[_0x7252('0x6')]('/',auth['isAuthenticated'](),controller[_0x7252('0x7')]);router['get'](_0x7252('0x8'),auth[_0x7252('0x9')](),controller[_0x7252('0xa')]);router[_0x7252('0x6')](_0x7252('0xb'),auth[_0x7252('0x9')](),controller[_0x7252('0xc')]);router[_0x7252('0xd')]('/',auth[_0x7252('0x9')](),controller[_0x7252('0xe')]);router['put']('/:id',auth[_0x7252('0x9')](),controller[_0x7252('0xf')]);router[_0x7252('0x10')](_0x7252('0xb'),auth[_0x7252('0x9')](),controller['destroy']);module[_0x7252('0x11')]=router; \ No newline at end of file +var _0xa561=['index','/describe','describe','/:id','post','update','delete','destroy','multer','util','path','express','../../components/interaction/service','get','isAuthenticated'];(function(_0x16d460,_0x4b67e8){var _0x58dfb8=function(_0x2c14d8){while(--_0x2c14d8){_0x16d460['push'](_0x16d460['shift']());}};_0x58dfb8(++_0x4b67e8);}(_0xa561,0x116));var _0x1a56=function(_0xd1b293,_0x21dd59){_0xd1b293=_0xd1b293-0x0;var _0x5b2f58=_0xa561[_0xd1b293];return _0x5b2f58;};'use strict';var multer=require(_0x1a56('0x0'));var util=require(_0x1a56('0x1'));var path=require(_0x1a56('0x2'));var timeout=require('connect-timeout');var express=require(_0x1a56('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1a56('0x4'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x1a56('0x5')]('/',auth[_0x1a56('0x6')](),controller[_0x1a56('0x7')]);router[_0x1a56('0x5')](_0x1a56('0x8'),auth[_0x1a56('0x6')](),controller[_0x1a56('0x9')]);router[_0x1a56('0x5')](_0x1a56('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1a56('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1a56('0xa'),auth[_0x1a56('0x6')](),controller[_0x1a56('0xc')]);router[_0x1a56('0xd')](_0x1a56('0xa'),auth[_0x1a56('0x6')](),controller[_0x1a56('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5ca36ce..bc71abe 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 _0xdd28=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x4febae,_0x26b122){var _0x2f4594=function(_0x11953a){while(--_0x11953a){_0x4febae['push'](_0x4febae['shift']());}};_0x2f4594(++_0x26b122);}(_0xdd28,0xdc));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8dd2('0x0'));module[_0x8dd2('0x1')]={'name':{'type':Sequelize[_0x8dd2('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8dd2('0x3'),_0x8dd2('0x4')),'defaultValue':_0x8dd2('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8dd2('0x5')]}}; \ No newline at end of file +var _0x6b4f=['mouseOver','timeout','sequelize','STRING'];(function(_0x17017e,_0x509679){var _0xbc7086=function(_0x30679d){while(--_0x30679d){_0x17017e['push'](_0x17017e['shift']());}};_0xbc7086(++_0x509679);}(_0x6b4f,0x14a));var _0xf6b4=function(_0x371571,_0x4e0ebf){_0x371571=_0x371571-0x0;var _0x1322a6=_0x6b4f[_0x371571];return _0x1322a6;};'use strict';var Sequelize=require(_0xf6b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xf6b4('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf6b4('0x2'),_0xf6b4('0x3')),'defaultValue':_0xf6b4('0x2')},'selector':{'type':Sequelize[_0xf6b4('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f4fff61..a49beee 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 _0xd13e=['fast-json-patch','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','name','show','params','keys','ChatProactiveAction','query','filters','intersection','model','attributes','length','includeAll','include','options','find','catch','create','body','eml-format','rimraf','zip-dir'];(function(_0x3fd6f1,_0x869f96){var _0x35989e=function(_0x1ece21){while(--_0x1ece21){_0x3fd6f1['push'](_0x3fd6f1['shift']());}};_0x35989e(++_0x869f96);}(_0xd13e,0x193));var _0xed13=function(_0x29e67d,_0x40f68e){_0x29e67d=_0x29e67d-0x0;var _0x44cf76=_0xd13e[_0x29e67d];return _0x44cf76;};'use strict';var emlformat=require(_0xed13('0x0'));var rimraf=require(_0xed13('0x1'));var zipdir=require(_0xed13('0x2'));var jsonpatch=require(_0xed13('0x3'));var rp=require('request-promise');var moment=require(_0xed13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed13('0x5'));var util=require('util');var path=require(_0xed13('0x6'));var sox=require(_0xed13('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var as=require(_0xed13('0x12'));var hardwareService=require(_0xed13('0x13'));var logger=require(_0xed13('0x14'))(_0xed13('0x15'));var utils=require('../../config/utils');var config=require(_0xed13('0x16'));var licenseUtil=require(_0xed13('0x17'));var db=require(_0xed13('0x18'))['db'];function respondWithStatusCode(_0x3c0b22,_0x936103){_0x936103=_0x936103||0xcc;return function(_0x3295ba){if(_0x3295ba){return _0x3c0b22['sendStatus'](_0x936103);}return _0x3c0b22[_0xed13('0x19')](_0x936103)['end']();};}function respondWithResult(_0x257074,_0x56fdc6){_0x56fdc6=_0x56fdc6||0xc8;return function(_0x6e2978){if(_0x6e2978){return _0x257074['status'](_0x56fdc6)[_0xed13('0x1a')](_0x6e2978);}};}function respondWithFilteredResult(_0x4d5435,_0x38901a){return function(_0xf900d2){if(_0xf900d2){var _0x1d3d67=typeof _0x38901a[_0xed13('0x1b')]===_0xed13('0x1c')&&typeof _0x38901a[_0xed13('0x1d')]===_0xed13('0x1c');var _0x1148a3=_0xf900d2[_0xed13('0x1e')];var _0x1e161f=_0x1d3d67?0x0:_0x38901a[_0xed13('0x1b')];var _0x31de07=_0x1d3d67?_0xf900d2[_0xed13('0x1e')]:_0x38901a[_0xed13('0x1b')]+_0x38901a[_0xed13('0x1d')];var _0x2f38c9;if(_0x31de07>=_0x1148a3){_0x31de07=_0x1148a3;_0x2f38c9=0xc8;}else{_0x2f38c9=0xce;}_0x4d5435['status'](_0x2f38c9);return _0x4d5435['set'](_0xed13('0x1f'),_0x1e161f+'-'+_0x31de07+'/'+_0x1148a3)[_0xed13('0x1a')](_0xf900d2);}return null;};}function patchUpdates(_0x4f455b){return function(_0x40dd86){try{jsonpatch['apply'](_0x40dd86,_0x4f455b,!![]);}catch(_0x4e9e3b){return BPromise[_0xed13('0x20')](_0x4e9e3b);}return _0x40dd86[_0xed13('0x21')]();};}function saveUpdates(_0x2d62cd,_0x192d12){return function(_0x1d7621){if(_0x1d7621){return _0x1d7621[_0xed13('0x22')](_0x2d62cd)['then'](function(_0x5c0daf){return _0x5c0daf;});}return null;};}function removeEntity(_0x5d7ae1,_0x19d51b){return function(_0x3b1f23){if(_0x3b1f23){return _0x3b1f23[_0xed13('0x23')]()[_0xed13('0x24')](function(){_0x5d7ae1[_0xed13('0x19')](0xcc)[_0xed13('0x25')]();});}};}function handleEntityNotFound(_0x1f0405,_0x276c57){return function(_0x2410e2){if(!_0x2410e2){_0x1f0405[_0xed13('0x26')](0x194);}return _0x2410e2;};}function handleError(_0x1f064c,_0x3bc666){_0x3bc666=_0x3bc666||0x1f4;return function(_0x2c6c33){logger[_0xed13('0x27')](_0x2c6c33['stack']);if(_0x2c6c33['name']){delete _0x2c6c33[_0xed13('0x28')];}_0x1f064c[_0xed13('0x19')](_0x3bc666)['send'](_0x2c6c33);};}exports[_0xed13('0x29')]=function(_0x40444a,_0x4ed119){var _0x7ce996={'raw':!![],'where':{'id':_0x40444a[_0xed13('0x2a')]['id']}},_0x2066ca={};_0x2066ca['model']=_[_0xed13('0x2b')](db[_0xed13('0x2c')]['rawAttributes']);_0x2066ca[_0xed13('0x2d')]=_[_0xed13('0x2b')](_0x40444a['query']);_0x2066ca[_0xed13('0x2e')]=_[_0xed13('0x2f')](_0x2066ca[_0xed13('0x30')],_0x2066ca[_0xed13('0x2d')]);_0x7ce996[_0xed13('0x31')]=_[_0xed13('0x2f')](_0x2066ca[_0xed13('0x30')],qs['fields'](_0x40444a[_0xed13('0x2d')]['fields']));_0x7ce996['attributes']=_0x7ce996[_0xed13('0x31')][_0xed13('0x32')]?_0x7ce996[_0xed13('0x31')]:_0x2066ca['model'];if(_0x40444a[_0xed13('0x2d')][_0xed13('0x33')]){_0x7ce996[_0xed13('0x34')]=[{'all':!![]}];}_0x7ce996=_['merge']({},_0x7ce996,_0x40444a[_0xed13('0x35')]);return db[_0xed13('0x2c')][_0xed13('0x36')](_0x7ce996)[_0xed13('0x24')](handleEntityNotFound(_0x4ed119,null))['then'](respondWithResult(_0x4ed119,null))[_0xed13('0x37')](handleError(_0x4ed119,null));};exports[_0xed13('0x38')]=function(_0x2508b4,_0xed7343){return db[_0xed13('0x2c')][_0xed13('0x38')](_0x2508b4[_0xed13('0x39')],{})[_0xed13('0x24')](respondWithResult(_0xed7343,0xc9))[_0xed13('0x37')](handleError(_0xed7343,null));};exports[_0xed13('0x22')]=function(_0x5a09e4,_0x2342a5){if(_0x5a09e4[_0xed13('0x39')]['id']){delete _0x5a09e4['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x5a09e4[_0xed13('0x2a')]['id']}})[_0xed13('0x24')](handleEntityNotFound(_0x2342a5,null))['then'](saveUpdates(_0x5a09e4['body'],null))[_0xed13('0x24')](respondWithResult(_0x2342a5,null))[_0xed13('0x37')](handleError(_0x2342a5,null));};exports[_0xed13('0x23')]=function(_0x32ec49,_0x358098){return db['ChatProactiveAction']['find']({'where':{'id':_0x32ec49[_0xed13('0x2a')]['id']}})['then'](handleEntityNotFound(_0x358098,null))[_0xed13('0x24')](removeEntity(_0x358098,null))['catch'](handleError(_0x358098,null));}; \ No newline at end of file +var _0x6208=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','show','model','ChatProactiveAction','query','keys','filters','intersection','fields','attributes','merge','options','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x6208,0x17d));var _0x8620=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x6208[_0x2555d0];return _0x3bb486;};'use strict';var emlformat=require(_0x8620('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8620('0x1'));var jsonpatch=require(_0x8620('0x2'));var rp=require('request-promise');var moment=require(_0x8620('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8620('0x4'));var util=require(_0x8620('0x5'));var path=require(_0x8620('0x6'));var sox=require(_0x8620('0x7'));var csv=require(_0x8620('0x8'));var ejs=require(_0x8620('0x9'));var fs=require('fs');var fs_extra=require(_0x8620('0xa'));var _=require('lodash');var squel=require(_0x8620('0xb'));var crypto=require(_0x8620('0xc'));var jsforce=require(_0x8620('0xd'));var deskjs=require(_0x8620('0xe'));var toCsv=require(_0x8620('0x8'));var querystring=require(_0x8620('0xf'));var Papa=require(_0x8620('0x10'));var Redis=require(_0x8620('0x11'));var authService=require(_0x8620('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8620('0x13'));var hardwareService=require(_0x8620('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8620('0x15'));var config=require(_0x8620('0x16'));var licenseUtil=require(_0x8620('0x17'));var db=require(_0x8620('0x18'))['db'];function respondWithStatusCode(_0x3d7a76,_0x36abcb){_0x36abcb=_0x36abcb||0xcc;return function(_0x578636){if(_0x578636){return _0x3d7a76[_0x8620('0x19')](_0x36abcb);}return _0x3d7a76['status'](_0x36abcb)[_0x8620('0x1a')]();};}function respondWithResult(_0x2747b3,_0x2490bb){_0x2490bb=_0x2490bb||0xc8;return function(_0x1e6721){if(_0x1e6721){return _0x2747b3['status'](_0x2490bb)[_0x8620('0x1b')](_0x1e6721);}};}function respondWithFilteredResult(_0x41ea96,_0x5908c0){return function(_0x4ae1d1){if(_0x4ae1d1){var _0x213668=typeof _0x5908c0[_0x8620('0x1c')]==='undefined'&&typeof _0x5908c0[_0x8620('0x1d')]==='undefined';var _0x400d93=_0x4ae1d1[_0x8620('0x1e')];var _0x114e25=_0x213668?0x0:_0x5908c0[_0x8620('0x1c')];var _0x1e6295=_0x213668?_0x4ae1d1[_0x8620('0x1e')]:_0x5908c0[_0x8620('0x1c')]+_0x5908c0[_0x8620('0x1d')];var _0x2f6d60;if(_0x1e6295>=_0x400d93){_0x1e6295=_0x400d93;_0x2f6d60=0xc8;}else{_0x2f6d60=0xce;}_0x41ea96[_0x8620('0x1f')](_0x2f6d60);return _0x41ea96[_0x8620('0x20')](_0x8620('0x21'),_0x114e25+'-'+_0x1e6295+'/'+_0x400d93)[_0x8620('0x1b')](_0x4ae1d1);}return null;};}function patchUpdates(_0x7deddb){return function(_0x1ff783){try{jsonpatch[_0x8620('0x22')](_0x1ff783,_0x7deddb,!![]);}catch(_0x4443c1){return BPromise[_0x8620('0x23')](_0x4443c1);}return _0x1ff783[_0x8620('0x24')]();};}function saveUpdates(_0x88ef0f,_0x49334a){return function(_0xa63ba9){if(_0xa63ba9){return _0xa63ba9[_0x8620('0x25')](_0x88ef0f)[_0x8620('0x26')](function(_0x3fb864){return _0x3fb864;});}return null;};}function removeEntity(_0xca485e,_0x291e6b){return function(_0x28c3e1){if(_0x28c3e1){return _0x28c3e1[_0x8620('0x27')]()[_0x8620('0x26')](function(){_0xca485e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9e92,_0x42a703){return function(_0x35ebda){if(!_0x35ebda){_0x5b9e92[_0x8620('0x19')](0x194);}return _0x35ebda;};}function handleError(_0x56cf13,_0x2d8cbd){_0x2d8cbd=_0x2d8cbd||0x1f4;return function(_0x2671fb){logger[_0x8620('0x28')](_0x2671fb[_0x8620('0x29')]);if(_0x2671fb[_0x8620('0x2a')]){delete _0x2671fb[_0x8620('0x2a')];}_0x56cf13[_0x8620('0x1f')](_0x2d8cbd)['send'](_0x2671fb);};}exports[_0x8620('0x2b')]=function(_0x524fc5,_0x9affe1){var _0x40e639={'raw':!![],'where':{'id':_0x524fc5['params']['id']}},_0x25e3c1={};_0x25e3c1[_0x8620('0x2c')]=_['keys'](db[_0x8620('0x2d')]['rawAttributes']);_0x25e3c1[_0x8620('0x2e')]=_[_0x8620('0x2f')](_0x524fc5[_0x8620('0x2e')]);_0x25e3c1[_0x8620('0x30')]=_[_0x8620('0x31')](_0x25e3c1[_0x8620('0x2c')],_0x25e3c1['query']);_0x40e639['attributes']=_['intersection'](_0x25e3c1['model'],qs[_0x8620('0x32')](_0x524fc5[_0x8620('0x2e')][_0x8620('0x32')]));_0x40e639['attributes']=_0x40e639['attributes']['length']?_0x40e639[_0x8620('0x33')]:_0x25e3c1['model'];if(_0x524fc5['query']['includeAll']){_0x40e639['include']=[{'all':!![]}];}_0x40e639=_[_0x8620('0x34')]({},_0x40e639,_0x524fc5[_0x8620('0x35')]);return db[_0x8620('0x2d')][_0x8620('0x36')](_0x40e639)[_0x8620('0x26')](handleEntityNotFound(_0x9affe1,null))[_0x8620('0x26')](respondWithResult(_0x9affe1,null))[_0x8620('0x37')](handleError(_0x9affe1,null));};exports[_0x8620('0x38')]=function(_0x124e18,_0x4c6c78){return db[_0x8620('0x2d')][_0x8620('0x38')](_0x124e18[_0x8620('0x39')],{})[_0x8620('0x26')](respondWithResult(_0x4c6c78,0xc9))['catch'](handleError(_0x4c6c78,null));};exports[_0x8620('0x25')]=function(_0x2cc394,_0x22a325){if(_0x2cc394[_0x8620('0x39')]['id']){delete _0x2cc394[_0x8620('0x39')]['id'];}return db[_0x8620('0x2d')][_0x8620('0x36')]({'where':{'id':_0x2cc394[_0x8620('0x3a')]['id']}})[_0x8620('0x26')](handleEntityNotFound(_0x22a325,null))[_0x8620('0x26')](saveUpdates(_0x2cc394[_0x8620('0x39')],null))[_0x8620('0x26')](respondWithResult(_0x22a325,null))[_0x8620('0x37')](handleError(_0x22a325,null));};exports[_0x8620('0x27')]=function(_0x5e5b5b,_0xf24da1){return db['ChatProactiveAction'][_0x8620('0x36')]({'where':{'id':_0x5e5b5b[_0x8620('0x3a')]['id']}})['then'](handleEntityNotFound(_0xf24da1,null))['then'](removeEntity(_0xf24da1,null))[_0x8620('0x37')](handleError(_0xf24da1,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8c4df16..11722b9 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 _0xe2d3=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x1c06e3,_0x4b5c9e){var _0x5a8217=function(_0x239207){while(--_0x239207){_0x1c06e3['push'](_0x1c06e3['shift']());}};_0x5a8217(++_0x4b5c9e);}(_0xe2d3,0x1b1));var _0x3e2d=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xe2d3[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x3e2d('0x0'));var util=require(_0x3e2d('0x1'));var logger=require(_0x3e2d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3e2d('0x3'));var rp=require(_0x3e2d('0x4'));var fs=require('fs');var path=require(_0x3e2d('0x5'));var rimraf=require(_0x3e2d('0x6'));var config=require(_0x3e2d('0x7'));var attributes=require(_0x3e2d('0x8'));module[_0x3e2d('0x9')]=function(_0x36e268,_0x4cacd2){return _0x36e268[_0x3e2d('0xa')](_0x3e2d('0xb'),attributes,{'tableName':_0x3e2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52ab=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2cd993,_0x26a4da){var _0x1f1cb1=function(_0x907326){while(--_0x907326){_0x2cd993['push'](_0x2cd993['shift']());}};_0x1f1cb1(++_0x26a4da);}(_0x52ab,0x87));var _0xb52a=function(_0xa2f497,_0x4d757d){_0xa2f497=_0xa2f497-0x0;var _0x202e66=_0x52ab[_0xa2f497];return _0x202e66;};'use strict';var _=require(_0xb52a('0x0'));var util=require(_0xb52a('0x1'));var logger=require(_0xb52a('0x2'))('api');var moment=require(_0xb52a('0x3'));var BPromise=require(_0xb52a('0x4'));var rp=require(_0xb52a('0x5'));var fs=require('fs');var path=require(_0xb52a('0x6'));var rimraf=require('rimraf');var config=require(_0xb52a('0x7'));var attributes=require(_0xb52a('0x8'));module[_0xb52a('0x9')]=function(_0x180d71,_0x539f67){return _0x180d71[_0xb52a('0xa')](_0xb52a('0xb'),attributes,{'tableName':_0xb52a('0xc'),'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 bc00321..5143041 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 _0x8e43=['ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x8e43,0x11d));var _0x38e4=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8e43[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var util=require(_0x38e4('0x0'));var moment=require(_0x38e4('0x1'));var BPromise=require(_0x38e4('0x2'));var rs=require(_0x38e4('0x3'));var fs=require('fs');var Redis=require(_0x38e4('0x4'));var db=require(_0x38e4('0x5'))['db'];var utils=require(_0x38e4('0x6'));var logger=require(_0x38e4('0x7'))(_0x38e4('0x8'));var config=require(_0x38e4('0x9'));var jayson=require(_0x38e4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36bf4d,_0x500e03,_0xd5ac79){return new BPromise(function(_0x5767e7,_0x4bdb69){return client[_0x38e4('0xb')](_0x36bf4d,_0xd5ac79)[_0x38e4('0xc')](function(_0x3ee87c){logger[_0x38e4('0xd')](_0x38e4('0xe'),_0x500e03,'request\x20sent');logger['debug'](_0x38e4('0xf'),_0x500e03,_0x38e4('0x10'),JSON[_0x38e4('0x11')](_0x3ee87c));if(_0x3ee87c[_0x38e4('0x12')]){if(_0x3ee87c[_0x38e4('0x12')][_0x38e4('0x13')]===0x1f4){logger[_0x38e4('0x12')](_0x38e4('0xe'),_0x500e03,_0x3ee87c[_0x38e4('0x12')][_0x38e4('0x14')]);return _0x4bdb69(_0x3ee87c['error'][_0x38e4('0x14')]);}logger[_0x38e4('0x12')](_0x38e4('0xe'),_0x500e03,_0x3ee87c[_0x38e4('0x12')][_0x38e4('0x14')]);return _0x5767e7(_0x3ee87c[_0x38e4('0x12')][_0x38e4('0x14')]);}else{logger[_0x38e4('0xd')](_0x38e4('0xe'),_0x500e03,_0x38e4('0x10'));_0x5767e7(_0x3ee87c[_0x38e4('0x15')][_0x38e4('0x14')]);}})[_0x38e4('0x16')](function(_0x29e415){logger['error'](_0x38e4('0xe'),_0x500e03,_0x29e415);_0x4bdb69(_0x29e415);});});} \ No newline at end of file +var _0x01d9=['http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4551d3,_0x56c2de){var _0xd53a7c=function(_0x4e74f4){while(--_0x4e74f4){_0x4551d3['push'](_0x4551d3['shift']());}};_0xd53a7c(++_0x56c2de);}(_0x01d9,0x84));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 moment=require(_0x901d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x901d('0x4'));var logger=require(_0x901d('0x5'))(_0x901d('0x6'));var config=require(_0x901d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x901d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbe68a6,_0x50c3c7,_0x779bf0){return new BPromise(function(_0x17e94d,_0xe8b37c){return client[_0x901d('0x9')](_0xbe68a6,_0x779bf0)['then'](function(_0x2545c3){logger[_0x901d('0xa')](_0x901d('0xb'),_0x50c3c7,_0x901d('0xc'));logger[_0x901d('0xd')](_0x901d('0xe'),_0x50c3c7,'request\x20sent',JSON['stringify'](_0x2545c3));if(_0x2545c3['error']){if(_0x2545c3[_0x901d('0xf')][_0x901d('0x10')]===0x1f4){logger['error'](_0x901d('0xb'),_0x50c3c7,_0x2545c3[_0x901d('0xf')][_0x901d('0x11')]);return _0xe8b37c(_0x2545c3[_0x901d('0xf')][_0x901d('0x11')]);}logger[_0x901d('0xf')](_0x901d('0xb'),_0x50c3c7,_0x2545c3[_0x901d('0xf')][_0x901d('0x11')]);return _0x17e94d(_0x2545c3[_0x901d('0xf')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x50c3c7,_0x901d('0xc'));_0x17e94d(_0x2545c3[_0x901d('0x12')][_0x901d('0x11')]);}})[_0x901d('0x13')](function(_0x112cb6){logger[_0x901d('0xf')](_0x901d('0xb'),_0x50c3c7,_0x112cb6);_0xe8b37c(_0x112cb6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 10151cb..3363079 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 _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x6580a7,_0x5348e5){_0x6580a7=_0x6580a7-0x0;var _0x984e11=_0x8d0e[_0x6580a7];return _0x984e11;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe14b=['/:id','isAuthenticated','show','post','update','delete','exports','multer','util','express','Router','../../components/auth/service','./chatProactiveAction.controller','get'];(function(_0x2c63ac,_0x1df97a){var _0xdf3040=function(_0x4c8f63){while(--_0x4c8f63){_0x2c63ac['push'](_0x2c63ac['shift']());}};_0xdf3040(++_0x1df97a);}(_0xe14b,0x93));var _0xbe14=function(_0x211c77,_0x580dd5){_0x211c77=_0x211c77-0x0;var _0x18ff21=_0xe14b[_0x211c77];return _0x18ff21;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')](_0xbe14('0x7'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x9')]);router[_0xbe14('0xa')]('/',auth[_0xbe14('0x8')](),controller['create']);router['put']('/:id',auth[_0xbe14('0x8')](),controller[_0xbe14('0xb')]);router[_0xbe14('0xc')](_0xbe14('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe14('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 67ce0e4..ed2751b 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 _0xaf43=['exports','STRING','INTEGER','ENUM','beepall'];(function(_0x2c2db7,_0x7181d1){var _0x38ee39=function(_0xe89388){while(--_0xe89388){_0x2c2db7['push'](_0x2c2db7['shift']());}};_0x38ee39(++_0x7181d1);}(_0xaf43,0xaf));var _0x3af4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xaf43[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module[_0x3af4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3af4('0x1')]},'timeout':{'type':Sequelize[_0x3af4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3af4('0x3')]('rrmemory',_0x3af4('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x41ce=['rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x44dbd0,_0x42b70b){var _0x55a151=function(_0x4911e1){while(--_0x4911e1){_0x44dbd0['push'](_0x44dbd0['shift']());}};_0x55a151(++_0x42b70b);}(_0x41ce,0x189));var _0xe41c=function(_0x15cc77,_0x266ca2){_0x15cc77=_0x15cc77-0x0;var _0x276650=_0x41ce[_0x15cc77];return _0x276650;};'use strict';var Sequelize=require(_0xe41c('0x0'));module['exports']={'name':{'type':Sequelize[_0xe41c('0x1')],'unique':_0xe41c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe41c('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe41c('0x3'),_0xe41c('0x4'),_0xe41c('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ff54ecd..0d39e74 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 _0xf650=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','UserProfileResource','stack','name','send','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','map','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserChatQueue','nolimit','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','removeAgents','userChatQueue:remove','addAgents','spread','userChatQueue:save','isArray','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x44121f,_0xd00d0){var _0x84fe7f=function(_0x36e2fb){while(--_0x36e2fb){_0x44121f['push'](_0x44121f['shift']());}};_0x84fe7f(++_0xd00d0);}(_0xf650,0x12b));var _0x0f65=function(_0x4e88f4,_0x36cb5a){_0x4e88f4=_0x4e88f4-0x0;var _0x2ea87b=_0xf650[_0x4e88f4];return _0x2ea87b;};'use strict';var emlformat=require(_0x0f65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f65('0x1'));var jsonpatch=require(_0x0f65('0x2'));var rp=require(_0x0f65('0x3'));var moment=require(_0x0f65('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f65('0x5'));var util=require(_0x0f65('0x6'));var path=require('path');var sox=require(_0x0f65('0x7'));var csv=require(_0x0f65('0x8'));var ejs=require(_0x0f65('0x9'));var fs=require('fs');var fs_extra=require(_0x0f65('0xa'));var _=require(_0x0f65('0xb'));var squel=require(_0x0f65('0xc'));var crypto=require(_0x0f65('0xd'));var jsforce=require(_0x0f65('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0f65('0x8'));var querystring=require(_0x0f65('0xf'));var Papa=require(_0x0f65('0x10'));var Redis=require(_0x0f65('0x11'));var authService=require(_0x0f65('0x12'));var qs=require(_0x0f65('0x13'));var as=require(_0x0f65('0x14'));var hardwareService=require(_0x0f65('0x15'));var logger=require(_0x0f65('0x16'))(_0x0f65('0x17'));var utils=require(_0x0f65('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f65('0x19'))['db'];config[_0x0f65('0x1a')]=_[_0x0f65('0x1b')](config['redis'],{'host':_0x0f65('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f65('0x1a')]));require(_0x0f65('0x1d'))[_0x0f65('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0f65('0x1f')][_0x0f65('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1ea1e5,_0x4a1987,_0x45e551,_0xea4882){return new BPromise(function(_0x5e17e8,_0x2addc3){var _0x4852c4=_0xea4882||client;return _0x4852c4[_0x0f65('0x21')](_0x1ea1e5,_0x45e551)[_0x0f65('0x22')](function(_0x9003d7){logger['info'](_0x0f65('0x23'),_0x4a1987,_0x0f65('0x24'));logger[_0x0f65('0x25')](_0x0f65('0x26'),_0x4a1987,_0x0f65('0x24'),JSON[_0x0f65('0x27')](_0x9003d7));if(_0x9003d7[_0x0f65('0x28')]){if(_0x9003d7['error'][_0x0f65('0x29')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4a1987,_0x9003d7['error']['message']);return _0x2addc3(_0x9003d7[_0x0f65('0x28')][_0x0f65('0x2a')]);}logger[_0x0f65('0x28')](_0x0f65('0x23'),_0x4a1987,_0x9003d7[_0x0f65('0x28')][_0x0f65('0x2a')]);return _0x5e17e8(_0x9003d7[_0x0f65('0x28')][_0x0f65('0x2a')]);}else{logger['info'](_0x0f65('0x23'),_0x4a1987,'request\x20sent');_0x5e17e8(_0x9003d7[_0x0f65('0x2b')][_0x0f65('0x2a')]);}})['catch'](function(_0x2ebe31){logger[_0x0f65('0x28')](_0x0f65('0x23'),_0x4a1987,_0x2ebe31);_0x2addc3(_0x2ebe31);});});}function respondWithStatusCode(_0x58831f,_0xf3d984){_0xf3d984=_0xf3d984||0xcc;return function(_0x2d1857){if(_0x2d1857){return _0x58831f[_0x0f65('0x2c')](_0xf3d984);}return _0x58831f['status'](_0xf3d984)[_0x0f65('0x2d')]();};}function respondWithResult(_0x120a29,_0x5c6441){_0x5c6441=_0x5c6441||0xc8;return function(_0x3f139f){if(_0x3f139f){return _0x120a29[_0x0f65('0x2e')](_0x5c6441)[_0x0f65('0x2f')](_0x3f139f);}};}function respondWithFilteredResult(_0x4d8348,_0x325c02){return function(_0x5d67f0){if(_0x5d67f0){var _0x2e7a38=typeof _0x325c02[_0x0f65('0x30')]===_0x0f65('0x31')&&typeof _0x325c02[_0x0f65('0x32')]===_0x0f65('0x31');var _0x4f3ff2=_0x5d67f0[_0x0f65('0x33')];var _0x9cc4d9=_0x2e7a38?0x0:_0x325c02[_0x0f65('0x30')];var _0x2ed992=_0x2e7a38?_0x5d67f0[_0x0f65('0x33')]:_0x325c02['offset']+_0x325c02['limit'];var _0x5b01ba;if(_0x2ed992>=_0x4f3ff2){_0x2ed992=_0x4f3ff2;_0x5b01ba=0xc8;}else{_0x5b01ba=0xce;}_0x4d8348['status'](_0x5b01ba);return _0x4d8348[_0x0f65('0x34')](_0x0f65('0x35'),_0x9cc4d9+'-'+_0x2ed992+'/'+_0x4f3ff2)[_0x0f65('0x2f')](_0x5d67f0);}return null;};}function patchUpdates(_0x55c95a){return function(_0x4bf87e){try{jsonpatch[_0x0f65('0x36')](_0x4bf87e,_0x55c95a,!![]);}catch(_0x365217){return BPromise[_0x0f65('0x37')](_0x365217);}return _0x4bf87e['save']();};}function saveUpdates(_0x22dd04,_0x326ca4){return function(_0x5bb31d){if(_0x5bb31d){return _0x5bb31d['update'](_0x22dd04)[_0x0f65('0x22')](function(_0x526b92){return _0x526b92;});}return null;};}function removeEntity(_0x32addd,_0x41a79c){return function(_0x187ce3){if(_0x187ce3){return _0x187ce3[_0x0f65('0x38')]()['then'](function(){var _0x394446=_0x187ce3['get']({'plain':!![]});var _0x137608='ChatQueues';return db[_0x0f65('0x39')][_0x0f65('0x38')]({'where':{'type':_0x137608,'resourceId':_0x394446['id']}})['then'](function(){return _0x187ce3;});})[_0x0f65('0x22')](function(){_0x32addd[_0x0f65('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2516,_0xde0681){return function(_0x3f5c44){if(!_0x3f5c44){_0x2b2516['sendStatus'](0x194);}return _0x3f5c44;};}function handleError(_0x41be2d,_0x223df6){_0x223df6=_0x223df6||0x1f4;return function(_0x6b126c){logger[_0x0f65('0x28')](_0x6b126c[_0x0f65('0x3a')]);if(_0x6b126c[_0x0f65('0x3b')]){delete _0x6b126c[_0x0f65('0x3b')];}_0x41be2d[_0x0f65('0x2e')](_0x223df6)[_0x0f65('0x3c')](_0x6b126c);};}exports['index']=function(_0x4579c6,_0x291d20){var _0x465a2b={},_0x16af94={},_0x3b7f17={'count':0x0,'rows':[]};var _0x4b6f85=_['map'](db[_0x0f65('0x3d')][_0x0f65('0x3e')],function(_0x501b44){return{'name':_0x501b44[_0x0f65('0x3f')],'type':_0x501b44[_0x0f65('0x40')][_0x0f65('0x41')]};});_0x16af94[_0x0f65('0x42')]=_['map'](_0x4b6f85,_0x0f65('0x3b'));_0x16af94[_0x0f65('0x43')]=_[_0x0f65('0x44')](_0x4579c6['query']);_0x16af94[_0x0f65('0x45')]=_[_0x0f65('0x46')](_0x16af94[_0x0f65('0x42')],_0x16af94['query']);_0x465a2b[_0x0f65('0x47')]=_['intersection'](_0x16af94[_0x0f65('0x42')],qs['fields'](_0x4579c6[_0x0f65('0x43')][_0x0f65('0x48')]));_0x465a2b[_0x0f65('0x47')]=_0x465a2b[_0x0f65('0x47')][_0x0f65('0x49')]?_0x465a2b[_0x0f65('0x47')]:_0x16af94[_0x0f65('0x42')];if(!_0x4579c6[_0x0f65('0x43')]['hasOwnProperty']('nolimit')){_0x465a2b[_0x0f65('0x32')]=qs[_0x0f65('0x32')](_0x4579c6[_0x0f65('0x43')][_0x0f65('0x32')]);_0x465a2b[_0x0f65('0x30')]=qs[_0x0f65('0x30')](_0x4579c6[_0x0f65('0x43')][_0x0f65('0x30')]);}_0x465a2b[_0x0f65('0x4a')]=qs['sort'](_0x4579c6['query'][_0x0f65('0x4b')]);_0x465a2b[_0x0f65('0x4c')]=qs[_0x0f65('0x45')](_[_0x0f65('0x4d')](_0x4579c6[_0x0f65('0x43')],_0x16af94['filters']),_0x4b6f85);if(_0x4579c6[_0x0f65('0x43')][_0x0f65('0x4e')]){_0x465a2b[_0x0f65('0x4c')]=_['merge'](_0x465a2b[_0x0f65('0x4c')],{'$or':_[_0x0f65('0x4f')](_0x4b6f85,function(_0x3a6a53){if(_0x3a6a53['type']!==_0x0f65('0x50')){var _0xfd3446={};_0xfd3446[_0x3a6a53['name']]={'$like':'%'+_0x4579c6[_0x0f65('0x43')][_0x0f65('0x4e')]+'%'};return _0xfd3446;}})});}_0x465a2b=_[_0x0f65('0x51')]({},_0x465a2b,_0x4579c6[_0x0f65('0x52')]);var _0x4a4aa3={'where':_0x465a2b[_0x0f65('0x4c')]};return db[_0x0f65('0x3d')][_0x0f65('0x33')](_0x4a4aa3)['then'](function(_0x20fa83){_0x3b7f17[_0x0f65('0x33')]=_0x20fa83;if(_0x4579c6[_0x0f65('0x43')]['includeAll']){_0x465a2b[_0x0f65('0x53')]=[{'all':!![]}];}return db[_0x0f65('0x3d')]['findAll'](_0x465a2b);})[_0x0f65('0x22')](function(_0x39802b){_0x3b7f17[_0x0f65('0x54')]=_0x39802b;return _0x3b7f17;})[_0x0f65('0x22')](respondWithFilteredResult(_0x291d20,_0x465a2b))['catch'](handleError(_0x291d20,null));};exports[_0x0f65('0x55')]=function(_0x5f21dc,_0x3426ed){var _0x3bd728={'raw':!![],'where':{'id':_0x5f21dc[_0x0f65('0x56')]['id']}},_0x49f8e9={};_0x49f8e9[_0x0f65('0x42')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x49f8e9['query']=_['keys'](_0x5f21dc['query']);_0x49f8e9[_0x0f65('0x45')]=_[_0x0f65('0x46')](_0x49f8e9[_0x0f65('0x42')],_0x49f8e9['query']);_0x3bd728[_0x0f65('0x47')]=_[_0x0f65('0x46')](_0x49f8e9[_0x0f65('0x42')],qs[_0x0f65('0x48')](_0x5f21dc[_0x0f65('0x43')][_0x0f65('0x48')]));_0x3bd728['attributes']=_0x3bd728[_0x0f65('0x47')]['length']?_0x3bd728['attributes']:_0x49f8e9[_0x0f65('0x42')];if(_0x5f21dc['query'][_0x0f65('0x57')]){_0x3bd728[_0x0f65('0x53')]=[{'all':!![]}];}_0x3bd728=_[_0x0f65('0x51')]({},_0x3bd728,_0x5f21dc[_0x0f65('0x52')]);return db[_0x0f65('0x3d')][_0x0f65('0x58')](_0x3bd728)['then'](handleEntityNotFound(_0x3426ed,null))[_0x0f65('0x22')](respondWithResult(_0x3426ed,null))[_0x0f65('0x59')](handleError(_0x3426ed,null));};exports[_0x0f65('0x5a')]=function(_0x242657,_0xec7068){return db[_0x0f65('0x3d')][_0x0f65('0x5a')](_0x242657['body'],{})[_0x0f65('0x22')](function(_0x4feb67){var _0x594b85=_0x242657[_0x0f65('0x5b')][_0x0f65('0x5c')]({'plain':!![]});if(!_0x594b85)throw new Error(_0x0f65('0x5d'));if(_0x594b85[_0x0f65('0x5e')]===_0x0f65('0x5b')){var _0x80f563=_0x4feb67['get']({'plain':!![]});var _0x5e96c6=_0x0f65('0x5f');return db[_0x0f65('0x60')][_0x0f65('0x58')]({'where':{'name':_0x5e96c6,'userProfileId':_0x594b85[_0x0f65('0x61')]},'raw':!![]})[_0x0f65('0x22')](function(_0x38ebf0){if(_0x38ebf0&&_0x38ebf0[_0x0f65('0x62')]===0x0){return db[_0x0f65('0x39')]['create']({'name':_0x80f563[_0x0f65('0x3b')],'resourceId':_0x80f563['id'],'type':_0x38ebf0[_0x0f65('0x3b')],'sectionId':_0x38ebf0['id']},{})['then'](function(){return _0x4feb67;});}else{return _0x4feb67;}})['catch'](function(_0x4a0580){logger[_0x0f65('0x28')](_0x0f65('0x63'),_0x4a0580);throw _0x4a0580;});}return _0x4feb67;})[_0x0f65('0x22')](respondWithResult(_0xec7068,0xc9))[_0x0f65('0x59')](handleError(_0xec7068,null));};exports[_0x0f65('0x64')]=function(_0x2203ad,_0x592849){if(_0x2203ad[_0x0f65('0x65')]['id']){delete _0x2203ad[_0x0f65('0x65')]['id'];}return db[_0x0f65('0x3d')][_0x0f65('0x58')]({'where':{'id':_0x2203ad['params']['id']}})[_0x0f65('0x22')](handleEntityNotFound(_0x592849,null))[_0x0f65('0x22')](saveUpdates(_0x2203ad['body'],null))[_0x0f65('0x22')](respondWithResult(_0x592849,null))['catch'](handleError(_0x592849,null));};exports['destroy']=function(_0x1f2053,_0x218670){return db['ChatQueue']['find']({'where':{'id':_0x1f2053[_0x0f65('0x56')]['id']}})[_0x0f65('0x22')](handleEntityNotFound(_0x218670,null))[_0x0f65('0x22')](removeEntity(_0x218670,null))['catch'](handleError(_0x218670,null));};exports[_0x0f65('0x66')]=function(_0x22d240,_0xcb4105){return db[_0x0f65('0x3d')][_0x0f65('0x66')]()[_0x0f65('0x22')](respondWithResult(_0xcb4105,null))[_0x0f65('0x59')](handleError(_0xcb4105,null));};exports[_0x0f65('0x67')]=function(_0x3e01b5,_0x1733a2,_0x296624){var _0x491459={'raw':!![],'where':{}},_0x2371cf={},_0x3f4786;return db[_0x0f65('0x3d')][_0x0f65('0x68')]({'where':{'id':_0x3e01b5[_0x0f65('0x56')]['id']}})[_0x0f65('0x22')](handleEntityNotFound(_0x1733a2,null))[_0x0f65('0x22')](function(_0x2f46c2){if(_0x2f46c2){_0x3f4786=_0x2f46c2[_0x0f65('0x5c')]({'plain':!![]});_0x2371cf[_0x0f65('0x42')]=_[_0x0f65('0x44')](db[_0x0f65('0x69')][_0x0f65('0x3e')]);_0x2371cf[_0x0f65('0x43')]=_[_0x0f65('0x44')](_0x3e01b5[_0x0f65('0x43')]);_0x2371cf['filters']=_[_0x0f65('0x46')](_0x2371cf[_0x0f65('0x42')],_0x2371cf[_0x0f65('0x43')]);_0x491459['attributes']=_['intersection'](_0x2371cf[_0x0f65('0x42')],qs['fields'](_0x3e01b5[_0x0f65('0x43')][_0x0f65('0x48')]));_0x491459[_0x0f65('0x47')]=_0x491459[_0x0f65('0x47')][_0x0f65('0x49')]?_0x491459[_0x0f65('0x47')]:_0x2371cf['model'];if(!_0x3e01b5[_0x0f65('0x43')]['hasOwnProperty'](_0x0f65('0x6a'))){_0x491459['limit']=qs[_0x0f65('0x32')](_0x3e01b5[_0x0f65('0x43')][_0x0f65('0x32')]);_0x491459[_0x0f65('0x30')]=qs[_0x0f65('0x30')](_0x3e01b5[_0x0f65('0x43')][_0x0f65('0x30')]);}_0x491459[_0x0f65('0x4a')]=qs[_0x0f65('0x4b')](_0x3e01b5[_0x0f65('0x43')][_0x0f65('0x4b')]);_0x491459[_0x0f65('0x4c')]=qs[_0x0f65('0x45')](_['pick'](_0x3e01b5['query'],_0x2371cf['filters']));_0x491459[_0x0f65('0x4c')]['ChatQueueId']=_0x2f46c2['id'];if(_0x3e01b5['query'][_0x0f65('0x4e')]){_0x491459[_0x0f65('0x4c')]=_[_0x0f65('0x51')](_0x491459[_0x0f65('0x4c')],{'$or':_['map'](_0x491459[_0x0f65('0x47')],function(_0x542f74){var _0xc68098={};_0xc68098[_0x542f74]={'$like':'%'+_0x3e01b5[_0x0f65('0x43')][_0x0f65('0x4e')]+'%'};return _0xc68098;})});}_0x491459=_[_0x0f65('0x51')]({},_0x491459,_0x3e01b5[_0x0f65('0x52')]);return db[_0x0f65('0x69')][_0x0f65('0x6b')](_0x491459);}})[_0x0f65('0x22')](function(_0x4442d9){if(_0x4442d9){return db[_0x0f65('0x6c')][_0x0f65('0x6d')]({'where':{'id':_[_0x0f65('0x4f')](_0x4442d9,_0x0f65('0x6e')),'role':_0x0f65('0x6f')},'attributes':['id',_0x0f65('0x3b'),_0x0f65('0x70'),_0x0f65('0x71'),'createdAt']});}})['then'](function(_0x5b66db){if(_0x5b66db){return{'count':_0x5b66db['count'],'rows':_[_0x0f65('0x4f')](_0x5b66db[_0x0f65('0x54')],function(_0xfb82ce){return{'membername':_0xfb82ce[_0x0f65('0x3b')],'UserId':_0xfb82ce['id'],'queue_name':_0x3f4786['name'],'ChatQueueId':_0x3f4786['id'],'interface':util[_0x0f65('0x72')](_0x0f65('0x73'),_0x0f65('0x74'),_0xfb82ce[_0x0f65('0x3b')]),'penalty':0x0,'paused':_0xfb82ce[_0x0f65('0x70')],'createdAt':_0xfb82ce[_0x0f65('0x75')],'updatedAt':_0xfb82ce[_0x0f65('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0f65('0x22')](respondWithFilteredResult(_0x1733a2,_0x491459))[_0x0f65('0x59')](handleError(_0x1733a2,null));};exports[_0x0f65('0x76')]=function(_0x255116,_0xf0b588,_0x36f34b){var _0x41fc60={};var _0x1da4b3={};var _0xef3abe;var _0x27598d;return db['ChatQueue'][_0x0f65('0x68')]({'where':{'id':_0x255116['params']['id']}})[_0x0f65('0x22')](handleEntityNotFound(_0xf0b588,null))['then'](function(_0x59f637){if(_0x59f637){_0xef3abe=_0x59f637;_0x1da4b3[_0x0f65('0x42')]=_[_0x0f65('0x44')](db[_0x0f65('0x77')]['rawAttributes']);_0x1da4b3[_0x0f65('0x43')]=_[_0x0f65('0x44')](_0x255116[_0x0f65('0x43')]);_0x1da4b3[_0x0f65('0x45')]=_[_0x0f65('0x46')](_0x1da4b3['model'],_0x1da4b3[_0x0f65('0x43')]);_0x41fc60[_0x0f65('0x47')]=_[_0x0f65('0x46')](_0x1da4b3[_0x0f65('0x42')],qs[_0x0f65('0x48')](_0x255116[_0x0f65('0x43')][_0x0f65('0x48')]));_0x41fc60[_0x0f65('0x47')]=_0x41fc60[_0x0f65('0x47')]['length']?_0x41fc60[_0x0f65('0x47')]:_0x1da4b3['model'];_0x41fc60[_0x0f65('0x4a')]=qs[_0x0f65('0x4b')](_0x255116[_0x0f65('0x43')][_0x0f65('0x4b')]);_0x41fc60['where']=qs[_0x0f65('0x45')](_[_0x0f65('0x4d')](_0x255116[_0x0f65('0x43')],_0x1da4b3[_0x0f65('0x45')]));if(_0x255116['query'][_0x0f65('0x4e')]){_0x41fc60[_0x0f65('0x4c')]=_['merge'](_0x41fc60[_0x0f65('0x4c')],{'$or':_[_0x0f65('0x4f')](_0x41fc60[_0x0f65('0x47')],function(_0x4f8d23){var _0x425713={};_0x425713[_0x4f8d23]={'$like':'%'+_0x255116[_0x0f65('0x43')]['filter']+'%'};return _0x425713;})});}_0x41fc60=_[_0x0f65('0x51')]({},_0x41fc60,_0x255116['options']);return _0xef3abe[_0x0f65('0x76')](_0x41fc60);}})[_0x0f65('0x22')](function(_0xf2f894){if(_0xf2f894){_0x27598d=_0xf2f894['length'];if(!_0x255116[_0x0f65('0x43')]['hasOwnProperty']('nolimit')){_0x41fc60[_0x0f65('0x32')]=qs[_0x0f65('0x32')](_0x255116[_0x0f65('0x43')][_0x0f65('0x32')]);_0x41fc60[_0x0f65('0x30')]=qs['offset'](_0x255116[_0x0f65('0x43')][_0x0f65('0x30')]);}return _0xef3abe[_0x0f65('0x76')](_0x41fc60);}})[_0x0f65('0x22')](function(_0x2d1349){if(_0x2d1349){return _0x2d1349?{'count':_0x27598d,'rows':_0x2d1349}:null;}})['then'](respondWithResult(_0xf0b588,null))[_0x0f65('0x59')](handleError(_0xf0b588,null));};exports[_0x0f65('0x78')]=function(_0x51e964,_0x15b351,_0x38f71e){var _0x19e229=_0x51e964['body'][_0x0f65('0x79')];return db[_0x0f65('0x77')][_0x0f65('0x6b')]({'where':{'id':_0x19e229},'attributes':['id'],'include':[{'model':db[_0x0f65('0x6c')],'as':'Agents','attributes':['id',_0x0f65('0x3b'),'online','voicePause','interface'],'raw':!![]}]})[_0x0f65('0x22')](function(_0x446192){if(_0x446192){var _0x59a57a=_[_0x0f65('0x7a')](_0x446192,function(_0x222b20){var _0x292f1c=_0x222b20[_0x0f65('0x5c')]({'plain':!![]});return _0x292f1c[_0x0f65('0x7b')];});return db[_0x0f65('0x3d')][_0x0f65('0x58')]({'where':{'id':_0x51e964[_0x0f65('0x56')]['id']}})['then'](function(_0x422965){return db[_0x0f65('0x7c')][_0x0f65('0x7d')](function(_0x3e8f95){return _0x422965['addTeams'](_0x19e229,{'transaction':_0x3e8f95})['then'](function(){return BPromise[_0x0f65('0x7e')](_0x59a57a,function(_0x4abc9b){return db[_0x0f65('0x69')][_0x0f65('0x7f')]({'where':{'UserId':_0x4abc9b['id'],'ChatQueueId':_0x51e964['params']['id']},'transaction':_0x3e8f95});});})['then'](function(){_0x59a57a[_0x0f65('0x80')](function(_0x11685e){socket[_0x0f65('0x81')]('userChatQueue:save',{'UserId':_0x11685e['id'],'ChatQueueId':_0x422965['id']});});});});});}})[_0x0f65('0x22')](respondWithStatusCode(_0x15b351,null))[_0x0f65('0x59')](handleError(_0x15b351,null));};exports[_0x0f65('0x82')]=function(_0x37e056,_0x235912,_0x58867f){return db[_0x0f65('0x77')][_0x0f65('0x6b')]({'where':{'id':_0x37e056[_0x0f65('0x43')][_0x0f65('0x79')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0f65('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x235912,null))[_0x0f65('0x22')](function(_0x9119c5){var _0x225c29=_[_0x0f65('0x4f')](_0x9119c5,'id');var _0x5cee0b=[];var _0x5eaef3=[];var _0x40f4c1=squel[_0x0f65('0x83')]();_0x40f4c1['field'](_0x0f65('0x84'))['from'](_0x0f65('0x85'),'tq')['join'](_0x0f65('0x86'),'ut',_0x0f65('0x87'))[_0x0f65('0x4c')](_0x0f65('0x88'),_0x37e056[_0x0f65('0x56')]['id']);for(var _0x562961=0x0;_0x562961<_0x9119c5[_0x0f65('0x49')];_0x562961+=0x1){let _0x53c52d=_0x9119c5[_0x562961];for(var _0x45d0f9=0x0;_0x45d0f9<_0x53c52d[_0x0f65('0x7b')]['length'];_0x45d0f9+=0x1){let _0x1ca203=_0x53c52d[_0x0f65('0x7b')][_0x45d0f9];var _0x5d941d=_0x40f4c1[_0x0f65('0x89')]();_0x5d941d[_0x0f65('0x4c')](_0x0f65('0x8a'),_0x1ca203['id']);_0x5eaef3[_0x0f65('0x8b')](db[_0x0f65('0x7c')][_0x0f65('0x43')](_0x5d941d['toString'](),{'type':db[_0x0f65('0x7c')][_0x0f65('0x8c')][_0x0f65('0x8d')]})[_0x0f65('0x22')](function(_0x20b214){if(_0x20b214[_0x0f65('0x49')]===0x1){return _0x1ca203['id'];}else{var _0x4a0cd9=_[_0x0f65('0x8e')](_[_0x0f65('0x4f')](_0x20b214,_0x0f65('0x8f')),function(_0xd61aa5){return _[_0x0f65('0x90')](_0x225c29,_0xd61aa5);});if(_0x4a0cd9){return _0x1ca203['id'];}}}));}}return BPromise[_0x0f65('0x91')](_0x5eaef3)[_0x0f65('0x22')](function(_0x164e2d){_0x5cee0b=_(_0x5cee0b)['union'](_0x164e2d)[_0x0f65('0x92')]()['value']();return db['ChatQueue'][_0x0f65('0x58')]({'where':{'id':_0x37e056[_0x0f65('0x56')]['id']}})['then'](function(_0x3ba48f){return db[_0x0f65('0x7c')][_0x0f65('0x7d')](function(_0x25be46){return _0x3ba48f[_0x0f65('0x82')](_0x37e056['query']['ids'],{'transaction':_0x25be46})[_0x0f65('0x22')](function(){if(!_['isEmpty'](_0x5cee0b)){return _0x3ba48f[_0x0f65('0x93')](_0x5cee0b,{'transaction':_0x25be46});}})['then'](function(){_0x5cee0b[_0x0f65('0x80')](function(_0x2b9b4d){socket[_0x0f65('0x81')](_0x0f65('0x94'),{'UserId':_0x2b9b4d,'ChatQueueId':_0x3ba48f['id']});});});});});});})['then'](respondWithStatusCode(_0x235912,null))['catch'](handleError(_0x235912,null));};exports[_0x0f65('0x95')]=function(_0xbb57ad,_0x2d2fa6,_0x1cd0ee){return db[_0x0f65('0x3d')]['find']({'where':{'id':_0xbb57ad[_0x0f65('0x56')]['id']}})[_0x0f65('0x22')](handleEntityNotFound(_0x2d2fa6,null))[_0x0f65('0x22')](function(_0xe2e934){if(_0xe2e934){return _0xe2e934[_0x0f65('0x95')](_0xbb57ad['body'][_0x0f65('0x79')],_['omit'](_0xbb57ad[_0x0f65('0x65')],[_0x0f65('0x79'),'id'])||{})[_0x0f65('0x96')](function(_0x56f35a){for(var _0x4f6191=0x0;_0x4f6191<_0xbb57ad['body'][_0x0f65('0x79')]['length'];_0x4f6191+=0x1){socket[_0x0f65('0x81')](_0x0f65('0x97'),{'UserId':Number(_0xbb57ad['body'][_0x0f65('0x79')][_0x4f6191]),'ChatQueueId':Number(_0xbb57ad[_0x0f65('0x56')]['id'])});}return _0x56f35a;});}})['then'](respondWithResult(_0x2d2fa6,null))['catch'](handleError(_0x2d2fa6,null));};exports['removeAgents']=function(_0x407438,_0x1358bb,_0x38fbb9){return db[_0x0f65('0x3d')][_0x0f65('0x58')]({'where':{'id':_0x407438[_0x0f65('0x56')]['id']}})[_0x0f65('0x22')](handleEntityNotFound(_0x1358bb,null))['then'](function(_0x29bf85){if(_0x29bf85){return _0x29bf85[_0x0f65('0x93')](_0x407438[_0x0f65('0x43')]['ids'])[_0x0f65('0x22')](function(){if(_[_0x0f65('0x98')](_0x407438[_0x0f65('0x43')]['ids'])){for(var _0xd7f856=0x0;_0xd7f856<_0x407438[_0x0f65('0x43')]['ids']['length'];_0xd7f856+=0x1){socket[_0x0f65('0x81')]('userChatQueue:remove',{'UserId':Number(_0x407438[_0x0f65('0x43')][_0x0f65('0x79')][_0xd7f856]),'ChatQueueId':Number(_0x407438[_0x0f65('0x56')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x407438['query'][_0x0f65('0x79')]),'ChatQueueId':Number(_0x407438['params']['id'])});}});}})[_0x0f65('0x22')](respondWithStatusCode(_0x1358bb,null))[_0x0f65('0x59')](handleError(_0x1358bb,null));};exports[_0x0f65('0x99')]=function(_0x34a5d6,_0x39847d,_0x43559c){var _0x6a1f22={};var _0x133a71={};var _0x2898bc;var _0x5de31c;return db[_0x0f65('0x3d')][_0x0f65('0x68')]({'where':{'id':_0x34a5d6[_0x0f65('0x56')]['id']}})['then'](handleEntityNotFound(_0x39847d,null))['then'](function(_0x5ea9e1){if(_0x5ea9e1){_0x2898bc=_0x5ea9e1;_0x133a71[_0x0f65('0x42')]=_[_0x0f65('0x44')](db[_0x0f65('0x6c')][_0x0f65('0x3e')]);_0x133a71[_0x0f65('0x43')]=_[_0x0f65('0x44')](_0x34a5d6['query']);_0x133a71[_0x0f65('0x45')]=_[_0x0f65('0x46')](_0x133a71[_0x0f65('0x42')],_0x133a71[_0x0f65('0x43')]);_0x6a1f22['attributes']=_[_0x0f65('0x46')](_0x133a71['model'],qs[_0x0f65('0x48')](_0x34a5d6['query']['fields']));_0x6a1f22[_0x0f65('0x47')]=_0x6a1f22[_0x0f65('0x47')][_0x0f65('0x49')]?_0x6a1f22[_0x0f65('0x47')]:_0x133a71[_0x0f65('0x42')];_0x6a1f22[_0x0f65('0x4a')]=qs[_0x0f65('0x4b')](_0x34a5d6['query']['sort']);_0x6a1f22[_0x0f65('0x4c')]=qs[_0x0f65('0x45')](_['pick'](_0x34a5d6['query'],_0x133a71[_0x0f65('0x45')]));if(_0x34a5d6[_0x0f65('0x43')][_0x0f65('0x4e')]){_0x6a1f22[_0x0f65('0x4c')]=_[_0x0f65('0x51')](_0x6a1f22[_0x0f65('0x4c')],{'$or':_[_0x0f65('0x4f')](_0x6a1f22['attributes'],function(_0x3810f2){var _0xa09e42={};_0xa09e42[_0x3810f2]={'$like':'%'+_0x34a5d6[_0x0f65('0x43')][_0x0f65('0x4e')]+'%'};return _0xa09e42;})});}_0x6a1f22=_[_0x0f65('0x51')]({},_0x6a1f22,_0x34a5d6['options']);return _0x2898bc[_0x0f65('0x99')](_0x6a1f22);}})[_0x0f65('0x22')](function(_0x1ba175){if(_0x1ba175){_0x5de31c=_0x1ba175[_0x0f65('0x49')];if(!_0x34a5d6[_0x0f65('0x43')][_0x0f65('0x9a')](_0x0f65('0x6a'))){_0x6a1f22[_0x0f65('0x32')]=qs['limit'](_0x34a5d6[_0x0f65('0x43')][_0x0f65('0x32')]);_0x6a1f22['offset']=qs['offset'](_0x34a5d6[_0x0f65('0x43')][_0x0f65('0x30')]);}return _0x2898bc[_0x0f65('0x99')](_0x6a1f22);}})[_0x0f65('0x22')](function(_0x19d67e){if(_0x19d67e){return _0x19d67e?{'count':_0x5de31c,'rows':_0x19d67e}:null;}})['then'](respondWithResult(_0x39847d,null))['catch'](handleError(_0x39847d,null));}; \ No newline at end of file +var _0x1a21=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','show','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','agent','updatedAt','createdAt','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','User','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','value','sequelize','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf'];(function(_0x1e79a0,_0x336c84){var _0x2805da=function(_0x4e1397){while(--_0x4e1397){_0x1e79a0['push'](_0x1e79a0['shift']());}};_0x2805da(++_0x336c84);}(_0x1a21,0x1bd));var _0x11a2=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0x1a21[_0x1d30a3];return _0x32bba1;};'use strict';var emlformat=require(_0x11a2('0x0'));var rimraf=require(_0x11a2('0x1'));var zipdir=require(_0x11a2('0x2'));var jsonpatch=require(_0x11a2('0x3'));var rp=require(_0x11a2('0x4'));var moment=require(_0x11a2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x11a2('0x6'));var util=require('util');var path=require(_0x11a2('0x7'));var sox=require(_0x11a2('0x8'));var csv=require(_0x11a2('0x9'));var ejs=require(_0x11a2('0xa'));var fs=require('fs');var fs_extra=require(_0x11a2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x11a2('0xc'));var deskjs=require(_0x11a2('0xd'));var toCsv=require(_0x11a2('0x9'));var querystring=require('querystring');var Papa=require(_0x11a2('0xe'));var Redis=require(_0x11a2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x11a2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11a2('0x11'));var logger=require(_0x11a2('0x12'))(_0x11a2('0x13'));var utils=require(_0x11a2('0x14'));var config=require(_0x11a2('0x15'));var licenseUtil=require(_0x11a2('0x16'));var db=require('../../mysqldb')['db'];config[_0x11a2('0x17')]=_[_0x11a2('0x18')](config[_0x11a2('0x17')],{'host':_0x11a2('0x19'),'port':0x18eb});var socket=require(_0x11a2('0x1a'))(new Redis(config[_0x11a2('0x17')]));require(_0x11a2('0x1b'))[_0x11a2('0x1c')](socket);var jayson=require(_0x11a2('0x1d'));var client=jayson[_0x11a2('0x1e')][_0x11a2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x33b592,_0x65dac5,_0x146774,_0x3c9588){return new BPromise(function(_0xde182b,_0x5575c4){var _0x2731cc=_0x3c9588||client;return _0x2731cc[_0x11a2('0x20')](_0x33b592,_0x146774)[_0x11a2('0x21')](function(_0x28b934){logger['info'](_0x11a2('0x22'),_0x65dac5,_0x11a2('0x23'));logger[_0x11a2('0x24')](_0x11a2('0x25'),_0x65dac5,_0x11a2('0x23'),JSON[_0x11a2('0x26')](_0x28b934));if(_0x28b934[_0x11a2('0x27')]){if(_0x28b934['error'][_0x11a2('0x28')]===0x1f4){logger['error'](_0x11a2('0x22'),_0x65dac5,_0x28b934['error']['message']);return _0x5575c4(_0x28b934['error'][_0x11a2('0x29')]);}logger[_0x11a2('0x27')](_0x11a2('0x22'),_0x65dac5,_0x28b934[_0x11a2('0x27')][_0x11a2('0x29')]);return _0xde182b(_0x28b934[_0x11a2('0x27')][_0x11a2('0x29')]);}else{logger[_0x11a2('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x65dac5,_0x11a2('0x23'));_0xde182b(_0x28b934[_0x11a2('0x2b')][_0x11a2('0x29')]);}})[_0x11a2('0x2c')](function(_0x57b73c){logger[_0x11a2('0x27')](_0x11a2('0x22'),_0x65dac5,_0x57b73c);_0x5575c4(_0x57b73c);});});}function respondWithStatusCode(_0x1edf0c,_0x4906a5){_0x4906a5=_0x4906a5||0xcc;return function(_0x18dfb3){if(_0x18dfb3){return _0x1edf0c[_0x11a2('0x2d')](_0x4906a5);}return _0x1edf0c[_0x11a2('0x2e')](_0x4906a5)[_0x11a2('0x2f')]();};}function respondWithResult(_0x1c4703,_0x2b4537){_0x2b4537=_0x2b4537||0xc8;return function(_0x52d537){if(_0x52d537){return _0x1c4703[_0x11a2('0x2e')](_0x2b4537)[_0x11a2('0x30')](_0x52d537);}};}function respondWithFilteredResult(_0x6db9ca,_0xa8b874){return function(_0x5a0f0f){if(_0x5a0f0f){var _0x1c35ab=typeof _0xa8b874['offset']===_0x11a2('0x31')&&typeof _0xa8b874[_0x11a2('0x32')]===_0x11a2('0x31');var _0x2b6a8a=_0x5a0f0f[_0x11a2('0x33')];var _0x44d561=_0x1c35ab?0x0:_0xa8b874[_0x11a2('0x34')];var _0x59e8f1=_0x1c35ab?_0x5a0f0f[_0x11a2('0x33')]:_0xa8b874[_0x11a2('0x34')]+_0xa8b874['limit'];var _0x4712ad;if(_0x59e8f1>=_0x2b6a8a){_0x59e8f1=_0x2b6a8a;_0x4712ad=0xc8;}else{_0x4712ad=0xce;}_0x6db9ca[_0x11a2('0x2e')](_0x4712ad);return _0x6db9ca[_0x11a2('0x35')](_0x11a2('0x36'),_0x44d561+'-'+_0x59e8f1+'/'+_0x2b6a8a)['json'](_0x5a0f0f);}return null;};}function patchUpdates(_0x54b60e){return function(_0x543d8e){try{jsonpatch[_0x11a2('0x37')](_0x543d8e,_0x54b60e,!![]);}catch(_0x433139){return BPromise[_0x11a2('0x38')](_0x433139);}return _0x543d8e[_0x11a2('0x39')]();};}function saveUpdates(_0x1ffb8c,_0x50c411){return function(_0x4ffac0){if(_0x4ffac0){return _0x4ffac0[_0x11a2('0x3a')](_0x1ffb8c)[_0x11a2('0x21')](function(_0x457e32){return _0x457e32;});}return null;};}function removeEntity(_0x2e15e9,_0x1ad4fb){return function(_0x39b544){if(_0x39b544){return _0x39b544[_0x11a2('0x3b')]()[_0x11a2('0x21')](function(){var _0x1f273d=_0x39b544[_0x11a2('0x3c')]({'plain':!![]});var _0x29c8fe=_0x11a2('0x3d');return db[_0x11a2('0x3e')][_0x11a2('0x3b')]({'where':{'type':_0x29c8fe,'resourceId':_0x1f273d['id']}})[_0x11a2('0x21')](function(){return _0x39b544;});})[_0x11a2('0x21')](function(){_0x2e15e9[_0x11a2('0x2e')](0xcc)[_0x11a2('0x2f')]();});}};}function handleEntityNotFound(_0x427e51,_0x147775){return function(_0x3d376f){if(!_0x3d376f){_0x427e51[_0x11a2('0x2d')](0x194);}return _0x3d376f;};}function handleError(_0x372fe8,_0x41653){_0x41653=_0x41653||0x1f4;return function(_0x2af8a9){logger[_0x11a2('0x27')](_0x2af8a9[_0x11a2('0x3f')]);if(_0x2af8a9[_0x11a2('0x40')]){delete _0x2af8a9['name'];}_0x372fe8[_0x11a2('0x2e')](_0x41653)[_0x11a2('0x41')](_0x2af8a9);};}exports['index']=function(_0x52748c,_0x444cad){var _0xb1fda1={},_0x26e380={},_0x6a1bd7={'count':0x0,'rows':[]};var _0x3d0a5d=_[_0x11a2('0x42')](db[_0x11a2('0x43')][_0x11a2('0x44')],function(_0x3af557){return{'name':_0x3af557[_0x11a2('0x45')],'type':_0x3af557[_0x11a2('0x46')][_0x11a2('0x47')]};});_0x26e380[_0x11a2('0x48')]=_[_0x11a2('0x42')](_0x3d0a5d,_0x11a2('0x40'));_0x26e380['query']=_[_0x11a2('0x49')](_0x52748c[_0x11a2('0x4a')]);_0x26e380[_0x11a2('0x4b')]=_[_0x11a2('0x4c')](_0x26e380[_0x11a2('0x48')],_0x26e380[_0x11a2('0x4a')]);_0xb1fda1[_0x11a2('0x4d')]=_[_0x11a2('0x4c')](_0x26e380['model'],qs['fields'](_0x52748c[_0x11a2('0x4a')]['fields']));_0xb1fda1[_0x11a2('0x4d')]=_0xb1fda1[_0x11a2('0x4d')][_0x11a2('0x4e')]?_0xb1fda1[_0x11a2('0x4d')]:_0x26e380[_0x11a2('0x48')];if(!_0x52748c[_0x11a2('0x4a')][_0x11a2('0x4f')](_0x11a2('0x50'))){_0xb1fda1['limit']=qs['limit'](_0x52748c[_0x11a2('0x4a')]['limit']);_0xb1fda1[_0x11a2('0x34')]=qs[_0x11a2('0x34')](_0x52748c[_0x11a2('0x4a')][_0x11a2('0x34')]);}_0xb1fda1['order']=qs[_0x11a2('0x51')](_0x52748c[_0x11a2('0x4a')][_0x11a2('0x51')]);_0xb1fda1['where']=qs[_0x11a2('0x4b')](_[_0x11a2('0x52')](_0x52748c[_0x11a2('0x4a')],_0x26e380[_0x11a2('0x4b')]),_0x3d0a5d);if(_0x52748c['query'][_0x11a2('0x53')]){_0xb1fda1[_0x11a2('0x54')]=_[_0x11a2('0x55')](_0xb1fda1[_0x11a2('0x54')],{'$or':_[_0x11a2('0x42')](_0x3d0a5d,function(_0x78aa0f){if(_0x78aa0f[_0x11a2('0x46')]!=='VIRTUAL'){var _0x2cd18f={};_0x2cd18f[_0x78aa0f['name']]={'$like':'%'+_0x52748c[_0x11a2('0x4a')][_0x11a2('0x53')]+'%'};return _0x2cd18f;}})});}_0xb1fda1=_[_0x11a2('0x55')]({},_0xb1fda1,_0x52748c[_0x11a2('0x56')]);var _0x7e692b={'where':_0xb1fda1['where']};return db[_0x11a2('0x43')]['count'](_0x7e692b)[_0x11a2('0x21')](function(_0x369da5){_0x6a1bd7[_0x11a2('0x33')]=_0x369da5;if(_0x52748c[_0x11a2('0x4a')]['includeAll']){_0xb1fda1[_0x11a2('0x57')]=[{'all':!![]}];}return db['ChatQueue'][_0x11a2('0x58')](_0xb1fda1);})[_0x11a2('0x21')](function(_0x372825){_0x6a1bd7[_0x11a2('0x59')]=_0x372825;return _0x6a1bd7;})[_0x11a2('0x21')](respondWithFilteredResult(_0x444cad,_0xb1fda1))[_0x11a2('0x2c')](handleError(_0x444cad,null));};exports[_0x11a2('0x5a')]=function(_0x330410,_0x4670ee){var _0x51f375={'raw':!![],'where':{'id':_0x330410['params']['id']}},_0x697a0f={};_0x697a0f[_0x11a2('0x48')]=_[_0x11a2('0x49')](db[_0x11a2('0x43')][_0x11a2('0x44')]);_0x697a0f[_0x11a2('0x4a')]=_[_0x11a2('0x49')](_0x330410[_0x11a2('0x4a')]);_0x697a0f[_0x11a2('0x4b')]=_[_0x11a2('0x4c')](_0x697a0f[_0x11a2('0x48')],_0x697a0f[_0x11a2('0x4a')]);_0x51f375[_0x11a2('0x4d')]=_[_0x11a2('0x4c')](_0x697a0f[_0x11a2('0x48')],qs[_0x11a2('0x5b')](_0x330410[_0x11a2('0x4a')]['fields']));_0x51f375[_0x11a2('0x4d')]=_0x51f375['attributes'][_0x11a2('0x4e')]?_0x51f375[_0x11a2('0x4d')]:_0x697a0f[_0x11a2('0x48')];if(_0x330410[_0x11a2('0x4a')][_0x11a2('0x5c')]){_0x51f375[_0x11a2('0x57')]=[{'all':!![]}];}_0x51f375=_['merge']({},_0x51f375,_0x330410[_0x11a2('0x56')]);return db[_0x11a2('0x43')][_0x11a2('0x5d')](_0x51f375)[_0x11a2('0x21')](handleEntityNotFound(_0x4670ee,null))[_0x11a2('0x21')](respondWithResult(_0x4670ee,null))['catch'](handleError(_0x4670ee,null));};exports[_0x11a2('0x5e')]=function(_0x4afec4,_0x113f9c){return db['ChatQueue'][_0x11a2('0x5e')](_0x4afec4[_0x11a2('0x5f')],{})[_0x11a2('0x21')](function(_0x3e6156){var _0x3ecd78=_0x4afec4[_0x11a2('0x60')][_0x11a2('0x3c')]({'plain':!![]});if(!_0x3ecd78)throw new Error(_0x11a2('0x61'));if(_0x3ecd78['role']==='user'){var _0x4a5e64=_0x3e6156[_0x11a2('0x3c')]({'plain':!![]});var _0x3a8eec='ChatQueues';return db['UserProfileSection'][_0x11a2('0x5d')]({'where':{'name':_0x3a8eec,'userProfileId':_0x3ecd78['userProfileId']},'raw':!![]})[_0x11a2('0x21')](function(_0x109838){if(_0x109838&&_0x109838[_0x11a2('0x62')]===0x0){return db[_0x11a2('0x3e')][_0x11a2('0x5e')]({'name':_0x4a5e64['name'],'resourceId':_0x4a5e64['id'],'type':_0x109838[_0x11a2('0x40')],'sectionId':_0x109838['id']},{})[_0x11a2('0x21')](function(){return _0x3e6156;});}else{return _0x3e6156;}})[_0x11a2('0x2c')](function(_0x4d4079){logger['error'](_0x11a2('0x63'),_0x4d4079);throw _0x4d4079;});}return _0x3e6156;})[_0x11a2('0x21')](respondWithResult(_0x113f9c,0xc9))[_0x11a2('0x2c')](handleError(_0x113f9c,null));};exports[_0x11a2('0x3a')]=function(_0x4154d1,_0x34b7b1){if(_0x4154d1['body']['id']){delete _0x4154d1[_0x11a2('0x5f')]['id'];}return db['ChatQueue'][_0x11a2('0x5d')]({'where':{'id':_0x4154d1['params']['id']}})[_0x11a2('0x21')](handleEntityNotFound(_0x34b7b1,null))[_0x11a2('0x21')](saveUpdates(_0x4154d1[_0x11a2('0x5f')],null))[_0x11a2('0x21')](respondWithResult(_0x34b7b1,null))[_0x11a2('0x2c')](handleError(_0x34b7b1,null));};exports[_0x11a2('0x3b')]=function(_0x29e7c9,_0x45deef){return db[_0x11a2('0x43')]['find']({'where':{'id':_0x29e7c9[_0x11a2('0x64')]['id']}})[_0x11a2('0x21')](handleEntityNotFound(_0x45deef,null))[_0x11a2('0x21')](removeEntity(_0x45deef,null))['catch'](handleError(_0x45deef,null));};exports[_0x11a2('0x65')]=function(_0x4e5a4d,_0x6c15ac){return db[_0x11a2('0x43')][_0x11a2('0x65')]()['then'](respondWithResult(_0x6c15ac,null))[_0x11a2('0x2c')](handleError(_0x6c15ac,null));};exports[_0x11a2('0x66')]=function(_0x2625a3,_0x24f12b,_0x2864c5){var _0x4e2efa={'raw':!![],'where':{}},_0x3c8bd0={},_0x54d8d1;return db[_0x11a2('0x43')][_0x11a2('0x67')]({'where':{'id':_0x2625a3['params']['id']}})[_0x11a2('0x21')](handleEntityNotFound(_0x24f12b,null))['then'](function(_0x457e1f){if(_0x457e1f){_0x54d8d1=_0x457e1f[_0x11a2('0x3c')]({'plain':!![]});_0x3c8bd0['model']=_['keys'](db[_0x11a2('0x68')][_0x11a2('0x44')]);_0x3c8bd0['query']=_[_0x11a2('0x49')](_0x2625a3['query']);_0x3c8bd0[_0x11a2('0x4b')]=_[_0x11a2('0x4c')](_0x3c8bd0['model'],_0x3c8bd0[_0x11a2('0x4a')]);_0x4e2efa['attributes']=_[_0x11a2('0x4c')](_0x3c8bd0[_0x11a2('0x48')],qs[_0x11a2('0x5b')](_0x2625a3[_0x11a2('0x4a')]['fields']));_0x4e2efa[_0x11a2('0x4d')]=_0x4e2efa[_0x11a2('0x4d')][_0x11a2('0x4e')]?_0x4e2efa['attributes']:_0x3c8bd0[_0x11a2('0x48')];if(!_0x2625a3[_0x11a2('0x4a')][_0x11a2('0x4f')](_0x11a2('0x50'))){_0x4e2efa['limit']=qs[_0x11a2('0x32')](_0x2625a3[_0x11a2('0x4a')][_0x11a2('0x32')]);_0x4e2efa[_0x11a2('0x34')]=qs[_0x11a2('0x34')](_0x2625a3[_0x11a2('0x4a')]['offset']);}_0x4e2efa[_0x11a2('0x69')]=qs['sort'](_0x2625a3['query'][_0x11a2('0x51')]);_0x4e2efa[_0x11a2('0x54')]=qs[_0x11a2('0x4b')](_[_0x11a2('0x52')](_0x2625a3[_0x11a2('0x4a')],_0x3c8bd0[_0x11a2('0x4b')]));_0x4e2efa[_0x11a2('0x54')][_0x11a2('0x6a')]=_0x457e1f['id'];if(_0x2625a3[_0x11a2('0x4a')][_0x11a2('0x53')]){_0x4e2efa[_0x11a2('0x54')]=_[_0x11a2('0x55')](_0x4e2efa[_0x11a2('0x54')],{'$or':_['map'](_0x4e2efa[_0x11a2('0x4d')],function(_0x9ca496){var _0x51265b={};_0x51265b[_0x9ca496]={'$like':'%'+_0x2625a3[_0x11a2('0x4a')][_0x11a2('0x53')]+'%'};return _0x51265b;})});}_0x4e2efa=_['merge']({},_0x4e2efa,_0x2625a3['options']);return db['UserChatQueue']['findAll'](_0x4e2efa);}})[_0x11a2('0x21')](function(_0x308cbe){if(_0x308cbe){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x308cbe,'UserId'),'role':_0x11a2('0x6b')},'attributes':['id',_0x11a2('0x40'),'chatPause',_0x11a2('0x6c'),_0x11a2('0x6d')]});}})['then'](function(_0x178f8e){if(_0x178f8e){return{'count':_0x178f8e[_0x11a2('0x33')],'rows':_[_0x11a2('0x42')](_0x178f8e['rows'],function(_0x436cea){return{'membername':_0x436cea['name'],'UserId':_0x436cea['id'],'queue_name':_0x54d8d1[_0x11a2('0x40')],'ChatQueueId':_0x54d8d1['id'],'interface':util['format'](_0x11a2('0x6e'),_0x11a2('0x6f'),_0x436cea[_0x11a2('0x40')]),'penalty':0x0,'paused':_0x436cea[_0x11a2('0x70')],'createdAt':_0x436cea['createdAt'],'updatedAt':_0x436cea[_0x11a2('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x11a2('0x21')](respondWithFilteredResult(_0x24f12b,_0x4e2efa))[_0x11a2('0x2c')](handleError(_0x24f12b,null));};exports[_0x11a2('0x71')]=function(_0x1ef96d,_0x4fb857,_0x1a8b5b){var _0x102e41={};var _0x164492={};var _0x548359;var _0x1cbc4f;return db[_0x11a2('0x43')][_0x11a2('0x67')]({'where':{'id':_0x1ef96d[_0x11a2('0x64')]['id']}})['then'](handleEntityNotFound(_0x4fb857,null))['then'](function(_0xbe4b5f){if(_0xbe4b5f){_0x548359=_0xbe4b5f;_0x164492['model']=_[_0x11a2('0x49')](db[_0x11a2('0x72')]['rawAttributes']);_0x164492[_0x11a2('0x4a')]=_[_0x11a2('0x49')](_0x1ef96d['query']);_0x164492[_0x11a2('0x4b')]=_[_0x11a2('0x4c')](_0x164492[_0x11a2('0x48')],_0x164492[_0x11a2('0x4a')]);_0x102e41[_0x11a2('0x4d')]=_['intersection'](_0x164492[_0x11a2('0x48')],qs['fields'](_0x1ef96d[_0x11a2('0x4a')]['fields']));_0x102e41[_0x11a2('0x4d')]=_0x102e41[_0x11a2('0x4d')][_0x11a2('0x4e')]?_0x102e41[_0x11a2('0x4d')]:_0x164492[_0x11a2('0x48')];_0x102e41[_0x11a2('0x69')]=qs[_0x11a2('0x51')](_0x1ef96d[_0x11a2('0x4a')][_0x11a2('0x51')]);_0x102e41[_0x11a2('0x54')]=qs[_0x11a2('0x4b')](_['pick'](_0x1ef96d[_0x11a2('0x4a')],_0x164492[_0x11a2('0x4b')]));if(_0x1ef96d['query'][_0x11a2('0x53')]){_0x102e41[_0x11a2('0x54')]=_[_0x11a2('0x55')](_0x102e41[_0x11a2('0x54')],{'$or':_[_0x11a2('0x42')](_0x102e41['attributes'],function(_0x45e4a0){var _0x27cf48={};_0x27cf48[_0x45e4a0]={'$like':'%'+_0x1ef96d[_0x11a2('0x4a')][_0x11a2('0x53')]+'%'};return _0x27cf48;})});}_0x102e41=_[_0x11a2('0x55')]({},_0x102e41,_0x1ef96d['options']);return _0x548359[_0x11a2('0x71')](_0x102e41);}})['then'](function(_0x574183){if(_0x574183){_0x1cbc4f=_0x574183[_0x11a2('0x4e')];if(!_0x1ef96d[_0x11a2('0x4a')]['hasOwnProperty'](_0x11a2('0x50'))){_0x102e41[_0x11a2('0x32')]=qs[_0x11a2('0x32')](_0x1ef96d['query'][_0x11a2('0x32')]);_0x102e41['offset']=qs[_0x11a2('0x34')](_0x1ef96d[_0x11a2('0x4a')][_0x11a2('0x34')]);}return _0x548359[_0x11a2('0x71')](_0x102e41);}})[_0x11a2('0x21')](function(_0x5f511c){if(_0x5f511c){return _0x5f511c?{'count':_0x1cbc4f,'rows':_0x5f511c}:null;}})['then'](respondWithResult(_0x4fb857,null))['catch'](handleError(_0x4fb857,null));};exports[_0x11a2('0x73')]=function(_0x98ec1,_0x4c4373,_0x1cb630){var _0xc7ae43=_0x98ec1[_0x11a2('0x5f')][_0x11a2('0x74')];return db[_0x11a2('0x72')][_0x11a2('0x58')]({'where':{'id':_0xc7ae43},'attributes':['id'],'include':[{'model':db[_0x11a2('0x75')],'as':'Agents','attributes':['id',_0x11a2('0x40'),'online',_0x11a2('0x76'),_0x11a2('0x77')],'raw':!![]}]})[_0x11a2('0x21')](function(_0x27dea2){if(_0x27dea2){var _0x183c10=_[_0x11a2('0x78')](_0x27dea2,function(_0x37b2f1){var _0x1bcd49=_0x37b2f1[_0x11a2('0x3c')]({'plain':!![]});return _0x1bcd49[_0x11a2('0x79')];});return db[_0x11a2('0x43')][_0x11a2('0x5d')]({'where':{'id':_0x98ec1[_0x11a2('0x64')]['id']}})[_0x11a2('0x21')](function(_0x92f9f){return db['sequelize'][_0x11a2('0x7a')](function(_0x63efee){return _0x92f9f[_0x11a2('0x73')](_0xc7ae43,{'transaction':_0x63efee})[_0x11a2('0x21')](function(){return BPromise[_0x11a2('0x7b')](_0x183c10,function(_0x210e1f){return db[_0x11a2('0x68')][_0x11a2('0x7c')]({'where':{'UserId':_0x210e1f['id'],'ChatQueueId':_0x98ec1[_0x11a2('0x64')]['id']},'transaction':_0x63efee});});})[_0x11a2('0x21')](function(){_0x183c10['forEach'](function(_0x33467a){socket[_0x11a2('0x7d')](_0x11a2('0x7e'),{'UserId':_0x33467a['id'],'ChatQueueId':_0x92f9f['id']});});});});});}})[_0x11a2('0x21')](respondWithStatusCode(_0x4c4373,null))[_0x11a2('0x2c')](handleError(_0x4c4373,null));};exports[_0x11a2('0x7f')]=function(_0x5c9c16,_0x59f5b8,_0x1396fb){return db[_0x11a2('0x72')][_0x11a2('0x58')]({'where':{'id':_0x5c9c16['query'][_0x11a2('0x74')]},'attributes':['id'],'include':[{'model':db[_0x11a2('0x75')],'as':_0x11a2('0x79'),'attributes':['id'],'raw':!![]}]})[_0x11a2('0x21')](handleEntityNotFound(_0x59f5b8,null))[_0x11a2('0x21')](function(_0x4bad9c){var _0x563e56=_['map'](_0x4bad9c,'id');var _0x35e33b=[];var _0x3c7936=[];var _0x455b29=squel['select']();_0x455b29[_0x11a2('0x80')]('tq.TeamId')['from']('team_has_chat_queues','tq')[_0x11a2('0x81')](_0x11a2('0x82'),'ut',_0x11a2('0x83'))['where']('ChatQueueId\x20=\x20?',_0x5c9c16[_0x11a2('0x64')]['id']);for(var _0x143464=0x0;_0x143464<_0x4bad9c['length'];_0x143464+=0x1){let _0x1bab79=_0x4bad9c[_0x143464];for(var _0x45be8e=0x0;_0x45be8e<_0x1bab79['Agents'][_0x11a2('0x4e')];_0x45be8e+=0x1){let _0x4df616=_0x1bab79['Agents'][_0x45be8e];var _0x3634e3=_0x455b29['clone']();_0x3634e3[_0x11a2('0x54')](_0x11a2('0x84'),_0x4df616['id']);_0x3c7936[_0x11a2('0x85')](db['sequelize'][_0x11a2('0x4a')](_0x3634e3['toString'](),{'type':db['sequelize'][_0x11a2('0x86')][_0x11a2('0x87')]})[_0x11a2('0x21')](function(_0x475854){if(_0x475854[_0x11a2('0x4e')]===0x1){return _0x4df616['id'];}else{var _0x781200=_[_0x11a2('0x88')](_[_0x11a2('0x42')](_0x475854,'TeamId'),function(_0x1a2ed5){return _[_0x11a2('0x89')](_0x563e56,_0x1a2ed5);});if(_0x781200){return _0x4df616['id'];}}}));}}return BPromise[_0x11a2('0x8a')](_0x3c7936)[_0x11a2('0x21')](function(_0x55582d){_0x35e33b=_(_0x35e33b)[_0x11a2('0x8b')](_0x55582d)['compact']()[_0x11a2('0x8c')]();return db[_0x11a2('0x43')]['find']({'where':{'id':_0x5c9c16[_0x11a2('0x64')]['id']}})[_0x11a2('0x21')](function(_0x39efc6){return db[_0x11a2('0x8d')][_0x11a2('0x7a')](function(_0x28e932){return _0x39efc6[_0x11a2('0x7f')](_0x5c9c16[_0x11a2('0x4a')][_0x11a2('0x74')],{'transaction':_0x28e932})[_0x11a2('0x21')](function(){if(!_['isEmpty'](_0x35e33b)){return _0x39efc6[_0x11a2('0x8e')](_0x35e33b,{'transaction':_0x28e932});}})['then'](function(){_0x35e33b['forEach'](function(_0x3904cb){socket[_0x11a2('0x7d')](_0x11a2('0x8f'),{'UserId':_0x3904cb,'ChatQueueId':_0x39efc6['id']});});});});});});})[_0x11a2('0x21')](respondWithStatusCode(_0x59f5b8,null))[_0x11a2('0x2c')](handleError(_0x59f5b8,null));};exports[_0x11a2('0x90')]=function(_0x38210d,_0x7ba53e,_0x46f463){return db[_0x11a2('0x43')][_0x11a2('0x5d')]({'where':{'id':_0x38210d['params']['id']}})['then'](handleEntityNotFound(_0x7ba53e,null))['then'](function(_0x3d8a6a){if(_0x3d8a6a){return _0x3d8a6a[_0x11a2('0x90')](_0x38210d[_0x11a2('0x5f')][_0x11a2('0x74')],_[_0x11a2('0x91')](_0x38210d[_0x11a2('0x5f')],[_0x11a2('0x74'),'id'])||{})[_0x11a2('0x92')](function(_0x47fc5c){for(var _0x23a23d=0x0;_0x23a23d<_0x38210d[_0x11a2('0x5f')][_0x11a2('0x74')]['length'];_0x23a23d+=0x1){socket[_0x11a2('0x7d')](_0x11a2('0x7e'),{'UserId':Number(_0x38210d[_0x11a2('0x5f')][_0x11a2('0x74')][_0x23a23d]),'ChatQueueId':Number(_0x38210d['params']['id'])});}return _0x47fc5c;});}})[_0x11a2('0x21')](respondWithResult(_0x7ba53e,null))[_0x11a2('0x2c')](handleError(_0x7ba53e,null));};exports['removeAgents']=function(_0x2b8353,_0x5840cb,_0x3b5e80){return db[_0x11a2('0x43')]['find']({'where':{'id':_0x2b8353[_0x11a2('0x64')]['id']}})[_0x11a2('0x21')](handleEntityNotFound(_0x5840cb,null))[_0x11a2('0x21')](function(_0x561084){if(_0x561084){return _0x561084['removeAgents'](_0x2b8353['query'][_0x11a2('0x74')])['then'](function(){if(_[_0x11a2('0x93')](_0x2b8353[_0x11a2('0x4a')][_0x11a2('0x74')])){for(var _0x488b13=0x0;_0x488b13<_0x2b8353['query'][_0x11a2('0x74')]['length'];_0x488b13+=0x1){socket[_0x11a2('0x7d')](_0x11a2('0x8f'),{'UserId':Number(_0x2b8353[_0x11a2('0x4a')][_0x11a2('0x74')][_0x488b13]),'ChatQueueId':Number(_0x2b8353[_0x11a2('0x64')]['id'])});}}else{socket[_0x11a2('0x7d')]('userChatQueue:remove',{'UserId':Number(_0x2b8353[_0x11a2('0x4a')][_0x11a2('0x74')]),'ChatQueueId':Number(_0x2b8353[_0x11a2('0x64')]['id'])});}});}})[_0x11a2('0x21')](respondWithStatusCode(_0x5840cb,null))[_0x11a2('0x2c')](handleError(_0x5840cb,null));};exports[_0x11a2('0x94')]=function(_0x51bcf2,_0x4b67cd,_0x2b03c8){var _0x1798ee={};var _0x3b1230={};var _0x466bfd;var _0x57d665;return db['ChatQueue']['findOne']({'where':{'id':_0x51bcf2['params']['id']}})[_0x11a2('0x21')](handleEntityNotFound(_0x4b67cd,null))[_0x11a2('0x21')](function(_0x14bc5d){if(_0x14bc5d){_0x466bfd=_0x14bc5d;_0x3b1230['model']=_[_0x11a2('0x49')](db['User'][_0x11a2('0x44')]);_0x3b1230['query']=_[_0x11a2('0x49')](_0x51bcf2[_0x11a2('0x4a')]);_0x3b1230[_0x11a2('0x4b')]=_[_0x11a2('0x4c')](_0x3b1230[_0x11a2('0x48')],_0x3b1230['query']);_0x1798ee[_0x11a2('0x4d')]=_[_0x11a2('0x4c')](_0x3b1230[_0x11a2('0x48')],qs[_0x11a2('0x5b')](_0x51bcf2['query'][_0x11a2('0x5b')]));_0x1798ee[_0x11a2('0x4d')]=_0x1798ee[_0x11a2('0x4d')][_0x11a2('0x4e')]?_0x1798ee[_0x11a2('0x4d')]:_0x3b1230['model'];_0x1798ee['order']=qs[_0x11a2('0x51')](_0x51bcf2[_0x11a2('0x4a')][_0x11a2('0x51')]);_0x1798ee['where']=qs['filters'](_['pick'](_0x51bcf2['query'],_0x3b1230['filters']));if(_0x51bcf2['query']['filter']){_0x1798ee['where']=_[_0x11a2('0x55')](_0x1798ee[_0x11a2('0x54')],{'$or':_[_0x11a2('0x42')](_0x1798ee['attributes'],function(_0x310550){var _0x3ac765={};_0x3ac765[_0x310550]={'$like':'%'+_0x51bcf2['query'][_0x11a2('0x53')]+'%'};return _0x3ac765;})});}_0x1798ee=_[_0x11a2('0x55')]({},_0x1798ee,_0x51bcf2['options']);return _0x466bfd[_0x11a2('0x94')](_0x1798ee);}})[_0x11a2('0x21')](function(_0x1cd36f){if(_0x1cd36f){_0x57d665=_0x1cd36f[_0x11a2('0x4e')];if(!_0x51bcf2[_0x11a2('0x4a')]['hasOwnProperty']('nolimit')){_0x1798ee[_0x11a2('0x32')]=qs[_0x11a2('0x32')](_0x51bcf2[_0x11a2('0x4a')][_0x11a2('0x32')]);_0x1798ee[_0x11a2('0x34')]=qs['offset'](_0x51bcf2[_0x11a2('0x4a')][_0x11a2('0x34')]);}return _0x466bfd[_0x11a2('0x94')](_0x1798ee);}})[_0x11a2('0x21')](function(_0x344f2e){if(_0x344f2e){return _0x344f2e?{'count':_0x57d665,'rows':_0x344f2e}:null;}})[_0x11a2('0x21')](respondWithResult(_0x4b67cd,null))[_0x11a2('0x2c')](handleError(_0x4b67cd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1db8b17..97160ee 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 _0x2cb4=['ChatQueue','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x5415d0,_0x1270ad){var _0xbbd0b4=function(_0x40a890){while(--_0x40a890){_0x5415d0['push'](_0x5415d0['shift']());}};_0xbbd0b4(++_0x1270ad);}(_0x2cb4,0x13e));var _0x42cb=function(_0x15876c,_0x510dd4){_0x15876c=_0x15876c-0x0;var _0x39d91b=_0x2cb4[_0x15876c];return _0x39d91b;};'use strict';var EventEmitter=require(_0x42cb('0x0'));var ChatQueue=require(_0x42cb('0x1'))['db'][_0x42cb('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x42cb('0x3')](0x0);var events={'afterCreate':_0x42cb('0x4'),'afterUpdate':_0x42cb('0x5'),'afterDestroy':_0x42cb('0x6')};function emitEvent(_0x524a33){return function(_0x272358,_0x2b4ebb,_0x43c035){ChatQueueEvents[_0x42cb('0x7')](_0x524a33+':'+_0x272358['id'],_0x272358);ChatQueueEvents[_0x42cb('0x7')](_0x524a33,_0x272358);_0x43c035(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x42cb('0x8')](e,emitEvent(event));}}module[_0x42cb('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x9248=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xb47fb2,_0x6a5f1c){var _0x2f58a0=function(_0xf6f046){while(--_0xf6f046){_0xb47fb2['push'](_0xb47fb2['shift']());}};_0x2f58a0(++_0x6a5f1c);}(_0x9248,0x18f));var _0x8924=function(_0x29e537,_0x326f0c){_0x29e537=_0x29e537-0x0;var _0x468bbc=_0x9248[_0x29e537];return _0x468bbc;};'use strict';var EventEmitter=require(_0x8924('0x0'));var ChatQueue=require(_0x8924('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8924('0x2')](0x0);var events={'afterCreate':_0x8924('0x3'),'afterUpdate':_0x8924('0x4'),'afterDestroy':_0x8924('0x5')};function emitEvent(_0x5804ed){return function(_0x50769f,_0x539a6d,_0x5e5c8a){ChatQueueEvents[_0x8924('0x6')](_0x5804ed+':'+_0x50769f['id'],_0x50769f);ChatQueueEvents[_0x8924('0x6')](_0x5804ed,_0x50769f);_0x5e5c8a(null);};}for(var e in events){if(events[_0x8924('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x8924('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index bd7b78a..f486e17 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 _0xb909=['api','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define','chat_queues','util','../../config/logger'];(function(_0x4cf444,_0x2fccf2){var _0x3b50f4=function(_0x3afdc8){while(--_0x3afdc8){_0x4cf444['push'](_0x4cf444['shift']());}};_0x3b50f4(++_0x2fccf2);}(_0xb909,0x13e));var _0x9b90=function(_0x447ae5,_0x406dd1){_0x447ae5=_0x447ae5-0x0;var _0xe6631e=_0xb909[_0x447ae5];return _0xe6631e;};'use strict';var _=require('lodash');var util=require(_0x9b90('0x0'));var logger=require(_0x9b90('0x1'))(_0x9b90('0x2'));var moment=require('moment');var BPromise=require(_0x9b90('0x3'));var rp=require(_0x9b90('0x4'));var fs=require('fs');var path=require(_0x9b90('0x5'));var rimraf=require(_0x9b90('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b90('0x7'));module['exports']=function(_0x5aea34,_0x354ef3){return _0x5aea34[_0x9b90('0x8')]('ChatQueue',attributes,{'tableName':_0x9b90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x111f=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','ChatQueue','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x111f,0x167));var _0xf111=function(_0x370a2e,_0x3f6e13){_0x370a2e=_0x370a2e-0x0;var _0x5f1691=_0x111f[_0x370a2e];return _0x5f1691;};'use strict';var _=require('lodash');var util=require(_0xf111('0x0'));var logger=require(_0xf111('0x1'))('api');var moment=require(_0xf111('0x2'));var BPromise=require('bluebird');var rp=require(_0xf111('0x3'));var fs=require('fs');var path=require(_0xf111('0x4'));var rimraf=require(_0xf111('0x5'));var config=require(_0xf111('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x3fbaef,_0x4fa343){return _0x3fbaef[_0xf111('0x7')](_0xf111('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 914af18..cc08aac 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 _0xc648=['stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','attributes','limit','map','include','model','GetChatQueue','where','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x121249,_0x3b4cea){var _0x52f27c=function(_0x48db46){while(--_0x48db46){_0x121249['push'](_0x121249['shift']());}};_0x52f27c(++_0x3b4cea);}(_0xc648,0x171));var _0x8c64=function(_0x194cec,_0x22f898){_0x194cec=_0x194cec-0x0;var _0x44930f=_0xc648[_0x194cec];return _0x44930f;};'use strict';var _=require('lodash');var util=require(_0x8c64('0x0'));var moment=require(_0x8c64('0x1'));var BPromise=require(_0x8c64('0x2'));var rs=require(_0x8c64('0x3'));var fs=require('fs');var Redis=require(_0x8c64('0x4'));var db=require(_0x8c64('0x5'))['db'];var utils=require(_0x8c64('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8c64('0x7'));var client=jayson[_0x8c64('0x8')][_0x8c64('0x9')]({'port':0x232a});config[_0x8c64('0xa')]=_['defaults'](config[_0x8c64('0xa')],{'host':_0x8c64('0xb'),'port':0x18eb});var socket=require(_0x8c64('0xc'))(new Redis(config[_0x8c64('0xa')]));require(_0x8c64('0xd'))['register'](socket);function respondWithRpcPromise(_0x6147f8,_0x40bb59,_0x4f7cb7){return new BPromise(function(_0x446101,_0x21905a){return client[_0x8c64('0xe')](_0x6147f8,_0x4f7cb7)[_0x8c64('0xf')](function(_0x177085){logger[_0x8c64('0x10')](_0x8c64('0x11'),_0x40bb59,_0x8c64('0x12'));logger[_0x8c64('0x13')](_0x8c64('0x14'),_0x40bb59,'request\x20sent',JSON[_0x8c64('0x15')](_0x177085));if(_0x177085[_0x8c64('0x16')]){if(_0x177085[_0x8c64('0x16')][_0x8c64('0x17')]===0x1f4){logger[_0x8c64('0x16')](_0x8c64('0x11'),_0x40bb59,_0x177085[_0x8c64('0x16')]['message']);return _0x21905a(_0x177085[_0x8c64('0x16')][_0x8c64('0x18')]);}logger['error'](_0x8c64('0x11'),_0x40bb59,_0x177085[_0x8c64('0x16')]['message']);return _0x446101(_0x177085[_0x8c64('0x16')][_0x8c64('0x18')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x40bb59,_0x8c64('0x12'));_0x446101(_0x177085[_0x8c64('0x19')]['message']);}})[_0x8c64('0x1a')](function(_0x30f7ad){logger['error']('ChatQueue,\x20%s,\x20%s',_0x40bb59,_0x30f7ad);_0x21905a(_0x30f7ad);});});}exports['GetChatQueue']=function(_0xb94635){var _0x530747=this;return new Promise(function(_0x47f6fa,_0x45839d){return db[_0x8c64('0x1b')][_0x8c64('0x1c')]({'raw':_0xb94635[_0x8c64('0x1d')]?_0xb94635[_0x8c64('0x1d')][_0x8c64('0x1e')]===undefined?!![]:![]:!![],'where':_0xb94635['options']?_0xb94635[_0x8c64('0x1d')]['where']||null:null,'attributes':_0xb94635[_0x8c64('0x1d')]?_0xb94635['options'][_0x8c64('0x1f')]||null:null,'limit':_0xb94635[_0x8c64('0x1d')]?_0xb94635['options'][_0x8c64('0x20')]||null:null,'include':_0xb94635[_0x8c64('0x1d')]?_0xb94635[_0x8c64('0x1d')]['include']?_[_0x8c64('0x21')](_0xb94635['options'][_0x8c64('0x22')],function(_0xd3001c){return{'model':db[_0xd3001c[_0x8c64('0x23')]],'as':_0xd3001c['as'],'attributes':_0xd3001c[_0x8c64('0x1f')],'include':_0xd3001c[_0x8c64('0x22')]?_['map'](_0xd3001c[_0x8c64('0x22')],function(_0x5cf51b){return{'model':db[_0x5cf51b['model']],'as':_0x5cf51b['as'],'attributes':_0x5cf51b[_0x8c64('0x1f')],'include':_0x5cf51b['include']?_[_0x8c64('0x21')](_0x5cf51b[_0x8c64('0x22')],function(_0x1cf017){return{'model':db[_0x1cf017['model']],'as':_0x1cf017['as'],'attributes':_0x1cf017[_0x8c64('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8c64('0xf')](function(_0x13f0b0){logger[_0x8c64('0x10')](_0x8c64('0x24'),_0xb94635);logger[_0x8c64('0x13')](_0x8c64('0x24'),_0xb94635,JSON[_0x8c64('0x15')](_0x13f0b0));_0x47f6fa(_0x13f0b0);})['catch'](function(_0x4f86cd){logger['error'](_0x8c64('0x24'),_0x4f86cd[_0x8c64('0x18')],_0xb94635);_0x45839d(_0x530747[_0x8c64('0x16')](0x1f4,_0x4f86cd[_0x8c64('0x18')]));});});};exports['ShowChatQueue']=function(_0x173b58){var _0x2ee384=this;return new Promise(function(_0x485044,_0x221559){return db['ChatQueue']['find']({'raw':_0x173b58[_0x8c64('0x1d')]?_0x173b58[_0x8c64('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x173b58['options']?_0x173b58['options'][_0x8c64('0x25')]||null:null,'attributes':_0x173b58[_0x8c64('0x1d')]?_0x173b58[_0x8c64('0x1d')][_0x8c64('0x1f')]||null:null,'include':_0x173b58[_0x8c64('0x1d')]?_0x173b58[_0x8c64('0x1d')][_0x8c64('0x22')]?_[_0x8c64('0x21')](_0x173b58[_0x8c64('0x1d')]['include'],function(_0x251d0f){return{'model':db[_0x251d0f[_0x8c64('0x23')]],'as':_0x251d0f['as'],'attributes':_0x251d0f[_0x8c64('0x1f')],'include':_0x251d0f['include']?_[_0x8c64('0x21')](_0x251d0f[_0x8c64('0x22')],function(_0x3d53f0){return{'model':db[_0x3d53f0['model']],'as':_0x3d53f0['as'],'attributes':_0x3d53f0[_0x8c64('0x1f')],'include':_0x3d53f0[_0x8c64('0x22')]?_[_0x8c64('0x21')](_0x3d53f0[_0x8c64('0x22')],function(_0x17dcca){return{'model':db[_0x17dcca[_0x8c64('0x23')]],'as':_0x17dcca['as'],'attributes':_0x17dcca[_0x8c64('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8c64('0xf')](function(_0x1f199e){logger[_0x8c64('0x10')](_0x8c64('0x26'),_0x173b58);logger[_0x8c64('0x13')](_0x8c64('0x26'),_0x173b58,JSON[_0x8c64('0x15')](_0x1f199e));_0x485044(_0x1f199e);})['catch'](function(_0x5ac70f){logger[_0x8c64('0x16')](_0x8c64('0x26'),_0x5ac70f[_0x8c64('0x18')],_0x173b58);_0x221559(_0x2ee384[_0x8c64('0x16')](0x1f4,_0x5ac70f['message']));});});}; \ No newline at end of file +var _0xb235=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','options','where','attributes','include','model','map','debug','ShowChatQueue','find','raw','lodash','util','bluebird','randomstring'];(function(_0x512163,_0x6da7c1){var _0x19fbaa=function(_0x3c1fa7){while(--_0x3c1fa7){_0x512163['push'](_0x512163['shift']());}};_0x19fbaa(++_0x6da7c1);}(_0xb235,0xb5));var _0x5b23=function(_0x336082,_0x5c364b){_0x336082=_0x336082-0x0;var _0x2ea2eb=_0xb235[_0x336082];return _0x2ea2eb;};'use strict';var _=require(_0x5b23('0x0'));var util=require(_0x5b23('0x1'));var moment=require('moment');var BPromise=require(_0x5b23('0x2'));var rs=require(_0x5b23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b23('0x4'))['db'];var utils=require(_0x5b23('0x5'));var logger=require(_0x5b23('0x6'))('rpc');var config=require(_0x5b23('0x7'));var jayson=require(_0x5b23('0x8'));var client=jayson[_0x5b23('0x9')][_0x5b23('0xa')]({'port':0x232a});config[_0x5b23('0xb')]=_[_0x5b23('0xc')](config['redis'],{'host':_0x5b23('0xd'),'port':0x18eb});var socket=require(_0x5b23('0xe'))(new Redis(config[_0x5b23('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1a1b97,_0x1b5868,_0x16a79e){return new BPromise(function(_0x52d872,_0x20549e){return client['request'](_0x1a1b97,_0x16a79e)[_0x5b23('0xf')](function(_0xad5190){logger[_0x5b23('0x10')](_0x5b23('0x11'),_0x1b5868,_0x5b23('0x12'));logger['debug'](_0x5b23('0x13'),_0x1b5868,_0x5b23('0x12'),JSON[_0x5b23('0x14')](_0xad5190));if(_0xad5190[_0x5b23('0x15')]){if(_0xad5190[_0x5b23('0x15')][_0x5b23('0x16')]===0x1f4){logger[_0x5b23('0x15')]('ChatQueue,\x20%s,\x20%s',_0x1b5868,_0xad5190[_0x5b23('0x15')][_0x5b23('0x17')]);return _0x20549e(_0xad5190['error'][_0x5b23('0x17')]);}logger[_0x5b23('0x15')]('ChatQueue,\x20%s,\x20%s',_0x1b5868,_0xad5190['error'][_0x5b23('0x17')]);return _0x52d872(_0xad5190['error'][_0x5b23('0x17')]);}else{logger[_0x5b23('0x10')](_0x5b23('0x11'),_0x1b5868,_0x5b23('0x12'));_0x52d872(_0xad5190['result']['message']);}})[_0x5b23('0x18')](function(_0x2b839e){logger[_0x5b23('0x15')](_0x5b23('0x11'),_0x1b5868,_0x2b839e);_0x20549e(_0x2b839e);});});}exports[_0x5b23('0x19')]=function(_0x1b3f63){var _0x43df90=this;return new Promise(function(_0x1dddf3,_0x2eff29){return db[_0x5b23('0x1a')]['findAll']({'raw':_0x1b3f63[_0x5b23('0x1b')]?_0x1b3f63['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b3f63[_0x5b23('0x1b')]?_0x1b3f63[_0x5b23('0x1b')][_0x5b23('0x1c')]||null:null,'attributes':_0x1b3f63[_0x5b23('0x1b')]?_0x1b3f63[_0x5b23('0x1b')][_0x5b23('0x1d')]||null:null,'limit':_0x1b3f63[_0x5b23('0x1b')]?_0x1b3f63[_0x5b23('0x1b')]['limit']||null:null,'include':_0x1b3f63[_0x5b23('0x1b')]?_0x1b3f63[_0x5b23('0x1b')][_0x5b23('0x1e')]?_['map'](_0x1b3f63['options'][_0x5b23('0x1e')],function(_0x54206c){return{'model':db[_0x54206c['model']],'as':_0x54206c['as'],'attributes':_0x54206c['attributes'],'include':_0x54206c['include']?_['map'](_0x54206c[_0x5b23('0x1e')],function(_0x29a5b4){return{'model':db[_0x29a5b4[_0x5b23('0x1f')]],'as':_0x29a5b4['as'],'attributes':_0x29a5b4[_0x5b23('0x1d')],'include':_0x29a5b4['include']?_[_0x5b23('0x20')](_0x29a5b4['include'],function(_0xd0d37){return{'model':db[_0xd0d37[_0x5b23('0x1f')]],'as':_0xd0d37['as'],'attributes':_0xd0d37['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b23('0xf')](function(_0xdd9ad2){logger[_0x5b23('0x10')]('GetChatQueue',_0x1b3f63);logger[_0x5b23('0x21')](_0x5b23('0x19'),_0x1b3f63,JSON[_0x5b23('0x14')](_0xdd9ad2));_0x1dddf3(_0xdd9ad2);})[_0x5b23('0x18')](function(_0x47fbdb){logger[_0x5b23('0x15')](_0x5b23('0x19'),_0x47fbdb[_0x5b23('0x17')],_0x1b3f63);_0x2eff29(_0x43df90[_0x5b23('0x15')](0x1f4,_0x47fbdb[_0x5b23('0x17')]));});});};exports[_0x5b23('0x22')]=function(_0x21e4b1){var _0x58baa9=this;return new Promise(function(_0x46055e,_0x17840f){return db[_0x5b23('0x1a')][_0x5b23('0x23')]({'raw':_0x21e4b1[_0x5b23('0x1b')]?_0x21e4b1['options'][_0x5b23('0x24')]===undefined?!![]:![]:!![],'where':_0x21e4b1[_0x5b23('0x1b')]?_0x21e4b1[_0x5b23('0x1b')][_0x5b23('0x1c')]||null:null,'attributes':_0x21e4b1[_0x5b23('0x1b')]?_0x21e4b1[_0x5b23('0x1b')][_0x5b23('0x1d')]||null:null,'include':_0x21e4b1[_0x5b23('0x1b')]?_0x21e4b1['options'][_0x5b23('0x1e')]?_[_0x5b23('0x20')](_0x21e4b1[_0x5b23('0x1b')][_0x5b23('0x1e')],function(_0x73e613){return{'model':db[_0x73e613[_0x5b23('0x1f')]],'as':_0x73e613['as'],'attributes':_0x73e613[_0x5b23('0x1d')],'include':_0x73e613[_0x5b23('0x1e')]?_[_0x5b23('0x20')](_0x73e613[_0x5b23('0x1e')],function(_0x1c3dfd){return{'model':db[_0x1c3dfd[_0x5b23('0x1f')]],'as':_0x1c3dfd['as'],'attributes':_0x1c3dfd['attributes'],'include':_0x1c3dfd[_0x5b23('0x1e')]?_[_0x5b23('0x20')](_0x1c3dfd[_0x5b23('0x1e')],function(_0x5261ab){return{'model':db[_0x5261ab[_0x5b23('0x1f')]],'as':_0x5261ab['as'],'attributes':_0x5261ab[_0x5b23('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b23('0xf')](function(_0xb8af77){logger[_0x5b23('0x10')]('ShowChatQueue',_0x21e4b1);logger[_0x5b23('0x21')]('ShowChatQueue',_0x21e4b1,JSON[_0x5b23('0x14')](_0xb8af77));_0x46055e(_0xb8af77);})[_0x5b23('0x18')](function(_0x8e3e){logger[_0x5b23('0x15')](_0x5b23('0x22'),_0x8e3e[_0x5b23('0x17')],_0x21e4b1);_0x17840f(_0x58baa9[_0x5b23('0x15')](0x1f4,_0x8e3e[_0x5b23('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2ef0e1c..b0737ac 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 _0x0ba7=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','remove','update'];(function(_0x1bb1ea,_0x5a2918){var _0x313151=function(_0x446287){while(--_0x446287){_0x1bb1ea['push'](_0x1bb1ea['shift']());}};_0x313151(++_0x5a2918);}(_0x0ba7,0x16d));var _0x70ba=function(_0x5ac496,_0x12d379){_0x5ac496=_0x5ac496-0x0;var _0x5091dc=_0x0ba7[_0x5ac496];return _0x5091dc;};'use strict';var ChatQueueEvents=require(_0x70ba('0x0'));var events=['save',_0x70ba('0x1'),_0x70ba('0x2')];function createListener(_0xadfc69,_0x42d93c){return function(_0x5e5368){_0x42d93c[_0x70ba('0x3')](_0xadfc69,_0x5e5368);};}function removeListener(_0x3e20ab,_0x3cb2e3){return function(){ChatQueueEvents[_0x70ba('0x4')](_0x3e20ab,_0x3cb2e3);};}exports[_0x70ba('0x5')]=function(_0x3f9877){for(var _0x17a00c=0x0,_0x2d5a16=events[_0x70ba('0x6')];_0x17a00c<_0x2d5a16;_0x17a00c++){var _0x1185cb=events[_0x17a00c];var _0x1a968b=createListener(_0x70ba('0x7')+_0x1185cb,_0x3f9877);ChatQueueEvents['on'](_0x1185cb,_0x1a968b);}}; \ No newline at end of file +var _0x0b78=['removeListener','length','chatQueue:','./chatQueue.events','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b78,0x1ad));var _0x80b7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0b78[_0x4b369d];return _0x571a98;};'use strict';var ChatQueueEvents=require(_0x80b7('0x0'));var events=[_0x80b7('0x1'),'remove',_0x80b7('0x2')];function createListener(_0x4f55ab,_0x4bffac){return function(_0x261012){_0x4bffac['emit'](_0x4f55ab,_0x261012);};}function removeListener(_0x6a187e,_0x89d4d7){return function(){ChatQueueEvents[_0x80b7('0x3')](_0x6a187e,_0x89d4d7);};}exports['register']=function(_0x49bc7f){for(var _0x167ddd=0x0,_0x584401=events[_0x80b7('0x4')];_0x167ddd<_0x584401;_0x167ddd++){var _0x122ebe=events[_0x167ddd];var _0x3c248d=createListener(_0x80b7('0x5')+_0x122ebe,_0x49bc7f);ChatQueueEvents['on'](_0x122ebe,_0x3c248d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ccd366e..355cdbc 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x9fa51b,_0x38889e){var _0x2f0160=function(_0x28e72c){while(--_0x28e72c){_0x9fa51b['push'](_0x9fa51b['shift']());}};_0x2f0160(++_0x38889e);}(_0x008c,0x188));var _0xc008=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x008c[_0x9d14e3];return _0x19bf32;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a30cf,_0x106fe6){var _0x1e3fd9=function(_0x4e1ea8){while(--_0x4e1ea8){_0x1a30cf['push'](_0x1a30cf['shift']());}};_0x1e3fd9(++_0x106fe6);}(_0x008c,0x188));var _0xc008=function(_0x67d2b,_0xc3be07){_0x67d2b=_0x67d2b-0x0;var _0x23e7c1=_0x008c[_0x67d2b];return _0x23e7c1;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index bf4605c..ca8c4f4 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 _0x2fb2=['DATE','moment','STRING'];(function(_0x496ed3,_0x5589e6){var _0x4ddb3d=function(_0x5c630e){while(--_0x5c630e){_0x496ed3['push'](_0x496ed3['shift']());}};_0x4ddb3d(++_0x5589e6);}(_0x2fb2,0x19c));var _0x22fb=function(_0x3024ac,_0x11128c){_0x3024ac=_0x3024ac-0x0;var _0x5e196c=_0x2fb2[_0x3024ac];return _0x5e196c;};'use strict';var moment=require(_0x22fb('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x22fb('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x22fb('0x1')]},'joinAt':{'type':Sequelize[_0x22fb('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x22fb('0x2')]},'exitAt':{'type':Sequelize[_0x22fb('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a9c=['DATE','moment','sequelize','exports','STRING'];(function(_0x43bf1f,_0x2c6036){var _0x53c257=function(_0x62049a){while(--_0x62049a){_0x43bf1f['push'](_0x43bf1f['shift']());}};_0x53c257(++_0x2c6036);}(_0x9a9c,0x15f));var _0xc9a9=function(_0x385839,_0x502e3e){_0x385839=_0x385839-0x0;var _0x31ff87=_0x9a9c[_0x385839];return _0x31ff87;};'use strict';var moment=require(_0xc9a9('0x0'));var Sequelize=require(_0xc9a9('0x1'));module[_0xc9a9('0x2')]={'uniqueid':{'type':Sequelize[_0xc9a9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc9a9('0x3')]},'joinAt':{'type':Sequelize[_0xc9a9('0x4')]},'leaveAt':{'type':Sequelize[_0xc9a9('0x4')]},'acceptAt':{'type':Sequelize[_0xc9a9('0x4')]},'exitAt':{'type':Sequelize[_0xc9a9('0x4')]},'reason':{'type':Sequelize[_0xc9a9('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index bdf11c0..c5696a4 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 _0x6829=['end','json','offset','limit','undefined','set','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','ChatQueueReport','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status'];(function(_0x166f7c,_0x474d3b){var _0x31e804=function(_0x4921d9){while(--_0x4921d9){_0x166f7c['push'](_0x166f7c['shift']());}};_0x31e804(++_0x474d3b);}(_0x6829,0x14c));var _0x9682=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6829[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x9682('0x0'));var rimraf=require(_0x9682('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9682('0x2'));var BPromise=require(_0x9682('0x3'));var Mustache=require(_0x9682('0x4'));var util=require(_0x9682('0x5'));var path=require(_0x9682('0x6'));var sox=require(_0x9682('0x7'));var csv=require(_0x9682('0x8'));var ejs=require(_0x9682('0x9'));var fs=require('fs');var fs_extra=require(_0x9682('0xa'));var _=require(_0x9682('0xb'));var squel=require(_0x9682('0xc'));var crypto=require(_0x9682('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9682('0xe'));var Papa=require(_0x9682('0xf'));var Redis=require('ioredis');var authService=require(_0x9682('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9682('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9682('0x12'))(_0x9682('0x13'));var utils=require(_0x9682('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9682('0x15'))['db'];function respondWithStatusCode(_0x1391c3,_0x57e123){_0x57e123=_0x57e123||0xcc;return function(_0x15663f){if(_0x15663f){return _0x1391c3['sendStatus'](_0x57e123);}return _0x1391c3[_0x9682('0x16')](_0x57e123)[_0x9682('0x17')]();};}function respondWithResult(_0x289d8b,_0x21451a){_0x21451a=_0x21451a||0xc8;return function(_0x30bfd7){if(_0x30bfd7){return _0x289d8b[_0x9682('0x16')](_0x21451a)[_0x9682('0x18')](_0x30bfd7);}};}function respondWithFilteredResult(_0xa26517,_0x1adcf8){return function(_0x13a1a9){if(_0x13a1a9){var _0x526391=typeof _0x1adcf8[_0x9682('0x19')]==='undefined'&&typeof _0x1adcf8[_0x9682('0x1a')]===_0x9682('0x1b');var _0x1f4971=_0x13a1a9['count'];var _0x1c73ee=_0x526391?0x0:_0x1adcf8['offset'];var _0x107291=_0x526391?_0x13a1a9['count']:_0x1adcf8[_0x9682('0x19')]+_0x1adcf8[_0x9682('0x1a')];var _0x57d4cf;if(_0x107291>=_0x1f4971){_0x107291=_0x1f4971;_0x57d4cf=0xc8;}else{_0x57d4cf=0xce;}_0xa26517[_0x9682('0x16')](_0x57d4cf);return _0xa26517[_0x9682('0x1c')]('Content-Range',_0x1c73ee+'-'+_0x107291+'/'+_0x1f4971)['json'](_0x13a1a9);}return null;};}function patchUpdates(_0x497ff7){return function(_0x3fca2b){try{jsonpatch['apply'](_0x3fca2b,_0x497ff7,!![]);}catch(_0x36230c){return BPromise[_0x9682('0x1d')](_0x36230c);}return _0x3fca2b['save']();};}function saveUpdates(_0x4650c9,_0x238361){return function(_0x1aacb6){if(_0x1aacb6){return _0x1aacb6[_0x9682('0x1e')](_0x4650c9)[_0x9682('0x1f')](function(_0x1c2eaf){return _0x1c2eaf;});}return null;};}function removeEntity(_0x738838,_0x40e927){return function(_0x107352){if(_0x107352){return _0x107352[_0x9682('0x20')]()['then'](function(){_0x738838[_0x9682('0x16')](0xcc)[_0x9682('0x17')]();});}};}function handleEntityNotFound(_0x88419f,_0x21a10b){return function(_0x39291f){if(!_0x39291f){_0x88419f['sendStatus'](0x194);}return _0x39291f;};}function handleError(_0x756fea,_0x1dbf57){_0x1dbf57=_0x1dbf57||0x1f4;return function(_0x44808c){logger[_0x9682('0x21')](_0x44808c[_0x9682('0x22')]);if(_0x44808c[_0x9682('0x23')]){delete _0x44808c['name'];}_0x756fea[_0x9682('0x16')](_0x1dbf57)[_0x9682('0x24')](_0x44808c);};}exports[_0x9682('0x25')]=function(_0x1d827e,_0x9e3d59){var _0x1fdb4d={},_0x176624={},_0x14d974={'count':0x0,'rows':[]};var _0x5f4294=_[_0x9682('0x26')](db['ChatQueueReport'][_0x9682('0x27')],function(_0x27d7f0){return{'name':_0x27d7f0['fieldName'],'type':_0x27d7f0['type']['key']};});_0x176624['model']=_[_0x9682('0x26')](_0x5f4294,'name');_0x176624[_0x9682('0x28')]=_[_0x9682('0x29')](_0x1d827e[_0x9682('0x28')]);_0x176624[_0x9682('0x2a')]=_['intersection'](_0x176624['model'],_0x176624[_0x9682('0x28')]);_0x1fdb4d[_0x9682('0x2b')]=_[_0x9682('0x2c')](_0x176624[_0x9682('0x2d')],qs[_0x9682('0x2e')](_0x1d827e['query']['fields']));_0x1fdb4d[_0x9682('0x2b')]=_0x1fdb4d[_0x9682('0x2b')][_0x9682('0x2f')]?_0x1fdb4d[_0x9682('0x2b')]:_0x176624[_0x9682('0x2d')];if(!_0x1d827e[_0x9682('0x28')][_0x9682('0x30')]('nolimit')){_0x1fdb4d[_0x9682('0x1a')]=qs[_0x9682('0x1a')](_0x1d827e[_0x9682('0x28')][_0x9682('0x1a')]);_0x1fdb4d[_0x9682('0x19')]=qs['offset'](_0x1d827e[_0x9682('0x28')]['offset']);}_0x1fdb4d[_0x9682('0x31')]=qs[_0x9682('0x32')](_0x1d827e[_0x9682('0x28')][_0x9682('0x32')]);_0x1fdb4d[_0x9682('0x33')]=qs[_0x9682('0x2a')](_[_0x9682('0x34')](_0x1d827e['query'],_0x176624[_0x9682('0x2a')]),_0x5f4294);if(_0x1d827e['query'][_0x9682('0x35')]){_0x1fdb4d['where']=_[_0x9682('0x36')](_0x1fdb4d[_0x9682('0x33')],{'$or':_[_0x9682('0x26')](_0x5f4294,function(_0x110fff){if(_0x110fff[_0x9682('0x37')]!==_0x9682('0x38')){var _0x123367={};_0x123367[_0x110fff[_0x9682('0x23')]]={'$like':'%'+_0x1d827e[_0x9682('0x28')][_0x9682('0x35')]+'%'};return _0x123367;}})});}_0x1fdb4d=_[_0x9682('0x36')]({},_0x1fdb4d,_0x1d827e['options']);var _0x30bdf0={'where':_0x1fdb4d[_0x9682('0x33')]};return db[_0x9682('0x39')][_0x9682('0x3a')](_0x30bdf0)[_0x9682('0x1f')](function(_0x479ac7){_0x14d974[_0x9682('0x3a')]=_0x479ac7;if(_0x1d827e[_0x9682('0x28')][_0x9682('0x3b')]){_0x1fdb4d['include']=[{'all':!![]}];}return db[_0x9682('0x39')][_0x9682('0x3c')](_0x1fdb4d);})[_0x9682('0x1f')](function(_0x240431){_0x14d974[_0x9682('0x3d')]=_0x240431;return _0x14d974;})[_0x9682('0x1f')](respondWithFilteredResult(_0x9e3d59,_0x1fdb4d))[_0x9682('0x3e')](handleError(_0x9e3d59,null));};exports[_0x9682('0x3f')]=function(_0x6e3eaa,_0x2d9b43){var _0x46b5c6={'raw':!![],'where':{'id':_0x6e3eaa[_0x9682('0x40')]['id']}},_0x3324b2={};_0x3324b2[_0x9682('0x2d')]=_[_0x9682('0x29')](db[_0x9682('0x39')]['rawAttributes']);_0x3324b2[_0x9682('0x28')]=_['keys'](_0x6e3eaa[_0x9682('0x28')]);_0x3324b2[_0x9682('0x2a')]=_[_0x9682('0x2c')](_0x3324b2['model'],_0x3324b2['query']);_0x46b5c6[_0x9682('0x2b')]=_[_0x9682('0x2c')](_0x3324b2[_0x9682('0x2d')],qs[_0x9682('0x2e')](_0x6e3eaa[_0x9682('0x28')][_0x9682('0x2e')]));_0x46b5c6[_0x9682('0x2b')]=_0x46b5c6['attributes'][_0x9682('0x2f')]?_0x46b5c6['attributes']:_0x3324b2[_0x9682('0x2d')];if(_0x6e3eaa[_0x9682('0x28')][_0x9682('0x3b')]){_0x46b5c6[_0x9682('0x41')]=[{'all':!![]}];}_0x46b5c6=_[_0x9682('0x36')]({},_0x46b5c6,_0x6e3eaa[_0x9682('0x42')]);return db[_0x9682('0x39')][_0x9682('0x43')](_0x46b5c6)['then'](handleEntityNotFound(_0x2d9b43,null))[_0x9682('0x1f')](respondWithResult(_0x2d9b43,null))[_0x9682('0x3e')](handleError(_0x2d9b43,null));};exports[_0x9682('0x44')]=function(_0x1d09a4,_0xd99414){return db[_0x9682('0x39')]['create'](_0x1d09a4[_0x9682('0x45')],{})[_0x9682('0x1f')](respondWithResult(_0xd99414,0xc9))[_0x9682('0x3e')](handleError(_0xd99414,null));};exports[_0x9682('0x1e')]=function(_0x3c79ce,_0x2cc99b){if(_0x3c79ce[_0x9682('0x45')]['id']){delete _0x3c79ce[_0x9682('0x45')]['id'];}return db[_0x9682('0x39')][_0x9682('0x43')]({'where':{'id':_0x3c79ce['params']['id']}})['then'](handleEntityNotFound(_0x2cc99b,null))['then'](saveUpdates(_0x3c79ce['body'],null))['then'](respondWithResult(_0x2cc99b,null))[_0x9682('0x3e')](handleError(_0x2cc99b,null));};exports[_0x9682('0x20')]=function(_0x731dd0,_0x5154c7){return db[_0x9682('0x39')][_0x9682('0x43')]({'where':{'id':_0x731dd0[_0x9682('0x40')]['id']}})['then'](handleEntityNotFound(_0x5154c7,null))[_0x9682('0x1f')](removeEntity(_0x5154c7,null))[_0x9682('0x3e')](handleError(_0x5154c7,null));};exports[_0x9682('0x46')]=function(_0x29fa7f,_0x3357d5){return db[_0x9682('0x39')][_0x9682('0x46')]()['then'](respondWithResult(_0x3357d5,null))[_0x9682('0x3e')](handleError(_0x3357d5,null));}; \ No newline at end of file +var _0x1fa9=['params','length','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1fa9,0x136));var _0x91fa=function(_0x1a8dd7,_0x17622d){_0x1a8dd7=_0x1a8dd7-0x0;var _0x1d3ec4=_0x1fa9[_0x1a8dd7];return _0x1d3ec4;};'use strict';var emlformat=require(_0x91fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91fa('0x2'));var moment=require(_0x91fa('0x3'));var BPromise=require(_0x91fa('0x4'));var Mustache=require('mustache');var util=require(_0x91fa('0x5'));var path=require(_0x91fa('0x6'));var sox=require(_0x91fa('0x7'));var csv=require(_0x91fa('0x8'));var ejs=require(_0x91fa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91fa('0xa'));var squel=require(_0x91fa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x91fa('0xc'));var toCsv=require(_0x91fa('0x8'));var querystring=require(_0x91fa('0xd'));var Papa=require(_0x91fa('0xe'));var Redis=require(_0x91fa('0xf'));var authService=require(_0x91fa('0x10'));var qs=require(_0x91fa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x91fa('0x12'))(_0x91fa('0x13'));var utils=require(_0x91fa('0x14'));var config=require(_0x91fa('0x15'));var licenseUtil=require(_0x91fa('0x16'));var db=require(_0x91fa('0x17'))['db'];function respondWithStatusCode(_0x1bdb51,_0x578035){_0x578035=_0x578035||0xcc;return function(_0x5a904d){if(_0x5a904d){return _0x1bdb51['sendStatus'](_0x578035);}return _0x1bdb51[_0x91fa('0x18')](_0x578035)['end']();};}function respondWithResult(_0x5f215d,_0x4d95f5){_0x4d95f5=_0x4d95f5||0xc8;return function(_0x4650bf){if(_0x4650bf){return _0x5f215d[_0x91fa('0x18')](_0x4d95f5)['json'](_0x4650bf);}};}function respondWithFilteredResult(_0x308812,_0x252ec7){return function(_0x74c75d){if(_0x74c75d){var _0x2667da=typeof _0x252ec7[_0x91fa('0x19')]===_0x91fa('0x1a')&&typeof _0x252ec7['limit']===_0x91fa('0x1a');var _0x17c4d4=_0x74c75d[_0x91fa('0x1b')];var _0x3916cc=_0x2667da?0x0:_0x252ec7[_0x91fa('0x19')];var _0x4dcbcf=_0x2667da?_0x74c75d[_0x91fa('0x1b')]:_0x252ec7[_0x91fa('0x19')]+_0x252ec7[_0x91fa('0x1c')];var _0x1e3d6f;if(_0x4dcbcf>=_0x17c4d4){_0x4dcbcf=_0x17c4d4;_0x1e3d6f=0xc8;}else{_0x1e3d6f=0xce;}_0x308812[_0x91fa('0x18')](_0x1e3d6f);return _0x308812[_0x91fa('0x1d')](_0x91fa('0x1e'),_0x3916cc+'-'+_0x4dcbcf+'/'+_0x17c4d4)[_0x91fa('0x1f')](_0x74c75d);}return null;};}function patchUpdates(_0xba1e97){return function(_0x274d6f){try{jsonpatch[_0x91fa('0x20')](_0x274d6f,_0xba1e97,!![]);}catch(_0x4a8f08){return BPromise[_0x91fa('0x21')](_0x4a8f08);}return _0x274d6f[_0x91fa('0x22')]();};}function saveUpdates(_0x4ac68d,_0x1a6480){return function(_0x50596c){if(_0x50596c){return _0x50596c[_0x91fa('0x23')](_0x4ac68d)['then'](function(_0x4e619c){return _0x4e619c;});}return null;};}function removeEntity(_0x5d89f9,_0x2ed86d){return function(_0x6d4e53){if(_0x6d4e53){return _0x6d4e53[_0x91fa('0x24')]()[_0x91fa('0x25')](function(){_0x5d89f9[_0x91fa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3048c4,_0xb7a98){return function(_0x252c71){if(!_0x252c71){_0x3048c4[_0x91fa('0x26')](0x194);}return _0x252c71;};}function handleError(_0x4b0090,_0x5a9554){_0x5a9554=_0x5a9554||0x1f4;return function(_0x2aa3d7){logger[_0x91fa('0x27')](_0x2aa3d7[_0x91fa('0x28')]);if(_0x2aa3d7[_0x91fa('0x29')]){delete _0x2aa3d7[_0x91fa('0x29')];}_0x4b0090['status'](_0x5a9554)[_0x91fa('0x2a')](_0x2aa3d7);};}exports[_0x91fa('0x2b')]=function(_0x402884,_0x5601c4){var _0x518cae={},_0x342670={},_0x45a0e8={'count':0x0,'rows':[]};var _0x3ec667=_[_0x91fa('0x2c')](db[_0x91fa('0x2d')][_0x91fa('0x2e')],function(_0x27ed0e){return{'name':_0x27ed0e[_0x91fa('0x2f')],'type':_0x27ed0e[_0x91fa('0x30')][_0x91fa('0x31')]};});_0x342670[_0x91fa('0x32')]=_['map'](_0x3ec667,'name');_0x342670[_0x91fa('0x33')]=_[_0x91fa('0x34')](_0x402884[_0x91fa('0x33')]);_0x342670[_0x91fa('0x35')]=_[_0x91fa('0x36')](_0x342670[_0x91fa('0x32')],_0x342670['query']);_0x518cae[_0x91fa('0x37')]=_[_0x91fa('0x36')](_0x342670[_0x91fa('0x32')],qs[_0x91fa('0x38')](_0x402884[_0x91fa('0x33')][_0x91fa('0x38')]));_0x518cae[_0x91fa('0x37')]=_0x518cae[_0x91fa('0x37')]['length']?_0x518cae['attributes']:_0x342670[_0x91fa('0x32')];if(!_0x402884[_0x91fa('0x33')]['hasOwnProperty'](_0x91fa('0x39'))){_0x518cae['limit']=qs['limit'](_0x402884[_0x91fa('0x33')][_0x91fa('0x1c')]);_0x518cae[_0x91fa('0x19')]=qs['offset'](_0x402884[_0x91fa('0x33')][_0x91fa('0x19')]);}_0x518cae[_0x91fa('0x3a')]=qs[_0x91fa('0x3b')](_0x402884[_0x91fa('0x33')][_0x91fa('0x3b')]);_0x518cae[_0x91fa('0x3c')]=qs['filters'](_[_0x91fa('0x3d')](_0x402884[_0x91fa('0x33')],_0x342670['filters']),_0x3ec667);if(_0x402884['query'][_0x91fa('0x3e')]){_0x518cae[_0x91fa('0x3c')]=_['merge'](_0x518cae[_0x91fa('0x3c')],{'$or':_[_0x91fa('0x2c')](_0x3ec667,function(_0x4baaf3){if(_0x4baaf3[_0x91fa('0x30')]!=='VIRTUAL'){var _0x5846ee={};_0x5846ee[_0x4baaf3[_0x91fa('0x29')]]={'$like':'%'+_0x402884[_0x91fa('0x33')]['filter']+'%'};return _0x5846ee;}})});}_0x518cae=_[_0x91fa('0x3f')]({},_0x518cae,_0x402884[_0x91fa('0x40')]);var _0x5e4495={'where':_0x518cae[_0x91fa('0x3c')]};return db['ChatQueueReport'][_0x91fa('0x1b')](_0x5e4495)['then'](function(_0x396a91){_0x45a0e8['count']=_0x396a91;if(_0x402884[_0x91fa('0x33')][_0x91fa('0x41')]){_0x518cae[_0x91fa('0x42')]=[{'all':!![]}];}return db[_0x91fa('0x2d')]['findAll'](_0x518cae);})[_0x91fa('0x25')](function(_0x337c8b){_0x45a0e8[_0x91fa('0x43')]=_0x337c8b;return _0x45a0e8;})[_0x91fa('0x25')](respondWithFilteredResult(_0x5601c4,_0x518cae))[_0x91fa('0x44')](handleError(_0x5601c4,null));};exports[_0x91fa('0x45')]=function(_0x5dad2e,_0x382fb5){var _0x47bd8a={'raw':!![],'where':{'id':_0x5dad2e[_0x91fa('0x46')]['id']}},_0x4cdd67={};_0x4cdd67[_0x91fa('0x32')]=_[_0x91fa('0x34')](db[_0x91fa('0x2d')][_0x91fa('0x2e')]);_0x4cdd67[_0x91fa('0x33')]=_[_0x91fa('0x34')](_0x5dad2e['query']);_0x4cdd67[_0x91fa('0x35')]=_['intersection'](_0x4cdd67[_0x91fa('0x32')],_0x4cdd67[_0x91fa('0x33')]);_0x47bd8a[_0x91fa('0x37')]=_[_0x91fa('0x36')](_0x4cdd67[_0x91fa('0x32')],qs[_0x91fa('0x38')](_0x5dad2e[_0x91fa('0x33')][_0x91fa('0x38')]));_0x47bd8a[_0x91fa('0x37')]=_0x47bd8a[_0x91fa('0x37')][_0x91fa('0x47')]?_0x47bd8a[_0x91fa('0x37')]:_0x4cdd67[_0x91fa('0x32')];if(_0x5dad2e[_0x91fa('0x33')][_0x91fa('0x41')]){_0x47bd8a['include']=[{'all':!![]}];}_0x47bd8a=_[_0x91fa('0x3f')]({},_0x47bd8a,_0x5dad2e[_0x91fa('0x40')]);return db[_0x91fa('0x2d')][_0x91fa('0x48')](_0x47bd8a)[_0x91fa('0x25')](handleEntityNotFound(_0x382fb5,null))[_0x91fa('0x25')](respondWithResult(_0x382fb5,null))[_0x91fa('0x44')](handleError(_0x382fb5,null));};exports[_0x91fa('0x49')]=function(_0x50aa1b,_0x3c554c){return db[_0x91fa('0x2d')][_0x91fa('0x49')](_0x50aa1b[_0x91fa('0x4a')],{})['then'](respondWithResult(_0x3c554c,0xc9))[_0x91fa('0x44')](handleError(_0x3c554c,null));};exports[_0x91fa('0x23')]=function(_0x27645d,_0x3f8ad7){if(_0x27645d[_0x91fa('0x4a')]['id']){delete _0x27645d['body']['id'];}return db[_0x91fa('0x2d')]['find']({'where':{'id':_0x27645d[_0x91fa('0x46')]['id']}})[_0x91fa('0x25')](handleEntityNotFound(_0x3f8ad7,null))[_0x91fa('0x25')](saveUpdates(_0x27645d[_0x91fa('0x4a')],null))[_0x91fa('0x25')](respondWithResult(_0x3f8ad7,null))[_0x91fa('0x44')](handleError(_0x3f8ad7,null));};exports[_0x91fa('0x24')]=function(_0x6c02b9,_0x36f280){return db[_0x91fa('0x2d')][_0x91fa('0x48')]({'where':{'id':_0x6c02b9['params']['id']}})[_0x91fa('0x25')](handleEntityNotFound(_0x36f280,null))['then'](removeEntity(_0x36f280,null))['catch'](handleError(_0x36f280,null));};exports['describe']=function(_0x49b160,_0x5e4c9a){return db[_0x91fa('0x2d')][_0x91fa('0x4b')]()[_0x91fa('0x25')](respondWithResult(_0x5e4c9a,null))[_0x91fa('0x44')](handleError(_0x5e4c9a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 270e8c0..91f38d8 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(_0x39f178,_0x29ce97){var _0x40ba9a=function(_0x109872){while(--_0x109872){_0x39f178['push'](_0x39f178['shift']());}};_0x40ba9a(++_0x29ce97);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0xdfbca7,_0x791315){var _0x124c4c=function(_0x5e8742){while(--_0x5e8742){_0xdfbca7['push'](_0xdfbca7['shift']());}};_0x124c4c(++_0x791315);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d2b5b01..87930cf 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 _0x3c55=['request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueueReport','create','body','raw','CreateChatQueueReport','UpdateChatQueueReport','update','options','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x3c55,0x7d));var _0x53c5=function(_0x2291d7,_0x41b380){_0x2291d7=_0x2291d7-0x0;var _0x2bb65d=_0x3c55[_0x2291d7];return _0x2bb65d;};'use strict';var _=require(_0x53c5('0x0'));var util=require('util');var moment=require(_0x53c5('0x1'));var BPromise=require(_0x53c5('0x2'));var rs=require(_0x53c5('0x3'));var fs=require('fs');var Redis=require(_0x53c5('0x4'));var db=require(_0x53c5('0x5'))['db'];var utils=require(_0x53c5('0x6'));var logger=require(_0x53c5('0x7'))('rpc');var config=require(_0x53c5('0x8'));var jayson=require(_0x53c5('0x9'));var client=jayson['client'][_0x53c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470098,_0x13b30b,_0x391bf0){return new BPromise(function(_0x4391ff,_0x53f017){return client[_0x53c5('0xb')](_0x470098,_0x391bf0)[_0x53c5('0xc')](function(_0x239b10){logger[_0x53c5('0xd')](_0x53c5('0xe'),_0x13b30b,'request\x20sent');logger[_0x53c5('0xf')](_0x53c5('0x10'),_0x13b30b,_0x53c5('0x11'),JSON[_0x53c5('0x12')](_0x239b10));if(_0x239b10[_0x53c5('0x13')]){if(_0x239b10[_0x53c5('0x13')][_0x53c5('0x14')]===0x1f4){logger[_0x53c5('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x13b30b,_0x239b10[_0x53c5('0x13')][_0x53c5('0x15')]);return _0x53f017(_0x239b10[_0x53c5('0x13')][_0x53c5('0x15')]);}logger[_0x53c5('0x13')](_0x53c5('0xe'),_0x13b30b,_0x239b10[_0x53c5('0x13')][_0x53c5('0x15')]);return _0x4391ff(_0x239b10[_0x53c5('0x13')]['message']);}else{logger[_0x53c5('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x13b30b,'request\x20sent');_0x4391ff(_0x239b10[_0x53c5('0x16')][_0x53c5('0x15')]);}})[_0x53c5('0x17')](function(_0x4b6b1c){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x13b30b,_0x4b6b1c);_0x53f017(_0x4b6b1c);});});}exports['CreateChatQueueReport']=function(_0x164a92){var _0x4a329d=this;return new Promise(function(_0x3059ff,_0xbe7bbc){return db[_0x53c5('0x18')][_0x53c5('0x19')](_0x164a92[_0x53c5('0x1a')],{'raw':_0x164a92['options']?_0x164a92['options'][_0x53c5('0x1b')]===undefined?!![]:![]:!![]})[_0x53c5('0xc')](function(_0xe7ecc5){logger[_0x53c5('0xd')](_0x53c5('0x1c'),_0x164a92);logger['debug'](_0x53c5('0x1c'),_0x164a92,JSON['stringify'](_0xe7ecc5));_0x3059ff(_0xe7ecc5);})[_0x53c5('0x17')](function(_0x127e84){logger['error']('CreateChatQueueReport',_0x127e84[_0x53c5('0x15')],_0x164a92);_0xbe7bbc(_0x4a329d[_0x53c5('0x13')](0x1f4,_0x127e84[_0x53c5('0x15')]));});});};exports[_0x53c5('0x1d')]=function(_0x517539){var _0x507119=this;return new Promise(function(_0x3b1ce9,_0x25fcc4){return db[_0x53c5('0x18')][_0x53c5('0x1e')](_0x517539['body'],{'raw':_0x517539[_0x53c5('0x1f')]?_0x517539[_0x53c5('0x1f')][_0x53c5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x517539[_0x53c5('0x1f')]?_0x517539[_0x53c5('0x1f')][_0x53c5('0x20')]||null:null,'attributes':_0x517539[_0x53c5('0x1f')]?_0x517539[_0x53c5('0x1f')][_0x53c5('0x21')]||null:null,'limit':_0x517539['options']?_0x517539[_0x53c5('0x1f')]['limit']||null:null})[_0x53c5('0xc')](function(_0x24084c){logger[_0x53c5('0xd')](_0x53c5('0x1d'),_0x517539);logger['debug'](_0x53c5('0x1d'),_0x517539,JSON[_0x53c5('0x12')](_0x24084c));_0x3b1ce9(_0x24084c);})[_0x53c5('0x17')](function(_0x4b73b8){logger[_0x53c5('0x13')](_0x53c5('0x1d'),_0x4b73b8['message'],_0x517539);_0x25fcc4(_0x507119[_0x53c5('0x13')](0x1f4,_0x4b73b8['message']));});});}; \ No newline at end of file +var _0xc8b8=['rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','debug','UpdateChatQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc8b8,0x99));var _0x8c8b=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0xc8b8[_0x59616b];return _0x5c4523;};'use strict';var _=require(_0x8c8b('0x0'));var util=require(_0x8c8b('0x1'));var moment=require(_0x8c8b('0x2'));var BPromise=require(_0x8c8b('0x3'));var rs=require(_0x8c8b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c8b('0x5'))['db'];var utils=require(_0x8c8b('0x6'));var logger=require('../../config/logger')(_0x8c8b('0x7'));var config=require(_0x8c8b('0x8'));var jayson=require(_0x8c8b('0x9'));var client=jayson['client'][_0x8c8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a8b38,_0x58bb2e,_0x16c4f8){return new BPromise(function(_0x4d379f,_0x3d4a95){return client[_0x8c8b('0xb')](_0x2a8b38,_0x16c4f8)[_0x8c8b('0xc')](function(_0x4c09d2){logger[_0x8c8b('0xd')](_0x8c8b('0xe'),_0x58bb2e,_0x8c8b('0xf'));logger['debug'](_0x8c8b('0x10'),_0x58bb2e,_0x8c8b('0xf'),JSON[_0x8c8b('0x11')](_0x4c09d2));if(_0x4c09d2[_0x8c8b('0x12')]){if(_0x4c09d2[_0x8c8b('0x12')]['code']===0x1f4){logger[_0x8c8b('0x12')](_0x8c8b('0xe'),_0x58bb2e,_0x4c09d2[_0x8c8b('0x12')][_0x8c8b('0x13')]);return _0x3d4a95(_0x4c09d2[_0x8c8b('0x12')][_0x8c8b('0x13')]);}logger['error'](_0x8c8b('0xe'),_0x58bb2e,_0x4c09d2[_0x8c8b('0x12')][_0x8c8b('0x13')]);return _0x4d379f(_0x4c09d2['error'][_0x8c8b('0x13')]);}else{logger[_0x8c8b('0xd')](_0x8c8b('0xe'),_0x58bb2e,_0x8c8b('0xf'));_0x4d379f(_0x4c09d2[_0x8c8b('0x14')]['message']);}})[_0x8c8b('0x15')](function(_0x5577c8){logger[_0x8c8b('0x12')](_0x8c8b('0xe'),_0x58bb2e,_0x5577c8);_0x3d4a95(_0x5577c8);});});}exports['CreateChatQueueReport']=function(_0x104b1f){var _0x40730d=this;return new Promise(function(_0x733514,_0x8076c){return db[_0x8c8b('0x16')][_0x8c8b('0x17')](_0x104b1f[_0x8c8b('0x18')],{'raw':_0x104b1f[_0x8c8b('0x19')]?_0x104b1f['options'][_0x8c8b('0x1a')]===undefined?!![]:![]:!![]})[_0x8c8b('0xc')](function(_0x193e72){logger[_0x8c8b('0xd')](_0x8c8b('0x1b'),_0x104b1f);logger[_0x8c8b('0x1c')](_0x8c8b('0x1b'),_0x104b1f,JSON['stringify'](_0x193e72));_0x733514(_0x193e72);})['catch'](function(_0x415991){logger[_0x8c8b('0x12')]('CreateChatQueueReport',_0x415991['message'],_0x104b1f);_0x8076c(_0x40730d[_0x8c8b('0x12')](0x1f4,_0x415991[_0x8c8b('0x13')]));});});};exports[_0x8c8b('0x1d')]=function(_0x5d7d6e){var _0x33f9f7=this;return new Promise(function(_0x5108e3,_0x1afbb9){return db['ChatQueueReport']['update'](_0x5d7d6e[_0x8c8b('0x18')],{'raw':_0x5d7d6e[_0x8c8b('0x19')]?_0x5d7d6e[_0x8c8b('0x19')][_0x8c8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7d6e[_0x8c8b('0x19')]?_0x5d7d6e[_0x8c8b('0x19')][_0x8c8b('0x1e')]||null:null,'attributes':_0x5d7d6e[_0x8c8b('0x19')]?_0x5d7d6e['options'][_0x8c8b('0x1f')]||null:null,'limit':_0x5d7d6e[_0x8c8b('0x19')]?_0x5d7d6e['options']['limit']||null:null})[_0x8c8b('0xc')](function(_0x496161){logger[_0x8c8b('0xd')](_0x8c8b('0x1d'),_0x5d7d6e);logger[_0x8c8b('0x1c')](_0x8c8b('0x1d'),_0x5d7d6e,JSON[_0x8c8b('0x11')](_0x496161));_0x5108e3(_0x496161);})[_0x8c8b('0x15')](function(_0x4c56fc){logger['error'](_0x8c8b('0x1d'),_0x4c56fc['message'],_0x5d7d6e);_0x1afbb9(_0x33f9f7[_0x8c8b('0x12')](0x1f4,_0x4c56fc[_0x8c8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 39174d9..97aee7e 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 _0xdbbc=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x2402dd,_0x3eb7d8){var _0x21b85c=function(_0x282768){while(--_0x282768){_0x2402dd['push'](_0x2402dd['shift']());}};_0x21b85c(++_0x3eb7d8);}(_0xdbbc,0x170));var _0xcdbb=function(_0x3b3f90,_0x388364){_0x3b3f90=_0x3b3f90-0x0;var _0x52522e=_0xdbbc[_0x3b3f90];return _0x52522e;};'use strict';var multer=require(_0xcdbb('0x0'));var util=require(_0xcdbb('0x1'));var path=require(_0xcdbb('0x2'));var timeout=require('connect-timeout');var express=require(_0xcdbb('0x3'));var router=express['Router']();var fs_extra=require(_0xcdbb('0x4'));var auth=require(_0xcdbb('0x5'));var interaction=require(_0xcdbb('0x6'));var config=require(_0xcdbb('0x7'));var controller=require(_0xcdbb('0x8'));router[_0xcdbb('0x9')]('/',auth[_0xcdbb('0xa')](),controller[_0xcdbb('0xb')]);router['get'](_0xcdbb('0xc'),auth[_0xcdbb('0xa')](),controller[_0xcdbb('0xd')]);router[_0xcdbb('0x9')](_0xcdbb('0xe'),auth[_0xcdbb('0xa')](),controller[_0xcdbb('0xf')]);router[_0xcdbb('0x10')]('/',auth['isAuthenticated'](),controller[_0xcdbb('0x11')]);router[_0xcdbb('0x12')](_0xcdbb('0xe'),auth['isAuthenticated'](),controller[_0xcdbb('0x13')]);router[_0xcdbb('0x14')](_0xcdbb('0xe'),auth['isAuthenticated'](),controller[_0xcdbb('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7009=['post','put','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0x3d3028,_0x489e13){var _0x341599=function(_0x4f0c43){while(--_0x4f0c43){_0x3d3028['push'](_0x3d3028['shift']());}};_0x341599(++_0x489e13);}(_0x7009,0x73));var _0x9700=function(_0x5a7aa4,_0x190480){_0x5a7aa4=_0x5a7aa4-0x0;var _0x496dc6=_0x7009[_0x5a7aa4];return _0x496dc6;};'use strict';var multer=require('multer');var util=require(_0x9700('0x0'));var path=require(_0x9700('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9700('0x2')]();var fs_extra=require(_0x9700('0x3'));var auth=require(_0x9700('0x4'));var interaction=require(_0x9700('0x5'));var config=require(_0x9700('0x6'));var controller=require(_0x9700('0x7'));router[_0x9700('0x8')]('/',auth[_0x9700('0x9')](),controller[_0x9700('0xa')]);router[_0x9700('0x8')]('/describe',auth[_0x9700('0x9')](),controller['describe']);router[_0x9700('0x8')]('/:id',auth[_0x9700('0x9')](),controller['show']);router[_0x9700('0xb')]('/',auth[_0x9700('0x9')](),controller['create']);router[_0x9700('0xc')]('/:id',auth[_0x9700('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9700('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 32e98fb..770b374 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0xb43b,0x1b2));var _0xbb43=function(_0x6c7c2c,_0x1c956b){_0x6c7c2c=_0x6c7c2c-0x0;var _0x5df439=_0xb43b[_0x6c7c2c];return _0x5df439;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2f8bc5,_0x12e3d1){var _0x2e4207=function(_0x217405){while(--_0x217405){_0x2f8bc5['push'](_0x2f8bc5['shift']());}};_0x2e4207(++_0x12e3d1);}(_0x008c,0x188));var _0xc008=function(_0x3ab6cb,_0x591249){_0x3ab6cb=_0x3ab6cb-0x0;var _0x108ae5=_0x008c[_0x3ab6cb];return _0x108ae5;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a7c5d81..2029ece 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 _0xe277=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','save','update','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','catch','show','params','find','then','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4f0b54,_0x301666){var _0x3e2440=function(_0x1369e2){while(--_0x1369e2){_0x4f0b54['push'](_0x4f0b54['shift']());}};_0x3e2440(++_0x301666);}(_0xe277,0xca));var _0x7e27=function(_0x2fb29e,_0x2b1bea){_0x2fb29e=_0x2fb29e-0x0;var _0x718e4e=_0xe277[_0x2fb29e];return _0x718e4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e27('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e27('0x1'));var rp=require(_0x7e27('0x2'));var moment=require(_0x7e27('0x3'));var BPromise=require(_0x7e27('0x4'));var Mustache=require(_0x7e27('0x5'));var util=require(_0x7e27('0x6'));var path=require(_0x7e27('0x7'));var sox=require(_0x7e27('0x8'));var csv=require(_0x7e27('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e27('0xa'));var _=require(_0x7e27('0xb'));var squel=require(_0x7e27('0xc'));var crypto=require(_0x7e27('0xd'));var jsforce=require(_0x7e27('0xe'));var deskjs=require(_0x7e27('0xf'));var toCsv=require(_0x7e27('0x9'));var querystring=require('querystring');var Papa=require(_0x7e27('0x10'));var Redis=require(_0x7e27('0x11'));var authService=require(_0x7e27('0x12'));var qs=require(_0x7e27('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e27('0x14'));var logger=require(_0x7e27('0x15'))('api');var utils=require(_0x7e27('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7e27('0x17'));var db=require(_0x7e27('0x18'))['db'];function respondWithStatusCode(_0x20c1eb,_0x2358ed){_0x2358ed=_0x2358ed||0xcc;return function(_0x560dc1){if(_0x560dc1){return _0x20c1eb['sendStatus'](_0x2358ed);}return _0x20c1eb[_0x7e27('0x19')](_0x2358ed)[_0x7e27('0x1a')]();};}function respondWithResult(_0x28f54a,_0x4541bd){_0x4541bd=_0x4541bd||0xc8;return function(_0x104d8c){if(_0x104d8c){return _0x28f54a[_0x7e27('0x19')](_0x4541bd)[_0x7e27('0x1b')](_0x104d8c);}};}function respondWithFilteredResult(_0x2bca97,_0x129ee7){return function(_0x2e860e){if(_0x2e860e){var _0x29ac9b=typeof _0x129ee7[_0x7e27('0x1c')]===_0x7e27('0x1d')&&typeof _0x129ee7[_0x7e27('0x1e')]===_0x7e27('0x1d');var _0x36bd76=_0x2e860e[_0x7e27('0x1f')];var _0x5ddfae=_0x29ac9b?0x0:_0x129ee7[_0x7e27('0x1c')];var _0x402fa4=_0x29ac9b?_0x2e860e[_0x7e27('0x1f')]:_0x129ee7[_0x7e27('0x1c')]+_0x129ee7[_0x7e27('0x1e')];var _0x27ebfc;if(_0x402fa4>=_0x36bd76){_0x402fa4=_0x36bd76;_0x27ebfc=0xc8;}else{_0x27ebfc=0xce;}_0x2bca97['status'](_0x27ebfc);return _0x2bca97['set']('Content-Range',_0x5ddfae+'-'+_0x402fa4+'/'+_0x36bd76)['json'](_0x2e860e);}return null;};}function patchUpdates(_0x1ae8da){return function(_0x536926){try{jsonpatch['apply'](_0x536926,_0x1ae8da,!![]);}catch(_0x3be779){return BPromise['reject'](_0x3be779);}return _0x536926[_0x7e27('0x20')]();};}function saveUpdates(_0x3f557f,_0x123baa){return function(_0x1f643e){if(_0x1f643e){return _0x1f643e[_0x7e27('0x21')](_0x3f557f)['then'](function(_0x5dde9b){return _0x5dde9b;});}return null;};}function removeEntity(_0x4a4cee,_0x3f9c01){return function(_0x57f5e6){if(_0x57f5e6){return _0x57f5e6[_0x7e27('0x22')]()['then'](function(){_0x4a4cee[_0x7e27('0x19')](0xcc)[_0x7e27('0x1a')]();});}};}function handleEntityNotFound(_0x53751a,_0x513bd9){return function(_0x24f7cf){if(!_0x24f7cf){_0x53751a[_0x7e27('0x23')](0x194);}return _0x24f7cf;};}function handleError(_0x382c90,_0x2ce8da){_0x2ce8da=_0x2ce8da||0x1f4;return function(_0xa87596){logger[_0x7e27('0x24')](_0xa87596['stack']);if(_0xa87596[_0x7e27('0x25')]){delete _0xa87596[_0x7e27('0x25')];}_0x382c90[_0x7e27('0x19')](_0x2ce8da)[_0x7e27('0x26')](_0xa87596);};}exports[_0x7e27('0x27')]=function(_0x621960,_0xad8f54){var _0x220870={},_0x22b67c={},_0x585030={'count':0x0,'rows':[]};var _0x2e7864=_[_0x7e27('0x28')](db['ChatTransferReport'][_0x7e27('0x29')],function(_0x2c31e0){return{'name':_0x2c31e0[_0x7e27('0x2a')],'type':_0x2c31e0[_0x7e27('0x2b')]['key']};});_0x22b67c[_0x7e27('0x2c')]=_[_0x7e27('0x28')](_0x2e7864,_0x7e27('0x25'));_0x22b67c[_0x7e27('0x2d')]=_[_0x7e27('0x2e')](_0x621960[_0x7e27('0x2d')]);_0x22b67c[_0x7e27('0x2f')]=_[_0x7e27('0x30')](_0x22b67c[_0x7e27('0x2c')],_0x22b67c['query']);_0x220870['attributes']=_[_0x7e27('0x30')](_0x22b67c['model'],qs[_0x7e27('0x31')](_0x621960['query'][_0x7e27('0x31')]));_0x220870[_0x7e27('0x32')]=_0x220870[_0x7e27('0x32')][_0x7e27('0x33')]?_0x220870['attributes']:_0x22b67c['model'];if(!_0x621960[_0x7e27('0x2d')]['hasOwnProperty']('nolimit')){_0x220870[_0x7e27('0x1e')]=qs[_0x7e27('0x1e')](_0x621960['query']['limit']);_0x220870[_0x7e27('0x1c')]=qs[_0x7e27('0x1c')](_0x621960[_0x7e27('0x2d')][_0x7e27('0x1c')]);}_0x220870[_0x7e27('0x34')]=qs[_0x7e27('0x35')](_0x621960[_0x7e27('0x2d')][_0x7e27('0x35')]);_0x220870[_0x7e27('0x36')]=qs[_0x7e27('0x2f')](_['pick'](_0x621960[_0x7e27('0x2d')],_0x22b67c[_0x7e27('0x2f')]),_0x2e7864);if(_0x621960[_0x7e27('0x2d')]['filter']){_0x220870[_0x7e27('0x36')]=_[_0x7e27('0x37')](_0x220870[_0x7e27('0x36')],{'$or':_['map'](_0x2e7864,function(_0x3d8eb8){if(_0x3d8eb8[_0x7e27('0x2b')]!==_0x7e27('0x38')){var _0x1da0d={};_0x1da0d[_0x3d8eb8['name']]={'$like':'%'+_0x621960['query']['filter']+'%'};return _0x1da0d;}})});}_0x220870=_[_0x7e27('0x37')]({},_0x220870,_0x621960[_0x7e27('0x39')]);var _0x575869={'where':_0x220870['where']};return db['ChatTransferReport']['count'](_0x575869)['then'](function(_0x454bcc){_0x585030[_0x7e27('0x1f')]=_0x454bcc;if(_0x621960[_0x7e27('0x2d')][_0x7e27('0x3a')]){_0x220870[_0x7e27('0x3b')]=[{'all':!![]}];}return db[_0x7e27('0x3c')][_0x7e27('0x3d')](_0x220870);})['then'](function(_0x1ac66b){_0x585030['rows']=_0x1ac66b;return _0x585030;})['then'](respondWithFilteredResult(_0xad8f54,_0x220870))[_0x7e27('0x3e')](handleError(_0xad8f54,null));};exports[_0x7e27('0x3f')]=function(_0x337f9d,_0x5a7465){var _0x5f4ff6={'raw':!![],'where':{'id':_0x337f9d[_0x7e27('0x40')]['id']}},_0x167c6a={};_0x167c6a[_0x7e27('0x2c')]=_[_0x7e27('0x2e')](db[_0x7e27('0x3c')][_0x7e27('0x29')]);_0x167c6a['query']=_['keys'](_0x337f9d[_0x7e27('0x2d')]);_0x167c6a[_0x7e27('0x2f')]=_[_0x7e27('0x30')](_0x167c6a[_0x7e27('0x2c')],_0x167c6a['query']);_0x5f4ff6[_0x7e27('0x32')]=_[_0x7e27('0x30')](_0x167c6a[_0x7e27('0x2c')],qs['fields'](_0x337f9d[_0x7e27('0x2d')][_0x7e27('0x31')]));_0x5f4ff6[_0x7e27('0x32')]=_0x5f4ff6['attributes'][_0x7e27('0x33')]?_0x5f4ff6[_0x7e27('0x32')]:_0x167c6a[_0x7e27('0x2c')];if(_0x337f9d[_0x7e27('0x2d')]['includeAll']){_0x5f4ff6[_0x7e27('0x3b')]=[{'all':!![]}];}_0x5f4ff6=_[_0x7e27('0x37')]({},_0x5f4ff6,_0x337f9d['options']);return db[_0x7e27('0x3c')][_0x7e27('0x41')](_0x5f4ff6)[_0x7e27('0x42')](handleEntityNotFound(_0x5a7465,null))['then'](respondWithResult(_0x5a7465,null))[_0x7e27('0x3e')](handleError(_0x5a7465,null));};exports[_0x7e27('0x43')]=function(_0x42a6f1,_0x38c237){return db[_0x7e27('0x3c')][_0x7e27('0x43')](_0x42a6f1[_0x7e27('0x44')],{})[_0x7e27('0x42')](respondWithResult(_0x38c237,0xc9))[_0x7e27('0x3e')](handleError(_0x38c237,null));};exports[_0x7e27('0x21')]=function(_0x55cfa5,_0x571559){if(_0x55cfa5[_0x7e27('0x44')]['id']){delete _0x55cfa5[_0x7e27('0x44')]['id'];}return db[_0x7e27('0x3c')]['find']({'where':{'id':_0x55cfa5[_0x7e27('0x40')]['id']}})[_0x7e27('0x42')](handleEntityNotFound(_0x571559,null))['then'](saveUpdates(_0x55cfa5[_0x7e27('0x44')],null))[_0x7e27('0x42')](respondWithResult(_0x571559,null))['catch'](handleError(_0x571559,null));};exports[_0x7e27('0x22')]=function(_0x236d1f,_0x3b0b14){return db[_0x7e27('0x3c')]['find']({'where':{'id':_0x236d1f['params']['id']}})[_0x7e27('0x42')](handleEntityNotFound(_0x3b0b14,null))[_0x7e27('0x42')](removeEntity(_0x3b0b14,null))[_0x7e27('0x3e')](handleError(_0x3b0b14,null));};exports[_0x7e27('0x45')]=function(_0x814079,_0x1abc0d){return db[_0x7e27('0x3c')][_0x7e27('0x45')]()[_0x7e27('0x42')](respondWithResult(_0x1abc0d,null))[_0x7e27('0x3e')](handleError(_0x1abc0d,null));}; \ No newline at end of file +var _0xb697=['rimraf','request-promise','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','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','order','sort','where','pick','merge','filter','options','rows','catch','show','params','includeAll','include','create','body','find','describe','eml-format'];(function(_0xc5f15,_0x3f18b5){var _0x466999=function(_0x24250d){while(--_0x24250d){_0xc5f15['push'](_0xc5f15['shift']());}};_0x466999(++_0x3f18b5);}(_0xb697,0xcb));var _0x7b69=function(_0x5805b0,_0x2d205d){_0x5805b0=_0x5805b0-0x0;var _0x1679c7=_0xb697[_0x5805b0];return _0x1679c7;};'use strict';var emlformat=require(_0x7b69('0x0'));var rimraf=require(_0x7b69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7b69('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b69('0x3'));var path=require(_0x7b69('0x4'));var sox=require(_0x7b69('0x5'));var csv=require(_0x7b69('0x6'));var ejs=require(_0x7b69('0x7'));var fs=require('fs');var fs_extra=require(_0x7b69('0x8'));var _=require(_0x7b69('0x9'));var squel=require(_0x7b69('0xa'));var crypto=require(_0x7b69('0xb'));var jsforce=require(_0x7b69('0xc'));var deskjs=require(_0x7b69('0xd'));var toCsv=require(_0x7b69('0x6'));var querystring=require(_0x7b69('0xe'));var Papa=require('papaparse');var Redis=require(_0x7b69('0xf'));var authService=require(_0x7b69('0x10'));var qs=require(_0x7b69('0x11'));var as=require(_0x7b69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7b69('0x13'));var utils=require('../../config/utils');var config=require(_0x7b69('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b69('0x15'))['db'];function respondWithStatusCode(_0x395721,_0x5bd135){_0x5bd135=_0x5bd135||0xcc;return function(_0x1d9e85){if(_0x1d9e85){return _0x395721[_0x7b69('0x16')](_0x5bd135);}return _0x395721[_0x7b69('0x17')](_0x5bd135)[_0x7b69('0x18')]();};}function respondWithResult(_0x1d7142,_0x30f57f){_0x30f57f=_0x30f57f||0xc8;return function(_0x361f6c){if(_0x361f6c){return _0x1d7142[_0x7b69('0x17')](_0x30f57f)['json'](_0x361f6c);}};}function respondWithFilteredResult(_0x1e3a74,_0x20d466){return function(_0x3c6e6c){if(_0x3c6e6c){var _0x1e3df5=typeof _0x20d466[_0x7b69('0x19')]===_0x7b69('0x1a')&&typeof _0x20d466[_0x7b69('0x1b')]==='undefined';var _0x476b61=_0x3c6e6c[_0x7b69('0x1c')];var _0x31b88e=_0x1e3df5?0x0:_0x20d466[_0x7b69('0x19')];var _0x11a874=_0x1e3df5?_0x3c6e6c[_0x7b69('0x1c')]:_0x20d466['offset']+_0x20d466[_0x7b69('0x1b')];var _0xe00fd7;if(_0x11a874>=_0x476b61){_0x11a874=_0x476b61;_0xe00fd7=0xc8;}else{_0xe00fd7=0xce;}_0x1e3a74[_0x7b69('0x17')](_0xe00fd7);return _0x1e3a74['set'](_0x7b69('0x1d'),_0x31b88e+'-'+_0x11a874+'/'+_0x476b61)['json'](_0x3c6e6c);}return null;};}function patchUpdates(_0x3a2ed2){return function(_0x27d9b4){try{jsonpatch['apply'](_0x27d9b4,_0x3a2ed2,!![]);}catch(_0x166436){return BPromise[_0x7b69('0x1e')](_0x166436);}return _0x27d9b4['save']();};}function saveUpdates(_0x29f7ea,_0x5d83a6){return function(_0x4147a6){if(_0x4147a6){return _0x4147a6[_0x7b69('0x1f')](_0x29f7ea)['then'](function(_0x2be697){return _0x2be697;});}return null;};}function removeEntity(_0x23e1d3,_0x219570){return function(_0x5c5920){if(_0x5c5920){return _0x5c5920[_0x7b69('0x20')]()[_0x7b69('0x21')](function(){_0x23e1d3[_0x7b69('0x17')](0xcc)[_0x7b69('0x18')]();});}};}function handleEntityNotFound(_0x422294,_0x5e6ae3){return function(_0x26c953){if(!_0x26c953){_0x422294['sendStatus'](0x194);}return _0x26c953;};}function handleError(_0x868858,_0x505f36){_0x505f36=_0x505f36||0x1f4;return function(_0x31abff){logger[_0x7b69('0x22')](_0x31abff[_0x7b69('0x23')]);if(_0x31abff[_0x7b69('0x24')]){delete _0x31abff[_0x7b69('0x24')];}_0x868858[_0x7b69('0x17')](_0x505f36)[_0x7b69('0x25')](_0x31abff);};}exports[_0x7b69('0x26')]=function(_0x1b899a,_0x5ebd12){var _0x5ed6d1={},_0x10872c={},_0x588966={'count':0x0,'rows':[]};var _0x540f4c=_[_0x7b69('0x27')](db[_0x7b69('0x28')][_0x7b69('0x29')],function(_0x29c581){return{'name':_0x29c581[_0x7b69('0x2a')],'type':_0x29c581[_0x7b69('0x2b')]['key']};});_0x10872c[_0x7b69('0x2c')]=_['map'](_0x540f4c,_0x7b69('0x24'));_0x10872c['query']=_['keys'](_0x1b899a['query']);_0x10872c[_0x7b69('0x2d')]=_[_0x7b69('0x2e')](_0x10872c[_0x7b69('0x2c')],_0x10872c[_0x7b69('0x2f')]);_0x5ed6d1[_0x7b69('0x30')]=_[_0x7b69('0x2e')](_0x10872c[_0x7b69('0x2c')],qs[_0x7b69('0x31')](_0x1b899a[_0x7b69('0x2f')][_0x7b69('0x31')]));_0x5ed6d1[_0x7b69('0x30')]=_0x5ed6d1['attributes'][_0x7b69('0x32')]?_0x5ed6d1[_0x7b69('0x30')]:_0x10872c[_0x7b69('0x2c')];if(!_0x1b899a[_0x7b69('0x2f')]['hasOwnProperty']('nolimit')){_0x5ed6d1[_0x7b69('0x1b')]=qs[_0x7b69('0x1b')](_0x1b899a['query'][_0x7b69('0x1b')]);_0x5ed6d1[_0x7b69('0x19')]=qs[_0x7b69('0x19')](_0x1b899a[_0x7b69('0x2f')]['offset']);}_0x5ed6d1[_0x7b69('0x33')]=qs['sort'](_0x1b899a[_0x7b69('0x2f')][_0x7b69('0x34')]);_0x5ed6d1[_0x7b69('0x35')]=qs[_0x7b69('0x2d')](_[_0x7b69('0x36')](_0x1b899a[_0x7b69('0x2f')],_0x10872c[_0x7b69('0x2d')]),_0x540f4c);if(_0x1b899a[_0x7b69('0x2f')]['filter']){_0x5ed6d1[_0x7b69('0x35')]=_[_0x7b69('0x37')](_0x5ed6d1['where'],{'$or':_[_0x7b69('0x27')](_0x540f4c,function(_0x2e97cf){if(_0x2e97cf[_0x7b69('0x2b')]!=='VIRTUAL'){var _0x1eb39f={};_0x1eb39f[_0x2e97cf[_0x7b69('0x24')]]={'$like':'%'+_0x1b899a[_0x7b69('0x2f')][_0x7b69('0x38')]+'%'};return _0x1eb39f;}})});}_0x5ed6d1=_[_0x7b69('0x37')]({},_0x5ed6d1,_0x1b899a[_0x7b69('0x39')]);var _0x3246d2={'where':_0x5ed6d1[_0x7b69('0x35')]};return db[_0x7b69('0x28')][_0x7b69('0x1c')](_0x3246d2)['then'](function(_0x4fd981){_0x588966[_0x7b69('0x1c')]=_0x4fd981;if(_0x1b899a[_0x7b69('0x2f')]['includeAll']){_0x5ed6d1['include']=[{'all':!![]}];}return db[_0x7b69('0x28')]['findAll'](_0x5ed6d1);})[_0x7b69('0x21')](function(_0x529b99){_0x588966[_0x7b69('0x3a')]=_0x529b99;return _0x588966;})['then'](respondWithFilteredResult(_0x5ebd12,_0x5ed6d1))[_0x7b69('0x3b')](handleError(_0x5ebd12,null));};exports[_0x7b69('0x3c')]=function(_0xb7d534,_0x3afef1){var _0x9b4f4b={'raw':!![],'where':{'id':_0xb7d534[_0x7b69('0x3d')]['id']}},_0x1472b5={};_0x1472b5[_0x7b69('0x2c')]=_['keys'](db['ChatTransferReport'][_0x7b69('0x29')]);_0x1472b5[_0x7b69('0x2f')]=_['keys'](_0xb7d534[_0x7b69('0x2f')]);_0x1472b5[_0x7b69('0x2d')]=_[_0x7b69('0x2e')](_0x1472b5[_0x7b69('0x2c')],_0x1472b5['query']);_0x9b4f4b[_0x7b69('0x30')]=_['intersection'](_0x1472b5[_0x7b69('0x2c')],qs[_0x7b69('0x31')](_0xb7d534[_0x7b69('0x2f')][_0x7b69('0x31')]));_0x9b4f4b[_0x7b69('0x30')]=_0x9b4f4b[_0x7b69('0x30')][_0x7b69('0x32')]?_0x9b4f4b['attributes']:_0x1472b5[_0x7b69('0x2c')];if(_0xb7d534[_0x7b69('0x2f')][_0x7b69('0x3e')]){_0x9b4f4b[_0x7b69('0x3f')]=[{'all':!![]}];}_0x9b4f4b=_['merge']({},_0x9b4f4b,_0xb7d534[_0x7b69('0x39')]);return db[_0x7b69('0x28')]['find'](_0x9b4f4b)[_0x7b69('0x21')](handleEntityNotFound(_0x3afef1,null))['then'](respondWithResult(_0x3afef1,null))[_0x7b69('0x3b')](handleError(_0x3afef1,null));};exports[_0x7b69('0x40')]=function(_0x15c156,_0x2670b6){return db['ChatTransferReport']['create'](_0x15c156[_0x7b69('0x41')],{})[_0x7b69('0x21')](respondWithResult(_0x2670b6,0xc9))[_0x7b69('0x3b')](handleError(_0x2670b6,null));};exports[_0x7b69('0x1f')]=function(_0x1b2717,_0x2b0b95){if(_0x1b2717[_0x7b69('0x41')]['id']){delete _0x1b2717['body']['id'];}return db[_0x7b69('0x28')]['find']({'where':{'id':_0x1b2717[_0x7b69('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2b0b95,null))['then'](saveUpdates(_0x1b2717[_0x7b69('0x41')],null))[_0x7b69('0x21')](respondWithResult(_0x2b0b95,null))[_0x7b69('0x3b')](handleError(_0x2b0b95,null));};exports[_0x7b69('0x20')]=function(_0x2e2278,_0x432f85){return db['ChatTransferReport'][_0x7b69('0x42')]({'where':{'id':_0x2e2278['params']['id']}})[_0x7b69('0x21')](handleEntityNotFound(_0x432f85,null))[_0x7b69('0x21')](removeEntity(_0x432f85,null))[_0x7b69('0x3b')](handleError(_0x432f85,null));};exports[_0x7b69('0x43')]=function(_0x12ee3b,_0x656b61){return db[_0x7b69('0x28')][_0x7b69('0x43')]()[_0x7b69('0x21')](respondWithResult(_0x656b61,null))[_0x7b69('0x3b')](handleError(_0x656b61,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index cbb402b..788894d 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 _0x1643=['uniqueid','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x46b3c8,_0x58199f){var _0x287b01=function(_0x38c92f){while(--_0x38c92f){_0x46b3c8['push'](_0x46b3c8['shift']());}};_0x287b01(++_0x58199f);}(_0x1643,0x1e1));var _0x3164=function(_0xbfbfd9,_0x33d7e0){_0xbfbfd9=_0xbfbfd9-0x0;var _0x1a7cec=_0x1643[_0xbfbfd9];return _0x1a7cec;};'use strict';var _=require(_0x3164('0x0'));var util=require(_0x3164('0x1'));var logger=require(_0x3164('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3164('0x3'));var rp=require(_0x3164('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3164('0x5'));var attributes=require(_0x3164('0x6'));module[_0x3164('0x7')]=function(_0x42f0da,_0x40e899){return _0x42f0da[_0x3164('0x8')](_0x3164('0x9'),attributes,{'tableName':_0x3164('0xa'),'paranoid':![],'indexes':[{'name':_0x3164('0xb'),'fields':[_0x3164('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c26=['../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x4c26,0x74));var _0x64c2=function(_0x4c31cd,_0x46b209){_0x4c31cd=_0x4c31cd-0x0;var _0x41c1a1=_0x4c26[_0x4c31cd];return _0x41c1a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x64c2('0x0'))('api');var moment=require(_0x64c2('0x1'));var BPromise=require(_0x64c2('0x2'));var rp=require(_0x64c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64c2('0x4'));var config=require(_0x64c2('0x5'));var attributes=require(_0x64c2('0x6'));module['exports']=function(_0x871c1f,_0x306942){return _0x871c1f[_0x64c2('0x7')](_0x64c2('0x8'),attributes,{'tableName':_0x64c2('0x9'),'paranoid':![],'indexes':[{'name':_0x64c2('0xa'),'fields':[_0x64c2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 37e6ed8..a8c4e47 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 _0x0869=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x141a1b,_0x48ce01){var _0x54319f=function(_0x841771){while(--_0x841771){_0x141a1b['push'](_0x141a1b['shift']());}};_0x54319f(++_0x48ce01);}(_0x0869,0xd0));var _0x9086=function(_0x128673,_0x1215f0){_0x128673=_0x128673-0x0;var _0x45e047=_0x0869[_0x128673];return _0x45e047;};'use strict';var _=require(_0x9086('0x0'));var util=require(_0x9086('0x1'));var moment=require('moment');var BPromise=require(_0x9086('0x2'));var rs=require(_0x9086('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9086('0x4'))['db'];var utils=require(_0x9086('0x5'));var logger=require('../../config/logger')(_0x9086('0x6'));var config=require('../../config/environment');var jayson=require(_0x9086('0x7'));var client=jayson[_0x9086('0x8')][_0x9086('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f24ce,_0x57a8ac,_0x398411){return new BPromise(function(_0x3f5c03,_0x4421cc){return client[_0x9086('0xa')](_0x1f24ce,_0x398411)[_0x9086('0xb')](function(_0x26235e){logger[_0x9086('0xc')](_0x9086('0xd'),_0x57a8ac,_0x9086('0xe'));logger[_0x9086('0xf')](_0x9086('0x10'),_0x57a8ac,_0x9086('0xe'),JSON[_0x9086('0x11')](_0x26235e));if(_0x26235e[_0x9086('0x12')]){if(_0x26235e[_0x9086('0x12')]['code']===0x1f4){logger[_0x9086('0x12')](_0x9086('0xd'),_0x57a8ac,_0x26235e[_0x9086('0x12')][_0x9086('0x13')]);return _0x4421cc(_0x26235e[_0x9086('0x12')][_0x9086('0x13')]);}logger['error'](_0x9086('0xd'),_0x57a8ac,_0x26235e[_0x9086('0x12')][_0x9086('0x13')]);return _0x3f5c03(_0x26235e[_0x9086('0x12')]['message']);}else{logger[_0x9086('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x57a8ac,_0x9086('0xe'));_0x3f5c03(_0x26235e['result'][_0x9086('0x13')]);}})[_0x9086('0x14')](function(_0x1a9c38){logger['error'](_0x9086('0xd'),_0x57a8ac,_0x1a9c38);_0x4421cc(_0x1a9c38);});});} \ No newline at end of file +var _0x3d97=['http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x31adfc,_0x2a3aae){var _0x669fc5=function(_0x37850a){while(--_0x37850a){_0x31adfc['push'](_0x31adfc['shift']());}};_0x669fc5(++_0x2a3aae);}(_0x3d97,0x18d));var _0x73d9=function(_0x3bdae4,_0x340726){_0x3bdae4=_0x3bdae4-0x0;var _0x10fcbb=_0x3d97[_0x3bdae4];return _0x10fcbb;};'use strict';var _=require(_0x73d9('0x0'));var util=require(_0x73d9('0x1'));var moment=require(_0x73d9('0x2'));var BPromise=require(_0x73d9('0x3'));var rs=require(_0x73d9('0x4'));var fs=require('fs');var Redis=require(_0x73d9('0x5'));var db=require(_0x73d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x73d9('0x7'))(_0x73d9('0x8'));var config=require(_0x73d9('0x9'));var jayson=require(_0x73d9('0xa'));var client=jayson['client'][_0x73d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37857f,_0x49e8bf,_0x186958){return new BPromise(function(_0x37f4bd,_0x501321){return client[_0x73d9('0xc')](_0x37857f,_0x186958)[_0x73d9('0xd')](function(_0x354bfa){logger['info'](_0x73d9('0xe'),_0x49e8bf,_0x73d9('0xf'));logger[_0x73d9('0x10')](_0x73d9('0x11'),_0x49e8bf,'request\x20sent',JSON['stringify'](_0x354bfa));if(_0x354bfa[_0x73d9('0x12')]){if(_0x354bfa[_0x73d9('0x12')][_0x73d9('0x13')]===0x1f4){logger[_0x73d9('0x12')](_0x73d9('0xe'),_0x49e8bf,_0x354bfa[_0x73d9('0x12')][_0x73d9('0x14')]);return _0x501321(_0x354bfa[_0x73d9('0x12')][_0x73d9('0x14')]);}logger['error'](_0x73d9('0xe'),_0x49e8bf,_0x354bfa['error'][_0x73d9('0x14')]);return _0x37f4bd(_0x354bfa['error'][_0x73d9('0x14')]);}else{logger[_0x73d9('0x15')](_0x73d9('0xe'),_0x49e8bf,_0x73d9('0xf'));_0x37f4bd(_0x354bfa[_0x73d9('0x16')][_0x73d9('0x14')]);}})[_0x73d9('0x17')](function(_0x4c8865){logger['error'](_0x73d9('0xe'),_0x49e8bf,_0x4c8865);_0x501321(_0x4c8865);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 707b7a2..fb0d1ee 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 _0x10df=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','destroy'];(function(_0x3636ed,_0x2bebfb){var _0x439afe=function(_0x512757){while(--_0x512757){_0x3636ed['push'](_0x3636ed['shift']());}};_0x439afe(++_0x2bebfb);}(_0x10df,0xc9));var _0xf10d=function(_0x2c0c25,_0x5b0a19){_0x2c0c25=_0x2c0c25-0x0;var _0x2d8cf8=_0x10df[_0x2c0c25];return _0x2d8cf8;};'use strict';var multer=require(_0xf10d('0x0'));var util=require(_0xf10d('0x1'));var path=require(_0xf10d('0x2'));var timeout=require(_0xf10d('0x3'));var express=require('express');var router=express[_0xf10d('0x4')]();var fs_extra=require(_0xf10d('0x5'));var auth=require(_0xf10d('0x6'));var interaction=require(_0xf10d('0x7'));var config=require('../../config/environment');var controller=require(_0xf10d('0x8'));router[_0xf10d('0x9')]('/',auth[_0xf10d('0xa')](),controller['index']);router[_0xf10d('0x9')](_0xf10d('0xb'),auth['isAuthenticated'](),controller[_0xf10d('0xc')]);router[_0xf10d('0x9')](_0xf10d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf10d('0xe')]('/',auth[_0xf10d('0xa')](),controller[_0xf10d('0xf')]);router['put'](_0xf10d('0xd'),auth[_0xf10d('0xa')](),controller[_0xf10d('0x10')]);router[_0xf10d('0x11')](_0xf10d('0xd'),auth[_0xf10d('0xa')](),controller[_0xf10d('0x12')]);module[_0xf10d('0x13')]=router; \ No newline at end of file +var _0x064d=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','/:id','destroy','exports'];(function(_0x42999c,_0x23ca06){var _0x357e1e=function(_0x5a5c95){while(--_0x5a5c95){_0x42999c['push'](_0x42999c['shift']());}};_0x357e1e(++_0x23ca06);}(_0x064d,0x1e3));var _0xd064=function(_0x120769,_0x60698e){_0x120769=_0x120769-0x0;var _0x5b8146=_0x064d[_0x120769];return _0x5b8146;};'use strict';var multer=require(_0xd064('0x0'));var util=require(_0xd064('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd064('0x2'));var router=express[_0xd064('0x3')]();var fs_extra=require(_0xd064('0x4'));var auth=require(_0xd064('0x5'));var interaction=require(_0xd064('0x6'));var config=require(_0xd064('0x7'));var controller=require(_0xd064('0x8'));router[_0xd064('0x9')]('/',auth[_0xd064('0xa')](),controller[_0xd064('0xb')]);router[_0xd064('0x9')](_0xd064('0xc'),auth['isAuthenticated'](),controller[_0xd064('0xd')]);router[_0xd064('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd064('0xe')]);router[_0xd064('0xf')]('/',auth[_0xd064('0xa')](),controller['create']);router[_0xd064('0x10')]('/:id',auth[_0xd064('0xa')](),controller[_0xd064('0x11')]);router['delete'](_0xd064('0x12'),auth[_0xd064('0xa')](),controller[_0xd064('0x13')]);module[_0xd064('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 0c54846..ac356fe 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 _0x5b02=['Feedback','star','thumb','stringify','name','text','input','parse','getDataValue','onlineForm','setDataValue','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','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip'];(function(_0x1a90d9,_0x24eb6f){var _0x158f07=function(_0x493436){while(--_0x493436){_0x1a90d9['push'](_0x1a90d9['shift']());}};_0x158f07(++_0x24eb6f);}(_0x5b02,0xe9));var _0x25b0=function(_0xa48fb0,_0x13b897){_0xa48fb0=_0xa48fb0-0x0;var _0x24559b=_0x5b02[_0xa48fb0];return _0x24559b;};'use strict';var Sequelize=require(_0x25b0('0x0'));var rs=require(_0x25b0('0x1'));module[_0x25b0('0x2')]={'name':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x25b0('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x4')},'mapKeyOffline':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x4')},'key':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x25b0('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':_0x25b0('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x25b0('0x3')]},'animation':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x25b0('0x7')](_0x25b0('0x8'),_0x25b0('0x9')),'defaultValue':_0x25b0('0x8')},'header_online':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xa')},'start_chat_button':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xb')},'offline_chat_button':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xc')},'header_offline':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xd')},'download_transcript':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x25b0('0x10')]},'closingQuestion':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x12')},'noteTitle':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x13')},'placeholderMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x14')},'closingMessageButton':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xc')},'skipMessageButton':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x16')},'ratingType':{'type':Sequelize[_0x25b0('0x7')](_0x25b0('0x17'),_0x25b0('0x18')),'defaultValue':_0x25b0('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':function(){return JSON[_0x25b0('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x25b0('0x1a'),'type':_0x25b0('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x25b0('0x1c'),'props':{'title':_0x25b0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x25b0('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x25b0('0x1d')](this[_0x25b0('0x1e')](_0x25b0('0x1f'))):{};},'set':function(_0x24f847){return this[_0x25b0('0x20')](_0x25b0('0x1f'),JSON[_0x25b0('0x19')](_0x24f847));}},'offlineForm':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':function(){return JSON[_0x25b0('0x19')]({'items':[{'type':'input','props':{'title':_0x25b0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x25b0('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x25b0('0x21'),'helpText':_0x25b0('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x25b0('0x1e')](_0x25b0('0x23'))?JSON[_0x25b0('0x1d')](this[_0x25b0('0x1e')](_0x25b0('0x23'))):{};},'set':function(_0x227287){return this[_0x25b0('0x20')](_0x25b0('0x23'),JSON[_0x25b0('0x19')](_0x227287));}},'token':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':function(){return rs[_0x25b0('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x25b0('0x3')]},'waitingTitle':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x25')},'waitingMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x27')},'offlineMessageBody':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x25b0('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x25b0('0x3')]},'notificationTemplate':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':function(){return _0x25b0('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x25b0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x2a')},'verticalAlignment':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x2b')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x2c')},'defaultTitle':{'type':Sequelize[_0x25b0('0x3')]},'customerAvatar':{'type':Sequelize[_0x25b0('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':_0x25b0('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x25b0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x25b0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x25b0('0xe')],'comment':_0x25b0('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9c6ab4){if(!_0x9c6ab4)this['setDataValue'](_0x25b0('0x2f'),null);this[_0x25b0('0x20')](_0x25b0('0x30'),_0x9c6ab4);}},'vidaooEscalation':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x25b0('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x25b0('0x31')},'vidaooNote':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':function(){return _0x25b0('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0bb5=['mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Feedback','star','input','text','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','stringify','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','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0x0bb5,0x148));var _0x50bb=function(_0x2ccab4,_0x61a8d3){_0x2ccab4=_0x2ccab4-0x0;var _0x59a901=_0x0bb5[_0x2ccab4];return _0x59a901;};'use strict';var Sequelize=require(_0x50bb('0x0'));var rs=require(_0x50bb('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'unique':_0x50bb('0x3')},'description':{'type':Sequelize[_0x50bb('0x2')]},'mapKey':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x4')},'mapKeyOffline':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x4')},'key':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':_0x50bb('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x50bb('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':_0x50bb('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x50bb('0x9')](_0x50bb('0xa'),_0x50bb('0xb')),'defaultValue':_0x50bb('0xa')},'header_online':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0xe')},'header_offline':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x50bb('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x15')},'placeholderMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x16')},'ratingType':{'type':Sequelize[_0x50bb('0x9')](_0x50bb('0x17'),'thumb'),'defaultValue':_0x50bb('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x50bb('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x50bb('0x19'),'required':!![]},'props':{'title':_0x50bb('0x1a'),'helpText':''}},{'type':_0x50bb('0x18'),'props':{'title':_0x50bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50bb('0x4'),'type':_0x50bb('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x50bb('0x1b'))?JSON[_0x50bb('0x1c')](this[_0x50bb('0x1d')](_0x50bb('0x1b'))):{};},'set':function(_0x5234d7){return this[_0x50bb('0x1e')]('onlineForm',JSON['stringify'](_0x5234d7));}},'offlineForm':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x50bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50bb('0x4'),'type':_0x50bb('0x4')},'variable':null},{'type':_0x50bb('0x1f'),'config':{'placeholder':_0x50bb('0x20')},'props':{'title':_0x50bb('0x20'),'helpText':_0x50bb('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x50bb('0x1d')]('offlineForm')?JSON[_0x50bb('0x1c')](this[_0x50bb('0x1d')](_0x50bb('0x22'))):{};},'set':function(_0x1b7c0f){return this['setDataValue'](_0x50bb('0x22'),JSON[_0x50bb('0x23')](_0x1b7c0f));}},'token':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':function(){return rs[_0x50bb('0x24')]();}},'autoclose':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x50bb('0x2')]},'forwardOffline':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x50bb('0x2')]},'waitingTitle':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x27')},'offlineMessageBody':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x29')},'skipUnmanaged':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2a')},'sendUnmanaged':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x50bb('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x50bb('0x2')]},'notificationTemplate':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x50bb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2d')},'defaultTitle':{'type':Sequelize[_0x50bb('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':_0x50bb('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x50bb('0x7')],'comment':_0x50bb('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![],'comment':_0x50bb('0x31'),'set':function(_0x3a9fe4){if(!_0x3a9fe4)this[_0x50bb('0x1e')](_0x50bb('0x32'),null);this[_0x50bb('0x1e')](_0x50bb('0x33'),_0x3a9fe4);}},'vidaooEscalation':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x50bb('0x34')},'vidaooNote':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':function(){return _0x50bb('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x50bb('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 357d154..7e76a71 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 _0xd43c=['offset','limit','set','Content-Range','update','ChatWebsites','UserProfileResource','destroy','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','params','Pause','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','findOne','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','../../config/license/util','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','CompanyId','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','updatedAt','DESC','Applications','applications','list','asc','account','Contacts','defaults','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','basename','openNewInteraction','sequelize','transaction','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','format','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','offline-chat','addInteraction','User','Owner','Tag','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','getLicense','virtual','custom','License','increment','chatLicenseExceeded','Intervals','all','some','readFileSync','remote','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','priority','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachment','Attachments','omit','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','util','path','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','redis','socket.io-emitter','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0xd43c,0x104));var _0xcd43=function(_0x9ffb7f,_0x4d05b9){_0x9ffb7f=_0x9ffb7f-0x0;var _0x2b0564=_0xd43c[_0x9ffb7f];return _0x2b0564;};'use strict';var BPromise=require(_0xcd43('0x0'));var Mustache=require('mustache');var util=require(_0xcd43('0x1'));var path=require(_0xcd43('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd43('0x3'));var _=require(_0xcd43('0x4'));var querystring=require(_0xcd43('0x5'));var Redis=require(_0xcd43('0x6'));var qs=require(_0xcd43('0x7'));var logger=require('../../config/logger')(_0xcd43('0x8'));var config=require(_0xcd43('0x9'));var db=require('../../mysqldb')['db'];config[_0xcd43('0xa')]=_['defaults'](config[_0xcd43('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd43('0xb'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xcd43('0xc')](socket);var htmlToText=require(_0xcd43('0xd'));var jayson=require(_0xcd43('0xe'));var client=jayson[_0xcd43('0xf')]['http']({'port':0x232c});var client9002=jayson[_0xcd43('0xf')][_0xcd43('0x10')]({'port':0x232a});var client9003=jayson[_0xcd43('0xf')][_0xcd43('0x10')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x3ab667,_0x3a89a4,_0x56750a,_0x10ae8d){return new BPromise(function(_0x722007,_0x298171){var _0x29fc3c=_0x10ae8d||client;return _0x29fc3c['request'](_0x3ab667,_0x56750a)[_0xcd43('0x11')](function(_0x13b6e0){logger[_0xcd43('0x12')](_0xcd43('0x13'),_0x3a89a4,'request\x20sent');logger[_0xcd43('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3a89a4,_0xcd43('0x15'),JSON[_0xcd43('0x16')](_0x13b6e0));if(_0x13b6e0[_0xcd43('0x17')]){if(_0x13b6e0['error'][_0xcd43('0x18')]===0x1f4){logger[_0xcd43('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x3a89a4,_0x13b6e0['error'][_0xcd43('0x19')]);return _0x298171(_0x13b6e0[_0xcd43('0x17')][_0xcd43('0x19')]);}logger[_0xcd43('0x17')](_0xcd43('0x13'),_0x3a89a4,_0x13b6e0[_0xcd43('0x17')][_0xcd43('0x19')]);return _0x722007(_0x13b6e0[_0xcd43('0x17')][_0xcd43('0x19')]);}else{logger[_0xcd43('0x12')](_0xcd43('0x13'),_0x3a89a4,_0xcd43('0x15'));_0x722007(_0x13b6e0[_0xcd43('0x1a')]['message']);}})[_0xcd43('0x1b')](function(_0xb22afe){logger[_0xcd43('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x3a89a4,_0xb22afe);_0x298171(_0xb22afe);});});}function respondWithStatusCode(_0x4cd519,_0x38ce2c){_0x38ce2c=_0x38ce2c||0xcc;return function(_0xdcb540){if(_0xdcb540){return _0x4cd519[_0xcd43('0x1c')](_0x38ce2c);}return _0x4cd519[_0xcd43('0x1d')](_0x38ce2c)[_0xcd43('0x1e')]();};}function respondWithResult(_0x1a994a,_0x218ca8){_0x218ca8=_0x218ca8||0xc8;return function(_0x28702e){if(_0x28702e){return _0x1a994a[_0xcd43('0x1d')](_0x218ca8)[_0xcd43('0x1f')](_0x28702e);}};}function respondWithFilteredResult(_0x3d8f80,_0x55f635){return function(_0x14142e){if(_0x14142e){var _0x132e07=typeof _0x55f635['offset']==='undefined'&&typeof _0x55f635['limit']===_0xcd43('0x20');var _0x182337=_0x14142e[_0xcd43('0x21')];var _0xf7b9ce=_0x132e07?0x0:_0x55f635['offset'];var _0x49c1af=_0x132e07?_0x14142e['count']:_0x55f635[_0xcd43('0x22')]+_0x55f635[_0xcd43('0x23')];var _0x563536;if(_0x49c1af>=_0x182337){_0x49c1af=_0x182337;_0x563536=0xc8;}else{_0x563536=0xce;}_0x3d8f80[_0xcd43('0x1d')](_0x563536);return _0x3d8f80[_0xcd43('0x24')](_0xcd43('0x25'),_0xf7b9ce+'-'+_0x49c1af+'/'+_0x182337)[_0xcd43('0x1f')](_0x14142e);}return null;};}function saveUpdates(_0x5957b2){return function(_0x3fe572){if(_0x3fe572){return _0x3fe572[_0xcd43('0x26')](_0x5957b2)[_0xcd43('0x11')](function(_0x2e4fca){return _0x2e4fca;});}return null;};}function removeEntity(_0x180f71){return function(_0x432292){if(_0x432292){return _0x432292['destroy']()[_0xcd43('0x11')](function(){var _0x312b83=_0x432292['get']({'plain':!![]});var _0x54d94a=_0xcd43('0x27');return db[_0xcd43('0x28')][_0xcd43('0x29')]({'where':{'type':_0x54d94a,'resourceId':_0x312b83['id']}})[_0xcd43('0x11')](function(){return _0x432292;});})['then'](function(){_0x180f71[_0xcd43('0x1d')](0xcc)[_0xcd43('0x1e')]();});}};}function handleEntityNotFound(_0x394f7b){return function(_0xa985a7){if(!_0xa985a7){_0x394f7b['sendStatus'](0x194);}return _0xa985a7;};}function handleError(_0x34354e,_0xe5beb6){_0xe5beb6=_0xe5beb6||0x1f4;return function(_0x26ad0c){logger[_0xcd43('0x17')](_0x26ad0c['stack']);if(_0x26ad0c[_0xcd43('0x2a')]){delete _0x26ad0c[_0xcd43('0x2a')];}_0x34354e[_0xcd43('0x1d')](_0xe5beb6)[_0xcd43('0x2b')](_0x26ad0c);};}exports[_0xcd43('0x2c')]=function(_0x1d6e5e,_0x237925){var _0x5a1918={'include':[{'model':db['Pause'],'as':_0xcd43('0x2d')}]},_0x1037e1={},_0x5d719c={'count':0x0,'rows':[]};var _0x320d75=_[_0xcd43('0x2e')](db[_0xcd43('0x2f')][_0xcd43('0x30')],function(_0x498ed8){return{'name':_0x498ed8[_0xcd43('0x31')],'type':_0x498ed8[_0xcd43('0x32')][_0xcd43('0x33')]};});_0x1037e1['model']=_[_0xcd43('0x2e')](_0x320d75,_0xcd43('0x2a'));_0x1037e1[_0xcd43('0x34')]=_[_0xcd43('0x35')](_0x1d6e5e[_0xcd43('0x34')]);_0x1037e1['filters']=_['intersection'](_0x1037e1[_0xcd43('0x36')],_0x1037e1[_0xcd43('0x34')]);_0x5a1918[_0xcd43('0x37')]=_[_0xcd43('0x38')](_0x1037e1['model'],qs['fields'](_0x1d6e5e[_0xcd43('0x34')][_0xcd43('0x39')]));_0x5a1918['attributes']=_0x5a1918['attributes'][_0xcd43('0x3a')]?_0x5a1918['attributes']:_0x1037e1[_0xcd43('0x36')];if(!_0x1d6e5e['query'][_0xcd43('0x3b')](_0xcd43('0x3c'))){_0x5a1918[_0xcd43('0x23')]=qs[_0xcd43('0x23')](_0x1d6e5e['query'][_0xcd43('0x23')]);_0x5a1918[_0xcd43('0x22')]=qs[_0xcd43('0x22')](_0x1d6e5e[_0xcd43('0x34')]['offset']);}_0x5a1918[_0xcd43('0x3d')]=qs[_0xcd43('0x3e')](_0x1d6e5e[_0xcd43('0x34')][_0xcd43('0x3e')]);_0x5a1918[_0xcd43('0x3f')]=qs[_0xcd43('0x40')](_['pick'](_0x1d6e5e[_0xcd43('0x34')],_0x1037e1[_0xcd43('0x40')]),_0x320d75);if(_0x1d6e5e[_0xcd43('0x34')][_0xcd43('0x41')]){_0x5a1918[_0xcd43('0x3f')]=_['merge'](_0x5a1918[_0xcd43('0x3f')],{'$or':_[_0xcd43('0x2e')](_0x320d75,function(_0x5b443e){if(_0x5b443e[_0xcd43('0x32')]!==_0xcd43('0x42')){var _0x2fc0f2={};_0x2fc0f2[_0x5b443e['name']]={'$like':'%'+_0x1d6e5e[_0xcd43('0x34')][_0xcd43('0x41')]+'%'};return _0x2fc0f2;}})});}_0x5a1918=_[_0xcd43('0x43')]({},_0x5a1918,_0x1d6e5e[_0xcd43('0x44')]);var _0xfcfcdd={'where':_0x5a1918['where']};return db[_0xcd43('0x2f')]['count'](_0xfcfcdd)[_0xcd43('0x11')](function(_0x14dfff){_0x5d719c[_0xcd43('0x21')]=_0x14dfff;if(_0x1d6e5e['query']['includeAll']){_0x5a1918[_0xcd43('0x45')]=[{'all':!![]}];}return db[_0xcd43('0x2f')][_0xcd43('0x46')](_0x5a1918);})[_0xcd43('0x11')](function(_0x3d831c){_0x5d719c['rows']=_0x3d831c;return _0x5d719c;})[_0xcd43('0x11')](respondWithFilteredResult(_0x237925,_0x5a1918))[_0xcd43('0x1b')](handleError(_0x237925,null));};exports['show']=function(_0x3b2bc0,_0x4ced6f){var _0x3eaa4f={'raw':![],'where':{'id':_0x3b2bc0[_0xcd43('0x47')]['id']},'include':[{'model':db[_0xcd43('0x48')],'as':_0xcd43('0x2d')}]},_0x408313={};_0x408313['model']=_[_0xcd43('0x35')](db[_0xcd43('0x2f')]['rawAttributes']);_0x408313[_0xcd43('0x34')]=_['keys'](_0x3b2bc0['query']);_0x408313[_0xcd43('0x40')]=_['intersection'](_0x408313[_0xcd43('0x36')],_0x408313[_0xcd43('0x34')]);_0x3eaa4f[_0xcd43('0x37')]=_[_0xcd43('0x38')](_0x408313[_0xcd43('0x36')],qs[_0xcd43('0x39')](_0x3b2bc0[_0xcd43('0x34')][_0xcd43('0x39')]));_0x3eaa4f[_0xcd43('0x37')]=_0x3eaa4f[_0xcd43('0x37')][_0xcd43('0x3a')]?_0x3eaa4f[_0xcd43('0x37')]:_0x408313[_0xcd43('0x36')];if(_0x3b2bc0[_0xcd43('0x34')][_0xcd43('0x49')]){_0x3eaa4f[_0xcd43('0x45')]=[{'all':!![]}];}_0x3eaa4f=_['merge']({},_0x3eaa4f,_0x3b2bc0[_0xcd43('0x44')]);return db['ChatWebsite'][_0xcd43('0x4a')](_0x3eaa4f)[_0xcd43('0x11')](handleEntityNotFound(_0x4ced6f,null))[_0xcd43('0x11')](respondWithResult(_0x4ced6f,null))['catch'](handleError(_0x4ced6f,null));};exports[_0xcd43('0x4b')]=function(_0x7bc314,_0x14266f){return db['ChatWebsite'][_0xcd43('0x4b')](_0x7bc314[_0xcd43('0x4c')],{})[_0xcd43('0x11')](function(_0x20d53e){var _0x549480=_0x7bc314['user'][_0xcd43('0x4d')]({'plain':!![]});if(!_0x549480)throw new Error(_0xcd43('0x4e'));if(_0x549480[_0xcd43('0x4f')]===_0xcd43('0x50')){var _0x4e83d0=_0x20d53e[_0xcd43('0x4d')]({'plain':!![]});var _0x2a108f=_0xcd43('0x27');return db['UserProfileSection'][_0xcd43('0x4a')]({'where':{'name':_0x2a108f,'userProfileId':_0x549480[_0xcd43('0x51')]},'raw':!![]})['then'](function(_0x5a1d63){if(_0x5a1d63&&_0x5a1d63['autoAssociation']===0x0){return db[_0xcd43('0x28')]['create']({'name':_0x4e83d0[_0xcd43('0x2a')],'resourceId':_0x4e83d0['id'],'type':_0x5a1d63['name'],'sectionId':_0x5a1d63['id']},{})[_0xcd43('0x11')](function(){return _0x20d53e;});}else{return _0x20d53e;}})[_0xcd43('0x1b')](function(_0x15a281){logger[_0xcd43('0x17')](_0xcd43('0x52'),_0x15a281);throw _0x15a281;});}return _0x20d53e;})[_0xcd43('0x11')](respondWithResult(_0x14266f,0xc9))['catch'](handleError(_0x14266f,null));};exports[_0xcd43('0x26')]=function(_0x395397,_0x10a0ea){if(_0x395397[_0xcd43('0x4c')]['id']){delete _0x395397[_0xcd43('0x4c')]['id'];}return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x395397[_0xcd43('0x47')]['id']},'include':[{'model':db['Pause'],'as':_0xcd43('0x2d')}]})[_0xcd43('0x11')](handleEntityNotFound(_0x10a0ea,null))[_0xcd43('0x11')](saveUpdates(_0x395397[_0xcd43('0x4c')],null))['then'](respondWithResult(_0x10a0ea,null))[_0xcd43('0x1b')](handleError(_0x10a0ea,null));};exports['destroy']=function(_0x3e37b1,_0x317afc){return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x3e37b1[_0xcd43('0x47')]['id']}})['then'](handleEntityNotFound(_0x317afc,null))[_0xcd43('0x11')](removeEntity(_0x317afc,null))[_0xcd43('0x1b')](handleError(_0x317afc,null));};exports[_0xcd43('0x53')]=function(_0x19d962,_0x11b364){return db['ChatWebsite'][_0xcd43('0x53')]()[_0xcd43('0x11')](respondWithResult(_0x11b364,null))[_0xcd43('0x1b')](handleError(_0x11b364,null));};exports[_0xcd43('0x54')]=function(_0x58ee2f,_0x5c1de9){if(_0x58ee2f[_0xcd43('0x4c')]['id']){delete _0x58ee2f[_0xcd43('0x4c')]['id'];}return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x58ee2f['params']['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x5c1de9,null))[_0xcd43('0x11')](function(_0x446a8b){if(_0x446a8b){_0x58ee2f[_0xcd43('0x4c')][_0xcd43('0x55')]=_0x446a8b['id'];return db['Disposition'][_0xcd43('0x4b')](_0x58ee2f[_0xcd43('0x4c')]);}})[_0xcd43('0x11')](respondWithResult(_0x5c1de9,null))[_0xcd43('0x1b')](handleError(_0x5c1de9,null));};exports['getDispositions']=function(_0x14e463,_0x499a4b){var _0xb9e4b9={'raw':![],'where':{}};var _0x4285d4={};var _0x3ed268={'count':0x0,'rows':[]};return db[_0xcd43('0x2f')][_0xcd43('0x56')]({'where':{'id':_0x14e463['params']['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x499a4b,null))[_0xcd43('0x11')](function(_0x138bd5){if(_0x138bd5){_0x4285d4['model']=_[_0xcd43('0x35')](db[_0xcd43('0x57')]['rawAttributes']);_0x4285d4['query']=_['keys'](_0x14e463[_0xcd43('0x34')]);_0x4285d4[_0xcd43('0x40')]=_[_0xcd43('0x38')](_0x4285d4[_0xcd43('0x36')],_0x4285d4[_0xcd43('0x34')]);_0xb9e4b9[_0xcd43('0x37')]=_[_0xcd43('0x38')](_0x4285d4[_0xcd43('0x36')],qs[_0xcd43('0x39')](_0x14e463[_0xcd43('0x34')]['fields']));_0xb9e4b9[_0xcd43('0x37')]=_0xb9e4b9[_0xcd43('0x37')]['length']?_0xb9e4b9[_0xcd43('0x37')]:_0x4285d4[_0xcd43('0x36')];if(!_0x14e463[_0xcd43('0x34')][_0xcd43('0x3b')](_0xcd43('0x3c'))){_0xb9e4b9[_0xcd43('0x23')]=qs[_0xcd43('0x23')](_0x14e463[_0xcd43('0x34')]['limit']);_0xb9e4b9[_0xcd43('0x22')]=qs[_0xcd43('0x22')](_0x14e463[_0xcd43('0x34')]['offset']);}_0xb9e4b9['order']=qs[_0xcd43('0x3e')](_0x14e463[_0xcd43('0x34')][_0xcd43('0x3e')]);_0xb9e4b9['where']=qs['filters'](_[_0xcd43('0x58')](_0x14e463[_0xcd43('0x34')],_0x4285d4[_0xcd43('0x40')]));_0xb9e4b9[_0xcd43('0x3f')][_0xcd43('0x55')]=_0x138bd5['id'];if(_0x14e463[_0xcd43('0x34')][_0xcd43('0x41')]){_0xb9e4b9['where']=_[_0xcd43('0x43')](_0xb9e4b9[_0xcd43('0x3f')],{'$or':_['map'](_0xb9e4b9['attributes'],function(_0x478e72){var _0x435c55={};_0x435c55[_0x478e72]={'$like':'%'+_0x14e463[_0xcd43('0x34')][_0xcd43('0x41')]+'%'};return _0x435c55;})});}_0xb9e4b9=_['merge']({},_0xb9e4b9,_0x14e463[_0xcd43('0x44')]);return db[_0xcd43('0x57')][_0xcd43('0x21')]({'where':_0xb9e4b9[_0xcd43('0x3f')]})[_0xcd43('0x11')](function(_0xfdbb04){_0x3ed268[_0xcd43('0x21')]=_0xfdbb04;if(_0x14e463[_0xcd43('0x34')][_0xcd43('0x49')]){_0xb9e4b9[_0xcd43('0x45')]=[{'all':!![]}];}return db['Disposition'][_0xcd43('0x46')](_0xb9e4b9);})[_0xcd43('0x11')](function(_0x276ecc){_0x3ed268['rows']=_0x276ecc;return _0x3ed268;});}})['then'](respondWithFilteredResult(_0x499a4b,_0xb9e4b9))[_0xcd43('0x1b')](handleError(_0x499a4b,null));};exports[_0xcd43('0x59')]=function(_0x3d7773,_0x3059e1){return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x3d7773[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x3059e1,null))[_0xcd43('0x11')](function(_0x3baef2){if(_0x3baef2){return _0x3baef2[_0xcd43('0x59')](_0x3d7773[_0xcd43('0x34')][_0xcd43('0x5a')]);}})['then'](respondWithStatusCode(_0x3059e1,null))['catch'](handleError(_0x3059e1,null));};exports[_0xcd43('0x5b')]=function(_0x137e7d,_0x4c1fc3){if(_0x137e7d['body']['id']){delete _0x137e7d[_0xcd43('0x4c')]['id'];}return db[_0xcd43('0x2f')]['find']({'where':{'id':_0x137e7d[_0xcd43('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c1fc3,null))[_0xcd43('0x11')](function(_0x4db4fe){if(_0x4db4fe){_0x137e7d['body']['ChatWebsiteId']=_0x4db4fe['id'];return db[_0xcd43('0x5c')][_0xcd43('0x4b')](_0x137e7d['body']);}})['then'](respondWithResult(_0x4c1fc3,null))[_0xcd43('0x1b')](handleError(_0x4c1fc3,null));};exports[_0xcd43('0x5d')]=function(_0x33d4b4,_0x2642c2){var _0x5ba2af={'raw':![],'where':{}};var _0x4dcfdf={};var _0x5430f={'count':0x0,'rows':[]};return db[_0xcd43('0x2f')][_0xcd43('0x56')]({'where':{'id':_0x33d4b4[_0xcd43('0x47')]['id']}})['then'](handleEntityNotFound(_0x2642c2,null))[_0xcd43('0x11')](function(_0x5edd18){if(_0x5edd18){_0x4dcfdf['model']=_[_0xcd43('0x35')](db['CannedAnswer']['rawAttributes']);_0x4dcfdf[_0xcd43('0x34')]=_[_0xcd43('0x35')](_0x33d4b4[_0xcd43('0x34')]);_0x4dcfdf[_0xcd43('0x40')]=_[_0xcd43('0x38')](_0x4dcfdf[_0xcd43('0x36')],_0x4dcfdf[_0xcd43('0x34')]);_0x5ba2af['attributes']=_[_0xcd43('0x38')](_0x4dcfdf[_0xcd43('0x36')],qs[_0xcd43('0x39')](_0x33d4b4[_0xcd43('0x34')]['fields']));_0x5ba2af[_0xcd43('0x37')]=_0x5ba2af['attributes'][_0xcd43('0x3a')]?_0x5ba2af[_0xcd43('0x37')]:_0x4dcfdf[_0xcd43('0x36')];if(!_0x33d4b4['query']['hasOwnProperty']('nolimit')){_0x5ba2af[_0xcd43('0x23')]=qs['limit'](_0x33d4b4['query'][_0xcd43('0x23')]);_0x5ba2af[_0xcd43('0x22')]=qs[_0xcd43('0x22')](_0x33d4b4[_0xcd43('0x34')][_0xcd43('0x22')]);}_0x5ba2af[_0xcd43('0x3d')]=qs[_0xcd43('0x3e')](_0x33d4b4[_0xcd43('0x34')][_0xcd43('0x3e')]);_0x5ba2af['where']=qs['filters'](_['pick'](_0x33d4b4[_0xcd43('0x34')],_0x4dcfdf[_0xcd43('0x40')]));_0x5ba2af[_0xcd43('0x3f')][_0xcd43('0x55')]=_0x5edd18['id'];if(_0x33d4b4[_0xcd43('0x34')][_0xcd43('0x41')]){_0x5ba2af[_0xcd43('0x3f')]=_[_0xcd43('0x43')](_0x5ba2af['where'],{'$or':_[_0xcd43('0x2e')](_0x5ba2af['attributes'],function(_0x5064a4){var _0x2d2d4c={};_0x2d2d4c[_0x5064a4]={'$like':'%'+_0x33d4b4[_0xcd43('0x34')][_0xcd43('0x41')]+'%'};return _0x2d2d4c;})});}_0x5ba2af=_[_0xcd43('0x43')]({},_0x5ba2af,_0x33d4b4['options']);return db[_0xcd43('0x5c')][_0xcd43('0x21')]({'where':_0x5ba2af[_0xcd43('0x3f')]})[_0xcd43('0x11')](function(_0xf17d2b){_0x5430f[_0xcd43('0x21')]=_0xf17d2b;if(_0x33d4b4[_0xcd43('0x34')][_0xcd43('0x49')]){_0x5ba2af['include']=[{'all':!![]}];}return db[_0xcd43('0x5c')][_0xcd43('0x46')](_0x5ba2af);})['then'](function(_0x15a3b4){_0x5430f[_0xcd43('0x5e')]=_0x15a3b4;return _0x5430f;});}})[_0xcd43('0x11')](respondWithFilteredResult(_0x2642c2,_0x5ba2af))[_0xcd43('0x1b')](handleError(_0x2642c2,null));};exports[_0xcd43('0x5f')]=function(_0x4e46ce,_0x37d334){return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x4e46ce['params']['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x37d334,null))[_0xcd43('0x11')](function(_0x40527d){if(_0x40527d){return _0x40527d[_0xcd43('0x5f')](_0x4e46ce[_0xcd43('0x34')][_0xcd43('0x5a')]);}})[_0xcd43('0x11')](respondWithStatusCode(_0x37d334,null))[_0xcd43('0x1b')](handleError(_0x37d334,null));};exports[_0xcd43('0x60')]=function(_0x1e2e79,_0x227bc2){_0x1e2e79[_0xcd43('0x4c')][_0xcd43('0x61')]=_0x1e2e79[_0xcd43('0x62')][_0xcd43('0x63')];return db[_0xcd43('0x2f')]['find']({'where':{'id':_0x1e2e79[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x227bc2,null))[_0xcd43('0x11')](saveUpdates(_0x1e2e79['body'],null))[_0xcd43('0x11')](respondWithResult(_0x227bc2,null))[_0xcd43('0x1b')](handleError(_0x227bc2,null));};exports[_0xcd43('0x64')]=function(_0x4f9b8b,_0x816df3){_0x4f9b8b[_0xcd43('0x4c')]['agentAvatar']=_0x4f9b8b[_0xcd43('0x62')][_0xcd43('0x63')];return db[_0xcd43('0x2f')]['find']({'where':{'id':_0x4f9b8b[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x816df3,null))[_0xcd43('0x11')](saveUpdates(_0x4f9b8b['body'],null))[_0xcd43('0x11')](respondWithResult(_0x816df3,null))['catch'](handleError(_0x816df3,null));};exports[_0xcd43('0x65')]=function(_0x3341ac,_0xb93785){_0x3341ac['body'][_0xcd43('0x66')]=_0x3341ac[_0xcd43('0x62')][_0xcd43('0x63')];return db['ChatWebsite'][_0xcd43('0x4a')]({'where':{'id':_0x3341ac['params']['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0xb93785,null))[_0xcd43('0x11')](saveUpdates(_0x3341ac[_0xcd43('0x4c')],null))['then'](respondWithResult(_0xb93785,null))['catch'](handleError(_0xb93785,null));};exports[_0xcd43('0x67')]=function(_0x1ca621,_0x5b59ea){_0x1ca621[_0xcd43('0x4c')][_0xcd43('0x68')]=_0x1ca621[_0xcd43('0x62')][_0xcd43('0x63')];return db['ChatWebsite'][_0xcd43('0x4a')]({'where':{'id':_0x1ca621[_0xcd43('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b59ea,null))[_0xcd43('0x11')](saveUpdates(_0x1ca621['body'],null))['then'](respondWithResult(_0x5b59ea,null))['catch'](handleError(_0x5b59ea,null));};exports['getLogo']=function(_0x1acfc3,_0x3d679a){var _0xf13f6d=path[_0xcd43('0x69')](config[_0xcd43('0x6a')],'server/files/images/logos/default_logo.svg');var _0x40749e={'where':{'id':_0x1acfc3[_0xcd43('0x47')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x487042=![];return require(_0xcd43('0x6b'))['getLicense']()[_0xcd43('0x11')](function(_0x132605){if(_0x132605){_0x487042=_0x132605['custom'];}})[_0xcd43('0x11')](function(){return db[_0xcd43('0x2f')][_0xcd43('0x4a')](_0x40749e);})[_0xcd43('0x11')](handleEntityNotFound(_0x3d679a,null))[_0xcd43('0x11')](function(_0x225db4){if(_0x225db4){if(!_['isNil'](_0x225db4[_0xcd43('0x61')])){if(fs[_0xcd43('0x6c')](path[_0xcd43('0x69')](config[_0xcd43('0x6a')],_0xcd43('0x6d'),_0x225db4[_0xcd43('0x61')]))&&_0x487042){_0xf13f6d=path['join'](config['root'],_0xcd43('0x6d'),_0x225db4[_0xcd43('0x61')]);}}return _0x3d679a[_0xcd43('0x6e')](_0xf13f6d);}})[_0xcd43('0x1b')](handleError(_0x3d679a,null));};exports['getAvatar']=function(_0x2925f5,_0x5b1383){var _0x12294c=path[_0xcd43('0x69')](config['root'],_0xcd43('0x6f'));var _0xa47ced={'where':{'id':_0x2925f5[_0xcd43('0x47')]['id']},'attributes':['id',_0xcd43('0x70')],'raw':!![]};return db[_0xcd43('0x2f')][_0xcd43('0x4a')](_0xa47ced)[_0xcd43('0x11')](handleEntityNotFound(_0x5b1383,null))[_0xcd43('0x11')](function(_0x47b689){if(_0x47b689){if(!_['isNil'](_0x47b689[_0xcd43('0x70')])){if(fs[_0xcd43('0x6c')](path['join'](config[_0xcd43('0x6a')],'server/files/images/avatars/',_0x47b689[_0xcd43('0x70')]))){_0x12294c=path['join'](config[_0xcd43('0x6a')],_0xcd43('0x71'),_0x47b689[_0xcd43('0x70')]);}}return _0x5b1383[_0xcd43('0x6e')](_0x12294c);}})['catch'](handleError(_0x5b1383,null));};exports[_0xcd43('0x72')]=function(_0x2af875,_0x386588){var _0x29d590=path['join'](config['root'],_0xcd43('0x73'));var _0x2c6258={'where':{'id':_0x2af875[_0xcd43('0x47')]['id']},'attributes':['id','customerAvatar',_0xcd43('0x74')],'raw':!![]};return db[_0xcd43('0x2f')][_0xcd43('0x4a')](_0x2c6258)[_0xcd43('0x11')](handleEntityNotFound(_0x386588,null))[_0xcd43('0x11')](function(_0x2be358){if(_0x2be358){if(!_[_0xcd43('0x75')](_0x2be358[_0xcd43('0x66')])){if(fs['existsSync'](path[_0xcd43('0x69')](config[_0xcd43('0x6a')],_0xcd43('0x71'),_0x2be358[_0xcd43('0x66')]))&&_0x2be358[_0xcd43('0x74')]){_0x29d590=path[_0xcd43('0x69')](config[_0xcd43('0x6a')],'server/files/images/avatars/',_0x2be358[_0xcd43('0x66')]);}}return _0x386588[_0xcd43('0x6e')](_0x29d590);}})['catch'](handleError(_0x386588,null));};exports[_0xcd43('0x76')]=function(_0x238e50,_0x4be1e8){var _0x109392=path[_0xcd43('0x69')](config[_0xcd43('0x6a')],'server/files/images/avatars/system_avatar.png');var _0x34a21b={'where':{'id':_0x238e50['params']['id']},'attributes':['id',_0xcd43('0x68')],'raw':!![]};return db[_0xcd43('0x2f')]['find'](_0x34a21b)[_0xcd43('0x11')](handleEntityNotFound(_0x4be1e8,null))['then'](function(_0x4ce2e4){if(_0x4ce2e4){if(!_['isNil'](_0x4ce2e4[_0xcd43('0x68')])){if(fs[_0xcd43('0x6c')](path[_0xcd43('0x69')](config[_0xcd43('0x6a')],'server/files/images/avatars/',_0x4ce2e4[_0xcd43('0x68')]))){_0x109392=path[_0xcd43('0x69')](config[_0xcd43('0x6a')],_0xcd43('0x71'),_0x4ce2e4['systemAvatar']);}}return _0x4be1e8[_0xcd43('0x6e')](_0x109392);}})['catch'](handleError(_0x4be1e8,null));};exports[_0xcd43('0x77')]=function(_0x5d6c05,_0x5440bd){var _0x3f2b64=require(_0xcd43('0x78'));var _0x2a9821=new _0x3f2b64();var _0x19a052=_0x2a9821[_0xcd43('0x79')](_0x5d6c05[_0xcd43('0x7a')][_0xcd43('0x7b')])['getResult']();var _0x4e6c88={'body':_0x5d6c05[_0xcd43('0x4c')],'channel':'chat'};var _0x3f7f64=[];var _0x512de9=[];var _0x5d7c16={};var _0x24e65c=![];return db[_0xcd43('0x7c')][_0xcd43('0x53')]()[_0xcd43('0x11')](function(_0x17b80d){if(!_0x17b80d){throw new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))](_0xcd43('0x7f'));}_0x3f7f64=_['difference'](_[_0xcd43('0x35')](_0x17b80d),[_0xcd43('0x80'),'updatedAt']);_0x512de9=_['difference'](_[_0xcd43('0x35')](_0x17b80d),[_0xcd43('0x80'),'updatedAt',_0xcd43('0x81'),'ListId']);if(_0x5d6c05[_0xcd43('0x4c')]['id']){delete _0x5d6c05['body']['id'];}if(_[_0xcd43('0x75')](_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x82')])){throw new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))]('from\x20is\x20mandatory');}if(_[_0xcd43('0x75')](_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x4c')])||_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x4c')]===''){throw new db['Sequelize'][(_0xcd43('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcd43('0x75')](_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x83')])){throw new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))](_0xcd43('0x84')+_0x512de9);}if(!_['includes'](_0x512de9,_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x83')])){throw new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))](_0xcd43('0x85')+_0x512de9);}_0x5d7c16[_0x5d6c05[_0xcd43('0x4c')]['mapKey']]=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x82')];})[_0xcd43('0x11')](function(){return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x5d6c05[_0xcd43('0x47')]['id']},'include':[{'model':db[_0xcd43('0x86')],'as':_0xcd43('0x87'),'include':[{'model':db[_0xcd43('0x7c')],'as':'Contacts','where':_0x5d7c16,'limit':0x1,'order':[[_0xcd43('0x88'),_0xcd43('0x89')]]}]},{'model':db['ChatApplication'],'as':_0xcd43('0x8a')}]});})[_0xcd43('0x11')](handleEntityNotFound(_0x5440bd,null))[_0xcd43('0x11')](function(_0x3f0cae){if(_0x3f0cae&&_0x3f0cae[_0xcd43('0x87')]){_0x4e6c88['account']=_0x3f0cae;_0x4e6c88[_0xcd43('0x8b')]=_0x3f0cae[_0xcd43('0x8a')];_0x4e6c88[_0xcd43('0x8c')]=_0x3f0cae['List'];_0x4e6c88['applications']=_['orderBy'](_0x4e6c88[_0xcd43('0x8b')],['priority'],[_0xcd43('0x8d')]);if(_0x4e6c88[_0xcd43('0x8e')][_0xcd43('0x8a')]){delete _0x4e6c88['account'][_0xcd43('0x8a')];}if(_0x4e6c88[_0xcd43('0x8e')][_0xcd43('0x87')]&&_0x4e6c88[_0xcd43('0x8e')][_0xcd43('0x87')]['Contacts'][_0xcd43('0x3a')]){return _0x4e6c88[_0xcd43('0x8e')][_0xcd43('0x87')][_0xcd43('0x8f')][0x0];}var _0x17a019=_[_0xcd43('0x90')](_0x5d6c05[_0xcd43('0x4c')],{'firstName':_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x82')],'ListId':_0x3f0cae[_0xcd43('0x91')]});_0x17a019[_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x83')]]=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x82')];return db[_0xcd43('0x7c')][_0xcd43('0x4b')](_0x17a019,{'fields':_0x3f7f64,'raw':!![]});}})['then'](handleEntityNotFound(_0x5440bd,null))[_0xcd43('0x11')](function(_0x25ed99){_0x4e6c88[_0xcd43('0x92')]=_0x25ed99;var _0x34cb3b=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0x93')];if(_0x5d6c05[_0xcd43('0x7a')][_0xcd43('0x94')]){_0x34cb3b=_0x5d6c05[_0xcd43('0x7a')][_0xcd43('0x94')];}else if(_0x5d6c05['headers'][_0xcd43('0x95')]){_0x34cb3b=_[_0xcd43('0x96')](_0x5d6c05[_0xcd43('0x7a')][_0xcd43('0x95')]['split'](','));}if(_0x25ed99){var _0x3d0f25={'ContactId':_0x25ed99['id'],'ChatWebsiteId':_0x5d6c05['params']['id'],'from':(_0x25ed99[_0xcd43('0x97')]||'')+'\x20'+(_0x25ed99[_0xcd43('0x98')]||''),'customerIp':_0x34cb3b,'customerPort':_0x5d6c05['headers'][_0xcd43('0x99')]?_0x5d6c05[_0xcd43('0x7a')]['x-real-port']:null,'referer':_0x5d6c05['body']['referer'],'browserName':_0x19a052[_0xcd43('0x9a')][_0xcd43('0x2a')]&&_0x19a052['browser'][_0xcd43('0x9b')]?util['format'](_0xcd43('0x9c'),_0x19a052[_0xcd43('0x9a')][_0xcd43('0x2a')],_0x19a052['browser'][_0xcd43('0x9b')]):_0xcd43('0x9d'),'browserVersion':_0x19a052[_0xcd43('0x9a')][_0xcd43('0x9b')]||'unknown','osName':util['format'](_0xcd43('0x9c'),_0x19a052['os'][_0xcd43('0x2a')],_0x19a052['os'][_0xcd43('0x9b')]),'osVersion':_0x19a052['os'][_0xcd43('0x9b')],'deviceModel':_0x19a052[_0xcd43('0x9e')][_0xcd43('0x36')]&&_0x19a052[_0xcd43('0x9e')][_0xcd43('0x9f')]?util['format']('%s\x20%s\x20%s',_0x19a052[_0xcd43('0x9e')][_0xcd43('0x36')],_0x19a052[_0xcd43('0x9e')][_0xcd43('0x9f')],_0x19a052['device'][_0xcd43('0x32')]):null,'deviceVendor':_0x19a052[_0xcd43('0x9e')]['vendor'],'deviceType':_0x19a052[_0xcd43('0x9e')][_0xcd43('0x32')],'formData':JSON[_0xcd43('0x16')](_0x5d6c05[_0xcd43('0x4c')])};var _0x18cf96={'ChatWebsiteId':_0x5d6c05[_0xcd43('0x47')]['id'],'closed':![]};if(_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa0')]){_0x18cf96['threadId']=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa0')];return db[_0xcd43('0xa1')]['find']({'where':_0x18cf96})['then'](function(_0xd85f6){if(_0xd85f6){return[_0xd85f6,![]];}_0x3d0f25['threadId']=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa0')];_0x3d0f25[_0xcd43('0xa2')]=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa2')];return db[_0xcd43('0xa1')]['create'](_0x3d0f25)['then'](function(_0x2b6e84){return[_0x2b6e84,!![]];});});}_0x18cf96['ContactId']=_0x25ed99['id'];if(_0x5d6c05['body'][_0xcd43('0xa3')]&&_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa3')]['id']){_0x18cf96['id']=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa3')]['id'];return db[_0xcd43('0xa1')][_0xcd43('0x4a')]({'where':_0x18cf96})[_0xcd43('0x11')](function(_0x5983c9){if(_0x5983c9){return[_0x5983c9,![]];}return db['ChatInteraction'][_0xcd43('0x4b')](_0x3d0f25)[_0xcd43('0x11')](function(_0x3a1978){return[_0x3a1978,!![]];});});}return db['ChatInteraction'][_0xcd43('0x4b')](_0x3d0f25)[_0xcd43('0x11')](function(_0x2e57d2){return[_0x2e57d2,!![]];});}})[_0xcd43('0xa4')](function(_0x9321ad,_0x4c9929){if(_0x9321ad){_0x24e65c=_0x4c9929;if(!_0x4c9929){var _0x714402={'from':(_0x4e6c88[_0xcd43('0x92')][_0xcd43('0x97')]||'')+'\x20'+(_0x4e6c88[_0xcd43('0x92')][_0xcd43('0x98')]||'')};if(_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa0')]&&_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa5')]&&_0x5d6c05['body'][_0xcd43('0xa0')]!=_0x5d6c05[_0xcd43('0x4c')]['messageId']){_0x714402[_0xcd43('0xa0')]=_0x5d6c05[_0xcd43('0x4c')][_0xcd43('0xa5')];}return _0x9321ad[_0xcd43('0x26')](_0x714402);}else{return _0x9321ad;}}})['then'](function(_0x30bef4){_0x4e6c88[_0xcd43('0xa3')]=_0x30bef4[_0xcd43('0x4d')]({'plain':!![]});_0x4e6c88['interaction']['created']=_0x24e65c;if(_0x4e6c88[_0xcd43('0xa3')][_0xcd43('0xa6')]){if(_0x4e6c88[_0xcd43('0x8e')][_0xcd43('0xa7')]){_0x4e6c88['applications'][_0xcd43('0xa8')]({'id':0x0,'priority':_0x4e6c88[_0xcd43('0x8b')][_0xcd43('0x3a')]+0x1,'app':_0xcd43('0xa9'),'appdata':_0xcd43('0xaa'),'interval':_0xcd43('0xab')});}}return db[_0xcd43('0xac')][_0xcd43('0x4b')]({'body':_0x5d6c05['body'][_0xcd43('0x4c')],'ChatWebsiteId':_0x5d6c05[_0xcd43('0x47')]['id'],'ChatInteractionId':_0x30bef4['id'],'direction':'in','ContactId':_0x4e6c88[_0xcd43('0x92')]['id'],'AttachmentId':_0x5d6c05['body'][_0xcd43('0xad')]});})[_0xcd43('0x11')](function(_0x26d630){_0x4e6c88['message']=_0x26d630;if(_0x4e6c88[_0xcd43('0xa3')][_0xcd43('0xae')]){return db['User']['find']({'attributes':['id',_0xcd43('0x2a')],'where':{'id':_0x4e6c88[_0xcd43('0xa3')][_0xcd43('0xae')]}})['then'](function(_0x12e7b9){if(_0x12e7b9){_0x4e6c88[_0xcd43('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcd43('0xaf'),'appdata':_0x12e7b9[_0xcd43('0x2a')]+','+(_0x4e6c88[_0xcd43('0x8e')][_0xcd43('0xb0')]||0xa),'interval':_0xcd43('0xab')});_0x4e6c88[_0xcd43('0xb1')]=!![];}return respondWithRpcPromise(_0xcd43('0xb2'),'startRouting',_0x4e6c88);});}return respondWithRpcPromise(_0xcd43('0xb2'),_0xcd43('0xb3'),_0x4e6c88);})[_0xcd43('0x11')](function(_0x4dc838){respondWithRpcPromise(_0xcd43('0xb4'),_0xcd43('0xb4'),{'event':_0xcd43('0x77'),'message':_0x4dc838},client9002);return _0x4dc838;})[_0xcd43('0x11')](respondWithResult(_0x5440bd,null))[_0xcd43('0x1b')](handleError(_0x5440bd,null));};exports[_0xcd43('0xb5')]=function(_0x957bd8,_0x5cb4d0){var _0x400120,_0x10c09e,_0x3b1939;var _0x4fb120=[];var _0x31dcce={};var _0x2ac4bc=_0x957bd8[_0xcd43('0xb6')]||[];var _0x42f351=[];var _0x1e6d35;return db[_0xcd43('0x7c')][_0xcd43('0x53')]()[_0xcd43('0x11')](function(_0x2b5643){if(!_0x2b5643){throw new db['Sequelize'][(_0xcd43('0x7e'))](_0xcd43('0x7f'));}_0x4fb120=_[_0xcd43('0xb7')](_[_0xcd43('0x35')](_0x2b5643),[_0xcd43('0x80'),_0xcd43('0x88'),_0xcd43('0x81'),'ListId']);if(_0x957bd8[_0xcd43('0x4c')]['id']){delete _0x957bd8[_0xcd43('0x4c')]['id'];}if(_[_0xcd43('0x75')](_0x957bd8[_0xcd43('0x4c')][_0xcd43('0x82')])){throw _0x5cb4d0[_0xcd43('0x1d')](0x1f4)[_0xcd43('0x2b')](new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))](_0xcd43('0xb8')));}if(_[_0xcd43('0x75')](_0x957bd8[_0xcd43('0x4c')][_0xcd43('0x4c')])||_0x957bd8[_0xcd43('0x4c')][_0xcd43('0x4c')]===''){throw _0x5cb4d0[_0xcd43('0x1d')](0x1f4)['send'](new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))](_0xcd43('0xb9')));}if(_['isNil'](_0x957bd8[_0xcd43('0x4c')]['mapKeyOffline'])){throw _0x5cb4d0['status'](0x1f4)[_0xcd43('0x2b')](new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))](_0xcd43('0xba')+_0x4fb120));}if(!_[_0xcd43('0xbb')](_0x4fb120,_0x957bd8[_0xcd43('0x4c')][_0xcd43('0xbc')])){throw _0x5cb4d0[_0xcd43('0x1d')](0x1f4)[_0xcd43('0x2b')](new db[(_0xcd43('0x7d'))][(_0xcd43('0x7e'))](_0xcd43('0xbd')+_0x4fb120));}_0x31dcce[_0x957bd8['body'][_0xcd43('0xbc')]]=_0x957bd8[_0xcd43('0x4c')][_0xcd43('0x82')];})['then'](function(){return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x957bd8[_0xcd43('0x47')]['id']},'include':[{'model':db[_0xcd43('0x86')],'as':_0xcd43('0x87')},{'model':db[_0xcd43('0xbe')],'as':_0xcd43('0xbe')}]});})[_0xcd43('0x11')](handleEntityNotFound(_0x5cb4d0,null))[_0xcd43('0x11')](function(_0x12517b){if(_0x12517b&&_0x12517b[_0xcd43('0x87')]){_0x10c09e=_0x12517b;var _0x3d548e=_['defaults'](_0x957bd8[_0xcd43('0x4c')],{'firstName':_0x957bd8[_0xcd43('0x4c')][_0xcd43('0x82')],'phone':_0x957bd8['body'][_0xcd43('0x82')],'ListId':_0x12517b['ListId']});_0x3d548e[_0x957bd8[_0xcd43('0x4c')][_0xcd43('0xbc')]]=_0x957bd8['body'][_0xcd43('0x82')];return db['CmContact'][_0xcd43('0xbf')]({'where':_0x31dcce,'defaults':_0x3d548e});}})[_0xcd43('0xa4')](function(_0x5cf460){if(_0x5cf460){_0x3b1939=_0x5cf460;var _0x431f91=fs['readFileSync'](path['join'](config[_0xcd43('0x6a')],_0xcd43('0xc0')),_0xcd43('0xc1'));var _0x3ed551=ejs[_0xcd43('0xc2')](_0x431f91,{'body':_[_0xcd43('0xc3')](_0x957bd8[_0xcd43('0x4c')][_0xcd43('0x4c')]),'bodyTitle':_0x10c09e[_0xcd43('0xc4')]});return db['ChatOfflineMessage'][_0xcd43('0x4b')]({'body':_0x3ed551,'plainBody':htmlToText[_0xcd43('0xc5')](_0x3ed551),'ContactId':_0x5cf460['id'],'ChatWebsiteId':_0x10c09e['id']});}})[_0xcd43('0x11')](function(_0x1c9c55){_0x1e6d35=_0x1c9c55;if(_0x2ac4bc[_0xcd43('0x3a')]){var _0x29c8d1=_0x2ac4bc[_0xcd43('0x2e')](function(_0x445984){return{'name':_0x445984[_0xcd43('0xc6')],'basename':_0x445984[_0xcd43('0x63')],'type':_0x445984[_0xcd43('0xc7')],'ChatOfflineMessageId':_0x1c9c55['id']};});_0x42f351=_0x29c8d1[_0xcd43('0x2e')](_0x56c269=>{var _0x4a98cd={'filename':_0x56c269[_0xcd43('0x2a')],'path':path['join'](config[_0xcd43('0x6a')],_0xcd43('0xc8'),_0xcd43('0xb6'),'attachments','offline-chat',_0x56c269[_0xcd43('0xc9')])};return _0x4a98cd;});if(!_0x10c09e[_0xcd43('0xca')]){return db[_0xcd43('0xcb')][_0xcd43('0xcc')](function(_0x13a56e){return db['Attachment']['bulkCreate'](_0x29c8d1,{'transaction':_0x13a56e});});}}})[_0xcd43('0x11')](function(){if(_0x1e6d35){_0x400120=_0x1e6d35;return db[_0xcd43('0xbe')][_0xcd43('0x56')]({'where':{'service':!![]},'include':[{'model':db[_0xcd43('0xcd')],'as':_0xcd43('0xce'),'raw':!![],'include':[{'model':db[_0xcd43('0xcf')],'as':_0xcd43('0xcf'),'raw':!![]}]}]});}})[_0xcd43('0x11')](function(_0x28f085){if(_0x28f085&&_0x28f085[_0xcd43('0xce')]&&_0x10c09e[_0xcd43('0xd0')]&&_0x10c09e[_0xcd43('0xd1')]){var _0x2dae61=_0x28f085['getSmtpOptions']();return respondWithRpcPromise(_0xcd43('0xd2'),_0xcd43('0xd3'),{'account':_0x2dae61,'message':{'from':util[_0xcd43('0xd4')]('\x22%s\x22\x20<%s>',_0x28f085[_0xcd43('0x2a')],_0x28f085[_0xcd43('0xd5')]||_0x28f085[_0xcd43('0xce')][_0xcd43('0x50')]),'to':_0x10c09e[_0xcd43('0xd1')],'subject':_0x10c09e[_0xcd43('0xd6')],'html':_0x400120[_0xcd43('0x4c')],'attachments':_0x42f351}},client9003)[_0xcd43('0x11')](function(){return _0x400120;})[_0xcd43('0x1b')](function(_0x5baa4c){logger[_0xcd43('0x17')](_0x5baa4c);});}})[_0xcd43('0x11')](function(){if(_0x10c09e&&_0x10c09e[_0xcd43('0xca')]&&_0x10c09e[_0xcd43('0xd7')]){var _0x35d344=[];if(_0x2ac4bc[_0xcd43('0x3a')]){_0x35d344=_0x2ac4bc[_0xcd43('0x2e')](function(_0x288e28){return{'name':_0x288e28[_0xcd43('0xc6')],'basename':_0x288e28[_0xcd43('0x63')],'type':_0x288e28['mimetype'],'ChatOfflineMessageId':_0x1e6d35['id']};});}var _0x1e47d8;if(!_[_0xcd43('0x75')](_0x10c09e[_0xcd43('0xd8')])){var _0x52492c=_[_0xcd43('0x2e')](_0x957bd8['body'],function(_0x3dd3f4){return _0x3dd3f4;});var _0x226704=_[_0xcd43('0xd9')](_0x52492c)[0x0];var _0x1abb55=_[_0xcd43('0xda')](_0x226704,function(_0xbea66){return _0xbea66;});_0x1e47d8=_0x1abb55[0x1][_0x10c09e[_0xcd43('0xd8')]];}var _0x23d8e3={'from':_0x3b1939[_0xcd43('0xd5')],'firstName':_0x3b1939[_0xcd43('0x97')],'lastName':_0x3b1939[_0xcd43('0x98')],'mapKey':_0xcd43('0xd5'),'message':{'from':_0x3b1939['email'],'to':_0x10c09e[_0xcd43('0xbe')][_0xcd43('0xd5')],'cc':'','subject':_[_0xcd43('0x75')](_0x1e47d8)?_0x10c09e['offlineMessageSubject']:_0x1e47d8,'messageId':'','sentAt':new Date(),'attach':_0x35d344[_0xcd43('0x3a')],'attachments':_0x35d344,'originChannel':_0xcd43('0xdb'),'ChatWebsiteId':_0x10c09e['id'],'ChatOfflineMessageId':_0x400120['id'],'originTo':_0x10c09e[_0xcd43('0xbe')]['email']},'body':_0x400120['body']};var _0x48675f={'account':{'id':_0x10c09e['MailAccountId']},'body':_0x23d8e3,'log':_0xcd43('0xdc')};return respondWithRpcPromise(_0xcd43('0xdc'),_0xcd43('0xdd'),_0x48675f,client9001)[_0xcd43('0x11')](function(){return _0x400120;})[_0xcd43('0x1b')](function(_0x25028f){logger[_0xcd43('0x17')](_0x25028f);});}return;})['then'](function(){if(_0x400120){return _0x400120;}})[_0xcd43('0x11')](respondWithResult(_0x5cb4d0,null))[_0xcd43('0x1b')](function(_0xad501b){logger[_0xcd43('0x17')](_0xcd43('0x1b'),_0xad501b);for(var _0x350909 of _0x2ac4bc){var _0xad4ac6=path[_0xcd43('0x69')](config[_0xcd43('0x6a')],_0xcd43('0xc8'),_0xcd43('0xb6'),_0xcd43('0xde'),_0xcd43('0xdf'),_0x350909[_0xcd43('0x63')]);fs_extra['remove'](_0xad4ac6)[_0xcd43('0x1b')](function(_0x17ba64){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0xad4ac6,_0x17ba64);});}});};exports[_0xcd43('0xe0')]=function(_0x507033,_0x503ba2){return db[_0xcd43('0xa1')][_0xcd43('0x4a')]({'where':{'id':_0x507033['params']['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x503ba2,null))[_0xcd43('0x11')](function(_0xa0a485){if(_0xa0a485){return _0xa0a485[_0xcd43('0xe0')](_0x507033[_0xcd43('0x4c')][_0xcd43('0x5a')],_['omit'](_0x507033[_0xcd43('0x4c')],[_0xcd43('0x5a'),'id'])||{});}})[_0xcd43('0x11')](respondWithResult(_0x503ba2,null))[_0xcd43('0x1b')](handleError(_0x503ba2,null));};exports['getInteractions']=function(_0x11f4a7,_0x165fcd){var _0x2c0bad={'raw':![],'where':{}};var _0x53f7f5={};var _0x3b4a4f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xcd43('0x56')]({'where':{'id':_0x11f4a7[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x165fcd,null))[_0xcd43('0x11')](function(_0x29932a){if(_0x29932a){_0x53f7f5['model']=_[_0xcd43('0x35')](db[_0xcd43('0xa1')][_0xcd43('0x30')]);_0x53f7f5[_0xcd43('0x34')]=_[_0xcd43('0x35')](_0x11f4a7[_0xcd43('0x34')]);_0x53f7f5[_0xcd43('0x40')]=_['intersection'](_0x53f7f5[_0xcd43('0x36')],_0x53f7f5[_0xcd43('0x34')]);_0x2c0bad[_0xcd43('0x37')]=_['intersection'](_0x53f7f5[_0xcd43('0x36')],qs[_0xcd43('0x39')](_0x11f4a7[_0xcd43('0x34')][_0xcd43('0x39')]));_0x2c0bad[_0xcd43('0x37')]=_0x2c0bad[_0xcd43('0x37')][_0xcd43('0x3a')]?_0x2c0bad[_0xcd43('0x37')]:_0x53f7f5[_0xcd43('0x36')];if(!_0x11f4a7[_0xcd43('0x34')][_0xcd43('0x3b')](_0xcd43('0x3c'))){_0x2c0bad[_0xcd43('0x23')]=qs['limit'](_0x11f4a7[_0xcd43('0x34')][_0xcd43('0x23')]);_0x2c0bad[_0xcd43('0x22')]=qs[_0xcd43('0x22')](_0x11f4a7[_0xcd43('0x34')][_0xcd43('0x22')]);}_0x2c0bad[_0xcd43('0x3d')]=qs['sort'](_0x11f4a7[_0xcd43('0x34')][_0xcd43('0x3e')]);_0x2c0bad[_0xcd43('0x3f')]=qs[_0xcd43('0x40')](_['pick'](_0x11f4a7[_0xcd43('0x34')],_0x53f7f5[_0xcd43('0x40')]));_0x2c0bad['where'][_0xcd43('0x55')]=_0x29932a['id'];if(_0x11f4a7['query'][_0xcd43('0x41')]){_0x2c0bad[_0xcd43('0x3f')]=_[_0xcd43('0x43')](_0x2c0bad[_0xcd43('0x3f')],{'$or':_['map'](_0x2c0bad[_0xcd43('0x37')],function(_0x3945ed){var _0x39be2d={};_0x39be2d[_0x3945ed]={'$like':'%'+_0x11f4a7[_0xcd43('0x34')]['filter']+'%'};return _0x39be2d;})});}_0x2c0bad=_[_0xcd43('0x43')]({},_0x2c0bad,_0x11f4a7[_0xcd43('0x44')]);return db['ChatInteraction']['count']({'where':_0x2c0bad[_0xcd43('0x3f')]})[_0xcd43('0x11')](function(_0x426571){_0x3b4a4f[_0xcd43('0x21')]=_0x426571;if(_0x11f4a7[_0xcd43('0x34')]['includeAll']){_0x2c0bad[_0xcd43('0x45')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xcd43('0xe1')],'as':_0xcd43('0xe2'),'attributes':[_0xcd43('0x2a'),'fullname','internal'],'required':![]},{'model':db[_0xcd43('0xe3')],'as':'Tags','attributes':['id',_0xcd43('0x2a'),_0xcd43('0xe4')],'where':_0x11f4a7[_0xcd43('0x34')]['tag']?{'id':_0x11f4a7[_0xcd43('0x34')][_0xcd43('0xe5')]}:undefined,'required':_0x11f4a7[_0xcd43('0x34')][_0xcd43('0xe5')]?!![]:![]}];}return db['ChatInteraction'][_0xcd43('0x46')](_0x2c0bad);})['then'](function(_0x44c1b6){_0x3b4a4f[_0xcd43('0x5e')]=_0x44c1b6;return _0x3b4a4f;});}})[_0xcd43('0x11')](respondWithFilteredResult(_0x165fcd,_0x2c0bad))[_0xcd43('0x1b')](handleError(_0x165fcd,null));};function iftimePromise(_0x1db92d,_0x4340ef){return respondWithRpcPromise(_0xcd43('0xe6'),_0xcd43('0xe7'),{'command':_0x4340ef[_0xcd43('0xe8')]?util[_0xcd43('0xd4')]('iftime\x20%s,%s',_0x1db92d[_0xcd43('0xe9')],_0x4340ef[_0xcd43('0xe8')]):util['format'](_0xcd43('0xea'),_0x1db92d[_0xcd43('0xe9')])},client9002)[_0xcd43('0x11')](function(_0x213da8){var _0x46bdd4=_0x213da8&&_0x213da8['indexOf'](_0xcd43('0xeb'))>=0x0?!![]:![];logger[_0xcd43('0x12')](_0xcd43('0xec'),_0x4340ef['id'],_0x1db92d['id'],_0x1db92d[_0xcd43('0xe9')],_0x46bdd4?_0xcd43('0xed'):_0xcd43('0xee'),_0x4340ef[_0xcd43('0xe8')]?_0x4340ef[_0xcd43('0xe8')]:_0xcd43('0xef'));return _0x46bdd4;})[_0xcd43('0x1b')](function(_0x4f3824){logger[_0xcd43('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4340ef['id'],_0x1db92d['id'],_0x1db92d['interval'],util[_0xcd43('0xf0')](_0x4f3824,{'showHidden':![],'depth':null}),_0x4340ef[_0xcd43('0xe8')]?_0x4340ef['timezone']:_0xcd43('0xef'));return![];});}exports[_0xcd43('0xe7')]=function(_0x38d0e3,_0x4d5c56){var _0x31cbb8=0x0;var _0x13db89=0x0;var _0x4c2579=![];var _0x4bc248;var _0x3191fe;return db[_0xcd43('0x2f')]['find']({'where':{'id':_0x38d0e3[_0xcd43('0x47')]['id']},'include':[{'model':db['Interval'],'as':_0xcd43('0xf1'),'include':[{'model':db[_0xcd43('0xf1')],'as':'Intervals','attributes':['id',_0xcd43('0xe9')],'raw':!![]}]}]})[_0xcd43('0x11')](handleEntityNotFound(_0x4d5c56,null))['then'](function(_0x50b4a6){if(_0x50b4a6){_0x4bc248=_0x50b4a6;return _0x50b4a6[_0xcd43('0xf2')]({'raw':!![]});}})[_0xcd43('0x11')](function(_0x5c5311){if(_0x4bc248){if(_0x5c5311){_0x3191fe=_0x5c5311;}}return require(_0xcd43('0x6b'))[_0xcd43('0xf3')]();})['then'](function(_0x199340){if(_0x199340){_0x13db89=_0x199340[_0xcd43('0xf4')];_0x4c2579=_0x199340[_0xcd43('0xf5')];}})['then'](function(){return db[_0xcd43('0xa1')][_0xcd43('0x21')]({'where':{'closed':![]}});})[_0xcd43('0x11')](function(_0x361c5b){_0x31cbb8=_0x361c5b;if(_0x13db89&&_0x361c5b>_0x13db89){return db[_0xcd43('0xf6')][_0xcd43('0x56')]({'where':{'id':0x1}})[_0xcd43('0x11')](function(_0x4dc739){if(_0x4dc739){_0x4dc739[_0xcd43('0xf7')](_0xcd43('0xf8'));}});}})[_0xcd43('0x11')](function(){if(_0x4bc248[_0xcd43('0xf1')]&&_0x4bc248['Interval'][_0xcd43('0xf9')]){var _0x2509f8=[];for(var _0x156411=0x0;_0x156411<_0x4bc248['Interval'][_0xcd43('0xf9')][_0xcd43('0x3a')];_0x156411++){var _0x520ada=_0x4bc248[_0xcd43('0xf1')][_0xcd43('0xf9')][_0x156411][_0xcd43('0x4d')]({'plain':!![]});_0x2509f8['push'](iftimePromise(_0x520ada,_0x4bc248));}return BPromise[_0xcd43('0xfa')](_0x2509f8)[_0xcd43('0x11')](function(_0xea2357){return _[_0xcd43('0xfb')](_0xea2357);});}else{return!![];}})[_0xcd43('0x11')](function(_0xca55c){var _0x1702cc=fs[_0xcd43('0xfc')](path['join'](config[_0xcd43('0x6a')],'server/files/chat/iframe.ejs'),_0xcd43('0xc1'));var _0x49a661={'remote':_0x4bc248[_0xcd43('0xfd')],'query':querystring[_0xcd43('0x16')](_[_0xcd43('0x43')](_0x4bc248[_0xcd43('0x4d')]({'plain':!![]}),{'customerIp':_0x38d0e3['headers'][_0xcd43('0x95')]||_0x38d0e3[_0xcd43('0x7a')][_0xcd43('0xfe')]||_0x38d0e3['connection'][_0xcd43('0xff')]||_0x38d0e3['ip'],'referer':_0x38d0e3[_0xcd43('0x7a')]['referer'],'openedInteractions':_0x31cbb8,'maxInteractions':_0x13db89,'virtual':_0x4c2579[_0xcd43('0xf4')],'online':_0xca55c,'custom':_0x4c2579}))[_0xcd43('0x100')](/'/g,'\x5c\x27')};_0x4d5c56['send'](ejs['render'](Mustache['render'](_0x1702cc,_0x49a661),{'proactiveActions':_0x3191fe,'alignment':_0x4bc248[_0xcd43('0x101')],'verticalAlignment':_0x4bc248[_0xcd43('0x102')],'div_color':_0x4bc248[_0xcd43('0xe4')],'labelText':_0x4bc248['labelText'],'text_color':_0x4bc248['textColor'],'text_button_color':_0x4bc248[_0xcd43('0x103')],'button_color':_0x4bc248[_0xcd43('0x104')],'background_color':_0x4bc248['backgroundColor'],'hideWhenOffline':_0x4bc248[_0xcd43('0x105')],'interval':_0x4bc248[_0xcd43('0x106')]}));})[_0xcd43('0x1b')](handleError(_0x4d5c56,null));};exports[_0xcd43('0x107')]=function(_0x340d34,_0x48a1ef){var _0x20ee6c=_0x340d34['params']['id'];var _0x23c2bc=_0x340d34['body'];var _0x2e5790=0xc8;var _0x49f0e7=null;return db[_0xcd43('0xcb')]['transaction']({'isolationLevel':db['sequelize'][_0xcd43('0x108')][_0xcd43('0x109')][_0xcd43('0x10a')]},function(_0x5c8811){return db[_0xcd43('0x2f')][_0xcd43('0x56')]({'where':{'id':_0x20ee6c},'transaction':_0x5c8811})[_0xcd43('0x11')](function(_0x19f967){if(_0x19f967){return db[_0xcd43('0x10b')]['destroy']({'where':{'ChatWebsiteId':_0x20ee6c},'transaction':_0x5c8811})[_0xcd43('0x11')](function(){var _0x536446=_[_0xcd43('0x2e')](_0x23c2bc,function(_0x246e24){_0x246e24['ChatWebsiteId']=_0x20ee6c;return _0x246e24;});return db[_0xcd43('0x10b')][_0xcd43('0x10c')](_0x536446,{'transaction':_0x5c8811});});}else{_0x2e5790=0x194;_0x49f0e7=[];}});})[_0xcd43('0x11')](function(){if(_0x2e5790!==0x194){return db[_0xcd43('0x10b')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x20ee6c},'order':_0xcd43('0x10d')})[_0xcd43('0x11')](function(_0x35f4a7){_0x49f0e7=_0x35f4a7;});}})[_0xcd43('0x1b')](function(_0x4c7e7f){_0x2e5790=0x1f4;logger['error'](_0x4c7e7f[_0xcd43('0x10e')]);if(_0x4c7e7f[_0xcd43('0x2a')]){delete _0x4c7e7f[_0xcd43('0x2a')];}_0x49f0e7=_0x4c7e7f;})[_0xcd43('0x10f')](function(){if(_0x49f0e7===null){_0x48a1ef['sendStatus'](_0x2e5790);}else{if(_0x2e5790===0x1f4){_0x48a1ef[_0xcd43('0x1d')](_0x2e5790)[_0xcd43('0x2b')](_0x49f0e7);}else{_0x48a1ef['status'](_0x2e5790)[_0xcd43('0x1f')](_0x49f0e7);}}});};exports[_0xcd43('0x110')]=function(_0x25645d,_0x578512){var _0x263c1f={};var _0x1cbc79={};var _0x1ffd81;var _0x51f940;return db['ChatWebsite'][_0xcd43('0x56')]({'where':{'id':_0x25645d[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x578512,null))['then'](function(_0x5bb5e6){if(_0x5bb5e6){_0x1ffd81=_0x5bb5e6;_0x1cbc79['model']=_['keys'](db[_0xcd43('0x10b')][_0xcd43('0x30')]);_0x1cbc79[_0xcd43('0x34')]=_[_0xcd43('0x35')](_0x25645d['query']);_0x1cbc79['filters']=_[_0xcd43('0x38')](_0x1cbc79[_0xcd43('0x36')],_0x1cbc79[_0xcd43('0x34')]);_0x263c1f[_0xcd43('0x37')]=_['intersection'](_0x1cbc79[_0xcd43('0x36')],qs[_0xcd43('0x39')](_0x25645d[_0xcd43('0x34')][_0xcd43('0x39')]));_0x263c1f[_0xcd43('0x37')]=_0x263c1f['attributes'][_0xcd43('0x3a')]?_0x263c1f['attributes']:_0x1cbc79[_0xcd43('0x36')];_0x263c1f[_0xcd43('0x3d')]=qs[_0xcd43('0x3e')](_0x25645d['query'][_0xcd43('0x3e')]);_0x263c1f[_0xcd43('0x3f')]=qs[_0xcd43('0x40')](_[_0xcd43('0x58')](_0x25645d['query'],_0x1cbc79[_0xcd43('0x40')]));if(_0x25645d[_0xcd43('0x34')][_0xcd43('0x41')]){_0x263c1f[_0xcd43('0x3f')]=_['merge'](_0x263c1f['where'],{'$or':_[_0xcd43('0x2e')](_0x263c1f[_0xcd43('0x37')],function(_0x47c382){var _0x4eabfd={};_0x4eabfd[_0x47c382]={'$like':'%'+_0x25645d[_0xcd43('0x34')][_0xcd43('0x41')]+'%'};return _0x4eabfd;})});}_0x263c1f=_[_0xcd43('0x43')]({},_0x263c1f,_0x25645d[_0xcd43('0x44')]);return _0x1ffd81['getApplications'](_0x263c1f);}})[_0xcd43('0x11')](function(_0x9ee0ba){if(_0x9ee0ba){_0x51f940=_0x9ee0ba[_0xcd43('0x3a')];if(!_0x25645d[_0xcd43('0x34')][_0xcd43('0x3b')](_0xcd43('0x3c'))){_0x263c1f[_0xcd43('0x23')]=qs[_0xcd43('0x23')](_0x25645d[_0xcd43('0x34')][_0xcd43('0x23')]);_0x263c1f[_0xcd43('0x22')]=qs['offset'](_0x25645d['query'][_0xcd43('0x22')]);}return _0x1ffd81[_0xcd43('0x110')](_0x263c1f);}})['then'](function(_0x11da57){if(_0x11da57){return _0x11da57?{'count':_0x51f940,'rows':_0x11da57}:null;}})[_0xcd43('0x11')](respondWithResult(_0x578512,null))[_0xcd43('0x1b')](handleError(_0x578512,null));};exports[_0xcd43('0x111')]=function(_0x287555,_0x354e51){return db['chatProactiveAction'][_0xcd43('0x4a')]({'where':{'id':_0x287555[_0xcd43('0x47')]['id']}})['then'](handleEntityNotFound(_0x354e51,null))[_0xcd43('0x11')](function(_0x4fcc66){if(_0x4fcc66){return _0x4fcc66[_0xcd43('0x111')](_0x287555[_0xcd43('0x4c')][_0xcd43('0x5a')],_['omit'](_0x287555[_0xcd43('0x4c')],[_0xcd43('0x5a'),'id'])||{});}})[_0xcd43('0x11')](respondWithResult(_0x354e51,null))[_0xcd43('0x1b')](handleError(_0x354e51,null));};exports['getProactiveActions']=function(_0x5a4610,_0x22b2c7){var _0x41218d={};var _0x699126={};var _0x46fda9;var _0x399b9f;return db[_0xcd43('0x2f')][_0xcd43('0x56')]({'where':{'id':_0x5a4610[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x22b2c7,null))[_0xcd43('0x11')](function(_0x204ea1){if(_0x204ea1){_0x46fda9=_0x204ea1;_0x699126[_0xcd43('0x36')]=_['keys'](db[_0xcd43('0x112')][_0xcd43('0x30')]);_0x699126['query']=_['keys'](_0x5a4610[_0xcd43('0x34')]);_0x699126[_0xcd43('0x40')]=_[_0xcd43('0x38')](_0x699126[_0xcd43('0x36')],_0x699126['query']);_0x41218d['attributes']=_[_0xcd43('0x38')](_0x699126[_0xcd43('0x36')],qs[_0xcd43('0x39')](_0x5a4610[_0xcd43('0x34')]['fields']));_0x41218d[_0xcd43('0x37')]=_0x41218d[_0xcd43('0x37')][_0xcd43('0x3a')]?_0x41218d[_0xcd43('0x37')]:_0x699126['model'];_0x41218d[_0xcd43('0x3d')]=qs['sort'](_0x5a4610['query'][_0xcd43('0x3e')]);_0x41218d['where']=qs['filters'](_[_0xcd43('0x58')](_0x5a4610[_0xcd43('0x34')],_0x699126[_0xcd43('0x40')]));if(_0x5a4610['query'][_0xcd43('0x41')]){_0x41218d[_0xcd43('0x3f')]=_[_0xcd43('0x43')](_0x41218d['where'],{'$or':_['map'](_0x41218d['attributes'],function(_0x57e3c3){var _0x50669d={};_0x50669d[_0x57e3c3]={'$like':'%'+_0x5a4610[_0xcd43('0x34')]['filter']+'%'};return _0x50669d;})});}_0x41218d=_[_0xcd43('0x43')]({},_0x41218d,_0x5a4610[_0xcd43('0x44')]);return _0x46fda9[_0xcd43('0xf2')](_0x41218d);}})['then'](function(_0xabfd89){if(_0xabfd89){_0x399b9f=_0xabfd89[_0xcd43('0x3a')];if(!_0x5a4610[_0xcd43('0x34')][_0xcd43('0x3b')](_0xcd43('0x3c'))){_0x41218d[_0xcd43('0x23')]=qs['limit'](_0x5a4610[_0xcd43('0x34')][_0xcd43('0x23')]);_0x41218d[_0xcd43('0x22')]=qs[_0xcd43('0x22')](_0x5a4610[_0xcd43('0x34')][_0xcd43('0x22')]);}return _0x46fda9[_0xcd43('0xf2')](_0x41218d);}})[_0xcd43('0x11')](function(_0x1a23d6){if(_0x1a23d6){return _0x1a23d6?{'count':_0x399b9f,'rows':_0x1a23d6}:null;}})[_0xcd43('0x11')](respondWithResult(_0x22b2c7,null))[_0xcd43('0x1b')](handleError(_0x22b2c7,null));};exports[_0xcd43('0x113')]=function(_0x212c0d,_0x4e597b){var _0x3a6145=_0x212c0d[_0xcd43('0x34')][_0xcd43('0x114')]===_0xcd43('0x115')?_0xcd43('0x116'):_0xcd43('0x117');return db['ChatWebsite'][_0xcd43('0x4a')]({'attributes':['id',_0x3a6145],'where':{'id':_0x212c0d[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x4e597b,null))['then'](function(_0x49d381){if(_0x49d381){var _0x15a5b5=_0x49d381[_0x3a6145];var _0x33b388=_0x15a5b5&&_0x15a5b5['items']?_0x15a5b5[_0xcd43('0x118')]:[];_0x4e597b[_0xcd43('0x2b')]({'fromKey':_['isNil'](_0x15a5b5[_0xcd43('0x119')])?undefined:_0x15a5b5[_0xcd43('0x119')],'count':_0x33b388['length'],'rows':_0x33b388});}})[_0xcd43('0x1b')](handleError(_0x4e597b,null));};exports[_0xcd43('0x11a')]=function(_0x1dbcb3,_0x3c65e3){var _0x53115d={'raw':![],'where':{}};var _0x3c7a8d={};var _0x35a0b0={'count':0x0,'rows':[]};return db[_0xcd43('0x2f')]['findOne']({'where':{'id':_0x1dbcb3[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x3c65e3,null))[_0xcd43('0x11')](function(_0x3901f4){if(_0x3901f4){_0x3c7a8d[_0xcd43('0x36')]=_[_0xcd43('0x35')](db[_0xcd43('0x11b')][_0xcd43('0x30')]);_0x3c7a8d[_0xcd43('0x34')]=_[_0xcd43('0x35')](_0x1dbcb3[_0xcd43('0x34')]);_0x3c7a8d[_0xcd43('0x40')]=_[_0xcd43('0x38')](_0x3c7a8d[_0xcd43('0x36')],_0x3c7a8d[_0xcd43('0x34')]);_0x53115d[_0xcd43('0x37')]=_[_0xcd43('0x38')](_0x3c7a8d[_0xcd43('0x36')],qs[_0xcd43('0x39')](_0x1dbcb3['query']['fields']));_0x53115d[_0xcd43('0x37')]=_0x53115d[_0xcd43('0x37')][_0xcd43('0x3a')]?_0x53115d[_0xcd43('0x37')]:_0x3c7a8d[_0xcd43('0x36')];if(!_0x1dbcb3[_0xcd43('0x34')]['hasOwnProperty'](_0xcd43('0x3c'))){_0x53115d[_0xcd43('0x23')]=qs[_0xcd43('0x23')](_0x1dbcb3[_0xcd43('0x34')][_0xcd43('0x23')]);_0x53115d[_0xcd43('0x22')]=qs[_0xcd43('0x22')](_0x1dbcb3[_0xcd43('0x34')][_0xcd43('0x22')]);}_0x53115d[_0xcd43('0x3d')]=qs[_0xcd43('0x3e')](_0x1dbcb3['query'][_0xcd43('0x3e')]);_0x53115d[_0xcd43('0x3f')]=qs[_0xcd43('0x40')](_['pick'](_0x1dbcb3[_0xcd43('0x34')],_0x3c7a8d['filters']));_0x53115d[_0xcd43('0x3f')][_0xcd43('0x55')]=_0x3901f4['id'];if(_0x1dbcb3['query']['filter']){_0x53115d['where']=_[_0xcd43('0x43')](_0x53115d[_0xcd43('0x3f')],{'$or':_[_0xcd43('0x2e')](_0x53115d[_0xcd43('0x37')],function(_0x521f8e){var _0x4f1b9e={};_0x4f1b9e[_0x521f8e]={'$like':'%'+_0x1dbcb3[_0xcd43('0x34')]['filter']+'%'};return _0x4f1b9e;})});}_0x53115d=_[_0xcd43('0x43')]({},_0x53115d,_0x1dbcb3[_0xcd43('0x44')]);return db[_0xcd43('0x11b')][_0xcd43('0x21')]({'where':_0x53115d['where']})[_0xcd43('0x11')](function(_0x1ecba3){_0x35a0b0[_0xcd43('0x21')]=_0x1ecba3;if(_0x1dbcb3[_0xcd43('0x34')]['includeAll']){_0x53115d[_0xcd43('0x45')]=[{'all':!![]}];}else{_0x53115d['include']=[{'model':db[_0xcd43('0x7c')],'as':_0xcd43('0x11c'),'required':![]},{'model':db[_0xcd43('0x11d')],'as':_0xcd43('0x11e'),'required':![]}];}return db[_0xcd43('0x11b')][_0xcd43('0x46')](_0x53115d);})[_0xcd43('0x11')](function(_0x1bee81){_0x35a0b0[_0xcd43('0x5e')]=_0x1bee81;return _0x35a0b0;});}})[_0xcd43('0x11')](respondWithFilteredResult(_0x3c65e3,_0x53115d))['catch'](handleError(_0x3c65e3,null));};exports['addAgents']=function(_0x42284d,_0x3a92fa){return db['ChatWebsite'][_0xcd43('0x4a')]({'where':{'id':_0x42284d[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x3a92fa,null))['then'](function(_0x390bf5){if(_0x390bf5){return _0x390bf5['addAgents'](_0x42284d['body'][_0xcd43('0x5a')],_[_0xcd43('0x11f')](_0x42284d[_0xcd43('0x4c')],[_0xcd43('0x5a'),'id'])||{})[_0xcd43('0xa4')](function(_0x3e142f){for(var _0x50723f=0x0;_0x50723f<_0x42284d['body'][_0xcd43('0x5a')][_0xcd43('0x3a')];_0x50723f+=0x1){socket['emit'](_0xcd43('0x120'),{'UserId':Number(_0x42284d[_0xcd43('0x4c')][_0xcd43('0x5a')][_0x50723f]),'ChatWebsiteId':Number(_0x42284d[_0xcd43('0x47')]['id'])});}return _0x3e142f;});}})[_0xcd43('0x11')](respondWithResult(_0x3a92fa,null))[_0xcd43('0x1b')](handleError(_0x3a92fa,null));};exports[_0xcd43('0x121')]=function(_0x1486c2,_0x16f59f){return db[_0xcd43('0x2f')][_0xcd43('0x4a')]({'where':{'id':_0x1486c2[_0xcd43('0x47')]['id']}})[_0xcd43('0x11')](handleEntityNotFound(_0x16f59f,null))['then'](function(_0x4d6806){if(_0x4d6806){return _0x4d6806['removeAgents'](_0x1486c2[_0xcd43('0x34')][_0xcd43('0x5a')])[_0xcd43('0x11')](function(){if(_[_0xcd43('0x122')](_0x1486c2[_0xcd43('0x34')][_0xcd43('0x5a')])){for(var _0xaad0f1=0x0;_0xaad0f1<_0x1486c2[_0xcd43('0x34')][_0xcd43('0x5a')][_0xcd43('0x3a')];_0xaad0f1+=0x1){socket[_0xcd43('0x123')](_0xcd43('0x124'),{'UserId':Number(_0x1486c2[_0xcd43('0x34')][_0xcd43('0x5a')][_0xaad0f1]),'ChatWebsiteId':Number(_0x1486c2[_0xcd43('0x47')]['id'])});}}else{socket[_0xcd43('0x123')](_0xcd43('0x124'),{'UserId':Number(_0x1486c2['query'][_0xcd43('0x5a')]),'ChatWebsiteId':Number(_0x1486c2[_0xcd43('0x47')]['id'])});}});}})[_0xcd43('0x11')](respondWithStatusCode(_0x16f59f,null))[_0xcd43('0x1b')](handleError(_0x16f59f,null));};exports[_0xcd43('0x125')]=function(_0x3af87d,_0x1e3710){var _0x58190b={};var _0x539bc4={};var _0x45e2c4;var _0x143d0a;return db[_0xcd43('0x2f')][_0xcd43('0x56')]({'where':{'id':_0x3af87d[_0xcd43('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e3710,null))[_0xcd43('0x11')](function(_0xc9a400){if(_0xc9a400){_0x45e2c4=_0xc9a400;_0x539bc4[_0xcd43('0x36')]=_[_0xcd43('0x35')](db[_0xcd43('0xe1')][_0xcd43('0x30')]);_0x539bc4['query']=_['keys'](_0x3af87d[_0xcd43('0x34')]);_0x539bc4['filters']=_[_0xcd43('0x38')](_0x539bc4[_0xcd43('0x36')],_0x539bc4[_0xcd43('0x34')]);_0x58190b[_0xcd43('0x37')]=_[_0xcd43('0x38')](_0x539bc4[_0xcd43('0x36')],qs['fields'](_0x3af87d[_0xcd43('0x34')][_0xcd43('0x39')]));_0x58190b[_0xcd43('0x37')]=_0x58190b[_0xcd43('0x37')][_0xcd43('0x3a')]?_0x58190b['attributes']:_0x539bc4[_0xcd43('0x36')];_0x58190b['order']=qs[_0xcd43('0x3e')](_0x3af87d[_0xcd43('0x34')][_0xcd43('0x3e')]);_0x58190b['where']=qs['filters'](_[_0xcd43('0x58')](_0x3af87d[_0xcd43('0x34')],_0x539bc4['filters']));if(_0x3af87d[_0xcd43('0x34')][_0xcd43('0x41')]){_0x58190b[_0xcd43('0x3f')]=_[_0xcd43('0x43')](_0x58190b['where'],{'$or':_[_0xcd43('0x2e')](_0x58190b[_0xcd43('0x37')],function(_0x396eea){var _0x1adb15={};_0x1adb15[_0x396eea]={'$like':'%'+_0x3af87d[_0xcd43('0x34')]['filter']+'%'};return _0x1adb15;})});}_0x58190b=_[_0xcd43('0x43')]({},_0x58190b,_0x3af87d[_0xcd43('0x44')]);return _0x45e2c4[_0xcd43('0x125')](_0x58190b);}})[_0xcd43('0x11')](function(_0x9e8eb7){if(_0x9e8eb7){_0x143d0a=_0x9e8eb7['length'];if(!_0x3af87d[_0xcd43('0x34')][_0xcd43('0x3b')](_0xcd43('0x3c'))){_0x58190b[_0xcd43('0x23')]=qs['limit'](_0x3af87d[_0xcd43('0x34')]['limit']);_0x58190b[_0xcd43('0x22')]=qs['offset'](_0x3af87d[_0xcd43('0x34')]['offset']);}return _0x45e2c4[_0xcd43('0x125')](_0x58190b);}})[_0xcd43('0x11')](function(_0x4429ab){if(_0x4429ab){return _0x4429ab?{'count':_0x143d0a,'rows':_0x4429ab}:null;}})[_0xcd43('0x11')](respondWithResult(_0x1e3710,null))['catch'](handleError(_0x1e3710,null));}; \ No newline at end of file +var _0x72fa=['Start','startRouting','EventManager','offline','files','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','forwardOfflineAddress','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','ChatWebsite','findAll','rows','show','params','find','create','role','user','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','ChatWebsiteId','Disposition','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','systemAvatar','user-agent-parser','setUA','headers','user-agent','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','asc','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership'];(function(_0x3ac3f6,_0x5d09a5){var _0x63ea4a=function(_0x667edc){while(--_0x667edc){_0x3ac3f6['push'](_0x3ac3f6['shift']());}};_0x63ea4a(++_0x5d09a5);}(_0x72fa,0x74));var _0xa72f=function(_0x1ed034,_0x5d495d){_0x1ed034=_0x1ed034-0x0;var _0x4a82b7=_0x72fa[_0x1ed034];return _0x4a82b7;};'use strict';var BPromise=require(_0xa72f('0x0'));var Mustache=require('mustache');var util=require(_0xa72f('0x1'));var path=require('path');var ejs=require(_0xa72f('0x2'));var fs=require('fs');var fs_extra=require(_0xa72f('0x3'));var _=require('lodash');var querystring=require('querystring');var Redis=require(_0xa72f('0x4'));var qs=require(_0xa72f('0x5'));var logger=require(_0xa72f('0x6'))('api');var config=require('../../config/environment');var db=require(_0xa72f('0x7'))['db'];config[_0xa72f('0x8')]=_[_0xa72f('0x9')](config['redis'],{'host':_0xa72f('0xa'),'port':0x18eb});var socket=require(_0xa72f('0xb'))(new Redis(config[_0xa72f('0x8')]));require('./chatWebsite.socket')[_0xa72f('0xc')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xa72f('0xd'));var client=jayson[_0xa72f('0xe')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa72f('0xf')]({'port':0x232a});var client9003=jayson[_0xa72f('0xe')][_0xa72f('0xf')]({'port':0x232b});var client9001=jayson[_0xa72f('0xe')]['http']({'port':0x2329});function respondWithRpcPromise(_0x56f3ec,_0x21ca2f,_0x53112f,_0x57e110){return new BPromise(function(_0x423e51,_0x3db1eb){var _0x593679=_0x57e110||client;return _0x593679[_0xa72f('0x10')](_0x56f3ec,_0x53112f)[_0xa72f('0x11')](function(_0x2be183){logger[_0xa72f('0x12')](_0xa72f('0x13'),_0x21ca2f,_0xa72f('0x14'));logger[_0xa72f('0x15')](_0xa72f('0x16'),_0x21ca2f,_0xa72f('0x14'),JSON[_0xa72f('0x17')](_0x2be183));if(_0x2be183[_0xa72f('0x18')]){if(_0x2be183['error'][_0xa72f('0x19')]===0x1f4){logger[_0xa72f('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x21ca2f,_0x2be183[_0xa72f('0x18')][_0xa72f('0x1a')]);return _0x3db1eb(_0x2be183[_0xa72f('0x18')][_0xa72f('0x1a')]);}logger[_0xa72f('0x18')](_0xa72f('0x13'),_0x21ca2f,_0x2be183['error'][_0xa72f('0x1a')]);return _0x423e51(_0x2be183[_0xa72f('0x18')][_0xa72f('0x1a')]);}else{logger['info'](_0xa72f('0x13'),_0x21ca2f,_0xa72f('0x14'));_0x423e51(_0x2be183[_0xa72f('0x1b')][_0xa72f('0x1a')]);}})[_0xa72f('0x1c')](function(_0x3e3cba){logger['error'](_0xa72f('0x13'),_0x21ca2f,_0x3e3cba);_0x3db1eb(_0x3e3cba);});});}function respondWithStatusCode(_0x25c1bf,_0x2e1082){_0x2e1082=_0x2e1082||0xcc;return function(_0x395a56){if(_0x395a56){return _0x25c1bf[_0xa72f('0x1d')](_0x2e1082);}return _0x25c1bf[_0xa72f('0x1e')](_0x2e1082)[_0xa72f('0x1f')]();};}function respondWithResult(_0x214d5f,_0x45c753){_0x45c753=_0x45c753||0xc8;return function(_0x499bad){if(_0x499bad){return _0x214d5f[_0xa72f('0x1e')](_0x45c753)[_0xa72f('0x20')](_0x499bad);}};}function respondWithFilteredResult(_0x5de922,_0x19e738){return function(_0x40f489){if(_0x40f489){var _0x14bbd2=typeof _0x19e738[_0xa72f('0x21')]===_0xa72f('0x22')&&typeof _0x19e738['limit']===_0xa72f('0x22');var _0x219634=_0x40f489['count'];var _0x2765c6=_0x14bbd2?0x0:_0x19e738[_0xa72f('0x21')];var _0x375b85=_0x14bbd2?_0x40f489[_0xa72f('0x23')]:_0x19e738[_0xa72f('0x21')]+_0x19e738[_0xa72f('0x24')];var _0x165b2f;if(_0x375b85>=_0x219634){_0x375b85=_0x219634;_0x165b2f=0xc8;}else{_0x165b2f=0xce;}_0x5de922[_0xa72f('0x1e')](_0x165b2f);return _0x5de922[_0xa72f('0x25')](_0xa72f('0x26'),_0x2765c6+'-'+_0x375b85+'/'+_0x219634)['json'](_0x40f489);}return null;};}function saveUpdates(_0x168959){return function(_0x5c16e7){if(_0x5c16e7){return _0x5c16e7[_0xa72f('0x27')](_0x168959)[_0xa72f('0x11')](function(_0x1df195){return _0x1df195;});}return null;};}function removeEntity(_0x404aed){return function(_0x5a9e4c){if(_0x5a9e4c){return _0x5a9e4c['destroy']()['then'](function(){var _0x12f17e=_0x5a9e4c[_0xa72f('0x28')]({'plain':!![]});var _0x92094='ChatWebsites';return db[_0xa72f('0x29')]['destroy']({'where':{'type':_0x92094,'resourceId':_0x12f17e['id']}})[_0xa72f('0x11')](function(){return _0x5a9e4c;});})['then'](function(){_0x404aed[_0xa72f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x452736){return function(_0x310840){if(!_0x310840){_0x452736['sendStatus'](0x194);}return _0x310840;};}function handleError(_0x47e484,_0x55520c){_0x55520c=_0x55520c||0x1f4;return function(_0x518dd1){logger[_0xa72f('0x18')](_0x518dd1[_0xa72f('0x2a')]);if(_0x518dd1[_0xa72f('0x2b')]){delete _0x518dd1[_0xa72f('0x2b')];}_0x47e484[_0xa72f('0x1e')](_0x55520c)['send'](_0x518dd1);};}exports[_0xa72f('0x2c')]=function(_0x436bb3,_0x5d767f){var _0x1df7a4={'include':[{'model':db[_0xa72f('0x2d')],'as':_0xa72f('0x2e')}]},_0x3ecdb9={},_0x533476={'count':0x0,'rows':[]};var _0x3b42b4=_[_0xa72f('0x2f')](db['ChatWebsite'][_0xa72f('0x30')],function(_0x186276){return{'name':_0x186276['fieldName'],'type':_0x186276['type']['key']};});_0x3ecdb9[_0xa72f('0x31')]=_[_0xa72f('0x2f')](_0x3b42b4,'name');_0x3ecdb9['query']=_[_0xa72f('0x32')](_0x436bb3[_0xa72f('0x33')]);_0x3ecdb9[_0xa72f('0x34')]=_[_0xa72f('0x35')](_0x3ecdb9['model'],_0x3ecdb9['query']);_0x1df7a4['attributes']=_[_0xa72f('0x35')](_0x3ecdb9[_0xa72f('0x31')],qs[_0xa72f('0x36')](_0x436bb3[_0xa72f('0x33')]['fields']));_0x1df7a4[_0xa72f('0x37')]=_0x1df7a4['attributes'][_0xa72f('0x38')]?_0x1df7a4[_0xa72f('0x37')]:_0x3ecdb9[_0xa72f('0x31')];if(!_0x436bb3[_0xa72f('0x33')][_0xa72f('0x39')](_0xa72f('0x3a'))){_0x1df7a4[_0xa72f('0x24')]=qs['limit'](_0x436bb3['query'][_0xa72f('0x24')]);_0x1df7a4[_0xa72f('0x21')]=qs[_0xa72f('0x21')](_0x436bb3[_0xa72f('0x33')][_0xa72f('0x21')]);}_0x1df7a4[_0xa72f('0x3b')]=qs['sort'](_0x436bb3['query'][_0xa72f('0x3c')]);_0x1df7a4[_0xa72f('0x3d')]=qs[_0xa72f('0x34')](_[_0xa72f('0x3e')](_0x436bb3[_0xa72f('0x33')],_0x3ecdb9[_0xa72f('0x34')]),_0x3b42b4);if(_0x436bb3[_0xa72f('0x33')][_0xa72f('0x3f')]){_0x1df7a4['where']=_[_0xa72f('0x40')](_0x1df7a4[_0xa72f('0x3d')],{'$or':_[_0xa72f('0x2f')](_0x3b42b4,function(_0x1a8a0e){if(_0x1a8a0e[_0xa72f('0x41')]!=='VIRTUAL'){var _0x2e09b7={};_0x2e09b7[_0x1a8a0e[_0xa72f('0x2b')]]={'$like':'%'+_0x436bb3[_0xa72f('0x33')]['filter']+'%'};return _0x2e09b7;}})});}_0x1df7a4=_[_0xa72f('0x40')]({},_0x1df7a4,_0x436bb3[_0xa72f('0x42')]);var _0xbf0957={'where':_0x1df7a4['where']};return db['ChatWebsite'][_0xa72f('0x23')](_0xbf0957)[_0xa72f('0x11')](function(_0x55ebea){_0x533476[_0xa72f('0x23')]=_0x55ebea;if(_0x436bb3[_0xa72f('0x33')][_0xa72f('0x43')]){_0x1df7a4[_0xa72f('0x44')]=[{'all':!![]}];}return db[_0xa72f('0x45')][_0xa72f('0x46')](_0x1df7a4);})[_0xa72f('0x11')](function(_0x27cfd3){_0x533476[_0xa72f('0x47')]=_0x27cfd3;return _0x533476;})['then'](respondWithFilteredResult(_0x5d767f,_0x1df7a4))['catch'](handleError(_0x5d767f,null));};exports[_0xa72f('0x48')]=function(_0x36b7ad,_0x281f93){var _0x27602b={'raw':![],'where':{'id':_0x36b7ad[_0xa72f('0x49')]['id']},'include':[{'model':db[_0xa72f('0x2d')],'as':_0xa72f('0x2e')}]},_0x57bca0={};_0x57bca0[_0xa72f('0x31')]=_[_0xa72f('0x32')](db[_0xa72f('0x45')][_0xa72f('0x30')]);_0x57bca0[_0xa72f('0x33')]=_['keys'](_0x36b7ad['query']);_0x57bca0[_0xa72f('0x34')]=_['intersection'](_0x57bca0[_0xa72f('0x31')],_0x57bca0[_0xa72f('0x33')]);_0x27602b[_0xa72f('0x37')]=_['intersection'](_0x57bca0[_0xa72f('0x31')],qs[_0xa72f('0x36')](_0x36b7ad['query'][_0xa72f('0x36')]));_0x27602b[_0xa72f('0x37')]=_0x27602b[_0xa72f('0x37')]['length']?_0x27602b[_0xa72f('0x37')]:_0x57bca0['model'];if(_0x36b7ad[_0xa72f('0x33')]['includeAll']){_0x27602b[_0xa72f('0x44')]=[{'all':!![]}];}_0x27602b=_[_0xa72f('0x40')]({},_0x27602b,_0x36b7ad[_0xa72f('0x42')]);return db['ChatWebsite'][_0xa72f('0x4a')](_0x27602b)[_0xa72f('0x11')](handleEntityNotFound(_0x281f93,null))[_0xa72f('0x11')](respondWithResult(_0x281f93,null))['catch'](handleError(_0x281f93,null));};exports[_0xa72f('0x4b')]=function(_0x5a13d,_0x4296a3){return db['ChatWebsite'][_0xa72f('0x4b')](_0x5a13d['body'],{})[_0xa72f('0x11')](function(_0x5f0ae1){var _0x314970=_0x5a13d['user'][_0xa72f('0x28')]({'plain':!![]});if(!_0x314970)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x314970[_0xa72f('0x4c')]===_0xa72f('0x4d')){var _0x5ca609=_0x5f0ae1[_0xa72f('0x28')]({'plain':!![]});var _0x46c447=_0xa72f('0x4e');return db[_0xa72f('0x4f')][_0xa72f('0x4a')]({'where':{'name':_0x46c447,'userProfileId':_0x314970['userProfileId']},'raw':!![]})[_0xa72f('0x11')](function(_0x2b53b3){if(_0x2b53b3&&_0x2b53b3[_0xa72f('0x50')]===0x0){return db[_0xa72f('0x29')][_0xa72f('0x4b')]({'name':_0x5ca609[_0xa72f('0x2b')],'resourceId':_0x5ca609['id'],'type':_0x2b53b3[_0xa72f('0x2b')],'sectionId':_0x2b53b3['id']},{})[_0xa72f('0x11')](function(){return _0x5f0ae1;});}else{return _0x5f0ae1;}})['catch'](function(_0x5651bb){logger[_0xa72f('0x18')](_0xa72f('0x51'),_0x5651bb);throw _0x5651bb;});}return _0x5f0ae1;})[_0xa72f('0x11')](respondWithResult(_0x4296a3,0xc9))['catch'](handleError(_0x4296a3,null));};exports[_0xa72f('0x27')]=function(_0x4af94a,_0x2c6371){if(_0x4af94a[_0xa72f('0x52')]['id']){delete _0x4af94a['body']['id'];}return db[_0xa72f('0x45')]['find']({'where':{'id':_0x4af94a['params']['id']},'include':[{'model':db[_0xa72f('0x2d')],'as':_0xa72f('0x2e')}]})[_0xa72f('0x11')](handleEntityNotFound(_0x2c6371,null))['then'](saveUpdates(_0x4af94a[_0xa72f('0x52')],null))['then'](respondWithResult(_0x2c6371,null))[_0xa72f('0x1c')](handleError(_0x2c6371,null));};exports[_0xa72f('0x53')]=function(_0x1ab76f,_0x2bc4ef){return db['ChatWebsite']['find']({'where':{'id':_0x1ab76f['params']['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x2bc4ef,null))['then'](removeEntity(_0x2bc4ef,null))[_0xa72f('0x1c')](handleError(_0x2bc4ef,null));};exports[_0xa72f('0x54')]=function(_0x60d236,_0x27f842){return db[_0xa72f('0x45')][_0xa72f('0x54')]()[_0xa72f('0x11')](respondWithResult(_0x27f842,null))['catch'](handleError(_0x27f842,null));};exports[_0xa72f('0x55')]=function(_0x4ae18f,_0x2dcb68){if(_0x4ae18f['body']['id']){delete _0x4ae18f['body']['id'];}return db['ChatWebsite'][_0xa72f('0x4a')]({'where':{'id':_0x4ae18f[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x2dcb68,null))[_0xa72f('0x11')](function(_0x41fb67){if(_0x41fb67){_0x4ae18f[_0xa72f('0x52')][_0xa72f('0x56')]=_0x41fb67['id'];return db[_0xa72f('0x57')]['create'](_0x4ae18f['body']);}})[_0xa72f('0x11')](respondWithResult(_0x2dcb68,null))[_0xa72f('0x1c')](handleError(_0x2dcb68,null));};exports['getDispositions']=function(_0x41dd07,_0x41c661){var _0x206065={'raw':![],'where':{}};var _0x2d85a0={};var _0x188de6={'count':0x0,'rows':[]};return db[_0xa72f('0x45')][_0xa72f('0x58')]({'where':{'id':_0x41dd07[_0xa72f('0x49')]['id']}})['then'](handleEntityNotFound(_0x41c661,null))['then'](function(_0x2b95e2){if(_0x2b95e2){_0x2d85a0['model']=_['keys'](db[_0xa72f('0x57')][_0xa72f('0x30')]);_0x2d85a0[_0xa72f('0x33')]=_[_0xa72f('0x32')](_0x41dd07[_0xa72f('0x33')]);_0x2d85a0[_0xa72f('0x34')]=_[_0xa72f('0x35')](_0x2d85a0[_0xa72f('0x31')],_0x2d85a0[_0xa72f('0x33')]);_0x206065['attributes']=_[_0xa72f('0x35')](_0x2d85a0[_0xa72f('0x31')],qs[_0xa72f('0x36')](_0x41dd07[_0xa72f('0x33')][_0xa72f('0x36')]));_0x206065[_0xa72f('0x37')]=_0x206065[_0xa72f('0x37')][_0xa72f('0x38')]?_0x206065[_0xa72f('0x37')]:_0x2d85a0[_0xa72f('0x31')];if(!_0x41dd07['query'][_0xa72f('0x39')](_0xa72f('0x3a'))){_0x206065[_0xa72f('0x24')]=qs[_0xa72f('0x24')](_0x41dd07[_0xa72f('0x33')]['limit']);_0x206065[_0xa72f('0x21')]=qs[_0xa72f('0x21')](_0x41dd07[_0xa72f('0x33')][_0xa72f('0x21')]);}_0x206065[_0xa72f('0x3b')]=qs[_0xa72f('0x3c')](_0x41dd07[_0xa72f('0x33')][_0xa72f('0x3c')]);_0x206065[_0xa72f('0x3d')]=qs[_0xa72f('0x34')](_[_0xa72f('0x3e')](_0x41dd07[_0xa72f('0x33')],_0x2d85a0[_0xa72f('0x34')]));_0x206065['where'][_0xa72f('0x56')]=_0x2b95e2['id'];if(_0x41dd07[_0xa72f('0x33')][_0xa72f('0x3f')]){_0x206065['where']=_[_0xa72f('0x40')](_0x206065[_0xa72f('0x3d')],{'$or':_[_0xa72f('0x2f')](_0x206065['attributes'],function(_0x5e7a1e){var _0x152daf={};_0x152daf[_0x5e7a1e]={'$like':'%'+_0x41dd07[_0xa72f('0x33')][_0xa72f('0x3f')]+'%'};return _0x152daf;})});}_0x206065=_[_0xa72f('0x40')]({},_0x206065,_0x41dd07[_0xa72f('0x42')]);return db[_0xa72f('0x57')]['count']({'where':_0x206065[_0xa72f('0x3d')]})[_0xa72f('0x11')](function(_0x44328d){_0x188de6[_0xa72f('0x23')]=_0x44328d;if(_0x41dd07['query'][_0xa72f('0x43')]){_0x206065[_0xa72f('0x44')]=[{'all':!![]}];}return db[_0xa72f('0x57')][_0xa72f('0x46')](_0x206065);})['then'](function(_0x124c03){_0x188de6['rows']=_0x124c03;return _0x188de6;});}})[_0xa72f('0x11')](respondWithFilteredResult(_0x41c661,_0x206065))['catch'](handleError(_0x41c661,null));};exports[_0xa72f('0x59')]=function(_0x5bbb83,_0x4e002d){return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x5bbb83['params']['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x4e002d,null))[_0xa72f('0x11')](function(_0x15e73d){if(_0x15e73d){return _0x15e73d[_0xa72f('0x59')](_0x5bbb83[_0xa72f('0x33')][_0xa72f('0x5a')]);}})['then'](respondWithStatusCode(_0x4e002d,null))[_0xa72f('0x1c')](handleError(_0x4e002d,null));};exports[_0xa72f('0x5b')]=function(_0x24f1a2,_0x42cb06){if(_0x24f1a2[_0xa72f('0x52')]['id']){delete _0x24f1a2[_0xa72f('0x52')]['id'];}return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x24f1a2[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x42cb06,null))[_0xa72f('0x11')](function(_0x3fe045){if(_0x3fe045){_0x24f1a2[_0xa72f('0x52')][_0xa72f('0x56')]=_0x3fe045['id'];return db['CannedAnswer'][_0xa72f('0x4b')](_0x24f1a2[_0xa72f('0x52')]);}})[_0xa72f('0x11')](respondWithResult(_0x42cb06,null))[_0xa72f('0x1c')](handleError(_0x42cb06,null));};exports[_0xa72f('0x5c')]=function(_0x2210b7,_0x266e49){var _0x361102={'raw':![],'where':{}};var _0x309e65={};var _0x678dfe={'count':0x0,'rows':[]};return db[_0xa72f('0x45')]['findOne']({'where':{'id':_0x2210b7[_0xa72f('0x49')]['id']}})['then'](handleEntityNotFound(_0x266e49,null))[_0xa72f('0x11')](function(_0x3a7045){if(_0x3a7045){_0x309e65[_0xa72f('0x31')]=_['keys'](db[_0xa72f('0x5d')]['rawAttributes']);_0x309e65[_0xa72f('0x33')]=_[_0xa72f('0x32')](_0x2210b7['query']);_0x309e65[_0xa72f('0x34')]=_['intersection'](_0x309e65[_0xa72f('0x31')],_0x309e65[_0xa72f('0x33')]);_0x361102[_0xa72f('0x37')]=_[_0xa72f('0x35')](_0x309e65[_0xa72f('0x31')],qs['fields'](_0x2210b7['query'][_0xa72f('0x36')]));_0x361102[_0xa72f('0x37')]=_0x361102[_0xa72f('0x37')][_0xa72f('0x38')]?_0x361102[_0xa72f('0x37')]:_0x309e65[_0xa72f('0x31')];if(!_0x2210b7[_0xa72f('0x33')][_0xa72f('0x39')](_0xa72f('0x3a'))){_0x361102[_0xa72f('0x24')]=qs[_0xa72f('0x24')](_0x2210b7[_0xa72f('0x33')]['limit']);_0x361102[_0xa72f('0x21')]=qs[_0xa72f('0x21')](_0x2210b7[_0xa72f('0x33')][_0xa72f('0x21')]);}_0x361102[_0xa72f('0x3b')]=qs[_0xa72f('0x3c')](_0x2210b7['query'][_0xa72f('0x3c')]);_0x361102[_0xa72f('0x3d')]=qs['filters'](_[_0xa72f('0x3e')](_0x2210b7[_0xa72f('0x33')],_0x309e65[_0xa72f('0x34')]));_0x361102[_0xa72f('0x3d')]['ChatWebsiteId']=_0x3a7045['id'];if(_0x2210b7[_0xa72f('0x33')][_0xa72f('0x3f')]){_0x361102[_0xa72f('0x3d')]=_[_0xa72f('0x40')](_0x361102['where'],{'$or':_[_0xa72f('0x2f')](_0x361102[_0xa72f('0x37')],function(_0x2078e0){var _0x11c971={};_0x11c971[_0x2078e0]={'$like':'%'+_0x2210b7[_0xa72f('0x33')][_0xa72f('0x3f')]+'%'};return _0x11c971;})});}_0x361102=_[_0xa72f('0x40')]({},_0x361102,_0x2210b7[_0xa72f('0x42')]);return db[_0xa72f('0x5d')]['count']({'where':_0x361102[_0xa72f('0x3d')]})['then'](function(_0x105932){_0x678dfe['count']=_0x105932;if(_0x2210b7[_0xa72f('0x33')][_0xa72f('0x43')]){_0x361102[_0xa72f('0x44')]=[{'all':!![]}];}return db[_0xa72f('0x5d')]['findAll'](_0x361102);})[_0xa72f('0x11')](function(_0x32d9ee){_0x678dfe[_0xa72f('0x47')]=_0x32d9ee;return _0x678dfe;});}})[_0xa72f('0x11')](respondWithFilteredResult(_0x266e49,_0x361102))['catch'](handleError(_0x266e49,null));};exports[_0xa72f('0x5e')]=function(_0x39a024,_0x47f7df){return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x39a024[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x47f7df,null))[_0xa72f('0x11')](function(_0x566d4d){if(_0x566d4d){return _0x566d4d[_0xa72f('0x5e')](_0x39a024[_0xa72f('0x33')]['ids']);}})[_0xa72f('0x11')](respondWithStatusCode(_0x47f7df,null))[_0xa72f('0x1c')](handleError(_0x47f7df,null));};exports[_0xa72f('0x5f')]=function(_0x3737fd,_0x3614c4){_0x3737fd['body'][_0xa72f('0x60')]=_0x3737fd['file'][_0xa72f('0x61')];return db[_0xa72f('0x45')]['find']({'where':{'id':_0x3737fd[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x3614c4,null))['then'](saveUpdates(_0x3737fd[_0xa72f('0x52')],null))[_0xa72f('0x11')](respondWithResult(_0x3614c4,null))[_0xa72f('0x1c')](handleError(_0x3614c4,null));};exports[_0xa72f('0x62')]=function(_0x4bd077,_0x54b94d){_0x4bd077[_0xa72f('0x52')][_0xa72f('0x63')]=_0x4bd077[_0xa72f('0x64')][_0xa72f('0x61')];return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x4bd077[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x54b94d,null))[_0xa72f('0x11')](saveUpdates(_0x4bd077['body'],null))['then'](respondWithResult(_0x54b94d,null))[_0xa72f('0x1c')](handleError(_0x54b94d,null));};exports[_0xa72f('0x65')]=function(_0x52fc76,_0x111f58){_0x52fc76['body'][_0xa72f('0x66')]=_0x52fc76[_0xa72f('0x64')][_0xa72f('0x61')];return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x52fc76[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x111f58,null))[_0xa72f('0x11')](saveUpdates(_0x52fc76['body'],null))['then'](respondWithResult(_0x111f58,null))['catch'](handleError(_0x111f58,null));};exports[_0xa72f('0x67')]=function(_0x42f5f5,_0x1081b7){_0x42f5f5[_0xa72f('0x52')]['systemAvatar']=_0x42f5f5['file'][_0xa72f('0x61')];return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x42f5f5[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x1081b7,null))[_0xa72f('0x11')](saveUpdates(_0x42f5f5[_0xa72f('0x52')],null))[_0xa72f('0x11')](respondWithResult(_0x1081b7,null))[_0xa72f('0x1c')](handleError(_0x1081b7,null));};exports['getLogo']=function(_0x15f30c,_0x4cd182){var _0x4194b5=path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0x6a'));var _0xb1560b={'where':{'id':_0x15f30c[_0xa72f('0x49')]['id']},'attributes':['id',_0xa72f('0x60')],'raw':!![]};var _0x1e2dc0=![];return require('../../config/license/util')[_0xa72f('0x6b')]()[_0xa72f('0x11')](function(_0x3be9ca){if(_0x3be9ca){_0x1e2dc0=_0x3be9ca[_0xa72f('0x6c')];}})['then'](function(){return db['ChatWebsite'][_0xa72f('0x4a')](_0xb1560b);})[_0xa72f('0x11')](handleEntityNotFound(_0x4cd182,null))[_0xa72f('0x11')](function(_0x99b31a){if(_0x99b31a){if(!_[_0xa72f('0x6d')](_0x99b31a[_0xa72f('0x60')])){if(fs[_0xa72f('0x6e')](path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0x6f'),_0x99b31a[_0xa72f('0x60')]))&&_0x1e2dc0){_0x4194b5=path['join'](config['root'],_0xa72f('0x6f'),_0x99b31a['sitepic']);}}return _0x4cd182['download'](_0x4194b5);}})['catch'](handleError(_0x4cd182,null));};exports[_0xa72f('0x70')]=function(_0x2e4980,_0x6a5aa8){var _0x2ee335=path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0x71'));var _0x11f8b2={'where':{'id':_0x2e4980[_0xa72f('0x49')]['id']},'attributes':['id',_0xa72f('0x63')],'raw':!![]};return db['ChatWebsite']['find'](_0x11f8b2)[_0xa72f('0x11')](handleEntityNotFound(_0x6a5aa8,null))[_0xa72f('0x11')](function(_0xae839b){if(_0xae839b){if(!_[_0xa72f('0x6d')](_0xae839b[_0xa72f('0x63')])){if(fs[_0xa72f('0x6e')](path[_0xa72f('0x68')](config['root'],_0xa72f('0x72'),_0xae839b[_0xa72f('0x63')]))){_0x2ee335=path[_0xa72f('0x68')](config['root'],_0xa72f('0x72'),_0xae839b[_0xa72f('0x63')]);}}return _0x6a5aa8[_0xa72f('0x73')](_0x2ee335);}})[_0xa72f('0x1c')](handleError(_0x6a5aa8,null));};exports['getCustomerAvatar']=function(_0x49865e,_0x47626e){var _0x156466=path['join'](config['root'],_0xa72f('0x74'));var _0x5c435b={'where':{'id':_0x49865e[_0xa72f('0x49')]['id']},'attributes':['id','customerAvatar',_0xa72f('0x75')],'raw':!![]};return db[_0xa72f('0x45')][_0xa72f('0x4a')](_0x5c435b)['then'](handleEntityNotFound(_0x47626e,null))[_0xa72f('0x11')](function(_0x26521b){if(_0x26521b){if(!_[_0xa72f('0x6d')](_0x26521b[_0xa72f('0x66')])){if(fs[_0xa72f('0x6e')](path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0x72'),_0x26521b[_0xa72f('0x66')]))&&_0x26521b[_0xa72f('0x75')]){_0x156466=path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0x72'),_0x26521b[_0xa72f('0x66')]);}}return _0x47626e[_0xa72f('0x73')](_0x156466);}})['catch'](handleError(_0x47626e,null));};exports[_0xa72f('0x76')]=function(_0x43bbc8,_0x5a2923){var _0x379626=path[_0xa72f('0x68')](config[_0xa72f('0x69')],'server/files/images/avatars/system_avatar.png');var _0x314084={'where':{'id':_0x43bbc8['params']['id']},'attributes':['id',_0xa72f('0x77')],'raw':!![]};return db[_0xa72f('0x45')][_0xa72f('0x4a')](_0x314084)[_0xa72f('0x11')](handleEntityNotFound(_0x5a2923,null))[_0xa72f('0x11')](function(_0x5210b6){if(_0x5210b6){if(!_[_0xa72f('0x6d')](_0x5210b6['systemAvatar'])){if(fs[_0xa72f('0x6e')](path[_0xa72f('0x68')](config['root'],_0xa72f('0x72'),_0x5210b6[_0xa72f('0x77')]))){_0x379626=path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0x72'),_0x5210b6[_0xa72f('0x77')]);}}return _0x5a2923[_0xa72f('0x73')](_0x379626);}})[_0xa72f('0x1c')](handleError(_0x5a2923,null));};exports['notify']=function(_0x2973bc,_0x48b2c2){var _0x5c5327=require(_0xa72f('0x78'));var _0x2c5544=new _0x5c5327();var _0x10ee55=_0x2c5544[_0xa72f('0x79')](_0x2973bc[_0xa72f('0x7a')][_0xa72f('0x7b')])['getResult']();var _0xe85fc7={'body':_0x2973bc[_0xa72f('0x52')],'channel':'chat'};var _0x45510b=[];var _0x402b27=[];var _0x4feb58={};var _0x4d300b=![];return db[_0xa72f('0x7c')]['describe']()[_0xa72f('0x11')](function(_0x2be75c){if(!_0x2be75c){throw new db[(_0xa72f('0x7d'))]['ValidationError'](_0xa72f('0x7e'));}_0x45510b=_[_0xa72f('0x7f')](_[_0xa72f('0x32')](_0x2be75c),[_0xa72f('0x80'),'updatedAt']);_0x402b27=_[_0xa72f('0x7f')](_[_0xa72f('0x32')](_0x2be75c),[_0xa72f('0x80'),_0xa72f('0x81'),'CompanyId',_0xa72f('0x82')]);if(_0x2973bc[_0xa72f('0x52')]['id']){delete _0x2973bc['body']['id'];}if(_[_0xa72f('0x6d')](_0x2973bc[_0xa72f('0x52')][_0xa72f('0x83')])){throw new db[(_0xa72f('0x7d'))][(_0xa72f('0x84'))]('from\x20is\x20mandatory');}if(_[_0xa72f('0x6d')](_0x2973bc[_0xa72f('0x52')][_0xa72f('0x52')])||_0x2973bc[_0xa72f('0x52')][_0xa72f('0x52')]===''){throw new db[(_0xa72f('0x7d'))][(_0xa72f('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa72f('0x6d')](_0x2973bc[_0xa72f('0x52')][_0xa72f('0x85')])){throw new db[(_0xa72f('0x7d'))]['ValidationError'](_0xa72f('0x86')+_0x402b27);}if(!_[_0xa72f('0x87')](_0x402b27,_0x2973bc[_0xa72f('0x52')][_0xa72f('0x85')])){throw new db['Sequelize'][(_0xa72f('0x84'))](_0xa72f('0x88')+_0x402b27);}_0x4feb58[_0x2973bc[_0xa72f('0x52')]['mapKey']]=_0x2973bc[_0xa72f('0x52')]['from'];})[_0xa72f('0x11')](function(){return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x2973bc[_0xa72f('0x49')]['id']},'include':[{'model':db[_0xa72f('0x89')],'as':_0xa72f('0x8a'),'include':[{'model':db[_0xa72f('0x7c')],'as':_0xa72f('0x8b'),'where':_0x4feb58,'limit':0x1,'order':[['updatedAt',_0xa72f('0x8c')]]}]},{'model':db[_0xa72f('0x8d')],'as':_0xa72f('0x8e')}]});})['then'](handleEntityNotFound(_0x48b2c2,null))[_0xa72f('0x11')](function(_0x2a2383){if(_0x2a2383&&_0x2a2383[_0xa72f('0x8a')]){_0xe85fc7[_0xa72f('0x8f')]=_0x2a2383;_0xe85fc7[_0xa72f('0x90')]=_0x2a2383[_0xa72f('0x8e')];_0xe85fc7[_0xa72f('0x91')]=_0x2a2383['List'];_0xe85fc7[_0xa72f('0x90')]=_[_0xa72f('0x92')](_0xe85fc7['applications'],['priority'],[_0xa72f('0x93')]);if(_0xe85fc7[_0xa72f('0x8f')][_0xa72f('0x8e')]){delete _0xe85fc7[_0xa72f('0x8f')]['Applications'];}if(_0xe85fc7[_0xa72f('0x8f')][_0xa72f('0x8a')]&&_0xe85fc7[_0xa72f('0x8f')][_0xa72f('0x8a')][_0xa72f('0x8b')][_0xa72f('0x38')]){return _0xe85fc7[_0xa72f('0x8f')][_0xa72f('0x8a')]['Contacts'][0x0];}var _0x3d741b=_[_0xa72f('0x9')](_0x2973bc[_0xa72f('0x52')],{'firstName':_0x2973bc['body'][_0xa72f('0x83')],'ListId':_0x2a2383['ListId']});_0x3d741b[_0x2973bc[_0xa72f('0x52')][_0xa72f('0x85')]]=_0x2973bc[_0xa72f('0x52')][_0xa72f('0x83')];return db[_0xa72f('0x7c')][_0xa72f('0x4b')](_0x3d741b,{'fields':_0x45510b,'raw':!![]});}})[_0xa72f('0x11')](handleEntityNotFound(_0x48b2c2,null))[_0xa72f('0x11')](function(_0x3ea7bf){_0xe85fc7[_0xa72f('0x94')]=_0x3ea7bf;var _0x460dc3=_0x2973bc['body']['customerIp'];if(_0x2973bc[_0xa72f('0x7a')][_0xa72f('0x95')]){_0x460dc3=_0x2973bc[_0xa72f('0x7a')][_0xa72f('0x95')];}else if(_0x2973bc['headers'][_0xa72f('0x96')]){_0x460dc3=_[_0xa72f('0x97')](_0x2973bc[_0xa72f('0x7a')][_0xa72f('0x96')][_0xa72f('0x98')](','));}if(_0x3ea7bf){var _0x34a7be={'ContactId':_0x3ea7bf['id'],'ChatWebsiteId':_0x2973bc[_0xa72f('0x49')]['id'],'from':(_0x3ea7bf[_0xa72f('0x99')]||'')+'\x20'+(_0x3ea7bf[_0xa72f('0x9a')]||''),'customerIp':_0x460dc3,'customerPort':_0x2973bc[_0xa72f('0x7a')]['x-real-port']?_0x2973bc[_0xa72f('0x7a')][_0xa72f('0x9b')]:null,'referer':_0x2973bc['body'][_0xa72f('0x9c')],'browserName':_0x10ee55[_0xa72f('0x9d')][_0xa72f('0x2b')]&&_0x10ee55['browser'][_0xa72f('0x9e')]?util[_0xa72f('0x9f')](_0xa72f('0xa0'),_0x10ee55['browser'][_0xa72f('0x2b')],_0x10ee55[_0xa72f('0x9d')][_0xa72f('0x9e')]):_0xa72f('0xa1'),'browserVersion':_0x10ee55['browser']['version']||_0xa72f('0xa1'),'osName':util[_0xa72f('0x9f')](_0xa72f('0xa0'),_0x10ee55['os'][_0xa72f('0x2b')],_0x10ee55['os'][_0xa72f('0x9e')]),'osVersion':_0x10ee55['os'][_0xa72f('0x9e')],'deviceModel':_0x10ee55[_0xa72f('0xa2')]['model']&&_0x10ee55[_0xa72f('0xa2')]['vendor']?util[_0xa72f('0x9f')](_0xa72f('0xa3'),_0x10ee55[_0xa72f('0xa2')][_0xa72f('0x31')],_0x10ee55['device'][_0xa72f('0xa4')],_0x10ee55[_0xa72f('0xa2')][_0xa72f('0x41')]):null,'deviceVendor':_0x10ee55[_0xa72f('0xa2')][_0xa72f('0xa4')],'deviceType':_0x10ee55[_0xa72f('0xa2')]['type'],'formData':JSON[_0xa72f('0x17')](_0x2973bc['body'])};var _0x4f86a5={'ChatWebsiteId':_0x2973bc[_0xa72f('0x49')]['id'],'closed':![]};if(_0x2973bc[_0xa72f('0x52')][_0xa72f('0xa5')]){_0x4f86a5[_0xa72f('0xa5')]=_0x2973bc['body'][_0xa72f('0xa5')];return db[_0xa72f('0xa6')]['find']({'where':_0x4f86a5})[_0xa72f('0x11')](function(_0x3f2714){if(_0x3f2714){return[_0x3f2714,![]];}_0x34a7be[_0xa72f('0xa5')]=_0x2973bc[_0xa72f('0x52')][_0xa72f('0xa5')];_0x34a7be[_0xa72f('0xa7')]=_0x2973bc[_0xa72f('0x52')][_0xa72f('0xa7')];return db['ChatInteraction'][_0xa72f('0x4b')](_0x34a7be)['then'](function(_0x3bedf4){return[_0x3bedf4,!![]];});});}_0x4f86a5[_0xa72f('0xa8')]=_0x3ea7bf['id'];if(_0x2973bc[_0xa72f('0x52')]['interaction']&&_0x2973bc[_0xa72f('0x52')]['interaction']['id']){_0x4f86a5['id']=_0x2973bc['body'][_0xa72f('0xa9')]['id'];return db[_0xa72f('0xa6')][_0xa72f('0x4a')]({'where':_0x4f86a5})['then'](function(_0x1c3c47){if(_0x1c3c47){return[_0x1c3c47,![]];}return db['ChatInteraction'][_0xa72f('0x4b')](_0x34a7be)[_0xa72f('0x11')](function(_0x222765){return[_0x222765,!![]];});});}return db[_0xa72f('0xa6')]['create'](_0x34a7be)[_0xa72f('0x11')](function(_0x2acb5f){return[_0x2acb5f,!![]];});}})[_0xa72f('0xaa')](function(_0xda96b5,_0x2da22e){if(_0xda96b5){_0x4d300b=_0x2da22e;if(!_0x2da22e){var _0xe8f4f={'from':(_0xe85fc7[_0xa72f('0x94')]['firstName']||'')+'\x20'+(_0xe85fc7[_0xa72f('0x94')][_0xa72f('0x9a')]||'')};if(_0x2973bc[_0xa72f('0x52')][_0xa72f('0xa5')]&&_0x2973bc[_0xa72f('0x52')]['messageId']&&_0x2973bc[_0xa72f('0x52')][_0xa72f('0xa5')]!=_0x2973bc[_0xa72f('0x52')][_0xa72f('0xab')]){_0xe8f4f[_0xa72f('0xa5')]=_0x2973bc['body'][_0xa72f('0xab')];}return _0xda96b5[_0xa72f('0x27')](_0xe8f4f);}else{return _0xda96b5;}}})[_0xa72f('0x11')](function(_0x1cbecc){_0xe85fc7[_0xa72f('0xa9')]=_0x1cbecc[_0xa72f('0x28')]({'plain':!![]});_0xe85fc7[_0xa72f('0xa9')]['created']=_0x4d300b;if(_0xe85fc7[_0xa72f('0xa9')][_0xa72f('0xac')]){if(_0xe85fc7[_0xa72f('0x8f')][_0xa72f('0xad')]){_0xe85fc7[_0xa72f('0x90')][_0xa72f('0xae')]({'id':0x0,'priority':_0xe85fc7[_0xa72f('0x90')][_0xa72f('0x38')]+0x1,'app':'close','appdata':_0xa72f('0xaf'),'interval':_0xa72f('0xb0')});}}return db['ChatMessage'][_0xa72f('0x4b')]({'body':_0x2973bc[_0xa72f('0x52')][_0xa72f('0x52')],'ChatWebsiteId':_0x2973bc[_0xa72f('0x49')]['id'],'ChatInteractionId':_0x1cbecc['id'],'direction':'in','ContactId':_0xe85fc7['contact']['id'],'AttachmentId':_0x2973bc[_0xa72f('0x52')][_0xa72f('0xb1')]});})[_0xa72f('0x11')](function(_0x1f8e55){_0xe85fc7[_0xa72f('0x1a')]=_0x1f8e55;if(_0xe85fc7['interaction'][_0xa72f('0xb2')]){return db[_0xa72f('0xb3')][_0xa72f('0x4a')]({'attributes':['id',_0xa72f('0x2b')],'where':{'id':_0xe85fc7[_0xa72f('0xa9')]['UserId']}})[_0xa72f('0x11')](function(_0x1893e4){if(_0x1893e4){_0xe85fc7[_0xa72f('0x90')][_0xa72f('0xb4')]({'id':0x0,'priority':0x0,'app':_0xa72f('0xb5'),'appdata':_0x1893e4[_0xa72f('0x2b')]+','+(_0xe85fc7[_0xa72f('0x8f')][_0xa72f('0xb6')]||0xa),'interval':_0xa72f('0xb0')});_0xe85fc7[_0xa72f('0xb7')]=!![];}return respondWithRpcPromise(_0xa72f('0xb8'),_0xa72f('0xb9'),_0xe85fc7);});}return respondWithRpcPromise(_0xa72f('0xb8'),'startRouting',_0xe85fc7);})[_0xa72f('0x11')](function(_0x5d676c){respondWithRpcPromise(_0xa72f('0xba'),'EventManager',{'event':'notify','message':_0x5d676c},client9002);return _0x5d676c;})[_0xa72f('0x11')](respondWithResult(_0x48b2c2,null))[_0xa72f('0x1c')](handleError(_0x48b2c2,null));};exports[_0xa72f('0xbb')]=function(_0xdd1ece,_0x165151){var _0x65f6f4,_0x493929,_0x5d070c;var _0x11c827=[];var _0x22d729={};var _0x48b7f6=_0xdd1ece[_0xa72f('0xbc')]||[];var _0x588239=[];var _0x3ad099;return db[_0xa72f('0x7c')]['describe']()[_0xa72f('0x11')](function(_0xc78a90){if(!_0xc78a90){throw new db[(_0xa72f('0x7d'))]['ValidationError'](_0xa72f('0x7e'));}_0x11c827=_[_0xa72f('0x7f')](_['keys'](_0xc78a90),[_0xa72f('0x80'),_0xa72f('0x81'),'CompanyId',_0xa72f('0x82')]);if(_0xdd1ece[_0xa72f('0x52')]['id']){delete _0xdd1ece['body']['id'];}if(_[_0xa72f('0x6d')](_0xdd1ece[_0xa72f('0x52')]['from'])){throw _0x165151[_0xa72f('0x1e')](0x1f4)['send'](new db[(_0xa72f('0x7d'))][(_0xa72f('0x84'))]('from\x20is\x20mandatory'));}if(_[_0xa72f('0x6d')](_0xdd1ece[_0xa72f('0x52')][_0xa72f('0x52')])||_0xdd1ece[_0xa72f('0x52')]['body']===''){throw _0x165151[_0xa72f('0x1e')](0x1f4)[_0xa72f('0xbd')](new db['Sequelize']['ValidationError'](_0xa72f('0xbe')));}if(_[_0xa72f('0x6d')](_0xdd1ece['body'][_0xa72f('0xbf')])){throw _0x165151[_0xa72f('0x1e')](0x1f4)[_0xa72f('0xbd')](new db[(_0xa72f('0x7d'))][(_0xa72f('0x84'))](_0xa72f('0xc0')+_0x11c827));}if(!_[_0xa72f('0x87')](_0x11c827,_0xdd1ece[_0xa72f('0x52')][_0xa72f('0xbf')])){throw _0x165151[_0xa72f('0x1e')](0x1f4)[_0xa72f('0xbd')](new db['Sequelize']['ValidationError'](_0xa72f('0xc1')+_0x11c827));}_0x22d729[_0xdd1ece[_0xa72f('0x52')][_0xa72f('0xbf')]]=_0xdd1ece['body'][_0xa72f('0x83')];})[_0xa72f('0x11')](function(){return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0xdd1ece[_0xa72f('0x49')]['id']},'include':[{'model':db[_0xa72f('0x89')],'as':'List'},{'model':db[_0xa72f('0xc2')],'as':_0xa72f('0xc2')}]});})['then'](handleEntityNotFound(_0x165151,null))['then'](function(_0x1a23ee){if(_0x1a23ee&&_0x1a23ee[_0xa72f('0x8a')]){_0x493929=_0x1a23ee;var _0x25094a=_[_0xa72f('0x9')](_0xdd1ece[_0xa72f('0x52')],{'firstName':_0xdd1ece[_0xa72f('0x52')]['from'],'phone':_0xdd1ece[_0xa72f('0x52')][_0xa72f('0x83')],'ListId':_0x1a23ee[_0xa72f('0x82')]});_0x25094a[_0xdd1ece[_0xa72f('0x52')][_0xa72f('0xbf')]]=_0xdd1ece[_0xa72f('0x52')][_0xa72f('0x83')];return db['CmContact']['findOrCreate']({'where':_0x22d729,'defaults':_0x25094a});}})['spread'](function(_0xc3b93d){if(_0xc3b93d){_0x5d070c=_0xc3b93d;var _0x5161dd=fs[_0xa72f('0xc3')](path['join'](config['root'],_0xa72f('0xc4')),_0xa72f('0xc5'));var _0x23a020=ejs[_0xa72f('0xc6')](_0x5161dd,{'body':_['toPairs'](_0xdd1ece[_0xa72f('0x52')]['body']),'bodyTitle':_0x493929[_0xa72f('0xc7')]});return db[_0xa72f('0xc8')]['create']({'body':_0x23a020,'plainBody':htmlToText['fromString'](_0x23a020),'ContactId':_0xc3b93d['id'],'ChatWebsiteId':_0x493929['id']});}})[_0xa72f('0x11')](function(_0x4fff3a){_0x3ad099=_0x4fff3a;if(_0x48b7f6[_0xa72f('0x38')]){var _0x457897=_0x48b7f6[_0xa72f('0x2f')](function(_0x41b6e7){return{'name':_0x41b6e7[_0xa72f('0xc9')],'basename':_0x41b6e7['filename'],'type':_0x41b6e7[_0xa72f('0xca')],'ChatOfflineMessageId':_0x4fff3a['id']};});_0x588239=_0x457897['map'](_0x55bddf=>{var _0x5e1937={'filename':_0x55bddf[_0xa72f('0x2b')],'path':path[_0xa72f('0x68')](config['root'],_0xa72f('0xcb'),'files',_0xa72f('0xcc'),'offline-chat',_0x55bddf[_0xa72f('0xcd')])};return _0x5e1937;});if(!_0x493929[_0xa72f('0xce')]){return db['sequelize'][_0xa72f('0xcf')](function(_0x52ca6e){return db[_0xa72f('0xd0')][_0xa72f('0xd1')](_0x457897,{'transaction':_0x52ca6e});});}}})[_0xa72f('0x11')](function(){if(_0x3ad099){_0x65f6f4=_0x3ad099;return db[_0xa72f('0xc2')][_0xa72f('0x58')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xa72f('0xd2'),'raw':!![],'include':[{'model':db[_0xa72f('0xd3')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xa72f('0x11')](function(_0x2dc585){if(_0x2dc585&&_0x2dc585[_0xa72f('0xd2')]&&_0x493929[_0xa72f('0xd4')]&&_0x493929['forwardOfflineAddress']){var _0x2b019d=_0x2dc585[_0xa72f('0xd5')]();return respondWithRpcPromise(_0xa72f('0xd6'),_0xa72f('0xd7'),{'account':_0x2b019d,'message':{'from':util[_0xa72f('0x9f')]('\x22%s\x22\x20<%s>',_0x2dc585[_0xa72f('0x2b')],_0x2dc585['email']||_0x2dc585[_0xa72f('0xd2')]['user']),'to':_0x493929[_0xa72f('0xd8')],'subject':_0x493929['offlineMessageSubject'],'html':_0x65f6f4[_0xa72f('0x52')],'attachments':_0x588239}},client9003)[_0xa72f('0x11')](function(){return _0x65f6f4;})[_0xa72f('0x1c')](function(_0x20a458){logger['error'](_0x20a458);});}})['then'](function(){if(_0x493929&&_0x493929[_0xa72f('0xce')]&&_0x493929[_0xa72f('0xd9')]){var _0x2df428=[];if(_0x48b7f6[_0xa72f('0x38')]){_0x2df428=_0x48b7f6[_0xa72f('0x2f')](function(_0xb72bd7){return{'name':_0xb72bd7[_0xa72f('0xc9')],'basename':_0xb72bd7[_0xa72f('0x61')],'type':_0xb72bd7[_0xa72f('0xca')],'ChatOfflineMessageId':_0x3ad099['id']};});}var _0x15b248;if(!_[_0xa72f('0x6d')](_0x493929[_0xa72f('0xda')])){var _0x246e51=_['map'](_0xdd1ece[_0xa72f('0x52')],function(_0xf9fb0d){return _0xf9fb0d;});var _0x1d3182=_[_0xa72f('0xdb')](_0x246e51)[0x0];var _0x875204=_[_0xa72f('0xdc')](_0x1d3182,function(_0x316867){return _0x316867;});_0x15b248=_0x875204[0x1][_0x493929['subjectOffline']];}var _0x23a319={'from':_0x5d070c[_0xa72f('0xdd')],'firstName':_0x5d070c[_0xa72f('0x99')],'lastName':_0x5d070c['lastName'],'mapKey':_0xa72f('0xdd'),'message':{'from':_0x5d070c['email'],'to':_0x493929['MailAccount'][_0xa72f('0xdd')],'cc':'','subject':_[_0xa72f('0x6d')](_0x15b248)?_0x493929[_0xa72f('0xde')]:_0x15b248,'messageId':'','sentAt':new Date(),'attach':_0x2df428[_0xa72f('0x38')],'attachments':_0x2df428,'originChannel':_0xa72f('0xdf'),'ChatWebsiteId':_0x493929['id'],'ChatOfflineMessageId':_0x65f6f4['id'],'originTo':_0x493929[_0xa72f('0xc2')][_0xa72f('0xdd')]},'body':_0x65f6f4[_0xa72f('0x52')]};var _0x285f25={'account':{'id':_0x493929['MailAccountId']},'body':_0x23a319,'log':_0xa72f('0xe0')};return respondWithRpcPromise(_0xa72f('0xe0'),_0xa72f('0xe1'),_0x285f25,client9001)[_0xa72f('0x11')](function(){return _0x65f6f4;})[_0xa72f('0x1c')](function(_0x41ab2d){logger[_0xa72f('0x18')](_0x41ab2d);});}return;})[_0xa72f('0x11')](function(){if(_0x65f6f4){return _0x65f6f4;}})['then'](respondWithResult(_0x165151,null))[_0xa72f('0x1c')](function(_0x3a5fc5){logger[_0xa72f('0x18')](_0xa72f('0x1c'),_0x3a5fc5);for(var _0x4b292f of _0x48b7f6){var _0x997b11=path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0xcb'),_0xa72f('0xbc'),_0xa72f('0xcc'),_0xa72f('0xe2'),_0x4b292f[_0xa72f('0x61')]);fs_extra[_0xa72f('0xe3')](_0x997b11)[_0xa72f('0x1c')](function(_0x2e1d44){logger['error'](_0xa72f('0xe4'),_0x997b11,_0x2e1d44);});}});};exports[_0xa72f('0xe5')]=function(_0x733195,_0x530eea){return db['ChatInteraction'][_0xa72f('0x4a')]({'where':{'id':_0x733195[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x530eea,null))[_0xa72f('0x11')](function(_0x22c8f2){if(_0x22c8f2){return _0x22c8f2[_0xa72f('0xe5')](_0x733195['body'][_0xa72f('0x5a')],_['omit'](_0x733195[_0xa72f('0x52')],['ids','id'])||{});}})[_0xa72f('0x11')](respondWithResult(_0x530eea,null))[_0xa72f('0x1c')](handleError(_0x530eea,null));};exports[_0xa72f('0xe6')]=function(_0x267654,_0x38301f){var _0x2a8838={'raw':![],'where':{}};var _0x55b9b3={};var _0x178c03={'count':0x0,'rows':[]};return db[_0xa72f('0x45')][_0xa72f('0x58')]({'where':{'id':_0x267654['params']['id']}})['then'](handleEntityNotFound(_0x38301f,null))[_0xa72f('0x11')](function(_0x237669){if(_0x237669){_0x55b9b3[_0xa72f('0x31')]=_[_0xa72f('0x32')](db[_0xa72f('0xa6')][_0xa72f('0x30')]);_0x55b9b3[_0xa72f('0x33')]=_[_0xa72f('0x32')](_0x267654[_0xa72f('0x33')]);_0x55b9b3[_0xa72f('0x34')]=_[_0xa72f('0x35')](_0x55b9b3['model'],_0x55b9b3[_0xa72f('0x33')]);_0x2a8838[_0xa72f('0x37')]=_['intersection'](_0x55b9b3['model'],qs['fields'](_0x267654['query']['fields']));_0x2a8838[_0xa72f('0x37')]=_0x2a8838[_0xa72f('0x37')][_0xa72f('0x38')]?_0x2a8838[_0xa72f('0x37')]:_0x55b9b3[_0xa72f('0x31')];if(!_0x267654[_0xa72f('0x33')]['hasOwnProperty'](_0xa72f('0x3a'))){_0x2a8838[_0xa72f('0x24')]=qs['limit'](_0x267654[_0xa72f('0x33')][_0xa72f('0x24')]);_0x2a8838[_0xa72f('0x21')]=qs[_0xa72f('0x21')](_0x267654[_0xa72f('0x33')][_0xa72f('0x21')]);}_0x2a8838[_0xa72f('0x3b')]=qs[_0xa72f('0x3c')](_0x267654[_0xa72f('0x33')]['sort']);_0x2a8838['where']=qs['filters'](_[_0xa72f('0x3e')](_0x267654[_0xa72f('0x33')],_0x55b9b3['filters']));_0x2a8838[_0xa72f('0x3d')][_0xa72f('0x56')]=_0x237669['id'];if(_0x267654['query'][_0xa72f('0x3f')]){_0x2a8838['where']=_['merge'](_0x2a8838[_0xa72f('0x3d')],{'$or':_[_0xa72f('0x2f')](_0x2a8838['attributes'],function(_0x381e05){var _0x2aa517={};_0x2aa517[_0x381e05]={'$like':'%'+_0x267654['query']['filter']+'%'};return _0x2aa517;})});}_0x2a8838=_['merge']({},_0x2a8838,_0x267654[_0xa72f('0x42')]);return db[_0xa72f('0xa6')]['count']({'where':_0x2a8838[_0xa72f('0x3d')]})['then'](function(_0x46e236){_0x178c03[_0xa72f('0x23')]=_0x46e236;if(_0x267654[_0xa72f('0x33')]['includeAll']){_0x2a8838['include']=[{'model':db[_0xa72f('0x7c')],'as':_0xa72f('0xe7'),'required':![]},{'model':db['User'],'as':_0xa72f('0xe8'),'attributes':[_0xa72f('0x2b'),_0xa72f('0xe9'),_0xa72f('0xea')],'required':![]},{'model':db[_0xa72f('0xeb')],'as':'Tags','attributes':['id','name',_0xa72f('0xec')],'where':_0x267654[_0xa72f('0x33')]['tag']?{'id':_0x267654[_0xa72f('0x33')][_0xa72f('0xed')]}:undefined,'required':_0x267654[_0xa72f('0x33')][_0xa72f('0xed')]?!![]:![]}];}return db[_0xa72f('0xa6')]['findAll'](_0x2a8838);})[_0xa72f('0x11')](function(_0x4a090a){_0x178c03[_0xa72f('0x47')]=_0x4a090a;return _0x178c03;});}})['then'](respondWithFilteredResult(_0x38301f,_0x2a8838))[_0xa72f('0x1c')](handleError(_0x38301f,null));};function iftimePromise(_0x372e1d,_0x58023d){return respondWithRpcPromise(_0xa72f('0xee'),_0xa72f('0xef'),{'command':_0x58023d['timezone']?util[_0xa72f('0x9f')](_0xa72f('0xf0'),_0x372e1d[_0xa72f('0xf1')],_0x58023d['timezone']):util[_0xa72f('0x9f')](_0xa72f('0xf2'),_0x372e1d[_0xa72f('0xf1')])},client9002)[_0xa72f('0x11')](function(_0xa204c7){var _0x2447dd=_0xa204c7&&_0xa204c7[_0xa72f('0xf3')](_0xa72f('0xf4'))>=0x0?!![]:![];logger[_0xa72f('0x12')](_0xa72f('0xf5'),_0x58023d['id'],_0x372e1d['id'],_0x372e1d['interval'],_0x2447dd?_0xa72f('0xf6'):_0xa72f('0xf7'),_0x58023d[_0xa72f('0xf8')]?_0x58023d[_0xa72f('0xf8')]:_0xa72f('0xf9'));return _0x2447dd;})[_0xa72f('0x1c')](function(_0x3cbdb2){logger[_0xa72f('0x18')](_0xa72f('0xf5'),_0x58023d['id'],_0x372e1d['id'],_0x372e1d[_0xa72f('0xf1')],util[_0xa72f('0xfa')](_0x3cbdb2,{'showHidden':![],'depth':null}),_0x58023d['timezone']?_0x58023d[_0xa72f('0xf8')]:_0xa72f('0xf9'));return![];});}exports[_0xa72f('0xef')]=function(_0x6473,_0x1d1ebd){var _0x3b66b2=0x0;var _0x44b198=0x0;var _0xc1199e=![];var _0x3bc554;var _0x372b2d;return db[_0xa72f('0x45')]['find']({'where':{'id':_0x6473[_0xa72f('0x49')]['id']},'include':[{'model':db[_0xa72f('0xfb')],'as':'Interval','include':[{'model':db['Interval'],'as':_0xa72f('0xfc'),'attributes':['id',_0xa72f('0xf1')],'raw':!![]}]}]})[_0xa72f('0x11')](handleEntityNotFound(_0x1d1ebd,null))['then'](function(_0x569c79){if(_0x569c79){_0x3bc554=_0x569c79;return _0x569c79['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3d1410){if(_0x3bc554){if(_0x3d1410){_0x372b2d=_0x3d1410;}}return require('../../config/license/util')[_0xa72f('0x6b')]();})[_0xa72f('0x11')](function(_0x5df218){if(_0x5df218){_0x44b198=_0x5df218[_0xa72f('0xfd')];_0xc1199e=_0x5df218[_0xa72f('0x6c')];}})[_0xa72f('0x11')](function(){return db[_0xa72f('0xa6')][_0xa72f('0x23')]({'where':{'closed':![]}});})[_0xa72f('0x11')](function(_0x182b17){_0x3b66b2=_0x182b17;if(_0x44b198&&_0x182b17>_0x44b198){return db['License'][_0xa72f('0x58')]({'where':{'id':0x1}})[_0xa72f('0x11')](function(_0x459fa8){if(_0x459fa8){_0x459fa8[_0xa72f('0xfe')](_0xa72f('0xff'));}});}})[_0xa72f('0x11')](function(){if(_0x3bc554[_0xa72f('0xfb')]&&_0x3bc554[_0xa72f('0xfb')]['Intervals']){var _0x4b8188=[];for(var _0x342430=0x0;_0x342430<_0x3bc554['Interval'][_0xa72f('0xfc')]['length'];_0x342430++){var _0x1a69c9=_0x3bc554[_0xa72f('0xfb')][_0xa72f('0xfc')][_0x342430]['get']({'plain':!![]});_0x4b8188[_0xa72f('0xae')](iftimePromise(_0x1a69c9,_0x3bc554));}return BPromise[_0xa72f('0x100')](_0x4b8188)[_0xa72f('0x11')](function(_0x81ab7b){return _[_0xa72f('0x101')](_0x81ab7b);});}else{return!![];}})[_0xa72f('0x11')](function(_0x4b60f0){var _0x2f4f89=fs['readFileSync'](path[_0xa72f('0x68')](config[_0xa72f('0x69')],_0xa72f('0x102')),_0xa72f('0xc5'));var _0x5c7c4c={'remote':_0x3bc554[_0xa72f('0x103')],'query':querystring['stringify'](_[_0xa72f('0x40')](_0x3bc554[_0xa72f('0x28')]({'plain':!![]}),{'customerIp':_0x6473[_0xa72f('0x7a')][_0xa72f('0x96')]||_0x6473[_0xa72f('0x7a')][_0xa72f('0x104')]||_0x6473[_0xa72f('0x105')][_0xa72f('0x106')]||_0x6473['ip'],'referer':_0x6473[_0xa72f('0x7a')]['referer'],'openedInteractions':_0x3b66b2,'maxInteractions':_0x44b198,'virtual':_0xc1199e[_0xa72f('0xfd')],'online':_0x4b60f0,'custom':_0xc1199e}))[_0xa72f('0x107')](/'/g,'\x5c\x27')};_0x1d1ebd[_0xa72f('0xbd')](ejs[_0xa72f('0xc6')](Mustache[_0xa72f('0xc6')](_0x2f4f89,_0x5c7c4c),{'proactiveActions':_0x372b2d,'alignment':_0x3bc554[_0xa72f('0x108')],'verticalAlignment':_0x3bc554[_0xa72f('0x109')],'div_color':_0x3bc554[_0xa72f('0xec')],'labelText':_0x3bc554[_0xa72f('0x10a')],'text_color':_0x3bc554[_0xa72f('0x10b')],'text_button_color':_0x3bc554[_0xa72f('0x10c')],'button_color':_0x3bc554[_0xa72f('0x10d')],'background_color':_0x3bc554['backgroundColor'],'hideWhenOffline':_0x3bc554[_0xa72f('0x10e')],'interval':_0x3bc554[_0xa72f('0x10f')]}));})[_0xa72f('0x1c')](handleError(_0x1d1ebd,null));};exports[_0xa72f('0x110')]=function(_0x3779cc,_0x2d279c){var _0x135543=_0x3779cc['params']['id'];var _0x44fc8d=_0x3779cc[_0xa72f('0x52')];var _0x1dc6c1=0xc8;var _0x1f80f7=null;return db[_0xa72f('0x111')][_0xa72f('0xcf')]({'isolationLevel':db[_0xa72f('0x111')]['Transaction'][_0xa72f('0x112')][_0xa72f('0x113')]},function(_0x378a38){return db['ChatWebsite'][_0xa72f('0x58')]({'where':{'id':_0x135543},'transaction':_0x378a38})['then'](function(_0x1ed9f8){if(_0x1ed9f8){return db[_0xa72f('0x8d')][_0xa72f('0x53')]({'where':{'ChatWebsiteId':_0x135543},'transaction':_0x378a38})[_0xa72f('0x11')](function(){var _0x53edad=_[_0xa72f('0x2f')](_0x44fc8d,function(_0x406b8b){_0x406b8b[_0xa72f('0x56')]=_0x135543;return _0x406b8b;});return db[_0xa72f('0x8d')][_0xa72f('0xd1')](_0x53edad,{'transaction':_0x378a38});});}else{_0x1dc6c1=0x194;_0x1f80f7=[];}});})[_0xa72f('0x11')](function(){if(_0x1dc6c1!==0x194){return db[_0xa72f('0x8d')][_0xa72f('0x114')]({'where':{'ChatWebsiteId':_0x135543},'order':_0xa72f('0x115')})['then'](function(_0x101146){_0x1f80f7=_0x101146;});}})['catch'](function(_0x281db8){_0x1dc6c1=0x1f4;logger[_0xa72f('0x18')](_0x281db8[_0xa72f('0x2a')]);if(_0x281db8['name']){delete _0x281db8[_0xa72f('0x2b')];}_0x1f80f7=_0x281db8;})[_0xa72f('0x116')](function(){if(_0x1f80f7===null){_0x2d279c[_0xa72f('0x1d')](_0x1dc6c1);}else{if(_0x1dc6c1===0x1f4){_0x2d279c['status'](_0x1dc6c1)[_0xa72f('0xbd')](_0x1f80f7);}else{_0x2d279c['status'](_0x1dc6c1)[_0xa72f('0x20')](_0x1f80f7);}}});};exports[_0xa72f('0x117')]=function(_0x7d0a7b,_0x262834){var _0x1b5164={};var _0x21f65d={};var _0x2cc7a2;var _0x115f67;return db['ChatWebsite'][_0xa72f('0x58')]({'where':{'id':_0x7d0a7b[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x262834,null))[_0xa72f('0x11')](function(_0x125708){if(_0x125708){_0x2cc7a2=_0x125708;_0x21f65d[_0xa72f('0x31')]=_['keys'](db[_0xa72f('0x8d')][_0xa72f('0x30')]);_0x21f65d[_0xa72f('0x33')]=_['keys'](_0x7d0a7b[_0xa72f('0x33')]);_0x21f65d[_0xa72f('0x34')]=_[_0xa72f('0x35')](_0x21f65d[_0xa72f('0x31')],_0x21f65d['query']);_0x1b5164[_0xa72f('0x37')]=_[_0xa72f('0x35')](_0x21f65d['model'],qs['fields'](_0x7d0a7b[_0xa72f('0x33')]['fields']));_0x1b5164[_0xa72f('0x37')]=_0x1b5164[_0xa72f('0x37')][_0xa72f('0x38')]?_0x1b5164['attributes']:_0x21f65d[_0xa72f('0x31')];_0x1b5164[_0xa72f('0x3b')]=qs[_0xa72f('0x3c')](_0x7d0a7b[_0xa72f('0x33')][_0xa72f('0x3c')]);_0x1b5164[_0xa72f('0x3d')]=qs[_0xa72f('0x34')](_[_0xa72f('0x3e')](_0x7d0a7b[_0xa72f('0x33')],_0x21f65d[_0xa72f('0x34')]));if(_0x7d0a7b[_0xa72f('0x33')]['filter']){_0x1b5164[_0xa72f('0x3d')]=_[_0xa72f('0x40')](_0x1b5164[_0xa72f('0x3d')],{'$or':_[_0xa72f('0x2f')](_0x1b5164[_0xa72f('0x37')],function(_0x2f4fa7){var _0x1a7dac={};_0x1a7dac[_0x2f4fa7]={'$like':'%'+_0x7d0a7b[_0xa72f('0x33')][_0xa72f('0x3f')]+'%'};return _0x1a7dac;})});}_0x1b5164=_['merge']({},_0x1b5164,_0x7d0a7b[_0xa72f('0x42')]);return _0x2cc7a2[_0xa72f('0x117')](_0x1b5164);}})[_0xa72f('0x11')](function(_0x14b96a){if(_0x14b96a){_0x115f67=_0x14b96a[_0xa72f('0x38')];if(!_0x7d0a7b[_0xa72f('0x33')][_0xa72f('0x39')]('nolimit')){_0x1b5164[_0xa72f('0x24')]=qs[_0xa72f('0x24')](_0x7d0a7b[_0xa72f('0x33')]['limit']);_0x1b5164[_0xa72f('0x21')]=qs[_0xa72f('0x21')](_0x7d0a7b[_0xa72f('0x33')][_0xa72f('0x21')]);}return _0x2cc7a2[_0xa72f('0x117')](_0x1b5164);}})['then'](function(_0x12dc85){if(_0x12dc85){return _0x12dc85?{'count':_0x115f67,'rows':_0x12dc85}:null;}})[_0xa72f('0x11')](respondWithResult(_0x262834,null))[_0xa72f('0x1c')](handleError(_0x262834,null));};exports[_0xa72f('0x118')]=function(_0xaede73,_0x15a1a5){return db[_0xa72f('0x119')][_0xa72f('0x4a')]({'where':{'id':_0xaede73[_0xa72f('0x49')]['id']}})['then'](handleEntityNotFound(_0x15a1a5,null))[_0xa72f('0x11')](function(_0xd30b86){if(_0xd30b86){return _0xd30b86[_0xa72f('0x118')](_0xaede73[_0xa72f('0x52')][_0xa72f('0x5a')],_['omit'](_0xaede73[_0xa72f('0x52')],[_0xa72f('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x15a1a5,null))['catch'](handleError(_0x15a1a5,null));};exports[_0xa72f('0x11a')]=function(_0x16f48d,_0x2fa110){var _0x201206={};var _0x26addb={};var _0x3bca5b;var _0x4d2867;return db[_0xa72f('0x45')][_0xa72f('0x58')]({'where':{'id':_0x16f48d['params']['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x2fa110,null))[_0xa72f('0x11')](function(_0x4c35a9){if(_0x4c35a9){_0x3bca5b=_0x4c35a9;_0x26addb[_0xa72f('0x31')]=_[_0xa72f('0x32')](db[_0xa72f('0x11b')][_0xa72f('0x30')]);_0x26addb[_0xa72f('0x33')]=_[_0xa72f('0x32')](_0x16f48d[_0xa72f('0x33')]);_0x26addb[_0xa72f('0x34')]=_[_0xa72f('0x35')](_0x26addb['model'],_0x26addb[_0xa72f('0x33')]);_0x201206[_0xa72f('0x37')]=_[_0xa72f('0x35')](_0x26addb[_0xa72f('0x31')],qs['fields'](_0x16f48d[_0xa72f('0x33')][_0xa72f('0x36')]));_0x201206[_0xa72f('0x37')]=_0x201206['attributes'][_0xa72f('0x38')]?_0x201206['attributes']:_0x26addb['model'];_0x201206[_0xa72f('0x3b')]=qs['sort'](_0x16f48d['query'][_0xa72f('0x3c')]);_0x201206['where']=qs['filters'](_[_0xa72f('0x3e')](_0x16f48d[_0xa72f('0x33')],_0x26addb['filters']));if(_0x16f48d['query'][_0xa72f('0x3f')]){_0x201206[_0xa72f('0x3d')]=_[_0xa72f('0x40')](_0x201206['where'],{'$or':_[_0xa72f('0x2f')](_0x201206['attributes'],function(_0x102026){var _0x5a06a1={};_0x5a06a1[_0x102026]={'$like':'%'+_0x16f48d[_0xa72f('0x33')][_0xa72f('0x3f')]+'%'};return _0x5a06a1;})});}_0x201206=_['merge']({},_0x201206,_0x16f48d[_0xa72f('0x42')]);return _0x3bca5b[_0xa72f('0x11a')](_0x201206);}})[_0xa72f('0x11')](function(_0xb4b3){if(_0xb4b3){_0x4d2867=_0xb4b3['length'];if(!_0x16f48d['query'][_0xa72f('0x39')]('nolimit')){_0x201206[_0xa72f('0x24')]=qs[_0xa72f('0x24')](_0x16f48d[_0xa72f('0x33')]['limit']);_0x201206[_0xa72f('0x21')]=qs[_0xa72f('0x21')](_0x16f48d[_0xa72f('0x33')][_0xa72f('0x21')]);}return _0x3bca5b[_0xa72f('0x11a')](_0x201206);}})['then'](function(_0x101a9a){if(_0x101a9a){return _0x101a9a?{'count':_0x4d2867,'rows':_0x101a9a}:null;}})[_0xa72f('0x11')](respondWithResult(_0x2fa110,null))[_0xa72f('0x1c')](handleError(_0x2fa110,null));};exports[_0xa72f('0x11c')]=function(_0x251a51,_0x3666d7){var _0x5d1c09=_0x251a51['query'][_0xa72f('0x11d')]===_0xa72f('0x11e')?_0xa72f('0x11f'):_0xa72f('0x120');return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'attributes':['id',_0x5d1c09],'where':{'id':_0x251a51['params']['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x3666d7,null))[_0xa72f('0x11')](function(_0x1c1ea6){if(_0x1c1ea6){var _0x11be75=_0x1c1ea6[_0x5d1c09];var _0x125b36=_0x11be75&&_0x11be75[_0xa72f('0x121')]?_0x11be75[_0xa72f('0x121')]:[];_0x3666d7[_0xa72f('0xbd')]({'fromKey':_['isNil'](_0x11be75[_0xa72f('0x122')])?undefined:_0x11be75['fromKey'],'count':_0x125b36[_0xa72f('0x38')],'rows':_0x125b36});}})[_0xa72f('0x1c')](handleError(_0x3666d7,null));};exports[_0xa72f('0x123')]=function(_0x191c91,_0x53964d){var _0x29e1cd={'raw':![],'where':{}};var _0x2e00d4={};var _0xef5331={'count':0x0,'rows':[]};return db[_0xa72f('0x45')]['findOne']({'where':{'id':_0x191c91[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0x53964d,null))['then'](function(_0xb697fa){if(_0xb697fa){_0x2e00d4['model']=_['keys'](db[_0xa72f('0xc8')][_0xa72f('0x30')]);_0x2e00d4[_0xa72f('0x33')]=_[_0xa72f('0x32')](_0x191c91[_0xa72f('0x33')]);_0x2e00d4[_0xa72f('0x34')]=_[_0xa72f('0x35')](_0x2e00d4['model'],_0x2e00d4[_0xa72f('0x33')]);_0x29e1cd[_0xa72f('0x37')]=_[_0xa72f('0x35')](_0x2e00d4[_0xa72f('0x31')],qs['fields'](_0x191c91[_0xa72f('0x33')]['fields']));_0x29e1cd[_0xa72f('0x37')]=_0x29e1cd[_0xa72f('0x37')]['length']?_0x29e1cd[_0xa72f('0x37')]:_0x2e00d4[_0xa72f('0x31')];if(!_0x191c91[_0xa72f('0x33')][_0xa72f('0x39')](_0xa72f('0x3a'))){_0x29e1cd[_0xa72f('0x24')]=qs['limit'](_0x191c91[_0xa72f('0x33')][_0xa72f('0x24')]);_0x29e1cd['offset']=qs[_0xa72f('0x21')](_0x191c91[_0xa72f('0x33')][_0xa72f('0x21')]);}_0x29e1cd[_0xa72f('0x3b')]=qs[_0xa72f('0x3c')](_0x191c91['query'][_0xa72f('0x3c')]);_0x29e1cd[_0xa72f('0x3d')]=qs[_0xa72f('0x34')](_[_0xa72f('0x3e')](_0x191c91[_0xa72f('0x33')],_0x2e00d4['filters']));_0x29e1cd['where']['ChatWebsiteId']=_0xb697fa['id'];if(_0x191c91['query'][_0xa72f('0x3f')]){_0x29e1cd['where']=_[_0xa72f('0x40')](_0x29e1cd[_0xa72f('0x3d')],{'$or':_[_0xa72f('0x2f')](_0x29e1cd[_0xa72f('0x37')],function(_0xe233e6){var _0x1a4e63={};_0x1a4e63[_0xe233e6]={'$like':'%'+_0x191c91[_0xa72f('0x33')][_0xa72f('0x3f')]+'%'};return _0x1a4e63;})});}_0x29e1cd=_['merge']({},_0x29e1cd,_0x191c91[_0xa72f('0x42')]);return db[_0xa72f('0xc8')][_0xa72f('0x23')]({'where':_0x29e1cd['where']})[_0xa72f('0x11')](function(_0x1023af){_0xef5331['count']=_0x1023af;if(_0x191c91[_0xa72f('0x33')][_0xa72f('0x43')]){_0x29e1cd[_0xa72f('0x44')]=[{'all':!![]}];}else{_0x29e1cd[_0xa72f('0x44')]=[{'model':db[_0xa72f('0x7c')],'as':'Contact','required':![]},{'model':db[_0xa72f('0xd0')],'as':_0xa72f('0x124'),'required':![]}];}return db['ChatOfflineMessage'][_0xa72f('0x46')](_0x29e1cd);})[_0xa72f('0x11')](function(_0x4dfcc9){_0xef5331[_0xa72f('0x47')]=_0x4dfcc9;return _0xef5331;});}})[_0xa72f('0x11')](respondWithFilteredResult(_0x53964d,_0x29e1cd))[_0xa72f('0x1c')](handleError(_0x53964d,null));};exports[_0xa72f('0x125')]=function(_0x3b5017,_0x346b12){return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x3b5017[_0xa72f('0x49')]['id']}})['then'](handleEntityNotFound(_0x346b12,null))[_0xa72f('0x11')](function(_0x4f7503){if(_0x4f7503){return _0x4f7503[_0xa72f('0x125')](_0x3b5017[_0xa72f('0x52')][_0xa72f('0x5a')],_['omit'](_0x3b5017[_0xa72f('0x52')],['ids','id'])||{})[_0xa72f('0xaa')](function(_0x3fb3f4){for(var _0x4399fb=0x0;_0x4399fb<_0x3b5017[_0xa72f('0x52')][_0xa72f('0x5a')]['length'];_0x4399fb+=0x1){socket[_0xa72f('0x126')](_0xa72f('0x127'),{'UserId':Number(_0x3b5017[_0xa72f('0x52')]['ids'][_0x4399fb]),'ChatWebsiteId':Number(_0x3b5017['params']['id'])});}return _0x3fb3f4;});}})[_0xa72f('0x11')](respondWithResult(_0x346b12,null))[_0xa72f('0x1c')](handleError(_0x346b12,null));};exports[_0xa72f('0x128')]=function(_0x335520,_0xb076ff){return db[_0xa72f('0x45')][_0xa72f('0x4a')]({'where':{'id':_0x335520[_0xa72f('0x49')]['id']}})[_0xa72f('0x11')](handleEntityNotFound(_0xb076ff,null))[_0xa72f('0x11')](function(_0x25a8cd){if(_0x25a8cd){return _0x25a8cd['removeAgents'](_0x335520[_0xa72f('0x33')][_0xa72f('0x5a')])[_0xa72f('0x11')](function(){if(_[_0xa72f('0x129')](_0x335520[_0xa72f('0x33')][_0xa72f('0x5a')])){for(var _0x1ac2e3=0x0;_0x1ac2e3<_0x335520[_0xa72f('0x33')][_0xa72f('0x5a')]['length'];_0x1ac2e3+=0x1){socket[_0xa72f('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x335520['query']['ids'][_0x1ac2e3]),'ChatWebsiteId':Number(_0x335520[_0xa72f('0x49')]['id'])});}}else{socket[_0xa72f('0x126')](_0xa72f('0x12a'),{'UserId':Number(_0x335520[_0xa72f('0x33')]['ids']),'ChatWebsiteId':Number(_0x335520['params']['id'])});}});}})['then'](respondWithStatusCode(_0xb076ff,null))[_0xa72f('0x1c')](handleError(_0xb076ff,null));};exports[_0xa72f('0x12b')]=function(_0x191e8e,_0xf99dde){var _0x2b56b9={};var _0x5749a5={};var _0x45c836;var _0x1b9924;return db['ChatWebsite'][_0xa72f('0x58')]({'where':{'id':_0x191e8e[_0xa72f('0x49')]['id']}})['then'](handleEntityNotFound(_0xf99dde,null))[_0xa72f('0x11')](function(_0x5c5c6a){if(_0x5c5c6a){_0x45c836=_0x5c5c6a;_0x5749a5[_0xa72f('0x31')]=_[_0xa72f('0x32')](db[_0xa72f('0xb3')][_0xa72f('0x30')]);_0x5749a5[_0xa72f('0x33')]=_[_0xa72f('0x32')](_0x191e8e['query']);_0x5749a5[_0xa72f('0x34')]=_[_0xa72f('0x35')](_0x5749a5['model'],_0x5749a5[_0xa72f('0x33')]);_0x2b56b9[_0xa72f('0x37')]=_[_0xa72f('0x35')](_0x5749a5[_0xa72f('0x31')],qs[_0xa72f('0x36')](_0x191e8e[_0xa72f('0x33')]['fields']));_0x2b56b9[_0xa72f('0x37')]=_0x2b56b9[_0xa72f('0x37')]['length']?_0x2b56b9['attributes']:_0x5749a5[_0xa72f('0x31')];_0x2b56b9['order']=qs[_0xa72f('0x3c')](_0x191e8e['query']['sort']);_0x2b56b9[_0xa72f('0x3d')]=qs[_0xa72f('0x34')](_[_0xa72f('0x3e')](_0x191e8e['query'],_0x5749a5[_0xa72f('0x34')]));if(_0x191e8e[_0xa72f('0x33')][_0xa72f('0x3f')]){_0x2b56b9[_0xa72f('0x3d')]=_[_0xa72f('0x40')](_0x2b56b9['where'],{'$or':_[_0xa72f('0x2f')](_0x2b56b9[_0xa72f('0x37')],function(_0x2639ee){var _0xed4e9f={};_0xed4e9f[_0x2639ee]={'$like':'%'+_0x191e8e[_0xa72f('0x33')]['filter']+'%'};return _0xed4e9f;})});}_0x2b56b9=_['merge']({},_0x2b56b9,_0x191e8e[_0xa72f('0x42')]);return _0x45c836[_0xa72f('0x12b')](_0x2b56b9);}})[_0xa72f('0x11')](function(_0x4aeffa){if(_0x4aeffa){_0x1b9924=_0x4aeffa[_0xa72f('0x38')];if(!_0x191e8e[_0xa72f('0x33')][_0xa72f('0x39')]('nolimit')){_0x2b56b9['limit']=qs[_0xa72f('0x24')](_0x191e8e[_0xa72f('0x33')]['limit']);_0x2b56b9['offset']=qs[_0xa72f('0x21')](_0x191e8e['query']['offset']);}return _0x45c836[_0xa72f('0x12b')](_0x2b56b9);}})['then'](function(_0xd728f4){if(_0xd728f4){return _0xd728f4?{'count':_0x1b9924,'rows':_0xd728f4}:null;}})[_0xa72f('0x11')](respondWithResult(_0xf99dde,null))[_0xa72f('0x1c')](handleError(_0xf99dde,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 6faa38b..f21ca75 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 _0xf3dc=['events','../../mysqldb','ChatWebsite','save','update','remove'];(function(_0x18b2a3,_0x2a639b){var _0x50659f=function(_0x6cb26e){while(--_0x6cb26e){_0x18b2a3['push'](_0x18b2a3['shift']());}};_0x50659f(++_0x2a639b);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x4046b6,_0x238c36){_0x4046b6=_0x4046b6-0x0;var _0x1443be=_0xf3dc[_0x4046b6];return _0x1443be;};'use strict';var EventEmitter=require(_0xcf3d('0x0'));var ChatWebsite=require(_0xcf3d('0x1'))['db'][_0xcf3d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcf3d('0x3'),'afterUpdate':_0xcf3d('0x4'),'afterDestroy':_0xcf3d('0x5')};function emitEvent(_0x226c79){return function(_0x17b83e,_0x44b3da,_0x4b34a3){ChatWebsiteEvents['emit'](_0x226c79+':'+_0x17b83e['id'],_0x17b83e);ChatWebsiteEvents['emit'](_0x226c79,_0x17b83e);_0x4b34a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x3036=['save','remove','emit','hasOwnProperty','hook','ChatWebsite','setMaxListeners'];(function(_0x946926,_0x7d3931){var _0x378426=function(_0x196986){while(--_0x196986){_0x946926['push'](_0x946926['shift']());}};_0x378426(++_0x7d3931);}(_0x3036,0x1a9));var _0x6303=function(_0x82f20e,_0x426323){_0x82f20e=_0x82f20e-0x0;var _0x4d624f=_0x3036[_0x82f20e];return _0x4d624f;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x6303('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6303('0x1')](0x0);var events={'afterCreate':_0x6303('0x2'),'afterUpdate':'update','afterDestroy':_0x6303('0x3')};function emitEvent(_0x4b6d75){return function(_0x48aa0c,_0x4d040b,_0x29f435){ChatWebsiteEvents['emit'](_0x4b6d75+':'+_0x48aa0c['id'],_0x48aa0c);ChatWebsiteEvents[_0x6303('0x4')](_0x4b6d75,_0x48aa0c);_0x29f435(null);};}for(var e in events){if(events[_0x6303('0x5')](e)){var event=events[e];ChatWebsite[_0x6303('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 0a65b02..c66069b 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 _0x5c41=['util','../../config/logger','api','moment','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x2765ff,_0x34527a){var _0x35890e=function(_0x445436){while(--_0x445436){_0x2765ff['push'](_0x2765ff['shift']());}};_0x35890e(++_0x34527a);}(_0x5c41,0x151));var _0x15c4=function(_0x39a71b,_0xeb62c3){_0x39a71b=_0x39a71b-0x0;var _0x1ff3db=_0x5c41[_0x39a71b];return _0x1ff3db;};'use strict';var _=require(_0x15c4('0x0'));var util=require(_0x15c4('0x1'));var logger=require(_0x15c4('0x2'))(_0x15c4('0x3'));var moment=require(_0x15c4('0x4'));var BPromise=require('bluebird');var rp=require(_0x15c4('0x5'));var fs=require('fs');var path=require(_0x15c4('0x6'));var rimraf=require(_0x15c4('0x7'));var config=require('../../config/environment');var attributes=require(_0x15c4('0x8'));module[_0x15c4('0x9')]=function(_0xb8f2b2,_0x118930){return _0xb8f2b2[_0x15c4('0xa')](_0x15c4('0xb'),attributes,{'tableName':_0x15c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe052=['moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api'];(function(_0x543759,_0x40cfbc){var _0x35003c=function(_0x34e7ba){while(--_0x34e7ba){_0x543759['push'](_0x543759['shift']());}};_0x35003c(++_0x40cfbc);}(_0xe052,0xe6));var _0x2e05=function(_0xf88a2e,_0x26a724){_0xf88a2e=_0xf88a2e-0x0;var _0x2ce6e2=_0xe052[_0xf88a2e];return _0x2ce6e2;};'use strict';var _=require(_0x2e05('0x0'));var util=require(_0x2e05('0x1'));var logger=require(_0x2e05('0x2'))(_0x2e05('0x3'));var moment=require(_0x2e05('0x4'));var BPromise=require(_0x2e05('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e05('0x6'));var rimraf=require(_0x2e05('0x7'));var config=require(_0x2e05('0x8'));var attributes=require(_0x2e05('0x9'));module[_0x2e05('0xa')]=function(_0x29f9e5,_0x466053){return _0x29f9e5[_0x2e05('0xb')]('ChatWebsite',attributes,{'tableName':_0x2e05('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 29d3a18..b4a5ffe 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 _0x2d86=['rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x381f03,_0x4c3f61){var _0x21a630=function(_0x34a2fa){while(--_0x34a2fa){_0x381f03['push'](_0x381f03['shift']());}};_0x21a630(++_0x4c3f61);}(_0x2d86,0x13c));var _0x62d8=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x2d86[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x62d8('0x0'));var util=require(_0x62d8('0x1'));var moment=require('moment');var BPromise=require(_0x62d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62d8('0x3'));var db=require(_0x62d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x62d8('0x5'))(_0x62d8('0x6'));var config=require(_0x62d8('0x7'));var jayson=require(_0x62d8('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x62d8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x62d8('0xa'))(new Redis(config['redis']));require(_0x62d8('0xb'))[_0x62d8('0xc')](socket);function respondWithRpcPromise(_0x132836,_0xd8ca39,_0x18c5ab){return new BPromise(function(_0x1472ba,_0x53dc2d){return client[_0x62d8('0xd')](_0x132836,_0x18c5ab)[_0x62d8('0xe')](function(_0x2df72e){logger[_0x62d8('0xf')](_0x62d8('0x10'),_0xd8ca39,_0x62d8('0x11'));logger['debug'](_0x62d8('0x12'),_0xd8ca39,_0x62d8('0x11'),JSON['stringify'](_0x2df72e));if(_0x2df72e['error']){if(_0x2df72e[_0x62d8('0x13')]['code']===0x1f4){logger[_0x62d8('0x13')](_0x62d8('0x10'),_0xd8ca39,_0x2df72e['error'][_0x62d8('0x14')]);return _0x53dc2d(_0x2df72e['error'][_0x62d8('0x14')]);}logger[_0x62d8('0x13')](_0x62d8('0x10'),_0xd8ca39,_0x2df72e[_0x62d8('0x13')]['message']);return _0x1472ba(_0x2df72e[_0x62d8('0x13')][_0x62d8('0x14')]);}else{logger[_0x62d8('0xf')](_0x62d8('0x10'),_0xd8ca39,'request\x20sent');_0x1472ba(_0x2df72e[_0x62d8('0x15')][_0x62d8('0x14')]);}})[_0x62d8('0x16')](function(_0x56c261){logger['error']('ChatWebsite,\x20%s,\x20%s',_0xd8ca39,_0x56c261);_0x53dc2d(_0x56c261);});});} \ No newline at end of file +var _0xb166=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then'];(function(_0x3248c3,_0x355905){var _0x123814=function(_0x232e85){while(--_0x232e85){_0x3248c3['push'](_0x3248c3['shift']());}};_0x123814(++_0x355905);}(_0xb166,0x6c));var _0x6b16=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0xb166[_0x845505];return _0x2513b9;};'use strict';var _=require('lodash');var util=require(_0x6b16('0x0'));var moment=require('moment');var BPromise=require(_0x6b16('0x1'));var rs=require(_0x6b16('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b16('0x3'));var logger=require(_0x6b16('0x4'))('rpc');var config=require(_0x6b16('0x5'));var jayson=require(_0x6b16('0x6'));var client=jayson[_0x6b16('0x7')][_0x6b16('0x8')]({'port':0x232a});config[_0x6b16('0x9')]=_[_0x6b16('0xa')](config['redis'],{'host':_0x6b16('0xb'),'port':0x18eb});var socket=require(_0x6b16('0xc'))(new Redis(config['redis']));require(_0x6b16('0xd'))[_0x6b16('0xe')](socket);function respondWithRpcPromise(_0x330a1c,_0x25b7e6,_0x4aa725){return new BPromise(function(_0x5c53de,_0x5ddecc){return client[_0x6b16('0xf')](_0x330a1c,_0x4aa725)[_0x6b16('0x10')](function(_0x2f6725){logger[_0x6b16('0x11')](_0x6b16('0x12'),_0x25b7e6,_0x6b16('0x13'));logger[_0x6b16('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x25b7e6,_0x6b16('0x13'),JSON[_0x6b16('0x15')](_0x2f6725));if(_0x2f6725['error']){if(_0x2f6725[_0x6b16('0x16')][_0x6b16('0x17')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x25b7e6,_0x2f6725[_0x6b16('0x16')][_0x6b16('0x18')]);return _0x5ddecc(_0x2f6725['error']['message']);}logger[_0x6b16('0x16')](_0x6b16('0x12'),_0x25b7e6,_0x2f6725[_0x6b16('0x16')][_0x6b16('0x18')]);return _0x5c53de(_0x2f6725[_0x6b16('0x16')][_0x6b16('0x18')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x25b7e6,_0x6b16('0x13'));_0x5c53de(_0x2f6725['result'][_0x6b16('0x18')]);}})['catch'](function(_0x3e3c60){logger[_0x6b16('0x16')](_0x6b16('0x12'),_0x25b7e6,_0x3e3c60);_0x5ddecc(_0x3e3c60);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e1817e5..32108dd 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 _0xf3e4=['removeListener','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x35cd75,_0x1b1f1a){var _0x12dbef=function(_0x289db2){while(--_0x289db2){_0x35cd75['push'](_0x35cd75['shift']());}};_0x12dbef(++_0x1b1f1a);}(_0xf3e4,0x15f));var _0x4f3e=function(_0x57e349,_0x3849ff){_0x57e349=_0x57e349-0x0;var _0x410855=_0xf3e4[_0x57e349];return _0x410855;};'use strict';var ChatWebsiteEvents=require(_0x4f3e('0x0'));var events=['save',_0x4f3e('0x1'),_0x4f3e('0x2')];function createListener(_0x46f1aa,_0xbd0a6b){return function(_0x6d35da){_0xbd0a6b['emit'](_0x46f1aa,_0x6d35da);};}function removeListener(_0x5d7b17,_0x232602){return function(){ChatWebsiteEvents[_0x4f3e('0x3')](_0x5d7b17,_0x232602);};}exports['register']=function(_0x5809f0){for(var _0x21fe43=0x0,_0x149a84=events[_0x4f3e('0x4')];_0x21fe43<_0x149a84;_0x21fe43++){var _0x4b124e=events[_0x21fe43];var _0x3530fc=createListener(_0x4f3e('0x5')+_0x4b124e,_0x5809f0);ChatWebsiteEvents['on'](_0x4b124e,_0x3530fc);}}; \ No newline at end of file +var _0xeff4=['./chatWebsite.events','save','remove','update','emit','removeListener','register','length'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xeff4,0x180));var _0x4eff=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xeff4[_0x4382bc];return _0x13c82a;};'use strict';var ChatWebsiteEvents=require(_0x4eff('0x0'));var events=[_0x4eff('0x1'),_0x4eff('0x2'),_0x4eff('0x3')];function createListener(_0x544741,_0x1f7fdc){return function(_0x11c96e){_0x1f7fdc[_0x4eff('0x4')](_0x544741,_0x11c96e);};}function removeListener(_0x438b11,_0x519b58){return function(){ChatWebsiteEvents[_0x4eff('0x5')](_0x438b11,_0x519b58);};}exports[_0x4eff('0x6')]=function(_0x35a4b0){for(var _0x2d7f61=0x0,_0x2ec9d3=events[_0x4eff('0x7')];_0x2d7f61<_0x2ec9d3;_0x2d7f61++){var _0x5cdcd2=events[_0x2d7f61];var _0x4c267a=createListener('chatWebsite:'+_0x5cdcd2,_0x35a4b0);ChatWebsiteEvents['on'](_0x5cdcd2,_0x4c267a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 0a41008..2616741 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 _0x1a20=['getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','replace','/:id/offline','any','offline','addInteraction','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar'];(function(_0xff0854,_0x50fd52){var _0x12f6bf=function(_0x3940f8){while(--_0x3940f8){_0xff0854['push'](_0xff0854['shift']());}};_0x12f6bf(++_0x50fd52);}(_0x1a20,0xff));var _0x01a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1a20[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x01a2('0x0'));var util=require(_0x01a2('0x1'));var path=require(_0x01a2('0x2'));var timeout=require(_0x01a2('0x3'));var express=require('express');var router=express[_0x01a2('0x4')]();var fs_extra=require(_0x01a2('0x5'));var auth=require(_0x01a2('0x6'));var interaction=require(_0x01a2('0x7'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x01a2('0x8')]);router[_0x01a2('0x9')](_0x01a2('0xa'),auth['isAuthenticated'](),controller[_0x01a2('0xb')]);router[_0x01a2('0x9')](_0x01a2('0xc'),auth[_0x01a2('0xd')](),controller[_0x01a2('0xe')]);router['get'](_0x01a2('0xf'),auth[_0x01a2('0xd')](),controller['getDispositions']);router[_0x01a2('0x9')]('/:id/canned_answers',auth[_0x01a2('0xd')](),controller[_0x01a2('0x10')]);router[_0x01a2('0x9')]('/:id/logo',controller[_0x01a2('0x11')]);router[_0x01a2('0x9')](_0x01a2('0x12'),controller[_0x01a2('0x13')]);router['get'](_0x01a2('0x14'),controller[_0x01a2('0x15')]);router[_0x01a2('0x9')](_0x01a2('0x16'),controller[_0x01a2('0x17')]);router[_0x01a2('0x9')](_0x01a2('0x18'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x19')]);router[_0x01a2('0x9')](_0x01a2('0x1a'),controller['getSnippet']);router[_0x01a2('0x9')](_0x01a2('0x1b'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x1c')]);router[_0x01a2('0x9')](_0x01a2('0x1d'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x1e')]);router['get'](_0x01a2('0x1f'),controller['getFields']);router[_0x01a2('0x9')](_0x01a2('0x20'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x21')]);router[_0x01a2('0x9')](_0x01a2('0x22'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x23')]);router[_0x01a2('0x24')]('/',auth[_0x01a2('0xd')](),controller[_0x01a2('0x25')]);router[_0x01a2('0x24')]('/:id/dispositions',auth[_0x01a2('0xd')](),controller['addDisposition']);router[_0x01a2('0x24')]('/:id/canned_answers',auth[_0x01a2('0xd')](),controller[_0x01a2('0x26')]);var upload=multer({'storage':multer[_0x01a2('0x27')]({'destination':function(_0x4d3b41,_0x171ccf,_0x526a64){_0x526a64(null,path[_0x01a2('0x28')](config[_0x01a2('0x29')],_0x01a2('0x2a')));},'filename':function(_0x33ef36,_0x217d84,_0x426f39){_0x426f39(null,util[_0x01a2('0x2b')](_0x01a2('0x2c'),Date[_0x01a2('0x2d')](),_0x217d84[_0x01a2('0x2e')]));}})});router[_0x01a2('0x24')](_0x01a2('0x2f'),upload[_0x01a2('0x30')](_0x01a2('0x31')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x431aba,_0xddabad,_0x14cb7a){_0x14cb7a(null,path[_0x01a2('0x28')](config[_0x01a2('0x29')],_0x01a2('0x32')));},'filename':function(_0x5da399,_0xcdef87,_0x2e12da){_0x2e12da(null,util[_0x01a2('0x2b')](_0x01a2('0x2c'),Date[_0x01a2('0x2d')](),_0xcdef87[_0x01a2('0x2e')]));}})});router[_0x01a2('0x24')](_0x01a2('0x12'),upload['single'](_0x01a2('0x31')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x334990,_0x5f96e,_0x263223){_0x263223(null,path[_0x01a2('0x28')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x35704a,_0x93121a,_0x95bc02){_0x95bc02(null,util['format'](_0x01a2('0x2c'),Date[_0x01a2('0x2d')](),_0x93121a[_0x01a2('0x2e')]));}})});router['post'](_0x01a2('0x14'),upload[_0x01a2('0x30')](_0x01a2('0x31')),controller[_0x01a2('0x33')]);var upload=multer({'storage':multer[_0x01a2('0x27')]({'destination':function(_0x4ac1bb,_0x5e6a86,_0x18c4c2){_0x18c4c2(null,path[_0x01a2('0x28')](config[_0x01a2('0x29')],_0x01a2('0x32')));},'filename':function(_0x18d1ff,_0x1ba277,_0x3b60ae){_0x3b60ae(null,util[_0x01a2('0x2b')](_0x01a2('0x2c'),Date[_0x01a2('0x2d')](),_0x1ba277[_0x01a2('0x2e')]));}})});router[_0x01a2('0x24')](_0x01a2('0x16'),upload['single'](_0x01a2('0x31')),controller[_0x01a2('0x34')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x01a2('0x27')]({'destination':function(_0x35d0e4,_0x4ce34d,_0x2fe74e){const _0x3bb03e=path[_0x01a2('0x28')](config[_0x01a2('0x29')],_0x01a2('0x35'),_0x01a2('0x36'),_0x01a2('0x37'));fs_extra['ensureDir'](_0x3bb03e,function(){_0x2fe74e(null,_0x3bb03e);});},'filename':function(_0x181a64,_0x1e10b7,_0x22bbe5){const _0x350476=_0x1e10b7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5b0710=path['extname'](_0x350476);const _0x3d21d7=Date[_0x01a2('0x2d')]()+'-'+_0x350476[_0x01a2('0x38')](_0x5b0710,'')+_0x5b0710;_0x22bbe5(null,_0x3d21d7);}})});router[_0x01a2('0x24')](_0x01a2('0x39'),offlineUploadMulter[_0x01a2('0x3a')](),controller[_0x01a2('0x3b')]);router[_0x01a2('0x24')](_0x01a2('0x18'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x3c')]);router['post'](_0x01a2('0x1b'),auth[_0x01a2('0xd')](),controller['addApplications']);router[_0x01a2('0x24')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router['post'](_0x01a2('0x22'),auth[_0x01a2('0xd')](),controller['addAgents']);router[_0x01a2('0x3d')](_0x01a2('0xc'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x3e')]);router[_0x01a2('0x3f')]('/:id',auth['isAuthenticated'](),controller[_0x01a2('0x40')]);router[_0x01a2('0x3f')](_0x01a2('0xf'),auth[_0x01a2('0xd')](),controller[_0x01a2('0x41')]);router[_0x01a2('0x3f')](_0x01a2('0x42'),auth[_0x01a2('0xd')](),controller['removeAnswers']);router[_0x01a2('0x3f')]('/:id/users',auth['isAuthenticated'](),controller[_0x01a2('0x43')]);module[_0x01a2('0x44')]=router; \ No newline at end of file +var _0x119b=['./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','format','originalname','file','server/files/images/avatars/','%s-%s','now','/:id/avatar','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','any','addApplications','addProactiveActions','addAgents','update','destroy','delete','removeDispositions','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1484c4,_0x2d844b){var _0x598b70=function(_0x3245f9){while(--_0x3245f9){_0x1484c4['push'](_0x1484c4['shift']());}};_0x598b70(++_0x2d844b);}(_0x119b,0x1f1));var _0xb119=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x119b[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require('multer');var util=require(_0xb119('0x0'));var path=require('path');var timeout=require(_0xb119('0x1'));var express=require(_0xb119('0x2'));var router=express[_0xb119('0x3')]();var fs_extra=require(_0xb119('0x4'));var auth=require(_0xb119('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb119('0x6'));var controller=require(_0xb119('0x7'));router[_0xb119('0x8')]('/',auth[_0xb119('0x9')](),controller[_0xb119('0xa')]);router[_0xb119('0x8')](_0xb119('0xb'),auth[_0xb119('0x9')](),controller[_0xb119('0xc')]);router['get'](_0xb119('0xd'),auth['isAuthenticated'](),controller[_0xb119('0xe')]);router['get']('/:id/dispositions',auth[_0xb119('0x9')](),controller[_0xb119('0xf')]);router[_0xb119('0x8')](_0xb119('0x10'),auth[_0xb119('0x9')](),controller['getAnswers']);router['get'](_0xb119('0x11'),controller[_0xb119('0x12')]);router[_0xb119('0x8')]('/:id/avatar',controller[_0xb119('0x13')]);router[_0xb119('0x8')](_0xb119('0x14'),controller['getCustomerAvatar']);router[_0xb119('0x8')](_0xb119('0x15'),controller[_0xb119('0x16')]);router[_0xb119('0x8')](_0xb119('0x17'),auth[_0xb119('0x9')](),controller[_0xb119('0x18')]);router[_0xb119('0x8')](_0xb119('0x19'),controller[_0xb119('0x1a')]);router['get'](_0xb119('0x1b'),auth[_0xb119('0x9')](),controller['getApplications']);router[_0xb119('0x8')](_0xb119('0x1c'),auth[_0xb119('0x9')](),controller[_0xb119('0x1d')]);router[_0xb119('0x8')](_0xb119('0x1e'),controller['getFields']);router[_0xb119('0x8')](_0xb119('0x1f'),auth[_0xb119('0x9')](),controller[_0xb119('0x20')]);router[_0xb119('0x8')](_0xb119('0x21'),auth[_0xb119('0x9')](),controller[_0xb119('0x22')]);router['post']('/',auth[_0xb119('0x9')](),controller[_0xb119('0x23')]);router[_0xb119('0x24')](_0xb119('0x25'),auth[_0xb119('0x9')](),controller[_0xb119('0x26')]);router[_0xb119('0x24')](_0xb119('0x10'),auth[_0xb119('0x9')](),controller[_0xb119('0x27')]);var upload=multer({'storage':multer[_0xb119('0x28')]({'destination':function(_0x299f4b,_0x46f808,_0x4b4ca1){_0x4b4ca1(null,path[_0xb119('0x29')](config[_0xb119('0x2a')],'server/files/images/logos/'));},'filename':function(_0x546413,_0x58fe51,_0x41452d){_0x41452d(null,util[_0xb119('0x2b')]('%s-%s',Date['now'](),_0x58fe51[_0xb119('0x2c')]));}})});router[_0xb119('0x24')](_0xb119('0x11'),upload['single'](_0xb119('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0xb119('0x28')]({'destination':function(_0x23140e,_0x274374,_0x432d0c){_0x432d0c(null,path['join'](config[_0xb119('0x2a')],_0xb119('0x2e')));},'filename':function(_0x3b1b57,_0x5e5e48,_0x119cce){_0x119cce(null,util[_0xb119('0x2b')](_0xb119('0x2f'),Date[_0xb119('0x30')](),_0x5e5e48[_0xb119('0x2c')]));}})});router['post'](_0xb119('0x31'),upload['single']('file'),controller[_0xb119('0x32')]);var upload=multer({'storage':multer[_0xb119('0x28')]({'destination':function(_0x227b62,_0x1a0bb6,_0x560f59){_0x560f59(null,path[_0xb119('0x29')](config[_0xb119('0x2a')],_0xb119('0x2e')));},'filename':function(_0xc8c668,_0x206893,_0x1344d){_0x1344d(null,util[_0xb119('0x2b')](_0xb119('0x2f'),Date[_0xb119('0x30')](),_0x206893[_0xb119('0x2c')]));}})});router[_0xb119('0x24')](_0xb119('0x14'),upload[_0xb119('0x33')](_0xb119('0x2d')),controller[_0xb119('0x34')]);var upload=multer({'storage':multer[_0xb119('0x28')]({'destination':function(_0x14e648,_0x3d9b70,_0x99b83e){_0x99b83e(null,path[_0xb119('0x29')](config[_0xb119('0x2a')],'server/files/images/avatars/'));},'filename':function(_0xa72d9c,_0x47a7ff,_0x5c4d30){_0x5c4d30(null,util['format'](_0xb119('0x2f'),Date[_0xb119('0x30')](),_0x47a7ff[_0xb119('0x2c')]));}})});router[_0xb119('0x24')](_0xb119('0x15'),upload['single'](_0xb119('0x2d')),controller[_0xb119('0x35')]);router[_0xb119('0x24')](_0xb119('0x36'),controller[_0xb119('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xb119('0x28')]({'destination':function(_0x398c1f,_0x4ed3b5,_0x314753){const _0x9d5f37=path[_0xb119('0x29')](config[_0xb119('0x2a')],_0xb119('0x38'),_0xb119('0x39'),_0xb119('0x3a'));fs_extra[_0xb119('0x3b')](_0x9d5f37,function(){_0x314753(null,_0x9d5f37);});},'filename':function(_0x3d7d1c,_0x279d6c,_0x2690df){const _0x34150e=_0x279d6c['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4139a1=path[_0xb119('0x3c')](_0x34150e);const _0x5a19bc=Date[_0xb119('0x30')]()+'-'+_0x34150e[_0xb119('0x3d')](_0x4139a1,'')+_0x4139a1;_0x2690df(null,_0x5a19bc);}})});router[_0xb119('0x24')]('/:id/offline',offlineUploadMulter[_0xb119('0x3e')](),controller['offline']);router['post']('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xb119('0x9')](),controller[_0xb119('0x3f')]);router['post']('/:id/proactive_actions',auth[_0xb119('0x9')](),controller[_0xb119('0x40')]);router[_0xb119('0x24')](_0xb119('0x21'),auth['isAuthenticated'](),controller[_0xb119('0x41')]);router['put'](_0xb119('0xd'),auth['isAuthenticated'](),controller[_0xb119('0x42')]);router['delete'](_0xb119('0xd'),auth[_0xb119('0x9')](),controller[_0xb119('0x43')]);router[_0xb119('0x44')]('/:id/dispositions',auth[_0xb119('0x9')](),controller[_0xb119('0x45')]);router[_0xb119('0x44')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xb119('0x44')](_0xb119('0x21'),auth[_0xb119('0x9')](),controller[_0xb119('0x46')]);module[_0xb119('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 88cc67c..7f67c2b 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 _0x0999=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../config/environment','env','production'];(function(_0x465811,_0x434579){var _0x29834d=function(_0x16194a){while(--_0x16194a){_0x465811['push'](_0x465811['shift']());}};_0x29834d(++_0x434579);}(_0x0999,0xd8));var _0x9099=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0x0999[_0x45161c];return _0x186581;};var beaverLogger=require(_0x9099('0x0'));var express=require(_0x9099('0x1'));var auth=require('../components/auth/service');var config=require(_0x9099('0x2'));var router=express['Router']();var isProduction=config[_0x9099('0x3')]===_0x9099('0x4')||![];function clientSideLogs(_0x1e8105,_0x587fe8,_0x32a12c){var _0x4c22c9=_0x1e8105[_0x9099('0x5')][_0x9099('0x6')](_0x9099('0x7'));if(!_0x4c22c9){throw new Error(_0x9099('0x8'));}return beaverLogger[_0x9099('0x9')]({'uri':_0x9099('0xa'),'logger':_0x4c22c9,'enableCors':!isProduction})(_0x1e8105,_0x587fe8,_0x32a12c);}router['use'](auth[_0x9099('0xb')](),clientSideLogs);module[_0x9099('0xc')]=router; \ No newline at end of file +var _0x6e92=['../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service'];(function(_0x3d1d36,_0xf5a9aa){var _0x5e0ade=function(_0x8c4932){while(--_0x8c4932){_0x3d1d36['push'](_0x3d1d36['shift']());}};_0x5e0ade(++_0xf5a9aa);}(_0x6e92,0x16d));var _0x26e9=function(_0x312d76,_0x1bc862){_0x312d76=_0x312d76-0x0;var _0xdc8d9d=_0x6e92[_0x312d76];return _0xdc8d9d;};var beaverLogger=require(_0x26e9('0x0'));var express=require(_0x26e9('0x1'));var auth=require(_0x26e9('0x2'));var config=require(_0x26e9('0x3'));var router=express[_0x26e9('0x4')]();var isProduction=config[_0x26e9('0x5')]===_0x26e9('0x6')||![];function clientSideLogs(_0x93ca44,_0x1ffa1c,_0x65c88b){var _0x2e8400=_0x93ca44[_0x26e9('0x7')][_0x26e9('0x8')](_0x26e9('0x9'));if(!_0x2e8400){throw new Error(_0x26e9('0xa'));}return beaverLogger[_0x26e9('0xb')]({'uri':_0x26e9('0xc'),'logger':_0x2e8400,'enableCors':!isProduction})(_0x93ca44,_0x1ffa1c,_0x65c88b);}router[_0x26e9('0xd')](auth[_0x26e9('0xe')](),clientSideLogs);module[_0x26e9('0xf')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4753b85..8aedcad 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 _0xbc37=['AmazonAWS','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xbc37,0x1c0));var _0x7bc3=function(_0x35d06e,_0x2e3503){_0x35d06e=_0x35d06e-0x0;var _0x9e9053=_0xbc37[_0x35d06e];return _0x9e9053;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7bc3('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7bc3('0x1')](_0x7bc3('0x2'),'Google',_0x7bc3('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x7bc3('0x1')]('Outlook365',_0x7bc3('0x4'))},'data1':{'type':Sequelize[_0x7bc3('0x0')],'comment':_0x7bc3('0x5')},'data2':{'type':Sequelize[_0x7bc3('0x0')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x7bc3('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x7bc3('0x6')],'comment':_0x7bc3('0x7')},'data6':{'type':Sequelize[_0x7bc3('0x6')],'comment':_0x7bc3('0x8')},'data7':{'type':Sequelize[_0x7bc3('0x6')],'comment':_0x7bc3('0x9')}}; \ No newline at end of file +var _0x5e2b=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x1043dd,_0x597e86){var _0x2a7b0f=function(_0x1cb3e7){while(--_0x1cb3e7){_0x1043dd['push'](_0x1043dd['shift']());}};_0x2a7b0f(++_0x597e86);}(_0x5e2b,0x75));var _0xb5e2=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x5e2b[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0xb5e2('0x0'));module[_0xb5e2('0x1')]={'name':{'type':Sequelize[_0xb5e2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb5e2('0x3')](_0xb5e2('0x4'),_0xb5e2('0x5'),_0xb5e2('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xb5e2('0x3')](_0xb5e2('0x7'),_0xb5e2('0x8'))},'data1':{'type':Sequelize[_0xb5e2('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xb5e2('0x2')],'comment':_0xb5e2('0x9')},'data3':{'type':Sequelize[_0xb5e2('0x2')],'comment':_0xb5e2('0xa')},'data4':{'type':Sequelize[_0xb5e2('0x2')],'comment':_0xb5e2('0xb')},'data5':{'type':Sequelize[_0xb5e2('0xc')],'comment':_0xb5e2('0xd')},'data6':{'type':Sequelize[_0xb5e2('0xc')],'comment':_0xb5e2('0xe')},'data7':{'type':Sequelize[_0xb5e2('0xc')],'comment':_0xb5e2('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1176ad7..64900d5 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 _0x8044=['parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../config/environment','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','service','MicrosoftAzure','decryptString','data3','params','rawAttributes','find','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter'];(function(_0x1e08fc,_0x181678){var _0x1e3e4a=function(_0x74d564){while(--_0x74d564){_0x1e08fc['push'](_0x1e08fc['shift']());}};_0x1e3e4a(++_0x181678);}(_0x8044,0x1f0));var _0x4804=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0x8044[_0xce6f11];return _0x35b709;};'use strict';var _=require('lodash');var Redis=require(_0x4804('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x4804('0x1'));var logger=require('../../config/logger')(_0x4804('0x2'));var db=require('../../mysqldb')['db'];var oauth=require(_0x4804('0x3'));config[_0x4804('0x4')]=_[_0x4804('0x5')](config[_0x4804('0x4')],{'host':_0x4804('0x6'),'port':0x18eb});var socket=require(_0x4804('0x7'))(new Redis(config[_0x4804('0x4')]));var redis=new Redis(config[_0x4804('0x4')]);function respondWithStatusCode(_0xf71081,_0x14c831){_0x14c831=_0x14c831||0xcc;return function(_0x5b0282){if(_0x5b0282){return _0xf71081['sendStatus'](_0x14c831);}return _0xf71081[_0x4804('0x8')](_0x14c831)[_0x4804('0x9')]();};}function respondWithResult(_0xa5fff4,_0x4f3267){_0x4f3267=_0x4f3267||0xc8;return function(_0x198007){if(_0x198007){return _0xa5fff4['status'](_0x4f3267)[_0x4804('0xa')](_0x198007);}};}function respondWithFilteredResult(_0x7e886a,_0x187fac){return function(_0x2e6886){if(_0x2e6886){var _0x24595b=typeof _0x187fac[_0x4804('0xb')]===_0x4804('0xc')&&typeof _0x187fac[_0x4804('0xd')]===_0x4804('0xc');var _0x324a26=_0x2e6886[_0x4804('0xe')];var _0x119d06=_0x24595b?0x0:_0x187fac[_0x4804('0xb')];var _0x31ca64=_0x24595b?_0x2e6886[_0x4804('0xe')]:_0x187fac['offset']+_0x187fac[_0x4804('0xd')];var _0x411fcb;if(_0x31ca64>=_0x324a26){_0x31ca64=_0x324a26;_0x411fcb=0xc8;}else{_0x411fcb=0xce;}_0x7e886a['status'](_0x411fcb);return _0x7e886a[_0x4804('0xf')](_0x4804('0x10'),_0x119d06+'-'+_0x31ca64+'/'+_0x324a26)[_0x4804('0xa')](_0x2e6886);}return null;};}function saveUpdates(_0x351e23){return function(_0x4b77fb){if(_0x4b77fb){return _0x4b77fb[_0x4804('0x11')](_0x351e23)['then'](function(_0x84ec75){return _0x84ec75;});}return null;};}function removeEntity(_0x3a4bb0){return function(_0x47ed4f){if(_0x47ed4f){return _0x47ed4f[_0x4804('0x12')]()[_0x4804('0x13')](function(){_0x3a4bb0[_0x4804('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373d66){return function(_0x49c9c8){if(!_0x49c9c8){_0x373d66[_0x4804('0x14')](0x194);}return _0x49c9c8;};}function handleError(_0x1bb182,_0x5596bc){_0x5596bc=_0x5596bc||0x1f4;return function(_0x2d7aad){logger[_0x4804('0x15')](_0x2d7aad[_0x4804('0x16')]);if(_0x2d7aad[_0x4804('0x17')]){delete _0x2d7aad[_0x4804('0x17')];}_0x1bb182[_0x4804('0x8')](_0x5596bc)[_0x4804('0x18')](_0x2d7aad);};}function maskClientSecret(_0x30c0c0){return _[_0x4804('0x19')](_0x30c0c0[_0x4804('0x1a')](0x0,0x3),0x14,'*');}exports[_0x4804('0x1b')]=function(_0x450bc3,_0x41be53){var _0x2319b5={},_0x4df94d={},_0x1c0514={'count':0x0,'rows':[]};var _0x48774a=_[_0x4804('0x1c')](db[_0x4804('0x1d')]['rawAttributes'],function(_0x16ffa7){return{'name':_0x16ffa7[_0x4804('0x1e')],'type':_0x16ffa7[_0x4804('0x1f')][_0x4804('0x20')]};});_0x4df94d[_0x4804('0x21')]=_['map'](_0x48774a,_0x4804('0x17'));_0x4df94d[_0x4804('0x22')]=_[_0x4804('0x23')](_0x450bc3[_0x4804('0x22')]);_0x4df94d[_0x4804('0x24')]=_[_0x4804('0x25')](_0x4df94d[_0x4804('0x21')],_0x4df94d[_0x4804('0x22')]);_0x2319b5['attributes']=_[_0x4804('0x25')](_0x4df94d[_0x4804('0x21')],qs[_0x4804('0x26')](_0x450bc3[_0x4804('0x22')]['fields']));_0x2319b5[_0x4804('0x27')]=_0x2319b5[_0x4804('0x27')][_0x4804('0x28')]?_0x2319b5[_0x4804('0x27')]:_0x4df94d[_0x4804('0x21')];if(!_0x450bc3[_0x4804('0x22')][_0x4804('0x29')](_0x4804('0x2a'))){_0x2319b5[_0x4804('0xd')]=qs[_0x4804('0xd')](_0x450bc3[_0x4804('0x22')][_0x4804('0xd')]);_0x2319b5['offset']=qs['offset'](_0x450bc3[_0x4804('0x22')]['offset']);}_0x2319b5[_0x4804('0x2b')]=qs[_0x4804('0x2c')](_0x450bc3[_0x4804('0x22')][_0x4804('0x2c')]);_0x2319b5[_0x4804('0x2d')]=qs['filters'](_[_0x4804('0x2e')](_0x450bc3['query'],_0x4df94d[_0x4804('0x24')]),_0x48774a);if(_0x450bc3[_0x4804('0x22')][_0x4804('0x2f')]){_0x2319b5[_0x4804('0x2d')]=_['merge'](_0x2319b5[_0x4804('0x2d')],{'$or':_[_0x4804('0x1c')](_0x48774a,function(_0x261fe4){if(_0x261fe4['type']!==_0x4804('0x30')){var _0x3169aa={};_0x3169aa[_0x261fe4[_0x4804('0x17')]]={'$like':'%'+_0x450bc3[_0x4804('0x22')]['filter']+'%'};return _0x3169aa;}})});}_0x2319b5=_[_0x4804('0x31')]({},_0x2319b5,_0x450bc3[_0x4804('0x32')]);var _0x2d0ba2={'where':_0x2319b5['where']};return db[_0x4804('0x1d')][_0x4804('0xe')](_0x2d0ba2)['then'](function(_0x165052){_0x1c0514[_0x4804('0xe')]=_0x165052;if(_0x450bc3[_0x4804('0x22')]['includeAll']){_0x2319b5[_0x4804('0x33')]=[{'all':!![]}];}return db[_0x4804('0x1d')]['findAll'](_0x2319b5);})[_0x4804('0x13')](function(_0x254fc2){_0x1c0514[_0x4804('0x34')]=_[_0x4804('0x1c')](_0x254fc2,function(_0x38b436){if(_0x38b436[_0x4804('0x35')]===_0x4804('0x36')){var _0x9855b=encryptor[_0x4804('0x37')](_0x38b436[_0x4804('0x38')]);_0x38b436[_0x4804('0x38')]=maskClientSecret(_0x9855b);}return _0x38b436;});return _0x1c0514;})[_0x4804('0x13')](respondWithFilteredResult(_0x41be53,_0x2319b5))['catch'](handleError(_0x41be53,null));};exports['show']=function(_0x276470,_0x13c5f3){var _0x385407={'raw':!![],'where':{'id':_0x276470[_0x4804('0x39')]['id']}},_0x239a52={};_0x239a52[_0x4804('0x21')]=_[_0x4804('0x23')](db[_0x4804('0x1d')][_0x4804('0x3a')]);_0x239a52[_0x4804('0x22')]=_[_0x4804('0x23')](_0x276470[_0x4804('0x22')]);_0x239a52['filters']=_[_0x4804('0x25')](_0x239a52[_0x4804('0x21')],_0x239a52[_0x4804('0x22')]);_0x385407[_0x4804('0x27')]=_['intersection'](_0x239a52[_0x4804('0x21')],qs[_0x4804('0x26')](_0x276470[_0x4804('0x22')]['fields']));_0x385407['attributes']=_0x385407['attributes'][_0x4804('0x28')]?_0x385407['attributes']:_0x239a52[_0x4804('0x21')];if(_0x276470[_0x4804('0x22')]['includeAll']){_0x385407[_0x4804('0x33')]=[{'all':!![]}];}_0x385407=_[_0x4804('0x31')]({},_0x385407,_0x276470[_0x4804('0x32')]);return db[_0x4804('0x1d')][_0x4804('0x3b')](_0x385407)[_0x4804('0x13')](handleEntityNotFound(_0x13c5f3,null))[_0x4804('0x13')](function(_0x7448a1){if(_0x7448a1[_0x4804('0x35')]===_0x4804('0x36')){var _0x293455=encryptor['decryptString'](_0x7448a1[_0x4804('0x38')]);_0x7448a1[_0x4804('0x38')]=maskClientSecret(_0x293455);}return _0x7448a1;})[_0x4804('0x13')](respondWithResult(_0x13c5f3,null))[_0x4804('0x3c')](handleError(_0x13c5f3,null));};exports[_0x4804('0x3d')]=function(_0x545f47,_0x16b0b4){if(!_0x545f47[_0x4804('0x3e')][_0x4804('0x17')])throw new Error(_0x4804('0x3f'));if(!_0x545f47[_0x4804('0x3e')][_0x4804('0x35')])throw new Error(_0x4804('0x40'));var _0x3b2d89=db[_0x4804('0x1d')][_0x4804('0x3a')][_0x4804('0x35')][_0x4804('0x41')];if(!_0x3b2d89['includes'](_0x545f47[_0x4804('0x3e')][_0x4804('0x35')]))throw new Error(_0x4804('0x42')+_0x3b2d89['join'](',\x20'));if(_0x545f47[_0x4804('0x3e')][_0x4804('0x35')]===_0x4804('0x36')&&_0x545f47['body']['data3']){_0x545f47[_0x4804('0x3e')][_0x4804('0x38')]=encryptor['encryptString'](_0x545f47[_0x4804('0x3e')][_0x4804('0x38')]);}return db[_0x4804('0x1d')][_0x4804('0x3d')](_0x545f47[_0x4804('0x3e')],{})['then'](respondWithResult(_0x16b0b4,0xc9))[_0x4804('0x3c')](handleError(_0x16b0b4,null));};exports[_0x4804('0x11')]=function(_0x1c554d,_0x454763){if(_0x1c554d[_0x4804('0x3e')]['id']){delete _0x1c554d[_0x4804('0x3e')]['id'];}return db['CloudProvider'][_0x4804('0x3b')]({'where':{'id':_0x1c554d[_0x4804('0x39')]['id']}})['then'](handleEntityNotFound(_0x454763,null))['then'](function(_0x36ffce){if(_0x36ffce['service']===_0x4804('0x36')&&_0x1c554d[_0x4804('0x3e')]['data3']){_0x1c554d[_0x4804('0x3e')][_0x4804('0x38')]=encryptor['encryptString'](_0x1c554d[_0x4804('0x3e')][_0x4804('0x38')]);}return _0x36ffce;})[_0x4804('0x13')](saveUpdates(_0x1c554d[_0x4804('0x3e')],null))[_0x4804('0x13')](respondWithResult(_0x454763,null))['catch'](handleError(_0x454763,null));};exports['destroy']=function(_0x2422ff,_0x275e27){return db[_0x4804('0x1d')][_0x4804('0x3b')]({'where':{'id':_0x2422ff[_0x4804('0x39')]['id']}})['then'](handleEntityNotFound(_0x275e27,null))[_0x4804('0x13')](removeEntity(_0x275e27,null))[_0x4804('0x3c')](handleError(_0x275e27,null));};exports[_0x4804('0x43')]=function(_0x5c0fc2,_0x37610b){return db[_0x4804('0x1d')][_0x4804('0x44')]({'where':{'id':_0x5c0fc2[_0x4804('0x39')]['id']},'raw':!![]})[_0x4804('0x13')](function(_0x25a055){if(!_0x25a055)return _0x37610b['sendStatus'](0x194);return{'url':oauth[_0x4804('0x45')](_0x25a055,_0x5c0fc2[_0x4804('0x46')]['id'])};})[_0x4804('0x13')](respondWithResult(_0x37610b,null))[_0x4804('0x3c')](handleError(_0x37610b,null));};exports[_0x4804('0x47')]=function(_0xb7e661,_0x28b2ff){var _0x5adb48=_0xb7e661[_0x4804('0x3e')];var _0x360ee4;var _0x39293f;if(_0x5adb48[_0x4804('0x15')])throw _0x5adb48;redis['get'](_0x5adb48[_0x4804('0x48')])[_0x4804('0x13')](function(_0x2eabff){if(!_0x2eabff)throw new Error(_0x4804('0x49'));_0x360ee4=JSON[_0x4804('0x4a')](_0x2eabff);var _0x429885=Buffer[_0x4804('0x4b')](_0x5adb48[_0x4804('0x48')],_0x4804('0x4c'))['toString'](_0x4804('0x4d'));_0x39293f=JSON[_0x4804('0x4a')](_0x429885);if(!oauth[_0x4804('0x4e')](_0x5adb48[_0x4804('0x4f')],_0x360ee4[_0x4804('0x50')]))throw new Error(_0x4804('0x51'));redis['del'](_0x5adb48[_0x4804('0x48')]);return oauth[_0x4804('0x52')](_0x5adb48[_0x4804('0x53')],_0x360ee4);})[_0x4804('0x13')](function(_0x298fd9){_0x360ee4[_0x4804('0x54')]=_0x298fd9[_0x4804('0x55')];_0x360ee4[_0x4804('0x56')]=_0x298fd9[_0x4804('0x57')];return db[_0x4804('0x1d')][_0x4804('0x11')]({'data5':_0x360ee4[_0x4804('0x54')],'data6':_0x360ee4[_0x4804('0x56')]},{'where':{'id':_0x360ee4['id']}});})[_0x4804('0x13')](function(){oauth[_0x4804('0x58')](_0x360ee4);socket[_0x4804('0x59')](_0x4804('0x5a'),{'id':_0x39293f['id']});return;})[_0x4804('0x13')](respondWithStatusCode(_0x28b2ff,null))[_0x4804('0x3c')](function(_0x4009a8){if(_0x39293f){socket[_0x4804('0x59')](_0x4804('0x5b'),{'id':_0x39293f['id']});}if(!_0x360ee4){logger['error'](_0x4804('0x5c'),_0x4009a8);return _0x28b2ff[_0x4804('0x8')](0x1f4)[_0x4804('0x18')](_0x4009a8[_0x4804('0x5d')]);}logger[_0x4804('0x15')](_0x4804('0x5e'),_0x360ee4['id'],JSON['stringify'](_0x4009a8));});}; \ No newline at end of file +var _0xa278=['base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','end','offset','limit','undefined','count','status','Content-Range','update','then','destroy','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','params','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','catch','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xa278,0x18b));var _0x8a27=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xa278[_0x376db5];return _0x304c17;};'use strict';var _=require(_0x8a27('0x0'));var Redis=require(_0x8a27('0x1'));var qs=require(_0x8a27('0x2'));var encryptor=require(_0x8a27('0x3'));var config=require(_0x8a27('0x4'));var logger=require(_0x8a27('0x5'))(_0x8a27('0x6'));var db=require(_0x8a27('0x7'))['db'];var oauth=require(_0x8a27('0x8'));config[_0x8a27('0x9')]=_['defaults'](config[_0x8a27('0x9')],{'host':_0x8a27('0xa'),'port':0x18eb});var socket=require(_0x8a27('0xb'))(new Redis(config[_0x8a27('0x9')]));var redis=new Redis(config[_0x8a27('0x9')]);function respondWithStatusCode(_0xd1fee8,_0x5963bc){_0x5963bc=_0x5963bc||0xcc;return function(_0x5a2b50){if(_0x5a2b50){return _0xd1fee8[_0x8a27('0xc')](_0x5963bc);}return _0xd1fee8['status'](_0x5963bc)[_0x8a27('0xd')]();};}function respondWithResult(_0x316a13,_0xdd8aa1){_0xdd8aa1=_0xdd8aa1||0xc8;return function(_0x58581b){if(_0x58581b){return _0x316a13['status'](_0xdd8aa1)['json'](_0x58581b);}};}function respondWithFilteredResult(_0x52ec82,_0x1cbd44){return function(_0x2a42df){if(_0x2a42df){var _0x2e7925=typeof _0x1cbd44[_0x8a27('0xe')]==='undefined'&&typeof _0x1cbd44[_0x8a27('0xf')]===_0x8a27('0x10');var _0x2f36cc=_0x2a42df[_0x8a27('0x11')];var _0x11a57d=_0x2e7925?0x0:_0x1cbd44[_0x8a27('0xe')];var _0x331acd=_0x2e7925?_0x2a42df[_0x8a27('0x11')]:_0x1cbd44['offset']+_0x1cbd44[_0x8a27('0xf')];var _0x2ffd96;if(_0x331acd>=_0x2f36cc){_0x331acd=_0x2f36cc;_0x2ffd96=0xc8;}else{_0x2ffd96=0xce;}_0x52ec82[_0x8a27('0x12')](_0x2ffd96);return _0x52ec82['set'](_0x8a27('0x13'),_0x11a57d+'-'+_0x331acd+'/'+_0x2f36cc)['json'](_0x2a42df);}return null;};}function saveUpdates(_0x2c44a7){return function(_0x4efd17){if(_0x4efd17){return _0x4efd17[_0x8a27('0x14')](_0x2c44a7)[_0x8a27('0x15')](function(_0x500e0c){return _0x500e0c;});}return null;};}function removeEntity(_0x22cca8){return function(_0x4ca7db){if(_0x4ca7db){return _0x4ca7db[_0x8a27('0x16')]()['then'](function(){_0x22cca8[_0x8a27('0x12')](0xcc)[_0x8a27('0xd')]();});}};}function handleEntityNotFound(_0x4c56c5){return function(_0x33d3f8){if(!_0x33d3f8){_0x4c56c5[_0x8a27('0xc')](0x194);}return _0x33d3f8;};}function handleError(_0x307a72,_0x47c77d){_0x47c77d=_0x47c77d||0x1f4;return function(_0xe7e108){logger[_0x8a27('0x17')](_0xe7e108['stack']);if(_0xe7e108[_0x8a27('0x18')]){delete _0xe7e108[_0x8a27('0x18')];}_0x307a72[_0x8a27('0x12')](_0x47c77d)[_0x8a27('0x19')](_0xe7e108);};}function maskClientSecret(_0x39f661){return _[_0x8a27('0x1a')](_0x39f661[_0x8a27('0x1b')](0x0,0x3),0x14,'*');}exports[_0x8a27('0x1c')]=function(_0x5228d1,_0x2299a6){var _0x4a88ef={},_0x11134a={},_0xba86db={'count':0x0,'rows':[]};var _0x219e43=_[_0x8a27('0x1d')](db[_0x8a27('0x1e')][_0x8a27('0x1f')],function(_0x5aeabd){return{'name':_0x5aeabd['fieldName'],'type':_0x5aeabd[_0x8a27('0x20')][_0x8a27('0x21')]};});_0x11134a[_0x8a27('0x22')]=_[_0x8a27('0x1d')](_0x219e43,'name');_0x11134a[_0x8a27('0x23')]=_[_0x8a27('0x24')](_0x5228d1[_0x8a27('0x23')]);_0x11134a[_0x8a27('0x25')]=_[_0x8a27('0x26')](_0x11134a['model'],_0x11134a[_0x8a27('0x23')]);_0x4a88ef['attributes']=_[_0x8a27('0x26')](_0x11134a[_0x8a27('0x22')],qs['fields'](_0x5228d1['query'][_0x8a27('0x27')]));_0x4a88ef[_0x8a27('0x28')]=_0x4a88ef['attributes'][_0x8a27('0x29')]?_0x4a88ef[_0x8a27('0x28')]:_0x11134a[_0x8a27('0x22')];if(!_0x5228d1[_0x8a27('0x23')][_0x8a27('0x2a')](_0x8a27('0x2b'))){_0x4a88ef[_0x8a27('0xf')]=qs['limit'](_0x5228d1[_0x8a27('0x23')]['limit']);_0x4a88ef['offset']=qs[_0x8a27('0xe')](_0x5228d1[_0x8a27('0x23')]['offset']);}_0x4a88ef['order']=qs['sort'](_0x5228d1[_0x8a27('0x23')]['sort']);_0x4a88ef[_0x8a27('0x2c')]=qs[_0x8a27('0x25')](_['pick'](_0x5228d1['query'],_0x11134a[_0x8a27('0x25')]),_0x219e43);if(_0x5228d1[_0x8a27('0x23')][_0x8a27('0x2d')]){_0x4a88ef[_0x8a27('0x2c')]=_['merge'](_0x4a88ef[_0x8a27('0x2c')],{'$or':_[_0x8a27('0x1d')](_0x219e43,function(_0x42d725){if(_0x42d725[_0x8a27('0x20')]!==_0x8a27('0x2e')){var _0x46e809={};_0x46e809[_0x42d725[_0x8a27('0x18')]]={'$like':'%'+_0x5228d1[_0x8a27('0x23')][_0x8a27('0x2d')]+'%'};return _0x46e809;}})});}_0x4a88ef=_[_0x8a27('0x2f')]({},_0x4a88ef,_0x5228d1[_0x8a27('0x30')]);var _0x262556={'where':_0x4a88ef['where']};return db['CloudProvider'][_0x8a27('0x11')](_0x262556)[_0x8a27('0x15')](function(_0x3c4dd4){_0xba86db[_0x8a27('0x11')]=_0x3c4dd4;if(_0x5228d1[_0x8a27('0x23')][_0x8a27('0x31')]){_0x4a88ef[_0x8a27('0x32')]=[{'all':!![]}];}return db['CloudProvider'][_0x8a27('0x33')](_0x4a88ef);})[_0x8a27('0x15')](function(_0x121d2c){_0xba86db[_0x8a27('0x34')]=_[_0x8a27('0x1d')](_0x121d2c,function(_0xa8c72d){if(_0xa8c72d[_0x8a27('0x35')]===_0x8a27('0x36')){var _0x4b43d2=encryptor[_0x8a27('0x37')](_0xa8c72d[_0x8a27('0x38')]);_0xa8c72d[_0x8a27('0x38')]=maskClientSecret(_0x4b43d2);}return _0xa8c72d;});return _0xba86db;})[_0x8a27('0x15')](respondWithFilteredResult(_0x2299a6,_0x4a88ef))['catch'](handleError(_0x2299a6,null));};exports[_0x8a27('0x39')]=function(_0x32f8fb,_0x238e62){var _0x2f640a={'raw':!![],'where':{'id':_0x32f8fb['params']['id']}},_0xba44b7={};_0xba44b7['model']=_[_0x8a27('0x24')](db['CloudProvider'][_0x8a27('0x1f')]);_0xba44b7[_0x8a27('0x23')]=_[_0x8a27('0x24')](_0x32f8fb['query']);_0xba44b7[_0x8a27('0x25')]=_[_0x8a27('0x26')](_0xba44b7[_0x8a27('0x22')],_0xba44b7[_0x8a27('0x23')]);_0x2f640a[_0x8a27('0x28')]=_[_0x8a27('0x26')](_0xba44b7[_0x8a27('0x22')],qs['fields'](_0x32f8fb[_0x8a27('0x23')][_0x8a27('0x27')]));_0x2f640a[_0x8a27('0x28')]=_0x2f640a['attributes'][_0x8a27('0x29')]?_0x2f640a[_0x8a27('0x28')]:_0xba44b7[_0x8a27('0x22')];if(_0x32f8fb['query']['includeAll']){_0x2f640a[_0x8a27('0x32')]=[{'all':!![]}];}_0x2f640a=_[_0x8a27('0x2f')]({},_0x2f640a,_0x32f8fb['options']);return db[_0x8a27('0x1e')][_0x8a27('0x3a')](_0x2f640a)[_0x8a27('0x15')](handleEntityNotFound(_0x238e62,null))['then'](function(_0x1b1dda){if(_0x1b1dda[_0x8a27('0x35')]===_0x8a27('0x36')){var _0x50f980=encryptor[_0x8a27('0x37')](_0x1b1dda[_0x8a27('0x38')]);_0x1b1dda['data3']=maskClientSecret(_0x50f980);}return _0x1b1dda;})[_0x8a27('0x15')](respondWithResult(_0x238e62,null))['catch'](handleError(_0x238e62,null));};exports[_0x8a27('0x3b')]=function(_0xe9c937,_0x3fd34a){if(!_0xe9c937[_0x8a27('0x3c')][_0x8a27('0x18')])throw new Error(_0x8a27('0x3d'));if(!_0xe9c937[_0x8a27('0x3c')]['service'])throw new Error(_0x8a27('0x3e'));var _0x497c7e=db['CloudProvider']['rawAttributes']['service']['values'];if(!_0x497c7e[_0x8a27('0x3f')](_0xe9c937['body']['service']))throw new Error(_0x8a27('0x40')+_0x497c7e['join'](',\x20'));if(_0xe9c937[_0x8a27('0x3c')][_0x8a27('0x35')]===_0x8a27('0x36')&&_0xe9c937[_0x8a27('0x3c')]['data3']){_0xe9c937[_0x8a27('0x3c')][_0x8a27('0x38')]=encryptor[_0x8a27('0x41')](_0xe9c937[_0x8a27('0x3c')][_0x8a27('0x38')]);}return db[_0x8a27('0x1e')][_0x8a27('0x3b')](_0xe9c937[_0x8a27('0x3c')],{})[_0x8a27('0x15')](respondWithResult(_0x3fd34a,0xc9))['catch'](handleError(_0x3fd34a,null));};exports[_0x8a27('0x14')]=function(_0x3631c0,_0x53f223){if(_0x3631c0[_0x8a27('0x3c')]['id']){delete _0x3631c0[_0x8a27('0x3c')]['id'];}return db[_0x8a27('0x1e')]['find']({'where':{'id':_0x3631c0[_0x8a27('0x42')]['id']}})['then'](handleEntityNotFound(_0x53f223,null))[_0x8a27('0x15')](function(_0x1832fa){if(_0x1832fa['service']===_0x8a27('0x36')&&_0x3631c0[_0x8a27('0x3c')]['data3']){_0x3631c0['body'][_0x8a27('0x38')]=encryptor['encryptString'](_0x3631c0[_0x8a27('0x3c')][_0x8a27('0x38')]);}return _0x1832fa;})[_0x8a27('0x15')](saveUpdates(_0x3631c0[_0x8a27('0x3c')],null))[_0x8a27('0x15')](respondWithResult(_0x53f223,null))['catch'](handleError(_0x53f223,null));};exports[_0x8a27('0x16')]=function(_0x4c74ae,_0x2c71c7){return db['CloudProvider']['find']({'where':{'id':_0x4c74ae[_0x8a27('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c71c7,null))[_0x8a27('0x15')](removeEntity(_0x2c71c7,null))['catch'](handleError(_0x2c71c7,null));};exports[_0x8a27('0x43')]=function(_0x530074,_0xb4a8d9){return db[_0x8a27('0x1e')]['findOne']({'where':{'id':_0x530074[_0x8a27('0x42')]['id']},'raw':!![]})[_0x8a27('0x15')](function(_0x4f7fa6){if(!_0x4f7fa6)return _0xb4a8d9[_0x8a27('0xc')](0x194);return{'url':oauth[_0x8a27('0x44')](_0x4f7fa6,_0x530074['user']['id'])};})[_0x8a27('0x15')](respondWithResult(_0xb4a8d9,null))[_0x8a27('0x45')](handleError(_0xb4a8d9,null));};exports[_0x8a27('0x46')]=function(_0x1d4a87,_0x35fa90){var _0x4bf3fc=_0x1d4a87[_0x8a27('0x3c')];var _0x4ff0fc;var _0x5f3e70;if(_0x4bf3fc[_0x8a27('0x17')])throw _0x4bf3fc;redis['get'](_0x4bf3fc[_0x8a27('0x47')])['then'](function(_0x2a5800){if(!_0x2a5800)throw new Error(_0x8a27('0x48'));_0x4ff0fc=JSON[_0x8a27('0x49')](_0x2a5800);var _0x5def25=Buffer[_0x8a27('0x4a')](_0x4bf3fc[_0x8a27('0x47')],_0x8a27('0x4b'))[_0x8a27('0x4c')](_0x8a27('0x4d'));_0x5f3e70=JSON[_0x8a27('0x49')](_0x5def25);if(!oauth['isValidIdToken'](_0x4bf3fc[_0x8a27('0x4e')],_0x4ff0fc[_0x8a27('0x4f')]))throw new Error(_0x8a27('0x50'));redis['del'](_0x4bf3fc[_0x8a27('0x47')]);return oauth[_0x8a27('0x51')](_0x4bf3fc[_0x8a27('0x52')],_0x4ff0fc);})[_0x8a27('0x15')](function(_0x533193){_0x4ff0fc['data5']=_0x533193[_0x8a27('0x53')];_0x4ff0fc[_0x8a27('0x54')]=_0x533193[_0x8a27('0x55')];return db[_0x8a27('0x1e')][_0x8a27('0x14')]({'data5':_0x4ff0fc[_0x8a27('0x56')],'data6':_0x4ff0fc[_0x8a27('0x54')]},{'where':{'id':_0x4ff0fc['id']}});})[_0x8a27('0x15')](function(){oauth['startRefreshInterval'](_0x4ff0fc);socket[_0x8a27('0x57')](_0x8a27('0x58'),{'id':_0x5f3e70['id']});return;})[_0x8a27('0x15')](respondWithStatusCode(_0x35fa90,null))[_0x8a27('0x45')](function(_0x3765aa){if(_0x5f3e70){socket[_0x8a27('0x57')](_0x8a27('0x59'),{'id':_0x5f3e70['id']});}if(!_0x4ff0fc){logger[_0x8a27('0x17')](_0x8a27('0x5a'),_0x3765aa);return _0x35fa90['status'](0x1f4)[_0x8a27('0x19')](_0x3765aa[_0x8a27('0x5b')]);}logger[_0x8a27('0x17')](_0x8a27('0x5c'),_0x4ff0fc['id'],JSON[_0x8a27('0x5d')](_0x3765aa));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index bb18aa0..2d6222c 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 _0xe420=['rimraf','define','CloudProvider','lodash','util','bluebird','request-promise'];(function(_0x698e7a,_0x1351bb){var _0x196a50=function(_0x28d790){while(--_0x28d790){_0x698e7a['push'](_0x698e7a['shift']());}};_0x196a50(++_0x1351bb);}(_0xe420,0x7a));var _0x0e42=function(_0x418ad6,_0x234284){_0x418ad6=_0x418ad6-0x0;var _0x9aa86f=_0xe420[_0x418ad6];return _0x9aa86f;};'use strict';var _=require(_0x0e42('0x0'));var util=require(_0x0e42('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0e42('0x2'));var rp=require(_0x0e42('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e42('0x4'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x1a16bf,_0x34ffe2){return _0x1a16bf[_0x0e42('0x5')](_0x0e42('0x6'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31a5=['api','moment','request-promise','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','../../config/logger'];(function(_0x58f65e,_0x467d61){var _0x35684b=function(_0x17cafe){while(--_0x17cafe){_0x58f65e['push'](_0x58f65e['shift']());}};_0x35684b(++_0x467d61);}(_0x31a5,0xe9));var _0x531a=function(_0x418fd0,_0xf95890){_0x418fd0=_0x418fd0-0x0;var _0x1e569d=_0x31a5[_0x418fd0];return _0x1e569d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x531a('0x0'))(_0x531a('0x1'));var moment=require(_0x531a('0x2'));var BPromise=require('bluebird');var rp=require(_0x531a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x531a('0x4'));var config=require('../../config/environment');var attributes=require(_0x531a('0x5'));module[_0x531a('0x6')]=function(_0x4706d7,_0x373f0b){return _0x4706d7[_0x531a('0x7')](_0x531a('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 7dbb3e8..bb5ea4d 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 _0x0dbf=['unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','update','catch','authorization_code','intervals','bind','findAll','all','error','exports','lodash','crypto','jsonwebtoken','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','profile','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','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','prompt','login','map','key','value','oauth2Claims','oauth2/','decode','payload','iss','issuer','aud','audience','nonce','isAfter'];(function(_0x1629c9,_0x484a8c){var _0x350a80=function(_0x2ddcb7){while(--_0x2ddcb7){_0x1629c9['push'](_0x1629c9['shift']());}};_0x350a80(++_0x484a8c);}(_0x0dbf,0x1a9));var _0xf0db=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x0dbf[_0x367336];return _0x3423a7;};'use strict';var _=require(_0xf0db('0x0'));var crypto=require(_0xf0db('0x1'));var jwt=require(_0xf0db('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0xf0db('0x3'));var encryptor=require(_0xf0db('0x4'));var config=require(_0xf0db('0x5'));var logger=require('../../config/logger')(_0xf0db('0x6'));var schedule=require(_0xf0db('0x7'));var db=require(_0xf0db('0x8'))['db'];config[_0xf0db('0x9')]=_[_0xf0db('0xa')](config[_0xf0db('0x9')],{'host':_0xf0db('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xf0db('0xc'),_0xf0db('0xd'),'email',_0xf0db('0xe'),_0xf0db('0xf'),_0xf0db('0x10'),_0xf0db('0x11')],'Dynamics365':['openid',_0xf0db('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0xf0db('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xf0db('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3dfec7){var _0x1b257d=_['map'](AZURE_AUTH_SCOPES[_0x3dfec7[_0xf0db('0x14')]]);if(_0x3dfec7[_0xf0db('0x14')]==='Dynamics365')_0x1b257d[_0xf0db('0x15')](_0x3dfec7[_0xf0db('0x16')]+_0xf0db('0x17'));return _0x1b257d['join']('\x20');}function getAccessTokenScope(_0xc8f9e1){if(_0xc8f9e1['type']===_0xf0db('0x18'))return _0xf0db('0xf');if(_0xc8f9e1[_0xf0db('0x14')]===_0xf0db('0x19'))return _0xc8f9e1['data7']+_0xf0db('0x17');}function generateMicrosoftAuthorizationUrl(_0xa19108,_0x2fc126){var _0x4982fa=MICROSOFT_AUTH_URL[_0xf0db('0x1a')](_0xf0db('0x1b'),_0xa19108[_0xf0db('0x1c')]);var _0x3f3166=[_0xf0db('0x1d'),_0xf0db('0x1e')];var _0x5e9b78=Buffer[_0xf0db('0x1f')](JSON[_0xf0db('0x20')]({'id':_0x2fc126}))[_0xf0db('0x21')](_0xf0db('0x22'));var _0x21dbc3=crypto[_0xf0db('0x23')](0x10)[_0xf0db('0x21')]('hex');var _0x30f9a2=getAuthorizationScopes(_0xa19108);var _0x4213ee=[{'key':_0xf0db('0x24'),'value':_0xa19108[_0xf0db('0x25')]},{'key':_0xf0db('0x26'),'value':encodeURIComponent(_0x3f3166[_0xf0db('0x27')]('\x20'))},{'key':_0xf0db('0x28'),'value':_0xa19108[_0xf0db('0x29')]},{'key':_0xf0db('0x2a'),'value':_0xf0db('0x2b')},{'key':_0xf0db('0x2c'),'value':encodeURIComponent(_0x30f9a2)},{'key':_0xf0db('0x2d'),'value':_0x5e9b78},{'key':'nonce','value':_0x21dbc3},{'key':_0xf0db('0x2e'),'value':_0xf0db('0x2f')}];var _0x207408=_0x4982fa+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xf0db('0x30')](_0x4213ee,function(_0x1cc976){return _0x1cc976[_0xf0db('0x31')]+'='+_0x1cc976[_0xf0db('0x32')];})['join']('&');_0xa19108[_0xf0db('0x33')]={'issuer':_0x4982fa['replace'](_0xf0db('0x34'),''),'audience':_0xa19108[_0xf0db('0x25')],'state':_0x5e9b78,'nonce':_0x21dbc3};redis['set'](_0x5e9b78,JSON[_0xf0db('0x20')](_0xa19108));return _0x207408;}function isValidIdToken(_0x18eac2,_0x4217d8){try{var _0x4dfcc4=jwt[_0xf0db('0x35')](_0x18eac2,{'complete':!![]});var _0x343fb8=_0x4dfcc4[_0xf0db('0x36')];if(_0x343fb8[_0xf0db('0x37')]!==_0x4217d8[_0xf0db('0x38')])return![];if(_0x343fb8[_0xf0db('0x39')]!==_0x4217d8[_0xf0db('0x3a')])return![];if(_0x343fb8[_0xf0db('0x3b')]!==_0x4217d8[_0xf0db('0x3b')])return![];if(moment()[_0xf0db('0x3c')](moment[_0xf0db('0x3d')](_0x343fb8[_0xf0db('0x3e')])))return![];return!![];}catch(_0x4dd201){throw _0x4dd201;}}function refreshOauth2MicrosoftAccessToken(_0x2ae2ef){return Promise[_0xf0db('0x3f')]()[_0xf0db('0x40')](function(){if(_0x2ae2ef['data3'])return _0x2ae2ef;return db[_0xf0db('0x41')][_0xf0db('0x42')]({'where':{'id':_0x2ae2ef['id']},'raw':!![]});})[_0xf0db('0x40')](function(_0x2e6f49){var _0x3115f8={'grant_type':_0xf0db('0x43'),'refresh_token':_0x2e6f49[_0xf0db('0x44')],'scope':getAccessTokenScope(_0x2e6f49),'redirect_uri':_0x2e6f49[_0xf0db('0x29')],'client_id':_0x2e6f49[_0xf0db('0x25')],'client_secret':encryptor[_0xf0db('0x45')](_0x2e6f49[_0xf0db('0x46')])};var _0x186c83={'method':_0xf0db('0x47'),'uri':MICROSOFT_AUTH_URL[_0xf0db('0x1a')](_0xf0db('0x1b'),_0x2e6f49[_0xf0db('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3115f8,'json':!![]};return rp(_0x186c83);})[_0xf0db('0x40')](function(_0x5ab100){_0x2ae2ef['data5']=_0x5ab100['access_token'];_0x2ae2ef[_0xf0db('0x44')]=_0x5ab100[_0xf0db('0x43')];return db[_0xf0db('0x41')][_0xf0db('0x48')]({'data5':_0x2ae2ef['data5'],'data6':_0x2ae2ef[_0xf0db('0x44')]},{'where':{'id':_0x2ae2ef['id']}});})[_0xf0db('0x40')](function(){return _0x2ae2ef;})[_0xf0db('0x49')](function(_0x36fd77){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x2ae2ef['id'],_0x36fd77);});}function getOauth2MicrosoftAccessToken(_0x3216db,_0x1a5070){var _0x4b6b26={'grant_type':_0xf0db('0x4a'),'code':_0x3216db,'scope':getAccessTokenScope(_0x1a5070),'redirect_uri':_0x1a5070['data4'],'client_id':_0x1a5070[_0xf0db('0x25')],'client_secret':encryptor[_0xf0db('0x45')](_0x1a5070[_0xf0db('0x46')])};var _0x1ee384={'method':_0xf0db('0x47'),'uri':MICROSOFT_AUTH_URL[_0xf0db('0x1a')](_0xf0db('0x1b'),_0x1a5070[_0xf0db('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4b6b26,'json':!![]};return rp(_0x1ee384);}function startRefreshInterval(_0x59ffb3){var _0x15dcc0=schedule[_0xf0db('0x4b')];if(_0x15dcc0[_0x59ffb3['id']])clearInterval(_0x15dcc0[_0x59ffb3['id']]);_0x15dcc0[_0x59ffb3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf0db('0x4c')](this,{'id':_0x59ffb3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf0db('0x4b')]=_0x15dcc0;}function startAllRefreshIntervals(){return db[_0xf0db('0x41')][_0xf0db('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x22f4b2){var _0x416c8b=_0x22f4b2[_0xf0db('0x30')](function(_0x35a11d){return refreshOauth2MicrosoftAccessToken(_0x35a11d)['then'](function(_0x3abb80){startRefreshInterval(_0x3abb80);});});return Promise[_0xf0db('0x4e')](_0x416c8b);})[_0xf0db('0x49')](function(_0xeeb2ce){var _0x359105=_0xeeb2ce?util['inspect'](_0xeeb2ce,{'showHidden':![],'depth':null}):'';logger[_0xf0db('0x4f')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x359105);});}module[_0xf0db('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xc82a=['data2','code','id_token','from','toString','randomBytes','client_id','response_mode','form_post','state','nonce','prompt','login','key','replace','oauth2/','set','stringify','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','refresh_token','data6','data4','data1','decryptString','data3','POST','data5','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','error','exports','lodash','jsonwebtoken','ioredis','request-promise','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/token','map','type','Dynamics365','push','data7','join','Outlook365','/.default','{TENANT_ID}'];(function(_0x33a974,_0x24ae0d){var _0x315850=function(_0x1aa4b8){while(--_0x1aa4b8){_0x33a974['push'](_0x33a974['shift']());}};_0x315850(++_0x24ae0d);}(_0xc82a,0x15c));var _0xac82=function(_0x318807,_0x51678f){_0x318807=_0x318807-0x0;var _0x33ea7e=_0xc82a[_0x318807];return _0x33ea7e;};'use strict';var _=require(_0xac82('0x0'));var crypto=require('crypto');var jwt=require(_0xac82('0x1'));var moment=require('moment');var Redis=require(_0xac82('0x2'));var rp=require(_0xac82('0x3'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0xac82('0x4'));var logger=require(_0xac82('0x5'))(_0xac82('0x6'));var schedule=require(_0xac82('0x7'));var db=require(_0xac82('0x8'))['db'];config[_0xac82('0x9')]=_[_0xac82('0xa')](config[_0xac82('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xac82('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xac82('0xc'),_0xac82('0xd'),'email',_0xac82('0xe'),_0xac82('0xf'),_0xac82('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xac82('0xc'),_0xac82('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xac82('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5d2b17){var _0x30e9a8=_[_0xac82('0x12')](AZURE_AUTH_SCOPES[_0x5d2b17[_0xac82('0x13')]]);if(_0x5d2b17[_0xac82('0x13')]===_0xac82('0x14'))_0x30e9a8[_0xac82('0x15')](_0x5d2b17[_0xac82('0x16')]+'/.default');return _0x30e9a8[_0xac82('0x17')]('\x20');}function getAccessTokenScope(_0x543b62){if(_0x543b62[_0xac82('0x13')]===_0xac82('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x543b62['type']===_0xac82('0x14'))return _0x543b62[_0xac82('0x16')]+_0xac82('0x19');}function generateMicrosoftAuthorizationUrl(_0xb5967d,_0x4faabf){var _0x544226=MICROSOFT_AUTH_URL['replace'](_0xac82('0x1a'),_0xb5967d[_0xac82('0x1b')]);var _0x4f4a14=[_0xac82('0x1c'),_0xac82('0x1d')];var _0x4a6961=Buffer[_0xac82('0x1e')](JSON['stringify']({'id':_0x4faabf}))[_0xac82('0x1f')]('base64');var _0x1d438b=crypto[_0xac82('0x20')](0x10)[_0xac82('0x1f')]('hex');var _0x4b71df=getAuthorizationScopes(_0xb5967d);var _0x32f989=[{'key':_0xac82('0x21'),'value':_0xb5967d['data1']},{'key':'response_type','value':encodeURIComponent(_0x4f4a14[_0xac82('0x17')]('\x20'))},{'key':'redirect_uri','value':_0xb5967d['data4']},{'key':_0xac82('0x22'),'value':_0xac82('0x23')},{'key':'scope','value':encodeURIComponent(_0x4b71df)},{'key':_0xac82('0x24'),'value':_0x4a6961},{'key':_0xac82('0x25'),'value':_0x1d438b},{'key':_0xac82('0x26'),'value':_0xac82('0x27')}];var _0x30d932=_0x544226+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xac82('0x12')](_0x32f989,function(_0x1b2f1f){return _0x1b2f1f[_0xac82('0x28')]+'='+_0x1b2f1f['value'];})['join']('&');_0xb5967d['oauth2Claims']={'issuer':_0x544226[_0xac82('0x29')](_0xac82('0x2a'),''),'audience':_0xb5967d['data1'],'state':_0x4a6961,'nonce':_0x1d438b};redis[_0xac82('0x2b')](_0x4a6961,JSON[_0xac82('0x2c')](_0xb5967d));return _0x30d932;}function isValidIdToken(_0x26878e,_0x31715b){try{var _0x155dba=jwt[_0xac82('0x2d')](_0x26878e,{'complete':!![]});var _0x1f100c=_0x155dba[_0xac82('0x2e')];if(_0x1f100c['iss']!==_0x31715b[_0xac82('0x2f')])return![];if(_0x1f100c[_0xac82('0x30')]!==_0x31715b[_0xac82('0x31')])return![];if(_0x1f100c['nonce']!==_0x31715b[_0xac82('0x25')])return![];if(moment()[_0xac82('0x32')](moment[_0xac82('0x33')](_0x1f100c[_0xac82('0x34')])))return![];return!![];}catch(_0x4c6c4f){throw _0x4c6c4f;}}function refreshOauth2MicrosoftAccessToken(_0x2c348f){return Promise[_0xac82('0x35')]()[_0xac82('0x36')](function(){if(_0x2c348f['data3'])return _0x2c348f;return db[_0xac82('0x37')]['findOne']({'where':{'id':_0x2c348f['id']},'raw':!![]});})[_0xac82('0x36')](function(_0x44e787){var _0x243c84={'grant_type':_0xac82('0x38'),'refresh_token':_0x44e787[_0xac82('0x39')],'scope':getAccessTokenScope(_0x44e787),'redirect_uri':_0x44e787[_0xac82('0x3a')],'client_id':_0x44e787[_0xac82('0x3b')],'client_secret':encryptor[_0xac82('0x3c')](_0x44e787[_0xac82('0x3d')])};var _0x3c76ff={'method':_0xac82('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xac82('0x29')](_0xac82('0x1a'),_0x44e787['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x243c84,'json':!![]};return rp(_0x3c76ff);})[_0xac82('0x36')](function(_0xe55ad5){_0x2c348f[_0xac82('0x3f')]=_0xe55ad5['access_token'];_0x2c348f['data6']=_0xe55ad5[_0xac82('0x38')];return db[_0xac82('0x37')][_0xac82('0x40')]({'data5':_0x2c348f[_0xac82('0x3f')],'data6':_0x2c348f[_0xac82('0x39')]},{'where':{'id':_0x2c348f['id']}});})[_0xac82('0x36')](function(){return _0x2c348f;})[_0xac82('0x41')](function(_0x50455d){logger['error'](_0xac82('0x42'),_0x2c348f['id'],_0x50455d);});}function getOauth2MicrosoftAccessToken(_0x6399a1,_0x3a21e4){var _0x14e9cb={'grant_type':_0xac82('0x43'),'code':_0x6399a1,'scope':getAccessTokenScope(_0x3a21e4),'redirect_uri':_0x3a21e4[_0xac82('0x3a')],'client_id':_0x3a21e4[_0xac82('0x3b')],'client_secret':encryptor[_0xac82('0x3c')](_0x3a21e4[_0xac82('0x3d')])};var _0x53e23b={'method':_0xac82('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xac82('0x29')](_0xac82('0x1a'),_0x3a21e4[_0xac82('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x14e9cb,'json':!![]};return rp(_0x53e23b);}function startRefreshInterval(_0x58a3e0){var _0x3b744a=schedule[_0xac82('0x44')];if(_0x3b744a[_0x58a3e0['id']])clearInterval(_0x3b744a[_0x58a3e0['id']]);_0x3b744a[_0x58a3e0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xac82('0x45')](this,{'id':_0x58a3e0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xac82('0x44')]=_0x3b744a;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xac82('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x14d945){var _0x20b0f5=_0x14d945[_0xac82('0x12')](function(_0x26b4bf){return refreshOauth2MicrosoftAccessToken(_0x26b4bf)['then'](function(_0x2236a3){startRefreshInterval(_0x2236a3);});});return Promise[_0xac82('0x47')](_0x20b0f5);})[_0xac82('0x41')](function(_0x1caf6a){var _0x1d3b87=_0x1caf6a?util[_0xac82('0x48')](_0x1caf6a,{'showHidden':![],'depth':null}):'';logger[_0xac82('0x49')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x1d3b87);});}module[_0xac82('0x4a')]={'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 37f0dcc..d46a790 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 _0x3fce=['info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then'];(function(_0x4d3a1a,_0x42a3cf){var _0x1e85ca=function(_0x3b27d3){while(--_0x3b27d3){_0x4d3a1a['push'](_0x4d3a1a['shift']());}};_0x1e85ca(++_0x42a3cf);}(_0x3fce,0x121));var _0xe3fc=function(_0x272d8a,_0x45184b){_0x272d8a=_0x272d8a-0x0;var _0x26286e=_0x3fce[_0x272d8a];return _0x26286e;};'use strict';var _=require('lodash');var util=require(_0xe3fc('0x0'));var moment=require(_0xe3fc('0x1'));var BPromise=require(_0xe3fc('0x2'));var rs=require(_0xe3fc('0x3'));var fs=require('fs');var Redis=require(_0xe3fc('0x4'));var db=require(_0xe3fc('0x5'))['db'];var utils=require(_0xe3fc('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe3fc('0x7')][_0xe3fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x523982,_0x200715,_0x49c611){return new BPromise(function(_0x40660f,_0x4a192d){return client[_0xe3fc('0x9')](_0x523982,_0x49c611)[_0xe3fc('0xa')](function(_0x1bb7be){logger[_0xe3fc('0xb')](_0xe3fc('0xc'),_0x200715,'request\x20sent');logger['debug'](_0xe3fc('0xd'),_0x200715,_0xe3fc('0xe'),JSON[_0xe3fc('0xf')](_0x1bb7be));if(_0x1bb7be['error']){if(_0x1bb7be[_0xe3fc('0x10')][_0xe3fc('0x11')]===0x1f4){logger[_0xe3fc('0x10')](_0xe3fc('0xc'),_0x200715,_0x1bb7be[_0xe3fc('0x10')][_0xe3fc('0x12')]);return _0x4a192d(_0x1bb7be[_0xe3fc('0x10')]['message']);}logger[_0xe3fc('0x10')](_0xe3fc('0xc'),_0x200715,_0x1bb7be['error'][_0xe3fc('0x12')]);return _0x40660f(_0x1bb7be[_0xe3fc('0x10')]['message']);}else{logger[_0xe3fc('0xb')](_0xe3fc('0xc'),_0x200715,'request\x20sent');_0x40660f(_0x1bb7be['result']['message']);}})[_0xe3fc('0x13')](function(_0x4283be){logger[_0xe3fc('0x10')]('CloudProvider,\x20%s,\x20%s',_0x200715,_0x4283be);_0x4a192d(_0x4283be);});});} \ No newline at end of file +var _0x4213=['CloudProvider,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5b8bec,_0x57d320){var _0x44b227=function(_0x26fb73){while(--_0x26fb73){_0x5b8bec['push'](_0x5b8bec['shift']());}};_0x44b227(++_0x57d320);}(_0x4213,0x77));var _0x3421=function(_0x573d7a,_0x2b01ac){_0x573d7a=_0x573d7a-0x0;var _0x4b10f6=_0x4213[_0x573d7a];return _0x4b10f6;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5469d8,_0x50e464,_0x1b152f){return new BPromise(function(_0x130625,_0x1cf6a0){return client[_0x3421('0xc')](_0x5469d8,_0x1b152f)['then'](function(_0x1f20cf){logger['info']('CloudProvider,\x20%s,\x20%s',_0x50e464,_0x3421('0xd'));logger['debug'](_0x3421('0xe'),_0x50e464,_0x3421('0xd'),JSON[_0x3421('0xf')](_0x1f20cf));if(_0x1f20cf[_0x3421('0x10')]){if(_0x1f20cf[_0x3421('0x10')][_0x3421('0x11')]===0x1f4){logger[_0x3421('0x10')]('CloudProvider,\x20%s,\x20%s',_0x50e464,_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);return _0x1cf6a0(_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);}logger[_0x3421('0x10')](_0x3421('0x13'),_0x50e464,_0x1f20cf[_0x3421('0x10')]['message']);return _0x130625(_0x1f20cf[_0x3421('0x10')]['message']);}else{logger[_0x3421('0x14')](_0x3421('0x13'),_0x50e464,'request\x20sent');_0x130625(_0x1f20cf[_0x3421('0x15')]['message']);}})[_0x3421('0x16')](function(_0x23694b){logger['error'](_0x3421('0x13'),_0x50e464,_0x23694b);_0x1cf6a0(_0x23694b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1d1de86..f856dd0 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x47ec04,_0x21b19e){var _0x3d48d2=function(_0x2ff0c2){while(--_0x2ff0c2){_0x47ec04['push'](_0x47ec04['shift']());}};_0x3d48d2(++_0x21b19e);}(_0xdb28,0x106));var _0x8db2=function(_0x1d3c48,_0x116b13){_0x1d3c48=_0x1d3c48-0x0;var _0xf9c7a4=_0xdb28[_0x1d3c48];return _0xf9c7a4;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x1261,0x144));var _0x1126=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x1261[_0x2e3545];return _0xcf18f;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 396d2f3..025964a 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 _0xd289=['exports','name','STRING'];(function(_0x19de15,_0x566051){var _0x5d6edf=function(_0x327dba){while(--_0x327dba){_0x19de15['push'](_0x19de15['shift']());}};_0x5d6edf(++_0x566051);}(_0xd289,0xf6));var _0x9d28=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xd289[_0x4b5813];return _0x423465;};'use strict';var Sequelize=require('sequelize');module[_0x9d28('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9d28('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9d28('0x2')]},'companyId':{'type':Sequelize[_0x9d28('0x2')]},'website':{'type':Sequelize[_0x9d28('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x9d28('0x2')]},'postalCode':{'type':Sequelize[_0x9d28('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9d28('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9d28('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x9d28('0x2')]},'sCity':{'type':Sequelize[_0x9d28('0x2')]},'sCountry':{'type':Sequelize[_0x9d28('0x2')]},'description':{'type':Sequelize[_0x9d28('0x2')]}}; \ No newline at end of file +var _0xbd19=['sequelize','exports','STRING'];(function(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0xbd19,0x9c));var _0x9bd1=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbd19[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x9bd1('0x0'));module[_0x9bd1('0x1')]={'name':{'type':Sequelize[_0x9bd1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9bd1('0x2')]},'companyId':{'type':Sequelize[_0x9bd1('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9bd1('0x2')]},'type':{'type':Sequelize[_0x9bd1('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9bd1('0x2')]},'country':{'type':Sequelize[_0x9bd1('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9bd1('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x9bd1('0x2')]},'sCity':{'type':Sequelize[_0x9bd1('0x2')]},'sCountry':{'type':Sequelize[_0x9bd1('0x2')]},'description':{'type':Sequelize[_0x9bd1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a3f7874..2ac5900 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 _0x7b11=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','end','name','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmCompany','includeAll','findAll','rows','catch','show','params','include','find','create','get','role','user','Companies','UserProfileSection','autoAssociation','error','body','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','map','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3575ae,_0x6cb4b3){var _0x437e3c=function(_0xc74cca){while(--_0xc74cca){_0x3575ae['push'](_0x3575ae['shift']());}};_0x437e3c(++_0x6cb4b3);}(_0x7b11,0x13a));var _0x17b1=function(_0x106664,_0x26af02){_0x106664=_0x106664-0x0;var _0x4dd09a=_0x7b11[_0x106664];return _0x4dd09a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17b1('0x0'));var zipdir=require(_0x17b1('0x1'));var jsonpatch=require(_0x17b1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x17b1('0x3'));var Mustache=require(_0x17b1('0x4'));var util=require(_0x17b1('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x17b1('0x6'));var fs=require('fs');var fs_extra=require(_0x17b1('0x7'));var _=require(_0x17b1('0x8'));var squel=require(_0x17b1('0x9'));var crypto=require('crypto');var jsforce=require(_0x17b1('0xa'));var deskjs=require(_0x17b1('0xb'));var toCsv=require(_0x17b1('0xc'));var querystring=require('querystring');var Papa=require(_0x17b1('0xd'));var Redis=require('ioredis');var authService=require(_0x17b1('0xe'));var qs=require(_0x17b1('0xf'));var as=require(_0x17b1('0x10'));var hardwareService=require(_0x17b1('0x11'));var logger=require(_0x17b1('0x12'))(_0x17b1('0x13'));var utils=require(_0x17b1('0x14'));var config=require(_0x17b1('0x15'));var licenseUtil=require(_0x17b1('0x16'));var db=require(_0x17b1('0x17'))['db'];function respondWithStatusCode(_0x5346ec,_0x30bba9){_0x30bba9=_0x30bba9||0xcc;return function(_0x556809){if(_0x556809){return _0x5346ec[_0x17b1('0x18')](_0x30bba9);}return _0x5346ec[_0x17b1('0x19')](_0x30bba9)['end']();};}function respondWithResult(_0x3ce50b,_0xaf30b9){_0xaf30b9=_0xaf30b9||0xc8;return function(_0xf060e8){if(_0xf060e8){return _0x3ce50b[_0x17b1('0x19')](_0xaf30b9)['json'](_0xf060e8);}};}function respondWithFilteredResult(_0x2a5d6f,_0x4c02b9){return function(_0x2de642){if(_0x2de642){var _0x4ed670=typeof _0x4c02b9[_0x17b1('0x1a')]===_0x17b1('0x1b')&&typeof _0x4c02b9[_0x17b1('0x1c')]==='undefined';var _0x1615f3=_0x2de642[_0x17b1('0x1d')];var _0x537e2f=_0x4ed670?0x0:_0x4c02b9[_0x17b1('0x1a')];var _0x4f3c49=_0x4ed670?_0x2de642[_0x17b1('0x1d')]:_0x4c02b9[_0x17b1('0x1a')]+_0x4c02b9['limit'];var _0x5f092a;if(_0x4f3c49>=_0x1615f3){_0x4f3c49=_0x1615f3;_0x5f092a=0xc8;}else{_0x5f092a=0xce;}_0x2a5d6f[_0x17b1('0x19')](_0x5f092a);return _0x2a5d6f[_0x17b1('0x1e')](_0x17b1('0x1f'),_0x537e2f+'-'+_0x4f3c49+'/'+_0x1615f3)[_0x17b1('0x20')](_0x2de642);}return null;};}function patchUpdates(_0x513df6){return function(_0x55a3f1){try{jsonpatch[_0x17b1('0x21')](_0x55a3f1,_0x513df6,!![]);}catch(_0x22afb8){return BPromise['reject'](_0x22afb8);}return _0x55a3f1['save']();};}function saveUpdates(_0x5b4742,_0x589490){return function(_0x476d35){if(_0x476d35){return _0x476d35[_0x17b1('0x22')](_0x5b4742)[_0x17b1('0x23')](function(_0x100384){return _0x100384;});}return null;};}function removeEntity(_0x2db1e7,_0x11cc6b){return function(_0x2e71b8){if(_0x2e71b8){return _0x2e71b8[_0x17b1('0x24')]()[_0x17b1('0x23')](function(){var _0x52a74c=_0x2e71b8['get']({'plain':!![]});var _0x51b7fe='Companies';return db['UserProfileResource'][_0x17b1('0x24')]({'where':{'type':_0x51b7fe,'resourceId':_0x52a74c['id']}})[_0x17b1('0x23')](function(){return _0x2e71b8;});})['then'](function(){_0x2db1e7['status'](0xcc)[_0x17b1('0x25')]();});}};}function handleEntityNotFound(_0x309fa8,_0x2e85a9){return function(_0x276a4e){if(!_0x276a4e){_0x309fa8[_0x17b1('0x18')](0x194);}return _0x276a4e;};}function handleError(_0xeb8975,_0x54c90c){_0x54c90c=_0x54c90c||0x1f4;return function(_0x48bf8f){logger['error'](_0x48bf8f['stack']);if(_0x48bf8f[_0x17b1('0x26')]){delete _0x48bf8f['name'];}_0xeb8975[_0x17b1('0x19')](_0x54c90c)['send'](_0x48bf8f);};}exports[_0x17b1('0x27')]=function(_0x5a46d9,_0x27fdf0){var _0xd484ae={},_0x2bbbe9={},_0x243950={'count':0x0,'rows':[]};return db['CmCompany'][_0x17b1('0x28')]()['then'](function(_0x281d7c){_0x2bbbe9[_0x17b1('0x29')]=_[_0x17b1('0x2a')](_0x281d7c);_0x2bbbe9['query']=_['keys'](_0x5a46d9[_0x17b1('0x2b')]);_0x2bbbe9[_0x17b1('0x2c')]=_[_0x17b1('0x2d')](_0x2bbbe9[_0x17b1('0x29')],_0x2bbbe9[_0x17b1('0x2b')]);_0xd484ae[_0x17b1('0x2e')]=_['intersection'](_0x2bbbe9[_0x17b1('0x29')],qs[_0x17b1('0x2f')](_0x5a46d9[_0x17b1('0x2b')][_0x17b1('0x2f')]));_0xd484ae[_0x17b1('0x2e')]=_0xd484ae['attributes'][_0x17b1('0x30')]?_0xd484ae['attributes']:_0x2bbbe9[_0x17b1('0x29')];if(!_0x5a46d9['query'][_0x17b1('0x31')](_0x17b1('0x32'))){_0xd484ae[_0x17b1('0x1c')]=qs[_0x17b1('0x1c')](_0x5a46d9['query'][_0x17b1('0x1c')]);_0xd484ae[_0x17b1('0x1a')]=qs[_0x17b1('0x1a')](_0x5a46d9['query']['offset']);}_0xd484ae[_0x17b1('0x33')]=qs[_0x17b1('0x34')](_0x5a46d9[_0x17b1('0x2b')][_0x17b1('0x34')]);_0xd484ae[_0x17b1('0x35')]=qs[_0x17b1('0x2c')](_[_0x17b1('0x36')](_0x5a46d9[_0x17b1('0x2b')],_0x2bbbe9[_0x17b1('0x2c')]),_0x281d7c);if(_0x5a46d9[_0x17b1('0x2b')][_0x17b1('0x37')]){_0xd484ae[_0x17b1('0x35')]=_[_0x17b1('0x38')](_0xd484ae['where'],{'$or':_['map'](_0xd484ae['attributes'],function(_0x2d530b){var _0x4cb957={};_0x4cb957[_0x2d530b]={'$like':'%'+_0x5a46d9[_0x17b1('0x2b')]['filter']+'%'};return _0x4cb957;})});}_0xd484ae=_[_0x17b1('0x38')]({},_0xd484ae,_0x5a46d9[_0x17b1('0x39')]);var _0x493ce7={'where':_0xd484ae[_0x17b1('0x35')]};return db[_0x17b1('0x3a')][_0x17b1('0x1d')](_0x493ce7)[_0x17b1('0x23')](function(_0x360a55){_0x243950['count']=_0x360a55;if(_0x5a46d9[_0x17b1('0x2b')][_0x17b1('0x3b')]){_0xd484ae['include']=[{'all':!![]}];}return db['CmCompany'][_0x17b1('0x3c')](_0xd484ae);})[_0x17b1('0x23')](function(_0x28765d){_0x243950[_0x17b1('0x3d')]=_0x28765d;return _0x243950;})['then'](respondWithFilteredResult(_0x27fdf0,_0xd484ae))[_0x17b1('0x3e')](handleError(_0x27fdf0,null));})['catch'](handleError(_0x27fdf0,null));};exports[_0x17b1('0x3f')]=function(_0x1b7dac,_0x14e120){var _0x88eb52={'raw':![],'where':{'id':_0x1b7dac[_0x17b1('0x40')]['id']}},_0x360917={};_0x360917['model']=_[_0x17b1('0x2a')](db[_0x17b1('0x3a')]['rawAttributes']);_0x360917[_0x17b1('0x2b')]=_[_0x17b1('0x2a')](_0x1b7dac[_0x17b1('0x2b')]);_0x360917[_0x17b1('0x2c')]=_['intersection'](_0x360917['model'],_0x360917[_0x17b1('0x2b')]);_0x88eb52[_0x17b1('0x2e')]=_[_0x17b1('0x2d')](_0x360917[_0x17b1('0x29')],qs[_0x17b1('0x2f')](_0x1b7dac[_0x17b1('0x2b')][_0x17b1('0x2f')]));_0x88eb52['attributes']=_0x88eb52[_0x17b1('0x2e')][_0x17b1('0x30')]?_0x88eb52[_0x17b1('0x2e')]:_0x360917[_0x17b1('0x29')];if(_0x1b7dac[_0x17b1('0x2b')][_0x17b1('0x3b')]){_0x88eb52[_0x17b1('0x41')]=[{'all':!![]}];}_0x88eb52=_[_0x17b1('0x38')]({},_0x88eb52,_0x1b7dac[_0x17b1('0x39')]);return db['CmCompany'][_0x17b1('0x42')](_0x88eb52)[_0x17b1('0x23')](handleEntityNotFound(_0x14e120,null))[_0x17b1('0x23')](respondWithResult(_0x14e120,null))['catch'](handleError(_0x14e120,null));};exports[_0x17b1('0x43')]=function(_0x973b6a,_0x174438){return db[_0x17b1('0x3a')][_0x17b1('0x43')](_0x973b6a['body'],{})[_0x17b1('0x23')](function(_0x2af846){var _0x503c24=_0x973b6a['user'][_0x17b1('0x44')]({'plain':!![]});if(!_0x503c24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x503c24[_0x17b1('0x45')]===_0x17b1('0x46')){var _0x5e5f3c=_0x2af846[_0x17b1('0x44')]({'plain':!![]});var _0x5c5d38=_0x17b1('0x47');return db[_0x17b1('0x48')][_0x17b1('0x42')]({'where':{'name':_0x5c5d38,'userProfileId':_0x503c24['userProfileId']},'raw':!![]})['then'](function(_0x5c0118){if(_0x5c0118&&_0x5c0118[_0x17b1('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e5f3c[_0x17b1('0x26')],'resourceId':_0x5e5f3c['id'],'type':_0x5c0118['name'],'sectionId':_0x5c0118['id']},{})[_0x17b1('0x23')](function(){return _0x2af846;});}else{return _0x2af846;}})[_0x17b1('0x3e')](function(_0x1dfedf){logger[_0x17b1('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dfedf);throw _0x1dfedf;});}return _0x2af846;})['then'](respondWithResult(_0x174438,0xc9))[_0x17b1('0x3e')](handleError(_0x174438,null));};exports[_0x17b1('0x22')]=function(_0x133ead,_0x38630b){if(_0x133ead['body']['id']){delete _0x133ead[_0x17b1('0x4b')]['id'];}return db[_0x17b1('0x3a')]['find']({'where':{'id':_0x133ead[_0x17b1('0x40')]['id']}})[_0x17b1('0x23')](handleEntityNotFound(_0x38630b,null))[_0x17b1('0x23')](saveUpdates(_0x133ead['body'],null))[_0x17b1('0x23')](respondWithResult(_0x38630b,null))['catch'](handleError(_0x38630b,null));};exports[_0x17b1('0x24')]=function(_0xc2996e,_0x606a99){return db[_0x17b1('0x3a')][_0x17b1('0x42')]({'where':{'id':_0xc2996e[_0x17b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x606a99,null))[_0x17b1('0x23')](removeEntity(_0x606a99,null))[_0x17b1('0x3e')](handleError(_0x606a99,null));};exports[_0x17b1('0x28')]=function(_0xf654e8,_0x378685){return db[_0x17b1('0x3a')]['describe']()['then'](respondWithResult(_0x378685,null))[_0x17b1('0x3e')](handleError(_0x378685,null));};exports[_0x17b1('0x4c')]=function(_0x58634b,_0x3acb32,_0x1a3b29){return db[_0x17b1('0x4d')][_0x17b1('0x42')]({'where':{'id':_0x58634b[_0x17b1('0x40')]['id']}})[_0x17b1('0x23')](handleEntityNotFound(_0x3acb32,null))[_0x17b1('0x23')](function(_0x42b76b){if(_0x42b76b){return _0x42b76b['addContacts'](_0x58634b[_0x17b1('0x4b')][_0x17b1('0x4e')],_[_0x17b1('0x4f')](_0x58634b[_0x17b1('0x4b')],[_0x17b1('0x4e'),'id'])||{});}})[_0x17b1('0x23')](respondWithResult(_0x3acb32,null))[_0x17b1('0x3e')](handleError(_0x3acb32,null));};exports[_0x17b1('0x50')]=function(_0x4a0e4b,_0x7be9a3,_0x17a4b4){var _0x54cf34={};var _0x5daf1f={};var _0x47db3f;var _0x18d641;return db[_0x17b1('0x3a')][_0x17b1('0x51')]({'where':{'id':_0x4a0e4b[_0x17b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x7be9a3,null))[_0x17b1('0x23')](function(_0x414c53){if(_0x414c53){_0x47db3f=_0x414c53;_0x5daf1f[_0x17b1('0x29')]=_[_0x17b1('0x2a')](db[_0x17b1('0x4d')][_0x17b1('0x52')]);_0x5daf1f[_0x17b1('0x2b')]=_['keys'](_0x4a0e4b[_0x17b1('0x2b')]);_0x5daf1f[_0x17b1('0x2c')]=_['intersection'](_0x5daf1f[_0x17b1('0x29')],_0x5daf1f[_0x17b1('0x2b')]);_0x54cf34[_0x17b1('0x2e')]=_[_0x17b1('0x2d')](_0x5daf1f['model'],qs['fields'](_0x4a0e4b[_0x17b1('0x2b')][_0x17b1('0x2f')]));_0x54cf34[_0x17b1('0x2e')]=_0x54cf34[_0x17b1('0x2e')][_0x17b1('0x30')]?_0x54cf34[_0x17b1('0x2e')]:_0x5daf1f['model'];_0x54cf34[_0x17b1('0x33')]=qs[_0x17b1('0x34')](_0x4a0e4b[_0x17b1('0x2b')][_0x17b1('0x34')]);_0x54cf34[_0x17b1('0x35')]=qs[_0x17b1('0x2c')](_['pick'](_0x4a0e4b[_0x17b1('0x2b')],_0x5daf1f['filters']));if(_0x4a0e4b[_0x17b1('0x2b')][_0x17b1('0x37')]){_0x54cf34[_0x17b1('0x35')]=_[_0x17b1('0x38')](_0x54cf34[_0x17b1('0x35')],{'$or':_[_0x17b1('0x53')](_0x54cf34[_0x17b1('0x2e')],function(_0x5a48db){var _0x35e16d={};_0x35e16d[_0x5a48db]={'$like':'%'+_0x4a0e4b[_0x17b1('0x2b')][_0x17b1('0x37')]+'%'};return _0x35e16d;})});}_0x54cf34=_[_0x17b1('0x38')]({},_0x54cf34,_0x4a0e4b[_0x17b1('0x39')]);return _0x47db3f[_0x17b1('0x50')](_0x54cf34);}})[_0x17b1('0x23')](function(_0xfdffe3){if(_0xfdffe3){_0x18d641=_0xfdffe3['length'];if(!_0x4a0e4b['query'][_0x17b1('0x31')](_0x17b1('0x32'))){_0x54cf34[_0x17b1('0x1c')]=qs[_0x17b1('0x1c')](_0x4a0e4b[_0x17b1('0x2b')][_0x17b1('0x1c')]);_0x54cf34[_0x17b1('0x1a')]=qs[_0x17b1('0x1a')](_0x4a0e4b[_0x17b1('0x2b')][_0x17b1('0x1a')]);}return _0x47db3f[_0x17b1('0x50')](_0x54cf34);}})[_0x17b1('0x23')](function(_0x53aee2){if(_0x53aee2){return _0x53aee2?{'count':_0x18d641,'rows':_0x53aee2}:null;}})[_0x17b1('0x23')](respondWithResult(_0x7be9a3,null))[_0x17b1('0x3e')](handleError(_0x7be9a3,null));}; \ No newline at end of file +var _0xf2d4=['where','merge','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','findOne','rawAttributes','getContacts','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','get','Companies','UserProfileResource','status','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0xa58ffc,_0x336897){var _0x44fc5f=function(_0x40ab2d){while(--_0x40ab2d){_0xa58ffc['push'](_0xa58ffc['shift']());}};_0x44fc5f(++_0x336897);}(_0xf2d4,0xbe));var _0x4f2d=function(_0x3d9f17,_0x138fb5){_0x3d9f17=_0x3d9f17-0x0;var _0x2e1bde=_0xf2d4[_0x3d9f17];return _0x2e1bde;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f2d('0x0'));var jsonpatch=require(_0x4f2d('0x1'));var rp=require(_0x4f2d('0x2'));var moment=require(_0x4f2d('0x3'));var BPromise=require(_0x4f2d('0x4'));var Mustache=require(_0x4f2d('0x5'));var util=require(_0x4f2d('0x6'));var path=require(_0x4f2d('0x7'));var sox=require(_0x4f2d('0x8'));var csv=require(_0x4f2d('0x9'));var ejs=require(_0x4f2d('0xa'));var fs=require('fs');var fs_extra=require(_0x4f2d('0xb'));var _=require(_0x4f2d('0xc'));var squel=require('squel');var crypto=require(_0x4f2d('0xd'));var jsforce=require(_0x4f2d('0xe'));var deskjs=require(_0x4f2d('0xf'));var toCsv=require(_0x4f2d('0x9'));var querystring=require(_0x4f2d('0x10'));var Papa=require(_0x4f2d('0x11'));var Redis=require(_0x4f2d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4f2d('0x13'));var as=require(_0x4f2d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f2d('0x15'))(_0x4f2d('0x16'));var utils=require(_0x4f2d('0x17'));var config=require(_0x4f2d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x133552,_0x44a7a3){_0x44a7a3=_0x44a7a3||0xcc;return function(_0xd221da){if(_0xd221da){return _0x133552[_0x4f2d('0x19')](_0x44a7a3);}return _0x133552['status'](_0x44a7a3)[_0x4f2d('0x1a')]();};}function respondWithResult(_0x12f0ff,_0x3d5fc5){_0x3d5fc5=_0x3d5fc5||0xc8;return function(_0x397929){if(_0x397929){return _0x12f0ff['status'](_0x3d5fc5)[_0x4f2d('0x1b')](_0x397929);}};}function respondWithFilteredResult(_0x2d22be,_0x14381a){return function(_0x2b6683){if(_0x2b6683){var _0x210679=typeof _0x14381a[_0x4f2d('0x1c')]==='undefined'&&typeof _0x14381a[_0x4f2d('0x1d')]===_0x4f2d('0x1e');var _0x1e6d5a=_0x2b6683[_0x4f2d('0x1f')];var _0x9f7994=_0x210679?0x0:_0x14381a[_0x4f2d('0x1c')];var _0x24d14b=_0x210679?_0x2b6683[_0x4f2d('0x1f')]:_0x14381a[_0x4f2d('0x1c')]+_0x14381a['limit'];var _0x544082;if(_0x24d14b>=_0x1e6d5a){_0x24d14b=_0x1e6d5a;_0x544082=0xc8;}else{_0x544082=0xce;}_0x2d22be['status'](_0x544082);return _0x2d22be[_0x4f2d('0x20')](_0x4f2d('0x21'),_0x9f7994+'-'+_0x24d14b+'/'+_0x1e6d5a)[_0x4f2d('0x1b')](_0x2b6683);}return null;};}function patchUpdates(_0x8ea065){return function(_0x4e592f){try{jsonpatch[_0x4f2d('0x22')](_0x4e592f,_0x8ea065,!![]);}catch(_0x2aa38f){return BPromise[_0x4f2d('0x23')](_0x2aa38f);}return _0x4e592f['save']();};}function saveUpdates(_0xe95f20,_0x84a136){return function(_0x32dd79){if(_0x32dd79){return _0x32dd79['update'](_0xe95f20)[_0x4f2d('0x24')](function(_0x44c65d){return _0x44c65d;});}return null;};}function removeEntity(_0x313dea,_0x4aae4c){return function(_0x4bd255){if(_0x4bd255){return _0x4bd255[_0x4f2d('0x25')]()[_0x4f2d('0x24')](function(){var _0x50bd9a=_0x4bd255[_0x4f2d('0x26')]({'plain':!![]});var _0x154d2d=_0x4f2d('0x27');return db[_0x4f2d('0x28')][_0x4f2d('0x25')]({'where':{'type':_0x154d2d,'resourceId':_0x50bd9a['id']}})['then'](function(){return _0x4bd255;});})[_0x4f2d('0x24')](function(){_0x313dea[_0x4f2d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9bdd60,_0x417cca){return function(_0x458414){if(!_0x458414){_0x9bdd60[_0x4f2d('0x19')](0x194);}return _0x458414;};}function handleError(_0x9dc00e,_0x28c159){_0x28c159=_0x28c159||0x1f4;return function(_0x2c86e9){logger[_0x4f2d('0x2a')](_0x2c86e9['stack']);if(_0x2c86e9[_0x4f2d('0x2b')]){delete _0x2c86e9[_0x4f2d('0x2b')];}_0x9dc00e[_0x4f2d('0x29')](_0x28c159)[_0x4f2d('0x2c')](_0x2c86e9);};}exports[_0x4f2d('0x2d')]=function(_0x2cdd52,_0x1ff806){var _0x36bfff={},_0x49df2c={},_0x5da706={'count':0x0,'rows':[]};return db[_0x4f2d('0x2e')][_0x4f2d('0x2f')]()[_0x4f2d('0x24')](function(_0x18f290){_0x49df2c[_0x4f2d('0x30')]=_[_0x4f2d('0x31')](_0x18f290);_0x49df2c[_0x4f2d('0x32')]=_['keys'](_0x2cdd52[_0x4f2d('0x32')]);_0x49df2c[_0x4f2d('0x33')]=_[_0x4f2d('0x34')](_0x49df2c[_0x4f2d('0x30')],_0x49df2c['query']);_0x36bfff[_0x4f2d('0x35')]=_[_0x4f2d('0x34')](_0x49df2c['model'],qs[_0x4f2d('0x36')](_0x2cdd52['query'][_0x4f2d('0x36')]));_0x36bfff['attributes']=_0x36bfff['attributes'][_0x4f2d('0x37')]?_0x36bfff[_0x4f2d('0x35')]:_0x49df2c['model'];if(!_0x2cdd52[_0x4f2d('0x32')][_0x4f2d('0x38')]('nolimit')){_0x36bfff['limit']=qs[_0x4f2d('0x1d')](_0x2cdd52['query'][_0x4f2d('0x1d')]);_0x36bfff['offset']=qs['offset'](_0x2cdd52[_0x4f2d('0x32')][_0x4f2d('0x1c')]);}_0x36bfff[_0x4f2d('0x39')]=qs[_0x4f2d('0x3a')](_0x2cdd52['query'][_0x4f2d('0x3a')]);_0x36bfff[_0x4f2d('0x3b')]=qs[_0x4f2d('0x33')](_['pick'](_0x2cdd52[_0x4f2d('0x32')],_0x49df2c[_0x4f2d('0x33')]),_0x18f290);if(_0x2cdd52[_0x4f2d('0x32')]['filter']){_0x36bfff[_0x4f2d('0x3b')]=_[_0x4f2d('0x3c')](_0x36bfff[_0x4f2d('0x3b')],{'$or':_['map'](_0x36bfff[_0x4f2d('0x35')],function(_0x3dbb96){var _0x5a5612={};_0x5a5612[_0x3dbb96]={'$like':'%'+_0x2cdd52[_0x4f2d('0x32')][_0x4f2d('0x3d')]+'%'};return _0x5a5612;})});}_0x36bfff=_[_0x4f2d('0x3c')]({},_0x36bfff,_0x2cdd52[_0x4f2d('0x3e')]);var _0x3443c9={'where':_0x36bfff[_0x4f2d('0x3b')]};return db[_0x4f2d('0x2e')][_0x4f2d('0x1f')](_0x3443c9)['then'](function(_0x2b4af2){_0x5da706[_0x4f2d('0x1f')]=_0x2b4af2;if(_0x2cdd52[_0x4f2d('0x32')]['includeAll']){_0x36bfff[_0x4f2d('0x3f')]=[{'all':!![]}];}return db[_0x4f2d('0x2e')][_0x4f2d('0x40')](_0x36bfff);})[_0x4f2d('0x24')](function(_0x233786){_0x5da706['rows']=_0x233786;return _0x5da706;})[_0x4f2d('0x24')](respondWithFilteredResult(_0x1ff806,_0x36bfff))[_0x4f2d('0x41')](handleError(_0x1ff806,null));})[_0x4f2d('0x41')](handleError(_0x1ff806,null));};exports[_0x4f2d('0x42')]=function(_0x1f9353,_0x5c8c3e){var _0x52f43e={'raw':![],'where':{'id':_0x1f9353[_0x4f2d('0x43')]['id']}},_0x4f9230={};_0x4f9230[_0x4f2d('0x30')]=_[_0x4f2d('0x31')](db[_0x4f2d('0x2e')]['rawAttributes']);_0x4f9230['query']=_[_0x4f2d('0x31')](_0x1f9353[_0x4f2d('0x32')]);_0x4f9230[_0x4f2d('0x33')]=_['intersection'](_0x4f9230[_0x4f2d('0x30')],_0x4f9230[_0x4f2d('0x32')]);_0x52f43e[_0x4f2d('0x35')]=_[_0x4f2d('0x34')](_0x4f9230['model'],qs['fields'](_0x1f9353[_0x4f2d('0x32')]['fields']));_0x52f43e[_0x4f2d('0x35')]=_0x52f43e['attributes']['length']?_0x52f43e[_0x4f2d('0x35')]:_0x4f9230[_0x4f2d('0x30')];if(_0x1f9353[_0x4f2d('0x32')][_0x4f2d('0x44')]){_0x52f43e[_0x4f2d('0x3f')]=[{'all':!![]}];}_0x52f43e=_[_0x4f2d('0x3c')]({},_0x52f43e,_0x1f9353[_0x4f2d('0x3e')]);return db['CmCompany'][_0x4f2d('0x45')](_0x52f43e)[_0x4f2d('0x24')](handleEntityNotFound(_0x5c8c3e,null))[_0x4f2d('0x24')](respondWithResult(_0x5c8c3e,null))[_0x4f2d('0x41')](handleError(_0x5c8c3e,null));};exports['create']=function(_0x48c596,_0x1cb5d0){return db['CmCompany'][_0x4f2d('0x46')](_0x48c596[_0x4f2d('0x47')],{})[_0x4f2d('0x24')](function(_0x23d69f){var _0x595ee0=_0x48c596[_0x4f2d('0x48')][_0x4f2d('0x26')]({'plain':!![]});if(!_0x595ee0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x595ee0['role']===_0x4f2d('0x48')){var _0x24842b=_0x23d69f['get']({'plain':!![]});var _0x492730=_0x4f2d('0x27');return db[_0x4f2d('0x49')][_0x4f2d('0x45')]({'where':{'name':_0x492730,'userProfileId':_0x595ee0[_0x4f2d('0x4a')]},'raw':!![]})[_0x4f2d('0x24')](function(_0x3a7f16){if(_0x3a7f16&&_0x3a7f16[_0x4f2d('0x4b')]===0x0){return db[_0x4f2d('0x28')]['create']({'name':_0x24842b[_0x4f2d('0x2b')],'resourceId':_0x24842b['id'],'type':_0x3a7f16['name'],'sectionId':_0x3a7f16['id']},{})[_0x4f2d('0x24')](function(){return _0x23d69f;});}else{return _0x23d69f;}})['catch'](function(_0x2e2067){logger[_0x4f2d('0x2a')](_0x4f2d('0x4c'),_0x2e2067);throw _0x2e2067;});}return _0x23d69f;})[_0x4f2d('0x24')](respondWithResult(_0x1cb5d0,0xc9))[_0x4f2d('0x41')](handleError(_0x1cb5d0,null));};exports['update']=function(_0x3538e8,_0x136b8f){if(_0x3538e8[_0x4f2d('0x47')]['id']){delete _0x3538e8[_0x4f2d('0x47')]['id'];}return db['CmCompany'][_0x4f2d('0x45')]({'where':{'id':_0x3538e8[_0x4f2d('0x43')]['id']}})[_0x4f2d('0x24')](handleEntityNotFound(_0x136b8f,null))[_0x4f2d('0x24')](saveUpdates(_0x3538e8['body'],null))[_0x4f2d('0x24')](respondWithResult(_0x136b8f,null))[_0x4f2d('0x41')](handleError(_0x136b8f,null));};exports['destroy']=function(_0x33030c,_0x3c7229){return db[_0x4f2d('0x2e')][_0x4f2d('0x45')]({'where':{'id':_0x33030c[_0x4f2d('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c7229,null))[_0x4f2d('0x24')](removeEntity(_0x3c7229,null))[_0x4f2d('0x41')](handleError(_0x3c7229,null));};exports[_0x4f2d('0x2f')]=function(_0x240a2c,_0x201a4e){return db[_0x4f2d('0x2e')][_0x4f2d('0x2f')]()[_0x4f2d('0x24')](respondWithResult(_0x201a4e,null))[_0x4f2d('0x41')](handleError(_0x201a4e,null));};exports['addContacts']=function(_0x55cb6e,_0x1a25ef,_0x37f2f4){return db[_0x4f2d('0x4d')][_0x4f2d('0x45')]({'where':{'id':_0x55cb6e[_0x4f2d('0x43')]['id']}})[_0x4f2d('0x24')](handleEntityNotFound(_0x1a25ef,null))[_0x4f2d('0x24')](function(_0x582dfd){if(_0x582dfd){return _0x582dfd[_0x4f2d('0x4e')](_0x55cb6e[_0x4f2d('0x47')][_0x4f2d('0x4f')],_['omit'](_0x55cb6e[_0x4f2d('0x47')],[_0x4f2d('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x1a25ef,null))[_0x4f2d('0x41')](handleError(_0x1a25ef,null));};exports['getContacts']=function(_0x564265,_0xe19c1,_0x932477){var _0x3a60c8={};var _0x4d9349={};var _0x3ef4de;var _0xab79d;return db['CmCompany'][_0x4f2d('0x50')]({'where':{'id':_0x564265['params']['id']}})[_0x4f2d('0x24')](handleEntityNotFound(_0xe19c1,null))[_0x4f2d('0x24')](function(_0xb57c98){if(_0xb57c98){_0x3ef4de=_0xb57c98;_0x4d9349['model']=_[_0x4f2d('0x31')](db[_0x4f2d('0x4d')][_0x4f2d('0x51')]);_0x4d9349['query']=_[_0x4f2d('0x31')](_0x564265['query']);_0x4d9349['filters']=_['intersection'](_0x4d9349['model'],_0x4d9349['query']);_0x3a60c8[_0x4f2d('0x35')]=_[_0x4f2d('0x34')](_0x4d9349['model'],qs['fields'](_0x564265['query'][_0x4f2d('0x36')]));_0x3a60c8['attributes']=_0x3a60c8[_0x4f2d('0x35')]['length']?_0x3a60c8['attributes']:_0x4d9349[_0x4f2d('0x30')];_0x3a60c8[_0x4f2d('0x39')]=qs['sort'](_0x564265[_0x4f2d('0x32')][_0x4f2d('0x3a')]);_0x3a60c8[_0x4f2d('0x3b')]=qs[_0x4f2d('0x33')](_['pick'](_0x564265['query'],_0x4d9349[_0x4f2d('0x33')]));if(_0x564265['query'][_0x4f2d('0x3d')]){_0x3a60c8['where']=_['merge'](_0x3a60c8[_0x4f2d('0x3b')],{'$or':_['map'](_0x3a60c8[_0x4f2d('0x35')],function(_0x24c47d){var _0x513cbc={};_0x513cbc[_0x24c47d]={'$like':'%'+_0x564265['query'][_0x4f2d('0x3d')]+'%'};return _0x513cbc;})});}_0x3a60c8=_[_0x4f2d('0x3c')]({},_0x3a60c8,_0x564265[_0x4f2d('0x3e')]);return _0x3ef4de[_0x4f2d('0x52')](_0x3a60c8);}})[_0x4f2d('0x24')](function(_0x4c417e){if(_0x4c417e){_0xab79d=_0x4c417e[_0x4f2d('0x37')];if(!_0x564265[_0x4f2d('0x32')]['hasOwnProperty']('nolimit')){_0x3a60c8[_0x4f2d('0x1d')]=qs[_0x4f2d('0x1d')](_0x564265['query'][_0x4f2d('0x1d')]);_0x3a60c8[_0x4f2d('0x1c')]=qs[_0x4f2d('0x1c')](_0x564265[_0x4f2d('0x32')]['offset']);}return _0x3ef4de['getContacts'](_0x3a60c8);}})[_0x4f2d('0x24')](function(_0x2ba6c2){if(_0x2ba6c2){return _0x2ba6c2?{'count':_0xab79d,'rows':_0x2ba6c2}:null;}})[_0x4f2d('0x24')](respondWithResult(_0xe19c1,null))[_0x4f2d('0x41')](handleError(_0xe19c1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 0eac624..7bf1ca8 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 _0x32f8=['cm_companies','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmCompany'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0x32f8,0x177));var _0x832f=function(_0x3b5aed,_0x3afd9c){_0x3b5aed=_0x3b5aed-0x0;var _0x5c78a6=_0x32f8[_0x3b5aed];return _0x5c78a6;};'use strict';var _=require('lodash');var util=require(_0x832f('0x0'));var logger=require('../../config/logger')(_0x832f('0x1'));var moment=require(_0x832f('0x2'));var BPromise=require(_0x832f('0x3'));var rp=require(_0x832f('0x4'));var fs=require('fs');var path=require(_0x832f('0x5'));var rimraf=require(_0x832f('0x6'));var config=require(_0x832f('0x7'));var attributes=require('./cmCompany.attributes');module[_0x832f('0x8')]=function(_0x201f7e,_0x44f47b){return _0x201f7e['define'](_0x832f('0x9'),attributes,{'tableName':_0x832f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4c8=['api','moment','request-promise','path','../../config/environment','exports','CmCompany','cm_companies','lodash','util'];(function(_0x385f81,_0x394333){var _0x390b9e=function(_0x5541b7){while(--_0x5541b7){_0x385f81['push'](_0x385f81['shift']());}};_0x390b9e(++_0x394333);}(_0xa4c8,0x184));var _0x8a4c=function(_0x21ce98,_0x436b58){_0x21ce98=_0x21ce98-0x0;var _0x2b3e63=_0xa4c8[_0x21ce98];return _0x2b3e63;};'use strict';var _=require(_0x8a4c('0x0'));var util=require(_0x8a4c('0x1'));var logger=require('../../config/logger')(_0x8a4c('0x2'));var moment=require(_0x8a4c('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a4c('0x4'));var fs=require('fs');var path=require(_0x8a4c('0x5'));var rimraf=require('rimraf');var config=require(_0x8a4c('0x6'));var attributes=require('./cmCompany.attributes');module[_0x8a4c('0x7')]=function(_0x15411c,_0x2492cf){return _0x15411c['define'](_0x8a4c('0x8'),attributes,{'tableName':_0x8a4c('0x9'),'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 fb9bb1a..ba54798 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 _0x0a55=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment'];(function(_0x6f9285,_0xc7a118){var _0x1f324d=function(_0x271524){while(--_0x271524){_0x6f9285['push'](_0x6f9285['shift']());}};_0x1f324d(++_0xc7a118);}(_0x0a55,0xb5));var _0x50a5=function(_0x124705,_0x368268){_0x124705=_0x124705-0x0;var _0x49278a=_0x0a55[_0x124705];return _0x49278a;};'use strict';var _=require(_0x50a5('0x0'));var util=require(_0x50a5('0x1'));var moment=require(_0x50a5('0x2'));var BPromise=require(_0x50a5('0x3'));var rs=require(_0x50a5('0x4'));var fs=require('fs');var Redis=require(_0x50a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x50a5('0x6'));var logger=require(_0x50a5('0x7'))(_0x50a5('0x8'));var config=require(_0x50a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x50a5('0xa')][_0x50a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18c53f,_0x4f05f8,_0x46af76){return new BPromise(function(_0x121035,_0x1066f8){return client[_0x50a5('0xc')](_0x18c53f,_0x46af76)[_0x50a5('0xd')](function(_0x38f089){logger[_0x50a5('0xe')](_0x50a5('0xf'),_0x4f05f8,_0x50a5('0x10'));logger[_0x50a5('0x11')](_0x50a5('0x12'),_0x4f05f8,_0x50a5('0x10'),JSON[_0x50a5('0x13')](_0x38f089));if(_0x38f089['error']){if(_0x38f089[_0x50a5('0x14')][_0x50a5('0x15')]===0x1f4){logger[_0x50a5('0x14')](_0x50a5('0xf'),_0x4f05f8,_0x38f089['error'][_0x50a5('0x16')]);return _0x1066f8(_0x38f089['error'][_0x50a5('0x16')]);}logger[_0x50a5('0x14')](_0x50a5('0xf'),_0x4f05f8,_0x38f089[_0x50a5('0x14')][_0x50a5('0x16')]);return _0x121035(_0x38f089[_0x50a5('0x14')]['message']);}else{logger[_0x50a5('0xe')]('CmCompany,\x20%s,\x20%s',_0x4f05f8,_0x50a5('0x10'));_0x121035(_0x38f089['result'][_0x50a5('0x16')]);}})['catch'](function(_0x3863a9){logger[_0x50a5('0x14')](_0x50a5('0xf'),_0x4f05f8,_0x3863a9);_0x1066f8(_0x3863a9);});});} \ No newline at end of file +var _0x8325=['bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x159f9b,_0x5b015c){var _0x5af408=function(_0x3d8a15){while(--_0x3d8a15){_0x159f9b['push'](_0x159f9b['shift']());}};_0x5af408(++_0x5b015c);}(_0x8325,0xa5));var _0x5832=function(_0x45ef17,_0x3eb0e5){_0x45ef17=_0x45ef17-0x0;var _0x238108=_0x8325[_0x45ef17];return _0x238108;};'use strict';var _=require(_0x5832('0x0'));var util=require(_0x5832('0x1'));var moment=require(_0x5832('0x2'));var BPromise=require(_0x5832('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5832('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5832('0x5'))('rpc');var config=require(_0x5832('0x6'));var jayson=require(_0x5832('0x7'));var client=jayson['client'][_0x5832('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x164c90,_0x37115a,_0x1ccda6){return new BPromise(function(_0x1d62b9,_0x9f192e){return client[_0x5832('0x9')](_0x164c90,_0x1ccda6)[_0x5832('0xa')](function(_0xc28e42){logger[_0x5832('0xb')]('CmCompany,\x20%s,\x20%s',_0x37115a,_0x5832('0xc'));logger[_0x5832('0xd')](_0x5832('0xe'),_0x37115a,'request\x20sent',JSON['stringify'](_0xc28e42));if(_0xc28e42[_0x5832('0xf')]){if(_0xc28e42[_0x5832('0xf')][_0x5832('0x10')]===0x1f4){logger[_0x5832('0xf')](_0x5832('0x11'),_0x37115a,_0xc28e42[_0x5832('0xf')][_0x5832('0x12')]);return _0x9f192e(_0xc28e42[_0x5832('0xf')][_0x5832('0x12')]);}logger[_0x5832('0xf')]('CmCompany,\x20%s,\x20%s',_0x37115a,_0xc28e42['error'][_0x5832('0x12')]);return _0x1d62b9(_0xc28e42['error'][_0x5832('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x37115a,_0x5832('0xc'));_0x1d62b9(_0xc28e42[_0x5832('0x13')]['message']);}})[_0x5832('0x14')](function(_0x176e05){logger[_0x5832('0xf')](_0x5832('0x11'),_0x37115a,_0x176e05);_0x9f192e(_0x176e05);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2f1e592..fd7b26d 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 _0xcb18=['addContacts','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post'];(function(_0x5a2d91,_0x513039){var _0x3422e4=function(_0x540310){while(--_0x540310){_0x5a2d91['push'](_0x5a2d91['shift']());}};_0x3422e4(++_0x513039);}(_0xcb18,0x191));var _0x8cb1=function(_0x4d431b,_0x52aca){_0x4d431b=_0x4d431b-0x0;var _0x4fdad5=_0xcb18[_0x4d431b];return _0x4fdad5;};'use strict';var multer=require(_0x8cb1('0x0'));var util=require('util');var path=require(_0x8cb1('0x1'));var timeout=require(_0x8cb1('0x2'));var express=require('express');var router=express[_0x8cb1('0x3')]();var fs_extra=require(_0x8cb1('0x4'));var auth=require(_0x8cb1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8cb1('0x6'));var controller=require(_0x8cb1('0x7'));router[_0x8cb1('0x8')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0x9')]);router[_0x8cb1('0x8')]('/describe',auth[_0x8cb1('0xa')](),controller[_0x8cb1('0xb')]);router[_0x8cb1('0x8')](_0x8cb1('0xc'),auth['isAuthenticated'](),controller[_0x8cb1('0xd')]);router[_0x8cb1('0x8')](_0x8cb1('0xe'),auth[_0x8cb1('0xa')](),controller[_0x8cb1('0xf')]);router[_0x8cb1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8cb1('0x10')](_0x8cb1('0xe'),auth['isAuthenticated'](),controller[_0x8cb1('0x11')]);router[_0x8cb1('0x12')]('/:id',auth[_0x8cb1('0xa')](),controller[_0x8cb1('0x13')]);router[_0x8cb1('0x14')](_0x8cb1('0xc'),auth[_0x8cb1('0xa')](),controller['destroy']);module[_0x8cb1('0x15')]=router; \ No newline at end of file +var _0x866e=['post','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','create'];(function(_0x4e86d8,_0x1c3bd4){var _0x937bd1=function(_0xdab00a){while(--_0xdab00a){_0x4e86d8['push'](_0x4e86d8['shift']());}};_0x937bd1(++_0x1c3bd4);}(_0x866e,0xaf));var _0xe866=function(_0x144804,_0x5b78bd){_0x144804=_0x144804-0x0;var _0x4598ec=_0x866e[_0x144804];return _0x4598ec;};'use strict';var multer=require(_0xe866('0x0'));var util=require(_0xe866('0x1'));var path=require(_0xe866('0x2'));var timeout=require(_0xe866('0x3'));var express=require(_0xe866('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe866('0x5'));var interaction=require(_0xe866('0x6'));var config=require(_0xe866('0x7'));var controller=require('./cmCompany.controller');router[_0xe866('0x8')]('/',auth[_0xe866('0x9')](),controller[_0xe866('0xa')]);router['get'](_0xe866('0xb'),auth[_0xe866('0x9')](),controller['describe']);router[_0xe866('0x8')](_0xe866('0xc'),auth[_0xe866('0x9')](),controller[_0xe866('0xd')]);router[_0xe866('0x8')](_0xe866('0xe'),auth[_0xe866('0x9')](),controller[_0xe866('0xf')]);router['post']('/',auth[_0xe866('0x9')](),controller[_0xe866('0x10')]);router[_0xe866('0x11')](_0xe866('0xe'),auth[_0xe866('0x9')](),controller[_0xe866('0x12')]);router[_0xe866('0x13')](_0xe866('0xc'),auth[_0xe866('0x9')](),controller[_0xe866('0x14')]);router[_0xe866('0x15')](_0xe866('0xc'),auth['isAuthenticated'](),controller[_0xe866('0x16')]);module[_0xe866('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 84735df..372466d 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 _0x633a=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x271f14,_0x55d96a){var _0x3a2bb5=function(_0x126651){while(--_0x126651){_0x271f14['push'](_0x271f14['shift']());}};_0x3a2bb5(++_0x55d96a);}(_0x633a,0x15e));var _0xa633=function(_0x3b6c24,_0x24a890){_0x3b6c24=_0x3b6c24-0x0;var _0x5eb881=_0x633a[_0x3b6c24];return _0x5eb881;};'use strict';var _=require(_0xa633('0x0'));var Sequelize=require(_0xa633('0x1'));module[_0xa633('0x2')]={'firstName':{'type':Sequelize[_0xa633('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa633('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa633('0x3')]},'country':{'type':Sequelize[_0xa633('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa633('0x4')]},'phone':{'type':Sequelize[_0xa633('0x3')]},'mobile':{'type':Sequelize[_0xa633('0x3')]},'fax':{'type':Sequelize[_0xa633('0x3')]},'email':{'type':Sequelize[_0xa633('0x3')]},'url':{'type':Sequelize[_0xa633('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xa633('0x3')]},'twitter':{'type':Sequelize[_0xa633('0x3')]},'skype':{'type':Sequelize[_0xa633('0x3')]},'teams':{'type':Sequelize[_0xa633('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa633('0x3')]},'wechat':{'type':Sequelize[_0xa633('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xa633('0x3')]},'priority':{'type':Sequelize[_0xa633('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa633('0x6')],'defaultValue':Sequelize[_0xa633('0x7')]},'dialTimezone':{'type':Sequelize[_0xa633('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x487c=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x101e60,_0x2878e2){var _0x39a4a0=function(_0x117072){while(--_0x117072){_0x101e60['push'](_0x101e60['shift']());}};_0x39a4a0(++_0x2878e2);}(_0x487c,0x187));var _0xc487=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x487c[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xc487('0x0'));var Sequelize=require(_0xc487('0x1'));module[_0xc487('0x2')]={'firstName':{'type':Sequelize[_0xc487('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc487('0x3')]},'street':{'type':Sequelize[_0xc487('0x3')]},'postalCode':{'type':Sequelize[_0xc487('0x3')]},'city':{'type':Sequelize[_0xc487('0x3')]},'country':{'type':Sequelize[_0xc487('0x3')]},'dateOfBirth':{'type':Sequelize[_0xc487('0x3')]},'description':{'type':Sequelize[_0xc487('0x4')]},'phone':{'type':Sequelize[_0xc487('0x3')]},'mobile':{'type':Sequelize[_0xc487('0x3')]},'fax':{'type':Sequelize[_0xc487('0x3')]},'email':{'type':Sequelize[_0xc487('0x3')]},'url':{'type':Sequelize[_0xc487('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xc487('0x3')]},'twitter':{'type':Sequelize[_0xc487('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xc487('0x3')]},'line':{'type':Sequelize[_0xc487('0x3')]},'wechat':{'type':Sequelize[_0xc487('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xc487('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xc487('0x3')]},'priority':{'type':Sequelize[_0xc487('0x5')](0x2)[_0xc487('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc487('0x7')],'defaultValue':Sequelize[_0xc487('0x8')]},'dialTimezone':{'type':Sequelize[_0xc487('0x3')]},'utcOffset':{'type':Sequelize[_0xc487('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f2ea0a6..b876d92 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 _0x7d82=['toString','keyBy','CmContact','c.firstName','c.lastName','c.fax','c.email','c.deletedAt','TagIds','Tags','push','rows','catch','destroy','params','analytics','columnName','custom','values','merge','body','findAll','get','mergeWith','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Tag','color','ItemType','literal','Phones.OrderBy','$and','format','cf_%d','pickBy','setFields','id\x20=\x20?','toParam','phone','pick','options','getTags','setTags','ContactItemType','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','`ItemType`.OrderBy','CmHopperId','item','OrderBy','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','rawAttributes','includeAll','include','ContactId','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','meta','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','importUpdates','stringify','message','exit','getJourney','mail','chat','sms','openchannel','fax','-createdAt','toLowerCase','channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','endtime','duration','note','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','createdAt','findAndCountAll','startCase','Account','closed','disposition','key','Owner','DESC','browserName','customerIp','deviceModel','osName','ratingType','ratingValue','subject','threadId','Interaction','slice','moment','bluebird','path','lodash','squel','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./cmContact.socket','status','offset','undefined','count','limit','Content-Range','json','update','then','end','sendStatus','error','name','index','describe','keys','length','startsWith','CmCustomField','findOne','trimStart','cf_','all','fieldType','type','model','query','intersection','attributes','fields','nolimit','order','sort','filters','select','field','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','where','expr','search','parseSearch','sqlOperator','conditions','find','value','split','union','User','dateOfBirth','datetime','DATE','text','start','map','hasOwnProperty','filter','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','t.id\x20IN\x20?','resolve','user','role','agent','getLists','c.ListId\x20IS\x20NULL','sequelize'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7d82,0x1d6));var _0x27d8=function(_0x16897d,_0x3e5323){_0x16897d=_0x16897d-0x0;var _0x401a46=_0x7d82[_0x16897d];return _0x401a46;};'use strict';var moment=require(_0x27d8('0x0'));var BPromise=require(_0x27d8('0x1'));var util=require('util');var path=require(_0x27d8('0x2'));var fs=require('fs');var _=require(_0x27d8('0x3'));var squel=require(_0x27d8('0x4'));var Papa=require(_0x27d8('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x27d8('0x6'));var logger=require(_0x27d8('0x7'))(_0x27d8('0x8'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0x27d8('0x9'))['db'];config[_0x27d8('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x27d8('0xb'))(new Redis(config[_0x27d8('0xa')]));require(_0x27d8('0xc'))['register'](socket);function respondWithResult(_0x297f90,_0x3923bc){_0x3923bc=_0x3923bc||0xc8;return function(_0x50a093){if(_0x50a093){return _0x297f90[_0x27d8('0xd')](_0x3923bc)['json'](_0x50a093);}};}function respondWithFilteredResult(_0x155c82,_0x18761d){return function(_0x4cb919){if(_0x4cb919){var _0x4d3ed9=typeof _0x18761d[_0x27d8('0xe')]==='undefined'&&typeof _0x18761d['limit']===_0x27d8('0xf');var _0x24f5ec=_0x4cb919[_0x27d8('0x10')];var _0x29df92=_0x4d3ed9?0x0:_0x18761d[_0x27d8('0xe')];var _0x35c10a=_0x4d3ed9?_0x4cb919[_0x27d8('0x10')]:_0x18761d[_0x27d8('0xe')]+_0x18761d[_0x27d8('0x11')];var _0x32c4fc;if(_0x35c10a>=_0x24f5ec){_0x35c10a=_0x24f5ec;_0x32c4fc=0xc8;}else{_0x32c4fc=0xce;}_0x155c82['status'](_0x32c4fc);return _0x155c82['set'](_0x27d8('0x12'),_0x29df92+'-'+_0x35c10a+'/'+_0x24f5ec)[_0x27d8('0x13')](_0x4cb919);}return null;};}function saveUpdates(_0x351315){return function(_0x2b2825){if(_0x2b2825){return _0x2b2825[_0x27d8('0x14')](_0x351315)[_0x27d8('0x15')](function(_0xc74767){return _0xc74767;});}return null;};}function removeEntity(_0x59d48b){return function(_0x4236ba){if(_0x4236ba){return _0x4236ba['destroy']()[_0x27d8('0x15')](function(){_0x59d48b[_0x27d8('0xd')](0xcc)[_0x27d8('0x16')]();});}};}function handleEntityNotFound(_0x34084c){return function(_0x32d66f){if(!_0x32d66f){_0x34084c[_0x27d8('0x17')](0x194);}return _0x32d66f;};}function handleError(_0x2a57cd,_0x46fe6e){_0x46fe6e=_0x46fe6e||0x1f4;return function(_0x462a86){logger[_0x27d8('0x18')](_0x462a86['stack']);if(_0x462a86[_0x27d8('0x19')]){delete _0x462a86['name'];}_0x2a57cd[_0x27d8('0xd')](_0x46fe6e)['send'](_0x462a86);};}exports[_0x27d8('0x1a')]=function(_0xd38929,_0xf09755){var _0x21cb2d={},_0xf0fd81={},_0x58f6ce={'count':0x0,'rows':[]};return db['CmContact'][_0x27d8('0x1b')]()[_0x27d8('0x15')](function(_0x1d387c){var _0x3e059d=[];for(var _0x2f08d1=0x0;_0x2f08d10x1){_0x20df02['or'](_0x27d8('0x56'),qs[_0x27d8('0x57')](_0x53b583),null);}else{if(qs[_0x27d8('0x58')](_0x53b583)){_0x20df02['or'](_0x27d8('0x59'),_0x53b583+'%');_0x20df02['or'](_0x27d8('0x5a'),_0x53b583+'%');_0x20df02['or'](_0x27d8('0x5b'),_0x53b583+'%');_0x20df02['or'](_0x27d8('0x5c'),_0x53b583+'%');}else if(qs[_0x27d8('0x5d')](_0x53b583)){_0x20df02['or']('c.email\x20LIKE\x20?',_0x53b583+'%');}else{_0x20df02['or'](_0x27d8('0x5e'),'%'+_0x53b583+'%');_0x20df02['or'](_0x27d8('0x5f'),'%'+_0x53b583+'%');_0x20df02['or'](_0x27d8('0x60'),'%'+_0x53b583+'%');}}}}_0x47ce78[_0x27d8('0x37')](_0x20df02);_0x47ce78[_0x27d8('0x61')](_0x27d8('0x62'));var _0x5fa69={'type':db[_0x27d8('0x63')][_0x27d8('0x64')][_0x27d8('0x65')],'raw':!![]};var _0x3cd164=_0x47ce78['clone']()[_0x27d8('0x30')](_0x27d8('0x62'));if(_0x21cb2d[_0x27d8('0x2c')]){_0x21cb2d[_0x27d8('0x2c')][_0x27d8('0x4d')](function(_0x1b3f9c){_0x47ce78['order']('c.'+_0x1b3f9c[0x0],_0x1b3f9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x27d8('0x4c')](_0x5333c1)){_0x47ce78['having'](_0x1f8856);_0x3cd164[_0x27d8('0x37')](_0x27d8('0x66'),_0x5333c1);}BPromise[_0x27d8('0x67')]()['then'](function(){if(!_0x87f817)return;if(_0xd38929[_0x27d8('0x68')][_0x27d8('0x69')]!==_0x27d8('0x6a'))return;if(!_['some'](_0x87f817[_0x27d8('0x3c')],[_0x27d8('0x30'),_0x27d8('0x41')])){return _0xd38929['user'][_0x27d8('0x6b')]({'attributes':['id'],'raw':!![]})[_0x27d8('0x15')](function(_0x7ba6ce){if(_[_0x27d8('0x4c')](_0x7ba6ce)){_0x3cd164[_0x27d8('0x37')](_0x27d8('0x6c'));_0x47ce78[_0x27d8('0x37')](_0x27d8('0x6c'));}else{_0x3cd164[_0x27d8('0x37')]('c.ListId\x20IN\x20?',_[_0x27d8('0x47')](_0x7ba6ce,'id'));_0x47ce78['where'](_0x27d8('0x4f'),_['map'](_0x7ba6ce,'id'));}});}})[_0x27d8('0x15')](function(){if(_0xd38929[_0x27d8('0x68')][_0x27d8('0x69')]===_0x27d8('0x6a')&&!_0x87f817&&!_0xd38929['query'][_0x27d8('0x4e')])return[];return db[_0x27d8('0x6d')]['query'](_0x3cd164[_0x27d8('0x6e')](),_0x5fa69);})[_0x27d8('0x15')](function(_0x5e2461){_0x58f6ce[_0x27d8('0x10')]=_0x5e2461[_0x27d8('0x1d')];if(_0x58f6ce[_0x27d8('0x10')]===0x0)return[];return db['sequelize'][_0x27d8('0x27')](_0x3be5f2[_0x27d8('0x6e')](),_0x5fa69)[_0x27d8('0x15')](function(_0x286f6b){_0x38e953=_[_0x27d8('0x6f')](_0x286f6b,'id');_0x5fa69=_['merge'](_0x5fa69,{'model':db[_0x27d8('0x70')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd38929[_0x27d8('0x27')][_0x27d8('0x2a')]){_0x21cb2d[_0x27d8('0x29')][_0x27d8('0x4d')](function(_0x17a4f5){_0x47ce78[_0x27d8('0x30')]('c.'+_0x17a4f5);});}else{_0x47ce78[_0x27d8('0x30')]('c.id');_0x47ce78[_0x27d8('0x30')](_0x27d8('0x71'));_0x47ce78[_0x27d8('0x30')](_0x27d8('0x72'));_0x47ce78[_0x27d8('0x30')]('c.phone');_0x47ce78[_0x27d8('0x30')]('c.mobile');_0x47ce78[_0x27d8('0x30')](_0x27d8('0x73'));_0x47ce78[_0x27d8('0x30')](_0x27d8('0x74'));_0x47ce78[_0x27d8('0x30')]('c.ListId');_0x47ce78[_0x27d8('0x30')]('c.createdAt');_0x47ce78[_0x27d8('0x30')](_0x27d8('0x75'));_0x47ce78[_0x27d8('0x30')]('c.CompanyId');_0x47ce78[_0x27d8('0x30')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x27d8('0x76'));}if(_0x21cb2d['limit'])_0x47ce78[_0x27d8('0x11')](_0x21cb2d[_0x27d8('0x11')]);if(_0x21cb2d[_0x27d8('0xe')])_0x47ce78[_0x27d8('0xe')](_0x21cb2d[_0x27d8('0xe')]);return db[_0x27d8('0x6d')]['query'](_0x47ce78[_0x27d8('0x6e')](),_0x5fa69);});})[_0x27d8('0x15')](function(_0xa6ff67){_0xa6ff67['forEach'](function(_0x3b6059){if(_0x3b6059[_0x27d8('0x76')]){_0x3b6059[_0x27d8('0x77')]=[];_0x3b6059[_0x27d8('0x76')]['split'](',')[_0x27d8('0x4d')](function(_0x48755b){_0x3b6059[_0x27d8('0x77')][_0x27d8('0x78')](_0x38e953[_0x48755b]);});}delete _0x3b6059[_0x27d8('0x76')];});_0x58f6ce[_0x27d8('0x79')]=_0xa6ff67;return _0x58f6ce;})['then'](respondWithFilteredResult(_0xf09755,_0x21cb2d));})[_0x27d8('0x7a')](handleError(_0xf09755,null));};exports[_0x27d8('0x7b')]=function(_0x292455,_0x1e1f77){return db['CmContact'][_0x27d8('0x3d')]({'where':{'id':_0x292455[_0x27d8('0x7c')]['id']}})[_0x27d8('0x15')](handleEntityNotFound(_0x1e1f77,null))['then'](removeEntity(_0x1e1f77,null))[_0x27d8('0x7a')](handleError(_0x1e1f77,null));};exports['describe']=function(_0x4e3609,_0x1ddcb6){return db[_0x27d8('0x70')][_0x27d8('0x1b')]()[_0x27d8('0x15')](function(_0x1ae8fe){delete _0x1ae8fe['tags'];for(var _0x596e26=0x0;_0x596e260x0){return new Promise(function(_0x216b0a,_0x21da4b){var _0x1b290c=[];for(var _0x4752a6=0x0;_0x4752a6<_0x1a365e[_0x27d8('0x1d')];_0x4752a6++){_0x1b290c[_0x27d8('0x78')](insertAdditionalPhones(_0x1a365e[_0x4752a6][_0x27d8('0xab')],_0x1a365e[_0x4752a6][_0x27d8('0xa4')]));}Promise[_0x27d8('0x23')](_0x1b290c)[_0x27d8('0x15')](function(){_0x216b0a(0x1);});})[_0x27d8('0x15')](function(){return{'success':_0x33af24,'failure':_0x1db1f7,'duplicates':_0x2c754e};});}else{return{'success':_0x33af24,'failure':_0x1db1f7,'duplicates':_0x2c754e};}}})[_0x27d8('0x15')](respondWithResult(_0x345b51,0xc9))['catch'](handleError(_0x345b51,null));};exports[_0x27d8('0xac')]=function(_0x5ab0f6,_0x3f19b1){var _0x3bc87e;return db[_0x27d8('0x70')][_0x27d8('0x1b')]()[_0x27d8('0x15')](function(_0x4f3dd9){return db[_0x27d8('0x70')][_0x27d8('0x3d')]({'where':{'id':_0x5ab0f6[_0x27d8('0x7c')]['id']},'include':[{'model':db[_0x27d8('0xad')],'as':_0x27d8('0x77'),'attributes':['id','name',_0x27d8('0xae')],'required':_0x5ab0f6[_0x27d8('0x27')][_0x27d8('0x52')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x5ab0f6[_0x27d8('0x7c')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x27d8('0xaf')}]}],'order':[db['sequelize'][_0x27d8('0xb0')](_0x27d8('0xb1'))],'attributes':_['keys'](_0x4f3dd9)});})[_0x27d8('0x15')](function(_0x3be505){if(!_[_0x27d8('0x4a')](_0x3be505)){_0x3bc87e=_0x3be505[_0x27d8('0x84')]({'plain':!![]});var _0x559740={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3be505&&_0x3be505[_0x27d8('0x4e')]){if(_0x3be505[_0x27d8('0x4e')]){_0x559740[_0x27d8('0x37')][_0x27d8('0xb2')]['push']({'ListId':{'$ne':_0x3be505['ListId']}});}}return db[_0x27d8('0x1f')][_0x27d8('0x83')](_0x559740);}})[_0x27d8('0x15')](function(_0x1e8740){if(!_[_0x27d8('0x4a')](_0x1e8740)){return _['omit'](_0x3bc87e,_[_0x27d8('0x47')](_0x1e8740,function(_0x1c9c66){return util[_0x27d8('0xb3')](_0x27d8('0xb4'),_0x1c9c66['id']);}));}})['then'](handleEntityNotFound(_0x3f19b1,null))[_0x27d8('0x15')](respondWithResult(_0x3f19b1,null))[_0x27d8('0x7a')](handleError(_0x3f19b1,null));};exports['update']=function(_0x31d5dc,_0x1527d1){var _0xd01b48;if(_0x31d5dc[_0x27d8('0x82')]['id']){delete _0x31d5dc['body']['id'];}if(!_[_0x27d8('0x4a')](_0x31d5dc['body']['dialTimezone'])){var _0x27655e=_0x31d5dc[_0x27d8('0x82')][_0x27d8('0xa1')];if(!_['isNil'](shared[_0x27d8('0xa2')][_0x27655e]))_0x31d5dc[_0x27d8('0x82')][_0x27d8('0xa3')]=shared[_0x27d8('0xa2')][_0x27655e][_0x27d8('0xa3')];}return db[_0x27d8('0x70')][_0x27d8('0x3d')]({'where':{'id':_0x31d5dc[_0x27d8('0x7c')]['id']}})[_0x27d8('0x15')](handleEntityNotFound(_0x1527d1,null))[_0x27d8('0x15')](saveUpdates(_0x31d5dc['body'],null))[_0x27d8('0x15')](function(_0x47eb12){_0xd01b48=_0x47eb12;var _0x1c08fe={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x47eb12&&_0x47eb12['ListId']){if(_0x47eb12[_0x27d8('0x4e')]){_0x1c08fe[_0x27d8('0x37')][_0x27d8('0xb2')][_0x27d8('0x78')]({'ListId':{'$ne':_0x47eb12[_0x27d8('0x4e')]}});}}return db[_0x27d8('0x1f')][_0x27d8('0x83')](_0x1c08fe);})[_0x27d8('0x15')](function(_0x240b7c){if(_0x240b7c){return _['omit'](_[_0x27d8('0xb5')](_0x31d5dc['body'],function(_0x19a66b,_0x4fb9cb){return _['startsWith'](_0x4fb9cb,_0x27d8('0x22'));}),_[_0x27d8('0x47')](_0x240b7c,function(_0x11059d){return util['format'](_0x27d8('0xb4'),_0x11059d['id']);}));}})[_0x27d8('0x15')](function(_0x47c923){if(_0x47c923&&!_['isEmpty'](_0x47c923)){var _0x45d1d3=squel[_0x27d8('0x14')]()['table'](_0x27d8('0x33'))[_0x27d8('0xb6')](_0x47c923)[_0x27d8('0x37')](_0x27d8('0xb7'),_0x31d5dc[_0x27d8('0x7c')]['id'])[_0x27d8('0xb8')]();return db[_0x27d8('0x6d')][_0x27d8('0x27')](_0x45d1d3[_0x27d8('0x45')],{'replacements':_0x45d1d3[_0x27d8('0x80')]});}})[_0x27d8('0x15')](function(){if(_0x31d5dc[_0x27d8('0x82')][_0x27d8('0xb9')]&&_0xd01b48){return db[_0x27d8('0x89')]['update']({'phone':_0x31d5dc['body'][_0x27d8('0xb9')],'OrderBy':0x0},{'where':{'ContactId':_0xd01b48['id']}});}})[_0x27d8('0x15')](function(){return _0xd01b48;})[_0x27d8('0x15')](respondWithResult(_0x1527d1,null))['catch'](handleError(_0x1527d1,null));};exports['getTags']=function(_0x885dd7,_0x31b4a2){var _0x1a7533={};var _0x462d2f={};var _0x134b67;var _0x1cd514;return db[_0x27d8('0x70')][_0x27d8('0x20')]({'where':{'id':_0x885dd7['params']['id']}})[_0x27d8('0x15')](handleEntityNotFound(_0x31b4a2,null))[_0x27d8('0x15')](function(_0x1f4a23){if(_0x1f4a23){_0x134b67=_0x1f4a23;_0x462d2f[_0x27d8('0x26')]=_[_0x27d8('0x1c')](db[_0x27d8('0xad')]['rawAttributes']);_0x462d2f[_0x27d8('0x27')]=_[_0x27d8('0x1c')](_0x885dd7[_0x27d8('0x27')]);_0x462d2f[_0x27d8('0x2e')]=_['intersection'](_0x462d2f[_0x27d8('0x26')],_0x462d2f[_0x27d8('0x27')]);_0x1a7533[_0x27d8('0x29')]=_[_0x27d8('0x28')](_0x462d2f[_0x27d8('0x26')],qs[_0x27d8('0x2a')](_0x885dd7['query'][_0x27d8('0x2a')]));_0x1a7533['attributes']=_0x1a7533[_0x27d8('0x29')][_0x27d8('0x1d')]?_0x1a7533[_0x27d8('0x29')]:_0x462d2f[_0x27d8('0x26')];_0x1a7533['order']=qs[_0x27d8('0x2d')](_0x885dd7[_0x27d8('0x27')][_0x27d8('0x2d')]);_0x1a7533[_0x27d8('0x37')]=qs['filters'](_[_0x27d8('0xba')](_0x885dd7[_0x27d8('0x27')],_0x462d2f[_0x27d8('0x2e')]));if(_0x885dd7[_0x27d8('0x27')]['filter']){_0x1a7533[_0x27d8('0x37')]=_[_0x27d8('0x81')](_0x1a7533[_0x27d8('0x37')],{'$or':_['map'](_0x1a7533['attributes'],function(_0x586736){var _0x1a7ccb={};_0x1a7ccb[_0x586736]={'$like':'%'+_0x885dd7[_0x27d8('0x27')][_0x27d8('0x49')]+'%'};return _0x1a7ccb;})});}_0x1a7533=_['merge']({},_0x1a7533,_0x885dd7[_0x27d8('0xbb')]);return _0x134b67[_0x27d8('0xbc')](_0x1a7533);}})[_0x27d8('0x15')](function(_0x2c676d){if(_0x2c676d){_0x1cd514=_0x2c676d['length'];if(!_0x885dd7[_0x27d8('0x27')]['hasOwnProperty'](_0x27d8('0x2b'))){_0x1a7533[_0x27d8('0x11')]=qs[_0x27d8('0x11')](_0x885dd7[_0x27d8('0x27')][_0x27d8('0x11')]);_0x1a7533[_0x27d8('0xe')]=qs['offset'](_0x885dd7[_0x27d8('0x27')]['offset']);}return _0x134b67[_0x27d8('0xbc')](_0x1a7533);}})[_0x27d8('0x15')](function(_0x1587ab){if(_0x1587ab){return _0x1587ab?{'count':_0x1cd514,'rows':_0x1587ab}:null;}})[_0x27d8('0x15')](respondWithResult(_0x31b4a2,null))[_0x27d8('0x7a')](handleError(_0x31b4a2,null));};exports['setTags']=function(_0xc4066b,_0x5bbda){if(_0xc4066b[_0x27d8('0x82')]['id']){delete _0xc4066b['body']['id'];}return db[_0x27d8('0x70')][_0x27d8('0x20')]({'where':{'id':_0xc4066b[_0x27d8('0x7c')]['id']}})[_0x27d8('0x15')](handleEntityNotFound(_0x5bbda,null))[_0x27d8('0x15')](function(_0x9632f5){if(_0x9632f5){return _0x9632f5[_0x27d8('0xbd')](_0xc4066b[_0x27d8('0x82')]['ids']||[]);}return null;})[_0x27d8('0x15')](respondWithResult(_0x5bbda,null))[_0x27d8('0x7a')](handleError(_0x5bbda,null));};exports['setAdditionalPhones']=function(_0x2e0592,_0x2e334d){var _0x51273a=[];_0x51273a[_0x27d8('0x78')](addAdditionalPhones(_0x2e0592[_0x27d8('0x82')]));Promise[_0x27d8('0x23')](_0x51273a)[_0x27d8('0x15')](function(){_0x51273a=[];_0x51273a[_0x27d8('0x78')](deleteCmHopperPhones(_0x2e0592[_0x27d8('0x82')]['id']));_0x51273a[_0x27d8('0x78')](addCmHopperPhones(_0x2e0592['body']['id']));Promise[_0x27d8('0x23')](_0x51273a)[_0x27d8('0x15')](function(){return[0x1];})[_0x27d8('0x15')](respondWithResult(_0x2e334d,null));});};function addAdditionalPhones(_0x2c933d){var _0x2ee290;return new Promise(function(_0x44e8ca,_0x57750f){return db['CmContactHasItem'][_0x27d8('0x7b')]({'where':{'CmContactId':_0x2c933d['id']}})['then'](function(){db[_0x27d8('0xbe')][_0x27d8('0x83')]({'raw':!![],'attributes':['id','OrderBy']})[_0x27d8('0x15')](function(_0x3c8fb7){var _0x3dfe1b=[];for(var _0x32055c=0x0;_0x32055c<_0x2c933d[_0x27d8('0xbf')]['length'];_0x32055c++){var _0x2f5bf8=_0x2c933d[_0x27d8('0xc0')]?_[_0x27d8('0x4a')](_0x2c933d[_0x27d8('0xc0')][_0x32055c])?'':_0x2c933d['item_types'][_0x32055c]:_0x2c933d[_0x27d8('0xbf')][_0x32055c]['ItemTypeId']?_0x2c933d[_0x27d8('0xbf')][_0x32055c][_0x27d8('0xc1')]:'';var _0x4dea5a=_[_0x27d8('0x4a')](_0x2c933d[_0x27d8('0xbf')][_0x32055c][_0x27d8('0xc2')])?'':_0x2c933d[_0x27d8('0xbf')][_0x32055c][_0x27d8('0xc2')];var _0x17dd8e=_0x2f5bf8+':'+_0x2c933d['items'][_0x32055c][_0x27d8('0xb9')]+'§'+_0x4dea5a;if(_['isNil'](_0x2ee290))_0x2ee290=_0x17dd8e;else _0x2ee290+=';'+_0x17dd8e;var _0x26e430=null;if(_0x2c933d[_0x27d8('0xc0')]){if(!_[_0x27d8('0x4a')](_0x2c933d[_0x27d8('0xc0')][_0x32055c])){var _0x4c0777=_[_0x27d8('0x3d')](_0x3c8fb7,function(_0x4fe562){return _0x4fe562['id']===_0x2c933d['item_types'][_0x32055c];});if(!_['isNil'](_0x4c0777)){_0x26e430=_0x4c0777['OrderBy'];}}}else{if(!_[_0x27d8('0x4a')](_0x2c933d[_0x27d8('0xbf')][_0x32055c])){var _0x4c0777=_[_0x27d8('0x3d')](_0x3c8fb7,function(_0x22a9ca){return _0x22a9ca['id']===_0x2c933d['items'][_0x32055c][_0x27d8('0xc1')];});if(!_[_0x27d8('0x4a')](_0x4c0777)){_0x26e430=_0x32055c;}}}if(_[_0x27d8('0x4a')](_0x26e430)){_0x26e430=0x64;}_0x3dfe1b[_0x27d8('0x78')](addAdditionalPhone(_0x2c933d['id'],_0x2c933d[_0x27d8('0xbf')][_0x32055c][_0x27d8('0xb9')],_0x2c933d[_0x27d8('0xc0')]?_['isNil'](_0x2c933d[_0x27d8('0xc0')][_0x32055c])?null:_0x2c933d[_0x27d8('0xc0')][_0x32055c]:_0x2c933d[_0x27d8('0xbf')][_0x32055c]['ItemTypeId']?_0x2c933d[_0x27d8('0xbf')][_0x32055c][_0x27d8('0xc1')]:null,_0x26e430,_0x4dea5a));}Promise[_0x27d8('0x23')](_0x3dfe1b)[_0x27d8('0x15')](function(){db[_0x27d8('0x70')]['update']({'AdditionalPhones':_0x2ee290},{'where':{'id':_0x2c933d['id']}})[_0x27d8('0x15')](function(){_0x44e8ca(0x1);});});});});});}function addAdditionalPhone(_0x3bbc62,_0x464a71,_0x3d9479,_0x2a03d5,_0x216114){return db[_0x27d8('0x96')][_0x27d8('0x3d')]({'where':{'CmContactId':_0x3bbc62,'item':_0x464a71}})[_0x27d8('0x15')](function(_0x29366b){if(_0x29366b)logger[_0x27d8('0x8a')](_0x27d8('0xc3'),_0x29366b);else{db['CmContactHasItem']['create']({'CmContactId':_0x3bbc62,'item':_0x464a71,'ItemTypeId':_0x3d9479,'OrderBy':_0x2a03d5,'ItemClass':_0x27d8('0xc4'),'description':_0x216114});}});}function deletePhones(_0x23967c){return db[_0x27d8('0x96')][_0x27d8('0x7b')]({'where':{'CmContactId':_0x23967c}});}function deleteCmHopperPhones(_0x112161){return new Promise(function(_0x2e9941,_0x2ef224){return db[_0x27d8('0x89')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x112161}})[_0x27d8('0x15')](function(_0x34056b){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x27d8('0x47')](_0x34056b,'id')}}});})['then'](function(){_0x2e9941(0x1);});});}function addCmHopperPhones(_0x307ab1){return new Promise(function(_0x29adf7,_0x4a3b4b){return db[_0x27d8('0x89')][_0x27d8('0x83')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x307ab1}})[_0x27d8('0x15')](function(_0x27f103){var _0x58768e=[];_[_0x27d8('0x47')](_0x27f103,function(_0x4dc036){_0x58768e[_0x27d8('0x78')](createCmHopperPhone(_0x307ab1,_0x4dc036['id']));});Promise['all'](_0x58768e)[_0x27d8('0x15')](function(){_0x29adf7(0x1);});});});}function createCmHopperPhone(_0x885b5,_0x2ea3d1){return new Promise(function(_0x34c8ef,_0x1c771d){db[_0x27d8('0x96')][_0x27d8('0x83')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x885b5,'ItemClass':_0x27d8('0xc4')},'include':[{'model':db[_0x27d8('0xbe')],'attributes':['OrderBy'],'as':'ItemType'}],'order':['OrderBy',db[_0x27d8('0x6d')]['literal'](_0x27d8('0xc5'))]})[_0x27d8('0x15')](function(_0x3fa755){var _0x4c33a1=0x1;var _0x2edca9=_[_0x27d8('0x47')](_0x3fa755,function(_0x48157b){_0x48157b[_0x27d8('0xc6')]=_0x2ea3d1;_0x48157b['phone']=_0x48157b[_0x27d8('0xc7')];_0x48157b[_0x27d8('0xc8')]=_0x4c33a1;delete _0x48157b[_0x27d8('0xc9')];_0x4c33a1=_0x4c33a1+0x1;return _0x48157b;});return db['CmHopperAdditionalPhone'][_0x27d8('0xa5')](_0x2edca9,{});})[_0x27d8('0x15')](function(){_0x34c8ef(0x1);});});}function insertAdditionalPhones(_0x5230f6,_0x5a5153){return new Promise(function(_0x28f174,_0x2df944){var _0x1bcbb5=[];for(var _0x62e921=0x0;_0x62e921<_0x5a5153[_0x27d8('0x1d')];_0x62e921++){var _0x316131=_0x5a5153[_0x62e921];_0x1bcbb5['push'](parseContactItemType(_0x316131));}Promise['all'](_0x1bcbb5)[_0x27d8('0x15')](function(){var _0xc57c53={'id':_0x5230f6['id'],'items':_0x5a5153};return addAdditionalPhones(_0xc57c53)['then'](function(_0x1cf316){return addCmHopperPhones(_0x5230f6['id']);});})[_0x27d8('0x15')](function(){_0x28f174(_0x5230f6);});});}function parseContactItemType(_0x4fdd3e){return new Promise(function(_0xa4750c,_0x1f56e9){if(_0x4fdd3e['hasOwnProperty'](_0x27d8('0xc1'))){_0xa4750c(_0x4fdd3e);}else{return db['ContactItemType'][_0x27d8('0x3d')]({'where':{'name':_0x4fdd3e[_0x27d8('0xaf')]}})[_0x27d8('0x15')](function(_0x46970a){if(_[_0x27d8('0x4a')](_0x46970a))_0x4fdd3e['ItemTypeId']=null;else _0x4fdd3e[_0x27d8('0xc1')]=_0x46970a['id'];_0xa4750c(_0x4fdd3e);});}});}exports[_0x27d8('0xca')]=function(_0x3c97d1,_0x2d6296){return db[_0x27d8('0x96')][_0x27d8('0x83')]({'raw':!![],'where':{'CmContactId':_0x3c97d1['params']['id'],'ItemClass':_0x27d8('0xc4')},'include':[{'model':db[_0x27d8('0xbe')],'as':_0x27d8('0xaf')}],'order':[[_0x27d8('0xc8')],[db[_0x27d8('0x6d')][_0x27d8('0xb0')](_0x27d8('0xc5'))]]})[_0x27d8('0x15')](function(_0x2c9de2){return _0x2c9de2;})[_0x27d8('0x15')](respondWithResult(_0x2d6296,null))[_0x27d8('0x7a')](handleError(_0x2d6296,null));};exports['duplicateAdditionalPhones']=function(_0x3e48bc,_0x5ce736){return db['CmContactHasItem'][_0x27d8('0x83')]({'raw':!![],'where':{'CmContactId':_0x3e48bc[_0x27d8('0x82')][_0x27d8('0xcb')]}})[_0x27d8('0x15')](function(_0x3937e4){var _0x2c9a00=_[_0x27d8('0x47')](_0x3937e4,function(_0x573878){_0x573878[_0x27d8('0xcc')]=_0x3e48bc['body'][_0x27d8('0xcd')];return _0x573878;});return db[_0x27d8('0x96')][_0x27d8('0xa5')](_0x2c9a00,{});})['then'](function(_0x1c15f5){return addCmHopperPhones(_0x3e48bc['body'][_0x27d8('0xcd')]);})['then'](function(_0x5f5230){return['ok'];})[_0x27d8('0x15')](respondWithResult(_0x5ce736,null))[_0x27d8('0x7a')](handleError(_0x5ce736,null));};exports['rescheduleAdditionalPhones']=function(_0x265f38,_0x5a5b46){var _0x20a0a8=[];_0x20a0a8['push'](createCmHopperPhone(_0x265f38[_0x27d8('0x82')]['id'],_0x265f38[_0x27d8('0x82')]['hopperId']));Promise['all'](_0x20a0a8)['then'](function(){return[0x1];})['then'](respondWithResult(_0x5a5b46,null));};exports['getHoppers']=function(_0x450572,_0x5a87ee){var _0x43ee2c={'raw':![],'where':{}};var _0xa3d486={};var _0x58aa33={'count':0x0,'rows':[]};return db[_0x27d8('0x70')]['findOne']({'where':{'id':_0x450572[_0x27d8('0x7c')]['id']}})['then'](handleEntityNotFound(_0x5a87ee,null))['then'](function(_0x51a01d){if(_0x51a01d){_0xa3d486[_0x27d8('0x26')]=_['keys'](db[_0x27d8('0x89')][_0x27d8('0xce')]);_0xa3d486[_0x27d8('0x27')]=_['keys'](_0x450572[_0x27d8('0x27')]);_0xa3d486[_0x27d8('0x2e')]=_['intersection'](_0xa3d486[_0x27d8('0x26')],_0xa3d486['query']);_0x43ee2c[_0x27d8('0x29')]=_[_0x27d8('0x28')](_0xa3d486['model'],qs[_0x27d8('0x2a')](_0x450572['query'][_0x27d8('0x2a')]));_0x43ee2c[_0x27d8('0x29')]=_0x43ee2c[_0x27d8('0x29')][_0x27d8('0x1d')]?_0x43ee2c[_0x27d8('0x29')]:_0xa3d486[_0x27d8('0x26')];if(!_0x450572[_0x27d8('0x27')][_0x27d8('0x48')](_0x27d8('0x2b'))){_0x43ee2c[_0x27d8('0x11')]=qs[_0x27d8('0x11')](_0x450572[_0x27d8('0x27')][_0x27d8('0x11')]);_0x43ee2c[_0x27d8('0xe')]=qs['offset'](_0x450572[_0x27d8('0x27')][_0x27d8('0xe')]);}_0x43ee2c['order']=qs[_0x27d8('0x2d')](_0x450572['query']['sort']);_0x43ee2c[_0x27d8('0x37')]=qs[_0x27d8('0x2e')](_[_0x27d8('0xba')](_0x450572[_0x27d8('0x27')],_0xa3d486[_0x27d8('0x2e')]));_0x43ee2c[_0x27d8('0x37')]['ContactId']=_0x51a01d['id'];if(_0x450572[_0x27d8('0x27')]['filter']){_0x43ee2c[_0x27d8('0x37')]=_[_0x27d8('0x81')](_0x43ee2c[_0x27d8('0x37')],{'$or':_[_0x27d8('0x47')](_0x43ee2c['attributes'],function(_0x3f1146){var _0x3496e6={};_0x3496e6[_0x3f1146]={'$like':'%'+_0x450572['query'][_0x27d8('0x49')]+'%'};return _0x3496e6;})});}_0x43ee2c=_[_0x27d8('0x81')]({},_0x43ee2c,_0x450572[_0x27d8('0xbb')]);return db[_0x27d8('0x89')][_0x27d8('0x10')]({'where':_0x43ee2c[_0x27d8('0x37')]})['then'](function(_0xa39816){_0x58aa33[_0x27d8('0x10')]=_0xa39816;if(_0x450572[_0x27d8('0x27')][_0x27d8('0xcf')]){_0x43ee2c[_0x27d8('0xd0')]=[{'all':!![]}];}return db[_0x27d8('0x89')][_0x27d8('0x83')](_0x43ee2c);})[_0x27d8('0x15')](function(_0x3961da){_0x58aa33[_0x27d8('0x79')]=_0x3961da;return _0x58aa33;});}})[_0x27d8('0x15')](respondWithFilteredResult(_0x5a87ee,_0x43ee2c))['catch'](handleError(_0x5a87ee,null));};exports['getHopperHistories']=function(_0x1e66e9,_0x372523){var _0x4f3f0b={'raw':!![],'where':{}};var _0xaacb2c={};var _0x57e437={'count':0x0,'rows':[]};return db[_0x27d8('0x70')][_0x27d8('0x20')]({'where':{'id':_0x1e66e9['params']['id']}})[_0x27d8('0x15')](handleEntityNotFound(_0x372523,null))['then'](function(_0x5ac980){if(_0x5ac980){_0xaacb2c['model']=_[_0x27d8('0x1c')](db[_0x27d8('0x98')][_0x27d8('0xce')]);_0xaacb2c[_0x27d8('0x27')]=_[_0x27d8('0x1c')](_0x1e66e9[_0x27d8('0x27')]);_0xaacb2c[_0x27d8('0x2e')]=_[_0x27d8('0x28')](_0xaacb2c[_0x27d8('0x26')],_0xaacb2c[_0x27d8('0x27')]);_0x4f3f0b[_0x27d8('0x29')]=_['intersection'](_0xaacb2c['model'],qs[_0x27d8('0x2a')](_0x1e66e9[_0x27d8('0x27')][_0x27d8('0x2a')]));_0x4f3f0b['attributes']=_0x4f3f0b[_0x27d8('0x29')][_0x27d8('0x1d')]?_0x4f3f0b[_0x27d8('0x29')]:_0xaacb2c[_0x27d8('0x26')];if(!_0x1e66e9[_0x27d8('0x27')][_0x27d8('0x48')](_0x27d8('0x2b'))){_0x4f3f0b[_0x27d8('0x11')]=qs['limit'](_0x1e66e9[_0x27d8('0x27')][_0x27d8('0x11')]);_0x4f3f0b[_0x27d8('0xe')]=qs[_0x27d8('0xe')](_0x1e66e9['query'][_0x27d8('0xe')]);}_0x4f3f0b[_0x27d8('0x2c')]=qs[_0x27d8('0x2d')](_0x1e66e9[_0x27d8('0x27')]['sort']);_0x4f3f0b['where']=qs[_0x27d8('0x2e')](_['pick'](_0x1e66e9['query'],_0xaacb2c[_0x27d8('0x2e')]));_0x4f3f0b[_0x27d8('0x37')][_0x27d8('0xd1')]=_0x5ac980['id'];if(_0x1e66e9[_0x27d8('0x27')][_0x27d8('0x49')]){_0x4f3f0b[_0x27d8('0x37')]=_[_0x27d8('0x81')](_0x4f3f0b['where'],{'$or':_[_0x27d8('0x47')](_0x4f3f0b[_0x27d8('0x29')],function(_0x1fc0ea){var _0x4137b1={};_0x4137b1[_0x1fc0ea]={'$like':'%'+_0x1e66e9[_0x27d8('0x27')]['filter']+'%'};return _0x4137b1;})});}_0x4f3f0b=_[_0x27d8('0x81')]({},_0x4f3f0b,_0x1e66e9[_0x27d8('0xbb')]);return db['CmHopperHistory'][_0x27d8('0x10')]({'where':_0x4f3f0b['where']})['then'](function(_0x552fb2){_0x57e437[_0x27d8('0x10')]=_0x552fb2;if(_0x1e66e9['query'][_0x27d8('0xcf')]){_0x4f3f0b[_0x27d8('0xd0')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x27d8('0x83')](_0x4f3f0b);})[_0x27d8('0x15')](function(_0x476f81){_0x57e437[_0x27d8('0x79')]=_0x476f81;return _0x57e437;});}})['then'](respondWithFilteredResult(_0x372523,_0x4f3f0b))['catch'](handleError(_0x372523,null));};exports[_0x27d8('0xd2')]=function(_0x599933,_0x1c2415){var _0xd85d6f={'raw':!![],'where':{}};var _0x3ebe04={};var _0x51cd9f={'count':0x0,'rows':[]};return db['CmContact'][_0x27d8('0x20')]({'where':{'id':_0x599933[_0x27d8('0x7c')]['id']}})[_0x27d8('0x15')](handleEntityNotFound(_0x1c2415,null))['then'](function(_0x2f795c){if(_0x2f795c){_0x3ebe04['model']=_[_0x27d8('0x1c')](db['CmHopperFinal'][_0x27d8('0xce')]);_0x3ebe04[_0x27d8('0x27')]=_[_0x27d8('0x1c')](_0x599933[_0x27d8('0x27')]);_0x3ebe04[_0x27d8('0x2e')]=_[_0x27d8('0x28')](_0x3ebe04[_0x27d8('0x26')],_0x3ebe04[_0x27d8('0x27')]);_0xd85d6f['attributes']=_['intersection'](_0x3ebe04[_0x27d8('0x26')],qs[_0x27d8('0x2a')](_0x599933['query'][_0x27d8('0x2a')]));_0xd85d6f[_0x27d8('0x29')]=_0xd85d6f['attributes'][_0x27d8('0x1d')]?_0xd85d6f[_0x27d8('0x29')]:_0x3ebe04[_0x27d8('0x26')];if(!_0x599933[_0x27d8('0x27')][_0x27d8('0x48')](_0x27d8('0x2b'))){_0xd85d6f['limit']=qs[_0x27d8('0x11')](_0x599933['query'][_0x27d8('0x11')]);_0xd85d6f[_0x27d8('0xe')]=qs[_0x27d8('0xe')](_0x599933[_0x27d8('0x27')]['offset']);}_0xd85d6f[_0x27d8('0x2c')]=qs['sort'](_0x599933[_0x27d8('0x27')][_0x27d8('0x2d')]);_0xd85d6f[_0x27d8('0x37')]=qs[_0x27d8('0x2e')](_[_0x27d8('0xba')](_0x599933[_0x27d8('0x27')],_0x3ebe04[_0x27d8('0x2e')]));_0xd85d6f[_0x27d8('0x37')][_0x27d8('0xd1')]=_0x2f795c['id'];if(_0x599933[_0x27d8('0x27')][_0x27d8('0x49')]){_0xd85d6f[_0x27d8('0x37')]=_[_0x27d8('0x81')](_0xd85d6f[_0x27d8('0x37')],{'$or':_[_0x27d8('0x47')](_0xd85d6f[_0x27d8('0x29')],function(_0x28f8c3){var _0x360109={};_0x360109[_0x28f8c3]={'$like':'%'+_0x599933[_0x27d8('0x27')][_0x27d8('0x49')]+'%'};return _0x360109;})});}_0xd85d6f=_[_0x27d8('0x81')]({},_0xd85d6f,_0x599933[_0x27d8('0xbb')]);return db[_0x27d8('0x97')][_0x27d8('0x10')]({'where':_0xd85d6f['where']})[_0x27d8('0x15')](function(_0x4a6c11){_0x51cd9f[_0x27d8('0x10')]=_0x4a6c11;if(_0x599933['query'][_0x27d8('0xcf')]){_0xd85d6f[_0x27d8('0xd0')]=[{'all':!![]}];}return db[_0x27d8('0x97')]['findAll'](_0xd85d6f);})['then'](function(_0x245a77){_0x51cd9f[_0x27d8('0x79')]=_0x245a77;return _0x51cd9f;});}})['then'](respondWithFilteredResult(_0x1c2415,_0xd85d6f))['catch'](handleError(_0x1c2415,null));};exports['getJscriptySessions']=function(_0x3d867c,_0x1c46d5){var _0x187f2b={'raw':!![],'where':{}};var _0xd4c835={};var _0x4271f8={'count':0x0,'rows':[]};return db[_0x27d8('0x70')][_0x27d8('0x20')]({'where':{'id':_0x3d867c['params']['id']}})[_0x27d8('0x15')](handleEntityNotFound(_0x1c46d5,null))[_0x27d8('0x15')](function(_0x2d323a){if(_0x2d323a){_0xd4c835[_0x27d8('0x26')]=_[_0x27d8('0x1c')](db[_0x27d8('0xd3')]['rawAttributes']);_0xd4c835[_0x27d8('0x27')]=_[_0x27d8('0x1c')](_0x3d867c[_0x27d8('0x27')]);_0xd4c835[_0x27d8('0x2e')]=_[_0x27d8('0x28')](_0xd4c835[_0x27d8('0x26')],_0xd4c835['query']);_0x187f2b[_0x27d8('0x29')]=_[_0x27d8('0x28')](_0xd4c835[_0x27d8('0x26')],qs['fields'](_0x3d867c[_0x27d8('0x27')][_0x27d8('0x2a')]));_0x187f2b['attributes']=_0x187f2b['attributes']['length']?_0x187f2b[_0x27d8('0x29')]:_0xd4c835[_0x27d8('0x26')];if(!_0x3d867c[_0x27d8('0x27')]['hasOwnProperty']('nolimit')){_0x187f2b['limit']=qs[_0x27d8('0x11')](_0x3d867c[_0x27d8('0x27')][_0x27d8('0x11')]);_0x187f2b[_0x27d8('0xe')]=qs[_0x27d8('0xe')](_0x3d867c[_0x27d8('0x27')][_0x27d8('0xe')]);}_0x187f2b[_0x27d8('0x2c')]=qs[_0x27d8('0x2d')](_0x3d867c[_0x27d8('0x27')][_0x27d8('0x2d')]);_0x187f2b[_0x27d8('0x37')]=qs[_0x27d8('0x2e')](_[_0x27d8('0xba')](_0x3d867c[_0x27d8('0x27')],_0xd4c835[_0x27d8('0x2e')]));_0x187f2b[_0x27d8('0x37')][_0x27d8('0xd1')]=_0x2d323a['id'];if(_0x3d867c[_0x27d8('0x27')]['filter']){_0x187f2b['where']=_['merge'](_0x187f2b[_0x27d8('0x37')],{'$or':_[_0x27d8('0x47')](_0x187f2b[_0x27d8('0x29')],function(_0x165a23){var _0x5af975={};_0x5af975[_0x165a23]={'$like':'%'+_0x3d867c[_0x27d8('0x27')][_0x27d8('0x49')]+'%'};return _0x5af975;})});}_0x187f2b=_[_0x27d8('0x81')]({},_0x187f2b,_0x3d867c['options']);return db['JscriptySessionReport'][_0x27d8('0x10')]({'where':_0x187f2b['where']})[_0x27d8('0x15')](function(_0x4c0dd3){_0x4271f8[_0x27d8('0x10')]=_0x4c0dd3;if(_0x3d867c['query'][_0x27d8('0xcf')]){_0x187f2b[_0x27d8('0xd0')]=[{'all':!![]}];}return db[_0x27d8('0xd3')][_0x27d8('0x83')](_0x187f2b);})[_0x27d8('0x15')](function(_0x110558){_0x4271f8[_0x27d8('0x79')]=_0x110558;return _0x4271f8;});}})['then'](respondWithFilteredResult(_0x1c46d5,_0x187f2b))[_0x27d8('0x7a')](handleError(_0x1c46d5,null));};exports[_0x27d8('0xd4')]=function(_0x5ad662,_0x544bc7){try{if(!_0x5ad662[_0x27d8('0x82')][_0x27d8('0x4e')]){throw new Error(_0x27d8('0xd5'));}if(!_0x5ad662[_0x27d8('0x82')][_0x27d8('0xd6')]){throw new Error(_0x27d8('0xd7'));}if(!_0x5ad662['body'][_0x27d8('0xd8')]){throw new Error(_0x27d8('0xd9'));}if(!_0x5ad662[_0x27d8('0x82')][_0x27d8('0xda')]){throw new Error(_0x27d8('0xdb'));}var _0x518519=_0x5ad662['body'][_0x27d8('0xd6')][_0x27d8('0x3f')](',');var _0x5552b7=_0x5ad662['body'][_0x27d8('0xd8')][_0x27d8('0x3f')](',');if(!_0x518519[_0x27d8('0x1d')]||!_0x5552b7['length']||_0x518519[_0x27d8('0x1d')]!==_0x5552b7[_0x27d8('0x1d')]){throw new Error(_0x27d8('0xdc'));}_0x5ad662[_0x27d8('0x82')][_0x27d8('0x2a')]=_[_0x27d8('0xdd')](_0x518519,_0x5552b7);if(!_0x5ad662['body']['fields'][_0x27d8('0xb9')]){throw new Error(_0x27d8('0xde'));}if(!_0x5ad662[_0x27d8('0x82')]['fields'][_0x27d8('0xdf')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x1fac32=path[_0x27d8('0x87')](config[_0x27d8('0xe0')],'server/files/tmp',_0x5ad662['file'][_0x27d8('0xe1')]);fs[_0x27d8('0xe2')](_0x1fac32,parseInt(_0x27d8('0xe3'),0x8));var _0xbe92ab=require(_0x27d8('0xe4'))[_0x27d8('0xe5')](path[_0x27d8('0x87')](__dirname,'../../components/import/cm/csv'),[_0x1fac32,_0x5ad662[_0x27d8('0x82')][_0x27d8('0xd6')],_0x5ad662[_0x27d8('0x82')][_0x27d8('0xd8')],_0x5ad662[_0x27d8('0x82')][_0x27d8('0x4e')],_0x5ad662[_0x27d8('0x82')][_0x27d8('0xe6')],_0x5ad662[_0x27d8('0x82')][_0x27d8('0xa7')],_0x5ad662[_0x27d8('0x82')][_0x27d8('0xda')]]);return _0x544bc7[_0x27d8('0xd')](0xc8)[_0x27d8('0x13')]({'message':_0x27d8('0xe7'),'pid':_0xbe92ab['pid']});}catch(_0xe88f78){return _0x544bc7[_0x27d8('0xd')](0x1f4)['send'](_0xe88f78);}};exports[_0x27d8('0xe8')]=function(_0xcc437,_0x2fb425){var _0x3c70b4=fs[_0x27d8('0xe9')](_0xcc437['file']['path']);Papa[_0x27d8('0xea')](_0x3c70b4,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2b87be){return _0x2fb425[_0x27d8('0xd')](0xc8)[_0x27d8('0x13')]({'file':_0xcc437['file'],'fields':_0x2b87be[_0x27d8('0xeb')][_0x27d8('0x2a')]});}});};exports['import']=function(_0x385c2b,_0x2c81b2){return db[_0x27d8('0x41')][_0x27d8('0x83')]({'raw':!![],'attributes':['id'],'where':{'role':_0x27d8('0x6a')}})['then'](function(_0x3436d4){var _0x1764ca=![];if(!_0x385c2b[_0x27d8('0x82')]['ListId']){throw new Error(_0x27d8('0xd5'));}if(!_0x385c2b['body']['binding'][_0x27d8('0xb9')]){throw new Error(_0x27d8('0xde'));}if(!_0x385c2b[_0x27d8('0x82')][_0x27d8('0xec')][_0x27d8('0xdf')]){throw new Error(_0x27d8('0xed'));}if(!_0x385c2b[_0x27d8('0x82')][_0x27d8('0xda')]){throw new Error(_0x27d8('0xdb'));}var _0x27a23c=require(_0x27d8('0xe4'))[_0x27d8('0xe5')](path[_0x27d8('0x87')](__dirname,_0x27d8('0xee')),[_0x385c2b['params']['id'],JSON['stringify'](_0x385c2b[_0x27d8('0x82')]),JSON['stringify'](_0x3436d4)]);_0x27a23c['on']('message',function(){_0x1764ca=!![];return _0x2c81b2[_0x27d8('0xd')](0xc8)['json']({'message':_0x27d8('0xef'),'pid':_0x27a23c[_0x27d8('0xf0')]});});_0x27a23c['on']('exit',function(_0x480ad1){if(_0x480ad1&&!_0x1764ca){return _0x2c81b2[_0x27d8('0xd')](0x1f4)[_0x27d8('0x13')]({'message':_0x27d8('0xf1'),'pid':_0x27a23c['pid']});}});})[_0x27d8('0x7a')](handleError(_0x2c81b2,null));};exports[_0x27d8('0xf2')]=function(_0x5b8272,_0x3f6137,_0x1c55d3){return db[_0x27d8('0x41')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x27d8('0x15')](function(_0x460ccb){var _0x49c085=![];if(!_0x5b8272[_0x27d8('0x82')][_0x27d8('0x4e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5b8272[_0x27d8('0x82')][_0x27d8('0xec')]['phone']){throw new Error(_0x27d8('0xde'));}if(!_0x5b8272[_0x27d8('0x82')][_0x27d8('0xec')][_0x27d8('0xdf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5b8272['body'][_0x27d8('0xda')]){throw new Error(_0x27d8('0xdb'));}var _0x2e885d=require(_0x27d8('0xe4'))[_0x27d8('0xe5')](path[_0x27d8('0x87')](__dirname,'../../components/import/cm/csvUpdates'),[_0x5b8272['params']['id'],JSON[_0x27d8('0xf3')](_0x5b8272['body']),JSON[_0x27d8('0xf3')](_0x460ccb)]);_0x2e885d['on'](_0x27d8('0xf4'),function(_0x1127b9){_0x49c085=!![];return _0x3f6137[_0x27d8('0xd')](0xc8)[_0x27d8('0x13')]({'message':_0x27d8('0xef'),'pid':_0x2e885d[_0x27d8('0xf0')]});});_0x2e885d['on'](_0x27d8('0xf5'),function(_0x84f4eb){if(_0x84f4eb&&!_0x49c085){return _0x3f6137['status'](0x1f4)[_0x27d8('0x13')]({'message':_0x27d8('0xf1'),'pid':_0x2e885d[_0x27d8('0xf0')]});}});})[_0x27d8('0x7a')](handleError(_0x3f6137,null));};exports[_0x27d8('0xf6')]=function(_0x170d1e,_0x49fbea){var _0x4cdb95=[_0x27d8('0xf7'),_0x27d8('0xf8'),_0x27d8('0xf9'),_0x27d8('0xfa'),_0x27d8('0xfb'),'whatsapp','voice'];var _0x13e407={'offset':0x0,'order':qs[_0x27d8('0x2d')](_0x27d8('0xfc'))},_0x2dcfd9={'count':0x0,'rows':[]};Promise[_0x27d8('0x67')]()[_0x27d8('0x15')](function(){if(_0x170d1e[_0x27d8('0x27')]['channel']){if(!_['includes'](_0x4cdb95,_0x170d1e[_0x27d8('0x27')]['channel'][_0x27d8('0xfd')]())){throw new Error('Invalid\x20channel');}_0x4cdb95=[_0x170d1e[_0x27d8('0x27')][_0x27d8('0xfe')]['toLowerCase']()];}if(_0x170d1e[_0x27d8('0x27')][_0x27d8('0xff')]){try{var _0x582055=JSON[_0x27d8('0xea')](_0x170d1e[_0x27d8('0x27')][_0x27d8('0xff')]);if(!moment(_0x582055[_0x27d8('0x31')])[_0x27d8('0x100')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x582055['to'])[_0x27d8('0x100')]()){throw new Error(_0x27d8('0x101'));}}catch(_0x49c673){throw new Error(_0x27d8('0x102'));}}if(!_0x170d1e[_0x27d8('0x27')][_0x27d8('0x48')](_0x27d8('0x2b'))){_0x13e407[_0x27d8('0x11')]=qs['limit'](_0x170d1e['query'][_0x27d8('0x11')]||0xa);_0x13e407[_0x27d8('0xe')]=qs[_0x27d8('0xe')](_0x170d1e[_0x27d8('0x27')][_0x27d8('0xe')]);}var _0x2f821c=_0x4cdb95[_0x27d8('0x47')](function(_0x465b06){if(_0x465b06==='voice'){var _0x1aa5f7={'attributes':['id','uniqueid',_0x27d8('0x25'),_0x27d8('0x103'),_0x27d8('0x104'),_0x27d8('0x105'),_0x27d8('0x106'),_0x27d8('0x107'),_0x27d8('0x108'),_0x27d8('0x109'),'createdAt','userDisposition',_0x27d8('0x10a'),_0x27d8('0x10b'),_0x27d8('0x10c')],'where':{'ContactId':_0x170d1e['params']['id']},'include':[{'model':db[_0x27d8('0x41')],'as':_0x27d8('0x41'),'attributes':['id',_0x27d8('0x19'),_0x27d8('0x10d'),_0x27d8('0x10e')]}],'order':[[_0x27d8('0x10f'),'DESC']]};if(_0x170d1e['query']['range']){_0x1aa5f7[_0x27d8('0x37')][_0x27d8('0x10f')]={'$gte':_0x582055[_0x27d8('0x31')],'$lte':_0x582055['to']};}return db[_0x27d8('0x9a')][_0x27d8('0x110')](_0x1aa5f7)[_0x27d8('0x15')](function(_0x9fea73){_0x2dcfd9[_0x27d8('0x10')]+=_0x9fea73[_0x27d8('0x10')];return _[_0x27d8('0x47')](_0x9fea73[_0x27d8('0x79')],function(_0x41f350){var _0x26dc4e=_0x41f350[_0x27d8('0x84')]({'plain':!![]});_0x26dc4e['channel']=_0x465b06;if(_0x26dc4e[_0x27d8('0x41')]){_0x26dc4e['User']={'id':_0x26dc4e[_0x27d8('0x41')]['id'],'name':_0x26dc4e[_0x27d8('0x41')][_0x27d8('0x19')],'fullname':_0x26dc4e['User'][_0x27d8('0x10d')],'alias':_0x26dc4e[_0x27d8('0x41')]['alias']};}return _0x26dc4e;});});}else{var _0x22c113=_[_0x27d8('0x111')](_0x465b06)+(_0x465b06===_0x27d8('0xf8')?'Website':_0x27d8('0x112'));var _0x2357a7={'attributes':['id',_0x27d8('0x113'),'closedAt',_0x27d8('0x10f'),_0x27d8('0x109'),_0x27d8('0x114'),'secondDisposition','thirdDisposition','UserId',_0x22c113+'Id'],'where':{'ContactId':_0x170d1e[_0x27d8('0x7c')]['id']},'include':[{'model':db[_0x22c113],'as':'Account','attributes':['id','name',_0x27d8('0x115')]},{'model':db[_0x27d8('0x41')],'as':_0x27d8('0x116'),'attributes':['id','name',_0x27d8('0x10d')]},{'model':db[_0x27d8('0xad')],'as':_0x27d8('0x77'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0x27d8('0x10f'),_0x27d8('0x117')]]};if(_0x170d1e[_0x27d8('0x27')][_0x27d8('0xff')]){_0x2357a7[_0x27d8('0x37')][_0x27d8('0x10f')]={'$gte':_0x582055[_0x27d8('0x31')],'$lte':_0x582055['to']};}switch(_0x465b06){case _0x27d8('0xf8'):_0x2357a7['attributes'][_0x27d8('0x78')](_0x27d8('0x118'),_0x27d8('0x119'),'customerPort',_0x27d8('0x11a'),_0x27d8('0x11b'),'ratingMessage',_0x27d8('0x11c'),_0x27d8('0x11d'),'referer');break;case _0x27d8('0xf7'):_0x2357a7[_0x27d8('0x29')][_0x27d8('0x78')](_0x27d8('0x11e'),'substatus');break;case _0x27d8('0xfa'):_0x2357a7['attributes'][_0x27d8('0x78')]('externalUrl',_0x27d8('0x11f'));break;}return db[_[_0x27d8('0x111')](_0x465b06)+_0x27d8('0x120')][_0x27d8('0x110')](_0x2357a7)['then'](function(_0xcbe7a6){_0x2dcfd9[_0x27d8('0x10')]+=_0xcbe7a6[_0x27d8('0x10')];return _[_0x27d8('0x47')](_0xcbe7a6['rows'],function(_0x520acd){var _0x35e5de=_0x520acd['get']({'plain':!![]});_0x35e5de['channel']=_0x465b06;if(_0x35e5de[_0x27d8('0x116')]){_0x35e5de[_0x27d8('0x116')]={'id':_0x35e5de['Owner']['id'],'name':_0x35e5de[_0x27d8('0x116')]['name'],'fullname':_0x35e5de[_0x27d8('0x116')][_0x27d8('0x10d')]};}return _0x35e5de;});});}});return Promise['all'](_0x2f821c);})['then'](function(_0x1c195e){return _(_0x1c195e)['flatten']()['sortBy'](_0x27d8('0x10f'))['reverse']()[_0x27d8('0x3e')]();})[_0x27d8('0x15')](function(_0x299e52){_0x2dcfd9[_0x27d8('0x79')]=_0x13e407['limit']?_0x299e52[_0x27d8('0x121')](_0x13e407['offset'],_0x13e407['offset']+_0x13e407[_0x27d8('0x11')]):_0x299e52;return _0x2dcfd9;})[_0x27d8('0x15')](respondWithFilteredResult(_0x49fbea,_0x13e407))['catch'](handleError(_0x49fbea,null));}; \ No newline at end of file +var _0x5b65=['tags','startsWith','columnName','displayName','analytics','findAll','alias','custom','merge','body','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmContactHasItem','CmHopperHistory','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','params','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','cf_%d','pickBy','format','table','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','options','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','CmHopperFinal','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','meta','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','callerid','starttime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','startCase','Website','closedAt','thirdDisposition','Account','key','browserName','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','slice','bluebird','util','path','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','update','then','destroy','end','stack','name','send','index','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','User','and','uc.UserId\x20=\x20?','datetime','text','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','user','role','c.ListId\x20IS\x20NULL','agent','toString','sequelize','keyBy','CmContact','c.firstName','c.phone','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch'];(function(_0x1b04e6,_0x257b26){var _0x54b637=function(_0x438044){while(--_0x438044){_0x1b04e6['push'](_0x1b04e6['shift']());}};_0x54b637(++_0x257b26);}(_0x5b65,0x1e3));var _0x55b6=function(_0x57c6f3,_0x34a5f2){_0x57c6f3=_0x57c6f3-0x0;var _0x44bca5=_0x5b65[_0x57c6f3];return _0x44bca5;};'use strict';var moment=require('moment');var BPromise=require(_0x55b6('0x0'));var util=require(_0x55b6('0x1'));var path=require(_0x55b6('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0x55b6('0x3'));var Redis=require(_0x55b6('0x4'));var qs=require(_0x55b6('0x5'));var as=require(_0x55b6('0x6'));var logger=require('../../config/logger')(_0x55b6('0x7'));var config=require(_0x55b6('0x8'));var shared=require(_0x55b6('0x9'));var db=require('../../mysqldb')['db'];config[_0x55b6('0xa')]=_[_0x55b6('0xb')](config['redis'],{'host':_0x55b6('0xc'),'port':0x18eb});var socket=require(_0x55b6('0xd'))(new Redis(config[_0x55b6('0xa')]));require(_0x55b6('0xe'))[_0x55b6('0xf')](socket);function respondWithResult(_0x36dff2,_0x546421){_0x546421=_0x546421||0xc8;return function(_0x4662a4){if(_0x4662a4){return _0x36dff2[_0x55b6('0x10')](_0x546421)[_0x55b6('0x11')](_0x4662a4);}};}function respondWithFilteredResult(_0x1980ad,_0x187bce){return function(_0x17b85b){if(_0x17b85b){var _0x442265=typeof _0x187bce[_0x55b6('0x12')]==='undefined'&&typeof _0x187bce[_0x55b6('0x13')]===_0x55b6('0x14');var _0x8ec2e6=_0x17b85b[_0x55b6('0x15')];var _0x224544=_0x442265?0x0:_0x187bce[_0x55b6('0x12')];var _0x49cb4f=_0x442265?_0x17b85b['count']:_0x187bce[_0x55b6('0x12')]+_0x187bce['limit'];var _0x297903;if(_0x49cb4f>=_0x8ec2e6){_0x49cb4f=_0x8ec2e6;_0x297903=0xc8;}else{_0x297903=0xce;}_0x1980ad[_0x55b6('0x10')](_0x297903);return _0x1980ad[_0x55b6('0x16')]('Content-Range',_0x224544+'-'+_0x49cb4f+'/'+_0x8ec2e6)['json'](_0x17b85b);}return null;};}function saveUpdates(_0x3e0814){return function(_0x58de58){if(_0x58de58){return _0x58de58[_0x55b6('0x17')](_0x3e0814)[_0x55b6('0x18')](function(_0x2c10c6){return _0x2c10c6;});}return null;};}function removeEntity(_0x1e2be8){return function(_0x22a6ce){if(_0x22a6ce){return _0x22a6ce[_0x55b6('0x19')]()[_0x55b6('0x18')](function(){_0x1e2be8[_0x55b6('0x10')](0xcc)[_0x55b6('0x1a')]();});}};}function handleEntityNotFound(_0x501fdd){return function(_0x42c445){if(!_0x42c445){_0x501fdd['sendStatus'](0x194);}return _0x42c445;};}function handleError(_0x1a429a,_0x2803c7){_0x2803c7=_0x2803c7||0x1f4;return function(_0x335fba){logger['error'](_0x335fba[_0x55b6('0x1b')]);if(_0x335fba[_0x55b6('0x1c')]){delete _0x335fba[_0x55b6('0x1c')];}_0x1a429a['status'](_0x2803c7)[_0x55b6('0x1d')](_0x335fba);};}exports[_0x55b6('0x1e')]=function(_0x1be441,_0x4e32ce){var _0x3075e7={},_0x52e663={},_0x553d0a={'count':0x0,'rows':[]};return db['CmContact'][_0x55b6('0x1f')]()[_0x55b6('0x18')](function(_0x3c73c2){var _0x1d5af3=[];for(var _0x278fa8=0x0;_0x278fa80x1){_0x1e0622['or'](_0x55b6('0x60'),qs[_0x55b6('0x61')](_0x16d7d2),null);}else{if(qs[_0x55b6('0x62')](_0x16d7d2)){_0x1e0622['or']('c.id\x20LIKE\x20?',_0x16d7d2+'%');_0x1e0622['or']('c.phone\x20LIKE\x20?',_0x16d7d2+'%');_0x1e0622['or']('c.mobile\x20LIKE\x20?',_0x16d7d2+'%');_0x1e0622['or'](_0x55b6('0x63'),_0x16d7d2+'%');}else if(qs['isEmail'](_0x16d7d2)){_0x1e0622['or']('c.email\x20LIKE\x20?',_0x16d7d2+'%');}else{_0x1e0622['or'](_0x55b6('0x64'),'%'+_0x16d7d2+'%');_0x1e0622['or'](_0x55b6('0x65'),'%'+_0x16d7d2+'%');_0x1e0622['or'](_0x55b6('0x66'),'%'+_0x16d7d2+'%');}}}}_0x3ce63a[_0x55b6('0x34')](_0x1e0622);_0x3ce63a['group'](_0x55b6('0x67'));var _0x5d013a={'type':db[_0x55b6('0x68')]['QueryTypes'][_0x55b6('0x69')],'raw':!![]};var _0x3c7b0d=_0x3ce63a[_0x55b6('0x6a')]()[_0x55b6('0x37')](_0x55b6('0x67'));if(_0x3075e7[_0x55b6('0x32')]){_0x3075e7[_0x55b6('0x32')][_0x55b6('0x4c')](function(_0x4ab0ba){_0x3ce63a[_0x55b6('0x32')]('c.'+_0x4ab0ba[0x0],_0x4ab0ba[0x1]===_0x55b6('0x6b')?![]:!![]);});}if(!_[_0x55b6('0x55')](_0xfad1fb)){_0x3ce63a['having'](_0x3332f5);_0x3c7b0d['where'](_0x55b6('0x6c'),_0xfad1fb);}BPromise[_0x55b6('0x6d')]()['then'](function(){if(!_0x22c342)return;if(_0x1be441[_0x55b6('0x6e')][_0x55b6('0x6f')]!=='agent')return;if(!_['some'](_0x22c342[_0x55b6('0x46')],[_0x55b6('0x37'),_0x55b6('0x4d')])){return _0x1be441[_0x55b6('0x6e')]['getLists']({'attributes':['id'],'raw':!![]})[_0x55b6('0x18')](function(_0x55bde5){if(_[_0x55b6('0x55')](_0x55bde5)){_0x3c7b0d[_0x55b6('0x34')](_0x55b6('0x70'));_0x3ce63a[_0x55b6('0x34')](_0x55b6('0x70'));}else{_0x3c7b0d[_0x55b6('0x34')]('c.ListId\x20IN\x20?',_[_0x55b6('0x4b')](_0x55bde5,'id'));_0x3ce63a['where']('c.ListId\x20IN\x20?',_['map'](_0x55bde5,'id'));}});}})[_0x55b6('0x18')](function(){if(_0x1be441[_0x55b6('0x6e')][_0x55b6('0x6f')]===_0x55b6('0x71')&&!_0x22c342&&!_0x1be441[_0x55b6('0x2b')][_0x55b6('0x56')])return[];return db['sequelize'][_0x55b6('0x2b')](_0x3c7b0d[_0x55b6('0x72')](),_0x5d013a);})[_0x55b6('0x18')](function(_0x3b2bb4){_0x553d0a['count']=_0x3b2bb4[_0x55b6('0x21')];if(_0x553d0a[_0x55b6('0x15')]===0x0)return[];return db[_0x55b6('0x73')][_0x55b6('0x2b')](_0x4285c8[_0x55b6('0x72')](),_0x5d013a)['then'](function(_0x239ce5){_0x1012e8=_[_0x55b6('0x74')](_0x239ce5,'id');_0x5d013a=_['merge'](_0x5d013a,{'model':db[_0x55b6('0x75')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1be441[_0x55b6('0x2b')][_0x55b6('0x2f')]){_0x3075e7[_0x55b6('0x2e')]['forEach'](function(_0x569dc1){_0x3ce63a[_0x55b6('0x37')]('c.'+_0x569dc1);});}else{_0x3ce63a[_0x55b6('0x37')](_0x55b6('0x67'));_0x3ce63a['field'](_0x55b6('0x76'));_0x3ce63a['field']('c.lastName');_0x3ce63a[_0x55b6('0x37')](_0x55b6('0x77'));_0x3ce63a[_0x55b6('0x37')](_0x55b6('0x78'));_0x3ce63a['field'](_0x55b6('0x79'));_0x3ce63a[_0x55b6('0x37')](_0x55b6('0x7a'));_0x3ce63a[_0x55b6('0x37')]('c.ListId');_0x3ce63a['field'](_0x55b6('0x7b'));_0x3ce63a[_0x55b6('0x37')](_0x55b6('0x7c'));_0x3ce63a[_0x55b6('0x37')](_0x55b6('0x7d'));_0x3ce63a[_0x55b6('0x37')](_0x55b6('0x7e'),_0x55b6('0x7f'));}if(_0x3075e7[_0x55b6('0x13')])_0x3ce63a[_0x55b6('0x13')](_0x3075e7['limit']);if(_0x3075e7[_0x55b6('0x12')])_0x3ce63a[_0x55b6('0x12')](_0x3075e7['offset']);return db['sequelize']['query'](_0x3ce63a[_0x55b6('0x72')](),_0x5d013a);});})[_0x55b6('0x18')](function(_0x27055d){_0x27055d[_0x55b6('0x4c')](function(_0x45865b){if(_0x45865b[_0x55b6('0x7f')]){_0x45865b['Tags']=[];_0x45865b[_0x55b6('0x7f')][_0x55b6('0x4a')](',')[_0x55b6('0x4c')](function(_0x5322c2){_0x45865b[_0x55b6('0x80')][_0x55b6('0x23')](_0x1012e8[_0x5322c2]);});}delete _0x45865b[_0x55b6('0x7f')];});_0x553d0a[_0x55b6('0x81')]=_0x27055d;return _0x553d0a;})[_0x55b6('0x18')](respondWithFilteredResult(_0x4e32ce,_0x3075e7));})['catch'](handleError(_0x4e32ce,null));};exports[_0x55b6('0x19')]=function(_0x399320,_0x22f329){return db[_0x55b6('0x75')][_0x55b6('0x47')]({'where':{'id':_0x399320['params']['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0x22f329,null))[_0x55b6('0x18')](removeEntity(_0x22f329,null))[_0x55b6('0x82')](handleError(_0x22f329,null));};exports[_0x55b6('0x1f')]=function(_0x51b99b,_0x409043){return db[_0x55b6('0x75')][_0x55b6('0x1f')]()[_0x55b6('0x18')](function(_0x4c3f08){delete _0x4c3f08[_0x55b6('0x83')];for(var _0x55bd24=0x0;_0x55bd240x0){return new Promise(function(_0x5ecbf0,_0x2c2ead){var _0x489dbb=[];for(var _0x1d5f6d=0x0;_0x1d5f6d<_0x44106f['length'];_0x1d5f6d++){_0x489dbb[_0x55b6('0x23')](insertAdditionalPhones(_0x44106f[_0x1d5f6d][_0x55b6('0xb1')],_0x44106f[_0x1d5f6d]['additionalPhones']));}Promise[_0x55b6('0x27')](_0x489dbb)[_0x55b6('0x18')](function(){_0x5ecbf0(0x1);});})[_0x55b6('0x18')](function(){return{'success':_0x4d6f,'failure':_0x38aa3f,'duplicates':_0x2a4248};});}else{return{'success':_0x4d6f,'failure':_0x38aa3f,'duplicates':_0x2a4248};}}})[_0x55b6('0x18')](respondWithResult(_0x1ed31d,0xc9))['catch'](handleError(_0x1ed31d,null));};exports[_0x55b6('0xb2')]=function(_0x36c643,_0x366f4b){var _0x2cd361;return db['CmContact'][_0x55b6('0x1f')]()[_0x55b6('0x18')](function(_0x5447ea){return db['CmContact'][_0x55b6('0x47')]({'where':{'id':_0x36c643[_0x55b6('0xb3')]['id']},'include':[{'model':db[_0x55b6('0x48')],'as':_0x55b6('0x80'),'attributes':['id',_0x55b6('0x1c'),_0x55b6('0x38')],'required':_0x36c643['query']['tag']?!![]:![]},{'model':db[_0x55b6('0x9e')],'as':_0x55b6('0xb4'),'where':{'CmContactId':_0x36c643[_0x55b6('0xb3')]['id']},'required':![],'include':[{'model':db[_0x55b6('0xb5')],'as':_0x55b6('0xb6')}]}],'order':[db[_0x55b6('0x73')][_0x55b6('0xb7')](_0x55b6('0xb8'))],'attributes':_[_0x55b6('0x20')](_0x5447ea)});})[_0x55b6('0x18')](function(_0x6295dc){if(!_[_0x55b6('0x53')](_0x6295dc)){_0x2cd361=_0x6295dc[_0x55b6('0x8d')]({'plain':!![]});var _0xfd0524={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x6295dc&&_0x6295dc[_0x55b6('0x56')]){if(_0x6295dc[_0x55b6('0x56')]){_0xfd0524['where'][_0x55b6('0xb9')][_0x55b6('0x23')]({'ListId':{'$ne':_0x6295dc[_0x55b6('0x56')]}});}}return db[_0x55b6('0x24')]['findAll'](_0xfd0524);}})[_0x55b6('0x18')](function(_0x2dc151){if(!_[_0x55b6('0x53')](_0x2dc151)){return _[_0x55b6('0xba')](_0x2cd361,_[_0x55b6('0x4b')](_0x2dc151,function(_0x59491e){return util['format'](_0x55b6('0xbb'),_0x59491e['id']);}));}})[_0x55b6('0x18')](handleEntityNotFound(_0x366f4b,null))[_0x55b6('0x18')](respondWithResult(_0x366f4b,null))[_0x55b6('0x82')](handleError(_0x366f4b,null));};exports[_0x55b6('0x17')]=function(_0x46abdd,_0x205b70){var _0x460593;if(_0x46abdd[_0x55b6('0x8c')]['id']){delete _0x46abdd['body']['id'];}if(!_[_0x55b6('0x53')](_0x46abdd['body'][_0x55b6('0xa7')])){var _0x42193e=_0x46abdd[_0x55b6('0x8c')][_0x55b6('0xa7')];if(!_['isNil'](shared['timezones'][_0x42193e]))_0x46abdd[_0x55b6('0x8c')][_0x55b6('0xa9')]=shared['timezones'][_0x42193e][_0x55b6('0xa9')];}return db[_0x55b6('0x75')][_0x55b6('0x47')]({'where':{'id':_0x46abdd[_0x55b6('0xb3')]['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0x205b70,null))['then'](saveUpdates(_0x46abdd[_0x55b6('0x8c')],null))[_0x55b6('0x18')](function(_0x352a23){_0x460593=_0x352a23;var _0x3ce280={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x352a23&&_0x352a23[_0x55b6('0x56')]){if(_0x352a23['ListId']){_0x3ce280['where'][_0x55b6('0xb9')][_0x55b6('0x23')]({'ListId':{'$ne':_0x352a23[_0x55b6('0x56')]}});}}return db[_0x55b6('0x24')][_0x55b6('0x88')](_0x3ce280);})['then'](function(_0x3a7061){if(_0x3a7061){return _[_0x55b6('0xba')](_[_0x55b6('0xbc')](_0x46abdd[_0x55b6('0x8c')],function(_0x2b1c82,_0x51564c){return _[_0x55b6('0x84')](_0x51564c,_0x55b6('0x22'));}),_[_0x55b6('0x4b')](_0x3a7061,function(_0x54a913){return util[_0x55b6('0xbd')](_0x55b6('0xbb'),_0x54a913['id']);}));}})[_0x55b6('0x18')](function(_0x5c9ea4){if(_0x5c9ea4&&!_[_0x55b6('0x55')](_0x5c9ea4)){var _0x3aa10c=squel[_0x55b6('0x17')]()[_0x55b6('0xbe')](_0x55b6('0x3b'))[_0x55b6('0xbf')](_0x5c9ea4)[_0x55b6('0x34')](_0x55b6('0xc0'),_0x46abdd['params']['id'])['toParam']();return db[_0x55b6('0x73')][_0x55b6('0x2b')](_0x3aa10c[_0x55b6('0x51')],{'replacements':_0x3aa10c[_0x55b6('0xc1')]});}})['then'](function(){if(_0x46abdd[_0x55b6('0x8c')][_0x55b6('0xc2')]&&_0x460593){return db['CmHopper'][_0x55b6('0x17')]({'phone':_0x46abdd['body'][_0x55b6('0xc2')],'OrderBy':0x0},{'where':{'ContactId':_0x460593['id']}});}})[_0x55b6('0x18')](function(){return _0x460593;})[_0x55b6('0x18')](respondWithResult(_0x205b70,null))[_0x55b6('0x82')](handleError(_0x205b70,null));};exports[_0x55b6('0xc3')]=function(_0x1b9f72,_0xa2deee){var _0x4884c9={};var _0x4b49ce={};var _0x166695;var _0x43c778;return db[_0x55b6('0x75')]['findOne']({'where':{'id':_0x1b9f72['params']['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0xa2deee,null))[_0x55b6('0x18')](function(_0x40cbef){if(_0x40cbef){_0x166695=_0x40cbef;_0x4b49ce[_0x55b6('0x2a')]=_[_0x55b6('0x20')](db[_0x55b6('0x48')][_0x55b6('0xc4')]);_0x4b49ce[_0x55b6('0x2b')]=_['keys'](_0x1b9f72[_0x55b6('0x2b')]);_0x4b49ce[_0x55b6('0x2c')]=_[_0x55b6('0x2d')](_0x4b49ce[_0x55b6('0x2a')],_0x4b49ce[_0x55b6('0x2b')]);_0x4884c9[_0x55b6('0x2e')]=_[_0x55b6('0x2d')](_0x4b49ce['model'],qs[_0x55b6('0x2f')](_0x1b9f72[_0x55b6('0x2b')]['fields']));_0x4884c9[_0x55b6('0x2e')]=_0x4884c9[_0x55b6('0x2e')]['length']?_0x4884c9[_0x55b6('0x2e')]:_0x4b49ce[_0x55b6('0x2a')];_0x4884c9[_0x55b6('0x32')]=qs[_0x55b6('0x33')](_0x1b9f72[_0x55b6('0x2b')][_0x55b6('0x33')]);_0x4884c9[_0x55b6('0x34')]=qs[_0x55b6('0x2c')](_[_0x55b6('0x35')](_0x1b9f72['query'],_0x4b49ce['filters']));if(_0x1b9f72[_0x55b6('0x2b')][_0x55b6('0x5e')]){_0x4884c9[_0x55b6('0x34')]=_[_0x55b6('0x8b')](_0x4884c9[_0x55b6('0x34')],{'$or':_[_0x55b6('0x4b')](_0x4884c9['attributes'],function(_0x4a9cf1){var _0x2c5be={};_0x2c5be[_0x4a9cf1]={'$like':'%'+_0x1b9f72[_0x55b6('0x2b')][_0x55b6('0x5e')]+'%'};return _0x2c5be;})});}_0x4884c9=_[_0x55b6('0x8b')]({},_0x4884c9,_0x1b9f72[_0x55b6('0xc5')]);return _0x166695[_0x55b6('0xc3')](_0x4884c9);}})[_0x55b6('0x18')](function(_0x4a759a){if(_0x4a759a){_0x43c778=_0x4a759a[_0x55b6('0x21')];if(!_0x1b9f72[_0x55b6('0x2b')][_0x55b6('0x30')](_0x55b6('0x31'))){_0x4884c9[_0x55b6('0x13')]=qs[_0x55b6('0x13')](_0x1b9f72[_0x55b6('0x2b')]['limit']);_0x4884c9[_0x55b6('0x12')]=qs[_0x55b6('0x12')](_0x1b9f72['query'][_0x55b6('0x12')]);}return _0x166695[_0x55b6('0xc3')](_0x4884c9);}})[_0x55b6('0x18')](function(_0x5a2937){if(_0x5a2937){return _0x5a2937?{'count':_0x43c778,'rows':_0x5a2937}:null;}})[_0x55b6('0x18')](respondWithResult(_0xa2deee,null))[_0x55b6('0x82')](handleError(_0xa2deee,null));};exports[_0x55b6('0xc6')]=function(_0x33e644,_0x5a6f1e){if(_0x33e644['body']['id']){delete _0x33e644[_0x55b6('0x8c')]['id'];}return db[_0x55b6('0x75')][_0x55b6('0x25')]({'where':{'id':_0x33e644[_0x55b6('0xb3')]['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0x5a6f1e,null))[_0x55b6('0x18')](function(_0x35b618){if(_0x35b618){return _0x35b618[_0x55b6('0xc6')](_0x33e644[_0x55b6('0x8c')][_0x55b6('0xc7')]||[]);}return null;})['then'](respondWithResult(_0x5a6f1e,null))[_0x55b6('0x82')](handleError(_0x5a6f1e,null));};exports[_0x55b6('0xc8')]=function(_0x492f24,_0x58f870){var _0x4edadf=[];_0x4edadf[_0x55b6('0x23')](addAdditionalPhones(_0x492f24['body']));Promise[_0x55b6('0x27')](_0x4edadf)[_0x55b6('0x18')](function(){_0x4edadf=[];_0x4edadf['push'](deleteCmHopperPhones(_0x492f24[_0x55b6('0x8c')]['id']));_0x4edadf[_0x55b6('0x23')](addCmHopperPhones(_0x492f24['body']['id']));Promise[_0x55b6('0x27')](_0x4edadf)[_0x55b6('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x58f870,null));});};function addAdditionalPhones(_0x191969){var _0x464744;return new Promise(function(_0x187775,_0x368865){return db['CmContactHasItem'][_0x55b6('0x19')]({'where':{'CmContactId':_0x191969['id']}})['then'](function(){db[_0x55b6('0xb5')][_0x55b6('0x88')]({'raw':!![],'attributes':['id',_0x55b6('0xc9')]})[_0x55b6('0x18')](function(_0x24e6cd){var _0x50b62f=[];for(var _0x15bb83=0x0;_0x15bb83<_0x191969[_0x55b6('0xca')][_0x55b6('0x21')];_0x15bb83++){var _0x41153d=_0x191969['item_types']?_[_0x55b6('0x53')](_0x191969[_0x55b6('0xcb')][_0x15bb83])?'':_0x191969[_0x55b6('0xcb')][_0x15bb83]:_0x191969[_0x55b6('0xca')][_0x15bb83][_0x55b6('0xcc')]?_0x191969[_0x55b6('0xca')][_0x15bb83][_0x55b6('0xcc')]:'';var _0x1599e1=_[_0x55b6('0x53')](_0x191969[_0x55b6('0xca')][_0x15bb83]['description'])?'':_0x191969[_0x55b6('0xca')][_0x15bb83][_0x55b6('0xcd')];var _0x8eb879=_0x41153d+':'+_0x191969[_0x55b6('0xca')][_0x15bb83]['phone']+'§'+_0x1599e1;if(_[_0x55b6('0x53')](_0x464744))_0x464744=_0x8eb879;else _0x464744+=';'+_0x8eb879;var _0x342db4=null;if(_0x191969[_0x55b6('0xcb')]){if(!_['isNil'](_0x191969[_0x55b6('0xcb')][_0x15bb83])){var _0x561969=_[_0x55b6('0x47')](_0x24e6cd,function(_0x4265d0){return _0x4265d0['id']===_0x191969['item_types'][_0x15bb83];});if(!_[_0x55b6('0x53')](_0x561969)){_0x342db4=_0x561969[_0x55b6('0xc9')];}}}else{if(!_[_0x55b6('0x53')](_0x191969[_0x55b6('0xca')][_0x15bb83])){var _0x561969=_[_0x55b6('0x47')](_0x24e6cd,function(_0x5e455d){return _0x5e455d['id']===_0x191969['items'][_0x15bb83]['ItemTypeId'];});if(!_['isNil'](_0x561969)){_0x342db4=_0x15bb83;}}}if(_[_0x55b6('0x53')](_0x342db4)){_0x342db4=0x64;}_0x50b62f[_0x55b6('0x23')](addAdditionalPhone(_0x191969['id'],_0x191969[_0x55b6('0xca')][_0x15bb83][_0x55b6('0xc2')],_0x191969['item_types']?_[_0x55b6('0x53')](_0x191969[_0x55b6('0xcb')][_0x15bb83])?null:_0x191969['item_types'][_0x15bb83]:_0x191969[_0x55b6('0xca')][_0x15bb83][_0x55b6('0xcc')]?_0x191969[_0x55b6('0xca')][_0x15bb83]['ItemTypeId']:null,_0x342db4,_0x1599e1));}Promise[_0x55b6('0x27')](_0x50b62f)[_0x55b6('0x18')](function(){db[_0x55b6('0x75')][_0x55b6('0x17')]({'AdditionalPhones':_0x464744},{'where':{'id':_0x191969['id']}})[_0x55b6('0x18')](function(){_0x187775(0x1);});});});});});}function addAdditionalPhone(_0x290874,_0x4fde68,_0x3ddd23,_0x520509,_0x16819d){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x290874,'item':_0x4fde68}})[_0x55b6('0x18')](function(_0x2fe7c9){if(_0x2fe7c9)logger[_0x55b6('0x8f')](_0x55b6('0xce'),_0x2fe7c9);else{db[_0x55b6('0x9e')][_0x55b6('0x94')]({'CmContactId':_0x290874,'item':_0x4fde68,'ItemTypeId':_0x3ddd23,'OrderBy':_0x520509,'ItemClass':_0x55b6('0xcf'),'description':_0x16819d});}});}function deletePhones(_0x37c212){return db['CmContactHasItem'][_0x55b6('0x19')]({'where':{'CmContactId':_0x37c212}});}function deleteCmHopperPhones(_0x48a49e){return new Promise(function(_0x401988,_0x230ae1){return db[_0x55b6('0x91')][_0x55b6('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48a49e}})[_0x55b6('0x18')](function(_0x4ead20){db[_0x55b6('0xd0')][_0x55b6('0x19')]({'where':{'CmHopperId':{'$in':_[_0x55b6('0x4b')](_0x4ead20,'id')}}});})[_0x55b6('0x18')](function(){_0x401988(0x1);});});}function addCmHopperPhones(_0x488973){return new Promise(function(_0x2acdfd,_0x22b5ef){return db[_0x55b6('0x91')][_0x55b6('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x488973}})[_0x55b6('0x18')](function(_0x18e64d){var _0xe73cea=[];_['map'](_0x18e64d,function(_0x58d729){_0xe73cea[_0x55b6('0x23')](createCmHopperPhone(_0x488973,_0x58d729['id']));});Promise[_0x55b6('0x27')](_0xe73cea)[_0x55b6('0x18')](function(){_0x2acdfd(0x1);});});});}function createCmHopperPhone(_0x4bc6b3,_0x174117){return new Promise(function(_0x153b46,_0x241936){db[_0x55b6('0x9e')]['findAll']({'raw':!![],'attributes':['item',_0x55b6('0xc9')],'where':{'CmContactId':_0x4bc6b3,'ItemClass':'PHONE'},'include':[{'model':db[_0x55b6('0xb5')],'attributes':[_0x55b6('0xc9')],'as':_0x55b6('0xb6')}],'order':[_0x55b6('0xc9'),db[_0x55b6('0x73')][_0x55b6('0xb7')]('`ItemType`.OrderBy')]})[_0x55b6('0x18')](function(_0xaced54){var _0x33977e=0x1;var _0x58d20a=_['map'](_0xaced54,function(_0x1f2b28){_0x1f2b28[_0x55b6('0xd1')]=_0x174117;_0x1f2b28[_0x55b6('0xc2')]=_0x1f2b28['item'];_0x1f2b28[_0x55b6('0xc9')]=_0x33977e;delete _0x1f2b28[_0x55b6('0xd2')];_0x33977e=_0x33977e+0x1;return _0x1f2b28;});return db[_0x55b6('0xd0')][_0x55b6('0xab')](_0x58d20a,{});})[_0x55b6('0x18')](function(){_0x153b46(0x1);});});}function insertAdditionalPhones(_0x9f1053,_0x41410a){return new Promise(function(_0x24bef3,_0x559b65){var _0x18bf46=[];for(var _0x1ebfb5=0x0;_0x1ebfb5<_0x41410a[_0x55b6('0x21')];_0x1ebfb5++){var _0x5db55b=_0x41410a[_0x1ebfb5];_0x18bf46[_0x55b6('0x23')](parseContactItemType(_0x5db55b));}Promise[_0x55b6('0x27')](_0x18bf46)['then'](function(){var _0x35350a={'id':_0x9f1053['id'],'items':_0x41410a};return addAdditionalPhones(_0x35350a)[_0x55b6('0x18')](function(_0x38c367){return addCmHopperPhones(_0x9f1053['id']);});})[_0x55b6('0x18')](function(){_0x24bef3(_0x9f1053);});});}function parseContactItemType(_0x3cf328){return new Promise(function(_0x40fff5,_0x2056ac){if(_0x3cf328['hasOwnProperty'](_0x55b6('0xcc'))){_0x40fff5(_0x3cf328);}else{return db['ContactItemType'][_0x55b6('0x47')]({'where':{'name':_0x3cf328[_0x55b6('0xb6')]}})[_0x55b6('0x18')](function(_0x831a0e){if(_['isNil'](_0x831a0e))_0x3cf328[_0x55b6('0xcc')]=null;else _0x3cf328[_0x55b6('0xcc')]=_0x831a0e['id'];_0x40fff5(_0x3cf328);});}});}exports[_0x55b6('0xd3')]=function(_0x2fbe97,_0x56f251){return db['CmContactHasItem'][_0x55b6('0x88')]({'raw':!![],'where':{'CmContactId':_0x2fbe97[_0x55b6('0xb3')]['id'],'ItemClass':_0x55b6('0xcf')},'include':[{'model':db[_0x55b6('0xb5')],'as':_0x55b6('0xb6')}],'order':[[_0x55b6('0xc9')],[db[_0x55b6('0x73')][_0x55b6('0xb7')](_0x55b6('0xd4'))]]})[_0x55b6('0x18')](function(_0x257348){return _0x257348;})['then'](respondWithResult(_0x56f251,null))['catch'](handleError(_0x56f251,null));};exports[_0x55b6('0xd5')]=function(_0x21b2a,_0x3c6a3c){return db[_0x55b6('0x9e')][_0x55b6('0x88')]({'raw':!![],'where':{'CmContactId':_0x21b2a[_0x55b6('0x8c')][_0x55b6('0xd6')]}})[_0x55b6('0x18')](function(_0xb69d7e){var _0x12c76e=_['map'](_0xb69d7e,function(_0x28a4a6){_0x28a4a6[_0x55b6('0xd7')]=_0x21b2a[_0x55b6('0x8c')][_0x55b6('0xd8')];return _0x28a4a6;});return db[_0x55b6('0x9e')][_0x55b6('0xab')](_0x12c76e,{});})['then'](function(_0x4f90b0){return addCmHopperPhones(_0x21b2a['body'][_0x55b6('0xd8')]);})[_0x55b6('0x18')](function(_0x267f47){return['ok'];})[_0x55b6('0x18')](respondWithResult(_0x3c6a3c,null))['catch'](handleError(_0x3c6a3c,null));};exports[_0x55b6('0xd9')]=function(_0x3e4cb8,_0x24d6ec){var _0x4874fb=[];_0x4874fb[_0x55b6('0x23')](createCmHopperPhone(_0x3e4cb8['body']['id'],_0x3e4cb8[_0x55b6('0x8c')][_0x55b6('0xda')]));Promise[_0x55b6('0x27')](_0x4874fb)[_0x55b6('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x24d6ec,null));};exports['getHoppers']=function(_0x3a2424,_0x22401f){var _0x130c2b={'raw':![],'where':{}};var _0xe184ce={};var _0x422cff={'count':0x0,'rows':[]};return db[_0x55b6('0x75')][_0x55b6('0x25')]({'where':{'id':_0x3a2424['params']['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0x22401f,null))[_0x55b6('0x18')](function(_0x26b9d3){if(_0x26b9d3){_0xe184ce[_0x55b6('0x2a')]=_['keys'](db[_0x55b6('0x91')][_0x55b6('0xc4')]);_0xe184ce[_0x55b6('0x2b')]=_[_0x55b6('0x20')](_0x3a2424['query']);_0xe184ce['filters']=_[_0x55b6('0x2d')](_0xe184ce[_0x55b6('0x2a')],_0xe184ce[_0x55b6('0x2b')]);_0x130c2b['attributes']=_[_0x55b6('0x2d')](_0xe184ce[_0x55b6('0x2a')],qs['fields'](_0x3a2424['query']['fields']));_0x130c2b[_0x55b6('0x2e')]=_0x130c2b[_0x55b6('0x2e')]['length']?_0x130c2b[_0x55b6('0x2e')]:_0xe184ce['model'];if(!_0x3a2424[_0x55b6('0x2b')]['hasOwnProperty'](_0x55b6('0x31'))){_0x130c2b[_0x55b6('0x13')]=qs[_0x55b6('0x13')](_0x3a2424['query'][_0x55b6('0x13')]);_0x130c2b[_0x55b6('0x12')]=qs[_0x55b6('0x12')](_0x3a2424[_0x55b6('0x2b')][_0x55b6('0x12')]);}_0x130c2b[_0x55b6('0x32')]=qs[_0x55b6('0x33')](_0x3a2424[_0x55b6('0x2b')][_0x55b6('0x33')]);_0x130c2b[_0x55b6('0x34')]=qs['filters'](_[_0x55b6('0x35')](_0x3a2424['query'],_0xe184ce[_0x55b6('0x2c')]));_0x130c2b[_0x55b6('0x34')][_0x55b6('0xdb')]=_0x26b9d3['id'];if(_0x3a2424[_0x55b6('0x2b')][_0x55b6('0x5e')]){_0x130c2b['where']=_[_0x55b6('0x8b')](_0x130c2b['where'],{'$or':_[_0x55b6('0x4b')](_0x130c2b[_0x55b6('0x2e')],function(_0xb13d08){var _0x59f7bc={};_0x59f7bc[_0xb13d08]={'$like':'%'+_0x3a2424[_0x55b6('0x2b')]['filter']+'%'};return _0x59f7bc;})});}_0x130c2b=_['merge']({},_0x130c2b,_0x3a2424[_0x55b6('0xc5')]);return db['CmHopper'][_0x55b6('0x15')]({'where':_0x130c2b[_0x55b6('0x34')]})[_0x55b6('0x18')](function(_0x369ea7){_0x422cff[_0x55b6('0x15')]=_0x369ea7;if(_0x3a2424[_0x55b6('0x2b')][_0x55b6('0xdc')]){_0x130c2b[_0x55b6('0xdd')]=[{'all':!![]}];}return db[_0x55b6('0x91')][_0x55b6('0x88')](_0x130c2b);})[_0x55b6('0x18')](function(_0x2ad7c7){_0x422cff[_0x55b6('0x81')]=_0x2ad7c7;return _0x422cff;});}})[_0x55b6('0x18')](respondWithFilteredResult(_0x22401f,_0x130c2b))[_0x55b6('0x82')](handleError(_0x22401f,null));};exports[_0x55b6('0xde')]=function(_0x40f978,_0x4fbac1){var _0x247279={'raw':!![],'where':{}};var _0x395f95={};var _0x188b85={'count':0x0,'rows':[]};return db[_0x55b6('0x75')][_0x55b6('0x25')]({'where':{'id':_0x40f978[_0x55b6('0xb3')]['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0x4fbac1,null))[_0x55b6('0x18')](function(_0x359439){if(_0x359439){_0x395f95['model']=_[_0x55b6('0x20')](db['CmHopperHistory']['rawAttributes']);_0x395f95['query']=_[_0x55b6('0x20')](_0x40f978[_0x55b6('0x2b')]);_0x395f95[_0x55b6('0x2c')]=_[_0x55b6('0x2d')](_0x395f95[_0x55b6('0x2a')],_0x395f95['query']);_0x247279[_0x55b6('0x2e')]=_[_0x55b6('0x2d')](_0x395f95[_0x55b6('0x2a')],qs['fields'](_0x40f978[_0x55b6('0x2b')][_0x55b6('0x2f')]));_0x247279['attributes']=_0x247279[_0x55b6('0x2e')][_0x55b6('0x21')]?_0x247279['attributes']:_0x395f95[_0x55b6('0x2a')];if(!_0x40f978[_0x55b6('0x2b')][_0x55b6('0x30')](_0x55b6('0x31'))){_0x247279['limit']=qs[_0x55b6('0x13')](_0x40f978[_0x55b6('0x2b')]['limit']);_0x247279[_0x55b6('0x12')]=qs[_0x55b6('0x12')](_0x40f978[_0x55b6('0x2b')]['offset']);}_0x247279['order']=qs[_0x55b6('0x33')](_0x40f978[_0x55b6('0x2b')][_0x55b6('0x33')]);_0x247279[_0x55b6('0x34')]=qs['filters'](_['pick'](_0x40f978['query'],_0x395f95['filters']));_0x247279[_0x55b6('0x34')]['ContactId']=_0x359439['id'];if(_0x40f978['query'][_0x55b6('0x5e')]){_0x247279['where']=_[_0x55b6('0x8b')](_0x247279[_0x55b6('0x34')],{'$or':_[_0x55b6('0x4b')](_0x247279[_0x55b6('0x2e')],function(_0x4f2416){var _0x42f31a={};_0x42f31a[_0x4f2416]={'$like':'%'+_0x40f978['query'][_0x55b6('0x5e')]+'%'};return _0x42f31a;})});}_0x247279=_[_0x55b6('0x8b')]({},_0x247279,_0x40f978['options']);return db[_0x55b6('0x9f')]['count']({'where':_0x247279[_0x55b6('0x34')]})[_0x55b6('0x18')](function(_0x4af239){_0x188b85[_0x55b6('0x15')]=_0x4af239;if(_0x40f978[_0x55b6('0x2b')][_0x55b6('0xdc')]){_0x247279[_0x55b6('0xdd')]=[{'all':!![]}];}return db[_0x55b6('0x9f')][_0x55b6('0x88')](_0x247279);})[_0x55b6('0x18')](function(_0x4c7ec6){_0x188b85[_0x55b6('0x81')]=_0x4c7ec6;return _0x188b85;});}})[_0x55b6('0x18')](respondWithFilteredResult(_0x4fbac1,_0x247279))[_0x55b6('0x82')](handleError(_0x4fbac1,null));};exports['getHopperFinals']=function(_0x240ce4,_0x497014){var _0x3115f2={'raw':!![],'where':{}};var _0x3c7ea0={};var _0x526166={'count':0x0,'rows':[]};return db['CmContact'][_0x55b6('0x25')]({'where':{'id':_0x240ce4[_0x55b6('0xb3')]['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0x497014,null))[_0x55b6('0x18')](function(_0x5b34ec){if(_0x5b34ec){_0x3c7ea0[_0x55b6('0x2a')]=_[_0x55b6('0x20')](db[_0x55b6('0xdf')][_0x55b6('0xc4')]);_0x3c7ea0[_0x55b6('0x2b')]=_[_0x55b6('0x20')](_0x240ce4['query']);_0x3c7ea0[_0x55b6('0x2c')]=_[_0x55b6('0x2d')](_0x3c7ea0[_0x55b6('0x2a')],_0x3c7ea0[_0x55b6('0x2b')]);_0x3115f2[_0x55b6('0x2e')]=_[_0x55b6('0x2d')](_0x3c7ea0[_0x55b6('0x2a')],qs['fields'](_0x240ce4[_0x55b6('0x2b')][_0x55b6('0x2f')]));_0x3115f2[_0x55b6('0x2e')]=_0x3115f2[_0x55b6('0x2e')][_0x55b6('0x21')]?_0x3115f2['attributes']:_0x3c7ea0[_0x55b6('0x2a')];if(!_0x240ce4['query']['hasOwnProperty']('nolimit')){_0x3115f2['limit']=qs[_0x55b6('0x13')](_0x240ce4[_0x55b6('0x2b')][_0x55b6('0x13')]);_0x3115f2[_0x55b6('0x12')]=qs['offset'](_0x240ce4[_0x55b6('0x2b')][_0x55b6('0x12')]);}_0x3115f2[_0x55b6('0x32')]=qs[_0x55b6('0x33')](_0x240ce4['query'][_0x55b6('0x33')]);_0x3115f2[_0x55b6('0x34')]=qs[_0x55b6('0x2c')](_['pick'](_0x240ce4[_0x55b6('0x2b')],_0x3c7ea0[_0x55b6('0x2c')]));_0x3115f2[_0x55b6('0x34')]['ContactId']=_0x5b34ec['id'];if(_0x240ce4[_0x55b6('0x2b')][_0x55b6('0x5e')]){_0x3115f2[_0x55b6('0x34')]=_['merge'](_0x3115f2[_0x55b6('0x34')],{'$or':_[_0x55b6('0x4b')](_0x3115f2[_0x55b6('0x2e')],function(_0x51d2ce){var _0x519344={};_0x519344[_0x51d2ce]={'$like':'%'+_0x240ce4[_0x55b6('0x2b')][_0x55b6('0x5e')]+'%'};return _0x519344;})});}_0x3115f2=_[_0x55b6('0x8b')]({},_0x3115f2,_0x240ce4['options']);return db[_0x55b6('0xdf')]['count']({'where':_0x3115f2[_0x55b6('0x34')]})[_0x55b6('0x18')](function(_0x52888f){_0x526166[_0x55b6('0x15')]=_0x52888f;if(_0x240ce4[_0x55b6('0x2b')][_0x55b6('0xdc')]){_0x3115f2[_0x55b6('0xdd')]=[{'all':!![]}];}return db[_0x55b6('0xdf')][_0x55b6('0x88')](_0x3115f2);})[_0x55b6('0x18')](function(_0x4e7695){_0x526166[_0x55b6('0x81')]=_0x4e7695;return _0x526166;});}})[_0x55b6('0x18')](respondWithFilteredResult(_0x497014,_0x3115f2))[_0x55b6('0x82')](handleError(_0x497014,null));};exports['getJscriptySessions']=function(_0x392163,_0x466735){var _0x34b50c={'raw':!![],'where':{}};var _0x46990c={};var _0x2fdebc={'count':0x0,'rows':[]};return db[_0x55b6('0x75')][_0x55b6('0x25')]({'where':{'id':_0x392163['params']['id']}})[_0x55b6('0x18')](handleEntityNotFound(_0x466735,null))[_0x55b6('0x18')](function(_0x4189a7){if(_0x4189a7){_0x46990c[_0x55b6('0x2a')]=_['keys'](db['JscriptySessionReport'][_0x55b6('0xc4')]);_0x46990c[_0x55b6('0x2b')]=_[_0x55b6('0x20')](_0x392163[_0x55b6('0x2b')]);_0x46990c[_0x55b6('0x2c')]=_[_0x55b6('0x2d')](_0x46990c['model'],_0x46990c[_0x55b6('0x2b')]);_0x34b50c[_0x55b6('0x2e')]=_['intersection'](_0x46990c[_0x55b6('0x2a')],qs[_0x55b6('0x2f')](_0x392163[_0x55b6('0x2b')]['fields']));_0x34b50c[_0x55b6('0x2e')]=_0x34b50c[_0x55b6('0x2e')][_0x55b6('0x21')]?_0x34b50c[_0x55b6('0x2e')]:_0x46990c[_0x55b6('0x2a')];if(!_0x392163[_0x55b6('0x2b')][_0x55b6('0x30')](_0x55b6('0x31'))){_0x34b50c[_0x55b6('0x13')]=qs[_0x55b6('0x13')](_0x392163['query']['limit']);_0x34b50c['offset']=qs[_0x55b6('0x12')](_0x392163[_0x55b6('0x2b')][_0x55b6('0x12')]);}_0x34b50c['order']=qs[_0x55b6('0x33')](_0x392163[_0x55b6('0x2b')][_0x55b6('0x33')]);_0x34b50c[_0x55b6('0x34')]=qs[_0x55b6('0x2c')](_['pick'](_0x392163[_0x55b6('0x2b')],_0x46990c[_0x55b6('0x2c')]));_0x34b50c[_0x55b6('0x34')][_0x55b6('0xdb')]=_0x4189a7['id'];if(_0x392163[_0x55b6('0x2b')][_0x55b6('0x5e')]){_0x34b50c[_0x55b6('0x34')]=_[_0x55b6('0x8b')](_0x34b50c[_0x55b6('0x34')],{'$or':_[_0x55b6('0x4b')](_0x34b50c['attributes'],function(_0x4aac5b){var _0x4dcd4f={};_0x4dcd4f[_0x4aac5b]={'$like':'%'+_0x392163[_0x55b6('0x2b')][_0x55b6('0x5e')]+'%'};return _0x4dcd4f;})});}_0x34b50c=_[_0x55b6('0x8b')]({},_0x34b50c,_0x392163[_0x55b6('0xc5')]);return db[_0x55b6('0xa3')][_0x55b6('0x15')]({'where':_0x34b50c[_0x55b6('0x34')]})[_0x55b6('0x18')](function(_0x57900b){_0x2fdebc[_0x55b6('0x15')]=_0x57900b;if(_0x392163[_0x55b6('0x2b')][_0x55b6('0xdc')]){_0x34b50c[_0x55b6('0xdd')]=[{'all':!![]}];}return db[_0x55b6('0xa3')][_0x55b6('0x88')](_0x34b50c);})[_0x55b6('0x18')](function(_0x42268f){_0x2fdebc[_0x55b6('0x81')]=_0x42268f;return _0x2fdebc;});}})[_0x55b6('0x18')](respondWithFilteredResult(_0x466735,_0x34b50c))[_0x55b6('0x82')](handleError(_0x466735,null));};exports['uploadCsv']=function(_0x231463,_0x2bbf8a){try{if(!_0x231463[_0x55b6('0x8c')][_0x55b6('0x56')]){throw new Error(_0x55b6('0xe0'));}if(!_0x231463[_0x55b6('0x8c')]['binding_keys']){throw new Error(_0x55b6('0xe1'));}if(!_0x231463[_0x55b6('0x8c')][_0x55b6('0xe2')]){throw new Error(_0x55b6('0xe3'));}if(!_0x231463[_0x55b6('0x8c')][_0x55b6('0xe4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2ad9ac=_0x231463['body'][_0x55b6('0xe5')][_0x55b6('0x4a')](',');var _0x530c41=_0x231463[_0x55b6('0x8c')]['binding_values'][_0x55b6('0x4a')](',');if(!_0x2ad9ac[_0x55b6('0x21')]||!_0x530c41[_0x55b6('0x21')]||_0x2ad9ac['length']!==_0x530c41[_0x55b6('0x21')]){throw new Error(_0x55b6('0xe6'));}_0x231463[_0x55b6('0x8c')][_0x55b6('0x2f')]=_[_0x55b6('0xe7')](_0x2ad9ac,_0x530c41);if(!_0x231463[_0x55b6('0x8c')][_0x55b6('0x2f')][_0x55b6('0xc2')]){throw new Error(_0x55b6('0xe8'));}if(!_0x231463[_0x55b6('0x8c')][_0x55b6('0x2f')][_0x55b6('0xe9')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x33ad38=path[_0x55b6('0x8e')](config[_0x55b6('0xea')],'server/files/tmp',_0x231463[_0x55b6('0xeb')][_0x55b6('0xec')]);fs['chmodSync'](_0x33ad38,parseInt(_0x55b6('0xed'),0x8));var _0x211fe5=require(_0x55b6('0xee'))[_0x55b6('0xef')](path[_0x55b6('0x8e')](__dirname,_0x55b6('0xf0')),[_0x33ad38,_0x231463['body'][_0x55b6('0xe5')],_0x231463[_0x55b6('0x8c')]['binding_values'],_0x231463[_0x55b6('0x8c')][_0x55b6('0x56')],_0x231463['body'][_0x55b6('0xf1')],_0x231463['body'][_0x55b6('0xad')],_0x231463[_0x55b6('0x8c')][_0x55b6('0xe4')]]);return _0x2bbf8a['status'](0xc8)[_0x55b6('0x11')]({'message':_0x55b6('0xf2'),'pid':_0x211fe5[_0x55b6('0xf3')]});}catch(_0x4bd3c5){return _0x2bbf8a['status'](0x1f4)[_0x55b6('0x1d')](_0x4bd3c5);}};exports[_0x55b6('0xf4')]=function(_0x4bb582,_0x428141){var _0x3514b5=fs['createReadStream'](_0x4bb582[_0x55b6('0xeb')][_0x55b6('0x2')]);Papa[_0x55b6('0xf5')](_0x3514b5,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x245157){return _0x428141[_0x55b6('0x10')](0xc8)[_0x55b6('0x11')]({'file':_0x4bb582[_0x55b6('0xeb')],'fields':_0x245157[_0x55b6('0xf6')][_0x55b6('0x2f')]});}});};exports['import']=function(_0x2cb2f1,_0x12998d){return db[_0x55b6('0x4d')][_0x55b6('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x55b6('0x18')](function(_0x52cac7){var _0xd6be4b=![];if(!_0x2cb2f1[_0x55b6('0x8c')][_0x55b6('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2cb2f1[_0x55b6('0x8c')][_0x55b6('0xf7')][_0x55b6('0xc2')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2cb2f1['body'][_0x55b6('0xf7')][_0x55b6('0xe9')]){throw new Error(_0x55b6('0xf8'));}if(!_0x2cb2f1['body'][_0x55b6('0xe4')]){throw new Error(_0x55b6('0xf9'));}var _0xfb5e8a=require('child_process')[_0x55b6('0xef')](path['join'](__dirname,_0x55b6('0xfa')),[_0x2cb2f1[_0x55b6('0xb3')]['id'],JSON[_0x55b6('0xfb')](_0x2cb2f1[_0x55b6('0x8c')]),JSON['stringify'](_0x52cac7)]);_0xfb5e8a['on'](_0x55b6('0xfc'),function(){_0xd6be4b=!![];return _0x12998d[_0x55b6('0x10')](0xc8)[_0x55b6('0x11')]({'message':_0x55b6('0xfd'),'pid':_0xfb5e8a[_0x55b6('0xf3')]});});_0xfb5e8a['on'](_0x55b6('0xfe'),function(_0x1dc515){if(_0x1dc515&&!_0xd6be4b){return _0x12998d[_0x55b6('0x10')](0x1f4)[_0x55b6('0x11')]({'message':_0x55b6('0xff'),'pid':_0xfb5e8a[_0x55b6('0xf3')]});}});})[_0x55b6('0x82')](handleError(_0x12998d,null));};exports[_0x55b6('0x100')]=function(_0x70c1d1,_0x413490,_0x385274){return db[_0x55b6('0x4d')][_0x55b6('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':_0x55b6('0x71')}})[_0x55b6('0x18')](function(_0x45dd62){var _0x262835=![];if(!_0x70c1d1['body'][_0x55b6('0x56')]){throw new Error(_0x55b6('0xe0'));}if(!_0x70c1d1[_0x55b6('0x8c')]['binding']['phone']){throw new Error(_0x55b6('0xe8'));}if(!_0x70c1d1[_0x55b6('0x8c')]['binding'][_0x55b6('0xe9')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x70c1d1[_0x55b6('0x8c')]['socket_timestamp']){throw new Error(_0x55b6('0xf9'));}var _0x34e8b6=require('child_process')[_0x55b6('0xef')](path['join'](__dirname,_0x55b6('0x101')),[_0x70c1d1['params']['id'],JSON['stringify'](_0x70c1d1[_0x55b6('0x8c')]),JSON[_0x55b6('0xfb')](_0x45dd62)]);_0x34e8b6['on'](_0x55b6('0xfc'),function(_0x5eefa8){_0x262835=!![];return _0x413490[_0x55b6('0x10')](0xc8)[_0x55b6('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x34e8b6['pid']});});_0x34e8b6['on']('exit',function(_0x3a6ccd){if(_0x3a6ccd&&!_0x262835){return _0x413490[_0x55b6('0x10')](0x1f4)[_0x55b6('0x11')]({'message':_0x55b6('0xff'),'pid':_0x34e8b6['pid']});}});})['catch'](handleError(_0x413490,null));};exports['getJourney']=function(_0x4842a3,_0x387beb){var _0x553433=[_0x55b6('0x102'),_0x55b6('0x103'),_0x55b6('0x104'),_0x55b6('0x105'),_0x55b6('0x106'),_0x55b6('0x107'),'voice'];var _0x4ec66={'offset':0x0,'order':qs[_0x55b6('0x33')](_0x55b6('0x108'))},_0x2b2ed5={'count':0x0,'rows':[]};Promise[_0x55b6('0x6d')]()[_0x55b6('0x18')](function(){if(_0x4842a3[_0x55b6('0x2b')][_0x55b6('0x109')]){if(!_['includes'](_0x553433,_0x4842a3[_0x55b6('0x2b')][_0x55b6('0x109')][_0x55b6('0x10a')]())){throw new Error(_0x55b6('0x10b'));}_0x553433=[_0x4842a3[_0x55b6('0x2b')][_0x55b6('0x109')][_0x55b6('0x10a')]()];}if(_0x4842a3[_0x55b6('0x2b')]['range']){try{var _0x357b60=JSON['parse'](_0x4842a3[_0x55b6('0x2b')][_0x55b6('0x10c')]);if(!moment(_0x357b60[_0x55b6('0x39')])[_0x55b6('0x10d')]()){throw new Error(_0x55b6('0x10e'));}if(!moment(_0x357b60['to'])[_0x55b6('0x10d')]()){throw new Error(_0x55b6('0x10f'));}}catch(_0x1f1c93){throw new Error(_0x55b6('0x110'));}}if(!_0x4842a3[_0x55b6('0x2b')][_0x55b6('0x30')](_0x55b6('0x31'))){_0x4ec66[_0x55b6('0x13')]=qs[_0x55b6('0x13')](_0x4842a3[_0x55b6('0x2b')]['limit']||0xa);_0x4ec66[_0x55b6('0x12')]=qs['offset'](_0x4842a3[_0x55b6('0x2b')][_0x55b6('0x12')]);}var _0x124255=_0x553433[_0x55b6('0x4b')](function(_0x497ea2){if(_0x497ea2===_0x55b6('0x111')){var _0x4cb304={'attributes':['id','uniqueid',_0x55b6('0x29'),'source','destination',_0x55b6('0x112'),_0x55b6('0x113'),'endtime',_0x55b6('0x114'),_0x55b6('0x115'),_0x55b6('0x116'),_0x55b6('0x117'),'userSecondDisposition',_0x55b6('0x118'),_0x55b6('0x119')],'where':{'ContactId':_0x4842a3[_0x55b6('0xb3')]['id']},'include':[{'model':db[_0x55b6('0x4d')],'as':_0x55b6('0x4d'),'attributes':['id',_0x55b6('0x1c'),_0x55b6('0x11a'),_0x55b6('0x89')]}],'order':[[_0x55b6('0x116'),_0x55b6('0x6b')]]};if(_0x4842a3[_0x55b6('0x2b')][_0x55b6('0x10c')]){_0x4cb304['where'][_0x55b6('0x116')]={'$gte':_0x357b60[_0x55b6('0x39')],'$lte':_0x357b60['to']};}return db[_0x55b6('0x11b')][_0x55b6('0x11c')](_0x4cb304)['then'](function(_0xe733c7){_0x2b2ed5['count']+=_0xe733c7[_0x55b6('0x15')];return _[_0x55b6('0x4b')](_0xe733c7[_0x55b6('0x81')],function(_0x1ada31){var _0x3b67b0=_0x1ada31['get']({'plain':!![]});_0x3b67b0[_0x55b6('0x109')]=_0x497ea2;if(_0x3b67b0['User']){_0x3b67b0[_0x55b6('0x4d')]={'id':_0x3b67b0[_0x55b6('0x4d')]['id'],'name':_0x3b67b0[_0x55b6('0x4d')][_0x55b6('0x1c')],'fullname':_0x3b67b0[_0x55b6('0x4d')]['fullname'],'alias':_0x3b67b0[_0x55b6('0x4d')][_0x55b6('0x89')]};}return _0x3b67b0;});});}else{var _0x30e6b0=_[_0x55b6('0x11d')](_0x497ea2)+(_0x497ea2==='chat'?_0x55b6('0x11e'):'Account');var _0x259185={'attributes':['id','closed',_0x55b6('0x11f'),'createdAt',_0x55b6('0x115'),'disposition','secondDisposition',_0x55b6('0x120'),_0x55b6('0x119'),_0x30e6b0+'Id'],'where':{'ContactId':_0x4842a3[_0x55b6('0xb3')]['id']},'include':[{'model':db[_0x30e6b0],'as':_0x55b6('0x121'),'attributes':['id',_0x55b6('0x1c'),_0x55b6('0x122')]},{'model':db[_0x55b6('0x4d')],'as':'Owner','attributes':['id',_0x55b6('0x1c'),'fullname']},{'model':db[_0x55b6('0x48')],'as':'Tags','attributes':['id',_0x55b6('0x1c'),'color'],'through':{'attributes':[]}}],'order':[[_0x55b6('0x116'),'DESC']]};if(_0x4842a3['query'][_0x55b6('0x10c')]){_0x259185[_0x55b6('0x34')][_0x55b6('0x116')]={'$gte':_0x357b60[_0x55b6('0x39')],'$lte':_0x357b60['to']};}switch(_0x497ea2){case _0x55b6('0x103'):_0x259185[_0x55b6('0x2e')][_0x55b6('0x23')](_0x55b6('0x123'),'customerIp',_0x55b6('0x124'),_0x55b6('0x125'),_0x55b6('0x126'),_0x55b6('0x127'),'ratingType',_0x55b6('0x128'),_0x55b6('0x129'));break;case _0x55b6('0x102'):_0x259185[_0x55b6('0x2e')][_0x55b6('0x23')](_0x55b6('0x12a'),_0x55b6('0x12b'));break;case _0x55b6('0x105'):_0x259185[_0x55b6('0x2e')][_0x55b6('0x23')](_0x55b6('0x12c'),_0x55b6('0x12d'));break;}return db[_[_0x55b6('0x11d')](_0x497ea2)+_0x55b6('0x12e')][_0x55b6('0x11c')](_0x259185)['then'](function(_0x2ef483){_0x2b2ed5['count']+=_0x2ef483[_0x55b6('0x15')];return _['map'](_0x2ef483['rows'],function(_0x56b550){var _0x3af398=_0x56b550[_0x55b6('0x8d')]({'plain':!![]});_0x3af398[_0x55b6('0x109')]=_0x497ea2;if(_0x3af398[_0x55b6('0x12f')]){_0x3af398[_0x55b6('0x12f')]={'id':_0x3af398[_0x55b6('0x12f')]['id'],'name':_0x3af398[_0x55b6('0x12f')][_0x55b6('0x1c')],'fullname':_0x3af398['Owner'][_0x55b6('0x11a')]};}return _0x3af398;});});}});return Promise[_0x55b6('0x27')](_0x124255);})[_0x55b6('0x18')](function(_0x3542ee){return _(_0x3542ee)[_0x55b6('0x130')]()[_0x55b6('0x131')](_0x55b6('0x116'))['reverse']()['value']();})[_0x55b6('0x18')](function(_0x8585eb){_0x2b2ed5[_0x55b6('0x81')]=_0x4ec66[_0x55b6('0x13')]?_0x8585eb[_0x55b6('0x132')](_0x4ec66[_0x55b6('0x12')],_0x4ec66[_0x55b6('0x12')]+_0x4ec66[_0x55b6('0x13')]):_0x8585eb;return _0x2b2ed5;})[_0x55b6('0x18')](respondWithFilteredResult(_0x387beb,_0x4ec66))[_0x55b6('0x82')](handleError(_0x387beb,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index d6b4f48..9f24b36 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 _0x5658=['CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x30b51f,_0x5c70a3){var _0x40e393=function(_0x35c78e){while(--_0x35c78e){_0x30b51f['push'](_0x30b51f['shift']());}};_0x40e393(++_0x5c70a3);}(_0x5658,0x17f));var _0x8565=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5658[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x8565('0x0'));var CmContact=require(_0x8565('0x1'))['db'][_0x8565('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8565('0x3')](0x0);var events={'afterCreate':_0x8565('0x4'),'afterUpdate':_0x8565('0x5'),'afterDestroy':_0x8565('0x6')};function emitEvent(_0x630faf){return function(_0x3a2b25,_0xcdcf7d,_0x537936){CmContactEvents[_0x8565('0x7')](_0x630faf+':'+_0x3a2b25['id'],_0x3a2b25);CmContactEvents[_0x8565('0x7')](_0x630faf,_0x3a2b25);_0x537936(null);};}for(var e in events){if(events[_0x8565('0x8')](e)){var event=events[e];CmContact[_0x8565('0x9')](e,emitEvent(event));}}module[_0x8565('0xa')]=CmContactEvents; \ No newline at end of file +var _0x31d5=['exports','events','../../mysqldb','CmContact','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x50cdea,_0x5c7af1){var _0x14d183=function(_0x4a9657){while(--_0x4a9657){_0x50cdea['push'](_0x50cdea['shift']());}};_0x14d183(++_0x5c7af1);}(_0x31d5,0x1a8));var _0x531d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x31d5[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x531d('0x0'));var CmContact=require(_0x531d('0x1'))['db'][_0x531d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x531d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x531d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x230fb5){return function(_0x5cd765,_0x33233b,_0x4bbae0){CmContactEvents[_0x531d('0x5')](_0x230fb5+':'+_0x5cd765['id'],_0x5cd765);CmContactEvents[_0x531d('0x5')](_0x230fb5,_0x5cd765);_0x4bbae0(null);};}for(var e in events){if(events[_0x531d('0x6')](e)){var event=events[e];CmContact[_0x531d('0x7')](e,emitEvent(event));}}module[_0x531d('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index efd3312..f57a67c 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 _0xa76e=['fti_cm_contacts','firstName','lastName','mobile','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','isNil','timezones','utcOffset','add','format','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','catch','inspect','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','always','onlyIfOpen','message','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','phone'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa76e,0x11a));var _0xea76=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xa76e[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xea76('0x0'));var util=require(_0xea76('0x1'));var logger=require(_0xea76('0x2'))(_0xea76('0x3'));var moment=require('moment');var BPromise=require(_0xea76('0x4'));var rp=require(_0xea76('0x5'));var fs=require('fs');var path=require(_0xea76('0x6'));var rimraf=require(_0xea76('0x7'));var config=require(_0xea76('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xea76('0x9'));module[_0xea76('0xa')]=function(_0x194f9a,_0x92a44){return _0x194f9a[_0xea76('0xb')](_0xea76('0xc'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0xea76('0xd')]},{'name':_0xea76('0xe'),'fields':[_0xea76('0xf'),_0xea76('0x10'),'phone',_0xea76('0x11'),'fax','email'],'type':_0xea76('0x12')}],'timestamps':!![],'charset':_0xea76('0x13'),'collate':_0xea76('0x14'),'hooks':{'afterCreate':function(_0x1723e9,_0x1e7ed8,_0x42605e){var _0x251806=_0x194f9a[_0xea76('0x15')];var _0x2d08f8=_0x1723e9[_0xea76('0x16')]({'plain':!![]});function _0x32c142(){return function(_0x3d7cc2){logger[_0xea76('0x17')](_0xea76('0x18'),_0xea76('0x19'),util['inspect'](_0x3d7cc2,{'showHidden':![],'depth':null}));};}function _0x2a9462(_0x150742,_0x4a16c9){var _0x4ac3b0=_0x4a16c9[_0xea76('0x1a')]?_0x4a16c9[_0xea76('0x1a')]:moment()['format'](_0xea76('0x1b'));return new BPromise(function(_0x30100b,_0xec727a){if(_['isNil'](_0x4a16c9[_0xea76('0x1c')])){_0x30100b({'ret':_0x4ac3b0});}else{_0x251806['VoiceQueue'][_0xea76('0x1d')]({'where':{'id':_0x150742['id']}})['then'](function(_0x50332b){if(!_[_0xea76('0x1e')](_0x50332b)){var _0x208770=_0x50332b[_0xea76('0x1c')];if(!_[_0xea76('0x1e')](_0x208770)){var _0x11c020=shared[_0xea76('0x1f')];var _0x478bd5=_0x11c020[_0x208770];var _0x342345=_0x11c020[_0x4a16c9[_0xea76('0x1c')]];if(!_[_0xea76('0x1e')](_0x478bd5)&&!_[_0xea76('0x1e')](_0x342345)){var _0x2a0fb5=_0x478bd5[_0xea76('0x20')]-_0x342345[_0xea76('0x20')];_0x4ac3b0=_0x4a16c9[_0xea76('0x1a')]?_0x4a16c9[_0xea76('0x1a')]:moment();var _0x18c066=moment(_0x4ac3b0)[_0xea76('0x21')](_0x2a0fb5,'minutes');_0x30100b({'ret':_0x18c066[_0xea76('0x22')](_0xea76('0x1b'))});}else _0x30100b({'ret':_0x4ac3b0});}else _0x30100b({'ret':_0x4ac3b0});}else{_0x30100b({'ret':_0x4ac3b0});}});}});return 0xa;}var _0x6012cd=function(_0x597690){return new BPromise(function(_0x5bc331,_0x2a6c62){_0x2a9462(_0x597690,_0x2d08f8)[_0xea76('0x23')](function(_0x27d272){_0x2d08f8[_0xea76('0x1a')]=_0x27d272[_0xea76('0x24')];_0x251806[_0xea76('0x25')][_0xea76('0x1d')]({'where':{'phone':_0x2d08f8['phone'],'VoiceQueueId':_0x597690['id']}})['then'](function(_0x597349){if(!_[_0xea76('0x1e')](_0x597349)){throw new Error(_0xea76('0x26')+_0x2d08f8['phone']+_0xea76('0x27')+_0x597690['id']);}return _0x251806[_0xea76('0x25')]['create']({'phone':_0x2d08f8[_0xea76('0xd')],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8[_0xea76('0x28')],'priority':_0x2d08f8[_0xea76('0x29')]?_0x2d08f8[_0xea76('0x29')]:0x2,'scheduledat':_0x2d08f8[_0xea76('0x1a')]?_0x2d08f8[_0xea76('0x1a')]:moment()['format'](_0xea76('0x1b')),'callback':_0x2d08f8['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2d08f8[_0xea76('0x2a')]?_0x2d08f8[_0xea76('0x2a')]:undefined,'callbackat':_0x2d08f8[_0xea76('0x2a')]?moment()[_0xea76('0x22')](_0xea76('0x1b')):undefined,'VoiceQueueId':_0x597690['id']});})['catch'](function(_0x179c63){_0x2a6c62(_0x179c63);});});});};var _0x1a5777=function(_0x26655f){return new BPromise(function(_0x50bbf4,_0x5b456c){_0x2a9462(_0x26655f,_0x2d08f8)[_0xea76('0x23')](function(_0xe27220){_0x2d08f8['scheduledat']=_0xe27220[_0xea76('0x24')];_0x251806[_0xea76('0x25')]['findOne']({'where':{'phone':_0x2d08f8[_0xea76('0xd')],'VoiceQueueId':_0x26655f['id']}})[_0xea76('0x23')](function(_0x4e62bc){if(!_[_0xea76('0x1e')](_0x4e62bc)){throw new Error(_0xea76('0x26')+_0x2d08f8[_0xea76('0xd')]+_0xea76('0x2b')+_0x26655f['id']);}return _0x251806[_0xea76('0x2c')]['findOne']({'where':{'calleridnum':_0x2d08f8['phone'],'VoiceQueueId':_0x26655f['id']}});})[_0xea76('0x23')](function(_0x122130){if(!_['isNil'](_0x122130)){throw new Error(_0xea76('0x2d')+_0x2d08f8[_0xea76('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x26655f['id']);}return _0x251806['CmHopper']['create']({'phone':_0x2d08f8[_0xea76('0xd')],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8[_0xea76('0x28')],'priority':_0x2d08f8['priority']?_0x2d08f8[_0xea76('0x29')]:0x2,'scheduledat':_0x2d08f8['scheduledat']?_0x2d08f8[_0xea76('0x1a')]:moment()[_0xea76('0x22')](_0xea76('0x1b')),'callback':_0x2d08f8[_0xea76('0x2a')]?!![]:![],'callbackuniqueid':_0x2d08f8[_0xea76('0x2a')]?_0x2d08f8[_0xea76('0x2a')]:undefined,'callbackat':_0x2d08f8[_0xea76('0x2a')]?moment()['format'](_0xea76('0x1b')):undefined,'VoiceQueueId':_0x26655f['id']});})[_0xea76('0x2e')](function(_0xa3e50c){_0x5b456c(_0xa3e50c);});});});};function _0x3159c8(){return function(_0x45f501){logger['error'](_0xea76('0x18'),_0xea76('0x19'),util[_0xea76('0x2f')](_0x45f501,{'showHidden':![],'depth':null}));};}function _0x32f5de(_0x43ed93,_0x3ba089){var _0x58be10=_0x3ba089[_0xea76('0x1a')]?_0x3ba089['scheduledat']:moment()[_0xea76('0x22')](_0xea76('0x1b'));return new BPromise(function(_0x3fac4a,_0x441524){if(_[_0xea76('0x1e')](_0x3ba089[_0xea76('0x1c')])){_0x3fac4a({'ret':_0x58be10});}else{_0x251806[_0xea76('0x30')]['findOne']({'where':{'id':_0x43ed93['id']}})[_0xea76('0x23')](function(_0x5add2e){if(!_[_0xea76('0x1e')](_0x5add2e)){var _0x48931a=_0x5add2e[_0xea76('0x1c')];if(!_[_0xea76('0x1e')](_0x48931a)){var _0x3459cd=shared['timezones'];var _0x26c4d1=_0x3459cd[_0x48931a];var _0x85b687=_0x3459cd[_0x3ba089[_0xea76('0x1c')]];if(!_[_0xea76('0x1e')](_0x26c4d1)&&!_[_0xea76('0x1e')](_0x85b687)){var _0x5a34da=_0x26c4d1['utcOffset']-_0x85b687['utcOffset'];_0x58be10=_0x3ba089[_0xea76('0x1a')]?_0x3ba089[_0xea76('0x1a')]:moment();var _0x33aefc=moment(_0x58be10)[_0xea76('0x21')](_0x5a34da,_0xea76('0x31'));_0x3fac4a({'ret':_0x33aefc[_0xea76('0x22')](_0xea76('0x1b'))});}else _0x3fac4a({'ret':_0x58be10});}else _0x3fac4a({'ret':_0x58be10});}else{_0x3fac4a({'ret':_0x58be10});}});}});return 0xa;}var _0x2b765f=function(_0x55d210){return new BPromise(function(_0x2bcb2a,_0x2a8d8c){_0x32f5de(_0x55d210,_0x2d08f8)[_0xea76('0x23')](function(_0x3ef3e0){_0x2d08f8[_0xea76('0x1a')]=_0x3ef3e0[_0xea76('0x24')];_0x251806[_0xea76('0x25')]['findOne']({'where':{'phone':_0x2d08f8[_0xea76('0xd')],'CampaignId':_0x55d210['id']}})[_0xea76('0x23')](function(_0x55a555){if(!_[_0xea76('0x1e')](_0x55a555)){throw new Error(_0xea76('0x26')+_0x2d08f8[_0xea76('0xd')]+_0xea76('0x32')+_0x55d210['id']);}return _0x251806[_0xea76('0x25')][_0xea76('0x33')]({'phone':_0x2d08f8[_0xea76('0xd')],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8[_0xea76('0x28')],'priority':_0x2d08f8['priority']?_0x2d08f8[_0xea76('0x29')]:0x2,'scheduledat':_0x2d08f8[_0xea76('0x1a')]?_0x2d08f8[_0xea76('0x1a')]:moment()['format'](_0xea76('0x1b')),'callback':_0x2d08f8[_0xea76('0x2a')]?!![]:![],'callbackuniqueid':_0x2d08f8[_0xea76('0x2a')]?_0x2d08f8[_0xea76('0x2a')]:undefined,'callbackat':_0x2d08f8[_0xea76('0x2a')]?moment()[_0xea76('0x22')](_0xea76('0x1b')):undefined,'CampaignId':_0x55d210['id']});})[_0xea76('0x2e')](function(_0x2d49d8){_0x2a8d8c(_0x2d49d8);});});});};var _0x545aa5=function(_0x33b5d8){return new BPromise(function(_0xca37e0,_0x3447cb){_0x32f5de(_0x33b5d8,_0x2d08f8)[_0xea76('0x23')](function(_0x5781e5){_0x2d08f8['scheduledat']=_0x5781e5[_0xea76('0x24')];_0x251806[_0xea76('0x25')][_0xea76('0x1d')]({'where':{'phone':_0x2d08f8['phone'],'CampaignId':_0x33b5d8['id']}})[_0xea76('0x23')](function(_0x2d5347){if(!_[_0xea76('0x1e')](_0x2d5347)){throw new Error(_0xea76('0x26')+_0x2d08f8[_0xea76('0xd')]+_0xea76('0x34')+_0x33b5d8['id']);}return _0x251806['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x2d08f8[_0xea76('0xd')],'CampaignId':_0x33b5d8['id']}});})[_0xea76('0x23')](function(_0x466063){if(!_['isNil'](_0x466063)){throw new Error(_0xea76('0x2d')+_0x2d08f8[_0xea76('0xd')]+_0xea76('0x35')+_0x33b5d8['id']);}return _0x251806[_0xea76('0x25')][_0xea76('0x33')]({'phone':_0x2d08f8[_0xea76('0xd')],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8[_0xea76('0x28')],'priority':_0x2d08f8['priority']?_0x2d08f8[_0xea76('0x29')]:0x2,'scheduledat':_0x2d08f8[_0xea76('0x1a')]?_0x2d08f8['scheduledat']:moment()[_0xea76('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2d08f8[_0xea76('0x2a')]?!![]:![],'callbackuniqueid':_0x2d08f8[_0xea76('0x2a')]?_0x2d08f8['callbackUniqueid']:undefined,'callbackat':_0x2d08f8[_0xea76('0x2a')]?moment()[_0xea76('0x22')](_0xea76('0x1b')):undefined,'CampaignId':_0x33b5d8['id']});})[_0xea76('0x2e')](function(_0x459737){_0x3447cb(_0x459737);});});});};if(_0x2d08f8[_0xea76('0x28')]){_0x251806[_0xea76('0x36')][_0xea76('0x37')]({'where':{'type':_0xea76('0x38')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x251806[_0xea76('0x39')],'as':_0xea76('0x3a'),'where':{'id':_0x2d08f8['ListId']}}]})['then'](function(_0x634124){if(_0x634124){var _0x47b8f3=[];for(var _0x5c7551=0x0,_0x49bec9;_0x5c7551<_0x634124['length'];_0x5c7551+=0x1){_0x49bec9=_0x634124[_0x5c7551]['get']({'plain':!![]});switch(_0x49bec9[_0xea76('0x3b')]){case'always':_0x1a5777(_0x49bec9)[_0xea76('0x2e')](_0x32c142());break;case'onlyIfOpen':_0x6012cd(_0x49bec9)['catch'](_0x32c142());break;default:_0x32f5de(_0x49bec9,_0x2d08f8)[_0xea76('0x23')](function(_0x2aea4d){_0x2d08f8[_0xea76('0x1a')]=_0x2aea4d[_0xea76('0x24')];_0x251806[_0xea76('0x25')][_0xea76('0x33')]({'phone':_0x2d08f8[_0xea76('0xd')],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8[_0xea76('0x28')],'scheduledat':_0x2d08f8[_0xea76('0x1a')]?_0x2d08f8[_0xea76('0x1a')]:moment()[_0xea76('0x22')](_0xea76('0x1b')),'priority':_0x2d08f8[_0xea76('0x29')]?_0x2d08f8['priority']:0x2,'callback':_0x2d08f8[_0xea76('0x2a')]?!![]:![],'callbackuniqueid':_0x2d08f8[_0xea76('0x2a')]?_0x2d08f8[_0xea76('0x2a')]:undefined,'callbackat':_0x2d08f8[_0xea76('0x2a')]?moment()[_0xea76('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x49bec9['id']})[_0xea76('0x2e')](_0x32c142());});}}}})[_0xea76('0x23')](function(){return _0x251806[_0xea76('0x36')]['findAll']({'where':{'type':_0xea76('0x38')},'attributes':['id'],'include':[{'model':_0x251806[_0xea76('0x39')],'as':_0xea76('0x3c'),'where':{'id':_0x2d08f8[_0xea76('0x28')]}}]})[_0xea76('0x23')](function(_0x4bf760){if(_0x4bf760){var _0x34e807=[];for(var _0x3ef581=0x0,_0x2b1b6c;_0x3ef581<_0x4bf760[_0xea76('0x3d')];_0x3ef581+=0x1){_0x2b1b6c=_0x4bf760[_0x3ef581][_0xea76('0x16')]({'plain':!![]});_0x251806[_0xea76('0x3e')][_0xea76('0x33')]({'phone':_0x2d08f8[_0xea76('0xd')],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8[_0xea76('0x28')],'VoiceQueueId':_0x2b1b6c['id']})[_0xea76('0x2e')](function(_0x4501fc){logger['error'](_0xea76('0x3f'),_0xea76('0x19'),_0x4501fc['message']);});}}});})['then'](function(){return _0x251806['Campaign'][_0xea76('0x37')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x251806[_0xea76('0x39')],'as':_0xea76('0x3a'),'where':{'id':_0x2d08f8[_0xea76('0x28')]}}]})[_0xea76('0x23')](function(_0x54821a){if(_0x54821a){var _0x2b93d6=[];for(var _0x2ce30d=0x0,_0x4078b9;_0x2ce30d<_0x54821a['length'];_0x2ce30d+=0x1){_0x4078b9=_0x54821a[_0x2ce30d][_0xea76('0x16')]({'plain':!![]});switch(_0x4078b9[_0xea76('0x3b')]){case _0xea76('0x40'):_0x545aa5(_0x4078b9)['catch'](_0x3159c8());break;case _0xea76('0x41'):_0x2b765f(_0x4078b9)['catch'](_0x3159c8());break;default:_0x251806['CmHopper']['create']({'phone':_0x2d08f8[_0xea76('0xd')],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8['ListId'],'scheduledat':_0x2d08f8[_0xea76('0x1a')]?_0x2d08f8[_0xea76('0x1a')]:moment()[_0xea76('0x22')](_0xea76('0x1b')),'priority':_0x2d08f8[_0xea76('0x29')]?_0x2d08f8[_0xea76('0x29')]:0x2,'callback':_0x2d08f8['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2d08f8[_0xea76('0x2a')]?_0x2d08f8[_0xea76('0x2a')]:undefined,'callbackat':_0x2d08f8[_0xea76('0x2a')]?moment()['format'](_0xea76('0x1b')):undefined,'CampaignId':_0x4078b9['id']})[_0xea76('0x2e')](_0x3159c8());}}}});})['then'](function(){return _0x251806[_0xea76('0x30')][_0xea76('0x37')]({'attributes':['id'],'include':[{'model':_0x251806[_0xea76('0x39')],'as':_0xea76('0x3c'),'where':{'id':_0x2d08f8['ListId']}}]})[_0xea76('0x23')](function(_0x5b87c4){if(_0x5b87c4){var _0x505c34=[];for(var _0x97fbca=0x0,_0x9eafcb;_0x97fbca<_0x5b87c4[_0xea76('0x3d')];_0x97fbca+=0x1){_0x9eafcb=_0x5b87c4[_0x97fbca]['get']({'plain':!![]});_0x251806[_0xea76('0x3e')][_0xea76('0x33')]({'phone':_0x2d08f8['phone'],'ContactId':_0x2d08f8['id'],'ListId':_0x2d08f8[_0xea76('0x28')],'CampaignId':_0x9eafcb['id']})[_0xea76('0x2e')](function(_0x1f1403){logger[_0xea76('0x17')](_0xea76('0x3f'),_0xea76('0x19'),_0x1f1403[_0xea76('0x42')]);});}}});})[_0xea76('0x23')](function(){_0x42605e();})[_0xea76('0x2e')](function(_0x4ec68f){logger[_0xea76('0x17')]('cmContact,\x20%s,\x20%s','afterCreate',_0x4ec68f[_0xea76('0x42')]);_0x42605e(_0x4ec68f);});}else{_0x42605e(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x4f8104,_0x4e2efc,_0x15e137){var _0x3ecd37=_0x194f9a[_0xea76('0x15')];var _0x188cf2=_0x4f8104['get']({'plain':!![]});return _0x3ecd37[_0xea76('0x25')][_0xea76('0x37')]({'raw':!![],'where':{'ListId':_0x188cf2['ListId'],'ContactId':_0x188cf2['id']}})[_0xea76('0x23')](function(_0x257f8d){if(!_[_0xea76('0x43')](_0x257f8d)){var _0x23655b=[];for(var _0x257d58=0x0;_0x257d58<_0x257f8d[_0xea76('0x3d')];_0x257d58+=0x1){var _0x1b3b0a=_0x3ecd37[_0xea76('0x25')][_0xea76('0x44')]({'where':{'ListId':_0x257f8d[_0x257d58][_0xea76('0x28')],'ContactId':_0x257f8d[_0x257d58][_0xea76('0x45')],'VoiceQueueId':_0x257f8d[_0x257d58][_0xea76('0x46')],'CampaignId':_0x257f8d[_0x257d58][_0xea76('0x47')]}});_0x23655b['push'](_0x1b3b0a);}return BPromise['all'](_0x23655b);}})['then'](function(_0x485362){logger['info'](_0xea76('0x48'),util[_0xea76('0x2f')](_0x485362,{'showHidden':![],'depth':null}));_0x15e137();})[_0xea76('0x2e')](function(_0x26bf18){logger[_0xea76('0x17')](_0xea76('0x49'),util[_0xea76('0x2f')](_0x26bf18,{'showHidden':![],'depth':null}));_0x15e137(_0x26bf18);});}}});}; \ No newline at end of file +var _0x9ad3=['dialCheckDuplicateType','Lists','onlyIfOpen','CmList','BlackLists','length','cmContact,\x20%s,\x20%s','message','always','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','../../config/environment/shared','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','email','utf8mb4','models','get','cmContact','afterCreate','inspect','scheduledat','format','dialTimezone','findOne','then','isNil','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','cmContact,\x20afterCreate\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\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','error','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound'];(function(_0x30a629,_0xdd2c74){var _0x130d61=function(_0x578b1c){while(--_0x578b1c){_0x30a629['push'](_0x30a629['shift']());}};_0x130d61(++_0xdd2c74);}(_0x9ad3,0x17a));var _0x39ad=function(_0xac01a9,_0x210f80){_0xac01a9=_0xac01a9-0x0;var _0x7048a5=_0x9ad3[_0xac01a9];return _0x7048a5;};'use strict';var _=require(_0x39ad('0x0'));var util=require(_0x39ad('0x1'));var logger=require(_0x39ad('0x2'))(_0x39ad('0x3'));var moment=require(_0x39ad('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x39ad('0x5'));var rimraf=require(_0x39ad('0x6'));var config=require(_0x39ad('0x7'));var shared=require(_0x39ad('0x8'));var attributes=require('./cmContact.attributes');module['exports']=function(_0xc02ccb,_0x27d146){return _0xc02ccb[_0x39ad('0x9')]('CmContact',attributes,{'tableName':_0x39ad('0xa'),'paranoid':!![],'indexes':[{'name':_0x39ad('0xb'),'fields':[_0x39ad('0xb')]},{'name':_0x39ad('0xc'),'fields':[_0x39ad('0xd'),_0x39ad('0xe'),'phone',_0x39ad('0xf'),'fax',_0x39ad('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x39ad('0x11'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x28eb15,_0x184524,_0x2b47c3){var _0x7f2040=_0xc02ccb[_0x39ad('0x12')];var _0xf6f1=_0x28eb15[_0x39ad('0x13')]({'plain':!![]});function _0x5ef7c0(){return function(_0x35a646){logger['error'](_0x39ad('0x14'),_0x39ad('0x15'),util[_0x39ad('0x16')](_0x35a646,{'showHidden':![],'depth':null}));};}function _0x1167d2(_0x206504,_0x4c2aba){var _0x4ac493=_0x4c2aba['scheduledat']?_0x4c2aba[_0x39ad('0x17')]:moment()[_0x39ad('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5901ab,_0x56b1aa){if(_['isNil'](_0x4c2aba[_0x39ad('0x19')])){_0x5901ab({'ret':_0x4ac493});}else{_0x7f2040['VoiceQueue'][_0x39ad('0x1a')]({'where':{'id':_0x206504['id']}})[_0x39ad('0x1b')](function(_0x21cef6){if(!_[_0x39ad('0x1c')](_0x21cef6)){var _0x400977=_0x21cef6['dialTimezone'];if(!_[_0x39ad('0x1c')](_0x400977)){var _0x164138=shared[_0x39ad('0x1d')];var _0x205c36=_0x164138[_0x400977];var _0x1109a1=_0x164138[_0x4c2aba[_0x39ad('0x19')]];if(!_[_0x39ad('0x1c')](_0x205c36)&&!_[_0x39ad('0x1c')](_0x1109a1)){var _0x53c238=_0x205c36[_0x39ad('0x1e')]-_0x1109a1[_0x39ad('0x1e')];_0x4ac493=_0x4c2aba[_0x39ad('0x17')]?_0x4c2aba[_0x39ad('0x17')]:moment();var _0x2df1b2=moment(_0x4ac493)['add'](_0x53c238,_0x39ad('0x1f'));_0x5901ab({'ret':_0x2df1b2[_0x39ad('0x18')](_0x39ad('0x20'))});}else _0x5901ab({'ret':_0x4ac493});}else _0x5901ab({'ret':_0x4ac493});}else{_0x5901ab({'ret':_0x4ac493});}});}});return 0xa;}var _0x5ce0a9=function(_0x424203){return new BPromise(function(_0x43bcba,_0x327725){_0x1167d2(_0x424203,_0xf6f1)[_0x39ad('0x1b')](function(_0x1fa93a){_0xf6f1[_0x39ad('0x17')]=_0x1fa93a[_0x39ad('0x21')];_0x7f2040['CmHopper']['findOne']({'where':{'phone':_0xf6f1[_0x39ad('0xb')],'VoiceQueueId':_0x424203['id']}})['then'](function(_0x4cb11f){if(!_['isNil'](_0x4cb11f)){throw new Error(_0x39ad('0x22')+_0xf6f1[_0x39ad('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x424203['id']);}return _0x7f2040[_0x39ad('0x23')][_0x39ad('0x24')]({'phone':_0xf6f1[_0x39ad('0xb')],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1[_0x39ad('0x25')],'priority':_0xf6f1[_0x39ad('0x26')]?_0xf6f1[_0x39ad('0x26')]:0x2,'scheduledat':_0xf6f1[_0x39ad('0x17')]?_0xf6f1[_0x39ad('0x17')]:moment()['format'](_0x39ad('0x20')),'callback':_0xf6f1[_0x39ad('0x27')]?!![]:![],'callbackuniqueid':_0xf6f1[_0x39ad('0x27')]?_0xf6f1[_0x39ad('0x27')]:undefined,'callbackat':_0xf6f1['callbackUniqueid']?moment()[_0x39ad('0x18')](_0x39ad('0x20')):undefined,'VoiceQueueId':_0x424203['id']});})[_0x39ad('0x28')](function(_0x2007d8){_0x327725(_0x2007d8);});});});};var _0x57a335=function(_0x511931){return new BPromise(function(_0x366f54,_0x3f3c36){_0x1167d2(_0x511931,_0xf6f1)[_0x39ad('0x1b')](function(_0xa6bbe0){_0xf6f1[_0x39ad('0x17')]=_0xa6bbe0[_0x39ad('0x21')];_0x7f2040[_0x39ad('0x23')][_0x39ad('0x1a')]({'where':{'phone':_0xf6f1[_0x39ad('0xb')],'VoiceQueueId':_0x511931['id']}})[_0x39ad('0x1b')](function(_0x4e3b0d){if(!_[_0x39ad('0x1c')](_0x4e3b0d)){throw new Error('cmContact,\x20afterCreate\x20'+_0xf6f1['phone']+_0x39ad('0x29')+_0x511931['id']);}return _0x7f2040[_0x39ad('0x2a')]['findOne']({'where':{'calleridnum':_0xf6f1[_0x39ad('0xb')],'VoiceQueueId':_0x511931['id']}});})['then'](function(_0x3efbb7){if(!_[_0x39ad('0x1c')](_0x3efbb7)){throw new Error(_0x39ad('0x2b')+_0xf6f1[_0x39ad('0xb')]+_0x39ad('0x2c')+_0x511931['id']);}return _0x7f2040[_0x39ad('0x23')]['create']({'phone':_0xf6f1[_0x39ad('0xb')],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1[_0x39ad('0x25')],'priority':_0xf6f1[_0x39ad('0x26')]?_0xf6f1['priority']:0x2,'scheduledat':_0xf6f1[_0x39ad('0x17')]?_0xf6f1['scheduledat']:moment()[_0x39ad('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xf6f1[_0x39ad('0x27')]?!![]:![],'callbackuniqueid':_0xf6f1[_0x39ad('0x27')]?_0xf6f1[_0x39ad('0x27')]:undefined,'callbackat':_0xf6f1[_0x39ad('0x27')]?moment()[_0x39ad('0x18')](_0x39ad('0x20')):undefined,'VoiceQueueId':_0x511931['id']});})['catch'](function(_0x25f22f){_0x3f3c36(_0x25f22f);});});});};function _0x3df0b2(){return function(_0x45d46d){logger[_0x39ad('0x2d')](_0x39ad('0x14'),'afterCreate',util[_0x39ad('0x16')](_0x45d46d,{'showHidden':![],'depth':null}));};}function _0x5250b7(_0x3a6512,_0x11d636){var _0xb7bbca=_0x11d636[_0x39ad('0x17')]?_0x11d636['scheduledat']:moment()[_0x39ad('0x18')](_0x39ad('0x20'));return new BPromise(function(_0x52162a,_0x55000c){if(_['isNil'](_0x11d636[_0x39ad('0x19')])){_0x52162a({'ret':_0xb7bbca});}else{_0x7f2040[_0x39ad('0x2e')]['findOne']({'where':{'id':_0x3a6512['id']}})['then'](function(_0x674c59){if(!_[_0x39ad('0x1c')](_0x674c59)){var _0x5382be=_0x674c59[_0x39ad('0x19')];if(!_[_0x39ad('0x1c')](_0x5382be)){var _0x18fd90=shared[_0x39ad('0x1d')];var _0x1d3a77=_0x18fd90[_0x5382be];var _0x13578b=_0x18fd90[_0x11d636['dialTimezone']];if(!_[_0x39ad('0x1c')](_0x1d3a77)&&!_['isNil'](_0x13578b)){var _0x15d7d3=_0x1d3a77[_0x39ad('0x1e')]-_0x13578b[_0x39ad('0x1e')];_0xb7bbca=_0x11d636[_0x39ad('0x17')]?_0x11d636[_0x39ad('0x17')]:moment();var _0x1ffa80=moment(_0xb7bbca)[_0x39ad('0x2f')](_0x15d7d3,_0x39ad('0x1f'));_0x52162a({'ret':_0x1ffa80['format'](_0x39ad('0x20'))});}else _0x52162a({'ret':_0xb7bbca});}else _0x52162a({'ret':_0xb7bbca});}else{_0x52162a({'ret':_0xb7bbca});}});}});return 0xa;}var _0x591bd7=function(_0x1aa4cb){return new BPromise(function(_0x52e74d,_0xdc3ad8){_0x5250b7(_0x1aa4cb,_0xf6f1)['then'](function(_0x29780f){_0xf6f1[_0x39ad('0x17')]=_0x29780f[_0x39ad('0x21')];_0x7f2040[_0x39ad('0x23')][_0x39ad('0x1a')]({'where':{'phone':_0xf6f1['phone'],'CampaignId':_0x1aa4cb['id']}})['then'](function(_0x290f07){if(!_[_0x39ad('0x1c')](_0x290f07)){throw new Error(_0x39ad('0x22')+_0xf6f1[_0x39ad('0xb')]+_0x39ad('0x30')+_0x1aa4cb['id']);}return _0x7f2040[_0x39ad('0x23')][_0x39ad('0x24')]({'phone':_0xf6f1[_0x39ad('0xb')],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1[_0x39ad('0x25')],'priority':_0xf6f1[_0x39ad('0x26')]?_0xf6f1[_0x39ad('0x26')]:0x2,'scheduledat':_0xf6f1[_0x39ad('0x17')]?_0xf6f1[_0x39ad('0x17')]:moment()['format'](_0x39ad('0x20')),'callback':_0xf6f1[_0x39ad('0x27')]?!![]:![],'callbackuniqueid':_0xf6f1[_0x39ad('0x27')]?_0xf6f1[_0x39ad('0x27')]:undefined,'callbackat':_0xf6f1[_0x39ad('0x27')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1aa4cb['id']});})['catch'](function(_0x1fd682){_0xdc3ad8(_0x1fd682);});});});};var _0x5a11e9=function(_0x558e3e){return new BPromise(function(_0x45b99b,_0x54cdbb){_0x5250b7(_0x558e3e,_0xf6f1)['then'](function(_0x2af340){_0xf6f1[_0x39ad('0x17')]=_0x2af340[_0x39ad('0x21')];_0x7f2040['CmHopper']['findOne']({'where':{'phone':_0xf6f1[_0x39ad('0xb')],'CampaignId':_0x558e3e['id']}})[_0x39ad('0x1b')](function(_0xeb7aa4){if(!_[_0x39ad('0x1c')](_0xeb7aa4)){throw new Error(_0x39ad('0x22')+_0xf6f1[_0x39ad('0xb')]+_0x39ad('0x31')+_0x558e3e['id']);}return _0x7f2040['CmHopperFinal'][_0x39ad('0x1a')]({'where':{'calleridnum':_0xf6f1['phone'],'CampaignId':_0x558e3e['id']}});})[_0x39ad('0x1b')](function(_0x3940e6){if(!_[_0x39ad('0x1c')](_0x3940e6)){throw new Error('cmContact,\x20afterCreate,\x20'+_0xf6f1[_0x39ad('0xb')]+_0x39ad('0x32')+_0x558e3e['id']);}return _0x7f2040[_0x39ad('0x23')][_0x39ad('0x24')]({'phone':_0xf6f1[_0x39ad('0xb')],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1[_0x39ad('0x25')],'priority':_0xf6f1[_0x39ad('0x26')]?_0xf6f1[_0x39ad('0x26')]:0x2,'scheduledat':_0xf6f1['scheduledat']?_0xf6f1['scheduledat']:moment()[_0x39ad('0x18')](_0x39ad('0x20')),'callback':_0xf6f1[_0x39ad('0x27')]?!![]:![],'callbackuniqueid':_0xf6f1[_0x39ad('0x27')]?_0xf6f1[_0x39ad('0x27')]:undefined,'callbackat':_0xf6f1['callbackUniqueid']?moment()[_0x39ad('0x18')](_0x39ad('0x20')):undefined,'CampaignId':_0x558e3e['id']});})['catch'](function(_0x1cf4a1){_0x54cdbb(_0x1cf4a1);});});});};if(_0xf6f1['ListId']){_0x7f2040[_0x39ad('0x33')][_0x39ad('0x34')]({'where':{'type':_0x39ad('0x35')},'attributes':['id',_0x39ad('0x36'),_0x39ad('0x19')],'include':[{'model':_0x7f2040['CmList'],'as':_0x39ad('0x37'),'where':{'id':_0xf6f1[_0x39ad('0x25')]}}]})['then'](function(_0x3e9fd7){if(_0x3e9fd7){var _0x3dec4f=[];for(var _0x492da9=0x0,_0x1bb142;_0x492da9<_0x3e9fd7['length'];_0x492da9+=0x1){_0x1bb142=_0x3e9fd7[_0x492da9]['get']({'plain':!![]});switch(_0x1bb142['dialCheckDuplicateType']){case'always':_0x57a335(_0x1bb142)[_0x39ad('0x28')](_0x5ef7c0());break;case _0x39ad('0x38'):_0x5ce0a9(_0x1bb142)[_0x39ad('0x28')](_0x5ef7c0());break;default:_0x5250b7(_0x1bb142,_0xf6f1)[_0x39ad('0x1b')](function(_0x206d2f){_0xf6f1[_0x39ad('0x17')]=_0x206d2f[_0x39ad('0x21')];_0x7f2040[_0x39ad('0x23')][_0x39ad('0x24')]({'phone':_0xf6f1[_0x39ad('0xb')],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1[_0x39ad('0x25')],'scheduledat':_0xf6f1[_0x39ad('0x17')]?_0xf6f1[_0x39ad('0x17')]:moment()[_0x39ad('0x18')](_0x39ad('0x20')),'priority':_0xf6f1['priority']?_0xf6f1[_0x39ad('0x26')]:0x2,'callback':_0xf6f1[_0x39ad('0x27')]?!![]:![],'callbackuniqueid':_0xf6f1[_0x39ad('0x27')]?_0xf6f1['callbackUniqueid']:undefined,'callbackat':_0xf6f1['callbackUniqueid']?moment()[_0x39ad('0x18')](_0x39ad('0x20')):undefined,'VoiceQueueId':_0x1bb142['id']})[_0x39ad('0x28')](_0x5ef7c0());});}}}})['then'](function(){return _0x7f2040[_0x39ad('0x33')][_0x39ad('0x34')]({'where':{'type':_0x39ad('0x35')},'attributes':['id'],'include':[{'model':_0x7f2040[_0x39ad('0x39')],'as':_0x39ad('0x3a'),'where':{'id':_0xf6f1[_0x39ad('0x25')]}}]})['then'](function(_0x2be61b){if(_0x2be61b){var _0xb5f597=[];for(var _0x220af8=0x0,_0x2d9ffa;_0x220af8<_0x2be61b[_0x39ad('0x3b')];_0x220af8+=0x1){_0x2d9ffa=_0x2be61b[_0x220af8]['get']({'plain':!![]});_0x7f2040['CmHopperBlack'][_0x39ad('0x24')]({'phone':_0xf6f1[_0x39ad('0xb')],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1['ListId'],'VoiceQueueId':_0x2d9ffa['id']})[_0x39ad('0x28')](function(_0x2cec51){logger['error'](_0x39ad('0x3c'),_0x39ad('0x15'),_0x2cec51[_0x39ad('0x3d')]);});}}});})['then'](function(){return _0x7f2040['Campaign'][_0x39ad('0x34')]({'attributes':['id',_0x39ad('0x36'),_0x39ad('0x19')],'include':[{'model':_0x7f2040[_0x39ad('0x39')],'as':'Lists','where':{'id':_0xf6f1[_0x39ad('0x25')]}}]})[_0x39ad('0x1b')](function(_0x4e67b2){if(_0x4e67b2){var _0x2b2be8=[];for(var _0x24d014=0x0,_0xe5873b;_0x24d014<_0x4e67b2['length'];_0x24d014+=0x1){_0xe5873b=_0x4e67b2[_0x24d014]['get']({'plain':!![]});switch(_0xe5873b[_0x39ad('0x36')]){case _0x39ad('0x3e'):_0x5a11e9(_0xe5873b)[_0x39ad('0x28')](_0x3df0b2());break;case _0x39ad('0x38'):_0x591bd7(_0xe5873b)['catch'](_0x3df0b2());break;default:_0x7f2040[_0x39ad('0x23')]['create']({'phone':_0xf6f1['phone'],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1['ListId'],'scheduledat':_0xf6f1['scheduledat']?_0xf6f1['scheduledat']:moment()['format'](_0x39ad('0x20')),'priority':_0xf6f1[_0x39ad('0x26')]?_0xf6f1['priority']:0x2,'callback':_0xf6f1[_0x39ad('0x27')]?!![]:![],'callbackuniqueid':_0xf6f1['callbackUniqueid']?_0xf6f1[_0x39ad('0x27')]:undefined,'callbackat':_0xf6f1[_0x39ad('0x27')]?moment()[_0x39ad('0x18')](_0x39ad('0x20')):undefined,'CampaignId':_0xe5873b['id']})[_0x39ad('0x28')](_0x3df0b2());}}}});})[_0x39ad('0x1b')](function(){return _0x7f2040[_0x39ad('0x2e')][_0x39ad('0x34')]({'attributes':['id'],'include':[{'model':_0x7f2040[_0x39ad('0x39')],'as':'BlackLists','where':{'id':_0xf6f1['ListId']}}]})[_0x39ad('0x1b')](function(_0x574903){if(_0x574903){var _0x3bcdf8=[];for(var _0x48331e=0x0,_0x2b9b19;_0x48331e<_0x574903[_0x39ad('0x3b')];_0x48331e+=0x1){_0x2b9b19=_0x574903[_0x48331e][_0x39ad('0x13')]({'plain':!![]});_0x7f2040['CmHopperBlack']['create']({'phone':_0xf6f1[_0x39ad('0xb')],'ContactId':_0xf6f1['id'],'ListId':_0xf6f1['ListId'],'CampaignId':_0x2b9b19['id']})['catch'](function(_0x490d5c){logger['error'](_0x39ad('0x3c'),_0x39ad('0x15'),_0x490d5c[_0x39ad('0x3d')]);});}}});})['then'](function(){_0x2b47c3();})[_0x39ad('0x28')](function(_0x58cd9b){logger[_0x39ad('0x2d')](_0x39ad('0x3c'),'afterCreate',_0x58cd9b['message']);_0x2b47c3(_0x58cd9b);});}else{_0x2b47c3(new Error(_0x39ad('0x3f')));}},'afterDestroy':function(_0x4e168f,_0x59ccc9,_0xea1b75){var _0x47194c=_0xc02ccb[_0x39ad('0x12')];var _0x573a34=_0x4e168f[_0x39ad('0x13')]({'plain':!![]});return _0x47194c[_0x39ad('0x23')][_0x39ad('0x34')]({'raw':!![],'where':{'ListId':_0x573a34[_0x39ad('0x25')],'ContactId':_0x573a34['id']}})[_0x39ad('0x1b')](function(_0x54f153){if(!_[_0x39ad('0x40')](_0x54f153)){var _0x3dc3ad=[];for(var _0x223605=0x0;_0x223605<_0x54f153[_0x39ad('0x3b')];_0x223605+=0x1){var _0x42f218=_0x47194c[_0x39ad('0x23')][_0x39ad('0x41')]({'where':{'ListId':_0x54f153[_0x223605]['ListId'],'ContactId':_0x54f153[_0x223605][_0x39ad('0x42')],'VoiceQueueId':_0x54f153[_0x223605][_0x39ad('0x43')],'CampaignId':_0x54f153[_0x223605]['CampaignId']}});_0x3dc3ad[_0x39ad('0x44')](_0x42f218);}return BPromise[_0x39ad('0x45')](_0x3dc3ad);}})[_0x39ad('0x1b')](function(_0x40c8e9){logger['info'](_0x39ad('0x46'),util[_0x39ad('0x16')](_0x40c8e9,{'showHidden':![],'depth':null}));_0xea1b75();})[_0x39ad('0x28')](function(_0x3017fb){logger[_0x39ad('0x2d')](_0x39ad('0x47'),util[_0x39ad('0x16')](_0x3017fb,{'showHidden':![],'depth':null}));_0xea1b75(_0x3017fb);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index de479ec..89bc2b1 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x1d26b8,_0x182407){var _0x5b2aa9=function(_0x1973d9){while(--_0x1973d9){_0x1d26b8['push'](_0x1d26b8['shift']());}};_0x5b2aa9(++_0x182407);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 bb74a12..7063f6d 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 _0xc576=['INTEGER','STRING','sequelize','exports'];(function(_0xe93ca,_0x17253c){var _0x5e374e=function(_0x35bcde){while(--_0x35bcde){_0xe93ca['push'](_0xe93ca['shift']());}};_0x5e374e(++_0x17253c);}(_0xc576,0x1ea));var _0x6c57=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xc576[_0x4cf8d4];return _0x2c1beb;};'use strict';var Sequelize=require(_0x6c57('0x0'));module[_0x6c57('0x1')]={'CmContactId':{'type':Sequelize[_0x6c57('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x6c57('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x6c57('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x6c57('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xc368=['STRING','INTEGER','PHONE','exports'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xc368,0x7b));var _0x8c36=function(_0x31eab5,_0x59701d){_0x31eab5=_0x31eab5-0x0;var _0x5a2c2c=_0xc368[_0x31eab5];return _0x5a2c2c;};'use strict';var Sequelize=require('sequelize');module[_0x8c36('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x8c36('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x8c36('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8c36('0x1')],'defaultValue':_0x8c36('0x3')},'OrderBy':{'type':Sequelize[_0x8c36('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'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 6286639..c65ffc5 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 _0x7a20=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmContactHasItems','UserProfileSection','autoAssociation'];(function(_0x439327,_0x1f85de){var _0x4304f3=function(_0x196544){while(--_0x196544){_0x439327['push'](_0x439327['shift']());}};_0x4304f3(++_0x1f85de);}(_0x7a20,0xa5));var _0x07a2=function(_0x5166fb,_0x4c5baa){_0x5166fb=_0x5166fb-0x0;var _0x327f28=_0x7a20[_0x5166fb];return _0x327f28;};'use strict';var emlformat=require(_0x07a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07a2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07a2('0x2'));var moment=require(_0x07a2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x07a2('0x4'));var util=require(_0x07a2('0x5'));var path=require('path');var sox=require(_0x07a2('0x6'));var csv=require('to-csv');var ejs=require(_0x07a2('0x7'));var fs=require('fs');var fs_extra=require(_0x07a2('0x8'));var _=require(_0x07a2('0x9'));var squel=require('squel');var crypto=require(_0x07a2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x07a2('0xb'));var querystring=require(_0x07a2('0xc'));var Papa=require(_0x07a2('0xd'));var Redis=require(_0x07a2('0xe'));var authService=require(_0x07a2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x07a2('0x10'));var hardwareService=require(_0x07a2('0x11'));var logger=require(_0x07a2('0x12'))(_0x07a2('0x13'));var utils=require('../../config/utils');var config=require(_0x07a2('0x14'));var licenseUtil=require(_0x07a2('0x15'));var db=require(_0x07a2('0x16'))['db'];function respondWithStatusCode(_0x366937,_0x24419b){_0x24419b=_0x24419b||0xcc;return function(_0x4998fb){if(_0x4998fb){return _0x366937[_0x07a2('0x17')](_0x24419b);}return _0x366937[_0x07a2('0x18')](_0x24419b)['end']();};}function respondWithResult(_0x2db563,_0x39c395){_0x39c395=_0x39c395||0xc8;return function(_0x2bcf24){if(_0x2bcf24){return _0x2db563[_0x07a2('0x18')](_0x39c395)[_0x07a2('0x19')](_0x2bcf24);}};}function respondWithFilteredResult(_0x5d9708,_0x55ef50){return function(_0x353579){if(_0x353579){var _0x40c03e=typeof _0x55ef50['offset']==='undefined'&&typeof _0x55ef50[_0x07a2('0x1a')]===_0x07a2('0x1b');var _0x449f80=_0x353579[_0x07a2('0x1c')];var _0xdcd42b=_0x40c03e?0x0:_0x55ef50[_0x07a2('0x1d')];var _0x4836ec=_0x40c03e?_0x353579[_0x07a2('0x1c')]:_0x55ef50['offset']+_0x55ef50['limit'];var _0x10fb4b;if(_0x4836ec>=_0x449f80){_0x4836ec=_0x449f80;_0x10fb4b=0xc8;}else{_0x10fb4b=0xce;}_0x5d9708[_0x07a2('0x18')](_0x10fb4b);return _0x5d9708[_0x07a2('0x1e')]('Content-Range',_0xdcd42b+'-'+_0x4836ec+'/'+_0x449f80)[_0x07a2('0x19')](_0x353579);}return null;};}function patchUpdates(_0x311fc3){return function(_0x59ac3f){try{jsonpatch[_0x07a2('0x1f')](_0x59ac3f,_0x311fc3,!![]);}catch(_0x1e5c90){return BPromise[_0x07a2('0x20')](_0x1e5c90);}return _0x59ac3f[_0x07a2('0x21')]();};}function saveUpdates(_0x16d0d0,_0x16ff20){return function(_0x4a8e1f){if(_0x4a8e1f){return _0x4a8e1f[_0x07a2('0x22')](_0x16d0d0)['then'](function(_0x18ec43){return _0x18ec43;});}return null;};}function removeEntity(_0x22d4d2,_0x1d1458){return function(_0xa376b2){if(_0xa376b2){return _0xa376b2[_0x07a2('0x23')]()[_0x07a2('0x24')](function(){var _0x2c7786=_0xa376b2[_0x07a2('0x25')]({'plain':!![]});var _0x350943='CmContactHasItems';return db[_0x07a2('0x26')]['destroy']({'where':{'type':_0x350943,'resourceId':_0x2c7786['id']}})['then'](function(){return _0xa376b2;});})[_0x07a2('0x24')](function(){_0x22d4d2[_0x07a2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14675a,_0x19721e){return function(_0xda46bc){if(!_0xda46bc){_0x14675a[_0x07a2('0x17')](0x194);}return _0xda46bc;};}function handleError(_0x29ce9a,_0x2b50b5){_0x2b50b5=_0x2b50b5||0x1f4;return function(_0x2b8562){logger[_0x07a2('0x27')](_0x2b8562[_0x07a2('0x28')]);if(_0x2b8562[_0x07a2('0x29')]){delete _0x2b8562[_0x07a2('0x29')];}_0x29ce9a['status'](_0x2b50b5)[_0x07a2('0x2a')](_0x2b8562);};}exports['index']=function(_0xe3de10,_0x5172d5){var _0x2553d8={},_0x36cad8={},_0x5f5476={'count':0x0,'rows':[]};var _0x3c29b9=_['map'](db[_0x07a2('0x2b')][_0x07a2('0x2c')],function(_0x5d62b8){return{'name':_0x5d62b8[_0x07a2('0x2d')],'type':_0x5d62b8[_0x07a2('0x2e')][_0x07a2('0x2f')]};});_0x36cad8[_0x07a2('0x30')]=_[_0x07a2('0x31')](_0x3c29b9,_0x07a2('0x29'));_0x36cad8[_0x07a2('0x32')]=_['keys'](_0xe3de10['query']);_0x36cad8['filters']=_[_0x07a2('0x33')](_0x36cad8[_0x07a2('0x30')],_0x36cad8['query']);_0x2553d8['attributes']=_[_0x07a2('0x33')](_0x36cad8[_0x07a2('0x30')],qs[_0x07a2('0x34')](_0xe3de10[_0x07a2('0x32')]['fields']));_0x2553d8[_0x07a2('0x35')]=_0x2553d8[_0x07a2('0x35')][_0x07a2('0x36')]?_0x2553d8[_0x07a2('0x35')]:_0x36cad8[_0x07a2('0x30')];if(!_0xe3de10['query']['hasOwnProperty']('nolimit')){_0x2553d8[_0x07a2('0x1a')]=qs[_0x07a2('0x1a')](_0xe3de10[_0x07a2('0x32')][_0x07a2('0x1a')]);_0x2553d8['offset']=qs[_0x07a2('0x1d')](_0xe3de10[_0x07a2('0x32')][_0x07a2('0x1d')]);}_0x2553d8[_0x07a2('0x37')]=qs[_0x07a2('0x38')](_0xe3de10['query'][_0x07a2('0x38')]);_0x2553d8[_0x07a2('0x39')]=qs[_0x07a2('0x3a')](_[_0x07a2('0x3b')](_0xe3de10[_0x07a2('0x32')],_0x36cad8[_0x07a2('0x3a')]),_0x3c29b9);if(_0xe3de10['query']['filter']){_0x2553d8[_0x07a2('0x39')]=_[_0x07a2('0x3c')](_0x2553d8[_0x07a2('0x39')],{'$or':_[_0x07a2('0x31')](_0x3c29b9,function(_0x45e2bf){if(_0x45e2bf[_0x07a2('0x2e')]!==_0x07a2('0x3d')){var _0x183f98={};_0x183f98[_0x45e2bf[_0x07a2('0x29')]]={'$like':'%'+_0xe3de10[_0x07a2('0x32')][_0x07a2('0x3e')]+'%'};return _0x183f98;}})});}_0x2553d8=_[_0x07a2('0x3c')]({},_0x2553d8,_0xe3de10[_0x07a2('0x3f')]);var _0x41ef97={'where':_0x2553d8['where']};return db['CmContactHasItem'][_0x07a2('0x1c')](_0x41ef97)[_0x07a2('0x24')](function(_0x9bd6ef){_0x5f5476['count']=_0x9bd6ef;if(_0xe3de10['query'][_0x07a2('0x40')]){_0x2553d8[_0x07a2('0x41')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x2553d8);})[_0x07a2('0x24')](function(_0x31a1d7){_0x5f5476[_0x07a2('0x42')]=_0x31a1d7;return _0x5f5476;})[_0x07a2('0x24')](respondWithFilteredResult(_0x5172d5,_0x2553d8))[_0x07a2('0x43')](handleError(_0x5172d5,null));};exports[_0x07a2('0x44')]=function(_0xb572a2,_0x36af03){var _0x56771e={'raw':!![],'where':{'id':_0xb572a2[_0x07a2('0x45')]['id']}},_0x10f70c={};_0x10f70c['model']=_[_0x07a2('0x46')](db[_0x07a2('0x2b')][_0x07a2('0x2c')]);_0x10f70c['query']=_['keys'](_0xb572a2[_0x07a2('0x32')]);_0x10f70c[_0x07a2('0x3a')]=_[_0x07a2('0x33')](_0x10f70c[_0x07a2('0x30')],_0x10f70c[_0x07a2('0x32')]);_0x56771e[_0x07a2('0x35')]=_[_0x07a2('0x33')](_0x10f70c[_0x07a2('0x30')],qs[_0x07a2('0x34')](_0xb572a2[_0x07a2('0x32')][_0x07a2('0x34')]));_0x56771e[_0x07a2('0x35')]=_0x56771e[_0x07a2('0x35')][_0x07a2('0x36')]?_0x56771e[_0x07a2('0x35')]:_0x10f70c['model'];if(_0xb572a2[_0x07a2('0x32')]['includeAll']){_0x56771e[_0x07a2('0x41')]=[{'all':!![]}];}_0x56771e=_[_0x07a2('0x3c')]({},_0x56771e,_0xb572a2[_0x07a2('0x3f')]);return db['CmContactHasItem']['find'](_0x56771e)[_0x07a2('0x24')](handleEntityNotFound(_0x36af03,null))['then'](respondWithResult(_0x36af03,null))['catch'](handleError(_0x36af03,null));};exports[_0x07a2('0x47')]=function(_0x4c39d3,_0x445ac2){return db[_0x07a2('0x2b')][_0x07a2('0x47')](_0x4c39d3['body'],{})[_0x07a2('0x24')](function(_0x299517){var _0x46c58c=_0x4c39d3['user']['get']({'plain':!![]});if(!_0x46c58c)throw new Error(_0x07a2('0x48'));if(_0x46c58c[_0x07a2('0x49')]===_0x07a2('0x4a')){var _0xdcbbb7=_0x299517[_0x07a2('0x25')]({'plain':!![]});var _0x21e7d2=_0x07a2('0x4b');return db[_0x07a2('0x4c')]['find']({'where':{'name':_0x21e7d2,'userProfileId':_0x46c58c['userProfileId']},'raw':!![]})[_0x07a2('0x24')](function(_0x231509){if(_0x231509&&_0x231509[_0x07a2('0x4d')]===0x0){return db[_0x07a2('0x26')][_0x07a2('0x47')]({'name':_0xdcbbb7[_0x07a2('0x29')],'resourceId':_0xdcbbb7['id'],'type':_0x231509['name'],'sectionId':_0x231509['id']},{})[_0x07a2('0x24')](function(){return _0x299517;});}else{return _0x299517;}})[_0x07a2('0x43')](function(_0x4e4b14){logger['error'](_0x07a2('0x4e'),_0x4e4b14);throw _0x4e4b14;});}return _0x299517;})[_0x07a2('0x24')](respondWithResult(_0x445ac2,0xc9))[_0x07a2('0x43')](handleError(_0x445ac2,null));};exports[_0x07a2('0x22')]=function(_0x3fae4c,_0x5b8b68){if(_0x3fae4c[_0x07a2('0x4f')]['id']){delete _0x3fae4c['body']['id'];}return db['CmContactHasItem'][_0x07a2('0x50')]({'where':{'id':_0x3fae4c[_0x07a2('0x45')]['id']}})[_0x07a2('0x24')](handleEntityNotFound(_0x5b8b68,null))[_0x07a2('0x24')](saveUpdates(_0x3fae4c['body'],null))[_0x07a2('0x24')](respondWithResult(_0x5b8b68,null))[_0x07a2('0x43')](handleError(_0x5b8b68,null));};exports['destroy']=function(_0x56c746,_0x36d4d2){return db[_0x07a2('0x2b')]['find']({'where':{'id':_0x56c746['params']['id']}})['then'](handleEntityNotFound(_0x36d4d2,null))[_0x07a2('0x24')](removeEntity(_0x36d4d2,null))[_0x07a2('0x43')](handleError(_0x36d4d2,null));}; \ No newline at end of file +var _0x3349=['findAll','catch','show','rawAttributes','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','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','name','send','index','map','CmContactHasItem','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include'];(function(_0x4ce315,_0x388074){var _0x1a6160=function(_0x510e0d){while(--_0x510e0d){_0x4ce315['push'](_0x4ce315['shift']());}};_0x1a6160(++_0x388074);}(_0x3349,0x16e));var _0x9334=function(_0x33100a,_0x55d520){_0x33100a=_0x33100a-0x0;var _0x84faac=_0x3349[_0x33100a];return _0x84faac;};'use strict';var emlformat=require(_0x9334('0x0'));var rimraf=require(_0x9334('0x1'));var zipdir=require(_0x9334('0x2'));var jsonpatch=require(_0x9334('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9334('0x4'));var Mustache=require(_0x9334('0x5'));var util=require(_0x9334('0x6'));var path=require(_0x9334('0x7'));var sox=require(_0x9334('0x8'));var csv=require(_0x9334('0x9'));var ejs=require(_0x9334('0xa'));var fs=require('fs');var fs_extra=require(_0x9334('0xb'));var _=require(_0x9334('0xc'));var squel=require(_0x9334('0xd'));var crypto=require(_0x9334('0xe'));var jsforce=require(_0x9334('0xf'));var deskjs=require(_0x9334('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9334('0x11'));var Papa=require(_0x9334('0x12'));var Redis=require('ioredis');var authService=require(_0x9334('0x13'));var qs=require(_0x9334('0x14'));var as=require(_0x9334('0x15'));var hardwareService=require(_0x9334('0x16'));var logger=require(_0x9334('0x17'))(_0x9334('0x18'));var utils=require(_0x9334('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9334('0x1a'));var db=require(_0x9334('0x1b'))['db'];function respondWithStatusCode(_0x54dad5,_0x4afc18){_0x4afc18=_0x4afc18||0xcc;return function(_0x4c91cb){if(_0x4c91cb){return _0x54dad5[_0x9334('0x1c')](_0x4afc18);}return _0x54dad5[_0x9334('0x1d')](_0x4afc18)[_0x9334('0x1e')]();};}function respondWithResult(_0x528323,_0x227eb9){_0x227eb9=_0x227eb9||0xc8;return function(_0x18875c){if(_0x18875c){return _0x528323[_0x9334('0x1d')](_0x227eb9)['json'](_0x18875c);}};}function respondWithFilteredResult(_0x5bb800,_0x2aa20b){return function(_0xa1547f){if(_0xa1547f){var _0x3d06f2=typeof _0x2aa20b['offset']===_0x9334('0x1f')&&typeof _0x2aa20b['limit']==='undefined';var _0x1486e8=_0xa1547f[_0x9334('0x20')];var _0x97ed1e=_0x3d06f2?0x0:_0x2aa20b[_0x9334('0x21')];var _0x1be1a1=_0x3d06f2?_0xa1547f[_0x9334('0x20')]:_0x2aa20b['offset']+_0x2aa20b[_0x9334('0x22')];var _0x3b33f1;if(_0x1be1a1>=_0x1486e8){_0x1be1a1=_0x1486e8;_0x3b33f1=0xc8;}else{_0x3b33f1=0xce;}_0x5bb800['status'](_0x3b33f1);return _0x5bb800[_0x9334('0x23')]('Content-Range',_0x97ed1e+'-'+_0x1be1a1+'/'+_0x1486e8)[_0x9334('0x24')](_0xa1547f);}return null;};}function patchUpdates(_0x24d898){return function(_0x448def){try{jsonpatch['apply'](_0x448def,_0x24d898,!![]);}catch(_0x140285){return BPromise[_0x9334('0x25')](_0x140285);}return _0x448def[_0x9334('0x26')]();};}function saveUpdates(_0x3cdf0c,_0x20ccb7){return function(_0x642ba8){if(_0x642ba8){return _0x642ba8[_0x9334('0x27')](_0x3cdf0c)[_0x9334('0x28')](function(_0x53d987){return _0x53d987;});}return null;};}function removeEntity(_0x4f655e,_0x63d92e){return function(_0x883d17){if(_0x883d17){return _0x883d17[_0x9334('0x29')]()[_0x9334('0x28')](function(){var _0x403671=_0x883d17['get']({'plain':!![]});var _0x5a73c3=_0x9334('0x2a');return db[_0x9334('0x2b')][_0x9334('0x29')]({'where':{'type':_0x5a73c3,'resourceId':_0x403671['id']}})[_0x9334('0x28')](function(){return _0x883d17;});})[_0x9334('0x28')](function(){_0x4f655e['status'](0xcc)[_0x9334('0x1e')]();});}};}function handleEntityNotFound(_0x616b29,_0x47f8a5){return function(_0x4629f3){if(!_0x4629f3){_0x616b29[_0x9334('0x1c')](0x194);}return _0x4629f3;};}function handleError(_0x13149a,_0x39eff2){_0x39eff2=_0x39eff2||0x1f4;return function(_0x30386f){logger['error'](_0x30386f['stack']);if(_0x30386f[_0x9334('0x2c')]){delete _0x30386f[_0x9334('0x2c')];}_0x13149a[_0x9334('0x1d')](_0x39eff2)[_0x9334('0x2d')](_0x30386f);};}exports[_0x9334('0x2e')]=function(_0x5e16af,_0x5d8ceb){var _0x408d9a={},_0x39ebfc={},_0x19db71={'count':0x0,'rows':[]};var _0x419e60=_[_0x9334('0x2f')](db[_0x9334('0x30')]['rawAttributes'],function(_0x2971a7){return{'name':_0x2971a7[_0x9334('0x31')],'type':_0x2971a7[_0x9334('0x32')][_0x9334('0x33')]};});_0x39ebfc[_0x9334('0x34')]=_[_0x9334('0x2f')](_0x419e60,_0x9334('0x2c'));_0x39ebfc[_0x9334('0x35')]=_[_0x9334('0x36')](_0x5e16af[_0x9334('0x35')]);_0x39ebfc['filters']=_[_0x9334('0x37')](_0x39ebfc['model'],_0x39ebfc['query']);_0x408d9a[_0x9334('0x38')]=_[_0x9334('0x37')](_0x39ebfc['model'],qs[_0x9334('0x39')](_0x5e16af[_0x9334('0x35')]['fields']));_0x408d9a[_0x9334('0x38')]=_0x408d9a[_0x9334('0x38')][_0x9334('0x3a')]?_0x408d9a[_0x9334('0x38')]:_0x39ebfc['model'];if(!_0x5e16af[_0x9334('0x35')][_0x9334('0x3b')]('nolimit')){_0x408d9a[_0x9334('0x22')]=qs[_0x9334('0x22')](_0x5e16af[_0x9334('0x35')][_0x9334('0x22')]);_0x408d9a[_0x9334('0x21')]=qs['offset'](_0x5e16af[_0x9334('0x35')][_0x9334('0x21')]);}_0x408d9a[_0x9334('0x3c')]=qs[_0x9334('0x3d')](_0x5e16af[_0x9334('0x35')][_0x9334('0x3d')]);_0x408d9a[_0x9334('0x3e')]=qs[_0x9334('0x3f')](_['pick'](_0x5e16af['query'],_0x39ebfc[_0x9334('0x3f')]),_0x419e60);if(_0x5e16af[_0x9334('0x35')][_0x9334('0x40')]){_0x408d9a[_0x9334('0x3e')]=_[_0x9334('0x41')](_0x408d9a[_0x9334('0x3e')],{'$or':_[_0x9334('0x2f')](_0x419e60,function(_0x495b40){if(_0x495b40[_0x9334('0x32')]!==_0x9334('0x42')){var _0xd805c6={};_0xd805c6[_0x495b40[_0x9334('0x2c')]]={'$like':'%'+_0x5e16af[_0x9334('0x35')]['filter']+'%'};return _0xd805c6;}})});}_0x408d9a=_['merge']({},_0x408d9a,_0x5e16af['options']);var _0x1270e0={'where':_0x408d9a[_0x9334('0x3e')]};return db[_0x9334('0x30')][_0x9334('0x20')](_0x1270e0)[_0x9334('0x28')](function(_0x492d8a){_0x19db71['count']=_0x492d8a;if(_0x5e16af[_0x9334('0x35')][_0x9334('0x43')]){_0x408d9a[_0x9334('0x44')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x9334('0x45')](_0x408d9a);})[_0x9334('0x28')](function(_0x22c40c){_0x19db71['rows']=_0x22c40c;return _0x19db71;})[_0x9334('0x28')](respondWithFilteredResult(_0x5d8ceb,_0x408d9a))[_0x9334('0x46')](handleError(_0x5d8ceb,null));};exports[_0x9334('0x47')]=function(_0x1a2e17,_0x21150f){var _0x4eb952={'raw':!![],'where':{'id':_0x1a2e17['params']['id']}},_0x533389={};_0x533389[_0x9334('0x34')]=_[_0x9334('0x36')](db[_0x9334('0x30')][_0x9334('0x48')]);_0x533389['query']=_['keys'](_0x1a2e17[_0x9334('0x35')]);_0x533389[_0x9334('0x3f')]=_[_0x9334('0x37')](_0x533389[_0x9334('0x34')],_0x533389[_0x9334('0x35')]);_0x4eb952[_0x9334('0x38')]=_[_0x9334('0x37')](_0x533389[_0x9334('0x34')],qs['fields'](_0x1a2e17[_0x9334('0x35')][_0x9334('0x39')]));_0x4eb952[_0x9334('0x38')]=_0x4eb952[_0x9334('0x38')][_0x9334('0x3a')]?_0x4eb952[_0x9334('0x38')]:_0x533389[_0x9334('0x34')];if(_0x1a2e17['query'][_0x9334('0x43')]){_0x4eb952[_0x9334('0x44')]=[{'all':!![]}];}_0x4eb952=_[_0x9334('0x41')]({},_0x4eb952,_0x1a2e17[_0x9334('0x49')]);return db['CmContactHasItem'][_0x9334('0x4a')](_0x4eb952)['then'](handleEntityNotFound(_0x21150f,null))[_0x9334('0x28')](respondWithResult(_0x21150f,null))['catch'](handleError(_0x21150f,null));};exports[_0x9334('0x4b')]=function(_0x17769a,_0x235fb0){return db[_0x9334('0x30')]['create'](_0x17769a[_0x9334('0x4c')],{})[_0x9334('0x28')](function(_0x3058b0){var _0x5a5922=_0x17769a[_0x9334('0x4d')][_0x9334('0x4e')]({'plain':!![]});if(!_0x5a5922)throw new Error(_0x9334('0x4f'));if(_0x5a5922[_0x9334('0x50')]===_0x9334('0x4d')){var _0x1cb8ea=_0x3058b0[_0x9334('0x4e')]({'plain':!![]});var _0x42ac28=_0x9334('0x2a');return db[_0x9334('0x51')][_0x9334('0x4a')]({'where':{'name':_0x42ac28,'userProfileId':_0x5a5922[_0x9334('0x52')]},'raw':!![]})[_0x9334('0x28')](function(_0xc21fae){if(_0xc21fae&&_0xc21fae[_0x9334('0x53')]===0x0){return db[_0x9334('0x2b')][_0x9334('0x4b')]({'name':_0x1cb8ea[_0x9334('0x2c')],'resourceId':_0x1cb8ea['id'],'type':_0xc21fae['name'],'sectionId':_0xc21fae['id']},{})['then'](function(){return _0x3058b0;});}else{return _0x3058b0;}})[_0x9334('0x46')](function(_0x38ddef){logger[_0x9334('0x54')](_0x9334('0x55'),_0x38ddef);throw _0x38ddef;});}return _0x3058b0;})[_0x9334('0x28')](respondWithResult(_0x235fb0,0xc9))['catch'](handleError(_0x235fb0,null));};exports['update']=function(_0x5b0c4a,_0x11ef6e){if(_0x5b0c4a[_0x9334('0x4c')]['id']){delete _0x5b0c4a[_0x9334('0x4c')]['id'];}return db[_0x9334('0x30')][_0x9334('0x4a')]({'where':{'id':_0x5b0c4a[_0x9334('0x56')]['id']}})[_0x9334('0x28')](handleEntityNotFound(_0x11ef6e,null))[_0x9334('0x28')](saveUpdates(_0x5b0c4a[_0x9334('0x4c')],null))[_0x9334('0x28')](respondWithResult(_0x11ef6e,null))[_0x9334('0x46')](handleError(_0x11ef6e,null));};exports[_0x9334('0x29')]=function(_0x42d296,_0x504060){return db[_0x9334('0x30')]['find']({'where':{'id':_0x42d296[_0x9334('0x56')]['id']}})['then'](handleEntityNotFound(_0x504060,null))[_0x9334('0x28')](removeEntity(_0x504060,null))['catch'](handleError(_0x504060,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 74b64e6..d9c8753 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 _0xac0c=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x101c5f,_0x55e79d){var _0x5a30ce=function(_0x4fd099){while(--_0x4fd099){_0x101c5f['push'](_0x101c5f['shift']());}};_0x5a30ce(++_0x55e79d);}(_0xac0c,0x150));var _0xcac0=function(_0x569ebc,_0x415cde){_0x569ebc=_0x569ebc-0x0;var _0xacee87=_0xac0c[_0x569ebc];return _0xacee87;};'use strict';var _=require(_0xcac0('0x0'));var util=require(_0xcac0('0x1'));var logger=require(_0xcac0('0x2'))(_0xcac0('0x3'));var moment=require('moment');var BPromise=require(_0xcac0('0x4'));var rp=require(_0xcac0('0x5'));var fs=require('fs');var path=require(_0xcac0('0x6'));var rimraf=require('rimraf');var config=require(_0xcac0('0x7'));var attributes=require(_0xcac0('0x8'));module[_0xcac0('0x9')]=function(_0x23cc7a,_0x559522){return _0x23cc7a[_0xcac0('0xa')](_0xcac0('0xb'),attributes,{'tableName':_0xcac0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd428=['request-promise','path','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd428,0x16f));var _0x8d42=function(_0x4c1239,_0x57921a){_0x4c1239=_0x4c1239-0x0;var _0x5c843a=_0xd428[_0x4c1239];return _0x5c843a;};'use strict';var _=require(_0x8d42('0x0'));var util=require('util');var logger=require(_0x8d42('0x1'))(_0x8d42('0x2'));var moment=require(_0x8d42('0x3'));var BPromise=require(_0x8d42('0x4'));var rp=require(_0x8d42('0x5'));var fs=require('fs');var path=require(_0x8d42('0x6'));var rimraf=require('rimraf');var config=require(_0x8d42('0x7'));var attributes=require(_0x8d42('0x8'));module['exports']=function(_0x4dd359,_0x54cb0a){return _0x4dd359[_0x8d42('0x9')](_0x8d42('0xa'),attributes,{'tableName':_0x8d42('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9aa5b73..4f787de 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 _0x487b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmContactHasItem,\x20%s,\x20%s','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b42bc,_0x38d1ce){var _0x56f779=function(_0xcc120a){while(--_0xcc120a){_0x5b42bc['push'](_0x5b42bc['shift']());}};_0x56f779(++_0x38d1ce);}(_0x487b,0xa6));var _0xb487=function(_0x346fd9,_0x41a300){_0x346fd9=_0x346fd9-0x0;var _0x962f10=_0x487b[_0x346fd9];return _0x962f10;};'use strict';var _=require(_0xb487('0x0'));var util=require(_0xb487('0x1'));var moment=require('moment');var BPromise=require(_0xb487('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb487('0x3'));var db=require(_0xb487('0x4'))['db'];var utils=require(_0xb487('0x5'));var logger=require(_0xb487('0x6'))(_0xb487('0x7'));var config=require(_0xb487('0x8'));var jayson=require(_0xb487('0x9'));var client=jayson[_0xb487('0xa')][_0xb487('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45a2b4,_0x1df290,_0xf94ad2){return new BPromise(function(_0x256e3f,_0x3dc153){return client[_0xb487('0xc')](_0x45a2b4,_0xf94ad2)[_0xb487('0xd')](function(_0x4d6f0a){logger[_0xb487('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x1df290,_0xb487('0xf'));logger[_0xb487('0x10')](_0xb487('0x11'),_0x1df290,_0xb487('0xf'),JSON[_0xb487('0x12')](_0x4d6f0a));if(_0x4d6f0a[_0xb487('0x13')]){if(_0x4d6f0a[_0xb487('0x13')][_0xb487('0x14')]===0x1f4){logger[_0xb487('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x1df290,_0x4d6f0a['error'][_0xb487('0x15')]);return _0x3dc153(_0x4d6f0a[_0xb487('0x13')][_0xb487('0x15')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x1df290,_0x4d6f0a[_0xb487('0x13')][_0xb487('0x15')]);return _0x256e3f(_0x4d6f0a[_0xb487('0x13')][_0xb487('0x15')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x1df290,_0xb487('0xf'));_0x256e3f(_0x4d6f0a[_0xb487('0x16')]['message']);}})[_0xb487('0x17')](function(_0x9c0e5e){logger['error'](_0xb487('0x18'),_0x1df290,_0x9c0e5e);_0x3dc153(_0x9c0e5e);});});} \ No newline at end of file +var _0x18da=['code','CmContactHasItem,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x321c3b,_0x112314){var _0x272a7d=function(_0xb0ec4d){while(--_0xb0ec4d){_0x321c3b['push'](_0x321c3b['shift']());}};_0x272a7d(++_0x112314);}(_0x18da,0x126));var _0xa18d=function(_0x485a5d,_0x4f346b){_0x485a5d=_0x485a5d-0x0;var _0xd13bf5=_0x18da[_0x485a5d];return _0xd13bf5;};'use strict';var _=require(_0xa18d('0x0'));var util=require(_0xa18d('0x1'));var moment=require(_0xa18d('0x2'));var BPromise=require(_0xa18d('0x3'));var rs=require(_0xa18d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa18d('0x5'))['db'];var utils=require(_0xa18d('0x6'));var logger=require('../../config/logger')(_0xa18d('0x7'));var config=require(_0xa18d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa18d('0x9')][_0xa18d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5da5bf,_0x29cda8,_0xe54b06){return new BPromise(function(_0x27df54,_0x484665){return client[_0xa18d('0xb')](_0x5da5bf,_0xe54b06)[_0xa18d('0xc')](function(_0xbc440a){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x29cda8,'request\x20sent');logger[_0xa18d('0xd')](_0xa18d('0xe'),_0x29cda8,_0xa18d('0xf'),JSON[_0xa18d('0x10')](_0xbc440a));if(_0xbc440a[_0xa18d('0x11')]){if(_0xbc440a['error'][_0xa18d('0x12')]===0x1f4){logger['error'](_0xa18d('0x13'),_0x29cda8,_0xbc440a[_0xa18d('0x11')][_0xa18d('0x14')]);return _0x484665(_0xbc440a[_0xa18d('0x11')][_0xa18d('0x14')]);}logger[_0xa18d('0x11')](_0xa18d('0x13'),_0x29cda8,_0xbc440a['error'][_0xa18d('0x14')]);return _0x27df54(_0xbc440a[_0xa18d('0x11')][_0xa18d('0x14')]);}else{logger[_0xa18d('0x15')](_0xa18d('0x13'),_0x29cda8,'request\x20sent');_0x27df54(_0xbc440a[_0xa18d('0x16')]['message']);}})[_0xa18d('0x17')](function(_0x4a8f3a){logger[_0xa18d('0x11')](_0xa18d('0x13'),_0x29cda8,_0x4a8f3a);_0x484665(_0x4a8f3a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8e860a7..005a2c4 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 _0x0fd9=['./cmContactHasItem.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x181012,_0x47541f){var _0x377af3=function(_0x1ad6f9){while(--_0x1ad6f9){_0x181012['push'](_0x181012['shift']());}};_0x377af3(++_0x47541f);}(_0x0fd9,0xa3));var _0x90fd=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x0fd9[_0x100682];return _0xcb6e87;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0xb')]('/',auth[_0x90fd('0x9')](),controller['create']);router[_0x90fd('0xc')](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xd')]);router[_0x90fd('0xe')](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xf')]);module[_0x90fd('0x10')]=router; \ No newline at end of file +var _0xf0c3=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x2782b1,_0x1f93f4){var _0x98e50a=function(_0x1c8d04){while(--_0x1c8d04){_0x2782b1['push'](_0x2782b1['shift']());}};_0x98e50a(++_0x1f93f4);}(_0xf0c3,0x104));var _0x3f0c=function(_0x1f4c8a,_0x2460d2){_0x1f4c8a=_0x1f4c8a-0x0;var _0x1de3c1=_0xf0c3[_0x1f4c8a];return _0x1de3c1;};'use strict';var multer=require(_0x3f0c('0x0'));var util=require(_0x3f0c('0x1'));var path=require('path');var timeout=require(_0x3f0c('0x2'));var express=require(_0x3f0c('0x3'));var router=express[_0x3f0c('0x4')]();var fs_extra=require(_0x3f0c('0x5'));var auth=require(_0x3f0c('0x6'));var interaction=require(_0x3f0c('0x7'));var config=require(_0x3f0c('0x8'));var controller=require(_0x3f0c('0x9'));router[_0x3f0c('0xa')]('/',auth[_0x3f0c('0xb')](),controller['index']);router[_0x3f0c('0xa')](_0x3f0c('0xc'),auth['isAuthenticated'](),controller[_0x3f0c('0xd')]);router[_0x3f0c('0xe')]('/',auth[_0x3f0c('0xb')](),controller[_0x3f0c('0xf')]);router[_0x3f0c('0x10')](_0x3f0c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3f0c('0x11')](_0x3f0c('0xc'),auth[_0x3f0c('0xb')](),controller[_0x3f0c('0x12')]);module[_0x3f0c('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index dd262ea..799cc3a 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 _0x85a3=['VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports'];(function(_0x348f97,_0x40734c){var _0x4ad01c=function(_0x6ba041){while(--_0x6ba041){_0x348f97['push'](_0x348f97['shift']());}};_0x4ad01c(++_0x40734c);}(_0x85a3,0xf9));var _0x385a=function(_0x14580b,_0x5abeec){_0x14580b=_0x14580b-0x0;var _0x1eb817=_0x85a3[_0x14580b];return _0x1eb817;};'use strict';var Sequelize=require(_0x385a('0x0'));var _=require(_0x385a('0x1'));module[_0x385a('0x2')]={'name':{'type':Sequelize[_0x385a('0x3')],'get':function(_0x30e6c2){return this[_0x385a('0x4')](_0x385a('0x5'));}},'alias':{'type':Sequelize[_0x385a('0x6')],'allowNull':![],'set':function(_0x99ca88){this[_0x385a('0x7')](_0x385a('0x5'),_0x99ca88?_0x99ca88:this[_0x385a('0x4')](_0x385a('0x8')));}},'type':{'type':Sequelize[_0x385a('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x385a('0x9')](_0x385a('0xa')),'get':function(){if(this['getDataValue']('type')===_0x385a('0xb')){return JSON[_0x385a('0xc')](this['getDataValue'](_0x385a('0xd')));}else{return this['getDataValue'](_0x385a('0xd'));}},'set':function(_0x402004){if(Array[_0x385a('0xe')](_0x402004)){this[_0x385a('0x7')](_0x385a('0xd'),JSON[_0x385a('0xf')](_0x402004));}else{this['setDataValue'](_0x385a('0xd'),_0x402004);}}},'required':{'type':Sequelize[_0x385a('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x385a('0x11')]('voice')}}; \ No newline at end of file +var _0x4bea=['VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','select','parse','isArray','values','stringify','BOOLEAN','ENUM','voice','lodash'];(function(_0x525876,_0xd2e709){var _0x20a8ce=function(_0x119bc5){while(--_0x119bc5){_0x525876['push'](_0x525876['shift']());}};_0x20a8ce(++_0xd2e709);}(_0x4bea,0x197));var _0xa4be=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0x4bea[_0x37d0bc];return _0x170e60;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa4be('0x0'));module['exports']={'name':{'type':Sequelize[_0xa4be('0x1')],'get':function(_0x467cc9){return this['getDataValue'](_0xa4be('0x2'));}},'alias':{'type':Sequelize[_0xa4be('0x3')],'allowNull':![],'set':function(_0x2a0ed1){this[_0xa4be('0x4')]('alias',_0x2a0ed1?_0x2a0ed1:this[_0xa4be('0x5')](_0xa4be('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xa4be('0x7')](_0xa4be('0x8')),'get':function(){if(this[_0xa4be('0x5')]('type')===_0xa4be('0x9')){return JSON[_0xa4be('0xa')](this['getDataValue']('values'));}else{return this['getDataValue']('values');}},'set':function(_0x30b9d7){if(Array[_0xa4be('0xb')](_0x30b9d7)){this[_0xa4be('0x4')](_0xa4be('0xc'),JSON[_0xa4be('0xd')](_0x30b9d7));}else{this[_0xa4be('0x4')](_0xa4be('0xc'),_0x30b9d7);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa4be('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa4be('0xf')](_0xa4be('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 967d2f1..06f03fa 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 _0x16e9=['sort','where','pick','filter','merge','options','CmCustomField','include','findAll','rows','catch','show','params','length','includeAll','body','find','create','transaction','TEXT','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','cf_%d','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x3b64f1,_0xd259c9){var _0x3d3a24=function(_0x18d120){while(--_0x18d120){_0x3b64f1['push'](_0x3b64f1['shift']());}};_0x3d3a24(++_0xd259c9);}(_0x16e9,0x155));var _0x916e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x916e('0x0'));var rp=require(_0x916e('0x1'));var moment=require(_0x916e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x916e('0x3'));var path=require(_0x916e('0x4'));var sox=require(_0x916e('0x5'));var csv=require(_0x916e('0x6'));var ejs=require(_0x916e('0x7'));var fs=require('fs');var fs_extra=require(_0x916e('0x8'));var _=require(_0x916e('0x9'));var squel=require(_0x916e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x916e('0x6'));var querystring=require('querystring');var Papa=require(_0x916e('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x916e('0xc'));var as=require(_0x916e('0xd'));var hardwareService=require(_0x916e('0xe'));var logger=require(_0x916e('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x916e('0x10'));var licenseUtil=require(_0x916e('0x11'));var db=require(_0x916e('0x12'))['db'];function respondWithStatusCode(_0x7debc2,_0x2bbdba){_0x2bbdba=_0x2bbdba||0xcc;return function(_0x1c77bb){if(_0x1c77bb){return _0x7debc2[_0x916e('0x13')](_0x2bbdba);}return _0x7debc2[_0x916e('0x14')](_0x2bbdba)[_0x916e('0x15')]();};}function respondWithResult(_0x20f7fe,_0x3d3ea6){_0x3d3ea6=_0x3d3ea6||0xc8;return function(_0x9a312b){if(_0x9a312b){return _0x20f7fe[_0x916e('0x14')](_0x3d3ea6)['json'](_0x9a312b);}};}function respondWithFilteredResult(_0x11d490,_0x59f413){return function(_0x3ff910){if(_0x3ff910){var _0x467575=typeof _0x59f413[_0x916e('0x16')]==='undefined'&&typeof _0x59f413['limit']===_0x916e('0x17');var _0x181df2=_0x3ff910[_0x916e('0x18')];var _0x2133b0=_0x467575?0x0:_0x59f413[_0x916e('0x16')];var _0x185fbf=_0x467575?_0x3ff910[_0x916e('0x18')]:_0x59f413[_0x916e('0x16')]+_0x59f413['limit'];var _0x5a65a7;if(_0x185fbf>=_0x181df2){_0x185fbf=_0x181df2;_0x5a65a7=0xc8;}else{_0x5a65a7=0xce;}_0x11d490['status'](_0x5a65a7);return _0x11d490[_0x916e('0x19')](_0x916e('0x1a'),_0x2133b0+'-'+_0x185fbf+'/'+_0x181df2)['json'](_0x3ff910);}return null;};}function patchUpdates(_0x3d55e1){return function(_0x555cac){try{jsonpatch[_0x916e('0x1b')](_0x555cac,_0x3d55e1,!![]);}catch(_0xb823c5){return BPromise[_0x916e('0x1c')](_0xb823c5);}return _0x555cac[_0x916e('0x1d')]();};}function saveUpdates(_0x2ad5a0,_0x37c088){return function(_0x3f5d49){if(_0x3f5d49){return _0x3f5d49[_0x916e('0x1e')](_0x2ad5a0)[_0x916e('0x1f')](function(_0x366667){return _0x366667;});}return null;};}function removeEntity(_0x1664db,_0x43df5c){return function(_0x3c7851){if(_0x3c7851){return _0x3c7851[_0x916e('0x20')]()[_0x916e('0x1f')](function(){_0x1664db[_0x916e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d28e,_0x5a00b2){return function(_0x2f72e9){if(!_0x2f72e9){_0x15d28e[_0x916e('0x13')](0x194);}return _0x2f72e9;};}function handleError(_0xe542c9,_0x4a10b5){_0x4a10b5=_0x4a10b5||0x1f4;return function(_0x2422f1){logger['error'](_0x2422f1['stack']);if(_0x2422f1[_0x916e('0x21')]){delete _0x2422f1[_0x916e('0x21')];}_0xe542c9[_0x916e('0x14')](_0x4a10b5)['send'](_0x2422f1);};}exports[_0x916e('0x22')]=function(_0xbe375e,_0xc17566){var _0x1a8b9b={},_0xc2cd60={},_0x3cc152={'count':0x0,'rows':[]};var _0x525e52=_[_0x916e('0x23')](db['CmCustomField'][_0x916e('0x24')],function(_0x3a40af){return{'name':_0x3a40af[_0x916e('0x25')],'type':_0x3a40af[_0x916e('0x26')][_0x916e('0x27')]};});_0xc2cd60[_0x916e('0x28')]=_['differenceBy'](_[_0x916e('0x23')](_0x525e52,_0x916e('0x21')),[_0x916e('0x21')]);_0xc2cd60[_0x916e('0x29')]=_[_0x916e('0x2a')](_0xbe375e[_0x916e('0x29')]);_0xc2cd60[_0x916e('0x2b')]=_[_0x916e('0x2c')](_0xc2cd60[_0x916e('0x28')],_0xc2cd60[_0x916e('0x29')]);_0x1a8b9b['attributes']=_[_0x916e('0x2c')](_0xc2cd60[_0x916e('0x28')],qs[_0x916e('0x2d')](_0xbe375e[_0x916e('0x29')][_0x916e('0x2d')]));_0x1a8b9b[_0x916e('0x2e')]=_0x1a8b9b[_0x916e('0x2e')]['length']?_0x1a8b9b[_0x916e('0x2e')]:_0xc2cd60[_0x916e('0x28')];if(!_0xbe375e[_0x916e('0x29')][_0x916e('0x2f')](_0x916e('0x30'))){_0x1a8b9b['limit']=qs['limit'](_0xbe375e['query']['limit']);_0x1a8b9b['offset']=qs[_0x916e('0x16')](_0xbe375e[_0x916e('0x29')][_0x916e('0x16')]);}_0x1a8b9b['order']=qs[_0x916e('0x31')](_0xbe375e[_0x916e('0x29')][_0x916e('0x31')]);_0x1a8b9b[_0x916e('0x32')]=qs[_0x916e('0x2b')](_[_0x916e('0x33')](_0xbe375e['query'],_0xc2cd60[_0x916e('0x2b')]),_0x525e52);if(_0xbe375e[_0x916e('0x29')][_0x916e('0x34')]){_0x1a8b9b['where']=_[_0x916e('0x35')](_0x1a8b9b[_0x916e('0x32')],{'$or':_[_0x916e('0x23')](_0x525e52,function(_0x21972b){if(_0x21972b[_0x916e('0x26')]!=='VIRTUAL'){var _0x9b3e91={};_0x9b3e91[_0x21972b['name']]={'$like':'%'+_0xbe375e['query']['filter']+'%'};return _0x9b3e91;}})});}_0x1a8b9b=_['merge']({},_0x1a8b9b,_0xbe375e[_0x916e('0x36')]);var _0x891ec5={'where':_0x1a8b9b[_0x916e('0x32')]};return db[_0x916e('0x37')]['count'](_0x891ec5)[_0x916e('0x1f')](function(_0x264777){_0x3cc152['count']=_0x264777;if(_0xbe375e[_0x916e('0x29')]['includeAll']){_0x1a8b9b[_0x916e('0x38')]=[{'all':!![]}];}return db[_0x916e('0x37')][_0x916e('0x39')](_0x1a8b9b);})['then'](function(_0x531205){_0x3cc152[_0x916e('0x3a')]=_0x531205;return _0x3cc152;})['then'](respondWithFilteredResult(_0xc17566,_0x1a8b9b))[_0x916e('0x3b')](handleError(_0xc17566,null));};exports[_0x916e('0x3c')]=function(_0x83178e,_0x17bd33){var _0x119e0d={'raw':!![],'where':{'id':_0x83178e[_0x916e('0x3d')]['id']}},_0x2e5cbc={};_0x2e5cbc['model']=_[_0x916e('0x2a')](db[_0x916e('0x37')][_0x916e('0x24')]);_0x2e5cbc[_0x916e('0x29')]=_[_0x916e('0x2a')](_0x83178e[_0x916e('0x29')]);_0x2e5cbc[_0x916e('0x2b')]=_[_0x916e('0x2c')](_0x2e5cbc[_0x916e('0x28')],_0x2e5cbc[_0x916e('0x29')]);_0x119e0d[_0x916e('0x2e')]=_['intersection'](_0x2e5cbc['model'],qs[_0x916e('0x2d')](_0x83178e[_0x916e('0x29')][_0x916e('0x2d')]));_0x119e0d[_0x916e('0x2e')]=_0x119e0d['attributes'][_0x916e('0x3e')]?_0x119e0d[_0x916e('0x2e')]:_0x2e5cbc[_0x916e('0x28')];if(_0x83178e[_0x916e('0x29')][_0x916e('0x3f')]){_0x119e0d[_0x916e('0x38')]=[{'all':!![]}];}_0x119e0d=_[_0x916e('0x35')]({},_0x119e0d,_0x83178e[_0x916e('0x36')]);return db[_0x916e('0x37')]['find'](_0x119e0d)['then'](handleEntityNotFound(_0x17bd33,null))[_0x916e('0x1f')](respondWithResult(_0x17bd33,null))[_0x916e('0x3b')](handleError(_0x17bd33,null));};exports[_0x916e('0x1e')]=function(_0x1f58a8,_0x38d3ef){if(_0x1f58a8[_0x916e('0x40')]['id']){delete _0x1f58a8['body']['id'];}return db['CmCustomField'][_0x916e('0x41')]({'where':{'id':_0x1f58a8[_0x916e('0x3d')]['id']}})[_0x916e('0x1f')](handleEntityNotFound(_0x38d3ef,null))[_0x916e('0x1f')](saveUpdates(_0x1f58a8[_0x916e('0x40')],null))[_0x916e('0x1f')](respondWithResult(_0x38d3ef,null))[_0x916e('0x3b')](handleError(_0x38d3ef,null));};exports[_0x916e('0x20')]=function(_0x494246,_0x4253db){return db[_0x916e('0x37')][_0x916e('0x41')]({'where':{'id':_0x494246[_0x916e('0x3d')]['id']}})[_0x916e('0x1f')](handleEntityNotFound(_0x4253db,null))['then'](removeEntity(_0x4253db,null))['catch'](handleError(_0x4253db,null));};exports[_0x916e('0x42')]=function(_0x1de9e2,_0x13fe4e){var _0x3071ee;return db['sequelize'][_0x916e('0x43')](function(_0x22a935){return db[_0x916e('0x37')][_0x916e('0x42')](_0x1de9e2[_0x916e('0x40')],{'transaction':_0x22a935})['then'](function(_0x48437f){_0x3071ee=_0x48437f;var _0x5a3fe9={'type':db['Sequelize'][_0x916e('0x44')],'transaction':_0x22a935};switch(_0x1de9e2[_0x916e('0x40')][_0x916e('0x26')]){case'text':_0x5a3fe9[_0x916e('0x26')]=db[_0x916e('0x45')][_0x916e('0x44')];break;case _0x916e('0x46'):_0x5a3fe9['type']=db['Sequelize'][_0x916e('0x47')];break;case _0x916e('0x48'):_0x5a3fe9['type']=db[_0x916e('0x45')]['BOOLEAN'];_0x5a3fe9[_0x916e('0x49')]=![];break;default:}return db['sequelize'][_0x916e('0x4a')]['addColumn'](_0x916e('0x4b'),util[_0x916e('0x4c')](_0x916e('0x4d'),_0x3071ee['id']),_0x5a3fe9);})[_0x916e('0x1f')](function(){return _0x3071ee;});})['then'](respondWithResult(_0x13fe4e,0xc9))[_0x916e('0x3b')](handleError(_0x13fe4e,null));}; \ No newline at end of file +var _0x1d0d=['set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmCustomField','findAll','rows','show','params','length','catch','body','find','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x343958,_0x46fa26){var _0xc1dfa4=function(_0x3d77f9){while(--_0x3d77f9){_0x343958['push'](_0x343958['shift']());}};_0xc1dfa4(++_0x46fa26);}(_0x1d0d,0x8e));var _0xd1d0=function(_0x4efd19,_0x362fbc){_0x4efd19=_0x4efd19-0x0;var _0x302751=_0x1d0d[_0x4efd19];return _0x302751;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1d0('0x0'));var zipdir=require(_0xd1d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1d0('0x2'));var moment=require(_0xd1d0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1d0('0x4'));var path=require('path');var sox=require(_0xd1d0('0x5'));var csv=require('to-csv');var ejs=require(_0xd1d0('0x6'));var fs=require('fs');var fs_extra=require(_0xd1d0('0x7'));var _=require(_0xd1d0('0x8'));var squel=require(_0xd1d0('0x9'));var crypto=require(_0xd1d0('0xa'));var jsforce=require(_0xd1d0('0xb'));var deskjs=require(_0xd1d0('0xc'));var toCsv=require(_0xd1d0('0xd'));var querystring=require('querystring');var Papa=require(_0xd1d0('0xe'));var Redis=require(_0xd1d0('0xf'));var authService=require(_0xd1d0('0x10'));var qs=require(_0xd1d0('0x11'));var as=require(_0xd1d0('0x12'));var hardwareService=require(_0xd1d0('0x13'));var logger=require(_0xd1d0('0x14'))(_0xd1d0('0x15'));var utils=require(_0xd1d0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd1d0('0x17'))['db'];function respondWithStatusCode(_0x5687c7,_0x472a95){_0x472a95=_0x472a95||0xcc;return function(_0x29b65e){if(_0x29b65e){return _0x5687c7[_0xd1d0('0x18')](_0x472a95);}return _0x5687c7[_0xd1d0('0x19')](_0x472a95)[_0xd1d0('0x1a')]();};}function respondWithResult(_0x23c20e,_0x11bd43){_0x11bd43=_0x11bd43||0xc8;return function(_0x4bc09d){if(_0x4bc09d){return _0x23c20e[_0xd1d0('0x19')](_0x11bd43)[_0xd1d0('0x1b')](_0x4bc09d);}};}function respondWithFilteredResult(_0x563d64,_0x408a53){return function(_0x4d96c5){if(_0x4d96c5){var _0x2b8e2d=typeof _0x408a53['offset']===_0xd1d0('0x1c')&&typeof _0x408a53[_0xd1d0('0x1d')]===_0xd1d0('0x1c');var _0x32f6f3=_0x4d96c5[_0xd1d0('0x1e')];var _0x502eed=_0x2b8e2d?0x0:_0x408a53[_0xd1d0('0x1f')];var _0xd5b82c=_0x2b8e2d?_0x4d96c5[_0xd1d0('0x1e')]:_0x408a53[_0xd1d0('0x1f')]+_0x408a53[_0xd1d0('0x1d')];var _0x49cdb5;if(_0xd5b82c>=_0x32f6f3){_0xd5b82c=_0x32f6f3;_0x49cdb5=0xc8;}else{_0x49cdb5=0xce;}_0x563d64[_0xd1d0('0x19')](_0x49cdb5);return _0x563d64[_0xd1d0('0x20')](_0xd1d0('0x21'),_0x502eed+'-'+_0xd5b82c+'/'+_0x32f6f3)[_0xd1d0('0x1b')](_0x4d96c5);}return null;};}function patchUpdates(_0x84c535){return function(_0x1e8d85){try{jsonpatch[_0xd1d0('0x22')](_0x1e8d85,_0x84c535,!![]);}catch(_0x29bee6){return BPromise[_0xd1d0('0x23')](_0x29bee6);}return _0x1e8d85[_0xd1d0('0x24')]();};}function saveUpdates(_0x3e5e0c,_0x52a6ba){return function(_0x34ffb8){if(_0x34ffb8){return _0x34ffb8['update'](_0x3e5e0c)['then'](function(_0x10a54f){return _0x10a54f;});}return null;};}function removeEntity(_0x16e7e8,_0x220d69){return function(_0xb40c4c){if(_0xb40c4c){return _0xb40c4c[_0xd1d0('0x25')]()[_0xd1d0('0x26')](function(){_0x16e7e8[_0xd1d0('0x19')](0xcc)[_0xd1d0('0x1a')]();});}};}function handleEntityNotFound(_0x283b2b,_0x3aa2e5){return function(_0x4e802b){if(!_0x4e802b){_0x283b2b[_0xd1d0('0x18')](0x194);}return _0x4e802b;};}function handleError(_0x3b709b,_0x30c44b){_0x30c44b=_0x30c44b||0x1f4;return function(_0xea68da){logger['error'](_0xea68da[_0xd1d0('0x27')]);if(_0xea68da[_0xd1d0('0x28')]){delete _0xea68da['name'];}_0x3b709b[_0xd1d0('0x19')](_0x30c44b)[_0xd1d0('0x29')](_0xea68da);};}exports[_0xd1d0('0x2a')]=function(_0x5d0cfd,_0x8e8903){var _0x4c6c4b={},_0x4cb5f1={},_0x298218={'count':0x0,'rows':[]};var _0x57703e=_[_0xd1d0('0x2b')](db['CmCustomField'][_0xd1d0('0x2c')],function(_0x4d8039){return{'name':_0x4d8039[_0xd1d0('0x2d')],'type':_0x4d8039[_0xd1d0('0x2e')][_0xd1d0('0x2f')]};});_0x4cb5f1[_0xd1d0('0x30')]=_[_0xd1d0('0x31')](_['map'](_0x57703e,'name'),[_0xd1d0('0x28')]);_0x4cb5f1[_0xd1d0('0x32')]=_[_0xd1d0('0x33')](_0x5d0cfd[_0xd1d0('0x32')]);_0x4cb5f1[_0xd1d0('0x34')]=_[_0xd1d0('0x35')](_0x4cb5f1['model'],_0x4cb5f1[_0xd1d0('0x32')]);_0x4c6c4b[_0xd1d0('0x36')]=_[_0xd1d0('0x35')](_0x4cb5f1[_0xd1d0('0x30')],qs[_0xd1d0('0x37')](_0x5d0cfd[_0xd1d0('0x32')]['fields']));_0x4c6c4b[_0xd1d0('0x36')]=_0x4c6c4b[_0xd1d0('0x36')]['length']?_0x4c6c4b[_0xd1d0('0x36')]:_0x4cb5f1[_0xd1d0('0x30')];if(!_0x5d0cfd['query'][_0xd1d0('0x38')]('nolimit')){_0x4c6c4b[_0xd1d0('0x1d')]=qs[_0xd1d0('0x1d')](_0x5d0cfd[_0xd1d0('0x32')][_0xd1d0('0x1d')]);_0x4c6c4b[_0xd1d0('0x1f')]=qs['offset'](_0x5d0cfd[_0xd1d0('0x32')][_0xd1d0('0x1f')]);}_0x4c6c4b['order']=qs['sort'](_0x5d0cfd[_0xd1d0('0x32')]['sort']);_0x4c6c4b[_0xd1d0('0x39')]=qs['filters'](_[_0xd1d0('0x3a')](_0x5d0cfd['query'],_0x4cb5f1[_0xd1d0('0x34')]),_0x57703e);if(_0x5d0cfd[_0xd1d0('0x32')][_0xd1d0('0x3b')]){_0x4c6c4b[_0xd1d0('0x39')]=_[_0xd1d0('0x3c')](_0x4c6c4b[_0xd1d0('0x39')],{'$or':_[_0xd1d0('0x2b')](_0x57703e,function(_0x214b1b){if(_0x214b1b[_0xd1d0('0x2e')]!==_0xd1d0('0x3d')){var _0xc4f89={};_0xc4f89[_0x214b1b[_0xd1d0('0x28')]]={'$like':'%'+_0x5d0cfd['query']['filter']+'%'};return _0xc4f89;}})});}_0x4c6c4b=_[_0xd1d0('0x3c')]({},_0x4c6c4b,_0x5d0cfd[_0xd1d0('0x3e')]);var _0x59add9={'where':_0x4c6c4b[_0xd1d0('0x39')]};return db['CmCustomField'][_0xd1d0('0x1e')](_0x59add9)['then'](function(_0x17b62f){_0x298218[_0xd1d0('0x1e')]=_0x17b62f;if(_0x5d0cfd['query'][_0xd1d0('0x3f')]){_0x4c6c4b[_0xd1d0('0x40')]=[{'all':!![]}];}return db[_0xd1d0('0x41')][_0xd1d0('0x42')](_0x4c6c4b);})[_0xd1d0('0x26')](function(_0x31f5f9){_0x298218[_0xd1d0('0x43')]=_0x31f5f9;return _0x298218;})[_0xd1d0('0x26')](respondWithFilteredResult(_0x8e8903,_0x4c6c4b))['catch'](handleError(_0x8e8903,null));};exports[_0xd1d0('0x44')]=function(_0x4c5bae,_0x4e689f){var _0x2f30a5={'raw':!![],'where':{'id':_0x4c5bae[_0xd1d0('0x45')]['id']}},_0x33c3ce={};_0x33c3ce[_0xd1d0('0x30')]=_[_0xd1d0('0x33')](db[_0xd1d0('0x41')][_0xd1d0('0x2c')]);_0x33c3ce[_0xd1d0('0x32')]=_[_0xd1d0('0x33')](_0x4c5bae[_0xd1d0('0x32')]);_0x33c3ce[_0xd1d0('0x34')]=_[_0xd1d0('0x35')](_0x33c3ce[_0xd1d0('0x30')],_0x33c3ce[_0xd1d0('0x32')]);_0x2f30a5['attributes']=_['intersection'](_0x33c3ce[_0xd1d0('0x30')],qs[_0xd1d0('0x37')](_0x4c5bae['query'][_0xd1d0('0x37')]));_0x2f30a5['attributes']=_0x2f30a5[_0xd1d0('0x36')][_0xd1d0('0x46')]?_0x2f30a5[_0xd1d0('0x36')]:_0x33c3ce[_0xd1d0('0x30')];if(_0x4c5bae[_0xd1d0('0x32')]['includeAll']){_0x2f30a5[_0xd1d0('0x40')]=[{'all':!![]}];}_0x2f30a5=_['merge']({},_0x2f30a5,_0x4c5bae[_0xd1d0('0x3e')]);return db[_0xd1d0('0x41')]['find'](_0x2f30a5)[_0xd1d0('0x26')](handleEntityNotFound(_0x4e689f,null))[_0xd1d0('0x26')](respondWithResult(_0x4e689f,null))[_0xd1d0('0x47')](handleError(_0x4e689f,null));};exports['update']=function(_0x396f88,_0x4fe260){if(_0x396f88[_0xd1d0('0x48')]['id']){delete _0x396f88[_0xd1d0('0x48')]['id'];}return db[_0xd1d0('0x41')]['find']({'where':{'id':_0x396f88[_0xd1d0('0x45')]['id']}})[_0xd1d0('0x26')](handleEntityNotFound(_0x4fe260,null))[_0xd1d0('0x26')](saveUpdates(_0x396f88[_0xd1d0('0x48')],null))[_0xd1d0('0x26')](respondWithResult(_0x4fe260,null))[_0xd1d0('0x47')](handleError(_0x4fe260,null));};exports[_0xd1d0('0x25')]=function(_0xa69b63,_0xb74cb8){return db['CmCustomField'][_0xd1d0('0x49')]({'where':{'id':_0xa69b63[_0xd1d0('0x45')]['id']}})[_0xd1d0('0x26')](handleEntityNotFound(_0xb74cb8,null))[_0xd1d0('0x26')](removeEntity(_0xb74cb8,null))[_0xd1d0('0x47')](handleError(_0xb74cb8,null));};exports[_0xd1d0('0x4a')]=function(_0x47c507,_0x312e55){var _0x157edf;return db[_0xd1d0('0x4b')]['transaction'](function(_0x309b7c){return db[_0xd1d0('0x41')][_0xd1d0('0x4a')](_0x47c507[_0xd1d0('0x48')],{'transaction':_0x309b7c})[_0xd1d0('0x26')](function(_0xaee0){_0x157edf=_0xaee0;var _0x4e466e={'type':db[_0xd1d0('0x4c')][_0xd1d0('0x4d')],'transaction':_0x309b7c};switch(_0x47c507['body'][_0xd1d0('0x2e')]){case _0xd1d0('0x4e'):_0x4e466e[_0xd1d0('0x2e')]=db['Sequelize']['TEXT'];break;case _0xd1d0('0x4f'):_0x4e466e['type']=db[_0xd1d0('0x4c')][_0xd1d0('0x50')];break;case _0xd1d0('0x51'):_0x4e466e[_0xd1d0('0x2e')]=db['Sequelize']['BOOLEAN'];_0x4e466e[_0xd1d0('0x52')]=![];break;default:}return db[_0xd1d0('0x4b')][_0xd1d0('0x53')][_0xd1d0('0x54')](_0xd1d0('0x55'),util[_0xd1d0('0x56')]('cf_%d',_0x157edf['id']),_0x4e466e);})[_0xd1d0('0x26')](function(){return _0x157edf;});})[_0xd1d0('0x26')](respondWithResult(_0x312e55,0xc9))[_0xd1d0('0x47')](handleError(_0x312e55,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 64b0f88..76e17e0 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 _0xd666=['define','cm_custom_fields','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports'];(function(_0xc0e66,_0x5e8e32){var _0xfe7ea6=function(_0x1bdbc7){while(--_0x1bdbc7){_0xc0e66['push'](_0xc0e66['shift']());}};_0xfe7ea6(++_0x5e8e32);}(_0xd666,0x91));var _0x6d66=function(_0x47d493,_0x3bedfb){_0x47d493=_0x47d493-0x0;var _0x50242a=_0xd666[_0x47d493];return _0x50242a;};'use strict';var _=require('lodash');var util=require(_0x6d66('0x0'));var logger=require(_0x6d66('0x1'))('api');var moment=require(_0x6d66('0x2'));var BPromise=require(_0x6d66('0x3'));var rp=require(_0x6d66('0x4'));var fs=require('fs');var path=require(_0x6d66('0x5'));var rimraf=require('rimraf');var config=require(_0x6d66('0x6'));var attributes=require(_0x6d66('0x7'));module[_0x6d66('0x8')]=function(_0x342195,_0x5e0429){return _0x342195[_0x6d66('0x9')]('CmCustomField',attributes,{'tableName':_0x6d66('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d06=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3733b0,_0x24b422){var _0x20dd14=function(_0x112672){while(--_0x112672){_0x3733b0['push'](_0x3733b0['shift']());}};_0x20dd14(++_0x24b422);}(_0x6d06,0x16a));var _0x66d0=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x6d06[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x66d0('0x0'));var util=require(_0x66d0('0x1'));var logger=require(_0x66d0('0x2'))('api');var moment=require(_0x66d0('0x3'));var BPromise=require(_0x66d0('0x4'));var rp=require(_0x66d0('0x5'));var fs=require('fs');var path=require(_0x66d0('0x6'));var rimraf=require(_0x66d0('0x7'));var config=require(_0x66d0('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x66d0('0x9')]=function(_0x18297b,_0xb84d64){return _0x18297b['define'](_0x66d0('0xa'),attributes,{'tableName':_0x66d0('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index f1463a6..a4c97ad 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 _0xfa45=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xfa45,0x1d3));var _0x5fa4=function(_0x520095,_0x4d4e76){_0x520095=_0x520095-0x0;var _0x3dd683=_0xfa45[_0x520095];return _0x3dd683;};'use strict';var _=require(_0x5fa4('0x0'));var util=require('util');var moment=require(_0x5fa4('0x1'));var BPromise=require(_0x5fa4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fa4('0x3'));var db=require(_0x5fa4('0x4'))['db'];var utils=require(_0x5fa4('0x5'));var logger=require('../../config/logger')(_0x5fa4('0x6'));var config=require(_0x5fa4('0x7'));var jayson=require(_0x5fa4('0x8'));var client=jayson[_0x5fa4('0x9')][_0x5fa4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x560678,_0x417ed0,_0x161e32){return new BPromise(function(_0x42f74d,_0x3b3712){return client[_0x5fa4('0xb')](_0x560678,_0x161e32)[_0x5fa4('0xc')](function(_0x2408d1){logger[_0x5fa4('0xd')](_0x5fa4('0xe'),_0x417ed0,_0x5fa4('0xf'));logger[_0x5fa4('0x10')](_0x5fa4('0x11'),_0x417ed0,_0x5fa4('0xf'),JSON['stringify'](_0x2408d1));if(_0x2408d1[_0x5fa4('0x12')]){if(_0x2408d1[_0x5fa4('0x12')][_0x5fa4('0x13')]===0x1f4){logger[_0x5fa4('0x12')](_0x5fa4('0xe'),_0x417ed0,_0x2408d1['error']['message']);return _0x3b3712(_0x2408d1[_0x5fa4('0x12')][_0x5fa4('0x14')]);}logger['error'](_0x5fa4('0xe'),_0x417ed0,_0x2408d1[_0x5fa4('0x12')][_0x5fa4('0x14')]);return _0x42f74d(_0x2408d1[_0x5fa4('0x12')][_0x5fa4('0x14')]);}else{logger['info'](_0x5fa4('0xe'),_0x417ed0,'request\x20sent');_0x42f74d(_0x2408d1[_0x5fa4('0x15')][_0x5fa4('0x14')]);}})[_0x5fa4('0x16')](function(_0x389480){logger[_0x5fa4('0x12')](_0x5fa4('0xe'),_0x417ed0,_0x389480);_0x3b3712(_0x389480);});});} \ No newline at end of file +var _0x8d36=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x8d36,0x1e0));var _0x68d3=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0x8d36[_0x2d2498];return _0x447a5b;};'use strict';var _=require(_0x68d3('0x0'));var util=require(_0x68d3('0x1'));var moment=require(_0x68d3('0x2'));var BPromise=require(_0x68d3('0x3'));var rs=require(_0x68d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x68d3('0x5'));var logger=require('../../config/logger')(_0x68d3('0x6'));var config=require(_0x68d3('0x7'));var jayson=require(_0x68d3('0x8'));var client=jayson[_0x68d3('0x9')][_0x68d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x109952,_0x1e7cb8,_0x2b9fa0){return new BPromise(function(_0x438cb0,_0x5b9f8a){return client['request'](_0x109952,_0x2b9fa0)['then'](function(_0x29cb1e){logger[_0x68d3('0xb')](_0x68d3('0xc'),_0x1e7cb8,_0x68d3('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1e7cb8,'request\x20sent',JSON['stringify'](_0x29cb1e));if(_0x29cb1e[_0x68d3('0xe')]){if(_0x29cb1e['error'][_0x68d3('0xf')]===0x1f4){logger['error'](_0x68d3('0xc'),_0x1e7cb8,_0x29cb1e['error'][_0x68d3('0x10')]);return _0x5b9f8a(_0x29cb1e['error'][_0x68d3('0x10')]);}logger[_0x68d3('0xe')](_0x68d3('0xc'),_0x1e7cb8,_0x29cb1e[_0x68d3('0xe')][_0x68d3('0x10')]);return _0x438cb0(_0x29cb1e[_0x68d3('0xe')][_0x68d3('0x10')]);}else{logger[_0x68d3('0xb')]('CmCustomField,\x20%s,\x20%s',_0x1e7cb8,_0x68d3('0xd'));_0x438cb0(_0x29cb1e[_0x68d3('0x11')]['message']);}})[_0x68d3('0x12')](function(_0x10062d){logger[_0x68d3('0xe')]('CmCustomField,\x20%s,\x20%s',_0x1e7cb8,_0x10062d);_0x5b9f8a(_0x10062d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 59273e8..e53d447 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 _0xb7a7=['isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x200b6f,_0x2e6fc1){var _0x1769a2=function(_0x4d36c0){while(--_0x4d36c0){_0x200b6f['push'](_0x200b6f['shift']());}};_0x1769a2(++_0x2e6fc1);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x114b69,_0x13bf5b){_0x114b69=_0x114b69-0x0;var _0x59ae61=_0xb7a7[_0x114b69];return _0x59ae61;};'use strict';var multer=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var path=require(_0x7b7a('0x2'));var timeout=require(_0x7b7a('0x3'));var express=require(_0x7b7a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7b7a('0x5'));var interaction=require(_0x7b7a('0x6'));var config=require(_0x7b7a('0x7'));var controller=require('./cmCustomField.controller');router[_0x7b7a('0x8')]('/',auth[_0x7b7a('0x9')](),controller[_0x7b7a('0xa')]);router[_0x7b7a('0x8')](_0x7b7a('0xb'),auth[_0x7b7a('0x9')](),controller[_0x7b7a('0xc')]);router[_0x7b7a('0xd')]('/',auth[_0x7b7a('0x9')](),controller['create']);router[_0x7b7a('0xe')]('/:id',auth[_0x7b7a('0x9')](),controller[_0x7b7a('0xf')]);router[_0x7b7a('0x10')](_0x7b7a('0xb'),auth[_0x7b7a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x96f1=['express','Router','fs-extra','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index','show','post','put','delete','multer','util','path','connect-timeout'];(function(_0x1a504e,_0x29b86b){var _0x2fbbde=function(_0x690728){while(--_0x690728){_0x1a504e['push'](_0x1a504e['shift']());}};_0x2fbbde(++_0x29b86b);}(_0x96f1,0x19c));var _0x196f=function(_0x1afc28,_0xa70ec4){_0x1afc28=_0x1afc28-0x0;var _0x2fa5c3=_0x96f1[_0x1afc28];return _0x2fa5c3;};'use strict';var multer=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var path=require(_0x196f('0x2'));var timeout=require(_0x196f('0x3'));var express=require(_0x196f('0x4'));var router=express[_0x196f('0x5')]();var fs_extra=require(_0x196f('0x6'));var auth=require(_0x196f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x196f('0x8'));router[_0x196f('0x9')]('/',auth[_0x196f('0xa')](),controller[_0x196f('0xb')]);router[_0x196f('0x9')]('/:id',auth[_0x196f('0xa')](),controller[_0x196f('0xc')]);router[_0x196f('0xd')]('/',auth[_0x196f('0xa')](),controller['create']);router[_0x196f('0xe')]('/:id',auth[_0x196f('0xa')](),controller['update']);router[_0x196f('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c9190c0..2112748 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 _0x8260=['UNSIGNED','contactListQueue','sequelize','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE'];(function(_0x3116c9,_0x1db034){var _0x2ca671=function(_0x24dae4){while(--_0x24dae4){_0x3116c9['push'](_0x3116c9['shift']());}};_0x2ca671(++_0x1db034);}(_0x8260,0xb6));var _0x0826=function(_0x4eb8e1,_0x52fb85){_0x4eb8e1=_0x4eb8e1-0x0;var _0x3a9f0a=_0x8260[_0x4eb8e1];return _0x3a9f0a;};'use strict';var moment=require('moment');var Sequelize=require(_0x0826('0x0'));module[_0x0826('0x1')]={'phone':{'type':Sequelize[_0x0826('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0826('0x3')](_0x0826('0x4'))},'countbusyretry':{'type':Sequelize[_0x0826('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0826('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0826('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0826('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0826('0x7')]},'priority':{'type':Sequelize[_0x0826('0x5')](0x2)[_0x0826('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0826('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0826('0x5')],'unique':_0x0826('0x9')},'ListId':{'type':Sequelize[_0x0826('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x0826('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x0826('0x5')],'unique':_0x0826('0x9')},'CampaignId':{'type':Sequelize[_0x0826('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0826('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0826('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0826('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x0826('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7590=['contactListQueue','DATE','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7590,0xf4));var _0x0759=function(_0x45a4e0,_0x345f4d){_0x45a4e0=_0x45a4e0-0x0;var _0x43f49d=_0x7590[_0x45a4e0];return _0x43f49d;};'use strict';var moment=require(_0x0759('0x0'));var Sequelize=require(_0x0759('0x1'));module[_0x0759('0x2')]={'phone':{'type':Sequelize[_0x0759('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x0759('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0759('0x5')](_0x0759('0x6'))},'countbusyretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0759('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0759('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x0759('0x7')](0x2)[_0x0759('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0759('0x7')],'unique':_0x0759('0x9')},'ListId':{'type':Sequelize[_0x0759('0x7')],'unique':_0x0759('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x0759('0x9')},'CampaignId':{'type':Sequelize[_0x0759('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0759('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0759('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0759('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x0759('0xa')],'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 0386672..5ec2c99 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 _0xb205=['$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$like','$overlap','$any','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','CmHopper','intersection','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','deleted','campaign','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','lastName','isNil','calleridname','firstName','finally','end','getPreview','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','Contact','getOpenContacts','getVoiceQueues','outbound','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','status','offset','undefined','count','set','update','then','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','concat','filters','$and','$or','$gt','$gte'];(function(_0x5cf387,_0x5dda9b){var _0x41b63f=function(_0x4a0695){while(--_0x4a0695){_0x5cf387['push'](_0x5cf387['shift']());}};_0x41b63f(++_0x5dda9b);}(_0xb205,0xf0));var _0x5b20=function(_0x540edd,_0xd168fd){_0x540edd=_0x540edd-0x0;var _0x1972eb=_0xb205[_0x540edd];return _0x1972eb;};'use strict';var moment=require(_0x5b20('0x0'));var _=require(_0x5b20('0x1'));var qs=require(_0x5b20('0x2'));var logger=require(_0x5b20('0x3'))(_0x5b20('0x4'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x37fe91,_0x573200){_0x573200=_0x573200||0xc8;return function(_0x17046a){if(_0x17046a){return _0x37fe91[_0x5b20('0x5')](_0x573200)['json'](_0x17046a);}};}function respondWithFilteredResult(_0x3206cd,_0x29d926){return function(_0x364e48){if(_0x364e48){var _0x5c1ff9=typeof _0x29d926[_0x5b20('0x6')]===_0x5b20('0x7')&&typeof _0x29d926['limit']==='undefined';var _0x2b5b5f=_0x364e48[_0x5b20('0x8')];var _0x36ef1b=_0x5c1ff9?0x0:_0x29d926[_0x5b20('0x6')];var _0xe0246d=_0x5c1ff9?_0x364e48[_0x5b20('0x8')]:_0x29d926[_0x5b20('0x6')]+_0x29d926['limit'];var _0xdec7cd;if(_0xe0246d>=_0x2b5b5f){_0xe0246d=_0x2b5b5f;_0xdec7cd=0xc8;}else{_0xdec7cd=0xce;}_0x3206cd[_0x5b20('0x5')](_0xdec7cd);return _0x3206cd[_0x5b20('0x9')]('Content-Range',_0x36ef1b+'-'+_0xe0246d+'/'+_0x2b5b5f)['json'](_0x364e48);}return null;};}function saveUpdates(_0x2a13ac,_0x374632){return function(_0xf721a0){if(_0xf721a0){return _0xf721a0[_0x5b20('0xa')](_0x2a13ac)[_0x5b20('0xb')](function(_0x4c76d8){return _0x4c76d8;});}return null;};}function handleEntityNotFound(_0x42fbb0,_0x32c2df){return function(_0x180185){if(!_0x180185){_0x42fbb0[_0x5b20('0xc')](0x194);}return _0x180185;};}function handleError(_0x519f9f,_0x5247f9){_0x5247f9=_0x5247f9||0x1f4;return function(_0x25b9ab){logger['error'](_0x25b9ab['stack']);if(_0x25b9ab[_0x5b20('0xd')]){delete _0x25b9ab['name'];}_0x519f9f[_0x5b20('0x5')](_0x5247f9)[_0x5b20('0xe')](_0x25b9ab);};}exports[_0x5b20('0xf')]=function(_0x498986,_0x44ac15){var _0x301c9a={},_0x3e37ef={},_0x43199f={'count':0x0,'rows':[]};var _0x4aca0f=_[_0x5b20('0x10')](db['CmHopper'][_0x5b20('0x11')],function(_0x30da3b){return{'name':_0x30da3b['fieldName'],'type':_0x30da3b[_0x5b20('0x12')][_0x5b20('0x13')]};});_0x3e37ef[_0x5b20('0x14')]=_['map'](_0x4aca0f,_0x5b20('0xd'));_0x3e37ef[_0x5b20('0x15')]=_['keys'](_0x498986[_0x5b20('0x15')]);_0x3e37ef['filters']=_['intersection'](_0x3e37ef[_0x5b20('0x14')],_0x3e37ef['query']);_0x3e37ef['filters']=_[_0x5b20('0x16')](_0x3e37ef[_0x5b20('0x17')],[_0x5b20('0x18'),_0x5b20('0x19'),_0x5b20('0x1a'),_0x5b20('0x1b'),_0x5b20('0x1c'),_0x5b20('0x1d'),'$ne',_0x5b20('0x1e'),_0x5b20('0x1f'),_0x5b20('0x20'),_0x5b20('0x21'),_0x5b20('0x22'),_0x5b20('0x23'),'$like',_0x5b20('0x24'),'$iLike',_0x5b20('0x25'),_0x5b20('0x26'),_0x5b20('0x27'),'$contains','$contained',_0x5b20('0x28')]);_0x301c9a[_0x5b20('0x29')]=_['intersection'](_0x3e37ef['model'],qs[_0x5b20('0x2a')](_0x498986['query'][_0x5b20('0x2a')]));_0x301c9a[_0x5b20('0x29')]=_0x301c9a[_0x5b20('0x29')][_0x5b20('0x2b')]?_0x301c9a['attributes']:_0x3e37ef[_0x5b20('0x14')];if(!_0x498986[_0x5b20('0x15')][_0x5b20('0x2c')](_0x5b20('0x2d'))){_0x301c9a['limit']=qs[_0x5b20('0x2e')](_0x498986[_0x5b20('0x15')][_0x5b20('0x2e')]);_0x301c9a[_0x5b20('0x6')]=qs[_0x5b20('0x6')](_0x498986[_0x5b20('0x15')][_0x5b20('0x6')]);}_0x301c9a[_0x5b20('0x2f')]=qs[_0x5b20('0x30')](_0x498986[_0x5b20('0x15')][_0x5b20('0x30')]);_0x301c9a[_0x5b20('0x31')]=qs[_0x5b20('0x17')](_[_0x5b20('0x32')](_0x498986[_0x5b20('0x15')],_0x3e37ef['filters']),_0x4aca0f);if(_0x498986['query']['filter']){_0x301c9a[_0x5b20('0x31')]=_[_0x5b20('0x33')](_0x301c9a[_0x5b20('0x31')],{'$or':_[_0x5b20('0x10')](_0x4aca0f,function(_0x5d3e95){if(_0x5d3e95['type']!==_0x5b20('0x34')){var _0x1c8ed6={};_0x1c8ed6[_0x5d3e95[_0x5b20('0xd')]]={'$like':'%'+_0x498986[_0x5b20('0x15')][_0x5b20('0x35')]+'%'};return _0x1c8ed6;}})});}_0x301c9a=_[_0x5b20('0x33')]({},_0x301c9a,_0x498986[_0x5b20('0x36')]);var _0x4f117d={'where':_0x301c9a['where']};return db['CmHopper'][_0x5b20('0x8')](_0x4f117d)[_0x5b20('0xb')](function(_0x29c731){_0x43199f[_0x5b20('0x8')]=_0x29c731;if(_0x498986[_0x5b20('0x15')][_0x5b20('0x37')]){_0x301c9a['include']=[{'all':!![]}];}return db['CmHopper'][_0x5b20('0x38')](_0x301c9a);})[_0x5b20('0xb')](function(_0x53abbf){_0x43199f[_0x5b20('0x39')]=_0x53abbf;return _0x43199f;})[_0x5b20('0xb')](respondWithFilteredResult(_0x44ac15,_0x301c9a))[_0x5b20('0x3a')](handleError(_0x44ac15,null));};exports[_0x5b20('0x3b')]=function(_0x368990,_0x1899e1){var _0x1e047b={'raw':!![],'where':{'id':_0x368990[_0x5b20('0x3c')]['id']}},_0x426ad4={};_0x426ad4[_0x5b20('0x14')]=_[_0x5b20('0x3d')](db[_0x5b20('0x3e')]['rawAttributes']);_0x426ad4[_0x5b20('0x15')]=_[_0x5b20('0x3d')](_0x368990[_0x5b20('0x15')]);_0x426ad4[_0x5b20('0x17')]=_[_0x5b20('0x3f')](_0x426ad4[_0x5b20('0x14')],_0x426ad4[_0x5b20('0x15')]);_0x1e047b[_0x5b20('0x29')]=_[_0x5b20('0x3f')](_0x426ad4[_0x5b20('0x14')],qs[_0x5b20('0x2a')](_0x368990[_0x5b20('0x15')][_0x5b20('0x2a')]));_0x1e047b[_0x5b20('0x29')]=_0x1e047b[_0x5b20('0x29')][_0x5b20('0x2b')]?_0x1e047b[_0x5b20('0x29')]:_0x426ad4[_0x5b20('0x14')];if(_0x368990[_0x5b20('0x15')][_0x5b20('0x37')]){_0x1e047b[_0x5b20('0x40')]=[{'all':!![]}];}_0x1e047b=_[_0x5b20('0x33')]({},_0x1e047b,_0x368990[_0x5b20('0x36')]);return db[_0x5b20('0x3e')][_0x5b20('0x41')](_0x1e047b)[_0x5b20('0xb')](handleEntityNotFound(_0x1899e1,null))[_0x5b20('0xb')](respondWithResult(_0x1899e1,null))['catch'](handleError(_0x1899e1,null));};exports[_0x5b20('0x42')]=function(_0x407467,_0x852527){return db[_0x5b20('0x3e')][_0x5b20('0x42')](_0x407467[_0x5b20('0x43')],{})[_0x5b20('0xb')](respondWithResult(_0x852527,0xc9))['catch'](handleError(_0x852527,null));};exports[_0x5b20('0xa')]=function(_0x2c47a6,_0x33c6d9){if(_0x2c47a6[_0x5b20('0x43')]['id']){delete _0x2c47a6[_0x5b20('0x43')]['id'];}return db[_0x5b20('0x3e')][_0x5b20('0x41')]({'where':{'id':_0x2c47a6['params']['id']}})[_0x5b20('0xb')](handleEntityNotFound(_0x33c6d9,null))[_0x5b20('0xb')](saveUpdates(_0x2c47a6['body'],null))[_0x5b20('0xb')](respondWithResult(_0x33c6d9,null))[_0x5b20('0x3a')](handleError(_0x33c6d9,null));};exports['describe']=function(_0x2b726c,_0x365af7){return db[_0x5b20('0x3e')][_0x5b20('0x44')]()[_0x5b20('0xb')](respondWithResult(_0x365af7,null))[_0x5b20('0x3a')](handleError(_0x365af7,null));};exports[_0x5b20('0x45')]=function(_0x36c204,_0x58bd13){var _0xbb6a0b;var _0x1e84ff=_0x36c204[_0x5b20('0x3c')]['id'];return db[_0x5b20('0x3e')][_0x5b20('0x41')]({'where':{'id':_0x36c204[_0x5b20('0x3c')]['id']}})['then'](handleEntityNotFound(_0x58bd13,null))[_0x5b20('0xb')](function(_0x220ff7){if(_0x220ff7){return _0x220ff7['destroy']()[_0x5b20('0xb')](function(_0x48d5f2){return _0x48d5f2;});}})[_0x5b20('0xb')](function(_0x3c224d){_0xbb6a0b=_0x3c224d;if(_0x3c224d){if(_0x3c224d[_0x5b20('0x46')]||_0x3c224d[_0x5b20('0x47')]){return db[_0x3c224d['VoiceQueueId']?_0x5b20('0x48'):_0x5b20('0x49')][_0x5b20('0x41')]({'where':{'id':_0x3c224d[_0x5b20('0x46')]?_0x3c224d[_0x5b20('0x46')]:_0x3c224d[_0x5b20('0x47')]},'attributes':['id',_0x5b20('0xd')],'raw':!![]});}}})['then'](function(_0x55fc94){var _0x2699bf={};if(_0x55fc94){_[_0x5b20('0x33')](_0x2699bf,_[_0x5b20('0x4a')](_0xbb6a0b['dataValues'],[_0x5b20('0x4b'),_0x5b20('0x4c'),'id']));_0x2699bf[_0x5b20('0x4d')]=0x15;_0x2699bf['statedesc']=_0x5b20('0x4e');_0x2699bf[_0x5b20('0x4f')]=_0x55fc94[_0x5b20('0xd')];_0x2699bf['membername']=_0x36c204[_0x5b20('0x50')]['name'];_0x2699bf[_0x5b20('0x51')]=_0x36c204[_0x5b20('0x50')]['id'];_0x2699bf[_0x5b20('0x4e')]=!![];_0x2699bf[_0x5b20('0x52')]=moment()['format'](_0x5b20('0x53'));_0x2699bf['calleridnum']=_0xbb6a0b[_0x5b20('0x54')];_0x2699bf['campaigntype']=_0xbb6a0b['VoiceQueueId']?_0x5b20('0x55'):_0x5b20('0x56');return db[_0x5b20('0x57')][_0x5b20('0x41')]({'where':{'id':_0x2699bf['ContactId']},'attributes':['firstName',_0x5b20('0x58')]})[_0x5b20('0xb')](function(_0x1cca2c){if(!_[_0x5b20('0x59')](_0x58bd13)&&!_[_0x5b20('0x59')](_0x1cca2c['firstName'])){_0x2699bf[_0x5b20('0x5a')]=_0x1cca2c[_0x5b20('0x5b')];if(!_[_0x5b20('0x59')](_0x1cca2c[_0x5b20('0x58')])){_0x2699bf[_0x5b20('0x5a')]+='\x20'+_0x1cca2c[_0x5b20('0x58')];}}})[_0x5b20('0x5c')](function(){return db['CmHopperFinal'][_0x5b20('0x42')](_0x2699bf);});}})[_0x5b20('0xb')](function(_0x2a9ca9){return db['CmHopperAdditionalPhone'][_0x5b20('0x45')]({'where':{'CmHopperId':_0x1e84ff}});})[_0x5b20('0xb')](function(){return _0x58bd13[_0x5b20('0x5')](0xcc)[_0x5b20('0x5d')]();})['catch'](handleError(_0x58bd13,null));};exports[_0x5b20('0x5e')]=function(_0x301a89,_0x404f87){var _0x290ddb=[];return db[_0x5b20('0x57')]['describe']()['then'](function(_0x4d4f17){_0x290ddb=_['keys'](_0x4d4f17);return _0x301a89['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5b20('0x5f')},'attributes':['id',_0x5b20('0x60'),_0x5b20('0x61')],'raw':!![]});})[_0x5b20('0xb')](function(_0x500a58){if(_0x500a58&&_0x500a58['length']){return db[_0x5b20('0x62')][_0x5b20('0x63')](function(_0x2db7a7){var _0xb1a217={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x5b20('0x10')](_0x500a58,'id')},'$or':[{'UserId':null},{'UserId':_0x301a89[_0x5b20('0x50')]['id']}]};var _0x42e992={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x500a58)[_0x5b20('0x35')](['dialPreviewAutoRecallMe',0x0])[_0x5b20('0x10')]('id')[_0x5b20('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x301a89['user']['id']}]};var _0xa346dc={'$or':[_0xb1a217,_0x42e992]};var _0x3015dd=[];if(_0x301a89[_0x5b20('0x43')][_0x5b20('0x65')]&&_0x301a89[_0x5b20('0x43')]['direction']===_0x5b20('0x66')){if(!_[_0x5b20('0x67')](_0x301a89[_0x5b20('0x43')][_0x5b20('0x68')])){_0xa346dc['id']={'$in':_0x301a89[_0x5b20('0x43')]['hopperIds']};}_0x3015dd=[[_0x5b20('0x69'),_0x5b20('0x6a')],[_0x5b20('0x6b'),_0x500a58[0x0][_0x5b20('0x60')]===_0x5b20('0x6a')?_0x5b20('0x6c'):_0x5b20('0x6a')],db[_0x5b20('0x62')]['literal'](_0x5b20('0x6d')),['id','DESC']];}else{if(!_['isEmpty'](_0x301a89[_0x5b20('0x43')][_0x5b20('0x68')])){_0xa346dc['id']={'$notIn':_0x301a89[_0x5b20('0x43')][_0x5b20('0x68')]};}_0x3015dd=[[_0x5b20('0x69'),_0x5b20('0x6c')],[_0x5b20('0x6b'),_0x500a58[0x0][_0x5b20('0x60')]],db[_0x5b20('0x62')][_0x5b20('0x6e')](_0x5b20('0x6f')),['id','ASC']];}return db[_0x5b20('0x3e')]['findOne']({'attributes':['id',_0x5b20('0x70'),_0x5b20('0x54'),_0x5b20('0x71')],'where':_0xa346dc,'order':_0x3015dd,'transaction':_0x2db7a7,'lock':_0x2db7a7[_0x5b20('0x72')][_0x5b20('0x73')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x290ddb,'include':[{'model':db[_0x5b20('0x74')],'as':_0x5b20('0x75'),'attributes':['id',_0x5b20('0xd')]}]},{'model':db[_0x5b20('0x76')],'as':_0x5b20('0x77'),'attributes':['id',_0x5b20('0xd')]},{'model':db[_0x5b20('0x48')],'as':_0x5b20('0x78'),'attributes':['id','name',_0x5b20('0x79')]}]})['then'](function(_0x24e77c){if(_0x24e77c){return _0x24e77c[_0x5b20('0xa')]({'UserId':_0x301a89['user']['id']},{'transaction':_0x2db7a7});}});});}})[_0x5b20('0xb')](handleEntityNotFound(_0x404f87,null))[_0x5b20('0xb')](respondWithResult(_0x404f87,null))[_0x5b20('0x3a')](handleError(_0x404f87,null));};exports[_0x5b20('0x7a')]=function(_0x360ec6,_0xaf8013,_0x2cc4b4){var _0x504968=[];var _0x279c1d=_0x360ec6['params']['id'];var _0x52fccc=_0x360ec6[_0x5b20('0x50')]['id'];return db[_0x5b20('0x57')]['describe']()[_0x5b20('0xb')](function(_0x19bc2f){_0x504968=_['keys'](_0x19bc2f);return db[_0x5b20('0x62')][_0x5b20('0x63')](function(_0x371f63){const _0xf00341={'id':_0x279c1d};return db[_0x5b20('0x3e')]['findOne']({'attributes':['id','scheduledat',_0x5b20('0x71')],'where':_0xf00341,'transaction':_0x371f63,'lock':_0x371f63[_0x5b20('0x72')][_0x5b20('0x73')],'include':[{'model':db[_0x5b20('0x57')],'as':_0x5b20('0x7b'),'attributes':_0x504968,'include':[{'model':db['CmCompany'],'as':_0x5b20('0x75'),'attributes':['id',_0x5b20('0xd')]}]},{'model':db[_0x5b20('0x76')],'as':_0x5b20('0x77'),'attributes':['id',_0x5b20('0xd')]},{'model':db[_0x5b20('0x48')],'as':_0x5b20('0x78'),'attributes':['id',_0x5b20('0xd'),_0x5b20('0x79')]}]})['then'](function(_0x2abfc5){if(_0x2abfc5){return _0x2abfc5[_0x5b20('0xa')]({'UserId':_0x52fccc},{'transaction':_0x371f63});}});});})[_0x5b20('0xb')](handleEntityNotFound(_0xaf8013,null))['then'](respondWithResult(_0xaf8013,null))['catch'](handleError(_0xaf8013,null));};exports[_0x5b20('0x7c')]=function(_0xfc7f55,_0x32c823){return _0xfc7f55[_0x5b20('0x50')][_0x5b20('0x7d')]({'where':{'type':_0x5b20('0x7e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x5b20('0xb')](function(_0x1b70c4){if(_0x1b70c4&&_0x1b70c4['length']){return db[_0x5b20('0x3e')][_0x5b20('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5b20('0x53'))},'VoiceQueueId':{'$in':_['map'](_0x1b70c4,'id')},'$or':[{'UserId':null},{'UserId':_0xfc7f55[_0x5b20('0x50')]['id']}]}});}return 0x0;})[_0x5b20('0xb')](function(_0x26b93a){if(!_['isNil'](_0x26b93a)&&_[_0x5b20('0x7f')](_0x26b93a)){return _0x32c823[_0x5b20('0x5')](0xc8)[_0x5b20('0x80')]({'contacts':_0x26b93a});}else{logger['error'](_0x5b20('0x81'),_0x5b20('0x7c'),0x194,_0x5b20('0x82'));_0x32c823[_0x5b20('0xc')](0x194);}})['catch'](handleError(_0x32c823,null));};exports['getTimezones']=function(_0x214a96,_0x210584){var _0x54d54f=shared[_0x5b20('0x83')];var _0x5f541d=[];_[_0x5b20('0x10')](_0x54d54f,function(_0x129b81){_0x5f541d[_0x5b20('0x84')]({'id':_0x129b81[_0x5b20('0xd')],'name':_0x129b81[_0x5b20('0xd')],'utcOffset':_0x129b81[_0x5b20('0x85')]});});return _0x210584[_0x5b20('0x5')](0xc8)[_0x5b20('0x80')]({'tz':_0x5f541d});};exports['getTimezone']=function(_0x5438ca,_0xa18191){var _0x205e5e=shared[_0x5b20('0x83')];var _0x41a5d0={};if(!_['isNil'](_0x205e5e[_0x5438ca[_0x5b20('0x43')]['id']]))_0x41a5d0=_0x205e5e[_0x5438ca[_0x5b20('0x43')]['id']];return _0xa18191[_0x5b20('0x5')](0xc8)[_0x5b20('0x80')](_0x41a5d0);}; \ No newline at end of file +var _0x0fda=['scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','count','status','set','Content-Range','update','sendStatus','error','stack','send','CmHopper','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$ne','$eq','$notBetween','$in','$notILike','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','then','rows','catch','show','params','include','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','format','map','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x4333fe,_0x2e66c0){_0x4333fe=_0x4333fe-0x0;var _0x4b4b28=_0x0fda[_0x4333fe];return _0x4b4b28;};'use strict';var moment=require(_0xa0fd('0x0'));var _=require('lodash');var qs=require(_0xa0fd('0x1'));var logger=require(_0xa0fd('0x2'))(_0xa0fd('0x3'));var shared=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];function respondWithResult(_0xd8e73a,_0x13c734){_0x13c734=_0x13c734||0xc8;return function(_0x574fca){if(_0x574fca){return _0xd8e73a['status'](_0x13c734)[_0xa0fd('0x6')](_0x574fca);}};}function respondWithFilteredResult(_0x4aec58,_0x49b3c1){return function(_0x868183){if(_0x868183){var _0x62b109=typeof _0x49b3c1[_0xa0fd('0x7')]===_0xa0fd('0x8')&&typeof _0x49b3c1['limit']===_0xa0fd('0x8');var _0xe93771=_0x868183[_0xa0fd('0x9')];var _0x322a1a=_0x62b109?0x0:_0x49b3c1['offset'];var _0x31088d=_0x62b109?_0x868183[_0xa0fd('0x9')]:_0x49b3c1[_0xa0fd('0x7')]+_0x49b3c1['limit'];var _0x4409e4;if(_0x31088d>=_0xe93771){_0x31088d=_0xe93771;_0x4409e4=0xc8;}else{_0x4409e4=0xce;}_0x4aec58[_0xa0fd('0xa')](_0x4409e4);return _0x4aec58[_0xa0fd('0xb')](_0xa0fd('0xc'),_0x322a1a+'-'+_0x31088d+'/'+_0xe93771)[_0xa0fd('0x6')](_0x868183);}return null;};}function saveUpdates(_0x4d5c32,_0x490112){return function(_0x32dcee){if(_0x32dcee){return _0x32dcee[_0xa0fd('0xd')](_0x4d5c32)['then'](function(_0x21acc2){return _0x21acc2;});}return null;};}function handleEntityNotFound(_0x8a67a5,_0x11e4eb){return function(_0x1e4a48){if(!_0x1e4a48){_0x8a67a5[_0xa0fd('0xe')](0x194);}return _0x1e4a48;};}function handleError(_0x2e3692,_0x2811c0){_0x2811c0=_0x2811c0||0x1f4;return function(_0x4fe62c){logger[_0xa0fd('0xf')](_0x4fe62c[_0xa0fd('0x10')]);if(_0x4fe62c['name']){delete _0x4fe62c['name'];}_0x2e3692[_0xa0fd('0xa')](_0x2811c0)[_0xa0fd('0x11')](_0x4fe62c);};}exports['index']=function(_0x2b8d15,_0x22a876){var _0x1cb027={},_0x5073a8={},_0x50cde2={'count':0x0,'rows':[]};var _0x46e15a=_['map'](db[_0xa0fd('0x12')][_0xa0fd('0x13')],function(_0x10f64b){return{'name':_0x10f64b[_0xa0fd('0x14')],'type':_0x10f64b[_0xa0fd('0x15')][_0xa0fd('0x16')]};});_0x5073a8[_0xa0fd('0x17')]=_['map'](_0x46e15a,_0xa0fd('0x18'));_0x5073a8[_0xa0fd('0x19')]=_[_0xa0fd('0x1a')](_0x2b8d15[_0xa0fd('0x19')]);_0x5073a8[_0xa0fd('0x1b')]=_[_0xa0fd('0x1c')](_0x5073a8[_0xa0fd('0x17')],_0x5073a8[_0xa0fd('0x19')]);_0x5073a8[_0xa0fd('0x1b')]=_[_0xa0fd('0x1d')](_0x5073a8[_0xa0fd('0x1b')],[_0xa0fd('0x1e'),_0xa0fd('0x1f'),'$gt',_0xa0fd('0x20'),_0xa0fd('0x21'),'$lte',_0xa0fd('0x22'),_0xa0fd('0x23'),'$not','$between',_0xa0fd('0x24'),_0xa0fd('0x25'),'$notIn','$like','$notLike','$iLike',_0xa0fd('0x26'),'$like',_0xa0fd('0x27'),_0xa0fd('0x28'),_0xa0fd('0x29'),'$any']);_0x1cb027[_0xa0fd('0x2a')]=_[_0xa0fd('0x1c')](_0x5073a8[_0xa0fd('0x17')],qs[_0xa0fd('0x2b')](_0x2b8d15[_0xa0fd('0x19')]['fields']));_0x1cb027[_0xa0fd('0x2a')]=_0x1cb027[_0xa0fd('0x2a')][_0xa0fd('0x2c')]?_0x1cb027[_0xa0fd('0x2a')]:_0x5073a8['model'];if(!_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x2d')]('nolimit')){_0x1cb027['limit']=qs['limit'](_0x2b8d15[_0xa0fd('0x19')]['limit']);_0x1cb027['offset']=qs[_0xa0fd('0x7')](_0x2b8d15['query'][_0xa0fd('0x7')]);}_0x1cb027[_0xa0fd('0x2e')]=qs[_0xa0fd('0x2f')](_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x2f')]);_0x1cb027[_0xa0fd('0x30')]=qs[_0xa0fd('0x1b')](_[_0xa0fd('0x31')](_0x2b8d15['query'],_0x5073a8[_0xa0fd('0x1b')]),_0x46e15a);if(_0x2b8d15['query'][_0xa0fd('0x32')]){_0x1cb027['where']=_['merge'](_0x1cb027[_0xa0fd('0x30')],{'$or':_['map'](_0x46e15a,function(_0x40f8f0){if(_0x40f8f0[_0xa0fd('0x15')]!==_0xa0fd('0x33')){var _0x3c7884={};_0x3c7884[_0x40f8f0['name']]={'$like':'%'+_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x32')]+'%'};return _0x3c7884;}})});}_0x1cb027=_[_0xa0fd('0x34')]({},_0x1cb027,_0x2b8d15[_0xa0fd('0x35')]);var _0x2e3cfa={'where':_0x1cb027[_0xa0fd('0x30')]};return db[_0xa0fd('0x12')]['count'](_0x2e3cfa)['then'](function(_0x2aa6a8){_0x50cde2[_0xa0fd('0x9')]=_0x2aa6a8;if(_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x36')]){_0x1cb027['include']=[{'all':!![]}];}return db[_0xa0fd('0x12')][_0xa0fd('0x37')](_0x1cb027);})[_0xa0fd('0x38')](function(_0x426ae6){_0x50cde2[_0xa0fd('0x39')]=_0x426ae6;return _0x50cde2;})['then'](respondWithFilteredResult(_0x22a876,_0x1cb027))[_0xa0fd('0x3a')](handleError(_0x22a876,null));};exports[_0xa0fd('0x3b')]=function(_0x558f67,_0x48125b){var _0x27082a={'raw':!![],'where':{'id':_0x558f67[_0xa0fd('0x3c')]['id']}},_0x163023={};_0x163023[_0xa0fd('0x17')]=_[_0xa0fd('0x1a')](db[_0xa0fd('0x12')][_0xa0fd('0x13')]);_0x163023[_0xa0fd('0x19')]=_[_0xa0fd('0x1a')](_0x558f67[_0xa0fd('0x19')]);_0x163023[_0xa0fd('0x1b')]=_[_0xa0fd('0x1c')](_0x163023[_0xa0fd('0x17')],_0x163023[_0xa0fd('0x19')]);_0x27082a[_0xa0fd('0x2a')]=_['intersection'](_0x163023['model'],qs['fields'](_0x558f67[_0xa0fd('0x19')][_0xa0fd('0x2b')]));_0x27082a[_0xa0fd('0x2a')]=_0x27082a['attributes'][_0xa0fd('0x2c')]?_0x27082a[_0xa0fd('0x2a')]:_0x163023[_0xa0fd('0x17')];if(_0x558f67['query'][_0xa0fd('0x36')]){_0x27082a[_0xa0fd('0x3d')]=[{'all':!![]}];}_0x27082a=_[_0xa0fd('0x34')]({},_0x27082a,_0x558f67[_0xa0fd('0x35')]);return db[_0xa0fd('0x12')][_0xa0fd('0x3e')](_0x27082a)['then'](handleEntityNotFound(_0x48125b,null))[_0xa0fd('0x38')](respondWithResult(_0x48125b,null))[_0xa0fd('0x3a')](handleError(_0x48125b,null));};exports[_0xa0fd('0x3f')]=function(_0x2498da,_0x324206){return db[_0xa0fd('0x12')]['create'](_0x2498da[_0xa0fd('0x40')],{})[_0xa0fd('0x38')](respondWithResult(_0x324206,0xc9))[_0xa0fd('0x3a')](handleError(_0x324206,null));};exports[_0xa0fd('0xd')]=function(_0x16d0cc,_0x508747){if(_0x16d0cc['body']['id']){delete _0x16d0cc[_0xa0fd('0x40')]['id'];}return db[_0xa0fd('0x12')][_0xa0fd('0x3e')]({'where':{'id':_0x16d0cc[_0xa0fd('0x3c')]['id']}})[_0xa0fd('0x38')](handleEntityNotFound(_0x508747,null))['then'](saveUpdates(_0x16d0cc[_0xa0fd('0x40')],null))[_0xa0fd('0x38')](respondWithResult(_0x508747,null))[_0xa0fd('0x3a')](handleError(_0x508747,null));};exports[_0xa0fd('0x41')]=function(_0x93d528,_0x22504a){return db['CmHopper']['describe']()['then'](respondWithResult(_0x22504a,null))[_0xa0fd('0x3a')](handleError(_0x22504a,null));};exports['destroy']=function(_0x4e4ce4,_0xcf725e){var _0x504a0a;var _0x357324=_0x4e4ce4[_0xa0fd('0x3c')]['id'];return db['CmHopper']['find']({'where':{'id':_0x4e4ce4[_0xa0fd('0x3c')]['id']}})[_0xa0fd('0x38')](handleEntityNotFound(_0xcf725e,null))[_0xa0fd('0x38')](function(_0x167503){if(_0x167503){return _0x167503[_0xa0fd('0x42')]()[_0xa0fd('0x38')](function(_0x5268ba){return _0x5268ba;});}})['then'](function(_0x50382c){_0x504a0a=_0x50382c;if(_0x50382c){if(_0x50382c['VoiceQueueId']||_0x50382c[_0xa0fd('0x43')]){return db[_0x50382c[_0xa0fd('0x44')]?_0xa0fd('0x45'):_0xa0fd('0x46')][_0xa0fd('0x3e')]({'where':{'id':_0x50382c['VoiceQueueId']?_0x50382c['VoiceQueueId']:_0x50382c['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x386dfe){var _0x4238e4={};if(_0x386dfe){_[_0xa0fd('0x34')](_0x4238e4,_[_0xa0fd('0x47')](_0x504a0a[_0xa0fd('0x48')],[_0xa0fd('0x49'),_0xa0fd('0x4a'),'id']));_0x4238e4[_0xa0fd('0x4b')]=0x15;_0x4238e4[_0xa0fd('0x4c')]=_0xa0fd('0x4d');_0x4238e4['campaign']=_0x386dfe['name'];_0x4238e4[_0xa0fd('0x4e')]=_0x4e4ce4[_0xa0fd('0x4f')][_0xa0fd('0x18')];_0x4238e4[_0xa0fd('0x50')]=_0x4e4ce4['user']['id'];_0x4238e4[_0xa0fd('0x4d')]=!![];_0x4238e4[_0xa0fd('0x51')]=moment()['format'](_0xa0fd('0x52'));_0x4238e4['calleridnum']=_0x504a0a[_0xa0fd('0x53')];_0x4238e4[_0xa0fd('0x54')]=_0x504a0a['VoiceQueueId']?_0xa0fd('0x55'):_0xa0fd('0x56');return db[_0xa0fd('0x57')][_0xa0fd('0x3e')]({'where':{'id':_0x4238e4[_0xa0fd('0x58')]},'attributes':[_0xa0fd('0x59'),_0xa0fd('0x5a')]})[_0xa0fd('0x38')](function(_0x5e0440){if(!_[_0xa0fd('0x5b')](_0xcf725e)&&!_['isNil'](_0x5e0440[_0xa0fd('0x59')])){_0x4238e4[_0xa0fd('0x5c')]=_0x5e0440[_0xa0fd('0x59')];if(!_[_0xa0fd('0x5b')](_0x5e0440[_0xa0fd('0x5a')])){_0x4238e4['calleridname']+='\x20'+_0x5e0440[_0xa0fd('0x5a')];}}})[_0xa0fd('0x5d')](function(){return db['CmHopperFinal'][_0xa0fd('0x3f')](_0x4238e4);});}})[_0xa0fd('0x38')](function(_0xfd99a9){return db['CmHopperAdditionalPhone'][_0xa0fd('0x42')]({'where':{'CmHopperId':_0x357324}});})['then'](function(){return _0xcf725e[_0xa0fd('0xa')](0xcc)['end']();})[_0xa0fd('0x3a')](handleError(_0xcf725e,null));};exports['getPreview']=function(_0x1a4da0,_0x62c3e7){var _0x3f9d1e=[];return db[_0xa0fd('0x57')][_0xa0fd('0x41')]()[_0xa0fd('0x38')](function(_0x38076b){_0x3f9d1e=_['keys'](_0x38076b);return _0x1a4da0[_0xa0fd('0x4f')][_0xa0fd('0x5e')]({'where':{'type':_0xa0fd('0x5f'),'dialActive':!![],'dialMethod':_0xa0fd('0x60')},'attributes':['id',_0xa0fd('0x61'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x4ed729){if(_0x4ed729&&_0x4ed729[_0xa0fd('0x2c')]){return db['sequelize'][_0xa0fd('0x62')](function(_0x589433){var _0x4524a3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa0fd('0x63')](_0xa0fd('0x52'))},'VoiceQueueId':{'$in':_[_0xa0fd('0x64')](_0x4ed729,'id')},'$or':[{'UserId':null},{'UserId':_0x1a4da0[_0xa0fd('0x4f')]['id']}]};var _0x5c3efa={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4ed729)[_0xa0fd('0x32')]([_0xa0fd('0x65'),0x0])[_0xa0fd('0x64')]('id')[_0xa0fd('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x1a4da0[_0xa0fd('0x4f')]['id']}]};var _0x26bd48={'$or':[_0x4524a3,_0x5c3efa]};var _0x527e93=[];if(_0x1a4da0['body'][_0xa0fd('0x67')]&&_0x1a4da0[_0xa0fd('0x40')][_0xa0fd('0x67')]===_0xa0fd('0x68')){if(!_[_0xa0fd('0x69')](_0x1a4da0[_0xa0fd('0x40')][_0xa0fd('0x6a')])){_0x26bd48['id']={'$in':_0x1a4da0[_0xa0fd('0x40')]['hopperIds']};}_0x527e93=[[_0xa0fd('0x6b'),_0xa0fd('0x6c')],[_0xa0fd('0x6d'),_0x4ed729[0x0][_0xa0fd('0x61')]===_0xa0fd('0x6c')?_0xa0fd('0x6e'):_0xa0fd('0x6c')],db[_0xa0fd('0x6f')][_0xa0fd('0x70')](_0xa0fd('0x71')),['id',_0xa0fd('0x6e')]];}else{if(!_[_0xa0fd('0x69')](_0x1a4da0['body'][_0xa0fd('0x6a')])){_0x26bd48['id']={'$notIn':_0x1a4da0[_0xa0fd('0x40')][_0xa0fd('0x6a')]};}_0x527e93=[[_0xa0fd('0x6b'),_0xa0fd('0x6e')],[_0xa0fd('0x6d'),_0x4ed729[0x0][_0xa0fd('0x61')]],db[_0xa0fd('0x6f')][_0xa0fd('0x70')](_0xa0fd('0x72')),['id','ASC']];}return db[_0xa0fd('0x12')][_0xa0fd('0x73')]({'attributes':['id',_0xa0fd('0x74'),_0xa0fd('0x53'),_0xa0fd('0x75')],'where':_0x26bd48,'order':_0x527e93,'transaction':_0x589433,'lock':_0x589433[_0xa0fd('0x76')][_0xa0fd('0x77')],'include':[{'model':db[_0xa0fd('0x57')],'as':'Contact','attributes':_0x3f9d1e,'include':[{'model':db[_0xa0fd('0x78')],'as':_0xa0fd('0x79'),'attributes':['id','name']}]},{'model':db[_0xa0fd('0x7a')],'as':_0xa0fd('0x7b'),'attributes':['id',_0xa0fd('0x18')]},{'model':db[_0xa0fd('0x45')],'as':_0xa0fd('0x7c'),'attributes':['id','name',_0xa0fd('0x7d')]}]})[_0xa0fd('0x38')](function(_0xccdeca){if(_0xccdeca){return _0xccdeca[_0xa0fd('0xd')]({'UserId':_0x1a4da0[_0xa0fd('0x4f')]['id']},{'transaction':_0x589433});}});});}})[_0xa0fd('0x38')](handleEntityNotFound(_0x62c3e7,null))[_0xa0fd('0x38')](respondWithResult(_0x62c3e7,null))[_0xa0fd('0x3a')](handleError(_0x62c3e7,null));};exports[_0xa0fd('0x7e')]=function(_0x4407a3,_0x3661f6,_0x245012){var _0x36452c=[];var _0x7d5b1d=_0x4407a3[_0xa0fd('0x3c')]['id'];var _0x1f3851=_0x4407a3[_0xa0fd('0x4f')]['id'];return db[_0xa0fd('0x57')][_0xa0fd('0x41')]()['then'](function(_0x2075cb){_0x36452c=_[_0xa0fd('0x1a')](_0x2075cb);return db[_0xa0fd('0x6f')][_0xa0fd('0x62')](function(_0x5551ff){const _0xeaddf={'id':_0x7d5b1d};return db[_0xa0fd('0x12')][_0xa0fd('0x73')]({'attributes':['id',_0xa0fd('0x74'),_0xa0fd('0x75')],'where':_0xeaddf,'transaction':_0x5551ff,'lock':_0x5551ff['LOCK'][_0xa0fd('0x77')],'include':[{'model':db[_0xa0fd('0x57')],'as':'Contact','attributes':_0x36452c,'include':[{'model':db['CmCompany'],'as':_0xa0fd('0x79'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xa0fd('0x7b'),'attributes':['id',_0xa0fd('0x18')]},{'model':db['VoiceQueue'],'as':_0xa0fd('0x7c'),'attributes':['id',_0xa0fd('0x18'),_0xa0fd('0x7d')]}]})[_0xa0fd('0x38')](function(_0x2aa91d){if(_0x2aa91d){return _0x2aa91d['update']({'UserId':_0x1f3851},{'transaction':_0x5551ff});}});});})[_0xa0fd('0x38')](handleEntityNotFound(_0x3661f6,null))[_0xa0fd('0x38')](respondWithResult(_0x3661f6,null))['catch'](handleError(_0x3661f6,null));};exports[_0xa0fd('0x7f')]=function(_0x37eb12,_0x6431a){return _0x37eb12['user'][_0xa0fd('0x5e')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa0fd('0x60')},'attributes':['id'],'raw':!![]})[_0xa0fd('0x38')](function(_0xe9600b){if(_0xe9600b&&_0xe9600b[_0xa0fd('0x2c')]){return db['CmHopper'][_0xa0fd('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa0fd('0x63')](_0xa0fd('0x52'))},'VoiceQueueId':{'$in':_[_0xa0fd('0x64')](_0xe9600b,'id')},'$or':[{'UserId':null},{'UserId':_0x37eb12[_0xa0fd('0x4f')]['id']}]}});}return 0x0;})[_0xa0fd('0x38')](function(_0x59e347){if(!_[_0xa0fd('0x5b')](_0x59e347)&&_[_0xa0fd('0x80')](_0x59e347)){return _0x6431a[_0xa0fd('0xa')](0xc8)[_0xa0fd('0x6')]({'contacts':_0x59e347});}else{logger[_0xa0fd('0xf')](_0xa0fd('0x81'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x6431a[_0xa0fd('0xe')](0x194);}})[_0xa0fd('0x3a')](handleError(_0x6431a,null));};exports['getTimezones']=function(_0x1888d4,_0x42a27d){var _0x1bdcb=shared[_0xa0fd('0x82')];var _0x4ebc93=[];_[_0xa0fd('0x64')](_0x1bdcb,function(_0x1bcad3){_0x4ebc93[_0xa0fd('0x83')]({'id':_0x1bcad3[_0xa0fd('0x18')],'name':_0x1bcad3['name'],'utcOffset':_0x1bcad3[_0xa0fd('0x84')]});});return _0x42a27d[_0xa0fd('0xa')](0xc8)[_0xa0fd('0x6')]({'tz':_0x4ebc93});};exports['getTimezone']=function(_0x1ef642,_0x23e557){var _0x4c3da0=shared['timezones'];var _0xe8e94c={};if(!_[_0xa0fd('0x5b')](_0x4c3da0[_0x1ef642[_0xa0fd('0x40')]['id']]))_0xe8e94c=_0x4c3da0[_0x1ef642[_0xa0fd('0x40')]['id']];return _0x23e557['status'](0xc8)['json'](_0xe8e94c);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 93b015d..d48c530 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 _0xe2fe=['CmHopper','scheduledat','phone','priority','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1c8eca,_0x4a069d){var _0x349d81=function(_0x47255e){while(--_0x47255e){_0x1c8eca['push'](_0x1c8eca['shift']());}};_0x349d81(++_0x4a069d);}(_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('./cmHopper.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['scheduledat']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'priority','fields':[_0xee2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['../../config/logger','api','bluebird','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c60,0xc1));var _0x04c6=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x4c60[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x04c6('0xa')]},{'name':_0x04c6('0xb'),'fields':[_0x04c6('0xb')]},{'name':_0x04c6('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c8aefa8..0e31251 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 _0x0268=['keys','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','name','voicePause','CmList','List','literal','NOW()','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopper','findAll','options','raw','where','map','include','model','attributes','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','LOCK','UPDATE','Contact','User','Agent','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview'];(function(_0x4b81f7,_0x4217a6){var _0x3d27b2=function(_0x333e4d){while(--_0x333e4d){_0x4b81f7['push'](_0x4b81f7['shift']());}};_0x3d27b2(++_0x4217a6);}(_0x0268,0x17e));var _0x8026=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x0268[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x8026('0x0'));var util=require('util');var moment=require(_0x8026('0x1'));var BPromise=require(_0x8026('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x8026('0x3'))(_0x8026('0x4'));var jayson=require(_0x8026('0x5'));var client=jayson[_0x8026('0x6')][_0x8026('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x480274,_0x4536df,_0x7a8ba2){return new BPromise(function(_0x589205,_0x2573a8){return client[_0x8026('0x8')](_0x480274,_0x7a8ba2)[_0x8026('0x9')](function(_0xaf6f84){logger[_0x8026('0xa')](_0x8026('0xb'),_0x4536df,_0x8026('0xc'));logger[_0x8026('0xd')](_0x8026('0xe'),_0x4536df,_0x8026('0xc'),JSON[_0x8026('0xf')](_0xaf6f84));if(_0xaf6f84[_0x8026('0x10')]){if(_0xaf6f84[_0x8026('0x10')]['code']===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x4536df,_0xaf6f84[_0x8026('0x10')]['message']);return _0x2573a8(_0xaf6f84[_0x8026('0x10')][_0x8026('0x11')]);}logger[_0x8026('0x10')](_0x8026('0xb'),_0x4536df,_0xaf6f84[_0x8026('0x10')][_0x8026('0x11')]);return _0x589205(_0xaf6f84[_0x8026('0x10')][_0x8026('0x11')]);}else{logger[_0x8026('0xa')](_0x8026('0xb'),_0x4536df,_0x8026('0xc'));_0x589205(_0xaf6f84[_0x8026('0x12')][_0x8026('0x11')]);}})[_0x8026('0x13')](function(_0x276623){logger[_0x8026('0x10')](_0x8026('0xb'),_0x4536df,_0x276623);_0x2573a8(_0x276623);});});}exports['GetCmHopper']=function(_0x5df96d){var _0x1acd0e=this;return new Promise(function(_0x27d2f5,_0x2ce7d0){return db[_0x8026('0x14')][_0x8026('0x15')]({'raw':_0x5df96d['options']?_0x5df96d[_0x8026('0x16')][_0x8026('0x17')]===undefined?!![]:![]:!![],'where':_0x5df96d['options']?_0x5df96d[_0x8026('0x16')][_0x8026('0x18')]||null:null,'attributes':_0x5df96d[_0x8026('0x16')]?_0x5df96d['options']['attributes']||null:null,'limit':_0x5df96d[_0x8026('0x16')]?_0x5df96d[_0x8026('0x16')]['limit']||null:null,'include':_0x5df96d[_0x8026('0x16')]?_0x5df96d[_0x8026('0x16')]['include']?_[_0x8026('0x19')](_0x5df96d[_0x8026('0x16')][_0x8026('0x1a')],function(_0x498c67){return{'model':db[_0x498c67[_0x8026('0x1b')]],'as':_0x498c67['as'],'attributes':_0x498c67[_0x8026('0x1c')],'include':_0x498c67['include']?_[_0x8026('0x19')](_0x498c67[_0x8026('0x1a')],function(_0x3b3ae3){return{'model':db[_0x3b3ae3[_0x8026('0x1b')]],'as':_0x3b3ae3['as'],'attributes':_0x3b3ae3[_0x8026('0x1c')],'include':_0x3b3ae3[_0x8026('0x1a')]?_['map'](_0x3b3ae3[_0x8026('0x1a')],function(_0x471277){return{'model':db[_0x471277[_0x8026('0x1b')]],'as':_0x471277['as'],'attributes':_0x471277[_0x8026('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8026('0x9')](function(_0x2dee5e){logger[_0x8026('0xa')]('GetCmHopper',_0x5df96d);logger['debug'](_0x8026('0x1d'),_0x5df96d,JSON[_0x8026('0xf')](_0x2dee5e));_0x27d2f5(_0x2dee5e);})[_0x8026('0x13')](function(_0x211234){logger[_0x8026('0x10')](_0x8026('0x1d'),_0x211234[_0x8026('0x11')],_0x5df96d);_0x2ce7d0(_0x1acd0e['error'](0x1f4,_0x211234['message']));});});};exports[_0x8026('0x1e')]=function(_0x7b6b71){var _0x11876f=this;return new Promise(function(_0x3f3ae4,_0x5577ed){return db[_0x8026('0x14')][_0x8026('0x1f')]({'raw':_0x7b6b71[_0x8026('0x16')]?_0x7b6b71[_0x8026('0x16')][_0x8026('0x17')]===undefined?!![]:![]:!![],'where':_0x7b6b71[_0x8026('0x16')]?_0x7b6b71[_0x8026('0x16')][_0x8026('0x18')]||null:null,'attributes':_0x7b6b71[_0x8026('0x16')]?_0x7b6b71['options'][_0x8026('0x1c')]||null:null,'include':_0x7b6b71[_0x8026('0x16')]?_0x7b6b71[_0x8026('0x16')]['include']?_[_0x8026('0x19')](_0x7b6b71[_0x8026('0x16')][_0x8026('0x1a')],function(_0xf1fd29){return{'model':db[_0xf1fd29[_0x8026('0x1b')]],'as':_0xf1fd29['as'],'attributes':_0xf1fd29[_0x8026('0x1c')],'include':_0xf1fd29[_0x8026('0x1a')]?_[_0x8026('0x19')](_0xf1fd29['include'],function(_0x8bffb6){return{'model':db[_0x8bffb6[_0x8026('0x1b')]],'as':_0x8bffb6['as'],'attributes':_0x8bffb6[_0x8026('0x1c')],'include':_0x8bffb6[_0x8026('0x1a')]?_[_0x8026('0x19')](_0x8bffb6['include'],function(_0x4a5e0b){return{'model':db[_0x4a5e0b[_0x8026('0x1b')]],'as':_0x4a5e0b['as'],'attributes':_0x4a5e0b[_0x8026('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8026('0x9')](function(_0x44a928){logger[_0x8026('0xa')](_0x8026('0x1e'),_0x7b6b71);logger[_0x8026('0xd')](_0x8026('0x1e'),_0x7b6b71,JSON[_0x8026('0xf')](_0x44a928));_0x3f3ae4(_0x44a928);})[_0x8026('0x13')](function(_0x557cd0){logger[_0x8026('0x10')](_0x8026('0x1e'),_0x557cd0[_0x8026('0x11')],_0x7b6b71);_0x5577ed(_0x11876f[_0x8026('0x10')](0x1f4,_0x557cd0[_0x8026('0x11')]));});});};exports[_0x8026('0x20')]=function(_0x504079){var _0x3fd9b7=this;return new Promise(function(_0x13fc76,_0x148f63){return db['CmHopper'][_0x8026('0x21')](_0x504079['body'],{'raw':_0x504079[_0x8026('0x16')]?_0x504079[_0x8026('0x16')][_0x8026('0x17')]===undefined?!![]:![]:!![]})[_0x8026('0x9')](function(_0x967992){logger[_0x8026('0xa')](_0x8026('0x20'),_0x504079);logger['debug'](_0x8026('0x20'),_0x504079,JSON[_0x8026('0xf')](_0x967992));_0x13fc76(_0x967992);})[_0x8026('0x13')](function(_0x3cbf2d){logger[_0x8026('0x10')](_0x8026('0x20'),_0x3cbf2d[_0x8026('0x11')],_0x504079);_0x148f63(_0x3fd9b7[_0x8026('0x10')](0x1f4,_0x3cbf2d[_0x8026('0x11')]));});});};exports[_0x8026('0x22')]=function(_0x404037){var _0x3d1a65=this;return new Promise(function(_0x21280e,_0x25708f){return db['CmHopper'][_0x8026('0x23')](_0x404037[_0x8026('0x24')],{'raw':_0x404037[_0x8026('0x16')]?_0x404037[_0x8026('0x16')][_0x8026('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x404037[_0x8026('0x16')]?_0x404037[_0x8026('0x16')][_0x8026('0x18')]||null:null,'attributes':_0x404037['options']?_0x404037[_0x8026('0x16')][_0x8026('0x1c')]||null:null,'limit':_0x404037[_0x8026('0x16')]?_0x404037[_0x8026('0x16')][_0x8026('0x25')]||null:null})['then'](function(_0x38c272){logger['info'](_0x8026('0x22'),_0x404037);logger[_0x8026('0xa')](_0x8026('0x26'),JSON['stringify'](_0x404037[_0x8026('0x16')][_0x8026('0x18')]),_0x404037[_0x8026('0x24')][_0x8026('0x27')]);logger[_0x8026('0xd')](_0x8026('0x22'),_0x404037,JSON['stringify'](_0x38c272));_0x21280e(_0x38c272);})[_0x8026('0x13')](function(_0x157c30){logger[_0x8026('0x10')]('UpdateCmHopper',_0x157c30[_0x8026('0x11')],_0x404037);_0x25708f(_0x3d1a65[_0x8026('0x10')](0x1f4,_0x157c30[_0x8026('0x11')]));});});};exports[_0x8026('0x28')]=function(_0x19c0a3){var _0x334067=this;return new Promise(function(_0x41121,_0x582980){return db[_0x8026('0x14')][_0x8026('0x29')]({'where':_0x19c0a3[_0x8026('0x16')]?_0x19c0a3[_0x8026('0x16')][_0x8026('0x18')]||null:null})['then'](function(_0x58cad4){logger['info']('DestroyCmHopper',_0x19c0a3);logger[_0x8026('0xd')](_0x8026('0x28'),_0x19c0a3,JSON[_0x8026('0xf')](_0x58cad4));_0x41121(_0x58cad4);})[_0x8026('0x13')](function(_0xa68ef1){logger['error'](_0x8026('0x28'),_0xa68ef1[_0x8026('0x11')],_0x19c0a3);_0x582980(_0x334067[_0x8026('0x10')](0x1f4,_0xa68ef1[_0x8026('0x11')]));});});};exports[_0x8026('0x2a')]=function(_0x3439a2){var _0x2de277=this;return new Promise(function(_0x5cba21,_0x4164e2){return db[_0x8026('0x2b')][_0x8026('0x2c')]()[_0x8026('0x9')](function(_0x23b4fd){return db['sequelize'][_0x8026('0x2d')](function(_0x3bdae7){return db[_0x8026('0x14')][_0x8026('0x15')]({'where':_0x3439a2['options']?_0x3439a2[_0x8026('0x16')][_0x8026('0x18')]||null:null,'attributes':_0x3439a2[_0x8026('0x16')]?_0x3439a2[_0x8026('0x16')][_0x8026('0x1c')]||null:null,'limit':_0x3439a2['options']?_0x3439a2[_0x8026('0x16')][_0x8026('0x25')]||null:null,'order':_0x3439a2[_0x8026('0x16')]?_0x3439a2[_0x8026('0x16')]['order']||null:null,'transaction':_0x3bdae7,'lock':_0x3bdae7[_0x8026('0x2e')][_0x8026('0x2f')],'include':[{'model':db[_0x8026('0x2b')],'as':_0x8026('0x30'),'attributes':_['keys'](_0x23b4fd)},{'model':db[_0x8026('0x31')],'as':_0x8026('0x32'),'attributes':['id','name','voicePause']}]})[_0x8026('0x9')](function(_0x3d285f){var _0x3ef3b3=[];var _0x1f30dd=[];for(var _0x2af932=0x0;_0x2af932<_0x3d285f[_0x8026('0x33')];_0x2af932+=0x1){var _0x1e42c1=_0x3d285f[_0x2af932][_0x8026('0x34')];if(_0x1e42c1===null){_0x3ef3b3[_0x8026('0x35')](_0x3d285f[_0x2af932][_0x8026('0x23')](_0x3439a2['body'],{'transaction':_0x3bdae7}));}else if(!_0x1f30dd[_0x8026('0x36')](_0x1e42c1)){_0x1f30dd['push'](_0x1e42c1);_0x3ef3b3[_0x8026('0x35')](_0x3d285f[_0x2af932][_0x8026('0x23')](_0x3439a2['body'],{'transaction':_0x3bdae7}));}}return BPromise[_0x8026('0x37')](_0x3ef3b3);});})[_0x8026('0x9')](function(_0x104186){logger[_0x8026('0xa')]('GetContactDialer',_0x3439a2);if(_0x104186[_0x8026('0x33')]>0x0){logger[_0x8026('0xa')](_0x8026('0x38'),_0x104186[0x0]['dataValues']['id'],_0x104186[0x0][_0x8026('0x39')][_0x8026('0x3a')],_0x104186[0x0][_0x8026('0x39')][_0x8026('0x27')]);}logger['debug'](_0x8026('0x2a'),_0x3439a2,JSON[_0x8026('0xf')](_0x104186));_0x5cba21(_0x104186);})[_0x8026('0x13')](function(_0x291f6e){logger['error']('GetContactDialer',_0x291f6e[_0x8026('0x11')],_0x3439a2);_0x4164e2(_0x2de277[_0x8026('0x10')](0x1f4,_0x291f6e[_0x8026('0x11')]));});});});};exports[_0x8026('0x3b')]=function(_0x47fd27){var _0x1d6eaf=this;return new Promise(function(_0x5db8d2,_0x546754){return db[_0x8026('0x3c')][_0x8026('0x2d')](function(_0x36198e){return db['CmHopperFinal'][_0x8026('0x21')](_0x47fd27[_0x8026('0x24')],{'raw':_0x47fd27['options']?_0x47fd27[_0x8026('0x16')][_0x8026('0x17')]===undefined?!![]:![]:!![],'transaction':_0x36198e})[_0x8026('0x9')](function(){logger['info'](_0x8026('0x3d'),JSON[_0x8026('0xf')](_0x47fd27[_0x8026('0x16')]['where']),_0x47fd27['options'][_0x8026('0x18')][_0x8026('0x27')]);return db[_0x8026('0x14')][_0x8026('0x29')]({'where':_0x47fd27[_0x8026('0x16')]?_0x47fd27[_0x8026('0x16')][_0x8026('0x18')]||null:null,'transaction':_0x36198e});});})[_0x8026('0x9')](function(_0x2045ca){logger[_0x8026('0xa')](_0x8026('0x3b'),_0x47fd27);logger[_0x8026('0xd')](_0x8026('0x3b'),_0x47fd27,JSON['stringify'](_0x2045ca));_0x5db8d2(_0x2045ca);})['catch'](function(_0x5a3942){logger[_0x8026('0x10')](_0x8026('0x3b'),_0x5a3942['message'],_0x47fd27);_0x546754(_0x1d6eaf[_0x8026('0x10')](0x1f4,_0x5a3942[_0x8026('0x11')]));});});};exports[_0x8026('0x3e')]=function(_0x7b880a){var _0x573231=this;return new Promise(function(_0x20ccd3,_0x15cf77){return db[_0x8026('0x14')]['findAll']({'raw':_0x7b880a[_0x8026('0x16')]?_0x7b880a[_0x8026('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x7b880a['options']?_0x7b880a[_0x8026('0x16')][_0x8026('0x18')]||null:null,'attributes':[[db[_0x8026('0x3c')]['fn'](_0x8026('0x3f'),db[_0x8026('0x3c')]['fn']('IF',db[_0x8026('0x3c')]['literal'](_0x8026('0x40')+util[_0x8026('0x41')](_0x8026('0x42'),moment()[_0x8026('0x41')](_0x8026('0x43')))+_0x8026('0x44')))),_0x8026('0x45')]]})['then'](function(_0x12ebf9){logger[_0x8026('0xa')](_0x8026('0x3e'),_0x7b880a);logger['debug'](_0x8026('0x3e'),_0x7b880a,JSON['stringify'](_0x12ebf9));_0x20ccd3(_0x12ebf9);})[_0x8026('0x13')](function(_0x3b34b6){logger[_0x8026('0x10')](_0x8026('0x3e'),_0x3b34b6[_0x8026('0x11')],_0x7b880a);_0x15cf77(_0x573231[_0x8026('0x10')](0x1f4,_0x3b34b6['message']));});});};exports[_0x8026('0x46')]=function(_0x3d05c4){var _0x3bb6b3=this;return new Promise(function(_0x26bc41,_0x178870){return db['CmContact']['describe']()[_0x8026('0x9')](function(_0x146acf){return db[_0x8026('0x3c')]['transaction'](function(_0xe39026){return db[_0x8026('0x14')][_0x8026('0x15')]({'where':_0x3d05c4[_0x8026('0x16')]?_0x3d05c4[_0x8026('0x16')][_0x8026('0x18')]||null:null,'attributes':_0x3d05c4[_0x8026('0x16')]?_0x3d05c4[_0x8026('0x16')][_0x8026('0x1c')]||null:null,'limit':0x1,'order':_0x3d05c4[_0x8026('0x16')]?_0x3d05c4['options'][_0x8026('0x47')]||null:null,'group':db[_0x8026('0x14')]['UserId'],'transaction':_0xe39026,'lock':_0xe39026[_0x8026('0x2e')][_0x8026('0x2f')],'include':_0x3d05c4[_0x8026('0x16')]?_0x3d05c4['options'][_0x8026('0x1a')]?_[_0x8026('0x19')](_0x3d05c4[_0x8026('0x16')][_0x8026('0x1a')],function(_0x3a123e){return{'model':db[_0x3a123e['model']],'as':_0x3a123e['as'],'attributes':_0x3a123e[_0x8026('0x1c')],'include':_0x3a123e['include']?_['map'](_0x3a123e['include'],function(_0x59f829){return{'model':db[_0x59f829[_0x8026('0x1b')]],'as':_0x59f829['as'],'attributes':_0x59f829[_0x8026('0x1c')],'include':_0x59f829[_0x8026('0x1a')]?_['map'](_0x59f829[_0x8026('0x1a')],function(_0x526d21){return{'model':db[_0x526d21['model']],'as':_0x526d21['as'],'attributes':_0x526d21[_0x8026('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8026('0x9')](function(_0x2ce6d1){var _0x20dd3b=[];for(var _0x269475=0x0;_0x269475<_0x2ce6d1['length'];_0x269475+=0x1){_0x20dd3b[_0x8026('0x35')](_0x2ce6d1[_0x269475]['update'](_0x3d05c4[_0x8026('0x24')],{'transaction':_0xe39026}));}return BPromise[_0x8026('0x37')](_0x20dd3b);});})[_0x8026('0x9')](function(_0x588e82){logger['info'](_0x8026('0x46'),_0x3d05c4);logger[_0x8026('0xd')](_0x8026('0x46'),_0x3d05c4,JSON[_0x8026('0xf')](_0x588e82));_0x26bc41(_0x588e82);})[_0x8026('0x13')](function(_0xc68dde){logger['error'](_0x8026('0x46'),_0xc68dde[_0x8026('0x11')],_0x3d05c4);_0x178870(_0x3bb6b3[_0x8026('0x10')](0x1f4,_0xc68dde[_0x8026('0x11')]));});});});};exports[_0x8026('0x48')]=function(_0x337907){var _0x486439=this;return new Promise(function(_0x18e02f,_0xfd0850){db['CmContact'][_0x8026('0x2c')]()[_0x8026('0x9')](function(_0x25d080){return db['CmHopper']['findAll']({'raw':_0x337907['options']?_0x337907[_0x8026('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x337907[_0x8026('0x16')]?_0x337907[_0x8026('0x16')][_0x8026('0x18')]||null:null,'attributes':_0x337907[_0x8026('0x16')]?_0x337907['options'][_0x8026('0x1c')]||null:null,'limit':_0x337907[_0x8026('0x16')]?_0x337907['options']['limit']||null:null,'include':_0x337907[_0x8026('0x16')]?_0x337907['options'][_0x8026('0x1a')]?_[_0x8026('0x19')](_0x337907[_0x8026('0x16')][_0x8026('0x1a')],function(_0x100512){return{'model':db[_0x100512[_0x8026('0x1b')]],'as':_0x100512['as'],'attributes':_0x100512['as']===_0x8026('0x30')?_[_0x8026('0x49')](_0x25d080):_0x100512[_0x8026('0x1c')],'include':_0x100512[_0x8026('0x1a')]?_[_0x8026('0x19')](_0x100512[_0x8026('0x1a')],function(_0x157439){return{'model':db[_0x157439['model']],'as':_0x157439['as'],'attributes':_0x157439[_0x8026('0x1c')],'include':_0x157439[_0x8026('0x1a')]?_[_0x8026('0x19')](_0x157439['include'],function(_0x188936){return{'model':db[_0x188936['model']],'as':_0x188936['as'],'attributes':_0x188936[_0x8026('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8026('0x9')](function(_0x178ccd){logger['info'](_0x8026('0x1d'),_0x337907);logger['debug'](_0x8026('0x1d'),_0x337907,JSON['stringify'](_0x178ccd));_0x18e02f(_0x178ccd);})[_0x8026('0x13')](function(_0x415633){logger[_0x8026('0x10')](_0x8026('0x1d'),_0x415633['message'],_0x337907);_0xfd0850(_0x486439[_0x8026('0x10')](0x1f4,_0x415633[_0x8026('0x11')]));});});});};exports['GetContactByPhone']=function(_0x458c49){var _0x3fac39=this;return new Promise(function(_0x16554a,_0x5adcec){return db['CmContact'][_0x8026('0x4a')]({'raw':!![],'where':{'phone':_0x458c49[_0x8026('0x16')][_0x8026('0x18')][_0x8026('0x4b')]},'attributes':['id','dialTimezone'],'order':[['id',_0x8026('0x4c')]]})[_0x8026('0x9')](function(_0x2c035b){logger['info'](_0x8026('0x4d'),_0x458c49);logger['debug'](_0x8026('0x4d'),_0x458c49,JSON[_0x8026('0xf')](_0x2c035b));_0x16554a(_0x2c035b);})[_0x8026('0x13')](function(_0xcc5d60){logger[_0x8026('0x10')]('getContactByPhone',_0xcc5d60['message'],_0x458c49);_0x5adcec(_0x3fac39[_0x8026('0x10')](0x1f4,_0xcc5d60[_0x8026('0x11')]));});});};exports[_0x8026('0x4e')]=function(_0x5b30c7){var _0x1b23a6=this;return new Promise(function(_0x357d98,_0x21cbab){return db[_0x8026('0x3c')]['transaction'](function(_0x55de9e){return db[_0x8026('0x14')][_0x8026('0x23')]({'active':![]},{'where':{},'transaction':_0x55de9e})['then'](function(_0x27d05c){logger[_0x8026('0xa')](_0x8026('0x4e'),_0x5b30c7);logger[_0x8026('0xd')](_0x8026('0x4e'),_0x5b30c7,JSON[_0x8026('0xf')](_0x27d05c));_0x357d98(_0x27d05c);})['catch'](function(_0x851c8b){logger[_0x8026('0x10')](_0x8026('0x4e'),_0x851c8b[_0x8026('0x11')],_0x5b30c7);_0x21cbab(_0x1b23a6[_0x8026('0x10')](0x1f4,_0x851c8b[_0x8026('0x11')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x3dfed2){var _0x52d141=this;var _0x2d9c22=_0x3dfed2['body'][_0x8026('0x18')][_0x8026('0x4f')];var _0x43bf09=_0x3dfed2[_0x8026('0x24')][_0x8026('0x18')][_0x8026('0x50')];var _0x31181b=_0x3dfed2['body'][_0x8026('0x18')][_0x8026('0x51')];return new Promise(function(_0x218234,_0x47f378){return db[_0x8026('0x14')][_0x8026('0x15')]({'where':{'voiceQueueId':{'$in':_0x2d9c22},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x8026('0x3c')]['literal'](_0x8026('0x52')+_0x43bf09+_0x8026('0x53')),'$gt':db[_0x8026('0x3c')]['literal']('NOW()')}},'UserId':{'$in':_0x31181b}},'include':[{'model':db[_0x8026('0x2b')],'as':_0x8026('0x30')},{'model':db['User'],'as':_0x8026('0x32'),'attributes':['id',_0x8026('0x54'),_0x8026('0x55')]},{'model':db[_0x8026('0x56')],'as':_0x8026('0x57')}]})[_0x8026('0x9')](function(_0x456841){if(_0x456841[_0x8026('0x33')]>0x0){return db[_0x8026('0x3c')]['transaction'](function(_0x4cbff9){return db[_0x8026('0x14')]['update']({'recallmeNotifiedDate':db['sequelize'][_0x8026('0x58')](_0x8026('0x59'))},{'where':{'id':{'$in':_[_0x8026('0x19')](_0x456841,'id')}},'transaction':_0x4cbff9})[_0x8026('0x9')](function(){_0x218234(_0x456841);})[_0x8026('0x13')](function(_0x3778ea){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x3778ea[_0x8026('0x11')],_0x3dfed2);_0x47f378(_0x52d141[_0x8026('0x10')](0x1f4,_0x3778ea[_0x8026('0x11')]));});})[_0x8026('0x13')](function(_0x48de09){logger[_0x8026('0x10')](_0x8026('0x5a'),_0x48de09[_0x8026('0x11')],_0x3dfed2);_0x47f378(_0x52d141['error'](0x1f4,_0x48de09[_0x8026('0x11')]));});}else{_0x218234(_0x456841);}});});}; \ No newline at end of file +var _0xa8ac=['active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','length','push','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','UserId','GetContactRecallMe','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()','User','List','util','moment','../../mysqldb','../../config/logger','client','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','find','CreateCmHopper','create','body','catch','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x174271,_0x221c70){var _0x2d0f00=function(_0x366d66){while(--_0x366d66){_0x174271['push'](_0x174271['shift']());}};_0x2d0f00(++_0x221c70);}(_0xa8ac,0xd9));var _0xca8a=function(_0x1521bb,_0x254e97){_0x1521bb=_0x1521bb-0x0;var _0x5eb884=_0xa8ac[_0x1521bb];return _0x5eb884;};'use strict';var _=require('lodash');var util=require(_0xca8a('0x0'));var moment=require(_0xca8a('0x1'));var BPromise=require('bluebird');var db=require(_0xca8a('0x2'))['db'];var logger=require(_0xca8a('0x3'))('rpc');var jayson=require('jayson/promise');var client=jayson[_0xca8a('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5128,_0x5a6fda,_0x1e20e6){return new BPromise(function(_0x498bf1,_0x3c494b){return client['request'](_0x1e5128,_0x1e20e6)[_0xca8a('0x5')](function(_0x93b7ed){logger[_0xca8a('0x6')](_0xca8a('0x7'),_0x5a6fda,_0xca8a('0x8'));logger[_0xca8a('0x9')](_0xca8a('0xa'),_0x5a6fda,_0xca8a('0x8'),JSON[_0xca8a('0xb')](_0x93b7ed));if(_0x93b7ed[_0xca8a('0xc')]){if(_0x93b7ed['error'][_0xca8a('0xd')]===0x1f4){logger['error'](_0xca8a('0x7'),_0x5a6fda,_0x93b7ed[_0xca8a('0xc')][_0xca8a('0xe')]);return _0x3c494b(_0x93b7ed[_0xca8a('0xc')][_0xca8a('0xe')]);}logger[_0xca8a('0xc')](_0xca8a('0x7'),_0x5a6fda,_0x93b7ed[_0xca8a('0xc')][_0xca8a('0xe')]);return _0x498bf1(_0x93b7ed['error'][_0xca8a('0xe')]);}else{logger[_0xca8a('0x6')](_0xca8a('0x7'),_0x5a6fda,'request\x20sent');_0x498bf1(_0x93b7ed[_0xca8a('0xf')][_0xca8a('0xe')]);}})['catch'](function(_0x5538aa){logger[_0xca8a('0xc')](_0xca8a('0x7'),_0x5a6fda,_0x5538aa);_0x3c494b(_0x5538aa);});});}exports[_0xca8a('0x10')]=function(_0x32732b){var _0x15c6da=this;return new Promise(function(_0x356bd8,_0x238f5e){return db[_0xca8a('0x11')][_0xca8a('0x12')]({'raw':_0x32732b[_0xca8a('0x13')]?_0x32732b['options'][_0xca8a('0x14')]===undefined?!![]:![]:!![],'where':_0x32732b[_0xca8a('0x13')]?_0x32732b[_0xca8a('0x13')][_0xca8a('0x15')]||null:null,'attributes':_0x32732b[_0xca8a('0x13')]?_0x32732b[_0xca8a('0x13')][_0xca8a('0x16')]||null:null,'limit':_0x32732b[_0xca8a('0x13')]?_0x32732b[_0xca8a('0x13')][_0xca8a('0x17')]||null:null,'include':_0x32732b[_0xca8a('0x13')]?_0x32732b[_0xca8a('0x13')][_0xca8a('0x18')]?_[_0xca8a('0x19')](_0x32732b[_0xca8a('0x13')][_0xca8a('0x18')],function(_0xf5b4d5){return{'model':db[_0xf5b4d5['model']],'as':_0xf5b4d5['as'],'attributes':_0xf5b4d5[_0xca8a('0x16')],'include':_0xf5b4d5['include']?_[_0xca8a('0x19')](_0xf5b4d5[_0xca8a('0x18')],function(_0x5a4df2){return{'model':db[_0x5a4df2[_0xca8a('0x1a')]],'as':_0x5a4df2['as'],'attributes':_0x5a4df2['attributes'],'include':_0x5a4df2[_0xca8a('0x18')]?_[_0xca8a('0x19')](_0x5a4df2['include'],function(_0x2618ab){return{'model':db[_0x2618ab['model']],'as':_0x2618ab['as'],'attributes':_0x2618ab[_0xca8a('0x16')]};}):[]};}):[]};}):[]:[]})[_0xca8a('0x5')](function(_0x535069){logger[_0xca8a('0x6')](_0xca8a('0x10'),_0x32732b);logger[_0xca8a('0x9')]('GetCmHopper',_0x32732b,JSON[_0xca8a('0xb')](_0x535069));_0x356bd8(_0x535069);})['catch'](function(_0x4ca10c){logger[_0xca8a('0xc')](_0xca8a('0x10'),_0x4ca10c[_0xca8a('0xe')],_0x32732b);_0x238f5e(_0x15c6da[_0xca8a('0xc')](0x1f4,_0x4ca10c[_0xca8a('0xe')]));});});};exports[_0xca8a('0x1b')]=function(_0x3527d4){var _0x75c041=this;return new Promise(function(_0x5caf48,_0x346568){return db[_0xca8a('0x11')][_0xca8a('0x1c')]({'raw':_0x3527d4[_0xca8a('0x13')]?_0x3527d4[_0xca8a('0x13')][_0xca8a('0x14')]===undefined?!![]:![]:!![],'where':_0x3527d4['options']?_0x3527d4[_0xca8a('0x13')][_0xca8a('0x15')]||null:null,'attributes':_0x3527d4[_0xca8a('0x13')]?_0x3527d4['options'][_0xca8a('0x16')]||null:null,'include':_0x3527d4[_0xca8a('0x13')]?_0x3527d4[_0xca8a('0x13')]['include']?_[_0xca8a('0x19')](_0x3527d4[_0xca8a('0x13')][_0xca8a('0x18')],function(_0x3c6858){return{'model':db[_0x3c6858[_0xca8a('0x1a')]],'as':_0x3c6858['as'],'attributes':_0x3c6858['attributes'],'include':_0x3c6858['include']?_[_0xca8a('0x19')](_0x3c6858[_0xca8a('0x18')],function(_0xc9f416){return{'model':db[_0xc9f416[_0xca8a('0x1a')]],'as':_0xc9f416['as'],'attributes':_0xc9f416[_0xca8a('0x16')],'include':_0xc9f416[_0xca8a('0x18')]?_[_0xca8a('0x19')](_0xc9f416['include'],function(_0x3806ff){return{'model':db[_0x3806ff[_0xca8a('0x1a')]],'as':_0x3806ff['as'],'attributes':_0x3806ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xca8a('0x5')](function(_0x5f681f){logger[_0xca8a('0x6')](_0xca8a('0x1b'),_0x3527d4);logger[_0xca8a('0x9')](_0xca8a('0x1b'),_0x3527d4,JSON[_0xca8a('0xb')](_0x5f681f));_0x5caf48(_0x5f681f);})['catch'](function(_0x1d9c5f){logger['error']('ShowCmHopper',_0x1d9c5f[_0xca8a('0xe')],_0x3527d4);_0x346568(_0x75c041[_0xca8a('0xc')](0x1f4,_0x1d9c5f[_0xca8a('0xe')]));});});};exports[_0xca8a('0x1d')]=function(_0x3b03be){var _0x1a7b75=this;return new Promise(function(_0x31aa86,_0x8904e1){return db[_0xca8a('0x11')][_0xca8a('0x1e')](_0x3b03be[_0xca8a('0x1f')],{'raw':_0x3b03be[_0xca8a('0x13')]?_0x3b03be['options'][_0xca8a('0x14')]===undefined?!![]:![]:!![]})[_0xca8a('0x5')](function(_0x388f9b){logger['info'](_0xca8a('0x1d'),_0x3b03be);logger[_0xca8a('0x9')](_0xca8a('0x1d'),_0x3b03be,JSON[_0xca8a('0xb')](_0x388f9b));_0x31aa86(_0x388f9b);})[_0xca8a('0x20')](function(_0x7e41d1){logger[_0xca8a('0xc')](_0xca8a('0x1d'),_0x7e41d1['message'],_0x3b03be);_0x8904e1(_0x1a7b75['error'](0x1f4,_0x7e41d1[_0xca8a('0xe')]));});});};exports[_0xca8a('0x21')]=function(_0x1ad82d){var _0x289a28=this;return new Promise(function(_0x51c605,_0x28eb37){return db[_0xca8a('0x11')]['update'](_0x1ad82d[_0xca8a('0x1f')],{'raw':_0x1ad82d[_0xca8a('0x13')]?_0x1ad82d[_0xca8a('0x13')][_0xca8a('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ad82d[_0xca8a('0x13')]?_0x1ad82d[_0xca8a('0x13')][_0xca8a('0x15')]||null:null,'attributes':_0x1ad82d[_0xca8a('0x13')]?_0x1ad82d['options'][_0xca8a('0x16')]||null:null,'limit':_0x1ad82d[_0xca8a('0x13')]?_0x1ad82d[_0xca8a('0x13')][_0xca8a('0x17')]||null:null})[_0xca8a('0x5')](function(_0x27804b){logger['info'](_0xca8a('0x21'),_0x1ad82d);logger[_0xca8a('0x6')](_0xca8a('0x22'),JSON[_0xca8a('0xb')](_0x1ad82d[_0xca8a('0x13')]['where']),_0x1ad82d[_0xca8a('0x1f')][_0xca8a('0x23')]);logger['debug'](_0xca8a('0x21'),_0x1ad82d,JSON[_0xca8a('0xb')](_0x27804b));_0x51c605(_0x27804b);})['catch'](function(_0x4240a8){logger[_0xca8a('0xc')](_0xca8a('0x21'),_0x4240a8[_0xca8a('0xe')],_0x1ad82d);_0x28eb37(_0x289a28[_0xca8a('0xc')](0x1f4,_0x4240a8[_0xca8a('0xe')]));});});};exports[_0xca8a('0x24')]=function(_0x303498){var _0x46e520=this;return new Promise(function(_0x17d4ac,_0x49934e){return db[_0xca8a('0x11')][_0xca8a('0x25')]({'where':_0x303498[_0xca8a('0x13')]?_0x303498[_0xca8a('0x13')]['where']||null:null})[_0xca8a('0x5')](function(_0x1ffcd7){logger[_0xca8a('0x6')](_0xca8a('0x24'),_0x303498);logger[_0xca8a('0x9')]('DestroyCmHopper',_0x303498,JSON['stringify'](_0x1ffcd7));_0x17d4ac(_0x1ffcd7);})['catch'](function(_0x3342be){logger[_0xca8a('0xc')](_0xca8a('0x24'),_0x3342be[_0xca8a('0xe')],_0x303498);_0x49934e(_0x46e520[_0xca8a('0xc')](0x1f4,_0x3342be[_0xca8a('0xe')]));});});};exports[_0xca8a('0x26')]=function(_0x45730e){var _0x540bd2=this;return new Promise(function(_0x4fb1ed,_0x4f6f9c){return db[_0xca8a('0x27')][_0xca8a('0x28')]()[_0xca8a('0x5')](function(_0x2538bc){return db['sequelize'][_0xca8a('0x29')](function(_0x7adb5e){return db[_0xca8a('0x11')][_0xca8a('0x12')]({'where':_0x45730e[_0xca8a('0x13')]?_0x45730e[_0xca8a('0x13')]['where']||null:null,'attributes':_0x45730e[_0xca8a('0x13')]?_0x45730e[_0xca8a('0x13')]['attributes']||null:null,'limit':_0x45730e[_0xca8a('0x13')]?_0x45730e[_0xca8a('0x13')][_0xca8a('0x17')]||null:null,'order':_0x45730e['options']?_0x45730e[_0xca8a('0x13')][_0xca8a('0x2a')]||null:null,'transaction':_0x7adb5e,'lock':_0x7adb5e[_0xca8a('0x2b')][_0xca8a('0x2c')],'include':[{'model':db['CmContact'],'as':_0xca8a('0x2d'),'attributes':_[_0xca8a('0x2e')](_0x2538bc)},{'model':db['User'],'as':_0xca8a('0x2f'),'attributes':['id',_0xca8a('0x30'),_0xca8a('0x31')]}]})[_0xca8a('0x5')](function(_0x45088b){var _0x83cd8a=[];var _0x4ecba8=[];for(var _0x32ab6c=0x0;_0x32ab6c<_0x45088b[_0xca8a('0x32')];_0x32ab6c+=0x1){var _0x10126a=_0x45088b[_0x32ab6c]['UserId'];if(_0x10126a===null){_0x83cd8a[_0xca8a('0x33')](_0x45088b[_0x32ab6c]['update'](_0x45730e[_0xca8a('0x1f')],{'transaction':_0x7adb5e}));}else if(!_0x4ecba8['includes'](_0x10126a)){_0x4ecba8[_0xca8a('0x33')](_0x10126a);_0x83cd8a['push'](_0x45088b[_0x32ab6c][_0xca8a('0x34')](_0x45730e['body'],{'transaction':_0x7adb5e}));}}return BPromise[_0xca8a('0x35')](_0x83cd8a);});})[_0xca8a('0x5')](function(_0xb5c490){logger[_0xca8a('0x6')](_0xca8a('0x26'),_0x45730e);if(_0xb5c490['length']>0x0){logger['info'](_0xca8a('0x36'),_0xb5c490[0x0][_0xca8a('0x37')]['id'],_0xb5c490[0x0][_0xca8a('0x37')][_0xca8a('0x38')],_0xb5c490[0x0][_0xca8a('0x37')][_0xca8a('0x23')]);}logger['debug'](_0xca8a('0x26'),_0x45730e,JSON[_0xca8a('0xb')](_0xb5c490));_0x4fb1ed(_0xb5c490);})['catch'](function(_0x32498f){logger[_0xca8a('0xc')](_0xca8a('0x26'),_0x32498f[_0xca8a('0xe')],_0x45730e);_0x4f6f9c(_0x540bd2[_0xca8a('0xc')](0x1f4,_0x32498f[_0xca8a('0xe')]));});});});};exports[_0xca8a('0x39')]=function(_0x2851b5){var _0x5bafc7=this;return new Promise(function(_0x143231,_0x10d0d5){return db[_0xca8a('0x3a')][_0xca8a('0x29')](function(_0x33a510){return db['CmHopperFinal']['create'](_0x2851b5[_0xca8a('0x1f')],{'raw':_0x2851b5['options']?_0x2851b5['options'][_0xca8a('0x14')]===undefined?!![]:![]:!![],'transaction':_0x33a510})['then'](function(){logger[_0xca8a('0x6')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x2851b5['options']['where']),_0x2851b5['options'][_0xca8a('0x15')][_0xca8a('0x23')]);return db[_0xca8a('0x11')][_0xca8a('0x25')]({'where':_0x2851b5[_0xca8a('0x13')]?_0x2851b5[_0xca8a('0x13')][_0xca8a('0x15')]||null:null,'transaction':_0x33a510});});})[_0xca8a('0x5')](function(_0x1cc36b){logger[_0xca8a('0x6')](_0xca8a('0x39'),_0x2851b5);logger[_0xca8a('0x9')](_0xca8a('0x39'),_0x2851b5,JSON[_0xca8a('0xb')](_0x1cc36b));_0x143231(_0x1cc36b);})[_0xca8a('0x20')](function(_0x3e10bd){logger[_0xca8a('0xc')]('MoveContactManagedDialer',_0x3e10bd[_0xca8a('0xe')],_0x2851b5);_0x10d0d5(_0x5bafc7[_0xca8a('0xc')](0x1f4,_0x3e10bd['message']));});});};exports['CountReScheduled']=function(_0xf2f3e2){var _0x10b3c6=this;return new Promise(function(_0x1ff6e6,_0x118aa0){return db[_0xca8a('0x11')][_0xca8a('0x12')]({'raw':_0xf2f3e2[_0xca8a('0x13')]?_0xf2f3e2[_0xca8a('0x13')][_0xca8a('0x14')]===undefined?!![]:![]:!![],'where':_0xf2f3e2[_0xca8a('0x13')]?_0xf2f3e2[_0xca8a('0x13')][_0xca8a('0x15')]||null:null,'attributes':[[db['sequelize']['fn'](_0xca8a('0x3b'),db['sequelize']['fn']('IF',db['sequelize'][_0xca8a('0x3c')](_0xca8a('0x3d')+util[_0xca8a('0x3e')](_0xca8a('0x3f'),moment()['format'](_0xca8a('0x40')))+_0xca8a('0x41')))),'contactsRescheduled']]})[_0xca8a('0x5')](function(_0x1e8f77){logger[_0xca8a('0x6')](_0xca8a('0x42'),_0xf2f3e2);logger[_0xca8a('0x9')](_0xca8a('0x42'),_0xf2f3e2,JSON[_0xca8a('0xb')](_0x1e8f77));_0x1ff6e6(_0x1e8f77);})[_0xca8a('0x20')](function(_0x407506){logger[_0xca8a('0xc')](_0xca8a('0x42'),_0x407506[_0xca8a('0xe')],_0xf2f3e2);_0x118aa0(_0x10b3c6[_0xca8a('0xc')](0x1f4,_0x407506[_0xca8a('0xe')]));});});};exports['GetContactRecallMe']=function(_0x482e27){var _0x4e82b7=this;return new Promise(function(_0xa6bb4a,_0x271bcc){return db[_0xca8a('0x27')][_0xca8a('0x28')]()[_0xca8a('0x5')](function(_0x507f10){return db[_0xca8a('0x3a')]['transaction'](function(_0x2a2b26){return db[_0xca8a('0x11')][_0xca8a('0x12')]({'where':_0x482e27[_0xca8a('0x13')]?_0x482e27[_0xca8a('0x13')][_0xca8a('0x15')]||null:null,'attributes':_0x482e27[_0xca8a('0x13')]?_0x482e27[_0xca8a('0x13')][_0xca8a('0x16')]||null:null,'limit':0x1,'order':_0x482e27[_0xca8a('0x13')]?_0x482e27[_0xca8a('0x13')]['order']||null:null,'group':db[_0xca8a('0x11')][_0xca8a('0x43')],'transaction':_0x2a2b26,'lock':_0x2a2b26[_0xca8a('0x2b')][_0xca8a('0x2c')],'include':_0x482e27['options']?_0x482e27[_0xca8a('0x13')][_0xca8a('0x18')]?_[_0xca8a('0x19')](_0x482e27['options'][_0xca8a('0x18')],function(_0x4be124){return{'model':db[_0x4be124[_0xca8a('0x1a')]],'as':_0x4be124['as'],'attributes':_0x4be124[_0xca8a('0x16')],'include':_0x4be124['include']?_[_0xca8a('0x19')](_0x4be124[_0xca8a('0x18')],function(_0x95ffb){return{'model':db[_0x95ffb[_0xca8a('0x1a')]],'as':_0x95ffb['as'],'attributes':_0x95ffb['attributes'],'include':_0x95ffb[_0xca8a('0x18')]?_[_0xca8a('0x19')](_0x95ffb[_0xca8a('0x18')],function(_0x4c47a1){return{'model':db[_0x4c47a1[_0xca8a('0x1a')]],'as':_0x4c47a1['as'],'attributes':_0x4c47a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5104a2){var _0x389cc6=[];for(var _0x19ac9c=0x0;_0x19ac9c<_0x5104a2['length'];_0x19ac9c+=0x1){_0x389cc6[_0xca8a('0x33')](_0x5104a2[_0x19ac9c]['update'](_0x482e27[_0xca8a('0x1f')],{'transaction':_0x2a2b26}));}return BPromise[_0xca8a('0x35')](_0x389cc6);});})[_0xca8a('0x5')](function(_0x3187d3){logger['info'](_0xca8a('0x44'),_0x482e27);logger[_0xca8a('0x9')](_0xca8a('0x44'),_0x482e27,JSON['stringify'](_0x3187d3));_0xa6bb4a(_0x3187d3);})[_0xca8a('0x20')](function(_0x5b944f){logger[_0xca8a('0xc')](_0xca8a('0x44'),_0x5b944f[_0xca8a('0xe')],_0x482e27);_0x271bcc(_0x4e82b7[_0xca8a('0xc')](0x1f4,_0x5b944f[_0xca8a('0xe')]));});});});};exports[_0xca8a('0x45')]=function(_0x48c102){var _0x5bc755=this;return new Promise(function(_0x56c407,_0x146532){db[_0xca8a('0x27')][_0xca8a('0x28')]()[_0xca8a('0x5')](function(_0x2e54c2){return db[_0xca8a('0x11')]['findAll']({'raw':_0x48c102[_0xca8a('0x13')]?_0x48c102[_0xca8a('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x48c102[_0xca8a('0x13')]?_0x48c102['options']['where']||null:null,'attributes':_0x48c102[_0xca8a('0x13')]?_0x48c102['options'][_0xca8a('0x16')]||null:null,'limit':_0x48c102[_0xca8a('0x13')]?_0x48c102['options'][_0xca8a('0x17')]||null:null,'include':_0x48c102[_0xca8a('0x13')]?_0x48c102['options'][_0xca8a('0x18')]?_[_0xca8a('0x19')](_0x48c102[_0xca8a('0x13')]['include'],function(_0x15258c){return{'model':db[_0x15258c['model']],'as':_0x15258c['as'],'attributes':_0x15258c['as']===_0xca8a('0x2d')?_[_0xca8a('0x2e')](_0x2e54c2):_0x15258c['attributes'],'include':_0x15258c['include']?_['map'](_0x15258c[_0xca8a('0x18')],function(_0x46937b){return{'model':db[_0x46937b[_0xca8a('0x1a')]],'as':_0x46937b['as'],'attributes':_0x46937b[_0xca8a('0x16')],'include':_0x46937b[_0xca8a('0x18')]?_[_0xca8a('0x19')](_0x46937b['include'],function(_0xcddc3d){return{'model':db[_0xcddc3d[_0xca8a('0x1a')]],'as':_0xcddc3d['as'],'attributes':_0xcddc3d['attributes']};}):[]};}):[]};}):[]:[]})[_0xca8a('0x5')](function(_0x51e88e){logger[_0xca8a('0x6')](_0xca8a('0x10'),_0x48c102);logger[_0xca8a('0x9')](_0xca8a('0x10'),_0x48c102,JSON['stringify'](_0x51e88e));_0x56c407(_0x51e88e);})[_0xca8a('0x20')](function(_0x16cfa3){logger['error']('GetCmHopper',_0x16cfa3[_0xca8a('0xe')],_0x48c102);_0x146532(_0x5bc755[_0xca8a('0xc')](0x1f4,_0x16cfa3[_0xca8a('0xe')]));});});});};exports['GetContactByPhone']=function(_0x4b1045){var _0x58be1d=this;return new Promise(function(_0x167595,_0x3c2134){return db['CmContact'][_0xca8a('0x46')]({'raw':!![],'where':{'phone':_0x4b1045[_0xca8a('0x13')][_0xca8a('0x15')][_0xca8a('0x47')]},'attributes':['id',_0xca8a('0x48')],'order':[['id',_0xca8a('0x49')]]})['then'](function(_0x3d324a){logger[_0xca8a('0x6')](_0xca8a('0x4a'),_0x4b1045);logger[_0xca8a('0x9')]('getContactByPhone',_0x4b1045,JSON[_0xca8a('0xb')](_0x3d324a));_0x167595(_0x3d324a);})[_0xca8a('0x20')](function(_0x12fb68){logger[_0xca8a('0xc')](_0xca8a('0x4a'),_0x12fb68['message'],_0x4b1045);_0x3c2134(_0x58be1d[_0xca8a('0xc')](0x1f4,_0x12fb68[_0xca8a('0xe')]));});});};exports[_0xca8a('0x4b')]=function(_0x5cddb3){var _0x111995=this;return new Promise(function(_0x3e64b9,_0x46472a){return db[_0xca8a('0x3a')][_0xca8a('0x29')](function(_0x55a925){return db[_0xca8a('0x11')][_0xca8a('0x34')]({'active':![]},{'where':{},'transaction':_0x55a925})['then'](function(_0x305ce0){logger[_0xca8a('0x6')](_0xca8a('0x4b'),_0x5cddb3);logger[_0xca8a('0x9')](_0xca8a('0x4b'),_0x5cddb3,JSON[_0xca8a('0xb')](_0x305ce0));_0x3e64b9(_0x305ce0);})['catch'](function(_0x3bf0fe){logger[_0xca8a('0xc')]('ResetActiveCalls',_0x3bf0fe[_0xca8a('0xe')],_0x5cddb3);_0x46472a(_0x111995[_0xca8a('0xc')](0x1f4,_0x3bf0fe[_0xca8a('0xe')]));});});});};exports[_0xca8a('0x4c')]=function(_0x4c463a){var _0x4d3d1b=this;var _0x1825ce=_0x4c463a[_0xca8a('0x1f')][_0xca8a('0x15')][_0xca8a('0x4d')];var _0x456a29=_0x4c463a['body'][_0xca8a('0x15')][_0xca8a('0x4e')];var _0x5bf0b9=_0x4c463a[_0xca8a('0x1f')][_0xca8a('0x15')][_0xca8a('0x4f')];return new Promise(function(_0x371886,_0x38fea7){return db[_0xca8a('0x11')]['findAll']({'where':{'voiceQueueId':{'$in':_0x1825ce},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xca8a('0x3a')][_0xca8a('0x3c')]('NOW()\x20+\x20INTERVAL\x20'+_0x456a29+_0xca8a('0x50')),'$gt':db[_0xca8a('0x3a')][_0xca8a('0x3c')](_0xca8a('0x51'))}},'UserId':{'$in':_0x5bf0b9}},'include':[{'model':db[_0xca8a('0x27')],'as':_0xca8a('0x2d')},{'model':db[_0xca8a('0x52')],'as':_0xca8a('0x2f'),'attributes':['id',_0xca8a('0x30'),_0xca8a('0x31')]},{'model':db['CmList'],'as':_0xca8a('0x53')}]})[_0xca8a('0x5')](function(_0x4cf137){if(_0x4cf137[_0xca8a('0x32')]>0x0){return db[_0xca8a('0x3a')][_0xca8a('0x29')](function(_0x18dbbd){return db[_0xca8a('0x11')][_0xca8a('0x34')]({'recallmeNotifiedDate':db['sequelize']['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0x4cf137,'id')}},'transaction':_0x18dbbd})[_0xca8a('0x5')](function(){_0x371886(_0x4cf137);})[_0xca8a('0x20')](function(_0x8d4b8){logger[_0xca8a('0xc')](_0xca8a('0x4c'),_0x8d4b8[_0xca8a('0xe')],_0x4c463a);_0x38fea7(_0x4d3d1b['error'](0x1f4,_0x8d4b8[_0xca8a('0xe')]));});})['catch'](function(_0x2d79f9){logger[_0xca8a('0xc')](_0xca8a('0x4c'),_0x2d79f9[_0xca8a('0xe')],_0x4c463a);_0x38fea7(_0x4d3d1b[_0xca8a('0xc')](0x1f4,_0x2d79f9[_0xca8a('0xe')]));});}else{_0x371886(_0x4cf137);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 060e704..df8b390 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 _0x8b03=['/describe','/timezones','getTimezones','/:id','/:id/previewrecall','post','create','getPreview','/timezone','getTimezone','put','delete','express','Router','./cmHopper.controller','get','isAuthenticated','index'];(function(_0x1fab4c,_0x108550){var _0x1ce889=function(_0x25f499){while(--_0x25f499){_0x1fab4c['push'](_0x1fab4c['shift']());}};_0x1ce889(++_0x108550);}(_0x8b03,0xae));var _0x38b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b03[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x38b0('0x0'));var router=express[_0x38b0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x38b0('0x2'));router[_0x38b0('0x3')]('/',auth[_0x38b0('0x4')](),controller[_0x38b0('0x5')]);router[_0x38b0('0x3')](_0x38b0('0x6'),auth[_0x38b0('0x4')](),controller['describe']);router[_0x38b0('0x3')]('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x38b0('0x3')](_0x38b0('0x7'),auth[_0x38b0('0x4')](),controller[_0x38b0('0x8')]);router[_0x38b0('0x3')](_0x38b0('0x9'),auth[_0x38b0('0x4')](),controller['show']);router[_0x38b0('0x3')](_0x38b0('0xa'),auth[_0x38b0('0x4')](),controller['getPreviewRecall']);router[_0x38b0('0xb')]('/',auth[_0x38b0('0x4')](),controller[_0x38b0('0xc')]);router[_0x38b0('0xb')]('/preview',auth[_0x38b0('0x4')](),controller[_0x38b0('0xd')]);router[_0x38b0('0xb')](_0x38b0('0xe'),auth[_0x38b0('0x4')](),controller[_0x38b0('0xf')]);router[_0x38b0('0x10')](_0x38b0('0x9'),auth[_0x38b0('0x4')](),controller['update']);router[_0x38b0('0x11')](_0x38b0('0x9'),auth[_0x38b0('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5a0e=['/timezone','getTimezone','put','update','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','getOpenContacts','/timezones','getTimezones','/:id','getPreviewRecall','post','create','/preview','getPreview'];(function(_0x4963e7,_0x27697c){var _0x5c4a71=function(_0x1015c6){while(--_0x1015c6){_0x4963e7['push'](_0x4963e7['shift']());}};_0x5c4a71(++_0x27697c);}(_0x5a0e,0x138));var _0xe5a0=function(_0x487ed4,_0x312026){_0x487ed4=_0x487ed4-0x0;var _0xa1193e=_0x5a0e[_0x487ed4];return _0xa1193e;};'use strict';var express=require(_0xe5a0('0x0'));var router=express[_0xe5a0('0x1')]();var auth=require(_0xe5a0('0x2'));var controller=require(_0xe5a0('0x3'));router[_0xe5a0('0x4')]('/',auth['isAuthenticated'](),controller[_0xe5a0('0x5')]);router[_0xe5a0('0x4')](_0xe5a0('0x6'),auth[_0xe5a0('0x7')](),controller[_0xe5a0('0x8')]);router[_0xe5a0('0x4')]('/opencontacts',auth[_0xe5a0('0x7')](),controller[_0xe5a0('0x9')]);router[_0xe5a0('0x4')](_0xe5a0('0xa'),auth['isAuthenticated'](),controller[_0xe5a0('0xb')]);router[_0xe5a0('0x4')](_0xe5a0('0xc'),auth[_0xe5a0('0x7')](),controller['show']);router[_0xe5a0('0x4')]('/:id/previewrecall',auth[_0xe5a0('0x7')](),controller[_0xe5a0('0xd')]);router[_0xe5a0('0xe')]('/',auth['isAuthenticated'](),controller[_0xe5a0('0xf')]);router[_0xe5a0('0xe')](_0xe5a0('0x10'),auth[_0xe5a0('0x7')](),controller[_0xe5a0('0x11')]);router[_0xe5a0('0xe')](_0xe5a0('0x12'),auth['isAuthenticated'](),controller[_0xe5a0('0x13')]);router[_0xe5a0('0x14')](_0xe5a0('0xc'),auth['isAuthenticated'](),controller[_0xe5a0('0x15')]);router['delete']('/:id',auth[_0xe5a0('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 2d0ff96..25b7833 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 _0x6255=['moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6255,0x150));var _0x5625=function(_0x46e5fc,_0x5db9aa){_0x46e5fc=_0x46e5fc-0x0;var _0x52f4e6=_0x6255[_0x46e5fc];return _0x52f4e6;};'use strict';var moment=require(_0x5625('0x0'));var Sequelize=require(_0x5625('0x1'));module[_0x5625('0x2')]={'CmHopperId':{'type':Sequelize[_0x5625('0x3')]},'phone':{'type':Sequelize[_0x5625('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5625('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5625('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x5625('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5625('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5625('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5625('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5625('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5625('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xde42=['INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde42,0x18f));var _0x2de4=function(_0x3c8018,_0x4f3203){_0x3c8018=_0x3c8018-0x0;var _0x1ad526=_0xde42[_0x3c8018];return _0x1ad526;};'use strict';var moment=require(_0x2de4('0x0'));var Sequelize=require(_0x2de4('0x1'));module[_0x2de4('0x2')]={'CmHopperId':{'type':Sequelize[_0x2de4('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2de4('0x4')],'defaultValue':moment()['format'](_0x2de4('0x5'))},'countbusyretry':{'type':Sequelize[_0x2de4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2de4('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2de4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2de4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2de4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2de4('0x3')],'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 5323dc6..3913b5d 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 _0xed4b=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperAdditionalPhone','includeAll','include','rows','catch','show','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','find','userProfileId','autoAssociation','eml-format','fast-json-patch','request-promise'];(function(_0x5ee0d6,_0x39d6d1){var _0x5c0d67=function(_0x58dbe9){while(--_0x58dbe9){_0x5ee0d6['push'](_0x5ee0d6['shift']());}};_0x5c0d67(++_0x39d6d1);}(_0xed4b,0x139));var _0xbed4=function(_0xca80a0,_0x3bba1d){_0xca80a0=_0xca80a0-0x0;var _0x496b4e=_0xed4b[_0xca80a0];return _0x496b4e;};'use strict';var emlformat=require(_0xbed4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbed4('0x1'));var rp=require(_0xbed4('0x2'));var moment=require(_0xbed4('0x3'));var BPromise=require(_0xbed4('0x4'));var Mustache=require(_0xbed4('0x5'));var util=require(_0xbed4('0x6'));var path=require(_0xbed4('0x7'));var sox=require(_0xbed4('0x8'));var csv=require(_0xbed4('0x9'));var ejs=require(_0xbed4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbed4('0xb'));var crypto=require(_0xbed4('0xc'));var jsforce=require(_0xbed4('0xd'));var deskjs=require(_0xbed4('0xe'));var toCsv=require(_0xbed4('0x9'));var querystring=require('querystring');var Papa=require(_0xbed4('0xf'));var Redis=require(_0xbed4('0x10'));var authService=require(_0xbed4('0x11'));var qs=require(_0xbed4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbed4('0x13'));var logger=require(_0xbed4('0x14'))(_0xbed4('0x15'));var utils=require('../../config/utils');var config=require(_0xbed4('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e292a,_0x1de9ff){_0x1de9ff=_0x1de9ff||0xcc;return function(_0x34847c){if(_0x34847c){return _0x4e292a[_0xbed4('0x17')](_0x1de9ff);}return _0x4e292a['status'](_0x1de9ff)[_0xbed4('0x18')]();};}function respondWithResult(_0x319b10,_0x123ab0){_0x123ab0=_0x123ab0||0xc8;return function(_0x5cb240){if(_0x5cb240){return _0x319b10['status'](_0x123ab0)[_0xbed4('0x19')](_0x5cb240);}};}function respondWithFilteredResult(_0x2cf95b,_0x3db0f4){return function(_0x3911e6){if(_0x3911e6){var _0x4b55c8=typeof _0x3db0f4[_0xbed4('0x1a')]===_0xbed4('0x1b')&&typeof _0x3db0f4[_0xbed4('0x1c')]===_0xbed4('0x1b');var _0x229d3b=_0x3911e6[_0xbed4('0x1d')];var _0x1f938a=_0x4b55c8?0x0:_0x3db0f4['offset'];var _0x4e22f5=_0x4b55c8?_0x3911e6['count']:_0x3db0f4['offset']+_0x3db0f4['limit'];var _0x41b78a;if(_0x4e22f5>=_0x229d3b){_0x4e22f5=_0x229d3b;_0x41b78a=0xc8;}else{_0x41b78a=0xce;}_0x2cf95b[_0xbed4('0x1e')](_0x41b78a);return _0x2cf95b['set']('Content-Range',_0x1f938a+'-'+_0x4e22f5+'/'+_0x229d3b)[_0xbed4('0x19')](_0x3911e6);}return null;};}function patchUpdates(_0x3dafd9){return function(_0x5a9ce2){try{jsonpatch['apply'](_0x5a9ce2,_0x3dafd9,!![]);}catch(_0x239360){return BPromise['reject'](_0x239360);}return _0x5a9ce2[_0xbed4('0x1f')]();};}function saveUpdates(_0x1574f9,_0x15d87c){return function(_0x4afcbc){if(_0x4afcbc){return _0x4afcbc[_0xbed4('0x20')](_0x1574f9)[_0xbed4('0x21')](function(_0x1150e4){return _0x1150e4;});}return null;};}function removeEntity(_0x8b6805,_0x56aa70){return function(_0x3939e4){if(_0x3939e4){return _0x3939e4[_0xbed4('0x22')]()[_0xbed4('0x21')](function(){var _0x578071=_0x3939e4[_0xbed4('0x23')]({'plain':!![]});var _0x3b5804='CmHopperAdditionalPhones';return db[_0xbed4('0x24')]['destroy']({'where':{'type':_0x3b5804,'resourceId':_0x578071['id']}})[_0xbed4('0x21')](function(){return _0x3939e4;});})[_0xbed4('0x21')](function(){_0x8b6805['status'](0xcc)[_0xbed4('0x18')]();});}};}function handleEntityNotFound(_0x27e899,_0x346b6d){return function(_0x3359b7){if(!_0x3359b7){_0x27e899[_0xbed4('0x17')](0x194);}return _0x3359b7;};}function handleError(_0x49fdfb,_0x3a913d){_0x3a913d=_0x3a913d||0x1f4;return function(_0x32ab16){logger[_0xbed4('0x25')](_0x32ab16[_0xbed4('0x26')]);if(_0x32ab16['name']){delete _0x32ab16[_0xbed4('0x27')];}_0x49fdfb[_0xbed4('0x1e')](_0x3a913d)[_0xbed4('0x28')](_0x32ab16);};}exports[_0xbed4('0x29')]=function(_0x4ccac9,_0x33ea9f){var _0x171d67={},_0x11b8c={},_0x3ca882={'count':0x0,'rows':[]};var _0x43f688=_[_0xbed4('0x2a')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x5ed926){return{'name':_0x5ed926[_0xbed4('0x2b')],'type':_0x5ed926[_0xbed4('0x2c')][_0xbed4('0x2d')]};});_0x11b8c[_0xbed4('0x2e')]=_[_0xbed4('0x2a')](_0x43f688,'name');_0x11b8c[_0xbed4('0x2f')]=_['keys'](_0x4ccac9[_0xbed4('0x2f')]);_0x11b8c[_0xbed4('0x30')]=_[_0xbed4('0x31')](_0x11b8c[_0xbed4('0x2e')],_0x11b8c[_0xbed4('0x2f')]);_0x171d67['attributes']=_[_0xbed4('0x31')](_0x11b8c['model'],qs[_0xbed4('0x32')](_0x4ccac9[_0xbed4('0x2f')]['fields']));_0x171d67[_0xbed4('0x33')]=_0x171d67[_0xbed4('0x33')][_0xbed4('0x34')]?_0x171d67[_0xbed4('0x33')]:_0x11b8c['model'];if(!_0x4ccac9[_0xbed4('0x2f')][_0xbed4('0x35')]('nolimit')){_0x171d67[_0xbed4('0x1c')]=qs[_0xbed4('0x1c')](_0x4ccac9['query'][_0xbed4('0x1c')]);_0x171d67['offset']=qs[_0xbed4('0x1a')](_0x4ccac9[_0xbed4('0x2f')][_0xbed4('0x1a')]);}_0x171d67[_0xbed4('0x36')]=qs[_0xbed4('0x37')](_0x4ccac9[_0xbed4('0x2f')][_0xbed4('0x37')]);_0x171d67[_0xbed4('0x38')]=qs[_0xbed4('0x30')](_[_0xbed4('0x39')](_0x4ccac9[_0xbed4('0x2f')],_0x11b8c[_0xbed4('0x30')]),_0x43f688);if(_0x4ccac9[_0xbed4('0x2f')][_0xbed4('0x3a')]){_0x171d67[_0xbed4('0x38')]=_[_0xbed4('0x3b')](_0x171d67[_0xbed4('0x38')],{'$or':_[_0xbed4('0x2a')](_0x43f688,function(_0x303d35){if(_0x303d35[_0xbed4('0x2c')]!==_0xbed4('0x3c')){var _0x449661={};_0x449661[_0x303d35['name']]={'$like':'%'+_0x4ccac9[_0xbed4('0x2f')][_0xbed4('0x3a')]+'%'};return _0x449661;}})});}_0x171d67=_[_0xbed4('0x3b')]({},_0x171d67,_0x4ccac9['options']);var _0xc71f2c={'where':_0x171d67[_0xbed4('0x38')]};return db[_0xbed4('0x3d')][_0xbed4('0x1d')](_0xc71f2c)[_0xbed4('0x21')](function(_0x1d950f){_0x3ca882['count']=_0x1d950f;if(_0x4ccac9[_0xbed4('0x2f')][_0xbed4('0x3e')]){_0x171d67[_0xbed4('0x3f')]=[{'all':!![]}];}return db[_0xbed4('0x3d')]['findAll'](_0x171d67);})[_0xbed4('0x21')](function(_0x15151a){_0x3ca882[_0xbed4('0x40')]=_0x15151a;return _0x3ca882;})[_0xbed4('0x21')](respondWithFilteredResult(_0x33ea9f,_0x171d67))[_0xbed4('0x41')](handleError(_0x33ea9f,null));};exports[_0xbed4('0x42')]=function(_0x4473f5,_0x458bf2){var _0x386691={'raw':!![],'where':{'id':_0x4473f5[_0xbed4('0x43')]['id']}},_0x57f397={};_0x57f397[_0xbed4('0x2e')]=_['keys'](db[_0xbed4('0x3d')]['rawAttributes']);_0x57f397['query']=_[_0xbed4('0x44')](_0x4473f5[_0xbed4('0x2f')]);_0x57f397['filters']=_['intersection'](_0x57f397['model'],_0x57f397[_0xbed4('0x2f')]);_0x386691[_0xbed4('0x33')]=_['intersection'](_0x57f397[_0xbed4('0x2e')],qs[_0xbed4('0x32')](_0x4473f5[_0xbed4('0x2f')][_0xbed4('0x32')]));_0x386691[_0xbed4('0x33')]=_0x386691[_0xbed4('0x33')]['length']?_0x386691[_0xbed4('0x33')]:_0x57f397['model'];if(_0x4473f5['query'][_0xbed4('0x3e')]){_0x386691[_0xbed4('0x3f')]=[{'all':!![]}];}_0x386691=_[_0xbed4('0x3b')]({},_0x386691,_0x4473f5[_0xbed4('0x45')]);return db[_0xbed4('0x3d')]['find'](_0x386691)['then'](handleEntityNotFound(_0x458bf2,null))['then'](respondWithResult(_0x458bf2,null))['catch'](handleError(_0x458bf2,null));};exports['create']=function(_0x5cdef1,_0x465867){return db[_0xbed4('0x3d')][_0xbed4('0x46')](_0x5cdef1[_0xbed4('0x47')],{})[_0xbed4('0x21')](function(_0x3b301b){var _0x311a38=_0x5cdef1[_0xbed4('0x48')][_0xbed4('0x23')]({'plain':!![]});if(!_0x311a38)throw new Error(_0xbed4('0x49'));if(_0x311a38['role']===_0xbed4('0x48')){var _0x2e0dbf=_0x3b301b[_0xbed4('0x23')]({'plain':!![]});var _0x1fbbac=_0xbed4('0x4a');return db[_0xbed4('0x4b')][_0xbed4('0x4c')]({'where':{'name':_0x1fbbac,'userProfileId':_0x311a38[_0xbed4('0x4d')]},'raw':!![]})['then'](function(_0x3c1902){if(_0x3c1902&&_0x3c1902[_0xbed4('0x4e')]===0x0){return db['UserProfileResource'][_0xbed4('0x46')]({'name':_0x2e0dbf[_0xbed4('0x27')],'resourceId':_0x2e0dbf['id'],'type':_0x3c1902[_0xbed4('0x27')],'sectionId':_0x3c1902['id']},{})['then'](function(){return _0x3b301b;});}else{return _0x3b301b;}})[_0xbed4('0x41')](function(_0x57f233){logger[_0xbed4('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57f233);throw _0x57f233;});}return _0x3b301b;})[_0xbed4('0x21')](respondWithResult(_0x465867,0xc9))[_0xbed4('0x41')](handleError(_0x465867,null));};exports[_0xbed4('0x20')]=function(_0x4ca5eb,_0x1aa489){if(_0x4ca5eb['body']['id']){delete _0x4ca5eb[_0xbed4('0x47')]['id'];}return db[_0xbed4('0x3d')][_0xbed4('0x4c')]({'where':{'id':_0x4ca5eb['params']['id']}})[_0xbed4('0x21')](handleEntityNotFound(_0x1aa489,null))[_0xbed4('0x21')](saveUpdates(_0x4ca5eb[_0xbed4('0x47')],null))[_0xbed4('0x21')](respondWithResult(_0x1aa489,null))['catch'](handleError(_0x1aa489,null));};exports[_0xbed4('0x22')]=function(_0x56602e,_0x23287f){return db[_0xbed4('0x3d')][_0xbed4('0x4c')]({'where':{'id':_0x56602e[_0xbed4('0x43')]['id']}})[_0xbed4('0x21')](handleEntityNotFound(_0x23287f,null))[_0xbed4('0x21')](removeEntity(_0x23287f,null))['catch'](handleError(_0x23287f,null));}; \ No newline at end of file +var _0xc72c=['offset','undefined','limit','count','set','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','findAll','rows','catch','params','includeAll','include','find','create','user','get','role','CmHopperAdditionalPhones','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x376849,_0x1f9df0){var _0xf4e7a9=function(_0x56be35){while(--_0x56be35){_0x376849['push'](_0x376849['shift']());}};_0xf4e7a9(++_0x1f9df0);}(_0xc72c,0x87));var _0xcc72=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc72c[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0xcc72('0x0'));var rimraf=require(_0xcc72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc72('0x2'));var rp=require(_0xcc72('0x3'));var moment=require(_0xcc72('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcc72('0x5'));var util=require(_0xcc72('0x6'));var path=require(_0xcc72('0x7'));var sox=require(_0xcc72('0x8'));var csv=require(_0xcc72('0x9'));var ejs=require(_0xcc72('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcc72('0xb'));var crypto=require(_0xcc72('0xc'));var jsforce=require(_0xcc72('0xd'));var deskjs=require(_0xcc72('0xe'));var toCsv=require(_0xcc72('0x9'));var querystring=require(_0xcc72('0xf'));var Papa=require(_0xcc72('0x10'));var Redis=require(_0xcc72('0x11'));var authService=require(_0xcc72('0x12'));var qs=require(_0xcc72('0x13'));var as=require(_0xcc72('0x14'));var hardwareService=require(_0xcc72('0x15'));var logger=require('../../config/logger')(_0xcc72('0x16'));var utils=require(_0xcc72('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcc72('0x18'))['db'];function respondWithStatusCode(_0x1e8669,_0x3dd262){_0x3dd262=_0x3dd262||0xcc;return function(_0x1691f7){if(_0x1691f7){return _0x1e8669[_0xcc72('0x19')](_0x3dd262);}return _0x1e8669[_0xcc72('0x1a')](_0x3dd262)[_0xcc72('0x1b')]();};}function respondWithResult(_0x593e7a,_0x62f25){_0x62f25=_0x62f25||0xc8;return function(_0x201377){if(_0x201377){return _0x593e7a['status'](_0x62f25)[_0xcc72('0x1c')](_0x201377);}};}function respondWithFilteredResult(_0x50bb9f,_0x1229c5){return function(_0x49b86f){if(_0x49b86f){var _0x4ecfa2=typeof _0x1229c5[_0xcc72('0x1d')]===_0xcc72('0x1e')&&typeof _0x1229c5[_0xcc72('0x1f')]==='undefined';var _0x2094c3=_0x49b86f[_0xcc72('0x20')];var _0x5d73a1=_0x4ecfa2?0x0:_0x1229c5['offset'];var _0x4be21c=_0x4ecfa2?_0x49b86f[_0xcc72('0x20')]:_0x1229c5[_0xcc72('0x1d')]+_0x1229c5['limit'];var _0xa41e1b;if(_0x4be21c>=_0x2094c3){_0x4be21c=_0x2094c3;_0xa41e1b=0xc8;}else{_0xa41e1b=0xce;}_0x50bb9f[_0xcc72('0x1a')](_0xa41e1b);return _0x50bb9f[_0xcc72('0x21')]('Content-Range',_0x5d73a1+'-'+_0x4be21c+'/'+_0x2094c3)[_0xcc72('0x1c')](_0x49b86f);}return null;};}function patchUpdates(_0x4dd6db){return function(_0x585e7c){try{jsonpatch['apply'](_0x585e7c,_0x4dd6db,!![]);}catch(_0x17b70a){return BPromise[_0xcc72('0x22')](_0x17b70a);}return _0x585e7c[_0xcc72('0x23')]();};}function saveUpdates(_0x4b6de6,_0x3b7f37){return function(_0x125b11){if(_0x125b11){return _0x125b11[_0xcc72('0x24')](_0x4b6de6)['then'](function(_0x58312b){return _0x58312b;});}return null;};}function removeEntity(_0x511697,_0x4e1610){return function(_0x373574){if(_0x373574){return _0x373574[_0xcc72('0x25')]()[_0xcc72('0x26')](function(){var _0x123471=_0x373574['get']({'plain':!![]});var _0x549ddb='CmHopperAdditionalPhones';return db[_0xcc72('0x27')][_0xcc72('0x25')]({'where':{'type':_0x549ddb,'resourceId':_0x123471['id']}})[_0xcc72('0x26')](function(){return _0x373574;});})['then'](function(){_0x511697['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb41f0d,_0x7f585a){return function(_0x137095){if(!_0x137095){_0xb41f0d[_0xcc72('0x19')](0x194);}return _0x137095;};}function handleError(_0x3045bd,_0x130dbe){_0x130dbe=_0x130dbe||0x1f4;return function(_0x2236a3){logger[_0xcc72('0x28')](_0x2236a3[_0xcc72('0x29')]);if(_0x2236a3[_0xcc72('0x2a')]){delete _0x2236a3[_0xcc72('0x2a')];}_0x3045bd[_0xcc72('0x1a')](_0x130dbe)[_0xcc72('0x2b')](_0x2236a3);};}exports[_0xcc72('0x2c')]=function(_0xcdf49d,_0x20ad54){var _0x2918dd={},_0x1a5dcf={},_0x56fccf={'count':0x0,'rows':[]};var _0x1a0c3b=_[_0xcc72('0x2d')](db[_0xcc72('0x2e')][_0xcc72('0x2f')],function(_0x4dc02e){return{'name':_0x4dc02e[_0xcc72('0x30')],'type':_0x4dc02e['type']['key']};});_0x1a5dcf[_0xcc72('0x31')]=_[_0xcc72('0x2d')](_0x1a0c3b,'name');_0x1a5dcf[_0xcc72('0x32')]=_[_0xcc72('0x33')](_0xcdf49d[_0xcc72('0x32')]);_0x1a5dcf[_0xcc72('0x34')]=_[_0xcc72('0x35')](_0x1a5dcf[_0xcc72('0x31')],_0x1a5dcf[_0xcc72('0x32')]);_0x2918dd['attributes']=_[_0xcc72('0x35')](_0x1a5dcf[_0xcc72('0x31')],qs['fields'](_0xcdf49d['query'][_0xcc72('0x36')]));_0x2918dd[_0xcc72('0x37')]=_0x2918dd[_0xcc72('0x37')][_0xcc72('0x38')]?_0x2918dd['attributes']:_0x1a5dcf['model'];if(!_0xcdf49d[_0xcc72('0x32')][_0xcc72('0x39')](_0xcc72('0x3a'))){_0x2918dd[_0xcc72('0x1f')]=qs[_0xcc72('0x1f')](_0xcdf49d[_0xcc72('0x32')][_0xcc72('0x1f')]);_0x2918dd[_0xcc72('0x1d')]=qs['offset'](_0xcdf49d[_0xcc72('0x32')][_0xcc72('0x1d')]);}_0x2918dd[_0xcc72('0x3b')]=qs[_0xcc72('0x3c')](_0xcdf49d[_0xcc72('0x32')]['sort']);_0x2918dd['where']=qs[_0xcc72('0x34')](_[_0xcc72('0x3d')](_0xcdf49d[_0xcc72('0x32')],_0x1a5dcf[_0xcc72('0x34')]),_0x1a0c3b);if(_0xcdf49d['query'][_0xcc72('0x3e')]){_0x2918dd[_0xcc72('0x3f')]=_[_0xcc72('0x40')](_0x2918dd[_0xcc72('0x3f')],{'$or':_['map'](_0x1a0c3b,function(_0x1fa3af){if(_0x1fa3af[_0xcc72('0x41')]!=='VIRTUAL'){var _0x17ada6={};_0x17ada6[_0x1fa3af[_0xcc72('0x2a')]]={'$like':'%'+_0xcdf49d[_0xcc72('0x32')][_0xcc72('0x3e')]+'%'};return _0x17ada6;}})});}_0x2918dd=_[_0xcc72('0x40')]({},_0x2918dd,_0xcdf49d[_0xcc72('0x42')]);var _0x6468b5={'where':_0x2918dd[_0xcc72('0x3f')]};return db[_0xcc72('0x2e')][_0xcc72('0x20')](_0x6468b5)[_0xcc72('0x26')](function(_0x228e81){_0x56fccf[_0xcc72('0x20')]=_0x228e81;if(_0xcdf49d[_0xcc72('0x32')]['includeAll']){_0x2918dd['include']=[{'all':!![]}];}return db[_0xcc72('0x2e')][_0xcc72('0x43')](_0x2918dd);})[_0xcc72('0x26')](function(_0x5aabc1){_0x56fccf[_0xcc72('0x44')]=_0x5aabc1;return _0x56fccf;})['then'](respondWithFilteredResult(_0x20ad54,_0x2918dd))[_0xcc72('0x45')](handleError(_0x20ad54,null));};exports['show']=function(_0x8beeb8,_0x1378e8){var _0x492ca5={'raw':!![],'where':{'id':_0x8beeb8[_0xcc72('0x46')]['id']}},_0x5c3ed8={};_0x5c3ed8[_0xcc72('0x31')]=_[_0xcc72('0x33')](db[_0xcc72('0x2e')][_0xcc72('0x2f')]);_0x5c3ed8['query']=_['keys'](_0x8beeb8[_0xcc72('0x32')]);_0x5c3ed8[_0xcc72('0x34')]=_[_0xcc72('0x35')](_0x5c3ed8[_0xcc72('0x31')],_0x5c3ed8[_0xcc72('0x32')]);_0x492ca5[_0xcc72('0x37')]=_[_0xcc72('0x35')](_0x5c3ed8[_0xcc72('0x31')],qs['fields'](_0x8beeb8['query'][_0xcc72('0x36')]));_0x492ca5[_0xcc72('0x37')]=_0x492ca5['attributes'][_0xcc72('0x38')]?_0x492ca5[_0xcc72('0x37')]:_0x5c3ed8[_0xcc72('0x31')];if(_0x8beeb8['query'][_0xcc72('0x47')]){_0x492ca5[_0xcc72('0x48')]=[{'all':!![]}];}_0x492ca5=_[_0xcc72('0x40')]({},_0x492ca5,_0x8beeb8[_0xcc72('0x42')]);return db[_0xcc72('0x2e')][_0xcc72('0x49')](_0x492ca5)[_0xcc72('0x26')](handleEntityNotFound(_0x1378e8,null))['then'](respondWithResult(_0x1378e8,null))['catch'](handleError(_0x1378e8,null));};exports[_0xcc72('0x4a')]=function(_0x537234,_0x52035e){return db['CmHopperAdditionalPhone'][_0xcc72('0x4a')](_0x537234['body'],{})['then'](function(_0x2db856){var _0x54eba0=_0x537234[_0xcc72('0x4b')][_0xcc72('0x4c')]({'plain':!![]});if(!_0x54eba0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54eba0[_0xcc72('0x4d')]===_0xcc72('0x4b')){var _0x4c33df=_0x2db856[_0xcc72('0x4c')]({'plain':!![]});var _0x4e46bc=_0xcc72('0x4e');return db[_0xcc72('0x4f')][_0xcc72('0x49')]({'where':{'name':_0x4e46bc,'userProfileId':_0x54eba0['userProfileId']},'raw':!![]})[_0xcc72('0x26')](function(_0x269ec2){if(_0x269ec2&&_0x269ec2['autoAssociation']===0x0){return db[_0xcc72('0x27')]['create']({'name':_0x4c33df[_0xcc72('0x2a')],'resourceId':_0x4c33df['id'],'type':_0x269ec2[_0xcc72('0x2a')],'sectionId':_0x269ec2['id']},{})['then'](function(){return _0x2db856;});}else{return _0x2db856;}})[_0xcc72('0x45')](function(_0x33fab8){logger[_0xcc72('0x28')](_0xcc72('0x50'),_0x33fab8);throw _0x33fab8;});}return _0x2db856;})[_0xcc72('0x26')](respondWithResult(_0x52035e,0xc9))[_0xcc72('0x45')](handleError(_0x52035e,null));};exports[_0xcc72('0x24')]=function(_0xd43c85,_0xe981ac){if(_0xd43c85[_0xcc72('0x51')]['id']){delete _0xd43c85[_0xcc72('0x51')]['id'];}return db[_0xcc72('0x2e')]['find']({'where':{'id':_0xd43c85[_0xcc72('0x46')]['id']}})['then'](handleEntityNotFound(_0xe981ac,null))[_0xcc72('0x26')](saveUpdates(_0xd43c85['body'],null))[_0xcc72('0x26')](respondWithResult(_0xe981ac,null))[_0xcc72('0x45')](handleError(_0xe981ac,null));};exports[_0xcc72('0x25')]=function(_0x82ac74,_0x455a4d){return db[_0xcc72('0x2e')][_0xcc72('0x49')]({'where':{'id':_0x82ac74[_0xcc72('0x46')]['id']}})[_0xcc72('0x26')](handleEntityNotFound(_0x455a4d,null))[_0xcc72('0x26')](removeEntity(_0x455a4d,null))['catch'](handleError(_0x455a4d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index af72319..8a9a596 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 _0x0717=['bluebird','path','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','util','../../config/logger','api'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x0717,0x72));var _0x7071=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0717[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x7071('0x0'));var logger=require(_0x7071('0x1'))(_0x7071('0x2'));var moment=require('moment');var BPromise=require(_0x7071('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7071('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7071('0x5'));module[_0x7071('0x6')]=function(_0x3936f4,_0x252d73){return _0x3936f4[_0x7071('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x7071('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe642=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5aa8b0,_0x25ebdb){var _0x272e16=function(_0x5e8a59){while(--_0x5e8a59){_0x5aa8b0['push'](_0x5aa8b0['shift']());}};_0x272e16(++_0x25ebdb);}(_0xe642,0x17c));var _0x2e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2e64('0x0'));var util=require('util');var logger=require(_0x2e64('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2e64('0x2'));var rp=require(_0x2e64('0x3'));var fs=require('fs');var path=require(_0x2e64('0x4'));var rimraf=require(_0x2e64('0x5'));var config=require(_0x2e64('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x4af34a,_0x14eb3d){return _0x4af34a['define'](_0x2e64('0x7'),attributes,{'tableName':_0x2e64('0x8'),'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 8cf739e..da07633 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 _0x5330=['updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','SwapAdditionalPhones','waitTime','duration','scheduledat','add','minutes','isNil','phone','createdAt'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x5330,0xe4));var _0x0533=function(_0x2bc425,_0x165e0d){_0x2bc425=_0x2bc425-0x0;var _0x4db266=_0x5330[_0x2bc425];return _0x4db266;};'use strict';var _=require(_0x0533('0x0'));var util=require('util');var moment=require(_0x0533('0x1'));var BPromise=require(_0x0533('0x2'));var rs=require(_0x0533('0x3'));var fs=require('fs');var Redis=require(_0x0533('0x4'));var db=require(_0x0533('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0533('0x6'))(_0x0533('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0533('0x8')][_0x0533('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ae90b,_0x1de94a,_0x21b029){return new BPromise(function(_0x20ba43,_0x1e7428){return client[_0x0533('0xa')](_0x1ae90b,_0x21b029)[_0x0533('0xb')](function(_0x1b38f7){logger[_0x0533('0xc')](_0x0533('0xd'),_0x1de94a,_0x0533('0xe'));logger[_0x0533('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1de94a,'request\x20sent',JSON[_0x0533('0x10')](_0x1b38f7));if(_0x1b38f7[_0x0533('0x11')]){if(_0x1b38f7[_0x0533('0x11')][_0x0533('0x12')]===0x1f4){logger[_0x0533('0x11')](_0x0533('0xd'),_0x1de94a,_0x1b38f7[_0x0533('0x11')][_0x0533('0x13')]);return _0x1e7428(_0x1b38f7['error'][_0x0533('0x13')]);}logger[_0x0533('0x11')](_0x0533('0xd'),_0x1de94a,_0x1b38f7[_0x0533('0x11')][_0x0533('0x13')]);return _0x20ba43(_0x1b38f7[_0x0533('0x11')][_0x0533('0x13')]);}else{logger['info'](_0x0533('0xd'),_0x1de94a,_0x0533('0xe'));_0x20ba43(_0x1b38f7[_0x0533('0x14')][_0x0533('0x13')]);}})[_0x0533('0x15')](function(_0x4169b5){logger[_0x0533('0x11')](_0x0533('0xd'),_0x1de94a,_0x4169b5);_0x1e7428(_0x4169b5);});});}exports[_0x0533('0x16')]=function(_0x488c1c){var _0x53b2e5=this;return new Promise(function(_0x459c88,_0x3fd3bc){return db[_0x0533('0x17')][_0x0533('0x18')]({'raw':!![],'where':{'ContactId':_0x488c1c[_0x0533('0x19')][_0x0533('0x1a')],'ListId':_0x488c1c['body'][_0x0533('0x1b')],'VoiceQueueId':_0x488c1c[_0x0533('0x19')][_0x0533('0x1c')]===undefined?null:_0x488c1c[_0x0533('0x19')][_0x0533('0x1c')],'CampaignId':_0x488c1c['body'][_0x0533('0x1d')]===undefined?null:_0x488c1c[_0x0533('0x19')][_0x0533('0x1d')]}})[_0x0533('0xb')](function(_0x1f1d91){if(_0x1f1d91!=null){return db[_0x0533('0x1e')][_0x0533('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1f1d91['id'],'OrderBy':{'$gt':_0x1f1d91[_0x0533('0x1f')]}},'order':[[_0x0533('0x1f'),_0x0533('0x20')]]})[_0x0533('0xb')](function(_0x413992){var _0xc666cb=0x0;if(_0x413992){if(_0x413992['countbusyretry']+_0x413992[_0x0533('0x21')]+_0x413992[_0x0533('0x22')]+_0x413992[_0x0533('0x23')]+_0x413992[_0x0533('0x24')]+_0x413992[_0x0533('0x25')]+_0x413992[_0x0533('0x26')]+_0x413992[_0x0533('0x27')]<_0x488c1c[_0x0533('0x28')][_0x0533('0x29')])_0xc666cb=0x1;_0x459c88({'additional':_0xc666cb});}else{return db['CmHopperAdditionalPhone'][_0x0533('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1f1d91['id']},'order':[[_0x0533('0x1f'),_0x0533('0x20')]]})[_0x0533('0xb')](function(_0x51068a){var _0x20dc4f=0x0;if(_0x51068a){if(_0x51068a[_0x0533('0x2a')]+_0x51068a['countcongestionretry']+_0x51068a[_0x0533('0x22')]+_0x51068a['countnosuchnumberretry']+_0x51068a[_0x0533('0x24')]+_0x51068a[_0x0533('0x25')]+_0x51068a[_0x0533('0x26')]+_0x51068a[_0x0533('0x27')]<_0x488c1c[_0x0533('0x28')]['dialGlobalMaxRetry'])_0x20dc4f=0x1;_0x459c88({'additional':_0x20dc4f});}else{_0x459c88({'additional':0x0});}})[_0x0533('0x15')](function(_0x30998e){logger[_0x0533('0x11')](_0x0533('0x16'),_0x30998e['message']);_0x3fd3bc(_0x53b2e5['error'](0x1f4,_0x30998e['message']));});}})[_0x0533('0x15')](function(_0x1c692d){logger[_0x0533('0x11')](_0x0533('0x16'),_0x1c692d['message']);_0x3fd3bc(_0x53b2e5[_0x0533('0x11')](0x1f4,_0x1c692d[_0x0533('0x13')]));});}else _0x459c88({'additional':0x0});});});};exports[_0x0533('0x2b')]=function(_0x291149){var _0x57c8a7=this;return new Promise(function(_0x4ec415,_0x5c404e){return db[_0x0533('0x17')][_0x0533('0x18')]({'raw':!![],'where':{'ContactId':_0x291149[_0x0533('0x19')]['ContactId'],'ListId':_0x291149[_0x0533('0x19')]['ListId'],'VoiceQueueId':_0x291149[_0x0533('0x19')][_0x0533('0x1c')]===undefined?null:_0x291149['body'][_0x0533('0x1c')],'CampaignId':_0x291149[_0x0533('0x19')][_0x0533('0x1d')]===undefined?null:_0x291149[_0x0533('0x19')][_0x0533('0x1d')]}})['then'](function(_0x210aa4){if(_0x210aa4!=null){return db[_0x0533('0x1e')][_0x0533('0x18')]({'raw':!![],'where':{'CmHopperId':_0x210aa4['id'],'OrderBy':{'$gte':_0x210aa4[_0x0533('0x1f')]}},'order':[[_0x0533('0x1f'),_0x0533('0x20')]]})[_0x0533('0xb')](function(_0x5de8da){if(_0x5de8da)return activateAdditionalPhone(_0x210aa4,_0x291149[_0x0533('0x19')],_0x5de8da,_0x291149['duration'],_0x291149[_0x0533('0x2c')])[_0x0533('0xb')](function(_0x351dea){_0x4ec415(_0x351dea);});else{return db[_0x0533('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x210aa4['id']},'order':[[_0x0533('0x1f'),_0x0533('0x20')]]})[_0x0533('0xb')](function(_0x19a4cd){if(_0x19a4cd)return activateAdditionalPhone(_0x210aa4,_0x291149[_0x0533('0x19')],_0x19a4cd,_0x291149[_0x0533('0x2d')],_0x291149[_0x0533('0x2c')])[_0x0533('0xb')](function(_0x5db8fa){_0x4ec415(_0x5db8fa);});else{_0x4ec415({'id':_0x210aa4['id'],'phone':''});}})['catch'](function(_0x368a55){logger[_0x0533('0x11')](_0x0533('0x16'),_0x368a55['message']);_0x5c404e(_0x57c8a7[_0x0533('0x11')](0x1f4,_0x368a55['message']));});}})[_0x0533('0x15')](function(_0x4af9cc){logger[_0x0533('0x11')](_0x0533('0x16'),_0x4af9cc[_0x0533('0x13')]);_0x5c404e(_0x57c8a7[_0x0533('0x11')](0x1f4,_0x4af9cc[_0x0533('0x13')]));});}else _0x4ec415(0x1);});});};function activateAdditionalPhone(_0x55c4a6,_0x405ca6,_0x53714a,_0x46a5d4,_0xdae6fa){return new Promise(function(_0x366bb2,_0x55556f){var _0x27e211;if(_['isNil'](_0x53714a['scheduledat'])){_0x53714a[_0x0533('0x2e')]=moment();}if(moment()>moment(_0x53714a['scheduledat'])){_0x27e211=moment()[_0x0533('0x2f')](_0xdae6fa||0x3,'minutes');}else{if(_0x53714a[_0x0533('0x1f')]==0x0){_0x27e211=moment(_0x53714a[_0x0533('0x2e')]);}else{_0x27e211=moment()[_0x0533('0x2f')](_0xdae6fa||0x3,_0x0533('0x30'));}}if(_[_0x0533('0x31')](_0x27e211)){_0x27e211=moment()[_0x0533('0x2f')](_0xdae6fa||0x3,'minutes');}var _0x365341={'phone':_0x55c4a6[_0x0533('0x32')],'active':0x0,'OrderBy':_[_0x0533('0x31')](_0x55c4a6[_0x0533('0x1f')])?0x0:_0x55c4a6[_0x0533('0x1f')],'scheduledat':moment()[_0x0533('0x2f')](_0x46a5d4||0x1,_0x0533('0x30')),'countbusyretry':_0x405ca6[_0x0533('0x2a')],'countcongestionretry':_0x405ca6['countcongestionretry'],'countnoanswerretry':_0x405ca6['countnoanswerretry'],'countnosuchnumberretry':_0x405ca6[_0x0533('0x23')],'countdropretry':_0x405ca6[_0x0533('0x24')],'countabandonedretry':_0x405ca6[_0x0533('0x25')],'countmachineretry':_0x405ca6['countmachineretry'],'countagentrejectretry':_0x405ca6[_0x0533('0x27')],'createdAt':_0x405ca6[_0x0533('0x33')],'updatedAt':_0x405ca6[_0x0533('0x34')]};var _0x637d32={'CmHopperId':_0x55c4a6['id'],'phone':_0x53714a[_0x0533('0x32')],'active':0x0,'OrderBy':_[_0x0533('0x31')](_0x53714a[_0x0533('0x1f')])?0x0:_0x53714a[_0x0533('0x1f')],'scheduledat':_0x27e211,'countbusyretry':_0x53714a[_0x0533('0x2a')],'countcongestionretry':_0x53714a[_0x0533('0x21')],'countnoanswerretry':_0x53714a[_0x0533('0x22')],'countnosuchnumberretry':_0x53714a[_0x0533('0x23')],'countdropretry':_0x53714a[_0x0533('0x24')],'countabandonedretry':_0x53714a[_0x0533('0x25')],'countmachineretry':_0x53714a['countmachineretry'],'countagentrejectretry':_0x53714a[_0x0533('0x27')],'createdAt':_0x53714a[_0x0533('0x33')],'updatedAt':_0x53714a[_0x0533('0x34')]};return db['sequelize']['transaction'](function(_0x20126b){return db[_0x0533('0x1e')][_0x0533('0x35')](_0x365341,{'where':{'id':_0x53714a['id']}},{'transaction':_0x20126b})['then'](function(){return db[_0x0533('0x17')][_0x0533('0x35')](_0x637d32,{'where':{'id':_0x55c4a6['id']}},{'transaction':_0x20126b});});})[_0x0533('0xb')](function(_0x452ba0){_0x366bb2({'id':_0x55c4a6['id'],'phone':_0x53714a[_0x0533('0x32')]});})[_0x0533('0x15')](function(_0x204271){logger['error'](_0x0533('0x36'),_0x204271['message']);_0x55556f({'error':_0x204271[_0x0533('0x13')]});});});}exports[_0x0533('0x37')]=function(_0x166e8a){var _0x5587c2=this;return new Promise(function(_0x542e93,_0x38a6b6){return db[_0x0533('0x17')]['update'](_0x166e8a['body']['field'],{'where':{'id':_0x166e8a[_0x0533('0x19')]['id']}})[_0x0533('0xb')](function(_0x1f09ab){_0x542e93(_0x1f09ab);})[_0x0533('0x15')](function(_0x4b1213){logger[_0x0533('0x11')](_0x0533('0x37'),_0x4b1213['message']);_0x38a6b6(_0x5587c2[_0x0533('0x11')](0x1f4,_0x4b1213['message']));});});}; \ No newline at end of file +var _0x649c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','entity','dialGlobalMaxRetry','countdropretry','countabandonedretry','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','add','minutes','isNil','phone','countnosuchnumberretry','countmachineretry','createdAt','updatedAt','sequelize','transaction','update','field','IncrementPreviewCounters','util'];(function(_0x436d3c,_0xaaebd4){var _0x4bad64=function(_0x4c786c){while(--_0x4c786c){_0x436d3c['push'](_0x436d3c['shift']());}};_0x4bad64(++_0xaaebd4);}(_0x649c,0x1cf));var _0xc649=function(_0x355151,_0x71a48d){_0x355151=_0x355151-0x0;var _0x505084=_0x649c[_0x355151];return _0x505084;};'use strict';var _=require('lodash');var util=require(_0xc649('0x0'));var moment=require('moment');var BPromise=require(_0xc649('0x1'));var rs=require(_0xc649('0x2'));var fs=require('fs');var Redis=require(_0xc649('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc649('0x4'));var logger=require(_0xc649('0x5'))(_0xc649('0x6'));var config=require(_0xc649('0x7'));var jayson=require(_0xc649('0x8'));var client=jayson[_0xc649('0x9')][_0xc649('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43e31a,_0x2817a8,_0x3d04b1){return new BPromise(function(_0x5bf82b,_0x63b44a){return client['request'](_0x43e31a,_0x3d04b1)[_0xc649('0xb')](function(_0x1bcc5e){logger[_0xc649('0xc')](_0xc649('0xd'),_0x2817a8,'request\x20sent');logger[_0xc649('0xe')](_0xc649('0xf'),_0x2817a8,_0xc649('0x10'),JSON['stringify'](_0x1bcc5e));if(_0x1bcc5e['error']){if(_0x1bcc5e['error'][_0xc649('0x11')]===0x1f4){logger[_0xc649('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2817a8,_0x1bcc5e[_0xc649('0x12')][_0xc649('0x13')]);return _0x63b44a(_0x1bcc5e[_0xc649('0x12')][_0xc649('0x13')]);}logger['error'](_0xc649('0xd'),_0x2817a8,_0x1bcc5e[_0xc649('0x12')][_0xc649('0x13')]);return _0x5bf82b(_0x1bcc5e['error']['message']);}else{logger['info'](_0xc649('0xd'),_0x2817a8,_0xc649('0x10'));_0x5bf82b(_0x1bcc5e[_0xc649('0x14')][_0xc649('0x13')]);}})[_0xc649('0x15')](function(_0x2d04c0){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2817a8,_0x2d04c0);_0x63b44a(_0x2d04c0);});});}exports[_0xc649('0x16')]=function(_0x18dcaa){var _0x5594e4=this;return new Promise(function(_0x4820ee,_0x5a619c){return db[_0xc649('0x17')][_0xc649('0x18')]({'raw':!![],'where':{'ContactId':_0x18dcaa[_0xc649('0x19')][_0xc649('0x1a')],'ListId':_0x18dcaa['body']['ListId'],'VoiceQueueId':_0x18dcaa[_0xc649('0x19')][_0xc649('0x1b')]===undefined?null:_0x18dcaa['body']['VoiceQueueId'],'CampaignId':_0x18dcaa[_0xc649('0x19')][_0xc649('0x1c')]===undefined?null:_0x18dcaa['body'][_0xc649('0x1c')]}})['then'](function(_0xaf4028){if(_0xaf4028!=null){return db[_0xc649('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xaf4028['id'],'OrderBy':{'$gt':_0xaf4028[_0xc649('0x1e')]}},'order':[[_0xc649('0x1e'),_0xc649('0x1f')]]})[_0xc649('0xb')](function(_0x39da86){var _0x900010=0x0;if(_0x39da86){if(_0x39da86[_0xc649('0x20')]+_0x39da86[_0xc649('0x21')]+_0x39da86[_0xc649('0x22')]+_0x39da86['countnosuchnumberretry']+_0x39da86['countdropretry']+_0x39da86['countabandonedretry']+_0x39da86['countmachineretry']+_0x39da86[_0xc649('0x23')]<_0x18dcaa[_0xc649('0x24')][_0xc649('0x25')])_0x900010=0x1;_0x4820ee({'additional':_0x900010});}else{return db[_0xc649('0x1d')][_0xc649('0x18')]({'raw':!![],'where':{'CmHopperId':_0xaf4028['id']},'order':[[_0xc649('0x1e'),'ASC']]})['then'](function(_0x56daae){var _0x4e74f0=0x0;if(_0x56daae){if(_0x56daae[_0xc649('0x20')]+_0x56daae[_0xc649('0x21')]+_0x56daae['countnoanswerretry']+_0x56daae['countnosuchnumberretry']+_0x56daae[_0xc649('0x26')]+_0x56daae[_0xc649('0x27')]+_0x56daae['countmachineretry']+_0x56daae[_0xc649('0x23')]<_0x18dcaa[_0xc649('0x24')][_0xc649('0x25')])_0x4e74f0=0x1;_0x4820ee({'additional':_0x4e74f0});}else{_0x4820ee({'additional':0x0});}})[_0xc649('0x15')](function(_0x404b24){logger[_0xc649('0x12')](_0xc649('0x16'),_0x404b24[_0xc649('0x13')]);_0x5a619c(_0x5594e4[_0xc649('0x12')](0x1f4,_0x404b24[_0xc649('0x13')]));});}})['catch'](function(_0x34e791){logger['error'](_0xc649('0x16'),_0x34e791['message']);_0x5a619c(_0x5594e4[_0xc649('0x12')](0x1f4,_0x34e791[_0xc649('0x13')]));});}else _0x4820ee({'additional':0x0});});});};exports[_0xc649('0x28')]=function(_0x431af3){var _0x4bb281=this;return new Promise(function(_0x58495e,_0x522911){return db[_0xc649('0x17')][_0xc649('0x18')]({'raw':!![],'where':{'ContactId':_0x431af3['body'][_0xc649('0x1a')],'ListId':_0x431af3[_0xc649('0x19')][_0xc649('0x29')],'VoiceQueueId':_0x431af3[_0xc649('0x19')][_0xc649('0x1b')]===undefined?null:_0x431af3[_0xc649('0x19')]['VoiceQueueId'],'CampaignId':_0x431af3[_0xc649('0x19')]['CampaignId']===undefined?null:_0x431af3[_0xc649('0x19')]['CampaignId']}})[_0xc649('0xb')](function(_0x1a4baa){if(_0x1a4baa!=null){return db[_0xc649('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1a4baa['id'],'OrderBy':{'$gte':_0x1a4baa[_0xc649('0x1e')]}},'order':[[_0xc649('0x1e'),'ASC']]})[_0xc649('0xb')](function(_0x3551c8){if(_0x3551c8)return activateAdditionalPhone(_0x1a4baa,_0x431af3['body'],_0x3551c8,_0x431af3[_0xc649('0x2a')],_0x431af3['waitTime'])[_0xc649('0xb')](function(_0x20154b){_0x58495e(_0x20154b);});else{return db['CmHopperAdditionalPhone'][_0xc649('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1a4baa['id']},'order':[[_0xc649('0x1e'),_0xc649('0x1f')]]})[_0xc649('0xb')](function(_0xc2d133){if(_0xc2d133)return activateAdditionalPhone(_0x1a4baa,_0x431af3[_0xc649('0x19')],_0xc2d133,_0x431af3[_0xc649('0x2a')],_0x431af3[_0xc649('0x2b')])[_0xc649('0xb')](function(_0x3f0125){_0x58495e(_0x3f0125);});else{_0x58495e({'id':_0x1a4baa['id'],'phone':''});}})[_0xc649('0x15')](function(_0x5525c9){logger[_0xc649('0x12')](_0xc649('0x16'),_0x5525c9['message']);_0x522911(_0x4bb281[_0xc649('0x12')](0x1f4,_0x5525c9[_0xc649('0x13')]));});}})[_0xc649('0x15')](function(_0x3784ac){logger[_0xc649('0x12')]('VerifyAdditionalPhones',_0x3784ac[_0xc649('0x13')]);_0x522911(_0x4bb281[_0xc649('0x12')](0x1f4,_0x3784ac[_0xc649('0x13')]));});}else _0x58495e(0x1);});});};function activateAdditionalPhone(_0x5b4bdd,_0xe2695f,_0x4d109d,_0x3a20d0,_0x32511b){return new Promise(function(_0x5d9bd3,_0x1efeef){var _0xad4e50;if(_['isNil'](_0x4d109d[_0xc649('0x2c')])){_0x4d109d['scheduledat']=moment();}if(moment()>moment(_0x4d109d['scheduledat'])){_0xad4e50=moment()[_0xc649('0x2d')](_0x32511b||0x3,_0xc649('0x2e'));}else{if(_0x4d109d[_0xc649('0x1e')]==0x0){_0xad4e50=moment(_0x4d109d[_0xc649('0x2c')]);}else{_0xad4e50=moment()[_0xc649('0x2d')](_0x32511b||0x3,_0xc649('0x2e'));}}if(_[_0xc649('0x2f')](_0xad4e50)){_0xad4e50=moment()[_0xc649('0x2d')](_0x32511b||0x3,_0xc649('0x2e'));}var _0x11e76f={'phone':_0x5b4bdd[_0xc649('0x30')],'active':0x0,'OrderBy':_[_0xc649('0x2f')](_0x5b4bdd[_0xc649('0x1e')])?0x0:_0x5b4bdd['OrderBy'],'scheduledat':moment()[_0xc649('0x2d')](_0x3a20d0||0x1,_0xc649('0x2e')),'countbusyretry':_0xe2695f[_0xc649('0x20')],'countcongestionretry':_0xe2695f[_0xc649('0x21')],'countnoanswerretry':_0xe2695f['countnoanswerretry'],'countnosuchnumberretry':_0xe2695f[_0xc649('0x31')],'countdropretry':_0xe2695f[_0xc649('0x26')],'countabandonedretry':_0xe2695f[_0xc649('0x27')],'countmachineretry':_0xe2695f[_0xc649('0x32')],'countagentrejectretry':_0xe2695f[_0xc649('0x23')],'createdAt':_0xe2695f[_0xc649('0x33')],'updatedAt':_0xe2695f[_0xc649('0x34')]};var _0x2afbe7={'CmHopperId':_0x5b4bdd['id'],'phone':_0x4d109d[_0xc649('0x30')],'active':0x0,'OrderBy':_[_0xc649('0x2f')](_0x4d109d['OrderBy'])?0x0:_0x4d109d[_0xc649('0x1e')],'scheduledat':_0xad4e50,'countbusyretry':_0x4d109d[_0xc649('0x20')],'countcongestionretry':_0x4d109d[_0xc649('0x21')],'countnoanswerretry':_0x4d109d[_0xc649('0x22')],'countnosuchnumberretry':_0x4d109d[_0xc649('0x31')],'countdropretry':_0x4d109d[_0xc649('0x26')],'countabandonedretry':_0x4d109d[_0xc649('0x27')],'countmachineretry':_0x4d109d['countmachineretry'],'countagentrejectretry':_0x4d109d[_0xc649('0x23')],'createdAt':_0x4d109d[_0xc649('0x33')],'updatedAt':_0x4d109d[_0xc649('0x34')]};return db[_0xc649('0x35')][_0xc649('0x36')](function(_0x41966f){return db[_0xc649('0x1d')][_0xc649('0x37')](_0x11e76f,{'where':{'id':_0x4d109d['id']}},{'transaction':_0x41966f})[_0xc649('0xb')](function(){return db[_0xc649('0x17')]['update'](_0x2afbe7,{'where':{'id':_0x5b4bdd['id']}},{'transaction':_0x41966f});});})[_0xc649('0xb')](function(_0x30696d){_0x5d9bd3({'id':_0x5b4bdd['id'],'phone':_0x4d109d['phone']});})[_0xc649('0x15')](function(_0x3c75ac){logger[_0xc649('0x12')]('activateAdditionalPhone',_0x3c75ac[_0xc649('0x13')]);_0x1efeef({'error':_0x3c75ac[_0xc649('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x3b7edd){var _0x59dec1=this;return new Promise(function(_0x10b102,_0x59a808){return db['CmHopper'][_0xc649('0x37')](_0x3b7edd[_0xc649('0x19')][_0xc649('0x38')],{'where':{'id':_0x3b7edd[_0xc649('0x19')]['id']}})[_0xc649('0xb')](function(_0x42f346){_0x10b102(_0x42f346);})[_0xc649('0x15')](function(_0x3cd39a){logger[_0xc649('0x12')](_0xc649('0x39'),_0x3cd39a[_0xc649('0x13')]);_0x59a808(_0x59dec1['error'](0x1f4,_0x3cd39a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4d9ad6d..3592479 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 _0xb9fc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0xbd9b8f,_0x3546ae){var _0x3f2e33=function(_0x1d11ba){while(--_0x1d11ba){_0xbd9b8f['push'](_0xbd9b8f['shift']());}};_0x3f2e33(++_0x3546ae);}(_0xb9fc,0x6e));var _0xcb9f=function(_0x17a22,_0x39c23b){_0x17a22=_0x17a22-0x0;var _0x44f866=_0xb9fc[_0x17a22];return _0x44f866;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcb9f('0x0'));var timeout=require(_0xcb9f('0x1'));var express=require(_0xcb9f('0x2'));var router=express[_0xcb9f('0x3')]();var fs_extra=require(_0xcb9f('0x4'));var auth=require(_0xcb9f('0x5'));var interaction=require(_0xcb9f('0x6'));var config=require(_0xcb9f('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xcb9f('0x8')]('/',auth['isAuthenticated'](),controller[_0xcb9f('0x9')]);router[_0xcb9f('0x8')](_0xcb9f('0xa'),auth[_0xcb9f('0xb')](),controller[_0xcb9f('0xc')]);router[_0xcb9f('0xd')]('/',auth['isAuthenticated'](),controller[_0xcb9f('0xe')]);router[_0xcb9f('0xf')](_0xcb9f('0xa'),auth[_0xcb9f('0xb')](),controller[_0xcb9f('0x10')]);router['delete']('/:id',auth[_0xcb9f('0xb')](),controller[_0xcb9f('0x11')]);module[_0xcb9f('0x12')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x598135,_0x5b0202){var _0x4f0adb=function(_0x463290){while(--_0x463290){_0x598135['push'](_0x598135['shift']());}};_0x4f0adb(++_0x5b0202);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x5eb8[_0x2998db];return _0x115fea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index defcafd..f8fbce5 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 _0x565f=['exports','STRING','contactListQueue','INTEGER','sequelize'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x565f,0x68));var _0xf565=function(_0x32221a,_0x7f0390){_0x32221a=_0x32221a-0x0;var _0x3d640d=_0x565f[_0x32221a];return _0x3d640d;};'use strict';var moment=require('moment');var Sequelize=require(_0xf565('0x0'));module[_0xf565('0x1')]={'phone':{'type':Sequelize[_0xf565('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xf565('0x3')},'ListId':{'type':Sequelize[_0xf565('0x4')],'unique':_0xf565('0x3')},'VoiceQueueId':{'type':Sequelize[_0xf565('0x4')],'unique':_0xf565('0x3')}}; \ No newline at end of file +var _0xda19=['contactListQueue','sequelize','exports','INTEGER'];(function(_0x16b776,_0x370b7b){var _0x471990=function(_0x1117b4){while(--_0x1117b4){_0x16b776['push'](_0x16b776['shift']());}};_0x471990(++_0x370b7b);}(_0xda19,0xd5));var _0x9da1=function(_0x528193,_0x4190e1){_0x528193=_0x528193-0x0;var _0x37008b=_0xda19[_0x528193];return _0x37008b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9da1('0x0'));module[_0x9da1('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9da1('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9da1('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x9da1('0x2')],'unique':_0x9da1('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ac7b736..07829ab 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 _0xe256=['Content-Range','reject','save','then','destroy','end','sendStatus','error','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','find','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','limit','undefined','count','set'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0xe256,0x197));var _0x6e25=function(_0x295318,_0x4f80cd){_0x295318=_0x295318-0x0;var _0x28a86d=_0xe256[_0x295318];return _0x28a86d;};'use strict';var emlformat=require(_0x6e25('0x0'));var rimraf=require(_0x6e25('0x1'));var zipdir=require(_0x6e25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e25('0x3'));var moment=require(_0x6e25('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e25('0x5'));var util=require(_0x6e25('0x6'));var path=require(_0x6e25('0x7'));var sox=require(_0x6e25('0x8'));var csv=require(_0x6e25('0x9'));var ejs=require(_0x6e25('0xa'));var fs=require('fs');var fs_extra=require(_0x6e25('0xb'));var _=require(_0x6e25('0xc'));var squel=require(_0x6e25('0xd'));var crypto=require(_0x6e25('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e25('0x9'));var querystring=require(_0x6e25('0xf'));var Papa=require(_0x6e25('0x10'));var Redis=require(_0x6e25('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6e25('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e25('0x13'));var logger=require(_0x6e25('0x14'))(_0x6e25('0x15'));var utils=require(_0x6e25('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6e25('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc225,_0x2f6cbd){_0x2f6cbd=_0x2f6cbd||0xcc;return function(_0x264290){if(_0x264290){return _0x3cc225['sendStatus'](_0x2f6cbd);}return _0x3cc225[_0x6e25('0x18')](_0x2f6cbd)['end']();};}function respondWithResult(_0x28c7f1,_0x57b850){_0x57b850=_0x57b850||0xc8;return function(_0x5014ef){if(_0x5014ef){return _0x28c7f1[_0x6e25('0x18')](_0x57b850)[_0x6e25('0x19')](_0x5014ef);}};}function respondWithFilteredResult(_0x175d53,_0x1f1f04){return function(_0xd2f680){if(_0xd2f680){var _0x208659=typeof _0x1f1f04[_0x6e25('0x1a')]==='undefined'&&typeof _0x1f1f04[_0x6e25('0x1b')]===_0x6e25('0x1c');var _0x40c5dc=_0xd2f680[_0x6e25('0x1d')];var _0x2b32ed=_0x208659?0x0:_0x1f1f04[_0x6e25('0x1a')];var _0x570e41=_0x208659?_0xd2f680[_0x6e25('0x1d')]:_0x1f1f04['offset']+_0x1f1f04[_0x6e25('0x1b')];var _0x46c62d;if(_0x570e41>=_0x40c5dc){_0x570e41=_0x40c5dc;_0x46c62d=0xc8;}else{_0x46c62d=0xce;}_0x175d53[_0x6e25('0x18')](_0x46c62d);return _0x175d53[_0x6e25('0x1e')](_0x6e25('0x1f'),_0x2b32ed+'-'+_0x570e41+'/'+_0x40c5dc)[_0x6e25('0x19')](_0xd2f680);}return null;};}function patchUpdates(_0x32da88){return function(_0xd1d5){try{jsonpatch['apply'](_0xd1d5,_0x32da88,!![]);}catch(_0x47ae27){return BPromise[_0x6e25('0x20')](_0x47ae27);}return _0xd1d5[_0x6e25('0x21')]();};}function saveUpdates(_0x475c87,_0x5adcc9){return function(_0x468d46){if(_0x468d46){return _0x468d46['update'](_0x475c87)[_0x6e25('0x22')](function(_0x39e798){return _0x39e798;});}return null;};}function removeEntity(_0x562b21,_0x2563ea){return function(_0x10ff53){if(_0x10ff53){return _0x10ff53[_0x6e25('0x23')]()[_0x6e25('0x22')](function(){_0x562b21[_0x6e25('0x18')](0xcc)[_0x6e25('0x24')]();});}};}function handleEntityNotFound(_0x411317,_0x1c8313){return function(_0x3688c5){if(!_0x3688c5){_0x411317[_0x6e25('0x25')](0x194);}return _0x3688c5;};}function handleError(_0x5559ce,_0x25a547){_0x25a547=_0x25a547||0x1f4;return function(_0xd01cb7){logger[_0x6e25('0x26')](_0xd01cb7['stack']);if(_0xd01cb7[_0x6e25('0x27')]){delete _0xd01cb7['name'];}_0x5559ce[_0x6e25('0x18')](_0x25a547)[_0x6e25('0x28')](_0xd01cb7);};}exports[_0x6e25('0x29')]=function(_0x26ef6f,_0x51435e){var _0xbb9985={},_0x356013={},_0x4186be={'count':0x0,'rows':[]};var _0x24661c=_[_0x6e25('0x2a')](db[_0x6e25('0x2b')]['rawAttributes'],function(_0x499a8c){return{'name':_0x499a8c[_0x6e25('0x2c')],'type':_0x499a8c[_0x6e25('0x2d')][_0x6e25('0x2e')]};});_0x356013[_0x6e25('0x2f')]=_[_0x6e25('0x2a')](_0x24661c,_0x6e25('0x27'));_0x356013[_0x6e25('0x30')]=_[_0x6e25('0x31')](_0x26ef6f[_0x6e25('0x30')]);_0x356013[_0x6e25('0x32')]=_[_0x6e25('0x33')](_0x356013[_0x6e25('0x2f')],_0x356013['query']);_0xbb9985[_0x6e25('0x34')]=_['intersection'](_0x356013[_0x6e25('0x2f')],qs[_0x6e25('0x35')](_0x26ef6f['query'][_0x6e25('0x35')]));_0xbb9985[_0x6e25('0x34')]=_0xbb9985[_0x6e25('0x34')][_0x6e25('0x36')]?_0xbb9985['attributes']:_0x356013[_0x6e25('0x2f')];if(!_0x26ef6f['query'][_0x6e25('0x37')]('nolimit')){_0xbb9985['limit']=qs[_0x6e25('0x1b')](_0x26ef6f['query']['limit']);_0xbb9985[_0x6e25('0x1a')]=qs[_0x6e25('0x1a')](_0x26ef6f[_0x6e25('0x30')][_0x6e25('0x1a')]);}_0xbb9985[_0x6e25('0x38')]=qs['sort'](_0x26ef6f[_0x6e25('0x30')]['sort']);_0xbb9985[_0x6e25('0x39')]=qs['filters'](_[_0x6e25('0x3a')](_0x26ef6f[_0x6e25('0x30')],_0x356013[_0x6e25('0x32')]),_0x24661c);if(_0x26ef6f[_0x6e25('0x30')][_0x6e25('0x3b')]){_0xbb9985[_0x6e25('0x39')]=_[_0x6e25('0x3c')](_0xbb9985['where'],{'$or':_[_0x6e25('0x2a')](_0x24661c,function(_0x1bf404){if(_0x1bf404['type']!=='VIRTUAL'){var _0x4b01ca={};_0x4b01ca[_0x1bf404[_0x6e25('0x27')]]={'$like':'%'+_0x26ef6f[_0x6e25('0x30')][_0x6e25('0x3b')]+'%'};return _0x4b01ca;}})});}_0xbb9985=_['merge']({},_0xbb9985,_0x26ef6f['options']);var _0x3bd85d={'where':_0xbb9985[_0x6e25('0x39')]};return db[_0x6e25('0x2b')][_0x6e25('0x1d')](_0x3bd85d)[_0x6e25('0x22')](function(_0xd4c606){_0x4186be[_0x6e25('0x1d')]=_0xd4c606;if(_0x26ef6f[_0x6e25('0x30')][_0x6e25('0x3d')]){_0xbb9985[_0x6e25('0x3e')]=[{'all':!![]}];}return db[_0x6e25('0x2b')]['findAll'](_0xbb9985);})['then'](function(_0x467986){_0x4186be[_0x6e25('0x3f')]=_0x467986;return _0x4186be;})[_0x6e25('0x22')](respondWithFilteredResult(_0x51435e,_0xbb9985))[_0x6e25('0x40')](handleError(_0x51435e,null));};exports[_0x6e25('0x41')]=function(_0x222eca,_0x5032af){var _0x42c331={'raw':!![],'where':{'id':_0x222eca[_0x6e25('0x42')]['id']}},_0x40b069={};_0x40b069[_0x6e25('0x2f')]=_[_0x6e25('0x31')](db[_0x6e25('0x2b')][_0x6e25('0x43')]);_0x40b069[_0x6e25('0x30')]=_[_0x6e25('0x31')](_0x222eca[_0x6e25('0x30')]);_0x40b069['filters']=_[_0x6e25('0x33')](_0x40b069['model'],_0x40b069[_0x6e25('0x30')]);_0x42c331[_0x6e25('0x34')]=_[_0x6e25('0x33')](_0x40b069['model'],qs['fields'](_0x222eca[_0x6e25('0x30')]['fields']));_0x42c331[_0x6e25('0x34')]=_0x42c331['attributes'][_0x6e25('0x36')]?_0x42c331[_0x6e25('0x34')]:_0x40b069[_0x6e25('0x2f')];if(_0x222eca[_0x6e25('0x30')][_0x6e25('0x3d')]){_0x42c331['include']=[{'all':!![]}];}_0x42c331=_[_0x6e25('0x3c')]({},_0x42c331,_0x222eca[_0x6e25('0x44')]);return db[_0x6e25('0x2b')][_0x6e25('0x45')](_0x42c331)[_0x6e25('0x22')](handleEntityNotFound(_0x5032af,null))[_0x6e25('0x22')](respondWithResult(_0x5032af,null))[_0x6e25('0x40')](handleError(_0x5032af,null));};exports[_0x6e25('0x46')]=function(_0x16669b,_0x59abcd){if(_0x16669b[_0x6e25('0x47')]['id']){delete _0x16669b[_0x6e25('0x47')]['id'];}return db[_0x6e25('0x2b')][_0x6e25('0x45')]({'where':{'id':_0x16669b[_0x6e25('0x42')]['id']}})['then'](handleEntityNotFound(_0x59abcd,null))['then'](saveUpdates(_0x16669b['body'],null))[_0x6e25('0x22')](respondWithResult(_0x59abcd,null))[_0x6e25('0x40')](handleError(_0x59abcd,null));};exports[_0x6e25('0x23')]=function(_0x29be30,_0x3ae2d4){return db[_0x6e25('0x2b')][_0x6e25('0x45')]({'where':{'id':_0x29be30[_0x6e25('0x42')]['id']}})[_0x6e25('0x22')](handleEntityNotFound(_0x3ae2d4,null))[_0x6e25('0x22')](removeEntity(_0x3ae2d4,null))[_0x6e25('0x40')](handleError(_0x3ae2d4,null));};exports[_0x6e25('0x48')]=function(_0x17b74a,_0x2afa6e){return db[_0x6e25('0x2b')][_0x6e25('0x48')]()[_0x6e25('0x22')](respondWithResult(_0x2afa6e,null))['catch'](handleError(_0x2afa6e,null));}; \ No newline at end of file +var _0xb2c4=['offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','index','map','CmHopperBlack','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','describe','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xb2c4,0x75));var _0x4b2c=function(_0x323c60,_0x219b72){_0x323c60=_0x323c60-0x0;var _0x103f23=_0xb2c4[_0x323c60];return _0x103f23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b2c('0x1'));var rp=require(_0x4b2c('0x2'));var moment=require(_0x4b2c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4b2c('0x4'));var path=require(_0x4b2c('0x5'));var sox=require(_0x4b2c('0x6'));var csv=require(_0x4b2c('0x7'));var ejs=require(_0x4b2c('0x8'));var fs=require('fs');var fs_extra=require(_0x4b2c('0x9'));var _=require('lodash');var squel=require(_0x4b2c('0xa'));var crypto=require(_0x4b2c('0xb'));var jsforce=require(_0x4b2c('0xc'));var deskjs=require(_0x4b2c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4b2c('0xe'));var Papa=require(_0x4b2c('0xf'));var Redis=require(_0x4b2c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4b2c('0x11'));var as=require(_0x4b2c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b2c('0x13'));var utils=require(_0x4b2c('0x14'));var config=require(_0x4b2c('0x15'));var licenseUtil=require(_0x4b2c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41422f,_0xa9b950){_0xa9b950=_0xa9b950||0xcc;return function(_0x3b3ca1){if(_0x3b3ca1){return _0x41422f[_0x4b2c('0x17')](_0xa9b950);}return _0x41422f['status'](_0xa9b950)[_0x4b2c('0x18')]();};}function respondWithResult(_0x256fce,_0x3647a7){_0x3647a7=_0x3647a7||0xc8;return function(_0x2d5d7e){if(_0x2d5d7e){return _0x256fce[_0x4b2c('0x19')](_0x3647a7)[_0x4b2c('0x1a')](_0x2d5d7e);}};}function respondWithFilteredResult(_0x8e4234,_0x164374){return function(_0x4d4e22){if(_0x4d4e22){var _0x5c8000=typeof _0x164374['offset']===_0x4b2c('0x1b')&&typeof _0x164374[_0x4b2c('0x1c')]===_0x4b2c('0x1b');var _0x350ccc=_0x4d4e22['count'];var _0x54cba0=_0x5c8000?0x0:_0x164374[_0x4b2c('0x1d')];var _0x454a04=_0x5c8000?_0x4d4e22['count']:_0x164374[_0x4b2c('0x1d')]+_0x164374[_0x4b2c('0x1c')];var _0x5cbac3;if(_0x454a04>=_0x350ccc){_0x454a04=_0x350ccc;_0x5cbac3=0xc8;}else{_0x5cbac3=0xce;}_0x8e4234[_0x4b2c('0x19')](_0x5cbac3);return _0x8e4234[_0x4b2c('0x1e')](_0x4b2c('0x1f'),_0x54cba0+'-'+_0x454a04+'/'+_0x350ccc)[_0x4b2c('0x1a')](_0x4d4e22);}return null;};}function patchUpdates(_0x602712){return function(_0x9f545f){try{jsonpatch[_0x4b2c('0x20')](_0x9f545f,_0x602712,!![]);}catch(_0x49e78a){return BPromise[_0x4b2c('0x21')](_0x49e78a);}return _0x9f545f[_0x4b2c('0x22')]();};}function saveUpdates(_0x30345d,_0x48696a){return function(_0x3f6efc){if(_0x3f6efc){return _0x3f6efc[_0x4b2c('0x23')](_0x30345d)[_0x4b2c('0x24')](function(_0x4bf1d1){return _0x4bf1d1;});}return null;};}function removeEntity(_0x555858,_0x50ece4){return function(_0x197a56){if(_0x197a56){return _0x197a56[_0x4b2c('0x25')]()[_0x4b2c('0x24')](function(){_0x555858[_0x4b2c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa765f5,_0x15fbf2){return function(_0x15c113){if(!_0x15c113){_0xa765f5[_0x4b2c('0x17')](0x194);}return _0x15c113;};}function handleError(_0x1d567b,_0x277cef){_0x277cef=_0x277cef||0x1f4;return function(_0x2f13c2){logger['error'](_0x2f13c2[_0x4b2c('0x26')]);if(_0x2f13c2['name']){delete _0x2f13c2['name'];}_0x1d567b[_0x4b2c('0x19')](_0x277cef)['send'](_0x2f13c2);};}exports[_0x4b2c('0x27')]=function(_0x598119,_0x2db497){var _0x10599d={},_0x18a20d={},_0x4ea546={'count':0x0,'rows':[]};var _0x2084c2=_[_0x4b2c('0x28')](db[_0x4b2c('0x29')]['rawAttributes'],function(_0x4072b0){return{'name':_0x4072b0['fieldName'],'type':_0x4072b0[_0x4b2c('0x2a')][_0x4b2c('0x2b')]};});_0x18a20d['model']=_[_0x4b2c('0x28')](_0x2084c2,'name');_0x18a20d[_0x4b2c('0x2c')]=_[_0x4b2c('0x2d')](_0x598119[_0x4b2c('0x2c')]);_0x18a20d[_0x4b2c('0x2e')]=_[_0x4b2c('0x2f')](_0x18a20d[_0x4b2c('0x30')],_0x18a20d[_0x4b2c('0x2c')]);_0x10599d[_0x4b2c('0x31')]=_['intersection'](_0x18a20d[_0x4b2c('0x30')],qs[_0x4b2c('0x32')](_0x598119[_0x4b2c('0x2c')]['fields']));_0x10599d[_0x4b2c('0x31')]=_0x10599d['attributes'][_0x4b2c('0x33')]?_0x10599d[_0x4b2c('0x31')]:_0x18a20d[_0x4b2c('0x30')];if(!_0x598119[_0x4b2c('0x2c')][_0x4b2c('0x34')](_0x4b2c('0x35'))){_0x10599d[_0x4b2c('0x1c')]=qs[_0x4b2c('0x1c')](_0x598119['query'][_0x4b2c('0x1c')]);_0x10599d[_0x4b2c('0x1d')]=qs['offset'](_0x598119[_0x4b2c('0x2c')][_0x4b2c('0x1d')]);}_0x10599d['order']=qs[_0x4b2c('0x36')](_0x598119[_0x4b2c('0x2c')]['sort']);_0x10599d[_0x4b2c('0x37')]=qs[_0x4b2c('0x2e')](_[_0x4b2c('0x38')](_0x598119['query'],_0x18a20d[_0x4b2c('0x2e')]),_0x2084c2);if(_0x598119[_0x4b2c('0x2c')][_0x4b2c('0x39')]){_0x10599d[_0x4b2c('0x37')]=_[_0x4b2c('0x3a')](_0x10599d['where'],{'$or':_[_0x4b2c('0x28')](_0x2084c2,function(_0x4d0dfe){if(_0x4d0dfe[_0x4b2c('0x2a')]!==_0x4b2c('0x3b')){var _0x2fad7d={};_0x2fad7d[_0x4d0dfe[_0x4b2c('0x3c')]]={'$like':'%'+_0x598119[_0x4b2c('0x2c')]['filter']+'%'};return _0x2fad7d;}})});}_0x10599d=_['merge']({},_0x10599d,_0x598119[_0x4b2c('0x3d')]);var _0x6d00b9={'where':_0x10599d[_0x4b2c('0x37')]};return db[_0x4b2c('0x29')][_0x4b2c('0x3e')](_0x6d00b9)['then'](function(_0x32c0f1){_0x4ea546[_0x4b2c('0x3e')]=_0x32c0f1;if(_0x598119[_0x4b2c('0x2c')][_0x4b2c('0x3f')]){_0x10599d[_0x4b2c('0x40')]=[{'all':!![]}];}return db[_0x4b2c('0x29')][_0x4b2c('0x41')](_0x10599d);})[_0x4b2c('0x24')](function(_0x5d1309){_0x4ea546['rows']=_0x5d1309;return _0x4ea546;})[_0x4b2c('0x24')](respondWithFilteredResult(_0x2db497,_0x10599d))[_0x4b2c('0x42')](handleError(_0x2db497,null));};exports[_0x4b2c('0x43')]=function(_0x3325b2,_0x49dd15){var _0x42b76a={'raw':!![],'where':{'id':_0x3325b2[_0x4b2c('0x44')]['id']}},_0x13de8d={};_0x13de8d[_0x4b2c('0x30')]=_[_0x4b2c('0x2d')](db[_0x4b2c('0x29')][_0x4b2c('0x45')]);_0x13de8d[_0x4b2c('0x2c')]=_[_0x4b2c('0x2d')](_0x3325b2['query']);_0x13de8d['filters']=_[_0x4b2c('0x2f')](_0x13de8d[_0x4b2c('0x30')],_0x13de8d[_0x4b2c('0x2c')]);_0x42b76a[_0x4b2c('0x31')]=_[_0x4b2c('0x2f')](_0x13de8d['model'],qs[_0x4b2c('0x32')](_0x3325b2[_0x4b2c('0x2c')][_0x4b2c('0x32')]));_0x42b76a['attributes']=_0x42b76a[_0x4b2c('0x31')]['length']?_0x42b76a[_0x4b2c('0x31')]:_0x13de8d[_0x4b2c('0x30')];if(_0x3325b2[_0x4b2c('0x2c')]['includeAll']){_0x42b76a[_0x4b2c('0x40')]=[{'all':!![]}];}_0x42b76a=_['merge']({},_0x42b76a,_0x3325b2[_0x4b2c('0x3d')]);return db['CmHopperBlack'][_0x4b2c('0x46')](_0x42b76a)[_0x4b2c('0x24')](handleEntityNotFound(_0x49dd15,null))[_0x4b2c('0x24')](respondWithResult(_0x49dd15,null))[_0x4b2c('0x42')](handleError(_0x49dd15,null));};exports[_0x4b2c('0x23')]=function(_0xf1bace,_0x27bae4){if(_0xf1bace[_0x4b2c('0x47')]['id']){delete _0xf1bace[_0x4b2c('0x47')]['id'];}return db[_0x4b2c('0x29')][_0x4b2c('0x46')]({'where':{'id':_0xf1bace[_0x4b2c('0x44')]['id']}})[_0x4b2c('0x24')](handleEntityNotFound(_0x27bae4,null))['then'](saveUpdates(_0xf1bace[_0x4b2c('0x47')],null))[_0x4b2c('0x24')](respondWithResult(_0x27bae4,null))[_0x4b2c('0x42')](handleError(_0x27bae4,null));};exports['destroy']=function(_0x2a34ad,_0x3cc1e9){return db['CmHopperBlack']['find']({'where':{'id':_0x2a34ad['params']['id']}})[_0x4b2c('0x24')](handleEntityNotFound(_0x3cc1e9,null))[_0x4b2c('0x24')](removeEntity(_0x3cc1e9,null))[_0x4b2c('0x42')](handleError(_0x3cc1e9,null));};exports[_0x4b2c('0x48')]=function(_0x23e229,_0x389358){return db[_0x4b2c('0x29')][_0x4b2c('0x48')]()[_0x4b2c('0x24')](respondWithResult(_0x389358,null))[_0x4b2c('0x42')](handleError(_0x389358,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7a24514..4ba5ac9 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 _0xe4d7=['cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x422007,_0x4f343a){var _0x449aca=function(_0x2afaac){while(--_0x2afaac){_0x422007['push'](_0x422007['shift']());}};_0x449aca(++_0x4f343a);}(_0xe4d7,0x17b));var _0x7e4d=function(_0x1ca260,_0xe1eaf5){_0x1ca260=_0x1ca260-0x0;var _0x401e94=_0xe4d7[_0x1ca260];return _0x401e94;};'use strict';var _=require(_0x7e4d('0x0'));var util=require(_0x7e4d('0x1'));var logger=require(_0x7e4d('0x2'))(_0x7e4d('0x3'));var moment=require(_0x7e4d('0x4'));var BPromise=require(_0x7e4d('0x5'));var rp=require(_0x7e4d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e4d('0x7'));var config=require(_0x7e4d('0x8'));var attributes=require(_0x7e4d('0x9'));module[_0x7e4d('0xa')]=function(_0x586f4e,_0x1c1a4f){return _0x586f4e[_0x7e4d('0xb')](_0x7e4d('0xc'),attributes,{'tableName':_0x7e4d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a82=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','util','api','bluebird'];(function(_0x503acb,_0x521d43){var _0x26ea2d=function(_0x107851){while(--_0x107851){_0x503acb['push'](_0x503acb['shift']());}};_0x26ea2d(++_0x521d43);}(_0x4a82,0x1ab));var _0x24a8=function(_0x1fc1c3,_0x219527){_0x1fc1c3=_0x1fc1c3-0x0;var _0x47b6f8=_0x4a82[_0x1fc1c3];return _0x47b6f8;};'use strict';var _=require('lodash');var util=require(_0x24a8('0x0'));var logger=require('../../config/logger')(_0x24a8('0x1'));var moment=require('moment');var BPromise=require(_0x24a8('0x2'));var rp=require(_0x24a8('0x3'));var fs=require('fs');var path=require(_0x24a8('0x4'));var rimraf=require(_0x24a8('0x5'));var config=require(_0x24a8('0x6'));var attributes=require(_0x24a8('0x7'));module[_0x24a8('0x8')]=function(_0xa53e75,_0x48936f){return _0xa53e75[_0x24a8('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','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 023cf60..f82273f 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 _0xe6af=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3c6e13,_0x41811d){var _0x3cb3f0=function(_0x50b776){while(--_0x50b776){_0x3c6e13['push'](_0x3c6e13['shift']());}};_0x3cb3f0(++_0x41811d);}(_0xe6af,0x160));var _0xfe6a=function(_0x685755,_0x23b767){_0x685755=_0x685755-0x0;var _0x28ca87=_0xe6af[_0x685755];return _0x28ca87;};'use strict';var _=require(_0xfe6a('0x0'));var util=require(_0xfe6a('0x1'));var moment=require(_0xfe6a('0x2'));var BPromise=require(_0xfe6a('0x3'));var rs=require(_0xfe6a('0x4'));var fs=require('fs');var Redis=require(_0xfe6a('0x5'));var db=require(_0xfe6a('0x6'))['db'];var utils=require(_0xfe6a('0x7'));var logger=require(_0xfe6a('0x8'))(_0xfe6a('0x9'));var config=require(_0xfe6a('0xa'));var jayson=require(_0xfe6a('0xb'));var client=jayson[_0xfe6a('0xc')][_0xfe6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x11563a,_0x5e6846,_0x331892){return new BPromise(function(_0x42aae0,_0x16a570){return client[_0xfe6a('0xe')](_0x11563a,_0x331892)[_0xfe6a('0xf')](function(_0x548e88){logger[_0xfe6a('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x5e6846,_0xfe6a('0x11'));logger[_0xfe6a('0x12')](_0xfe6a('0x13'),_0x5e6846,_0xfe6a('0x11'),JSON['stringify'](_0x548e88));if(_0x548e88[_0xfe6a('0x14')]){if(_0x548e88[_0xfe6a('0x14')]['code']===0x1f4){logger[_0xfe6a('0x14')](_0xfe6a('0x15'),_0x5e6846,_0x548e88[_0xfe6a('0x14')]['message']);return _0x16a570(_0x548e88['error']['message']);}logger['error'](_0xfe6a('0x15'),_0x5e6846,_0x548e88[_0xfe6a('0x14')][_0xfe6a('0x16')]);return _0x42aae0(_0x548e88['error'][_0xfe6a('0x16')]);}else{logger[_0xfe6a('0x10')](_0xfe6a('0x15'),_0x5e6846,_0xfe6a('0x11'));_0x42aae0(_0x548e88[_0xfe6a('0x17')][_0xfe6a('0x16')]);}})[_0xfe6a('0x18')](function(_0x235bc6){logger[_0xfe6a('0x14')](_0xfe6a('0x15'),_0x5e6846,_0x235bc6);_0x16a570(_0x235bc6);});});}exports['GetCmHopperBlack']=function(_0x1b7c61){var _0xb4dfc3=this;return new Promise(function(_0x338c7f,_0x26c372){return db[_0xfe6a('0x19')]['findAll']({'raw':_0x1b7c61[_0xfe6a('0x1a')]?_0x1b7c61[_0xfe6a('0x1a')][_0xfe6a('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b7c61[_0xfe6a('0x1a')]?_0x1b7c61['options']['where']||null:null,'attributes':_0x1b7c61[_0xfe6a('0x1a')]?_0x1b7c61['options'][_0xfe6a('0x1c')]||null:null,'limit':_0x1b7c61[_0xfe6a('0x1a')]?_0x1b7c61[_0xfe6a('0x1a')][_0xfe6a('0x1d')]||null:null,'include':_0x1b7c61[_0xfe6a('0x1a')]?_0x1b7c61[_0xfe6a('0x1a')][_0xfe6a('0x1e')]?_[_0xfe6a('0x1f')](_0x1b7c61['options'][_0xfe6a('0x1e')],function(_0x3a5cab){return{'model':db[_0x3a5cab[_0xfe6a('0x20')]],'as':_0x3a5cab['as'],'attributes':_0x3a5cab[_0xfe6a('0x1c')],'include':_0x3a5cab['include']?_['map'](_0x3a5cab['include'],function(_0x88de21){return{'model':db[_0x88de21[_0xfe6a('0x20')]],'as':_0x88de21['as'],'attributes':_0x88de21['attributes'],'include':_0x88de21['include']?_[_0xfe6a('0x1f')](_0x88de21[_0xfe6a('0x1e')],function(_0x129fd0){return{'model':db[_0x129fd0[_0xfe6a('0x20')]],'as':_0x129fd0['as'],'attributes':_0x129fd0[_0xfe6a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfe6a('0xf')](function(_0x79eb34){logger['info'](_0xfe6a('0x21'),_0x1b7c61);logger[_0xfe6a('0x12')](_0xfe6a('0x21'),_0x1b7c61,JSON['stringify'](_0x79eb34));_0x338c7f(_0x79eb34);})[_0xfe6a('0x18')](function(_0x5a9936){logger[_0xfe6a('0x14')](_0xfe6a('0x21'),_0x5a9936[_0xfe6a('0x16')],_0x1b7c61);_0x26c372(_0xb4dfc3[_0xfe6a('0x14')](0x1f4,_0x5a9936[_0xfe6a('0x16')]));});});};exports[_0xfe6a('0x22')]=function(_0x1a60e8){var _0x7e648a=this;return new Promise(function(_0x53fc6b,_0x477ad3){return db[_0xfe6a('0x19')][_0xfe6a('0x23')](_0x1a60e8['body'],{'raw':_0x1a60e8['options']?_0x1a60e8[_0xfe6a('0x1a')][_0xfe6a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a60e8[_0xfe6a('0x1a')]?_0x1a60e8['options'][_0xfe6a('0x24')]||null:null,'attributes':_0x1a60e8[_0xfe6a('0x1a')]?_0x1a60e8[_0xfe6a('0x1a')][_0xfe6a('0x1c')]||null:null,'limit':_0x1a60e8[_0xfe6a('0x1a')]?_0x1a60e8[_0xfe6a('0x1a')]['limit']||null:null})[_0xfe6a('0xf')](function(_0x31231b){logger[_0xfe6a('0x10')]('UpdateCmHopperBlack',_0x1a60e8);logger[_0xfe6a('0x12')](_0xfe6a('0x22'),_0x1a60e8,JSON['stringify'](_0x31231b));_0x53fc6b(_0x31231b);})[_0xfe6a('0x18')](function(_0x4df5c9){logger[_0xfe6a('0x14')](_0xfe6a('0x22'),_0x4df5c9[_0xfe6a('0x16')],_0x1a60e8);_0x477ad3(_0x7e648a[_0xfe6a('0x14')](0x1f4,_0x4df5c9[_0xfe6a('0x16')]));});});};exports[_0xfe6a('0x25')]=function(_0x478135){var _0x3238ef=this;return new Promise(function(_0x1ba8ca,_0x26a116){return db[_0xfe6a('0x19')][_0xfe6a('0x26')]({'where':_0x478135[_0xfe6a('0x1a')]?_0x478135[_0xfe6a('0x1a')][_0xfe6a('0x24')]||null:null})[_0xfe6a('0xf')](function(_0x244b21){logger[_0xfe6a('0x10')](_0xfe6a('0x25'),_0x478135);logger['debug']('DestroyCmHopperBlack',_0x478135,JSON[_0xfe6a('0x27')](_0x244b21));_0x1ba8ca(_0x244b21);})[_0xfe6a('0x18')](function(_0x4ea8eb){logger['error'](_0xfe6a('0x25'),_0x4ea8eb['message'],_0x478135);_0x26a116(_0x3238ef[_0xfe6a('0x14')](0x1f4,_0x4ea8eb[_0xfe6a('0x16')]));});});}; \ No newline at end of file +var _0x03b9=['CmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','GetCmHopperBlack','options','raw','where','attributes','map','include','model','UpdateCmHopperBlack'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x03b9,0x127));var _0x903b=function(_0x2b7519,_0x438f55){_0x2b7519=_0x2b7519-0x0;var _0x562914=_0x03b9[_0x2b7519];return _0x562914;};'use strict';var _=require(_0x903b('0x0'));var util=require('util');var moment=require(_0x903b('0x1'));var BPromise=require(_0x903b('0x2'));var rs=require(_0x903b('0x3'));var fs=require('fs');var Redis=require(_0x903b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x903b('0x5'))('rpc');var config=require(_0x903b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x903b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3363c5,_0x5d5e3f,_0x5d9004){return new BPromise(function(_0x4dadd1,_0x7c925d){return client[_0x903b('0x8')](_0x3363c5,_0x5d9004)[_0x903b('0x9')](function(_0x3b40a4){logger[_0x903b('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x5d5e3f,_0x903b('0xb'));logger[_0x903b('0xc')](_0x903b('0xd'),_0x5d5e3f,_0x903b('0xb'),JSON[_0x903b('0xe')](_0x3b40a4));if(_0x3b40a4['error']){if(_0x3b40a4[_0x903b('0xf')][_0x903b('0x10')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5d5e3f,_0x3b40a4[_0x903b('0xf')][_0x903b('0x11')]);return _0x7c925d(_0x3b40a4[_0x903b('0xf')][_0x903b('0x11')]);}logger[_0x903b('0xf')](_0x903b('0x12'),_0x5d5e3f,_0x3b40a4[_0x903b('0xf')][_0x903b('0x11')]);return _0x4dadd1(_0x3b40a4[_0x903b('0xf')]['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x5d5e3f,_0x903b('0xb'));_0x4dadd1(_0x3b40a4[_0x903b('0x13')]['message']);}})['catch'](function(_0x38a0e8){logger[_0x903b('0xf')](_0x903b('0x12'),_0x5d5e3f,_0x38a0e8);_0x7c925d(_0x38a0e8);});});}exports[_0x903b('0x14')]=function(_0x144375){var _0x128e7d=this;return new Promise(function(_0x17e300,_0x31266c){return db['CmHopperBlack']['findAll']({'raw':_0x144375[_0x903b('0x15')]?_0x144375[_0x903b('0x15')][_0x903b('0x16')]===undefined?!![]:![]:!![],'where':_0x144375[_0x903b('0x15')]?_0x144375[_0x903b('0x15')][_0x903b('0x17')]||null:null,'attributes':_0x144375['options']?_0x144375[_0x903b('0x15')][_0x903b('0x18')]||null:null,'limit':_0x144375[_0x903b('0x15')]?_0x144375['options']['limit']||null:null,'include':_0x144375[_0x903b('0x15')]?_0x144375['options']['include']?_[_0x903b('0x19')](_0x144375[_0x903b('0x15')][_0x903b('0x1a')],function(_0x56e6dd){return{'model':db[_0x56e6dd[_0x903b('0x1b')]],'as':_0x56e6dd['as'],'attributes':_0x56e6dd[_0x903b('0x18')],'include':_0x56e6dd['include']?_[_0x903b('0x19')](_0x56e6dd[_0x903b('0x1a')],function(_0x19e2cd){return{'model':db[_0x19e2cd['model']],'as':_0x19e2cd['as'],'attributes':_0x19e2cd[_0x903b('0x18')],'include':_0x19e2cd['include']?_[_0x903b('0x19')](_0x19e2cd[_0x903b('0x1a')],function(_0x59f691){return{'model':db[_0x59f691[_0x903b('0x1b')]],'as':_0x59f691['as'],'attributes':_0x59f691[_0x903b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e76de){logger[_0x903b('0xa')](_0x903b('0x14'),_0x144375);logger[_0x903b('0xc')]('GetCmHopperBlack',_0x144375,JSON[_0x903b('0xe')](_0x5e76de));_0x17e300(_0x5e76de);})['catch'](function(_0x594cef){logger[_0x903b('0xf')](_0x903b('0x14'),_0x594cef[_0x903b('0x11')],_0x144375);_0x31266c(_0x128e7d[_0x903b('0xf')](0x1f4,_0x594cef['message']));});});};exports[_0x903b('0x1c')]=function(_0x3857f5){var _0x201b5f=this;return new Promise(function(_0x2f5d7e,_0x2fde7e){return db[_0x903b('0x1d')][_0x903b('0x1e')](_0x3857f5[_0x903b('0x1f')],{'raw':_0x3857f5[_0x903b('0x15')]?_0x3857f5[_0x903b('0x15')][_0x903b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3857f5['options']?_0x3857f5['options']['where']||null:null,'attributes':_0x3857f5[_0x903b('0x15')]?_0x3857f5[_0x903b('0x15')]['attributes']||null:null,'limit':_0x3857f5[_0x903b('0x15')]?_0x3857f5['options'][_0x903b('0x20')]||null:null})[_0x903b('0x9')](function(_0x3d1519){logger[_0x903b('0xa')]('UpdateCmHopperBlack',_0x3857f5);logger[_0x903b('0xc')](_0x903b('0x1c'),_0x3857f5,JSON[_0x903b('0xe')](_0x3d1519));_0x2f5d7e(_0x3d1519);})['catch'](function(_0x54618f){logger[_0x903b('0xf')](_0x903b('0x1c'),_0x54618f[_0x903b('0x11')],_0x3857f5);_0x2fde7e(_0x201b5f[_0x903b('0xf')](0x1f4,_0x54618f[_0x903b('0x11')]));});});};exports[_0x903b('0x21')]=function(_0x230c95){var _0xbb6800=this;return new Promise(function(_0x274ae4,_0x537d32){return db[_0x903b('0x1d')][_0x903b('0x22')]({'where':_0x230c95[_0x903b('0x15')]?_0x230c95[_0x903b('0x15')][_0x903b('0x17')]||null:null})[_0x903b('0x9')](function(_0x58324f){logger[_0x903b('0xa')](_0x903b('0x21'),_0x230c95);logger['debug']('DestroyCmHopperBlack',_0x230c95,JSON[_0x903b('0xe')](_0x58324f));_0x274ae4(_0x58324f);})[_0x903b('0x23')](function(_0x875584){logger[_0x903b('0xf')](_0x903b('0x21'),_0x875584[_0x903b('0x11')],_0x230c95);_0x537d32(_0xbb6800['error'](0x1f4,_0x875584['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ac11b0c..84351ed 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','delete','destroy','multer','util'];(function(_0x3e59e6,_0x57029f){var _0x1a6ad5=function(_0x2dd63d){while(--_0x2dd63d){_0x3e59e6['push'](_0x3e59e6['shift']());}};_0x1a6ad5(++_0x57029f);}(_0xf494,0x1c6));var _0x4f49=function(_0x506572,_0xea854f){_0x506572=_0x506572-0x0;var _0x165744=_0xf494[_0x506572];return _0x165744;};'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('0x10')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x11')](_0x4f49('0xe'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','/describe','isAuthenticated'];(function(_0x3c2e8e,_0x158a83){var _0x4338bd=function(_0x52eda6){while(--_0x52eda6){_0x3c2e8e['push'](_0x3c2e8e['shift']());}};_0x4338bd(++_0x158a83);}(_0x2ef3,0xba));var _0x32ef=function(_0x535bc5,_0xd55fb0){_0x535bc5=_0x535bc5-0x0;var _0x4e0075=_0x2ef3[_0x535bc5];return _0x4e0075;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x32ef('0x10')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 076484d..7c8cf15 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 _0x9e2b=['setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x23285f,_0x5529ce){var _0x1a5a34=function(_0x57cd52){while(--_0x57cd52){_0x23285f['push'](_0x23285f['shift']());}};_0x1a5a34(++_0x5529ce);}(_0x9e2b,0x179));var _0xb9e2=function(_0x4bc1c2,_0x11e45c){_0x4bc1c2=_0x4bc1c2-0x0;var _0x17f215=_0x9e2b[_0x4bc1c2];return _0x17f215;};'use strict';var Sequelize=require(_0xb9e2('0x0'));var moment=require(_0xb9e2('0x1'));module['exports']={'state':{'type':Sequelize[_0xb9e2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb9e2('0x3')]},'scheduledat':{'type':Sequelize[_0xb9e2('0x4')]},'countbusyretry':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb9e2('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb9e2('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb9e2('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb9e2('0x4')]},'responsetime':{'type':Sequelize[_0xb9e2('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb9e2('0x4')]},'ringtime':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb9e2('0x3')]},'campaign':{'type':Sequelize[_0xb9e2('0x3')]},'campaigntype':{'type':Sequelize[_0xb9e2('0x3')]},'membername':{'type':Sequelize[_0xb9e2('0x3')]},'reason':{'type':Sequelize[_0xb9e2('0x3')]},'disposition':{'type':Sequelize[_0xb9e2('0x3')]},'secondDisposition':{'type':Sequelize[_0xb9e2('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb9e2('0x3')]},'dispositionat':{'type':Sequelize[_0xb9e2('0x4')],'set':function(_0x4b7d56){var _0xd2df5=this[_0xb9e2('0x5')](_0xb9e2('0x6'));if(_0xd2df5&&_0x4b7d56){this[_0xb9e2('0x7')](_0xb9e2('0x8'),moment(_0x4b7d56)[_0xb9e2('0x9')](moment(_0xd2df5),_0xb9e2('0xa')));}}},'amd':{'type':Sequelize[_0xb9e2('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb9e2('0x4')]},'callback':{'type':Sequelize[_0xb9e2('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb9e2('0x4')]},'deleted':{'type':Sequelize[_0xb9e2('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb9e2('0x4')]},'recallme':{'type':Sequelize[_0xb9e2('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb9e2('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb9e2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0b7d=['INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','seconds','BOOLEAN','sequelize','exports'];(function(_0x1a0aa4,_0x366f8d){var _0x18db26=function(_0x34d677){while(--_0x34d677){_0x1a0aa4['push'](_0x1a0aa4['shift']());}};_0x18db26(++_0x366f8d);}(_0x0b7d,0x170));var _0xd0b7=function(_0xa3a76e,_0x55edec){_0xa3a76e=_0xa3a76e-0x0;var _0x125fce=_0x0b7d[_0xa3a76e];return _0x125fce;};'use strict';var Sequelize=require(_0xd0b7('0x0'));var moment=require('moment');module[_0xd0b7('0x1')]={'state':{'type':Sequelize[_0xd0b7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd0b7('0x3')]},'scheduledat':{'type':Sequelize[_0xd0b7('0x4')]},'countbusyretry':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd0b7('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd0b7('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd0b7('0x4')]},'responsetime':{'type':Sequelize[_0xd0b7('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd0b7('0x4')]},'ringtime':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd0b7('0x3')]},'campaign':{'type':Sequelize[_0xd0b7('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd0b7('0x3')]},'disposition':{'type':Sequelize[_0xd0b7('0x3')]},'secondDisposition':{'type':Sequelize[_0xd0b7('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xd0b7('0x4')],'set':function(_0x3c0197){var _0x447740=this[_0xd0b7('0x5')]('endtime');if(_0x447740&&_0x3c0197){this[_0xd0b7('0x6')](_0xd0b7('0x7'),moment(_0x3c0197)['diff'](moment(_0x447740),_0xd0b7('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd0b7('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd0b7('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd0b7('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd0b7('0x4')]},'deleted':{'type':Sequelize[_0xd0b7('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd0b7('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd0b7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd0b7('0x2')],'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 d356d3a..3abb9ae 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 _0x1967=['sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','CmHopperFinal','includeAll','include','findAll','rows','show','params','fields','options','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`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','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','state','calleridnum','group','checkContactHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3c82f7,_0x5271f2){var _0x1508f6=function(_0x13b784){while(--_0x13b784){_0x3c82f7['push'](_0x3c82f7['shift']());}};_0x1508f6(++_0x5271f2);}(_0x1967,0x173));var _0x7196=function(_0xee1405,_0x118dd8){_0xee1405=_0xee1405-0x0;var _0x1f1d56=_0x1967[_0xee1405];return _0x1f1d56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['CmHopperFinal'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':!![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['describe']=function(_0x29c7e8,_0x582884){return db['CmHopperFinal'][_0x7196('0x49')]()['then'](respondWithResult(_0x582884,null))['catch'](handleError(_0x582884,null));};exports['update']=function(_0x2299e2,_0x5052ee){if(_0x2299e2['body'][_0x7196('0x4a')]){delete _0x2299e2[_0x7196('0x4b')][_0x7196('0x4a')];}return db[_0x7196('0x3e')]['find']({'where':{'uniqueid':_0x2299e2[_0x7196('0x44')]['id']}})['then'](handleEntityNotFound(_0x5052ee,null))[_0x7196('0x27')](saveUpdates(_0x2299e2[_0x7196('0x4b')],null))['then'](respondWithResult(_0x5052ee,null))[_0x7196('0x48')](handleError(_0x5052ee,null));};exports[_0x7196('0x4c')]=function(_0x3fe092,_0x4fa18f,_0x317ab6){return db['CmHopperFinal'][_0x7196('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x3fe092[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),_0x7196('0x51')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x52')))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x54')))),_0x7196('0x55')],[db['sequelize']['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7196('0x58')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),'reCallContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7196('0x27')](handleEntityNotFound(_0x4fa18f,null))[_0x7196('0x27')](respondWithResult(_0x4fa18f,null))[_0x7196('0x48')](handleError(_0x4fa18f,null));};exports[_0x7196('0x5a')]=function(_0x14cb38,_0x43b9ac,_0xe3fb61){return db[_0x7196('0x3e')][_0x7196('0x41')]({'raw':![],'where':{'CampaignId':_0x14cb38[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5b')))),_0x7196('0x51')],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x54')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),_0x7196('0x5d')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x7196('0x5e')]]})['then'](handleEntityNotFound(_0x43b9ac,null))[_0x7196('0x27')](respondWithResult(_0x43b9ac,null))[_0x7196('0x48')](handleError(_0x43b9ac,null));};exports[_0x7196('0x5f')]=function(_0x267903,_0x5ab6ae,_0x5a786a){return db[_0x7196('0x60')]['find']({'where':{'id':_0x267903[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x5ab6ae,null))[_0x7196('0x27')](function(_0x38c1b3){var _0xd4c784;if(_0x38c1b3){_0xd4c784=squel[_0x7196('0x61')]()['into'](_0x7196('0x62'))[_0x7196('0x63')]([_0x7196('0x64'),_0x7196('0x65'),_0x7196('0x66'),_0x7196('0x67'),_0x7196('0x68'),_0x7196('0x69'),_0x7196('0x6a')],squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x6d'),'phone')[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')['field'](_0x7196('0x6f'),_0x7196('0x66'))[_0x7196('0x6c')]('ANY_VALUE(ListId)',_0x7196('0x67'))['field'](_0x7196('0x70'),_0x7196('0x68'))['field'](_0x7196('0x6e'),'createdAt')['field'](_0x7196('0x6e'),_0x7196('0x6a'))[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')]('VoiceQueueId\x20=\x20?',_0x267903[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x73'),_0x267903[_0x7196('0x4b')]['state'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x74'))[_0x7196('0x3a')](_0x7196('0x75'),squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x64'))['from'](_0x7196('0x62'))[_0x7196('0x3a')](_0x7196('0x76'),_0x267903[_0x7196('0x44')]['id']['toString']()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')]('calleridnum')[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')](_0x7196('0x76'),_0x267903['params']['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x77')))['group']('ContactId'))[_0x7196('0x72')]();return db['sequelize']['query'](_0xd4c784);}return[];})[_0x7196('0x27')](respondWithResult(_0x5ab6ae,null))[_0x7196('0x48')](handleError(_0x5ab6ae,null));};exports[_0x7196('0x78')]=function(_0x509c4a,_0x35c5b3,_0x59370b){return db[_0x7196('0x79')][_0x7196('0x47')]({'where':{'id':_0x509c4a[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x35c5b3,null))[_0x7196('0x27')](function(_0x8673e){var _0x32ba47;if(_0x8673e){_0x32ba47=squel[_0x7196('0x61')]()[_0x7196('0x7a')]('cm_hopper')['fromQuery']([_0x7196('0x64'),'scheduledAt','ContactId',_0x7196('0x67'),_0x7196('0x7b'),_0x7196('0x69'),_0x7196('0x6a')],squel['select']()['field'](_0x7196('0x6d'),_0x7196('0x64'))[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')[_0x7196('0x6c')]('ANY_VALUE(ContactId)','ContactId')[_0x7196('0x6c')](_0x7196('0x7c'),_0x7196('0x67'))['field'](_0x7196('0x7d'),_0x7196('0x7b'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x69'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x6a'))['from'](_0x7196('0x7e'))[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())['where'](_0x7196('0x73'),_0x509c4a[_0x7196('0x4b')][_0x7196('0x80')]['toString']())[_0x7196('0x3a')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7196('0x75'),squel[_0x7196('0x6b')]()['field'](_0x7196('0x64'))[_0x7196('0x71')]('cm_hopper')[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')](_0x7196('0x81'))[_0x7196('0x71')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')]('state\x20=\x204'))[_0x7196('0x82')]('ContactId'))[_0x7196('0x72')]();return db['sequelize'][_0x7196('0x31')](_0x32ba47);}return[];})[_0x7196('0x27')](respondWithResult(_0x35c5b3,null))[_0x7196('0x48')](handleError(_0x35c5b3,null));};exports[_0x7196('0x83')]=function(_0x37290e,_0x10b628,_0x43e7d5){return db['CmHopper'][_0x7196('0x84')]({'where':{'VoiceQueueId':_0x37290e['body']['VoiceQueueId'],'CampaignId':_0x37290e['body']['CampaignId'],'ContactId':_0x37290e['body'][_0x7196('0x66')]}})[_0x7196('0x27')](handleEntityNotFound(_0x10b628,null))[_0x7196('0x27')](function(_0x5bab25){if(_0x5bab25){return _0x5bab25;}return null;})[_0x7196('0x27')](respondWithResult(_0x10b628,null))['catch'](handleError(_0x10b628,null));}; \ No newline at end of file +var _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x187d,0x93));var _0xd187=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x187d[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 34f0336..375bd63 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 _0x84fc=['calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x49a60f,_0x518c48){var _0x38c29c=function(_0x42b9cb){while(--_0x42b9cb){_0x49a60f['push'](_0x49a60f['shift']());}};_0x38c29c(++_0x518c48);}(_0x84fc,0x1a6));var _0xc84f=function(_0x227901,_0x1d8fca){_0x227901=_0x227901-0x0;var _0x5a55e4=_0x84fc[_0x227901];return _0x5a55e4;};'use strict';var _=require(_0xc84f('0x0'));var util=require(_0xc84f('0x1'));var logger=require(_0xc84f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc84f('0x3'));var rp=require(_0xc84f('0x4'));var fs=require('fs');var path=require(_0xc84f('0x5'));var rimraf=require(_0xc84f('0x6'));var config=require(_0xc84f('0x7'));var attributes=require(_0xc84f('0x8'));module[_0xc84f('0x9')]=function(_0xf11972,_0x5e971f){return _0xf11972[_0xc84f('0xa')]('CmHopperFinal',attributes,{'tableName':_0xc84f('0xb'),'paranoid':![],'indexes':[{'name':_0xc84f('0xc'),'fields':[_0xc84f('0xc')]},{'name':_0xc84f('0xd'),'fields':[_0xc84f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3529=['./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0x3529,0x87));var _0x9352=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x3529[_0x30cd7e];return _0x462a02;};'use strict';var _=require('lodash');var util=require(_0x9352('0x0'));var logger=require(_0x9352('0x1'))('api');var moment=require(_0x9352('0x2'));var BPromise=require(_0x9352('0x3'));var rp=require(_0x9352('0x4'));var fs=require('fs');var path=require(_0x9352('0x5'));var rimraf=require(_0x9352('0x6'));var config=require(_0x9352('0x7'));var attributes=require(_0x9352('0x8'));module['exports']=function(_0x595004,_0x303791){return _0x595004[_0x9352('0x9')]('CmHopperFinal',attributes,{'tableName':_0x9352('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x9352('0xb')]},{'name':_0x9352('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e9f01a7..5c69b54 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x333213,_0x432545){var _0x328460=function(_0x334c3b){while(--_0x334c3b){_0x333213['push'](_0x333213['shift']());}};_0x328460(++_0x432545);}(_0x7a54,0x106));var _0x47a5=function(_0x2c5a4c,_0x45f29a){_0x2c5a4c=_0x2c5a4c-0x0;var _0x3080a3=_0x7a54[_0x2c5a4c];return _0x3080a3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x584aa0,_0x28d65d){var _0xed67fb=function(_0x3ad447){while(--_0x3ad447){_0x584aa0['push'](_0x584aa0['shift']());}};_0xed67fb(++_0x28d65d);}(_0x7a54,0x106));var _0x47a5=function(_0x1b2d09,_0x47d6ab){_0x1b2d09=_0x1b2d09-0x0;var _0x8405de=_0x7a54[_0x1b2d09];return _0x8405de;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index b5b6e5d..b5337fd 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 _0xd9e3=['describe','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','/:id','update','exports','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0xd9e3,0x7b));var _0x3d9e=function(_0x5b9ac0,_0x5a4785){_0x5b9ac0=_0x5b9ac0-0x0;var _0x49d3f7=_0xd9e3[_0x5b9ac0];return _0x49d3f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3d9e('0x0'));var timeout=require(_0x3d9e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d9e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3d9e('0x3'));var config=require(_0x3d9e('0x4'));var controller=require(_0x3d9e('0x5'));router[_0x3d9e('0x6')]('/',auth[_0x3d9e('0x7')](),controller['index']);router[_0x3d9e('0x6')](_0x3d9e('0x8'),auth[_0x3d9e('0x7')](),controller[_0x3d9e('0x9')]);router[_0x3d9e('0x6')]('/:id',auth[_0x3d9e('0x7')](),controller[_0x3d9e('0xa')]);router[_0x3d9e('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x3d9e('0xb')]);router[_0x3d9e('0x6')]('/campaign/countAttributes/:id',auth[_0x3d9e('0x7')](),controller[_0x3d9e('0xc')]);router[_0x3d9e('0xd')](_0x3d9e('0xe'),auth[_0x3d9e('0x7')](),controller[_0x3d9e('0xf')]);router[_0x3d9e('0xd')]('/voice/campaign/moveContacts/:id',auth[_0x3d9e('0x7')](),controller[_0x3d9e('0x10')]);router[_0x3d9e('0xd')]('/checkContactHopper',auth[_0x3d9e('0x7')](),controller[_0x3d9e('0x11')]);router[_0x3d9e('0x12')](_0x3d9e('0x13'),auth[_0x3d9e('0x7')](),controller[_0x3d9e('0x14')]);module[_0x3d9e('0x15')]=router; \ No newline at end of file +var _0x9626=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x9626,0x196));var _0x6962=function(_0x16a22b,_0x5210fb){_0x16a22b=_0x16a22b-0x0;var _0xd667f0=_0x9626[_0x16a22b];return _0xd667f0;};'use strict';var multer=require(_0x6962('0x0'));var util=require(_0x6962('0x1'));var path=require(_0x6962('0x2'));var timeout=require('connect-timeout');var express=require(_0x6962('0x3'));var router=express['Router']();var fs_extra=require(_0x6962('0x4'));var auth=require(_0x6962('0x5'));var interaction=require(_0x6962('0x6'));var config=require(_0x6962('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x6962('0x8')]('/',auth['isAuthenticated'](),controller[_0x6962('0x9')]);router[_0x6962('0x8')](_0x6962('0xa'),auth[_0x6962('0xb')](),controller['describe']);router['get']('/:id',auth[_0x6962('0xb')](),controller[_0x6962('0xc')]);router[_0x6962('0x8')](_0x6962('0xd'),auth[_0x6962('0xb')](),controller[_0x6962('0xe')]);router[_0x6962('0x8')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x6962('0xf')]);router[_0x6962('0x10')](_0x6962('0x11'),auth[_0x6962('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x6962('0x10')](_0x6962('0x12'),auth[_0x6962('0xb')](),controller[_0x6962('0x13')]);router[_0x6962('0x10')](_0x6962('0x14'),auth['isAuthenticated'](),controller[_0x6962('0x15')]);router[_0x6962('0x16')](_0x6962('0x17'),auth[_0x6962('0xb')](),controller[_0x6962('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 29ab319..89d9b9b 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 _0x5d95=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x5d95,0x77));var _0x55d9=function(_0x3666e1,_0x10d17d){_0x3666e1=_0x3666e1-0x0;var _0x4e8f3f=_0x5d95[_0x3666e1];return _0x4e8f3f;};'use strict';var Sequelize=require(_0x55d9('0x0'));module[_0x55d9('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x55d9('0x2')]},'scheduledat':{'type':Sequelize[_0x55d9('0x3')]},'countbusyretry':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x55d9('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x55d9('0x2')]},'calleridname':{'type':Sequelize[_0x55d9('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x55d9('0x2')]},'campaign':{'type':Sequelize[_0x55d9('0x2')]},'campaigntype':{'type':Sequelize[_0x55d9('0x2')]},'membername':{'type':Sequelize[_0x55d9('0x2')]},'reason':{'type':Sequelize[_0x55d9('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x55d9('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x55d9('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x55d9('0x3')]},'recallme':{'type':Sequelize[_0x55d9('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x55d9('0x3')]},'edited':{'type':Sequelize[_0x55d9('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x55d9('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x55d9('0x2')]}}; \ No newline at end of file +var _0x2741=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x25280c,_0x2edec1){var _0x3a58c3=function(_0x5292a0){while(--_0x5292a0){_0x25280c['push'](_0x25280c['shift']());}};_0x3a58c3(++_0x2edec1);}(_0x2741,0xae));var _0x1274=function(_0x4c8fa1,_0x37c983){_0x4c8fa1=_0x4c8fa1-0x0;var _0x15ab54=_0x2741[_0x4c8fa1];return _0x15ab54;};'use strict';var Sequelize=require(_0x1274('0x0'));module[_0x1274('0x1')]={'state':{'type':Sequelize[_0x1274('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1274('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1274('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1274('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1274('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1274('0x4')]},'answertime':{'type':Sequelize[_0x1274('0x4')]},'droptime':{'type':Sequelize[_0x1274('0x4')]},'endtime':{'type':Sequelize[_0x1274('0x4')]},'ringtime':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1274('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1274('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x1274('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1274('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1274('0x4')]},'recallme':{'type':Sequelize[_0x1274('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1274('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1274('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1274('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 6cba044..f6f1be8 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 _0xa4b0=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','then','error','stack','send','index','map','CmHopperHistory','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','describe','update','uniqueid','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto'];(function(_0x52e040,_0x583d2f){var _0x4cd278=function(_0xa844b5){while(--_0xa844b5){_0x52e040['push'](_0x52e040['shift']());}};_0x4cd278(++_0x583d2f);}(_0xa4b0,0x90));var _0x0a4b=function(_0x11d1ed,_0x3a8455){_0x11d1ed=_0x11d1ed-0x0;var _0x1dacaa=_0xa4b0[_0x11d1ed];return _0x1dacaa;};'use strict';var emlformat=require(_0x0a4b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a4b('0x1'));var rp=require(_0x0a4b('0x2'));var moment=require(_0x0a4b('0x3'));var BPromise=require(_0x0a4b('0x4'));var Mustache=require('mustache');var util=require(_0x0a4b('0x5'));var path=require(_0x0a4b('0x6'));var sox=require(_0x0a4b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a4b('0x8'));var _=require(_0x0a4b('0x9'));var squel=require(_0x0a4b('0xa'));var crypto=require(_0x0a4b('0xb'));var jsforce=require(_0x0a4b('0xc'));var deskjs=require(_0x0a4b('0xd'));var toCsv=require(_0x0a4b('0xe'));var querystring=require(_0x0a4b('0xf'));var Papa=require('papaparse');var Redis=require(_0x0a4b('0x10'));var authService=require(_0x0a4b('0x11'));var qs=require(_0x0a4b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a4b('0x13'));var logger=require(_0x0a4b('0x14'))(_0x0a4b('0x15'));var utils=require(_0x0a4b('0x16'));var config=require(_0x0a4b('0x17'));var licenseUtil=require(_0x0a4b('0x18'));var db=require(_0x0a4b('0x19'))['db'];function respondWithStatusCode(_0x5d5357,_0x5bfbe5){_0x5bfbe5=_0x5bfbe5||0xcc;return function(_0x4ca1f8){if(_0x4ca1f8){return _0x5d5357[_0x0a4b('0x1a')](_0x5bfbe5);}return _0x5d5357[_0x0a4b('0x1b')](_0x5bfbe5)[_0x0a4b('0x1c')]();};}function respondWithResult(_0x1f22ff,_0x3f08cf){_0x3f08cf=_0x3f08cf||0xc8;return function(_0x4698be){if(_0x4698be){return _0x1f22ff['status'](_0x3f08cf)[_0x0a4b('0x1d')](_0x4698be);}};}function respondWithFilteredResult(_0x221c07,_0x6ad0ae){return function(_0x45ee0f){if(_0x45ee0f){var _0x4fa99e=typeof _0x6ad0ae['offset']==='undefined'&&typeof _0x6ad0ae[_0x0a4b('0x1e')]==='undefined';var _0x13540f=_0x45ee0f[_0x0a4b('0x1f')];var _0x254b75=_0x4fa99e?0x0:_0x6ad0ae[_0x0a4b('0x20')];var _0x3007b9=_0x4fa99e?_0x45ee0f[_0x0a4b('0x1f')]:_0x6ad0ae[_0x0a4b('0x20')]+_0x6ad0ae[_0x0a4b('0x1e')];var _0x287408;if(_0x3007b9>=_0x13540f){_0x3007b9=_0x13540f;_0x287408=0xc8;}else{_0x287408=0xce;}_0x221c07[_0x0a4b('0x1b')](_0x287408);return _0x221c07['set'](_0x0a4b('0x21'),_0x254b75+'-'+_0x3007b9+'/'+_0x13540f)['json'](_0x45ee0f);}return null;};}function patchUpdates(_0x32b87b){return function(_0x47aaf2){try{jsonpatch[_0x0a4b('0x22')](_0x47aaf2,_0x32b87b,!![]);}catch(_0x41c58a){return BPromise[_0x0a4b('0x23')](_0x41c58a);}return _0x47aaf2[_0x0a4b('0x24')]();};}function saveUpdates(_0x55918a,_0x13d82a){return function(_0x376bd5){if(_0x376bd5){return _0x376bd5['update'](_0x55918a)[_0x0a4b('0x25')](function(_0x207526){return _0x207526;});}return null;};}function removeEntity(_0x3a5160,_0x127896){return function(_0x44ef5f){if(_0x44ef5f){return _0x44ef5f['destroy']()[_0x0a4b('0x25')](function(){_0x3a5160[_0x0a4b('0x1b')](0xcc)[_0x0a4b('0x1c')]();});}};}function handleEntityNotFound(_0x228c0e,_0x90e119){return function(_0x8fdabb){if(!_0x8fdabb){_0x228c0e[_0x0a4b('0x1a')](0x194);}return _0x8fdabb;};}function handleError(_0x531975,_0x4e22ad){_0x4e22ad=_0x4e22ad||0x1f4;return function(_0x404fe8){logger[_0x0a4b('0x26')](_0x404fe8[_0x0a4b('0x27')]);if(_0x404fe8['name']){delete _0x404fe8['name'];}_0x531975[_0x0a4b('0x1b')](_0x4e22ad)[_0x0a4b('0x28')](_0x404fe8);};}exports[_0x0a4b('0x29')]=function(_0x238634,_0x25f1e9){var _0x22890b={},_0x1af548={},_0x4a1238={'count':0x0,'rows':[]};var _0x1e18c5=_[_0x0a4b('0x2a')](db[_0x0a4b('0x2b')]['rawAttributes'],function(_0x5c3390){return{'name':_0x5c3390[_0x0a4b('0x2c')],'type':_0x5c3390[_0x0a4b('0x2d')][_0x0a4b('0x2e')]};});_0x1af548[_0x0a4b('0x2f')]=_[_0x0a4b('0x2a')](_0x1e18c5,_0x0a4b('0x30'));_0x1af548[_0x0a4b('0x31')]=_[_0x0a4b('0x32')](_0x238634[_0x0a4b('0x31')]);_0x1af548[_0x0a4b('0x33')]=_[_0x0a4b('0x34')](_0x1af548[_0x0a4b('0x2f')],_0x1af548[_0x0a4b('0x31')]);_0x22890b[_0x0a4b('0x35')]=_[_0x0a4b('0x34')](_0x1af548[_0x0a4b('0x2f')],qs[_0x0a4b('0x36')](_0x238634['query'][_0x0a4b('0x36')]));_0x22890b['attributes']=_0x22890b[_0x0a4b('0x35')][_0x0a4b('0x37')]?_0x22890b[_0x0a4b('0x35')]:_0x1af548[_0x0a4b('0x2f')];if(!_0x238634['query']['hasOwnProperty'](_0x0a4b('0x38'))){_0x22890b[_0x0a4b('0x1e')]=qs[_0x0a4b('0x1e')](_0x238634[_0x0a4b('0x31')][_0x0a4b('0x1e')]);_0x22890b[_0x0a4b('0x20')]=qs[_0x0a4b('0x20')](_0x238634[_0x0a4b('0x31')]['offset']);}_0x22890b[_0x0a4b('0x39')]=qs[_0x0a4b('0x3a')](_0x238634[_0x0a4b('0x31')][_0x0a4b('0x3a')]);_0x22890b[_0x0a4b('0x3b')]=qs[_0x0a4b('0x33')](_[_0x0a4b('0x3c')](_0x238634[_0x0a4b('0x31')],_0x1af548[_0x0a4b('0x33')]),_0x1e18c5);if(_0x238634[_0x0a4b('0x31')][_0x0a4b('0x3d')]){_0x22890b[_0x0a4b('0x3b')]=_[_0x0a4b('0x3e')](_0x22890b[_0x0a4b('0x3b')],{'$or':_[_0x0a4b('0x2a')](_0x1e18c5,function(_0x46c20c){if(_0x46c20c[_0x0a4b('0x2d')]!==_0x0a4b('0x3f')){var _0x2ae134={};_0x2ae134[_0x46c20c['name']]={'$like':'%'+_0x238634[_0x0a4b('0x31')]['filter']+'%'};return _0x2ae134;}})});}_0x22890b=_[_0x0a4b('0x3e')]({},_0x22890b,_0x238634['options']);var _0x409f09={'where':_0x22890b['where']};return db[_0x0a4b('0x2b')]['count'](_0x409f09)[_0x0a4b('0x25')](function(_0x4bd9cd){_0x4a1238[_0x0a4b('0x1f')]=_0x4bd9cd;if(_0x238634[_0x0a4b('0x31')][_0x0a4b('0x40')]){_0x22890b[_0x0a4b('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a4b('0x42')](_0x22890b);})['then'](function(_0x1d3c04){_0x4a1238[_0x0a4b('0x43')]=_0x1d3c04;return _0x4a1238;})['then'](respondWithFilteredResult(_0x25f1e9,_0x22890b))[_0x0a4b('0x44')](handleError(_0x25f1e9,null));};exports[_0x0a4b('0x45')]=function(_0x239c3c,_0x3a6d40){var _0x50f186={'raw':!![],'where':{'id':_0x239c3c[_0x0a4b('0x46')]['id']}},_0x3ad377={};_0x3ad377['model']=_[_0x0a4b('0x32')](db['CmHopperHistory'][_0x0a4b('0x47')]);_0x3ad377[_0x0a4b('0x31')]=_['keys'](_0x239c3c[_0x0a4b('0x31')]);_0x3ad377[_0x0a4b('0x33')]=_['intersection'](_0x3ad377[_0x0a4b('0x2f')],_0x3ad377[_0x0a4b('0x31')]);_0x50f186[_0x0a4b('0x35')]=_[_0x0a4b('0x34')](_0x3ad377[_0x0a4b('0x2f')],qs['fields'](_0x239c3c['query']['fields']));_0x50f186[_0x0a4b('0x35')]=_0x50f186[_0x0a4b('0x35')][_0x0a4b('0x37')]?_0x50f186[_0x0a4b('0x35')]:_0x3ad377[_0x0a4b('0x2f')];if(_0x239c3c[_0x0a4b('0x31')][_0x0a4b('0x40')]){_0x50f186[_0x0a4b('0x41')]=[{'all':!![]}];}_0x50f186=_['merge']({},_0x50f186,_0x239c3c[_0x0a4b('0x48')]);return db[_0x0a4b('0x2b')][_0x0a4b('0x49')](_0x50f186)[_0x0a4b('0x25')](handleEntityNotFound(_0x3a6d40,null))[_0x0a4b('0x25')](respondWithResult(_0x3a6d40,null))[_0x0a4b('0x44')](handleError(_0x3a6d40,null));};exports['create']=function(_0x22b737,_0x30b983){return db['CmHopperHistory']['create'](_0x22b737[_0x0a4b('0x4a')],{})[_0x0a4b('0x25')](respondWithResult(_0x30b983,0xc9))['catch'](handleError(_0x30b983,null));};exports[_0x0a4b('0x4b')]=function(_0x189c7d,_0x350ba0){return db[_0x0a4b('0x2b')][_0x0a4b('0x4b')]()[_0x0a4b('0x25')](respondWithResult(_0x350ba0,null))[_0x0a4b('0x44')](handleError(_0x350ba0,null));};exports[_0x0a4b('0x4c')]=function(_0x20bd4e,_0x10e629){if(_0x20bd4e[_0x0a4b('0x4a')][_0x0a4b('0x4d')]){delete _0x20bd4e[_0x0a4b('0x4a')][_0x0a4b('0x4d')];}return db[_0x0a4b('0x2b')][_0x0a4b('0x49')]({'where':{'uniqueid':_0x20bd4e[_0x0a4b('0x46')]['id']}})[_0x0a4b('0x25')](handleEntityNotFound(_0x10e629,null))[_0x0a4b('0x25')](saveUpdates(_0x20bd4e[_0x0a4b('0x4a')],null))['then'](respondWithResult(_0x10e629,null))[_0x0a4b('0x44')](handleError(_0x10e629,null));}; \ No newline at end of file +var _0x18d1=['VIRTUAL','merge','options','then','includeAll','include','rows','catch','params','rawAttributes','fields','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','save','update','error','stack','name','send','index','map','CmHopperHistory','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','type'];(function(_0x38a366,_0x284d80){var _0x3d0557=function(_0x3e5fba){while(--_0x3e5fba){_0x38a366['push'](_0x38a366['shift']());}};_0x3d0557(++_0x284d80);}(_0x18d1,0xeb));var _0x118d=function(_0x105077,_0x17c544){_0x105077=_0x105077-0x0;var _0x1ede71=_0x18d1[_0x105077];return _0x1ede71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x118d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x118d('0x1'));var rp=require(_0x118d('0x2'));var moment=require(_0x118d('0x3'));var BPromise=require(_0x118d('0x4'));var Mustache=require(_0x118d('0x5'));var util=require(_0x118d('0x6'));var path=require('path');var sox=require(_0x118d('0x7'));var csv=require(_0x118d('0x8'));var ejs=require(_0x118d('0x9'));var fs=require('fs');var fs_extra=require(_0x118d('0xa'));var _=require(_0x118d('0xb'));var squel=require(_0x118d('0xc'));var crypto=require('crypto');var jsforce=require(_0x118d('0xd'));var deskjs=require(_0x118d('0xe'));var toCsv=require(_0x118d('0x8'));var querystring=require('querystring');var Papa=require(_0x118d('0xf'));var Redis=require(_0x118d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x118d('0x11'));var as=require(_0x118d('0x12'));var hardwareService=require(_0x118d('0x13'));var logger=require(_0x118d('0x14'))('api');var utils=require(_0x118d('0x15'));var config=require(_0x118d('0x16'));var licenseUtil=require(_0x118d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50f7c6,_0x2396dd){_0x2396dd=_0x2396dd||0xcc;return function(_0x385277){if(_0x385277){return _0x50f7c6[_0x118d('0x18')](_0x2396dd);}return _0x50f7c6[_0x118d('0x19')](_0x2396dd)[_0x118d('0x1a')]();};}function respondWithResult(_0x4a6aaa,_0x1db1a5){_0x1db1a5=_0x1db1a5||0xc8;return function(_0x5edf3c){if(_0x5edf3c){return _0x4a6aaa[_0x118d('0x19')](_0x1db1a5)['json'](_0x5edf3c);}};}function respondWithFilteredResult(_0x3c875e,_0x4bff8c){return function(_0x53b8bd){if(_0x53b8bd){var _0x116416=typeof _0x4bff8c[_0x118d('0x1b')]===_0x118d('0x1c')&&typeof _0x4bff8c['limit']===_0x118d('0x1c');var _0xe7eb2e=_0x53b8bd[_0x118d('0x1d')];var _0x431ac5=_0x116416?0x0:_0x4bff8c['offset'];var _0x2bbc37=_0x116416?_0x53b8bd[_0x118d('0x1d')]:_0x4bff8c[_0x118d('0x1b')]+_0x4bff8c[_0x118d('0x1e')];var _0x14f329;if(_0x2bbc37>=_0xe7eb2e){_0x2bbc37=_0xe7eb2e;_0x14f329=0xc8;}else{_0x14f329=0xce;}_0x3c875e[_0x118d('0x19')](_0x14f329);return _0x3c875e['set'](_0x118d('0x1f'),_0x431ac5+'-'+_0x2bbc37+'/'+_0xe7eb2e)[_0x118d('0x20')](_0x53b8bd);}return null;};}function patchUpdates(_0x450130){return function(_0x4f8b09){try{jsonpatch['apply'](_0x4f8b09,_0x450130,!![]);}catch(_0x4f1ad0){return BPromise['reject'](_0x4f1ad0);}return _0x4f8b09[_0x118d('0x21')]();};}function saveUpdates(_0x186d46,_0x1ad93c){return function(_0x5768bc){if(_0x5768bc){return _0x5768bc[_0x118d('0x22')](_0x186d46)['then'](function(_0x24316d){return _0x24316d;});}return null;};}function removeEntity(_0x1802a7,_0x3658f9){return function(_0xb82a60){if(_0xb82a60){return _0xb82a60['destroy']()['then'](function(){_0x1802a7[_0x118d('0x19')](0xcc)[_0x118d('0x1a')]();});}};}function handleEntityNotFound(_0x1d2ecf,_0x1c35d3){return function(_0x107bb){if(!_0x107bb){_0x1d2ecf[_0x118d('0x18')](0x194);}return _0x107bb;};}function handleError(_0x3d0293,_0x4d5660){_0x4d5660=_0x4d5660||0x1f4;return function(_0x37c5fa){logger[_0x118d('0x23')](_0x37c5fa[_0x118d('0x24')]);if(_0x37c5fa[_0x118d('0x25')]){delete _0x37c5fa['name'];}_0x3d0293['status'](_0x4d5660)[_0x118d('0x26')](_0x37c5fa);};}exports[_0x118d('0x27')]=function(_0x162678,_0x291ef9){var _0x49a1b1={},_0x55f217={},_0x3ade4c={'count':0x0,'rows':[]};var _0x38a6b4=_[_0x118d('0x28')](db[_0x118d('0x29')]['rawAttributes'],function(_0x14d2f0){return{'name':_0x14d2f0['fieldName'],'type':_0x14d2f0['type'][_0x118d('0x2a')]};});_0x55f217['model']=_['map'](_0x38a6b4,_0x118d('0x25'));_0x55f217[_0x118d('0x2b')]=_[_0x118d('0x2c')](_0x162678[_0x118d('0x2b')]);_0x55f217[_0x118d('0x2d')]=_[_0x118d('0x2e')](_0x55f217[_0x118d('0x2f')],_0x55f217[_0x118d('0x2b')]);_0x49a1b1[_0x118d('0x30')]=_['intersection'](_0x55f217[_0x118d('0x2f')],qs['fields'](_0x162678[_0x118d('0x2b')]['fields']));_0x49a1b1[_0x118d('0x30')]=_0x49a1b1['attributes'][_0x118d('0x31')]?_0x49a1b1[_0x118d('0x30')]:_0x55f217[_0x118d('0x2f')];if(!_0x162678[_0x118d('0x2b')]['hasOwnProperty'](_0x118d('0x32'))){_0x49a1b1[_0x118d('0x1e')]=qs[_0x118d('0x1e')](_0x162678[_0x118d('0x2b')][_0x118d('0x1e')]);_0x49a1b1[_0x118d('0x1b')]=qs['offset'](_0x162678[_0x118d('0x2b')][_0x118d('0x1b')]);}_0x49a1b1[_0x118d('0x33')]=qs[_0x118d('0x34')](_0x162678[_0x118d('0x2b')][_0x118d('0x34')]);_0x49a1b1[_0x118d('0x35')]=qs['filters'](_[_0x118d('0x36')](_0x162678[_0x118d('0x2b')],_0x55f217[_0x118d('0x2d')]),_0x38a6b4);if(_0x162678['query'][_0x118d('0x37')]){_0x49a1b1[_0x118d('0x35')]=_['merge'](_0x49a1b1[_0x118d('0x35')],{'$or':_['map'](_0x38a6b4,function(_0x543ce5){if(_0x543ce5[_0x118d('0x38')]!==_0x118d('0x39')){var _0x2725ca={};_0x2725ca[_0x543ce5[_0x118d('0x25')]]={'$like':'%'+_0x162678[_0x118d('0x2b')]['filter']+'%'};return _0x2725ca;}})});}_0x49a1b1=_[_0x118d('0x3a')]({},_0x49a1b1,_0x162678[_0x118d('0x3b')]);var _0x1f1488={'where':_0x49a1b1['where']};return db['CmHopperHistory'][_0x118d('0x1d')](_0x1f1488)[_0x118d('0x3c')](function(_0x609438){_0x3ade4c[_0x118d('0x1d')]=_0x609438;if(_0x162678['query'][_0x118d('0x3d')]){_0x49a1b1[_0x118d('0x3e')]=[{'all':!![]}];}return db[_0x118d('0x29')]['findAll'](_0x49a1b1);})[_0x118d('0x3c')](function(_0x11fba2){_0x3ade4c[_0x118d('0x3f')]=_0x11fba2;return _0x3ade4c;})[_0x118d('0x3c')](respondWithFilteredResult(_0x291ef9,_0x49a1b1))[_0x118d('0x40')](handleError(_0x291ef9,null));};exports['show']=function(_0x48e840,_0x213689){var _0x4a1417={'raw':!![],'where':{'id':_0x48e840[_0x118d('0x41')]['id']}},_0x49dee5={};_0x49dee5[_0x118d('0x2f')]=_[_0x118d('0x2c')](db[_0x118d('0x29')][_0x118d('0x42')]);_0x49dee5['query']=_['keys'](_0x48e840[_0x118d('0x2b')]);_0x49dee5[_0x118d('0x2d')]=_[_0x118d('0x2e')](_0x49dee5[_0x118d('0x2f')],_0x49dee5[_0x118d('0x2b')]);_0x4a1417[_0x118d('0x30')]=_[_0x118d('0x2e')](_0x49dee5[_0x118d('0x2f')],qs['fields'](_0x48e840['query'][_0x118d('0x43')]));_0x4a1417['attributes']=_0x4a1417[_0x118d('0x30')]['length']?_0x4a1417[_0x118d('0x30')]:_0x49dee5[_0x118d('0x2f')];if(_0x48e840[_0x118d('0x2b')]['includeAll']){_0x4a1417[_0x118d('0x3e')]=[{'all':!![]}];}_0x4a1417=_[_0x118d('0x3a')]({},_0x4a1417,_0x48e840[_0x118d('0x3b')]);return db[_0x118d('0x29')][_0x118d('0x44')](_0x4a1417)[_0x118d('0x3c')](handleEntityNotFound(_0x213689,null))[_0x118d('0x3c')](respondWithResult(_0x213689,null))[_0x118d('0x40')](handleError(_0x213689,null));};exports[_0x118d('0x45')]=function(_0x369118,_0x3ff7b7){return db[_0x118d('0x29')][_0x118d('0x45')](_0x369118[_0x118d('0x46')],{})['then'](respondWithResult(_0x3ff7b7,0xc9))[_0x118d('0x40')](handleError(_0x3ff7b7,null));};exports[_0x118d('0x47')]=function(_0x41f10c,_0x5f3c63){return db['CmHopperHistory'][_0x118d('0x47')]()[_0x118d('0x3c')](respondWithResult(_0x5f3c63,null))[_0x118d('0x40')](handleError(_0x5f3c63,null));};exports['update']=function(_0x23c3b0,_0x2060ac){if(_0x23c3b0['body'][_0x118d('0x48')]){delete _0x23c3b0[_0x118d('0x46')][_0x118d('0x48')];}return db[_0x118d('0x29')][_0x118d('0x44')]({'where':{'uniqueid':_0x23c3b0['params']['id']}})['then'](handleEntityNotFound(_0x2060ac,null))[_0x118d('0x3c')](saveUpdates(_0x23c3b0[_0x118d('0x46')],null))['then'](respondWithResult(_0x2060ac,null))[_0x118d('0x40')](handleError(_0x2060ac,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b4c5f4c..b1d8d62 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 _0xaa64=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x22a993,_0x4a48ba){var _0x13c3a7=function(_0x3c7cbe){while(--_0x3c7cbe){_0x22a993['push'](_0x22a993['shift']());}};_0x13c3a7(++_0x4a48ba);}(_0xaa64,0xf7));var _0x4aa6=function(_0x2d7226,_0x35edb1){_0x2d7226=_0x2d7226-0x0;var _0x59b03f=_0xaa64[_0x2d7226];return _0x59b03f;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var logger=require('../../config/logger')(_0x4aa6('0x2'));var moment=require('moment');var BPromise=require(_0x4aa6('0x3'));var rp=require(_0x4aa6('0x4'));var fs=require('fs');var path=require(_0x4aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x4aa6('0x6'));var attributes=require(_0x4aa6('0x7'));module[_0x4aa6('0x8')]=function(_0x37a260,_0x426bd6){return _0x37a260[_0x4aa6('0x9')](_0x4aa6('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x4aa6('0xb')]},{'name':_0x4aa6('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x955f=['util','../../config/logger','api','moment','request-promise','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x5bd1fc,_0x5a5d57){var _0x4f9cfa=function(_0xa5a33b){while(--_0xa5a33b){_0x5bd1fc['push'](_0x5bd1fc['shift']());}};_0x4f9cfa(++_0x5a5d57);}(_0x955f,0x1eb));var _0xf955=function(_0xc0b539,_0x1afd86){_0xc0b539=_0xc0b539-0x0;var _0x49270d=_0x955f[_0xc0b539];return _0x49270d;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xf955('0xa')]},{'name':_0xf955('0xb'),'fields':[_0xf955('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index ed88998..bfa2167 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 _0x7e6b=['stringify','error','code','message','request\x20sent','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','then','findAll','options','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperHistory,\x20%s,\x20%s','debug'];(function(_0x18f420,_0x268f01){var _0x3d1096=function(_0x1a07fe){while(--_0x1a07fe){_0x18f420['push'](_0x18f420['shift']());}};_0x3d1096(++_0x268f01);}(_0x7e6b,0x186));var _0xb7e6=function(_0x4818fb,_0x116adc){_0x4818fb=_0x4818fb-0x0;var _0x4031a4=_0x7e6b[_0x4818fb];return _0x4031a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb7e6('0x0'));var BPromise=require(_0xb7e6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7e6('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb7e6('0x3'))(_0xb7e6('0x4'));var config=require(_0xb7e6('0x5'));var jayson=require(_0xb7e6('0x6'));var client=jayson[_0xb7e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5142ac,_0x42378f,_0x170430){return new BPromise(function(_0x1347e1,_0x2ace08){return client[_0xb7e6('0x8')](_0x5142ac,_0x170430)['then'](function(_0x3ae017){logger[_0xb7e6('0x9')](_0xb7e6('0xa'),_0x42378f,'request\x20sent');logger[_0xb7e6('0xb')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x42378f,'request\x20sent',JSON[_0xb7e6('0xc')](_0x3ae017));if(_0x3ae017[_0xb7e6('0xd')]){if(_0x3ae017[_0xb7e6('0xd')][_0xb7e6('0xe')]===0x1f4){logger[_0xb7e6('0xd')](_0xb7e6('0xa'),_0x42378f,_0x3ae017['error']['message']);return _0x2ace08(_0x3ae017['error'][_0xb7e6('0xf')]);}logger[_0xb7e6('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x42378f,_0x3ae017['error'][_0xb7e6('0xf')]);return _0x1347e1(_0x3ae017[_0xb7e6('0xd')][_0xb7e6('0xf')]);}else{logger['info'](_0xb7e6('0xa'),_0x42378f,_0xb7e6('0x10'));_0x1347e1(_0x3ae017[_0xb7e6('0x11')]['message']);}})[_0xb7e6('0x12')](function(_0x500936){logger[_0xb7e6('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x42378f,_0x500936);_0x2ace08(_0x500936);});});}exports[_0xb7e6('0x13')]=function(_0x5a5e0f){var _0x522143=this;return new Promise(function(_0x3b9ade,_0x297d63){return db[_0xb7e6('0x14')][_0xb7e6('0x15')](_0x5a5e0f[_0xb7e6('0x16')],{'raw':_0x5a5e0f['options']?_0x5a5e0f['options']['raw']===undefined?!![]:![]:!![]})[_0xb7e6('0x17')](function(_0x544aa1){logger[_0xb7e6('0x9')]('CreateCmHopperHistory',_0x5a5e0f);logger[_0xb7e6('0xb')](_0xb7e6('0x13'),_0x5a5e0f,JSON[_0xb7e6('0xc')](_0x544aa1));_0x3b9ade(_0x544aa1);})[_0xb7e6('0x12')](function(_0x55fb83){logger['error'](_0xb7e6('0x13'),_0x55fb83[_0xb7e6('0xf')],_0x5a5e0f);_0x297d63(_0x522143[_0xb7e6('0xd')](0x1f4,_0x55fb83[_0xb7e6('0xf')]));});});};exports['AvgHandleTime']=function(_0x14b21a){var _0x3c7c1a=this;return new Promise(function(_0x4d683e,_0x238fd4){return db[_0xb7e6('0x14')][_0xb7e6('0x18')]({'raw':_0x14b21a[_0xb7e6('0x19')]?_0x14b21a['options'][_0xb7e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x14b21a['options']?_0x14b21a[_0xb7e6('0x19')][_0xb7e6('0x1b')]||null:null,'attributes':[[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')][_0xb7e6('0x1e')]('id')),_0xb7e6('0x1f')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xb7e6('0x1c')]['fn']('COUNT',db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')]['literal'](_0xb7e6('0x21')))),_0xb7e6('0x22')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xb7e6('0x23')],[db['sequelize']['fn'](_0xb7e6('0x24'),db['sequelize']['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')](_0xb7e6('0x25')))),_0xb7e6('0x26')],[db[_0xb7e6('0x1c')]['fn']('AVG',db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')](_0xb7e6('0x27')))),_0xb7e6('0x28')]]})[_0xb7e6('0x17')](function(_0x10a89e){logger[_0xb7e6('0x9')](_0xb7e6('0x29'),_0x14b21a);logger[_0xb7e6('0xb')]('AvgHandleTime',_0x14b21a,JSON[_0xb7e6('0xc')](_0x10a89e));_0x4d683e(_0x10a89e);})['catch'](function(_0x1ea65e){logger[_0xb7e6('0xd')](_0xb7e6('0x29'),_0x1ea65e[_0xb7e6('0xf')],_0x14b21a);_0x238fd4(_0x3c7c1a[_0xb7e6('0xd')](0x1f4,_0x1ea65e[_0xb7e6('0xf')]));});});};exports[_0xb7e6('0x2a')]=function(_0x4e842d){var _0xd2ccb7=this;return new Promise(function(_0x2cde99,_0x5ea893){return db['CmHopperHistory']['findAll']({'raw':_0x4e842d[_0xb7e6('0x19')]?_0x4e842d[_0xb7e6('0x19')][_0xb7e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e842d[_0xb7e6('0x19')]?_0x4e842d[_0xb7e6('0x19')][_0xb7e6('0x1b')]||null:null,'attributes':[[_0xb7e6('0x2b'),'name'],[db['sequelize']['fn']('COUNT',db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')]['literal'](_0xb7e6('0x2c')))),_0xb7e6('0x2d')],[db[_0xb7e6('0x1c')]['fn']('COUNT',db[_0xb7e6('0x1c')]['fn']('IF',db['sequelize'][_0xb7e6('0x20')](_0xb7e6('0x2e')))),_0xb7e6('0x2f')],[db['sequelize']['fn'](_0xb7e6('0x1d'),db['sequelize']['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xb7e6('0x30')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0xb7e6('0x31')],[db['sequelize']['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xb7e6('0x32')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db['sequelize']['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')](_0xb7e6('0x33')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb7e6('0x34')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0xb7e6('0x35')],[db[_0xb7e6('0x1c')]['fn']('COUNT',db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')](_0xb7e6('0x36')))),_0xb7e6('0x37')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db['sequelize'][_0xb7e6('0x20')](_0xb7e6('0x38')))),_0xb7e6('0x39')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')]['literal'](_0xb7e6('0x3a')))),_0xb7e6('0x3b')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')]['literal'](_0xb7e6('0x3c')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')](_0xb7e6('0x3d')))),'outboundRejectCallsDay'],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db['sequelize'][_0xb7e6('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xb7e6('0x3e')]],'group':[_0xb7e6('0x2b')]})[_0xb7e6('0x17')](function(_0x22964b){logger[_0xb7e6('0x9')](_0xb7e6('0x2a'),_0x4e842d);logger[_0xb7e6('0xb')](_0xb7e6('0x2a'),_0x4e842d,JSON[_0xb7e6('0xc')](_0x22964b));_0x2cde99(_0x22964b);})[_0xb7e6('0x12')](function(_0x281aed){logger['error']('GetVoiceQueueHopperHistory',_0x281aed['message'],_0x4e842d);_0x5ea893(_0xd2ccb7[_0xb7e6('0xd')](0x1f4,_0x281aed[_0xb7e6('0xf')]));});});};exports['GetCampaignHopperHistory']=function(_0x2aca1b){var _0x3b8a4c=this;return new Promise(function(_0x40788c,_0x213dc3){return db[_0xb7e6('0x14')][_0xb7e6('0x18')]({'raw':_0x2aca1b[_0xb7e6('0x19')]?_0x2aca1b[_0xb7e6('0x19')][_0xb7e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x2aca1b['options']?_0x2aca1b[_0xb7e6('0x19')][_0xb7e6('0x1b')]||null:null,'attributes':[[_0xb7e6('0x2b'),_0xb7e6('0x3f')],[db['sequelize']['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')][_0xb7e6('0x1e')]('id')),_0xb7e6('0x40')],[db[_0xb7e6('0x1c')]['fn'](_0xb7e6('0x1d'),db[_0xb7e6('0x1c')]['fn']('IF',db[_0xb7e6('0x1c')][_0xb7e6('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xb7e6('0x41')]],'group':['campaign']})[_0xb7e6('0x17')](function(_0x5bdd35){logger[_0xb7e6('0x9')]('GetCampaignHopperHistory',_0x2aca1b);logger[_0xb7e6('0xb')](_0xb7e6('0x42'),_0x2aca1b,JSON[_0xb7e6('0xc')](_0x5bdd35));_0x40788c(_0x5bdd35);})['catch'](function(_0x5680bc){logger['error'](_0xb7e6('0x42'),_0x5680bc[_0xb7e6('0xf')],_0x2aca1b);_0x213dc3(_0x3b8a4c[_0xb7e6('0xd')](0x1f4,_0x5680bc[_0xb7e6('0xf')]));});});}; \ No newline at end of file +var _0xbe0f=['`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','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','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','then','CreateCmHopperHistory','debug','AvgHandleTime','CmHopperHistory','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay'];(function(_0x95a30c,_0x2988be){var _0x3eb15c=function(_0xd7ceb8){while(--_0xd7ceb8){_0x95a30c['push'](_0x95a30c['shift']());}};_0x3eb15c(++_0x2988be);}(_0xbe0f,0x1d3));var _0xfbe0=function(_0x2e1982,_0x57c29f){_0x2e1982=_0x2e1982-0x0;var _0x2187d6=_0xbe0f[_0x2e1982];return _0x2187d6;};'use strict';var _=require(_0xfbe0('0x0'));var util=require(_0xfbe0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfbe0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbe0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbe0('0x4'))(_0xfbe0('0x5'));var config=require(_0xfbe0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfbe0('0x7')][_0xfbe0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57e832,_0x2f0146,_0x1b8e67){return new BPromise(function(_0x1ce1c3,_0x1be56a){return client[_0xfbe0('0x9')](_0x57e832,_0x1b8e67)['then'](function(_0x2a572c){logger[_0xfbe0('0xa')](_0xfbe0('0xb'),_0x2f0146,_0xfbe0('0xc'));logger['debug'](_0xfbe0('0xd'),_0x2f0146,_0xfbe0('0xc'),JSON[_0xfbe0('0xe')](_0x2a572c));if(_0x2a572c[_0xfbe0('0xf')]){if(_0x2a572c[_0xfbe0('0xf')]['code']===0x1f4){logger[_0xfbe0('0xf')](_0xfbe0('0xb'),_0x2f0146,_0x2a572c['error'][_0xfbe0('0x10')]);return _0x1be56a(_0x2a572c[_0xfbe0('0xf')][_0xfbe0('0x10')]);}logger[_0xfbe0('0xf')](_0xfbe0('0xb'),_0x2f0146,_0x2a572c[_0xfbe0('0xf')][_0xfbe0('0x10')]);return _0x1ce1c3(_0x2a572c[_0xfbe0('0xf')][_0xfbe0('0x10')]);}else{logger[_0xfbe0('0xa')](_0xfbe0('0xb'),_0x2f0146,_0xfbe0('0xc'));_0x1ce1c3(_0x2a572c[_0xfbe0('0x11')][_0xfbe0('0x10')]);}})[_0xfbe0('0x12')](function(_0x325b8d){logger[_0xfbe0('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x2f0146,_0x325b8d);_0x1be56a(_0x325b8d);});});}exports['CreateCmHopperHistory']=function(_0x5db910){var _0x250631=this;return new Promise(function(_0x3bb90d,_0x4992d4){return db['CmHopperHistory'][_0xfbe0('0x13')](_0x5db910[_0xfbe0('0x14')],{'raw':_0x5db910['options']?_0x5db910[_0xfbe0('0x15')][_0xfbe0('0x16')]===undefined?!![]:![]:!![]})[_0xfbe0('0x17')](function(_0x3bdb0b){logger[_0xfbe0('0xa')](_0xfbe0('0x18'),_0x5db910);logger[_0xfbe0('0x19')](_0xfbe0('0x18'),_0x5db910,JSON[_0xfbe0('0xe')](_0x3bdb0b));_0x3bb90d(_0x3bdb0b);})[_0xfbe0('0x12')](function(_0x1821bb){logger['error'](_0xfbe0('0x18'),_0x1821bb['message'],_0x5db910);_0x4992d4(_0x250631[_0xfbe0('0xf')](0x1f4,_0x1821bb[_0xfbe0('0x10')]));});});};exports[_0xfbe0('0x1a')]=function(_0x4ca905){var _0xa4ddf7=this;return new Promise(function(_0x5d5e6c,_0x189188){return db[_0xfbe0('0x1b')]['findAll']({'raw':_0x4ca905['options']?_0x4ca905['options'][_0xfbe0('0x16')]===undefined?!![]:![]:!![],'where':_0x4ca905[_0xfbe0('0x15')]?_0x4ca905[_0xfbe0('0x15')][_0xfbe0('0x1c')]||null:null,'attributes':[[db[_0xfbe0('0x1d')]['fn']('COUNT',db[_0xfbe0('0x1d')][_0xfbe0('0x1e')]('id')),_0xfbe0('0x1f')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x22')))),_0xfbe0('0x23')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x24')))),_0xfbe0('0x25')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0xfbe0('0x26')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x27'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')]['literal'](_0xfbe0('0x28')))),_0xfbe0('0x29')],[db['sequelize']['fn']('AVG',db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0xfbe0('0x17')](function(_0x2fcc2d){logger[_0xfbe0('0xa')](_0xfbe0('0x1a'),_0x4ca905);logger[_0xfbe0('0x19')](_0xfbe0('0x1a'),_0x4ca905,JSON[_0xfbe0('0xe')](_0x2fcc2d));_0x5d5e6c(_0x2fcc2d);})[_0xfbe0('0x12')](function(_0x46b8c2){logger[_0xfbe0('0xf')](_0xfbe0('0x1a'),_0x46b8c2[_0xfbe0('0x10')],_0x4ca905);_0x189188(_0xa4ddf7[_0xfbe0('0xf')](0x1f4,_0x46b8c2[_0xfbe0('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0xdc1469){var _0x418143=this;return new Promise(function(_0x818acb,_0x215ff8){return db[_0xfbe0('0x1b')][_0xfbe0('0x2b')]({'raw':_0xdc1469['options']?_0xdc1469['options'][_0xfbe0('0x16')]===undefined?!![]:![]:!![],'where':_0xdc1469[_0xfbe0('0x15')]?_0xdc1469[_0xfbe0('0x15')][_0xfbe0('0x1c')]||null:null,'attributes':[[_0xfbe0('0x2c'),_0xfbe0('0x2d')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')]['literal'](_0xfbe0('0x2e')))),_0xfbe0('0x2f')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db['sequelize'][_0xfbe0('0x21')](_0xfbe0('0x30')))),_0xfbe0('0x31')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xfbe0('0x32')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db['sequelize']['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x33')))),_0xfbe0('0x34')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db['sequelize'][_0xfbe0('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0xfbe0('0x35')],[db['sequelize']['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db['sequelize'][_0xfbe0('0x21')](_0xfbe0('0x36')))),_0xfbe0('0x37')],[db[_0xfbe0('0x1d')]['fn']('COUNT',db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x38')))),_0xfbe0('0x39')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0xfbe0('0x3a')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db['sequelize'][_0xfbe0('0x21')](_0xfbe0('0x3b')))),_0xfbe0('0x3c')],[db['sequelize']['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')]['literal'](_0xfbe0('0x3d')))),_0xfbe0('0x3e')],[db['sequelize']['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x3f')))),_0xfbe0('0x40')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db['sequelize'][_0xfbe0('0x21')](_0xfbe0('0x41')))),_0xfbe0('0x42')],[db[_0xfbe0('0x1d')]['fn']('COUNT',db[_0xfbe0('0x1d')]['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x43')))),'outboundRejectCallsDay'],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db['sequelize']['fn']('IF',db[_0xfbe0('0x1d')][_0xfbe0('0x21')](_0xfbe0('0x44')))),_0xfbe0('0x45')]],'group':[_0xfbe0('0x2c')]})[_0xfbe0('0x17')](function(_0x47aa23){logger[_0xfbe0('0xa')]('GetVoiceQueueHopperHistory',_0xdc1469);logger[_0xfbe0('0x19')](_0xfbe0('0x46'),_0xdc1469,JSON[_0xfbe0('0xe')](_0x47aa23));_0x818acb(_0x47aa23);})[_0xfbe0('0x12')](function(_0x5586c6){logger[_0xfbe0('0xf')]('GetVoiceQueueHopperHistory',_0x5586c6[_0xfbe0('0x10')],_0xdc1469);_0x215ff8(_0x418143[_0xfbe0('0xf')](0x1f4,_0x5586c6[_0xfbe0('0x10')]));});});};exports['GetCampaignHopperHistory']=function(_0x43459c){var _0x382881=this;return new Promise(function(_0x2e27a4,_0x85c268){return db[_0xfbe0('0x1b')][_0xfbe0('0x2b')]({'raw':_0x43459c[_0xfbe0('0x15')]?_0x43459c[_0xfbe0('0x15')][_0xfbe0('0x16')]===undefined?!![]:![]:!![],'where':_0x43459c['options']?_0x43459c[_0xfbe0('0x15')][_0xfbe0('0x1c')]||null:null,'attributes':[['campaign','name'],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')][_0xfbe0('0x1e')]('id')),_0xfbe0('0x47')],[db[_0xfbe0('0x1d')]['fn'](_0xfbe0('0x20'),db[_0xfbe0('0x1d')]['fn']('IF',db['sequelize'][_0xfbe0('0x21')](_0xfbe0('0x22')))),_0xfbe0('0x48')]],'group':['campaign']})[_0xfbe0('0x17')](function(_0xb7e718){logger[_0xfbe0('0xa')](_0xfbe0('0x49'),_0x43459c);logger[_0xfbe0('0x19')](_0xfbe0('0x49'),_0x43459c,JSON[_0xfbe0('0xe')](_0xb7e718));_0x2e27a4(_0xb7e718);})[_0xfbe0('0x12')](function(_0xdf5e3d){logger[_0xfbe0('0xf')]('GetCampaignHopperHistory',_0xdf5e3d[_0xfbe0('0x10')],_0x43459c);_0x85c268(_0x382881[_0xfbe0('0xf')](0x1f4,_0xdf5e3d[_0xfbe0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6c2e81f..38eab46 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 _0x3afe=['isAuthenticated','index','describe','/:id','show','post','create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3afe,0x122));var _0xe3af=function(_0x1fe809,_0x433222){_0x1fe809=_0x1fe809-0x0;var _0x59c58c=_0x3afe[_0x1fe809];return _0x59c58c;};'use strict';var multer=require(_0xe3af('0x0'));var util=require(_0xe3af('0x1'));var path=require(_0xe3af('0x2'));var timeout=require('connect-timeout');var express=require(_0xe3af('0x3'));var router=express[_0xe3af('0x4')]();var fs_extra=require(_0xe3af('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe3af('0x6'));var config=require(_0xe3af('0x7'));var controller=require(_0xe3af('0x8'));router[_0xe3af('0x9')]('/',auth[_0xe3af('0xa')](),controller[_0xe3af('0xb')]);router['get']('/describe',auth[_0xe3af('0xa')](),controller[_0xe3af('0xc')]);router['get'](_0xe3af('0xd'),auth['isAuthenticated'](),controller[_0xe3af('0xe')]);router[_0xe3af('0xf')]('/',auth[_0xe3af('0xa')](),controller[_0xe3af('0x10')]);router[_0xe3af('0x11')](_0xe3af('0xd'),auth[_0xe3af('0xa')](),controller[_0xe3af('0x12')]);module[_0xe3af('0x13')]=router; \ No newline at end of file +var _0x76d2=['exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update'];(function(_0x5ad794,_0x330eb1){var _0x58d45e=function(_0x28c899){while(--_0x28c899){_0x5ad794['push'](_0x5ad794['shift']());}};_0x58d45e(++_0x330eb1);}(_0x76d2,0xef));var _0x276d=function(_0x52a887,_0x4dbc2c){_0x52a887=_0x52a887-0x0;var _0x267daa=_0x76d2[_0x52a887];return _0x267daa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x276d('0x0'));var timeout=require('connect-timeout');var express=require(_0x276d('0x1'));var router=express['Router']();var fs_extra=require(_0x276d('0x2'));var auth=require(_0x276d('0x3'));var interaction=require(_0x276d('0x4'));var config=require(_0x276d('0x5'));var controller=require(_0x276d('0x6'));router[_0x276d('0x7')]('/',auth[_0x276d('0x8')](),controller[_0x276d('0x9')]);router[_0x276d('0x7')](_0x276d('0xa'),auth[_0x276d('0x8')](),controller[_0x276d('0xb')]);router[_0x276d('0x7')]('/:id',auth[_0x276d('0x8')](),controller[_0x276d('0xc')]);router['post']('/',auth[_0x276d('0x8')](),controller[_0x276d('0xd')]);router[_0x276d('0xe')]('/:id',auth[_0x276d('0x8')](),controller[_0x276d('0xf')]);module[_0x276d('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 30c5f7d..3cb57ce 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 _0x25fa=['name','sequelize','STRING'];(function(_0x10db17,_0x57f51b){var _0x34c3e5=function(_0x326cb4){while(--_0x326cb4){_0x10db17['push'](_0x10db17['shift']());}};_0x34c3e5(++_0x57f51b);}(_0x25fa,0x109));var _0xa25f=function(_0x5307ca,_0x5d5dc1){_0x5307ca=_0x5307ca-0x0;var _0x5348b3=_0x25fa[_0x5307ca];return _0x5348b3;};'use strict';var Sequelize=require(_0xa25f('0x0'));module['exports']={'name':{'type':Sequelize[_0xa25f('0x1')],'unique':_0xa25f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xa25f('0x1')]}}; \ No newline at end of file +var _0x9658=['sequelize','STRING','name'];(function(_0x566f15,_0x52fea1){var _0x2dabf8=function(_0x1bbe49){while(--_0x1bbe49){_0x566f15['push'](_0x566f15['shift']());}};_0x2dabf8(++_0x52fea1);}(_0x9658,0x6f));var _0x8965=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x9658[_0x29ae80];return _0x5d6d71;};'use strict';var Sequelize=require(_0x8965('0x0'));module['exports']={'name':{'type':Sequelize[_0x8965('0x1')],'unique':_0x8965('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x8965('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 009946d..127b7ab 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 _0xf0c6=['addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','message','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rawAttributes','nolimit','pick','options','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','success','dataValues','errors','CmCustomField','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction'];(function(_0x6e1b81,_0x548e36){var _0x294220=function(_0x4f3f5a){while(--_0x4f3f5a){_0x6e1b81['push'](_0x6e1b81['shift']());}};_0x294220(++_0x548e36);}(_0xf0c6,0x1ee));var _0x6f0c=function(_0x3e70dc,_0x5f1075){_0x3e70dc=_0x3e70dc-0x0;var _0x589049=_0xf0c6[_0x3e70dc];return _0x589049;};'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(_0x6f0c('0x0'));var moment=require(_0x6f0c('0x1'));var BPromise=require(_0x6f0c('0x2'));var Mustache=require(_0x6f0c('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6f0c('0x4'));var csv=require(_0x6f0c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f0c('0x6'));var _=require(_0x6f0c('0x7'));var squel=require(_0x6f0c('0x8'));var crypto=require(_0x6f0c('0x9'));var jsforce=require(_0x6f0c('0xa'));var deskjs=require(_0x6f0c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6f0c('0xc'));var Papa=require(_0x6f0c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f0c('0xe'));var logger=require('../../config/logger')(_0x6f0c('0xf'));var utils=require('../../config/utils');var config=require(_0x6f0c('0x10'));var licenseUtil=require(_0x6f0c('0x11'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x6f0c('0x12')]=_[_0x6f0c('0x13')](config[_0x6f0c('0x12')],{'host':_0x6f0c('0x14'),'port':0x18eb});var socket=require(_0x6f0c('0x15'))(new Redis(config[_0x6f0c('0x12')]));require(_0x6f0c('0x16'))[_0x6f0c('0x17')](socket);function respondWithStatusCode(_0x3ba44c,_0x59406e){_0x59406e=_0x59406e||0xcc;return function(_0x1d0498){if(_0x1d0498){return _0x3ba44c['sendStatus'](_0x59406e);}return _0x3ba44c['status'](_0x59406e)[_0x6f0c('0x18')]();};}function respondWithResult(_0x2b3bb5,_0x54878f){_0x54878f=_0x54878f||0xc8;return function(_0x189a7a){if(_0x189a7a){return _0x2b3bb5[_0x6f0c('0x19')](_0x54878f)[_0x6f0c('0x1a')](_0x189a7a);}};}function respondWithFilteredResult(_0x43bfd3,_0x319eea){return function(_0x4b58ed){if(_0x4b58ed){var _0x4adf50=typeof _0x319eea[_0x6f0c('0x1b')]===_0x6f0c('0x1c')&&typeof _0x319eea[_0x6f0c('0x1d')]===_0x6f0c('0x1c');var _0x5516a1=_0x4b58ed[_0x6f0c('0x1e')];var _0x1e57a6=_0x4adf50?0x0:_0x319eea[_0x6f0c('0x1b')];var _0x51dfe9=_0x4adf50?_0x4b58ed[_0x6f0c('0x1e')]:_0x319eea[_0x6f0c('0x1b')]+_0x319eea[_0x6f0c('0x1d')];var _0x17b39f;if(_0x51dfe9>=_0x5516a1){_0x51dfe9=_0x5516a1;_0x17b39f=0xc8;}else{_0x17b39f=0xce;}_0x43bfd3[_0x6f0c('0x19')](_0x17b39f);return _0x43bfd3[_0x6f0c('0x1f')]('Content-Range',_0x1e57a6+'-'+_0x51dfe9+'/'+_0x5516a1)[_0x6f0c('0x1a')](_0x4b58ed);}return null;};}function patchUpdates(_0x1fa2e6){return function(_0x117fdf){try{jsonpatch[_0x6f0c('0x20')](_0x117fdf,_0x1fa2e6,!![]);}catch(_0x58e407){return BPromise[_0x6f0c('0x21')](_0x58e407);}return _0x117fdf['save']();};}function saveUpdates(_0x21798a,_0xa58f01){return function(_0x1c405b){if(_0x1c405b){return _0x1c405b[_0x6f0c('0x22')](_0x21798a)['then'](function(_0x262aaf){return _0x262aaf;});}return null;};}function removeEntity(_0x2087a6,_0x35e240){return function(_0x5742ba){if(_0x5742ba){return _0x5742ba[_0x6f0c('0x23')]()[_0x6f0c('0x24')](function(){var _0x16b869=_0x5742ba[_0x6f0c('0x25')]({'plain':!![]});var _0x3ebb6e=_0x6f0c('0x26');return db[_0x6f0c('0x27')]['destroy']({'where':{'type':_0x3ebb6e,'resourceId':_0x16b869['id']}})[_0x6f0c('0x24')](function(){return _0x5742ba;});})['then'](function(){_0x2087a6[_0x6f0c('0x19')](0xcc)[_0x6f0c('0x18')]();});}};}function handleEntityNotFound(_0x53cbe8,_0x53d95f){return function(_0x392031){if(!_0x392031){_0x53cbe8[_0x6f0c('0x28')](0x194);}return _0x392031;};}function handleError(_0x18d9d1,_0x41780b){_0x41780b=_0x41780b||0x1f4;return function(_0x1f84bd){logger[_0x6f0c('0x29')](_0x1f84bd[_0x6f0c('0x2a')]);if(_0x1f84bd[_0x6f0c('0x2b')]){delete _0x1f84bd[_0x6f0c('0x2b')];}_0x18d9d1['status'](_0x41780b)[_0x6f0c('0x2c')](_0x1f84bd);};}exports[_0x6f0c('0x2d')]=function(_0x4e461d,_0x3fd332){var _0x1b6c51={},_0x3456bb={},_0x24f02c={'count':0x0,'rows':[]};var _0x2b171c=_[_0x6f0c('0x2e')](db[_0x6f0c('0x2f')]['rawAttributes'],function(_0x44208f){return{'name':_0x44208f[_0x6f0c('0x30')],'type':_0x44208f[_0x6f0c('0x31')][_0x6f0c('0x32')]};});_0x3456bb['model']=_[_0x6f0c('0x2e')](_0x2b171c,_0x6f0c('0x2b'));_0x3456bb['query']=_[_0x6f0c('0x33')](_0x4e461d[_0x6f0c('0x34')]);_0x3456bb[_0x6f0c('0x35')]=_[_0x6f0c('0x36')](_0x3456bb[_0x6f0c('0x37')],_0x3456bb['query']);_0x1b6c51[_0x6f0c('0x38')]=_['intersection'](_0x3456bb[_0x6f0c('0x37')],qs['fields'](_0x4e461d[_0x6f0c('0x34')][_0x6f0c('0x39')]));_0x1b6c51[_0x6f0c('0x38')]=_0x1b6c51[_0x6f0c('0x38')][_0x6f0c('0x3a')]?_0x1b6c51[_0x6f0c('0x38')]:_0x3456bb['model'];if(!_0x4e461d[_0x6f0c('0x34')][_0x6f0c('0x3b')]('nolimit')){_0x1b6c51[_0x6f0c('0x1d')]=qs['limit'](_0x4e461d[_0x6f0c('0x34')]['limit']);_0x1b6c51['offset']=qs[_0x6f0c('0x1b')](_0x4e461d['query'][_0x6f0c('0x1b')]);}_0x1b6c51[_0x6f0c('0x3c')]=qs[_0x6f0c('0x3d')](_0x4e461d['query'][_0x6f0c('0x3d')]);_0x1b6c51[_0x6f0c('0x3e')]=qs[_0x6f0c('0x35')](_['pick'](_0x4e461d[_0x6f0c('0x34')],_0x3456bb[_0x6f0c('0x35')]),_0x2b171c);if(_0x4e461d[_0x6f0c('0x34')]['filter']){_0x1b6c51[_0x6f0c('0x3e')]=_['merge'](_0x1b6c51[_0x6f0c('0x3e')],{'$or':_[_0x6f0c('0x2e')](_0x2b171c,function(_0x598c95){if(_0x598c95['type']!==_0x6f0c('0x3f')){var _0x1f2f38={};_0x1f2f38[_0x598c95['name']]={'$like':'%'+_0x4e461d['query'][_0x6f0c('0x40')]+'%'};return _0x1f2f38;}})});}_0x1b6c51=_[_0x6f0c('0x41')]({},_0x1b6c51,_0x4e461d['options']);var _0x11adbd={'where':_0x1b6c51['where']};return db[_0x6f0c('0x2f')][_0x6f0c('0x1e')](_0x11adbd)['then'](function(_0x5587bf){_0x24f02c[_0x6f0c('0x1e')]=_0x5587bf;if(_0x4e461d[_0x6f0c('0x34')][_0x6f0c('0x42')]){_0x1b6c51[_0x6f0c('0x43')]=[{'all':!![]}];}return db[_0x6f0c('0x2f')][_0x6f0c('0x44')](_0x1b6c51);})[_0x6f0c('0x24')](function(_0x1a21fd){_0x24f02c[_0x6f0c('0x45')]=_0x1a21fd;return _0x24f02c;})[_0x6f0c('0x24')](respondWithFilteredResult(_0x3fd332,_0x1b6c51))[_0x6f0c('0x46')](handleError(_0x3fd332,null));};exports[_0x6f0c('0x47')]=function(_0x5dbe3,_0x2325eb){var _0x4fd817={'raw':![],'where':{'id':_0x5dbe3['params']['id']}},_0x111692={};_0x111692['model']=_['keys'](db[_0x6f0c('0x2f')]['rawAttributes']);_0x111692[_0x6f0c('0x34')]=_[_0x6f0c('0x33')](_0x5dbe3[_0x6f0c('0x34')]);_0x111692['filters']=_[_0x6f0c('0x36')](_0x111692[_0x6f0c('0x37')],_0x111692['query']);_0x4fd817[_0x6f0c('0x38')]=_[_0x6f0c('0x36')](_0x111692[_0x6f0c('0x37')],qs[_0x6f0c('0x39')](_0x5dbe3[_0x6f0c('0x34')][_0x6f0c('0x39')]));_0x4fd817['attributes']=_0x4fd817[_0x6f0c('0x38')][_0x6f0c('0x3a')]?_0x4fd817[_0x6f0c('0x38')]:_0x111692[_0x6f0c('0x37')];if(_0x5dbe3[_0x6f0c('0x34')]['includeAll']){_0x4fd817['include']=[{'all':!![]}];}_0x4fd817=_[_0x6f0c('0x41')]({},_0x4fd817,_0x5dbe3['options']);return db[_0x6f0c('0x2f')]['find'](_0x4fd817)[_0x6f0c('0x24')](handleEntityNotFound(_0x2325eb,null))[_0x6f0c('0x24')](respondWithResult(_0x2325eb,null))[_0x6f0c('0x46')](handleError(_0x2325eb,null));};exports[_0x6f0c('0x48')]=function(_0x1c2998,_0x3cec0d){return db[_0x6f0c('0x2f')][_0x6f0c('0x48')](_0x1c2998[_0x6f0c('0x49')],{})[_0x6f0c('0x24')](function(_0x302fd5){var _0x16abbd=_0x1c2998['user'][_0x6f0c('0x25')]({'plain':!![]});if(!_0x16abbd)throw new Error(_0x6f0c('0x4a'));if(_0x16abbd['role']==='user'){var _0x52d70a=_0x302fd5[_0x6f0c('0x25')]({'plain':!![]});var _0x431861=_0x6f0c('0x26');return db[_0x6f0c('0x4b')][_0x6f0c('0x4c')]({'where':{'name':_0x431861,'userProfileId':_0x16abbd['userProfileId']},'raw':!![]})[_0x6f0c('0x24')](function(_0x1d3b63){if(_0x1d3b63&&_0x1d3b63[_0x6f0c('0x4d')]===0x0){return db['UserProfileResource'][_0x6f0c('0x48')]({'name':_0x52d70a[_0x6f0c('0x2b')],'resourceId':_0x52d70a['id'],'type':_0x1d3b63[_0x6f0c('0x2b')],'sectionId':_0x1d3b63['id']},{})[_0x6f0c('0x24')](function(){return _0x302fd5;});}else{return _0x302fd5;}})[_0x6f0c('0x46')](function(_0x4ff6b2){logger[_0x6f0c('0x29')](_0x6f0c('0x4e'),_0x4ff6b2);throw _0x4ff6b2;});}return _0x302fd5;})[_0x6f0c('0x24')](respondWithResult(_0x3cec0d,0xc9))[_0x6f0c('0x46')](handleError(_0x3cec0d,null));};exports['update']=function(_0xd52bd4,_0x272752){if(_0xd52bd4[_0x6f0c('0x49')]['id']){delete _0xd52bd4[_0x6f0c('0x49')]['id'];}return db[_0x6f0c('0x2f')]['find']({'where':{'id':_0xd52bd4['params']['id']}})[_0x6f0c('0x24')](handleEntityNotFound(_0x272752,null))['then'](saveUpdates(_0xd52bd4[_0x6f0c('0x49')],null))[_0x6f0c('0x24')](respondWithResult(_0x272752,null))[_0x6f0c('0x46')](handleError(_0x272752,null));};exports[_0x6f0c('0x23')]=function(_0x2ce912,_0x165f58){return db[_0x6f0c('0x2f')][_0x6f0c('0x4c')]({'where':{'id':_0x2ce912[_0x6f0c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x165f58,null))[_0x6f0c('0x24')](removeEntity(_0x165f58,null))[_0x6f0c('0x46')](handleError(_0x165f58,null));};exports[_0x6f0c('0x50')]=function(_0x4d28f7,_0x2e630b){return db[_0x6f0c('0x2f')]['describe']()[_0x6f0c('0x24')](respondWithResult(_0x2e630b,null))[_0x6f0c('0x46')](handleError(_0x2e630b,null));};exports[_0x6f0c('0x51')]=function(_0x2ec64f,_0x1fd320,_0x14bbf4){if(_0x2ec64f[_0x6f0c('0x49')]['id']){delete _0x2ec64f[_0x6f0c('0x49')]['id'];}return db[_0x6f0c('0x2f')][_0x6f0c('0x4c')]({'where':{'id':_0x2ec64f[_0x6f0c('0x4f')]['id']}})[_0x6f0c('0x24')](handleEntityNotFound(_0x1fd320,null))[_0x6f0c('0x24')](function(_0x1f93e7){if(_0x1f93e7){_0x2ec64f['body'][_0x6f0c('0x52')]=_0x1f93e7['id'];return db[_0x6f0c('0x53')]['create'](_0x2ec64f[_0x6f0c('0x49')]);}})[_0x6f0c('0x24')](respondWithResult(_0x1fd320,null))[_0x6f0c('0x46')](handleError(_0x1fd320,null));};exports[_0x6f0c('0x54')]=function(_0xdde2fd,_0x20d375,_0x1d0b1a){var _0x4032f4={'raw':![],'where':{}};var _0x112ae3={};var _0x425d45={'count':0x0,'rows':[]};return db[_0x6f0c('0x2f')][_0x6f0c('0x55')]({'where':{'id':_0xdde2fd[_0x6f0c('0x4f')]['id']}})[_0x6f0c('0x24')](handleEntityNotFound(_0x20d375,null))[_0x6f0c('0x24')](function(_0x53304d){if(_0x53304d){_0x112ae3[_0x6f0c('0x37')]=_[_0x6f0c('0x33')](db['Disposition'][_0x6f0c('0x56')]);_0x112ae3['query']=_[_0x6f0c('0x33')](_0xdde2fd[_0x6f0c('0x34')]);_0x112ae3[_0x6f0c('0x35')]=_[_0x6f0c('0x36')](_0x112ae3['model'],_0x112ae3[_0x6f0c('0x34')]);_0x4032f4[_0x6f0c('0x38')]=_[_0x6f0c('0x36')](_0x112ae3[_0x6f0c('0x37')],qs[_0x6f0c('0x39')](_0xdde2fd[_0x6f0c('0x34')][_0x6f0c('0x39')]));_0x4032f4[_0x6f0c('0x38')]=_0x4032f4[_0x6f0c('0x38')][_0x6f0c('0x3a')]?_0x4032f4[_0x6f0c('0x38')]:_0x112ae3['model'];if(!_0xdde2fd['query'][_0x6f0c('0x3b')](_0x6f0c('0x57'))){_0x4032f4[_0x6f0c('0x1d')]=qs[_0x6f0c('0x1d')](_0xdde2fd[_0x6f0c('0x34')][_0x6f0c('0x1d')]);_0x4032f4[_0x6f0c('0x1b')]=qs[_0x6f0c('0x1b')](_0xdde2fd['query'][_0x6f0c('0x1b')]);}_0x4032f4[_0x6f0c('0x3c')]=qs[_0x6f0c('0x3d')](_0xdde2fd['query'][_0x6f0c('0x3d')]);_0x4032f4[_0x6f0c('0x3e')]=qs[_0x6f0c('0x35')](_[_0x6f0c('0x58')](_0xdde2fd[_0x6f0c('0x34')],_0x112ae3[_0x6f0c('0x35')]));_0x4032f4['where']['ListId']=_0x53304d['id'];if(_0xdde2fd['query'][_0x6f0c('0x40')]){_0x4032f4['where']=_[_0x6f0c('0x41')](_0x4032f4['where'],{'$or':_[_0x6f0c('0x2e')](_0x4032f4[_0x6f0c('0x38')],function(_0x5742ac){var _0xbcd436={};_0xbcd436[_0x5742ac]={'$like':'%'+_0xdde2fd[_0x6f0c('0x34')][_0x6f0c('0x40')]+'%'};return _0xbcd436;})});}_0x4032f4=_[_0x6f0c('0x41')]({},_0x4032f4,_0xdde2fd[_0x6f0c('0x59')]);return db[_0x6f0c('0x53')][_0x6f0c('0x1e')]({'where':_0x4032f4[_0x6f0c('0x3e')]})[_0x6f0c('0x24')](function(_0x2f0751){_0x425d45[_0x6f0c('0x1e')]=_0x2f0751;if(_0xdde2fd['query'][_0x6f0c('0x42')]){_0x4032f4[_0x6f0c('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x6f0c('0x44')](_0x4032f4);})[_0x6f0c('0x24')](function(_0x5ce887){_0x425d45[_0x6f0c('0x45')]=_0x5ce887;return _0x425d45;});}})[_0x6f0c('0x24')](respondWithFilteredResult(_0x20d375,_0x4032f4))[_0x6f0c('0x46')](handleError(_0x20d375,null));};exports[_0x6f0c('0x5a')]=function(_0x509ca4,_0x29c773,_0x19e18a){return db[_0x6f0c('0x2f')]['find']({'where':{'id':_0x509ca4['params']['id']}})[_0x6f0c('0x24')](handleEntityNotFound(_0x29c773,null))[_0x6f0c('0x24')](function(_0x441ea4){if(_0x441ea4){return _0x441ea4['removeDispositions'](_0x509ca4[_0x6f0c('0x34')][_0x6f0c('0x5b')]);}})[_0x6f0c('0x24')](respondWithStatusCode(_0x29c773,null))[_0x6f0c('0x46')](handleError(_0x29c773,null));};exports[_0x6f0c('0x5c')]=function(_0x133d5c,_0x304e2f,_0x4488b0){return db[_0x6f0c('0x2f')][_0x6f0c('0x4c')]({'where':{'id':_0x133d5c[_0x6f0c('0x4f')]['id']}})[_0x6f0c('0x24')](handleEntityNotFound(_0x304e2f,null))[_0x6f0c('0x24')](function(_0x17ca04){if(_0x17ca04){var _0x4a8421=[];var _0x16d13d={'success':[],'errors':[]};return db[_0x6f0c('0x5d')][_0x6f0c('0x50')]()['then'](function(_0x236bc7){if(_0x133d5c[_0x6f0c('0x49')][_0x6f0c('0x5e')]&&_['isArray'](_0x133d5c['body']['tags'])){if(_0x133d5c['body']['tags'][_0x6f0c('0x3a')]){_0x133d5c[_0x6f0c('0x49')]['tags']=_0x133d5c[_0x6f0c('0x49')]['tags']['join'](';')+';';}else{_0x133d5c[_0x6f0c('0x49')][_0x6f0c('0x5e')]=null;}}else{_0x133d5c['body'][_0x6f0c('0x5e')]=null;}if(_0x133d5c[_0x6f0c('0x49')]&&_[_0x6f0c('0x5f')](_0x133d5c[_0x6f0c('0x49')])){for(var _0xd46c7b=0x0;_0xd46c7b<_0x133d5c[_0x6f0c('0x49')][_0x6f0c('0x3a')];_0xd46c7b+=0x1){_0x133d5c[_0x6f0c('0x49')][_0xd46c7b][_0x6f0c('0x52')]=_0x133d5c[_0x6f0c('0x4f')]['id'];_0x4a8421[_0x6f0c('0x60')](_0x133d5c[_0x6f0c('0x49')][_0xd46c7b]);}return BPromise[_0x6f0c('0x61')](_0x4a8421,function(_0x32a6bc){return db[_0x6f0c('0x5d')]['create'](_['omit'](_0x32a6bc,[_0x6f0c('0x5b'),'id'])||{},{'fields':_[_0x6f0c('0x33')](_0x236bc7),'raw':!![]})[_0x6f0c('0x24')](function(_0x3ad7a3){_0x16d13d[_0x6f0c('0x62')][_0x6f0c('0x60')](_0x3ad7a3[_0x6f0c('0x63')]);})['catch'](function(_0x4109c8){_0x16d13d[_0x6f0c('0x64')][_0x6f0c('0x60')]({'data':_0x32a6bc,'error':_0x4109c8['message']});});})[_0x6f0c('0x24')](function(_0x301a67){return _0x16d13d;})[_0x6f0c('0x46')](function(_0x5f36e9){return _0x5f36e9;});}else{_0x304e2f[_0x6f0c('0x19')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x6f0c('0x24')](respondWithResult(_0x304e2f,null))['catch'](handleError(_0x304e2f,null));};exports['getContacts']=function(_0x3d90aa,_0x4266f7,_0x4c357d){var _0x1b99e5;return db[_0x6f0c('0x2f')][_0x6f0c('0x4c')]({'where':{'id':_0x3d90aa[_0x6f0c('0x4f')]['id']},'include':[{'model':db[_0x6f0c('0x65')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x4266f7,null))[_0x6f0c('0x24')](function(_0x340ec1){if(_0x340ec1){_0x1b99e5=_0x340ec1;return db[_0x6f0c('0x5d')][_0x6f0c('0x56')];}})[_0x6f0c('0x24')](function(_0x732c7e){if(_0x732c7e){var _0x22d8f5={};var _0x20c071={};_0x20c071['model']=_['concat'](_[_0x6f0c('0x33')](_0x732c7e),_['map'](_0x1b99e5['CustomFields'],function(_0x2b6776){return util[_0x6f0c('0x66')](_0x6f0c('0x67'),_0x2b6776['id']);}));_0x20c071['query']=_[_0x6f0c('0x33')](_0x3d90aa[_0x6f0c('0x34')]);_0x20c071['filters']=_[_0x6f0c('0x36')](_0x20c071['model'],_0x20c071['query']);_0x22d8f5[_0x6f0c('0x38')]=_[_0x6f0c('0x36')](_0x20c071[_0x6f0c('0x37')],qs[_0x6f0c('0x39')](_0x3d90aa[_0x6f0c('0x34')]['fields']));_0x22d8f5[_0x6f0c('0x38')]=_0x22d8f5[_0x6f0c('0x38')]['length']?_0x22d8f5['attributes']:_0x20c071[_0x6f0c('0x37')];if(!_0x3d90aa[_0x6f0c('0x34')][_0x6f0c('0x3b')](_0x6f0c('0x57'))){_0x22d8f5[_0x6f0c('0x1d')]=qs[_0x6f0c('0x1d')](_0x3d90aa[_0x6f0c('0x34')][_0x6f0c('0x1d')]);_0x22d8f5['offset']=qs[_0x6f0c('0x1b')](_0x3d90aa[_0x6f0c('0x34')][_0x6f0c('0x1b')]);}_0x22d8f5[_0x6f0c('0x3c')]=qs[_0x6f0c('0x3d')](_0x3d90aa[_0x6f0c('0x34')][_0x6f0c('0x3d')]);_0x22d8f5[_0x6f0c('0x3e')]=qs[_0x6f0c('0x35')](_[_0x6f0c('0x58')](_0x3d90aa[_0x6f0c('0x34')],_0x20c071[_0x6f0c('0x35')]));_0x22d8f5[_0x6f0c('0x68')]=!![];if(_0x3d90aa[_0x6f0c('0x34')][_0x6f0c('0x40')]){_0x22d8f5['where']=_[_0x6f0c('0x41')](_0x22d8f5[_0x6f0c('0x3e')],{'$or':_[_0x6f0c('0x2e')](_0x22d8f5[_0x6f0c('0x38')],function(_0x3f4581){var _0x530fb1={};_0x530fb1[_0x3f4581]={'$like':'%'+_0x3d90aa[_0x6f0c('0x34')][_0x6f0c('0x40')]+'%'};return _0x530fb1;})});}_0x22d8f5=_[_0x6f0c('0x41')]({},_0x22d8f5,_0x3d90aa[_0x6f0c('0x59')]);return _0x1b99e5[_0x6f0c('0x69')](_0x22d8f5);}})['then'](respondWithResult(_0x4266f7,null))[_0x6f0c('0x46')](handleError(_0x4266f7,null));};exports[_0x6f0c('0x6a')]=function(_0x2c1d1f,_0x5d3fbc,_0x29e3ce){var _0xbabe27;var _0x42da18;var _0x2c4e1c;var _0x207a46=_0x2c1d1f[_0x6f0c('0x4f')]['id'];csv_results=[];return db[_0x6f0c('0x6b')]['findAll']({'attributes':['id',_0x6f0c('0x2b')],'raw':!![],'order':[_0x6f0c('0x6c')]})[_0x6f0c('0x24')](function(_0x19e385){_0xbabe27=_0x19e385;var _0x1a6158=_[_0x6f0c('0x33')](db[_0x6f0c('0x5d')][_0x6f0c('0x56')]);return db[_0x6f0c('0x65')][_0x6f0c('0x44')]({'raw':!![],'attributes':['id',_0x6f0c('0x6d')]})[_0x6f0c('0x24')](function(_0x372401){_0x42da18=_0x372401;var _0x37392b=squel[_0x6f0c('0x6e')]()[_0x6f0c('0x39')](_0x1a6158)[_0x6f0c('0x6f')]('cm_contacts','c')[_0x6f0c('0x3e')](_0x6f0c('0x70'),_0x207a46)[_0x6f0c('0x3e')](_0x6f0c('0x71'))['distinct']();for(var _0x2141a6=0x0;_0x2141a6<_0x42da18['length'];_0x2141a6++){_0x37392b[_0x6f0c('0x72')](_0x6f0c('0x73')+_0x42da18[_0x2141a6]['id'],_0x6f0c('0x74')+_0x42da18[_0x2141a6][_0x6f0c('0x6d')]);}for(var _0x2141a6=0x0;_0x2141a6<_0xbabe27[_0x6f0c('0x3a')];_0x2141a6++){_0x37392b[_0x6f0c('0x72')](squel['select']()[_0x6f0c('0x72')]('item')['from'](_0x6f0c('0x75'))['where'](_0x6f0c('0x76'),_0xbabe27[_0x2141a6]['id'])[_0x6f0c('0x3e')](_0x6f0c('0x77')),'additionalPhone_'+_0xbabe27[_0x2141a6]['name']);_0x37392b[_0x6f0c('0x72')](squel[_0x6f0c('0x6e')]()['field']('description')[_0x6f0c('0x6f')]('cm_contact_has_items')[_0x6f0c('0x3e')](_0x6f0c('0x76'),_0xbabe27[_0x2141a6]['id'])[_0x6f0c('0x3e')](_0x6f0c('0x77')),'description_additionalPhone_'+_0xbabe27[_0x2141a6]['name']);}var _0x2d8b3b=[];_0x2d8b3b['push'](_0x37392b[_0x6f0c('0x78')]());BPromise[_0x6f0c('0x61')](_0x2d8b3b,handleQuery)[_0x6f0c('0x24')](function(_0x10649d){handleQuery(_0x37392b[_0x6f0c('0x78')]());var _0x416ac4=csv_results[0x0];if(!_[_0x6f0c('0x79')](_0x416ac4)){var _0x24f39f=toCsv(_0x416ac4);var _0x4d1fab=Date[_0x6f0c('0x7a')]();fs[_0x6f0c('0x7b')](util[_0x6f0c('0x66')](_0x6f0c('0x7c'),_0x207a46,_0x4d1fab),_0x24f39f);_0x5d3fbc[_0x6f0c('0x7d')](_0x6f0c('0x7e'),_0x6f0c('0x7f')+util['format'](_0x6f0c('0x80'),_0x207a46,_0x4d1fab));_0x5d3fbc[_0x6f0c('0x7d')](_0x6f0c('0x81'),'text/csv');return _0x5d3fbc[_0x6f0c('0x82')](util['format'](_0x6f0c('0x7c'),_0x207a46,_0x4d1fab));}else{return _0x5d3fbc[_0x6f0c('0x28')](0xcc);}});});});};exports[_0x6f0c('0x83')]=function(_0x59fa59,_0x95c4b5,_0x4a796e){var _0x1ff267;delete _0x59fa59[_0x6f0c('0x49')]['id'];return db[_0x6f0c('0x2f')][_0x6f0c('0x55')]({'where':{'id':_0x59fa59[_0x6f0c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x95c4b5,null))['then'](function(_0xa0973b){if(_0xa0973b){return db[_0x6f0c('0x84')][_0x6f0c('0x85')](function(_0x59d319){return db['CmCustomField'][_0x6f0c('0x48')](_0x59fa59[_0x6f0c('0x49')],{'transaction':_0x59d319})[_0x6f0c('0x24')](function(_0xb13af4){_0x1ff267=_0xb13af4;return _0xa0973b[_0x6f0c('0x86')](_0xb13af4,{'transaction':_0x59d319});})[_0x6f0c('0x24')](function(){var _0x1c4cb0={'type':db[_0x6f0c('0x87')][_0x6f0c('0x88')],'transaction':_0x59d319};switch(_0x59fa59[_0x6f0c('0x49')][_0x6f0c('0x31')]){case _0x6f0c('0x89'):_0x1c4cb0[_0x6f0c('0x31')]=db['Sequelize']['TEXT'];break;case _0x6f0c('0x8a'):_0x1c4cb0['type']=db[_0x6f0c('0x87')][_0x6f0c('0x8b')];break;case _0x6f0c('0x8c'):_0x1c4cb0['type']=db[_0x6f0c('0x87')][_0x6f0c('0x8d')];_0x1c4cb0[_0x6f0c('0x8e')]=![];break;default:}return db['sequelize'][_0x6f0c('0x8f')][_0x6f0c('0x90')]('cm_contacts',util['format']('cf_%s',_0x1ff267['id']),_0x1c4cb0);})[_0x6f0c('0x24')](function(){return _0x1ff267;});});}})['then'](respondWithResult(_0x95c4b5,null))[_0x6f0c('0x46')](handleError(_0x95c4b5,null));};exports['getCustomFields']=function(_0x10b865,_0x24f43a,_0x1af93b){var _0x23b3cb={};var _0x5291f0={};var _0x4241cb;var _0x341d1b;return db[_0x6f0c('0x2f')][_0x6f0c('0x55')]({'where':{'id':_0x10b865['params']['id']}})['then'](handleEntityNotFound(_0x24f43a,null))[_0x6f0c('0x24')](function(_0x158cb0){if(_0x158cb0){_0x4241cb=_0x158cb0;_0x5291f0[_0x6f0c('0x37')]=_['keys'](db[_0x6f0c('0x65')][_0x6f0c('0x56')]);_0x5291f0[_0x6f0c('0x34')]=_[_0x6f0c('0x33')](_0x10b865[_0x6f0c('0x34')]);_0x5291f0['filters']=_[_0x6f0c('0x36')](_0x5291f0[_0x6f0c('0x37')],_0x5291f0[_0x6f0c('0x34')]);_0x23b3cb[_0x6f0c('0x38')]=_[_0x6f0c('0x36')](_0x5291f0[_0x6f0c('0x37')],qs[_0x6f0c('0x39')](_0x10b865[_0x6f0c('0x34')][_0x6f0c('0x39')]));_0x23b3cb[_0x6f0c('0x38')]=_0x23b3cb['attributes'][_0x6f0c('0x3a')]?_0x23b3cb['attributes']:_0x5291f0[_0x6f0c('0x37')];_0x23b3cb['order']=qs[_0x6f0c('0x3d')](_0x10b865[_0x6f0c('0x34')]['sort']);_0x23b3cb[_0x6f0c('0x3e')]=qs['filters'](_[_0x6f0c('0x58')](_0x10b865['query'],_0x5291f0[_0x6f0c('0x35')]));_0x23b3cb[_0x6f0c('0x3e')]=_[_0x6f0c('0x41')](_0x23b3cb['where'],{'$or':[{'ListId':_0x158cb0['id']},{'ListId':null}]});if(_0x10b865[_0x6f0c('0x34')][_0x6f0c('0x40')]){_0x23b3cb['where']=_['merge'](_0x23b3cb['where'],{'$or':_['map'](_0x23b3cb[_0x6f0c('0x38')],function(_0x12468b){var _0x1bf072={};_0x1bf072[_0x12468b]={'$like':'%'+_0x10b865['query'][_0x6f0c('0x40')]+'%'};return _0x1bf072;})});}_0x23b3cb=_[_0x6f0c('0x41')]({},_0x23b3cb,_0x10b865[_0x6f0c('0x59')]);return db[_0x6f0c('0x65')][_0x6f0c('0x91')](_0x23b3cb);}})[_0x6f0c('0x24')](respondWithResult(_0x24f43a,null))[_0x6f0c('0x46')](handleError(_0x24f43a,null));};exports[_0x6f0c('0x92')]=function(_0x348d95,_0x514193){return db[_0x6f0c('0x65')][_0x6f0c('0x91')]({'where':{'ListId':null}})[_0x6f0c('0x24')](handleEntityNotFound(_0x514193,null))[_0x6f0c('0x24')](function(_0x393ccf){return _0x393ccf;})['then'](respondWithResult(_0x514193,null))[_0x6f0c('0x46')](handleError(_0x514193,null));};exports[_0x6f0c('0x93')]=function(_0x244294,_0x51bf14,_0x490059){return db['CmList']['find']({'where':{'id':_0x244294[_0x6f0c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51bf14,null))['then'](function(_0xd0cd8c){if(_0xd0cd8c){return _0xd0cd8c[_0x6f0c('0x93')](_0x244294[_0x6f0c('0x49')][_0x6f0c('0x5b')],_[_0x6f0c('0x94')](_0x244294['body'],[_0x6f0c('0x5b'),'id'])||{})[_0x6f0c('0x95')](function(_0x464eeb){for(var _0x384dec=0x0;_0x384dec<_0x244294[_0x6f0c('0x49')][_0x6f0c('0x5b')][_0x6f0c('0x3a')];_0x384dec+=0x1){socket[_0x6f0c('0x96')](_0x6f0c('0x97'),{'UserId':Number(_0x244294[_0x6f0c('0x49')][_0x6f0c('0x5b')][_0x384dec]),'CmListId':Number(_0x244294[_0x6f0c('0x4f')]['id'])});}return _0x464eeb;});}})[_0x6f0c('0x24')](respondWithResult(_0x51bf14,null))[_0x6f0c('0x46')](handleError(_0x51bf14,null));};exports[_0x6f0c('0x98')]=function(_0x2c45aa,_0x410b0b,_0x16b57f){return db[_0x6f0c('0x2f')][_0x6f0c('0x4c')]({'where':{'id':_0x2c45aa[_0x6f0c('0x4f')]['id']}})[_0x6f0c('0x24')](handleEntityNotFound(_0x410b0b,null))[_0x6f0c('0x24')](function(_0x3e3641){if(_0x3e3641){return _0x3e3641[_0x6f0c('0x98')](_0x2c45aa['query'][_0x6f0c('0x5b')])[_0x6f0c('0x24')](function(){if(_[_0x6f0c('0x5f')](_0x2c45aa[_0x6f0c('0x34')][_0x6f0c('0x5b')])){for(var _0x7bb00b=0x0;_0x7bb00b<_0x2c45aa[_0x6f0c('0x34')][_0x6f0c('0x5b')][_0x6f0c('0x3a')];_0x7bb00b+=0x1){socket[_0x6f0c('0x96')](_0x6f0c('0x99'),{'UserId':Number(_0x2c45aa[_0x6f0c('0x34')][_0x6f0c('0x5b')][_0x7bb00b]),'CmListId':Number(_0x2c45aa[_0x6f0c('0x4f')]['id'])});}}else{socket['emit'](_0x6f0c('0x99'),{'UserId':Number(_0x2c45aa[_0x6f0c('0x34')][_0x6f0c('0x5b')]),'CmListId':Number(_0x2c45aa[_0x6f0c('0x4f')]['id'])});}});}})[_0x6f0c('0x24')](respondWithStatusCode(_0x410b0b,null))['catch'](handleError(_0x410b0b,null));};exports[_0x6f0c('0x9a')]=function(_0x31102c,_0x352425,_0x25aaa7){var _0x1b21cc={};var _0x44c53f={};var _0x2279d9;var _0x480603;return db['CmList'][_0x6f0c('0x55')]({'where':{'id':_0x31102c['params']['id']}})[_0x6f0c('0x24')](handleEntityNotFound(_0x352425,null))['then'](function(_0x555e88){if(_0x555e88){_0x2279d9=_0x555e88;_0x44c53f['model']=_[_0x6f0c('0x33')](db[_0x6f0c('0x9b')][_0x6f0c('0x56')]);_0x44c53f[_0x6f0c('0x34')]=_['keys'](_0x31102c[_0x6f0c('0x34')]);_0x44c53f[_0x6f0c('0x35')]=_[_0x6f0c('0x36')](_0x44c53f['model'],_0x44c53f[_0x6f0c('0x34')]);_0x1b21cc[_0x6f0c('0x38')]=_['intersection'](_0x44c53f[_0x6f0c('0x37')],qs['fields'](_0x31102c[_0x6f0c('0x34')]['fields']));_0x1b21cc[_0x6f0c('0x38')]=_0x1b21cc['attributes'][_0x6f0c('0x3a')]?_0x1b21cc[_0x6f0c('0x38')]:_0x44c53f[_0x6f0c('0x37')];_0x1b21cc['order']=qs[_0x6f0c('0x3d')](_0x31102c[_0x6f0c('0x34')]['sort']);_0x1b21cc[_0x6f0c('0x3e')]=qs[_0x6f0c('0x35')](_['pick'](_0x31102c[_0x6f0c('0x34')],_0x44c53f[_0x6f0c('0x35')]));if(_0x31102c[_0x6f0c('0x34')][_0x6f0c('0x40')]){_0x1b21cc[_0x6f0c('0x3e')]=_['merge'](_0x1b21cc[_0x6f0c('0x3e')],{'$or':_[_0x6f0c('0x2e')](_0x1b21cc['attributes'],function(_0x5f1773){var _0x543a05={};_0x543a05[_0x5f1773]={'$like':'%'+_0x31102c[_0x6f0c('0x34')]['filter']+'%'};return _0x543a05;})});}_0x1b21cc=_[_0x6f0c('0x41')]({},_0x1b21cc,_0x31102c[_0x6f0c('0x59')]);return _0x2279d9[_0x6f0c('0x9a')](_0x1b21cc);}})['then'](function(_0x2e95fd){if(_0x2e95fd){_0x480603=_0x2e95fd[_0x6f0c('0x3a')];if(!_0x31102c[_0x6f0c('0x34')][_0x6f0c('0x3b')](_0x6f0c('0x57'))){_0x1b21cc[_0x6f0c('0x1d')]=qs[_0x6f0c('0x1d')](_0x31102c[_0x6f0c('0x34')][_0x6f0c('0x1d')]);_0x1b21cc[_0x6f0c('0x1b')]=qs[_0x6f0c('0x1b')](_0x31102c['query'][_0x6f0c('0x1b')]);}return _0x2279d9['getAgents'](_0x1b21cc);}})[_0x6f0c('0x24')](function(_0x41b2c9){if(_0x41b2c9){return _0x41b2c9?{'count':_0x480603,'rows':_0x41b2c9}:null;}})['then'](respondWithResult(_0x352425,null))[_0x6f0c('0x46')](handleError(_0x352425,null));};function handleQuery(_0x3e36b0){logger['info'](_0x3e36b0);return db[_0x6f0c('0x84')][_0x6f0c('0x34')](_0x3e36b0)[_0x6f0c('0x95')](function(_0x4541b2){csv_results[_0x6f0c('0x60')](_0x4541b2);})[_0x6f0c('0x46')](function(_0x3adbe0){logger[_0x6f0c('0x29')](_0x3adbe0[_0x6f0c('0x9c')]);});} \ No newline at end of file +var _0x61d3=['addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','map','CmList','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','order','ListId','rows','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','each','omit','push','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','customField_','select','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','field','description','description_additionalPhone_','toString','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','Sequelize','TEXT','INTEGER','switch','defaultValue','getCustomFields','findAndCountAll','getGlobalCustomFields'];(function(_0x30cf8d,_0x286354){var _0x92e924=function(_0x5ce89b){while(--_0x5ce89b){_0x30cf8d['push'](_0x30cf8d['shift']());}};_0x92e924(++_0x286354);}(_0x61d3,0x1e9));var _0x361d=function(_0x1a84b1,_0x3ca6d8){_0x1a84b1=_0x1a84b1-0x0;var _0x161938=_0x61d3[_0x1a84b1];return _0x161938;};'use strict';var emlformat=require(_0x361d('0x0'));var rimraf=require(_0x361d('0x1'));var zipdir=require(_0x361d('0x2'));var jsonpatch=require(_0x361d('0x3'));var rp=require('request-promise');var moment=require(_0x361d('0x4'));var BPromise=require(_0x361d('0x5'));var Mustache=require(_0x361d('0x6'));var util=require(_0x361d('0x7'));var path=require(_0x361d('0x8'));var sox=require(_0x361d('0x9'));var csv=require(_0x361d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x361d('0xb'));var _=require(_0x361d('0xc'));var squel=require('squel');var crypto=require(_0x361d('0xd'));var jsforce=require(_0x361d('0xe'));var deskjs=require(_0x361d('0xf'));var toCsv=require(_0x361d('0xa'));var querystring=require(_0x361d('0x10'));var Papa=require(_0x361d('0x11'));var Redis=require(_0x361d('0x12'));var authService=require(_0x361d('0x13'));var qs=require(_0x361d('0x14'));var as=require(_0x361d('0x15'));var hardwareService=require(_0x361d('0x16'));var logger=require(_0x361d('0x17'))(_0x361d('0x18'));var utils=require('../../config/utils');var config=require(_0x361d('0x19'));var licenseUtil=require(_0x361d('0x1a'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x361d('0x1b')]=_[_0x361d('0x1c')](config[_0x361d('0x1b')],{'host':_0x361d('0x1d'),'port':0x18eb});var socket=require(_0x361d('0x1e'))(new Redis(config[_0x361d('0x1b')]));require(_0x361d('0x1f'))[_0x361d('0x20')](socket);function respondWithStatusCode(_0x121038,_0x372e6d){_0x372e6d=_0x372e6d||0xcc;return function(_0x14efbc){if(_0x14efbc){return _0x121038[_0x361d('0x21')](_0x372e6d);}return _0x121038['status'](_0x372e6d)[_0x361d('0x22')]();};}function respondWithResult(_0x911065,_0x1ef583){_0x1ef583=_0x1ef583||0xc8;return function(_0x2b888a){if(_0x2b888a){return _0x911065[_0x361d('0x23')](_0x1ef583)['json'](_0x2b888a);}};}function respondWithFilteredResult(_0x9eebb,_0x48a31f){return function(_0x28e499){if(_0x28e499){var _0x2dea8a=typeof _0x48a31f[_0x361d('0x24')]==='undefined'&&typeof _0x48a31f[_0x361d('0x25')]===_0x361d('0x26');var _0x5d6c98=_0x28e499[_0x361d('0x27')];var _0x31b8d9=_0x2dea8a?0x0:_0x48a31f['offset'];var _0x125e7a=_0x2dea8a?_0x28e499['count']:_0x48a31f[_0x361d('0x24')]+_0x48a31f[_0x361d('0x25')];var _0x40a2a3;if(_0x125e7a>=_0x5d6c98){_0x125e7a=_0x5d6c98;_0x40a2a3=0xc8;}else{_0x40a2a3=0xce;}_0x9eebb[_0x361d('0x23')](_0x40a2a3);return _0x9eebb[_0x361d('0x28')]('Content-Range',_0x31b8d9+'-'+_0x125e7a+'/'+_0x5d6c98)['json'](_0x28e499);}return null;};}function patchUpdates(_0xf8040e){return function(_0xde4f28){try{jsonpatch[_0x361d('0x29')](_0xde4f28,_0xf8040e,!![]);}catch(_0x207be4){return BPromise[_0x361d('0x2a')](_0x207be4);}return _0xde4f28[_0x361d('0x2b')]();};}function saveUpdates(_0x4ce432,_0x17a21a){return function(_0x37268d){if(_0x37268d){return _0x37268d[_0x361d('0x2c')](_0x4ce432)['then'](function(_0x312573){return _0x312573;});}return null;};}function removeEntity(_0xae6169,_0xf27cd0){return function(_0x1959ec){if(_0x1959ec){return _0x1959ec[_0x361d('0x2d')]()[_0x361d('0x2e')](function(){var _0x3e061d=_0x1959ec[_0x361d('0x2f')]({'plain':!![]});var _0x505b84='Lists';return db[_0x361d('0x30')][_0x361d('0x2d')]({'where':{'type':_0x505b84,'resourceId':_0x3e061d['id']}})[_0x361d('0x2e')](function(){return _0x1959ec;});})['then'](function(){_0xae6169[_0x361d('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374e3c,_0x4cd904){return function(_0x3cf88e){if(!_0x3cf88e){_0x374e3c['sendStatus'](0x194);}return _0x3cf88e;};}function handleError(_0x1afd3d,_0x53ed4f){_0x53ed4f=_0x53ed4f||0x1f4;return function(_0x12683e){logger[_0x361d('0x31')](_0x12683e[_0x361d('0x32')]);if(_0x12683e[_0x361d('0x33')]){delete _0x12683e[_0x361d('0x33')];}_0x1afd3d[_0x361d('0x23')](_0x53ed4f)['send'](_0x12683e);};}exports[_0x361d('0x34')]=function(_0x5f37e4,_0xdcfa3){var _0x2ce341={},_0x5c7328={},_0xeef852={'count':0x0,'rows':[]};var _0x3f6230=_[_0x361d('0x35')](db[_0x361d('0x36')][_0x361d('0x37')],function(_0x16390c){return{'name':_0x16390c['fieldName'],'type':_0x16390c[_0x361d('0x38')]['key']};});_0x5c7328['model']=_[_0x361d('0x35')](_0x3f6230,_0x361d('0x33'));_0x5c7328[_0x361d('0x39')]=_[_0x361d('0x3a')](_0x5f37e4[_0x361d('0x39')]);_0x5c7328[_0x361d('0x3b')]=_[_0x361d('0x3c')](_0x5c7328[_0x361d('0x3d')],_0x5c7328[_0x361d('0x39')]);_0x2ce341[_0x361d('0x3e')]=_[_0x361d('0x3c')](_0x5c7328['model'],qs[_0x361d('0x3f')](_0x5f37e4[_0x361d('0x39')][_0x361d('0x3f')]));_0x2ce341[_0x361d('0x3e')]=_0x2ce341[_0x361d('0x3e')]['length']?_0x2ce341[_0x361d('0x3e')]:_0x5c7328[_0x361d('0x3d')];if(!_0x5f37e4[_0x361d('0x39')][_0x361d('0x40')](_0x361d('0x41'))){_0x2ce341['limit']=qs['limit'](_0x5f37e4[_0x361d('0x39')]['limit']);_0x2ce341[_0x361d('0x24')]=qs[_0x361d('0x24')](_0x5f37e4['query'][_0x361d('0x24')]);}_0x2ce341['order']=qs['sort'](_0x5f37e4[_0x361d('0x39')][_0x361d('0x42')]);_0x2ce341[_0x361d('0x43')]=qs[_0x361d('0x3b')](_[_0x361d('0x44')](_0x5f37e4[_0x361d('0x39')],_0x5c7328['filters']),_0x3f6230);if(_0x5f37e4['query'][_0x361d('0x45')]){_0x2ce341[_0x361d('0x43')]=_[_0x361d('0x46')](_0x2ce341[_0x361d('0x43')],{'$or':_['map'](_0x3f6230,function(_0x51fcd5){if(_0x51fcd5[_0x361d('0x38')]!==_0x361d('0x47')){var _0x27e6ef={};_0x27e6ef[_0x51fcd5[_0x361d('0x33')]]={'$like':'%'+_0x5f37e4[_0x361d('0x39')][_0x361d('0x45')]+'%'};return _0x27e6ef;}})});}_0x2ce341=_[_0x361d('0x46')]({},_0x2ce341,_0x5f37e4[_0x361d('0x48')]);var _0x13a665={'where':_0x2ce341['where']};return db['CmList']['count'](_0x13a665)[_0x361d('0x2e')](function(_0x262900){_0xeef852[_0x361d('0x27')]=_0x262900;if(_0x5f37e4[_0x361d('0x39')]['includeAll']){_0x2ce341[_0x361d('0x49')]=[{'all':!![]}];}return db['CmList'][_0x361d('0x4a')](_0x2ce341);})['then'](function(_0x42cf1e){_0xeef852['rows']=_0x42cf1e;return _0xeef852;})[_0x361d('0x2e')](respondWithFilteredResult(_0xdcfa3,_0x2ce341))[_0x361d('0x4b')](handleError(_0xdcfa3,null));};exports[_0x361d('0x4c')]=function(_0x4f64e7,_0x3d8fcb){var _0x2de784={'raw':![],'where':{'id':_0x4f64e7['params']['id']}},_0x16222b={};_0x16222b[_0x361d('0x3d')]=_[_0x361d('0x3a')](db[_0x361d('0x36')][_0x361d('0x37')]);_0x16222b[_0x361d('0x39')]=_['keys'](_0x4f64e7[_0x361d('0x39')]);_0x16222b[_0x361d('0x3b')]=_[_0x361d('0x3c')](_0x16222b['model'],_0x16222b['query']);_0x2de784[_0x361d('0x3e')]=_['intersection'](_0x16222b[_0x361d('0x3d')],qs['fields'](_0x4f64e7[_0x361d('0x39')]['fields']));_0x2de784[_0x361d('0x3e')]=_0x2de784[_0x361d('0x3e')][_0x361d('0x4d')]?_0x2de784[_0x361d('0x3e')]:_0x16222b['model'];if(_0x4f64e7['query'][_0x361d('0x4e')]){_0x2de784[_0x361d('0x49')]=[{'all':!![]}];}_0x2de784=_['merge']({},_0x2de784,_0x4f64e7[_0x361d('0x48')]);return db[_0x361d('0x36')][_0x361d('0x4f')](_0x2de784)['then'](handleEntityNotFound(_0x3d8fcb,null))[_0x361d('0x2e')](respondWithResult(_0x3d8fcb,null))[_0x361d('0x4b')](handleError(_0x3d8fcb,null));};exports[_0x361d('0x50')]=function(_0xfda9c3,_0x2b8795){return db[_0x361d('0x36')]['create'](_0xfda9c3[_0x361d('0x51')],{})[_0x361d('0x2e')](function(_0x31696d){var _0x26c1a8=_0xfda9c3['user'][_0x361d('0x2f')]({'plain':!![]});if(!_0x26c1a8)throw new Error(_0x361d('0x52'));if(_0x26c1a8[_0x361d('0x53')]===_0x361d('0x54')){var _0x4d06b6=_0x31696d[_0x361d('0x2f')]({'plain':!![]});var _0x1fc20d='Lists';return db['UserProfileSection'][_0x361d('0x4f')]({'where':{'name':_0x1fc20d,'userProfileId':_0x26c1a8[_0x361d('0x55')]},'raw':!![]})['then'](function(_0x56b3e3){if(_0x56b3e3&&_0x56b3e3[_0x361d('0x56')]===0x0){return db[_0x361d('0x30')][_0x361d('0x50')]({'name':_0x4d06b6[_0x361d('0x33')],'resourceId':_0x4d06b6['id'],'type':_0x56b3e3['name'],'sectionId':_0x56b3e3['id']},{})[_0x361d('0x2e')](function(){return _0x31696d;});}else{return _0x31696d;}})[_0x361d('0x4b')](function(_0x4a1a94){logger[_0x361d('0x31')](_0x361d('0x57'),_0x4a1a94);throw _0x4a1a94;});}return _0x31696d;})[_0x361d('0x2e')](respondWithResult(_0x2b8795,0xc9))['catch'](handleError(_0x2b8795,null));};exports[_0x361d('0x2c')]=function(_0x1ad297,_0x5affc1){if(_0x1ad297['body']['id']){delete _0x1ad297[_0x361d('0x51')]['id'];}return db['CmList']['find']({'where':{'id':_0x1ad297['params']['id']}})[_0x361d('0x2e')](handleEntityNotFound(_0x5affc1,null))['then'](saveUpdates(_0x1ad297[_0x361d('0x51')],null))[_0x361d('0x2e')](respondWithResult(_0x5affc1,null))[_0x361d('0x4b')](handleError(_0x5affc1,null));};exports['destroy']=function(_0x2c1504,_0x538e01){return db[_0x361d('0x36')][_0x361d('0x4f')]({'where':{'id':_0x2c1504[_0x361d('0x58')]['id']}})['then'](handleEntityNotFound(_0x538e01,null))[_0x361d('0x2e')](removeEntity(_0x538e01,null))['catch'](handleError(_0x538e01,null));};exports[_0x361d('0x59')]=function(_0x36ed4a,_0x24d449){return db[_0x361d('0x36')][_0x361d('0x59')]()['then'](respondWithResult(_0x24d449,null))['catch'](handleError(_0x24d449,null));};exports[_0x361d('0x5a')]=function(_0x57e0ce,_0x12cb43,_0x540f10){if(_0x57e0ce[_0x361d('0x51')]['id']){delete _0x57e0ce[_0x361d('0x51')]['id'];}return db['CmList'][_0x361d('0x4f')]({'where':{'id':_0x57e0ce[_0x361d('0x58')]['id']}})[_0x361d('0x2e')](handleEntityNotFound(_0x12cb43,null))[_0x361d('0x2e')](function(_0x1dcbee){if(_0x1dcbee){_0x57e0ce[_0x361d('0x51')]['ListId']=_0x1dcbee['id'];return db[_0x361d('0x5b')][_0x361d('0x50')](_0x57e0ce['body']);}})['then'](respondWithResult(_0x12cb43,null))['catch'](handleError(_0x12cb43,null));};exports[_0x361d('0x5c')]=function(_0x32343f,_0x1832e6,_0x556ce3){var _0x5312d5={'raw':![],'where':{}};var _0x5816b6={};var _0x3d9030={'count':0x0,'rows':[]};return db[_0x361d('0x36')]['findOne']({'where':{'id':_0x32343f[_0x361d('0x58')]['id']}})[_0x361d('0x2e')](handleEntityNotFound(_0x1832e6,null))[_0x361d('0x2e')](function(_0x135cef){if(_0x135cef){_0x5816b6['model']=_[_0x361d('0x3a')](db[_0x361d('0x5b')][_0x361d('0x37')]);_0x5816b6[_0x361d('0x39')]=_[_0x361d('0x3a')](_0x32343f[_0x361d('0x39')]);_0x5816b6[_0x361d('0x3b')]=_['intersection'](_0x5816b6[_0x361d('0x3d')],_0x5816b6['query']);_0x5312d5[_0x361d('0x3e')]=_[_0x361d('0x3c')](_0x5816b6[_0x361d('0x3d')],qs[_0x361d('0x3f')](_0x32343f[_0x361d('0x39')][_0x361d('0x3f')]));_0x5312d5[_0x361d('0x3e')]=_0x5312d5[_0x361d('0x3e')]['length']?_0x5312d5[_0x361d('0x3e')]:_0x5816b6[_0x361d('0x3d')];if(!_0x32343f['query']['hasOwnProperty'](_0x361d('0x41'))){_0x5312d5['limit']=qs[_0x361d('0x25')](_0x32343f[_0x361d('0x39')][_0x361d('0x25')]);_0x5312d5[_0x361d('0x24')]=qs[_0x361d('0x24')](_0x32343f[_0x361d('0x39')][_0x361d('0x24')]);}_0x5312d5[_0x361d('0x5d')]=qs['sort'](_0x32343f['query']['sort']);_0x5312d5['where']=qs['filters'](_[_0x361d('0x44')](_0x32343f[_0x361d('0x39')],_0x5816b6[_0x361d('0x3b')]));_0x5312d5[_0x361d('0x43')][_0x361d('0x5e')]=_0x135cef['id'];if(_0x32343f[_0x361d('0x39')][_0x361d('0x45')]){_0x5312d5[_0x361d('0x43')]=_[_0x361d('0x46')](_0x5312d5[_0x361d('0x43')],{'$or':_[_0x361d('0x35')](_0x5312d5[_0x361d('0x3e')],function(_0x5c409b){var _0x3b97f0={};_0x3b97f0[_0x5c409b]={'$like':'%'+_0x32343f[_0x361d('0x39')][_0x361d('0x45')]+'%'};return _0x3b97f0;})});}_0x5312d5=_[_0x361d('0x46')]({},_0x5312d5,_0x32343f[_0x361d('0x48')]);return db[_0x361d('0x5b')][_0x361d('0x27')]({'where':_0x5312d5[_0x361d('0x43')]})[_0x361d('0x2e')](function(_0x28892d){_0x3d9030[_0x361d('0x27')]=_0x28892d;if(_0x32343f[_0x361d('0x39')]['includeAll']){_0x5312d5['include']=[{'all':!![]}];}return db[_0x361d('0x5b')][_0x361d('0x4a')](_0x5312d5);})[_0x361d('0x2e')](function(_0x2ea998){_0x3d9030[_0x361d('0x5f')]=_0x2ea998;return _0x3d9030;});}})[_0x361d('0x2e')](respondWithFilteredResult(_0x1832e6,_0x5312d5))[_0x361d('0x4b')](handleError(_0x1832e6,null));};exports[_0x361d('0x60')]=function(_0x3427ce,_0x10ccf9,_0x46146d){return db[_0x361d('0x36')]['find']({'where':{'id':_0x3427ce[_0x361d('0x58')]['id']}})[_0x361d('0x2e')](handleEntityNotFound(_0x10ccf9,null))['then'](function(_0x5e59f4){if(_0x5e59f4){return _0x5e59f4[_0x361d('0x60')](_0x3427ce[_0x361d('0x39')][_0x361d('0x61')]);}})[_0x361d('0x2e')](respondWithStatusCode(_0x10ccf9,null))[_0x361d('0x4b')](handleError(_0x10ccf9,null));};exports[_0x361d('0x62')]=function(_0x5a2a07,_0x24452b,_0x108747){return db[_0x361d('0x36')][_0x361d('0x4f')]({'where':{'id':_0x5a2a07[_0x361d('0x58')]['id']}})[_0x361d('0x2e')](handleEntityNotFound(_0x24452b,null))[_0x361d('0x2e')](function(_0x591d92){if(_0x591d92){var _0x12ecdb=[];var _0x46f78f={'success':[],'errors':[]};return db[_0x361d('0x63')][_0x361d('0x59')]()['then'](function(_0x217abc){if(_0x5a2a07['body'][_0x361d('0x64')]&&_['isArray'](_0x5a2a07['body']['tags'])){if(_0x5a2a07['body']['tags'][_0x361d('0x4d')]){_0x5a2a07[_0x361d('0x51')][_0x361d('0x64')]=_0x5a2a07[_0x361d('0x51')][_0x361d('0x64')][_0x361d('0x65')](';')+';';}else{_0x5a2a07[_0x361d('0x51')]['tags']=null;}}else{_0x5a2a07[_0x361d('0x51')][_0x361d('0x64')]=null;}if(_0x5a2a07['body']&&_[_0x361d('0x66')](_0x5a2a07[_0x361d('0x51')])){for(var _0x5a242e=0x0;_0x5a242e<_0x5a2a07[_0x361d('0x51')][_0x361d('0x4d')];_0x5a242e+=0x1){_0x5a2a07[_0x361d('0x51')][_0x5a242e][_0x361d('0x5e')]=_0x5a2a07['params']['id'];_0x12ecdb['push'](_0x5a2a07[_0x361d('0x51')][_0x5a242e]);}return BPromise[_0x361d('0x67')](_0x12ecdb,function(_0x506109){return db[_0x361d('0x63')]['create'](_[_0x361d('0x68')](_0x506109,[_0x361d('0x61'),'id'])||{},{'fields':_[_0x361d('0x3a')](_0x217abc),'raw':!![]})[_0x361d('0x2e')](function(_0x5c423a){_0x46f78f['success'][_0x361d('0x69')](_0x5c423a[_0x361d('0x6a')]);})[_0x361d('0x4b')](function(_0x170f5d){_0x46f78f[_0x361d('0x6b')][_0x361d('0x69')]({'data':_0x506109,'error':_0x170f5d['message']});});})[_0x361d('0x2e')](function(_0x1d1e6e){return _0x46f78f;})['catch'](function(_0x3736c4){return _0x3736c4;});}else{_0x24452b['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x361d('0x2e')](respondWithResult(_0x24452b,null))[_0x361d('0x4b')](handleError(_0x24452b,null));};exports[_0x361d('0x6c')]=function(_0x208b1f,_0x5dc533,_0x2da984){var _0x1555a4;return db[_0x361d('0x36')][_0x361d('0x4f')]({'where':{'id':_0x208b1f['params']['id']},'include':[{'model':db[_0x361d('0x6d')],'as':_0x361d('0x6e')}]})[_0x361d('0x2e')](handleEntityNotFound(_0x5dc533,null))['then'](function(_0xbd1dc7){if(_0xbd1dc7){_0x1555a4=_0xbd1dc7;return db[_0x361d('0x63')][_0x361d('0x37')];}})[_0x361d('0x2e')](function(_0x5781aa){if(_0x5781aa){var _0x13ffb4={};var _0x3b251c={};_0x3b251c[_0x361d('0x3d')]=_[_0x361d('0x6f')](_['keys'](_0x5781aa),_['map'](_0x1555a4[_0x361d('0x6e')],function(_0x25ddf5){return util[_0x361d('0x70')](_0x361d('0x71'),_0x25ddf5['id']);}));_0x3b251c[_0x361d('0x39')]=_['keys'](_0x208b1f[_0x361d('0x39')]);_0x3b251c[_0x361d('0x3b')]=_[_0x361d('0x3c')](_0x3b251c[_0x361d('0x3d')],_0x3b251c['query']);_0x13ffb4[_0x361d('0x3e')]=_['intersection'](_0x3b251c[_0x361d('0x3d')],qs[_0x361d('0x3f')](_0x208b1f[_0x361d('0x39')][_0x361d('0x3f')]));_0x13ffb4[_0x361d('0x3e')]=_0x13ffb4[_0x361d('0x3e')][_0x361d('0x4d')]?_0x13ffb4[_0x361d('0x3e')]:_0x3b251c['model'];if(!_0x208b1f['query'][_0x361d('0x40')](_0x361d('0x41'))){_0x13ffb4[_0x361d('0x25')]=qs[_0x361d('0x25')](_0x208b1f['query']['limit']);_0x13ffb4[_0x361d('0x24')]=qs[_0x361d('0x24')](_0x208b1f['query'][_0x361d('0x24')]);}_0x13ffb4['order']=qs[_0x361d('0x42')](_0x208b1f['query'][_0x361d('0x42')]);_0x13ffb4[_0x361d('0x43')]=qs[_0x361d('0x3b')](_[_0x361d('0x44')](_0x208b1f[_0x361d('0x39')],_0x3b251c['filters']));_0x13ffb4['raw']=!![];if(_0x208b1f[_0x361d('0x39')]['filter']){_0x13ffb4[_0x361d('0x43')]=_[_0x361d('0x46')](_0x13ffb4[_0x361d('0x43')],{'$or':_[_0x361d('0x35')](_0x13ffb4[_0x361d('0x3e')],function(_0x11b25e){var _0x53005b={};_0x53005b[_0x11b25e]={'$like':'%'+_0x208b1f[_0x361d('0x39')][_0x361d('0x45')]+'%'};return _0x53005b;})});}_0x13ffb4=_[_0x361d('0x46')]({},_0x13ffb4,_0x208b1f[_0x361d('0x48')]);return _0x1555a4[_0x361d('0x6c')](_0x13ffb4);}})[_0x361d('0x2e')](respondWithResult(_0x5dc533,null))[_0x361d('0x4b')](handleError(_0x5dc533,null));};exports[_0x361d('0x72')]=function(_0xad9f27,_0x488d2d,_0x3ec10f){var _0x1c4cd9;var _0xa676bc;var _0xa79710;var _0x2faafc=_0xad9f27[_0x361d('0x58')]['id'];csv_results=[];return db[_0x361d('0x73')][_0x361d('0x4a')]({'attributes':['id',_0x361d('0x33')],'raw':!![],'order':[_0x361d('0x74')]})[_0x361d('0x2e')](function(_0x2b2163){_0x1c4cd9=_0x2b2163;var _0x30b9ef=_[_0x361d('0x3a')](db[_0x361d('0x63')][_0x361d('0x37')]);return db['CmCustomField'][_0x361d('0x4a')]({'raw':!![],'attributes':['id',_0x361d('0x75')]})[_0x361d('0x2e')](function(_0x46f578){_0xa676bc=_0x46f578;var _0x43c8e2=squel['select']()[_0x361d('0x3f')](_0x30b9ef)[_0x361d('0x76')](_0x361d('0x77'),'c')[_0x361d('0x43')](_0x361d('0x78'),_0x2faafc)['where'](_0x361d('0x79'))[_0x361d('0x7a')]();for(var _0x2d1fbb=0x0;_0x2d1fbb<_0xa676bc[_0x361d('0x4d')];_0x2d1fbb++){_0x43c8e2['field']('c.cf_'+_0xa676bc[_0x2d1fbb]['id'],_0x361d('0x7b')+_0xa676bc[_0x2d1fbb][_0x361d('0x75')]);}for(var _0x2d1fbb=0x0;_0x2d1fbb<_0x1c4cd9['length'];_0x2d1fbb++){_0x43c8e2['field'](squel[_0x361d('0x7c')]()['field'](_0x361d('0x7d'))[_0x361d('0x76')](_0x361d('0x7e'))[_0x361d('0x43')]('ItemTypeId\x20=\x20?',_0x1c4cd9[_0x2d1fbb]['id'])[_0x361d('0x43')](_0x361d('0x7f')),_0x361d('0x80')+_0x1c4cd9[_0x2d1fbb][_0x361d('0x33')]);_0x43c8e2['field'](squel[_0x361d('0x7c')]()[_0x361d('0x81')](_0x361d('0x82'))[_0x361d('0x76')](_0x361d('0x7e'))[_0x361d('0x43')]('ItemTypeId\x20=\x20?',_0x1c4cd9[_0x2d1fbb]['id'])[_0x361d('0x43')](_0x361d('0x7f')),_0x361d('0x83')+_0x1c4cd9[_0x2d1fbb][_0x361d('0x33')]);}var _0x299acc=[];_0x299acc[_0x361d('0x69')](_0x43c8e2[_0x361d('0x84')]());BPromise[_0x361d('0x67')](_0x299acc,handleQuery)[_0x361d('0x2e')](function(_0x110e70){handleQuery(_0x43c8e2[_0x361d('0x84')]());var _0x436255=csv_results[0x0];if(!_['isEmpty'](_0x436255)){var _0x212595=toCsv(_0x436255);var _0x349259=Date['now']();fs[_0x361d('0x85')](util[_0x361d('0x70')](_0x361d('0x86'),_0x2faafc,_0x349259),_0x212595);_0x488d2d['setHeader'](_0x361d('0x87'),_0x361d('0x88')+util[_0x361d('0x70')](_0x361d('0x89'),_0x2faafc,_0x349259));_0x488d2d['setHeader'](_0x361d('0x8a'),_0x361d('0x8b'));return _0x488d2d[_0x361d('0x8c')](util[_0x361d('0x70')](_0x361d('0x86'),_0x2faafc,_0x349259));}else{return _0x488d2d[_0x361d('0x21')](0xcc);}});});});};exports['addCustomField']=function(_0x4916e9,_0x3defea,_0x4034d4){var _0x34284c;delete _0x4916e9['body']['id'];return db[_0x361d('0x36')][_0x361d('0x8d')]({'where':{'id':_0x4916e9[_0x361d('0x58')]['id']}})['then'](handleEntityNotFound(_0x3defea,null))[_0x361d('0x2e')](function(_0x4228fd){if(_0x4228fd){return db[_0x361d('0x8e')]['transaction'](function(_0x2bd1fd){return db[_0x361d('0x6d')]['create'](_0x4916e9['body'],{'transaction':_0x2bd1fd})[_0x361d('0x2e')](function(_0x41ba41){_0x34284c=_0x41ba41;return _0x4228fd['addCustomFields'](_0x41ba41,{'transaction':_0x2bd1fd});})[_0x361d('0x2e')](function(){var _0x346bf7={'type':db[_0x361d('0x8f')][_0x361d('0x90')],'transaction':_0x2bd1fd};switch(_0x4916e9[_0x361d('0x51')][_0x361d('0x38')]){case'text':_0x346bf7[_0x361d('0x38')]=db[_0x361d('0x8f')][_0x361d('0x90')];break;case'number':_0x346bf7[_0x361d('0x38')]=db['Sequelize'][_0x361d('0x91')];break;case _0x361d('0x92'):_0x346bf7[_0x361d('0x38')]=db[_0x361d('0x8f')]['BOOLEAN'];_0x346bf7[_0x361d('0x93')]=![];break;default:}return db[_0x361d('0x8e')]['queryInterface']['addColumn'](_0x361d('0x77'),util[_0x361d('0x70')]('cf_%s',_0x34284c['id']),_0x346bf7);})['then'](function(){return _0x34284c;});});}})[_0x361d('0x2e')](respondWithResult(_0x3defea,null))[_0x361d('0x4b')](handleError(_0x3defea,null));};exports[_0x361d('0x94')]=function(_0x2825a4,_0x5e482c,_0x4e9825){var _0x19fadf={};var _0x4488bf={};var _0x3900ff;var _0x421430;return db[_0x361d('0x36')][_0x361d('0x8d')]({'where':{'id':_0x2825a4[_0x361d('0x58')]['id']}})[_0x361d('0x2e')](handleEntityNotFound(_0x5e482c,null))[_0x361d('0x2e')](function(_0x2ce80c){if(_0x2ce80c){_0x3900ff=_0x2ce80c;_0x4488bf[_0x361d('0x3d')]=_['keys'](db[_0x361d('0x6d')]['rawAttributes']);_0x4488bf[_0x361d('0x39')]=_[_0x361d('0x3a')](_0x2825a4['query']);_0x4488bf[_0x361d('0x3b')]=_[_0x361d('0x3c')](_0x4488bf[_0x361d('0x3d')],_0x4488bf[_0x361d('0x39')]);_0x19fadf['attributes']=_[_0x361d('0x3c')](_0x4488bf['model'],qs['fields'](_0x2825a4[_0x361d('0x39')][_0x361d('0x3f')]));_0x19fadf[_0x361d('0x3e')]=_0x19fadf['attributes'][_0x361d('0x4d')]?_0x19fadf[_0x361d('0x3e')]:_0x4488bf['model'];_0x19fadf[_0x361d('0x5d')]=qs[_0x361d('0x42')](_0x2825a4[_0x361d('0x39')][_0x361d('0x42')]);_0x19fadf['where']=qs[_0x361d('0x3b')](_[_0x361d('0x44')](_0x2825a4[_0x361d('0x39')],_0x4488bf[_0x361d('0x3b')]));_0x19fadf[_0x361d('0x43')]=_[_0x361d('0x46')](_0x19fadf['where'],{'$or':[{'ListId':_0x2ce80c['id']},{'ListId':null}]});if(_0x2825a4[_0x361d('0x39')]['filter']){_0x19fadf[_0x361d('0x43')]=_[_0x361d('0x46')](_0x19fadf[_0x361d('0x43')],{'$or':_[_0x361d('0x35')](_0x19fadf[_0x361d('0x3e')],function(_0x4ece6f){var _0x31cbe4={};_0x31cbe4[_0x4ece6f]={'$like':'%'+_0x2825a4[_0x361d('0x39')][_0x361d('0x45')]+'%'};return _0x31cbe4;})});}_0x19fadf=_[_0x361d('0x46')]({},_0x19fadf,_0x2825a4[_0x361d('0x48')]);return db[_0x361d('0x6d')][_0x361d('0x95')](_0x19fadf);}})['then'](respondWithResult(_0x5e482c,null))['catch'](handleError(_0x5e482c,null));};exports[_0x361d('0x96')]=function(_0x31e469,_0x5bedca){return db[_0x361d('0x6d')][_0x361d('0x95')]({'where':{'ListId':null}})[_0x361d('0x2e')](handleEntityNotFound(_0x5bedca,null))[_0x361d('0x2e')](function(_0x4be1b1){return _0x4be1b1;})[_0x361d('0x2e')](respondWithResult(_0x5bedca,null))[_0x361d('0x4b')](handleError(_0x5bedca,null));};exports[_0x361d('0x97')]=function(_0x3752fa,_0x57aed8,_0xc859b1){return db[_0x361d('0x36')]['find']({'where':{'id':_0x3752fa['params']['id']}})['then'](handleEntityNotFound(_0x57aed8,null))[_0x361d('0x2e')](function(_0x193820){if(_0x193820){return _0x193820[_0x361d('0x97')](_0x3752fa[_0x361d('0x51')][_0x361d('0x61')],_[_0x361d('0x68')](_0x3752fa[_0x361d('0x51')],[_0x361d('0x61'),'id'])||{})[_0x361d('0x98')](function(_0x302c42){for(var _0x2044a4=0x0;_0x2044a4<_0x3752fa[_0x361d('0x51')][_0x361d('0x61')]['length'];_0x2044a4+=0x1){socket['emit'](_0x361d('0x99'),{'UserId':Number(_0x3752fa['body'][_0x361d('0x61')][_0x2044a4]),'CmListId':Number(_0x3752fa[_0x361d('0x58')]['id'])});}return _0x302c42;});}})[_0x361d('0x2e')](respondWithResult(_0x57aed8,null))[_0x361d('0x4b')](handleError(_0x57aed8,null));};exports[_0x361d('0x9a')]=function(_0x5cb595,_0xacbd6c,_0x277a49){return db[_0x361d('0x36')][_0x361d('0x4f')]({'where':{'id':_0x5cb595[_0x361d('0x58')]['id']}})[_0x361d('0x2e')](handleEntityNotFound(_0xacbd6c,null))[_0x361d('0x2e')](function(_0x29ceae){if(_0x29ceae){return _0x29ceae[_0x361d('0x9a')](_0x5cb595[_0x361d('0x39')][_0x361d('0x61')])[_0x361d('0x2e')](function(){if(_[_0x361d('0x66')](_0x5cb595[_0x361d('0x39')][_0x361d('0x61')])){for(var _0x285ff4=0x0;_0x285ff4<_0x5cb595['query']['ids'][_0x361d('0x4d')];_0x285ff4+=0x1){socket[_0x361d('0x9b')](_0x361d('0x9c'),{'UserId':Number(_0x5cb595[_0x361d('0x39')][_0x361d('0x61')][_0x285ff4]),'CmListId':Number(_0x5cb595[_0x361d('0x58')]['id'])});}}else{socket[_0x361d('0x9b')](_0x361d('0x9c'),{'UserId':Number(_0x5cb595[_0x361d('0x39')][_0x361d('0x61')]),'CmListId':Number(_0x5cb595[_0x361d('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0xacbd6c,null))[_0x361d('0x4b')](handleError(_0xacbd6c,null));};exports[_0x361d('0x9d')]=function(_0x63add7,_0x262aba,_0x37ef52){var _0x4910c2={};var _0xd9790e={};var _0x5df5d6;var _0x55f60f;return db[_0x361d('0x36')][_0x361d('0x8d')]({'where':{'id':_0x63add7[_0x361d('0x58')]['id']}})['then'](handleEntityNotFound(_0x262aba,null))[_0x361d('0x2e')](function(_0x4583fd){if(_0x4583fd){_0x5df5d6=_0x4583fd;_0xd9790e['model']=_[_0x361d('0x3a')](db[_0x361d('0x9e')][_0x361d('0x37')]);_0xd9790e[_0x361d('0x39')]=_[_0x361d('0x3a')](_0x63add7[_0x361d('0x39')]);_0xd9790e[_0x361d('0x3b')]=_[_0x361d('0x3c')](_0xd9790e['model'],_0xd9790e[_0x361d('0x39')]);_0x4910c2['attributes']=_[_0x361d('0x3c')](_0xd9790e[_0x361d('0x3d')],qs['fields'](_0x63add7['query'][_0x361d('0x3f')]));_0x4910c2['attributes']=_0x4910c2['attributes'][_0x361d('0x4d')]?_0x4910c2['attributes']:_0xd9790e[_0x361d('0x3d')];_0x4910c2[_0x361d('0x5d')]=qs[_0x361d('0x42')](_0x63add7[_0x361d('0x39')][_0x361d('0x42')]);_0x4910c2[_0x361d('0x43')]=qs[_0x361d('0x3b')](_[_0x361d('0x44')](_0x63add7[_0x361d('0x39')],_0xd9790e[_0x361d('0x3b')]));if(_0x63add7[_0x361d('0x39')]['filter']){_0x4910c2[_0x361d('0x43')]=_[_0x361d('0x46')](_0x4910c2[_0x361d('0x43')],{'$or':_[_0x361d('0x35')](_0x4910c2['attributes'],function(_0x4d73b6){var _0x5adc4a={};_0x5adc4a[_0x4d73b6]={'$like':'%'+_0x63add7[_0x361d('0x39')][_0x361d('0x45')]+'%'};return _0x5adc4a;})});}_0x4910c2=_[_0x361d('0x46')]({},_0x4910c2,_0x63add7['options']);return _0x5df5d6[_0x361d('0x9d')](_0x4910c2);}})[_0x361d('0x2e')](function(_0x23f90f){if(_0x23f90f){_0x55f60f=_0x23f90f[_0x361d('0x4d')];if(!_0x63add7[_0x361d('0x39')][_0x361d('0x40')](_0x361d('0x41'))){_0x4910c2[_0x361d('0x25')]=qs['limit'](_0x63add7[_0x361d('0x39')]['limit']);_0x4910c2['offset']=qs[_0x361d('0x24')](_0x63add7[_0x361d('0x39')][_0x361d('0x24')]);}return _0x5df5d6[_0x361d('0x9d')](_0x4910c2);}})[_0x361d('0x2e')](function(_0x3ff07e){if(_0x3ff07e){return _0x3ff07e?{'count':_0x55f60f,'rows':_0x3ff07e}:null;}})[_0x361d('0x2e')](respondWithResult(_0x262aba,null))[_0x361d('0x4b')](handleError(_0x262aba,null));};function handleQuery(_0x2b44b4){logger['info'](_0x2b44b4);return db[_0x361d('0x8e')][_0x361d('0x39')](_0x2b44b4)['spread'](function(_0xcf3626){csv_results[_0x361d('0x69')](_0xcf3626);})['catch'](function(_0x2a98d0){logger[_0x361d('0x31')](_0x2a98d0[_0x361d('0x9f')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 905c2aa..3edac98 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x55ca,0x126));var _0xa55c=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0x55ca[_0x36147b];return _0x141351;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x5d201,_0x4e81d9){_0x5d201=_0x5d201-0x0;var _0x2f1335=_0xe14b[_0x5d201];return _0x2f1335;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 146ca69..29ca305 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 _0xb4e6=['path','rimraf','./cmList.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xdad6db,_0x230e47){var _0x4a117c=function(_0x282693){while(--_0x282693){_0xdad6db['push'](_0xdad6db['shift']());}};_0x4a117c(++_0x230e47);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0xb4e6[_0xa28b1a];return _0x4c9b78;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x362deb,_0x59fa58){var _0xa9f9b0=function(_0x2c231c){while(--_0x2c231c){_0x362deb['push'](_0x362deb['shift']());}};_0xa9f9b0(++_0x59fa58);}(_0xac4a,0x13f));var _0xaac4=function(_0x5ad8a8,_0x3af725){_0x5ad8a8=_0x5ad8a8-0x0;var _0x2eb718=_0xac4a[_0x5ad8a8];return _0x2eb718;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 8977563..3e6daa9 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 _0x5369=['code','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x5369,0x12d));var _0x9536=function(_0x57af1e,_0x664fb9){_0x57af1e=_0x57af1e-0x0;var _0x165f34=_0x5369[_0x57af1e];return _0x165f34;};'use strict';var _=require(_0x9536('0x0'));var util=require(_0x9536('0x1'));var moment=require(_0x9536('0x2'));var BPromise=require(_0x9536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9536('0x4'));var db=require(_0x9536('0x5'))['db'];var utils=require(_0x9536('0x6'));var logger=require(_0x9536('0x7'))(_0x9536('0x8'));var config=require(_0x9536('0x9'));var jayson=require(_0x9536('0xa'));var client=jayson[_0x9536('0xb')]['http']({'port':0x232a});config[_0x9536('0xc')]=_['defaults'](config[_0x9536('0xc')],{'host':_0x9536('0xd'),'port':0x18eb});var socket=require(_0x9536('0xe'))(new Redis(config[_0x9536('0xc')]));require(_0x9536('0xf'))['register'](socket);function respondWithRpcPromise(_0x3380bf,_0xe7d69f,_0x1038e7){return new BPromise(function(_0x14be50,_0x2a6bcf){return client[_0x9536('0x10')](_0x3380bf,_0x1038e7)[_0x9536('0x11')](function(_0x12a997){logger[_0x9536('0x12')]('CmList,\x20%s,\x20%s',_0xe7d69f,'request\x20sent');logger['debug'](_0x9536('0x13'),_0xe7d69f,_0x9536('0x14'),JSON[_0x9536('0x15')](_0x12a997));if(_0x12a997['error']){if(_0x12a997[_0x9536('0x16')][_0x9536('0x17')]===0x1f4){logger['error'](_0x9536('0x18'),_0xe7d69f,_0x12a997[_0x9536('0x16')]['message']);return _0x2a6bcf(_0x12a997[_0x9536('0x16')][_0x9536('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0xe7d69f,_0x12a997[_0x9536('0x16')][_0x9536('0x19')]);return _0x14be50(_0x12a997[_0x9536('0x16')][_0x9536('0x19')]);}else{logger[_0x9536('0x12')]('CmList,\x20%s,\x20%s',_0xe7d69f,_0x9536('0x14'));_0x14be50(_0x12a997[_0x9536('0x1a')]['message']);}})['catch'](function(_0x11efff){logger[_0x9536('0x16')](_0x9536('0x18'),_0xe7d69f,_0x11efff);_0x2a6bcf(_0x11efff);});});} \ No newline at end of file +var _0xc807=['../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xd5c1f8,_0x3c6710){var _0x2f1285=function(_0x5d5aca){while(--_0x5d5aca){_0xd5c1f8['push'](_0xd5c1f8['shift']());}};_0x2f1285(++_0x3c6710);}(_0xc807,0x68));var _0x7c80=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc807[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7c80('0x0'));var util=require(_0x7c80('0x1'));var moment=require(_0x7c80('0x2'));var BPromise=require(_0x7c80('0x3'));var rs=require(_0x7c80('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c80('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c80('0x6'))(_0x7c80('0x7'));var config=require(_0x7c80('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c80('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7c80('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c80('0xb'))(new Redis(config[_0x7c80('0xa')]));require(_0x7c80('0xc'))[_0x7c80('0xd')](socket);function respondWithRpcPromise(_0x55f095,_0x2f12ef,_0x247d65){return new BPromise(function(_0x3b9f93,_0x3d8b8d){return client['request'](_0x55f095,_0x247d65)['then'](function(_0x18c6f4){logger[_0x7c80('0xe')](_0x7c80('0xf'),_0x2f12ef,_0x7c80('0x10'));logger[_0x7c80('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x2f12ef,'request\x20sent',JSON['stringify'](_0x18c6f4));if(_0x18c6f4['error']){if(_0x18c6f4[_0x7c80('0x12')][_0x7c80('0x13')]===0x1f4){logger[_0x7c80('0x12')](_0x7c80('0xf'),_0x2f12ef,_0x18c6f4[_0x7c80('0x12')][_0x7c80('0x14')]);return _0x3d8b8d(_0x18c6f4[_0x7c80('0x12')][_0x7c80('0x14')]);}logger['error'](_0x7c80('0xf'),_0x2f12ef,_0x18c6f4[_0x7c80('0x12')][_0x7c80('0x14')]);return _0x3b9f93(_0x18c6f4[_0x7c80('0x12')]['message']);}else{logger['info'](_0x7c80('0xf'),_0x2f12ef,_0x7c80('0x10'));_0x3b9f93(_0x18c6f4['result'][_0x7c80('0x14')]);}})[_0x7c80('0x15')](function(_0x4f812f){logger['error'](_0x7c80('0xf'),_0x2f12ef,_0x4f812f);_0x3d8b8d(_0x4f812f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 621cfe4..3cb5cf6 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 _0x12b6=['cmList:','./cmList.events','save','remove','update','removeListener','register'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x12b6,0x10b));var _0x612b=function(_0x1baff2,_0x2d3dac){_0x1baff2=_0x1baff2-0x0;var _0x1ffdfd=_0x12b6[_0x1baff2];return _0x1ffdfd;};'use strict';var CmListEvents=require(_0x612b('0x0'));var events=[_0x612b('0x1'),_0x612b('0x2'),_0x612b('0x3')];function createListener(_0x198b01,_0x223208){return function(_0x75f28a){_0x223208['emit'](_0x198b01,_0x75f28a);};}function removeListener(_0xafa662,_0x4b108f){return function(){CmListEvents[_0x612b('0x4')](_0xafa662,_0x4b108f);};}exports[_0x612b('0x5')]=function(_0x3bc5f7){for(var _0x482859=0x0,_0x3f0200=events['length'];_0x482859<_0x3f0200;_0x482859++){var _0x3fb463=events[_0x482859];var _0x9183ca=createListener(_0x612b('0x6')+_0x3fb463,_0x3bc5f7);CmListEvents['on'](_0x3fb463,_0x9183ca);}}; \ No newline at end of file +var _0x035d=['register','length','cmList:','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x36a06a,_0x34bfb7){var _0x45dcb0=function(_0x5a1edb){while(--_0x5a1edb){_0x36a06a['push'](_0x36a06a['shift']());}};_0x45dcb0(++_0x34bfb7);}(_0x035d,0x174));var _0xd035=function(_0x217fda,_0x248a69){_0x217fda=_0x217fda-0x0;var _0x25dcf5=_0x035d[_0x217fda];return _0x25dcf5;};'use strict';var CmListEvents=require(_0xd035('0x0'));var events=[_0xd035('0x1'),_0xd035('0x2'),_0xd035('0x3')];function createListener(_0x179976,_0x57f8bb){return function(_0x549ce1){_0x57f8bb[_0xd035('0x4')](_0x179976,_0x549ce1);};}function removeListener(_0x5bf888,_0xb4be75){return function(){CmListEvents[_0xd035('0x5')](_0x5bf888,_0xb4be75);};}exports[_0xd035('0x6')]=function(_0x5b9876){for(var _0x278668=0x0,_0x54c98b=events[_0xd035('0x7')];_0x278668<_0x54c98b;_0x278668++){var _0x1fdf16=events[_0x278668];var _0x1985a7=createListener(_0xd035('0x8')+_0x1fdf16,_0x5b9876);CmListEvents['on'](_0x1fdf16,_0x1985a7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c3c787c..8cc2001 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 _0xcb39=['post','create','addDisposition','/:id/contacts','/:id/fields','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./cmList.controller','isAuthenticated','index','get','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','getContactsCsv','/:id/users','getAgents'];(function(_0x49f88a,_0x5df0b9){var _0x543ea6=function(_0x2cf8b3){while(--_0x2cf8b3){_0x49f88a['push'](_0x49f88a['shift']());}};_0x543ea6(++_0x5df0b9);}(_0xcb39,0x76));var _0x9cb3=function(_0x24b3fd,_0x3d7922){_0x24b3fd=_0x24b3fd-0x0;var _0x5bebf4=_0xcb39[_0x24b3fd];return _0x5bebf4;};'use strict';var multer=require(_0x9cb3('0x0'));var util=require(_0x9cb3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9cb3('0x2'));var router=express[_0x9cb3('0x3')]();var fs_extra=require(_0x9cb3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9cb3('0x5'));var config=require('../../config/environment');var controller=require(_0x9cb3('0x6'));router['get']('/',auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x8')]);router[_0x9cb3('0x9')](_0x9cb3('0xa'),auth['isAuthenticated'](),controller[_0x9cb3('0xb')]);router[_0x9cb3('0x9')](_0x9cb3('0xc'),auth[_0x9cb3('0x7')](),controller[_0x9cb3('0xd')]);router['get'](_0x9cb3('0xe'),auth['isAuthenticated'](),controller[_0x9cb3('0xf')]);router['get'](_0x9cb3('0x10'),auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x11')]);router[_0x9cb3('0x9')]('/:id/contacts',auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x12')]);router[_0x9cb3('0x9')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x9cb3('0x13')]);router[_0x9cb3('0x9')]('/:id/fields',auth[_0x9cb3('0x7')](),controller['getCustomFields']);router[_0x9cb3('0x9')](_0x9cb3('0x14'),auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x15')]);router[_0x9cb3('0x16')]('/',auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x17')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9cb3('0x18')]);router[_0x9cb3('0x16')](_0x9cb3('0x19'),auth[_0x9cb3('0x7')](),controller['addContacts']);router[_0x9cb3('0x16')](_0x9cb3('0x1a'),auth[_0x9cb3('0x7')](),controller['addCustomField']);router['post'](_0x9cb3('0x14'),auth['isAuthenticated'](),controller[_0x9cb3('0x1b')]);router[_0x9cb3('0x1c')](_0x9cb3('0xe'),auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x1d')]);router[_0x9cb3('0x1e')](_0x9cb3('0xe'),auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x1f')]);router[_0x9cb3('0x1e')](_0x9cb3('0x10'),auth['isAuthenticated'](),controller[_0x9cb3('0x20')]);router[_0x9cb3('0x1e')](_0x9cb3('0x14'),auth[_0x9cb3('0x7')](),controller[_0x9cb3('0x21')]);module[_0x9cb3('0x22')]=router; \ No newline at end of file +var _0xee53=['put','delete','removeAgents','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents'];(function(_0x1db794,_0x13bc92){var _0x1940fc=function(_0x121631){while(--_0x121631){_0x1db794['push'](_0x1db794['shift']());}};_0x1940fc(++_0x13bc92);}(_0xee53,0xa8));var _0x3ee5=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xee53[_0x52684f];return _0x4a55f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3ee5('0x0'));var timeout=require(_0x3ee5('0x1'));var express=require(_0x3ee5('0x2'));var router=express['Router']();var fs_extra=require(_0x3ee5('0x3'));var auth=require(_0x3ee5('0x4'));var interaction=require(_0x3ee5('0x5'));var config=require(_0x3ee5('0x6'));var controller=require(_0x3ee5('0x7'));router[_0x3ee5('0x8')]('/',auth[_0x3ee5('0x9')](),controller[_0x3ee5('0xa')]);router[_0x3ee5('0x8')](_0x3ee5('0xb'),auth[_0x3ee5('0x9')](),controller[_0x3ee5('0xc')]);router[_0x3ee5('0x8')]('/global_fields',auth[_0x3ee5('0x9')](),controller[_0x3ee5('0xd')]);router[_0x3ee5('0x8')](_0x3ee5('0xe'),auth['isAuthenticated'](),controller[_0x3ee5('0xf')]);router[_0x3ee5('0x8')](_0x3ee5('0x10'),auth[_0x3ee5('0x9')](),controller['getDispositions']);router[_0x3ee5('0x8')](_0x3ee5('0x11'),auth['isAuthenticated'](),controller[_0x3ee5('0x12')]);router['get'](_0x3ee5('0x13'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x3ee5('0x8')](_0x3ee5('0x14'),auth[_0x3ee5('0x9')](),controller[_0x3ee5('0x15')]);router[_0x3ee5('0x8')](_0x3ee5('0x16'),auth[_0x3ee5('0x9')](),controller[_0x3ee5('0x17')]);router[_0x3ee5('0x18')]('/',auth['isAuthenticated'](),controller[_0x3ee5('0x19')]);router['post'](_0x3ee5('0x10'),auth[_0x3ee5('0x9')](),controller[_0x3ee5('0x1a')]);router[_0x3ee5('0x18')](_0x3ee5('0x11'),auth[_0x3ee5('0x9')](),controller[_0x3ee5('0x1b')]);router['post'](_0x3ee5('0x14'),auth[_0x3ee5('0x9')](),controller[_0x3ee5('0x1c')]);router[_0x3ee5('0x18')]('/:id/users',auth[_0x3ee5('0x9')](),controller[_0x3ee5('0x1d')]);router[_0x3ee5('0x1e')](_0x3ee5('0xe'),auth[_0x3ee5('0x9')](),controller['update']);router[_0x3ee5('0x1f')](_0x3ee5('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x3ee5('0x1f')](_0x3ee5('0x10'),auth[_0x3ee5('0x9')](),controller['removeDispositions']);router[_0x3ee5('0x1f')]('/:id/users',auth[_0x3ee5('0x9')](),controller[_0x3ee5('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 95d1437..cf260ec 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 _0xc655=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0xc655,0xe3));var _0x5c65=function(_0x30239e,_0x18670f){_0x30239e=_0x30239e-0x0;var _0x23fb12=_0xc655[_0x30239e];return _0x23fb12;};'use strict';var Sequelize=require('sequelize');module[_0x5c65('0x0')]={'name':{'type':Sequelize[_0x5c65('0x1')],'get':function(_0x5a10d5){return this[_0x5c65('0x2')](_0x5c65('0x3'));}},'field':{'type':Sequelize[_0x5c65('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x5c65('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x5c65('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x6a73=['VIRTUAL','getDataValue','STRING','exports'];(function(_0x36afe0,_0x57a5d9){var _0xdd93ba=function(_0x189b90){while(--_0x189b90){_0x36afe0['push'](_0x36afe0['shift']());}};_0xdd93ba(++_0x57a5d9);}(_0x6a73,0xe3));var _0x36a7=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x6a73[_0x3df871];return _0x570f7b;};'use strict';var Sequelize=require('sequelize');module[_0x36a7('0x0')]={'name':{'type':Sequelize[_0x36a7('0x1')],'get':function(_0x316066){return this[_0x36a7('0x2')]('field');}},'field':{'type':Sequelize[_0x36a7('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x36a7('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x36a7('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index f493cdb..5cc1ff6 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x3d187e,_0x629d4b){var _0x444629=function(_0x441f23){while(--_0x441f23){_0x3d187e['push'](_0x3d187e['shift']());}};_0x444629(++_0x629d4b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x50a6f2,_0x18cabd){var _0x112c5e=function(_0x2a19bb){while(--_0x2a19bb){_0x50a6f2['push'](_0x50a6f2['shift']());}};_0x112c5e(++_0x18cabd);}(_0x7a54,0x106));var _0x47a5=function(_0xe59b6f,_0x2d7153){_0xe59b6f=_0xe59b6f-0x0;var _0x4a9cd7=_0x7a54[_0xe59b6f];return _0x4a9cd7;};'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 31e9218..d099708 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 _0xf465=['request-promise','../../config/environment','exports','define','tools_conditions','lodash','util','../../config/logger','bluebird'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xf465,0x10a));var _0x5f46=function(_0xec8c53,_0x33ab0d){_0xec8c53=_0xec8c53-0x0;var _0x3412f6=_0xf465[_0xec8c53];return _0x3412f6;};'use strict';var _=require(_0x5f46('0x0'));var util=require(_0x5f46('0x1'));var logger=require(_0x5f46('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5f46('0x3'));var rp=require(_0x5f46('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5f46('0x5'));var attributes=require('./condition.attributes');module[_0x5f46('0x6')]=function(_0x4854b,_0x3b936f){return _0x4854b[_0x5f46('0x7')]('Condition',attributes,{'tableName':_0x5f46('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd56=['exports','define','Condition','../../config/logger','bluebird','request-promise','rimraf','./condition.attributes'];(function(_0xd6d2a6,_0x2791da){var _0x476c3a=function(_0x501d52){while(--_0x501d52){_0xd6d2a6['push'](_0xd6d2a6['shift']());}};_0x476c3a(++_0x2791da);}(_0xfd56,0x14b));var _0x6fd5=function(_0x469adb,_0x341925){_0x469adb=_0x469adb-0x0;var _0x21a3a8=_0xfd56[_0x469adb];return _0x21a3a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6fd5('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6fd5('0x1'));var rp=require(_0x6fd5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fd5('0x3'));var config=require('../../config/environment');var attributes=require(_0x6fd5('0x4'));module[_0x6fd5('0x5')]=function(_0x4e5496,_0x364835){return _0x4e5496[_0x6fd5('0x6')](_0x6fd5('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 54f6797..c57d2b7 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 _0xa815=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x42cbf3,_0x27a08c){var _0x51bcd7=function(_0x1b506e){while(--_0x1b506e){_0x42cbf3['push'](_0x42cbf3['shift']());}};_0x51bcd7(++_0x27a08c);}(_0xa815,0x90));var _0x5a81=function(_0x74d12d,_0x1970a1){_0x74d12d=_0x74d12d-0x0;var _0x325250=_0xa815[_0x74d12d];return _0x325250;};'use strict';var _=require(_0x5a81('0x0'));var util=require(_0x5a81('0x1'));var moment=require(_0x5a81('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a81('0x3'))['db'];var utils=require(_0x5a81('0x4'));var logger=require('../../config/logger')(_0x5a81('0x5'));var config=require(_0x5a81('0x6'));var jayson=require(_0x5a81('0x7'));var client=jayson[_0x5a81('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd40f5f,_0xe8ce47,_0x37f041){return new BPromise(function(_0x2b867b,_0x3c6d35){return client[_0x5a81('0x9')](_0xd40f5f,_0x37f041)[_0x5a81('0xa')](function(_0x1af830){logger[_0x5a81('0xb')](_0x5a81('0xc'),_0xe8ce47,_0x5a81('0xd'));logger[_0x5a81('0xe')](_0x5a81('0xf'),_0xe8ce47,_0x5a81('0xd'),JSON['stringify'](_0x1af830));if(_0x1af830[_0x5a81('0x10')]){if(_0x1af830[_0x5a81('0x10')][_0x5a81('0x11')]===0x1f4){logger[_0x5a81('0x10')](_0x5a81('0xc'),_0xe8ce47,_0x1af830[_0x5a81('0x10')][_0x5a81('0x12')]);return _0x3c6d35(_0x1af830['error'][_0x5a81('0x12')]);}logger[_0x5a81('0x10')](_0x5a81('0xc'),_0xe8ce47,_0x1af830[_0x5a81('0x10')]['message']);return _0x2b867b(_0x1af830[_0x5a81('0x10')][_0x5a81('0x12')]);}else{logger['info'](_0x5a81('0xc'),_0xe8ce47,_0x5a81('0xd'));_0x2b867b(_0x1af830[_0x5a81('0x13')]['message']);}})[_0x5a81('0x14')](function(_0x29701a){logger[_0x5a81('0x10')](_0x5a81('0xc'),_0xe8ce47,_0x29701a);_0x3c6d35(_0x29701a);});});} \ No newline at end of file +var _0xdb14=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xdb14,0x14a));var _0x4db1=function(_0xa2f063,_0x4b72d3){_0xa2f063=_0xa2f063-0x0;var _0x17e6d5=_0xdb14[_0xa2f063];return _0x17e6d5;};'use strict';var _=require(_0x4db1('0x0'));var util=require(_0x4db1('0x1'));var moment=require('moment');var BPromise=require(_0x4db1('0x2'));var rs=require(_0x4db1('0x3'));var fs=require('fs');var Redis=require(_0x4db1('0x4'));var db=require(_0x4db1('0x5'))['db'];var utils=require(_0x4db1('0x6'));var logger=require(_0x4db1('0x7'))(_0x4db1('0x8'));var config=require(_0x4db1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4db1('0xa')][_0x4db1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb87c21,_0x3af51d,_0x23c1f3){return new BPromise(function(_0x548373,_0x2883b3){return client['request'](_0xb87c21,_0x23c1f3)['then'](function(_0x455efa){logger['info'](_0x4db1('0xc'),_0x3af51d,'request\x20sent');logger[_0x4db1('0xd')](_0x4db1('0xe'),_0x3af51d,_0x4db1('0xf'),JSON[_0x4db1('0x10')](_0x455efa));if(_0x455efa[_0x4db1('0x11')]){if(_0x455efa[_0x4db1('0x11')][_0x4db1('0x12')]===0x1f4){logger[_0x4db1('0x11')](_0x4db1('0xc'),_0x3af51d,_0x455efa[_0x4db1('0x11')]['message']);return _0x2883b3(_0x455efa[_0x4db1('0x11')]['message']);}logger['error'](_0x4db1('0xc'),_0x3af51d,_0x455efa[_0x4db1('0x11')][_0x4db1('0x13')]);return _0x548373(_0x455efa[_0x4db1('0x11')][_0x4db1('0x13')]);}else{logger[_0x4db1('0x14')](_0x4db1('0xc'),_0x3af51d,_0x4db1('0xf'));_0x548373(_0x455efa[_0x4db1('0x15')]['message']);}})['catch'](function(_0x434d11){logger[_0x4db1('0x11')](_0x4db1('0xc'),_0x3af51d,_0x434d11);_0x2883b3(_0x434d11);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9642b80..68c5338 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 _0x4012=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x43ac17,_0x136057){var _0x44ee42=function(_0x1adf5d){while(--_0x1adf5d){_0x43ac17['push'](_0x43ac17['shift']());}};_0x44ee42(++_0x136057);}(_0x4012,0x17c));var _0x2401=function(_0x3b7e99,_0x4aa267){_0x3b7e99=_0x3b7e99-0x0;var _0x5162a5=_0x4012[_0x3b7e99];return _0x5162a5;};'use strict';var multer=require(_0x2401('0x0'));var util=require('util');var path=require(_0x2401('0x1'));var timeout=require('connect-timeout');var express=require(_0x2401('0x2'));var router=express[_0x2401('0x3')]();var fs_extra=require(_0x2401('0x4'));var auth=require(_0x2401('0x5'));var interaction=require(_0x2401('0x6'));var config=require(_0x2401('0x7'));var controller=require(_0x2401('0x8'));router[_0x2401('0x9')](_0x2401('0xa'),auth[_0x2401('0xb')](),controller[_0x2401('0xc')]);router[_0x2401('0xd')](_0x2401('0xa'),auth[_0x2401('0xb')](),controller[_0x2401('0xe')]);module[_0x2401('0xf')]=router; \ No newline at end of file +var _0x0873=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id'];(function(_0x31c80e,_0x29d87d){var _0x44fb02=function(_0x4995a4){while(--_0x4995a4){_0x31c80e['push'](_0x31c80e['shift']());}};_0x44fb02(++_0x29d87d);}(_0x0873,0x153));var _0x3087=function(_0x1c8020,_0x5415a1){_0x1c8020=_0x1c8020-0x0;var _0x4ff50d=_0x0873[_0x1c8020];return _0x4ff50d;};'use strict';var multer=require(_0x3087('0x0'));var util=require(_0x3087('0x1'));var path=require(_0x3087('0x2'));var timeout=require(_0x3087('0x3'));var express=require(_0x3087('0x4'));var router=express['Router']();var fs_extra=require(_0x3087('0x5'));var auth=require(_0x3087('0x6'));var interaction=require(_0x3087('0x7'));var config=require(_0x3087('0x8'));var controller=require(_0x3087('0x9'));router['put'](_0x3087('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x3087('0xb')](_0x3087('0xa'),auth['isAuthenticated'](),controller[_0x3087('0xc')]);module[_0x3087('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 33ef4eb..c81577b 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 _0x8b9e=['name','INTEGER','STRING'];(function(_0x534692,_0x471eb2){var _0x41239e=function(_0xb7e995){while(--_0xb7e995){_0x534692['push'](_0x534692['shift']());}};_0x41239e(++_0x471eb2);}(_0x8b9e,0x137));var _0xe8b9=function(_0x352c0d,_0x2557c2){_0x352c0d=_0x352c0d-0x0;var _0x134912=_0x8b9e[_0x352c0d];return _0x134912;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe8b9('0x0')],'allowNull':![],'unique':_0xe8b9('0x1')},'OrderBy':{'type':Sequelize[_0xe8b9('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe8b9('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x8164=['sequelize','exports','STRING','INTEGER'];(function(_0x2f2764,_0x4917a8){var _0x38cf30=function(_0x176491){while(--_0x176491){_0x2f2764['push'](_0x2f2764['shift']());}};_0x38cf30(++_0x4917a8);}(_0x8164,0x170));var _0x4816=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0x8164[_0x4df6f9];return _0x4b1a73;};'use strict';var Sequelize=require(_0x4816('0x0'));module[_0x4816('0x1')]={'name':{'type':Sequelize[_0x4816('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x4816('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4816('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 8d04509..fe85acf 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 _0x6d11=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x20961b,_0x121bba){var _0x48ad1c=function(_0xe59db4){while(--_0xe59db4){_0x20961b['push'](_0x20961b['shift']());}};_0x48ad1c(++_0x121bba);}(_0x6d11,0xbf));var _0x16d1=function(_0x3c144b,_0x54557c){_0x3c144b=_0x3c144b-0x0;var _0x259d26=_0x6d11[_0x3c144b];return _0x259d26;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){var _0x21e122=_0x215c23[_0x16d1('0x24')]({'plain':!![]});var _0x335c24=_0x16d1('0x25');return db[_0x16d1('0x26')][_0x16d1('0x23')]({'where':{'type':_0x335c24,'resourceId':_0x21e122['id']}})[_0x16d1('0x22')](function(){return _0x215c23;});})[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae4e,_0x440a47){return function(_0x4257f1){if(!_0x4257f1){_0x25ae4e['sendStatus'](0x194);}return _0x4257f1;};}function handleError(_0x28837c,_0x1deb1e){_0x1deb1e=_0x1deb1e||0x1f4;return function(_0x364bf7){logger[_0x16d1('0x27')](_0x364bf7[_0x16d1('0x28')]);if(_0x364bf7[_0x16d1('0x29')]){delete _0x364bf7[_0x16d1('0x29')];}_0x28837c['status'](_0x1deb1e)[_0x16d1('0x2a')](_0x364bf7);};}exports[_0x16d1('0x2b')]=function(_0x31c4e9,_0x30cd8f){var _0x55c021={},_0x4b27f6={},_0x2f16ee={'count':0x0,'rows':[]};var _0x4ab3d4=_[_0x16d1('0x2c')](db[_0x16d1('0x2d')][_0x16d1('0x2e')],function(_0x2b4dbd){return{'name':_0x2b4dbd[_0x16d1('0x2f')],'type':_0x2b4dbd[_0x16d1('0x30')][_0x16d1('0x31')]};});_0x4b27f6[_0x16d1('0x32')]=_[_0x16d1('0x2c')](_0x4ab3d4,_0x16d1('0x29'));_0x4b27f6[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x31c4e9['query']);_0x4b27f6[_0x16d1('0x35')]=_['intersection'](_0x4b27f6[_0x16d1('0x32')],_0x4b27f6[_0x16d1('0x33')]);_0x55c021[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x4b27f6[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x31c4e9['query']['fields']));_0x55c021['attributes']=_0x55c021[_0x16d1('0x36')][_0x16d1('0x39')]?_0x55c021[_0x16d1('0x36')]:_0x4b27f6[_0x16d1('0x32')];if(!_0x31c4e9['query'][_0x16d1('0x3a')](_0x16d1('0x3b'))){_0x55c021['limit']=qs['limit'](_0x31c4e9['query'][_0x16d1('0x1f')]);_0x55c021[_0x16d1('0x1d')]=qs[_0x16d1('0x1d')](_0x31c4e9['query'][_0x16d1('0x1d')]);}_0x55c021[_0x16d1('0x3c')]=qs[_0x16d1('0x3d')](_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3d')]);_0x55c021[_0x16d1('0x3e')]=qs[_0x16d1('0x35')](_['pick'](_0x31c4e9['query'],_0x4b27f6['filters']),_0x4ab3d4);if(_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3f')]){_0x55c021[_0x16d1('0x3e')]=_[_0x16d1('0x40')](_0x55c021[_0x16d1('0x3e')],{'$or':_[_0x16d1('0x2c')](_0x4ab3d4,function(_0x364c39){if(_0x364c39[_0x16d1('0x30')]!=='VIRTUAL'){var _0x180f55={};_0x180f55[_0x364c39['name']]={'$like':'%'+_0x31c4e9['query'][_0x16d1('0x3f')]+'%'};return _0x180f55;}})});}_0x55c021=_[_0x16d1('0x40')]({},_0x55c021,_0x31c4e9[_0x16d1('0x41')]);var _0x3a0343={'where':_0x55c021[_0x16d1('0x3e')]};return db[_0x16d1('0x2d')]['count'](_0x3a0343)[_0x16d1('0x22')](function(_0x525212){_0x2f16ee['count']=_0x525212;if(_0x31c4e9['query']['includeAll']){_0x55c021[_0x16d1('0x42')]=[{'all':!![]}];}return db[_0x16d1('0x2d')][_0x16d1('0x43')](_0x55c021);})[_0x16d1('0x22')](function(_0x53de06){_0x2f16ee[_0x16d1('0x44')]=_0x53de06;return _0x2f16ee;})['then'](respondWithFilteredResult(_0x30cd8f,_0x55c021))[_0x16d1('0x45')](handleError(_0x30cd8f,null));};exports[_0x16d1('0x46')]=function(_0x19ac7c,_0x2e4971){var _0x1a109d={'raw':!![],'where':{'id':_0x19ac7c[_0x16d1('0x47')]['id']}},_0x116f51={};_0x116f51[_0x16d1('0x32')]=_[_0x16d1('0x34')](db[_0x16d1('0x2d')][_0x16d1('0x2e')]);_0x116f51[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x19ac7c[_0x16d1('0x33')]);_0x116f51[_0x16d1('0x35')]=_['intersection'](_0x116f51['model'],_0x116f51[_0x16d1('0x33')]);_0x1a109d[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x116f51[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x19ac7c[_0x16d1('0x33')]['fields']));_0x1a109d[_0x16d1('0x36')]=_0x1a109d[_0x16d1('0x36')][_0x16d1('0x39')]?_0x1a109d['attributes']:_0x116f51['model'];if(_0x19ac7c[_0x16d1('0x33')][_0x16d1('0x48')]){_0x1a109d['include']=[{'all':!![]}];}_0x1a109d=_[_0x16d1('0x40')]({},_0x1a109d,_0x19ac7c['options']);return db[_0x16d1('0x2d')][_0x16d1('0x49')](_0x1a109d)[_0x16d1('0x22')](handleEntityNotFound(_0x2e4971,null))[_0x16d1('0x22')](respondWithResult(_0x2e4971,null))['catch'](handleError(_0x2e4971,null));};exports['create']=function(_0x1d92cd,_0x8bb0c1){return db['ContactItemType'][_0x16d1('0x4a')](_0x1d92cd[_0x16d1('0x4b')],{})[_0x16d1('0x22')](function(_0x117da5){var _0x3b77db=_0x1d92cd['user'][_0x16d1('0x24')]({'plain':!![]});if(!_0x3b77db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b77db[_0x16d1('0x4c')]===_0x16d1('0x4d')){var _0x5d384c=_0x117da5[_0x16d1('0x24')]({'plain':!![]});var _0xd3a7f8=_0x16d1('0x25');return db[_0x16d1('0x4e')]['find']({'where':{'name':_0xd3a7f8,'userProfileId':_0x3b77db['userProfileId']},'raw':!![]})['then'](function(_0x34e266){if(_0x34e266&&_0x34e266[_0x16d1('0x4f')]===0x0){return db[_0x16d1('0x26')][_0x16d1('0x4a')]({'name':_0x5d384c['name'],'resourceId':_0x5d384c['id'],'type':_0x34e266[_0x16d1('0x29')],'sectionId':_0x34e266['id']},{})[_0x16d1('0x22')](function(){return _0x117da5;});}else{return _0x117da5;}})['catch'](function(_0x1e1bbc){logger[_0x16d1('0x27')](_0x16d1('0x50'),_0x1e1bbc);throw _0x1e1bbc;});}return _0x117da5;})[_0x16d1('0x22')](respondWithResult(_0x8bb0c1,0xc9))['catch'](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x51')]=function(_0x2b0aa7,_0xb9fb43){if(_0x2b0aa7['body']['id']){delete _0x2b0aa7['body']['id'];}return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x2b0aa7['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0xb9fb43,null))[_0x16d1('0x22')](saveUpdates(_0x2b0aa7[_0x16d1('0x4b')],null))['then'](respondWithResult(_0xb9fb43,null))[_0x16d1('0x45')](handleError(_0xb9fb43,null));};exports[_0x16d1('0x23')]=function(_0x11209f,_0x4b3079){return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x11209f['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x4b3079,null))[_0x16d1('0x22')](db['CmContactHasItem'][_0x16d1('0x51')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x11209f[_0x16d1('0x47')]['id']}}))[_0x16d1('0x22')](removeEntity(_0x4b3079,null))[_0x16d1('0x45')](handleError(_0x4b3079,null));}; \ No newline at end of file +var _0x1a37=['includeAll','include','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1a37,0xb4));var _0x71a3=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x1a37[_0x2fc012];return _0x2891f9;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){var _0xb9c195=_0x5f33c5[_0x71a3('0x26')]({'plain':!![]});var _0xb0f3aa='ContactItemTypes';return db[_0x71a3('0x27')][_0x71a3('0x25')]({'where':{'type':_0xb0f3aa,'resourceId':_0xb9c195['id']}})['then'](function(){return _0x5f33c5;});})[_0x71a3('0x24')](function(){_0x452bc4['status'](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0x2fd3b6,_0x211ea8){return function(_0x35b5c7){if(!_0x35b5c7){_0x2fd3b6[_0x71a3('0x18')](0x194);}return _0x35b5c7;};}function handleError(_0x314439,_0x2317ec){_0x2317ec=_0x2317ec||0x1f4;return function(_0x242b85){logger[_0x71a3('0x28')](_0x242b85[_0x71a3('0x29')]);if(_0x242b85[_0x71a3('0x2a')]){delete _0x242b85[_0x71a3('0x2a')];}_0x314439['status'](_0x2317ec)[_0x71a3('0x2b')](_0x242b85);};}exports[_0x71a3('0x2c')]=function(_0x334db0,_0x23ae85){var _0x4a750c={},_0x18a8fe={},_0x216d84={'count':0x0,'rows':[]};var _0x45d13d=_[_0x71a3('0x2d')](db[_0x71a3('0x2e')][_0x71a3('0x2f')],function(_0x1d09bd){return{'name':_0x1d09bd['fieldName'],'type':_0x1d09bd[_0x71a3('0x30')][_0x71a3('0x31')]};});_0x18a8fe[_0x71a3('0x32')]=_[_0x71a3('0x2d')](_0x45d13d,_0x71a3('0x2a'));_0x18a8fe[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x334db0[_0x71a3('0x33')]);_0x18a8fe[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x18a8fe[_0x71a3('0x32')],_0x18a8fe[_0x71a3('0x33')]);_0x4a750c[_0x71a3('0x37')]=_['intersection'](_0x18a8fe['model'],qs[_0x71a3('0x38')](_0x334db0[_0x71a3('0x33')]['fields']));_0x4a750c[_0x71a3('0x37')]=_0x4a750c[_0x71a3('0x37')]['length']?_0x4a750c[_0x71a3('0x37')]:_0x18a8fe[_0x71a3('0x32')];if(!_0x334db0[_0x71a3('0x33')][_0x71a3('0x39')](_0x71a3('0x3a'))){_0x4a750c[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x334db0['query'][_0x71a3('0x1d')]);_0x4a750c[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x334db0['query'][_0x71a3('0x1b')]);}_0x4a750c[_0x71a3('0x3b')]=qs[_0x71a3('0x3c')](_0x334db0[_0x71a3('0x33')][_0x71a3('0x3c')]);_0x4a750c['where']=qs['filters'](_[_0x71a3('0x3d')](_0x334db0[_0x71a3('0x33')],_0x18a8fe[_0x71a3('0x35')]),_0x45d13d);if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]){_0x4a750c['where']=_[_0x71a3('0x3f')](_0x4a750c[_0x71a3('0x40')],{'$or':_[_0x71a3('0x2d')](_0x45d13d,function(_0x58b833){if(_0x58b833[_0x71a3('0x30')]!=='VIRTUAL'){var _0x3edeff={};_0x3edeff[_0x58b833[_0x71a3('0x2a')]]={'$like':'%'+_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]+'%'};return _0x3edeff;}})});}_0x4a750c=_[_0x71a3('0x3f')]({},_0x4a750c,_0x334db0[_0x71a3('0x41')]);var _0x468ca4={'where':_0x4a750c[_0x71a3('0x40')]};return db[_0x71a3('0x2e')][_0x71a3('0x1e')](_0x468ca4)['then'](function(_0xa49846){_0x216d84['count']=_0xa49846;if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x42')]){_0x4a750c[_0x71a3('0x43')]=[{'all':!![]}];}return db[_0x71a3('0x2e')]['findAll'](_0x4a750c);})[_0x71a3('0x24')](function(_0x4b4fde){_0x216d84['rows']=_0x4b4fde;return _0x216d84;})[_0x71a3('0x24')](respondWithFilteredResult(_0x23ae85,_0x4a750c))[_0x71a3('0x44')](handleError(_0x23ae85,null));};exports[_0x71a3('0x45')]=function(_0x1dc34b,_0x519242){var _0x248a04={'raw':!![],'where':{'id':_0x1dc34b[_0x71a3('0x46')]['id']}},_0x615c6f={};_0x615c6f[_0x71a3('0x32')]=_[_0x71a3('0x34')](db[_0x71a3('0x2e')][_0x71a3('0x2f')]);_0x615c6f[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x1dc34b[_0x71a3('0x33')]);_0x615c6f[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x615c6f[_0x71a3('0x32')],_0x615c6f[_0x71a3('0x33')]);_0x248a04[_0x71a3('0x37')]=_[_0x71a3('0x36')](_0x615c6f['model'],qs[_0x71a3('0x38')](_0x1dc34b[_0x71a3('0x33')]['fields']));_0x248a04[_0x71a3('0x37')]=_0x248a04[_0x71a3('0x37')][_0x71a3('0x47')]?_0x248a04[_0x71a3('0x37')]:_0x615c6f[_0x71a3('0x32')];if(_0x1dc34b['query']['includeAll']){_0x248a04[_0x71a3('0x43')]=[{'all':!![]}];}_0x248a04=_[_0x71a3('0x3f')]({},_0x248a04,_0x1dc34b['options']);return db[_0x71a3('0x2e')][_0x71a3('0x48')](_0x248a04)[_0x71a3('0x24')](handleEntityNotFound(_0x519242,null))[_0x71a3('0x24')](respondWithResult(_0x519242,null))[_0x71a3('0x44')](handleError(_0x519242,null));};exports[_0x71a3('0x49')]=function(_0x501a62,_0x1c9ba6){return db['ContactItemType'][_0x71a3('0x49')](_0x501a62[_0x71a3('0x4a')],{})[_0x71a3('0x24')](function(_0x2f3f19){var _0x32e313=_0x501a62['user'][_0x71a3('0x26')]({'plain':!![]});if(!_0x32e313)throw new Error(_0x71a3('0x4b'));if(_0x32e313[_0x71a3('0x4c')]==='user'){var _0x6c34=_0x2f3f19['get']({'plain':!![]});var _0x278e11=_0x71a3('0x4d');return db['UserProfileSection'][_0x71a3('0x48')]({'where':{'name':_0x278e11,'userProfileId':_0x32e313[_0x71a3('0x4e')]},'raw':!![]})[_0x71a3('0x24')](function(_0x384f38){if(_0x384f38&&_0x384f38[_0x71a3('0x4f')]===0x0){return db[_0x71a3('0x27')][_0x71a3('0x49')]({'name':_0x6c34['name'],'resourceId':_0x6c34['id'],'type':_0x384f38[_0x71a3('0x2a')],'sectionId':_0x384f38['id']},{})['then'](function(){return _0x2f3f19;});}else{return _0x2f3f19;}})[_0x71a3('0x44')](function(_0x480e90){logger[_0x71a3('0x28')](_0x71a3('0x50'),_0x480e90);throw _0x480e90;});}return _0x2f3f19;})[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,0xc9))[_0x71a3('0x44')](handleError(_0x1c9ba6,null));};exports['update']=function(_0x54b80f,_0x1e13ae){if(_0x54b80f[_0x71a3('0x4a')]['id']){delete _0x54b80f[_0x71a3('0x4a')]['id'];}return db[_0x71a3('0x2e')]['find']({'where':{'id':_0x54b80f['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1e13ae,null))[_0x71a3('0x24')](saveUpdates(_0x54b80f[_0x71a3('0x4a')],null))[_0x71a3('0x24')](respondWithResult(_0x1e13ae,null))[_0x71a3('0x44')](handleError(_0x1e13ae,null));};exports['destroy']=function(_0x421b6a,_0x3379cb){return db[_0x71a3('0x2e')][_0x71a3('0x48')]({'where':{'id':_0x421b6a[_0x71a3('0x46')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x3379cb,null))[_0x71a3('0x24')](db[_0x71a3('0x51')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x421b6a[_0x71a3('0x46')]['id']}}))[_0x71a3('0x24')](removeEntity(_0x3379cb,null))[_0x71a3('0x44')](handleError(_0x3379cb,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2b593fe..bf27351 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 _0x43c3=['request-promise','path','../../config/environment','./contactItemType.attributes','tools_contact_item_types','lodash','util','api'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x43c3,0x10d));var _0x343c=function(_0x29cace,_0x3d1d88){_0x29cace=_0x29cace-0x0;var _0x34c5bf=_0x43c3[_0x29cace];return _0x34c5bf;};'use strict';var _=require(_0x343c('0x0'));var util=require(_0x343c('0x1'));var logger=require('../../config/logger')(_0x343c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x343c('0x3'));var fs=require('fs');var path=require(_0x343c('0x4'));var rimraf=require('rimraf');var config=require(_0x343c('0x5'));var attributes=require(_0x343c('0x6'));module['exports']=function(_0x58ab91,_0x4596e0){return _0x58ab91['define']('ContactItemType',attributes,{'tableName':_0x343c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37b7=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types'];(function(_0x483403,_0x23b5d4){var _0x53b060=function(_0x52ffbb){while(--_0x52ffbb){_0x483403['push'](_0x483403['shift']());}};_0x53b060(++_0x23b5d4);}(_0x37b7,0x142));var _0x737b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x37b7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x737b('0x0'));var util=require('util');var logger=require(_0x737b('0x1'))(_0x737b('0x2'));var moment=require(_0x737b('0x3'));var BPromise=require(_0x737b('0x4'));var rp=require(_0x737b('0x5'));var fs=require('fs');var path=require(_0x737b('0x6'));var rimraf=require(_0x737b('0x7'));var config=require(_0x737b('0x8'));var attributes=require(_0x737b('0x9'));module[_0x737b('0xa')]=function(_0x28c7d5,_0x207a9f){return _0x28c7d5[_0x737b('0xb')](_0x737b('0xc'),attributes,{'tableName':_0x737b('0xd'),'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 c7387ef..d377442 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 _0x8cc5=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3edf7c,_0xbd283e){var _0x44d821=function(_0x3faf46){while(--_0x3faf46){_0x3edf7c['push'](_0x3edf7c['shift']());}};_0x44d821(++_0xbd283e);}(_0x8cc5,0x91));var _0x58cc=function(_0xc3d199,_0x5492f0){_0xc3d199=_0xc3d199-0x0;var _0x473271=_0x8cc5[_0xc3d199];return _0x473271;};'use strict';var _=require(_0x58cc('0x0'));var util=require(_0x58cc('0x1'));var moment=require(_0x58cc('0x2'));var BPromise=require(_0x58cc('0x3'));var rs=require(_0x58cc('0x4'));var fs=require('fs');var Redis=require(_0x58cc('0x5'));var db=require(_0x58cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x58cc('0x7'))(_0x58cc('0x8'));var config=require(_0x58cc('0x9'));var jayson=require(_0x58cc('0xa'));var client=jayson[_0x58cc('0xb')][_0x58cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d7398,_0x27f6d,_0x2b3203){return new BPromise(function(_0x3fe16b,_0x546da5){return client[_0x58cc('0xd')](_0x5d7398,_0x2b3203)[_0x58cc('0xe')](function(_0x1450b8){logger[_0x58cc('0xf')](_0x58cc('0x10'),_0x27f6d,_0x58cc('0x11'));logger[_0x58cc('0x12')](_0x58cc('0x13'),_0x27f6d,_0x58cc('0x11'),JSON[_0x58cc('0x14')](_0x1450b8));if(_0x1450b8['error']){if(_0x1450b8[_0x58cc('0x15')]['code']===0x1f4){logger[_0x58cc('0x15')](_0x58cc('0x10'),_0x27f6d,_0x1450b8[_0x58cc('0x15')][_0x58cc('0x16')]);return _0x546da5(_0x1450b8[_0x58cc('0x15')][_0x58cc('0x16')]);}logger['error'](_0x58cc('0x10'),_0x27f6d,_0x1450b8[_0x58cc('0x15')][_0x58cc('0x16')]);return _0x3fe16b(_0x1450b8[_0x58cc('0x15')][_0x58cc('0x16')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x27f6d,'request\x20sent');_0x3fe16b(_0x1450b8[_0x58cc('0x17')]['message']);}})[_0x58cc('0x18')](function(_0x191e46){logger['error'](_0x58cc('0x10'),_0x27f6d,_0x191e46);_0x546da5(_0x191e46);});});} \ No newline at end of file +var _0xc288=['ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc288,0x1d3));var _0x8c28=function(_0xc01aad,_0x2616df){_0xc01aad=_0xc01aad-0x0;var _0x2d95db=_0xc288[_0xc01aad];return _0x2d95db;};'use strict';var _=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var moment=require(_0x8c28('0x2'));var BPromise=require(_0x8c28('0x3'));var rs=require(_0x8c28('0x4'));var fs=require('fs');var Redis=require(_0x8c28('0x5'));var db=require(_0x8c28('0x6'))['db'];var utils=require(_0x8c28('0x7'));var logger=require(_0x8c28('0x8'))(_0x8c28('0x9'));var config=require(_0x8c28('0xa'));var jayson=require(_0x8c28('0xb'));var client=jayson[_0x8c28('0xc')][_0x8c28('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ff095,_0x19c30e,_0x6aa073){return new BPromise(function(_0x4f2c15,_0x1906f3){return client['request'](_0x2ff095,_0x6aa073)[_0x8c28('0xe')](function(_0x506ed4){logger[_0x8c28('0xf')](_0x8c28('0x10'),_0x19c30e,'request\x20sent');logger[_0x8c28('0x11')](_0x8c28('0x12'),_0x19c30e,_0x8c28('0x13'),JSON['stringify'](_0x506ed4));if(_0x506ed4[_0x8c28('0x14')]){if(_0x506ed4[_0x8c28('0x14')]['code']===0x1f4){logger[_0x8c28('0x14')](_0x8c28('0x10'),_0x19c30e,_0x506ed4[_0x8c28('0x14')][_0x8c28('0x15')]);return _0x1906f3(_0x506ed4[_0x8c28('0x14')][_0x8c28('0x15')]);}logger['error'](_0x8c28('0x10'),_0x19c30e,_0x506ed4[_0x8c28('0x14')]['message']);return _0x4f2c15(_0x506ed4[_0x8c28('0x14')][_0x8c28('0x15')]);}else{logger[_0x8c28('0xf')]('ContactItemType,\x20%s,\x20%s',_0x19c30e,_0x8c28('0x13'));_0x4f2c15(_0x506ed4['result'][_0x8c28('0x15')]);}})[_0x8c28('0x16')](function(_0x2ef58b){logger[_0x8c28('0x14')]('ContactItemType,\x20%s,\x20%s',_0x19c30e,_0x2ef58b);_0x1906f3(_0x2ef58b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 7d1818f..944736b 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 _0x6a05=['update','delete','destroy','exports','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0xd1cf76,_0x1e667d){var _0x580cbf=function(_0x51dc24){while(--_0x51dc24){_0xd1cf76['push'](_0xd1cf76['shift']());}};_0x580cbf(++_0x1e667d);}(_0x6a05,0x1a4));var _0x56a0=function(_0x386306,_0x1363c9){_0x386306=_0x386306-0x0;var _0xcb23d=_0x6a05[_0x386306];return _0xcb23d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x56a0('0x0')]();var fs_extra=require('fs-extra');var auth=require(_0x56a0('0x1'));var interaction=require(_0x56a0('0x2'));var config=require(_0x56a0('0x3'));var controller=require('./contactItemType.controller');router[_0x56a0('0x4')]('/',auth[_0x56a0('0x5')](),controller[_0x56a0('0x6')]);router[_0x56a0('0x4')]('/:id',auth[_0x56a0('0x5')](),controller[_0x56a0('0x7')]);router[_0x56a0('0x8')]('/',auth['isAuthenticated'](),controller[_0x56a0('0x9')]);router[_0x56a0('0xa')](_0x56a0('0xb'),auth[_0x56a0('0x5')](),controller[_0x56a0('0xc')]);router[_0x56a0('0xd')]('/:id',auth[_0x56a0('0x5')](),controller[_0x56a0('0xe')]);module[_0x56a0('0xf')]=router; \ No newline at end of file +var _0x50a3=['post','create','put','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x50a3,0x9d));var _0x350a=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x50a3[_0x1627ae];return _0x34b38f;};'use strict';var multer=require(_0x350a('0x0'));var util=require(_0x350a('0x1'));var path=require(_0x350a('0x2'));var timeout=require('connect-timeout');var express=require(_0x350a('0x3'));var router=express[_0x350a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x350a('0x5'));var interaction=require(_0x350a('0x6'));var config=require(_0x350a('0x7'));var controller=require(_0x350a('0x8'));router[_0x350a('0x9')]('/',auth[_0x350a('0xa')](),controller[_0x350a('0xb')]);router[_0x350a('0x9')](_0x350a('0xc'),auth[_0x350a('0xa')](),controller[_0x350a('0xd')]);router[_0x350a('0xe')]('/',auth[_0x350a('0xa')](),controller[_0x350a('0xf')]);router[_0x350a('0x10')](_0x350a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x350a('0x11')](_0x350a('0xc'),auth[_0x350a('0xa')](),controller['destroy']);module[_0x350a('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a8d1c0d..854cb92 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 _0x757a=['exports','STRING'];(function(_0x2b5ca0,_0x182ac3){var _0x37e243=function(_0x30dd31){while(--_0x30dd31){_0x2b5ca0['push'](_0x2b5ca0['shift']());}};_0x37e243(++_0x182ac3);}(_0x757a,0xde));var _0xa757=function(_0x24b64a,_0x44bf5f){_0x24b64a=_0x24b64a-0x0;var _0x327725=_0x757a[_0x24b64a];return _0x327725;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x4d2167,_0x24571b){var _0x2348e5=function(_0x465b66){while(--_0x465b66){_0x4d2167['push'](_0x4d2167['shift']());}};_0x2348e5(++_0x24571b);}(_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 d47c4c9..6c4f568 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 _0xf559=['widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','destroy','CustomDashboards','UserProfileResource','then','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrChannel','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','voice','attrSmsAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0xf559,0x114));var _0x9f55=function(_0x24a15f,_0x2169e2){_0x24a15f=_0x24a15f-0x0;var _0x295e34=_0xf559[_0x24a15f];return _0x295e34;};'use strict';var emlformat=require(_0x9f55('0x0'));var rimraf=require(_0x9f55('0x1'));var zipdir=require(_0x9f55('0x2'));var jsonpatch=require(_0x9f55('0x3'));var rp=require('request-promise');var moment=require(_0x9f55('0x4'));var BPromise=require(_0x9f55('0x5'));var Mustache=require(_0x9f55('0x6'));var util=require('util');var path=require(_0x9f55('0x7'));var sox=require('sox');var csv=require(_0x9f55('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f55('0x9'));var _=require('lodash');var squel=require(_0x9f55('0xa'));var crypto=require('crypto');var jsforce=require(_0x9f55('0xb'));var deskjs=require(_0x9f55('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9f55('0xd'));var Papa=require(_0x9f55('0xe'));var Redis=require(_0x9f55('0xf'));var authService=require(_0x9f55('0x10'));var qs=require(_0x9f55('0x11'));var as=require(_0x9f55('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f55('0x13'))(_0x9f55('0x14'));var utils=require(_0x9f55('0x15'));var config=require(_0x9f55('0x16'));var licenseUtil=require(_0x9f55('0x17'));var db=require(_0x9f55('0x18'))['db'];config[_0x9f55('0x19')]=_[_0x9f55('0x1a')](config[_0x9f55('0x19')],{'host':_0x9f55('0x1b'),'port':0x18eb});var socket=require(_0x9f55('0x1c'))(new Redis(config[_0x9f55('0x19')]));require(_0x9f55('0x1d'))[_0x9f55('0x1e')](socket);function respondWithStatusCode(_0x556c1e,_0x561e60){_0x561e60=_0x561e60||0xcc;return function(_0x5b7c9d){if(_0x5b7c9d){return _0x556c1e[_0x9f55('0x1f')](_0x561e60);}return _0x556c1e[_0x9f55('0x20')](_0x561e60)[_0x9f55('0x21')]();};}function respondWithResult(_0x22f565,_0x465c3d){_0x465c3d=_0x465c3d||0xc8;return function(_0x3b5476){if(_0x3b5476){return _0x22f565[_0x9f55('0x20')](_0x465c3d)[_0x9f55('0x22')](_0x3b5476);}};}function respondWithFilteredResult(_0x57e44e,_0x54ed1d){return function(_0x2548be){if(_0x2548be){var _0x1220bd=typeof _0x54ed1d[_0x9f55('0x23')]===_0x9f55('0x24')&&typeof _0x54ed1d['limit']===_0x9f55('0x24');var _0x436569=_0x2548be[_0x9f55('0x25')];var _0xb5d96a=_0x1220bd?0x0:_0x54ed1d['offset'];var _0x353cae=_0x1220bd?_0x2548be[_0x9f55('0x25')]:_0x54ed1d[_0x9f55('0x23')]+_0x54ed1d['limit'];var _0x3c0124;if(_0x353cae>=_0x436569){_0x353cae=_0x436569;_0x3c0124=0xc8;}else{_0x3c0124=0xce;}_0x57e44e[_0x9f55('0x20')](_0x3c0124);return _0x57e44e[_0x9f55('0x26')](_0x9f55('0x27'),_0xb5d96a+'-'+_0x353cae+'/'+_0x436569)[_0x9f55('0x22')](_0x2548be);}return null;};}function patchUpdates(_0x5dcefb){return function(_0x17130f){try{jsonpatch['apply'](_0x17130f,_0x5dcefb,!![]);}catch(_0x55e146){return BPromise['reject'](_0x55e146);}return _0x17130f[_0x9f55('0x28')]();};}function saveUpdates(_0xdcd880,_0x280a22){return function(_0x15e959){if(_0x15e959){return _0x15e959[_0x9f55('0x29')](_0xdcd880)['then'](function(_0x3f02fe){return _0x3f02fe;});}return null;};}function removeEntity(_0x5849df,_0x4d5dc6){return function(_0x3d55c2){if(_0x3d55c2){return _0x3d55c2[_0x9f55('0x2a')]()['then'](function(){var _0x575bc8=_0x3d55c2['get']({'plain':!![]});var _0x2c4303=_0x9f55('0x2b');return db[_0x9f55('0x2c')][_0x9f55('0x2a')]({'where':{'type':_0x2c4303,'resourceId':_0x575bc8['id']}})[_0x9f55('0x2d')](function(){return _0x3d55c2;});})[_0x9f55('0x2d')](function(){_0x5849df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x87c6f7,_0x2faf46){return function(_0x3aeb3b){if(!_0x3aeb3b){_0x87c6f7['sendStatus'](0x194);}return _0x3aeb3b;};}function handleError(_0x27aff3,_0x4df4ec){_0x4df4ec=_0x4df4ec||0x1f4;return function(_0x5916e9){logger['error'](_0x5916e9[_0x9f55('0x2e')]);if(_0x5916e9[_0x9f55('0x2f')]){delete _0x5916e9['name'];}_0x27aff3[_0x9f55('0x20')](_0x4df4ec)[_0x9f55('0x30')](_0x5916e9);};}exports[_0x9f55('0x31')]=function(_0x204101,_0x4f6f1f){var _0x1fa038={},_0x1fb2cf={},_0x554581={'count':0x0,'rows':[]};var _0x475ecf=_['map'](db[_0x9f55('0x32')][_0x9f55('0x33')],function(_0x1a9585){return{'name':_0x1a9585[_0x9f55('0x34')],'type':_0x1a9585[_0x9f55('0x35')][_0x9f55('0x36')]};});_0x1fb2cf[_0x9f55('0x37')]=_[_0x9f55('0x38')](_0x475ecf,'name');_0x1fb2cf['query']=_[_0x9f55('0x39')](_0x204101['query']);_0x1fb2cf[_0x9f55('0x3a')]=_['intersection'](_0x1fb2cf['model'],_0x1fb2cf[_0x9f55('0x3b')]);_0x1fa038[_0x9f55('0x3c')]=_[_0x9f55('0x3d')](_0x1fb2cf[_0x9f55('0x37')],qs[_0x9f55('0x3e')](_0x204101[_0x9f55('0x3b')]['fields']));_0x1fa038[_0x9f55('0x3c')]=_0x1fa038[_0x9f55('0x3c')]['length']?_0x1fa038[_0x9f55('0x3c')]:_0x1fb2cf['model'];if(!_0x204101[_0x9f55('0x3b')][_0x9f55('0x3f')](_0x9f55('0x40'))){_0x1fa038[_0x9f55('0x41')]=qs['limit'](_0x204101[_0x9f55('0x3b')]['limit']);_0x1fa038[_0x9f55('0x23')]=qs[_0x9f55('0x23')](_0x204101[_0x9f55('0x3b')]['offset']);}_0x1fa038[_0x9f55('0x42')]=qs[_0x9f55('0x43')](_0x204101[_0x9f55('0x3b')][_0x9f55('0x43')]);_0x1fa038[_0x9f55('0x44')]=qs[_0x9f55('0x3a')](_[_0x9f55('0x45')](_0x204101[_0x9f55('0x3b')],_0x1fb2cf['filters']),_0x475ecf);if(_0x204101[_0x9f55('0x3b')][_0x9f55('0x46')]){_0x1fa038[_0x9f55('0x44')]=_[_0x9f55('0x47')](_0x1fa038['where'],{'$or':_['map'](_0x475ecf,function(_0x51b837){if(_0x51b837[_0x9f55('0x35')]!==_0x9f55('0x48')){var _0x5cfdb8={};_0x5cfdb8[_0x51b837['name']]={'$like':'%'+_0x204101[_0x9f55('0x3b')][_0x9f55('0x46')]+'%'};return _0x5cfdb8;}})});}_0x1fa038=_['merge']({},_0x1fa038,_0x204101[_0x9f55('0x49')]);var _0x46399c={'where':_0x1fa038[_0x9f55('0x44')]};return db['Dashboard']['count'](_0x46399c)[_0x9f55('0x2d')](function(_0x4d9471){_0x554581[_0x9f55('0x25')]=_0x4d9471;if(_0x204101[_0x9f55('0x3b')][_0x9f55('0x4a')]){_0x1fa038['include']=[{'all':!![]}];}return db[_0x9f55('0x32')][_0x9f55('0x4b')](_0x1fa038);})[_0x9f55('0x2d')](function(_0x2c9297){_0x554581[_0x9f55('0x4c')]=_0x2c9297;return _0x554581;})[_0x9f55('0x2d')](respondWithFilteredResult(_0x4f6f1f,_0x1fa038))[_0x9f55('0x4d')](handleError(_0x4f6f1f,null));};exports[_0x9f55('0x4e')]=function(_0x250822,_0x1a39d1){var _0x523e7b={'raw':![],'where':{'id':_0x250822[_0x9f55('0x4f')]['id']}},_0x28c9a0={};_0x28c9a0['model']=_[_0x9f55('0x39')](db[_0x9f55('0x32')]['rawAttributes']);_0x28c9a0['query']=_['keys'](_0x250822[_0x9f55('0x3b')]);_0x28c9a0[_0x9f55('0x3a')]=_['intersection'](_0x28c9a0[_0x9f55('0x37')],_0x28c9a0[_0x9f55('0x3b')]);_0x523e7b['attributes']=_[_0x9f55('0x3d')](_0x28c9a0[_0x9f55('0x37')],qs[_0x9f55('0x3e')](_0x250822[_0x9f55('0x3b')][_0x9f55('0x3e')]));_0x523e7b[_0x9f55('0x3c')]=_0x523e7b[_0x9f55('0x3c')][_0x9f55('0x50')]?_0x523e7b[_0x9f55('0x3c')]:_0x28c9a0[_0x9f55('0x37')];if(_0x250822['query'][_0x9f55('0x4a')]){_0x523e7b[_0x9f55('0x51')]=[{'all':!![]}];}_0x523e7b=_['merge']({},_0x523e7b,_0x250822[_0x9f55('0x49')]);return db[_0x9f55('0x32')][_0x9f55('0x52')](_0x523e7b)[_0x9f55('0x2d')](handleEntityNotFound(_0x1a39d1,null))['then'](respondWithResult(_0x1a39d1,null))['catch'](handleError(_0x1a39d1,null));};exports[_0x9f55('0x53')]=function(_0x2f85db,_0x5aca80){return db[_0x9f55('0x32')][_0x9f55('0x53')](_0x2f85db[_0x9f55('0x54')],{})[_0x9f55('0x2d')](function(_0x401c82){var _0x45913e=_0x2f85db[_0x9f55('0x55')]['get']({'plain':!![]});if(!_0x45913e)throw new Error(_0x9f55('0x56'));if(_0x45913e['role']===_0x9f55('0x55')){var _0x5dd049=_0x401c82[_0x9f55('0x57')]({'plain':!![]});var _0x332279=_0x9f55('0x2b');return db[_0x9f55('0x58')][_0x9f55('0x52')]({'where':{'name':_0x332279,'userProfileId':_0x45913e[_0x9f55('0x59')]},'raw':!![]})['then'](function(_0x31b4c2){if(_0x31b4c2&&_0x31b4c2['autoAssociation']===0x0){return db[_0x9f55('0x2c')]['create']({'name':_0x5dd049[_0x9f55('0x2f')],'resourceId':_0x5dd049['id'],'type':_0x31b4c2[_0x9f55('0x2f')],'sectionId':_0x31b4c2['id']},{})['then'](function(){return _0x401c82;});}else{return _0x401c82;}})[_0x9f55('0x4d')](function(_0x3cfc2e){logger[_0x9f55('0x5a')](_0x9f55('0x5b'),_0x3cfc2e);throw _0x3cfc2e;});}return _0x401c82;})[_0x9f55('0x2d')](respondWithResult(_0x5aca80,0xc9))['catch'](handleError(_0x5aca80,null));};exports['clone']=function(_0x1621a1,_0x18b181){var _0x5b0a4a={'where':{'id':_0x1621a1[_0x9f55('0x4f')]['id']}},_0x1c5c4a={};_0x1c5c4a[_0x9f55('0x37')]=_[_0x9f55('0x39')](db[_0x9f55('0x32')][_0x9f55('0x33')]);_0x5b0a4a[_0x9f55('0x3c')]=_[_0x9f55('0x3d')](_0x1c5c4a['model'],qs[_0x9f55('0x3e')](_0x1621a1[_0x9f55('0x3b')][_0x9f55('0x3e')]));_0x5b0a4a[_0x9f55('0x3c')]=_0x5b0a4a['attributes'][_0x9f55('0x50')]?_0x5b0a4a[_0x9f55('0x3c')]:_0x1c5c4a['model'];if(_0x1621a1['query'][_0x9f55('0x4a')]){_0x5b0a4a[_0x9f55('0x51')]=[{'all':!![]}];}_0x5b0a4a=_[_0x9f55('0x47')]({},_0x5b0a4a,_0x1621a1['options']);return db[_0x9f55('0x32')][_0x9f55('0x52')](_0x5b0a4a)[_0x9f55('0x2d')](handleEntityNotFound(_0x18b181,null))[_0x9f55('0x2d')](function(_0x62d626){if(_0x62d626){var _0x317426=_0x62d626[_0x9f55('0x57')]({'plain':!![]});_0x317426=qs[_0x9f55('0x5c')](_0x317426,['id',_0x9f55('0x5d'),'updatedAt']);_0x1621a1['body']=_['omit'](_0x1621a1[_0x9f55('0x54')],['id',_0x9f55('0x5d'),'updatedAt']);return db[_0x9f55('0x32')][_0x9f55('0x53')](_[_0x9f55('0x47')](_0x317426,_0x1621a1['body']),{'include':_0x1621a1[_0x9f55('0x3b')][_0x9f55('0x4a')]?[{'all':!![]}]:undefined})[_0x9f55('0x2d')](function(_0x184635){var _0x507662=_0x1621a1['user'][_0x9f55('0x57')]({'plain':!![]});if(!_0x507662)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x507662['role']==='user'){var _0x2f60c9=_0x184635[_0x9f55('0x57')]({'plain':!![]});var _0xf1d6cb=_0x9f55('0x2b');return db[_0x9f55('0x58')][_0x9f55('0x52')]({'where':{'name':_0xf1d6cb,'userProfileId':_0x507662[_0x9f55('0x59')]},'raw':!![]})[_0x9f55('0x2d')](function(_0x34f71c){if(_0x34f71c&&_0x34f71c[_0x9f55('0x5e')]===0x0){return db[_0x9f55('0x2c')][_0x9f55('0x53')]({'name':_0x2f60c9['name'],'resourceId':_0x2f60c9['id'],'type':_0x34f71c[_0x9f55('0x2f')],'sectionId':_0x34f71c['id']},{})['then'](function(){return _0x184635;});}else{return _0x184635;}})[_0x9f55('0x4d')](function(_0x1c19e3){logger[_0x9f55('0x5a')](_0x9f55('0x5b'),_0x1c19e3);throw _0x1c19e3;});}return _0x184635;});}})[_0x9f55('0x2d')](respondWithResult(_0x18b181,0xc9))[_0x9f55('0x4d')](handleError(_0x18b181,null));};exports[_0x9f55('0x29')]=function(_0x4e9b2f,_0x4822f0){if(_0x4e9b2f[_0x9f55('0x54')]['id']){delete _0x4e9b2f[_0x9f55('0x54')]['id'];}return db[_0x9f55('0x32')][_0x9f55('0x52')]({'where':{'id':_0x4e9b2f['params']['id']}})['then'](handleEntityNotFound(_0x4822f0,null))[_0x9f55('0x2d')](saveUpdates(_0x4e9b2f['body'],null))[_0x9f55('0x2d')](respondWithResult(_0x4822f0,null))[_0x9f55('0x4d')](handleError(_0x4822f0,null));};exports['destroy']=function(_0x43bf4e,_0x597c21){return db[_0x9f55('0x32')][_0x9f55('0x52')]({'where':{'id':_0x43bf4e['params']['id']}})[_0x9f55('0x2d')](handleEntityNotFound(_0x597c21,null))[_0x9f55('0x2d')](removeEntity(_0x597c21,null))[_0x9f55('0x4d')](handleError(_0x597c21,null));};function widgetAttributes(_0x240fc2){try{switch(_0x240fc2['type']){case _0x9f55('0x5f'):return[{'name':'attrUrl','value':_0x240fc2[_0x9f55('0x60')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x0]?_0x240fc2['attrs'][0x0][_0x9f55('0x62')]:undefined)||_0x9f55('0x63')}];case _0x9f55('0x64'):return[{'name':_0x9f55('0x65'),'value':_0x240fc2['attrPath']||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x0]?_0x240fc2['attrs'][0x0][_0x9f55('0x62')]:undefined)||''}];case _0x9f55('0x66'):return[{'name':_0x9f55('0x67'),'value':_0x240fc2[_0x9f55('0x67')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x0]?_0x240fc2[_0x9f55('0x61')][0x0][_0x9f55('0x62')]:undefined)||_0x9f55('0x68')},{'name':_0x9f55('0x69'),'value':_0x240fc2[_0x9f55('0x69')]||(_0x240fc2['attrs']&&_0x240fc2[_0x9f55('0x61')][0x1]?_0x240fc2[_0x9f55('0x61')][0x1][_0x9f55('0x62')]:undefined)||_0x9f55('0x6a')},{'name':_0x9f55('0x6b'),'value':_0x240fc2['attrFontSize']||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x2]?_0x240fc2[_0x9f55('0x61')][0x2][_0x9f55('0x62')]:undefined)||0xc}];case _0x9f55('0x6c'):return[{'name':_0x9f55('0x6d'),'value':_0x240fc2[_0x9f55('0x6d')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x0]?_0x240fc2[_0x9f55('0x61')][0x0][_0x9f55('0x62')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x240fc2['attrVoiceQueues']||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x1]?_0x240fc2[_0x9f55('0x61')][0x1][_0x9f55('0x62')]:undefined)||[]},{'name':_0x9f55('0x6b'),'value':_0x240fc2[_0x9f55('0x6b')]||(_0x240fc2['attrs']&&_0x240fc2[_0x9f55('0x61')][0x2]?_0x240fc2[_0x9f55('0x61')][0x2][_0x9f55('0x62')]:undefined)||0x14},{'name':_0x9f55('0x6e'),'value':_0x240fc2[_0x9f55('0x6e')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x3]?_0x240fc2[_0x9f55('0x61')][0x3][_0x9f55('0x62')]:undefined)||'voice'},{'name':_0x9f55('0x6f'),'value':_0x240fc2[_0x9f55('0x6f')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x4]?_0x240fc2['attrs'][0x4][_0x9f55('0x62')]:undefined)||''},{'name':_0x9f55('0x70'),'value':_0x240fc2[_0x9f55('0x70')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2['attrs'][0x5]?_0x240fc2[_0x9f55('0x61')][0x5][_0x9f55('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x240fc2['attrSmsAccounts']||(_0x240fc2['attrs']&&_0x240fc2[_0x9f55('0x61')][0x6]?_0x240fc2['attrs'][0x6][_0x9f55('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x240fc2[_0x9f55('0x71')]||(_0x240fc2['attrs']&&_0x240fc2[_0x9f55('0x61')][0x7]?_0x240fc2[_0x9f55('0x61')][0x7][_0x9f55('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x240fc2['attrWhatsappAccounts']||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x8]?_0x240fc2[_0x9f55('0x61')][0x8][_0x9f55('0x62')]:undefined)||''},{'name':_0x9f55('0x72'),'value':_0x240fc2[_0x9f55('0x72')]||(_0x240fc2['attrs']&&_0x240fc2[_0x9f55('0x61')][0x9]?_0x240fc2[_0x9f55('0x61')][0x9]['value']:undefined)||''}];case _0x9f55('0x73'):case _0x9f55('0x74'):return[{'name':_0x9f55('0x75'),'value':_0x240fc2[_0x9f55('0x75')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2['attrs'][0x0]?_0x240fc2[_0x9f55('0x61')][0x0][_0x9f55('0x62')]:undefined)||_0x9f55('0x76')},{'name':'attrSerie2','value':_0x240fc2[_0x9f55('0x77')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x1]?_0x240fc2['attrs'][0x1]['value']:undefined)||null},{'name':_0x9f55('0x78'),'value':_0x240fc2['attrSerie3']||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2['attrs'][0x2]?_0x240fc2[_0x9f55('0x61')][0x2][_0x9f55('0x62')]:undefined)||null},{'name':_0x9f55('0x79'),'value':_0x240fc2[_0x9f55('0x79')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x3]?_0x240fc2[_0x9f55('0x61')][0x3]['value']:undefined)||[]},{'name':_0x9f55('0x6e'),'value':_0x240fc2[_0x9f55('0x6e')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x4]?_0x240fc2[_0x9f55('0x61')][0x4][_0x9f55('0x62')]:undefined)||_0x9f55('0x7a')},{'name':'attrEmailAccounts','value':_0x240fc2[_0x9f55('0x6f')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x5]?_0x240fc2[_0x9f55('0x61')][0x5]['value']:undefined)||''},{'name':_0x9f55('0x70'),'value':_0x240fc2[_0x9f55('0x70')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x6]?_0x240fc2[_0x9f55('0x61')][0x6][_0x9f55('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x240fc2[_0x9f55('0x7b')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x7]?_0x240fc2[_0x9f55('0x61')][0x7][_0x9f55('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x240fc2[_0x9f55('0x71')]||(_0x240fc2['attrs']&&_0x240fc2[_0x9f55('0x61')][0x8]?_0x240fc2['attrs'][0x8][_0x9f55('0x62')]:undefined)||''},{'name':_0x9f55('0x7c'),'value':_0x240fc2['attrWhatsappAccounts']||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2['attrs'][0x9]?_0x240fc2[_0x9f55('0x61')][0x9][_0x9f55('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x240fc2['attrChatWebsites']||(_0x240fc2['attrs']&&_0x240fc2['attrs'][0xa]?_0x240fc2[_0x9f55('0x61')][0xa][_0x9f55('0x62')]:undefined)||''}];case _0x9f55('0x7d'):return[{'name':_0x9f55('0x7e'),'type':_0x240fc2[_0x9f55('0x7f')]||(_0x240fc2['attrs']&&_0x240fc2[_0x9f55('0x61')][0x0]?_0x240fc2[_0x9f55('0x61')][0x0][_0x9f55('0x35')]:undefined)||null,'value':_0x240fc2[_0x9f55('0x7e')]||(_0x240fc2[_0x9f55('0x61')]&&_0x240fc2[_0x9f55('0x61')][0x0]?_0x240fc2[_0x9f55('0x61')][0x0][_0x9f55('0x62')]:undefined)||null},{'name':_0x9f55('0x80'),'value':_0x240fc2[_0x9f55('0x80')]||(_0x240fc2['attrs']&&_0x240fc2['attrs'][0x1]?_0x240fc2['attrs'][0x1][_0x9f55('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x3abac7){logger[_0x9f55('0x5a')](_0x9f55('0x81'),JSON[_0x9f55('0x82')](_0x3abac7));return[];}}exports[_0x9f55('0x83')]=function(_0x34eee4,_0x1d870e,_0x18ec24){if(_0x34eee4[_0x9f55('0x54')]['id']){delete _0x34eee4[_0x9f55('0x54')]['id'];}return db[_0x9f55('0x32')][_0x9f55('0x52')]({'where':{'id':_0x34eee4[_0x9f55('0x4f')]['id']}})[_0x9f55('0x2d')](handleEntityNotFound(_0x1d870e,null))[_0x9f55('0x2d')](function(_0x591092){if(_0x591092){_0x34eee4[_0x9f55('0x54')][_0x9f55('0x84')]=_0x591092['id'];_0x34eee4[_0x9f55('0x54')][_0x9f55('0x61')]=widgetAttributes(_0x34eee4[_0x9f55('0x54')]);return db[_0x9f55('0x85')][_0x9f55('0x53')](_0x34eee4[_0x9f55('0x54')]);}})[_0x9f55('0x2d')](respondWithResult(_0x1d870e,null))[_0x9f55('0x4d')](handleError(_0x1d870e,null));};exports[_0x9f55('0x86')]=function(_0x3a285e,_0x2dfe4c,_0x17ee3a){var _0x4df3e8={};var _0x30134a={};var _0x1c41cc;var _0x3a3491;return db[_0x9f55('0x32')]['findOne']({'where':{'id':_0x3a285e[_0x9f55('0x4f')]['id']}})[_0x9f55('0x2d')](handleEntityNotFound(_0x2dfe4c,null))[_0x9f55('0x2d')](function(_0x28bcd1){if(_0x28bcd1){_0x1c41cc=_0x28bcd1;_0x30134a[_0x9f55('0x37')]=_[_0x9f55('0x39')](db[_0x9f55('0x85')][_0x9f55('0x33')]);_0x30134a[_0x9f55('0x3b')]=_[_0x9f55('0x39')](_0x3a285e[_0x9f55('0x3b')]);_0x30134a[_0x9f55('0x3a')]=_[_0x9f55('0x3d')](_0x30134a[_0x9f55('0x37')],_0x30134a[_0x9f55('0x3b')]);_0x4df3e8['attributes']=_['intersection'](_0x30134a[_0x9f55('0x37')],qs[_0x9f55('0x3e')](_0x3a285e[_0x9f55('0x3b')][_0x9f55('0x3e')]));_0x4df3e8[_0x9f55('0x3c')]=_0x4df3e8[_0x9f55('0x3c')][_0x9f55('0x50')]?_0x4df3e8[_0x9f55('0x3c')]:_0x30134a[_0x9f55('0x37')];_0x4df3e8[_0x9f55('0x42')]=qs[_0x9f55('0x43')](_0x3a285e[_0x9f55('0x3b')][_0x9f55('0x43')]);_0x4df3e8['where']=qs[_0x9f55('0x3a')](_[_0x9f55('0x45')](_0x3a285e[_0x9f55('0x3b')],_0x30134a[_0x9f55('0x3a')]));if(_0x3a285e[_0x9f55('0x3b')]['filter']){_0x4df3e8[_0x9f55('0x44')]=_[_0x9f55('0x47')](_0x4df3e8[_0x9f55('0x44')],{'$or':_[_0x9f55('0x38')](_0x4df3e8[_0x9f55('0x3c')],function(_0x51f60a){var _0xc004={};_0xc004[_0x51f60a]={'$like':'%'+_0x3a285e[_0x9f55('0x3b')][_0x9f55('0x46')]+'%'};return _0xc004;})});}_0x4df3e8=_[_0x9f55('0x47')]({},_0x4df3e8,_0x3a285e['options']);return _0x1c41cc['getItems'](_0x4df3e8);}})['then'](function(_0x2fb501){if(_0x2fb501){_0x3a3491=_0x2fb501[_0x9f55('0x50')];if(!_0x3a285e[_0x9f55('0x3b')]['hasOwnProperty'](_0x9f55('0x40'))){_0x4df3e8[_0x9f55('0x41')]=qs[_0x9f55('0x41')](_0x3a285e[_0x9f55('0x3b')][_0x9f55('0x41')]);_0x4df3e8[_0x9f55('0x23')]=qs[_0x9f55('0x23')](_0x3a285e['query'][_0x9f55('0x23')]);}return _0x1c41cc[_0x9f55('0x86')](_0x4df3e8);}})['then'](function(_0xbf79ba){if(_0xbf79ba){return _0xbf79ba?{'count':_0x3a3491,'rows':_0xbf79ba}:null;}})[_0x9f55('0x2d')](respondWithResult(_0x2dfe4c,null))[_0x9f55('0x4d')](handleError(_0x2dfe4c,null));}; \ No newline at end of file +var _0xb8ef=['../../config/license/util','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','include','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','reportType','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0xb8ef,0x167));var _0xfb8e=function(_0x567fab,_0xc50bfd){_0x567fab=_0x567fab-0x0;var _0x5e5fb0=_0xb8ef[_0x567fab];return _0x5e5fb0;};'use strict';var emlformat=require(_0xfb8e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb8e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb8e('0x2'));var moment=require(_0xfb8e('0x3'));var BPromise=require(_0xfb8e('0x4'));var Mustache=require(_0xfb8e('0x5'));var util=require(_0xfb8e('0x6'));var path=require('path');var sox=require(_0xfb8e('0x7'));var csv=require(_0xfb8e('0x8'));var ejs=require(_0xfb8e('0x9'));var fs=require('fs');var fs_extra=require(_0xfb8e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb8e('0xb'));var jsforce=require(_0xfb8e('0xc'));var deskjs=require(_0xfb8e('0xd'));var toCsv=require(_0xfb8e('0x8'));var querystring=require(_0xfb8e('0xe'));var Papa=require(_0xfb8e('0xf'));var Redis=require(_0xfb8e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfb8e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb8e('0x12'));var logger=require(_0xfb8e('0x13'))(_0xfb8e('0x14'));var utils=require(_0xfb8e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfb8e('0x16'));var db=require('../../mysqldb')['db'];config[_0xfb8e('0x17')]=_[_0xfb8e('0x18')](config[_0xfb8e('0x17')],{'host':_0xfb8e('0x19'),'port':0x18eb});var socket=require(_0xfb8e('0x1a'))(new Redis(config[_0xfb8e('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x4e35c6,_0x34c02c){_0x34c02c=_0x34c02c||0xcc;return function(_0x3ef635){if(_0x3ef635){return _0x4e35c6['sendStatus'](_0x34c02c);}return _0x4e35c6[_0xfb8e('0x1b')](_0x34c02c)['end']();};}function respondWithResult(_0x2aa40f,_0x44665e){_0x44665e=_0x44665e||0xc8;return function(_0x4bc123){if(_0x4bc123){return _0x2aa40f[_0xfb8e('0x1b')](_0x44665e)[_0xfb8e('0x1c')](_0x4bc123);}};}function respondWithFilteredResult(_0x3c424b,_0x417caa){return function(_0x28d0bf){if(_0x28d0bf){var _0x4bc121=typeof _0x417caa[_0xfb8e('0x1d')]===_0xfb8e('0x1e')&&typeof _0x417caa['limit']==='undefined';var _0x763806=_0x28d0bf[_0xfb8e('0x1f')];var _0x4768e7=_0x4bc121?0x0:_0x417caa['offset'];var _0x441987=_0x4bc121?_0x28d0bf[_0xfb8e('0x1f')]:_0x417caa['offset']+_0x417caa[_0xfb8e('0x20')];var _0x40e429;if(_0x441987>=_0x763806){_0x441987=_0x763806;_0x40e429=0xc8;}else{_0x40e429=0xce;}_0x3c424b[_0xfb8e('0x1b')](_0x40e429);return _0x3c424b[_0xfb8e('0x21')](_0xfb8e('0x22'),_0x4768e7+'-'+_0x441987+'/'+_0x763806)['json'](_0x28d0bf);}return null;};}function patchUpdates(_0x2913a2){return function(_0x501405){try{jsonpatch[_0xfb8e('0x23')](_0x501405,_0x2913a2,!![]);}catch(_0x1f5f6e){return BPromise[_0xfb8e('0x24')](_0x1f5f6e);}return _0x501405['save']();};}function saveUpdates(_0x198abe,_0x565c03){return function(_0x2dd595){if(_0x2dd595){return _0x2dd595[_0xfb8e('0x25')](_0x198abe)[_0xfb8e('0x26')](function(_0x2c28a5){return _0x2c28a5;});}return null;};}function removeEntity(_0x3b0681,_0xfe918b){return function(_0x5d9fbc){if(_0x5d9fbc){return _0x5d9fbc[_0xfb8e('0x27')]()[_0xfb8e('0x26')](function(){var _0x1e242b=_0x5d9fbc[_0xfb8e('0x28')]({'plain':!![]});var _0x305f64=_0xfb8e('0x29');return db[_0xfb8e('0x2a')][_0xfb8e('0x27')]({'where':{'type':_0x305f64,'resourceId':_0x1e242b['id']}})[_0xfb8e('0x26')](function(){return _0x5d9fbc;});})[_0xfb8e('0x26')](function(){_0x3b0681[_0xfb8e('0x1b')](0xcc)[_0xfb8e('0x2b')]();});}};}function handleEntityNotFound(_0x755caf,_0x40342a){return function(_0xa9deaa){if(!_0xa9deaa){_0x755caf['sendStatus'](0x194);}return _0xa9deaa;};}function handleError(_0x18965b,_0x45ee7f){_0x45ee7f=_0x45ee7f||0x1f4;return function(_0x993b44){logger[_0xfb8e('0x2c')](_0x993b44[_0xfb8e('0x2d')]);if(_0x993b44['name']){delete _0x993b44[_0xfb8e('0x2e')];}_0x18965b[_0xfb8e('0x1b')](_0x45ee7f)[_0xfb8e('0x2f')](_0x993b44);};}exports['index']=function(_0x4a2ad7,_0x5d5b67){var _0x1b9ef5={},_0x5f27e3={},_0x2c57d5={'count':0x0,'rows':[]};var _0x245996=_[_0xfb8e('0x30')](db[_0xfb8e('0x31')][_0xfb8e('0x32')],function(_0x14626a){return{'name':_0x14626a[_0xfb8e('0x33')],'type':_0x14626a[_0xfb8e('0x34')][_0xfb8e('0x35')]};});_0x5f27e3['model']=_[_0xfb8e('0x30')](_0x245996,_0xfb8e('0x2e'));_0x5f27e3[_0xfb8e('0x36')]=_[_0xfb8e('0x37')](_0x4a2ad7[_0xfb8e('0x36')]);_0x5f27e3['filters']=_[_0xfb8e('0x38')](_0x5f27e3[_0xfb8e('0x39')],_0x5f27e3['query']);_0x1b9ef5[_0xfb8e('0x3a')]=_[_0xfb8e('0x38')](_0x5f27e3[_0xfb8e('0x39')],qs['fields'](_0x4a2ad7[_0xfb8e('0x36')]['fields']));_0x1b9ef5[_0xfb8e('0x3a')]=_0x1b9ef5[_0xfb8e('0x3a')][_0xfb8e('0x3b')]?_0x1b9ef5[_0xfb8e('0x3a')]:_0x5f27e3['model'];if(!_0x4a2ad7[_0xfb8e('0x36')]['hasOwnProperty'](_0xfb8e('0x3c'))){_0x1b9ef5[_0xfb8e('0x20')]=qs[_0xfb8e('0x20')](_0x4a2ad7['query'][_0xfb8e('0x20')]);_0x1b9ef5[_0xfb8e('0x1d')]=qs['offset'](_0x4a2ad7['query'][_0xfb8e('0x1d')]);}_0x1b9ef5[_0xfb8e('0x3d')]=qs[_0xfb8e('0x3e')](_0x4a2ad7['query']['sort']);_0x1b9ef5[_0xfb8e('0x3f')]=qs[_0xfb8e('0x40')](_[_0xfb8e('0x41')](_0x4a2ad7['query'],_0x5f27e3[_0xfb8e('0x40')]),_0x245996);if(_0x4a2ad7['query'][_0xfb8e('0x42')]){_0x1b9ef5['where']=_[_0xfb8e('0x43')](_0x1b9ef5[_0xfb8e('0x3f')],{'$or':_['map'](_0x245996,function(_0x2ccb4c){if(_0x2ccb4c['type']!==_0xfb8e('0x44')){var _0x322d9d={};_0x322d9d[_0x2ccb4c[_0xfb8e('0x2e')]]={'$like':'%'+_0x4a2ad7[_0xfb8e('0x36')][_0xfb8e('0x42')]+'%'};return _0x322d9d;}})});}_0x1b9ef5=_['merge']({},_0x1b9ef5,_0x4a2ad7[_0xfb8e('0x45')]);var _0x124c85={'where':_0x1b9ef5['where']};return db[_0xfb8e('0x31')]['count'](_0x124c85)['then'](function(_0x2b73ee){_0x2c57d5['count']=_0x2b73ee;if(_0x4a2ad7[_0xfb8e('0x36')][_0xfb8e('0x46')]){_0x1b9ef5['include']=[{'all':!![]}];}return db[_0xfb8e('0x31')][_0xfb8e('0x47')](_0x1b9ef5);})[_0xfb8e('0x26')](function(_0x262054){_0x2c57d5[_0xfb8e('0x48')]=_0x262054;return _0x2c57d5;})[_0xfb8e('0x26')](respondWithFilteredResult(_0x5d5b67,_0x1b9ef5))['catch'](handleError(_0x5d5b67,null));};exports[_0xfb8e('0x49')]=function(_0x2d962c,_0x29ce44){var _0x46944a={'raw':![],'where':{'id':_0x2d962c[_0xfb8e('0x4a')]['id']}},_0x953ae4={};_0x953ae4[_0xfb8e('0x39')]=_['keys'](db[_0xfb8e('0x31')][_0xfb8e('0x32')]);_0x953ae4[_0xfb8e('0x36')]=_['keys'](_0x2d962c[_0xfb8e('0x36')]);_0x953ae4[_0xfb8e('0x40')]=_['intersection'](_0x953ae4[_0xfb8e('0x39')],_0x953ae4[_0xfb8e('0x36')]);_0x46944a[_0xfb8e('0x3a')]=_[_0xfb8e('0x38')](_0x953ae4['model'],qs[_0xfb8e('0x4b')](_0x2d962c['query'][_0xfb8e('0x4b')]));_0x46944a['attributes']=_0x46944a[_0xfb8e('0x3a')]['length']?_0x46944a[_0xfb8e('0x3a')]:_0x953ae4[_0xfb8e('0x39')];if(_0x2d962c['query'][_0xfb8e('0x46')]){_0x46944a[_0xfb8e('0x4c')]=[{'all':!![]}];}_0x46944a=_[_0xfb8e('0x43')]({},_0x46944a,_0x2d962c[_0xfb8e('0x45')]);return db[_0xfb8e('0x31')][_0xfb8e('0x4d')](_0x46944a)[_0xfb8e('0x26')](handleEntityNotFound(_0x29ce44,null))[_0xfb8e('0x26')](respondWithResult(_0x29ce44,null))['catch'](handleError(_0x29ce44,null));};exports[_0xfb8e('0x4e')]=function(_0x10d198,_0x44c815){return db[_0xfb8e('0x31')][_0xfb8e('0x4e')](_0x10d198[_0xfb8e('0x4f')],{})[_0xfb8e('0x26')](function(_0x361ebd){var _0x533967=_0x10d198[_0xfb8e('0x50')][_0xfb8e('0x28')]({'plain':!![]});if(!_0x533967)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x533967[_0xfb8e('0x51')]==='user'){var _0x3453fc=_0x361ebd[_0xfb8e('0x28')]({'plain':!![]});var _0x2a1d36=_0xfb8e('0x29');return db[_0xfb8e('0x52')][_0xfb8e('0x4d')]({'where':{'name':_0x2a1d36,'userProfileId':_0x533967['userProfileId']},'raw':!![]})[_0xfb8e('0x26')](function(_0x3c1abd){if(_0x3c1abd&&_0x3c1abd[_0xfb8e('0x53')]===0x0){return db[_0xfb8e('0x2a')][_0xfb8e('0x4e')]({'name':_0x3453fc[_0xfb8e('0x2e')],'resourceId':_0x3453fc['id'],'type':_0x3c1abd[_0xfb8e('0x2e')],'sectionId':_0x3c1abd['id']},{})['then'](function(){return _0x361ebd;});}else{return _0x361ebd;}})[_0xfb8e('0x54')](function(_0x7d38ab){logger[_0xfb8e('0x2c')](_0xfb8e('0x55'),_0x7d38ab);throw _0x7d38ab;});}return _0x361ebd;})[_0xfb8e('0x26')](respondWithResult(_0x44c815,0xc9))[_0xfb8e('0x54')](handleError(_0x44c815,null));};exports[_0xfb8e('0x56')]=function(_0x3571b0,_0x106287){var _0x1a2619={'where':{'id':_0x3571b0[_0xfb8e('0x4a')]['id']}},_0x55c9d0={};_0x55c9d0[_0xfb8e('0x39')]=_[_0xfb8e('0x37')](db[_0xfb8e('0x31')][_0xfb8e('0x32')]);_0x1a2619[_0xfb8e('0x3a')]=_[_0xfb8e('0x38')](_0x55c9d0['model'],qs['fields'](_0x3571b0[_0xfb8e('0x36')][_0xfb8e('0x4b')]));_0x1a2619[_0xfb8e('0x3a')]=_0x1a2619['attributes']['length']?_0x1a2619[_0xfb8e('0x3a')]:_0x55c9d0['model'];if(_0x3571b0[_0xfb8e('0x36')]['includeAll']){_0x1a2619[_0xfb8e('0x4c')]=[{'all':!![]}];}_0x1a2619=_[_0xfb8e('0x43')]({},_0x1a2619,_0x3571b0[_0xfb8e('0x45')]);return db[_0xfb8e('0x31')][_0xfb8e('0x4d')](_0x1a2619)[_0xfb8e('0x26')](handleEntityNotFound(_0x106287,null))[_0xfb8e('0x26')](function(_0x42337d){if(_0x42337d){var _0x192c09=_0x42337d['get']({'plain':!![]});_0x192c09=qs[_0xfb8e('0x57')](_0x192c09,['id',_0xfb8e('0x58'),_0xfb8e('0x59')]);_0x3571b0['body']=_[_0xfb8e('0x57')](_0x3571b0['body'],['id',_0xfb8e('0x58'),_0xfb8e('0x59')]);return db['Dashboard'][_0xfb8e('0x4e')](_[_0xfb8e('0x43')](_0x192c09,_0x3571b0[_0xfb8e('0x4f')]),{'include':_0x3571b0[_0xfb8e('0x36')][_0xfb8e('0x46')]?[{'all':!![]}]:undefined})[_0xfb8e('0x26')](function(_0x12b973){var _0x305e97=_0x3571b0[_0xfb8e('0x50')][_0xfb8e('0x28')]({'plain':!![]});if(!_0x305e97)throw new Error(_0xfb8e('0x5a'));if(_0x305e97[_0xfb8e('0x51')]===_0xfb8e('0x50')){var _0x2bdbdc=_0x12b973['get']({'plain':!![]});var _0x13f67f=_0xfb8e('0x29');return db[_0xfb8e('0x52')][_0xfb8e('0x4d')]({'where':{'name':_0x13f67f,'userProfileId':_0x305e97[_0xfb8e('0x5b')]},'raw':!![]})[_0xfb8e('0x26')](function(_0x22705c){if(_0x22705c&&_0x22705c[_0xfb8e('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x2bdbdc[_0xfb8e('0x2e')],'resourceId':_0x2bdbdc['id'],'type':_0x22705c['name'],'sectionId':_0x22705c['id']},{})[_0xfb8e('0x26')](function(){return _0x12b973;});}else{return _0x12b973;}})[_0xfb8e('0x54')](function(_0x28577c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28577c);throw _0x28577c;});}return _0x12b973;});}})[_0xfb8e('0x26')](respondWithResult(_0x106287,0xc9))[_0xfb8e('0x54')](handleError(_0x106287,null));};exports[_0xfb8e('0x25')]=function(_0x1f4d44,_0xaf2c3e){if(_0x1f4d44[_0xfb8e('0x4f')]['id']){delete _0x1f4d44[_0xfb8e('0x4f')]['id'];}return db[_0xfb8e('0x31')][_0xfb8e('0x4d')]({'where':{'id':_0x1f4d44[_0xfb8e('0x4a')]['id']}})['then'](handleEntityNotFound(_0xaf2c3e,null))['then'](saveUpdates(_0x1f4d44['body'],null))[_0xfb8e('0x26')](respondWithResult(_0xaf2c3e,null))[_0xfb8e('0x54')](handleError(_0xaf2c3e,null));};exports[_0xfb8e('0x27')]=function(_0x19a14c,_0x5ead9c){return db['Dashboard'][_0xfb8e('0x4d')]({'where':{'id':_0x19a14c[_0xfb8e('0x4a')]['id']}})[_0xfb8e('0x26')](handleEntityNotFound(_0x5ead9c,null))[_0xfb8e('0x26')](removeEntity(_0x5ead9c,null))[_0xfb8e('0x54')](handleError(_0x5ead9c,null));};function widgetAttributes(_0x446a2b){try{switch(_0x446a2b[_0xfb8e('0x34')]){case'iframe':return[{'name':_0xfb8e('0x5c'),'value':_0x446a2b['attrUrl']||(_0x446a2b['attrs']&&_0x446a2b[_0xfb8e('0x5d')][0x0]?_0x446a2b['attrs'][0x0][_0xfb8e('0x5e')]:undefined)||'https://'}];case _0xfb8e('0x5f'):return[{'name':_0xfb8e('0x60'),'value':_0x446a2b['attrPath']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x0]?_0x446a2b[_0xfb8e('0x5d')][0x0][_0xfb8e('0x5e')]:undefined)||''}];case _0xfb8e('0x61'):return[{'name':_0xfb8e('0x62'),'value':_0x446a2b[_0xfb8e('0x62')]||(_0x446a2b['attrs']&&_0x446a2b['attrs'][0x0]?_0x446a2b[_0xfb8e('0x5d')][0x0][_0xfb8e('0x5e')]:undefined)||_0xfb8e('0x63')},{'name':_0xfb8e('0x64'),'value':_0x446a2b[_0xfb8e('0x64')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x1]?_0x446a2b[_0xfb8e('0x5d')][0x1][_0xfb8e('0x5e')]:undefined)||_0xfb8e('0x65')},{'name':_0xfb8e('0x66'),'value':_0x446a2b[_0xfb8e('0x66')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x2]?_0x446a2b[_0xfb8e('0x5d')][0x2][_0xfb8e('0x5e')]:undefined)||0xc}];case'counter':return[{'name':_0xfb8e('0x67'),'value':_0x446a2b['attrMetric']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x0]?_0x446a2b[_0xfb8e('0x5d')][0x0][_0xfb8e('0x5e')]:undefined)||_0xfb8e('0x68')},{'name':'attrVoiceQueues','value':_0x446a2b['attrVoiceQueues']||(_0x446a2b['attrs']&&_0x446a2b[_0xfb8e('0x5d')][0x1]?_0x446a2b[_0xfb8e('0x5d')][0x1][_0xfb8e('0x5e')]:undefined)||[]},{'name':_0xfb8e('0x66'),'value':_0x446a2b[_0xfb8e('0x66')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x2]?_0x446a2b[_0xfb8e('0x5d')][0x2][_0xfb8e('0x5e')]:undefined)||0x14},{'name':_0xfb8e('0x69'),'value':_0x446a2b['attrChannel']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x3]?_0x446a2b[_0xfb8e('0x5d')][0x3][_0xfb8e('0x5e')]:undefined)||_0xfb8e('0x6a')},{'name':_0xfb8e('0x6b'),'value':_0x446a2b[_0xfb8e('0x6b')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x4]?_0x446a2b[_0xfb8e('0x5d')][0x4][_0xfb8e('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x446a2b[_0xfb8e('0x6c')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x5]?_0x446a2b['attrs'][0x5][_0xfb8e('0x5e')]:undefined)||''},{'name':_0xfb8e('0x6d'),'value':_0x446a2b['attrSmsAccounts']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x6]?_0x446a2b[_0xfb8e('0x5d')][0x6][_0xfb8e('0x5e')]:undefined)||''},{'name':_0xfb8e('0x6e'),'value':_0x446a2b[_0xfb8e('0x6e')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x7]?_0x446a2b[_0xfb8e('0x5d')][0x7][_0xfb8e('0x5e')]:undefined)||''},{'name':_0xfb8e('0x6f'),'value':_0x446a2b[_0xfb8e('0x6f')]||(_0x446a2b['attrs']&&_0x446a2b[_0xfb8e('0x5d')][0x8]?_0x446a2b[_0xfb8e('0x5d')][0x8][_0xfb8e('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x446a2b[_0xfb8e('0x70')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x9]?_0x446a2b[_0xfb8e('0x5d')][0x9][_0xfb8e('0x5e')]:undefined)||''}];case'multibar-chart':case _0xfb8e('0x71'):return[{'name':_0xfb8e('0x72'),'value':_0x446a2b[_0xfb8e('0x72')]||(_0x446a2b['attrs']&&_0x446a2b['attrs'][0x0]?_0x446a2b[_0xfb8e('0x5d')][0x0][_0xfb8e('0x5e')]:undefined)||'total'},{'name':_0xfb8e('0x73'),'value':_0x446a2b['attrSerie2']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x1]?_0x446a2b[_0xfb8e('0x5d')][0x1][_0xfb8e('0x5e')]:undefined)||null},{'name':_0xfb8e('0x74'),'value':_0x446a2b[_0xfb8e('0x74')]||(_0x446a2b['attrs']&&_0x446a2b['attrs'][0x2]?_0x446a2b[_0xfb8e('0x5d')][0x2][_0xfb8e('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x446a2b[_0xfb8e('0x75')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x3]?_0x446a2b[_0xfb8e('0x5d')][0x3][_0xfb8e('0x5e')]:undefined)||[]},{'name':_0xfb8e('0x69'),'value':_0x446a2b[_0xfb8e('0x69')]||(_0x446a2b['attrs']&&_0x446a2b[_0xfb8e('0x5d')][0x4]?_0x446a2b[_0xfb8e('0x5d')][0x4][_0xfb8e('0x5e')]:undefined)||_0xfb8e('0x6a')},{'name':_0xfb8e('0x6b'),'value':_0x446a2b[_0xfb8e('0x6b')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b['attrs'][0x5]?_0x446a2b['attrs'][0x5][_0xfb8e('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x446a2b[_0xfb8e('0x6c')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x6]?_0x446a2b[_0xfb8e('0x5d')][0x6][_0xfb8e('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x446a2b['attrSmsAccounts']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x7]?_0x446a2b[_0xfb8e('0x5d')][0x7]['value']:undefined)||''},{'name':_0xfb8e('0x6e'),'value':_0x446a2b[_0xfb8e('0x6e')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x8]?_0x446a2b[_0xfb8e('0x5d')][0x8][_0xfb8e('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x446a2b[_0xfb8e('0x6f')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x9]?_0x446a2b[_0xfb8e('0x5d')][0x9][_0xfb8e('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x446a2b['attrChatWebsites']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0xa]?_0x446a2b[_0xfb8e('0x5d')][0xa][_0xfb8e('0x5e')]:undefined)||''}];case _0xfb8e('0x76'):return[{'name':'attrReport','type':_0x446a2b[_0xfb8e('0x77')]||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x0]?_0x446a2b['attrs'][0x0][_0xfb8e('0x34')]:undefined)||null,'value':_0x446a2b['attrReport']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x0]?_0x446a2b[_0xfb8e('0x5d')][0x0]['value']:undefined)||null},{'name':_0xfb8e('0x78'),'value':_0x446a2b['attrRefresh']||(_0x446a2b[_0xfb8e('0x5d')]&&_0x446a2b[_0xfb8e('0x5d')][0x1]?_0x446a2b[_0xfb8e('0x5d')][0x1][_0xfb8e('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x583fc2){logger[_0xfb8e('0x2c')]('widgetAttributes:\x20%s',JSON[_0xfb8e('0x79')](_0x583fc2));return[];}}exports['addItem']=function(_0xa408bd,_0x99cdda,_0x3bb6d7){if(_0xa408bd['body']['id']){delete _0xa408bd[_0xfb8e('0x4f')]['id'];}return db['Dashboard'][_0xfb8e('0x4d')]({'where':{'id':_0xa408bd[_0xfb8e('0x4a')]['id']}})[_0xfb8e('0x26')](handleEntityNotFound(_0x99cdda,null))[_0xfb8e('0x26')](function(_0x51fca8){if(_0x51fca8){_0xa408bd[_0xfb8e('0x4f')][_0xfb8e('0x7a')]=_0x51fca8['id'];_0xa408bd[_0xfb8e('0x4f')][_0xfb8e('0x5d')]=widgetAttributes(_0xa408bd['body']);return db[_0xfb8e('0x7b')]['create'](_0xa408bd[_0xfb8e('0x4f')]);}})[_0xfb8e('0x26')](respondWithResult(_0x99cdda,null))[_0xfb8e('0x54')](handleError(_0x99cdda,null));};exports[_0xfb8e('0x7c')]=function(_0x3ee969,_0x3a8c60,_0x2d730e){var _0x5c2db7={};var _0x31bacc={};var _0x1a494b;var _0x1218be;return db['Dashboard'][_0xfb8e('0x7d')]({'where':{'id':_0x3ee969['params']['id']}})[_0xfb8e('0x26')](handleEntityNotFound(_0x3a8c60,null))[_0xfb8e('0x26')](function(_0x27b695){if(_0x27b695){_0x1a494b=_0x27b695;_0x31bacc['model']=_[_0xfb8e('0x37')](db['DashboardItem'][_0xfb8e('0x32')]);_0x31bacc[_0xfb8e('0x36')]=_[_0xfb8e('0x37')](_0x3ee969[_0xfb8e('0x36')]);_0x31bacc[_0xfb8e('0x40')]=_[_0xfb8e('0x38')](_0x31bacc[_0xfb8e('0x39')],_0x31bacc[_0xfb8e('0x36')]);_0x5c2db7[_0xfb8e('0x3a')]=_[_0xfb8e('0x38')](_0x31bacc[_0xfb8e('0x39')],qs[_0xfb8e('0x4b')](_0x3ee969[_0xfb8e('0x36')][_0xfb8e('0x4b')]));_0x5c2db7[_0xfb8e('0x3a')]=_0x5c2db7[_0xfb8e('0x3a')][_0xfb8e('0x3b')]?_0x5c2db7[_0xfb8e('0x3a')]:_0x31bacc[_0xfb8e('0x39')];_0x5c2db7[_0xfb8e('0x3d')]=qs[_0xfb8e('0x3e')](_0x3ee969[_0xfb8e('0x36')]['sort']);_0x5c2db7[_0xfb8e('0x3f')]=qs[_0xfb8e('0x40')](_['pick'](_0x3ee969[_0xfb8e('0x36')],_0x31bacc[_0xfb8e('0x40')]));if(_0x3ee969[_0xfb8e('0x36')]['filter']){_0x5c2db7[_0xfb8e('0x3f')]=_[_0xfb8e('0x43')](_0x5c2db7['where'],{'$or':_[_0xfb8e('0x30')](_0x5c2db7[_0xfb8e('0x3a')],function(_0x432b3b){var _0x1e6fd5={};_0x1e6fd5[_0x432b3b]={'$like':'%'+_0x3ee969[_0xfb8e('0x36')][_0xfb8e('0x42')]+'%'};return _0x1e6fd5;})});}_0x5c2db7=_[_0xfb8e('0x43')]({},_0x5c2db7,_0x3ee969['options']);return _0x1a494b['getItems'](_0x5c2db7);}})[_0xfb8e('0x26')](function(_0x249e95){if(_0x249e95){_0x1218be=_0x249e95[_0xfb8e('0x3b')];if(!_0x3ee969[_0xfb8e('0x36')][_0xfb8e('0x7e')]('nolimit')){_0x5c2db7[_0xfb8e('0x20')]=qs[_0xfb8e('0x20')](_0x3ee969['query']['limit']);_0x5c2db7['offset']=qs['offset'](_0x3ee969[_0xfb8e('0x36')][_0xfb8e('0x1d')]);}return _0x1a494b[_0xfb8e('0x7c')](_0x5c2db7);}})[_0xfb8e('0x26')](function(_0x49e193){if(_0x49e193){return _0x49e193?{'count':_0x1218be,'rows':_0x49e193}:null;}})[_0xfb8e('0x26')](respondWithResult(_0x3a8c60,null))[_0xfb8e('0x54')](handleError(_0x3a8c60,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 97f46eb..46cbac8 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 _0x0379=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x5e3e6c,_0x5e631d){var _0x213228=function(_0x55e506){while(--_0x55e506){_0x5e3e6c['push'](_0x5e3e6c['shift']());}};_0x213228(++_0x5e631d);}(_0x0379,0xe8));var _0x9037=function(_0x1c20ed,_0x5c4c13){_0x1c20ed=_0x1c20ed-0x0;var _0x3fe93d=_0x0379[_0x1c20ed];return _0x3fe93d;};'use strict';var EventEmitter=require(_0x9037('0x0'));var Dashboard=require(_0x9037('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9037('0x2')](0x0);var events={'afterCreate':_0x9037('0x3'),'afterUpdate':'update','afterDestroy':_0x9037('0x4')};function emitEvent(_0x2873e1){return function(_0xf58ba6,_0x1e15f2,_0x1e1856){DashboardEvents[_0x9037('0x5')](_0x2873e1+':'+_0xf58ba6['id'],_0xf58ba6);DashboardEvents[_0x9037('0x5')](_0x2873e1,_0xf58ba6);_0x1e1856(null);};}for(var e in events){if(events[_0x9037('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xacea=['Dashboard','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3deb7b,_0x5c4502){var _0x474d5a=function(_0x59cb1d){while(--_0x59cb1d){_0x3deb7b['push'](_0x3deb7b['shift']());}};_0x474d5a(++_0x5c4502);}(_0xacea,0x1d2));var _0xaace=function(_0x1ffaf5,_0x5c488d){_0x1ffaf5=_0x1ffaf5-0x0;var _0x26b504=_0xacea[_0x1ffaf5];return _0x26b504;};'use strict';var EventEmitter=require(_0xaace('0x0'));var Dashboard=require(_0xaace('0x1'))['db'][_0xaace('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaace('0x3'),'afterUpdate':_0xaace('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e3e4c){return function(_0x5bbad5,_0x3917a6,_0x34c476){DashboardEvents[_0xaace('0x5')](_0x3e3e4c+':'+_0x5bbad5['id'],_0x5bbad5);DashboardEvents[_0xaace('0x5')](_0x3e3e4c,_0x5bbad5);_0x34c476(null);};}for(var e in events){if(events[_0xaace('0x6')](e)){var event=events[e];Dashboard[_0xaace('0x7')](e,emitEvent(event));}}module[_0xaace('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e8f5830..fe91682 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 _0x1f0b=['request-promise','path','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api','moment'];(function(_0x366fe1,_0x2c1d33){var _0x5a61c7=function(_0x1b9a60){while(--_0x1b9a60){_0x366fe1['push'](_0x366fe1['shift']());}};_0x5a61c7(++_0x2c1d33);}(_0x1f0b,0x1d5));var _0xb1f0=function(_0x4ed239,_0x3bb2d8){_0x4ed239=_0x4ed239-0x0;var _0x19b898=_0x1f0b[_0x4ed239];return _0x19b898;};'use strict';var _=require(_0xb1f0('0x0'));var util=require(_0xb1f0('0x1'));var logger=require('../../config/logger')(_0xb1f0('0x2'));var moment=require(_0xb1f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1f0('0x4'));var fs=require('fs');var path=require(_0xb1f0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb1f0('0x6'));module[_0xb1f0('0x7')]=function(_0x3d8ac3,_0x5622e6){return _0x3d8ac3[_0xb1f0('0x8')](_0xb1f0('0x9'),attributes,{'tableName':_0xb1f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x879f=['moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x879f,0xea));var _0xf879=function(_0x2e7441,_0x1d0abd){_0x2e7441=_0x2e7441-0x0;var _0x5d46d0=_0x879f[_0x2e7441];return _0x5d46d0;};'use strict';var _=require(_0xf879('0x0'));var util=require(_0xf879('0x1'));var logger=require(_0xf879('0x2'))(_0xf879('0x3'));var moment=require(_0xf879('0x4'));var BPromise=require(_0xf879('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf879('0x6'));var rimraf=require(_0xf879('0x7'));var config=require(_0xf879('0x8'));var attributes=require(_0xf879('0x9'));module[_0xf879('0xa')]=function(_0x3e68b9,_0x15712e){return _0x3e68b9[_0xf879('0xb')](_0xf879('0xc'),attributes,{'tableName':_0xf879('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 697c5eb..66d0d7a 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 _0xc794=['randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_0xc794,0x9d));var _0x4c79=function(_0x38f057,_0x5cbc67){_0x38f057=_0x38f057-0x0;var _0x289965=_0xc794[_0x38f057];return _0x289965;};'use strict';var _=require(_0x4c79('0x0'));var util=require(_0x4c79('0x1'));var moment=require(_0x4c79('0x2'));var BPromise=require(_0x4c79('0x3'));var rs=require(_0x4c79('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c79('0x5'))['db'];var utils=require(_0x4c79('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4c79('0x7'));var client=jayson[_0x4c79('0x8')][_0x4c79('0x9')]({'port':0x232a});config[_0x4c79('0xa')]=_[_0x4c79('0xb')](config[_0x4c79('0xa')],{'host':_0x4c79('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c79('0xa')]));require(_0x4c79('0xd'))['register'](socket);function respondWithRpcPromise(_0x76c288,_0x1d7669,_0x5dd8ef){return new BPromise(function(_0x58d06d,_0x452197){return client['request'](_0x76c288,_0x5dd8ef)['then'](function(_0x4ad61b){logger['info']('Dashboard,\x20%s,\x20%s',_0x1d7669,'request\x20sent');logger[_0x4c79('0xe')](_0x4c79('0xf'),_0x1d7669,_0x4c79('0x10'),JSON['stringify'](_0x4ad61b));if(_0x4ad61b[_0x4c79('0x11')]){if(_0x4ad61b[_0x4c79('0x11')][_0x4c79('0x12')]===0x1f4){logger[_0x4c79('0x11')](_0x4c79('0x13'),_0x1d7669,_0x4ad61b[_0x4c79('0x11')]['message']);return _0x452197(_0x4ad61b['error'][_0x4c79('0x14')]);}logger[_0x4c79('0x11')](_0x4c79('0x13'),_0x1d7669,_0x4ad61b[_0x4c79('0x11')][_0x4c79('0x14')]);return _0x58d06d(_0x4ad61b[_0x4c79('0x11')][_0x4c79('0x14')]);}else{logger['info'](_0x4c79('0x13'),_0x1d7669,_0x4c79('0x10'));_0x58d06d(_0x4ad61b[_0x4c79('0x15')]['message']);}})[_0x4c79('0x16')](function(_0x3a3ded){logger[_0x4c79('0x11')](_0x4c79('0x13'),_0x1d7669,_0x3a3ded);_0x452197(_0x3a3ded);});});} \ No newline at end of file +var _0x28b4=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x360afc,_0x1a370e){var _0xf3790a=function(_0x31735d){while(--_0x31735d){_0x360afc['push'](_0x360afc['shift']());}};_0xf3790a(++_0x1a370e);}(_0x28b4,0x18d));var _0x428b=function(_0x18199d,_0x31c92c){_0x18199d=_0x18199d-0x0;var _0x101da8=_0x28b4[_0x18199d];return _0x101da8;};'use strict';var _=require(_0x428b('0x0'));var util=require('util');var moment=require(_0x428b('0x1'));var BPromise=require(_0x428b('0x2'));var rs=require(_0x428b('0x3'));var fs=require('fs');var Redis=require(_0x428b('0x4'));var db=require(_0x428b('0x5'))['db'];var utils=require(_0x428b('0x6'));var logger=require(_0x428b('0x7'))(_0x428b('0x8'));var config=require(_0x428b('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x428b('0xa')]=_[_0x428b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x428b('0xc'))(new Redis(config[_0x428b('0xa')]));require(_0x428b('0xd'))[_0x428b('0xe')](socket);function respondWithRpcPromise(_0x4be0b8,_0x216038,_0x5efb54){return new BPromise(function(_0x4ae26c,_0x1b0f86){return client[_0x428b('0xf')](_0x4be0b8,_0x5efb54)[_0x428b('0x10')](function(_0x516ead){logger[_0x428b('0x11')](_0x428b('0x12'),_0x216038,_0x428b('0x13'));logger[_0x428b('0x14')](_0x428b('0x15'),_0x216038,_0x428b('0x13'),JSON['stringify'](_0x516ead));if(_0x516ead['error']){if(_0x516ead[_0x428b('0x16')][_0x428b('0x17')]===0x1f4){logger[_0x428b('0x16')]('Dashboard,\x20%s,\x20%s',_0x216038,_0x516ead[_0x428b('0x16')][_0x428b('0x18')]);return _0x1b0f86(_0x516ead[_0x428b('0x16')]['message']);}logger[_0x428b('0x16')]('Dashboard,\x20%s,\x20%s',_0x216038,_0x516ead[_0x428b('0x16')][_0x428b('0x18')]);return _0x4ae26c(_0x516ead['error']['message']);}else{logger[_0x428b('0x11')](_0x428b('0x12'),_0x216038,_0x428b('0x13'));_0x4ae26c(_0x516ead['result'][_0x428b('0x18')]);}})[_0x428b('0x19')](function(_0x42798){logger[_0x428b('0x16')](_0x428b('0x12'),_0x216038,_0x42798);_0x1b0f86(_0x42798);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 19970ef..4d409ea 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 _0x033a=['save','remove','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x2766ea,_0x62b027){var _0x18b1f3=function(_0x9b5c2e){while(--_0x9b5c2e){_0x2766ea['push'](_0x2766ea['shift']());}};_0x18b1f3(++_0x62b027);}(_0x033a,0x157));var _0xa033=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x033a[_0x13b330];return _0x1f666c;};'use strict';var DashboardEvents=require(_0xa033('0x0'));var events=[_0xa033('0x1'),_0xa033('0x2'),'update'];function createListener(_0x1c8bbc,_0x353dc3){return function(_0x3d85d0){_0x353dc3[_0xa033('0x3')](_0x1c8bbc,_0x3d85d0);};}function removeListener(_0x374b21,_0x50e6d0){return function(){DashboardEvents[_0xa033('0x4')](_0x374b21,_0x50e6d0);};}exports[_0xa033('0x5')]=function(_0x5e7b9e){for(var _0x44e7b7=0x0,_0x242900=events[_0xa033('0x6')];_0x44e7b7<_0x242900;_0x44e7b7++){var _0x139fc7=events[_0x44e7b7];var _0x168a4f=createListener(_0xa033('0x7')+_0x139fc7,_0x5e7b9e);DashboardEvents['on'](_0x139fc7,_0x168a4f);}}; \ No newline at end of file +var _0xaf8b=['dashboard:','./dashboard.events','remove','update','emit','removeListener','length'];(function(_0x400672,_0x243a7e){var _0x27ed65=function(_0x350ca9){while(--_0x350ca9){_0x400672['push'](_0x400672['shift']());}};_0x27ed65(++_0x243a7e);}(_0xaf8b,0xbe));var _0xbaf8=function(_0x32ac38,_0x262bad){_0x32ac38=_0x32ac38-0x0;var _0x43335f=_0xaf8b[_0x32ac38];return _0x43335f;};'use strict';var DashboardEvents=require(_0xbaf8('0x0'));var events=['save',_0xbaf8('0x1'),_0xbaf8('0x2')];function createListener(_0x2162e1,_0x33dceb){return function(_0x3f85b6){_0x33dceb[_0xbaf8('0x3')](_0x2162e1,_0x3f85b6);};}function removeListener(_0x2fec19,_0x13e25a){return function(){DashboardEvents[_0xbaf8('0x4')](_0x2fec19,_0x13e25a);};}exports['register']=function(_0x5f31ff){for(var _0x90523b=0x0,_0x13dc1b=events[_0xbaf8('0x5')];_0x90523b<_0x13dc1b;_0x90523b++){var _0x513325=events[_0x90523b];var _0x1f95bf=createListener(_0xbaf8('0x6')+_0x513325,_0x5f31ff);DashboardEvents['on'](_0x513325,_0x1f95bf);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1e9b41a..727a9e3 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 _0xb2b8=['put','/:id','update','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x2d63e2,_0x1e2dd0){var _0x58c724=function(_0xc8e339){while(--_0xc8e339){_0x2d63e2['push'](_0x2d63e2['shift']());}};_0x58c724(++_0x1e2dd0);}(_0xb2b8,0x17f));var _0x8b2b=function(_0x17a052,_0x290e66){_0x17a052=_0x17a052-0x0;var _0x59b1f1=_0xb2b8[_0x17a052];return _0x59b1f1;};'use strict';var multer=require('multer');var util=require(_0x8b2b('0x0'));var path=require(_0x8b2b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b2b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8b2b('0x3'));var interaction=require(_0x8b2b('0x4'));var config=require(_0x8b2b('0x5'));var controller=require(_0x8b2b('0x6'));router[_0x8b2b('0x7')]('/',auth[_0x8b2b('0x8')](),controller['index']);router[_0x8b2b('0x7')]('/:id',auth[_0x8b2b('0x8')](),controller[_0x8b2b('0x9')]);router[_0x8b2b('0x7')](_0x8b2b('0xa'),auth[_0x8b2b('0x8')](),controller[_0x8b2b('0xb')]);router[_0x8b2b('0xc')]('/',auth['isAuthenticated'](),controller[_0x8b2b('0xd')]);router[_0x8b2b('0xc')](_0x8b2b('0xe'),auth[_0x8b2b('0x8')](),controller[_0x8b2b('0xf')]);router['post']('/:id/items',auth['isAuthenticated'](),controller['addItem']);router[_0x8b2b('0x10')](_0x8b2b('0x11'),auth[_0x8b2b('0x8')](),controller[_0x8b2b('0x12')]);router['delete'](_0x8b2b('0x11'),auth[_0x8b2b('0x8')](),controller[_0x8b2b('0x13')]);module[_0x8b2b('0x14')]=router; \ No newline at end of file +var _0xa44d=['update','delete','destroy','exports','path','express','Router','../../components/auth/service','index','get','/:id','isAuthenticated','show','getItems','post','create','clone','/:id/items','addItem'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa44d,0x76));var _0xda44=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xa44d[_0x148879];return _0x4f7027;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda44('0x0'));var timeout=require('connect-timeout');var express=require(_0xda44('0x1'));var router=express[_0xda44('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xda44('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xda44('0x4')]);router[_0xda44('0x5')](_0xda44('0x6'),auth[_0xda44('0x7')](),controller[_0xda44('0x8')]);router['get']('/:id/items',auth[_0xda44('0x7')](),controller[_0xda44('0x9')]);router[_0xda44('0xa')]('/',auth[_0xda44('0x7')](),controller[_0xda44('0xb')]);router[_0xda44('0xa')]('/:id/clone',auth['isAuthenticated'](),controller[_0xda44('0xc')]);router[_0xda44('0xa')](_0xda44('0xd'),auth[_0xda44('0x7')](),controller[_0xda44('0xe')]);router['put'](_0xda44('0x6'),auth['isAuthenticated'](),controller[_0xda44('0xf')]);router[_0xda44('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xda44('0x11')]);module[_0xda44('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 24f3c9c..03e616e 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 _0xe3da=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize'];(function(_0x13939a,_0x162cee){var _0x9d3ba7=function(_0x2f9ada){while(--_0x2f9ada){_0x13939a['push'](_0x13939a['shift']());}};_0x9d3ba7(++_0x162cee);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xae3d('0x0'));var squel=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));module[_0xae3d('0x3')]={'title':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xae3d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){try{return JSON[_0xae3d('0x7')](this[_0xae3d('0x8')](_0xae3d('0x9')));}catch(_0x26282d){return[];}},'set':function(_0xa9a1a){try{this[_0xae3d('0xa')](_0xae3d('0x9'),JSON[_0xae3d('0xb')](_0xa9a1a));}catch(_0x583b98){this[_0xae3d('0xa')](_0xae3d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xae3d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xae3d('0xc')]},'col':{'type':Sequelize[_0xae3d('0xc')]},'background':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':_0xae3d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xae3d('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xfcf0[_0x2962d5];return _0x273406;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 0c621d4..3ea4294 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 _0x3079=['lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./dashboardItem.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x5f7d79,_0x546143){var _0x577319=function(_0x217aac){while(--_0x217aac){_0x5f7d79['push'](_0x5f7d79['shift']());}};_0x577319(++_0x546143);}(_0x3079,0x110));var _0x9307=function(_0x3ac0f0,_0x4b5b02){_0x3ac0f0=_0x3ac0f0-0x0;var _0x6a2fa6=_0x3079[_0x3ac0f0];return _0x6a2fa6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9307('0x0'));var zipdir=require(_0x9307('0x1'));var jsonpatch=require(_0x9307('0x2'));var rp=require(_0x9307('0x3'));var moment=require('moment');var BPromise=require(_0x9307('0x4'));var Mustache=require(_0x9307('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9307('0x6'));var csv=require(_0x9307('0x7'));var ejs=require(_0x9307('0x8'));var fs=require('fs');var fs_extra=require(_0x9307('0x9'));var _=require(_0x9307('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9307('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9307('0x7'));var querystring=require(_0x9307('0xc'));var Papa=require('papaparse');var Redis=require(_0x9307('0xd'));var authService=require(_0x9307('0xe'));var qs=require(_0x9307('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9307('0x10'))(_0x9307('0x11'));var utils=require(_0x9307('0x12'));var config=require(_0x9307('0x13'));var licenseUtil=require(_0x9307('0x14'));var db=require(_0x9307('0x15'))['db'];config['redis']=_[_0x9307('0x16')](config[_0x9307('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9307('0x17')]));require(_0x9307('0x18'))['register'](socket);function respondWithStatusCode(_0x3d9864,_0x4053e2){_0x4053e2=_0x4053e2||0xcc;return function(_0x545b0a){if(_0x545b0a){return _0x3d9864[_0x9307('0x19')](_0x4053e2);}return _0x3d9864[_0x9307('0x1a')](_0x4053e2)['end']();};}function respondWithResult(_0x3fc6fd,_0x4296e9){_0x4296e9=_0x4296e9||0xc8;return function(_0x100f15){if(_0x100f15){return _0x3fc6fd['status'](_0x4296e9)[_0x9307('0x1b')](_0x100f15);}};}function respondWithFilteredResult(_0x27682a,_0x503338){return function(_0xbba867){if(_0xbba867){var _0x3d84b0=typeof _0x503338[_0x9307('0x1c')]===_0x9307('0x1d')&&typeof _0x503338[_0x9307('0x1e')]===_0x9307('0x1d');var _0x5810d7=_0xbba867[_0x9307('0x1f')];var _0x10aa66=_0x3d84b0?0x0:_0x503338[_0x9307('0x1c')];var _0x58574e=_0x3d84b0?_0xbba867[_0x9307('0x1f')]:_0x503338[_0x9307('0x1c')]+_0x503338['limit'];var _0x307ab9;if(_0x58574e>=_0x5810d7){_0x58574e=_0x5810d7;_0x307ab9=0xc8;}else{_0x307ab9=0xce;}_0x27682a[_0x9307('0x1a')](_0x307ab9);return _0x27682a[_0x9307('0x20')](_0x9307('0x21'),_0x10aa66+'-'+_0x58574e+'/'+_0x5810d7)[_0x9307('0x1b')](_0xbba867);}return null;};}function patchUpdates(_0xf39222){return function(_0x1d671b){try{jsonpatch[_0x9307('0x22')](_0x1d671b,_0xf39222,!![]);}catch(_0x2f5f68){return BPromise[_0x9307('0x23')](_0x2f5f68);}return _0x1d671b[_0x9307('0x24')]();};}function saveUpdates(_0x5d42a0,_0x1e17c5){return function(_0x593f27){if(_0x593f27){return _0x593f27[_0x9307('0x25')](_0x5d42a0)['then'](function(_0x2c59ef){return _0x2c59ef;});}return null;};}function removeEntity(_0x5bb98a,_0x4d1a13){return function(_0x428043){if(_0x428043){return _0x428043[_0x9307('0x26')]()[_0x9307('0x27')](function(){_0x5bb98a[_0x9307('0x1a')](0xcc)[_0x9307('0x28')]();});}};}function handleEntityNotFound(_0xd89e2f,_0x15145d){return function(_0x5927ce){if(!_0x5927ce){_0xd89e2f[_0x9307('0x19')](0x194);}return _0x5927ce;};}function handleError(_0x5e2de0,_0x1da3e3){_0x1da3e3=_0x1da3e3||0x1f4;return function(_0x1c7e60){logger[_0x9307('0x29')](_0x1c7e60['stack']);if(_0x1c7e60[_0x9307('0x2a')]){delete _0x1c7e60['name'];}_0x5e2de0['status'](_0x1da3e3)['send'](_0x1c7e60);};}exports[_0x9307('0x2b')]=function(_0x5c46cd,_0xfe280b){var _0x6a5aa9={'raw':![],'where':{'id':_0x5c46cd[_0x9307('0x2c')]['id']}},_0x3c1764={};_0x3c1764[_0x9307('0x2d')]=_[_0x9307('0x2e')](db['DashboardItem'][_0x9307('0x2f')]);_0x3c1764[_0x9307('0x30')]=_[_0x9307('0x2e')](_0x5c46cd[_0x9307('0x30')]);_0x3c1764[_0x9307('0x31')]=_[_0x9307('0x32')](_0x3c1764[_0x9307('0x2d')],_0x3c1764['query']);_0x6a5aa9['attributes']=_[_0x9307('0x32')](_0x3c1764[_0x9307('0x2d')],qs[_0x9307('0x33')](_0x5c46cd[_0x9307('0x30')][_0x9307('0x33')]));_0x6a5aa9[_0x9307('0x34')]=_0x6a5aa9[_0x9307('0x34')][_0x9307('0x35')]?_0x6a5aa9[_0x9307('0x34')]:_0x3c1764[_0x9307('0x2d')];if(_0x5c46cd['query'][_0x9307('0x36')]){_0x6a5aa9[_0x9307('0x37')]=[{'all':!![]}];}_0x6a5aa9=_[_0x9307('0x38')]({},_0x6a5aa9,_0x5c46cd[_0x9307('0x39')]);return db[_0x9307('0x3a')][_0x9307('0x3b')](_0x6a5aa9)[_0x9307('0x27')](handleEntityNotFound(_0xfe280b,null))[_0x9307('0x27')](respondWithResult(_0xfe280b,null))[_0x9307('0x3c')](handleError(_0xfe280b,null));};exports[_0x9307('0x26')]=function(_0x2ecc1b,_0xdb2956){return db[_0x9307('0x3a')][_0x9307('0x3b')]({'where':{'id':_0x2ecc1b['params']['id']}})[_0x9307('0x27')](handleEntityNotFound(_0xdb2956,null))[_0x9307('0x27')](removeEntity(_0xdb2956,null))[_0x9307('0x3c')](handleError(_0xdb2956,null));};function widgetAttributes(_0x3b6af2){try{switch(_0x3b6af2[_0x9307('0x3d')]){case _0x9307('0x3e'):return[{'name':_0x9307('0x3f'),'value':_0x3b6af2[_0x9307('0x3f')]||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0x0]?_0x3b6af2[_0x9307('0x40')][0x0][_0x9307('0x41')]:undefined)||'https://'}];case _0x9307('0x42'):return[{'name':_0x9307('0x43'),'value':_0x3b6af2[_0x9307('0x43')]||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0x0]?_0x3b6af2[_0x9307('0x40')][0x0][_0x9307('0x41')]:undefined)||''}];case _0x9307('0x44'):return[{'name':'attrHourFormat','value':_0x3b6af2['attrHourFormat']||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x0]?_0x3b6af2[_0x9307('0x40')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x9307('0x45'),'value':_0x3b6af2['attrTimezone']||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x1]?_0x3b6af2['attrs'][0x1][_0x9307('0x41')]:undefined)||_0x9307('0x46')},{'name':_0x9307('0x47'),'value':_0x3b6af2[_0x9307('0x47')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x2]?_0x3b6af2[_0x9307('0x40')][0x2][_0x9307('0x41')]:undefined)||0xc}];case _0x9307('0x48'):return[{'name':'attrMetric','value':_0x3b6af2['attrMetric']||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x0]?_0x3b6af2[_0x9307('0x40')][0x0][_0x9307('0x41')]:undefined)||_0x9307('0x49')},{'name':_0x9307('0x4a'),'value':_0x3b6af2['attrVoiceQueues']||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0x1]?_0x3b6af2[_0x9307('0x40')][0x1]['value']:undefined)||[]},{'name':_0x9307('0x47'),'value':_0x3b6af2['attrFontSize']||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x2]?_0x3b6af2['attrs'][0x2][_0x9307('0x41')]:undefined)||0x14},{'name':_0x9307('0x4b'),'value':_0x3b6af2[_0x9307('0x4b')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x3]?_0x3b6af2[_0x9307('0x40')][0x3][_0x9307('0x41')]:undefined)||_0x9307('0x4c')},{'name':'attrEmailAccounts','value':_0x3b6af2[_0x9307('0x4d')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x4]?_0x3b6af2[_0x9307('0x40')][0x4][_0x9307('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3b6af2[_0x9307('0x4e')]||(_0x3b6af2['attrs']&&_0x3b6af2['attrs'][0x5]?_0x3b6af2[_0x9307('0x40')][0x5][_0x9307('0x41')]:undefined)||''},{'name':_0x9307('0x4f'),'value':_0x3b6af2[_0x9307('0x4f')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2['attrs'][0x6]?_0x3b6af2[_0x9307('0x40')][0x6]['value']:undefined)||''},{'name':_0x9307('0x50'),'value':_0x3b6af2[_0x9307('0x50')]||(_0x3b6af2['attrs']&&_0x3b6af2['attrs'][0x7]?_0x3b6af2[_0x9307('0x40')][0x7][_0x9307('0x41')]:undefined)||''},{'name':_0x9307('0x51'),'value':_0x3b6af2[_0x9307('0x51')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2['attrs'][0x8]?_0x3b6af2[_0x9307('0x40')][0x8][_0x9307('0x41')]:undefined)||''},{'name':_0x9307('0x52'),'value':_0x3b6af2[_0x9307('0x52')]||(_0x3b6af2['attrs']&&_0x3b6af2['attrs'][0x9]?_0x3b6af2['attrs'][0x9][_0x9307('0x41')]:undefined)||''}];case'multibar-chart':case _0x9307('0x53'):return[{'name':'attrSerie1','value':_0x3b6af2[_0x9307('0x54')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x0]?_0x3b6af2['attrs'][0x0][_0x9307('0x41')]:undefined)||_0x9307('0x49')},{'name':'attrSerie2','value':_0x3b6af2[_0x9307('0x55')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2['attrs'][0x1]?_0x3b6af2[_0x9307('0x40')][0x1][_0x9307('0x41')]:undefined)||null},{'name':_0x9307('0x56'),'value':_0x3b6af2[_0x9307('0x56')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x2]?_0x3b6af2[_0x9307('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x3b6af2[_0x9307('0x4a')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x3]?_0x3b6af2['attrs'][0x3][_0x9307('0x41')]:undefined)||[]},{'name':_0x9307('0x4b'),'value':_0x3b6af2['attrChannel']||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x4]?_0x3b6af2[_0x9307('0x40')][0x4]['value']:undefined)||_0x9307('0x4c')},{'name':_0x9307('0x4d'),'value':_0x3b6af2['attrEmailAccounts']||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x5]?_0x3b6af2[_0x9307('0x40')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3b6af2['attrFaxAccounts']||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0x6]?_0x3b6af2[_0x9307('0x40')][0x6][_0x9307('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3b6af2['attrSmsAccounts']||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x7]?_0x3b6af2[_0x9307('0x40')][0x7][_0x9307('0x41')]:undefined)||''},{'name':_0x9307('0x50'),'value':_0x3b6af2[_0x9307('0x50')]||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0x8]?_0x3b6af2[_0x9307('0x40')][0x8][_0x9307('0x41')]:undefined)||''},{'name':_0x9307('0x51'),'value':_0x3b6af2[_0x9307('0x51')]||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0x9]?_0x3b6af2[_0x9307('0x40')][0x9]['value']:undefined)||''},{'name':_0x9307('0x52'),'value':_0x3b6af2[_0x9307('0x52')]||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0xa]?_0x3b6af2[_0x9307('0x40')][0xa]['value']:undefined)||''}];case _0x9307('0x57'):return[{'name':_0x9307('0x58'),'type':_0x3b6af2[_0x9307('0x59')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x0]?_0x3b6af2[_0x9307('0x40')][0x0][_0x9307('0x3d')]:undefined)||null,'value':_0x3b6af2[_0x9307('0x58')]||(_0x3b6af2[_0x9307('0x40')]&&_0x3b6af2[_0x9307('0x40')][0x0]?_0x3b6af2[_0x9307('0x40')][0x0][_0x9307('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x3b6af2[_0x9307('0x5a')]||(_0x3b6af2['attrs']&&_0x3b6af2[_0x9307('0x40')][0x1]?_0x3b6af2[_0x9307('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1aa112){logger[_0x9307('0x29')]('widgetAttributes:\x20%s',JSON[_0x9307('0x5b')](_0x1aa112));return[];}}exports[_0x9307('0x5c')]=function(_0xdb251b,_0x400b96){if(_0xdb251b[_0x9307('0x5d')]){_0xdb251b[_0x9307('0x5d')]['attrs']=widgetAttributes(_0xdb251b[_0x9307('0x5d')]);}return db[_0x9307('0x3a')][_0x9307('0x5c')](_0xdb251b['body'],{})[_0x9307('0x27')](respondWithResult(_0x400b96,0xc9))[_0x9307('0x3c')](handleError(_0x400b96,null));};exports[_0x9307('0x25')]=function(_0x5bd192,_0x16a62b){if(_0x5bd192[_0x9307('0x5d')]['id']){delete _0x5bd192['body']['id'];}_0x5bd192[_0x9307('0x5d')][_0x9307('0x40')]=widgetAttributes(_0x5bd192[_0x9307('0x5d')]);return db[_0x9307('0x3a')][_0x9307('0x3b')]({'where':{'id':_0x5bd192['params']['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x16a62b,null))[_0x9307('0x27')](saveUpdates(_0x5bd192['body'],null))['then'](respondWithResult(_0x16a62b,null))[_0x9307('0x3c')](handleError(_0x16a62b,null));}; \ No newline at end of file +var _0x0f4d=['attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','params','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','include','merge','find','catch','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2'];(function(_0x10ab8f,_0x39c0d7){var _0x560d77=function(_0x5698b6){while(--_0x5698b6){_0x10ab8f['push'](_0x10ab8f['shift']());}};_0x560d77(++_0x39c0d7);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x357bb8,_0x43113e){_0x357bb8=_0x357bb8-0x0;var _0x32d46b=_0x0f4d[_0x357bb8];return _0x32d46b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f4('0x0'));var rp=require('request-promise');var moment=require(_0xd0f4('0x1'));var BPromise=require(_0xd0f4('0x2'));var Mustache=require(_0xd0f4('0x3'));var util=require(_0xd0f4('0x4'));var path=require(_0xd0f4('0x5'));var sox=require(_0xd0f4('0x6'));var csv=require(_0xd0f4('0x7'));var ejs=require(_0xd0f4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0f4('0x9'));var squel=require(_0xd0f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xd0f4('0xb'));var deskjs=require(_0xd0f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd0f4('0xd'));var Papa=require(_0xd0f4('0xe'));var Redis=require('ioredis');var authService=require(_0xd0f4('0xf'));var qs=require(_0xd0f4('0x10'));var as=require(_0xd0f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0f4('0x12'));var utils=require(_0xd0f4('0x13'));var config=require(_0xd0f4('0x14'));var licenseUtil=require(_0xd0f4('0x15'));var db=require(_0xd0f4('0x16'))['db'];config[_0xd0f4('0x17')]=_[_0xd0f4('0x18')](config['redis'],{'host':_0xd0f4('0x19'),'port':0x18eb});var socket=require(_0xd0f4('0x1a'))(new Redis(config['redis']));require(_0xd0f4('0x1b'))['register'](socket);function respondWithStatusCode(_0x828792,_0x48254a){_0x48254a=_0x48254a||0xcc;return function(_0x401779){if(_0x401779){return _0x828792['sendStatus'](_0x48254a);}return _0x828792['status'](_0x48254a)['end']();};}function respondWithResult(_0x45b32e,_0x320d37){_0x320d37=_0x320d37||0xc8;return function(_0xe37a0d){if(_0xe37a0d){return _0x45b32e[_0xd0f4('0x1c')](_0x320d37)[_0xd0f4('0x1d')](_0xe37a0d);}};}function respondWithFilteredResult(_0x10acbe,_0xe8cefc){return function(_0x35be48){if(_0x35be48){var _0x247cff=typeof _0xe8cefc['offset']===_0xd0f4('0x1e')&&typeof _0xe8cefc[_0xd0f4('0x1f')]===_0xd0f4('0x1e');var _0xa0662=_0x35be48['count'];var _0x11d9ba=_0x247cff?0x0:_0xe8cefc[_0xd0f4('0x20')];var _0x171ccc=_0x247cff?_0x35be48[_0xd0f4('0x21')]:_0xe8cefc['offset']+_0xe8cefc[_0xd0f4('0x1f')];var _0xda1d14;if(_0x171ccc>=_0xa0662){_0x171ccc=_0xa0662;_0xda1d14=0xc8;}else{_0xda1d14=0xce;}_0x10acbe[_0xd0f4('0x1c')](_0xda1d14);return _0x10acbe[_0xd0f4('0x22')](_0xd0f4('0x23'),_0x11d9ba+'-'+_0x171ccc+'/'+_0xa0662)[_0xd0f4('0x1d')](_0x35be48);}return null;};}function patchUpdates(_0x25ee43){return function(_0x4d3a99){try{jsonpatch[_0xd0f4('0x24')](_0x4d3a99,_0x25ee43,!![]);}catch(_0x327696){return BPromise[_0xd0f4('0x25')](_0x327696);}return _0x4d3a99[_0xd0f4('0x26')]();};}function saveUpdates(_0x4d49c0,_0x14ffba){return function(_0x524d73){if(_0x524d73){return _0x524d73[_0xd0f4('0x27')](_0x4d49c0)[_0xd0f4('0x28')](function(_0x1cf493){return _0x1cf493;});}return null;};}function removeEntity(_0x567eb4,_0x42d944){return function(_0x96fae){if(_0x96fae){return _0x96fae[_0xd0f4('0x29')]()[_0xd0f4('0x28')](function(){_0x567eb4[_0xd0f4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3860e8,_0x269fdd){return function(_0x1b36c2){if(!_0x1b36c2){_0x3860e8[_0xd0f4('0x2a')](0x194);}return _0x1b36c2;};}function handleError(_0x31c48c,_0x17d563){_0x17d563=_0x17d563||0x1f4;return function(_0x1d3246){logger[_0xd0f4('0x2b')](_0x1d3246[_0xd0f4('0x2c')]);if(_0x1d3246['name']){delete _0x1d3246[_0xd0f4('0x2d')];}_0x31c48c[_0xd0f4('0x1c')](_0x17d563)[_0xd0f4('0x2e')](_0x1d3246);};}exports[_0xd0f4('0x2f')]=function(_0x5bf441,_0x4058d7){var _0x52a22a={'raw':![],'where':{'id':_0x5bf441['params']['id']}},_0x4f92a9={};_0x4f92a9[_0xd0f4('0x30')]=_[_0xd0f4('0x31')](db[_0xd0f4('0x32')][_0xd0f4('0x33')]);_0x4f92a9[_0xd0f4('0x34')]=_[_0xd0f4('0x31')](_0x5bf441[_0xd0f4('0x34')]);_0x4f92a9[_0xd0f4('0x35')]=_['intersection'](_0x4f92a9[_0xd0f4('0x30')],_0x4f92a9['query']);_0x52a22a[_0xd0f4('0x36')]=_[_0xd0f4('0x37')](_0x4f92a9['model'],qs['fields'](_0x5bf441[_0xd0f4('0x34')]['fields']));_0x52a22a[_0xd0f4('0x36')]=_0x52a22a[_0xd0f4('0x36')]['length']?_0x52a22a[_0xd0f4('0x36')]:_0x4f92a9[_0xd0f4('0x30')];if(_0x5bf441['query']['includeAll']){_0x52a22a[_0xd0f4('0x38')]=[{'all':!![]}];}_0x52a22a=_[_0xd0f4('0x39')]({},_0x52a22a,_0x5bf441['options']);return db[_0xd0f4('0x32')]['find'](_0x52a22a)[_0xd0f4('0x28')](handleEntityNotFound(_0x4058d7,null))[_0xd0f4('0x28')](respondWithResult(_0x4058d7,null))['catch'](handleError(_0x4058d7,null));};exports[_0xd0f4('0x29')]=function(_0x202535,_0x40e383){return db[_0xd0f4('0x32')][_0xd0f4('0x3a')]({'where':{'id':_0x202535['params']['id']}})[_0xd0f4('0x28')](handleEntityNotFound(_0x40e383,null))[_0xd0f4('0x28')](removeEntity(_0x40e383,null))[_0xd0f4('0x3b')](handleError(_0x40e383,null));};function widgetAttributes(_0x5b1ebc){try{switch(_0x5b1ebc['type']){case _0xd0f4('0x3c'):return[{'name':_0xd0f4('0x3d'),'value':_0x5b1ebc[_0xd0f4('0x3d')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x0]?_0x5b1ebc[_0xd0f4('0x3e')][0x0]['value']:undefined)||_0xd0f4('0x3f')}];case _0xd0f4('0x40'):return[{'name':_0xd0f4('0x41'),'value':_0x5b1ebc['attrPath']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x0]?_0x5b1ebc['attrs'][0x0][_0xd0f4('0x42')]:undefined)||''}];case _0xd0f4('0x43'):return[{'name':'attrHourFormat','value':_0x5b1ebc['attrHourFormat']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x0]?_0x5b1ebc[_0xd0f4('0x3e')][0x0]['value']:undefined)||_0xd0f4('0x44')},{'name':'attrTimezone','value':_0x5b1ebc[_0xd0f4('0x45')]||(_0x5b1ebc['attrs']&&_0x5b1ebc[_0xd0f4('0x3e')][0x1]?_0x5b1ebc[_0xd0f4('0x3e')][0x1][_0xd0f4('0x42')]:undefined)||_0xd0f4('0x46')},{'name':'attrFontSize','value':_0x5b1ebc[_0xd0f4('0x47')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x2]?_0x5b1ebc['attrs'][0x2]['value']:undefined)||0xc}];case _0xd0f4('0x48'):return[{'name':_0xd0f4('0x49'),'value':_0x5b1ebc[_0xd0f4('0x49')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x0]?_0x5b1ebc[_0xd0f4('0x3e')][0x0][_0xd0f4('0x42')]:undefined)||_0xd0f4('0x4a')},{'name':_0xd0f4('0x4b'),'value':_0x5b1ebc[_0xd0f4('0x4b')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x1]?_0x5b1ebc['attrs'][0x1][_0xd0f4('0x42')]:undefined)||[]},{'name':_0xd0f4('0x47'),'value':_0x5b1ebc['attrFontSize']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x2]?_0x5b1ebc[_0xd0f4('0x3e')][0x2][_0xd0f4('0x42')]:undefined)||0x14},{'name':_0xd0f4('0x4c'),'value':_0x5b1ebc[_0xd0f4('0x4c')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc['attrs'][0x3]?_0x5b1ebc[_0xd0f4('0x3e')][0x3][_0xd0f4('0x42')]:undefined)||_0xd0f4('0x4d')},{'name':'attrEmailAccounts','value':_0x5b1ebc[_0xd0f4('0x4e')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x4]?_0x5b1ebc[_0xd0f4('0x3e')][0x4][_0xd0f4('0x42')]:undefined)||''},{'name':_0xd0f4('0x4f'),'value':_0x5b1ebc['attrFaxAccounts']||(_0x5b1ebc['attrs']&&_0x5b1ebc[_0xd0f4('0x3e')][0x5]?_0x5b1ebc[_0xd0f4('0x3e')][0x5][_0xd0f4('0x42')]:undefined)||''},{'name':_0xd0f4('0x50'),'value':_0x5b1ebc['attrSmsAccounts']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x6]?_0x5b1ebc['attrs'][0x6][_0xd0f4('0x42')]:undefined)||''},{'name':_0xd0f4('0x51'),'value':_0x5b1ebc[_0xd0f4('0x51')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x7]?_0x5b1ebc[_0xd0f4('0x3e')][0x7][_0xd0f4('0x42')]:undefined)||''},{'name':_0xd0f4('0x52'),'value':_0x5b1ebc[_0xd0f4('0x52')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x8]?_0x5b1ebc[_0xd0f4('0x3e')][0x8][_0xd0f4('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5b1ebc[_0xd0f4('0x53')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x9]?_0x5b1ebc['attrs'][0x9][_0xd0f4('0x42')]:undefined)||''}];case _0xd0f4('0x54'):case _0xd0f4('0x55'):return[{'name':'attrSerie1','value':_0x5b1ebc[_0xd0f4('0x56')]||(_0x5b1ebc['attrs']&&_0x5b1ebc[_0xd0f4('0x3e')][0x0]?_0x5b1ebc['attrs'][0x0]['value']:undefined)||_0xd0f4('0x4a')},{'name':_0xd0f4('0x57'),'value':_0x5b1ebc[_0xd0f4('0x57')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x1]?_0x5b1ebc[_0xd0f4('0x3e')][0x1]['value']:undefined)||null},{'name':_0xd0f4('0x58'),'value':_0x5b1ebc[_0xd0f4('0x58')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x2]?_0x5b1ebc[_0xd0f4('0x3e')][0x2][_0xd0f4('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5b1ebc[_0xd0f4('0x4b')]||(_0x5b1ebc['attrs']&&_0x5b1ebc['attrs'][0x3]?_0x5b1ebc[_0xd0f4('0x3e')][0x3][_0xd0f4('0x42')]:undefined)||[]},{'name':_0xd0f4('0x4c'),'value':_0x5b1ebc['attrChannel']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x4]?_0x5b1ebc[_0xd0f4('0x3e')][0x4][_0xd0f4('0x42')]:undefined)||_0xd0f4('0x4d')},{'name':_0xd0f4('0x4e'),'value':_0x5b1ebc[_0xd0f4('0x4e')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x5]?_0x5b1ebc[_0xd0f4('0x3e')][0x5]['value']:undefined)||''},{'name':_0xd0f4('0x4f'),'value':_0x5b1ebc[_0xd0f4('0x4f')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x6]?_0x5b1ebc['attrs'][0x6][_0xd0f4('0x42')]:undefined)||''},{'name':_0xd0f4('0x50'),'value':_0x5b1ebc[_0xd0f4('0x50')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x7]?_0x5b1ebc[_0xd0f4('0x3e')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5b1ebc[_0xd0f4('0x51')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x8]?_0x5b1ebc[_0xd0f4('0x3e')][0x8][_0xd0f4('0x42')]:undefined)||''},{'name':_0xd0f4('0x52'),'value':_0x5b1ebc['attrWhatsappAccounts']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x9]?_0x5b1ebc[_0xd0f4('0x3e')][0x9]['value']:undefined)||''},{'name':_0xd0f4('0x53'),'value':_0x5b1ebc[_0xd0f4('0x53')]||(_0x5b1ebc['attrs']&&_0x5b1ebc['attrs'][0xa]?_0x5b1ebc[_0xd0f4('0x3e')][0xa]['value']:undefined)||''}];case _0xd0f4('0x59'):return[{'name':_0xd0f4('0x5a'),'type':_0x5b1ebc['reportType']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x0]?_0x5b1ebc['attrs'][0x0][_0xd0f4('0x5b')]:undefined)||null,'value':_0x5b1ebc[_0xd0f4('0x5a')]||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc['attrs'][0x0]?_0x5b1ebc['attrs'][0x0][_0xd0f4('0x42')]:undefined)||null},{'name':_0xd0f4('0x5c'),'value':_0x5b1ebc['attrRefresh']||(_0x5b1ebc[_0xd0f4('0x3e')]&&_0x5b1ebc[_0xd0f4('0x3e')][0x1]?_0x5b1ebc['attrs'][0x1][_0xd0f4('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x1bba7d){logger[_0xd0f4('0x2b')](_0xd0f4('0x5d'),JSON[_0xd0f4('0x5e')](_0x1bba7d));return[];}}exports['create']=function(_0xd224c6,_0x5740b3){if(_0xd224c6[_0xd0f4('0x5f')]){_0xd224c6[_0xd0f4('0x5f')][_0xd0f4('0x3e')]=widgetAttributes(_0xd224c6[_0xd0f4('0x5f')]);}return db[_0xd0f4('0x32')]['create'](_0xd224c6['body'],{})['then'](respondWithResult(_0x5740b3,0xc9))[_0xd0f4('0x3b')](handleError(_0x5740b3,null));};exports[_0xd0f4('0x27')]=function(_0x36311e,_0x2f6423){if(_0x36311e[_0xd0f4('0x5f')]['id']){delete _0x36311e[_0xd0f4('0x5f')]['id'];}_0x36311e[_0xd0f4('0x5f')][_0xd0f4('0x3e')]=widgetAttributes(_0x36311e[_0xd0f4('0x5f')]);return db[_0xd0f4('0x32')][_0xd0f4('0x3a')]({'where':{'id':_0x36311e[_0xd0f4('0x60')]['id']}})['then'](handleEntityNotFound(_0x2f6423,null))['then'](saveUpdates(_0x36311e[_0xd0f4('0x5f')],null))['then'](respondWithResult(_0x2f6423,null))[_0xd0f4('0x3b')](handleError(_0x2f6423,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 197920e..8752128 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 _0x028a=['update','remove','emit','hook','exports','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x2c1103,_0x151f85){var _0x21a953=function(_0x5e1e41){while(--_0x5e1e41){_0x2c1103['push'](_0x2c1103['shift']());}};_0x21a953(++_0x151f85);}(_0x028a,0x1b5));var _0xa028=function(_0x2b5632,_0x275680){_0x2b5632=_0x2b5632-0x0;var _0x242978=_0x028a[_0x2b5632];return _0x242978;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xa028('0x0'))['db'][_0xa028('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa028('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa028('0x3'),'afterDestroy':_0xa028('0x4')};function emitEvent(_0x131492){return function(_0x290e46,_0x332373,_0x44891e){DashboardItemEvents[_0xa028('0x5')](_0x131492+':'+_0x290e46['id'],_0x290e46);DashboardItemEvents['emit'](_0x131492,_0x290e46);_0x44891e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xa028('0x6')](e,emitEvent(event));}}module[_0xa028('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x3f1b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3f1b,0xcc));var _0xb3f1=function(_0x3b0091,_0x531358){_0x3b0091=_0x3b0091-0x0;var _0x23b724=_0x3f1b[_0x3b0091];return _0x23b724;};'use strict';var EventEmitter=require(_0xb3f1('0x0'));var DashboardItem=require(_0xb3f1('0x1'))['db'][_0xb3f1('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb3f1('0x3')](0x0);var events={'afterCreate':_0xb3f1('0x4'),'afterUpdate':_0xb3f1('0x5'),'afterDestroy':_0xb3f1('0x6')};function emitEvent(_0x4376a9){return function(_0x5cfbc7,_0xbf155,_0x41118d){DashboardItemEvents[_0xb3f1('0x7')](_0x4376a9+':'+_0x5cfbc7['id'],_0x5cfbc7);DashboardItemEvents['emit'](_0x4376a9,_0x5cfbc7);_0x41118d(null);};}for(var e in events){if(events[_0xb3f1('0x8')](e)){var event=events[e];DashboardItem[_0xb3f1('0x9')](e,emitEvent(event));}}module[_0xb3f1('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b7a5a6e..ffbcc0f 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 _0x162e=['bluebird','request-promise','path','rimraf','exports','DashboardItem','dashboard_items','../../config/logger','api','moment'];(function(_0x250cb1,_0x283b1a){var _0x2156c6=function(_0x1998b5){while(--_0x1998b5){_0x250cb1['push'](_0x250cb1['shift']());}};_0x2156c6(++_0x283b1a);}(_0x162e,0x75));var _0xe162=function(_0x28a3de,_0x3ceb18){_0x28a3de=_0x28a3de-0x0;var _0x451e02=_0x162e[_0x28a3de];return _0x451e02;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe162('0x0'))(_0xe162('0x1'));var moment=require(_0xe162('0x2'));var BPromise=require(_0xe162('0x3'));var rp=require(_0xe162('0x4'));var fs=require('fs');var path=require(_0xe162('0x5'));var rimraf=require(_0xe162('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0xe162('0x7')]=function(_0x5d378e,_0x506e35){return _0x5d378e['define'](_0xe162('0x8'),attributes,{'tableName':_0xe162('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc19f=['rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x12c9dc,_0x4808a0){var _0x406603=function(_0x5014d7){while(--_0x5014d7){_0x12c9dc['push'](_0x12c9dc['shift']());}};_0x406603(++_0x4808a0);}(_0xc19f,0xbc));var _0xfc19=function(_0x165b5e,_0x58296f){_0x165b5e=_0x165b5e-0x0;var _0x3f9502=_0xc19f[_0x165b5e];return _0x3f9502;};'use strict';var _=require(_0xfc19('0x0'));var util=require('util');var logger=require(_0xfc19('0x1'))(_0xfc19('0x2'));var moment=require(_0xfc19('0x3'));var BPromise=require(_0xfc19('0x4'));var rp=require(_0xfc19('0x5'));var fs=require('fs');var path=require(_0xfc19('0x6'));var rimraf=require(_0xfc19('0x7'));var config=require(_0xfc19('0x8'));var attributes=require(_0xfc19('0x9'));module[_0xfc19('0xa')]=function(_0x323713,_0x45e897){return _0x323713[_0xfc19('0xb')]('DashboardItem',attributes,{'tableName':_0xfc19('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 1c87940..078d71e 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 _0x845e=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x845e,0xe5));var _0xe845=function(_0x327da0,_0x33e90c){_0x327da0=_0x327da0-0x0;var _0x417397=_0x845e[_0x327da0];return _0x417397;};'use strict';var _=require(_0xe845('0x0'));var util=require(_0xe845('0x1'));var moment=require('moment');var BPromise=require(_0xe845('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe845('0x3'));var db=require(_0xe845('0x4'))['db'];var utils=require(_0xe845('0x5'));var logger=require(_0xe845('0x6'))(_0xe845('0x7'));var config=require(_0xe845('0x8'));var jayson=require(_0xe845('0x9'));var client=jayson[_0xe845('0xa')][_0xe845('0xb')]({'port':0x232a});config['redis']=_[_0xe845('0xc')](config['redis'],{'host':_0xe845('0xd'),'port':0x18eb});var socket=require(_0xe845('0xe'))(new Redis(config[_0xe845('0xf')]));require(_0xe845('0x10'))[_0xe845('0x11')](socket);function respondWithRpcPromise(_0x40c349,_0x1610d3,_0x52799c){return new BPromise(function(_0x4eb426,_0x7fb26a){return client['request'](_0x40c349,_0x52799c)['then'](function(_0x2a3285){logger[_0xe845('0x12')](_0xe845('0x13'),_0x1610d3,'request\x20sent');logger[_0xe845('0x14')](_0xe845('0x15'),_0x1610d3,'request\x20sent',JSON[_0xe845('0x16')](_0x2a3285));if(_0x2a3285[_0xe845('0x17')]){if(_0x2a3285[_0xe845('0x17')][_0xe845('0x18')]===0x1f4){logger[_0xe845('0x17')](_0xe845('0x13'),_0x1610d3,_0x2a3285[_0xe845('0x17')]['message']);return _0x7fb26a(_0x2a3285[_0xe845('0x17')][_0xe845('0x19')]);}logger[_0xe845('0x17')](_0xe845('0x13'),_0x1610d3,_0x2a3285[_0xe845('0x17')][_0xe845('0x19')]);return _0x4eb426(_0x2a3285['error'][_0xe845('0x19')]);}else{logger[_0xe845('0x12')](_0xe845('0x13'),_0x1610d3,'request\x20sent');_0x4eb426(_0x2a3285[_0xe845('0x1a')][_0xe845('0x19')]);}})[_0xe845('0x1b')](function(_0x762707){logger['error'](_0xe845('0x13'),_0x1610d3,_0x762707);_0x7fb26a(_0x762707);});});} \ No newline at end of file +var _0xcaae=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x16fc10,_0x5a06fc){var _0xa28c98=function(_0x18a6df){while(--_0x18a6df){_0x16fc10['push'](_0x16fc10['shift']());}};_0xa28c98(++_0x5a06fc);}(_0xcaae,0x1ba));var _0xecaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xecaa('0x0'));var util=require(_0xecaa('0x1'));var moment=require(_0xecaa('0x2'));var BPromise=require(_0xecaa('0x3'));var rs=require(_0xecaa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecaa('0x5'))['db'];var utils=require(_0xecaa('0x6'));var logger=require(_0xecaa('0x7'))(_0xecaa('0x8'));var config=require(_0xecaa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xecaa('0xa')][_0xecaa('0xb')]({'port':0x232a});config[_0xecaa('0xc')]=_[_0xecaa('0xd')](config['redis'],{'host':_0xecaa('0xe'),'port':0x18eb});var socket=require(_0xecaa('0xf'))(new Redis(config[_0xecaa('0xc')]));require('./dashboardItem.socket')[_0xecaa('0x10')](socket);function respondWithRpcPromise(_0x352e40,_0xba54b8,_0x3461a6){return new BPromise(function(_0x133000,_0x4a9c23){return client[_0xecaa('0x11')](_0x352e40,_0x3461a6)[_0xecaa('0x12')](function(_0x12d426){logger['info'](_0xecaa('0x13'),_0xba54b8,'request\x20sent');logger[_0xecaa('0x14')](_0xecaa('0x15'),_0xba54b8,_0xecaa('0x16'),JSON[_0xecaa('0x17')](_0x12d426));if(_0x12d426['error']){if(_0x12d426[_0xecaa('0x18')][_0xecaa('0x19')]===0x1f4){logger[_0xecaa('0x18')]('DashboardItem,\x20%s,\x20%s',_0xba54b8,_0x12d426[_0xecaa('0x18')]['message']);return _0x4a9c23(_0x12d426[_0xecaa('0x18')][_0xecaa('0x1a')]);}logger[_0xecaa('0x18')](_0xecaa('0x13'),_0xba54b8,_0x12d426[_0xecaa('0x18')][_0xecaa('0x1a')]);return _0x133000(_0x12d426['error'][_0xecaa('0x1a')]);}else{logger[_0xecaa('0x1b')]('DashboardItem,\x20%s,\x20%s',_0xba54b8,_0xecaa('0x16'));_0x133000(_0x12d426[_0xecaa('0x1c')][_0xecaa('0x1a')]);}})[_0xecaa('0x1d')](function(_0x4bcbf9){logger[_0xecaa('0x18')]('DashboardItem,\x20%s,\x20%s',_0xba54b8,_0x4bcbf9);_0x4a9c23(_0x4bcbf9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 7fe52b4..41c64cc 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 _0x5d59=['removeListener','register','length','update','emit'];(function(_0x1f8af3,_0x29da16){var _0xf77c37=function(_0x1c4e82){while(--_0x1c4e82){_0x1f8af3['push'](_0x1f8af3['shift']());}};_0xf77c37(++_0x29da16);}(_0x5d59,0x1cf));var _0x95d5=function(_0x4da7da,_0x17974b){_0x4da7da=_0x4da7da-0x0;var _0x30485d=_0x5d59[_0x4da7da];return _0x30485d;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0x95d5('0x0')];function createListener(_0x1630c3,_0xfcff97){return function(_0x261b39){_0xfcff97[_0x95d5('0x1')](_0x1630c3,_0x261b39);};}function removeListener(_0x1172ca,_0x3ce124){return function(){DashboardItemEvents[_0x95d5('0x2')](_0x1172ca,_0x3ce124);};}exports[_0x95d5('0x3')]=function(_0x3f0aec){for(var _0x28a3ac=0x0,_0x5cd730=events[_0x95d5('0x4')];_0x28a3ac<_0x5cd730;_0x28a3ac++){var _0x183e56=events[_0x28a3ac];var _0x504ca8=createListener('dashboardItem:'+_0x183e56,_0x3f0aec);DashboardItemEvents['on'](_0x183e56,_0x504ca8);}}; \ No newline at end of file +var _0x3ef1=['register','length','dashboardItem:','save','remove'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3ef1,0x8a));var _0x13ef=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x3ef1[_0x543084];return _0x306a57;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x13ef('0x0'),_0x13ef('0x1'),'update'];function createListener(_0x3886cb,_0xdbddea){return function(_0x368ef8){_0xdbddea['emit'](_0x3886cb,_0x368ef8);};}function removeListener(_0x48b138,_0x50dbf1){return function(){DashboardItemEvents['removeListener'](_0x48b138,_0x50dbf1);};}exports[_0x13ef('0x2')]=function(_0x217ec8){for(var _0x110596=0x0,_0x118f03=events[_0x13ef('0x3')];_0x110596<_0x118f03;_0x110596++){var _0x2e0eb3=events[_0x110596];var _0x29e9b0=createListener(_0x13ef('0x4')+_0x2e0eb3,_0x217ec8);DashboardItemEvents['on'](_0x2e0eb3,_0x29e9b0);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a54d9af..4047ad7 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 _0xd58e=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','put','update','exports'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0xd58e,0x142));var _0xed58=function(_0x5a2c05,_0xf19389){_0x5a2c05=_0x5a2c05-0x0;var _0x3afdf7=_0xd58e[_0x5a2c05];return _0x3afdf7;};'use strict';var multer=require('multer');var util=require(_0xed58('0x0'));var path=require(_0xed58('0x1'));var timeout=require(_0xed58('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xed58('0x3'));var auth=require(_0xed58('0x4'));var interaction=require(_0xed58('0x5'));var config=require(_0xed58('0x6'));var controller=require('./dashboardItem.controller');router[_0xed58('0x7')](_0xed58('0x8'),auth['isAuthenticated'](),controller[_0xed58('0x9')]);router['post']('/',auth[_0xed58('0xa')](),controller['create']);router[_0xed58('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xed58('0xc')]);router['delete'](_0xed58('0x8'),auth[_0xed58('0xa')](),controller['destroy']);module[_0xed58('0xd')]=router; \ No newline at end of file +var _0x7c48=['get','/:id','isAuthenticated','show','put','update','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x4465bc,_0x5e5776){var _0x3aa0d9=function(_0x5e9bc8){while(--_0x5e9bc8){_0x4465bc['push'](_0x4465bc['shift']());}};_0x3aa0d9(++_0x5e5776);}(_0x7c48,0x19c));var _0x87c4=function(_0x46a355,_0x1b5f1a){_0x46a355=_0x46a355-0x0;var _0x60e91e=_0x7c48[_0x46a355];return _0x60e91e;};'use strict';var multer=require('multer');var util=require(_0x87c4('0x0'));var path=require(_0x87c4('0x1'));var timeout=require(_0x87c4('0x2'));var express=require('express');var router=express[_0x87c4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x87c4('0x4'));var interaction=require(_0x87c4('0x5'));var config=require(_0x87c4('0x6'));var controller=require(_0x87c4('0x7'));router[_0x87c4('0x8')](_0x87c4('0x9'),auth[_0x87c4('0xa')](),controller[_0x87c4('0xb')]);router['post']('/',auth[_0x87c4('0xa')](),controller['create']);router[_0x87c4('0xc')](_0x87c4('0x9'),auth['isAuthenticated'](),controller[_0x87c4('0xd')]);router['delete'](_0x87c4('0x9'),auth['isAuthenticated'](),controller[_0x87c4('0xe')]);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 ebc8440..f5023f5 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 _0x35ad=['sequelize','STRING','ENUM','first','second'];(function(_0x265898,_0xff5231){var _0x2ca161=function(_0x316c8b){while(--_0x316c8b){_0x265898['push'](_0x265898['shift']());}};_0x2ca161(++_0xff5231);}(_0x35ad,0x1a9));var _0xd35a=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x35ad[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0xd35a('0x0'));module['exports']={'name':{'type':Sequelize[_0xd35a('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xd35a('0x2')](_0xd35a('0x3'),_0xd35a('0x4'),'third'),'allowNull':![],'defaultValue':_0xd35a('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeae6=['STRING','second','third','first','sequelize','exports'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0xeae6,0x1e4));var _0x6eae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeae6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6eae('0x0'));module[_0x6eae('0x1')]={'name':{'type':Sequelize[_0x6eae('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x6eae('0x3'),_0x6eae('0x4')),'allowNull':![],'defaultValue':_0x6eae('0x5')},'description':{'type':Sequelize[_0x6eae('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index cb3c2a6..f05667d 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 _0x503b=['apply','reject','save','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','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','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x503b,0xdf));var _0xb503=function(_0xca40a6,_0x55d2b8){_0xca40a6=_0xca40a6-0x0;var _0x3f94cc=_0x503b[_0xca40a6];return _0x3f94cc;};'use strict';var emlformat=require(_0xb503('0x0'));var rimraf=require(_0xb503('0x1'));var zipdir=require(_0xb503('0x2'));var jsonpatch=require(_0xb503('0x3'));var rp=require(_0xb503('0x4'));var moment=require(_0xb503('0x5'));var BPromise=require(_0xb503('0x6'));var Mustache=require('mustache');var util=require(_0xb503('0x7'));var path=require(_0xb503('0x8'));var sox=require(_0xb503('0x9'));var csv=require(_0xb503('0xa'));var ejs=require(_0xb503('0xb'));var fs=require('fs');var fs_extra=require(_0xb503('0xc'));var _=require(_0xb503('0xd'));var squel=require(_0xb503('0xe'));var crypto=require(_0xb503('0xf'));var jsforce=require(_0xb503('0x10'));var deskjs=require(_0xb503('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb503('0x12'));var Redis=require(_0xb503('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb503('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb503('0x15'));var logger=require('../../config/logger')(_0xb503('0x16'));var utils=require('../../config/utils');var config=require(_0xb503('0x17'));var licenseUtil=require(_0xb503('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31d2ed,_0x294d57){_0x294d57=_0x294d57||0xcc;return function(_0x4f5145){if(_0x4f5145){return _0x31d2ed[_0xb503('0x19')](_0x294d57);}return _0x31d2ed[_0xb503('0x1a')](_0x294d57)[_0xb503('0x1b')]();};}function respondWithResult(_0x23a4b2,_0x626bdf){_0x626bdf=_0x626bdf||0xc8;return function(_0x329b25){if(_0x329b25){return _0x23a4b2['status'](_0x626bdf)[_0xb503('0x1c')](_0x329b25);}};}function respondWithFilteredResult(_0x2574bc,_0x494aef){return function(_0x28b0a0){if(_0x28b0a0){var _0x2a02ee=typeof _0x494aef[_0xb503('0x1d')]===_0xb503('0x1e')&&typeof _0x494aef[_0xb503('0x1f')]===_0xb503('0x1e');var _0x1df239=_0x28b0a0[_0xb503('0x20')];var _0x31fd55=_0x2a02ee?0x0:_0x494aef[_0xb503('0x1d')];var _0x2d7e2e=_0x2a02ee?_0x28b0a0[_0xb503('0x20')]:_0x494aef['offset']+_0x494aef[_0xb503('0x1f')];var _0x58e77e;if(_0x2d7e2e>=_0x1df239){_0x2d7e2e=_0x1df239;_0x58e77e=0xc8;}else{_0x58e77e=0xce;}_0x2574bc[_0xb503('0x1a')](_0x58e77e);return _0x2574bc[_0xb503('0x21')](_0xb503('0x22'),_0x31fd55+'-'+_0x2d7e2e+'/'+_0x1df239)[_0xb503('0x1c')](_0x28b0a0);}return null;};}function patchUpdates(_0x41b5f2){return function(_0x5d8ad6){try{jsonpatch[_0xb503('0x23')](_0x5d8ad6,_0x41b5f2,!![]);}catch(_0x50b989){return BPromise[_0xb503('0x24')](_0x50b989);}return _0x5d8ad6[_0xb503('0x25')]();};}function saveUpdates(_0x6bbafb,_0x1b1789){return function(_0x57d8d1){if(_0x57d8d1){return _0x57d8d1['update'](_0x6bbafb)[_0xb503('0x26')](function(_0x44f4cb){return _0x44f4cb;});}return null;};}function removeEntity(_0x556008,_0x2862f3){return function(_0xdcf6b3){if(_0xdcf6b3){return _0xdcf6b3[_0xb503('0x27')]()['then'](function(){var _0xd5b526=_0xdcf6b3[_0xb503('0x28')]({'plain':!![]});var _0x2cc50e=_0xb503('0x29');return db[_0xb503('0x2a')][_0xb503('0x27')]({'where':{'type':_0x2cc50e,'resourceId':_0xd5b526['id']}})[_0xb503('0x26')](function(){return _0xdcf6b3;});})[_0xb503('0x26')](function(){_0x556008[_0xb503('0x1a')](0xcc)[_0xb503('0x1b')]();});}};}function handleEntityNotFound(_0x153817,_0x3a4560){return function(_0x426c0f){if(!_0x426c0f){_0x153817[_0xb503('0x19')](0x194);}return _0x426c0f;};}function handleError(_0x4d1a3f,_0x407c72){_0x407c72=_0x407c72||0x1f4;return function(_0x50a2b6){logger[_0xb503('0x2b')](_0x50a2b6[_0xb503('0x2c')]);if(_0x50a2b6[_0xb503('0x2d')]){delete _0x50a2b6[_0xb503('0x2d')];}_0x4d1a3f[_0xb503('0x1a')](_0x407c72)[_0xb503('0x2e')](_0x50a2b6);};}exports[_0xb503('0x2f')]=function(_0x565306,_0x469aa2){var _0x374de9={},_0xf7a2f7={},_0x28b385={'count':0x0,'rows':[]};var _0x454219=_[_0xb503('0x30')](db[_0xb503('0x31')][_0xb503('0x32')],function(_0x228325){return{'name':_0x228325[_0xb503('0x33')],'type':_0x228325[_0xb503('0x34')][_0xb503('0x35')]};});_0xf7a2f7[_0xb503('0x36')]=_['map'](_0x454219,_0xb503('0x2d'));_0xf7a2f7[_0xb503('0x37')]=_[_0xb503('0x38')](_0x565306[_0xb503('0x37')]);_0xf7a2f7[_0xb503('0x39')]=_[_0xb503('0x3a')](_0xf7a2f7['model'],_0xf7a2f7['query']);_0x374de9[_0xb503('0x3b')]=_['intersection'](_0xf7a2f7[_0xb503('0x36')],qs[_0xb503('0x3c')](_0x565306[_0xb503('0x37')][_0xb503('0x3c')]));_0x374de9[_0xb503('0x3b')]=_0x374de9['attributes'][_0xb503('0x3d')]?_0x374de9[_0xb503('0x3b')]:_0xf7a2f7[_0xb503('0x36')];if(!_0x565306[_0xb503('0x37')]['hasOwnProperty'](_0xb503('0x3e'))){_0x374de9[_0xb503('0x1f')]=qs[_0xb503('0x1f')](_0x565306['query'][_0xb503('0x1f')]);_0x374de9[_0xb503('0x1d')]=qs[_0xb503('0x1d')](_0x565306[_0xb503('0x37')][_0xb503('0x1d')]);}_0x374de9['order']=qs['sort'](_0x565306[_0xb503('0x37')][_0xb503('0x3f')]);_0x374de9[_0xb503('0x40')]=qs['filters'](_[_0xb503('0x41')](_0x565306[_0xb503('0x37')],_0xf7a2f7[_0xb503('0x39')]),_0x454219);if(_0x565306[_0xb503('0x37')][_0xb503('0x42')]){_0x374de9[_0xb503('0x40')]=_[_0xb503('0x43')](_0x374de9['where'],{'$or':_[_0xb503('0x30')](_0x454219,function(_0x48ab2f){if(_0x48ab2f[_0xb503('0x34')]!==_0xb503('0x44')){var _0x1b782f={};_0x1b782f[_0x48ab2f[_0xb503('0x2d')]]={'$like':'%'+_0x565306[_0xb503('0x37')][_0xb503('0x42')]+'%'};return _0x1b782f;}})});}_0x374de9=_[_0xb503('0x43')]({},_0x374de9,_0x565306[_0xb503('0x45')]);var _0x5aafcc={'where':_0x374de9[_0xb503('0x40')]};return db['Disposition'][_0xb503('0x20')](_0x5aafcc)[_0xb503('0x26')](function(_0x2668c7){_0x28b385[_0xb503('0x20')]=_0x2668c7;if(_0x565306[_0xb503('0x37')]['includeAll']){_0x374de9[_0xb503('0x46')]=[{'all':!![]}];}return db['Disposition'][_0xb503('0x47')](_0x374de9);})[_0xb503('0x26')](function(_0x3cb713){_0x28b385['rows']=_0x3cb713;return _0x28b385;})['then'](respondWithFilteredResult(_0x469aa2,_0x374de9))[_0xb503('0x48')](handleError(_0x469aa2,null));};exports[_0xb503('0x49')]=function(_0x3be898,_0x1d6570){var _0x44835b={'raw':!![],'where':{'id':_0x3be898[_0xb503('0x4a')]['id']}},_0x5d2c9a={};_0x5d2c9a[_0xb503('0x36')]=_[_0xb503('0x38')](db[_0xb503('0x31')][_0xb503('0x32')]);_0x5d2c9a[_0xb503('0x37')]=_[_0xb503('0x38')](_0x3be898[_0xb503('0x37')]);_0x5d2c9a[_0xb503('0x39')]=_[_0xb503('0x3a')](_0x5d2c9a[_0xb503('0x36')],_0x5d2c9a[_0xb503('0x37')]);_0x44835b[_0xb503('0x3b')]=_[_0xb503('0x3a')](_0x5d2c9a[_0xb503('0x36')],qs['fields'](_0x3be898[_0xb503('0x37')][_0xb503('0x3c')]));_0x44835b[_0xb503('0x3b')]=_0x44835b['attributes'][_0xb503('0x3d')]?_0x44835b[_0xb503('0x3b')]:_0x5d2c9a[_0xb503('0x36')];if(_0x3be898[_0xb503('0x37')][_0xb503('0x4b')]){_0x44835b[_0xb503('0x46')]=[{'all':!![]}];}_0x44835b=_[_0xb503('0x43')]({},_0x44835b,_0x3be898[_0xb503('0x45')]);return db[_0xb503('0x31')][_0xb503('0x4c')](_0x44835b)[_0xb503('0x26')](handleEntityNotFound(_0x1d6570,null))[_0xb503('0x26')](respondWithResult(_0x1d6570,null))[_0xb503('0x48')](handleError(_0x1d6570,null));};exports[_0xb503('0x4d')]=function(_0x5e2e1e,_0x33464f){return db['Disposition'][_0xb503('0x4d')](_0x5e2e1e[_0xb503('0x4e')],{})[_0xb503('0x26')](function(_0x4a5f4a){var _0x1235f9=_0x5e2e1e[_0xb503('0x4f')]['get']({'plain':!![]});if(!_0x1235f9)throw new Error(_0xb503('0x50'));if(_0x1235f9[_0xb503('0x51')]===_0xb503('0x4f')){var _0x406766=_0x4a5f4a['get']({'plain':!![]});var _0xa62224=_0xb503('0x29');return db[_0xb503('0x52')][_0xb503('0x4c')]({'where':{'name':_0xa62224,'userProfileId':_0x1235f9['userProfileId']},'raw':!![]})[_0xb503('0x26')](function(_0x237f40){if(_0x237f40&&_0x237f40[_0xb503('0x53')]===0x0){return db[_0xb503('0x2a')][_0xb503('0x4d')]({'name':_0x406766[_0xb503('0x2d')],'resourceId':_0x406766['id'],'type':_0x237f40[_0xb503('0x2d')],'sectionId':_0x237f40['id']},{})[_0xb503('0x26')](function(){return _0x4a5f4a;});}else{return _0x4a5f4a;}})['catch'](function(_0x50c3c9){logger[_0xb503('0x2b')](_0xb503('0x54'),_0x50c3c9);throw _0x50c3c9;});}return _0x4a5f4a;})[_0xb503('0x26')](respondWithResult(_0x33464f,0xc9))['catch'](handleError(_0x33464f,null));};exports[_0xb503('0x55')]=function(_0x2b027f,_0x193df0){if(_0x2b027f[_0xb503('0x4e')]['id']){delete _0x2b027f[_0xb503('0x4e')]['id'];}return db['Disposition'][_0xb503('0x4c')]({'where':{'id':_0x2b027f['params']['id']}})['then'](handleEntityNotFound(_0x193df0,null))[_0xb503('0x26')](saveUpdates(_0x2b027f[_0xb503('0x4e')],null))['then'](respondWithResult(_0x193df0,null))[_0xb503('0x48')](handleError(_0x193df0,null));};exports[_0xb503('0x27')]=function(_0x394c6b,_0xf96289){return db['Disposition'][_0xb503('0x4c')]({'where':{'id':_0x394c6b[_0xb503('0x4a')]['id']}})[_0xb503('0x26')](handleEntityNotFound(_0xf96289,null))[_0xb503('0x26')](removeEntity(_0xf96289,null))['catch'](handleError(_0xf96289,null));}; \ No newline at end of file +var _0x8dbd=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Disposition','includeAll','catch','show','params','rawAttributes','fields','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4028ec,_0x3e2bb6){var _0x41a03c=function(_0x2ec0e1){while(--_0x2ec0e1){_0x4028ec['push'](_0x4028ec['shift']());}};_0x41a03c(++_0x3e2bb6);}(_0x8dbd,0x159));var _0xd8db=function(_0x198adb,_0x33342b){_0x198adb=_0x198adb-0x0;var _0x3622c6=_0x8dbd[_0x198adb];return _0x3622c6;};'use strict';var emlformat=require(_0xd8db('0x0'));var rimraf=require(_0xd8db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8db('0x2'));var rp=require(_0xd8db('0x3'));var moment=require(_0xd8db('0x4'));var BPromise=require(_0xd8db('0x5'));var Mustache=require(_0xd8db('0x6'));var util=require(_0xd8db('0x7'));var path=require(_0xd8db('0x8'));var sox=require(_0xd8db('0x9'));var csv=require(_0xd8db('0xa'));var ejs=require(_0xd8db('0xb'));var fs=require('fs');var fs_extra=require(_0xd8db('0xc'));var _=require(_0xd8db('0xd'));var squel=require(_0xd8db('0xe'));var crypto=require(_0xd8db('0xf'));var jsforce=require(_0xd8db('0x10'));var deskjs=require(_0xd8db('0x11'));var toCsv=require(_0xd8db('0xa'));var querystring=require('querystring');var Papa=require(_0xd8db('0x12'));var Redis=require(_0xd8db('0x13'));var authService=require(_0xd8db('0x14'));var qs=require(_0xd8db('0x15'));var as=require(_0xd8db('0x16'));var hardwareService=require(_0xd8db('0x17'));var logger=require(_0xd8db('0x18'))(_0xd8db('0x19'));var utils=require(_0xd8db('0x1a'));var config=require(_0xd8db('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8db('0x1c'))['db'];function respondWithStatusCode(_0x23b404,_0x300fbd){_0x300fbd=_0x300fbd||0xcc;return function(_0xbfeb55){if(_0xbfeb55){return _0x23b404[_0xd8db('0x1d')](_0x300fbd);}return _0x23b404[_0xd8db('0x1e')](_0x300fbd)[_0xd8db('0x1f')]();};}function respondWithResult(_0x1eaa93,_0x491503){_0x491503=_0x491503||0xc8;return function(_0x5c0512){if(_0x5c0512){return _0x1eaa93[_0xd8db('0x1e')](_0x491503)[_0xd8db('0x20')](_0x5c0512);}};}function respondWithFilteredResult(_0x4c10a6,_0x221681){return function(_0x2eeed7){if(_0x2eeed7){var _0x54ad20=typeof _0x221681[_0xd8db('0x21')]===_0xd8db('0x22')&&typeof _0x221681[_0xd8db('0x23')]===_0xd8db('0x22');var _0x29d0b8=_0x2eeed7[_0xd8db('0x24')];var _0x2d0a0c=_0x54ad20?0x0:_0x221681[_0xd8db('0x21')];var _0x29026e=_0x54ad20?_0x2eeed7[_0xd8db('0x24')]:_0x221681[_0xd8db('0x21')]+_0x221681['limit'];var _0x4b5c1e;if(_0x29026e>=_0x29d0b8){_0x29026e=_0x29d0b8;_0x4b5c1e=0xc8;}else{_0x4b5c1e=0xce;}_0x4c10a6[_0xd8db('0x1e')](_0x4b5c1e);return _0x4c10a6[_0xd8db('0x25')](_0xd8db('0x26'),_0x2d0a0c+'-'+_0x29026e+'/'+_0x29d0b8)[_0xd8db('0x20')](_0x2eeed7);}return null;};}function patchUpdates(_0x2207bd){return function(_0xe8a2f){try{jsonpatch[_0xd8db('0x27')](_0xe8a2f,_0x2207bd,!![]);}catch(_0x44041c){return BPromise[_0xd8db('0x28')](_0x44041c);}return _0xe8a2f[_0xd8db('0x29')]();};}function saveUpdates(_0xf901a5,_0x1b32d9){return function(_0x11db7a){if(_0x11db7a){return _0x11db7a['update'](_0xf901a5)[_0xd8db('0x2a')](function(_0xd540b){return _0xd540b;});}return null;};}function removeEntity(_0x312024,_0x107292){return function(_0x2524ea){if(_0x2524ea){return _0x2524ea['destroy']()['then'](function(){var _0xfd9373=_0x2524ea[_0xd8db('0x2b')]({'plain':!![]});var _0x269f42=_0xd8db('0x2c');return db[_0xd8db('0x2d')][_0xd8db('0x2e')]({'where':{'type':_0x269f42,'resourceId':_0xfd9373['id']}})['then'](function(){return _0x2524ea;});})[_0xd8db('0x2a')](function(){_0x312024['status'](0xcc)[_0xd8db('0x1f')]();});}};}function handleEntityNotFound(_0xa481d3,_0x42b025){return function(_0x530704){if(!_0x530704){_0xa481d3[_0xd8db('0x1d')](0x194);}return _0x530704;};}function handleError(_0x53bf27,_0x14fd34){_0x14fd34=_0x14fd34||0x1f4;return function(_0x3249f3){logger[_0xd8db('0x2f')](_0x3249f3[_0xd8db('0x30')]);if(_0x3249f3[_0xd8db('0x31')]){delete _0x3249f3['name'];}_0x53bf27[_0xd8db('0x1e')](_0x14fd34)[_0xd8db('0x32')](_0x3249f3);};}exports[_0xd8db('0x33')]=function(_0x3d1553,_0x4f0024){var _0x55355d={},_0x1ac8d2={},_0x51145e={'count':0x0,'rows':[]};var _0x300815=_[_0xd8db('0x34')](db['Disposition']['rawAttributes'],function(_0xb52522){return{'name':_0xb52522[_0xd8db('0x35')],'type':_0xb52522[_0xd8db('0x36')]['key']};});_0x1ac8d2[_0xd8db('0x37')]=_[_0xd8db('0x34')](_0x300815,'name');_0x1ac8d2[_0xd8db('0x38')]=_[_0xd8db('0x39')](_0x3d1553[_0xd8db('0x38')]);_0x1ac8d2[_0xd8db('0x3a')]=_[_0xd8db('0x3b')](_0x1ac8d2[_0xd8db('0x37')],_0x1ac8d2[_0xd8db('0x38')]);_0x55355d['attributes']=_[_0xd8db('0x3b')](_0x1ac8d2[_0xd8db('0x37')],qs['fields'](_0x3d1553[_0xd8db('0x38')]['fields']));_0x55355d[_0xd8db('0x3c')]=_0x55355d['attributes'][_0xd8db('0x3d')]?_0x55355d[_0xd8db('0x3c')]:_0x1ac8d2[_0xd8db('0x37')];if(!_0x3d1553[_0xd8db('0x38')][_0xd8db('0x3e')](_0xd8db('0x3f'))){_0x55355d[_0xd8db('0x23')]=qs['limit'](_0x3d1553['query']['limit']);_0x55355d[_0xd8db('0x21')]=qs[_0xd8db('0x21')](_0x3d1553[_0xd8db('0x38')]['offset']);}_0x55355d['order']=qs[_0xd8db('0x40')](_0x3d1553[_0xd8db('0x38')][_0xd8db('0x40')]);_0x55355d[_0xd8db('0x41')]=qs[_0xd8db('0x3a')](_[_0xd8db('0x42')](_0x3d1553[_0xd8db('0x38')],_0x1ac8d2[_0xd8db('0x3a')]),_0x300815);if(_0x3d1553['query'][_0xd8db('0x43')]){_0x55355d[_0xd8db('0x41')]=_[_0xd8db('0x44')](_0x55355d[_0xd8db('0x41')],{'$or':_[_0xd8db('0x34')](_0x300815,function(_0xe79c20){if(_0xe79c20['type']!=='VIRTUAL'){var _0x2fa84c={};_0x2fa84c[_0xe79c20[_0xd8db('0x31')]]={'$like':'%'+_0x3d1553[_0xd8db('0x38')]['filter']+'%'};return _0x2fa84c;}})});}_0x55355d=_[_0xd8db('0x44')]({},_0x55355d,_0x3d1553[_0xd8db('0x45')]);var _0x90fa93={'where':_0x55355d['where']};return db[_0xd8db('0x46')][_0xd8db('0x24')](_0x90fa93)[_0xd8db('0x2a')](function(_0x2f7a0c){_0x51145e[_0xd8db('0x24')]=_0x2f7a0c;if(_0x3d1553['query'][_0xd8db('0x47')]){_0x55355d['include']=[{'all':!![]}];}return db[_0xd8db('0x46')]['findAll'](_0x55355d);})['then'](function(_0x1e7dd8){_0x51145e['rows']=_0x1e7dd8;return _0x51145e;})[_0xd8db('0x2a')](respondWithFilteredResult(_0x4f0024,_0x55355d))[_0xd8db('0x48')](handleError(_0x4f0024,null));};exports[_0xd8db('0x49')]=function(_0x441c29,_0x481e54){var _0x121be2={'raw':!![],'where':{'id':_0x441c29[_0xd8db('0x4a')]['id']}},_0x4359b5={};_0x4359b5[_0xd8db('0x37')]=_[_0xd8db('0x39')](db[_0xd8db('0x46')][_0xd8db('0x4b')]);_0x4359b5['query']=_[_0xd8db('0x39')](_0x441c29[_0xd8db('0x38')]);_0x4359b5['filters']=_[_0xd8db('0x3b')](_0x4359b5[_0xd8db('0x37')],_0x4359b5[_0xd8db('0x38')]);_0x121be2['attributes']=_[_0xd8db('0x3b')](_0x4359b5['model'],qs[_0xd8db('0x4c')](_0x441c29[_0xd8db('0x38')][_0xd8db('0x4c')]));_0x121be2[_0xd8db('0x3c')]=_0x121be2['attributes'][_0xd8db('0x3d')]?_0x121be2[_0xd8db('0x3c')]:_0x4359b5[_0xd8db('0x37')];if(_0x441c29[_0xd8db('0x38')]['includeAll']){_0x121be2[_0xd8db('0x4d')]=[{'all':!![]}];}_0x121be2=_[_0xd8db('0x44')]({},_0x121be2,_0x441c29[_0xd8db('0x45')]);return db['Disposition']['find'](_0x121be2)[_0xd8db('0x2a')](handleEntityNotFound(_0x481e54,null))[_0xd8db('0x2a')](respondWithResult(_0x481e54,null))[_0xd8db('0x48')](handleError(_0x481e54,null));};exports['create']=function(_0x215907,_0x57cd75){return db['Disposition'][_0xd8db('0x4e')](_0x215907['body'],{})[_0xd8db('0x2a')](function(_0x9f8a56){var _0x3b1e6e=_0x215907[_0xd8db('0x4f')][_0xd8db('0x2b')]({'plain':!![]});if(!_0x3b1e6e)throw new Error(_0xd8db('0x50'));if(_0x3b1e6e[_0xd8db('0x51')]===_0xd8db('0x4f')){var _0x206f34=_0x9f8a56[_0xd8db('0x2b')]({'plain':!![]});var _0x9e0ca=_0xd8db('0x2c');return db[_0xd8db('0x52')][_0xd8db('0x53')]({'where':{'name':_0x9e0ca,'userProfileId':_0x3b1e6e[_0xd8db('0x54')]},'raw':!![]})['then'](function(_0x3bd177){if(_0x3bd177&&_0x3bd177[_0xd8db('0x55')]===0x0){return db[_0xd8db('0x2d')][_0xd8db('0x4e')]({'name':_0x206f34[_0xd8db('0x31')],'resourceId':_0x206f34['id'],'type':_0x3bd177[_0xd8db('0x31')],'sectionId':_0x3bd177['id']},{})[_0xd8db('0x2a')](function(){return _0x9f8a56;});}else{return _0x9f8a56;}})['catch'](function(_0x4686b5){logger[_0xd8db('0x2f')](_0xd8db('0x56'),_0x4686b5);throw _0x4686b5;});}return _0x9f8a56;})[_0xd8db('0x2a')](respondWithResult(_0x57cd75,0xc9))['catch'](handleError(_0x57cd75,null));};exports[_0xd8db('0x57')]=function(_0x55e81a,_0x2aafac){if(_0x55e81a[_0xd8db('0x58')]['id']){delete _0x55e81a['body']['id'];}return db[_0xd8db('0x46')][_0xd8db('0x53')]({'where':{'id':_0x55e81a[_0xd8db('0x4a')]['id']}})[_0xd8db('0x2a')](handleEntityNotFound(_0x2aafac,null))['then'](saveUpdates(_0x55e81a[_0xd8db('0x58')],null))[_0xd8db('0x2a')](respondWithResult(_0x2aafac,null))[_0xd8db('0x48')](handleError(_0x2aafac,null));};exports[_0xd8db('0x2e')]=function(_0xc6b971,_0x35c71f){return db[_0xd8db('0x46')][_0xd8db('0x53')]({'where':{'id':_0xc6b971[_0xd8db('0x4a')]['id']}})[_0xd8db('0x2a')](handleEntityNotFound(_0x35c71f,null))[_0xd8db('0x2a')](removeEntity(_0x35c71f,null))[_0xd8db('0x48')](handleError(_0x35c71f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index fadb7b0..d65e2ee 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 _0xc057=['tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Disposition'];(function(_0x58825f,_0x552337){var _0x1f893e=function(_0x236580){while(--_0x236580){_0x58825f['push'](_0x58825f['shift']());}};_0x1f893e(++_0x552337);}(_0xc057,0x193));var _0x7c05=function(_0xd18bd,_0xe818a8){_0xd18bd=_0xd18bd-0x0;var _0x38fc0e=_0xc057[_0xd18bd];return _0x38fc0e;};'use strict';var _=require(_0x7c05('0x0'));var util=require(_0x7c05('0x1'));var logger=require('../../config/logger')(_0x7c05('0x2'));var moment=require('moment');var BPromise=require(_0x7c05('0x3'));var rp=require(_0x7c05('0x4'));var fs=require('fs');var path=require(_0x7c05('0x5'));var rimraf=require(_0x7c05('0x6'));var config=require(_0x7c05('0x7'));var attributes=require('./disposition.attributes');module[_0x7c05('0x8')]=function(_0x18654e,_0x469059){return _0x18654e[_0x7c05('0x9')](_0x7c05('0xa'),attributes,{'tableName':_0x7c05('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7c05('0xc'),'fields':[_0x7c05('0xd'),'ListId']},{'unique':!![],'name':_0x7c05('0xe'),'fields':[_0x7c05('0xd'),_0x7c05('0xf')]},{'unique':!![],'name':_0x7c05('0x10'),'fields':[_0x7c05('0xd'),_0x7c05('0x11')]},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':_0x7c05('0x12'),'fields':[_0x7c05('0xd'),'FaxAccountId']},{'unique':!![],'name':_0x7c05('0x13'),'fields':[_0x7c05('0xd'),_0x7c05('0x14')]},{'unique':!![],'name':_0x7c05('0x15'),'fields':[_0x7c05('0xd'),_0x7c05('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa80c=['ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','Disposition','tools_dispositions','name','ListId','name_chat'];(function(_0x539c6c,_0xc21c4b){var _0x20c7fc=function(_0x25ebf0){while(--_0x25ebf0){_0x539c6c['push'](_0x539c6c['shift']());}};_0x20c7fc(++_0xc21c4b);}(_0xa80c,0x8d));var _0xca80=function(_0x47957e,_0xc6c924){_0x47957e=_0x47957e-0x0;var _0x836197=_0xa80c[_0x47957e];return _0x836197;};'use strict';var _=require('lodash');var util=require(_0xca80('0x0'));var logger=require(_0xca80('0x1'))('api');var moment=require(_0xca80('0x2'));var BPromise=require(_0xca80('0x3'));var rp=require(_0xca80('0x4'));var fs=require('fs');var path=require(_0xca80('0x5'));var rimraf=require(_0xca80('0x6'));var config=require(_0xca80('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x239ff8,_0x31aec8){return _0x239ff8['define'](_0xca80('0x8'),attributes,{'tableName':_0xca80('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xca80('0xa'),_0xca80('0xb')]},{'unique':!![],'name':_0xca80('0xc'),'fields':[_0xca80('0xa'),_0xca80('0xd')]},{'unique':!![],'name':_0xca80('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xca80('0xf'),'fields':['name',_0xca80('0x10')]},{'unique':!![],'name':_0xca80('0x11'),'fields':[_0xca80('0xa'),_0xca80('0x12')]},{'unique':!![],'name':_0xca80('0x13'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xca80('0x14'),'fields':[_0xca80('0xa'),_0xca80('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4699485..60733ef 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(_0x437c60,_0x1cffa2){var _0x434f80=function(_0x18dc66){while(--_0x18dc66){_0x437c60['push'](_0x437c60['shift']());}};_0x434f80(++_0x1cffa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x2af182,_0x569b2a){var _0x14990c=function(_0x506fbb){while(--_0x506fbb){_0x2af182['push'](_0x2af182['shift']());}};_0x14990c(++_0x569b2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 8f7325b..2fa98b0 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 _0xb9a0=['index','/:id','post','create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x119a96,_0x46d293){var _0x5a0c5e=function(_0x21f111){while(--_0x21f111){_0x119a96['push'](_0x119a96['shift']());}};_0x5a0c5e(++_0x46d293);}(_0xb9a0,0x14b));var _0x0b9a=function(_0x2a8444,_0xb5ee31){_0x2a8444=_0x2a8444-0x0;var _0x53c724=_0xb9a0[_0x2a8444];return _0x53c724;};'use strict';var multer=require(_0x0b9a('0x0'));var util=require(_0x0b9a('0x1'));var path=require(_0x0b9a('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b9a('0x3'));var router=express[_0x0b9a('0x4')]();var fs_extra=require(_0x0b9a('0x5'));var auth=require(_0x0b9a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b9a('0x7'));var controller=require(_0x0b9a('0x8'));router[_0x0b9a('0x9')]('/',auth[_0x0b9a('0xa')](),controller[_0x0b9a('0xb')]);router['get'](_0x0b9a('0xc'),auth[_0x0b9a('0xa')](),controller['show']);router[_0x0b9a('0xd')]('/',auth['isAuthenticated'](),controller[_0x0b9a('0xe')]);router[_0x0b9a('0xf')]('/:id',auth[_0x0b9a('0xa')](),controller[_0x0b9a('0x10')]);router['delete'](_0x0b9a('0xc'),auth[_0x0b9a('0xa')](),controller['destroy']);module[_0x0b9a('0x11')]=router; \ No newline at end of file +var _0xf423=['/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0xf423,0xf5));var _0x3f42=function(_0x4e6463,_0x73900c){_0x4e6463=_0x4e6463-0x0;var _0x3456b5=_0xf423[_0x4e6463];return _0x3456b5;};'use strict';var multer=require(_0x3f42('0x0'));var util=require(_0x3f42('0x1'));var path=require('path');var timeout=require(_0x3f42('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3f42('0x3'));var auth=require(_0x3f42('0x4'));var interaction=require(_0x3f42('0x5'));var config=require(_0x3f42('0x6'));var controller=require('./disposition.controller');router[_0x3f42('0x7')]('/',auth[_0x3f42('0x8')](),controller[_0x3f42('0x9')]);router[_0x3f42('0x7')](_0x3f42('0xa'),auth['isAuthenticated'](),controller[_0x3f42('0xb')]);router[_0x3f42('0xc')]('/',auth['isAuthenticated'](),controller[_0x3f42('0xd')]);router[_0x3f42('0xe')](_0x3f42('0xa'),auth[_0x3f42('0x8')](),controller[_0x3f42('0xf')]);router['delete'](_0x3f42('0xa'),auth[_0x3f42('0x8')](),controller[_0x3f42('0x10')]);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 468129b..424119b 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 _0xcd35=['KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','localstationid','2400','4800','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd35,0x12e));var _0x5cd3=function(_0x2bf010,_0x5ba1e2){_0x2bf010=_0x2bf010-0x0;var _0x1700b1=_0xcd35[_0x2bf010];return _0x1700b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5cd3('0x0')]},'ecm':{'type':Sequelize[_0x5cd3('0x1')](_0x5cd3('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x5cd3('0x0')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x5cd3('0x0')],'unique':_0x5cd3('0x3')},'minrate':{'type':Sequelize['ENUM'](_0x5cd3('0x4'),_0x5cd3('0x5'),'7200',_0x5cd3('0x6'),_0x5cd3('0x7'),_0x5cd3('0x8')),'defaultValue':_0x5cd3('0x5')},'maxrate':{'type':Sequelize[_0x5cd3('0x1')]('2400','4800','7200',_0x5cd3('0x6'),_0x5cd3('0x7'),_0x5cd3('0x8')),'defaultValue':_0x5cd3('0x8')},'modem':{'type':Sequelize[_0x5cd3('0x0')],'defaultValue':_0x5cd3('0x9')},'gateway':{'type':Sequelize[_0x5cd3('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5cd3('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5cd3('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x5cd3('0xb'),_0x5cd3('0xc'),'DADHI',_0x5cd3('0xd')),'defaultValue':_0x5cd3('0xb')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5cd3('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5cd3('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5cd3('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5cd3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5cd3('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5cd3('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5cd3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5cd3('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0x5cd3('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5cd3('0x11'),'set':function(_0x51cbec){if(!_0x51cbec)this[_0x5cd3('0x12')](_0x5cd3('0x13'),null);this[_0x5cd3('0x12')](_0x5cd3('0x14'),_0x51cbec);}}}; \ No newline at end of file +var _0xf740=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xf740,0x1e7));var _0x0f74=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0xf740[_0x25b24a];return _0x224e68;};'use strict';var Sequelize=require(_0x0f74('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f74('0x1')]},'ecm':{'type':Sequelize[_0x0f74('0x2')](_0x0f74('0x3'),'no'),'defaultValue':_0x0f74('0x3')},'headerinfo':{'type':Sequelize[_0x0f74('0x1')],'defaultValue':_0x0f74('0x4')},'localstationid':{'type':Sequelize[_0x0f74('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x0f74('0x5'),_0x0f74('0x6'),_0x0f74('0x7'),'9600',_0x0f74('0x8'),_0x0f74('0x9')),'defaultValue':_0x0f74('0x6')},'maxrate':{'type':Sequelize[_0x0f74('0x2')]('2400',_0x0f74('0x6'),'7200','9600','12000',_0x0f74('0x9')),'defaultValue':_0x0f74('0x9')},'modem':{'type':Sequelize[_0x0f74('0x1')],'defaultValue':_0x0f74('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0f74('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0f74('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0f74('0x2')](_0x0f74('0xc'),_0x0f74('0xd'),'DADHI',_0x0f74('0xe')),'defaultValue':_0x0f74('0xc')},'key':{'type':Sequelize[_0x0f74('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0f74('0xf')],'defaultValue':function(){return _0x0f74('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0f74('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0f74('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0f74('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0f74('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0f74('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0f74('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0f74('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x0f74('0x11')],'defaultValue':![],'comment':_0x0f74('0x13'),'set':function(_0x256ca0){if(!_0x256ca0)this['setDataValue'](_0x0f74('0x14'),null);this['setDataValue'](_0x0f74('0x15'),_0x256ca0);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e99c5ab..19eef3f 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 _0x1c99=['moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','client','http','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','rows','show','params','mandatoryDispositionPause','length','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','app','system','description','Fax\x20Extension','push','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xcdd267,_0x4c18a5){var _0x58115e=function(_0x5e6f23){while(--_0x5e6f23){_0xcdd267['push'](_0xcdd267['shift']());}};_0x58115e(++_0x4c18a5);}(_0x1c99,0xc1));var _0x91c9=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x1c99[_0xfedc72];return _0x2c7c78;};'use strict';var emlformat=require(_0x91c9('0x0'));var rimraf=require(_0x91c9('0x1'));var zipdir=require(_0x91c9('0x2'));var jsonpatch=require(_0x91c9('0x3'));var rp=require(_0x91c9('0x4'));var moment=require(_0x91c9('0x5'));var BPromise=require(_0x91c9('0x6'));var Mustache=require(_0x91c9('0x7'));var util=require('util');var path=require(_0x91c9('0x8'));var sox=require(_0x91c9('0x9'));var csv=require(_0x91c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x91c9('0xb'));var jsforce=require(_0x91c9('0xc'));var deskjs=require(_0x91c9('0xd'));var toCsv=require(_0x91c9('0xa'));var querystring=require(_0x91c9('0xe'));var Papa=require(_0x91c9('0xf'));var Redis=require(_0x91c9('0x10'));var authService=require(_0x91c9('0x11'));var qs=require(_0x91c9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91c9('0x13'));var logger=require(_0x91c9('0x14'))('api');var utils=require(_0x91c9('0x15'));var config=require(_0x91c9('0x16'));var licenseUtil=require(_0x91c9('0x17'));var db=require('../../mysqldb')['db'];config[_0x91c9('0x18')]=_['defaults'](config[_0x91c9('0x18')],{'host':_0x91c9('0x19'),'port':0x18eb});var socket=require(_0x91c9('0x1a'))(new Redis(config['redis']));require(_0x91c9('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x91c9('0x1c')][_0x91c9('0x1d')]({'port':0x232c});var client9002=jayson[_0x91c9('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12e536,_0x38b529,_0x8dd448,_0x57219d){return new BPromise(function(_0x32961a,_0x3fb1a8){var _0x5785c5=_0x57219d||client;return _0x5785c5[_0x91c9('0x1e')](_0x12e536,_0x8dd448)[_0x91c9('0x1f')](function(_0x250f5b){logger[_0x91c9('0x20')]('FaxAccount,\x20%s,\x20%s',_0x38b529,'request\x20sent');logger[_0x91c9('0x21')](_0x91c9('0x22'),_0x38b529,_0x91c9('0x23'),JSON['stringify'](_0x250f5b));if(_0x250f5b[_0x91c9('0x24')]){if(_0x250f5b[_0x91c9('0x24')][_0x91c9('0x25')]===0x1f4){logger[_0x91c9('0x24')](_0x91c9('0x26'),_0x38b529,_0x250f5b[_0x91c9('0x24')][_0x91c9('0x27')]);return _0x3fb1a8(_0x250f5b[_0x91c9('0x24')][_0x91c9('0x27')]);}logger[_0x91c9('0x24')](_0x91c9('0x26'),_0x38b529,_0x250f5b[_0x91c9('0x24')][_0x91c9('0x27')]);return _0x32961a(_0x250f5b[_0x91c9('0x24')][_0x91c9('0x27')]);}else{logger[_0x91c9('0x20')]('FaxAccount,\x20%s,\x20%s',_0x38b529,'request\x20sent');_0x32961a(_0x250f5b['result'][_0x91c9('0x27')]);}})[_0x91c9('0x28')](function(_0x124a2){logger[_0x91c9('0x24')](_0x91c9('0x26'),_0x38b529,_0x124a2);_0x3fb1a8(_0x124a2);});});}function respondWithStatusCode(_0x52a24f,_0x3a0ef4){_0x3a0ef4=_0x3a0ef4||0xcc;return function(_0x103af7){if(_0x103af7){return _0x52a24f[_0x91c9('0x29')](_0x3a0ef4);}return _0x52a24f[_0x91c9('0x2a')](_0x3a0ef4)['end']();};}function respondWithResult(_0x471118,_0x23fcb7){_0x23fcb7=_0x23fcb7||0xc8;return function(_0x266b22){if(_0x266b22){return _0x471118[_0x91c9('0x2a')](_0x23fcb7)[_0x91c9('0x2b')](_0x266b22);}};}function respondWithFilteredResult(_0xf3580a,_0x54c361){return function(_0x533296){if(_0x533296){var _0x45122d=typeof _0x54c361[_0x91c9('0x2c')]==='undefined'&&typeof _0x54c361[_0x91c9('0x2d')]==='undefined';var _0x3bfd18=_0x533296[_0x91c9('0x2e')];var _0x4cee0c=_0x45122d?0x0:_0x54c361[_0x91c9('0x2c')];var _0x4ff8b0=_0x45122d?_0x533296[_0x91c9('0x2e')]:_0x54c361[_0x91c9('0x2c')]+_0x54c361[_0x91c9('0x2d')];var _0x1fad84;if(_0x4ff8b0>=_0x3bfd18){_0x4ff8b0=_0x3bfd18;_0x1fad84=0xc8;}else{_0x1fad84=0xce;}_0xf3580a[_0x91c9('0x2a')](_0x1fad84);return _0xf3580a[_0x91c9('0x2f')](_0x91c9('0x30'),_0x4cee0c+'-'+_0x4ff8b0+'/'+_0x3bfd18)[_0x91c9('0x2b')](_0x533296);}return null;};}function patchUpdates(_0x51673b){return function(_0x1cf672){try{jsonpatch[_0x91c9('0x31')](_0x1cf672,_0x51673b,!![]);}catch(_0x18cb57){return BPromise[_0x91c9('0x32')](_0x18cb57);}return _0x1cf672[_0x91c9('0x33')]();};}function saveUpdates(_0x7a35c1,_0x2ea120){return function(_0x577589){if(_0x577589){return _0x577589[_0x91c9('0x34')](_0x7a35c1)[_0x91c9('0x1f')](function(_0x5aa8e4){return _0x5aa8e4;});}return null;};}function removeEntity(_0x514af9,_0x2a6067){return function(_0x450f6f){if(_0x450f6f){return _0x450f6f[_0x91c9('0x35')]()[_0x91c9('0x1f')](function(){var _0x3971fc=_0x450f6f[_0x91c9('0x36')]({'plain':!![]});var _0x16e61a=_0x91c9('0x37');return db[_0x91c9('0x38')][_0x91c9('0x35')]({'where':{'type':_0x16e61a,'resourceId':_0x3971fc['id']}})[_0x91c9('0x1f')](function(){return _0x450f6f;});})['then'](function(){_0x514af9[_0x91c9('0x2a')](0xcc)[_0x91c9('0x39')]();});}};}function handleEntityNotFound(_0x3e6c07,_0x10149c){return function(_0x1d37c4){if(!_0x1d37c4){_0x3e6c07[_0x91c9('0x29')](0x194);}return _0x1d37c4;};}function handleError(_0x38e467,_0x251b5c){_0x251b5c=_0x251b5c||0x1f4;return function(_0x132f1b){logger[_0x91c9('0x24')](_0x132f1b[_0x91c9('0x3a')]);if(_0x132f1b[_0x91c9('0x3b')]){delete _0x132f1b[_0x91c9('0x3b')];}_0x38e467[_0x91c9('0x2a')](_0x251b5c)[_0x91c9('0x3c')](_0x132f1b);};}exports[_0x91c9('0x3d')]=function(_0x560bb5,_0x4fbb1e){var _0x2c578f={'include':[{'model':db[_0x91c9('0x3e')],'as':'mandatoryDispositionPause'}]},_0x50c892={},_0x42de5f={'count':0x0,'rows':[]};var _0x47de7e=_[_0x91c9('0x3f')](db[_0x91c9('0x40')][_0x91c9('0x41')],function(_0x17da0a){return{'name':_0x17da0a['fieldName'],'type':_0x17da0a[_0x91c9('0x42')][_0x91c9('0x43')]};});_0x50c892[_0x91c9('0x44')]=_[_0x91c9('0x3f')](_0x47de7e,_0x91c9('0x3b'));_0x50c892['query']=_[_0x91c9('0x45')](_0x560bb5[_0x91c9('0x46')]);_0x50c892['filters']=_[_0x91c9('0x47')](_0x50c892[_0x91c9('0x44')],_0x50c892['query']);_0x2c578f[_0x91c9('0x48')]=_['intersection'](_0x50c892[_0x91c9('0x44')],qs[_0x91c9('0x49')](_0x560bb5['query']['fields']));_0x2c578f[_0x91c9('0x48')]=_0x2c578f[_0x91c9('0x48')]['length']?_0x2c578f[_0x91c9('0x48')]:_0x50c892[_0x91c9('0x44')];if(!_0x560bb5[_0x91c9('0x46')][_0x91c9('0x4a')](_0x91c9('0x4b'))){_0x2c578f[_0x91c9('0x2d')]=qs['limit'](_0x560bb5[_0x91c9('0x46')][_0x91c9('0x2d')]);_0x2c578f[_0x91c9('0x2c')]=qs[_0x91c9('0x2c')](_0x560bb5[_0x91c9('0x46')][_0x91c9('0x2c')]);}_0x2c578f[_0x91c9('0x4c')]=qs[_0x91c9('0x4d')](_0x560bb5[_0x91c9('0x46')][_0x91c9('0x4d')]);_0x2c578f[_0x91c9('0x4e')]=qs[_0x91c9('0x4f')](_[_0x91c9('0x50')](_0x560bb5[_0x91c9('0x46')],_0x50c892['filters']),_0x47de7e);if(_0x560bb5[_0x91c9('0x46')]['filter']){_0x2c578f[_0x91c9('0x4e')]=_[_0x91c9('0x51')](_0x2c578f[_0x91c9('0x4e')],{'$or':_[_0x91c9('0x3f')](_0x47de7e,function(_0x1f30f7){if(_0x1f30f7[_0x91c9('0x42')]!==_0x91c9('0x52')){var _0x68d4a={};_0x68d4a[_0x1f30f7[_0x91c9('0x3b')]]={'$like':'%'+_0x560bb5[_0x91c9('0x46')][_0x91c9('0x53')]+'%'};return _0x68d4a;}})});}_0x2c578f=_[_0x91c9('0x51')]({},_0x2c578f,_0x560bb5['options']);var _0x24a2ca={'where':_0x2c578f[_0x91c9('0x4e')]};return db['FaxAccount'][_0x91c9('0x2e')](_0x24a2ca)[_0x91c9('0x1f')](function(_0x444b00){_0x42de5f['count']=_0x444b00;if(_0x560bb5['query']['includeAll']){_0x2c578f['include']=[{'all':!![]}];}return db[_0x91c9('0x40')]['findAll'](_0x2c578f);})[_0x91c9('0x1f')](function(_0x54152c){_0x42de5f[_0x91c9('0x54')]=_0x54152c;return _0x42de5f;})[_0x91c9('0x1f')](respondWithFilteredResult(_0x4fbb1e,_0x2c578f))['catch'](handleError(_0x4fbb1e,null));};exports[_0x91c9('0x55')]=function(_0x242998,_0x510430){var _0x341d04={'raw':![],'where':{'id':_0x242998[_0x91c9('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x91c9('0x57')}]},_0x53a451={};_0x53a451[_0x91c9('0x44')]=_[_0x91c9('0x45')](db[_0x91c9('0x40')]['rawAttributes']);_0x53a451[_0x91c9('0x46')]=_[_0x91c9('0x45')](_0x242998[_0x91c9('0x46')]);_0x53a451['filters']=_[_0x91c9('0x47')](_0x53a451['model'],_0x53a451[_0x91c9('0x46')]);_0x341d04[_0x91c9('0x48')]=_[_0x91c9('0x47')](_0x53a451[_0x91c9('0x44')],qs[_0x91c9('0x49')](_0x242998['query']['fields']));_0x341d04['attributes']=_0x341d04[_0x91c9('0x48')][_0x91c9('0x58')]?_0x341d04[_0x91c9('0x48')]:_0x53a451[_0x91c9('0x44')];if(_0x242998[_0x91c9('0x46')][_0x91c9('0x59')]){_0x341d04[_0x91c9('0x5a')]=[{'all':!![]}];}_0x341d04=_['merge']({},_0x341d04,_0x242998[_0x91c9('0x5b')]);return db[_0x91c9('0x40')][_0x91c9('0x5c')](_0x341d04)[_0x91c9('0x1f')](handleEntityNotFound(_0x510430,null))[_0x91c9('0x1f')](respondWithResult(_0x510430,null))[_0x91c9('0x28')](handleError(_0x510430,null));};exports[_0x91c9('0x5d')]=function(_0x58b26a,_0x5368c1){return db[_0x91c9('0x40')]['create'](_0x58b26a[_0x91c9('0x5e')],{})[_0x91c9('0x1f')](function(_0xa3f44f){var _0x24313f=_0x58b26a[_0x91c9('0x5f')][_0x91c9('0x36')]({'plain':!![]});if(!_0x24313f)throw new Error(_0x91c9('0x60'));if(_0x24313f[_0x91c9('0x61')]===_0x91c9('0x5f')){var _0x4741b0=_0xa3f44f['get']({'plain':!![]});var _0xc8ed03=_0x91c9('0x37');return db[_0x91c9('0x62')][_0x91c9('0x5c')]({'where':{'name':_0xc8ed03,'userProfileId':_0x24313f[_0x91c9('0x63')]},'raw':!![]})[_0x91c9('0x1f')](function(_0x46ebf5){if(_0x46ebf5&&_0x46ebf5[_0x91c9('0x64')]===0x0){return db[_0x91c9('0x38')]['create']({'name':_0x4741b0[_0x91c9('0x3b')],'resourceId':_0x4741b0['id'],'type':_0x46ebf5[_0x91c9('0x3b')],'sectionId':_0x46ebf5['id']},{})[_0x91c9('0x1f')](function(){return _0xa3f44f;});}else{return _0xa3f44f;}})[_0x91c9('0x28')](function(_0x53c97d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53c97d);throw _0x53c97d;});}return _0xa3f44f;})[_0x91c9('0x1f')](respondWithResult(_0x5368c1,0xc9))['catch'](handleError(_0x5368c1,null));};exports[_0x91c9('0x34')]=function(_0x459963,_0x1cee2a){if(_0x459963[_0x91c9('0x5e')]['id']){delete _0x459963[_0x91c9('0x5e')]['id'];}return db[_0x91c9('0x40')]['find']({'where':{'id':_0x459963[_0x91c9('0x56')]['id']},'include':[{'model':db[_0x91c9('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x91c9('0x1f')](handleEntityNotFound(_0x1cee2a,null))[_0x91c9('0x1f')](saveUpdates(_0x459963[_0x91c9('0x5e')],null))[_0x91c9('0x1f')](respondWithResult(_0x1cee2a,null))[_0x91c9('0x28')](handleError(_0x1cee2a,null));};exports['destroy']=function(_0x2c44ea,_0x43671b){return db[_0x91c9('0x40')][_0x91c9('0x5c')]({'where':{'id':_0x2c44ea[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x43671b,null))[_0x91c9('0x1f')](removeEntity(_0x43671b,null))[_0x91c9('0x28')](handleError(_0x43671b,null));};exports['describe']=function(_0x119867,_0x463a63){return db[_0x91c9('0x40')][_0x91c9('0x65')]()[_0x91c9('0x1f')](respondWithResult(_0x463a63,null))[_0x91c9('0x28')](handleError(_0x463a63,null));};exports[_0x91c9('0x66')]=function(_0xb79979,_0x424520,_0x34add6){if(_0xb79979[_0x91c9('0x5e')]['id']){delete _0xb79979[_0x91c9('0x5e')]['id'];}return db[_0x91c9('0x40')][_0x91c9('0x5c')]({'where':{'id':_0xb79979['params']['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x424520,null))['then'](function(_0x20acae){if(_0x20acae){_0xb79979[_0x91c9('0x5e')][_0x91c9('0x67')]=_0x20acae['id'];return db[_0x91c9('0x68')][_0x91c9('0x5d')](_0xb79979[_0x91c9('0x5e')]);}})[_0x91c9('0x1f')](respondWithResult(_0x424520,null))['catch'](handleError(_0x424520,null));};exports[_0x91c9('0x69')]=function(_0x52cf06,_0x316f4f,_0x5561ae){var _0x8c5665={'raw':![],'where':{}};var _0x312cb0={};var _0x3436cc={'count':0x0,'rows':[]};return db[_0x91c9('0x40')]['findOne']({'where':{'id':_0x52cf06[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x316f4f,null))[_0x91c9('0x1f')](function(_0x5c0a74){if(_0x5c0a74){_0x312cb0['model']=_['keys'](db['Disposition']['rawAttributes']);_0x312cb0['query']=_[_0x91c9('0x45')](_0x52cf06['query']);_0x312cb0[_0x91c9('0x4f')]=_['intersection'](_0x312cb0[_0x91c9('0x44')],_0x312cb0[_0x91c9('0x46')]);_0x8c5665[_0x91c9('0x48')]=_[_0x91c9('0x47')](_0x312cb0[_0x91c9('0x44')],qs['fields'](_0x52cf06[_0x91c9('0x46')][_0x91c9('0x49')]));_0x8c5665[_0x91c9('0x48')]=_0x8c5665[_0x91c9('0x48')][_0x91c9('0x58')]?_0x8c5665[_0x91c9('0x48')]:_0x312cb0['model'];if(!_0x52cf06[_0x91c9('0x46')]['hasOwnProperty']('nolimit')){_0x8c5665[_0x91c9('0x2d')]=qs[_0x91c9('0x2d')](_0x52cf06[_0x91c9('0x46')][_0x91c9('0x2d')]);_0x8c5665[_0x91c9('0x2c')]=qs[_0x91c9('0x2c')](_0x52cf06[_0x91c9('0x46')][_0x91c9('0x2c')]);}_0x8c5665['order']=qs[_0x91c9('0x4d')](_0x52cf06['query'][_0x91c9('0x4d')]);_0x8c5665[_0x91c9('0x4e')]=qs[_0x91c9('0x4f')](_[_0x91c9('0x50')](_0x52cf06[_0x91c9('0x46')],_0x312cb0['filters']));_0x8c5665[_0x91c9('0x4e')]['FaxAccountId']=_0x5c0a74['id'];if(_0x52cf06[_0x91c9('0x46')]['filter']){_0x8c5665[_0x91c9('0x4e')]=_[_0x91c9('0x51')](_0x8c5665[_0x91c9('0x4e')],{'$or':_[_0x91c9('0x3f')](_0x8c5665['attributes'],function(_0x28c154){var _0x130f11={};_0x130f11[_0x28c154]={'$like':'%'+_0x52cf06['query'][_0x91c9('0x53')]+'%'};return _0x130f11;})});}_0x8c5665=_[_0x91c9('0x51')]({},_0x8c5665,_0x52cf06['options']);return db[_0x91c9('0x68')]['count']({'where':_0x8c5665[_0x91c9('0x4e')]})[_0x91c9('0x1f')](function(_0x5ee442){_0x3436cc[_0x91c9('0x2e')]=_0x5ee442;if(_0x52cf06['query']['includeAll']){_0x8c5665[_0x91c9('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x91c9('0x6a')](_0x8c5665);})['then'](function(_0x394d75){_0x3436cc['rows']=_0x394d75;return _0x3436cc;});}})[_0x91c9('0x1f')](respondWithFilteredResult(_0x316f4f,_0x8c5665))[_0x91c9('0x28')](handleError(_0x316f4f,null));};exports[_0x91c9('0x6b')]=function(_0x181508,_0x1513a8,_0xe4eb29){return db['FaxAccount'][_0x91c9('0x5c')]({'where':{'id':_0x181508['params']['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x1513a8,null))[_0x91c9('0x1f')](function(_0x3949c1){if(_0x3949c1){return _0x3949c1[_0x91c9('0x6b')](_0x181508[_0x91c9('0x46')][_0x91c9('0x6c')]);}})[_0x91c9('0x1f')](respondWithStatusCode(_0x1513a8,null))['catch'](handleError(_0x1513a8,null));};exports[_0x91c9('0x6d')]=function(_0x230b02,_0x549ae4,_0x49efcf){if(_0x230b02[_0x91c9('0x5e')]['id']){delete _0x230b02[_0x91c9('0x5e')]['id'];}return db[_0x91c9('0x40')][_0x91c9('0x5c')]({'where':{'id':_0x230b02[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x549ae4,null))['then'](function(_0x143852){if(_0x143852){_0x230b02['body']['FaxAccountId']=_0x143852['id'];return db['CannedAnswer']['create'](_0x230b02[_0x91c9('0x5e')]);}})[_0x91c9('0x1f')](respondWithResult(_0x549ae4,null))[_0x91c9('0x28')](handleError(_0x549ae4,null));};exports['getAnswers']=function(_0x317cf4,_0x2cfd41,_0x3e5bc7){var _0x4bff3a={'raw':![],'where':{}};var _0x15c2de={};var _0x4ec0ea={'count':0x0,'rows':[]};return db[_0x91c9('0x40')][_0x91c9('0x6e')]({'where':{'id':_0x317cf4[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x2cfd41,null))['then'](function(_0x258c67){if(_0x258c67){_0x15c2de[_0x91c9('0x44')]=_['keys'](db[_0x91c9('0x6f')]['rawAttributes']);_0x15c2de[_0x91c9('0x46')]=_[_0x91c9('0x45')](_0x317cf4[_0x91c9('0x46')]);_0x15c2de[_0x91c9('0x4f')]=_[_0x91c9('0x47')](_0x15c2de[_0x91c9('0x44')],_0x15c2de['query']);_0x4bff3a['attributes']=_[_0x91c9('0x47')](_0x15c2de[_0x91c9('0x44')],qs[_0x91c9('0x49')](_0x317cf4[_0x91c9('0x46')][_0x91c9('0x49')]));_0x4bff3a[_0x91c9('0x48')]=_0x4bff3a[_0x91c9('0x48')][_0x91c9('0x58')]?_0x4bff3a[_0x91c9('0x48')]:_0x15c2de[_0x91c9('0x44')];if(!_0x317cf4[_0x91c9('0x46')][_0x91c9('0x4a')]('nolimit')){_0x4bff3a[_0x91c9('0x2d')]=qs[_0x91c9('0x2d')](_0x317cf4[_0x91c9('0x46')][_0x91c9('0x2d')]);_0x4bff3a[_0x91c9('0x2c')]=qs['offset'](_0x317cf4['query'][_0x91c9('0x2c')]);}_0x4bff3a[_0x91c9('0x4c')]=qs[_0x91c9('0x4d')](_0x317cf4['query']['sort']);_0x4bff3a['where']=qs[_0x91c9('0x4f')](_[_0x91c9('0x50')](_0x317cf4[_0x91c9('0x46')],_0x15c2de[_0x91c9('0x4f')]));_0x4bff3a[_0x91c9('0x4e')][_0x91c9('0x67')]=_0x258c67['id'];if(_0x317cf4[_0x91c9('0x46')]['filter']){_0x4bff3a[_0x91c9('0x4e')]=_[_0x91c9('0x51')](_0x4bff3a[_0x91c9('0x4e')],{'$or':_[_0x91c9('0x3f')](_0x4bff3a[_0x91c9('0x48')],function(_0x37fb63){var _0x31f624={};_0x31f624[_0x37fb63]={'$like':'%'+_0x317cf4[_0x91c9('0x46')][_0x91c9('0x53')]+'%'};return _0x31f624;})});}_0x4bff3a=_['merge']({},_0x4bff3a,_0x317cf4['options']);return db[_0x91c9('0x6f')]['count']({'where':_0x4bff3a[_0x91c9('0x4e')]})[_0x91c9('0x1f')](function(_0x5b9628){_0x4ec0ea[_0x91c9('0x2e')]=_0x5b9628;if(_0x317cf4[_0x91c9('0x46')]['includeAll']){_0x4bff3a[_0x91c9('0x5a')]=[{'all':!![]}];}return db[_0x91c9('0x6f')][_0x91c9('0x6a')](_0x4bff3a);})[_0x91c9('0x1f')](function(_0x4ea283){_0x4ec0ea['rows']=_0x4ea283;return _0x4ec0ea;});}})['then'](respondWithFilteredResult(_0x2cfd41,_0x4bff3a))[_0x91c9('0x28')](handleError(_0x2cfd41,null));};exports[_0x91c9('0x70')]=function(_0x38f489,_0x5a7d56,_0x1b7acd){return db[_0x91c9('0x40')][_0x91c9('0x5c')]({'where':{'id':_0x38f489[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x5a7d56,null))[_0x91c9('0x1f')](function(_0x138229){if(_0x138229){return _0x138229[_0x91c9('0x70')](_0x38f489[_0x91c9('0x46')][_0x91c9('0x6c')]);}})[_0x91c9('0x1f')](respondWithStatusCode(_0x5a7d56,null))[_0x91c9('0x28')](handleError(_0x5a7d56,null));};exports[_0x91c9('0x71')]=function(_0x329cb6,_0x37655e,_0x14b6ac){return db[_0x91c9('0x72')][_0x91c9('0x5c')]({'where':{'id':_0x329cb6[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x37655e,null))[_0x91c9('0x1f')](function(_0x2f0ec3){if(_0x2f0ec3){return _0x2f0ec3[_0x91c9('0x71')](_0x329cb6[_0x91c9('0x5e')]['ids'],_[_0x91c9('0x73')](_0x329cb6['body'],[_0x91c9('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x37655e,null))[_0x91c9('0x28')](handleError(_0x37655e,null));};exports[_0x91c9('0x74')]=function(_0x1b00c3,_0x540422,_0x31de93){var _0x2efc01={'raw':![],'where':{}};var _0x269c4f={};var _0x1eea17={'count':0x0,'rows':[]};return db['FaxAccount'][_0x91c9('0x6e')]({'where':{'id':_0x1b00c3[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x540422,null))[_0x91c9('0x1f')](function(_0x6fdc6b){if(_0x6fdc6b){_0x269c4f[_0x91c9('0x44')]=_['keys'](db[_0x91c9('0x72')][_0x91c9('0x41')]);_0x269c4f[_0x91c9('0x46')]=_['keys'](_0x1b00c3['query']);_0x269c4f[_0x91c9('0x4f')]=_[_0x91c9('0x47')](_0x269c4f[_0x91c9('0x44')],_0x269c4f['query']);_0x2efc01[_0x91c9('0x48')]=_[_0x91c9('0x47')](_0x269c4f['model'],qs[_0x91c9('0x49')](_0x1b00c3['query'][_0x91c9('0x49')]));_0x2efc01[_0x91c9('0x48')]=_0x2efc01[_0x91c9('0x48')][_0x91c9('0x58')]?_0x2efc01[_0x91c9('0x48')]:_0x269c4f['model'];if(!_0x1b00c3['query'][_0x91c9('0x4a')](_0x91c9('0x4b'))){_0x2efc01[_0x91c9('0x2d')]=qs[_0x91c9('0x2d')](_0x1b00c3[_0x91c9('0x46')]['limit']);_0x2efc01[_0x91c9('0x2c')]=qs[_0x91c9('0x2c')](_0x1b00c3[_0x91c9('0x46')]['offset']);}_0x2efc01[_0x91c9('0x4c')]=qs[_0x91c9('0x4d')](_0x1b00c3[_0x91c9('0x46')][_0x91c9('0x4d')]);_0x2efc01['where']=qs[_0x91c9('0x4f')](_[_0x91c9('0x50')](_0x1b00c3[_0x91c9('0x46')],_0x269c4f[_0x91c9('0x4f')]));_0x2efc01[_0x91c9('0x4e')]['FaxAccountId']=_0x6fdc6b['id'];if(_0x1b00c3[_0x91c9('0x46')][_0x91c9('0x53')]){_0x2efc01[_0x91c9('0x4e')]=_['merge'](_0x2efc01[_0x91c9('0x4e')],{'$or':_[_0x91c9('0x3f')](_0x2efc01[_0x91c9('0x48')],function(_0xd77a2c){var _0x4c069b={};_0x4c069b[_0xd77a2c]={'$like':'%'+_0x1b00c3['query'][_0x91c9('0x53')]+'%'};return _0x4c069b;})});}_0x2efc01=_[_0x91c9('0x51')]({},_0x2efc01,_0x1b00c3[_0x91c9('0x5b')]);return db[_0x91c9('0x72')][_0x91c9('0x2e')]({'where':_0x2efc01[_0x91c9('0x4e')]})[_0x91c9('0x1f')](function(_0x293117){_0x1eea17[_0x91c9('0x2e')]=_0x293117;if(_0x1b00c3['query'][_0x91c9('0x59')]){_0x2efc01[_0x91c9('0x5a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x91c9('0x75')],'as':_0x91c9('0x76'),'attributes':['name',_0x91c9('0x77'),_0x91c9('0x78')],'required':![]},{'model':db[_0x91c9('0x79')],'as':_0x91c9('0x7a'),'attributes':['id',_0x91c9('0x3b'),_0x91c9('0x7b')],'where':_0x1b00c3[_0x91c9('0x46')][_0x91c9('0x7c')]?{'id':_0x1b00c3[_0x91c9('0x46')][_0x91c9('0x7c')]}:undefined,'required':_0x1b00c3[_0x91c9('0x46')][_0x91c9('0x7c')]?!![]:![]}];}return db[_0x91c9('0x72')][_0x91c9('0x6a')](_0x2efc01);})['then'](function(_0x3ed972){_0x1eea17['rows']=_0x3ed972;return _0x1eea17;});}})[_0x91c9('0x1f')](respondWithFilteredResult(_0x540422,_0x2efc01))[_0x91c9('0x28')](handleError(_0x540422,null));};exports['addApplications']=function(_0xffa31c,_0x20399e){var _0x530de5=_0xffa31c['params']['id'];var _0x1fc844=_0xffa31c[_0x91c9('0x5e')];var _0x5ad037=0xc8;var _0x20f67d=null;return db['sequelize'][_0x91c9('0x7d')]({'isolationLevel':db[_0x91c9('0x7e')][_0x91c9('0x7f')][_0x91c9('0x80')]['READ_COMMITTED']},function(_0x459947){return db['FaxAccount']['findOne']({'where':{'id':_0x530de5},'transaction':_0x459947})[_0x91c9('0x1f')](function(_0x275044){if(_0x275044){return db[_0x91c9('0x81')][_0x91c9('0x35')]({'where':{'FaxAccountId':_0x530de5},'transaction':_0x459947})[_0x91c9('0x1f')](function(){var _0x543c24=_[_0x91c9('0x3f')](_0x1fc844,function(_0x250e2b){_0x250e2b[_0x91c9('0x67')]=_0x530de5;return _0x250e2b;});return db['FaxApplication'][_0x91c9('0x82')](_0x543c24,{'transaction':_0x459947});});}else{_0x5ad037=0x194;_0x20f67d=[];}});})[_0x91c9('0x1f')](function(){if(_0x5ad037!==0x194){return db[_0x91c9('0x81')][_0x91c9('0x83')]({'where':{'FaxAccountId':_0x530de5},'order':_0x91c9('0x84')})[_0x91c9('0x1f')](function(_0xecdd8c){_0x20f67d=_0xecdd8c;});}})[_0x91c9('0x28')](function(_0x12af24){_0x5ad037=0x1f4;logger[_0x91c9('0x24')](_0x12af24[_0x91c9('0x3a')]);if(_0x12af24[_0x91c9('0x3b')]){delete _0x12af24[_0x91c9('0x3b')];}_0x20f67d=_0x12af24;})['finally'](function(){if(_0x20f67d===null){_0x20399e[_0x91c9('0x29')](_0x5ad037);}else{if(_0x5ad037===0x1f4){_0x20399e[_0x91c9('0x2a')](_0x5ad037)[_0x91c9('0x3c')](_0x20f67d);}else{_0x20399e[_0x91c9('0x2a')](_0x5ad037)[_0x91c9('0x2b')](_0x20f67d);}}});};exports[_0x91c9('0x85')]=function(_0x4ac8fc,_0x4f03a1,_0xb2714f){var _0x3535c1={};var _0x58bc75={};var _0x39d130;var _0x290617;return db[_0x91c9('0x40')]['findOne']({'where':{'id':_0x4ac8fc[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x4f03a1,null))[_0x91c9('0x1f')](function(_0x21f5d3){if(_0x21f5d3){_0x39d130=_0x21f5d3;_0x58bc75['model']=_[_0x91c9('0x45')](db[_0x91c9('0x81')]['rawAttributes']);_0x58bc75[_0x91c9('0x46')]=_[_0x91c9('0x45')](_0x4ac8fc[_0x91c9('0x46')]);_0x58bc75[_0x91c9('0x4f')]=_[_0x91c9('0x47')](_0x58bc75[_0x91c9('0x44')],_0x58bc75['query']);_0x3535c1[_0x91c9('0x48')]=_[_0x91c9('0x47')](_0x58bc75[_0x91c9('0x44')],qs[_0x91c9('0x49')](_0x4ac8fc['query']['fields']));_0x3535c1[_0x91c9('0x48')]=_0x3535c1[_0x91c9('0x48')][_0x91c9('0x58')]?_0x3535c1['attributes']:_0x58bc75[_0x91c9('0x44')];_0x3535c1[_0x91c9('0x4c')]=qs[_0x91c9('0x4d')](_0x4ac8fc['query'][_0x91c9('0x4d')]);_0x3535c1[_0x91c9('0x4e')]=qs['filters'](_[_0x91c9('0x50')](_0x4ac8fc[_0x91c9('0x46')],_0x58bc75[_0x91c9('0x4f')]));if(_0x4ac8fc['query']['filter']){_0x3535c1['where']=_[_0x91c9('0x51')](_0x3535c1['where'],{'$or':_['map'](_0x3535c1['attributes'],function(_0xc81628){var _0x2d1aa6={};_0x2d1aa6[_0xc81628]={'$like':'%'+_0x4ac8fc[_0x91c9('0x46')][_0x91c9('0x53')]+'%'};return _0x2d1aa6;})});}_0x3535c1=_[_0x91c9('0x51')]({},_0x3535c1,_0x4ac8fc[_0x91c9('0x5b')]);return _0x39d130[_0x91c9('0x85')](_0x3535c1);}})['then'](function(_0x5daef3){if(_0x5daef3){_0x290617=_0x5daef3['length'];if(!_0x4ac8fc[_0x91c9('0x46')][_0x91c9('0x4a')]('nolimit')){_0x3535c1[_0x91c9('0x2d')]=qs[_0x91c9('0x2d')](_0x4ac8fc[_0x91c9('0x46')][_0x91c9('0x2d')]);_0x3535c1['offset']=qs[_0x91c9('0x2c')](_0x4ac8fc['query'][_0x91c9('0x2c')]);}return _0x39d130[_0x91c9('0x85')](_0x3535c1);}})[_0x91c9('0x1f')](function(_0x25228b){if(_0x25228b){return _0x25228b?{'count':_0x290617,'rows':_0x25228b}:null;}})[_0x91c9('0x1f')](respondWithResult(_0x4f03a1,null))[_0x91c9('0x28')](handleError(_0x4f03a1,null));};function Extension(_0x43e3e9,_0x38056c,_0x7a980b,_0x279b32){this['context']=_0x91c9('0x86');this['exten']=_0x43e3e9['localstationid'];this[_0x91c9('0x87')]=_0x279b32;this[_0x91c9('0x42')]=_0x91c9('0x88');this[_0x91c9('0x89')]=_0x91c9('0x8a');this[_0x91c9('0x67')]=_0x43e3e9['id'];this[_0x91c9('0x84')]=_0x38056c;this['appdata']=_0x7a980b;}function createExtensionsReciveFax(_0x2021af){var _0x367fcb=0x1;var _0x4ba14a=[];_0x4ba14a[_0x91c9('0x8b')](new Extension(_0x2021af,_0x367fcb,'','Answer'));_0x367fcb+=0x1;_0x4ba14a[_0x91c9('0x8b')](new Extension(_0x2021af,_0x367fcb,'CDR(type)=inbound-fax','Set'));_0x367fcb+=0x1;for(var _0x2ef815 in _0x2021af){if(_0x2021af['hasOwnProperty'](_0x2ef815)&&(_0x2ef815===_0x91c9('0x8c')||_0x2ef815==='localstationid'||_0x2ef815===_0x91c9('0x8d')||_0x2ef815===_0x91c9('0x8e')||_0x2ef815===_0x91c9('0x8f')||_0x2ef815===_0x91c9('0x90')||_0x2ef815==='minrate'||_0x2ef815===_0x91c9('0x91')||_0x2ef815===_0x91c9('0x92'))){_0x4ba14a['push'](new Extension(_0x2021af,_0x367fcb,_0x91c9('0x93')+_0x2ef815+')='+_0x2021af[_0x2ef815],_0x91c9('0x94')));_0x367fcb+=0x1;}}_0x4ba14a[_0x91c9('0x8b')](new Extension(_0x2021af,_0x367fcb,'6',_0x91c9('0x95')));_0x367fcb+=0x1;_0x4ba14a[_0x91c9('0x8b')](new Extension(_0x2021af,_0x367fcb,_0x91c9('0x96'),_0x91c9('0x97')));_0x367fcb=0x0;return _0x4ba14a;}exports[_0x91c9('0x98')]=function(_0x190987,_0x5c0456,_0xbe1ded){var _0x207fcb;return db[_0x91c9('0x7e')][_0x91c9('0x7d')](function(_0x129bea){return db[_0x91c9('0x40')][_0x91c9('0x5d')](_0x190987[_0x91c9('0x5e')],{'transaction':_0x129bea})[_0x91c9('0x1f')](function(_0x5d9419){_0x207fcb=_0x5d9419[_0x91c9('0x36')]({'plain':!![]});return db[_0x91c9('0x99')][_0x91c9('0x82')](createExtensionsReciveFax(_0x207fcb),{'transaction':_0x129bea});});})[_0x91c9('0x1f')](function(){return _0x207fcb;})[_0x91c9('0x1f')](respondWithResult(_0x5c0456,null))['catch'](handleError(_0x5c0456,null));};exports[_0x91c9('0x9a')]=function(_0x1f91a6,_0x18edb8,_0x22c78b){var _0x454863;return db[_0x91c9('0x7e')]['transaction'](function(_0x23dbf9){return db[_0x91c9('0x40')][_0x91c9('0x34')](_0x1f91a6[_0x91c9('0x5e')],{'where':{'id':_0x1f91a6[_0x91c9('0x5e')]['id']},'transaction':_0x23dbf9})[_0x91c9('0x1f')](function(_0x5ca0be){return db[_0x91c9('0x99')][_0x91c9('0x35')]({'where':{'FaxAccountId':_0x1f91a6[_0x91c9('0x5e')]['id']},'transaction':_0x23dbf9})[_0x91c9('0x1f')](function(_0xcff378){return db[_0x91c9('0x99')]['bulkCreate'](createExtensionsReciveFax(_[_0x91c9('0x73')](_0x1f91a6[_0x91c9('0x5e')],[_0x91c9('0x9b'),_0x91c9('0x43'),_0x91c9('0x9c'),'updatedAt',_0x91c9('0x9d'),_0x91c9('0x9e')])),{'transaction':_0x23dbf9});});});})[_0x91c9('0x1f')](function(){return db[_0x91c9('0x40')][_0x91c9('0x9f')](_0x1f91a6[_0x91c9('0x5e')]['id']);})[_0x91c9('0x1f')](respondWithResult(_0x18edb8,null))[_0x91c9('0x28')](handleError(_0x18edb8,null));};exports[_0x91c9('0xa0')]=function(_0x197148,_0x4f594e,_0x33dbd1){var _0x4feb26={'raw':!![],'where':{}};var _0x3d6ddf={};var _0x4343aa={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x197148['params']['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x4f594e,null))[_0x91c9('0x1f')](function(_0x3c7a5e){if(_0x3c7a5e){_0x3d6ddf[_0x91c9('0x44')]=_['keys'](db[_0x91c9('0xa1')][_0x91c9('0x41')]);_0x3d6ddf[_0x91c9('0x46')]=_[_0x91c9('0x45')](_0x197148[_0x91c9('0x46')]);_0x3d6ddf[_0x91c9('0x4f')]=_[_0x91c9('0x47')](_0x3d6ddf['model'],_0x3d6ddf[_0x91c9('0x46')]);_0x4feb26[_0x91c9('0x48')]=_[_0x91c9('0x47')](_0x3d6ddf[_0x91c9('0x44')],qs[_0x91c9('0x49')](_0x197148['query'][_0x91c9('0x49')]));_0x4feb26[_0x91c9('0x48')]=_0x4feb26[_0x91c9('0x48')]['length']?_0x4feb26[_0x91c9('0x48')]:_0x3d6ddf[_0x91c9('0x44')];if(!_0x197148['query'][_0x91c9('0x4a')](_0x91c9('0x4b'))){_0x4feb26['limit']=qs[_0x91c9('0x2d')](_0x197148[_0x91c9('0x46')]['limit']);_0x4feb26[_0x91c9('0x2c')]=qs[_0x91c9('0x2c')](_0x197148['query']['offset']);}_0x4feb26[_0x91c9('0x4c')]=qs[_0x91c9('0x4d')](_0x197148[_0x91c9('0x46')]['sort']);_0x4feb26[_0x91c9('0x4e')]=qs[_0x91c9('0x4f')](_[_0x91c9('0x50')](_0x197148[_0x91c9('0x46')],_0x3d6ddf[_0x91c9('0x4f')]));_0x4feb26['where']['FaxAccountId']=_0x3c7a5e['id'];if(_0x197148[_0x91c9('0x46')]['filter']){_0x4feb26[_0x91c9('0x4e')]=_[_0x91c9('0x51')](_0x4feb26[_0x91c9('0x4e')],{'$or':_[_0x91c9('0x3f')](_0x4feb26[_0x91c9('0x48')],function(_0x5c5220){var _0x54e946={};_0x54e946[_0x5c5220]={'$like':'%'+_0x197148[_0x91c9('0x46')]['filter']+'%'};return _0x54e946;})});}if(_0x197148[_0x91c9('0x46')]['$gte']){var _0x48823b=_0x197148[_0x91c9('0x46')][_0x91c9('0xa2')]['split'](',');var _0x11c4d2={};_0x11c4d2[_0x48823b[0x0]]={'$gte':moment(_0x48823b[0x1])[_0x91c9('0xa3')](_0x91c9('0xa4'))};_0x4feb26[_0x91c9('0x4e')]=_[_0x91c9('0x51')](_0x4feb26['where'],_0x11c4d2);}_0x4feb26=_['merge']({},_0x4feb26,_0x197148[_0x91c9('0x5b')]);return db[_0x91c9('0xa1')][_0x91c9('0x2e')]({'where':_0x4feb26[_0x91c9('0x4e')]})[_0x91c9('0x1f')](function(_0x52297b){_0x4343aa[_0x91c9('0x2e')]=_0x52297b;if(_0x197148[_0x91c9('0x46')][_0x91c9('0x59')]){_0x4feb26[_0x91c9('0x5a')]=[{'all':!![]}];}return db[_0x91c9('0xa1')][_0x91c9('0x6a')](_0x4feb26);})[_0x91c9('0x1f')](function(_0x37458a){_0x4343aa[_0x91c9('0x54')]=_0x37458a;return _0x4343aa;});}})['then'](respondWithFilteredResult(_0x4f594e,_0x4feb26))[_0x91c9('0x28')](handleError(_0x4f594e,null));};exports[_0x91c9('0x3c')]=function(_0x2053e0,_0x342d9a,_0x2f9eb5){var _0x5b342c,_0x1d4a48={},_0x226dc9;if(_0x2053e0[_0x91c9('0x5e')]['to']){_0x226dc9=_0x2053e0[_0x91c9('0x5e')]['to'][0x0];}return db[_0x91c9('0x40')]['find']({'where':{'id':_0x2053e0['params']['id']},'include':[{'model':db[_0x91c9('0xa5')],'as':'List','include':[{'model':db[_0x91c9('0xa6')],'as':_0x91c9('0xa7'),'where':{'fax':_0x226dc9},'limit':0x1,'order':[[_0x91c9('0xa8'),_0x91c9('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x342d9a,null))[_0x91c9('0x1f')](function(_0x31ed57){_0x5b342c=_0x31ed57;if(_0x2053e0['body'][_0x91c9('0xaa')]&&_0x2053e0['body'][_0x91c9('0xaa')][_0x91c9('0x58')]){for(var _0x119ebd=0x0;_0x119ebd<_0x2053e0[_0x91c9('0x5e')]['attachments'][_0x91c9('0x58')];_0x119ebd+=0x1){_0x2053e0[_0x91c9('0x5e')]['attachments'][_0x119ebd]={'filename':_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][_0x119ebd][_0x91c9('0x3b')],'id':_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][_0x119ebd]['id'],'path':path[_0x91c9('0xab')](config[_0x91c9('0xac')],_0x91c9('0xad'),_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][_0x119ebd][_0x91c9('0xae')])};}}return respondWithRpcPromise(_0x91c9('0xaf'),_0x91c9('0xaf'),{'FaxAccountId':_[_0x91c9('0xb0')](_0x2053e0[_0x91c9('0x56')]['id'])?undefined:_0x2053e0[_0x91c9('0x56')]['id'],'path':_[_0x91c9('0xb0')](_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][0x0][_0x91c9('0x8')])?undefined:_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][0x0][_0x91c9('0x8')],'fax':_[_0x91c9('0xb0')](_0x2053e0[_0x91c9('0x5e')]['to'][0x0])?undefined:_0x2053e0[_0x91c9('0x5e')]['to'][0x0]},client9002);})[_0x91c9('0x1f')](function(){if(_0x5b342c){if(_[_0x91c9('0xb0')](_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xb1')])){_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xb1')]=util['format'](_0x91c9('0xb2'),_0x5b342c[_0x91c9('0x3b')],_0x5b342c[_0x91c9('0xb3')]);}if(_0x5b342c[_0x91c9('0xb4')]){if(_0x5b342c['List'][_0x91c9('0xa7')][_0x91c9('0x58')]){return _0x5b342c[_0x91c9('0xb4')][_0x91c9('0xa7')][0x0];}else{return db[_0x91c9('0xa6')][_0x91c9('0x5d')](_[_0x91c9('0xb5')](_0x2053e0[_0x91c9('0x5e')],{'firstName':_0x2053e0['body']['to'][0x0],'phone':_0x2053e0[_0x91c9('0x5e')]['to'][0x0],'fax':_0x2053e0[_0x91c9('0x5e')]['to'][0x0],'ListId':_0x5b342c[_0x91c9('0x9e')]}));}}else{throw new Error(_0x91c9('0xb6'));}}else{throw new Error(_0x91c9('0xb7'));}})[_0x91c9('0x1f')](function(_0x28e6c2){if(_0x28e6c2){return db['FaxInteraction'][_0x91c9('0x5c')]({'where':{'ContactId':_0x28e6c2['id'],'closed':![],'FaxAccountId':_0x5b342c['id']}})[_0x91c9('0x1f')](function(_0x5e9a71){if(_0x5e9a71){return[_0x5e9a71,![]];}return db['FaxInteraction']['create']({'UserId':_0x2053e0[_0x91c9('0x5f')]['id'],'ContactId':_0x28e6c2['id'],'FaxAccountId':_0x5b342c['id'],'fax':_0x2053e0['body']['to'][0x0],'firstMsgDirection':_0x91c9('0xb8'),'Messages':[_[_0x91c9('0x51')](_0x2053e0['body'],{'read':![],'body':_0x2053e0['body'][_0x91c9('0xaa')][0x0]['filename'],'FaxAccountId':_0x5b342c['id'],'UserId':_0x2053e0[_0x91c9('0x5f')]['id'],'ContactId':_0x28e6c2['id'],'AttachmentId':_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x91c9('0xa1')],'as':_0x91c9('0xb9')}]})['then'](function(_0x5899ea){return[_0x5899ea,!![]];});});}else{throw new Error(_0x91c9('0xba'));}})[_0x91c9('0xbb')](function(_0x2ddf74,_0x408705){if(_0x408705){return _0x2ddf74;}return db[_0x91c9('0xa1')][_0x91c9('0x5d')]({'direction':_0x91c9('0xb8'),'read':![],'body':_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][0x0]['filename'],'FaxAccountId':_0x5b342c['id'],'FaxInteractionId':_0x2ddf74['id'],'UserId':_0x2053e0[_0x91c9('0x5f')]['id'],'ContactId':_0x2ddf74[_0x91c9('0xbc')],'AttachmentId':_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][0x0]['id']})[_0x91c9('0x1f')](function(_0x5976ee){_0x2ddf74[_0x91c9('0xbd')][_0x91c9('0xb9')]=[];_0x2ddf74[_0x91c9('0xbd')][_0x91c9('0xb9')][_0x91c9('0x8b')](_0x5976ee[_0x91c9('0xbd')]);return _0x2ddf74;});})[_0x91c9('0x1f')](function(_0x5a54f3){respondWithRpcPromise('SendFax',_0x91c9('0xbe'),{'FaxAccountId':_[_0x91c9('0xb0')](_0x2053e0['params']['id'])?undefined:_0x2053e0[_0x91c9('0x56')]['id'],'path':_['isNil'](_0x2053e0[_0x91c9('0x5e')]['attachments'][0x0][_0x91c9('0x8')])?undefined:_0x2053e0[_0x91c9('0x5e')][_0x91c9('0xaa')][0x0]['path'],'fax':_[_0x91c9('0xb0')](_0x2053e0[_0x91c9('0x5e')]['to'][0x0])?undefined:_0x2053e0['body']['to'][0x0],'AttachmentId':_0x2053e0['body'][_0x91c9('0xaa')][0x0]['id']},client9002)['then'](function(_0x51dede){logger[_0x91c9('0x20')](_0x91c9('0xbf'),_0x51dede);})[_0x91c9('0x28')](function(_0x803dc8){logger[_0x91c9('0x20')]('SendFaxRpc,\x20%s',_0x803dc8);});return _0x5a54f3;})[_0x91c9('0x1f')](respondWithResult(_0x342d9a,null))[_0x91c9('0x28')](handleError(_0x342d9a,null));};exports[_0x91c9('0xc0')]=function(_0xa78416,_0x21fbd7,_0x5a7545){return db[_0x91c9('0x40')][_0x91c9('0x5c')]({'where':{'id':_0xa78416[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x21fbd7,null))['then'](function(_0x115ac9){if(_0x115ac9){return _0x115ac9[_0x91c9('0xc0')](_0xa78416[_0x91c9('0x5e')][_0x91c9('0x6c')],_[_0x91c9('0x73')](_0xa78416[_0x91c9('0x5e')],[_0x91c9('0x6c'),'id'])||{})[_0x91c9('0xbb')](function(_0x1e7280){for(var _0x333cee=0x0;_0x333cee<_0xa78416['body'][_0x91c9('0x6c')][_0x91c9('0x58')];_0x333cee+=0x1){socket[_0x91c9('0xc1')](_0x91c9('0xc2'),{'UserId':Number(_0xa78416[_0x91c9('0x5e')][_0x91c9('0x6c')][_0x333cee]),'FaxAccountId':Number(_0xa78416[_0x91c9('0x56')]['id'])});}return _0x1e7280;});}})[_0x91c9('0x1f')](respondWithResult(_0x21fbd7,null))[_0x91c9('0x28')](handleError(_0x21fbd7,null));};exports['removeAgents']=function(_0x393a7e,_0x4979c8,_0x373cf2){return db[_0x91c9('0x40')]['find']({'where':{'id':_0x393a7e[_0x91c9('0x56')]['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x4979c8,null))[_0x91c9('0x1f')](function(_0x1320c8){if(_0x1320c8){return _0x1320c8['removeAgents'](_0x393a7e[_0x91c9('0x46')][_0x91c9('0x6c')])[_0x91c9('0x1f')](function(){if(_[_0x91c9('0xc3')](_0x393a7e[_0x91c9('0x46')][_0x91c9('0x6c')])){for(var _0x370d81=0x0;_0x370d81<_0x393a7e[_0x91c9('0x46')]['ids'][_0x91c9('0x58')];_0x370d81+=0x1){socket[_0x91c9('0xc1')](_0x91c9('0xc4'),{'UserId':Number(_0x393a7e[_0x91c9('0x46')][_0x91c9('0x6c')][_0x370d81]),'FaxAccountId':Number(_0x393a7e[_0x91c9('0x56')]['id'])});}}else{socket[_0x91c9('0xc1')](_0x91c9('0xc4'),{'UserId':Number(_0x393a7e['query']['ids']),'FaxAccountId':Number(_0x393a7e[_0x91c9('0x56')]['id'])});}});}})[_0x91c9('0x1f')](respondWithStatusCode(_0x4979c8,null))['catch'](handleError(_0x4979c8,null));};exports[_0x91c9('0xc5')]=function(_0x40e705,_0x8eddf0,_0x1a44be){var _0x271de8={};var _0xabcdc={};var _0x3d2476;var _0x13ecdf;return db[_0x91c9('0x40')][_0x91c9('0x6e')]({'where':{'id':_0x40e705['params']['id']}})[_0x91c9('0x1f')](handleEntityNotFound(_0x8eddf0,null))[_0x91c9('0x1f')](function(_0x16d27c){if(_0x16d27c){_0x3d2476=_0x16d27c;_0xabcdc[_0x91c9('0x44')]=_[_0x91c9('0x45')](db[_0x91c9('0x75')][_0x91c9('0x41')]);_0xabcdc[_0x91c9('0x46')]=_['keys'](_0x40e705[_0x91c9('0x46')]);_0xabcdc[_0x91c9('0x4f')]=_[_0x91c9('0x47')](_0xabcdc[_0x91c9('0x44')],_0xabcdc[_0x91c9('0x46')]);_0x271de8[_0x91c9('0x48')]=_[_0x91c9('0x47')](_0xabcdc['model'],qs['fields'](_0x40e705[_0x91c9('0x46')][_0x91c9('0x49')]));_0x271de8[_0x91c9('0x48')]=_0x271de8['attributes'][_0x91c9('0x58')]?_0x271de8[_0x91c9('0x48')]:_0xabcdc[_0x91c9('0x44')];_0x271de8[_0x91c9('0x4c')]=qs[_0x91c9('0x4d')](_0x40e705[_0x91c9('0x46')]['sort']);_0x271de8[_0x91c9('0x4e')]=qs['filters'](_[_0x91c9('0x50')](_0x40e705[_0x91c9('0x46')],_0xabcdc[_0x91c9('0x4f')]));if(_0x40e705[_0x91c9('0x46')][_0x91c9('0x53')]){_0x271de8[_0x91c9('0x4e')]=_['merge'](_0x271de8[_0x91c9('0x4e')],{'$or':_[_0x91c9('0x3f')](_0x271de8['attributes'],function(_0x3e24e7){var _0x1d993a={};_0x1d993a[_0x3e24e7]={'$like':'%'+_0x40e705[_0x91c9('0x46')][_0x91c9('0x53')]+'%'};return _0x1d993a;})});}_0x271de8=_[_0x91c9('0x51')]({},_0x271de8,_0x40e705[_0x91c9('0x5b')]);return _0x3d2476[_0x91c9('0xc5')](_0x271de8);}})[_0x91c9('0x1f')](function(_0x23a191){if(_0x23a191){_0x13ecdf=_0x23a191['length'];if(!_0x40e705['query'][_0x91c9('0x4a')](_0x91c9('0x4b'))){_0x271de8[_0x91c9('0x2d')]=qs[_0x91c9('0x2d')](_0x40e705[_0x91c9('0x46')][_0x91c9('0x2d')]);_0x271de8[_0x91c9('0x2c')]=qs[_0x91c9('0x2c')](_0x40e705[_0x91c9('0x46')][_0x91c9('0x2c')]);}return _0x3d2476[_0x91c9('0xc5')](_0x271de8);}})[_0x91c9('0x1f')](function(_0x3966fd){if(_0x3966fd){return _0x3966fd?{'count':_0x13ecdf,'rows':_0x3966fd}:null;}})[_0x91c9('0x1f')](respondWithResult(_0x8eddf0,null))['catch'](handleError(_0x8eddf0,null));}; \ No newline at end of file +var _0xfbf4=['apply','save','update','then','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','FaxAccountId','Disposition','getDispositions','findOne','filter','ids','getAnswers','CannedAnswer','hasOwnProperty','addInteraction','FaxInteraction','getInteractions','CmContact','Owner','fullname','Tag','Tags','tag','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','appdata','Answer','push','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','transaction','VoiceExtension','bulkCreate','key','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','omit','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','path','fs-extra','squel','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','./faxAccount.socket','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x32a1ee,_0x3373b9){var _0x2c8083=function(_0x3f8c91){while(--_0x3f8c91){_0x32a1ee['push'](_0x32a1ee['shift']());}};_0x2c8083(++_0x3373b9);}(_0xfbf4,0x8d));var _0x4fbf=function(_0x377517,_0x2fbdd5){_0x377517=_0x377517-0x0;var _0x50697b=_0xfbf4[_0x377517];return _0x50697b;};'use strict';var emlformat=require(_0x4fbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fbf('0x2'));var moment=require(_0x4fbf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4fbf('0x4'));var util=require(_0x4fbf('0x5'));var path=require(_0x4fbf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fbf('0x7'));var _=require('lodash');var squel=require(_0x4fbf('0x8'));var crypto=require('crypto');var jsforce=require(_0x4fbf('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4fbf('0xa'));var querystring=require(_0x4fbf('0xb'));var Papa=require(_0x4fbf('0xc'));var Redis=require('ioredis');var authService=require(_0x4fbf('0xd'));var qs=require(_0x4fbf('0xe'));var as=require(_0x4fbf('0xf'));var hardwareService=require(_0x4fbf('0x10'));var logger=require(_0x4fbf('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x4fbf('0x12'));var licenseUtil=require(_0x4fbf('0x13'));var db=require(_0x4fbf('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fbf('0x15')]));require(_0x4fbf('0x16'))['register'](socket);var jayson=require(_0x4fbf('0x17'));var client=jayson['client'][_0x4fbf('0x18')]({'port':0x232c});var client9002=jayson[_0x4fbf('0x19')][_0x4fbf('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x273ecb,_0x12278c,_0x4f307c,_0x22b208){return new BPromise(function(_0x4d2aab,_0x667fa9){var _0x278e6c=_0x22b208||client;return _0x278e6c[_0x4fbf('0x1a')](_0x273ecb,_0x4f307c)['then'](function(_0x464ac4){logger[_0x4fbf('0x1b')](_0x4fbf('0x1c'),_0x12278c,_0x4fbf('0x1d'));logger['debug'](_0x4fbf('0x1e'),_0x12278c,'request\x20sent',JSON[_0x4fbf('0x1f')](_0x464ac4));if(_0x464ac4[_0x4fbf('0x20')]){if(_0x464ac4[_0x4fbf('0x20')]['code']===0x1f4){logger[_0x4fbf('0x20')](_0x4fbf('0x1c'),_0x12278c,_0x464ac4['error'][_0x4fbf('0x21')]);return _0x667fa9(_0x464ac4[_0x4fbf('0x20')][_0x4fbf('0x21')]);}logger[_0x4fbf('0x20')](_0x4fbf('0x1c'),_0x12278c,_0x464ac4[_0x4fbf('0x20')]['message']);return _0x4d2aab(_0x464ac4[_0x4fbf('0x20')][_0x4fbf('0x21')]);}else{logger[_0x4fbf('0x1b')](_0x4fbf('0x1c'),_0x12278c,_0x4fbf('0x1d'));_0x4d2aab(_0x464ac4['result'][_0x4fbf('0x21')]);}})[_0x4fbf('0x22')](function(_0x2e2746){logger[_0x4fbf('0x20')](_0x4fbf('0x1c'),_0x12278c,_0x2e2746);_0x667fa9(_0x2e2746);});});}function respondWithStatusCode(_0x2ae839,_0x40d92c){_0x40d92c=_0x40d92c||0xcc;return function(_0x9b8279){if(_0x9b8279){return _0x2ae839[_0x4fbf('0x23')](_0x40d92c);}return _0x2ae839[_0x4fbf('0x24')](_0x40d92c)[_0x4fbf('0x25')]();};}function respondWithResult(_0x536715,_0x130c44){_0x130c44=_0x130c44||0xc8;return function(_0x2c4302){if(_0x2c4302){return _0x536715['status'](_0x130c44)[_0x4fbf('0x26')](_0x2c4302);}};}function respondWithFilteredResult(_0x4c4e76,_0x3f1c68){return function(_0x25d4bf){if(_0x25d4bf){var _0x200ae3=typeof _0x3f1c68[_0x4fbf('0x27')]===_0x4fbf('0x28')&&typeof _0x3f1c68[_0x4fbf('0x29')]==='undefined';var _0x41107d=_0x25d4bf[_0x4fbf('0x2a')];var _0x5c3c55=_0x200ae3?0x0:_0x3f1c68[_0x4fbf('0x27')];var _0x5bdf2b=_0x200ae3?_0x25d4bf['count']:_0x3f1c68['offset']+_0x3f1c68['limit'];var _0x256090;if(_0x5bdf2b>=_0x41107d){_0x5bdf2b=_0x41107d;_0x256090=0xc8;}else{_0x256090=0xce;}_0x4c4e76['status'](_0x256090);return _0x4c4e76[_0x4fbf('0x2b')](_0x4fbf('0x2c'),_0x5c3c55+'-'+_0x5bdf2b+'/'+_0x41107d)[_0x4fbf('0x26')](_0x25d4bf);}return null;};}function patchUpdates(_0x15a69e){return function(_0x1fc669){try{jsonpatch[_0x4fbf('0x2d')](_0x1fc669,_0x15a69e,!![]);}catch(_0x3c9183){return BPromise['reject'](_0x3c9183);}return _0x1fc669[_0x4fbf('0x2e')]();};}function saveUpdates(_0x41fc6e,_0x2a2e22){return function(_0x487337){if(_0x487337){return _0x487337[_0x4fbf('0x2f')](_0x41fc6e)[_0x4fbf('0x30')](function(_0x76537){return _0x76537;});}return null;};}function removeEntity(_0x56b558,_0x3265fe){return function(_0x3003ea){if(_0x3003ea){return _0x3003ea[_0x4fbf('0x31')]()[_0x4fbf('0x30')](function(){var _0xf1c4a6=_0x3003ea['get']({'plain':!![]});var _0x22fb6f=_0x4fbf('0x32');return db[_0x4fbf('0x33')][_0x4fbf('0x31')]({'where':{'type':_0x22fb6f,'resourceId':_0xf1c4a6['id']}})[_0x4fbf('0x30')](function(){return _0x3003ea;});})['then'](function(){_0x56b558[_0x4fbf('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2ff8,_0x1c0461){return function(_0x404e8e){if(!_0x404e8e){_0x3c2ff8['sendStatus'](0x194);}return _0x404e8e;};}function handleError(_0x4fb9ba,_0x57d67a){_0x57d67a=_0x57d67a||0x1f4;return function(_0x8983cd){logger['error'](_0x8983cd[_0x4fbf('0x34')]);if(_0x8983cd[_0x4fbf('0x35')]){delete _0x8983cd[_0x4fbf('0x35')];}_0x4fb9ba['status'](_0x57d67a)[_0x4fbf('0x36')](_0x8983cd);};}exports[_0x4fbf('0x37')]=function(_0x1c85b3,_0xa7337c){var _0x2ad9a9={'include':[{'model':db[_0x4fbf('0x38')],'as':_0x4fbf('0x39')}]},_0x46d678={},_0x43d76a={'count':0x0,'rows':[]};var _0x59b124=_[_0x4fbf('0x3a')](db[_0x4fbf('0x3b')][_0x4fbf('0x3c')],function(_0x352894){return{'name':_0x352894[_0x4fbf('0x3d')],'type':_0x352894[_0x4fbf('0x3e')]['key']};});_0x46d678[_0x4fbf('0x3f')]=_[_0x4fbf('0x3a')](_0x59b124,_0x4fbf('0x35'));_0x46d678['query']=_['keys'](_0x1c85b3[_0x4fbf('0x40')]);_0x46d678[_0x4fbf('0x41')]=_['intersection'](_0x46d678[_0x4fbf('0x3f')],_0x46d678[_0x4fbf('0x40')]);_0x2ad9a9[_0x4fbf('0x42')]=_['intersection'](_0x46d678[_0x4fbf('0x3f')],qs[_0x4fbf('0x43')](_0x1c85b3['query']['fields']));_0x2ad9a9[_0x4fbf('0x42')]=_0x2ad9a9[_0x4fbf('0x42')][_0x4fbf('0x44')]?_0x2ad9a9['attributes']:_0x46d678[_0x4fbf('0x3f')];if(!_0x1c85b3[_0x4fbf('0x40')]['hasOwnProperty'](_0x4fbf('0x45'))){_0x2ad9a9[_0x4fbf('0x29')]=qs['limit'](_0x1c85b3['query'][_0x4fbf('0x29')]);_0x2ad9a9[_0x4fbf('0x27')]=qs[_0x4fbf('0x27')](_0x1c85b3['query']['offset']);}_0x2ad9a9[_0x4fbf('0x46')]=qs[_0x4fbf('0x47')](_0x1c85b3['query'][_0x4fbf('0x47')]);_0x2ad9a9[_0x4fbf('0x48')]=qs['filters'](_[_0x4fbf('0x49')](_0x1c85b3['query'],_0x46d678[_0x4fbf('0x41')]),_0x59b124);if(_0x1c85b3[_0x4fbf('0x40')]['filter']){_0x2ad9a9[_0x4fbf('0x48')]=_[_0x4fbf('0x4a')](_0x2ad9a9[_0x4fbf('0x48')],{'$or':_[_0x4fbf('0x3a')](_0x59b124,function(_0x2eb33e){if(_0x2eb33e['type']!=='VIRTUAL'){var _0x58e5f1={};_0x58e5f1[_0x2eb33e[_0x4fbf('0x35')]]={'$like':'%'+_0x1c85b3[_0x4fbf('0x40')]['filter']+'%'};return _0x58e5f1;}})});}_0x2ad9a9=_['merge']({},_0x2ad9a9,_0x1c85b3[_0x4fbf('0x4b')]);var _0x24382c={'where':_0x2ad9a9['where']};return db[_0x4fbf('0x3b')][_0x4fbf('0x2a')](_0x24382c)[_0x4fbf('0x30')](function(_0x2d7a55){_0x43d76a[_0x4fbf('0x2a')]=_0x2d7a55;if(_0x1c85b3[_0x4fbf('0x40')][_0x4fbf('0x4c')]){_0x2ad9a9[_0x4fbf('0x4d')]=[{'all':!![]}];}return db[_0x4fbf('0x3b')][_0x4fbf('0x4e')](_0x2ad9a9);})[_0x4fbf('0x30')](function(_0x4c9f4a){_0x43d76a[_0x4fbf('0x4f')]=_0x4c9f4a;return _0x43d76a;})[_0x4fbf('0x30')](respondWithFilteredResult(_0xa7337c,_0x2ad9a9))['catch'](handleError(_0xa7337c,null));};exports[_0x4fbf('0x50')]=function(_0x3cc0df,_0x3628f8){var _0x4c30bc={'raw':![],'where':{'id':_0x3cc0df[_0x4fbf('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x4fbf('0x39')}]},_0x4d5f8b={};_0x4d5f8b[_0x4fbf('0x3f')]=_[_0x4fbf('0x52')](db[_0x4fbf('0x3b')][_0x4fbf('0x3c')]);_0x4d5f8b[_0x4fbf('0x40')]=_['keys'](_0x3cc0df[_0x4fbf('0x40')]);_0x4d5f8b[_0x4fbf('0x41')]=_[_0x4fbf('0x53')](_0x4d5f8b[_0x4fbf('0x3f')],_0x4d5f8b['query']);_0x4c30bc[_0x4fbf('0x42')]=_[_0x4fbf('0x53')](_0x4d5f8b[_0x4fbf('0x3f')],qs[_0x4fbf('0x43')](_0x3cc0df[_0x4fbf('0x40')][_0x4fbf('0x43')]));_0x4c30bc[_0x4fbf('0x42')]=_0x4c30bc[_0x4fbf('0x42')][_0x4fbf('0x44')]?_0x4c30bc['attributes']:_0x4d5f8b['model'];if(_0x3cc0df[_0x4fbf('0x40')][_0x4fbf('0x4c')]){_0x4c30bc[_0x4fbf('0x4d')]=[{'all':!![]}];}_0x4c30bc=_[_0x4fbf('0x4a')]({},_0x4c30bc,_0x3cc0df['options']);return db['FaxAccount']['find'](_0x4c30bc)[_0x4fbf('0x30')](handleEntityNotFound(_0x3628f8,null))[_0x4fbf('0x30')](respondWithResult(_0x3628f8,null))[_0x4fbf('0x22')](handleError(_0x3628f8,null));};exports[_0x4fbf('0x54')]=function(_0x568e06,_0x428c74){return db[_0x4fbf('0x3b')]['create'](_0x568e06[_0x4fbf('0x55')],{})[_0x4fbf('0x30')](function(_0x4e17b1){var _0x289db0=_0x568e06[_0x4fbf('0x56')][_0x4fbf('0x57')]({'plain':!![]});if(!_0x289db0)throw new Error(_0x4fbf('0x58'));if(_0x289db0[_0x4fbf('0x59')]==='user'){var _0x44dad1=_0x4e17b1[_0x4fbf('0x57')]({'plain':!![]});var _0x7eb41e=_0x4fbf('0x32');return db[_0x4fbf('0x5a')][_0x4fbf('0x5b')]({'where':{'name':_0x7eb41e,'userProfileId':_0x289db0[_0x4fbf('0x5c')]},'raw':!![]})[_0x4fbf('0x30')](function(_0x1dd60e){if(_0x1dd60e&&_0x1dd60e[_0x4fbf('0x5d')]===0x0){return db[_0x4fbf('0x33')]['create']({'name':_0x44dad1['name'],'resourceId':_0x44dad1['id'],'type':_0x1dd60e['name'],'sectionId':_0x1dd60e['id']},{})[_0x4fbf('0x30')](function(){return _0x4e17b1;});}else{return _0x4e17b1;}})[_0x4fbf('0x22')](function(_0x26998e){logger[_0x4fbf('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26998e);throw _0x26998e;});}return _0x4e17b1;})['then'](respondWithResult(_0x428c74,0xc9))[_0x4fbf('0x22')](handleError(_0x428c74,null));};exports['update']=function(_0xabdaeb,_0x29531b){if(_0xabdaeb[_0x4fbf('0x55')]['id']){delete _0xabdaeb[_0x4fbf('0x55')]['id'];}return db['FaxAccount'][_0x4fbf('0x5b')]({'where':{'id':_0xabdaeb[_0x4fbf('0x51')]['id']},'include':[{'model':db[_0x4fbf('0x38')],'as':'mandatoryDispositionPause'}]})[_0x4fbf('0x30')](handleEntityNotFound(_0x29531b,null))['then'](saveUpdates(_0xabdaeb[_0x4fbf('0x55')],null))[_0x4fbf('0x30')](respondWithResult(_0x29531b,null))['catch'](handleError(_0x29531b,null));};exports[_0x4fbf('0x31')]=function(_0x40b6cd,_0x293dbf){return db['FaxAccount'][_0x4fbf('0x5b')]({'where':{'id':_0x40b6cd['params']['id']}})[_0x4fbf('0x30')](handleEntityNotFound(_0x293dbf,null))[_0x4fbf('0x30')](removeEntity(_0x293dbf,null))[_0x4fbf('0x22')](handleError(_0x293dbf,null));};exports[_0x4fbf('0x5e')]=function(_0x5df737,_0x17c65a){return db[_0x4fbf('0x3b')][_0x4fbf('0x5e')]()[_0x4fbf('0x30')](respondWithResult(_0x17c65a,null))[_0x4fbf('0x22')](handleError(_0x17c65a,null));};exports['addDisposition']=function(_0x236f03,_0x52de5d,_0x5d2c2c){if(_0x236f03[_0x4fbf('0x55')]['id']){delete _0x236f03[_0x4fbf('0x55')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x236f03[_0x4fbf('0x51')]['id']}})['then'](handleEntityNotFound(_0x52de5d,null))[_0x4fbf('0x30')](function(_0x1dd829){if(_0x1dd829){_0x236f03[_0x4fbf('0x55')][_0x4fbf('0x5f')]=_0x1dd829['id'];return db[_0x4fbf('0x60')][_0x4fbf('0x54')](_0x236f03['body']);}})['then'](respondWithResult(_0x52de5d,null))['catch'](handleError(_0x52de5d,null));};exports[_0x4fbf('0x61')]=function(_0x4c5299,_0x2f2244,_0x4effab){var _0x2843e2={'raw':![],'where':{}};var _0x210641={};var _0x44d568={'count':0x0,'rows':[]};return db[_0x4fbf('0x3b')][_0x4fbf('0x62')]({'where':{'id':_0x4c5299[_0x4fbf('0x51')]['id']}})[_0x4fbf('0x30')](handleEntityNotFound(_0x2f2244,null))[_0x4fbf('0x30')](function(_0x3e95ed){if(_0x3e95ed){_0x210641[_0x4fbf('0x3f')]=_['keys'](db[_0x4fbf('0x60')]['rawAttributes']);_0x210641['query']=_[_0x4fbf('0x52')](_0x4c5299[_0x4fbf('0x40')]);_0x210641[_0x4fbf('0x41')]=_[_0x4fbf('0x53')](_0x210641[_0x4fbf('0x3f')],_0x210641[_0x4fbf('0x40')]);_0x2843e2[_0x4fbf('0x42')]=_[_0x4fbf('0x53')](_0x210641['model'],qs[_0x4fbf('0x43')](_0x4c5299[_0x4fbf('0x40')]['fields']));_0x2843e2[_0x4fbf('0x42')]=_0x2843e2['attributes'][_0x4fbf('0x44')]?_0x2843e2[_0x4fbf('0x42')]:_0x210641[_0x4fbf('0x3f')];if(!_0x4c5299[_0x4fbf('0x40')]['hasOwnProperty'](_0x4fbf('0x45'))){_0x2843e2[_0x4fbf('0x29')]=qs[_0x4fbf('0x29')](_0x4c5299[_0x4fbf('0x40')][_0x4fbf('0x29')]);_0x2843e2['offset']=qs[_0x4fbf('0x27')](_0x4c5299[_0x4fbf('0x40')][_0x4fbf('0x27')]);}_0x2843e2[_0x4fbf('0x46')]=qs[_0x4fbf('0x47')](_0x4c5299[_0x4fbf('0x40')]['sort']);_0x2843e2[_0x4fbf('0x48')]=qs[_0x4fbf('0x41')](_[_0x4fbf('0x49')](_0x4c5299[_0x4fbf('0x40')],_0x210641[_0x4fbf('0x41')]));_0x2843e2[_0x4fbf('0x48')][_0x4fbf('0x5f')]=_0x3e95ed['id'];if(_0x4c5299['query'][_0x4fbf('0x63')]){_0x2843e2[_0x4fbf('0x48')]=_['merge'](_0x2843e2[_0x4fbf('0x48')],{'$or':_['map'](_0x2843e2['attributes'],function(_0xfb4ce6){var _0x8efe50={};_0x8efe50[_0xfb4ce6]={'$like':'%'+_0x4c5299['query']['filter']+'%'};return _0x8efe50;})});}_0x2843e2=_[_0x4fbf('0x4a')]({},_0x2843e2,_0x4c5299[_0x4fbf('0x4b')]);return db[_0x4fbf('0x60')][_0x4fbf('0x2a')]({'where':_0x2843e2['where']})['then'](function(_0x1fcd35){_0x44d568[_0x4fbf('0x2a')]=_0x1fcd35;if(_0x4c5299[_0x4fbf('0x40')][_0x4fbf('0x4c')]){_0x2843e2[_0x4fbf('0x4d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2843e2);})[_0x4fbf('0x30')](function(_0x5b58dc){_0x44d568['rows']=_0x5b58dc;return _0x44d568;});}})['then'](respondWithFilteredResult(_0x2f2244,_0x2843e2))['catch'](handleError(_0x2f2244,null));};exports['removeDispositions']=function(_0x32604b,_0x3dec20,_0x1e5058){return db[_0x4fbf('0x3b')][_0x4fbf('0x5b')]({'where':{'id':_0x32604b[_0x4fbf('0x51')]['id']}})[_0x4fbf('0x30')](handleEntityNotFound(_0x3dec20,null))['then'](function(_0x3b31fb){if(_0x3b31fb){return _0x3b31fb['removeDispositions'](_0x32604b['query'][_0x4fbf('0x64')]);}})[_0x4fbf('0x30')](respondWithStatusCode(_0x3dec20,null))[_0x4fbf('0x22')](handleError(_0x3dec20,null));};exports['addAnswer']=function(_0x1d74ab,_0x5da95b,_0x5c6e12){if(_0x1d74ab['body']['id']){delete _0x1d74ab[_0x4fbf('0x55')]['id'];}return db[_0x4fbf('0x3b')][_0x4fbf('0x5b')]({'where':{'id':_0x1d74ab[_0x4fbf('0x51')]['id']}})[_0x4fbf('0x30')](handleEntityNotFound(_0x5da95b,null))[_0x4fbf('0x30')](function(_0x1d0275){if(_0x1d0275){_0x1d74ab['body'][_0x4fbf('0x5f')]=_0x1d0275['id'];return db['CannedAnswer'][_0x4fbf('0x54')](_0x1d74ab['body']);}})[_0x4fbf('0x30')](respondWithResult(_0x5da95b,null))[_0x4fbf('0x22')](handleError(_0x5da95b,null));};exports[_0x4fbf('0x65')]=function(_0x2b4801,_0x319d78,_0x2e730d){var _0x132178={'raw':![],'where':{}};var _0x51fc61={};var _0x439781={'count':0x0,'rows':[]};return db[_0x4fbf('0x3b')][_0x4fbf('0x62')]({'where':{'id':_0x2b4801[_0x4fbf('0x51')]['id']}})['then'](handleEntityNotFound(_0x319d78,null))['then'](function(_0xe982f2){if(_0xe982f2){_0x51fc61['model']=_[_0x4fbf('0x52')](db[_0x4fbf('0x66')]['rawAttributes']);_0x51fc61[_0x4fbf('0x40')]=_['keys'](_0x2b4801[_0x4fbf('0x40')]);_0x51fc61['filters']=_['intersection'](_0x51fc61['model'],_0x51fc61[_0x4fbf('0x40')]);_0x132178[_0x4fbf('0x42')]=_[_0x4fbf('0x53')](_0x51fc61[_0x4fbf('0x3f')],qs[_0x4fbf('0x43')](_0x2b4801[_0x4fbf('0x40')][_0x4fbf('0x43')]));_0x132178['attributes']=_0x132178['attributes'][_0x4fbf('0x44')]?_0x132178[_0x4fbf('0x42')]:_0x51fc61['model'];if(!_0x2b4801[_0x4fbf('0x40')][_0x4fbf('0x67')](_0x4fbf('0x45'))){_0x132178[_0x4fbf('0x29')]=qs[_0x4fbf('0x29')](_0x2b4801['query'][_0x4fbf('0x29')]);_0x132178[_0x4fbf('0x27')]=qs[_0x4fbf('0x27')](_0x2b4801[_0x4fbf('0x40')]['offset']);}_0x132178[_0x4fbf('0x46')]=qs[_0x4fbf('0x47')](_0x2b4801[_0x4fbf('0x40')]['sort']);_0x132178[_0x4fbf('0x48')]=qs[_0x4fbf('0x41')](_['pick'](_0x2b4801[_0x4fbf('0x40')],_0x51fc61[_0x4fbf('0x41')]));_0x132178['where'][_0x4fbf('0x5f')]=_0xe982f2['id'];if(_0x2b4801[_0x4fbf('0x40')][_0x4fbf('0x63')]){_0x132178['where']=_['merge'](_0x132178[_0x4fbf('0x48')],{'$or':_[_0x4fbf('0x3a')](_0x132178[_0x4fbf('0x42')],function(_0x2b07fa){var _0x10e966={};_0x10e966[_0x2b07fa]={'$like':'%'+_0x2b4801[_0x4fbf('0x40')][_0x4fbf('0x63')]+'%'};return _0x10e966;})});}_0x132178=_[_0x4fbf('0x4a')]({},_0x132178,_0x2b4801[_0x4fbf('0x4b')]);return db[_0x4fbf('0x66')][_0x4fbf('0x2a')]({'where':_0x132178['where']})['then'](function(_0x222149){_0x439781[_0x4fbf('0x2a')]=_0x222149;if(_0x2b4801['query'][_0x4fbf('0x4c')]){_0x132178[_0x4fbf('0x4d')]=[{'all':!![]}];}return db[_0x4fbf('0x66')][_0x4fbf('0x4e')](_0x132178);})['then'](function(_0x4e7b41){_0x439781[_0x4fbf('0x4f')]=_0x4e7b41;return _0x439781;});}})[_0x4fbf('0x30')](respondWithFilteredResult(_0x319d78,_0x132178))[_0x4fbf('0x22')](handleError(_0x319d78,null));};exports['removeAnswers']=function(_0x1599c6,_0x4a0bc4,_0x508156){return db[_0x4fbf('0x3b')][_0x4fbf('0x5b')]({'where':{'id':_0x1599c6[_0x4fbf('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a0bc4,null))['then'](function(_0x47fa5e){if(_0x47fa5e){return _0x47fa5e['removeAnswers'](_0x1599c6['query'][_0x4fbf('0x64')]);}})[_0x4fbf('0x30')](respondWithStatusCode(_0x4a0bc4,null))[_0x4fbf('0x22')](handleError(_0x4a0bc4,null));};exports[_0x4fbf('0x68')]=function(_0x40f84b,_0x3c641f,_0x519564){return db[_0x4fbf('0x69')][_0x4fbf('0x5b')]({'where':{'id':_0x40f84b[_0x4fbf('0x51')]['id']}})['then'](handleEntityNotFound(_0x3c641f,null))[_0x4fbf('0x30')](function(_0x6472be){if(_0x6472be){return _0x6472be[_0x4fbf('0x68')](_0x40f84b['body'][_0x4fbf('0x64')],_['omit'](_0x40f84b[_0x4fbf('0x55')],['ids','id'])||{});}})['then'](respondWithResult(_0x3c641f,null))[_0x4fbf('0x22')](handleError(_0x3c641f,null));};exports[_0x4fbf('0x6a')]=function(_0x491a89,_0x453062,_0x6cd714){var _0x48d41d={'raw':![],'where':{}};var _0x381975={};var _0x4a437b={'count':0x0,'rows':[]};return db[_0x4fbf('0x3b')][_0x4fbf('0x62')]({'where':{'id':_0x491a89[_0x4fbf('0x51')]['id']}})[_0x4fbf('0x30')](handleEntityNotFound(_0x453062,null))['then'](function(_0x4be055){if(_0x4be055){_0x381975['model']=_['keys'](db['FaxInteraction'][_0x4fbf('0x3c')]);_0x381975[_0x4fbf('0x40')]=_[_0x4fbf('0x52')](_0x491a89[_0x4fbf('0x40')]);_0x381975[_0x4fbf('0x41')]=_[_0x4fbf('0x53')](_0x381975[_0x4fbf('0x3f')],_0x381975[_0x4fbf('0x40')]);_0x48d41d[_0x4fbf('0x42')]=_[_0x4fbf('0x53')](_0x381975['model'],qs[_0x4fbf('0x43')](_0x491a89['query']['fields']));_0x48d41d['attributes']=_0x48d41d['attributes']['length']?_0x48d41d[_0x4fbf('0x42')]:_0x381975['model'];if(!_0x491a89[_0x4fbf('0x40')]['hasOwnProperty'](_0x4fbf('0x45'))){_0x48d41d[_0x4fbf('0x29')]=qs[_0x4fbf('0x29')](_0x491a89[_0x4fbf('0x40')][_0x4fbf('0x29')]);_0x48d41d['offset']=qs[_0x4fbf('0x27')](_0x491a89[_0x4fbf('0x40')][_0x4fbf('0x27')]);}_0x48d41d['order']=qs[_0x4fbf('0x47')](_0x491a89[_0x4fbf('0x40')][_0x4fbf('0x47')]);_0x48d41d[_0x4fbf('0x48')]=qs[_0x4fbf('0x41')](_[_0x4fbf('0x49')](_0x491a89[_0x4fbf('0x40')],_0x381975[_0x4fbf('0x41')]));_0x48d41d['where'][_0x4fbf('0x5f')]=_0x4be055['id'];if(_0x491a89[_0x4fbf('0x40')]['filter']){_0x48d41d[_0x4fbf('0x48')]=_[_0x4fbf('0x4a')](_0x48d41d['where'],{'$or':_[_0x4fbf('0x3a')](_0x48d41d[_0x4fbf('0x42')],function(_0x2601cc){var _0x4c9362={};_0x4c9362[_0x2601cc]={'$like':'%'+_0x491a89[_0x4fbf('0x40')]['filter']+'%'};return _0x4c9362;})});}_0x48d41d=_[_0x4fbf('0x4a')]({},_0x48d41d,_0x491a89['options']);return db['FaxInteraction'][_0x4fbf('0x2a')]({'where':_0x48d41d['where']})['then'](function(_0x23d0c1){_0x4a437b['count']=_0x23d0c1;if(_0x491a89[_0x4fbf('0x40')]['includeAll']){_0x48d41d['include']=[{'model':db[_0x4fbf('0x6b')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4fbf('0x6c'),'attributes':['name',_0x4fbf('0x6d'),'internal'],'required':![]},{'model':db[_0x4fbf('0x6e')],'as':_0x4fbf('0x6f'),'attributes':['id',_0x4fbf('0x35'),'color'],'where':_0x491a89['query']['tag']?{'id':_0x491a89[_0x4fbf('0x40')][_0x4fbf('0x70')]}:undefined,'required':_0x491a89[_0x4fbf('0x40')][_0x4fbf('0x70')]?!![]:![]}];}return db[_0x4fbf('0x69')][_0x4fbf('0x4e')](_0x48d41d);})['then'](function(_0x33ca5f){_0x4a437b['rows']=_0x33ca5f;return _0x4a437b;});}})[_0x4fbf('0x30')](respondWithFilteredResult(_0x453062,_0x48d41d))[_0x4fbf('0x22')](handleError(_0x453062,null));};exports[_0x4fbf('0x71')]=function(_0x29f631,_0x595f22){var _0x25a366=_0x29f631['params']['id'];var _0x1a789e=_0x29f631[_0x4fbf('0x55')];var _0x59e862=0xc8;var _0x1f23b6=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x4fbf('0x72')][_0x4fbf('0x73')][_0x4fbf('0x74')]},function(_0x33610b){return db[_0x4fbf('0x3b')][_0x4fbf('0x62')]({'where':{'id':_0x25a366},'transaction':_0x33610b})['then'](function(_0x4ad4e4){if(_0x4ad4e4){return db[_0x4fbf('0x75')][_0x4fbf('0x31')]({'where':{'FaxAccountId':_0x25a366},'transaction':_0x33610b})[_0x4fbf('0x30')](function(){var _0x586729=_['map'](_0x1a789e,function(_0x679a06){_0x679a06[_0x4fbf('0x5f')]=_0x25a366;return _0x679a06;});return db[_0x4fbf('0x75')]['bulkCreate'](_0x586729,{'transaction':_0x33610b});});}else{_0x59e862=0x194;_0x1f23b6=[];}});})[_0x4fbf('0x30')](function(){if(_0x59e862!==0x194){return db[_0x4fbf('0x75')][_0x4fbf('0x76')]({'where':{'FaxAccountId':_0x25a366},'order':_0x4fbf('0x77')})[_0x4fbf('0x30')](function(_0x32e6af){_0x1f23b6=_0x32e6af;});}})['catch'](function(_0x4ae914){_0x59e862=0x1f4;logger[_0x4fbf('0x20')](_0x4ae914[_0x4fbf('0x34')]);if(_0x4ae914[_0x4fbf('0x35')]){delete _0x4ae914[_0x4fbf('0x35')];}_0x1f23b6=_0x4ae914;})['finally'](function(){if(_0x1f23b6===null){_0x595f22[_0x4fbf('0x23')](_0x59e862);}else{if(_0x59e862===0x1f4){_0x595f22[_0x4fbf('0x24')](_0x59e862)[_0x4fbf('0x36')](_0x1f23b6);}else{_0x595f22[_0x4fbf('0x24')](_0x59e862)[_0x4fbf('0x26')](_0x1f23b6);}}});};exports['getApplications']=function(_0x2f048e,_0x9a56e5,_0x40ea9f){var _0x2ce9b0={};var _0x2297cd={};var _0x4890eb;var _0x481a4f;return db[_0x4fbf('0x3b')]['findOne']({'where':{'id':_0x2f048e['params']['id']}})['then'](handleEntityNotFound(_0x9a56e5,null))[_0x4fbf('0x30')](function(_0x1deedf){if(_0x1deedf){_0x4890eb=_0x1deedf;_0x2297cd[_0x4fbf('0x3f')]=_['keys'](db[_0x4fbf('0x75')][_0x4fbf('0x3c')]);_0x2297cd['query']=_['keys'](_0x2f048e[_0x4fbf('0x40')]);_0x2297cd['filters']=_[_0x4fbf('0x53')](_0x2297cd[_0x4fbf('0x3f')],_0x2297cd[_0x4fbf('0x40')]);_0x2ce9b0[_0x4fbf('0x42')]=_[_0x4fbf('0x53')](_0x2297cd[_0x4fbf('0x3f')],qs[_0x4fbf('0x43')](_0x2f048e[_0x4fbf('0x40')][_0x4fbf('0x43')]));_0x2ce9b0['attributes']=_0x2ce9b0[_0x4fbf('0x42')][_0x4fbf('0x44')]?_0x2ce9b0[_0x4fbf('0x42')]:_0x2297cd['model'];_0x2ce9b0[_0x4fbf('0x46')]=qs[_0x4fbf('0x47')](_0x2f048e[_0x4fbf('0x40')][_0x4fbf('0x47')]);_0x2ce9b0['where']=qs[_0x4fbf('0x41')](_[_0x4fbf('0x49')](_0x2f048e['query'],_0x2297cd[_0x4fbf('0x41')]));if(_0x2f048e[_0x4fbf('0x40')][_0x4fbf('0x63')]){_0x2ce9b0[_0x4fbf('0x48')]=_['merge'](_0x2ce9b0['where'],{'$or':_[_0x4fbf('0x3a')](_0x2ce9b0[_0x4fbf('0x42')],function(_0x42ae83){var _0x41bc6e={};_0x41bc6e[_0x42ae83]={'$like':'%'+_0x2f048e['query']['filter']+'%'};return _0x41bc6e;})});}_0x2ce9b0=_['merge']({},_0x2ce9b0,_0x2f048e[_0x4fbf('0x4b')]);return _0x4890eb[_0x4fbf('0x78')](_0x2ce9b0);}})[_0x4fbf('0x30')](function(_0xf124d4){if(_0xf124d4){_0x481a4f=_0xf124d4[_0x4fbf('0x44')];if(!_0x2f048e[_0x4fbf('0x40')][_0x4fbf('0x67')](_0x4fbf('0x45'))){_0x2ce9b0[_0x4fbf('0x29')]=qs[_0x4fbf('0x29')](_0x2f048e[_0x4fbf('0x40')]['limit']);_0x2ce9b0[_0x4fbf('0x27')]=qs[_0x4fbf('0x27')](_0x2f048e['query'][_0x4fbf('0x27')]);}return _0x4890eb[_0x4fbf('0x78')](_0x2ce9b0);}})['then'](function(_0x570d84){if(_0x570d84){return _0x570d84?{'count':_0x481a4f,'rows':_0x570d84}:null;}})[_0x4fbf('0x30')](respondWithResult(_0x9a56e5,null))[_0x4fbf('0x22')](handleError(_0x9a56e5,null));};function Extension(_0x1ce2a2,_0xc33a89,_0xc6c258,_0x2dc59e){this[_0x4fbf('0x79')]='from-voip-provider';this[_0x4fbf('0x7a')]=_0x1ce2a2[_0x4fbf('0x7b')];this[_0x4fbf('0x7c')]=_0x2dc59e;this[_0x4fbf('0x3e')]=_0x4fbf('0x7d');this[_0x4fbf('0x7e')]='Fax\x20Extension';this[_0x4fbf('0x5f')]=_0x1ce2a2['id'];this[_0x4fbf('0x77')]=_0xc33a89;this[_0x4fbf('0x7f')]=_0xc6c258;}function createExtensionsReciveFax(_0x6d91b2){var _0x4fecf0=0x1;var _0x3b4806=[];_0x3b4806['push'](new Extension(_0x6d91b2,_0x4fecf0,'',_0x4fbf('0x80')));_0x4fecf0+=0x1;_0x3b4806[_0x4fbf('0x81')](new Extension(_0x6d91b2,_0x4fecf0,'CDR(type)=inbound-fax','Set'));_0x4fecf0+=0x1;for(var _0x4ce391 in _0x6d91b2){if(_0x6d91b2['hasOwnProperty'](_0x4ce391)&&(_0x4ce391===_0x4fbf('0x82')||_0x4ce391==='localstationid'||_0x4ce391===_0x4fbf('0x83')||_0x4ce391===_0x4fbf('0x84')||_0x4ce391===_0x4fbf('0x85')||_0x4ce391===_0x4fbf('0x86')||_0x4ce391==='minrate'||_0x4ce391===_0x4fbf('0x87')||_0x4ce391===_0x4fbf('0x88'))){_0x3b4806[_0x4fbf('0x81')](new Extension(_0x6d91b2,_0x4fecf0,_0x4fbf('0x89')+_0x4ce391+')='+_0x6d91b2[_0x4ce391],'Set'));_0x4fecf0+=0x1;}}_0x3b4806[_0x4fbf('0x81')](new Extension(_0x6d91b2,_0x4fecf0,'6',_0x4fbf('0x8a')));_0x4fecf0+=0x1;_0x3b4806['push'](new Extension(_0x6d91b2,_0x4fecf0,_0x4fbf('0x8b'),_0x4fbf('0x8c')));_0x4fecf0=0x0;return _0x3b4806;}exports[_0x4fbf('0x8d')]=function(_0x565bed,_0x11a19f,_0xd7b107){var _0x598185;return db[_0x4fbf('0x8e')][_0x4fbf('0x8f')](function(_0x3d8adb){return db[_0x4fbf('0x3b')][_0x4fbf('0x54')](_0x565bed['body'],{'transaction':_0x3d8adb})['then'](function(_0xc166bc){_0x598185=_0xc166bc[_0x4fbf('0x57')]({'plain':!![]});return db[_0x4fbf('0x90')][_0x4fbf('0x91')](createExtensionsReciveFax(_0x598185),{'transaction':_0x3d8adb});});})[_0x4fbf('0x30')](function(){return _0x598185;})[_0x4fbf('0x30')](respondWithResult(_0x11a19f,null))[_0x4fbf('0x22')](handleError(_0x11a19f,null));};exports['updateAccountApplications']=function(_0x15a44c,_0x3027cf,_0x3e6324){var _0x53e160;return db[_0x4fbf('0x8e')][_0x4fbf('0x8f')](function(_0x5699af){return db[_0x4fbf('0x3b')]['update'](_0x15a44c[_0x4fbf('0x55')],{'where':{'id':_0x15a44c[_0x4fbf('0x55')]['id']},'transaction':_0x5699af})['then'](function(_0x2bed1f){return db[_0x4fbf('0x90')][_0x4fbf('0x31')]({'where':{'FaxAccountId':_0x15a44c['body']['id']},'transaction':_0x5699af})[_0x4fbf('0x30')](function(_0x64effc){return db[_0x4fbf('0x90')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x15a44c[_0x4fbf('0x55')],['tech',_0x4fbf('0x92'),_0x4fbf('0x93'),_0x4fbf('0x94'),'TrunkId',_0x4fbf('0x95')])),{'transaction':_0x5699af});});});})[_0x4fbf('0x30')](function(){return db[_0x4fbf('0x3b')][_0x4fbf('0x96')](_0x15a44c[_0x4fbf('0x55')]['id']);})[_0x4fbf('0x30')](respondWithResult(_0x3027cf,null))['catch'](handleError(_0x3027cf,null));};exports[_0x4fbf('0x97')]=function(_0x2528a9,_0x52aab3,_0x36cff0){var _0x1930c6={'raw':!![],'where':{}};var _0x62d0ac={};var _0x4ecc8a={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4fbf('0x62')]({'where':{'id':_0x2528a9[_0x4fbf('0x51')]['id']}})['then'](handleEntityNotFound(_0x52aab3,null))['then'](function(_0x485e38){if(_0x485e38){_0x62d0ac[_0x4fbf('0x3f')]=_[_0x4fbf('0x52')](db['FaxMessage'][_0x4fbf('0x3c')]);_0x62d0ac[_0x4fbf('0x40')]=_[_0x4fbf('0x52')](_0x2528a9['query']);_0x62d0ac[_0x4fbf('0x41')]=_['intersection'](_0x62d0ac[_0x4fbf('0x3f')],_0x62d0ac[_0x4fbf('0x40')]);_0x1930c6['attributes']=_[_0x4fbf('0x53')](_0x62d0ac[_0x4fbf('0x3f')],qs[_0x4fbf('0x43')](_0x2528a9[_0x4fbf('0x40')][_0x4fbf('0x43')]));_0x1930c6['attributes']=_0x1930c6['attributes'][_0x4fbf('0x44')]?_0x1930c6[_0x4fbf('0x42')]:_0x62d0ac[_0x4fbf('0x3f')];if(!_0x2528a9[_0x4fbf('0x40')][_0x4fbf('0x67')](_0x4fbf('0x45'))){_0x1930c6['limit']=qs[_0x4fbf('0x29')](_0x2528a9['query']['limit']);_0x1930c6[_0x4fbf('0x27')]=qs[_0x4fbf('0x27')](_0x2528a9[_0x4fbf('0x40')][_0x4fbf('0x27')]);}_0x1930c6['order']=qs[_0x4fbf('0x47')](_0x2528a9[_0x4fbf('0x40')][_0x4fbf('0x47')]);_0x1930c6[_0x4fbf('0x48')]=qs[_0x4fbf('0x41')](_[_0x4fbf('0x49')](_0x2528a9[_0x4fbf('0x40')],_0x62d0ac['filters']));_0x1930c6[_0x4fbf('0x48')][_0x4fbf('0x5f')]=_0x485e38['id'];if(_0x2528a9['query']['filter']){_0x1930c6[_0x4fbf('0x48')]=_[_0x4fbf('0x4a')](_0x1930c6[_0x4fbf('0x48')],{'$or':_['map'](_0x1930c6[_0x4fbf('0x42')],function(_0x1ff644){var _0x34ba29={};_0x34ba29[_0x1ff644]={'$like':'%'+_0x2528a9[_0x4fbf('0x40')][_0x4fbf('0x63')]+'%'};return _0x34ba29;})});}if(_0x2528a9['query']['$gte']){var _0x4ee638=_0x2528a9['query'][_0x4fbf('0x98')][_0x4fbf('0x99')](',');var _0x12b067={};_0x12b067[_0x4ee638[0x0]]={'$gte':moment(_0x4ee638[0x1])[_0x4fbf('0x9a')](_0x4fbf('0x9b'))};_0x1930c6[_0x4fbf('0x48')]=_[_0x4fbf('0x4a')](_0x1930c6[_0x4fbf('0x48')],_0x12b067);}_0x1930c6=_['merge']({},_0x1930c6,_0x2528a9[_0x4fbf('0x4b')]);return db[_0x4fbf('0x9c')][_0x4fbf('0x2a')]({'where':_0x1930c6[_0x4fbf('0x48')]})[_0x4fbf('0x30')](function(_0x1d5354){_0x4ecc8a[_0x4fbf('0x2a')]=_0x1d5354;if(_0x2528a9['query'][_0x4fbf('0x4c')]){_0x1930c6[_0x4fbf('0x4d')]=[{'all':!![]}];}return db[_0x4fbf('0x9c')]['findAll'](_0x1930c6);})[_0x4fbf('0x30')](function(_0x5b4aa0){_0x4ecc8a[_0x4fbf('0x4f')]=_0x5b4aa0;return _0x4ecc8a;});}})[_0x4fbf('0x30')](respondWithFilteredResult(_0x52aab3,_0x1930c6))['catch'](handleError(_0x52aab3,null));};exports[_0x4fbf('0x36')]=function(_0x49afaf,_0x1069ce,_0x56f978){var _0x5af54b,_0x4defb7={},_0x5a56eb;if(_0x49afaf[_0x4fbf('0x55')]['to']){_0x5a56eb=_0x49afaf[_0x4fbf('0x55')]['to'][0x0];}return db[_0x4fbf('0x3b')][_0x4fbf('0x5b')]({'where':{'id':_0x49afaf[_0x4fbf('0x51')]['id']},'include':[{'model':db[_0x4fbf('0x9d')],'as':'List','include':[{'model':db[_0x4fbf('0x6b')],'as':_0x4fbf('0x9e'),'where':{'fax':_0x5a56eb},'limit':0x1,'order':[['updatedAt',_0x4fbf('0x9f')]]}]}]})[_0x4fbf('0x30')](handleEntityNotFound(_0x1069ce,null))['then'](function(_0x388dda){_0x5af54b=_0x388dda;if(_0x49afaf[_0x4fbf('0x55')]['attachments']&&_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][_0x4fbf('0x44')]){for(var _0x880eb7=0x0;_0x880eb7<_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][_0x4fbf('0x44')];_0x880eb7+=0x1){_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][_0x880eb7]={'filename':_0x49afaf[_0x4fbf('0x55')]['attachments'][_0x880eb7][_0x4fbf('0x35')],'id':_0x49afaf[_0x4fbf('0x55')]['attachments'][_0x880eb7]['id'],'path':path['join'](config[_0x4fbf('0xa1')],_0x4fbf('0xa2'),_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][_0x880eb7][_0x4fbf('0xa3')])};}}return respondWithRpcPromise('CheckAfterSend',_0x4fbf('0xa4'),{'FaxAccountId':_[_0x4fbf('0xa5')](_0x49afaf[_0x4fbf('0x51')]['id'])?undefined:_0x49afaf['params']['id'],'path':_[_0x4fbf('0xa5')](_0x49afaf[_0x4fbf('0x55')]['attachments'][0x0]['path'])?undefined:_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][0x0][_0x4fbf('0x6')],'fax':_[_0x4fbf('0xa5')](_0x49afaf[_0x4fbf('0x55')]['to'][0x0])?undefined:_0x49afaf['body']['to'][0x0]},client9002);})['then'](function(){if(_0x5af54b){if(_['isNil'](_0x49afaf['body'][_0x4fbf('0xa6')])){_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa6')]=util[_0x4fbf('0x9a')](_0x4fbf('0xa7'),_0x5af54b[_0x4fbf('0x35')],_0x5af54b[_0x4fbf('0xa8')]);}if(_0x5af54b[_0x4fbf('0xa9')]){if(_0x5af54b['List'][_0x4fbf('0x9e')][_0x4fbf('0x44')]){return _0x5af54b[_0x4fbf('0xa9')][_0x4fbf('0x9e')][0x0];}else{return db[_0x4fbf('0x6b')][_0x4fbf('0x54')](_['defaults'](_0x49afaf[_0x4fbf('0x55')],{'firstName':_0x49afaf[_0x4fbf('0x55')]['to'][0x0],'phone':_0x49afaf[_0x4fbf('0x55')]['to'][0x0],'fax':_0x49afaf[_0x4fbf('0x55')]['to'][0x0],'ListId':_0x5af54b['ListId']}));}}else{throw new Error(_0x4fbf('0xaa'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x5082dc){if(_0x5082dc){return db[_0x4fbf('0x69')][_0x4fbf('0x5b')]({'where':{'ContactId':_0x5082dc['id'],'closed':![],'FaxAccountId':_0x5af54b['id']}})['then'](function(_0x11aabf){if(_0x11aabf){return[_0x11aabf,![]];}return db['FaxInteraction'][_0x4fbf('0x54')]({'UserId':_0x49afaf[_0x4fbf('0x56')]['id'],'ContactId':_0x5082dc['id'],'FaxAccountId':_0x5af54b['id'],'fax':_0x49afaf[_0x4fbf('0x55')]['to'][0x0],'firstMsgDirection':_0x4fbf('0xab'),'Messages':[_['merge'](_0x49afaf[_0x4fbf('0x55')],{'read':![],'body':_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][0x0][_0x4fbf('0xac')],'FaxAccountId':_0x5af54b['id'],'UserId':_0x49afaf[_0x4fbf('0x56')]['id'],'ContactId':_0x5082dc['id'],'AttachmentId':_0x49afaf['body'][_0x4fbf('0xa0')][0x0]['id']})]},{'include':[{'model':db[_0x4fbf('0x9c')],'as':_0x4fbf('0xad')}]})[_0x4fbf('0x30')](function(_0x117edb){return[_0x117edb,!![]];});});}else{throw new Error(_0x4fbf('0xae'));}})[_0x4fbf('0xaf')](function(_0x354e61,_0x27ff34){if(_0x27ff34){return _0x354e61;}return db[_0x4fbf('0x9c')][_0x4fbf('0x54')]({'direction':'out','read':![],'body':_0x49afaf['body'][_0x4fbf('0xa0')][0x0]['filename'],'FaxAccountId':_0x5af54b['id'],'FaxInteractionId':_0x354e61['id'],'UserId':_0x49afaf['user']['id'],'ContactId':_0x354e61[_0x4fbf('0xb0')],'AttachmentId':_0x49afaf[_0x4fbf('0x55')]['attachments'][0x0]['id']})[_0x4fbf('0x30')](function(_0x19e6ca){_0x354e61[_0x4fbf('0xb1')][_0x4fbf('0xad')]=[];_0x354e61['dataValues'][_0x4fbf('0xad')][_0x4fbf('0x81')](_0x19e6ca[_0x4fbf('0xb1')]);return _0x354e61;});})[_0x4fbf('0x30')](function(_0x4e39f1){respondWithRpcPromise(_0x4fbf('0xb2'),_0x4fbf('0xb2'),{'FaxAccountId':_[_0x4fbf('0xa5')](_0x49afaf[_0x4fbf('0x51')]['id'])?undefined:_0x49afaf[_0x4fbf('0x51')]['id'],'path':_[_0x4fbf('0xa5')](_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][0x0][_0x4fbf('0x6')])?undefined:_0x49afaf[_0x4fbf('0x55')][_0x4fbf('0xa0')][0x0][_0x4fbf('0x6')],'fax':_[_0x4fbf('0xa5')](_0x49afaf[_0x4fbf('0x55')]['to'][0x0])?undefined:_0x49afaf[_0x4fbf('0x55')]['to'][0x0],'AttachmentId':_0x49afaf[_0x4fbf('0x55')]['attachments'][0x0]['id']},client9002)[_0x4fbf('0x30')](function(_0x41c4ea){logger[_0x4fbf('0x1b')]('SendFaxRpc,\x20%s',_0x41c4ea);})[_0x4fbf('0x22')](function(_0x29446b){logger['info']('SendFaxRpc,\x20%s',_0x29446b);});return _0x4e39f1;})[_0x4fbf('0x30')](respondWithResult(_0x1069ce,null))['catch'](handleError(_0x1069ce,null));};exports['addAgents']=function(_0x4705f2,_0x3b5b87,_0x5ae166){return db['FaxAccount'][_0x4fbf('0x5b')]({'where':{'id':_0x4705f2[_0x4fbf('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b5b87,null))[_0x4fbf('0x30')](function(_0xb43fba){if(_0xb43fba){return _0xb43fba[_0x4fbf('0xb3')](_0x4705f2['body'][_0x4fbf('0x64')],_[_0x4fbf('0xb4')](_0x4705f2[_0x4fbf('0x55')],[_0x4fbf('0x64'),'id'])||{})[_0x4fbf('0xaf')](function(_0x3f4c88){for(var _0x5dad89=0x0;_0x5dad89<_0x4705f2[_0x4fbf('0x55')][_0x4fbf('0x64')][_0x4fbf('0x44')];_0x5dad89+=0x1){socket[_0x4fbf('0xb5')](_0x4fbf('0xb6'),{'UserId':Number(_0x4705f2['body']['ids'][_0x5dad89]),'FaxAccountId':Number(_0x4705f2[_0x4fbf('0x51')]['id'])});}return _0x3f4c88;});}})[_0x4fbf('0x30')](respondWithResult(_0x3b5b87,null))[_0x4fbf('0x22')](handleError(_0x3b5b87,null));};exports[_0x4fbf('0xb7')]=function(_0x33e218,_0x114af9,_0x4bd4e8){return db[_0x4fbf('0x3b')][_0x4fbf('0x5b')]({'where':{'id':_0x33e218['params']['id']}})[_0x4fbf('0x30')](handleEntityNotFound(_0x114af9,null))[_0x4fbf('0x30')](function(_0x4832c2){if(_0x4832c2){return _0x4832c2[_0x4fbf('0xb7')](_0x33e218[_0x4fbf('0x40')][_0x4fbf('0x64')])[_0x4fbf('0x30')](function(){if(_['isArray'](_0x33e218[_0x4fbf('0x40')][_0x4fbf('0x64')])){for(var _0x255c05=0x0;_0x255c05<_0x33e218[_0x4fbf('0x40')][_0x4fbf('0x64')][_0x4fbf('0x44')];_0x255c05+=0x1){socket[_0x4fbf('0xb5')](_0x4fbf('0xb8'),{'UserId':Number(_0x33e218['query'][_0x4fbf('0x64')][_0x255c05]),'FaxAccountId':Number(_0x33e218[_0x4fbf('0x51')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x33e218['query'][_0x4fbf('0x64')]),'FaxAccountId':Number(_0x33e218[_0x4fbf('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x114af9,null))[_0x4fbf('0x22')](handleError(_0x114af9,null));};exports[_0x4fbf('0xb9')]=function(_0x1616f5,_0x4bdc96,_0x3ebc3a){var _0x28dadf={};var _0x2cf131={};var _0x439324;var _0x13c67d;return db[_0x4fbf('0x3b')][_0x4fbf('0x62')]({'where':{'id':_0x1616f5['params']['id']}})[_0x4fbf('0x30')](handleEntityNotFound(_0x4bdc96,null))[_0x4fbf('0x30')](function(_0x3b3af1){if(_0x3b3af1){_0x439324=_0x3b3af1;_0x2cf131[_0x4fbf('0x3f')]=_[_0x4fbf('0x52')](db['User'][_0x4fbf('0x3c')]);_0x2cf131['query']=_[_0x4fbf('0x52')](_0x1616f5[_0x4fbf('0x40')]);_0x2cf131[_0x4fbf('0x41')]=_[_0x4fbf('0x53')](_0x2cf131[_0x4fbf('0x3f')],_0x2cf131[_0x4fbf('0x40')]);_0x28dadf[_0x4fbf('0x42')]=_['intersection'](_0x2cf131[_0x4fbf('0x3f')],qs[_0x4fbf('0x43')](_0x1616f5[_0x4fbf('0x40')][_0x4fbf('0x43')]));_0x28dadf[_0x4fbf('0x42')]=_0x28dadf[_0x4fbf('0x42')][_0x4fbf('0x44')]?_0x28dadf[_0x4fbf('0x42')]:_0x2cf131[_0x4fbf('0x3f')];_0x28dadf[_0x4fbf('0x46')]=qs[_0x4fbf('0x47')](_0x1616f5[_0x4fbf('0x40')][_0x4fbf('0x47')]);_0x28dadf['where']=qs[_0x4fbf('0x41')](_['pick'](_0x1616f5[_0x4fbf('0x40')],_0x2cf131['filters']));if(_0x1616f5[_0x4fbf('0x40')][_0x4fbf('0x63')]){_0x28dadf['where']=_[_0x4fbf('0x4a')](_0x28dadf['where'],{'$or':_[_0x4fbf('0x3a')](_0x28dadf[_0x4fbf('0x42')],function(_0x567414){var _0xc56412={};_0xc56412[_0x567414]={'$like':'%'+_0x1616f5['query'][_0x4fbf('0x63')]+'%'};return _0xc56412;})});}_0x28dadf=_['merge']({},_0x28dadf,_0x1616f5[_0x4fbf('0x4b')]);return _0x439324['getAgents'](_0x28dadf);}})[_0x4fbf('0x30')](function(_0x27b469){if(_0x27b469){_0x13c67d=_0x27b469[_0x4fbf('0x44')];if(!_0x1616f5[_0x4fbf('0x40')][_0x4fbf('0x67')](_0x4fbf('0x45'))){_0x28dadf[_0x4fbf('0x29')]=qs[_0x4fbf('0x29')](_0x1616f5[_0x4fbf('0x40')][_0x4fbf('0x29')]);_0x28dadf[_0x4fbf('0x27')]=qs['offset'](_0x1616f5['query'][_0x4fbf('0x27')]);}return _0x439324[_0x4fbf('0xb9')](_0x28dadf);}})[_0x4fbf('0x30')](function(_0x8d823){if(_0x8d823){return _0x8d823?{'count':_0x13c67d,'rows':_0x8d823}:null;}})[_0x4fbf('0x30')](respondWithResult(_0x4bdc96,null))[_0x4fbf('0x22')](handleError(_0x4bdc96,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b594908..1cdf1f9 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 _0x13c4=['exports','../../mysqldb','FaxAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x13c4,0x121));var _0x413c=function(_0xb63246,_0x3d0c29){_0xb63246=_0xb63246-0x0;var _0x5f058f=_0x13c4[_0xb63246];return _0x5f058f;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x413c('0x0'))['db'][_0x413c('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x413c('0x2'),'afterUpdate':_0x413c('0x3'),'afterDestroy':_0x413c('0x4')};function emitEvent(_0x194db4){return function(_0x5492e4,_0xd3c2f2,_0x124738){FaxAccountEvents[_0x413c('0x5')](_0x194db4+':'+_0x5492e4['id'],_0x5492e4);FaxAccountEvents[_0x413c('0x5')](_0x194db4,_0x5492e4);_0x124738(null);};}for(var e in events){if(events[_0x413c('0x6')](e)){var event=events[e];FaxAccount[_0x413c('0x7')](e,emitEvent(event));}}module[_0x413c('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xec7c=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x59bbf0,_0x55887c){var _0x37e810=function(_0x3f7a15){while(--_0x3f7a15){_0x59bbf0['push'](_0x59bbf0['shift']());}};_0x37e810(++_0x55887c);}(_0xec7c,0x154));var _0xcec7=function(_0x3f0efe,_0x1dce28){_0x3f0efe=_0x3f0efe-0x0;var _0x8a65a0=_0xec7c[_0x3f0efe];return _0x8a65a0;};'use strict';var EventEmitter=require(_0xcec7('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xcec7('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcec7('0x2')](0x0);var events={'afterCreate':_0xcec7('0x3'),'afterUpdate':'update','afterDestroy':_0xcec7('0x4')};function emitEvent(_0x1c281c){return function(_0x3e5838,_0x365a89,_0x26d849){FaxAccountEvents[_0xcec7('0x5')](_0x1c281c+':'+_0x3e5838['id'],_0x3e5838);FaxAccountEvents['emit'](_0x1c281c,_0x3e5838);_0x26d849(null);};}for(var e in events){if(events[_0xcec7('0x6')](e)){var event=events[e];FaxAccount[_0xcec7('0x7')](e,emitEvent(event));}}module[_0xcec7('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7b116b4..565330e 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 _0x47f0=['moment','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47f0,0x73));var _0x047f=function(_0x5edcd7,_0x4c5e59){_0x5edcd7=_0x5edcd7-0x0;var _0x2f5b45=_0x47f0[_0x5edcd7];return _0x2f5b45;};'use strict';var _=require(_0x047f('0x0'));var util=require(_0x047f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x047f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x047f('0x3'));var rimraf=require('rimraf');var config=require(_0x047f('0x4'));var attributes=require(_0x047f('0x5'));module[_0x047f('0x6')]=function(_0xae8778,_0x28c7eb){return _0xae8778[_0x047f('0x7')](_0x047f('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4305=['define','fax_accounts','lodash','util','moment','bluebird','request-promise','exports'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x4305,0x92));var _0x5430=function(_0x284669,_0x19fbd9){_0x284669=_0x284669-0x0;var _0x3bc417=_0x4305[_0x284669];return _0x3bc417;};'use strict';var _=require(_0x5430('0x0'));var util=require(_0x5430('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5430('0x2'));var BPromise=require(_0x5430('0x3'));var rp=require(_0x5430('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x5430('0x5')]=function(_0x593885,_0x51b10f){return _0x593885[_0x5430('0x6')]('FaxAccount',attributes,{'tableName':_0x5430('0x7'),'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 a6617b0..e83497f 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 _0x3335=['ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','then','info','request\x20sent','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','NotifyFaxAccount','body','CmContact','describe','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','*,*,*,*','created','interaction','FaxMessage'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3335,0xc1));var _0x5333=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x3335[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x5333('0x0'));var util=require('util');var moment=require(_0x5333('0x1'));var BPromise=require(_0x5333('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5333('0x3'));var db=require(_0x5333('0x4'))['db'];var utils=require(_0x5333('0x5'));var logger=require(_0x5333('0x6'))(_0x5333('0x7'));var config=require(_0x5333('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5333('0x9')][_0x5333('0xa')]({'port':0x232c});config[_0x5333('0xb')]=_[_0x5333('0xc')](config[_0x5333('0xb')],{'host':_0x5333('0xd'),'port':0x18eb});var socket=require(_0x5333('0xe'))(new Redis(config[_0x5333('0xb')]));require(_0x5333('0xf'))['register'](socket);function respondWithRpcPromise(_0x40f5c2,_0x134213,_0x20bc7e){return new BPromise(function(_0x36ff07,_0x41f20f){return client['request'](_0x40f5c2,_0x20bc7e)[_0x5333('0x10')](function(_0xa38630){logger[_0x5333('0x11')]('FaxAccount,\x20%s,\x20%s',_0x134213,_0x5333('0x12'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x134213,_0x5333('0x12'),JSON['stringify'](_0xa38630));if(_0xa38630[_0x5333('0x13')]){if(_0xa38630[_0x5333('0x13')]['code']===0x1f4){logger[_0x5333('0x13')](_0x5333('0x14'),_0x134213,_0xa38630[_0x5333('0x13')][_0x5333('0x15')]);return _0x41f20f(_0xa38630[_0x5333('0x13')][_0x5333('0x15')]);}logger['error'](_0x5333('0x14'),_0x134213,_0xa38630[_0x5333('0x13')][_0x5333('0x15')]);return _0x36ff07(_0xa38630['error'][_0x5333('0x15')]);}else{logger[_0x5333('0x11')]('FaxAccount,\x20%s,\x20%s',_0x134213,'request\x20sent');_0x36ff07(_0xa38630[_0x5333('0x16')][_0x5333('0x15')]);}})[_0x5333('0x17')](function(_0x1ad4ff){logger[_0x5333('0x13')]('FaxAccount,\x20%s,\x20%s',_0x134213,_0x1ad4ff);_0x41f20f(_0x1ad4ff);});});}exports[_0x5333('0x18')]=function(_0x5b157d){var _0x496799=this;return new Promise(function(_0x452137,_0x2bac0c){return db[_0x5333('0x19')][_0x5333('0x1a')]({'raw':_0x5b157d[_0x5333('0x1b')]?_0x5b157d[_0x5333('0x1b')][_0x5333('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b157d['options']?_0x5b157d['options'][_0x5333('0x1d')]||null:null,'attributes':_0x5b157d['options']?_0x5b157d[_0x5333('0x1b')][_0x5333('0x1e')]||null:null,'limit':_0x5b157d[_0x5333('0x1b')]?_0x5b157d['options'][_0x5333('0x1f')]||null:null,'include':_0x5b157d[_0x5333('0x1b')]?_0x5b157d[_0x5333('0x1b')][_0x5333('0x20')]?_[_0x5333('0x21')](_0x5b157d[_0x5333('0x1b')][_0x5333('0x20')],function(_0x15e41d){return{'model':db[_0x15e41d[_0x5333('0x22')]],'as':_0x15e41d['as'],'attributes':_0x15e41d[_0x5333('0x1e')],'include':_0x15e41d[_0x5333('0x20')]?_[_0x5333('0x21')](_0x15e41d[_0x5333('0x20')],function(_0x5600e0){return{'model':db[_0x5600e0[_0x5333('0x22')]],'as':_0x5600e0['as'],'attributes':_0x5600e0[_0x5333('0x1e')],'include':_0x5600e0['include']?_['map'](_0x5600e0['include'],function(_0x2df948){return{'model':db[_0x2df948[_0x5333('0x22')]],'as':_0x2df948['as'],'attributes':_0x2df948[_0x5333('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5333('0x10')](function(_0x2eecd9){logger[_0x5333('0x11')](_0x5333('0x18'),_0x5b157d);logger[_0x5333('0x23')](_0x5333('0x18'),_0x5b157d,JSON[_0x5333('0x24')](_0x2eecd9));_0x452137(_0x2eecd9);})['catch'](function(_0x301ccb){logger['error']('GetFaxAccount',_0x301ccb[_0x5333('0x15')],_0x5b157d);_0x2bac0c(_0x496799[_0x5333('0x13')](0x1f4,_0x301ccb[_0x5333('0x15')]));});});};exports[_0x5333('0x25')]=function(_0x4ebf8d,_0x47b8f6,_0x395977){var _0xb5d5d2=this;return new Promise(function(_0x1f7ee8,_0x3f99b9){var _0x460cc9={'body':_0x4ebf8d[_0x5333('0x26')],'channel':'fax'};var _0x527083=[];var _0x5ea8c7=[];var _0xb0f0ae={};return db[_0x5333('0x27')][_0x5333('0x28')]()[_0x5333('0x10')](function(_0x5eef42){if(!_0x5eef42){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x527083=_[_0x5333('0x29')](_[_0x5333('0x2a')](_0x5eef42),[_0x5333('0x2b'),'updatedAt']);_0x5ea8c7=_[_0x5333('0x29')](_['keys'](_0x5eef42),[_0x5333('0x2b'),_0x5333('0x2c'),_0x5333('0x2d'),_0x5333('0x2e')]);if(_0x4ebf8d[_0x5333('0x26')]['id']){delete _0x4ebf8d['body']['id'];}if(_[_0x5333('0x2f')](_0x4ebf8d[_0x5333('0x26')][_0x5333('0x30')])){throw new db[(_0x5333('0x31'))]['ValidationError'](_0x5333('0x32'));}if(_[_0x5333('0x2f')](_0x4ebf8d[_0x5333('0x26')][_0x5333('0x26')])||_0x4ebf8d['body']['body']===''){throw new db[(_0x5333('0x31'))][(_0x5333('0x33'))](_0x5333('0x34'));}if(_['isNil'](_0x4ebf8d['body']['mapKey'])){throw new db[(_0x5333('0x31'))][(_0x5333('0x33'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ea8c7);}if(!_[_0x5333('0x35')](_0x5ea8c7,_0x4ebf8d[_0x5333('0x26')]['mapKey'])){throw new db[(_0x5333('0x31'))][(_0x5333('0x33'))](_0x5333('0x36')+_0x5ea8c7);}_0xb0f0ae[_0x4ebf8d['body'][_0x5333('0x37')]]=_0x4ebf8d[_0x5333('0x26')]['from'];})[_0x5333('0x10')](function(){return db[_0x5333('0x19')][_0x5333('0x38')]({'where':{'id':_0x4ebf8d[_0x5333('0x39')]['id']},'include':[{'model':db[_0x5333('0x3a')],'as':_0x5333('0x3b'),'include':[{'model':db['CmContact'],'as':_0x5333('0x3c'),'where':_0xb0f0ae,'limit':0x1,'order':[['updatedAt',_0x5333('0x3d')]]}]},{'model':db[_0x5333('0x3e')],'as':_0x5333('0x3f')}]});})[_0x5333('0x10')](function(_0x5f332a){if(_0x5f332a&&_0x5f332a[_0x5333('0x3b')]){var _0xa86fae=_0x5f332a['get']({'plain':!![]});_0x460cc9[_0x5333('0x39')]=_0xa86fae;_0x460cc9[_0x5333('0x40')]=_0xa86fae['Applications'];_0x460cc9[_0x5333('0x41')]=_0xa86fae[_0x5333('0x3b')];_0x460cc9[_0x5333('0x40')]=_[_0x5333('0x42')](_0x460cc9[_0x5333('0x40')],[_0x5333('0x43')],[_0x5333('0x44')]);if(_0x460cc9['account']['Applications']){delete _0x460cc9[_0x5333('0x39')][_0x5333('0x3f')];}if(_0x460cc9['account']['List']&&_0x460cc9[_0x5333('0x39')][_0x5333('0x3b')][_0x5333('0x3c')][_0x5333('0x45')]){return _0x460cc9[_0x5333('0x39')][_0x5333('0x3b')][_0x5333('0x3c')][0x0];}var _0x762ca9=_[_0x5333('0xc')](_0x4ebf8d[_0x5333('0x26')],{'firstName':_0x4ebf8d[_0x5333('0x26')][_0x5333('0x30')],'ListId':_0xa86fae[_0x5333('0x2e')]});_0x762ca9[_0x4ebf8d['body'][_0x5333('0x37')]]=_0x4ebf8d[_0x5333('0x26')][_0x5333('0x30')];return db[_0x5333('0x27')][_0x5333('0x46')](_0x762ca9,{'fields':_0x527083,'raw':!![]});}})[_0x5333('0x10')](function(_0x51f6fa){_0x460cc9[_0x5333('0x47')]=_0x51f6fa;if(_0x51f6fa){var _0x46081f={'ContactId':_0x51f6fa['id'],'FaxAccountId':_0x4ebf8d['account']['id'],'fax':_0x51f6fa[_0x5333('0x48')]};return db[_0x5333('0x49')]['find']({'where':{'ContactId':_0x51f6fa['id'],'closed':![],'FaxAccountId':_0x4ebf8d[_0x5333('0x39')]['id']}})['then'](function(_0x438c3){if(_0x438c3){return[_0x438c3,![]];}return db['FaxInteraction'][_0x5333('0x46')](_0x46081f)[_0x5333('0x10')](function(_0x2e79ce){return[_0x2e79ce,!![]];});});}else{throw new Error(_0x5333('0x4a'));}})[_0x5333('0x4b')](function(_0x365818,_0x2d6621){var _0xbc7753=_0x365818[_0x5333('0x4c')]({'plain':!![]});if(_0x2d6621){if(_0x460cc9['account'][_0x5333('0x4d')]){_0x460cc9[_0x5333('0x40')][_0x5333('0x4e')]({'id':0x0,'priority':_0x460cc9['applications'][_0x5333('0x45')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5333('0x4f')});}_0xbc7753[_0x5333('0x50')]=!![];}else{_0xbc7753[_0x5333('0x50')]=![];}_0x460cc9[_0x5333('0x51')]=_0xbc7753;return db[_0x5333('0x52')]['create']({'body':_0x4ebf8d[_0x5333('0x26')][_0x5333('0x26')],'FaxAccountId':_0x4ebf8d[_0x5333('0x39')]['id'],'FaxInteractionId':_0x365818['id'],'direction':'in','ContactId':_0x365818[_0x5333('0x53')],'AttachmentId':_0x4ebf8d[_0x5333('0x26')][_0x5333('0x54')]});})[_0x5333('0x10')](function(_0x5c0c79){_0x460cc9[_0x5333('0x15')]=_0x5c0c79;if(_0x460cc9[_0x5333('0x51')][_0x5333('0x55')]){return db[_0x5333('0x56')][_0x5333('0x38')]({'attributes':['id',_0x5333('0x57')],'where':{'id':_0x460cc9[_0x5333('0x51')][_0x5333('0x55')]}})[_0x5333('0x10')](function(_0x108fea){if(_0x108fea){_0x460cc9[_0x5333('0x40')][_0x5333('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x108fea['name']+','+(_0x460cc9['account'][_0x5333('0x59')]||0xa),'interval':_0x5333('0x4f')});}return respondWithRpcPromise(_0x5333('0x5a'),_0x5333('0x5b'),_0x460cc9);});}return respondWithRpcPromise('Start',_0x5333('0x5b'),_0x460cc9);})[_0x5333('0x10')](function(_0x1af1e4){_0x1f7ee8(_0x1af1e4);})[_0x5333('0x17')](function(_0x2ad3e9){_0x3f99b9(_0xb5d5d2[_0x5333('0x13')](0x1f4,_0x2ad3e9['message']));});});}; \ No newline at end of file +var _0x10e1=['fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','FaxAccount,\x20%s,\x20%s','catch','findAll','options','raw','attributes','limit','include','map','model','GetFaxAccount','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','body','isNil','from','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','CmContact','Contacts','Applications','get','list','applications','orderBy','priority','asc','account','length','defaults','ListId','create','contact'];(function(_0x3ec7fa,_0x92a0a5){var _0x8c8389=function(_0x1c196c){while(--_0x1c196c){_0x3ec7fa['push'](_0x3ec7fa['shift']());}};_0x8c8389(++_0x92a0a5);}(_0x10e1,0x174));var _0x110e=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x10e1[_0x2f45ea];return _0x485a84;};'use strict';var _=require('lodash');var util=require(_0x110e('0x0'));var moment=require(_0x110e('0x1'));var BPromise=require(_0x110e('0x2'));var rs=require(_0x110e('0x3'));var fs=require('fs');var Redis=require(_0x110e('0x4'));var db=require(_0x110e('0x5'))['db'];var utils=require(_0x110e('0x6'));var logger=require(_0x110e('0x7'))('rpc');var config=require(_0x110e('0x8'));var jayson=require(_0x110e('0x9'));var client=jayson[_0x110e('0xa')][_0x110e('0xb')]({'port':0x232c});config[_0x110e('0xc')]=_['defaults'](config[_0x110e('0xc')],{'host':_0x110e('0xd'),'port':0x18eb});var socket=require(_0x110e('0xe'))(new Redis(config[_0x110e('0xc')]));require('./faxAccount.socket')[_0x110e('0xf')](socket);function respondWithRpcPromise(_0xdde511,_0x275918,_0x4dcdab){return new BPromise(function(_0x31e161,_0x3b5314){return client[_0x110e('0x10')](_0xdde511,_0x4dcdab)[_0x110e('0x11')](function(_0x187c82){logger[_0x110e('0x12')]('FaxAccount,\x20%s,\x20%s',_0x275918,_0x110e('0x13'));logger[_0x110e('0x14')](_0x110e('0x15'),_0x275918,_0x110e('0x13'),JSON['stringify'](_0x187c82));if(_0x187c82['error']){if(_0x187c82[_0x110e('0x16')][_0x110e('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x275918,_0x187c82['error'][_0x110e('0x18')]);return _0x3b5314(_0x187c82['error'][_0x110e('0x18')]);}logger[_0x110e('0x16')](_0x110e('0x19'),_0x275918,_0x187c82[_0x110e('0x16')][_0x110e('0x18')]);return _0x31e161(_0x187c82[_0x110e('0x16')][_0x110e('0x18')]);}else{logger['info'](_0x110e('0x19'),_0x275918,_0x110e('0x13'));_0x31e161(_0x187c82['result'][_0x110e('0x18')]);}})[_0x110e('0x1a')](function(_0xd08d28){logger[_0x110e('0x16')](_0x110e('0x19'),_0x275918,_0xd08d28);_0x3b5314(_0xd08d28);});});}exports['GetFaxAccount']=function(_0x2670b4){var _0x2d70bf=this;return new Promise(function(_0x7e69e3,_0x5da4ae){return db['FaxAccount'][_0x110e('0x1b')]({'raw':_0x2670b4[_0x110e('0x1c')]?_0x2670b4[_0x110e('0x1c')][_0x110e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2670b4[_0x110e('0x1c')]?_0x2670b4[_0x110e('0x1c')]['where']||null:null,'attributes':_0x2670b4[_0x110e('0x1c')]?_0x2670b4['options'][_0x110e('0x1e')]||null:null,'limit':_0x2670b4[_0x110e('0x1c')]?_0x2670b4[_0x110e('0x1c')][_0x110e('0x1f')]||null:null,'include':_0x2670b4[_0x110e('0x1c')]?_0x2670b4[_0x110e('0x1c')][_0x110e('0x20')]?_[_0x110e('0x21')](_0x2670b4['options'][_0x110e('0x20')],function(_0x182989){return{'model':db[_0x182989['model']],'as':_0x182989['as'],'attributes':_0x182989[_0x110e('0x1e')],'include':_0x182989[_0x110e('0x20')]?_[_0x110e('0x21')](_0x182989[_0x110e('0x20')],function(_0x5af8ca){return{'model':db[_0x5af8ca['model']],'as':_0x5af8ca['as'],'attributes':_0x5af8ca[_0x110e('0x1e')],'include':_0x5af8ca[_0x110e('0x20')]?_['map'](_0x5af8ca[_0x110e('0x20')],function(_0x1523e1){return{'model':db[_0x1523e1[_0x110e('0x22')]],'as':_0x1523e1['as'],'attributes':_0x1523e1[_0x110e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x110e('0x11')](function(_0x5800a7){logger[_0x110e('0x12')](_0x110e('0x23'),_0x2670b4);logger['debug'](_0x110e('0x23'),_0x2670b4,JSON['stringify'](_0x5800a7));_0x7e69e3(_0x5800a7);})['catch'](function(_0xf7a3f8){logger['error'](_0x110e('0x23'),_0xf7a3f8[_0x110e('0x18')],_0x2670b4);_0x5da4ae(_0x2d70bf[_0x110e('0x16')](0x1f4,_0xf7a3f8['message']));});});};exports['NotifyFaxAccount']=function(_0x3675b4,_0x2b0cb4,_0xc88979){var _0x48febc=this;return new Promise(function(_0x8acb6e,_0x430efc){var _0x24f821={'body':_0x3675b4['body'],'channel':'fax'};var _0x31f7e3=[];var _0x41aed4=[];var _0x5ec907={};return db['CmContact']['describe']()[_0x110e('0x11')](function(_0x341812){if(!_0x341812){throw new db[(_0x110e('0x24'))][(_0x110e('0x25'))](_0x110e('0x26'));}_0x31f7e3=_['difference'](_[_0x110e('0x27')](_0x341812),[_0x110e('0x28'),_0x110e('0x29')]);_0x41aed4=_[_0x110e('0x2a')](_[_0x110e('0x27')](_0x341812),[_0x110e('0x28'),'updatedAt','CompanyId','ListId']);if(_0x3675b4[_0x110e('0x2b')]['id']){delete _0x3675b4[_0x110e('0x2b')]['id'];}if(_[_0x110e('0x2c')](_0x3675b4[_0x110e('0x2b')][_0x110e('0x2d')])){throw new db[(_0x110e('0x24'))][(_0x110e('0x25'))]('from\x20is\x20mandatory');}if(_[_0x110e('0x2c')](_0x3675b4['body'][_0x110e('0x2b')])||_0x3675b4[_0x110e('0x2b')]['body']===''){throw new db[(_0x110e('0x24'))][(_0x110e('0x25'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3675b4[_0x110e('0x2b')]['mapKey'])){throw new db[(_0x110e('0x24'))]['ValidationError'](_0x110e('0x2e')+_0x41aed4);}if(!_[_0x110e('0x2f')](_0x41aed4,_0x3675b4[_0x110e('0x2b')][_0x110e('0x30')])){throw new db[(_0x110e('0x24'))][(_0x110e('0x25'))](_0x110e('0x31')+_0x41aed4);}_0x5ec907[_0x3675b4['body'][_0x110e('0x30')]]=_0x3675b4[_0x110e('0x2b')][_0x110e('0x2d')];})[_0x110e('0x11')](function(){return db['FaxAccount'][_0x110e('0x32')]({'where':{'id':_0x3675b4['account']['id']},'include':[{'model':db[_0x110e('0x33')],'as':_0x110e('0x34'),'include':[{'model':db[_0x110e('0x35')],'as':_0x110e('0x36'),'where':_0x5ec907,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['FaxApplication'],'as':_0x110e('0x37')}]});})[_0x110e('0x11')](function(_0x569349){if(_0x569349&&_0x569349['List']){var _0x910385=_0x569349[_0x110e('0x38')]({'plain':!![]});_0x24f821['account']=_0x910385;_0x24f821['applications']=_0x910385[_0x110e('0x37')];_0x24f821[_0x110e('0x39')]=_0x910385['List'];_0x24f821[_0x110e('0x3a')]=_[_0x110e('0x3b')](_0x24f821[_0x110e('0x3a')],[_0x110e('0x3c')],[_0x110e('0x3d')]);if(_0x24f821['account']['Applications']){delete _0x24f821[_0x110e('0x3e')][_0x110e('0x37')];}if(_0x24f821['account'][_0x110e('0x34')]&&_0x24f821[_0x110e('0x3e')][_0x110e('0x34')][_0x110e('0x36')][_0x110e('0x3f')]){return _0x24f821[_0x110e('0x3e')][_0x110e('0x34')][_0x110e('0x36')][0x0];}var _0x13b183=_[_0x110e('0x40')](_0x3675b4[_0x110e('0x2b')],{'firstName':_0x3675b4[_0x110e('0x2b')]['from'],'ListId':_0x910385[_0x110e('0x41')]});_0x13b183[_0x3675b4[_0x110e('0x2b')]['mapKey']]=_0x3675b4[_0x110e('0x2b')][_0x110e('0x2d')];return db['CmContact'][_0x110e('0x42')](_0x13b183,{'fields':_0x31f7e3,'raw':!![]});}})[_0x110e('0x11')](function(_0x54f63d){_0x24f821[_0x110e('0x43')]=_0x54f63d;if(_0x54f63d){var _0xa6e3f7={'ContactId':_0x54f63d['id'],'FaxAccountId':_0x3675b4[_0x110e('0x3e')]['id'],'fax':_0x54f63d[_0x110e('0x44')]};return db[_0x110e('0x45')]['find']({'where':{'ContactId':_0x54f63d['id'],'closed':![],'FaxAccountId':_0x3675b4[_0x110e('0x3e')]['id']}})['then'](function(_0x34a7ef){if(_0x34a7ef){return[_0x34a7ef,![]];}return db[_0x110e('0x45')][_0x110e('0x42')](_0xa6e3f7)[_0x110e('0x11')](function(_0x5a44b2){return[_0x5a44b2,!![]];});});}else{throw new Error(_0x110e('0x46'));}})[_0x110e('0x47')](function(_0x24c303,_0x47e5a8){var _0x55acf3=_0x24c303['get']({'plain':!![]});if(_0x47e5a8){if(_0x24f821['account'][_0x110e('0x48')]){_0x24f821[_0x110e('0x3a')][_0x110e('0x49')]({'id':0x0,'priority':_0x24f821[_0x110e('0x3a')][_0x110e('0x3f')]+0x1,'app':'close','appdata':_0x110e('0x4a'),'interval':_0x110e('0x4b')});}_0x55acf3[_0x110e('0x4c')]=!![];}else{_0x55acf3[_0x110e('0x4c')]=![];}_0x24f821['interaction']=_0x55acf3;return db[_0x110e('0x4d')][_0x110e('0x42')]({'body':_0x3675b4[_0x110e('0x2b')][_0x110e('0x2b')],'FaxAccountId':_0x3675b4[_0x110e('0x3e')]['id'],'FaxInteractionId':_0x24c303['id'],'direction':'in','ContactId':_0x24c303[_0x110e('0x4e')],'AttachmentId':_0x3675b4['body'][_0x110e('0x4f')]});})['then'](function(_0x1603fa){_0x24f821['message']=_0x1603fa;if(_0x24f821[_0x110e('0x50')][_0x110e('0x51')]){return db[_0x110e('0x52')][_0x110e('0x32')]({'attributes':['id',_0x110e('0x53')],'where':{'id':_0x24f821['interaction']['UserId']}})['then'](function(_0x3776be){if(_0x3776be){_0x24f821[_0x110e('0x3a')][_0x110e('0x54')]({'id':0x0,'priority':0x0,'app':_0x110e('0x55'),'appdata':_0x3776be[_0x110e('0x53')]+','+(_0x24f821['account'][_0x110e('0x56')]||0xa),'interval':_0x110e('0x4b')});}return respondWithRpcPromise('Start',_0x110e('0x57'),_0x24f821);});}return respondWithRpcPromise('Start',_0x110e('0x57'),_0x24f821);})[_0x110e('0x11')](function(_0x117eea){_0x8acb6e(_0x117eea);})['catch'](function(_0x176013){_0x430efc(_0x48febc[_0x110e('0x16')](0x1f4,_0x176013[_0x110e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 39bc315..05419ca 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 _0x40a5=['faxAccount:','./faxAccount.events','emit','removeListener','register'];(function(_0x2f2b68,_0x9b0752){var _0x1949d0=function(_0x1df02a){while(--_0x1df02a){_0x2f2b68['push'](_0x2f2b68['shift']());}};_0x1949d0(++_0x9b0752);}(_0x40a5,0xd8));var _0x540a=function(_0x126121,_0x35e290){_0x126121=_0x126121-0x0;var _0x57d413=_0x40a5[_0x126121];return _0x57d413;};'use strict';var FaxAccountEvents=require(_0x540a('0x0'));var events=['save','remove','update'];function createListener(_0x26ac87,_0x4e5ba5){return function(_0x55c218){_0x4e5ba5[_0x540a('0x1')](_0x26ac87,_0x55c218);};}function removeListener(_0x519a65,_0x2fa3c0){return function(){FaxAccountEvents[_0x540a('0x2')](_0x519a65,_0x2fa3c0);};}exports[_0x540a('0x3')]=function(_0x32c327){for(var _0x5e9c88=0x0,_0x349a64=events['length'];_0x5e9c88<_0x349a64;_0x5e9c88++){var _0x14ad45=events[_0x5e9c88];var _0x3ec826=createListener(_0x540a('0x4')+_0x14ad45,_0x32c327);FaxAccountEvents['on'](_0x14ad45,_0x3ec826);}}; \ No newline at end of file +var _0x72d3=['./faxAccount.events','save','remove','update','removeListener','register','length'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x72d3,0xe7));var _0x372d=function(_0xee4b51,_0x82653a){_0xee4b51=_0xee4b51-0x0;var _0x5c4317=_0x72d3[_0xee4b51];return _0x5c4317;};'use strict';var FaxAccountEvents=require(_0x372d('0x0'));var events=[_0x372d('0x1'),_0x372d('0x2'),_0x372d('0x3')];function createListener(_0x4fd293,_0x25aafe){return function(_0x59b3e7){_0x25aafe['emit'](_0x4fd293,_0x59b3e7);};}function removeListener(_0x258ab2,_0x25829c){return function(){FaxAccountEvents[_0x372d('0x4')](_0x258ab2,_0x25829c);};}exports[_0x372d('0x5')]=function(_0x30f728){for(var _0x22a846=0x0,_0x170767=events[_0x372d('0x6')];_0x22a846<_0x170767;_0x22a846++){var _0x3da0e0=events[_0x22a846];var _0x1b0f61=createListener('faxAccount:'+_0x3da0e0,_0x30f728);FaxAccountEvents['on'](_0x3da0e0,_0x1b0f61);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 288cd96..2641625 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(_0x260deb,_0x592463){var _0x47daec=function(_0x56f7c4){while(--_0x56f7c4){_0x260deb['push'](_0x260deb['shift']());}};_0x47daec(++_0x592463);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x46b1d0,_0x15ad34){var _0x29e368=function(_0x29ddbd){while(--_0x29ddbd){_0x46b1d0['push'](_0x46b1d0['shift']());}};_0x29e368(++_0x15ad34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 c027614..1fad689 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 _0x6778=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x6778,0x8c));var _0x8677=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x6778[_0x5d4f12];return _0x4eb577;};'use strict';var Sequelize=require('sequelize');module[_0x8677('0x0')]={'priority':{'type':Sequelize[_0x8677('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8677('0x2')},'appdata':{'type':Sequelize[_0x8677('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8677('0x4')],'defaultValue':_0x8677('0x5')}}; \ No newline at end of file +var _0x6ca5=['*,*,*,*','sequelize','INTEGER','STRING','TEXT'];(function(_0x2960f4,_0x421609){var _0x497125=function(_0x12c470){while(--_0x12c470){_0x2960f4['push'](_0x2960f4['shift']());}};_0x497125(++_0x421609);}(_0x6ca5,0xba));var _0x56ca=function(_0x55e509,_0x342e58){_0x55e509=_0x55e509-0x0;var _0x431aaa=_0x6ca5[_0x55e509];return _0x431aaa;};'use strict';var Sequelize=require(_0x56ca('0x0'));module['exports']={'priority':{'type':Sequelize[_0x56ca('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x56ca('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x56ca('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x56ca('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7d161d6..e5225f7 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 _0xc3a5=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','filters','create','body','update','find','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x34f55d,_0x286cc3){var _0x1a6288=function(_0x402545){while(--_0x402545){_0x34f55d['push'](_0x34f55d['shift']());}};_0x1a6288(++_0x286cc3);}(_0xc3a5,0x13a));var _0x5c3a=function(_0x26788e,_0x98f6dd){_0x26788e=_0x26788e-0x0;var _0x2d8169=_0xc3a5[_0x26788e];return _0x2d8169;};'use strict';var emlformat=require(_0x5c3a('0x0'));var rimraf=require(_0x5c3a('0x1'));var zipdir=require(_0x5c3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5c3a('0x3'));var BPromise=require(_0x5c3a('0x4'));var Mustache=require(_0x5c3a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c3a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c3a('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x5c3a('0x8'));var toCsv=require(_0x5c3a('0x9'));var querystring=require(_0x5c3a('0xa'));var Papa=require(_0x5c3a('0xb'));var Redis=require(_0x5c3a('0xc'));var authService=require(_0x5c3a('0xd'));var qs=require(_0x5c3a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c3a('0xf'));var logger=require(_0x5c3a('0x10'))(_0x5c3a('0x11'));var utils=require(_0x5c3a('0x12'));var config=require(_0x5c3a('0x13'));var licenseUtil=require(_0x5c3a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf9af38,_0x13b948){_0x13b948=_0x13b948||0xcc;return function(_0x371d1c){if(_0x371d1c){return _0xf9af38[_0x5c3a('0x15')](_0x13b948);}return _0xf9af38['status'](_0x13b948)[_0x5c3a('0x16')]();};}function respondWithResult(_0x5bfe31,_0x5dcc74){_0x5dcc74=_0x5dcc74||0xc8;return function(_0x338848){if(_0x338848){return _0x5bfe31[_0x5c3a('0x17')](_0x5dcc74)[_0x5c3a('0x18')](_0x338848);}};}function respondWithFilteredResult(_0x2e6690,_0x19cc99){return function(_0x42f825){if(_0x42f825){var _0x58f1bf=typeof _0x19cc99['offset']===_0x5c3a('0x19')&&typeof _0x19cc99[_0x5c3a('0x1a')]===_0x5c3a('0x19');var _0x4b1183=_0x42f825[_0x5c3a('0x1b')];var _0x13683f=_0x58f1bf?0x0:_0x19cc99['offset'];var _0x2986ed=_0x58f1bf?_0x42f825['count']:_0x19cc99[_0x5c3a('0x1c')]+_0x19cc99[_0x5c3a('0x1a')];var _0xdfd55b;if(_0x2986ed>=_0x4b1183){_0x2986ed=_0x4b1183;_0xdfd55b=0xc8;}else{_0xdfd55b=0xce;}_0x2e6690['status'](_0xdfd55b);return _0x2e6690[_0x5c3a('0x1d')]('Content-Range',_0x13683f+'-'+_0x2986ed+'/'+_0x4b1183)['json'](_0x42f825);}return null;};}function patchUpdates(_0x45a983){return function(_0x53e4f9){try{jsonpatch[_0x5c3a('0x1e')](_0x53e4f9,_0x45a983,!![]);}catch(_0x23c578){return BPromise[_0x5c3a('0x1f')](_0x23c578);}return _0x53e4f9[_0x5c3a('0x20')]();};}function saveUpdates(_0x24514a,_0x46b682){return function(_0x204af9){if(_0x204af9){return _0x204af9['update'](_0x24514a)[_0x5c3a('0x21')](function(_0x1a55c9){return _0x1a55c9;});}return null;};}function removeEntity(_0x3159b5,_0x1b104){return function(_0xff2496){if(_0xff2496){return _0xff2496[_0x5c3a('0x22')]()[_0x5c3a('0x21')](function(){_0x3159b5[_0x5c3a('0x17')](0xcc)[_0x5c3a('0x16')]();});}};}function handleEntityNotFound(_0x1b3bfa,_0x10e7a2){return function(_0x534cc6){if(!_0x534cc6){_0x1b3bfa[_0x5c3a('0x15')](0x194);}return _0x534cc6;};}function handleError(_0xdd7cbb,_0x5c42e3){_0x5c42e3=_0x5c42e3||0x1f4;return function(_0x49fcfc){logger[_0x5c3a('0x23')](_0x49fcfc[_0x5c3a('0x24')]);if(_0x49fcfc[_0x5c3a('0x25')]){delete _0x49fcfc[_0x5c3a('0x25')];}_0xdd7cbb['status'](_0x5c42e3)[_0x5c3a('0x26')](_0x49fcfc);};}exports[_0x5c3a('0x27')]=function(_0x52cd0b,_0x1ceb77){var _0x1032d4={},_0x14d666={},_0x53deb1={'count':0x0,'rows':[]};var _0x3ce2f8=_[_0x5c3a('0x28')](db[_0x5c3a('0x29')][_0x5c3a('0x2a')],function(_0x25a3f4){return{'name':_0x25a3f4[_0x5c3a('0x2b')],'type':_0x25a3f4[_0x5c3a('0x2c')][_0x5c3a('0x2d')]};});_0x14d666[_0x5c3a('0x2e')]=_['map'](_0x3ce2f8,_0x5c3a('0x25'));_0x14d666[_0x5c3a('0x2f')]=_[_0x5c3a('0x30')](_0x52cd0b[_0x5c3a('0x2f')]);_0x14d666['filters']=_[_0x5c3a('0x31')](_0x14d666[_0x5c3a('0x2e')],_0x14d666[_0x5c3a('0x2f')]);_0x1032d4[_0x5c3a('0x32')]=_[_0x5c3a('0x31')](_0x14d666['model'],qs['fields'](_0x52cd0b[_0x5c3a('0x2f')][_0x5c3a('0x33')]));_0x1032d4[_0x5c3a('0x32')]=_0x1032d4[_0x5c3a('0x32')][_0x5c3a('0x34')]?_0x1032d4[_0x5c3a('0x32')]:_0x14d666[_0x5c3a('0x2e')];if(!_0x52cd0b[_0x5c3a('0x2f')][_0x5c3a('0x35')](_0x5c3a('0x36'))){_0x1032d4[_0x5c3a('0x1a')]=qs[_0x5c3a('0x1a')](_0x52cd0b[_0x5c3a('0x2f')]['limit']);_0x1032d4[_0x5c3a('0x1c')]=qs['offset'](_0x52cd0b[_0x5c3a('0x2f')][_0x5c3a('0x1c')]);}_0x1032d4[_0x5c3a('0x37')]=qs[_0x5c3a('0x38')](_0x52cd0b[_0x5c3a('0x2f')][_0x5c3a('0x38')]);_0x1032d4[_0x5c3a('0x39')]=qs['filters'](_['pick'](_0x52cd0b['query'],_0x14d666['filters']),_0x3ce2f8);if(_0x52cd0b[_0x5c3a('0x2f')][_0x5c3a('0x3a')]){_0x1032d4['where']=_['merge'](_0x1032d4[_0x5c3a('0x39')],{'$or':_['map'](_0x3ce2f8,function(_0x5b6e92){if(_0x5b6e92['type']!==_0x5c3a('0x3b')){var _0x13d3ec={};_0x13d3ec[_0x5b6e92[_0x5c3a('0x25')]]={'$like':'%'+_0x52cd0b[_0x5c3a('0x2f')][_0x5c3a('0x3a')]+'%'};return _0x13d3ec;}})});}_0x1032d4=_[_0x5c3a('0x3c')]({},_0x1032d4,_0x52cd0b[_0x5c3a('0x3d')]);var _0x85628c={'where':_0x1032d4['where']};return db[_0x5c3a('0x29')][_0x5c3a('0x1b')](_0x85628c)[_0x5c3a('0x21')](function(_0x37957f){_0x53deb1['count']=_0x37957f;if(_0x52cd0b[_0x5c3a('0x2f')][_0x5c3a('0x3e')]){_0x1032d4[_0x5c3a('0x3f')]=[{'all':!![]}];}return db[_0x5c3a('0x29')]['findAll'](_0x1032d4);})[_0x5c3a('0x21')](function(_0xce9c44){_0x53deb1[_0x5c3a('0x40')]=_0xce9c44;return _0x53deb1;})[_0x5c3a('0x21')](respondWithFilteredResult(_0x1ceb77,_0x1032d4))[_0x5c3a('0x41')](handleError(_0x1ceb77,null));};exports[_0x5c3a('0x42')]=function(_0x5883d6,_0x348dd4){var _0x3c9e7d={'raw':!![],'where':{'id':_0x5883d6['params']['id']}},_0x475266={};_0x475266[_0x5c3a('0x2e')]=_[_0x5c3a('0x30')](db['FaxApplication'][_0x5c3a('0x2a')]);_0x475266[_0x5c3a('0x2f')]=_['keys'](_0x5883d6[_0x5c3a('0x2f')]);_0x475266[_0x5c3a('0x43')]=_[_0x5c3a('0x31')](_0x475266['model'],_0x475266[_0x5c3a('0x2f')]);_0x3c9e7d['attributes']=_['intersection'](_0x475266[_0x5c3a('0x2e')],qs[_0x5c3a('0x33')](_0x5883d6[_0x5c3a('0x2f')][_0x5c3a('0x33')]));_0x3c9e7d[_0x5c3a('0x32')]=_0x3c9e7d[_0x5c3a('0x32')][_0x5c3a('0x34')]?_0x3c9e7d[_0x5c3a('0x32')]:_0x475266[_0x5c3a('0x2e')];if(_0x5883d6['query'][_0x5c3a('0x3e')]){_0x3c9e7d[_0x5c3a('0x3f')]=[{'all':!![]}];}_0x3c9e7d=_[_0x5c3a('0x3c')]({},_0x3c9e7d,_0x5883d6[_0x5c3a('0x3d')]);return db['FaxApplication']['find'](_0x3c9e7d)[_0x5c3a('0x21')](handleEntityNotFound(_0x348dd4,null))[_0x5c3a('0x21')](respondWithResult(_0x348dd4,null))[_0x5c3a('0x41')](handleError(_0x348dd4,null));};exports[_0x5c3a('0x44')]=function(_0x2ab3ca,_0x2a6f97){return db[_0x5c3a('0x29')][_0x5c3a('0x44')](_0x2ab3ca[_0x5c3a('0x45')],{})['then'](respondWithResult(_0x2a6f97,0xc9))['catch'](handleError(_0x2a6f97,null));};exports[_0x5c3a('0x46')]=function(_0x15cf78,_0x3f1190){if(_0x15cf78[_0x5c3a('0x45')]['id']){delete _0x15cf78[_0x5c3a('0x45')]['id'];}return db[_0x5c3a('0x29')][_0x5c3a('0x47')]({'where':{'id':_0x15cf78[_0x5c3a('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f1190,null))[_0x5c3a('0x21')](saveUpdates(_0x15cf78[_0x5c3a('0x45')],null))[_0x5c3a('0x21')](respondWithResult(_0x3f1190,null))['catch'](handleError(_0x3f1190,null));};exports[_0x5c3a('0x22')]=function(_0x43760e,_0x403c00){return db[_0x5c3a('0x29')][_0x5c3a('0x47')]({'where':{'id':_0x43760e[_0x5c3a('0x48')]['id']}})[_0x5c3a('0x21')](handleEntityNotFound(_0x403c00,null))[_0x5c3a('0x21')](removeEntity(_0x403c00,null))[_0x5c3a('0x41')](handleError(_0x403c00,null));}; \ No newline at end of file +var _0x58a4=['merge','map','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x58a4,0x17d));var _0x458a=function(_0x29279c,_0x570176){_0x29279c=_0x29279c-0x0;var _0x279b1f=_0x58a4[_0x29279c];return _0x279b1f;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x458a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x458a('0x2'));var moment=require(_0x458a('0x3'));var BPromise=require(_0x458a('0x4'));var Mustache=require('mustache');var util=require(_0x458a('0x5'));var path=require('path');var sox=require(_0x458a('0x6'));var csv=require(_0x458a('0x7'));var ejs=require(_0x458a('0x8'));var fs=require('fs');var fs_extra=require(_0x458a('0x9'));var _=require(_0x458a('0xa'));var squel=require('squel');var crypto=require(_0x458a('0xb'));var jsforce=require(_0x458a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x458a('0x7'));var querystring=require(_0x458a('0xd'));var Papa=require(_0x458a('0xe'));var Redis=require(_0x458a('0xf'));var authService=require(_0x458a('0x10'));var qs=require(_0x458a('0x11'));var as=require(_0x458a('0x12'));var hardwareService=require(_0x458a('0x13'));var logger=require(_0x458a('0x14'))(_0x458a('0x15'));var utils=require('../../config/utils');var config=require(_0x458a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x458a('0x17'))['db'];function respondWithStatusCode(_0x440d0a,_0x1ea070){_0x1ea070=_0x1ea070||0xcc;return function(_0x2041aa){if(_0x2041aa){return _0x440d0a[_0x458a('0x18')](_0x1ea070);}return _0x440d0a[_0x458a('0x19')](_0x1ea070)['end']();};}function respondWithResult(_0x8a782b,_0x2ef9ab){_0x2ef9ab=_0x2ef9ab||0xc8;return function(_0x1cc63f){if(_0x1cc63f){return _0x8a782b[_0x458a('0x19')](_0x2ef9ab)[_0x458a('0x1a')](_0x1cc63f);}};}function respondWithFilteredResult(_0x1ecb20,_0x1e5f0a){return function(_0x4c1952){if(_0x4c1952){var _0x1d76b6=typeof _0x1e5f0a['offset']===_0x458a('0x1b')&&typeof _0x1e5f0a[_0x458a('0x1c')]==='undefined';var _0x5363b6=_0x4c1952[_0x458a('0x1d')];var _0x52b7b1=_0x1d76b6?0x0:_0x1e5f0a['offset'];var _0x47437a=_0x1d76b6?_0x4c1952[_0x458a('0x1d')]:_0x1e5f0a['offset']+_0x1e5f0a[_0x458a('0x1c')];var _0x4864ab;if(_0x47437a>=_0x5363b6){_0x47437a=_0x5363b6;_0x4864ab=0xc8;}else{_0x4864ab=0xce;}_0x1ecb20[_0x458a('0x19')](_0x4864ab);return _0x1ecb20[_0x458a('0x1e')](_0x458a('0x1f'),_0x52b7b1+'-'+_0x47437a+'/'+_0x5363b6)[_0x458a('0x1a')](_0x4c1952);}return null;};}function patchUpdates(_0x2a9019){return function(_0x3bf1a6){try{jsonpatch[_0x458a('0x20')](_0x3bf1a6,_0x2a9019,!![]);}catch(_0x839b4f){return BPromise[_0x458a('0x21')](_0x839b4f);}return _0x3bf1a6[_0x458a('0x22')]();};}function saveUpdates(_0x339d39,_0x15d5ab){return function(_0x54dd22){if(_0x54dd22){return _0x54dd22[_0x458a('0x23')](_0x339d39)[_0x458a('0x24')](function(_0x238a1d){return _0x238a1d;});}return null;};}function removeEntity(_0x128fea,_0x45f918){return function(_0x30b588){if(_0x30b588){return _0x30b588[_0x458a('0x25')]()[_0x458a('0x24')](function(){_0x128fea[_0x458a('0x19')](0xcc)[_0x458a('0x26')]();});}};}function handleEntityNotFound(_0x4bb865,_0x36071a){return function(_0x520c09){if(!_0x520c09){_0x4bb865['sendStatus'](0x194);}return _0x520c09;};}function handleError(_0x3afa3d,_0x27cebe){_0x27cebe=_0x27cebe||0x1f4;return function(_0x51f8cc){logger[_0x458a('0x27')](_0x51f8cc[_0x458a('0x28')]);if(_0x51f8cc[_0x458a('0x29')]){delete _0x51f8cc['name'];}_0x3afa3d[_0x458a('0x19')](_0x27cebe)[_0x458a('0x2a')](_0x51f8cc);};}exports[_0x458a('0x2b')]=function(_0x27d54d,_0x2a927d){var _0x3b917f={},_0x5983fc={},_0x1fa470={'count':0x0,'rows':[]};var _0x1d01c5=_['map'](db[_0x458a('0x2c')][_0x458a('0x2d')],function(_0xe2c7c){return{'name':_0xe2c7c[_0x458a('0x2e')],'type':_0xe2c7c[_0x458a('0x2f')]['key']};});_0x5983fc[_0x458a('0x30')]=_['map'](_0x1d01c5,_0x458a('0x29'));_0x5983fc[_0x458a('0x31')]=_[_0x458a('0x32')](_0x27d54d[_0x458a('0x31')]);_0x5983fc[_0x458a('0x33')]=_[_0x458a('0x34')](_0x5983fc[_0x458a('0x30')],_0x5983fc[_0x458a('0x31')]);_0x3b917f[_0x458a('0x35')]=_['intersection'](_0x5983fc['model'],qs[_0x458a('0x36')](_0x27d54d[_0x458a('0x31')]['fields']));_0x3b917f[_0x458a('0x35')]=_0x3b917f['attributes'][_0x458a('0x37')]?_0x3b917f[_0x458a('0x35')]:_0x5983fc[_0x458a('0x30')];if(!_0x27d54d[_0x458a('0x31')][_0x458a('0x38')](_0x458a('0x39'))){_0x3b917f[_0x458a('0x1c')]=qs['limit'](_0x27d54d[_0x458a('0x31')]['limit']);_0x3b917f[_0x458a('0x3a')]=qs[_0x458a('0x3a')](_0x27d54d[_0x458a('0x31')][_0x458a('0x3a')]);}_0x3b917f['order']=qs['sort'](_0x27d54d['query'][_0x458a('0x3b')]);_0x3b917f['where']=qs[_0x458a('0x33')](_[_0x458a('0x3c')](_0x27d54d[_0x458a('0x31')],_0x5983fc['filters']),_0x1d01c5);if(_0x27d54d[_0x458a('0x31')][_0x458a('0x3d')]){_0x3b917f[_0x458a('0x3e')]=_[_0x458a('0x3f')](_0x3b917f['where'],{'$or':_[_0x458a('0x40')](_0x1d01c5,function(_0x4ae6f5){if(_0x4ae6f5['type']!=='VIRTUAL'){var _0x562bf4={};_0x562bf4[_0x4ae6f5[_0x458a('0x29')]]={'$like':'%'+_0x27d54d[_0x458a('0x31')][_0x458a('0x3d')]+'%'};return _0x562bf4;}})});}_0x3b917f=_[_0x458a('0x3f')]({},_0x3b917f,_0x27d54d['options']);var _0x238ecb={'where':_0x3b917f[_0x458a('0x3e')]};return db[_0x458a('0x2c')][_0x458a('0x1d')](_0x238ecb)[_0x458a('0x24')](function(_0x54aba0){_0x1fa470['count']=_0x54aba0;if(_0x27d54d[_0x458a('0x31')]['includeAll']){_0x3b917f['include']=[{'all':!![]}];}return db[_0x458a('0x2c')][_0x458a('0x41')](_0x3b917f);})[_0x458a('0x24')](function(_0x28e195){_0x1fa470[_0x458a('0x42')]=_0x28e195;return _0x1fa470;})[_0x458a('0x24')](respondWithFilteredResult(_0x2a927d,_0x3b917f))[_0x458a('0x43')](handleError(_0x2a927d,null));};exports[_0x458a('0x44')]=function(_0x39393e,_0x466f8a){var _0x1dd2dd={'raw':!![],'where':{'id':_0x39393e[_0x458a('0x45')]['id']}},_0x338d84={};_0x338d84['model']=_[_0x458a('0x32')](db[_0x458a('0x2c')][_0x458a('0x2d')]);_0x338d84[_0x458a('0x31')]=_[_0x458a('0x32')](_0x39393e[_0x458a('0x31')]);_0x338d84['filters']=_['intersection'](_0x338d84[_0x458a('0x30')],_0x338d84[_0x458a('0x31')]);_0x1dd2dd[_0x458a('0x35')]=_[_0x458a('0x34')](_0x338d84[_0x458a('0x30')],qs['fields'](_0x39393e['query'][_0x458a('0x36')]));_0x1dd2dd[_0x458a('0x35')]=_0x1dd2dd['attributes'][_0x458a('0x37')]?_0x1dd2dd[_0x458a('0x35')]:_0x338d84['model'];if(_0x39393e['query']['includeAll']){_0x1dd2dd['include']=[{'all':!![]}];}_0x1dd2dd=_[_0x458a('0x3f')]({},_0x1dd2dd,_0x39393e[_0x458a('0x46')]);return db['FaxApplication']['find'](_0x1dd2dd)[_0x458a('0x24')](handleEntityNotFound(_0x466f8a,null))[_0x458a('0x24')](respondWithResult(_0x466f8a,null))[_0x458a('0x43')](handleError(_0x466f8a,null));};exports['create']=function(_0x6727e3,_0x37ce92){return db[_0x458a('0x2c')][_0x458a('0x47')](_0x6727e3[_0x458a('0x48')],{})[_0x458a('0x24')](respondWithResult(_0x37ce92,0xc9))[_0x458a('0x43')](handleError(_0x37ce92,null));};exports[_0x458a('0x23')]=function(_0x33f84b,_0x5120c3){if(_0x33f84b[_0x458a('0x48')]['id']){delete _0x33f84b['body']['id'];}return db['FaxApplication'][_0x458a('0x49')]({'where':{'id':_0x33f84b[_0x458a('0x45')]['id']}})[_0x458a('0x24')](handleEntityNotFound(_0x5120c3,null))[_0x458a('0x24')](saveUpdates(_0x33f84b[_0x458a('0x48')],null))['then'](respondWithResult(_0x5120c3,null))[_0x458a('0x43')](handleError(_0x5120c3,null));};exports[_0x458a('0x25')]=function(_0x8d93bc,_0x3140a9){return db[_0x458a('0x2c')][_0x458a('0x49')]({'where':{'id':_0x8d93bc[_0x458a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3140a9,null))[_0x458a('0x24')](removeEntity(_0x3140a9,null))['catch'](handleError(_0x3140a9,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 086ddfb..12b3823 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 _0xbcff=['api','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x32d1b4,_0x53adec){var _0x4e3dae=function(_0x2d68f1){while(--_0x2d68f1){_0x32d1b4['push'](_0x32d1b4['shift']());}};_0x4e3dae(++_0x53adec);}(_0xbcff,0x143));var _0xfbcf=function(_0x619464,_0x427598){_0x619464=_0x619464-0x0;var _0x46e7a8=_0xbcff[_0x619464];return _0x46e7a8;};'use strict';var _=require('lodash');var util=require(_0xfbcf('0x0'));var logger=require(_0xfbcf('0x1'))(_0xfbcf('0x2'));var moment=require('moment');var BPromise=require(_0xfbcf('0x3'));var rp=require(_0xfbcf('0x4'));var fs=require('fs');var path=require(_0xfbcf('0x5'));var rimraf=require(_0xfbcf('0x6'));var config=require('../../config/environment');var attributes=require(_0xfbcf('0x7'));module[_0xfbcf('0x8')]=function(_0x2d3012,_0x161721){return _0x2d3012[_0xfbcf('0x9')](_0xfbcf('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfbcf('0xb'),'collate':_0xfbcf('0xc')});}; \ No newline at end of file +var _0x73f5=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0x9b891d,_0x399394){var _0xfa74e3=function(_0x2a623b){while(--_0x2a623b){_0x9b891d['push'](_0x9b891d['shift']());}};_0xfa74e3(++_0x399394);}(_0x73f5,0x1e4));var _0x573f=function(_0x211397,_0x52b103){_0x211397=_0x211397-0x0;var _0x3df56c=_0x73f5[_0x211397];return _0x3df56c;};'use strict';var _=require(_0x573f('0x0'));var util=require(_0x573f('0x1'));var logger=require(_0x573f('0x2'))('api');var moment=require(_0x573f('0x3'));var BPromise=require(_0x573f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x573f('0x5'));var rimraf=require(_0x573f('0x6'));var config=require(_0x573f('0x7'));var attributes=require(_0x573f('0x8'));module[_0x573f('0x9')]=function(_0x586716,_0x46ea58){return _0x586716[_0x573f('0xa')](_0x573f('0xb'),attributes,{'tableName':_0x573f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x573f('0xd'),'collate':_0x573f('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 6d111f5..2cc2daa 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 _0x28d1=['jayson/promise','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x480957,_0x2632b7){var _0x5101d3=function(_0xca6835){while(--_0xca6835){_0x480957['push'](_0x480957['shift']());}};_0x5101d3(++_0x2632b7);}(_0x28d1,0x1d2));var _0x128d=function(_0x452a5f,_0x4fa52d){_0x452a5f=_0x452a5f-0x0;var _0x678c67=_0x28d1[_0x452a5f];return _0x678c67;};'use strict';var _=require(_0x128d('0x0'));var util=require(_0x128d('0x1'));var moment=require(_0x128d('0x2'));var BPromise=require(_0x128d('0x3'));var rs=require(_0x128d('0x4'));var fs=require('fs');var Redis=require(_0x128d('0x5'));var db=require(_0x128d('0x6'))['db'];var utils=require(_0x128d('0x7'));var logger=require(_0x128d('0x8'))('rpc');var config=require(_0x128d('0x9'));var jayson=require(_0x128d('0xa'));var client=jayson['client'][_0x128d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c0e1d,_0x1fa318,_0x29e963){return new BPromise(function(_0x46f4a5,_0x37610f){return client[_0x128d('0xc')](_0x5c0e1d,_0x29e963)[_0x128d('0xd')](function(_0x29b9da){logger[_0x128d('0xe')]('FaxApplication,\x20%s,\x20%s',_0x1fa318,_0x128d('0xf'));logger[_0x128d('0x10')](_0x128d('0x11'),_0x1fa318,_0x128d('0xf'),JSON[_0x128d('0x12')](_0x29b9da));if(_0x29b9da[_0x128d('0x13')]){if(_0x29b9da[_0x128d('0x13')][_0x128d('0x14')]===0x1f4){logger[_0x128d('0x13')](_0x128d('0x15'),_0x1fa318,_0x29b9da['error'][_0x128d('0x16')]);return _0x37610f(_0x29b9da[_0x128d('0x13')][_0x128d('0x16')]);}logger[_0x128d('0x13')](_0x128d('0x15'),_0x1fa318,_0x29b9da[_0x128d('0x13')][_0x128d('0x16')]);return _0x46f4a5(_0x29b9da[_0x128d('0x13')][_0x128d('0x16')]);}else{logger[_0x128d('0xe')](_0x128d('0x15'),_0x1fa318,_0x128d('0xf'));_0x46f4a5(_0x29b9da[_0x128d('0x17')][_0x128d('0x16')]);}})[_0x128d('0x18')](function(_0x4fb33e){logger[_0x128d('0x13')](_0x128d('0x15'),_0x1fa318,_0x4fb33e);_0x37610f(_0x4fb33e);});});}exports[_0x128d('0x19')]=function(_0x189d60){var _0x231013=this;return new Promise(function(_0x3b6f0d,_0x16cd3e){return db[_0x128d('0x1a')][_0x128d('0x1b')](_0x189d60[_0x128d('0x1c')],{'raw':_0x189d60[_0x128d('0x1d')]?_0x189d60[_0x128d('0x1d')][_0x128d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x189d60[_0x128d('0x1d')]?_0x189d60[_0x128d('0x1d')][_0x128d('0x1f')]||null:null,'attributes':_0x189d60[_0x128d('0x1d')]?_0x189d60[_0x128d('0x1d')][_0x128d('0x20')]||null:null,'limit':_0x189d60[_0x128d('0x1d')]?_0x189d60[_0x128d('0x1d')][_0x128d('0x21')]||null:null})[_0x128d('0xd')](function(_0x33cf15){logger['info'](_0x128d('0x19'),_0x189d60);logger[_0x128d('0x10')](_0x128d('0x19'),_0x189d60,JSON[_0x128d('0x12')](_0x33cf15));_0x3b6f0d(_0x33cf15);})[_0x128d('0x18')](function(_0x344509){logger[_0x128d('0x13')](_0x128d('0x19'),_0x344509['message'],_0x189d60);_0x16cd3e(_0x231013[_0x128d('0x13')](0x1f4,_0x344509[_0x128d('0x16')]));});});}; \ No newline at end of file +var _0xc5dd=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request'];(function(_0x39f28a,_0x10259e){var _0x2427a1=function(_0x30467d){while(--_0x30467d){_0x39f28a['push'](_0x39f28a['shift']());}};_0x2427a1(++_0x10259e);}(_0xc5dd,0x170));var _0xdc5d=function(_0x1932d0,_0xd09dcb){_0x1932d0=_0x1932d0-0x0;var _0x3d84d8=_0xc5dd[_0x1932d0];return _0x3d84d8;};'use strict';var _=require(_0xdc5d('0x0'));var util=require(_0xdc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc5d('0x2'));var db=require(_0xdc5d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc5d('0x4'));var config=require('../../config/environment');var jayson=require(_0xdc5d('0x5'));var client=jayson[_0xdc5d('0x6')][_0xdc5d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19f841,_0x2033a6,_0x21f318){return new BPromise(function(_0x2e4776,_0x17839a){return client[_0xdc5d('0x8')](_0x19f841,_0x21f318)[_0xdc5d('0x9')](function(_0x9f14f4){logger[_0xdc5d('0xa')](_0xdc5d('0xb'),_0x2033a6,_0xdc5d('0xc'));logger[_0xdc5d('0xd')](_0xdc5d('0xe'),_0x2033a6,_0xdc5d('0xc'),JSON[_0xdc5d('0xf')](_0x9f14f4));if(_0x9f14f4['error']){if(_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2033a6,_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x12')]);return _0x17839a(_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x12')]);}logger[_0xdc5d('0x10')](_0xdc5d('0xb'),_0x2033a6,_0x9f14f4[_0xdc5d('0x10')][_0xdc5d('0x12')]);return _0x2e4776(_0x9f14f4['error'][_0xdc5d('0x12')]);}else{logger[_0xdc5d('0xa')]('FaxApplication,\x20%s,\x20%s',_0x2033a6,_0xdc5d('0xc'));_0x2e4776(_0x9f14f4[_0xdc5d('0x13')][_0xdc5d('0x12')]);}})[_0xdc5d('0x14')](function(_0x5953f0){logger[_0xdc5d('0x10')]('FaxApplication,\x20%s,\x20%s',_0x2033a6,_0x5953f0);_0x17839a(_0x5953f0);});});}exports[_0xdc5d('0x15')]=function(_0x1e605c){var _0x82df6e=this;return new Promise(function(_0x24d0ca,_0x237d28){return db[_0xdc5d('0x16')][_0xdc5d('0x17')](_0x1e605c[_0xdc5d('0x18')],{'raw':_0x1e605c[_0xdc5d('0x19')]?_0x1e605c[_0xdc5d('0x19')][_0xdc5d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e605c[_0xdc5d('0x19')]?_0x1e605c[_0xdc5d('0x19')]['where']||null:null,'attributes':_0x1e605c['options']?_0x1e605c['options'][_0xdc5d('0x1b')]||null:null,'limit':_0x1e605c['options']?_0x1e605c[_0xdc5d('0x19')][_0xdc5d('0x1c')]||null:null})['then'](function(_0x585261){logger['info'](_0xdc5d('0x15'),_0x1e605c);logger['debug'](_0xdc5d('0x15'),_0x1e605c,JSON[_0xdc5d('0xf')](_0x585261));_0x24d0ca(_0x585261);})[_0xdc5d('0x14')](function(_0x213a97){logger[_0xdc5d('0x10')]('UpdateFaxApplication',_0x213a97[_0xdc5d('0x12')],_0x1e605c);_0x237d28(_0x82df6e[_0xdc5d('0x10')](0x1f4,_0x213a97[_0xdc5d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index cf5f46b..51b07a7 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 _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x5d9bd6,_0x3a5f01){var _0x4e78d2=function(_0x195a9d){while(--_0x195a9d){_0x5d9bd6['push'](_0x5d9bd6['shift']());}};_0x4e78d2(++_0x3a5f01);}(_0x9354,0x96));var _0x4935=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0x9354[_0x58de4a];return _0x178820;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x3dc30d,_0x3eee3c){var _0x225236=function(_0x303bd2){while(--_0x303bd2){_0x3dc30d['push'](_0x3dc30d['shift']());}};_0x225236(++_0x3eee3c);}(_0xda2d,0x102));var _0xdda2=function(_0x4d67d8,_0x4f1fad){_0x4d67d8=_0x4d67d8-0x0;var _0x48d6b8=_0xda2d[_0x4d67d8];return _0x48d6b8;};'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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 46c83f6..9629d36 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 _0x1c8f=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x34c085,_0x47624b){var _0x9f7dc2=function(_0x3fcbed){while(--_0x3fcbed){_0x34c085['push'](_0x34c085['shift']());}};_0x9f7dc2(++_0x47624b);}(_0x1c8f,0x10c));var _0xf1c8=function(_0x3266ac,_0x419571){_0x3266ac=_0x3266ac-0x0;var _0x3207bf=_0x1c8f[_0x3266ac];return _0x3207bf;};'use strict';var Sequelize=require(_0xf1c8('0x0'));module[_0xf1c8('0x1')]={'closed':{'type':Sequelize[_0xf1c8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf1c8('0x3')]},'disposition':{'type':Sequelize[_0xf1c8('0x4')]},'secondDisposition':{'type':Sequelize[_0xf1c8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf1c8('0x4')]},'note':{'type':Sequelize[_0xf1c8('0x4')]},'read1stAt':{'type':Sequelize[_0xf1c8('0x3')]},'fax':{'type':Sequelize[_0xf1c8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf1c8('0x5')]('in',_0xf1c8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf1c8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf1c8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc859=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x354cc9,_0x583983){var _0x3d7ddc=function(_0x4e02b6){while(--_0x4e02b6){_0x354cc9['push'](_0x354cc9['shift']());}};_0x3d7ddc(++_0x583983);}(_0xc859,0x17b));var _0x9c85=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc859[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module[_0x9c85('0x0')]={'closed':{'type':Sequelize[_0x9c85('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9c85('0x2')]},'disposition':{'type':Sequelize[_0x9c85('0x3')]},'secondDisposition':{'type':Sequelize[_0x9c85('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9c85('0x3')]},'note':{'type':Sequelize[_0x9c85('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x9c85('0x4')]('in',_0x9c85('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9c85('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9c85('0x4')]('in',_0x9c85('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 48f5d3b..310ec7c 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 _0x2353=['addTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','existsSync','pipe','createWriteStream','log','err','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','name','map','fullname','TagIds','split','forEach','Tags','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','find','buildExpression','body','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','show','params','includeAll','options','create','describe','addMessage','ids','omit','FaxMessage','filter','YYYY-MM-DD\x20HH:mm:ss','include','findAll'];(function(_0xc90181,_0x5d0df1){var _0x30febb=function(_0xde15a9){while(--_0xde15a9){_0xc90181['push'](_0xc90181['shift']());}};_0x30febb(++_0x5d0df1);}(_0x2353,0xec));var _0x3235=function(_0x2fe645,_0x4b2b7f){_0x2fe645=_0x2fe645-0x0;var _0x20acfd=_0x2353[_0x2fe645];return _0x20acfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3235('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3235('0x1'));var rp=require(_0x3235('0x2'));var moment=require(_0x3235('0x3'));var BPromise=require(_0x3235('0x4'));var Mustache=require('mustache');var util=require(_0x3235('0x5'));var path=require(_0x3235('0x6'));var sox=require(_0x3235('0x7'));var csv=require(_0x3235('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3235('0x9'));var squel=require(_0x3235('0xa'));var crypto=require(_0x3235('0xb'));var jsforce=require(_0x3235('0xc'));var deskjs=require(_0x3235('0xd'));var toCsv=require(_0x3235('0x8'));var querystring=require(_0x3235('0xe'));var Papa=require(_0x3235('0xf'));var Redis=require(_0x3235('0x10'));var authService=require(_0x3235('0x11'));var qs=require(_0x3235('0x12'));var as=require(_0x3235('0x13'));var hardwareService=require(_0x3235('0x14'));var logger=require(_0x3235('0x15'))(_0x3235('0x16'));var utils=require('../../config/utils');var config=require(_0x3235('0x17'));var licenseUtil=require(_0x3235('0x18'));var db=require(_0x3235('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3235('0x1a'),'port':0x18eb});var socket=require(_0x3235('0x1b'))(new Redis(config[_0x3235('0x1c')]));require(_0x3235('0x1d'))[_0x3235('0x1e')](socket);function respondWithStatusCode(_0x31537d,_0x421a65){_0x421a65=_0x421a65||0xcc;return function(_0x2b59c0){if(_0x2b59c0){return _0x31537d[_0x3235('0x1f')](_0x421a65);}return _0x31537d[_0x3235('0x20')](_0x421a65)[_0x3235('0x21')]();};}function respondWithResult(_0x1ee00f,_0x5f01ca){_0x5f01ca=_0x5f01ca||0xc8;return function(_0xba7291){if(_0xba7291){return _0x1ee00f[_0x3235('0x20')](_0x5f01ca)[_0x3235('0x22')](_0xba7291);}};}function respondWithFilteredResult(_0x581167,_0x1ae952){return function(_0x1c50fb){if(_0x1c50fb){var _0x56a228=typeof _0x1ae952[_0x3235('0x23')]===_0x3235('0x24')&&typeof _0x1ae952[_0x3235('0x25')]===_0x3235('0x24');var _0x854336=_0x1c50fb[_0x3235('0x26')];var _0x35575f=_0x56a228?0x0:_0x1ae952[_0x3235('0x23')];var _0x599480=_0x56a228?_0x1c50fb[_0x3235('0x26')]:_0x1ae952['offset']+_0x1ae952[_0x3235('0x25')];var _0x53796c;if(_0x599480>=_0x854336){_0x599480=_0x854336;_0x53796c=0xc8;}else{_0x53796c=0xce;}_0x581167[_0x3235('0x20')](_0x53796c);return _0x581167['set'](_0x3235('0x27'),_0x35575f+'-'+_0x599480+'/'+_0x854336)[_0x3235('0x22')](_0x1c50fb);}return null;};}function patchUpdates(_0x2a9f14){return function(_0x38e979){try{jsonpatch['apply'](_0x38e979,_0x2a9f14,!![]);}catch(_0x30a248){return BPromise[_0x3235('0x28')](_0x30a248);}return _0x38e979['save']();};}function saveUpdates(_0x2a81cf,_0x2dd23c){return function(_0x5d0d28){if(_0x5d0d28){return _0x5d0d28[_0x3235('0x29')](_0x2a81cf)[_0x3235('0x2a')](function(_0x12a02a){return _0x12a02a;});}return null;};}function removeEntity(_0x11665b,_0x5592e6){return function(_0x3b09f3){if(_0x3b09f3){return _0x3b09f3[_0x3235('0x2b')]()[_0x3235('0x2a')](function(){_0x11665b[_0x3235('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x149c3c,_0x1bbe13){return function(_0x34b469){if(!_0x34b469){_0x149c3c[_0x3235('0x1f')](0x194);}return _0x34b469;};}function handleError(_0x2b16ca,_0x19de0c){_0x19de0c=_0x19de0c||0x1f4;return function(_0x5d10fd){logger[_0x3235('0x2c')](_0x5d10fd['stack']);if(_0x5d10fd[_0x3235('0x2d')]){delete _0x5d10fd[_0x3235('0x2d')];}_0x2b16ca[_0x3235('0x20')](_0x19de0c)['send'](_0x5d10fd);};}function getInteractionUsers(_0x436ac5,_0x859ebf){return new BPromise(function(_0x57562e,_0x1f6a33){try{if(_0x859ebf[_0x436ac5['id']]){_0x436ac5['Users']=_[_0x3235('0x2e')](_0x859ebf[_0x436ac5['id']],function(_0x539805){return{'id':_0x539805['id'],'fullname':_0x539805[_0x3235('0x2f')]};});}}catch(_0x294137){_0x1f6a33(_0x294137);}_0x57562e(_0x436ac5);});}function getInteractionTags(_0x7d21ff,_0x5a9e81){return new BPromise(function(_0x3641b9,_0x32495f){try{if(_0x7d21ff[_0x3235('0x30')]){_0x7d21ff['Tags']=[];_0x7d21ff[_0x3235('0x30')][_0x3235('0x31')](',')[_0x3235('0x32')](function(_0xd4a553){_0x7d21ff[_0x3235('0x33')][_0x3235('0x34')](_0x5a9e81[_0xd4a553]);});}delete _0x7d21ff[_0x3235('0x30')];}catch(_0x442c50){_0x32495f(_0x442c50);}_0x3641b9(_0x7d21ff);});}function updateFaxInteraction(_0x43f964,_0x1af3cc,_0x2d809b){return new BPromise(function(_0x5a2d18,_0x2c5eae){return getInteractionUsers(_0x43f964,_0x2d809b)[_0x3235('0x2a')](function(_0x4a5cf0){return getInteractionTags(_0x4a5cf0,_0x1af3cc);})[_0x3235('0x2a')](function(_0x519fb5){return getStateInteraction(_0x519fb5);})[_0x3235('0x2a')](function(_0x3cbed4){_0x5a2d18(_0x3cbed4);})[_0x3235('0x35')](function(_0x1344f3){_0x2c5eae(_0x1344f3);});});}function getStateInteraction(_0x2368e0){return new BPromise(function(_0x571a47){_0x2368e0[_0x3235('0x36')]=0x0;_0x2368e0[_0x3235('0x37')]=0x0;_0x2368e0['answered']=0x0;_0x2368e0[_0x3235('0x38')]=0x0;_0x2368e0[_0x3235('0x39')]=0x0;if(!_0x2368e0[_0x3235('0x3a')]&&!_0x2368e0[_0x3235('0x3b')]){_0x2368e0[_0x3235('0x36')]+=0x1;}if(!_0x2368e0[_0x3235('0x3a')]&&_0x2368e0[_0x3235('0x3b')]){_0x2368e0['talking']+=0x1;if(_0x2368e0['waiting']){_0x2368e0[_0x3235('0x36')]-=0x1;}}if(_0x2368e0['closed']&&_0x2368e0[_0x3235('0x3b')]){_0x2368e0[_0x3235('0x3c')]+=0x1;if(_0x2368e0[_0x3235('0x37')]){_0x2368e0[_0x3235('0x37')]-=0x1;}}if(_0x2368e0['closed']&&!_0x2368e0[_0x3235('0x3b')]){_0x2368e0['unmanaged']+=0x1;if(_0x2368e0['waiting']){_0x2368e0[_0x3235('0x36')]-=0x1;}}_0x2368e0[_0x3235('0x39')]+=0x1;_0x571a47(_0x2368e0);});}exports[_0x3235('0x3d')]=function(_0x1f21b5,_0x4d6129){var _0x30a809={},_0x4eabf3={},_0x2af40a={'count':0x0,'rows':[]};var _0x110c85=_['map'](db['FaxInteraction'][_0x3235('0x3e')],function(_0x8ae0e9){return{'name':_0x8ae0e9['fieldName'],'type':_0x8ae0e9[_0x3235('0x3f')][_0x3235('0x40')]};});_0x4eabf3[_0x3235('0x41')]=_['map'](_0x110c85,'name');_0x4eabf3[_0x3235('0x42')]=_[_0x3235('0x43')](_0x1f21b5['query']);_0x4eabf3[_0x3235('0x44')]=_[_0x3235('0x45')](_0x4eabf3[_0x3235('0x41')],_0x4eabf3['query']);_0x30a809[_0x3235('0x46')]=_[_0x3235('0x45')](_0x4eabf3[_0x3235('0x41')],qs[_0x3235('0x47')](_0x1f21b5[_0x3235('0x42')]['fields']));_0x30a809[_0x3235('0x46')]=_0x30a809[_0x3235('0x46')][_0x3235('0x48')]?_0x30a809[_0x3235('0x46')]:_0x4eabf3[_0x3235('0x41')];if(!_0x1f21b5['query'][_0x3235('0x49')](_0x3235('0x4a'))){_0x30a809[_0x3235('0x25')]=qs[_0x3235('0x25')](_0x1f21b5['query'][_0x3235('0x25')]);_0x30a809['offset']=qs[_0x3235('0x23')](_0x1f21b5[_0x3235('0x42')][_0x3235('0x23')]);}_0x30a809[_0x3235('0x4b')]=qs[_0x3235('0x4c')](_0x1f21b5[_0x3235('0x42')][_0x3235('0x4c')]);_0x30a809['where']=qs[_0x3235('0x44')](_[_0x3235('0x4d')](_0x1f21b5[_0x3235('0x42')],_0x4eabf3[_0x3235('0x44')]),_0x110c85);var _0x5a09f7=[];var _0x18bd61=squel[_0x3235('0x4e')]()['field']('id')['field'](_0x3235('0x2d'))[_0x3235('0x4f')](_0x3235('0x50'))[_0x3235('0x51')]('tools_tags');var _0x3b3bb9=squel[_0x3235('0x4e')]()[_0x3235('0x4f')]('u.id')[_0x3235('0x4f')](_0x3235('0x52'))['field'](_0x3235('0x53'))[_0x3235('0x51')](_0x3235('0x54'),'ui')[_0x3235('0x55')]('users','u',_0x3235('0x56'));var _0x5af78d=squel[_0x3235('0x4e')]()[_0x3235('0x51')](_0x3235('0x57'),'i')['left_join'](_0x3235('0x58'),'c',_0x3235('0x59'))[_0x3235('0x55')](_0x3235('0x5a'),'o','o.id\x20=\x20i.UserId')[_0x3235('0x55')](_0x3235('0x5b'),'a',_0x3235('0x5c'))[_0x3235('0x55')]('fax_messages','me',_0x3235('0x5d'))['left_join'](_0x3235('0x5e'),'it',_0x3235('0x5f'))[_0x3235('0x55')]('tools_tags','t',_0x3235('0x60'));var _0x2231ba=squel[_0x3235('0x61')]();var _0x123fe5=[];var _0x37f6bb=squel[_0x3235('0x61')]();var _0x3fcbe3;if(_0x1f21b5[_0x3235('0x42')]['search']){_0x3fcbe3=as[_0x3235('0x62')](_0x1f21b5[_0x3235('0x42')]['search']);var _0x47e282=_0x3fcbe3['sqlOperator'];for(var _0x12b9ba=0x0;_0x12b9ba<_0x3fcbe3[_0x3235('0x63')]['length'];_0x12b9ba++){var _0x1c7baf=_0x3fcbe3[_0x3235('0x63')][_0x12b9ba];var _0x36780b='i';var _0x3576f6=_['find'](_0x110c85,[_0x3235('0x2d'),_0x1c7baf['field']]);if(!_0x3576f6){switch(_0x1c7baf['field']){case'unreadMessages':if(_0x1c7baf[_0x3235('0x64')]==0x1){_0x5af78d[_0x3235('0x65')]('`'+_0x1c7baf['field']+_0x3235('0x66'));}else{_0x5af78d[_0x3235('0x65')]('`'+_0x1c7baf[_0x3235('0x4f')]+'`\x20>\x200');}break;case _0x3235('0x67'):if(_0x1c7baf[_0x3235('0x68')]===_0x3235('0x69')){if(_0x1c7baf[_0x3235('0x64')][_0x3235('0x31')]('\x20')[_0x3235('0x48')]>0x1){_0x2231ba[_0x47e282](_0x3235('0x6a'),qs[_0x3235('0x6b')](_0x1c7baf[_0x3235('0x64')]),null);}else{var _0x2783e4='%'+_0x1c7baf[_0x3235('0x64')]+'%';_0x2231ba[_0x47e282](_0x3235('0x6c'),_0x2783e4,_0x2783e4,_0x2783e4);}}else{_0x3576f6=_['find'](_0x110c85,[_0x3235('0x2d'),_0x3235('0x6d')]);_0x1c7baf[_0x3235('0x4f')]=_0x3235('0x6d');_0x3692aa=as['buildExpression'](_0x36780b,_0x3576f6[_0x3235('0x3f')],_0x1c7baf);_0x2231ba[_0x47e282](_0x3692aa[_0x3235('0x6e')],_0x3692aa[_0x3235('0x64')][_0x3235('0x6f')],_0x3692aa[_0x3235('0x64')][_0x3235('0x21')]);}break;case _0x3235('0x70'):var _0x438079=_0x1c7baf[_0x3235('0x64')][_0x3235('0x31')](',')['map'](function(_0x4bb8b0){return Number(_0x4bb8b0);});_0x438079['forEach'](function(_0x3b7ec9){_0x37f6bb['or'](_0x3235('0x71'),'%,'+_0x3b7ec9+',%');});_0x123fe5=_[_0x3235('0x72')](_0x123fe5,_0x438079);break;case _0x3235('0x73'):if(_0x1c7baf[_0x3235('0x68')]==='$substring'){_0x2231ba[_0x47e282]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1c7baf['value']+'%',null);}else{_0x3576f6=_[_0x3235('0x74')](_0x110c85,[_0x3235('0x2d'),_0x3235('0x3b')]);_0x1c7baf['field']='UserId';_0x3692aa=as[_0x3235('0x75')](_0x36780b,_0x3576f6[_0x3235('0x3f')],_0x1c7baf);_0x2231ba[_0x47e282](_0x3692aa[_0x3235('0x6e')],_0x3692aa['value']['start'],_0x3692aa[_0x3235('0x64')][_0x3235('0x21')]);}break;case _0x3235('0x76'):_0x3692aa=as[_0x3235('0x75')]('me',null,_0x1c7baf);_0x2231ba[_0x47e282](_0x3692aa[_0x3235('0x6e')],_0x3692aa['value']['start'],_0x3692aa[_0x3235('0x64')][_0x3235('0x21')]);break;}}else{var _0x3692aa=as[_0x3235('0x75')](_0x36780b,_0x3576f6[_0x3235('0x3f')],_0x1c7baf);_0x2231ba[_0x47e282](_0x3692aa['text'],_0x3692aa[_0x3235('0x64')]['start'],_0x3692aa[_0x3235('0x64')][_0x3235('0x21')]);}}}else{var _0x7070f=_(_0x1f21b5[_0x3235('0x42')])['keys']()[_0x3235('0x2e')](function(_0x557ff4){return _[_0x3235('0x77')](_0x110c85,[_0x3235('0x2d'),_0x557ff4])?_0x557ff4:undefined;})[_0x3235('0x78')]()[_0x3235('0x64')]();if(!_[_0x3235('0x79')](_0x7070f)){_0x7070f[_0x3235('0x32')](function(_0xc838fb){if(_0xc838fb===_0x3235('0x7a')){_0x5af78d[_0x3235('0x7b')](_0x3235('0x7c'),[]['concat'](_0x1f21b5[_0x3235('0x42')][_0xc838fb]));}else if(_0xc838fb===_0x3235('0x7d')){var _0x3f063e=JSON[_0x3235('0x7e')](_0x1f21b5[_0x3235('0x42')][_0xc838fb])[_0x3235('0x7f')];var _0x4eee3e=JSON[_0x3235('0x7e')](_0x1f21b5[_0x3235('0x42')][_0xc838fb])[_0x3235('0x80')];_0x5af78d[_0x3235('0x7b')](_0x3235('0x81'),_0x3f063e,_0x4eee3e);}else{if(_0x1f21b5[_0x3235('0x42')][_0xc838fb]===_0x3235('0x82')){_0x5af78d[_0x3235('0x7b')]('i.'+_0xc838fb+_0x3235('0x83'));}else{_0x5af78d[_0x3235('0x7b')]('i.'+_0xc838fb+_0x3235('0x84'),_0x1f21b5[_0x3235('0x42')][_0xc838fb]);}}});}if(_0x1f21b5[_0x3235('0x42')][_0x3235('0x85')]){if(_0x1f21b5[_0x3235('0x42')][_0x3235('0x85')]==0x1){_0x5af78d[_0x3235('0x65')](_0x3235('0x86'));}else{_0x5af78d[_0x3235('0x65')](_0x3235('0x87'));}}if(_0x1f21b5[_0x3235('0x42')]['tag']){_0x123fe5=_[_0x3235('0x88')](_0x1f21b5['query']['tag'])?_0x1f21b5['query'][_0x3235('0x89')]:new Array(_0x1f21b5[_0x3235('0x42')][_0x3235('0x89')]);_0x123fe5[_0x3235('0x32')](function(_0x3e5e23){_0x37f6bb['or'](_0x3235('0x71'),'%,'+_0x3e5e23+',%');});}if(_0x1f21b5[_0x3235('0x42')]['filter']){var _0x49a434=_0x1f21b5[_0x3235('0x42')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x3235('0x8a')](_0x49a434)){_0x2231ba['or']('i.id\x20LIKE\x20?',_0x49a434+'%')['or'](_0x3235('0x8b'),_0x49a434+'%');}_0x2231ba['or'](_0x3235('0x8c'),_0x49a434+'%');}}_0x5af78d[_0x3235('0x7b')](_0x2231ba);_0x5af78d[_0x3235('0x8d')](_0x3235('0x8e'));var _0x9c72c8={'type':db[_0x3235('0x8f')]['QueryTypes'][_0x3235('0x90')],'raw':!![]};var _0x4fe781=_0x5af78d['clone']();_0x4fe781[_0x3235('0x4f')]('i.id');_0x4fe781[_0x3235('0x4f')](_0x3235('0x91'),_0x3235('0x92'));if(_0x30a809[_0x3235('0x4b')]){_0x30a809[_0x3235('0x4b')][_0x3235('0x32')](function(_0x3750f8){var _0x587dba=_0x3750f8[0x0]===_0x3235('0x93')?_0x3750f8[0x0]:'i.'+_0x3750f8[0x0];_0x5af78d[_0x3235('0x4b')](_0x587dba,_0x3750f8[0x1]===_0x3235('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x123fe5)){_0x5af78d['having'](_0x37f6bb);_0x4fe781[_0x3235('0x7b')](_0x3235('0x95'),_0x123fe5);}BPromise[_0x3235('0x96')]()[_0x3235('0x2a')](function(){if(!_0x3fcbe3){if(_0x1f21b5[_0x3235('0x42')][_0x3235('0x7a')])return;_0x4fe781[_0x3235('0x7b')](_0x3235('0x97'));_0x5af78d[_0x3235('0x7b')](_0x3235('0x97'));return;}if(_0x1f21b5[_0x3235('0x98')][_0x3235('0x99')]!==_0x3235('0x9a'))return;return _0x1f21b5[_0x3235('0x98')][_0x3235('0x9b')]({'attributes':['id'],'raw':!![]})[_0x3235('0x2a')](function(_0x6689db){if(_[_0x3235('0x79')](_0x6689db)){_0x4fe781[_0x3235('0x7b')](_0x3235('0x9c'));_0x5af78d['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x4fe781[_0x3235('0x7b')](_0x3235('0x7c'),_[_0x3235('0x2e')](_0x6689db,'id'));_0x5af78d[_0x3235('0x7b')](_0x3235('0x7c'),_[_0x3235('0x2e')](_0x6689db,'id'));}});})[_0x3235('0x2a')](function(){if(_0x1f21b5[_0x3235('0x98')][_0x3235('0x99')]==='agent'&&!_0x3fcbe3&&!_0x1f21b5[_0x3235('0x42')][_0x3235('0x7a')])return[];return db[_0x3235('0x9d')]['query'](_0x4fe781['toString'](),_0x9c72c8);})['then'](function(_0xbb5181){_0x2af40a['count']=_0xbb5181[_0x3235('0x48')];if(_0x2af40a[_0x3235('0x26')]===0x0)return[];return db['sequelize'][_0x3235('0x42')](_0x18bd61[_0x3235('0x9e')](),_0x9c72c8)['then'](function(_0x3ea0dc){_0x5a09f7=_[_0x3235('0x9f')](_0x3ea0dc,'id');_0x9c72c8=_[_0x3235('0xa0')](_0x9c72c8,{'model':db[_0x3235('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f21b5[_0x3235('0x42')]['fields']){_0x30a809[_0x3235('0x46')][_0x3235('0x32')](function(_0x700a7e){_0x5af78d[_0x3235('0x4f')]('i.'+_0x700a7e);});}else{_0x5af78d[_0x3235('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3235('0x92'));_0x5af78d[_0x3235('0x4f')]('a.key','Account.key');_0x5af78d['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x5af78d[_0x3235('0x4f')]('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',_0x3235('0x93'));_0x5af78d[_0x3235('0x4f')]('i.*');_0x5af78d[_0x3235('0x4f')](_0x3235('0xa2'),_0x3235('0xa3'));_0x5af78d[_0x3235('0x4f')](_0x3235('0xa4'),_0x3235('0xa5'));_0x5af78d[_0x3235('0x4f')](_0x3235('0xa6'),_0x3235('0xa7'));_0x5af78d[_0x3235('0x4f')](_0x3235('0xa8'),_0x3235('0xa9'));_0x5af78d['field'](_0x3235('0xaa'),_0x3235('0xab'));_0x5af78d[_0x3235('0x4f')](_0x3235('0xac'),'Contact.fax');_0x5af78d[_0x3235('0x4f')](_0x3235('0xad'),_0x3235('0xae'));_0x5af78d['field']('o.internal','Owner.internal');_0x5af78d[_0x3235('0x4f')](_0x3235('0xaf'),_0x3235('0x30'));}if(_0x30a809['limit'])_0x5af78d[_0x3235('0x25')](_0x30a809[_0x3235('0x25')]);if(_0x30a809[_0x3235('0x23')])_0x5af78d['offset'](_0x30a809['offset']);return db[_0x3235('0x9d')][_0x3235('0x42')](_0x5af78d[_0x3235('0x9e')](),_0x9c72c8);})[_0x3235('0x2a')](function(_0x237ea6){if(_0x237ea6[_0x3235('0x48')]>0x0)_0x3b3bb9[_0x3235('0x7b')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x237ea6,'id'));return db[_0x3235('0x9d')][_0x3235('0x42')](_0x3b3bb9[_0x3235('0x9e')](),_0x9c72c8)['then'](function(_0x51799c){var _0x1873a7=_[_0x3235('0xb0')](_0x51799c,_0x3235('0xb1'));var _0x45e963=[];_0x237ea6[_0x3235('0x32')](function(_0x222773){_0x45e963[_0x3235('0x34')](updateFaxInteraction(_0x222773,_0x5a09f7,_0x1873a7));});return BPromise[_0x3235('0xb2')](_0x45e963);});});})[_0x3235('0x2a')](function(_0x1d78d4){_0x2af40a[_0x3235('0xb3')]=_0x1d78d4;return _0x2af40a;})[_0x3235('0x2a')](respondWithFilteredResult(_0x4d6129,_0x30a809))[_0x3235('0x35')](handleError(_0x4d6129,null));};exports[_0x3235('0xb4')]=function(_0x29dff6,_0x1b46e3){var _0x37780e={'raw':![],'where':{'id':_0x29dff6[_0x3235('0xb5')]['id']}},_0x46fb4d={};_0x46fb4d[_0x3235('0x41')]=_[_0x3235('0x43')](db[_0x3235('0xa1')][_0x3235('0x3e')]);_0x46fb4d['query']=_[_0x3235('0x43')](_0x29dff6[_0x3235('0x42')]);_0x46fb4d[_0x3235('0x44')]=_[_0x3235('0x45')](_0x46fb4d[_0x3235('0x41')],_0x46fb4d[_0x3235('0x42')]);_0x37780e[_0x3235('0x46')]=_['intersection'](_0x46fb4d['model'],qs['fields'](_0x29dff6['query'][_0x3235('0x47')]));_0x37780e[_0x3235('0x46')]=_0x37780e[_0x3235('0x46')]['length']?_0x37780e['attributes']:_0x46fb4d['model'];if(_0x29dff6[_0x3235('0x42')][_0x3235('0xb6')]){_0x37780e['include']=[{'all':!![]}];}_0x37780e=_[_0x3235('0xa0')]({},_0x37780e,_0x29dff6[_0x3235('0xb7')]);return db['FaxInteraction']['find'](_0x37780e)[_0x3235('0x2a')](handleEntityNotFound(_0x1b46e3,null))[_0x3235('0x2a')](respondWithResult(_0x1b46e3,null))['catch'](handleError(_0x1b46e3,null));};exports['create']=function(_0x280414,_0x26d056){return db[_0x3235('0xa1')][_0x3235('0xb8')](_0x280414[_0x3235('0x76')],{})[_0x3235('0x2a')](respondWithResult(_0x26d056,0xc9))[_0x3235('0x35')](handleError(_0x26d056,null));};exports[_0x3235('0x29')]=function(_0x1b01a3,_0x4fac75){if(_0x1b01a3[_0x3235('0x76')]['id']){delete _0x1b01a3[_0x3235('0x76')]['id'];}return db[_0x3235('0xa1')][_0x3235('0x74')]({'where':{'id':_0x1b01a3[_0x3235('0xb5')]['id']}})[_0x3235('0x2a')](handleEntityNotFound(_0x4fac75,null))[_0x3235('0x2a')](saveUpdates(_0x1b01a3[_0x3235('0x76')],null))[_0x3235('0x2a')](respondWithResult(_0x4fac75,null))['catch'](handleError(_0x4fac75,null));};exports['destroy']=function(_0x44c1db,_0x2da779){return db[_0x3235('0xa1')]['find']({'where':{'id':_0x44c1db[_0x3235('0xb5')]['id']}})[_0x3235('0x2a')](handleEntityNotFound(_0x2da779,null))[_0x3235('0x2a')](removeEntity(_0x2da779,null))['catch'](handleError(_0x2da779,null));};exports[_0x3235('0xb9')]=function(_0xcf565e,_0x3ad8fb){return db[_0x3235('0xa1')]['describe']()['then'](respondWithResult(_0x3ad8fb,null))[_0x3235('0x35')](handleError(_0x3ad8fb,null));};exports[_0x3235('0xba')]=function(_0x19d9eb,_0x3e3b0e,_0xd6553f){return db['FaxMessage'][_0x3235('0x74')]({'where':{'id':_0x19d9eb[_0x3235('0xb5')]['id']}})[_0x3235('0x2a')](handleEntityNotFound(_0x3e3b0e,null))[_0x3235('0x2a')](function(_0x174f7e){if(_0x174f7e){return _0x174f7e[_0x3235('0xba')](_0x19d9eb[_0x3235('0x76')][_0x3235('0xbb')],_[_0x3235('0xbc')](_0x19d9eb[_0x3235('0x76')],[_0x3235('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x3e3b0e,null))[_0x3235('0x35')](handleError(_0x3e3b0e,null));};exports['getMessages']=function(_0x1c492,_0x14c230,_0x40d8e9){var _0x49c757={'raw':![],'where':{}};var _0x516942={};var _0x1160a0={'count':0x0,'rows':[]};return db[_0x3235('0xa1')]['findOne']({'where':{'id':_0x1c492[_0x3235('0xb5')]['id']}})[_0x3235('0x2a')](handleEntityNotFound(_0x14c230,null))[_0x3235('0x2a')](function(_0x10f82b){if(_0x10f82b){_0x516942['model']=_['keys'](db[_0x3235('0xbd')][_0x3235('0x3e')]);_0x516942['query']=_['keys'](_0x1c492['query']);_0x516942['filters']=_[_0x3235('0x45')](_0x516942[_0x3235('0x41')],_0x516942['query']);_0x49c757[_0x3235('0x46')]=_[_0x3235('0x45')](_0x516942[_0x3235('0x41')],qs[_0x3235('0x47')](_0x1c492[_0x3235('0x42')][_0x3235('0x47')]));_0x49c757[_0x3235('0x46')]=_0x49c757[_0x3235('0x46')][_0x3235('0x48')]?_0x49c757[_0x3235('0x46')]:_0x516942[_0x3235('0x41')];if(!_0x1c492[_0x3235('0x42')]['hasOwnProperty'](_0x3235('0x4a'))){_0x49c757[_0x3235('0x25')]=qs['limit'](_0x1c492[_0x3235('0x42')][_0x3235('0x25')]);_0x49c757[_0x3235('0x23')]=qs[_0x3235('0x23')](_0x1c492[_0x3235('0x42')][_0x3235('0x23')]);}_0x49c757[_0x3235('0x4b')]=qs[_0x3235('0x4c')](_0x1c492[_0x3235('0x42')][_0x3235('0x4c')]);_0x49c757[_0x3235('0x7b')]=qs[_0x3235('0x44')](_[_0x3235('0x4d')](_0x1c492[_0x3235('0x42')],_0x516942[_0x3235('0x44')]));_0x49c757[_0x3235('0x7b')][_0x3235('0xb1')]=_0x10f82b['id'];if(_0x1c492[_0x3235('0x42')]['filter']){_0x49c757[_0x3235('0x7b')]=_['merge'](_0x49c757[_0x3235('0x7b')],{'$or':_[_0x3235('0x2e')](_0x49c757[_0x3235('0x46')],function(_0x1b8e69){var _0xb3578d={};_0xb3578d[_0x1b8e69]={'$like':'%'+_0x1c492[_0x3235('0x42')][_0x3235('0xbe')]+'%'};return _0xb3578d;})});}if(_0x1c492[_0x3235('0x42')][_0x3235('0x7f')]){var _0x31efb5=_0x1c492[_0x3235('0x42')]['$gte'][_0x3235('0x31')](',');var _0xe136e3={};_0xe136e3[_0x31efb5[0x0]]={'$gte':moment(_0x31efb5[0x1])['format'](_0x3235('0xbf'))};_0x49c757['where']=_['merge'](_0x49c757[_0x3235('0x7b')],_0xe136e3);}_0x49c757=_['merge']({},_0x49c757,_0x1c492[_0x3235('0xb7')]);return db[_0x3235('0xbd')][_0x3235('0x26')]({'where':_0x49c757[_0x3235('0x7b')]})[_0x3235('0x2a')](function(_0x12cc3e){_0x1160a0[_0x3235('0x26')]=_0x12cc3e;if(_0x1c492[_0x3235('0x42')]['includeAll']){_0x49c757[_0x3235('0xc0')]=[{'all':!![]}];}return db[_0x3235('0xbd')][_0x3235('0xc1')](_0x49c757);})[_0x3235('0x2a')](function(_0x1e1b84){_0x1160a0['rows']=_0x1e1b84;return _0x1160a0;});}})[_0x3235('0x2a')](respondWithFilteredResult(_0x14c230,_0x49c757))[_0x3235('0x35')](handleError(_0x14c230,null));};exports[_0x3235('0xc2')]=function(_0x37e239,_0xf16900,_0x577195){return db['FaxInteraction'][_0x3235('0x74')]({'where':{'id':_0x37e239[_0x3235('0xb5')]['id']}})[_0x3235('0x2a')](handleEntityNotFound(_0xf16900,null))['then'](function(_0x4269ca){if(_0x4269ca){return _0x4269ca['setTags'](_0x37e239[_0x3235('0x76')][_0x3235('0xbb')],_[_0x3235('0xbc')](_0x37e239[_0x3235('0x76')],[_0x3235('0xbb'),'id'])||{})[_0x3235('0xc3')](function(){return db[_0x3235('0x70')][_0x3235('0xc1')]({'attributes':['id',_0x3235('0x2d'),_0x3235('0x50')],'where':{'id':_0x37e239[_0x3235('0x76')][_0x3235('0xbb')]}});})[_0x3235('0x2a')](function(_0x30d2cd){socket[_0x3235('0xc4')]('faxInteractionTags:save',{'id':Number(_0x37e239[_0x3235('0xb5')]['id']),'tags':_0x30d2cd||[]});return{'id':Number(_0x37e239[_0x3235('0xb5')]['id']),'tags':_0x30d2cd||[]};});}})['then'](respondWithResult(_0xf16900,null))[_0x3235('0x35')](handleError(_0xf16900,null));};exports[_0x3235('0xc5')]=function(_0x3ce6bb,_0x56a13d,_0x1b95c9){return db[_0x3235('0xa1')]['find']({'where':{'id':_0x3ce6bb[_0x3235('0xb5')]['id']}})[_0x3235('0x2a')](handleEntityNotFound(_0x56a13d,null))[_0x3235('0x2a')](function(_0x1577be){if(_0x1577be){return _0x1577be[_0x3235('0xc5')](_0x3ce6bb[_0x3235('0x42')][_0x3235('0xbb')]);}})['then'](respondWithStatusCode(_0x56a13d,null))[_0x3235('0x35')](handleError(_0x56a13d,null));};exports[_0x3235('0xc6')]=function(_0x45ea74,_0x372527){var _0x5b8214=moment()[_0x3235('0xc7')]()[_0x3235('0x9e')]();var _0x44910f=path[_0x3235('0xc8')](config[_0x3235('0xc9')],_0x3235('0xca'),_0x3235('0xcb'),_0x3235('0xcc'));var _0x187c3c=path[_0x3235('0xc8')](config['root'],_0x3235('0xca'),_0x3235('0xcb'),_0x3235('0xcd'));var _0x4b4710=path[_0x3235('0xc8')](_0x44910f,_0x5b8214);var _0x1970d8=util['format'](_0x3235('0xce'),_0x45ea74[_0x3235('0xb5')]['id'],_0x5b8214);var _0x149c25=path['join'](_0x44910f,_0x1970d8);var _0x2fbe3d=[];_0x2fbe3d[_0x3235('0x34')]({'model':db[_0x3235('0xcf')],'as':_0x3235('0xcf'),'raw':!![]});var _0x10ec33=[{'model':db[_0x3235('0xbd')],'as':_0x3235('0xd0'),'attributes':['id',_0x3235('0x76'),_0x3235('0x7d')],'include':_0x2fbe3d}];return db[_0x3235('0xa1')]['find']({'where':{'id':_0x45ea74[_0x3235('0xb5')]['id']},'include':_0x10ec33})[_0x3235('0x2a')](handleEntityNotFound(_0x372527,null))[_0x3235('0x2a')](function(_0xf30015){if(_0xf30015&&_0xf30015[_0x3235('0xd0')]){var _0x477aa7=_0xf30015['get']({'plain':!![]});fs[_0x3235('0xd1')](_0x4b4710);for(var _0x8a0149=0x0;_0x8a0149<_0x477aa7[_0x3235('0xd0')][_0x3235('0x48')];_0x8a0149++){var _0x4b0ecc=_0x477aa7[_0x3235('0xd0')][_0x8a0149][_0x3235('0xcf')];if(_0x4b0ecc){var _0x423d38=path['join'](_0x187c3c,_0x4b0ecc['basename']);if(fs[_0x3235('0xd2')](_0x423d38)){fs['createReadStream'](_0x423d38)[_0x3235('0xd3')](fs[_0x3235('0xd4')](path[_0x3235('0xc8')](_0x4b4710,_0x4b0ecc['basename'])));}}}return BPromise[_0x3235('0x96')]()[_0x3235('0x2a')](function(){return new BPromise(function(_0x595e17,_0x3909de){zipdir(_0x4b4710,{'saveTo':_0x149c25},function(_0x4cb767,_0x562251){if(_0x4cb767)return _0x3909de(_0x4cb767);return _0x595e17(_0x562251);});})[_0x3235('0x2a')](function(){return new BPromise(function(_0x49633e,_0x16d4c1){rimraf(_0x4b4710,function(_0x4e5994){if(_0x4e5994)_0x16d4c1(_0x4e5994);return _0x49633e();});});})[_0x3235('0x2a')](function(){return _0x372527['download'](_0x149c25,_0x1970d8,function(_0x132829){if(_0x132829){console[_0x3235('0xd5')](_0x3235('0xd6'),_0x132829);}else{fs['unlinkSync'](_0x149c25);}});});});}else{return _0x372527[_0x3235('0x1f')](0xc8);}})[_0x3235('0x35')](handleError(_0x372527,null));}; \ No newline at end of file +var _0xf4e6=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','Users','fullname','Tags','TagIds','split','forEach','push','catch','waiting','unmanaged','total','closed','UserId','answered','talking','index','FaxInteraction','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','field','color','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','params','filters','options','create','update','describe','addMessage','FaxMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','omit','spread','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x578f89,_0x573aa1){var _0x444b86=function(_0x5c24ae){while(--_0x5c24ae){_0x578f89['push'](_0x578f89['shift']());}};_0x444b86(++_0x573aa1);}(_0xf4e6,0xd5));var _0x6f4e=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0xf4e6[_0x344adc];return _0x4014b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f4e('0x0'));var zipdir=require(_0x6f4e('0x1'));var jsonpatch=require(_0x6f4e('0x2'));var rp=require('request-promise');var moment=require(_0x6f4e('0x3'));var BPromise=require(_0x6f4e('0x4'));var Mustache=require(_0x6f4e('0x5'));var util=require('util');var path=require(_0x6f4e('0x6'));var sox=require(_0x6f4e('0x7'));var csv=require(_0x6f4e('0x8'));var ejs=require(_0x6f4e('0x9'));var fs=require('fs');var fs_extra=require(_0x6f4e('0xa'));var _=require(_0x6f4e('0xb'));var squel=require(_0x6f4e('0xc'));var crypto=require(_0x6f4e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f4e('0x8'));var querystring=require('querystring');var Papa=require(_0x6f4e('0xe'));var Redis=require('ioredis');var authService=require(_0x6f4e('0xf'));var qs=require(_0x6f4e('0x10'));var as=require(_0x6f4e('0x11'));var hardwareService=require(_0x6f4e('0x12'));var logger=require('../../config/logger')(_0x6f4e('0x13'));var utils=require(_0x6f4e('0x14'));var config=require(_0x6f4e('0x15'));var licenseUtil=require(_0x6f4e('0x16'));var db=require('../../mysqldb')['db'];config[_0x6f4e('0x17')]=_[_0x6f4e('0x18')](config['redis'],{'host':_0x6f4e('0x19'),'port':0x18eb});var socket=require(_0x6f4e('0x1a'))(new Redis(config[_0x6f4e('0x17')]));require(_0x6f4e('0x1b'))[_0x6f4e('0x1c')](socket);function respondWithStatusCode(_0x5bdd2a,_0x41ef2a){_0x41ef2a=_0x41ef2a||0xcc;return function(_0x1bf39b){if(_0x1bf39b){return _0x5bdd2a[_0x6f4e('0x1d')](_0x41ef2a);}return _0x5bdd2a[_0x6f4e('0x1e')](_0x41ef2a)['end']();};}function respondWithResult(_0x34a853,_0x1f05ff){_0x1f05ff=_0x1f05ff||0xc8;return function(_0x5b6da1){if(_0x5b6da1){return _0x34a853[_0x6f4e('0x1e')](_0x1f05ff)[_0x6f4e('0x1f')](_0x5b6da1);}};}function respondWithFilteredResult(_0x39a812,_0x38b8fc){return function(_0x52dc9c){if(_0x52dc9c){var _0x1e0624=typeof _0x38b8fc[_0x6f4e('0x20')]===_0x6f4e('0x21')&&typeof _0x38b8fc[_0x6f4e('0x22')]===_0x6f4e('0x21');var _0x36e5c0=_0x52dc9c[_0x6f4e('0x23')];var _0x58479b=_0x1e0624?0x0:_0x38b8fc['offset'];var _0x21a8f5=_0x1e0624?_0x52dc9c[_0x6f4e('0x23')]:_0x38b8fc['offset']+_0x38b8fc[_0x6f4e('0x22')];var _0x4c7b02;if(_0x21a8f5>=_0x36e5c0){_0x21a8f5=_0x36e5c0;_0x4c7b02=0xc8;}else{_0x4c7b02=0xce;}_0x39a812[_0x6f4e('0x1e')](_0x4c7b02);return _0x39a812[_0x6f4e('0x24')]('Content-Range',_0x58479b+'-'+_0x21a8f5+'/'+_0x36e5c0)['json'](_0x52dc9c);}return null;};}function patchUpdates(_0x479ce6){return function(_0x47ed29){try{jsonpatch[_0x6f4e('0x25')](_0x47ed29,_0x479ce6,!![]);}catch(_0xb0f17c){return BPromise[_0x6f4e('0x26')](_0xb0f17c);}return _0x47ed29[_0x6f4e('0x27')]();};}function saveUpdates(_0x94ee18,_0x3ac970){return function(_0x535f2f){if(_0x535f2f){return _0x535f2f['update'](_0x94ee18)[_0x6f4e('0x28')](function(_0x406a67){return _0x406a67;});}return null;};}function removeEntity(_0x49e1a8,_0x1f12f6){return function(_0xa1a447){if(_0xa1a447){return _0xa1a447[_0x6f4e('0x29')]()['then'](function(){_0x49e1a8[_0x6f4e('0x1e')](0xcc)[_0x6f4e('0x2a')]();});}};}function handleEntityNotFound(_0x1650be,_0x5ec84a){return function(_0x8459a4){if(!_0x8459a4){_0x1650be[_0x6f4e('0x1d')](0x194);}return _0x8459a4;};}function handleError(_0x2bbd5c,_0x3346f5){_0x3346f5=_0x3346f5||0x1f4;return function(_0x27e886){logger[_0x6f4e('0x2b')](_0x27e886[_0x6f4e('0x2c')]);if(_0x27e886['name']){delete _0x27e886[_0x6f4e('0x2d')];}_0x2bbd5c[_0x6f4e('0x1e')](_0x3346f5)[_0x6f4e('0x2e')](_0x27e886);};}function getInteractionUsers(_0xdfbf99,_0x3062a9){return new BPromise(function(_0x499ac4,_0x41e1fe){try{if(_0x3062a9[_0xdfbf99['id']]){_0xdfbf99[_0x6f4e('0x2f')]=_['map'](_0x3062a9[_0xdfbf99['id']],function(_0xed3f18){return{'id':_0xed3f18['id'],'fullname':_0xed3f18[_0x6f4e('0x30')]};});}}catch(_0x364086){_0x41e1fe(_0x364086);}_0x499ac4(_0xdfbf99);});}function getInteractionTags(_0xad56e8,_0x1b4b9a){return new BPromise(function(_0x2a0a10,_0x1abd59){try{if(_0xad56e8['TagIds']){_0xad56e8[_0x6f4e('0x31')]=[];_0xad56e8[_0x6f4e('0x32')][_0x6f4e('0x33')](',')[_0x6f4e('0x34')](function(_0x5b9f61){_0xad56e8[_0x6f4e('0x31')][_0x6f4e('0x35')](_0x1b4b9a[_0x5b9f61]);});}delete _0xad56e8[_0x6f4e('0x32')];}catch(_0x18218b){_0x1abd59(_0x18218b);}_0x2a0a10(_0xad56e8);});}function updateFaxInteraction(_0x59d461,_0x5887af,_0x48888a){return new BPromise(function(_0x162e25,_0x55757b){return getInteractionUsers(_0x59d461,_0x48888a)[_0x6f4e('0x28')](function(_0x30bd83){return getInteractionTags(_0x30bd83,_0x5887af);})['then'](function(_0x11e9bb){return getStateInteraction(_0x11e9bb);})['then'](function(_0x1d5095){_0x162e25(_0x1d5095);})[_0x6f4e('0x36')](function(_0x5db1a8){_0x55757b(_0x5db1a8);});});}function getStateInteraction(_0x52e9b9){return new BPromise(function(_0x19b1f2){_0x52e9b9[_0x6f4e('0x37')]=0x0;_0x52e9b9['talking']=0x0;_0x52e9b9['answered']=0x0;_0x52e9b9[_0x6f4e('0x38')]=0x0;_0x52e9b9[_0x6f4e('0x39')]=0x0;if(!_0x52e9b9[_0x6f4e('0x3a')]&&!_0x52e9b9[_0x6f4e('0x3b')]){_0x52e9b9[_0x6f4e('0x37')]+=0x1;}if(!_0x52e9b9['closed']&&_0x52e9b9[_0x6f4e('0x3b')]){_0x52e9b9['talking']+=0x1;if(_0x52e9b9[_0x6f4e('0x37')]){_0x52e9b9[_0x6f4e('0x37')]-=0x1;}}if(_0x52e9b9[_0x6f4e('0x3a')]&&_0x52e9b9[_0x6f4e('0x3b')]){_0x52e9b9[_0x6f4e('0x3c')]+=0x1;if(_0x52e9b9[_0x6f4e('0x3d')]){_0x52e9b9[_0x6f4e('0x3d')]-=0x1;}}if(_0x52e9b9[_0x6f4e('0x3a')]&&!_0x52e9b9[_0x6f4e('0x3b')]){_0x52e9b9['unmanaged']+=0x1;if(_0x52e9b9[_0x6f4e('0x37')]){_0x52e9b9[_0x6f4e('0x37')]-=0x1;}}_0x52e9b9[_0x6f4e('0x39')]+=0x1;_0x19b1f2(_0x52e9b9);});}exports[_0x6f4e('0x3e')]=function(_0x1809a0,_0x542569){var _0x26e3b5={},_0x135840={},_0x253c6b={'count':0x0,'rows':[]};var _0x23b15b=_['map'](db[_0x6f4e('0x3f')][_0x6f4e('0x40')],function(_0x4784b5){return{'name':_0x4784b5[_0x6f4e('0x41')],'type':_0x4784b5[_0x6f4e('0x42')][_0x6f4e('0x43')]};});_0x135840['model']=_[_0x6f4e('0x44')](_0x23b15b,'name');_0x135840[_0x6f4e('0x45')]=_[_0x6f4e('0x46')](_0x1809a0[_0x6f4e('0x45')]);_0x135840['filters']=_['intersection'](_0x135840[_0x6f4e('0x47')],_0x135840[_0x6f4e('0x45')]);_0x26e3b5[_0x6f4e('0x48')]=_[_0x6f4e('0x49')](_0x135840[_0x6f4e('0x47')],qs[_0x6f4e('0x4a')](_0x1809a0['query'][_0x6f4e('0x4a')]));_0x26e3b5[_0x6f4e('0x48')]=_0x26e3b5[_0x6f4e('0x48')]['length']?_0x26e3b5[_0x6f4e('0x48')]:_0x135840[_0x6f4e('0x47')];if(!_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x4b')](_0x6f4e('0x4c'))){_0x26e3b5[_0x6f4e('0x22')]=qs['limit'](_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x22')]);_0x26e3b5[_0x6f4e('0x20')]=qs[_0x6f4e('0x20')](_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x20')]);}_0x26e3b5['order']=qs['sort'](_0x1809a0['query'][_0x6f4e('0x4d')]);_0x26e3b5[_0x6f4e('0x4e')]=qs['filters'](_[_0x6f4e('0x4f')](_0x1809a0[_0x6f4e('0x45')],_0x135840['filters']),_0x23b15b);var _0x3dd244=[];var _0x3f8a93=squel['select']()[_0x6f4e('0x50')]('id')['field'](_0x6f4e('0x2d'))[_0x6f4e('0x50')](_0x6f4e('0x51'))['from']('tools_tags');var _0x5bce70=squel['select']()[_0x6f4e('0x50')](_0x6f4e('0x52'))[_0x6f4e('0x50')](_0x6f4e('0x53'))[_0x6f4e('0x50')](_0x6f4e('0x54'))[_0x6f4e('0x55')](_0x6f4e('0x56'),'ui')[_0x6f4e('0x57')](_0x6f4e('0x58'),'u',_0x6f4e('0x59'));var _0x115690=squel[_0x6f4e('0x5a')]()[_0x6f4e('0x55')](_0x6f4e('0x5b'),'i')[_0x6f4e('0x57')](_0x6f4e('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x6f4e('0x58'),'o',_0x6f4e('0x5d'))[_0x6f4e('0x57')](_0x6f4e('0x5e'),'a',_0x6f4e('0x5f'))[_0x6f4e('0x57')](_0x6f4e('0x60'),'me',_0x6f4e('0x61'))[_0x6f4e('0x57')](_0x6f4e('0x62'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x6f4e('0x57')](_0x6f4e('0x63'),'t',_0x6f4e('0x64'));var _0x113224=squel['expr']();var _0x22cffb=[];var _0xd4fa56=squel['expr']();var _0x52a7b6;if(_0x1809a0[_0x6f4e('0x45')]['search']){_0x52a7b6=as[_0x6f4e('0x65')](_0x1809a0['query']['search']);var _0x3f3f5d=_0x52a7b6[_0x6f4e('0x66')];for(var _0x123fc2=0x0;_0x123fc2<_0x52a7b6[_0x6f4e('0x67')][_0x6f4e('0x68')];_0x123fc2++){var _0x156016=_0x52a7b6['conditions'][_0x123fc2];var _0x22ac7b='i';var _0x1baa14=_[_0x6f4e('0x69')](_0x23b15b,[_0x6f4e('0x2d'),_0x156016['field']]);if(!_0x1baa14){switch(_0x156016['field']){case _0x6f4e('0x6a'):if(_0x156016[_0x6f4e('0x6b')]==0x1){_0x115690[_0x6f4e('0x6c')]('`'+_0x156016[_0x6f4e('0x50')]+_0x6f4e('0x6d'));}else{_0x115690[_0x6f4e('0x6c')]('`'+_0x156016[_0x6f4e('0x50')]+'`\x20>\x200');}break;case _0x6f4e('0x6e'):if(_0x156016[_0x6f4e('0x6f')]===_0x6f4e('0x70')){if(_0x156016[_0x6f4e('0x6b')][_0x6f4e('0x33')]('\x20')[_0x6f4e('0x68')]>0x1){_0x113224[_0x3f3f5d](_0x6f4e('0x71'),qs[_0x6f4e('0x72')](_0x156016['value']),null);}else{var _0x5875da='%'+_0x156016['value']+'%';_0x113224[_0x3f3f5d](_0x6f4e('0x73'),_0x5875da,_0x5875da,_0x5875da);}}else{_0x1baa14=_[_0x6f4e('0x69')](_0x23b15b,['name','ContactId']);_0x156016['field']=_0x6f4e('0x74');_0xf893e7=as[_0x6f4e('0x75')](_0x22ac7b,_0x1baa14[_0x6f4e('0x42')],_0x156016);_0x113224[_0x3f3f5d](_0xf893e7[_0x6f4e('0x76')],_0xf893e7[_0x6f4e('0x6b')][_0x6f4e('0x77')],_0xf893e7[_0x6f4e('0x6b')][_0x6f4e('0x2a')]);}break;case _0x6f4e('0x78'):var _0x35c013=_0x156016[_0x6f4e('0x6b')][_0x6f4e('0x33')](',')['map'](function(_0x49e183){return Number(_0x49e183);});_0x35c013['forEach'](function(_0x36f477){_0xd4fa56['or'](_0x6f4e('0x79'),'%,'+_0x36f477+',%');});_0x22cffb=_['union'](_0x22cffb,_0x35c013);break;case'User':if(_0x156016[_0x6f4e('0x6f')]===_0x6f4e('0x70')){_0x113224[_0x3f3f5d](_0x6f4e('0x7a'),'%'+_0x156016['value']+'%',null);}else{_0x1baa14=_[_0x6f4e('0x69')](_0x23b15b,[_0x6f4e('0x2d'),_0x6f4e('0x3b')]);_0x156016[_0x6f4e('0x50')]=_0x6f4e('0x3b');_0xf893e7=as[_0x6f4e('0x75')](_0x22ac7b,_0x1baa14['type'],_0x156016);_0x113224[_0x3f3f5d](_0xf893e7[_0x6f4e('0x76')],_0xf893e7[_0x6f4e('0x6b')][_0x6f4e('0x77')],_0xf893e7['value'][_0x6f4e('0x2a')]);}break;case _0x6f4e('0x7b'):_0xf893e7=as[_0x6f4e('0x75')]('me',null,_0x156016);_0x113224[_0x3f3f5d](_0xf893e7[_0x6f4e('0x76')],_0xf893e7[_0x6f4e('0x6b')][_0x6f4e('0x77')],_0xf893e7[_0x6f4e('0x6b')][_0x6f4e('0x2a')]);break;}}else{var _0xf893e7=as['buildExpression'](_0x22ac7b,_0x1baa14['type'],_0x156016);_0x113224[_0x3f3f5d](_0xf893e7[_0x6f4e('0x76')],_0xf893e7[_0x6f4e('0x6b')][_0x6f4e('0x77')],_0xf893e7[_0x6f4e('0x6b')][_0x6f4e('0x2a')]);}}}else{var _0x131b99=_(_0x1809a0[_0x6f4e('0x45')])[_0x6f4e('0x46')]()[_0x6f4e('0x44')](function(_0x245cc9){return _['some'](_0x23b15b,[_0x6f4e('0x2d'),_0x245cc9])?_0x245cc9:undefined;})['compact']()[_0x6f4e('0x6b')]();if(!_[_0x6f4e('0x7c')](_0x131b99)){_0x131b99[_0x6f4e('0x34')](function(_0x5881af){if(_0x5881af==='FaxAccountId'){_0x115690['where'](_0x6f4e('0x7d'),[][_0x6f4e('0x7e')](_0x1809a0[_0x6f4e('0x45')][_0x5881af]));}else if(_0x5881af===_0x6f4e('0x7f')){var _0x447757=JSON['parse'](_0x1809a0[_0x6f4e('0x45')][_0x5881af])[_0x6f4e('0x80')];var _0x1962e6=JSON[_0x6f4e('0x81')](_0x1809a0['query'][_0x5881af])[_0x6f4e('0x82')];_0x115690['where'](_0x6f4e('0x83'),_0x447757,_0x1962e6);}else{if(_0x1809a0[_0x6f4e('0x45')][_0x5881af]==='null'){_0x115690[_0x6f4e('0x4e')]('i.'+_0x5881af+_0x6f4e('0x84'));}else{_0x115690[_0x6f4e('0x4e')]('i.'+_0x5881af+'\x20=\x20?',_0x1809a0[_0x6f4e('0x45')][_0x5881af]);}}});}if(_0x1809a0[_0x6f4e('0x45')]['read']){if(_0x1809a0['query'][_0x6f4e('0x85')]==0x1){_0x115690['having']('`unreadMessages`\x20=\x200');}else{_0x115690[_0x6f4e('0x6c')](_0x6f4e('0x86'));}}if(_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x87')]){_0x22cffb=_[_0x6f4e('0x88')](_0x1809a0['query'][_0x6f4e('0x87')])?_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x87')]:new Array(_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x87')]);_0x22cffb['forEach'](function(_0x1e7972){_0xd4fa56['or'](_0x6f4e('0x79'),'%,'+_0x1e7972+',%');});}if(_0x1809a0[_0x6f4e('0x45')]['filter']){var _0x59bbc0=_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x89')][_0x6f4e('0x8a')]('\x5c','\x5c\x5c')[_0x6f4e('0x8a')](/'/g,'\x27\x27');if(qs[_0x6f4e('0x8b')](_0x59bbc0)){_0x113224['or'](_0x6f4e('0x8c'),_0x59bbc0+'%')['or'](_0x6f4e('0x8d'),_0x59bbc0+'%');}_0x113224['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x59bbc0+'%');}}_0x115690[_0x6f4e('0x4e')](_0x113224);_0x115690[_0x6f4e('0x8e')]('i.id');var _0x2736f9={'type':db[_0x6f4e('0x8f')][_0x6f4e('0x90')][_0x6f4e('0x91')],'raw':!![]};var _0xf469a1=_0x115690[_0x6f4e('0x92')]();_0xf469a1[_0x6f4e('0x50')]('i.id');_0xf469a1[_0x6f4e('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6f4e('0x6a'));if(_0x26e3b5[_0x6f4e('0x93')]){_0x26e3b5[_0x6f4e('0x93')][_0x6f4e('0x34')](function(_0x51b91a){var _0x1304fa=_0x51b91a[0x0]===_0x6f4e('0x94')?_0x51b91a[0x0]:'i.'+_0x51b91a[0x0];_0x115690[_0x6f4e('0x93')](_0x1304fa,_0x51b91a[0x1]===_0x6f4e('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x22cffb)){_0x115690['having'](_0xd4fa56);_0xf469a1['where'](_0x6f4e('0x96'),_0x22cffb);}BPromise[_0x6f4e('0x97')]()[_0x6f4e('0x28')](function(){if(!_0x52a7b6){if(_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x98')])return;_0xf469a1[_0x6f4e('0x4e')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x115690[_0x6f4e('0x4e')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1809a0[_0x6f4e('0x99')][_0x6f4e('0x9a')]!=='agent')return;return _0x1809a0['user'][_0x6f4e('0x9b')]({'attributes':['id'],'raw':!![]})[_0x6f4e('0x28')](function(_0x56f774){if(_[_0x6f4e('0x7c')](_0x56f774)){_0xf469a1[_0x6f4e('0x4e')](_0x6f4e('0x9c'));_0x115690['where'](_0x6f4e('0x9c'));}else{_0xf469a1['where']('i.FaxAccountId\x20IN\x20?',_[_0x6f4e('0x44')](_0x56f774,'id'));_0x115690[_0x6f4e('0x4e')](_0x6f4e('0x7d'),_[_0x6f4e('0x44')](_0x56f774,'id'));}});})[_0x6f4e('0x28')](function(){if(_0x1809a0['user'][_0x6f4e('0x9a')]===_0x6f4e('0x9d')&&!_0x52a7b6&&!_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x98')])return[];return db['sequelize'][_0x6f4e('0x45')](_0xf469a1[_0x6f4e('0x9e')](),_0x2736f9);})[_0x6f4e('0x28')](function(_0x1f54ee){_0x253c6b[_0x6f4e('0x23')]=_0x1f54ee[_0x6f4e('0x68')];if(_0x253c6b[_0x6f4e('0x23')]===0x0)return[];return db['sequelize'][_0x6f4e('0x45')](_0x3f8a93['toString'](),_0x2736f9)[_0x6f4e('0x28')](function(_0x449d81){_0x3dd244=_['keyBy'](_0x449d81,'id');_0x2736f9=_[_0x6f4e('0x9f')](_0x2736f9,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1809a0[_0x6f4e('0x45')][_0x6f4e('0x4a')]){_0x26e3b5[_0x6f4e('0x48')][_0x6f4e('0x34')](function(_0x5283f8){_0x115690[_0x6f4e('0x50')]('i.'+_0x5283f8);});}else{_0x115690[_0x6f4e('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6f4e('0x6a'));_0x115690[_0x6f4e('0x50')](_0x6f4e('0xa0'),'Account.key');_0x115690['field'](_0x6f4e('0xa1'),_0x6f4e('0xa2'));_0x115690[_0x6f4e('0x50')](_0x6f4e('0xa3'),'contactName');_0x115690[_0x6f4e('0x50')](_0x6f4e('0xa4'));_0x115690[_0x6f4e('0x50')](_0x6f4e('0xa5'),_0x6f4e('0xa6'));_0x115690['field'](_0x6f4e('0xa7'),_0x6f4e('0xa8'));_0x115690[_0x6f4e('0x50')](_0x6f4e('0xa9'),_0x6f4e('0xaa'));_0x115690[_0x6f4e('0x50')](_0x6f4e('0xab'),_0x6f4e('0xac'));_0x115690['field'](_0x6f4e('0xad'),_0x6f4e('0xae'));_0x115690[_0x6f4e('0x50')]('c.fax',_0x6f4e('0xaf'));_0x115690[_0x6f4e('0x50')](_0x6f4e('0xb0'),'Owner.fullname');_0x115690[_0x6f4e('0x50')]('o.internal','Owner.internal');_0x115690[_0x6f4e('0x50')](_0x6f4e('0xb1'),_0x6f4e('0x32'));}if(_0x26e3b5[_0x6f4e('0x22')])_0x115690[_0x6f4e('0x22')](_0x26e3b5['limit']);if(_0x26e3b5[_0x6f4e('0x20')])_0x115690[_0x6f4e('0x20')](_0x26e3b5[_0x6f4e('0x20')]);return db[_0x6f4e('0xb2')]['query'](_0x115690[_0x6f4e('0x9e')](),_0x2736f9);})['then'](function(_0x116ac6){if(_0x116ac6[_0x6f4e('0x68')]>0x0)_0x5bce70[_0x6f4e('0x4e')](_0x6f4e('0xb3'),_['map'](_0x116ac6,'id'));return db[_0x6f4e('0xb2')][_0x6f4e('0x45')](_0x5bce70[_0x6f4e('0x9e')](),_0x2736f9)[_0x6f4e('0x28')](function(_0x4b9d78){var _0x3a8cec=_['groupBy'](_0x4b9d78,_0x6f4e('0xb4'));var _0xf66bb6=[];_0x116ac6[_0x6f4e('0x34')](function(_0x3b0fc9){_0xf66bb6[_0x6f4e('0x35')](updateFaxInteraction(_0x3b0fc9,_0x3dd244,_0x3a8cec));});return BPromise['all'](_0xf66bb6);});});})[_0x6f4e('0x28')](function(_0x295b75){_0x253c6b[_0x6f4e('0xb5')]=_0x295b75;return _0x253c6b;})[_0x6f4e('0x28')](respondWithFilteredResult(_0x542569,_0x26e3b5))[_0x6f4e('0x36')](handleError(_0x542569,null));};exports['show']=function(_0x1323c9,_0x463d04){var _0x20492d={'raw':![],'where':{'id':_0x1323c9[_0x6f4e('0xb6')]['id']}},_0x2140a1={};_0x2140a1[_0x6f4e('0x47')]=_['keys'](db[_0x6f4e('0x3f')][_0x6f4e('0x40')]);_0x2140a1[_0x6f4e('0x45')]=_[_0x6f4e('0x46')](_0x1323c9[_0x6f4e('0x45')]);_0x2140a1[_0x6f4e('0xb7')]=_[_0x6f4e('0x49')](_0x2140a1[_0x6f4e('0x47')],_0x2140a1[_0x6f4e('0x45')]);_0x20492d[_0x6f4e('0x48')]=_[_0x6f4e('0x49')](_0x2140a1[_0x6f4e('0x47')],qs['fields'](_0x1323c9[_0x6f4e('0x45')]['fields']));_0x20492d['attributes']=_0x20492d[_0x6f4e('0x48')][_0x6f4e('0x68')]?_0x20492d['attributes']:_0x2140a1['model'];if(_0x1323c9[_0x6f4e('0x45')]['includeAll']){_0x20492d['include']=[{'all':!![]}];}_0x20492d=_[_0x6f4e('0x9f')]({},_0x20492d,_0x1323c9[_0x6f4e('0xb8')]);return db[_0x6f4e('0x3f')][_0x6f4e('0x69')](_0x20492d)[_0x6f4e('0x28')](handleEntityNotFound(_0x463d04,null))[_0x6f4e('0x28')](respondWithResult(_0x463d04,null))['catch'](handleError(_0x463d04,null));};exports[_0x6f4e('0xb9')]=function(_0x253090,_0x2355a1){return db[_0x6f4e('0x3f')][_0x6f4e('0xb9')](_0x253090[_0x6f4e('0x7b')],{})[_0x6f4e('0x28')](respondWithResult(_0x2355a1,0xc9))[_0x6f4e('0x36')](handleError(_0x2355a1,null));};exports[_0x6f4e('0xba')]=function(_0x325cd7,_0x28297a){if(_0x325cd7[_0x6f4e('0x7b')]['id']){delete _0x325cd7[_0x6f4e('0x7b')]['id'];}return db[_0x6f4e('0x3f')][_0x6f4e('0x69')]({'where':{'id':_0x325cd7[_0x6f4e('0xb6')]['id']}})[_0x6f4e('0x28')](handleEntityNotFound(_0x28297a,null))['then'](saveUpdates(_0x325cd7[_0x6f4e('0x7b')],null))[_0x6f4e('0x28')](respondWithResult(_0x28297a,null))['catch'](handleError(_0x28297a,null));};exports[_0x6f4e('0x29')]=function(_0x858b2c,_0x37e691){return db[_0x6f4e('0x3f')][_0x6f4e('0x69')]({'where':{'id':_0x858b2c[_0x6f4e('0xb6')]['id']}})[_0x6f4e('0x28')](handleEntityNotFound(_0x37e691,null))[_0x6f4e('0x28')](removeEntity(_0x37e691,null))['catch'](handleError(_0x37e691,null));};exports[_0x6f4e('0xbb')]=function(_0x3038b3,_0xd6b3ac){return db[_0x6f4e('0x3f')][_0x6f4e('0xbb')]()['then'](respondWithResult(_0xd6b3ac,null))['catch'](handleError(_0xd6b3ac,null));};exports[_0x6f4e('0xbc')]=function(_0x976ac9,_0x3aa5b5,_0x46cc9f){return db[_0x6f4e('0xbd')][_0x6f4e('0x69')]({'where':{'id':_0x976ac9['params']['id']}})[_0x6f4e('0x28')](handleEntityNotFound(_0x3aa5b5,null))[_0x6f4e('0x28')](function(_0x2e65f9){if(_0x2e65f9){return _0x2e65f9[_0x6f4e('0xbc')](_0x976ac9['body'][_0x6f4e('0xbe')],_['omit'](_0x976ac9[_0x6f4e('0x7b')],[_0x6f4e('0xbe'),'id'])||{});}})[_0x6f4e('0x28')](respondWithResult(_0x3aa5b5,null))[_0x6f4e('0x36')](handleError(_0x3aa5b5,null));};exports[_0x6f4e('0xbf')]=function(_0x89f834,_0x4c04cf,_0x10b5c1){var _0xf6223b={'raw':![],'where':{}};var _0x158ae0={};var _0x4bed6a={'count':0x0,'rows':[]};return db[_0x6f4e('0x3f')]['findOne']({'where':{'id':_0x89f834['params']['id']}})[_0x6f4e('0x28')](handleEntityNotFound(_0x4c04cf,null))[_0x6f4e('0x28')](function(_0x523704){if(_0x523704){_0x158ae0[_0x6f4e('0x47')]=_['keys'](db[_0x6f4e('0xbd')][_0x6f4e('0x40')]);_0x158ae0[_0x6f4e('0x45')]=_['keys'](_0x89f834[_0x6f4e('0x45')]);_0x158ae0[_0x6f4e('0xb7')]=_[_0x6f4e('0x49')](_0x158ae0['model'],_0x158ae0[_0x6f4e('0x45')]);_0xf6223b[_0x6f4e('0x48')]=_[_0x6f4e('0x49')](_0x158ae0['model'],qs[_0x6f4e('0x4a')](_0x89f834['query'][_0x6f4e('0x4a')]));_0xf6223b[_0x6f4e('0x48')]=_0xf6223b[_0x6f4e('0x48')]['length']?_0xf6223b['attributes']:_0x158ae0[_0x6f4e('0x47')];if(!_0x89f834[_0x6f4e('0x45')][_0x6f4e('0x4b')](_0x6f4e('0x4c'))){_0xf6223b[_0x6f4e('0x22')]=qs[_0x6f4e('0x22')](_0x89f834[_0x6f4e('0x45')]['limit']);_0xf6223b[_0x6f4e('0x20')]=qs[_0x6f4e('0x20')](_0x89f834[_0x6f4e('0x45')]['offset']);}_0xf6223b['order']=qs[_0x6f4e('0x4d')](_0x89f834[_0x6f4e('0x45')][_0x6f4e('0x4d')]);_0xf6223b[_0x6f4e('0x4e')]=qs[_0x6f4e('0xb7')](_['pick'](_0x89f834[_0x6f4e('0x45')],_0x158ae0[_0x6f4e('0xb7')]));_0xf6223b[_0x6f4e('0x4e')][_0x6f4e('0xb4')]=_0x523704['id'];if(_0x89f834[_0x6f4e('0x45')][_0x6f4e('0x89')]){_0xf6223b[_0x6f4e('0x4e')]=_[_0x6f4e('0x9f')](_0xf6223b['where'],{'$or':_[_0x6f4e('0x44')](_0xf6223b[_0x6f4e('0x48')],function(_0x17c178){var _0x40e306={};_0x40e306[_0x17c178]={'$like':'%'+_0x89f834['query'][_0x6f4e('0x89')]+'%'};return _0x40e306;})});}if(_0x89f834['query'][_0x6f4e('0x80')]){var _0x109aa2=_0x89f834['query'][_0x6f4e('0x80')]['split'](',');var _0x4aecb8={};_0x4aecb8[_0x109aa2[0x0]]={'$gte':moment(_0x109aa2[0x1])[_0x6f4e('0xc0')](_0x6f4e('0xc1'))};_0xf6223b['where']=_[_0x6f4e('0x9f')](_0xf6223b[_0x6f4e('0x4e')],_0x4aecb8);}_0xf6223b=_[_0x6f4e('0x9f')]({},_0xf6223b,_0x89f834[_0x6f4e('0xb8')]);return db['FaxMessage'][_0x6f4e('0x23')]({'where':_0xf6223b[_0x6f4e('0x4e')]})[_0x6f4e('0x28')](function(_0x54774d){_0x4bed6a[_0x6f4e('0x23')]=_0x54774d;if(_0x89f834['query']['includeAll']){_0xf6223b[_0x6f4e('0xc2')]=[{'all':!![]}];}return db[_0x6f4e('0xbd')][_0x6f4e('0xc3')](_0xf6223b);})[_0x6f4e('0x28')](function(_0x14e5dd){_0x4bed6a[_0x6f4e('0xb5')]=_0x14e5dd;return _0x4bed6a;});}})[_0x6f4e('0x28')](respondWithFilteredResult(_0x4c04cf,_0xf6223b))[_0x6f4e('0x36')](handleError(_0x4c04cf,null));};exports['addTags']=function(_0x5c30e1,_0x4e60c1,_0x3c404b){return db['FaxInteraction'][_0x6f4e('0x69')]({'where':{'id':_0x5c30e1[_0x6f4e('0xb6')]['id']}})[_0x6f4e('0x28')](handleEntityNotFound(_0x4e60c1,null))[_0x6f4e('0x28')](function(_0x285d22){if(_0x285d22){return _0x285d22['setTags'](_0x5c30e1[_0x6f4e('0x7b')]['ids'],_[_0x6f4e('0xc4')](_0x5c30e1[_0x6f4e('0x7b')],[_0x6f4e('0xbe'),'id'])||{})[_0x6f4e('0xc5')](function(){return db[_0x6f4e('0x78')][_0x6f4e('0xc3')]({'attributes':['id',_0x6f4e('0x2d'),_0x6f4e('0x51')],'where':{'id':_0x5c30e1[_0x6f4e('0x7b')][_0x6f4e('0xbe')]}});})[_0x6f4e('0x28')](function(_0x562b8a){socket[_0x6f4e('0xc6')](_0x6f4e('0xc7'),{'id':Number(_0x5c30e1[_0x6f4e('0xb6')]['id']),'tags':_0x562b8a||[]});return{'id':Number(_0x5c30e1['params']['id']),'tags':_0x562b8a||[]};});}})[_0x6f4e('0x28')](respondWithResult(_0x4e60c1,null))[_0x6f4e('0x36')](handleError(_0x4e60c1,null));};exports[_0x6f4e('0xc8')]=function(_0x361512,_0x20929c,_0x3c4d6d){return db[_0x6f4e('0x3f')][_0x6f4e('0x69')]({'where':{'id':_0x361512['params']['id']}})[_0x6f4e('0x28')](handleEntityNotFound(_0x20929c,null))[_0x6f4e('0x28')](function(_0x178dc5){if(_0x178dc5){return _0x178dc5[_0x6f4e('0xc8')](_0x361512[_0x6f4e('0x45')][_0x6f4e('0xbe')]);}})[_0x6f4e('0x28')](respondWithStatusCode(_0x20929c,null))[_0x6f4e('0x36')](handleError(_0x20929c,null));};exports['download']=function(_0xf8ed7c,_0xff95c1){var _0x517943=moment()[_0x6f4e('0xc9')]()[_0x6f4e('0x9e')]();var _0x419f49=path[_0x6f4e('0xca')](config[_0x6f4e('0xcb')],'server','files','tmp');var _0xe5904f=path[_0x6f4e('0xca')](config['root'],_0x6f4e('0xcc'),_0x6f4e('0xcd'),_0x6f4e('0xce'));var _0x52d83c=path[_0x6f4e('0xca')](_0x419f49,_0x517943);var _0x191280=util[_0x6f4e('0xc0')](_0x6f4e('0xcf'),_0xf8ed7c[_0x6f4e('0xb6')]['id'],_0x517943);var _0x211ddb=path[_0x6f4e('0xca')](_0x419f49,_0x191280);var _0x58e9cb=[];_0x58e9cb['push']({'model':db['Attachment'],'as':_0x6f4e('0xd0'),'raw':!![]});var _0x24f053=[{'model':db[_0x6f4e('0xbd')],'as':'Messages','attributes':['id','body',_0x6f4e('0x7f')],'include':_0x58e9cb}];return db[_0x6f4e('0x3f')]['find']({'where':{'id':_0xf8ed7c[_0x6f4e('0xb6')]['id']},'include':_0x24f053})['then'](handleEntityNotFound(_0xff95c1,null))['then'](function(_0x417155){if(_0x417155&&_0x417155[_0x6f4e('0xd1')]){var _0x1df3b5=_0x417155[_0x6f4e('0xd2')]({'plain':!![]});fs[_0x6f4e('0xd3')](_0x52d83c);for(var _0x926ba4=0x0;_0x926ba4<_0x1df3b5[_0x6f4e('0xd1')]['length'];_0x926ba4++){var _0x16a8e9=_0x1df3b5[_0x6f4e('0xd1')][_0x926ba4]['Attachment'];if(_0x16a8e9){var _0x408699=path[_0x6f4e('0xca')](_0xe5904f,_0x16a8e9['basename']);if(fs[_0x6f4e('0xd4')](_0x408699)){fs[_0x6f4e('0xd5')](_0x408699)[_0x6f4e('0xd6')](fs[_0x6f4e('0xd7')](path[_0x6f4e('0xca')](_0x52d83c,_0x16a8e9[_0x6f4e('0xd8')])));}}}return BPromise[_0x6f4e('0x97')]()[_0x6f4e('0x28')](function(){return new BPromise(function(_0x2287f2,_0x5eea33){zipdir(_0x52d83c,{'saveTo':_0x211ddb},function(_0x4a8c8f,_0xcd1e20){if(_0x4a8c8f)return _0x5eea33(_0x4a8c8f);return _0x2287f2(_0xcd1e20);});})['then'](function(){return new BPromise(function(_0x52520a,_0x5d4d3d){rimraf(_0x52d83c,function(_0x1f26ef){if(_0x1f26ef)_0x5d4d3d(_0x1f26ef);return _0x52520a();});});})[_0x6f4e('0x28')](function(){return _0xff95c1['download'](_0x211ddb,_0x191280,function(_0x9e474f){if(_0x9e474f){console[_0x6f4e('0xd9')](_0x6f4e('0xda'),_0x9e474f);}else{fs[_0x6f4e('0xdb')](_0x211ddb);}});});});}else{return _0xff95c1[_0x6f4e('0x1d')](0xc8);}})[_0x6f4e('0x36')](handleError(_0xff95c1,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 269b7c6..1a146bb 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 _0x264c=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','then','setDataValue','Users'];(function(_0x19b96d,_0x523704){var _0x1368ad=function(_0x4b6697){while(--_0x4b6697){_0x19b96d['push'](_0x19b96d['shift']());}};_0x1368ad(++_0x523704);}(_0x264c,0x13b));var _0xc264=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x264c[_0x82140];return _0x2b15a6;};'use strict';var EventEmitter=require(_0xc264('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xc264('0x1'))['db'][_0xc264('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc264('0x3'),'afterUpdate':_0xc264('0x4'),'afterDestroy':_0xc264('0x5')};function emitEvent(_0x53bbcd){return function(_0x3ea553,_0x507259,_0x5e4fff){_0x3ea553['getUsers']({'attributes':['id'],'raw':!![]})[_0xc264('0x6')](function(_0x38034b){_0x3ea553[_0xc264('0x7')](_0xc264('0x8'),_0x38034b[_0xc264('0x9')](function(_0x10a3ca){return{'id':_0x10a3ca['id']};}));return FaxMessage[_0xc264('0xa')]({'where':{'FaxInteractionId':_0x3ea553['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc264('0x6')](function(_0xb24a15){_0x3ea553[_0xc264('0x7')](_0xc264('0xb'),_0xb24a15[_0xc264('0xc')]);FaxInteractionEvents[_0xc264('0xd')](_0x53bbcd+':'+_0x3ea553['id'],_0x3ea553);FaxInteractionEvents[_0xc264('0xd')](_0x53bbcd,_0x3ea553);_0x5e4fff(null);})[_0xc264('0xe')](_0x5e4fff(null));};}for(var e in events){if(events[_0xc264('0xf')](e)){var event=events[e];FaxInteraction[_0xc264('0x10')](e,emitEvent(event));}}module[_0xc264('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x5f91=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll'];(function(_0x3e508c,_0x5d5c7b){var _0x24f0fb=function(_0x491fe1){while(--_0x491fe1){_0x3e508c['push'](_0x3e508c['shift']());}};_0x24f0fb(++_0x5d5c7b);}(_0x5f91,0x183));var _0x15f9=function(_0x573890,_0x20650d){_0x573890=_0x573890-0x0;var _0x22f42b=_0x5f91[_0x573890];return _0x22f42b;};'use strict';var EventEmitter=require(_0x15f9('0x0'));var FaxInteraction=require(_0x15f9('0x1'))['db'][_0x15f9('0x2')];var FaxMessage=require(_0x15f9('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x15f9('0x3')](0x0);var events={'afterCreate':_0x15f9('0x4'),'afterUpdate':_0x15f9('0x5'),'afterDestroy':_0x15f9('0x6')};function emitEvent(_0x4616d2){return function(_0x27554a,_0x30fe3f,_0x3913d3){_0x27554a['getUsers']({'attributes':['id'],'raw':!![]})[_0x15f9('0x7')](function(_0x57d315){_0x27554a[_0x15f9('0x8')](_0x15f9('0x9'),_0x57d315[_0x15f9('0xa')](function(_0x61a0cd){return{'id':_0x61a0cd['id']};}));return FaxMessage[_0x15f9('0xb')]({'where':{'FaxInteractionId':_0x27554a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x80296a){_0x27554a[_0x15f9('0x8')](_0x15f9('0xc'),_0x80296a[_0x15f9('0xd')]);FaxInteractionEvents[_0x15f9('0xe')](_0x4616d2+':'+_0x27554a['id'],_0x27554a);FaxInteractionEvents[_0x15f9('0xe')](_0x4616d2,_0x27554a);_0x3913d3(null);})[_0x15f9('0xf')](_0x3913d3(null));};}for(var e in events){if(events[_0x15f9('0x10')](e)){var event=events[e];FaxInteraction[_0x15f9('0x11')](e,emitEvent(event));}}module[_0x15f9('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5230ba6..5267c8e 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 _0x0434=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','fax_interactions','changed','closed','closedAt','format','../../config/logger','api','bluebird','request-promise'];(function(_0x220c34,_0xb137f7){var _0x100625=function(_0x252bcb){while(--_0x252bcb){_0x220c34['push'](_0x220c34['shift']());}};_0x100625(++_0xb137f7);}(_0x0434,0xa4));var _0x4043=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x0434[_0x57fa33];return _0x12e724;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4043('0x0'))(_0x4043('0x1'));var moment=require('moment');var BPromise=require(_0x4043('0x2'));var rp=require(_0x4043('0x3'));var fs=require('fs');var path=require(_0x4043('0x4'));var rimraf=require(_0x4043('0x5'));var config=require(_0x4043('0x6'));var attributes=require(_0x4043('0x7'));module[_0x4043('0x8')]=function(_0x153c0d,_0x1a0a18){return _0x153c0d['define']('FaxInteraction',attributes,{'tableName':_0x4043('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x265235,_0x3ab457,_0x336173){if(_0x265235[_0x4043('0xa')](_0x4043('0xb'))){_0x265235[_0x4043('0xc')]=moment()[_0x4043('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x336173(null,_0x265235);}}});}; \ No newline at end of file +var _0x4404=['request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x4404,0x15a));var _0x4440=function(_0x14ba42,_0x29e9f7){_0x14ba42=_0x14ba42-0x0;var _0x303c1d=_0x4404[_0x14ba42];return _0x303c1d;};'use strict';var _=require(_0x4440('0x0'));var util=require('util');var logger=require(_0x4440('0x1'))(_0x4440('0x2'));var moment=require('moment');var BPromise=require(_0x4440('0x3'));var rp=require(_0x4440('0x4'));var fs=require('fs');var path=require(_0x4440('0x5'));var rimraf=require(_0x4440('0x6'));var config=require('../../config/environment');var attributes=require(_0x4440('0x7'));module[_0x4440('0x8')]=function(_0x39e150,_0x40be4f){return _0x39e150[_0x4440('0x9')](_0x4440('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19d4f9,_0x532a41,_0x300739){if(_0x19d4f9[_0x4440('0xb')]('closed')){_0x19d4f9['closedAt']=moment()[_0x4440('0xc')](_0x4440('0xd'));}_0x300739(null,_0x19d4f9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 4d2d0b2..8cb8edd 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 _0xb680=['UpdateFaxInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxInteraction','update','body','options','raw','where','limit'];(function(_0xf0496f,_0x12b537){var _0x5b201c=function(_0x541ed3){while(--_0x541ed3){_0xf0496f['push'](_0xf0496f['shift']());}};_0x5b201c(++_0x12b537);}(_0xb680,0x177));var _0x0b68=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0xb680[_0x19aa84];return _0x536146;};'use strict';var _=require(_0x0b68('0x0'));var util=require(_0x0b68('0x1'));var moment=require(_0x0b68('0x2'));var BPromise=require(_0x0b68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b68('0x4'));var db=require(_0x0b68('0x5'))['db'];var utils=require(_0x0b68('0x6'));var logger=require(_0x0b68('0x7'))(_0x0b68('0x8'));var config=require('../../config/environment');var jayson=require(_0x0b68('0x9'));var client=jayson[_0x0b68('0xa')][_0x0b68('0xb')]({'port':0x232a});config['redis']=_[_0x0b68('0xc')](config[_0x0b68('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b68('0xd')]));require(_0x0b68('0xe'))[_0x0b68('0xf')](socket);function respondWithRpcPromise(_0x35b542,_0x5b3adf,_0x2c6876){return new BPromise(function(_0x31186d,_0x54c2fa){return client[_0x0b68('0x10')](_0x35b542,_0x2c6876)[_0x0b68('0x11')](function(_0x1c9e26){logger[_0x0b68('0x12')](_0x0b68('0x13'),_0x5b3adf,_0x0b68('0x14'));logger[_0x0b68('0x15')](_0x0b68('0x16'),_0x5b3adf,'request\x20sent',JSON[_0x0b68('0x17')](_0x1c9e26));if(_0x1c9e26[_0x0b68('0x18')]){if(_0x1c9e26[_0x0b68('0x18')][_0x0b68('0x19')]===0x1f4){logger[_0x0b68('0x18')](_0x0b68('0x13'),_0x5b3adf,_0x1c9e26[_0x0b68('0x18')][_0x0b68('0x1a')]);return _0x54c2fa(_0x1c9e26[_0x0b68('0x18')][_0x0b68('0x1a')]);}logger[_0x0b68('0x18')](_0x0b68('0x13'),_0x5b3adf,_0x1c9e26['error'][_0x0b68('0x1a')]);return _0x31186d(_0x1c9e26[_0x0b68('0x18')]['message']);}else{logger[_0x0b68('0x12')](_0x0b68('0x13'),_0x5b3adf,'request\x20sent');_0x31186d(_0x1c9e26['result']['message']);}})[_0x0b68('0x1b')](function(_0x33d97f){logger[_0x0b68('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x5b3adf,_0x33d97f);_0x54c2fa(_0x33d97f);});});}exports['UpdateFaxInteraction']=function(_0x59fe0a){var _0x4be565=this;return new Promise(function(_0x2bac0d,_0x2dd479){return db[_0x0b68('0x1c')][_0x0b68('0x1d')](_0x59fe0a[_0x0b68('0x1e')],{'raw':_0x59fe0a[_0x0b68('0x1f')]?_0x59fe0a['options'][_0x0b68('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59fe0a[_0x0b68('0x1f')]?_0x59fe0a['options'][_0x0b68('0x21')]||null:null,'attributes':_0x59fe0a[_0x0b68('0x1f')]?_0x59fe0a[_0x0b68('0x1f')]['attributes']||null:null,'limit':_0x59fe0a[_0x0b68('0x1f')]?_0x59fe0a[_0x0b68('0x1f')][_0x0b68('0x22')]||null:null})[_0x0b68('0x11')](function(_0x16ac28){logger[_0x0b68('0x12')](_0x0b68('0x23'),_0x59fe0a);logger[_0x0b68('0x15')]('UpdateFaxInteraction',_0x59fe0a,JSON['stringify'](_0x16ac28));_0x2bac0d(_0x16ac28);})[_0x0b68('0x1b')](function(_0x36e5e8){logger[_0x0b68('0x18')](_0x0b68('0x23'),_0x36e5e8[_0x0b68('0x1a')],_0x59fe0a);_0x2dd479(_0x4be565[_0x0b68('0x18')](0x1f4,_0x36e5e8[_0x0b68('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4e6652){return new Promise(function(_0x330a34,_0x22d08c){return db[_0x0b68('0x1c')][_0x0b68('0x24')]({'where':_0x4e6652[_0x0b68('0x1f')]?_0x4e6652[_0x0b68('0x1f')][_0x0b68('0x21')]||null:null})[_0x0b68('0x11')](function(_0x2841fa){if(_0x2841fa){return _0x2841fa[_0x0b68('0x25')](_0x4e6652[_0x0b68('0x1e')][_0x0b68('0x26')],_[_0x0b68('0x27')](_0x4e6652[_0x0b68('0x1e')],[_0x0b68('0x26'),'id'])||{});}})['spread'](function(_0x3ebf78){logger[_0x0b68('0x12')](_0x0b68('0x28'),_0x4e6652);logger['debug'](_0x0b68('0x28'),_0x4e6652,JSON[_0x0b68('0x17')](_0x3ebf78));_0x330a34(_0x3ebf78);})['catch'](function(_0x360e67){logger[_0x0b68('0x18')](_0x0b68('0x28'),_0x360e67['message'],_0x4e6652);_0x22d08c(_this['error'](0x1f4,_0x360e67[_0x0b68('0x1a')]));});});}; \ No newline at end of file +var _0x88cd=['FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','FaxInteraction','options','raw','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','where','addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug'];(function(_0x14f84d,_0x518dea){var _0x247e30=function(_0x5af5a9){while(--_0x5af5a9){_0x14f84d['push'](_0x14f84d['shift']());}};_0x247e30(++_0x518dea);}(_0x88cd,0xb8));var _0xd88c=function(_0x45ce2a,_0x34af86){_0x45ce2a=_0x45ce2a-0x0;var _0x8c912a=_0x88cd[_0x45ce2a];return _0x8c912a;};'use strict';var _=require(_0xd88c('0x0'));var util=require('util');var moment=require(_0xd88c('0x1'));var BPromise=require(_0xd88c('0x2'));var rs=require(_0xd88c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd88c('0x4'));var logger=require(_0xd88c('0x5'))(_0xd88c('0x6'));var config=require(_0xd88c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd88c('0x8')][_0xd88c('0x9')]({'port':0x232a});config[_0xd88c('0xa')]=_[_0xd88c('0xb')](config[_0xd88c('0xa')],{'host':_0xd88c('0xc'),'port':0x18eb});var socket=require(_0xd88c('0xd'))(new Redis(config[_0xd88c('0xa')]));require(_0xd88c('0xe'))[_0xd88c('0xf')](socket);function respondWithRpcPromise(_0x44a170,_0x1a84d1,_0x56a481){return new BPromise(function(_0x1917c1,_0x2651d9){return client[_0xd88c('0x10')](_0x44a170,_0x56a481)[_0xd88c('0x11')](function(_0x1a7546){logger[_0xd88c('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x1a84d1,_0xd88c('0x13'));logger[_0xd88c('0x14')](_0xd88c('0x15'),_0x1a84d1,'request\x20sent',JSON[_0xd88c('0x16')](_0x1a7546));if(_0x1a7546['error']){if(_0x1a7546[_0xd88c('0x17')][_0xd88c('0x18')]===0x1f4){logger[_0xd88c('0x17')](_0xd88c('0x19'),_0x1a84d1,_0x1a7546[_0xd88c('0x17')][_0xd88c('0x1a')]);return _0x2651d9(_0x1a7546[_0xd88c('0x17')][_0xd88c('0x1a')]);}logger[_0xd88c('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x1a84d1,_0x1a7546[_0xd88c('0x17')]['message']);return _0x1917c1(_0x1a7546[_0xd88c('0x17')][_0xd88c('0x1a')]);}else{logger[_0xd88c('0x12')](_0xd88c('0x19'),_0x1a84d1,_0xd88c('0x13'));_0x1917c1(_0x1a7546[_0xd88c('0x1b')][_0xd88c('0x1a')]);}})[_0xd88c('0x1c')](function(_0x135fe3){logger[_0xd88c('0x17')](_0xd88c('0x19'),_0x1a84d1,_0x135fe3);_0x2651d9(_0x135fe3);});});}exports['UpdateFaxInteraction']=function(_0x43c4f3){var _0x3c5333=this;return new Promise(function(_0x2c1273,_0x16afe4){return db[_0xd88c('0x1d')]['update'](_0x43c4f3['body'],{'raw':_0x43c4f3[_0xd88c('0x1e')]?_0x43c4f3[_0xd88c('0x1e')][_0xd88c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c4f3['options']?_0x43c4f3[_0xd88c('0x1e')]['where']||null:null,'attributes':_0x43c4f3['options']?_0x43c4f3['options'][_0xd88c('0x20')]||null:null,'limit':_0x43c4f3[_0xd88c('0x1e')]?_0x43c4f3[_0xd88c('0x1e')]['limit']||null:null})[_0xd88c('0x11')](function(_0xac8945){logger[_0xd88c('0x12')]('UpdateFaxInteraction',_0x43c4f3);logger[_0xd88c('0x14')]('UpdateFaxInteraction',_0x43c4f3,JSON['stringify'](_0xac8945));_0x2c1273(_0xac8945);})['catch'](function(_0xc7c243){logger[_0xd88c('0x17')](_0xd88c('0x21'),_0xc7c243[_0xd88c('0x1a')],_0x43c4f3);_0x16afe4(_0x3c5333['error'](0x1f4,_0xc7c243[_0xd88c('0x1a')]));});});};exports[_0xd88c('0x22')]=function(_0xeac50e){return new Promise(function(_0x1d7ef3,_0x5f5b2d){return db[_0xd88c('0x1d')]['find']({'where':_0xeac50e[_0xd88c('0x1e')]?_0xeac50e['options'][_0xd88c('0x23')]||null:null})[_0xd88c('0x11')](function(_0x310bf9){if(_0x310bf9){return _0x310bf9[_0xd88c('0x24')](_0xeac50e[_0xd88c('0x25')][_0xd88c('0x26')],_[_0xd88c('0x27')](_0xeac50e[_0xd88c('0x25')],[_0xd88c('0x26'),'id'])||{});}})['spread'](function(_0xf9856f){logger[_0xd88c('0x12')](_0xd88c('0x28'),_0xeac50e);logger[_0xd88c('0x14')]('AddTags',_0xeac50e,JSON[_0xd88c('0x16')](_0xf9856f));_0x1d7ef3(_0xf9856f);})[_0xd88c('0x1c')](function(_0x14a33a){logger[_0xd88c('0x17')](_0xd88c('0x28'),_0x14a33a['message'],_0xeac50e);_0x5f5b2d(_this[_0xd88c('0x17')](0x1f4,_0x14a33a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e985a2c..dca8f09 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 _0x0827=['update','emit','removeListener','register','./faxInteraction.events','save'];(function(_0x28f6a5,_0x37f7c9){var _0x18ded8=function(_0x5477fb){while(--_0x5477fb){_0x28f6a5['push'](_0x28f6a5['shift']());}};_0x18ded8(++_0x37f7c9);}(_0x0827,0x76));var _0x7082=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x0827[_0x12b8ec];return _0x21af77;};'use strict';var FaxInteractionEvents=require(_0x7082('0x0'));var events=[_0x7082('0x1'),'remove',_0x7082('0x2')];function createListener(_0x44b8b2,_0x596843){return function(_0x567f3a){_0x596843[_0x7082('0x3')](_0x44b8b2,_0x567f3a);};}function removeListener(_0x580a32,_0x161f6b){return function(){FaxInteractionEvents[_0x7082('0x4')](_0x580a32,_0x161f6b);};}exports[_0x7082('0x5')]=function(_0x2a79ac){for(var _0x113951=0x0,_0x262a18=events['length'];_0x113951<_0x262a18;_0x113951++){var _0x3de2e3=events[_0x113951];var _0x258231=createListener('faxInteraction:'+_0x3de2e3,_0x2a79ac);FaxInteractionEvents['on'](_0x3de2e3,_0x258231);}}; \ No newline at end of file +var _0x62db=['removeListener','length','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x286a8a,_0x34853d){var _0x34a488=function(_0x3d63e3){while(--_0x3d63e3){_0x286a8a['push'](_0x286a8a['shift']());}};_0x34a488(++_0x34853d);}(_0x62db,0xb2));var _0xb62d=function(_0x4db568,_0x37c011){_0x4db568=_0x4db568-0x0;var _0x46b22c=_0x62db[_0x4db568];return _0x46b22c;};'use strict';var FaxInteractionEvents=require(_0xb62d('0x0'));var events=[_0xb62d('0x1'),_0xb62d('0x2'),'update'];function createListener(_0x5aee96,_0x241769){return function(_0x25cfc2){_0x241769[_0xb62d('0x3')](_0x5aee96,_0x25cfc2);};}function removeListener(_0x2dfc46,_0xa2f518){return function(){FaxInteractionEvents[_0xb62d('0x4')](_0x2dfc46,_0xa2f518);};}exports['register']=function(_0x18deaf){for(var _0x4a873b=0x0,_0x366be6=events[_0xb62d('0x5')];_0x4a873b<_0x366be6;_0x4a873b++){var _0x179a6c=events[_0x4a873b];var _0x20351d=createListener(_0xb62d('0x6')+_0x179a6c,_0x18deaf);FaxInteractionEvents['on'](_0x179a6c,_0x20351d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index d0047d6..890164d 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 _0x1210=['/:id/messages','getMessages','download','post','create','addMessage','tracked','fax','faxinteraction:addtags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x1210,0x188));var _0x0121=function(_0x1b2cf0,_0x3e1559){_0x1b2cf0=_0x1b2cf0-0x0;var _0x566935=_0x1210[_0x1b2cf0];return _0x566935;};'use strict';var multer=require(_0x0121('0x0'));var util=require(_0x0121('0x1'));var path=require(_0x0121('0x2'));var timeout=require('connect-timeout');var express=require(_0x0121('0x3'));var router=express[_0x0121('0x4')]();var fs_extra=require(_0x0121('0x5'));var auth=require(_0x0121('0x6'));var interaction=require(_0x0121('0x7'));var config=require(_0x0121('0x8'));var controller=require(_0x0121('0x9'));router[_0x0121('0xa')]('/',auth[_0x0121('0xb')](),controller[_0x0121('0xc')]);router[_0x0121('0xa')](_0x0121('0xd'),auth[_0x0121('0xb')](),controller[_0x0121('0xe')]);router['get']('/:id',auth[_0x0121('0xb')](),controller[_0x0121('0xf')]);router['get'](_0x0121('0x10'),auth[_0x0121('0xb')](),controller[_0x0121('0x11')]);router[_0x0121('0xa')]('/:id/download',auth[_0x0121('0xb')](),controller[_0x0121('0x12')]);router[_0x0121('0x13')]('/',auth[_0x0121('0xb')](),controller[_0x0121('0x14')]);router[_0x0121('0x13')]('/:id/messages',auth[_0x0121('0xb')](),controller[_0x0121('0x15')]);router[_0x0121('0x13')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0121('0x16')](_0x0121('0x17'),_0x0121('0x18')),controller['addTags']);router[_0x0121('0x19')](_0x0121('0x1a'),auth['isAuthenticated'](),interaction[_0x0121('0x16')](_0x0121('0x17'),_0x0121('0x1b')),controller[_0x0121('0x1c')]);router[_0x0121('0x1d')](_0x0121('0x1a'),auth[_0x0121('0xb')](),interaction['tracked']('fax',_0x0121('0x1e')),controller[_0x0121('0x1f')]);router[_0x0121('0x1d')]('/:id/tags',auth[_0x0121('0xb')](),controller[_0x0121('0x20')]);module[_0x0121('0x21')]=router; \ No newline at end of file +var _0x6819=['faxinteraction:update','delete','faxinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','fax','faxinteraction:addtags'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x6819,0x8a));var _0x9681=function(_0x45203a,_0x8dd03b){_0x45203a=_0x45203a-0x0;var _0x142e16=_0x6819[_0x45203a];return _0x142e16;};'use strict';var multer=require(_0x9681('0x0'));var util=require(_0x9681('0x1'));var path=require(_0x9681('0x2'));var timeout=require(_0x9681('0x3'));var express=require(_0x9681('0x4'));var router=express[_0x9681('0x5')]();var fs_extra=require(_0x9681('0x6'));var auth=require(_0x9681('0x7'));var interaction=require(_0x9681('0x8'));var config=require(_0x9681('0x9'));var controller=require(_0x9681('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9681('0xb')](_0x9681('0xc'),auth[_0x9681('0xd')](),controller[_0x9681('0xe')]);router[_0x9681('0xb')](_0x9681('0xf'),auth[_0x9681('0xd')](),controller[_0x9681('0x10')]);router[_0x9681('0xb')](_0x9681('0x11'),auth[_0x9681('0xd')](),controller[_0x9681('0x12')]);router['get'](_0x9681('0x13'),auth[_0x9681('0xd')](),controller[_0x9681('0x14')]);router['post']('/',auth[_0x9681('0xd')](),controller[_0x9681('0x15')]);router[_0x9681('0x16')](_0x9681('0x11'),auth[_0x9681('0xd')](),controller[_0x9681('0x17')]);router[_0x9681('0x16')]('/:id/tags',auth[_0x9681('0xd')](),interaction[_0x9681('0x18')](_0x9681('0x19'),_0x9681('0x1a')),controller['addTags']);router['put'](_0x9681('0xf'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x9681('0x1b')),controller['update']);router[_0x9681('0x1c')](_0x9681('0xf'),auth[_0x9681('0xd')](),interaction[_0x9681('0x18')](_0x9681('0x19'),_0x9681('0x1d')),controller[_0x9681('0x1e')]);router[_0x9681('0x1c')](_0x9681('0x1f'),auth[_0x9681('0xd')](),controller['removeTags']);module[_0x9681('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ee34b64..7ff36c5 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 _0xe64a=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x4e3aea,_0x17f32d){var _0x16cb0c=function(_0x50e11e){while(--_0x50e11e){_0x4e3aea['push'](_0x4e3aea['shift']());}};_0x16cb0c(++_0x17f32d);}(_0xe64a,0x1e0));var _0xae64=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe64a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xae64('0x0'));module[_0xae64('0x1')]={'body':{'type':Sequelize[_0xae64('0x2')](_0xae64('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xae64('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xae64('0x5')]('in',_0xae64('0x6')),'defaultValue':_0xae64('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xde9d=['sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xde9d,0x156));var _0xdde9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xde9d[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xdde9('0x0'));module[_0xdde9('0x1')]={'body':{'type':Sequelize[_0xdde9('0x2')](_0xdde9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdde9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdde9('0x5')),'defaultValue':_0xdde9('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xdde9('0x2')],'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 721ba42..3d1485a 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 _0x957c=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','name','send','index','FaxMessage','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','body','describe','../../config/logger','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','read1stAt','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','fax','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','SELECT','email','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','join','root','server','attachments','download','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4214c8,_0x55efaf){var _0x4496d5=function(_0x6a281e){while(--_0x6a281e){_0x4214c8['push'](_0x4214c8['shift']());}};_0x4496d5(++_0x55efaf);}(_0x957c,0x10c));var _0xc957=function(_0x4944ab,_0x1f3926){_0x4944ab=_0x4944ab-0x0;var _0x4f4ae6=_0x957c[_0x4944ab];return _0x4f4ae6;};'use strict';var emlformat=require(_0xc957('0x0'));var rimraf=require(_0xc957('0x1'));var zipdir=require(_0xc957('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc957('0x3'));var moment=require(_0xc957('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc957('0x5'));var path=require(_0xc957('0x6'));var sox=require(_0xc957('0x7'));var csv=require(_0xc957('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc957('0x9'));var squel=require(_0xc957('0xa'));var crypto=require(_0xc957('0xb'));var jsforce=require(_0xc957('0xc'));var deskjs=require(_0xc957('0xd'));var toCsv=require(_0xc957('0x8'));var querystring=require(_0xc957('0xe'));var Papa=require(_0xc957('0xf'));var Redis=require('ioredis');var authService=require(_0xc957('0x10'));var qs=require(_0xc957('0x11'));var as=require(_0xc957('0x12'));var hardwareService=require(_0xc957('0x13'));var logger=require('../../config/logger')(_0xc957('0x14'));var utils=require(_0xc957('0x15'));var config=require(_0xc957('0x16'));var licenseUtil=require(_0xc957('0x17'));var db=require('../../mysqldb')['db'];config[_0xc957('0x18')]=_[_0xc957('0x19')](config[_0xc957('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc957('0x1a'))(new Redis(config[_0xc957('0x18')]));require(_0xc957('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc957('0x1c')][_0xc957('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xc957('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x366bc7,_0x371f77,_0x416f0d,_0x2a1fc6){return new BPromise(function(_0x7fbb36,_0x5f5db2){var _0x11d9ff=_0x2a1fc6||client;return _0x11d9ff[_0xc957('0x1e')](_0x366bc7,_0x416f0d)[_0xc957('0x1f')](function(_0x38a316){logger[_0xc957('0x20')](_0xc957('0x21'),_0x371f77,_0xc957('0x22'));logger[_0xc957('0x23')](_0xc957('0x24'),_0x371f77,_0xc957('0x22'),JSON[_0xc957('0x25')](_0x38a316));if(_0x38a316[_0xc957('0x26')]){if(_0x38a316['error']['code']===0x1f4){logger['error'](_0xc957('0x21'),_0x371f77,_0x38a316[_0xc957('0x26')][_0xc957('0x27')]);return _0x5f5db2(_0x38a316[_0xc957('0x26')][_0xc957('0x27')]);}logger[_0xc957('0x26')](_0xc957('0x21'),_0x371f77,_0x38a316[_0xc957('0x26')]['message']);return _0x7fbb36(_0x38a316[_0xc957('0x26')]['message']);}else{logger[_0xc957('0x20')](_0xc957('0x21'),_0x371f77,_0xc957('0x22'));_0x7fbb36(_0x38a316[_0xc957('0x28')][_0xc957('0x27')]);}})[_0xc957('0x29')](function(_0x380a43){logger[_0xc957('0x26')](_0xc957('0x21'),_0x371f77,_0x380a43);_0x5f5db2(_0x380a43);});});}function respondWithStatusCode(_0x34c56d,_0x3e765f){_0x3e765f=_0x3e765f||0xcc;return function(_0x28e437){if(_0x28e437){return _0x34c56d[_0xc957('0x2a')](_0x3e765f);}return _0x34c56d['status'](_0x3e765f)[_0xc957('0x2b')]();};}function respondWithResult(_0x3eab73,_0x37f2ce){_0x37f2ce=_0x37f2ce||0xc8;return function(_0x3cc852){if(_0x3cc852){return _0x3eab73[_0xc957('0x2c')](_0x37f2ce)[_0xc957('0x2d')](_0x3cc852);}};}function respondWithFilteredResult(_0x523c38,_0x21084e){return function(_0x517797){if(_0x517797){var _0x3616f2=typeof _0x21084e[_0xc957('0x2e')]===_0xc957('0x2f')&&typeof _0x21084e['limit']===_0xc957('0x2f');var _0x2dd806=_0x517797[_0xc957('0x30')];var _0x3e7d60=_0x3616f2?0x0:_0x21084e[_0xc957('0x2e')];var _0x5e5c8d=_0x3616f2?_0x517797[_0xc957('0x30')]:_0x21084e[_0xc957('0x2e')]+_0x21084e[_0xc957('0x31')];var _0x62558;if(_0x5e5c8d>=_0x2dd806){_0x5e5c8d=_0x2dd806;_0x62558=0xc8;}else{_0x62558=0xce;}_0x523c38['status'](_0x62558);return _0x523c38[_0xc957('0x32')](_0xc957('0x33'),_0x3e7d60+'-'+_0x5e5c8d+'/'+_0x2dd806)[_0xc957('0x2d')](_0x517797);}return null;};}function patchUpdates(_0x303a36){return function(_0x5207ed){try{jsonpatch[_0xc957('0x34')](_0x5207ed,_0x303a36,!![]);}catch(_0x2235fe){return BPromise[_0xc957('0x35')](_0x2235fe);}return _0x5207ed['save']();};}function saveUpdates(_0x38a81f,_0x47d616){return function(_0x2d3ea3){if(_0x2d3ea3){return _0x2d3ea3[_0xc957('0x36')](_0x38a81f)['then'](function(_0x150489){return _0x150489;});}return null;};}function removeEntity(_0x25e83e,_0x1b5f6e){return function(_0x5a32ad){if(_0x5a32ad){return _0x5a32ad[_0xc957('0x37')]()['then'](function(){_0x25e83e['status'](0xcc)[_0xc957('0x2b')]();});}};}function handleEntityNotFound(_0x49b653,_0x4cea87){return function(_0x516c5a){if(!_0x516c5a){_0x49b653['sendStatus'](0x194);}return _0x516c5a;};}function handleError(_0x398a21,_0x15ed79){_0x15ed79=_0x15ed79||0x1f4;return function(_0x1c3b5f){logger[_0xc957('0x26')](_0x1c3b5f['stack']);if(_0x1c3b5f[_0xc957('0x38')]){delete _0x1c3b5f['name'];}_0x398a21['status'](_0x15ed79)[_0xc957('0x39')](_0x1c3b5f);};}exports[_0xc957('0x3a')]=function(_0x186a88,_0x55779e){var _0x24a862={},_0x3dbd30={},_0x3e45a6={'count':0x0,'rows':[]};var _0x496066=_['map'](db[_0xc957('0x3b')][_0xc957('0x3c')],function(_0x130efd){return{'name':_0x130efd[_0xc957('0x3d')],'type':_0x130efd['type'][_0xc957('0x3e')]};});_0x3dbd30[_0xc957('0x3f')]=_[_0xc957('0x40')](_0x496066,_0xc957('0x38'));_0x3dbd30[_0xc957('0x41')]=_['keys'](_0x186a88[_0xc957('0x41')]);_0x3dbd30[_0xc957('0x42')]=_['intersection'](_0x3dbd30[_0xc957('0x3f')],_0x3dbd30['query']);_0x24a862[_0xc957('0x43')]=_[_0xc957('0x44')](_0x3dbd30['model'],qs[_0xc957('0x45')](_0x186a88['query'][_0xc957('0x45')]));_0x24a862['attributes']=_0x24a862[_0xc957('0x43')][_0xc957('0x46')]?_0x24a862[_0xc957('0x43')]:_0x3dbd30[_0xc957('0x3f')];if(!_0x186a88[_0xc957('0x41')][_0xc957('0x47')]('nolimit')){_0x24a862[_0xc957('0x31')]=qs[_0xc957('0x31')](_0x186a88[_0xc957('0x41')]['limit']);_0x24a862[_0xc957('0x2e')]=qs[_0xc957('0x2e')](_0x186a88[_0xc957('0x41')][_0xc957('0x2e')]);}_0x24a862['order']=qs['sort'](_0x186a88[_0xc957('0x41')][_0xc957('0x48')]);_0x24a862['where']=qs[_0xc957('0x42')](_['pick'](_0x186a88[_0xc957('0x41')],_0x3dbd30[_0xc957('0x42')]),_0x496066);if(_0x186a88[_0xc957('0x41')][_0xc957('0x49')]){_0x24a862['where']=_[_0xc957('0x4a')](_0x24a862[_0xc957('0x4b')],{'$or':_[_0xc957('0x40')](_0x496066,function(_0x26a9ae){if(_0x26a9ae[_0xc957('0x4c')]!==_0xc957('0x4d')){var _0x293665={};_0x293665[_0x26a9ae[_0xc957('0x38')]]={'$like':'%'+_0x186a88[_0xc957('0x41')][_0xc957('0x49')]+'%'};return _0x293665;}})});}_0x24a862=_[_0xc957('0x4a')]({},_0x24a862,_0x186a88[_0xc957('0x4e')]);var _0xf32be0={'where':_0x24a862[_0xc957('0x4b')]};return db[_0xc957('0x3b')][_0xc957('0x30')](_0xf32be0)[_0xc957('0x1f')](function(_0x4b5802){_0x3e45a6[_0xc957('0x30')]=_0x4b5802;if(_0x186a88[_0xc957('0x41')][_0xc957('0x4f')]){_0x24a862[_0xc957('0x50')]=[{'all':!![]}];}return db[_0xc957('0x3b')][_0xc957('0x51')](_0x24a862);})['then'](function(_0x212324){_0x3e45a6[_0xc957('0x52')]=_0x212324;return _0x3e45a6;})[_0xc957('0x1f')](respondWithFilteredResult(_0x55779e,_0x24a862))[_0xc957('0x29')](handleError(_0x55779e,null));};exports['show']=function(_0x2cfc98,_0x35aca5){var _0x255d85={'raw':!![],'where':{'id':_0x2cfc98[_0xc957('0x53')]['id']}},_0x281b33={};_0x281b33[_0xc957('0x3f')]=_[_0xc957('0x54')](db[_0xc957('0x3b')][_0xc957('0x3c')]);_0x281b33[_0xc957('0x41')]=_[_0xc957('0x54')](_0x2cfc98[_0xc957('0x41')]);_0x281b33[_0xc957('0x42')]=_['intersection'](_0x281b33[_0xc957('0x3f')],_0x281b33[_0xc957('0x41')]);_0x255d85[_0xc957('0x43')]=_[_0xc957('0x44')](_0x281b33[_0xc957('0x3f')],qs['fields'](_0x2cfc98[_0xc957('0x41')][_0xc957('0x45')]));_0x255d85['attributes']=_0x255d85[_0xc957('0x43')][_0xc957('0x46')]?_0x255d85[_0xc957('0x43')]:_0x281b33[_0xc957('0x3f')];if(_0x2cfc98[_0xc957('0x41')]['includeAll']){_0x255d85[_0xc957('0x50')]=[{'all':!![]}];}_0x255d85=_[_0xc957('0x4a')]({},_0x255d85,_0x2cfc98['options']);return db['FaxMessage'][_0xc957('0x55')](_0x255d85)[_0xc957('0x1f')](handleEntityNotFound(_0x35aca5,null))['then'](respondWithResult(_0x35aca5,null))[_0xc957('0x29')](handleError(_0x35aca5,null));};exports[_0xc957('0x36')]=function(_0x61cfbf,_0x2e5a05){if(_0x61cfbf[_0xc957('0x56')]['id']){delete _0x61cfbf[_0xc957('0x56')]['id'];}return db[_0xc957('0x3b')][_0xc957('0x55')]({'where':{'id':_0x61cfbf['params']['id']}})[_0xc957('0x1f')](handleEntityNotFound(_0x2e5a05,null))[_0xc957('0x1f')](saveUpdates(_0x61cfbf[_0xc957('0x56')],null))[_0xc957('0x1f')](respondWithResult(_0x2e5a05,null))['catch'](handleError(_0x2e5a05,null));};exports['destroy']=function(_0x1d4069,_0x60e885){return db[_0xc957('0x3b')][_0xc957('0x55')]({'where':{'id':_0x1d4069['params']['id']}})[_0xc957('0x1f')](handleEntityNotFound(_0x60e885,null))[_0xc957('0x1f')](removeEntity(_0x60e885,null))[_0xc957('0x29')](handleError(_0x60e885,null));};exports['describe']=function(_0x5597b8,_0x3a5f69){return db[_0xc957('0x3b')][_0xc957('0x57')]()[_0xc957('0x1f')](respondWithResult(_0x3a5f69,null))[_0xc957('0x29')](handleError(_0x3a5f69,null));};var interaction_log=require(_0xc957('0x58'))(_0xc957('0x59'));exports['accept']=function(_0x4fa8f2,_0xa398ef,_0x18bbbe){var _0x2f1288={'agent':{},'channel':'fax'};if(_0x4fa8f2['body']['id']){delete _0x4fa8f2[_0xc957('0x56')]['id'];}_0x4fa8f2[_0xc957('0x56')][_0xc957('0x5a')]=!![];_0x4fa8f2[_0xc957('0x56')][_0xc957('0x5b')]=moment()[_0xc957('0x5c')](_0xc957('0x5d'));_0x4fa8f2[_0xc957('0x56')][_0xc957('0x5e')]=_0x4fa8f2[_0xc957('0x56')][_0xc957('0x5e')]||_0x4fa8f2[_0xc957('0x5f')]['id'];_0x2f1288[_0xc957('0x60')]['id']=_0x4fa8f2[_0xc957('0x56')]['UserId'];return db[_0xc957('0x3b')][_0xc957('0x55')]({'where':{'id':_0x4fa8f2[_0xc957('0x53')]['id'],'UserId':null}})[_0xc957('0x1f')](handleEntityNotFound(_0xa398ef,null))[_0xc957('0x1f')](saveUpdates(_0x4fa8f2['body'],null))['then'](function(_0x532194){if(_0x532194){_0x2f1288[_0xc957('0x27')]=_0x532194[_0xc957('0x61')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x532194['FaxInteractionId']}});}return null;})[_0xc957('0x1f')](handleEntityNotFound(_0xa398ef,null))[_0xc957('0x1f')](function(_0x129993){if(_0x129993){return _0x129993[_0xc957('0x36')]({'UserId':_0x4fa8f2[_0xc957('0x56')][_0xc957('0x5e')],'read1stAt':_['isNil'](_0x129993[_0xc957('0x62')])?moment()[_0xc957('0x5c')](_0xc957('0x5d')):undefined});}return null;})[_0xc957('0x1f')](function(_0x436389){if(_0x436389){_0x2f1288['interaction']=_0x436389[_0xc957('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fa8f2[_0xc957('0x5f')]['id'],_0x4fa8f2[_0xc957('0x5f')][_0xc957('0x38')],_0x4fa8f2[_0xc957('0x5f')][_0xc957('0x63')],_0x2f1288['interaction']['id'],_0x4fa8f2['body']?JSON[_0xc957('0x25')](_0x4fa8f2[_0xc957('0x56')]):_0xc957('0x64'));return respondWithRpcPromise(_0xc957('0x65'),_0xc957('0x66'),_0x2f1288);}return null;})[_0xc957('0x1f')](function(_0x234735){var _0x88257e=_0xc957('0x67')+_0x234735['message'][_0xc957('0x68')];return db[_0xc957('0x69')][_0xc957('0x41')](_0x88257e,{'type':db['Sequelize'][_0xc957('0x6a')]['SELECT'],'raw':!![]})[_0xc957('0x1f')](function(_0x419472){return _0x419472;});})[_0xc957('0x1f')](function(_0x379336){if(_0x379336){_0x2f1288[_0xc957('0x27')][_0xc957('0x6b')]=_0x379336[0x0];if(!_0x4fa8f2[_0xc957('0x56')]['UserId'])return;return db[_0xc957('0x6c')][_0xc957('0x55')]({'where':{'id':_0x4fa8f2[_0xc957('0x56')][_0xc957('0x5e')],'role':_0xc957('0x60')},'attributes':['id','name',_0xc957('0x6d'),'email',_0xc957('0x6e')],'raw':!![]});}return null;})[_0xc957('0x1f')](function(_0x473f32){if(!_0x473f32)return null;_0x2f1288[_0xc957('0x27')][_0xc957('0x60')]=_0x473f32;return _0x2f1288;})[_0xc957('0x1f')](function(_0x192316){if(_0x192316){if(_0x4fa8f2[_0xc957('0x56')][_0xc957('0x6f')]){_0x2f1288[_0xc957('0x27')][_0xc957('0x70')]=util[_0xc957('0x5c')](_0xc957('0x71'),_0x4fa8f2[_0xc957('0x5f')]['name']);_0x2f1288['message'][_0xc957('0x72')]=_0x2f1288[_0xc957('0x72')];_0x2f1288[_0xc957('0x27')][_0xc957('0x73')]=_0x2f1288[_0xc957('0x72')];_0x2f1288[_0xc957('0x27')]['event']=_0xc957('0x74');return respondWithRpcPromise(_0xc957('0x75'),_0xc957('0x75'),{'event':'acceptmessage','message':_0x2f1288[_0xc957('0x27')]},client9002)[_0xc957('0x1f')](function(){return _0x2f1288;});}return _0x2f1288;}return null;})[_0xc957('0x1f')](respondWithResult(_0xa398ef,null))[_0xc957('0x29')](handleError(_0xa398ef,null));};var interaction_log=require(_0xc957('0x58'))('fax-interactions');exports[_0xc957('0x35')]=function(_0xafac8,_0x3ce730,_0x27f787){var _0x13c884={'agent':{},'channel':_0xc957('0x76')};if(_0xafac8[_0xc957('0x56')]['id']){delete _0xafac8[_0xc957('0x56')]['id'];}_0xafac8[_0xc957('0x56')][_0xc957('0x5e')]=_0xafac8[_0xc957('0x56')][_0xc957('0x5e')]||_0xafac8[_0xc957('0x5f')]['id'];_0x13c884[_0xc957('0x60')]['id']=_0xafac8[_0xc957('0x56')][_0xc957('0x5e')];return db[_0xc957('0x3b')]['find']({'where':{'id':_0xafac8[_0xc957('0x53')]['id'],'UserId':null}})[_0xc957('0x1f')](handleEntityNotFound(_0x3ce730,null))[_0xc957('0x1f')](function(_0x40fb48){if(_0x40fb48){_0x13c884[_0xc957('0x27')]=_0x40fb48[_0xc957('0x61')]({'plain':!![]});return db[_0xc957('0x77')][_0xc957('0x55')]({'where':{'id':_0x40fb48[_0xc957('0x78')]}});}return null;})[_0xc957('0x1f')](handleEntityNotFound(_0x3ce730,null))[_0xc957('0x1f')](function(_0x5b9a3b){if(_0x5b9a3b){_0x13c884[_0xc957('0x79')]=_0x5b9a3b[_0xc957('0x61')]({'plain':!![]});interaction_log['info'](_0xc957('0x7a'),_0xafac8[_0xc957('0x5f')]['id'],_0xafac8[_0xc957('0x5f')]['name'],_0xafac8['user'][_0xc957('0x63')],_0x13c884[_0xc957('0x79')]['id'],_0xafac8[_0xc957('0x56')]?JSON[_0xc957('0x25')](_0xafac8['body']):_0xc957('0x64'));return respondWithRpcPromise(_0xc957('0x7b'),'rejectMessage',_0x13c884);}return null;})[_0xc957('0x1f')](function(_0x54d563){var _0x3453ed=_0xc957('0x67')+_0x54d563['message'][_0xc957('0x68')];return db[_0xc957('0x69')][_0xc957('0x41')](_0x3453ed,{'type':db[_0xc957('0x7c')][_0xc957('0x6a')][_0xc957('0x7d')],'raw':!![]})[_0xc957('0x1f')](function(_0x4650d2){return _0x4650d2;});})[_0xc957('0x1f')](function(_0x29ad4a){if(_0x29ad4a){_0x13c884['message'][_0xc957('0x6b')]=_0x29ad4a[0x0];if(!_0xafac8['body'][_0xc957('0x5e')])return;return db[_0xc957('0x6c')][_0xc957('0x55')]({'where':{'id':_0xafac8['body']['UserId'],'role':_0xc957('0x60')},'attributes':['id',_0xc957('0x38'),_0xc957('0x6d'),_0xc957('0x7e'),'internal'],'raw':!![]});}return null;})[_0xc957('0x1f')](function(_0x3c6cdf){if(!_0x3c6cdf)return null;_0x13c884[_0xc957('0x27')][_0xc957('0x60')]=_0x3c6cdf;return _0x13c884;})['then'](function(_0x50e52e){if(_0x50e52e){_0x50e52e[_0xc957('0x27')][_0xc957('0x70')]=util[_0xc957('0x5c')](_0xc957('0x71'),_0xafac8[_0xc957('0x5f')][_0xc957('0x38')]);_0x50e52e[_0xc957('0x27')][_0xc957('0x72')]=_0x13c884[_0xc957('0x72')];_0x50e52e[_0xc957('0x27')]['motionChannel']=_0x13c884[_0xc957('0x72')];_0x50e52e[_0xc957('0x27')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x50e52e[_0xc957('0x27')]},client9002);return _0x13c884;}return null;})[_0xc957('0x1f')](respondWithResult(_0x3ce730,null))[_0xc957('0x29')](handleError(_0x3ce730,null));};exports[_0xc957('0x7f')]=function(_0x24178c,_0x742b1){var _0x4737ea;return db[_0xc957('0x3b')][_0xc957('0x7f')](_0x24178c[_0xc957('0x56')],{})[_0xc957('0x1f')](function(_0xc62fd5){_0x4737ea=_0xc62fd5;return db[_0xc957('0x80')][_0xc957('0x81')]({'where':{'id':_0x4737ea[_0xc957('0x68')]}});})['then'](function(_0x53c339){if(_[_0xc957('0x82')](_0x53c339)){return;}else{_0x4737ea[_0xc957('0x76')]=_0x53c339[_0xc957('0x76')];return db[_0xc957('0x83')][_0xc957('0x81')]({'where':{'id':_0x4737ea[_0xc957('0x84')]}});}})[_0xc957('0x1f')](function(_0x305ae7){return respondWithRpcPromise(_0xc957('0x85'),_0xc957('0x85'),{'FaxAccountId':_[_0xc957('0x82')](_0x24178c['body'])?undefined:_0x24178c[_0xc957('0x56')][_0xc957('0x86')],'path':_[_0xc957('0x82')](_0x305ae7)?undefined:util[_0xc957('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x305ae7[_0xc957('0x87')]),'fax':_[_0xc957('0x82')](_0x4737ea['fax'])?undefined:_0x4737ea[_0xc957('0x76')],'AttachmentId':_0x4737ea[_0xc957('0x84')]},client9002);})[_0xc957('0x1f')](respondWithResult(_0x742b1,0xc9))[_0xc957('0x29')](handleError(_0x742b1,null));};exports['download']=function(_0x148884,_0x2cc857){var _0x45b764=path[_0xc957('0x88')](config[_0xc957('0x89')],_0xc957('0x8a'),'files',_0xc957('0x8b'));return db[_0xc957('0x3b')]['find']({'where':{'id':_0x148884[_0xc957('0x53')]['id']},'include':[{'model':db[_0xc957('0x83')],'as':_0xc957('0x83')}]})['then'](handleEntityNotFound(_0x2cc857,null))['then'](function(_0x5cbbcc){if(_0x5cbbcc){return _0x2cc857[_0xc957('0x8c')](path['join'](_0x45b764,_0x5cbbcc[_0xc957('0x83')][_0xc957('0x87')]));}})[_0xc957('0x29')](handleError(_0x2cc857,null));}; \ No newline at end of file +var _0x5a90=['find','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','update','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','fax','params','RejectMessage','rejectMessage','sequelize','create','CmContact','findOne','isNil','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','attachments','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','to-csv','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','./faxMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','FaxMessage,\x20%s,\x20%s','info','result','catch','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','sendStatus','stack','send','index','map','FaxMessage','fieldName','type','key','model','name','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','keys','rawAttributes','fields','options'];(function(_0x47841f,_0x5ece9f){var _0xefd299=function(_0x47707c){while(--_0x47707c){_0x47841f['push'](_0x47841f['shift']());}};_0xefd299(++_0x5ece9f);}(_0x5a90,0xc6));var _0x05a9=function(_0x148c5c,_0x53bf6c){_0x148c5c=_0x148c5c-0x0;var _0xd32592=_0x5a90[_0x148c5c];return _0xd32592;};'use strict';var emlformat=require(_0x05a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x05a9('0x1'));var jsonpatch=require(_0x05a9('0x2'));var rp=require('request-promise');var moment=require(_0x05a9('0x3'));var BPromise=require(_0x05a9('0x4'));var Mustache=require(_0x05a9('0x5'));var util=require(_0x05a9('0x6'));var path=require(_0x05a9('0x7'));var sox=require(_0x05a9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05a9('0x9'));var _=require(_0x05a9('0xa'));var squel=require(_0x05a9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x05a9('0xc'));var querystring=require(_0x05a9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x05a9('0xe'));var qs=require(_0x05a9('0xf'));var as=require(_0x05a9('0x10'));var hardwareService=require(_0x05a9('0x11'));var logger=require(_0x05a9('0x12'))(_0x05a9('0x13'));var utils=require(_0x05a9('0x14'));var config=require(_0x05a9('0x15'));var licenseUtil=require(_0x05a9('0x16'));var db=require(_0x05a9('0x17'))['db'];config[_0x05a9('0x18')]=_['defaults'](config['redis'],{'host':_0x05a9('0x19'),'port':0x18eb});var socket=require(_0x05a9('0x1a'))(new Redis(config[_0x05a9('0x18')]));require(_0x05a9('0x1b'))[_0x05a9('0x1c')](socket);var jayson=require(_0x05a9('0x1d'));var client=jayson[_0x05a9('0x1e')][_0x05a9('0x1f')]({'port':0x232c});var client9002=jayson[_0x05a9('0x1e')][_0x05a9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x66383a,_0x23447e,_0x389e76,_0x77e743){return new BPromise(function(_0xe73d6b,_0x11d236){var _0x402b23=_0x77e743||client;return _0x402b23[_0x05a9('0x20')](_0x66383a,_0x389e76)[_0x05a9('0x21')](function(_0x8bc47c){logger['info']('FaxMessage,\x20%s,\x20%s',_0x23447e,_0x05a9('0x22'));logger[_0x05a9('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x23447e,_0x05a9('0x22'),JSON[_0x05a9('0x24')](_0x8bc47c));if(_0x8bc47c[_0x05a9('0x25')]){if(_0x8bc47c['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x23447e,_0x8bc47c['error'][_0x05a9('0x26')]);return _0x11d236(_0x8bc47c['error'][_0x05a9('0x26')]);}logger[_0x05a9('0x25')](_0x05a9('0x27'),_0x23447e,_0x8bc47c[_0x05a9('0x25')][_0x05a9('0x26')]);return _0xe73d6b(_0x8bc47c[_0x05a9('0x25')][_0x05a9('0x26')]);}else{logger[_0x05a9('0x28')]('FaxMessage,\x20%s,\x20%s',_0x23447e,_0x05a9('0x22'));_0xe73d6b(_0x8bc47c[_0x05a9('0x29')][_0x05a9('0x26')]);}})[_0x05a9('0x2a')](function(_0x27639f){logger['error'](_0x05a9('0x27'),_0x23447e,_0x27639f);_0x11d236(_0x27639f);});});}function respondWithStatusCode(_0x55e6e2,_0x10b4f7){_0x10b4f7=_0x10b4f7||0xcc;return function(_0x51c600){if(_0x51c600){return _0x55e6e2['sendStatus'](_0x10b4f7);}return _0x55e6e2['status'](_0x10b4f7)[_0x05a9('0x2b')]();};}function respondWithResult(_0x47fc78,_0x3d795b){_0x3d795b=_0x3d795b||0xc8;return function(_0x506134){if(_0x506134){return _0x47fc78[_0x05a9('0x2c')](_0x3d795b)['json'](_0x506134);}};}function respondWithFilteredResult(_0xad0c4a,_0x478a46){return function(_0x384674){if(_0x384674){var _0x556a3e=typeof _0x478a46[_0x05a9('0x2d')]===_0x05a9('0x2e')&&typeof _0x478a46[_0x05a9('0x2f')]===_0x05a9('0x2e');var _0x3ec909=_0x384674['count'];var _0x2a6ee1=_0x556a3e?0x0:_0x478a46['offset'];var _0x32ba76=_0x556a3e?_0x384674[_0x05a9('0x30')]:_0x478a46[_0x05a9('0x2d')]+_0x478a46[_0x05a9('0x2f')];var _0x25337a;if(_0x32ba76>=_0x3ec909){_0x32ba76=_0x3ec909;_0x25337a=0xc8;}else{_0x25337a=0xce;}_0xad0c4a[_0x05a9('0x2c')](_0x25337a);return _0xad0c4a[_0x05a9('0x31')](_0x05a9('0x32'),_0x2a6ee1+'-'+_0x32ba76+'/'+_0x3ec909)[_0x05a9('0x33')](_0x384674);}return null;};}function patchUpdates(_0x599145){return function(_0x56d935){try{jsonpatch[_0x05a9('0x34')](_0x56d935,_0x599145,!![]);}catch(_0x914cfe){return BPromise[_0x05a9('0x35')](_0x914cfe);}return _0x56d935[_0x05a9('0x36')]();};}function saveUpdates(_0x1b6b26,_0x44a78c){return function(_0x54e3df){if(_0x54e3df){return _0x54e3df['update'](_0x1b6b26)[_0x05a9('0x21')](function(_0x4ac537){return _0x4ac537;});}return null;};}function removeEntity(_0x4343a5,_0x3fbb4c){return function(_0x1619cb){if(_0x1619cb){return _0x1619cb[_0x05a9('0x37')]()['then'](function(){_0x4343a5[_0x05a9('0x2c')](0xcc)[_0x05a9('0x2b')]();});}};}function handleEntityNotFound(_0x3954d9,_0x1d9519){return function(_0x146d8f){if(!_0x146d8f){_0x3954d9[_0x05a9('0x38')](0x194);}return _0x146d8f;};}function handleError(_0x12fe6f,_0x9e9406){_0x9e9406=_0x9e9406||0x1f4;return function(_0x49cb3d){logger[_0x05a9('0x25')](_0x49cb3d[_0x05a9('0x39')]);if(_0x49cb3d['name']){delete _0x49cb3d['name'];}_0x12fe6f['status'](_0x9e9406)[_0x05a9('0x3a')](_0x49cb3d);};}exports[_0x05a9('0x3b')]=function(_0xaf3a41,_0x70f8a9){var _0x20b6c3={},_0x204922={},_0x2037eb={'count':0x0,'rows':[]};var _0x5c8b68=_[_0x05a9('0x3c')](db[_0x05a9('0x3d')]['rawAttributes'],function(_0x535448){return{'name':_0x535448[_0x05a9('0x3e')],'type':_0x535448[_0x05a9('0x3f')][_0x05a9('0x40')]};});_0x204922[_0x05a9('0x41')]=_[_0x05a9('0x3c')](_0x5c8b68,_0x05a9('0x42'));_0x204922['query']=_['keys'](_0xaf3a41[_0x05a9('0x43')]);_0x204922[_0x05a9('0x44')]=_[_0x05a9('0x45')](_0x204922['model'],_0x204922[_0x05a9('0x43')]);_0x20b6c3[_0x05a9('0x46')]=_['intersection'](_0x204922[_0x05a9('0x41')],qs['fields'](_0xaf3a41['query']['fields']));_0x20b6c3[_0x05a9('0x46')]=_0x20b6c3[_0x05a9('0x46')][_0x05a9('0x47')]?_0x20b6c3[_0x05a9('0x46')]:_0x204922[_0x05a9('0x41')];if(!_0xaf3a41[_0x05a9('0x43')][_0x05a9('0x48')](_0x05a9('0x49'))){_0x20b6c3['limit']=qs[_0x05a9('0x2f')](_0xaf3a41['query'][_0x05a9('0x2f')]);_0x20b6c3[_0x05a9('0x2d')]=qs['offset'](_0xaf3a41['query'][_0x05a9('0x2d')]);}_0x20b6c3['order']=qs[_0x05a9('0x4a')](_0xaf3a41['query'][_0x05a9('0x4a')]);_0x20b6c3[_0x05a9('0x4b')]=qs['filters'](_[_0x05a9('0x4c')](_0xaf3a41[_0x05a9('0x43')],_0x204922[_0x05a9('0x44')]),_0x5c8b68);if(_0xaf3a41[_0x05a9('0x43')][_0x05a9('0x4d')]){_0x20b6c3[_0x05a9('0x4b')]=_['merge'](_0x20b6c3[_0x05a9('0x4b')],{'$or':_[_0x05a9('0x3c')](_0x5c8b68,function(_0x162585){if(_0x162585[_0x05a9('0x3f')]!==_0x05a9('0x4e')){var _0x584134={};_0x584134[_0x162585[_0x05a9('0x42')]]={'$like':'%'+_0xaf3a41[_0x05a9('0x43')][_0x05a9('0x4d')]+'%'};return _0x584134;}})});}_0x20b6c3=_[_0x05a9('0x4f')]({},_0x20b6c3,_0xaf3a41['options']);var _0x181712={'where':_0x20b6c3[_0x05a9('0x4b')]};return db[_0x05a9('0x3d')][_0x05a9('0x30')](_0x181712)['then'](function(_0x20fbe2){_0x2037eb[_0x05a9('0x30')]=_0x20fbe2;if(_0xaf3a41[_0x05a9('0x43')]['includeAll']){_0x20b6c3[_0x05a9('0x50')]=[{'all':!![]}];}return db[_0x05a9('0x3d')][_0x05a9('0x51')](_0x20b6c3);})['then'](function(_0x4fee02){_0x2037eb[_0x05a9('0x52')]=_0x4fee02;return _0x2037eb;})['then'](respondWithFilteredResult(_0x70f8a9,_0x20b6c3))[_0x05a9('0x2a')](handleError(_0x70f8a9,null));};exports[_0x05a9('0x53')]=function(_0x1ff5a1,_0x2ad854){var _0x4b4479={'raw':!![],'where':{'id':_0x1ff5a1['params']['id']}},_0x182924={};_0x182924[_0x05a9('0x41')]=_[_0x05a9('0x54')](db[_0x05a9('0x3d')][_0x05a9('0x55')]);_0x182924['query']=_[_0x05a9('0x54')](_0x1ff5a1[_0x05a9('0x43')]);_0x182924[_0x05a9('0x44')]=_['intersection'](_0x182924[_0x05a9('0x41')],_0x182924[_0x05a9('0x43')]);_0x4b4479[_0x05a9('0x46')]=_[_0x05a9('0x45')](_0x182924[_0x05a9('0x41')],qs[_0x05a9('0x56')](_0x1ff5a1[_0x05a9('0x43')]['fields']));_0x4b4479[_0x05a9('0x46')]=_0x4b4479['attributes'][_0x05a9('0x47')]?_0x4b4479['attributes']:_0x182924[_0x05a9('0x41')];if(_0x1ff5a1[_0x05a9('0x43')]['includeAll']){_0x4b4479[_0x05a9('0x50')]=[{'all':!![]}];}_0x4b4479=_[_0x05a9('0x4f')]({},_0x4b4479,_0x1ff5a1[_0x05a9('0x57')]);return db[_0x05a9('0x3d')][_0x05a9('0x58')](_0x4b4479)['then'](handleEntityNotFound(_0x2ad854,null))[_0x05a9('0x21')](respondWithResult(_0x2ad854,null))[_0x05a9('0x2a')](handleError(_0x2ad854,null));};exports['update']=function(_0xb123f0,_0x54a1b9){if(_0xb123f0[_0x05a9('0x59')]['id']){delete _0xb123f0['body']['id'];}return db[_0x05a9('0x3d')][_0x05a9('0x58')]({'where':{'id':_0xb123f0['params']['id']}})['then'](handleEntityNotFound(_0x54a1b9,null))['then'](saveUpdates(_0xb123f0[_0x05a9('0x59')],null))[_0x05a9('0x21')](respondWithResult(_0x54a1b9,null))[_0x05a9('0x2a')](handleError(_0x54a1b9,null));};exports['destroy']=function(_0x441b33,_0x35ab65){return db[_0x05a9('0x3d')][_0x05a9('0x58')]({'where':{'id':_0x441b33['params']['id']}})[_0x05a9('0x21')](handleEntityNotFound(_0x35ab65,null))[_0x05a9('0x21')](removeEntity(_0x35ab65,null))[_0x05a9('0x2a')](handleError(_0x35ab65,null));};exports[_0x05a9('0x5a')]=function(_0x2cacb7,_0x3ad1fc){return db[_0x05a9('0x3d')][_0x05a9('0x5a')]()[_0x05a9('0x21')](respondWithResult(_0x3ad1fc,null))[_0x05a9('0x2a')](handleError(_0x3ad1fc,null));};var interaction_log=require(_0x05a9('0x12'))('fax-interactions');exports[_0x05a9('0x5b')]=function(_0x48d85f,_0x1088ba,_0x1e9091){var _0x27ec98={'agent':{},'channel':'fax'};if(_0x48d85f[_0x05a9('0x59')]['id']){delete _0x48d85f[_0x05a9('0x59')]['id'];}_0x48d85f['body'][_0x05a9('0x5c')]=!![];_0x48d85f[_0x05a9('0x59')][_0x05a9('0x5d')]=moment()[_0x05a9('0x5e')](_0x05a9('0x5f'));_0x48d85f[_0x05a9('0x59')][_0x05a9('0x60')]=_0x48d85f[_0x05a9('0x59')]['UserId']||_0x48d85f['user']['id'];_0x27ec98[_0x05a9('0x61')]['id']=_0x48d85f[_0x05a9('0x59')][_0x05a9('0x60')];return db[_0x05a9('0x3d')][_0x05a9('0x58')]({'where':{'id':_0x48d85f['params']['id'],'UserId':null}})[_0x05a9('0x21')](handleEntityNotFound(_0x1088ba,null))['then'](saveUpdates(_0x48d85f[_0x05a9('0x59')],null))['then'](function(_0x2d73ea){if(_0x2d73ea){_0x27ec98['message']=_0x2d73ea[_0x05a9('0x62')]({'plain':!![]});return db[_0x05a9('0x63')]['find']({'where':{'id':_0x2d73ea[_0x05a9('0x64')]}});}return null;})[_0x05a9('0x21')](handleEntityNotFound(_0x1088ba,null))[_0x05a9('0x21')](function(_0x966cc7){if(_0x966cc7){return _0x966cc7[_0x05a9('0x65')]({'UserId':_0x48d85f[_0x05a9('0x59')]['UserId'],'read1stAt':_['isNil'](_0x966cc7[_0x05a9('0x66')])?moment()[_0x05a9('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x05a9('0x21')](function(_0x10023d){if(_0x10023d){_0x27ec98['interaction']=_0x10023d[_0x05a9('0x62')]({'plain':!![]});interaction_log['info'](_0x05a9('0x67'),_0x48d85f[_0x05a9('0x68')]['id'],_0x48d85f[_0x05a9('0x68')][_0x05a9('0x42')],_0x48d85f[_0x05a9('0x68')][_0x05a9('0x69')],_0x27ec98[_0x05a9('0x6a')]['id'],_0x48d85f[_0x05a9('0x59')]?JSON[_0x05a9('0x24')](_0x48d85f[_0x05a9('0x59')]):_0x05a9('0x6b'));return respondWithRpcPromise(_0x05a9('0x6c'),'acceptMessage',_0x27ec98);}return null;})['then'](function(_0x7462bf){var _0x417904=_0x05a9('0x6d')+_0x7462bf[_0x05a9('0x26')][_0x05a9('0x6e')];return db['sequelize']['query'](_0x417904,{'type':db[_0x05a9('0x6f')][_0x05a9('0x70')]['SELECT'],'raw':!![]})[_0x05a9('0x21')](function(_0x329b76){return _0x329b76;});})[_0x05a9('0x21')](function(_0x172c3e){if(_0x172c3e){_0x27ec98[_0x05a9('0x26')][_0x05a9('0x71')]=_0x172c3e[0x0];if(!_0x48d85f[_0x05a9('0x59')][_0x05a9('0x60')])return;return db[_0x05a9('0x72')][_0x05a9('0x58')]({'where':{'id':_0x48d85f[_0x05a9('0x59')][_0x05a9('0x60')],'role':_0x05a9('0x61')},'attributes':['id',_0x05a9('0x42'),_0x05a9('0x73'),_0x05a9('0x74'),_0x05a9('0x75')],'raw':!![]});}return null;})[_0x05a9('0x21')](function(_0x34a0e4){if(!_0x34a0e4)return null;_0x27ec98['message']['agent']=_0x34a0e4;return _0x27ec98;})[_0x05a9('0x21')](function(_0x4e87c4){if(_0x4e87c4){if(_0x48d85f[_0x05a9('0x59')][_0x05a9('0x76')]){_0x27ec98[_0x05a9('0x26')][_0x05a9('0x77')]=util[_0x05a9('0x5e')]('SIP/%s',_0x48d85f['user'][_0x05a9('0x42')]);_0x27ec98['message'][_0x05a9('0x78')]=_0x27ec98[_0x05a9('0x78')];_0x27ec98['message'][_0x05a9('0x79')]=_0x27ec98[_0x05a9('0x78')];_0x27ec98[_0x05a9('0x26')][_0x05a9('0x7a')]=_0x05a9('0x5b');return respondWithRpcPromise(_0x05a9('0x7b'),_0x05a9('0x7b'),{'event':_0x05a9('0x7c'),'message':_0x27ec98[_0x05a9('0x26')]},client9002)[_0x05a9('0x21')](function(){return _0x27ec98;});}return _0x27ec98;}return null;})[_0x05a9('0x21')](respondWithResult(_0x1088ba,null))[_0x05a9('0x2a')](handleError(_0x1088ba,null));};var interaction_log=require(_0x05a9('0x12'))('fax-interactions');exports[_0x05a9('0x35')]=function(_0x16eb06,_0x4a4880,_0x58324d){var _0x1d4ceb={'agent':{},'channel':_0x05a9('0x7d')};if(_0x16eb06[_0x05a9('0x59')]['id']){delete _0x16eb06[_0x05a9('0x59')]['id'];}_0x16eb06['body'][_0x05a9('0x60')]=_0x16eb06[_0x05a9('0x59')][_0x05a9('0x60')]||_0x16eb06[_0x05a9('0x68')]['id'];_0x1d4ceb[_0x05a9('0x61')]['id']=_0x16eb06[_0x05a9('0x59')][_0x05a9('0x60')];return db[_0x05a9('0x3d')]['find']({'where':{'id':_0x16eb06[_0x05a9('0x7e')]['id'],'UserId':null}})[_0x05a9('0x21')](handleEntityNotFound(_0x4a4880,null))[_0x05a9('0x21')](function(_0x45ed96){if(_0x45ed96){_0x1d4ceb[_0x05a9('0x26')]=_0x45ed96[_0x05a9('0x62')]({'plain':!![]});return db[_0x05a9('0x63')][_0x05a9('0x58')]({'where':{'id':_0x45ed96[_0x05a9('0x64')]}});}return null;})[_0x05a9('0x21')](handleEntityNotFound(_0x4a4880,null))[_0x05a9('0x21')](function(_0x31cbe4){if(_0x31cbe4){_0x1d4ceb[_0x05a9('0x6a')]=_0x31cbe4['get']({'plain':!![]});interaction_log[_0x05a9('0x28')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x16eb06[_0x05a9('0x68')]['id'],_0x16eb06[_0x05a9('0x68')][_0x05a9('0x42')],_0x16eb06['user']['role'],_0x1d4ceb['interaction']['id'],_0x16eb06[_0x05a9('0x59')]?JSON[_0x05a9('0x24')](_0x16eb06[_0x05a9('0x59')]):'null');return respondWithRpcPromise(_0x05a9('0x7f'),_0x05a9('0x80'),_0x1d4ceb);}return null;})[_0x05a9('0x21')](function(_0x489e61){var _0x47e981=_0x05a9('0x6d')+_0x489e61[_0x05a9('0x26')]['ContactId'];return db[_0x05a9('0x81')][_0x05a9('0x43')](_0x47e981,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x05a9('0x21')](function(_0x472598){return _0x472598;});})[_0x05a9('0x21')](function(_0x452f5f){if(_0x452f5f){_0x1d4ceb[_0x05a9('0x26')][_0x05a9('0x71')]=_0x452f5f[0x0];if(!_0x16eb06[_0x05a9('0x59')][_0x05a9('0x60')])return;return db[_0x05a9('0x72')][_0x05a9('0x58')]({'where':{'id':_0x16eb06[_0x05a9('0x59')][_0x05a9('0x60')],'role':_0x05a9('0x61')},'attributes':['id','name',_0x05a9('0x73'),_0x05a9('0x74'),_0x05a9('0x75')],'raw':!![]});}return null;})[_0x05a9('0x21')](function(_0x55e3ca){if(!_0x55e3ca)return null;_0x1d4ceb[_0x05a9('0x26')][_0x05a9('0x61')]=_0x55e3ca;return _0x1d4ceb;})[_0x05a9('0x21')](function(_0x26aab2){if(_0x26aab2){_0x26aab2['message'][_0x05a9('0x77')]=util[_0x05a9('0x5e')]('SIP/%s',_0x16eb06['user']['name']);_0x26aab2[_0x05a9('0x26')][_0x05a9('0x78')]=_0x1d4ceb[_0x05a9('0x78')];_0x26aab2['message'][_0x05a9('0x79')]=_0x1d4ceb[_0x05a9('0x78')];_0x26aab2[_0x05a9('0x26')][_0x05a9('0x7a')]=_0x05a9('0x35');respondWithRpcPromise(_0x05a9('0x7b'),_0x05a9('0x7b'),{'event':'rejectmessage','message':_0x26aab2[_0x05a9('0x26')]},client9002);return _0x1d4ceb;}return null;})[_0x05a9('0x21')](respondWithResult(_0x4a4880,null))['catch'](handleError(_0x4a4880,null));};exports['create']=function(_0x44b309,_0x20d29c){var _0x72611b;return db['FaxMessage'][_0x05a9('0x82')](_0x44b309[_0x05a9('0x59')],{})[_0x05a9('0x21')](function(_0x540574){_0x72611b=_0x540574;return db[_0x05a9('0x83')][_0x05a9('0x84')]({'where':{'id':_0x72611b[_0x05a9('0x6e')]}});})[_0x05a9('0x21')](function(_0xaddf49){if(_[_0x05a9('0x85')](_0xaddf49)){return;}else{_0x72611b['fax']=_0xaddf49['fax'];return db[_0x05a9('0x86')]['findOne']({'where':{'id':_0x72611b['AttachmentId']}});}})[_0x05a9('0x21')](function(_0x3e0bf7){return respondWithRpcPromise('SendFax',_0x05a9('0x87'),{'FaxAccountId':_['isNil'](_0x44b309[_0x05a9('0x59')])?undefined:_0x44b309[_0x05a9('0x59')]['FaxAccountId'],'path':_[_0x05a9('0x85')](_0x3e0bf7)?undefined:util[_0x05a9('0x5e')](_0x05a9('0x88'),_0x3e0bf7[_0x05a9('0x89')]),'fax':_[_0x05a9('0x85')](_0x72611b[_0x05a9('0x7d')])?undefined:_0x72611b[_0x05a9('0x7d')],'AttachmentId':_0x72611b['AttachmentId']},client9002);})[_0x05a9('0x21')](respondWithResult(_0x20d29c,0xc9))[_0x05a9('0x2a')](handleError(_0x20d29c,null));};exports[_0x05a9('0x8a')]=function(_0x217547,_0x58ccdb){var _0x1f2841=path[_0x05a9('0x8b')](config[_0x05a9('0x8c')],'server',_0x05a9('0x8d'),_0x05a9('0x8e'));return db['FaxMessage']['find']({'where':{'id':_0x217547[_0x05a9('0x7e')]['id']},'include':[{'model':db['Attachment'],'as':_0x05a9('0x86')}]})[_0x05a9('0x21')](handleEntityNotFound(_0x58ccdb,null))['then'](function(_0x1641d6){if(_0x1641d6){return _0x58ccdb['download'](path[_0x05a9('0x8b')](_0x1f2841,_0x1641d6[_0x05a9('0x86')][_0x05a9('0x89')]));}})[_0x05a9('0x2a')](handleError(_0x58ccdb,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8f037f7..fcd4f84 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 _0x8277=['update','emit','hook','exports','../../mysqldb','FaxMessage','save'];(function(_0x3547b9,_0x1b90e6){var _0x174db6=function(_0x4395e9){while(--_0x4395e9){_0x3547b9['push'](_0x3547b9['shift']());}};_0x174db6(++_0x1b90e6);}(_0x8277,0xcf));var _0x7827=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x8277[_0x1bd323];return _0x13097b;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x7827('0x0'))['db'][_0x7827('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7827('0x2'),'afterUpdate':_0x7827('0x3'),'afterDestroy':'remove'};function emitEvent(_0x141f27){return function(_0x202d8c,_0x56f066,_0x248be2){FaxMessageEvents[_0x7827('0x4')](_0x141f27+':'+_0x202d8c['id'],_0x202d8c);FaxMessageEvents[_0x7827('0x4')](_0x141f27,_0x202d8c);_0x248be2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x7827('0x5')](e,emitEvent(event));}}module[_0x7827('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x8277=['update','emit','hook','exports','../../mysqldb','FaxMessage','save'];(function(_0x3cdc35,_0x37b3d9){var _0x4b1e8d=function(_0x2901a5){while(--_0x2901a5){_0x3cdc35['push'](_0x3cdc35['shift']());}};_0x4b1e8d(++_0x37b3d9);}(_0x8277,0xcf));var _0x7827=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x8277[_0x3fa7d3];return _0x4c51bd;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x7827('0x0'))['db'][_0x7827('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7827('0x2'),'afterUpdate':_0x7827('0x3'),'afterDestroy':'remove'};function emitEvent(_0x141f27){return function(_0x202d8c,_0x56f066,_0x248be2){FaxMessageEvents[_0x7827('0x4')](_0x141f27+':'+_0x202d8c['id'],_0x202d8c);FaxMessageEvents[_0x7827('0x4')](_0x141f27,_0x202d8c);_0x248be2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x7827('0x5')](e,emitEvent(event));}}module[_0x7827('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d52c50e..c743dfd 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 _0x3b62=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','FaxMessage','fax_messages','fti_fax_messages','body','direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId'];(function(_0x16d2c7,_0x5bf3c0){var _0x1c9a0a=function(_0x5c6187){while(--_0x5c6187){_0x16d2c7['push'](_0x16d2c7['shift']());}};_0x1c9a0a(++_0x5bf3c0);}(_0x3b62,0xf6));var _0x23b6=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0x3b62[_0x33ca22];return _0x1790c3;};'use strict';var _=require(_0x23b6('0x0'));var util=require(_0x23b6('0x1'));var logger=require(_0x23b6('0x2'))(_0x23b6('0x3'));var moment=require(_0x23b6('0x4'));var BPromise=require(_0x23b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x359a2d,_0x34c38b){return _0x359a2d['define'](_0x23b6('0x7'),attributes,{'tableName':_0x23b6('0x8'),'paranoid':![],'indexes':[{'name':_0x23b6('0x9'),'fields':[_0x23b6('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10aa28,_0x1daaa5,_0x53437c){var _0xa908d=_0x359a2d['models'];var _0x6bede6=_0x10aa28['get']({'plain':!![]});if(_0x6bede6[_0x23b6('0xb')][_0x23b6('0xc')]()==='in'||_0x6bede6[_0x23b6('0xb')][_0x23b6('0xc')]()===_0x23b6('0xd')&&!_0x6bede6[_0x23b6('0xe')]&&!_['isNil'](_0x6bede6['UserId'])){_0xa908d[_0x23b6('0xf')][_0x23b6('0x10')]({'where':{'id':_0x6bede6[_0x23b6('0x11')]}})['then'](function(_0x2b6fc4){if(_0x2b6fc4){_0x2b6fc4[_0x23b6('0x12')]({'lastMsgAt':_0x6bede6[_0x23b6('0x13')],'lastMsgDirection':_0x6bede6[_0x23b6('0xb')][_0x23b6('0xc')]()});}})[_0x23b6('0x14')](function(_0x199015){console[_0x23b6('0x15')](_0x199015);});}_0x53437c();}},'charset':_0x23b6('0x16'),'collate':_0x23b6('0x17')});}; \ No newline at end of file +var _0x69e7=['get','direction','toLowerCase','secret','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models'];(function(_0x26425a,_0x1b4d6f){var _0x12802a=function(_0x5db8a7){while(--_0x5db8a7){_0x26425a['push'](_0x26425a['shift']());}};_0x12802a(++_0x1b4d6f);}(_0x69e7,0x181));var _0x769e=function(_0x365d4e,_0x413d54){_0x365d4e=_0x365d4e-0x0;var _0x28e7f8=_0x69e7[_0x365d4e];return _0x28e7f8;};'use strict';var _=require(_0x769e('0x0'));var util=require(_0x769e('0x1'));var logger=require(_0x769e('0x2'))(_0x769e('0x3'));var moment=require(_0x769e('0x4'));var BPromise=require(_0x769e('0x5'));var rp=require(_0x769e('0x6'));var fs=require('fs');var path=require(_0x769e('0x7'));var rimraf=require(_0x769e('0x8'));var config=require(_0x769e('0x9'));var attributes=require(_0x769e('0xa'));module[_0x769e('0xb')]=function(_0x4faebd,_0x4ba1c4){return _0x4faebd[_0x769e('0xc')](_0x769e('0xd'),attributes,{'tableName':_0x769e('0xe'),'paranoid':![],'indexes':[{'name':_0x769e('0xf'),'fields':[_0x769e('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23158a,_0x143f6e,_0x124a94){var _0xff37ce=_0x4faebd[_0x769e('0x11')];var _0x42832f=_0x23158a[_0x769e('0x12')]({'plain':!![]});if(_0x42832f[_0x769e('0x13')][_0x769e('0x14')]()==='in'||_0x42832f[_0x769e('0x13')][_0x769e('0x14')]()==='out'&&!_0x42832f[_0x769e('0x15')]&&!_[_0x769e('0x16')](_0x42832f[_0x769e('0x17')])){_0xff37ce['FaxInteraction'][_0x769e('0x18')]({'where':{'id':_0x42832f[_0x769e('0x19')]}})['then'](function(_0x1724d1){if(_0x1724d1){_0x1724d1[_0x769e('0x1a')]({'lastMsgAt':_0x42832f[_0x769e('0x1b')],'lastMsgDirection':_0x42832f[_0x769e('0x13')][_0x769e('0x14')]()});}})[_0x769e('0x1c')](function(_0x33b4be){console[_0x769e('0x1d')](_0x33b4be);});}_0x124a94();}},'charset':'utf8mb4','collate':_0x769e('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 773504c..3d01f21 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 _0xeec6=['FaxMessage','create','body','options','then','catch','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage'];(function(_0x237d3f,_0xc42220){var _0x37e73b=function(_0x107caa){while(--_0x107caa){_0x237d3f['push'](_0x237d3f['shift']());}};_0x37e73b(++_0xc42220);}(_0xeec6,0x1c2));var _0x6eec=function(_0x32917a,_0x3559ea){_0x32917a=_0x32917a-0x0;var _0x1881e1=_0xeec6[_0x32917a];return _0x1881e1;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});}exports[_0x6eec('0x1d')]=function(_0xd86135){var _0x1761f4=this;return new Promise(function(_0x536429,_0x328693){return db[_0x6eec('0x1e')][_0x6eec('0x1f')](_0xd86135[_0x6eec('0x20')],{'raw':_0xd86135[_0x6eec('0x21')]?_0xd86135[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6eec('0x22')](function(_0x852d08){logger[_0x6eec('0x13')](_0x6eec('0x1d'),_0xd86135);logger[_0x6eec('0x15')](_0x6eec('0x1d'),_0xd86135,JSON['stringify'](_0x852d08));_0x536429(_0x852d08);})[_0x6eec('0x23')](function(_0x2ad14b){logger[_0x6eec('0x18')](_0x6eec('0x1d'),_0x2ad14b[_0x6eec('0x1b')],_0xd86135);_0x328693(_0x1761f4[_0x6eec('0x18')](0x1f4,_0x2ad14b[_0x6eec('0x1b')]));});});};exports[_0x6eec('0x24')]=function(_0x316317){var _0x58f95c=this;return new Promise(function(_0x1d750c,_0x44b31c){return db[_0x6eec('0x1e')][_0x6eec('0x25')](_0x316317['body'],{'raw':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316317['options']?_0x316317[_0x6eec('0x21')]['where']||null:null,'attributes':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x26')]||null:null,'limit':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x27')]||null:null})[_0x6eec('0x22')](function(_0x33e4a1){logger[_0x6eec('0x13')](_0x6eec('0x24'),_0x316317);logger['debug'](_0x6eec('0x24'),_0x316317,JSON['stringify'](_0x33e4a1));_0x1d750c(_0x33e4a1);})[_0x6eec('0x23')](function(_0x125bfc){logger[_0x6eec('0x18')]('UpdateFaxMessage',_0x125bfc['message'],_0x316317);_0x44b31c(_0x58f95c['error'](0x1f4,_0x125bfc[_0x6eec('0x1b')]));});});}; \ No newline at end of file +var _0x84ab=['code','message','result','catch','FaxMessage','create','body','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47aad7,_0x75a3c0){var _0xf932c0=function(_0x1d2a5b){while(--_0x1d2a5b){_0x47aad7['push'](_0x47aad7['shift']());}};_0xf932c0(++_0x75a3c0);}(_0x84ab,0x12f));var _0xb84a=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x84ab[_0x33fcbb];return _0x2efe40;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb84a('0xa')](config['redis'],{'host':_0xb84a('0xb'),'port':0x18eb});var socket=require(_0xb84a('0xc'))(new Redis(config['redis']));require(_0xb84a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e6a71,_0x1886e0,_0x42daf5){return new BPromise(function(_0x5d3b29,_0x5a34f7){return client['request'](_0x2e6a71,_0x42daf5)[_0xb84a('0xe')](function(_0x17379b){logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));logger['debug'](_0xb84a('0x12'),_0x1886e0,_0xb84a('0x11'),JSON[_0xb84a('0x13')](_0x17379b));if(_0x17379b[_0xb84a('0x14')]){if(_0x17379b[_0xb84a('0x14')][_0xb84a('0x15')]===0x1f4){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5a34f7(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}logger['error'](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5d3b29(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}else{logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));_0x5d3b29(_0x17379b[_0xb84a('0x17')][_0xb84a('0x16')]);}})[_0xb84a('0x18')](function(_0x2de49c){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x2de49c);_0x5a34f7(_0x2de49c);});});}exports['CreateFaxMessage']=function(_0x1a0056){var _0x319216=this;return new Promise(function(_0x55a633,_0xac76d3){return db[_0xb84a('0x19')][_0xb84a('0x1a')](_0x1a0056[_0xb84a('0x1b')],{'raw':_0x1a0056['options']?_0x1a0056['options'][_0xb84a('0x1c')]===undefined?!![]:![]:!![]})[_0xb84a('0xe')](function(_0x2d70fd){logger[_0xb84a('0xf')](_0xb84a('0x1d'),_0x1a0056);logger[_0xb84a('0x1e')](_0xb84a('0x1d'),_0x1a0056,JSON[_0xb84a('0x13')](_0x2d70fd));_0x55a633(_0x2d70fd);})[_0xb84a('0x18')](function(_0x26fe42){logger[_0xb84a('0x14')](_0xb84a('0x1d'),_0x26fe42[_0xb84a('0x16')],_0x1a0056);_0xac76d3(_0x319216[_0xb84a('0x14')](0x1f4,_0x26fe42[_0xb84a('0x16')]));});});};exports[_0xb84a('0x1f')]=function(_0x378ce1){var _0x3ff0bc=this;return new Promise(function(_0x3b6805,_0xd468c3){return db[_0xb84a('0x19')][_0xb84a('0x20')](_0x378ce1[_0xb84a('0x1b')],{'raw':_0x378ce1[_0xb84a('0x21')]?_0x378ce1[_0xb84a('0x21')][_0xb84a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378ce1['options']?_0x378ce1['options'][_0xb84a('0x22')]||null:null,'attributes':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options'][_0xb84a('0x23')]||null:null,'limit':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options']['limit']||null:null})[_0xb84a('0xe')](function(_0x8e9319){logger['info'](_0xb84a('0x1f'),_0x378ce1);logger[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x378ce1,JSON[_0xb84a('0x13')](_0x8e9319));_0x3b6805(_0x8e9319);})[_0xb84a('0x18')](function(_0x144c25){logger[_0xb84a('0x14')](_0xb84a('0x1f'),_0x144c25['message'],_0x378ce1);_0xd468c3(_0x3ff0bc[_0xb84a('0x14')](0x1f4,_0x144c25['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 61de413..5544faa 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 _0x6732=['./faxMessage.events','remove','emit','removeListener','register','faxMessage:'];(function(_0x51652a,_0x5144fc){var _0xae7099=function(_0x4b239b){while(--_0x4b239b){_0x51652a['push'](_0x51652a['shift']());}};_0xae7099(++_0x5144fc);}(_0x6732,0x18c));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require(_0x2673('0x0'));var events=['save',_0x2673('0x1'),'update'];function createListener(_0x201ab0,_0xec7172){return function(_0x41307b){_0xec7172[_0x2673('0x2')](_0x201ab0,_0x41307b);};}function removeListener(_0x26e316,_0xb490bc){return function(){FaxMessageEvents[_0x2673('0x3')](_0x26e316,_0xb490bc);};}exports[_0x2673('0x4')]=function(_0x2afa87){for(var _0x556f2e=0x0,_0x234155=events['length'];_0x556f2e<_0x234155;_0x556f2e++){var _0x2c969a=events[_0x556f2e];var _0x327893=createListener(_0x2673('0x5')+_0x2c969a,_0x2afa87);FaxMessageEvents['on'](_0x2c969a,_0x327893);}}; \ No newline at end of file +var _0x4f15=['faxMessage:','save','update','emit','register'];(function(_0x4ee4d4,_0xf296eb){var _0x8274de=function(_0x1a05f8){while(--_0x1a05f8){_0x4ee4d4['push'](_0x4ee4d4['shift']());}};_0x8274de(++_0xf296eb);}(_0x4f15,0x123));var _0x54f1=function(_0x306723,_0x1bcbc7){_0x306723=_0x306723-0x0;var _0x10b9fc=_0x4f15[_0x306723];return _0x10b9fc;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x54f1('0x0'),'remove',_0x54f1('0x1')];function createListener(_0x23e292,_0x4f3ef5){return function(_0x30311a){_0x4f3ef5[_0x54f1('0x2')](_0x23e292,_0x30311a);};}function removeListener(_0xdcfd19,_0x1a389b){return function(){FaxMessageEvents['removeListener'](_0xdcfd19,_0x1a389b);};}exports[_0x54f1('0x3')]=function(_0x1b7a71){for(var _0x6ed6d7=0x0,_0x2a2079=events['length'];_0x6ed6d7<_0x2a2079;_0x6ed6d7++){var _0x3997df=events[_0x6ed6d7];var _0x3d93c7=createListener(_0x54f1('0x4')+_0x3997df,_0x1b7a71);FaxMessageEvents['on'](_0x3997df,_0x3d93c7);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c2d3dda..0f53f21 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 _0x4ded=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','download','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x1bf5c2,_0x44f4d7){var _0x4a46fb=function(_0x5c71c0){while(--_0x5c71c0){_0x1bf5c2['push'](_0x1bf5c2['shift']());}};_0x4a46fb(++_0x44f4d7);}(_0x4ded,0x116));var _0xd4de=function(_0x3e026e,_0x1095bd){_0x3e026e=_0x3e026e-0x0;var _0x3076ad=_0x4ded[_0x3e026e];return _0x3076ad;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var fs_extra=require(_0xd4de('0x6'));var auth=require(_0xd4de('0x7'));var interaction=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var controller=require(_0xd4de('0xa'));router[_0xd4de('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xb')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0xb')]('/:id',auth[_0xd4de('0xe')](),controller['show']);router['get']('/:id/download',auth[_0xd4de('0xe')](),controller[_0xd4de('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xd4de('0x11'),'faxmessage:create'),controller[_0xd4de('0x12')]);router[_0xd4de('0x13')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x15')]);router[_0xd4de('0x13')](_0xd4de('0x16'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x17')]);router[_0xd4de('0x13')](_0xd4de('0x18'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x19')]);router[_0xd4de('0x1a')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5b02=['put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','show','download','post','tracked','fax','faxmessage:create','create'];(function(_0x2906e7,_0x489d22){var _0x1211cd=function(_0x2686cd){while(--_0x2686cd){_0x2906e7['push'](_0x2906e7['shift']());}};_0x1211cd(++_0x489d22);}(_0x5b02,0xe9));var _0x25b0=function(_0x505fb5,_0x46b8a8){_0x505fb5=_0x505fb5-0x0;var _0x4a468b=_0x5b02[_0x505fb5];return _0x4a468b;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x8')]('/:id/download',auth[_0x25b0('0x9')](),controller[_0x25b0('0xd')]);router[_0x25b0('0xe')]('/',auth[_0x25b0('0x9')](),interaction[_0x25b0('0xf')](_0x25b0('0x10'),_0x25b0('0x11')),controller[_0x25b0('0x12')]);router[_0x25b0('0x13')](_0x25b0('0x14'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x15')]);router[_0x25b0('0x13')](_0x25b0('0x16'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x17')]);router[_0x25b0('0x13')](_0x25b0('0x18'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x19')]);router[_0x25b0('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x25b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 58834d1..1eb7e3c 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 _0x2c49=['exports','STRING','name','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x26a3de,_0x4f8ccb){var _0x26f6db=function(_0x2f03aa){while(--_0x2f03aa){_0x26a3de['push'](_0x26a3de['shift']());}};_0x26f6db(++_0x4f8ccb);}(_0x2c49,0xc3));var _0x92c4=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x2c49[_0x2d1971];return _0x4d7759;};'use strict';var Sequelize=require(_0x92c4('0x0'));module[_0x92c4('0x1')]={'name':{'type':Sequelize[_0x92c4('0x2')],'unique':_0x92c4('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92c4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x92c4('0x4')](_0x92c4('0x5'),'beepall',_0x92c4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf35d=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x283cb2,_0x5bd3d4){var _0x2a1ba5=function(_0x4fd00c){while(--_0x4fd00c){_0x283cb2['push'](_0x283cb2['shift']());}};_0x2a1ba5(++_0x5bd3d4);}(_0xf35d,0xcc));var _0xdf35=function(_0x20d883,_0x223781){_0x20d883=_0x20d883-0x0;var _0x22d006=_0xf35d[_0x20d883];return _0x22d006;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf35('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdf35('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf35('0x2')](_0xdf35('0x3'),_0xdf35('0x4'),_0xdf35('0x5')),'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 6b2869e..d4f41fc 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 _0xf45b=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserFaxQueue','FaxQueueId','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','ids','Team','Agents','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','getAgents','eml-format','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','status','error','name','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0xbb7293,_0x2d31fc){var _0x13a139=function(_0x1cd719){while(--_0x1cd719){_0xbb7293['push'](_0xbb7293['shift']());}};_0x13a139(++_0x2d31fc);}(_0xf45b,0x1f2));var _0xbf45=function(_0x265e81,_0x514eff){_0x265e81=_0x265e81-0x0;var _0x55b6b7=_0xf45b[_0x265e81];return _0x55b6b7;};'use strict';var emlformat=require(_0xbf45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf45('0x2'));var BPromise=require(_0xbf45('0x3'));var Mustache=require(_0xbf45('0x4'));var util=require('util');var path=require(_0xbf45('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf45('0x6'));var fs=require('fs');var fs_extra=require(_0xbf45('0x7'));var _=require(_0xbf45('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf45('0x9'));var querystring=require('querystring');var Papa=require(_0xbf45('0xa'));var Redis=require(_0xbf45('0xb'));var authService=require(_0xbf45('0xc'));var qs=require(_0xbf45('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf45('0xe'));var logger=require(_0xbf45('0xf'))('api');var utils=require(_0xbf45('0x10'));var config=require(_0xbf45('0x11'));var licenseUtil=require(_0xbf45('0x12'));var db=require(_0xbf45('0x13'))['db'];config[_0xbf45('0x14')]=_[_0xbf45('0x15')](config[_0xbf45('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf45('0x16'))(new Redis(config[_0xbf45('0x14')]));require(_0xbf45('0x17'))[_0xbf45('0x18')](socket);function respondWithStatusCode(_0x4b3e7b,_0x486840){_0x486840=_0x486840||0xcc;return function(_0x45c348){if(_0x45c348){return _0x4b3e7b[_0xbf45('0x19')](_0x486840);}return _0x4b3e7b['status'](_0x486840)[_0xbf45('0x1a')]();};}function respondWithResult(_0x226ba6,_0x285d04){_0x285d04=_0x285d04||0xc8;return function(_0x1eedbb){if(_0x1eedbb){return _0x226ba6['status'](_0x285d04)[_0xbf45('0x1b')](_0x1eedbb);}};}function respondWithFilteredResult(_0x620e4a,_0x36ed02){return function(_0x16b3d7){if(_0x16b3d7){var _0x754145=typeof _0x36ed02[_0xbf45('0x1c')]===_0xbf45('0x1d')&&typeof _0x36ed02[_0xbf45('0x1e')]===_0xbf45('0x1d');var _0x420835=_0x16b3d7[_0xbf45('0x1f')];var _0x5c9cd4=_0x754145?0x0:_0x36ed02[_0xbf45('0x1c')];var _0x155fa1=_0x754145?_0x16b3d7[_0xbf45('0x1f')]:_0x36ed02['offset']+_0x36ed02[_0xbf45('0x1e')];var _0x175b85;if(_0x155fa1>=_0x420835){_0x155fa1=_0x420835;_0x175b85=0xc8;}else{_0x175b85=0xce;}_0x620e4a['status'](_0x175b85);return _0x620e4a[_0xbf45('0x20')](_0xbf45('0x21'),_0x5c9cd4+'-'+_0x155fa1+'/'+_0x420835)[_0xbf45('0x1b')](_0x16b3d7);}return null;};}function patchUpdates(_0x410e6d){return function(_0x189a7e){try{jsonpatch[_0xbf45('0x22')](_0x189a7e,_0x410e6d,!![]);}catch(_0x2dd882){return BPromise[_0xbf45('0x23')](_0x2dd882);}return _0x189a7e[_0xbf45('0x24')]();};}function saveUpdates(_0x5a6e3f,_0x1fb9e5){return function(_0x1adca1){if(_0x1adca1){return _0x1adca1['update'](_0x5a6e3f)[_0xbf45('0x25')](function(_0x25cf40){return _0x25cf40;});}return null;};}function removeEntity(_0x348386,_0x3cd3c1){return function(_0x5c4826){if(_0x5c4826){return _0x5c4826[_0xbf45('0x26')]()[_0xbf45('0x25')](function(){var _0x7a8436=_0x5c4826[_0xbf45('0x27')]({'plain':!![]});var _0x1fa280=_0xbf45('0x28');return db[_0xbf45('0x29')]['destroy']({'where':{'type':_0x1fa280,'resourceId':_0x7a8436['id']}})['then'](function(){return _0x5c4826;});})[_0xbf45('0x25')](function(){_0x348386[_0xbf45('0x2a')](0xcc)[_0xbf45('0x1a')]();});}};}function handleEntityNotFound(_0x14237e,_0x5b4072){return function(_0xdef6d3){if(!_0xdef6d3){_0x14237e[_0xbf45('0x19')](0x194);}return _0xdef6d3;};}function handleError(_0x56e6c1,_0x343193){_0x343193=_0x343193||0x1f4;return function(_0x3b75be){logger[_0xbf45('0x2b')](_0x3b75be['stack']);if(_0x3b75be[_0xbf45('0x2c')]){delete _0x3b75be[_0xbf45('0x2c')];}_0x56e6c1['status'](_0x343193)['send'](_0x3b75be);};}exports['index']=function(_0x3c5778,_0x24a258){var _0xcc62bc={},_0x501a24={},_0x563421={'count':0x0,'rows':[]};var _0x5de6f2=_[_0xbf45('0x2d')](db[_0xbf45('0x2e')][_0xbf45('0x2f')],function(_0x57b543){return{'name':_0x57b543[_0xbf45('0x30')],'type':_0x57b543[_0xbf45('0x31')][_0xbf45('0x32')]};});_0x501a24[_0xbf45('0x33')]=_[_0xbf45('0x2d')](_0x5de6f2,_0xbf45('0x2c'));_0x501a24[_0xbf45('0x34')]=_[_0xbf45('0x35')](_0x3c5778[_0xbf45('0x34')]);_0x501a24['filters']=_[_0xbf45('0x36')](_0x501a24[_0xbf45('0x33')],_0x501a24['query']);_0xcc62bc[_0xbf45('0x37')]=_[_0xbf45('0x36')](_0x501a24[_0xbf45('0x33')],qs[_0xbf45('0x38')](_0x3c5778[_0xbf45('0x34')]['fields']));_0xcc62bc['attributes']=_0xcc62bc['attributes'][_0xbf45('0x39')]?_0xcc62bc['attributes']:_0x501a24[_0xbf45('0x33')];if(!_0x3c5778['query'][_0xbf45('0x3a')](_0xbf45('0x3b'))){_0xcc62bc['limit']=qs[_0xbf45('0x1e')](_0x3c5778[_0xbf45('0x34')]['limit']);_0xcc62bc['offset']=qs[_0xbf45('0x1c')](_0x3c5778[_0xbf45('0x34')][_0xbf45('0x1c')]);}_0xcc62bc[_0xbf45('0x3c')]=qs['sort'](_0x3c5778[_0xbf45('0x34')][_0xbf45('0x3d')]);_0xcc62bc[_0xbf45('0x3e')]=qs[_0xbf45('0x3f')](_[_0xbf45('0x40')](_0x3c5778[_0xbf45('0x34')],_0x501a24[_0xbf45('0x3f')]),_0x5de6f2);if(_0x3c5778[_0xbf45('0x34')][_0xbf45('0x41')]){_0xcc62bc[_0xbf45('0x3e')]=_[_0xbf45('0x42')](_0xcc62bc[_0xbf45('0x3e')],{'$or':_[_0xbf45('0x2d')](_0x5de6f2,function(_0xb67052){if(_0xb67052['type']!==_0xbf45('0x43')){var _0x1cb22e={};_0x1cb22e[_0xb67052[_0xbf45('0x2c')]]={'$like':'%'+_0x3c5778['query'][_0xbf45('0x41')]+'%'};return _0x1cb22e;}})});}_0xcc62bc=_[_0xbf45('0x42')]({},_0xcc62bc,_0x3c5778[_0xbf45('0x44')]);var _0x48339e={'where':_0xcc62bc['where']};return db[_0xbf45('0x2e')][_0xbf45('0x1f')](_0x48339e)[_0xbf45('0x25')](function(_0x2b2078){_0x563421[_0xbf45('0x1f')]=_0x2b2078;if(_0x3c5778[_0xbf45('0x34')]['includeAll']){_0xcc62bc[_0xbf45('0x45')]=[{'all':!![]}];}return db['FaxQueue'][_0xbf45('0x46')](_0xcc62bc);})[_0xbf45('0x25')](function(_0xd1a917){_0x563421[_0xbf45('0x47')]=_0xd1a917;return _0x563421;})[_0xbf45('0x25')](respondWithFilteredResult(_0x24a258,_0xcc62bc))['catch'](handleError(_0x24a258,null));};exports['show']=function(_0xb537cd,_0x8d44ad){var _0x5e96e0={'raw':!![],'where':{'id':_0xb537cd[_0xbf45('0x48')]['id']}},_0x31c22={};_0x31c22[_0xbf45('0x33')]=_[_0xbf45('0x35')](db['FaxQueue'][_0xbf45('0x2f')]);_0x31c22[_0xbf45('0x34')]=_[_0xbf45('0x35')](_0xb537cd[_0xbf45('0x34')]);_0x31c22[_0xbf45('0x3f')]=_['intersection'](_0x31c22[_0xbf45('0x33')],_0x31c22['query']);_0x5e96e0[_0xbf45('0x37')]=_[_0xbf45('0x36')](_0x31c22[_0xbf45('0x33')],qs[_0xbf45('0x38')](_0xb537cd[_0xbf45('0x34')][_0xbf45('0x38')]));_0x5e96e0[_0xbf45('0x37')]=_0x5e96e0[_0xbf45('0x37')][_0xbf45('0x39')]?_0x5e96e0[_0xbf45('0x37')]:_0x31c22['model'];if(_0xb537cd[_0xbf45('0x34')]['includeAll']){_0x5e96e0['include']=[{'all':!![]}];}_0x5e96e0=_[_0xbf45('0x42')]({},_0x5e96e0,_0xb537cd[_0xbf45('0x44')]);return db[_0xbf45('0x2e')][_0xbf45('0x49')](_0x5e96e0)[_0xbf45('0x25')](handleEntityNotFound(_0x8d44ad,null))[_0xbf45('0x25')](respondWithResult(_0x8d44ad,null))[_0xbf45('0x4a')](handleError(_0x8d44ad,null));};exports[_0xbf45('0x4b')]=function(_0x4b34bf,_0x695378){return db[_0xbf45('0x2e')][_0xbf45('0x4b')](_0x4b34bf[_0xbf45('0x4c')],{})[_0xbf45('0x25')](function(_0x5605f6){var _0x31a892=_0x4b34bf[_0xbf45('0x4d')][_0xbf45('0x27')]({'plain':!![]});if(!_0x31a892)throw new Error(_0xbf45('0x4e'));if(_0x31a892[_0xbf45('0x4f')]===_0xbf45('0x4d')){var _0x7e0a35=_0x5605f6[_0xbf45('0x27')]({'plain':!![]});var _0x83ceb1=_0xbf45('0x28');return db[_0xbf45('0x50')][_0xbf45('0x49')]({'where':{'name':_0x83ceb1,'userProfileId':_0x31a892[_0xbf45('0x51')]},'raw':!![]})['then'](function(_0x3b5ad6){if(_0x3b5ad6&&_0x3b5ad6[_0xbf45('0x52')]===0x0){return db['UserProfileResource'][_0xbf45('0x4b')]({'name':_0x7e0a35[_0xbf45('0x2c')],'resourceId':_0x7e0a35['id'],'type':_0x3b5ad6[_0xbf45('0x2c')],'sectionId':_0x3b5ad6['id']},{})[_0xbf45('0x25')](function(){return _0x5605f6;});}else{return _0x5605f6;}})['catch'](function(_0x32dbc3){logger[_0xbf45('0x2b')](_0xbf45('0x53'),_0x32dbc3);throw _0x32dbc3;});}return _0x5605f6;})[_0xbf45('0x25')](respondWithResult(_0x695378,0xc9))[_0xbf45('0x4a')](handleError(_0x695378,null));};exports[_0xbf45('0x54')]=function(_0x1ee75d,_0x56036a){if(_0x1ee75d[_0xbf45('0x4c')]['id']){delete _0x1ee75d[_0xbf45('0x4c')]['id'];}return db[_0xbf45('0x2e')][_0xbf45('0x49')]({'where':{'id':_0x1ee75d[_0xbf45('0x48')]['id']}})['then'](handleEntityNotFound(_0x56036a,null))[_0xbf45('0x25')](saveUpdates(_0x1ee75d[_0xbf45('0x4c')],null))[_0xbf45('0x25')](respondWithResult(_0x56036a,null))[_0xbf45('0x4a')](handleError(_0x56036a,null));};exports[_0xbf45('0x26')]=function(_0x540dcb,_0x3e928a){return db[_0xbf45('0x2e')][_0xbf45('0x49')]({'where':{'id':_0x540dcb[_0xbf45('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e928a,null))['then'](removeEntity(_0x3e928a,null))[_0xbf45('0x4a')](handleError(_0x3e928a,null));};exports[_0xbf45('0x55')]=function(_0x441496,_0x22c1ec){return db[_0xbf45('0x2e')][_0xbf45('0x55')]()[_0xbf45('0x25')](respondWithResult(_0x22c1ec,null))[_0xbf45('0x4a')](handleError(_0x22c1ec,null));};exports[_0xbf45('0x56')]=function(_0x1eccb3,_0x2b9c44,_0x105eef){var _0x5c1f43={'raw':!![],'where':{}},_0x283487={},_0x350e2a;return db[_0xbf45('0x2e')]['findOne']({'where':{'id':_0x1eccb3['params']['id']}})['then'](handleEntityNotFound(_0x2b9c44,null))[_0xbf45('0x25')](function(_0x112e1b){if(_0x112e1b){_0x350e2a=_0x112e1b['get']({'plain':!![]});_0x283487[_0xbf45('0x33')]=_['keys'](db[_0xbf45('0x57')][_0xbf45('0x2f')]);_0x283487[_0xbf45('0x34')]=_[_0xbf45('0x35')](_0x1eccb3[_0xbf45('0x34')]);_0x283487[_0xbf45('0x3f')]=_[_0xbf45('0x36')](_0x283487[_0xbf45('0x33')],_0x283487[_0xbf45('0x34')]);_0x5c1f43[_0xbf45('0x37')]=_[_0xbf45('0x36')](_0x283487[_0xbf45('0x33')],qs[_0xbf45('0x38')](_0x1eccb3['query'][_0xbf45('0x38')]));_0x5c1f43[_0xbf45('0x37')]=_0x5c1f43[_0xbf45('0x37')][_0xbf45('0x39')]?_0x5c1f43[_0xbf45('0x37')]:_0x283487[_0xbf45('0x33')];if(!_0x1eccb3[_0xbf45('0x34')]['hasOwnProperty'](_0xbf45('0x3b'))){_0x5c1f43['limit']=qs[_0xbf45('0x1e')](_0x1eccb3[_0xbf45('0x34')][_0xbf45('0x1e')]);_0x5c1f43[_0xbf45('0x1c')]=qs['offset'](_0x1eccb3[_0xbf45('0x34')][_0xbf45('0x1c')]);}_0x5c1f43[_0xbf45('0x3c')]=qs[_0xbf45('0x3d')](_0x1eccb3[_0xbf45('0x34')][_0xbf45('0x3d')]);_0x5c1f43[_0xbf45('0x3e')]=qs[_0xbf45('0x3f')](_[_0xbf45('0x40')](_0x1eccb3[_0xbf45('0x34')],_0x283487[_0xbf45('0x3f')]));_0x5c1f43[_0xbf45('0x3e')][_0xbf45('0x58')]=_0x112e1b['id'];if(_0x1eccb3[_0xbf45('0x34')]['filter']){_0x5c1f43['where']=_[_0xbf45('0x42')](_0x5c1f43['where'],{'$or':_[_0xbf45('0x2d')](_0x5c1f43[_0xbf45('0x37')],function(_0x4e36b7){var _0x3c8f51={};_0x3c8f51[_0x4e36b7]={'$like':'%'+_0x1eccb3[_0xbf45('0x34')][_0xbf45('0x41')]+'%'};return _0x3c8f51;})});}_0x5c1f43=_[_0xbf45('0x42')]({},_0x5c1f43,_0x1eccb3['options']);return db[_0xbf45('0x57')][_0xbf45('0x46')](_0x5c1f43);}})[_0xbf45('0x25')](function(_0x36a006){if(_0x36a006){return db[_0xbf45('0x59')]['findAndCountAll']({'where':{'id':_[_0xbf45('0x2d')](_0x36a006,_0xbf45('0x5a')),'role':_0xbf45('0x5b')},'attributes':['id',_0xbf45('0x2c'),'faxPause',_0xbf45('0x5c'),_0xbf45('0x5d')]});}})[_0xbf45('0x25')](function(_0x252364){if(_0x252364){return{'count':_0x252364['count'],'rows':_[_0xbf45('0x2d')](_0x252364[_0xbf45('0x47')],function(_0x3a8614){return{'membername':_0x3a8614[_0xbf45('0x2c')],'UserId':_0x3a8614['id'],'queue_name':_0x350e2a[_0xbf45('0x2c')],'FaxQueueId':_0x350e2a['id'],'interface':util[_0xbf45('0x5e')](_0xbf45('0x5f'),_0xbf45('0x60'),_0x3a8614[_0xbf45('0x2c')]),'penalty':0x0,'paused':_0x3a8614[_0xbf45('0x61')],'createdAt':_0x3a8614[_0xbf45('0x5d')],'updatedAt':_0x3a8614['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf45('0x25')](respondWithFilteredResult(_0x2b9c44,_0x5c1f43))[_0xbf45('0x4a')](handleError(_0x2b9c44,null));};exports[_0xbf45('0x62')]=function(_0x58eef9,_0x3b6e44,_0x3ad95a){var _0x212c08={};var _0x449853={};var _0x569fa6;var _0x67865b;return db[_0xbf45('0x2e')]['findOne']({'where':{'id':_0x58eef9[_0xbf45('0x48')]['id']}})[_0xbf45('0x25')](handleEntityNotFound(_0x3b6e44,null))[_0xbf45('0x25')](function(_0x10291c){if(_0x10291c){_0x569fa6=_0x10291c;_0x449853['model']=_[_0xbf45('0x35')](db['Team'][_0xbf45('0x2f')]);_0x449853['query']=_['keys'](_0x58eef9[_0xbf45('0x34')]);_0x449853['filters']=_[_0xbf45('0x36')](_0x449853['model'],_0x449853[_0xbf45('0x34')]);_0x212c08[_0xbf45('0x37')]=_[_0xbf45('0x36')](_0x449853['model'],qs[_0xbf45('0x38')](_0x58eef9[_0xbf45('0x34')][_0xbf45('0x38')]));_0x212c08[_0xbf45('0x37')]=_0x212c08['attributes'][_0xbf45('0x39')]?_0x212c08[_0xbf45('0x37')]:_0x449853['model'];_0x212c08['order']=qs[_0xbf45('0x3d')](_0x58eef9['query'][_0xbf45('0x3d')]);_0x212c08[_0xbf45('0x3e')]=qs['filters'](_['pick'](_0x58eef9[_0xbf45('0x34')],_0x449853[_0xbf45('0x3f')]));if(_0x58eef9[_0xbf45('0x34')]['filter']){_0x212c08[_0xbf45('0x3e')]=_[_0xbf45('0x42')](_0x212c08[_0xbf45('0x3e')],{'$or':_[_0xbf45('0x2d')](_0x212c08[_0xbf45('0x37')],function(_0x4672fd){var _0x2ebf0d={};_0x2ebf0d[_0x4672fd]={'$like':'%'+_0x58eef9[_0xbf45('0x34')][_0xbf45('0x41')]+'%'};return _0x2ebf0d;})});}_0x212c08=_['merge']({},_0x212c08,_0x58eef9[_0xbf45('0x44')]);return _0x569fa6[_0xbf45('0x62')](_0x212c08);}})[_0xbf45('0x25')](function(_0x2bc770){if(_0x2bc770){_0x67865b=_0x2bc770[_0xbf45('0x39')];if(!_0x58eef9[_0xbf45('0x34')][_0xbf45('0x3a')]('nolimit')){_0x212c08[_0xbf45('0x1e')]=qs[_0xbf45('0x1e')](_0x58eef9['query']['limit']);_0x212c08[_0xbf45('0x1c')]=qs[_0xbf45('0x1c')](_0x58eef9[_0xbf45('0x34')][_0xbf45('0x1c')]);}return _0x569fa6[_0xbf45('0x62')](_0x212c08);}})[_0xbf45('0x25')](function(_0x40a0b0){if(_0x40a0b0){return _0x40a0b0?{'count':_0x67865b,'rows':_0x40a0b0}:null;}})[_0xbf45('0x25')](respondWithResult(_0x3b6e44,null))[_0xbf45('0x4a')](handleError(_0x3b6e44,null));};exports[_0xbf45('0x63')]=function(_0x954f5d,_0x5924e0,_0x22bc6a){var _0x4fb287=_0x954f5d[_0xbf45('0x4c')][_0xbf45('0x64')];return db[_0xbf45('0x65')]['findAll']({'where':{'id':_0x4fb287},'attributes':['id'],'include':[{'model':db[_0xbf45('0x59')],'as':_0xbf45('0x66'),'attributes':['id',_0xbf45('0x2c'),'online',_0xbf45('0x67'),_0xbf45('0x68')],'raw':!![]}]})[_0xbf45('0x25')](function(_0x230c84){if(_0x230c84){var _0x28a5e5=_['flatMap'](_0x230c84,function(_0xad2df9){var _0x3a86e0=_0xad2df9[_0xbf45('0x27')]({'plain':!![]});return _0x3a86e0[_0xbf45('0x66')];});return db[_0xbf45('0x2e')][_0xbf45('0x49')]({'where':{'id':_0x954f5d[_0xbf45('0x48')]['id']}})[_0xbf45('0x25')](function(_0x16127f){return db['sequelize'][_0xbf45('0x69')](function(_0x2cdc74){return _0x16127f[_0xbf45('0x63')](_0x4fb287,{'transaction':_0x2cdc74})[_0xbf45('0x25')](function(){return BPromise[_0xbf45('0x6a')](_0x28a5e5,function(_0x1bc00c){return db[_0xbf45('0x57')][_0xbf45('0x6b')]({'where':{'UserId':_0x1bc00c['id'],'FaxQueueId':_0x954f5d[_0xbf45('0x48')]['id']},'transaction':_0x2cdc74});});})[_0xbf45('0x25')](function(){_0x28a5e5[_0xbf45('0x6c')](function(_0x1f1d04){socket[_0xbf45('0x6d')](_0xbf45('0x6e'),{'UserId':_0x1f1d04['id'],'FaxQueueId':_0x16127f['id']});});});});});}})['then'](respondWithStatusCode(_0x5924e0,null))['catch'](handleError(_0x5924e0,null));};exports[_0xbf45('0x6f')]=function(_0x20c27a,_0x4e6a0d,_0x4bf4f2){return db[_0xbf45('0x65')][_0xbf45('0x46')]({'where':{'id':_0x20c27a[_0xbf45('0x34')][_0xbf45('0x64')]},'attributes':['id'],'include':[{'model':db[_0xbf45('0x59')],'as':_0xbf45('0x66'),'attributes':['id'],'raw':!![]}]})[_0xbf45('0x25')](handleEntityNotFound(_0x4e6a0d,null))[_0xbf45('0x25')](function(_0x44479e){var _0x2d9e10=_[_0xbf45('0x2d')](_0x44479e,'id');var _0x5cb959=[];var _0x443747=[];var _0x2a1b81=squel[_0xbf45('0x70')]();_0x2a1b81[_0xbf45('0x71')](_0xbf45('0x72'))[_0xbf45('0x73')]('team_has_fax_queues','tq')['join'](_0xbf45('0x74'),'ut',_0xbf45('0x75'))[_0xbf45('0x3e')](_0xbf45('0x76'),_0x20c27a[_0xbf45('0x48')]['id']);for(var _0x4efc0f=0x0;_0x4efc0f<_0x44479e[_0xbf45('0x39')];_0x4efc0f+=0x1){let _0x3e16b7=_0x44479e[_0x4efc0f];for(var _0x278ac6=0x0;_0x278ac6<_0x3e16b7[_0xbf45('0x66')]['length'];_0x278ac6+=0x1){let _0x196bed=_0x3e16b7[_0xbf45('0x66')][_0x278ac6];var _0x17fb84=_0x2a1b81[_0xbf45('0x77')]();_0x17fb84[_0xbf45('0x3e')](_0xbf45('0x78'),_0x196bed['id']);_0x443747[_0xbf45('0x79')](db[_0xbf45('0x7a')][_0xbf45('0x34')](_0x17fb84[_0xbf45('0x7b')](),{'type':db[_0xbf45('0x7a')][_0xbf45('0x7c')][_0xbf45('0x7d')]})['then'](function(_0x25b7f1){if(_0x25b7f1['length']===0x1){return _0x196bed['id'];}else{var _0x594cc3=_['every'](_[_0xbf45('0x2d')](_0x25b7f1,_0xbf45('0x7e')),function(_0x375467){return _[_0xbf45('0x7f')](_0x2d9e10,_0x375467);});if(_0x594cc3){return _0x196bed['id'];}}}));}}return BPromise[_0xbf45('0x80')](_0x443747)[_0xbf45('0x25')](function(_0x16675a){_0x5cb959=_(_0x5cb959)[_0xbf45('0x81')](_0x16675a)[_0xbf45('0x82')]()[_0xbf45('0x83')]();return db[_0xbf45('0x2e')][_0xbf45('0x49')]({'where':{'id':_0x20c27a[_0xbf45('0x48')]['id']}})[_0xbf45('0x25')](function(_0x254d4a){return db[_0xbf45('0x7a')][_0xbf45('0x69')](function(_0x353632){return _0x254d4a[_0xbf45('0x6f')](_0x20c27a['query'][_0xbf45('0x64')],{'transaction':_0x353632})[_0xbf45('0x25')](function(){if(!_[_0xbf45('0x84')](_0x5cb959)){return _0x254d4a['removeAgents'](_0x5cb959,{'transaction':_0x353632});}})[_0xbf45('0x25')](function(){_0x5cb959[_0xbf45('0x6c')](function(_0x4fbec2){socket['emit']('userFaxQueue:remove',{'UserId':_0x4fbec2,'FaxQueueId':_0x254d4a['id']});});});});});});})[_0xbf45('0x25')](respondWithStatusCode(_0x4e6a0d,null))[_0xbf45('0x4a')](handleError(_0x4e6a0d,null));};exports['addAgents']=function(_0x36e6b3,_0x2e1946,_0x3515c0){return db['FaxQueue']['find']({'where':{'id':_0x36e6b3['params']['id']}})[_0xbf45('0x25')](handleEntityNotFound(_0x2e1946,null))[_0xbf45('0x25')](function(_0x1d7044){if(_0x1d7044){return _0x1d7044[_0xbf45('0x85')](_0x36e6b3[_0xbf45('0x4c')]['ids'],_[_0xbf45('0x86')](_0x36e6b3[_0xbf45('0x4c')],[_0xbf45('0x64'),'id'])||{})['spread'](function(_0x330f96){for(var _0x2f6b99=0x0;_0x2f6b99<_0x36e6b3[_0xbf45('0x4c')][_0xbf45('0x64')][_0xbf45('0x39')];_0x2f6b99+=0x1){socket[_0xbf45('0x6d')](_0xbf45('0x6e'),{'UserId':Number(_0x36e6b3['body'][_0xbf45('0x64')][_0x2f6b99]),'FaxQueueId':Number(_0x36e6b3['params']['id'])});}return _0x330f96;});}})[_0xbf45('0x25')](respondWithResult(_0x2e1946,null))[_0xbf45('0x4a')](handleError(_0x2e1946,null));};exports[_0xbf45('0x87')]=function(_0x2e8725,_0x502ac3,_0x292f5a){return db[_0xbf45('0x2e')][_0xbf45('0x49')]({'where':{'id':_0x2e8725[_0xbf45('0x48')]['id']}})[_0xbf45('0x25')](handleEntityNotFound(_0x502ac3,null))['then'](function(_0x328037){if(_0x328037){return _0x328037['removeAgents'](_0x2e8725[_0xbf45('0x34')]['ids'])[_0xbf45('0x25')](function(){if(_[_0xbf45('0x88')](_0x2e8725['query'][_0xbf45('0x64')])){for(var _0xafcf85=0x0;_0xafcf85<_0x2e8725[_0xbf45('0x34')]['ids'][_0xbf45('0x39')];_0xafcf85+=0x1){socket[_0xbf45('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x2e8725['query'][_0xbf45('0x64')][_0xafcf85]),'FaxQueueId':Number(_0x2e8725['params']['id'])});}}else{socket[_0xbf45('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x2e8725[_0xbf45('0x34')][_0xbf45('0x64')]),'FaxQueueId':Number(_0x2e8725['params']['id'])});}});}})[_0xbf45('0x25')](respondWithStatusCode(_0x502ac3,null))[_0xbf45('0x4a')](handleError(_0x502ac3,null));};exports[_0xbf45('0x89')]=function(_0x197409,_0x3d9d46,_0x310a07){var _0x1d7f3e={};var _0x2ff09a={};var _0x1a92a0;var _0x1b9d3a;return db['FaxQueue']['findOne']({'where':{'id':_0x197409[_0xbf45('0x48')]['id']}})[_0xbf45('0x25')](handleEntityNotFound(_0x3d9d46,null))[_0xbf45('0x25')](function(_0x5809cf){if(_0x5809cf){_0x1a92a0=_0x5809cf;_0x2ff09a[_0xbf45('0x33')]=_[_0xbf45('0x35')](db[_0xbf45('0x59')]['rawAttributes']);_0x2ff09a['query']=_[_0xbf45('0x35')](_0x197409[_0xbf45('0x34')]);_0x2ff09a[_0xbf45('0x3f')]=_[_0xbf45('0x36')](_0x2ff09a[_0xbf45('0x33')],_0x2ff09a[_0xbf45('0x34')]);_0x1d7f3e[_0xbf45('0x37')]=_[_0xbf45('0x36')](_0x2ff09a['model'],qs[_0xbf45('0x38')](_0x197409[_0xbf45('0x34')][_0xbf45('0x38')]));_0x1d7f3e[_0xbf45('0x37')]=_0x1d7f3e['attributes']['length']?_0x1d7f3e[_0xbf45('0x37')]:_0x2ff09a['model'];_0x1d7f3e['order']=qs[_0xbf45('0x3d')](_0x197409[_0xbf45('0x34')][_0xbf45('0x3d')]);_0x1d7f3e[_0xbf45('0x3e')]=qs['filters'](_['pick'](_0x197409[_0xbf45('0x34')],_0x2ff09a[_0xbf45('0x3f')]));if(_0x197409[_0xbf45('0x34')][_0xbf45('0x41')]){_0x1d7f3e['where']=_[_0xbf45('0x42')](_0x1d7f3e[_0xbf45('0x3e')],{'$or':_[_0xbf45('0x2d')](_0x1d7f3e[_0xbf45('0x37')],function(_0xd120d9){var _0x19b877={};_0x19b877[_0xd120d9]={'$like':'%'+_0x197409[_0xbf45('0x34')]['filter']+'%'};return _0x19b877;})});}_0x1d7f3e=_[_0xbf45('0x42')]({},_0x1d7f3e,_0x197409['options']);return _0x1a92a0[_0xbf45('0x89')](_0x1d7f3e);}})[_0xbf45('0x25')](function(_0x2bfac4){if(_0x2bfac4){_0x1b9d3a=_0x2bfac4['length'];if(!_0x197409[_0xbf45('0x34')][_0xbf45('0x3a')](_0xbf45('0x3b'))){_0x1d7f3e[_0xbf45('0x1e')]=qs[_0xbf45('0x1e')](_0x197409[_0xbf45('0x34')][_0xbf45('0x1e')]);_0x1d7f3e[_0xbf45('0x1c')]=qs['offset'](_0x197409[_0xbf45('0x34')][_0xbf45('0x1c')]);}return _0x1a92a0[_0xbf45('0x89')](_0x1d7f3e);}})['then'](function(_0x1a17ec){if(_0x1a17ec){return _0x1a17ec?{'count':_0x1b9d3a,'rows':_0x1a17ec}:null;}})['then'](respondWithResult(_0x3d9d46,null))['catch'](handleError(_0x3d9d46,null));}; \ No newline at end of file +var _0x361b=['team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserFaxQueue','findAll','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','SIP','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from'];(function(_0x277292,_0xd6652c){var _0x58edc2=function(_0x338610){while(--_0x338610){_0x277292['push'](_0x277292['shift']());}};_0x58edc2(++_0xd6652c);}(_0x361b,0x1c7));var _0xb361=function(_0xe8f8f3,_0x13fd98){_0xe8f8f3=_0xe8f8f3-0x0;var _0x123dce=_0x361b[_0xe8f8f3];return _0x123dce;};'use strict';var emlformat=require(_0xb361('0x0'));var rimraf=require(_0xb361('0x1'));var zipdir=require(_0xb361('0x2'));var jsonpatch=require(_0xb361('0x3'));var rp=require('request-promise');var moment=require(_0xb361('0x4'));var BPromise=require(_0xb361('0x5'));var Mustache=require('mustache');var util=require(_0xb361('0x6'));var path=require('path');var sox=require(_0xb361('0x7'));var csv=require(_0xb361('0x8'));var ejs=require(_0xb361('0x9'));var fs=require('fs');var fs_extra=require(_0xb361('0xa'));var _=require(_0xb361('0xb'));var squel=require(_0xb361('0xc'));var crypto=require(_0xb361('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb361('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb361('0xf'));var Papa=require('papaparse');var Redis=require(_0xb361('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb361('0x11'));var as=require(_0xb361('0x12'));var hardwareService=require(_0xb361('0x13'));var logger=require(_0xb361('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb361('0x15'));var licenseUtil=require(_0xb361('0x16'));var db=require(_0xb361('0x17'))['db'];config[_0xb361('0x18')]=_[_0xb361('0x19')](config[_0xb361('0x18')],{'host':_0xb361('0x1a'),'port':0x18eb});var socket=require(_0xb361('0x1b'))(new Redis(config[_0xb361('0x18')]));require(_0xb361('0x1c'))['register'](socket);function respondWithStatusCode(_0x51f6bd,_0x298002){_0x298002=_0x298002||0xcc;return function(_0x3593d3){if(_0x3593d3){return _0x51f6bd[_0xb361('0x1d')](_0x298002);}return _0x51f6bd[_0xb361('0x1e')](_0x298002)[_0xb361('0x1f')]();};}function respondWithResult(_0x336bd7,_0x410e70){_0x410e70=_0x410e70||0xc8;return function(_0x3aa0b3){if(_0x3aa0b3){return _0x336bd7[_0xb361('0x1e')](_0x410e70)[_0xb361('0x20')](_0x3aa0b3);}};}function respondWithFilteredResult(_0x40a06d,_0x1820eb){return function(_0x1122ca){if(_0x1122ca){var _0x1d94e1=typeof _0x1820eb[_0xb361('0x21')]===_0xb361('0x22')&&typeof _0x1820eb[_0xb361('0x23')]===_0xb361('0x22');var _0x47c1f3=_0x1122ca[_0xb361('0x24')];var _0x219d2e=_0x1d94e1?0x0:_0x1820eb[_0xb361('0x21')];var _0x5713ff=_0x1d94e1?_0x1122ca[_0xb361('0x24')]:_0x1820eb[_0xb361('0x21')]+_0x1820eb[_0xb361('0x23')];var _0x22e577;if(_0x5713ff>=_0x47c1f3){_0x5713ff=_0x47c1f3;_0x22e577=0xc8;}else{_0x22e577=0xce;}_0x40a06d['status'](_0x22e577);return _0x40a06d[_0xb361('0x25')](_0xb361('0x26'),_0x219d2e+'-'+_0x5713ff+'/'+_0x47c1f3)[_0xb361('0x20')](_0x1122ca);}return null;};}function patchUpdates(_0x2087f6){return function(_0x12d2bc){try{jsonpatch[_0xb361('0x27')](_0x12d2bc,_0x2087f6,!![]);}catch(_0x2ec90a){return BPromise[_0xb361('0x28')](_0x2ec90a);}return _0x12d2bc[_0xb361('0x29')]();};}function saveUpdates(_0x112998,_0x133226){return function(_0x236f9a){if(_0x236f9a){return _0x236f9a[_0xb361('0x2a')](_0x112998)[_0xb361('0x2b')](function(_0x326175){return _0x326175;});}return null;};}function removeEntity(_0x5c2ab2,_0x1f8a3b){return function(_0x5c52b8){if(_0x5c52b8){return _0x5c52b8[_0xb361('0x2c')]()[_0xb361('0x2b')](function(){var _0x276feb=_0x5c52b8['get']({'plain':!![]});var _0x3d59c5=_0xb361('0x2d');return db[_0xb361('0x2e')][_0xb361('0x2c')]({'where':{'type':_0x3d59c5,'resourceId':_0x276feb['id']}})['then'](function(){return _0x5c52b8;});})[_0xb361('0x2b')](function(){_0x5c2ab2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b90f,_0x17fc0d){return function(_0x568fbf){if(!_0x568fbf){_0x19b90f['sendStatus'](0x194);}return _0x568fbf;};}function handleError(_0x4b2aee,_0x3b9c2d){_0x3b9c2d=_0x3b9c2d||0x1f4;return function(_0x57fbf8){logger['error'](_0x57fbf8[_0xb361('0x2f')]);if(_0x57fbf8[_0xb361('0x30')]){delete _0x57fbf8[_0xb361('0x30')];}_0x4b2aee[_0xb361('0x1e')](_0x3b9c2d)[_0xb361('0x31')](_0x57fbf8);};}exports[_0xb361('0x32')]=function(_0x3928a2,_0x15ecec){var _0xb4dc4a={},_0x452673={},_0x423866={'count':0x0,'rows':[]};var _0x22cb1c=_[_0xb361('0x33')](db[_0xb361('0x34')][_0xb361('0x35')],function(_0x556e72){return{'name':_0x556e72['fieldName'],'type':_0x556e72[_0xb361('0x36')][_0xb361('0x37')]};});_0x452673[_0xb361('0x38')]=_[_0xb361('0x33')](_0x22cb1c,_0xb361('0x30'));_0x452673[_0xb361('0x39')]=_[_0xb361('0x3a')](_0x3928a2[_0xb361('0x39')]);_0x452673['filters']=_[_0xb361('0x3b')](_0x452673[_0xb361('0x38')],_0x452673[_0xb361('0x39')]);_0xb4dc4a[_0xb361('0x3c')]=_[_0xb361('0x3b')](_0x452673[_0xb361('0x38')],qs[_0xb361('0x3d')](_0x3928a2[_0xb361('0x39')][_0xb361('0x3d')]));_0xb4dc4a['attributes']=_0xb4dc4a[_0xb361('0x3c')][_0xb361('0x3e')]?_0xb4dc4a['attributes']:_0x452673[_0xb361('0x38')];if(!_0x3928a2['query'][_0xb361('0x3f')](_0xb361('0x40'))){_0xb4dc4a[_0xb361('0x23')]=qs[_0xb361('0x23')](_0x3928a2['query'][_0xb361('0x23')]);_0xb4dc4a[_0xb361('0x21')]=qs['offset'](_0x3928a2[_0xb361('0x39')]['offset']);}_0xb4dc4a[_0xb361('0x41')]=qs[_0xb361('0x42')](_0x3928a2['query'][_0xb361('0x42')]);_0xb4dc4a[_0xb361('0x43')]=qs['filters'](_[_0xb361('0x44')](_0x3928a2[_0xb361('0x39')],_0x452673[_0xb361('0x45')]),_0x22cb1c);if(_0x3928a2[_0xb361('0x39')][_0xb361('0x46')]){_0xb4dc4a[_0xb361('0x43')]=_[_0xb361('0x47')](_0xb4dc4a[_0xb361('0x43')],{'$or':_[_0xb361('0x33')](_0x22cb1c,function(_0x5dc6db){if(_0x5dc6db['type']!=='VIRTUAL'){var _0x138ca6={};_0x138ca6[_0x5dc6db[_0xb361('0x30')]]={'$like':'%'+_0x3928a2[_0xb361('0x39')]['filter']+'%'};return _0x138ca6;}})});}_0xb4dc4a=_[_0xb361('0x47')]({},_0xb4dc4a,_0x3928a2[_0xb361('0x48')]);var _0x124012={'where':_0xb4dc4a['where']};return db[_0xb361('0x34')][_0xb361('0x24')](_0x124012)[_0xb361('0x2b')](function(_0x1431fb){_0x423866[_0xb361('0x24')]=_0x1431fb;if(_0x3928a2[_0xb361('0x39')][_0xb361('0x49')]){_0xb4dc4a[_0xb361('0x4a')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0xb4dc4a);})[_0xb361('0x2b')](function(_0x8dca0a){_0x423866[_0xb361('0x4b')]=_0x8dca0a;return _0x423866;})[_0xb361('0x2b')](respondWithFilteredResult(_0x15ecec,_0xb4dc4a))[_0xb361('0x4c')](handleError(_0x15ecec,null));};exports['show']=function(_0x31c483,_0x4c1852){var _0x23ba9e={'raw':!![],'where':{'id':_0x31c483['params']['id']}},_0x1e7b25={};_0x1e7b25[_0xb361('0x38')]=_['keys'](db[_0xb361('0x34')][_0xb361('0x35')]);_0x1e7b25[_0xb361('0x39')]=_[_0xb361('0x3a')](_0x31c483['query']);_0x1e7b25[_0xb361('0x45')]=_[_0xb361('0x3b')](_0x1e7b25[_0xb361('0x38')],_0x1e7b25[_0xb361('0x39')]);_0x23ba9e[_0xb361('0x3c')]=_[_0xb361('0x3b')](_0x1e7b25['model'],qs[_0xb361('0x3d')](_0x31c483[_0xb361('0x39')]['fields']));_0x23ba9e[_0xb361('0x3c')]=_0x23ba9e['attributes'][_0xb361('0x3e')]?_0x23ba9e[_0xb361('0x3c')]:_0x1e7b25['model'];if(_0x31c483[_0xb361('0x39')][_0xb361('0x49')]){_0x23ba9e[_0xb361('0x4a')]=[{'all':!![]}];}_0x23ba9e=_[_0xb361('0x47')]({},_0x23ba9e,_0x31c483[_0xb361('0x48')]);return db[_0xb361('0x34')]['find'](_0x23ba9e)['then'](handleEntityNotFound(_0x4c1852,null))['then'](respondWithResult(_0x4c1852,null))['catch'](handleError(_0x4c1852,null));};exports['create']=function(_0x17b7d1,_0x3e4558){return db[_0xb361('0x34')][_0xb361('0x4d')](_0x17b7d1[_0xb361('0x4e')],{})['then'](function(_0x397266){var _0x3b1a11=_0x17b7d1[_0xb361('0x4f')]['get']({'plain':!![]});if(!_0x3b1a11)throw new Error(_0xb361('0x50'));if(_0x3b1a11[_0xb361('0x51')]===_0xb361('0x4f')){var _0x5e8b3c=_0x397266[_0xb361('0x52')]({'plain':!![]});var _0x3df5c0=_0xb361('0x2d');return db[_0xb361('0x53')][_0xb361('0x54')]({'where':{'name':_0x3df5c0,'userProfileId':_0x3b1a11[_0xb361('0x55')]},'raw':!![]})[_0xb361('0x2b')](function(_0x501547){if(_0x501547&&_0x501547[_0xb361('0x56')]===0x0){return db[_0xb361('0x2e')]['create']({'name':_0x5e8b3c[_0xb361('0x30')],'resourceId':_0x5e8b3c['id'],'type':_0x501547['name'],'sectionId':_0x501547['id']},{})[_0xb361('0x2b')](function(){return _0x397266;});}else{return _0x397266;}})[_0xb361('0x4c')](function(_0xf550f4){logger['error'](_0xb361('0x57'),_0xf550f4);throw _0xf550f4;});}return _0x397266;})[_0xb361('0x2b')](respondWithResult(_0x3e4558,0xc9))[_0xb361('0x4c')](handleError(_0x3e4558,null));};exports[_0xb361('0x2a')]=function(_0x472663,_0x177aab){if(_0x472663['body']['id']){delete _0x472663[_0xb361('0x4e')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x472663['params']['id']}})[_0xb361('0x2b')](handleEntityNotFound(_0x177aab,null))[_0xb361('0x2b')](saveUpdates(_0x472663['body'],null))[_0xb361('0x2b')](respondWithResult(_0x177aab,null))[_0xb361('0x4c')](handleError(_0x177aab,null));};exports['destroy']=function(_0x1016b8,_0x2e0960){return db[_0xb361('0x34')]['find']({'where':{'id':_0x1016b8[_0xb361('0x58')]['id']}})[_0xb361('0x2b')](handleEntityNotFound(_0x2e0960,null))['then'](removeEntity(_0x2e0960,null))[_0xb361('0x4c')](handleError(_0x2e0960,null));};exports[_0xb361('0x59')]=function(_0x263c04,_0x4f0d50){return db[_0xb361('0x34')][_0xb361('0x59')]()[_0xb361('0x2b')](respondWithResult(_0x4f0d50,null))[_0xb361('0x4c')](handleError(_0x4f0d50,null));};exports[_0xb361('0x5a')]=function(_0x16c495,_0x3e3954,_0x1f674f){var _0x5c9a6a={'raw':!![],'where':{}},_0x2c04b0={},_0x34bd18;return db[_0xb361('0x34')]['findOne']({'where':{'id':_0x16c495[_0xb361('0x58')]['id']}})[_0xb361('0x2b')](handleEntityNotFound(_0x3e3954,null))['then'](function(_0x219164){if(_0x219164){_0x34bd18=_0x219164[_0xb361('0x52')]({'plain':!![]});_0x2c04b0[_0xb361('0x38')]=_[_0xb361('0x3a')](db['UserFaxQueue'][_0xb361('0x35')]);_0x2c04b0[_0xb361('0x39')]=_[_0xb361('0x3a')](_0x16c495[_0xb361('0x39')]);_0x2c04b0['filters']=_[_0xb361('0x3b')](_0x2c04b0[_0xb361('0x38')],_0x2c04b0[_0xb361('0x39')]);_0x5c9a6a[_0xb361('0x3c')]=_[_0xb361('0x3b')](_0x2c04b0['model'],qs[_0xb361('0x3d')](_0x16c495[_0xb361('0x39')]['fields']));_0x5c9a6a['attributes']=_0x5c9a6a[_0xb361('0x3c')]['length']?_0x5c9a6a[_0xb361('0x3c')]:_0x2c04b0['model'];if(!_0x16c495['query'][_0xb361('0x3f')]('nolimit')){_0x5c9a6a['limit']=qs[_0xb361('0x23')](_0x16c495['query'][_0xb361('0x23')]);_0x5c9a6a[_0xb361('0x21')]=qs[_0xb361('0x21')](_0x16c495[_0xb361('0x39')]['offset']);}_0x5c9a6a[_0xb361('0x41')]=qs[_0xb361('0x42')](_0x16c495['query']['sort']);_0x5c9a6a[_0xb361('0x43')]=qs['filters'](_[_0xb361('0x44')](_0x16c495['query'],_0x2c04b0[_0xb361('0x45')]));_0x5c9a6a['where']['FaxQueueId']=_0x219164['id'];if(_0x16c495[_0xb361('0x39')][_0xb361('0x46')]){_0x5c9a6a['where']=_[_0xb361('0x47')](_0x5c9a6a[_0xb361('0x43')],{'$or':_[_0xb361('0x33')](_0x5c9a6a[_0xb361('0x3c')],function(_0x57f07e){var _0x44a2ac={};_0x44a2ac[_0x57f07e]={'$like':'%'+_0x16c495[_0xb361('0x39')][_0xb361('0x46')]+'%'};return _0x44a2ac;})});}_0x5c9a6a=_[_0xb361('0x47')]({},_0x5c9a6a,_0x16c495[_0xb361('0x48')]);return db[_0xb361('0x5b')][_0xb361('0x5c')](_0x5c9a6a);}})['then'](function(_0x234345){if(_0x234345){return db[_0xb361('0x5d')][_0xb361('0x5e')]({'where':{'id':_[_0xb361('0x33')](_0x234345,_0xb361('0x5f')),'role':'agent'},'attributes':['id',_0xb361('0x30'),_0xb361('0x60'),_0xb361('0x61'),_0xb361('0x62')]});}})['then'](function(_0x17accb){if(_0x17accb){return{'count':_0x17accb[_0xb361('0x24')],'rows':_[_0xb361('0x33')](_0x17accb[_0xb361('0x4b')],function(_0x3f2314){return{'membername':_0x3f2314[_0xb361('0x30')],'UserId':_0x3f2314['id'],'queue_name':_0x34bd18[_0xb361('0x30')],'FaxQueueId':_0x34bd18['id'],'interface':util[_0xb361('0x63')]('%s/%s',_0xb361('0x64'),_0x3f2314[_0xb361('0x30')]),'penalty':0x0,'paused':_0x3f2314['faxPause'],'createdAt':_0x3f2314[_0xb361('0x62')],'updatedAt':_0x3f2314['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb361('0x2b')](respondWithFilteredResult(_0x3e3954,_0x5c9a6a))['catch'](handleError(_0x3e3954,null));};exports[_0xb361('0x65')]=function(_0x15e242,_0x509250,_0x18d231){var _0x1ef65c={};var _0x13308c={};var _0x14d33c;var _0x3cbf32;return db['FaxQueue'][_0xb361('0x66')]({'where':{'id':_0x15e242['params']['id']}})[_0xb361('0x2b')](handleEntityNotFound(_0x509250,null))[_0xb361('0x2b')](function(_0x212cee){if(_0x212cee){_0x14d33c=_0x212cee;_0x13308c[_0xb361('0x38')]=_[_0xb361('0x3a')](db['Team']['rawAttributes']);_0x13308c[_0xb361('0x39')]=_[_0xb361('0x3a')](_0x15e242[_0xb361('0x39')]);_0x13308c[_0xb361('0x45')]=_[_0xb361('0x3b')](_0x13308c['model'],_0x13308c[_0xb361('0x39')]);_0x1ef65c[_0xb361('0x3c')]=_[_0xb361('0x3b')](_0x13308c[_0xb361('0x38')],qs[_0xb361('0x3d')](_0x15e242[_0xb361('0x39')][_0xb361('0x3d')]));_0x1ef65c[_0xb361('0x3c')]=_0x1ef65c[_0xb361('0x3c')][_0xb361('0x3e')]?_0x1ef65c[_0xb361('0x3c')]:_0x13308c[_0xb361('0x38')];_0x1ef65c['order']=qs['sort'](_0x15e242['query']['sort']);_0x1ef65c[_0xb361('0x43')]=qs['filters'](_[_0xb361('0x44')](_0x15e242[_0xb361('0x39')],_0x13308c['filters']));if(_0x15e242['query'][_0xb361('0x46')]){_0x1ef65c['where']=_['merge'](_0x1ef65c[_0xb361('0x43')],{'$or':_[_0xb361('0x33')](_0x1ef65c['attributes'],function(_0x25d233){var _0x3dc32b={};_0x3dc32b[_0x25d233]={'$like':'%'+_0x15e242[_0xb361('0x39')][_0xb361('0x46')]+'%'};return _0x3dc32b;})});}_0x1ef65c=_['merge']({},_0x1ef65c,_0x15e242[_0xb361('0x48')]);return _0x14d33c['getTeams'](_0x1ef65c);}})[_0xb361('0x2b')](function(_0x12f5b6){if(_0x12f5b6){_0x3cbf32=_0x12f5b6[_0xb361('0x3e')];if(!_0x15e242['query'][_0xb361('0x3f')](_0xb361('0x40'))){_0x1ef65c[_0xb361('0x23')]=qs[_0xb361('0x23')](_0x15e242[_0xb361('0x39')][_0xb361('0x23')]);_0x1ef65c[_0xb361('0x21')]=qs[_0xb361('0x21')](_0x15e242[_0xb361('0x39')][_0xb361('0x21')]);}return _0x14d33c[_0xb361('0x65')](_0x1ef65c);}})[_0xb361('0x2b')](function(_0x3a7683){if(_0x3a7683){return _0x3a7683?{'count':_0x3cbf32,'rows':_0x3a7683}:null;}})['then'](respondWithResult(_0x509250,null))[_0xb361('0x4c')](handleError(_0x509250,null));};exports[_0xb361('0x67')]=function(_0x1592d2,_0xe994a7,_0x554ceb){var _0x44aca5=_0x1592d2[_0xb361('0x4e')][_0xb361('0x68')];return db[_0xb361('0x69')]['findAll']({'where':{'id':_0x44aca5},'attributes':['id'],'include':[{'model':db[_0xb361('0x5d')],'as':_0xb361('0x6a'),'attributes':['id',_0xb361('0x30'),_0xb361('0x6b'),_0xb361('0x6c'),_0xb361('0x6d')],'raw':!![]}]})['then'](function(_0x61f104){if(_0x61f104){var _0x250816=_[_0xb361('0x6e')](_0x61f104,function(_0x4025f9){var _0x55f472=_0x4025f9[_0xb361('0x52')]({'plain':!![]});return _0x55f472[_0xb361('0x6a')];});return db[_0xb361('0x34')]['find']({'where':{'id':_0x1592d2[_0xb361('0x58')]['id']}})[_0xb361('0x2b')](function(_0x31a144){return db[_0xb361('0x6f')][_0xb361('0x70')](function(_0x393b41){return _0x31a144['addTeams'](_0x44aca5,{'transaction':_0x393b41})[_0xb361('0x2b')](function(){return BPromise['each'](_0x250816,function(_0x4372e8){return db['UserFaxQueue'][_0xb361('0x71')]({'where':{'UserId':_0x4372e8['id'],'FaxQueueId':_0x1592d2['params']['id']},'transaction':_0x393b41});});})['then'](function(){_0x250816[_0xb361('0x72')](function(_0x46302a){socket[_0xb361('0x73')](_0xb361('0x74'),{'UserId':_0x46302a['id'],'FaxQueueId':_0x31a144['id']});});});});});}})[_0xb361('0x2b')](respondWithStatusCode(_0xe994a7,null))[_0xb361('0x4c')](handleError(_0xe994a7,null));};exports[_0xb361('0x75')]=function(_0x524af,_0x347294,_0x2f92d4){return db[_0xb361('0x69')]['findAll']({'where':{'id':_0x524af[_0xb361('0x39')][_0xb361('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb361('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xb361('0x2b')](handleEntityNotFound(_0x347294,null))['then'](function(_0x1a13e5){var _0x38fe35=_[_0xb361('0x33')](_0x1a13e5,'id');var _0xf22a8a=[];var _0x3b7440=[];var _0x592b66=squel['select']();_0x592b66[_0xb361('0x76')](_0xb361('0x77'))[_0xb361('0x78')](_0xb361('0x79'),'tq')[_0xb361('0x7a')]('user_has_teams','ut',_0xb361('0x7b'))[_0xb361('0x43')]('FaxQueueId\x20=\x20?',_0x524af[_0xb361('0x58')]['id']);for(var _0x287d2c=0x0;_0x287d2c<_0x1a13e5['length'];_0x287d2c+=0x1){let _0x5a3e13=_0x1a13e5[_0x287d2c];for(var _0xd15001=0x0;_0xd15001<_0x5a3e13[_0xb361('0x6a')]['length'];_0xd15001+=0x1){let _0x5539c0=_0x5a3e13[_0xb361('0x6a')][_0xd15001];var _0x52fd99=_0x592b66[_0xb361('0x7c')]();_0x52fd99[_0xb361('0x43')](_0xb361('0x7d'),_0x5539c0['id']);_0x3b7440[_0xb361('0x7e')](db['sequelize'][_0xb361('0x39')](_0x52fd99['toString'](),{'type':db[_0xb361('0x6f')][_0xb361('0x7f')][_0xb361('0x80')]})['then'](function(_0x3e2a58){if(_0x3e2a58[_0xb361('0x3e')]===0x1){return _0x5539c0['id'];}else{var _0x192ea4=_[_0xb361('0x81')](_[_0xb361('0x33')](_0x3e2a58,_0xb361('0x82')),function(_0x27aaf2){return _[_0xb361('0x83')](_0x38fe35,_0x27aaf2);});if(_0x192ea4){return _0x5539c0['id'];}}}));}}return BPromise[_0xb361('0x84')](_0x3b7440)[_0xb361('0x2b')](function(_0x2f71b9){_0xf22a8a=_(_0xf22a8a)[_0xb361('0x85')](_0x2f71b9)[_0xb361('0x86')]()[_0xb361('0x87')]();return db[_0xb361('0x34')][_0xb361('0x54')]({'where':{'id':_0x524af[_0xb361('0x58')]['id']}})[_0xb361('0x2b')](function(_0x2ea7cc){return db[_0xb361('0x6f')][_0xb361('0x70')](function(_0x5c4599){return _0x2ea7cc['removeTeams'](_0x524af[_0xb361('0x39')]['ids'],{'transaction':_0x5c4599})[_0xb361('0x2b')](function(){if(!_[_0xb361('0x88')](_0xf22a8a)){return _0x2ea7cc[_0xb361('0x89')](_0xf22a8a,{'transaction':_0x5c4599});}})[_0xb361('0x2b')](function(){_0xf22a8a['forEach'](function(_0x159868){socket['emit'](_0xb361('0x8a'),{'UserId':_0x159868,'FaxQueueId':_0x2ea7cc['id']});});});});});});})['then'](respondWithStatusCode(_0x347294,null))[_0xb361('0x4c')](handleError(_0x347294,null));};exports[_0xb361('0x8b')]=function(_0xec06fb,_0x1a6fc5,_0x47bce2){return db[_0xb361('0x34')]['find']({'where':{'id':_0xec06fb[_0xb361('0x58')]['id']}})['then'](handleEntityNotFound(_0x1a6fc5,null))['then'](function(_0x41af7c){if(_0x41af7c){return _0x41af7c[_0xb361('0x8b')](_0xec06fb[_0xb361('0x4e')]['ids'],_[_0xb361('0x8c')](_0xec06fb[_0xb361('0x4e')],[_0xb361('0x68'),'id'])||{})[_0xb361('0x8d')](function(_0x470bfc){for(var _0x1f4a6d=0x0;_0x1f4a6d<_0xec06fb[_0xb361('0x4e')][_0xb361('0x68')]['length'];_0x1f4a6d+=0x1){socket[_0xb361('0x73')](_0xb361('0x74'),{'UserId':Number(_0xec06fb[_0xb361('0x4e')]['ids'][_0x1f4a6d]),'FaxQueueId':Number(_0xec06fb[_0xb361('0x58')]['id'])});}return _0x470bfc;});}})[_0xb361('0x2b')](respondWithResult(_0x1a6fc5,null))['catch'](handleError(_0x1a6fc5,null));};exports['removeAgents']=function(_0x585570,_0x465f73,_0x2a76d7){return db['FaxQueue']['find']({'where':{'id':_0x585570[_0xb361('0x58')]['id']}})[_0xb361('0x2b')](handleEntityNotFound(_0x465f73,null))[_0xb361('0x2b')](function(_0x359d80){if(_0x359d80){return _0x359d80['removeAgents'](_0x585570[_0xb361('0x39')][_0xb361('0x68')])['then'](function(){if(_[_0xb361('0x8e')](_0x585570['query']['ids'])){for(var _0x390e9c=0x0;_0x390e9c<_0x585570[_0xb361('0x39')]['ids'][_0xb361('0x3e')];_0x390e9c+=0x1){socket['emit'](_0xb361('0x8a'),{'UserId':Number(_0x585570[_0xb361('0x39')][_0xb361('0x68')][_0x390e9c]),'FaxQueueId':Number(_0x585570[_0xb361('0x58')]['id'])});}}else{socket[_0xb361('0x73')](_0xb361('0x8a'),{'UserId':Number(_0x585570['query'][_0xb361('0x68')]),'FaxQueueId':Number(_0x585570[_0xb361('0x58')]['id'])});}});}})[_0xb361('0x2b')](respondWithStatusCode(_0x465f73,null))[_0xb361('0x4c')](handleError(_0x465f73,null));};exports[_0xb361('0x8f')]=function(_0x32e0dd,_0xc9e6a9,_0x424f1d){var _0x2252ca={};var _0x360b75={};var _0x23b578;var _0x53dd0a;return db[_0xb361('0x34')][_0xb361('0x66')]({'where':{'id':_0x32e0dd[_0xb361('0x58')]['id']}})['then'](handleEntityNotFound(_0xc9e6a9,null))[_0xb361('0x2b')](function(_0x2a8f3d){if(_0x2a8f3d){_0x23b578=_0x2a8f3d;_0x360b75['model']=_[_0xb361('0x3a')](db['User'][_0xb361('0x35')]);_0x360b75['query']=_[_0xb361('0x3a')](_0x32e0dd['query']);_0x360b75[_0xb361('0x45')]=_[_0xb361('0x3b')](_0x360b75[_0xb361('0x38')],_0x360b75['query']);_0x2252ca[_0xb361('0x3c')]=_['intersection'](_0x360b75[_0xb361('0x38')],qs[_0xb361('0x3d')](_0x32e0dd[_0xb361('0x39')][_0xb361('0x3d')]));_0x2252ca[_0xb361('0x3c')]=_0x2252ca[_0xb361('0x3c')]['length']?_0x2252ca[_0xb361('0x3c')]:_0x360b75[_0xb361('0x38')];_0x2252ca[_0xb361('0x41')]=qs[_0xb361('0x42')](_0x32e0dd[_0xb361('0x39')][_0xb361('0x42')]);_0x2252ca[_0xb361('0x43')]=qs[_0xb361('0x45')](_[_0xb361('0x44')](_0x32e0dd['query'],_0x360b75['filters']));if(_0x32e0dd[_0xb361('0x39')][_0xb361('0x46')]){_0x2252ca['where']=_['merge'](_0x2252ca[_0xb361('0x43')],{'$or':_['map'](_0x2252ca['attributes'],function(_0x5c1013){var _0x5b2f34={};_0x5b2f34[_0x5c1013]={'$like':'%'+_0x32e0dd['query']['filter']+'%'};return _0x5b2f34;})});}_0x2252ca=_[_0xb361('0x47')]({},_0x2252ca,_0x32e0dd[_0xb361('0x48')]);return _0x23b578['getAgents'](_0x2252ca);}})[_0xb361('0x2b')](function(_0x460147){if(_0x460147){_0x53dd0a=_0x460147[_0xb361('0x3e')];if(!_0x32e0dd[_0xb361('0x39')][_0xb361('0x3f')](_0xb361('0x40'))){_0x2252ca[_0xb361('0x23')]=qs[_0xb361('0x23')](_0x32e0dd['query']['limit']);_0x2252ca['offset']=qs['offset'](_0x32e0dd[_0xb361('0x39')][_0xb361('0x21')]);}return _0x23b578['getAgents'](_0x2252ca);}})['then'](function(_0x131cff){if(_0x131cff){return _0x131cff?{'count':_0x53dd0a,'rows':_0x131cff}:null;}})[_0xb361('0x2b')](respondWithResult(_0xc9e6a9,null))[_0xb361('0x4c')](handleError(_0xc9e6a9,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index eb7b795..cbce7d8 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 _0x4e0d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove'];(function(_0x4bf280,_0x5a0136){var _0xfbb486=function(_0x27cdbd){while(--_0x27cdbd){_0x4bf280['push'](_0x4bf280['shift']());}};_0xfbb486(++_0x5a0136);}(_0x4e0d,0x16c));var _0xd4e0=function(_0x430428,_0x28e0de){_0x430428=_0x430428-0x0;var _0x2b20d6=_0x4e0d[_0x430428];return _0x2b20d6;};'use strict';var EventEmitter=require(_0xd4e0('0x0'));var FaxQueue=require(_0xd4e0('0x1'))['db'][_0xd4e0('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xd4e0('0x3')](0x0);var events={'afterCreate':_0xd4e0('0x4'),'afterUpdate':'update','afterDestroy':_0xd4e0('0x5')};function emitEvent(_0x4e34ec){return function(_0x48f349,_0x344df0,_0x5cbde7){FaxQueueEvents['emit'](_0x4e34ec+':'+_0x48f349['id'],_0x48f349);FaxQueueEvents[_0xd4e0('0x6')](_0x4e34ec,_0x48f349);_0x5cbde7(null);};}for(var e in events){if(events[_0xd4e0('0x7')](e)){var event=events[e];FaxQueue[_0xd4e0('0x8')](e,emitEvent(event));}}module[_0xd4e0('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xd647=['hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x12304e,_0x290be7){var _0x27096b=function(_0xeef1a5){while(--_0xeef1a5){_0x12304e['push'](_0x12304e['shift']());}};_0x27096b(++_0x290be7);}(_0xd647,0xf1));var _0x7d64=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0xd647[_0x3d7022];return _0x40870b;};'use strict';var EventEmitter=require(_0x7d64('0x0'));var FaxQueue=require(_0x7d64('0x1'))['db'][_0x7d64('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7d64('0x3')](0x0);var events={'afterCreate':_0x7d64('0x4'),'afterUpdate':'update','afterDestroy':_0x7d64('0x5')};function emitEvent(_0x384a10){return function(_0x3527a4,_0x1b7df5,_0x138a80){FaxQueueEvents[_0x7d64('0x6')](_0x384a10+':'+_0x3527a4['id'],_0x3527a4);FaxQueueEvents['emit'](_0x384a10,_0x3527a4);_0x138a80(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x7d64('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 23af9a8..b25bf5e 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 _0x1d79=['request-promise','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','lodash','util','api','moment'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x1d79,0x13c));var _0x91d7=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1d79[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x91d7('0x0'));var util=require(_0x91d7('0x1'));var logger=require('../../config/logger')(_0x91d7('0x2'));var moment=require(_0x91d7('0x3'));var BPromise=require('bluebird');var rp=require(_0x91d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91d7('0x5'));var config=require(_0x91d7('0x6'));var attributes=require(_0x91d7('0x7'));module['exports']=function(_0x321faf,_0x390f2c){return _0x321faf[_0x91d7('0x8')](_0x91d7('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffb7=['request-promise','path','rimraf','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment'];(function(_0x549e01,_0x557c28){var _0x4523c5=function(_0x3ddb18){while(--_0x3ddb18){_0x549e01['push'](_0x549e01['shift']());}};_0x4523c5(++_0x557c28);}(_0xffb7,0x80));var _0x7ffb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xffb7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7ffb('0x0'));var util=require('util');var logger=require(_0x7ffb('0x1'))(_0x7ffb('0x2'));var moment=require(_0x7ffb('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ffb('0x4'));var fs=require('fs');var path=require(_0x7ffb('0x5'));var rimraf=require(_0x7ffb('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ffb('0x7'));module['exports']=function(_0x42d27a,_0x2f5afb){return _0x42d27a[_0x7ffb('0x8')](_0x7ffb('0x9'),attributes,{'tableName':_0x7ffb('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 5dceffc..c4d6631 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 _0xf609=['FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFaxQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','error','code','message','result','catch','GetFaxQueue'];(function(_0x249597,_0x49372d){var _0xb78cc0=function(_0x591d7d){while(--_0x591d7d){_0x249597['push'](_0x249597['shift']());}};_0xb78cc0(++_0x49372d);}(_0xf609,0x162));var _0x9f60=function(_0x4b2367,_0x3bee6c){_0x4b2367=_0x4b2367-0x0;var _0x26a012=_0xf609[_0x4b2367];return _0x26a012;};'use strict';var _=require(_0x9f60('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f60('0x1'));var fs=require('fs');var Redis=require(_0x9f60('0x2'));var db=require(_0x9f60('0x3'))['db'];var utils=require(_0x9f60('0x4'));var logger=require(_0x9f60('0x5'))(_0x9f60('0x6'));var config=require(_0x9f60('0x7'));var jayson=require(_0x9f60('0x8'));var client=jayson[_0x9f60('0x9')][_0x9f60('0xa')]({'port':0x232a});config[_0x9f60('0xb')]=_[_0x9f60('0xc')](config[_0x9f60('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f60('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x9f60('0xe')](socket);function respondWithRpcPromise(_0xf42170,_0x5d9cad,_0x2c4210){return new BPromise(function(_0x465bf6,_0xf3da8a){return client[_0x9f60('0xf')](_0xf42170,_0x2c4210)[_0x9f60('0x10')](function(_0x16ce42){logger[_0x9f60('0x11')](_0x9f60('0x12'),_0x5d9cad,'request\x20sent');logger[_0x9f60('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5d9cad,'request\x20sent',JSON['stringify'](_0x16ce42));if(_0x16ce42[_0x9f60('0x14')]){if(_0x16ce42['error'][_0x9f60('0x15')]===0x1f4){logger[_0x9f60('0x14')](_0x9f60('0x12'),_0x5d9cad,_0x16ce42[_0x9f60('0x14')][_0x9f60('0x16')]);return _0xf3da8a(_0x16ce42[_0x9f60('0x14')][_0x9f60('0x16')]);}logger['error'](_0x9f60('0x12'),_0x5d9cad,_0x16ce42[_0x9f60('0x14')][_0x9f60('0x16')]);return _0x465bf6(_0x16ce42[_0x9f60('0x14')][_0x9f60('0x16')]);}else{logger[_0x9f60('0x11')](_0x9f60('0x12'),_0x5d9cad,'request\x20sent');_0x465bf6(_0x16ce42[_0x9f60('0x17')][_0x9f60('0x16')]);}})[_0x9f60('0x18')](function(_0x5bdcab){logger[_0x9f60('0x14')](_0x9f60('0x12'),_0x5d9cad,_0x5bdcab);_0xf3da8a(_0x5bdcab);});});}exports[_0x9f60('0x19')]=function(_0x2d42b4){var _0x52dfa7=this;return new Promise(function(_0x9daacb,_0x20e6fa){return db[_0x9f60('0x1a')][_0x9f60('0x1b')]({'raw':_0x2d42b4['options']?_0x2d42b4[_0x9f60('0x1c')][_0x9f60('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d42b4[_0x9f60('0x1c')]?_0x2d42b4[_0x9f60('0x1c')][_0x9f60('0x1e')]||null:null,'attributes':_0x2d42b4['options']?_0x2d42b4['options'][_0x9f60('0x1f')]||null:null,'limit':_0x2d42b4[_0x9f60('0x1c')]?_0x2d42b4[_0x9f60('0x1c')][_0x9f60('0x20')]||null:null,'include':_0x2d42b4['options']?_0x2d42b4['options'][_0x9f60('0x21')]?_[_0x9f60('0x22')](_0x2d42b4[_0x9f60('0x1c')][_0x9f60('0x21')],function(_0x317a5a){return{'model':db[_0x317a5a[_0x9f60('0x23')]],'as':_0x317a5a['as'],'attributes':_0x317a5a[_0x9f60('0x1f')],'include':_0x317a5a[_0x9f60('0x21')]?_[_0x9f60('0x22')](_0x317a5a['include'],function(_0x5805a2){return{'model':db[_0x5805a2[_0x9f60('0x23')]],'as':_0x5805a2['as'],'attributes':_0x5805a2[_0x9f60('0x1f')],'include':_0x5805a2[_0x9f60('0x21')]?_[_0x9f60('0x22')](_0x5805a2[_0x9f60('0x21')],function(_0x5bc953){return{'model':db[_0x5bc953[_0x9f60('0x23')]],'as':_0x5bc953['as'],'attributes':_0x5bc953[_0x9f60('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9f60('0x10')](function(_0x267b04){logger[_0x9f60('0x11')](_0x9f60('0x19'),_0x2d42b4);logger[_0x9f60('0x13')]('GetFaxQueue',_0x2d42b4,JSON[_0x9f60('0x24')](_0x267b04));_0x9daacb(_0x267b04);})['catch'](function(_0x5f562f){logger[_0x9f60('0x14')](_0x9f60('0x19'),_0x5f562f['message'],_0x2d42b4);_0x20e6fa(_0x52dfa7[_0x9f60('0x14')](0x1f4,_0x5f562f[_0x9f60('0x16')]));});});};exports[_0x9f60('0x25')]=function(_0x3885ce){var _0xddf1b0=this;return new Promise(function(_0x1b713d,_0x5a82fd){return db[_0x9f60('0x1a')]['find']({'raw':_0x3885ce[_0x9f60('0x1c')]?_0x3885ce['options'][_0x9f60('0x1d')]===undefined?!![]:![]:!![],'where':_0x3885ce[_0x9f60('0x1c')]?_0x3885ce[_0x9f60('0x1c')][_0x9f60('0x1e')]||null:null,'attributes':_0x3885ce[_0x9f60('0x1c')]?_0x3885ce['options'][_0x9f60('0x1f')]||null:null,'include':_0x3885ce[_0x9f60('0x1c')]?_0x3885ce['options'][_0x9f60('0x21')]?_[_0x9f60('0x22')](_0x3885ce[_0x9f60('0x1c')][_0x9f60('0x21')],function(_0x51c0d4){return{'model':db[_0x51c0d4[_0x9f60('0x23')]],'as':_0x51c0d4['as'],'attributes':_0x51c0d4['attributes'],'include':_0x51c0d4[_0x9f60('0x21')]?_[_0x9f60('0x22')](_0x51c0d4[_0x9f60('0x21')],function(_0x5289eb){return{'model':db[_0x5289eb[_0x9f60('0x23')]],'as':_0x5289eb['as'],'attributes':_0x5289eb[_0x9f60('0x1f')],'include':_0x5289eb['include']?_[_0x9f60('0x22')](_0x5289eb[_0x9f60('0x21')],function(_0x29b491){return{'model':db[_0x29b491[_0x9f60('0x23')]],'as':_0x29b491['as'],'attributes':_0x29b491[_0x9f60('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9f60('0x10')](function(_0x4139ef){logger[_0x9f60('0x11')](_0x9f60('0x25'),_0x3885ce);logger[_0x9f60('0x13')](_0x9f60('0x25'),_0x3885ce,JSON[_0x9f60('0x24')](_0x4139ef));_0x1b713d(_0x4139ef);})[_0x9f60('0x18')](function(_0x374496){logger[_0x9f60('0x14')]('ShowFaxQueue',_0x374496[_0x9f60('0x16')],_0x3885ce);_0x5a82fd(_0xddf1b0[_0x9f60('0x14')](0x1f4,_0x374496[_0x9f60('0x16')]));});});}; \ No newline at end of file +var _0xb363=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','lodash','util','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb363,0xec));var _0x3b36=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb363[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x3b36('0x0'));var util=require(_0x3b36('0x1'));var moment=require(_0x3b36('0x2'));var BPromise=require(_0x3b36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b36('0x4'));var db=require(_0x3b36('0x5'))['db'];var utils=require(_0x3b36('0x6'));var logger=require(_0x3b36('0x7'))('rpc');var config=require(_0x3b36('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3b36('0x9')]=_[_0x3b36('0xa')](config[_0x3b36('0x9')],{'host':_0x3b36('0xb'),'port':0x18eb});var socket=require(_0x3b36('0xc'))(new Redis(config[_0x3b36('0x9')]));require(_0x3b36('0xd'))[_0x3b36('0xe')](socket);function respondWithRpcPromise(_0x5d6974,_0x48d331,_0x4b32db){return new BPromise(function(_0x31af36,_0x467f5c){return client[_0x3b36('0xf')](_0x5d6974,_0x4b32db)[_0x3b36('0x10')](function(_0x11bbed){logger[_0x3b36('0x11')](_0x3b36('0x12'),_0x48d331,'request\x20sent');logger[_0x3b36('0x13')](_0x3b36('0x14'),_0x48d331,_0x3b36('0x15'),JSON[_0x3b36('0x16')](_0x11bbed));if(_0x11bbed['error']){if(_0x11bbed['error'][_0x3b36('0x17')]===0x1f4){logger[_0x3b36('0x18')](_0x3b36('0x12'),_0x48d331,_0x11bbed[_0x3b36('0x18')][_0x3b36('0x19')]);return _0x467f5c(_0x11bbed[_0x3b36('0x18')][_0x3b36('0x19')]);}logger[_0x3b36('0x18')](_0x3b36('0x12'),_0x48d331,_0x11bbed[_0x3b36('0x18')][_0x3b36('0x19')]);return _0x31af36(_0x11bbed[_0x3b36('0x18')][_0x3b36('0x19')]);}else{logger[_0x3b36('0x11')](_0x3b36('0x12'),_0x48d331,_0x3b36('0x15'));_0x31af36(_0x11bbed[_0x3b36('0x1a')][_0x3b36('0x19')]);}})[_0x3b36('0x1b')](function(_0x3c0b72){logger[_0x3b36('0x18')]('FaxQueue,\x20%s,\x20%s',_0x48d331,_0x3c0b72);_0x467f5c(_0x3c0b72);});});}exports[_0x3b36('0x1c')]=function(_0x5b8afd){var _0x256553=this;return new Promise(function(_0x391d2c,_0x3412fe){return db[_0x3b36('0x1d')][_0x3b36('0x1e')]({'raw':_0x5b8afd[_0x3b36('0x1f')]?_0x5b8afd['options'][_0x3b36('0x20')]===undefined?!![]:![]:!![],'where':_0x5b8afd['options']?_0x5b8afd[_0x3b36('0x1f')][_0x3b36('0x21')]||null:null,'attributes':_0x5b8afd[_0x3b36('0x1f')]?_0x5b8afd[_0x3b36('0x1f')][_0x3b36('0x22')]||null:null,'limit':_0x5b8afd['options']?_0x5b8afd[_0x3b36('0x1f')][_0x3b36('0x23')]||null:null,'include':_0x5b8afd[_0x3b36('0x1f')]?_0x5b8afd[_0x3b36('0x1f')]['include']?_[_0x3b36('0x24')](_0x5b8afd[_0x3b36('0x1f')][_0x3b36('0x25')],function(_0x465680){return{'model':db[_0x465680[_0x3b36('0x26')]],'as':_0x465680['as'],'attributes':_0x465680[_0x3b36('0x22')],'include':_0x465680[_0x3b36('0x25')]?_[_0x3b36('0x24')](_0x465680[_0x3b36('0x25')],function(_0x44cd4d){return{'model':db[_0x44cd4d[_0x3b36('0x26')]],'as':_0x44cd4d['as'],'attributes':_0x44cd4d[_0x3b36('0x22')],'include':_0x44cd4d[_0x3b36('0x25')]?_[_0x3b36('0x24')](_0x44cd4d['include'],function(_0x593994){return{'model':db[_0x593994[_0x3b36('0x26')]],'as':_0x593994['as'],'attributes':_0x593994[_0x3b36('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x133b57){logger[_0x3b36('0x11')](_0x3b36('0x1c'),_0x5b8afd);logger[_0x3b36('0x13')](_0x3b36('0x1c'),_0x5b8afd,JSON[_0x3b36('0x16')](_0x133b57));_0x391d2c(_0x133b57);})[_0x3b36('0x1b')](function(_0x565167){logger['error'](_0x3b36('0x1c'),_0x565167[_0x3b36('0x19')],_0x5b8afd);_0x3412fe(_0x256553[_0x3b36('0x18')](0x1f4,_0x565167[_0x3b36('0x19')]));});});};exports[_0x3b36('0x27')]=function(_0xedfc56){var _0x37bb21=this;return new Promise(function(_0x596283,_0x563424){return db[_0x3b36('0x1d')]['find']({'raw':_0xedfc56[_0x3b36('0x1f')]?_0xedfc56[_0x3b36('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xedfc56[_0x3b36('0x1f')]?_0xedfc56['options'][_0x3b36('0x21')]||null:null,'attributes':_0xedfc56[_0x3b36('0x1f')]?_0xedfc56['options'][_0x3b36('0x22')]||null:null,'include':_0xedfc56[_0x3b36('0x1f')]?_0xedfc56[_0x3b36('0x1f')][_0x3b36('0x25')]?_[_0x3b36('0x24')](_0xedfc56[_0x3b36('0x1f')][_0x3b36('0x25')],function(_0x3aeae5){return{'model':db[_0x3aeae5[_0x3b36('0x26')]],'as':_0x3aeae5['as'],'attributes':_0x3aeae5['attributes'],'include':_0x3aeae5[_0x3b36('0x25')]?_['map'](_0x3aeae5[_0x3b36('0x25')],function(_0x410aa1){return{'model':db[_0x410aa1[_0x3b36('0x26')]],'as':_0x410aa1['as'],'attributes':_0x410aa1[_0x3b36('0x22')],'include':_0x410aa1[_0x3b36('0x25')]?_['map'](_0x410aa1['include'],function(_0x24f8ac){return{'model':db[_0x24f8ac[_0x3b36('0x26')]],'as':_0x24f8ac['as'],'attributes':_0x24f8ac[_0x3b36('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3b36('0x10')](function(_0x40c884){logger['info'](_0x3b36('0x27'),_0xedfc56);logger[_0x3b36('0x13')](_0x3b36('0x27'),_0xedfc56,JSON['stringify'](_0x40c884));_0x596283(_0x40c884);})[_0x3b36('0x1b')](function(_0xb1e05f){logger[_0x3b36('0x18')](_0x3b36('0x27'),_0xb1e05f[_0x3b36('0x19')],_0xedfc56);_0x563424(_0x37bb21[_0x3b36('0x18')](0x1f4,_0xb1e05f[_0x3b36('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 23455ba..e44133b 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 _0xab33=['remove','emit','faxQueue:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab33,0x1a3));var _0x3ab3=function(_0x1d7e64,_0x44f657){_0x1d7e64=_0x1d7e64-0x0;var _0x175935=_0xab33[_0x1d7e64];return _0x175935;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x3ab3('0x0'),_0x3ab3('0x1'),'update'];function createListener(_0x18a618,_0x4d8430){return function(_0x481512){_0x4d8430[_0x3ab3('0x2')](_0x18a618,_0x481512);};}function removeListener(_0x2843e1,_0x310872){return function(){FaxQueueEvents['removeListener'](_0x2843e1,_0x310872);};}exports['register']=function(_0x1495c2){for(var _0x543906=0x0,_0x4451ba=events['length'];_0x543906<_0x4451ba;_0x543906++){var _0x4f760a=events[_0x543906];var _0x277d51=createListener(_0x3ab3('0x3')+_0x4f760a,_0x1495c2);FaxQueueEvents['on'](_0x4f760a,_0x277d51);}}; \ No newline at end of file +var _0x7b14=['./faxQueue.events','emit','register','length','faxQueue:'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7b14,0x91));var _0x47b1=function(_0x430c82,_0x279561){_0x430c82=_0x430c82-0x0;var _0x48dc05=_0x7b14[_0x430c82];return _0x48dc05;};'use strict';var FaxQueueEvents=require(_0x47b1('0x0'));var events=['save','remove','update'];function createListener(_0x5033d7,_0x1ed380){return function(_0x148601){_0x1ed380[_0x47b1('0x1')](_0x5033d7,_0x148601);};}function removeListener(_0x25eb3f,_0x544514){return function(){FaxQueueEvents['removeListener'](_0x25eb3f,_0x544514);};}exports[_0x47b1('0x2')]=function(_0x317a11){for(var _0x465170=0x0,_0x3bc66e=events[_0x47b1('0x3')];_0x465170<_0x3bc66e;_0x465170++){var _0x11ffdb=events[_0x465170];var _0x1d77c2=createListener(_0x47b1('0x4')+_0x11ffdb,_0x317a11);FaxQueueEvents['on'](_0x11ffdb,_0x1d77c2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 66608b8..b31cfa7 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 _0xbff5=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/users','getAgents','create','/:id/teams','addAgents','update','destroy','removeTeams'];(function(_0x4496f3,_0x309546){var _0x5db3c8=function(_0x8eb874){while(--_0x8eb874){_0x4496f3['push'](_0x4496f3['shift']());}};_0x5db3c8(++_0x309546);}(_0xbff5,0x1bc));var _0x5bff=function(_0x37dcb4,_0x3d1071){_0x37dcb4=_0x37dcb4-0x0;var _0x5d366d=_0xbff5[_0x37dcb4];return _0x5d366d;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['get'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['getMembers']);router[_0x5bff('0x8')]('/:id/teams',auth[_0x5bff('0x9')](),controller['getTeams']);router[_0x5bff('0x8')](_0x5bff('0x10'),auth['isAuthenticated'](),controller[_0x5bff('0x11')]);router['post']('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0x12')]);router['post'](_0x5bff('0x13'),auth[_0x5bff('0x9')](),controller['addTeams']);router['post'](_0x5bff('0x10'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x14')]);router['put'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x15')]);router['delete'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x16')]);router['delete'](_0x5bff('0x13'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x17')]);router[_0x5bff('0x18')]('/:id/users',auth[_0x5bff('0x9')](),controller['removeAgents']);module[_0x5bff('0x19')]=router; \ No newline at end of file +var _0x90ec=['/:id/teams','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getAgents','post','create','addTeams','/:id/users','addAgents','delete','destroy'];(function(_0x4ea095,_0x5c34bc){var _0x433dd9=function(_0x57f849){while(--_0x57f849){_0x4ea095['push'](_0x4ea095['shift']());}};_0x433dd9(++_0x5c34bc);}(_0x90ec,0x1d4));var _0xc90e=function(_0x1a862a,_0x18a556){_0x1a862a=_0x1a862a-0x0;var _0x25715b=_0x90ec[_0x1a862a];return _0x25715b;};'use strict';var multer=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var path=require('path');var timeout=require(_0xc90e('0x2'));var express=require(_0xc90e('0x3'));var router=express[_0xc90e('0x4')]();var fs_extra=require(_0xc90e('0x5'));var auth=require(_0xc90e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc90e('0x7'));var controller=require(_0xc90e('0x8'));router[_0xc90e('0x9')]('/',auth['isAuthenticated'](),controller[_0xc90e('0xa')]);router['get'](_0xc90e('0xb'),auth[_0xc90e('0xc')](),controller['describe']);router[_0xc90e('0x9')](_0xc90e('0xd'),auth[_0xc90e('0xc')](),controller[_0xc90e('0xe')]);router[_0xc90e('0x9')](_0xc90e('0xf'),auth[_0xc90e('0xc')](),controller[_0xc90e('0x10')]);router[_0xc90e('0x9')]('/:id/teams',auth[_0xc90e('0xc')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xc90e('0x11')]);router[_0xc90e('0x12')]('/',auth['isAuthenticated'](),controller[_0xc90e('0x13')]);router[_0xc90e('0x12')]('/:id/teams',auth[_0xc90e('0xc')](),controller[_0xc90e('0x14')]);router[_0xc90e('0x12')](_0xc90e('0x15'),auth[_0xc90e('0xc')](),controller[_0xc90e('0x16')]);router['put'](_0xc90e('0xd'),auth[_0xc90e('0xc')](),controller['update']);router[_0xc90e('0x17')]('/:id',auth[_0xc90e('0xc')](),controller[_0xc90e('0x18')]);router['delete'](_0xc90e('0x19'),auth[_0xc90e('0xc')](),controller[_0xc90e('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xc90e('0x1b')]);module[_0xc90e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1d29eb3..070fa8b 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 _0xf864=['exports','STRING','DATE','moment'];(function(_0x5e84dc,_0x54390e){var _0x9eef8d=function(_0x30ab7e){while(--_0x30ab7e){_0x5e84dc['push'](_0x5e84dc['shift']());}};_0x9eef8d(++_0x54390e);}(_0xf864,0x11f));var _0x4f86=function(_0x28d985,_0x4c69d2){_0x28d985=_0x28d985-0x0;var _0x1e000e=_0xf864[_0x28d985];return _0x1e000e;};'use strict';var moment=require(_0x4f86('0x0'));var Sequelize=require('sequelize');module[_0x4f86('0x1')]={'uniqueid':{'type':Sequelize[_0x4f86('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4f86('0x3')]},'exitAt':{'type':Sequelize[_0x4f86('0x3')]},'reason':{'type':Sequelize[_0x4f86('0x2')]}}; \ No newline at end of file +var _0xd2ca=['exports','STRING','DATE','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2ca,0x16f));var _0xad2c=function(_0x3ccf3e,_0x32a1d6){_0x3ccf3e=_0x3ccf3e-0x0;var _0x2ee0a0=_0xd2ca[_0x3ccf3e];return _0x2ee0a0;};'use strict';var moment=require('moment');var Sequelize=require(_0xad2c('0x0'));module[_0xad2c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xad2c('0x2')]},'joinAt':{'type':Sequelize[_0xad2c('0x3')]},'leaveAt':{'type':Sequelize[_0xad2c('0x3')]},'acceptAt':{'type':Sequelize[_0xad2c('0x3')]},'exitAt':{'type':Sequelize[_0xad2c('0x3')]},'reason':{'type':Sequelize[_0xad2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 87134f4..2b4e0d9 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 _0x6075=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x52f0fd,_0x458797){var _0x273fc0=function(_0x2ec1ff){while(--_0x2ec1ff){_0x52f0fd['push'](_0x52f0fd['shift']());}};_0x273fc0(++_0x458797);}(_0x6075,0x142));var _0x5607=function(_0x467cfb,_0xce9b04){_0x467cfb=_0x467cfb-0x0;var _0x2004c8=_0x6075[_0x467cfb];return _0x2004c8;};'use strict';var emlformat=require(_0x5607('0x0'));var rimraf=require(_0x5607('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5607('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5607('0x5'));var csv=require('to-csv');var ejs=require(_0x5607('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5607('0x7'));var squel=require('squel');var crypto=require(_0x5607('0x8'));var jsforce=require(_0x5607('0x9'));var deskjs=require(_0x5607('0xa'));var toCsv=require(_0x5607('0xb'));var querystring=require(_0x5607('0xc'));var Papa=require(_0x5607('0xd'));var Redis=require(_0x5607('0xe'));var authService=require(_0x5607('0xf'));var qs=require(_0x5607('0x10'));var as=require(_0x5607('0x11'));var hardwareService=require(_0x5607('0x12'));var logger=require(_0x5607('0x13'))(_0x5607('0x14'));var utils=require('../../config/utils');var config=require(_0x5607('0x15'));var licenseUtil=require(_0x5607('0x16'));var db=require(_0x5607('0x17'))['db'];function respondWithStatusCode(_0x5d9418,_0x8d61f1){_0x8d61f1=_0x8d61f1||0xcc;return function(_0x4166c7){if(_0x4166c7){return _0x5d9418['sendStatus'](_0x8d61f1);}return _0x5d9418[_0x5607('0x18')](_0x8d61f1)[_0x5607('0x19')]();};}function respondWithResult(_0x47dd56,_0x44642d){_0x44642d=_0x44642d||0xc8;return function(_0x514d22){if(_0x514d22){return _0x47dd56[_0x5607('0x18')](_0x44642d)[_0x5607('0x1a')](_0x514d22);}};}function respondWithFilteredResult(_0x255936,_0x381634){return function(_0x5ba100){if(_0x5ba100){var _0x17ede4=typeof _0x381634[_0x5607('0x1b')]===_0x5607('0x1c')&&typeof _0x381634[_0x5607('0x1d')]===_0x5607('0x1c');var _0xb3bf29=_0x5ba100[_0x5607('0x1e')];var _0xe089=_0x17ede4?0x0:_0x381634[_0x5607('0x1b')];var _0x4295b5=_0x17ede4?_0x5ba100[_0x5607('0x1e')]:_0x381634[_0x5607('0x1b')]+_0x381634['limit'];var _0x58b8de;if(_0x4295b5>=_0xb3bf29){_0x4295b5=_0xb3bf29;_0x58b8de=0xc8;}else{_0x58b8de=0xce;}_0x255936['status'](_0x58b8de);return _0x255936['set'](_0x5607('0x1f'),_0xe089+'-'+_0x4295b5+'/'+_0xb3bf29)[_0x5607('0x1a')](_0x5ba100);}return null;};}function patchUpdates(_0x450dd3){return function(_0x28cd0e){try{jsonpatch[_0x5607('0x20')](_0x28cd0e,_0x450dd3,!![]);}catch(_0x274cfa){return BPromise[_0x5607('0x21')](_0x274cfa);}return _0x28cd0e[_0x5607('0x22')]();};}function saveUpdates(_0x5ecb83,_0x5bb8c7){return function(_0x3e0cbb){if(_0x3e0cbb){return _0x3e0cbb[_0x5607('0x23')](_0x5ecb83)[_0x5607('0x24')](function(_0x479615){return _0x479615;});}return null;};}function removeEntity(_0x2bfa58,_0x82265b){return function(_0x158211){if(_0x158211){return _0x158211[_0x5607('0x25')]()[_0x5607('0x24')](function(){_0x2bfa58[_0x5607('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c215a,_0x294ed1){return function(_0x2234c4){if(!_0x2234c4){_0x4c215a[_0x5607('0x26')](0x194);}return _0x2234c4;};}function handleError(_0x47fe80,_0x4a0f55){_0x4a0f55=_0x4a0f55||0x1f4;return function(_0x1b4e3f){logger['error'](_0x1b4e3f[_0x5607('0x27')]);if(_0x1b4e3f[_0x5607('0x28')]){delete _0x1b4e3f[_0x5607('0x28')];}_0x47fe80[_0x5607('0x18')](_0x4a0f55)[_0x5607('0x29')](_0x1b4e3f);};}exports['index']=function(_0x5bb86c,_0x3cbaa1){var _0x261b36={},_0x207b11={},_0x464ffa={'count':0x0,'rows':[]};var _0x361ad3=_[_0x5607('0x2a')](db[_0x5607('0x2b')][_0x5607('0x2c')],function(_0x4ebf35){return{'name':_0x4ebf35[_0x5607('0x2d')],'type':_0x4ebf35[_0x5607('0x2e')][_0x5607('0x2f')]};});_0x207b11[_0x5607('0x30')]=_[_0x5607('0x2a')](_0x361ad3,_0x5607('0x28'));_0x207b11[_0x5607('0x31')]=_[_0x5607('0x32')](_0x5bb86c[_0x5607('0x31')]);_0x207b11[_0x5607('0x33')]=_['intersection'](_0x207b11[_0x5607('0x30')],_0x207b11['query']);_0x261b36[_0x5607('0x34')]=_[_0x5607('0x35')](_0x207b11[_0x5607('0x30')],qs[_0x5607('0x36')](_0x5bb86c[_0x5607('0x31')]['fields']));_0x261b36[_0x5607('0x34')]=_0x261b36[_0x5607('0x34')][_0x5607('0x37')]?_0x261b36[_0x5607('0x34')]:_0x207b11[_0x5607('0x30')];if(!_0x5bb86c[_0x5607('0x31')][_0x5607('0x38')](_0x5607('0x39'))){_0x261b36[_0x5607('0x1d')]=qs['limit'](_0x5bb86c[_0x5607('0x31')][_0x5607('0x1d')]);_0x261b36[_0x5607('0x1b')]=qs[_0x5607('0x1b')](_0x5bb86c['query']['offset']);}_0x261b36[_0x5607('0x3a')]=qs[_0x5607('0x3b')](_0x5bb86c[_0x5607('0x31')][_0x5607('0x3b')]);_0x261b36['where']=qs[_0x5607('0x33')](_[_0x5607('0x3c')](_0x5bb86c[_0x5607('0x31')],_0x207b11['filters']),_0x361ad3);if(_0x5bb86c[_0x5607('0x31')]['filter']){_0x261b36[_0x5607('0x3d')]=_[_0x5607('0x3e')](_0x261b36[_0x5607('0x3d')],{'$or':_[_0x5607('0x2a')](_0x361ad3,function(_0xf69d5b){if(_0xf69d5b[_0x5607('0x2e')]!==_0x5607('0x3f')){var _0x3349c8={};_0x3349c8[_0xf69d5b[_0x5607('0x28')]]={'$like':'%'+_0x5bb86c[_0x5607('0x31')][_0x5607('0x40')]+'%'};return _0x3349c8;}})});}_0x261b36=_[_0x5607('0x3e')]({},_0x261b36,_0x5bb86c[_0x5607('0x41')]);var _0x4dfaaa={'where':_0x261b36[_0x5607('0x3d')]};return db['FaxQueueReport'][_0x5607('0x1e')](_0x4dfaaa)[_0x5607('0x24')](function(_0x399ad7){_0x464ffa[_0x5607('0x1e')]=_0x399ad7;if(_0x5bb86c[_0x5607('0x31')][_0x5607('0x42')]){_0x261b36[_0x5607('0x43')]=[{'all':!![]}];}return db[_0x5607('0x2b')]['findAll'](_0x261b36);})[_0x5607('0x24')](function(_0x51d69f){_0x464ffa['rows']=_0x51d69f;return _0x464ffa;})['then'](respondWithFilteredResult(_0x3cbaa1,_0x261b36))[_0x5607('0x44')](handleError(_0x3cbaa1,null));};exports[_0x5607('0x45')]=function(_0x541f3e,_0x3cfc39){var _0xf45c0={'raw':!![],'where':{'id':_0x541f3e[_0x5607('0x46')]['id']}},_0x198d1a={};_0x198d1a[_0x5607('0x30')]=_[_0x5607('0x32')](db[_0x5607('0x2b')][_0x5607('0x2c')]);_0x198d1a['query']=_[_0x5607('0x32')](_0x541f3e['query']);_0x198d1a[_0x5607('0x33')]=_[_0x5607('0x35')](_0x198d1a[_0x5607('0x30')],_0x198d1a[_0x5607('0x31')]);_0xf45c0[_0x5607('0x34')]=_[_0x5607('0x35')](_0x198d1a[_0x5607('0x30')],qs[_0x5607('0x36')](_0x541f3e[_0x5607('0x31')][_0x5607('0x36')]));_0xf45c0[_0x5607('0x34')]=_0xf45c0['attributes'][_0x5607('0x37')]?_0xf45c0[_0x5607('0x34')]:_0x198d1a[_0x5607('0x30')];if(_0x541f3e[_0x5607('0x31')]['includeAll']){_0xf45c0[_0x5607('0x43')]=[{'all':!![]}];}_0xf45c0=_[_0x5607('0x3e')]({},_0xf45c0,_0x541f3e['options']);return db[_0x5607('0x2b')][_0x5607('0x47')](_0xf45c0)[_0x5607('0x24')](handleEntityNotFound(_0x3cfc39,null))['then'](respondWithResult(_0x3cfc39,null))[_0x5607('0x44')](handleError(_0x3cfc39,null));};exports[_0x5607('0x48')]=function(_0x38f430,_0x186e0d){return db[_0x5607('0x2b')]['create'](_0x38f430[_0x5607('0x49')],{})['then'](respondWithResult(_0x186e0d,0xc9))[_0x5607('0x44')](handleError(_0x186e0d,null));};exports[_0x5607('0x23')]=function(_0xef0bad,_0x4a36dd){if(_0xef0bad[_0x5607('0x49')]['id']){delete _0xef0bad[_0x5607('0x49')]['id'];}return db[_0x5607('0x2b')][_0x5607('0x47')]({'where':{'id':_0xef0bad[_0x5607('0x46')]['id']}})[_0x5607('0x24')](handleEntityNotFound(_0x4a36dd,null))[_0x5607('0x24')](saveUpdates(_0xef0bad[_0x5607('0x49')],null))[_0x5607('0x24')](respondWithResult(_0x4a36dd,null))[_0x5607('0x44')](handleError(_0x4a36dd,null));};exports[_0x5607('0x25')]=function(_0x108a83,_0x14a3aa){return db['FaxQueueReport'][_0x5607('0x47')]({'where':{'id':_0x108a83['params']['id']}})[_0x5607('0x24')](handleEntityNotFound(_0x14a3aa,null))['then'](removeEntity(_0x14a3aa,null))[_0x5607('0x44')](handleError(_0x14a3aa,null));};exports[_0x5607('0x4a')]=function(_0x3b2ded,_0x26eda1){return db[_0x5607('0x2b')][_0x5607('0x4a')]()[_0x5607('0x24')](respondWithResult(_0x26eda1,null))[_0x5607('0x44')](handleError(_0x26eda1,null));}; \ No newline at end of file +var _0x8ce3=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','FaxQueueReport','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','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','Content-Range','apply','reject'];(function(_0x533f3a,_0x4019f4){var _0x64c095=function(_0x20de6e){while(--_0x20de6e){_0x533f3a['push'](_0x533f3a['shift']());}};_0x64c095(++_0x4019f4);}(_0x8ce3,0xc3));var _0x38ce=function(_0x496af1,_0x2d5f59){_0x496af1=_0x496af1-0x0;var _0x5700b3=_0x8ce3[_0x496af1];return _0x5700b3;};'use strict';var emlformat=require(_0x38ce('0x0'));var rimraf=require(_0x38ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require(_0x38ce('0x6'));var util=require(_0x38ce('0x7'));var path=require(_0x38ce('0x8'));var sox=require(_0x38ce('0x9'));var csv=require('to-csv');var ejs=require(_0x38ce('0xa'));var fs=require('fs');var fs_extra=require(_0x38ce('0xb'));var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xf'));var querystring=require('querystring');var Papa=require(_0x38ce('0x10'));var Redis=require('ioredis');var authService=require(_0x38ce('0x11'));var qs=require(_0x38ce('0x12'));var as=require(_0x38ce('0x13'));var hardwareService=require(_0x38ce('0x14'));var logger=require(_0x38ce('0x15'))(_0x38ce('0x16'));var utils=require(_0x38ce('0x17'));var config=require(_0x38ce('0x18'));var licenseUtil=require(_0x38ce('0x19'));var db=require(_0x38ce('0x1a'))['db'];function respondWithStatusCode(_0x42e234,_0x3ef662){_0x3ef662=_0x3ef662||0xcc;return function(_0x28b554){if(_0x28b554){return _0x42e234[_0x38ce('0x1b')](_0x3ef662);}return _0x42e234[_0x38ce('0x1c')](_0x3ef662)[_0x38ce('0x1d')]();};}function respondWithResult(_0x56a09f,_0x48ba7c){_0x48ba7c=_0x48ba7c||0xc8;return function(_0x3c4d7f){if(_0x3c4d7f){return _0x56a09f[_0x38ce('0x1c')](_0x48ba7c)[_0x38ce('0x1e')](_0x3c4d7f);}};}function respondWithFilteredResult(_0x55be6a,_0x2f3b99){return function(_0x54fcd3){if(_0x54fcd3){var _0x2771ec=typeof _0x2f3b99[_0x38ce('0x1f')]==='undefined'&&typeof _0x2f3b99[_0x38ce('0x20')]===_0x38ce('0x21');var _0x1dfaba=_0x54fcd3['count'];var _0xe4099a=_0x2771ec?0x0:_0x2f3b99[_0x38ce('0x1f')];var _0x3df527=_0x2771ec?_0x54fcd3[_0x38ce('0x22')]:_0x2f3b99[_0x38ce('0x1f')]+_0x2f3b99[_0x38ce('0x20')];var _0x2d4218;if(_0x3df527>=_0x1dfaba){_0x3df527=_0x1dfaba;_0x2d4218=0xc8;}else{_0x2d4218=0xce;}_0x55be6a['status'](_0x2d4218);return _0x55be6a[_0x38ce('0x23')](_0x38ce('0x24'),_0xe4099a+'-'+_0x3df527+'/'+_0x1dfaba)[_0x38ce('0x1e')](_0x54fcd3);}return null;};}function patchUpdates(_0x303391){return function(_0x30b060){try{jsonpatch[_0x38ce('0x25')](_0x30b060,_0x303391,!![]);}catch(_0x323490){return BPromise[_0x38ce('0x26')](_0x323490);}return _0x30b060[_0x38ce('0x27')]();};}function saveUpdates(_0x3cf50b,_0x1aace7){return function(_0x580cf3){if(_0x580cf3){return _0x580cf3[_0x38ce('0x28')](_0x3cf50b)[_0x38ce('0x29')](function(_0xe40e9c){return _0xe40e9c;});}return null;};}function removeEntity(_0xcf5d9e,_0x4a56b0){return function(_0x2c85e6){if(_0x2c85e6){return _0x2c85e6[_0x38ce('0x2a')]()['then'](function(){_0xcf5d9e[_0x38ce('0x1c')](0xcc)[_0x38ce('0x1d')]();});}};}function handleEntityNotFound(_0x43b479,_0x5b330c){return function(_0x4a7e8e){if(!_0x4a7e8e){_0x43b479[_0x38ce('0x1b')](0x194);}return _0x4a7e8e;};}function handleError(_0x28ab4c,_0x142d72){_0x142d72=_0x142d72||0x1f4;return function(_0x21d4e7){logger[_0x38ce('0x2b')](_0x21d4e7[_0x38ce('0x2c')]);if(_0x21d4e7[_0x38ce('0x2d')]){delete _0x21d4e7[_0x38ce('0x2d')];}_0x28ab4c[_0x38ce('0x1c')](_0x142d72)[_0x38ce('0x2e')](_0x21d4e7);};}exports[_0x38ce('0x2f')]=function(_0x381703,_0x50692a){var _0x1212dd={},_0x1538a0={},_0x5b4a7a={'count':0x0,'rows':[]};var _0x229ac2=_[_0x38ce('0x30')](db['FaxQueueReport'][_0x38ce('0x31')],function(_0x282ee4){return{'name':_0x282ee4['fieldName'],'type':_0x282ee4[_0x38ce('0x32')]['key']};});_0x1538a0[_0x38ce('0x33')]=_[_0x38ce('0x30')](_0x229ac2,_0x38ce('0x2d'));_0x1538a0[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x381703[_0x38ce('0x34')]);_0x1538a0[_0x38ce('0x36')]=_[_0x38ce('0x37')](_0x1538a0['model'],_0x1538a0['query']);_0x1212dd[_0x38ce('0x38')]=_[_0x38ce('0x37')](_0x1538a0[_0x38ce('0x33')],qs[_0x38ce('0x39')](_0x381703[_0x38ce('0x34')]['fields']));_0x1212dd[_0x38ce('0x38')]=_0x1212dd[_0x38ce('0x38')][_0x38ce('0x3a')]?_0x1212dd[_0x38ce('0x38')]:_0x1538a0[_0x38ce('0x33')];if(!_0x381703[_0x38ce('0x34')][_0x38ce('0x3b')]('nolimit')){_0x1212dd[_0x38ce('0x20')]=qs[_0x38ce('0x20')](_0x381703['query'][_0x38ce('0x20')]);_0x1212dd[_0x38ce('0x1f')]=qs[_0x38ce('0x1f')](_0x381703[_0x38ce('0x34')][_0x38ce('0x1f')]);}_0x1212dd[_0x38ce('0x3c')]=qs[_0x38ce('0x3d')](_0x381703[_0x38ce('0x34')]['sort']);_0x1212dd[_0x38ce('0x3e')]=qs[_0x38ce('0x36')](_[_0x38ce('0x3f')](_0x381703[_0x38ce('0x34')],_0x1538a0['filters']),_0x229ac2);if(_0x381703[_0x38ce('0x34')]['filter']){_0x1212dd[_0x38ce('0x3e')]=_[_0x38ce('0x40')](_0x1212dd[_0x38ce('0x3e')],{'$or':_[_0x38ce('0x30')](_0x229ac2,function(_0x43d629){if(_0x43d629[_0x38ce('0x32')]!=='VIRTUAL'){var _0x1c3fd5={};_0x1c3fd5[_0x43d629['name']]={'$like':'%'+_0x381703[_0x38ce('0x34')][_0x38ce('0x41')]+'%'};return _0x1c3fd5;}})});}_0x1212dd=_[_0x38ce('0x40')]({},_0x1212dd,_0x381703[_0x38ce('0x42')]);var _0x277e94={'where':_0x1212dd[_0x38ce('0x3e')]};return db['FaxQueueReport'][_0x38ce('0x22')](_0x277e94)[_0x38ce('0x29')](function(_0x318ff8){_0x5b4a7a[_0x38ce('0x22')]=_0x318ff8;if(_0x381703[_0x38ce('0x34')][_0x38ce('0x43')]){_0x1212dd['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x38ce('0x44')](_0x1212dd);})[_0x38ce('0x29')](function(_0x174c86){_0x5b4a7a[_0x38ce('0x45')]=_0x174c86;return _0x5b4a7a;})[_0x38ce('0x29')](respondWithFilteredResult(_0x50692a,_0x1212dd))[_0x38ce('0x46')](handleError(_0x50692a,null));};exports[_0x38ce('0x47')]=function(_0x570a3d,_0x43b4fc){var _0x30cfe3={'raw':!![],'where':{'id':_0x570a3d[_0x38ce('0x48')]['id']}},_0x5a689b={};_0x5a689b[_0x38ce('0x33')]=_[_0x38ce('0x35')](db['FaxQueueReport'][_0x38ce('0x31')]);_0x5a689b[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x570a3d[_0x38ce('0x34')]);_0x5a689b[_0x38ce('0x36')]=_[_0x38ce('0x37')](_0x5a689b['model'],_0x5a689b[_0x38ce('0x34')]);_0x30cfe3[_0x38ce('0x38')]=_[_0x38ce('0x37')](_0x5a689b[_0x38ce('0x33')],qs[_0x38ce('0x39')](_0x570a3d[_0x38ce('0x34')]['fields']));_0x30cfe3[_0x38ce('0x38')]=_0x30cfe3[_0x38ce('0x38')]['length']?_0x30cfe3['attributes']:_0x5a689b['model'];if(_0x570a3d[_0x38ce('0x34')][_0x38ce('0x43')]){_0x30cfe3['include']=[{'all':!![]}];}_0x30cfe3=_['merge']({},_0x30cfe3,_0x570a3d[_0x38ce('0x42')]);return db['FaxQueueReport'][_0x38ce('0x49')](_0x30cfe3)['then'](handleEntityNotFound(_0x43b4fc,null))[_0x38ce('0x29')](respondWithResult(_0x43b4fc,null))[_0x38ce('0x46')](handleError(_0x43b4fc,null));};exports['create']=function(_0x1d9ef8,_0x17a8cf){return db['FaxQueueReport'][_0x38ce('0x4a')](_0x1d9ef8[_0x38ce('0x4b')],{})[_0x38ce('0x29')](respondWithResult(_0x17a8cf,0xc9))[_0x38ce('0x46')](handleError(_0x17a8cf,null));};exports[_0x38ce('0x28')]=function(_0x25a299,_0x58cc6f){if(_0x25a299[_0x38ce('0x4b')]['id']){delete _0x25a299[_0x38ce('0x4b')]['id'];}return db['FaxQueueReport'][_0x38ce('0x49')]({'where':{'id':_0x25a299[_0x38ce('0x48')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x58cc6f,null))[_0x38ce('0x29')](saveUpdates(_0x25a299[_0x38ce('0x4b')],null))[_0x38ce('0x29')](respondWithResult(_0x58cc6f,null))[_0x38ce('0x46')](handleError(_0x58cc6f,null));};exports['destroy']=function(_0x3e1522,_0x34a118){return db[_0x38ce('0x4c')][_0x38ce('0x49')]({'where':{'id':_0x3e1522[_0x38ce('0x48')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x34a118,null))['then'](removeEntity(_0x34a118,null))['catch'](handleError(_0x34a118,null));};exports[_0x38ce('0x4d')]=function(_0x13acb4,_0x2f935f){return db[_0x38ce('0x4c')][_0x38ce('0x4d')]()[_0x38ce('0x29')](respondWithResult(_0x2f935f,null))['catch'](handleError(_0x2f935f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 6a5006f..6a49dec 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bcbb7,_0x2b3295){var _0x46b6a5=function(_0x47b927){while(--_0x47b927){_0x3bcbb7['push'](_0x3bcbb7['shift']());}};_0x46b6a5(++_0x2b3295);}(_0x4975,0x86));var _0x5497=function(_0x1fe788,_0x19b7ef){_0x1fe788=_0x1fe788-0x0;var _0x2edee1=_0x4975[_0x1fe788];return _0x2edee1;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x37410d,_0xb3f6b1){var _0x5be5e2=function(_0xcdf6d5){while(--_0xcdf6d5){_0x37410d['push'](_0x37410d['shift']());}};_0x5be5e2(++_0xb3f6b1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2234bd,_0x259d9d){_0x2234bd=_0x2234bd-0x0;var _0x2aa4bd=_0x7fbe[_0x2234bd];return _0x2aa4bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d3471cf..75f1034 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 _0xa81f=['FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1a4535,_0xf577a6){var _0x5ed87d=function(_0x1af9db){while(--_0x1af9db){_0x1a4535['push'](_0x1a4535['shift']());}};_0x5ed87d(++_0xf577a6);}(_0xa81f,0x77));var _0xfa81=function(_0x43bed9,_0x26adca){_0x43bed9=_0x43bed9-0x0;var _0x27b03d=_0xa81f[_0x43bed9];return _0x27b03d;};'use strict';var _=require(_0xfa81('0x0'));var util=require(_0xfa81('0x1'));var moment=require(_0xfa81('0x2'));var BPromise=require(_0xfa81('0x3'));var rs=require(_0xfa81('0x4'));var fs=require('fs');var Redis=require(_0xfa81('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa81('0x6'));var logger=require(_0xfa81('0x7'))(_0xfa81('0x8'));var config=require(_0xfa81('0x9'));var jayson=require(_0xfa81('0xa'));var client=jayson[_0xfa81('0xb')][_0xfa81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cfc68,_0x23e136,_0x52bc38){return new BPromise(function(_0x50084c,_0x17a3d6){return client[_0xfa81('0xd')](_0x1cfc68,_0x52bc38)[_0xfa81('0xe')](function(_0x37ffcb){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x23e136,_0xfa81('0xf'));logger[_0xfa81('0x10')](_0xfa81('0x11'),_0x23e136,_0xfa81('0xf'),JSON[_0xfa81('0x12')](_0x37ffcb));if(_0x37ffcb[_0xfa81('0x13')]){if(_0x37ffcb[_0xfa81('0x13')][_0xfa81('0x14')]===0x1f4){logger[_0xfa81('0x13')](_0xfa81('0x15'),_0x23e136,_0x37ffcb[_0xfa81('0x13')][_0xfa81('0x16')]);return _0x17a3d6(_0x37ffcb[_0xfa81('0x13')][_0xfa81('0x16')]);}logger[_0xfa81('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x23e136,_0x37ffcb[_0xfa81('0x13')][_0xfa81('0x16')]);return _0x50084c(_0x37ffcb['error'][_0xfa81('0x16')]);}else{logger[_0xfa81('0x17')](_0xfa81('0x15'),_0x23e136,_0xfa81('0xf'));_0x50084c(_0x37ffcb[_0xfa81('0x18')][_0xfa81('0x16')]);}})[_0xfa81('0x19')](function(_0x2746bc){logger[_0xfa81('0x13')](_0xfa81('0x15'),_0x23e136,_0x2746bc);_0x17a3d6(_0x2746bc);});});}exports[_0xfa81('0x1a')]=function(_0x58e39c){var _0x1c3b33=this;return new Promise(function(_0x49edd6,_0x54d3cb){return db[_0xfa81('0x1b')][_0xfa81('0x1c')](_0x58e39c[_0xfa81('0x1d')],{'raw':_0x58e39c[_0xfa81('0x1e')]?_0x58e39c[_0xfa81('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x54104c){logger[_0xfa81('0x17')](_0xfa81('0x1a'),_0x58e39c);logger[_0xfa81('0x10')](_0xfa81('0x1a'),_0x58e39c,JSON[_0xfa81('0x12')](_0x54104c));_0x49edd6(_0x54104c);})[_0xfa81('0x19')](function(_0x20e8c2){logger[_0xfa81('0x13')](_0xfa81('0x1a'),_0x20e8c2[_0xfa81('0x16')],_0x58e39c);_0x54d3cb(_0x1c3b33[_0xfa81('0x13')](0x1f4,_0x20e8c2[_0xfa81('0x16')]));});});};exports[_0xfa81('0x1f')]=function(_0x34d78a){var _0x460aae=this;return new Promise(function(_0x3b22c2,_0x314147){return db[_0xfa81('0x1b')][_0xfa81('0x20')](_0x34d78a[_0xfa81('0x1d')],{'raw':_0x34d78a[_0xfa81('0x1e')]?_0x34d78a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d78a[_0xfa81('0x1e')]?_0x34d78a[_0xfa81('0x1e')][_0xfa81('0x21')]||null:null,'attributes':_0x34d78a[_0xfa81('0x1e')]?_0x34d78a[_0xfa81('0x1e')]['attributes']||null:null,'limit':_0x34d78a[_0xfa81('0x1e')]?_0x34d78a[_0xfa81('0x1e')][_0xfa81('0x22')]||null:null})[_0xfa81('0xe')](function(_0x6a0efd){logger[_0xfa81('0x17')](_0xfa81('0x1f'),_0x34d78a);logger['debug'](_0xfa81('0x1f'),_0x34d78a,JSON['stringify'](_0x6a0efd));_0x3b22c2(_0x6a0efd);})[_0xfa81('0x19')](function(_0x54d5c7){logger[_0xfa81('0x13')]('UpdateFaxQueueReport',_0x54d5c7[_0xfa81('0x16')],_0x34d78a);_0x314147(_0x460aae[_0xfa81('0x13')](0x1f4,_0x54d5c7['message']));});});}; \ No newline at end of file +var _0x800c=['../../config/utils','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','create','body','options','raw','CreateFaxQueueReport','catch','FaxQueueReport','update','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x367a44,_0x121a26){var _0x14c9d1=function(_0x1262a8){while(--_0x1262a8){_0x367a44['push'](_0x367a44['shift']());}};_0x14c9d1(++_0x121a26);}(_0x800c,0x82));var _0xc800=function(_0x1efa50,_0x4308f8){_0x1efa50=_0x1efa50-0x0;var _0x10eca0=_0x800c[_0x1efa50];return _0x10eca0;};'use strict';var _=require(_0xc800('0x0'));var util=require(_0xc800('0x1'));var moment=require(_0xc800('0x2'));var BPromise=require('bluebird');var rs=require(_0xc800('0x3'));var fs=require('fs');var Redis=require(_0xc800('0x4'));var db=require(_0xc800('0x5'))['db'];var utils=require(_0xc800('0x6'));var logger=require('../../config/logger')(_0xc800('0x7'));var config=require(_0xc800('0x8'));var jayson=require(_0xc800('0x9'));var client=jayson[_0xc800('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x347a54,_0x5b558f,_0x54b5a6){return new BPromise(function(_0x441a63,_0x5a3eb5){return client[_0xc800('0xb')](_0x347a54,_0x54b5a6)[_0xc800('0xc')](function(_0x227d25){logger[_0xc800('0xd')](_0xc800('0xe'),_0x5b558f,_0xc800('0xf'));logger[_0xc800('0x10')](_0xc800('0x11'),_0x5b558f,_0xc800('0xf'),JSON[_0xc800('0x12')](_0x227d25));if(_0x227d25['error']){if(_0x227d25[_0xc800('0x13')][_0xc800('0x14')]===0x1f4){logger[_0xc800('0x13')](_0xc800('0xe'),_0x5b558f,_0x227d25[_0xc800('0x13')][_0xc800('0x15')]);return _0x5a3eb5(_0x227d25[_0xc800('0x13')]['message']);}logger['error'](_0xc800('0xe'),_0x5b558f,_0x227d25['error'][_0xc800('0x15')]);return _0x441a63(_0x227d25['error']['message']);}else{logger['info'](_0xc800('0xe'),_0x5b558f,_0xc800('0xf'));_0x441a63(_0x227d25[_0xc800('0x16')][_0xc800('0x15')]);}})['catch'](function(_0x874235){logger['error'](_0xc800('0xe'),_0x5b558f,_0x874235);_0x5a3eb5(_0x874235);});});}exports['CreateFaxQueueReport']=function(_0x219e8d){var _0x2c1354=this;return new Promise(function(_0x1ae846,_0x1b3320){return db['FaxQueueReport'][_0xc800('0x17')](_0x219e8d[_0xc800('0x18')],{'raw':_0x219e8d[_0xc800('0x19')]?_0x219e8d[_0xc800('0x19')][_0xc800('0x1a')]===undefined?!![]:![]:!![]})[_0xc800('0xc')](function(_0x1275ff){logger[_0xc800('0xd')](_0xc800('0x1b'),_0x219e8d);logger[_0xc800('0x10')](_0xc800('0x1b'),_0x219e8d,JSON[_0xc800('0x12')](_0x1275ff));_0x1ae846(_0x1275ff);})[_0xc800('0x1c')](function(_0x24efa1){logger[_0xc800('0x13')](_0xc800('0x1b'),_0x24efa1['message'],_0x219e8d);_0x1b3320(_0x2c1354[_0xc800('0x13')](0x1f4,_0x24efa1[_0xc800('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x1d837d){var _0x3c3a3f=this;return new Promise(function(_0x54382e,_0xe2718a){return db[_0xc800('0x1d')][_0xc800('0x1e')](_0x1d837d['body'],{'raw':_0x1d837d[_0xc800('0x19')]?_0x1d837d['options'][_0xc800('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d837d['options']?_0x1d837d['options']['where']||null:null,'attributes':_0x1d837d['options']?_0x1d837d[_0xc800('0x19')][_0xc800('0x1f')]||null:null,'limit':_0x1d837d[_0xc800('0x19')]?_0x1d837d[_0xc800('0x19')][_0xc800('0x20')]||null:null})['then'](function(_0x501052){logger[_0xc800('0xd')](_0xc800('0x21'),_0x1d837d);logger[_0xc800('0x10')]('UpdateFaxQueueReport',_0x1d837d,JSON[_0xc800('0x12')](_0x501052));_0x54382e(_0x501052);})['catch'](function(_0x455864){logger['error'](_0xc800('0x21'),_0x455864['message'],_0x1d837d);_0xe2718a(_0x3c3a3f[_0xc800('0x13')](0x1f4,_0x455864[_0xc800('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 1051304..d97642e 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 _0x20e5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','create','put','update','delete','exports','multer','util'];(function(_0x171da3,_0x466402){var _0x5c9866=function(_0x59b39b){while(--_0x59b39b){_0x171da3['push'](_0x171da3['shift']());}};_0x5c9866(++_0x466402);}(_0x20e5,0x18d));var _0x520e=function(_0x8f0f2c,_0x3b7304){_0x8f0f2c=_0x8f0f2c-0x0;var _0x114143=_0x20e5[_0x8f0f2c];return _0x114143;};'use strict';var multer=require(_0x520e('0x0'));var util=require(_0x520e('0x1'));var path=require(_0x520e('0x2'));var timeout=require('connect-timeout');var express=require(_0x520e('0x3'));var router=express[_0x520e('0x4')]();var fs_extra=require(_0x520e('0x5'));var auth=require(_0x520e('0x6'));var interaction=require(_0x520e('0x7'));var config=require(_0x520e('0x8'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x520e('0x9')](),controller[_0x520e('0xa')]);router['get']('/describe',auth[_0x520e('0x9')](),controller[_0x520e('0xb')]);router[_0x520e('0xc')](_0x520e('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x520e('0x9')](),controller[_0x520e('0xe')]);router[_0x520e('0xf')](_0x520e('0xd'),auth[_0x520e('0x9')](),controller[_0x520e('0x10')]);router[_0x520e('0x11')](_0x520e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x520e('0x12')]=router; \ No newline at end of file +var _0x9539=['update','delete','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x323c2f,_0x4d5a51){var _0x47f06a=function(_0x56827a){while(--_0x56827a){_0x323c2f['push'](_0x323c2f['shift']());}};_0x47f06a(++_0x4d5a51);}(_0x9539,0x116));var _0x9953=function(_0x5e9759,_0x444bb7){_0x5e9759=_0x5e9759-0x0;var _0x3c022b=_0x9539[_0x5e9759];return _0x3c022b;};'use strict';var multer=require('multer');var util=require(_0x9953('0x0'));var path=require(_0x9953('0x1'));var timeout=require('connect-timeout');var express=require(_0x9953('0x2'));var router=express[_0x9953('0x3')]();var fs_extra=require(_0x9953('0x4'));var auth=require(_0x9953('0x5'));var interaction=require(_0x9953('0x6'));var config=require(_0x9953('0x7'));var controller=require(_0x9953('0x8'));router[_0x9953('0x9')]('/',auth[_0x9953('0xa')](),controller[_0x9953('0xb')]);router[_0x9953('0x9')](_0x9953('0xc'),auth['isAuthenticated'](),controller[_0x9953('0xd')]);router[_0x9953('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9953('0xe')]);router[_0x9953('0xf')]('/',auth[_0x9953('0xa')](),controller['create']);router['put']('/:id',auth[_0x9953('0xa')](),controller[_0x9953('0x10')]);router[_0x9953('0x11')](_0x9953('0x12'),auth['isAuthenticated'](),controller[_0x9953('0x13')]);module[_0x9953('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 33bc9e9..252a117 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x1e4d2d,_0x28d990){var _0xb4a0f9=function(_0x51b87f){while(--_0x51b87f){_0x1e4d2d['push'](_0x1e4d2d['shift']());}};_0xb4a0f9(++_0x28d990);}(_0xe706,0xa3));var _0x6e70=function(_0x2d50be,_0x4e2d7c){_0x2d50be=_0x2d50be-0x0;var _0x2d3545=_0xe706[_0x2d50be];return _0x2d3545;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xd4ac62,_0x396930){var _0x5f38d3=function(_0x136f81){while(--_0x136f81){_0xd4ac62['push'](_0xd4ac62['shift']());}};_0x5f38d3(++_0x396930);}(_0x34e8,0x12c));var _0x834e=function(_0x4f6083,_0x5aefc6){_0x4f6083=_0x4f6083-0x0;var _0x149ad5=_0x34e8[_0x4f6083];return _0x149ad5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 0699403..997d85e 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 _0xdd74=['type','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xdd74,0xab));var _0x4dd7=function(_0x1402d8,_0x3ccea1){_0x1402d8=_0x1402d8-0x0;var _0x54a6ac=_0xdd74[_0x1402d8];return _0x54a6ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4dd7('0x0'));var zipdir=require(_0x4dd7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4dd7('0x2'));var moment=require('moment');var BPromise=require(_0x4dd7('0x3'));var Mustache=require(_0x4dd7('0x4'));var util=require(_0x4dd7('0x5'));var path=require(_0x4dd7('0x6'));var sox=require(_0x4dd7('0x7'));var csv=require(_0x4dd7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4dd7('0x9'));var _=require('lodash');var squel=require(_0x4dd7('0xa'));var crypto=require(_0x4dd7('0xb'));var jsforce=require(_0x4dd7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4dd7('0x8'));var querystring=require(_0x4dd7('0xd'));var Papa=require(_0x4dd7('0xe'));var Redis=require(_0x4dd7('0xf'));var authService=require(_0x4dd7('0x10'));var qs=require(_0x4dd7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dd7('0x12'));var logger=require(_0x4dd7('0x13'))(_0x4dd7('0x14'));var utils=require(_0x4dd7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4dd7('0x16'));var db=require(_0x4dd7('0x17'))['db'];function respondWithStatusCode(_0x2a4071,_0xdd5a69){_0xdd5a69=_0xdd5a69||0xcc;return function(_0x105bb9){if(_0x105bb9){return _0x2a4071[_0x4dd7('0x18')](_0xdd5a69);}return _0x2a4071[_0x4dd7('0x19')](_0xdd5a69)[_0x4dd7('0x1a')]();};}function respondWithResult(_0x20a764,_0x5b8221){_0x5b8221=_0x5b8221||0xc8;return function(_0x334e6b){if(_0x334e6b){return _0x20a764['status'](_0x5b8221)[_0x4dd7('0x1b')](_0x334e6b);}};}function respondWithFilteredResult(_0x4c02b8,_0x5a7485){return function(_0x3ac468){if(_0x3ac468){var _0x1c98fe=typeof _0x5a7485[_0x4dd7('0x1c')]==='undefined'&&typeof _0x5a7485[_0x4dd7('0x1d')]===_0x4dd7('0x1e');var _0x2f3594=_0x3ac468[_0x4dd7('0x1f')];var _0x5640ca=_0x1c98fe?0x0:_0x5a7485[_0x4dd7('0x1c')];var _0x2b3da2=_0x1c98fe?_0x3ac468[_0x4dd7('0x1f')]:_0x5a7485[_0x4dd7('0x1c')]+_0x5a7485[_0x4dd7('0x1d')];var _0x5d2f8e;if(_0x2b3da2>=_0x2f3594){_0x2b3da2=_0x2f3594;_0x5d2f8e=0xc8;}else{_0x5d2f8e=0xce;}_0x4c02b8[_0x4dd7('0x19')](_0x5d2f8e);return _0x4c02b8[_0x4dd7('0x20')]('Content-Range',_0x5640ca+'-'+_0x2b3da2+'/'+_0x2f3594)['json'](_0x3ac468);}return null;};}function patchUpdates(_0x434ec2){return function(_0x422400){try{jsonpatch[_0x4dd7('0x21')](_0x422400,_0x434ec2,!![]);}catch(_0x2b20ec){return BPromise[_0x4dd7('0x22')](_0x2b20ec);}return _0x422400[_0x4dd7('0x23')]();};}function saveUpdates(_0x5d6d88,_0x12511b){return function(_0x2c0e21){if(_0x2c0e21){return _0x2c0e21[_0x4dd7('0x24')](_0x5d6d88)['then'](function(_0x2fd6e5){return _0x2fd6e5;});}return null;};}function removeEntity(_0x4d065c,_0x174d31){return function(_0x4d9774){if(_0x4d9774){return _0x4d9774['destroy']()[_0x4dd7('0x25')](function(){_0x4d065c[_0x4dd7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d813f,_0x246836){return function(_0x41f422){if(!_0x41f422){_0x1d813f[_0x4dd7('0x18')](0x194);}return _0x41f422;};}function handleError(_0x1dfcbe,_0x28873e){_0x28873e=_0x28873e||0x1f4;return function(_0xba8617){logger['error'](_0xba8617[_0x4dd7('0x26')]);if(_0xba8617[_0x4dd7('0x27')]){delete _0xba8617[_0x4dd7('0x27')];}_0x1dfcbe[_0x4dd7('0x19')](_0x28873e)[_0x4dd7('0x28')](_0xba8617);};}exports[_0x4dd7('0x29')]=function(_0x4355eb,_0x3c8ee9){var _0x3f73af={},_0x33c675={},_0x21ae0c={'count':0x0,'rows':[]};var _0xa7bfe6=_[_0x4dd7('0x2a')](db['FaxTransferReport'][_0x4dd7('0x2b')],function(_0x7874d5){return{'name':_0x7874d5[_0x4dd7('0x2c')],'type':_0x7874d5['type'][_0x4dd7('0x2d')]};});_0x33c675[_0x4dd7('0x2e')]=_[_0x4dd7('0x2a')](_0xa7bfe6,_0x4dd7('0x27'));_0x33c675['query']=_[_0x4dd7('0x2f')](_0x4355eb[_0x4dd7('0x30')]);_0x33c675[_0x4dd7('0x31')]=_[_0x4dd7('0x32')](_0x33c675[_0x4dd7('0x2e')],_0x33c675[_0x4dd7('0x30')]);_0x3f73af[_0x4dd7('0x33')]=_[_0x4dd7('0x32')](_0x33c675[_0x4dd7('0x2e')],qs[_0x4dd7('0x34')](_0x4355eb[_0x4dd7('0x30')][_0x4dd7('0x34')]));_0x3f73af[_0x4dd7('0x33')]=_0x3f73af[_0x4dd7('0x33')]['length']?_0x3f73af['attributes']:_0x33c675[_0x4dd7('0x2e')];if(!_0x4355eb[_0x4dd7('0x30')][_0x4dd7('0x35')]('nolimit')){_0x3f73af['limit']=qs['limit'](_0x4355eb['query'][_0x4dd7('0x1d')]);_0x3f73af['offset']=qs[_0x4dd7('0x1c')](_0x4355eb[_0x4dd7('0x30')][_0x4dd7('0x1c')]);}_0x3f73af[_0x4dd7('0x36')]=qs['sort'](_0x4355eb[_0x4dd7('0x30')][_0x4dd7('0x37')]);_0x3f73af['where']=qs[_0x4dd7('0x31')](_[_0x4dd7('0x38')](_0x4355eb[_0x4dd7('0x30')],_0x33c675[_0x4dd7('0x31')]),_0xa7bfe6);if(_0x4355eb[_0x4dd7('0x30')][_0x4dd7('0x39')]){_0x3f73af[_0x4dd7('0x3a')]=_[_0x4dd7('0x3b')](_0x3f73af['where'],{'$or':_[_0x4dd7('0x2a')](_0xa7bfe6,function(_0x32f542){if(_0x32f542[_0x4dd7('0x3c')]!==_0x4dd7('0x3d')){var _0x329940={};_0x329940[_0x32f542[_0x4dd7('0x27')]]={'$like':'%'+_0x4355eb[_0x4dd7('0x30')][_0x4dd7('0x39')]+'%'};return _0x329940;}})});}_0x3f73af=_['merge']({},_0x3f73af,_0x4355eb[_0x4dd7('0x3e')]);var _0x2bbed7={'where':_0x3f73af[_0x4dd7('0x3a')]};return db[_0x4dd7('0x3f')][_0x4dd7('0x1f')](_0x2bbed7)['then'](function(_0x1ff95d){_0x21ae0c[_0x4dd7('0x1f')]=_0x1ff95d;if(_0x4355eb[_0x4dd7('0x30')][_0x4dd7('0x40')]){_0x3f73af[_0x4dd7('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x4dd7('0x42')](_0x3f73af);})[_0x4dd7('0x25')](function(_0x4b16cf){_0x21ae0c[_0x4dd7('0x43')]=_0x4b16cf;return _0x21ae0c;})[_0x4dd7('0x25')](respondWithFilteredResult(_0x3c8ee9,_0x3f73af))[_0x4dd7('0x44')](handleError(_0x3c8ee9,null));};exports[_0x4dd7('0x45')]=function(_0x1c4a23,_0x51d5dd){var _0x3c82ca={'raw':!![],'where':{'id':_0x1c4a23['params']['id']}},_0x4cc2e9={};_0x4cc2e9['model']=_[_0x4dd7('0x2f')](db[_0x4dd7('0x3f')][_0x4dd7('0x2b')]);_0x4cc2e9[_0x4dd7('0x30')]=_[_0x4dd7('0x2f')](_0x1c4a23[_0x4dd7('0x30')]);_0x4cc2e9[_0x4dd7('0x31')]=_['intersection'](_0x4cc2e9[_0x4dd7('0x2e')],_0x4cc2e9[_0x4dd7('0x30')]);_0x3c82ca[_0x4dd7('0x33')]=_[_0x4dd7('0x32')](_0x4cc2e9[_0x4dd7('0x2e')],qs[_0x4dd7('0x34')](_0x1c4a23[_0x4dd7('0x30')][_0x4dd7('0x34')]));_0x3c82ca[_0x4dd7('0x33')]=_0x3c82ca[_0x4dd7('0x33')][_0x4dd7('0x46')]?_0x3c82ca[_0x4dd7('0x33')]:_0x4cc2e9[_0x4dd7('0x2e')];if(_0x1c4a23[_0x4dd7('0x30')]['includeAll']){_0x3c82ca[_0x4dd7('0x41')]=[{'all':!![]}];}_0x3c82ca=_[_0x4dd7('0x3b')]({},_0x3c82ca,_0x1c4a23[_0x4dd7('0x3e')]);return db[_0x4dd7('0x3f')][_0x4dd7('0x47')](_0x3c82ca)[_0x4dd7('0x25')](handleEntityNotFound(_0x51d5dd,null))['then'](respondWithResult(_0x51d5dd,null))[_0x4dd7('0x44')](handleError(_0x51d5dd,null));};exports[_0x4dd7('0x48')]=function(_0x14c681,_0x1ce566){return db['FaxTransferReport']['create'](_0x14c681[_0x4dd7('0x49')],{})['then'](respondWithResult(_0x1ce566,0xc9))[_0x4dd7('0x44')](handleError(_0x1ce566,null));};exports[_0x4dd7('0x24')]=function(_0xebf291,_0x217eef){if(_0xebf291[_0x4dd7('0x49')]['id']){delete _0xebf291[_0x4dd7('0x49')]['id'];}return db[_0x4dd7('0x3f')][_0x4dd7('0x47')]({'where':{'id':_0xebf291[_0x4dd7('0x4a')]['id']}})[_0x4dd7('0x25')](handleEntityNotFound(_0x217eef,null))['then'](saveUpdates(_0xebf291[_0x4dd7('0x49')],null))[_0x4dd7('0x25')](respondWithResult(_0x217eef,null))[_0x4dd7('0x44')](handleError(_0x217eef,null));};exports[_0x4dd7('0x4b')]=function(_0x4850de,_0x4fe772){return db[_0x4dd7('0x3f')][_0x4dd7('0x47')]({'where':{'id':_0x4850de['params']['id']}})['then'](handleEntityNotFound(_0x4fe772,null))['then'](removeEntity(_0x4fe772,null))[_0x4dd7('0x44')](handleError(_0x4fe772,null));};exports[_0x4dd7('0x4c')]=function(_0xdc54e0,_0x26b7ff){return db['FaxTransferReport']['describe']()[_0x4dd7('0x25')](respondWithResult(_0x26b7ff,null))[_0x4dd7('0x44')](handleError(_0x26b7ff,null));}; \ No newline at end of file +var _0xa50e=['save','then','destroy','stack','name','index','FaxTransferReport','type','key','keys','query','filters','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','update','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x3e97f5,_0x485e2c){var _0x4f8183=function(_0x3c2398){while(--_0x3c2398){_0x3e97f5['push'](_0x3e97f5['shift']());}};_0x4f8183(++_0x485e2c);}(_0xa50e,0x1d6));var _0xea50=function(_0x2b644e,_0x243bfc){_0x2b644e=_0x2b644e-0x0;var _0x2ad018=_0xa50e[_0x2b644e];return _0x2ad018;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea50('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea50('0x1'));var moment=require('moment');var BPromise=require(_0xea50('0x2'));var Mustache=require(_0xea50('0x3'));var util=require(_0xea50('0x4'));var path=require(_0xea50('0x5'));var sox=require(_0xea50('0x6'));var csv=require('to-csv');var ejs=require(_0xea50('0x7'));var fs=require('fs');var fs_extra=require(_0xea50('0x8'));var _=require(_0xea50('0x9'));var squel=require('squel');var crypto=require(_0xea50('0xa'));var jsforce=require(_0xea50('0xb'));var deskjs=require(_0xea50('0xc'));var toCsv=require(_0xea50('0xd'));var querystring=require(_0xea50('0xe'));var Papa=require(_0xea50('0xf'));var Redis=require(_0xea50('0x10'));var authService=require(_0xea50('0x11'));var qs=require(_0xea50('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea50('0x13'))('api');var utils=require(_0xea50('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xea50('0x15'));var db=require(_0xea50('0x16'))['db'];function respondWithStatusCode(_0x52793f,_0x4852eb){_0x4852eb=_0x4852eb||0xcc;return function(_0x14be93){if(_0x14be93){return _0x52793f[_0xea50('0x17')](_0x4852eb);}return _0x52793f[_0xea50('0x18')](_0x4852eb)[_0xea50('0x19')]();};}function respondWithResult(_0xdaba12,_0x1761f1){_0x1761f1=_0x1761f1||0xc8;return function(_0xf03c23){if(_0xf03c23){return _0xdaba12['status'](_0x1761f1)[_0xea50('0x1a')](_0xf03c23);}};}function respondWithFilteredResult(_0x1659b0,_0x2eff88){return function(_0x50c318){if(_0x50c318){var _0xf9160b=typeof _0x2eff88[_0xea50('0x1b')]===_0xea50('0x1c')&&typeof _0x2eff88[_0xea50('0x1d')]===_0xea50('0x1c');var _0x5bf7ac=_0x50c318[_0xea50('0x1e')];var _0x33f879=_0xf9160b?0x0:_0x2eff88['offset'];var _0x317d61=_0xf9160b?_0x50c318['count']:_0x2eff88[_0xea50('0x1b')]+_0x2eff88[_0xea50('0x1d')];var _0x1553cb;if(_0x317d61>=_0x5bf7ac){_0x317d61=_0x5bf7ac;_0x1553cb=0xc8;}else{_0x1553cb=0xce;}_0x1659b0[_0xea50('0x18')](_0x1553cb);return _0x1659b0[_0xea50('0x1f')](_0xea50('0x20'),_0x33f879+'-'+_0x317d61+'/'+_0x5bf7ac)['json'](_0x50c318);}return null;};}function patchUpdates(_0x585c21){return function(_0x5ba924){try{jsonpatch[_0xea50('0x21')](_0x5ba924,_0x585c21,!![]);}catch(_0x3deb92){return BPromise['reject'](_0x3deb92);}return _0x5ba924[_0xea50('0x22')]();};}function saveUpdates(_0x1cb14b,_0x5a90d4){return function(_0x45d7c3){if(_0x45d7c3){return _0x45d7c3['update'](_0x1cb14b)[_0xea50('0x23')](function(_0x13ea8e){return _0x13ea8e;});}return null;};}function removeEntity(_0x24fdaf,_0x3a0df7){return function(_0x2725d1){if(_0x2725d1){return _0x2725d1[_0xea50('0x24')]()['then'](function(){_0x24fdaf[_0xea50('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2f16,_0x2b2135){return function(_0x3dac33){if(!_0x3dac33){_0x3c2f16['sendStatus'](0x194);}return _0x3dac33;};}function handleError(_0x2d925b,_0x10b7a6){_0x10b7a6=_0x10b7a6||0x1f4;return function(_0x13c3c6){logger['error'](_0x13c3c6[_0xea50('0x25')]);if(_0x13c3c6[_0xea50('0x26')]){delete _0x13c3c6[_0xea50('0x26')];}_0x2d925b[_0xea50('0x18')](_0x10b7a6)['send'](_0x13c3c6);};}exports[_0xea50('0x27')]=function(_0x1414cb,_0x3427d9){var _0xd27f44={},_0xb51651={},_0x11137e={'count':0x0,'rows':[]};var _0x5acc12=_['map'](db[_0xea50('0x28')]['rawAttributes'],function(_0x50e44d){return{'name':_0x50e44d['fieldName'],'type':_0x50e44d[_0xea50('0x29')][_0xea50('0x2a')]};});_0xb51651['model']=_['map'](_0x5acc12,_0xea50('0x26'));_0xb51651['query']=_[_0xea50('0x2b')](_0x1414cb[_0xea50('0x2c')]);_0xb51651[_0xea50('0x2d')]=_['intersection'](_0xb51651['model'],_0xb51651[_0xea50('0x2c')]);_0xd27f44[_0xea50('0x2e')]=_['intersection'](_0xb51651[_0xea50('0x2f')],qs['fields'](_0x1414cb['query'][_0xea50('0x30')]));_0xd27f44[_0xea50('0x2e')]=_0xd27f44['attributes'][_0xea50('0x31')]?_0xd27f44['attributes']:_0xb51651[_0xea50('0x2f')];if(!_0x1414cb[_0xea50('0x2c')]['hasOwnProperty'](_0xea50('0x32'))){_0xd27f44['limit']=qs[_0xea50('0x1d')](_0x1414cb[_0xea50('0x2c')][_0xea50('0x1d')]);_0xd27f44['offset']=qs[_0xea50('0x1b')](_0x1414cb[_0xea50('0x2c')][_0xea50('0x1b')]);}_0xd27f44[_0xea50('0x33')]=qs[_0xea50('0x34')](_0x1414cb[_0xea50('0x2c')]['sort']);_0xd27f44[_0xea50('0x35')]=qs[_0xea50('0x2d')](_[_0xea50('0x36')](_0x1414cb['query'],_0xb51651[_0xea50('0x2d')]),_0x5acc12);if(_0x1414cb[_0xea50('0x2c')]['filter']){_0xd27f44[_0xea50('0x35')]=_[_0xea50('0x37')](_0xd27f44[_0xea50('0x35')],{'$or':_[_0xea50('0x38')](_0x5acc12,function(_0x42935f){if(_0x42935f[_0xea50('0x29')]!=='VIRTUAL'){var _0x1e6145={};_0x1e6145[_0x42935f[_0xea50('0x26')]]={'$like':'%'+_0x1414cb[_0xea50('0x2c')]['filter']+'%'};return _0x1e6145;}})});}_0xd27f44=_[_0xea50('0x37')]({},_0xd27f44,_0x1414cb[_0xea50('0x39')]);var _0x48d824={'where':_0xd27f44[_0xea50('0x35')]};return db[_0xea50('0x28')][_0xea50('0x1e')](_0x48d824)['then'](function(_0x20e440){_0x11137e['count']=_0x20e440;if(_0x1414cb[_0xea50('0x2c')][_0xea50('0x3a')]){_0xd27f44[_0xea50('0x3b')]=[{'all':!![]}];}return db[_0xea50('0x28')][_0xea50('0x3c')](_0xd27f44);})[_0xea50('0x23')](function(_0x419169){_0x11137e[_0xea50('0x3d')]=_0x419169;return _0x11137e;})['then'](respondWithFilteredResult(_0x3427d9,_0xd27f44))[_0xea50('0x3e')](handleError(_0x3427d9,null));};exports[_0xea50('0x3f')]=function(_0x3eb7dd,_0xb18258){var _0x49c9eb={'raw':!![],'where':{'id':_0x3eb7dd[_0xea50('0x40')]['id']}},_0x140f90={};_0x140f90[_0xea50('0x2f')]=_[_0xea50('0x2b')](db[_0xea50('0x28')][_0xea50('0x41')]);_0x140f90['query']=_[_0xea50('0x2b')](_0x3eb7dd['query']);_0x140f90['filters']=_[_0xea50('0x42')](_0x140f90['model'],_0x140f90[_0xea50('0x2c')]);_0x49c9eb[_0xea50('0x2e')]=_['intersection'](_0x140f90[_0xea50('0x2f')],qs[_0xea50('0x30')](_0x3eb7dd[_0xea50('0x2c')]['fields']));_0x49c9eb[_0xea50('0x2e')]=_0x49c9eb['attributes'][_0xea50('0x31')]?_0x49c9eb[_0xea50('0x2e')]:_0x140f90[_0xea50('0x2f')];if(_0x3eb7dd[_0xea50('0x2c')][_0xea50('0x3a')]){_0x49c9eb['include']=[{'all':!![]}];}_0x49c9eb=_[_0xea50('0x37')]({},_0x49c9eb,_0x3eb7dd[_0xea50('0x39')]);return db[_0xea50('0x28')][_0xea50('0x43')](_0x49c9eb)['then'](handleEntityNotFound(_0xb18258,null))[_0xea50('0x23')](respondWithResult(_0xb18258,null))[_0xea50('0x3e')](handleError(_0xb18258,null));};exports['create']=function(_0x424dbc,_0x2574c1){return db[_0xea50('0x28')][_0xea50('0x44')](_0x424dbc[_0xea50('0x45')],{})['then'](respondWithResult(_0x2574c1,0xc9))[_0xea50('0x3e')](handleError(_0x2574c1,null));};exports[_0xea50('0x46')]=function(_0x262bcc,_0x44ac12){if(_0x262bcc[_0xea50('0x45')]['id']){delete _0x262bcc['body']['id'];}return db['FaxTransferReport'][_0xea50('0x43')]({'where':{'id':_0x262bcc['params']['id']}})[_0xea50('0x23')](handleEntityNotFound(_0x44ac12,null))['then'](saveUpdates(_0x262bcc['body'],null))[_0xea50('0x23')](respondWithResult(_0x44ac12,null))[_0xea50('0x3e')](handleError(_0x44ac12,null));};exports[_0xea50('0x24')]=function(_0x3307da,_0x7d5b61){return db[_0xea50('0x28')][_0xea50('0x43')]({'where':{'id':_0x3307da['params']['id']}})[_0xea50('0x23')](handleEntityNotFound(_0x7d5b61,null))['then'](removeEntity(_0x7d5b61,null))['catch'](handleError(_0x7d5b61,null));};exports['describe']=function(_0x271ee5,_0x21cceb){return db[_0xea50('0x28')][_0xea50('0x47')]()['then'](respondWithResult(_0x21cceb,null))['catch'](handleError(_0x21cceb,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 778a1af..f7ae995 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 _0xf122=['./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5651ee,_0x5ca2ec){var _0x459bf9=function(_0x69f9b0){while(--_0x69f9b0){_0x5651ee['push'](_0x5651ee['shift']());}};_0x459bf9(++_0x5ca2ec);}(_0xf122,0x17f));var _0x2f12=function(_0x27bfef,_0x10fe6e){_0x27bfef=_0x27bfef-0x0;var _0x3c67c6=_0xf122[_0x27bfef];return _0x3c67c6;};'use strict';var _=require(_0x2f12('0x0'));var util=require(_0x2f12('0x1'));var logger=require('../../config/logger')(_0x2f12('0x2'));var moment=require(_0x2f12('0x3'));var BPromise=require(_0x2f12('0x4'));var rp=require(_0x2f12('0x5'));var fs=require('fs');var path=require(_0x2f12('0x6'));var rimraf=require(_0x2f12('0x7'));var config=require(_0x2f12('0x8'));var attributes=require(_0x2f12('0x9'));module['exports']=function(_0x4564d,_0x30fffa){return _0x4564d[_0x2f12('0xa')](_0x2f12('0xb'),attributes,{'tableName':_0x2f12('0xc'),'paranoid':![],'indexes':[{'name':_0x2f12('0xd'),'fields':[_0x2f12('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9c5=['uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer'];(function(_0x316185,_0x3bfa56){var _0x55f870=function(_0x185e62){while(--_0x185e62){_0x316185['push'](_0x316185['shift']());}};_0x55f870(++_0x3bfa56);}(_0xb9c5,0x90));var _0x5b9c=function(_0x3b6dff,_0x211326){_0x3b6dff=_0x3b6dff-0x0;var _0x48aab4=_0xb9c5[_0x3b6dff];return _0x48aab4;};'use strict';var _=require('lodash');var util=require(_0x5b9c('0x0'));var logger=require('../../config/logger')(_0x5b9c('0x1'));var moment=require(_0x5b9c('0x2'));var BPromise=require(_0x5b9c('0x3'));var rp=require(_0x5b9c('0x4'));var fs=require('fs');var path=require(_0x5b9c('0x5'));var rimraf=require(_0x5b9c('0x6'));var config=require(_0x5b9c('0x7'));var attributes=require(_0x5b9c('0x8'));module[_0x5b9c('0x9')]=function(_0x12b0e8,_0x1d95c1){return _0x12b0e8[_0x5b9c('0xa')]('FaxTransferReport',attributes,{'tableName':_0x5b9c('0xb'),'paranoid':![],'indexes':[{'name':_0x5b9c('0xc'),'fields':[_0x5b9c('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 318c722..0fbded3 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 _0xbf92=['request','then','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','FaxTransferReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x52bc11,_0x217557){var _0x2973ed=function(_0x388d64){while(--_0x388d64){_0x52bc11['push'](_0x52bc11['shift']());}};_0x2973ed(++_0x217557);}(_0xbf92,0x1eb));var _0x2bf9=function(_0x521efc,_0x485a41){_0x521efc=_0x521efc-0x0;var _0x31043b=_0xbf92[_0x521efc];return _0x31043b;};'use strict';var _=require(_0x2bf9('0x0'));var util=require(_0x2bf9('0x1'));var moment=require('moment');var BPromise=require(_0x2bf9('0x2'));var rs=require(_0x2bf9('0x3'));var fs=require('fs');var Redis=require(_0x2bf9('0x4'));var db=require(_0x2bf9('0x5'))['db'];var utils=require(_0x2bf9('0x6'));var logger=require(_0x2bf9('0x7'))(_0x2bf9('0x8'));var config=require(_0x2bf9('0x9'));var jayson=require(_0x2bf9('0xa'));var client=jayson[_0x2bf9('0xb')][_0x2bf9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ed5c7,_0x3f5a01,_0x137372){return new BPromise(function(_0x4ccc13,_0x28310c){return client[_0x2bf9('0xd')](_0x4ed5c7,_0x137372)[_0x2bf9('0xe')](function(_0xd7d797){logger[_0x2bf9('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3f5a01,'request\x20sent');logger[_0x2bf9('0x10')](_0x2bf9('0x11'),_0x3f5a01,_0x2bf9('0x12'),JSON['stringify'](_0xd7d797));if(_0xd7d797['error']){if(_0xd7d797[_0x2bf9('0x13')]['code']===0x1f4){logger[_0x2bf9('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x3f5a01,_0xd7d797[_0x2bf9('0x13')][_0x2bf9('0x14')]);return _0x28310c(_0xd7d797[_0x2bf9('0x13')]['message']);}logger[_0x2bf9('0x13')](_0x2bf9('0x15'),_0x3f5a01,_0xd7d797['error'][_0x2bf9('0x14')]);return _0x4ccc13(_0xd7d797['error'][_0x2bf9('0x14')]);}else{logger[_0x2bf9('0xf')](_0x2bf9('0x15'),_0x3f5a01,'request\x20sent');_0x4ccc13(_0xd7d797[_0x2bf9('0x16')]['message']);}})[_0x2bf9('0x17')](function(_0x18ff99){logger[_0x2bf9('0x13')](_0x2bf9('0x15'),_0x3f5a01,_0x18ff99);_0x28310c(_0x18ff99);});});} \ No newline at end of file +var _0x3d50=['client','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3d50,0xf8));var _0x03d5=function(_0x3e22f3,_0x6068f0){_0x3e22f3=_0x3e22f3-0x0;var _0x219ea7=_0x3d50[_0x3e22f3];return _0x219ea7;};'use strict';var _=require(_0x03d5('0x0'));var util=require(_0x03d5('0x1'));var moment=require(_0x03d5('0x2'));var BPromise=require(_0x03d5('0x3'));var rs=require(_0x03d5('0x4'));var fs=require('fs');var Redis=require(_0x03d5('0x5'));var db=require(_0x03d5('0x6'))['db'];var utils=require(_0x03d5('0x7'));var logger=require(_0x03d5('0x8'))(_0x03d5('0x9'));var config=require(_0x03d5('0xa'));var jayson=require(_0x03d5('0xb'));var client=jayson[_0x03d5('0xc')][_0x03d5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x59494c,_0x52b7e5,_0x54d443){return new BPromise(function(_0x575e14,_0x2dca49){return client[_0x03d5('0xe')](_0x59494c,_0x54d443)[_0x03d5('0xf')](function(_0x428fec){logger[_0x03d5('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x52b7e5,_0x03d5('0x11'));logger['debug'](_0x03d5('0x12'),_0x52b7e5,'request\x20sent',JSON[_0x03d5('0x13')](_0x428fec));if(_0x428fec[_0x03d5('0x14')]){if(_0x428fec[_0x03d5('0x14')][_0x03d5('0x15')]===0x1f4){logger[_0x03d5('0x14')](_0x03d5('0x16'),_0x52b7e5,_0x428fec[_0x03d5('0x14')][_0x03d5('0x17')]);return _0x2dca49(_0x428fec[_0x03d5('0x14')][_0x03d5('0x17')]);}logger[_0x03d5('0x14')](_0x03d5('0x16'),_0x52b7e5,_0x428fec[_0x03d5('0x14')][_0x03d5('0x17')]);return _0x575e14(_0x428fec['error'][_0x03d5('0x17')]);}else{logger[_0x03d5('0x10')](_0x03d5('0x16'),_0x52b7e5,'request\x20sent');_0x575e14(_0x428fec[_0x03d5('0x18')][_0x03d5('0x17')]);}})[_0x03d5('0x19')](function(_0x1cdaef){logger['error'](_0x03d5('0x16'),_0x52b7e5,_0x1cdaef);_0x2dca49(_0x1cdaef);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index fd3f7d9..ed9e616 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 _0x7621=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','/:id','show'];(function(_0x2ebcfa,_0x1fcb47){var _0x5dc2f1=function(_0x1f55c7){while(--_0x1f55c7){_0x2ebcfa['push'](_0x2ebcfa['shift']());}};_0x5dc2f1(++_0x1fcb47);}(_0x7621,0x1aa));var _0x1762=function(_0x5d381e,_0xa31db5){_0x5d381e=_0x5d381e-0x0;var _0x3707a9=_0x7621[_0x5d381e];return _0x3707a9;};'use strict';var multer=require(_0x1762('0x0'));var util=require(_0x1762('0x1'));var path=require(_0x1762('0x2'));var timeout=require('connect-timeout');var express=require(_0x1762('0x3'));var router=express[_0x1762('0x4')]();var fs_extra=require(_0x1762('0x5'));var auth=require(_0x1762('0x6'));var interaction=require(_0x1762('0x7'));var config=require(_0x1762('0x8'));var controller=require(_0x1762('0x9'));router[_0x1762('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1762('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1762('0xc'),auth['isAuthenticated'](),controller[_0x1762('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1762('0xe')]);router[_0x1762('0xf')](_0x1762('0xc'),auth['isAuthenticated'](),controller[_0x1762('0x10')]);router[_0x1762('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1762('0x12')]);module[_0x1762('0x13')]=router; \ No newline at end of file +var _0xaddc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x2589e2,_0x561636){var _0x33a4f3=function(_0x506e26){while(--_0x506e26){_0x2589e2['push'](_0x2589e2['shift']());}};_0x33a4f3(++_0x561636);}(_0xaddc,0xd1));var _0xcadd=function(_0x1aac6a,_0x7ef3f2){_0x1aac6a=_0x1aac6a-0x0;var _0x1aebfe=_0xaddc[_0x1aac6a];return _0x1aebfe;};'use strict';var multer=require('multer');var util=require(_0xcadd('0x0'));var path=require('path');var timeout=require(_0xcadd('0x1'));var express=require(_0xcadd('0x2'));var router=express[_0xcadd('0x3')]();var fs_extra=require(_0xcadd('0x4'));var auth=require(_0xcadd('0x5'));var interaction=require(_0xcadd('0x6'));var config=require(_0xcadd('0x7'));var controller=require(_0xcadd('0x8'));router[_0xcadd('0x9')]('/',auth[_0xcadd('0xa')](),controller['index']);router[_0xcadd('0x9')]('/describe',auth[_0xcadd('0xa')](),controller[_0xcadd('0xb')]);router['get'](_0xcadd('0xc'),auth[_0xcadd('0xa')](),controller[_0xcadd('0xd')]);router[_0xcadd('0xe')]('/',auth[_0xcadd('0xa')](),controller[_0xcadd('0xf')]);router[_0xcadd('0x10')]('/:id',auth[_0xcadd('0xa')](),controller[_0xcadd('0x11')]);router[_0xcadd('0x12')]('/:id',auth[_0xcadd('0xa')](),controller[_0xcadd('0x13')]);module[_0xcadd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 77c5aab..041d895 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 _0x5dd2=['get','isAuthenticated','/:id','getFields','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x5dd2,0x1db));var _0x25dd=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x5dd2[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0x25dd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x25dd('0x1'));var express=require(_0x25dd('0x2'));var router=express[_0x25dd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x25dd('0x4'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x25dd('0x5')]('/',auth[_0x25dd('0x6')](),controller['index']);router[_0x25dd('0x5')](_0x25dd('0x7'),auth[_0x25dd('0x6')](),controller['show']);router['get']('/:id/configurations',auth[_0x25dd('0x6')](),controller['getConfigurations']);router[_0x25dd('0x5')]('/:id/fields',auth[_0x25dd('0x6')](),controller[_0x25dd('0x8')]);router['post']('/',auth[_0x25dd('0x6')](),controller['create']);router['post']('/:id/configurations',auth[_0x25dd('0x6')](),controller[_0x25dd('0x9')]);router[_0x25dd('0xa')](_0x25dd('0x7'),auth['isAuthenticated'](),controller[_0x25dd('0xb')]);router[_0x25dd('0xc')](_0x25dd('0x7'),auth[_0x25dd('0x6')](),controller[_0x25dd('0xd')]);module[_0x25dd('0xe')]=router; \ No newline at end of file +var _0x07e1=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x07e1,0x19d));var _0x107e=function(_0x1f0c59,_0x25cb9f){_0x1f0c59=_0x1f0c59-0x0;var _0x435b54=_0x07e1[_0x1f0c59];return _0x435b54;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x107e('0x0'));var express=require('express');var router=express[_0x107e('0x1')]();var fs_extra=require(_0x107e('0x2'));var auth=require(_0x107e('0x3'));var interaction=require(_0x107e('0x4'));var config=require(_0x107e('0x5'));var controller=require(_0x107e('0x6'));router[_0x107e('0x7')]('/',auth[_0x107e('0x8')](),controller[_0x107e('0x9')]);router[_0x107e('0x7')](_0x107e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x107e('0x7')]('/:id/configurations',auth[_0x107e('0x8')](),controller[_0x107e('0xb')]);router[_0x107e('0x7')](_0x107e('0xc'),auth['isAuthenticated'](),controller[_0x107e('0xd')]);router[_0x107e('0xe')]('/',auth[_0x107e('0x8')](),controller[_0x107e('0xf')]);router[_0x107e('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x107e('0x10')]);router[_0x107e('0x11')](_0x107e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x107e('0x12')](_0x107e('0xa'),auth[_0x107e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 2b7fd45..87a2b5f 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 _0xf64e=['integrationTab','newTab','sequelize','exports','ENUM','basic','STRING'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xf64e,0x6b));var _0xef64=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf64e[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xef64('0x0'));module[_0xef64('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xef64('0x2')](_0xef64('0x3')),'defaultValue':_0xef64('0x3')},'password':{'type':Sequelize[_0xef64('0x4')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xef64('0x4')]},'token':{'type':Sequelize[_0xef64('0x4')]},'tokenSecret':{'type':Sequelize[_0xef64('0x4')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xef64('0x5'),_0xef64('0x6')),'defaultValue':_0xef64('0x5')}}; \ No newline at end of file +var _0xedb6=['newTab','sequelize','exports','STRING','basic','ENUM','integrationTab'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xedb6,0x104));var _0x6edb=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xedb6[_0xbf5e16];return _0x5975a5;};'use strict';var Sequelize=require(_0x6edb('0x0'));module[_0x6edb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6edb('0x2')]},'remoteUri':{'type':Sequelize[_0x6edb('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x6edb('0x3')),'defaultValue':_0x6edb('0x3')},'password':{'type':Sequelize[_0x6edb('0x2')]},'consumerKey':{'type':Sequelize[_0x6edb('0x2')]},'consumerSecret':{'type':Sequelize[_0x6edb('0x2')]},'token':{'type':Sequelize[_0x6edb('0x2')]},'tokenSecret':{'type':Sequelize[_0x6edb('0x2')]},'serverUrl':{'type':Sequelize[_0x6edb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6edb('0x4')](_0x6edb('0x5'),_0x6edb('0x6')),'defaultValue':_0x6edb('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index de2ea0d..e039ac8 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 _0xebfc=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','findOne','DeskConfiguration','order','pick','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','_embedded','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','DeskAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','attributes','query','fields','length','hasOwnProperty','sort','where'];(function(_0x206852,_0x1dc044){var _0x268746=function(_0x503832){while(--_0x503832){_0x206852['push'](_0x206852['shift']());}};_0x268746(++_0x1dc044);}(_0xebfc,0x129));var _0xcebf=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xebfc[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0xcebf('0x0'));var rimraf=require(_0xcebf('0x1'));var zipdir=require(_0xcebf('0x2'));var jsonpatch=require(_0xcebf('0x3'));var rp=require(_0xcebf('0x4'));var moment=require(_0xcebf('0x5'));var BPromise=require(_0xcebf('0x6'));var Mustache=require(_0xcebf('0x7'));var util=require(_0xcebf('0x8'));var path=require(_0xcebf('0x9'));var sox=require(_0xcebf('0xa'));var csv=require('to-csv');var ejs=require(_0xcebf('0xb'));var fs=require('fs');var fs_extra=require(_0xcebf('0xc'));var _=require('lodash');var squel=require(_0xcebf('0xd'));var crypto=require(_0xcebf('0xe'));var jsforce=require(_0xcebf('0xf'));var deskjs=require(_0xcebf('0x10'));var toCsv=require(_0xcebf('0x11'));var querystring=require(_0xcebf('0x12'));var Papa=require(_0xcebf('0x13'));var Redis=require(_0xcebf('0x14'));var authService=require(_0xcebf('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xcebf('0x16'));var hardwareService=require(_0xcebf('0x17'));var logger=require(_0xcebf('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xcebf('0x19'));var licenseUtil=require(_0xcebf('0x1a'));var db=require(_0xcebf('0x1b'))['db'];var integrations=require(_0xcebf('0x1c'));function respondWithStatusCode(_0x52275b,_0x12b0ab){_0x12b0ab=_0x12b0ab||0xcc;return function(_0x393f6d){if(_0x393f6d){return _0x52275b[_0xcebf('0x1d')](_0x12b0ab);}return _0x52275b[_0xcebf('0x1e')](_0x12b0ab)['end']();};}function respondWithResult(_0x3ec001,_0x3e63a3){_0x3e63a3=_0x3e63a3||0xc8;return function(_0x4896c6){if(_0x4896c6){return _0x3ec001['status'](_0x3e63a3)[_0xcebf('0x1f')](_0x4896c6);}};}function respondWithFilteredResult(_0x4abd71,_0x42b0a0){return function(_0x391643){if(_0x391643){var _0x384bfb=typeof _0x42b0a0[_0xcebf('0x20')]===_0xcebf('0x21')&&typeof _0x42b0a0['limit']==='undefined';var _0x18fb25=_0x391643['count'];var _0x2894b1=_0x384bfb?0x0:_0x42b0a0[_0xcebf('0x20')];var _0x34e79d=_0x384bfb?_0x391643[_0xcebf('0x22')]:_0x42b0a0['offset']+_0x42b0a0[_0xcebf('0x23')];var _0x52b540;if(_0x34e79d>=_0x18fb25){_0x34e79d=_0x18fb25;_0x52b540=0xc8;}else{_0x52b540=0xce;}_0x4abd71[_0xcebf('0x1e')](_0x52b540);return _0x4abd71[_0xcebf('0x24')](_0xcebf('0x25'),_0x2894b1+'-'+_0x34e79d+'/'+_0x18fb25)[_0xcebf('0x1f')](_0x391643);}return null;};}function patchUpdates(_0x4369f5){return function(_0x22a545){try{jsonpatch['apply'](_0x22a545,_0x4369f5,!![]);}catch(_0x13372f){return BPromise['reject'](_0x13372f);}return _0x22a545[_0xcebf('0x26')]();};}function saveUpdates(_0x2cb8f7,_0xc6696c){return function(_0x29847c){if(_0x29847c){return _0x29847c[_0xcebf('0x27')](_0x2cb8f7)[_0xcebf('0x28')](function(_0x1c1312){return _0x1c1312;});}return null;};}function removeEntity(_0x186094,_0x41eec3){return function(_0x239164){if(_0x239164){return _0x239164[_0xcebf('0x29')]()[_0xcebf('0x28')](function(){_0x186094[_0xcebf('0x1e')](0xcc)[_0xcebf('0x2a')]();});}};}function handleEntityNotFound(_0xbf3d11,_0x11bc97){return function(_0x1df5f1){if(!_0x1df5f1){_0xbf3d11[_0xcebf('0x1d')](0x194);}return _0x1df5f1;};}function handleError(_0x50b9b2,_0x24feb9){_0x24feb9=_0x24feb9||0x1f4;return function(_0x1f62b9){logger[_0xcebf('0x2b')](_0x1f62b9[_0xcebf('0x2c')]);if(_0x1f62b9[_0xcebf('0x2d')]){delete _0x1f62b9[_0xcebf('0x2d')];}_0x50b9b2['status'](_0x24feb9)[_0xcebf('0x2e')](_0x1f62b9);};}exports['index']=function(_0x10c5bd,_0x5323cf){var _0x467377={},_0x1f2f8b={},_0x2ce6c1={'count':0x0,'rows':[]};var _0x3b9847=_['map'](db[_0xcebf('0x2f')][_0xcebf('0x30')],function(_0x55a83a){return{'name':_0x55a83a[_0xcebf('0x31')],'type':_0x55a83a[_0xcebf('0x32')][_0xcebf('0x33')]};});_0x1f2f8b[_0xcebf('0x34')]=_[_0xcebf('0x35')](_0x3b9847,'name');_0x1f2f8b['query']=_[_0xcebf('0x36')](_0x10c5bd['query']);_0x1f2f8b[_0xcebf('0x37')]=_['intersection'](_0x1f2f8b[_0xcebf('0x34')],_0x1f2f8b['query']);_0x467377[_0xcebf('0x38')]=_['intersection'](_0x1f2f8b[_0xcebf('0x34')],qs['fields'](_0x10c5bd[_0xcebf('0x39')][_0xcebf('0x3a')]));_0x467377[_0xcebf('0x38')]=_0x467377[_0xcebf('0x38')][_0xcebf('0x3b')]?_0x467377[_0xcebf('0x38')]:_0x1f2f8b[_0xcebf('0x34')];if(!_0x10c5bd[_0xcebf('0x39')][_0xcebf('0x3c')]('nolimit')){_0x467377[_0xcebf('0x23')]=qs[_0xcebf('0x23')](_0x10c5bd[_0xcebf('0x39')][_0xcebf('0x23')]);_0x467377[_0xcebf('0x20')]=qs[_0xcebf('0x20')](_0x10c5bd[_0xcebf('0x39')][_0xcebf('0x20')]);}_0x467377['order']=qs['sort'](_0x10c5bd[_0xcebf('0x39')][_0xcebf('0x3d')]);_0x467377[_0xcebf('0x3e')]=qs[_0xcebf('0x37')](_['pick'](_0x10c5bd[_0xcebf('0x39')],_0x1f2f8b[_0xcebf('0x37')]),_0x3b9847);if(_0x10c5bd['query'][_0xcebf('0x3f')]){_0x467377['where']=_[_0xcebf('0x40')](_0x467377[_0xcebf('0x3e')],{'$or':_[_0xcebf('0x35')](_0x3b9847,function(_0x5b7828){if(_0x5b7828[_0xcebf('0x32')]!==_0xcebf('0x41')){var _0x332d8d={};_0x332d8d[_0x5b7828['name']]={'$like':'%'+_0x10c5bd[_0xcebf('0x39')][_0xcebf('0x3f')]+'%'};return _0x332d8d;}})});}_0x467377=_[_0xcebf('0x40')]({},_0x467377,_0x10c5bd[_0xcebf('0x42')]);var _0x419c38={'where':_0x467377[_0xcebf('0x3e')]};return db[_0xcebf('0x2f')][_0xcebf('0x22')](_0x419c38)[_0xcebf('0x28')](function(_0x139bec){_0x2ce6c1[_0xcebf('0x22')]=_0x139bec;if(_0x10c5bd[_0xcebf('0x39')][_0xcebf('0x43')]){_0x467377[_0xcebf('0x44')]=[{'all':!![]}];}return db['DeskAccount'][_0xcebf('0x45')](_0x467377);})[_0xcebf('0x28')](function(_0x4b72a8){_0x2ce6c1[_0xcebf('0x46')]=_0x4b72a8;return _0x2ce6c1;})[_0xcebf('0x28')](respondWithFilteredResult(_0x5323cf,_0x467377))['catch'](handleError(_0x5323cf,null));};exports[_0xcebf('0x47')]=function(_0xeb87e0,_0x1b8d4d){var _0x45d2ff={'raw':![],'where':{'id':_0xeb87e0[_0xcebf('0x48')]['id']}},_0x505500={};_0x505500[_0xcebf('0x34')]=_[_0xcebf('0x36')](db[_0xcebf('0x2f')][_0xcebf('0x30')]);_0x505500['query']=_[_0xcebf('0x36')](_0xeb87e0[_0xcebf('0x39')]);_0x505500['filters']=_['intersection'](_0x505500[_0xcebf('0x34')],_0x505500[_0xcebf('0x39')]);_0x45d2ff[_0xcebf('0x38')]=_[_0xcebf('0x49')](_0x505500[_0xcebf('0x34')],qs['fields'](_0xeb87e0[_0xcebf('0x39')][_0xcebf('0x3a')]));_0x45d2ff['attributes']=_0x45d2ff[_0xcebf('0x38')][_0xcebf('0x3b')]?_0x45d2ff[_0xcebf('0x38')]:_0x505500[_0xcebf('0x34')];if(_0xeb87e0[_0xcebf('0x39')][_0xcebf('0x43')]){_0x45d2ff['include']=[{'all':!![]}];}_0x45d2ff=_['merge']({},_0x45d2ff,_0xeb87e0[_0xcebf('0x42')]);return db[_0xcebf('0x2f')][_0xcebf('0x4a')](_0x45d2ff)[_0xcebf('0x28')](handleEntityNotFound(_0x1b8d4d,null))[_0xcebf('0x28')](respondWithResult(_0x1b8d4d,null))['catch'](handleError(_0x1b8d4d,null));};exports[_0xcebf('0x4b')]=function(_0x2cd25f,_0x1500ec){return db[_0xcebf('0x2f')][_0xcebf('0x4b')](_0x2cd25f[_0xcebf('0x4c')],{})[_0xcebf('0x28')](respondWithResult(_0x1500ec,0xc9))[_0xcebf('0x4d')](handleError(_0x1500ec,null));};exports[_0xcebf('0x27')]=function(_0x364813,_0x578662){if(_0x364813[_0xcebf('0x4c')]['id']){delete _0x364813[_0xcebf('0x4c')]['id'];}return db['DeskAccount'][_0xcebf('0x4a')]({'where':{'id':_0x364813[_0xcebf('0x48')]['id']}})[_0xcebf('0x28')](handleEntityNotFound(_0x578662,null))[_0xcebf('0x28')](saveUpdates(_0x364813[_0xcebf('0x4c')],null))['then'](respondWithResult(_0x578662,null))[_0xcebf('0x4d')](handleError(_0x578662,null));};exports[_0xcebf('0x29')]=function(_0x424c83,_0x34ffd3){return db[_0xcebf('0x2f')][_0xcebf('0x4a')]({'where':{'id':_0x424c83['params']['id']}})[_0xcebf('0x28')](handleEntityNotFound(_0x34ffd3,null))[_0xcebf('0x28')](removeEntity(_0x34ffd3,null))[_0xcebf('0x4d')](handleError(_0x34ffd3,null));};exports['getConfigurations']=function(_0x415614,_0x2cf11e,_0xc30eb5){var _0x22092e={};var _0x3d6603={};var _0x2df186;var _0x139400;return db['DeskAccount'][_0xcebf('0x4e')]({'where':{'id':_0x415614[_0xcebf('0x48')]['id']}})[_0xcebf('0x28')](handleEntityNotFound(_0x2cf11e,null))[_0xcebf('0x28')](function(_0x305da4){if(_0x305da4){_0x2df186=_0x305da4;_0x3d6603[_0xcebf('0x34')]=_['keys'](db[_0xcebf('0x4f')][_0xcebf('0x30')]);_0x3d6603['query']=_[_0xcebf('0x36')](_0x415614[_0xcebf('0x39')]);_0x3d6603[_0xcebf('0x37')]=_['intersection'](_0x3d6603['model'],_0x3d6603[_0xcebf('0x39')]);_0x22092e['attributes']=_[_0xcebf('0x49')](_0x3d6603[_0xcebf('0x34')],qs[_0xcebf('0x3a')](_0x415614[_0xcebf('0x39')][_0xcebf('0x3a')]));_0x22092e[_0xcebf('0x38')]=_0x22092e[_0xcebf('0x38')]['length']?_0x22092e['attributes']:_0x3d6603[_0xcebf('0x34')];_0x22092e[_0xcebf('0x50')]=qs['sort'](_0x415614[_0xcebf('0x39')][_0xcebf('0x3d')]);_0x22092e['where']=qs[_0xcebf('0x37')](_[_0xcebf('0x51')](_0x415614['query'],_0x3d6603[_0xcebf('0x37')]));if(_0x415614[_0xcebf('0x39')]['filter']){_0x22092e[_0xcebf('0x3e')]=_['merge'](_0x22092e['where'],{'$or':_['map'](_0x22092e['attributes'],function(_0x3dc9ff){var _0x3d8ddb={};_0x3d8ddb[_0x3dc9ff]={'$like':'%'+_0x415614[_0xcebf('0x39')][_0xcebf('0x3f')]+'%'};return _0x3d8ddb;})});}_0x22092e=_['merge']({},_0x22092e,_0x415614['options']);return _0x2df186[_0xcebf('0x52')](_0x22092e);}})[_0xcebf('0x28')](function(_0x5d890a){if(_0x5d890a){_0x139400=_0x5d890a['length'];if(!_0x415614[_0xcebf('0x39')][_0xcebf('0x3c')](_0xcebf('0x53'))){_0x22092e[_0xcebf('0x23')]=qs[_0xcebf('0x23')](_0x415614[_0xcebf('0x39')][_0xcebf('0x23')]);_0x22092e[_0xcebf('0x20')]=qs['offset'](_0x415614['query']['offset']);}return _0x2df186['getConfigurations'](_0x22092e);}})[_0xcebf('0x28')](function(_0x5a3293){if(_0x5a3293){return _0x5a3293?{'count':_0x139400,'rows':_0x5a3293}:null;}})[_0xcebf('0x28')](respondWithResult(_0x2cf11e,null))[_0xcebf('0x4d')](handleError(_0x2cf11e,null));};exports[_0xcebf('0x54')]=function(_0x3d863f,_0x2cb1be,_0x3e4497){if(_0x3d863f[_0xcebf('0x4c')]['id']){delete _0x3d863f[_0xcebf('0x4c')]['id'];}return db[_0xcebf('0x2f')][_0xcebf('0x4e')]({'where':{'id':_0x3d863f['params']['id']}})[_0xcebf('0x28')](handleEntityNotFound(_0x2cb1be,null))['then'](function(_0x3dc2fe){if(_0x3dc2fe){_0x3d863f[_0xcebf('0x4c')]['AccountId']=_0x3dc2fe['id'];_0x3d863f[_0xcebf('0x4c')][_0xcebf('0x55')]=integrations[_0xcebf('0x56')](_0x3d863f[_0xcebf('0x4c')][_0xcebf('0x57')],_0x3d863f[_0xcebf('0x4c')][_0xcebf('0x32')]);_0x3d863f[_0xcebf('0x4c')][_0xcebf('0x58')]=integrations[_0xcebf('0x59')](_0x3d863f[_0xcebf('0x4c')]['channel'],_0x3d863f[_0xcebf('0x4c')][_0xcebf('0x32')]);return db[_0xcebf('0x4f')][_0xcebf('0x4b')](_0x3d863f[_0xcebf('0x4c')],{'include':[{'model':db[_0xcebf('0x5a')],'as':_0xcebf('0x55')},{'model':db[_0xcebf('0x5a')],'as':_0xcebf('0x58')}]});}return null;})[_0xcebf('0x28')](respondWithResult(_0x2cb1be,null))['catch'](handleError(_0x2cb1be,null));};exports[_0xcebf('0x5b')]=function(_0x20facb,_0x11c180,_0x11d24f){var _0x332d30=[{'name':_0xcebf('0x5c'),'label':_0xcebf('0x5c'),'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 _0xb73bbe='';return db[_0xcebf('0x2f')][_0xcebf('0x4e')]({'where':{'id':_0x20facb[_0xcebf('0x48')]['id']},'attributes':['id',_0xcebf('0x5d'),_0xcebf('0x5e'),_0xcebf('0x5f'),_0xcebf('0x60'),_0xcebf('0x61'),'consumerSecret',_0xcebf('0x62'),_0xcebf('0x63')]})['then'](handleEntityNotFound(_0x11c180,null))[_0xcebf('0x28')](function(_0x82033b){if(_0x82033b){_0xb73bbe=_0x82033b[_0xcebf('0x5d')];var _0x1d9591=_0xb73bbe[_0xcebf('0x64')](-0x1);if(_0x1d9591==='/'){_0xb73bbe=_0xb73bbe[_0xcebf('0x65')](0x0,_0xb73bbe[_0xcebf('0x66')](_0x1d9591));}var _0x271020={'method':_0xcebf('0x67'),'uri':util[_0xcebf('0x68')](_0xcebf('0x69'),_0xb73bbe),'headers':{'Content-Type':_0xcebf('0x6a'),'Accept':_0xcebf('0x6a')},'json':!![]};if(_0x82033b['authType']===_0xcebf('0x6b')){_0x271020[_0xcebf('0x6c')]['Authorization']=util[_0xcebf('0x68')](_0xcebf('0x6d'),new Buffer(util[_0xcebf('0x68')](_0xcebf('0x6e'),_0x82033b[_0xcebf('0x5f')],_0x82033b[_0xcebf('0x60')]))[_0xcebf('0x6f')]('base64'));}return rp(_0x271020)['then'](function(_0x3b17ff){return _0x332d30['concat'](_[_0xcebf('0x35')](_0x3b17ff[_0xcebf('0x70')][_0xcebf('0x71')],function(_0x5469d5){return{'id':_0x5469d5[_0xcebf('0x2d')],'name':_0x5469d5[_0xcebf('0x2d')],'type':_0x5469d5['type'],'active':_0x5469d5[_0xcebf('0x72')],'label':_0x5469d5[_0xcebf('0x73')],'custom':!![]};}));});}})[_0xcebf('0x28')](function(_0x26fbc8){return{'count':_0x26fbc8['length'],'rows':_0x26fbc8};})['then'](respondWithResult(_0x11c180,null))[_0xcebf('0x4d')](function(_0xe183f5){var _0x3e854f=_0x20facb['query'][_0xcebf('0x74')]?0x1f4:_0xe183f5[_0xcebf('0x75')]||0x1f4;logger[_0xcebf('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xcebf('0x5b'),_0x3e854f,JSON[_0xcebf('0x76')](_0xe183f5));delete _0xe183f5[_0xcebf('0x2d')];if(_0x3e854f===0x191){_0x3e854f=0x190;}_0x11c180[_0xcebf('0x1e')](_0x3e854f)['send'](_0x20facb['query']['test']?{'message':_0xcebf('0x77'),'statusCode':_0xe183f5[_0xcebf('0x75')]}:_0xe183f5);});}; \ No newline at end of file +var _0x2ef5=['active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','body','destroy','getConfigurations','findOne','DeskConfiguration','pick','nolimit','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Basic\x20%s','%s:%s','base64','concat','entries'];(function(_0x1433df,_0x1c1ddc){var _0x49fade=function(_0x27803b){while(--_0x27803b){_0x1433df['push'](_0x1433df['shift']());}};_0x49fade(++_0x1c1ddc);}(_0x2ef5,0xe3));var _0x52ef=function(_0x1c9d85,_0x2caf0c){_0x1c9d85=_0x1c9d85-0x0;var _0x5dbbe5=_0x2ef5[_0x1c9d85];return _0x5dbbe5;};'use strict';var emlformat=require(_0x52ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52ef('0x1'));var jsonpatch=require(_0x52ef('0x2'));var rp=require(_0x52ef('0x3'));var moment=require('moment');var BPromise=require(_0x52ef('0x4'));var Mustache=require('mustache');var util=require(_0x52ef('0x5'));var path=require(_0x52ef('0x6'));var sox=require(_0x52ef('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52ef('0x8'));var _=require(_0x52ef('0x9'));var squel=require('squel');var crypto=require(_0x52ef('0xa'));var jsforce=require(_0x52ef('0xb'));var deskjs=require(_0x52ef('0xc'));var toCsv=require(_0x52ef('0xd'));var querystring=require(_0x52ef('0xe'));var Papa=require('papaparse');var Redis=require(_0x52ef('0xf'));var authService=require(_0x52ef('0x10'));var qs=require(_0x52ef('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52ef('0x12'));var logger=require('../../config/logger')(_0x52ef('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x52ef('0x14'))['db'];var integrations=require(_0x52ef('0x15'));function respondWithStatusCode(_0x4cf80b,_0xcdb055){_0xcdb055=_0xcdb055||0xcc;return function(_0xc3af18){if(_0xc3af18){return _0x4cf80b['sendStatus'](_0xcdb055);}return _0x4cf80b[_0x52ef('0x16')](_0xcdb055)[_0x52ef('0x17')]();};}function respondWithResult(_0x533b58,_0x1baf2a){_0x1baf2a=_0x1baf2a||0xc8;return function(_0x2218a7){if(_0x2218a7){return _0x533b58[_0x52ef('0x16')](_0x1baf2a)[_0x52ef('0x18')](_0x2218a7);}};}function respondWithFilteredResult(_0x1daebb,_0x3284cd){return function(_0x253814){if(_0x253814){var _0x15bbfc=typeof _0x3284cd[_0x52ef('0x19')]==='undefined'&&typeof _0x3284cd[_0x52ef('0x1a')]===_0x52ef('0x1b');var _0x1056d5=_0x253814[_0x52ef('0x1c')];var _0x589dcb=_0x15bbfc?0x0:_0x3284cd[_0x52ef('0x19')];var _0x2bd1cd=_0x15bbfc?_0x253814[_0x52ef('0x1c')]:_0x3284cd[_0x52ef('0x19')]+_0x3284cd[_0x52ef('0x1a')];var _0x11bf32;if(_0x2bd1cd>=_0x1056d5){_0x2bd1cd=_0x1056d5;_0x11bf32=0xc8;}else{_0x11bf32=0xce;}_0x1daebb[_0x52ef('0x16')](_0x11bf32);return _0x1daebb[_0x52ef('0x1d')]('Content-Range',_0x589dcb+'-'+_0x2bd1cd+'/'+_0x1056d5)[_0x52ef('0x18')](_0x253814);}return null;};}function patchUpdates(_0x44a959){return function(_0x30709c){try{jsonpatch[_0x52ef('0x1e')](_0x30709c,_0x44a959,!![]);}catch(_0x3deb7b){return BPromise[_0x52ef('0x1f')](_0x3deb7b);}return _0x30709c[_0x52ef('0x20')]();};}function saveUpdates(_0x2bcd09,_0x1b268c){return function(_0x2ed320){if(_0x2ed320){return _0x2ed320[_0x52ef('0x21')](_0x2bcd09)[_0x52ef('0x22')](function(_0x3f1871){return _0x3f1871;});}return null;};}function removeEntity(_0x5d846a,_0x53d9ca){return function(_0x52a2fd){if(_0x52a2fd){return _0x52a2fd['destroy']()[_0x52ef('0x22')](function(){_0x5d846a[_0x52ef('0x16')](0xcc)[_0x52ef('0x17')]();});}};}function handleEntityNotFound(_0x282849,_0x41a271){return function(_0x112ced){if(!_0x112ced){_0x282849[_0x52ef('0x23')](0x194);}return _0x112ced;};}function handleError(_0x899196,_0x5de99b){_0x5de99b=_0x5de99b||0x1f4;return function(_0x393da4){logger[_0x52ef('0x24')](_0x393da4[_0x52ef('0x25')]);if(_0x393da4['name']){delete _0x393da4[_0x52ef('0x26')];}_0x899196[_0x52ef('0x16')](_0x5de99b)[_0x52ef('0x27')](_0x393da4);};}exports[_0x52ef('0x28')]=function(_0x13cf9a,_0x2908e9){var _0x47ed58={},_0x4bd1e6={},_0x1b1512={'count':0x0,'rows':[]};var _0x77e354=_['map'](db[_0x52ef('0x29')][_0x52ef('0x2a')],function(_0x3814e5){return{'name':_0x3814e5[_0x52ef('0x2b')],'type':_0x3814e5[_0x52ef('0x2c')][_0x52ef('0x2d')]};});_0x4bd1e6[_0x52ef('0x2e')]=_[_0x52ef('0x2f')](_0x77e354,'name');_0x4bd1e6[_0x52ef('0x30')]=_['keys'](_0x13cf9a[_0x52ef('0x30')]);_0x4bd1e6[_0x52ef('0x31')]=_[_0x52ef('0x32')](_0x4bd1e6['model'],_0x4bd1e6[_0x52ef('0x30')]);_0x47ed58[_0x52ef('0x33')]=_[_0x52ef('0x32')](_0x4bd1e6[_0x52ef('0x2e')],qs[_0x52ef('0x34')](_0x13cf9a[_0x52ef('0x30')][_0x52ef('0x34')]));_0x47ed58[_0x52ef('0x33')]=_0x47ed58['attributes'][_0x52ef('0x35')]?_0x47ed58[_0x52ef('0x33')]:_0x4bd1e6[_0x52ef('0x2e')];if(!_0x13cf9a[_0x52ef('0x30')][_0x52ef('0x36')]('nolimit')){_0x47ed58[_0x52ef('0x1a')]=qs[_0x52ef('0x1a')](_0x13cf9a[_0x52ef('0x30')]['limit']);_0x47ed58[_0x52ef('0x19')]=qs[_0x52ef('0x19')](_0x13cf9a[_0x52ef('0x30')][_0x52ef('0x19')]);}_0x47ed58[_0x52ef('0x37')]=qs[_0x52ef('0x38')](_0x13cf9a[_0x52ef('0x30')]['sort']);_0x47ed58[_0x52ef('0x39')]=qs[_0x52ef('0x31')](_['pick'](_0x13cf9a[_0x52ef('0x30')],_0x4bd1e6[_0x52ef('0x31')]),_0x77e354);if(_0x13cf9a[_0x52ef('0x30')][_0x52ef('0x3a')]){_0x47ed58[_0x52ef('0x39')]=_[_0x52ef('0x3b')](_0x47ed58[_0x52ef('0x39')],{'$or':_['map'](_0x77e354,function(_0x11d255){if(_0x11d255[_0x52ef('0x2c')]!==_0x52ef('0x3c')){var _0x419359={};_0x419359[_0x11d255[_0x52ef('0x26')]]={'$like':'%'+_0x13cf9a[_0x52ef('0x30')]['filter']+'%'};return _0x419359;}})});}_0x47ed58=_[_0x52ef('0x3b')]({},_0x47ed58,_0x13cf9a['options']);var _0x499dc2={'where':_0x47ed58['where']};return db['DeskAccount'][_0x52ef('0x1c')](_0x499dc2)['then'](function(_0x3094b7){_0x1b1512[_0x52ef('0x1c')]=_0x3094b7;if(_0x13cf9a[_0x52ef('0x30')][_0x52ef('0x3d')]){_0x47ed58[_0x52ef('0x3e')]=[{'all':!![]}];}return db['DeskAccount'][_0x52ef('0x3f')](_0x47ed58);})['then'](function(_0x580ca3){_0x1b1512['rows']=_0x580ca3;return _0x1b1512;})['then'](respondWithFilteredResult(_0x2908e9,_0x47ed58))[_0x52ef('0x40')](handleError(_0x2908e9,null));};exports[_0x52ef('0x41')]=function(_0x537943,_0x4e8003){var _0x5d54d4={'raw':![],'where':{'id':_0x537943[_0x52ef('0x42')]['id']}},_0x47e6ba={};_0x47e6ba[_0x52ef('0x2e')]=_[_0x52ef('0x43')](db[_0x52ef('0x29')][_0x52ef('0x2a')]);_0x47e6ba[_0x52ef('0x30')]=_[_0x52ef('0x43')](_0x537943['query']);_0x47e6ba[_0x52ef('0x31')]=_['intersection'](_0x47e6ba[_0x52ef('0x2e')],_0x47e6ba['query']);_0x5d54d4[_0x52ef('0x33')]=_[_0x52ef('0x32')](_0x47e6ba[_0x52ef('0x2e')],qs[_0x52ef('0x34')](_0x537943['query'][_0x52ef('0x34')]));_0x5d54d4[_0x52ef('0x33')]=_0x5d54d4[_0x52ef('0x33')][_0x52ef('0x35')]?_0x5d54d4[_0x52ef('0x33')]:_0x47e6ba[_0x52ef('0x2e')];if(_0x537943['query'][_0x52ef('0x3d')]){_0x5d54d4[_0x52ef('0x3e')]=[{'all':!![]}];}_0x5d54d4=_[_0x52ef('0x3b')]({},_0x5d54d4,_0x537943[_0x52ef('0x44')]);return db[_0x52ef('0x29')][_0x52ef('0x45')](_0x5d54d4)['then'](handleEntityNotFound(_0x4e8003,null))[_0x52ef('0x22')](respondWithResult(_0x4e8003,null))['catch'](handleError(_0x4e8003,null));};exports['create']=function(_0x4014c7,_0x39789d){return db['DeskAccount']['create'](_0x4014c7[_0x52ef('0x46')],{})['then'](respondWithResult(_0x39789d,0xc9))['catch'](handleError(_0x39789d,null));};exports['update']=function(_0x27b9fa,_0x500c36){if(_0x27b9fa[_0x52ef('0x46')]['id']){delete _0x27b9fa[_0x52ef('0x46')]['id'];}return db['DeskAccount'][_0x52ef('0x45')]({'where':{'id':_0x27b9fa[_0x52ef('0x42')]['id']}})[_0x52ef('0x22')](handleEntityNotFound(_0x500c36,null))[_0x52ef('0x22')](saveUpdates(_0x27b9fa[_0x52ef('0x46')],null))[_0x52ef('0x22')](respondWithResult(_0x500c36,null))[_0x52ef('0x40')](handleError(_0x500c36,null));};exports[_0x52ef('0x47')]=function(_0x516fcf,_0x30fc6c){return db[_0x52ef('0x29')][_0x52ef('0x45')]({'where':{'id':_0x516fcf[_0x52ef('0x42')]['id']}})[_0x52ef('0x22')](handleEntityNotFound(_0x30fc6c,null))[_0x52ef('0x22')](removeEntity(_0x30fc6c,null))['catch'](handleError(_0x30fc6c,null));};exports[_0x52ef('0x48')]=function(_0x28a4c5,_0x5d0f52,_0x8dbdac){var _0xbb1345={};var _0x2caa6f={};var _0x54c608;var _0x1d9b0f;return db[_0x52ef('0x29')][_0x52ef('0x49')]({'where':{'id':_0x28a4c5['params']['id']}})[_0x52ef('0x22')](handleEntityNotFound(_0x5d0f52,null))[_0x52ef('0x22')](function(_0x10a061){if(_0x10a061){_0x54c608=_0x10a061;_0x2caa6f[_0x52ef('0x2e')]=_[_0x52ef('0x43')](db[_0x52ef('0x4a')][_0x52ef('0x2a')]);_0x2caa6f[_0x52ef('0x30')]=_[_0x52ef('0x43')](_0x28a4c5['query']);_0x2caa6f[_0x52ef('0x31')]=_[_0x52ef('0x32')](_0x2caa6f[_0x52ef('0x2e')],_0x2caa6f[_0x52ef('0x30')]);_0xbb1345[_0x52ef('0x33')]=_[_0x52ef('0x32')](_0x2caa6f[_0x52ef('0x2e')],qs[_0x52ef('0x34')](_0x28a4c5[_0x52ef('0x30')][_0x52ef('0x34')]));_0xbb1345[_0x52ef('0x33')]=_0xbb1345[_0x52ef('0x33')][_0x52ef('0x35')]?_0xbb1345[_0x52ef('0x33')]:_0x2caa6f[_0x52ef('0x2e')];_0xbb1345[_0x52ef('0x37')]=qs[_0x52ef('0x38')](_0x28a4c5[_0x52ef('0x30')][_0x52ef('0x38')]);_0xbb1345[_0x52ef('0x39')]=qs[_0x52ef('0x31')](_[_0x52ef('0x4b')](_0x28a4c5[_0x52ef('0x30')],_0x2caa6f[_0x52ef('0x31')]));if(_0x28a4c5[_0x52ef('0x30')]['filter']){_0xbb1345['where']=_[_0x52ef('0x3b')](_0xbb1345['where'],{'$or':_[_0x52ef('0x2f')](_0xbb1345[_0x52ef('0x33')],function(_0x255773){var _0x152976={};_0x152976[_0x255773]={'$like':'%'+_0x28a4c5[_0x52ef('0x30')][_0x52ef('0x3a')]+'%'};return _0x152976;})});}_0xbb1345=_[_0x52ef('0x3b')]({},_0xbb1345,_0x28a4c5[_0x52ef('0x44')]);return _0x54c608[_0x52ef('0x48')](_0xbb1345);}})[_0x52ef('0x22')](function(_0x6e8305){if(_0x6e8305){_0x1d9b0f=_0x6e8305[_0x52ef('0x35')];if(!_0x28a4c5[_0x52ef('0x30')]['hasOwnProperty'](_0x52ef('0x4c'))){_0xbb1345[_0x52ef('0x1a')]=qs[_0x52ef('0x1a')](_0x28a4c5[_0x52ef('0x30')][_0x52ef('0x1a')]);_0xbb1345[_0x52ef('0x19')]=qs[_0x52ef('0x19')](_0x28a4c5['query'][_0x52ef('0x19')]);}return _0x54c608['getConfigurations'](_0xbb1345);}})[_0x52ef('0x22')](function(_0x222c20){if(_0x222c20){return _0x222c20?{'count':_0x1d9b0f,'rows':_0x222c20}:null;}})['then'](respondWithResult(_0x5d0f52,null))[_0x52ef('0x40')](handleError(_0x5d0f52,null));};exports['addConfiguration']=function(_0x33ce12,_0x3180e6,_0x2a8b75){if(_0x33ce12['body']['id']){delete _0x33ce12[_0x52ef('0x46')]['id'];}return db[_0x52ef('0x29')][_0x52ef('0x49')]({'where':{'id':_0x33ce12[_0x52ef('0x42')]['id']}})['then'](handleEntityNotFound(_0x3180e6,null))['then'](function(_0x26e9ba){if(_0x26e9ba){_0x33ce12[_0x52ef('0x46')]['AccountId']=_0x26e9ba['id'];_0x33ce12[_0x52ef('0x46')][_0x52ef('0x4d')]=integrations[_0x52ef('0x4e')](_0x33ce12[_0x52ef('0x46')]['channel'],_0x33ce12['body'][_0x52ef('0x2c')]);_0x33ce12[_0x52ef('0x46')]['Descriptions']=integrations[_0x52ef('0x4f')](_0x33ce12[_0x52ef('0x46')][_0x52ef('0x50')],_0x33ce12['body'][_0x52ef('0x2c')]);return db[_0x52ef('0x4a')]['create'](_0x33ce12[_0x52ef('0x46')],{'include':[{'model':db[_0x52ef('0x51')],'as':_0x52ef('0x4d')},{'model':db[_0x52ef('0x51')],'as':_0x52ef('0x52')}]});}return null;})[_0x52ef('0x22')](respondWithResult(_0x3180e6,null))[_0x52ef('0x40')](handleError(_0x3180e6,null));};exports[_0x52ef('0x53')]=function(_0x3b658f,_0x51190c,_0xb0cf43){var _0x332e3e=[{'name':_0x52ef('0x54'),'label':_0x52ef('0x54'),'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 _0x32b28b='';return db[_0x52ef('0x29')][_0x52ef('0x49')]({'where':{'id':_0x3b658f['params']['id']},'attributes':['id',_0x52ef('0x55'),_0x52ef('0x56'),_0x52ef('0x57'),_0x52ef('0x58'),_0x52ef('0x59'),_0x52ef('0x5a'),_0x52ef('0x5b'),_0x52ef('0x5c')]})['then'](handleEntityNotFound(_0x51190c,null))['then'](function(_0x4dbf9e){if(_0x4dbf9e){_0x32b28b=_0x4dbf9e['remoteUri'];var _0x37a226=_0x32b28b[_0x52ef('0x5d')](-0x1);if(_0x37a226==='/'){_0x32b28b=_0x32b28b[_0x52ef('0x5e')](0x0,_0x32b28b[_0x52ef('0x5f')](_0x37a226));}var _0x1f7c32={'method':_0x52ef('0x60'),'uri':util[_0x52ef('0x61')]('%s/custom_fields',_0x32b28b),'headers':{'Content-Type':_0x52ef('0x62'),'Accept':_0x52ef('0x62')},'json':!![]};if(_0x4dbf9e['authType']===_0x52ef('0x63')){_0x1f7c32[_0x52ef('0x64')]['Authorization']=util['format'](_0x52ef('0x65'),new Buffer(util[_0x52ef('0x61')](_0x52ef('0x66'),_0x4dbf9e[_0x52ef('0x57')],_0x4dbf9e[_0x52ef('0x58')]))['toString'](_0x52ef('0x67')));}return rp(_0x1f7c32)[_0x52ef('0x22')](function(_0x3a44b6){return _0x332e3e[_0x52ef('0x68')](_[_0x52ef('0x2f')](_0x3a44b6['_embedded'][_0x52ef('0x69')],function(_0x5c8b7d){return{'id':_0x5c8b7d[_0x52ef('0x26')],'name':_0x5c8b7d['name'],'type':_0x5c8b7d[_0x52ef('0x2c')],'active':_0x5c8b7d[_0x52ef('0x6a')],'label':_0x5c8b7d[_0x52ef('0x6b')],'custom':!![]};}));});}})[_0x52ef('0x22')](function(_0x1b3bf5){return{'count':_0x1b3bf5[_0x52ef('0x35')],'rows':_0x1b3bf5};})[_0x52ef('0x22')](respondWithResult(_0x51190c,null))[_0x52ef('0x40')](function(_0x9d0967){var _0x52ff1c=_0x3b658f['query'][_0x52ef('0x6c')]?0x1f4:_0x9d0967[_0x52ef('0x6d')]||0x1f4;logger[_0x52ef('0x24')](_0x52ef('0x6e'),_0x52ef('0x53'),_0x52ff1c,JSON['stringify'](_0x9d0967));delete _0x9d0967[_0x52ef('0x26')];if(_0x52ff1c===0x191){_0x52ff1c=0x190;}_0x51190c[_0x52ef('0x16')](_0x52ff1c)[_0x52ef('0x27')](_0x3b658f[_0x52ef('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x9d0967[_0x52ef('0x6d')]}:_0x9d0967);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ac6cdc1..2421166 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 _0x129d=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x42c7ed,_0x25d73d){var _0x478d3b=function(_0x1d77d8){while(--_0x1d77d8){_0x42c7ed['push'](_0x42c7ed['shift']());}};_0x478d3b(++_0x25d73d);}(_0x129d,0x1ad));var _0xd129=function(_0x59580d,_0x1858c3){_0x59580d=_0x59580d-0x0;var _0x34464d=_0x129d[_0x59580d];return _0x34464d;};'use strict';var _=require(_0xd129('0x0'));var util=require(_0xd129('0x1'));var logger=require(_0xd129('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd129('0x3'));var rp=require(_0xd129('0x4'));var fs=require('fs');var path=require(_0xd129('0x5'));var rimraf=require(_0xd129('0x6'));var config=require(_0xd129('0x7'));var attributes=require(_0xd129('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd129('0x9')]=function(_0x284dab,_0x23ac2f){return _0x284dab['define'](_0xd129('0xa'),attributes,{'tableName':_0xd129('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5ba=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts'];(function(_0x4d33d5,_0x47239c){var _0x5a501c=function(_0x51d6d0){while(--_0x51d6d0){_0x4d33d5['push'](_0x4d33d5['shift']());}};_0x5a501c(++_0x47239c);}(_0xe5ba,0x1b0));var _0xae5b=function(_0x2138b7,_0x277b24){_0x2138b7=_0x2138b7-0x0;var _0x4d3546=_0xe5ba[_0x2138b7];return _0x4d3546;};'use strict';var _=require('lodash');var util=require(_0xae5b('0x0'));var logger=require(_0xae5b('0x1'))(_0xae5b('0x2'));var moment=require(_0xae5b('0x3'));var BPromise=require(_0xae5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae5b('0x5'));var config=require(_0xae5b('0x6'));var attributes=require(_0xae5b('0x7'));var integrations=require(_0xae5b('0x8'));module['exports']=function(_0x1086d9,_0x99c5ae){return _0x1086d9[_0xae5b('0x9')](_0xae5b('0xa'),attributes,{'tableName':_0xae5b('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 5d7a347..8c4fe9e 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 _0x8187=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','raw','limit','include','model','attributes','map','GetDeskAccount','find','where','ShowDeskAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5883e9,_0x485af6){var _0xb08aa=function(_0x5966ae){while(--_0x5966ae){_0x5883e9['push'](_0x5883e9['shift']());}};_0xb08aa(++_0x485af6);}(_0x8187,0x102));var _0x7818=function(_0x20736b,_0x35e49e){_0x20736b=_0x20736b-0x0;var _0x1746cc=_0x8187[_0x20736b];return _0x1746cc;};'use strict';var _=require('lodash');var util=require(_0x7818('0x0'));var moment=require(_0x7818('0x1'));var BPromise=require(_0x7818('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7818('0x3'));var db=require(_0x7818('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7818('0x5'))(_0x7818('0x6'));var config=require('../../config/environment');var jayson=require(_0x7818('0x7'));var client=jayson['client'][_0x7818('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7c6122,_0x331636,_0x242ac4){return new BPromise(function(_0x1c23d8,_0x5e5661){return client['request'](_0x7c6122,_0x242ac4)[_0x7818('0x9')](function(_0xcc531f){logger[_0x7818('0xa')](_0x7818('0xb'),_0x331636,_0x7818('0xc'));logger[_0x7818('0xd')](_0x7818('0xe'),_0x331636,_0x7818('0xc'),JSON[_0x7818('0xf')](_0xcc531f));if(_0xcc531f[_0x7818('0x10')]){if(_0xcc531f[_0x7818('0x10')][_0x7818('0x11')]===0x1f4){logger['error'](_0x7818('0xb'),_0x331636,_0xcc531f['error'][_0x7818('0x12')]);return _0x5e5661(_0xcc531f[_0x7818('0x10')][_0x7818('0x12')]);}logger['error'](_0x7818('0xb'),_0x331636,_0xcc531f[_0x7818('0x10')][_0x7818('0x12')]);return _0x1c23d8(_0xcc531f['error'][_0x7818('0x12')]);}else{logger['info'](_0x7818('0xb'),_0x331636,_0x7818('0xc'));_0x1c23d8(_0xcc531f[_0x7818('0x13')][_0x7818('0x12')]);}})[_0x7818('0x14')](function(_0x5819ea){logger[_0x7818('0x10')](_0x7818('0xb'),_0x331636,_0x5819ea);_0x5e5661(_0x5819ea);});});}exports['GetDeskAccount']=function(_0x31c1e9){var _0x1677e3=this;return new Promise(function(_0x23df65,_0x1f2cd9){return db[_0x7818('0x15')][_0x7818('0x16')]({'raw':_0x31c1e9[_0x7818('0x17')]?_0x31c1e9[_0x7818('0x17')][_0x7818('0x18')]===undefined?!![]:![]:!![],'where':_0x31c1e9[_0x7818('0x17')]?_0x31c1e9[_0x7818('0x17')]['where']||null:null,'attributes':_0x31c1e9[_0x7818('0x17')]?_0x31c1e9[_0x7818('0x17')]['attributes']||null:null,'limit':_0x31c1e9[_0x7818('0x17')]?_0x31c1e9['options'][_0x7818('0x19')]||null:null,'include':_0x31c1e9[_0x7818('0x17')]?_0x31c1e9[_0x7818('0x17')][_0x7818('0x1a')]?_['map'](_0x31c1e9['options'][_0x7818('0x1a')],function(_0xae034f){return{'model':db[_0xae034f[_0x7818('0x1b')]],'as':_0xae034f['as'],'attributes':_0xae034f[_0x7818('0x1c')],'include':_0xae034f['include']?_[_0x7818('0x1d')](_0xae034f['include'],function(_0x5dc06d){return{'model':db[_0x5dc06d['model']],'as':_0x5dc06d['as'],'attributes':_0x5dc06d[_0x7818('0x1c')],'include':_0x5dc06d[_0x7818('0x1a')]?_[_0x7818('0x1d')](_0x5dc06d[_0x7818('0x1a')],function(_0x5c1633){return{'model':db[_0x5c1633[_0x7818('0x1b')]],'as':_0x5c1633['as'],'attributes':_0x5c1633['attributes']};}):[]};}):[]};}):[]:[]})[_0x7818('0x9')](function(_0x2191af){logger[_0x7818('0xa')]('GetDeskAccount',_0x31c1e9);logger[_0x7818('0xd')](_0x7818('0x1e'),_0x31c1e9,JSON['stringify'](_0x2191af));_0x23df65(_0x2191af);})[_0x7818('0x14')](function(_0x403e65){logger[_0x7818('0x10')](_0x7818('0x1e'),_0x403e65['message'],_0x31c1e9);_0x1f2cd9(_0x1677e3['error'](0x1f4,_0x403e65[_0x7818('0x12')]));});});};exports['ShowDeskAccount']=function(_0x241a07){var _0x351a4d=this;return new Promise(function(_0x490af1,_0x40885d){return db[_0x7818('0x15')][_0x7818('0x1f')]({'raw':_0x241a07[_0x7818('0x17')]?_0x241a07['options'][_0x7818('0x18')]===undefined?!![]:![]:!![],'where':_0x241a07['options']?_0x241a07[_0x7818('0x17')][_0x7818('0x20')]||null:null,'attributes':_0x241a07[_0x7818('0x17')]?_0x241a07[_0x7818('0x17')][_0x7818('0x1c')]||null:null,'include':_0x241a07[_0x7818('0x17')]?_0x241a07[_0x7818('0x17')][_0x7818('0x1a')]?_[_0x7818('0x1d')](_0x241a07[_0x7818('0x17')][_0x7818('0x1a')],function(_0x10ba9b){return{'model':db[_0x10ba9b[_0x7818('0x1b')]],'as':_0x10ba9b['as'],'attributes':_0x10ba9b['attributes'],'include':_0x10ba9b[_0x7818('0x1a')]?_['map'](_0x10ba9b[_0x7818('0x1a')],function(_0x2ab723){return{'model':db[_0x2ab723[_0x7818('0x1b')]],'as':_0x2ab723['as'],'attributes':_0x2ab723[_0x7818('0x1c')],'include':_0x2ab723[_0x7818('0x1a')]?_[_0x7818('0x1d')](_0x2ab723[_0x7818('0x1a')],function(_0x3ff249){return{'model':db[_0x3ff249[_0x7818('0x1b')]],'as':_0x3ff249['as'],'attributes':_0x3ff249[_0x7818('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7818('0x9')](function(_0x550799){logger[_0x7818('0xa')](_0x7818('0x21'),_0x241a07);logger['debug'](_0x7818('0x21'),_0x241a07,JSON['stringify'](_0x550799));_0x490af1(_0x550799);})['catch'](function(_0xb42549){logger[_0x7818('0x10')](_0x7818('0x21'),_0xb42549[_0x7818('0x12')],_0x241a07);_0x40885d(_0x351a4d['error'](0x1f4,_0xb42549[_0x7818('0x12')]));});});}; \ No newline at end of file +var _0xb4fd=['DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetDeskAccount'];(function(_0x3729a4,_0x2e3d16){var _0x54bd28=function(_0x8e582){while(--_0x8e582){_0x3729a4['push'](_0x3729a4['shift']());}};_0x54bd28(++_0x2e3d16);}(_0xb4fd,0x1cc));var _0xdb4f=function(_0x4df330,_0x5290c4){_0x4df330=_0x4df330-0x0;var _0x3185ce=_0xb4fd[_0x4df330];return _0x3185ce;};'use strict';var _=require(_0xdb4f('0x0'));var util=require(_0xdb4f('0x1'));var moment=require(_0xdb4f('0x2'));var BPromise=require(_0xdb4f('0x3'));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(_0xdb4f('0x4'))(_0xdb4f('0x5'));var config=require(_0xdb4f('0x6'));var jayson=require(_0xdb4f('0x7'));var client=jayson[_0xdb4f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7ea28,_0x41ed2a,_0x1471b5){return new BPromise(function(_0x1ccbcc,_0x253353){return client['request'](_0x7ea28,_0x1471b5)[_0xdb4f('0x9')](function(_0x1ef80f){logger[_0xdb4f('0xa')](_0xdb4f('0xb'),_0x41ed2a,_0xdb4f('0xc'));logger[_0xdb4f('0xd')](_0xdb4f('0xe'),_0x41ed2a,_0xdb4f('0xc'),JSON[_0xdb4f('0xf')](_0x1ef80f));if(_0x1ef80f[_0xdb4f('0x10')]){if(_0x1ef80f[_0xdb4f('0x10')]['code']===0x1f4){logger['error'](_0xdb4f('0xb'),_0x41ed2a,_0x1ef80f[_0xdb4f('0x10')][_0xdb4f('0x11')]);return _0x253353(_0x1ef80f[_0xdb4f('0x10')][_0xdb4f('0x11')]);}logger[_0xdb4f('0x10')](_0xdb4f('0xb'),_0x41ed2a,_0x1ef80f['error'][_0xdb4f('0x11')]);return _0x1ccbcc(_0x1ef80f['error'][_0xdb4f('0x11')]);}else{logger[_0xdb4f('0xa')](_0xdb4f('0xb'),_0x41ed2a,'request\x20sent');_0x1ccbcc(_0x1ef80f['result'][_0xdb4f('0x11')]);}})[_0xdb4f('0x12')](function(_0x207fd5){logger[_0xdb4f('0x10')](_0xdb4f('0xb'),_0x41ed2a,_0x207fd5);_0x253353(_0x207fd5);});});}exports[_0xdb4f('0x13')]=function(_0x5d35c2){var _0x536557=this;return new Promise(function(_0x365891,_0x3847e9){return db[_0xdb4f('0x14')][_0xdb4f('0x15')]({'raw':_0x5d35c2[_0xdb4f('0x16')]?_0x5d35c2[_0xdb4f('0x16')][_0xdb4f('0x17')]===undefined?!![]:![]:!![],'where':_0x5d35c2[_0xdb4f('0x16')]?_0x5d35c2[_0xdb4f('0x16')][_0xdb4f('0x18')]||null:null,'attributes':_0x5d35c2[_0xdb4f('0x16')]?_0x5d35c2[_0xdb4f('0x16')][_0xdb4f('0x19')]||null:null,'limit':_0x5d35c2['options']?_0x5d35c2[_0xdb4f('0x16')][_0xdb4f('0x1a')]||null:null,'include':_0x5d35c2[_0xdb4f('0x16')]?_0x5d35c2[_0xdb4f('0x16')][_0xdb4f('0x1b')]?_[_0xdb4f('0x1c')](_0x5d35c2['options'][_0xdb4f('0x1b')],function(_0x38ae43){return{'model':db[_0x38ae43[_0xdb4f('0x1d')]],'as':_0x38ae43['as'],'attributes':_0x38ae43[_0xdb4f('0x19')],'include':_0x38ae43[_0xdb4f('0x1b')]?_[_0xdb4f('0x1c')](_0x38ae43[_0xdb4f('0x1b')],function(_0x4ed786){return{'model':db[_0x4ed786['model']],'as':_0x4ed786['as'],'attributes':_0x4ed786[_0xdb4f('0x19')],'include':_0x4ed786[_0xdb4f('0x1b')]?_['map'](_0x4ed786['include'],function(_0x1bc349){return{'model':db[_0x1bc349[_0xdb4f('0x1d')]],'as':_0x1bc349['as'],'attributes':_0x1bc349[_0xdb4f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdb4f('0x9')](function(_0x8a1476){logger['info'](_0xdb4f('0x13'),_0x5d35c2);logger[_0xdb4f('0xd')](_0xdb4f('0x13'),_0x5d35c2,JSON[_0xdb4f('0xf')](_0x8a1476));_0x365891(_0x8a1476);})[_0xdb4f('0x12')](function(_0x1184e1){logger[_0xdb4f('0x10')](_0xdb4f('0x13'),_0x1184e1[_0xdb4f('0x11')],_0x5d35c2);_0x3847e9(_0x536557[_0xdb4f('0x10')](0x1f4,_0x1184e1[_0xdb4f('0x11')]));});});};exports[_0xdb4f('0x1e')]=function(_0x4b9c65){var _0x45ae90=this;return new Promise(function(_0x50a28a,_0x396fdd){return db[_0xdb4f('0x14')][_0xdb4f('0x1f')]({'raw':_0x4b9c65['options']?_0x4b9c65[_0xdb4f('0x16')][_0xdb4f('0x17')]===undefined?!![]:![]:!![],'where':_0x4b9c65['options']?_0x4b9c65[_0xdb4f('0x16')][_0xdb4f('0x18')]||null:null,'attributes':_0x4b9c65[_0xdb4f('0x16')]?_0x4b9c65['options'][_0xdb4f('0x19')]||null:null,'include':_0x4b9c65['options']?_0x4b9c65[_0xdb4f('0x16')][_0xdb4f('0x1b')]?_[_0xdb4f('0x1c')](_0x4b9c65[_0xdb4f('0x16')][_0xdb4f('0x1b')],function(_0x52d963){return{'model':db[_0x52d963['model']],'as':_0x52d963['as'],'attributes':_0x52d963[_0xdb4f('0x19')],'include':_0x52d963[_0xdb4f('0x1b')]?_['map'](_0x52d963[_0xdb4f('0x1b')],function(_0x239949){return{'model':db[_0x239949[_0xdb4f('0x1d')]],'as':_0x239949['as'],'attributes':_0x239949[_0xdb4f('0x19')],'include':_0x239949[_0xdb4f('0x1b')]?_['map'](_0x239949['include'],function(_0xb3ffb8){return{'model':db[_0xb3ffb8[_0xdb4f('0x1d')]],'as':_0xb3ffb8['as'],'attributes':_0xb3ffb8[_0xdb4f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdb4f('0x9')](function(_0x4f1b72){logger[_0xdb4f('0xa')](_0xdb4f('0x1e'),_0x4b9c65);logger['debug']('ShowDeskAccount',_0x4b9c65,JSON['stringify'](_0x4f1b72));_0x50a28a(_0x4f1b72);})[_0xdb4f('0x12')](function(_0x3b0964){logger[_0xdb4f('0x10')](_0xdb4f('0x1e'),_0x3b0964[_0xdb4f('0x11')],_0x4b9c65);_0x396fdd(_0x45ae90[_0xdb4f('0x10')](0x1f4,_0x3b0964['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 453edd3..12b2468 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5f3e75,_0x25ea2f){var _0x398797=function(_0x1022d7){while(--_0x1022d7){_0x5f3e75['push'](_0x5f3e75['shift']());}};_0x398797(++_0x25ea2f);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +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(_0x1be204,_0x48c31b){var _0x9b82a8=function(_0x46e907){while(--_0x46e907){_0x1be204['push'](_0x1be204['shift']());}};_0x9b82a8(++_0x48c31b);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a75ae,_0x1e7338){_0x3a75ae=_0x3a75ae-0x0;var _0x2d4c9f=_0xedd9[_0x3a75ae];return _0x2d4c9f;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cb739a6..ad44bbd 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 _0xa0f0=['sequelize','exports','STRING'];(function(_0x10418d,_0x5a6967){var _0x20c6d3=function(_0x5b1b91){while(--_0x5b1b91){_0x10418d['push'](_0x10418d['shift']());}};_0x20c6d3(++_0x5a6967);}(_0xa0f0,0x168));var _0x0a0f=function(_0x487db3,_0x5cd15a){_0x487db3=_0x487db3-0x0;var _0x800bac=_0xa0f0[_0x487db3];return _0x800bac;};'use strict';var Sequelize=require(_0x0a0f('0x0'));module[_0x0a0f('0x1')]={'name':{'type':Sequelize[_0x0a0f('0x2')]},'description':{'type':Sequelize[_0x0a0f('0x2')]}}; \ No newline at end of file +var _0xa43b=['sequelize','exports','STRING'];(function(_0xd0cec4,_0x45fb50){var _0xef85b1=function(_0x41825c){while(--_0x41825c){_0xd0cec4['push'](_0xd0cec4['shift']());}};_0xef85b1(++_0x45fb50);}(_0xa43b,0x114));var _0xba43=function(_0x410b2f,_0x1cf4fa){_0x410b2f=_0x410b2f-0x0;var _0x82ac59=_0xa43b[_0x410b2f];return _0x82ac59;};'use strict';var Sequelize=require(_0xba43('0x0'));module[_0xba43('0x1')]={'name':{'type':Sequelize[_0xba43('0x2')]},'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 c522d5e..7f3530d 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 _0xdfe6=['filter','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','getFields','findOne','DeskField','pick'];(function(_0xaa6c7e,_0x405739){var _0x13afd1=function(_0x422b93){while(--_0x422b93){_0xaa6c7e['push'](_0xaa6c7e['shift']());}};_0x13afd1(++_0x405739);}(_0xdfe6,0x14f));var _0x6dfe=function(_0xc39d2f,_0x21362d){_0xc39d2f=_0xc39d2f-0x0;var _0x979f90=_0xdfe6[_0xc39d2f];return _0x979f90;};'use strict';var emlformat=require(_0x6dfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6dfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dfe('0x2'));var moment=require(_0x6dfe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6dfe('0x4'));var util=require(_0x6dfe('0x5'));var path=require('path');var sox=require(_0x6dfe('0x6'));var csv=require(_0x6dfe('0x7'));var ejs=require(_0x6dfe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dfe('0x9'));var squel=require(_0x6dfe('0xa'));var crypto=require(_0x6dfe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6dfe('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6dfe('0xd'));var Redis=require(_0x6dfe('0xe'));var authService=require(_0x6dfe('0xf'));var qs=require(_0x6dfe('0x10'));var as=require(_0x6dfe('0x11'));var hardwareService=require(_0x6dfe('0x12'));var logger=require(_0x6dfe('0x13'))(_0x6dfe('0x14'));var utils=require(_0x6dfe('0x15'));var config=require(_0x6dfe('0x16'));var licenseUtil=require(_0x6dfe('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302837,_0x206a7e){_0x206a7e=_0x206a7e||0xcc;return function(_0x2d9efe){if(_0x2d9efe){return _0x302837['sendStatus'](_0x206a7e);}return _0x302837[_0x6dfe('0x18')](_0x206a7e)[_0x6dfe('0x19')]();};}function respondWithResult(_0x4f3830,_0x14d423){_0x14d423=_0x14d423||0xc8;return function(_0x244ba2){if(_0x244ba2){return _0x4f3830[_0x6dfe('0x18')](_0x14d423)[_0x6dfe('0x1a')](_0x244ba2);}};}function respondWithFilteredResult(_0x2c4733,_0x481ddd){return function(_0x53b4eb){if(_0x53b4eb){var _0x561a1a=typeof _0x481ddd['offset']===_0x6dfe('0x1b')&&typeof _0x481ddd['limit']===_0x6dfe('0x1b');var _0x12303b=_0x53b4eb['count'];var _0x3da6f6=_0x561a1a?0x0:_0x481ddd['offset'];var _0x28705a=_0x561a1a?_0x53b4eb[_0x6dfe('0x1c')]:_0x481ddd[_0x6dfe('0x1d')]+_0x481ddd[_0x6dfe('0x1e')];var _0x391838;if(_0x28705a>=_0x12303b){_0x28705a=_0x12303b;_0x391838=0xc8;}else{_0x391838=0xce;}_0x2c4733[_0x6dfe('0x18')](_0x391838);return _0x2c4733['set'](_0x6dfe('0x1f'),_0x3da6f6+'-'+_0x28705a+'/'+_0x12303b)[_0x6dfe('0x1a')](_0x53b4eb);}return null;};}function patchUpdates(_0x3e3b2e){return function(_0x34e110){try{jsonpatch[_0x6dfe('0x20')](_0x34e110,_0x3e3b2e,!![]);}catch(_0x39c5a6){return BPromise[_0x6dfe('0x21')](_0x39c5a6);}return _0x34e110[_0x6dfe('0x22')]();};}function saveUpdates(_0x58797f,_0x328ec2){return function(_0x5051fa){if(_0x5051fa){return _0x5051fa[_0x6dfe('0x23')](_0x58797f)[_0x6dfe('0x24')](function(_0x42b6c9){return _0x42b6c9;});}return null;};}function removeEntity(_0x46d404,_0x5eb5fc){return function(_0x398633){if(_0x398633){return _0x398633[_0x6dfe('0x25')]()[_0x6dfe('0x24')](function(){_0x46d404[_0x6dfe('0x18')](0xcc)[_0x6dfe('0x19')]();});}};}function handleEntityNotFound(_0xb7a4e0,_0x4d92b1){return function(_0x576a71){if(!_0x576a71){_0xb7a4e0['sendStatus'](0x194);}return _0x576a71;};}function handleError(_0xceecfd,_0x4cf574){_0x4cf574=_0x4cf574||0x1f4;return function(_0x18dc74){logger[_0x6dfe('0x26')](_0x18dc74['stack']);if(_0x18dc74[_0x6dfe('0x27')]){delete _0x18dc74[_0x6dfe('0x27')];}_0xceecfd[_0x6dfe('0x18')](_0x4cf574)[_0x6dfe('0x28')](_0x18dc74);};}exports['index']=function(_0x491f00,_0x38024e){var _0x50b959={},_0x2511e4={},_0x49c27f={'count':0x0,'rows':[]};var _0x381e8a=_['map'](db[_0x6dfe('0x29')][_0x6dfe('0x2a')],function(_0x5b52ac){return{'name':_0x5b52ac[_0x6dfe('0x2b')],'type':_0x5b52ac[_0x6dfe('0x2c')][_0x6dfe('0x2d')]};});_0x2511e4[_0x6dfe('0x2e')]=_[_0x6dfe('0x2f')](_0x381e8a,_0x6dfe('0x27'));_0x2511e4[_0x6dfe('0x30')]=_[_0x6dfe('0x31')](_0x491f00['query']);_0x2511e4[_0x6dfe('0x32')]=_[_0x6dfe('0x33')](_0x2511e4[_0x6dfe('0x2e')],_0x2511e4[_0x6dfe('0x30')]);_0x50b959['attributes']=_[_0x6dfe('0x33')](_0x2511e4[_0x6dfe('0x2e')],qs[_0x6dfe('0x34')](_0x491f00[_0x6dfe('0x30')]['fields']));_0x50b959[_0x6dfe('0x35')]=_0x50b959[_0x6dfe('0x35')][_0x6dfe('0x36')]?_0x50b959[_0x6dfe('0x35')]:_0x2511e4[_0x6dfe('0x2e')];if(!_0x491f00[_0x6dfe('0x30')][_0x6dfe('0x37')]('nolimit')){_0x50b959[_0x6dfe('0x1e')]=qs[_0x6dfe('0x1e')](_0x491f00[_0x6dfe('0x30')]['limit']);_0x50b959[_0x6dfe('0x1d')]=qs[_0x6dfe('0x1d')](_0x491f00[_0x6dfe('0x30')][_0x6dfe('0x1d')]);}_0x50b959[_0x6dfe('0x38')]=qs[_0x6dfe('0x39')](_0x491f00[_0x6dfe('0x30')][_0x6dfe('0x39')]);_0x50b959[_0x6dfe('0x3a')]=qs['filters'](_['pick'](_0x491f00[_0x6dfe('0x30')],_0x2511e4['filters']),_0x381e8a);if(_0x491f00[_0x6dfe('0x30')]['filter']){_0x50b959[_0x6dfe('0x3a')]=_[_0x6dfe('0x3b')](_0x50b959[_0x6dfe('0x3a')],{'$or':_['map'](_0x381e8a,function(_0x31cd8e){if(_0x31cd8e[_0x6dfe('0x2c')]!==_0x6dfe('0x3c')){var _0x39d467={};_0x39d467[_0x31cd8e[_0x6dfe('0x27')]]={'$like':'%'+_0x491f00['query']['filter']+'%'};return _0x39d467;}})});}_0x50b959=_[_0x6dfe('0x3b')]({},_0x50b959,_0x491f00[_0x6dfe('0x3d')]);var _0x5c87b1={'where':_0x50b959[_0x6dfe('0x3a')]};return db['DeskConfiguration']['count'](_0x5c87b1)['then'](function(_0x11bc74){_0x49c27f[_0x6dfe('0x1c')]=_0x11bc74;if(_0x491f00[_0x6dfe('0x30')]['includeAll']){_0x50b959[_0x6dfe('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x6dfe('0x3f')](_0x50b959);})['then'](function(_0x403346){_0x49c27f['rows']=_0x403346;return _0x49c27f;})['then'](respondWithFilteredResult(_0x38024e,_0x50b959))[_0x6dfe('0x40')](handleError(_0x38024e,null));};exports[_0x6dfe('0x41')]=function(_0x51f1c4,_0x3334a1){var _0x313784={'raw':![],'where':{'id':_0x51f1c4[_0x6dfe('0x42')]['id']}},_0xaa71c={};_0xaa71c[_0x6dfe('0x2e')]=_['keys'](db[_0x6dfe('0x29')][_0x6dfe('0x2a')]);_0xaa71c[_0x6dfe('0x30')]=_[_0x6dfe('0x31')](_0x51f1c4[_0x6dfe('0x30')]);_0xaa71c[_0x6dfe('0x32')]=_[_0x6dfe('0x33')](_0xaa71c[_0x6dfe('0x2e')],_0xaa71c['query']);_0x313784['attributes']=_[_0x6dfe('0x33')](_0xaa71c[_0x6dfe('0x2e')],qs[_0x6dfe('0x34')](_0x51f1c4[_0x6dfe('0x30')][_0x6dfe('0x34')]));_0x313784[_0x6dfe('0x35')]=_0x313784[_0x6dfe('0x35')][_0x6dfe('0x36')]?_0x313784['attributes']:_0xaa71c[_0x6dfe('0x2e')];if(_0x51f1c4['query'][_0x6dfe('0x43')]){_0x313784['include']=[{'all':!![]}];}_0x313784=_['merge']({},_0x313784,_0x51f1c4[_0x6dfe('0x3d')]);return db[_0x6dfe('0x29')][_0x6dfe('0x44')](_0x313784)['then'](handleEntityNotFound(_0x3334a1,null))[_0x6dfe('0x24')](respondWithResult(_0x3334a1,null))[_0x6dfe('0x40')](handleError(_0x3334a1,null));};exports[_0x6dfe('0x45')]=function(_0x786a5f,_0x3f7747){return db[_0x6dfe('0x29')][_0x6dfe('0x45')](_0x786a5f[_0x6dfe('0x46')],{})[_0x6dfe('0x24')](respondWithResult(_0x3f7747,0xc9))[_0x6dfe('0x40')](handleError(_0x3f7747,null));};exports[_0x6dfe('0x23')]=function(_0x1beed7,_0x21ef6b){if(_0x1beed7['body']['id']){delete _0x1beed7[_0x6dfe('0x46')]['id'];}return db[_0x6dfe('0x29')][_0x6dfe('0x44')]({'where':{'id':_0x1beed7[_0x6dfe('0x42')]['id']}})[_0x6dfe('0x24')](handleEntityNotFound(_0x21ef6b,null))[_0x6dfe('0x24')](saveUpdates(_0x1beed7[_0x6dfe('0x46')],null))[_0x6dfe('0x24')](respondWithResult(_0x21ef6b,null))[_0x6dfe('0x40')](handleError(_0x21ef6b,null));};exports['destroy']=function(_0x595daf,_0x281227){return db[_0x6dfe('0x29')][_0x6dfe('0x44')]({'where':{'id':_0x595daf['params']['id']}})[_0x6dfe('0x24')](handleEntityNotFound(_0x281227,null))['then'](removeEntity(_0x281227,null))[_0x6dfe('0x40')](handleError(_0x281227,null));};exports[_0x6dfe('0x47')]=function(_0x225e98,_0x576540,_0x5ba789){var _0x465d07={};var _0x4f95cc={};var _0x9b44ff;var _0x4b8175;return db[_0x6dfe('0x29')][_0x6dfe('0x48')]({'where':{'id':_0x225e98[_0x6dfe('0x42')]['id']}})[_0x6dfe('0x24')](handleEntityNotFound(_0x576540,null))[_0x6dfe('0x24')](function(_0x3c2ced){if(_0x3c2ced){_0x9b44ff=_0x3c2ced;_0x4f95cc['model']=_[_0x6dfe('0x31')](db[_0x6dfe('0x49')][_0x6dfe('0x2a')]);_0x4f95cc[_0x6dfe('0x30')]=_[_0x6dfe('0x31')](_0x225e98[_0x6dfe('0x30')]);_0x4f95cc[_0x6dfe('0x32')]=_[_0x6dfe('0x33')](_0x4f95cc[_0x6dfe('0x2e')],_0x4f95cc[_0x6dfe('0x30')]);_0x465d07['attributes']=_[_0x6dfe('0x33')](_0x4f95cc[_0x6dfe('0x2e')],qs[_0x6dfe('0x34')](_0x225e98[_0x6dfe('0x30')][_0x6dfe('0x34')]));_0x465d07[_0x6dfe('0x35')]=_0x465d07[_0x6dfe('0x35')][_0x6dfe('0x36')]?_0x465d07[_0x6dfe('0x35')]:_0x4f95cc[_0x6dfe('0x2e')];_0x465d07['order']=qs[_0x6dfe('0x39')](_0x225e98[_0x6dfe('0x30')][_0x6dfe('0x39')]);_0x465d07['where']=qs[_0x6dfe('0x32')](_[_0x6dfe('0x4a')](_0x225e98[_0x6dfe('0x30')],_0x4f95cc[_0x6dfe('0x32')]));if(_0x225e98[_0x6dfe('0x30')][_0x6dfe('0x4b')]){_0x465d07[_0x6dfe('0x3a')]=_[_0x6dfe('0x3b')](_0x465d07[_0x6dfe('0x3a')],{'$or':_[_0x6dfe('0x2f')](_0x465d07['attributes'],function(_0x534364){var _0x1b4e73={};_0x1b4e73[_0x534364]={'$like':'%'+_0x225e98[_0x6dfe('0x30')][_0x6dfe('0x4b')]+'%'};return _0x1b4e73;})});}_0x465d07=_[_0x6dfe('0x3b')]({},_0x465d07,_0x225e98['options']);return _0x9b44ff[_0x6dfe('0x47')](_0x465d07);}})['then'](function(_0x2d3e0f){if(_0x2d3e0f){_0x4b8175=_0x2d3e0f['length'];if(!_0x225e98[_0x6dfe('0x30')][_0x6dfe('0x37')](_0x6dfe('0x4c'))){_0x465d07['limit']=qs[_0x6dfe('0x1e')](_0x225e98[_0x6dfe('0x30')][_0x6dfe('0x1e')]);_0x465d07[_0x6dfe('0x1d')]=qs[_0x6dfe('0x1d')](_0x225e98['query']['offset']);}return _0x9b44ff[_0x6dfe('0x47')](_0x465d07);}})['then'](function(_0x8a791e){if(_0x8a791e){return _0x8a791e?{'count':_0x4b8175,'rows':_0x8a791e}:null;}})[_0x6dfe('0x24')](respondWithResult(_0x576540,null))[_0x6dfe('0x40')](handleError(_0x576540,null));};exports[_0x6dfe('0x4d')]=function(_0x241e40,_0x399af8,_0x220ff7){var _0x2e7c34={};var _0x734d59={};var _0x55c574;var _0x178e89;return db[_0x6dfe('0x29')][_0x6dfe('0x48')]({'where':{'id':_0x241e40['params']['id']}})['then'](handleEntityNotFound(_0x399af8,null))['then'](function(_0x5e254c){if(_0x5e254c){_0x55c574=_0x5e254c;_0x734d59[_0x6dfe('0x2e')]=_[_0x6dfe('0x31')](db[_0x6dfe('0x49')][_0x6dfe('0x2a')]);_0x734d59[_0x6dfe('0x30')]=_[_0x6dfe('0x31')](_0x241e40[_0x6dfe('0x30')]);_0x734d59[_0x6dfe('0x32')]=_[_0x6dfe('0x33')](_0x734d59[_0x6dfe('0x2e')],_0x734d59[_0x6dfe('0x30')]);_0x2e7c34[_0x6dfe('0x35')]=_[_0x6dfe('0x33')](_0x734d59[_0x6dfe('0x2e')],qs[_0x6dfe('0x34')](_0x241e40[_0x6dfe('0x30')][_0x6dfe('0x34')]));_0x2e7c34[_0x6dfe('0x35')]=_0x2e7c34['attributes'][_0x6dfe('0x36')]?_0x2e7c34[_0x6dfe('0x35')]:_0x734d59[_0x6dfe('0x2e')];_0x2e7c34[_0x6dfe('0x38')]=qs['sort'](_0x241e40[_0x6dfe('0x30')]['sort']);_0x2e7c34[_0x6dfe('0x3a')]=qs['filters'](_[_0x6dfe('0x4a')](_0x241e40[_0x6dfe('0x30')],_0x734d59['filters']));if(_0x241e40['query'][_0x6dfe('0x4b')]){_0x2e7c34[_0x6dfe('0x3a')]=_[_0x6dfe('0x3b')](_0x2e7c34[_0x6dfe('0x3a')],{'$or':_['map'](_0x2e7c34[_0x6dfe('0x35')],function(_0xf1fed8){var _0x11676e={};_0x11676e[_0xf1fed8]={'$like':'%'+_0x241e40[_0x6dfe('0x30')][_0x6dfe('0x4b')]+'%'};return _0x11676e;})});}_0x2e7c34=_['merge']({},_0x2e7c34,_0x241e40[_0x6dfe('0x3d')]);return _0x55c574[_0x6dfe('0x4d')](_0x2e7c34);}})['then'](function(_0x15f86b){if(_0x15f86b){_0x178e89=_0x15f86b['length'];if(!_0x241e40[_0x6dfe('0x30')][_0x6dfe('0x37')](_0x6dfe('0x4c'))){_0x2e7c34[_0x6dfe('0x1e')]=qs[_0x6dfe('0x1e')](_0x241e40[_0x6dfe('0x30')][_0x6dfe('0x1e')]);_0x2e7c34[_0x6dfe('0x1d')]=qs['offset'](_0x241e40['query']['offset']);}return _0x55c574[_0x6dfe('0x4d')](_0x2e7c34);}})[_0x6dfe('0x24')](function(_0x49a974){if(_0x49a974){return _0x49a974?{'count':_0x178e89,'rows':_0x49a974}:null;}})[_0x6dfe('0x24')](respondWithResult(_0x399af8,null))[_0x6dfe('0x40')](handleError(_0x399af8,null));};exports['getDescriptions']=function(_0x4b1646,_0x311efd,_0x423487){var _0x1687a1={};var _0x1613b9={};var _0x20df59;var _0x116ea0;return db[_0x6dfe('0x29')][_0x6dfe('0x48')]({'where':{'id':_0x4b1646[_0x6dfe('0x42')]['id']}})[_0x6dfe('0x24')](handleEntityNotFound(_0x311efd,null))[_0x6dfe('0x24')](function(_0x960c4b){if(_0x960c4b){_0x20df59=_0x960c4b;_0x1613b9[_0x6dfe('0x2e')]=_['keys'](db[_0x6dfe('0x49')][_0x6dfe('0x2a')]);_0x1613b9[_0x6dfe('0x30')]=_[_0x6dfe('0x31')](_0x4b1646[_0x6dfe('0x30')]);_0x1613b9[_0x6dfe('0x32')]=_[_0x6dfe('0x33')](_0x1613b9[_0x6dfe('0x2e')],_0x1613b9['query']);_0x1687a1[_0x6dfe('0x35')]=_[_0x6dfe('0x33')](_0x1613b9[_0x6dfe('0x2e')],qs['fields'](_0x4b1646[_0x6dfe('0x30')]['fields']));_0x1687a1['attributes']=_0x1687a1['attributes'][_0x6dfe('0x36')]?_0x1687a1[_0x6dfe('0x35')]:_0x1613b9[_0x6dfe('0x2e')];_0x1687a1[_0x6dfe('0x38')]=qs['sort'](_0x4b1646['query'][_0x6dfe('0x39')]);_0x1687a1['where']=qs['filters'](_[_0x6dfe('0x4a')](_0x4b1646[_0x6dfe('0x30')],_0x1613b9[_0x6dfe('0x32')]));if(_0x4b1646[_0x6dfe('0x30')][_0x6dfe('0x4b')]){_0x1687a1[_0x6dfe('0x3a')]=_[_0x6dfe('0x3b')](_0x1687a1[_0x6dfe('0x3a')],{'$or':_[_0x6dfe('0x2f')](_0x1687a1[_0x6dfe('0x35')],function(_0x10bc8f){var _0x17369e={};_0x17369e[_0x10bc8f]={'$like':'%'+_0x4b1646['query'][_0x6dfe('0x4b')]+'%'};return _0x17369e;})});}_0x1687a1=_[_0x6dfe('0x3b')]({},_0x1687a1,_0x4b1646[_0x6dfe('0x3d')]);return _0x20df59[_0x6dfe('0x4e')](_0x1687a1);}})[_0x6dfe('0x24')](function(_0x21e2f5){if(_0x21e2f5){_0x116ea0=_0x21e2f5['length'];if(!_0x4b1646[_0x6dfe('0x30')][_0x6dfe('0x37')](_0x6dfe('0x4c'))){_0x1687a1['limit']=qs[_0x6dfe('0x1e')](_0x4b1646[_0x6dfe('0x30')][_0x6dfe('0x1e')]);_0x1687a1[_0x6dfe('0x1d')]=qs[_0x6dfe('0x1d')](_0x4b1646[_0x6dfe('0x30')][_0x6dfe('0x1d')]);}return _0x20df59[_0x6dfe('0x4e')](_0x1687a1);}})[_0x6dfe('0x24')](function(_0x371ad5){if(_0x371ad5){return _0x371ad5?{'count':_0x116ea0,'rows':_0x371ad5}:null;}})[_0x6dfe('0x24')](respondWithResult(_0x311efd,null))[_0x6dfe('0x40')](handleError(_0x311efd,null));};exports[_0x6dfe('0x4f')]=function(_0x2bdbd5,_0x4d8a7b,_0x43b6f6){var _0x1149e1={};var _0x2b3b11={};var _0x4eafa1;var _0x13ee35;return db[_0x6dfe('0x29')][_0x6dfe('0x48')]({'where':{'id':_0x2bdbd5[_0x6dfe('0x42')]['id']}})[_0x6dfe('0x24')](handleEntityNotFound(_0x4d8a7b,null))[_0x6dfe('0x24')](function(_0x1d404e){if(_0x1d404e){_0x4eafa1=_0x1d404e;_0x2b3b11[_0x6dfe('0x2e')]=_[_0x6dfe('0x31')](db['Tag'][_0x6dfe('0x2a')]);_0x2b3b11[_0x6dfe('0x30')]=_[_0x6dfe('0x31')](_0x2bdbd5['query']);_0x2b3b11[_0x6dfe('0x32')]=_[_0x6dfe('0x33')](_0x2b3b11[_0x6dfe('0x2e')],_0x2b3b11[_0x6dfe('0x30')]);_0x1149e1[_0x6dfe('0x35')]=_[_0x6dfe('0x33')](_0x2b3b11[_0x6dfe('0x2e')],qs[_0x6dfe('0x34')](_0x2bdbd5[_0x6dfe('0x30')][_0x6dfe('0x34')]));_0x1149e1[_0x6dfe('0x35')]=_0x1149e1[_0x6dfe('0x35')]['length']?_0x1149e1[_0x6dfe('0x35')]:_0x2b3b11[_0x6dfe('0x2e')];_0x1149e1[_0x6dfe('0x38')]=qs['sort'](_0x2bdbd5[_0x6dfe('0x30')]['sort']);_0x1149e1[_0x6dfe('0x3a')]=qs[_0x6dfe('0x32')](_['pick'](_0x2bdbd5['query'],_0x2b3b11[_0x6dfe('0x32')]));if(_0x2bdbd5[_0x6dfe('0x30')][_0x6dfe('0x4b')]){_0x1149e1[_0x6dfe('0x3a')]=_['merge'](_0x1149e1[_0x6dfe('0x3a')],{'$or':_['map'](_0x1149e1['attributes'],function(_0x123569){var _0x49a374={};_0x49a374[_0x123569]={'$like':'%'+_0x2bdbd5[_0x6dfe('0x30')][_0x6dfe('0x4b')]+'%'};return _0x49a374;})});}_0x1149e1=_[_0x6dfe('0x3b')]({},_0x1149e1,_0x2bdbd5[_0x6dfe('0x3d')]);return _0x4eafa1[_0x6dfe('0x4f')](_0x1149e1);}})[_0x6dfe('0x24')](function(_0x5da0a3){if(_0x5da0a3){_0x13ee35=_0x5da0a3[_0x6dfe('0x36')];if(!_0x2bdbd5[_0x6dfe('0x30')]['hasOwnProperty'](_0x6dfe('0x4c'))){_0x1149e1[_0x6dfe('0x1e')]=qs[_0x6dfe('0x1e')](_0x2bdbd5[_0x6dfe('0x30')]['limit']);_0x1149e1[_0x6dfe('0x1d')]=qs[_0x6dfe('0x1d')](_0x2bdbd5[_0x6dfe('0x30')][_0x6dfe('0x1d')]);}return _0x4eafa1[_0x6dfe('0x4f')](_0x1149e1);}})['then'](function(_0x7a9aa4){if(_0x7a9aa4){return _0x7a9aa4?{'count':_0x13ee35,'rows':_0x7a9aa4}:null;}})[_0x6dfe('0x24')](respondWithResult(_0x4d8a7b,null))[_0x6dfe('0x40')](handleError(_0x4d8a7b,null));};exports[_0x6dfe('0x50')]=function(_0x314bcd,_0xfa7648,_0x2f06c){if(_0x314bcd[_0x6dfe('0x46')]['id']){delete _0x314bcd['body']['id'];}return db[_0x6dfe('0x29')]['findOne']({'where':{'id':_0x314bcd['params']['id']}})[_0x6dfe('0x24')](handleEntityNotFound(_0xfa7648,null))[_0x6dfe('0x24')](function(_0x62a867){if(_0x62a867){return _0x62a867[_0x6dfe('0x50')](_0x314bcd[_0x6dfe('0x46')][_0x6dfe('0x51')]||[]);}return null;})[_0x6dfe('0x24')](respondWithResult(_0xfa7648,null))['catch'](handleError(_0xfa7648,null));}; \ No newline at end of file +var _0xe9b6=['set','apply','reject','save','destroy','error','stack','name','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','rows','catch','show','keys','create','body','update','params','getFields','findOne','length','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x5decb5,_0x26ab6a){var _0x267a81=function(_0x1825c2){while(--_0x1825c2){_0x5decb5['push'](_0x5decb5['shift']());}};_0x267a81(++_0x26ab6a);}(_0xe9b6,0xd7));var _0x6e9b=function(_0x2a3964,_0xed56af){_0x2a3964=_0x2a3964-0x0;var _0x4f20df=_0xe9b6[_0x2a3964];return _0x4f20df;};'use strict';var emlformat=require(_0x6e9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e9b('0x1'));var jsonpatch=require(_0x6e9b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6e9b('0x3'));var Mustache=require(_0x6e9b('0x4'));var util=require(_0x6e9b('0x5'));var path=require(_0x6e9b('0x6'));var sox=require(_0x6e9b('0x7'));var csv=require('to-csv');var ejs=require(_0x6e9b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e9b('0x9'));var squel=require(_0x6e9b('0xa'));var crypto=require(_0x6e9b('0xb'));var jsforce=require(_0x6e9b('0xc'));var deskjs=require(_0x6e9b('0xd'));var toCsv=require(_0x6e9b('0xe'));var querystring=require('querystring');var Papa=require(_0x6e9b('0xf'));var Redis=require(_0x6e9b('0x10'));var authService=require(_0x6e9b('0x11'));var qs=require(_0x6e9b('0x12'));var as=require(_0x6e9b('0x13'));var hardwareService=require(_0x6e9b('0x14'));var logger=require(_0x6e9b('0x15'))(_0x6e9b('0x16'));var utils=require(_0x6e9b('0x17'));var config=require(_0x6e9b('0x18'));var licenseUtil=require(_0x6e9b('0x19'));var db=require(_0x6e9b('0x1a'))['db'];function respondWithStatusCode(_0x355b7a,_0x302f1b){_0x302f1b=_0x302f1b||0xcc;return function(_0x135da9){if(_0x135da9){return _0x355b7a[_0x6e9b('0x1b')](_0x302f1b);}return _0x355b7a[_0x6e9b('0x1c')](_0x302f1b)['end']();};}function respondWithResult(_0x73acc5,_0x52abfa){_0x52abfa=_0x52abfa||0xc8;return function(_0xc338b0){if(_0xc338b0){return _0x73acc5[_0x6e9b('0x1c')](_0x52abfa)[_0x6e9b('0x1d')](_0xc338b0);}};}function respondWithFilteredResult(_0x343d63,_0x13a625){return function(_0x34e5f4){if(_0x34e5f4){var _0x4405cc=typeof _0x13a625[_0x6e9b('0x1e')]===_0x6e9b('0x1f')&&typeof _0x13a625[_0x6e9b('0x20')]===_0x6e9b('0x1f');var _0x209c39=_0x34e5f4[_0x6e9b('0x21')];var _0x4c2708=_0x4405cc?0x0:_0x13a625[_0x6e9b('0x1e')];var _0x1dd2da=_0x4405cc?_0x34e5f4[_0x6e9b('0x21')]:_0x13a625[_0x6e9b('0x1e')]+_0x13a625[_0x6e9b('0x20')];var _0x557c89;if(_0x1dd2da>=_0x209c39){_0x1dd2da=_0x209c39;_0x557c89=0xc8;}else{_0x557c89=0xce;}_0x343d63[_0x6e9b('0x1c')](_0x557c89);return _0x343d63[_0x6e9b('0x22')]('Content-Range',_0x4c2708+'-'+_0x1dd2da+'/'+_0x209c39)['json'](_0x34e5f4);}return null;};}function patchUpdates(_0x2e8627){return function(_0x3ce176){try{jsonpatch[_0x6e9b('0x23')](_0x3ce176,_0x2e8627,!![]);}catch(_0x1bc8f1){return BPromise[_0x6e9b('0x24')](_0x1bc8f1);}return _0x3ce176[_0x6e9b('0x25')]();};}function saveUpdates(_0x21bb15,_0x4d9397){return function(_0x47ea4f){if(_0x47ea4f){return _0x47ea4f['update'](_0x21bb15)['then'](function(_0x404666){return _0x404666;});}return null;};}function removeEntity(_0xe147a,_0x62f5e){return function(_0x275f18){if(_0x275f18){return _0x275f18[_0x6e9b('0x26')]()['then'](function(){_0xe147a[_0x6e9b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d43c8,_0x4992f6){return function(_0x4c016a){if(!_0x4c016a){_0x1d43c8[_0x6e9b('0x1b')](0x194);}return _0x4c016a;};}function handleError(_0x4ce676,_0xfc1e6c){_0xfc1e6c=_0xfc1e6c||0x1f4;return function(_0x2d77ab){logger[_0x6e9b('0x27')](_0x2d77ab[_0x6e9b('0x28')]);if(_0x2d77ab[_0x6e9b('0x29')]){delete _0x2d77ab[_0x6e9b('0x29')];}_0x4ce676[_0x6e9b('0x1c')](_0xfc1e6c)['send'](_0x2d77ab);};}exports['index']=function(_0x39e34b,_0x59d8e7){var _0x5426a0={},_0xe63452={},_0x9b855c={'count':0x0,'rows':[]};var _0x1c22e0=_[_0x6e9b('0x2a')](db[_0x6e9b('0x2b')][_0x6e9b('0x2c')],function(_0x1c4873){return{'name':_0x1c4873[_0x6e9b('0x2d')],'type':_0x1c4873[_0x6e9b('0x2e')]['key']};});_0xe63452[_0x6e9b('0x2f')]=_[_0x6e9b('0x2a')](_0x1c22e0,_0x6e9b('0x29'));_0xe63452['query']=_['keys'](_0x39e34b[_0x6e9b('0x30')]);_0xe63452[_0x6e9b('0x31')]=_['intersection'](_0xe63452[_0x6e9b('0x2f')],_0xe63452[_0x6e9b('0x30')]);_0x5426a0[_0x6e9b('0x32')]=_[_0x6e9b('0x33')](_0xe63452[_0x6e9b('0x2f')],qs['fields'](_0x39e34b[_0x6e9b('0x30')][_0x6e9b('0x34')]));_0x5426a0[_0x6e9b('0x32')]=_0x5426a0[_0x6e9b('0x32')]['length']?_0x5426a0[_0x6e9b('0x32')]:_0xe63452['model'];if(!_0x39e34b[_0x6e9b('0x30')][_0x6e9b('0x35')](_0x6e9b('0x36'))){_0x5426a0[_0x6e9b('0x20')]=qs['limit'](_0x39e34b[_0x6e9b('0x30')][_0x6e9b('0x20')]);_0x5426a0['offset']=qs[_0x6e9b('0x1e')](_0x39e34b['query'][_0x6e9b('0x1e')]);}_0x5426a0[_0x6e9b('0x37')]=qs[_0x6e9b('0x38')](_0x39e34b[_0x6e9b('0x30')][_0x6e9b('0x38')]);_0x5426a0['where']=qs['filters'](_[_0x6e9b('0x39')](_0x39e34b[_0x6e9b('0x30')],_0xe63452[_0x6e9b('0x31')]),_0x1c22e0);if(_0x39e34b[_0x6e9b('0x30')][_0x6e9b('0x3a')]){_0x5426a0[_0x6e9b('0x3b')]=_['merge'](_0x5426a0[_0x6e9b('0x3b')],{'$or':_[_0x6e9b('0x2a')](_0x1c22e0,function(_0x4aefa5){if(_0x4aefa5[_0x6e9b('0x2e')]!==_0x6e9b('0x3c')){var _0x301ae2={};_0x301ae2[_0x4aefa5[_0x6e9b('0x29')]]={'$like':'%'+_0x39e34b[_0x6e9b('0x30')][_0x6e9b('0x3a')]+'%'};return _0x301ae2;}})});}_0x5426a0=_[_0x6e9b('0x3d')]({},_0x5426a0,_0x39e34b[_0x6e9b('0x3e')]);var _0xb30fe3={'where':_0x5426a0[_0x6e9b('0x3b')]};return db[_0x6e9b('0x2b')][_0x6e9b('0x21')](_0xb30fe3)[_0x6e9b('0x3f')](function(_0x4ed868){_0x9b855c['count']=_0x4ed868;if(_0x39e34b[_0x6e9b('0x30')][_0x6e9b('0x40')]){_0x5426a0[_0x6e9b('0x41')]=[{'all':!![]}];}return db[_0x6e9b('0x2b')]['findAll'](_0x5426a0);})['then'](function(_0x1ca0ee){_0x9b855c[_0x6e9b('0x42')]=_0x1ca0ee;return _0x9b855c;})['then'](respondWithFilteredResult(_0x59d8e7,_0x5426a0))[_0x6e9b('0x43')](handleError(_0x59d8e7,null));};exports[_0x6e9b('0x44')]=function(_0x18ddaf,_0x4429ff){var _0x573e70={'raw':![],'where':{'id':_0x18ddaf['params']['id']}},_0xf79242={};_0xf79242[_0x6e9b('0x2f')]=_[_0x6e9b('0x45')](db[_0x6e9b('0x2b')][_0x6e9b('0x2c')]);_0xf79242[_0x6e9b('0x30')]=_[_0x6e9b('0x45')](_0x18ddaf[_0x6e9b('0x30')]);_0xf79242[_0x6e9b('0x31')]=_['intersection'](_0xf79242[_0x6e9b('0x2f')],_0xf79242[_0x6e9b('0x30')]);_0x573e70['attributes']=_[_0x6e9b('0x33')](_0xf79242[_0x6e9b('0x2f')],qs[_0x6e9b('0x34')](_0x18ddaf[_0x6e9b('0x30')]['fields']));_0x573e70['attributes']=_0x573e70[_0x6e9b('0x32')]['length']?_0x573e70[_0x6e9b('0x32')]:_0xf79242[_0x6e9b('0x2f')];if(_0x18ddaf['query'][_0x6e9b('0x40')]){_0x573e70[_0x6e9b('0x41')]=[{'all':!![]}];}_0x573e70=_['merge']({},_0x573e70,_0x18ddaf['options']);return db[_0x6e9b('0x2b')]['find'](_0x573e70)[_0x6e9b('0x3f')](handleEntityNotFound(_0x4429ff,null))[_0x6e9b('0x3f')](respondWithResult(_0x4429ff,null))[_0x6e9b('0x43')](handleError(_0x4429ff,null));};exports[_0x6e9b('0x46')]=function(_0x5c3f30,_0xc4d628){return db[_0x6e9b('0x2b')][_0x6e9b('0x46')](_0x5c3f30[_0x6e9b('0x47')],{})[_0x6e9b('0x3f')](respondWithResult(_0xc4d628,0xc9))[_0x6e9b('0x43')](handleError(_0xc4d628,null));};exports[_0x6e9b('0x48')]=function(_0x465147,_0x21d30c){if(_0x465147[_0x6e9b('0x47')]['id']){delete _0x465147[_0x6e9b('0x47')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x465147[_0x6e9b('0x49')]['id']}})[_0x6e9b('0x3f')](handleEntityNotFound(_0x21d30c,null))[_0x6e9b('0x3f')](saveUpdates(_0x465147['body'],null))[_0x6e9b('0x3f')](respondWithResult(_0x21d30c,null))['catch'](handleError(_0x21d30c,null));};exports['destroy']=function(_0x230d9d,_0x49d875){return db[_0x6e9b('0x2b')]['find']({'where':{'id':_0x230d9d['params']['id']}})['then'](handleEntityNotFound(_0x49d875,null))[_0x6e9b('0x3f')](removeEntity(_0x49d875,null))[_0x6e9b('0x43')](handleError(_0x49d875,null));};exports[_0x6e9b('0x4a')]=function(_0x243491,_0x37e89b,_0x198bdd){var _0x5f5cce={};var _0xffb54e={};var _0x188136;var _0x159b59;return db[_0x6e9b('0x2b')][_0x6e9b('0x4b')]({'where':{'id':_0x243491[_0x6e9b('0x49')]['id']}})[_0x6e9b('0x3f')](handleEntityNotFound(_0x37e89b,null))[_0x6e9b('0x3f')](function(_0x2fbb08){if(_0x2fbb08){_0x188136=_0x2fbb08;_0xffb54e['model']=_[_0x6e9b('0x45')](db['DeskField'][_0x6e9b('0x2c')]);_0xffb54e[_0x6e9b('0x30')]=_['keys'](_0x243491[_0x6e9b('0x30')]);_0xffb54e[_0x6e9b('0x31')]=_['intersection'](_0xffb54e[_0x6e9b('0x2f')],_0xffb54e[_0x6e9b('0x30')]);_0x5f5cce[_0x6e9b('0x32')]=_[_0x6e9b('0x33')](_0xffb54e[_0x6e9b('0x2f')],qs[_0x6e9b('0x34')](_0x243491['query'][_0x6e9b('0x34')]));_0x5f5cce[_0x6e9b('0x32')]=_0x5f5cce[_0x6e9b('0x32')][_0x6e9b('0x4c')]?_0x5f5cce[_0x6e9b('0x32')]:_0xffb54e[_0x6e9b('0x2f')];_0x5f5cce['order']=qs[_0x6e9b('0x38')](_0x243491['query']['sort']);_0x5f5cce[_0x6e9b('0x3b')]=qs[_0x6e9b('0x31')](_[_0x6e9b('0x39')](_0x243491['query'],_0xffb54e[_0x6e9b('0x31')]));if(_0x243491[_0x6e9b('0x30')][_0x6e9b('0x3a')]){_0x5f5cce['where']=_[_0x6e9b('0x3d')](_0x5f5cce[_0x6e9b('0x3b')],{'$or':_[_0x6e9b('0x2a')](_0x5f5cce[_0x6e9b('0x32')],function(_0x2a8f58){var _0x201039={};_0x201039[_0x2a8f58]={'$like':'%'+_0x243491[_0x6e9b('0x30')][_0x6e9b('0x3a')]+'%'};return _0x201039;})});}_0x5f5cce=_[_0x6e9b('0x3d')]({},_0x5f5cce,_0x243491[_0x6e9b('0x3e')]);return _0x188136[_0x6e9b('0x4a')](_0x5f5cce);}})['then'](function(_0x1922c2){if(_0x1922c2){_0x159b59=_0x1922c2[_0x6e9b('0x4c')];if(!_0x243491['query'][_0x6e9b('0x35')](_0x6e9b('0x36'))){_0x5f5cce[_0x6e9b('0x20')]=qs[_0x6e9b('0x20')](_0x243491[_0x6e9b('0x30')][_0x6e9b('0x20')]);_0x5f5cce[_0x6e9b('0x1e')]=qs['offset'](_0x243491[_0x6e9b('0x30')][_0x6e9b('0x1e')]);}return _0x188136[_0x6e9b('0x4a')](_0x5f5cce);}})[_0x6e9b('0x3f')](function(_0x55f9fd){if(_0x55f9fd){return _0x55f9fd?{'count':_0x159b59,'rows':_0x55f9fd}:null;}})[_0x6e9b('0x3f')](respondWithResult(_0x37e89b,null))[_0x6e9b('0x43')](handleError(_0x37e89b,null));};exports['getSubjects']=function(_0x1142f2,_0x3e2d96,_0x125100){var _0x2e951a={};var _0xa0582={};var _0x3bd2e2;var _0x4f26d1;return db[_0x6e9b('0x2b')][_0x6e9b('0x4b')]({'where':{'id':_0x1142f2[_0x6e9b('0x49')]['id']}})[_0x6e9b('0x3f')](handleEntityNotFound(_0x3e2d96,null))[_0x6e9b('0x3f')](function(_0xa14c65){if(_0xa14c65){_0x3bd2e2=_0xa14c65;_0xa0582[_0x6e9b('0x2f')]=_[_0x6e9b('0x45')](db[_0x6e9b('0x4d')][_0x6e9b('0x2c')]);_0xa0582[_0x6e9b('0x30')]=_[_0x6e9b('0x45')](_0x1142f2[_0x6e9b('0x30')]);_0xa0582[_0x6e9b('0x31')]=_[_0x6e9b('0x33')](_0xa0582[_0x6e9b('0x2f')],_0xa0582[_0x6e9b('0x30')]);_0x2e951a[_0x6e9b('0x32')]=_[_0x6e9b('0x33')](_0xa0582[_0x6e9b('0x2f')],qs['fields'](_0x1142f2[_0x6e9b('0x30')][_0x6e9b('0x34')]));_0x2e951a['attributes']=_0x2e951a[_0x6e9b('0x32')][_0x6e9b('0x4c')]?_0x2e951a['attributes']:_0xa0582[_0x6e9b('0x2f')];_0x2e951a[_0x6e9b('0x37')]=qs[_0x6e9b('0x38')](_0x1142f2[_0x6e9b('0x30')][_0x6e9b('0x38')]);_0x2e951a['where']=qs['filters'](_[_0x6e9b('0x39')](_0x1142f2[_0x6e9b('0x30')],_0xa0582[_0x6e9b('0x31')]));if(_0x1142f2[_0x6e9b('0x30')][_0x6e9b('0x3a')]){_0x2e951a[_0x6e9b('0x3b')]=_['merge'](_0x2e951a[_0x6e9b('0x3b')],{'$or':_[_0x6e9b('0x2a')](_0x2e951a[_0x6e9b('0x32')],function(_0x4b8f1a){var _0x1544d6={};_0x1544d6[_0x4b8f1a]={'$like':'%'+_0x1142f2[_0x6e9b('0x30')][_0x6e9b('0x3a')]+'%'};return _0x1544d6;})});}_0x2e951a=_[_0x6e9b('0x3d')]({},_0x2e951a,_0x1142f2['options']);return _0x3bd2e2[_0x6e9b('0x4e')](_0x2e951a);}})[_0x6e9b('0x3f')](function(_0x406a64){if(_0x406a64){_0x4f26d1=_0x406a64[_0x6e9b('0x4c')];if(!_0x1142f2[_0x6e9b('0x30')][_0x6e9b('0x35')](_0x6e9b('0x36'))){_0x2e951a[_0x6e9b('0x20')]=qs['limit'](_0x1142f2[_0x6e9b('0x30')]['limit']);_0x2e951a['offset']=qs['offset'](_0x1142f2[_0x6e9b('0x30')][_0x6e9b('0x1e')]);}return _0x3bd2e2[_0x6e9b('0x4e')](_0x2e951a);}})['then'](function(_0x547197){if(_0x547197){return _0x547197?{'count':_0x4f26d1,'rows':_0x547197}:null;}})[_0x6e9b('0x3f')](respondWithResult(_0x3e2d96,null))['catch'](handleError(_0x3e2d96,null));};exports[_0x6e9b('0x4f')]=function(_0x5496eb,_0x147c19,_0xbdb44c){var _0x1284a9={};var _0x1f44b4={};var _0x1e9bab;var _0x517784;return db[_0x6e9b('0x2b')]['findOne']({'where':{'id':_0x5496eb['params']['id']}})['then'](handleEntityNotFound(_0x147c19,null))[_0x6e9b('0x3f')](function(_0x8385a3){if(_0x8385a3){_0x1e9bab=_0x8385a3;_0x1f44b4[_0x6e9b('0x2f')]=_[_0x6e9b('0x45')](db[_0x6e9b('0x4d')][_0x6e9b('0x2c')]);_0x1f44b4[_0x6e9b('0x30')]=_[_0x6e9b('0x45')](_0x5496eb[_0x6e9b('0x30')]);_0x1f44b4['filters']=_[_0x6e9b('0x33')](_0x1f44b4[_0x6e9b('0x2f')],_0x1f44b4[_0x6e9b('0x30')]);_0x1284a9[_0x6e9b('0x32')]=_[_0x6e9b('0x33')](_0x1f44b4['model'],qs[_0x6e9b('0x34')](_0x5496eb[_0x6e9b('0x30')][_0x6e9b('0x34')]));_0x1284a9[_0x6e9b('0x32')]=_0x1284a9[_0x6e9b('0x32')][_0x6e9b('0x4c')]?_0x1284a9['attributes']:_0x1f44b4['model'];_0x1284a9[_0x6e9b('0x37')]=qs[_0x6e9b('0x38')](_0x5496eb[_0x6e9b('0x30')][_0x6e9b('0x38')]);_0x1284a9['where']=qs[_0x6e9b('0x31')](_['pick'](_0x5496eb[_0x6e9b('0x30')],_0x1f44b4[_0x6e9b('0x31')]));if(_0x5496eb['query'][_0x6e9b('0x3a')]){_0x1284a9[_0x6e9b('0x3b')]=_[_0x6e9b('0x3d')](_0x1284a9[_0x6e9b('0x3b')],{'$or':_[_0x6e9b('0x2a')](_0x1284a9[_0x6e9b('0x32')],function(_0x425153){var _0x292e43={};_0x292e43[_0x425153]={'$like':'%'+_0x5496eb[_0x6e9b('0x30')]['filter']+'%'};return _0x292e43;})});}_0x1284a9=_[_0x6e9b('0x3d')]({},_0x1284a9,_0x5496eb['options']);return _0x1e9bab['getDescriptions'](_0x1284a9);}})[_0x6e9b('0x3f')](function(_0x19b853){if(_0x19b853){_0x517784=_0x19b853[_0x6e9b('0x4c')];if(!_0x5496eb[_0x6e9b('0x30')][_0x6e9b('0x35')](_0x6e9b('0x36'))){_0x1284a9['limit']=qs[_0x6e9b('0x20')](_0x5496eb[_0x6e9b('0x30')][_0x6e9b('0x20')]);_0x1284a9[_0x6e9b('0x1e')]=qs['offset'](_0x5496eb['query'][_0x6e9b('0x1e')]);}return _0x1e9bab[_0x6e9b('0x4f')](_0x1284a9);}})[_0x6e9b('0x3f')](function(_0x39b73d){if(_0x39b73d){return _0x39b73d?{'count':_0x517784,'rows':_0x39b73d}:null;}})['then'](respondWithResult(_0x147c19,null))[_0x6e9b('0x43')](handleError(_0x147c19,null));};exports[_0x6e9b('0x50')]=function(_0x5a5ec8,_0x5e53f9,_0x18dfcf){var _0x12fe83={};var _0x2a1050={};var _0x351681;var _0x87ea48;return db[_0x6e9b('0x2b')][_0x6e9b('0x4b')]({'where':{'id':_0x5a5ec8['params']['id']}})['then'](handleEntityNotFound(_0x5e53f9,null))[_0x6e9b('0x3f')](function(_0x225573){if(_0x225573){_0x351681=_0x225573;_0x2a1050['model']=_[_0x6e9b('0x45')](db['Tag'][_0x6e9b('0x2c')]);_0x2a1050[_0x6e9b('0x30')]=_[_0x6e9b('0x45')](_0x5a5ec8[_0x6e9b('0x30')]);_0x2a1050[_0x6e9b('0x31')]=_[_0x6e9b('0x33')](_0x2a1050['model'],_0x2a1050[_0x6e9b('0x30')]);_0x12fe83[_0x6e9b('0x32')]=_[_0x6e9b('0x33')](_0x2a1050['model'],qs['fields'](_0x5a5ec8[_0x6e9b('0x30')]['fields']));_0x12fe83['attributes']=_0x12fe83['attributes'][_0x6e9b('0x4c')]?_0x12fe83[_0x6e9b('0x32')]:_0x2a1050['model'];_0x12fe83[_0x6e9b('0x37')]=qs['sort'](_0x5a5ec8[_0x6e9b('0x30')]['sort']);_0x12fe83[_0x6e9b('0x3b')]=qs['filters'](_['pick'](_0x5a5ec8[_0x6e9b('0x30')],_0x2a1050[_0x6e9b('0x31')]));if(_0x5a5ec8[_0x6e9b('0x30')]['filter']){_0x12fe83[_0x6e9b('0x3b')]=_[_0x6e9b('0x3d')](_0x12fe83[_0x6e9b('0x3b')],{'$or':_[_0x6e9b('0x2a')](_0x12fe83[_0x6e9b('0x32')],function(_0x327664){var _0x1e47e3={};_0x1e47e3[_0x327664]={'$like':'%'+_0x5a5ec8[_0x6e9b('0x30')]['filter']+'%'};return _0x1e47e3;})});}_0x12fe83=_['merge']({},_0x12fe83,_0x5a5ec8[_0x6e9b('0x3e')]);return _0x351681[_0x6e9b('0x50')](_0x12fe83);}})[_0x6e9b('0x3f')](function(_0x1a0624){if(_0x1a0624){_0x87ea48=_0x1a0624[_0x6e9b('0x4c')];if(!_0x5a5ec8[_0x6e9b('0x30')][_0x6e9b('0x35')](_0x6e9b('0x36'))){_0x12fe83[_0x6e9b('0x20')]=qs['limit'](_0x5a5ec8[_0x6e9b('0x30')][_0x6e9b('0x20')]);_0x12fe83[_0x6e9b('0x1e')]=qs[_0x6e9b('0x1e')](_0x5a5ec8[_0x6e9b('0x30')]['offset']);}return _0x351681[_0x6e9b('0x50')](_0x12fe83);}})[_0x6e9b('0x3f')](function(_0x1ab8fc){if(_0x1ab8fc){return _0x1ab8fc?{'count':_0x87ea48,'rows':_0x1ab8fc}:null;}})[_0x6e9b('0x3f')](respondWithResult(_0x5e53f9,null))[_0x6e9b('0x43')](handleError(_0x5e53f9,null));};exports['setTags']=function(_0x8f31dc,_0x3eb9fd,_0x45da39){if(_0x8f31dc['body']['id']){delete _0x8f31dc[_0x6e9b('0x47')]['id'];}return db['DeskConfiguration'][_0x6e9b('0x4b')]({'where':{'id':_0x8f31dc['params']['id']}})['then'](handleEntityNotFound(_0x3eb9fd,null))['then'](function(_0x2f8f9e){if(_0x2f8f9e){return _0x2f8f9e[_0x6e9b('0x51')](_0x8f31dc['body'][_0x6e9b('0x52')]||[]);}return null;})[_0x6e9b('0x3f')](respondWithResult(_0x3eb9fd,null))[_0x6e9b('0x43')](handleError(_0x3eb9fd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index fc32eeb..71e56e4 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 _0xaf73=['bluebird','path','rimraf','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x1eebe4,_0x27f7b4){var _0x46f639=function(_0x520de8){while(--_0x520de8){_0x1eebe4['push'](_0x1eebe4['shift']());}};_0x46f639(++_0x27f7b4);}(_0xaf73,0x188));var _0x3af7=function(_0x390d43,_0xb9dacb){_0x390d43=_0x390d43-0x0;var _0xe62708=_0xaf73[_0x390d43];return _0xe62708;};'use strict';var _=require(_0x3af7('0x0'));var util=require(_0x3af7('0x1'));var logger=require(_0x3af7('0x2'))('api');var moment=require(_0x3af7('0x3'));var BPromise=require(_0x3af7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3af7('0x5'));var rimraf=require(_0x3af7('0x6'));var config=require('../../config/environment');var attributes=require(_0x3af7('0x7'));module[_0x3af7('0x8')]=function(_0x3fb51d,_0x327c94){return _0x3fb51d[_0x3af7('0x9')]('DeskConfiguration',attributes,{'tableName':_0x3af7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5447=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration'];(function(_0x236158,_0x49c1e3){var _0x42edf1=function(_0x5ea244){while(--_0x5ea244){_0x236158['push'](_0x236158['shift']());}};_0x42edf1(++_0x49c1e3);}(_0x5447,0x1a7));var _0x7544=function(_0x30b34f,_0x41a200){_0x30b34f=_0x30b34f-0x0;var _0x1908c1=_0x5447[_0x30b34f];return _0x1908c1;};'use strict';var _=require(_0x7544('0x0'));var util=require(_0x7544('0x1'));var logger=require(_0x7544('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7544('0x3'));var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module['exports']=function(_0x1efed6,_0x5dbdeb){return _0x1efed6['define'](_0x7544('0x8'),attributes,{'tableName':'int_desk_configurations','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 2355617..0b82e84 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 _0xa468=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x9eb826,_0x554cf7){var _0x515352=function(_0x5f5463){while(--_0x5f5463){_0x9eb826['push'](_0x9eb826['shift']());}};_0x515352(++_0x554cf7);}(_0xa468,0x1b1));var _0x8a46=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa468[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x8a46('0x0'));var util=require(_0x8a46('0x1'));var moment=require(_0x8a46('0x2'));var BPromise=require(_0x8a46('0x3'));var rs=require(_0x8a46('0x4'));var fs=require('fs');var Redis=require(_0x8a46('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a46('0x6'))(_0x8a46('0x7'));var config=require(_0x8a46('0x8'));var jayson=require(_0x8a46('0x9'));var client=jayson[_0x8a46('0xa')][_0x8a46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4436f1,_0x4c47ff,_0x54b9ef){return new BPromise(function(_0x206dce,_0x3303aa){return client['request'](_0x4436f1,_0x54b9ef)[_0x8a46('0xc')](function(_0x1bd083){logger[_0x8a46('0xd')](_0x8a46('0xe'),_0x4c47ff,_0x8a46('0xf'));logger[_0x8a46('0x10')](_0x8a46('0x11'),_0x4c47ff,_0x8a46('0xf'),JSON[_0x8a46('0x12')](_0x1bd083));if(_0x1bd083[_0x8a46('0x13')]){if(_0x1bd083[_0x8a46('0x13')][_0x8a46('0x14')]===0x1f4){logger['error'](_0x8a46('0xe'),_0x4c47ff,_0x1bd083[_0x8a46('0x13')][_0x8a46('0x15')]);return _0x3303aa(_0x1bd083['error']['message']);}logger['error'](_0x8a46('0xe'),_0x4c47ff,_0x1bd083[_0x8a46('0x13')][_0x8a46('0x15')]);return _0x206dce(_0x1bd083[_0x8a46('0x13')]['message']);}else{logger[_0x8a46('0xd')](_0x8a46('0xe'),_0x4c47ff,'request\x20sent');_0x206dce(_0x1bd083[_0x8a46('0x16')][_0x8a46('0x15')]);}})[_0x8a46('0x17')](function(_0x16b1fe){logger[_0x8a46('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4c47ff,_0x16b1fe);_0x3303aa(_0x16b1fe);});});} \ No newline at end of file +var _0x565e=['stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x48dc10,_0x579339){var _0x20b9fc=function(_0x3278fc){while(--_0x3278fc){_0x48dc10['push'](_0x48dc10['shift']());}};_0x20b9fc(++_0x579339);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a9d48,_0x470daf,_0x359a05){return new BPromise(function(_0x1204c8,_0x14f3df){return client[_0xe565('0xb')](_0x1a9d48,_0x359a05)[_0xe565('0xc')](function(_0x1d3d48){logger[_0xe565('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x470daf,_0xe565('0xe'));logger[_0xe565('0xf')](_0xe565('0x10'),_0x470daf,'request\x20sent',JSON[_0xe565('0x11')](_0x1d3d48));if(_0x1d3d48[_0xe565('0x12')]){if(_0x1d3d48[_0xe565('0x12')][_0xe565('0x13')]===0x1f4){logger['error'](_0xe565('0x14'),_0x470daf,_0x1d3d48['error'][_0xe565('0x15')]);return _0x14f3df(_0x1d3d48['error'][_0xe565('0x15')]);}logger[_0xe565('0x12')](_0xe565('0x14'),_0x470daf,_0x1d3d48['error'][_0xe565('0x15')]);return _0x1204c8(_0x1d3d48[_0xe565('0x12')][_0xe565('0x15')]);}else{logger[_0xe565('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x470daf,_0xe565('0xe'));_0x1204c8(_0x1d3d48[_0xe565('0x16')][_0xe565('0x15')]);}})[_0xe565('0x17')](function(_0x3899de){logger[_0xe565('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x470daf,_0x3899de);_0x14f3df(_0x3899de);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9a7691a..1c30f1e 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 _0x1312=['util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x246d6c,_0x3e7be3){var _0x41922f=function(_0xff98b1){while(--_0xff98b1){_0x246d6c['push'](_0x246d6c['shift']());}};_0x41922f(++_0x3e7be3);}(_0x1312,0x167));var _0x2131=function(_0x26dd96,_0x1e70a6){_0x26dd96=_0x26dd96-0x0;var _0x1aa18f=_0x1312[_0x26dd96];return _0x1aa18f;};'use strict';var multer=require(_0x2131('0x0'));var util=require(_0x2131('0x1'));var path=require(_0x2131('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2131('0x3')]();var fs_extra=require(_0x2131('0x4'));var auth=require(_0x2131('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2131('0x6'));var controller=require(_0x2131('0x7'));router[_0x2131('0x8')]('/',auth[_0x2131('0x9')](),controller['index']);router[_0x2131('0x8')](_0x2131('0xa'),auth[_0x2131('0x9')](),controller[_0x2131('0xb')]);router[_0x2131('0xc')]('/',auth[_0x2131('0x9')](),controller[_0x2131('0xd')]);router[_0x2131('0xe')](_0x2131('0xa'),auth[_0x2131('0x9')](),controller['update']);router[_0x2131('0xf')](_0x2131('0xa'),auth['isAuthenticated'](),controller[_0x2131('0x10')]);module[_0x2131('0x11')]=router; \ No newline at end of file +var _0x4189=['./intDeskField.controller','get','index','/:id','show','post','put','isAuthenticated','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2beac2,_0x2648cd){var _0xb2f9d6=function(_0x5d4326){while(--_0x5d4326){_0x2beac2['push'](_0x2beac2['shift']());}};_0xb2f9d6(++_0x2648cd);}(_0x4189,0x13c));var _0x9418=function(_0x2adfae,_0x2821af){_0x2adfae=_0x2adfae-0x0;var _0x28cc0=_0x4189[_0x2adfae];return _0x28cc0;};'use strict';var multer=require(_0x9418('0x0'));var util=require('util');var path=require(_0x9418('0x1'));var timeout=require(_0x9418('0x2'));var express=require(_0x9418('0x3'));var router=express[_0x9418('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9418('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9418('0x6'));var controller=require(_0x9418('0x7'));router[_0x9418('0x8')]('/',auth['isAuthenticated'](),controller[_0x9418('0x9')]);router['get'](_0x9418('0xa'),auth['isAuthenticated'](),controller[_0x9418('0xb')]);router[_0x9418('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9418('0xd')](_0x9418('0xa'),auth[_0x9418('0xe')](),controller[_0x9418('0xf')]);router['delete'](_0x9418('0xa'),auth[_0x9418('0xe')](),controller[_0x9418('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 078ea25..d54e659 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 _0xa167=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x50637c,_0x7b940c){var _0x4d3884=function(_0x4f71c9){while(--_0x4f71c9){_0x50637c['push'](_0x50637c['shift']());}};_0x4d3884(++_0x7b940c);}(_0xa167,0x188));var _0x7a16=function(_0xe15c68,_0x3bad75){_0xe15c68=_0xe15c68-0x0;var _0x1c4b58=_0xa167[_0xe15c68];return _0x1c4b58;};'use strict';var Sequelize=require(_0x7a16('0x0'));module[_0x7a16('0x1')]={'type':{'type':Sequelize[_0x7a16('0x2')](_0x7a16('0x3'),'variable',_0x7a16('0x4'),_0x7a16('0x5'),'picklist'),'defaultValue':_0x7a16('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7a16('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7a16('0x3'),_0x7a16('0x7'),_0x7a16('0x4'))},'keyContent':{'type':Sequelize[_0x7a16('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7a16('0x6')]},'customField':{'type':Sequelize[_0x7a16('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a16('0x6')]}}; \ No newline at end of file +var _0x91b5=['keyValue','picklist','string','STRING','customVariable','sequelize','variable'];(function(_0x15d913,_0x51cf7a){var _0x4ae65e=function(_0x2f39a1){while(--_0x2f39a1){_0x15d913['push'](_0x15d913['shift']());}};_0x4ae65e(++_0x51cf7a);}(_0x91b5,0x9f));var _0x591b=function(_0x625ffc,_0x440989){_0x625ffc=_0x625ffc-0x0;var _0x478a47=_0x91b5[_0x625ffc];return _0x478a47;};'use strict';var Sequelize=require(_0x591b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x591b('0x1'),'customVariable',_0x591b('0x2'),_0x591b('0x3')),'defaultValue':_0x591b('0x4')},'content':{'type':Sequelize[_0x591b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x591b('0x4'),_0x591b('0x1'),_0x591b('0x6'))},'keyContent':{'type':Sequelize[_0x591b('0x5')]},'idField':{'type':Sequelize[_0x591b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x591b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index e7fd95e..59fa6b4 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 _0x0628=['update','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','then','end','error','stack','name','map','DeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','length','options','find','catch','body'];(function(_0x19470d,_0x598e59){var _0x50d0d9=function(_0x5aa88e){while(--_0x5aa88e){_0x19470d['push'](_0x19470d['shift']());}};_0x50d0d9(++_0x598e59);}(_0x0628,0x15c));var _0x8062=function(_0x268b6c,_0x1e332d){_0x268b6c=_0x268b6c-0x0;var _0x1257f1=_0x0628[_0x268b6c];return _0x1257f1;};'use strict';var emlformat=require(_0x8062('0x0'));var rimraf=require(_0x8062('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8062('0x2'));var rp=require(_0x8062('0x3'));var moment=require(_0x8062('0x4'));var BPromise=require(_0x8062('0x5'));var Mustache=require(_0x8062('0x6'));var util=require('util');var path=require(_0x8062('0x7'));var sox=require('sox');var csv=require(_0x8062('0x8'));var ejs=require(_0x8062('0x9'));var fs=require('fs');var fs_extra=require(_0x8062('0xa'));var _=require(_0x8062('0xb'));var squel=require('squel');var crypto=require(_0x8062('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8062('0xd'));var toCsv=require(_0x8062('0x8'));var querystring=require(_0x8062('0xe'));var Papa=require(_0x8062('0xf'));var Redis=require(_0x8062('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8062('0x11'));var as=require(_0x8062('0x12'));var hardwareService=require(_0x8062('0x13'));var logger=require('../../config/logger')(_0x8062('0x14'));var utils=require(_0x8062('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8062('0x16'));var db=require(_0x8062('0x17'))['db'];function respondWithStatusCode(_0x5435b5,_0x5467b1){_0x5467b1=_0x5467b1||0xcc;return function(_0x3c7d29){if(_0x3c7d29){return _0x5435b5[_0x8062('0x18')](_0x5467b1);}return _0x5435b5[_0x8062('0x19')](_0x5467b1)['end']();};}function respondWithResult(_0x210dba,_0x453001){_0x453001=_0x453001||0xc8;return function(_0x147e24){if(_0x147e24){return _0x210dba[_0x8062('0x19')](_0x453001)[_0x8062('0x1a')](_0x147e24);}};}function respondWithFilteredResult(_0x5e8d19,_0x159c98){return function(_0x350b3f){if(_0x350b3f){var _0x12bc58=typeof _0x159c98[_0x8062('0x1b')]===_0x8062('0x1c')&&typeof _0x159c98[_0x8062('0x1d')]===_0x8062('0x1c');var _0x287b90=_0x350b3f[_0x8062('0x1e')];var _0x1f2006=_0x12bc58?0x0:_0x159c98[_0x8062('0x1b')];var _0x5dd6bb=_0x12bc58?_0x350b3f['count']:_0x159c98[_0x8062('0x1b')]+_0x159c98[_0x8062('0x1d')];var _0x31f3f8;if(_0x5dd6bb>=_0x287b90){_0x5dd6bb=_0x287b90;_0x31f3f8=0xc8;}else{_0x31f3f8=0xce;}_0x5e8d19[_0x8062('0x19')](_0x31f3f8);return _0x5e8d19['set'](_0x8062('0x1f'),_0x1f2006+'-'+_0x5dd6bb+'/'+_0x287b90)[_0x8062('0x1a')](_0x350b3f);}return null;};}function patchUpdates(_0xf7ab45){return function(_0x49e600){try{jsonpatch[_0x8062('0x20')](_0x49e600,_0xf7ab45,!![]);}catch(_0x1680a2){return BPromise['reject'](_0x1680a2);}return _0x49e600['save']();};}function saveUpdates(_0x90738,_0xecb97d){return function(_0x148dda){if(_0x148dda){return _0x148dda['update'](_0x90738)[_0x8062('0x21')](function(_0xe8b135){return _0xe8b135;});}return null;};}function removeEntity(_0x55f118,_0x2893fb){return function(_0xd7feb3){if(_0xd7feb3){return _0xd7feb3['destroy']()[_0x8062('0x21')](function(){_0x55f118[_0x8062('0x19')](0xcc)[_0x8062('0x22')]();});}};}function handleEntityNotFound(_0x48f714,_0x2ca7b6){return function(_0x58e0a0){if(!_0x58e0a0){_0x48f714[_0x8062('0x18')](0x194);}return _0x58e0a0;};}function handleError(_0x534d00,_0x2ac4be){_0x2ac4be=_0x2ac4be||0x1f4;return function(_0x46a178){logger[_0x8062('0x23')](_0x46a178[_0x8062('0x24')]);if(_0x46a178[_0x8062('0x25')]){delete _0x46a178[_0x8062('0x25')];}_0x534d00['status'](_0x2ac4be)['send'](_0x46a178);};}exports['index']=function(_0x18e19a,_0x10dff4){var _0x17fea1={},_0x115616={},_0x50ea45={'count':0x0,'rows':[]};var _0x40286d=_[_0x8062('0x26')](db[_0x8062('0x27')][_0x8062('0x28')],function(_0x3d4827){return{'name':_0x3d4827[_0x8062('0x29')],'type':_0x3d4827[_0x8062('0x2a')]['key']};});_0x115616['model']=_[_0x8062('0x26')](_0x40286d,_0x8062('0x25'));_0x115616[_0x8062('0x2b')]=_[_0x8062('0x2c')](_0x18e19a[_0x8062('0x2b')]);_0x115616[_0x8062('0x2d')]=_[_0x8062('0x2e')](_0x115616['model'],_0x115616['query']);_0x17fea1['attributes']=_[_0x8062('0x2e')](_0x115616[_0x8062('0x2f')],qs[_0x8062('0x30')](_0x18e19a[_0x8062('0x2b')][_0x8062('0x30')]));_0x17fea1[_0x8062('0x31')]=_0x17fea1[_0x8062('0x31')]['length']?_0x17fea1['attributes']:_0x115616['model'];if(!_0x18e19a[_0x8062('0x2b')]['hasOwnProperty'](_0x8062('0x32'))){_0x17fea1['limit']=qs[_0x8062('0x1d')](_0x18e19a[_0x8062('0x2b')][_0x8062('0x1d')]);_0x17fea1[_0x8062('0x1b')]=qs['offset'](_0x18e19a[_0x8062('0x2b')][_0x8062('0x1b')]);}_0x17fea1['order']=qs[_0x8062('0x33')](_0x18e19a[_0x8062('0x2b')][_0x8062('0x33')]);_0x17fea1[_0x8062('0x34')]=qs[_0x8062('0x2d')](_['pick'](_0x18e19a['query'],_0x115616[_0x8062('0x2d')]),_0x40286d);if(_0x18e19a['query']['filter']){_0x17fea1[_0x8062('0x34')]=_[_0x8062('0x35')](_0x17fea1[_0x8062('0x34')],{'$or':_[_0x8062('0x26')](_0x40286d,function(_0x422119){if(_0x422119[_0x8062('0x2a')]!==_0x8062('0x36')){var _0x320659={};_0x320659[_0x422119[_0x8062('0x25')]]={'$like':'%'+_0x18e19a['query'][_0x8062('0x37')]+'%'};return _0x320659;}})});}_0x17fea1=_['merge']({},_0x17fea1,_0x18e19a['options']);var _0x5c1297={'where':_0x17fea1[_0x8062('0x34')]};return db['DeskField'][_0x8062('0x1e')](_0x5c1297)[_0x8062('0x21')](function(_0x220131){_0x50ea45[_0x8062('0x1e')]=_0x220131;if(_0x18e19a[_0x8062('0x2b')][_0x8062('0x38')]){_0x17fea1[_0x8062('0x39')]=[{'all':!![]}];}return db[_0x8062('0x27')][_0x8062('0x3a')](_0x17fea1);})[_0x8062('0x21')](function(_0x215bfc){_0x50ea45[_0x8062('0x3b')]=_0x215bfc;return _0x50ea45;})[_0x8062('0x21')](respondWithFilteredResult(_0x10dff4,_0x17fea1))['catch'](handleError(_0x10dff4,null));};exports[_0x8062('0x3c')]=function(_0x1131e6,_0x4b40ac){var _0xf6c66e={'raw':!![],'where':{'id':_0x1131e6['params']['id']}},_0x50e3db={};_0x50e3db[_0x8062('0x2f')]=_[_0x8062('0x2c')](db[_0x8062('0x27')][_0x8062('0x28')]);_0x50e3db[_0x8062('0x2b')]=_[_0x8062('0x2c')](_0x1131e6['query']);_0x50e3db[_0x8062('0x2d')]=_['intersection'](_0x50e3db[_0x8062('0x2f')],_0x50e3db[_0x8062('0x2b')]);_0xf6c66e[_0x8062('0x31')]=_[_0x8062('0x2e')](_0x50e3db[_0x8062('0x2f')],qs['fields'](_0x1131e6['query'][_0x8062('0x30')]));_0xf6c66e[_0x8062('0x31')]=_0xf6c66e[_0x8062('0x31')][_0x8062('0x3d')]?_0xf6c66e[_0x8062('0x31')]:_0x50e3db[_0x8062('0x2f')];if(_0x1131e6[_0x8062('0x2b')][_0x8062('0x38')]){_0xf6c66e[_0x8062('0x39')]=[{'all':!![]}];}_0xf6c66e=_[_0x8062('0x35')]({},_0xf6c66e,_0x1131e6[_0x8062('0x3e')]);return db[_0x8062('0x27')][_0x8062('0x3f')](_0xf6c66e)[_0x8062('0x21')](handleEntityNotFound(_0x4b40ac,null))[_0x8062('0x21')](respondWithResult(_0x4b40ac,null))[_0x8062('0x40')](handleError(_0x4b40ac,null));};exports['create']=function(_0x59d14e,_0x137fa7){return db[_0x8062('0x27')]['create'](_0x59d14e[_0x8062('0x41')],{})['then'](respondWithResult(_0x137fa7,0xc9))['catch'](handleError(_0x137fa7,null));};exports[_0x8062('0x42')]=function(_0x5edea6,_0xbb4f8f){if(_0x5edea6[_0x8062('0x41')]['id']){delete _0x5edea6[_0x8062('0x41')]['id'];}return db[_0x8062('0x27')]['find']({'where':{'id':_0x5edea6[_0x8062('0x43')]['id']}})[_0x8062('0x21')](handleEntityNotFound(_0xbb4f8f,null))[_0x8062('0x21')](saveUpdates(_0x5edea6['body'],null))[_0x8062('0x21')](respondWithResult(_0xbb4f8f,null))[_0x8062('0x40')](handleError(_0xbb4f8f,null));};exports[_0x8062('0x44')]=function(_0x296105,_0x42ed11){return db[_0x8062('0x27')][_0x8062('0x3f')]({'where':{'id':_0x296105[_0x8062('0x43')]['id']}})[_0x8062('0x21')](handleEntityNotFound(_0x42ed11,null))[_0x8062('0x21')](removeEntity(_0x42ed11,null))[_0x8062('0x40')](handleError(_0x42ed11,null));}; \ No newline at end of file +var _0xc9b0=['rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','map','DeskField','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','type','VIRTUAL','options','then','includeAll','include','findAll'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc9b0,0x143));var _0x0c9b=function(_0x132331,_0x3ec2bf){_0x132331=_0x132331-0x0;var _0x7ade37=_0xc9b0[_0x132331];return _0x7ade37;};'use strict';var emlformat=require(_0x0c9b('0x0'));var rimraf=require(_0x0c9b('0x1'));var zipdir=require(_0x0c9b('0x2'));var jsonpatch=require(_0x0c9b('0x3'));var rp=require(_0x0c9b('0x4'));var moment=require(_0x0c9b('0x5'));var BPromise=require(_0x0c9b('0x6'));var Mustache=require(_0x0c9b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0c9b('0x8'));var csv=require(_0x0c9b('0x9'));var ejs=require(_0x0c9b('0xa'));var fs=require('fs');var fs_extra=require(_0x0c9b('0xb'));var _=require(_0x0c9b('0xc'));var squel=require(_0x0c9b('0xd'));var crypto=require(_0x0c9b('0xe'));var jsforce=require(_0x0c9b('0xf'));var deskjs=require(_0x0c9b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0c9b('0x11'));var authService=require(_0x0c9b('0x12'));var qs=require(_0x0c9b('0x13'));var as=require(_0x0c9b('0x14'));var hardwareService=require(_0x0c9b('0x15'));var logger=require(_0x0c9b('0x16'))('api');var utils=require(_0x0c9b('0x17'));var config=require(_0x0c9b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c9b('0x19'))['db'];function respondWithStatusCode(_0x4acc77,_0x273644){_0x273644=_0x273644||0xcc;return function(_0xe55deb){if(_0xe55deb){return _0x4acc77[_0x0c9b('0x1a')](_0x273644);}return _0x4acc77[_0x0c9b('0x1b')](_0x273644)[_0x0c9b('0x1c')]();};}function respondWithResult(_0x2bc058,_0x291aeb){_0x291aeb=_0x291aeb||0xc8;return function(_0x41603d){if(_0x41603d){return _0x2bc058[_0x0c9b('0x1b')](_0x291aeb)[_0x0c9b('0x1d')](_0x41603d);}};}function respondWithFilteredResult(_0x4daf5e,_0x5967a6){return function(_0x518486){if(_0x518486){var _0x3ac356=typeof _0x5967a6[_0x0c9b('0x1e')]==='undefined'&&typeof _0x5967a6[_0x0c9b('0x1f')]===_0x0c9b('0x20');var _0x3279cd=_0x518486[_0x0c9b('0x21')];var _0x2b2f65=_0x3ac356?0x0:_0x5967a6[_0x0c9b('0x1e')];var _0x39218d=_0x3ac356?_0x518486['count']:_0x5967a6['offset']+_0x5967a6[_0x0c9b('0x1f')];var _0x49d499;if(_0x39218d>=_0x3279cd){_0x39218d=_0x3279cd;_0x49d499=0xc8;}else{_0x49d499=0xce;}_0x4daf5e[_0x0c9b('0x1b')](_0x49d499);return _0x4daf5e[_0x0c9b('0x22')](_0x0c9b('0x23'),_0x2b2f65+'-'+_0x39218d+'/'+_0x3279cd)[_0x0c9b('0x1d')](_0x518486);}return null;};}function patchUpdates(_0x1bf9f1){return function(_0x3d335c){try{jsonpatch[_0x0c9b('0x24')](_0x3d335c,_0x1bf9f1,!![]);}catch(_0x2269d4){return BPromise[_0x0c9b('0x25')](_0x2269d4);}return _0x3d335c[_0x0c9b('0x26')]();};}function saveUpdates(_0x4cc5cc,_0x19f6e2){return function(_0x3dfd64){if(_0x3dfd64){return _0x3dfd64[_0x0c9b('0x27')](_0x4cc5cc)['then'](function(_0x428a74){return _0x428a74;});}return null;};}function removeEntity(_0x37ee51,_0x2409c6){return function(_0x5c83c8){if(_0x5c83c8){return _0x5c83c8[_0x0c9b('0x28')]()['then'](function(){_0x37ee51[_0x0c9b('0x1b')](0xcc)[_0x0c9b('0x1c')]();});}};}function handleEntityNotFound(_0x2d1ce5,_0x1824d2){return function(_0xd0733f){if(!_0xd0733f){_0x2d1ce5[_0x0c9b('0x1a')](0x194);}return _0xd0733f;};}function handleError(_0x29e457,_0x21748a){_0x21748a=_0x21748a||0x1f4;return function(_0x476c59){logger[_0x0c9b('0x29')](_0x476c59[_0x0c9b('0x2a')]);if(_0x476c59['name']){delete _0x476c59['name'];}_0x29e457[_0x0c9b('0x1b')](_0x21748a)[_0x0c9b('0x2b')](_0x476c59);};}exports[_0x0c9b('0x2c')]=function(_0x2c9f63,_0x4ca17d){var _0x361d03={},_0x1391d1={},_0x54f75e={'count':0x0,'rows':[]};var _0x709be7=_[_0x0c9b('0x2d')](db[_0x0c9b('0x2e')][_0x0c9b('0x2f')],function(_0x4740ab){return{'name':_0x4740ab[_0x0c9b('0x30')],'type':_0x4740ab['type'][_0x0c9b('0x31')]};});_0x1391d1[_0x0c9b('0x32')]=_['map'](_0x709be7,_0x0c9b('0x33'));_0x1391d1[_0x0c9b('0x34')]=_[_0x0c9b('0x35')](_0x2c9f63[_0x0c9b('0x34')]);_0x1391d1[_0x0c9b('0x36')]=_[_0x0c9b('0x37')](_0x1391d1[_0x0c9b('0x32')],_0x1391d1[_0x0c9b('0x34')]);_0x361d03[_0x0c9b('0x38')]=_[_0x0c9b('0x37')](_0x1391d1[_0x0c9b('0x32')],qs['fields'](_0x2c9f63['query'][_0x0c9b('0x39')]));_0x361d03[_0x0c9b('0x38')]=_0x361d03[_0x0c9b('0x38')][_0x0c9b('0x3a')]?_0x361d03[_0x0c9b('0x38')]:_0x1391d1[_0x0c9b('0x32')];if(!_0x2c9f63[_0x0c9b('0x34')][_0x0c9b('0x3b')](_0x0c9b('0x3c'))){_0x361d03[_0x0c9b('0x1f')]=qs['limit'](_0x2c9f63[_0x0c9b('0x34')]['limit']);_0x361d03[_0x0c9b('0x1e')]=qs[_0x0c9b('0x1e')](_0x2c9f63[_0x0c9b('0x34')][_0x0c9b('0x1e')]);}_0x361d03[_0x0c9b('0x3d')]=qs['sort'](_0x2c9f63[_0x0c9b('0x34')]['sort']);_0x361d03['where']=qs[_0x0c9b('0x36')](_['pick'](_0x2c9f63[_0x0c9b('0x34')],_0x1391d1[_0x0c9b('0x36')]),_0x709be7);if(_0x2c9f63[_0x0c9b('0x34')][_0x0c9b('0x3e')]){_0x361d03[_0x0c9b('0x3f')]=_[_0x0c9b('0x40')](_0x361d03[_0x0c9b('0x3f')],{'$or':_[_0x0c9b('0x2d')](_0x709be7,function(_0x26e3ef){if(_0x26e3ef[_0x0c9b('0x41')]!==_0x0c9b('0x42')){var _0x1d838b={};_0x1d838b[_0x26e3ef['name']]={'$like':'%'+_0x2c9f63[_0x0c9b('0x34')][_0x0c9b('0x3e')]+'%'};return _0x1d838b;}})});}_0x361d03=_[_0x0c9b('0x40')]({},_0x361d03,_0x2c9f63[_0x0c9b('0x43')]);var _0x4034a0={'where':_0x361d03['where']};return db[_0x0c9b('0x2e')][_0x0c9b('0x21')](_0x4034a0)[_0x0c9b('0x44')](function(_0x3cdc24){_0x54f75e[_0x0c9b('0x21')]=_0x3cdc24;if(_0x2c9f63[_0x0c9b('0x34')][_0x0c9b('0x45')]){_0x361d03[_0x0c9b('0x46')]=[{'all':!![]}];}return db['DeskField'][_0x0c9b('0x47')](_0x361d03);})['then'](function(_0x17b1aa){_0x54f75e[_0x0c9b('0x48')]=_0x17b1aa;return _0x54f75e;})[_0x0c9b('0x44')](respondWithFilteredResult(_0x4ca17d,_0x361d03))[_0x0c9b('0x49')](handleError(_0x4ca17d,null));};exports[_0x0c9b('0x4a')]=function(_0x5463f0,_0x40e545){var _0x21c44b={'raw':!![],'where':{'id':_0x5463f0[_0x0c9b('0x4b')]['id']}},_0xbe5877={};_0xbe5877[_0x0c9b('0x32')]=_[_0x0c9b('0x35')](db[_0x0c9b('0x2e')][_0x0c9b('0x2f')]);_0xbe5877['query']=_[_0x0c9b('0x35')](_0x5463f0[_0x0c9b('0x34')]);_0xbe5877[_0x0c9b('0x36')]=_[_0x0c9b('0x37')](_0xbe5877['model'],_0xbe5877[_0x0c9b('0x34')]);_0x21c44b['attributes']=_[_0x0c9b('0x37')](_0xbe5877[_0x0c9b('0x32')],qs[_0x0c9b('0x39')](_0x5463f0['query'][_0x0c9b('0x39')]));_0x21c44b['attributes']=_0x21c44b['attributes'][_0x0c9b('0x3a')]?_0x21c44b[_0x0c9b('0x38')]:_0xbe5877[_0x0c9b('0x32')];if(_0x5463f0[_0x0c9b('0x34')][_0x0c9b('0x45')]){_0x21c44b[_0x0c9b('0x46')]=[{'all':!![]}];}_0x21c44b=_['merge']({},_0x21c44b,_0x5463f0['options']);return db[_0x0c9b('0x2e')][_0x0c9b('0x4c')](_0x21c44b)[_0x0c9b('0x44')](handleEntityNotFound(_0x40e545,null))[_0x0c9b('0x44')](respondWithResult(_0x40e545,null))[_0x0c9b('0x49')](handleError(_0x40e545,null));};exports[_0x0c9b('0x4d')]=function(_0x264a69,_0x2861f9){return db['DeskField']['create'](_0x264a69[_0x0c9b('0x4e')],{})[_0x0c9b('0x44')](respondWithResult(_0x2861f9,0xc9))['catch'](handleError(_0x2861f9,null));};exports[_0x0c9b('0x27')]=function(_0x55e94d,_0x52f612){if(_0x55e94d[_0x0c9b('0x4e')]['id']){delete _0x55e94d[_0x0c9b('0x4e')]['id'];}return db[_0x0c9b('0x2e')][_0x0c9b('0x4c')]({'where':{'id':_0x55e94d[_0x0c9b('0x4b')]['id']}})[_0x0c9b('0x44')](handleEntityNotFound(_0x52f612,null))[_0x0c9b('0x44')](saveUpdates(_0x55e94d['body'],null))['then'](respondWithResult(_0x52f612,null))[_0x0c9b('0x49')](handleError(_0x52f612,null));};exports['destroy']=function(_0x16bd59,_0x19512c){return db['DeskField']['find']({'where':{'id':_0x16bd59['params']['id']}})[_0x0c9b('0x44')](handleEntityNotFound(_0x19512c,null))[_0x0c9b('0x44')](removeEntity(_0x19512c,null))[_0x0c9b('0x49')](handleError(_0x19512c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index b3b244b..5cf5114 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 _0x90de=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields','lodash'];(function(_0x2f1a2d,_0x586ce1){var _0x7a81cb=function(_0x59d349){while(--_0x59d349){_0x2f1a2d['push'](_0x2f1a2d['shift']());}};_0x7a81cb(++_0x586ce1);}(_0x90de,0x151));var _0xe90d=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x90de[_0x529059];return _0x156bc2;};'use strict';var _=require(_0xe90d('0x0'));var util=require(_0xe90d('0x1'));var logger=require(_0xe90d('0x2'))(_0xe90d('0x3'));var moment=require(_0xe90d('0x4'));var BPromise=require(_0xe90d('0x5'));var rp=require(_0xe90d('0x6'));var fs=require('fs');var path=require(_0xe90d('0x7'));var rimraf=require(_0xe90d('0x8'));var config=require('../../config/environment');var attributes=require(_0xe90d('0x9'));module['exports']=function(_0x5cb5d0,_0x23fb05){return _0x5cb5d0[_0xe90d('0xa')](_0xe90d('0xb'),attributes,{'tableName':_0xe90d('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b1a=['define','DeskField','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports'];(function(_0xf6a3a4,_0x148acb){var _0x586f7f=function(_0x5131a0){while(--_0x5131a0){_0xf6a3a4['push'](_0xf6a3a4['shift']());}};_0x586f7f(++_0x148acb);}(_0x1b1a,0x1a9));var _0xa1b1=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x1b1a[_0x9c8b4a];return _0x198bef;};'use strict';var _=require(_0xa1b1('0x0'));var util=require('util');var logger=require(_0xa1b1('0x1'))(_0xa1b1('0x2'));var moment=require(_0xa1b1('0x3'));var BPromise=require(_0xa1b1('0x4'));var rp=require(_0xa1b1('0x5'));var fs=require('fs');var path=require(_0xa1b1('0x6'));var rimraf=require(_0xa1b1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa1b1('0x8'));module[_0xa1b1('0x9')]=function(_0x4f024e,_0x53460e){return _0x4f024e[_0xa1b1('0xa')](_0xa1b1('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa1b1('0xc'),'fields':[_0xa1b1('0xd'),_0xa1b1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index dd51876..a0159aa 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 _0xcb5e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result'];(function(_0xdb199a,_0x387db0){var _0x3e1f37=function(_0x2c5115){while(--_0x2c5115){_0xdb199a['push'](_0xdb199a['shift']());}};_0x3e1f37(++_0x387db0);}(_0xcb5e,0x1b9));var _0xecb5=function(_0x3abaf9,_0x13fecb){_0x3abaf9=_0x3abaf9-0x0;var _0x1bc864=_0xcb5e[_0x3abaf9];return _0x1bc864;};'use strict';var _=require(_0xecb5('0x0'));var util=require(_0xecb5('0x1'));var moment=require(_0xecb5('0x2'));var BPromise=require(_0xecb5('0x3'));var rs=require(_0xecb5('0x4'));var fs=require('fs');var Redis=require(_0xecb5('0x5'));var db=require(_0xecb5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xecb5('0x7'))(_0xecb5('0x8'));var config=require(_0xecb5('0x9'));var jayson=require(_0xecb5('0xa'));var client=jayson[_0xecb5('0xb')][_0xecb5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ce00b,_0x5b817d,_0x1ea662){return new BPromise(function(_0x2464d3,_0x46bec9){return client['request'](_0x1ce00b,_0x1ea662)['then'](function(_0x149a78){logger[_0xecb5('0xd')]('DeskField,\x20%s,\x20%s',_0x5b817d,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x5b817d,_0xecb5('0xe'),JSON[_0xecb5('0xf')](_0x149a78));if(_0x149a78[_0xecb5('0x10')]){if(_0x149a78[_0xecb5('0x10')][_0xecb5('0x11')]===0x1f4){logger['error'](_0xecb5('0x12'),_0x5b817d,_0x149a78['error'][_0xecb5('0x13')]);return _0x46bec9(_0x149a78[_0xecb5('0x10')][_0xecb5('0x13')]);}logger[_0xecb5('0x10')](_0xecb5('0x12'),_0x5b817d,_0x149a78[_0xecb5('0x10')]['message']);return _0x2464d3(_0x149a78[_0xecb5('0x10')][_0xecb5('0x13')]);}else{logger[_0xecb5('0xd')]('DeskField,\x20%s,\x20%s',_0x5b817d,_0xecb5('0xe'));_0x2464d3(_0x149a78[_0xecb5('0x14')][_0xecb5('0x13')]);}})[_0xecb5('0x15')](function(_0x35fe7f){logger[_0xecb5('0x10')](_0xecb5('0x12'),_0x5b817d,_0x35fe7f);_0x46bec9(_0x35fe7f);});});} \ No newline at end of file +var _0x703e=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x703e,0x1a0));var _0xe703=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x703e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xe703('0x0'));var util=require(_0xe703('0x1'));var moment=require('moment');var BPromise=require(_0xe703('0x2'));var rs=require(_0xe703('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe703('0x4'))['db'];var utils=require(_0xe703('0x5'));var logger=require(_0xe703('0x6'))(_0xe703('0x7'));var config=require('../../config/environment');var jayson=require(_0xe703('0x8'));var client=jayson['client'][_0xe703('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ee7a4,_0x23fc79,_0x5779c1){return new BPromise(function(_0x2e4d29,_0x401a42){return client[_0xe703('0xa')](_0x1ee7a4,_0x5779c1)[_0xe703('0xb')](function(_0x4d7b06){logger['info'](_0xe703('0xc'),_0x23fc79,_0xe703('0xd'));logger[_0xe703('0xe')](_0xe703('0xf'),_0x23fc79,_0xe703('0xd'),JSON['stringify'](_0x4d7b06));if(_0x4d7b06[_0xe703('0x10')]){if(_0x4d7b06[_0xe703('0x10')][_0xe703('0x11')]===0x1f4){logger[_0xe703('0x10')](_0xe703('0xc'),_0x23fc79,_0x4d7b06['error']['message']);return _0x401a42(_0x4d7b06['error'][_0xe703('0x12')]);}logger[_0xe703('0x10')]('DeskField,\x20%s,\x20%s',_0x23fc79,_0x4d7b06[_0xe703('0x10')]['message']);return _0x2e4d29(_0x4d7b06['error'][_0xe703('0x12')]);}else{logger['info'](_0xe703('0xc'),_0x23fc79,_0xe703('0xd'));_0x2e4d29(_0x4d7b06[_0xe703('0x13')][_0xe703('0x12')]);}})[_0xe703('0x14')](function(_0x9a434e){logger['error']('DeskField,\x20%s,\x20%s',_0x23fc79,_0x9a434e);_0x401a42(_0x9a434e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e1d4b97..6abe1df 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 _0xab6d=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getFields','create','post','addConfiguration','update','delete','destroy'];(function(_0x1718ba,_0x1c54ba){var _0x3dbb9b=function(_0x56cfdb){while(--_0x56cfdb){_0x1718ba['push'](_0x1718ba['shift']());}};_0x3dbb9b(++_0x1c54ba);}(_0xab6d,0x1b8));var _0xdab6=function(_0x47cafe,_0x1689d3){_0x47cafe=_0x47cafe-0x0;var _0x3c75e8=_0xab6d[_0x47cafe];return _0x3c75e8;};'use strict';var multer=require(_0xdab6('0x0'));var util=require(_0xdab6('0x1'));var path=require('path');var timeout=require(_0xdab6('0x2'));var express=require(_0xdab6('0x3'));var router=express['Router']();var fs_extra=require(_0xdab6('0x4'));var auth=require(_0xdab6('0x5'));var interaction=require(_0xdab6('0x6'));var config=require(_0xdab6('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xdab6('0x8')]('/',auth[_0xdab6('0x9')](),controller['index']);router[_0xdab6('0x8')](_0xdab6('0xa'),auth['isAuthenticated'](),controller[_0xdab6('0xb')]);router[_0xdab6('0x8')](_0xdab6('0xc'),auth[_0xdab6('0x9')](),controller['getConfigurations']);router[_0xdab6('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdab6('0xd')]);router['post']('/',auth[_0xdab6('0x9')](),controller[_0xdab6('0xe')]);router[_0xdab6('0xf')](_0xdab6('0xc'),auth['isAuthenticated'](),controller[_0xdab6('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdab6('0x11')]);router[_0xdab6('0x12')](_0xdab6('0xa'),auth[_0xdab6('0x9')](),controller[_0xdab6('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbb7e=['get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x320ad4,_0x1d738e){var _0x3cea5b=function(_0x5e940e){while(--_0x5e940e){_0x320ad4['push'](_0x320ad4['shift']());}};_0x3cea5b(++_0x1d738e);}(_0xbb7e,0xde));var _0xebb7=function(_0x2ce53c,_0x50405b){_0x2ce53c=_0x2ce53c-0x0;var _0x2212b0=_0xbb7e[_0x2ce53c];return _0x2212b0;};'use strict';var multer=require(_0xebb7('0x0'));var util=require(_0xebb7('0x1'));var path=require(_0xebb7('0x2'));var timeout=require(_0xebb7('0x3'));var express=require(_0xebb7('0x4'));var router=express['Router']();var fs_extra=require(_0xebb7('0x5'));var auth=require(_0xebb7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xebb7('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xebb7('0x8')]('/',auth[_0xebb7('0x9')](),controller[_0xebb7('0xa')]);router['get'](_0xebb7('0xb'),auth[_0xebb7('0x9')](),controller[_0xebb7('0xc')]);router[_0xebb7('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xebb7('0xd')]);router['get'](_0xebb7('0xe'),auth[_0xebb7('0x9')](),controller[_0xebb7('0xf')]);router[_0xebb7('0x10')]('/',auth[_0xebb7('0x9')](),controller[_0xebb7('0x11')]);router[_0xebb7('0x10')](_0xebb7('0x12'),auth[_0xebb7('0x9')](),controller[_0xebb7('0x13')]);router['put']('/:id',auth[_0xebb7('0x9')](),controller[_0xebb7('0x14')]);router['delete'](_0xebb7('0xb'),auth['isAuthenticated'](),controller[_0xebb7('0x15')]);module[_0xebb7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 2274a3b..134b745 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 _0x975f=['STRING','sequelize'];(function(_0x3e1224,_0x321e91){var _0x19dc4b=function(_0x39e292){while(--_0x39e292){_0x3e1224['push'](_0x3e1224['shift']());}};_0x19dc4b(++_0x321e91);}(_0x975f,0x191));var _0xf975=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0x975f[_0x50f112];return _0x4ecf28;};'use strict';var Sequelize=require(_0xf975('0x0'));module['exports']={'name':{'type':Sequelize[_0xf975('0x1')]},'username':{'type':Sequelize[_0xf975('0x1')]},'password':{'type':Sequelize[_0xf975('0x1')]},'remoteUri':{'type':Sequelize[_0xf975('0x1')]},'tenantId':{'type':Sequelize[_0xf975('0x1')]},'clientId':{'type':Sequelize[_0xf975('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf975('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf975('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd8a5=['BOOLEAN','sequelize','STRING'];(function(_0x512d05,_0x1d7dbe){var _0x23bce8=function(_0xc5125b){while(--_0xc5125b){_0x512d05['push'](_0x512d05['shift']());}};_0x23bce8(++_0x1d7dbe);}(_0xd8a5,0x160));var _0x5d8a=function(_0x2e9989,_0x1daf00){_0x2e9989=_0x2e9989-0x0;var _0x12ed7f=_0xd8a5[_0x2e9989];return _0x12ed7f;};'use strict';var Sequelize=require(_0x5d8a('0x0'));module['exports']={'name':{'type':Sequelize[_0x5d8a('0x1')]},'username':{'type':Sequelize[_0x5d8a('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5d8a('0x1')]},'tenantId':{'type':Sequelize[_0x5d8a('0x1')]},'clientId':{'type':Sequelize[_0x5d8a('0x1')]},'clientSecret':{'type':Sequelize[_0x5d8a('0x1')]},'serverUrl':{'type':Sequelize[_0x5d8a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5d8a('0x1')]},'modernAuthentication':{'type':Sequelize[_0x5d8a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 00b9650..57247dc 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 _0xa106=['StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','test','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption','util','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','count','limit','set','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','update','getConfigurations','Dynamics365Configuration','order','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','GET','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','remove','includes','@odata.type','forEach','isNil','substring','BooleanAttributeMetadata','push','all'];(function(_0x55f27d,_0x1af6f4){var _0x259d3d=function(_0x37072a){while(--_0x37072a){_0x55f27d['push'](_0x55f27d['shift']());}};_0x259d3d(++_0x1af6f4);}(_0xa106,0x17f));var _0x6a10=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0xa106[_0x4d1d2c];return _0x2c4cb9;};'use strict';var rp=require('request-promise');var util=require(_0x6a10('0x0'));var _=require(_0x6a10('0x1'));var qs=require(_0x6a10('0x2'));var logger=require(_0x6a10('0x3'))(_0x6a10('0x4'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0xdf0eef,_0x51a11a){_0x51a11a=_0x51a11a||0xc8;return function(_0x236f7f){if(_0x236f7f){return _0xdf0eef[_0x6a10('0x5')](_0x51a11a)[_0x6a10('0x6')](_0x236f7f);}};}function respondWithFilteredResult(_0x2a9468,_0x4ee006){return function(_0x1fa672){if(_0x1fa672){var _0x4988d8=typeof _0x4ee006[_0x6a10('0x7')]===_0x6a10('0x8')&&typeof _0x4ee006['limit']==='undefined';var _0x2fe44f=_0x1fa672[_0x6a10('0x9')];var _0x3a5647=_0x4988d8?0x0:_0x4ee006[_0x6a10('0x7')];var _0x572c52=_0x4988d8?_0x1fa672['count']:_0x4ee006[_0x6a10('0x7')]+_0x4ee006[_0x6a10('0xa')];var _0x56896a;if(_0x572c52>=_0x2fe44f){_0x572c52=_0x2fe44f;_0x56896a=0xc8;}else{_0x56896a=0xce;}_0x2a9468[_0x6a10('0x5')](_0x56896a);return _0x2a9468[_0x6a10('0xb')]('Content-Range',_0x3a5647+'-'+_0x572c52+'/'+_0x2fe44f)['json'](_0x1fa672);}return null;};}function saveUpdates(_0x4986ee){return function(_0x5c3fd0){if(_0x5c3fd0){return _0x5c3fd0['update'](_0x4986ee)[_0x6a10('0xc')](function(_0x21a589){return _0x21a589;});}return null;};}function removeEntity(_0x4c1711){return function(_0x1a293e){if(_0x1a293e){return _0x1a293e[_0x6a10('0xd')]()[_0x6a10('0xc')](function(){_0x4c1711[_0x6a10('0x5')](0xcc)[_0x6a10('0xe')]();});}};}function handleEntityNotFound(_0x179cb7){return function(_0x2155dd){if(!_0x2155dd){_0x179cb7['sendStatus'](0x194);}return _0x2155dd;};}function handleError(_0x4bfe0b,_0x2f3794){_0x2f3794=_0x2f3794||0x1f4;return function(_0x3c66a2){logger[_0x6a10('0xf')](_0x3c66a2[_0x6a10('0x10')]);if(_0x3c66a2[_0x6a10('0x11')]){delete _0x3c66a2[_0x6a10('0x11')];}_0x4bfe0b[_0x6a10('0x5')](_0x2f3794)[_0x6a10('0x12')](_0x3c66a2);};}exports[_0x6a10('0x13')]=function(_0x294238,_0x2c2559){var _0x1bef2c={},_0x1dd38f={},_0x458d02={'count':0x0,'rows':[]};var _0x1979b3=_[_0x6a10('0x14')](db[_0x6a10('0x15')][_0x6a10('0x16')],function(_0x20f3d1){return{'name':_0x20f3d1[_0x6a10('0x17')],'type':_0x20f3d1[_0x6a10('0x18')][_0x6a10('0x19')]};});_0x1dd38f['model']=_[_0x6a10('0x14')](_0x1979b3,_0x6a10('0x11'));_0x1dd38f[_0x6a10('0x1a')]=_[_0x6a10('0x1b')](_0x294238['query']);_0x1dd38f[_0x6a10('0x1c')]=_[_0x6a10('0x1d')](_0x1dd38f['model'],_0x1dd38f[_0x6a10('0x1a')]);_0x1bef2c[_0x6a10('0x1e')]=_[_0x6a10('0x1d')](_0x1dd38f[_0x6a10('0x1f')],qs['fields'](_0x294238[_0x6a10('0x1a')][_0x6a10('0x20')]));_0x1bef2c['attributes']=_0x1bef2c['attributes'][_0x6a10('0x21')]?_0x1bef2c[_0x6a10('0x1e')]:_0x1dd38f['model'];if(!_0x294238[_0x6a10('0x1a')][_0x6a10('0x22')]('nolimit')){_0x1bef2c[_0x6a10('0xa')]=qs['limit'](_0x294238[_0x6a10('0x1a')][_0x6a10('0xa')]);_0x1bef2c['offset']=qs[_0x6a10('0x7')](_0x294238[_0x6a10('0x1a')][_0x6a10('0x7')]);}_0x1bef2c['order']=qs[_0x6a10('0x23')](_0x294238[_0x6a10('0x1a')][_0x6a10('0x23')]);_0x1bef2c['where']=qs[_0x6a10('0x1c')](_[_0x6a10('0x24')](_0x294238[_0x6a10('0x1a')],_0x1dd38f[_0x6a10('0x1c')]),_0x1979b3);if(_0x294238[_0x6a10('0x1a')]['filter']){_0x1bef2c[_0x6a10('0x25')]=_['merge'](_0x1bef2c[_0x6a10('0x25')],{'$or':_[_0x6a10('0x14')](_0x1979b3,function(_0x956b1c){if(_0x956b1c['type']!==_0x6a10('0x26')){var _0x42c688={};_0x42c688[_0x956b1c[_0x6a10('0x11')]]={'$like':'%'+_0x294238[_0x6a10('0x1a')][_0x6a10('0x27')]+'%'};return _0x42c688;}})});}_0x1bef2c=_['merge']({},_0x1bef2c,_0x294238[_0x6a10('0x28')]);var _0x597c27={'where':_0x1bef2c[_0x6a10('0x25')]};return db[_0x6a10('0x15')][_0x6a10('0x9')](_0x597c27)['then'](function(_0x399523){_0x458d02[_0x6a10('0x9')]=_0x399523;if(_0x294238[_0x6a10('0x1a')][_0x6a10('0x29')]){_0x1bef2c[_0x6a10('0x2a')]=[{'all':!![]}];}return db[_0x6a10('0x15')][_0x6a10('0x2b')](_0x1bef2c);})[_0x6a10('0xc')](function(_0x349e73){_0x458d02['rows']=_0x349e73;return _0x458d02;})[_0x6a10('0xc')](respondWithFilteredResult(_0x2c2559,_0x1bef2c))[_0x6a10('0x2c')](handleError(_0x2c2559,null));};exports[_0x6a10('0x2d')]=function(_0x126b62,_0x16e5e5){var _0x5588f5={'raw':![],'where':{'id':_0x126b62[_0x6a10('0x2e')]['id']}},_0x23aece={};_0x23aece['model']=_['keys'](db[_0x6a10('0x15')][_0x6a10('0x16')]);_0x23aece[_0x6a10('0x1a')]=_['keys'](_0x126b62[_0x6a10('0x1a')]);_0x23aece[_0x6a10('0x1c')]=_[_0x6a10('0x1d')](_0x23aece[_0x6a10('0x1f')],_0x23aece[_0x6a10('0x1a')]);_0x5588f5[_0x6a10('0x1e')]=_['intersection'](_0x23aece[_0x6a10('0x1f')],qs[_0x6a10('0x20')](_0x126b62[_0x6a10('0x1a')][_0x6a10('0x20')]));_0x5588f5[_0x6a10('0x1e')]=_0x5588f5['attributes'][_0x6a10('0x21')]?_0x5588f5[_0x6a10('0x1e')]:_0x23aece['model'];if(_0x126b62[_0x6a10('0x1a')][_0x6a10('0x29')]){_0x5588f5[_0x6a10('0x2a')]=[{'all':!![]}];}_0x5588f5=_[_0x6a10('0x2f')]({},_0x5588f5,_0x126b62['options']);return db[_0x6a10('0x15')][_0x6a10('0x30')](_0x5588f5)['then'](handleEntityNotFound(_0x16e5e5,null))[_0x6a10('0xc')](respondWithResult(_0x16e5e5,null))['catch'](handleError(_0x16e5e5,null));};exports[_0x6a10('0x31')]=function(_0x1dfacf,_0x5044e1){return db['Dynamics365Account'][_0x6a10('0x31')](_0x1dfacf[_0x6a10('0x32')],{})[_0x6a10('0xc')](respondWithResult(_0x5044e1,0xc9))[_0x6a10('0x2c')](handleError(_0x5044e1,null));};exports[_0x6a10('0x33')]=function(_0x18d6af,_0x5f5829){if(_0x18d6af[_0x6a10('0x32')]['id']){delete _0x18d6af[_0x6a10('0x32')]['id'];}return db[_0x6a10('0x15')][_0x6a10('0x30')]({'where':{'id':_0x18d6af['params']['id']}})[_0x6a10('0xc')](handleEntityNotFound(_0x5f5829,null))[_0x6a10('0xc')](saveUpdates(_0x18d6af['body'],null))[_0x6a10('0xc')](respondWithResult(_0x5f5829,null))[_0x6a10('0x2c')](handleError(_0x5f5829,null));};exports[_0x6a10('0xd')]=function(_0xeed900,_0x20adf0){return db[_0x6a10('0x15')][_0x6a10('0x30')]({'where':{'id':_0xeed900['params']['id']}})['then'](handleEntityNotFound(_0x20adf0,null))[_0x6a10('0xc')](removeEntity(_0x20adf0,null))[_0x6a10('0x2c')](handleError(_0x20adf0,null));};exports[_0x6a10('0x34')]=function(_0x46333a,_0x1ecbc7){var _0x40f644={};var _0x820bb3={};var _0x202447;var _0x178fc;return db['Dynamics365Account']['findOne']({'where':{'id':_0x46333a[_0x6a10('0x2e')]['id']}})[_0x6a10('0xc')](handleEntityNotFound(_0x1ecbc7,null))[_0x6a10('0xc')](function(_0x1a60fc){if(_0x1a60fc){_0x202447=_0x1a60fc;_0x820bb3['model']=_[_0x6a10('0x1b')](db[_0x6a10('0x35')]['rawAttributes']);_0x820bb3['query']=_[_0x6a10('0x1b')](_0x46333a['query']);_0x820bb3['filters']=_[_0x6a10('0x1d')](_0x820bb3['model'],_0x820bb3['query']);_0x40f644[_0x6a10('0x1e')]=_[_0x6a10('0x1d')](_0x820bb3['model'],qs[_0x6a10('0x20')](_0x46333a['query'][_0x6a10('0x20')]));_0x40f644['attributes']=_0x40f644['attributes'][_0x6a10('0x21')]?_0x40f644[_0x6a10('0x1e')]:_0x820bb3['model'];_0x40f644[_0x6a10('0x36')]=qs['sort'](_0x46333a[_0x6a10('0x1a')]['sort']);_0x40f644['where']=qs['filters'](_['pick'](_0x46333a[_0x6a10('0x1a')],_0x820bb3[_0x6a10('0x1c')]));if(_0x46333a['query']['filter']){_0x40f644[_0x6a10('0x25')]=_[_0x6a10('0x2f')](_0x40f644['where'],{'$or':_[_0x6a10('0x14')](_0x40f644['attributes'],function(_0x3c9fd6){var _0x39638b={};_0x39638b[_0x3c9fd6]={'$like':'%'+_0x46333a['query']['filter']+'%'};return _0x39638b;})});}_0x40f644=_['merge']({},_0x40f644,_0x46333a[_0x6a10('0x28')]);return _0x202447[_0x6a10('0x34')](_0x40f644);}})[_0x6a10('0xc')](function(_0xb845f6){if(_0xb845f6){_0x178fc=_0xb845f6[_0x6a10('0x21')];if(!_0x46333a['query'][_0x6a10('0x22')]('nolimit')){_0x40f644[_0x6a10('0xa')]=qs[_0x6a10('0xa')](_0x46333a[_0x6a10('0x1a')]['limit']);_0x40f644['offset']=qs[_0x6a10('0x7')](_0x46333a[_0x6a10('0x1a')][_0x6a10('0x7')]);}return _0x202447[_0x6a10('0x34')](_0x40f644);}})[_0x6a10('0xc')](function(_0x21e7d1){if(_0x21e7d1){return _0x21e7d1?{'count':_0x178fc,'rows':_0x21e7d1}:null;}})[_0x6a10('0xc')](respondWithResult(_0x1ecbc7,null))[_0x6a10('0x2c')](handleError(_0x1ecbc7,null));};exports['addConfiguration']=function(_0x3272fb,_0x1ae022){if(_0x3272fb['body']['id']){delete _0x3272fb[_0x6a10('0x32')]['id'];}return db[_0x6a10('0x15')][_0x6a10('0x37')]({'where':{'id':_0x3272fb['params']['id']}})[_0x6a10('0xc')](handleEntityNotFound(_0x1ae022,null))[_0x6a10('0xc')](function(_0x22038e){if(_0x22038e){_0x3272fb[_0x6a10('0x32')][_0x6a10('0x38')]=_0x22038e['id'];_0x3272fb[_0x6a10('0x32')][_0x6a10('0x39')]=integrations[_0x6a10('0x3a')](_0x3272fb[_0x6a10('0x32')][_0x6a10('0x3b')],_0x3272fb[_0x6a10('0x32')][_0x6a10('0x18')]);_0x3272fb[_0x6a10('0x32')][_0x6a10('0x3c')]=integrations[_0x6a10('0x3d')](_0x3272fb['body'][_0x6a10('0x3b')],_0x3272fb[_0x6a10('0x32')][_0x6a10('0x18')]);return db[_0x6a10('0x35')][_0x6a10('0x31')](_0x3272fb[_0x6a10('0x32')],{'include':[{'model':db[_0x6a10('0x3e')],'as':_0x6a10('0x39')},{'model':db[_0x6a10('0x3e')],'as':_0x6a10('0x3c')}]});}return null;})[_0x6a10('0xc')](respondWithResult(_0x1ae022,null))['catch'](handleError(_0x1ae022,null));};function sanitizeRemoteUri(_0x1ee7d4){var _0xf78239=_0x1ee7d4[_0x6a10('0x3f')](-0x1);if(_0xf78239==='/')return _0x1ee7d4['substring'](0x0,_0x1ee7d4[_0x6a10('0x40')](_0xf78239));return _0x1ee7d4;}function getWebApiUrl(_0x2327c6){return util[_0x6a10('0x41')](_0x6a10('0x42'),_0x2327c6);}exports['getFields']=function(_0x3f9ab6,_0xce6c23){var _0x1f177d=_0x3f9ab6[_0x6a10('0x1a')]['ticketType'];var _0x34d123=_0x1f177d===_0x6a10('0x43')?_0x6a10('0x44'):_0x6a10('0x45');var _0x315bee='';var _0x184bce='';var _0x3fc1c8='';var _0x25024d='';var _0x14c466='';var _0xc655dc='';var _0x505d79='';var _0x318830='';var _0x11d4eb=[_0x6a10('0x46'),_0x6a10('0x47'),_0x6a10('0x48'),_0x6a10('0x49'),'caseorigincode',_0x6a10('0x4a'),'phonenumber',_0x6a10('0x4b'),_0x6a10('0x4c'),_0x6a10('0x4d')];var _0x2f6865=[_0x6a10('0x4e'),_0x6a10('0x4f'),_0x6a10('0x50'),'billedserviceunits','contactidname',_0x6a10('0x51'),_0x6a10('0x52'),'contractidname',_0x6a10('0x53'),_0x6a10('0x54'),_0x6a10('0x55'),_0x6a10('0x56'),_0x6a10('0x57'),'createdonbehalfbyname',_0x6a10('0x58'),_0x6a10('0x59'),_0x6a10('0x5a'),'customeridyominame','emailaddress',_0x6a10('0x5b'),_0x6a10('0x5c'),_0x6a10('0x5d'),'escalatedon','exchangerate',_0x6a10('0x5e'),_0x6a10('0x5f'),_0x6a10('0x60'),'influencescore',_0x6a10('0x61'),_0x6a10('0x62'),_0x6a10('0x63'),_0x6a10('0x64'),'modifiedbyexternalpartyyominame',_0x6a10('0x65'),_0x6a10('0x66'),_0x6a10('0x67'),'modifiedonbehalfbyname',_0x6a10('0x68'),_0x6a10('0x69'),'msdyn_iotalertname','numberofchildincidents',_0x6a10('0x6a'),_0x6a10('0x6b'),'owneridname',_0x6a10('0x6c'),_0x6a10('0x6d'),_0x6a10('0x6e'),_0x6a10('0x6f'),_0x6a10('0x70'),_0x6a10('0x71'),_0x6a10('0x72'),'productserialnumber','resolveby',_0x6a10('0x73'),_0x6a10('0x74'),_0x6a10('0x75'),'responsiblecontactidyominame',_0x6a10('0x76'),_0x6a10('0x77'),_0x6a10('0x78'),_0x6a10('0x79'),_0x6a10('0x7a'),_0x6a10('0x7b'),_0x6a10('0x7c'),_0x6a10('0x7d'),_0x6a10('0x7e'),_0x6a10('0x7f'),'traversedpath',_0x6a10('0x80'),_0x6a10('0x81')];var _0x116a4d=_0x11d4eb[_0x6a10('0x82')](_0x2f6865);return db['Dynamics365Account'][_0x6a10('0x37')]({'where':{'id':_0x3f9ab6['params']['id']},'attributes':['id',_0x6a10('0x83'),_0x6a10('0x84'),_0x6a10('0x85'),_0x6a10('0x86'),_0x6a10('0x87'),_0x6a10('0x88'),_0x6a10('0x89')],'include':[{'model':db[_0x6a10('0x8a')],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0x6a10('0xc')](handleEntityNotFound(_0xce6c23,null))['then'](function(_0x54bd2c){if(_0x54bd2c){if(_0x54bd2c[_0x6a10('0x89')]){_0x54bd2c[_0x6a10('0x8b')]=_0x54bd2c[_0x6a10('0x8a')][_0x6a10('0x8c')];_0x318830=sanitizeRemoteUri(_0x54bd2c['CloudProvider'][_0x6a10('0x8d')]);_0x505d79=getWebApiUrl(_0x318830);return _0x54bd2c;}_0x318830=sanitizeRemoteUri(_0x54bd2c[_0x6a10('0x85')]);_0x505d79=getWebApiUrl(_0x318830);var _0x1c5505={'method':_0x6a10('0x8e'),'uri':_0x6a10('0x8f')+_0x54bd2c[_0x6a10('0x86')]+_0x6a10('0x90'),'form':{'client_id':_0x54bd2c['clientId'],'resource':_0x318830,'username':_0x54bd2c[_0x6a10('0x83')],'password':_0x54bd2c[_0x6a10('0x84')],'grant_type':_0x6a10('0x84'),'client_secret':_0x54bd2c['clientSecret']},'json':!![]};return rp(_0x1c5505);}})['then'](function(_0x4f3708){_0xc655dc=_0x4f3708['access_token'];var _0x362d7b={'method':_0x6a10('0x91'),'uri':encodeURI(_0x505d79+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x34d123+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xc655dc,'If-None-Match':null,'OData-Version':_0x6a10('0x92')},'json':!![]};return rp(_0x362d7b);})[_0x6a10('0xc')](function(_0xe381b0){var _0xf653dc=_0xe381b0[_0x6a10('0x93')][0x0];var _0x2e4aa5=_0xf653dc[_0x6a10('0x94')];var _0x15462f={'method':'GET','uri':_0x505d79+_0x6a10('0x95')+_0x2e4aa5+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x6a10('0x96')+_0xc655dc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15462f);})[_0x6a10('0xc')](function(_0x2cc6e4){_0x315bee=_0x2cc6e4;_0x184bce=_0x315bee['Attributes'];_0x184bce=_[_0x6a10('0x97')](_0x184bce,function(_0x11f428){return!_0x116a4d[_0x6a10('0x98')](_0x11f428['LogicalName']);});var _0x29372a=[];var _0x148043=[];_0x184bce['forEach'](function(_0x3cdc2d){if(_0x3cdc2d[_0x6a10('0x99')]){var _0x188d6a=_0x3cdc2d[_0x6a10('0x99')]['substring'](_0x3cdc2d[_0x6a10('0x99')][_0x6a10('0x40')]('.')+0x1);if(_0x188d6a==='PicklistAttributeMetadata'){_0x29372a['push'](getSelectList(_0x505d79,_0x1f177d,_0x148043,_0x315bee[_0x6a10('0x94')],_0x3cdc2d['MetadataId'],_0xc655dc));}}});return Promise['all'](_0x29372a);})['then'](function(_0x26d471){_0x3fc1c8=_0x26d471[0x0];var _0x620d0f=[];var _0x24634d=[];_0x184bce[_0x6a10('0x9a')](function(_0x3f1301){if(!_[_0x6a10('0x9b')](_0x3f1301[_0x6a10('0x99')])){var _0x35966d=_0x3f1301['@odata.type'][_0x6a10('0x9c')](_0x3f1301[_0x6a10('0x99')][_0x6a10('0x40')]('.')+0x1);if(_0x35966d===_0x6a10('0x9d')){_0x620d0f[_0x6a10('0x9e')](getBooleanList(_0x505d79,_0x1f177d,_0x24634d,_0x315bee[_0x6a10('0x94')],_0x3f1301[_0x6a10('0x94')],_0xc655dc));}}});return Promise[_0x6a10('0x9f')](_0x620d0f);})[_0x6a10('0xc')](function(_0x2f36f2){_0x25024d=_0x2f36f2[0x0];var _0xc5d232=[];var _0xd202ff=[];_0x184bce[_0x6a10('0x9a')](function(_0x44bc68){if(_0x44bc68['@odata.type']){var _0x4b856d=_0x44bc68['@odata.type'][_0x6a10('0x9c')](_0x44bc68[_0x6a10('0x99')]['lastIndexOf']('.')+0x1);if(_0x4b856d===_0x6a10('0xa0')||_0x4b856d===_0x6a10('0xa1')||_0x4b856d==='BigIntAttributeMetadata'||_0x4b856d===_0x6a10('0xa2')||_0x4b856d===_0x6a10('0xa3')||_0x4b856d===_0x6a10('0xa4')||_0x4b856d==='StatusAttributeMetadata'||_0x4b856d===_0x6a10('0xa5')||_0x4b856d==='StateAttributeMetadata'||_0x4b856d==='DecimalAttributeMetadata'){_0xc5d232[_0x6a10('0x9e')](getInputList(_0x505d79,_0x1f177d,_0x4b856d,_0xd202ff,_0x315bee[_0x6a10('0x94')],_0x44bc68[_0x6a10('0x94')],_0xc655dc));}}});return Promise['all'](_0xc5d232);})[_0x6a10('0xc')](function(_0x58ab89){_0x14c466=_0x58ab89[0x0];var _0x5d4908=_0x3fc1c8[_0x6a10('0x82')](_0x25024d)[_0x6a10('0x82')](_0x14c466);var _0x4807d4={'count':_0x5d4908[_0x6a10('0x21')],'rows':_0x5d4908};return _0x4807d4;})['then'](respondWithResult(_0xce6c23,null))[_0x6a10('0x2c')](function(_0x473b6f){var _0x2edda5=_0x3f9ab6[_0x6a10('0x1a')][_0x6a10('0xa6')]?0x1f4:_0x473b6f[_0x6a10('0xa7')]||0x1f4;logger[_0x6a10('0xf')](_0x473b6f[_0x6a10('0x10')]);delete _0x473b6f[_0x6a10('0x11')];if(_0x2edda5===0x191){_0x2edda5=0x190;}_0xce6c23['status'](_0x2edda5)[_0x6a10('0x12')](_0x3f9ab6[_0x6a10('0x1a')][_0x6a10('0xa6')]?{'message':'Wrong\x20credentials','statusCode':_0x473b6f[_0x6a10('0xa7')]}:_0x473b6f);});};function getSelectList(_0x3165fd,_0x1aa5a3,_0x1d8868,_0x8b9e41,_0x2c5d22,_0x2aa946){var _0x2a663d={'method':_0x6a10('0x91'),'uri':_0x3165fd+_0x6a10('0x95')+_0x8b9e41+_0x6a10('0xa8')+_0x2c5d22+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x6a10('0xa9'),'headers':{'Authorization':_0x6a10('0x96')+_0x2aa946,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a663d)[_0x6a10('0xc')](function(_0x29d7e6){var _0x13cddf=[];var _0x14ee39=_0x29d7e6['OptionSet'][_0x6a10('0xaa')];_0x14ee39[_0x6a10('0x9a')](function(_0x3c0311){_0x13cddf['push']({'name':_0x3c0311[_0x6a10('0xab')][_0x6a10('0xac')][_0x6a10('0xab')],'value':String(_0x3c0311[_0x6a10('0xad')])});});var _0x17510f={'id':_0x1aa5a3+'_'+_0x29d7e6[_0x6a10('0xae')],'name':_0x29d7e6[_0x6a10('0xaf')][_0x6a10('0xac')][_0x6a10('0xab')],'custom':![],'options':_0x13cddf};_0x1d8868[_0x6a10('0x9e')](_0x17510f);return _0x1d8868;});}function getBooleanList(_0x5001cf,_0x158a99,_0x219d6c,_0x95b9fd,_0x41d8d3,_0x454221){var _0xdd9f04={'method':'GET','uri':_0x5001cf+_0x6a10('0x95')+_0x95b9fd+')/Attributes('+_0x41d8d3+_0x6a10('0xb0'),'headers':{'Authorization':_0x6a10('0x96')+_0x454221,'If-None-Match':null,'OData-Version':_0x6a10('0x92')},'json':!![]};return rp(_0xdd9f04)[_0x6a10('0xc')](function(_0x38c451){var _0x32b5d1=[];_0x32b5d1[_0x6a10('0x9e')]({'name':_0x38c451['OptionSet'][_0x6a10('0xb1')]['Label']['UserLocalizedLabel'][_0x6a10('0xab')],'value':_0x6a10('0xb2')},{'name':_0x38c451[_0x6a10('0xb3')][_0x6a10('0xb4')][_0x6a10('0xab')][_0x6a10('0xac')][_0x6a10('0xab')],'value':'false'});var _0x55668c={'id':_0x158a99+'_'+_0x38c451['LogicalName'],'name':_0x38c451[_0x6a10('0xaf')][_0x6a10('0xac')][_0x6a10('0xab')],'custom':![],'options':_0x32b5d1};_0x219d6c[_0x6a10('0x9e')](_0x55668c);return _0x219d6c;});}function getInputList(_0x43bd17,_0x41ec40,_0xd6cab3,_0x1bf2e9,_0xe1e79,_0x475fd8,_0x26c2e7){var _0x259d5d={'method':_0x6a10('0x91'),'uri':_0x43bd17+_0x6a10('0x95')+_0xe1e79+')/Attributes('+_0x475fd8+')/Microsoft.Dynamics.CRM.'+_0xd6cab3+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x6a10('0x96')+_0x26c2e7,'If-None-Match':null,'OData-Version':_0x6a10('0x92')},'json':!![]};return rp(_0x259d5d)[_0x6a10('0xc')](function(_0x1e0923){var _0x241716={'id':_0x41ec40+'_'+_0x1e0923[_0x6a10('0xae')],'name':_0x1e0923[_0x6a10('0xaf')][_0x6a10('0xac')]?_0x1e0923['DisplayName'][_0x6a10('0xac')]['Label']:_0x1e0923[_0x6a10('0xae')],'custom':![],'options':[]};_0x1bf2e9['push'](_0x241716);return _0x1bf2e9;});} \ No newline at end of file +var _0x210b=['timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','api','../../mysqldb','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','status','send','index','map','Dynamics365Account','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','ticketnumber'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x210b,0xfa));var _0xb210=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x210b[_0xea8947];return _0x2455e9;};'use strict';var rp=require('request-promise');var util=require(_0xb210('0x0'));var _=require(_0xb210('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xb210('0x2'))(_0xb210('0x3'));var db=require(_0xb210('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x3673e6,_0x593960){_0x593960=_0x593960||0xc8;return function(_0x1d1594){if(_0x1d1594){return _0x3673e6['status'](_0x593960)[_0xb210('0x5')](_0x1d1594);}};}function respondWithFilteredResult(_0x3177de,_0x5da442){return function(_0x15c027){if(_0x15c027){var _0x311d1e=typeof _0x5da442[_0xb210('0x6')]===_0xb210('0x7')&&typeof _0x5da442[_0xb210('0x8')]===_0xb210('0x7');var _0x34d5e9=_0x15c027[_0xb210('0x9')];var _0xaa28a1=_0x311d1e?0x0:_0x5da442[_0xb210('0x6')];var _0x5a535c=_0x311d1e?_0x15c027['count']:_0x5da442['offset']+_0x5da442[_0xb210('0x8')];var _0x2d2eae;if(_0x5a535c>=_0x34d5e9){_0x5a535c=_0x34d5e9;_0x2d2eae=0xc8;}else{_0x2d2eae=0xce;}_0x3177de['status'](_0x2d2eae);return _0x3177de[_0xb210('0xa')](_0xb210('0xb'),_0xaa28a1+'-'+_0x5a535c+'/'+_0x34d5e9)[_0xb210('0x5')](_0x15c027);}return null;};}function saveUpdates(_0x1a138){return function(_0x4c2707){if(_0x4c2707){return _0x4c2707[_0xb210('0xc')](_0x1a138)[_0xb210('0xd')](function(_0x1ae717){return _0x1ae717;});}return null;};}function removeEntity(_0x3cb7cb){return function(_0x2d1b70){if(_0x2d1b70){return _0x2d1b70[_0xb210('0xe')]()['then'](function(){_0x3cb7cb['status'](0xcc)[_0xb210('0xf')]();});}};}function handleEntityNotFound(_0x4eafc1){return function(_0x3a1898){if(!_0x3a1898){_0x4eafc1[_0xb210('0x10')](0x194);}return _0x3a1898;};}function handleError(_0x21c1db,_0x15871d){_0x15871d=_0x15871d||0x1f4;return function(_0x246675){logger[_0xb210('0x11')](_0x246675[_0xb210('0x12')]);if(_0x246675[_0xb210('0x13')]){delete _0x246675[_0xb210('0x13')];}_0x21c1db[_0xb210('0x14')](_0x15871d)[_0xb210('0x15')](_0x246675);};}exports[_0xb210('0x16')]=function(_0x4caf80,_0x1ef347){var _0x449271={},_0x50c5d2={},_0x47b4cc={'count':0x0,'rows':[]};var _0x3322cb=_[_0xb210('0x17')](db[_0xb210('0x18')]['rawAttributes'],function(_0x1f6c34){return{'name':_0x1f6c34[_0xb210('0x19')],'type':_0x1f6c34['type'][_0xb210('0x1a')]};});_0x50c5d2[_0xb210('0x1b')]=_[_0xb210('0x17')](_0x3322cb,_0xb210('0x13'));_0x50c5d2[_0xb210('0x1c')]=_[_0xb210('0x1d')](_0x4caf80[_0xb210('0x1c')]);_0x50c5d2[_0xb210('0x1e')]=_[_0xb210('0x1f')](_0x50c5d2['model'],_0x50c5d2[_0xb210('0x1c')]);_0x449271['attributes']=_['intersection'](_0x50c5d2[_0xb210('0x1b')],qs[_0xb210('0x20')](_0x4caf80['query'][_0xb210('0x20')]));_0x449271[_0xb210('0x21')]=_0x449271[_0xb210('0x21')][_0xb210('0x22')]?_0x449271['attributes']:_0x50c5d2[_0xb210('0x1b')];if(!_0x4caf80['query'][_0xb210('0x23')]('nolimit')){_0x449271['limit']=qs[_0xb210('0x8')](_0x4caf80[_0xb210('0x1c')][_0xb210('0x8')]);_0x449271['offset']=qs[_0xb210('0x6')](_0x4caf80[_0xb210('0x1c')]['offset']);}_0x449271['order']=qs['sort'](_0x4caf80[_0xb210('0x1c')][_0xb210('0x24')]);_0x449271[_0xb210('0x25')]=qs[_0xb210('0x1e')](_[_0xb210('0x26')](_0x4caf80['query'],_0x50c5d2[_0xb210('0x1e')]),_0x3322cb);if(_0x4caf80[_0xb210('0x1c')][_0xb210('0x27')]){_0x449271[_0xb210('0x25')]=_['merge'](_0x449271[_0xb210('0x25')],{'$or':_[_0xb210('0x17')](_0x3322cb,function(_0x31d847){if(_0x31d847[_0xb210('0x28')]!=='VIRTUAL'){var _0x1407c4={};_0x1407c4[_0x31d847[_0xb210('0x13')]]={'$like':'%'+_0x4caf80['query'][_0xb210('0x27')]+'%'};return _0x1407c4;}})});}_0x449271=_[_0xb210('0x29')]({},_0x449271,_0x4caf80['options']);var _0x1eda37={'where':_0x449271[_0xb210('0x25')]};return db[_0xb210('0x18')]['count'](_0x1eda37)[_0xb210('0xd')](function(_0x17f21f){_0x47b4cc[_0xb210('0x9')]=_0x17f21f;if(_0x4caf80[_0xb210('0x1c')][_0xb210('0x2a')]){_0x449271[_0xb210('0x2b')]=[{'all':!![]}];}return db[_0xb210('0x18')]['findAll'](_0x449271);})[_0xb210('0xd')](function(_0x542360){_0x47b4cc[_0xb210('0x2c')]=_0x542360;return _0x47b4cc;})[_0xb210('0xd')](respondWithFilteredResult(_0x1ef347,_0x449271))[_0xb210('0x2d')](handleError(_0x1ef347,null));};exports[_0xb210('0x2e')]=function(_0x11222e,_0x2cd092){var _0x1495a2={'raw':![],'where':{'id':_0x11222e[_0xb210('0x2f')]['id']}},_0x59da11={};_0x59da11[_0xb210('0x1b')]=_[_0xb210('0x1d')](db['Dynamics365Account'][_0xb210('0x30')]);_0x59da11['query']=_[_0xb210('0x1d')](_0x11222e[_0xb210('0x1c')]);_0x59da11[_0xb210('0x1e')]=_['intersection'](_0x59da11[_0xb210('0x1b')],_0x59da11['query']);_0x1495a2[_0xb210('0x21')]=_[_0xb210('0x1f')](_0x59da11[_0xb210('0x1b')],qs[_0xb210('0x20')](_0x11222e['query'][_0xb210('0x20')]));_0x1495a2[_0xb210('0x21')]=_0x1495a2[_0xb210('0x21')][_0xb210('0x22')]?_0x1495a2[_0xb210('0x21')]:_0x59da11[_0xb210('0x1b')];if(_0x11222e[_0xb210('0x1c')][_0xb210('0x2a')]){_0x1495a2[_0xb210('0x2b')]=[{'all':!![]}];}_0x1495a2=_['merge']({},_0x1495a2,_0x11222e[_0xb210('0x31')]);return db[_0xb210('0x18')][_0xb210('0x32')](_0x1495a2)[_0xb210('0xd')](handleEntityNotFound(_0x2cd092,null))[_0xb210('0xd')](respondWithResult(_0x2cd092,null))[_0xb210('0x2d')](handleError(_0x2cd092,null));};exports[_0xb210('0x33')]=function(_0x41db25,_0x1555fe){return db[_0xb210('0x18')][_0xb210('0x33')](_0x41db25['body'],{})[_0xb210('0xd')](respondWithResult(_0x1555fe,0xc9))[_0xb210('0x2d')](handleError(_0x1555fe,null));};exports[_0xb210('0xc')]=function(_0x5510f7,_0x544e52){if(_0x5510f7[_0xb210('0x34')]['id']){delete _0x5510f7[_0xb210('0x34')]['id'];}return db['Dynamics365Account'][_0xb210('0x32')]({'where':{'id':_0x5510f7['params']['id']}})[_0xb210('0xd')](handleEntityNotFound(_0x544e52,null))['then'](saveUpdates(_0x5510f7[_0xb210('0x34')],null))[_0xb210('0xd')](respondWithResult(_0x544e52,null))[_0xb210('0x2d')](handleError(_0x544e52,null));};exports[_0xb210('0xe')]=function(_0x141410,_0x2e35f5){return db['Dynamics365Account'][_0xb210('0x32')]({'where':{'id':_0x141410[_0xb210('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2e35f5,null))['then'](removeEntity(_0x2e35f5,null))[_0xb210('0x2d')](handleError(_0x2e35f5,null));};exports['getConfigurations']=function(_0x1f1db2,_0x1aa6e1){var _0x4286d1={};var _0xe375ab={};var _0x5aa616;var _0x2b9650;return db[_0xb210('0x18')]['findOne']({'where':{'id':_0x1f1db2[_0xb210('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1aa6e1,null))['then'](function(_0x5084d1){if(_0x5084d1){_0x5aa616=_0x5084d1;_0xe375ab[_0xb210('0x1b')]=_[_0xb210('0x1d')](db['Dynamics365Configuration'][_0xb210('0x30')]);_0xe375ab['query']=_[_0xb210('0x1d')](_0x1f1db2[_0xb210('0x1c')]);_0xe375ab['filters']=_['intersection'](_0xe375ab[_0xb210('0x1b')],_0xe375ab[_0xb210('0x1c')]);_0x4286d1[_0xb210('0x21')]=_[_0xb210('0x1f')](_0xe375ab['model'],qs[_0xb210('0x20')](_0x1f1db2[_0xb210('0x1c')][_0xb210('0x20')]));_0x4286d1[_0xb210('0x21')]=_0x4286d1[_0xb210('0x21')][_0xb210('0x22')]?_0x4286d1[_0xb210('0x21')]:_0xe375ab[_0xb210('0x1b')];_0x4286d1['order']=qs[_0xb210('0x24')](_0x1f1db2[_0xb210('0x1c')][_0xb210('0x24')]);_0x4286d1[_0xb210('0x25')]=qs[_0xb210('0x1e')](_[_0xb210('0x26')](_0x1f1db2[_0xb210('0x1c')],_0xe375ab['filters']));if(_0x1f1db2[_0xb210('0x1c')][_0xb210('0x27')]){_0x4286d1[_0xb210('0x25')]=_[_0xb210('0x29')](_0x4286d1[_0xb210('0x25')],{'$or':_[_0xb210('0x17')](_0x4286d1[_0xb210('0x21')],function(_0x364276){var _0x3bd151={};_0x3bd151[_0x364276]={'$like':'%'+_0x1f1db2[_0xb210('0x1c')][_0xb210('0x27')]+'%'};return _0x3bd151;})});}_0x4286d1=_[_0xb210('0x29')]({},_0x4286d1,_0x1f1db2[_0xb210('0x31')]);return _0x5aa616[_0xb210('0x35')](_0x4286d1);}})[_0xb210('0xd')](function(_0x141afc){if(_0x141afc){_0x2b9650=_0x141afc['length'];if(!_0x1f1db2['query'][_0xb210('0x23')](_0xb210('0x36'))){_0x4286d1[_0xb210('0x8')]=qs['limit'](_0x1f1db2[_0xb210('0x1c')][_0xb210('0x8')]);_0x4286d1[_0xb210('0x6')]=qs[_0xb210('0x6')](_0x1f1db2['query']['offset']);}return _0x5aa616[_0xb210('0x35')](_0x4286d1);}})['then'](function(_0x160355){if(_0x160355){return _0x160355?{'count':_0x2b9650,'rows':_0x160355}:null;}})[_0xb210('0xd')](respondWithResult(_0x1aa6e1,null))[_0xb210('0x2d')](handleError(_0x1aa6e1,null));};exports[_0xb210('0x37')]=function(_0x275222,_0x4f3a08){if(_0x275222[_0xb210('0x34')]['id']){delete _0x275222[_0xb210('0x34')]['id'];}return db[_0xb210('0x18')][_0xb210('0x38')]({'where':{'id':_0x275222['params']['id']}})['then'](handleEntityNotFound(_0x4f3a08,null))['then'](function(_0xf84a94){if(_0xf84a94){_0x275222[_0xb210('0x34')][_0xb210('0x39')]=_0xf84a94['id'];_0x275222[_0xb210('0x34')][_0xb210('0x3a')]=integrations['getSubjects'](_0x275222[_0xb210('0x34')]['channel'],_0x275222[_0xb210('0x34')][_0xb210('0x28')]);_0x275222[_0xb210('0x34')][_0xb210('0x3b')]=integrations[_0xb210('0x3c')](_0x275222['body'][_0xb210('0x3d')],_0x275222[_0xb210('0x34')][_0xb210('0x28')]);return db[_0xb210('0x3e')][_0xb210('0x33')](_0x275222[_0xb210('0x34')],{'include':[{'model':db[_0xb210('0x3f')],'as':_0xb210('0x3a')},{'model':db[_0xb210('0x3f')],'as':_0xb210('0x3b')}]});}return null;})[_0xb210('0xd')](respondWithResult(_0x4f3a08,null))[_0xb210('0x2d')](handleError(_0x4f3a08,null));};function sanitizeRemoteUri(_0x2f7c74){var _0x3a1ffb=_0x2f7c74['slice'](-0x1);if(_0x3a1ffb==='/')return _0x2f7c74[_0xb210('0x40')](0x0,_0x2f7c74[_0xb210('0x41')](_0x3a1ffb));return _0x2f7c74;}function getWebApiUrl(_0x2dff5c){return util[_0xb210('0x42')](_0xb210('0x43'),_0x2dff5c);}exports[_0xb210('0x44')]=function(_0x422c9e,_0x15bbd3){var _0x598bc0=_0x422c9e[_0xb210('0x1c')]['ticketType'];var _0x4d6059=_0x598bc0===_0xb210('0x45')?_0xb210('0x46'):_0xb210('0x47');var _0x16322e='';var _0x528ba1='';var _0x5ea379='';var _0xcfbdae='';var _0x4cfda9='';var _0x3eeac2='';var _0x19a696='';var _0x258e67='';var _0x51f158=[_0xb210('0x48'),_0xb210('0x49'),_0xb210('0x4a'),_0xb210('0x4b'),_0xb210('0x4c'),_0xb210('0x4d'),_0xb210('0x4e'),_0xb210('0x4f'),_0xb210('0x50'),_0xb210('0x51')];var _0x1a6424=['accountidname',_0xb210('0x52'),'actualserviceunits',_0xb210('0x53'),_0xb210('0x54'),_0xb210('0x55'),'contractdetailidname','contractidname',_0xb210('0x56'),_0xb210('0x57'),_0xb210('0x58'),_0xb210('0x59'),_0xb210('0x5a'),'createdonbehalfbyname',_0xb210('0x5b'),_0xb210('0x5c'),'customeridtype',_0xb210('0x5d'),_0xb210('0x5e'),_0xb210('0x5f'),_0xb210('0x60'),_0xb210('0x61'),_0xb210('0x62'),'exchangerate',_0xb210('0x63'),'followupby',_0xb210('0x64'),'influencescore',_0xb210('0x65'),_0xb210('0x66'),_0xb210('0x67'),_0xb210('0x68'),_0xb210('0x69'),_0xb210('0x6a'),_0xb210('0x6b'),'modifiedon','modifiedonbehalfbyname',_0xb210('0x6c'),_0xb210('0x6d'),_0xb210('0x6e'),_0xb210('0x6f'),_0xb210('0x70'),_0xb210('0x71'),_0xb210('0x72'),_0xb210('0x73'),_0xb210('0x74'),_0xb210('0x75'),_0xb210('0x76'),_0xb210('0x77'),_0xb210('0x78'),_0xb210('0x79'),'productserialnumber','resolveby',_0xb210('0x7a'),_0xb210('0x7b'),_0xb210('0x7c'),_0xb210('0x7d'),_0xb210('0x7e'),_0xb210('0x7f'),_0xb210('0x80'),_0xb210('0x81'),_0xb210('0x82'),'statuscode','subjectidname',_0xb210('0x83'),_0xb210('0x84'),_0xb210('0x85'),_0xb210('0x86'),_0xb210('0x87'),_0xb210('0x88')];var _0x533901=_0x51f158['concat'](_0x1a6424);return db['Dynamics365Account'][_0xb210('0x38')]({'where':{'id':_0x422c9e[_0xb210('0x2f')]['id']},'attributes':['id',_0xb210('0x89'),_0xb210('0x8a'),_0xb210('0x8b'),_0xb210('0x8c'),'clientId',_0xb210('0x8d'),_0xb210('0x8e')],'include':[{'model':db[_0xb210('0x8f')],'as':'CloudProvider','attributes':['id',_0xb210('0x90'),_0xb210('0x91')]}]})[_0xb210('0xd')](handleEntityNotFound(_0x15bbd3,null))[_0xb210('0xd')](function(_0x294dbf){if(_0x294dbf){if(_0x294dbf[_0xb210('0x8e')]){_0x294dbf['access_token']=_0x294dbf[_0xb210('0x8f')]['data5'];_0x258e67=sanitizeRemoteUri(_0x294dbf[_0xb210('0x8f')][_0xb210('0x91')]);_0x19a696=getWebApiUrl(_0x258e67);return _0x294dbf;}_0x258e67=sanitizeRemoteUri(_0x294dbf['remoteUri']);_0x19a696=getWebApiUrl(_0x258e67);var _0x56ac03={'method':_0xb210('0x92'),'uri':'https://login.microsoftonline.com/'+_0x294dbf[_0xb210('0x8c')]+_0xb210('0x93'),'form':{'client_id':_0x294dbf['clientId'],'resource':_0x258e67,'username':_0x294dbf[_0xb210('0x89')],'password':_0x294dbf[_0xb210('0x8a')],'grant_type':_0xb210('0x8a'),'client_secret':_0x294dbf[_0xb210('0x8d')]},'json':!![]};return rp(_0x56ac03);}})[_0xb210('0xd')](function(_0x48058a){_0x3eeac2=_0x48058a['access_token'];var _0x5129e5={'method':_0xb210('0x94'),'uri':encodeURI(_0x19a696+_0xb210('0x95')+_0x4d6059+'\x27'),'headers':{'Authorization':_0xb210('0x96')+_0x3eeac2,'If-None-Match':null,'OData-Version':_0xb210('0x97')},'json':!![]};return rp(_0x5129e5);})[_0xb210('0xd')](function(_0x3782d9){var _0x3cdb9d=_0x3782d9[_0xb210('0x98')][0x0];var _0x3db4e1=_0x3cdb9d[_0xb210('0x99')];var _0x326144={'method':_0xb210('0x94'),'uri':_0x19a696+_0xb210('0x9a')+_0x3db4e1+_0xb210('0x9b'),'headers':{'Authorization':_0xb210('0x96')+_0x3eeac2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x326144);})[_0xb210('0xd')](function(_0x1498eb){_0x16322e=_0x1498eb;_0x528ba1=_0x16322e[_0xb210('0x9c')];_0x528ba1=_[_0xb210('0x9d')](_0x528ba1,function(_0x3720bc){return!_0x533901[_0xb210('0x9e')](_0x3720bc[_0xb210('0x9f')]);});var _0x549a5e=[];var _0x5b1a53=[];_0x528ba1[_0xb210('0xa0')](function(_0x34cc92){if(_0x34cc92[_0xb210('0xa1')]){var _0x292beb=_0x34cc92[_0xb210('0xa1')][_0xb210('0x40')](_0x34cc92['@odata.type'][_0xb210('0x41')]('.')+0x1);if(_0x292beb==='PicklistAttributeMetadata'){_0x549a5e['push'](getSelectList(_0x19a696,_0x598bc0,_0x5b1a53,_0x16322e[_0xb210('0x99')],_0x34cc92[_0xb210('0x99')],_0x3eeac2));}}});return Promise[_0xb210('0xa2')](_0x549a5e);})[_0xb210('0xd')](function(_0x449ea1){_0x5ea379=_0x449ea1[0x0];var _0x2db6b3=[];var _0x536831=[];_0x528ba1[_0xb210('0xa0')](function(_0x52cbdd){if(!_[_0xb210('0xa3')](_0x52cbdd[_0xb210('0xa1')])){var _0x2b0c98=_0x52cbdd[_0xb210('0xa1')]['substring'](_0x52cbdd['@odata.type'][_0xb210('0x41')]('.')+0x1);if(_0x2b0c98===_0xb210('0xa4')){_0x2db6b3[_0xb210('0xa5')](getBooleanList(_0x19a696,_0x598bc0,_0x536831,_0x16322e['MetadataId'],_0x52cbdd[_0xb210('0x99')],_0x3eeac2));}}});return Promise[_0xb210('0xa2')](_0x2db6b3);})['then'](function(_0x3ea873){_0xcfbdae=_0x3ea873[0x0];var _0x5a23e4=[];var _0xe525e6=[];_0x528ba1[_0xb210('0xa0')](function(_0x5915d5){if(_0x5915d5[_0xb210('0xa1')]){var _0x1dbe3d=_0x5915d5[_0xb210('0xa1')]['substring'](_0x5915d5[_0xb210('0xa1')][_0xb210('0x41')]('.')+0x1);if(_0x1dbe3d===_0xb210('0xa6')||_0x1dbe3d===_0xb210('0xa7')||_0x1dbe3d===_0xb210('0xa8')||_0x1dbe3d===_0xb210('0xa9')||_0x1dbe3d===_0xb210('0xaa')||_0x1dbe3d==='DateTimeAttributeMetadata'||_0x1dbe3d==='StatusAttributeMetadata'||_0x1dbe3d===_0xb210('0xab')||_0x1dbe3d==='StateAttributeMetadata'||_0x1dbe3d===_0xb210('0xac')){_0x5a23e4[_0xb210('0xa5')](getInputList(_0x19a696,_0x598bc0,_0x1dbe3d,_0xe525e6,_0x16322e[_0xb210('0x99')],_0x5915d5[_0xb210('0x99')],_0x3eeac2));}}});return Promise[_0xb210('0xa2')](_0x5a23e4);})[_0xb210('0xd')](function(_0x186e57){_0x4cfda9=_0x186e57[0x0];var _0x5255a0=_0x5ea379[_0xb210('0xad')](_0xcfbdae)['concat'](_0x4cfda9);var _0x116547={'count':_0x5255a0['length'],'rows':_0x5255a0};return _0x116547;})[_0xb210('0xd')](respondWithResult(_0x15bbd3,null))['catch'](function(_0x1c5760){var _0xde62a=_0x422c9e[_0xb210('0x1c')][_0xb210('0xae')]?0x1f4:_0x1c5760['statusCode']||0x1f4;logger[_0xb210('0x11')](_0x1c5760['stack']);delete _0x1c5760[_0xb210('0x13')];if(_0xde62a===0x191){_0xde62a=0x190;}_0x15bbd3[_0xb210('0x14')](_0xde62a)['send'](_0x422c9e['query'][_0xb210('0xae')]?{'message':_0xb210('0xaf'),'statusCode':_0x1c5760[_0xb210('0xb0')]}:_0x1c5760);});};function getSelectList(_0x1db346,_0x595037,_0x2e0910,_0x40f125,_0x120173,_0x486c6e){var _0x1ac710={'method':_0xb210('0x94'),'uri':_0x1db346+'EntityDefinitions('+_0x40f125+_0xb210('0xb1')+_0x120173+_0xb210('0xb2')+_0xb210('0xb3'),'headers':{'Authorization':_0xb210('0x96')+_0x486c6e,'If-None-Match':null,'OData-Version':_0xb210('0x97')},'json':!![]};return rp(_0x1ac710)[_0xb210('0xd')](function(_0x3016a5){var _0x41b2e0=[];var _0x451bb0=_0x3016a5[_0xb210('0xb4')][_0xb210('0xb5')];_0x451bb0[_0xb210('0xa0')](function(_0x583e9d){_0x41b2e0[_0xb210('0xa5')]({'name':_0x583e9d[_0xb210('0xb6')][_0xb210('0xb7')][_0xb210('0xb6')],'value':String(_0x583e9d[_0xb210('0xb8')])});});var _0x164aa0={'id':_0x595037+'_'+_0x3016a5['LogicalName'],'name':_0x3016a5[_0xb210('0xb9')][_0xb210('0xb7')][_0xb210('0xb6')],'custom':![],'options':_0x41b2e0};_0x2e0910[_0xb210('0xa5')](_0x164aa0);return _0x2e0910;});}function getBooleanList(_0xaece97,_0x171d2e,_0x516eff,_0x11ff7d,_0x558693,_0x2ae55a){var _0xcdaa4c={'method':_0xb210('0x94'),'uri':_0xaece97+'EntityDefinitions('+_0x11ff7d+_0xb210('0xb1')+_0x558693+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x2ae55a,'If-None-Match':null,'OData-Version':_0xb210('0x97')},'json':!![]};return rp(_0xcdaa4c)[_0xb210('0xd')](function(_0x4ba63d){var _0xf1cd98=[];_0xf1cd98[_0xb210('0xa5')]({'name':_0x4ba63d['OptionSet'][_0xb210('0xba')][_0xb210('0xb6')]['UserLocalizedLabel'][_0xb210('0xb6')],'value':_0xb210('0xbb')},{'name':_0x4ba63d[_0xb210('0xb4')][_0xb210('0xbc')][_0xb210('0xb6')][_0xb210('0xb7')][_0xb210('0xb6')],'value':_0xb210('0xbd')});var _0x4f62d2={'id':_0x171d2e+'_'+_0x4ba63d['LogicalName'],'name':_0x4ba63d[_0xb210('0xb9')][_0xb210('0xb7')]['Label'],'custom':![],'options':_0xf1cd98};_0x516eff[_0xb210('0xa5')](_0x4f62d2);return _0x516eff;});}function getInputList(_0xe68b49,_0x592148,_0x4ee594,_0x23df6,_0x3a5994,_0x28f76f,_0x4c93b6){var _0x1f1203={'method':_0xb210('0x94'),'uri':_0xe68b49+_0xb210('0x9a')+_0x3a5994+_0xb210('0xb1')+_0x28f76f+')/Microsoft.Dynamics.CRM.'+_0x4ee594+_0xb210('0xbe'),'headers':{'Authorization':_0xb210('0x96')+_0x4c93b6,'If-None-Match':null,'OData-Version':_0xb210('0x97')},'json':!![]};return rp(_0x1f1203)[_0xb210('0xd')](function(_0x37a804){var _0x1062f8={'id':_0x592148+'_'+_0x37a804[_0xb210('0x9f')],'name':_0x37a804[_0xb210('0xb9')][_0xb210('0xb7')]?_0x37a804[_0xb210('0xb9')][_0xb210('0xb7')][_0xb210('0xb6')]:_0x37a804[_0xb210('0x9f')],'custom':![],'options':[]};_0x23df6['push'](_0x1062f8);return _0x23df6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 82012a0..4b2059e 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(_0xefa11c,_0x2516a2){var _0x26bdd9=function(_0x3d373a){while(--_0x3d373a){_0xefa11c['push'](_0xefa11c['shift']());}};_0x26bdd9(++_0x2516a2);}(_0xe706,0xa3));var _0x6e70=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xe706[_0x2459fd];return _0x364cd2;};'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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x485324,_0x3c8148){var _0x3ca838=function(_0x3a96df){while(--_0x3a96df){_0x485324['push'](_0x485324['shift']());}};_0x3ca838(++_0x3c8148);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','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 45332fd..80ded29 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 _0xb398=['http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Dynamics365Account','findAll','options','raw','map','include','model','attributes','GetDynamics365Account','ShowDynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3960a3,_0x5e59b8){var _0x2e103b=function(_0x1255a1){while(--_0x1255a1){_0x3960a3['push'](_0x3960a3['shift']());}};_0x2e103b(++_0x5e59b8);}(_0xb398,0x128));var _0x8b39=function(_0x8dec1d,_0x2a10f4){_0x8dec1d=_0x8dec1d-0x0;var _0x46d69c=_0xb398[_0x8dec1d];return _0x46d69c;};'use strict';var _=require(_0x8b39('0x0'));var util=require(_0x8b39('0x1'));var moment=require(_0x8b39('0x2'));var BPromise=require(_0x8b39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b39('0x5'));var logger=require('../../config/logger')(_0x8b39('0x6'));var config=require(_0x8b39('0x7'));var jayson=require(_0x8b39('0x8'));var client=jayson[_0x8b39('0x9')][_0x8b39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4989c3,_0x12bdb8,_0x3f1de0){return new BPromise(function(_0x143979,_0xc1fd21){return client[_0x8b39('0xb')](_0x4989c3,_0x3f1de0)[_0x8b39('0xc')](function(_0xce78e0){logger['info'](_0x8b39('0xd'),_0x12bdb8,_0x8b39('0xe'));logger[_0x8b39('0xf')](_0x8b39('0x10'),_0x12bdb8,_0x8b39('0xe'),JSON[_0x8b39('0x11')](_0xce78e0));if(_0xce78e0[_0x8b39('0x12')]){if(_0xce78e0[_0x8b39('0x12')]['code']===0x1f4){logger[_0x8b39('0x12')](_0x8b39('0xd'),_0x12bdb8,_0xce78e0[_0x8b39('0x12')][_0x8b39('0x13')]);return _0xc1fd21(_0xce78e0['error'][_0x8b39('0x13')]);}logger[_0x8b39('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x12bdb8,_0xce78e0[_0x8b39('0x12')]['message']);return _0x143979(_0xce78e0['error'][_0x8b39('0x13')]);}else{logger[_0x8b39('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x12bdb8,'request\x20sent');_0x143979(_0xce78e0[_0x8b39('0x15')][_0x8b39('0x13')]);}})[_0x8b39('0x16')](function(_0x3318da){logger['error'](_0x8b39('0xd'),_0x12bdb8,_0x3318da);_0xc1fd21(_0x3318da);});});}exports['GetDynamics365Account']=function(_0x501190){var _0x172252=this;return new Promise(function(_0x1b0740,_0x410e95){return db[_0x8b39('0x17')][_0x8b39('0x18')]({'raw':_0x501190[_0x8b39('0x19')]?_0x501190[_0x8b39('0x19')][_0x8b39('0x1a')]===undefined?!![]:![]:!![],'where':_0x501190['options']?_0x501190[_0x8b39('0x19')]['where']||null:null,'attributes':_0x501190[_0x8b39('0x19')]?_0x501190[_0x8b39('0x19')]['attributes']||null:null,'limit':_0x501190[_0x8b39('0x19')]?_0x501190['options']['limit']||null:null,'include':_0x501190['options']?_0x501190['options']['include']?_[_0x8b39('0x1b')](_0x501190[_0x8b39('0x19')][_0x8b39('0x1c')],function(_0x80ddf4){return{'model':db[_0x80ddf4[_0x8b39('0x1d')]],'as':_0x80ddf4['as'],'attributes':_0x80ddf4[_0x8b39('0x1e')],'include':_0x80ddf4[_0x8b39('0x1c')]?_['map'](_0x80ddf4[_0x8b39('0x1c')],function(_0x291608){return{'model':db[_0x291608[_0x8b39('0x1d')]],'as':_0x291608['as'],'attributes':_0x291608[_0x8b39('0x1e')],'include':_0x291608['include']?_[_0x8b39('0x1b')](_0x291608['include'],function(_0x2be3ec){return{'model':db[_0x2be3ec['model']],'as':_0x2be3ec['as'],'attributes':_0x2be3ec['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b25ad){logger[_0x8b39('0x14')](_0x8b39('0x1f'),_0x501190);logger[_0x8b39('0xf')]('GetDynamics365Account',_0x501190,JSON[_0x8b39('0x11')](_0x2b25ad));_0x1b0740(_0x2b25ad);})['catch'](function(_0x505747){logger[_0x8b39('0x12')](_0x8b39('0x1f'),_0x505747['message'],_0x501190);_0x410e95(_0x172252[_0x8b39('0x12')](0x1f4,_0x505747[_0x8b39('0x13')]));});});};exports[_0x8b39('0x20')]=function(_0x16e118){var _0x4b8b3c=this;return new Promise(function(_0x523dff,_0x53e0a5){return db[_0x8b39('0x17')][_0x8b39('0x21')]({'raw':_0x16e118[_0x8b39('0x19')]?_0x16e118[_0x8b39('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x16e118[_0x8b39('0x19')]?_0x16e118['options']['where']||null:null,'attributes':_0x16e118[_0x8b39('0x19')]?_0x16e118[_0x8b39('0x19')]['attributes']||null:null,'include':_0x16e118[_0x8b39('0x19')]?_0x16e118[_0x8b39('0x19')]['include']?_[_0x8b39('0x1b')](_0x16e118[_0x8b39('0x19')]['include'],function(_0x1a1a4d){return{'model':db[_0x1a1a4d[_0x8b39('0x1d')]],'as':_0x1a1a4d['as'],'attributes':_0x1a1a4d[_0x8b39('0x1e')],'include':_0x1a1a4d[_0x8b39('0x1c')]?_[_0x8b39('0x1b')](_0x1a1a4d[_0x8b39('0x1c')],function(_0x51671e){return{'model':db[_0x51671e['model']],'as':_0x51671e['as'],'attributes':_0x51671e[_0x8b39('0x1e')],'include':_0x51671e['include']?_[_0x8b39('0x1b')](_0x51671e['include'],function(_0x554d2a){return{'model':db[_0x554d2a['model']],'as':_0x554d2a['as'],'attributes':_0x554d2a[_0x8b39('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8b39('0xc')](function(_0xa1068d){logger['info'](_0x8b39('0x20'),_0x16e118);logger[_0x8b39('0xf')]('ShowDynamics365Account',_0x16e118,JSON[_0x8b39('0x11')](_0xa1068d));_0x523dff(_0xa1068d);})[_0x8b39('0x16')](function(_0x150857){logger[_0x8b39('0x12')](_0x8b39('0x20'),_0x150857[_0x8b39('0x13')],_0x16e118);_0x53e0a5(_0x4b8b3c['error'](0x1f4,_0x150857[_0x8b39('0x13')]));});});}; \ No newline at end of file +var _0xa2a5=['raw','where','attributes','limit','model','include','map','ShowDynamics365Account','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options'];(function(_0x217e32,_0x258354){var _0x585cb8=function(_0x40dfe1){while(--_0x40dfe1){_0x217e32['push'](_0x217e32['shift']());}};_0x585cb8(++_0x258354);}(_0xa2a5,0x1c5));var _0x5a2a=function(_0x2a6d6e,_0x798e86){_0x2a6d6e=_0x2a6d6e-0x0;var _0x571cf8=_0xa2a5[_0x2a6d6e];return _0x571cf8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a2a('0x0'));var BPromise=require(_0x5a2a('0x1'));var rs=require(_0x5a2a('0x2'));var fs=require('fs');var Redis=require(_0x5a2a('0x3'));var db=require(_0x5a2a('0x4'))['db'];var utils=require(_0x5a2a('0x5'));var logger=require(_0x5a2a('0x6'))(_0x5a2a('0x7'));var config=require(_0x5a2a('0x8'));var jayson=require(_0x5a2a('0x9'));var client=jayson['client'][_0x5a2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ba1e8,_0x20edbe,_0x29c26c){return new BPromise(function(_0x52a406,_0x2a1e86){return client[_0x5a2a('0xb')](_0x3ba1e8,_0x29c26c)[_0x5a2a('0xc')](function(_0x39f2cd){logger[_0x5a2a('0xd')](_0x5a2a('0xe'),_0x20edbe,_0x5a2a('0xf'));logger[_0x5a2a('0x10')](_0x5a2a('0x11'),_0x20edbe,_0x5a2a('0xf'),JSON[_0x5a2a('0x12')](_0x39f2cd));if(_0x39f2cd[_0x5a2a('0x13')]){if(_0x39f2cd[_0x5a2a('0x13')][_0x5a2a('0x14')]===0x1f4){logger[_0x5a2a('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x20edbe,_0x39f2cd[_0x5a2a('0x13')]['message']);return _0x2a1e86(_0x39f2cd[_0x5a2a('0x13')]['message']);}logger['error'](_0x5a2a('0xe'),_0x20edbe,_0x39f2cd[_0x5a2a('0x13')]['message']);return _0x52a406(_0x39f2cd[_0x5a2a('0x13')]['message']);}else{logger['info'](_0x5a2a('0xe'),_0x20edbe,'request\x20sent');_0x52a406(_0x39f2cd[_0x5a2a('0x15')][_0x5a2a('0x16')]);}})[_0x5a2a('0x17')](function(_0x285b9f){logger[_0x5a2a('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x20edbe,_0x285b9f);_0x2a1e86(_0x285b9f);});});}exports[_0x5a2a('0x18')]=function(_0x3f0c4c){var _0x5aafe8=this;return new Promise(function(_0x1a29b5,_0x4e3365){return db[_0x5a2a('0x19')][_0x5a2a('0x1a')]({'raw':_0x3f0c4c[_0x5a2a('0x1b')]?_0x3f0c4c[_0x5a2a('0x1b')][_0x5a2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f0c4c[_0x5a2a('0x1b')]?_0x3f0c4c[_0x5a2a('0x1b')][_0x5a2a('0x1d')]||null:null,'attributes':_0x3f0c4c[_0x5a2a('0x1b')]?_0x3f0c4c[_0x5a2a('0x1b')][_0x5a2a('0x1e')]||null:null,'limit':_0x3f0c4c[_0x5a2a('0x1b')]?_0x3f0c4c[_0x5a2a('0x1b')][_0x5a2a('0x1f')]||null:null,'include':_0x3f0c4c[_0x5a2a('0x1b')]?_0x3f0c4c[_0x5a2a('0x1b')]['include']?_['map'](_0x3f0c4c[_0x5a2a('0x1b')]['include'],function(_0x26741e){return{'model':db[_0x26741e[_0x5a2a('0x20')]],'as':_0x26741e['as'],'attributes':_0x26741e[_0x5a2a('0x1e')],'include':_0x26741e[_0x5a2a('0x21')]?_[_0x5a2a('0x22')](_0x26741e['include'],function(_0x5bd1b9){return{'model':db[_0x5bd1b9['model']],'as':_0x5bd1b9['as'],'attributes':_0x5bd1b9[_0x5a2a('0x1e')],'include':_0x5bd1b9[_0x5a2a('0x21')]?_[_0x5a2a('0x22')](_0x5bd1b9[_0x5a2a('0x21')],function(_0x404a65){return{'model':db[_0x404a65[_0x5a2a('0x20')]],'as':_0x404a65['as'],'attributes':_0x404a65['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a2a('0xc')](function(_0x130713){logger[_0x5a2a('0xd')]('GetDynamics365Account',_0x3f0c4c);logger[_0x5a2a('0x10')](_0x5a2a('0x18'),_0x3f0c4c,JSON[_0x5a2a('0x12')](_0x130713));_0x1a29b5(_0x130713);})[_0x5a2a('0x17')](function(_0xb09ce4){logger[_0x5a2a('0x13')]('GetDynamics365Account',_0xb09ce4[_0x5a2a('0x16')],_0x3f0c4c);_0x4e3365(_0x5aafe8[_0x5a2a('0x13')](0x1f4,_0xb09ce4[_0x5a2a('0x16')]));});});};exports[_0x5a2a('0x23')]=function(_0x3d552d){var _0x3e56f6=this;return new Promise(function(_0x122398,_0x35d749){return db['Dynamics365Account'][_0x5a2a('0x24')]({'raw':_0x3d552d[_0x5a2a('0x1b')]?_0x3d552d[_0x5a2a('0x1b')][_0x5a2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d552d['options']?_0x3d552d[_0x5a2a('0x1b')][_0x5a2a('0x1d')]||null:null,'attributes':_0x3d552d[_0x5a2a('0x1b')]?_0x3d552d[_0x5a2a('0x1b')][_0x5a2a('0x1e')]||null:null,'include':_0x3d552d[_0x5a2a('0x1b')]?_0x3d552d[_0x5a2a('0x1b')]['include']?_[_0x5a2a('0x22')](_0x3d552d[_0x5a2a('0x1b')][_0x5a2a('0x21')],function(_0x15e439){return{'model':db[_0x15e439[_0x5a2a('0x20')]],'as':_0x15e439['as'],'attributes':_0x15e439[_0x5a2a('0x1e')],'include':_0x15e439[_0x5a2a('0x21')]?_[_0x5a2a('0x22')](_0x15e439[_0x5a2a('0x21')],function(_0x9eda2f){return{'model':db[_0x9eda2f[_0x5a2a('0x20')]],'as':_0x9eda2f['as'],'attributes':_0x9eda2f[_0x5a2a('0x1e')],'include':_0x9eda2f['include']?_['map'](_0x9eda2f[_0x5a2a('0x21')],function(_0x1d1362){return{'model':db[_0x1d1362[_0x5a2a('0x20')]],'as':_0x1d1362['as'],'attributes':_0x1d1362[_0x5a2a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5a2a('0xc')](function(_0x384d17){logger[_0x5a2a('0xd')](_0x5a2a('0x23'),_0x3d552d);logger[_0x5a2a('0x10')](_0x5a2a('0x23'),_0x3d552d,JSON['stringify'](_0x384d17));_0x122398(_0x384d17);})[_0x5a2a('0x17')](function(_0x2d58ed){logger[_0x5a2a('0x13')](_0x5a2a('0x23'),_0x2d58ed['message'],_0x3d552d);_0x35d749(_0x3e56f6['error'](0x1f4,_0x2d58ed[_0x5a2a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1fa54ba..01f4f3b 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 _0x9334=['isAuthenticated','index','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4cd102,_0x2f1297){var _0x4c2fe4=function(_0x537db6){while(--_0x537db6){_0x4cd102['push'](_0x4cd102['shift']());}};_0x4c2fe4(++_0x2f1297);}(_0x9334,0x1f1));var _0x4933=function(_0x1855a8,_0x41db71){_0x1855a8=_0x1855a8-0x0;var _0xb9edff=_0x9334[_0x1855a8];return _0xb9edff;};'use strict';var multer=require(_0x4933('0x0'));var util=require('util');var path=require(_0x4933('0x1'));var timeout=require(_0x4933('0x2'));var express=require(_0x4933('0x3'));var router=express['Router']();var fs_extra=require(_0x4933('0x4'));var auth=require(_0x4933('0x5'));var interaction=require(_0x4933('0x6'));var config=require(_0x4933('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x4933('0x8')]('/',auth[_0x4933('0x9')](),controller[_0x4933('0xa')]);router[_0x4933('0x8')]('/:id',auth[_0x4933('0x9')](),controller[_0x4933('0xb')]);router[_0x4933('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4933('0xc')]);router[_0x4933('0x8')]('/:id/subjects',auth[_0x4933('0x9')](),controller[_0x4933('0xd')]);router['get'](_0x4933('0xe'),auth[_0x4933('0x9')](),controller[_0x4933('0xf')]);router[_0x4933('0x10')]('/',auth[_0x4933('0x9')](),controller[_0x4933('0x11')]);router['put'](_0x4933('0x12'),auth['isAuthenticated'](),controller[_0x4933('0x13')]);router[_0x4933('0x14')](_0x4933('0x12'),auth[_0x4933('0x9')](),controller[_0x4933('0x15')]);module[_0x4933('0x16')]=router; \ No newline at end of file +var _0x714d=['update','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put'];(function(_0x4abab9,_0xde21a4){var _0x374eba=function(_0x3659f7){while(--_0x3659f7){_0x4abab9['push'](_0x4abab9['shift']());}};_0x374eba(++_0xde21a4);}(_0x714d,0x167));var _0xd714=function(_0x41f78a,_0x13687c){_0x41f78a=_0x41f78a-0x0;var _0x2a1fef=_0x714d[_0x41f78a];return _0x2a1fef;};'use strict';var multer=require('multer');var util=require(_0xd714('0x0'));var path=require(_0xd714('0x1'));var timeout=require('connect-timeout');var express=require(_0xd714('0x2'));var router=express[_0xd714('0x3')]();var fs_extra=require(_0xd714('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd714('0x5'));var config=require('../../config/environment');var controller=require(_0xd714('0x6'));router['get']('/',auth[_0xd714('0x7')](),controller['index']);router[_0xd714('0x8')](_0xd714('0x9'),auth['isAuthenticated'](),controller[_0xd714('0xa')]);router[_0xd714('0x8')](_0xd714('0xb'),auth[_0xd714('0x7')](),controller[_0xd714('0xc')]);router['get'](_0xd714('0xd'),auth[_0xd714('0x7')](),controller[_0xd714('0xe')]);router['get'](_0xd714('0xf'),auth[_0xd714('0x7')](),controller['getDescriptions']);router[_0xd714('0x10')]('/',auth[_0xd714('0x7')](),controller[_0xd714('0x11')]);router[_0xd714('0x12')](_0xd714('0x9'),auth[_0xd714('0x7')](),controller[_0xd714('0x13')]);router['delete'](_0xd714('0x9'),auth['isAuthenticated'](),controller[_0xd714('0x14')]);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 1436531..bc7b190 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 _0xc867=['contact','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0xc867,0xf7));var _0x7c86=function(_0x37dce3,_0x1aff65){_0x37dce3=_0x37dce3-0x0;var _0x140841=_0xc867[_0x37dce3];return _0x140841;};'use strict';var Sequelize=require(_0x7c86('0x0'));module[_0x7c86('0x1')]={'name':{'type':Sequelize[_0x7c86('0x2')]},'description':{'type':Sequelize[_0x7c86('0x2')]},'ticketType':{'type':Sequelize[_0x7c86('0x3')](_0x7c86('0x4'),'phonecall'),'defaultValue':_0x7c86('0x4')},'moduleCreate':{'type':Sequelize[_0x7c86('0x3')](_0x7c86('0x5'),'nothing'),'defaultValue':_0x7c86('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7c86('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7c86('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9e9b=['STRING','ENUM','incident','phonecall','nothing','contact','BOOLEAN','sequelize','exports'];(function(_0x50d02f,_0x5b1cb){var _0x2e6778=function(_0x4b1ea9){while(--_0x4b1ea9){_0x50d02f['push'](_0x50d02f['shift']());}};_0x2e6778(++_0x5b1cb);}(_0x9e9b,0x103));var _0xb9e9=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0x9e9b[_0x5f12fd];return _0x58bd80;};'use strict';var Sequelize=require(_0xb9e9('0x0'));module[_0xb9e9('0x1')]={'name':{'type':Sequelize[_0xb9e9('0x2')]},'description':{'type':Sequelize[_0xb9e9('0x2')]},'ticketType':{'type':Sequelize[_0xb9e9('0x3')](_0xb9e9('0x4'),_0xb9e9('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0xb9e9('0x6')),'defaultValue':_0xb9e9('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb9e9('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xb9e9('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 98e6536..03cfeff 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 _0xe03d=['count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','pick','merge','where','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','getFields','findOne','Dynamics365Field','length','sort','filter','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe03d,0x89));var _0xde03=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xe03d[_0x587fb5];return _0x551105;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde03('0x0'));var zipdir=require(_0xde03('0x1'));var jsonpatch=require(_0xde03('0x2'));var rp=require(_0xde03('0x3'));var moment=require(_0xde03('0x4'));var BPromise=require(_0xde03('0x5'));var Mustache=require(_0xde03('0x6'));var util=require(_0xde03('0x7'));var path=require(_0xde03('0x8'));var sox=require(_0xde03('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde03('0xa'));var _=require(_0xde03('0xb'));var squel=require(_0xde03('0xc'));var crypto=require(_0xde03('0xd'));var jsforce=require(_0xde03('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xde03('0xf'));var querystring=require(_0xde03('0x10'));var Papa=require('papaparse');var Redis=require(_0xde03('0x11'));var authService=require(_0xde03('0x12'));var qs=require(_0xde03('0x13'));var as=require(_0xde03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xde03('0x15'));var utils=require(_0xde03('0x16'));var config=require(_0xde03('0x17'));var licenseUtil=require(_0xde03('0x18'));var db=require(_0xde03('0x19'))['db'];function respondWithStatusCode(_0x1fb238,_0x41db65){_0x41db65=_0x41db65||0xcc;return function(_0x47d3ba){if(_0x47d3ba){return _0x1fb238[_0xde03('0x1a')](_0x41db65);}return _0x1fb238[_0xde03('0x1b')](_0x41db65)[_0xde03('0x1c')]();};}function respondWithResult(_0x5b861d,_0x3ee326){_0x3ee326=_0x3ee326||0xc8;return function(_0x45e7a4){if(_0x45e7a4){return _0x5b861d['status'](_0x3ee326)['json'](_0x45e7a4);}};}function respondWithFilteredResult(_0x1e35f6,_0x34a7f0){return function(_0x4169c3){if(_0x4169c3){var _0xbaa44a=typeof _0x34a7f0[_0xde03('0x1d')]==='undefined'&&typeof _0x34a7f0['limit']===_0xde03('0x1e');var _0x1ad8ae=_0x4169c3[_0xde03('0x1f')];var _0x24e1d4=_0xbaa44a?0x0:_0x34a7f0['offset'];var _0x117866=_0xbaa44a?_0x4169c3['count']:_0x34a7f0[_0xde03('0x1d')]+_0x34a7f0[_0xde03('0x20')];var _0x309672;if(_0x117866>=_0x1ad8ae){_0x117866=_0x1ad8ae;_0x309672=0xc8;}else{_0x309672=0xce;}_0x1e35f6['status'](_0x309672);return _0x1e35f6[_0xde03('0x21')](_0xde03('0x22'),_0x24e1d4+'-'+_0x117866+'/'+_0x1ad8ae)[_0xde03('0x23')](_0x4169c3);}return null;};}function patchUpdates(_0x4bf177){return function(_0x3a7214){try{jsonpatch[_0xde03('0x24')](_0x3a7214,_0x4bf177,!![]);}catch(_0x36414e){return BPromise[_0xde03('0x25')](_0x36414e);}return _0x3a7214[_0xde03('0x26')]();};}function saveUpdates(_0x8283c2,_0x106c97){return function(_0x1faf06){if(_0x1faf06){return _0x1faf06[_0xde03('0x27')](_0x8283c2)[_0xde03('0x28')](function(_0x3a50e7){return _0x3a50e7;});}return null;};}function removeEntity(_0x3c0eb1,_0x536f00){return function(_0x17066f){if(_0x17066f){return _0x17066f[_0xde03('0x29')]()[_0xde03('0x28')](function(){_0x3c0eb1[_0xde03('0x1b')](0xcc)[_0xde03('0x1c')]();});}};}function handleEntityNotFound(_0x199041,_0x26ceb5){return function(_0xe0c178){if(!_0xe0c178){_0x199041[_0xde03('0x1a')](0x194);}return _0xe0c178;};}function handleError(_0x1bea9e,_0x22b69f){_0x22b69f=_0x22b69f||0x1f4;return function(_0x48f180){logger[_0xde03('0x2a')](_0x48f180[_0xde03('0x2b')]);if(_0x48f180[_0xde03('0x2c')]){delete _0x48f180[_0xde03('0x2c')];}_0x1bea9e['status'](_0x22b69f)[_0xde03('0x2d')](_0x48f180);};}exports[_0xde03('0x2e')]=function(_0x4ae3b0,_0x19ce7f){var _0x5eae6f={},_0x2d270b={},_0x2a3b1a={'count':0x0,'rows':[]};var _0x3ef7fa=_[_0xde03('0x2f')](db[_0xde03('0x30')][_0xde03('0x31')],function(_0x2faa0e){return{'name':_0x2faa0e['fieldName'],'type':_0x2faa0e['type'][_0xde03('0x32')]};});_0x2d270b[_0xde03('0x33')]=_[_0xde03('0x2f')](_0x3ef7fa,_0xde03('0x2c'));_0x2d270b[_0xde03('0x34')]=_['keys'](_0x4ae3b0[_0xde03('0x34')]);_0x2d270b[_0xde03('0x35')]=_[_0xde03('0x36')](_0x2d270b[_0xde03('0x33')],_0x2d270b[_0xde03('0x34')]);_0x5eae6f[_0xde03('0x37')]=_[_0xde03('0x36')](_0x2d270b[_0xde03('0x33')],qs[_0xde03('0x38')](_0x4ae3b0[_0xde03('0x34')]['fields']));_0x5eae6f[_0xde03('0x37')]=_0x5eae6f['attributes']['length']?_0x5eae6f['attributes']:_0x2d270b[_0xde03('0x33')];if(!_0x4ae3b0[_0xde03('0x34')][_0xde03('0x39')](_0xde03('0x3a'))){_0x5eae6f[_0xde03('0x20')]=qs[_0xde03('0x20')](_0x4ae3b0[_0xde03('0x34')]['limit']);_0x5eae6f['offset']=qs['offset'](_0x4ae3b0['query']['offset']);}_0x5eae6f['order']=qs['sort'](_0x4ae3b0[_0xde03('0x34')]['sort']);_0x5eae6f['where']=qs[_0xde03('0x35')](_[_0xde03('0x3b')](_0x4ae3b0[_0xde03('0x34')],_0x2d270b[_0xde03('0x35')]),_0x3ef7fa);if(_0x4ae3b0[_0xde03('0x34')]['filter']){_0x5eae6f['where']=_[_0xde03('0x3c')](_0x5eae6f[_0xde03('0x3d')],{'$or':_['map'](_0x3ef7fa,function(_0x59e889){if(_0x59e889[_0xde03('0x3e')]!==_0xde03('0x3f')){var _0x33704a={};_0x33704a[_0x59e889[_0xde03('0x2c')]]={'$like':'%'+_0x4ae3b0[_0xde03('0x34')]['filter']+'%'};return _0x33704a;}})});}_0x5eae6f=_[_0xde03('0x3c')]({},_0x5eae6f,_0x4ae3b0[_0xde03('0x40')]);var _0x442aba={'where':_0x5eae6f['where']};return db[_0xde03('0x30')][_0xde03('0x1f')](_0x442aba)['then'](function(_0x23c8ff){_0x2a3b1a[_0xde03('0x1f')]=_0x23c8ff;if(_0x4ae3b0[_0xde03('0x34')][_0xde03('0x41')]){_0x5eae6f[_0xde03('0x42')]=[{'all':!![]}];}return db[_0xde03('0x30')]['findAll'](_0x5eae6f);})['then'](function(_0x1fc934){_0x2a3b1a[_0xde03('0x43')]=_0x1fc934;return _0x2a3b1a;})[_0xde03('0x28')](respondWithFilteredResult(_0x19ce7f,_0x5eae6f))['catch'](handleError(_0x19ce7f,null));};exports[_0xde03('0x44')]=function(_0x275c21,_0xc61a65){var _0x5314c0={'raw':![],'where':{'id':_0x275c21[_0xde03('0x45')]['id']}},_0x3ec207={};_0x3ec207['model']=_[_0xde03('0x46')](db[_0xde03('0x30')][_0xde03('0x31')]);_0x3ec207[_0xde03('0x34')]=_[_0xde03('0x46')](_0x275c21[_0xde03('0x34')]);_0x3ec207[_0xde03('0x35')]=_[_0xde03('0x36')](_0x3ec207[_0xde03('0x33')],_0x3ec207[_0xde03('0x34')]);_0x5314c0[_0xde03('0x37')]=_[_0xde03('0x36')](_0x3ec207[_0xde03('0x33')],qs[_0xde03('0x38')](_0x275c21[_0xde03('0x34')]['fields']));_0x5314c0['attributes']=_0x5314c0['attributes']['length']?_0x5314c0[_0xde03('0x37')]:_0x3ec207[_0xde03('0x33')];if(_0x275c21[_0xde03('0x34')][_0xde03('0x41')]){_0x5314c0[_0xde03('0x42')]=[{'all':!![]}];}_0x5314c0=_[_0xde03('0x3c')]({},_0x5314c0,_0x275c21[_0xde03('0x40')]);return db[_0xde03('0x30')][_0xde03('0x47')](_0x5314c0)[_0xde03('0x28')](handleEntityNotFound(_0xc61a65,null))[_0xde03('0x28')](respondWithResult(_0xc61a65,null))[_0xde03('0x48')](handleError(_0xc61a65,null));};exports[_0xde03('0x49')]=function(_0x3b2297,_0x251e59){return db['Dynamics365Configuration'][_0xde03('0x49')](_0x3b2297[_0xde03('0x4a')],{})[_0xde03('0x28')](respondWithResult(_0x251e59,0xc9))['catch'](handleError(_0x251e59,null));};exports['update']=function(_0x5edf84,_0x6d355c){if(_0x5edf84[_0xde03('0x4a')]['id']){delete _0x5edf84[_0xde03('0x4a')]['id'];}return db[_0xde03('0x30')][_0xde03('0x47')]({'where':{'id':_0x5edf84[_0xde03('0x45')]['id']}})[_0xde03('0x28')](handleEntityNotFound(_0x6d355c,null))['then'](saveUpdates(_0x5edf84[_0xde03('0x4a')],null))['then'](respondWithResult(_0x6d355c,null))[_0xde03('0x48')](handleError(_0x6d355c,null));};exports['destroy']=function(_0x2018fa,_0x509048){return db[_0xde03('0x30')][_0xde03('0x47')]({'where':{'id':_0x2018fa[_0xde03('0x45')]['id']}})[_0xde03('0x28')](handleEntityNotFound(_0x509048,null))[_0xde03('0x28')](removeEntity(_0x509048,null))[_0xde03('0x48')](handleError(_0x509048,null));};exports[_0xde03('0x4b')]=function(_0x507427,_0x159dc0,_0x16f673){var _0x8faff9={};var _0x4a2a02={};var _0x128a4d;var _0xc4e66a;return db['Dynamics365Configuration'][_0xde03('0x4c')]({'where':{'id':_0x507427[_0xde03('0x45')]['id']}})[_0xde03('0x28')](handleEntityNotFound(_0x159dc0,null))[_0xde03('0x28')](function(_0x277a62){if(_0x277a62){_0x128a4d=_0x277a62;_0x4a2a02[_0xde03('0x33')]=_[_0xde03('0x46')](db[_0xde03('0x4d')][_0xde03('0x31')]);_0x4a2a02[_0xde03('0x34')]=_['keys'](_0x507427['query']);_0x4a2a02['filters']=_[_0xde03('0x36')](_0x4a2a02['model'],_0x4a2a02['query']);_0x8faff9['attributes']=_[_0xde03('0x36')](_0x4a2a02[_0xde03('0x33')],qs[_0xde03('0x38')](_0x507427[_0xde03('0x34')][_0xde03('0x38')]));_0x8faff9[_0xde03('0x37')]=_0x8faff9['attributes'][_0xde03('0x4e')]?_0x8faff9[_0xde03('0x37')]:_0x4a2a02['model'];_0x8faff9['order']=qs[_0xde03('0x4f')](_0x507427[_0xde03('0x34')][_0xde03('0x4f')]);_0x8faff9[_0xde03('0x3d')]=qs[_0xde03('0x35')](_[_0xde03('0x3b')](_0x507427[_0xde03('0x34')],_0x4a2a02[_0xde03('0x35')]));if(_0x507427[_0xde03('0x34')][_0xde03('0x50')]){_0x8faff9[_0xde03('0x3d')]=_[_0xde03('0x3c')](_0x8faff9[_0xde03('0x3d')],{'$or':_[_0xde03('0x2f')](_0x8faff9[_0xde03('0x37')],function(_0x4fa91f){var _0x49a49f={};_0x49a49f[_0x4fa91f]={'$like':'%'+_0x507427[_0xde03('0x34')]['filter']+'%'};return _0x49a49f;})});}_0x8faff9=_['merge']({},_0x8faff9,_0x507427[_0xde03('0x40')]);return _0x128a4d['getFields'](_0x8faff9);}})[_0xde03('0x28')](function(_0x20843f){if(_0x20843f){_0xc4e66a=_0x20843f['length'];if(!_0x507427['query']['hasOwnProperty'](_0xde03('0x3a'))){_0x8faff9[_0xde03('0x20')]=qs[_0xde03('0x20')](_0x507427[_0xde03('0x34')][_0xde03('0x20')]);_0x8faff9['offset']=qs[_0xde03('0x1d')](_0x507427[_0xde03('0x34')]['offset']);}return _0x128a4d[_0xde03('0x4b')](_0x8faff9);}})[_0xde03('0x28')](function(_0x12e111){if(_0x12e111){return _0x12e111?{'count':_0xc4e66a,'rows':_0x12e111}:null;}})[_0xde03('0x28')](respondWithResult(_0x159dc0,null))['catch'](handleError(_0x159dc0,null));};exports['getSubjects']=function(_0x42e8d8,_0x1afd86,_0x2ccaa8){var _0x3e3348={};var _0x2f7799={};var _0x5b8dd4;var _0xd7cc69;return db[_0xde03('0x30')][_0xde03('0x4c')]({'where':{'id':_0x42e8d8[_0xde03('0x45')]['id']}})[_0xde03('0x28')](handleEntityNotFound(_0x1afd86,null))[_0xde03('0x28')](function(_0x229578){if(_0x229578){_0x5b8dd4=_0x229578;_0x2f7799['model']=_['keys'](db[_0xde03('0x4d')][_0xde03('0x31')]);_0x2f7799[_0xde03('0x34')]=_[_0xde03('0x46')](_0x42e8d8['query']);_0x2f7799[_0xde03('0x35')]=_['intersection'](_0x2f7799['model'],_0x2f7799['query']);_0x3e3348[_0xde03('0x37')]=_[_0xde03('0x36')](_0x2f7799[_0xde03('0x33')],qs['fields'](_0x42e8d8[_0xde03('0x34')]['fields']));_0x3e3348[_0xde03('0x37')]=_0x3e3348['attributes'][_0xde03('0x4e')]?_0x3e3348[_0xde03('0x37')]:_0x2f7799[_0xde03('0x33')];_0x3e3348[_0xde03('0x51')]=qs[_0xde03('0x4f')](_0x42e8d8['query'][_0xde03('0x4f')]);_0x3e3348[_0xde03('0x3d')]=qs[_0xde03('0x35')](_[_0xde03('0x3b')](_0x42e8d8[_0xde03('0x34')],_0x2f7799['filters']));if(_0x42e8d8['query']['filter']){_0x3e3348['where']=_[_0xde03('0x3c')](_0x3e3348['where'],{'$or':_[_0xde03('0x2f')](_0x3e3348[_0xde03('0x37')],function(_0x2a9988){var _0x49921a={};_0x49921a[_0x2a9988]={'$like':'%'+_0x42e8d8[_0xde03('0x34')][_0xde03('0x50')]+'%'};return _0x49921a;})});}_0x3e3348=_[_0xde03('0x3c')]({},_0x3e3348,_0x42e8d8[_0xde03('0x40')]);return _0x5b8dd4[_0xde03('0x52')](_0x3e3348);}})['then'](function(_0x478944){if(_0x478944){_0xd7cc69=_0x478944[_0xde03('0x4e')];if(!_0x42e8d8['query'][_0xde03('0x39')](_0xde03('0x3a'))){_0x3e3348[_0xde03('0x20')]=qs[_0xde03('0x20')](_0x42e8d8[_0xde03('0x34')][_0xde03('0x20')]);_0x3e3348[_0xde03('0x1d')]=qs['offset'](_0x42e8d8['query'][_0xde03('0x1d')]);}return _0x5b8dd4[_0xde03('0x52')](_0x3e3348);}})[_0xde03('0x28')](function(_0x7ab0d0){if(_0x7ab0d0){return _0x7ab0d0?{'count':_0xd7cc69,'rows':_0x7ab0d0}:null;}})[_0xde03('0x28')](respondWithResult(_0x1afd86,null))[_0xde03('0x48')](handleError(_0x1afd86,null));};exports[_0xde03('0x53')]=function(_0x1084d1,_0x3ae01d,_0x49d178){var _0x39c982={};var _0x4dbc1c={};var _0x484612;var _0x2d4cdf;return db[_0xde03('0x30')][_0xde03('0x4c')]({'where':{'id':_0x1084d1[_0xde03('0x45')]['id']}})[_0xde03('0x28')](handleEntityNotFound(_0x3ae01d,null))[_0xde03('0x28')](function(_0x1e245c){if(_0x1e245c){_0x484612=_0x1e245c;_0x4dbc1c[_0xde03('0x33')]=_[_0xde03('0x46')](db[_0xde03('0x4d')]['rawAttributes']);_0x4dbc1c[_0xde03('0x34')]=_['keys'](_0x1084d1[_0xde03('0x34')]);_0x4dbc1c[_0xde03('0x35')]=_[_0xde03('0x36')](_0x4dbc1c[_0xde03('0x33')],_0x4dbc1c[_0xde03('0x34')]);_0x39c982[_0xde03('0x37')]=_[_0xde03('0x36')](_0x4dbc1c['model'],qs[_0xde03('0x38')](_0x1084d1[_0xde03('0x34')][_0xde03('0x38')]));_0x39c982[_0xde03('0x37')]=_0x39c982[_0xde03('0x37')][_0xde03('0x4e')]?_0x39c982[_0xde03('0x37')]:_0x4dbc1c[_0xde03('0x33')];_0x39c982[_0xde03('0x51')]=qs[_0xde03('0x4f')](_0x1084d1['query']['sort']);_0x39c982[_0xde03('0x3d')]=qs[_0xde03('0x35')](_[_0xde03('0x3b')](_0x1084d1[_0xde03('0x34')],_0x4dbc1c[_0xde03('0x35')]));if(_0x1084d1[_0xde03('0x34')][_0xde03('0x50')]){_0x39c982[_0xde03('0x3d')]=_['merge'](_0x39c982[_0xde03('0x3d')],{'$or':_[_0xde03('0x2f')](_0x39c982['attributes'],function(_0x5d8114){var _0x24a03d={};_0x24a03d[_0x5d8114]={'$like':'%'+_0x1084d1[_0xde03('0x34')][_0xde03('0x50')]+'%'};return _0x24a03d;})});}_0x39c982=_[_0xde03('0x3c')]({},_0x39c982,_0x1084d1['options']);return _0x484612[_0xde03('0x53')](_0x39c982);}})[_0xde03('0x28')](function(_0x5fd019){if(_0x5fd019){_0x2d4cdf=_0x5fd019[_0xde03('0x4e')];if(!_0x1084d1['query']['hasOwnProperty'](_0xde03('0x3a'))){_0x39c982['limit']=qs[_0xde03('0x20')](_0x1084d1[_0xde03('0x34')][_0xde03('0x20')]);_0x39c982[_0xde03('0x1d')]=qs[_0xde03('0x1d')](_0x1084d1[_0xde03('0x34')][_0xde03('0x1d')]);}return _0x484612[_0xde03('0x53')](_0x39c982);}})['then'](function(_0x36361e){if(_0x36361e){return _0x36361e?{'count':_0x2d4cdf,'rows':_0x36361e}:null;}})[_0xde03('0x28')](respondWithResult(_0x3ae01d,null))['catch'](handleError(_0x3ae01d,null));}; \ No newline at end of file +var _0x2945=['intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','findOne','Dynamics365Field','nolimit','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x254fcc,_0x3893eb){var _0xc7e7d1=function(_0x3e34c5){while(--_0x3e34c5){_0x254fcc['push'](_0x254fcc['shift']());}};_0xc7e7d1(++_0x3893eb);}(_0x2945,0x70));var _0x5294=function(_0x98a7f4,_0x26a940){_0x98a7f4=_0x98a7f4-0x0;var _0x1d8a5a=_0x2945[_0x98a7f4];return _0x1d8a5a;};'use strict';var emlformat=require(_0x5294('0x0'));var rimraf=require(_0x5294('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5294('0x2'));var rp=require(_0x5294('0x3'));var moment=require('moment');var BPromise=require(_0x5294('0x4'));var Mustache=require(_0x5294('0x5'));var util=require(_0x5294('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5294('0x7'));var fs=require('fs');var fs_extra=require(_0x5294('0x8'));var _=require(_0x5294('0x9'));var squel=require('squel');var crypto=require(_0x5294('0xa'));var jsforce=require(_0x5294('0xb'));var deskjs=require(_0x5294('0xc'));var toCsv=require(_0x5294('0xd'));var querystring=require(_0x5294('0xe'));var Papa=require(_0x5294('0xf'));var Redis=require(_0x5294('0x10'));var authService=require(_0x5294('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5294('0x12'));var logger=require(_0x5294('0x13'))(_0x5294('0x14'));var utils=require(_0x5294('0x15'));var config=require(_0x5294('0x16'));var licenseUtil=require(_0x5294('0x17'));var db=require(_0x5294('0x18'))['db'];function respondWithStatusCode(_0x18a795,_0x3164b7){_0x3164b7=_0x3164b7||0xcc;return function(_0x734d9e){if(_0x734d9e){return _0x18a795[_0x5294('0x19')](_0x3164b7);}return _0x18a795[_0x5294('0x1a')](_0x3164b7)[_0x5294('0x1b')]();};}function respondWithResult(_0x4070c4,_0x4a047c){_0x4a047c=_0x4a047c||0xc8;return function(_0x13e9ba){if(_0x13e9ba){return _0x4070c4[_0x5294('0x1a')](_0x4a047c)[_0x5294('0x1c')](_0x13e9ba);}};}function respondWithFilteredResult(_0x57d026,_0xf02017){return function(_0xcf4bcc){if(_0xcf4bcc){var _0x26b927=typeof _0xf02017[_0x5294('0x1d')]===_0x5294('0x1e')&&typeof _0xf02017[_0x5294('0x1f')]==='undefined';var _0xe5b1f9=_0xcf4bcc[_0x5294('0x20')];var _0x2d62ef=_0x26b927?0x0:_0xf02017[_0x5294('0x1d')];var _0x1f52da=_0x26b927?_0xcf4bcc[_0x5294('0x20')]:_0xf02017[_0x5294('0x1d')]+_0xf02017[_0x5294('0x1f')];var _0x2b698c;if(_0x1f52da>=_0xe5b1f9){_0x1f52da=_0xe5b1f9;_0x2b698c=0xc8;}else{_0x2b698c=0xce;}_0x57d026[_0x5294('0x1a')](_0x2b698c);return _0x57d026['set'](_0x5294('0x21'),_0x2d62ef+'-'+_0x1f52da+'/'+_0xe5b1f9)[_0x5294('0x1c')](_0xcf4bcc);}return null;};}function patchUpdates(_0x2d3d0b){return function(_0x1ac9e9){try{jsonpatch['apply'](_0x1ac9e9,_0x2d3d0b,!![]);}catch(_0x5bb9c6){return BPromise[_0x5294('0x22')](_0x5bb9c6);}return _0x1ac9e9[_0x5294('0x23')]();};}function saveUpdates(_0x4335ba,_0x3c978e){return function(_0x3a548b){if(_0x3a548b){return _0x3a548b['update'](_0x4335ba)[_0x5294('0x24')](function(_0x4c6f27){return _0x4c6f27;});}return null;};}function removeEntity(_0xd03fed,_0x13da13){return function(_0x4da74a){if(_0x4da74a){return _0x4da74a[_0x5294('0x25')]()[_0x5294('0x24')](function(){_0xd03fed[_0x5294('0x1a')](0xcc)[_0x5294('0x1b')]();});}};}function handleEntityNotFound(_0x40ae12,_0x333529){return function(_0x8a08f1){if(!_0x8a08f1){_0x40ae12[_0x5294('0x19')](0x194);}return _0x8a08f1;};}function handleError(_0x2de9be,_0x48727c){_0x48727c=_0x48727c||0x1f4;return function(_0x1d0a40){logger[_0x5294('0x26')](_0x1d0a40[_0x5294('0x27')]);if(_0x1d0a40[_0x5294('0x28')]){delete _0x1d0a40[_0x5294('0x28')];}_0x2de9be[_0x5294('0x1a')](_0x48727c)[_0x5294('0x29')](_0x1d0a40);};}exports[_0x5294('0x2a')]=function(_0x8e8cee,_0x15ff93){var _0x3032cf={},_0x22aea2={},_0x90a9b8={'count':0x0,'rows':[]};var _0x428f42=_[_0x5294('0x2b')](db[_0x5294('0x2c')][_0x5294('0x2d')],function(_0x488467){return{'name':_0x488467[_0x5294('0x2e')],'type':_0x488467['type'][_0x5294('0x2f')]};});_0x22aea2[_0x5294('0x30')]=_[_0x5294('0x2b')](_0x428f42,_0x5294('0x28'));_0x22aea2[_0x5294('0x31')]=_[_0x5294('0x32')](_0x8e8cee[_0x5294('0x31')]);_0x22aea2[_0x5294('0x33')]=_[_0x5294('0x34')](_0x22aea2['model'],_0x22aea2[_0x5294('0x31')]);_0x3032cf[_0x5294('0x35')]=_['intersection'](_0x22aea2['model'],qs[_0x5294('0x36')](_0x8e8cee[_0x5294('0x31')][_0x5294('0x36')]));_0x3032cf[_0x5294('0x35')]=_0x3032cf[_0x5294('0x35')][_0x5294('0x37')]?_0x3032cf['attributes']:_0x22aea2[_0x5294('0x30')];if(!_0x8e8cee[_0x5294('0x31')][_0x5294('0x38')]('nolimit')){_0x3032cf[_0x5294('0x1f')]=qs[_0x5294('0x1f')](_0x8e8cee[_0x5294('0x31')]['limit']);_0x3032cf['offset']=qs['offset'](_0x8e8cee[_0x5294('0x31')][_0x5294('0x1d')]);}_0x3032cf[_0x5294('0x39')]=qs[_0x5294('0x3a')](_0x8e8cee[_0x5294('0x31')][_0x5294('0x3a')]);_0x3032cf['where']=qs[_0x5294('0x33')](_[_0x5294('0x3b')](_0x8e8cee[_0x5294('0x31')],_0x22aea2[_0x5294('0x33')]),_0x428f42);if(_0x8e8cee['query'][_0x5294('0x3c')]){_0x3032cf['where']=_[_0x5294('0x3d')](_0x3032cf[_0x5294('0x3e')],{'$or':_[_0x5294('0x2b')](_0x428f42,function(_0x787977){if(_0x787977[_0x5294('0x3f')]!==_0x5294('0x40')){var _0x3ae1ef={};_0x3ae1ef[_0x787977[_0x5294('0x28')]]={'$like':'%'+_0x8e8cee[_0x5294('0x31')][_0x5294('0x3c')]+'%'};return _0x3ae1ef;}})});}_0x3032cf=_['merge']({},_0x3032cf,_0x8e8cee[_0x5294('0x41')]);var _0x581275={'where':_0x3032cf[_0x5294('0x3e')]};return db[_0x5294('0x2c')][_0x5294('0x20')](_0x581275)[_0x5294('0x24')](function(_0x5c3899){_0x90a9b8[_0x5294('0x20')]=_0x5c3899;if(_0x8e8cee['query'][_0x5294('0x42')]){_0x3032cf['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x5294('0x43')](_0x3032cf);})[_0x5294('0x24')](function(_0x18a800){_0x90a9b8[_0x5294('0x44')]=_0x18a800;return _0x90a9b8;})[_0x5294('0x24')](respondWithFilteredResult(_0x15ff93,_0x3032cf))['catch'](handleError(_0x15ff93,null));};exports[_0x5294('0x45')]=function(_0x314add,_0x471dc9){var _0x53f95f={'raw':![],'where':{'id':_0x314add[_0x5294('0x46')]['id']}},_0xeef920={};_0xeef920['model']=_[_0x5294('0x32')](db['Dynamics365Configuration']['rawAttributes']);_0xeef920[_0x5294('0x31')]=_[_0x5294('0x32')](_0x314add[_0x5294('0x31')]);_0xeef920[_0x5294('0x33')]=_[_0x5294('0x34')](_0xeef920[_0x5294('0x30')],_0xeef920[_0x5294('0x31')]);_0x53f95f['attributes']=_[_0x5294('0x34')](_0xeef920[_0x5294('0x30')],qs[_0x5294('0x36')](_0x314add['query'][_0x5294('0x36')]));_0x53f95f['attributes']=_0x53f95f[_0x5294('0x35')]['length']?_0x53f95f['attributes']:_0xeef920[_0x5294('0x30')];if(_0x314add['query'][_0x5294('0x42')]){_0x53f95f[_0x5294('0x47')]=[{'all':!![]}];}_0x53f95f=_[_0x5294('0x3d')]({},_0x53f95f,_0x314add[_0x5294('0x41')]);return db['Dynamics365Configuration'][_0x5294('0x48')](_0x53f95f)[_0x5294('0x24')](handleEntityNotFound(_0x471dc9,null))['then'](respondWithResult(_0x471dc9,null))[_0x5294('0x49')](handleError(_0x471dc9,null));};exports[_0x5294('0x4a')]=function(_0xe73bba,_0x4f332a){return db[_0x5294('0x2c')][_0x5294('0x4a')](_0xe73bba[_0x5294('0x4b')],{})[_0x5294('0x24')](respondWithResult(_0x4f332a,0xc9))[_0x5294('0x49')](handleError(_0x4f332a,null));};exports['update']=function(_0x3f12b0,_0x4f5404){if(_0x3f12b0[_0x5294('0x4b')]['id']){delete _0x3f12b0['body']['id'];}return db[_0x5294('0x2c')]['find']({'where':{'id':_0x3f12b0['params']['id']}})[_0x5294('0x24')](handleEntityNotFound(_0x4f5404,null))['then'](saveUpdates(_0x3f12b0[_0x5294('0x4b')],null))[_0x5294('0x24')](respondWithResult(_0x4f5404,null))[_0x5294('0x49')](handleError(_0x4f5404,null));};exports['destroy']=function(_0x313986,_0x268a25){return db['Dynamics365Configuration'][_0x5294('0x48')]({'where':{'id':_0x313986[_0x5294('0x46')]['id']}})['then'](handleEntityNotFound(_0x268a25,null))[_0x5294('0x24')](removeEntity(_0x268a25,null))[_0x5294('0x49')](handleError(_0x268a25,null));};exports['getFields']=function(_0x172900,_0xf58352,_0x2a84c6){var _0x1946fb={};var _0x5b073e={};var _0x4dd817;var _0xbbc9f2;return db[_0x5294('0x2c')][_0x5294('0x4c')]({'where':{'id':_0x172900[_0x5294('0x46')]['id']}})[_0x5294('0x24')](handleEntityNotFound(_0xf58352,null))['then'](function(_0x529d06){if(_0x529d06){_0x4dd817=_0x529d06;_0x5b073e[_0x5294('0x30')]=_[_0x5294('0x32')](db[_0x5294('0x4d')][_0x5294('0x2d')]);_0x5b073e[_0x5294('0x31')]=_['keys'](_0x172900[_0x5294('0x31')]);_0x5b073e[_0x5294('0x33')]=_[_0x5294('0x34')](_0x5b073e[_0x5294('0x30')],_0x5b073e[_0x5294('0x31')]);_0x1946fb[_0x5294('0x35')]=_['intersection'](_0x5b073e[_0x5294('0x30')],qs[_0x5294('0x36')](_0x172900['query'][_0x5294('0x36')]));_0x1946fb['attributes']=_0x1946fb[_0x5294('0x35')][_0x5294('0x37')]?_0x1946fb[_0x5294('0x35')]:_0x5b073e[_0x5294('0x30')];_0x1946fb[_0x5294('0x39')]=qs[_0x5294('0x3a')](_0x172900['query'][_0x5294('0x3a')]);_0x1946fb[_0x5294('0x3e')]=qs[_0x5294('0x33')](_[_0x5294('0x3b')](_0x172900[_0x5294('0x31')],_0x5b073e[_0x5294('0x33')]));if(_0x172900[_0x5294('0x31')]['filter']){_0x1946fb[_0x5294('0x3e')]=_[_0x5294('0x3d')](_0x1946fb[_0x5294('0x3e')],{'$or':_[_0x5294('0x2b')](_0x1946fb[_0x5294('0x35')],function(_0x4db3e4){var _0x2f9ff7={};_0x2f9ff7[_0x4db3e4]={'$like':'%'+_0x172900[_0x5294('0x31')]['filter']+'%'};return _0x2f9ff7;})});}_0x1946fb=_['merge']({},_0x1946fb,_0x172900['options']);return _0x4dd817['getFields'](_0x1946fb);}})['then'](function(_0x45eb05){if(_0x45eb05){_0xbbc9f2=_0x45eb05['length'];if(!_0x172900[_0x5294('0x31')][_0x5294('0x38')](_0x5294('0x4e'))){_0x1946fb[_0x5294('0x1f')]=qs[_0x5294('0x1f')](_0x172900[_0x5294('0x31')]['limit']);_0x1946fb[_0x5294('0x1d')]=qs[_0x5294('0x1d')](_0x172900[_0x5294('0x31')][_0x5294('0x1d')]);}return _0x4dd817[_0x5294('0x4f')](_0x1946fb);}})[_0x5294('0x24')](function(_0x462c75){if(_0x462c75){return _0x462c75?{'count':_0xbbc9f2,'rows':_0x462c75}:null;}})[_0x5294('0x24')](respondWithResult(_0xf58352,null))[_0x5294('0x49')](handleError(_0xf58352,null));};exports[_0x5294('0x50')]=function(_0x23adfc,_0x2682f1,_0x298d24){var _0x29a277={};var _0x2d455e={};var _0x427088;var _0x476a8d;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x23adfc[_0x5294('0x46')]['id']}})[_0x5294('0x24')](handleEntityNotFound(_0x2682f1,null))['then'](function(_0x22ed7a){if(_0x22ed7a){_0x427088=_0x22ed7a;_0x2d455e[_0x5294('0x30')]=_[_0x5294('0x32')](db['Dynamics365Field'][_0x5294('0x2d')]);_0x2d455e[_0x5294('0x31')]=_[_0x5294('0x32')](_0x23adfc[_0x5294('0x31')]);_0x2d455e[_0x5294('0x33')]=_[_0x5294('0x34')](_0x2d455e['model'],_0x2d455e['query']);_0x29a277['attributes']=_['intersection'](_0x2d455e[_0x5294('0x30')],qs[_0x5294('0x36')](_0x23adfc['query']['fields']));_0x29a277[_0x5294('0x35')]=_0x29a277[_0x5294('0x35')][_0x5294('0x37')]?_0x29a277[_0x5294('0x35')]:_0x2d455e[_0x5294('0x30')];_0x29a277['order']=qs[_0x5294('0x3a')](_0x23adfc['query'][_0x5294('0x3a')]);_0x29a277['where']=qs[_0x5294('0x33')](_['pick'](_0x23adfc[_0x5294('0x31')],_0x2d455e[_0x5294('0x33')]));if(_0x23adfc[_0x5294('0x31')][_0x5294('0x3c')]){_0x29a277['where']=_[_0x5294('0x3d')](_0x29a277[_0x5294('0x3e')],{'$or':_[_0x5294('0x2b')](_0x29a277[_0x5294('0x35')],function(_0x2930f3){var _0x193d9f={};_0x193d9f[_0x2930f3]={'$like':'%'+_0x23adfc[_0x5294('0x31')]['filter']+'%'};return _0x193d9f;})});}_0x29a277=_[_0x5294('0x3d')]({},_0x29a277,_0x23adfc[_0x5294('0x41')]);return _0x427088[_0x5294('0x50')](_0x29a277);}})[_0x5294('0x24')](function(_0x77803a){if(_0x77803a){_0x476a8d=_0x77803a[_0x5294('0x37')];if(!_0x23adfc[_0x5294('0x31')][_0x5294('0x38')](_0x5294('0x4e'))){_0x29a277[_0x5294('0x1f')]=qs['limit'](_0x23adfc[_0x5294('0x31')][_0x5294('0x1f')]);_0x29a277[_0x5294('0x1d')]=qs[_0x5294('0x1d')](_0x23adfc[_0x5294('0x31')][_0x5294('0x1d')]);}return _0x427088[_0x5294('0x50')](_0x29a277);}})[_0x5294('0x24')](function(_0x476c23){if(_0x476c23){return _0x476c23?{'count':_0x476a8d,'rows':_0x476c23}:null;}})[_0x5294('0x24')](respondWithResult(_0x2682f1,null))[_0x5294('0x49')](handleError(_0x2682f1,null));};exports['getDescriptions']=function(_0xdba301,_0x2c22a2,_0xb113f8){var _0x5a8dea={};var _0x3f5294={};var _0x162956;var _0x1be28e;return db[_0x5294('0x2c')]['findOne']({'where':{'id':_0xdba301[_0x5294('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c22a2,null))[_0x5294('0x24')](function(_0x4f498f){if(_0x4f498f){_0x162956=_0x4f498f;_0x3f5294[_0x5294('0x30')]=_[_0x5294('0x32')](db[_0x5294('0x4d')][_0x5294('0x2d')]);_0x3f5294[_0x5294('0x31')]=_['keys'](_0xdba301[_0x5294('0x31')]);_0x3f5294[_0x5294('0x33')]=_[_0x5294('0x34')](_0x3f5294['model'],_0x3f5294[_0x5294('0x31')]);_0x5a8dea['attributes']=_[_0x5294('0x34')](_0x3f5294[_0x5294('0x30')],qs[_0x5294('0x36')](_0xdba301[_0x5294('0x31')]['fields']));_0x5a8dea['attributes']=_0x5a8dea[_0x5294('0x35')][_0x5294('0x37')]?_0x5a8dea[_0x5294('0x35')]:_0x3f5294[_0x5294('0x30')];_0x5a8dea['order']=qs[_0x5294('0x3a')](_0xdba301[_0x5294('0x31')][_0x5294('0x3a')]);_0x5a8dea['where']=qs[_0x5294('0x33')](_[_0x5294('0x3b')](_0xdba301['query'],_0x3f5294[_0x5294('0x33')]));if(_0xdba301['query'][_0x5294('0x3c')]){_0x5a8dea[_0x5294('0x3e')]=_['merge'](_0x5a8dea[_0x5294('0x3e')],{'$or':_[_0x5294('0x2b')](_0x5a8dea[_0x5294('0x35')],function(_0x14db1a){var _0x29b262={};_0x29b262[_0x14db1a]={'$like':'%'+_0xdba301['query'][_0x5294('0x3c')]+'%'};return _0x29b262;})});}_0x5a8dea=_[_0x5294('0x3d')]({},_0x5a8dea,_0xdba301[_0x5294('0x41')]);return _0x162956[_0x5294('0x51')](_0x5a8dea);}})[_0x5294('0x24')](function(_0x4dd7e2){if(_0x4dd7e2){_0x1be28e=_0x4dd7e2['length'];if(!_0xdba301[_0x5294('0x31')][_0x5294('0x38')](_0x5294('0x4e'))){_0x5a8dea[_0x5294('0x1f')]=qs[_0x5294('0x1f')](_0xdba301[_0x5294('0x31')]['limit']);_0x5a8dea[_0x5294('0x1d')]=qs[_0x5294('0x1d')](_0xdba301[_0x5294('0x31')][_0x5294('0x1d')]);}return _0x162956[_0x5294('0x51')](_0x5a8dea);}})[_0x5294('0x24')](function(_0x3dc956){if(_0x3dc956){return _0x3dc956?{'count':_0x1be28e,'rows':_0x3dc956}:null;}})['then'](respondWithResult(_0x2c22a2,null))[_0x5294('0x49')](handleError(_0x2c22a2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index bfe9736..a8209ca 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 _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x4135bd,_0x163b65){var _0x37e1d0=function(_0x4dc758){while(--_0x4dc758){_0x4135bd['push'](_0x4135bd['shift']());}};_0x37e1d0(++_0x163b65);}(_0xf109,0xce));var _0x9f10=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xf109[_0x1573ea];return _0x51c0e2;};'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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x4875e9,_0x35b64c){var _0x5bf530=function(_0x37092c){while(--_0x37092c){_0x4875e9['push'](_0x4875e9['shift']());}};_0x5bf530(++_0x35b64c);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index ca5b8ae..3ba4bf1 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 _0x1f65=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a7906,_0x3ef77d){var _0x558373=function(_0xd892c3){while(--_0xd892c3){_0x4a7906['push'](_0x4a7906['shift']());}};_0x558373(++_0x3ef77d);}(_0x1f65,0x75));var _0x51f6=function(_0x459e81,_0x52aeb0){_0x459e81=_0x459e81-0x0;var _0x4fac6a=_0x1f65[_0x459e81];return _0x4fac6a;};'use strict';var _=require(_0x51f6('0x0'));var util=require(_0x51f6('0x1'));var moment=require(_0x51f6('0x2'));var BPromise=require(_0x51f6('0x3'));var rs=require(_0x51f6('0x4'));var fs=require('fs');var Redis=require(_0x51f6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x51f6('0x6'));var config=require(_0x51f6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11bda9,_0x269879,_0x31edaa){return new BPromise(function(_0x4876e8,_0x5aaa60){return client['request'](_0x11bda9,_0x31edaa)[_0x51f6('0x8')](function(_0x405c05){logger[_0x51f6('0x9')](_0x51f6('0xa'),_0x269879,_0x51f6('0xb'));logger['debug'](_0x51f6('0xc'),_0x269879,_0x51f6('0xb'),JSON[_0x51f6('0xd')](_0x405c05));if(_0x405c05['error']){if(_0x405c05[_0x51f6('0xe')][_0x51f6('0xf')]===0x1f4){logger[_0x51f6('0xe')](_0x51f6('0xa'),_0x269879,_0x405c05[_0x51f6('0xe')][_0x51f6('0x10')]);return _0x5aaa60(_0x405c05[_0x51f6('0xe')][_0x51f6('0x10')]);}logger[_0x51f6('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x269879,_0x405c05['error']['message']);return _0x4876e8(_0x405c05[_0x51f6('0xe')]['message']);}else{logger['info'](_0x51f6('0xa'),_0x269879,_0x51f6('0xb'));_0x4876e8(_0x405c05[_0x51f6('0x11')][_0x51f6('0x10')]);}})[_0x51f6('0x12')](function(_0x555b2e){logger[_0x51f6('0xe')](_0x51f6('0xa'),_0x269879,_0x555b2e);_0x5aaa60(_0x555b2e);});});} \ No newline at end of file +var _0x8e7d=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message','catch','lodash','bluebird'];(function(_0x1b5d48,_0x477a26){var _0x48d8b1=function(_0x3cc9fe){while(--_0x3cc9fe){_0x1b5d48['push'](_0x1b5d48['shift']());}};_0x48d8b1(++_0x477a26);}(_0x8e7d,0x1cc));var _0xd8e7=function(_0x38ff4d,_0x6ef55b){_0x38ff4d=_0x38ff4d-0x0;var _0x2e5488=_0x8e7d[_0x38ff4d];return _0x2e5488;};'use strict';var _=require(_0xd8e7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8e7('0x1'));var rs=require(_0xd8e7('0x2'));var fs=require('fs');var Redis=require(_0xd8e7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8e7('0x4'));var logger=require(_0xd8e7('0x5'))(_0xd8e7('0x6'));var config=require(_0xd8e7('0x7'));var jayson=require(_0xd8e7('0x8'));var client=jayson['client'][_0xd8e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ed2cd,_0x30fe9c,_0x219e5b){return new BPromise(function(_0x42bb2b,_0x3dea3e){return client[_0xd8e7('0xa')](_0x2ed2cd,_0x219e5b)[_0xd8e7('0xb')](function(_0x11f976){logger[_0xd8e7('0xc')](_0xd8e7('0xd'),_0x30fe9c,_0xd8e7('0xe'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x30fe9c,_0xd8e7('0xe'),JSON[_0xd8e7('0xf')](_0x11f976));if(_0x11f976[_0xd8e7('0x10')]){if(_0x11f976[_0xd8e7('0x10')][_0xd8e7('0x11')]===0x1f4){logger[_0xd8e7('0x10')](_0xd8e7('0xd'),_0x30fe9c,_0x11f976[_0xd8e7('0x10')]['message']);return _0x3dea3e(_0x11f976[_0xd8e7('0x10')]['message']);}logger[_0xd8e7('0x10')](_0xd8e7('0xd'),_0x30fe9c,_0x11f976[_0xd8e7('0x10')]['message']);return _0x42bb2b(_0x11f976['error']['message']);}else{logger['info'](_0xd8e7('0xd'),_0x30fe9c,'request\x20sent');_0x42bb2b(_0x11f976[_0xd8e7('0x12')][_0xd8e7('0x13')]);}})[_0xd8e7('0x14')](function(_0x706fd5){logger[_0xd8e7('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x30fe9c,_0x706fd5);_0x3dea3e(_0x706fd5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 07f42e1..62b82fb 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 _0xc7e4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','update','destroy','exports','util','path'];(function(_0x2a1212,_0x51e1f4){var _0x133028=function(_0xe79c33){while(--_0xe79c33){_0x2a1212['push'](_0x2a1212['shift']());}};_0x133028(++_0x51e1f4);}(_0xc7e4,0x1da));var _0x4c7e=function(_0x4442ff,_0x5e93e5){_0x4442ff=_0x4442ff-0x0;var _0x3bb5e2=_0xc7e4[_0x4442ff];return _0x3bb5e2;};'use strict';var multer=require('multer');var util=require(_0x4c7e('0x0'));var path=require(_0x4c7e('0x1'));var timeout=require(_0x4c7e('0x2'));var express=require(_0x4c7e('0x3'));var router=express[_0x4c7e('0x4')]();var fs_extra=require(_0x4c7e('0x5'));var auth=require(_0x4c7e('0x6'));var interaction=require(_0x4c7e('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x4c7e('0x8')]('/',auth[_0x4c7e('0x9')](),controller['index']);router[_0x4c7e('0x8')](_0x4c7e('0xa'),auth[_0x4c7e('0x9')](),controller['show']);router['post']('/',auth[_0x4c7e('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4c7e('0xb')]);router['delete'](_0x4c7e('0xa'),auth[_0x4c7e('0x9')](),controller[_0x4c7e('0xc')]);module[_0x4c7e('0xd')]=router; \ No newline at end of file +var _0x7053=['create','exports','multer','path','express','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x5dc42e,_0x3873f5){var _0x1064c2=function(_0x10e03a){while(--_0x10e03a){_0x5dc42e['push'](_0x5dc42e['shift']());}};_0x1064c2(++_0x3873f5);}(_0x7053,0xfe));var _0x3705=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0x7053[_0xaf25ae];return _0x49732d;};'use strict';var multer=require(_0x3705('0x0'));var util=require('util');var path=require(_0x3705('0x1'));var timeout=require('connect-timeout');var express=require(_0x3705('0x2'));var router=express['Router']();var fs_extra=require(_0x3705('0x3'));var auth=require(_0x3705('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3705('0x5'));router[_0x3705('0x6')]('/',auth[_0x3705('0x7')](),controller[_0x3705('0x8')]);router['get'](_0x3705('0x9'),auth[_0x3705('0x7')](),controller['show']);router['post']('/',auth[_0x3705('0x7')](),controller[_0x3705('0xa')]);router['put'](_0x3705('0x9'),auth[_0x3705('0x7')](),controller['update']);router['delete'](_0x3705('0x9'),auth[_0x3705('0x7')](),controller['destroy']);module[_0x3705('0xb')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 803295d..67475b4 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 _0x9732=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x11ca4c,_0x460772){var _0x54fd4d=function(_0x4fd99d){while(--_0x4fd99d){_0x11ca4c['push'](_0x11ca4c['shift']());}};_0x54fd4d(++_0x460772);}(_0x9732,0x104));var _0x2973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9732[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2973('0x0'));module['exports']={'type':{'type':Sequelize[_0x2973('0x1')](_0x2973('0x2'),_0x2973('0x3'),_0x2973('0x4'),_0x2973('0x5'),_0x2973('0x6')),'defaultValue':_0x2973('0x2')},'content':{'type':Sequelize[_0x2973('0x7')]},'key':{'type':Sequelize[_0x2973('0x7')]},'keyType':{'type':Sequelize[_0x2973('0x1')](_0x2973('0x2'),_0x2973('0x3'),_0x2973('0x4'))},'keyContent':{'type':Sequelize[_0x2973('0x7')]},'idField':{'type':Sequelize[_0x2973('0x7')]},'nameField':{'type':Sequelize[_0x2973('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2973('0x7')]}}; \ No newline at end of file +var _0x0ebf=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x474bcc,_0x63c88b){var _0x4455b2=function(_0xc4e28f){while(--_0xc4e28f){_0x474bcc['push'](_0x474bcc['shift']());}};_0x4455b2(++_0x63c88b);}(_0x0ebf,0x178));var _0xf0eb=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x0ebf[_0x277721];return _0x286051;};'use strict';var Sequelize=require(_0xf0eb('0x0'));module[_0xf0eb('0x1')]={'type':{'type':Sequelize[_0xf0eb('0x2')](_0xf0eb('0x3'),_0xf0eb('0x4'),'customVariable',_0xf0eb('0x5'),_0xf0eb('0x6')),'defaultValue':_0xf0eb('0x3')},'content':{'type':Sequelize[_0xf0eb('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf0eb('0x2')]('string','variable',_0xf0eb('0x8'))},'keyContent':{'type':Sequelize[_0xf0eb('0x7')]},'idField':{'type':Sequelize[_0xf0eb('0x7')]},'nameField':{'type':Sequelize[_0xf0eb('0x7')]},'customField':{'type':Sequelize[_0xf0eb('0x9')],'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 568e8c3..b313b8b 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 _0x2bbd=['json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','Dynamics365Field','includeAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x34ca41,_0x5b71ba){var _0x1517db=function(_0x112ec7){while(--_0x112ec7){_0x34ca41['push'](_0x34ca41['shift']());}};_0x1517db(++_0x5b71ba);}(_0x2bbd,0x1d5));var _0xd2bb=function(_0x1751cc,_0x4ba834){_0x1751cc=_0x1751cc-0x0;var _0x45a877=_0x2bbd[_0x1751cc];return _0x45a877;};'use strict';var emlformat=require(_0xd2bb('0x0'));var rimraf=require(_0xd2bb('0x1'));var zipdir=require(_0xd2bb('0x2'));var jsonpatch=require(_0xd2bb('0x3'));var rp=require(_0xd2bb('0x4'));var moment=require('moment');var BPromise=require(_0xd2bb('0x5'));var Mustache=require('mustache');var util=require(_0xd2bb('0x6'));var path=require(_0xd2bb('0x7'));var sox=require(_0xd2bb('0x8'));var csv=require(_0xd2bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2bb('0xa'));var _=require(_0xd2bb('0xb'));var squel=require(_0xd2bb('0xc'));var crypto=require(_0xd2bb('0xd'));var jsforce=require(_0xd2bb('0xe'));var deskjs=require(_0xd2bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd2bb('0x10'));var Papa=require(_0xd2bb('0x11'));var Redis=require(_0xd2bb('0x12'));var authService=require(_0xd2bb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd2bb('0x14'));var hardwareService=require(_0xd2bb('0x15'));var logger=require('../../config/logger')(_0xd2bb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd2bb('0x17'));var db=require(_0xd2bb('0x18'))['db'];function respondWithStatusCode(_0x3994ce,_0x548030){_0x548030=_0x548030||0xcc;return function(_0xc69649){if(_0xc69649){return _0x3994ce[_0xd2bb('0x19')](_0x548030);}return _0x3994ce['status'](_0x548030)[_0xd2bb('0x1a')]();};}function respondWithResult(_0x9a0a2f,_0x42b57e){_0x42b57e=_0x42b57e||0xc8;return function(_0x243ad9){if(_0x243ad9){return _0x9a0a2f[_0xd2bb('0x1b')](_0x42b57e)[_0xd2bb('0x1c')](_0x243ad9);}};}function respondWithFilteredResult(_0x5c58ac,_0x5a411a){return function(_0x1a7862){if(_0x1a7862){var _0x4d8aca=typeof _0x5a411a[_0xd2bb('0x1d')]===_0xd2bb('0x1e')&&typeof _0x5a411a[_0xd2bb('0x1f')]==='undefined';var _0x2d199b=_0x1a7862[_0xd2bb('0x20')];var _0x22840e=_0x4d8aca?0x0:_0x5a411a[_0xd2bb('0x1d')];var _0x4762a3=_0x4d8aca?_0x1a7862[_0xd2bb('0x20')]:_0x5a411a[_0xd2bb('0x1d')]+_0x5a411a[_0xd2bb('0x1f')];var _0x476bc6;if(_0x4762a3>=_0x2d199b){_0x4762a3=_0x2d199b;_0x476bc6=0xc8;}else{_0x476bc6=0xce;}_0x5c58ac[_0xd2bb('0x1b')](_0x476bc6);return _0x5c58ac[_0xd2bb('0x21')](_0xd2bb('0x22'),_0x22840e+'-'+_0x4762a3+'/'+_0x2d199b)['json'](_0x1a7862);}return null;};}function patchUpdates(_0x14cb72){return function(_0x57623d){try{jsonpatch['apply'](_0x57623d,_0x14cb72,!![]);}catch(_0x314ba6){return BPromise['reject'](_0x314ba6);}return _0x57623d[_0xd2bb('0x23')]();};}function saveUpdates(_0xfb239d,_0xb114ee){return function(_0x17e4be){if(_0x17e4be){return _0x17e4be[_0xd2bb('0x24')](_0xfb239d)[_0xd2bb('0x25')](function(_0x50acda){return _0x50acda;});}return null;};}function removeEntity(_0x3a951d,_0x20db81){return function(_0x408db5){if(_0x408db5){return _0x408db5[_0xd2bb('0x26')]()[_0xd2bb('0x25')](function(){_0x3a951d[_0xd2bb('0x1b')](0xcc)[_0xd2bb('0x1a')]();});}};}function handleEntityNotFound(_0x22a8e6,_0x5591d2){return function(_0x34abc9){if(!_0x34abc9){_0x22a8e6['sendStatus'](0x194);}return _0x34abc9;};}function handleError(_0x16512c,_0x3c4755){_0x3c4755=_0x3c4755||0x1f4;return function(_0x1e21d8){logger[_0xd2bb('0x27')](_0x1e21d8['stack']);if(_0x1e21d8['name']){delete _0x1e21d8[_0xd2bb('0x28')];}_0x16512c['status'](_0x3c4755)['send'](_0x1e21d8);};}exports[_0xd2bb('0x29')]=function(_0x469f7b,_0x508dec){var _0x43677c={},_0x26d245={},_0x351b6e={'count':0x0,'rows':[]};var _0x1c8679=_[_0xd2bb('0x2a')](db['Dynamics365Field'][_0xd2bb('0x2b')],function(_0x5c622e){return{'name':_0x5c622e[_0xd2bb('0x2c')],'type':_0x5c622e['type'][_0xd2bb('0x2d')]};});_0x26d245[_0xd2bb('0x2e')]=_[_0xd2bb('0x2a')](_0x1c8679,_0xd2bb('0x28'));_0x26d245[_0xd2bb('0x2f')]=_[_0xd2bb('0x30')](_0x469f7b['query']);_0x26d245[_0xd2bb('0x31')]=_[_0xd2bb('0x32')](_0x26d245[_0xd2bb('0x2e')],_0x26d245[_0xd2bb('0x2f')]);_0x43677c['attributes']=_['intersection'](_0x26d245['model'],qs[_0xd2bb('0x33')](_0x469f7b[_0xd2bb('0x2f')][_0xd2bb('0x33')]));_0x43677c[_0xd2bb('0x34')]=_0x43677c[_0xd2bb('0x34')][_0xd2bb('0x35')]?_0x43677c['attributes']:_0x26d245[_0xd2bb('0x2e')];if(!_0x469f7b[_0xd2bb('0x2f')][_0xd2bb('0x36')]('nolimit')){_0x43677c[_0xd2bb('0x1f')]=qs[_0xd2bb('0x1f')](_0x469f7b[_0xd2bb('0x2f')][_0xd2bb('0x1f')]);_0x43677c[_0xd2bb('0x1d')]=qs['offset'](_0x469f7b[_0xd2bb('0x2f')][_0xd2bb('0x1d')]);}_0x43677c[_0xd2bb('0x37')]=qs[_0xd2bb('0x38')](_0x469f7b['query']['sort']);_0x43677c[_0xd2bb('0x39')]=qs[_0xd2bb('0x31')](_['pick'](_0x469f7b[_0xd2bb('0x2f')],_0x26d245[_0xd2bb('0x31')]),_0x1c8679);if(_0x469f7b[_0xd2bb('0x2f')][_0xd2bb('0x3a')]){_0x43677c[_0xd2bb('0x39')]=_['merge'](_0x43677c[_0xd2bb('0x39')],{'$or':_[_0xd2bb('0x2a')](_0x1c8679,function(_0x246509){if(_0x246509['type']!==_0xd2bb('0x3b')){var _0x4fcfa5={};_0x4fcfa5[_0x246509[_0xd2bb('0x28')]]={'$like':'%'+_0x469f7b[_0xd2bb('0x2f')][_0xd2bb('0x3a')]+'%'};return _0x4fcfa5;}})});}_0x43677c=_[_0xd2bb('0x3c')]({},_0x43677c,_0x469f7b[_0xd2bb('0x3d')]);var _0x3d0ecf={'where':_0x43677c[_0xd2bb('0x39')]};return db[_0xd2bb('0x3e')][_0xd2bb('0x20')](_0x3d0ecf)[_0xd2bb('0x25')](function(_0xf4e17e){_0x351b6e[_0xd2bb('0x20')]=_0xf4e17e;if(_0x469f7b[_0xd2bb('0x2f')][_0xd2bb('0x3f')]){_0x43677c['include']=[{'all':!![]}];}return db[_0xd2bb('0x3e')]['findAll'](_0x43677c);})[_0xd2bb('0x25')](function(_0x10652b){_0x351b6e[_0xd2bb('0x40')]=_0x10652b;return _0x351b6e;})[_0xd2bb('0x25')](respondWithFilteredResult(_0x508dec,_0x43677c))[_0xd2bb('0x41')](handleError(_0x508dec,null));};exports[_0xd2bb('0x42')]=function(_0x4626b0,_0x1be872){var _0x328d8c={'raw':!![],'where':{'id':_0x4626b0[_0xd2bb('0x43')]['id']}},_0x211663={};_0x211663[_0xd2bb('0x2e')]=_['keys'](db[_0xd2bb('0x3e')][_0xd2bb('0x2b')]);_0x211663[_0xd2bb('0x2f')]=_[_0xd2bb('0x30')](_0x4626b0[_0xd2bb('0x2f')]);_0x211663[_0xd2bb('0x31')]=_[_0xd2bb('0x32')](_0x211663[_0xd2bb('0x2e')],_0x211663[_0xd2bb('0x2f')]);_0x328d8c['attributes']=_[_0xd2bb('0x32')](_0x211663[_0xd2bb('0x2e')],qs['fields'](_0x4626b0[_0xd2bb('0x2f')][_0xd2bb('0x33')]));_0x328d8c[_0xd2bb('0x34')]=_0x328d8c[_0xd2bb('0x34')][_0xd2bb('0x35')]?_0x328d8c[_0xd2bb('0x34')]:_0x211663[_0xd2bb('0x2e')];if(_0x4626b0[_0xd2bb('0x2f')][_0xd2bb('0x3f')]){_0x328d8c['include']=[{'all':!![]}];}_0x328d8c=_[_0xd2bb('0x3c')]({},_0x328d8c,_0x4626b0[_0xd2bb('0x3d')]);return db[_0xd2bb('0x3e')][_0xd2bb('0x44')](_0x328d8c)[_0xd2bb('0x25')](handleEntityNotFound(_0x1be872,null))[_0xd2bb('0x25')](respondWithResult(_0x1be872,null))[_0xd2bb('0x41')](handleError(_0x1be872,null));};exports[_0xd2bb('0x45')]=function(_0x210082,_0x380d2f){return db[_0xd2bb('0x3e')][_0xd2bb('0x45')](_0x210082[_0xd2bb('0x46')],{})[_0xd2bb('0x25')](respondWithResult(_0x380d2f,0xc9))[_0xd2bb('0x41')](handleError(_0x380d2f,null));};exports[_0xd2bb('0x24')]=function(_0x4b3362,_0x249a37){if(_0x4b3362['body']['id']){delete _0x4b3362[_0xd2bb('0x46')]['id'];}return db[_0xd2bb('0x3e')][_0xd2bb('0x44')]({'where':{'id':_0x4b3362['params']['id']}})[_0xd2bb('0x25')](handleEntityNotFound(_0x249a37,null))[_0xd2bb('0x25')](saveUpdates(_0x4b3362['body'],null))[_0xd2bb('0x25')](respondWithResult(_0x249a37,null))['catch'](handleError(_0x249a37,null));};exports['destroy']=function(_0x2ea0ce,_0x55fffa){return db['Dynamics365Field']['find']({'where':{'id':_0x2ea0ce[_0xd2bb('0x43')]['id']}})[_0xd2bb('0x25')](handleEntityNotFound(_0x55fffa,null))[_0xd2bb('0x25')](removeEntity(_0x55fffa,null))['catch'](handleError(_0x55fffa,null));}; \ No newline at end of file +var _0xa606=['query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rawAttributes','intersection','includeAll','find','catch','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Field','fieldName','type','model'];(function(_0x394177,_0x1cf6fb){var _0x7ab9a3=function(_0x4da9de){while(--_0x4da9de){_0x394177['push'](_0x394177['shift']());}};_0x7ab9a3(++_0x1cf6fb);}(_0xa606,0xa9));var _0x6a60=function(_0x28e920,_0x4b6cff){_0x28e920=_0x28e920-0x0;var _0x47066c=_0xa606[_0x28e920];return _0x47066c;};'use strict';var emlformat=require(_0x6a60('0x0'));var rimraf=require(_0x6a60('0x1'));var zipdir=require(_0x6a60('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a60('0x3'));var moment=require(_0x6a60('0x4'));var BPromise=require(_0x6a60('0x5'));var Mustache=require(_0x6a60('0x6'));var util=require(_0x6a60('0x7'));var path=require(_0x6a60('0x8'));var sox=require(_0x6a60('0x9'));var csv=require('to-csv');var ejs=require(_0x6a60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a60('0xb'));var squel=require(_0x6a60('0xc'));var crypto=require(_0x6a60('0xd'));var jsforce=require(_0x6a60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6a60('0xf'));var querystring=require(_0x6a60('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a60('0x11'));var qs=require(_0x6a60('0x12'));var as=require(_0x6a60('0x13'));var hardwareService=require(_0x6a60('0x14'));var logger=require(_0x6a60('0x15'))(_0x6a60('0x16'));var utils=require(_0x6a60('0x17'));var config=require(_0x6a60('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a60('0x19'))['db'];function respondWithStatusCode(_0x594974,_0x1990bf){_0x1990bf=_0x1990bf||0xcc;return function(_0x430cc8){if(_0x430cc8){return _0x594974['sendStatus'](_0x1990bf);}return _0x594974[_0x6a60('0x1a')](_0x1990bf)[_0x6a60('0x1b')]();};}function respondWithResult(_0x200976,_0x359e03){_0x359e03=_0x359e03||0xc8;return function(_0x410f85){if(_0x410f85){return _0x200976['status'](_0x359e03)[_0x6a60('0x1c')](_0x410f85);}};}function respondWithFilteredResult(_0x50edfc,_0x15c6f4){return function(_0xa02705){if(_0xa02705){var _0x247ca4=typeof _0x15c6f4[_0x6a60('0x1d')]==='undefined'&&typeof _0x15c6f4[_0x6a60('0x1e')]===_0x6a60('0x1f');var _0x39510b=_0xa02705[_0x6a60('0x20')];var _0x4aea88=_0x247ca4?0x0:_0x15c6f4['offset'];var _0x39e9a7=_0x247ca4?_0xa02705[_0x6a60('0x20')]:_0x15c6f4['offset']+_0x15c6f4[_0x6a60('0x1e')];var _0x218440;if(_0x39e9a7>=_0x39510b){_0x39e9a7=_0x39510b;_0x218440=0xc8;}else{_0x218440=0xce;}_0x50edfc[_0x6a60('0x1a')](_0x218440);return _0x50edfc['set'](_0x6a60('0x21'),_0x4aea88+'-'+_0x39e9a7+'/'+_0x39510b)[_0x6a60('0x1c')](_0xa02705);}return null;};}function patchUpdates(_0x570a32){return function(_0x4dbf72){try{jsonpatch[_0x6a60('0x22')](_0x4dbf72,_0x570a32,!![]);}catch(_0x60411a){return BPromise[_0x6a60('0x23')](_0x60411a);}return _0x4dbf72[_0x6a60('0x24')]();};}function saveUpdates(_0x3ab82b,_0x1e5c78){return function(_0x5ef05f){if(_0x5ef05f){return _0x5ef05f[_0x6a60('0x25')](_0x3ab82b)[_0x6a60('0x26')](function(_0x64246c){return _0x64246c;});}return null;};}function removeEntity(_0x29dd58,_0x2f54af){return function(_0x18518f){if(_0x18518f){return _0x18518f[_0x6a60('0x27')]()['then'](function(){_0x29dd58[_0x6a60('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6ea8ad,_0xf58499){return function(_0x2de721){if(!_0x2de721){_0x6ea8ad[_0x6a60('0x28')](0x194);}return _0x2de721;};}function handleError(_0x20d32d,_0x5c894c){_0x5c894c=_0x5c894c||0x1f4;return function(_0x16df4b){logger['error'](_0x16df4b[_0x6a60('0x29')]);if(_0x16df4b[_0x6a60('0x2a')]){delete _0x16df4b[_0x6a60('0x2a')];}_0x20d32d[_0x6a60('0x1a')](_0x5c894c)[_0x6a60('0x2b')](_0x16df4b);};}exports[_0x6a60('0x2c')]=function(_0x45345f,_0x12732f){var _0xece978={},_0x51762d={},_0x5e9eb4={'count':0x0,'rows':[]};var _0x20a69d=_[_0x6a60('0x2d')](db[_0x6a60('0x2e')]['rawAttributes'],function(_0xa1b800){return{'name':_0xa1b800[_0x6a60('0x2f')],'type':_0xa1b800[_0x6a60('0x30')]['key']};});_0x51762d[_0x6a60('0x31')]=_[_0x6a60('0x2d')](_0x20a69d,_0x6a60('0x2a'));_0x51762d[_0x6a60('0x32')]=_[_0x6a60('0x33')](_0x45345f[_0x6a60('0x32')]);_0x51762d[_0x6a60('0x34')]=_['intersection'](_0x51762d[_0x6a60('0x31')],_0x51762d[_0x6a60('0x32')]);_0xece978['attributes']=_['intersection'](_0x51762d[_0x6a60('0x31')],qs[_0x6a60('0x35')](_0x45345f['query']['fields']));_0xece978['attributes']=_0xece978[_0x6a60('0x36')]['length']?_0xece978[_0x6a60('0x36')]:_0x51762d['model'];if(!_0x45345f[_0x6a60('0x32')]['hasOwnProperty'](_0x6a60('0x37'))){_0xece978[_0x6a60('0x1e')]=qs['limit'](_0x45345f[_0x6a60('0x32')]['limit']);_0xece978['offset']=qs[_0x6a60('0x1d')](_0x45345f['query']['offset']);}_0xece978[_0x6a60('0x38')]=qs['sort'](_0x45345f[_0x6a60('0x32')][_0x6a60('0x39')]);_0xece978[_0x6a60('0x3a')]=qs[_0x6a60('0x34')](_[_0x6a60('0x3b')](_0x45345f[_0x6a60('0x32')],_0x51762d['filters']),_0x20a69d);if(_0x45345f[_0x6a60('0x32')][_0x6a60('0x3c')]){_0xece978[_0x6a60('0x3a')]=_[_0x6a60('0x3d')](_0xece978[_0x6a60('0x3a')],{'$or':_[_0x6a60('0x2d')](_0x20a69d,function(_0x7a467){if(_0x7a467[_0x6a60('0x30')]!=='VIRTUAL'){var _0x30d8a1={};_0x30d8a1[_0x7a467['name']]={'$like':'%'+_0x45345f[_0x6a60('0x32')][_0x6a60('0x3c')]+'%'};return _0x30d8a1;}})});}_0xece978=_['merge']({},_0xece978,_0x45345f[_0x6a60('0x3e')]);var _0x317c2a={'where':_0xece978[_0x6a60('0x3a')]};return db[_0x6a60('0x2e')][_0x6a60('0x20')](_0x317c2a)[_0x6a60('0x26')](function(_0x380de4){_0x5e9eb4[_0x6a60('0x20')]=_0x380de4;if(_0x45345f['query']['includeAll']){_0xece978[_0x6a60('0x3f')]=[{'all':!![]}];}return db[_0x6a60('0x2e')][_0x6a60('0x40')](_0xece978);})[_0x6a60('0x26')](function(_0x5cb221){_0x5e9eb4['rows']=_0x5cb221;return _0x5e9eb4;})[_0x6a60('0x26')](respondWithFilteredResult(_0x12732f,_0xece978))['catch'](handleError(_0x12732f,null));};exports['show']=function(_0x5e70f7,_0x598d54){var _0x4f8e82={'raw':!![],'where':{'id':_0x5e70f7['params']['id']}},_0x64cb0e={};_0x64cb0e['model']=_[_0x6a60('0x33')](db[_0x6a60('0x2e')][_0x6a60('0x41')]);_0x64cb0e[_0x6a60('0x32')]=_[_0x6a60('0x33')](_0x5e70f7['query']);_0x64cb0e['filters']=_[_0x6a60('0x42')](_0x64cb0e[_0x6a60('0x31')],_0x64cb0e['query']);_0x4f8e82[_0x6a60('0x36')]=_[_0x6a60('0x42')](_0x64cb0e[_0x6a60('0x31')],qs['fields'](_0x5e70f7[_0x6a60('0x32')][_0x6a60('0x35')]));_0x4f8e82['attributes']=_0x4f8e82[_0x6a60('0x36')]['length']?_0x4f8e82[_0x6a60('0x36')]:_0x64cb0e[_0x6a60('0x31')];if(_0x5e70f7[_0x6a60('0x32')][_0x6a60('0x43')]){_0x4f8e82[_0x6a60('0x3f')]=[{'all':!![]}];}_0x4f8e82=_[_0x6a60('0x3d')]({},_0x4f8e82,_0x5e70f7[_0x6a60('0x3e')]);return db[_0x6a60('0x2e')][_0x6a60('0x44')](_0x4f8e82)['then'](handleEntityNotFound(_0x598d54,null))[_0x6a60('0x26')](respondWithResult(_0x598d54,null))[_0x6a60('0x45')](handleError(_0x598d54,null));};exports[_0x6a60('0x46')]=function(_0x2b4640,_0x29bbeb){return db[_0x6a60('0x2e')]['create'](_0x2b4640['body'],{})[_0x6a60('0x26')](respondWithResult(_0x29bbeb,0xc9))['catch'](handleError(_0x29bbeb,null));};exports[_0x6a60('0x25')]=function(_0x27c963,_0x5bb68d){if(_0x27c963[_0x6a60('0x47')]['id']){delete _0x27c963[_0x6a60('0x47')]['id'];}return db[_0x6a60('0x2e')][_0x6a60('0x44')]({'where':{'id':_0x27c963[_0x6a60('0x48')]['id']}})[_0x6a60('0x26')](handleEntityNotFound(_0x5bb68d,null))[_0x6a60('0x26')](saveUpdates(_0x27c963[_0x6a60('0x47')],null))['then'](respondWithResult(_0x5bb68d,null))[_0x6a60('0x45')](handleError(_0x5bb68d,null));};exports[_0x6a60('0x27')]=function(_0x4acce8,_0x244f88){return db['Dynamics365Field'][_0x6a60('0x44')]({'where':{'id':_0x4acce8[_0x6a60('0x48')]['id']}})[_0x6a60('0x26')](handleEntityNotFound(_0x244f88,null))[_0x6a60('0x26')](removeEntity(_0x244f88,null))['catch'](handleError(_0x244f88,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c24c5f0..e940e87 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 _0x3587=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash'];(function(_0xcd40c4,_0x3e3659){var _0x22d92f=function(_0x415229){while(--_0x415229){_0xcd40c4['push'](_0xcd40c4['shift']());}};_0x22d92f(++_0x3e3659);}(_0x3587,0x179));var _0x7358=function(_0x40db10,_0x14cb74){_0x40db10=_0x40db10-0x0;var _0x272014=_0x3587[_0x40db10];return _0x272014;};'use strict';var _=require(_0x7358('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7358('0x1'));var BPromise=require(_0x7358('0x2'));var rp=require(_0x7358('0x3'));var fs=require('fs');var path=require(_0x7358('0x4'));var rimraf=require(_0x7358('0x5'));var config=require(_0x7358('0x6'));var attributes=require(_0x7358('0x7'));module[_0x7358('0x8')]=function(_0xd5972a,_0x1089a5){return _0xd5972a[_0x7358('0x9')](_0x7358('0xa'),attributes,{'tableName':_0x7358('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x7358('0xc'),_0x7358('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5322=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes'];(function(_0x4e99fd,_0x3a2f2c){var _0x46b44e=function(_0x2ecebe){while(--_0x2ecebe){_0x4e99fd['push'](_0x4e99fd['shift']());}};_0x46b44e(++_0x3a2f2c);}(_0x5322,0xf5));var _0x2532=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x5322[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0x2532('0x0'));var util=require(_0x2532('0x1'));var logger=require(_0x2532('0x2'))(_0x2532('0x3'));var moment=require(_0x2532('0x4'));var BPromise=require(_0x2532('0x5'));var rp=require(_0x2532('0x6'));var fs=require('fs');var path=require(_0x2532('0x7'));var rimraf=require(_0x2532('0x8'));var config=require('../../config/environment');var attributes=require(_0x2532('0x9'));module[_0x2532('0xa')]=function(_0x6951ce,_0x1820a9){return _0x6951ce[_0x2532('0xb')](_0x2532('0xc'),attributes,{'tableName':_0x2532('0xd'),'paranoid':![],'indexes':[{'name':_0x2532('0xe'),'fields':[_0x2532('0xf'),_0x2532('0x10')],'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 8048118..d8c921a 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 _0xdef5=['Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xdef5,0x77));var _0x5def=function(_0x526caf,_0x4cf2ec){_0x526caf=_0x526caf-0x0;var _0x34b314=_0xdef5[_0x526caf];return _0x34b314;};'use strict';var _=require('lodash');var util=require(_0x5def('0x0'));var moment=require(_0x5def('0x1'));var BPromise=require(_0x5def('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5def('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5def('0x4'));var logger=require('../../config/logger')(_0x5def('0x5'));var config=require(_0x5def('0x6'));var jayson=require(_0x5def('0x7'));var client=jayson['client'][_0x5def('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8910d,_0x71134c,_0x576ec9){return new BPromise(function(_0x60797f,_0x2f6ca5){return client[_0x5def('0x9')](_0x8910d,_0x576ec9)[_0x5def('0xa')](function(_0x34c745){logger['info'](_0x5def('0xb'),_0x71134c,'request\x20sent');logger[_0x5def('0xc')](_0x5def('0xd'),_0x71134c,_0x5def('0xe'),JSON[_0x5def('0xf')](_0x34c745));if(_0x34c745[_0x5def('0x10')]){if(_0x34c745[_0x5def('0x10')][_0x5def('0x11')]===0x1f4){logger[_0x5def('0x10')](_0x5def('0xb'),_0x71134c,_0x34c745[_0x5def('0x10')]['message']);return _0x2f6ca5(_0x34c745[_0x5def('0x10')][_0x5def('0x12')]);}logger[_0x5def('0x10')](_0x5def('0xb'),_0x71134c,_0x34c745['error'][_0x5def('0x12')]);return _0x60797f(_0x34c745[_0x5def('0x10')][_0x5def('0x12')]);}else{logger[_0x5def('0x13')](_0x5def('0xb'),_0x71134c,_0x5def('0xe'));_0x60797f(_0x34c745[_0x5def('0x14')][_0x5def('0x12')]);}})[_0x5def('0x15')](function(_0x46d5ba){logger[_0x5def('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x71134c,_0x46d5ba);_0x2f6ca5(_0x46d5ba);});});} \ No newline at end of file +var _0x7e24=['jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4c10f9,_0x3ca0b9){var _0xf8689=function(_0x408cdb){while(--_0x408cdb){_0x4c10f9['push'](_0x4c10f9['shift']());}};_0xf8689(++_0x3ca0b9);}(_0x7e24,0x1b8));var _0x47e2=function(_0x1d5d74,_0x5639f2){_0x1d5d74=_0x1d5d74-0x0;var _0x4014d1=_0x7e24[_0x1d5d74];return _0x4014d1;};'use strict';var _=require(_0x47e2('0x0'));var util=require(_0x47e2('0x1'));var moment=require('moment');var BPromise=require(_0x47e2('0x2'));var rs=require(_0x47e2('0x3'));var fs=require('fs');var Redis=require(_0x47e2('0x4'));var db=require(_0x47e2('0x5'))['db'];var utils=require(_0x47e2('0x6'));var logger=require(_0x47e2('0x7'))(_0x47e2('0x8'));var config=require(_0x47e2('0x9'));var jayson=require(_0x47e2('0xa'));var client=jayson[_0x47e2('0xb')][_0x47e2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34d7a1,_0x2b4c27,_0x3151f0){return new BPromise(function(_0x3f8f3c,_0x345823){return client[_0x47e2('0xd')](_0x34d7a1,_0x3151f0)[_0x47e2('0xe')](function(_0x4d00cc){logger[_0x47e2('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x2b4c27,_0x47e2('0x10'));logger[_0x47e2('0x11')](_0x47e2('0x12'),_0x2b4c27,_0x47e2('0x10'),JSON['stringify'](_0x4d00cc));if(_0x4d00cc[_0x47e2('0x13')]){if(_0x4d00cc[_0x47e2('0x13')][_0x47e2('0x14')]===0x1f4){logger[_0x47e2('0x13')](_0x47e2('0x15'),_0x2b4c27,_0x4d00cc['error'][_0x47e2('0x16')]);return _0x345823(_0x4d00cc[_0x47e2('0x13')][_0x47e2('0x16')]);}logger[_0x47e2('0x13')](_0x47e2('0x15'),_0x2b4c27,_0x4d00cc[_0x47e2('0x13')][_0x47e2('0x16')]);return _0x3f8f3c(_0x4d00cc[_0x47e2('0x13')][_0x47e2('0x16')]);}else{logger[_0x47e2('0xf')](_0x47e2('0x15'),_0x2b4c27,'request\x20sent');_0x3f8f3c(_0x4d00cc[_0x47e2('0x17')][_0x47e2('0x16')]);}})[_0x47e2('0x18')](function(_0xfd6613){logger[_0x47e2('0x13')](_0x47e2('0x15'),_0x2b4c27,_0xfd6613);_0x345823(_0xfd6613);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7a33ea5..9625757 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 _0x01c2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put'];(function(_0x2bdb0e,_0x50263b){var _0x50cd84=function(_0x12efb7){while(--_0x12efb7){_0x2bdb0e['push'](_0x2bdb0e['shift']());}};_0x50cd84(++_0x50263b);}(_0x01c2,0x9a));var _0x201c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01c2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x201c('0x0'));var util=require(_0x201c('0x1'));var path=require(_0x201c('0x2'));var timeout=require(_0x201c('0x3'));var express=require(_0x201c('0x4'));var router=express[_0x201c('0x5')]();var fs_extra=require(_0x201c('0x6'));var auth=require(_0x201c('0x7'));var interaction=require(_0x201c('0x8'));var config=require('../../config/environment');var controller=require(_0x201c('0x9'));router[_0x201c('0xa')]('/',auth[_0x201c('0xb')](),controller['index']);router[_0x201c('0xa')](_0x201c('0xc'),auth[_0x201c('0xb')](),controller[_0x201c('0xd')]);router[_0x201c('0xa')](_0x201c('0xe'),auth[_0x201c('0xb')](),controller[_0x201c('0xf')]);router[_0x201c('0xa')](_0x201c('0x10'),auth[_0x201c('0xb')](),controller['getFields']);router['post']('/',auth[_0x201c('0xb')](),controller[_0x201c('0x11')]);router[_0x201c('0x12')](_0x201c('0xe'),auth[_0x201c('0xb')](),controller[_0x201c('0x13')]);router[_0x201c('0x14')]('/:id',auth[_0x201c('0xb')](),controller[_0x201c('0x15')]);router[_0x201c('0x16')]('/:id',auth[_0x201c('0xb')](),controller[_0x201c('0x17')]);module[_0x201c('0x18')]=router; \ No newline at end of file +var _0xaef4=['multer','path','connect-timeout','express','fs-extra','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','delete','exports'];(function(_0x1822f8,_0x41e4f0){var _0x2fdc6d=function(_0x23e78d){while(--_0x23e78d){_0x1822f8['push'](_0x1822f8['shift']());}};_0x2fdc6d(++_0x41e4f0);}(_0xaef4,0x1a4));var _0x4aef=function(_0x329d78,_0xbd62cc){_0x329d78=_0x329d78-0x0;var _0x3a328f=_0xaef4[_0x329d78];return _0x3a328f;};'use strict';var multer=require(_0x4aef('0x0'));var util=require('util');var path=require(_0x4aef('0x1'));var timeout=require(_0x4aef('0x2'));var express=require(_0x4aef('0x3'));var router=express['Router']();var fs_extra=require(_0x4aef('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4aef('0x5'));router[_0x4aef('0x6')]('/',auth[_0x4aef('0x7')](),controller[_0x4aef('0x8')]);router[_0x4aef('0x6')](_0x4aef('0x9'),auth[_0x4aef('0x7')](),controller[_0x4aef('0xa')]);router[_0x4aef('0x6')](_0x4aef('0xb'),auth[_0x4aef('0x7')](),controller[_0x4aef('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x4aef('0xd')]);router['post']('/',auth[_0x4aef('0x7')](),controller[_0x4aef('0xe')]);router[_0x4aef('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4aef('0x10')]);router['put'](_0x4aef('0x9'),auth[_0x4aef('0x7')](),controller[_0x4aef('0x11')]);router[_0x4aef('0x12')](_0x4aef('0x9'),auth[_0x4aef('0x7')](),controller['destroy']);module[_0x4aef('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c1b3f8c..1235d6c 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 _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x521df7,_0x277fd6){var _0x4b57b5=function(_0x345f75){while(--_0x345f75){_0x521df7['push'](_0x521df7['shift']());}};_0x4b57b5(++_0x277fd6);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x6131c5,_0x26e7e7){_0x6131c5=_0x6131c5-0x0;var _0x33ddcb=_0xdd4f[_0x6131c5];return _0x33ddcb;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['STRING','username','exports'];(function(_0x79c241,_0x3e02cf){var _0x590990=function(_0x506b56){while(--_0x506b56){_0x79c241['push'](_0x79c241['shift']());}};_0x590990(++_0x3e02cf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x65f6('0x1')]},'username':{'type':Sequelize[_0x65f6('0x1')],'unique':_0x65f6('0x2')},'apiKey':{'type':Sequelize[_0x65f6('0x1')]},'remoteUri':{'type':Sequelize[_0x65f6('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 735e727..423b2a0 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 _0x38a5=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','update','body','getConfigurations','keys','FreshdeskConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','findOne','apiKey','remoteUri','substring','lastIndexOf','format','%s/%s','%s:X','toString','subject','group','source','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x38a5,0x69));var _0x538a=function(_0x433536,_0x4ee136){_0x433536=_0x433536-0x0;var _0x4d64fd=_0x38a5[_0x433536];return _0x4d64fd;};'use strict';var emlformat=require(_0x538a('0x0'));var rimraf=require(_0x538a('0x1'));var zipdir=require(_0x538a('0x2'));var jsonpatch=require(_0x538a('0x3'));var rp=require('request-promise');var moment=require(_0x538a('0x4'));var BPromise=require(_0x538a('0x5'));var Mustache=require(_0x538a('0x6'));var util=require(_0x538a('0x7'));var path=require(_0x538a('0x8'));var sox=require(_0x538a('0x9'));var csv=require(_0x538a('0xa'));var ejs=require(_0x538a('0xb'));var fs=require('fs');var fs_extra=require(_0x538a('0xc'));var _=require(_0x538a('0xd'));var squel=require(_0x538a('0xe'));var crypto=require(_0x538a('0xf'));var jsforce=require(_0x538a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x538a('0x11'));var Papa=require(_0x538a('0x12'));var Redis=require(_0x538a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x538a('0x14'));var as=require(_0x538a('0x15'));var hardwareService=require(_0x538a('0x16'));var logger=require(_0x538a('0x17'))(_0x538a('0x18'));var utils=require(_0x538a('0x19'));var config=require(_0x538a('0x1a'));var licenseUtil=require(_0x538a('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d9f47,_0x2051d0){_0x2051d0=_0x2051d0||0xcc;return function(_0x5e2d12){if(_0x5e2d12){return _0x1d9f47['sendStatus'](_0x2051d0);}return _0x1d9f47[_0x538a('0x1c')](_0x2051d0)[_0x538a('0x1d')]();};}function respondWithResult(_0x31551a,_0x10ef78){_0x10ef78=_0x10ef78||0xc8;return function(_0x41abff){if(_0x41abff){return _0x31551a[_0x538a('0x1c')](_0x10ef78)[_0x538a('0x1e')](_0x41abff);}};}function respondWithFilteredResult(_0x2da7c0,_0x4c8fe1){return function(_0xe56b7b){if(_0xe56b7b){var _0x29d92e=typeof _0x4c8fe1[_0x538a('0x1f')]==='undefined'&&typeof _0x4c8fe1['limit']==='undefined';var _0x4f873a=_0xe56b7b[_0x538a('0x20')];var _0x344b64=_0x29d92e?0x0:_0x4c8fe1[_0x538a('0x1f')];var _0x5108fb=_0x29d92e?_0xe56b7b[_0x538a('0x20')]:_0x4c8fe1[_0x538a('0x1f')]+_0x4c8fe1['limit'];var _0x31a93a;if(_0x5108fb>=_0x4f873a){_0x5108fb=_0x4f873a;_0x31a93a=0xc8;}else{_0x31a93a=0xce;}_0x2da7c0[_0x538a('0x1c')](_0x31a93a);return _0x2da7c0[_0x538a('0x21')](_0x538a('0x22'),_0x344b64+'-'+_0x5108fb+'/'+_0x4f873a)[_0x538a('0x1e')](_0xe56b7b);}return null;};}function patchUpdates(_0x4c3e2d){return function(_0x335dc6){try{jsonpatch[_0x538a('0x23')](_0x335dc6,_0x4c3e2d,!![]);}catch(_0x50c765){return BPromise[_0x538a('0x24')](_0x50c765);}return _0x335dc6[_0x538a('0x25')]();};}function saveUpdates(_0x3124c0,_0x47ee63){return function(_0x18fbab){if(_0x18fbab){return _0x18fbab['update'](_0x3124c0)[_0x538a('0x26')](function(_0x555340){return _0x555340;});}return null;};}function removeEntity(_0xed1f6a,_0x27d5c9){return function(_0x51766c){if(_0x51766c){return _0x51766c[_0x538a('0x27')]()[_0x538a('0x26')](function(){_0xed1f6a[_0x538a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cea03,_0x22c8a8){return function(_0x412209){if(!_0x412209){_0x1cea03['sendStatus'](0x194);}return _0x412209;};}function handleError(_0x4f2188,_0x141680){_0x141680=_0x141680||0x1f4;return function(_0x48222b){logger['error'](_0x48222b['stack']);if(_0x48222b[_0x538a('0x28')]){delete _0x48222b[_0x538a('0x28')];}_0x4f2188[_0x538a('0x1c')](_0x141680)[_0x538a('0x29')](_0x48222b);};}exports[_0x538a('0x2a')]=function(_0x42068a,_0x4d5ece){var _0x55b5c6={},_0x3cc681={},_0x5e6965={'count':0x0,'rows':[]};var _0x36a852=_[_0x538a('0x2b')](db[_0x538a('0x2c')]['rawAttributes'],function(_0x1e3841){return{'name':_0x1e3841[_0x538a('0x2d')],'type':_0x1e3841[_0x538a('0x2e')][_0x538a('0x2f')]};});_0x3cc681[_0x538a('0x30')]=_[_0x538a('0x2b')](_0x36a852,'name');_0x3cc681[_0x538a('0x31')]=_['keys'](_0x42068a[_0x538a('0x31')]);_0x3cc681[_0x538a('0x32')]=_[_0x538a('0x33')](_0x3cc681[_0x538a('0x30')],_0x3cc681[_0x538a('0x31')]);_0x55b5c6[_0x538a('0x34')]=_['intersection'](_0x3cc681['model'],qs['fields'](_0x42068a[_0x538a('0x31')][_0x538a('0x35')]));_0x55b5c6[_0x538a('0x34')]=_0x55b5c6[_0x538a('0x34')][_0x538a('0x36')]?_0x55b5c6[_0x538a('0x34')]:_0x3cc681[_0x538a('0x30')];if(!_0x42068a[_0x538a('0x31')][_0x538a('0x37')](_0x538a('0x38'))){_0x55b5c6[_0x538a('0x39')]=qs[_0x538a('0x39')](_0x42068a[_0x538a('0x31')][_0x538a('0x39')]);_0x55b5c6[_0x538a('0x1f')]=qs[_0x538a('0x1f')](_0x42068a[_0x538a('0x31')]['offset']);}_0x55b5c6[_0x538a('0x3a')]=qs['sort'](_0x42068a['query'][_0x538a('0x3b')]);_0x55b5c6[_0x538a('0x3c')]=qs[_0x538a('0x32')](_['pick'](_0x42068a[_0x538a('0x31')],_0x3cc681[_0x538a('0x32')]),_0x36a852);if(_0x42068a[_0x538a('0x31')][_0x538a('0x3d')]){_0x55b5c6[_0x538a('0x3c')]=_[_0x538a('0x3e')](_0x55b5c6[_0x538a('0x3c')],{'$or':_['map'](_0x36a852,function(_0x25ea80){if(_0x25ea80[_0x538a('0x2e')]!==_0x538a('0x3f')){var _0x4040b9={};_0x4040b9[_0x25ea80['name']]={'$like':'%'+_0x42068a[_0x538a('0x31')][_0x538a('0x3d')]+'%'};return _0x4040b9;}})});}_0x55b5c6=_['merge']({},_0x55b5c6,_0x42068a['options']);var _0x2583e1={'where':_0x55b5c6[_0x538a('0x3c')]};return db['FreshdeskAccount'][_0x538a('0x20')](_0x2583e1)[_0x538a('0x26')](function(_0x8332fc){_0x5e6965['count']=_0x8332fc;if(_0x42068a['query'][_0x538a('0x40')]){_0x55b5c6[_0x538a('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x538a('0x42')](_0x55b5c6);})['then'](function(_0x263dcb){_0x5e6965[_0x538a('0x43')]=_0x263dcb;return _0x5e6965;})['then'](respondWithFilteredResult(_0x4d5ece,_0x55b5c6))[_0x538a('0x44')](handleError(_0x4d5ece,null));};exports['show']=function(_0x5909ff,_0x4e8d85){var _0x33893b={'raw':![],'where':{'id':_0x5909ff[_0x538a('0x45')]['id']}},_0x3597a5={};_0x3597a5[_0x538a('0x30')]=_['keys'](db[_0x538a('0x2c')][_0x538a('0x46')]);_0x3597a5[_0x538a('0x31')]=_['keys'](_0x5909ff['query']);_0x3597a5['filters']=_[_0x538a('0x33')](_0x3597a5['model'],_0x3597a5[_0x538a('0x31')]);_0x33893b['attributes']=_[_0x538a('0x33')](_0x3597a5[_0x538a('0x30')],qs[_0x538a('0x35')](_0x5909ff[_0x538a('0x31')][_0x538a('0x35')]));_0x33893b[_0x538a('0x34')]=_0x33893b[_0x538a('0x34')][_0x538a('0x36')]?_0x33893b['attributes']:_0x3597a5[_0x538a('0x30')];if(_0x5909ff[_0x538a('0x31')]['includeAll']){_0x33893b['include']=[{'all':!![]}];}_0x33893b=_[_0x538a('0x3e')]({},_0x33893b,_0x5909ff[_0x538a('0x47')]);return db['FreshdeskAccount'][_0x538a('0x48')](_0x33893b)[_0x538a('0x26')](handleEntityNotFound(_0x4e8d85,null))[_0x538a('0x26')](respondWithResult(_0x4e8d85,null))[_0x538a('0x44')](handleError(_0x4e8d85,null));};exports[_0x538a('0x49')]=function(_0x51d0fc,_0x4c607e){return db[_0x538a('0x2c')][_0x538a('0x49')](_0x51d0fc['body'],{})[_0x538a('0x26')](respondWithResult(_0x4c607e,0xc9))[_0x538a('0x44')](handleError(_0x4c607e,null));};exports[_0x538a('0x4a')]=function(_0x19313d,_0x3b7ff7){if(_0x19313d[_0x538a('0x4b')]['id']){delete _0x19313d['body']['id'];}return db[_0x538a('0x2c')][_0x538a('0x48')]({'where':{'id':_0x19313d[_0x538a('0x45')]['id']}})[_0x538a('0x26')](handleEntityNotFound(_0x3b7ff7,null))['then'](saveUpdates(_0x19313d['body'],null))[_0x538a('0x26')](respondWithResult(_0x3b7ff7,null))[_0x538a('0x44')](handleError(_0x3b7ff7,null));};exports[_0x538a('0x27')]=function(_0x6c678c,_0x5da146){return db[_0x538a('0x2c')][_0x538a('0x48')]({'where':{'id':_0x6c678c[_0x538a('0x45')]['id']}})[_0x538a('0x26')](handleEntityNotFound(_0x5da146,null))[_0x538a('0x26')](removeEntity(_0x5da146,null))['catch'](handleError(_0x5da146,null));};exports[_0x538a('0x4c')]=function(_0x988816,_0x66b200,_0x1cc6e5){var _0x6e0172={};var _0x4f56e={};var _0x5ac705;var _0x30797c;return db[_0x538a('0x2c')]['findOne']({'where':{'id':_0x988816['params']['id']}})[_0x538a('0x26')](handleEntityNotFound(_0x66b200,null))[_0x538a('0x26')](function(_0x4feb08){if(_0x4feb08){_0x5ac705=_0x4feb08;_0x4f56e[_0x538a('0x30')]=_[_0x538a('0x4d')](db[_0x538a('0x4e')]['rawAttributes']);_0x4f56e[_0x538a('0x31')]=_[_0x538a('0x4d')](_0x988816['query']);_0x4f56e['filters']=_[_0x538a('0x33')](_0x4f56e[_0x538a('0x30')],_0x4f56e[_0x538a('0x31')]);_0x6e0172[_0x538a('0x34')]=_[_0x538a('0x33')](_0x4f56e['model'],qs[_0x538a('0x35')](_0x988816[_0x538a('0x31')]['fields']));_0x6e0172['attributes']=_0x6e0172['attributes']['length']?_0x6e0172[_0x538a('0x34')]:_0x4f56e[_0x538a('0x30')];_0x6e0172[_0x538a('0x3a')]=qs[_0x538a('0x3b')](_0x988816[_0x538a('0x31')][_0x538a('0x3b')]);_0x6e0172[_0x538a('0x3c')]=qs[_0x538a('0x32')](_[_0x538a('0x4f')](_0x988816[_0x538a('0x31')],_0x4f56e[_0x538a('0x32')]));if(_0x988816['query']['filter']){_0x6e0172['where']=_[_0x538a('0x3e')](_0x6e0172[_0x538a('0x3c')],{'$or':_[_0x538a('0x2b')](_0x6e0172[_0x538a('0x34')],function(_0x3c8ea6){var _0xcfbd15={};_0xcfbd15[_0x3c8ea6]={'$like':'%'+_0x988816['query']['filter']+'%'};return _0xcfbd15;})});}_0x6e0172=_['merge']({},_0x6e0172,_0x988816[_0x538a('0x47')]);return _0x5ac705[_0x538a('0x4c')](_0x6e0172);}})[_0x538a('0x26')](function(_0xb7f9fa){if(_0xb7f9fa){_0x30797c=_0xb7f9fa[_0x538a('0x36')];if(!_0x988816[_0x538a('0x31')]['hasOwnProperty'](_0x538a('0x38'))){_0x6e0172[_0x538a('0x39')]=qs[_0x538a('0x39')](_0x988816[_0x538a('0x31')][_0x538a('0x39')]);_0x6e0172['offset']=qs[_0x538a('0x1f')](_0x988816['query'][_0x538a('0x1f')]);}return _0x5ac705[_0x538a('0x4c')](_0x6e0172);}})[_0x538a('0x26')](function(_0x363717){if(_0x363717){return _0x363717?{'count':_0x30797c,'rows':_0x363717}:null;}})['then'](respondWithResult(_0x66b200,null))[_0x538a('0x44')](handleError(_0x66b200,null));};exports['addConfiguration']=function(_0x975d01,_0x549e17,_0x316c91){if(_0x975d01['body']['id']){delete _0x975d01['body']['id'];}return db[_0x538a('0x2c')]['findOne']({'where':{'id':_0x975d01[_0x538a('0x45')]['id']}})[_0x538a('0x26')](handleEntityNotFound(_0x549e17,null))[_0x538a('0x26')](function(_0xd4cf55){if(_0xd4cf55){_0x975d01[_0x538a('0x4b')][_0x538a('0x50')]=_0xd4cf55['id'];_0x975d01[_0x538a('0x4b')][_0x538a('0x51')]=integrations[_0x538a('0x52')](_0x975d01['body'][_0x538a('0x53')],_0x975d01[_0x538a('0x4b')]['type']);_0x975d01[_0x538a('0x4b')][_0x538a('0x54')]=integrations[_0x538a('0x55')](_0x975d01[_0x538a('0x4b')][_0x538a('0x53')],_0x975d01[_0x538a('0x4b')]['type']);return db[_0x538a('0x4e')]['create'](_0x975d01[_0x538a('0x4b')],{'include':[{'model':db[_0x538a('0x56')],'as':'Subjects'},{'model':db[_0x538a('0x56')],'as':'Descriptions'}]});}return null;})[_0x538a('0x26')](respondWithResult(_0x549e17,null))['catch'](handleError(_0x549e17,null));};exports[_0x538a('0x57')]=function(_0x3bd1f9,_0x65e858,_0x4c458d){var _0x36115f='';return db[_0x538a('0x2c')][_0x538a('0x58')]({'where':{'id':_0x3bd1f9[_0x538a('0x45')]['id']},'attributes':['id','remoteUri',_0x538a('0x59')]})['then'](handleEntityNotFound(_0x65e858,null))[_0x538a('0x26')](function(_0x58e2e8){if(_0x58e2e8){_0x36115f=_0x58e2e8[_0x538a('0x5a')];var _0x35ac7b=_0x36115f['slice'](-0x1);if(_0x35ac7b==='/'){_0x36115f=_0x36115f[_0x538a('0x5b')](0x0,_0x36115f[_0x538a('0x5c')](_0x35ac7b));}return rp({'method':'GET','uri':util[_0x538a('0x5d')](_0x538a('0x5e'),_0x36115f,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x538a('0x5d')]('Basic\x20%s',new Buffer(util[_0x538a('0x5d')](_0x538a('0x5f'),_0x58e2e8[_0x538a('0x59')]))[_0x538a('0x60')]('base64'))},'json':!![]});}})[_0x538a('0x26')](function(_0x20491f){if(_0x20491f){var _0x1a5c8f=['requester',_0x538a('0x61'),'agent','description',_0x538a('0x1c'),'priority',_0x538a('0x62'),_0x538a('0x63'),'ticket_type',_0x538a('0x62'),'company'];_[_0x538a('0x64')](_0x20491f,function(_0x12d354){return _0x1a5c8f[_0x538a('0x65')](_0x12d354[_0x538a('0x28')])||!_0x12d354[_0x538a('0x66')]&&_0x12d354['type']!==_0x538a('0x67')&&_0x12d354[_0x538a('0x2e')]!==_0x538a('0x68');});return{'count':_0x20491f[_0x538a('0x36')],'rows':_[_0x538a('0x2b')](_0x20491f,function(_0x1bbb81){return{'id':_0x1bbb81['name'],'name':_0x1bbb81[_0x538a('0x69')],'custom':!_0x1bbb81[_0x538a('0x66')],'options':_0x1bbb81[_0x538a('0x6a')]?_[_0x538a('0x2b')](_0x1bbb81[_0x538a('0x6a')],function(_0x262290){return{'name':_[_0x538a('0x6b')](_0x262290),'value':_0x262290};}):[]};})};}})[_0x538a('0x26')](respondWithResult(_0x65e858,null))[_0x538a('0x44')](function(_0x55fba6){var _0x125661=_0x3bd1f9['query'][_0x538a('0x6c')]?0x1f4:_0x55fba6[_0x538a('0x6d')]||0x1f4;logger[_0x538a('0x6e')](_0x538a('0x6f'),_0x538a('0x57'),_0x125661,JSON['stringify'](_0x55fba6));delete _0x55fba6[_0x538a('0x28')];if(_0x125661===0x191){_0x125661=0x190;}_0x65e858[_0x538a('0x1c')](_0x125661)['send'](_0x3bd1f9['query']['test']?{'message':_0x538a('0x70'),'statusCode':_0x55fba6['statusCode']}:_0x55fba6);});}; \ No newline at end of file +var _0x6b24=['label','choices','statusCode','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','rows','show','params','length','includeAll','include','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','%s:X','toString','subject','agent','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown'];(function(_0x52b018,_0x130caa){var _0x264797=function(_0x57f981){while(--_0x57f981){_0x52b018['push'](_0x52b018['shift']());}};_0x264797(++_0x130caa);}(_0x6b24,0x1ce));var _0x46b2=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x6b24[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b2('0x0'));var zipdir=require(_0x46b2('0x1'));var jsonpatch=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46b2('0x4'));var path=require('path');var sox=require(_0x46b2('0x5'));var csv=require('to-csv');var ejs=require(_0x46b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46b2('0x7'));var crypto=require(_0x46b2('0x8'));var jsforce=require(_0x46b2('0x9'));var deskjs=require(_0x46b2('0xa'));var toCsv=require(_0x46b2('0xb'));var querystring=require(_0x46b2('0xc'));var Papa=require(_0x46b2('0xd'));var Redis=require(_0x46b2('0xe'));var authService=require(_0x46b2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46b2('0x10'));var logger=require(_0x46b2('0x11'))(_0x46b2('0x12'));var utils=require('../../config/utils');var config=require(_0x46b2('0x13'));var licenseUtil=require(_0x46b2('0x14'));var db=require(_0x46b2('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x468ae9,_0x886e41){_0x886e41=_0x886e41||0xcc;return function(_0x411208){if(_0x411208){return _0x468ae9[_0x46b2('0x16')](_0x886e41);}return _0x468ae9[_0x46b2('0x17')](_0x886e41)[_0x46b2('0x18')]();};}function respondWithResult(_0x3ff25d,_0x228261){_0x228261=_0x228261||0xc8;return function(_0xc70994){if(_0xc70994){return _0x3ff25d[_0x46b2('0x17')](_0x228261)['json'](_0xc70994);}};}function respondWithFilteredResult(_0x43e0d9,_0x5b49da){return function(_0x49479c){if(_0x49479c){var _0x179bd9=typeof _0x5b49da[_0x46b2('0x19')]===_0x46b2('0x1a')&&typeof _0x5b49da[_0x46b2('0x1b')]===_0x46b2('0x1a');var _0x1497d6=_0x49479c[_0x46b2('0x1c')];var _0x5bd251=_0x179bd9?0x0:_0x5b49da[_0x46b2('0x19')];var _0x57e403=_0x179bd9?_0x49479c[_0x46b2('0x1c')]:_0x5b49da[_0x46b2('0x19')]+_0x5b49da[_0x46b2('0x1b')];var _0x4d04a1;if(_0x57e403>=_0x1497d6){_0x57e403=_0x1497d6;_0x4d04a1=0xc8;}else{_0x4d04a1=0xce;}_0x43e0d9[_0x46b2('0x17')](_0x4d04a1);return _0x43e0d9[_0x46b2('0x1d')](_0x46b2('0x1e'),_0x5bd251+'-'+_0x57e403+'/'+_0x1497d6)[_0x46b2('0x1f')](_0x49479c);}return null;};}function patchUpdates(_0x350f85){return function(_0x321033){try{jsonpatch[_0x46b2('0x20')](_0x321033,_0x350f85,!![]);}catch(_0x44c768){return BPromise[_0x46b2('0x21')](_0x44c768);}return _0x321033[_0x46b2('0x22')]();};}function saveUpdates(_0x29ade9,_0x1b5fbe){return function(_0x451985){if(_0x451985){return _0x451985[_0x46b2('0x23')](_0x29ade9)[_0x46b2('0x24')](function(_0x50011b){return _0x50011b;});}return null;};}function removeEntity(_0x209519,_0x4c2983){return function(_0x5ae029){if(_0x5ae029){return _0x5ae029[_0x46b2('0x25')]()[_0x46b2('0x24')](function(){_0x209519[_0x46b2('0x17')](0xcc)[_0x46b2('0x18')]();});}};}function handleEntityNotFound(_0x16f646,_0x58069e){return function(_0x95d2cf){if(!_0x95d2cf){_0x16f646[_0x46b2('0x16')](0x194);}return _0x95d2cf;};}function handleError(_0x5ca1c7,_0x3c5997){_0x3c5997=_0x3c5997||0x1f4;return function(_0x5ee12f){logger[_0x46b2('0x26')](_0x5ee12f[_0x46b2('0x27')]);if(_0x5ee12f[_0x46b2('0x28')]){delete _0x5ee12f[_0x46b2('0x28')];}_0x5ca1c7[_0x46b2('0x17')](_0x3c5997)[_0x46b2('0x29')](_0x5ee12f);};}exports[_0x46b2('0x2a')]=function(_0x1a6caf,_0x429496){var _0x20ccb2={},_0x5421d9={},_0x4e2a9b={'count':0x0,'rows':[]};var _0x4dcee5=_[_0x46b2('0x2b')](db[_0x46b2('0x2c')][_0x46b2('0x2d')],function(_0x58fd96){return{'name':_0x58fd96[_0x46b2('0x2e')],'type':_0x58fd96[_0x46b2('0x2f')]['key']};});_0x5421d9[_0x46b2('0x30')]=_[_0x46b2('0x2b')](_0x4dcee5,_0x46b2('0x28'));_0x5421d9[_0x46b2('0x31')]=_[_0x46b2('0x32')](_0x1a6caf[_0x46b2('0x31')]);_0x5421d9[_0x46b2('0x33')]=_[_0x46b2('0x34')](_0x5421d9[_0x46b2('0x30')],_0x5421d9['query']);_0x20ccb2[_0x46b2('0x35')]=_[_0x46b2('0x34')](_0x5421d9[_0x46b2('0x30')],qs['fields'](_0x1a6caf[_0x46b2('0x31')][_0x46b2('0x36')]));_0x20ccb2[_0x46b2('0x35')]=_0x20ccb2[_0x46b2('0x35')]['length']?_0x20ccb2[_0x46b2('0x35')]:_0x5421d9['model'];if(!_0x1a6caf[_0x46b2('0x31')][_0x46b2('0x37')](_0x46b2('0x38'))){_0x20ccb2[_0x46b2('0x1b')]=qs[_0x46b2('0x1b')](_0x1a6caf[_0x46b2('0x31')][_0x46b2('0x1b')]);_0x20ccb2['offset']=qs[_0x46b2('0x19')](_0x1a6caf[_0x46b2('0x31')][_0x46b2('0x19')]);}_0x20ccb2[_0x46b2('0x39')]=qs[_0x46b2('0x3a')](_0x1a6caf[_0x46b2('0x31')][_0x46b2('0x3a')]);_0x20ccb2['where']=qs['filters'](_['pick'](_0x1a6caf[_0x46b2('0x31')],_0x5421d9[_0x46b2('0x33')]),_0x4dcee5);if(_0x1a6caf['query'][_0x46b2('0x3b')]){_0x20ccb2['where']=_['merge'](_0x20ccb2[_0x46b2('0x3c')],{'$or':_[_0x46b2('0x2b')](_0x4dcee5,function(_0x214c77){if(_0x214c77[_0x46b2('0x2f')]!=='VIRTUAL'){var _0x243740={};_0x243740[_0x214c77['name']]={'$like':'%'+_0x1a6caf['query']['filter']+'%'};return _0x243740;}})});}_0x20ccb2=_[_0x46b2('0x3d')]({},_0x20ccb2,_0x1a6caf[_0x46b2('0x3e')]);var _0x447166={'where':_0x20ccb2['where']};return db[_0x46b2('0x2c')]['count'](_0x447166)[_0x46b2('0x24')](function(_0x290b7e){_0x4e2a9b['count']=_0x290b7e;if(_0x1a6caf[_0x46b2('0x31')]['includeAll']){_0x20ccb2['include']=[{'all':!![]}];}return db[_0x46b2('0x2c')]['findAll'](_0x20ccb2);})[_0x46b2('0x24')](function(_0x357116){_0x4e2a9b[_0x46b2('0x3f')]=_0x357116;return _0x4e2a9b;})[_0x46b2('0x24')](respondWithFilteredResult(_0x429496,_0x20ccb2))['catch'](handleError(_0x429496,null));};exports[_0x46b2('0x40')]=function(_0x13343e,_0x205027){var _0x4fdfeb={'raw':![],'where':{'id':_0x13343e[_0x46b2('0x41')]['id']}},_0x4c20bd={};_0x4c20bd[_0x46b2('0x30')]=_[_0x46b2('0x32')](db[_0x46b2('0x2c')]['rawAttributes']);_0x4c20bd['query']=_[_0x46b2('0x32')](_0x13343e[_0x46b2('0x31')]);_0x4c20bd[_0x46b2('0x33')]=_[_0x46b2('0x34')](_0x4c20bd[_0x46b2('0x30')],_0x4c20bd[_0x46b2('0x31')]);_0x4fdfeb['attributes']=_['intersection'](_0x4c20bd[_0x46b2('0x30')],qs[_0x46b2('0x36')](_0x13343e[_0x46b2('0x31')][_0x46b2('0x36')]));_0x4fdfeb['attributes']=_0x4fdfeb[_0x46b2('0x35')][_0x46b2('0x42')]?_0x4fdfeb[_0x46b2('0x35')]:_0x4c20bd[_0x46b2('0x30')];if(_0x13343e['query'][_0x46b2('0x43')]){_0x4fdfeb[_0x46b2('0x44')]=[{'all':!![]}];}_0x4fdfeb=_[_0x46b2('0x3d')]({},_0x4fdfeb,_0x13343e[_0x46b2('0x3e')]);return db[_0x46b2('0x2c')][_0x46b2('0x45')](_0x4fdfeb)[_0x46b2('0x24')](handleEntityNotFound(_0x205027,null))['then'](respondWithResult(_0x205027,null))[_0x46b2('0x46')](handleError(_0x205027,null));};exports[_0x46b2('0x47')]=function(_0x55c0aa,_0x1a3940){return db['FreshdeskAccount'][_0x46b2('0x47')](_0x55c0aa['body'],{})[_0x46b2('0x24')](respondWithResult(_0x1a3940,0xc9))[_0x46b2('0x46')](handleError(_0x1a3940,null));};exports['update']=function(_0x301c64,_0x9165fb){if(_0x301c64['body']['id']){delete _0x301c64['body']['id'];}return db[_0x46b2('0x2c')]['find']({'where':{'id':_0x301c64[_0x46b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x9165fb,null))[_0x46b2('0x24')](saveUpdates(_0x301c64[_0x46b2('0x48')],null))[_0x46b2('0x24')](respondWithResult(_0x9165fb,null))[_0x46b2('0x46')](handleError(_0x9165fb,null));};exports[_0x46b2('0x25')]=function(_0x251c28,_0x3a17cf){return db[_0x46b2('0x2c')][_0x46b2('0x45')]({'where':{'id':_0x251c28[_0x46b2('0x41')]['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x3a17cf,null))[_0x46b2('0x24')](removeEntity(_0x3a17cf,null))['catch'](handleError(_0x3a17cf,null));};exports[_0x46b2('0x49')]=function(_0x11b05f,_0x4eb8f4,_0x44599e){var _0x5012ac={};var _0x117774={};var _0x44836b;var _0x3d6189;return db[_0x46b2('0x2c')][_0x46b2('0x4a')]({'where':{'id':_0x11b05f[_0x46b2('0x41')]['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x4eb8f4,null))[_0x46b2('0x24')](function(_0x2dce5b){if(_0x2dce5b){_0x44836b=_0x2dce5b;_0x117774[_0x46b2('0x30')]=_['keys'](db[_0x46b2('0x4b')]['rawAttributes']);_0x117774['query']=_[_0x46b2('0x32')](_0x11b05f[_0x46b2('0x31')]);_0x117774['filters']=_[_0x46b2('0x34')](_0x117774[_0x46b2('0x30')],_0x117774[_0x46b2('0x31')]);_0x5012ac[_0x46b2('0x35')]=_[_0x46b2('0x34')](_0x117774[_0x46b2('0x30')],qs[_0x46b2('0x36')](_0x11b05f[_0x46b2('0x31')][_0x46b2('0x36')]));_0x5012ac['attributes']=_0x5012ac[_0x46b2('0x35')][_0x46b2('0x42')]?_0x5012ac[_0x46b2('0x35')]:_0x117774[_0x46b2('0x30')];_0x5012ac[_0x46b2('0x39')]=qs[_0x46b2('0x3a')](_0x11b05f['query'][_0x46b2('0x3a')]);_0x5012ac[_0x46b2('0x3c')]=qs['filters'](_[_0x46b2('0x4c')](_0x11b05f[_0x46b2('0x31')],_0x117774['filters']));if(_0x11b05f['query'][_0x46b2('0x3b')]){_0x5012ac[_0x46b2('0x3c')]=_[_0x46b2('0x3d')](_0x5012ac['where'],{'$or':_['map'](_0x5012ac[_0x46b2('0x35')],function(_0xfd511f){var _0x84131f={};_0x84131f[_0xfd511f]={'$like':'%'+_0x11b05f['query'][_0x46b2('0x3b')]+'%'};return _0x84131f;})});}_0x5012ac=_[_0x46b2('0x3d')]({},_0x5012ac,_0x11b05f[_0x46b2('0x3e')]);return _0x44836b[_0x46b2('0x49')](_0x5012ac);}})[_0x46b2('0x24')](function(_0x668088){if(_0x668088){_0x3d6189=_0x668088['length'];if(!_0x11b05f['query'][_0x46b2('0x37')]('nolimit')){_0x5012ac[_0x46b2('0x1b')]=qs[_0x46b2('0x1b')](_0x11b05f[_0x46b2('0x31')][_0x46b2('0x1b')]);_0x5012ac[_0x46b2('0x19')]=qs[_0x46b2('0x19')](_0x11b05f[_0x46b2('0x31')][_0x46b2('0x19')]);}return _0x44836b[_0x46b2('0x49')](_0x5012ac);}})[_0x46b2('0x24')](function(_0x41df32){if(_0x41df32){return _0x41df32?{'count':_0x3d6189,'rows':_0x41df32}:null;}})['then'](respondWithResult(_0x4eb8f4,null))[_0x46b2('0x46')](handleError(_0x4eb8f4,null));};exports[_0x46b2('0x4d')]=function(_0x11e778,_0x5c2546,_0x5a8e88){if(_0x11e778[_0x46b2('0x48')]['id']){delete _0x11e778[_0x46b2('0x48')]['id'];}return db['FreshdeskAccount'][_0x46b2('0x4a')]({'where':{'id':_0x11e778[_0x46b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c2546,null))[_0x46b2('0x24')](function(_0x56f179){if(_0x56f179){_0x11e778[_0x46b2('0x48')][_0x46b2('0x4e')]=_0x56f179['id'];_0x11e778[_0x46b2('0x48')][_0x46b2('0x4f')]=integrations[_0x46b2('0x50')](_0x11e778[_0x46b2('0x48')]['channel'],_0x11e778[_0x46b2('0x48')][_0x46b2('0x2f')]);_0x11e778[_0x46b2('0x48')][_0x46b2('0x51')]=integrations[_0x46b2('0x52')](_0x11e778[_0x46b2('0x48')][_0x46b2('0x53')],_0x11e778[_0x46b2('0x48')]['type']);return db[_0x46b2('0x4b')]['create'](_0x11e778['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x46b2('0x4f')},{'model':db[_0x46b2('0x54')],'as':_0x46b2('0x51')}]});}return null;})['then'](respondWithResult(_0x5c2546,null))[_0x46b2('0x46')](handleError(_0x5c2546,null));};exports[_0x46b2('0x55')]=function(_0x5cf1d0,_0x10e060,_0x1a0de8){var _0xd2bb80='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x5cf1d0['params']['id']},'attributes':['id','remoteUri',_0x46b2('0x56')]})['then'](handleEntityNotFound(_0x10e060,null))[_0x46b2('0x24')](function(_0x9571ec){if(_0x9571ec){_0xd2bb80=_0x9571ec[_0x46b2('0x57')];var _0x578368=_0xd2bb80[_0x46b2('0x58')](-0x1);if(_0x578368==='/'){_0xd2bb80=_0xd2bb80[_0x46b2('0x59')](0x0,_0xd2bb80[_0x46b2('0x5a')](_0x578368));}return rp({'method':_0x46b2('0x5b'),'uri':util['format']('%s/%s',_0xd2bb80,_0x46b2('0x5c')),'headers':{'Authorization':util[_0x46b2('0x5d')]('Basic\x20%s',new Buffer(util[_0x46b2('0x5d')](_0x46b2('0x5e'),_0x9571ec['apiKey']))[_0x46b2('0x5f')]('base64'))},'json':!![]});}})['then'](function(_0x28b834){if(_0x28b834){var _0x67abed=['requester',_0x46b2('0x60'),_0x46b2('0x61'),_0x46b2('0x62'),_0x46b2('0x17'),_0x46b2('0x63'),_0x46b2('0x64'),_0x46b2('0x65'),_0x46b2('0x66'),_0x46b2('0x64'),_0x46b2('0x67')];_[_0x46b2('0x68')](_0x28b834,function(_0x324e5d){return _0x67abed['includes'](_0x324e5d[_0x46b2('0x28')])||!_0x324e5d[_0x46b2('0x69')]&&_0x324e5d['type']!==_0x46b2('0x6a')&&_0x324e5d[_0x46b2('0x2f')]!==_0x46b2('0x6b');});return{'count':_0x28b834[_0x46b2('0x42')],'rows':_[_0x46b2('0x2b')](_0x28b834,function(_0x316832){return{'id':_0x316832['name'],'name':_0x316832[_0x46b2('0x6c')],'custom':!_0x316832[_0x46b2('0x69')],'options':_0x316832[_0x46b2('0x6d')]?_[_0x46b2('0x2b')](_0x316832['choices'],function(_0x5a729c){return{'name':_['capitalize'](_0x5a729c),'value':_0x5a729c};}):[]};})};}})[_0x46b2('0x24')](respondWithResult(_0x10e060,null))[_0x46b2('0x46')](function(_0x548ff0){var _0x1fc450=_0x5cf1d0['query']['test']?0x1f4:_0x548ff0[_0x46b2('0x6e')]||0x1f4;logger[_0x46b2('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x46b2('0x55'),_0x1fc450,JSON[_0x46b2('0x6f')](_0x548ff0));delete _0x548ff0['name'];if(_0x1fc450===0x191){_0x1fc450=0x190;}_0x10e060[_0x46b2('0x17')](_0x1fc450)[_0x46b2('0x29')](_0x5cf1d0['query'][_0x46b2('0x70')]?{'message':_0x46b2('0x71'),'statusCode':_0x548ff0[_0x46b2('0x6e')]}:_0x548ff0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b062d04..2b7886c 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 _0x935e=['FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x25e40d,_0x53ce1f){var _0x3f7c6a=function(_0x418259){while(--_0x418259){_0x25e40d['push'](_0x25e40d['shift']());}};_0x3f7c6a(++_0x53ce1f);}(_0x935e,0xc2));var _0xe935=function(_0xbf1a49,_0x383c34){_0xbf1a49=_0xbf1a49-0x0;var _0x30edc9=_0x935e[_0xbf1a49];return _0x30edc9;};'use strict';var _=require('lodash');var util=require(_0xe935('0x0'));var logger=require(_0xe935('0x1'))('api');var moment=require(_0xe935('0x2'));var BPromise=require(_0xe935('0x3'));var rp=require(_0xe935('0x4'));var fs=require('fs');var path=require(_0xe935('0x5'));var rimraf=require('rimraf');var config=require(_0xe935('0x6'));var attributes=require(_0xe935('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe935('0x8')]=function(_0xe66c43,_0x1450d0){return _0xe66c43[_0xe935('0x9')](_0xe935('0xa'),attributes,{'tableName':_0xe935('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44f=['path','rimraf','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','../../config/logger','api','moment','bluebird'];(function(_0x32a74e,_0x10fb00){var _0x3f281f=function(_0x327c7e){while(--_0x327c7e){_0x32a74e['push'](_0x32a74e['shift']());}};_0x3f281f(++_0x10fb00);}(_0xb44f,0x1d5));var _0xfb44=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb44f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb44('0x0'))(_0xfb44('0x1'));var moment=require(_0xfb44('0x2'));var BPromise=require(_0xfb44('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb44('0x4'));var rimraf=require(_0xfb44('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xfb44('0x6'));module[_0xfb44('0x7')]=function(_0x577b84,_0x5e6a43){return _0x577b84[_0xfb44('0x8')](_0xfb44('0x9'),attributes,{'tableName':_0xfb44('0xa'),'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 96296b5..33efb3d 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 _0xf6e6=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','raw','lodash','util'];(function(_0x282caa,_0x18b665){var _0x989f60=function(_0xe29d81){while(--_0xe29d81){_0x282caa['push'](_0x282caa['shift']());}};_0x989f60(++_0x18b665);}(_0xf6e6,0x1ae));var _0x6f6e=function(_0x5ac1ae,_0x2bbf6d){_0x5ac1ae=_0x5ac1ae-0x0;var _0x2ca11f=_0xf6e6[_0x5ac1ae];return _0x2ca11f;};'use strict';var _=require(_0x6f6e('0x0'));var util=require(_0x6f6e('0x1'));var moment=require(_0x6f6e('0x2'));var BPromise=require(_0x6f6e('0x3'));var rs=require(_0x6f6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f6e('0x5'))['db'];var utils=require(_0x6f6e('0x6'));var logger=require(_0x6f6e('0x7'))(_0x6f6e('0x8'));var config=require(_0x6f6e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x420e15,_0x561055,_0x5dd3b3){return new BPromise(function(_0x149e41,_0x1373ee){return client[_0x6f6e('0xa')](_0x420e15,_0x5dd3b3)[_0x6f6e('0xb')](function(_0xa5f817){logger['info'](_0x6f6e('0xc'),_0x561055,_0x6f6e('0xd'));logger[_0x6f6e('0xe')](_0x6f6e('0xf'),_0x561055,_0x6f6e('0xd'),JSON[_0x6f6e('0x10')](_0xa5f817));if(_0xa5f817[_0x6f6e('0x11')]){if(_0xa5f817[_0x6f6e('0x11')][_0x6f6e('0x12')]===0x1f4){logger[_0x6f6e('0x11')](_0x6f6e('0xc'),_0x561055,_0xa5f817[_0x6f6e('0x11')][_0x6f6e('0x13')]);return _0x1373ee(_0xa5f817[_0x6f6e('0x11')][_0x6f6e('0x13')]);}logger[_0x6f6e('0x11')](_0x6f6e('0xc'),_0x561055,_0xa5f817[_0x6f6e('0x11')][_0x6f6e('0x13')]);return _0x149e41(_0xa5f817[_0x6f6e('0x11')][_0x6f6e('0x13')]);}else{logger[_0x6f6e('0x14')](_0x6f6e('0xc'),_0x561055,_0x6f6e('0xd'));_0x149e41(_0xa5f817[_0x6f6e('0x15')][_0x6f6e('0x13')]);}})[_0x6f6e('0x16')](function(_0xff48c9){logger[_0x6f6e('0x11')](_0x6f6e('0xc'),_0x561055,_0xff48c9);_0x1373ee(_0xff48c9);});});}exports[_0x6f6e('0x17')]=function(_0x4bef79){var _0x3f8e6c=this;return new Promise(function(_0x55b4ea,_0x3969e4){return db['FreshdeskAccount'][_0x6f6e('0x18')]({'raw':_0x4bef79[_0x6f6e('0x19')]?_0x4bef79[_0x6f6e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4bef79['options']?_0x4bef79[_0x6f6e('0x19')][_0x6f6e('0x1a')]||null:null,'attributes':_0x4bef79[_0x6f6e('0x19')]?_0x4bef79[_0x6f6e('0x19')][_0x6f6e('0x1b')]||null:null,'limit':_0x4bef79['options']?_0x4bef79['options'][_0x6f6e('0x1c')]||null:null,'include':_0x4bef79[_0x6f6e('0x19')]?_0x4bef79[_0x6f6e('0x19')][_0x6f6e('0x1d')]?_['map'](_0x4bef79[_0x6f6e('0x19')][_0x6f6e('0x1d')],function(_0x3cc725){return{'model':db[_0x3cc725['model']],'as':_0x3cc725['as'],'attributes':_0x3cc725[_0x6f6e('0x1b')],'include':_0x3cc725['include']?_[_0x6f6e('0x1e')](_0x3cc725[_0x6f6e('0x1d')],function(_0x2a83cb){return{'model':db[_0x2a83cb[_0x6f6e('0x1f')]],'as':_0x2a83cb['as'],'attributes':_0x2a83cb[_0x6f6e('0x1b')],'include':_0x2a83cb[_0x6f6e('0x1d')]?_[_0x6f6e('0x1e')](_0x2a83cb[_0x6f6e('0x1d')],function(_0x302343){return{'model':db[_0x302343[_0x6f6e('0x1f')]],'as':_0x302343['as'],'attributes':_0x302343[_0x6f6e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6f6e('0xb')](function(_0x34b4b6){logger[_0x6f6e('0x14')]('GetFreshdeskAccount',_0x4bef79);logger[_0x6f6e('0xe')](_0x6f6e('0x17'),_0x4bef79,JSON[_0x6f6e('0x10')](_0x34b4b6));_0x55b4ea(_0x34b4b6);})[_0x6f6e('0x16')](function(_0x4db5fd){logger['error'](_0x6f6e('0x17'),_0x4db5fd['message'],_0x4bef79);_0x3969e4(_0x3f8e6c[_0x6f6e('0x11')](0x1f4,_0x4db5fd[_0x6f6e('0x13')]));});});};exports[_0x6f6e('0x20')]=function(_0x2ac8b4){var _0x5a2e1f=this;return new Promise(function(_0x5d2b77,_0x5f27df){return db[_0x6f6e('0x21')][_0x6f6e('0x22')]({'raw':_0x2ac8b4[_0x6f6e('0x19')]?_0x2ac8b4[_0x6f6e('0x19')][_0x6f6e('0x23')]===undefined?!![]:![]:!![],'where':_0x2ac8b4[_0x6f6e('0x19')]?_0x2ac8b4[_0x6f6e('0x19')]['where']||null:null,'attributes':_0x2ac8b4['options']?_0x2ac8b4[_0x6f6e('0x19')][_0x6f6e('0x1b')]||null:null,'include':_0x2ac8b4['options']?_0x2ac8b4['options'][_0x6f6e('0x1d')]?_[_0x6f6e('0x1e')](_0x2ac8b4[_0x6f6e('0x19')][_0x6f6e('0x1d')],function(_0x5dfec5){return{'model':db[_0x5dfec5[_0x6f6e('0x1f')]],'as':_0x5dfec5['as'],'attributes':_0x5dfec5[_0x6f6e('0x1b')],'include':_0x5dfec5[_0x6f6e('0x1d')]?_['map'](_0x5dfec5['include'],function(_0xe44270){return{'model':db[_0xe44270[_0x6f6e('0x1f')]],'as':_0xe44270['as'],'attributes':_0xe44270['attributes'],'include':_0xe44270[_0x6f6e('0x1d')]?_[_0x6f6e('0x1e')](_0xe44270[_0x6f6e('0x1d')],function(_0x21cecf){return{'model':db[_0x21cecf['model']],'as':_0x21cecf['as'],'attributes':_0x21cecf[_0x6f6e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e7c12){logger[_0x6f6e('0x14')](_0x6f6e('0x20'),_0x2ac8b4);logger[_0x6f6e('0xe')](_0x6f6e('0x20'),_0x2ac8b4,JSON['stringify'](_0x5e7c12));_0x5d2b77(_0x5e7c12);})['catch'](function(_0x5c9c3d){logger[_0x6f6e('0x11')](_0x6f6e('0x20'),_0x5c9c3d['message'],_0x2ac8b4);_0x5f27df(_0x5a2e1f['error'](0x1f4,_0x5c9c3d[_0x6f6e('0x13')]));});});}; \ No newline at end of file +var _0x54bc=['message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','ShowFreshdeskAccount','find','map','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x444254,_0x270cf3){var _0x162704=function(_0x30b446){while(--_0x30b446){_0x444254['push'](_0x444254['shift']());}};_0x162704(++_0x270cf3);}(_0x54bc,0x13a));var _0xc54b=function(_0x273b89,_0x56eb56){_0x273b89=_0x273b89-0x0;var _0x1ce2ee=_0x54bc[_0x273b89];return _0x1ce2ee;};'use strict';var _=require(_0xc54b('0x0'));var util=require('util');var moment=require(_0xc54b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc54b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc54b('0x3'));var logger=require(_0xc54b('0x4'))('rpc');var config=require(_0xc54b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc54b('0x6')][_0xc54b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a19d4,_0x1feba8,_0x203f1e){return new BPromise(function(_0x575ed4,_0x14ab1a){return client['request'](_0x3a19d4,_0x203f1e)[_0xc54b('0x8')](function(_0x5b5193){logger['info'](_0xc54b('0x9'),_0x1feba8,_0xc54b('0xa'));logger[_0xc54b('0xb')](_0xc54b('0xc'),_0x1feba8,'request\x20sent',JSON[_0xc54b('0xd')](_0x5b5193));if(_0x5b5193[_0xc54b('0xe')]){if(_0x5b5193[_0xc54b('0xe')][_0xc54b('0xf')]===0x1f4){logger[_0xc54b('0xe')](_0xc54b('0x9'),_0x1feba8,_0x5b5193['error'][_0xc54b('0x10')]);return _0x14ab1a(_0x5b5193[_0xc54b('0xe')][_0xc54b('0x10')]);}logger[_0xc54b('0xe')](_0xc54b('0x9'),_0x1feba8,_0x5b5193[_0xc54b('0xe')][_0xc54b('0x10')]);return _0x575ed4(_0x5b5193[_0xc54b('0xe')][_0xc54b('0x10')]);}else{logger[_0xc54b('0x11')](_0xc54b('0x9'),_0x1feba8,'request\x20sent');_0x575ed4(_0x5b5193[_0xc54b('0x12')][_0xc54b('0x10')]);}})[_0xc54b('0x13')](function(_0x1c6013){logger[_0xc54b('0xe')](_0xc54b('0x9'),_0x1feba8,_0x1c6013);_0x14ab1a(_0x1c6013);});});}exports[_0xc54b('0x14')]=function(_0x2b57ed){var _0x44d70c=this;return new Promise(function(_0x1ff1b0,_0xc8bf60){return db[_0xc54b('0x15')][_0xc54b('0x16')]({'raw':_0x2b57ed[_0xc54b('0x17')]?_0x2b57ed['options'][_0xc54b('0x18')]===undefined?!![]:![]:!![],'where':_0x2b57ed[_0xc54b('0x17')]?_0x2b57ed[_0xc54b('0x17')][_0xc54b('0x19')]||null:null,'attributes':_0x2b57ed[_0xc54b('0x17')]?_0x2b57ed[_0xc54b('0x17')][_0xc54b('0x1a')]||null:null,'limit':_0x2b57ed[_0xc54b('0x17')]?_0x2b57ed[_0xc54b('0x17')][_0xc54b('0x1b')]||null:null,'include':_0x2b57ed[_0xc54b('0x17')]?_0x2b57ed[_0xc54b('0x17')][_0xc54b('0x1c')]?_['map'](_0x2b57ed[_0xc54b('0x17')]['include'],function(_0x2be489){return{'model':db[_0x2be489[_0xc54b('0x1d')]],'as':_0x2be489['as'],'attributes':_0x2be489['attributes'],'include':_0x2be489[_0xc54b('0x1c')]?_['map'](_0x2be489[_0xc54b('0x1c')],function(_0x237ac){return{'model':db[_0x237ac[_0xc54b('0x1d')]],'as':_0x237ac['as'],'attributes':_0x237ac[_0xc54b('0x1a')],'include':_0x237ac[_0xc54b('0x1c')]?_['map'](_0x237ac['include'],function(_0x1fc549){return{'model':db[_0x1fc549[_0xc54b('0x1d')]],'as':_0x1fc549['as'],'attributes':_0x1fc549[_0xc54b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d389d){logger[_0xc54b('0x11')](_0xc54b('0x14'),_0x2b57ed);logger['debug']('GetFreshdeskAccount',_0x2b57ed,JSON[_0xc54b('0xd')](_0x2d389d));_0x1ff1b0(_0x2d389d);})[_0xc54b('0x13')](function(_0x24f32b){logger[_0xc54b('0xe')](_0xc54b('0x14'),_0x24f32b['message'],_0x2b57ed);_0xc8bf60(_0x44d70c['error'](0x1f4,_0x24f32b[_0xc54b('0x10')]));});});};exports[_0xc54b('0x1e')]=function(_0x63f6d3){var _0x2910ac=this;return new Promise(function(_0x52bc17,_0x608d16){return db['FreshdeskAccount'][_0xc54b('0x1f')]({'raw':_0x63f6d3[_0xc54b('0x17')]?_0x63f6d3[_0xc54b('0x17')][_0xc54b('0x18')]===undefined?!![]:![]:!![],'where':_0x63f6d3['options']?_0x63f6d3[_0xc54b('0x17')]['where']||null:null,'attributes':_0x63f6d3[_0xc54b('0x17')]?_0x63f6d3[_0xc54b('0x17')][_0xc54b('0x1a')]||null:null,'include':_0x63f6d3[_0xc54b('0x17')]?_0x63f6d3['options'][_0xc54b('0x1c')]?_[_0xc54b('0x20')](_0x63f6d3[_0xc54b('0x17')][_0xc54b('0x1c')],function(_0xad9ef7){return{'model':db[_0xad9ef7[_0xc54b('0x1d')]],'as':_0xad9ef7['as'],'attributes':_0xad9ef7[_0xc54b('0x1a')],'include':_0xad9ef7['include']?_[_0xc54b('0x20')](_0xad9ef7[_0xc54b('0x1c')],function(_0x3d62b5){return{'model':db[_0x3d62b5[_0xc54b('0x1d')]],'as':_0x3d62b5['as'],'attributes':_0x3d62b5[_0xc54b('0x1a')],'include':_0x3d62b5['include']?_['map'](_0x3d62b5['include'],function(_0x9b1744){return{'model':db[_0x9b1744[_0xc54b('0x1d')]],'as':_0x9b1744['as'],'attributes':_0x9b1744[_0xc54b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6b8400){logger[_0xc54b('0x11')](_0xc54b('0x1e'),_0x63f6d3);logger['debug'](_0xc54b('0x1e'),_0x63f6d3,JSON[_0xc54b('0xd')](_0x6b8400));_0x52bc17(_0x6b8400);})[_0xc54b('0x13')](function(_0x2adc09){logger[_0xc54b('0xe')](_0xc54b('0x1e'),_0x2adc09[_0xc54b('0x10')],_0x63f6d3);_0x608d16(_0x2910ac[_0xc54b('0xe')](0x1f4,_0x2adc09['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 96961cd..2e6d3be 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 _0xed64=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','/:id/fields','getFields','getSubjects'];(function(_0x2a9aa2,_0x4d0dd8){var _0x5bb9ab=function(_0x39bc1e){while(--_0x39bc1e){_0x2a9aa2['push'](_0x2a9aa2['shift']());}};_0x5bb9ab(++_0x4d0dd8);}(_0xed64,0x73));var _0x4ed6=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0xed64[_0x1fc18b];return _0x16a351;};'use strict';var multer=require('multer');var util=require(_0x4ed6('0x0'));var path=require(_0x4ed6('0x1'));var timeout=require(_0x4ed6('0x2'));var express=require(_0x4ed6('0x3'));var router=express[_0x4ed6('0x4')]();var fs_extra=require(_0x4ed6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x4ed6('0x6')]('/',auth[_0x4ed6('0x7')](),controller['index']);router['get']('/:id',auth[_0x4ed6('0x7')](),controller['show']);router[_0x4ed6('0x6')](_0x4ed6('0x8'),auth['isAuthenticated'](),controller[_0x4ed6('0x9')]);router[_0x4ed6('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x4ed6('0xa')]);router[_0x4ed6('0x6')](_0x4ed6('0xb'),auth['isAuthenticated'](),controller[_0x4ed6('0xc')]);router['get'](_0x4ed6('0xd'),auth[_0x4ed6('0x7')](),controller[_0x4ed6('0xe')]);router[_0x4ed6('0xf')]('/',auth['isAuthenticated'](),controller[_0x4ed6('0x10')]);router[_0x4ed6('0xf')](_0x4ed6('0xd'),auth[_0x4ed6('0x7')](),controller[_0x4ed6('0x11')]);router[_0x4ed6('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4ed6('0x7')](),controller[_0x4ed6('0x13')]);module[_0x4ed6('0x14')]=router; \ No newline at end of file +var _0x4410=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x515eb1,_0x2bfb26){var _0x38df33=function(_0x29fecd){while(--_0x29fecd){_0x515eb1['push'](_0x515eb1['shift']());}};_0x38df33(++_0x2bfb26);}(_0x4410,0x127));var _0x0441=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x4410[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x0441('0x0'));var util=require(_0x0441('0x1'));var path=require('path');var timeout=require(_0x0441('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0441('0x3'));var auth=require(_0x0441('0x4'));var interaction=require(_0x0441('0x5'));var config=require(_0x0441('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x0441('0x7')]('/',auth[_0x0441('0x8')](),controller[_0x0441('0x9')]);router['get']('/:id',auth[_0x0441('0x8')](),controller[_0x0441('0xa')]);router[_0x0441('0x7')](_0x0441('0xb'),auth[_0x0441('0x8')](),controller[_0x0441('0xc')]);router[_0x0441('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x0441('0xd')]);router[_0x0441('0x7')](_0x0441('0xe'),auth['isAuthenticated'](),controller[_0x0441('0xf')]);router[_0x0441('0x7')](_0x0441('0x10'),auth['isAuthenticated'](),controller['getTags']);router[_0x0441('0x11')]('/',auth[_0x0441('0x8')](),controller[_0x0441('0x12')]);router[_0x0441('0x11')](_0x0441('0x10'),auth['isAuthenticated'](),controller['setTags']);router[_0x0441('0x13')]('/:id',auth[_0x0441('0x8')](),controller[_0x0441('0x14')]);router[_0x0441('0x15')](_0x0441('0x16'),auth[_0x0441('0x8')](),controller[_0x0441('0x17')]);module[_0x0441('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 20f8833..12f5172 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 _0x693a=['sequelize','STRING'];(function(_0x2fe414,_0x560733){var _0x54b3f3=function(_0x101022){while(--_0x101022){_0x2fe414['push'](_0x2fe414['shift']());}};_0x54b3f3(++_0x560733);}(_0x693a,0x13c));var _0xa693=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x693a[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0xa693('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa693('0x1')]}}; \ No newline at end of file +var _0x8d6a=['STRING','sequelize'];(function(_0x43870e,_0x3ce568){var _0x3a9a4e=function(_0x426113){while(--_0x426113){_0x43870e['push'](_0x43870e['shift']());}};_0x3a9a4e(++_0x3ce568);}(_0x8d6a,0x1cd));var _0xa8d6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d6a[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xa8d6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa8d6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e48007f..553c1df 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 _0xdb1e=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','getFields','FreshdeskField','getSubjects','findOne','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type'];(function(_0xa6c600,_0x17b0e6){var _0x52165e=function(_0x380970){while(--_0x380970){_0xa6c600['push'](_0xa6c600['shift']());}};_0x52165e(++_0x17b0e6);}(_0xdb1e,0x172));var _0xedb1=function(_0x3d20fe,_0x4d11ca){_0x3d20fe=_0x3d20fe-0x0;var _0x5c4a9a=_0xdb1e[_0x3d20fe];return _0x5c4a9a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xedb1('0x0'));var jsonpatch=require(_0xedb1('0x1'));var rp=require(_0xedb1('0x2'));var moment=require(_0xedb1('0x3'));var BPromise=require(_0xedb1('0x4'));var Mustache=require('mustache');var util=require(_0xedb1('0x5'));var path=require(_0xedb1('0x6'));var sox=require(_0xedb1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xedb1('0x8'));var crypto=require(_0xedb1('0x9'));var jsforce=require(_0xedb1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xedb1('0xb'));var querystring=require('querystring');var Papa=require(_0xedb1('0xc'));var Redis=require(_0xedb1('0xd'));var authService=require(_0xedb1('0xe'));var qs=require(_0xedb1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedb1('0x10'));var logger=require(_0xedb1('0x11'))('api');var utils=require(_0xedb1('0x12'));var config=require(_0xedb1('0x13'));var licenseUtil=require(_0xedb1('0x14'));var db=require(_0xedb1('0x15'))['db'];function respondWithStatusCode(_0x4025f9,_0x3e67b6){_0x3e67b6=_0x3e67b6||0xcc;return function(_0x227756){if(_0x227756){return _0x4025f9[_0xedb1('0x16')](_0x3e67b6);}return _0x4025f9[_0xedb1('0x17')](_0x3e67b6)[_0xedb1('0x18')]();};}function respondWithResult(_0x2296df,_0xe1a19d){_0xe1a19d=_0xe1a19d||0xc8;return function(_0x3d8f3b){if(_0x3d8f3b){return _0x2296df[_0xedb1('0x17')](_0xe1a19d)[_0xedb1('0x19')](_0x3d8f3b);}};}function respondWithFilteredResult(_0x13e413,_0x205a35){return function(_0x439141){if(_0x439141){var _0x5aa94d=typeof _0x205a35[_0xedb1('0x1a')]===_0xedb1('0x1b')&&typeof _0x205a35[_0xedb1('0x1c')]===_0xedb1('0x1b');var _0x53b30e=_0x439141['count'];var _0x382f87=_0x5aa94d?0x0:_0x205a35[_0xedb1('0x1a')];var _0x3a043b=_0x5aa94d?_0x439141['count']:_0x205a35[_0xedb1('0x1a')]+_0x205a35[_0xedb1('0x1c')];var _0xc82a9f;if(_0x3a043b>=_0x53b30e){_0x3a043b=_0x53b30e;_0xc82a9f=0xc8;}else{_0xc82a9f=0xce;}_0x13e413['status'](_0xc82a9f);return _0x13e413[_0xedb1('0x1d')](_0xedb1('0x1e'),_0x382f87+'-'+_0x3a043b+'/'+_0x53b30e)['json'](_0x439141);}return null;};}function patchUpdates(_0x3a1f39){return function(_0x53b3c0){try{jsonpatch[_0xedb1('0x1f')](_0x53b3c0,_0x3a1f39,!![]);}catch(_0x371525){return BPromise[_0xedb1('0x20')](_0x371525);}return _0x53b3c0[_0xedb1('0x21')]();};}function saveUpdates(_0x17ac2d,_0x2d8457){return function(_0x2415de){if(_0x2415de){return _0x2415de[_0xedb1('0x22')](_0x17ac2d)[_0xedb1('0x23')](function(_0x52f221){return _0x52f221;});}return null;};}function removeEntity(_0x27d7e5,_0xfa6106){return function(_0x12e40e){if(_0x12e40e){return _0x12e40e[_0xedb1('0x24')]()[_0xedb1('0x23')](function(){_0x27d7e5[_0xedb1('0x17')](0xcc)[_0xedb1('0x18')]();});}};}function handleEntityNotFound(_0x34763d,_0x41c805){return function(_0x262e78){if(!_0x262e78){_0x34763d[_0xedb1('0x16')](0x194);}return _0x262e78;};}function handleError(_0x22893d,_0x15c1b2){_0x15c1b2=_0x15c1b2||0x1f4;return function(_0x1d7626){logger['error'](_0x1d7626['stack']);if(_0x1d7626[_0xedb1('0x25')]){delete _0x1d7626['name'];}_0x22893d[_0xedb1('0x17')](_0x15c1b2)[_0xedb1('0x26')](_0x1d7626);};}exports[_0xedb1('0x27')]=function(_0x4dbd24,_0xa5ef6c){var _0x50b788={},_0x289fc7={},_0x19fb62={'count':0x0,'rows':[]};var _0x2a5923=_[_0xedb1('0x28')](db[_0xedb1('0x29')][_0xedb1('0x2a')],function(_0x5b0c6f){return{'name':_0x5b0c6f[_0xedb1('0x2b')],'type':_0x5b0c6f[_0xedb1('0x2c')][_0xedb1('0x2d')]};});_0x289fc7[_0xedb1('0x2e')]=_[_0xedb1('0x28')](_0x2a5923,_0xedb1('0x25'));_0x289fc7[_0xedb1('0x2f')]=_[_0xedb1('0x30')](_0x4dbd24[_0xedb1('0x2f')]);_0x289fc7[_0xedb1('0x31')]=_[_0xedb1('0x32')](_0x289fc7[_0xedb1('0x2e')],_0x289fc7[_0xedb1('0x2f')]);_0x50b788[_0xedb1('0x33')]=_[_0xedb1('0x32')](_0x289fc7[_0xedb1('0x2e')],qs[_0xedb1('0x34')](_0x4dbd24[_0xedb1('0x2f')][_0xedb1('0x34')]));_0x50b788[_0xedb1('0x33')]=_0x50b788[_0xedb1('0x33')][_0xedb1('0x35')]?_0x50b788['attributes']:_0x289fc7[_0xedb1('0x2e')];if(!_0x4dbd24[_0xedb1('0x2f')][_0xedb1('0x36')](_0xedb1('0x37'))){_0x50b788[_0xedb1('0x1c')]=qs[_0xedb1('0x1c')](_0x4dbd24[_0xedb1('0x2f')][_0xedb1('0x1c')]);_0x50b788['offset']=qs[_0xedb1('0x1a')](_0x4dbd24[_0xedb1('0x2f')][_0xedb1('0x1a')]);}_0x50b788[_0xedb1('0x38')]=qs[_0xedb1('0x39')](_0x4dbd24[_0xedb1('0x2f')][_0xedb1('0x39')]);_0x50b788[_0xedb1('0x3a')]=qs['filters'](_[_0xedb1('0x3b')](_0x4dbd24[_0xedb1('0x2f')],_0x289fc7['filters']),_0x2a5923);if(_0x4dbd24[_0xedb1('0x2f')]['filter']){_0x50b788[_0xedb1('0x3a')]=_[_0xedb1('0x3c')](_0x50b788[_0xedb1('0x3a')],{'$or':_[_0xedb1('0x28')](_0x2a5923,function(_0x21b8d5){if(_0x21b8d5[_0xedb1('0x2c')]!==_0xedb1('0x3d')){var _0x19bcdc={};_0x19bcdc[_0x21b8d5[_0xedb1('0x25')]]={'$like':'%'+_0x4dbd24[_0xedb1('0x2f')][_0xedb1('0x3e')]+'%'};return _0x19bcdc;}})});}_0x50b788=_[_0xedb1('0x3c')]({},_0x50b788,_0x4dbd24[_0xedb1('0x3f')]);var _0x2290f9={'where':_0x50b788[_0xedb1('0x3a')]};return db[_0xedb1('0x29')]['count'](_0x2290f9)[_0xedb1('0x23')](function(_0x4cb6a1){_0x19fb62[_0xedb1('0x40')]=_0x4cb6a1;if(_0x4dbd24[_0xedb1('0x2f')][_0xedb1('0x41')]){_0x50b788['include']=[{'all':!![]}];}return db[_0xedb1('0x29')][_0xedb1('0x42')](_0x50b788);})['then'](function(_0x2084ba){_0x19fb62[_0xedb1('0x43')]=_0x2084ba;return _0x19fb62;})[_0xedb1('0x23')](respondWithFilteredResult(_0xa5ef6c,_0x50b788))[_0xedb1('0x44')](handleError(_0xa5ef6c,null));};exports[_0xedb1('0x45')]=function(_0x41f00e,_0x1d385c){var _0x2200da={'raw':![],'where':{'id':_0x41f00e[_0xedb1('0x46')]['id']}},_0x54e97b={};_0x54e97b['model']=_[_0xedb1('0x30')](db[_0xedb1('0x29')][_0xedb1('0x2a')]);_0x54e97b[_0xedb1('0x2f')]=_[_0xedb1('0x30')](_0x41f00e[_0xedb1('0x2f')]);_0x54e97b[_0xedb1('0x31')]=_[_0xedb1('0x32')](_0x54e97b[_0xedb1('0x2e')],_0x54e97b['query']);_0x2200da[_0xedb1('0x33')]=_[_0xedb1('0x32')](_0x54e97b[_0xedb1('0x2e')],qs[_0xedb1('0x34')](_0x41f00e['query'][_0xedb1('0x34')]));_0x2200da[_0xedb1('0x33')]=_0x2200da[_0xedb1('0x33')]['length']?_0x2200da[_0xedb1('0x33')]:_0x54e97b[_0xedb1('0x2e')];if(_0x41f00e[_0xedb1('0x2f')]['includeAll']){_0x2200da[_0xedb1('0x47')]=[{'all':!![]}];}_0x2200da=_[_0xedb1('0x3c')]({},_0x2200da,_0x41f00e[_0xedb1('0x3f')]);return db[_0xedb1('0x29')]['find'](_0x2200da)[_0xedb1('0x23')](handleEntityNotFound(_0x1d385c,null))[_0xedb1('0x23')](respondWithResult(_0x1d385c,null))[_0xedb1('0x44')](handleError(_0x1d385c,null));};exports['create']=function(_0x4bb1b6,_0x2c489a){return db[_0xedb1('0x29')][_0xedb1('0x48')](_0x4bb1b6[_0xedb1('0x49')],{})[_0xedb1('0x23')](respondWithResult(_0x2c489a,0xc9))[_0xedb1('0x44')](handleError(_0x2c489a,null));};exports['update']=function(_0x2f75a7,_0x1a6145){if(_0x2f75a7['body']['id']){delete _0x2f75a7[_0xedb1('0x49')]['id'];}return db['FreshdeskConfiguration'][_0xedb1('0x4a')]({'where':{'id':_0x2f75a7[_0xedb1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a6145,null))[_0xedb1('0x23')](saveUpdates(_0x2f75a7['body'],null))[_0xedb1('0x23')](respondWithResult(_0x1a6145,null))[_0xedb1('0x44')](handleError(_0x1a6145,null));};exports['destroy']=function(_0x55007f,_0x1846c1){return db[_0xedb1('0x29')]['find']({'where':{'id':_0x55007f[_0xedb1('0x46')]['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x1846c1,null))['then'](removeEntity(_0x1846c1,null))[_0xedb1('0x44')](handleError(_0x1846c1,null));};exports[_0xedb1('0x4b')]=function(_0x27dfc1,_0x172aeb,_0x2fbc27){var _0xe1654d={};var _0x3ce02a={};var _0x24bc31;var _0xb1645a;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x27dfc1[_0xedb1('0x46')]['id']}})['then'](handleEntityNotFound(_0x172aeb,null))[_0xedb1('0x23')](function(_0x551770){if(_0x551770){_0x24bc31=_0x551770;_0x3ce02a[_0xedb1('0x2e')]=_[_0xedb1('0x30')](db[_0xedb1('0x4c')][_0xedb1('0x2a')]);_0x3ce02a[_0xedb1('0x2f')]=_[_0xedb1('0x30')](_0x27dfc1[_0xedb1('0x2f')]);_0x3ce02a[_0xedb1('0x31')]=_['intersection'](_0x3ce02a[_0xedb1('0x2e')],_0x3ce02a[_0xedb1('0x2f')]);_0xe1654d[_0xedb1('0x33')]=_[_0xedb1('0x32')](_0x3ce02a[_0xedb1('0x2e')],qs[_0xedb1('0x34')](_0x27dfc1[_0xedb1('0x2f')][_0xedb1('0x34')]));_0xe1654d[_0xedb1('0x33')]=_0xe1654d['attributes'][_0xedb1('0x35')]?_0xe1654d[_0xedb1('0x33')]:_0x3ce02a['model'];_0xe1654d[_0xedb1('0x38')]=qs[_0xedb1('0x39')](_0x27dfc1[_0xedb1('0x2f')][_0xedb1('0x39')]);_0xe1654d[_0xedb1('0x3a')]=qs['filters'](_[_0xedb1('0x3b')](_0x27dfc1['query'],_0x3ce02a['filters']));if(_0x27dfc1[_0xedb1('0x2f')]['filter']){_0xe1654d[_0xedb1('0x3a')]=_[_0xedb1('0x3c')](_0xe1654d['where'],{'$or':_[_0xedb1('0x28')](_0xe1654d['attributes'],function(_0x132d35){var _0x306f79={};_0x306f79[_0x132d35]={'$like':'%'+_0x27dfc1['query']['filter']+'%'};return _0x306f79;})});}_0xe1654d=_[_0xedb1('0x3c')]({},_0xe1654d,_0x27dfc1[_0xedb1('0x3f')]);return _0x24bc31[_0xedb1('0x4b')](_0xe1654d);}})['then'](function(_0x8b4c7f){if(_0x8b4c7f){_0xb1645a=_0x8b4c7f[_0xedb1('0x35')];if(!_0x27dfc1['query'][_0xedb1('0x36')](_0xedb1('0x37'))){_0xe1654d[_0xedb1('0x1c')]=qs[_0xedb1('0x1c')](_0x27dfc1['query']['limit']);_0xe1654d[_0xedb1('0x1a')]=qs[_0xedb1('0x1a')](_0x27dfc1[_0xedb1('0x2f')][_0xedb1('0x1a')]);}return _0x24bc31[_0xedb1('0x4b')](_0xe1654d);}})[_0xedb1('0x23')](function(_0x4b35fa){if(_0x4b35fa){return _0x4b35fa?{'count':_0xb1645a,'rows':_0x4b35fa}:null;}})['then'](respondWithResult(_0x172aeb,null))[_0xedb1('0x44')](handleError(_0x172aeb,null));};exports[_0xedb1('0x4d')]=function(_0x8f7003,_0x1d04a2,_0x72389d){var _0x592803={};var _0x2a8003={};var _0x3b4787;var _0x12c996;return db[_0xedb1('0x29')][_0xedb1('0x4e')]({'where':{'id':_0x8f7003[_0xedb1('0x46')]['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x1d04a2,null))[_0xedb1('0x23')](function(_0x127af0){if(_0x127af0){_0x3b4787=_0x127af0;_0x2a8003[_0xedb1('0x2e')]=_[_0xedb1('0x30')](db['FreshdeskField'][_0xedb1('0x2a')]);_0x2a8003[_0xedb1('0x2f')]=_[_0xedb1('0x30')](_0x8f7003[_0xedb1('0x2f')]);_0x2a8003[_0xedb1('0x31')]=_[_0xedb1('0x32')](_0x2a8003['model'],_0x2a8003[_0xedb1('0x2f')]);_0x592803[_0xedb1('0x33')]=_[_0xedb1('0x32')](_0x2a8003[_0xedb1('0x2e')],qs['fields'](_0x8f7003['query'][_0xedb1('0x34')]));_0x592803['attributes']=_0x592803[_0xedb1('0x33')]['length']?_0x592803[_0xedb1('0x33')]:_0x2a8003[_0xedb1('0x2e')];_0x592803[_0xedb1('0x38')]=qs['sort'](_0x8f7003[_0xedb1('0x2f')][_0xedb1('0x39')]);_0x592803[_0xedb1('0x3a')]=qs['filters'](_[_0xedb1('0x3b')](_0x8f7003[_0xedb1('0x2f')],_0x2a8003['filters']));if(_0x8f7003[_0xedb1('0x2f')][_0xedb1('0x3e')]){_0x592803[_0xedb1('0x3a')]=_[_0xedb1('0x3c')](_0x592803['where'],{'$or':_['map'](_0x592803[_0xedb1('0x33')],function(_0x50d680){var _0x1e437f={};_0x1e437f[_0x50d680]={'$like':'%'+_0x8f7003[_0xedb1('0x2f')][_0xedb1('0x3e')]+'%'};return _0x1e437f;})});}_0x592803=_[_0xedb1('0x3c')]({},_0x592803,_0x8f7003[_0xedb1('0x3f')]);return _0x3b4787[_0xedb1('0x4d')](_0x592803);}})['then'](function(_0x57456f){if(_0x57456f){_0x12c996=_0x57456f['length'];if(!_0x8f7003[_0xedb1('0x2f')]['hasOwnProperty'](_0xedb1('0x37'))){_0x592803['limit']=qs[_0xedb1('0x1c')](_0x8f7003[_0xedb1('0x2f')][_0xedb1('0x1c')]);_0x592803[_0xedb1('0x1a')]=qs['offset'](_0x8f7003[_0xedb1('0x2f')][_0xedb1('0x1a')]);}return _0x3b4787['getSubjects'](_0x592803);}})[_0xedb1('0x23')](function(_0x217df6){if(_0x217df6){return _0x217df6?{'count':_0x12c996,'rows':_0x217df6}:null;}})[_0xedb1('0x23')](respondWithResult(_0x1d04a2,null))[_0xedb1('0x44')](handleError(_0x1d04a2,null));};exports['getDescriptions']=function(_0x181a24,_0x598da6,_0x554e2f){var _0x432308={};var _0x2d4d30={};var _0x5729eb;var _0x1ef693;return db[_0xedb1('0x29')][_0xedb1('0x4e')]({'where':{'id':_0x181a24[_0xedb1('0x46')]['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x598da6,null))[_0xedb1('0x23')](function(_0x201bfc){if(_0x201bfc){_0x5729eb=_0x201bfc;_0x2d4d30['model']=_['keys'](db[_0xedb1('0x4c')][_0xedb1('0x2a')]);_0x2d4d30[_0xedb1('0x2f')]=_[_0xedb1('0x30')](_0x181a24['query']);_0x2d4d30['filters']=_[_0xedb1('0x32')](_0x2d4d30['model'],_0x2d4d30[_0xedb1('0x2f')]);_0x432308[_0xedb1('0x33')]=_[_0xedb1('0x32')](_0x2d4d30[_0xedb1('0x2e')],qs[_0xedb1('0x34')](_0x181a24['query'][_0xedb1('0x34')]));_0x432308[_0xedb1('0x33')]=_0x432308[_0xedb1('0x33')][_0xedb1('0x35')]?_0x432308['attributes']:_0x2d4d30[_0xedb1('0x2e')];_0x432308[_0xedb1('0x38')]=qs['sort'](_0x181a24['query']['sort']);_0x432308[_0xedb1('0x3a')]=qs['filters'](_[_0xedb1('0x3b')](_0x181a24[_0xedb1('0x2f')],_0x2d4d30[_0xedb1('0x31')]));if(_0x181a24[_0xedb1('0x2f')][_0xedb1('0x3e')]){_0x432308[_0xedb1('0x3a')]=_[_0xedb1('0x3c')](_0x432308[_0xedb1('0x3a')],{'$or':_['map'](_0x432308[_0xedb1('0x33')],function(_0x57e0ff){var _0x5ad873={};_0x5ad873[_0x57e0ff]={'$like':'%'+_0x181a24[_0xedb1('0x2f')][_0xedb1('0x3e')]+'%'};return _0x5ad873;})});}_0x432308=_[_0xedb1('0x3c')]({},_0x432308,_0x181a24[_0xedb1('0x3f')]);return _0x5729eb[_0xedb1('0x4f')](_0x432308);}})[_0xedb1('0x23')](function(_0x5ac861){if(_0x5ac861){_0x1ef693=_0x5ac861['length'];if(!_0x181a24[_0xedb1('0x2f')][_0xedb1('0x36')](_0xedb1('0x37'))){_0x432308[_0xedb1('0x1c')]=qs['limit'](_0x181a24[_0xedb1('0x2f')][_0xedb1('0x1c')]);_0x432308[_0xedb1('0x1a')]=qs[_0xedb1('0x1a')](_0x181a24[_0xedb1('0x2f')][_0xedb1('0x1a')]);}return _0x5729eb[_0xedb1('0x4f')](_0x432308);}})[_0xedb1('0x23')](function(_0x917bde){if(_0x917bde){return _0x917bde?{'count':_0x1ef693,'rows':_0x917bde}:null;}})[_0xedb1('0x23')](respondWithResult(_0x598da6,null))[_0xedb1('0x44')](handleError(_0x598da6,null));};exports[_0xedb1('0x50')]=function(_0x563c0c,_0x29339c,_0x23cc2e){var _0x415c44={};var _0x45e898={};var _0x2c5ffb;var _0x3b5b94;return db[_0xedb1('0x29')][_0xedb1('0x4e')]({'where':{'id':_0x563c0c[_0xedb1('0x46')]['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x29339c,null))[_0xedb1('0x23')](function(_0x53971c){if(_0x53971c){_0x2c5ffb=_0x53971c;_0x45e898[_0xedb1('0x2e')]=_[_0xedb1('0x30')](db['Tag'][_0xedb1('0x2a')]);_0x45e898[_0xedb1('0x2f')]=_[_0xedb1('0x30')](_0x563c0c['query']);_0x45e898[_0xedb1('0x31')]=_[_0xedb1('0x32')](_0x45e898[_0xedb1('0x2e')],_0x45e898[_0xedb1('0x2f')]);_0x415c44[_0xedb1('0x33')]=_['intersection'](_0x45e898[_0xedb1('0x2e')],qs[_0xedb1('0x34')](_0x563c0c[_0xedb1('0x2f')]['fields']));_0x415c44[_0xedb1('0x33')]=_0x415c44[_0xedb1('0x33')][_0xedb1('0x35')]?_0x415c44[_0xedb1('0x33')]:_0x45e898[_0xedb1('0x2e')];_0x415c44[_0xedb1('0x38')]=qs[_0xedb1('0x39')](_0x563c0c['query']['sort']);_0x415c44['where']=qs[_0xedb1('0x31')](_[_0xedb1('0x3b')](_0x563c0c['query'],_0x45e898[_0xedb1('0x31')]));if(_0x563c0c[_0xedb1('0x2f')]['filter']){_0x415c44[_0xedb1('0x3a')]=_['merge'](_0x415c44['where'],{'$or':_['map'](_0x415c44[_0xedb1('0x33')],function(_0x435c6d){var _0x2bfca0={};_0x2bfca0[_0x435c6d]={'$like':'%'+_0x563c0c[_0xedb1('0x2f')]['filter']+'%'};return _0x2bfca0;})});}_0x415c44=_['merge']({},_0x415c44,_0x563c0c[_0xedb1('0x3f')]);return _0x2c5ffb[_0xedb1('0x50')](_0x415c44);}})[_0xedb1('0x23')](function(_0x580689){if(_0x580689){_0x3b5b94=_0x580689['length'];if(!_0x563c0c[_0xedb1('0x2f')][_0xedb1('0x36')]('nolimit')){_0x415c44[_0xedb1('0x1c')]=qs[_0xedb1('0x1c')](_0x563c0c[_0xedb1('0x2f')]['limit']);_0x415c44[_0xedb1('0x1a')]=qs['offset'](_0x563c0c[_0xedb1('0x2f')][_0xedb1('0x1a')]);}return _0x2c5ffb[_0xedb1('0x50')](_0x415c44);}})[_0xedb1('0x23')](function(_0x434641){if(_0x434641){return _0x434641?{'count':_0x3b5b94,'rows':_0x434641}:null;}})['then'](respondWithResult(_0x29339c,null))['catch'](handleError(_0x29339c,null));};exports[_0xedb1('0x51')]=function(_0x3c1b6e,_0x3e8dd6,_0x8b9695){if(_0x3c1b6e[_0xedb1('0x49')]['id']){delete _0x3c1b6e[_0xedb1('0x49')]['id'];}return db[_0xedb1('0x29')][_0xedb1('0x4e')]({'where':{'id':_0x3c1b6e['params']['id']}})['then'](handleEntityNotFound(_0x3e8dd6,null))['then'](function(_0x4c335e){if(_0x4c335e){return _0x4c335e['setTags'](_0x3c1b6e[_0xedb1('0x49')][_0xedb1('0x52')]||[]);}return null;})['then'](respondWithResult(_0x3e8dd6,null))['catch'](handleError(_0x3e8dd6,null));}; \ No newline at end of file +var _0x4eff=['getDescriptions','hasOwnProperty','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','reject','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FreshdeskConfiguration','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','findOne','FreshdeskField','length','getFields','getSubjects'];(function(_0x289394,_0x4637c3){var _0x3ef411=function(_0x44a61c){while(--_0x44a61c){_0x289394['push'](_0x289394['shift']());}};_0x3ef411(++_0x4637c3);}(_0x4eff,0x13a));var _0xf4ef=function(_0x10ddbf,_0x5f1a22){_0x10ddbf=_0x10ddbf-0x0;var _0x386f96=_0x4eff[_0x10ddbf];return _0x386f96;};'use strict';var emlformat=require(_0xf4ef('0x0'));var rimraf=require(_0xf4ef('0x1'));var zipdir=require(_0xf4ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ef('0x3'));var moment=require('moment');var BPromise=require(_0xf4ef('0x4'));var Mustache=require(_0xf4ef('0x5'));var util=require(_0xf4ef('0x6'));var path=require(_0xf4ef('0x7'));var sox=require('sox');var csv=require(_0xf4ef('0x8'));var ejs=require(_0xf4ef('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4ef('0xa'));var squel=require('squel');var crypto=require(_0xf4ef('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4ef('0xc'));var Redis=require(_0xf4ef('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf4ef('0xe'));var as=require(_0xf4ef('0xf'));var hardwareService=require(_0xf4ef('0x10'));var logger=require(_0xf4ef('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf4ef('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4ef('0x13'))['db'];function respondWithStatusCode(_0x399984,_0x2cd55b){_0x2cd55b=_0x2cd55b||0xcc;return function(_0x4ff45c){if(_0x4ff45c){return _0x399984['sendStatus'](_0x2cd55b);}return _0x399984[_0xf4ef('0x14')](_0x2cd55b)[_0xf4ef('0x15')]();};}function respondWithResult(_0x2c8022,_0x47f79c){_0x47f79c=_0x47f79c||0xc8;return function(_0x1fa389){if(_0x1fa389){return _0x2c8022['status'](_0x47f79c)['json'](_0x1fa389);}};}function respondWithFilteredResult(_0xbf8c28,_0xbcae83){return function(_0xa01e55){if(_0xa01e55){var _0x2456e0=typeof _0xbcae83[_0xf4ef('0x16')]===_0xf4ef('0x17')&&typeof _0xbcae83[_0xf4ef('0x18')]===_0xf4ef('0x17');var _0x356b28=_0xa01e55[_0xf4ef('0x19')];var _0x52c0f0=_0x2456e0?0x0:_0xbcae83[_0xf4ef('0x16')];var _0x2e3543=_0x2456e0?_0xa01e55['count']:_0xbcae83['offset']+_0xbcae83[_0xf4ef('0x18')];var _0x46e865;if(_0x2e3543>=_0x356b28){_0x2e3543=_0x356b28;_0x46e865=0xc8;}else{_0x46e865=0xce;}_0xbf8c28[_0xf4ef('0x14')](_0x46e865);return _0xbf8c28['set']('Content-Range',_0x52c0f0+'-'+_0x2e3543+'/'+_0x356b28)['json'](_0xa01e55);}return null;};}function patchUpdates(_0x11514e){return function(_0x1d4ddc){try{jsonpatch['apply'](_0x1d4ddc,_0x11514e,!![]);}catch(_0x2c6dcb){return BPromise[_0xf4ef('0x1a')](_0x2c6dcb);}return _0x1d4ddc[_0xf4ef('0x1b')]();};}function saveUpdates(_0x212bb2,_0x4227e1){return function(_0x1ecae6){if(_0x1ecae6){return _0x1ecae6[_0xf4ef('0x1c')](_0x212bb2)[_0xf4ef('0x1d')](function(_0x525592){return _0x525592;});}return null;};}function removeEntity(_0x4401ce,_0x4a0258){return function(_0x1ae3a9){if(_0x1ae3a9){return _0x1ae3a9[_0xf4ef('0x1e')]()['then'](function(){_0x4401ce[_0xf4ef('0x14')](0xcc)[_0xf4ef('0x15')]();});}};}function handleEntityNotFound(_0x399305,_0x58b2cb){return function(_0x2fc428){if(!_0x2fc428){_0x399305[_0xf4ef('0x1f')](0x194);}return _0x2fc428;};}function handleError(_0x112e78,_0x17a98a){_0x17a98a=_0x17a98a||0x1f4;return function(_0x7a5e45){logger[_0xf4ef('0x20')](_0x7a5e45[_0xf4ef('0x21')]);if(_0x7a5e45[_0xf4ef('0x22')]){delete _0x7a5e45[_0xf4ef('0x22')];}_0x112e78['status'](_0x17a98a)['send'](_0x7a5e45);};}exports['index']=function(_0x373fe5,_0x5a8897){var _0x5d93e7={},_0x1e13c8={},_0x49210d={'count':0x0,'rows':[]};var _0x6855f2=_[_0xf4ef('0x23')](db['FreshdeskConfiguration'][_0xf4ef('0x24')],function(_0x1de0a0){return{'name':_0x1de0a0['fieldName'],'type':_0x1de0a0[_0xf4ef('0x25')][_0xf4ef('0x26')]};});_0x1e13c8[_0xf4ef('0x27')]=_['map'](_0x6855f2,'name');_0x1e13c8[_0xf4ef('0x28')]=_['keys'](_0x373fe5[_0xf4ef('0x28')]);_0x1e13c8[_0xf4ef('0x29')]=_['intersection'](_0x1e13c8[_0xf4ef('0x27')],_0x1e13c8[_0xf4ef('0x28')]);_0x5d93e7[_0xf4ef('0x2a')]=_[_0xf4ef('0x2b')](_0x1e13c8[_0xf4ef('0x27')],qs[_0xf4ef('0x2c')](_0x373fe5[_0xf4ef('0x28')][_0xf4ef('0x2c')]));_0x5d93e7['attributes']=_0x5d93e7[_0xf4ef('0x2a')]['length']?_0x5d93e7[_0xf4ef('0x2a')]:_0x1e13c8['model'];if(!_0x373fe5[_0xf4ef('0x28')]['hasOwnProperty'](_0xf4ef('0x2d'))){_0x5d93e7['limit']=qs[_0xf4ef('0x18')](_0x373fe5[_0xf4ef('0x28')][_0xf4ef('0x18')]);_0x5d93e7[_0xf4ef('0x16')]=qs[_0xf4ef('0x16')](_0x373fe5[_0xf4ef('0x28')][_0xf4ef('0x16')]);}_0x5d93e7[_0xf4ef('0x2e')]=qs[_0xf4ef('0x2f')](_0x373fe5[_0xf4ef('0x28')]['sort']);_0x5d93e7[_0xf4ef('0x30')]=qs[_0xf4ef('0x29')](_[_0xf4ef('0x31')](_0x373fe5[_0xf4ef('0x28')],_0x1e13c8[_0xf4ef('0x29')]),_0x6855f2);if(_0x373fe5['query'][_0xf4ef('0x32')]){_0x5d93e7[_0xf4ef('0x30')]=_['merge'](_0x5d93e7[_0xf4ef('0x30')],{'$or':_[_0xf4ef('0x23')](_0x6855f2,function(_0x275a22){if(_0x275a22[_0xf4ef('0x25')]!==_0xf4ef('0x33')){var _0xb003a={};_0xb003a[_0x275a22[_0xf4ef('0x22')]]={'$like':'%'+_0x373fe5[_0xf4ef('0x28')]['filter']+'%'};return _0xb003a;}})});}_0x5d93e7=_[_0xf4ef('0x34')]({},_0x5d93e7,_0x373fe5[_0xf4ef('0x35')]);var _0x355b62={'where':_0x5d93e7['where']};return db[_0xf4ef('0x36')][_0xf4ef('0x19')](_0x355b62)[_0xf4ef('0x1d')](function(_0x494ccd){_0x49210d[_0xf4ef('0x19')]=_0x494ccd;if(_0x373fe5['query']['includeAll']){_0x5d93e7[_0xf4ef('0x37')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xf4ef('0x38')](_0x5d93e7);})[_0xf4ef('0x1d')](function(_0x2b2075){_0x49210d[_0xf4ef('0x39')]=_0x2b2075;return _0x49210d;})[_0xf4ef('0x1d')](respondWithFilteredResult(_0x5a8897,_0x5d93e7))['catch'](handleError(_0x5a8897,null));};exports[_0xf4ef('0x3a')]=function(_0x5ce5f2,_0x456ab9){var _0x328b1b={'raw':![],'where':{'id':_0x5ce5f2[_0xf4ef('0x3b')]['id']}},_0x229e64={};_0x229e64[_0xf4ef('0x27')]=_[_0xf4ef('0x3c')](db[_0xf4ef('0x36')]['rawAttributes']);_0x229e64['query']=_[_0xf4ef('0x3c')](_0x5ce5f2[_0xf4ef('0x28')]);_0x229e64['filters']=_['intersection'](_0x229e64[_0xf4ef('0x27')],_0x229e64[_0xf4ef('0x28')]);_0x328b1b[_0xf4ef('0x2a')]=_[_0xf4ef('0x2b')](_0x229e64[_0xf4ef('0x27')],qs['fields'](_0x5ce5f2[_0xf4ef('0x28')][_0xf4ef('0x2c')]));_0x328b1b[_0xf4ef('0x2a')]=_0x328b1b[_0xf4ef('0x2a')]['length']?_0x328b1b[_0xf4ef('0x2a')]:_0x229e64['model'];if(_0x5ce5f2[_0xf4ef('0x28')][_0xf4ef('0x3d')]){_0x328b1b[_0xf4ef('0x37')]=[{'all':!![]}];}_0x328b1b=_[_0xf4ef('0x34')]({},_0x328b1b,_0x5ce5f2[_0xf4ef('0x35')]);return db[_0xf4ef('0x36')][_0xf4ef('0x3e')](_0x328b1b)[_0xf4ef('0x1d')](handleEntityNotFound(_0x456ab9,null))[_0xf4ef('0x1d')](respondWithResult(_0x456ab9,null))[_0xf4ef('0x3f')](handleError(_0x456ab9,null));};exports[_0xf4ef('0x40')]=function(_0x5d7fd0,_0x2f9009){return db['FreshdeskConfiguration'][_0xf4ef('0x40')](_0x5d7fd0[_0xf4ef('0x41')],{})[_0xf4ef('0x1d')](respondWithResult(_0x2f9009,0xc9))[_0xf4ef('0x3f')](handleError(_0x2f9009,null));};exports[_0xf4ef('0x1c')]=function(_0x529b55,_0x4bc261){if(_0x529b55[_0xf4ef('0x41')]['id']){delete _0x529b55[_0xf4ef('0x41')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x529b55['params']['id']}})['then'](handleEntityNotFound(_0x4bc261,null))[_0xf4ef('0x1d')](saveUpdates(_0x529b55[_0xf4ef('0x41')],null))[_0xf4ef('0x1d')](respondWithResult(_0x4bc261,null))[_0xf4ef('0x3f')](handleError(_0x4bc261,null));};exports[_0xf4ef('0x1e')]=function(_0x3e134d,_0x276239){return db[_0xf4ef('0x36')][_0xf4ef('0x3e')]({'where':{'id':_0x3e134d['params']['id']}})[_0xf4ef('0x1d')](handleEntityNotFound(_0x276239,null))[_0xf4ef('0x1d')](removeEntity(_0x276239,null))[_0xf4ef('0x3f')](handleError(_0x276239,null));};exports['getFields']=function(_0x38a452,_0x4fb469,_0x44ef4f){var _0x42e9e9={};var _0x45124a={};var _0x131fc4;var _0x1430ef;return db[_0xf4ef('0x36')][_0xf4ef('0x42')]({'where':{'id':_0x38a452['params']['id']}})['then'](handleEntityNotFound(_0x4fb469,null))[_0xf4ef('0x1d')](function(_0x186ded){if(_0x186ded){_0x131fc4=_0x186ded;_0x45124a[_0xf4ef('0x27')]=_[_0xf4ef('0x3c')](db[_0xf4ef('0x43')][_0xf4ef('0x24')]);_0x45124a[_0xf4ef('0x28')]=_[_0xf4ef('0x3c')](_0x38a452[_0xf4ef('0x28')]);_0x45124a[_0xf4ef('0x29')]=_[_0xf4ef('0x2b')](_0x45124a[_0xf4ef('0x27')],_0x45124a[_0xf4ef('0x28')]);_0x42e9e9['attributes']=_['intersection'](_0x45124a[_0xf4ef('0x27')],qs[_0xf4ef('0x2c')](_0x38a452[_0xf4ef('0x28')]['fields']));_0x42e9e9[_0xf4ef('0x2a')]=_0x42e9e9[_0xf4ef('0x2a')][_0xf4ef('0x44')]?_0x42e9e9[_0xf4ef('0x2a')]:_0x45124a[_0xf4ef('0x27')];_0x42e9e9[_0xf4ef('0x2e')]=qs[_0xf4ef('0x2f')](_0x38a452[_0xf4ef('0x28')][_0xf4ef('0x2f')]);_0x42e9e9[_0xf4ef('0x30')]=qs[_0xf4ef('0x29')](_[_0xf4ef('0x31')](_0x38a452[_0xf4ef('0x28')],_0x45124a[_0xf4ef('0x29')]));if(_0x38a452[_0xf4ef('0x28')][_0xf4ef('0x32')]){_0x42e9e9[_0xf4ef('0x30')]=_[_0xf4ef('0x34')](_0x42e9e9[_0xf4ef('0x30')],{'$or':_[_0xf4ef('0x23')](_0x42e9e9[_0xf4ef('0x2a')],function(_0x39222b){var _0x44a2a7={};_0x44a2a7[_0x39222b]={'$like':'%'+_0x38a452[_0xf4ef('0x28')][_0xf4ef('0x32')]+'%'};return _0x44a2a7;})});}_0x42e9e9=_['merge']({},_0x42e9e9,_0x38a452[_0xf4ef('0x35')]);return _0x131fc4[_0xf4ef('0x45')](_0x42e9e9);}})[_0xf4ef('0x1d')](function(_0x108b20){if(_0x108b20){_0x1430ef=_0x108b20['length'];if(!_0x38a452[_0xf4ef('0x28')]['hasOwnProperty']('nolimit')){_0x42e9e9['limit']=qs[_0xf4ef('0x18')](_0x38a452[_0xf4ef('0x28')]['limit']);_0x42e9e9['offset']=qs[_0xf4ef('0x16')](_0x38a452[_0xf4ef('0x28')]['offset']);}return _0x131fc4[_0xf4ef('0x45')](_0x42e9e9);}})[_0xf4ef('0x1d')](function(_0x1bc8ba){if(_0x1bc8ba){return _0x1bc8ba?{'count':_0x1430ef,'rows':_0x1bc8ba}:null;}})[_0xf4ef('0x1d')](respondWithResult(_0x4fb469,null))[_0xf4ef('0x3f')](handleError(_0x4fb469,null));};exports[_0xf4ef('0x46')]=function(_0x55eee0,_0x1fed3e,_0x45abf4){var _0x1e9304={};var _0x2ea5ed={};var _0x9ebdad;var _0x343e18;return db[_0xf4ef('0x36')]['findOne']({'where':{'id':_0x55eee0[_0xf4ef('0x3b')]['id']}})[_0xf4ef('0x1d')](handleEntityNotFound(_0x1fed3e,null))['then'](function(_0x3644cf){if(_0x3644cf){_0x9ebdad=_0x3644cf;_0x2ea5ed['model']=_[_0xf4ef('0x3c')](db['FreshdeskField'][_0xf4ef('0x24')]);_0x2ea5ed['query']=_[_0xf4ef('0x3c')](_0x55eee0['query']);_0x2ea5ed[_0xf4ef('0x29')]=_[_0xf4ef('0x2b')](_0x2ea5ed[_0xf4ef('0x27')],_0x2ea5ed['query']);_0x1e9304['attributes']=_['intersection'](_0x2ea5ed['model'],qs[_0xf4ef('0x2c')](_0x55eee0[_0xf4ef('0x28')][_0xf4ef('0x2c')]));_0x1e9304['attributes']=_0x1e9304[_0xf4ef('0x2a')]['length']?_0x1e9304[_0xf4ef('0x2a')]:_0x2ea5ed['model'];_0x1e9304[_0xf4ef('0x2e')]=qs[_0xf4ef('0x2f')](_0x55eee0['query'][_0xf4ef('0x2f')]);_0x1e9304[_0xf4ef('0x30')]=qs[_0xf4ef('0x29')](_['pick'](_0x55eee0[_0xf4ef('0x28')],_0x2ea5ed[_0xf4ef('0x29')]));if(_0x55eee0[_0xf4ef('0x28')][_0xf4ef('0x32')]){_0x1e9304[_0xf4ef('0x30')]=_[_0xf4ef('0x34')](_0x1e9304[_0xf4ef('0x30')],{'$or':_[_0xf4ef('0x23')](_0x1e9304[_0xf4ef('0x2a')],function(_0x573932){var _0x3fad12={};_0x3fad12[_0x573932]={'$like':'%'+_0x55eee0[_0xf4ef('0x28')][_0xf4ef('0x32')]+'%'};return _0x3fad12;})});}_0x1e9304=_['merge']({},_0x1e9304,_0x55eee0['options']);return _0x9ebdad['getSubjects'](_0x1e9304);}})[_0xf4ef('0x1d')](function(_0x276614){if(_0x276614){_0x343e18=_0x276614[_0xf4ef('0x44')];if(!_0x55eee0[_0xf4ef('0x28')]['hasOwnProperty'](_0xf4ef('0x2d'))){_0x1e9304[_0xf4ef('0x18')]=qs[_0xf4ef('0x18')](_0x55eee0['query']['limit']);_0x1e9304[_0xf4ef('0x16')]=qs[_0xf4ef('0x16')](_0x55eee0[_0xf4ef('0x28')][_0xf4ef('0x16')]);}return _0x9ebdad[_0xf4ef('0x46')](_0x1e9304);}})[_0xf4ef('0x1d')](function(_0x2e3145){if(_0x2e3145){return _0x2e3145?{'count':_0x343e18,'rows':_0x2e3145}:null;}})[_0xf4ef('0x1d')](respondWithResult(_0x1fed3e,null))[_0xf4ef('0x3f')](handleError(_0x1fed3e,null));};exports[_0xf4ef('0x47')]=function(_0x3cc838,_0xd91852,_0x2ed567){var _0x163e05={};var _0x7dff6f={};var _0xa79702;var _0x26d857;return db[_0xf4ef('0x36')]['findOne']({'where':{'id':_0x3cc838[_0xf4ef('0x3b')]['id']}})[_0xf4ef('0x1d')](handleEntityNotFound(_0xd91852,null))[_0xf4ef('0x1d')](function(_0x203a30){if(_0x203a30){_0xa79702=_0x203a30;_0x7dff6f['model']=_[_0xf4ef('0x3c')](db[_0xf4ef('0x43')]['rawAttributes']);_0x7dff6f[_0xf4ef('0x28')]=_[_0xf4ef('0x3c')](_0x3cc838[_0xf4ef('0x28')]);_0x7dff6f[_0xf4ef('0x29')]=_[_0xf4ef('0x2b')](_0x7dff6f[_0xf4ef('0x27')],_0x7dff6f[_0xf4ef('0x28')]);_0x163e05[_0xf4ef('0x2a')]=_[_0xf4ef('0x2b')](_0x7dff6f['model'],qs['fields'](_0x3cc838[_0xf4ef('0x28')][_0xf4ef('0x2c')]));_0x163e05['attributes']=_0x163e05[_0xf4ef('0x2a')][_0xf4ef('0x44')]?_0x163e05[_0xf4ef('0x2a')]:_0x7dff6f[_0xf4ef('0x27')];_0x163e05['order']=qs[_0xf4ef('0x2f')](_0x3cc838[_0xf4ef('0x28')][_0xf4ef('0x2f')]);_0x163e05[_0xf4ef('0x30')]=qs[_0xf4ef('0x29')](_[_0xf4ef('0x31')](_0x3cc838[_0xf4ef('0x28')],_0x7dff6f['filters']));if(_0x3cc838[_0xf4ef('0x28')]['filter']){_0x163e05[_0xf4ef('0x30')]=_['merge'](_0x163e05[_0xf4ef('0x30')],{'$or':_[_0xf4ef('0x23')](_0x163e05[_0xf4ef('0x2a')],function(_0x3dea0f){var _0x7a2dc4={};_0x7a2dc4[_0x3dea0f]={'$like':'%'+_0x3cc838[_0xf4ef('0x28')]['filter']+'%'};return _0x7a2dc4;})});}_0x163e05=_[_0xf4ef('0x34')]({},_0x163e05,_0x3cc838[_0xf4ef('0x35')]);return _0xa79702[_0xf4ef('0x47')](_0x163e05);}})[_0xf4ef('0x1d')](function(_0x486c21){if(_0x486c21){_0x26d857=_0x486c21[_0xf4ef('0x44')];if(!_0x3cc838[_0xf4ef('0x28')][_0xf4ef('0x48')](_0xf4ef('0x2d'))){_0x163e05[_0xf4ef('0x18')]=qs[_0xf4ef('0x18')](_0x3cc838[_0xf4ef('0x28')][_0xf4ef('0x18')]);_0x163e05[_0xf4ef('0x16')]=qs[_0xf4ef('0x16')](_0x3cc838[_0xf4ef('0x28')]['offset']);}return _0xa79702[_0xf4ef('0x47')](_0x163e05);}})[_0xf4ef('0x1d')](function(_0x2f218b){if(_0x2f218b){return _0x2f218b?{'count':_0x26d857,'rows':_0x2f218b}:null;}})[_0xf4ef('0x1d')](respondWithResult(_0xd91852,null))[_0xf4ef('0x3f')](handleError(_0xd91852,null));};exports[_0xf4ef('0x49')]=function(_0x187fca,_0x317bd4,_0x3ed6c7){var _0x557c5c={};var _0xcb04ff={};var _0x365366;var _0x1feca5;return db['FreshdeskConfiguration'][_0xf4ef('0x42')]({'where':{'id':_0x187fca[_0xf4ef('0x3b')]['id']}})['then'](handleEntityNotFound(_0x317bd4,null))['then'](function(_0xc2e630){if(_0xc2e630){_0x365366=_0xc2e630;_0xcb04ff[_0xf4ef('0x27')]=_[_0xf4ef('0x3c')](db[_0xf4ef('0x4a')]['rawAttributes']);_0xcb04ff[_0xf4ef('0x28')]=_['keys'](_0x187fca[_0xf4ef('0x28')]);_0xcb04ff[_0xf4ef('0x29')]=_['intersection'](_0xcb04ff['model'],_0xcb04ff[_0xf4ef('0x28')]);_0x557c5c[_0xf4ef('0x2a')]=_[_0xf4ef('0x2b')](_0xcb04ff[_0xf4ef('0x27')],qs['fields'](_0x187fca[_0xf4ef('0x28')][_0xf4ef('0x2c')]));_0x557c5c[_0xf4ef('0x2a')]=_0x557c5c['attributes'][_0xf4ef('0x44')]?_0x557c5c[_0xf4ef('0x2a')]:_0xcb04ff[_0xf4ef('0x27')];_0x557c5c[_0xf4ef('0x2e')]=qs[_0xf4ef('0x2f')](_0x187fca['query'][_0xf4ef('0x2f')]);_0x557c5c[_0xf4ef('0x30')]=qs['filters'](_[_0xf4ef('0x31')](_0x187fca[_0xf4ef('0x28')],_0xcb04ff['filters']));if(_0x187fca[_0xf4ef('0x28')][_0xf4ef('0x32')]){_0x557c5c[_0xf4ef('0x30')]=_[_0xf4ef('0x34')](_0x557c5c[_0xf4ef('0x30')],{'$or':_[_0xf4ef('0x23')](_0x557c5c[_0xf4ef('0x2a')],function(_0x5ac038){var _0x986122={};_0x986122[_0x5ac038]={'$like':'%'+_0x187fca[_0xf4ef('0x28')][_0xf4ef('0x32')]+'%'};return _0x986122;})});}_0x557c5c=_[_0xf4ef('0x34')]({},_0x557c5c,_0x187fca[_0xf4ef('0x35')]);return _0x365366[_0xf4ef('0x49')](_0x557c5c);}})[_0xf4ef('0x1d')](function(_0x194ac3){if(_0x194ac3){_0x1feca5=_0x194ac3['length'];if(!_0x187fca['query'][_0xf4ef('0x48')](_0xf4ef('0x2d'))){_0x557c5c[_0xf4ef('0x18')]=qs[_0xf4ef('0x18')](_0x187fca[_0xf4ef('0x28')]['limit']);_0x557c5c[_0xf4ef('0x16')]=qs[_0xf4ef('0x16')](_0x187fca[_0xf4ef('0x28')][_0xf4ef('0x16')]);}return _0x365366['getTags'](_0x557c5c);}})[_0xf4ef('0x1d')](function(_0x4afbd3){if(_0x4afbd3){return _0x4afbd3?{'count':_0x1feca5,'rows':_0x4afbd3}:null;}})[_0xf4ef('0x1d')](respondWithResult(_0x317bd4,null))[_0xf4ef('0x3f')](handleError(_0x317bd4,null));};exports[_0xf4ef('0x4b')]=function(_0x9c8a51,_0x5563e0,_0x337b4b){if(_0x9c8a51[_0xf4ef('0x41')]['id']){delete _0x9c8a51[_0xf4ef('0x41')]['id'];}return db[_0xf4ef('0x36')]['findOne']({'where':{'id':_0x9c8a51[_0xf4ef('0x3b')]['id']}})[_0xf4ef('0x1d')](handleEntityNotFound(_0x5563e0,null))[_0xf4ef('0x1d')](function(_0x24eb54){if(_0x24eb54){return _0x24eb54[_0xf4ef('0x4b')](_0x9c8a51[_0xf4ef('0x41')][_0xf4ef('0x4c')]||[]);}return null;})['then'](respondWithResult(_0x5563e0,null))[_0xf4ef('0x3f')](handleError(_0x5563e0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 79eb58d..b856f1a 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 _0x1144=['exports','define','FreshdeskConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x5e0ac6,_0x40b94b){var _0x140494=function(_0x3cd04f){while(--_0x3cd04f){_0x5e0ac6['push'](_0x5e0ac6['shift']());}};_0x140494(++_0x40b94b);}(_0x1144,0x117));var _0x4114=function(_0x5c7c22,_0x18136b){_0x5c7c22=_0x5c7c22-0x0;var _0x47c6ca=_0x1144[_0x5c7c22];return _0x47c6ca;};'use strict';var _=require('lodash');var util=require(_0x4114('0x0'));var logger=require(_0x4114('0x1'))(_0x4114('0x2'));var moment=require(_0x4114('0x3'));var BPromise=require(_0x4114('0x4'));var rp=require(_0x4114('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4114('0x6'));var config=require(_0x4114('0x7'));var attributes=require(_0x4114('0x8'));module[_0x4114('0x9')]=function(_0x545d88,_0x9f5a50){return _0x545d88[_0x4114('0xa')](_0x4114('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fbf=['define','FreshdeskConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3fbf,0x1e3));var _0xf3fb=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x3fbf[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xf3fb('0x0'));var util=require(_0xf3fb('0x1'));var logger=require(_0xf3fb('0x2'))('api');var moment=require(_0xf3fb('0x3'));var BPromise=require(_0xf3fb('0x4'));var rp=require(_0xf3fb('0x5'));var fs=require('fs');var path=require(_0xf3fb('0x6'));var rimraf=require(_0xf3fb('0x7'));var config=require(_0xf3fb('0x8'));var attributes=require(_0xf3fb('0x9'));module[_0xf3fb('0xa')]=function(_0x3162bc,_0x323025){return _0x3162bc[_0xf3fb('0xb')](_0xf3fb('0xc'),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 3fb7dee..43ba9f3 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 _0x9213=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','error'];(function(_0x48df8b,_0x4bff7a){var _0x230a0b=function(_0x3d6024){while(--_0x3d6024){_0x48df8b['push'](_0x48df8b['shift']());}};_0x230a0b(++_0x4bff7a);}(_0x9213,0x16d));var _0x3921=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x9213[_0x277af0];return _0x43bd7c;};'use strict';var _=require(_0x3921('0x0'));var util=require('util');var moment=require(_0x3921('0x1'));var BPromise=require(_0x3921('0x2'));var rs=require(_0x3921('0x3'));var fs=require('fs');var Redis=require(_0x3921('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3921('0x5'));var config=require(_0x3921('0x6'));var jayson=require(_0x3921('0x7'));var client=jayson[_0x3921('0x8')][_0x3921('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33d66d,_0x30ec9f,_0x2612ee){return new BPromise(function(_0x2fa75d,_0x3fc54a){return client[_0x3921('0xa')](_0x33d66d,_0x2612ee)[_0x3921('0xb')](function(_0x36e7d7){logger['info'](_0x3921('0xc'),_0x30ec9f,_0x3921('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x30ec9f,_0x3921('0xd'),JSON['stringify'](_0x36e7d7));if(_0x36e7d7[_0x3921('0xe')]){if(_0x36e7d7[_0x3921('0xe')][_0x3921('0xf')]===0x1f4){logger[_0x3921('0xe')](_0x3921('0xc'),_0x30ec9f,_0x36e7d7[_0x3921('0xe')]['message']);return _0x3fc54a(_0x36e7d7[_0x3921('0xe')][_0x3921('0x10')]);}logger[_0x3921('0xe')](_0x3921('0xc'),_0x30ec9f,_0x36e7d7[_0x3921('0xe')][_0x3921('0x10')]);return _0x2fa75d(_0x36e7d7['error'][_0x3921('0x10')]);}else{logger[_0x3921('0x11')](_0x3921('0xc'),_0x30ec9f,'request\x20sent');_0x2fa75d(_0x36e7d7[_0x3921('0x12')][_0x3921('0x10')]);}})[_0x3921('0x13')](function(_0x17c660){logger[_0x3921('0xe')](_0x3921('0xc'),_0x30ec9f,_0x17c660);_0x3fc54a(_0x17c660);});});} \ No newline at end of file +var _0x4795=['debug','request\x20sent','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','request','info'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x4795,0xc2));var _0x5479=function(_0x5825db,_0x2d3ab3){_0x5825db=_0x5825db-0x0;var _0x165731=_0x4795[_0x5825db];return _0x165731;};'use strict';var _=require('lodash');var util=require(_0x5479('0x0'));var moment=require(_0x5479('0x1'));var BPromise=require(_0x5479('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5479('0x3'));var db=require(_0x5479('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5479('0x5'));var client=jayson[_0x5479('0x6')][_0x5479('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x57c62b,_0x35dece,_0x70a954){return new BPromise(function(_0x419bc9,_0x36529d){return client[_0x5479('0x8')](_0x57c62b,_0x70a954)['then'](function(_0x61a6ec){logger[_0x5479('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x35dece,'request\x20sent');logger[_0x5479('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x35dece,_0x5479('0xb'),JSON[_0x5479('0xc')](_0x61a6ec));if(_0x61a6ec[_0x5479('0xd')]){if(_0x61a6ec['error'][_0x5479('0xe')]===0x1f4){logger[_0x5479('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x35dece,_0x61a6ec[_0x5479('0xd')][_0x5479('0xf')]);return _0x36529d(_0x61a6ec['error'][_0x5479('0xf')]);}logger[_0x5479('0xd')](_0x5479('0x10'),_0x35dece,_0x61a6ec[_0x5479('0xd')]['message']);return _0x419bc9(_0x61a6ec[_0x5479('0xd')][_0x5479('0xf')]);}else{logger[_0x5479('0x9')](_0x5479('0x10'),_0x35dece,_0x5479('0xb'));_0x419bc9(_0x61a6ec['result'][_0x5479('0xf')]);}})['catch'](function(_0x39000d){logger[_0x5479('0xd')](_0x5479('0x10'),_0x35dece,_0x39000d);_0x36529d(_0x39000d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index fe85a55..54b0e24 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 _0x4099=['../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14b5cc,_0x490f17){var _0xf25922=function(_0x4f0b97){while(--_0x4f0b97){_0x14b5cc['push'](_0x14b5cc['shift']());}};_0xf25922(++_0x490f17);}(_0x4099,0x71));var _0x9409=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x4099[_0x374ada];return _0x449ed8;};'use strict';var multer=require(_0x9409('0x0'));var util=require('util');var path=require(_0x9409('0x1'));var timeout=require(_0x9409('0x2'));var express=require(_0x9409('0x3'));var router=express[_0x9409('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9409('0x5'));var interaction=require(_0x9409('0x6'));var config=require(_0x9409('0x7'));var controller=require(_0x9409('0x8'));router[_0x9409('0x9')]('/',auth[_0x9409('0xa')](),controller[_0x9409('0xb')]);router[_0x9409('0x9')](_0x9409('0xc'),auth['isAuthenticated'](),controller[_0x9409('0xd')]);router[_0x9409('0xe')]('/',auth[_0x9409('0xa')](),controller[_0x9409('0xf')]);router[_0x9409('0x10')](_0x9409('0xc'),auth['isAuthenticated'](),controller[_0x9409('0x11')]);router[_0x9409('0x12')](_0x9409('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9409('0x13')]=router; \ No newline at end of file +var _0x4ace=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','isAuthenticated','create','put','update','delete','destroy'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4ace,0x10b));var _0xe4ac=function(_0x1f32f6,_0x4ccbee){_0x1f32f6=_0x1f32f6-0x0;var _0x4b7494=_0x4ace[_0x1f32f6];return _0x4b7494;};'use strict';var multer=require('multer');var util=require(_0xe4ac('0x0'));var path=require(_0xe4ac('0x1'));var timeout=require(_0xe4ac('0x2'));var express=require(_0xe4ac('0x3'));var router=express[_0xe4ac('0x4')]();var fs_extra=require(_0xe4ac('0x5'));var auth=require(_0xe4ac('0x6'));var interaction=require(_0xe4ac('0x7'));var config=require(_0xe4ac('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe4ac('0x9')]);router['get'](_0xe4ac('0xa'),auth['isAuthenticated'](),controller[_0xe4ac('0xb')]);router['post']('/',auth[_0xe4ac('0xc')](),controller[_0xe4ac('0xd')]);router[_0xe4ac('0xe')](_0xe4ac('0xa'),auth[_0xe4ac('0xc')](),controller[_0xe4ac('0xf')]);router[_0xe4ac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe4ac('0x11')]);module[_0xe4ac('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 8c03576..23f57ad 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 _0x4df3=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x19c19b,_0x26340e){var _0x9b022b=function(_0x2a2da7){while(--_0x2a2da7){_0x19c19b['push'](_0x19c19b['shift']());}};_0x9b022b(++_0x26340e);}(_0x4df3,0x1b6));var _0x34df=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0x4df3[_0xd8a8af];return _0x5b7278;};'use strict';var Sequelize=require(_0x34df('0x0'));module[_0x34df('0x1')]={'type':{'type':Sequelize[_0x34df('0x2')](_0x34df('0x3'),_0x34df('0x4'),'customVariable',_0x34df('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x34df('0x6')]},'key':{'type':Sequelize[_0x34df('0x6')]},'keyType':{'type':Sequelize[_0x34df('0x2')](_0x34df('0x3'),_0x34df('0x4'),_0x34df('0x7'))},'keyContent':{'type':Sequelize[_0x34df('0x6')]},'idField':{'type':Sequelize[_0x34df('0x6')]},'nameField':{'type':Sequelize[_0x34df('0x6')]},'customField':{'type':Sequelize[_0x34df('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x34df('0x6')]}}; \ No newline at end of file +var _0xa3ea=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x2e5568,_0x3dac5f){var _0x332c16=function(_0x47684b){while(--_0x47684b){_0x2e5568['push'](_0x2e5568['shift']());}};_0x332c16(++_0x3dac5f);}(_0xa3ea,0x123));var _0xaa3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa3ea[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xaa3e('0x0')]={'type':{'type':Sequelize[_0xaa3e('0x1')](_0xaa3e('0x2'),_0xaa3e('0x3'),_0xaa3e('0x4'),_0xaa3e('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xaa3e('0x6')]},'key':{'type':Sequelize[_0xaa3e('0x6')]},'keyType':{'type':Sequelize[_0xaa3e('0x1')](_0xaa3e('0x2'),'variable',_0xaa3e('0x4'))},'keyContent':{'type':Sequelize[_0xaa3e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaa3e('0x6')]},'customField':{'type':Sequelize[_0xaa3e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa3e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 85b76f8..b74c1df 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 _0x9c5e=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x21f9e2,_0x4d4b88){_0x21f9e2=_0x21f9e2-0x0;var _0x4d0032=_0x9c5e[_0x21f9e2];return _0x4d0032;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x28')]();});}};}function handleEntityNotFound(_0x5a3caa,_0x5c8bb7){return function(_0x250e1c){if(!_0x250e1c){_0x5a3caa[_0xe9c5('0x19')](0x194);}return _0x250e1c;};}function handleError(_0x298dca,_0x3bf679){_0x3bf679=_0x3bf679||0x1f4;return function(_0x33fe71){logger[_0xe9c5('0x29')](_0x33fe71['stack']);if(_0x33fe71[_0xe9c5('0x2a')]){delete _0x33fe71['name'];}_0x298dca[_0xe9c5('0x1a')](_0x3bf679)['send'](_0x33fe71);};}exports[_0xe9c5('0x2b')]=function(_0x2112a6,_0x52d008){var _0x36d145={},_0x46d253={},_0x334f5a={'count':0x0,'rows':[]};var _0x37cfa5=_[_0xe9c5('0x2c')](db['FreshdeskField'][_0xe9c5('0x2d')],function(_0x4fcabd){return{'name':_0x4fcabd[_0xe9c5('0x2e')],'type':_0x4fcabd['type'][_0xe9c5('0x2f')]};});_0x46d253[_0xe9c5('0x30')]=_[_0xe9c5('0x2c')](_0x37cfa5,_0xe9c5('0x2a'));_0x46d253[_0xe9c5('0x31')]=_['keys'](_0x2112a6[_0xe9c5('0x31')]);_0x46d253[_0xe9c5('0x32')]=_[_0xe9c5('0x33')](_0x46d253[_0xe9c5('0x30')],_0x46d253[_0xe9c5('0x31')]);_0x36d145['attributes']=_['intersection'](_0x46d253[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x36d145[_0xe9c5('0x35')]=_0x36d145[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x36d145[_0xe9c5('0x35')]:_0x46d253['model'];if(!_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x37')]('nolimit')){_0x36d145[_0xe9c5('0x1d')]=qs['limit'](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1d')]);_0x36d145[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1f')]);}_0x36d145[_0xe9c5('0x38')]=qs[_0xe9c5('0x39')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x39')]);_0x36d145[_0xe9c5('0x3a')]=qs[_0xe9c5('0x32')](_[_0xe9c5('0x3b')](_0x2112a6[_0xe9c5('0x31')],_0x46d253[_0xe9c5('0x32')]),_0x37cfa5);if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x3c')]){_0x36d145[_0xe9c5('0x3a')]=_[_0xe9c5('0x3d')](_0x36d145['where'],{'$or':_[_0xe9c5('0x2c')](_0x37cfa5,function(_0x2e3f15){if(_0x2e3f15[_0xe9c5('0x3e')]!==_0xe9c5('0x3f')){var _0x204b53={};_0x204b53[_0x2e3f15[_0xe9c5('0x2a')]]={'$like':'%'+_0x2112a6['query'][_0xe9c5('0x3c')]+'%'};return _0x204b53;}})});}_0x36d145=_[_0xe9c5('0x3d')]({},_0x36d145,_0x2112a6[_0xe9c5('0x40')]);var _0x480b83={'where':_0x36d145[_0xe9c5('0x3a')]};return db[_0xe9c5('0x41')][_0xe9c5('0x1e')](_0x480b83)[_0xe9c5('0x26')](function(_0x2c1615){_0x334f5a[_0xe9c5('0x1e')]=_0x2c1615;if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x36d145[_0xe9c5('0x43')]=[{'all':!![]}];}return db[_0xe9c5('0x41')][_0xe9c5('0x44')](_0x36d145);})['then'](function(_0x51dd18){_0x334f5a[_0xe9c5('0x45')]=_0x51dd18;return _0x334f5a;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x52d008,_0x36d145))[_0xe9c5('0x46')](handleError(_0x52d008,null));};exports[_0xe9c5('0x47')]=function(_0x4ca4b0,_0x4a3fc5){var _0x382405={'raw':!![],'where':{'id':_0x4ca4b0['params']['id']}},_0x144e85={};_0x144e85[_0xe9c5('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x144e85[_0xe9c5('0x31')]=_[_0xe9c5('0x48')](_0x4ca4b0[_0xe9c5('0x31')]);_0x144e85[_0xe9c5('0x32')]=_['intersection'](_0x144e85[_0xe9c5('0x30')],_0x144e85[_0xe9c5('0x31')]);_0x382405[_0xe9c5('0x35')]=_[_0xe9c5('0x33')](_0x144e85[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x382405['attributes']=_0x382405[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x382405[_0xe9c5('0x35')]:_0x144e85[_0xe9c5('0x30')];if(_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x382405['include']=[{'all':!![]}];}_0x382405=_['merge']({},_0x382405,_0x4ca4b0['options']);return db['FreshdeskField'][_0xe9c5('0x49')](_0x382405)[_0xe9c5('0x26')](handleEntityNotFound(_0x4a3fc5,null))[_0xe9c5('0x26')](respondWithResult(_0x4a3fc5,null))['catch'](handleError(_0x4a3fc5,null));};exports[_0xe9c5('0x4a')]=function(_0x520248,_0x1ed99e){return db[_0xe9c5('0x41')][_0xe9c5('0x4a')](_0x520248[_0xe9c5('0x4b')],{})['then'](respondWithResult(_0x1ed99e,0xc9))[_0xe9c5('0x46')](handleError(_0x1ed99e,null));};exports[_0xe9c5('0x25')]=function(_0x1da6a3,_0x249940){if(_0x1da6a3['body']['id']){delete _0x1da6a3[_0xe9c5('0x4b')]['id'];}return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x1da6a3[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x249940,null))[_0xe9c5('0x26')](saveUpdates(_0x1da6a3['body'],null))[_0xe9c5('0x26')](respondWithResult(_0x249940,null))[_0xe9c5('0x46')](handleError(_0x249940,null));};exports[_0xe9c5('0x27')]=function(_0x9d0154,_0x5e7c24){return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x9d0154[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x5e7c24,null))[_0xe9c5('0x26')](removeEntity(_0x5e7c24,null))[_0xe9c5('0x46')](handleError(_0x5e7c24,null));}; \ No newline at end of file +var _0xb9a7=['merge','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','create','body','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','stack','map','FreshdeskField','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xb9a7,0x112));var _0x7b9a=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xb9a7[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['FreshdeskField'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index b77c6a1..01bb462 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 _0x3e5c=['FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x51f308,_0x3d48e0){var _0x563121=function(_0x2aaea4){while(--_0x2aaea4){_0x51f308['push'](_0x51f308['shift']());}};_0x563121(++_0x3d48e0);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x14fb18,_0x47d57d){_0x14fb18=_0x14fb18-0x0;var _0x33c916=_0x3e5c[_0x14fb18];return _0x33c916;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var logger=require(_0xc3e5('0x2'))(_0xc3e5('0x3'));var moment=require('moment');var BPromise=require(_0xc3e5('0x4'));var rp=require(_0xc3e5('0x5'));var fs=require('fs');var path=require(_0xc3e5('0x6'));var rimraf=require(_0xc3e5('0x7'));var config=require(_0xc3e5('0x8'));var attributes=require(_0xc3e5('0x9'));module['exports']=function(_0xf61ec2,_0xdf5a06){return _0xf61ec2[_0xc3e5('0xa')](_0xc3e5('0xb'),attributes,{'tableName':_0xc3e5('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xc3e5('0xd'),_0xc3e5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaee2=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x583b3b,_0x31271d){var _0xcdb6d0=function(_0x209dcd){while(--_0x209dcd){_0x583b3b['push'](_0x583b3b['shift']());}};_0xcdb6d0(++_0x31271d);}(_0xaee2,0xf2));var _0x2aee=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0xaee2[_0xd39959];return _0x1ff69c;};'use strict';var _=require(_0x2aee('0x0'));var util=require(_0x2aee('0x1'));var logger=require(_0x2aee('0x2'))(_0x2aee('0x3'));var moment=require(_0x2aee('0x4'));var BPromise=require(_0x2aee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2aee('0x6'));var config=require(_0x2aee('0x7'));var attributes=require(_0x2aee('0x8'));module[_0x2aee('0x9')]=function(_0x4a652a,_0x2e3b3d){return _0x4a652a[_0x2aee('0xa')](_0x2aee('0xb'),attributes,{'tableName':_0x2aee('0xc'),'paranoid':![],'indexes':[{'name':_0x2aee('0xd'),'fields':[_0x2aee('0xe'),_0x2aee('0xf')],'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 0152527..4f609d4 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 _0x56d1=['FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2b3cad,_0x573629){var _0x2175c4=function(_0x2f5a4f){while(--_0x2f5a4f){_0x2b3cad['push'](_0x2b3cad['shift']());}};_0x2175c4(++_0x573629);}(_0x56d1,0x1ac));var _0x156d=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0x56d1[_0x40b981];return _0x58696b;};'use strict';var _=require(_0x156d('0x0'));var util=require(_0x156d('0x1'));var moment=require(_0x156d('0x2'));var BPromise=require('bluebird');var rs=require(_0x156d('0x3'));var fs=require('fs');var Redis=require(_0x156d('0x4'));var db=require(_0x156d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x156d('0x6'));var jayson=require(_0x156d('0x7'));var client=jayson[_0x156d('0x8')][_0x156d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a1337,_0x224012,_0x7070fa){return new BPromise(function(_0x142613,_0x2917ec){return client['request'](_0x1a1337,_0x7070fa)[_0x156d('0xa')](function(_0x1baf5b){logger[_0x156d('0xb')](_0x156d('0xc'),_0x224012,_0x156d('0xd'));logger['debug'](_0x156d('0xe'),_0x224012,_0x156d('0xd'),JSON[_0x156d('0xf')](_0x1baf5b));if(_0x1baf5b['error']){if(_0x1baf5b[_0x156d('0x10')]['code']===0x1f4){logger[_0x156d('0x10')](_0x156d('0xc'),_0x224012,_0x1baf5b[_0x156d('0x10')][_0x156d('0x11')]);return _0x2917ec(_0x1baf5b[_0x156d('0x10')][_0x156d('0x11')]);}logger[_0x156d('0x10')](_0x156d('0xc'),_0x224012,_0x1baf5b[_0x156d('0x10')]['message']);return _0x142613(_0x1baf5b[_0x156d('0x10')]['message']);}else{logger[_0x156d('0xb')](_0x156d('0xc'),_0x224012,_0x156d('0xd'));_0x142613(_0x1baf5b[_0x156d('0x12')][_0x156d('0x11')]);}})[_0x156d('0x13')](function(_0x18589c){logger['error'](_0x156d('0xc'),_0x224012,_0x18589c);_0x2917ec(_0x18589c);});});} \ No newline at end of file +var _0x25fa=['lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x16ca8e,_0x60f267){var _0x4c560e=function(_0x40e8e5){while(--_0x40e8e5){_0x16ca8e['push'](_0x16ca8e['shift']());}};_0x4c560e(++_0x60f267);}(_0x25fa,0x190));var _0xa25f=function(_0x3fbcf5,_0x550b7e){_0x3fbcf5=_0x3fbcf5-0x0;var _0x5515c8=_0x25fa[_0x3fbcf5];return _0x5515c8;};'use strict';var _=require(_0xa25f('0x0'));var util=require(_0xa25f('0x1'));var moment=require(_0xa25f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa25f('0x3'));var logger=require(_0xa25f('0x4'))(_0xa25f('0x5'));var config=require('../../config/environment');var jayson=require(_0xa25f('0x6'));var client=jayson[_0xa25f('0x7')][_0xa25f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcf9110,_0x611603,_0x505fac){return new BPromise(function(_0x1b32bd,_0x42f884){return client[_0xa25f('0x9')](_0xcf9110,_0x505fac)[_0xa25f('0xa')](function(_0x19f395){logger[_0xa25f('0xb')](_0xa25f('0xc'),_0x611603,_0xa25f('0xd'));logger[_0xa25f('0xe')](_0xa25f('0xf'),_0x611603,_0xa25f('0xd'),JSON[_0xa25f('0x10')](_0x19f395));if(_0x19f395[_0xa25f('0x11')]){if(_0x19f395[_0xa25f('0x11')]['code']===0x1f4){logger['error'](_0xa25f('0xc'),_0x611603,_0x19f395[_0xa25f('0x11')][_0xa25f('0x12')]);return _0x42f884(_0x19f395['error'][_0xa25f('0x12')]);}logger[_0xa25f('0x11')](_0xa25f('0xc'),_0x611603,_0x19f395[_0xa25f('0x11')][_0xa25f('0x12')]);return _0x1b32bd(_0x19f395[_0xa25f('0x11')][_0xa25f('0x12')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x611603,_0xa25f('0xd'));_0x1b32bd(_0x19f395[_0xa25f('0x13')][_0xa25f('0x12')]);}})['catch'](function(_0xea897b){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x611603,_0xea897b);_0x42f884(_0xea897b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 13a98fe..5871f99 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 _0xe205=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe205,0xa7));var _0x5e20=function(_0x3a3787,_0x3e2c7b){_0x3a3787=_0x3a3787-0x0;var _0x3e9030=_0xe205[_0x3a3787];return _0x3e9030;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/:id',auth[_0x5e20('0xb')](),controller['show']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['getConfigurations']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0x10')]);router[_0x5e20('0x11')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x12')]);router['put'](_0x5e20('0x13'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x14')]);router['delete'](_0x5e20('0x13'),auth['isAuthenticated'](),controller[_0x5e20('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa5fa=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','destroy','exports','util','path'];(function(_0x4b0577,_0x6ac222){var _0x262693=function(_0x17751d){while(--_0x17751d){_0x4b0577['push'](_0x4b0577['shift']());}};_0x262693(++_0x6ac222);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x1ce6a7,_0xeaa892){_0x1ce6a7=_0x1ce6a7-0x0;var _0x3095a7=_0xa5fa[_0x1ce6a7];return _0x3095a7;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa5f('0x10')]);router['post'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x11')]);router[_0xaa5f('0x12')](_0xaa5f('0xb'),auth['isAuthenticated'](),controller[_0xaa5f('0x13')]);router['delete'](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);module[_0xaa5f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ac212a5..7369e33 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 _0x5204=['exports','STRING','username','sequelize'];(function(_0x520513,_0x1e86e1){var _0x48394b=function(_0x2b5625){while(--_0x2b5625){_0x520513['push'](_0x520513['shift']());}};_0x48394b(++_0x1e86e1);}(_0x5204,0xdf));var _0x4520=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x5204[_0x4fbb86];return _0xb141fe;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x77d4=['exports','STRING','username'];(function(_0x25483f,_0x43852f){var _0x220d13=function(_0x4a5779){while(--_0x4a5779){_0x25483f['push'](_0x25483f['shift']());}};_0x220d13(++_0x43852f);}(_0x77d4,0x108));var _0x477d=function(_0x88281e,_0x502f0b){_0x88281e=_0x88281e-0x0;var _0x4c8edf=_0x77d4[_0x88281e];return _0x4c8edf;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 1f5a842..63ca806 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 _0x453a=['path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','filter','Descriptions','channel','FreshsalesConfiguration','Subjects','FreshsalesField','getFields','username','remoteUri','slice','substring','GET','%s%s','Token\x20token=','apiKey','users','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x453a,0x1e3));var _0xa453=function(_0x2bc4df,_0x397a6f){_0x2bc4df=_0x2bc4df-0x0;var _0x4bcc54=_0x453a[_0x2bc4df];return _0x4bcc54;};'use strict';var emlformat=require(_0xa453('0x0'));var rimraf=require(_0xa453('0x1'));var zipdir=require(_0xa453('0x2'));var jsonpatch=require(_0xa453('0x3'));var rp=require(_0xa453('0x4'));var moment=require(_0xa453('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa453('0x6'));var util=require('util');var path=require(_0xa453('0x7'));var sox=require(_0xa453('0x8'));var csv=require(_0xa453('0x9'));var ejs=require(_0xa453('0xa'));var fs=require('fs');var fs_extra=require(_0xa453('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa453('0xc'));var jsforce=require(_0xa453('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa453('0x9'));var querystring=require('querystring');var Papa=require(_0xa453('0xe'));var Redis=require(_0xa453('0xf'));var authService=require(_0xa453('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa453('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa453('0x12'));var utils=require(_0xa453('0x13'));var config=require(_0xa453('0x14'));var licenseUtil=require(_0xa453('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa453('0x16'));function respondWithStatusCode(_0x3f66d6,_0x366035){_0x366035=_0x366035||0xcc;return function(_0x31c5ec){if(_0x31c5ec){return _0x3f66d6[_0xa453('0x17')](_0x366035);}return _0x3f66d6[_0xa453('0x18')](_0x366035)[_0xa453('0x19')]();};}function respondWithResult(_0x313daa,_0x58c8d7){_0x58c8d7=_0x58c8d7||0xc8;return function(_0x4b8ac4){if(_0x4b8ac4){return _0x313daa[_0xa453('0x18')](_0x58c8d7)[_0xa453('0x1a')](_0x4b8ac4);}};}function respondWithFilteredResult(_0x1b1607,_0xd1e571){return function(_0xc1c269){if(_0xc1c269){var _0x72357f=typeof _0xd1e571[_0xa453('0x1b')]===_0xa453('0x1c')&&typeof _0xd1e571[_0xa453('0x1d')]===_0xa453('0x1c');var _0x1475de=_0xc1c269[_0xa453('0x1e')];var _0x2e5900=_0x72357f?0x0:_0xd1e571[_0xa453('0x1b')];var _0x473874=_0x72357f?_0xc1c269[_0xa453('0x1e')]:_0xd1e571['offset']+_0xd1e571[_0xa453('0x1d')];var _0x14e4b0;if(_0x473874>=_0x1475de){_0x473874=_0x1475de;_0x14e4b0=0xc8;}else{_0x14e4b0=0xce;}_0x1b1607[_0xa453('0x18')](_0x14e4b0);return _0x1b1607['set'](_0xa453('0x1f'),_0x2e5900+'-'+_0x473874+'/'+_0x1475de)['json'](_0xc1c269);}return null;};}function patchUpdates(_0x26e728){return function(_0x2b7d70){try{jsonpatch['apply'](_0x2b7d70,_0x26e728,!![]);}catch(_0x5e6ed2){return BPromise[_0xa453('0x20')](_0x5e6ed2);}return _0x2b7d70['save']();};}function saveUpdates(_0x40448d,_0x65326c){return function(_0x41fba5){if(_0x41fba5){return _0x41fba5[_0xa453('0x21')](_0x40448d)[_0xa453('0x22')](function(_0xdfd9a){return _0xdfd9a;});}return null;};}function removeEntity(_0x3cde4c,_0x24e43f){return function(_0x174ae1){if(_0x174ae1){return _0x174ae1[_0xa453('0x23')]()[_0xa453('0x22')](function(){_0x3cde4c[_0xa453('0x18')](0xcc)[_0xa453('0x19')]();});}};}function handleEntityNotFound(_0x63024f,_0x3a6f7e){return function(_0x2bb00f){if(!_0x2bb00f){_0x63024f[_0xa453('0x17')](0x194);}return _0x2bb00f;};}function handleError(_0x28414c,_0x1c23b5){_0x1c23b5=_0x1c23b5||0x1f4;return function(_0x1750f6){logger['error'](_0x1750f6[_0xa453('0x24')]);if(_0x1750f6['name']){delete _0x1750f6[_0xa453('0x25')];}_0x28414c[_0xa453('0x18')](_0x1c23b5)[_0xa453('0x26')](_0x1750f6);};}exports[_0xa453('0x27')]=function(_0x2a0c26,_0x2b231a){var _0x34a52c={},_0x4749c0={},_0x4a5574={'count':0x0,'rows':[]};var _0x3621b5=_[_0xa453('0x28')](db[_0xa453('0x29')]['rawAttributes'],function(_0x4a413b){return{'name':_0x4a413b[_0xa453('0x2a')],'type':_0x4a413b[_0xa453('0x2b')][_0xa453('0x2c')]};});_0x4749c0[_0xa453('0x2d')]=_[_0xa453('0x28')](_0x3621b5,_0xa453('0x25'));_0x4749c0[_0xa453('0x2e')]=_[_0xa453('0x2f')](_0x2a0c26[_0xa453('0x2e')]);_0x4749c0['filters']=_[_0xa453('0x30')](_0x4749c0['model'],_0x4749c0[_0xa453('0x2e')]);_0x34a52c[_0xa453('0x31')]=_[_0xa453('0x30')](_0x4749c0[_0xa453('0x2d')],qs['fields'](_0x2a0c26['query'][_0xa453('0x32')]));_0x34a52c[_0xa453('0x31')]=_0x34a52c[_0xa453('0x31')][_0xa453('0x33')]?_0x34a52c['attributes']:_0x4749c0[_0xa453('0x2d')];if(!_0x2a0c26[_0xa453('0x2e')][_0xa453('0x34')](_0xa453('0x35'))){_0x34a52c['limit']=qs[_0xa453('0x1d')](_0x2a0c26['query'][_0xa453('0x1d')]);_0x34a52c[_0xa453('0x1b')]=qs[_0xa453('0x1b')](_0x2a0c26[_0xa453('0x2e')][_0xa453('0x1b')]);}_0x34a52c[_0xa453('0x36')]=qs[_0xa453('0x37')](_0x2a0c26['query'][_0xa453('0x37')]);_0x34a52c[_0xa453('0x38')]=qs[_0xa453('0x39')](_[_0xa453('0x3a')](_0x2a0c26[_0xa453('0x2e')],_0x4749c0[_0xa453('0x39')]),_0x3621b5);if(_0x2a0c26[_0xa453('0x2e')]['filter']){_0x34a52c[_0xa453('0x38')]=_[_0xa453('0x3b')](_0x34a52c[_0xa453('0x38')],{'$or':_[_0xa453('0x28')](_0x3621b5,function(_0x5934e3){if(_0x5934e3[_0xa453('0x2b')]!==_0xa453('0x3c')){var _0x1912d9={};_0x1912d9[_0x5934e3[_0xa453('0x25')]]={'$like':'%'+_0x2a0c26[_0xa453('0x2e')]['filter']+'%'};return _0x1912d9;}})});}_0x34a52c=_[_0xa453('0x3b')]({},_0x34a52c,_0x2a0c26[_0xa453('0x3d')]);var _0x5f3e3d={'where':_0x34a52c[_0xa453('0x38')]};return db[_0xa453('0x29')]['count'](_0x5f3e3d)[_0xa453('0x22')](function(_0x51f383){_0x4a5574[_0xa453('0x1e')]=_0x51f383;if(_0x2a0c26[_0xa453('0x2e')][_0xa453('0x3e')]){_0x34a52c[_0xa453('0x3f')]=[{'all':!![]}];}return db[_0xa453('0x29')][_0xa453('0x40')](_0x34a52c);})['then'](function(_0x392eda){_0x4a5574[_0xa453('0x41')]=_0x392eda;return _0x4a5574;})[_0xa453('0x22')](respondWithFilteredResult(_0x2b231a,_0x34a52c))['catch'](handleError(_0x2b231a,null));};exports[_0xa453('0x42')]=function(_0x3fe100,_0x7f3ba9){var _0x500b74={'raw':![],'where':{'id':_0x3fe100[_0xa453('0x43')]['id']}},_0x3cc730={};_0x3cc730[_0xa453('0x2d')]=_[_0xa453('0x2f')](db['FreshsalesAccount'][_0xa453('0x44')]);_0x3cc730[_0xa453('0x2e')]=_[_0xa453('0x2f')](_0x3fe100['query']);_0x3cc730[_0xa453('0x39')]=_['intersection'](_0x3cc730['model'],_0x3cc730[_0xa453('0x2e')]);_0x500b74[_0xa453('0x31')]=_[_0xa453('0x30')](_0x3cc730[_0xa453('0x2d')],qs[_0xa453('0x32')](_0x3fe100['query'][_0xa453('0x32')]));_0x500b74[_0xa453('0x31')]=_0x500b74[_0xa453('0x31')]['length']?_0x500b74['attributes']:_0x3cc730[_0xa453('0x2d')];if(_0x3fe100[_0xa453('0x2e')][_0xa453('0x3e')]){_0x500b74[_0xa453('0x3f')]=[{'all':!![]}];}_0x500b74=_['merge']({},_0x500b74,_0x3fe100[_0xa453('0x3d')]);return db[_0xa453('0x29')][_0xa453('0x45')](_0x500b74)['then'](handleEntityNotFound(_0x7f3ba9,null))['then'](respondWithResult(_0x7f3ba9,null))[_0xa453('0x46')](handleError(_0x7f3ba9,null));};exports['create']=function(_0x1f9180,_0x580d78){return db[_0xa453('0x29')][_0xa453('0x47')](_0x1f9180[_0xa453('0x48')],{})[_0xa453('0x22')](respondWithResult(_0x580d78,0xc9))['catch'](handleError(_0x580d78,null));};exports[_0xa453('0x21')]=function(_0x234406,_0x596a84){if(_0x234406[_0xa453('0x48')]['id']){delete _0x234406['body']['id'];}return db[_0xa453('0x29')][_0xa453('0x45')]({'where':{'id':_0x234406[_0xa453('0x43')]['id']}})[_0xa453('0x22')](handleEntityNotFound(_0x596a84,null))[_0xa453('0x22')](saveUpdates(_0x234406['body'],null))['then'](respondWithResult(_0x596a84,null))[_0xa453('0x46')](handleError(_0x596a84,null));};exports['destroy']=function(_0x42d4ba,_0x1f4785){return db[_0xa453('0x29')][_0xa453('0x45')]({'where':{'id':_0x42d4ba['params']['id']}})[_0xa453('0x22')](handleEntityNotFound(_0x1f4785,null))['then'](removeEntity(_0x1f4785,null))[_0xa453('0x46')](handleError(_0x1f4785,null));};exports[_0xa453('0x49')]=function(_0x4c098c,_0x1e88d4,_0xf85e17){var _0x3efe39={};var _0x260a09={};var _0x39e0c2;var _0x3f8775;return db[_0xa453('0x29')][_0xa453('0x4a')]({'where':{'id':_0x4c098c[_0xa453('0x43')]['id']}})[_0xa453('0x22')](handleEntityNotFound(_0x1e88d4,null))[_0xa453('0x22')](function(_0x164cb1){if(_0x164cb1){_0x39e0c2=_0x164cb1;_0x260a09[_0xa453('0x2d')]=_[_0xa453('0x2f')](db['FreshsalesConfiguration'][_0xa453('0x44')]);_0x260a09[_0xa453('0x2e')]=_[_0xa453('0x2f')](_0x4c098c[_0xa453('0x2e')]);_0x260a09['filters']=_[_0xa453('0x30')](_0x260a09[_0xa453('0x2d')],_0x260a09[_0xa453('0x2e')]);_0x3efe39[_0xa453('0x31')]=_['intersection'](_0x260a09[_0xa453('0x2d')],qs[_0xa453('0x32')](_0x4c098c['query']['fields']));_0x3efe39[_0xa453('0x31')]=_0x3efe39[_0xa453('0x31')]['length']?_0x3efe39[_0xa453('0x31')]:_0x260a09['model'];_0x3efe39[_0xa453('0x36')]=qs[_0xa453('0x37')](_0x4c098c[_0xa453('0x2e')]['sort']);_0x3efe39['where']=qs[_0xa453('0x39')](_[_0xa453('0x3a')](_0x4c098c[_0xa453('0x2e')],_0x260a09[_0xa453('0x39')]));if(_0x4c098c[_0xa453('0x2e')]['filter']){_0x3efe39[_0xa453('0x38')]=_[_0xa453('0x3b')](_0x3efe39[_0xa453('0x38')],{'$or':_[_0xa453('0x28')](_0x3efe39[_0xa453('0x31')],function(_0x5c1f5d){var _0x5836d2={};_0x5836d2[_0x5c1f5d]={'$like':'%'+_0x4c098c[_0xa453('0x2e')][_0xa453('0x4b')]+'%'};return _0x5836d2;})});}_0x3efe39=_[_0xa453('0x3b')]({},_0x3efe39,_0x4c098c[_0xa453('0x3d')]);return _0x39e0c2[_0xa453('0x49')](_0x3efe39);}})['then'](function(_0x34ecc9){if(_0x34ecc9){_0x3f8775=_0x34ecc9['length'];if(!_0x4c098c[_0xa453('0x2e')]['hasOwnProperty'](_0xa453('0x35'))){_0x3efe39[_0xa453('0x1d')]=qs['limit'](_0x4c098c[_0xa453('0x2e')]['limit']);_0x3efe39['offset']=qs['offset'](_0x4c098c[_0xa453('0x2e')][_0xa453('0x1b')]);}return _0x39e0c2['getConfigurations'](_0x3efe39);}})[_0xa453('0x22')](function(_0x34d21b){if(_0x34d21b){return _0x34d21b?{'count':_0x3f8775,'rows':_0x34d21b}:null;}})['then'](respondWithResult(_0x1e88d4,null))[_0xa453('0x46')](handleError(_0x1e88d4,null));};exports['addConfiguration']=function(_0x430393,_0x3555fd,_0x554af2){if(_0x430393[_0xa453('0x48')]['id']){delete _0x430393[_0xa453('0x48')]['id'];}return db[_0xa453('0x29')][_0xa453('0x4a')]({'where':{'id':_0x430393['params']['id']}})[_0xa453('0x22')](handleEntityNotFound(_0x3555fd,null))[_0xa453('0x22')](function(_0x6690e0){if(_0x6690e0){_0x430393[_0xa453('0x48')]['AccountId']=_0x6690e0['id'];_0x430393[_0xa453('0x48')]['Subjects']=integrations['getSubjects'](_0x430393['body']['channel'],_0x430393[_0xa453('0x48')][_0xa453('0x2b')]);_0x430393[_0xa453('0x48')][_0xa453('0x4c')]=integrations['getDescriptions'](_0x430393[_0xa453('0x48')][_0xa453('0x4d')],_0x430393[_0xa453('0x48')]['type']);return db[_0xa453('0x4e')][_0xa453('0x47')](_0x430393[_0xa453('0x48')],{'include':[{'model':db['FreshsalesField'],'as':_0xa453('0x4f')},{'model':db[_0xa453('0x50')],'as':'Descriptions'}]});}return null;})[_0xa453('0x22')](respondWithResult(_0x3555fd,null))['catch'](handleError(_0x3555fd,null));};exports[_0xa453('0x51')]=function(_0x3f0884,_0x3a6336,_0x55ede5){var _0x17eb00='';var _0x5432aa='';return db[_0xa453('0x29')][_0xa453('0x4a')]({'where':{'id':_0x3f0884['params']['id']},'attributes':['id',_0xa453('0x52'),_0xa453('0x53'),'apiKey']})['then'](handleEntityNotFound(_0x3a6336,null))['then'](function(_0x3d94e7){if(_0x3d94e7){_0x5432aa=_0x3d94e7[_0xa453('0x52')];_0x17eb00=_0x3d94e7[_0xa453('0x53')];var _0x28a119=_0x3d94e7[_0xa453('0x53')][_0xa453('0x54')](-0x1);if(_0x28a119==='/'){_0x17eb00=_0x17eb00[_0xa453('0x55')](0x0,_0x17eb00['lastIndexOf'](_0x28a119));}return rp({'method':_0xa453('0x56'),'uri':util['format'](_0xa453('0x57'),_0x17eb00,'/api/selector/owners'),'headers':{'Authorization':_0xa453('0x58')+_0x3d94e7[_0xa453('0x59')]},'json':!![]});}})[_0xa453('0x22')](function(_0x147621){if(_0x147621){var _0x532705=_0x147621[_0xa453('0x5a')];var _0x152d6e=![];var _0x3d7066=null;for(_0x3d7066=0x0;_0x3d7066<_0x532705['length'];_0x3d7066++){if(_0x532705[_0x3d7066]['email']===_0x5432aa){_0x152d6e=!![];}}if(_0x152d6e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa453('0x5b')});}}})['then'](respondWithResult(_0x3a6336,null))['catch'](function(_0x4c6932){var _0x1d10b8=_0x3f0884[_0xa453('0x2e')][_0xa453('0x5c')]?0x1f4:_0x4c6932[_0xa453('0x5d')]||0x1f4;logger[_0xa453('0x5e')](_0xa453('0x5f'),'getFields',_0x1d10b8,JSON[_0xa453('0x60')](_0x4c6932));delete _0x4c6932[_0xa453('0x25')];if(_0x1d10b8===0x191){_0x1d10b8=0x190;}_0x3a6336['status'](_0x1d10b8)['send'](_0x3f0884[_0xa453('0x2e')][_0xa453('0x5c')]?{'message':_0xa453('0x61'),'statusCode':_0x4c6932[_0xa453('0x5d')]}:_0x4c6932);});}; \ No newline at end of file +var _0xbe9b=['sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','catch','keys','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','apiKey','users','test','statusCode','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','end'];(function(_0x2a0afd,_0x4224c6){var _0x5c998f=function(_0x5eb695){while(--_0x5eb695){_0x2a0afd['push'](_0x2a0afd['shift']());}};_0x5c998f(++_0x4224c6);}(_0xbe9b,0xfe));var _0xbbe9=function(_0x86777b,_0x3ae3b0){_0x86777b=_0x86777b-0x0;var _0x1f9555=_0xbe9b[_0x86777b];return _0x1f9555;};'use strict';var emlformat=require(_0xbbe9('0x0'));var rimraf=require(_0xbbe9('0x1'));var zipdir=require(_0xbbe9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbbe9('0x3'));var moment=require(_0xbbe9('0x4'));var BPromise=require(_0xbbe9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbbe9('0x6'));var sox=require(_0xbbe9('0x7'));var csv=require(_0xbbe9('0x8'));var ejs=require(_0xbbe9('0x9'));var fs=require('fs');var fs_extra=require(_0xbbe9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbbe9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbbe9('0xc'));var toCsv=require(_0xbbe9('0x8'));var querystring=require(_0xbbe9('0xd'));var Papa=require(_0xbbe9('0xe'));var Redis=require(_0xbbe9('0xf'));var authService=require(_0xbbe9('0x10'));var qs=require(_0xbbe9('0x11'));var as=require(_0xbbe9('0x12'));var hardwareService=require(_0xbbe9('0x13'));var logger=require('../../config/logger')(_0xbbe9('0x14'));var utils=require(_0xbbe9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbbe9('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56c76b,_0x16f86c){_0x16f86c=_0x16f86c||0xcc;return function(_0x834f80){if(_0x834f80){return _0x56c76b['sendStatus'](_0x16f86c);}return _0x56c76b[_0xbbe9('0x17')](_0x16f86c)['end']();};}function respondWithResult(_0x557e3b,_0x15b7cc){_0x15b7cc=_0x15b7cc||0xc8;return function(_0x556ce2){if(_0x556ce2){return _0x557e3b[_0xbbe9('0x17')](_0x15b7cc)['json'](_0x556ce2);}};}function respondWithFilteredResult(_0x249eac,_0x4913bc){return function(_0x28ae8c){if(_0x28ae8c){var _0x578be6=typeof _0x4913bc[_0xbbe9('0x18')]==='undefined'&&typeof _0x4913bc[_0xbbe9('0x19')]===_0xbbe9('0x1a');var _0x47d63b=_0x28ae8c[_0xbbe9('0x1b')];var _0x5e96fd=_0x578be6?0x0:_0x4913bc[_0xbbe9('0x18')];var _0x5dad4d=_0x578be6?_0x28ae8c['count']:_0x4913bc['offset']+_0x4913bc[_0xbbe9('0x19')];var _0x5e897f;if(_0x5dad4d>=_0x47d63b){_0x5dad4d=_0x47d63b;_0x5e897f=0xc8;}else{_0x5e897f=0xce;}_0x249eac[_0xbbe9('0x17')](_0x5e897f);return _0x249eac[_0xbbe9('0x1c')](_0xbbe9('0x1d'),_0x5e96fd+'-'+_0x5dad4d+'/'+_0x47d63b)[_0xbbe9('0x1e')](_0x28ae8c);}return null;};}function patchUpdates(_0xb287d1){return function(_0x9416dc){try{jsonpatch[_0xbbe9('0x1f')](_0x9416dc,_0xb287d1,!![]);}catch(_0x291a59){return BPromise[_0xbbe9('0x20')](_0x291a59);}return _0x9416dc['save']();};}function saveUpdates(_0x4a74b7,_0x183932){return function(_0x255746){if(_0x255746){return _0x255746[_0xbbe9('0x21')](_0x4a74b7)[_0xbbe9('0x22')](function(_0x24dbc1){return _0x24dbc1;});}return null;};}function removeEntity(_0x1f8c2d,_0x3a29ef){return function(_0x3d9ad2){if(_0x3d9ad2){return _0x3d9ad2[_0xbbe9('0x23')]()['then'](function(){_0x1f8c2d[_0xbbe9('0x17')](0xcc)[_0xbbe9('0x24')]();});}};}function handleEntityNotFound(_0x10ca87,_0x10610b){return function(_0x2243ae){if(!_0x2243ae){_0x10ca87[_0xbbe9('0x25')](0x194);}return _0x2243ae;};}function handleError(_0x53add4,_0x3823b6){_0x3823b6=_0x3823b6||0x1f4;return function(_0x65a4a7){logger[_0xbbe9('0x26')](_0x65a4a7['stack']);if(_0x65a4a7['name']){delete _0x65a4a7[_0xbbe9('0x27')];}_0x53add4[_0xbbe9('0x17')](_0x3823b6)[_0xbbe9('0x28')](_0x65a4a7);};}exports[_0xbbe9('0x29')]=function(_0x68d8cb,_0x4568df){var _0x120f77={},_0x4d9b08={},_0x40715a={'count':0x0,'rows':[]};var _0x3bb027=_[_0xbbe9('0x2a')](db['FreshsalesAccount'][_0xbbe9('0x2b')],function(_0x2c4ec9){return{'name':_0x2c4ec9[_0xbbe9('0x2c')],'type':_0x2c4ec9[_0xbbe9('0x2d')][_0xbbe9('0x2e')]};});_0x4d9b08[_0xbbe9('0x2f')]=_[_0xbbe9('0x2a')](_0x3bb027,_0xbbe9('0x27'));_0x4d9b08['query']=_['keys'](_0x68d8cb['query']);_0x4d9b08[_0xbbe9('0x30')]=_[_0xbbe9('0x31')](_0x4d9b08['model'],_0x4d9b08['query']);_0x120f77[_0xbbe9('0x32')]=_['intersection'](_0x4d9b08[_0xbbe9('0x2f')],qs[_0xbbe9('0x33')](_0x68d8cb['query'][_0xbbe9('0x33')]));_0x120f77[_0xbbe9('0x32')]=_0x120f77['attributes'][_0xbbe9('0x34')]?_0x120f77[_0xbbe9('0x32')]:_0x4d9b08[_0xbbe9('0x2f')];if(!_0x68d8cb[_0xbbe9('0x35')][_0xbbe9('0x36')]('nolimit')){_0x120f77[_0xbbe9('0x19')]=qs[_0xbbe9('0x19')](_0x68d8cb[_0xbbe9('0x35')][_0xbbe9('0x19')]);_0x120f77[_0xbbe9('0x18')]=qs[_0xbbe9('0x18')](_0x68d8cb[_0xbbe9('0x35')][_0xbbe9('0x18')]);}_0x120f77[_0xbbe9('0x37')]=qs[_0xbbe9('0x38')](_0x68d8cb[_0xbbe9('0x35')][_0xbbe9('0x38')]);_0x120f77[_0xbbe9('0x39')]=qs['filters'](_['pick'](_0x68d8cb[_0xbbe9('0x35')],_0x4d9b08[_0xbbe9('0x30')]),_0x3bb027);if(_0x68d8cb[_0xbbe9('0x35')][_0xbbe9('0x3a')]){_0x120f77[_0xbbe9('0x39')]=_[_0xbbe9('0x3b')](_0x120f77[_0xbbe9('0x39')],{'$or':_[_0xbbe9('0x2a')](_0x3bb027,function(_0xaa3a9e){if(_0xaa3a9e[_0xbbe9('0x2d')]!==_0xbbe9('0x3c')){var _0x209bc9={};_0x209bc9[_0xaa3a9e[_0xbbe9('0x27')]]={'$like':'%'+_0x68d8cb[_0xbbe9('0x35')][_0xbbe9('0x3a')]+'%'};return _0x209bc9;}})});}_0x120f77=_[_0xbbe9('0x3b')]({},_0x120f77,_0x68d8cb[_0xbbe9('0x3d')]);var _0x455efa={'where':_0x120f77['where']};return db[_0xbbe9('0x3e')]['count'](_0x455efa)[_0xbbe9('0x22')](function(_0x7276a6){_0x40715a[_0xbbe9('0x1b')]=_0x7276a6;if(_0x68d8cb[_0xbbe9('0x35')][_0xbbe9('0x3f')]){_0x120f77[_0xbbe9('0x40')]=[{'all':!![]}];}return db[_0xbbe9('0x3e')][_0xbbe9('0x41')](_0x120f77);})['then'](function(_0x487afa){_0x40715a[_0xbbe9('0x42')]=_0x487afa;return _0x40715a;})[_0xbbe9('0x22')](respondWithFilteredResult(_0x4568df,_0x120f77))[_0xbbe9('0x43')](handleError(_0x4568df,null));};exports['show']=function(_0x219b8a,_0x4bb9c8){var _0x152c85={'raw':![],'where':{'id':_0x219b8a['params']['id']}},_0x45d5ce={};_0x45d5ce[_0xbbe9('0x2f')]=_[_0xbbe9('0x44')](db[_0xbbe9('0x3e')][_0xbbe9('0x2b')]);_0x45d5ce['query']=_['keys'](_0x219b8a[_0xbbe9('0x35')]);_0x45d5ce[_0xbbe9('0x30')]=_['intersection'](_0x45d5ce[_0xbbe9('0x2f')],_0x45d5ce[_0xbbe9('0x35')]);_0x152c85[_0xbbe9('0x32')]=_[_0xbbe9('0x31')](_0x45d5ce[_0xbbe9('0x2f')],qs['fields'](_0x219b8a['query']['fields']));_0x152c85['attributes']=_0x152c85['attributes'][_0xbbe9('0x34')]?_0x152c85[_0xbbe9('0x32')]:_0x45d5ce[_0xbbe9('0x2f')];if(_0x219b8a[_0xbbe9('0x35')][_0xbbe9('0x3f')]){_0x152c85[_0xbbe9('0x40')]=[{'all':!![]}];}_0x152c85=_[_0xbbe9('0x3b')]({},_0x152c85,_0x219b8a[_0xbbe9('0x3d')]);return db['FreshsalesAccount'][_0xbbe9('0x45')](_0x152c85)[_0xbbe9('0x22')](handleEntityNotFound(_0x4bb9c8,null))[_0xbbe9('0x22')](respondWithResult(_0x4bb9c8,null))[_0xbbe9('0x43')](handleError(_0x4bb9c8,null));};exports[_0xbbe9('0x46')]=function(_0x120dc8,_0x13b398){return db[_0xbbe9('0x3e')][_0xbbe9('0x46')](_0x120dc8[_0xbbe9('0x47')],{})[_0xbbe9('0x22')](respondWithResult(_0x13b398,0xc9))[_0xbbe9('0x43')](handleError(_0x13b398,null));};exports[_0xbbe9('0x21')]=function(_0x2f22d,_0x132eed){if(_0x2f22d[_0xbbe9('0x47')]['id']){delete _0x2f22d['body']['id'];}return db[_0xbbe9('0x3e')]['find']({'where':{'id':_0x2f22d[_0xbbe9('0x48')]['id']}})['then'](handleEntityNotFound(_0x132eed,null))[_0xbbe9('0x22')](saveUpdates(_0x2f22d[_0xbbe9('0x47')],null))[_0xbbe9('0x22')](respondWithResult(_0x132eed,null))[_0xbbe9('0x43')](handleError(_0x132eed,null));};exports['destroy']=function(_0x30ce9c,_0x48500d){return db['FreshsalesAccount'][_0xbbe9('0x45')]({'where':{'id':_0x30ce9c['params']['id']}})[_0xbbe9('0x22')](handleEntityNotFound(_0x48500d,null))[_0xbbe9('0x22')](removeEntity(_0x48500d,null))['catch'](handleError(_0x48500d,null));};exports[_0xbbe9('0x49')]=function(_0x575194,_0x24ad35,_0x1c09c8){var _0x50fa4a={};var _0x57de76={};var _0x1d7d4c;var _0x4b333c;return db[_0xbbe9('0x3e')][_0xbbe9('0x4a')]({'where':{'id':_0x575194['params']['id']}})[_0xbbe9('0x22')](handleEntityNotFound(_0x24ad35,null))[_0xbbe9('0x22')](function(_0x2d53b2){if(_0x2d53b2){_0x1d7d4c=_0x2d53b2;_0x57de76[_0xbbe9('0x2f')]=_[_0xbbe9('0x44')](db[_0xbbe9('0x4b')][_0xbbe9('0x2b')]);_0x57de76['query']=_['keys'](_0x575194['query']);_0x57de76['filters']=_['intersection'](_0x57de76[_0xbbe9('0x2f')],_0x57de76['query']);_0x50fa4a[_0xbbe9('0x32')]=_[_0xbbe9('0x31')](_0x57de76[_0xbbe9('0x2f')],qs[_0xbbe9('0x33')](_0x575194['query'][_0xbbe9('0x33')]));_0x50fa4a[_0xbbe9('0x32')]=_0x50fa4a['attributes']['length']?_0x50fa4a['attributes']:_0x57de76['model'];_0x50fa4a['order']=qs[_0xbbe9('0x38')](_0x575194[_0xbbe9('0x35')][_0xbbe9('0x38')]);_0x50fa4a[_0xbbe9('0x39')]=qs['filters'](_[_0xbbe9('0x4c')](_0x575194[_0xbbe9('0x35')],_0x57de76[_0xbbe9('0x30')]));if(_0x575194[_0xbbe9('0x35')][_0xbbe9('0x3a')]){_0x50fa4a[_0xbbe9('0x39')]=_[_0xbbe9('0x3b')](_0x50fa4a[_0xbbe9('0x39')],{'$or':_[_0xbbe9('0x2a')](_0x50fa4a[_0xbbe9('0x32')],function(_0xd7c5a4){var _0x437bac={};_0x437bac[_0xd7c5a4]={'$like':'%'+_0x575194['query'][_0xbbe9('0x3a')]+'%'};return _0x437bac;})});}_0x50fa4a=_['merge']({},_0x50fa4a,_0x575194[_0xbbe9('0x3d')]);return _0x1d7d4c[_0xbbe9('0x49')](_0x50fa4a);}})[_0xbbe9('0x22')](function(_0x1fa54c){if(_0x1fa54c){_0x4b333c=_0x1fa54c[_0xbbe9('0x34')];if(!_0x575194[_0xbbe9('0x35')][_0xbbe9('0x36')](_0xbbe9('0x4d'))){_0x50fa4a[_0xbbe9('0x19')]=qs[_0xbbe9('0x19')](_0x575194[_0xbbe9('0x35')]['limit']);_0x50fa4a[_0xbbe9('0x18')]=qs[_0xbbe9('0x18')](_0x575194[_0xbbe9('0x35')][_0xbbe9('0x18')]);}return _0x1d7d4c[_0xbbe9('0x49')](_0x50fa4a);}})[_0xbbe9('0x22')](function(_0x30357f){if(_0x30357f){return _0x30357f?{'count':_0x4b333c,'rows':_0x30357f}:null;}})[_0xbbe9('0x22')](respondWithResult(_0x24ad35,null))[_0xbbe9('0x43')](handleError(_0x24ad35,null));};exports['addConfiguration']=function(_0x1d9d4b,_0x50b52e,_0x309daa){if(_0x1d9d4b['body']['id']){delete _0x1d9d4b[_0xbbe9('0x47')]['id'];}return db[_0xbbe9('0x3e')][_0xbbe9('0x4a')]({'where':{'id':_0x1d9d4b[_0xbbe9('0x48')]['id']}})[_0xbbe9('0x22')](handleEntityNotFound(_0x50b52e,null))[_0xbbe9('0x22')](function(_0x2484b5){if(_0x2484b5){_0x1d9d4b[_0xbbe9('0x47')][_0xbbe9('0x4e')]=_0x2484b5['id'];_0x1d9d4b[_0xbbe9('0x47')][_0xbbe9('0x4f')]=integrations[_0xbbe9('0x50')](_0x1d9d4b[_0xbbe9('0x47')][_0xbbe9('0x51')],_0x1d9d4b[_0xbbe9('0x47')]['type']);_0x1d9d4b['body'][_0xbbe9('0x52')]=integrations[_0xbbe9('0x53')](_0x1d9d4b[_0xbbe9('0x47')]['channel'],_0x1d9d4b['body'][_0xbbe9('0x2d')]);return db[_0xbbe9('0x4b')][_0xbbe9('0x46')](_0x1d9d4b['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xbbe9('0x4f')},{'model':db['FreshsalesField'],'as':_0xbbe9('0x52')}]});}return null;})['then'](respondWithResult(_0x50b52e,null))['catch'](handleError(_0x50b52e,null));};exports['getFields']=function(_0x1fa429,_0x3c5dd9,_0x11de49){var _0x450b31='';var _0x26425f='';return db[_0xbbe9('0x3e')][_0xbbe9('0x4a')]({'where':{'id':_0x1fa429[_0xbbe9('0x48')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0xbbe9('0x22')](handleEntityNotFound(_0x3c5dd9,null))[_0xbbe9('0x22')](function(_0x16f09c){if(_0x16f09c){_0x26425f=_0x16f09c[_0xbbe9('0x54')];_0x450b31=_0x16f09c[_0xbbe9('0x55')];var _0x1596f2=_0x16f09c[_0xbbe9('0x55')]['slice'](-0x1);if(_0x1596f2==='/'){_0x450b31=_0x450b31[_0xbbe9('0x56')](0x0,_0x450b31[_0xbbe9('0x57')](_0x1596f2));}return rp({'method':_0xbbe9('0x58'),'uri':util[_0xbbe9('0x59')](_0xbbe9('0x5a'),_0x450b31,_0xbbe9('0x5b')),'headers':{'Authorization':'Token\x20token='+_0x16f09c[_0xbbe9('0x5c')]},'json':!![]});}})[_0xbbe9('0x22')](function(_0x2b86c5){if(_0x2b86c5){var _0xbe6fd0=_0x2b86c5[_0xbbe9('0x5d')];var _0x5a638b=![];var _0x1271cb=null;for(_0x1271cb=0x0;_0x1271cb<_0xbe6fd0[_0xbbe9('0x34')];_0x1271cb++){if(_0xbe6fd0[_0x1271cb]['email']===_0x26425f){_0x5a638b=!![];}}if(_0x5a638b){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xbbe9('0x22')](respondWithResult(_0x3c5dd9,null))[_0xbbe9('0x43')](function(_0x8967ef){var _0x2de1b0=_0x1fa429[_0xbbe9('0x35')][_0xbbe9('0x5e')]?0x1f4:_0x8967ef[_0xbbe9('0x5f')]||0x1f4;logger[_0xbbe9('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2de1b0,JSON[_0xbbe9('0x60')](_0x8967ef));delete _0x8967ef['name'];if(_0x2de1b0===0x191){_0x2de1b0=0x190;}_0x3c5dd9[_0xbbe9('0x17')](_0x2de1b0)[_0xbbe9('0x28')](_0x1fa429[_0xbbe9('0x35')][_0xbbe9('0x5e')]?{'message':'Wrong\x20credentials','statusCode':_0x8967ef['statusCode']}:_0x8967ef);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 6564a8c..786af61 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 _0x524e=['define','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1b522e,_0x2be342){var _0xf644f3=function(_0x465498){while(--_0x465498){_0x1b522e['push'](_0x1b522e['shift']());}};_0xf644f3(++_0x2be342);}(_0x524e,0x15e));var _0xe524=function(_0x56617c,_0x401979){_0x56617c=_0x56617c-0x0;var _0x2210af=_0x524e[_0x56617c];return _0x2210af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));var integrations=require(_0xe524('0x9'));module['exports']=function(_0xaaeaa9,_0x41e1a3){return _0xaaeaa9[_0xe524('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xe524('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x153aaf,_0x142f68){var _0x1f8897=function(_0x37f1f6){while(--_0x37f1f6){_0x153aaf['push'](_0x153aaf['shift']());}};_0x1f8897(++_0x142f68);}(_0x524e,0x15e));var _0xe524=function(_0x8eb57f,_0x42f377){_0x8eb57f=_0x8eb57f-0x0;var _0x13c944=_0x524e[_0x8eb57f];return _0x13c944;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));var integrations=require(_0xe524('0x9'));module['exports']=function(_0xaaeaa9,_0x41e1a3){return _0xaaeaa9[_0xe524('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xe524('0xb'),'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 bd70892..fd8f443 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 _0x1a37=['model','then','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0xad9b66,_0x4a6b2c){var _0x3e4c3f=function(_0x24725c){while(--_0x24725c){_0xad9b66['push'](_0xad9b66['shift']());}};_0x3e4c3f(++_0x4a6b2c);}(_0x1a37,0xb4));var _0x71a3=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x1a37[_0x166742];return _0xb7814a;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45050a,_0x231ea7,_0x2bb6a2){return new BPromise(function(_0x4a9ab2,_0x53b893){return client['request'](_0x45050a,_0x2bb6a2)['then'](function(_0x89da86){logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,_0x71a3('0xe'));logger[_0x71a3('0xf')](_0x71a3('0x10'),_0x231ea7,_0x71a3('0xe'),JSON[_0x71a3('0x11')](_0x89da86));if(_0x89da86['error']){if(_0x89da86['error']['code']===0x1f4){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x53b893(_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);}logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x4a9ab2(_0x89da86[_0x71a3('0x12')]['message']);}else{logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,'request\x20sent');_0x4a9ab2(_0x89da86['result'][_0x71a3('0x13')]);}})[_0x71a3('0x14')](function(_0xee797f){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0xee797f);_0x53b893(_0xee797f);});});}exports[_0x71a3('0x15')]=function(_0x5d4dee){var _0x656cd2=this;return new Promise(function(_0x27bfb4,_0x5b955a){return db['FreshsalesAccount'][_0x71a3('0x16')]({'raw':_0x5d4dee[_0x71a3('0x17')]?_0x5d4dee[_0x71a3('0x17')][_0x71a3('0x18')]===undefined?!![]:![]:!![],'where':_0x5d4dee[_0x71a3('0x17')]?_0x5d4dee['options'][_0x71a3('0x19')]||null:null,'attributes':_0x5d4dee[_0x71a3('0x17')]?_0x5d4dee[_0x71a3('0x17')][_0x71a3('0x1a')]||null:null,'limit':_0x5d4dee[_0x71a3('0x17')]?_0x5d4dee['options'][_0x71a3('0x1b')]||null:null,'include':_0x5d4dee['options']?_0x5d4dee[_0x71a3('0x17')][_0x71a3('0x1c')]?_[_0x71a3('0x1d')](_0x5d4dee[_0x71a3('0x17')][_0x71a3('0x1c')],function(_0x2847b4){return{'model':db[_0x2847b4['model']],'as':_0x2847b4['as'],'attributes':_0x2847b4[_0x71a3('0x1a')],'include':_0x2847b4[_0x71a3('0x1c')]?_[_0x71a3('0x1d')](_0x2847b4[_0x71a3('0x1c')],function(_0xb0f3aa){return{'model':db[_0xb0f3aa['model']],'as':_0xb0f3aa['as'],'attributes':_0xb0f3aa[_0x71a3('0x1a')],'include':_0xb0f3aa[_0x71a3('0x1c')]?_['map'](_0xb0f3aa[_0x71a3('0x1c')],function(_0x515519){return{'model':db[_0x515519[_0x71a3('0x1e')]],'as':_0x515519['as'],'attributes':_0x515519[_0x71a3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x71a3('0x1f')](function(_0x35b5c7){logger[_0x71a3('0xc')](_0x71a3('0x15'),_0x5d4dee);logger[_0x71a3('0xf')](_0x71a3('0x15'),_0x5d4dee,JSON[_0x71a3('0x11')](_0x35b5c7));_0x27bfb4(_0x35b5c7);})[_0x71a3('0x14')](function(_0x3ea7aa){logger[_0x71a3('0x12')]('GetFreshsalesAccount',_0x3ea7aa[_0x71a3('0x13')],_0x5d4dee);_0x5b955a(_0x656cd2[_0x71a3('0x12')](0x1f4,_0x3ea7aa[_0x71a3('0x13')]));});});};exports[_0x71a3('0x20')]=function(_0x4a750c){var _0x18a8fe=this;return new Promise(function(_0x216d84,_0x45d13d){return db[_0x71a3('0x21')][_0x71a3('0x22')]({'raw':_0x4a750c[_0x71a3('0x17')]?_0x4a750c[_0x71a3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4a750c[_0x71a3('0x17')]?_0x4a750c[_0x71a3('0x17')][_0x71a3('0x19')]||null:null,'attributes':_0x4a750c[_0x71a3('0x17')]?_0x4a750c[_0x71a3('0x17')][_0x71a3('0x1a')]||null:null,'include':_0x4a750c[_0x71a3('0x17')]?_0x4a750c[_0x71a3('0x17')][_0x71a3('0x1c')]?_[_0x71a3('0x1d')](_0x4a750c[_0x71a3('0x17')][_0x71a3('0x1c')],function(_0x447b14){return{'model':db[_0x447b14['model']],'as':_0x447b14['as'],'attributes':_0x447b14['attributes'],'include':_0x447b14[_0x71a3('0x1c')]?_[_0x71a3('0x1d')](_0x447b14['include'],function(_0x39b28e){return{'model':db[_0x39b28e[_0x71a3('0x1e')]],'as':_0x39b28e['as'],'attributes':_0x39b28e['attributes'],'include':_0x39b28e[_0x71a3('0x1c')]?_[_0x71a3('0x1d')](_0x39b28e[_0x71a3('0x1c')],function(_0x250572){return{'model':db[_0x250572[_0x71a3('0x1e')]],'as':_0x250572['as'],'attributes':_0x250572[_0x71a3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x71a3('0x1f')](function(_0x541840){logger[_0x71a3('0xc')](_0x71a3('0x20'),_0x4a750c);logger[_0x71a3('0xf')]('ShowFreshsalesAccount',_0x4a750c,JSON[_0x71a3('0x11')](_0x541840));_0x216d84(_0x541840);})[_0x71a3('0x14')](function(_0x3dc1de){logger[_0x71a3('0x12')](_0x71a3('0x20'),_0x3dc1de['message'],_0x4a750c);_0x45d13d(_0x18a8fe['error'](0x1f4,_0x3dc1de[_0x71a3('0x13')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')]({'raw':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b8185[_0xf160('0x19')]?_0x4b8185['options'][_0xf160('0x1b')]||null:null,'attributes':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')]['attributes']||null:null,'limit':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1c')]||null:null,'include':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4b8185['options'][_0xf160('0x1d')],function(_0x28bf27){return{'model':db[_0x28bf27[_0xf160('0x1f')]],'as':_0x28bf27['as'],'attributes':_0x28bf27[_0xf160('0x20')],'include':_0x28bf27['include']?_[_0xf160('0x1e')](_0x28bf27[_0xf160('0x1d')],function(_0x4a8003){return{'model':db[_0x4a8003['model']],'as':_0x4a8003['as'],'attributes':_0x4a8003[_0xf160('0x20')],'include':_0x4a8003[_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4a8003['include'],function(_0xcfa9bd){return{'model':db[_0xcfa9bd[_0xf160('0x1f')]],'as':_0xcfa9bd['as'],'attributes':_0xcfa9bd[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x135e0f){logger[_0xf160('0xd')]('GetFreshsalesAccount',_0x4b8185);logger['debug']('GetFreshsalesAccount',_0x4b8185,JSON[_0xf160('0x11')](_0x135e0f));_0x1cf6ba(_0x135e0f);})[_0xf160('0x15')](function(_0xcaab39){logger[_0xf160('0x12')](_0xf160('0x16'),_0xcaab39['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0xcaab39[_0xf160('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4ce478){var _0x22c2e3=this;return new Promise(function(_0x3a35b3,_0x5497f6){return db[_0xf160('0x17')][_0xf160('0x21')]({'raw':_0x4ce478['options']?_0x4ce478['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ce478['options']?_0x4ce478[_0xf160('0x19')][_0xf160('0x1b')]||null:null,'attributes':_0x4ce478[_0xf160('0x19')]?_0x4ce478[_0xf160('0x19')][_0xf160('0x20')]||null:null,'include':_0x4ce478[_0xf160('0x19')]?_0x4ce478['options']['include']?_['map'](_0x4ce478[_0xf160('0x19')]['include'],function(_0x5c65d2){return{'model':db[_0x5c65d2[_0xf160('0x1f')]],'as':_0x5c65d2['as'],'attributes':_0x5c65d2[_0xf160('0x20')],'include':_0x5c65d2['include']?_[_0xf160('0x1e')](_0x5c65d2[_0xf160('0x1d')],function(_0x272efe){return{'model':db[_0x272efe[_0xf160('0x1f')]],'as':_0x272efe['as'],'attributes':_0x272efe[_0xf160('0x20')],'include':_0x272efe['include']?_[_0xf160('0x1e')](_0x272efe[_0xf160('0x1d')],function(_0x15070a){return{'model':db[_0x15070a['model']],'as':_0x15070a['as'],'attributes':_0x15070a[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x1e4bd6){logger[_0xf160('0xd')](_0xf160('0x22'),_0x4ce478);logger[_0xf160('0x23')]('ShowFreshsalesAccount',_0x4ce478,JSON['stringify'](_0x1e4bd6));_0x3a35b3(_0x1e4bd6);})[_0xf160('0x15')](function(_0x21c248){logger[_0xf160('0x12')](_0xf160('0x22'),_0x21c248[_0xf160('0x14')],_0x4ce478);_0x5497f6(_0x22c2e3[_0xf160('0x12')](0x1f4,_0x21c248[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9b07b39..746cef5 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 _0xda4d=['/:id/descriptions','getDescriptions','getFields','post','create','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','getSubjects'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xda4d,0x161));var _0xdda4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xda4d[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xdda4('0x0'));var util=require(_0xdda4('0x1'));var path=require(_0xdda4('0x2'));var timeout=require(_0xdda4('0x3'));var express=require(_0xdda4('0x4'));var router=express[_0xdda4('0x5')]();var fs_extra=require(_0xdda4('0x6'));var auth=require(_0xdda4('0x7'));var interaction=require(_0xdda4('0x8'));var config=require(_0xdda4('0x9'));var controller=require(_0xdda4('0xa'));router[_0xdda4('0xb')]('/',auth[_0xdda4('0xc')](),controller[_0xdda4('0xd')]);router[_0xdda4('0xb')]('/:id',auth[_0xdda4('0xc')](),controller['show']);router[_0xdda4('0xb')]('/:id/subjects',auth[_0xdda4('0xc')](),controller[_0xdda4('0xe')]);router[_0xdda4('0xb')](_0xdda4('0xf'),auth[_0xdda4('0xc')](),controller[_0xdda4('0x10')]);router['get']('/:id/fields',auth[_0xdda4('0xc')](),controller[_0xdda4('0x11')]);router[_0xdda4('0x12')]('/',auth[_0xdda4('0xc')](),controller[_0xdda4('0x13')]);router['put'](_0xdda4('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xdda4('0x15')](_0xdda4('0x14'),auth[_0xdda4('0xc')](),controller[_0xdda4('0x16')]);module['exports']=router; \ No newline at end of file +var _0x10b5=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','get','/:id/fields','getFields','create','put','update','delete','destroy','exports'];(function(_0xca2486,_0x5b2634){var _0x200841=function(_0x19801){while(--_0x19801){_0xca2486['push'](_0xca2486['shift']());}};_0x200841(++_0x5b2634);}(_0x10b5,0x180));var _0x510b=function(_0x50314e,_0x5d52d4){_0x50314e=_0x50314e-0x0;var _0x26def8=_0x10b5[_0x50314e];return _0x26def8;};'use strict';var multer=require(_0x510b('0x0'));var util=require('util');var path=require(_0x510b('0x1'));var timeout=require(_0x510b('0x2'));var express=require(_0x510b('0x3'));var router=express['Router']();var fs_extra=require(_0x510b('0x4'));var auth=require(_0x510b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x510b('0x6'));var controller=require(_0x510b('0x7'));router['get']('/',auth[_0x510b('0x8')](),controller[_0x510b('0x9')]);router['get'](_0x510b('0xa'),auth[_0x510b('0x8')](),controller[_0x510b('0xb')]);router['get']('/:id/subjects',auth[_0x510b('0x8')](),controller[_0x510b('0xc')]);router['get'](_0x510b('0xd'),auth[_0x510b('0x8')](),controller[_0x510b('0xe')]);router[_0x510b('0xf')](_0x510b('0x10'),auth[_0x510b('0x8')](),controller[_0x510b('0x11')]);router['post']('/',auth[_0x510b('0x8')](),controller[_0x510b('0x12')]);router[_0x510b('0x13')]('/:id',auth[_0x510b('0x8')](),controller[_0x510b('0x14')]);router[_0x510b('0x15')](_0x510b('0xa'),auth[_0x510b('0x8')](),controller[_0x510b('0x16')]);module[_0x510b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 98a835b..0332e17 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 _0xadbd=['STRING','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xadbd,0x1e7));var _0xdadb=function(_0x37167e,_0x77ae2c){_0x37167e=_0x37167e-0x0;var _0x48c2cf=_0xadbd[_0x37167e];return _0x48c2cf;};'use strict';var Sequelize=require('sequelize');module[_0xdadb('0x0')]={'name':{'type':Sequelize[_0xdadb('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8e87=['sequelize','STRING'];(function(_0x57c68d,_0x596cf2){var _0x43306f=function(_0x414e91){while(--_0x414e91){_0x57c68d['push'](_0x57c68d['shift']());}};_0x43306f(++_0x596cf2);}(_0x8e87,0xf8));var _0x78e8=function(_0x49b8e2,_0x13a891){_0x49b8e2=_0x49b8e2-0x0;var _0x305a75=_0x8e87[_0x49b8e2];return _0x305a75;};'use strict';var Sequelize=require(_0x78e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x78e8('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6337f04..5535de4 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 _0xc580=['nolimit','getDescriptions','getFields','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','update','then','destroy','end','error','stack','send','index','FreshsalesConfiguration','rawAttributes','fieldName','key','model','map','name','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','FreshsalesField','getSubjects','hasOwnProperty'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xc580,0xa6));var _0x0c58=function(_0x2728bf,_0x3e5a5d){_0x2728bf=_0x2728bf-0x0;var _0x444ec8=_0xc580[_0x2728bf];return _0x444ec8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c58('0x0'));var zipdir=require(_0x0c58('0x1'));var jsonpatch=require(_0x0c58('0x2'));var rp=require(_0x0c58('0x3'));var moment=require(_0x0c58('0x4'));var BPromise=require(_0x0c58('0x5'));var Mustache=require(_0x0c58('0x6'));var util=require(_0x0c58('0x7'));var path=require(_0x0c58('0x8'));var sox=require(_0x0c58('0x9'));var csv=require(_0x0c58('0xa'));var ejs=require(_0x0c58('0xb'));var fs=require('fs');var fs_extra=require(_0x0c58('0xc'));var _=require('lodash');var squel=require(_0x0c58('0xd'));var crypto=require(_0x0c58('0xe'));var jsforce=require(_0x0c58('0xf'));var deskjs=require(_0x0c58('0x10'));var toCsv=require(_0x0c58('0xa'));var querystring=require('querystring');var Papa=require(_0x0c58('0x11'));var Redis=require(_0x0c58('0x12'));var authService=require(_0x0c58('0x13'));var qs=require(_0x0c58('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c58('0x15'))(_0x0c58('0x16'));var utils=require(_0x0c58('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c58('0x18'))['db'];function respondWithStatusCode(_0xbc10d1,_0x5d9149){_0x5d9149=_0x5d9149||0xcc;return function(_0x41aa6a){if(_0x41aa6a){return _0xbc10d1['sendStatus'](_0x5d9149);}return _0xbc10d1[_0x0c58('0x19')](_0x5d9149)['end']();};}function respondWithResult(_0x5ba363,_0x1585f4){_0x1585f4=_0x1585f4||0xc8;return function(_0x3800b4){if(_0x3800b4){return _0x5ba363['status'](_0x1585f4)[_0x0c58('0x1a')](_0x3800b4);}};}function respondWithFilteredResult(_0x10e30d,_0x5c5878){return function(_0x5d7182){if(_0x5d7182){var _0x436d72=typeof _0x5c5878[_0x0c58('0x1b')]===_0x0c58('0x1c')&&typeof _0x5c5878['limit']===_0x0c58('0x1c');var _0x5ab151=_0x5d7182[_0x0c58('0x1d')];var _0x5df5b6=_0x436d72?0x0:_0x5c5878[_0x0c58('0x1b')];var _0x44be9f=_0x436d72?_0x5d7182[_0x0c58('0x1d')]:_0x5c5878[_0x0c58('0x1b')]+_0x5c5878[_0x0c58('0x1e')];var _0x4210e3;if(_0x44be9f>=_0x5ab151){_0x44be9f=_0x5ab151;_0x4210e3=0xc8;}else{_0x4210e3=0xce;}_0x10e30d[_0x0c58('0x19')](_0x4210e3);return _0x10e30d[_0x0c58('0x1f')]('Content-Range',_0x5df5b6+'-'+_0x44be9f+'/'+_0x5ab151)['json'](_0x5d7182);}return null;};}function patchUpdates(_0x437407){return function(_0x516cb8){try{jsonpatch[_0x0c58('0x20')](_0x516cb8,_0x437407,!![]);}catch(_0x30b379){return BPromise['reject'](_0x30b379);}return _0x516cb8['save']();};}function saveUpdates(_0x3b5c9e,_0x2a3f56){return function(_0x368154){if(_0x368154){return _0x368154[_0x0c58('0x21')](_0x3b5c9e)[_0x0c58('0x22')](function(_0xc41a3){return _0xc41a3;});}return null;};}function removeEntity(_0x1931b5,_0x3b7bbb){return function(_0x4f448c){if(_0x4f448c){return _0x4f448c[_0x0c58('0x23')]()[_0x0c58('0x22')](function(){_0x1931b5[_0x0c58('0x19')](0xcc)[_0x0c58('0x24')]();});}};}function handleEntityNotFound(_0x340df8,_0x284642){return function(_0x1038c6){if(!_0x1038c6){_0x340df8['sendStatus'](0x194);}return _0x1038c6;};}function handleError(_0x2163c3,_0xf86ab5){_0xf86ab5=_0xf86ab5||0x1f4;return function(_0x175f4e){logger[_0x0c58('0x25')](_0x175f4e[_0x0c58('0x26')]);if(_0x175f4e['name']){delete _0x175f4e['name'];}_0x2163c3[_0x0c58('0x19')](_0xf86ab5)[_0x0c58('0x27')](_0x175f4e);};}exports[_0x0c58('0x28')]=function(_0x1416a6,_0x4e35d4){var _0x25f118={},_0x4fb189={},_0x1b1146={'count':0x0,'rows':[]};var _0x5b8442=_['map'](db[_0x0c58('0x29')][_0x0c58('0x2a')],function(_0x103611){return{'name':_0x103611[_0x0c58('0x2b')],'type':_0x103611['type'][_0x0c58('0x2c')]};});_0x4fb189[_0x0c58('0x2d')]=_[_0x0c58('0x2e')](_0x5b8442,_0x0c58('0x2f'));_0x4fb189['query']=_[_0x0c58('0x30')](_0x1416a6[_0x0c58('0x31')]);_0x4fb189['filters']=_[_0x0c58('0x32')](_0x4fb189['model'],_0x4fb189['query']);_0x25f118[_0x0c58('0x33')]=_['intersection'](_0x4fb189[_0x0c58('0x2d')],qs[_0x0c58('0x34')](_0x1416a6[_0x0c58('0x31')]['fields']));_0x25f118[_0x0c58('0x33')]=_0x25f118['attributes'][_0x0c58('0x35')]?_0x25f118[_0x0c58('0x33')]:_0x4fb189[_0x0c58('0x2d')];if(!_0x1416a6['query']['hasOwnProperty']('nolimit')){_0x25f118[_0x0c58('0x1e')]=qs[_0x0c58('0x1e')](_0x1416a6[_0x0c58('0x31')][_0x0c58('0x1e')]);_0x25f118[_0x0c58('0x1b')]=qs['offset'](_0x1416a6[_0x0c58('0x31')]['offset']);}_0x25f118[_0x0c58('0x36')]=qs['sort'](_0x1416a6['query'][_0x0c58('0x37')]);_0x25f118[_0x0c58('0x38')]=qs[_0x0c58('0x39')](_[_0x0c58('0x3a')](_0x1416a6[_0x0c58('0x31')],_0x4fb189[_0x0c58('0x39')]),_0x5b8442);if(_0x1416a6['query'][_0x0c58('0x3b')]){_0x25f118[_0x0c58('0x38')]=_[_0x0c58('0x3c')](_0x25f118['where'],{'$or':_[_0x0c58('0x2e')](_0x5b8442,function(_0x25bab5){if(_0x25bab5[_0x0c58('0x3d')]!==_0x0c58('0x3e')){var _0x4d6f80={};_0x4d6f80[_0x25bab5[_0x0c58('0x2f')]]={'$like':'%'+_0x1416a6[_0x0c58('0x31')]['filter']+'%'};return _0x4d6f80;}})});}_0x25f118=_[_0x0c58('0x3c')]({},_0x25f118,_0x1416a6[_0x0c58('0x3f')]);var _0x44b905={'where':_0x25f118[_0x0c58('0x38')]};return db['FreshsalesConfiguration'][_0x0c58('0x1d')](_0x44b905)[_0x0c58('0x22')](function(_0x26ad4f){_0x1b1146[_0x0c58('0x1d')]=_0x26ad4f;if(_0x1416a6[_0x0c58('0x31')][_0x0c58('0x40')]){_0x25f118[_0x0c58('0x41')]=[{'all':!![]}];}return db[_0x0c58('0x29')][_0x0c58('0x42')](_0x25f118);})[_0x0c58('0x22')](function(_0x475462){_0x1b1146[_0x0c58('0x43')]=_0x475462;return _0x1b1146;})['then'](respondWithFilteredResult(_0x4e35d4,_0x25f118))['catch'](handleError(_0x4e35d4,null));};exports[_0x0c58('0x44')]=function(_0x44547f,_0x2daf89){var _0x15f1a6={'raw':![],'where':{'id':_0x44547f[_0x0c58('0x45')]['id']}},_0x37b054={};_0x37b054['model']=_['keys'](db['FreshsalesConfiguration'][_0x0c58('0x2a')]);_0x37b054[_0x0c58('0x31')]=_['keys'](_0x44547f[_0x0c58('0x31')]);_0x37b054['filters']=_[_0x0c58('0x32')](_0x37b054[_0x0c58('0x2d')],_0x37b054[_0x0c58('0x31')]);_0x15f1a6[_0x0c58('0x33')]=_[_0x0c58('0x32')](_0x37b054[_0x0c58('0x2d')],qs[_0x0c58('0x34')](_0x44547f[_0x0c58('0x31')][_0x0c58('0x34')]));_0x15f1a6[_0x0c58('0x33')]=_0x15f1a6['attributes']['length']?_0x15f1a6['attributes']:_0x37b054[_0x0c58('0x2d')];if(_0x44547f[_0x0c58('0x31')][_0x0c58('0x40')]){_0x15f1a6[_0x0c58('0x41')]=[{'all':!![]}];}_0x15f1a6=_['merge']({},_0x15f1a6,_0x44547f[_0x0c58('0x3f')]);return db[_0x0c58('0x29')][_0x0c58('0x46')](_0x15f1a6)[_0x0c58('0x22')](handleEntityNotFound(_0x2daf89,null))[_0x0c58('0x22')](respondWithResult(_0x2daf89,null))['catch'](handleError(_0x2daf89,null));};exports[_0x0c58('0x47')]=function(_0x322817,_0x54ed34){return db['FreshsalesConfiguration']['create'](_0x322817[_0x0c58('0x48')],{})['then'](respondWithResult(_0x54ed34,0xc9))[_0x0c58('0x49')](handleError(_0x54ed34,null));};exports[_0x0c58('0x21')]=function(_0x4f7da5,_0x1078bb){if(_0x4f7da5['body']['id']){delete _0x4f7da5[_0x0c58('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x0c58('0x46')]({'where':{'id':_0x4f7da5[_0x0c58('0x45')]['id']}})['then'](handleEntityNotFound(_0x1078bb,null))[_0x0c58('0x22')](saveUpdates(_0x4f7da5[_0x0c58('0x48')],null))[_0x0c58('0x22')](respondWithResult(_0x1078bb,null))['catch'](handleError(_0x1078bb,null));};exports[_0x0c58('0x23')]=function(_0x150905,_0x250a44){return db[_0x0c58('0x29')][_0x0c58('0x46')]({'where':{'id':_0x150905['params']['id']}})[_0x0c58('0x22')](handleEntityNotFound(_0x250a44,null))[_0x0c58('0x22')](removeEntity(_0x250a44,null))[_0x0c58('0x49')](handleError(_0x250a44,null));};exports['getSubjects']=function(_0x9dd21,_0x460fab,_0x16ae18){var _0x4ab8fd={};var _0x1334d8={};var _0x50692b;var _0x92e6a1;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x9dd21[_0x0c58('0x45')]['id']}})[_0x0c58('0x22')](handleEntityNotFound(_0x460fab,null))[_0x0c58('0x22')](function(_0x1a7600){if(_0x1a7600){_0x50692b=_0x1a7600;_0x1334d8['model']=_[_0x0c58('0x30')](db[_0x0c58('0x4a')][_0x0c58('0x2a')]);_0x1334d8[_0x0c58('0x31')]=_[_0x0c58('0x30')](_0x9dd21[_0x0c58('0x31')]);_0x1334d8[_0x0c58('0x39')]=_[_0x0c58('0x32')](_0x1334d8[_0x0c58('0x2d')],_0x1334d8[_0x0c58('0x31')]);_0x4ab8fd['attributes']=_[_0x0c58('0x32')](_0x1334d8[_0x0c58('0x2d')],qs[_0x0c58('0x34')](_0x9dd21[_0x0c58('0x31')][_0x0c58('0x34')]));_0x4ab8fd['attributes']=_0x4ab8fd[_0x0c58('0x33')][_0x0c58('0x35')]?_0x4ab8fd[_0x0c58('0x33')]:_0x1334d8[_0x0c58('0x2d')];_0x4ab8fd[_0x0c58('0x36')]=qs[_0x0c58('0x37')](_0x9dd21['query'][_0x0c58('0x37')]);_0x4ab8fd[_0x0c58('0x38')]=qs[_0x0c58('0x39')](_[_0x0c58('0x3a')](_0x9dd21[_0x0c58('0x31')],_0x1334d8['filters']));if(_0x9dd21[_0x0c58('0x31')][_0x0c58('0x3b')]){_0x4ab8fd[_0x0c58('0x38')]=_['merge'](_0x4ab8fd['where'],{'$or':_[_0x0c58('0x2e')](_0x4ab8fd['attributes'],function(_0x2693bc){var _0x404cc6={};_0x404cc6[_0x2693bc]={'$like':'%'+_0x9dd21[_0x0c58('0x31')]['filter']+'%'};return _0x404cc6;})});}_0x4ab8fd=_[_0x0c58('0x3c')]({},_0x4ab8fd,_0x9dd21['options']);return _0x50692b[_0x0c58('0x4b')](_0x4ab8fd);}})['then'](function(_0x51ea9b){if(_0x51ea9b){_0x92e6a1=_0x51ea9b[_0x0c58('0x35')];if(!_0x9dd21[_0x0c58('0x31')][_0x0c58('0x4c')](_0x0c58('0x4d'))){_0x4ab8fd[_0x0c58('0x1e')]=qs[_0x0c58('0x1e')](_0x9dd21[_0x0c58('0x31')][_0x0c58('0x1e')]);_0x4ab8fd[_0x0c58('0x1b')]=qs['offset'](_0x9dd21['query'][_0x0c58('0x1b')]);}return _0x50692b[_0x0c58('0x4b')](_0x4ab8fd);}})[_0x0c58('0x22')](function(_0x5b72cc){if(_0x5b72cc){return _0x5b72cc?{'count':_0x92e6a1,'rows':_0x5b72cc}:null;}})[_0x0c58('0x22')](respondWithResult(_0x460fab,null))[_0x0c58('0x49')](handleError(_0x460fab,null));};exports[_0x0c58('0x4e')]=function(_0x43cd9e,_0x3f5bd6,_0x160353){var _0x1bacf4={};var _0x4da433={};var _0x44924e;var _0x5c9a0e;return db[_0x0c58('0x29')]['findOne']({'where':{'id':_0x43cd9e['params']['id']}})[_0x0c58('0x22')](handleEntityNotFound(_0x3f5bd6,null))[_0x0c58('0x22')](function(_0x3e8d5d){if(_0x3e8d5d){_0x44924e=_0x3e8d5d;_0x4da433['model']=_[_0x0c58('0x30')](db[_0x0c58('0x4a')][_0x0c58('0x2a')]);_0x4da433['query']=_[_0x0c58('0x30')](_0x43cd9e[_0x0c58('0x31')]);_0x4da433['filters']=_[_0x0c58('0x32')](_0x4da433[_0x0c58('0x2d')],_0x4da433[_0x0c58('0x31')]);_0x1bacf4[_0x0c58('0x33')]=_[_0x0c58('0x32')](_0x4da433[_0x0c58('0x2d')],qs[_0x0c58('0x34')](_0x43cd9e[_0x0c58('0x31')][_0x0c58('0x34')]));_0x1bacf4[_0x0c58('0x33')]=_0x1bacf4[_0x0c58('0x33')]['length']?_0x1bacf4[_0x0c58('0x33')]:_0x4da433[_0x0c58('0x2d')];_0x1bacf4[_0x0c58('0x36')]=qs[_0x0c58('0x37')](_0x43cd9e[_0x0c58('0x31')]['sort']);_0x1bacf4[_0x0c58('0x38')]=qs[_0x0c58('0x39')](_[_0x0c58('0x3a')](_0x43cd9e[_0x0c58('0x31')],_0x4da433['filters']));if(_0x43cd9e[_0x0c58('0x31')][_0x0c58('0x3b')]){_0x1bacf4[_0x0c58('0x38')]=_[_0x0c58('0x3c')](_0x1bacf4['where'],{'$or':_['map'](_0x1bacf4[_0x0c58('0x33')],function(_0x26395c){var _0x4b543b={};_0x4b543b[_0x26395c]={'$like':'%'+_0x43cd9e['query'][_0x0c58('0x3b')]+'%'};return _0x4b543b;})});}_0x1bacf4=_[_0x0c58('0x3c')]({},_0x1bacf4,_0x43cd9e[_0x0c58('0x3f')]);return _0x44924e[_0x0c58('0x4e')](_0x1bacf4);}})[_0x0c58('0x22')](function(_0x483a00){if(_0x483a00){_0x5c9a0e=_0x483a00[_0x0c58('0x35')];if(!_0x43cd9e[_0x0c58('0x31')][_0x0c58('0x4c')](_0x0c58('0x4d'))){_0x1bacf4[_0x0c58('0x1e')]=qs[_0x0c58('0x1e')](_0x43cd9e['query'][_0x0c58('0x1e')]);_0x1bacf4[_0x0c58('0x1b')]=qs[_0x0c58('0x1b')](_0x43cd9e[_0x0c58('0x31')]['offset']);}return _0x44924e[_0x0c58('0x4e')](_0x1bacf4);}})[_0x0c58('0x22')](function(_0x2e9681){if(_0x2e9681){return _0x2e9681?{'count':_0x5c9a0e,'rows':_0x2e9681}:null;}})[_0x0c58('0x22')](respondWithResult(_0x3f5bd6,null))[_0x0c58('0x49')](handleError(_0x3f5bd6,null));};exports[_0x0c58('0x4f')]=function(_0x2503e4,_0x1a1825,_0xced058){var _0x28e546={};var _0x212626={};var _0xf5f605;var _0x59365e;return db['FreshsalesConfiguration'][_0x0c58('0x50')]({'where':{'id':_0x2503e4[_0x0c58('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a1825,null))['then'](function(_0x218c4a){if(_0x218c4a){_0xf5f605=_0x218c4a;_0x212626[_0x0c58('0x2d')]=_[_0x0c58('0x30')](db[_0x0c58('0x4a')][_0x0c58('0x2a')]);_0x212626[_0x0c58('0x31')]=_['keys'](_0x2503e4[_0x0c58('0x31')]);_0x212626[_0x0c58('0x39')]=_['intersection'](_0x212626[_0x0c58('0x2d')],_0x212626[_0x0c58('0x31')]);_0x28e546['attributes']=_[_0x0c58('0x32')](_0x212626[_0x0c58('0x2d')],qs[_0x0c58('0x34')](_0x2503e4['query']['fields']));_0x28e546[_0x0c58('0x33')]=_0x28e546[_0x0c58('0x33')][_0x0c58('0x35')]?_0x28e546[_0x0c58('0x33')]:_0x212626[_0x0c58('0x2d')];_0x28e546['order']=qs[_0x0c58('0x37')](_0x2503e4[_0x0c58('0x31')][_0x0c58('0x37')]);_0x28e546[_0x0c58('0x38')]=qs[_0x0c58('0x39')](_[_0x0c58('0x3a')](_0x2503e4['query'],_0x212626[_0x0c58('0x39')]));if(_0x2503e4['query'][_0x0c58('0x3b')]){_0x28e546['where']=_[_0x0c58('0x3c')](_0x28e546[_0x0c58('0x38')],{'$or':_['map'](_0x28e546[_0x0c58('0x33')],function(_0xda7727){var _0x332fad={};_0x332fad[_0xda7727]={'$like':'%'+_0x2503e4['query'][_0x0c58('0x3b')]+'%'};return _0x332fad;})});}_0x28e546=_[_0x0c58('0x3c')]({},_0x28e546,_0x2503e4[_0x0c58('0x3f')]);return _0xf5f605['getFields'](_0x28e546);}})[_0x0c58('0x22')](function(_0x181344){if(_0x181344){_0x59365e=_0x181344[_0x0c58('0x35')];if(!_0x2503e4[_0x0c58('0x31')][_0x0c58('0x4c')](_0x0c58('0x4d'))){_0x28e546[_0x0c58('0x1e')]=qs[_0x0c58('0x1e')](_0x2503e4[_0x0c58('0x31')][_0x0c58('0x1e')]);_0x28e546['offset']=qs[_0x0c58('0x1b')](_0x2503e4[_0x0c58('0x31')]['offset']);}return _0xf5f605[_0x0c58('0x4f')](_0x28e546);}})[_0x0c58('0x22')](function(_0x5e2918){if(_0x5e2918){return _0x5e2918?{'count':_0x59365e,'rows':_0x5e2918}:null;}})[_0x0c58('0x22')](respondWithResult(_0x1a1825,null))[_0x0c58('0x49')](handleError(_0x1a1825,null));}; \ No newline at end of file +var _0x23cf=['status','end','offset','undefined','limit','count','set','json','save','update','destroy','then','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','include','rows','catch','params','create','body','find','getSubjects','findOne','pick','nolimit','FreshsalesField','getDescriptions','getFields','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x9035ea,_0x58b74a){var _0x21a866=function(_0x336df2){while(--_0x336df2){_0x9035ea['push'](_0x9035ea['shift']());}};_0x21a866(++_0x58b74a);}(_0x23cf,0x14d));var _0xf23c=function(_0x398b24,_0x177061){_0x398b24=_0x398b24-0x0;var _0x462c8f=_0x23cf[_0x398b24];return _0x462c8f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf23c('0x0'));var rp=require('request-promise');var moment=require(_0xf23c('0x1'));var BPromise=require(_0xf23c('0x2'));var Mustache=require(_0xf23c('0x3'));var util=require(_0xf23c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xf23c('0x5'));var ejs=require(_0xf23c('0x6'));var fs=require('fs');var fs_extra=require(_0xf23c('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf23c('0x8'));var jsforce=require(_0xf23c('0x9'));var deskjs=require(_0xf23c('0xa'));var toCsv=require(_0xf23c('0x5'));var querystring=require(_0xf23c('0xb'));var Papa=require(_0xf23c('0xc'));var Redis=require(_0xf23c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf23c('0xe'));var as=require(_0xf23c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf23c('0x10'))('api');var utils=require(_0xf23c('0x11'));var config=require(_0xf23c('0x12'));var licenseUtil=require(_0xf23c('0x13'));var db=require(_0xf23c('0x14'))['db'];function respondWithStatusCode(_0x2b2361,_0x453a28){_0x453a28=_0x453a28||0xcc;return function(_0x3d6efe){if(_0x3d6efe){return _0x2b2361[_0xf23c('0x15')](_0x453a28);}return _0x2b2361[_0xf23c('0x16')](_0x453a28)[_0xf23c('0x17')]();};}function respondWithResult(_0x1b0571,_0x75d4d9){_0x75d4d9=_0x75d4d9||0xc8;return function(_0x4bf355){if(_0x4bf355){return _0x1b0571[_0xf23c('0x16')](_0x75d4d9)['json'](_0x4bf355);}};}function respondWithFilteredResult(_0x1695d8,_0xd31695){return function(_0x3f4331){if(_0x3f4331){var _0x504717=typeof _0xd31695[_0xf23c('0x18')]===_0xf23c('0x19')&&typeof _0xd31695[_0xf23c('0x1a')]===_0xf23c('0x19');var _0x277288=_0x3f4331[_0xf23c('0x1b')];var _0x59eb85=_0x504717?0x0:_0xd31695[_0xf23c('0x18')];var _0x497a0d=_0x504717?_0x3f4331[_0xf23c('0x1b')]:_0xd31695[_0xf23c('0x18')]+_0xd31695[_0xf23c('0x1a')];var _0x3e7704;if(_0x497a0d>=_0x277288){_0x497a0d=_0x277288;_0x3e7704=0xc8;}else{_0x3e7704=0xce;}_0x1695d8['status'](_0x3e7704);return _0x1695d8[_0xf23c('0x1c')]('Content-Range',_0x59eb85+'-'+_0x497a0d+'/'+_0x277288)[_0xf23c('0x1d')](_0x3f4331);}return null;};}function patchUpdates(_0x4b6540){return function(_0x99ddf9){try{jsonpatch['apply'](_0x99ddf9,_0x4b6540,!![]);}catch(_0x521cd4){return BPromise['reject'](_0x521cd4);}return _0x99ddf9[_0xf23c('0x1e')]();};}function saveUpdates(_0x2a504d,_0x4b65b5){return function(_0x57686b){if(_0x57686b){return _0x57686b[_0xf23c('0x1f')](_0x2a504d)['then'](function(_0x3bc398){return _0x3bc398;});}return null;};}function removeEntity(_0x12ef2b,_0x495e7e){return function(_0x4dae1f){if(_0x4dae1f){return _0x4dae1f[_0xf23c('0x20')]()[_0xf23c('0x21')](function(){_0x12ef2b[_0xf23c('0x16')](0xcc)[_0xf23c('0x17')]();});}};}function handleEntityNotFound(_0x50f444,_0x113777){return function(_0x5abd8f){if(!_0x5abd8f){_0x50f444['sendStatus'](0x194);}return _0x5abd8f;};}function handleError(_0x248639,_0x10146d){_0x10146d=_0x10146d||0x1f4;return function(_0x340400){logger['error'](_0x340400[_0xf23c('0x22')]);if(_0x340400[_0xf23c('0x23')]){delete _0x340400[_0xf23c('0x23')];}_0x248639[_0xf23c('0x16')](_0x10146d)[_0xf23c('0x24')](_0x340400);};}exports[_0xf23c('0x25')]=function(_0x252b94,_0x45135b){var _0x18ea8f={},_0x1ab958={},_0x37cc8e={'count':0x0,'rows':[]};var _0x113432=_[_0xf23c('0x26')](db[_0xf23c('0x27')][_0xf23c('0x28')],function(_0x1d7543){return{'name':_0x1d7543['fieldName'],'type':_0x1d7543[_0xf23c('0x29')]['key']};});_0x1ab958['model']=_[_0xf23c('0x26')](_0x113432,'name');_0x1ab958[_0xf23c('0x2a')]=_[_0xf23c('0x2b')](_0x252b94[_0xf23c('0x2a')]);_0x1ab958[_0xf23c('0x2c')]=_['intersection'](_0x1ab958[_0xf23c('0x2d')],_0x1ab958[_0xf23c('0x2a')]);_0x18ea8f[_0xf23c('0x2e')]=_[_0xf23c('0x2f')](_0x1ab958[_0xf23c('0x2d')],qs[_0xf23c('0x30')](_0x252b94['query'][_0xf23c('0x30')]));_0x18ea8f[_0xf23c('0x2e')]=_0x18ea8f[_0xf23c('0x2e')][_0xf23c('0x31')]?_0x18ea8f[_0xf23c('0x2e')]:_0x1ab958[_0xf23c('0x2d')];if(!_0x252b94['query'][_0xf23c('0x32')]('nolimit')){_0x18ea8f['limit']=qs[_0xf23c('0x1a')](_0x252b94[_0xf23c('0x2a')]['limit']);_0x18ea8f['offset']=qs[_0xf23c('0x18')](_0x252b94[_0xf23c('0x2a')]['offset']);}_0x18ea8f[_0xf23c('0x33')]=qs[_0xf23c('0x34')](_0x252b94[_0xf23c('0x2a')]['sort']);_0x18ea8f[_0xf23c('0x35')]=qs[_0xf23c('0x2c')](_['pick'](_0x252b94[_0xf23c('0x2a')],_0x1ab958['filters']),_0x113432);if(_0x252b94[_0xf23c('0x2a')]['filter']){_0x18ea8f[_0xf23c('0x35')]=_[_0xf23c('0x36')](_0x18ea8f[_0xf23c('0x35')],{'$or':_[_0xf23c('0x26')](_0x113432,function(_0x1b02a1){if(_0x1b02a1[_0xf23c('0x29')]!=='VIRTUAL'){var _0x439eba={};_0x439eba[_0x1b02a1[_0xf23c('0x23')]]={'$like':'%'+_0x252b94[_0xf23c('0x2a')][_0xf23c('0x37')]+'%'};return _0x439eba;}})});}_0x18ea8f=_[_0xf23c('0x36')]({},_0x18ea8f,_0x252b94[_0xf23c('0x38')]);var _0xf04c64={'where':_0x18ea8f[_0xf23c('0x35')]};return db[_0xf23c('0x27')][_0xf23c('0x1b')](_0xf04c64)[_0xf23c('0x21')](function(_0x1e26b0){_0x37cc8e[_0xf23c('0x1b')]=_0x1e26b0;if(_0x252b94[_0xf23c('0x2a')]['includeAll']){_0x18ea8f[_0xf23c('0x39')]=[{'all':!![]}];}return db[_0xf23c('0x27')]['findAll'](_0x18ea8f);})[_0xf23c('0x21')](function(_0x5a91bc){_0x37cc8e[_0xf23c('0x3a')]=_0x5a91bc;return _0x37cc8e;})[_0xf23c('0x21')](respondWithFilteredResult(_0x45135b,_0x18ea8f))[_0xf23c('0x3b')](handleError(_0x45135b,null));};exports['show']=function(_0x173bc2,_0x1a71f9){var _0x7c3753={'raw':![],'where':{'id':_0x173bc2[_0xf23c('0x3c')]['id']}},_0x54582d={};_0x54582d[_0xf23c('0x2d')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x54582d[_0xf23c('0x2a')]=_[_0xf23c('0x2b')](_0x173bc2['query']);_0x54582d[_0xf23c('0x2c')]=_['intersection'](_0x54582d[_0xf23c('0x2d')],_0x54582d[_0xf23c('0x2a')]);_0x7c3753[_0xf23c('0x2e')]=_['intersection'](_0x54582d[_0xf23c('0x2d')],qs[_0xf23c('0x30')](_0x173bc2[_0xf23c('0x2a')][_0xf23c('0x30')]));_0x7c3753[_0xf23c('0x2e')]=_0x7c3753['attributes']['length']?_0x7c3753[_0xf23c('0x2e')]:_0x54582d[_0xf23c('0x2d')];if(_0x173bc2['query']['includeAll']){_0x7c3753[_0xf23c('0x39')]=[{'all':!![]}];}_0x7c3753=_[_0xf23c('0x36')]({},_0x7c3753,_0x173bc2[_0xf23c('0x38')]);return db['FreshsalesConfiguration']['find'](_0x7c3753)['then'](handleEntityNotFound(_0x1a71f9,null))['then'](respondWithResult(_0x1a71f9,null))[_0xf23c('0x3b')](handleError(_0x1a71f9,null));};exports[_0xf23c('0x3d')]=function(_0x235b97,_0x42b100){return db[_0xf23c('0x27')][_0xf23c('0x3d')](_0x235b97[_0xf23c('0x3e')],{})['then'](respondWithResult(_0x42b100,0xc9))[_0xf23c('0x3b')](handleError(_0x42b100,null));};exports[_0xf23c('0x1f')]=function(_0x511165,_0x6c1471){if(_0x511165['body']['id']){delete _0x511165[_0xf23c('0x3e')]['id'];}return db[_0xf23c('0x27')][_0xf23c('0x3f')]({'where':{'id':_0x511165[_0xf23c('0x3c')]['id']}})[_0xf23c('0x21')](handleEntityNotFound(_0x6c1471,null))[_0xf23c('0x21')](saveUpdates(_0x511165[_0xf23c('0x3e')],null))[_0xf23c('0x21')](respondWithResult(_0x6c1471,null))[_0xf23c('0x3b')](handleError(_0x6c1471,null));};exports['destroy']=function(_0x589e5a,_0x3f8aea){return db[_0xf23c('0x27')]['find']({'where':{'id':_0x589e5a[_0xf23c('0x3c')]['id']}})[_0xf23c('0x21')](handleEntityNotFound(_0x3f8aea,null))[_0xf23c('0x21')](removeEntity(_0x3f8aea,null))['catch'](handleError(_0x3f8aea,null));};exports[_0xf23c('0x40')]=function(_0x187ac6,_0x5c4a4c,_0x51bc5e){var _0x13038c={};var _0x3014e9={};var _0x4ce286;var _0x44441d;return db[_0xf23c('0x27')][_0xf23c('0x41')]({'where':{'id':_0x187ac6[_0xf23c('0x3c')]['id']}})[_0xf23c('0x21')](handleEntityNotFound(_0x5c4a4c,null))[_0xf23c('0x21')](function(_0x421336){if(_0x421336){_0x4ce286=_0x421336;_0x3014e9[_0xf23c('0x2d')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x3014e9[_0xf23c('0x2a')]=_[_0xf23c('0x2b')](_0x187ac6[_0xf23c('0x2a')]);_0x3014e9[_0xf23c('0x2c')]=_['intersection'](_0x3014e9[_0xf23c('0x2d')],_0x3014e9[_0xf23c('0x2a')]);_0x13038c['attributes']=_[_0xf23c('0x2f')](_0x3014e9['model'],qs[_0xf23c('0x30')](_0x187ac6[_0xf23c('0x2a')][_0xf23c('0x30')]));_0x13038c[_0xf23c('0x2e')]=_0x13038c[_0xf23c('0x2e')][_0xf23c('0x31')]?_0x13038c['attributes']:_0x3014e9[_0xf23c('0x2d')];_0x13038c[_0xf23c('0x33')]=qs['sort'](_0x187ac6['query'][_0xf23c('0x34')]);_0x13038c[_0xf23c('0x35')]=qs[_0xf23c('0x2c')](_[_0xf23c('0x42')](_0x187ac6[_0xf23c('0x2a')],_0x3014e9[_0xf23c('0x2c')]));if(_0x187ac6['query']['filter']){_0x13038c[_0xf23c('0x35')]=_[_0xf23c('0x36')](_0x13038c[_0xf23c('0x35')],{'$or':_[_0xf23c('0x26')](_0x13038c[_0xf23c('0x2e')],function(_0x179446){var _0x10658a={};_0x10658a[_0x179446]={'$like':'%'+_0x187ac6[_0xf23c('0x2a')][_0xf23c('0x37')]+'%'};return _0x10658a;})});}_0x13038c=_['merge']({},_0x13038c,_0x187ac6['options']);return _0x4ce286[_0xf23c('0x40')](_0x13038c);}})['then'](function(_0x5452ef){if(_0x5452ef){_0x44441d=_0x5452ef[_0xf23c('0x31')];if(!_0x187ac6[_0xf23c('0x2a')][_0xf23c('0x32')](_0xf23c('0x43'))){_0x13038c['limit']=qs[_0xf23c('0x1a')](_0x187ac6[_0xf23c('0x2a')]['limit']);_0x13038c['offset']=qs[_0xf23c('0x18')](_0x187ac6[_0xf23c('0x2a')]['offset']);}return _0x4ce286[_0xf23c('0x40')](_0x13038c);}})[_0xf23c('0x21')](function(_0x308afa){if(_0x308afa){return _0x308afa?{'count':_0x44441d,'rows':_0x308afa}:null;}})[_0xf23c('0x21')](respondWithResult(_0x5c4a4c,null))['catch'](handleError(_0x5c4a4c,null));};exports['getDescriptions']=function(_0x36ee77,_0xee620e,_0x3d13c0){var _0x2e81a1={};var _0x59bcf6={};var _0x5f0a79;var _0x178571;return db[_0xf23c('0x27')][_0xf23c('0x41')]({'where':{'id':_0x36ee77[_0xf23c('0x3c')]['id']}})[_0xf23c('0x21')](handleEntityNotFound(_0xee620e,null))['then'](function(_0x1158e6){if(_0x1158e6){_0x5f0a79=_0x1158e6;_0x59bcf6['model']=_[_0xf23c('0x2b')](db[_0xf23c('0x44')][_0xf23c('0x28')]);_0x59bcf6[_0xf23c('0x2a')]=_[_0xf23c('0x2b')](_0x36ee77[_0xf23c('0x2a')]);_0x59bcf6['filters']=_[_0xf23c('0x2f')](_0x59bcf6['model'],_0x59bcf6[_0xf23c('0x2a')]);_0x2e81a1[_0xf23c('0x2e')]=_[_0xf23c('0x2f')](_0x59bcf6['model'],qs[_0xf23c('0x30')](_0x36ee77[_0xf23c('0x2a')][_0xf23c('0x30')]));_0x2e81a1[_0xf23c('0x2e')]=_0x2e81a1[_0xf23c('0x2e')][_0xf23c('0x31')]?_0x2e81a1[_0xf23c('0x2e')]:_0x59bcf6[_0xf23c('0x2d')];_0x2e81a1[_0xf23c('0x33')]=qs[_0xf23c('0x34')](_0x36ee77[_0xf23c('0x2a')][_0xf23c('0x34')]);_0x2e81a1['where']=qs[_0xf23c('0x2c')](_[_0xf23c('0x42')](_0x36ee77[_0xf23c('0x2a')],_0x59bcf6['filters']));if(_0x36ee77['query'][_0xf23c('0x37')]){_0x2e81a1[_0xf23c('0x35')]=_['merge'](_0x2e81a1[_0xf23c('0x35')],{'$or':_[_0xf23c('0x26')](_0x2e81a1['attributes'],function(_0x80adf1){var _0x3b748f={};_0x3b748f[_0x80adf1]={'$like':'%'+_0x36ee77[_0xf23c('0x2a')][_0xf23c('0x37')]+'%'};return _0x3b748f;})});}_0x2e81a1=_['merge']({},_0x2e81a1,_0x36ee77['options']);return _0x5f0a79[_0xf23c('0x45')](_0x2e81a1);}})[_0xf23c('0x21')](function(_0x155eda){if(_0x155eda){_0x178571=_0x155eda[_0xf23c('0x31')];if(!_0x36ee77[_0xf23c('0x2a')][_0xf23c('0x32')]('nolimit')){_0x2e81a1[_0xf23c('0x1a')]=qs[_0xf23c('0x1a')](_0x36ee77[_0xf23c('0x2a')][_0xf23c('0x1a')]);_0x2e81a1[_0xf23c('0x18')]=qs[_0xf23c('0x18')](_0x36ee77[_0xf23c('0x2a')]['offset']);}return _0x5f0a79[_0xf23c('0x45')](_0x2e81a1);}})['then'](function(_0x3879f8){if(_0x3879f8){return _0x3879f8?{'count':_0x178571,'rows':_0x3879f8}:null;}})[_0xf23c('0x21')](respondWithResult(_0xee620e,null))[_0xf23c('0x3b')](handleError(_0xee620e,null));};exports[_0xf23c('0x46')]=function(_0x2e1b81,_0x4e45e0,_0xe30f18){var _0x150608={};var _0x435ecb={};var _0x43fe8f;var _0x167846;return db[_0xf23c('0x27')][_0xf23c('0x41')]({'where':{'id':_0x2e1b81[_0xf23c('0x3c')]['id']}})[_0xf23c('0x21')](handleEntityNotFound(_0x4e45e0,null))[_0xf23c('0x21')](function(_0x2e409a){if(_0x2e409a){_0x43fe8f=_0x2e409a;_0x435ecb[_0xf23c('0x2d')]=_[_0xf23c('0x2b')](db['FreshsalesField']['rawAttributes']);_0x435ecb[_0xf23c('0x2a')]=_[_0xf23c('0x2b')](_0x2e1b81['query']);_0x435ecb[_0xf23c('0x2c')]=_[_0xf23c('0x2f')](_0x435ecb['model'],_0x435ecb[_0xf23c('0x2a')]);_0x150608['attributes']=_[_0xf23c('0x2f')](_0x435ecb['model'],qs[_0xf23c('0x30')](_0x2e1b81[_0xf23c('0x2a')]['fields']));_0x150608[_0xf23c('0x2e')]=_0x150608['attributes'][_0xf23c('0x31')]?_0x150608[_0xf23c('0x2e')]:_0x435ecb['model'];_0x150608[_0xf23c('0x33')]=qs[_0xf23c('0x34')](_0x2e1b81[_0xf23c('0x2a')]['sort']);_0x150608[_0xf23c('0x35')]=qs[_0xf23c('0x2c')](_[_0xf23c('0x42')](_0x2e1b81[_0xf23c('0x2a')],_0x435ecb[_0xf23c('0x2c')]));if(_0x2e1b81[_0xf23c('0x2a')][_0xf23c('0x37')]){_0x150608[_0xf23c('0x35')]=_[_0xf23c('0x36')](_0x150608[_0xf23c('0x35')],{'$or':_[_0xf23c('0x26')](_0x150608[_0xf23c('0x2e')],function(_0x38d545){var _0x3d5d62={};_0x3d5d62[_0x38d545]={'$like':'%'+_0x2e1b81[_0xf23c('0x2a')][_0xf23c('0x37')]+'%'};return _0x3d5d62;})});}_0x150608=_[_0xf23c('0x36')]({},_0x150608,_0x2e1b81['options']);return _0x43fe8f[_0xf23c('0x46')](_0x150608);}})[_0xf23c('0x21')](function(_0x44ac93){if(_0x44ac93){_0x167846=_0x44ac93[_0xf23c('0x31')];if(!_0x2e1b81['query'][_0xf23c('0x32')](_0xf23c('0x43'))){_0x150608['limit']=qs[_0xf23c('0x1a')](_0x2e1b81[_0xf23c('0x2a')]['limit']);_0x150608['offset']=qs[_0xf23c('0x18')](_0x2e1b81[_0xf23c('0x2a')][_0xf23c('0x18')]);}return _0x43fe8f[_0xf23c('0x46')](_0x150608);}})[_0xf23c('0x21')](function(_0x4649ce){if(_0x4649ce){return _0x4649ce?{'count':_0x167846,'rows':_0x4649ce}:null;}})[_0xf23c('0x21')](respondWithResult(_0x4e45e0,null))[_0xf23c('0x3b')](handleError(_0x4e45e0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 26628c9..e62dd6a 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 _0x7a77=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x56be45,_0x10cd0e){var _0x1b75d3=function(_0x314616){while(--_0x314616){_0x56be45['push'](_0x56be45['shift']());}};_0x1b75d3(++_0x10cd0e);}(_0x7a77,0xb0));var _0x77a7=function(_0x596e1c,_0x4aa6f1){_0x596e1c=_0x596e1c-0x0;var _0x41da21=_0x7a77[_0x596e1c];return _0x41da21;};'use strict';var _=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var logger=require('../../config/logger')(_0x77a7('0x2'));var moment=require(_0x77a7('0x3'));var BPromise=require(_0x77a7('0x4'));var rp=require(_0x77a7('0x5'));var fs=require('fs');var path=require(_0x77a7('0x6'));var rimraf=require(_0x77a7('0x7'));var config=require(_0x77a7('0x8'));var attributes=require(_0x77a7('0x9'));module[_0x77a7('0xa')]=function(_0x57872c,_0x2d26e5){return _0x57872c[_0x77a7('0xb')](_0x77a7('0xc'),attributes,{'tableName':_0x77a7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9c4=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes'];(function(_0x5a8a6f,_0x47160f){var _0xba2897=function(_0x3757b7){while(--_0x3757b7){_0x5a8a6f['push'](_0x5a8a6f['shift']());}};_0xba2897(++_0x47160f);}(_0xe9c4,0x100));var _0x4e9c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe9c4[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x4e9c('0x0'));var util=require(_0x4e9c('0x1'));var logger=require(_0x4e9c('0x2'))(_0x4e9c('0x3'));var moment=require('moment');var BPromise=require(_0x4e9c('0x4'));var rp=require(_0x4e9c('0x5'));var fs=require('fs');var path=require(_0x4e9c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e9c('0x7'));module[_0x4e9c('0x8')]=function(_0x31844f,_0xc71c7f){return _0x31844f[_0x4e9c('0x9')](_0x4e9c('0xa'),attributes,{'tableName':_0x4e9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 4186d3f..4b388ca 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 _0xc7d1=['catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3adb19,_0x153747){var _0x1ea3ab=function(_0x78bc05){while(--_0x78bc05){_0x3adb19['push'](_0x3adb19['shift']());}};_0x1ea3ab(++_0x153747);}(_0xc7d1,0xc7));var _0x1c7d=function(_0x5c9955,_0x23144f){_0x5c9955=_0x5c9955-0x0;var _0x584229=_0xc7d1[_0x5c9955];return _0x584229;};'use strict';var _=require(_0x1c7d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c7d('0x1'));var db=require(_0x1c7d('0x2'))['db'];var utils=require(_0x1c7d('0x3'));var logger=require(_0x1c7d('0x4'))(_0x1c7d('0x5'));var config=require('../../config/environment');var jayson=require(_0x1c7d('0x6'));var client=jayson[_0x1c7d('0x7')][_0x1c7d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52b559,_0x3a3133,_0x2140eb){return new BPromise(function(_0x59ee00,_0x3a891d){return client[_0x1c7d('0x9')](_0x52b559,_0x2140eb)[_0x1c7d('0xa')](function(_0x5d100c){logger[_0x1c7d('0xb')](_0x1c7d('0xc'),_0x3a3133,_0x1c7d('0xd'));logger[_0x1c7d('0xe')](_0x1c7d('0xf'),_0x3a3133,'request\x20sent',JSON[_0x1c7d('0x10')](_0x5d100c));if(_0x5d100c[_0x1c7d('0x11')]){if(_0x5d100c[_0x1c7d('0x11')][_0x1c7d('0x12')]===0x1f4){logger[_0x1c7d('0x11')](_0x1c7d('0xc'),_0x3a3133,_0x5d100c['error'][_0x1c7d('0x13')]);return _0x3a891d(_0x5d100c[_0x1c7d('0x11')][_0x1c7d('0x13')]);}logger[_0x1c7d('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a3133,_0x5d100c[_0x1c7d('0x11')][_0x1c7d('0x13')]);return _0x59ee00(_0x5d100c[_0x1c7d('0x11')]['message']);}else{logger[_0x1c7d('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a3133,'request\x20sent');_0x59ee00(_0x5d100c[_0x1c7d('0x14')][_0x1c7d('0x13')]);}})[_0x1c7d('0x15')](function(_0x41e659){logger[_0x1c7d('0x11')](_0x1c7d('0xc'),_0x3a3133,_0x41e659);_0x3a891d(_0x41e659);});});} \ No newline at end of file +var _0xcdb5=['error','message','result','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcdb5,0xd4));var _0x5cdb=function(_0x366195,_0x50da84){_0x366195=_0x366195-0x0;var _0xf37646=_0xcdb5[_0x366195];return _0xf37646;};'use strict';var _=require(_0x5cdb('0x0'));var util=require(_0x5cdb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cdb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cdb('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5cdb('0x4'));var config=require(_0x5cdb('0x5'));var jayson=require(_0x5cdb('0x6'));var client=jayson['client'][_0x5cdb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a0418,_0x78a466,_0x1fba28){return new BPromise(function(_0x54e089,_0xf9f2da){return client[_0x5cdb('0x8')](_0x1a0418,_0x1fba28)[_0x5cdb('0x9')](function(_0x248b03){logger[_0x5cdb('0xa')](_0x5cdb('0xb'),_0x78a466,_0x5cdb('0xc'));logger[_0x5cdb('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x78a466,_0x5cdb('0xc'),JSON[_0x5cdb('0xe')](_0x248b03));if(_0x248b03['error']){if(_0x248b03['error'][_0x5cdb('0xf')]===0x1f4){logger[_0x5cdb('0x10')](_0x5cdb('0xb'),_0x78a466,_0x248b03[_0x5cdb('0x10')][_0x5cdb('0x11')]);return _0xf9f2da(_0x248b03[_0x5cdb('0x10')]['message']);}logger[_0x5cdb('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x78a466,_0x248b03[_0x5cdb('0x10')][_0x5cdb('0x11')]);return _0x54e089(_0x248b03[_0x5cdb('0x10')][_0x5cdb('0x11')]);}else{logger[_0x5cdb('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x78a466,_0x5cdb('0xc'));_0x54e089(_0x248b03[_0x5cdb('0x12')][_0x5cdb('0x11')]);}})['catch'](function(_0x1a333d){logger[_0x5cdb('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x78a466,_0x1a333d);_0xf9f2da(_0x1a333d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 30e577b..c5e3864 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcffe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x39d0b8,_0x2991bd){var _0x2e525f=function(_0x34f3b1){while(--_0x34f3b1){_0x39d0b8['push'](_0x39d0b8['shift']());}};_0x2e525f(++_0x2991bd);}(_0xcffe,0x1a1));var _0xecff=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xcffe[_0x25d386];return _0x857f4a;};'use strict';var multer=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var path=require(_0xecff('0x2'));var timeout=require(_0xecff('0x3'));var express=require(_0xecff('0x4'));var router=express[_0xecff('0x5')]();var fs_extra=require(_0xecff('0x6'));var auth=require(_0xecff('0x7'));var interaction=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xecff('0xa')](),controller[_0xecff('0xb')]);router[_0xecff('0xc')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0xe')]);router[_0xecff('0xf')]('/',auth['isAuthenticated'](),controller[_0xecff('0x10')]);router[_0xecff('0x11')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x12')]);router['delete'](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x13')]);module[_0xecff('0x14')]=router; \ No newline at end of file +var _0x58e5=['util','path','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesField.controller','isAuthenticated','get','/:id','put','update','delete','exports','multer'];(function(_0x4b5815,_0x44fb95){var _0x58634a=function(_0x5565ce){while(--_0x5565ce){_0x4b5815['push'](_0x4b5815['shift']());}};_0x58634a(++_0x44fb95);}(_0x58e5,0xd1));var _0x558e=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x58e5[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0x558e('0x0'));var util=require(_0x558e('0x1'));var path=require(_0x558e('0x2'));var timeout=require(_0x558e('0x3'));var express=require(_0x558e('0x4'));var router=express[_0x558e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x558e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x558e('0x7'));router['get']('/',auth[_0x558e('0x8')](),controller['index']);router[_0x558e('0x9')](_0x558e('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x558e('0xb')](_0x558e('0xa'),auth['isAuthenticated'](),controller[_0x558e('0xc')]);router[_0x558e('0xd')](_0x558e('0xa'),auth[_0x558e('0x8')](),controller['destroy']);module[_0x558e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 01f9971..d230d52 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 _0x4a62=['STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x23d50e,_0x378059){var _0x1ce88f=function(_0x33ea5b){while(--_0x33ea5b){_0x23d50e['push'](_0x23d50e['shift']());}};_0x1ce88f(++_0x378059);}(_0x4a62,0x1ac));var _0x24a6=function(_0x30a961,_0x610bb7){_0x30a961=_0x30a961-0x0;var _0xa01d7a=_0x4a62[_0x30a961];return _0xa01d7a;};'use strict';var Sequelize=require(_0x24a6('0x0'));module['exports']={'type':{'type':Sequelize[_0x24a6('0x1')](_0x24a6('0x2'),_0x24a6('0x3'),_0x24a6('0x4'),_0x24a6('0x5'),'picklist'),'defaultValue':_0x24a6('0x2')},'content':{'type':Sequelize[_0x24a6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x24a6('0x1')](_0x24a6('0x2'),_0x24a6('0x3'),_0x24a6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x24a6('0x6')]},'nameField':{'type':Sequelize[_0x24a6('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa80b=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2a9ba8,_0x54b284){var _0x168b9e=function(_0x2e8ce5){while(--_0x2e8ce5){_0x2a9ba8['push'](_0x2a9ba8['shift']());}};_0x168b9e(++_0x54b284);}(_0xa80b,0xa0));var _0xba80=function(_0x41aa4d,_0x51e45f){_0x41aa4d=_0x41aa4d-0x0;var _0x3fb7d6=_0xa80b[_0x41aa4d];return _0x3fb7d6;};'use strict';var Sequelize=require(_0xba80('0x0'));module[_0xba80('0x1')]={'type':{'type':Sequelize[_0xba80('0x2')](_0xba80('0x3'),_0xba80('0x4'),_0xba80('0x5'),_0xba80('0x6'),_0xba80('0x7')),'defaultValue':_0xba80('0x3')},'content':{'type':Sequelize[_0xba80('0x8')]},'key':{'type':Sequelize[_0xba80('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xba80('0x3'),_0xba80('0x4'),_0xba80('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xba80('0x8')]},'customField':{'type':Sequelize[_0xba80('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba80('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ab74c4e..a0859c8 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 _0x8e25=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','save','then','error','stack','name','send','index','map','FreshsalesField','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4ad58e,_0x5d7105){var _0x39d83c=function(_0x367258){while(--_0x367258){_0x4ad58e['push'](_0x4ad58e['shift']());}};_0x39d83c(++_0x5d7105);}(_0x8e25,0xc3));var _0x58e2=function(_0x1690ca,_0x55f2a0){_0x1690ca=_0x1690ca-0x0;var _0x3da951=_0x8e25[_0x1690ca];return _0x3da951;};'use strict';var emlformat=require(_0x58e2('0x0'));var rimraf=require(_0x58e2('0x1'));var zipdir=require(_0x58e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x58e2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x58e2('0x4'));var util=require(_0x58e2('0x5'));var path=require(_0x58e2('0x6'));var sox=require(_0x58e2('0x7'));var csv=require(_0x58e2('0x8'));var ejs=require(_0x58e2('0x9'));var fs=require('fs');var fs_extra=require(_0x58e2('0xa'));var _=require('lodash');var squel=require(_0x58e2('0xb'));var crypto=require('crypto');var jsforce=require(_0x58e2('0xc'));var deskjs=require(_0x58e2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x58e2('0xe'));var Papa=require(_0x58e2('0xf'));var Redis=require(_0x58e2('0x10'));var authService=require(_0x58e2('0x11'));var qs=require(_0x58e2('0x12'));var as=require(_0x58e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x58e2('0x14'));var utils=require(_0x58e2('0x15'));var config=require(_0x58e2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec246,_0x4ea36d){_0x4ea36d=_0x4ea36d||0xcc;return function(_0x366a94){if(_0x366a94){return _0x5ec246[_0x58e2('0x17')](_0x4ea36d);}return _0x5ec246[_0x58e2('0x18')](_0x4ea36d)[_0x58e2('0x19')]();};}function respondWithResult(_0x180192,_0x260398){_0x260398=_0x260398||0xc8;return function(_0x4980fa){if(_0x4980fa){return _0x180192[_0x58e2('0x18')](_0x260398)[_0x58e2('0x1a')](_0x4980fa);}};}function respondWithFilteredResult(_0x56454f,_0x1b7b0b){return function(_0x124236){if(_0x124236){var _0x2bfdb8=typeof _0x1b7b0b['offset']==='undefined'&&typeof _0x1b7b0b[_0x58e2('0x1b')]===_0x58e2('0x1c');var _0x598f86=_0x124236['count'];var _0xe8f4e1=_0x2bfdb8?0x0:_0x1b7b0b[_0x58e2('0x1d')];var _0x5dde12=_0x2bfdb8?_0x124236[_0x58e2('0x1e')]:_0x1b7b0b['offset']+_0x1b7b0b[_0x58e2('0x1b')];var _0x180665;if(_0x5dde12>=_0x598f86){_0x5dde12=_0x598f86;_0x180665=0xc8;}else{_0x180665=0xce;}_0x56454f[_0x58e2('0x18')](_0x180665);return _0x56454f[_0x58e2('0x1f')](_0x58e2('0x20'),_0xe8f4e1+'-'+_0x5dde12+'/'+_0x598f86)[_0x58e2('0x1a')](_0x124236);}return null;};}function patchUpdates(_0x542908){return function(_0x19c288){try{jsonpatch['apply'](_0x19c288,_0x542908,!![]);}catch(_0x35c9ac){return BPromise['reject'](_0x35c9ac);}return _0x19c288[_0x58e2('0x21')]();};}function saveUpdates(_0x11a6f1,_0x295b3f){return function(_0x50390a){if(_0x50390a){return _0x50390a['update'](_0x11a6f1)[_0x58e2('0x22')](function(_0x1f21b8){return _0x1f21b8;});}return null;};}function removeEntity(_0x30f737,_0x5dad2d){return function(_0x2e1993){if(_0x2e1993){return _0x2e1993['destroy']()[_0x58e2('0x22')](function(){_0x30f737['status'](0xcc)[_0x58e2('0x19')]();});}};}function handleEntityNotFound(_0x5a9ed5,_0x5679ee){return function(_0x4d2f33){if(!_0x4d2f33){_0x5a9ed5[_0x58e2('0x17')](0x194);}return _0x4d2f33;};}function handleError(_0x33a9e1,_0x22891e){_0x22891e=_0x22891e||0x1f4;return function(_0x274270){logger[_0x58e2('0x23')](_0x274270[_0x58e2('0x24')]);if(_0x274270[_0x58e2('0x25')]){delete _0x274270[_0x58e2('0x25')];}_0x33a9e1['status'](_0x22891e)[_0x58e2('0x26')](_0x274270);};}exports[_0x58e2('0x27')]=function(_0x177231,_0x5a12b5){var _0x3f5ef2={},_0x3c4306={},_0x109c27={'count':0x0,'rows':[]};var _0x2e25d3=_[_0x58e2('0x28')](db[_0x58e2('0x29')]['rawAttributes'],function(_0x54e02f){return{'name':_0x54e02f[_0x58e2('0x2a')],'type':_0x54e02f[_0x58e2('0x2b')]['key']};});_0x3c4306[_0x58e2('0x2c')]=_[_0x58e2('0x28')](_0x2e25d3,_0x58e2('0x25'));_0x3c4306['query']=_['keys'](_0x177231[_0x58e2('0x2d')]);_0x3c4306[_0x58e2('0x2e')]=_[_0x58e2('0x2f')](_0x3c4306[_0x58e2('0x2c')],_0x3c4306['query']);_0x3f5ef2['attributes']=_[_0x58e2('0x2f')](_0x3c4306[_0x58e2('0x2c')],qs[_0x58e2('0x30')](_0x177231[_0x58e2('0x2d')]['fields']));_0x3f5ef2[_0x58e2('0x31')]=_0x3f5ef2[_0x58e2('0x31')]['length']?_0x3f5ef2['attributes']:_0x3c4306['model'];if(!_0x177231[_0x58e2('0x2d')][_0x58e2('0x32')](_0x58e2('0x33'))){_0x3f5ef2[_0x58e2('0x1b')]=qs[_0x58e2('0x1b')](_0x177231[_0x58e2('0x2d')][_0x58e2('0x1b')]);_0x3f5ef2[_0x58e2('0x1d')]=qs[_0x58e2('0x1d')](_0x177231['query'][_0x58e2('0x1d')]);}_0x3f5ef2['order']=qs[_0x58e2('0x34')](_0x177231[_0x58e2('0x2d')][_0x58e2('0x34')]);_0x3f5ef2['where']=qs[_0x58e2('0x2e')](_['pick'](_0x177231[_0x58e2('0x2d')],_0x3c4306[_0x58e2('0x2e')]),_0x2e25d3);if(_0x177231[_0x58e2('0x2d')][_0x58e2('0x35')]){_0x3f5ef2[_0x58e2('0x36')]=_[_0x58e2('0x37')](_0x3f5ef2[_0x58e2('0x36')],{'$or':_[_0x58e2('0x28')](_0x2e25d3,function(_0x370e96){if(_0x370e96[_0x58e2('0x2b')]!==_0x58e2('0x38')){var _0x58fe8e={};_0x58fe8e[_0x370e96[_0x58e2('0x25')]]={'$like':'%'+_0x177231[_0x58e2('0x2d')][_0x58e2('0x35')]+'%'};return _0x58fe8e;}})});}_0x3f5ef2=_['merge']({},_0x3f5ef2,_0x177231['options']);var _0x2615be={'where':_0x3f5ef2['where']};return db[_0x58e2('0x29')][_0x58e2('0x1e')](_0x2615be)[_0x58e2('0x22')](function(_0x13d6d1){_0x109c27[_0x58e2('0x1e')]=_0x13d6d1;if(_0x177231[_0x58e2('0x2d')][_0x58e2('0x39')]){_0x3f5ef2[_0x58e2('0x3a')]=[{'all':!![]}];}return db['FreshsalesField'][_0x58e2('0x3b')](_0x3f5ef2);})['then'](function(_0x59eb6e){_0x109c27['rows']=_0x59eb6e;return _0x109c27;})['then'](respondWithFilteredResult(_0x5a12b5,_0x3f5ef2))['catch'](handleError(_0x5a12b5,null));};exports[_0x58e2('0x3c')]=function(_0x210151,_0x48e61a){var _0x2e0d21={'raw':!![],'where':{'id':_0x210151[_0x58e2('0x3d')]['id']}},_0x5a4b72={};_0x5a4b72[_0x58e2('0x2c')]=_[_0x58e2('0x3e')](db['FreshsalesField'][_0x58e2('0x3f')]);_0x5a4b72[_0x58e2('0x2d')]=_[_0x58e2('0x3e')](_0x210151['query']);_0x5a4b72['filters']=_[_0x58e2('0x2f')](_0x5a4b72[_0x58e2('0x2c')],_0x5a4b72[_0x58e2('0x2d')]);_0x2e0d21[_0x58e2('0x31')]=_['intersection'](_0x5a4b72['model'],qs['fields'](_0x210151['query'][_0x58e2('0x30')]));_0x2e0d21[_0x58e2('0x31')]=_0x2e0d21[_0x58e2('0x31')]['length']?_0x2e0d21[_0x58e2('0x31')]:_0x5a4b72['model'];if(_0x210151[_0x58e2('0x2d')]['includeAll']){_0x2e0d21[_0x58e2('0x3a')]=[{'all':!![]}];}_0x2e0d21=_[_0x58e2('0x37')]({},_0x2e0d21,_0x210151[_0x58e2('0x40')]);return db[_0x58e2('0x29')][_0x58e2('0x41')](_0x2e0d21)[_0x58e2('0x22')](handleEntityNotFound(_0x48e61a,null))[_0x58e2('0x22')](respondWithResult(_0x48e61a,null))[_0x58e2('0x42')](handleError(_0x48e61a,null));};exports[_0x58e2('0x43')]=function(_0x204660,_0x4cd1af){return db[_0x58e2('0x29')][_0x58e2('0x43')](_0x204660[_0x58e2('0x44')],{})[_0x58e2('0x22')](respondWithResult(_0x4cd1af,0xc9))[_0x58e2('0x42')](handleError(_0x4cd1af,null));};exports[_0x58e2('0x45')]=function(_0x449e5e,_0x594a39){if(_0x449e5e['body']['id']){delete _0x449e5e['body']['id'];}return db['FreshsalesField'][_0x58e2('0x41')]({'where':{'id':_0x449e5e[_0x58e2('0x3d')]['id']}})[_0x58e2('0x22')](handleEntityNotFound(_0x594a39,null))[_0x58e2('0x22')](saveUpdates(_0x449e5e[_0x58e2('0x44')],null))['then'](respondWithResult(_0x594a39,null))[_0x58e2('0x42')](handleError(_0x594a39,null));};exports[_0x58e2('0x46')]=function(_0x4d4830,_0x4cfcb1){return db[_0x58e2('0x29')][_0x58e2('0x41')]({'where':{'id':_0x4d4830[_0x58e2('0x3d')]['id']}})[_0x58e2('0x22')](handleEntityNotFound(_0x4cfcb1,null))[_0x58e2('0x22')](removeEntity(_0x4cfcb1,null))[_0x58e2('0x42')](handleError(_0x4cfcb1,null));}; \ No newline at end of file +var _0xf02e=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','end','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','then','includeAll','include','findAll','catch','show','params','options','find','create','body','update','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x2c78df,_0x20abba){var _0x50912=function(_0x5aa161){while(--_0x5aa161){_0x2c78df['push'](_0x2c78df['shift']());}};_0x50912(++_0x20abba);}(_0xf02e,0x85));var _0xef02=function(_0x9ac284,_0x388945){_0x9ac284=_0x9ac284-0x0;var _0x42fdb9=_0xf02e[_0x9ac284];return _0x42fdb9;};'use strict';var emlformat=require(_0xef02('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef02('0x1'));var jsonpatch=require(_0xef02('0x2'));var rp=require(_0xef02('0x3'));var moment=require(_0xef02('0x4'));var BPromise=require(_0xef02('0x5'));var Mustache=require('mustache');var util=require(_0xef02('0x6'));var path=require(_0xef02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef02('0x8'));var _=require(_0xef02('0x9'));var squel=require(_0xef02('0xa'));var crypto=require('crypto');var jsforce=require(_0xef02('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef02('0xc'));var Papa=require('papaparse');var Redis=require(_0xef02('0xd'));var authService=require(_0xef02('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xef02('0xf'));var hardwareService=require(_0xef02('0x10'));var logger=require(_0xef02('0x11'))(_0xef02('0x12'));var utils=require(_0xef02('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xef02('0x14'));var db=require(_0xef02('0x15'))['db'];function respondWithStatusCode(_0x1af44e,_0x40a8b5){_0x40a8b5=_0x40a8b5||0xcc;return function(_0x15f6d3){if(_0x15f6d3){return _0x1af44e['sendStatus'](_0x40a8b5);}return _0x1af44e[_0xef02('0x16')](_0x40a8b5)['end']();};}function respondWithResult(_0x556d79,_0x2d4419){_0x2d4419=_0x2d4419||0xc8;return function(_0x5b82cd){if(_0x5b82cd){return _0x556d79[_0xef02('0x16')](_0x2d4419)[_0xef02('0x17')](_0x5b82cd);}};}function respondWithFilteredResult(_0xd2d342,_0xec397b){return function(_0x372b42){if(_0x372b42){var _0x5accb8=typeof _0xec397b[_0xef02('0x18')]===_0xef02('0x19')&&typeof _0xec397b[_0xef02('0x1a')]==='undefined';var _0x112f8b=_0x372b42['count'];var _0x3a5650=_0x5accb8?0x0:_0xec397b[_0xef02('0x18')];var _0x1388ff=_0x5accb8?_0x372b42[_0xef02('0x1b')]:_0xec397b[_0xef02('0x18')]+_0xec397b[_0xef02('0x1a')];var _0x21036c;if(_0x1388ff>=_0x112f8b){_0x1388ff=_0x112f8b;_0x21036c=0xc8;}else{_0x21036c=0xce;}_0xd2d342['status'](_0x21036c);return _0xd2d342['set'](_0xef02('0x1c'),_0x3a5650+'-'+_0x1388ff+'/'+_0x112f8b)[_0xef02('0x17')](_0x372b42);}return null;};}function patchUpdates(_0x137cbf){return function(_0x3a0e5e){try{jsonpatch['apply'](_0x3a0e5e,_0x137cbf,!![]);}catch(_0x4a7a62){return BPromise[_0xef02('0x1d')](_0x4a7a62);}return _0x3a0e5e[_0xef02('0x1e')]();};}function saveUpdates(_0x4cd907,_0x1c3f5d){return function(_0x481baa){if(_0x481baa){return _0x481baa['update'](_0x4cd907)['then'](function(_0x157702){return _0x157702;});}return null;};}function removeEntity(_0x15563b,_0x160906){return function(_0x352c8c){if(_0x352c8c){return _0x352c8c['destroy']()['then'](function(){_0x15563b[_0xef02('0x16')](0xcc)[_0xef02('0x1f')]();});}};}function handleEntityNotFound(_0x1c7b07,_0x112998){return function(_0x37eb97){if(!_0x37eb97){_0x1c7b07[_0xef02('0x20')](0x194);}return _0x37eb97;};}function handleError(_0x37a5ea,_0x16872b){_0x16872b=_0x16872b||0x1f4;return function(_0x3a334c){logger[_0xef02('0x21')](_0x3a334c[_0xef02('0x22')]);if(_0x3a334c[_0xef02('0x23')]){delete _0x3a334c[_0xef02('0x23')];}_0x37a5ea[_0xef02('0x16')](_0x16872b)[_0xef02('0x24')](_0x3a334c);};}exports[_0xef02('0x25')]=function(_0x12dddc,_0x24f71c){var _0x2e4a7b={},_0x420b73={},_0x96dc1c={'count':0x0,'rows':[]};var _0x122bdb=_[_0xef02('0x26')](db[_0xef02('0x27')][_0xef02('0x28')],function(_0xb0009a){return{'name':_0xb0009a[_0xef02('0x29')],'type':_0xb0009a[_0xef02('0x2a')][_0xef02('0x2b')]};});_0x420b73[_0xef02('0x2c')]=_[_0xef02('0x26')](_0x122bdb,_0xef02('0x23'));_0x420b73['query']=_[_0xef02('0x2d')](_0x12dddc['query']);_0x420b73[_0xef02('0x2e')]=_[_0xef02('0x2f')](_0x420b73[_0xef02('0x2c')],_0x420b73[_0xef02('0x30')]);_0x2e4a7b[_0xef02('0x31')]=_[_0xef02('0x2f')](_0x420b73[_0xef02('0x2c')],qs['fields'](_0x12dddc[_0xef02('0x30')][_0xef02('0x32')]));_0x2e4a7b[_0xef02('0x31')]=_0x2e4a7b[_0xef02('0x31')][_0xef02('0x33')]?_0x2e4a7b[_0xef02('0x31')]:_0x420b73[_0xef02('0x2c')];if(!_0x12dddc['query'][_0xef02('0x34')]('nolimit')){_0x2e4a7b[_0xef02('0x1a')]=qs[_0xef02('0x1a')](_0x12dddc[_0xef02('0x30')][_0xef02('0x1a')]);_0x2e4a7b[_0xef02('0x18')]=qs[_0xef02('0x18')](_0x12dddc['query'][_0xef02('0x18')]);}_0x2e4a7b[_0xef02('0x35')]=qs['sort'](_0x12dddc[_0xef02('0x30')][_0xef02('0x36')]);_0x2e4a7b[_0xef02('0x37')]=qs[_0xef02('0x2e')](_[_0xef02('0x38')](_0x12dddc[_0xef02('0x30')],_0x420b73[_0xef02('0x2e')]),_0x122bdb);if(_0x12dddc['query'][_0xef02('0x39')]){_0x2e4a7b[_0xef02('0x37')]=_['merge'](_0x2e4a7b[_0xef02('0x37')],{'$or':_[_0xef02('0x26')](_0x122bdb,function(_0x49cec0){if(_0x49cec0[_0xef02('0x2a')]!==_0xef02('0x3a')){var _0x1e8eb8={};_0x1e8eb8[_0x49cec0[_0xef02('0x23')]]={'$like':'%'+_0x12dddc[_0xef02('0x30')][_0xef02('0x39')]+'%'};return _0x1e8eb8;}})});}_0x2e4a7b=_[_0xef02('0x3b')]({},_0x2e4a7b,_0x12dddc['options']);var _0x2bb6f7={'where':_0x2e4a7b[_0xef02('0x37')]};return db[_0xef02('0x27')][_0xef02('0x1b')](_0x2bb6f7)[_0xef02('0x3c')](function(_0xca89b6){_0x96dc1c['count']=_0xca89b6;if(_0x12dddc[_0xef02('0x30')][_0xef02('0x3d')]){_0x2e4a7b[_0xef02('0x3e')]=[{'all':!![]}];}return db[_0xef02('0x27')][_0xef02('0x3f')](_0x2e4a7b);})[_0xef02('0x3c')](function(_0x5eab35){_0x96dc1c['rows']=_0x5eab35;return _0x96dc1c;})[_0xef02('0x3c')](respondWithFilteredResult(_0x24f71c,_0x2e4a7b))[_0xef02('0x40')](handleError(_0x24f71c,null));};exports[_0xef02('0x41')]=function(_0x2d96fd,_0x5066f3){var _0x1bed38={'raw':!![],'where':{'id':_0x2d96fd[_0xef02('0x42')]['id']}},_0x8c9fc0={};_0x8c9fc0['model']=_['keys'](db['FreshsalesField'][_0xef02('0x28')]);_0x8c9fc0[_0xef02('0x30')]=_['keys'](_0x2d96fd[_0xef02('0x30')]);_0x8c9fc0[_0xef02('0x2e')]=_[_0xef02('0x2f')](_0x8c9fc0[_0xef02('0x2c')],_0x8c9fc0[_0xef02('0x30')]);_0x1bed38[_0xef02('0x31')]=_[_0xef02('0x2f')](_0x8c9fc0[_0xef02('0x2c')],qs['fields'](_0x2d96fd['query']['fields']));_0x1bed38['attributes']=_0x1bed38[_0xef02('0x31')][_0xef02('0x33')]?_0x1bed38['attributes']:_0x8c9fc0[_0xef02('0x2c')];if(_0x2d96fd['query'][_0xef02('0x3d')]){_0x1bed38[_0xef02('0x3e')]=[{'all':!![]}];}_0x1bed38=_[_0xef02('0x3b')]({},_0x1bed38,_0x2d96fd[_0xef02('0x43')]);return db[_0xef02('0x27')][_0xef02('0x44')](_0x1bed38)['then'](handleEntityNotFound(_0x5066f3,null))['then'](respondWithResult(_0x5066f3,null))[_0xef02('0x40')](handleError(_0x5066f3,null));};exports[_0xef02('0x45')]=function(_0x314b35,_0x466fc4){return db['FreshsalesField'][_0xef02('0x45')](_0x314b35[_0xef02('0x46')],{})[_0xef02('0x3c')](respondWithResult(_0x466fc4,0xc9))[_0xef02('0x40')](handleError(_0x466fc4,null));};exports[_0xef02('0x47')]=function(_0x515d0a,_0x128643){if(_0x515d0a[_0xef02('0x46')]['id']){delete _0x515d0a['body']['id'];}return db[_0xef02('0x27')]['find']({'where':{'id':_0x515d0a['params']['id']}})['then'](handleEntityNotFound(_0x128643,null))['then'](saveUpdates(_0x515d0a[_0xef02('0x46')],null))[_0xef02('0x3c')](respondWithResult(_0x128643,null))[_0xef02('0x40')](handleError(_0x128643,null));};exports[_0xef02('0x48')]=function(_0x5b0e63,_0x5ebd37){return db[_0xef02('0x27')][_0xef02('0x44')]({'where':{'id':_0x5b0e63['params']['id']}})[_0xef02('0x3c')](handleEntityNotFound(_0x5ebd37,null))[_0xef02('0x3c')](removeEntity(_0x5ebd37,null))[_0xef02('0x40')](handleError(_0x5ebd37,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 11afc2f..9b3cd92 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 _0xbcae=['path','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2d6d7b,_0x183ff8){var _0x4372c5=function(_0x2a8715){while(--_0x2a8715){_0x2d6d7b['push'](_0x2d6d7b['shift']());}};_0x4372c5(++_0x183ff8);}(_0xbcae,0xa9));var _0xebca=function(_0x9264d,_0x4391a5){_0x9264d=_0x9264d-0x0;var _0x565280=_0xbcae[_0x9264d];return _0x565280;};'use strict';var _=require(_0xebca('0x0'));var util=require(_0xebca('0x1'));var logger=require(_0xebca('0x2'))(_0xebca('0x3'));var moment=require(_0xebca('0x4'));var BPromise=require(_0xebca('0x5'));var rp=require(_0xebca('0x6'));var fs=require('fs');var path=require(_0xebca('0x7'));var rimraf=require(_0xebca('0x8'));var config=require(_0xebca('0x9'));var attributes=require('./intFreshsalesField.attributes');module[_0xebca('0xa')]=function(_0x149c78,_0x585ff6){return _0x149c78[_0xebca('0xb')](_0xebca('0xc'),attributes,{'tableName':_0xebca('0xd'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xebca('0xe'),_0xebca('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabad=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0x5c604c,_0x3c638f){var _0x565a0e=function(_0x363a79){while(--_0x363a79){_0x5c604c['push'](_0x5c604c['shift']());}};_0x565a0e(++_0x3c638f);}(_0xabad,0x150));var _0xdaba=function(_0x2cde51,_0x41b85c){_0x2cde51=_0x2cde51-0x0;var _0x37177e=_0xabad[_0x2cde51];return _0x37177e;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var logger=require(_0xdaba('0x1'))(_0xdaba('0x2'));var moment=require(_0xdaba('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaba('0x4'));var fs=require('fs');var path=require(_0xdaba('0x5'));var rimraf=require('rimraf');var config=require(_0xdaba('0x6'));var attributes=require(_0xdaba('0x7'));module[_0xdaba('0x8')]=function(_0x387d02,_0x20fd9f){return _0x387d02[_0xdaba('0x9')](_0xdaba('0xa'),attributes,{'tableName':_0xdaba('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xdaba('0xc'),_0xdaba('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 3a59a7d..fc985c5 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x58b4dc,_0x147a42){var _0x503a2d=function(_0x5a0bfb){while(--_0x5a0bfb){_0x58b4dc['push'](_0x58b4dc['shift']());}};_0x503a2d(++_0x147a42);}(_0x33af,0xec));var _0xf33a=function(_0x533ca6,_0x4ed3fb){_0x533ca6=_0x533ca6-0x0;var _0x34f0bd=_0x33af[_0x533ca6];return _0x34f0bd;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0xfdbd=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x4b8a8b,_0x1df174){var _0x532079=function(_0x2175a6){while(--_0x2175a6){_0x4b8a8b['push'](_0x4b8a8b['shift']());}};_0x532079(++_0x1df174);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x485abd,_0x32c7c1){_0x485abd=_0x485abd-0x0;var _0x3379f1=_0xfdbd[_0x485abd];return _0x3379f1;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x489f19,_0x556dc0,_0x590b5d){return new BPromise(function(_0x188508,_0xf72a24){return client['request'](_0x489f19,_0x590b5d)[_0xdfdb('0xc')](function(_0x444c19){logger[_0xdfdb('0xd')](_0xdfdb('0xe'),_0x556dc0,_0xdfdb('0xf'));logger[_0xdfdb('0x10')](_0xdfdb('0x11'),_0x556dc0,'request\x20sent',JSON[_0xdfdb('0x12')](_0x444c19));if(_0x444c19[_0xdfdb('0x13')]){if(_0x444c19['error'][_0xdfdb('0x14')]===0x1f4){logger[_0xdfdb('0x13')](_0xdfdb('0xe'),_0x556dc0,_0x444c19[_0xdfdb('0x13')][_0xdfdb('0x15')]);return _0xf72a24(_0x444c19[_0xdfdb('0x13')][_0xdfdb('0x15')]);}logger[_0xdfdb('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x556dc0,_0x444c19['error'][_0xdfdb('0x15')]);return _0x188508(_0x444c19['error'][_0xdfdb('0x15')]);}else{logger[_0xdfdb('0xd')](_0xdfdb('0xe'),_0x556dc0,_0xdfdb('0xf'));_0x188508(_0x444c19[_0xdfdb('0x16')][_0xdfdb('0x15')]);}})['catch'](function(_0x4fd3d5){logger[_0xdfdb('0x13')](_0xdfdb('0xe'),_0x556dc0,_0x4fd3d5);_0xf72a24(_0x4fd3d5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 43c2430..5d13e24 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(_0x491fd8,_0x4b56fb){var _0x1df365=function(_0x1a8729){while(--_0x1a8729){_0x491fd8['push'](_0x491fd8['shift']());}};_0x1df365(++_0x4b56fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 _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(_0x150021,_0x11e584){var _0x11348c=function(_0xdfa676){while(--_0xdfa676){_0x150021['push'](_0x150021['shift']());}};_0x11348c(++_0x11e584);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ca60c58..e797d6c 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 _0x15b8=['integrationTab','exports','STRING','username','ENUM','newTab'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x15b8,0xcd));var _0x815b=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x15b8[_0x543084];return _0x306a57;};'use strict';var Sequelize=require('sequelize');module[_0x815b('0x0')]={'name':{'type':Sequelize[_0x815b('0x1')]},'description':{'type':Sequelize[_0x815b('0x1')]},'username':{'type':Sequelize[_0x815b('0x1')],'unique':_0x815b('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x815b('0x1')]},'clientId':{'type':Sequelize[_0x815b('0x1')]},'clientSecret':{'type':Sequelize[_0x815b('0x1')]},'securityToken':{'type':Sequelize[_0x815b('0x1')]},'serverUrl':{'type':Sequelize[_0x815b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x815b('0x3')]('integrationTab',_0x815b('0x4')),'defaultValue':_0x815b('0x5')}}; \ No newline at end of file +var _0xbd89=['ENUM','integrationTab','newTab','STRING','username'];(function(_0x368497,_0x12927f){var _0x3dfa61=function(_0x2d3ebb){while(--_0x2d3ebb){_0x368497['push'](_0x368497['shift']());}};_0x3dfa61(++_0x12927f);}(_0xbd89,0x9e));var _0x9bd8=function(_0x1a9593,_0x5bbe9e){_0x1a9593=_0x1a9593-0x0;var _0xb65b5f=_0xbd89[_0x1a9593];return _0xb65b5f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9bd8('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x9bd8('0x1')},'remoteUri':{'type':Sequelize[_0x9bd8('0x0')]},'password':{'type':Sequelize[_0x9bd8('0x0')]},'clientId':{'type':Sequelize[_0x9bd8('0x0')]},'clientSecret':{'type':Sequelize[_0x9bd8('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9bd8('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x9bd8('0x2')](_0x9bd8('0x3'),_0x9bd8('0x4')),'defaultValue':_0x9bd8('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 18d7a2c..3cad7d8 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 _0x4730=['true','False','false','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','intersection','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','boolean','email','phone','includes','custom','picklistValues','label','value','True'];(function(_0x5da01c,_0x53bf77){var _0x1216c2=function(_0x1d8513){while(--_0x1d8513){_0x5da01c['push'](_0x5da01c['shift']());}};_0x1216c2(++_0x53bf77);}(_0x4730,0x182));var _0x0473=function(_0x4e6fc7,_0x6b9a5d){_0x4e6fc7=_0x4e6fc7-0x0;var _0x3c2ef6=_0x4730[_0x4e6fc7];return _0x3c2ef6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0473('0x0'));var jsonpatch=require(_0x0473('0x1'));var rp=require(_0x0473('0x2'));var moment=require(_0x0473('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0473('0x4'));var util=require('util');var path=require(_0x0473('0x5'));var sox=require(_0x0473('0x6'));var csv=require('to-csv');var ejs=require(_0x0473('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0473('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0473('0x9'));var toCsv=require(_0x0473('0xa'));var querystring=require(_0x0473('0xb'));var Papa=require(_0x0473('0xc'));var Redis=require(_0x0473('0xd'));var authService=require(_0x0473('0xe'));var qs=require(_0x0473('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0473('0x10'))(_0x0473('0x11'));var utils=require(_0x0473('0x12'));var config=require(_0x0473('0x13'));var licenseUtil=require(_0x0473('0x14'));var db=require(_0x0473('0x15'))['db'];var integrations=require(_0x0473('0x16'));function respondWithStatusCode(_0x9500b4,_0x586ff7){_0x586ff7=_0x586ff7||0xcc;return function(_0x1ef4d6){if(_0x1ef4d6){return _0x9500b4['sendStatus'](_0x586ff7);}return _0x9500b4['status'](_0x586ff7)[_0x0473('0x17')]();};}function respondWithResult(_0x3b4995,_0x593c2f){_0x593c2f=_0x593c2f||0xc8;return function(_0x1a28e0){if(_0x1a28e0){return _0x3b4995[_0x0473('0x18')](_0x593c2f)[_0x0473('0x19')](_0x1a28e0);}};}function respondWithFilteredResult(_0xcf2dc6,_0x1b9187){return function(_0x2e6d5a){if(_0x2e6d5a){var _0x43c972=typeof _0x1b9187['offset']==='undefined'&&typeof _0x1b9187[_0x0473('0x1a')]===_0x0473('0x1b');var _0x5302bc=_0x2e6d5a[_0x0473('0x1c')];var _0x13d68c=_0x43c972?0x0:_0x1b9187[_0x0473('0x1d')];var _0x37264f=_0x43c972?_0x2e6d5a['count']:_0x1b9187['offset']+_0x1b9187['limit'];var _0x4290cf;if(_0x37264f>=_0x5302bc){_0x37264f=_0x5302bc;_0x4290cf=0xc8;}else{_0x4290cf=0xce;}_0xcf2dc6[_0x0473('0x18')](_0x4290cf);return _0xcf2dc6[_0x0473('0x1e')]('Content-Range',_0x13d68c+'-'+_0x37264f+'/'+_0x5302bc)['json'](_0x2e6d5a);}return null;};}function patchUpdates(_0x311ac5){return function(_0x2f3344){try{jsonpatch[_0x0473('0x1f')](_0x2f3344,_0x311ac5,!![]);}catch(_0xbd43d5){return BPromise[_0x0473('0x20')](_0xbd43d5);}return _0x2f3344[_0x0473('0x21')]();};}function saveUpdates(_0xc86a12,_0x48d477){return function(_0x22c7c7){if(_0x22c7c7){return _0x22c7c7[_0x0473('0x22')](_0xc86a12)['then'](function(_0x3160c3){return _0x3160c3;});}return null;};}function removeEntity(_0x2961a6,_0x42fb04){return function(_0xef7629){if(_0xef7629){return _0xef7629[_0x0473('0x23')]()[_0x0473('0x24')](function(){_0x2961a6[_0x0473('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ec992,_0x213352){return function(_0xf1a6f3){if(!_0xf1a6f3){_0x1ec992[_0x0473('0x25')](0x194);}return _0xf1a6f3;};}function handleError(_0x1d94f5,_0x51991d){_0x51991d=_0x51991d||0x1f4;return function(_0x598966){logger[_0x0473('0x26')](_0x598966[_0x0473('0x27')]);if(_0x598966[_0x0473('0x28')]){delete _0x598966[_0x0473('0x28')];}_0x1d94f5[_0x0473('0x18')](_0x51991d)[_0x0473('0x29')](_0x598966);};}exports[_0x0473('0x2a')]=function(_0x1fc1af,_0x4a9f87){var _0x99e6f2={},_0x590510={},_0xa9f15a={'count':0x0,'rows':[]};var _0x22f141=_[_0x0473('0x2b')](db[_0x0473('0x2c')][_0x0473('0x2d')],function(_0x1d079d){return{'name':_0x1d079d[_0x0473('0x2e')],'type':_0x1d079d[_0x0473('0x2f')][_0x0473('0x30')]};});_0x590510[_0x0473('0x31')]=_[_0x0473('0x2b')](_0x22f141,_0x0473('0x28'));_0x590510[_0x0473('0x32')]=_[_0x0473('0x33')](_0x1fc1af[_0x0473('0x32')]);_0x590510[_0x0473('0x34')]=_['intersection'](_0x590510[_0x0473('0x31')],_0x590510[_0x0473('0x32')]);_0x99e6f2[_0x0473('0x35')]=_['intersection'](_0x590510[_0x0473('0x31')],qs[_0x0473('0x36')](_0x1fc1af[_0x0473('0x32')][_0x0473('0x36')]));_0x99e6f2[_0x0473('0x35')]=_0x99e6f2['attributes'][_0x0473('0x37')]?_0x99e6f2[_0x0473('0x35')]:_0x590510[_0x0473('0x31')];if(!_0x1fc1af[_0x0473('0x32')][_0x0473('0x38')](_0x0473('0x39'))){_0x99e6f2[_0x0473('0x1a')]=qs['limit'](_0x1fc1af[_0x0473('0x32')][_0x0473('0x1a')]);_0x99e6f2['offset']=qs[_0x0473('0x1d')](_0x1fc1af[_0x0473('0x32')][_0x0473('0x1d')]);}_0x99e6f2[_0x0473('0x3a')]=qs['sort'](_0x1fc1af['query'][_0x0473('0x3b')]);_0x99e6f2['where']=qs[_0x0473('0x34')](_[_0x0473('0x3c')](_0x1fc1af[_0x0473('0x32')],_0x590510[_0x0473('0x34')]),_0x22f141);if(_0x1fc1af[_0x0473('0x32')][_0x0473('0x3d')]){_0x99e6f2['where']=_[_0x0473('0x3e')](_0x99e6f2[_0x0473('0x3f')],{'$or':_[_0x0473('0x2b')](_0x22f141,function(_0x6e73eb){if(_0x6e73eb[_0x0473('0x2f')]!==_0x0473('0x40')){var _0x2f611e={};_0x2f611e[_0x6e73eb[_0x0473('0x28')]]={'$like':'%'+_0x1fc1af[_0x0473('0x32')][_0x0473('0x3d')]+'%'};return _0x2f611e;}})});}_0x99e6f2=_[_0x0473('0x3e')]({},_0x99e6f2,_0x1fc1af[_0x0473('0x41')]);var _0x4194e8={'where':_0x99e6f2['where']};return db[_0x0473('0x2c')]['count'](_0x4194e8)[_0x0473('0x24')](function(_0x1267e6){_0xa9f15a[_0x0473('0x1c')]=_0x1267e6;if(_0x1fc1af[_0x0473('0x32')][_0x0473('0x42')]){_0x99e6f2[_0x0473('0x43')]=[{'all':!![]}];}return db[_0x0473('0x2c')][_0x0473('0x44')](_0x99e6f2);})['then'](function(_0x544d84){_0xa9f15a['rows']=_0x544d84;return _0xa9f15a;})[_0x0473('0x24')](respondWithFilteredResult(_0x4a9f87,_0x99e6f2))[_0x0473('0x45')](handleError(_0x4a9f87,null));};exports[_0x0473('0x46')]=function(_0x38ba67,_0x3c81ab){var _0x7139d3={'raw':![],'where':{'id':_0x38ba67['params']['id']}},_0x4b6db3={};_0x4b6db3['model']=_[_0x0473('0x33')](db[_0x0473('0x2c')][_0x0473('0x2d')]);_0x4b6db3[_0x0473('0x32')]=_[_0x0473('0x33')](_0x38ba67[_0x0473('0x32')]);_0x4b6db3[_0x0473('0x34')]=_[_0x0473('0x47')](_0x4b6db3[_0x0473('0x31')],_0x4b6db3['query']);_0x7139d3['attributes']=_[_0x0473('0x47')](_0x4b6db3['model'],qs['fields'](_0x38ba67['query'][_0x0473('0x36')]));_0x7139d3[_0x0473('0x35')]=_0x7139d3[_0x0473('0x35')][_0x0473('0x37')]?_0x7139d3[_0x0473('0x35')]:_0x4b6db3[_0x0473('0x31')];if(_0x38ba67[_0x0473('0x32')]['includeAll']){_0x7139d3[_0x0473('0x43')]=[{'all':!![]}];}_0x7139d3=_[_0x0473('0x3e')]({},_0x7139d3,_0x38ba67['options']);return db['SalesforceAccount'][_0x0473('0x48')](_0x7139d3)[_0x0473('0x24')](handleEntityNotFound(_0x3c81ab,null))[_0x0473('0x24')](respondWithResult(_0x3c81ab,null))[_0x0473('0x45')](handleError(_0x3c81ab,null));};exports[_0x0473('0x49')]=function(_0x212679,_0x3687aa){return db[_0x0473('0x2c')][_0x0473('0x49')](_0x212679[_0x0473('0x4a')],{})[_0x0473('0x24')](respondWithResult(_0x3687aa,0xc9))[_0x0473('0x45')](handleError(_0x3687aa,null));};exports[_0x0473('0x22')]=function(_0x390375,_0x2ad7c5){if(_0x390375[_0x0473('0x4a')]['id']){delete _0x390375['body']['id'];}return db['SalesforceAccount'][_0x0473('0x48')]({'where':{'id':_0x390375[_0x0473('0x4b')]['id']}})[_0x0473('0x24')](handleEntityNotFound(_0x2ad7c5,null))['then'](saveUpdates(_0x390375['body'],null))[_0x0473('0x24')](respondWithResult(_0x2ad7c5,null))[_0x0473('0x45')](handleError(_0x2ad7c5,null));};exports[_0x0473('0x23')]=function(_0x1147dc,_0x1a4c19){return db['SalesforceAccount'][_0x0473('0x48')]({'where':{'id':_0x1147dc[_0x0473('0x4b')]['id']}})[_0x0473('0x24')](handleEntityNotFound(_0x1a4c19,null))[_0x0473('0x24')](removeEntity(_0x1a4c19,null))[_0x0473('0x45')](handleError(_0x1a4c19,null));};exports[_0x0473('0x4c')]=function(_0x50d9d4,_0x98735,_0x3a6840){var _0x250396={};var _0x265fac={};var _0x10a018;var _0x57aad6;return db[_0x0473('0x2c')][_0x0473('0x4d')]({'where':{'id':_0x50d9d4[_0x0473('0x4b')]['id']}})[_0x0473('0x24')](handleEntityNotFound(_0x98735,null))[_0x0473('0x24')](function(_0x23ab48){if(_0x23ab48){_0x10a018=_0x23ab48;_0x265fac[_0x0473('0x31')]=_[_0x0473('0x33')](db[_0x0473('0x4e')][_0x0473('0x2d')]);_0x265fac[_0x0473('0x32')]=_[_0x0473('0x33')](_0x50d9d4['query']);_0x265fac['filters']=_[_0x0473('0x47')](_0x265fac[_0x0473('0x31')],_0x265fac[_0x0473('0x32')]);_0x250396['attributes']=_[_0x0473('0x47')](_0x265fac[_0x0473('0x31')],qs[_0x0473('0x36')](_0x50d9d4[_0x0473('0x32')]['fields']));_0x250396[_0x0473('0x35')]=_0x250396[_0x0473('0x35')][_0x0473('0x37')]?_0x250396['attributes']:_0x265fac[_0x0473('0x31')];_0x250396[_0x0473('0x3a')]=qs[_0x0473('0x3b')](_0x50d9d4[_0x0473('0x32')]['sort']);_0x250396[_0x0473('0x3f')]=qs[_0x0473('0x34')](_[_0x0473('0x3c')](_0x50d9d4[_0x0473('0x32')],_0x265fac[_0x0473('0x34')]));if(_0x50d9d4[_0x0473('0x32')][_0x0473('0x3d')]){_0x250396[_0x0473('0x3f')]=_[_0x0473('0x3e')](_0x250396['where'],{'$or':_[_0x0473('0x2b')](_0x250396['attributes'],function(_0x1bcc46){var _0x408b2b={};_0x408b2b[_0x1bcc46]={'$like':'%'+_0x50d9d4[_0x0473('0x32')][_0x0473('0x3d')]+'%'};return _0x408b2b;})});}_0x250396=_['merge']({},_0x250396,_0x50d9d4[_0x0473('0x41')]);return _0x10a018[_0x0473('0x4c')](_0x250396);}})['then'](function(_0x29e9c2){if(_0x29e9c2){_0x57aad6=_0x29e9c2['length'];if(!_0x50d9d4['query'][_0x0473('0x38')](_0x0473('0x39'))){_0x250396[_0x0473('0x1a')]=qs[_0x0473('0x1a')](_0x50d9d4[_0x0473('0x32')][_0x0473('0x1a')]);_0x250396['offset']=qs[_0x0473('0x1d')](_0x50d9d4[_0x0473('0x32')][_0x0473('0x1d')]);}return _0x10a018[_0x0473('0x4c')](_0x250396);}})[_0x0473('0x24')](function(_0x6ac2c2){if(_0x6ac2c2){return _0x6ac2c2?{'count':_0x57aad6,'rows':_0x6ac2c2}:null;}})[_0x0473('0x24')](respondWithResult(_0x98735,null))[_0x0473('0x45')](handleError(_0x98735,null));};exports[_0x0473('0x4f')]=function(_0x4dd0fd,_0x5ab976,_0x24bc8e){if(_0x4dd0fd[_0x0473('0x4a')]['id']){delete _0x4dd0fd[_0x0473('0x4a')]['id'];}return db[_0x0473('0x2c')][_0x0473('0x4d')]({'where':{'id':_0x4dd0fd[_0x0473('0x4b')]['id']}})[_0x0473('0x24')](handleEntityNotFound(_0x5ab976,null))['then'](function(_0x59a249){if(_0x59a249){_0x4dd0fd[_0x0473('0x4a')][_0x0473('0x50')]=_0x59a249['id'];_0x4dd0fd[_0x0473('0x4a')][_0x0473('0x51')]=integrations[_0x0473('0x52')](_0x4dd0fd[_0x0473('0x4a')][_0x0473('0x53')],_0x4dd0fd[_0x0473('0x4a')][_0x0473('0x2f')]);_0x4dd0fd[_0x0473('0x4a')]['Descriptions']=integrations[_0x0473('0x54')](_0x4dd0fd[_0x0473('0x4a')][_0x0473('0x53')],_0x4dd0fd['body'][_0x0473('0x2f')]);return db[_0x0473('0x4e')][_0x0473('0x49')](_0x4dd0fd[_0x0473('0x4a')],{'include':[{'model':db[_0x0473('0x55')],'as':_0x0473('0x51')},{'model':db[_0x0473('0x55')],'as':_0x0473('0x56')}]});}return null;})['then'](respondWithResult(_0x5ab976,null))['catch'](handleError(_0x5ab976,null));};exports[_0x0473('0x57')]=function(_0x57ec67,_0xbbfd0,_0x20b9d2){var _0xd8709f;var _0x3e5ee2='';var _0x58db0e=_0x0473('0x58');return db[_0x0473('0x2c')][_0x0473('0x4d')]({'where':{'id':_0x57ec67[_0x0473('0x4b')]['id']},'attributes':['id',_0x0473('0x59'),_0x0473('0x5a'),'clientSecret',_0x0473('0x5b'),_0x0473('0x5c'),_0x0473('0x5d')]})[_0x0473('0x24')](handleEntityNotFound(_0xbbfd0,null))['then'](function(_0x3c7de6){if(_0x3c7de6){_0x3e5ee2=_0x3c7de6['remoteUri'];var _0x2a44c7=_0x3e5ee2[_0x0473('0x5e')](-0x1);if(_0x2a44c7==='/'){_0x3e5ee2=_0x3e5ee2[_0x0473('0x5f')](0x0,_0x3e5ee2[_0x0473('0x60')](_0x2a44c7));}_0xd8709f=new jsforce[(_0x0473('0x61'))]({'oauth2':{'loginUrl':_0x3e5ee2,'clientId':_0x3c7de6[_0x0473('0x5a')],'clientSecret':_0x3c7de6[_0x0473('0x62')]}});return _0xd8709f['login'](_0x3c7de6[_0x0473('0x5b')],_0x3c7de6[_0x0473('0x5c')][_0x0473('0x63')](_0x3c7de6[_0x0473('0x5d')]));}})['then'](function(_0x21528b){if(_0x21528b){if(!_[_0x0473('0x64')](_0x57ec67['query']['ticketType'])){_0x58db0e=_0x57ec67['query'][_0x0473('0x65')];}return _0xd8709f['sobject'](_0x58db0e)[_0x0473('0x66')]();}})[_0x0473('0x24')](function(_0x4fc262){var _0x35f520=[_0x0473('0x67'),_0x0473('0x68'),_0x0473('0x69'),'IsRecurrence',_0x0473('0x6a'),_0x0473('0x6b')];var _0x9386e8=['string',_0x0473('0x6c'),'picklist',_0x0473('0x6d'),_0x0473('0x6e'),'textarea',_0x0473('0x6f')];if(_0x4fc262){_['remove'](_0x4fc262[_0x0473('0x36')],function(_0x28fa41){return _0x35f520[_0x0473('0x70')](_0x28fa41[_0x0473('0x28')])||!_0x9386e8[_0x0473('0x70')](_0x28fa41[_0x0473('0x2f')]);});return{'count':_0x4fc262[_0x0473('0x36')][_0x0473('0x37')],'rows':_[_0x0473('0x2b')](_0x4fc262[_0x0473('0x36')],function(_0x431dcf){return{'id':_0x431dcf[_0x0473('0x28')],'name':_0x431dcf['label'],'custom':_0x431dcf[_0x0473('0x71')],'options':_0x431dcf[_0x0473('0x72')][_0x0473('0x37')]>0x0?_['map'](_0x431dcf['picklistValues'],function(_0x49eec1){return{'name':_0x49eec1[_0x0473('0x73')],'value':_0x49eec1[_0x0473('0x74')]};}):_0x431dcf[_0x0473('0x2f')]=='boolean'?[{'name':_0x0473('0x75'),'value':_0x0473('0x76')},{'name':_0x0473('0x77'),'value':_0x0473('0x78')}]:[]};})};}})[_0x0473('0x24')](respondWithResult(_0xbbfd0,null))[_0x0473('0x45')](function(_0x140f21){var _0x2a80fe=_0x57ec67[_0x0473('0x32')]['test']?0x1f4:_0x140f21['statusCode']||0x1f4;logger[_0x0473('0x26')](_0x0473('0x79'),_0x0473('0x57'),_0x2a80fe,JSON[_0x0473('0x7a')](_0x140f21));delete _0x140f21[_0x0473('0x28')];if(_0x2a80fe===0x191){_0x2a80fe=0x190;}_0xbbfd0['status'](_0x2a80fe)[_0x0473('0x29')](_0x57ec67[_0x0473('0x32')][_0x0473('0x7b')]?{'message':_0x0473('0x7c'),'statusCode':_0x140f21[_0x0473('0x7d')]}:_0x140f21);});}; \ No newline at end of file +var _0x1f11=['request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','Subjects','getSubjects','getDescriptions','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','username','concat','isNil','ticketType','sobject','describe','ActivityDate','IsRecurrence','Subject','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','zip-dir','fast-json-patch'];(function(_0x243939,_0x2eb4b1){var _0xc48956=function(_0x13452f){while(--_0x13452f){_0x243939['push'](_0x243939['shift']());}};_0xc48956(++_0x2eb4b1);}(_0x1f11,0x76));var _0x11f1=function(_0x365251,_0x30efc7){_0x365251=_0x365251-0x0;var _0x4c9e29=_0x1f11[_0x365251];return _0x4c9e29;};'use strict';var emlformat=require(_0x11f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11f1('0x1'));var jsonpatch=require(_0x11f1('0x2'));var rp=require(_0x11f1('0x3'));var moment=require(_0x11f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x11f1('0x5'));var util=require(_0x11f1('0x6'));var path=require('path');var sox=require(_0x11f1('0x7'));var csv=require(_0x11f1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11f1('0x9'));var _=require(_0x11f1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x11f1('0xb'));var deskjs=require(_0x11f1('0xc'));var toCsv=require(_0x11f1('0x8'));var querystring=require(_0x11f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x11f1('0xe'));var authService=require(_0x11f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11f1('0x10'));var hardwareService=require(_0x11f1('0x11'));var logger=require(_0x11f1('0x12'))(_0x11f1('0x13'));var utils=require(_0x11f1('0x14'));var config=require(_0x11f1('0x15'));var licenseUtil=require(_0x11f1('0x16'));var db=require(_0x11f1('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3919db,_0x2f8b56){_0x2f8b56=_0x2f8b56||0xcc;return function(_0x531456){if(_0x531456){return _0x3919db[_0x11f1('0x18')](_0x2f8b56);}return _0x3919db[_0x11f1('0x19')](_0x2f8b56)[_0x11f1('0x1a')]();};}function respondWithResult(_0x526f1a,_0x3a46b6){_0x3a46b6=_0x3a46b6||0xc8;return function(_0x5a2597){if(_0x5a2597){return _0x526f1a[_0x11f1('0x19')](_0x3a46b6)[_0x11f1('0x1b')](_0x5a2597);}};}function respondWithFilteredResult(_0x3733a9,_0x5d2dc1){return function(_0x71ff8){if(_0x71ff8){var _0x3a4e21=typeof _0x5d2dc1[_0x11f1('0x1c')]==='undefined'&&typeof _0x5d2dc1[_0x11f1('0x1d')]===_0x11f1('0x1e');var _0x5a7d46=_0x71ff8[_0x11f1('0x1f')];var _0x24ad39=_0x3a4e21?0x0:_0x5d2dc1[_0x11f1('0x1c')];var _0x3bf6e5=_0x3a4e21?_0x71ff8['count']:_0x5d2dc1['offset']+_0x5d2dc1[_0x11f1('0x1d')];var _0xd45175;if(_0x3bf6e5>=_0x5a7d46){_0x3bf6e5=_0x5a7d46;_0xd45175=0xc8;}else{_0xd45175=0xce;}_0x3733a9[_0x11f1('0x19')](_0xd45175);return _0x3733a9['set'](_0x11f1('0x20'),_0x24ad39+'-'+_0x3bf6e5+'/'+_0x5a7d46)['json'](_0x71ff8);}return null;};}function patchUpdates(_0x4447b7){return function(_0x406677){try{jsonpatch[_0x11f1('0x21')](_0x406677,_0x4447b7,!![]);}catch(_0xb5fb13){return BPromise[_0x11f1('0x22')](_0xb5fb13);}return _0x406677[_0x11f1('0x23')]();};}function saveUpdates(_0x5baa44,_0x513913){return function(_0x438182){if(_0x438182){return _0x438182['update'](_0x5baa44)['then'](function(_0x1237e4){return _0x1237e4;});}return null;};}function removeEntity(_0x428b04,_0x5c1ced){return function(_0x5b48a2){if(_0x5b48a2){return _0x5b48a2['destroy']()[_0x11f1('0x24')](function(){_0x428b04['status'](0xcc)[_0x11f1('0x1a')]();});}};}function handleEntityNotFound(_0x197c98,_0x4c8619){return function(_0x47f107){if(!_0x47f107){_0x197c98[_0x11f1('0x18')](0x194);}return _0x47f107;};}function handleError(_0x22f325,_0x1275c9){_0x1275c9=_0x1275c9||0x1f4;return function(_0x431fbd){logger[_0x11f1('0x25')](_0x431fbd[_0x11f1('0x26')]);if(_0x431fbd[_0x11f1('0x27')]){delete _0x431fbd[_0x11f1('0x27')];}_0x22f325[_0x11f1('0x19')](_0x1275c9)[_0x11f1('0x28')](_0x431fbd);};}exports[_0x11f1('0x29')]=function(_0x10fc03,_0x35c24d){var _0x30a44d={},_0x395385={},_0x21875f={'count':0x0,'rows':[]};var _0x4faa5a=_[_0x11f1('0x2a')](db[_0x11f1('0x2b')][_0x11f1('0x2c')],function(_0x4d1bb0){return{'name':_0x4d1bb0[_0x11f1('0x2d')],'type':_0x4d1bb0[_0x11f1('0x2e')][_0x11f1('0x2f')]};});_0x395385[_0x11f1('0x30')]=_['map'](_0x4faa5a,'name');_0x395385[_0x11f1('0x31')]=_[_0x11f1('0x32')](_0x10fc03['query']);_0x395385[_0x11f1('0x33')]=_[_0x11f1('0x34')](_0x395385[_0x11f1('0x30')],_0x395385[_0x11f1('0x31')]);_0x30a44d[_0x11f1('0x35')]=_['intersection'](_0x395385[_0x11f1('0x30')],qs[_0x11f1('0x36')](_0x10fc03[_0x11f1('0x31')][_0x11f1('0x36')]));_0x30a44d[_0x11f1('0x35')]=_0x30a44d['attributes'][_0x11f1('0x37')]?_0x30a44d[_0x11f1('0x35')]:_0x395385[_0x11f1('0x30')];if(!_0x10fc03['query']['hasOwnProperty'](_0x11f1('0x38'))){_0x30a44d[_0x11f1('0x1d')]=qs['limit'](_0x10fc03['query']['limit']);_0x30a44d['offset']=qs[_0x11f1('0x1c')](_0x10fc03[_0x11f1('0x31')][_0x11f1('0x1c')]);}_0x30a44d[_0x11f1('0x39')]=qs[_0x11f1('0x3a')](_0x10fc03[_0x11f1('0x31')]['sort']);_0x30a44d[_0x11f1('0x3b')]=qs[_0x11f1('0x33')](_['pick'](_0x10fc03[_0x11f1('0x31')],_0x395385[_0x11f1('0x33')]),_0x4faa5a);if(_0x10fc03[_0x11f1('0x31')][_0x11f1('0x3c')]){_0x30a44d[_0x11f1('0x3b')]=_[_0x11f1('0x3d')](_0x30a44d[_0x11f1('0x3b')],{'$or':_[_0x11f1('0x2a')](_0x4faa5a,function(_0x21f420){if(_0x21f420[_0x11f1('0x2e')]!==_0x11f1('0x3e')){var _0x5b403f={};_0x5b403f[_0x21f420['name']]={'$like':'%'+_0x10fc03['query'][_0x11f1('0x3c')]+'%'};return _0x5b403f;}})});}_0x30a44d=_[_0x11f1('0x3d')]({},_0x30a44d,_0x10fc03[_0x11f1('0x3f')]);var _0x3251de={'where':_0x30a44d[_0x11f1('0x3b')]};return db['SalesforceAccount'][_0x11f1('0x1f')](_0x3251de)[_0x11f1('0x24')](function(_0x3dc139){_0x21875f[_0x11f1('0x1f')]=_0x3dc139;if(_0x10fc03[_0x11f1('0x31')]['includeAll']){_0x30a44d['include']=[{'all':!![]}];}return db[_0x11f1('0x2b')]['findAll'](_0x30a44d);})[_0x11f1('0x24')](function(_0x49da25){_0x21875f[_0x11f1('0x40')]=_0x49da25;return _0x21875f;})[_0x11f1('0x24')](respondWithFilteredResult(_0x35c24d,_0x30a44d))[_0x11f1('0x41')](handleError(_0x35c24d,null));};exports[_0x11f1('0x42')]=function(_0x5b4085,_0x528784){var _0x22f515={'raw':![],'where':{'id':_0x5b4085['params']['id']}},_0x43c1bc={};_0x43c1bc['model']=_[_0x11f1('0x32')](db['SalesforceAccount'][_0x11f1('0x2c')]);_0x43c1bc[_0x11f1('0x31')]=_[_0x11f1('0x32')](_0x5b4085[_0x11f1('0x31')]);_0x43c1bc[_0x11f1('0x33')]=_[_0x11f1('0x34')](_0x43c1bc[_0x11f1('0x30')],_0x43c1bc['query']);_0x22f515[_0x11f1('0x35')]=_[_0x11f1('0x34')](_0x43c1bc[_0x11f1('0x30')],qs[_0x11f1('0x36')](_0x5b4085[_0x11f1('0x31')][_0x11f1('0x36')]));_0x22f515[_0x11f1('0x35')]=_0x22f515[_0x11f1('0x35')][_0x11f1('0x37')]?_0x22f515['attributes']:_0x43c1bc[_0x11f1('0x30')];if(_0x5b4085[_0x11f1('0x31')][_0x11f1('0x43')]){_0x22f515[_0x11f1('0x44')]=[{'all':!![]}];}_0x22f515=_['merge']({},_0x22f515,_0x5b4085[_0x11f1('0x3f')]);return db[_0x11f1('0x2b')][_0x11f1('0x45')](_0x22f515)[_0x11f1('0x24')](handleEntityNotFound(_0x528784,null))[_0x11f1('0x24')](respondWithResult(_0x528784,null))[_0x11f1('0x41')](handleError(_0x528784,null));};exports['create']=function(_0x39745f,_0xe4752b){return db['SalesforceAccount'][_0x11f1('0x46')](_0x39745f[_0x11f1('0x47')],{})[_0x11f1('0x24')](respondWithResult(_0xe4752b,0xc9))[_0x11f1('0x41')](handleError(_0xe4752b,null));};exports['update']=function(_0x340a3f,_0x495ab0){if(_0x340a3f[_0x11f1('0x47')]['id']){delete _0x340a3f[_0x11f1('0x47')]['id'];}return db[_0x11f1('0x2b')][_0x11f1('0x45')]({'where':{'id':_0x340a3f['params']['id']}})[_0x11f1('0x24')](handleEntityNotFound(_0x495ab0,null))[_0x11f1('0x24')](saveUpdates(_0x340a3f[_0x11f1('0x47')],null))[_0x11f1('0x24')](respondWithResult(_0x495ab0,null))['catch'](handleError(_0x495ab0,null));};exports['destroy']=function(_0x261693,_0xe820fb){return db[_0x11f1('0x2b')][_0x11f1('0x45')]({'where':{'id':_0x261693[_0x11f1('0x48')]['id']}})['then'](handleEntityNotFound(_0xe820fb,null))[_0x11f1('0x24')](removeEntity(_0xe820fb,null))[_0x11f1('0x41')](handleError(_0xe820fb,null));};exports[_0x11f1('0x49')]=function(_0x37bd2f,_0x202758,_0x2b66f6){var _0x429c97={};var _0x3f5d90={};var _0x120b97;var _0x57bef1;return db[_0x11f1('0x2b')][_0x11f1('0x4a')]({'where':{'id':_0x37bd2f[_0x11f1('0x48')]['id']}})[_0x11f1('0x24')](handleEntityNotFound(_0x202758,null))[_0x11f1('0x24')](function(_0x569e8f){if(_0x569e8f){_0x120b97=_0x569e8f;_0x3f5d90[_0x11f1('0x30')]=_['keys'](db[_0x11f1('0x4b')][_0x11f1('0x2c')]);_0x3f5d90[_0x11f1('0x31')]=_[_0x11f1('0x32')](_0x37bd2f[_0x11f1('0x31')]);_0x3f5d90[_0x11f1('0x33')]=_['intersection'](_0x3f5d90[_0x11f1('0x30')],_0x3f5d90[_0x11f1('0x31')]);_0x429c97['attributes']=_[_0x11f1('0x34')](_0x3f5d90[_0x11f1('0x30')],qs[_0x11f1('0x36')](_0x37bd2f['query'][_0x11f1('0x36')]));_0x429c97[_0x11f1('0x35')]=_0x429c97[_0x11f1('0x35')]['length']?_0x429c97['attributes']:_0x3f5d90[_0x11f1('0x30')];_0x429c97[_0x11f1('0x39')]=qs['sort'](_0x37bd2f[_0x11f1('0x31')][_0x11f1('0x3a')]);_0x429c97['where']=qs[_0x11f1('0x33')](_['pick'](_0x37bd2f[_0x11f1('0x31')],_0x3f5d90['filters']));if(_0x37bd2f[_0x11f1('0x31')][_0x11f1('0x3c')]){_0x429c97['where']=_[_0x11f1('0x3d')](_0x429c97[_0x11f1('0x3b')],{'$or':_['map'](_0x429c97[_0x11f1('0x35')],function(_0x3f82b6){var _0x50e580={};_0x50e580[_0x3f82b6]={'$like':'%'+_0x37bd2f[_0x11f1('0x31')][_0x11f1('0x3c')]+'%'};return _0x50e580;})});}_0x429c97=_[_0x11f1('0x3d')]({},_0x429c97,_0x37bd2f[_0x11f1('0x3f')]);return _0x120b97['getConfigurations'](_0x429c97);}})[_0x11f1('0x24')](function(_0x2fe0ff){if(_0x2fe0ff){_0x57bef1=_0x2fe0ff[_0x11f1('0x37')];if(!_0x37bd2f[_0x11f1('0x31')]['hasOwnProperty'](_0x11f1('0x38'))){_0x429c97[_0x11f1('0x1d')]=qs['limit'](_0x37bd2f[_0x11f1('0x31')][_0x11f1('0x1d')]);_0x429c97[_0x11f1('0x1c')]=qs[_0x11f1('0x1c')](_0x37bd2f['query'][_0x11f1('0x1c')]);}return _0x120b97[_0x11f1('0x49')](_0x429c97);}})[_0x11f1('0x24')](function(_0x496658){if(_0x496658){return _0x496658?{'count':_0x57bef1,'rows':_0x496658}:null;}})[_0x11f1('0x24')](respondWithResult(_0x202758,null))[_0x11f1('0x41')](handleError(_0x202758,null));};exports[_0x11f1('0x4c')]=function(_0x353a96,_0x3870fa,_0x5d5875){if(_0x353a96[_0x11f1('0x47')]['id']){delete _0x353a96[_0x11f1('0x47')]['id'];}return db[_0x11f1('0x2b')][_0x11f1('0x4a')]({'where':{'id':_0x353a96[_0x11f1('0x48')]['id']}})[_0x11f1('0x24')](handleEntityNotFound(_0x3870fa,null))[_0x11f1('0x24')](function(_0x2769a6){if(_0x2769a6){_0x353a96[_0x11f1('0x47')]['AccountId']=_0x2769a6['id'];_0x353a96['body'][_0x11f1('0x4d')]=integrations[_0x11f1('0x4e')](_0x353a96['body']['channel'],_0x353a96[_0x11f1('0x47')][_0x11f1('0x2e')]);_0x353a96['body']['Descriptions']=integrations[_0x11f1('0x4f')](_0x353a96[_0x11f1('0x47')][_0x11f1('0x50')],_0x353a96[_0x11f1('0x47')]['type']);return db[_0x11f1('0x4b')][_0x11f1('0x46')](_0x353a96[_0x11f1('0x47')],{'include':[{'model':db[_0x11f1('0x51')],'as':'Subjects'},{'model':db[_0x11f1('0x51')],'as':_0x11f1('0x52')}]});}return null;})[_0x11f1('0x24')](respondWithResult(_0x3870fa,null))[_0x11f1('0x41')](handleError(_0x3870fa,null));};exports[_0x11f1('0x53')]=function(_0x38782c,_0x2569cb,_0x58783d){var _0x3de266;var _0x27bb8c='';var _0x3e0b8c=_0x11f1('0x54');return db[_0x11f1('0x2b')][_0x11f1('0x4a')]({'where':{'id':_0x38782c[_0x11f1('0x48')]['id']},'attributes':['id',_0x11f1('0x55'),_0x11f1('0x56'),_0x11f1('0x57'),'username',_0x11f1('0x58'),_0x11f1('0x59')]})['then'](handleEntityNotFound(_0x2569cb,null))[_0x11f1('0x24')](function(_0x5d2ae8){if(_0x5d2ae8){_0x27bb8c=_0x5d2ae8[_0x11f1('0x55')];var _0x47cf1c=_0x27bb8c[_0x11f1('0x5a')](-0x1);if(_0x47cf1c==='/'){_0x27bb8c=_0x27bb8c[_0x11f1('0x5b')](0x0,_0x27bb8c[_0x11f1('0x5c')](_0x47cf1c));}_0x3de266=new jsforce[(_0x11f1('0x5d'))]({'oauth2':{'loginUrl':_0x27bb8c,'clientId':_0x5d2ae8[_0x11f1('0x56')],'clientSecret':_0x5d2ae8[_0x11f1('0x57')]}});return _0x3de266[_0x11f1('0x5e')](_0x5d2ae8[_0x11f1('0x5f')],_0x5d2ae8[_0x11f1('0x58')][_0x11f1('0x60')](_0x5d2ae8[_0x11f1('0x59')]));}})['then'](function(_0x1c6b0b){if(_0x1c6b0b){if(!_[_0x11f1('0x61')](_0x38782c[_0x11f1('0x31')]['ticketType'])){_0x3e0b8c=_0x38782c['query'][_0x11f1('0x62')];}return _0x3de266[_0x11f1('0x63')](_0x3e0b8c)[_0x11f1('0x64')]();}})['then'](function(_0x1e20bb){var _0x27ca22=['OwnerId',_0x11f1('0x65'),'IsReminderSet',_0x11f1('0x66'),_0x11f1('0x67'),'Description'];var _0x49d2ee=['string','int',_0x11f1('0x68'),_0x11f1('0x69'),_0x11f1('0x6a'),_0x11f1('0x6b'),_0x11f1('0x6c')];if(_0x1e20bb){_[_0x11f1('0x6d')](_0x1e20bb[_0x11f1('0x36')],function(_0x450af4){return _0x27ca22[_0x11f1('0x6e')](_0x450af4[_0x11f1('0x27')])||!_0x49d2ee[_0x11f1('0x6e')](_0x450af4[_0x11f1('0x2e')]);});return{'count':_0x1e20bb[_0x11f1('0x36')][_0x11f1('0x37')],'rows':_[_0x11f1('0x2a')](_0x1e20bb['fields'],function(_0x364b63){return{'id':_0x364b63['name'],'name':_0x364b63[_0x11f1('0x6f')],'custom':_0x364b63[_0x11f1('0x70')],'options':_0x364b63[_0x11f1('0x71')][_0x11f1('0x37')]>0x0?_[_0x11f1('0x2a')](_0x364b63[_0x11f1('0x71')],function(_0x3a7364){return{'name':_0x3a7364[_0x11f1('0x6f')],'value':_0x3a7364['value']};}):_0x364b63[_0x11f1('0x2e')]==_0x11f1('0x69')?[{'name':_0x11f1('0x72'),'value':_0x11f1('0x73')},{'name':_0x11f1('0x74'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x2569cb,null))[_0x11f1('0x41')](function(_0x5ea509){var _0x151344=_0x38782c[_0x11f1('0x31')][_0x11f1('0x75')]?0x1f4:_0x5ea509['statusCode']||0x1f4;logger[_0x11f1('0x25')](_0x11f1('0x76'),'getFields',_0x151344,JSON[_0x11f1('0x77')](_0x5ea509));delete _0x5ea509[_0x11f1('0x27')];if(_0x151344===0x191){_0x151344=0x190;}_0x2569cb[_0x11f1('0x19')](_0x151344)[_0x11f1('0x28')](_0x38782c[_0x11f1('0x31')][_0x11f1('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x5ea509[_0x11f1('0x78')]}:_0x5ea509);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7620110..3da0630 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 _0x22cc=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x10423d,_0x13071e){var _0x3fbc6a=function(_0x472ded){while(--_0x472ded){_0x10423d['push'](_0x10423d['shift']());}};_0x3fbc6a(++_0x13071e);}(_0x22cc,0x1e1));var _0xc22c=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x22cc[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require(_0xc22c('0x0'));var logger=require(_0xc22c('0x1'))(_0xc22c('0x2'));var moment=require(_0xc22c('0x3'));var BPromise=require(_0xc22c('0x4'));var rp=require(_0xc22c('0x5'));var fs=require('fs');var path=require(_0xc22c('0x6'));var rimraf=require(_0xc22c('0x7'));var config=require(_0xc22c('0x8'));var attributes=require(_0xc22c('0x9'));var integrations=require(_0xc22c('0xa'));module[_0xc22c('0xb')]=function(_0x1df50d,_0x38df1f){return _0x1df50d[_0xc22c('0xc')](_0xc22c('0xd'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c99=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x524557,_0x27abf5){var _0x11587=function(_0x534af4){while(--_0x534af4){_0x524557['push'](_0x524557['shift']());}};_0x11587(++_0x27abf5);}(_0x8c99,0x1a8));var _0x98c9=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x8c99[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var logger=require(_0x98c9('0x2'))(_0x98c9('0x3'));var moment=require(_0x98c9('0x4'));var BPromise=require(_0x98c9('0x5'));var rp=require(_0x98c9('0x6'));var fs=require('fs');var path=require(_0x98c9('0x7'));var rimraf=require(_0x98c9('0x8'));var config=require(_0x98c9('0x9'));var attributes=require(_0x98c9('0xa'));var integrations=require(_0x98c9('0xb'));module['exports']=function(_0x7f0fec,_0x2ed2b6){return _0x7f0fec['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','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 b9bd845..d0f2e21 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 _0xfb3e=['error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSalesforceAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f9595,_0x3e3b2d){var _0x3f1866=function(_0xa16e61){while(--_0xa16e61){_0x2f9595['push'](_0x2f9595['shift']());}};_0x3f1866(++_0x3e3b2d);}(_0xfb3e,0x7b));var _0xefb3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfb3e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xefb3('0x0'));var util=require(_0xefb3('0x1'));var moment=require(_0xefb3('0x2'));var BPromise=require(_0xefb3('0x3'));var rs=require(_0xefb3('0x4'));var fs=require('fs');var Redis=require(_0xefb3('0x5'));var db=require(_0xefb3('0x6'))['db'];var utils=require(_0xefb3('0x7'));var logger=require('../../config/logger')(_0xefb3('0x8'));var config=require('../../config/environment');var jayson=require(_0xefb3('0x9'));var client=jayson[_0xefb3('0xa')][_0xefb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4687f6,_0x3dd03a,_0x44e9a7){return new BPromise(function(_0x10e885,_0x258b6e){return client['request'](_0x4687f6,_0x44e9a7)[_0xefb3('0xc')](function(_0x3ff16b){logger[_0xefb3('0xd')](_0xefb3('0xe'),_0x3dd03a,'request\x20sent');logger['debug'](_0xefb3('0xf'),_0x3dd03a,'request\x20sent',JSON[_0xefb3('0x10')](_0x3ff16b));if(_0x3ff16b[_0xefb3('0x11')]){if(_0x3ff16b['error'][_0xefb3('0x12')]===0x1f4){logger[_0xefb3('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3dd03a,_0x3ff16b[_0xefb3('0x11')][_0xefb3('0x13')]);return _0x258b6e(_0x3ff16b[_0xefb3('0x11')][_0xefb3('0x13')]);}logger[_0xefb3('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3dd03a,_0x3ff16b[_0xefb3('0x11')][_0xefb3('0x13')]);return _0x10e885(_0x3ff16b[_0xefb3('0x11')][_0xefb3('0x13')]);}else{logger[_0xefb3('0xd')](_0xefb3('0xe'),_0x3dd03a,'request\x20sent');_0x10e885(_0x3ff16b['result']['message']);}})[_0xefb3('0x14')](function(_0xe1197f){logger[_0xefb3('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3dd03a,_0xe1197f);_0x258b6e(_0xe1197f);});});}exports[_0xefb3('0x15')]=function(_0x2967e1){var _0x24525=this;return new Promise(function(_0x2739ff,_0x22d995){return db[_0xefb3('0x16')][_0xefb3('0x17')]({'raw':_0x2967e1[_0xefb3('0x18')]?_0x2967e1[_0xefb3('0x18')][_0xefb3('0x19')]===undefined?!![]:![]:!![],'where':_0x2967e1[_0xefb3('0x18')]?_0x2967e1['options'][_0xefb3('0x1a')]||null:null,'attributes':_0x2967e1[_0xefb3('0x18')]?_0x2967e1['options'][_0xefb3('0x1b')]||null:null,'limit':_0x2967e1[_0xefb3('0x18')]?_0x2967e1['options'][_0xefb3('0x1c')]||null:null,'include':_0x2967e1[_0xefb3('0x18')]?_0x2967e1['options'][_0xefb3('0x1d')]?_['map'](_0x2967e1['options'][_0xefb3('0x1d')],function(_0x15cb56){return{'model':db[_0x15cb56[_0xefb3('0x1e')]],'as':_0x15cb56['as'],'attributes':_0x15cb56[_0xefb3('0x1b')],'include':_0x15cb56[_0xefb3('0x1d')]?_['map'](_0x15cb56[_0xefb3('0x1d')],function(_0x2aa5c7){return{'model':db[_0x2aa5c7[_0xefb3('0x1e')]],'as':_0x2aa5c7['as'],'attributes':_0x2aa5c7[_0xefb3('0x1b')],'include':_0x2aa5c7[_0xefb3('0x1d')]?_[_0xefb3('0x1f')](_0x2aa5c7[_0xefb3('0x1d')],function(_0x1131cf){return{'model':db[_0x1131cf['model']],'as':_0x1131cf['as'],'attributes':_0x1131cf['attributes']};}):[]};}):[]};}):[]:[]})[_0xefb3('0xc')](function(_0xd20b17){logger[_0xefb3('0xd')](_0xefb3('0x15'),_0x2967e1);logger['debug']('GetSalesforceAccount',_0x2967e1,JSON[_0xefb3('0x10')](_0xd20b17));_0x2739ff(_0xd20b17);})[_0xefb3('0x14')](function(_0x9c50e5){logger['error']('GetSalesforceAccount',_0x9c50e5[_0xefb3('0x13')],_0x2967e1);_0x22d995(_0x24525[_0xefb3('0x11')](0x1f4,_0x9c50e5[_0xefb3('0x13')]));});});};exports[_0xefb3('0x20')]=function(_0x357d72){var _0x2d8b25=this;return new Promise(function(_0x8a3de0,_0x4e136d){return db[_0xefb3('0x16')][_0xefb3('0x21')]({'raw':_0x357d72['options']?_0x357d72[_0xefb3('0x18')][_0xefb3('0x19')]===undefined?!![]:![]:!![],'where':_0x357d72[_0xefb3('0x18')]?_0x357d72[_0xefb3('0x18')][_0xefb3('0x1a')]||null:null,'attributes':_0x357d72[_0xefb3('0x18')]?_0x357d72['options'][_0xefb3('0x1b')]||null:null,'include':_0x357d72[_0xefb3('0x18')]?_0x357d72[_0xefb3('0x18')][_0xefb3('0x1d')]?_[_0xefb3('0x1f')](_0x357d72[_0xefb3('0x18')][_0xefb3('0x1d')],function(_0x4564f1){return{'model':db[_0x4564f1[_0xefb3('0x1e')]],'as':_0x4564f1['as'],'attributes':_0x4564f1[_0xefb3('0x1b')],'include':_0x4564f1[_0xefb3('0x1d')]?_[_0xefb3('0x1f')](_0x4564f1['include'],function(_0x2ce184){return{'model':db[_0x2ce184[_0xefb3('0x1e')]],'as':_0x2ce184['as'],'attributes':_0x2ce184['attributes'],'include':_0x2ce184[_0xefb3('0x1d')]?_[_0xefb3('0x1f')](_0x2ce184[_0xefb3('0x1d')],function(_0x1942f9){return{'model':db[_0x1942f9[_0xefb3('0x1e')]],'as':_0x1942f9['as'],'attributes':_0x1942f9[_0xefb3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41d467){logger['info']('ShowSalesforceAccount',_0x357d72);logger[_0xefb3('0x22')](_0xefb3('0x20'),_0x357d72,JSON[_0xefb3('0x10')](_0x41d467));_0x8a3de0(_0x41d467);})[_0xefb3('0x14')](function(_0x54e25a){logger[_0xefb3('0x11')]('ShowSalesforceAccount',_0x54e25a[_0xefb3('0x13')],_0x357d72);_0x4e136d(_0x2d8b25[_0xefb3('0x11')](0x1f4,_0x54e25a[_0xefb3('0x13')]));});});}; \ No newline at end of file +var _0x75ad=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','catch','findAll','options','where','include','model','attributes','map','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash'];(function(_0xf77eb7,_0x25b10a){var _0x20a3c9=function(_0x2198cd){while(--_0x2198cd){_0xf77eb7['push'](_0xf77eb7['shift']());}};_0x20a3c9(++_0x25b10a);}(_0x75ad,0xd7));var _0xd75a=function(_0x1956f1,_0x734e5c){_0x1956f1=_0x1956f1-0x0;var _0x3fef98=_0x75ad[_0x1956f1];return _0x3fef98;};'use strict';var _=require(_0xd75a('0x0'));var util=require(_0xd75a('0x1'));var moment=require(_0xd75a('0x2'));var BPromise=require(_0xd75a('0x3'));var rs=require(_0xd75a('0x4'));var fs=require('fs');var Redis=require(_0xd75a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd75a('0x6'));var logger=require(_0xd75a('0x7'))('rpc');var config=require(_0xd75a('0x8'));var jayson=require(_0xd75a('0x9'));var client=jayson[_0xd75a('0xa')][_0xd75a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c8ef9,_0x40ee1f,_0x396cd1){return new BPromise(function(_0x4c7bbe,_0x12a0de){return client[_0xd75a('0xc')](_0x5c8ef9,_0x396cd1)[_0xd75a('0xd')](function(_0x559c2d){logger[_0xd75a('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x40ee1f,'request\x20sent');logger[_0xd75a('0xf')](_0xd75a('0x10'),_0x40ee1f,_0xd75a('0x11'),JSON[_0xd75a('0x12')](_0x559c2d));if(_0x559c2d[_0xd75a('0x13')]){if(_0x559c2d[_0xd75a('0x13')][_0xd75a('0x14')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x40ee1f,_0x559c2d[_0xd75a('0x13')][_0xd75a('0x15')]);return _0x12a0de(_0x559c2d['error'][_0xd75a('0x15')]);}logger[_0xd75a('0x13')](_0xd75a('0x16'),_0x40ee1f,_0x559c2d[_0xd75a('0x13')][_0xd75a('0x15')]);return _0x4c7bbe(_0x559c2d[_0xd75a('0x13')][_0xd75a('0x15')]);}else{logger[_0xd75a('0xe')](_0xd75a('0x16'),_0x40ee1f,_0xd75a('0x11'));_0x4c7bbe(_0x559c2d[_0xd75a('0x17')][_0xd75a('0x15')]);}})[_0xd75a('0x18')](function(_0x4cef04){logger[_0xd75a('0x13')](_0xd75a('0x16'),_0x40ee1f,_0x4cef04);_0x12a0de(_0x4cef04);});});}exports['GetSalesforceAccount']=function(_0x550f6f){var _0x3099d6=this;return new Promise(function(_0xaf712a,_0x184dea){return db['SalesforceAccount'][_0xd75a('0x19')]({'raw':_0x550f6f[_0xd75a('0x1a')]?_0x550f6f[_0xd75a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x550f6f[_0xd75a('0x1a')]?_0x550f6f[_0xd75a('0x1a')][_0xd75a('0x1b')]||null:null,'attributes':_0x550f6f[_0xd75a('0x1a')]?_0x550f6f[_0xd75a('0x1a')]['attributes']||null:null,'limit':_0x550f6f[_0xd75a('0x1a')]?_0x550f6f['options']['limit']||null:null,'include':_0x550f6f[_0xd75a('0x1a')]?_0x550f6f[_0xd75a('0x1a')][_0xd75a('0x1c')]?_['map'](_0x550f6f[_0xd75a('0x1a')]['include'],function(_0x5a395d){return{'model':db[_0x5a395d[_0xd75a('0x1d')]],'as':_0x5a395d['as'],'attributes':_0x5a395d['attributes'],'include':_0x5a395d[_0xd75a('0x1c')]?_['map'](_0x5a395d[_0xd75a('0x1c')],function(_0x36df77){return{'model':db[_0x36df77['model']],'as':_0x36df77['as'],'attributes':_0x36df77[_0xd75a('0x1e')],'include':_0x36df77[_0xd75a('0x1c')]?_[_0xd75a('0x1f')](_0x36df77[_0xd75a('0x1c')],function(_0x30e79f){return{'model':db[_0x30e79f['model']],'as':_0x30e79f['as'],'attributes':_0x30e79f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd75a('0xd')](function(_0x2d7699){logger[_0xd75a('0xe')](_0xd75a('0x20'),_0x550f6f);logger[_0xd75a('0xf')](_0xd75a('0x20'),_0x550f6f,JSON[_0xd75a('0x12')](_0x2d7699));_0xaf712a(_0x2d7699);})['catch'](function(_0x40fbb3){logger['error']('GetSalesforceAccount',_0x40fbb3['message'],_0x550f6f);_0x184dea(_0x3099d6['error'](0x1f4,_0x40fbb3[_0xd75a('0x15')]));});});};exports[_0xd75a('0x21')]=function(_0x68ebe7){var _0x44a432=this;return new Promise(function(_0x39754e,_0x52fae8){return db[_0xd75a('0x22')][_0xd75a('0x23')]({'raw':_0x68ebe7[_0xd75a('0x1a')]?_0x68ebe7[_0xd75a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x68ebe7[_0xd75a('0x1a')]?_0x68ebe7[_0xd75a('0x1a')][_0xd75a('0x1b')]||null:null,'attributes':_0x68ebe7[_0xd75a('0x1a')]?_0x68ebe7[_0xd75a('0x1a')][_0xd75a('0x1e')]||null:null,'include':_0x68ebe7[_0xd75a('0x1a')]?_0x68ebe7[_0xd75a('0x1a')][_0xd75a('0x1c')]?_[_0xd75a('0x1f')](_0x68ebe7[_0xd75a('0x1a')][_0xd75a('0x1c')],function(_0x3517a1){return{'model':db[_0x3517a1[_0xd75a('0x1d')]],'as':_0x3517a1['as'],'attributes':_0x3517a1['attributes'],'include':_0x3517a1[_0xd75a('0x1c')]?_[_0xd75a('0x1f')](_0x3517a1['include'],function(_0x49cc20){return{'model':db[_0x49cc20[_0xd75a('0x1d')]],'as':_0x49cc20['as'],'attributes':_0x49cc20[_0xd75a('0x1e')],'include':_0x49cc20[_0xd75a('0x1c')]?_['map'](_0x49cc20[_0xd75a('0x1c')],function(_0x4590c4){return{'model':db[_0x4590c4[_0xd75a('0x1d')]],'as':_0x4590c4['as'],'attributes':_0x4590c4[_0xd75a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd75a('0xd')](function(_0x690ae0){logger[_0xd75a('0xe')](_0xd75a('0x21'),_0x68ebe7);logger[_0xd75a('0xf')](_0xd75a('0x21'),_0x68ebe7,JSON[_0xd75a('0x12')](_0x690ae0));_0x39754e(_0x690ae0);})[_0xd75a('0x18')](function(_0x150fbd){logger[_0xd75a('0x13')](_0xd75a('0x21'),_0x150fbd['message'],_0x68ebe7);_0x52fae8(_0x44a432[_0xd75a('0x13')](0x1f4,_0x150fbd[_0xd75a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0825ef7..1bacf55 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2dfa33,_0x370390){var _0x36f642=function(_0x35512e){while(--_0x35512e){_0x2dfa33['push'](_0x2dfa33['shift']());}};_0x36f642(++_0x370390);}(_0x2ef3,0xba));var _0x32ef=function(_0x44c93c,_0x4d2b36){_0x44c93c=_0x44c93c-0x0;var _0x3843e0=_0x2ef3[_0x44c93c];return _0x3843e0;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2c8507,_0x2936df){var _0x208b5e=function(_0x38ec79){while(--_0x38ec79){_0x2c8507['push'](_0x2c8507['shift']());}};_0x208b5e(++_0x2936df);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 8b11aa1..13b4d2e 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 _0x7f91=['lead','account_contact_lead','nothing','account','sequelize','STRING','Task','Case','ENUM','contact_lead','contact'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7f91,0x93));var _0x17f9=function(_0x369a41,_0x5ed95c){_0x369a41=_0x369a41-0x0;var _0x16807d=_0x7f91[_0x369a41];return _0x16807d;};'use strict';var Sequelize=require(_0x17f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x17f9('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x17f9('0x2'),_0x17f9('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x17f9('0x4')](_0x17f9('0x5'),_0x17f9('0x6'),_0x17f9('0x7'),_0x17f9('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x17f9('0x4')](_0x17f9('0x9'),'contact','lead',_0x17f9('0xa')),'defaultValue':_0x17f9('0x7')},'leadId':{'type':Sequelize[_0x17f9('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x17f9('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x17f9('0x1')]}}; \ No newline at end of file +var _0x9e07=['ENUM','Task','Case','contact_lead','contact','lead','account','sequelize','exports','STRING'];(function(_0x7845f4,_0x276a64){var _0x12fb24=function(_0x2f400a){while(--_0x2f400a){_0x7845f4['push'](_0x7845f4['shift']());}};_0x12fb24(++_0x276a64);}(_0x9e07,0xb1));var _0x79e0=function(_0x1cb929,_0x1228ac){_0x1cb929=_0x1cb929-0x0;var _0x54d4a1=_0x9e07[_0x1cb929];return _0x54d4a1;};'use strict';var Sequelize=require(_0x79e0('0x0'));module[_0x79e0('0x1')]={'name':{'type':Sequelize[_0x79e0('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x79e0('0x3')](_0x79e0('0x4'),_0x79e0('0x5')),'defaultValue':_0x79e0('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x79e0('0x6'),_0x79e0('0x7'),_0x79e0('0x8'),'account_contact_lead',_0x79e0('0x9')),'defaultValue':_0x79e0('0x6')},'moduleCreate':{'type':Sequelize[_0x79e0('0x3')]('nothing',_0x79e0('0x7'),_0x79e0('0x8'),_0x79e0('0x9')),'defaultValue':_0x79e0('0x8')},'leadId':{'type':Sequelize[_0x79e0('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x79e0('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x79e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ce04ba4..29304c3 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 _0x8bf8=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','name','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','find','create','body','params','order','getFields','hasOwnProperty','getSubjects','getDescriptions','findOne','SalesforceField','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x475e93,_0x1f5842){var _0x8ff450=function(_0x1030f4){while(--_0x1030f4){_0x475e93['push'](_0x475e93['shift']());}};_0x8ff450(++_0x1f5842);}(_0x8bf8,0x11a));var _0x88bf=function(_0x3e83c2,_0x3e5de0){_0x3e83c2=_0x3e83c2-0x0;var _0xf86fe9=_0x8bf8[_0x3e83c2];return _0xf86fe9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88bf('0x0'));var zipdir=require(_0x88bf('0x1'));var jsonpatch=require(_0x88bf('0x2'));var rp=require(_0x88bf('0x3'));var moment=require(_0x88bf('0x4'));var BPromise=require(_0x88bf('0x5'));var Mustache=require(_0x88bf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x88bf('0x7'));var csv=require(_0x88bf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88bf('0x9'));var _=require(_0x88bf('0xa'));var squel=require(_0x88bf('0xb'));var crypto=require(_0x88bf('0xc'));var jsforce=require(_0x88bf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x88bf('0x8'));var querystring=require(_0x88bf('0xe'));var Papa=require(_0x88bf('0xf'));var Redis=require(_0x88bf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x88bf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88bf('0x12'));var logger=require(_0x88bf('0x13'))(_0x88bf('0x14'));var utils=require(_0x88bf('0x15'));var config=require(_0x88bf('0x16'));var licenseUtil=require(_0x88bf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29bc37,_0x336b3d){_0x336b3d=_0x336b3d||0xcc;return function(_0x96dfbb){if(_0x96dfbb){return _0x29bc37['sendStatus'](_0x336b3d);}return _0x29bc37[_0x88bf('0x18')](_0x336b3d)[_0x88bf('0x19')]();};}function respondWithResult(_0x4c0323,_0x2aaec7){_0x2aaec7=_0x2aaec7||0xc8;return function(_0x4b5c9f){if(_0x4b5c9f){return _0x4c0323[_0x88bf('0x18')](_0x2aaec7)[_0x88bf('0x1a')](_0x4b5c9f);}};}function respondWithFilteredResult(_0x289c73,_0x3e3ae1){return function(_0x4cf451){if(_0x4cf451){var _0x125f2e=typeof _0x3e3ae1[_0x88bf('0x1b')]===_0x88bf('0x1c')&&typeof _0x3e3ae1[_0x88bf('0x1d')]===_0x88bf('0x1c');var _0xd15348=_0x4cf451['count'];var _0x37226e=_0x125f2e?0x0:_0x3e3ae1[_0x88bf('0x1b')];var _0x4456ea=_0x125f2e?_0x4cf451[_0x88bf('0x1e')]:_0x3e3ae1[_0x88bf('0x1b')]+_0x3e3ae1['limit'];var _0x392d84;if(_0x4456ea>=_0xd15348){_0x4456ea=_0xd15348;_0x392d84=0xc8;}else{_0x392d84=0xce;}_0x289c73[_0x88bf('0x18')](_0x392d84);return _0x289c73['set'](_0x88bf('0x1f'),_0x37226e+'-'+_0x4456ea+'/'+_0xd15348)[_0x88bf('0x1a')](_0x4cf451);}return null;};}function patchUpdates(_0x295ab9){return function(_0x463678){try{jsonpatch['apply'](_0x463678,_0x295ab9,!![]);}catch(_0x47223e){return BPromise[_0x88bf('0x20')](_0x47223e);}return _0x463678['save']();};}function saveUpdates(_0x1804e8,_0x4911ec){return function(_0x3fca9f){if(_0x3fca9f){return _0x3fca9f[_0x88bf('0x21')](_0x1804e8)[_0x88bf('0x22')](function(_0x1ba1d2){return _0x1ba1d2;});}return null;};}function removeEntity(_0x1c5c4c,_0x2d5590){return function(_0x5be217){if(_0x5be217){return _0x5be217[_0x88bf('0x23')]()[_0x88bf('0x22')](function(){_0x1c5c4c[_0x88bf('0x18')](0xcc)[_0x88bf('0x19')]();});}};}function handleEntityNotFound(_0x1426e8,_0x62a00){return function(_0x4aa3cf){if(!_0x4aa3cf){_0x1426e8['sendStatus'](0x194);}return _0x4aa3cf;};}function handleError(_0x13a507,_0x198a66){_0x198a66=_0x198a66||0x1f4;return function(_0x5ed5be){logger['error'](_0x5ed5be[_0x88bf('0x24')]);if(_0x5ed5be['name']){delete _0x5ed5be[_0x88bf('0x25')];}_0x13a507['status'](_0x198a66)['send'](_0x5ed5be);};}exports['index']=function(_0x1ea57b,_0x6b0204){var _0x4554bb={},_0x1d5cd5={},_0x3fc792={'count':0x0,'rows':[]};var _0x356b37=_[_0x88bf('0x26')](db[_0x88bf('0x27')][_0x88bf('0x28')],function(_0x2238ee){return{'name':_0x2238ee[_0x88bf('0x29')],'type':_0x2238ee[_0x88bf('0x2a')][_0x88bf('0x2b')]};});_0x1d5cd5[_0x88bf('0x2c')]=_[_0x88bf('0x26')](_0x356b37,_0x88bf('0x25'));_0x1d5cd5[_0x88bf('0x2d')]=_[_0x88bf('0x2e')](_0x1ea57b[_0x88bf('0x2d')]);_0x1d5cd5[_0x88bf('0x2f')]=_[_0x88bf('0x30')](_0x1d5cd5['model'],_0x1d5cd5[_0x88bf('0x2d')]);_0x4554bb[_0x88bf('0x31')]=_[_0x88bf('0x30')](_0x1d5cd5[_0x88bf('0x2c')],qs[_0x88bf('0x32')](_0x1ea57b[_0x88bf('0x2d')][_0x88bf('0x32')]));_0x4554bb['attributes']=_0x4554bb[_0x88bf('0x31')][_0x88bf('0x33')]?_0x4554bb[_0x88bf('0x31')]:_0x1d5cd5[_0x88bf('0x2c')];if(!_0x1ea57b[_0x88bf('0x2d')]['hasOwnProperty'](_0x88bf('0x34'))){_0x4554bb[_0x88bf('0x1d')]=qs[_0x88bf('0x1d')](_0x1ea57b[_0x88bf('0x2d')]['limit']);_0x4554bb[_0x88bf('0x1b')]=qs[_0x88bf('0x1b')](_0x1ea57b[_0x88bf('0x2d')][_0x88bf('0x1b')]);}_0x4554bb['order']=qs['sort'](_0x1ea57b[_0x88bf('0x2d')][_0x88bf('0x35')]);_0x4554bb[_0x88bf('0x36')]=qs[_0x88bf('0x2f')](_[_0x88bf('0x37')](_0x1ea57b['query'],_0x1d5cd5[_0x88bf('0x2f')]),_0x356b37);if(_0x1ea57b['query']['filter']){_0x4554bb['where']=_['merge'](_0x4554bb[_0x88bf('0x36')],{'$or':_['map'](_0x356b37,function(_0x3dd88b){if(_0x3dd88b[_0x88bf('0x2a')]!==_0x88bf('0x38')){var _0x5a9ae6={};_0x5a9ae6[_0x3dd88b[_0x88bf('0x25')]]={'$like':'%'+_0x1ea57b[_0x88bf('0x2d')][_0x88bf('0x39')]+'%'};return _0x5a9ae6;}})});}_0x4554bb=_[_0x88bf('0x3a')]({},_0x4554bb,_0x1ea57b[_0x88bf('0x3b')]);var _0x221c3b={'where':_0x4554bb[_0x88bf('0x36')]};return db[_0x88bf('0x27')][_0x88bf('0x1e')](_0x221c3b)[_0x88bf('0x22')](function(_0x26635e){_0x3fc792[_0x88bf('0x1e')]=_0x26635e;if(_0x1ea57b[_0x88bf('0x2d')]['includeAll']){_0x4554bb[_0x88bf('0x3c')]=[{'all':!![]}];}return db[_0x88bf('0x27')][_0x88bf('0x3d')](_0x4554bb);})[_0x88bf('0x22')](function(_0x377538){_0x3fc792[_0x88bf('0x3e')]=_0x377538;return _0x3fc792;})[_0x88bf('0x22')](respondWithFilteredResult(_0x6b0204,_0x4554bb))[_0x88bf('0x3f')](handleError(_0x6b0204,null));};exports[_0x88bf('0x40')]=function(_0x44ce27,_0x50bbc5){var _0x292dc6={'raw':![],'where':{'id':_0x44ce27['params']['id']}},_0x37cf3c={};_0x37cf3c[_0x88bf('0x2c')]=_[_0x88bf('0x2e')](db[_0x88bf('0x27')]['rawAttributes']);_0x37cf3c[_0x88bf('0x2d')]=_[_0x88bf('0x2e')](_0x44ce27[_0x88bf('0x2d')]);_0x37cf3c['filters']=_[_0x88bf('0x30')](_0x37cf3c['model'],_0x37cf3c[_0x88bf('0x2d')]);_0x292dc6[_0x88bf('0x31')]=_['intersection'](_0x37cf3c[_0x88bf('0x2c')],qs[_0x88bf('0x32')](_0x44ce27[_0x88bf('0x2d')][_0x88bf('0x32')]));_0x292dc6[_0x88bf('0x31')]=_0x292dc6[_0x88bf('0x31')]['length']?_0x292dc6[_0x88bf('0x31')]:_0x37cf3c[_0x88bf('0x2c')];if(_0x44ce27['query']['includeAll']){_0x292dc6['include']=[{'all':!![]}];}_0x292dc6=_[_0x88bf('0x3a')]({},_0x292dc6,_0x44ce27[_0x88bf('0x3b')]);return db['SalesforceConfiguration'][_0x88bf('0x41')](_0x292dc6)['then'](handleEntityNotFound(_0x50bbc5,null))[_0x88bf('0x22')](respondWithResult(_0x50bbc5,null))[_0x88bf('0x3f')](handleError(_0x50bbc5,null));};exports[_0x88bf('0x42')]=function(_0x4546c0,_0x206082){return db['SalesforceConfiguration']['create'](_0x4546c0[_0x88bf('0x43')],{})['then'](respondWithResult(_0x206082,0xc9))[_0x88bf('0x3f')](handleError(_0x206082,null));};exports[_0x88bf('0x21')]=function(_0x382428,_0xfa1d8e){if(_0x382428[_0x88bf('0x43')]['id']){delete _0x382428[_0x88bf('0x43')]['id'];}return db[_0x88bf('0x27')][_0x88bf('0x41')]({'where':{'id':_0x382428['params']['id']}})[_0x88bf('0x22')](handleEntityNotFound(_0xfa1d8e,null))['then'](saveUpdates(_0x382428[_0x88bf('0x43')],null))[_0x88bf('0x22')](respondWithResult(_0xfa1d8e,null))[_0x88bf('0x3f')](handleError(_0xfa1d8e,null));};exports[_0x88bf('0x23')]=function(_0x44067c,_0x31fe7c){return db[_0x88bf('0x27')]['find']({'where':{'id':_0x44067c[_0x88bf('0x44')]['id']}})[_0x88bf('0x22')](handleEntityNotFound(_0x31fe7c,null))[_0x88bf('0x22')](removeEntity(_0x31fe7c,null))[_0x88bf('0x3f')](handleError(_0x31fe7c,null));};exports['getFields']=function(_0x4db138,_0x512c77,_0x3d4d90){var _0x74dd38={};var _0x43ce89={};var _0x3e35de;var _0x25be07;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4db138[_0x88bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x512c77,null))[_0x88bf('0x22')](function(_0x2e9d9b){if(_0x2e9d9b){_0x3e35de=_0x2e9d9b;_0x43ce89[_0x88bf('0x2c')]=_[_0x88bf('0x2e')](db['SalesforceField'][_0x88bf('0x28')]);_0x43ce89['query']=_[_0x88bf('0x2e')](_0x4db138[_0x88bf('0x2d')]);_0x43ce89[_0x88bf('0x2f')]=_['intersection'](_0x43ce89[_0x88bf('0x2c')],_0x43ce89[_0x88bf('0x2d')]);_0x74dd38[_0x88bf('0x31')]=_['intersection'](_0x43ce89[_0x88bf('0x2c')],qs[_0x88bf('0x32')](_0x4db138[_0x88bf('0x2d')][_0x88bf('0x32')]));_0x74dd38[_0x88bf('0x31')]=_0x74dd38[_0x88bf('0x31')][_0x88bf('0x33')]?_0x74dd38['attributes']:_0x43ce89['model'];_0x74dd38[_0x88bf('0x45')]=qs[_0x88bf('0x35')](_0x4db138[_0x88bf('0x2d')]['sort']);_0x74dd38[_0x88bf('0x36')]=qs[_0x88bf('0x2f')](_[_0x88bf('0x37')](_0x4db138[_0x88bf('0x2d')],_0x43ce89[_0x88bf('0x2f')]));if(_0x4db138['query'][_0x88bf('0x39')]){_0x74dd38[_0x88bf('0x36')]=_[_0x88bf('0x3a')](_0x74dd38[_0x88bf('0x36')],{'$or':_['map'](_0x74dd38[_0x88bf('0x31')],function(_0x2fbfaf){var _0xf853={};_0xf853[_0x2fbfaf]={'$like':'%'+_0x4db138[_0x88bf('0x2d')][_0x88bf('0x39')]+'%'};return _0xf853;})});}_0x74dd38=_['merge']({},_0x74dd38,_0x4db138['options']);return _0x3e35de[_0x88bf('0x46')](_0x74dd38);}})[_0x88bf('0x22')](function(_0x235a18){if(_0x235a18){_0x25be07=_0x235a18[_0x88bf('0x33')];if(!_0x4db138[_0x88bf('0x2d')][_0x88bf('0x47')](_0x88bf('0x34'))){_0x74dd38['limit']=qs[_0x88bf('0x1d')](_0x4db138[_0x88bf('0x2d')][_0x88bf('0x1d')]);_0x74dd38[_0x88bf('0x1b')]=qs['offset'](_0x4db138[_0x88bf('0x2d')][_0x88bf('0x1b')]);}return _0x3e35de[_0x88bf('0x46')](_0x74dd38);}})['then'](function(_0x541e7e){if(_0x541e7e){return _0x541e7e?{'count':_0x25be07,'rows':_0x541e7e}:null;}})[_0x88bf('0x22')](respondWithResult(_0x512c77,null))['catch'](handleError(_0x512c77,null));};exports[_0x88bf('0x48')]=function(_0x20bbeb,_0x477673,_0xd301ce){var _0x47a918={};var _0x4ce5e7={};var _0x30bbfe;var _0x20c3ea;return db[_0x88bf('0x27')]['findOne']({'where':{'id':_0x20bbeb[_0x88bf('0x44')]['id']}})[_0x88bf('0x22')](handleEntityNotFound(_0x477673,null))[_0x88bf('0x22')](function(_0x3dcd4c){if(_0x3dcd4c){_0x30bbfe=_0x3dcd4c;_0x4ce5e7[_0x88bf('0x2c')]=_[_0x88bf('0x2e')](db['SalesforceField'][_0x88bf('0x28')]);_0x4ce5e7[_0x88bf('0x2d')]=_[_0x88bf('0x2e')](_0x20bbeb[_0x88bf('0x2d')]);_0x4ce5e7['filters']=_[_0x88bf('0x30')](_0x4ce5e7['model'],_0x4ce5e7[_0x88bf('0x2d')]);_0x47a918['attributes']=_[_0x88bf('0x30')](_0x4ce5e7[_0x88bf('0x2c')],qs[_0x88bf('0x32')](_0x20bbeb['query']['fields']));_0x47a918[_0x88bf('0x31')]=_0x47a918['attributes'][_0x88bf('0x33')]?_0x47a918[_0x88bf('0x31')]:_0x4ce5e7[_0x88bf('0x2c')];_0x47a918[_0x88bf('0x45')]=qs[_0x88bf('0x35')](_0x20bbeb['query'][_0x88bf('0x35')]);_0x47a918[_0x88bf('0x36')]=qs['filters'](_[_0x88bf('0x37')](_0x20bbeb['query'],_0x4ce5e7['filters']));if(_0x20bbeb['query']['filter']){_0x47a918[_0x88bf('0x36')]=_[_0x88bf('0x3a')](_0x47a918[_0x88bf('0x36')],{'$or':_['map'](_0x47a918['attributes'],function(_0x8ee3c3){var _0xf1aac0={};_0xf1aac0[_0x8ee3c3]={'$like':'%'+_0x20bbeb[_0x88bf('0x2d')][_0x88bf('0x39')]+'%'};return _0xf1aac0;})});}_0x47a918=_['merge']({},_0x47a918,_0x20bbeb[_0x88bf('0x3b')]);return _0x30bbfe['getSubjects'](_0x47a918);}})[_0x88bf('0x22')](function(_0x214b49){if(_0x214b49){_0x20c3ea=_0x214b49[_0x88bf('0x33')];if(!_0x20bbeb[_0x88bf('0x2d')][_0x88bf('0x47')](_0x88bf('0x34'))){_0x47a918['limit']=qs['limit'](_0x20bbeb[_0x88bf('0x2d')][_0x88bf('0x1d')]);_0x47a918[_0x88bf('0x1b')]=qs['offset'](_0x20bbeb[_0x88bf('0x2d')][_0x88bf('0x1b')]);}return _0x30bbfe[_0x88bf('0x48')](_0x47a918);}})[_0x88bf('0x22')](function(_0x315780){if(_0x315780){return _0x315780?{'count':_0x20c3ea,'rows':_0x315780}:null;}})[_0x88bf('0x22')](respondWithResult(_0x477673,null))[_0x88bf('0x3f')](handleError(_0x477673,null));};exports[_0x88bf('0x49')]=function(_0x5d827f,_0xee3b2a,_0x56bcc7){var _0x6d28d7={};var _0x3c0ce1={};var _0x1fa9f0;var _0x13d7d9;return db[_0x88bf('0x27')][_0x88bf('0x4a')]({'where':{'id':_0x5d827f[_0x88bf('0x44')]['id']}})['then'](handleEntityNotFound(_0xee3b2a,null))[_0x88bf('0x22')](function(_0x1ebff3){if(_0x1ebff3){_0x1fa9f0=_0x1ebff3;_0x3c0ce1[_0x88bf('0x2c')]=_[_0x88bf('0x2e')](db[_0x88bf('0x4b')][_0x88bf('0x28')]);_0x3c0ce1[_0x88bf('0x2d')]=_[_0x88bf('0x2e')](_0x5d827f[_0x88bf('0x2d')]);_0x3c0ce1['filters']=_[_0x88bf('0x30')](_0x3c0ce1[_0x88bf('0x2c')],_0x3c0ce1['query']);_0x6d28d7[_0x88bf('0x31')]=_[_0x88bf('0x30')](_0x3c0ce1[_0x88bf('0x2c')],qs[_0x88bf('0x32')](_0x5d827f['query'][_0x88bf('0x32')]));_0x6d28d7[_0x88bf('0x31')]=_0x6d28d7['attributes'][_0x88bf('0x33')]?_0x6d28d7[_0x88bf('0x31')]:_0x3c0ce1[_0x88bf('0x2c')];_0x6d28d7[_0x88bf('0x45')]=qs['sort'](_0x5d827f[_0x88bf('0x2d')]['sort']);_0x6d28d7[_0x88bf('0x36')]=qs[_0x88bf('0x2f')](_[_0x88bf('0x37')](_0x5d827f[_0x88bf('0x2d')],_0x3c0ce1[_0x88bf('0x2f')]));if(_0x5d827f[_0x88bf('0x2d')][_0x88bf('0x39')]){_0x6d28d7['where']=_[_0x88bf('0x3a')](_0x6d28d7[_0x88bf('0x36')],{'$or':_[_0x88bf('0x26')](_0x6d28d7['attributes'],function(_0x3a311e){var _0x41e273={};_0x41e273[_0x3a311e]={'$like':'%'+_0x5d827f[_0x88bf('0x2d')][_0x88bf('0x39')]+'%'};return _0x41e273;})});}_0x6d28d7=_[_0x88bf('0x3a')]({},_0x6d28d7,_0x5d827f[_0x88bf('0x3b')]);return _0x1fa9f0[_0x88bf('0x49')](_0x6d28d7);}})['then'](function(_0x156419){if(_0x156419){_0x13d7d9=_0x156419[_0x88bf('0x33')];if(!_0x5d827f[_0x88bf('0x2d')]['hasOwnProperty'](_0x88bf('0x34'))){_0x6d28d7[_0x88bf('0x1d')]=qs[_0x88bf('0x1d')](_0x5d827f[_0x88bf('0x2d')]['limit']);_0x6d28d7['offset']=qs[_0x88bf('0x1b')](_0x5d827f[_0x88bf('0x2d')][_0x88bf('0x1b')]);}return _0x1fa9f0[_0x88bf('0x49')](_0x6d28d7);}})[_0x88bf('0x22')](function(_0x2195a6){if(_0x2195a6){return _0x2195a6?{'count':_0x13d7d9,'rows':_0x2195a6}:null;}})['then'](respondWithResult(_0xee3b2a,null))[_0x88bf('0x3f')](handleError(_0xee3b2a,null));}; \ No newline at end of file +var _0x0c9c=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','show','params','keys','find','catch','create','body','getFields','findOne','SalesforceField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc0c9('0x0'));var rimraf=require(_0xc0c9('0x1'));var zipdir=require(_0xc0c9('0x2'));var jsonpatch=require(_0xc0c9('0x3'));var rp=require('request-promise');var moment=require(_0xc0c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc0c9('0x5'));var util=require(_0xc0c9('0x6'));var path=require(_0xc0c9('0x7'));var sox=require(_0xc0c9('0x8'));var csv=require(_0xc0c9('0x9'));var ejs=require(_0xc0c9('0xa'));var fs=require('fs');var fs_extra=require(_0xc0c9('0xb'));var _=require(_0xc0c9('0xc'));var squel=require(_0xc0c9('0xd'));var crypto=require(_0xc0c9('0xe'));var jsforce=require(_0xc0c9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc0c9('0x9'));var querystring=require(_0xc0c9('0x10'));var Papa=require(_0xc0c9('0x11'));var Redis=require(_0xc0c9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc0c9('0x13'));var as=require(_0xc0c9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0c9('0x15'))('api');var utils=require(_0xc0c9('0x16'));var config=require(_0xc0c9('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3181e3,_0xebab88){_0xebab88=_0xebab88||0xcc;return function(_0x17613d){if(_0x17613d){return _0x3181e3[_0xc0c9('0x18')](_0xebab88);}return _0x3181e3[_0xc0c9('0x19')](_0xebab88)[_0xc0c9('0x1a')]();};}function respondWithResult(_0x10406a,_0x43e6b4){_0x43e6b4=_0x43e6b4||0xc8;return function(_0x4cac4c){if(_0x4cac4c){return _0x10406a['status'](_0x43e6b4)[_0xc0c9('0x1b')](_0x4cac4c);}};}function respondWithFilteredResult(_0x413f84,_0x2c4879){return function(_0x254722){if(_0x254722){var _0x4fad7e=typeof _0x2c4879[_0xc0c9('0x1c')]===_0xc0c9('0x1d')&&typeof _0x2c4879[_0xc0c9('0x1e')]===_0xc0c9('0x1d');var _0x49045f=_0x254722[_0xc0c9('0x1f')];var _0x40ecaa=_0x4fad7e?0x0:_0x2c4879[_0xc0c9('0x1c')];var _0xa6ea55=_0x4fad7e?_0x254722[_0xc0c9('0x1f')]:_0x2c4879[_0xc0c9('0x1c')]+_0x2c4879[_0xc0c9('0x1e')];var _0xa5ea7e;if(_0xa6ea55>=_0x49045f){_0xa6ea55=_0x49045f;_0xa5ea7e=0xc8;}else{_0xa5ea7e=0xce;}_0x413f84[_0xc0c9('0x19')](_0xa5ea7e);return _0x413f84[_0xc0c9('0x20')](_0xc0c9('0x21'),_0x40ecaa+'-'+_0xa6ea55+'/'+_0x49045f)['json'](_0x254722);}return null;};}function patchUpdates(_0xdafb56){return function(_0x361a09){try{jsonpatch[_0xc0c9('0x22')](_0x361a09,_0xdafb56,!![]);}catch(_0x4ad456){return BPromise[_0xc0c9('0x23')](_0x4ad456);}return _0x361a09[_0xc0c9('0x24')]();};}function saveUpdates(_0x1c2170,_0x436616){return function(_0x4385c1){if(_0x4385c1){return _0x4385c1[_0xc0c9('0x25')](_0x1c2170)[_0xc0c9('0x26')](function(_0x1e82ee){return _0x1e82ee;});}return null;};}function removeEntity(_0x27542d,_0x1144b9){return function(_0x5cc111){if(_0x5cc111){return _0x5cc111[_0xc0c9('0x27')]()[_0xc0c9('0x26')](function(){_0x27542d[_0xc0c9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2366be,_0x485489){return function(_0x59d65f){if(!_0x59d65f){_0x2366be[_0xc0c9('0x18')](0x194);}return _0x59d65f;};}function handleError(_0x1fefe9,_0x2afb6f){_0x2afb6f=_0x2afb6f||0x1f4;return function(_0xbd7e47){logger[_0xc0c9('0x28')](_0xbd7e47[_0xc0c9('0x29')]);if(_0xbd7e47['name']){delete _0xbd7e47[_0xc0c9('0x2a')];}_0x1fefe9[_0xc0c9('0x19')](_0x2afb6f)[_0xc0c9('0x2b')](_0xbd7e47);};}exports[_0xc0c9('0x2c')]=function(_0x126c34,_0x4e3e2c){var _0x4327ce={},_0x1171a6={},_0xa46694={'count':0x0,'rows':[]};var _0x594e61=_['map'](db['SalesforceConfiguration'][_0xc0c9('0x2d')],function(_0x24a33a){return{'name':_0x24a33a[_0xc0c9('0x2e')],'type':_0x24a33a[_0xc0c9('0x2f')][_0xc0c9('0x30')]};});_0x1171a6[_0xc0c9('0x31')]=_[_0xc0c9('0x32')](_0x594e61,_0xc0c9('0x2a'));_0x1171a6[_0xc0c9('0x33')]=_['keys'](_0x126c34[_0xc0c9('0x33')]);_0x1171a6[_0xc0c9('0x34')]=_[_0xc0c9('0x35')](_0x1171a6['model'],_0x1171a6['query']);_0x4327ce[_0xc0c9('0x36')]=_[_0xc0c9('0x35')](_0x1171a6[_0xc0c9('0x31')],qs[_0xc0c9('0x37')](_0x126c34[_0xc0c9('0x33')]['fields']));_0x4327ce[_0xc0c9('0x36')]=_0x4327ce[_0xc0c9('0x36')][_0xc0c9('0x38')]?_0x4327ce['attributes']:_0x1171a6[_0xc0c9('0x31')];if(!_0x126c34[_0xc0c9('0x33')]['hasOwnProperty'](_0xc0c9('0x39'))){_0x4327ce['limit']=qs[_0xc0c9('0x1e')](_0x126c34['query']['limit']);_0x4327ce[_0xc0c9('0x1c')]=qs[_0xc0c9('0x1c')](_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x1c')]);}_0x4327ce[_0xc0c9('0x3a')]=qs[_0xc0c9('0x3b')](_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x3b')]);_0x4327ce[_0xc0c9('0x3c')]=qs[_0xc0c9('0x34')](_[_0xc0c9('0x3d')](_0x126c34[_0xc0c9('0x33')],_0x1171a6[_0xc0c9('0x34')]),_0x594e61);if(_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x3e')]){_0x4327ce[_0xc0c9('0x3c')]=_[_0xc0c9('0x3f')](_0x4327ce[_0xc0c9('0x3c')],{'$or':_['map'](_0x594e61,function(_0x2547ea){if(_0x2547ea[_0xc0c9('0x2f')]!==_0xc0c9('0x40')){var _0x286e30={};_0x286e30[_0x2547ea['name']]={'$like':'%'+_0x126c34[_0xc0c9('0x33')]['filter']+'%'};return _0x286e30;}})});}_0x4327ce=_[_0xc0c9('0x3f')]({},_0x4327ce,_0x126c34[_0xc0c9('0x41')]);var _0x3d4953={'where':_0x4327ce['where']};return db['SalesforceConfiguration'][_0xc0c9('0x1f')](_0x3d4953)[_0xc0c9('0x26')](function(_0x1605b1){_0xa46694[_0xc0c9('0x1f')]=_0x1605b1;if(_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x42')]){_0x4327ce[_0xc0c9('0x43')]=[{'all':!![]}];}return db[_0xc0c9('0x44')][_0xc0c9('0x45')](_0x4327ce);})[_0xc0c9('0x26')](function(_0x16e875){_0xa46694[_0xc0c9('0x46')]=_0x16e875;return _0xa46694;})[_0xc0c9('0x26')](respondWithFilteredResult(_0x4e3e2c,_0x4327ce))['catch'](handleError(_0x4e3e2c,null));};exports[_0xc0c9('0x47')]=function(_0x103c3b,_0x527552){var _0x4d836e={'raw':![],'where':{'id':_0x103c3b[_0xc0c9('0x48')]['id']}},_0xdc29bc={};_0xdc29bc[_0xc0c9('0x31')]=_[_0xc0c9('0x49')](db[_0xc0c9('0x44')]['rawAttributes']);_0xdc29bc[_0xc0c9('0x33')]=_['keys'](_0x103c3b['query']);_0xdc29bc[_0xc0c9('0x34')]=_[_0xc0c9('0x35')](_0xdc29bc['model'],_0xdc29bc[_0xc0c9('0x33')]);_0x4d836e[_0xc0c9('0x36')]=_[_0xc0c9('0x35')](_0xdc29bc['model'],qs['fields'](_0x103c3b[_0xc0c9('0x33')][_0xc0c9('0x37')]));_0x4d836e[_0xc0c9('0x36')]=_0x4d836e[_0xc0c9('0x36')][_0xc0c9('0x38')]?_0x4d836e[_0xc0c9('0x36')]:_0xdc29bc[_0xc0c9('0x31')];if(_0x103c3b['query'][_0xc0c9('0x42')]){_0x4d836e[_0xc0c9('0x43')]=[{'all':!![]}];}_0x4d836e=_[_0xc0c9('0x3f')]({},_0x4d836e,_0x103c3b['options']);return db[_0xc0c9('0x44')][_0xc0c9('0x4a')](_0x4d836e)[_0xc0c9('0x26')](handleEntityNotFound(_0x527552,null))[_0xc0c9('0x26')](respondWithResult(_0x527552,null))[_0xc0c9('0x4b')](handleError(_0x527552,null));};exports[_0xc0c9('0x4c')]=function(_0x1e9fb2,_0x172d2f){return db[_0xc0c9('0x44')][_0xc0c9('0x4c')](_0x1e9fb2['body'],{})['then'](respondWithResult(_0x172d2f,0xc9))['catch'](handleError(_0x172d2f,null));};exports[_0xc0c9('0x25')]=function(_0x2aa7ae,_0x14ed1){if(_0x2aa7ae[_0xc0c9('0x4d')]['id']){delete _0x2aa7ae['body']['id'];}return db[_0xc0c9('0x44')]['find']({'where':{'id':_0x2aa7ae[_0xc0c9('0x48')]['id']}})[_0xc0c9('0x26')](handleEntityNotFound(_0x14ed1,null))[_0xc0c9('0x26')](saveUpdates(_0x2aa7ae[_0xc0c9('0x4d')],null))[_0xc0c9('0x26')](respondWithResult(_0x14ed1,null))[_0xc0c9('0x4b')](handleError(_0x14ed1,null));};exports[_0xc0c9('0x27')]=function(_0x450679,_0x5bb665){return db[_0xc0c9('0x44')][_0xc0c9('0x4a')]({'where':{'id':_0x450679[_0xc0c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bb665,null))[_0xc0c9('0x26')](removeEntity(_0x5bb665,null))[_0xc0c9('0x4b')](handleError(_0x5bb665,null));};exports[_0xc0c9('0x4e')]=function(_0x1d85b3,_0x312d4a,_0x48222e){var _0x2ab3e1={};var _0x3d4955={};var _0x44a847;var _0x48fb6f;return db[_0xc0c9('0x44')][_0xc0c9('0x4f')]({'where':{'id':_0x1d85b3['params']['id']}})[_0xc0c9('0x26')](handleEntityNotFound(_0x312d4a,null))[_0xc0c9('0x26')](function(_0x53c329){if(_0x53c329){_0x44a847=_0x53c329;_0x3d4955[_0xc0c9('0x31')]=_[_0xc0c9('0x49')](db[_0xc0c9('0x50')][_0xc0c9('0x2d')]);_0x3d4955[_0xc0c9('0x33')]=_[_0xc0c9('0x49')](_0x1d85b3[_0xc0c9('0x33')]);_0x3d4955[_0xc0c9('0x34')]=_[_0xc0c9('0x35')](_0x3d4955['model'],_0x3d4955[_0xc0c9('0x33')]);_0x2ab3e1['attributes']=_[_0xc0c9('0x35')](_0x3d4955[_0xc0c9('0x31')],qs['fields'](_0x1d85b3[_0xc0c9('0x33')][_0xc0c9('0x37')]));_0x2ab3e1[_0xc0c9('0x36')]=_0x2ab3e1[_0xc0c9('0x36')][_0xc0c9('0x38')]?_0x2ab3e1[_0xc0c9('0x36')]:_0x3d4955[_0xc0c9('0x31')];_0x2ab3e1['order']=qs[_0xc0c9('0x3b')](_0x1d85b3[_0xc0c9('0x33')][_0xc0c9('0x3b')]);_0x2ab3e1[_0xc0c9('0x3c')]=qs[_0xc0c9('0x34')](_[_0xc0c9('0x3d')](_0x1d85b3[_0xc0c9('0x33')],_0x3d4955[_0xc0c9('0x34')]));if(_0x1d85b3['query'][_0xc0c9('0x3e')]){_0x2ab3e1[_0xc0c9('0x3c')]=_['merge'](_0x2ab3e1[_0xc0c9('0x3c')],{'$or':_[_0xc0c9('0x32')](_0x2ab3e1[_0xc0c9('0x36')],function(_0x1acac3){var _0x4b10c0={};_0x4b10c0[_0x1acac3]={'$like':'%'+_0x1d85b3[_0xc0c9('0x33')][_0xc0c9('0x3e')]+'%'};return _0x4b10c0;})});}_0x2ab3e1=_[_0xc0c9('0x3f')]({},_0x2ab3e1,_0x1d85b3[_0xc0c9('0x41')]);return _0x44a847[_0xc0c9('0x4e')](_0x2ab3e1);}})[_0xc0c9('0x26')](function(_0x386e9a){if(_0x386e9a){_0x48fb6f=_0x386e9a['length'];if(!_0x1d85b3[_0xc0c9('0x33')]['hasOwnProperty'](_0xc0c9('0x39'))){_0x2ab3e1[_0xc0c9('0x1e')]=qs[_0xc0c9('0x1e')](_0x1d85b3[_0xc0c9('0x33')][_0xc0c9('0x1e')]);_0x2ab3e1[_0xc0c9('0x1c')]=qs[_0xc0c9('0x1c')](_0x1d85b3[_0xc0c9('0x33')]['offset']);}return _0x44a847[_0xc0c9('0x4e')](_0x2ab3e1);}})['then'](function(_0x804341){if(_0x804341){return _0x804341?{'count':_0x48fb6f,'rows':_0x804341}:null;}})['then'](respondWithResult(_0x312d4a,null))['catch'](handleError(_0x312d4a,null));};exports[_0xc0c9('0x51')]=function(_0x1152c4,_0x36199a,_0x3be2a8){var _0x3a8750={};var _0x28b5ca={};var _0x446c71;var _0x128017;return db[_0xc0c9('0x44')]['findOne']({'where':{'id':_0x1152c4[_0xc0c9('0x48')]['id']}})[_0xc0c9('0x26')](handleEntityNotFound(_0x36199a,null))[_0xc0c9('0x26')](function(_0x7396cd){if(_0x7396cd){_0x446c71=_0x7396cd;_0x28b5ca[_0xc0c9('0x31')]=_['keys'](db[_0xc0c9('0x50')][_0xc0c9('0x2d')]);_0x28b5ca['query']=_[_0xc0c9('0x49')](_0x1152c4[_0xc0c9('0x33')]);_0x28b5ca[_0xc0c9('0x34')]=_[_0xc0c9('0x35')](_0x28b5ca['model'],_0x28b5ca['query']);_0x3a8750[_0xc0c9('0x36')]=_[_0xc0c9('0x35')](_0x28b5ca['model'],qs[_0xc0c9('0x37')](_0x1152c4[_0xc0c9('0x33')][_0xc0c9('0x37')]));_0x3a8750[_0xc0c9('0x36')]=_0x3a8750[_0xc0c9('0x36')][_0xc0c9('0x38')]?_0x3a8750[_0xc0c9('0x36')]:_0x28b5ca['model'];_0x3a8750[_0xc0c9('0x3a')]=qs[_0xc0c9('0x3b')](_0x1152c4[_0xc0c9('0x33')]['sort']);_0x3a8750[_0xc0c9('0x3c')]=qs[_0xc0c9('0x34')](_['pick'](_0x1152c4[_0xc0c9('0x33')],_0x28b5ca['filters']));if(_0x1152c4[_0xc0c9('0x33')]['filter']){_0x3a8750[_0xc0c9('0x3c')]=_[_0xc0c9('0x3f')](_0x3a8750[_0xc0c9('0x3c')],{'$or':_['map'](_0x3a8750[_0xc0c9('0x36')],function(_0x40ac38){var _0x17be1f={};_0x17be1f[_0x40ac38]={'$like':'%'+_0x1152c4['query'][_0xc0c9('0x3e')]+'%'};return _0x17be1f;})});}_0x3a8750=_[_0xc0c9('0x3f')]({},_0x3a8750,_0x1152c4[_0xc0c9('0x41')]);return _0x446c71[_0xc0c9('0x51')](_0x3a8750);}})['then'](function(_0x55b6ba){if(_0x55b6ba){_0x128017=_0x55b6ba['length'];if(!_0x1152c4['query'][_0xc0c9('0x52')]('nolimit')){_0x3a8750[_0xc0c9('0x1e')]=qs[_0xc0c9('0x1e')](_0x1152c4[_0xc0c9('0x33')][_0xc0c9('0x1e')]);_0x3a8750[_0xc0c9('0x1c')]=qs[_0xc0c9('0x1c')](_0x1152c4[_0xc0c9('0x33')][_0xc0c9('0x1c')]);}return _0x446c71[_0xc0c9('0x51')](_0x3a8750);}})[_0xc0c9('0x26')](function(_0x4be5d5){if(_0x4be5d5){return _0x4be5d5?{'count':_0x128017,'rows':_0x4be5d5}:null;}})['then'](respondWithResult(_0x36199a,null))['catch'](handleError(_0x36199a,null));};exports['getDescriptions']=function(_0x53d96f,_0x2b0f7e,_0x3bc4c1){var _0x5dc759={};var _0xb18d63={};var _0x57db6d;var _0x2ce9f3;return db[_0xc0c9('0x44')][_0xc0c9('0x4f')]({'where':{'id':_0x53d96f[_0xc0c9('0x48')]['id']}})[_0xc0c9('0x26')](handleEntityNotFound(_0x2b0f7e,null))['then'](function(_0x3c23c3){if(_0x3c23c3){_0x57db6d=_0x3c23c3;_0xb18d63['model']=_[_0xc0c9('0x49')](db[_0xc0c9('0x50')]['rawAttributes']);_0xb18d63[_0xc0c9('0x33')]=_[_0xc0c9('0x49')](_0x53d96f['query']);_0xb18d63[_0xc0c9('0x34')]=_[_0xc0c9('0x35')](_0xb18d63[_0xc0c9('0x31')],_0xb18d63[_0xc0c9('0x33')]);_0x5dc759[_0xc0c9('0x36')]=_[_0xc0c9('0x35')](_0xb18d63[_0xc0c9('0x31')],qs[_0xc0c9('0x37')](_0x53d96f[_0xc0c9('0x33')][_0xc0c9('0x37')]));_0x5dc759[_0xc0c9('0x36')]=_0x5dc759['attributes'][_0xc0c9('0x38')]?_0x5dc759[_0xc0c9('0x36')]:_0xb18d63[_0xc0c9('0x31')];_0x5dc759[_0xc0c9('0x3a')]=qs[_0xc0c9('0x3b')](_0x53d96f[_0xc0c9('0x33')][_0xc0c9('0x3b')]);_0x5dc759[_0xc0c9('0x3c')]=qs['filters'](_[_0xc0c9('0x3d')](_0x53d96f['query'],_0xb18d63['filters']));if(_0x53d96f['query'][_0xc0c9('0x3e')]){_0x5dc759[_0xc0c9('0x3c')]=_['merge'](_0x5dc759[_0xc0c9('0x3c')],{'$or':_[_0xc0c9('0x32')](_0x5dc759[_0xc0c9('0x36')],function(_0x442adb){var _0x17acd8={};_0x17acd8[_0x442adb]={'$like':'%'+_0x53d96f['query'][_0xc0c9('0x3e')]+'%'};return _0x17acd8;})});}_0x5dc759=_[_0xc0c9('0x3f')]({},_0x5dc759,_0x53d96f[_0xc0c9('0x41')]);return _0x57db6d[_0xc0c9('0x53')](_0x5dc759);}})[_0xc0c9('0x26')](function(_0x21f9bd){if(_0x21f9bd){_0x2ce9f3=_0x21f9bd[_0xc0c9('0x38')];if(!_0x53d96f[_0xc0c9('0x33')][_0xc0c9('0x52')](_0xc0c9('0x39'))){_0x5dc759['limit']=qs['limit'](_0x53d96f[_0xc0c9('0x33')][_0xc0c9('0x1e')]);_0x5dc759[_0xc0c9('0x1c')]=qs[_0xc0c9('0x1c')](_0x53d96f[_0xc0c9('0x33')][_0xc0c9('0x1c')]);}return _0x57db6d['getDescriptions'](_0x5dc759);}})['then'](function(_0x16aaa8){if(_0x16aaa8){return _0x16aaa8?{'count':_0x2ce9f3,'rows':_0x16aaa8}:null;}})[_0xc0c9('0x26')](respondWithResult(_0x2b0f7e,null))[_0xc0c9('0x4b')](handleError(_0x2b0f7e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4b59a9e..342954a 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 _0x1fe3=['int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x3d5c4f,_0x57f9b1){var _0x2f29b7=function(_0x5add9a){while(--_0x5add9a){_0x3d5c4f['push'](_0x3d5c4f['shift']());}};_0x2f29b7(++_0x57f9b1);}(_0x1fe3,0x12c));var _0x31fe=function(_0x5d52ca,_0x30915b){_0x5d52ca=_0x5d52ca-0x0;var _0x556044=_0x1fe3[_0x5d52ca];return _0x556044;};'use strict';var _=require(_0x31fe('0x0'));var util=require(_0x31fe('0x1'));var logger=require(_0x31fe('0x2'))('api');var moment=require(_0x31fe('0x3'));var BPromise=require(_0x31fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31fe('0x5'));var rimraf=require(_0x31fe('0x6'));var config=require(_0x31fe('0x7'));var attributes=require(_0x31fe('0x8'));module[_0x31fe('0x9')]=function(_0x430f15,_0x189a80){return _0x430f15[_0x31fe('0xa')](_0x31fe('0xb'),attributes,{'tableName':_0x31fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa09=['api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x46864e,_0x14c53c){var _0x2cf14d=function(_0x5d647b){while(--_0x5d647b){_0x46864e['push'](_0x46864e['shift']());}};_0x2cf14d(++_0x14c53c);}(_0xfa09,0x172));var _0x9fa0=function(_0x23d631,_0x408800){_0x23d631=_0x23d631-0x0;var _0x37b607=_0xfa09[_0x23d631];return _0x37b607;};'use strict';var _=require(_0x9fa0('0x0'));var util=require(_0x9fa0('0x1'));var logger=require('../../config/logger')(_0x9fa0('0x2'));var moment=require(_0x9fa0('0x3'));var BPromise=require(_0x9fa0('0x4'));var rp=require(_0x9fa0('0x5'));var fs=require('fs');var path=require(_0x9fa0('0x6'));var rimraf=require('rimraf');var config=require(_0x9fa0('0x7'));var attributes=require(_0x9fa0('0x8'));module[_0x9fa0('0x9')]=function(_0x142878,_0x1d7615){return _0x142878['define'](_0x9fa0('0xa'),attributes,{'tableName':_0x9fa0('0xb'),'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 1be01a8..4f8d0dc 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 _0xe27b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','lodash'];(function(_0x51ce14,_0x5cd58b){var _0x301a2d=function(_0x85fdf){while(--_0x85fdf){_0x51ce14['push'](_0x51ce14['shift']());}};_0x301a2d(++_0x5cd58b);}(_0xe27b,0x1cd));var _0xbe27=function(_0x103356,_0x473a6d){_0x103356=_0x103356-0x0;var _0x1ebbd0=_0xe27b[_0x103356];return _0x1ebbd0;};'use strict';var _=require(_0xbe27('0x0'));var util=require(_0xbe27('0x1'));var moment=require(_0xbe27('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe27('0x3'));var fs=require('fs');var Redis=require(_0xbe27('0x4'));var db=require(_0xbe27('0x5'))['db'];var utils=require(_0xbe27('0x6'));var logger=require(_0xbe27('0x7'))(_0xbe27('0x8'));var config=require(_0xbe27('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe27('0xa')][_0xbe27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bc625,_0x35ae2e,_0x2e6664){return new BPromise(function(_0x189095,_0x279d2e){return client['request'](_0x2bc625,_0x2e6664)[_0xbe27('0xc')](function(_0x509089){logger[_0xbe27('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x35ae2e,'request\x20sent');logger['debug'](_0xbe27('0xe'),_0x35ae2e,_0xbe27('0xf'),JSON[_0xbe27('0x10')](_0x509089));if(_0x509089[_0xbe27('0x11')]){if(_0x509089[_0xbe27('0x11')][_0xbe27('0x12')]===0x1f4){logger[_0xbe27('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x35ae2e,_0x509089['error'][_0xbe27('0x13')]);return _0x279d2e(_0x509089[_0xbe27('0x11')]['message']);}logger[_0xbe27('0x11')](_0xbe27('0x14'),_0x35ae2e,_0x509089[_0xbe27('0x11')][_0xbe27('0x13')]);return _0x189095(_0x509089[_0xbe27('0x11')]['message']);}else{logger[_0xbe27('0xd')](_0xbe27('0x14'),_0x35ae2e,'request\x20sent');_0x189095(_0x509089['result'][_0xbe27('0x13')]);}})['catch'](function(_0x3839bd){logger[_0xbe27('0x11')](_0xbe27('0x14'),_0x35ae2e,_0x3839bd);_0x279d2e(_0x3839bd);});});} \ No newline at end of file +var _0x27b6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x27b6,0xbe));var _0x627b=function(_0x5480d0,_0x1f0425){_0x5480d0=_0x5480d0-0x0;var _0x3c9d3f=_0x27b6[_0x5480d0];return _0x3c9d3f;};'use strict';var _=require(_0x627b('0x0'));var util=require(_0x627b('0x1'));var moment=require('moment');var BPromise=require(_0x627b('0x2'));var rs=require(_0x627b('0x3'));var fs=require('fs');var Redis=require(_0x627b('0x4'));var db=require(_0x627b('0x5'))['db'];var utils=require(_0x627b('0x6'));var logger=require(_0x627b('0x7'))(_0x627b('0x8'));var config=require('../../config/environment');var jayson=require(_0x627b('0x9'));var client=jayson[_0x627b('0xa')][_0x627b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eea4e,_0x109926,_0x4d511d){return new BPromise(function(_0x5baa5b,_0x319dd7){return client['request'](_0x5eea4e,_0x4d511d)[_0x627b('0xc')](function(_0x391971){logger[_0x627b('0xd')](_0x627b('0xe'),_0x109926,_0x627b('0xf'));logger[_0x627b('0x10')](_0x627b('0x11'),_0x109926,_0x627b('0xf'),JSON[_0x627b('0x12')](_0x391971));if(_0x391971[_0x627b('0x13')]){if(_0x391971[_0x627b('0x13')][_0x627b('0x14')]===0x1f4){logger[_0x627b('0x13')](_0x627b('0xe'),_0x109926,_0x391971[_0x627b('0x13')][_0x627b('0x15')]);return _0x319dd7(_0x391971[_0x627b('0x13')][_0x627b('0x15')]);}logger[_0x627b('0x13')](_0x627b('0xe'),_0x109926,_0x391971[_0x627b('0x13')][_0x627b('0x15')]);return _0x5baa5b(_0x391971[_0x627b('0x13')][_0x627b('0x15')]);}else{logger[_0x627b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x109926,_0x627b('0xf'));_0x5baa5b(_0x391971[_0x627b('0x16')][_0x627b('0x15')]);}})[_0x627b('0x17')](function(_0x4751c7){logger['error'](_0x627b('0xe'),_0x109926,_0x4751c7);_0x319dd7(_0x4751c7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 160ce07..bfd390a 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 _0x0b96=['/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','create','put','update','delete'];(function(_0x2eaf99,_0x4022b6){var _0x471353=function(_0x13448c){while(--_0x13448c){_0x2eaf99['push'](_0x2eaf99['shift']());}};_0x471353(++_0x4022b6);}(_0x0b96,0x159));var _0x60b9=function(_0x2f3b14,_0x554f94){_0x2f3b14=_0x2f3b14-0x0;var _0x20e924=_0x0b96[_0x2f3b14];return _0x20e924;};'use strict';var multer=require(_0x60b9('0x0'));var util=require('util');var path=require(_0x60b9('0x1'));var timeout=require('connect-timeout');var express=require(_0x60b9('0x2'));var router=express[_0x60b9('0x3')]();var fs_extra=require(_0x60b9('0x4'));var auth=require(_0x60b9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x60b9('0x6'));var controller=require('./intSalesforceField.controller');router[_0x60b9('0x7')]('/',auth[_0x60b9('0x8')](),controller[_0x60b9('0x9')]);router['get']('/:id',auth[_0x60b9('0x8')](),controller['show']);router[_0x60b9('0xa')]('/',auth[_0x60b9('0x8')](),controller[_0x60b9('0xb')]);router[_0x60b9('0xc')]('/:id',auth[_0x60b9('0x8')](),controller[_0x60b9('0xd')]);router[_0x60b9('0xe')](_0x60b9('0xf'),auth[_0x60b9('0x8')](),controller[_0x60b9('0x10')]);module[_0x60b9('0x11')]=router; \ No newline at end of file +var _0xdd29=['post','create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdd29,0xde));var _0x9dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd29[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9dd2('0x0'));var util=require(_0x9dd2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9dd2('0x2'));var router=express[_0x9dd2('0x3')]();var fs_extra=require(_0x9dd2('0x4'));var auth=require(_0x9dd2('0x5'));var interaction=require(_0x9dd2('0x6'));var config=require('../../config/environment');var controller=require(_0x9dd2('0x7'));router[_0x9dd2('0x8')]('/',auth[_0x9dd2('0x9')](),controller[_0x9dd2('0xa')]);router[_0x9dd2('0x8')](_0x9dd2('0xb'),auth[_0x9dd2('0x9')](),controller['show']);router[_0x9dd2('0xc')]('/',auth['isAuthenticated'](),controller[_0x9dd2('0xd')]);router['put'](_0x9dd2('0xb'),auth[_0x9dd2('0x9')](),controller[_0x9dd2('0xe')]);router[_0x9dd2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9dd2('0x10')]);module[_0x9dd2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cfd51d7..3e9e264 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 _0x06cd=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1f5d35,_0x13db91){var _0x27355a=function(_0x1a3932){while(--_0x1a3932){_0x1f5d35['push'](_0x1f5d35['shift']());}};_0x27355a(++_0x13db91);}(_0x06cd,0x15f));var _0xd06c=function(_0x2cebed,_0x4659e7){_0x2cebed=_0x2cebed-0x0;var _0x217ee3=_0x06cd[_0x2cebed];return _0x217ee3;};'use strict';var Sequelize=require(_0xd06c('0x0'));module[_0xd06c('0x1')]={'type':{'type':Sequelize[_0xd06c('0x2')](_0xd06c('0x3'),_0xd06c('0x4'),_0xd06c('0x5'),_0xd06c('0x6'),_0xd06c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd06c('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd06c('0x2')](_0xd06c('0x3'),_0xd06c('0x4'),_0xd06c('0x5'))},'keyContent':{'type':Sequelize[_0xd06c('0x8')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xd06c('0x8')]}}; \ No newline at end of file +var _0x3460=['customVariable','picklist','STRING','variable','sequelize','ENUM','string'];(function(_0xb8a99,_0x18398b){var _0xc29c09=function(_0x54b514){while(--_0x54b514){_0xb8a99['push'](_0xb8a99['shift']());}};_0xc29c09(++_0x18398b);}(_0x3460,0xc1));var _0x0346=function(_0x30f2bd,_0x361f7c){_0x30f2bd=_0x30f2bd-0x0;var _0x3801ef=_0x3460[_0x30f2bd];return _0x3801ef;};'use strict';var Sequelize=require(_0x0346('0x0'));module['exports']={'type':{'type':Sequelize[_0x0346('0x1')](_0x0346('0x2'),'variable',_0x0346('0x3'),'keyValue',_0x0346('0x4')),'defaultValue':_0x0346('0x2')},'content':{'type':Sequelize[_0x0346('0x5')]},'key':{'type':Sequelize[_0x0346('0x5')]},'keyType':{'type':Sequelize[_0x0346('0x1')](_0x0346('0x2'),_0x0346('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ec23a3a..b73b34f 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 _0x408a=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','name','send','index','map','SalesforceField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','destroy','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv'];(function(_0xe66bd8,_0x5b6d8e){var _0x24c892=function(_0x2ec3d9){while(--_0x2ec3d9){_0xe66bd8['push'](_0xe66bd8['shift']());}};_0x24c892(++_0x5b6d8e);}(_0x408a,0x120));var _0xa408=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x408a[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa408('0x0'));var zipdir=require(_0xa408('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa408('0x2'));var moment=require('moment');var BPromise=require(_0xa408('0x3'));var Mustache=require('mustache');var util=require(_0xa408('0x4'));var path=require(_0xa408('0x5'));var sox=require(_0xa408('0x6'));var csv=require(_0xa408('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa408('0x8'));var _=require(_0xa408('0x9'));var squel=require(_0xa408('0xa'));var crypto=require(_0xa408('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa408('0xc'));var toCsv=require(_0xa408('0x7'));var querystring=require(_0xa408('0xd'));var Papa=require(_0xa408('0xe'));var Redis=require('ioredis');var authService=require(_0xa408('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa408('0x10'));var hardwareService=require(_0xa408('0x11'));var logger=require(_0xa408('0x12'))(_0xa408('0x13'));var utils=require(_0xa408('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa408('0x15'));var db=require(_0xa408('0x16'))['db'];function respondWithStatusCode(_0x2b74f5,_0x400922){_0x400922=_0x400922||0xcc;return function(_0x3056ff){if(_0x3056ff){return _0x2b74f5[_0xa408('0x17')](_0x400922);}return _0x2b74f5[_0xa408('0x18')](_0x400922)[_0xa408('0x19')]();};}function respondWithResult(_0x240b20,_0x5ce7bd){_0x5ce7bd=_0x5ce7bd||0xc8;return function(_0x3e7b8f){if(_0x3e7b8f){return _0x240b20['status'](_0x5ce7bd)['json'](_0x3e7b8f);}};}function respondWithFilteredResult(_0x7b2601,_0x278d28){return function(_0x172014){if(_0x172014){var _0x3443ba=typeof _0x278d28[_0xa408('0x1a')]==='undefined'&&typeof _0x278d28[_0xa408('0x1b')]===_0xa408('0x1c');var _0xbdd057=_0x172014[_0xa408('0x1d')];var _0x201f64=_0x3443ba?0x0:_0x278d28['offset'];var _0x312690=_0x3443ba?_0x172014[_0xa408('0x1d')]:_0x278d28[_0xa408('0x1a')]+_0x278d28[_0xa408('0x1b')];var _0x55ee8c;if(_0x312690>=_0xbdd057){_0x312690=_0xbdd057;_0x55ee8c=0xc8;}else{_0x55ee8c=0xce;}_0x7b2601[_0xa408('0x18')](_0x55ee8c);return _0x7b2601[_0xa408('0x1e')](_0xa408('0x1f'),_0x201f64+'-'+_0x312690+'/'+_0xbdd057)[_0xa408('0x20')](_0x172014);}return null;};}function patchUpdates(_0x40a96f){return function(_0x1acf96){try{jsonpatch[_0xa408('0x21')](_0x1acf96,_0x40a96f,!![]);}catch(_0x411f1f){return BPromise[_0xa408('0x22')](_0x411f1f);}return _0x1acf96[_0xa408('0x23')]();};}function saveUpdates(_0x7603c3,_0x1ec28a){return function(_0x3f619c){if(_0x3f619c){return _0x3f619c[_0xa408('0x24')](_0x7603c3)[_0xa408('0x25')](function(_0x1d5679){return _0x1d5679;});}return null;};}function removeEntity(_0x1d27cb,_0x28693a){return function(_0x105467){if(_0x105467){return _0x105467['destroy']()[_0xa408('0x25')](function(){_0x1d27cb['status'](0xcc)[_0xa408('0x19')]();});}};}function handleEntityNotFound(_0x58ba4b,_0x1d8034){return function(_0x395371){if(!_0x395371){_0x58ba4b[_0xa408('0x17')](0x194);}return _0x395371;};}function handleError(_0x3d9908,_0x4a9039){_0x4a9039=_0x4a9039||0x1f4;return function(_0x3daf64){logger['error'](_0x3daf64['stack']);if(_0x3daf64[_0xa408('0x26')]){delete _0x3daf64['name'];}_0x3d9908[_0xa408('0x18')](_0x4a9039)[_0xa408('0x27')](_0x3daf64);};}exports[_0xa408('0x28')]=function(_0xde44cb,_0xf965e6){var _0x43a443={},_0x4a269d={},_0x374113={'count':0x0,'rows':[]};var _0x2070d9=_[_0xa408('0x29')](db[_0xa408('0x2a')]['rawAttributes'],function(_0x8151cb){return{'name':_0x8151cb[_0xa408('0x2b')],'type':_0x8151cb[_0xa408('0x2c')][_0xa408('0x2d')]};});_0x4a269d['model']=_[_0xa408('0x29')](_0x2070d9,_0xa408('0x26'));_0x4a269d[_0xa408('0x2e')]=_[_0xa408('0x2f')](_0xde44cb['query']);_0x4a269d[_0xa408('0x30')]=_[_0xa408('0x31')](_0x4a269d[_0xa408('0x32')],_0x4a269d[_0xa408('0x2e')]);_0x43a443['attributes']=_[_0xa408('0x31')](_0x4a269d['model'],qs['fields'](_0xde44cb['query'][_0xa408('0x33')]));_0x43a443[_0xa408('0x34')]=_0x43a443[_0xa408('0x34')][_0xa408('0x35')]?_0x43a443[_0xa408('0x34')]:_0x4a269d[_0xa408('0x32')];if(!_0xde44cb[_0xa408('0x2e')][_0xa408('0x36')]('nolimit')){_0x43a443['limit']=qs['limit'](_0xde44cb[_0xa408('0x2e')]['limit']);_0x43a443['offset']=qs[_0xa408('0x1a')](_0xde44cb[_0xa408('0x2e')][_0xa408('0x1a')]);}_0x43a443[_0xa408('0x37')]=qs['sort'](_0xde44cb[_0xa408('0x2e')]['sort']);_0x43a443[_0xa408('0x38')]=qs[_0xa408('0x30')](_[_0xa408('0x39')](_0xde44cb[_0xa408('0x2e')],_0x4a269d[_0xa408('0x30')]),_0x2070d9);if(_0xde44cb[_0xa408('0x2e')][_0xa408('0x3a')]){_0x43a443[_0xa408('0x38')]=_[_0xa408('0x3b')](_0x43a443['where'],{'$or':_[_0xa408('0x29')](_0x2070d9,function(_0x524565){if(_0x524565[_0xa408('0x2c')]!==_0xa408('0x3c')){var _0x273d3f={};_0x273d3f[_0x524565[_0xa408('0x26')]]={'$like':'%'+_0xde44cb['query']['filter']+'%'};return _0x273d3f;}})});}_0x43a443=_[_0xa408('0x3b')]({},_0x43a443,_0xde44cb[_0xa408('0x3d')]);var _0x2ba004={'where':_0x43a443[_0xa408('0x38')]};return db[_0xa408('0x2a')][_0xa408('0x1d')](_0x2ba004)[_0xa408('0x25')](function(_0x2a2691){_0x374113[_0xa408('0x1d')]=_0x2a2691;if(_0xde44cb['query'][_0xa408('0x3e')]){_0x43a443[_0xa408('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0xa408('0x40')](_0x43a443);})[_0xa408('0x25')](function(_0x31f33d){_0x374113[_0xa408('0x41')]=_0x31f33d;return _0x374113;})[_0xa408('0x25')](respondWithFilteredResult(_0xf965e6,_0x43a443))[_0xa408('0x42')](handleError(_0xf965e6,null));};exports[_0xa408('0x43')]=function(_0x3d672a,_0x35d3b3){var _0x38f52d={'raw':!![],'where':{'id':_0x3d672a['params']['id']}},_0x3fbecd={};_0x3fbecd[_0xa408('0x32')]=_[_0xa408('0x2f')](db[_0xa408('0x2a')][_0xa408('0x44')]);_0x3fbecd['query']=_[_0xa408('0x2f')](_0x3d672a[_0xa408('0x2e')]);_0x3fbecd[_0xa408('0x30')]=_[_0xa408('0x31')](_0x3fbecd[_0xa408('0x32')],_0x3fbecd['query']);_0x38f52d[_0xa408('0x34')]=_[_0xa408('0x31')](_0x3fbecd[_0xa408('0x32')],qs[_0xa408('0x33')](_0x3d672a[_0xa408('0x2e')][_0xa408('0x33')]));_0x38f52d[_0xa408('0x34')]=_0x38f52d['attributes'][_0xa408('0x35')]?_0x38f52d['attributes']:_0x3fbecd[_0xa408('0x32')];if(_0x3d672a[_0xa408('0x2e')][_0xa408('0x3e')]){_0x38f52d['include']=[{'all':!![]}];}_0x38f52d=_[_0xa408('0x3b')]({},_0x38f52d,_0x3d672a[_0xa408('0x3d')]);return db['SalesforceField']['find'](_0x38f52d)[_0xa408('0x25')](handleEntityNotFound(_0x35d3b3,null))[_0xa408('0x25')](respondWithResult(_0x35d3b3,null))[_0xa408('0x42')](handleError(_0x35d3b3,null));};exports[_0xa408('0x45')]=function(_0x552b2a,_0x24e0d0){return db[_0xa408('0x2a')][_0xa408('0x45')](_0x552b2a[_0xa408('0x46')],{})[_0xa408('0x25')](respondWithResult(_0x24e0d0,0xc9))['catch'](handleError(_0x24e0d0,null));};exports[_0xa408('0x24')]=function(_0x456f7e,_0x1cc12f){if(_0x456f7e['body']['id']){delete _0x456f7e[_0xa408('0x46')]['id'];}return db[_0xa408('0x2a')][_0xa408('0x47')]({'where':{'id':_0x456f7e[_0xa408('0x48')]['id']}})['then'](handleEntityNotFound(_0x1cc12f,null))[_0xa408('0x25')](saveUpdates(_0x456f7e['body'],null))[_0xa408('0x25')](respondWithResult(_0x1cc12f,null))[_0xa408('0x42')](handleError(_0x1cc12f,null));};exports[_0xa408('0x49')]=function(_0x2403f3,_0x8baaef){return db['SalesforceField'][_0xa408('0x47')]({'where':{'id':_0x2403f3[_0xa408('0x48')]['id']}})['then'](handleEntityNotFound(_0x8baaef,null))[_0xa408('0x25')](removeEntity(_0x8baaef,null))[_0xa408('0x42')](handleError(_0x8baaef,null));}; \ No newline at end of file +var _0x6aa0=['options','includeAll','include','SalesforceField','findAll','rows','catch','show','params','rawAttributes','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','sendStatus','error','name','map','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6aa0,0x175));var _0x06aa=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x6aa0[_0x236c89];return _0x3b2a15;};'use strict';var emlformat=require(_0x06aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06aa('0x1'));var jsonpatch=require(_0x06aa('0x2'));var rp=require(_0x06aa('0x3'));var moment=require(_0x06aa('0x4'));var BPromise=require(_0x06aa('0x5'));var Mustache=require(_0x06aa('0x6'));var util=require(_0x06aa('0x7'));var path=require(_0x06aa('0x8'));var sox=require(_0x06aa('0x9'));var csv=require(_0x06aa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x06aa('0xb'));var _=require('lodash');var squel=require(_0x06aa('0xc'));var crypto=require(_0x06aa('0xd'));var jsforce=require(_0x06aa('0xe'));var deskjs=require(_0x06aa('0xf'));var toCsv=require(_0x06aa('0xa'));var querystring=require('querystring');var Papa=require(_0x06aa('0x10'));var Redis=require(_0x06aa('0x11'));var authService=require(_0x06aa('0x12'));var qs=require(_0x06aa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06aa('0x14'));var logger=require(_0x06aa('0x15'))('api');var utils=require(_0x06aa('0x16'));var config=require(_0x06aa('0x17'));var licenseUtil=require(_0x06aa('0x18'));var db=require(_0x06aa('0x19'))['db'];function respondWithStatusCode(_0x4243ec,_0x446aec){_0x446aec=_0x446aec||0xcc;return function(_0x5baae0){if(_0x5baae0){return _0x4243ec['sendStatus'](_0x446aec);}return _0x4243ec[_0x06aa('0x1a')](_0x446aec)[_0x06aa('0x1b')]();};}function respondWithResult(_0x1b8c61,_0x31be2e){_0x31be2e=_0x31be2e||0xc8;return function(_0x49a293){if(_0x49a293){return _0x1b8c61[_0x06aa('0x1a')](_0x31be2e)[_0x06aa('0x1c')](_0x49a293);}};}function respondWithFilteredResult(_0x4b7c98,_0x7c2daa){return function(_0x589d65){if(_0x589d65){var _0x50daaf=typeof _0x7c2daa[_0x06aa('0x1d')]===_0x06aa('0x1e')&&typeof _0x7c2daa[_0x06aa('0x1f')]===_0x06aa('0x1e');var _0x42cf48=_0x589d65[_0x06aa('0x20')];var _0x1d9174=_0x50daaf?0x0:_0x7c2daa[_0x06aa('0x1d')];var _0x3bd924=_0x50daaf?_0x589d65[_0x06aa('0x20')]:_0x7c2daa[_0x06aa('0x1d')]+_0x7c2daa[_0x06aa('0x1f')];var _0x5cfe06;if(_0x3bd924>=_0x42cf48){_0x3bd924=_0x42cf48;_0x5cfe06=0xc8;}else{_0x5cfe06=0xce;}_0x4b7c98[_0x06aa('0x1a')](_0x5cfe06);return _0x4b7c98['set'](_0x06aa('0x21'),_0x1d9174+'-'+_0x3bd924+'/'+_0x42cf48)[_0x06aa('0x1c')](_0x589d65);}return null;};}function patchUpdates(_0x332a20){return function(_0x534f0d){try{jsonpatch['apply'](_0x534f0d,_0x332a20,!![]);}catch(_0x22e153){return BPromise[_0x06aa('0x22')](_0x22e153);}return _0x534f0d['save']();};}function saveUpdates(_0x7564b9,_0x38348b){return function(_0x19d4ff){if(_0x19d4ff){return _0x19d4ff[_0x06aa('0x23')](_0x7564b9)[_0x06aa('0x24')](function(_0x21527a){return _0x21527a;});}return null;};}function removeEntity(_0x4df143,_0x476961){return function(_0x28df7e){if(_0x28df7e){return _0x28df7e[_0x06aa('0x25')]()[_0x06aa('0x24')](function(){_0x4df143[_0x06aa('0x1a')](0xcc)[_0x06aa('0x1b')]();});}};}function handleEntityNotFound(_0x1ea817,_0x38ef74){return function(_0x3f2343){if(!_0x3f2343){_0x1ea817[_0x06aa('0x26')](0x194);}return _0x3f2343;};}function handleError(_0x4ad1ee,_0x35df8e){_0x35df8e=_0x35df8e||0x1f4;return function(_0x262fc6){logger[_0x06aa('0x27')](_0x262fc6['stack']);if(_0x262fc6[_0x06aa('0x28')]){delete _0x262fc6[_0x06aa('0x28')];}_0x4ad1ee['status'](_0x35df8e)['send'](_0x262fc6);};}exports['index']=function(_0x26f93a,_0x41db48){var _0x413e46={},_0x10b767={},_0x348603={'count':0x0,'rows':[]};var _0x35799f=_[_0x06aa('0x29')](db['SalesforceField']['rawAttributes'],function(_0x1347b1){return{'name':_0x1347b1[_0x06aa('0x2a')],'type':_0x1347b1[_0x06aa('0x2b')]['key']};});_0x10b767['model']=_[_0x06aa('0x29')](_0x35799f,_0x06aa('0x28'));_0x10b767[_0x06aa('0x2c')]=_[_0x06aa('0x2d')](_0x26f93a[_0x06aa('0x2c')]);_0x10b767[_0x06aa('0x2e')]=_['intersection'](_0x10b767[_0x06aa('0x2f')],_0x10b767['query']);_0x413e46[_0x06aa('0x30')]=_[_0x06aa('0x31')](_0x10b767[_0x06aa('0x2f')],qs[_0x06aa('0x32')](_0x26f93a[_0x06aa('0x2c')][_0x06aa('0x32')]));_0x413e46['attributes']=_0x413e46[_0x06aa('0x30')][_0x06aa('0x33')]?_0x413e46['attributes']:_0x10b767[_0x06aa('0x2f')];if(!_0x26f93a[_0x06aa('0x2c')]['hasOwnProperty'](_0x06aa('0x34'))){_0x413e46['limit']=qs['limit'](_0x26f93a['query'][_0x06aa('0x1f')]);_0x413e46[_0x06aa('0x1d')]=qs[_0x06aa('0x1d')](_0x26f93a[_0x06aa('0x2c')][_0x06aa('0x1d')]);}_0x413e46['order']=qs[_0x06aa('0x35')](_0x26f93a[_0x06aa('0x2c')][_0x06aa('0x35')]);_0x413e46[_0x06aa('0x36')]=qs['filters'](_[_0x06aa('0x37')](_0x26f93a[_0x06aa('0x2c')],_0x10b767['filters']),_0x35799f);if(_0x26f93a[_0x06aa('0x2c')][_0x06aa('0x38')]){_0x413e46[_0x06aa('0x36')]=_[_0x06aa('0x39')](_0x413e46[_0x06aa('0x36')],{'$or':_['map'](_0x35799f,function(_0x33fb72){if(_0x33fb72['type']!==_0x06aa('0x3a')){var _0x551a72={};_0x551a72[_0x33fb72['name']]={'$like':'%'+_0x26f93a[_0x06aa('0x2c')][_0x06aa('0x38')]+'%'};return _0x551a72;}})});}_0x413e46=_[_0x06aa('0x39')]({},_0x413e46,_0x26f93a[_0x06aa('0x3b')]);var _0x2521d0={'where':_0x413e46[_0x06aa('0x36')]};return db['SalesforceField'][_0x06aa('0x20')](_0x2521d0)['then'](function(_0x22a0f7){_0x348603[_0x06aa('0x20')]=_0x22a0f7;if(_0x26f93a[_0x06aa('0x2c')][_0x06aa('0x3c')]){_0x413e46[_0x06aa('0x3d')]=[{'all':!![]}];}return db[_0x06aa('0x3e')][_0x06aa('0x3f')](_0x413e46);})[_0x06aa('0x24')](function(_0x5a6748){_0x348603[_0x06aa('0x40')]=_0x5a6748;return _0x348603;})[_0x06aa('0x24')](respondWithFilteredResult(_0x41db48,_0x413e46))[_0x06aa('0x41')](handleError(_0x41db48,null));};exports[_0x06aa('0x42')]=function(_0x391979,_0x3a28c3){var _0x16c274={'raw':!![],'where':{'id':_0x391979[_0x06aa('0x43')]['id']}},_0xcc899e={};_0xcc899e[_0x06aa('0x2f')]=_[_0x06aa('0x2d')](db['SalesforceField'][_0x06aa('0x44')]);_0xcc899e[_0x06aa('0x2c')]=_['keys'](_0x391979[_0x06aa('0x2c')]);_0xcc899e[_0x06aa('0x2e')]=_['intersection'](_0xcc899e[_0x06aa('0x2f')],_0xcc899e['query']);_0x16c274['attributes']=_[_0x06aa('0x31')](_0xcc899e[_0x06aa('0x2f')],qs[_0x06aa('0x32')](_0x391979['query'][_0x06aa('0x32')]));_0x16c274[_0x06aa('0x30')]=_0x16c274[_0x06aa('0x30')][_0x06aa('0x33')]?_0x16c274[_0x06aa('0x30')]:_0xcc899e[_0x06aa('0x2f')];if(_0x391979[_0x06aa('0x2c')][_0x06aa('0x3c')]){_0x16c274[_0x06aa('0x3d')]=[{'all':!![]}];}_0x16c274=_[_0x06aa('0x39')]({},_0x16c274,_0x391979[_0x06aa('0x3b')]);return db[_0x06aa('0x3e')]['find'](_0x16c274)['then'](handleEntityNotFound(_0x3a28c3,null))['then'](respondWithResult(_0x3a28c3,null))[_0x06aa('0x41')](handleError(_0x3a28c3,null));};exports[_0x06aa('0x45')]=function(_0x5ea8f0,_0x26d059){return db[_0x06aa('0x3e')][_0x06aa('0x45')](_0x5ea8f0[_0x06aa('0x46')],{})[_0x06aa('0x24')](respondWithResult(_0x26d059,0xc9))[_0x06aa('0x41')](handleError(_0x26d059,null));};exports['update']=function(_0x43e242,_0x3e2bcd){if(_0x43e242['body']['id']){delete _0x43e242['body']['id'];}return db[_0x06aa('0x3e')][_0x06aa('0x47')]({'where':{'id':_0x43e242[_0x06aa('0x43')]['id']}})[_0x06aa('0x24')](handleEntityNotFound(_0x3e2bcd,null))['then'](saveUpdates(_0x43e242[_0x06aa('0x46')],null))[_0x06aa('0x24')](respondWithResult(_0x3e2bcd,null))[_0x06aa('0x41')](handleError(_0x3e2bcd,null));};exports[_0x06aa('0x25')]=function(_0x476a5d,_0x1630ad){return db['SalesforceField'][_0x06aa('0x47')]({'where':{'id':_0x476a5d[_0x06aa('0x43')]['id']}})[_0x06aa('0x24')](handleEntityNotFound(_0x1630ad,null))[_0x06aa('0x24')](removeEntity(_0x1630ad,null))['catch'](handleError(_0x1630ad,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9d7a464..10c08f9 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 _0x3d50=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x100f8e,_0x1efaa3){var _0x5587df=function(_0x273a7e){while(--_0x273a7e){_0x100f8e['push'](_0x100f8e['shift']());}};_0x5587df(++_0x1efaa3);}(_0x3d50,0x104));var _0x03d5=function(_0x3e949e,_0x2c133c){_0x3e949e=_0x3e949e-0x0;var _0x1f55cd=_0x3d50[_0x3e949e];return _0x1f55cd;};'use strict';var _=require(_0x03d5('0x0'));var util=require(_0x03d5('0x1'));var logger=require(_0x03d5('0x2'))(_0x03d5('0x3'));var moment=require('moment');var BPromise=require(_0x03d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03d5('0x5'));var rimraf=require(_0x03d5('0x6'));var config=require(_0x03d5('0x7'));var attributes=require(_0x03d5('0x8'));module[_0x03d5('0x9')]=function(_0x28d0ac,_0x345e01){return _0x28d0ac[_0x03d5('0xa')](_0x03d5('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x03d5('0xc'),'fields':[_0x03d5('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30c3=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x30c3,0x1d9));var _0x330c=function(_0x14540b,_0x85d32d){_0x14540b=_0x14540b-0x0;var _0x394822=_0x30c3[_0x14540b];return _0x394822;};'use strict';var _=require('lodash');var util=require(_0x330c('0x0'));var logger=require('../../config/logger')(_0x330c('0x1'));var moment=require(_0x330c('0x2'));var BPromise=require(_0x330c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x330c('0x4'));var rimraf=require(_0x330c('0x5'));var config=require(_0x330c('0x6'));var attributes=require(_0x330c('0x7'));module[_0x330c('0x8')]=function(_0x25846c,_0x22c776){return _0x25846c[_0x330c('0x9')](_0x330c('0xa'),attributes,{'tableName':_0x330c('0xb'),'paranoid':![],'indexes':[{'name':_0x330c('0xc'),'fields':[_0x330c('0xd'),_0x330c('0xe')],'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 0de7613..919979a 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 _0xac49=['then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x19283a,_0x8a2bde){var _0x1bd412=function(_0x49fb46){while(--_0x49fb46){_0x19283a['push'](_0x19283a['shift']());}};_0x1bd412(++_0x8a2bde);}(_0xac49,0x6f));var _0x9ac4=function(_0x109855,_0x5cc962){_0x109855=_0x109855-0x0;var _0x133876=_0xac49[_0x109855];return _0x133876;};'use strict';var _=require('lodash');var util=require(_0x9ac4('0x0'));var moment=require(_0x9ac4('0x1'));var BPromise=require(_0x9ac4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ac4('0x3'))['db'];var utils=require(_0x9ac4('0x4'));var logger=require('../../config/logger')(_0x9ac4('0x5'));var config=require('../../config/environment');var jayson=require(_0x9ac4('0x6'));var client=jayson[_0x9ac4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x222550,_0x427a6f,_0x4a8c4f){return new BPromise(function(_0x10544a,_0x1a083a){return client['request'](_0x222550,_0x4a8c4f)[_0x9ac4('0x8')](function(_0x3d8276){logger[_0x9ac4('0x9')]('SalesforceField,\x20%s,\x20%s',_0x427a6f,_0x9ac4('0xa'));logger[_0x9ac4('0xb')](_0x9ac4('0xc'),_0x427a6f,_0x9ac4('0xa'),JSON['stringify'](_0x3d8276));if(_0x3d8276['error']){if(_0x3d8276[_0x9ac4('0xd')][_0x9ac4('0xe')]===0x1f4){logger[_0x9ac4('0xd')](_0x9ac4('0xf'),_0x427a6f,_0x3d8276[_0x9ac4('0xd')]['message']);return _0x1a083a(_0x3d8276[_0x9ac4('0xd')][_0x9ac4('0x10')]);}logger['error'](_0x9ac4('0xf'),_0x427a6f,_0x3d8276[_0x9ac4('0xd')][_0x9ac4('0x10')]);return _0x10544a(_0x3d8276[_0x9ac4('0xd')][_0x9ac4('0x10')]);}else{logger[_0x9ac4('0x9')](_0x9ac4('0xf'),_0x427a6f,'request\x20sent');_0x10544a(_0x3d8276['result'][_0x9ac4('0x10')]);}})['catch'](function(_0x594489){logger[_0x9ac4('0xd')](_0x9ac4('0xf'),_0x427a6f,_0x594489);_0x1a083a(_0x594489);});});} \ No newline at end of file +var _0x09a0=['message','result','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09a0,0x120));var _0x009a=function(_0x38be70,_0x50006c){_0x38be70=_0x38be70-0x0;var _0x5e0c15=_0x09a0[_0x38be70];return _0x5e0c15;};'use strict';var _=require(_0x009a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x009a('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x009a('0x2'))(_0x009a('0x3'));var config=require(_0x009a('0x4'));var jayson=require(_0x009a('0x5'));var client=jayson[_0x009a('0x6')][_0x009a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x468275,_0x271730,_0x321924){return new BPromise(function(_0x4d92a6,_0x5ba87d){return client[_0x009a('0x8')](_0x468275,_0x321924)[_0x009a('0x9')](function(_0x236760){logger[_0x009a('0xa')](_0x009a('0xb'),_0x271730,_0x009a('0xc'));logger[_0x009a('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x271730,_0x009a('0xc'),JSON[_0x009a('0xe')](_0x236760));if(_0x236760[_0x009a('0xf')]){if(_0x236760['error']['code']===0x1f4){logger[_0x009a('0xf')](_0x009a('0xb'),_0x271730,_0x236760[_0x009a('0xf')][_0x009a('0x10')]);return _0x5ba87d(_0x236760[_0x009a('0xf')][_0x009a('0x10')]);}logger['error'](_0x009a('0xb'),_0x271730,_0x236760[_0x009a('0xf')][_0x009a('0x10')]);return _0x4d92a6(_0x236760['error'][_0x009a('0x10')]);}else{logger[_0x009a('0xa')](_0x009a('0xb'),_0x271730,'request\x20sent');_0x4d92a6(_0x236760[_0x009a('0x11')]['message']);}})[_0x009a('0x12')](function(_0x3e0537){logger[_0x009a('0xf')](_0x009a('0xb'),_0x271730,_0x3e0537);_0x5ba87d(_0x3e0537);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5a7a1bd..204a2b2 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 _0xd582=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3213b7,_0x6789ca){var _0xb960bf=function(_0x2f7f04){while(--_0x2f7f04){_0x3213b7['push'](_0x3213b7['shift']());}};_0xb960bf(++_0x6789ca);}(_0xd582,0xff));var _0x2d58=function(_0x4bb1f3,_0xe6cdc4){_0x4bb1f3=_0x4bb1f3-0x0;var _0x47a5c7=_0xd582[_0x4bb1f3];return _0x47a5c7;};'use strict';var multer=require(_0x2d58('0x0'));var util=require(_0x2d58('0x1'));var path=require(_0x2d58('0x2'));var timeout=require(_0x2d58('0x3'));var express=require(_0x2d58('0x4'));var router=express[_0x2d58('0x5')]();var fs_extra=require(_0x2d58('0x6'));var auth=require(_0x2d58('0x7'));var interaction=require(_0x2d58('0x8'));var config=require(_0x2d58('0x9'));var controller=require(_0x2d58('0xa'));router[_0x2d58('0xb')]('/',auth[_0x2d58('0xc')](),controller[_0x2d58('0xd')]);router[_0x2d58('0xb')](_0x2d58('0xe'),auth[_0x2d58('0xc')](),controller[_0x2d58('0xf')]);router['get'](_0x2d58('0x10'),auth[_0x2d58('0xc')](),controller['getConfigurations']);router[_0x2d58('0xb')](_0x2d58('0x11'),auth[_0x2d58('0xc')](),controller['getFields']);router[_0x2d58('0x12')]('/',auth[_0x2d58('0xc')](),controller[_0x2d58('0x13')]);router[_0x2d58('0x12')](_0x2d58('0x10'),auth[_0x2d58('0xc')](),controller['addConfiguration']);router[_0x2d58('0x14')](_0x2d58('0xe'),auth[_0x2d58('0xc')](),controller['update']);router[_0x2d58('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2d58('0x16')]);module[_0x2d58('0x17')]=router; \ No newline at end of file +var _0xf675=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf675,0x15d));var _0x5f67=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0xf675[_0x3df822];return _0x4e457d;};'use strict';var multer=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var path=require(_0x5f67('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f67('0x3'));var router=express[_0x5f67('0x4')]();var fs_extra=require(_0x5f67('0x5'));var auth=require(_0x5f67('0x6'));var interaction=require(_0x5f67('0x7'));var config=require(_0x5f67('0x8'));var controller=require(_0x5f67('0x9'));router['get']('/',auth[_0x5f67('0xa')](),controller[_0x5f67('0xb')]);router[_0x5f67('0xc')](_0x5f67('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5f67('0xc')](_0x5f67('0xe'),auth[_0x5f67('0xa')](),controller[_0x5f67('0xf')]);router['get'](_0x5f67('0x10'),auth[_0x5f67('0xa')](),controller['getFields']);router[_0x5f67('0x11')]('/',auth[_0x5f67('0xa')](),controller[_0x5f67('0x12')]);router[_0x5f67('0x11')](_0x5f67('0xe'),auth['isAuthenticated'](),controller[_0x5f67('0x13')]);router[_0x5f67('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5f67('0x15')]);router[_0x5f67('0x16')]('/:id',auth[_0x5f67('0xa')](),controller[_0x5f67('0x17')]);module[_0x5f67('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 97297c4..ababe6d 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 _0xb01f=['exports','STRING','remoteUri','sequelize'];(function(_0x5380c5,_0x5bc69f){var _0x32c4a6=function(_0x4d3351){while(--_0x4d3351){_0x5380c5['push'](_0x5380c5['shift']());}};_0x32c4a6(++_0x5bc69f);}(_0xb01f,0x87));var _0xfb01=function(_0x44332a,_0x1e1426){_0x44332a=_0x44332a-0x0;var _0x18acb2=_0xb01f[_0x44332a];return _0x18acb2;};'use strict';var Sequelize=require(_0xfb01('0x0'));module[_0xfb01('0x1')]={'name':{'type':Sequelize[_0xfb01('0x2')]},'description':{'type':Sequelize[_0xfb01('0x2')]},'username':{'type':Sequelize[_0xfb01('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xfb01('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfb01('0x2')],'unique':_0xfb01('0x3')},'serverUrl':{'type':Sequelize[_0xfb01('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb3ee=['STRING','username','remoteUri','sequelize','exports'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xb3ee,0xc6));var _0xeb3e=function(_0x21af09,_0x3df61f){_0x21af09=_0x21af09-0x0;var _0x5bd278=_0xb3ee[_0x21af09];return _0x5bd278;};'use strict';var Sequelize=require(_0xeb3e('0x0'));module[_0xeb3e('0x1')]={'name':{'type':Sequelize[_0xeb3e('0x2')]},'description':{'type':Sequelize[_0xeb3e('0x2')]},'username':{'type':Sequelize[_0xeb3e('0x2')],'unique':_0xeb3e('0x3')},'password':{'type':Sequelize[_0xeb3e('0x2')]},'email':{'type':Sequelize[_0xeb3e('0x2')]},'remoteUri':{'type':Sequelize[_0xeb3e('0x2')],'unique':_0xeb3e('0x4')},'serverUrl':{'type':Sequelize[_0xeb3e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 4f476f2..4482746 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 _0xae2d=['caused_by','watch_list','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','resolved_at','caller_id','work_notes','short_description','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','reopen_count','sys_tags','correlation_id','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','push','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','all','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','getConfigurations','findOne','ServicenowConfiguration','sort','options','Subjects','Descriptions','channel','knowledge','subcategory','close_code','notify','severity','parent','made_sla'];(function(_0x30065e,_0x141e66){var _0x2a2726=function(_0x3ac530){while(--_0x3ac530){_0x30065e['push'](_0x30065e['shift']());}};_0x2a2726(++_0x141e66);}(_0xae2d,0x114));var _0xdae2=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0xae2d[_0x281e5e];return _0x5a22d2;};'use strict';var emlformat=require(_0xdae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdae2('0x1'));var jsonpatch=require(_0xdae2('0x2'));var rp=require(_0xdae2('0x3'));var moment=require(_0xdae2('0x4'));var BPromise=require(_0xdae2('0x5'));var Mustache=require(_0xdae2('0x6'));var util=require(_0xdae2('0x7'));var path=require(_0xdae2('0x8'));var sox=require(_0xdae2('0x9'));var csv=require(_0xdae2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdae2('0xb'));var _=require(_0xdae2('0xc'));var squel=require(_0xdae2('0xd'));var crypto=require('crypto');var jsforce=require(_0xdae2('0xe'));var deskjs=require(_0xdae2('0xf'));var toCsv=require(_0xdae2('0xa'));var querystring=require('querystring');var Papa=require(_0xdae2('0x10'));var Redis=require(_0xdae2('0x11'));var authService=require(_0xdae2('0x12'));var qs=require(_0xdae2('0x13'));var as=require(_0xdae2('0x14'));var hardwareService=require(_0xdae2('0x15'));var logger=require(_0xdae2('0x16'))(_0xdae2('0x17'));var utils=require('../../config/utils');var config=require(_0xdae2('0x18'));var licenseUtil=require(_0xdae2('0x19'));var db=require(_0xdae2('0x1a'))['db'];var integrations=require(_0xdae2('0x1b'));function respondWithStatusCode(_0x475bf7,_0x3e88ea){_0x3e88ea=_0x3e88ea||0xcc;return function(_0x5d03d8){if(_0x5d03d8){return _0x475bf7['sendStatus'](_0x3e88ea);}return _0x475bf7[_0xdae2('0x1c')](_0x3e88ea)[_0xdae2('0x1d')]();};}function respondWithResult(_0x47f9ce,_0x28556a){_0x28556a=_0x28556a||0xc8;return function(_0x11e61b){if(_0x11e61b){return _0x47f9ce['status'](_0x28556a)[_0xdae2('0x1e')](_0x11e61b);}};}function respondWithFilteredResult(_0x1641f7,_0x4a2783){return function(_0x2bacf4){if(_0x2bacf4){var _0x3b010c=typeof _0x4a2783['offset']==='undefined'&&typeof _0x4a2783[_0xdae2('0x1f')]==='undefined';var _0x472702=_0x2bacf4['count'];var _0x436786=_0x3b010c?0x0:_0x4a2783[_0xdae2('0x20')];var _0x4e7672=_0x3b010c?_0x2bacf4[_0xdae2('0x21')]:_0x4a2783[_0xdae2('0x20')]+_0x4a2783[_0xdae2('0x1f')];var _0x55025d;if(_0x4e7672>=_0x472702){_0x4e7672=_0x472702;_0x55025d=0xc8;}else{_0x55025d=0xce;}_0x1641f7['status'](_0x55025d);return _0x1641f7[_0xdae2('0x22')](_0xdae2('0x23'),_0x436786+'-'+_0x4e7672+'/'+_0x472702)['json'](_0x2bacf4);}return null;};}function patchUpdates(_0x1a6ed9){return function(_0xa9447c){try{jsonpatch[_0xdae2('0x24')](_0xa9447c,_0x1a6ed9,!![]);}catch(_0x59230c){return BPromise['reject'](_0x59230c);}return _0xa9447c[_0xdae2('0x25')]();};}function saveUpdates(_0x20a02c,_0x9aa929){return function(_0x45ecb7){if(_0x45ecb7){return _0x45ecb7[_0xdae2('0x26')](_0x20a02c)[_0xdae2('0x27')](function(_0x36f2e0){return _0x36f2e0;});}return null;};}function removeEntity(_0x3eda71,_0x4ac11a){return function(_0x51a495){if(_0x51a495){return _0x51a495[_0xdae2('0x28')]()[_0xdae2('0x27')](function(){_0x3eda71[_0xdae2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2906f0,_0x52e502){return function(_0x4998d4){if(!_0x4998d4){_0x2906f0[_0xdae2('0x29')](0x194);}return _0x4998d4;};}function handleError(_0x22f977,_0x299a01){_0x299a01=_0x299a01||0x1f4;return function(_0x16a70b){logger[_0xdae2('0x2a')](_0x16a70b[_0xdae2('0x2b')]);if(_0x16a70b['name']){delete _0x16a70b[_0xdae2('0x2c')];}_0x22f977['status'](_0x299a01)[_0xdae2('0x2d')](_0x16a70b);};}exports[_0xdae2('0x2e')]=function(_0x4bcc72,_0x551ae2){var _0x5a9b30={},_0x4dab5b={},_0x515c48={'count':0x0,'rows':[]};var _0x16a816=_[_0xdae2('0x2f')](db[_0xdae2('0x30')][_0xdae2('0x31')],function(_0x496a50){return{'name':_0x496a50[_0xdae2('0x32')],'type':_0x496a50[_0xdae2('0x33')][_0xdae2('0x34')]};});_0x4dab5b[_0xdae2('0x35')]=_[_0xdae2('0x2f')](_0x16a816,_0xdae2('0x2c'));_0x4dab5b[_0xdae2('0x36')]=_[_0xdae2('0x37')](_0x4bcc72[_0xdae2('0x36')]);_0x4dab5b[_0xdae2('0x38')]=_[_0xdae2('0x39')](_0x4dab5b[_0xdae2('0x35')],_0x4dab5b[_0xdae2('0x36')]);_0x5a9b30[_0xdae2('0x3a')]=_[_0xdae2('0x39')](_0x4dab5b[_0xdae2('0x35')],qs['fields'](_0x4bcc72['query']['fields']));_0x5a9b30[_0xdae2('0x3a')]=_0x5a9b30[_0xdae2('0x3a')]['length']?_0x5a9b30['attributes']:_0x4dab5b[_0xdae2('0x35')];if(!_0x4bcc72[_0xdae2('0x36')][_0xdae2('0x3b')](_0xdae2('0x3c'))){_0x5a9b30[_0xdae2('0x1f')]=qs['limit'](_0x4bcc72[_0xdae2('0x36')][_0xdae2('0x1f')]);_0x5a9b30[_0xdae2('0x20')]=qs[_0xdae2('0x20')](_0x4bcc72['query'][_0xdae2('0x20')]);}_0x5a9b30[_0xdae2('0x3d')]=qs['sort'](_0x4bcc72[_0xdae2('0x36')]['sort']);_0x5a9b30[_0xdae2('0x3e')]=qs[_0xdae2('0x38')](_[_0xdae2('0x3f')](_0x4bcc72[_0xdae2('0x36')],_0x4dab5b[_0xdae2('0x38')]),_0x16a816);if(_0x4bcc72[_0xdae2('0x36')][_0xdae2('0x40')]){_0x5a9b30['where']=_[_0xdae2('0x41')](_0x5a9b30[_0xdae2('0x3e')],{'$or':_[_0xdae2('0x2f')](_0x16a816,function(_0x4df171){if(_0x4df171[_0xdae2('0x33')]!==_0xdae2('0x42')){var _0x479035={};_0x479035[_0x4df171['name']]={'$like':'%'+_0x4bcc72[_0xdae2('0x36')][_0xdae2('0x40')]+'%'};return _0x479035;}})});}_0x5a9b30=_['merge']({},_0x5a9b30,_0x4bcc72['options']);var _0x16b100={'where':_0x5a9b30[_0xdae2('0x3e')]};return db[_0xdae2('0x30')][_0xdae2('0x21')](_0x16b100)[_0xdae2('0x27')](function(_0x317d8e){_0x515c48['count']=_0x317d8e;if(_0x4bcc72['query'][_0xdae2('0x43')]){_0x5a9b30[_0xdae2('0x44')]=[{'all':!![]}];}return db[_0xdae2('0x30')][_0xdae2('0x45')](_0x5a9b30);})[_0xdae2('0x27')](function(_0x586785){_0x515c48[_0xdae2('0x46')]=_0x586785;return _0x515c48;})[_0xdae2('0x27')](respondWithFilteredResult(_0x551ae2,_0x5a9b30))[_0xdae2('0x47')](handleError(_0x551ae2,null));};exports[_0xdae2('0x48')]=function(_0x6fd64e,_0x29f914){var _0x4766f4={'raw':![],'where':{'id':_0x6fd64e[_0xdae2('0x49')]['id']}},_0x543425={};_0x543425[_0xdae2('0x35')]=_['keys'](db[_0xdae2('0x30')][_0xdae2('0x31')]);_0x543425[_0xdae2('0x36')]=_[_0xdae2('0x37')](_0x6fd64e[_0xdae2('0x36')]);_0x543425[_0xdae2('0x38')]=_[_0xdae2('0x39')](_0x543425[_0xdae2('0x35')],_0x543425[_0xdae2('0x36')]);_0x4766f4[_0xdae2('0x3a')]=_['intersection'](_0x543425['model'],qs['fields'](_0x6fd64e[_0xdae2('0x36')][_0xdae2('0x4a')]));_0x4766f4[_0xdae2('0x3a')]=_0x4766f4['attributes'][_0xdae2('0x4b')]?_0x4766f4[_0xdae2('0x3a')]:_0x543425['model'];if(_0x6fd64e[_0xdae2('0x36')][_0xdae2('0x43')]){_0x4766f4[_0xdae2('0x44')]=[{'all':!![]}];}_0x4766f4=_['merge']({},_0x4766f4,_0x6fd64e['options']);return db['ServicenowAccount'][_0xdae2('0x4c')](_0x4766f4)['then'](handleEntityNotFound(_0x29f914,null))[_0xdae2('0x27')](respondWithResult(_0x29f914,null))[_0xdae2('0x47')](handleError(_0x29f914,null));};exports[_0xdae2('0x4d')]=function(_0x55bb4f,_0x5dec3d){return db[_0xdae2('0x30')][_0xdae2('0x4d')](_0x55bb4f[_0xdae2('0x4e')],{})['then'](respondWithResult(_0x5dec3d,0xc9))['catch'](handleError(_0x5dec3d,null));};exports[_0xdae2('0x26')]=function(_0x1f1807,_0x288969){if(_0x1f1807['body']['id']){delete _0x1f1807[_0xdae2('0x4e')]['id'];}return db[_0xdae2('0x30')]['find']({'where':{'id':_0x1f1807['params']['id']}})[_0xdae2('0x27')](handleEntityNotFound(_0x288969,null))[_0xdae2('0x27')](saveUpdates(_0x1f1807['body'],null))[_0xdae2('0x27')](respondWithResult(_0x288969,null))[_0xdae2('0x47')](handleError(_0x288969,null));};exports['destroy']=function(_0x43ba20,_0x4efc0b){return db['ServicenowAccount']['find']({'where':{'id':_0x43ba20[_0xdae2('0x49')]['id']}})[_0xdae2('0x27')](handleEntityNotFound(_0x4efc0b,null))[_0xdae2('0x27')](removeEntity(_0x4efc0b,null))[_0xdae2('0x47')](handleError(_0x4efc0b,null));};exports[_0xdae2('0x4f')]=function(_0x30b8a8,_0x5bd849,_0x39fc83){var _0x16c688={};var _0x468b96={};var _0x4b9702;var _0x14488f;return db['ServicenowAccount'][_0xdae2('0x50')]({'where':{'id':_0x30b8a8[_0xdae2('0x49')]['id']}})[_0xdae2('0x27')](handleEntityNotFound(_0x5bd849,null))[_0xdae2('0x27')](function(_0x3b74d8){if(_0x3b74d8){_0x4b9702=_0x3b74d8;_0x468b96[_0xdae2('0x35')]=_[_0xdae2('0x37')](db[_0xdae2('0x51')][_0xdae2('0x31')]);_0x468b96['query']=_[_0xdae2('0x37')](_0x30b8a8[_0xdae2('0x36')]);_0x468b96[_0xdae2('0x38')]=_['intersection'](_0x468b96[_0xdae2('0x35')],_0x468b96[_0xdae2('0x36')]);_0x16c688['attributes']=_[_0xdae2('0x39')](_0x468b96[_0xdae2('0x35')],qs[_0xdae2('0x4a')](_0x30b8a8[_0xdae2('0x36')][_0xdae2('0x4a')]));_0x16c688['attributes']=_0x16c688[_0xdae2('0x3a')]['length']?_0x16c688[_0xdae2('0x3a')]:_0x468b96[_0xdae2('0x35')];_0x16c688[_0xdae2('0x3d')]=qs[_0xdae2('0x52')](_0x30b8a8['query'][_0xdae2('0x52')]);_0x16c688[_0xdae2('0x3e')]=qs[_0xdae2('0x38')](_[_0xdae2('0x3f')](_0x30b8a8[_0xdae2('0x36')],_0x468b96[_0xdae2('0x38')]));if(_0x30b8a8[_0xdae2('0x36')][_0xdae2('0x40')]){_0x16c688[_0xdae2('0x3e')]=_['merge'](_0x16c688[_0xdae2('0x3e')],{'$or':_[_0xdae2('0x2f')](_0x16c688['attributes'],function(_0x2d4ebe){var _0x3478fc={};_0x3478fc[_0x2d4ebe]={'$like':'%'+_0x30b8a8['query'][_0xdae2('0x40')]+'%'};return _0x3478fc;})});}_0x16c688=_[_0xdae2('0x41')]({},_0x16c688,_0x30b8a8[_0xdae2('0x53')]);return _0x4b9702[_0xdae2('0x4f')](_0x16c688);}})[_0xdae2('0x27')](function(_0x49a83b){if(_0x49a83b){_0x14488f=_0x49a83b[_0xdae2('0x4b')];if(!_0x30b8a8[_0xdae2('0x36')][_0xdae2('0x3b')](_0xdae2('0x3c'))){_0x16c688[_0xdae2('0x1f')]=qs[_0xdae2('0x1f')](_0x30b8a8['query'][_0xdae2('0x1f')]);_0x16c688['offset']=qs[_0xdae2('0x20')](_0x30b8a8[_0xdae2('0x36')][_0xdae2('0x20')]);}return _0x4b9702['getConfigurations'](_0x16c688);}})[_0xdae2('0x27')](function(_0xd7b655){if(_0xd7b655){return _0xd7b655?{'count':_0x14488f,'rows':_0xd7b655}:null;}})[_0xdae2('0x27')](respondWithResult(_0x5bd849,null))['catch'](handleError(_0x5bd849,null));};exports['addConfiguration']=function(_0x2f8337,_0x313a8e,_0x225bda){if(_0x2f8337['body']['id']){delete _0x2f8337[_0xdae2('0x4e')]['id'];}return db[_0xdae2('0x30')][_0xdae2('0x50')]({'where':{'id':_0x2f8337[_0xdae2('0x49')]['id']}})[_0xdae2('0x27')](handleEntityNotFound(_0x313a8e,null))[_0xdae2('0x27')](function(_0x2175e0){if(_0x2175e0){_0x2f8337['body']['AccountId']=_0x2175e0['id'];_0x2f8337[_0xdae2('0x4e')][_0xdae2('0x54')]=integrations['getSubjects'](_0x2f8337[_0xdae2('0x4e')]['channel'],_0x2f8337[_0xdae2('0x4e')][_0xdae2('0x33')]);_0x2f8337[_0xdae2('0x4e')][_0xdae2('0x55')]=integrations['getDescriptions'](_0x2f8337['body'][_0xdae2('0x56')],_0x2f8337[_0xdae2('0x4e')][_0xdae2('0x33')]);return db[_0xdae2('0x51')][_0xdae2('0x4d')](_0x2f8337['body'],{'include':[{'model':db['ServicenowField'],'as':_0xdae2('0x54')},{'model':db['ServicenowField'],'as':_0xdae2('0x55')}]});}return null;})[_0xdae2('0x27')](respondWithResult(_0x313a8e,null))[_0xdae2('0x47')](handleError(_0x313a8e,null));};exports['getFields']=function(_0x46cd12,_0xc0c120,_0x5b0233){var _0x28c13a=['made_sla','hold_reason',_0xdae2('0x57'),_0xdae2('0x58'),_0xdae2('0x59'),_0xdae2('0x5a'),'incident_state',_0xdae2('0x5b'),'category'];var _0xe280d3=[_0xdae2('0x5c'),_0xdae2('0x5d'),_0xdae2('0x5e'),_0xdae2('0x5f'),'upon_reject',_0xdae2('0x60'),_0xdae2('0x61'),_0xdae2('0x62'),_0xdae2('0x63'),_0xdae2('0x64'),_0xdae2('0x65'),_0xdae2('0x66'),'opened_by',_0xdae2('0x67'),_0xdae2('0x68'),_0xdae2('0x69'),_0xdae2('0x6a'),_0xdae2('0x6b'),_0xdae2('0x57'),_0xdae2('0x3d'),_0xdae2('0x6c'),_0xdae2('0x6d'),_0xdae2('0x6e'),'delivery_plan',_0xdae2('0x6f'),'active',_0xdae2('0x70'),_0xdae2('0x71'),_0xdae2('0x72'),_0xdae2('0x73'),_0xdae2('0x74'),_0xdae2('0x75'),_0xdae2('0x76'),_0xdae2('0x77'),_0xdae2('0x78'),'group_list',_0xdae2('0x79'),'reopened_time',_0xdae2('0x7a'),_0xdae2('0x7b'),'approval_set',_0xdae2('0x58'),_0xdae2('0x7c'),_0xdae2('0x7d'),_0xdae2('0x59'),_0xdae2('0x7e'),'delivery_task','work_start',_0xdae2('0x7f'),_0xdae2('0x80'),_0xdae2('0x81'),_0xdae2('0x82'),_0xdae2('0x83'),_0xdae2('0x5a'),'sys_class_name',_0xdae2('0x84'),'closed_by',_0xdae2('0x85'),_0xdae2('0x86'),_0xdae2('0x87'),_0xdae2('0x88'),_0xdae2('0x89'),_0xdae2('0x8a'),_0xdae2('0x8b'),_0xdae2('0x8c'),_0xdae2('0x8d'),_0xdae2('0x8e'),'activity_due',_0xdae2('0x8f'),_0xdae2('0x5b'),'comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count',_0xdae2('0x90'),_0xdae2('0x91'),'escalation','upon_approval',_0xdae2('0x92'),'location',_0xdae2('0x93')];var _0x2caed5='';var _0x55a0e0='';var _0x34e969=[];var _0x49f603='';var _0x146591='';var _0x353f02=[];var _0x16e0f9='';var _0x511725='';var _0x15e7ce={};var _0x2fa148='';return db[_0xdae2('0x30')][_0xdae2('0x50')]({'where':{'id':_0x46cd12[_0xdae2('0x49')]['id']},'attributes':['id',_0xdae2('0x94'),_0xdae2('0x95'),_0xdae2('0x96'),_0xdae2('0x97'),_0xdae2('0x98')]})[_0xdae2('0x27')](handleEntityNotFound(_0xc0c120,null))[_0xdae2('0x27')](function(_0x2303fe){if(_0x2303fe){_0x2fa148=_0x2303fe[_0xdae2('0x97')];var _0x5c6dcf=_0x2fa148[_0xdae2('0x99')](-0x1);if(_0x5c6dcf==='/'){_0x2fa148=_0x2fa148[_0xdae2('0x9a')](0x0,_0x2fa148[_0xdae2('0x9b')](_0x5c6dcf));}_0x511725=util[_0xdae2('0x9c')](_0xdae2('0x9d'),_0x2fa148);_0x16e0f9=util[_0xdae2('0x9c')](_0xdae2('0x9e'),_0x2fa148);_0x15e7ce={'user':_0x2303fe[_0xdae2('0x94')],'pass':_0x2303fe[_0xdae2('0x95')]};var _0x1bf5b6={'method':'GET','uri':_0x511725+_0xdae2('0x9f'),'auth':_0x15e7ce,'json':!![]};return rp(_0x1bf5b6);}})['then'](function(_0x25e5c8){if(_0x25e5c8['result']['length']>0x0){_0x2caed5=_0x25e5c8[_0xdae2('0xa0')];}console[_0xdae2('0xa1')](_0xdae2('0xa2'),_0x2caed5);_0x353f02=[];_0x55a0e0=Object['assign']([],_0x2caed5);_[_0xdae2('0xa3')](_0x55a0e0,function(_0x33022f){return!_0x28c13a[_0xdae2('0xa4')](_0x33022f['name']);});_0x55a0e0[_0xdae2('0xa5')](function(_0x20819f){var _0x393575=createFieldObject(_0x16e0f9,_0x15e7ce,_0x20819f[_0xdae2('0xa6')],_0x20819f[_0xdae2('0x2c')],_0x20819f['label'],![]);_0x353f02[_0xdae2('0xa7')](_0x393575);});return Promise['all'](_0x353f02);})[_0xdae2('0x27')](function(_0x36c918){_0x34e969=_0x36c918;_0x49f603=Object[_0xdae2('0xa8')]([],_0x2caed5);console[_0xdae2('0xa1')]('TCL:\x20_object',_0x2caed5);_['remove'](_0x49f603,function(_0x5e6a0a){return _0xe280d3[_0xdae2('0xa4')](_0x5e6a0a[_0xdae2('0x2c')]);});console[_0xdae2('0xa1')](_0xdae2('0xa9'),_0x49f603);_0x353f02=[];_0x49f603[_0xdae2('0xa5')](function(_0x10800c){var _0x164779=createFieldObject(_0x16e0f9,_0x15e7ce,_0x10800c[_0xdae2('0xa6')],_0x10800c[_0xdae2('0x2c')],_0x10800c[_0xdae2('0xaa')],!![]);_0x353f02[_0xdae2('0xa7')](_0x164779);});return Promise[_0xdae2('0xab')](_0x353f02);})['then'](function(_0x7e777e){_0x146591=_0x7e777e;var _0x1a8db8=_0x34e969['concat'](_0x146591);return{'count':_0x1a8db8[_0xdae2('0x4b')],'rows':_0x1a8db8};})[_0xdae2('0x27')](respondWithResult(_0xc0c120,null))[_0xdae2('0x47')](function(_0x19b844){console[_0xdae2('0xa1')](_0xdae2('0xac')+_0x19b844);var _0x3afd59=_0x46cd12[_0xdae2('0x36')][_0xdae2('0xad')]?0x1f4:_0x19b844[_0xdae2('0xae')]||0x1f4;logger[_0xdae2('0x2a')](_0x19b844[_0xdae2('0x2b')]);delete _0x19b844[_0xdae2('0x2c')];if(_0x3afd59===0x191){_0x3afd59=0x190;}_0xc0c120[_0xdae2('0x1c')](_0x3afd59)[_0xdae2('0x2d')](_0x46cd12['query']['test']?{'message':_0xdae2('0xaf'),'statusCode':_0x19b844[_0xdae2('0xae')]}:_0x19b844);});};function createFieldObject(_0x2578c3,_0x8664ed,_0x4ea8e8,_0x170ed5,_0x2bb770,_0x1912e5){return new Promise(function(_0x4f36e3,_0x355277){var _0x5ad302={'id':_0x170ed5,'name':_0x2bb770,'custom':_0x1912e5};if(_0x4ea8e8===_0xdae2('0xb0')){_0x5ad302[_0xdae2('0x53')]=[{'name':_0xdae2('0xb1'),'value':_0xdae2('0xb2')},{'name':_0xdae2('0xb3'),'value':_0xdae2('0xb4')}];_0x4f36e3(_0x5ad302);}else{var _0x44c05c={'method':_0xdae2('0xb5'),'uri':_0x2578c3+_0xdae2('0xb6')+_0x170ed5,'auth':_0x8664ed,'json':!![]};return rp(_0x44c05c)[_0xdae2('0x27')](function(_0x3793d3){var _0x695c06=[];if(_0x3793d3['result'][_0xdae2('0x4b')]>0x0){_0x3793d3[_0xdae2('0xa0')]['forEach'](function(_0x2adb00){if(_0x2adb00[_0xdae2('0xb7')]===_0xdae2('0xb4')){var _0x8eed5a={'name':_0x2adb00['label'],'value':_0x2adb00[_0xdae2('0xb8')]};_0x695c06[_0xdae2('0xa7')](_0x8eed5a);}});}_0x5ad302[_0xdae2('0x53')]=_0x695c06;if(_0x5ad302[_0xdae2('0x53')]['length']>0x0){_0x4f36e3(_0x5ad302);}else{if(_0x1912e5==![]){_0x4f36e3();}else{_0x4f36e3(_0x5ad302);}}});}});} \ No newline at end of file +var _0x612b=['Content-Range','apply','save','update','then','destroy','stack','send','map','ServicenowAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','name','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','findOne','ServicenowConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','hold_reason','knowledge','subcategory','notify','severity','parent','made_sla','watch_list','upon_reject','approval_history','number','resolved_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x258b61,_0x24e6bf){var _0x1d9bc2=function(_0x16d123){while(--_0x16d123){_0x258b61['push'](_0x258b61['shift']());}};_0x1d9bc2(++_0x24e6bf);}(_0x612b,0x14e));var _0xb612=function(_0x6ee255,_0x367e67){_0x6ee255=_0x6ee255-0x0;var _0x3f059c=_0x612b[_0x6ee255];return _0x3f059c;};'use strict';var emlformat=require(_0xb612('0x0'));var rimraf=require(_0xb612('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb612('0x2'));var rp=require(_0xb612('0x3'));var moment=require('moment');var BPromise=require(_0xb612('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb612('0x5'));var sox=require(_0xb612('0x6'));var csv=require(_0xb612('0x7'));var ejs=require(_0xb612('0x8'));var fs=require('fs');var fs_extra=require(_0xb612('0x9'));var _=require(_0xb612('0xa'));var squel=require(_0xb612('0xb'));var crypto=require(_0xb612('0xc'));var jsforce=require(_0xb612('0xd'));var deskjs=require(_0xb612('0xe'));var toCsv=require(_0xb612('0x7'));var querystring=require(_0xb612('0xf'));var Papa=require(_0xb612('0x10'));var Redis=require(_0xb612('0x11'));var authService=require(_0xb612('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb612('0x13'))(_0xb612('0x14'));var utils=require(_0xb612('0x15'));var config=require(_0xb612('0x16'));var licenseUtil=require(_0xb612('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb612('0x18'));function respondWithStatusCode(_0x348afa,_0xf45e19){_0xf45e19=_0xf45e19||0xcc;return function(_0x156ede){if(_0x156ede){return _0x348afa[_0xb612('0x19')](_0xf45e19);}return _0x348afa[_0xb612('0x1a')](_0xf45e19)[_0xb612('0x1b')]();};}function respondWithResult(_0x4c6029,_0x3cb83c){_0x3cb83c=_0x3cb83c||0xc8;return function(_0x2094bb){if(_0x2094bb){return _0x4c6029[_0xb612('0x1a')](_0x3cb83c)[_0xb612('0x1c')](_0x2094bb);}};}function respondWithFilteredResult(_0x2fb69b,_0x53d629){return function(_0x3ac5a6){if(_0x3ac5a6){var _0x21fec3=typeof _0x53d629[_0xb612('0x1d')]==='undefined'&&typeof _0x53d629[_0xb612('0x1e')]===_0xb612('0x1f');var _0x20c139=_0x3ac5a6[_0xb612('0x20')];var _0xa86c19=_0x21fec3?0x0:_0x53d629['offset'];var _0x174363=_0x21fec3?_0x3ac5a6[_0xb612('0x20')]:_0x53d629[_0xb612('0x1d')]+_0x53d629[_0xb612('0x1e')];var _0x26319f;if(_0x174363>=_0x20c139){_0x174363=_0x20c139;_0x26319f=0xc8;}else{_0x26319f=0xce;}_0x2fb69b[_0xb612('0x1a')](_0x26319f);return _0x2fb69b[_0xb612('0x21')](_0xb612('0x22'),_0xa86c19+'-'+_0x174363+'/'+_0x20c139)[_0xb612('0x1c')](_0x3ac5a6);}return null;};}function patchUpdates(_0x172f9c){return function(_0x5ed850){try{jsonpatch[_0xb612('0x23')](_0x5ed850,_0x172f9c,!![]);}catch(_0x4f02c3){return BPromise['reject'](_0x4f02c3);}return _0x5ed850[_0xb612('0x24')]();};}function saveUpdates(_0x56641c,_0x431136){return function(_0x28f21e){if(_0x28f21e){return _0x28f21e[_0xb612('0x25')](_0x56641c)[_0xb612('0x26')](function(_0x3669b7){return _0x3669b7;});}return null;};}function removeEntity(_0x47ae8b,_0x19fe9f){return function(_0x305e48){if(_0x305e48){return _0x305e48[_0xb612('0x27')]()[_0xb612('0x26')](function(){_0x47ae8b[_0xb612('0x1a')](0xcc)[_0xb612('0x1b')]();});}};}function handleEntityNotFound(_0x2a16c8,_0x374d48){return function(_0x5918f3){if(!_0x5918f3){_0x2a16c8[_0xb612('0x19')](0x194);}return _0x5918f3;};}function handleError(_0x4249dc,_0x2705c1){_0x2705c1=_0x2705c1||0x1f4;return function(_0x2e0880){logger['error'](_0x2e0880[_0xb612('0x28')]);if(_0x2e0880['name']){delete _0x2e0880['name'];}_0x4249dc[_0xb612('0x1a')](_0x2705c1)[_0xb612('0x29')](_0x2e0880);};}exports['index']=function(_0x482f60,_0x41c0d2){var _0x2aa910={},_0x362557={},_0x52b1a8={'count':0x0,'rows':[]};var _0x39d781=_[_0xb612('0x2a')](db[_0xb612('0x2b')][_0xb612('0x2c')],function(_0xcbb2c4){return{'name':_0xcbb2c4[_0xb612('0x2d')],'type':_0xcbb2c4['type']['key']};});_0x362557[_0xb612('0x2e')]=_[_0xb612('0x2a')](_0x39d781,'name');_0x362557[_0xb612('0x2f')]=_[_0xb612('0x30')](_0x482f60[_0xb612('0x2f')]);_0x362557[_0xb612('0x31')]=_[_0xb612('0x32')](_0x362557[_0xb612('0x2e')],_0x362557[_0xb612('0x2f')]);_0x2aa910[_0xb612('0x33')]=_[_0xb612('0x32')](_0x362557[_0xb612('0x2e')],qs[_0xb612('0x34')](_0x482f60[_0xb612('0x2f')][_0xb612('0x34')]));_0x2aa910['attributes']=_0x2aa910[_0xb612('0x33')][_0xb612('0x35')]?_0x2aa910[_0xb612('0x33')]:_0x362557[_0xb612('0x2e')];if(!_0x482f60['query'][_0xb612('0x36')]('nolimit')){_0x2aa910[_0xb612('0x1e')]=qs[_0xb612('0x1e')](_0x482f60[_0xb612('0x2f')][_0xb612('0x1e')]);_0x2aa910[_0xb612('0x1d')]=qs['offset'](_0x482f60[_0xb612('0x2f')][_0xb612('0x1d')]);}_0x2aa910['order']=qs[_0xb612('0x37')](_0x482f60[_0xb612('0x2f')][_0xb612('0x37')]);_0x2aa910[_0xb612('0x38')]=qs['filters'](_[_0xb612('0x39')](_0x482f60['query'],_0x362557[_0xb612('0x31')]),_0x39d781);if(_0x482f60[_0xb612('0x2f')][_0xb612('0x3a')]){_0x2aa910[_0xb612('0x38')]=_['merge'](_0x2aa910[_0xb612('0x38')],{'$or':_[_0xb612('0x2a')](_0x39d781,function(_0x3f49d0){if(_0x3f49d0[_0xb612('0x3b')]!==_0xb612('0x3c')){var _0x5a08ad={};_0x5a08ad[_0x3f49d0[_0xb612('0x3d')]]={'$like':'%'+_0x482f60[_0xb612('0x2f')][_0xb612('0x3a')]+'%'};return _0x5a08ad;}})});}_0x2aa910=_[_0xb612('0x3e')]({},_0x2aa910,_0x482f60['options']);var _0x29d19c={'where':_0x2aa910[_0xb612('0x38')]};return db[_0xb612('0x2b')][_0xb612('0x20')](_0x29d19c)[_0xb612('0x26')](function(_0x1c5fed){_0x52b1a8[_0xb612('0x20')]=_0x1c5fed;if(_0x482f60[_0xb612('0x2f')][_0xb612('0x3f')]){_0x2aa910[_0xb612('0x40')]=[{'all':!![]}];}return db[_0xb612('0x2b')][_0xb612('0x41')](_0x2aa910);})[_0xb612('0x26')](function(_0x503981){_0x52b1a8[_0xb612('0x42')]=_0x503981;return _0x52b1a8;})[_0xb612('0x26')](respondWithFilteredResult(_0x41c0d2,_0x2aa910))[_0xb612('0x43')](handleError(_0x41c0d2,null));};exports[_0xb612('0x44')]=function(_0x549930,_0x16c1a2){var _0x41150d={'raw':![],'where':{'id':_0x549930[_0xb612('0x45')]['id']}},_0x3e03cb={};_0x3e03cb[_0xb612('0x2e')]=_[_0xb612('0x30')](db['ServicenowAccount'][_0xb612('0x2c')]);_0x3e03cb[_0xb612('0x2f')]=_[_0xb612('0x30')](_0x549930[_0xb612('0x2f')]);_0x3e03cb[_0xb612('0x31')]=_[_0xb612('0x32')](_0x3e03cb[_0xb612('0x2e')],_0x3e03cb['query']);_0x41150d[_0xb612('0x33')]=_[_0xb612('0x32')](_0x3e03cb[_0xb612('0x2e')],qs[_0xb612('0x34')](_0x549930[_0xb612('0x2f')][_0xb612('0x34')]));_0x41150d[_0xb612('0x33')]=_0x41150d['attributes'][_0xb612('0x35')]?_0x41150d['attributes']:_0x3e03cb['model'];if(_0x549930['query'][_0xb612('0x3f')]){_0x41150d[_0xb612('0x40')]=[{'all':!![]}];}_0x41150d=_['merge']({},_0x41150d,_0x549930[_0xb612('0x46')]);return db[_0xb612('0x2b')][_0xb612('0x47')](_0x41150d)[_0xb612('0x26')](handleEntityNotFound(_0x16c1a2,null))['then'](respondWithResult(_0x16c1a2,null))['catch'](handleError(_0x16c1a2,null));};exports[_0xb612('0x48')]=function(_0x165661,_0x388f81){return db[_0xb612('0x2b')][_0xb612('0x48')](_0x165661['body'],{})[_0xb612('0x26')](respondWithResult(_0x388f81,0xc9))[_0xb612('0x43')](handleError(_0x388f81,null));};exports['update']=function(_0x22c21a,_0x433ff8){if(_0x22c21a[_0xb612('0x49')]['id']){delete _0x22c21a[_0xb612('0x49')]['id'];}return db['ServicenowAccount'][_0xb612('0x47')]({'where':{'id':_0x22c21a[_0xb612('0x45')]['id']}})['then'](handleEntityNotFound(_0x433ff8,null))[_0xb612('0x26')](saveUpdates(_0x22c21a[_0xb612('0x49')],null))[_0xb612('0x26')](respondWithResult(_0x433ff8,null))['catch'](handleError(_0x433ff8,null));};exports['destroy']=function(_0x43e97c,_0x583ab3){return db[_0xb612('0x2b')]['find']({'where':{'id':_0x43e97c[_0xb612('0x45')]['id']}})[_0xb612('0x26')](handleEntityNotFound(_0x583ab3,null))[_0xb612('0x26')](removeEntity(_0x583ab3,null))[_0xb612('0x43')](handleError(_0x583ab3,null));};exports['getConfigurations']=function(_0x1ca6a5,_0x371a71,_0x4af626){var _0x2b9987={};var _0x2c71eb={};var _0x260526;var _0x4d0295;return db[_0xb612('0x2b')][_0xb612('0x4a')]({'where':{'id':_0x1ca6a5[_0xb612('0x45')]['id']}})[_0xb612('0x26')](handleEntityNotFound(_0x371a71,null))[_0xb612('0x26')](function(_0x2267a8){if(_0x2267a8){_0x260526=_0x2267a8;_0x2c71eb[_0xb612('0x2e')]=_[_0xb612('0x30')](db[_0xb612('0x4b')][_0xb612('0x2c')]);_0x2c71eb[_0xb612('0x2f')]=_[_0xb612('0x30')](_0x1ca6a5['query']);_0x2c71eb[_0xb612('0x31')]=_[_0xb612('0x32')](_0x2c71eb['model'],_0x2c71eb[_0xb612('0x2f')]);_0x2b9987[_0xb612('0x33')]=_[_0xb612('0x32')](_0x2c71eb[_0xb612('0x2e')],qs['fields'](_0x1ca6a5['query']['fields']));_0x2b9987[_0xb612('0x33')]=_0x2b9987[_0xb612('0x33')][_0xb612('0x35')]?_0x2b9987['attributes']:_0x2c71eb[_0xb612('0x2e')];_0x2b9987['order']=qs[_0xb612('0x37')](_0x1ca6a5['query'][_0xb612('0x37')]);_0x2b9987['where']=qs[_0xb612('0x31')](_[_0xb612('0x39')](_0x1ca6a5['query'],_0x2c71eb[_0xb612('0x31')]));if(_0x1ca6a5['query'][_0xb612('0x3a')]){_0x2b9987[_0xb612('0x38')]=_[_0xb612('0x3e')](_0x2b9987['where'],{'$or':_[_0xb612('0x2a')](_0x2b9987[_0xb612('0x33')],function(_0x40abd2){var _0x4294f6={};_0x4294f6[_0x40abd2]={'$like':'%'+_0x1ca6a5[_0xb612('0x2f')][_0xb612('0x3a')]+'%'};return _0x4294f6;})});}_0x2b9987=_[_0xb612('0x3e')]({},_0x2b9987,_0x1ca6a5[_0xb612('0x46')]);return _0x260526[_0xb612('0x4c')](_0x2b9987);}})[_0xb612('0x26')](function(_0x22fc1a){if(_0x22fc1a){_0x4d0295=_0x22fc1a[_0xb612('0x35')];if(!_0x1ca6a5['query'][_0xb612('0x36')](_0xb612('0x4d'))){_0x2b9987['limit']=qs[_0xb612('0x1e')](_0x1ca6a5['query'][_0xb612('0x1e')]);_0x2b9987[_0xb612('0x1d')]=qs['offset'](_0x1ca6a5[_0xb612('0x2f')]['offset']);}return _0x260526['getConfigurations'](_0x2b9987);}})['then'](function(_0x2dc876){if(_0x2dc876){return _0x2dc876?{'count':_0x4d0295,'rows':_0x2dc876}:null;}})[_0xb612('0x26')](respondWithResult(_0x371a71,null))[_0xb612('0x43')](handleError(_0x371a71,null));};exports[_0xb612('0x4e')]=function(_0x15a1be,_0x2a8d84,_0x494cab){if(_0x15a1be[_0xb612('0x49')]['id']){delete _0x15a1be[_0xb612('0x49')]['id'];}return db['ServicenowAccount'][_0xb612('0x4a')]({'where':{'id':_0x15a1be[_0xb612('0x45')]['id']}})[_0xb612('0x26')](handleEntityNotFound(_0x2a8d84,null))['then'](function(_0x391db5){if(_0x391db5){_0x15a1be[_0xb612('0x49')][_0xb612('0x4f')]=_0x391db5['id'];_0x15a1be['body'][_0xb612('0x50')]=integrations[_0xb612('0x51')](_0x15a1be['body']['channel'],_0x15a1be[_0xb612('0x49')][_0xb612('0x3b')]);_0x15a1be['body'][_0xb612('0x52')]=integrations[_0xb612('0x53')](_0x15a1be[_0xb612('0x49')][_0xb612('0x54')],_0x15a1be[_0xb612('0x49')][_0xb612('0x3b')]);return db[_0xb612('0x4b')][_0xb612('0x48')](_0x15a1be['body'],{'include':[{'model':db['ServicenowField'],'as':_0xb612('0x50')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0xb612('0x26')](respondWithResult(_0x2a8d84,null))['catch'](handleError(_0x2a8d84,null));};exports[_0xb612('0x55')]=function(_0x30c40b,_0x242ff9,_0xa2f1cf){var _0x2dad65=['made_sla',_0xb612('0x56'),_0xb612('0x57'),_0xb612('0x58'),'close_code',_0xb612('0x59'),'incident_state',_0xb612('0x5a'),'category'];var _0x52bb1c=[_0xb612('0x5b'),_0xb612('0x5c'),'caused_by',_0xb612('0x5d'),_0xb612('0x5e'),'sys_updated_on','child_incidents',_0xb612('0x56'),_0xb612('0x5f'),_0xb612('0x60'),_0xb612('0x61'),'sys_updated_by','opened_by',_0xb612('0x62'),_0xb612('0x63'),'sys_domain',_0xb612('0x64'),_0xb612('0x65'),_0xb612('0x57'),'order',_0xb612('0x66'),_0xb612('0x67'),'cmdb_ci',_0xb612('0x68'),_0xb612('0x69'),_0xb612('0x6a'),'work_notes_list','business_service',_0xb612('0x6b'),_0xb612('0x6c'),'rfc',_0xb612('0x6d'),_0xb612('0x6e'),_0xb612('0x6f'),_0xb612('0x70'),'group_list',_0xb612('0x71'),_0xb612('0x72'),_0xb612('0x73'),_0xb612('0x74'),_0xb612('0x75'),_0xb612('0x58'),_0xb612('0x76'),_0xb612('0x77'),'close_code','correlation_display',_0xb612('0x78'),_0xb612('0x79'),_0xb612('0x7a'),'business_stc',_0xb612('0x7b'),_0xb612('0x7c'),_0xb612('0x7d'),'notify',_0xb612('0x7e'),_0xb612('0x7f'),_0xb612('0x80'),_0xb612('0x81'),_0xb612('0x82'),_0xb612('0x83'),_0xb612('0x84'),'reopened_by',_0xb612('0x85'),_0xb612('0x86'),_0xb612('0x87'),_0xb612('0x88'),_0xb612('0x89'),'activity_due',_0xb612('0x8a'),_0xb612('0x5a'),_0xb612('0x8b'),_0xb612('0x8c'),_0xb612('0x8d'),_0xb612('0x8e'),_0xb612('0x8f'),_0xb612('0x90'),'reopen_count',_0xb612('0x91'),_0xb612('0x92'),_0xb612('0x93'),_0xb612('0x94'),_0xb612('0x95'),_0xb612('0x96')];var _0x23f88c='';var _0x41a9a8='';var _0x3efc68=[];var _0x3dbf3b='';var _0x40bf9c='';var _0x211b6e=[];var _0x3f3d70='';var _0x11a230='';var _0x2f8ac6={};var _0xff3cc1='';return db[_0xb612('0x2b')][_0xb612('0x4a')]({'where':{'id':_0x30c40b[_0xb612('0x45')]['id']},'attributes':['id',_0xb612('0x97'),_0xb612('0x98'),_0xb612('0x99'),_0xb612('0x9a'),_0xb612('0x9b')]})[_0xb612('0x26')](handleEntityNotFound(_0x242ff9,null))[_0xb612('0x26')](function(_0x2b36fc){if(_0x2b36fc){_0xff3cc1=_0x2b36fc[_0xb612('0x9a')];var _0x1418fe=_0xff3cc1[_0xb612('0x9c')](-0x1);if(_0x1418fe==='/'){_0xff3cc1=_0xff3cc1[_0xb612('0x9d')](0x0,_0xff3cc1[_0xb612('0x9e')](_0x1418fe));}_0x11a230=util[_0xb612('0x9f')]('%s/api/now/doc/table/schema/',_0xff3cc1);_0x3f3d70=util['format'](_0xb612('0xa0'),_0xff3cc1);_0x2f8ac6={'user':_0x2b36fc[_0xb612('0x97')],'pass':_0x2b36fc[_0xb612('0x98')]};var _0x378e96={'method':_0xb612('0xa1'),'uri':_0x11a230+_0xb612('0xa2'),'auth':_0x2f8ac6,'json':!![]};return rp(_0x378e96);}})[_0xb612('0x26')](function(_0x1f3ba3){if(_0x1f3ba3[_0xb612('0xa3')][_0xb612('0x35')]>0x0){_0x23f88c=_0x1f3ba3[_0xb612('0xa3')];}console[_0xb612('0xa4')](_0xb612('0xa5'),_0x23f88c);_0x211b6e=[];_0x41a9a8=Object[_0xb612('0xa6')]([],_0x23f88c);_['remove'](_0x41a9a8,function(_0x1e79e1){return!_0x2dad65[_0xb612('0xa7')](_0x1e79e1['name']);});_0x41a9a8[_0xb612('0xa8')](function(_0x339146){var _0x5b207c=createFieldObject(_0x3f3d70,_0x2f8ac6,_0x339146['internalType'],_0x339146['name'],_0x339146[_0xb612('0xa9')],![]);_0x211b6e['push'](_0x5b207c);});return Promise[_0xb612('0xaa')](_0x211b6e);})[_0xb612('0x26')](function(_0x1503ef){_0x3efc68=_0x1503ef;_0x3dbf3b=Object['assign']([],_0x23f88c);console[_0xb612('0xa4')](_0xb612('0xab'),_0x23f88c);_['remove'](_0x3dbf3b,function(_0x4dfedf){return _0x52bb1c[_0xb612('0xa7')](_0x4dfedf[_0xb612('0x3d')]);});console[_0xb612('0xa4')](_0xb612('0xac'),_0x3dbf3b);_0x211b6e=[];_0x3dbf3b[_0xb612('0xa8')](function(_0x49c936){var _0x2d6d0f=createFieldObject(_0x3f3d70,_0x2f8ac6,_0x49c936['internalType'],_0x49c936['name'],_0x49c936[_0xb612('0xa9')],!![]);_0x211b6e[_0xb612('0xad')](_0x2d6d0f);});return Promise[_0xb612('0xaa')](_0x211b6e);})[_0xb612('0x26')](function(_0x5da962){_0x40bf9c=_0x5da962;var _0x282aa2=_0x3efc68[_0xb612('0xae')](_0x40bf9c);return{'count':_0x282aa2['length'],'rows':_0x282aa2};})[_0xb612('0x26')](respondWithResult(_0x242ff9,null))[_0xb612('0x43')](function(_0x3664eb){console[_0xb612('0xa4')](_0xb612('0xaf')+_0x3664eb);var _0x4c945a=_0x30c40b[_0xb612('0x2f')][_0xb612('0xb0')]?0x1f4:_0x3664eb[_0xb612('0xb1')]||0x1f4;logger['error'](_0x3664eb[_0xb612('0x28')]);delete _0x3664eb[_0xb612('0x3d')];if(_0x4c945a===0x191){_0x4c945a=0x190;}_0x242ff9[_0xb612('0x1a')](_0x4c945a)[_0xb612('0x29')](_0x30c40b[_0xb612('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3664eb[_0xb612('0xb1')]}:_0x3664eb);});};function createFieldObject(_0x43c03f,_0x1dc62b,_0x37c2bf,_0x4df5ee,_0x4c6a89,_0x1b400b){return new Promise(function(_0x15b849,_0x2957c8){var _0x2cb5df={'id':_0x4df5ee,'name':_0x4c6a89,'custom':_0x1b400b};if(_0x37c2bf===_0xb612('0xb2')){_0x2cb5df['options']=[{'name':_0xb612('0xb3'),'value':_0xb612('0xb4')},{'name':'False','value':_0xb612('0xb5')}];_0x15b849(_0x2cb5df);}else{var _0x169346={'method':'GET','uri':_0x43c03f+_0xb612('0xb6')+_0x4df5ee,'auth':_0x1dc62b,'json':!![]};return rp(_0x169346)[_0xb612('0x26')](function(_0x30f4fc){var _0x241e37=[];if(_0x30f4fc[_0xb612('0xa3')][_0xb612('0x35')]>0x0){_0x30f4fc['result'][_0xb612('0xa8')](function(_0x5e1fb2){if(_0x5e1fb2['inactive']===_0xb612('0xb5')){var _0x59d765={'name':_0x5e1fb2[_0xb612('0xa9')],'value':_0x5e1fb2[_0xb612('0xb7')]};_0x241e37[_0xb612('0xad')](_0x59d765);}});}_0x2cb5df[_0xb612('0x46')]=_0x241e37;if(_0x2cb5df[_0xb612('0x46')]['length']>0x0){_0x15b849(_0x2cb5df);}else{if(_0x1b400b==![]){_0x15b849();}else{_0x15b849(_0x2cb5df);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7afc50a..e255ec6 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 _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5e4905,_0xa25560){var _0x4d5fb4=function(_0xe69abe){while(--_0xe69abe){_0x5e4905['push'](_0x5e4905['shift']());}};_0x4d5fb4(++_0xa25560);}(_0x31f0,0xb7));var _0x031f=function(_0x1a386d,_0x376b88){_0x1a386d=_0x1a386d-0x0;var _0x2c33b0=_0x31f0[_0x1a386d];return _0x2c33b0;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x2b9f8b,_0x383fe7){var _0x2e4202=function(_0x4418fc){while(--_0x4418fc){_0x2b9f8b['push'](_0x2b9f8b['shift']());}};_0x2e4202(++_0x383fe7);}(_0x7217,0x19e));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'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 1d16add..e45aa5c 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 _0x266e=['map','debug','catch','ShowServicenowAccount','find','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','model'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x266e,0x103));var _0xe266=function(_0x5f5d89,_0x18fba5){_0x5f5d89=_0x5f5d89-0x0;var _0x2f7b07=_0x266e[_0x5f5d89];return _0x2f7b07;};'use strict';var _=require(_0xe266('0x0'));var util=require(_0xe266('0x1'));var moment=require('moment');var BPromise=require(_0xe266('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe266('0x3'));var db=require(_0xe266('0x4'))['db'];var utils=require(_0xe266('0x5'));var logger=require('../../config/logger')(_0xe266('0x6'));var config=require(_0xe266('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe266('0x8')][_0xe266('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf57ae9,_0x160265,_0x197814){return new BPromise(function(_0x471923,_0x32c78c){return client[_0xe266('0xa')](_0xf57ae9,_0x197814)[_0xe266('0xb')](function(_0x730742){logger[_0xe266('0xc')](_0xe266('0xd'),_0x160265,_0xe266('0xe'));logger['debug'](_0xe266('0xf'),_0x160265,_0xe266('0xe'),JSON['stringify'](_0x730742));if(_0x730742[_0xe266('0x10')]){if(_0x730742[_0xe266('0x10')][_0xe266('0x11')]===0x1f4){logger[_0xe266('0x10')](_0xe266('0xd'),_0x160265,_0x730742[_0xe266('0x10')]['message']);return _0x32c78c(_0x730742[_0xe266('0x10')][_0xe266('0x12')]);}logger[_0xe266('0x10')](_0xe266('0xd'),_0x160265,_0x730742[_0xe266('0x10')][_0xe266('0x12')]);return _0x471923(_0x730742[_0xe266('0x10')][_0xe266('0x12')]);}else{logger[_0xe266('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x160265,_0xe266('0xe'));_0x471923(_0x730742[_0xe266('0x13')][_0xe266('0x12')]);}})['catch'](function(_0x354900){logger[_0xe266('0x10')](_0xe266('0xd'),_0x160265,_0x354900);_0x32c78c(_0x354900);});});}exports[_0xe266('0x14')]=function(_0x3d6fa9){var _0x36d2be=this;return new Promise(function(_0x36aee8,_0x5c2890){return db[_0xe266('0x15')][_0xe266('0x16')]({'raw':_0x3d6fa9[_0xe266('0x17')]?_0x3d6fa9['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d6fa9[_0xe266('0x17')]?_0x3d6fa9[_0xe266('0x17')][_0xe266('0x18')]||null:null,'attributes':_0x3d6fa9[_0xe266('0x17')]?_0x3d6fa9[_0xe266('0x17')][_0xe266('0x19')]||null:null,'limit':_0x3d6fa9[_0xe266('0x17')]?_0x3d6fa9[_0xe266('0x17')][_0xe266('0x1a')]||null:null,'include':_0x3d6fa9[_0xe266('0x17')]?_0x3d6fa9['options'][_0xe266('0x1b')]?_['map'](_0x3d6fa9['options']['include'],function(_0x16bbfe){return{'model':db[_0x16bbfe[_0xe266('0x1c')]],'as':_0x16bbfe['as'],'attributes':_0x16bbfe['attributes'],'include':_0x16bbfe[_0xe266('0x1b')]?_[_0xe266('0x1d')](_0x16bbfe[_0xe266('0x1b')],function(_0x2a62c6){return{'model':db[_0x2a62c6['model']],'as':_0x2a62c6['as'],'attributes':_0x2a62c6[_0xe266('0x19')],'include':_0x2a62c6['include']?_[_0xe266('0x1d')](_0x2a62c6[_0xe266('0x1b')],function(_0x2c3cad){return{'model':db[_0x2c3cad['model']],'as':_0x2c3cad['as'],'attributes':_0x2c3cad['attributes']};}):[]};}):[]};}):[]:[]})[_0xe266('0xb')](function(_0x5d0718){logger[_0xe266('0xc')](_0xe266('0x14'),_0x3d6fa9);logger[_0xe266('0x1e')](_0xe266('0x14'),_0x3d6fa9,JSON['stringify'](_0x5d0718));_0x36aee8(_0x5d0718);})[_0xe266('0x1f')](function(_0x425723){logger['error']('GetServicenowAccount',_0x425723[_0xe266('0x12')],_0x3d6fa9);_0x5c2890(_0x36d2be[_0xe266('0x10')](0x1f4,_0x425723[_0xe266('0x12')]));});});};exports[_0xe266('0x20')]=function(_0x4c53c2){var _0x5fc304=this;return new Promise(function(_0x312ba8,_0x2fccc0){return db[_0xe266('0x15')][_0xe266('0x21')]({'raw':_0x4c53c2[_0xe266('0x17')]?_0x4c53c2[_0xe266('0x17')][_0xe266('0x22')]===undefined?!![]:![]:!![],'where':_0x4c53c2[_0xe266('0x17')]?_0x4c53c2['options']['where']||null:null,'attributes':_0x4c53c2[_0xe266('0x17')]?_0x4c53c2[_0xe266('0x17')][_0xe266('0x19')]||null:null,'include':_0x4c53c2[_0xe266('0x17')]?_0x4c53c2['options']['include']?_[_0xe266('0x1d')](_0x4c53c2['options'][_0xe266('0x1b')],function(_0x5717e8){return{'model':db[_0x5717e8[_0xe266('0x1c')]],'as':_0x5717e8['as'],'attributes':_0x5717e8[_0xe266('0x19')],'include':_0x5717e8[_0xe266('0x1b')]?_[_0xe266('0x1d')](_0x5717e8[_0xe266('0x1b')],function(_0x791bb){return{'model':db[_0x791bb['model']],'as':_0x791bb['as'],'attributes':_0x791bb['attributes'],'include':_0x791bb[_0xe266('0x1b')]?_[_0xe266('0x1d')](_0x791bb[_0xe266('0x1b')],function(_0x16ccab){return{'model':db[_0x16ccab[_0xe266('0x1c')]],'as':_0x16ccab['as'],'attributes':_0x16ccab[_0xe266('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe266('0xb')](function(_0x395ded){logger[_0xe266('0xc')]('ShowServicenowAccount',_0x4c53c2);logger[_0xe266('0x1e')]('ShowServicenowAccount',_0x4c53c2,JSON[_0xe266('0x23')](_0x395ded));_0x312ba8(_0x395ded);})[_0xe266('0x1f')](function(_0x2667cc){logger[_0xe266('0x10')](_0xe266('0x20'),_0x2667cc[_0xe266('0x12')],_0x4c53c2);_0x2fccc0(_0x5fc304['error'](0x1f4,_0x2667cc[_0xe266('0x12')]));});});}; \ No newline at end of file +var _0x3707=['info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','model','map','ShowServicenowAccount','find','raw','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then'];(function(_0x2a4f43,_0x5a8687){var _0x56727f=function(_0x4c0e16){while(--_0x4c0e16){_0x2a4f43['push'](_0x2a4f43['shift']());}};_0x56727f(++_0x5a8687);}(_0x3707,0x1e6));var _0x7370=function(_0x304b3d,_0x54fdc0){_0x304b3d=_0x304b3d-0x0;var _0x224078=_0x3707[_0x304b3d];return _0x224078;};'use strict';var _=require(_0x7370('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7370('0x1'));var fs=require('fs');var Redis=require(_0x7370('0x2'));var db=require(_0x7370('0x3'))['db'];var utils=require(_0x7370('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7370('0x5'));var client=jayson['client'][_0x7370('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x29bb57,_0x187847,_0x40e54e){return new BPromise(function(_0x5affff,_0x397749){return client[_0x7370('0x7')](_0x29bb57,_0x40e54e)[_0x7370('0x8')](function(_0x27e7c7){logger[_0x7370('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x187847,_0x7370('0xa'));logger[_0x7370('0xb')](_0x7370('0xc'),_0x187847,'request\x20sent',JSON[_0x7370('0xd')](_0x27e7c7));if(_0x27e7c7[_0x7370('0xe')]){if(_0x27e7c7['error'][_0x7370('0xf')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x187847,_0x27e7c7['error'][_0x7370('0x10')]);return _0x397749(_0x27e7c7['error']['message']);}logger[_0x7370('0xe')](_0x7370('0x11'),_0x187847,_0x27e7c7[_0x7370('0xe')][_0x7370('0x10')]);return _0x5affff(_0x27e7c7['error'][_0x7370('0x10')]);}else{logger[_0x7370('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x187847,'request\x20sent');_0x5affff(_0x27e7c7[_0x7370('0x12')]['message']);}})['catch'](function(_0x60fa63){logger[_0x7370('0xe')](_0x7370('0x11'),_0x187847,_0x60fa63);_0x397749(_0x60fa63);});});}exports[_0x7370('0x13')]=function(_0x5465f1){var _0x23f5f9=this;return new Promise(function(_0x5aef44,_0x4b68c4){return db[_0x7370('0x14')][_0x7370('0x15')]({'raw':_0x5465f1[_0x7370('0x16')]?_0x5465f1[_0x7370('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5465f1['options']?_0x5465f1[_0x7370('0x16')][_0x7370('0x17')]||null:null,'attributes':_0x5465f1[_0x7370('0x16')]?_0x5465f1['options'][_0x7370('0x18')]||null:null,'limit':_0x5465f1['options']?_0x5465f1[_0x7370('0x16')][_0x7370('0x19')]||null:null,'include':_0x5465f1[_0x7370('0x16')]?_0x5465f1[_0x7370('0x16')][_0x7370('0x1a')]?_['map'](_0x5465f1['options'][_0x7370('0x1a')],function(_0x59cbdd){return{'model':db[_0x59cbdd[_0x7370('0x1b')]],'as':_0x59cbdd['as'],'attributes':_0x59cbdd[_0x7370('0x18')],'include':_0x59cbdd[_0x7370('0x1a')]?_['map'](_0x59cbdd['include'],function(_0x49d60f){return{'model':db[_0x49d60f[_0x7370('0x1b')]],'as':_0x49d60f['as'],'attributes':_0x49d60f[_0x7370('0x18')],'include':_0x49d60f[_0x7370('0x1a')]?_[_0x7370('0x1c')](_0x49d60f[_0x7370('0x1a')],function(_0x15740d){return{'model':db[_0x15740d[_0x7370('0x1b')]],'as':_0x15740d['as'],'attributes':_0x15740d[_0x7370('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7370('0x8')](function(_0x3a6834){logger[_0x7370('0x9')]('GetServicenowAccount',_0x5465f1);logger['debug'](_0x7370('0x13'),_0x5465f1,JSON[_0x7370('0xd')](_0x3a6834));_0x5aef44(_0x3a6834);})['catch'](function(_0x4aaff8){logger[_0x7370('0xe')](_0x7370('0x13'),_0x4aaff8['message'],_0x5465f1);_0x4b68c4(_0x23f5f9[_0x7370('0xe')](0x1f4,_0x4aaff8[_0x7370('0x10')]));});});};exports[_0x7370('0x1d')]=function(_0x191311){var _0x136bf0=this;return new Promise(function(_0x8c6de8,_0x1b7db2){return db[_0x7370('0x14')][_0x7370('0x1e')]({'raw':_0x191311['options']?_0x191311[_0x7370('0x16')][_0x7370('0x1f')]===undefined?!![]:![]:!![],'where':_0x191311[_0x7370('0x16')]?_0x191311[_0x7370('0x16')][_0x7370('0x17')]||null:null,'attributes':_0x191311[_0x7370('0x16')]?_0x191311[_0x7370('0x16')][_0x7370('0x18')]||null:null,'include':_0x191311['options']?_0x191311[_0x7370('0x16')][_0x7370('0x1a')]?_[_0x7370('0x1c')](_0x191311[_0x7370('0x16')][_0x7370('0x1a')],function(_0x12a080){return{'model':db[_0x12a080[_0x7370('0x1b')]],'as':_0x12a080['as'],'attributes':_0x12a080[_0x7370('0x18')],'include':_0x12a080['include']?_[_0x7370('0x1c')](_0x12a080[_0x7370('0x1a')],function(_0x432365){return{'model':db[_0x432365[_0x7370('0x1b')]],'as':_0x432365['as'],'attributes':_0x432365['attributes'],'include':_0x432365['include']?_[_0x7370('0x1c')](_0x432365[_0x7370('0x1a')],function(_0x1bdd41){return{'model':db[_0x1bdd41[_0x7370('0x1b')]],'as':_0x1bdd41['as'],'attributes':_0x1bdd41[_0x7370('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18dbe9){logger[_0x7370('0x9')](_0x7370('0x1d'),_0x191311);logger[_0x7370('0xb')](_0x7370('0x1d'),_0x191311,JSON['stringify'](_0x18dbe9));_0x8c6de8(_0x18dbe9);})[_0x7370('0x20')](function(_0x5affbd){logger[_0x7370('0xe')](_0x7370('0x1d'),_0x5affbd['message'],_0x191311);_0x1b7db2(_0x136bf0[_0x7370('0xe')](0x1f4,_0x5affbd['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 687a3a1..fadfdb6 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 _0x6776=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x5aa02a,_0x5f213e){var _0x4f6786=function(_0x49cf08){while(--_0x49cf08){_0x5aa02a['push'](_0x5aa02a['shift']());}};_0x4f6786(++_0x5f213e);}(_0x6776,0x106));var _0x6677=function(_0x296d2f,_0x29ee9e){_0x296d2f=_0x296d2f-0x0;var _0x9a1653=_0x6776[_0x296d2f];return _0x9a1653;};'use strict';var multer=require(_0x6677('0x0'));var util=require('util');var path=require(_0x6677('0x1'));var timeout=require(_0x6677('0x2'));var express=require(_0x6677('0x3'));var router=express[_0x6677('0x4')]();var fs_extra=require(_0x6677('0x5'));var auth=require(_0x6677('0x6'));var interaction=require(_0x6677('0x7'));var config=require(_0x6677('0x8'));var controller=require(_0x6677('0x9'));router['get']('/',auth[_0x6677('0xa')](),controller[_0x6677('0xb')]);router['get'](_0x6677('0xc'),auth[_0x6677('0xa')](),controller['show']);router[_0x6677('0xd')](_0x6677('0xe'),auth['isAuthenticated'](),controller[_0x6677('0xf')]);router['get'](_0x6677('0x10'),auth['isAuthenticated'](),controller[_0x6677('0x11')]);router['get'](_0x6677('0x12'),auth[_0x6677('0xa')](),controller[_0x6677('0x13')]);router[_0x6677('0x14')]('/',auth[_0x6677('0xa')](),controller[_0x6677('0x15')]);router[_0x6677('0x16')](_0x6677('0xc'),auth[_0x6677('0xa')](),controller[_0x6677('0x17')]);router['delete']('/:id',auth[_0x6677('0xa')](),controller[_0x6677('0x18')]);module[_0x6677('0x19')]=router; \ No newline at end of file +var _0xfef1=['exports','util','connect-timeout','express','Router','./intServicenowConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete'];(function(_0xa51b,_0x2a9a94){var _0x4fa43e=function(_0x2a55d1){while(--_0x2a55d1){_0xa51b['push'](_0xa51b['shift']());}};_0x4fa43e(++_0x2a9a94);}(_0xfef1,0x157));var _0x1fef=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xfef1[_0x1fc122];return _0xa2cb13;};'use strict';var multer=require('multer');var util=require(_0x1fef('0x0'));var path=require('path');var timeout=require(_0x1fef('0x1'));var express=require(_0x1fef('0x2'));var router=express[_0x1fef('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1fef('0x4'));router[_0x1fef('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1fef('0x5')](_0x1fef('0x6'),auth['isAuthenticated'](),controller[_0x1fef('0x7')]);router[_0x1fef('0x5')](_0x1fef('0x8'),auth[_0x1fef('0x9')](),controller['getFields']);router[_0x1fef('0x5')](_0x1fef('0xa'),auth['isAuthenticated'](),controller[_0x1fef('0xb')]);router['get']('/:id/descriptions',auth[_0x1fef('0x9')](),controller[_0x1fef('0xc')]);router[_0x1fef('0xd')]('/',auth[_0x1fef('0x9')](),controller[_0x1fef('0xe')]);router[_0x1fef('0xf')](_0x1fef('0x6'),auth[_0x1fef('0x9')](),controller[_0x1fef('0x10')]);router[_0x1fef('0x11')](_0x1fef('0x6'),auth[_0x1fef('0x9')](),controller['destroy']);module[_0x1fef('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 b30d62c..d1c7cef 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 _0x6cf6=['sequelize','exports','STRING'];(function(_0x1b3ddb,_0x190f99){var _0x3b952d=function(_0x590bd0){while(--_0x590bd0){_0x1b3ddb['push'](_0x1b3ddb['shift']());}};_0x3b952d(++_0x190f99);}(_0x6cf6,0x120));var _0x66cf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6cf6[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x66cf('0x0'));module[_0x66cf('0x1')]={'name':{'type':Sequelize[_0x66cf('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c4d=['exports','STRING','sequelize'];(function(_0x349407,_0x1b1a22){var _0x120773=function(_0x128e6d){while(--_0x128e6d){_0x349407['push'](_0x349407['shift']());}};_0x120773(++_0x1b1a22);}(_0x8c4d,0xbc));var _0xd8c4=function(_0xeffc63,_0x4acafd){_0xeffc63=_0xeffc63-0x0;var _0x175db2=_0x8c4d[_0xeffc63];return _0x175db2;};'use strict';var Sequelize=require(_0xd8c4('0x0'));module[_0xd8c4('0x1')]={'name':{'type':Sequelize[_0xd8c4('0x2')]},'description':{'type':Sequelize[_0xd8c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 9aea4ea..083e454 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 _0x569d=['end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','then','include','keys','find','catch','create','body','params','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','filter','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x411a39,_0x120a4b){var _0x55bb4e=function(_0x39e9ef){while(--_0x39e9ef){_0x411a39['push'](_0x411a39['shift']());}};_0x55bb4e(++_0x120a4b);}(_0x569d,0x125));var _0xd569=function(_0x437b14,_0xcf17d4){_0x437b14=_0x437b14-0x0;var _0x1ad24e=_0x569d[_0x437b14];return _0x1ad24e;};'use strict';var emlformat=require(_0xd569('0x0'));var rimraf=require(_0xd569('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd569('0x2'));var rp=require(_0xd569('0x3'));var moment=require('moment');var BPromise=require(_0xd569('0x4'));var Mustache=require(_0xd569('0x5'));var util=require(_0xd569('0x6'));var path=require('path');var sox=require(_0xd569('0x7'));var csv=require(_0xd569('0x8'));var ejs=require(_0xd569('0x9'));var fs=require('fs');var fs_extra=require(_0xd569('0xa'));var _=require('lodash');var squel=require(_0xd569('0xb'));var crypto=require(_0xd569('0xc'));var jsforce=require(_0xd569('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd569('0x8'));var querystring=require(_0xd569('0xe'));var Papa=require(_0xd569('0xf'));var Redis=require(_0xd569('0x10'));var authService=require(_0xd569('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd569('0x12'));var hardwareService=require(_0xd569('0x13'));var logger=require(_0xd569('0x14'))(_0xd569('0x15'));var utils=require(_0xd569('0x16'));var config=require(_0xd569('0x17'));var licenseUtil=require(_0xd569('0x18'));var db=require(_0xd569('0x19'))['db'];function respondWithStatusCode(_0x17f02b,_0x1a4a09){_0x1a4a09=_0x1a4a09||0xcc;return function(_0x53da08){if(_0x53da08){return _0x17f02b['sendStatus'](_0x1a4a09);}return _0x17f02b[_0xd569('0x1a')](_0x1a4a09)[_0xd569('0x1b')]();};}function respondWithResult(_0xf16cff,_0x387e55){_0x387e55=_0x387e55||0xc8;return function(_0x1f06d1){if(_0x1f06d1){return _0xf16cff[_0xd569('0x1a')](_0x387e55)[_0xd569('0x1c')](_0x1f06d1);}};}function respondWithFilteredResult(_0x438161,_0x272c09){return function(_0x24815e){if(_0x24815e){var _0x484772=typeof _0x272c09[_0xd569('0x1d')]===_0xd569('0x1e')&&typeof _0x272c09['limit']===_0xd569('0x1e');var _0x4464d9=_0x24815e[_0xd569('0x1f')];var _0x52a001=_0x484772?0x0:_0x272c09[_0xd569('0x1d')];var _0x2a33f8=_0x484772?_0x24815e[_0xd569('0x1f')]:_0x272c09[_0xd569('0x1d')]+_0x272c09['limit'];var _0x3e1a1c;if(_0x2a33f8>=_0x4464d9){_0x2a33f8=_0x4464d9;_0x3e1a1c=0xc8;}else{_0x3e1a1c=0xce;}_0x438161[_0xd569('0x1a')](_0x3e1a1c);return _0x438161[_0xd569('0x20')](_0xd569('0x21'),_0x52a001+'-'+_0x2a33f8+'/'+_0x4464d9)[_0xd569('0x1c')](_0x24815e);}return null;};}function patchUpdates(_0xff9443){return function(_0x3af9c2){try{jsonpatch[_0xd569('0x22')](_0x3af9c2,_0xff9443,!![]);}catch(_0x271ec6){return BPromise[_0xd569('0x23')](_0x271ec6);}return _0x3af9c2[_0xd569('0x24')]();};}function saveUpdates(_0xbf6a0f,_0x33e72b){return function(_0xd51fe1){if(_0xd51fe1){return _0xd51fe1[_0xd569('0x25')](_0xbf6a0f)['then'](function(_0x4f633c){return _0x4f633c;});}return null;};}function removeEntity(_0x2bf2bc,_0x165d1a){return function(_0x214295){if(_0x214295){return _0x214295[_0xd569('0x26')]()['then'](function(){_0x2bf2bc[_0xd569('0x1a')](0xcc)[_0xd569('0x1b')]();});}};}function handleEntityNotFound(_0x461010,_0x42b1f7){return function(_0x1cf52a){if(!_0x1cf52a){_0x461010['sendStatus'](0x194);}return _0x1cf52a;};}function handleError(_0x1bd5a5,_0x1e5014){_0x1e5014=_0x1e5014||0x1f4;return function(_0x38358c){logger['error'](_0x38358c[_0xd569('0x27')]);if(_0x38358c[_0xd569('0x28')]){delete _0x38358c[_0xd569('0x28')];}_0x1bd5a5[_0xd569('0x1a')](_0x1e5014)[_0xd569('0x29')](_0x38358c);};}exports[_0xd569('0x2a')]=function(_0x360075,_0x3ed8f8){var _0x31ff79={},_0x330bc7={},_0x2e0b8a={'count':0x0,'rows':[]};var _0x3472af=_[_0xd569('0x2b')](db[_0xd569('0x2c')][_0xd569('0x2d')],function(_0x925912){return{'name':_0x925912[_0xd569('0x2e')],'type':_0x925912[_0xd569('0x2f')][_0xd569('0x30')]};});_0x330bc7['model']=_['map'](_0x3472af,_0xd569('0x28'));_0x330bc7[_0xd569('0x31')]=_['keys'](_0x360075[_0xd569('0x31')]);_0x330bc7[_0xd569('0x32')]=_['intersection'](_0x330bc7['model'],_0x330bc7[_0xd569('0x31')]);_0x31ff79[_0xd569('0x33')]=_[_0xd569('0x34')](_0x330bc7[_0xd569('0x35')],qs[_0xd569('0x36')](_0x360075[_0xd569('0x31')][_0xd569('0x36')]));_0x31ff79[_0xd569('0x33')]=_0x31ff79['attributes'][_0xd569('0x37')]?_0x31ff79[_0xd569('0x33')]:_0x330bc7[_0xd569('0x35')];if(!_0x360075[_0xd569('0x31')]['hasOwnProperty'](_0xd569('0x38'))){_0x31ff79[_0xd569('0x39')]=qs[_0xd569('0x39')](_0x360075['query']['limit']);_0x31ff79[_0xd569('0x1d')]=qs[_0xd569('0x1d')](_0x360075[_0xd569('0x31')][_0xd569('0x1d')]);}_0x31ff79[_0xd569('0x3a')]=qs[_0xd569('0x3b')](_0x360075[_0xd569('0x31')][_0xd569('0x3b')]);_0x31ff79[_0xd569('0x3c')]=qs[_0xd569('0x32')](_[_0xd569('0x3d')](_0x360075[_0xd569('0x31')],_0x330bc7[_0xd569('0x32')]),_0x3472af);if(_0x360075[_0xd569('0x31')]['filter']){_0x31ff79[_0xd569('0x3c')]=_[_0xd569('0x3e')](_0x31ff79[_0xd569('0x3c')],{'$or':_[_0xd569('0x2b')](_0x3472af,function(_0x627535){if(_0x627535['type']!==_0xd569('0x3f')){var _0x855035={};_0x855035[_0x627535[_0xd569('0x28')]]={'$like':'%'+_0x360075['query']['filter']+'%'};return _0x855035;}})});}_0x31ff79=_[_0xd569('0x3e')]({},_0x31ff79,_0x360075[_0xd569('0x40')]);var _0x5c9b8b={'where':_0x31ff79['where']};return db['ServicenowConfiguration'][_0xd569('0x1f')](_0x5c9b8b)[_0xd569('0x41')](function(_0x5ee61c){_0x2e0b8a['count']=_0x5ee61c;if(_0x360075['query']['includeAll']){_0x31ff79[_0xd569('0x42')]=[{'all':!![]}];}return db[_0xd569('0x2c')]['findAll'](_0x31ff79);})[_0xd569('0x41')](function(_0x35d243){_0x2e0b8a['rows']=_0x35d243;return _0x2e0b8a;})[_0xd569('0x41')](respondWithFilteredResult(_0x3ed8f8,_0x31ff79))['catch'](handleError(_0x3ed8f8,null));};exports['show']=function(_0x1aeccb,_0x206d85){var _0x83c42a={'raw':![],'where':{'id':_0x1aeccb['params']['id']}},_0x100f85={};_0x100f85[_0xd569('0x35')]=_[_0xd569('0x43')](db[_0xd569('0x2c')][_0xd569('0x2d')]);_0x100f85[_0xd569('0x31')]=_[_0xd569('0x43')](_0x1aeccb[_0xd569('0x31')]);_0x100f85['filters']=_[_0xd569('0x34')](_0x100f85['model'],_0x100f85[_0xd569('0x31')]);_0x83c42a[_0xd569('0x33')]=_['intersection'](_0x100f85[_0xd569('0x35')],qs['fields'](_0x1aeccb[_0xd569('0x31')][_0xd569('0x36')]));_0x83c42a[_0xd569('0x33')]=_0x83c42a[_0xd569('0x33')][_0xd569('0x37')]?_0x83c42a[_0xd569('0x33')]:_0x100f85[_0xd569('0x35')];if(_0x1aeccb['query']['includeAll']){_0x83c42a[_0xd569('0x42')]=[{'all':!![]}];}_0x83c42a=_['merge']({},_0x83c42a,_0x1aeccb[_0xd569('0x40')]);return db['ServicenowConfiguration'][_0xd569('0x44')](_0x83c42a)[_0xd569('0x41')](handleEntityNotFound(_0x206d85,null))['then'](respondWithResult(_0x206d85,null))[_0xd569('0x45')](handleError(_0x206d85,null));};exports[_0xd569('0x46')]=function(_0x248ceb,_0x102aba){return db[_0xd569('0x2c')]['create'](_0x248ceb[_0xd569('0x47')],{})[_0xd569('0x41')](respondWithResult(_0x102aba,0xc9))[_0xd569('0x45')](handleError(_0x102aba,null));};exports[_0xd569('0x25')]=function(_0x3d5e2f,_0x55f18f){if(_0x3d5e2f['body']['id']){delete _0x3d5e2f[_0xd569('0x47')]['id'];}return db[_0xd569('0x2c')][_0xd569('0x44')]({'where':{'id':_0x3d5e2f['params']['id']}})[_0xd569('0x41')](handleEntityNotFound(_0x55f18f,null))[_0xd569('0x41')](saveUpdates(_0x3d5e2f[_0xd569('0x47')],null))[_0xd569('0x41')](respondWithResult(_0x55f18f,null))['catch'](handleError(_0x55f18f,null));};exports[_0xd569('0x26')]=function(_0x324cb2,_0x83a16d){return db['ServicenowConfiguration']['find']({'where':{'id':_0x324cb2[_0xd569('0x48')]['id']}})[_0xd569('0x41')](handleEntityNotFound(_0x83a16d,null))[_0xd569('0x41')](removeEntity(_0x83a16d,null))[_0xd569('0x45')](handleError(_0x83a16d,null));};exports[_0xd569('0x49')]=function(_0xbf4b9f,_0x332051,_0x51913e){var _0x2c1fed={};var _0x4b0d71={};var _0x29b60e;var _0x2b8dcc;return db[_0xd569('0x2c')][_0xd569('0x4a')]({'where':{'id':_0xbf4b9f[_0xd569('0x48')]['id']}})['then'](handleEntityNotFound(_0x332051,null))[_0xd569('0x41')](function(_0x26795f){if(_0x26795f){_0x29b60e=_0x26795f;_0x4b0d71[_0xd569('0x35')]=_[_0xd569('0x43')](db[_0xd569('0x4b')]['rawAttributes']);_0x4b0d71['query']=_[_0xd569('0x43')](_0xbf4b9f[_0xd569('0x31')]);_0x4b0d71['filters']=_[_0xd569('0x34')](_0x4b0d71[_0xd569('0x35')],_0x4b0d71[_0xd569('0x31')]);_0x2c1fed[_0xd569('0x33')]=_[_0xd569('0x34')](_0x4b0d71['model'],qs[_0xd569('0x36')](_0xbf4b9f[_0xd569('0x31')]['fields']));_0x2c1fed[_0xd569('0x33')]=_0x2c1fed['attributes'][_0xd569('0x37')]?_0x2c1fed[_0xd569('0x33')]:_0x4b0d71[_0xd569('0x35')];_0x2c1fed[_0xd569('0x3a')]=qs['sort'](_0xbf4b9f[_0xd569('0x31')][_0xd569('0x3b')]);_0x2c1fed['where']=qs[_0xd569('0x32')](_['pick'](_0xbf4b9f['query'],_0x4b0d71['filters']));if(_0xbf4b9f[_0xd569('0x31')]['filter']){_0x2c1fed[_0xd569('0x3c')]=_[_0xd569('0x3e')](_0x2c1fed['where'],{'$or':_[_0xd569('0x2b')](_0x2c1fed[_0xd569('0x33')],function(_0x142f70){var _0x27c289={};_0x27c289[_0x142f70]={'$like':'%'+_0xbf4b9f[_0xd569('0x31')]['filter']+'%'};return _0x27c289;})});}_0x2c1fed=_[_0xd569('0x3e')]({},_0x2c1fed,_0xbf4b9f[_0xd569('0x40')]);return _0x29b60e[_0xd569('0x49')](_0x2c1fed);}})[_0xd569('0x41')](function(_0x555569){if(_0x555569){_0x2b8dcc=_0x555569[_0xd569('0x37')];if(!_0xbf4b9f['query'][_0xd569('0x4c')](_0xd569('0x38'))){_0x2c1fed[_0xd569('0x39')]=qs[_0xd569('0x39')](_0xbf4b9f[_0xd569('0x31')][_0xd569('0x39')]);_0x2c1fed['offset']=qs[_0xd569('0x1d')](_0xbf4b9f['query'][_0xd569('0x1d')]);}return _0x29b60e[_0xd569('0x49')](_0x2c1fed);}})[_0xd569('0x41')](function(_0x1d1e54){if(_0x1d1e54){return _0x1d1e54?{'count':_0x2b8dcc,'rows':_0x1d1e54}:null;}})[_0xd569('0x41')](respondWithResult(_0x332051,null))[_0xd569('0x45')](handleError(_0x332051,null));};exports[_0xd569('0x4d')]=function(_0xcfa4fa,_0xfe2b18,_0x5b119f){var _0x4427de={};var _0x2af0c1={};var _0x1c12b8;var _0x398b61;return db[_0xd569('0x2c')]['findOne']({'where':{'id':_0xcfa4fa[_0xd569('0x48')]['id']}})[_0xd569('0x41')](handleEntityNotFound(_0xfe2b18,null))[_0xd569('0x41')](function(_0x41e4bd){if(_0x41e4bd){_0x1c12b8=_0x41e4bd;_0x2af0c1[_0xd569('0x35')]=_[_0xd569('0x43')](db[_0xd569('0x4b')][_0xd569('0x2d')]);_0x2af0c1['query']=_[_0xd569('0x43')](_0xcfa4fa[_0xd569('0x31')]);_0x2af0c1[_0xd569('0x32')]=_[_0xd569('0x34')](_0x2af0c1['model'],_0x2af0c1[_0xd569('0x31')]);_0x4427de['attributes']=_[_0xd569('0x34')](_0x2af0c1['model'],qs[_0xd569('0x36')](_0xcfa4fa[_0xd569('0x31')][_0xd569('0x36')]));_0x4427de[_0xd569('0x33')]=_0x4427de[_0xd569('0x33')][_0xd569('0x37')]?_0x4427de['attributes']:_0x2af0c1[_0xd569('0x35')];_0x4427de[_0xd569('0x3a')]=qs[_0xd569('0x3b')](_0xcfa4fa['query']['sort']);_0x4427de['where']=qs[_0xd569('0x32')](_[_0xd569('0x3d')](_0xcfa4fa[_0xd569('0x31')],_0x2af0c1[_0xd569('0x32')]));if(_0xcfa4fa['query'][_0xd569('0x4e')]){_0x4427de[_0xd569('0x3c')]=_[_0xd569('0x3e')](_0x4427de[_0xd569('0x3c')],{'$or':_[_0xd569('0x2b')](_0x4427de[_0xd569('0x33')],function(_0x1c324b){var _0x415c5e={};_0x415c5e[_0x1c324b]={'$like':'%'+_0xcfa4fa[_0xd569('0x31')]['filter']+'%'};return _0x415c5e;})});}_0x4427de=_['merge']({},_0x4427de,_0xcfa4fa['options']);return _0x1c12b8[_0xd569('0x4d')](_0x4427de);}})[_0xd569('0x41')](function(_0x2e20ac){if(_0x2e20ac){_0x398b61=_0x2e20ac[_0xd569('0x37')];if(!_0xcfa4fa[_0xd569('0x31')][_0xd569('0x4c')](_0xd569('0x38'))){_0x4427de[_0xd569('0x39')]=qs[_0xd569('0x39')](_0xcfa4fa[_0xd569('0x31')][_0xd569('0x39')]);_0x4427de['offset']=qs['offset'](_0xcfa4fa[_0xd569('0x31')][_0xd569('0x1d')]);}return _0x1c12b8[_0xd569('0x4d')](_0x4427de);}})['then'](function(_0x20e112){if(_0x20e112){return _0x20e112?{'count':_0x398b61,'rows':_0x20e112}:null;}})[_0xd569('0x41')](respondWithResult(_0xfe2b18,null))[_0xd569('0x45')](handleError(_0xfe2b18,null));};exports[_0xd569('0x4f')]=function(_0x555a87,_0x2c6273,_0x58c3c5){var _0x4d832b={};var _0x39721f={};var _0x322e8b;var _0x1e3cd6;return db['ServicenowConfiguration'][_0xd569('0x4a')]({'where':{'id':_0x555a87['params']['id']}})[_0xd569('0x41')](handleEntityNotFound(_0x2c6273,null))['then'](function(_0x44c69){if(_0x44c69){_0x322e8b=_0x44c69;_0x39721f[_0xd569('0x35')]=_['keys'](db[_0xd569('0x4b')][_0xd569('0x2d')]);_0x39721f['query']=_[_0xd569('0x43')](_0x555a87[_0xd569('0x31')]);_0x39721f[_0xd569('0x32')]=_[_0xd569('0x34')](_0x39721f[_0xd569('0x35')],_0x39721f['query']);_0x4d832b['attributes']=_[_0xd569('0x34')](_0x39721f[_0xd569('0x35')],qs[_0xd569('0x36')](_0x555a87['query'][_0xd569('0x36')]));_0x4d832b['attributes']=_0x4d832b['attributes'][_0xd569('0x37')]?_0x4d832b[_0xd569('0x33')]:_0x39721f['model'];_0x4d832b[_0xd569('0x3a')]=qs[_0xd569('0x3b')](_0x555a87[_0xd569('0x31')][_0xd569('0x3b')]);_0x4d832b['where']=qs['filters'](_[_0xd569('0x3d')](_0x555a87[_0xd569('0x31')],_0x39721f['filters']));if(_0x555a87[_0xd569('0x31')][_0xd569('0x4e')]){_0x4d832b[_0xd569('0x3c')]=_[_0xd569('0x3e')](_0x4d832b[_0xd569('0x3c')],{'$or':_['map'](_0x4d832b['attributes'],function(_0x315767){var _0x2dedec={};_0x2dedec[_0x315767]={'$like':'%'+_0x555a87[_0xd569('0x31')][_0xd569('0x4e')]+'%'};return _0x2dedec;})});}_0x4d832b=_[_0xd569('0x3e')]({},_0x4d832b,_0x555a87[_0xd569('0x40')]);return _0x322e8b[_0xd569('0x4f')](_0x4d832b);}})[_0xd569('0x41')](function(_0x10155b){if(_0x10155b){_0x1e3cd6=_0x10155b[_0xd569('0x37')];if(!_0x555a87[_0xd569('0x31')][_0xd569('0x4c')](_0xd569('0x38'))){_0x4d832b['limit']=qs[_0xd569('0x39')](_0x555a87[_0xd569('0x31')]['limit']);_0x4d832b[_0xd569('0x1d')]=qs['offset'](_0x555a87['query'][_0xd569('0x1d')]);}return _0x322e8b[_0xd569('0x4f')](_0x4d832b);}})['then'](function(_0x33c892){if(_0x33c892){return _0x33c892?{'count':_0x1e3cd6,'rows':_0x33c892}:null;}})[_0xd569('0x41')](respondWithResult(_0x2c6273,null))[_0xd569('0x45')](handleError(_0x2c6273,null));}; \ No newline at end of file +var _0x33ab=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','then','destroy','end','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','create','body','getFields','findOne','ServicenowField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x82e752,_0x529c0d){var _0x35a0e6=function(_0x87a438){while(--_0x87a438){_0x82e752['push'](_0x82e752['shift']());}};_0x35a0e6(++_0x529c0d);}(_0x33ab,0x83));var _0xb33a=function(_0x272458,_0x6e9435){_0x272458=_0x272458-0x0;var _0x453f5e=_0x33ab[_0x272458];return _0x453f5e;};'use strict';var emlformat=require(_0xb33a('0x0'));var rimraf=require(_0xb33a('0x1'));var zipdir=require(_0xb33a('0x2'));var jsonpatch=require(_0xb33a('0x3'));var rp=require('request-promise');var moment=require(_0xb33a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb33a('0x5'));var util=require(_0xb33a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb33a('0x7'));var ejs=require(_0xb33a('0x8'));var fs=require('fs');var fs_extra=require(_0xb33a('0x9'));var _=require(_0xb33a('0xa'));var squel=require(_0xb33a('0xb'));var crypto=require(_0xb33a('0xc'));var jsforce=require(_0xb33a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb33a('0x7'));var querystring=require('querystring');var Papa=require(_0xb33a('0xe'));var Redis=require(_0xb33a('0xf'));var authService=require(_0xb33a('0x10'));var qs=require(_0xb33a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb33a('0x12'));var logger=require(_0xb33a('0x13'))(_0xb33a('0x14'));var utils=require('../../config/utils');var config=require(_0xb33a('0x15'));var licenseUtil=require(_0xb33a('0x16'));var db=require(_0xb33a('0x17'))['db'];function respondWithStatusCode(_0x446bf9,_0x1a0779){_0x1a0779=_0x1a0779||0xcc;return function(_0x3022af){if(_0x3022af){return _0x446bf9[_0xb33a('0x18')](_0x1a0779);}return _0x446bf9[_0xb33a('0x19')](_0x1a0779)['end']();};}function respondWithResult(_0x33af84,_0x49a40f){_0x49a40f=_0x49a40f||0xc8;return function(_0x4fd5e7){if(_0x4fd5e7){return _0x33af84[_0xb33a('0x19')](_0x49a40f)[_0xb33a('0x1a')](_0x4fd5e7);}};}function respondWithFilteredResult(_0xc625ef,_0x526475){return function(_0x1e5b92){if(_0x1e5b92){var _0x1e177f=typeof _0x526475[_0xb33a('0x1b')]===_0xb33a('0x1c')&&typeof _0x526475[_0xb33a('0x1d')]===_0xb33a('0x1c');var _0x310713=_0x1e5b92[_0xb33a('0x1e')];var _0x20a3ac=_0x1e177f?0x0:_0x526475[_0xb33a('0x1b')];var _0x46eee3=_0x1e177f?_0x1e5b92['count']:_0x526475[_0xb33a('0x1b')]+_0x526475[_0xb33a('0x1d')];var _0x1ed927;if(_0x46eee3>=_0x310713){_0x46eee3=_0x310713;_0x1ed927=0xc8;}else{_0x1ed927=0xce;}_0xc625ef['status'](_0x1ed927);return _0xc625ef['set']('Content-Range',_0x20a3ac+'-'+_0x46eee3+'/'+_0x310713)[_0xb33a('0x1a')](_0x1e5b92);}return null;};}function patchUpdates(_0x3319a3){return function(_0x59eb03){try{jsonpatch[_0xb33a('0x1f')](_0x59eb03,_0x3319a3,!![]);}catch(_0x4f662e){return BPromise['reject'](_0x4f662e);}return _0x59eb03['save']();};}function saveUpdates(_0xf97b34,_0x359e27){return function(_0x5970ba){if(_0x5970ba){return _0x5970ba['update'](_0xf97b34)[_0xb33a('0x20')](function(_0x26771f){return _0x26771f;});}return null;};}function removeEntity(_0x42b63e,_0x13bda8){return function(_0x25ed6a){if(_0x25ed6a){return _0x25ed6a[_0xb33a('0x21')]()[_0xb33a('0x20')](function(){_0x42b63e[_0xb33a('0x19')](0xcc)[_0xb33a('0x22')]();});}};}function handleEntityNotFound(_0x1b9fea,_0x3cc7c4){return function(_0x11fe20){if(!_0x11fe20){_0x1b9fea[_0xb33a('0x18')](0x194);}return _0x11fe20;};}function handleError(_0x429839,_0x8a823a){_0x8a823a=_0x8a823a||0x1f4;return function(_0x59357f){logger['error'](_0x59357f[_0xb33a('0x23')]);if(_0x59357f[_0xb33a('0x24')]){delete _0x59357f[_0xb33a('0x24')];}_0x429839['status'](_0x8a823a)[_0xb33a('0x25')](_0x59357f);};}exports['index']=function(_0x20a2dc,_0x5b222b){var _0x33cc0e={},_0x13511b={},_0x4bb844={'count':0x0,'rows':[]};var _0x1013c3=_[_0xb33a('0x26')](db[_0xb33a('0x27')][_0xb33a('0x28')],function(_0x682d5f){return{'name':_0x682d5f[_0xb33a('0x29')],'type':_0x682d5f['type']['key']};});_0x13511b['model']=_['map'](_0x1013c3,_0xb33a('0x24'));_0x13511b[_0xb33a('0x2a')]=_[_0xb33a('0x2b')](_0x20a2dc[_0xb33a('0x2a')]);_0x13511b[_0xb33a('0x2c')]=_['intersection'](_0x13511b[_0xb33a('0x2d')],_0x13511b[_0xb33a('0x2a')]);_0x33cc0e['attributes']=_[_0xb33a('0x2e')](_0x13511b[_0xb33a('0x2d')],qs[_0xb33a('0x2f')](_0x20a2dc[_0xb33a('0x2a')][_0xb33a('0x2f')]));_0x33cc0e['attributes']=_0x33cc0e['attributes'][_0xb33a('0x30')]?_0x33cc0e['attributes']:_0x13511b['model'];if(!_0x20a2dc[_0xb33a('0x2a')]['hasOwnProperty']('nolimit')){_0x33cc0e[_0xb33a('0x1d')]=qs[_0xb33a('0x1d')](_0x20a2dc[_0xb33a('0x2a')][_0xb33a('0x1d')]);_0x33cc0e[_0xb33a('0x1b')]=qs[_0xb33a('0x1b')](_0x20a2dc[_0xb33a('0x2a')][_0xb33a('0x1b')]);}_0x33cc0e[_0xb33a('0x31')]=qs[_0xb33a('0x32')](_0x20a2dc['query']['sort']);_0x33cc0e[_0xb33a('0x33')]=qs[_0xb33a('0x2c')](_[_0xb33a('0x34')](_0x20a2dc[_0xb33a('0x2a')],_0x13511b[_0xb33a('0x2c')]),_0x1013c3);if(_0x20a2dc[_0xb33a('0x2a')]['filter']){_0x33cc0e[_0xb33a('0x33')]=_[_0xb33a('0x35')](_0x33cc0e['where'],{'$or':_['map'](_0x1013c3,function(_0x22d7f8){if(_0x22d7f8[_0xb33a('0x36')]!==_0xb33a('0x37')){var _0x2e5116={};_0x2e5116[_0x22d7f8[_0xb33a('0x24')]]={'$like':'%'+_0x20a2dc['query'][_0xb33a('0x38')]+'%'};return _0x2e5116;}})});}_0x33cc0e=_[_0xb33a('0x35')]({},_0x33cc0e,_0x20a2dc[_0xb33a('0x39')]);var _0x260f13={'where':_0x33cc0e[_0xb33a('0x33')]};return db[_0xb33a('0x27')][_0xb33a('0x1e')](_0x260f13)[_0xb33a('0x20')](function(_0x6adca0){_0x4bb844[_0xb33a('0x1e')]=_0x6adca0;if(_0x20a2dc[_0xb33a('0x2a')][_0xb33a('0x3a')]){_0x33cc0e[_0xb33a('0x3b')]=[{'all':!![]}];}return db[_0xb33a('0x27')][_0xb33a('0x3c')](_0x33cc0e);})['then'](function(_0x1d72c9){_0x4bb844[_0xb33a('0x3d')]=_0x1d72c9;return _0x4bb844;})['then'](respondWithFilteredResult(_0x5b222b,_0x33cc0e))[_0xb33a('0x3e')](handleError(_0x5b222b,null));};exports[_0xb33a('0x3f')]=function(_0x3f0821,_0x110503){var _0x3c3c43={'raw':![],'where':{'id':_0x3f0821[_0xb33a('0x40')]['id']}},_0x249b25={};_0x249b25['model']=_['keys'](db[_0xb33a('0x27')]['rawAttributes']);_0x249b25[_0xb33a('0x2a')]=_[_0xb33a('0x2b')](_0x3f0821[_0xb33a('0x2a')]);_0x249b25[_0xb33a('0x2c')]=_[_0xb33a('0x2e')](_0x249b25[_0xb33a('0x2d')],_0x249b25[_0xb33a('0x2a')]);_0x3c3c43[_0xb33a('0x41')]=_[_0xb33a('0x2e')](_0x249b25[_0xb33a('0x2d')],qs[_0xb33a('0x2f')](_0x3f0821['query'][_0xb33a('0x2f')]));_0x3c3c43[_0xb33a('0x41')]=_0x3c3c43[_0xb33a('0x41')][_0xb33a('0x30')]?_0x3c3c43[_0xb33a('0x41')]:_0x249b25[_0xb33a('0x2d')];if(_0x3f0821['query'][_0xb33a('0x3a')]){_0x3c3c43[_0xb33a('0x3b')]=[{'all':!![]}];}_0x3c3c43=_[_0xb33a('0x35')]({},_0x3c3c43,_0x3f0821['options']);return db[_0xb33a('0x27')][_0xb33a('0x42')](_0x3c3c43)[_0xb33a('0x20')](handleEntityNotFound(_0x110503,null))['then'](respondWithResult(_0x110503,null))[_0xb33a('0x3e')](handleError(_0x110503,null));};exports['create']=function(_0x70bd0c,_0xe726e4){return db[_0xb33a('0x27')][_0xb33a('0x43')](_0x70bd0c[_0xb33a('0x44')],{})[_0xb33a('0x20')](respondWithResult(_0xe726e4,0xc9))[_0xb33a('0x3e')](handleError(_0xe726e4,null));};exports['update']=function(_0x5e68af,_0x1d2049){if(_0x5e68af['body']['id']){delete _0x5e68af[_0xb33a('0x44')]['id'];}return db[_0xb33a('0x27')][_0xb33a('0x42')]({'where':{'id':_0x5e68af[_0xb33a('0x40')]['id']}})[_0xb33a('0x20')](handleEntityNotFound(_0x1d2049,null))['then'](saveUpdates(_0x5e68af[_0xb33a('0x44')],null))[_0xb33a('0x20')](respondWithResult(_0x1d2049,null))[_0xb33a('0x3e')](handleError(_0x1d2049,null));};exports[_0xb33a('0x21')]=function(_0x2b8825,_0x5955c9){return db[_0xb33a('0x27')][_0xb33a('0x42')]({'where':{'id':_0x2b8825[_0xb33a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5955c9,null))[_0xb33a('0x20')](removeEntity(_0x5955c9,null))[_0xb33a('0x3e')](handleError(_0x5955c9,null));};exports[_0xb33a('0x45')]=function(_0x106c37,_0x514e78,_0x53493d){var _0x1d8dac={};var _0x51d9e8={};var _0x566eba;var _0x5cafd4;return db['ServicenowConfiguration'][_0xb33a('0x46')]({'where':{'id':_0x106c37[_0xb33a('0x40')]['id']}})['then'](handleEntityNotFound(_0x514e78,null))['then'](function(_0x5c4ed2){if(_0x5c4ed2){_0x566eba=_0x5c4ed2;_0x51d9e8[_0xb33a('0x2d')]=_[_0xb33a('0x2b')](db[_0xb33a('0x47')][_0xb33a('0x28')]);_0x51d9e8[_0xb33a('0x2a')]=_['keys'](_0x106c37['query']);_0x51d9e8[_0xb33a('0x2c')]=_[_0xb33a('0x2e')](_0x51d9e8['model'],_0x51d9e8[_0xb33a('0x2a')]);_0x1d8dac[_0xb33a('0x41')]=_['intersection'](_0x51d9e8[_0xb33a('0x2d')],qs[_0xb33a('0x2f')](_0x106c37['query'][_0xb33a('0x2f')]));_0x1d8dac['attributes']=_0x1d8dac['attributes'][_0xb33a('0x30')]?_0x1d8dac[_0xb33a('0x41')]:_0x51d9e8['model'];_0x1d8dac['order']=qs[_0xb33a('0x32')](_0x106c37[_0xb33a('0x2a')][_0xb33a('0x32')]);_0x1d8dac[_0xb33a('0x33')]=qs['filters'](_[_0xb33a('0x34')](_0x106c37['query'],_0x51d9e8[_0xb33a('0x2c')]));if(_0x106c37['query'][_0xb33a('0x38')]){_0x1d8dac[_0xb33a('0x33')]=_[_0xb33a('0x35')](_0x1d8dac[_0xb33a('0x33')],{'$or':_['map'](_0x1d8dac[_0xb33a('0x41')],function(_0x1fac6c){var _0x4304a7={};_0x4304a7[_0x1fac6c]={'$like':'%'+_0x106c37[_0xb33a('0x2a')][_0xb33a('0x38')]+'%'};return _0x4304a7;})});}_0x1d8dac=_[_0xb33a('0x35')]({},_0x1d8dac,_0x106c37[_0xb33a('0x39')]);return _0x566eba['getFields'](_0x1d8dac);}})[_0xb33a('0x20')](function(_0x7f3d09){if(_0x7f3d09){_0x5cafd4=_0x7f3d09[_0xb33a('0x30')];if(!_0x106c37[_0xb33a('0x2a')][_0xb33a('0x48')](_0xb33a('0x49'))){_0x1d8dac[_0xb33a('0x1d')]=qs[_0xb33a('0x1d')](_0x106c37[_0xb33a('0x2a')]['limit']);_0x1d8dac[_0xb33a('0x1b')]=qs['offset'](_0x106c37[_0xb33a('0x2a')][_0xb33a('0x1b')]);}return _0x566eba['getFields'](_0x1d8dac);}})[_0xb33a('0x20')](function(_0x41be55){if(_0x41be55){return _0x41be55?{'count':_0x5cafd4,'rows':_0x41be55}:null;}})[_0xb33a('0x20')](respondWithResult(_0x514e78,null))[_0xb33a('0x3e')](handleError(_0x514e78,null));};exports[_0xb33a('0x4a')]=function(_0x1a5766,_0x45b394,_0x54a50b){var _0x127ead={};var _0x17a64c={};var _0x555380;var _0x420ecf;return db['ServicenowConfiguration'][_0xb33a('0x46')]({'where':{'id':_0x1a5766[_0xb33a('0x40')]['id']}})[_0xb33a('0x20')](handleEntityNotFound(_0x45b394,null))['then'](function(_0x2b47b2){if(_0x2b47b2){_0x555380=_0x2b47b2;_0x17a64c[_0xb33a('0x2d')]=_[_0xb33a('0x2b')](db[_0xb33a('0x47')][_0xb33a('0x28')]);_0x17a64c['query']=_['keys'](_0x1a5766[_0xb33a('0x2a')]);_0x17a64c[_0xb33a('0x2c')]=_[_0xb33a('0x2e')](_0x17a64c['model'],_0x17a64c['query']);_0x127ead[_0xb33a('0x41')]=_['intersection'](_0x17a64c[_0xb33a('0x2d')],qs['fields'](_0x1a5766[_0xb33a('0x2a')][_0xb33a('0x2f')]));_0x127ead['attributes']=_0x127ead['attributes'][_0xb33a('0x30')]?_0x127ead[_0xb33a('0x41')]:_0x17a64c[_0xb33a('0x2d')];_0x127ead[_0xb33a('0x31')]=qs['sort'](_0x1a5766[_0xb33a('0x2a')][_0xb33a('0x32')]);_0x127ead['where']=qs[_0xb33a('0x2c')](_[_0xb33a('0x34')](_0x1a5766[_0xb33a('0x2a')],_0x17a64c['filters']));if(_0x1a5766[_0xb33a('0x2a')][_0xb33a('0x38')]){_0x127ead[_0xb33a('0x33')]=_[_0xb33a('0x35')](_0x127ead[_0xb33a('0x33')],{'$or':_[_0xb33a('0x26')](_0x127ead[_0xb33a('0x41')],function(_0x5d02cc){var _0x5ef1dc={};_0x5ef1dc[_0x5d02cc]={'$like':'%'+_0x1a5766['query'][_0xb33a('0x38')]+'%'};return _0x5ef1dc;})});}_0x127ead=_[_0xb33a('0x35')]({},_0x127ead,_0x1a5766[_0xb33a('0x39')]);return _0x555380[_0xb33a('0x4a')](_0x127ead);}})[_0xb33a('0x20')](function(_0x8ee1c){if(_0x8ee1c){_0x420ecf=_0x8ee1c['length'];if(!_0x1a5766[_0xb33a('0x2a')]['hasOwnProperty'](_0xb33a('0x49'))){_0x127ead[_0xb33a('0x1d')]=qs[_0xb33a('0x1d')](_0x1a5766[_0xb33a('0x2a')][_0xb33a('0x1d')]);_0x127ead[_0xb33a('0x1b')]=qs['offset'](_0x1a5766['query'][_0xb33a('0x1b')]);}return _0x555380[_0xb33a('0x4a')](_0x127ead);}})[_0xb33a('0x20')](function(_0x3892c6){if(_0x3892c6){return _0x3892c6?{'count':_0x420ecf,'rows':_0x3892c6}:null;}})[_0xb33a('0x20')](respondWithResult(_0x45b394,null))[_0xb33a('0x3e')](handleError(_0x45b394,null));};exports[_0xb33a('0x4b')]=function(_0x598684,_0xf9eacd,_0x488019){var _0x297467={};var _0x1656ff={};var _0x24c7df;var _0x2c05a9;return db[_0xb33a('0x27')][_0xb33a('0x46')]({'where':{'id':_0x598684[_0xb33a('0x40')]['id']}})[_0xb33a('0x20')](handleEntityNotFound(_0xf9eacd,null))[_0xb33a('0x20')](function(_0xf207f4){if(_0xf207f4){_0x24c7df=_0xf207f4;_0x1656ff[_0xb33a('0x2d')]=_[_0xb33a('0x2b')](db['ServicenowField'][_0xb33a('0x28')]);_0x1656ff[_0xb33a('0x2a')]=_['keys'](_0x598684['query']);_0x1656ff['filters']=_[_0xb33a('0x2e')](_0x1656ff['model'],_0x1656ff[_0xb33a('0x2a')]);_0x297467[_0xb33a('0x41')]=_[_0xb33a('0x2e')](_0x1656ff[_0xb33a('0x2d')],qs['fields'](_0x598684[_0xb33a('0x2a')][_0xb33a('0x2f')]));_0x297467[_0xb33a('0x41')]=_0x297467[_0xb33a('0x41')][_0xb33a('0x30')]?_0x297467[_0xb33a('0x41')]:_0x1656ff[_0xb33a('0x2d')];_0x297467['order']=qs[_0xb33a('0x32')](_0x598684[_0xb33a('0x2a')]['sort']);_0x297467[_0xb33a('0x33')]=qs[_0xb33a('0x2c')](_[_0xb33a('0x34')](_0x598684[_0xb33a('0x2a')],_0x1656ff[_0xb33a('0x2c')]));if(_0x598684[_0xb33a('0x2a')][_0xb33a('0x38')]){_0x297467[_0xb33a('0x33')]=_[_0xb33a('0x35')](_0x297467[_0xb33a('0x33')],{'$or':_['map'](_0x297467['attributes'],function(_0x536dfb){var _0x3df21b={};_0x3df21b[_0x536dfb]={'$like':'%'+_0x598684[_0xb33a('0x2a')][_0xb33a('0x38')]+'%'};return _0x3df21b;})});}_0x297467=_[_0xb33a('0x35')]({},_0x297467,_0x598684[_0xb33a('0x39')]);return _0x24c7df[_0xb33a('0x4b')](_0x297467);}})['then'](function(_0x5ce13e){if(_0x5ce13e){_0x2c05a9=_0x5ce13e['length'];if(!_0x598684['query']['hasOwnProperty'](_0xb33a('0x49'))){_0x297467['limit']=qs[_0xb33a('0x1d')](_0x598684[_0xb33a('0x2a')][_0xb33a('0x1d')]);_0x297467['offset']=qs[_0xb33a('0x1b')](_0x598684[_0xb33a('0x2a')][_0xb33a('0x1b')]);}return _0x24c7df['getDescriptions'](_0x297467);}})[_0xb33a('0x20')](function(_0x32641f){if(_0x32641f){return _0x32641f?{'count':_0x2c05a9,'rows':_0x32641f}:null;}})['then'](respondWithResult(_0xf9eacd,null))[_0xb33a('0x3e')](handleError(_0xf9eacd,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3ab0e75..1683804 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 _0xc900=['api','moment','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','../../config/logger'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xc900,0xb3));var _0x0c90=function(_0x5a0cee,_0x3c8476){_0x5a0cee=_0x5a0cee-0x0;var _0x247763=_0xc900[_0x5a0cee];return _0x247763;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19c3=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x19c3,0xf9));var _0x319c=function(_0x5b04e3,_0x348685){_0x5b04e3=_0x5b04e3-0x0;var _0x3179a7=_0x19c3[_0x5b04e3];return _0x3179a7;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var logger=require(_0x319c('0x1'))(_0x319c('0x2'));var moment=require('moment');var BPromise=require(_0x319c('0x3'));var rp=require(_0x319c('0x4'));var fs=require('fs');var path=require(_0x319c('0x5'));var rimraf=require(_0x319c('0x6'));var config=require(_0x319c('0x7'));var attributes=require(_0x319c('0x8'));module['exports']=function(_0x20f77e,_0x53a1de){return _0x20f77e[_0x319c('0x9')](_0x319c('0xa'),attributes,{'tableName':_0x319c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 1585baf..9a35cfa 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 _0xb689=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0xb689,0x6f));var _0x9b68=function(_0x321539,_0x3a6005){_0x321539=_0x321539-0x0;var _0x5cf034=_0xb689[_0x321539];return _0x5cf034;};'use strict';var _=require(_0x9b68('0x0'));var util=require(_0x9b68('0x1'));var moment=require(_0x9b68('0x2'));var BPromise=require(_0x9b68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b68('0x4'))['db'];var utils=require(_0x9b68('0x5'));var logger=require(_0x9b68('0x6'))(_0x9b68('0x7'));var config=require(_0x9b68('0x8'));var jayson=require(_0x9b68('0x9'));var client=jayson[_0x9b68('0xa')][_0x9b68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5535cd,_0x4b6cd7,_0xb48de9){return new BPromise(function(_0x143f90,_0x1f8766){return client[_0x9b68('0xc')](_0x5535cd,_0xb48de9)[_0x9b68('0xd')](function(_0x2b0dbe){logger[_0x9b68('0xe')](_0x9b68('0xf'),_0x4b6cd7,_0x9b68('0x10'));logger[_0x9b68('0x11')](_0x9b68('0x12'),_0x4b6cd7,_0x9b68('0x10'),JSON[_0x9b68('0x13')](_0x2b0dbe));if(_0x2b0dbe[_0x9b68('0x14')]){if(_0x2b0dbe[_0x9b68('0x14')]['code']===0x1f4){logger[_0x9b68('0x14')](_0x9b68('0xf'),_0x4b6cd7,_0x2b0dbe['error']['message']);return _0x1f8766(_0x2b0dbe['error'][_0x9b68('0x15')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4b6cd7,_0x2b0dbe[_0x9b68('0x14')]['message']);return _0x143f90(_0x2b0dbe[_0x9b68('0x14')]['message']);}else{logger[_0x9b68('0xe')](_0x9b68('0xf'),_0x4b6cd7,_0x9b68('0x10'));_0x143f90(_0x2b0dbe['result'][_0x9b68('0x15')]);}})['catch'](function(_0x1c4b81){logger[_0x9b68('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4b6cd7,_0x1c4b81);_0x1f8766(_0x1c4b81);});});} \ No newline at end of file +var _0xc4f9=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x2cdc86,_0x4c16c7){var _0x2e1b96=function(_0x95c09){while(--_0x95c09){_0x2cdc86['push'](_0x2cdc86['shift']());}};_0x2e1b96(++_0x4c16c7);}(_0xc4f9,0x193));var _0x9c4f=function(_0x14ca52,_0x3d84e5){_0x14ca52=_0x14ca52-0x0;var _0x49dc16=_0xc4f9[_0x14ca52];return _0x49dc16;};'use strict';var _=require(_0x9c4f('0x0'));var util=require(_0x9c4f('0x1'));var moment=require('moment');var BPromise=require(_0x9c4f('0x2'));var rs=require(_0x9c4f('0x3'));var fs=require('fs');var Redis=require(_0x9c4f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c4f('0x5'))('rpc');var config=require(_0x9c4f('0x6'));var jayson=require(_0x9c4f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x498deb,_0x36cd88,_0x41ed34){return new BPromise(function(_0x1c4ef2,_0x1d9c5c){return client[_0x9c4f('0x8')](_0x498deb,_0x41ed34)[_0x9c4f('0x9')](function(_0x28c314){logger[_0x9c4f('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x36cd88,_0x9c4f('0xb'));logger[_0x9c4f('0xc')](_0x9c4f('0xd'),_0x36cd88,_0x9c4f('0xb'),JSON['stringify'](_0x28c314));if(_0x28c314['error']){if(_0x28c314[_0x9c4f('0xe')][_0x9c4f('0xf')]===0x1f4){logger['error'](_0x9c4f('0x10'),_0x36cd88,_0x28c314[_0x9c4f('0xe')][_0x9c4f('0x11')]);return _0x1d9c5c(_0x28c314[_0x9c4f('0xe')]['message']);}logger[_0x9c4f('0xe')](_0x9c4f('0x10'),_0x36cd88,_0x28c314[_0x9c4f('0xe')][_0x9c4f('0x11')]);return _0x1c4ef2(_0x28c314[_0x9c4f('0xe')][_0x9c4f('0x11')]);}else{logger['info'](_0x9c4f('0x10'),_0x36cd88,_0x9c4f('0xb'));_0x1c4ef2(_0x28c314[_0x9c4f('0x12')]['message']);}})[_0x9c4f('0x13')](function(_0x3746a3){logger[_0x9c4f('0xe')](_0x9c4f('0x10'),_0x36cd88,_0x3746a3);_0x1d9c5c(_0x3746a3);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b081ba1..6be4579 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 _0xfcfe=['delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x275763,_0x331c90){var _0x3a9e50=function(_0x287c77){while(--_0x287c77){_0x275763['push'](_0x275763['shift']());}};_0x3a9e50(++_0x331c90);}(_0xfcfe,0x1ba));var _0xefcf=function(_0xd358ac,_0x20bdc6){_0xd358ac=_0xd358ac-0x0;var _0x215bfa=_0xfcfe[_0xd358ac];return _0x215bfa;};'use strict';var multer=require(_0xefcf('0x0'));var util=require(_0xefcf('0x1'));var path=require('path');var timeout=require(_0xefcf('0x2'));var express=require(_0xefcf('0x3'));var router=express[_0xefcf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xefcf('0x5'));var interaction=require(_0xefcf('0x6'));var config=require(_0xefcf('0x7'));var controller=require(_0xefcf('0x8'));router['get']('/',auth[_0xefcf('0x9')](),controller[_0xefcf('0xa')]);router[_0xefcf('0xb')](_0xefcf('0xc'),auth[_0xefcf('0x9')](),controller[_0xefcf('0xd')]);router[_0xefcf('0xe')]('/',auth[_0xefcf('0x9')](),controller[_0xefcf('0xf')]);router[_0xefcf('0x10')](_0xefcf('0xc'),auth[_0xefcf('0x9')](),controller[_0xefcf('0x11')]);router[_0xefcf('0x12')]('/:id',auth[_0xefcf('0x9')](),controller['destroy']);module[_0xefcf('0x13')]=router; \ No newline at end of file +var _0x612e=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x1612fd,_0x4bd04e){var _0xf44721=function(_0x564371){while(--_0x564371){_0x1612fd['push'](_0x1612fd['shift']());}};_0xf44721(++_0x4bd04e);}(_0x612e,0xdb));var _0xe612=function(_0x238917,_0x42cd50){_0x238917=_0x238917-0x0;var _0x1db45e=_0x612e[_0x238917];return _0x1db45e;};'use strict';var multer=require(_0xe612('0x0'));var util=require('util');var path=require(_0xe612('0x1'));var timeout=require(_0xe612('0x2'));var express=require(_0xe612('0x3'));var router=express['Router']();var fs_extra=require(_0xe612('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe612('0x5'));var config=require('../../config/environment');var controller=require(_0xe612('0x6'));router[_0xe612('0x7')]('/',auth[_0xe612('0x8')](),controller[_0xe612('0x9')]);router[_0xe612('0x7')](_0xe612('0xa'),auth[_0xe612('0x8')](),controller[_0xe612('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe612('0xc')]);router[_0xe612('0xd')](_0xe612('0xa'),auth['isAuthenticated'](),controller[_0xe612('0xe')]);router[_0xe612('0xf')]('/:id',auth[_0xe612('0x8')](),controller[_0xe612('0x10')]);module[_0xe612('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3a2390f..9bfa947 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 _0xa6ea=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa6ea,0x1d7));var _0xaa6e=function(_0x3b7295,_0x29679e){_0x3b7295=_0x3b7295-0x0;var _0x320e95=_0xa6ea[_0x3b7295];return _0x320e95;};'use strict';var Sequelize=require('sequelize');module[_0xaa6e('0x0')]={'type':{'type':Sequelize[_0xaa6e('0x1')](_0xaa6e('0x2'),_0xaa6e('0x3'),_0xaa6e('0x4'),_0xaa6e('0x5'),_0xaa6e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xaa6e('0x7')]},'key':{'type':Sequelize[_0xaa6e('0x7')]},'keyType':{'type':Sequelize[_0xaa6e('0x1')](_0xaa6e('0x2'),_0xaa6e('0x3'),_0xaa6e('0x4'))},'keyContent':{'type':Sequelize[_0xaa6e('0x7')]},'idField':{'type':Sequelize[_0xaa6e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaa6e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa6e('0x7')]}}; \ No newline at end of file +var _0xc3b9=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x50a864,_0x3303e2){var _0x2fb82f=function(_0x2dc650){while(--_0x2dc650){_0x50a864['push'](_0x50a864['shift']());}};_0x2fb82f(++_0x3303e2);}(_0xc3b9,0xe4));var _0x9c3b=function(_0x1d2c4a,_0x54c283){_0x1d2c4a=_0x1d2c4a-0x0;var _0x23e15d=_0xc3b9[_0x1d2c4a];return _0x23e15d;};'use strict';var Sequelize=require(_0x9c3b('0x0'));module[_0x9c3b('0x1')]={'type':{'type':Sequelize[_0x9c3b('0x2')](_0x9c3b('0x3'),_0x9c3b('0x4'),_0x9c3b('0x5'),'keyValue',_0x9c3b('0x6')),'defaultValue':_0x9c3b('0x3')},'content':{'type':Sequelize[_0x9c3b('0x7')]},'key':{'type':Sequelize[_0x9c3b('0x7')]},'keyType':{'type':Sequelize[_0x9c3b('0x2')]('string',_0x9c3b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x9c3b('0x7')]},'idField':{'type':Sequelize[_0x9c3b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c3b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 80d848a..dc68e18 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 _0x3bbb=['send','map','ServicenowField','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','options','find','create','body','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x3bbb,0x140));var _0xb3bb=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x3bbb[_0x4bed75];return _0x2dd8e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3bb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb3bb('0x1'));var moment=require(_0xb3bb('0x2'));var BPromise=require(_0xb3bb('0x3'));var Mustache=require(_0xb3bb('0x4'));var util=require(_0xb3bb('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb3bb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3bb('0x7'));var _=require(_0xb3bb('0x8'));var squel=require(_0xb3bb('0x9'));var crypto=require(_0xb3bb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb3bb('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb3bb('0xc'));var Papa=require(_0xb3bb('0xd'));var Redis=require('ioredis');var authService=require(_0xb3bb('0xe'));var qs=require(_0xb3bb('0xf'));var as=require(_0xb3bb('0x10'));var hardwareService=require(_0xb3bb('0x11'));var logger=require(_0xb3bb('0x12'))(_0xb3bb('0x13'));var utils=require(_0xb3bb('0x14'));var config=require(_0xb3bb('0x15'));var licenseUtil=require(_0xb3bb('0x16'));var db=require(_0xb3bb('0x17'))['db'];function respondWithStatusCode(_0x428267,_0x41f2b8){_0x41f2b8=_0x41f2b8||0xcc;return function(_0x2d053e){if(_0x2d053e){return _0x428267[_0xb3bb('0x18')](_0x41f2b8);}return _0x428267['status'](_0x41f2b8)[_0xb3bb('0x19')]();};}function respondWithResult(_0x4ff467,_0x442c6c){_0x442c6c=_0x442c6c||0xc8;return function(_0x59d6d6){if(_0x59d6d6){return _0x4ff467[_0xb3bb('0x1a')](_0x442c6c)['json'](_0x59d6d6);}};}function respondWithFilteredResult(_0x21e266,_0x2fca37){return function(_0x1189be){if(_0x1189be){var _0x58b023=typeof _0x2fca37[_0xb3bb('0x1b')]===_0xb3bb('0x1c')&&typeof _0x2fca37['limit']===_0xb3bb('0x1c');var _0x569c1f=_0x1189be[_0xb3bb('0x1d')];var _0x20d482=_0x58b023?0x0:_0x2fca37[_0xb3bb('0x1b')];var _0x25b96f=_0x58b023?_0x1189be[_0xb3bb('0x1d')]:_0x2fca37[_0xb3bb('0x1b')]+_0x2fca37[_0xb3bb('0x1e')];var _0xf71328;if(_0x25b96f>=_0x569c1f){_0x25b96f=_0x569c1f;_0xf71328=0xc8;}else{_0xf71328=0xce;}_0x21e266[_0xb3bb('0x1a')](_0xf71328);return _0x21e266['set']('Content-Range',_0x20d482+'-'+_0x25b96f+'/'+_0x569c1f)['json'](_0x1189be);}return null;};}function patchUpdates(_0x958f83){return function(_0x1e0fae){try{jsonpatch[_0xb3bb('0x1f')](_0x1e0fae,_0x958f83,!![]);}catch(_0x3f8d1a){return BPromise[_0xb3bb('0x20')](_0x3f8d1a);}return _0x1e0fae[_0xb3bb('0x21')]();};}function saveUpdates(_0x315fc0,_0x5ab126){return function(_0x3822c8){if(_0x3822c8){return _0x3822c8[_0xb3bb('0x22')](_0x315fc0)[_0xb3bb('0x23')](function(_0x142dbf){return _0x142dbf;});}return null;};}function removeEntity(_0x119d7a,_0x3f37e0){return function(_0x4165a7){if(_0x4165a7){return _0x4165a7[_0xb3bb('0x24')]()['then'](function(){_0x119d7a[_0xb3bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x118449,_0xa1a56b){return function(_0x16c78e){if(!_0x16c78e){_0x118449[_0xb3bb('0x18')](0x194);}return _0x16c78e;};}function handleError(_0x5078d9,_0xb320c2){_0xb320c2=_0xb320c2||0x1f4;return function(_0x52d333){logger[_0xb3bb('0x25')](_0x52d333[_0xb3bb('0x26')]);if(_0x52d333['name']){delete _0x52d333[_0xb3bb('0x27')];}_0x5078d9['status'](_0xb320c2)[_0xb3bb('0x28')](_0x52d333);};}exports['index']=function(_0x21c3a3,_0x27710b){var _0x4b8f68={},_0x17a488={},_0x109d1a={'count':0x0,'rows':[]};var _0x3f939b=_[_0xb3bb('0x29')](db[_0xb3bb('0x2a')][_0xb3bb('0x2b')],function(_0x4e1a9c){return{'name':_0x4e1a9c[_0xb3bb('0x2c')],'type':_0x4e1a9c[_0xb3bb('0x2d')]['key']};});_0x17a488['model']=_['map'](_0x3f939b,_0xb3bb('0x27'));_0x17a488[_0xb3bb('0x2e')]=_[_0xb3bb('0x2f')](_0x21c3a3[_0xb3bb('0x2e')]);_0x17a488['filters']=_['intersection'](_0x17a488[_0xb3bb('0x30')],_0x17a488[_0xb3bb('0x2e')]);_0x4b8f68[_0xb3bb('0x31')]=_[_0xb3bb('0x32')](_0x17a488[_0xb3bb('0x30')],qs[_0xb3bb('0x33')](_0x21c3a3['query'][_0xb3bb('0x33')]));_0x4b8f68[_0xb3bb('0x31')]=_0x4b8f68['attributes'][_0xb3bb('0x34')]?_0x4b8f68['attributes']:_0x17a488[_0xb3bb('0x30')];if(!_0x21c3a3[_0xb3bb('0x2e')][_0xb3bb('0x35')](_0xb3bb('0x36'))){_0x4b8f68[_0xb3bb('0x1e')]=qs[_0xb3bb('0x1e')](_0x21c3a3[_0xb3bb('0x2e')][_0xb3bb('0x1e')]);_0x4b8f68['offset']=qs[_0xb3bb('0x1b')](_0x21c3a3[_0xb3bb('0x2e')]['offset']);}_0x4b8f68[_0xb3bb('0x37')]=qs[_0xb3bb('0x38')](_0x21c3a3[_0xb3bb('0x2e')]['sort']);_0x4b8f68[_0xb3bb('0x39')]=qs[_0xb3bb('0x3a')](_[_0xb3bb('0x3b')](_0x21c3a3[_0xb3bb('0x2e')],_0x17a488[_0xb3bb('0x3a')]),_0x3f939b);if(_0x21c3a3[_0xb3bb('0x2e')][_0xb3bb('0x3c')]){_0x4b8f68[_0xb3bb('0x39')]=_['merge'](_0x4b8f68['where'],{'$or':_['map'](_0x3f939b,function(_0x515c48){if(_0x515c48[_0xb3bb('0x2d')]!==_0xb3bb('0x3d')){var _0x5a2543={};_0x5a2543[_0x515c48[_0xb3bb('0x27')]]={'$like':'%'+_0x21c3a3[_0xb3bb('0x2e')][_0xb3bb('0x3c')]+'%'};return _0x5a2543;}})});}_0x4b8f68=_[_0xb3bb('0x3e')]({},_0x4b8f68,_0x21c3a3['options']);var _0x5fe8d6={'where':_0x4b8f68['where']};return db[_0xb3bb('0x2a')]['count'](_0x5fe8d6)[_0xb3bb('0x23')](function(_0x13653d){_0x109d1a[_0xb3bb('0x1d')]=_0x13653d;if(_0x21c3a3['query'][_0xb3bb('0x3f')]){_0x4b8f68[_0xb3bb('0x40')]=[{'all':!![]}];}return db[_0xb3bb('0x2a')]['findAll'](_0x4b8f68);})[_0xb3bb('0x23')](function(_0x478933){_0x109d1a[_0xb3bb('0x41')]=_0x478933;return _0x109d1a;})[_0xb3bb('0x23')](respondWithFilteredResult(_0x27710b,_0x4b8f68))[_0xb3bb('0x42')](handleError(_0x27710b,null));};exports['show']=function(_0x4ad31d,_0x483470){var _0x2333df={'raw':!![],'where':{'id':_0x4ad31d[_0xb3bb('0x43')]['id']}},_0x3fe7f6={};_0x3fe7f6[_0xb3bb('0x30')]=_['keys'](db[_0xb3bb('0x2a')][_0xb3bb('0x2b')]);_0x3fe7f6[_0xb3bb('0x2e')]=_[_0xb3bb('0x2f')](_0x4ad31d['query']);_0x3fe7f6[_0xb3bb('0x3a')]=_[_0xb3bb('0x32')](_0x3fe7f6['model'],_0x3fe7f6[_0xb3bb('0x2e')]);_0x2333df[_0xb3bb('0x31')]=_[_0xb3bb('0x32')](_0x3fe7f6[_0xb3bb('0x30')],qs[_0xb3bb('0x33')](_0x4ad31d['query']['fields']));_0x2333df[_0xb3bb('0x31')]=_0x2333df[_0xb3bb('0x31')]['length']?_0x2333df[_0xb3bb('0x31')]:_0x3fe7f6[_0xb3bb('0x30')];if(_0x4ad31d[_0xb3bb('0x2e')]['includeAll']){_0x2333df[_0xb3bb('0x40')]=[{'all':!![]}];}_0x2333df=_[_0xb3bb('0x3e')]({},_0x2333df,_0x4ad31d[_0xb3bb('0x44')]);return db[_0xb3bb('0x2a')][_0xb3bb('0x45')](_0x2333df)[_0xb3bb('0x23')](handleEntityNotFound(_0x483470,null))[_0xb3bb('0x23')](respondWithResult(_0x483470,null))[_0xb3bb('0x42')](handleError(_0x483470,null));};exports[_0xb3bb('0x46')]=function(_0x48b6b4,_0x125df9){return db['ServicenowField'][_0xb3bb('0x46')](_0x48b6b4[_0xb3bb('0x47')],{})[_0xb3bb('0x23')](respondWithResult(_0x125df9,0xc9))['catch'](handleError(_0x125df9,null));};exports[_0xb3bb('0x22')]=function(_0x2afcbd,_0x433e4c){if(_0x2afcbd[_0xb3bb('0x47')]['id']){delete _0x2afcbd[_0xb3bb('0x47')]['id'];}return db[_0xb3bb('0x2a')][_0xb3bb('0x45')]({'where':{'id':_0x2afcbd[_0xb3bb('0x43')]['id']}})[_0xb3bb('0x23')](handleEntityNotFound(_0x433e4c,null))[_0xb3bb('0x23')](saveUpdates(_0x2afcbd[_0xb3bb('0x47')],null))[_0xb3bb('0x23')](respondWithResult(_0x433e4c,null))[_0xb3bb('0x42')](handleError(_0x433e4c,null));};exports[_0xb3bb('0x24')]=function(_0x44fdec,_0x38f899){return db[_0xb3bb('0x2a')][_0xb3bb('0x45')]({'where':{'id':_0x44fdec[_0xb3bb('0x43')]['id']}})[_0xb3bb('0x23')](handleEntityNotFound(_0x38f899,null))[_0xb3bb('0x23')](removeEntity(_0x38f899,null))[_0xb3bb('0x42')](handleError(_0x38f899,null));}; \ No newline at end of file +var _0x4b62=['update','then','destroy','stack','index','map','ServicenowField','rawAttributes','fieldName','type','key','name','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x4b62,0x194));var _0x24b6=function(_0x3b4a36,_0x3611fb){_0x3b4a36=_0x3b4a36-0x0;var _0x596e8b=_0x4b62[_0x3b4a36];return _0x596e8b;};'use strict';var emlformat=require(_0x24b6('0x0'));var rimraf=require(_0x24b6('0x1'));var zipdir=require(_0x24b6('0x2'));var jsonpatch=require(_0x24b6('0x3'));var rp=require('request-promise');var moment=require(_0x24b6('0x4'));var BPromise=require(_0x24b6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x24b6('0x6'));var sox=require(_0x24b6('0x7'));var csv=require(_0x24b6('0x8'));var ejs=require(_0x24b6('0x9'));var fs=require('fs');var fs_extra=require(_0x24b6('0xa'));var _=require(_0x24b6('0xb'));var squel=require('squel');var crypto=require(_0x24b6('0xc'));var jsforce=require(_0x24b6('0xd'));var deskjs=require(_0x24b6('0xe'));var toCsv=require(_0x24b6('0x8'));var querystring=require(_0x24b6('0xf'));var Papa=require('papaparse');var Redis=require(_0x24b6('0x10'));var authService=require(_0x24b6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x24b6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x24b6('0x13'));var config=require(_0x24b6('0x14'));var licenseUtil=require(_0x24b6('0x15'));var db=require(_0x24b6('0x16'))['db'];function respondWithStatusCode(_0x19c3fb,_0x35f12a){_0x35f12a=_0x35f12a||0xcc;return function(_0x1b0880){if(_0x1b0880){return _0x19c3fb[_0x24b6('0x17')](_0x35f12a);}return _0x19c3fb['status'](_0x35f12a)[_0x24b6('0x18')]();};}function respondWithResult(_0x487762,_0xe8809b){_0xe8809b=_0xe8809b||0xc8;return function(_0x145d72){if(_0x145d72){return _0x487762[_0x24b6('0x19')](_0xe8809b)[_0x24b6('0x1a')](_0x145d72);}};}function respondWithFilteredResult(_0x57a64f,_0x3bd168){return function(_0x5bf725){if(_0x5bf725){var _0x4baf6d=typeof _0x3bd168[_0x24b6('0x1b')]===_0x24b6('0x1c')&&typeof _0x3bd168[_0x24b6('0x1d')]===_0x24b6('0x1c');var _0x21d9e3=_0x5bf725[_0x24b6('0x1e')];var _0x2f8c53=_0x4baf6d?0x0:_0x3bd168['offset'];var _0x35de97=_0x4baf6d?_0x5bf725['count']:_0x3bd168[_0x24b6('0x1b')]+_0x3bd168[_0x24b6('0x1d')];var _0x366d1c;if(_0x35de97>=_0x21d9e3){_0x35de97=_0x21d9e3;_0x366d1c=0xc8;}else{_0x366d1c=0xce;}_0x57a64f[_0x24b6('0x19')](_0x366d1c);return _0x57a64f['set'](_0x24b6('0x1f'),_0x2f8c53+'-'+_0x35de97+'/'+_0x21d9e3)['json'](_0x5bf725);}return null;};}function patchUpdates(_0x178152){return function(_0xcae9a0){try{jsonpatch[_0x24b6('0x20')](_0xcae9a0,_0x178152,!![]);}catch(_0x1a4cea){return BPromise['reject'](_0x1a4cea);}return _0xcae9a0[_0x24b6('0x21')]();};}function saveUpdates(_0x1d8bf8,_0x50e01f){return function(_0x11be0b){if(_0x11be0b){return _0x11be0b[_0x24b6('0x22')](_0x1d8bf8)[_0x24b6('0x23')](function(_0x540b40){return _0x540b40;});}return null;};}function removeEntity(_0xef534e,_0x2bdf83){return function(_0x404dca){if(_0x404dca){return _0x404dca[_0x24b6('0x24')]()[_0x24b6('0x23')](function(){_0xef534e[_0x24b6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44fea8,_0x2b3800){return function(_0x2a69a0){if(!_0x2a69a0){_0x44fea8[_0x24b6('0x17')](0x194);}return _0x2a69a0;};}function handleError(_0x6b0b47,_0x203991){_0x203991=_0x203991||0x1f4;return function(_0x2efa90){logger['error'](_0x2efa90[_0x24b6('0x25')]);if(_0x2efa90['name']){delete _0x2efa90['name'];}_0x6b0b47[_0x24b6('0x19')](_0x203991)['send'](_0x2efa90);};}exports[_0x24b6('0x26')]=function(_0x4d0b5e,_0x3a802d){var _0xd64b47={},_0x3bf452={},_0x267871={'count':0x0,'rows':[]};var _0x286c03=_[_0x24b6('0x27')](db[_0x24b6('0x28')][_0x24b6('0x29')],function(_0x224f3d){return{'name':_0x224f3d[_0x24b6('0x2a')],'type':_0x224f3d[_0x24b6('0x2b')][_0x24b6('0x2c')]};});_0x3bf452['model']=_[_0x24b6('0x27')](_0x286c03,_0x24b6('0x2d'));_0x3bf452[_0x24b6('0x2e')]=_[_0x24b6('0x2f')](_0x4d0b5e[_0x24b6('0x2e')]);_0x3bf452[_0x24b6('0x30')]=_['intersection'](_0x3bf452['model'],_0x3bf452[_0x24b6('0x2e')]);_0xd64b47[_0x24b6('0x31')]=_['intersection'](_0x3bf452['model'],qs[_0x24b6('0x32')](_0x4d0b5e['query'][_0x24b6('0x32')]));_0xd64b47[_0x24b6('0x31')]=_0xd64b47[_0x24b6('0x31')][_0x24b6('0x33')]?_0xd64b47[_0x24b6('0x31')]:_0x3bf452[_0x24b6('0x34')];if(!_0x4d0b5e['query'][_0x24b6('0x35')](_0x24b6('0x36'))){_0xd64b47[_0x24b6('0x1d')]=qs[_0x24b6('0x1d')](_0x4d0b5e[_0x24b6('0x2e')][_0x24b6('0x1d')]);_0xd64b47['offset']=qs[_0x24b6('0x1b')](_0x4d0b5e[_0x24b6('0x2e')]['offset']);}_0xd64b47[_0x24b6('0x37')]=qs[_0x24b6('0x38')](_0x4d0b5e['query'][_0x24b6('0x38')]);_0xd64b47[_0x24b6('0x39')]=qs['filters'](_[_0x24b6('0x3a')](_0x4d0b5e['query'],_0x3bf452[_0x24b6('0x30')]),_0x286c03);if(_0x4d0b5e[_0x24b6('0x2e')][_0x24b6('0x3b')]){_0xd64b47[_0x24b6('0x39')]=_[_0x24b6('0x3c')](_0xd64b47['where'],{'$or':_[_0x24b6('0x27')](_0x286c03,function(_0x4e662e){if(_0x4e662e[_0x24b6('0x2b')]!==_0x24b6('0x3d')){var _0x58e455={};_0x58e455[_0x4e662e[_0x24b6('0x2d')]]={'$like':'%'+_0x4d0b5e[_0x24b6('0x2e')][_0x24b6('0x3b')]+'%'};return _0x58e455;}})});}_0xd64b47=_[_0x24b6('0x3c')]({},_0xd64b47,_0x4d0b5e[_0x24b6('0x3e')]);var _0x1a8308={'where':_0xd64b47[_0x24b6('0x39')]};return db[_0x24b6('0x28')]['count'](_0x1a8308)[_0x24b6('0x23')](function(_0x74f20c){_0x267871[_0x24b6('0x1e')]=_0x74f20c;if(_0x4d0b5e[_0x24b6('0x2e')][_0x24b6('0x3f')]){_0xd64b47[_0x24b6('0x40')]=[{'all':!![]}];}return db['ServicenowField'][_0x24b6('0x41')](_0xd64b47);})['then'](function(_0x2ee049){_0x267871[_0x24b6('0x42')]=_0x2ee049;return _0x267871;})[_0x24b6('0x23')](respondWithFilteredResult(_0x3a802d,_0xd64b47))[_0x24b6('0x43')](handleError(_0x3a802d,null));};exports[_0x24b6('0x44')]=function(_0x3efcbf,_0x5f0ffa){var _0x45f5ee={'raw':!![],'where':{'id':_0x3efcbf[_0x24b6('0x45')]['id']}},_0x1cc036={};_0x1cc036[_0x24b6('0x34')]=_['keys'](db['ServicenowField'][_0x24b6('0x29')]);_0x1cc036['query']=_[_0x24b6('0x2f')](_0x3efcbf[_0x24b6('0x2e')]);_0x1cc036[_0x24b6('0x30')]=_['intersection'](_0x1cc036[_0x24b6('0x34')],_0x1cc036[_0x24b6('0x2e')]);_0x45f5ee[_0x24b6('0x31')]=_['intersection'](_0x1cc036[_0x24b6('0x34')],qs[_0x24b6('0x32')](_0x3efcbf[_0x24b6('0x2e')][_0x24b6('0x32')]));_0x45f5ee[_0x24b6('0x31')]=_0x45f5ee['attributes'][_0x24b6('0x33')]?_0x45f5ee[_0x24b6('0x31')]:_0x1cc036['model'];if(_0x3efcbf[_0x24b6('0x2e')]['includeAll']){_0x45f5ee['include']=[{'all':!![]}];}_0x45f5ee=_['merge']({},_0x45f5ee,_0x3efcbf['options']);return db[_0x24b6('0x28')][_0x24b6('0x46')](_0x45f5ee)[_0x24b6('0x23')](handleEntityNotFound(_0x5f0ffa,null))[_0x24b6('0x23')](respondWithResult(_0x5f0ffa,null))[_0x24b6('0x43')](handleError(_0x5f0ffa,null));};exports[_0x24b6('0x47')]=function(_0x2c6a80,_0x1e7493){return db[_0x24b6('0x28')][_0x24b6('0x47')](_0x2c6a80[_0x24b6('0x48')],{})[_0x24b6('0x23')](respondWithResult(_0x1e7493,0xc9))[_0x24b6('0x43')](handleError(_0x1e7493,null));};exports[_0x24b6('0x22')]=function(_0x1d74ec,_0x4fcf39){if(_0x1d74ec['body']['id']){delete _0x1d74ec[_0x24b6('0x48')]['id'];}return db[_0x24b6('0x28')][_0x24b6('0x46')]({'where':{'id':_0x1d74ec[_0x24b6('0x45')]['id']}})['then'](handleEntityNotFound(_0x4fcf39,null))[_0x24b6('0x23')](saveUpdates(_0x1d74ec[_0x24b6('0x48')],null))[_0x24b6('0x23')](respondWithResult(_0x4fcf39,null))[_0x24b6('0x43')](handleError(_0x4fcf39,null));};exports[_0x24b6('0x24')]=function(_0x23d719,_0x2565d3){return db[_0x24b6('0x28')]['find']({'where':{'id':_0x23d719[_0x24b6('0x45')]['id']}})[_0x24b6('0x23')](handleEntityNotFound(_0x2565d3,null))['then'](removeEntity(_0x2565d3,null))[_0x24b6('0x43')](handleError(_0x2565d3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 65b7419..acb6241 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 _0x7402=['request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7402,0xfa));var _0x2740=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0x7402[_0x895358];return _0x26e26e;};'use strict';var _=require(_0x2740('0x0'));var util=require(_0x2740('0x1'));var logger=require('../../config/logger')(_0x2740('0x2'));var moment=require(_0x2740('0x3'));var BPromise=require(_0x2740('0x4'));var rp=require(_0x2740('0x5'));var fs=require('fs');var path=require(_0x2740('0x6'));var rimraf=require(_0x2740('0x7'));var config=require(_0x2740('0x8'));var attributes=require(_0x2740('0x9'));module[_0x2740('0xa')]=function(_0x39ab26,_0x50a566){return _0x39ab26[_0x2740('0xb')](_0x2740('0xc'),attributes,{'tableName':_0x2740('0xd'),'paranoid':![],'indexes':[{'name':_0x2740('0xe'),'fields':[_0x2740('0xf'),_0x2740('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','idField','FieldId'];(function(_0x598cc3,_0x3875b6){var _0x37eb2e=function(_0xf72549){while(--_0xf72549){_0x598cc3['push'](_0x598cc3['shift']());}};_0x37eb2e(++_0x3875b6);}(_0x7fab,0xd0));var _0xb7fa=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x7fab[_0x39ea42];return _0x33f5b7;};'use strict';var _=require(_0xb7fa('0x0'));var util=require(_0xb7fa('0x1'));var logger=require(_0xb7fa('0x2'))(_0xb7fa('0x3'));var moment=require(_0xb7fa('0x4'));var BPromise=require(_0xb7fa('0x5'));var rp=require(_0xb7fa('0x6'));var fs=require('fs');var path=require(_0xb7fa('0x7'));var rimraf=require(_0xb7fa('0x8'));var config=require(_0xb7fa('0x9'));var attributes=require(_0xb7fa('0xa'));module[_0xb7fa('0xb')]=function(_0x1f72c6,_0x17d17c){return _0x1f72c6['define'](_0xb7fa('0xc'),attributes,{'tableName':_0xb7fa('0xd'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xb7fa('0xe'),_0xb7fa('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index e5b68cb..3a314b9 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xac4a,0x13f));var _0xaac4=function(_0x392452,_0x96be72){_0x392452=_0x392452-0x0;var _0x569714=_0xac4a[_0x392452];return _0x569714;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +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(_0x2af29a,_0x4f44bc){var _0x5ef02f=function(_0x4349ef){while(--_0x4349ef){_0x2af29a['push'](_0x2af29a['shift']());}};_0x5ef02f(++_0x4f44bc);}(_0xda3f,0xec));var _0xfda3=function(_0x43e47b,_0x21d739){_0x43e47b=_0x43e47b-0x0;var _0x5b36ec=_0xda3f[_0x43e47b];return _0x5b36ec;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0f8c6c8..4a5b1cc 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(_0x5d3882,_0x528ff0){var _0x20b576=function(_0x18d3d3){while(--_0x18d3d3){_0x5d3882['push'](_0x5d3882['shift']());}};_0x20b576(++_0x528ff0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 _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(_0x2360a0,_0x303a69){var _0x40055e=function(_0x291ff9){while(--_0x291ff9){_0x2360a0['push'](_0x2360a0['shift']());}};_0x40055e(++_0x303a69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5d706be..662c2f7 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(_0x30d394,_0x1b22bc){var _0x559e12=function(_0x3ed313){while(--_0x3ed313){_0x30d394['push'](_0x30d394['shift']());}};_0x559e12(++_0x1b22bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x4338b3,_0x3acd81){var _0x280fc4=function(_0x309209){while(--_0x309209){_0x4338b3['push'](_0x4338b3['shift']());}};_0x280fc4(++_0x3acd81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 1197d76..a01d933 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 _0x81a7=['substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/license/util','sendStatus','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','status','end','stack','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','show','params','rawAttributes','options','find','create','body','catch','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','channel','type','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_minutes','parent_type','direction','remoteUri'];(function(_0xf6e517,_0xfc297b){var _0x430d42=function(_0x5fefa1){while(--_0x5fefa1){_0xf6e517['push'](_0xf6e517['shift']());}};_0x430d42(++_0xfc297b);}(_0x81a7,0x177));var _0x781a=function(_0x342eb8,_0x328a1e){_0x342eb8=_0x342eb8-0x0;var _0x29873c=_0x81a7[_0x342eb8];return _0x29873c;};'use strict';var emlformat=require(_0x781a('0x0'));var rimraf=require(_0x781a('0x1'));var zipdir=require(_0x781a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x781a('0x3'));var Mustache=require(_0x781a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x781a('0x5'));var csv=require(_0x781a('0x6'));var ejs=require(_0x781a('0x7'));var fs=require('fs');var fs_extra=require(_0x781a('0x8'));var _=require(_0x781a('0x9'));var squel=require(_0x781a('0xa'));var crypto=require(_0x781a('0xb'));var jsforce=require(_0x781a('0xc'));var deskjs=require(_0x781a('0xd'));var toCsv=require(_0x781a('0x6'));var querystring=require(_0x781a('0xe'));var Papa=require(_0x781a('0xf'));var Redis=require(_0x781a('0x10'));var authService=require(_0x781a('0x11'));var qs=require(_0x781a('0x12'));var as=require(_0x781a('0x13'));var hardwareService=require(_0x781a('0x14'));var logger=require(_0x781a('0x15'))(_0x781a('0x16'));var utils=require(_0x781a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x781a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x255fe0,_0x396d33){_0x396d33=_0x396d33||0xcc;return function(_0xe2bf96){if(_0xe2bf96){return _0x255fe0[_0x781a('0x19')](_0x396d33);}return _0x255fe0['status'](_0x396d33)['end']();};}function respondWithResult(_0x3520e3,_0x2741b3){_0x2741b3=_0x2741b3||0xc8;return function(_0x5b7ac2){if(_0x5b7ac2){return _0x3520e3['status'](_0x2741b3)[_0x781a('0x1a')](_0x5b7ac2);}};}function respondWithFilteredResult(_0x4e63be,_0x207761){return function(_0x284dfb){if(_0x284dfb){var _0x2bb1fe=typeof _0x207761['offset']===_0x781a('0x1b')&&typeof _0x207761[_0x781a('0x1c')]===_0x781a('0x1b');var _0x4545a9=_0x284dfb['count'];var _0x106b63=_0x2bb1fe?0x0:_0x207761[_0x781a('0x1d')];var _0xa25455=_0x2bb1fe?_0x284dfb[_0x781a('0x1e')]:_0x207761[_0x781a('0x1d')]+_0x207761[_0x781a('0x1c')];var _0x1f8374;if(_0xa25455>=_0x4545a9){_0xa25455=_0x4545a9;_0x1f8374=0xc8;}else{_0x1f8374=0xce;}_0x4e63be['status'](_0x1f8374);return _0x4e63be[_0x781a('0x1f')](_0x781a('0x20'),_0x106b63+'-'+_0xa25455+'/'+_0x4545a9)['json'](_0x284dfb);}return null;};}function patchUpdates(_0x5eb516){return function(_0x3a7d47){try{jsonpatch[_0x781a('0x21')](_0x3a7d47,_0x5eb516,!![]);}catch(_0x1453a7){return BPromise['reject'](_0x1453a7);}return _0x3a7d47[_0x781a('0x22')]();};}function saveUpdates(_0x37c8d0,_0x24f38c){return function(_0x23fdac){if(_0x23fdac){return _0x23fdac[_0x781a('0x23')](_0x37c8d0)[_0x781a('0x24')](function(_0x2f7720){return _0x2f7720;});}return null;};}function removeEntity(_0x14e2b8,_0x2eb32f){return function(_0x8ea773){if(_0x8ea773){return _0x8ea773['destroy']()[_0x781a('0x24')](function(){_0x14e2b8[_0x781a('0x25')](0xcc)[_0x781a('0x26')]();});}};}function handleEntityNotFound(_0x4312c1,_0x431b25){return function(_0x4d11c4){if(!_0x4d11c4){_0x4312c1[_0x781a('0x19')](0x194);}return _0x4d11c4;};}function handleError(_0x28ebf9,_0x410cde){_0x410cde=_0x410cde||0x1f4;return function(_0x6f0f64){logger['error'](_0x6f0f64[_0x781a('0x27')]);if(_0x6f0f64[_0x781a('0x28')]){delete _0x6f0f64[_0x781a('0x28')];}_0x28ebf9[_0x781a('0x25')](_0x410cde)[_0x781a('0x29')](_0x6f0f64);};}exports[_0x781a('0x2a')]=function(_0x3ac9a2,_0x373b41){var _0x45b21b={},_0x25f702={},_0x2eac72={'count':0x0,'rows':[]};var _0x2ac8fe=_[_0x781a('0x2b')](db[_0x781a('0x2c')]['rawAttributes'],function(_0x35aa02){return{'name':_0x35aa02[_0x781a('0x2d')],'type':_0x35aa02['type'][_0x781a('0x2e')]};});_0x25f702[_0x781a('0x2f')]=_['map'](_0x2ac8fe,_0x781a('0x28'));_0x25f702[_0x781a('0x30')]=_[_0x781a('0x31')](_0x3ac9a2[_0x781a('0x30')]);_0x25f702['filters']=_[_0x781a('0x32')](_0x25f702[_0x781a('0x2f')],_0x25f702[_0x781a('0x30')]);_0x45b21b[_0x781a('0x33')]=_['intersection'](_0x25f702[_0x781a('0x2f')],qs[_0x781a('0x34')](_0x3ac9a2[_0x781a('0x30')][_0x781a('0x34')]));_0x45b21b['attributes']=_0x45b21b[_0x781a('0x33')][_0x781a('0x35')]?_0x45b21b[_0x781a('0x33')]:_0x25f702[_0x781a('0x2f')];if(!_0x3ac9a2['query'][_0x781a('0x36')](_0x781a('0x37'))){_0x45b21b[_0x781a('0x1c')]=qs[_0x781a('0x1c')](_0x3ac9a2[_0x781a('0x30')]['limit']);_0x45b21b[_0x781a('0x1d')]=qs[_0x781a('0x1d')](_0x3ac9a2[_0x781a('0x30')][_0x781a('0x1d')]);}_0x45b21b[_0x781a('0x38')]=qs[_0x781a('0x39')](_0x3ac9a2['query']['sort']);_0x45b21b[_0x781a('0x3a')]=qs[_0x781a('0x3b')](_[_0x781a('0x3c')](_0x3ac9a2[_0x781a('0x30')],_0x25f702[_0x781a('0x3b')]),_0x2ac8fe);if(_0x3ac9a2[_0x781a('0x30')][_0x781a('0x3d')]){_0x45b21b['where']=_[_0x781a('0x3e')](_0x45b21b[_0x781a('0x3a')],{'$or':_['map'](_0x2ac8fe,function(_0x4de3b6){if(_0x4de3b6['type']!=='VIRTUAL'){var _0x20eead={};_0x20eead[_0x4de3b6[_0x781a('0x28')]]={'$like':'%'+_0x3ac9a2[_0x781a('0x30')][_0x781a('0x3d')]+'%'};return _0x20eead;}})});}_0x45b21b=_[_0x781a('0x3e')]({},_0x45b21b,_0x3ac9a2['options']);var _0x246f0c={'where':_0x45b21b[_0x781a('0x3a')]};return db[_0x781a('0x2c')][_0x781a('0x1e')](_0x246f0c)[_0x781a('0x24')](function(_0x44556d){_0x2eac72[_0x781a('0x1e')]=_0x44556d;if(_0x3ac9a2[_0x781a('0x30')][_0x781a('0x3f')]){_0x45b21b[_0x781a('0x40')]=[{'all':!![]}];}return db[_0x781a('0x2c')]['findAll'](_0x45b21b);})[_0x781a('0x24')](function(_0x2e018e){_0x2eac72[_0x781a('0x41')]=_0x2e018e;return _0x2eac72;})['then'](respondWithFilteredResult(_0x373b41,_0x45b21b))['catch'](handleError(_0x373b41,null));};exports[_0x781a('0x42')]=function(_0x39ac9f,_0x2e7ed9){var _0x31ba8b={'raw':![],'where':{'id':_0x39ac9f[_0x781a('0x43')]['id']}},_0x19d3ec={};_0x19d3ec[_0x781a('0x2f')]=_[_0x781a('0x31')](db[_0x781a('0x2c')][_0x781a('0x44')]);_0x19d3ec[_0x781a('0x30')]=_[_0x781a('0x31')](_0x39ac9f[_0x781a('0x30')]);_0x19d3ec[_0x781a('0x3b')]=_[_0x781a('0x32')](_0x19d3ec[_0x781a('0x2f')],_0x19d3ec[_0x781a('0x30')]);_0x31ba8b['attributes']=_['intersection'](_0x19d3ec[_0x781a('0x2f')],qs['fields'](_0x39ac9f[_0x781a('0x30')][_0x781a('0x34')]));_0x31ba8b[_0x781a('0x33')]=_0x31ba8b['attributes'][_0x781a('0x35')]?_0x31ba8b[_0x781a('0x33')]:_0x19d3ec[_0x781a('0x2f')];if(_0x39ac9f['query'][_0x781a('0x3f')]){_0x31ba8b[_0x781a('0x40')]=[{'all':!![]}];}_0x31ba8b=_[_0x781a('0x3e')]({},_0x31ba8b,_0x39ac9f[_0x781a('0x45')]);return db['SugarcrmAccount'][_0x781a('0x46')](_0x31ba8b)[_0x781a('0x24')](handleEntityNotFound(_0x2e7ed9,null))[_0x781a('0x24')](respondWithResult(_0x2e7ed9,null))['catch'](handleError(_0x2e7ed9,null));};exports[_0x781a('0x47')]=function(_0x236a3a,_0x321685){return db[_0x781a('0x2c')][_0x781a('0x47')](_0x236a3a[_0x781a('0x48')],{})[_0x781a('0x24')](respondWithResult(_0x321685,0xc9))[_0x781a('0x49')](handleError(_0x321685,null));};exports[_0x781a('0x23')]=function(_0xfb3ed,_0x124e3f){if(_0xfb3ed[_0x781a('0x48')]['id']){delete _0xfb3ed[_0x781a('0x48')]['id'];}return db[_0x781a('0x2c')]['find']({'where':{'id':_0xfb3ed['params']['id']}})[_0x781a('0x24')](handleEntityNotFound(_0x124e3f,null))[_0x781a('0x24')](saveUpdates(_0xfb3ed[_0x781a('0x48')],null))[_0x781a('0x24')](respondWithResult(_0x124e3f,null))[_0x781a('0x49')](handleError(_0x124e3f,null));};exports[_0x781a('0x4a')]=function(_0x524789,_0x41f52d){return db[_0x781a('0x2c')][_0x781a('0x46')]({'where':{'id':_0x524789[_0x781a('0x43')]['id']}})[_0x781a('0x24')](handleEntityNotFound(_0x41f52d,null))[_0x781a('0x24')](removeEntity(_0x41f52d,null))[_0x781a('0x49')](handleError(_0x41f52d,null));};exports[_0x781a('0x4b')]=function(_0x509d0f,_0x37b735,_0x4cef8c){var _0x4801f2={};var _0x36f18e={};var _0xc37afb;var _0x257d85;return db[_0x781a('0x2c')][_0x781a('0x4c')]({'where':{'id':_0x509d0f['params']['id']}})[_0x781a('0x24')](handleEntityNotFound(_0x37b735,null))['then'](function(_0xd4d723){if(_0xd4d723){_0xc37afb=_0xd4d723;_0x36f18e[_0x781a('0x2f')]=_[_0x781a('0x31')](db[_0x781a('0x4d')]['rawAttributes']);_0x36f18e[_0x781a('0x30')]=_['keys'](_0x509d0f['query']);_0x36f18e['filters']=_[_0x781a('0x32')](_0x36f18e[_0x781a('0x2f')],_0x36f18e[_0x781a('0x30')]);_0x4801f2[_0x781a('0x33')]=_[_0x781a('0x32')](_0x36f18e['model'],qs[_0x781a('0x34')](_0x509d0f[_0x781a('0x30')][_0x781a('0x34')]));_0x4801f2[_0x781a('0x33')]=_0x4801f2[_0x781a('0x33')][_0x781a('0x35')]?_0x4801f2['attributes']:_0x36f18e[_0x781a('0x2f')];_0x4801f2[_0x781a('0x38')]=qs[_0x781a('0x39')](_0x509d0f['query'][_0x781a('0x39')]);_0x4801f2['where']=qs[_0x781a('0x3b')](_[_0x781a('0x3c')](_0x509d0f[_0x781a('0x30')],_0x36f18e['filters']));if(_0x509d0f[_0x781a('0x30')][_0x781a('0x3d')]){_0x4801f2[_0x781a('0x3a')]=_['merge'](_0x4801f2[_0x781a('0x3a')],{'$or':_[_0x781a('0x2b')](_0x4801f2[_0x781a('0x33')],function(_0x375330){var _0x50fb36={};_0x50fb36[_0x375330]={'$like':'%'+_0x509d0f[_0x781a('0x30')]['filter']+'%'};return _0x50fb36;})});}_0x4801f2=_[_0x781a('0x3e')]({},_0x4801f2,_0x509d0f['options']);return _0xc37afb[_0x781a('0x4b')](_0x4801f2);}})[_0x781a('0x24')](function(_0x23357f){if(_0x23357f){_0x257d85=_0x23357f['length'];if(!_0x509d0f[_0x781a('0x30')][_0x781a('0x36')](_0x781a('0x37'))){_0x4801f2[_0x781a('0x1c')]=qs[_0x781a('0x1c')](_0x509d0f[_0x781a('0x30')][_0x781a('0x1c')]);_0x4801f2[_0x781a('0x1d')]=qs[_0x781a('0x1d')](_0x509d0f['query'][_0x781a('0x1d')]);}return _0xc37afb['getConfigurations'](_0x4801f2);}})[_0x781a('0x24')](function(_0x35d13e){if(_0x35d13e){return _0x35d13e?{'count':_0x257d85,'rows':_0x35d13e}:null;}})[_0x781a('0x24')](respondWithResult(_0x37b735,null))['catch'](handleError(_0x37b735,null));};exports[_0x781a('0x4e')]=function(_0x2eb190,_0x3b7c38,_0x292288){if(_0x2eb190[_0x781a('0x48')]['id']){delete _0x2eb190[_0x781a('0x48')]['id'];}return db[_0x781a('0x2c')][_0x781a('0x4c')]({'where':{'id':_0x2eb190[_0x781a('0x43')]['id']}})[_0x781a('0x24')](handleEntityNotFound(_0x3b7c38,null))[_0x781a('0x24')](function(_0x43b537){if(_0x43b537){_0x2eb190['body'][_0x781a('0x4f')]=_0x43b537['id'];_0x2eb190[_0x781a('0x48')][_0x781a('0x50')]=integrations['getSubjects'](_0x2eb190[_0x781a('0x48')][_0x781a('0x51')],_0x2eb190[_0x781a('0x48')][_0x781a('0x52')]);_0x2eb190[_0x781a('0x48')][_0x781a('0x53')]=integrations['getDescriptions'](_0x2eb190[_0x781a('0x48')][_0x781a('0x51')],_0x2eb190[_0x781a('0x48')][_0x781a('0x52')]);return db[_0x781a('0x4d')][_0x781a('0x47')](_0x2eb190['body'],{'include':[{'model':db[_0x781a('0x54')],'as':'Subjects'},{'model':db[_0x781a('0x54')],'as':_0x781a('0x53')}]});}return null;})[_0x781a('0x24')](respondWithResult(_0x3b7c38,null))[_0x781a('0x49')](handleError(_0x3b7c38,null));};exports[_0x781a('0x55')]=function(_0x626d0c,_0x239ab4,_0x1ec9b2){var _0x1c0413='';var _0x4e910b=['id',_0x781a('0x28'),_0x781a('0x56'),'created_by',_0x781a('0x57'),_0x781a('0x58'),'duration_hours',_0x781a('0x59'),'parent_id',_0x781a('0x5a'),'parent_name',_0x781a('0x5b')];return db[_0x781a('0x2c')][_0x781a('0x4c')]({'where':{'id':_0x626d0c[_0x781a('0x43')]['id']},'attributes':['id','username','password','remoteUri']})[_0x781a('0x24')](handleEntityNotFound(_0x239ab4,null))['then'](function(_0x2c9763){if(_0x2c9763){_0x1c0413=_0x2c9763[_0x781a('0x5c')];var _0x491d0e=_0x1c0413['slice'](-0x1);if(_0x491d0e==='/'){_0x1c0413=_0x1c0413[_0x781a('0x5d')](0x0,_0x1c0413['lastIndexOf'](_0x491d0e));}return rp({'method':_0x781a('0x5e'),'uri':util['format'](_0x781a('0x5f'),_0x1c0413,_0x781a('0x60')),'json':!![],'form':{'method':_0x781a('0x61'),'input_type':_0x781a('0x62'),'response_type':_0x781a('0x62'),'rest_data':JSON[_0x781a('0x63')]({'user_auth':{'user_name':_0x2c9763['username'],'password':_0x2c9763['password'],'encryption':_0x781a('0x64')},'application':_0x781a('0x65')})}});}})['then'](function(_0x3f0465){if(_0x3f0465&&_0x3f0465[_0x781a('0x28')]!==_0x781a('0x66')&&_0x3f0465[_0x781a('0x28')]!=='Password\x20Expired'){return rp({'method':_0x781a('0x5e'),'uri':util[_0x781a('0x67')](_0x781a('0x5f'),_0x1c0413,_0x781a('0x60')),'json':!![],'form':{'method':_0x781a('0x68'),'input_type':_0x781a('0x62'),'response_type':_0x781a('0x62'),'rest_data':JSON[_0x781a('0x63')]({'session':_0x3f0465['id'],'module_name':_0x781a('0x69')})}})[_0x781a('0x24')](function(_0x3d403a){if(_0x3d403a){var _0x15edb4=_[_0x781a('0x6a')](_0x3d403a[_0x781a('0x6b')]);_['remove'](_0x15edb4,function(_0xd1ee85){return _0x4e910b[_0x781a('0x6c')](_0xd1ee85[_0x781a('0x28')]);});return{'count':_0x15edb4[_0x781a('0x35')],'rows':_[_0x781a('0x2b')](_0x15edb4,function(_0x95d3a5){return{'id':_0x95d3a5['name'],'name':_0x95d3a5[_0x781a('0x6d')],'custom':_[_0x781a('0x6e')](_0x95d3a5[_0x781a('0x28')],'_c')?!![]:![],'options':_0x95d3a5[_0x781a('0x45')]?_[_0x781a('0x2b')](_[_0x781a('0x6a')](_0x95d3a5[_0x781a('0x45')]),function(_0x11645d){return{'name':_0x11645d[_0x781a('0x6f')],'value':_0x11645d['name']};}):[]};})};}})[_0x781a('0x24')](respondWithResult(_0x239ab4,null))[_0x781a('0x49')](function(_0xb62b5d){var _0x4ab15f=_0x626d0c[_0x781a('0x30')][_0x781a('0x70')]?0x1f4:_0xb62b5d[_0x781a('0x71')]||0x1f4;logger[_0x781a('0x72')](_0x781a('0x73'),'getFields',_0x4ab15f,JSON[_0x781a('0x63')](_0xb62b5d));delete _0xb62b5d[_0x781a('0x28')];if(_0x4ab15f===0x191){_0x4ab15f=0x190;}_0x239ab4['status'](_0x4ab15f)['send'](_0x626d0c[_0x781a('0x30')][_0x781a('0x70')]?{'message':_0x781a('0x74'),'statusCode':_0xb62b5d[_0x781a('0x71')]}:_0xb62b5d);});}else{var _0x733623=0x1f4;_0x239ab4['status'](_0x733623)[_0x781a('0x29')]({'message':_0x781a('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x757a=['get_module_fields','Calls','remove','endsWith','values','value','test','statusCode','send','Wrong\x20credentials','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','destroy','then','error','name','index','map','SugarcrmAccount','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','show','params','includeAll','include','find','catch','create','body','update','getConfigurations','SugarcrmConfiguration','rawAttributes','length','nolimit','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','remoteUri','slice','substring','lastIndexOf','format','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','%s%s','/service/v4_1/rest.php'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x757a,0x1ea));var _0xa757=function(_0x58e9c4,_0x545742){_0x58e9c4=_0x58e9c4-0x0;var _0x250053=_0x757a[_0x58e9c4];return _0x250053;};'use strict';var emlformat=require(_0xa757('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa757('0x1'));var jsonpatch=require(_0xa757('0x2'));var rp=require(_0xa757('0x3'));var moment=require(_0xa757('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa757('0x5'));var util=require(_0xa757('0x6'));var path=require(_0xa757('0x7'));var sox=require(_0xa757('0x8'));var csv=require(_0xa757('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0xa'));var _=require(_0xa757('0xb'));var squel=require(_0xa757('0xc'));var crypto=require(_0xa757('0xd'));var jsforce=require(_0xa757('0xe'));var deskjs=require(_0xa757('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa757('0x10'));var Papa=require('papaparse');var Redis=require(_0xa757('0x11'));var authService=require(_0xa757('0x12'));var qs=require(_0xa757('0x13'));var as=require(_0xa757('0x14'));var hardwareService=require(_0xa757('0x15'));var logger=require(_0xa757('0x16'))(_0xa757('0x17'));var utils=require(_0xa757('0x18'));var config=require(_0xa757('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa757('0x1a'))['db'];var integrations=require(_0xa757('0x1b'));function respondWithStatusCode(_0x31df0c,_0x309791){_0x309791=_0x309791||0xcc;return function(_0x343569){if(_0x343569){return _0x31df0c[_0xa757('0x1c')](_0x309791);}return _0x31df0c[_0xa757('0x1d')](_0x309791)[_0xa757('0x1e')]();};}function respondWithResult(_0xd2628a,_0x2a53f1){_0x2a53f1=_0x2a53f1||0xc8;return function(_0x13dbd0){if(_0x13dbd0){return _0xd2628a[_0xa757('0x1d')](_0x2a53f1)['json'](_0x13dbd0);}};}function respondWithFilteredResult(_0xa81144,_0x338067){return function(_0x36659f){if(_0x36659f){var _0x588566=typeof _0x338067[_0xa757('0x1f')]===_0xa757('0x20')&&typeof _0x338067[_0xa757('0x21')]===_0xa757('0x20');var _0x3dfc94=_0x36659f[_0xa757('0x22')];var _0x466e51=_0x588566?0x0:_0x338067[_0xa757('0x1f')];var _0x26d802=_0x588566?_0x36659f['count']:_0x338067[_0xa757('0x1f')]+_0x338067[_0xa757('0x21')];var _0x2225a4;if(_0x26d802>=_0x3dfc94){_0x26d802=_0x3dfc94;_0x2225a4=0xc8;}else{_0x2225a4=0xce;}_0xa81144[_0xa757('0x1d')](_0x2225a4);return _0xa81144[_0xa757('0x23')](_0xa757('0x24'),_0x466e51+'-'+_0x26d802+'/'+_0x3dfc94)[_0xa757('0x25')](_0x36659f);}return null;};}function patchUpdates(_0x2f7190){return function(_0x4c7967){try{jsonpatch['apply'](_0x4c7967,_0x2f7190,!![]);}catch(_0x2da14e){return BPromise[_0xa757('0x26')](_0x2da14e);}return _0x4c7967['save']();};}function saveUpdates(_0x3ebdb4,_0x377834){return function(_0x28d923){if(_0x28d923){return _0x28d923['update'](_0x3ebdb4)['then'](function(_0x1aa36c){return _0x1aa36c;});}return null;};}function removeEntity(_0x514f11,_0x3a97ef){return function(_0x4f5551){if(_0x4f5551){return _0x4f5551[_0xa757('0x27')]()[_0xa757('0x28')](function(){_0x514f11[_0xa757('0x1d')](0xcc)[_0xa757('0x1e')]();});}};}function handleEntityNotFound(_0x290fa9,_0x469d7b){return function(_0x2853a9){if(!_0x2853a9){_0x290fa9['sendStatus'](0x194);}return _0x2853a9;};}function handleError(_0x2652b6,_0x1ae220){_0x1ae220=_0x1ae220||0x1f4;return function(_0x5ad876){logger[_0xa757('0x29')](_0x5ad876['stack']);if(_0x5ad876[_0xa757('0x2a')]){delete _0x5ad876[_0xa757('0x2a')];}_0x2652b6['status'](_0x1ae220)['send'](_0x5ad876);};}exports[_0xa757('0x2b')]=function(_0x5545b4,_0x5135ed){var _0x4a53e2={},_0x1ebaae={},_0x1e2312={'count':0x0,'rows':[]};var _0x25ae74=_[_0xa757('0x2c')](db[_0xa757('0x2d')]['rawAttributes'],function(_0x3c48a7){return{'name':_0x3c48a7['fieldName'],'type':_0x3c48a7['type'][_0xa757('0x2e')]};});_0x1ebaae['model']=_[_0xa757('0x2c')](_0x25ae74,_0xa757('0x2a'));_0x1ebaae['query']=_[_0xa757('0x2f')](_0x5545b4[_0xa757('0x30')]);_0x1ebaae[_0xa757('0x31')]=_['intersection'](_0x1ebaae['model'],_0x1ebaae[_0xa757('0x30')]);_0x4a53e2[_0xa757('0x32')]=_[_0xa757('0x33')](_0x1ebaae[_0xa757('0x34')],qs[_0xa757('0x35')](_0x5545b4['query'][_0xa757('0x35')]));_0x4a53e2[_0xa757('0x32')]=_0x4a53e2['attributes']['length']?_0x4a53e2[_0xa757('0x32')]:_0x1ebaae['model'];if(!_0x5545b4[_0xa757('0x30')][_0xa757('0x36')]('nolimit')){_0x4a53e2[_0xa757('0x21')]=qs[_0xa757('0x21')](_0x5545b4['query'][_0xa757('0x21')]);_0x4a53e2[_0xa757('0x1f')]=qs[_0xa757('0x1f')](_0x5545b4[_0xa757('0x30')]['offset']);}_0x4a53e2[_0xa757('0x37')]=qs[_0xa757('0x38')](_0x5545b4[_0xa757('0x30')][_0xa757('0x38')]);_0x4a53e2[_0xa757('0x39')]=qs[_0xa757('0x31')](_[_0xa757('0x3a')](_0x5545b4[_0xa757('0x30')],_0x1ebaae['filters']),_0x25ae74);if(_0x5545b4[_0xa757('0x30')][_0xa757('0x3b')]){_0x4a53e2[_0xa757('0x39')]=_[_0xa757('0x3c')](_0x4a53e2[_0xa757('0x39')],{'$or':_[_0xa757('0x2c')](_0x25ae74,function(_0x339724){if(_0x339724[_0xa757('0x3d')]!==_0xa757('0x3e')){var _0x42db94={};_0x42db94[_0x339724[_0xa757('0x2a')]]={'$like':'%'+_0x5545b4[_0xa757('0x30')][_0xa757('0x3b')]+'%'};return _0x42db94;}})});}_0x4a53e2=_['merge']({},_0x4a53e2,_0x5545b4[_0xa757('0x3f')]);var _0x242b86={'where':_0x4a53e2[_0xa757('0x39')]};return db[_0xa757('0x2d')][_0xa757('0x22')](_0x242b86)[_0xa757('0x28')](function(_0xababbb){_0x1e2312[_0xa757('0x22')]=_0xababbb;if(_0x5545b4[_0xa757('0x30')]['includeAll']){_0x4a53e2['include']=[{'all':!![]}];}return db[_0xa757('0x2d')][_0xa757('0x40')](_0x4a53e2);})['then'](function(_0x2b7358){_0x1e2312['rows']=_0x2b7358;return _0x1e2312;})[_0xa757('0x28')](respondWithFilteredResult(_0x5135ed,_0x4a53e2))['catch'](handleError(_0x5135ed,null));};exports[_0xa757('0x41')]=function(_0x136be7,_0x9b585f){var _0x1f58b6={'raw':![],'where':{'id':_0x136be7[_0xa757('0x42')]['id']}},_0x35f0a5={};_0x35f0a5[_0xa757('0x34')]=_[_0xa757('0x2f')](db[_0xa757('0x2d')]['rawAttributes']);_0x35f0a5[_0xa757('0x30')]=_[_0xa757('0x2f')](_0x136be7['query']);_0x35f0a5[_0xa757('0x31')]=_[_0xa757('0x33')](_0x35f0a5[_0xa757('0x34')],_0x35f0a5['query']);_0x1f58b6[_0xa757('0x32')]=_[_0xa757('0x33')](_0x35f0a5[_0xa757('0x34')],qs[_0xa757('0x35')](_0x136be7[_0xa757('0x30')]['fields']));_0x1f58b6[_0xa757('0x32')]=_0x1f58b6['attributes']['length']?_0x1f58b6[_0xa757('0x32')]:_0x35f0a5['model'];if(_0x136be7[_0xa757('0x30')][_0xa757('0x43')]){_0x1f58b6[_0xa757('0x44')]=[{'all':!![]}];}_0x1f58b6=_[_0xa757('0x3c')]({},_0x1f58b6,_0x136be7[_0xa757('0x3f')]);return db['SugarcrmAccount'][_0xa757('0x45')](_0x1f58b6)['then'](handleEntityNotFound(_0x9b585f,null))[_0xa757('0x28')](respondWithResult(_0x9b585f,null))[_0xa757('0x46')](handleError(_0x9b585f,null));};exports[_0xa757('0x47')]=function(_0x5035df,_0x3f4ed2){return db[_0xa757('0x2d')]['create'](_0x5035df[_0xa757('0x48')],{})[_0xa757('0x28')](respondWithResult(_0x3f4ed2,0xc9))[_0xa757('0x46')](handleError(_0x3f4ed2,null));};exports[_0xa757('0x49')]=function(_0x1e5741,_0x81eb5b){if(_0x1e5741[_0xa757('0x48')]['id']){delete _0x1e5741[_0xa757('0x48')]['id'];}return db['SugarcrmAccount'][_0xa757('0x45')]({'where':{'id':_0x1e5741['params']['id']}})['then'](handleEntityNotFound(_0x81eb5b,null))['then'](saveUpdates(_0x1e5741[_0xa757('0x48')],null))['then'](respondWithResult(_0x81eb5b,null))[_0xa757('0x46')](handleError(_0x81eb5b,null));};exports['destroy']=function(_0x3e76f4,_0x467276){return db[_0xa757('0x2d')]['find']({'where':{'id':_0x3e76f4[_0xa757('0x42')]['id']}})['then'](handleEntityNotFound(_0x467276,null))[_0xa757('0x28')](removeEntity(_0x467276,null))[_0xa757('0x46')](handleError(_0x467276,null));};exports[_0xa757('0x4a')]=function(_0x218f75,_0x5393c4,_0x5b9c5f){var _0x128e1e={};var _0x2d3882={};var _0x5949b5;var _0x59a789;return db[_0xa757('0x2d')]['findOne']({'where':{'id':_0x218f75[_0xa757('0x42')]['id']}})[_0xa757('0x28')](handleEntityNotFound(_0x5393c4,null))[_0xa757('0x28')](function(_0x2ec6b8){if(_0x2ec6b8){_0x5949b5=_0x2ec6b8;_0x2d3882[_0xa757('0x34')]=_[_0xa757('0x2f')](db[_0xa757('0x4b')][_0xa757('0x4c')]);_0x2d3882['query']=_['keys'](_0x218f75['query']);_0x2d3882[_0xa757('0x31')]=_[_0xa757('0x33')](_0x2d3882[_0xa757('0x34')],_0x2d3882['query']);_0x128e1e['attributes']=_[_0xa757('0x33')](_0x2d3882[_0xa757('0x34')],qs[_0xa757('0x35')](_0x218f75[_0xa757('0x30')][_0xa757('0x35')]));_0x128e1e[_0xa757('0x32')]=_0x128e1e[_0xa757('0x32')]['length']?_0x128e1e[_0xa757('0x32')]:_0x2d3882[_0xa757('0x34')];_0x128e1e[_0xa757('0x37')]=qs[_0xa757('0x38')](_0x218f75[_0xa757('0x30')][_0xa757('0x38')]);_0x128e1e[_0xa757('0x39')]=qs[_0xa757('0x31')](_[_0xa757('0x3a')](_0x218f75[_0xa757('0x30')],_0x2d3882['filters']));if(_0x218f75['query'][_0xa757('0x3b')]){_0x128e1e[_0xa757('0x39')]=_[_0xa757('0x3c')](_0x128e1e[_0xa757('0x39')],{'$or':_['map'](_0x128e1e[_0xa757('0x32')],function(_0x12728d){var _0xffd161={};_0xffd161[_0x12728d]={'$like':'%'+_0x218f75['query'][_0xa757('0x3b')]+'%'};return _0xffd161;})});}_0x128e1e=_[_0xa757('0x3c')]({},_0x128e1e,_0x218f75['options']);return _0x5949b5[_0xa757('0x4a')](_0x128e1e);}})[_0xa757('0x28')](function(_0x2c70fc){if(_0x2c70fc){_0x59a789=_0x2c70fc[_0xa757('0x4d')];if(!_0x218f75[_0xa757('0x30')][_0xa757('0x36')](_0xa757('0x4e'))){_0x128e1e['limit']=qs[_0xa757('0x21')](_0x218f75['query'][_0xa757('0x21')]);_0x128e1e[_0xa757('0x1f')]=qs[_0xa757('0x1f')](_0x218f75[_0xa757('0x30')][_0xa757('0x1f')]);}return _0x5949b5[_0xa757('0x4a')](_0x128e1e);}})[_0xa757('0x28')](function(_0x430986){if(_0x430986){return _0x430986?{'count':_0x59a789,'rows':_0x430986}:null;}})['then'](respondWithResult(_0x5393c4,null))[_0xa757('0x46')](handleError(_0x5393c4,null));};exports['addConfiguration']=function(_0x2259cd,_0x153c44,_0x16df2d){if(_0x2259cd[_0xa757('0x48')]['id']){delete _0x2259cd[_0xa757('0x48')]['id'];}return db['SugarcrmAccount'][_0xa757('0x4f')]({'where':{'id':_0x2259cd[_0xa757('0x42')]['id']}})[_0xa757('0x28')](handleEntityNotFound(_0x153c44,null))[_0xa757('0x28')](function(_0x297c62){if(_0x297c62){_0x2259cd[_0xa757('0x48')][_0xa757('0x50')]=_0x297c62['id'];_0x2259cd[_0xa757('0x48')]['Subjects']=integrations[_0xa757('0x51')](_0x2259cd[_0xa757('0x48')][_0xa757('0x52')],_0x2259cd['body']['type']);_0x2259cd[_0xa757('0x48')][_0xa757('0x53')]=integrations[_0xa757('0x54')](_0x2259cd[_0xa757('0x48')][_0xa757('0x52')],_0x2259cd[_0xa757('0x48')]['type']);return db[_0xa757('0x4b')][_0xa757('0x47')](_0x2259cd['body'],{'include':[{'model':db[_0xa757('0x55')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x153c44,null))[_0xa757('0x46')](handleError(_0x153c44,null));};exports[_0xa757('0x56')]=function(_0x440c18,_0x25aebf,_0x56797a){var _0x29271e='';var _0x2e1c96=['id',_0xa757('0x2a'),_0xa757('0x57'),'created_by',_0xa757('0x58'),_0xa757('0x59'),_0xa757('0x5a'),_0xa757('0x5b'),_0xa757('0x5c'),_0xa757('0x5d'),_0xa757('0x5e'),'direction'];return db['SugarcrmAccount'][_0xa757('0x4f')]({'where':{'id':_0x440c18['params']['id']},'attributes':['id',_0xa757('0x5f'),'password',_0xa757('0x60')]})[_0xa757('0x28')](handleEntityNotFound(_0x25aebf,null))['then'](function(_0x37f195){if(_0x37f195){_0x29271e=_0x37f195['remoteUri'];var _0x94bd11=_0x29271e[_0xa757('0x61')](-0x1);if(_0x94bd11==='/'){_0x29271e=_0x29271e[_0xa757('0x62')](0x0,_0x29271e[_0xa757('0x63')](_0x94bd11));}return rp({'method':'POST','uri':util[_0xa757('0x64')]('%s%s',_0x29271e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa757('0x65'),'input_type':_0xa757('0x66'),'response_type':_0xa757('0x66'),'rest_data':JSON[_0xa757('0x67')]({'user_auth':{'user_name':_0x37f195[_0xa757('0x5f')],'password':_0x37f195['password'],'encryption':'PLAIN'},'application':_0xa757('0x68')})}});}})['then'](function(_0x208920){if(_0x208920&&_0x208920[_0xa757('0x2a')]!==_0xa757('0x69')&&_0x208920[_0xa757('0x2a')]!==_0xa757('0x6a')){return rp({'method':_0xa757('0x6b'),'uri':util[_0xa757('0x64')](_0xa757('0x6c'),_0x29271e,_0xa757('0x6d')),'json':!![],'form':{'method':_0xa757('0x6e'),'input_type':_0xa757('0x66'),'response_type':_0xa757('0x66'),'rest_data':JSON[_0xa757('0x67')]({'session':_0x208920['id'],'module_name':_0xa757('0x6f')})}})[_0xa757('0x28')](function(_0x4f6207){if(_0x4f6207){var _0x5c4cac=_['values'](_0x4f6207['module_fields']);_[_0xa757('0x70')](_0x5c4cac,function(_0x19c721){return _0x2e1c96['includes'](_0x19c721[_0xa757('0x2a')]);});return{'count':_0x5c4cac['length'],'rows':_[_0xa757('0x2c')](_0x5c4cac,function(_0x3cfbf8){return{'id':_0x3cfbf8['name'],'name':_0x3cfbf8['label'],'custom':_[_0xa757('0x71')](_0x3cfbf8[_0xa757('0x2a')],'_c')?!![]:![],'options':_0x3cfbf8[_0xa757('0x3f')]?_[_0xa757('0x2c')](_[_0xa757('0x72')](_0x3cfbf8['options']),function(_0x320cdf){return{'name':_0x320cdf[_0xa757('0x73')],'value':_0x320cdf[_0xa757('0x2a')]};}):[]};})};}})[_0xa757('0x28')](respondWithResult(_0x25aebf,null))[_0xa757('0x46')](function(_0x5488c8){var _0x4b2154=_0x440c18[_0xa757('0x30')][_0xa757('0x74')]?0x1f4:_0x5488c8[_0xa757('0x75')]||0x1f4;logger[_0xa757('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xa757('0x56'),_0x4b2154,JSON[_0xa757('0x67')](_0x5488c8));delete _0x5488c8[_0xa757('0x2a')];if(_0x4b2154===0x191){_0x4b2154=0x190;}_0x25aebf['status'](_0x4b2154)[_0xa757('0x76')](_0x440c18[_0xa757('0x30')][_0xa757('0x74')]?{'message':_0xa757('0x77'),'statusCode':_0x5488c8[_0xa757('0x75')]}:_0x5488c8);});}else{var _0x204650=0x1f4;_0x25aebf[_0xa757('0x1d')](_0x204650)[_0xa757('0x76')]({'message':_0xa757('0x77'),'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 f50e307..429d501 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 _0xdb6a=['bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xdb6a,0x102));var _0xadb6=function(_0xa82abf,_0x2e27ac){_0xa82abf=_0xa82abf-0x0;var _0xf56c93=_0xdb6a[_0xa82abf];return _0xf56c93;};'use strict';var _=require(_0xadb6('0x0'));var util=require(_0xadb6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xadb6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadb6('0x3'));var rimraf=require(_0xadb6('0x4'));var config=require(_0xadb6('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xadb6('0x6'));module[_0xadb6('0x7')]=function(_0x5d4680,_0x5cd190){return _0x5d4680['define'](_0xadb6('0x8'),attributes,{'tableName':_0xadb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fe=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd8fe,0xfa));var _0xed8f=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd8fe[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xed8f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xed8f('0x1'));var moment=require(_0xed8f('0x2'));var BPromise=require(_0xed8f('0x3'));var rp=require(_0xed8f('0x4'));var fs=require('fs');var path=require(_0xed8f('0x5'));var rimraf=require(_0xed8f('0x6'));var config=require('../../config/environment');var attributes=require(_0xed8f('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xed8f('0x8')]=function(_0x29aa00,_0x588aac){return _0x29aa00[_0xed8f('0x9')](_0xed8f('0xa'),attributes,{'tableName':_0xed8f('0xb'),'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 e9c19cc..d331549 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 _0x64dd=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','include','map','model','attributes','info','debug','ShowSugarcrmAccount','find','lodash','util','moment'];(function(_0x862ab8,_0x55dca6){var _0xc9c454=function(_0x230fab){while(--_0x230fab){_0x862ab8['push'](_0x862ab8['shift']());}};_0xc9c454(++_0x55dca6);}(_0x64dd,0x105));var _0xd64d=function(_0x50915e,_0x35273b){_0x50915e=_0x50915e-0x0;var _0xd8bee8=_0x64dd[_0x50915e];return _0xd8bee8;};'use strict';var _=require(_0xd64d('0x0'));var util=require(_0xd64d('0x1'));var moment=require(_0xd64d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd64d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd64d('0x4'))('rpc');var config=require(_0xd64d('0x5'));var jayson=require(_0xd64d('0x6'));var client=jayson[_0xd64d('0x7')][_0xd64d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33dd17,_0x3a3582,_0x2a847c){return new BPromise(function(_0x24a9f9,_0x5928ad){return client[_0xd64d('0x9')](_0x33dd17,_0x2a847c)[_0xd64d('0xa')](function(_0x1e5237){logger['info'](_0xd64d('0xb'),_0x3a3582,_0xd64d('0xc'));logger['debug'](_0xd64d('0xd'),_0x3a3582,_0xd64d('0xc'),JSON[_0xd64d('0xe')](_0x1e5237));if(_0x1e5237[_0xd64d('0xf')]){if(_0x1e5237['error'][_0xd64d('0x10')]===0x1f4){logger['error'](_0xd64d('0xb'),_0x3a3582,_0x1e5237[_0xd64d('0xf')]['message']);return _0x5928ad(_0x1e5237['error'][_0xd64d('0x11')]);}logger[_0xd64d('0xf')](_0xd64d('0xb'),_0x3a3582,_0x1e5237[_0xd64d('0xf')]['message']);return _0x24a9f9(_0x1e5237['error']['message']);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3a3582,_0xd64d('0xc'));_0x24a9f9(_0x1e5237['result'][_0xd64d('0x11')]);}})[_0xd64d('0x12')](function(_0x152253){logger[_0xd64d('0xf')](_0xd64d('0xb'),_0x3a3582,_0x152253);_0x5928ad(_0x152253);});});}exports[_0xd64d('0x13')]=function(_0x5300b5){var _0x32cf21=this;return new Promise(function(_0x1d223b,_0x816194){return db[_0xd64d('0x14')][_0xd64d('0x15')]({'raw':_0x5300b5['options']?_0x5300b5[_0xd64d('0x16')][_0xd64d('0x17')]===undefined?!![]:![]:!![],'where':_0x5300b5[_0xd64d('0x16')]?_0x5300b5[_0xd64d('0x16')][_0xd64d('0x18')]||null:null,'attributes':_0x5300b5['options']?_0x5300b5['options']['attributes']||null:null,'limit':_0x5300b5[_0xd64d('0x16')]?_0x5300b5[_0xd64d('0x16')]['limit']||null:null,'include':_0x5300b5[_0xd64d('0x16')]?_0x5300b5[_0xd64d('0x16')][_0xd64d('0x19')]?_[_0xd64d('0x1a')](_0x5300b5[_0xd64d('0x16')][_0xd64d('0x19')],function(_0x550fc7){return{'model':db[_0x550fc7[_0xd64d('0x1b')]],'as':_0x550fc7['as'],'attributes':_0x550fc7[_0xd64d('0x1c')],'include':_0x550fc7[_0xd64d('0x19')]?_[_0xd64d('0x1a')](_0x550fc7[_0xd64d('0x19')],function(_0x4ac0b2){return{'model':db[_0x4ac0b2[_0xd64d('0x1b')]],'as':_0x4ac0b2['as'],'attributes':_0x4ac0b2[_0xd64d('0x1c')],'include':_0x4ac0b2[_0xd64d('0x19')]?_[_0xd64d('0x1a')](_0x4ac0b2[_0xd64d('0x19')],function(_0x126b94){return{'model':db[_0x126b94[_0xd64d('0x1b')]],'as':_0x126b94['as'],'attributes':_0x126b94[_0xd64d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd64d('0xa')](function(_0x13519a){logger[_0xd64d('0x1d')](_0xd64d('0x13'),_0x5300b5);logger[_0xd64d('0x1e')]('GetSugarcrmAccount',_0x5300b5,JSON[_0xd64d('0xe')](_0x13519a));_0x1d223b(_0x13519a);})[_0xd64d('0x12')](function(_0x3887d6){logger[_0xd64d('0xf')]('GetSugarcrmAccount',_0x3887d6[_0xd64d('0x11')],_0x5300b5);_0x816194(_0x32cf21['error'](0x1f4,_0x3887d6[_0xd64d('0x11')]));});});};exports[_0xd64d('0x1f')]=function(_0x162058){var _0x4384ca=this;return new Promise(function(_0x181c10,_0x357a3d){return db[_0xd64d('0x14')][_0xd64d('0x20')]({'raw':_0x162058[_0xd64d('0x16')]?_0x162058[_0xd64d('0x16')][_0xd64d('0x17')]===undefined?!![]:![]:!![],'where':_0x162058[_0xd64d('0x16')]?_0x162058['options'][_0xd64d('0x18')]||null:null,'attributes':_0x162058[_0xd64d('0x16')]?_0x162058[_0xd64d('0x16')][_0xd64d('0x1c')]||null:null,'include':_0x162058[_0xd64d('0x16')]?_0x162058[_0xd64d('0x16')][_0xd64d('0x19')]?_['map'](_0x162058[_0xd64d('0x16')][_0xd64d('0x19')],function(_0x52e372){return{'model':db[_0x52e372['model']],'as':_0x52e372['as'],'attributes':_0x52e372[_0xd64d('0x1c')],'include':_0x52e372[_0xd64d('0x19')]?_[_0xd64d('0x1a')](_0x52e372[_0xd64d('0x19')],function(_0x550f83){return{'model':db[_0x550f83[_0xd64d('0x1b')]],'as':_0x550f83['as'],'attributes':_0x550f83[_0xd64d('0x1c')],'include':_0x550f83['include']?_[_0xd64d('0x1a')](_0x550f83[_0xd64d('0x19')],function(_0x334c1b){return{'model':db[_0x334c1b['model']],'as':_0x334c1b['as'],'attributes':_0x334c1b[_0xd64d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3248f3){logger[_0xd64d('0x1d')](_0xd64d('0x1f'),_0x162058);logger[_0xd64d('0x1e')](_0xd64d('0x1f'),_0x162058,JSON[_0xd64d('0xe')](_0x3248f3));_0x181c10(_0x3248f3);})[_0xd64d('0x12')](function(_0x291c9b){logger[_0xd64d('0xf')](_0xd64d('0x1f'),_0x291c9b[_0xd64d('0x11')],_0x162058);_0x357a3d(_0x4384ca[_0xd64d('0xf')](0x1f4,_0x291c9b[_0xd64d('0x11')]));});});}; \ No newline at end of file +var _0x1456=['code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','SugarcrmAccount','raw','options','where','attributes','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d9825,_0x5abdbc){var _0x204124=function(_0x2b6948){while(--_0x2b6948){_0x4d9825['push'](_0x4d9825['shift']());}};_0x204124(++_0x5abdbc);}(_0x1456,0xdc));var _0x6145=function(_0x2c26a0,_0x2b9577){_0x2c26a0=_0x2c26a0-0x0;var _0x3e26d2=_0x1456[_0x2c26a0];return _0x3e26d2;};'use strict';var _=require(_0x6145('0x0'));var util=require(_0x6145('0x1'));var moment=require(_0x6145('0x2'));var BPromise=require(_0x6145('0x3'));var rs=require(_0x6145('0x4'));var fs=require('fs');var Redis=require(_0x6145('0x5'));var db=require(_0x6145('0x6'))['db'];var utils=require(_0x6145('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6145('0x8'));var client=jayson['client'][_0x6145('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x229f6b,_0x4f0c01,_0x54b0a0){return new BPromise(function(_0x1fb457,_0x53832f){return client[_0x6145('0xa')](_0x229f6b,_0x54b0a0)[_0x6145('0xb')](function(_0x18dce8){logger[_0x6145('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f0c01,_0x6145('0xd'));logger[_0x6145('0xe')](_0x6145('0xf'),_0x4f0c01,_0x6145('0xd'),JSON[_0x6145('0x10')](_0x18dce8));if(_0x18dce8['error']){if(_0x18dce8[_0x6145('0x11')][_0x6145('0x12')]===0x1f4){logger[_0x6145('0x11')](_0x6145('0x13'),_0x4f0c01,_0x18dce8[_0x6145('0x11')][_0x6145('0x14')]);return _0x53832f(_0x18dce8[_0x6145('0x11')][_0x6145('0x14')]);}logger[_0x6145('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f0c01,_0x18dce8[_0x6145('0x11')][_0x6145('0x14')]);return _0x1fb457(_0x18dce8[_0x6145('0x11')][_0x6145('0x14')]);}else{logger[_0x6145('0xc')](_0x6145('0x13'),_0x4f0c01,'request\x20sent');_0x1fb457(_0x18dce8[_0x6145('0x15')][_0x6145('0x14')]);}})[_0x6145('0x16')](function(_0x29799d){logger[_0x6145('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f0c01,_0x29799d);_0x53832f(_0x29799d);});});}exports['GetSugarcrmAccount']=function(_0x41d6de){var _0x4255db=this;return new Promise(function(_0x459a0c,_0x332507){return db[_0x6145('0x17')]['findAll']({'raw':_0x41d6de['options']?_0x41d6de['options'][_0x6145('0x18')]===undefined?!![]:![]:!![],'where':_0x41d6de['options']?_0x41d6de[_0x6145('0x19')][_0x6145('0x1a')]||null:null,'attributes':_0x41d6de[_0x6145('0x19')]?_0x41d6de['options'][_0x6145('0x1b')]||null:null,'limit':_0x41d6de['options']?_0x41d6de[_0x6145('0x19')]['limit']||null:null,'include':_0x41d6de['options']?_0x41d6de[_0x6145('0x19')][_0x6145('0x1c')]?_[_0x6145('0x1d')](_0x41d6de['options'][_0x6145('0x1c')],function(_0x57e382){return{'model':db[_0x57e382[_0x6145('0x1e')]],'as':_0x57e382['as'],'attributes':_0x57e382[_0x6145('0x1b')],'include':_0x57e382['include']?_['map'](_0x57e382['include'],function(_0x942dc5){return{'model':db[_0x942dc5[_0x6145('0x1e')]],'as':_0x942dc5['as'],'attributes':_0x942dc5[_0x6145('0x1b')],'include':_0x942dc5[_0x6145('0x1c')]?_['map'](_0x942dc5[_0x6145('0x1c')],function(_0x388fc1){return{'model':db[_0x388fc1[_0x6145('0x1e')]],'as':_0x388fc1['as'],'attributes':_0x388fc1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6145('0xb')](function(_0x59b5ef){logger[_0x6145('0xc')](_0x6145('0x1f'),_0x41d6de);logger[_0x6145('0xe')]('GetSugarcrmAccount',_0x41d6de,JSON[_0x6145('0x10')](_0x59b5ef));_0x459a0c(_0x59b5ef);})['catch'](function(_0x423c03){logger[_0x6145('0x11')](_0x6145('0x1f'),_0x423c03[_0x6145('0x14')],_0x41d6de);_0x332507(_0x4255db[_0x6145('0x11')](0x1f4,_0x423c03[_0x6145('0x14')]));});});};exports[_0x6145('0x20')]=function(_0x2a1fdc){var _0x212782=this;return new Promise(function(_0xbfdf25,_0x4f5e0a){return db[_0x6145('0x17')][_0x6145('0x21')]({'raw':_0x2a1fdc[_0x6145('0x19')]?_0x2a1fdc[_0x6145('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2a1fdc[_0x6145('0x19')]?_0x2a1fdc[_0x6145('0x19')]['where']||null:null,'attributes':_0x2a1fdc[_0x6145('0x19')]?_0x2a1fdc['options'][_0x6145('0x1b')]||null:null,'include':_0x2a1fdc[_0x6145('0x19')]?_0x2a1fdc[_0x6145('0x19')][_0x6145('0x1c')]?_[_0x6145('0x1d')](_0x2a1fdc[_0x6145('0x19')][_0x6145('0x1c')],function(_0x4528a2){return{'model':db[_0x4528a2[_0x6145('0x1e')]],'as':_0x4528a2['as'],'attributes':_0x4528a2['attributes'],'include':_0x4528a2[_0x6145('0x1c')]?_[_0x6145('0x1d')](_0x4528a2[_0x6145('0x1c')],function(_0xd250fa){return{'model':db[_0xd250fa[_0x6145('0x1e')]],'as':_0xd250fa['as'],'attributes':_0xd250fa[_0x6145('0x1b')],'include':_0xd250fa['include']?_[_0x6145('0x1d')](_0xd250fa[_0x6145('0x1c')],function(_0x5d6d5e){return{'model':db[_0x5d6d5e[_0x6145('0x1e')]],'as':_0x5d6d5e['as'],'attributes':_0x5d6d5e[_0x6145('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6145('0xb')](function(_0x30fd62){logger[_0x6145('0xc')](_0x6145('0x20'),_0x2a1fdc);logger[_0x6145('0xe')](_0x6145('0x20'),_0x2a1fdc,JSON[_0x6145('0x10')](_0x30fd62));_0xbfdf25(_0x30fd62);})[_0x6145('0x16')](function(_0xe0cd30){logger[_0x6145('0x11')](_0x6145('0x20'),_0xe0cd30['message'],_0x2a1fdc);_0x4f5e0a(_0x212782[_0x6145('0x11')](0x1f4,_0xe0cd30['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7e9c85e..7322cbb 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 _0x1a80=['Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x1a80,0x122));var _0x01a8=function(_0x2a5f3a,_0x1d7959){_0x2a5f3a=_0x2a5f3a-0x0;var _0x3b5fe0=_0x1a80[_0x2a5f3a];return _0x3b5fe0;};'use strict';var multer=require('multer');var util=require(_0x01a8('0x0'));var path=require(_0x01a8('0x1'));var timeout=require(_0x01a8('0x2'));var express=require(_0x01a8('0x3'));var router=express[_0x01a8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x01a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x01a8('0x6'));var controller=require(_0x01a8('0x7'));router[_0x01a8('0x8')]('/',auth[_0x01a8('0x9')](),controller[_0x01a8('0xa')]);router['get'](_0x01a8('0xb'),auth[_0x01a8('0x9')](),controller['show']);router['get'](_0x01a8('0xc'),auth[_0x01a8('0x9')](),controller[_0x01a8('0xd')]);router[_0x01a8('0x8')]('/:id/subjects',auth[_0x01a8('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x01a8('0x9')](),controller['getDescriptions']);router[_0x01a8('0xe')]('/',auth['isAuthenticated'](),controller[_0x01a8('0xf')]);router[_0x01a8('0x10')](_0x01a8('0xb'),auth['isAuthenticated'](),controller[_0x01a8('0x11')]);router[_0x01a8('0x12')]('/:id',auth[_0x01a8('0x9')](),controller[_0x01a8('0x13')]);module[_0x01a8('0x14')]=router; \ No newline at end of file +var _0x6dd1=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x1c2d23,_0x40f8d3){var _0x459564=function(_0x376356){while(--_0x376356){_0x1c2d23['push'](_0x1c2d23['shift']());}};_0x459564(++_0x40f8d3);}(_0x6dd1,0x98));var _0x16dd=function(_0x27d1e7,_0x33fab6){_0x27d1e7=_0x27d1e7-0x0;var _0x2ec61c=_0x6dd1[_0x27d1e7];return _0x2ec61c;};'use strict';var multer=require(_0x16dd('0x0'));var util=require(_0x16dd('0x1'));var path=require(_0x16dd('0x2'));var timeout=require(_0x16dd('0x3'));var express=require(_0x16dd('0x4'));var router=express[_0x16dd('0x5')]();var fs_extra=require(_0x16dd('0x6'));var auth=require(_0x16dd('0x7'));var interaction=require(_0x16dd('0x8'));var config=require(_0x16dd('0x9'));var controller=require(_0x16dd('0xa'));router[_0x16dd('0xb')]('/',auth[_0x16dd('0xc')](),controller['index']);router[_0x16dd('0xb')](_0x16dd('0xd'),auth[_0x16dd('0xc')](),controller[_0x16dd('0xe')]);router[_0x16dd('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x16dd('0xf')]);router[_0x16dd('0xb')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x16dd('0x10')]);router[_0x16dd('0xb')](_0x16dd('0x11'),auth['isAuthenticated'](),controller[_0x16dd('0x12')]);router[_0x16dd('0x13')]('/',auth['isAuthenticated'](),controller[_0x16dd('0x14')]);router[_0x16dd('0x15')]('/:id',auth[_0x16dd('0xc')](),controller[_0x16dd('0x16')]);router['delete'](_0x16dd('0xd'),auth[_0x16dd('0xc')](),controller[_0x16dd('0x17')]);module[_0x16dd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index cc432ee..6e884ad 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 _0x5091=['sequelize','exports','STRING'];(function(_0x18229d,_0x402688){var _0x4d2aaa=function(_0x1e2520){while(--_0x1e2520){_0x18229d['push'](_0x18229d['shift']());}};_0x4d2aaa(++_0x402688);}(_0x5091,0x1da));var _0x1509=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5091[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1509('0x0'));module[_0x1509('0x1')]={'name':{'type':Sequelize[_0x1509('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd058=['STRING','sequelize','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd058,0x13f));var _0x8d05=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0xd058[_0xcfe8cc];return _0x55ac53;};'use strict';var Sequelize=require(_0x8d05('0x0'));module[_0x8d05('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d05('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index e36ffff..de79989 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 _0xfb39=['sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','findOne','SugarcrmField','pick','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order'];(function(_0x133928,_0x14e8e){var _0x320d88=function(_0x3c6179){while(--_0x3c6179){_0x133928['push'](_0x133928['shift']());}};_0x320d88(++_0x14e8e);}(_0xfb39,0x14f));var _0x9fb3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb39[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x9fb3('0x0'));var rimraf=require(_0x9fb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fb3('0x2'));var rp=require(_0x9fb3('0x3'));var moment=require(_0x9fb3('0x4'));var BPromise=require(_0x9fb3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9fb3('0x6'));var sox=require(_0x9fb3('0x7'));var csv=require(_0x9fb3('0x8'));var ejs=require(_0x9fb3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9fb3('0xa'));var crypto=require(_0x9fb3('0xb'));var jsforce=require(_0x9fb3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9fb3('0x8'));var querystring=require(_0x9fb3('0xd'));var Papa=require(_0x9fb3('0xe'));var Redis=require(_0x9fb3('0xf'));var authService=require(_0x9fb3('0x10'));var qs=require(_0x9fb3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fb3('0x12'))(_0x9fb3('0x13'));var utils=require(_0x9fb3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9fb3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x344bdf,_0x324ea6){_0x324ea6=_0x324ea6||0xcc;return function(_0x5c0eb2){if(_0x5c0eb2){return _0x344bdf[_0x9fb3('0x16')](_0x324ea6);}return _0x344bdf[_0x9fb3('0x17')](_0x324ea6)[_0x9fb3('0x18')]();};}function respondWithResult(_0x1d2ad7,_0xb36cd4){_0xb36cd4=_0xb36cd4||0xc8;return function(_0x4c177b){if(_0x4c177b){return _0x1d2ad7['status'](_0xb36cd4)[_0x9fb3('0x19')](_0x4c177b);}};}function respondWithFilteredResult(_0x1a53ab,_0x450f5f){return function(_0x47684e){if(_0x47684e){var _0x9de5d7=typeof _0x450f5f[_0x9fb3('0x1a')]===_0x9fb3('0x1b')&&typeof _0x450f5f[_0x9fb3('0x1c')]===_0x9fb3('0x1b');var _0x432b75=_0x47684e[_0x9fb3('0x1d')];var _0x66e700=_0x9de5d7?0x0:_0x450f5f[_0x9fb3('0x1a')];var _0x50acea=_0x9de5d7?_0x47684e[_0x9fb3('0x1d')]:_0x450f5f['offset']+_0x450f5f[_0x9fb3('0x1c')];var _0x6c19d2;if(_0x50acea>=_0x432b75){_0x50acea=_0x432b75;_0x6c19d2=0xc8;}else{_0x6c19d2=0xce;}_0x1a53ab[_0x9fb3('0x17')](_0x6c19d2);return _0x1a53ab['set']('Content-Range',_0x66e700+'-'+_0x50acea+'/'+_0x432b75)[_0x9fb3('0x19')](_0x47684e);}return null;};}function patchUpdates(_0x2198d2){return function(_0x44c588){try{jsonpatch[_0x9fb3('0x1e')](_0x44c588,_0x2198d2,!![]);}catch(_0xe7093e){return BPromise[_0x9fb3('0x1f')](_0xe7093e);}return _0x44c588[_0x9fb3('0x20')]();};}function saveUpdates(_0x402491,_0x46a7d3){return function(_0x2d8474){if(_0x2d8474){return _0x2d8474[_0x9fb3('0x21')](_0x402491)[_0x9fb3('0x22')](function(_0x306f45){return _0x306f45;});}return null;};}function removeEntity(_0x24ab9d,_0x577b7a){return function(_0x20feb4){if(_0x20feb4){return _0x20feb4['destroy']()[_0x9fb3('0x22')](function(){_0x24ab9d[_0x9fb3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a45e6,_0x22fea1){return function(_0x1a7214){if(!_0x1a7214){_0x3a45e6[_0x9fb3('0x16')](0x194);}return _0x1a7214;};}function handleError(_0x1c3d7f,_0x5d1769){_0x5d1769=_0x5d1769||0x1f4;return function(_0x3405e5){logger[_0x9fb3('0x23')](_0x3405e5[_0x9fb3('0x24')]);if(_0x3405e5[_0x9fb3('0x25')]){delete _0x3405e5['name'];}_0x1c3d7f[_0x9fb3('0x17')](_0x5d1769)[_0x9fb3('0x26')](_0x3405e5);};}exports[_0x9fb3('0x27')]=function(_0x540e11,_0x3e797d){var _0x525de6={},_0x52e407={},_0xa53860={'count':0x0,'rows':[]};var _0x568063=_[_0x9fb3('0x28')](db[_0x9fb3('0x29')][_0x9fb3('0x2a')],function(_0x53036c){return{'name':_0x53036c['fieldName'],'type':_0x53036c[_0x9fb3('0x2b')][_0x9fb3('0x2c')]};});_0x52e407[_0x9fb3('0x2d')]=_['map'](_0x568063,_0x9fb3('0x25'));_0x52e407['query']=_[_0x9fb3('0x2e')](_0x540e11[_0x9fb3('0x2f')]);_0x52e407[_0x9fb3('0x30')]=_['intersection'](_0x52e407[_0x9fb3('0x2d')],_0x52e407[_0x9fb3('0x2f')]);_0x525de6[_0x9fb3('0x31')]=_[_0x9fb3('0x32')](_0x52e407[_0x9fb3('0x2d')],qs[_0x9fb3('0x33')](_0x540e11[_0x9fb3('0x2f')][_0x9fb3('0x33')]));_0x525de6['attributes']=_0x525de6[_0x9fb3('0x31')][_0x9fb3('0x34')]?_0x525de6[_0x9fb3('0x31')]:_0x52e407[_0x9fb3('0x2d')];if(!_0x540e11['query'][_0x9fb3('0x35')]('nolimit')){_0x525de6[_0x9fb3('0x1c')]=qs[_0x9fb3('0x1c')](_0x540e11['query'][_0x9fb3('0x1c')]);_0x525de6[_0x9fb3('0x1a')]=qs['offset'](_0x540e11[_0x9fb3('0x2f')][_0x9fb3('0x1a')]);}_0x525de6[_0x9fb3('0x36')]=qs[_0x9fb3('0x37')](_0x540e11[_0x9fb3('0x2f')][_0x9fb3('0x37')]);_0x525de6[_0x9fb3('0x38')]=qs[_0x9fb3('0x30')](_['pick'](_0x540e11[_0x9fb3('0x2f')],_0x52e407[_0x9fb3('0x30')]),_0x568063);if(_0x540e11['query'][_0x9fb3('0x39')]){_0x525de6['where']=_[_0x9fb3('0x3a')](_0x525de6['where'],{'$or':_['map'](_0x568063,function(_0xf54d5){if(_0xf54d5[_0x9fb3('0x2b')]!==_0x9fb3('0x3b')){var _0x2b4ad0={};_0x2b4ad0[_0xf54d5['name']]={'$like':'%'+_0x540e11[_0x9fb3('0x2f')][_0x9fb3('0x39')]+'%'};return _0x2b4ad0;}})});}_0x525de6=_[_0x9fb3('0x3a')]({},_0x525de6,_0x540e11[_0x9fb3('0x3c')]);var _0xd33af6={'where':_0x525de6[_0x9fb3('0x38')]};return db['SugarcrmConfiguration']['count'](_0xd33af6)[_0x9fb3('0x22')](function(_0xfa0cfb){_0xa53860['count']=_0xfa0cfb;if(_0x540e11[_0x9fb3('0x2f')]['includeAll']){_0x525de6[_0x9fb3('0x3d')]=[{'all':!![]}];}return db[_0x9fb3('0x29')][_0x9fb3('0x3e')](_0x525de6);})[_0x9fb3('0x22')](function(_0x4b6afb){_0xa53860[_0x9fb3('0x3f')]=_0x4b6afb;return _0xa53860;})['then'](respondWithFilteredResult(_0x3e797d,_0x525de6))[_0x9fb3('0x40')](handleError(_0x3e797d,null));};exports[_0x9fb3('0x41')]=function(_0x47607a,_0x59b236){var _0x1a2aa0={'raw':![],'where':{'id':_0x47607a[_0x9fb3('0x42')]['id']}},_0x520aa7={};_0x520aa7[_0x9fb3('0x2d')]=_['keys'](db[_0x9fb3('0x29')]['rawAttributes']);_0x520aa7[_0x9fb3('0x2f')]=_[_0x9fb3('0x2e')](_0x47607a[_0x9fb3('0x2f')]);_0x520aa7[_0x9fb3('0x30')]=_[_0x9fb3('0x32')](_0x520aa7[_0x9fb3('0x2d')],_0x520aa7[_0x9fb3('0x2f')]);_0x1a2aa0[_0x9fb3('0x31')]=_[_0x9fb3('0x32')](_0x520aa7[_0x9fb3('0x2d')],qs[_0x9fb3('0x33')](_0x47607a[_0x9fb3('0x2f')][_0x9fb3('0x33')]));_0x1a2aa0[_0x9fb3('0x31')]=_0x1a2aa0[_0x9fb3('0x31')][_0x9fb3('0x34')]?_0x1a2aa0[_0x9fb3('0x31')]:_0x520aa7[_0x9fb3('0x2d')];if(_0x47607a['query'][_0x9fb3('0x43')]){_0x1a2aa0['include']=[{'all':!![]}];}_0x1a2aa0=_[_0x9fb3('0x3a')]({},_0x1a2aa0,_0x47607a[_0x9fb3('0x3c')]);return db[_0x9fb3('0x29')]['find'](_0x1a2aa0)[_0x9fb3('0x22')](handleEntityNotFound(_0x59b236,null))[_0x9fb3('0x22')](respondWithResult(_0x59b236,null))[_0x9fb3('0x40')](handleError(_0x59b236,null));};exports[_0x9fb3('0x44')]=function(_0xdbc1d6,_0x4ec5de){return db[_0x9fb3('0x29')][_0x9fb3('0x44')](_0xdbc1d6[_0x9fb3('0x45')],{})[_0x9fb3('0x22')](respondWithResult(_0x4ec5de,0xc9))[_0x9fb3('0x40')](handleError(_0x4ec5de,null));};exports['update']=function(_0x381180,_0x191137){if(_0x381180['body']['id']){delete _0x381180['body']['id'];}return db[_0x9fb3('0x29')][_0x9fb3('0x46')]({'where':{'id':_0x381180[_0x9fb3('0x42')]['id']}})[_0x9fb3('0x22')](handleEntityNotFound(_0x191137,null))[_0x9fb3('0x22')](saveUpdates(_0x381180[_0x9fb3('0x45')],null))[_0x9fb3('0x22')](respondWithResult(_0x191137,null))[_0x9fb3('0x40')](handleError(_0x191137,null));};exports['destroy']=function(_0xcf43f2,_0x4615ec){return db['SugarcrmConfiguration'][_0x9fb3('0x46')]({'where':{'id':_0xcf43f2[_0x9fb3('0x42')]['id']}})[_0x9fb3('0x22')](handleEntityNotFound(_0x4615ec,null))[_0x9fb3('0x22')](removeEntity(_0x4615ec,null))[_0x9fb3('0x40')](handleError(_0x4615ec,null));};exports['getFields']=function(_0x6b414,_0x3bcc18,_0x4ab826){var _0x2df75a={};var _0x2531e6={};var _0x1b94e7;var _0x10934f;return db['SugarcrmConfiguration'][_0x9fb3('0x47')]({'where':{'id':_0x6b414[_0x9fb3('0x42')]['id']}})[_0x9fb3('0x22')](handleEntityNotFound(_0x3bcc18,null))['then'](function(_0x16666c){if(_0x16666c){_0x1b94e7=_0x16666c;_0x2531e6[_0x9fb3('0x2d')]=_[_0x9fb3('0x2e')](db[_0x9fb3('0x48')][_0x9fb3('0x2a')]);_0x2531e6[_0x9fb3('0x2f')]=_['keys'](_0x6b414[_0x9fb3('0x2f')]);_0x2531e6[_0x9fb3('0x30')]=_[_0x9fb3('0x32')](_0x2531e6[_0x9fb3('0x2d')],_0x2531e6['query']);_0x2df75a[_0x9fb3('0x31')]=_[_0x9fb3('0x32')](_0x2531e6[_0x9fb3('0x2d')],qs['fields'](_0x6b414[_0x9fb3('0x2f')][_0x9fb3('0x33')]));_0x2df75a[_0x9fb3('0x31')]=_0x2df75a[_0x9fb3('0x31')][_0x9fb3('0x34')]?_0x2df75a[_0x9fb3('0x31')]:_0x2531e6['model'];_0x2df75a['order']=qs[_0x9fb3('0x37')](_0x6b414[_0x9fb3('0x2f')][_0x9fb3('0x37')]);_0x2df75a[_0x9fb3('0x38')]=qs[_0x9fb3('0x30')](_[_0x9fb3('0x49')](_0x6b414[_0x9fb3('0x2f')],_0x2531e6[_0x9fb3('0x30')]));if(_0x6b414['query']['filter']){_0x2df75a[_0x9fb3('0x38')]=_[_0x9fb3('0x3a')](_0x2df75a[_0x9fb3('0x38')],{'$or':_[_0x9fb3('0x28')](_0x2df75a[_0x9fb3('0x31')],function(_0x22beae){var _0x53f5fe={};_0x53f5fe[_0x22beae]={'$like':'%'+_0x6b414[_0x9fb3('0x2f')]['filter']+'%'};return _0x53f5fe;})});}_0x2df75a=_[_0x9fb3('0x3a')]({},_0x2df75a,_0x6b414[_0x9fb3('0x3c')]);return _0x1b94e7[_0x9fb3('0x4a')](_0x2df75a);}})[_0x9fb3('0x22')](function(_0x1a0d33){if(_0x1a0d33){_0x10934f=_0x1a0d33[_0x9fb3('0x34')];if(!_0x6b414[_0x9fb3('0x2f')][_0x9fb3('0x35')](_0x9fb3('0x4b'))){_0x2df75a['limit']=qs['limit'](_0x6b414[_0x9fb3('0x2f')][_0x9fb3('0x1c')]);_0x2df75a[_0x9fb3('0x1a')]=qs[_0x9fb3('0x1a')](_0x6b414['query'][_0x9fb3('0x1a')]);}return _0x1b94e7[_0x9fb3('0x4a')](_0x2df75a);}})[_0x9fb3('0x22')](function(_0x1cc1e3){if(_0x1cc1e3){return _0x1cc1e3?{'count':_0x10934f,'rows':_0x1cc1e3}:null;}})[_0x9fb3('0x22')](respondWithResult(_0x3bcc18,null))[_0x9fb3('0x40')](handleError(_0x3bcc18,null));};exports[_0x9fb3('0x4c')]=function(_0x260643,_0x3bfa54,_0x4ac275){var _0x536e86={};var _0x465451={};var _0x3aca69;var _0x381ae7;return db[_0x9fb3('0x29')][_0x9fb3('0x47')]({'where':{'id':_0x260643['params']['id']}})[_0x9fb3('0x22')](handleEntityNotFound(_0x3bfa54,null))['then'](function(_0x431132){if(_0x431132){_0x3aca69=_0x431132;_0x465451[_0x9fb3('0x2d')]=_[_0x9fb3('0x2e')](db[_0x9fb3('0x48')][_0x9fb3('0x2a')]);_0x465451[_0x9fb3('0x2f')]=_[_0x9fb3('0x2e')](_0x260643[_0x9fb3('0x2f')]);_0x465451[_0x9fb3('0x30')]=_[_0x9fb3('0x32')](_0x465451[_0x9fb3('0x2d')],_0x465451[_0x9fb3('0x2f')]);_0x536e86['attributes']=_['intersection'](_0x465451[_0x9fb3('0x2d')],qs[_0x9fb3('0x33')](_0x260643[_0x9fb3('0x2f')]['fields']));_0x536e86[_0x9fb3('0x31')]=_0x536e86[_0x9fb3('0x31')][_0x9fb3('0x34')]?_0x536e86[_0x9fb3('0x31')]:_0x465451[_0x9fb3('0x2d')];_0x536e86['order']=qs[_0x9fb3('0x37')](_0x260643['query'][_0x9fb3('0x37')]);_0x536e86[_0x9fb3('0x38')]=qs['filters'](_[_0x9fb3('0x49')](_0x260643[_0x9fb3('0x2f')],_0x465451['filters']));if(_0x260643[_0x9fb3('0x2f')][_0x9fb3('0x39')]){_0x536e86[_0x9fb3('0x38')]=_[_0x9fb3('0x3a')](_0x536e86['where'],{'$or':_[_0x9fb3('0x28')](_0x536e86[_0x9fb3('0x31')],function(_0x3494c7){var _0x28aac7={};_0x28aac7[_0x3494c7]={'$like':'%'+_0x260643[_0x9fb3('0x2f')][_0x9fb3('0x39')]+'%'};return _0x28aac7;})});}_0x536e86=_['merge']({},_0x536e86,_0x260643[_0x9fb3('0x3c')]);return _0x3aca69[_0x9fb3('0x4c')](_0x536e86);}})[_0x9fb3('0x22')](function(_0x48cdb5){if(_0x48cdb5){_0x381ae7=_0x48cdb5[_0x9fb3('0x34')];if(!_0x260643['query']['hasOwnProperty'](_0x9fb3('0x4b'))){_0x536e86['limit']=qs[_0x9fb3('0x1c')](_0x260643[_0x9fb3('0x2f')]['limit']);_0x536e86[_0x9fb3('0x1a')]=qs[_0x9fb3('0x1a')](_0x260643['query'][_0x9fb3('0x1a')]);}return _0x3aca69[_0x9fb3('0x4c')](_0x536e86);}})['then'](function(_0x1ce350){if(_0x1ce350){return _0x1ce350?{'count':_0x381ae7,'rows':_0x1ce350}:null;}})[_0x9fb3('0x22')](respondWithResult(_0x3bfa54,null))[_0x9fb3('0x40')](handleError(_0x3bfa54,null));};exports['getDescriptions']=function(_0x3600ff,_0x52609a,_0x46a55d){var _0x3aa0cf={};var _0x82eb54={};var _0x382855;var _0x28009b;return db[_0x9fb3('0x29')][_0x9fb3('0x47')]({'where':{'id':_0x3600ff[_0x9fb3('0x42')]['id']}})['then'](handleEntityNotFound(_0x52609a,null))[_0x9fb3('0x22')](function(_0x38ea91){if(_0x38ea91){_0x382855=_0x38ea91;_0x82eb54['model']=_[_0x9fb3('0x2e')](db[_0x9fb3('0x48')][_0x9fb3('0x2a')]);_0x82eb54[_0x9fb3('0x2f')]=_[_0x9fb3('0x2e')](_0x3600ff[_0x9fb3('0x2f')]);_0x82eb54[_0x9fb3('0x30')]=_[_0x9fb3('0x32')](_0x82eb54['model'],_0x82eb54[_0x9fb3('0x2f')]);_0x3aa0cf[_0x9fb3('0x31')]=_[_0x9fb3('0x32')](_0x82eb54[_0x9fb3('0x2d')],qs[_0x9fb3('0x33')](_0x3600ff['query'][_0x9fb3('0x33')]));_0x3aa0cf['attributes']=_0x3aa0cf[_0x9fb3('0x31')][_0x9fb3('0x34')]?_0x3aa0cf['attributes']:_0x82eb54[_0x9fb3('0x2d')];_0x3aa0cf[_0x9fb3('0x36')]=qs['sort'](_0x3600ff[_0x9fb3('0x2f')]['sort']);_0x3aa0cf[_0x9fb3('0x38')]=qs[_0x9fb3('0x30')](_[_0x9fb3('0x49')](_0x3600ff[_0x9fb3('0x2f')],_0x82eb54[_0x9fb3('0x30')]));if(_0x3600ff['query'][_0x9fb3('0x39')]){_0x3aa0cf['where']=_[_0x9fb3('0x3a')](_0x3aa0cf[_0x9fb3('0x38')],{'$or':_[_0x9fb3('0x28')](_0x3aa0cf[_0x9fb3('0x31')],function(_0x544416){var _0x30a847={};_0x30a847[_0x544416]={'$like':'%'+_0x3600ff['query']['filter']+'%'};return _0x30a847;})});}_0x3aa0cf=_[_0x9fb3('0x3a')]({},_0x3aa0cf,_0x3600ff[_0x9fb3('0x3c')]);return _0x382855[_0x9fb3('0x4d')](_0x3aa0cf);}})[_0x9fb3('0x22')](function(_0x4408cf){if(_0x4408cf){_0x28009b=_0x4408cf[_0x9fb3('0x34')];if(!_0x3600ff[_0x9fb3('0x2f')]['hasOwnProperty']('nolimit')){_0x3aa0cf[_0x9fb3('0x1c')]=qs[_0x9fb3('0x1c')](_0x3600ff[_0x9fb3('0x2f')][_0x9fb3('0x1c')]);_0x3aa0cf['offset']=qs['offset'](_0x3600ff[_0x9fb3('0x2f')][_0x9fb3('0x1a')]);}return _0x382855[_0x9fb3('0x4d')](_0x3aa0cf);}})[_0x9fb3('0x22')](function(_0x3f3e16){if(_0x3f3e16){return _0x3f3e16?{'count':_0x28009b,'rows':_0x3f3e16}:null;}})[_0x9fb3('0x22')](respondWithResult(_0x52609a,null))[_0x9fb3('0x40')](handleError(_0x52609a,null));}; \ No newline at end of file +var _0x9799=['papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SugarcrmConfiguration','rows','catch','keys','length','includeAll','find','create','body','update','params','destroy','SugarcrmField','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','crypto','desk.js','querystring'];(function(_0x321aaa,_0x3c80f9){var _0x29b276=function(_0x17a12a){while(--_0x17a12a){_0x321aaa['push'](_0x321aaa['shift']());}};_0x29b276(++_0x3c80f9);}(_0x9799,0xce));var _0x9979=function(_0x3e6c3e,_0x4a87a0){_0x3e6c3e=_0x3e6c3e-0x0;var _0x39028f=_0x9799[_0x3e6c3e];return _0x39028f;};'use strict';var emlformat=require(_0x9979('0x0'));var rimraf=require(_0x9979('0x1'));var zipdir=require(_0x9979('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9979('0x3'));var moment=require('moment');var BPromise=require(_0x9979('0x4'));var Mustache=require(_0x9979('0x5'));var util=require('util');var path=require(_0x9979('0x6'));var sox=require(_0x9979('0x7'));var csv=require(_0x9979('0x8'));var ejs=require(_0x9979('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9979('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9979('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9979('0xc'));var Papa=require(_0x9979('0xd'));var Redis=require('ioredis');var authService=require(_0x9979('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9979('0xf'))(_0x9979('0x10'));var utils=require(_0x9979('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x9979('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x235abe,_0x4e6e14){_0x4e6e14=_0x4e6e14||0xcc;return function(_0xd91b43){if(_0xd91b43){return _0x235abe[_0x9979('0x13')](_0x4e6e14);}return _0x235abe[_0x9979('0x14')](_0x4e6e14)[_0x9979('0x15')]();};}function respondWithResult(_0x3d4db4,_0x395f5e){_0x395f5e=_0x395f5e||0xc8;return function(_0x427795){if(_0x427795){return _0x3d4db4['status'](_0x395f5e)[_0x9979('0x16')](_0x427795);}};}function respondWithFilteredResult(_0x57cd58,_0x46b4e8){return function(_0x21d176){if(_0x21d176){var _0x57ae14=typeof _0x46b4e8[_0x9979('0x17')]===_0x9979('0x18')&&typeof _0x46b4e8['limit']===_0x9979('0x18');var _0x5971d3=_0x21d176[_0x9979('0x19')];var _0x3a5473=_0x57ae14?0x0:_0x46b4e8[_0x9979('0x17')];var _0x2e655b=_0x57ae14?_0x21d176[_0x9979('0x19')]:_0x46b4e8[_0x9979('0x17')]+_0x46b4e8[_0x9979('0x1a')];var _0xa538ac;if(_0x2e655b>=_0x5971d3){_0x2e655b=_0x5971d3;_0xa538ac=0xc8;}else{_0xa538ac=0xce;}_0x57cd58[_0x9979('0x14')](_0xa538ac);return _0x57cd58[_0x9979('0x1b')](_0x9979('0x1c'),_0x3a5473+'-'+_0x2e655b+'/'+_0x5971d3)[_0x9979('0x16')](_0x21d176);}return null;};}function patchUpdates(_0x17d679){return function(_0x58d9d3){try{jsonpatch[_0x9979('0x1d')](_0x58d9d3,_0x17d679,!![]);}catch(_0x49f88f){return BPromise['reject'](_0x49f88f);}return _0x58d9d3[_0x9979('0x1e')]();};}function saveUpdates(_0x9e9b32,_0x2cbfa2){return function(_0x3aa6bb){if(_0x3aa6bb){return _0x3aa6bb['update'](_0x9e9b32)[_0x9979('0x1f')](function(_0xfa3215){return _0xfa3215;});}return null;};}function removeEntity(_0x5748ef,_0x200f5c){return function(_0x5b553f){if(_0x5b553f){return _0x5b553f['destroy']()['then'](function(){_0x5748ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ed6d,_0x544abc){return function(_0x591552){if(!_0x591552){_0x41ed6d['sendStatus'](0x194);}return _0x591552;};}function handleError(_0x39fa73,_0x12b549){_0x12b549=_0x12b549||0x1f4;return function(_0x4871bc){logger[_0x9979('0x20')](_0x4871bc[_0x9979('0x21')]);if(_0x4871bc[_0x9979('0x22')]){delete _0x4871bc[_0x9979('0x22')];}_0x39fa73['status'](_0x12b549)[_0x9979('0x23')](_0x4871bc);};}exports['index']=function(_0x494931,_0x25f93a){var _0x5d4275={},_0x284a16={},_0x598693={'count':0x0,'rows':[]};var _0x129b60=_[_0x9979('0x24')](db['SugarcrmConfiguration'][_0x9979('0x25')],function(_0x5a104e){return{'name':_0x5a104e[_0x9979('0x26')],'type':_0x5a104e[_0x9979('0x27')]['key']};});_0x284a16['model']=_['map'](_0x129b60,_0x9979('0x22'));_0x284a16[_0x9979('0x28')]=_['keys'](_0x494931[_0x9979('0x28')]);_0x284a16[_0x9979('0x29')]=_[_0x9979('0x2a')](_0x284a16[_0x9979('0x2b')],_0x284a16[_0x9979('0x28')]);_0x5d4275[_0x9979('0x2c')]=_[_0x9979('0x2a')](_0x284a16['model'],qs[_0x9979('0x2d')](_0x494931[_0x9979('0x28')][_0x9979('0x2d')]));_0x5d4275[_0x9979('0x2c')]=_0x5d4275[_0x9979('0x2c')]['length']?_0x5d4275[_0x9979('0x2c')]:_0x284a16['model'];if(!_0x494931[_0x9979('0x28')][_0x9979('0x2e')](_0x9979('0x2f'))){_0x5d4275[_0x9979('0x1a')]=qs[_0x9979('0x1a')](_0x494931['query'][_0x9979('0x1a')]);_0x5d4275[_0x9979('0x17')]=qs[_0x9979('0x17')](_0x494931[_0x9979('0x28')][_0x9979('0x17')]);}_0x5d4275[_0x9979('0x30')]=qs['sort'](_0x494931[_0x9979('0x28')][_0x9979('0x31')]);_0x5d4275[_0x9979('0x32')]=qs[_0x9979('0x29')](_[_0x9979('0x33')](_0x494931['query'],_0x284a16[_0x9979('0x29')]),_0x129b60);if(_0x494931['query'][_0x9979('0x34')]){_0x5d4275[_0x9979('0x32')]=_['merge'](_0x5d4275[_0x9979('0x32')],{'$or':_[_0x9979('0x24')](_0x129b60,function(_0x1bc693){if(_0x1bc693['type']!==_0x9979('0x35')){var _0x291e13={};_0x291e13[_0x1bc693['name']]={'$like':'%'+_0x494931[_0x9979('0x28')][_0x9979('0x34')]+'%'};return _0x291e13;}})});}_0x5d4275=_[_0x9979('0x36')]({},_0x5d4275,_0x494931[_0x9979('0x37')]);var _0x4fb608={'where':_0x5d4275['where']};return db[_0x9979('0x38')]['count'](_0x4fb608)[_0x9979('0x1f')](function(_0x129ab0){_0x598693[_0x9979('0x19')]=_0x129ab0;if(_0x494931[_0x9979('0x28')]['includeAll']){_0x5d4275['include']=[{'all':!![]}];}return db[_0x9979('0x38')]['findAll'](_0x5d4275);})[_0x9979('0x1f')](function(_0x27e4e9){_0x598693[_0x9979('0x39')]=_0x27e4e9;return _0x598693;})['then'](respondWithFilteredResult(_0x25f93a,_0x5d4275))[_0x9979('0x3a')](handleError(_0x25f93a,null));};exports['show']=function(_0x54f025,_0x52449f){var _0x3d6831={'raw':![],'where':{'id':_0x54f025['params']['id']}},_0x55fcdb={};_0x55fcdb[_0x9979('0x2b')]=_[_0x9979('0x3b')](db[_0x9979('0x38')][_0x9979('0x25')]);_0x55fcdb[_0x9979('0x28')]=_[_0x9979('0x3b')](_0x54f025[_0x9979('0x28')]);_0x55fcdb['filters']=_[_0x9979('0x2a')](_0x55fcdb[_0x9979('0x2b')],_0x55fcdb[_0x9979('0x28')]);_0x3d6831[_0x9979('0x2c')]=_[_0x9979('0x2a')](_0x55fcdb[_0x9979('0x2b')],qs[_0x9979('0x2d')](_0x54f025[_0x9979('0x28')][_0x9979('0x2d')]));_0x3d6831['attributes']=_0x3d6831[_0x9979('0x2c')][_0x9979('0x3c')]?_0x3d6831[_0x9979('0x2c')]:_0x55fcdb[_0x9979('0x2b')];if(_0x54f025[_0x9979('0x28')][_0x9979('0x3d')]){_0x3d6831['include']=[{'all':!![]}];}_0x3d6831=_[_0x9979('0x36')]({},_0x3d6831,_0x54f025['options']);return db[_0x9979('0x38')][_0x9979('0x3e')](_0x3d6831)[_0x9979('0x1f')](handleEntityNotFound(_0x52449f,null))[_0x9979('0x1f')](respondWithResult(_0x52449f,null))['catch'](handleError(_0x52449f,null));};exports[_0x9979('0x3f')]=function(_0x45695a,_0x520fc8){return db['SugarcrmConfiguration']['create'](_0x45695a[_0x9979('0x40')],{})['then'](respondWithResult(_0x520fc8,0xc9))['catch'](handleError(_0x520fc8,null));};exports[_0x9979('0x41')]=function(_0x5b82de,_0x5cd949){if(_0x5b82de[_0x9979('0x40')]['id']){delete _0x5b82de[_0x9979('0x40')]['id'];}return db['SugarcrmConfiguration'][_0x9979('0x3e')]({'where':{'id':_0x5b82de[_0x9979('0x42')]['id']}})[_0x9979('0x1f')](handleEntityNotFound(_0x5cd949,null))['then'](saveUpdates(_0x5b82de['body'],null))[_0x9979('0x1f')](respondWithResult(_0x5cd949,null))[_0x9979('0x3a')](handleError(_0x5cd949,null));};exports[_0x9979('0x43')]=function(_0x1b27af,_0x9729d5){return db['SugarcrmConfiguration'][_0x9979('0x3e')]({'where':{'id':_0x1b27af[_0x9979('0x42')]['id']}})['then'](handleEntityNotFound(_0x9729d5,null))['then'](removeEntity(_0x9729d5,null))[_0x9979('0x3a')](handleError(_0x9729d5,null));};exports['getFields']=function(_0x524eac,_0x1e891,_0x8d4cc1){var _0x2f8092={};var _0x7653cc={};var _0x5b18d6;var _0x5b9d01;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x524eac[_0x9979('0x42')]['id']}})[_0x9979('0x1f')](handleEntityNotFound(_0x1e891,null))['then'](function(_0x5bc242){if(_0x5bc242){_0x5b18d6=_0x5bc242;_0x7653cc['model']=_[_0x9979('0x3b')](db[_0x9979('0x44')]['rawAttributes']);_0x7653cc['query']=_['keys'](_0x524eac[_0x9979('0x28')]);_0x7653cc[_0x9979('0x29')]=_['intersection'](_0x7653cc[_0x9979('0x2b')],_0x7653cc['query']);_0x2f8092['attributes']=_['intersection'](_0x7653cc[_0x9979('0x2b')],qs[_0x9979('0x2d')](_0x524eac['query']['fields']));_0x2f8092['attributes']=_0x2f8092[_0x9979('0x2c')]['length']?_0x2f8092[_0x9979('0x2c')]:_0x7653cc[_0x9979('0x2b')];_0x2f8092[_0x9979('0x30')]=qs[_0x9979('0x31')](_0x524eac[_0x9979('0x28')][_0x9979('0x31')]);_0x2f8092[_0x9979('0x32')]=qs['filters'](_[_0x9979('0x33')](_0x524eac[_0x9979('0x28')],_0x7653cc[_0x9979('0x29')]));if(_0x524eac['query']['filter']){_0x2f8092[_0x9979('0x32')]=_[_0x9979('0x36')](_0x2f8092['where'],{'$or':_[_0x9979('0x24')](_0x2f8092[_0x9979('0x2c')],function(_0x2052ff){var _0x4ffe0d={};_0x4ffe0d[_0x2052ff]={'$like':'%'+_0x524eac[_0x9979('0x28')][_0x9979('0x34')]+'%'};return _0x4ffe0d;})});}_0x2f8092=_[_0x9979('0x36')]({},_0x2f8092,_0x524eac['options']);return _0x5b18d6[_0x9979('0x45')](_0x2f8092);}})['then'](function(_0x2d67d6){if(_0x2d67d6){_0x5b9d01=_0x2d67d6[_0x9979('0x3c')];if(!_0x524eac['query'][_0x9979('0x2e')]('nolimit')){_0x2f8092['limit']=qs[_0x9979('0x1a')](_0x524eac[_0x9979('0x28')][_0x9979('0x1a')]);_0x2f8092[_0x9979('0x17')]=qs[_0x9979('0x17')](_0x524eac[_0x9979('0x28')]['offset']);}return _0x5b18d6['getFields'](_0x2f8092);}})['then'](function(_0x3d58b3){if(_0x3d58b3){return _0x3d58b3?{'count':_0x5b9d01,'rows':_0x3d58b3}:null;}})[_0x9979('0x1f')](respondWithResult(_0x1e891,null))[_0x9979('0x3a')](handleError(_0x1e891,null));};exports[_0x9979('0x46')]=function(_0x54845b,_0x3f5c07,_0x1244e6){var _0x982a1a={};var _0x5d1010={};var _0x2cc0ce;var _0x35827f;return db[_0x9979('0x38')][_0x9979('0x47')]({'where':{'id':_0x54845b[_0x9979('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f5c07,null))[_0x9979('0x1f')](function(_0x25ed84){if(_0x25ed84){_0x2cc0ce=_0x25ed84;_0x5d1010[_0x9979('0x2b')]=_[_0x9979('0x3b')](db[_0x9979('0x44')][_0x9979('0x25')]);_0x5d1010['query']=_[_0x9979('0x3b')](_0x54845b[_0x9979('0x28')]);_0x5d1010[_0x9979('0x29')]=_['intersection'](_0x5d1010['model'],_0x5d1010[_0x9979('0x28')]);_0x982a1a[_0x9979('0x2c')]=_[_0x9979('0x2a')](_0x5d1010[_0x9979('0x2b')],qs[_0x9979('0x2d')](_0x54845b[_0x9979('0x28')][_0x9979('0x2d')]));_0x982a1a[_0x9979('0x2c')]=_0x982a1a[_0x9979('0x2c')][_0x9979('0x3c')]?_0x982a1a[_0x9979('0x2c')]:_0x5d1010['model'];_0x982a1a[_0x9979('0x30')]=qs['sort'](_0x54845b[_0x9979('0x28')]['sort']);_0x982a1a[_0x9979('0x32')]=qs[_0x9979('0x29')](_[_0x9979('0x33')](_0x54845b[_0x9979('0x28')],_0x5d1010[_0x9979('0x29')]));if(_0x54845b[_0x9979('0x28')][_0x9979('0x34')]){_0x982a1a[_0x9979('0x32')]=_['merge'](_0x982a1a[_0x9979('0x32')],{'$or':_[_0x9979('0x24')](_0x982a1a[_0x9979('0x2c')],function(_0x20376a){var _0x4ca53c={};_0x4ca53c[_0x20376a]={'$like':'%'+_0x54845b['query'][_0x9979('0x34')]+'%'};return _0x4ca53c;})});}_0x982a1a=_[_0x9979('0x36')]({},_0x982a1a,_0x54845b[_0x9979('0x37')]);return _0x2cc0ce['getSubjects'](_0x982a1a);}})[_0x9979('0x1f')](function(_0x5d0473){if(_0x5d0473){_0x35827f=_0x5d0473['length'];if(!_0x54845b[_0x9979('0x28')][_0x9979('0x2e')](_0x9979('0x2f'))){_0x982a1a[_0x9979('0x1a')]=qs[_0x9979('0x1a')](_0x54845b[_0x9979('0x28')]['limit']);_0x982a1a[_0x9979('0x17')]=qs[_0x9979('0x17')](_0x54845b[_0x9979('0x28')][_0x9979('0x17')]);}return _0x2cc0ce[_0x9979('0x46')](_0x982a1a);}})[_0x9979('0x1f')](function(_0x30fc70){if(_0x30fc70){return _0x30fc70?{'count':_0x35827f,'rows':_0x30fc70}:null;}})[_0x9979('0x1f')](respondWithResult(_0x3f5c07,null))[_0x9979('0x3a')](handleError(_0x3f5c07,null));};exports[_0x9979('0x48')]=function(_0x91a901,_0x240235,_0x15fc14){var _0xee09b8={};var _0x2d1ce7={};var _0x1e2b04;var _0x29c234;return db[_0x9979('0x38')][_0x9979('0x47')]({'where':{'id':_0x91a901[_0x9979('0x42')]['id']}})[_0x9979('0x1f')](handleEntityNotFound(_0x240235,null))[_0x9979('0x1f')](function(_0x25a3be){if(_0x25a3be){_0x1e2b04=_0x25a3be;_0x2d1ce7[_0x9979('0x2b')]=_[_0x9979('0x3b')](db[_0x9979('0x44')][_0x9979('0x25')]);_0x2d1ce7[_0x9979('0x28')]=_[_0x9979('0x3b')](_0x91a901[_0x9979('0x28')]);_0x2d1ce7[_0x9979('0x29')]=_[_0x9979('0x2a')](_0x2d1ce7['model'],_0x2d1ce7[_0x9979('0x28')]);_0xee09b8[_0x9979('0x2c')]=_[_0x9979('0x2a')](_0x2d1ce7[_0x9979('0x2b')],qs[_0x9979('0x2d')](_0x91a901[_0x9979('0x28')]['fields']));_0xee09b8[_0x9979('0x2c')]=_0xee09b8[_0x9979('0x2c')][_0x9979('0x3c')]?_0xee09b8['attributes']:_0x2d1ce7[_0x9979('0x2b')];_0xee09b8['order']=qs[_0x9979('0x31')](_0x91a901[_0x9979('0x28')][_0x9979('0x31')]);_0xee09b8[_0x9979('0x32')]=qs['filters'](_[_0x9979('0x33')](_0x91a901[_0x9979('0x28')],_0x2d1ce7['filters']));if(_0x91a901[_0x9979('0x28')]['filter']){_0xee09b8[_0x9979('0x32')]=_['merge'](_0xee09b8[_0x9979('0x32')],{'$or':_[_0x9979('0x24')](_0xee09b8[_0x9979('0x2c')],function(_0x59f65e){var _0x34b4f9={};_0x34b4f9[_0x59f65e]={'$like':'%'+_0x91a901['query'][_0x9979('0x34')]+'%'};return _0x34b4f9;})});}_0xee09b8=_['merge']({},_0xee09b8,_0x91a901[_0x9979('0x37')]);return _0x1e2b04['getDescriptions'](_0xee09b8);}})[_0x9979('0x1f')](function(_0x273932){if(_0x273932){_0x29c234=_0x273932[_0x9979('0x3c')];if(!_0x91a901[_0x9979('0x28')]['hasOwnProperty'](_0x9979('0x2f'))){_0xee09b8['limit']=qs[_0x9979('0x1a')](_0x91a901['query']['limit']);_0xee09b8[_0x9979('0x17')]=qs[_0x9979('0x17')](_0x91a901[_0x9979('0x28')][_0x9979('0x17')]);}return _0x1e2b04[_0x9979('0x48')](_0xee09b8);}})[_0x9979('0x1f')](function(_0x1c3aee){if(_0x1c3aee){return _0x1c3aee?{'count':_0x29c234,'rows':_0x1c3aee}:null;}})[_0x9979('0x1f')](respondWithResult(_0x240235,null))['catch'](handleError(_0x240235,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e9e73fa..b25e454 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 _0x0c0b=['SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1c3f0f,_0xfd81d3){var _0x3f452a=function(_0x53e9d1){while(--_0x53e9d1){_0x1c3f0f['push'](_0x1c3f0f['shift']());}};_0x3f452a(++_0xfd81d3);}(_0x0c0b,0x16d));var _0xb0c0=function(_0x2276e0,_0x2f68db){_0x2276e0=_0x2276e0-0x0;var _0x1cec49=_0x0c0b[_0x2276e0];return _0x1cec49;};'use strict';var _=require(_0xb0c0('0x0'));var util=require(_0xb0c0('0x1'));var logger=require(_0xb0c0('0x2'))(_0xb0c0('0x3'));var moment=require(_0xb0c0('0x4'));var BPromise=require(_0xb0c0('0x5'));var rp=require(_0xb0c0('0x6'));var fs=require('fs');var path=require(_0xb0c0('0x7'));var rimraf=require(_0xb0c0('0x8'));var config=require(_0xb0c0('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xb0c0('0xa')]=function(_0xbb5302,_0x5e41de){return _0xbb5302[_0xb0c0('0xb')](_0xb0c0('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9c7=['SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x229f8a,_0x92db14){var _0x2f7967=function(_0x37ac1b){while(--_0x37ac1b){_0x229f8a['push'](_0x229f8a['shift']());}};_0x2f7967(++_0x92db14);}(_0xd9c7,0x137));var _0x7d9c=function(_0x550412,_0x310c50){_0x550412=_0x550412-0x0;var _0x5003b1=_0xd9c7[_0x550412];return _0x5003b1;};'use strict';var _=require(_0x7d9c('0x0'));var util=require(_0x7d9c('0x1'));var logger=require(_0x7d9c('0x2'))(_0x7d9c('0x3'));var moment=require(_0x7d9c('0x4'));var BPromise=require(_0x7d9c('0x5'));var rp=require(_0x7d9c('0x6'));var fs=require('fs');var path=require(_0x7d9c('0x7'));var rimraf=require('rimraf');var config=require(_0x7d9c('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x3c4908,_0x1303b5){return _0x3c4908['define'](_0x7d9c('0x9'),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 eddfa37..519cc99 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 _0x918e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4e09fb,_0x3708ce){var _0x2f783c=function(_0x1dbf13){while(--_0x1dbf13){_0x4e09fb['push'](_0x4e09fb['shift']());}};_0x2f783c(++_0x3708ce);}(_0x918e,0x10c));var _0xe918=function(_0xb9df17,_0x45e3ca){_0xb9df17=_0xb9df17-0x0;var _0x56dca2=_0x918e[_0xb9df17];return _0x56dca2;};'use strict';var _=require(_0xe918('0x0'));var util=require(_0xe918('0x1'));var moment=require(_0xe918('0x2'));var BPromise=require('bluebird');var rs=require(_0xe918('0x3'));var fs=require('fs');var Redis=require(_0xe918('0x4'));var db=require(_0xe918('0x5'))['db'];var utils=require(_0xe918('0x6'));var logger=require(_0xe918('0x7'))(_0xe918('0x8'));var config=require(_0xe918('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe918('0xa')][_0xe918('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ebd92,_0x3b24b7,_0x11a929){return new BPromise(function(_0x35966a,_0x3eb496){return client['request'](_0x1ebd92,_0x11a929)[_0xe918('0xc')](function(_0xb0b6a4){logger[_0xe918('0xd')](_0xe918('0xe'),_0x3b24b7,_0xe918('0xf'));logger['debug'](_0xe918('0x10'),_0x3b24b7,_0xe918('0xf'),JSON['stringify'](_0xb0b6a4));if(_0xb0b6a4['error']){if(_0xb0b6a4[_0xe918('0x11')][_0xe918('0x12')]===0x1f4){logger[_0xe918('0x11')](_0xe918('0xe'),_0x3b24b7,_0xb0b6a4[_0xe918('0x11')][_0xe918('0x13')]);return _0x3eb496(_0xb0b6a4[_0xe918('0x11')][_0xe918('0x13')]);}logger[_0xe918('0x11')](_0xe918('0xe'),_0x3b24b7,_0xb0b6a4[_0xe918('0x11')][_0xe918('0x13')]);return _0x35966a(_0xb0b6a4[_0xe918('0x11')][_0xe918('0x13')]);}else{logger['info'](_0xe918('0xe'),_0x3b24b7,_0xe918('0xf'));_0x35966a(_0xb0b6a4['result'][_0xe918('0x13')]);}})[_0xe918('0x14')](function(_0x24ab72){logger[_0xe918('0x11')](_0xe918('0xe'),_0x3b24b7,_0x24ab72);_0x3eb496(_0x24ab72);});});} \ No newline at end of file +var _0xc3e4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','randomstring','ioredis'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xc3e4,0x1ca));var _0x4c3e=function(_0x5d2ff4,_0x1205e7){_0x5d2ff4=_0x5d2ff4-0x0;var _0x28f3d4=_0xc3e4[_0x5d2ff4];return _0x28f3d4;};'use strict';var _=require(_0x4c3e('0x0'));var util=require(_0x4c3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c3e('0x2'));var fs=require('fs');var Redis=require(_0x4c3e('0x3'));var db=require(_0x4c3e('0x4'))['db'];var utils=require(_0x4c3e('0x5'));var logger=require(_0x4c3e('0x6'))(_0x4c3e('0x7'));var config=require(_0x4c3e('0x8'));var jayson=require(_0x4c3e('0x9'));var client=jayson['client'][_0x4c3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbcc420,_0x38570c,_0x595aec){return new BPromise(function(_0x4d590b,_0xf63d5e){return client[_0x4c3e('0xb')](_0xbcc420,_0x595aec)[_0x4c3e('0xc')](function(_0x4ce6eb){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x38570c,'request\x20sent');logger[_0x4c3e('0xd')](_0x4c3e('0xe'),_0x38570c,'request\x20sent',JSON[_0x4c3e('0xf')](_0x4ce6eb));if(_0x4ce6eb[_0x4c3e('0x10')]){if(_0x4ce6eb[_0x4c3e('0x10')][_0x4c3e('0x11')]===0x1f4){logger[_0x4c3e('0x10')](_0x4c3e('0x12'),_0x38570c,_0x4ce6eb[_0x4c3e('0x10')][_0x4c3e('0x13')]);return _0xf63d5e(_0x4ce6eb[_0x4c3e('0x10')][_0x4c3e('0x13')]);}logger[_0x4c3e('0x10')](_0x4c3e('0x12'),_0x38570c,_0x4ce6eb[_0x4c3e('0x10')]['message']);return _0x4d590b(_0x4ce6eb[_0x4c3e('0x10')][_0x4c3e('0x13')]);}else{logger[_0x4c3e('0x14')](_0x4c3e('0x12'),_0x38570c,'request\x20sent');_0x4d590b(_0x4ce6eb['result']['message']);}})[_0x4c3e('0x15')](function(_0x381ae3){logger['error'](_0x4c3e('0x12'),_0x38570c,_0x381ae3);_0xf63d5e(_0x381ae3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5c3ecd1..83325e2 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 _0x2ce7=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x1d3e93,_0x3aa521){var _0x13cb04=function(_0x5bd634){while(--_0x5bd634){_0x1d3e93['push'](_0x1d3e93['shift']());}};_0x13cb04(++_0x3aa521);}(_0x2ce7,0x183));var _0x72ce=function(_0x3a5d36,_0x55970c){_0x3a5d36=_0x3a5d36-0x0;var _0x148820=_0x2ce7[_0x3a5d36];return _0x148820;};'use strict';var multer=require(_0x72ce('0x0'));var util=require(_0x72ce('0x1'));var path=require(_0x72ce('0x2'));var timeout=require(_0x72ce('0x3'));var express=require(_0x72ce('0x4'));var router=express[_0x72ce('0x5')]();var fs_extra=require(_0x72ce('0x6'));var auth=require(_0x72ce('0x7'));var interaction=require(_0x72ce('0x8'));var config=require(_0x72ce('0x9'));var controller=require('./intSugarcrmField.controller');router[_0x72ce('0xa')]('/',auth[_0x72ce('0xb')](),controller['index']);router[_0x72ce('0xa')](_0x72ce('0xc'),auth['isAuthenticated'](),controller[_0x72ce('0xd')]);router[_0x72ce('0xe')]('/',auth[_0x72ce('0xb')](),controller[_0x72ce('0xf')]);router[_0x72ce('0x10')](_0x72ce('0xc'),auth['isAuthenticated'](),controller[_0x72ce('0x11')]);router[_0x72ce('0x12')](_0x72ce('0xc'),auth[_0x72ce('0xb')](),controller['destroy']);module[_0x72ce('0x13')]=router; \ No newline at end of file +var _0x806d=['create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post'];(function(_0x287234,_0x4b9e28){var _0x4bfc27=function(_0x2089b5){while(--_0x2089b5){_0x287234['push'](_0x287234['shift']());}};_0x4bfc27(++_0x4b9e28);}(_0x806d,0x7e));var _0xd806=function(_0x204783,_0x111860){_0x204783=_0x204783-0x0;var _0x214eb1=_0x806d[_0x204783];return _0x214eb1;};'use strict';var multer=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var path=require(_0xd806('0x2'));var timeout=require(_0xd806('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd806('0x4'));var auth=require(_0xd806('0x5'));var interaction=require(_0xd806('0x6'));var config=require(_0xd806('0x7'));var controller=require(_0xd806('0x8'));router[_0xd806('0x9')]('/',auth[_0xd806('0xa')](),controller[_0xd806('0xb')]);router[_0xd806('0x9')]('/:id',auth[_0xd806('0xa')](),controller[_0xd806('0xc')]);router[_0xd806('0xd')]('/',auth['isAuthenticated'](),controller[_0xd806('0xe')]);router[_0xd806('0xf')](_0xd806('0x10'),auth[_0xd806('0xa')](),controller[_0xd806('0x11')]);router['delete'](_0xd806('0x10'),auth[_0xd806('0xa')](),controller[_0xd806('0x12')]);module[_0xd806('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 2167219..775c6e8 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 _0xc366=['picklist','STRING','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc366,0xea));var _0x6c36=function(_0x5849a7,_0x7495fc){_0x5849a7=_0x5849a7-0x0;var _0x1617a9=_0xc366[_0x5849a7];return _0x1617a9;};'use strict';var Sequelize=require('sequelize');module[_0x6c36('0x0')]={'type':{'type':Sequelize[_0x6c36('0x1')](_0x6c36('0x2'),_0x6c36('0x3'),_0x6c36('0x4'),_0x6c36('0x5'),_0x6c36('0x6')),'defaultValue':_0x6c36('0x2')},'content':{'type':Sequelize[_0x6c36('0x7')]},'key':{'type':Sequelize[_0x6c36('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x6c36('0x2'),'variable',_0x6c36('0x4'))},'keyContent':{'type':Sequelize[_0x6c36('0x7')]},'idField':{'type':Sequelize[_0x6c36('0x7')]},'nameField':{'type':Sequelize[_0x6c36('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c36('0x7')]}}; \ No newline at end of file +var _0xd6f9=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x5efb4a,_0x39b1ec){var _0x5f31a2=function(_0x2375a7){while(--_0x2375a7){_0x5efb4a['push'](_0x5efb4a['shift']());}};_0x5f31a2(++_0x39b1ec);}(_0xd6f9,0x1da));var _0x9d6f=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xd6f9[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x9d6f('0x0'));module[_0x9d6f('0x1')]={'type':{'type':Sequelize[_0x9d6f('0x2')](_0x9d6f('0x3'),_0x9d6f('0x4'),_0x9d6f('0x5'),_0x9d6f('0x6'),_0x9d6f('0x7')),'defaultValue':_0x9d6f('0x3')},'content':{'type':Sequelize[_0x9d6f('0x8')]},'key':{'type':Sequelize[_0x9d6f('0x8')]},'keyType':{'type':Sequelize[_0x9d6f('0x2')](_0x9d6f('0x3'),_0x9d6f('0x4'),_0x9d6f('0x5'))},'keyContent':{'type':Sequelize[_0x9d6f('0x8')]},'idField':{'type':Sequelize[_0x9d6f('0x8')]},'nameField':{'type':Sequelize[_0x9d6f('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d6f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 14102b6..a4abd4a 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 _0x823b=['index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','options','SugarcrmField','then','include','rows','params','includeAll','catch','create','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','save','update','destroy','sendStatus','stack','name','send'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0x823b,0x1c3));var _0xb823=function(_0x10be9e,_0x4769fb){_0x10be9e=_0x10be9e-0x0;var _0x30721f=_0x823b[_0x10be9e];return _0x30721f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb823('0x0'));var rp=require(_0xb823('0x1'));var moment=require(_0xb823('0x2'));var BPromise=require(_0xb823('0x3'));var Mustache=require(_0xb823('0x4'));var util=require('util');var path=require(_0xb823('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb823('0x6'));var fs=require('fs');var fs_extra=require(_0xb823('0x7'));var _=require(_0xb823('0x8'));var squel=require(_0xb823('0x9'));var crypto=require(_0xb823('0xa'));var jsforce=require(_0xb823('0xb'));var deskjs=require(_0xb823('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb823('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb823('0xe'));var qs=require(_0xb823('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb823('0x10'));var logger=require(_0xb823('0x11'))(_0xb823('0x12'));var utils=require(_0xb823('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb823('0x14'));var db=require(_0xb823('0x15'))['db'];function respondWithStatusCode(_0x1f2e3b,_0x183a0e){_0x183a0e=_0x183a0e||0xcc;return function(_0x5020e1){if(_0x5020e1){return _0x1f2e3b['sendStatus'](_0x183a0e);}return _0x1f2e3b[_0xb823('0x16')](_0x183a0e)[_0xb823('0x17')]();};}function respondWithResult(_0x575539,_0x3349a5){_0x3349a5=_0x3349a5||0xc8;return function(_0x281f7d){if(_0x281f7d){return _0x575539[_0xb823('0x16')](_0x3349a5)['json'](_0x281f7d);}};}function respondWithFilteredResult(_0x2ebe4c,_0x7a869){return function(_0x2ff803){if(_0x2ff803){var _0x5a6c66=typeof _0x7a869['offset']==='undefined'&&typeof _0x7a869[_0xb823('0x18')]===_0xb823('0x19');var _0x32fd57=_0x2ff803['count'];var _0x4ad07c=_0x5a6c66?0x0:_0x7a869[_0xb823('0x1a')];var _0x11340f=_0x5a6c66?_0x2ff803[_0xb823('0x1b')]:_0x7a869['offset']+_0x7a869[_0xb823('0x18')];var _0x1b23a1;if(_0x11340f>=_0x32fd57){_0x11340f=_0x32fd57;_0x1b23a1=0xc8;}else{_0x1b23a1=0xce;}_0x2ebe4c[_0xb823('0x16')](_0x1b23a1);return _0x2ebe4c[_0xb823('0x1c')](_0xb823('0x1d'),_0x4ad07c+'-'+_0x11340f+'/'+_0x32fd57)[_0xb823('0x1e')](_0x2ff803);}return null;};}function patchUpdates(_0xc62d88){return function(_0x351d14){try{jsonpatch[_0xb823('0x1f')](_0x351d14,_0xc62d88,!![]);}catch(_0x3d717c){return BPromise['reject'](_0x3d717c);}return _0x351d14[_0xb823('0x20')]();};}function saveUpdates(_0x1fa859,_0x41b418){return function(_0x5e3322){if(_0x5e3322){return _0x5e3322[_0xb823('0x21')](_0x1fa859)['then'](function(_0x400b8a){return _0x400b8a;});}return null;};}function removeEntity(_0x207907,_0x2faeca){return function(_0x5a4d3b){if(_0x5a4d3b){return _0x5a4d3b[_0xb823('0x22')]()['then'](function(){_0x207907[_0xb823('0x16')](0xcc)[_0xb823('0x17')]();});}};}function handleEntityNotFound(_0x6c243a,_0x4b85ca){return function(_0x5e07d5){if(!_0x5e07d5){_0x6c243a[_0xb823('0x23')](0x194);}return _0x5e07d5;};}function handleError(_0x168346,_0x4106f7){_0x4106f7=_0x4106f7||0x1f4;return function(_0x4d4b99){logger['error'](_0x4d4b99[_0xb823('0x24')]);if(_0x4d4b99[_0xb823('0x25')]){delete _0x4d4b99[_0xb823('0x25')];}_0x168346[_0xb823('0x16')](_0x4106f7)[_0xb823('0x26')](_0x4d4b99);};}exports[_0xb823('0x27')]=function(_0x9060fe,_0x590c85){var _0x54e46a={},_0x98ec4d={},_0x42da4b={'count':0x0,'rows':[]};var _0x594075=_[_0xb823('0x28')](db['SugarcrmField'][_0xb823('0x29')],function(_0x5611ad){return{'name':_0x5611ad[_0xb823('0x2a')],'type':_0x5611ad[_0xb823('0x2b')][_0xb823('0x2c')]};});_0x98ec4d['model']=_['map'](_0x594075,_0xb823('0x25'));_0x98ec4d[_0xb823('0x2d')]=_[_0xb823('0x2e')](_0x9060fe[_0xb823('0x2d')]);_0x98ec4d[_0xb823('0x2f')]=_[_0xb823('0x30')](_0x98ec4d[_0xb823('0x31')],_0x98ec4d[_0xb823('0x2d')]);_0x54e46a[_0xb823('0x32')]=_[_0xb823('0x30')](_0x98ec4d[_0xb823('0x31')],qs[_0xb823('0x33')](_0x9060fe[_0xb823('0x2d')]['fields']));_0x54e46a[_0xb823('0x32')]=_0x54e46a[_0xb823('0x32')][_0xb823('0x34')]?_0x54e46a[_0xb823('0x32')]:_0x98ec4d[_0xb823('0x31')];if(!_0x9060fe[_0xb823('0x2d')]['hasOwnProperty']('nolimit')){_0x54e46a[_0xb823('0x18')]=qs[_0xb823('0x18')](_0x9060fe['query'][_0xb823('0x18')]);_0x54e46a[_0xb823('0x1a')]=qs[_0xb823('0x1a')](_0x9060fe[_0xb823('0x2d')][_0xb823('0x1a')]);}_0x54e46a[_0xb823('0x35')]=qs[_0xb823('0x36')](_0x9060fe[_0xb823('0x2d')]['sort']);_0x54e46a['where']=qs[_0xb823('0x2f')](_[_0xb823('0x37')](_0x9060fe[_0xb823('0x2d')],_0x98ec4d[_0xb823('0x2f')]),_0x594075);if(_0x9060fe['query']['filter']){_0x54e46a[_0xb823('0x38')]=_[_0xb823('0x39')](_0x54e46a[_0xb823('0x38')],{'$or':_[_0xb823('0x28')](_0x594075,function(_0x2f385a){if(_0x2f385a['type']!==_0xb823('0x3a')){var _0x135b00={};_0x135b00[_0x2f385a[_0xb823('0x25')]]={'$like':'%'+_0x9060fe[_0xb823('0x2d')]['filter']+'%'};return _0x135b00;}})});}_0x54e46a=_[_0xb823('0x39')]({},_0x54e46a,_0x9060fe[_0xb823('0x3b')]);var _0x2778e9={'where':_0x54e46a[_0xb823('0x38')]};return db[_0xb823('0x3c')][_0xb823('0x1b')](_0x2778e9)[_0xb823('0x3d')](function(_0x3d83ef){_0x42da4b[_0xb823('0x1b')]=_0x3d83ef;if(_0x9060fe[_0xb823('0x2d')]['includeAll']){_0x54e46a[_0xb823('0x3e')]=[{'all':!![]}];}return db[_0xb823('0x3c')]['findAll'](_0x54e46a);})['then'](function(_0x37dc8d){_0x42da4b[_0xb823('0x3f')]=_0x37dc8d;return _0x42da4b;})['then'](respondWithFilteredResult(_0x590c85,_0x54e46a))['catch'](handleError(_0x590c85,null));};exports['show']=function(_0x391bee,_0x250218){var _0x9cf6a9={'raw':!![],'where':{'id':_0x391bee[_0xb823('0x40')]['id']}},_0x6b4fcd={};_0x6b4fcd[_0xb823('0x31')]=_[_0xb823('0x2e')](db[_0xb823('0x3c')][_0xb823('0x29')]);_0x6b4fcd[_0xb823('0x2d')]=_[_0xb823('0x2e')](_0x391bee[_0xb823('0x2d')]);_0x6b4fcd[_0xb823('0x2f')]=_[_0xb823('0x30')](_0x6b4fcd[_0xb823('0x31')],_0x6b4fcd[_0xb823('0x2d')]);_0x9cf6a9['attributes']=_[_0xb823('0x30')](_0x6b4fcd[_0xb823('0x31')],qs[_0xb823('0x33')](_0x391bee[_0xb823('0x2d')][_0xb823('0x33')]));_0x9cf6a9['attributes']=_0x9cf6a9[_0xb823('0x32')][_0xb823('0x34')]?_0x9cf6a9['attributes']:_0x6b4fcd[_0xb823('0x31')];if(_0x391bee[_0xb823('0x2d')][_0xb823('0x41')]){_0x9cf6a9[_0xb823('0x3e')]=[{'all':!![]}];}_0x9cf6a9=_[_0xb823('0x39')]({},_0x9cf6a9,_0x391bee[_0xb823('0x3b')]);return db[_0xb823('0x3c')]['find'](_0x9cf6a9)[_0xb823('0x3d')](handleEntityNotFound(_0x250218,null))['then'](respondWithResult(_0x250218,null))[_0xb823('0x42')](handleError(_0x250218,null));};exports[_0xb823('0x43')]=function(_0x3342c8,_0xa891c3){return db[_0xb823('0x3c')][_0xb823('0x43')](_0x3342c8['body'],{})[_0xb823('0x3d')](respondWithResult(_0xa891c3,0xc9))[_0xb823('0x42')](handleError(_0xa891c3,null));};exports[_0xb823('0x21')]=function(_0x4a543c,_0x16135f){if(_0x4a543c['body']['id']){delete _0x4a543c[_0xb823('0x44')]['id'];}return db[_0xb823('0x3c')]['find']({'where':{'id':_0x4a543c[_0xb823('0x40')]['id']}})[_0xb823('0x3d')](handleEntityNotFound(_0x16135f,null))[_0xb823('0x3d')](saveUpdates(_0x4a543c[_0xb823('0x44')],null))[_0xb823('0x3d')](respondWithResult(_0x16135f,null))[_0xb823('0x42')](handleError(_0x16135f,null));};exports['destroy']=function(_0x5b3088,_0x5a59e5){return db[_0xb823('0x3c')][_0xb823('0x45')]({'where':{'id':_0x5b3088['params']['id']}})[_0xb823('0x3d')](handleEntityNotFound(_0x5a59e5,null))['then'](removeEntity(_0x5a59e5,null))[_0xb823('0x42')](handleError(_0x5a59e5,null));}; \ No newline at end of file +var _0x9d83=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','key','query','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','options','SugarcrmField','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','include','find','create','body','rimraf','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/utils','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9d83,0x1c0));var _0x39d8=function(_0xd206ce,_0x3031d2){_0xd206ce=_0xd206ce-0x0;var _0x5b3ec6=_0x9d83[_0xd206ce];return _0x5b3ec6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39d8('0x1'));var rp=require(_0x39d8('0x2'));var moment=require(_0x39d8('0x3'));var BPromise=require(_0x39d8('0x4'));var Mustache=require(_0x39d8('0x5'));var util=require(_0x39d8('0x6'));var path=require(_0x39d8('0x7'));var sox=require(_0x39d8('0x8'));var csv=require(_0x39d8('0x9'));var ejs=require(_0x39d8('0xa'));var fs=require('fs');var fs_extra=require(_0x39d8('0xb'));var _=require(_0x39d8('0xc'));var squel=require(_0x39d8('0xd'));var crypto=require(_0x39d8('0xe'));var jsforce=require(_0x39d8('0xf'));var deskjs=require(_0x39d8('0x10'));var toCsv=require(_0x39d8('0x9'));var querystring=require(_0x39d8('0x11'));var Papa=require(_0x39d8('0x12'));var Redis=require(_0x39d8('0x13'));var authService=require(_0x39d8('0x14'));var qs=require(_0x39d8('0x15'));var as=require(_0x39d8('0x16'));var hardwareService=require(_0x39d8('0x17'));var logger=require(_0x39d8('0x18'))(_0x39d8('0x19'));var utils=require(_0x39d8('0x1a'));var config=require(_0x39d8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x39d8('0x1c'))['db'];function respondWithStatusCode(_0x53db24,_0x3db72f){_0x3db72f=_0x3db72f||0xcc;return function(_0x196e30){if(_0x196e30){return _0x53db24[_0x39d8('0x1d')](_0x3db72f);}return _0x53db24['status'](_0x3db72f)[_0x39d8('0x1e')]();};}function respondWithResult(_0x3eb76b,_0x58972f){_0x58972f=_0x58972f||0xc8;return function(_0x58e017){if(_0x58e017){return _0x3eb76b[_0x39d8('0x1f')](_0x58972f)[_0x39d8('0x20')](_0x58e017);}};}function respondWithFilteredResult(_0x226753,_0x2b0cf0){return function(_0x4345ee){if(_0x4345ee){var _0x14714b=typeof _0x2b0cf0['offset']===_0x39d8('0x21')&&typeof _0x2b0cf0[_0x39d8('0x22')]===_0x39d8('0x21');var _0x67ea65=_0x4345ee[_0x39d8('0x23')];var _0x3bcba8=_0x14714b?0x0:_0x2b0cf0[_0x39d8('0x24')];var _0x46f8a2=_0x14714b?_0x4345ee[_0x39d8('0x23')]:_0x2b0cf0[_0x39d8('0x24')]+_0x2b0cf0[_0x39d8('0x22')];var _0x20de5e;if(_0x46f8a2>=_0x67ea65){_0x46f8a2=_0x67ea65;_0x20de5e=0xc8;}else{_0x20de5e=0xce;}_0x226753[_0x39d8('0x1f')](_0x20de5e);return _0x226753[_0x39d8('0x25')](_0x39d8('0x26'),_0x3bcba8+'-'+_0x46f8a2+'/'+_0x67ea65)['json'](_0x4345ee);}return null;};}function patchUpdates(_0x52423e){return function(_0x3d1fe6){try{jsonpatch[_0x39d8('0x27')](_0x3d1fe6,_0x52423e,!![]);}catch(_0x19eaba){return BPromise[_0x39d8('0x28')](_0x19eaba);}return _0x3d1fe6[_0x39d8('0x29')]();};}function saveUpdates(_0x587d60,_0x532ddf){return function(_0x5266c8){if(_0x5266c8){return _0x5266c8[_0x39d8('0x2a')](_0x587d60)[_0x39d8('0x2b')](function(_0x294b6b){return _0x294b6b;});}return null;};}function removeEntity(_0x41cdf9,_0x5befca){return function(_0x1332da){if(_0x1332da){return _0x1332da[_0x39d8('0x2c')]()[_0x39d8('0x2b')](function(){_0x41cdf9['status'](0xcc)[_0x39d8('0x1e')]();});}};}function handleEntityNotFound(_0x1686b9,_0x18e5f2){return function(_0x558ac9){if(!_0x558ac9){_0x1686b9[_0x39d8('0x1d')](0x194);}return _0x558ac9;};}function handleError(_0x41908e,_0x5d6565){_0x5d6565=_0x5d6565||0x1f4;return function(_0x39e174){logger[_0x39d8('0x2d')](_0x39e174[_0x39d8('0x2e')]);if(_0x39e174[_0x39d8('0x2f')]){delete _0x39e174['name'];}_0x41908e[_0x39d8('0x1f')](_0x5d6565)['send'](_0x39e174);};}exports[_0x39d8('0x30')]=function(_0x33b323,_0x33c5a2){var _0x140da0={},_0x5e3285={},_0x472fc4={'count':0x0,'rows':[]};var _0x104df2=_[_0x39d8('0x31')](db['SugarcrmField']['rawAttributes'],function(_0x2f69cd){return{'name':_0x2f69cd[_0x39d8('0x32')],'type':_0x2f69cd['type'][_0x39d8('0x33')]};});_0x5e3285['model']=_[_0x39d8('0x31')](_0x104df2,_0x39d8('0x2f'));_0x5e3285[_0x39d8('0x34')]=_['keys'](_0x33b323[_0x39d8('0x34')]);_0x5e3285['filters']=_['intersection'](_0x5e3285['model'],_0x5e3285['query']);_0x140da0[_0x39d8('0x35')]=_[_0x39d8('0x36')](_0x5e3285[_0x39d8('0x37')],qs['fields'](_0x33b323[_0x39d8('0x34')][_0x39d8('0x38')]));_0x140da0[_0x39d8('0x35')]=_0x140da0[_0x39d8('0x35')]['length']?_0x140da0[_0x39d8('0x35')]:_0x5e3285[_0x39d8('0x37')];if(!_0x33b323['query'][_0x39d8('0x39')](_0x39d8('0x3a'))){_0x140da0[_0x39d8('0x22')]=qs[_0x39d8('0x22')](_0x33b323[_0x39d8('0x34')][_0x39d8('0x22')]);_0x140da0['offset']=qs['offset'](_0x33b323['query'][_0x39d8('0x24')]);}_0x140da0[_0x39d8('0x3b')]=qs[_0x39d8('0x3c')](_0x33b323['query']['sort']);_0x140da0['where']=qs[_0x39d8('0x3d')](_[_0x39d8('0x3e')](_0x33b323[_0x39d8('0x34')],_0x5e3285[_0x39d8('0x3d')]),_0x104df2);if(_0x33b323[_0x39d8('0x34')][_0x39d8('0x3f')]){_0x140da0[_0x39d8('0x40')]=_['merge'](_0x140da0[_0x39d8('0x40')],{'$or':_[_0x39d8('0x31')](_0x104df2,function(_0x1405f6){if(_0x1405f6[_0x39d8('0x41')]!=='VIRTUAL'){var _0xbf9a6b={};_0xbf9a6b[_0x1405f6[_0x39d8('0x2f')]]={'$like':'%'+_0x33b323[_0x39d8('0x34')]['filter']+'%'};return _0xbf9a6b;}})});}_0x140da0=_['merge']({},_0x140da0,_0x33b323[_0x39d8('0x42')]);var _0x220978={'where':_0x140da0[_0x39d8('0x40')]};return db[_0x39d8('0x43')]['count'](_0x220978)[_0x39d8('0x2b')](function(_0x3e1e4c){_0x472fc4['count']=_0x3e1e4c;if(_0x33b323[_0x39d8('0x34')]['includeAll']){_0x140da0['include']=[{'all':!![]}];}return db[_0x39d8('0x43')][_0x39d8('0x44')](_0x140da0);})[_0x39d8('0x2b')](function(_0x3138c4){_0x472fc4[_0x39d8('0x45')]=_0x3138c4;return _0x472fc4;})[_0x39d8('0x2b')](respondWithFilteredResult(_0x33c5a2,_0x140da0))[_0x39d8('0x46')](handleError(_0x33c5a2,null));};exports['show']=function(_0x21db3b,_0x49ac58){var _0x2ac8c0={'raw':!![],'where':{'id':_0x21db3b[_0x39d8('0x47')]['id']}},_0x44766f={};_0x44766f[_0x39d8('0x37')]=_[_0x39d8('0x48')](db[_0x39d8('0x43')][_0x39d8('0x49')]);_0x44766f[_0x39d8('0x34')]=_[_0x39d8('0x48')](_0x21db3b[_0x39d8('0x34')]);_0x44766f['filters']=_['intersection'](_0x44766f[_0x39d8('0x37')],_0x44766f[_0x39d8('0x34')]);_0x2ac8c0['attributes']=_[_0x39d8('0x36')](_0x44766f['model'],qs[_0x39d8('0x38')](_0x21db3b[_0x39d8('0x34')][_0x39d8('0x38')]));_0x2ac8c0[_0x39d8('0x35')]=_0x2ac8c0[_0x39d8('0x35')][_0x39d8('0x4a')]?_0x2ac8c0[_0x39d8('0x35')]:_0x44766f['model'];if(_0x21db3b[_0x39d8('0x34')][_0x39d8('0x4b')]){_0x2ac8c0[_0x39d8('0x4c')]=[{'all':!![]}];}_0x2ac8c0=_['merge']({},_0x2ac8c0,_0x21db3b[_0x39d8('0x42')]);return db[_0x39d8('0x43')][_0x39d8('0x4d')](_0x2ac8c0)['then'](handleEntityNotFound(_0x49ac58,null))[_0x39d8('0x2b')](respondWithResult(_0x49ac58,null))[_0x39d8('0x46')](handleError(_0x49ac58,null));};exports[_0x39d8('0x4e')]=function(_0x385130,_0x2cd5c6){return db[_0x39d8('0x43')]['create'](_0x385130[_0x39d8('0x4f')],{})['then'](respondWithResult(_0x2cd5c6,0xc9))['catch'](handleError(_0x2cd5c6,null));};exports['update']=function(_0x2e37c4,_0x3b8835){if(_0x2e37c4[_0x39d8('0x4f')]['id']){delete _0x2e37c4[_0x39d8('0x4f')]['id'];}return db[_0x39d8('0x43')][_0x39d8('0x4d')]({'where':{'id':_0x2e37c4[_0x39d8('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b8835,null))[_0x39d8('0x2b')](saveUpdates(_0x2e37c4['body'],null))['then'](respondWithResult(_0x3b8835,null))[_0x39d8('0x46')](handleError(_0x3b8835,null));};exports[_0x39d8('0x2c')]=function(_0x1ad7a5,_0x182314){return db['SugarcrmField'][_0x39d8('0x4d')]({'where':{'id':_0x1ad7a5[_0x39d8('0x47')]['id']}})[_0x39d8('0x2b')](handleEntityNotFound(_0x182314,null))[_0x39d8('0x2b')](removeEntity(_0x182314,null))['catch'](handleError(_0x182314,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6465256..c984fce 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 _0x7c3f=['moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0x7c3f,0xec));var _0xf7c3=function(_0x1ee7a7,_0x2478b0){_0x1ee7a7=_0x1ee7a7-0x0;var _0x291a52=_0x7c3f[_0x1ee7a7];return _0x291a52;};'use strict';var _=require(_0xf7c3('0x0'));var util=require(_0xf7c3('0x1'));var logger=require(_0xf7c3('0x2'))(_0xf7c3('0x3'));var moment=require(_0xf7c3('0x4'));var BPromise=require(_0xf7c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7c3('0x6'));var rimraf=require(_0xf7c3('0x7'));var config=require(_0xf7c3('0x8'));var attributes=require(_0xf7c3('0x9'));module[_0xf7c3('0xa')]=function(_0x5cd42f,_0x30507d){return _0x5cd42f['define']('SugarcrmField',attributes,{'tableName':_0xf7c3('0xb'),'paranoid':![],'indexes':[{'name':_0xf7c3('0xc'),'fields':[_0xf7c3('0xd'),_0xf7c3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x166b=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x457e0d,_0x58eacf){var _0x3aaa9f=function(_0x3a44cc){while(--_0x3a44cc){_0x457e0d['push'](_0x457e0d['shift']());}};_0x3aaa9f(++_0x58eacf);}(_0x166b,0x1e1));var _0xb166=function(_0x20c664,_0x317fce){_0x20c664=_0x20c664-0x0;var _0x49978f=_0x166b[_0x20c664];return _0x49978f;};'use strict';var _=require(_0xb166('0x0'));var util=require(_0xb166('0x1'));var logger=require(_0xb166('0x2'))(_0xb166('0x3'));var moment=require(_0xb166('0x4'));var BPromise=require('bluebird');var rp=require(_0xb166('0x5'));var fs=require('fs');var path=require(_0xb166('0x6'));var rimraf=require(_0xb166('0x7'));var config=require(_0xb166('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xb166('0x9')]=function(_0x26e095,_0x2a773f){return _0x26e095[_0xb166('0xa')](_0xb166('0xb'),attributes,{'tableName':_0xb166('0xc'),'paranoid':![],'indexes':[{'name':_0xb166('0xd'),'fields':[_0xb166('0xe'),_0xb166('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 92a17a8..cfa11cd 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 _0x4c82=['rpc','../../config/environment','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x3c0232,_0x4ad683){var _0x48aecf=function(_0x545a4c){while(--_0x545a4c){_0x3c0232['push'](_0x3c0232['shift']());}};_0x48aecf(++_0x4ad683);}(_0x4c82,0x72));var _0x24c8=function(_0x5b7820,_0x36ab53){_0x5b7820=_0x5b7820-0x0;var _0x17db47=_0x4c82[_0x5b7820];return _0x17db47;};'use strict';var _=require('lodash');var util=require(_0x24c8('0x0'));var moment=require(_0x24c8('0x1'));var BPromise=require(_0x24c8('0x2'));var rs=require(_0x24c8('0x3'));var fs=require('fs');var Redis=require(_0x24c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x24c8('0x5'))(_0x24c8('0x6'));var config=require(_0x24c8('0x7'));var jayson=require(_0x24c8('0x8'));var client=jayson['client'][_0x24c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x447529,_0x424e82,_0xf7d2cd){return new BPromise(function(_0x37cf87,_0x21897a){return client[_0x24c8('0xa')](_0x447529,_0xf7d2cd)[_0x24c8('0xb')](function(_0x3f351c){logger['info'](_0x24c8('0xc'),_0x424e82,'request\x20sent');logger[_0x24c8('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x424e82,_0x24c8('0xe'),JSON['stringify'](_0x3f351c));if(_0x3f351c[_0x24c8('0xf')]){if(_0x3f351c['error'][_0x24c8('0x10')]===0x1f4){logger[_0x24c8('0xf')](_0x24c8('0xc'),_0x424e82,_0x3f351c['error'][_0x24c8('0x11')]);return _0x21897a(_0x3f351c[_0x24c8('0xf')][_0x24c8('0x11')]);}logger[_0x24c8('0xf')](_0x24c8('0xc'),_0x424e82,_0x3f351c['error'][_0x24c8('0x11')]);return _0x37cf87(_0x3f351c['error'][_0x24c8('0x11')]);}else{logger[_0x24c8('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x424e82,_0x24c8('0xe'));_0x37cf87(_0x3f351c[_0x24c8('0x13')][_0x24c8('0x11')]);}})['catch'](function(_0x39ee72){logger[_0x24c8('0xf')](_0x24c8('0xc'),_0x424e82,_0x39ee72);_0x21897a(_0x39ee72);});});} \ No newline at end of file +var _0xedbc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x1fd57f,_0x45186b){var _0x25c3d6=function(_0x102ab4){while(--_0x102ab4){_0x1fd57f['push'](_0x1fd57f['shift']());}};_0x25c3d6(++_0x45186b);}(_0xedbc,0x122));var _0xcedb=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xedbc[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xcedb('0x0'));var util=require(_0xcedb('0x1'));var moment=require(_0xcedb('0x2'));var BPromise=require(_0xcedb('0x3'));var rs=require(_0xcedb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcedb('0x5'))['db'];var utils=require(_0xcedb('0x6'));var logger=require(_0xcedb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcedb('0x8'));var client=jayson[_0xcedb('0x9')][_0xcedb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43f93d,_0x214885,_0xa79b7){return new BPromise(function(_0x249e21,_0x3388b7){return client[_0xcedb('0xb')](_0x43f93d,_0xa79b7)['then'](function(_0x59e37e){logger[_0xcedb('0xc')](_0xcedb('0xd'),_0x214885,_0xcedb('0xe'));logger[_0xcedb('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x214885,_0xcedb('0xe'),JSON[_0xcedb('0x10')](_0x59e37e));if(_0x59e37e[_0xcedb('0x11')]){if(_0x59e37e['error'][_0xcedb('0x12')]===0x1f4){logger[_0xcedb('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x214885,_0x59e37e[_0xcedb('0x11')][_0xcedb('0x13')]);return _0x3388b7(_0x59e37e['error']['message']);}logger[_0xcedb('0x11')](_0xcedb('0xd'),_0x214885,_0x59e37e['error'][_0xcedb('0x13')]);return _0x249e21(_0x59e37e[_0xcedb('0x11')][_0xcedb('0x13')]);}else{logger['info'](_0xcedb('0xd'),_0x214885,_0xcedb('0xe'));_0x249e21(_0x59e37e[_0xcedb('0x14')][_0xcedb('0x13')]);}})['catch'](function(_0x3ddaeb){logger[_0xcedb('0x11')](_0xcedb('0xd'),_0x214885,_0x3ddaeb);_0x3388b7(_0x3ddaeb);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 11da4c3..903af93 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 _0x222f=['addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x4683d5,_0xe1a390){var _0xe2fef2=function(_0x400c07){while(--_0x400c07){_0x4683d5['push'](_0x4683d5['shift']());}};_0xe2fef2(++_0xe1a390);}(_0x222f,0x1a4));var _0xf222=function(_0x4ff939,_0x5f54ea){_0x4ff939=_0x4ff939-0x0;var _0x3f8ba8=_0x222f[_0x4ff939];return _0x3f8ba8;};'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('./intVtigerAccount.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/:id',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['getFields']);router[_0xf222('0xf')]('/',auth[_0xf222('0xa')](),controller[_0xf222('0x10')]);router[_0xf222('0xf')]('/:id/configurations',auth[_0xf222('0xa')](),controller[_0xf222('0x11')]);router[_0xf222('0x12')](_0xf222('0x13'),auth[_0xf222('0xa')](),controller[_0xf222('0x14')]);router[_0xf222('0x15')](_0xf222('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xf222('0x16')]=router; \ No newline at end of file +var _0x5081=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put'];(function(_0x31968f,_0x5c7afe){var _0x16c0b2=function(_0x161047){while(--_0x161047){_0x31968f['push'](_0x31968f['shift']());}};_0x16c0b2(++_0x5c7afe);}(_0x5081,0x148));var _0x1508=function(_0x2cd16a,_0x3125e9){_0x2cd16a=_0x2cd16a-0x0;var _0x47e762=_0x5081[_0x2cd16a];return _0x47e762;};'use strict';var multer=require(_0x1508('0x0'));var util=require(_0x1508('0x1'));var path=require(_0x1508('0x2'));var timeout=require(_0x1508('0x3'));var express=require(_0x1508('0x4'));var router=express[_0x1508('0x5')]();var fs_extra=require(_0x1508('0x6'));var auth=require(_0x1508('0x7'));var interaction=require(_0x1508('0x8'));var config=require(_0x1508('0x9'));var controller=require(_0x1508('0xa'));router[_0x1508('0xb')]('/',auth['isAuthenticated'](),controller[_0x1508('0xc')]);router['get'](_0x1508('0xd'),auth[_0x1508('0xe')](),controller[_0x1508('0xf')]);router[_0x1508('0xb')](_0x1508('0x10'),auth[_0x1508('0xe')](),controller[_0x1508('0x11')]);router['get']('/:id/fields',auth[_0x1508('0xe')](),controller[_0x1508('0x12')]);router['post']('/',auth[_0x1508('0xe')](),controller[_0x1508('0x13')]);router['post'](_0x1508('0x10'),auth['isAuthenticated'](),controller[_0x1508('0x14')]);router[_0x1508('0x15')](_0x1508('0xd'),auth[_0x1508('0xe')](),controller['update']);router[_0x1508('0x16')](_0x1508('0xd'),auth[_0x1508('0xe')](),controller[_0x1508('0x17')]);module[_0x1508('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 418cdce..685ded5 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 _0x18ba=['exports','STRING','sequelize'];(function(_0xca6092,_0x227611){var _0x5c43be=function(_0x1ce3a1){while(--_0x1ce3a1){_0xca6092['push'](_0xca6092['shift']());}};_0x5c43be(++_0x227611);}(_0x18ba,0x8f));var _0xa18b=function(_0x42cbfb,_0x1ad129){_0x42cbfb=_0x42cbfb-0x0;var _0x4fcecd=_0x18ba[_0x42cbfb];return _0x4fcecd;};'use strict';var Sequelize=require(_0xa18b('0x0'));module[_0xa18b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa18b('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xa18b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa18b('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x86ed=['STRING','HelpDesk','sequelize','exports'];(function(_0x3943f3,_0x398a62){var _0x52b837=function(_0x5d2dd0){while(--_0x5d2dd0){_0x3943f3['push'](_0x3943f3['shift']());}};_0x52b837(++_0x398a62);}(_0x86ed,0x146));var _0xd86e=function(_0x10723a,_0x4249eb){_0x10723a=_0x10723a-0x0;var _0x3d905c=_0x86ed[_0x10723a];return _0x3d905c;};'use strict';var Sequelize=require(_0xd86e('0x0'));module[_0xd86e('0x1')]={'name':{'type':Sequelize[_0xd86e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd86e('0x2')]},'username':{'type':Sequelize[_0xd86e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd86e('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd86e('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 545ca87..9f48434 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 _0xf5c3=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','then','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','filter','merge','options','VtigerAccount','includeAll','include','show','params','find','catch','create','body','update','destroy','getConfigurations','findOne','order','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','Subjects','VtigerField','md5','username','description','remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','sessionName','autogenerated','reference','owner','editable','false','label','cf_','picklistValues','log','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0xf5c3,0xd8));var _0x3f5c=function(_0x48ed5b,_0x43ab37){_0x48ed5b=_0x48ed5b-0x0;var _0x5afb47=_0xf5c3[_0x48ed5b];return _0x5afb47;};'use strict';var emlformat=require(_0x3f5c('0x0'));var rimraf=require(_0x3f5c('0x1'));var zipdir=require(_0x3f5c('0x2'));var jsonpatch=require(_0x3f5c('0x3'));var rp=require(_0x3f5c('0x4'));var moment=require(_0x3f5c('0x5'));var BPromise=require(_0x3f5c('0x6'));var Mustache=require(_0x3f5c('0x7'));var util=require(_0x3f5c('0x8'));var path=require(_0x3f5c('0x9'));var sox=require(_0x3f5c('0xa'));var csv=require(_0x3f5c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f5c('0xc'));var squel=require(_0x3f5c('0xd'));var crypto=require(_0x3f5c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3f5c('0xf'));var toCsv=require(_0x3f5c('0xb'));var querystring=require(_0x3f5c('0x10'));var Papa=require('papaparse');var Redis=require(_0x3f5c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3f5c('0x12'));var as=require(_0x3f5c('0x13'));var hardwareService=require(_0x3f5c('0x14'));var logger=require(_0x3f5c('0x15'))(_0x3f5c('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(_0x3f5c('0x17'));function respondWithStatusCode(_0x52fd5f,_0xf82039){_0xf82039=_0xf82039||0xcc;return function(_0x49d86c){if(_0x49d86c){return _0x52fd5f[_0x3f5c('0x18')](_0xf82039);}return _0x52fd5f[_0x3f5c('0x19')](_0xf82039)[_0x3f5c('0x1a')]();};}function respondWithResult(_0x220066,_0x5352f4){_0x5352f4=_0x5352f4||0xc8;return function(_0x7b52ed){if(_0x7b52ed){return _0x220066[_0x3f5c('0x19')](_0x5352f4)['json'](_0x7b52ed);}};}function respondWithFilteredResult(_0xf92089,_0xe3a617){return function(_0x2e21c6){if(_0x2e21c6){var _0x4d6ebf=typeof _0xe3a617['offset']==='undefined'&&typeof _0xe3a617['limit']===_0x3f5c('0x1b');var _0x1a23e3=_0x2e21c6[_0x3f5c('0x1c')];var _0x35d1f0=_0x4d6ebf?0x0:_0xe3a617[_0x3f5c('0x1d')];var _0x33df32=_0x4d6ebf?_0x2e21c6[_0x3f5c('0x1c')]:_0xe3a617['offset']+_0xe3a617[_0x3f5c('0x1e')];var _0x39266f;if(_0x33df32>=_0x1a23e3){_0x33df32=_0x1a23e3;_0x39266f=0xc8;}else{_0x39266f=0xce;}_0xf92089['status'](_0x39266f);return _0xf92089[_0x3f5c('0x1f')]('Content-Range',_0x35d1f0+'-'+_0x33df32+'/'+_0x1a23e3)[_0x3f5c('0x20')](_0x2e21c6);}return null;};}function patchUpdates(_0x35a163){return function(_0x35d11e){try{jsonpatch[_0x3f5c('0x21')](_0x35d11e,_0x35a163,!![]);}catch(_0x41b71c){return BPromise[_0x3f5c('0x22')](_0x41b71c);}return _0x35d11e[_0x3f5c('0x23')]();};}function saveUpdates(_0x49699b,_0x29c77a){return function(_0x49d183){if(_0x49d183){return _0x49d183['update'](_0x49699b)[_0x3f5c('0x24')](function(_0x220729){return _0x220729;});}return null;};}function removeEntity(_0x3263c8,_0x2f7742){return function(_0x552c2c){if(_0x552c2c){return _0x552c2c['destroy']()[_0x3f5c('0x24')](function(){_0x3263c8[_0x3f5c('0x19')](0xcc)[_0x3f5c('0x1a')]();});}};}function handleEntityNotFound(_0x19f3ff,_0x56bf5e){return function(_0x107e8e){if(!_0x107e8e){_0x19f3ff['sendStatus'](0x194);}return _0x107e8e;};}function handleError(_0x4201ab,_0x58e6ea){_0x58e6ea=_0x58e6ea||0x1f4;return function(_0x211326){logger['error'](_0x211326['stack']);if(_0x211326[_0x3f5c('0x25')]){delete _0x211326[_0x3f5c('0x25')];}_0x4201ab[_0x3f5c('0x19')](_0x58e6ea)[_0x3f5c('0x26')](_0x211326);};}exports[_0x3f5c('0x27')]=function(_0xf98f69,_0x15987b){var _0x5950d3={},_0x22b647={},_0x49d9f={'count':0x0,'rows':[]};var _0x394bdf=_['map'](db['VtigerAccount'][_0x3f5c('0x28')],function(_0x2ebe9c){return{'name':_0x2ebe9c['fieldName'],'type':_0x2ebe9c[_0x3f5c('0x29')][_0x3f5c('0x2a')]};});_0x22b647[_0x3f5c('0x2b')]=_['map'](_0x394bdf,_0x3f5c('0x25'));_0x22b647[_0x3f5c('0x2c')]=_[_0x3f5c('0x2d')](_0xf98f69[_0x3f5c('0x2c')]);_0x22b647[_0x3f5c('0x2e')]=_[_0x3f5c('0x2f')](_0x22b647[_0x3f5c('0x2b')],_0x22b647[_0x3f5c('0x2c')]);_0x5950d3[_0x3f5c('0x30')]=_[_0x3f5c('0x2f')](_0x22b647[_0x3f5c('0x2b')],qs[_0x3f5c('0x31')](_0xf98f69[_0x3f5c('0x2c')]['fields']));_0x5950d3[_0x3f5c('0x30')]=_0x5950d3['attributes'][_0x3f5c('0x32')]?_0x5950d3[_0x3f5c('0x30')]:_0x22b647[_0x3f5c('0x2b')];if(!_0xf98f69[_0x3f5c('0x2c')][_0x3f5c('0x33')](_0x3f5c('0x34'))){_0x5950d3['limit']=qs[_0x3f5c('0x1e')](_0xf98f69['query'][_0x3f5c('0x1e')]);_0x5950d3[_0x3f5c('0x1d')]=qs[_0x3f5c('0x1d')](_0xf98f69[_0x3f5c('0x2c')][_0x3f5c('0x1d')]);}_0x5950d3['order']=qs[_0x3f5c('0x35')](_0xf98f69['query'][_0x3f5c('0x35')]);_0x5950d3[_0x3f5c('0x36')]=qs['filters'](_[_0x3f5c('0x37')](_0xf98f69[_0x3f5c('0x2c')],_0x22b647[_0x3f5c('0x2e')]),_0x394bdf);if(_0xf98f69[_0x3f5c('0x2c')]['filter']){_0x5950d3[_0x3f5c('0x36')]=_['merge'](_0x5950d3[_0x3f5c('0x36')],{'$or':_[_0x3f5c('0x38')](_0x394bdf,function(_0x1be17e){if(_0x1be17e[_0x3f5c('0x29')]!==_0x3f5c('0x39')){var _0x1498db={};_0x1498db[_0x1be17e['name']]={'$like':'%'+_0xf98f69[_0x3f5c('0x2c')][_0x3f5c('0x3a')]+'%'};return _0x1498db;}})});}_0x5950d3=_[_0x3f5c('0x3b')]({},_0x5950d3,_0xf98f69[_0x3f5c('0x3c')]);var _0x119d78={'where':_0x5950d3[_0x3f5c('0x36')]};return db[_0x3f5c('0x3d')][_0x3f5c('0x1c')](_0x119d78)[_0x3f5c('0x24')](function(_0x378830){_0x49d9f[_0x3f5c('0x1c')]=_0x378830;if(_0xf98f69[_0x3f5c('0x2c')][_0x3f5c('0x3e')]){_0x5950d3[_0x3f5c('0x3f')]=[{'all':!![]}];}return db[_0x3f5c('0x3d')]['findAll'](_0x5950d3);})['then'](function(_0x3b0c05){_0x49d9f['rows']=_0x3b0c05;return _0x49d9f;})[_0x3f5c('0x24')](respondWithFilteredResult(_0x15987b,_0x5950d3))['catch'](handleError(_0x15987b,null));};exports[_0x3f5c('0x40')]=function(_0x361284,_0x462157){var _0x256074={'raw':![],'where':{'id':_0x361284[_0x3f5c('0x41')]['id']}},_0x2a0f17={};_0x2a0f17[_0x3f5c('0x2b')]=_[_0x3f5c('0x2d')](db[_0x3f5c('0x3d')][_0x3f5c('0x28')]);_0x2a0f17[_0x3f5c('0x2c')]=_[_0x3f5c('0x2d')](_0x361284[_0x3f5c('0x2c')]);_0x2a0f17[_0x3f5c('0x2e')]=_[_0x3f5c('0x2f')](_0x2a0f17[_0x3f5c('0x2b')],_0x2a0f17[_0x3f5c('0x2c')]);_0x256074['attributes']=_[_0x3f5c('0x2f')](_0x2a0f17[_0x3f5c('0x2b')],qs['fields'](_0x361284[_0x3f5c('0x2c')][_0x3f5c('0x31')]));_0x256074[_0x3f5c('0x30')]=_0x256074[_0x3f5c('0x30')]['length']?_0x256074['attributes']:_0x2a0f17[_0x3f5c('0x2b')];if(_0x361284[_0x3f5c('0x2c')][_0x3f5c('0x3e')]){_0x256074['include']=[{'all':!![]}];}_0x256074=_[_0x3f5c('0x3b')]({},_0x256074,_0x361284[_0x3f5c('0x3c')]);return db['VtigerAccount'][_0x3f5c('0x42')](_0x256074)[_0x3f5c('0x24')](handleEntityNotFound(_0x462157,null))[_0x3f5c('0x24')](respondWithResult(_0x462157,null))[_0x3f5c('0x43')](handleError(_0x462157,null));};exports['create']=function(_0x4af3b0,_0x43456c){return db[_0x3f5c('0x3d')][_0x3f5c('0x44')](_0x4af3b0[_0x3f5c('0x45')],{})[_0x3f5c('0x24')](respondWithResult(_0x43456c,0xc9))[_0x3f5c('0x43')](handleError(_0x43456c,null));};exports[_0x3f5c('0x46')]=function(_0x2d4a51,_0x2d930f){if(_0x2d4a51['body']['id']){delete _0x2d4a51[_0x3f5c('0x45')]['id'];}return db[_0x3f5c('0x3d')][_0x3f5c('0x42')]({'where':{'id':_0x2d4a51[_0x3f5c('0x41')]['id']}})[_0x3f5c('0x24')](handleEntityNotFound(_0x2d930f,null))['then'](saveUpdates(_0x2d4a51[_0x3f5c('0x45')],null))[_0x3f5c('0x24')](respondWithResult(_0x2d930f,null))['catch'](handleError(_0x2d930f,null));};exports[_0x3f5c('0x47')]=function(_0x44aaf1,_0x19ac54){return db[_0x3f5c('0x3d')][_0x3f5c('0x42')]({'where':{'id':_0x44aaf1[_0x3f5c('0x41')]['id']}})[_0x3f5c('0x24')](handleEntityNotFound(_0x19ac54,null))[_0x3f5c('0x24')](removeEntity(_0x19ac54,null))[_0x3f5c('0x43')](handleError(_0x19ac54,null));};exports[_0x3f5c('0x48')]=function(_0x390bd7,_0x233894,_0x494c3c){var _0x4ec33b={};var _0x1b923c={};var _0x525404;var _0x549893;return db[_0x3f5c('0x3d')][_0x3f5c('0x49')]({'where':{'id':_0x390bd7['params']['id']}})[_0x3f5c('0x24')](handleEntityNotFound(_0x233894,null))['then'](function(_0x1680e1){if(_0x1680e1){_0x525404=_0x1680e1;_0x1b923c[_0x3f5c('0x2b')]=_['keys'](db['VtigerConfiguration'][_0x3f5c('0x28')]);_0x1b923c['query']=_[_0x3f5c('0x2d')](_0x390bd7['query']);_0x1b923c[_0x3f5c('0x2e')]=_[_0x3f5c('0x2f')](_0x1b923c[_0x3f5c('0x2b')],_0x1b923c[_0x3f5c('0x2c')]);_0x4ec33b[_0x3f5c('0x30')]=_[_0x3f5c('0x2f')](_0x1b923c[_0x3f5c('0x2b')],qs['fields'](_0x390bd7[_0x3f5c('0x2c')][_0x3f5c('0x31')]));_0x4ec33b[_0x3f5c('0x30')]=_0x4ec33b[_0x3f5c('0x30')][_0x3f5c('0x32')]?_0x4ec33b[_0x3f5c('0x30')]:_0x1b923c['model'];_0x4ec33b[_0x3f5c('0x4a')]=qs[_0x3f5c('0x35')](_0x390bd7[_0x3f5c('0x2c')][_0x3f5c('0x35')]);_0x4ec33b[_0x3f5c('0x36')]=qs[_0x3f5c('0x2e')](_[_0x3f5c('0x37')](_0x390bd7[_0x3f5c('0x2c')],_0x1b923c['filters']));if(_0x390bd7['query'][_0x3f5c('0x3a')]){_0x4ec33b[_0x3f5c('0x36')]=_[_0x3f5c('0x3b')](_0x4ec33b[_0x3f5c('0x36')],{'$or':_['map'](_0x4ec33b[_0x3f5c('0x30')],function(_0x5ead28){var _0x3e3b84={};_0x3e3b84[_0x5ead28]={'$like':'%'+_0x390bd7['query'][_0x3f5c('0x3a')]+'%'};return _0x3e3b84;})});}_0x4ec33b=_['merge']({},_0x4ec33b,_0x390bd7['options']);return _0x525404[_0x3f5c('0x48')](_0x4ec33b);}})[_0x3f5c('0x24')](function(_0x2825f3){if(_0x2825f3){_0x549893=_0x2825f3[_0x3f5c('0x32')];if(!_0x390bd7[_0x3f5c('0x2c')][_0x3f5c('0x33')](_0x3f5c('0x34'))){_0x4ec33b[_0x3f5c('0x1e')]=qs[_0x3f5c('0x1e')](_0x390bd7[_0x3f5c('0x2c')][_0x3f5c('0x1e')]);_0x4ec33b[_0x3f5c('0x1d')]=qs[_0x3f5c('0x1d')](_0x390bd7[_0x3f5c('0x2c')][_0x3f5c('0x1d')]);}return _0x525404[_0x3f5c('0x48')](_0x4ec33b);}})[_0x3f5c('0x24')](function(_0x4959d8){if(_0x4959d8){return _0x4959d8?{'count':_0x549893,'rows':_0x4959d8}:null;}})[_0x3f5c('0x24')](respondWithResult(_0x233894,null))[_0x3f5c('0x43')](handleError(_0x233894,null));};exports[_0x3f5c('0x4b')]=function(_0x159657,_0x1106f8,_0x3fff40){if(_0x159657['body']['id']){delete _0x159657['body']['id'];}return db[_0x3f5c('0x3d')][_0x3f5c('0x49')]({'where':{'id':_0x159657[_0x3f5c('0x41')]['id']}})[_0x3f5c('0x24')](handleEntityNotFound(_0x1106f8,null))[_0x3f5c('0x24')](function(_0x309eed){if(_0x309eed){_0x159657[_0x3f5c('0x45')]['AccountId']=_0x309eed['id'];_0x159657[_0x3f5c('0x45')]['Subjects']=integrations[_0x3f5c('0x4c')](_0x159657[_0x3f5c('0x45')]['channel'],_0x159657[_0x3f5c('0x45')]['type']);_0x159657[_0x3f5c('0x45')][_0x3f5c('0x4d')]=integrations[_0x3f5c('0x4e')](_0x159657[_0x3f5c('0x45')][_0x3f5c('0x4f')],_0x159657[_0x3f5c('0x45')][_0x3f5c('0x29')]);return db[_0x3f5c('0x50')][_0x3f5c('0x44')](_0x159657['body'],{'include':[{'model':db['VtigerField'],'as':_0x3f5c('0x51')},{'model':db[_0x3f5c('0x52')],'as':_0x3f5c('0x4d')}]});}return null;})[_0x3f5c('0x24')](respondWithResult(_0x1106f8,null))['catch'](handleError(_0x1106f8,null));};var md5=require(_0x3f5c('0x53'));exports['getFields']=function(_0x315cf2,_0x49185d,_0x526cd5){var _0x350cb1=null;var _0x4b9755=null;var _0xa2cc6d=null;var _0x4c7fec=null;var _0x5773df='';return db['VtigerAccount'][_0x3f5c('0x49')]({'where':{'id':_0x315cf2['params']['id']},'attributes':['id',_0x3f5c('0x25'),_0x3f5c('0x54'),_0x3f5c('0x55'),'moduleName',_0x3f5c('0x56'),'serverUrl',_0x3f5c('0x57')]})['then'](handleEntityNotFound(_0x49185d,null))[_0x3f5c('0x24')](function(_0x35befc){if(_0x35befc){_0x350cb1=_0x35befc['username'];_0x4b9755=_0x35befc['accessKey'];_0xa2cc6d=_0x35befc[_0x3f5c('0x58')];_0x5773df=_0x35befc[_0x3f5c('0x56')];var _0x2d0fea=_0x5773df[_0x3f5c('0x59')](-0x1);if(_0x2d0fea==='/'){_0x5773df=_0x5773df[_0x3f5c('0x5a')](0x0,_0x5773df[_0x3f5c('0x5b')](_0x2d0fea));}_0x4c7fec=util[_0x3f5c('0x5c')](_0x3f5c('0x5d'),_0x5773df);var _0x5be3be={'method':_0x3f5c('0x5e'),'uri':_0x4c7fec,'qs':{'operation':'getchallenge','username':_0x35befc[_0x3f5c('0x54')]},'json':!![]};return rp(_0x5be3be);}})[_0x3f5c('0x24')](function(_0x256548){if(_0x256548[_0x3f5c('0x5f')]){var _0x4e7658={'method':_0x3f5c('0x60'),'uri':_0x4c7fec,'form':{'operation':_0x3f5c('0x61'),'username':_0x350cb1,'accessKey':md5(_0x256548[_0x3f5c('0x62')][_0x3f5c('0x63')]+_0x4b9755)},'json':!![]};return rp(_0x4e7658);}})[_0x3f5c('0x24')](function(_0x543667){if(_0x543667['success']){var _0xd946f9={'method':_0x3f5c('0x5e'),'uri':_0x4c7fec,'qs':{'operation':'describe','username':_0x350cb1,'sessionName':_0x543667[_0x3f5c('0x62')][_0x3f5c('0x64')],'elementType':_0xa2cc6d},'json':!![]};return rp(_0xd946f9);}})[_0x3f5c('0x24')](function(_0x453fac){if(_0x453fac[_0x3f5c('0x5f')]){var _0x45dcc5=[_0x3f5c('0x65'),_0x3f5c('0x66'),_0x3f5c('0x67')];_['remove'](_0x453fac[_0x3f5c('0x62')][_0x3f5c('0x31')],function(_0x3295e0){return _0x45dcc5['includes'](_0x3295e0[_0x3f5c('0x29')]['name']);});_['remove'](_0x453fac[_0x3f5c('0x62')][_0x3f5c('0x31')],function(_0x4fefd3){return _0x4fefd3[_0x3f5c('0x68')]===_0x3f5c('0x69');});return{'count':_0x453fac[_0x3f5c('0x62')][_0x3f5c('0x31')]['length'],'rows':_['map'](_0x453fac[_0x3f5c('0x62')][_0x3f5c('0x31')],function(_0x21a1db){return{'id':_0x21a1db['name'],'name':_0x21a1db[_0x3f5c('0x6a')],'custom':_['startsWith'](_0x21a1db[_0x3f5c('0x25')],_0x3f5c('0x6b'))?!![]:![],'options':_0x21a1db['type']['name']==='picklist'&&_0x21a1db[_0x3f5c('0x29')][_0x3f5c('0x6c')][_0x3f5c('0x32')]>0x0?_[_0x3f5c('0x38')](_0x21a1db['type'][_0x3f5c('0x6c')],function(_0x379584){return{'name':_0x379584['label'],'value':_0x379584['value']};}):[]};})};}})[_0x3f5c('0x24')](respondWithResult(_0x49185d,null))[_0x3f5c('0x43')](function(_0x3f28e0){console[_0x3f5c('0x6d')]('vTiger\x20error:\x20'+_0x3f28e0);var _0x4e8ec9=_0x315cf2['query'][_0x3f5c('0x6e')]?0x1f4:_0x3f28e0[_0x3f5c('0x6f')]||0x1f4;logger[_0x3f5c('0x70')](_0x3f5c('0x71'),_0x3f5c('0x72'),_0x4e8ec9,JSON[_0x3f5c('0x73')](_0x3f28e0));delete _0x3f28e0['name'];if(_0x4e8ec9===0x191){_0x4e8ec9=0x190;}_0x49185d[_0x3f5c('0x19')](_0x4e8ec9)[_0x3f5c('0x26')](_0x315cf2[_0x3f5c('0x2c')][_0x3f5c('0x6e')]?{'message':_0x3f5c('0x74'),'statusCode':_0x3f28e0[_0x3f5c('0x6f')]}:_0x3f28e0);});}; \ No newline at end of file +var _0xc1b4=['AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','reference','owner','includes','remove','editable','label','startsWith','cf_','log','vTiger\x20error:\x20','test','statusCode','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','VtigerAccount','include','findAll','rows','catch','show','params','create','body','destroy','find','findOne','VtigerConfiguration','pick','getConfigurations','addConfiguration'];(function(_0x4def54,_0x36de1d){var _0x137bee=function(_0x1dd6f4){while(--_0x1dd6f4){_0x4def54['push'](_0x4def54['shift']());}};_0x137bee(++_0x36de1d);}(_0xc1b4,0x193));var _0x4c1b=function(_0x21dc8e,_0x572973){_0x21dc8e=_0x21dc8e-0x0;var _0x408475=_0xc1b4[_0x21dc8e];return _0x408475;};'use strict';var emlformat=require(_0x4c1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c1b('0x1'));var jsonpatch=require(_0x4c1b('0x2'));var rp=require(_0x4c1b('0x3'));var moment=require(_0x4c1b('0x4'));var BPromise=require(_0x4c1b('0x5'));var Mustache=require(_0x4c1b('0x6'));var util=require(_0x4c1b('0x7'));var path=require(_0x4c1b('0x8'));var sox=require(_0x4c1b('0x9'));var csv=require(_0x4c1b('0xa'));var ejs=require(_0x4c1b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c1b('0xc'));var squel=require(_0x4c1b('0xd'));var crypto=require(_0x4c1b('0xe'));var jsforce=require(_0x4c1b('0xf'));var deskjs=require(_0x4c1b('0x10'));var toCsv=require(_0x4c1b('0xa'));var querystring=require(_0x4c1b('0x11'));var Papa=require(_0x4c1b('0x12'));var Redis=require(_0x4c1b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4c1b('0x14'));var as=require(_0x4c1b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c1b('0x16'))(_0x4c1b('0x17'));var utils=require(_0x4c1b('0x18'));var config=require(_0x4c1b('0x19'));var licenseUtil=require(_0x4c1b('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4c1b('0x1b'));function respondWithStatusCode(_0x540a4e,_0x5efa62){_0x5efa62=_0x5efa62||0xcc;return function(_0x5014f8){if(_0x5014f8){return _0x540a4e[_0x4c1b('0x1c')](_0x5efa62);}return _0x540a4e[_0x4c1b('0x1d')](_0x5efa62)[_0x4c1b('0x1e')]();};}function respondWithResult(_0x216122,_0x5d218f){_0x5d218f=_0x5d218f||0xc8;return function(_0x38fb96){if(_0x38fb96){return _0x216122['status'](_0x5d218f)[_0x4c1b('0x1f')](_0x38fb96);}};}function respondWithFilteredResult(_0x4ee5c2,_0x3718f7){return function(_0x23112f){if(_0x23112f){var _0x170738=typeof _0x3718f7[_0x4c1b('0x20')]===_0x4c1b('0x21')&&typeof _0x3718f7[_0x4c1b('0x22')]===_0x4c1b('0x21');var _0xbfb072=_0x23112f['count'];var _0x23f05b=_0x170738?0x0:_0x3718f7[_0x4c1b('0x20')];var _0x34e399=_0x170738?_0x23112f[_0x4c1b('0x23')]:_0x3718f7['offset']+_0x3718f7[_0x4c1b('0x22')];var _0xf99520;if(_0x34e399>=_0xbfb072){_0x34e399=_0xbfb072;_0xf99520=0xc8;}else{_0xf99520=0xce;}_0x4ee5c2['status'](_0xf99520);return _0x4ee5c2[_0x4c1b('0x24')](_0x4c1b('0x25'),_0x23f05b+'-'+_0x34e399+'/'+_0xbfb072)['json'](_0x23112f);}return null;};}function patchUpdates(_0xe1279b){return function(_0x53ae1b){try{jsonpatch['apply'](_0x53ae1b,_0xe1279b,!![]);}catch(_0x2885bf){return BPromise['reject'](_0x2885bf);}return _0x53ae1b[_0x4c1b('0x26')]();};}function saveUpdates(_0x4dbd40,_0x18b051){return function(_0x71bc6d){if(_0x71bc6d){return _0x71bc6d[_0x4c1b('0x27')](_0x4dbd40)[_0x4c1b('0x28')](function(_0x97bbc5){return _0x97bbc5;});}return null;};}function removeEntity(_0x6bba64,_0x11c15f){return function(_0x7f5edc){if(_0x7f5edc){return _0x7f5edc['destroy']()[_0x4c1b('0x28')](function(){_0x6bba64[_0x4c1b('0x1d')](0xcc)[_0x4c1b('0x1e')]();});}};}function handleEntityNotFound(_0x53595f,_0x243ce9){return function(_0x1c8713){if(!_0x1c8713){_0x53595f[_0x4c1b('0x1c')](0x194);}return _0x1c8713;};}function handleError(_0x521412,_0x5afab4){_0x5afab4=_0x5afab4||0x1f4;return function(_0xf1f820){logger['error'](_0xf1f820[_0x4c1b('0x29')]);if(_0xf1f820[_0x4c1b('0x2a')]){delete _0xf1f820[_0x4c1b('0x2a')];}_0x521412[_0x4c1b('0x1d')](_0x5afab4)[_0x4c1b('0x2b')](_0xf1f820);};}exports['index']=function(_0x24977d,_0x57fe53){var _0x51962d={},_0x474568={},_0x434dd2={'count':0x0,'rows':[]};var _0x34be92=_[_0x4c1b('0x2c')](db['VtigerAccount'][_0x4c1b('0x2d')],function(_0x555874){return{'name':_0x555874[_0x4c1b('0x2e')],'type':_0x555874['type'][_0x4c1b('0x2f')]};});_0x474568[_0x4c1b('0x30')]=_[_0x4c1b('0x2c')](_0x34be92,'name');_0x474568[_0x4c1b('0x31')]=_[_0x4c1b('0x32')](_0x24977d[_0x4c1b('0x31')]);_0x474568[_0x4c1b('0x33')]=_[_0x4c1b('0x34')](_0x474568[_0x4c1b('0x30')],_0x474568[_0x4c1b('0x31')]);_0x51962d['attributes']=_[_0x4c1b('0x34')](_0x474568[_0x4c1b('0x30')],qs['fields'](_0x24977d['query'][_0x4c1b('0x35')]));_0x51962d[_0x4c1b('0x36')]=_0x51962d[_0x4c1b('0x36')][_0x4c1b('0x37')]?_0x51962d['attributes']:_0x474568[_0x4c1b('0x30')];if(!_0x24977d['query']['hasOwnProperty'](_0x4c1b('0x38'))){_0x51962d[_0x4c1b('0x22')]=qs['limit'](_0x24977d[_0x4c1b('0x31')][_0x4c1b('0x22')]);_0x51962d[_0x4c1b('0x20')]=qs[_0x4c1b('0x20')](_0x24977d[_0x4c1b('0x31')][_0x4c1b('0x20')]);}_0x51962d[_0x4c1b('0x39')]=qs[_0x4c1b('0x3a')](_0x24977d[_0x4c1b('0x31')][_0x4c1b('0x3a')]);_0x51962d['where']=qs[_0x4c1b('0x33')](_['pick'](_0x24977d['query'],_0x474568[_0x4c1b('0x33')]),_0x34be92);if(_0x24977d[_0x4c1b('0x31')][_0x4c1b('0x3b')]){_0x51962d[_0x4c1b('0x3c')]=_[_0x4c1b('0x3d')](_0x51962d[_0x4c1b('0x3c')],{'$or':_[_0x4c1b('0x2c')](_0x34be92,function(_0x36479c){if(_0x36479c[_0x4c1b('0x3e')]!==_0x4c1b('0x3f')){var _0x41e518={};_0x41e518[_0x36479c[_0x4c1b('0x2a')]]={'$like':'%'+_0x24977d['query']['filter']+'%'};return _0x41e518;}})});}_0x51962d=_['merge']({},_0x51962d,_0x24977d[_0x4c1b('0x40')]);var _0x3f7ff8={'where':_0x51962d[_0x4c1b('0x3c')]};return db[_0x4c1b('0x41')]['count'](_0x3f7ff8)['then'](function(_0x969410){_0x434dd2['count']=_0x969410;if(_0x24977d[_0x4c1b('0x31')]['includeAll']){_0x51962d[_0x4c1b('0x42')]=[{'all':!![]}];}return db['VtigerAccount'][_0x4c1b('0x43')](_0x51962d);})[_0x4c1b('0x28')](function(_0x27c6c6){_0x434dd2[_0x4c1b('0x44')]=_0x27c6c6;return _0x434dd2;})[_0x4c1b('0x28')](respondWithFilteredResult(_0x57fe53,_0x51962d))[_0x4c1b('0x45')](handleError(_0x57fe53,null));};exports[_0x4c1b('0x46')]=function(_0x3a1251,_0x3e661b){var _0x9ecfce={'raw':![],'where':{'id':_0x3a1251[_0x4c1b('0x47')]['id']}},_0x5dcada={};_0x5dcada[_0x4c1b('0x30')]=_[_0x4c1b('0x32')](db[_0x4c1b('0x41')][_0x4c1b('0x2d')]);_0x5dcada[_0x4c1b('0x31')]=_[_0x4c1b('0x32')](_0x3a1251['query']);_0x5dcada[_0x4c1b('0x33')]=_['intersection'](_0x5dcada[_0x4c1b('0x30')],_0x5dcada[_0x4c1b('0x31')]);_0x9ecfce[_0x4c1b('0x36')]=_['intersection'](_0x5dcada[_0x4c1b('0x30')],qs[_0x4c1b('0x35')](_0x3a1251[_0x4c1b('0x31')][_0x4c1b('0x35')]));_0x9ecfce['attributes']=_0x9ecfce[_0x4c1b('0x36')][_0x4c1b('0x37')]?_0x9ecfce[_0x4c1b('0x36')]:_0x5dcada[_0x4c1b('0x30')];if(_0x3a1251[_0x4c1b('0x31')]['includeAll']){_0x9ecfce[_0x4c1b('0x42')]=[{'all':!![]}];}_0x9ecfce=_['merge']({},_0x9ecfce,_0x3a1251['options']);return db[_0x4c1b('0x41')]['find'](_0x9ecfce)[_0x4c1b('0x28')](handleEntityNotFound(_0x3e661b,null))['then'](respondWithResult(_0x3e661b,null))[_0x4c1b('0x45')](handleError(_0x3e661b,null));};exports[_0x4c1b('0x48')]=function(_0x58e8dd,_0x1a7f4e){return db['VtigerAccount'][_0x4c1b('0x48')](_0x58e8dd[_0x4c1b('0x49')],{})[_0x4c1b('0x28')](respondWithResult(_0x1a7f4e,0xc9))[_0x4c1b('0x45')](handleError(_0x1a7f4e,null));};exports[_0x4c1b('0x27')]=function(_0x32cffe,_0x978107){if(_0x32cffe[_0x4c1b('0x49')]['id']){delete _0x32cffe[_0x4c1b('0x49')]['id'];}return db[_0x4c1b('0x41')]['find']({'where':{'id':_0x32cffe[_0x4c1b('0x47')]['id']}})[_0x4c1b('0x28')](handleEntityNotFound(_0x978107,null))[_0x4c1b('0x28')](saveUpdates(_0x32cffe[_0x4c1b('0x49')],null))['then'](respondWithResult(_0x978107,null))[_0x4c1b('0x45')](handleError(_0x978107,null));};exports[_0x4c1b('0x4a')]=function(_0x57150d,_0x4f0c0c){return db['VtigerAccount'][_0x4c1b('0x4b')]({'where':{'id':_0x57150d['params']['id']}})[_0x4c1b('0x28')](handleEntityNotFound(_0x4f0c0c,null))['then'](removeEntity(_0x4f0c0c,null))[_0x4c1b('0x45')](handleError(_0x4f0c0c,null));};exports['getConfigurations']=function(_0x3e62a2,_0x243b5d,_0x1525ed){var _0x34afac={};var _0x12f498={};var _0x39a775;var _0x43aa78;return db[_0x4c1b('0x41')][_0x4c1b('0x4c')]({'where':{'id':_0x3e62a2[_0x4c1b('0x47')]['id']}})[_0x4c1b('0x28')](handleEntityNotFound(_0x243b5d,null))[_0x4c1b('0x28')](function(_0x326fab){if(_0x326fab){_0x39a775=_0x326fab;_0x12f498[_0x4c1b('0x30')]=_['keys'](db[_0x4c1b('0x4d')][_0x4c1b('0x2d')]);_0x12f498['query']=_[_0x4c1b('0x32')](_0x3e62a2[_0x4c1b('0x31')]);_0x12f498[_0x4c1b('0x33')]=_[_0x4c1b('0x34')](_0x12f498[_0x4c1b('0x30')],_0x12f498[_0x4c1b('0x31')]);_0x34afac[_0x4c1b('0x36')]=_[_0x4c1b('0x34')](_0x12f498[_0x4c1b('0x30')],qs[_0x4c1b('0x35')](_0x3e62a2[_0x4c1b('0x31')][_0x4c1b('0x35')]));_0x34afac['attributes']=_0x34afac[_0x4c1b('0x36')]['length']?_0x34afac[_0x4c1b('0x36')]:_0x12f498[_0x4c1b('0x30')];_0x34afac[_0x4c1b('0x39')]=qs['sort'](_0x3e62a2[_0x4c1b('0x31')][_0x4c1b('0x3a')]);_0x34afac[_0x4c1b('0x3c')]=qs[_0x4c1b('0x33')](_[_0x4c1b('0x4e')](_0x3e62a2['query'],_0x12f498[_0x4c1b('0x33')]));if(_0x3e62a2[_0x4c1b('0x31')][_0x4c1b('0x3b')]){_0x34afac[_0x4c1b('0x3c')]=_[_0x4c1b('0x3d')](_0x34afac[_0x4c1b('0x3c')],{'$or':_[_0x4c1b('0x2c')](_0x34afac[_0x4c1b('0x36')],function(_0x1a0e97){var _0x45e491={};_0x45e491[_0x1a0e97]={'$like':'%'+_0x3e62a2[_0x4c1b('0x31')]['filter']+'%'};return _0x45e491;})});}_0x34afac=_[_0x4c1b('0x3d')]({},_0x34afac,_0x3e62a2[_0x4c1b('0x40')]);return _0x39a775[_0x4c1b('0x4f')](_0x34afac);}})[_0x4c1b('0x28')](function(_0x55d7d8){if(_0x55d7d8){_0x43aa78=_0x55d7d8[_0x4c1b('0x37')];if(!_0x3e62a2[_0x4c1b('0x31')]['hasOwnProperty'](_0x4c1b('0x38'))){_0x34afac['limit']=qs['limit'](_0x3e62a2['query']['limit']);_0x34afac[_0x4c1b('0x20')]=qs[_0x4c1b('0x20')](_0x3e62a2['query'][_0x4c1b('0x20')]);}return _0x39a775[_0x4c1b('0x4f')](_0x34afac);}})[_0x4c1b('0x28')](function(_0x59f03c){if(_0x59f03c){return _0x59f03c?{'count':_0x43aa78,'rows':_0x59f03c}:null;}})[_0x4c1b('0x28')](respondWithResult(_0x243b5d,null))[_0x4c1b('0x45')](handleError(_0x243b5d,null));};exports[_0x4c1b('0x50')]=function(_0x320197,_0xbe6ec1,_0x29b590){if(_0x320197[_0x4c1b('0x49')]['id']){delete _0x320197[_0x4c1b('0x49')]['id'];}return db[_0x4c1b('0x41')][_0x4c1b('0x4c')]({'where':{'id':_0x320197[_0x4c1b('0x47')]['id']}})[_0x4c1b('0x28')](handleEntityNotFound(_0xbe6ec1,null))[_0x4c1b('0x28')](function(_0x1889cd){if(_0x1889cd){_0x320197['body'][_0x4c1b('0x51')]=_0x1889cd['id'];_0x320197[_0x4c1b('0x49')][_0x4c1b('0x52')]=integrations[_0x4c1b('0x53')](_0x320197['body'][_0x4c1b('0x54')],_0x320197[_0x4c1b('0x49')][_0x4c1b('0x3e')]);_0x320197[_0x4c1b('0x49')]['Descriptions']=integrations[_0x4c1b('0x55')](_0x320197[_0x4c1b('0x49')][_0x4c1b('0x54')],_0x320197['body'][_0x4c1b('0x3e')]);return db[_0x4c1b('0x4d')][_0x4c1b('0x48')](_0x320197[_0x4c1b('0x49')],{'include':[{'model':db['VtigerField'],'as':_0x4c1b('0x52')},{'model':db[_0x4c1b('0x56')],'as':_0x4c1b('0x57')}]});}return null;})[_0x4c1b('0x28')](respondWithResult(_0xbe6ec1,null))[_0x4c1b('0x45')](handleError(_0xbe6ec1,null));};var md5=require(_0x4c1b('0x58'));exports[_0x4c1b('0x59')]=function(_0x2b160a,_0x4106b1,_0x133669){var _0x315679=null;var _0x336579=null;var _0x519d62=null;var _0x293c6c=null;var _0x3b0b56='';return db[_0x4c1b('0x41')][_0x4c1b('0x4c')]({'where':{'id':_0x2b160a[_0x4c1b('0x47')]['id']},'attributes':['id',_0x4c1b('0x2a'),_0x4c1b('0x5a'),'description',_0x4c1b('0x5b'),_0x4c1b('0x5c'),_0x4c1b('0x5d'),_0x4c1b('0x5e')]})['then'](handleEntityNotFound(_0x4106b1,null))[_0x4c1b('0x28')](function(_0x28b577){if(_0x28b577){_0x315679=_0x28b577[_0x4c1b('0x5a')];_0x336579=_0x28b577[_0x4c1b('0x5e')];_0x519d62=_0x28b577[_0x4c1b('0x5b')];_0x3b0b56=_0x28b577[_0x4c1b('0x5c')];var _0x559f37=_0x3b0b56[_0x4c1b('0x5f')](-0x1);if(_0x559f37==='/'){_0x3b0b56=_0x3b0b56[_0x4c1b('0x60')](0x0,_0x3b0b56['lastIndexOf'](_0x559f37));}_0x293c6c=util['format'](_0x4c1b('0x61'),_0x3b0b56);var _0x1e2d3c={'method':'GET','uri':_0x293c6c,'qs':{'operation':_0x4c1b('0x62'),'username':_0x28b577[_0x4c1b('0x5a')]},'json':!![]};return rp(_0x1e2d3c);}})[_0x4c1b('0x28')](function(_0x53a685){if(_0x53a685[_0x4c1b('0x63')]){var _0x1dc196={'method':_0x4c1b('0x64'),'uri':_0x293c6c,'form':{'operation':_0x4c1b('0x65'),'username':_0x315679,'accessKey':md5(_0x53a685[_0x4c1b('0x66')][_0x4c1b('0x67')]+_0x336579)},'json':!![]};return rp(_0x1dc196);}})[_0x4c1b('0x28')](function(_0x270e79){if(_0x270e79[_0x4c1b('0x63')]){var _0x1e48c5={'method':_0x4c1b('0x68'),'uri':_0x293c6c,'qs':{'operation':_0x4c1b('0x69'),'username':_0x315679,'sessionName':_0x270e79[_0x4c1b('0x66')][_0x4c1b('0x6a')],'elementType':_0x519d62},'json':!![]};return rp(_0x1e48c5);}})[_0x4c1b('0x28')](function(_0x155270){if(_0x155270['success']){var _0x269981=[_0x4c1b('0x6b'),_0x4c1b('0x6c'),_0x4c1b('0x6d')];_['remove'](_0x155270['result'][_0x4c1b('0x35')],function(_0x528767){return _0x269981[_0x4c1b('0x6e')](_0x528767[_0x4c1b('0x3e')][_0x4c1b('0x2a')]);});_[_0x4c1b('0x6f')](_0x155270[_0x4c1b('0x66')]['fields'],function(_0x56b0cf){return _0x56b0cf[_0x4c1b('0x70')]==='false';});return{'count':_0x155270[_0x4c1b('0x66')][_0x4c1b('0x35')][_0x4c1b('0x37')],'rows':_['map'](_0x155270[_0x4c1b('0x66')][_0x4c1b('0x35')],function(_0x591384){return{'id':_0x591384[_0x4c1b('0x2a')],'name':_0x591384[_0x4c1b('0x71')],'custom':_[_0x4c1b('0x72')](_0x591384[_0x4c1b('0x2a')],_0x4c1b('0x73'))?!![]:![],'options':_0x591384[_0x4c1b('0x3e')]['name']==='picklist'&&_0x591384['type']['picklistValues'][_0x4c1b('0x37')]>0x0?_[_0x4c1b('0x2c')](_0x591384['type']['picklistValues'],function(_0x54da75){return{'name':_0x54da75['label'],'value':_0x54da75['value']};}):[]};})};}})[_0x4c1b('0x28')](respondWithResult(_0x4106b1,null))[_0x4c1b('0x45')](function(_0x546511){console[_0x4c1b('0x74')](_0x4c1b('0x75')+_0x546511);var _0x3133e1=_0x2b160a[_0x4c1b('0x31')][_0x4c1b('0x76')]?0x1f4:_0x546511[_0x4c1b('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4c1b('0x59'),_0x3133e1,JSON[_0x4c1b('0x78')](_0x546511));delete _0x546511[_0x4c1b('0x2a')];if(_0x3133e1===0x191){_0x3133e1=0x190;}_0x4106b1['status'](_0x3133e1)[_0x4c1b('0x2b')](_0x2b160a[_0x4c1b('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x546511[_0x4c1b('0x77')]}:_0x546511);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9655683..52c2532 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 _0x2ea2=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','moment','bluebird','rimraf'];(function(_0x454cd9,_0x39e4af){var _0xa015fc=function(_0x13cfab){while(--_0x13cfab){_0x454cd9['push'](_0x454cd9['shift']());}};_0xa015fc(++_0x39e4af);}(_0x2ea2,0x7e));var _0x22ea=function(_0x424285,_0x2f2a57){_0x424285=_0x424285-0x0;var _0x9db0dc=_0x2ea2[_0x424285];return _0x9db0dc;};'use strict';var _=require(_0x22ea('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x22ea('0x1'));var BPromise=require(_0x22ea('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x22ea('0x3'));var config=require(_0x22ea('0x4'));var attributes=require(_0x22ea('0x5'));var integrations=require(_0x22ea('0x6'));module[_0x22ea('0x7')]=function(_0x336792,_0xae0dfa){return _0x336792[_0x22ea('0x8')](_0x22ea('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06a2=['path','define','int_vtiger_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0x06a2,0x1bb));var _0x206a=function(_0x16eeff,_0x54d42e){_0x16eeff=_0x16eeff-0x0;var _0xd3ea1d=_0x06a2[_0x16eeff];return _0xd3ea1d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x206a('0x0'))(_0x206a('0x1'));var moment=require(_0x206a('0x2'));var BPromise=require(_0x206a('0x3'));var rp=require(_0x206a('0x4'));var fs=require('fs');var path=require(_0x206a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x214195,_0x2adecd){return _0x214195[_0x206a('0x6')]('VtigerAccount',attributes,{'tableName':_0x206a('0x7'),'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 ba0e8a1..5f39819 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 _0xa74f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','attributes','include','map','model','ShowVtigerAccount','find','moment'];(function(_0x2cd62c,_0x46b378){var _0x1b90ae=function(_0x19d1e7){while(--_0x19d1e7){_0x2cd62c['push'](_0x2cd62c['shift']());}};_0x1b90ae(++_0x46b378);}(_0xa74f,0x9a));var _0xfa74=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xa74f[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['findAll']({'raw':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x51dda1['options']?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x51dda1[_0xfa74('0x15')]?_0x51dda1['options']['attributes']||null:null,'limit':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x18')]||null:null,'include':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')]['include']?_['map'](_0x51dda1[_0xfa74('0x15')]['include'],function(_0x48cbd3){return{'model':db[_0x48cbd3['model']],'as':_0x48cbd3['as'],'attributes':_0x48cbd3[_0xfa74('0x19')],'include':_0x48cbd3[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x48cbd3['include'],function(_0x530f99){return{'model':db[_0x530f99[_0xfa74('0x1c')]],'as':_0x530f99['as'],'attributes':_0x530f99[_0xfa74('0x19')],'include':_0x530f99['include']?_[_0xfa74('0x1b')](_0x530f99['include'],function(_0x1a8cf7){return{'model':db[_0x1a8cf7[_0xfa74('0x1c')]],'as':_0x1a8cf7['as'],'attributes':_0x1a8cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1130de){logger[_0xfa74('0x8')](_0xfa74('0x13'),_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x1130de));_0x31d3c1(_0x1130de);})[_0xfa74('0x12')](function(_0x57d90e){logger['error'](_0xfa74('0x13'),_0x57d90e[_0xfa74('0xf')],_0x51dda1);_0x25a36b(_0x4928b6['error'](0x1f4,_0x57d90e['message']));});});};exports[_0xfa74('0x1d')]=function(_0x564060){var _0x2238d4=this;return new Promise(function(_0x4d6d0a,_0x363173){return db[_0xfa74('0x14')][_0xfa74('0x1e')]({'raw':_0x564060[_0xfa74('0x15')]?_0x564060['options'][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x19')]||null:null,'include':_0x564060['options']?_0x564060[_0xfa74('0x15')]['include']?_[_0xfa74('0x1b')](_0x564060[_0xfa74('0x15')][_0xfa74('0x1a')],function(_0x1b5ff0){return{'model':db[_0x1b5ff0['model']],'as':_0x1b5ff0['as'],'attributes':_0x1b5ff0['attributes'],'include':_0x1b5ff0[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x1b5ff0[_0xfa74('0x1a')],function(_0x25863f){return{'model':db[_0x25863f['model']],'as':_0x25863f['as'],'attributes':_0x25863f[_0xfa74('0x19')],'include':_0x25863f[_0xfa74('0x1a')]?_['map'](_0x25863f['include'],function(_0x557510){return{'model':db[_0x557510['model']],'as':_0x557510['as'],'attributes':_0x557510['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1c3b44){logger[_0xfa74('0x8')](_0xfa74('0x1d'),_0x564060);logger[_0xfa74('0xa')](_0xfa74('0x1d'),_0x564060,JSON[_0xfa74('0xc')](_0x1c3b44));_0x4d6d0a(_0x1c3b44);})[_0xfa74('0x12')](function(_0x1a2d52){logger['error'](_0xfa74('0x1d'),_0x1a2d52[_0xfa74('0xf')],_0x564060);_0x363173(_0x2238d4[_0xfa74('0xd')](0x1f4,_0x1a2d52[_0xfa74('0xf')]));});});}; \ No newline at end of file +var _0x351d=['findAll','options','attributes','include','map','model','then','catch','ShowVtigerAccount','find','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount'];(function(_0x5071f3,_0x126db7){var _0x2edf56=function(_0x5d9e3c){while(--_0x5d9e3c){_0x5071f3['push'](_0x5071f3['shift']());}};_0x2edf56(++_0x126db7);}(_0x351d,0x90));var _0xd351=function(_0x448f37,_0x41cd1c){_0x448f37=_0x448f37-0x0;var _0x31453d=_0x351d[_0x448f37];return _0x31453d;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5318b2,_0x16b3f7,_0x235aa0){return new BPromise(function(_0x4e1b06,_0x2e9a2a){return client[_0xd351('0xa')](_0x5318b2,_0x235aa0)['then'](function(_0x586c60){logger[_0xd351('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'),JSON[_0xd351('0xe')](_0x586c60));if(_0x586c60['error']){if(_0x586c60[_0xd351('0xf')]['code']===0x1f4){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);return _0x2e9a2a(_0x586c60[_0xd351('0xf')]['message']);}logger[_0xd351('0xf')](_0xd351('0x10'),_0x16b3f7,_0x586c60['error'][_0xd351('0x11')]);return _0x4e1b06(_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);}else{logger[_0xd351('0xb')](_0xd351('0x10'),_0x16b3f7,'request\x20sent');_0x4e1b06(_0x586c60[_0xd351('0x12')]['message']);}})['catch'](function(_0x2c6708){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x2c6708);_0x2e9a2a(_0x2c6708);});});}exports[_0xd351('0x13')]=function(_0x4e0164){var _0x4c6693=this;return new Promise(function(_0x1e1a3c,_0x2bfc53){return db[_0xd351('0x14')][_0xd351('0x15')]({'raw':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['where']||null:null,'attributes':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x17')]||null:null,'limit':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')]['limit']||null:null,'include':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x4e0164[_0xd351('0x16')][_0xd351('0x18')],function(_0x365bbc){return{'model':db[_0x365bbc['model']],'as':_0x365bbc['as'],'attributes':_0x365bbc[_0xd351('0x17')],'include':_0x365bbc[_0xd351('0x18')]?_[_0xd351('0x19')](_0x365bbc[_0xd351('0x18')],function(_0x489c9a){return{'model':db[_0x489c9a[_0xd351('0x1a')]],'as':_0x489c9a['as'],'attributes':_0x489c9a['attributes'],'include':_0x489c9a[_0xd351('0x18')]?_[_0xd351('0x19')](_0x489c9a['include'],function(_0x2648d0){return{'model':db[_0x2648d0['model']],'as':_0x2648d0['as'],'attributes':_0x2648d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd351('0x1b')](function(_0x560be9){logger['info'](_0xd351('0x13'),_0x4e0164);logger['debug'](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x560be9));_0x1e1a3c(_0x560be9);})[_0xd351('0x1c')](function(_0x4d3f48){logger[_0xd351('0xf')]('GetVtigerAccount',_0x4d3f48[_0xd351('0x11')],_0x4e0164);_0x2bfc53(_0x4c6693['error'](0x1f4,_0x4d3f48['message']));});});};exports[_0xd351('0x1d')]=function(_0x38c82f){var _0x3f9ef3=this;return new Promise(function(_0x33b43d,_0x48aa96){return db[_0xd351('0x14')][_0xd351('0x1e')]({'raw':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x1f')]===undefined?!![]:![]:!![],'where':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x20')]||null:null,'attributes':_0x38c82f[_0xd351('0x16')]?_0x38c82f['options'][_0xd351('0x17')]||null:null,'include':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x38c82f[_0xd351('0x16')][_0xd351('0x18')],function(_0x3d5b7f){return{'model':db[_0x3d5b7f[_0xd351('0x1a')]],'as':_0x3d5b7f['as'],'attributes':_0x3d5b7f[_0xd351('0x17')],'include':_0x3d5b7f[_0xd351('0x18')]?_[_0xd351('0x19')](_0x3d5b7f[_0xd351('0x18')],function(_0x238663){return{'model':db[_0x238663['model']],'as':_0x238663['as'],'attributes':_0x238663['attributes'],'include':_0x238663[_0xd351('0x18')]?_[_0xd351('0x19')](_0x238663[_0xd351('0x18')],function(_0x2907b7){return{'model':db[_0x2907b7[_0xd351('0x1a')]],'as':_0x2907b7['as'],'attributes':_0x2907b7[_0xd351('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47e2fa){logger[_0xd351('0xb')]('ShowVtigerAccount',_0x38c82f);logger[_0xd351('0xd')](_0xd351('0x1d'),_0x38c82f,JSON[_0xd351('0xe')](_0x47e2fa));_0x33b43d(_0x47e2fa);})[_0xd351('0x1c')](function(_0x33307){logger[_0xd351('0xf')](_0xd351('0x1d'),_0x33307[_0xd351('0x11')],_0x38c82f);_0x48aa96(_0x3f9ef3[_0xd351('0xf')](0x1f4,_0x33307[_0xd351('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f9fecb1..9604b21 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 _0xc60c=['getSubjects','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields'];(function(_0x12fe56,_0x58a592){var _0x8750c3=function(_0x29a9b3){while(--_0x29a9b3){_0x12fe56['push'](_0x12fe56['shift']());}};_0x8750c3(++_0x58a592);}(_0xc60c,0x13b));var _0xcc60=function(_0x3ed528,_0x52481c){_0x3ed528=_0x3ed528-0x0;var _0x3ac7fb=_0xc60c[_0x3ed528];return _0x3ac7fb;};'use strict';var multer=require(_0xcc60('0x0'));var util=require(_0xcc60('0x1'));var path=require('path');var timeout=require(_0xcc60('0x2'));var express=require(_0xcc60('0x3'));var router=express[_0xcc60('0x4')]();var fs_extra=require(_0xcc60('0x5'));var auth=require(_0xcc60('0x6'));var interaction=require(_0xcc60('0x7'));var config=require(_0xcc60('0x8'));var controller=require(_0xcc60('0x9'));router[_0xcc60('0xa')]('/',auth[_0xcc60('0xb')](),controller['index']);router[_0xcc60('0xa')](_0xcc60('0xc'),auth[_0xcc60('0xb')](),controller['show']);router['get'](_0xcc60('0xd'),auth[_0xcc60('0xb')](),controller[_0xcc60('0xe')]);router[_0xcc60('0xa')]('/:id/subjects',auth[_0xcc60('0xb')](),controller[_0xcc60('0xf')]);router[_0xcc60('0xa')]('/:id/descriptions',auth[_0xcc60('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0xcc60('0xb')](),controller[_0xcc60('0x10')]);router[_0xcc60('0x11')](_0xcc60('0xc'),auth[_0xcc60('0xb')](),controller[_0xcc60('0x12')]);router[_0xcc60('0x13')](_0xcc60('0xc'),auth['isAuthenticated'](),controller[_0xcc60('0x14')]);module[_0xcc60('0x15')]=router; \ No newline at end of file +var _0x8e26=['getDescriptions','post','create','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x1bee5d,_0x18713e){var _0x1d2fcd=function(_0x11d173){while(--_0x11d173){_0x1bee5d['push'](_0x1bee5d['shift']());}};_0x1d2fcd(++_0x18713e);}(_0x8e26,0x1bf));var _0x68e2=function(_0xfeb802,_0x48c931){_0xfeb802=_0xfeb802-0x0;var _0x24b38f=_0x8e26[_0xfeb802];return _0x24b38f;};'use strict';var multer=require(_0x68e2('0x0'));var util=require('util');var path=require(_0x68e2('0x1'));var timeout=require('connect-timeout');var express=require(_0x68e2('0x2'));var router=express[_0x68e2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x68e2('0x4'));var interaction=require(_0x68e2('0x5'));var config=require(_0x68e2('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x68e2('0x7')]('/',auth[_0x68e2('0x8')](),controller[_0x68e2('0x9')]);router[_0x68e2('0x7')](_0x68e2('0xa'),auth[_0x68e2('0x8')](),controller[_0x68e2('0xb')]);router[_0x68e2('0x7')](_0x68e2('0xc'),auth[_0x68e2('0x8')](),controller[_0x68e2('0xd')]);router['get'](_0x68e2('0xe'),auth[_0x68e2('0x8')](),controller['getSubjects']);router[_0x68e2('0x7')]('/:id/descriptions',auth[_0x68e2('0x8')](),controller[_0x68e2('0xf')]);router[_0x68e2('0x10')]('/',auth[_0x68e2('0x8')](),controller[_0x68e2('0x11')]);router[_0x68e2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x68e2('0x13')]);router[_0x68e2('0x14')](_0x68e2('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x68e2('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 bbdc0b8..d0dccfd 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 _0xa441=['exports','STRING','sequelize'];(function(_0x39019c,_0x3b1af0){var _0x546f14=function(_0x235807){while(--_0x235807){_0x39019c['push'](_0x39019c['shift']());}};_0x546f14(++_0x3b1af0);}(_0xa441,0x1eb));var _0x1a44=function(_0x45e1dd,_0x283d44){_0x45e1dd=_0x45e1dd-0x0;var _0x232cd8=_0xa441[_0x45e1dd];return _0x232cd8;};'use strict';var Sequelize=require(_0x1a44('0x0'));module[_0x1a44('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a44('0x2')]}}; \ No newline at end of file +var _0x6f9c=['STRING','sequelize','exports'];(function(_0x2f9f6e,_0x3cad04){var _0x2e56bb=function(_0x43d1c3){while(--_0x43d1c3){_0x2f9f6e['push'](_0x2f9f6e['shift']());}};_0x2e56bb(++_0x3cad04);}(_0x6f9c,0x169));var _0xc6f9=function(_0x3b1823,_0xe74f59){_0x3b1823=_0x3b1823-0x0;var _0xe836a5=_0x6f9c[_0x3b1823];return _0xe836a5;};'use strict';var Sequelize=require(_0xc6f9('0x0'));module[_0xc6f9('0x1')]={'name':{'type':Sequelize[_0xc6f9('0x2')]},'description':{'type':Sequelize[_0xc6f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index aa8b6a7..5b2cc1f 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 _0x7da8=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','VtigerField','order','pick','getFields','getSubjects','findOne','length','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x30b317,_0x545380){var _0x352d9b=function(_0x3970b6){while(--_0x3970b6){_0x30b317['push'](_0x30b317['shift']());}};_0x352d9b(++_0x545380);}(_0x7da8,0xa6));var _0x87da=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7da8[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x87da('0x0'));var rimraf=require(_0x87da('0x1'));var zipdir=require(_0x87da('0x2'));var jsonpatch=require(_0x87da('0x3'));var rp=require(_0x87da('0x4'));var moment=require(_0x87da('0x5'));var BPromise=require(_0x87da('0x6'));var Mustache=require(_0x87da('0x7'));var util=require('util');var path=require(_0x87da('0x8'));var sox=require(_0x87da('0x9'));var csv=require(_0x87da('0xa'));var ejs=require(_0x87da('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87da('0xc'));var squel=require(_0x87da('0xd'));var crypto=require('crypto');var jsforce=require(_0x87da('0xe'));var deskjs=require(_0x87da('0xf'));var toCsv=require('to-csv');var querystring=require(_0x87da('0x10'));var Papa=require('papaparse');var Redis=require(_0x87da('0x11'));var authService=require(_0x87da('0x12'));var qs=require(_0x87da('0x13'));var as=require(_0x87da('0x14'));var hardwareService=require(_0x87da('0x15'));var logger=require('../../config/logger')(_0x87da('0x16'));var utils=require('../../config/utils');var config=require(_0x87da('0x17'));var licenseUtil=require(_0x87da('0x18'));var db=require(_0x87da('0x19'))['db'];function respondWithStatusCode(_0x2a2e1c,_0x23976e){_0x23976e=_0x23976e||0xcc;return function(_0x1ceb0a){if(_0x1ceb0a){return _0x2a2e1c[_0x87da('0x1a')](_0x23976e);}return _0x2a2e1c[_0x87da('0x1b')](_0x23976e)['end']();};}function respondWithResult(_0x5820fd,_0x36a57a){_0x36a57a=_0x36a57a||0xc8;return function(_0x466fda){if(_0x466fda){return _0x5820fd[_0x87da('0x1b')](_0x36a57a)['json'](_0x466fda);}};}function respondWithFilteredResult(_0x3f5bd0,_0x2e1d0e){return function(_0x6b70ee){if(_0x6b70ee){var _0x445e54=typeof _0x2e1d0e[_0x87da('0x1c')]===_0x87da('0x1d')&&typeof _0x2e1d0e[_0x87da('0x1e')]===_0x87da('0x1d');var _0x3073e6=_0x6b70ee[_0x87da('0x1f')];var _0x192887=_0x445e54?0x0:_0x2e1d0e[_0x87da('0x1c')];var _0x6e3031=_0x445e54?_0x6b70ee[_0x87da('0x1f')]:_0x2e1d0e['offset']+_0x2e1d0e['limit'];var _0x463855;if(_0x6e3031>=_0x3073e6){_0x6e3031=_0x3073e6;_0x463855=0xc8;}else{_0x463855=0xce;}_0x3f5bd0['status'](_0x463855);return _0x3f5bd0[_0x87da('0x20')](_0x87da('0x21'),_0x192887+'-'+_0x6e3031+'/'+_0x3073e6)[_0x87da('0x22')](_0x6b70ee);}return null;};}function patchUpdates(_0x17ced5){return function(_0x11d76c){try{jsonpatch[_0x87da('0x23')](_0x11d76c,_0x17ced5,!![]);}catch(_0x2cfc27){return BPromise[_0x87da('0x24')](_0x2cfc27);}return _0x11d76c[_0x87da('0x25')]();};}function saveUpdates(_0x12061c,_0x39e4e0){return function(_0x341461){if(_0x341461){return _0x341461[_0x87da('0x26')](_0x12061c)[_0x87da('0x27')](function(_0x13b704){return _0x13b704;});}return null;};}function removeEntity(_0x4e0a17,_0x307940){return function(_0x1fccd0){if(_0x1fccd0){return _0x1fccd0[_0x87da('0x28')]()[_0x87da('0x27')](function(){_0x4e0a17[_0x87da('0x1b')](0xcc)[_0x87da('0x29')]();});}};}function handleEntityNotFound(_0x5e46a8,_0xca8a94){return function(_0x113784){if(!_0x113784){_0x5e46a8['sendStatus'](0x194);}return _0x113784;};}function handleError(_0x103ee4,_0x470aec){_0x470aec=_0x470aec||0x1f4;return function(_0x3b5cd7){logger[_0x87da('0x2a')](_0x3b5cd7[_0x87da('0x2b')]);if(_0x3b5cd7[_0x87da('0x2c')]){delete _0x3b5cd7[_0x87da('0x2c')];}_0x103ee4['status'](_0x470aec)['send'](_0x3b5cd7);};}exports[_0x87da('0x2d')]=function(_0x3662be,_0x154371){var _0x32989e={},_0x4485f0={},_0x2de7a8={'count':0x0,'rows':[]};var _0xa7fb97=_['map'](db[_0x87da('0x2e')][_0x87da('0x2f')],function(_0x382d29){return{'name':_0x382d29[_0x87da('0x30')],'type':_0x382d29[_0x87da('0x31')][_0x87da('0x32')]};});_0x4485f0[_0x87da('0x33')]=_[_0x87da('0x34')](_0xa7fb97,'name');_0x4485f0[_0x87da('0x35')]=_[_0x87da('0x36')](_0x3662be['query']);_0x4485f0['filters']=_[_0x87da('0x37')](_0x4485f0[_0x87da('0x33')],_0x4485f0[_0x87da('0x35')]);_0x32989e[_0x87da('0x38')]=_[_0x87da('0x37')](_0x4485f0[_0x87da('0x33')],qs['fields'](_0x3662be[_0x87da('0x35')]['fields']));_0x32989e[_0x87da('0x38')]=_0x32989e[_0x87da('0x38')]['length']?_0x32989e[_0x87da('0x38')]:_0x4485f0[_0x87da('0x33')];if(!_0x3662be[_0x87da('0x35')]['hasOwnProperty'](_0x87da('0x39'))){_0x32989e['limit']=qs[_0x87da('0x1e')](_0x3662be[_0x87da('0x35')][_0x87da('0x1e')]);_0x32989e[_0x87da('0x1c')]=qs[_0x87da('0x1c')](_0x3662be[_0x87da('0x35')][_0x87da('0x1c')]);}_0x32989e['order']=qs[_0x87da('0x3a')](_0x3662be['query'][_0x87da('0x3a')]);_0x32989e[_0x87da('0x3b')]=qs['filters'](_['pick'](_0x3662be['query'],_0x4485f0[_0x87da('0x3c')]),_0xa7fb97);if(_0x3662be[_0x87da('0x35')]['filter']){_0x32989e['where']=_[_0x87da('0x3d')](_0x32989e['where'],{'$or':_['map'](_0xa7fb97,function(_0x2e520f){if(_0x2e520f[_0x87da('0x31')]!==_0x87da('0x3e')){var _0x1f6e5d={};_0x1f6e5d[_0x2e520f['name']]={'$like':'%'+_0x3662be[_0x87da('0x35')][_0x87da('0x3f')]+'%'};return _0x1f6e5d;}})});}_0x32989e=_[_0x87da('0x3d')]({},_0x32989e,_0x3662be[_0x87da('0x40')]);var _0xfdf476={'where':_0x32989e['where']};return db[_0x87da('0x2e')][_0x87da('0x1f')](_0xfdf476)[_0x87da('0x27')](function(_0x332a3b){_0x2de7a8[_0x87da('0x1f')]=_0x332a3b;if(_0x3662be[_0x87da('0x35')][_0x87da('0x41')]){_0x32989e[_0x87da('0x42')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x87da('0x43')](_0x32989e);})[_0x87da('0x27')](function(_0x1baa24){_0x2de7a8[_0x87da('0x44')]=_0x1baa24;return _0x2de7a8;})['then'](respondWithFilteredResult(_0x154371,_0x32989e))[_0x87da('0x45')](handleError(_0x154371,null));};exports[_0x87da('0x46')]=function(_0x22a0de,_0x50e505){var _0x4ced08={'raw':![],'where':{'id':_0x22a0de[_0x87da('0x47')]['id']}},_0x5bdb90={};_0x5bdb90[_0x87da('0x33')]=_['keys'](db[_0x87da('0x2e')][_0x87da('0x2f')]);_0x5bdb90[_0x87da('0x35')]=_[_0x87da('0x36')](_0x22a0de[_0x87da('0x35')]);_0x5bdb90[_0x87da('0x3c')]=_[_0x87da('0x37')](_0x5bdb90[_0x87da('0x33')],_0x5bdb90['query']);_0x4ced08[_0x87da('0x38')]=_['intersection'](_0x5bdb90[_0x87da('0x33')],qs[_0x87da('0x48')](_0x22a0de['query'][_0x87da('0x48')]));_0x4ced08[_0x87da('0x38')]=_0x4ced08[_0x87da('0x38')]['length']?_0x4ced08['attributes']:_0x5bdb90[_0x87da('0x33')];if(_0x22a0de[_0x87da('0x35')][_0x87da('0x41')]){_0x4ced08[_0x87da('0x42')]=[{'all':!![]}];}_0x4ced08=_[_0x87da('0x3d')]({},_0x4ced08,_0x22a0de[_0x87da('0x40')]);return db[_0x87da('0x2e')]['find'](_0x4ced08)['then'](handleEntityNotFound(_0x50e505,null))[_0x87da('0x27')](respondWithResult(_0x50e505,null))[_0x87da('0x45')](handleError(_0x50e505,null));};exports['create']=function(_0x43d83b,_0x129219){return db[_0x87da('0x2e')][_0x87da('0x49')](_0x43d83b[_0x87da('0x4a')],{})[_0x87da('0x27')](respondWithResult(_0x129219,0xc9))[_0x87da('0x45')](handleError(_0x129219,null));};exports[_0x87da('0x26')]=function(_0x72feb2,_0x289357){if(_0x72feb2['body']['id']){delete _0x72feb2[_0x87da('0x4a')]['id'];}return db[_0x87da('0x2e')][_0x87da('0x4b')]({'where':{'id':_0x72feb2[_0x87da('0x47')]['id']}})['then'](handleEntityNotFound(_0x289357,null))['then'](saveUpdates(_0x72feb2[_0x87da('0x4a')],null))['then'](respondWithResult(_0x289357,null))[_0x87da('0x45')](handleError(_0x289357,null));};exports[_0x87da('0x28')]=function(_0x746e4c,_0x1588c8){return db[_0x87da('0x2e')][_0x87da('0x4b')]({'where':{'id':_0x746e4c[_0x87da('0x47')]['id']}})[_0x87da('0x27')](handleEntityNotFound(_0x1588c8,null))['then'](removeEntity(_0x1588c8,null))['catch'](handleError(_0x1588c8,null));};exports['getFields']=function(_0x3cd1ed,_0x1fd5c0,_0x5d25d8){var _0x1db518={};var _0x337eb3={};var _0x17e542;var _0x184ac3;return db[_0x87da('0x2e')]['findOne']({'where':{'id':_0x3cd1ed[_0x87da('0x47')]['id']}})[_0x87da('0x27')](handleEntityNotFound(_0x1fd5c0,null))[_0x87da('0x27')](function(_0x10630a){if(_0x10630a){_0x17e542=_0x10630a;_0x337eb3[_0x87da('0x33')]=_[_0x87da('0x36')](db[_0x87da('0x4c')][_0x87da('0x2f')]);_0x337eb3[_0x87da('0x35')]=_['keys'](_0x3cd1ed[_0x87da('0x35')]);_0x337eb3['filters']=_[_0x87da('0x37')](_0x337eb3[_0x87da('0x33')],_0x337eb3[_0x87da('0x35')]);_0x1db518[_0x87da('0x38')]=_[_0x87da('0x37')](_0x337eb3['model'],qs['fields'](_0x3cd1ed[_0x87da('0x35')][_0x87da('0x48')]));_0x1db518[_0x87da('0x38')]=_0x1db518[_0x87da('0x38')]['length']?_0x1db518[_0x87da('0x38')]:_0x337eb3[_0x87da('0x33')];_0x1db518[_0x87da('0x4d')]=qs[_0x87da('0x3a')](_0x3cd1ed['query']['sort']);_0x1db518[_0x87da('0x3b')]=qs[_0x87da('0x3c')](_[_0x87da('0x4e')](_0x3cd1ed['query'],_0x337eb3['filters']));if(_0x3cd1ed[_0x87da('0x35')][_0x87da('0x3f')]){_0x1db518[_0x87da('0x3b')]=_[_0x87da('0x3d')](_0x1db518[_0x87da('0x3b')],{'$or':_[_0x87da('0x34')](_0x1db518[_0x87da('0x38')],function(_0x4bd65c){var _0x266195={};_0x266195[_0x4bd65c]={'$like':'%'+_0x3cd1ed[_0x87da('0x35')][_0x87da('0x3f')]+'%'};return _0x266195;})});}_0x1db518=_[_0x87da('0x3d')]({},_0x1db518,_0x3cd1ed['options']);return _0x17e542[_0x87da('0x4f')](_0x1db518);}})[_0x87da('0x27')](function(_0x3fac3d){if(_0x3fac3d){_0x184ac3=_0x3fac3d['length'];if(!_0x3cd1ed['query']['hasOwnProperty']('nolimit')){_0x1db518[_0x87da('0x1e')]=qs[_0x87da('0x1e')](_0x3cd1ed[_0x87da('0x35')]['limit']);_0x1db518[_0x87da('0x1c')]=qs[_0x87da('0x1c')](_0x3cd1ed['query'][_0x87da('0x1c')]);}return _0x17e542['getFields'](_0x1db518);}})[_0x87da('0x27')](function(_0x11ddce){if(_0x11ddce){return _0x11ddce?{'count':_0x184ac3,'rows':_0x11ddce}:null;}})[_0x87da('0x27')](respondWithResult(_0x1fd5c0,null))['catch'](handleError(_0x1fd5c0,null));};exports[_0x87da('0x50')]=function(_0x4f144a,_0x386f5f,_0x2f9914){var _0xbd0f82={};var _0x367a96={};var _0xc2aec2;var _0x5e00a4;return db['VtigerConfiguration'][_0x87da('0x51')]({'where':{'id':_0x4f144a[_0x87da('0x47')]['id']}})['then'](handleEntityNotFound(_0x386f5f,null))['then'](function(_0x440a69){if(_0x440a69){_0xc2aec2=_0x440a69;_0x367a96[_0x87da('0x33')]=_[_0x87da('0x36')](db[_0x87da('0x4c')][_0x87da('0x2f')]);_0x367a96[_0x87da('0x35')]=_[_0x87da('0x36')](_0x4f144a[_0x87da('0x35')]);_0x367a96[_0x87da('0x3c')]=_['intersection'](_0x367a96[_0x87da('0x33')],_0x367a96['query']);_0xbd0f82['attributes']=_[_0x87da('0x37')](_0x367a96[_0x87da('0x33')],qs['fields'](_0x4f144a[_0x87da('0x35')][_0x87da('0x48')]));_0xbd0f82[_0x87da('0x38')]=_0xbd0f82[_0x87da('0x38')][_0x87da('0x52')]?_0xbd0f82['attributes']:_0x367a96['model'];_0xbd0f82[_0x87da('0x4d')]=qs[_0x87da('0x3a')](_0x4f144a[_0x87da('0x35')][_0x87da('0x3a')]);_0xbd0f82[_0x87da('0x3b')]=qs[_0x87da('0x3c')](_[_0x87da('0x4e')](_0x4f144a['query'],_0x367a96[_0x87da('0x3c')]));if(_0x4f144a[_0x87da('0x35')][_0x87da('0x3f')]){_0xbd0f82['where']=_[_0x87da('0x3d')](_0xbd0f82[_0x87da('0x3b')],{'$or':_[_0x87da('0x34')](_0xbd0f82['attributes'],function(_0x4bc831){var _0x52f289={};_0x52f289[_0x4bc831]={'$like':'%'+_0x4f144a[_0x87da('0x35')][_0x87da('0x3f')]+'%'};return _0x52f289;})});}_0xbd0f82=_['merge']({},_0xbd0f82,_0x4f144a[_0x87da('0x40')]);return _0xc2aec2['getSubjects'](_0xbd0f82);}})[_0x87da('0x27')](function(_0x31ec99){if(_0x31ec99){_0x5e00a4=_0x31ec99[_0x87da('0x52')];if(!_0x4f144a[_0x87da('0x35')][_0x87da('0x53')]('nolimit')){_0xbd0f82[_0x87da('0x1e')]=qs[_0x87da('0x1e')](_0x4f144a['query']['limit']);_0xbd0f82[_0x87da('0x1c')]=qs['offset'](_0x4f144a[_0x87da('0x35')][_0x87da('0x1c')]);}return _0xc2aec2[_0x87da('0x50')](_0xbd0f82);}})['then'](function(_0x34b7f2){if(_0x34b7f2){return _0x34b7f2?{'count':_0x5e00a4,'rows':_0x34b7f2}:null;}})[_0x87da('0x27')](respondWithResult(_0x386f5f,null))[_0x87da('0x45')](handleError(_0x386f5f,null));};exports[_0x87da('0x54')]=function(_0x26c6e7,_0x138841,_0x2855f0){var _0xd1be74={};var _0x3211e9={};var _0x12924d;var _0xfc1d9d;return db[_0x87da('0x2e')][_0x87da('0x51')]({'where':{'id':_0x26c6e7[_0x87da('0x47')]['id']}})[_0x87da('0x27')](handleEntityNotFound(_0x138841,null))[_0x87da('0x27')](function(_0x741523){if(_0x741523){_0x12924d=_0x741523;_0x3211e9[_0x87da('0x33')]=_[_0x87da('0x36')](db[_0x87da('0x4c')]['rawAttributes']);_0x3211e9[_0x87da('0x35')]=_[_0x87da('0x36')](_0x26c6e7['query']);_0x3211e9['filters']=_[_0x87da('0x37')](_0x3211e9[_0x87da('0x33')],_0x3211e9[_0x87da('0x35')]);_0xd1be74[_0x87da('0x38')]=_[_0x87da('0x37')](_0x3211e9[_0x87da('0x33')],qs[_0x87da('0x48')](_0x26c6e7[_0x87da('0x35')][_0x87da('0x48')]));_0xd1be74[_0x87da('0x38')]=_0xd1be74[_0x87da('0x38')][_0x87da('0x52')]?_0xd1be74['attributes']:_0x3211e9['model'];_0xd1be74[_0x87da('0x4d')]=qs[_0x87da('0x3a')](_0x26c6e7[_0x87da('0x35')][_0x87da('0x3a')]);_0xd1be74[_0x87da('0x3b')]=qs[_0x87da('0x3c')](_[_0x87da('0x4e')](_0x26c6e7['query'],_0x3211e9[_0x87da('0x3c')]));if(_0x26c6e7[_0x87da('0x35')]['filter']){_0xd1be74[_0x87da('0x3b')]=_[_0x87da('0x3d')](_0xd1be74[_0x87da('0x3b')],{'$or':_[_0x87da('0x34')](_0xd1be74[_0x87da('0x38')],function(_0x10cf84){var _0xcaa1c6={};_0xcaa1c6[_0x10cf84]={'$like':'%'+_0x26c6e7[_0x87da('0x35')][_0x87da('0x3f')]+'%'};return _0xcaa1c6;})});}_0xd1be74=_[_0x87da('0x3d')]({},_0xd1be74,_0x26c6e7['options']);return _0x12924d[_0x87da('0x54')](_0xd1be74);}})[_0x87da('0x27')](function(_0x12eb14){if(_0x12eb14){_0xfc1d9d=_0x12eb14['length'];if(!_0x26c6e7[_0x87da('0x35')]['hasOwnProperty'](_0x87da('0x39'))){_0xd1be74[_0x87da('0x1e')]=qs['limit'](_0x26c6e7[_0x87da('0x35')]['limit']);_0xd1be74[_0x87da('0x1c')]=qs[_0x87da('0x1c')](_0x26c6e7[_0x87da('0x35')][_0x87da('0x1c')]);}return _0x12924d[_0x87da('0x54')](_0xd1be74);}})[_0x87da('0x27')](function(_0x4c2283){if(_0x4c2283){return _0x4c2283?{'count':_0xfc1d9d,'rows':_0x4c2283}:null;}})[_0x87da('0x27')](respondWithResult(_0x138841,null))[_0x87da('0x45')](handleError(_0x138841,null));}; \ No newline at end of file +var _0x2630=['count','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','type','merge','VtigerConfiguration','findAll','catch','show','params','rawAttributes','options','find','create','body','getFields','VtigerField','getSubjects','findOne','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit'];(function(_0x44c5af,_0x2d7731){var _0xdd5f2d=function(_0x5ef4d8){while(--_0x5ef4d8){_0x44c5af['push'](_0x44c5af['shift']());}};_0xdd5f2d(++_0x2d7731);}(_0x2630,0x1b9));var _0x0263=function(_0x4eee44,_0x38c25b){_0x4eee44=_0x4eee44-0x0;var _0x49dad9=_0x2630[_0x4eee44];return _0x49dad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0263('0x0'));var zipdir=require(_0x0263('0x1'));var jsonpatch=require(_0x0263('0x2'));var rp=require(_0x0263('0x3'));var moment=require(_0x0263('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0263('0x5'));var util=require(_0x0263('0x6'));var path=require(_0x0263('0x7'));var sox=require(_0x0263('0x8'));var csv=require(_0x0263('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0263('0xa'));var _=require('lodash');var squel=require(_0x0263('0xb'));var crypto=require(_0x0263('0xc'));var jsforce=require(_0x0263('0xd'));var deskjs=require(_0x0263('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0263('0xf'));var Papa=require(_0x0263('0x10'));var Redis=require(_0x0263('0x11'));var authService=require(_0x0263('0x12'));var qs=require(_0x0263('0x13'));var as=require(_0x0263('0x14'));var hardwareService=require(_0x0263('0x15'));var logger=require(_0x0263('0x16'))(_0x0263('0x17'));var utils=require(_0x0263('0x18'));var config=require(_0x0263('0x19'));var licenseUtil=require(_0x0263('0x1a'));var db=require(_0x0263('0x1b'))['db'];function respondWithStatusCode(_0x1c1f2e,_0x510322){_0x510322=_0x510322||0xcc;return function(_0x15cce1){if(_0x15cce1){return _0x1c1f2e[_0x0263('0x1c')](_0x510322);}return _0x1c1f2e[_0x0263('0x1d')](_0x510322)['end']();};}function respondWithResult(_0xc062c8,_0x36e315){_0x36e315=_0x36e315||0xc8;return function(_0x61dc28){if(_0x61dc28){return _0xc062c8[_0x0263('0x1d')](_0x36e315)['json'](_0x61dc28);}};}function respondWithFilteredResult(_0x29b173,_0x165409){return function(_0x45cf76){if(_0x45cf76){var _0x252550=typeof _0x165409[_0x0263('0x1e')]===_0x0263('0x1f')&&typeof _0x165409[_0x0263('0x20')]===_0x0263('0x1f');var _0x654827=_0x45cf76[_0x0263('0x21')];var _0x4f5494=_0x252550?0x0:_0x165409[_0x0263('0x1e')];var _0x2bbcec=_0x252550?_0x45cf76[_0x0263('0x21')]:_0x165409[_0x0263('0x1e')]+_0x165409[_0x0263('0x20')];var _0x5b61ff;if(_0x2bbcec>=_0x654827){_0x2bbcec=_0x654827;_0x5b61ff=0xc8;}else{_0x5b61ff=0xce;}_0x29b173[_0x0263('0x1d')](_0x5b61ff);return _0x29b173[_0x0263('0x22')](_0x0263('0x23'),_0x4f5494+'-'+_0x2bbcec+'/'+_0x654827)['json'](_0x45cf76);}return null;};}function patchUpdates(_0x43bfd1){return function(_0x2b3492){try{jsonpatch['apply'](_0x2b3492,_0x43bfd1,!![]);}catch(_0x17cea2){return BPromise['reject'](_0x17cea2);}return _0x2b3492[_0x0263('0x24')]();};}function saveUpdates(_0x56dc20,_0x5d3033){return function(_0x466191){if(_0x466191){return _0x466191[_0x0263('0x25')](_0x56dc20)[_0x0263('0x26')](function(_0x579433){return _0x579433;});}return null;};}function removeEntity(_0x45059c,_0x397fdd){return function(_0x3567df){if(_0x3567df){return _0x3567df[_0x0263('0x27')]()[_0x0263('0x26')](function(){_0x45059c[_0x0263('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33808f,_0x19e937){return function(_0x417907){if(!_0x417907){_0x33808f[_0x0263('0x1c')](0x194);}return _0x417907;};}function handleError(_0x408807,_0x44fcfe){_0x44fcfe=_0x44fcfe||0x1f4;return function(_0x38e688){logger['error'](_0x38e688[_0x0263('0x28')]);if(_0x38e688[_0x0263('0x29')]){delete _0x38e688[_0x0263('0x29')];}_0x408807[_0x0263('0x1d')](_0x44fcfe)[_0x0263('0x2a')](_0x38e688);};}exports[_0x0263('0x2b')]=function(_0x1b5483,_0x2b8e60){var _0x41c599={},_0x2f63aa={},_0x14e69f={'count':0x0,'rows':[]};var _0x45acc5=_[_0x0263('0x2c')](db['VtigerConfiguration']['rawAttributes'],function(_0x5d9179){return{'name':_0x5d9179[_0x0263('0x2d')],'type':_0x5d9179['type'][_0x0263('0x2e')]};});_0x2f63aa[_0x0263('0x2f')]=_[_0x0263('0x2c')](_0x45acc5,_0x0263('0x29'));_0x2f63aa[_0x0263('0x30')]=_[_0x0263('0x31')](_0x1b5483['query']);_0x2f63aa[_0x0263('0x32')]=_['intersection'](_0x2f63aa[_0x0263('0x2f')],_0x2f63aa[_0x0263('0x30')]);_0x41c599[_0x0263('0x33')]=_[_0x0263('0x34')](_0x2f63aa[_0x0263('0x2f')],qs[_0x0263('0x35')](_0x1b5483['query'][_0x0263('0x35')]));_0x41c599[_0x0263('0x33')]=_0x41c599[_0x0263('0x33')][_0x0263('0x36')]?_0x41c599[_0x0263('0x33')]:_0x2f63aa[_0x0263('0x2f')];if(!_0x1b5483[_0x0263('0x30')]['hasOwnProperty'](_0x0263('0x37'))){_0x41c599[_0x0263('0x20')]=qs[_0x0263('0x20')](_0x1b5483[_0x0263('0x30')]['limit']);_0x41c599[_0x0263('0x1e')]=qs[_0x0263('0x1e')](_0x1b5483[_0x0263('0x30')][_0x0263('0x1e')]);}_0x41c599[_0x0263('0x38')]=qs['sort'](_0x1b5483[_0x0263('0x30')][_0x0263('0x39')]);_0x41c599['where']=qs[_0x0263('0x32')](_[_0x0263('0x3a')](_0x1b5483['query'],_0x2f63aa[_0x0263('0x32')]),_0x45acc5);if(_0x1b5483[_0x0263('0x30')][_0x0263('0x3b')]){_0x41c599['where']=_['merge'](_0x41c599[_0x0263('0x3c')],{'$or':_[_0x0263('0x2c')](_0x45acc5,function(_0x1cf553){if(_0x1cf553[_0x0263('0x3d')]!=='VIRTUAL'){var _0x526e06={};_0x526e06[_0x1cf553[_0x0263('0x29')]]={'$like':'%'+_0x1b5483['query']['filter']+'%'};return _0x526e06;}})});}_0x41c599=_[_0x0263('0x3e')]({},_0x41c599,_0x1b5483['options']);var _0xbf9712={'where':_0x41c599[_0x0263('0x3c')]};return db[_0x0263('0x3f')]['count'](_0xbf9712)[_0x0263('0x26')](function(_0x19df41){_0x14e69f[_0x0263('0x21')]=_0x19df41;if(_0x1b5483[_0x0263('0x30')]['includeAll']){_0x41c599['include']=[{'all':!![]}];}return db[_0x0263('0x3f')][_0x0263('0x40')](_0x41c599);})['then'](function(_0x138a66){_0x14e69f['rows']=_0x138a66;return _0x14e69f;})['then'](respondWithFilteredResult(_0x2b8e60,_0x41c599))[_0x0263('0x41')](handleError(_0x2b8e60,null));};exports[_0x0263('0x42')]=function(_0x20541b,_0x379152){var _0x5c3759={'raw':![],'where':{'id':_0x20541b[_0x0263('0x43')]['id']}},_0x5a8d09={};_0x5a8d09['model']=_[_0x0263('0x31')](db[_0x0263('0x3f')][_0x0263('0x44')]);_0x5a8d09[_0x0263('0x30')]=_[_0x0263('0x31')](_0x20541b['query']);_0x5a8d09[_0x0263('0x32')]=_[_0x0263('0x34')](_0x5a8d09[_0x0263('0x2f')],_0x5a8d09[_0x0263('0x30')]);_0x5c3759[_0x0263('0x33')]=_['intersection'](_0x5a8d09[_0x0263('0x2f')],qs[_0x0263('0x35')](_0x20541b[_0x0263('0x30')]['fields']));_0x5c3759[_0x0263('0x33')]=_0x5c3759[_0x0263('0x33')][_0x0263('0x36')]?_0x5c3759[_0x0263('0x33')]:_0x5a8d09[_0x0263('0x2f')];if(_0x20541b[_0x0263('0x30')]['includeAll']){_0x5c3759['include']=[{'all':!![]}];}_0x5c3759=_[_0x0263('0x3e')]({},_0x5c3759,_0x20541b[_0x0263('0x45')]);return db[_0x0263('0x3f')][_0x0263('0x46')](_0x5c3759)[_0x0263('0x26')](handleEntityNotFound(_0x379152,null))[_0x0263('0x26')](respondWithResult(_0x379152,null))[_0x0263('0x41')](handleError(_0x379152,null));};exports[_0x0263('0x47')]=function(_0x44e417,_0x14b803){return db[_0x0263('0x3f')][_0x0263('0x47')](_0x44e417[_0x0263('0x48')],{})[_0x0263('0x26')](respondWithResult(_0x14b803,0xc9))[_0x0263('0x41')](handleError(_0x14b803,null));};exports[_0x0263('0x25')]=function(_0x42c0a9,_0x50ade6){if(_0x42c0a9['body']['id']){delete _0x42c0a9[_0x0263('0x48')]['id'];}return db[_0x0263('0x3f')][_0x0263('0x46')]({'where':{'id':_0x42c0a9[_0x0263('0x43')]['id']}})[_0x0263('0x26')](handleEntityNotFound(_0x50ade6,null))[_0x0263('0x26')](saveUpdates(_0x42c0a9[_0x0263('0x48')],null))['then'](respondWithResult(_0x50ade6,null))[_0x0263('0x41')](handleError(_0x50ade6,null));};exports[_0x0263('0x27')]=function(_0x3f947a,_0x5a9c7e){return db[_0x0263('0x3f')]['find']({'where':{'id':_0x3f947a[_0x0263('0x43')]['id']}})[_0x0263('0x26')](handleEntityNotFound(_0x5a9c7e,null))[_0x0263('0x26')](removeEntity(_0x5a9c7e,null))[_0x0263('0x41')](handleError(_0x5a9c7e,null));};exports[_0x0263('0x49')]=function(_0x1acbd8,_0x396c09,_0x20354f){var _0x3542de={};var _0x1fe265={};var _0xb81a83;var _0x24715f;return db[_0x0263('0x3f')]['findOne']({'where':{'id':_0x1acbd8[_0x0263('0x43')]['id']}})[_0x0263('0x26')](handleEntityNotFound(_0x396c09,null))[_0x0263('0x26')](function(_0x4da849){if(_0x4da849){_0xb81a83=_0x4da849;_0x1fe265['model']=_[_0x0263('0x31')](db[_0x0263('0x4a')][_0x0263('0x44')]);_0x1fe265[_0x0263('0x30')]=_[_0x0263('0x31')](_0x1acbd8[_0x0263('0x30')]);_0x1fe265[_0x0263('0x32')]=_[_0x0263('0x34')](_0x1fe265[_0x0263('0x2f')],_0x1fe265[_0x0263('0x30')]);_0x3542de[_0x0263('0x33')]=_['intersection'](_0x1fe265['model'],qs[_0x0263('0x35')](_0x1acbd8[_0x0263('0x30')][_0x0263('0x35')]));_0x3542de['attributes']=_0x3542de[_0x0263('0x33')][_0x0263('0x36')]?_0x3542de['attributes']:_0x1fe265['model'];_0x3542de[_0x0263('0x38')]=qs['sort'](_0x1acbd8[_0x0263('0x30')][_0x0263('0x39')]);_0x3542de[_0x0263('0x3c')]=qs['filters'](_['pick'](_0x1acbd8[_0x0263('0x30')],_0x1fe265[_0x0263('0x32')]));if(_0x1acbd8[_0x0263('0x30')][_0x0263('0x3b')]){_0x3542de['where']=_[_0x0263('0x3e')](_0x3542de['where'],{'$or':_[_0x0263('0x2c')](_0x3542de[_0x0263('0x33')],function(_0x249d50){var _0x13e6f2={};_0x13e6f2[_0x249d50]={'$like':'%'+_0x1acbd8[_0x0263('0x30')]['filter']+'%'};return _0x13e6f2;})});}_0x3542de=_[_0x0263('0x3e')]({},_0x3542de,_0x1acbd8['options']);return _0xb81a83[_0x0263('0x49')](_0x3542de);}})['then'](function(_0x51d29e){if(_0x51d29e){_0x24715f=_0x51d29e['length'];if(!_0x1acbd8[_0x0263('0x30')]['hasOwnProperty'](_0x0263('0x37'))){_0x3542de[_0x0263('0x20')]=qs[_0x0263('0x20')](_0x1acbd8['query']['limit']);_0x3542de[_0x0263('0x1e')]=qs[_0x0263('0x1e')](_0x1acbd8['query'][_0x0263('0x1e')]);}return _0xb81a83[_0x0263('0x49')](_0x3542de);}})['then'](function(_0x17b15a){if(_0x17b15a){return _0x17b15a?{'count':_0x24715f,'rows':_0x17b15a}:null;}})[_0x0263('0x26')](respondWithResult(_0x396c09,null))[_0x0263('0x41')](handleError(_0x396c09,null));};exports[_0x0263('0x4b')]=function(_0x1cf2e3,_0x3b2b16,_0x370925){var _0x364103={};var _0x1b5c59={};var _0x11c517;var _0x52e43e;return db['VtigerConfiguration'][_0x0263('0x4c')]({'where':{'id':_0x1cf2e3['params']['id']}})[_0x0263('0x26')](handleEntityNotFound(_0x3b2b16,null))['then'](function(_0x696603){if(_0x696603){_0x11c517=_0x696603;_0x1b5c59['model']=_[_0x0263('0x31')](db[_0x0263('0x4a')][_0x0263('0x44')]);_0x1b5c59[_0x0263('0x30')]=_[_0x0263('0x31')](_0x1cf2e3[_0x0263('0x30')]);_0x1b5c59['filters']=_[_0x0263('0x34')](_0x1b5c59['model'],_0x1b5c59[_0x0263('0x30')]);_0x364103['attributes']=_[_0x0263('0x34')](_0x1b5c59[_0x0263('0x2f')],qs['fields'](_0x1cf2e3[_0x0263('0x30')][_0x0263('0x35')]));_0x364103[_0x0263('0x33')]=_0x364103[_0x0263('0x33')][_0x0263('0x36')]?_0x364103[_0x0263('0x33')]:_0x1b5c59[_0x0263('0x2f')];_0x364103['order']=qs[_0x0263('0x39')](_0x1cf2e3[_0x0263('0x30')]['sort']);_0x364103[_0x0263('0x3c')]=qs[_0x0263('0x32')](_[_0x0263('0x3a')](_0x1cf2e3[_0x0263('0x30')],_0x1b5c59[_0x0263('0x32')]));if(_0x1cf2e3[_0x0263('0x30')][_0x0263('0x3b')]){_0x364103[_0x0263('0x3c')]=_['merge'](_0x364103[_0x0263('0x3c')],{'$or':_[_0x0263('0x2c')](_0x364103[_0x0263('0x33')],function(_0x378cb0){var _0x4ed9b3={};_0x4ed9b3[_0x378cb0]={'$like':'%'+_0x1cf2e3[_0x0263('0x30')][_0x0263('0x3b')]+'%'};return _0x4ed9b3;})});}_0x364103=_[_0x0263('0x3e')]({},_0x364103,_0x1cf2e3[_0x0263('0x45')]);return _0x11c517[_0x0263('0x4b')](_0x364103);}})[_0x0263('0x26')](function(_0x2709d5){if(_0x2709d5){_0x52e43e=_0x2709d5[_0x0263('0x36')];if(!_0x1cf2e3[_0x0263('0x30')][_0x0263('0x4d')](_0x0263('0x37'))){_0x364103['limit']=qs[_0x0263('0x20')](_0x1cf2e3[_0x0263('0x30')][_0x0263('0x20')]);_0x364103[_0x0263('0x1e')]=qs[_0x0263('0x1e')](_0x1cf2e3[_0x0263('0x30')][_0x0263('0x1e')]);}return _0x11c517['getSubjects'](_0x364103);}})[_0x0263('0x26')](function(_0x3a9d0e){if(_0x3a9d0e){return _0x3a9d0e?{'count':_0x52e43e,'rows':_0x3a9d0e}:null;}})[_0x0263('0x26')](respondWithResult(_0x3b2b16,null))[_0x0263('0x41')](handleError(_0x3b2b16,null));};exports['getDescriptions']=function(_0x4246b2,_0x375b81,_0x579d48){var _0x1bbb14={};var _0x559adf={};var _0x3e1374;var _0x1fc571;return db[_0x0263('0x3f')]['findOne']({'where':{'id':_0x4246b2[_0x0263('0x43')]['id']}})[_0x0263('0x26')](handleEntityNotFound(_0x375b81,null))[_0x0263('0x26')](function(_0x156473){if(_0x156473){_0x3e1374=_0x156473;_0x559adf[_0x0263('0x2f')]=_[_0x0263('0x31')](db['VtigerField'][_0x0263('0x44')]);_0x559adf[_0x0263('0x30')]=_[_0x0263('0x31')](_0x4246b2[_0x0263('0x30')]);_0x559adf[_0x0263('0x32')]=_[_0x0263('0x34')](_0x559adf[_0x0263('0x2f')],_0x559adf['query']);_0x1bbb14['attributes']=_[_0x0263('0x34')](_0x559adf[_0x0263('0x2f')],qs[_0x0263('0x35')](_0x4246b2[_0x0263('0x30')][_0x0263('0x35')]));_0x1bbb14['attributes']=_0x1bbb14[_0x0263('0x33')][_0x0263('0x36')]?_0x1bbb14[_0x0263('0x33')]:_0x559adf[_0x0263('0x2f')];_0x1bbb14[_0x0263('0x38')]=qs[_0x0263('0x39')](_0x4246b2[_0x0263('0x30')]['sort']);_0x1bbb14[_0x0263('0x3c')]=qs['filters'](_['pick'](_0x4246b2['query'],_0x559adf['filters']));if(_0x4246b2[_0x0263('0x30')][_0x0263('0x3b')]){_0x1bbb14[_0x0263('0x3c')]=_['merge'](_0x1bbb14[_0x0263('0x3c')],{'$or':_[_0x0263('0x2c')](_0x1bbb14[_0x0263('0x33')],function(_0x20d5e5){var _0x2d5eb3={};_0x2d5eb3[_0x20d5e5]={'$like':'%'+_0x4246b2[_0x0263('0x30')]['filter']+'%'};return _0x2d5eb3;})});}_0x1bbb14=_[_0x0263('0x3e')]({},_0x1bbb14,_0x4246b2[_0x0263('0x45')]);return _0x3e1374[_0x0263('0x4e')](_0x1bbb14);}})['then'](function(_0x8aaaf1){if(_0x8aaaf1){_0x1fc571=_0x8aaaf1[_0x0263('0x36')];if(!_0x4246b2[_0x0263('0x30')][_0x0263('0x4d')](_0x0263('0x37'))){_0x1bbb14[_0x0263('0x20')]=qs[_0x0263('0x20')](_0x4246b2[_0x0263('0x30')][_0x0263('0x20')]);_0x1bbb14['offset']=qs[_0x0263('0x1e')](_0x4246b2['query'][_0x0263('0x1e')]);}return _0x3e1374[_0x0263('0x4e')](_0x1bbb14);}})[_0x0263('0x26')](function(_0x46ba48){if(_0x46ba48){return _0x46ba48?{'count':_0x1fc571,'rows':_0x46ba48}:null;}})[_0x0263('0x26')](respondWithResult(_0x375b81,null))['catch'](handleError(_0x375b81,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e580f1a..1e25a60 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 _0xcb99=['api','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger'];(function(_0x18dee1,_0x2c30fc){var _0x25dbe7=function(_0x4d62ca){while(--_0x4d62ca){_0x18dee1['push'](_0x18dee1['shift']());}};_0x25dbe7(++_0x2c30fc);}(_0xcb99,0x194));var _0x9cb9=function(_0x4a6a4c,_0x5149d1){_0x4a6a4c=_0x4a6a4c-0x0;var _0xdb0e5b=_0xcb99[_0x4a6a4c];return _0xdb0e5b;};'use strict';var _=require(_0x9cb9('0x0'));var util=require(_0x9cb9('0x1'));var logger=require(_0x9cb9('0x2'))(_0x9cb9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9cb9('0x4'));var fs=require('fs');var path=require(_0x9cb9('0x5'));var rimraf=require('rimraf');var config=require(_0x9cb9('0x6'));var attributes=require(_0x9cb9('0x7'));module[_0x9cb9('0x8')]=function(_0x3fef63,_0x1df2d8){return _0x3fef63[_0x9cb9('0x9')](_0x9cb9('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ccf=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations'];(function(_0x230dec,_0x4ef8ea){var _0x5ad73e=function(_0x243d42){while(--_0x243d42){_0x230dec['push'](_0x230dec['shift']());}};_0x5ad73e(++_0x4ef8ea);}(_0x1ccf,0x1a4));var _0xf1cc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1ccf[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf1cc('0x0'));var util=require(_0xf1cc('0x1'));var logger=require('../../config/logger')(_0xf1cc('0x2'));var moment=require(_0xf1cc('0x3'));var BPromise=require(_0xf1cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1cc('0x5'));var rimraf=require(_0xf1cc('0x6'));var config=require(_0xf1cc('0x7'));var attributes=require(_0xf1cc('0x8'));module[_0xf1cc('0x9')]=function(_0x35bcfe,_0x41fa2d){return _0x35bcfe['define'](_0xf1cc('0xa'),attributes,{'tableName':_0xf1cc('0xb'),'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 e2c52aa..f242aba 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 _0x5003=['error','code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x172eff,_0xb7df4b){var _0x28fa44=function(_0x5d4a54){while(--_0x5d4a54){_0x172eff['push'](_0x172eff['shift']());}};_0x28fa44(++_0xb7df4b);}(_0x5003,0x16c));var _0x3500=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5003[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3500('0x0'));var util=require(_0x3500('0x1'));var moment=require(_0x3500('0x2'));var BPromise=require('bluebird');var rs=require(_0x3500('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3500('0x4'))['db'];var utils=require(_0x3500('0x5'));var logger=require(_0x3500('0x6'))(_0x3500('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3500('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48fa05,_0x517c7b,_0x37e9f1){return new BPromise(function(_0x7382fc,_0x4b7cf8){return client[_0x3500('0x9')](_0x48fa05,_0x37e9f1)[_0x3500('0xa')](function(_0x554acc){logger[_0x3500('0xb')](_0x3500('0xc'),_0x517c7b,_0x3500('0xd'));logger[_0x3500('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x517c7b,_0x3500('0xd'),JSON[_0x3500('0xf')](_0x554acc));if(_0x554acc[_0x3500('0x10')]){if(_0x554acc['error'][_0x3500('0x11')]===0x1f4){logger[_0x3500('0x10')](_0x3500('0xc'),_0x517c7b,_0x554acc[_0x3500('0x10')][_0x3500('0x12')]);return _0x4b7cf8(_0x554acc[_0x3500('0x10')]['message']);}logger[_0x3500('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x517c7b,_0x554acc['error'][_0x3500('0x12')]);return _0x7382fc(_0x554acc[_0x3500('0x10')][_0x3500('0x12')]);}else{logger[_0x3500('0xb')](_0x3500('0xc'),_0x517c7b,_0x3500('0xd'));_0x7382fc(_0x554acc['result'][_0x3500('0x12')]);}})['catch'](function(_0x1eb522){logger[_0x3500('0x10')](_0x3500('0xc'),_0x517c7b,_0x1eb522);_0x4b7cf8(_0x1eb522);});});} \ No newline at end of file +var _0x5205=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5205,0x182));var _0x5520=function(_0x3624e7,_0x4ad580){_0x3624e7=_0x3624e7-0x0;var _0x3cfbc0=_0x5205[_0x3624e7];return _0x3cfbc0;};'use strict';var _=require(_0x5520('0x0'));var util=require(_0x5520('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5520('0x2'));var fs=require('fs');var Redis=require(_0x5520('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5520('0x4'));var logger=require(_0x5520('0x5'))(_0x5520('0x6'));var config=require(_0x5520('0x7'));var jayson=require(_0x5520('0x8'));var client=jayson[_0x5520('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b90ca,_0x2873e3,_0x3a2b6e){return new BPromise(function(_0x44d12f,_0x105e6a){return client['request'](_0x4b90ca,_0x3a2b6e)[_0x5520('0xa')](function(_0x5f2a36){logger[_0x5520('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x2873e3,_0x5520('0xc'));logger['debug'](_0x5520('0xd'),_0x2873e3,_0x5520('0xc'),JSON[_0x5520('0xe')](_0x5f2a36));if(_0x5f2a36['error']){if(_0x5f2a36['error'][_0x5520('0xf')]===0x1f4){logger[_0x5520('0x10')](_0x5520('0x11'),_0x2873e3,_0x5f2a36[_0x5520('0x10')]['message']);return _0x105e6a(_0x5f2a36['error']['message']);}logger[_0x5520('0x10')](_0x5520('0x11'),_0x2873e3,_0x5f2a36[_0x5520('0x10')][_0x5520('0x12')]);return _0x44d12f(_0x5f2a36['error'][_0x5520('0x12')]);}else{logger[_0x5520('0xb')](_0x5520('0x11'),_0x2873e3,_0x5520('0xc'));_0x44d12f(_0x5f2a36[_0x5520('0x13')][_0x5520('0x12')]);}})[_0x5520('0x14')](function(_0x2e42d1){logger[_0x5520('0x10')](_0x5520('0x11'),_0x2873e3,_0x2e42d1);_0x105e6a(_0x2e42d1);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 48d1b36..29640fb 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 _0x3f54=['./intVtigerField.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x48bab9,_0x5d3471){var _0xa48e02=function(_0x5e438d){while(--_0x5e438d){_0x48bab9['push'](_0x48bab9['shift']());}};_0xa48e02(++_0x5d3471);}(_0x3f54,0x1ae));var _0x43f5=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x3f54[_0x366388];return _0x41c97e;};'use strict';var multer=require(_0x43f5('0x0'));var util=require(_0x43f5('0x1'));var path=require(_0x43f5('0x2'));var timeout=require(_0x43f5('0x3'));var express=require(_0x43f5('0x4'));var router=express['Router']();var fs_extra=require(_0x43f5('0x5'));var auth=require(_0x43f5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x43f5('0x7'));router[_0x43f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x43f5('0x9')]);router[_0x43f5('0x8')](_0x43f5('0xa'),auth['isAuthenticated'](),controller[_0x43f5('0xb')]);router[_0x43f5('0xc')]('/',auth[_0x43f5('0xd')](),controller[_0x43f5('0xe')]);router[_0x43f5('0xf')](_0x43f5('0xa'),auth[_0x43f5('0xd')](),controller['update']);router[_0x43f5('0x10')](_0x43f5('0xa'),auth[_0x43f5('0xd')](),controller[_0x43f5('0x11')]);module[_0x43f5('0x12')]=router; \ No newline at end of file +var _0x58e8=['multer','util','path','express','fs-extra','./intVtigerField.controller','isAuthenticated','index','get','/:id','post','create','put','exports'];(function(_0x18c855,_0x1838e7){var _0x791c64=function(_0x438f5d){while(--_0x438f5d){_0x18c855['push'](_0x18c855['shift']());}};_0x791c64(++_0x1838e7);}(_0x58e8,0x10a));var _0x858e=function(_0x3ceaff,_0xa0376c){_0x3ceaff=_0x3ceaff-0x0;var _0x52d839=_0x58e8[_0x3ceaff];return _0x52d839;};'use strict';var multer=require(_0x858e('0x0'));var util=require(_0x858e('0x1'));var path=require(_0x858e('0x2'));var timeout=require('connect-timeout');var express=require(_0x858e('0x3'));var router=express['Router']();var fs_extra=require(_0x858e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x858e('0x5'));router['get']('/',auth[_0x858e('0x6')](),controller[_0x858e('0x7')]);router[_0x858e('0x8')](_0x858e('0x9'),auth[_0x858e('0x6')](),controller['show']);router[_0x858e('0xa')]('/',auth['isAuthenticated'](),controller[_0x858e('0xb')]);router[_0x858e('0xc')](_0x858e('0x9'),auth[_0x858e('0x6')](),controller['update']);router['delete'](_0x858e('0x9'),auth[_0x858e('0x6')](),controller['destroy']);module[_0x858e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8fbda8b..082dd38 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 _0x41af=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x41af,0x12c));var _0xf41a=function(_0x1b59b3,_0x580015){_0x1b59b3=_0x1b59b3-0x0;var _0x19de28=_0x41af[_0x1b59b3];return _0x19de28;};'use strict';var Sequelize=require(_0xf41a('0x0'));module[_0xf41a('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf41a('0x2'),_0xf41a('0x3'),_0xf41a('0x4'),'keyValue',_0xf41a('0x5')),'defaultValue':_0xf41a('0x2')},'content':{'type':Sequelize[_0xf41a('0x6')]},'key':{'type':Sequelize[_0xf41a('0x6')]},'keyType':{'type':Sequelize[_0xf41a('0x7')](_0xf41a('0x2'),_0xf41a('0x3'),_0xf41a('0x4'))},'keyContent':{'type':Sequelize[_0xf41a('0x6')]},'idField':{'type':Sequelize[_0xf41a('0x6')]},'nameField':{'type':Sequelize[_0xf41a('0x6')]},'customField':{'type':Sequelize[_0xf41a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf41a('0x6')]}}; \ No newline at end of file +var _0x2351=['STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist'];(function(_0x13bea0,_0x210a0c){var _0x3f12df=function(_0x11ef1c){while(--_0x11ef1c){_0x13bea0['push'](_0x13bea0['shift']());}};_0x3f12df(++_0x210a0c);}(_0x2351,0x162));var _0x1235=function(_0x1e468d,_0x521a90){_0x1e468d=_0x1e468d-0x0;var _0x59fe75=_0x2351[_0x1e468d];return _0x59fe75;};'use strict';var Sequelize=require(_0x1235('0x0'));module['exports']={'type':{'type':Sequelize[_0x1235('0x1')](_0x1235('0x2'),_0x1235('0x3'),'customVariable',_0x1235('0x4'),_0x1235('0x5')),'defaultValue':_0x1235('0x2')},'content':{'type':Sequelize[_0x1235('0x6')]},'key':{'type':Sequelize[_0x1235('0x6')]},'keyType':{'type':Sequelize[_0x1235('0x1')](_0x1235('0x2'),_0x1235('0x3'),_0x1235('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1235('0x6')]},'nameField':{'type':Sequelize[_0x1235('0x6')]},'customField':{'type':Sequelize[_0x1235('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1235('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 764b737..f7140d8 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 _0x3418=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','catch','update','eml-format','rimraf','zip-dir','request-promise','mustache','util','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','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerField','type','key','model','query'];(function(_0x52ad34,_0x232ffe){var _0x449310=function(_0x516202){while(--_0x516202){_0x52ad34['push'](_0x52ad34['shift']());}};_0x449310(++_0x232ffe);}(_0x3418,0x1a7));var _0x8341=function(_0x2af4f8,_0x18b5dc){_0x2af4f8=_0x2af4f8-0x0;var _0x110c95=_0x3418[_0x2af4f8];return _0x110c95;};'use strict';var emlformat=require(_0x8341('0x0'));var rimraf=require(_0x8341('0x1'));var zipdir=require(_0x8341('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8341('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8341('0x4'));var util=require(_0x8341('0x5'));var path=require(_0x8341('0x6'));var sox=require(_0x8341('0x7'));var csv=require(_0x8341('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8341('0x9'));var _=require(_0x8341('0xa'));var squel=require(_0x8341('0xb'));var crypto=require(_0x8341('0xc'));var jsforce=require(_0x8341('0xd'));var deskjs=require(_0x8341('0xe'));var toCsv=require(_0x8341('0x8'));var querystring=require(_0x8341('0xf'));var Papa=require('papaparse');var Redis=require(_0x8341('0x10'));var authService=require(_0x8341('0x11'));var qs=require(_0x8341('0x12'));var as=require(_0x8341('0x13'));var hardwareService=require(_0x8341('0x14'));var logger=require('../../config/logger')(_0x8341('0x15'));var utils=require(_0x8341('0x16'));var config=require(_0x8341('0x17'));var licenseUtil=require(_0x8341('0x18'));var db=require(_0x8341('0x19'))['db'];function respondWithStatusCode(_0x4e77b2,_0x2b288c){_0x2b288c=_0x2b288c||0xcc;return function(_0xe8aa8e){if(_0xe8aa8e){return _0x4e77b2[_0x8341('0x1a')](_0x2b288c);}return _0x4e77b2[_0x8341('0x1b')](_0x2b288c)[_0x8341('0x1c')]();};}function respondWithResult(_0x453296,_0x14fbf0){_0x14fbf0=_0x14fbf0||0xc8;return function(_0x2bb517){if(_0x2bb517){return _0x453296[_0x8341('0x1b')](_0x14fbf0)[_0x8341('0x1d')](_0x2bb517);}};}function respondWithFilteredResult(_0x3f8ac8,_0x2dc7ea){return function(_0xaf2499){if(_0xaf2499){var _0x2a06d7=typeof _0x2dc7ea[_0x8341('0x1e')]===_0x8341('0x1f')&&typeof _0x2dc7ea['limit']===_0x8341('0x1f');var _0x3f7baf=_0xaf2499[_0x8341('0x20')];var _0x38e7f4=_0x2a06d7?0x0:_0x2dc7ea[_0x8341('0x1e')];var _0x3f86ac=_0x2a06d7?_0xaf2499['count']:_0x2dc7ea[_0x8341('0x1e')]+_0x2dc7ea[_0x8341('0x21')];var _0xbdf679;if(_0x3f86ac>=_0x3f7baf){_0x3f86ac=_0x3f7baf;_0xbdf679=0xc8;}else{_0xbdf679=0xce;}_0x3f8ac8[_0x8341('0x1b')](_0xbdf679);return _0x3f8ac8[_0x8341('0x22')](_0x8341('0x23'),_0x38e7f4+'-'+_0x3f86ac+'/'+_0x3f7baf)[_0x8341('0x1d')](_0xaf2499);}return null;};}function patchUpdates(_0x1453fc){return function(_0x1d1b43){try{jsonpatch[_0x8341('0x24')](_0x1d1b43,_0x1453fc,!![]);}catch(_0x173681){return BPromise[_0x8341('0x25')](_0x173681);}return _0x1d1b43[_0x8341('0x26')]();};}function saveUpdates(_0x12ca06,_0x2bf333){return function(_0x4933aa){if(_0x4933aa){return _0x4933aa['update'](_0x12ca06)[_0x8341('0x27')](function(_0x39d4c4){return _0x39d4c4;});}return null;};}function removeEntity(_0x1f222d,_0x29d3f6){return function(_0xa8214b){if(_0xa8214b){return _0xa8214b[_0x8341('0x28')]()[_0x8341('0x27')](function(){_0x1f222d[_0x8341('0x1b')](0xcc)[_0x8341('0x1c')]();});}};}function handleEntityNotFound(_0x1baf05,_0x3b193b){return function(_0x387d9c){if(!_0x387d9c){_0x1baf05[_0x8341('0x1a')](0x194);}return _0x387d9c;};}function handleError(_0x3e8ae6,_0x1cd814){_0x1cd814=_0x1cd814||0x1f4;return function(_0x2f8949){logger['error'](_0x2f8949[_0x8341('0x29')]);if(_0x2f8949['name']){delete _0x2f8949[_0x8341('0x2a')];}_0x3e8ae6[_0x8341('0x1b')](_0x1cd814)[_0x8341('0x2b')](_0x2f8949);};}exports[_0x8341('0x2c')]=function(_0x2935d5,_0x51a8bd){var _0x472be9={},_0x858a00={},_0x4af68d={'count':0x0,'rows':[]};var _0x5d7328=_[_0x8341('0x2d')](db[_0x8341('0x2e')]['rawAttributes'],function(_0x3569b2){return{'name':_0x3569b2['fieldName'],'type':_0x3569b2[_0x8341('0x2f')][_0x8341('0x30')]};});_0x858a00[_0x8341('0x31')]=_[_0x8341('0x2d')](_0x5d7328,_0x8341('0x2a'));_0x858a00[_0x8341('0x32')]=_['keys'](_0x2935d5[_0x8341('0x32')]);_0x858a00[_0x8341('0x33')]=_['intersection'](_0x858a00[_0x8341('0x31')],_0x858a00[_0x8341('0x32')]);_0x472be9[_0x8341('0x34')]=_[_0x8341('0x35')](_0x858a00['model'],qs[_0x8341('0x36')](_0x2935d5[_0x8341('0x32')][_0x8341('0x36')]));_0x472be9[_0x8341('0x34')]=_0x472be9[_0x8341('0x34')][_0x8341('0x37')]?_0x472be9[_0x8341('0x34')]:_0x858a00['model'];if(!_0x2935d5[_0x8341('0x32')][_0x8341('0x38')](_0x8341('0x39'))){_0x472be9[_0x8341('0x21')]=qs[_0x8341('0x21')](_0x2935d5[_0x8341('0x32')]['limit']);_0x472be9[_0x8341('0x1e')]=qs[_0x8341('0x1e')](_0x2935d5[_0x8341('0x32')][_0x8341('0x1e')]);}_0x472be9[_0x8341('0x3a')]=qs[_0x8341('0x3b')](_0x2935d5[_0x8341('0x32')][_0x8341('0x3b')]);_0x472be9[_0x8341('0x3c')]=qs[_0x8341('0x33')](_[_0x8341('0x3d')](_0x2935d5['query'],_0x858a00['filters']),_0x5d7328);if(_0x2935d5[_0x8341('0x32')][_0x8341('0x3e')]){_0x472be9[_0x8341('0x3c')]=_[_0x8341('0x3f')](_0x472be9[_0x8341('0x3c')],{'$or':_['map'](_0x5d7328,function(_0xd67faf){if(_0xd67faf[_0x8341('0x2f')]!==_0x8341('0x40')){var _0x210d8a={};_0x210d8a[_0xd67faf[_0x8341('0x2a')]]={'$like':'%'+_0x2935d5[_0x8341('0x32')]['filter']+'%'};return _0x210d8a;}})});}_0x472be9=_[_0x8341('0x3f')]({},_0x472be9,_0x2935d5[_0x8341('0x41')]);var _0xbe6173={'where':_0x472be9[_0x8341('0x3c')]};return db[_0x8341('0x2e')][_0x8341('0x20')](_0xbe6173)[_0x8341('0x27')](function(_0x4606f6){_0x4af68d[_0x8341('0x20')]=_0x4606f6;if(_0x2935d5[_0x8341('0x32')][_0x8341('0x42')]){_0x472be9[_0x8341('0x43')]=[{'all':!![]}];}return db[_0x8341('0x2e')][_0x8341('0x44')](_0x472be9);})[_0x8341('0x27')](function(_0x89ecaf){_0x4af68d[_0x8341('0x45')]=_0x89ecaf;return _0x4af68d;})[_0x8341('0x27')](respondWithFilteredResult(_0x51a8bd,_0x472be9))['catch'](handleError(_0x51a8bd,null));};exports[_0x8341('0x46')]=function(_0x5befc5,_0x2dac37){var _0x24d84a={'raw':!![],'where':{'id':_0x5befc5[_0x8341('0x47')]['id']}},_0xa8ea2d={};_0xa8ea2d[_0x8341('0x31')]=_[_0x8341('0x48')](db[_0x8341('0x2e')][_0x8341('0x49')]);_0xa8ea2d['query']=_[_0x8341('0x48')](_0x5befc5['query']);_0xa8ea2d[_0x8341('0x33')]=_['intersection'](_0xa8ea2d['model'],_0xa8ea2d[_0x8341('0x32')]);_0x24d84a[_0x8341('0x34')]=_[_0x8341('0x35')](_0xa8ea2d[_0x8341('0x31')],qs[_0x8341('0x36')](_0x5befc5[_0x8341('0x32')][_0x8341('0x36')]));_0x24d84a['attributes']=_0x24d84a[_0x8341('0x34')]['length']?_0x24d84a[_0x8341('0x34')]:_0xa8ea2d['model'];if(_0x5befc5[_0x8341('0x32')][_0x8341('0x42')]){_0x24d84a[_0x8341('0x43')]=[{'all':!![]}];}_0x24d84a=_[_0x8341('0x3f')]({},_0x24d84a,_0x5befc5[_0x8341('0x41')]);return db[_0x8341('0x2e')][_0x8341('0x4a')](_0x24d84a)[_0x8341('0x27')](handleEntityNotFound(_0x2dac37,null))[_0x8341('0x27')](respondWithResult(_0x2dac37,null))['catch'](handleError(_0x2dac37,null));};exports[_0x8341('0x4b')]=function(_0x1774ed,_0x516645){return db[_0x8341('0x2e')][_0x8341('0x4b')](_0x1774ed[_0x8341('0x4c')],{})[_0x8341('0x27')](respondWithResult(_0x516645,0xc9))[_0x8341('0x4d')](handleError(_0x516645,null));};exports[_0x8341('0x4e')]=function(_0x1a6e77,_0x4c63ec){if(_0x1a6e77[_0x8341('0x4c')]['id']){delete _0x1a6e77[_0x8341('0x4c')]['id'];}return db[_0x8341('0x2e')][_0x8341('0x4a')]({'where':{'id':_0x1a6e77[_0x8341('0x47')]['id']}})[_0x8341('0x27')](handleEntityNotFound(_0x4c63ec,null))[_0x8341('0x27')](saveUpdates(_0x1a6e77[_0x8341('0x4c')],null))[_0x8341('0x27')](respondWithResult(_0x4c63ec,null))['catch'](handleError(_0x4c63ec,null));};exports['destroy']=function(_0x49bd01,_0x1fd917){return db['VtigerField'][_0x8341('0x4a')]({'where':{'id':_0x49bd01['params']['id']}})[_0x8341('0x27')](handleEntityNotFound(_0x1fd917,null))['then'](removeEntity(_0x1fd917,null))[_0x8341('0x4d')](handleError(_0x1fd917,null));}; \ No newline at end of file +var _0xb880=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','stack','send','index','map','VtigerField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2000a4,_0x4f23fa){var _0x4152c3=function(_0x47cb5d){while(--_0x47cb5d){_0x2000a4['push'](_0x2000a4['shift']());}};_0x4152c3(++_0x4f23fa);}(_0xb880,0x7b));var _0x0b88=function(_0x426a9f,_0x522dfc){_0x426a9f=_0x426a9f-0x0;var _0xe0166b=_0xb880[_0x426a9f];return _0xe0166b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b88('0x0'));var zipdir=require(_0x0b88('0x1'));var jsonpatch=require(_0x0b88('0x2'));var rp=require(_0x0b88('0x3'));var moment=require(_0x0b88('0x4'));var BPromise=require(_0x0b88('0x5'));var Mustache=require(_0x0b88('0x6'));var util=require('util');var path=require(_0x0b88('0x7'));var sox=require('sox');var csv=require(_0x0b88('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b88('0x9'));var _=require(_0x0b88('0xa'));var squel=require('squel');var crypto=require(_0x0b88('0xb'));var jsforce=require(_0x0b88('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0b88('0x8'));var querystring=require(_0x0b88('0xd'));var Papa=require(_0x0b88('0xe'));var Redis=require(_0x0b88('0xf'));var authService=require(_0x0b88('0x10'));var qs=require(_0x0b88('0x11'));var as=require(_0x0b88('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0b88('0x13'));var licenseUtil=require(_0x0b88('0x14'));var db=require(_0x0b88('0x15'))['db'];function respondWithStatusCode(_0x4fb206,_0x2191bc){_0x2191bc=_0x2191bc||0xcc;return function(_0x59fe7b){if(_0x59fe7b){return _0x4fb206[_0x0b88('0x16')](_0x2191bc);}return _0x4fb206[_0x0b88('0x17')](_0x2191bc)['end']();};}function respondWithResult(_0x1e6280,_0x1b963c){_0x1b963c=_0x1b963c||0xc8;return function(_0xae6f50){if(_0xae6f50){return _0x1e6280[_0x0b88('0x17')](_0x1b963c)[_0x0b88('0x18')](_0xae6f50);}};}function respondWithFilteredResult(_0x3ecd3e,_0x10fa5a){return function(_0x2923d6){if(_0x2923d6){var _0x2a020a=typeof _0x10fa5a[_0x0b88('0x19')]===_0x0b88('0x1a')&&typeof _0x10fa5a[_0x0b88('0x1b')]===_0x0b88('0x1a');var _0x432052=_0x2923d6['count'];var _0x2e9274=_0x2a020a?0x0:_0x10fa5a[_0x0b88('0x19')];var _0x9e714a=_0x2a020a?_0x2923d6[_0x0b88('0x1c')]:_0x10fa5a[_0x0b88('0x19')]+_0x10fa5a[_0x0b88('0x1b')];var _0x3fe3d2;if(_0x9e714a>=_0x432052){_0x9e714a=_0x432052;_0x3fe3d2=0xc8;}else{_0x3fe3d2=0xce;}_0x3ecd3e[_0x0b88('0x17')](_0x3fe3d2);return _0x3ecd3e[_0x0b88('0x1d')]('Content-Range',_0x2e9274+'-'+_0x9e714a+'/'+_0x432052)['json'](_0x2923d6);}return null;};}function patchUpdates(_0x26de9f){return function(_0xc5ad2e){try{jsonpatch[_0x0b88('0x1e')](_0xc5ad2e,_0x26de9f,!![]);}catch(_0x34537a){return BPromise[_0x0b88('0x1f')](_0x34537a);}return _0xc5ad2e[_0x0b88('0x20')]();};}function saveUpdates(_0x4c9ebc,_0x299593){return function(_0x46ab54){if(_0x46ab54){return _0x46ab54[_0x0b88('0x21')](_0x4c9ebc)[_0x0b88('0x22')](function(_0x5ca82e){return _0x5ca82e;});}return null;};}function removeEntity(_0x512fe2,_0x6d55e8){return function(_0x52ec80){if(_0x52ec80){return _0x52ec80['destroy']()[_0x0b88('0x22')](function(){_0x512fe2['status'](0xcc)[_0x0b88('0x23')]();});}};}function handleEntityNotFound(_0x493601,_0x550d84){return function(_0x33634e){if(!_0x33634e){_0x493601[_0x0b88('0x16')](0x194);}return _0x33634e;};}function handleError(_0x2b269e,_0x2a3480){_0x2a3480=_0x2a3480||0x1f4;return function(_0x1c198b){logger['error'](_0x1c198b[_0x0b88('0x24')]);if(_0x1c198b['name']){delete _0x1c198b['name'];}_0x2b269e['status'](_0x2a3480)[_0x0b88('0x25')](_0x1c198b);};}exports[_0x0b88('0x26')]=function(_0x570778,_0x39d152){var _0xfdce7={},_0x2c13c3={},_0x2e38c5={'count':0x0,'rows':[]};var _0x3f9152=_[_0x0b88('0x27')](db[_0x0b88('0x28')]['rawAttributes'],function(_0x12bce8){return{'name':_0x12bce8[_0x0b88('0x29')],'type':_0x12bce8[_0x0b88('0x2a')][_0x0b88('0x2b')]};});_0x2c13c3[_0x0b88('0x2c')]=_[_0x0b88('0x27')](_0x3f9152,'name');_0x2c13c3[_0x0b88('0x2d')]=_[_0x0b88('0x2e')](_0x570778['query']);_0x2c13c3[_0x0b88('0x2f')]=_[_0x0b88('0x30')](_0x2c13c3['model'],_0x2c13c3[_0x0b88('0x2d')]);_0xfdce7[_0x0b88('0x31')]=_[_0x0b88('0x30')](_0x2c13c3['model'],qs[_0x0b88('0x32')](_0x570778[_0x0b88('0x2d')]['fields']));_0xfdce7[_0x0b88('0x31')]=_0xfdce7['attributes'][_0x0b88('0x33')]?_0xfdce7[_0x0b88('0x31')]:_0x2c13c3[_0x0b88('0x2c')];if(!_0x570778[_0x0b88('0x2d')][_0x0b88('0x34')](_0x0b88('0x35'))){_0xfdce7['limit']=qs[_0x0b88('0x1b')](_0x570778['query'][_0x0b88('0x1b')]);_0xfdce7[_0x0b88('0x19')]=qs[_0x0b88('0x19')](_0x570778[_0x0b88('0x2d')][_0x0b88('0x19')]);}_0xfdce7[_0x0b88('0x36')]=qs[_0x0b88('0x37')](_0x570778[_0x0b88('0x2d')][_0x0b88('0x37')]);_0xfdce7[_0x0b88('0x38')]=qs[_0x0b88('0x2f')](_[_0x0b88('0x39')](_0x570778[_0x0b88('0x2d')],_0x2c13c3[_0x0b88('0x2f')]),_0x3f9152);if(_0x570778[_0x0b88('0x2d')][_0x0b88('0x3a')]){_0xfdce7[_0x0b88('0x38')]=_[_0x0b88('0x3b')](_0xfdce7[_0x0b88('0x38')],{'$or':_['map'](_0x3f9152,function(_0xac26cb){if(_0xac26cb[_0x0b88('0x2a')]!=='VIRTUAL'){var _0x292dbb={};_0x292dbb[_0xac26cb[_0x0b88('0x3c')]]={'$like':'%'+_0x570778['query'][_0x0b88('0x3a')]+'%'};return _0x292dbb;}})});}_0xfdce7=_['merge']({},_0xfdce7,_0x570778['options']);var _0x3a19c7={'where':_0xfdce7['where']};return db[_0x0b88('0x28')][_0x0b88('0x1c')](_0x3a19c7)['then'](function(_0x2ceeee){_0x2e38c5[_0x0b88('0x1c')]=_0x2ceeee;if(_0x570778[_0x0b88('0x2d')][_0x0b88('0x3d')]){_0xfdce7[_0x0b88('0x3e')]=[{'all':!![]}];}return db[_0x0b88('0x28')][_0x0b88('0x3f')](_0xfdce7);})[_0x0b88('0x22')](function(_0x3e5628){_0x2e38c5[_0x0b88('0x40')]=_0x3e5628;return _0x2e38c5;})[_0x0b88('0x22')](respondWithFilteredResult(_0x39d152,_0xfdce7))['catch'](handleError(_0x39d152,null));};exports[_0x0b88('0x41')]=function(_0x1ca1ed,_0x1111ef){var _0x4c7dbe={'raw':!![],'where':{'id':_0x1ca1ed[_0x0b88('0x42')]['id']}},_0x1e19cf={};_0x1e19cf['model']=_[_0x0b88('0x2e')](db[_0x0b88('0x28')]['rawAttributes']);_0x1e19cf['query']=_['keys'](_0x1ca1ed[_0x0b88('0x2d')]);_0x1e19cf['filters']=_['intersection'](_0x1e19cf[_0x0b88('0x2c')],_0x1e19cf[_0x0b88('0x2d')]);_0x4c7dbe[_0x0b88('0x31')]=_['intersection'](_0x1e19cf[_0x0b88('0x2c')],qs[_0x0b88('0x32')](_0x1ca1ed[_0x0b88('0x2d')][_0x0b88('0x32')]));_0x4c7dbe[_0x0b88('0x31')]=_0x4c7dbe[_0x0b88('0x31')]['length']?_0x4c7dbe[_0x0b88('0x31')]:_0x1e19cf[_0x0b88('0x2c')];if(_0x1ca1ed[_0x0b88('0x2d')][_0x0b88('0x3d')]){_0x4c7dbe[_0x0b88('0x3e')]=[{'all':!![]}];}_0x4c7dbe=_[_0x0b88('0x3b')]({},_0x4c7dbe,_0x1ca1ed[_0x0b88('0x43')]);return db['VtigerField'][_0x0b88('0x44')](_0x4c7dbe)['then'](handleEntityNotFound(_0x1111ef,null))['then'](respondWithResult(_0x1111ef,null))['catch'](handleError(_0x1111ef,null));};exports[_0x0b88('0x45')]=function(_0x19342f,_0x4fcf98){return db[_0x0b88('0x28')][_0x0b88('0x45')](_0x19342f[_0x0b88('0x46')],{})[_0x0b88('0x22')](respondWithResult(_0x4fcf98,0xc9))[_0x0b88('0x47')](handleError(_0x4fcf98,null));};exports[_0x0b88('0x21')]=function(_0x5f4592,_0xf43f27){if(_0x5f4592[_0x0b88('0x46')]['id']){delete _0x5f4592[_0x0b88('0x46')]['id'];}return db['VtigerField'][_0x0b88('0x44')]({'where':{'id':_0x5f4592['params']['id']}})['then'](handleEntityNotFound(_0xf43f27,null))[_0x0b88('0x22')](saveUpdates(_0x5f4592['body'],null))[_0x0b88('0x22')](respondWithResult(_0xf43f27,null))[_0x0b88('0x47')](handleError(_0xf43f27,null));};exports[_0x0b88('0x48')]=function(_0x2b66ff,_0x238316){return db[_0x0b88('0x28')][_0x0b88('0x44')]({'where':{'id':_0x2b66ff['params']['id']}})[_0x0b88('0x22')](handleEntityNotFound(_0x238316,null))['then'](removeEntity(_0x238316,null))[_0x0b88('0x47')](handleError(_0x238316,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6852df7..0a0b88a 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 _0x96a5=['FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','idField'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0x96a5,0x1a1));var _0x596a=function(_0x476a19,_0x27b512){_0x476a19=_0x476a19-0x0;var _0x3ada4f=_0x96a5[_0x476a19];return _0x3ada4f;};'use strict';var _=require(_0x596a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x596a('0x1'));var moment=require(_0x596a('0x2'));var BPromise=require(_0x596a('0x3'));var rp=require(_0x596a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x596a('0x5'));var config=require(_0x596a('0x6'));var attributes=require(_0x596a('0x7'));module[_0x596a('0x8')]=function(_0x11a099,_0x321a1f){return _0x11a099[_0x596a('0x9')]('VtigerField',attributes,{'tableName':_0x596a('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x596a('0xb'),_0x596a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0e9=['path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','FieldId','lodash','api','moment','request-promise'];(function(_0x2f57ae,_0x5de255){var _0x527574=function(_0x321df4){while(--_0x321df4){_0x2f57ae['push'](_0x2f57ae['shift']());}};_0x527574(++_0x5de255);}(_0xc0e9,0x1d0));var _0x9c0e=function(_0x43eaaa,_0x44da75){_0x43eaaa=_0x43eaaa-0x0;var _0xf36c7b=_0xc0e9[_0x43eaaa];return _0xf36c7b;};'use strict';var _=require(_0x9c0e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9c0e('0x1'));var moment=require(_0x9c0e('0x2'));var BPromise=require('bluebird');var rp=require(_0x9c0e('0x3'));var fs=require('fs');var path=require(_0x9c0e('0x4'));var rimraf=require(_0x9c0e('0x5'));var config=require(_0x9c0e('0x6'));var attributes=require(_0x9c0e('0x7'));module['exports']=function(_0x3fa6e5,_0x342e6b){return _0x3fa6e5[_0x9c0e('0x8')](_0x9c0e('0x9'),attributes,{'tableName':_0x9c0e('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x9c0e('0xb')],'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 f915fc0..fa18a42 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 _0xcad9=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d69a6,_0x44cbe8){var _0x56739a=function(_0x50cc2c){while(--_0x50cc2c){_0x4d69a6['push'](_0x4d69a6['shift']());}};_0x56739a(++_0x44cbe8);}(_0xcad9,0x7b));var _0x9cad=function(_0x45460b,_0x3d883f){_0x45460b=_0x45460b-0x0;var _0x1edaa2=_0xcad9[_0x45460b];return _0x1edaa2;};'use strict';var _=require(_0x9cad('0x0'));var util=require(_0x9cad('0x1'));var moment=require(_0x9cad('0x2'));var BPromise=require(_0x9cad('0x3'));var rs=require(_0x9cad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cad('0x5'))['db'];var utils=require(_0x9cad('0x6'));var logger=require(_0x9cad('0x7'))(_0x9cad('0x8'));var config=require(_0x9cad('0x9'));var jayson=require(_0x9cad('0xa'));var client=jayson['client'][_0x9cad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5df78e,_0x39a567,_0x3a4817){return new BPromise(function(_0x3c56ae,_0x5324a7){return client['request'](_0x5df78e,_0x3a4817)[_0x9cad('0xc')](function(_0x1c1b3d){logger[_0x9cad('0xd')](_0x9cad('0xe'),_0x39a567,_0x9cad('0xf'));logger[_0x9cad('0x10')](_0x9cad('0x11'),_0x39a567,'request\x20sent',JSON[_0x9cad('0x12')](_0x1c1b3d));if(_0x1c1b3d[_0x9cad('0x13')]){if(_0x1c1b3d[_0x9cad('0x13')][_0x9cad('0x14')]===0x1f4){logger['error'](_0x9cad('0xe'),_0x39a567,_0x1c1b3d['error']['message']);return _0x5324a7(_0x1c1b3d[_0x9cad('0x13')][_0x9cad('0x15')]);}logger[_0x9cad('0x13')](_0x9cad('0xe'),_0x39a567,_0x1c1b3d[_0x9cad('0x13')][_0x9cad('0x15')]);return _0x3c56ae(_0x1c1b3d[_0x9cad('0x13')][_0x9cad('0x15')]);}else{logger[_0x9cad('0xd')]('VtigerField,\x20%s,\x20%s',_0x39a567,_0x9cad('0xf'));_0x3c56ae(_0x1c1b3d[_0x9cad('0x16')][_0x9cad('0x15')]);}})[_0x9cad('0x17')](function(_0x198827){logger[_0x9cad('0x13')]('VtigerField,\x20%s,\x20%s',_0x39a567,_0x198827);_0x5324a7(_0x198827);});});} \ No newline at end of file +var _0x4119=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x3d9146,_0x419f9e){var _0x501319=function(_0x1e5238){while(--_0x1e5238){_0x3d9146['push'](_0x3d9146['shift']());}};_0x501319(++_0x419f9e);}(_0x4119,0xfa));var _0x9411=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x4119[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x9411('0x0'));var util=require(_0x9411('0x1'));var moment=require(_0x9411('0x2'));var BPromise=require(_0x9411('0x3'));var rs=require(_0x9411('0x4'));var fs=require('fs');var Redis=require(_0x9411('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9411('0x6'));var logger=require(_0x9411('0x7'))('rpc');var config=require(_0x9411('0x8'));var jayson=require(_0x9411('0x9'));var client=jayson[_0x9411('0xa')][_0x9411('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x318510,_0x3fd5fa,_0x5f1fb7){return new BPromise(function(_0x9e2af3,_0x7251ff){return client[_0x9411('0xc')](_0x318510,_0x5f1fb7)['then'](function(_0x1aaeb9){logger[_0x9411('0xd')](_0x9411('0xe'),_0x3fd5fa,_0x9411('0xf'));logger[_0x9411('0x10')](_0x9411('0x11'),_0x3fd5fa,_0x9411('0xf'),JSON['stringify'](_0x1aaeb9));if(_0x1aaeb9[_0x9411('0x12')]){if(_0x1aaeb9['error'][_0x9411('0x13')]===0x1f4){logger[_0x9411('0x12')](_0x9411('0xe'),_0x3fd5fa,_0x1aaeb9['error'][_0x9411('0x14')]);return _0x7251ff(_0x1aaeb9[_0x9411('0x12')][_0x9411('0x14')]);}logger[_0x9411('0x12')](_0x9411('0xe'),_0x3fd5fa,_0x1aaeb9['error'][_0x9411('0x14')]);return _0x9e2af3(_0x1aaeb9['error'][_0x9411('0x14')]);}else{logger[_0x9411('0xd')](_0x9411('0xe'),_0x3fd5fa,_0x9411('0xf'));_0x9e2af3(_0x1aaeb9[_0x9411('0x15')][_0x9411('0x14')]);}})['catch'](function(_0x32013c){logger[_0x9411('0x12')](_0x9411('0xe'),_0x3fd5fa,_0x32013c);_0x7251ff(_0x32013c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 7720d1a..fe8ec79 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 _0x4496=['get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x25d8f4,_0x344f68){var _0x446eb2=function(_0x3ea8e3){while(--_0x3ea8e3){_0x25d8f4['push'](_0x25d8f4['shift']());}};_0x446eb2(++_0x344f68);}(_0x4496,0x1c1));var _0x6449=function(_0x461e50,_0x17c077){_0x461e50=_0x461e50-0x0;var _0x1f1197=_0x4496[_0x461e50];return _0x1f1197;};'use strict';var multer=require(_0x6449('0x0'));var util=require(_0x6449('0x1'));var path=require(_0x6449('0x2'));var timeout=require(_0x6449('0x3'));var express=require(_0x6449('0x4'));var router=express['Router']();var fs_extra=require(_0x6449('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6449('0x6'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x6449('0x7')](),controller[_0x6449('0x8')]);router['get'](_0x6449('0x9'),auth[_0x6449('0x7')](),controller[_0x6449('0xa')]);router[_0x6449('0xb')](_0x6449('0xc'),auth[_0x6449('0x7')](),controller[_0x6449('0xd')]);router[_0x6449('0xb')]('/:id/fields',auth[_0x6449('0x7')](),controller[_0x6449('0xe')]);router[_0x6449('0xf')]('/',auth['isAuthenticated'](),controller[_0x6449('0x10')]);router[_0x6449('0xf')](_0x6449('0xc'),auth[_0x6449('0x7')](),controller[_0x6449('0x11')]);router[_0x6449('0x12')]('/:id',auth[_0x6449('0x7')](),controller[_0x6449('0x13')]);router[_0x6449('0x14')](_0x6449('0x9'),auth[_0x6449('0x7')](),controller[_0x6449('0x15')]);module[_0x6449('0x16')]=router; \ No newline at end of file +var _0x8a82=['Router','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x4afc33,_0xc18955){var _0x5bfdef=function(_0x48587c){while(--_0x48587c){_0x4afc33['push'](_0x4afc33['shift']());}};_0x5bfdef(++_0xc18955);}(_0x8a82,0x70));var _0x28a8=function(_0x277066,_0x54cc60){_0x277066=_0x277066-0x0;var _0x380245=_0x8a82[_0x277066];return _0x380245;};'use strict';var multer=require(_0x28a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x28a8('0x1'));var express=require(_0x28a8('0x2'));var router=express[_0x28a8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x28a8('0x4'));var config=require('../../config/environment');var controller=require(_0x28a8('0x5'));router[_0x28a8('0x6')]('/',auth[_0x28a8('0x7')](),controller[_0x28a8('0x8')]);router[_0x28a8('0x6')](_0x28a8('0x9'),auth[_0x28a8('0x7')](),controller[_0x28a8('0xa')]);router[_0x28a8('0x6')](_0x28a8('0xb'),auth[_0x28a8('0x7')](),controller[_0x28a8('0xc')]);router[_0x28a8('0x6')](_0x28a8('0xd'),auth[_0x28a8('0x7')](),controller[_0x28a8('0xe')]);router[_0x28a8('0xf')]('/',auth['isAuthenticated'](),controller[_0x28a8('0x10')]);router[_0x28a8('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x28a8('0x11')]);router[_0x28a8('0x12')](_0x28a8('0x9'),auth['isAuthenticated'](),controller[_0x28a8('0x13')]);router[_0x28a8('0x14')](_0x28a8('0x9'),auth[_0x28a8('0x7')](),controller[_0x28a8('0x15')]);module[_0x28a8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index cca2fb1..9f89d39 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 _0xf2e3=['integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','token','password'];(function(_0x482396,_0x2c242b){var _0x50bc94=function(_0x561651){while(--_0x561651){_0x482396['push'](_0x482396['shift']());}};_0x50bc94(++_0x2c242b);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf2e3[_0x525c7b];return _0x27b33e;};'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')},'password':{'type':Sequelize[_0x3f2e('0x1')]},'token':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'authType':{'type':Sequelize[_0x3f2e('0x4')]('password',_0x3f2e('0x5')),'defaultValue':_0x3f2e('0x6')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3f2e('0x4')](_0x3f2e('0x7'),_0x3f2e('0x8')),'defaultValue':_0x3f2e('0x7')}}; \ No newline at end of file +var _0x6c45=['username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x293c3b,_0x51bea3){var _0x8401a2=function(_0x48354c){while(--_0x48354c){_0x293c3b['push'](_0x293c3b['shift']());}};_0x8401a2(++_0x51bea3);}(_0x6c45,0xb1));var _0x56c4=function(_0x1310f6,_0x4f0baa){_0x1310f6=_0x1310f6-0x0;var _0xe24909=_0x6c45[_0x1310f6];return _0xe24909;};'use strict';var Sequelize=require(_0x56c4('0x0'));module[_0x56c4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56c4('0x2')]},'username':{'type':Sequelize[_0x56c4('0x2')],'unique':_0x56c4('0x3')},'password':{'type':Sequelize[_0x56c4('0x2')]},'token':{'type':Sequelize[_0x56c4('0x2')]},'remoteUri':{'type':Sequelize[_0x56c4('0x2')],'unique':_0x56c4('0x4')},'authType':{'type':Sequelize[_0x56c4('0x5')](_0x56c4('0x6'),_0x56c4('0x7')),'defaultValue':_0x56c4('0x6')},'serverUrl':{'type':Sequelize[_0x56c4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x56c4('0x5')](_0x56c4('0x8'),_0x56c4('0x9')),'defaultValue':_0x56c4('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index cb6e9f9..edf29fd 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 _0x02ce=['sendStatus','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','show','params','length','merge','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','channel','getDescriptions','Subjects','ZendeskField','Descriptions','username','password','authType','remoteUri','GET','format','%s/%s','ticket_fields','headers','toString','base64','%s/token:%s','token','Sequelize','ValidationError','subject','description','group','assignee','remove','title','position','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','limit','undefined','count','set','reject','update','then','destroy'];(function(_0x4e372f,_0xceb8ef){var _0x2de1b9=function(_0x5c54e9){while(--_0x5c54e9){_0x4e372f['push'](_0x4e372f['shift']());}};_0x2de1b9(++_0xceb8ef);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5a5e62,_0x2da752){_0x5a5e62=_0x5a5e62-0x0;var _0x2bb129=_0x02ce[_0x5a5e62];return _0x2bb129;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];var integrations=require(_0xe02c('0x1c'));function respondWithStatusCode(_0x32fc45,_0x5d6d13){_0x5d6d13=_0x5d6d13||0xcc;return function(_0x43079c){if(_0x43079c){return _0x32fc45['sendStatus'](_0x5d6d13);}return _0x32fc45['status'](_0x5d6d13)[_0xe02c('0x1d')]();};}function respondWithResult(_0x56405a,_0x221910){_0x221910=_0x221910||0xc8;return function(_0x59614c){if(_0x59614c){return _0x56405a[_0xe02c('0x1e')](_0x221910)['json'](_0x59614c);}};}function respondWithFilteredResult(_0x256311,_0x366893){return function(_0x59f2f6){if(_0x59f2f6){var _0x10a2a6=typeof _0x366893[_0xe02c('0x1f')]==='undefined'&&typeof _0x366893[_0xe02c('0x20')]===_0xe02c('0x21');var _0x5a4583=_0x59f2f6['count'];var _0x3e37bf=_0x10a2a6?0x0:_0x366893['offset'];var _0x1f8f37=_0x10a2a6?_0x59f2f6[_0xe02c('0x22')]:_0x366893[_0xe02c('0x1f')]+_0x366893[_0xe02c('0x20')];var _0x3898dc;if(_0x1f8f37>=_0x5a4583){_0x1f8f37=_0x5a4583;_0x3898dc=0xc8;}else{_0x3898dc=0xce;}_0x256311['status'](_0x3898dc);return _0x256311[_0xe02c('0x23')]('Content-Range',_0x3e37bf+'-'+_0x1f8f37+'/'+_0x5a4583)['json'](_0x59f2f6);}return null;};}function patchUpdates(_0x393621){return function(_0x4514ac){try{jsonpatch['apply'](_0x4514ac,_0x393621,!![]);}catch(_0x3fe8f7){return BPromise[_0xe02c('0x24')](_0x3fe8f7);}return _0x4514ac['save']();};}function saveUpdates(_0x38dce2,_0x45fd82){return function(_0x39b00c){if(_0x39b00c){return _0x39b00c[_0xe02c('0x25')](_0x38dce2)[_0xe02c('0x26')](function(_0x557142){return _0x557142;});}return null;};}function removeEntity(_0x3e80e3,_0xf41d4c){return function(_0xeae877){if(_0xeae877){return _0xeae877[_0xe02c('0x27')]()[_0xe02c('0x26')](function(){_0x3e80e3['status'](0xcc)[_0xe02c('0x1d')]();});}};}function handleEntityNotFound(_0x4411d8,_0x3592ca){return function(_0x14ffba){if(!_0x14ffba){_0x4411d8[_0xe02c('0x28')](0x194);}return _0x14ffba;};}function handleError(_0x303d24,_0x43dc78){_0x43dc78=_0x43dc78||0x1f4;return function(_0x1c14d6){logger['error'](_0x1c14d6[_0xe02c('0x29')]);if(_0x1c14d6[_0xe02c('0x2a')]){delete _0x1c14d6[_0xe02c('0x2a')];}_0x303d24['status'](_0x43dc78)[_0xe02c('0x2b')](_0x1c14d6);};}exports[_0xe02c('0x2c')]=function(_0x445421,_0x287f7e){var _0x1e7eab={},_0x35a309={},_0x22a285={'count':0x0,'rows':[]};var _0x1b8f21=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x5a2da0){return{'name':_0x5a2da0[_0xe02c('0x30')],'type':_0x5a2da0[_0xe02c('0x31')][_0xe02c('0x32')]};});_0x35a309[_0xe02c('0x33')]=_[_0xe02c('0x2d')](_0x1b8f21,_0xe02c('0x2a'));_0x35a309['query']=_[_0xe02c('0x34')](_0x445421[_0xe02c('0x35')]);_0x35a309['filters']=_[_0xe02c('0x36')](_0x35a309[_0xe02c('0x33')],_0x35a309[_0xe02c('0x35')]);_0x1e7eab[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35a309['model'],qs['fields'](_0x445421[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1e7eab['attributes']=_0x1e7eab[_0xe02c('0x37')]['length']?_0x1e7eab[_0xe02c('0x37')]:_0x35a309[_0xe02c('0x33')];if(!_0x445421[_0xe02c('0x35')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1e7eab['limit']=qs[_0xe02c('0x20')](_0x445421['query'][_0xe02c('0x20')]);_0x1e7eab[_0xe02c('0x1f')]=qs[_0xe02c('0x1f')](_0x445421[_0xe02c('0x35')][_0xe02c('0x1f')]);}_0x1e7eab[_0xe02c('0x3b')]=qs['sort'](_0x445421[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1e7eab['where']=qs[_0xe02c('0x3d')](_[_0xe02c('0x3e')](_0x445421['query'],_0x35a309[_0xe02c('0x3d')]),_0x1b8f21);if(_0x445421['query'][_0xe02c('0x3f')]){_0x1e7eab[_0xe02c('0x40')]=_['merge'](_0x1e7eab[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1b8f21,function(_0x2502c8){if(_0x2502c8[_0xe02c('0x31')]!==_0xe02c('0x41')){var _0x28922a={};_0x28922a[_0x2502c8['name']]={'$like':'%'+_0x445421[_0xe02c('0x35')]['filter']+'%'};return _0x28922a;}})});}_0x1e7eab=_['merge']({},_0x1e7eab,_0x445421[_0xe02c('0x42')]);var _0x1095fb={'where':_0x1e7eab[_0xe02c('0x40')]};return db[_0xe02c('0x2e')]['count'](_0x1095fb)[_0xe02c('0x26')](function(_0x17830e){_0x22a285[_0xe02c('0x22')]=_0x17830e;if(_0x445421['query']['includeAll']){_0x1e7eab[_0xe02c('0x43')]=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x44')](_0x1e7eab);})[_0xe02c('0x26')](function(_0x1b0876){_0x22a285[_0xe02c('0x45')]=_0x1b0876;return _0x22a285;})[_0xe02c('0x26')](respondWithFilteredResult(_0x287f7e,_0x1e7eab))[_0xe02c('0x46')](handleError(_0x287f7e,null));};exports[_0xe02c('0x47')]=function(_0x53d123,_0xc7e935){var _0x5ef4a1={'raw':![],'where':{'id':_0x53d123[_0xe02c('0x48')]['id']}},_0x4d4be5={};_0x4d4be5[_0xe02c('0x33')]=_[_0xe02c('0x34')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x4d4be5[_0xe02c('0x35')]=_[_0xe02c('0x34')](_0x53d123[_0xe02c('0x35')]);_0x4d4be5['filters']=_['intersection'](_0x4d4be5[_0xe02c('0x33')],_0x4d4be5[_0xe02c('0x35')]);_0x5ef4a1[_0xe02c('0x37')]=_['intersection'](_0x4d4be5[_0xe02c('0x33')],qs[_0xe02c('0x38')](_0x53d123[_0xe02c('0x35')][_0xe02c('0x38')]));_0x5ef4a1[_0xe02c('0x37')]=_0x5ef4a1[_0xe02c('0x37')][_0xe02c('0x49')]?_0x5ef4a1[_0xe02c('0x37')]:_0x4d4be5[_0xe02c('0x33')];if(_0x53d123[_0xe02c('0x35')]['includeAll']){_0x5ef4a1[_0xe02c('0x43')]=[{'all':!![]}];}_0x5ef4a1=_[_0xe02c('0x4a')]({},_0x5ef4a1,_0x53d123[_0xe02c('0x42')]);return db[_0xe02c('0x2e')][_0xe02c('0x4b')](_0x5ef4a1)[_0xe02c('0x26')](handleEntityNotFound(_0xc7e935,null))[_0xe02c('0x26')](respondWithResult(_0xc7e935,null))[_0xe02c('0x46')](handleError(_0xc7e935,null));};exports[_0xe02c('0x4c')]=function(_0x1176c9,_0xfed475){return db[_0xe02c('0x2e')][_0xe02c('0x4c')](_0x1176c9['body'],{})[_0xe02c('0x26')](respondWithResult(_0xfed475,0xc9))['catch'](handleError(_0xfed475,null));};exports[_0xe02c('0x25')]=function(_0x324911,_0x45a6df){if(_0x324911[_0xe02c('0x4d')]['id']){delete _0x324911[_0xe02c('0x4d')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x4b')]({'where':{'id':_0x324911[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x45a6df,null))[_0xe02c('0x26')](saveUpdates(_0x324911['body'],null))[_0xe02c('0x26')](respondWithResult(_0x45a6df,null))[_0xe02c('0x46')](handleError(_0x45a6df,null));};exports[_0xe02c('0x27')]=function(_0x536cf7,_0xdab6cb){return db['ZendeskAccount'][_0xe02c('0x4b')]({'where':{'id':_0x536cf7['params']['id']}})['then'](handleEntityNotFound(_0xdab6cb,null))['then'](removeEntity(_0xdab6cb,null))['catch'](handleError(_0xdab6cb,null));};exports['getConfigurations']=function(_0x5740df,_0x107f3f,_0x3ac0a5){var _0x1510aa={};var _0x35fbe2={};var _0x5d963d;var _0x274beb;return db[_0xe02c('0x2e')]['findOne']({'where':{'id':_0x5740df[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x107f3f,null))[_0xe02c('0x26')](function(_0x51f940){if(_0x51f940){_0x5d963d=_0x51f940;_0x35fbe2['model']=_[_0xe02c('0x34')](db[_0xe02c('0x4e')][_0xe02c('0x2f')]);_0x35fbe2['query']=_[_0xe02c('0x34')](_0x5740df['query']);_0x35fbe2['filters']=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],_0x35fbe2['query']);_0x1510aa[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],qs['fields'](_0x5740df[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1510aa['attributes']=_0x1510aa[_0xe02c('0x37')][_0xe02c('0x49')]?_0x1510aa[_0xe02c('0x37')]:_0x35fbe2[_0xe02c('0x33')];_0x1510aa[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1510aa[_0xe02c('0x40')]=qs['filters'](_['pick'](_0x5740df['query'],_0x35fbe2[_0xe02c('0x3d')]));if(_0x5740df[_0xe02c('0x35')][_0xe02c('0x3f')]){_0x1510aa['where']=_['merge'](_0x1510aa[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1510aa[_0xe02c('0x37')],function(_0xb50cfa){var _0xe02798={};_0xe02798[_0xb50cfa]={'$like':'%'+_0x5740df['query'][_0xe02c('0x3f')]+'%'};return _0xe02798;})});}_0x1510aa=_[_0xe02c('0x4a')]({},_0x1510aa,_0x5740df['options']);return _0x5d963d['getConfigurations'](_0x1510aa);}})[_0xe02c('0x26')](function(_0x566204){if(_0x566204){_0x274beb=_0x566204['length'];if(!_0x5740df['query'][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1510aa[_0xe02c('0x20')]=qs[_0xe02c('0x20')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x20')]);_0x1510aa['offset']=qs[_0xe02c('0x1f')](_0x5740df['query']['offset']);}return _0x5d963d[_0xe02c('0x4f')](_0x1510aa);}})[_0xe02c('0x26')](function(_0x44ba68){if(_0x44ba68){return _0x44ba68?{'count':_0x274beb,'rows':_0x44ba68}:null;}})[_0xe02c('0x26')](respondWithResult(_0x107f3f,null))['catch'](handleError(_0x107f3f,null));};exports[_0xe02c('0x50')]=function(_0x31c287,_0x5d2119,_0xa7133f){if(_0x31c287[_0xe02c('0x4d')]['id']){delete _0x31c287['body']['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x31c287[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x5d2119,null))[_0xe02c('0x26')](function(_0x3a62a2){if(_0x3a62a2){_0x31c287[_0xe02c('0x4d')]['AccountId']=_0x3a62a2['id'];_0x31c287[_0xe02c('0x4d')]['Subjects']=integrations['getSubjects'](_0x31c287['body'][_0xe02c('0x52')],_0x31c287[_0xe02c('0x4d')][_0xe02c('0x31')]);_0x31c287[_0xe02c('0x4d')]['Descriptions']=integrations[_0xe02c('0x53')](_0x31c287[_0xe02c('0x4d')]['channel'],_0x31c287['body']['type']);return db[_0xe02c('0x4e')][_0xe02c('0x4c')](_0x31c287['body'],{'include':[{'model':db['ZendeskField'],'as':_0xe02c('0x54')},{'model':db[_0xe02c('0x55')],'as':_0xe02c('0x56')}]});}return null;})[_0xe02c('0x26')](respondWithResult(_0x5d2119,null))[_0xe02c('0x46')](handleError(_0x5d2119,null));};exports['getFields']=function(_0x39c7db,_0x12ac9f,_0x3f277b){var _0x2776c0='';return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x39c7db['params']['id']},'attributes':['id',_0xe02c('0x57'),_0xe02c('0x58'),'token',_0xe02c('0x59'),_0xe02c('0x5a')]})[_0xe02c('0x26')](handleEntityNotFound(_0x12ac9f,null))[_0xe02c('0x26')](function(_0x5d2455){if(_0x5d2455){_0x2776c0=_0x5d2455[_0xe02c('0x5a')];var _0x2229ae=_0x2776c0['slice'](-0x1);if(_0x2229ae==='/'){_0x2776c0=_0x2776c0['substring'](0x0,_0x2776c0['lastIndexOf'](_0x2229ae));}var _0x43977c={'method':_0xe02c('0x5b'),'uri':util[_0xe02c('0x5c')](_0xe02c('0x5d'),_0x2776c0,_0xe02c('0x5e')),'json':!![]};switch(_0x5d2455['authType']){case _0xe02c('0x58'):_0x43977c[_0xe02c('0x5f')]={'Authorization':util[_0xe02c('0x5c')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x58')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;case'token':_0x43977c[_0xe02c('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe02c('0x5c')](_0xe02c('0x62'),_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x63')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;default:throw new db[(_0xe02c('0x64'))][(_0xe02c('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x43977c);}})[_0xe02c('0x26')](function(_0x21049f){if(_0x21049f){var _0x2386cf=[_0xe02c('0x66'),_0xe02c('0x67'),_0xe02c('0x68'),_0xe02c('0x69')];_[_0xe02c('0x6a')](_0x21049f[_0xe02c('0x5e')],function(_0x411cd5){return _0x2386cf['includes'](_0x411cd5['type']);});return{'count':_0x21049f[_0xe02c('0x5e')][_0xe02c('0x49')],'rows':_[_0xe02c('0x2d')](_0x21049f[_0xe02c('0x5e')],function(_0x108566){return{'id':_0x108566['id'],'name':_0x108566['position']>0x7?_0x108566[_0xe02c('0x6b')]:_0x108566[_0xe02c('0x31')],'custom':_0x108566[_0xe02c('0x6c')]>0x7?!![]:![],'options':_0x108566[_0xe02c('0x6d')]?_0x108566[_0xe02c('0x6d')]:_0x108566[_0xe02c('0x6e')]?_0x108566[_0xe02c('0x6e')]:[]};})};}})[_0xe02c('0x26')](respondWithResult(_0x12ac9f,null))[_0xe02c('0x46')](function(_0x159f58){var _0x287eca=_0x39c7db[_0xe02c('0x35')]['test']?0x1f4:_0x159f58['statusCode']||0x1f4;logger[_0xe02c('0x6f')](_0xe02c('0x70'),'getFields',_0x287eca,JSON[_0xe02c('0x71')](_0x159f58));delete _0x159f58['name'];if(_0x287eca===0x191){_0x287eca=0x190;}_0x12ac9f[_0xe02c('0x1e')](_0x287eca)['send'](_0x39c7db[_0xe02c('0x35')][_0xe02c('0x72')]?{'message':_0xe02c('0x73'),'statusCode':_0x159f58[_0xe02c('0x74')]}:_0x159f58);});}; \ No newline at end of file +var _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','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','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x1b2d05,_0x5b5806){var _0x465420=function(_0x49a8c6){while(--_0x49a8c6){_0x1b2d05['push'](_0x1b2d05['shift']());}};_0x465420(++_0x5b5806);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 20904f2..79881d2 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 _0xee94=['api','bluebird','path','../../config/environment','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger'];(function(_0x37b3ef,_0x49ccd8){var _0x200dbe=function(_0x51bb36){while(--_0x51bb36){_0x37b3ef['push'](_0x37b3ef['shift']());}};_0x200dbe(++_0x49ccd8);}(_0xee94,0xf8));var _0x4ee9=function(_0x395e0f,_0x333eaa){_0x395e0f=_0x395e0f-0x0;var _0x5b42f2=_0xee94[_0x395e0f];return _0x5b42f2;};'use strict';var _=require('lodash');var util=require(_0x4ee9('0x0'));var logger=require(_0x4ee9('0x1'))(_0x4ee9('0x2'));var moment=require('moment');var BPromise=require(_0x4ee9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ee9('0x4'));var rimraf=require('rimraf');var config=require(_0x4ee9('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x4ee9('0x6'));module['exports']=function(_0x545bc6,_0x498abb){return _0x545bc6[_0x4ee9('0x7')](_0x4ee9('0x8'),attributes,{'tableName':_0x4ee9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9819=['rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0x261297,_0x4e3cc1){var _0x210040=function(_0x2be4c2){while(--_0x2be4c2){_0x261297['push'](_0x261297['shift']());}};_0x210040(++_0x4e3cc1);}(_0x9819,0xaf));var _0x9981=function(_0x3e068d,_0x2938f4){_0x3e068d=_0x3e068d-0x0;var _0x24280d=_0x9819[_0x3e068d];return _0x24280d;};'use strict';var _=require(_0x9981('0x0'));var util=require(_0x9981('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9981('0x2'));var BPromise=require(_0x9981('0x3'));var rp=require(_0x9981('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9981('0x5'));var config=require('../../config/environment');var attributes=require(_0x9981('0x6'));var integrations=require(_0x9981('0x7'));module[_0x9981('0x8')]=function(_0x46c669,_0x1ed083){return _0x46c669[_0x9981('0x9')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2a878ff..2590c87 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 _0xf49a=['options','raw','where','attributes','limit','map','include','model','then','GetZendeskAccount','debug','find','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ZendeskAccount','findAll'];(function(_0x37e775,_0x3bb1c6){var _0x3c1ab5=function(_0x2f2077){while(--_0x2f2077){_0x37e775['push'](_0x37e775['shift']());}};_0x3c1ab5(++_0x3bb1c6);}(_0xf49a,0x199));var _0xaf49=function(_0x2e8abe,_0x3504a7){_0x2e8abe=_0x2e8abe-0x0;var _0x2838f9=_0xf49a[_0x2e8abe];return _0x2838f9;};'use strict';var _=require(_0xaf49('0x0'));var util=require(_0xaf49('0x1'));var moment=require(_0xaf49('0x2'));var BPromise=require(_0xaf49('0x3'));var rs=require(_0xaf49('0x4'));var fs=require('fs');var Redis=require(_0xaf49('0x5'));var db=require(_0xaf49('0x6'))['db'];var utils=require(_0xaf49('0x7'));var logger=require(_0xaf49('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaf49('0x9'));var client=jayson['client'][_0xaf49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1092e0,_0x4e67af,_0x23c327){return new BPromise(function(_0x5c7278,_0x29eede){return client[_0xaf49('0xb')](_0x1092e0,_0x23c327)['then'](function(_0x5112a4){logger[_0xaf49('0xc')](_0xaf49('0xd'),_0x4e67af,_0xaf49('0xe'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4e67af,_0xaf49('0xe'),JSON[_0xaf49('0xf')](_0x5112a4));if(_0x5112a4['error']){if(_0x5112a4[_0xaf49('0x10')][_0xaf49('0x11')]===0x1f4){logger[_0xaf49('0x10')](_0xaf49('0xd'),_0x4e67af,_0x5112a4[_0xaf49('0x10')][_0xaf49('0x12')]);return _0x29eede(_0x5112a4[_0xaf49('0x10')][_0xaf49('0x12')]);}logger[_0xaf49('0x10')](_0xaf49('0xd'),_0x4e67af,_0x5112a4[_0xaf49('0x10')][_0xaf49('0x12')]);return _0x5c7278(_0x5112a4['error'][_0xaf49('0x12')]);}else{logger['info'](_0xaf49('0xd'),_0x4e67af,_0xaf49('0xe'));_0x5c7278(_0x5112a4[_0xaf49('0x13')]['message']);}})[_0xaf49('0x14')](function(_0x28a8f5){logger[_0xaf49('0x10')](_0xaf49('0xd'),_0x4e67af,_0x28a8f5);_0x29eede(_0x28a8f5);});});}exports['GetZendeskAccount']=function(_0x3396ca){var _0x2bad59=this;return new Promise(function(_0x2d3a09,_0xc2fd15){return db[_0xaf49('0x15')][_0xaf49('0x16')]({'raw':_0x3396ca[_0xaf49('0x17')]?_0x3396ca[_0xaf49('0x17')][_0xaf49('0x18')]===undefined?!![]:![]:!![],'where':_0x3396ca[_0xaf49('0x17')]?_0x3396ca[_0xaf49('0x17')][_0xaf49('0x19')]||null:null,'attributes':_0x3396ca[_0xaf49('0x17')]?_0x3396ca[_0xaf49('0x17')][_0xaf49('0x1a')]||null:null,'limit':_0x3396ca[_0xaf49('0x17')]?_0x3396ca[_0xaf49('0x17')][_0xaf49('0x1b')]||null:null,'include':_0x3396ca[_0xaf49('0x17')]?_0x3396ca[_0xaf49('0x17')]['include']?_[_0xaf49('0x1c')](_0x3396ca[_0xaf49('0x17')][_0xaf49('0x1d')],function(_0x1b193f){return{'model':db[_0x1b193f[_0xaf49('0x1e')]],'as':_0x1b193f['as'],'attributes':_0x1b193f['attributes'],'include':_0x1b193f[_0xaf49('0x1d')]?_['map'](_0x1b193f[_0xaf49('0x1d')],function(_0xdeb87d){return{'model':db[_0xdeb87d[_0xaf49('0x1e')]],'as':_0xdeb87d['as'],'attributes':_0xdeb87d[_0xaf49('0x1a')],'include':_0xdeb87d['include']?_[_0xaf49('0x1c')](_0xdeb87d[_0xaf49('0x1d')],function(_0x1084b5){return{'model':db[_0x1084b5[_0xaf49('0x1e')]],'as':_0x1084b5['as'],'attributes':_0x1084b5[_0xaf49('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaf49('0x1f')](function(_0x3ae0b8){logger['info'](_0xaf49('0x20'),_0x3396ca);logger[_0xaf49('0x21')](_0xaf49('0x20'),_0x3396ca,JSON[_0xaf49('0xf')](_0x3ae0b8));_0x2d3a09(_0x3ae0b8);})[_0xaf49('0x14')](function(_0x118ed8){logger[_0xaf49('0x10')](_0xaf49('0x20'),_0x118ed8[_0xaf49('0x12')],_0x3396ca);_0xc2fd15(_0x2bad59[_0xaf49('0x10')](0x1f4,_0x118ed8[_0xaf49('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x5be842){var _0x3dcd3b=this;return new Promise(function(_0x6fc5be,_0x4013b8){return db[_0xaf49('0x15')][_0xaf49('0x22')]({'raw':_0x5be842[_0xaf49('0x17')]?_0x5be842[_0xaf49('0x17')][_0xaf49('0x18')]===undefined?!![]:![]:!![],'where':_0x5be842['options']?_0x5be842[_0xaf49('0x17')][_0xaf49('0x19')]||null:null,'attributes':_0x5be842[_0xaf49('0x17')]?_0x5be842[_0xaf49('0x17')][_0xaf49('0x1a')]||null:null,'include':_0x5be842[_0xaf49('0x17')]?_0x5be842[_0xaf49('0x17')][_0xaf49('0x1d')]?_[_0xaf49('0x1c')](_0x5be842[_0xaf49('0x17')][_0xaf49('0x1d')],function(_0x2bba78){return{'model':db[_0x2bba78['model']],'as':_0x2bba78['as'],'attributes':_0x2bba78[_0xaf49('0x1a')],'include':_0x2bba78['include']?_[_0xaf49('0x1c')](_0x2bba78[_0xaf49('0x1d')],function(_0x508fba){return{'model':db[_0x508fba[_0xaf49('0x1e')]],'as':_0x508fba['as'],'attributes':_0x508fba['attributes'],'include':_0x508fba[_0xaf49('0x1d')]?_[_0xaf49('0x1c')](_0x508fba[_0xaf49('0x1d')],function(_0x10ff49){return{'model':db[_0x10ff49[_0xaf49('0x1e')]],'as':_0x10ff49['as'],'attributes':_0x10ff49[_0xaf49('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaf49('0x1f')](function(_0x19afa4){logger[_0xaf49('0xc')](_0xaf49('0x23'),_0x5be842);logger['debug']('ShowZendeskAccount',_0x5be842,JSON[_0xaf49('0xf')](_0x19afa4));_0x6fc5be(_0x19afa4);})['catch'](function(_0xcdb1ca){logger['error'](_0xaf49('0x23'),_0xcdb1ca[_0xaf49('0x12')],_0x5be842);_0x4013b8(_0x3dcd3b[_0xaf49('0x10')](0x1f4,_0xcdb1ca[_0xaf49('0x12')]));});});}; \ No newline at end of file +var _0x9d5c=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','info','catch','findAll','options','raw','limit','include','model','attributes','map','GetZendeskAccount','where','ShowZendeskAccount','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x9d5c,0x98));var _0xc9d5=function(_0x507c19,_0x20dec6){_0x507c19=_0x507c19-0x0;var _0x347609=_0x9d5c[_0x507c19];return _0x347609;};'use strict';var _=require(_0xc9d5('0x0'));var util=require('util');var moment=require(_0xc9d5('0x1'));var BPromise=require(_0xc9d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9d5('0x3'));var db=require(_0xc9d5('0x4'))['db'];var utils=require(_0xc9d5('0x5'));var logger=require('../../config/logger')(_0xc9d5('0x6'));var config=require(_0xc9d5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc9d5('0x8')][_0xc9d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a91f5,_0x955d2d,_0x2edfbc){return new BPromise(function(_0x3a5810,_0x265d56){return client[_0xc9d5('0xa')](_0x1a91f5,_0x2edfbc)[_0xc9d5('0xb')](function(_0x2e0051){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x955d2d,_0xc9d5('0xc'));logger['debug'](_0xc9d5('0xd'),_0x955d2d,_0xc9d5('0xc'),JSON[_0xc9d5('0xe')](_0x2e0051));if(_0x2e0051[_0xc9d5('0xf')]){if(_0x2e0051[_0xc9d5('0xf')][_0xc9d5('0x10')]===0x1f4){logger[_0xc9d5('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x955d2d,_0x2e0051['error']['message']);return _0x265d56(_0x2e0051[_0xc9d5('0xf')][_0xc9d5('0x11')]);}logger[_0xc9d5('0xf')](_0xc9d5('0x12'),_0x955d2d,_0x2e0051['error'][_0xc9d5('0x11')]);return _0x3a5810(_0x2e0051[_0xc9d5('0xf')]['message']);}else{logger[_0xc9d5('0x13')](_0xc9d5('0x12'),_0x955d2d,'request\x20sent');_0x3a5810(_0x2e0051['result'][_0xc9d5('0x11')]);}})[_0xc9d5('0x14')](function(_0xcf1521){logger['error'](_0xc9d5('0x12'),_0x955d2d,_0xcf1521);_0x265d56(_0xcf1521);});});}exports['GetZendeskAccount']=function(_0x3c8441){var _0x37fe94=this;return new Promise(function(_0x3105d2,_0x321956){return db['ZendeskAccount'][_0xc9d5('0x15')]({'raw':_0x3c8441['options']?_0x3c8441[_0xc9d5('0x16')][_0xc9d5('0x17')]===undefined?!![]:![]:!![],'where':_0x3c8441[_0xc9d5('0x16')]?_0x3c8441[_0xc9d5('0x16')]['where']||null:null,'attributes':_0x3c8441[_0xc9d5('0x16')]?_0x3c8441['options']['attributes']||null:null,'limit':_0x3c8441[_0xc9d5('0x16')]?_0x3c8441[_0xc9d5('0x16')][_0xc9d5('0x18')]||null:null,'include':_0x3c8441[_0xc9d5('0x16')]?_0x3c8441[_0xc9d5('0x16')]['include']?_['map'](_0x3c8441[_0xc9d5('0x16')][_0xc9d5('0x19')],function(_0x41cd76){return{'model':db[_0x41cd76[_0xc9d5('0x1a')]],'as':_0x41cd76['as'],'attributes':_0x41cd76[_0xc9d5('0x1b')],'include':_0x41cd76[_0xc9d5('0x19')]?_[_0xc9d5('0x1c')](_0x41cd76[_0xc9d5('0x19')],function(_0x1f2fbb){return{'model':db[_0x1f2fbb[_0xc9d5('0x1a')]],'as':_0x1f2fbb['as'],'attributes':_0x1f2fbb['attributes'],'include':_0x1f2fbb[_0xc9d5('0x19')]?_[_0xc9d5('0x1c')](_0x1f2fbb[_0xc9d5('0x19')],function(_0x2253c5){return{'model':db[_0x2253c5[_0xc9d5('0x1a')]],'as':_0x2253c5['as'],'attributes':_0x2253c5[_0xc9d5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc9d5('0xb')](function(_0x5b411d){logger[_0xc9d5('0x13')](_0xc9d5('0x1d'),_0x3c8441);logger['debug'](_0xc9d5('0x1d'),_0x3c8441,JSON[_0xc9d5('0xe')](_0x5b411d));_0x3105d2(_0x5b411d);})[_0xc9d5('0x14')](function(_0xb219e4){logger[_0xc9d5('0xf')](_0xc9d5('0x1d'),_0xb219e4[_0xc9d5('0x11')],_0x3c8441);_0x321956(_0x37fe94[_0xc9d5('0xf')](0x1f4,_0xb219e4[_0xc9d5('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x1a2417){var _0x41d217=this;return new Promise(function(_0x2f038e,_0x57fb6c){return db['ZendeskAccount']['find']({'raw':_0x1a2417['options']?_0x1a2417[_0xc9d5('0x16')][_0xc9d5('0x17')]===undefined?!![]:![]:!![],'where':_0x1a2417[_0xc9d5('0x16')]?_0x1a2417[_0xc9d5('0x16')][_0xc9d5('0x1e')]||null:null,'attributes':_0x1a2417[_0xc9d5('0x16')]?_0x1a2417['options'][_0xc9d5('0x1b')]||null:null,'include':_0x1a2417[_0xc9d5('0x16')]?_0x1a2417[_0xc9d5('0x16')][_0xc9d5('0x19')]?_['map'](_0x1a2417[_0xc9d5('0x16')][_0xc9d5('0x19')],function(_0x21f130){return{'model':db[_0x21f130[_0xc9d5('0x1a')]],'as':_0x21f130['as'],'attributes':_0x21f130['attributes'],'include':_0x21f130[_0xc9d5('0x19')]?_['map'](_0x21f130[_0xc9d5('0x19')],function(_0x299065){return{'model':db[_0x299065[_0xc9d5('0x1a')]],'as':_0x299065['as'],'attributes':_0x299065['attributes'],'include':_0x299065[_0xc9d5('0x19')]?_[_0xc9d5('0x1c')](_0x299065[_0xc9d5('0x19')],function(_0x5e0e51){return{'model':db[_0x5e0e51[_0xc9d5('0x1a')]],'as':_0x5e0e51['as'],'attributes':_0x5e0e51[_0xc9d5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c40f4){logger[_0xc9d5('0x13')](_0xc9d5('0x1f'),_0x1a2417);logger[_0xc9d5('0x20')](_0xc9d5('0x1f'),_0x1a2417,JSON[_0xc9d5('0xe')](_0x2c40f4));_0x2f038e(_0x2c40f4);})['catch'](function(_0x57c637){logger[_0xc9d5('0xf')]('ShowZendeskAccount',_0x57c637[_0xc9d5('0x11')],_0x1a2417);_0x57fb6c(_0x41d217[_0xc9d5('0xf')](0x1f4,_0x57c637[_0xc9d5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b9c372a..b1d76f5 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x1ba2de,_0x54dc2a){var _0x5d2eda=function(_0x1562df){while(--_0x1562df){_0x1ba2de['push'](_0x1ba2de['shift']());}};_0x5d2eda(++_0x54dc2a);}(_0x4fc2,0x111));var _0x24fc=function(_0x540346,_0x2b2f3a){_0x540346=_0x540346-0x0;var _0x325487=_0x4fc2[_0x540346];return _0x325487;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x53ff26,_0x418e36){var _0x372c29=function(_0x43d951){while(--_0x43d951){_0x53ff26['push'](_0x53ff26['shift']());}};_0x372c29(++_0x418e36);}(_0x0bb5,0x148));var _0x50bb=function(_0x58e0f6,_0x3dcb1c){_0x58e0f6=_0x58e0f6-0x0;var _0x10346f=_0x0bb5[_0x58e0f6];return _0x10346f;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 9fd354c..2e7cf54 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 _0xd93a=['STRING','sequelize','exports'];(function(_0xdd7bcb,_0x54666e){var _0x4b9e8e=function(_0xce2959){while(--_0xce2959){_0xdd7bcb['push'](_0xdd7bcb['shift']());}};_0x4b9e8e(++_0x54666e);}(_0xd93a,0x118));var _0xad93=function(_0x59b60a,_0x33fb0f){_0x59b60a=_0x59b60a-0x0;var _0x30e3c7=_0xd93a[_0x59b60a];return _0x30e3c7;};'use strict';var Sequelize=require(_0xad93('0x0'));module[_0xad93('0x1')]={'name':{'type':Sequelize[_0xad93('0x2')]},'description':{'type':Sequelize[_0xad93('0x2')]}}; \ No newline at end of file +var _0xbca2=['exports','STRING'];(function(_0x192088,_0x2e43a8){var _0x4fd3e0=function(_0x43778b){while(--_0x43778b){_0x192088['push'](_0x192088['shift']());}};_0x4fd3e0(++_0x2e43a8);}(_0xbca2,0x192));var _0x2bca=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xbca2[_0x1ca9e9];return _0x309f3c;};'use strict';var Sequelize=require('sequelize');module[_0x2bca('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2bca('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 44e3914..96afb19 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 _0xf9f4=['order','getFields','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','params','keys','find','create','body','destroy','findOne','ZendeskField'];(function(_0x335f5c,_0xce622c){var _0x27458c=function(_0x108b7f){while(--_0x108b7f){_0x335f5c['push'](_0x335f5c['shift']());}};_0x27458c(++_0xce622c);}(_0xf9f4,0x1b1));var _0x4f9f=function(_0x3e2990,_0x34b176){_0x3e2990=_0x3e2990-0x0;var _0x51a77d=_0xf9f4[_0x3e2990];return _0x51a77d;};'use strict';var emlformat=require(_0x4f9f('0x0'));var rimraf=require(_0x4f9f('0x1'));var zipdir=require(_0x4f9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f9f('0x3'));var moment=require(_0x4f9f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f9f('0x5'));var util=require('util');var path=require(_0x4f9f('0x6'));var sox=require(_0x4f9f('0x7'));var csv=require('to-csv');var ejs=require(_0x4f9f('0x8'));var fs=require('fs');var fs_extra=require(_0x4f9f('0x9'));var _=require(_0x4f9f('0xa'));var squel=require('squel');var crypto=require(_0x4f9f('0xb'));var jsforce=require(_0x4f9f('0xc'));var deskjs=require(_0x4f9f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4f9f('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f9f('0xf'));var authService=require(_0x4f9f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4f9f('0x11'));var hardwareService=require(_0x4f9f('0x12'));var logger=require(_0x4f9f('0x13'))(_0x4f9f('0x14'));var utils=require('../../config/utils');var config=require(_0x4f9f('0x15'));var licenseUtil=require(_0x4f9f('0x16'));var db=require(_0x4f9f('0x17'))['db'];function respondWithStatusCode(_0x1531ba,_0x5c88dc){_0x5c88dc=_0x5c88dc||0xcc;return function(_0x55fff2){if(_0x55fff2){return _0x1531ba['sendStatus'](_0x5c88dc);}return _0x1531ba[_0x4f9f('0x18')](_0x5c88dc)[_0x4f9f('0x19')]();};}function respondWithResult(_0x19a034,_0x2b9689){_0x2b9689=_0x2b9689||0xc8;return function(_0xa8499c){if(_0xa8499c){return _0x19a034[_0x4f9f('0x18')](_0x2b9689)['json'](_0xa8499c);}};}function respondWithFilteredResult(_0x5060ca,_0x11112a){return function(_0x2e0f59){if(_0x2e0f59){var _0x25ecdc=typeof _0x11112a[_0x4f9f('0x1a')]===_0x4f9f('0x1b')&&typeof _0x11112a[_0x4f9f('0x1c')]===_0x4f9f('0x1b');var _0x1140e6=_0x2e0f59['count'];var _0x11cb09=_0x25ecdc?0x0:_0x11112a[_0x4f9f('0x1a')];var _0x478e2e=_0x25ecdc?_0x2e0f59['count']:_0x11112a[_0x4f9f('0x1a')]+_0x11112a[_0x4f9f('0x1c')];var _0x3a6fb9;if(_0x478e2e>=_0x1140e6){_0x478e2e=_0x1140e6;_0x3a6fb9=0xc8;}else{_0x3a6fb9=0xce;}_0x5060ca[_0x4f9f('0x18')](_0x3a6fb9);return _0x5060ca[_0x4f9f('0x1d')](_0x4f9f('0x1e'),_0x11cb09+'-'+_0x478e2e+'/'+_0x1140e6)['json'](_0x2e0f59);}return null;};}function patchUpdates(_0x565299){return function(_0x3bbe41){try{jsonpatch[_0x4f9f('0x1f')](_0x3bbe41,_0x565299,!![]);}catch(_0x4b4a9a){return BPromise[_0x4f9f('0x20')](_0x4b4a9a);}return _0x3bbe41[_0x4f9f('0x21')]();};}function saveUpdates(_0x5be7da,_0x32d3ad){return function(_0x425ecc){if(_0x425ecc){return _0x425ecc[_0x4f9f('0x22')](_0x5be7da)[_0x4f9f('0x23')](function(_0x2c195d){return _0x2c195d;});}return null;};}function removeEntity(_0x32970d,_0x30cf4c){return function(_0x1f7862){if(_0x1f7862){return _0x1f7862['destroy']()[_0x4f9f('0x23')](function(){_0x32970d[_0x4f9f('0x18')](0xcc)[_0x4f9f('0x19')]();});}};}function handleEntityNotFound(_0x1d3881,_0x28a225){return function(_0xccb581){if(!_0xccb581){_0x1d3881[_0x4f9f('0x24')](0x194);}return _0xccb581;};}function handleError(_0x3530d5,_0x4bdb99){_0x4bdb99=_0x4bdb99||0x1f4;return function(_0x3ae1c5){logger[_0x4f9f('0x25')](_0x3ae1c5[_0x4f9f('0x26')]);if(_0x3ae1c5[_0x4f9f('0x27')]){delete _0x3ae1c5['name'];}_0x3530d5['status'](_0x4bdb99)[_0x4f9f('0x28')](_0x3ae1c5);};}exports[_0x4f9f('0x29')]=function(_0x25b301,_0xae87dd){var _0x3a0a70={},_0x530799={},_0x5a4c5f={'count':0x0,'rows':[]};var _0x2412cd=_[_0x4f9f('0x2a')](db['ZendeskConfiguration'][_0x4f9f('0x2b')],function(_0xc7c5b9){return{'name':_0xc7c5b9[_0x4f9f('0x2c')],'type':_0xc7c5b9[_0x4f9f('0x2d')]['key']};});_0x530799[_0x4f9f('0x2e')]=_[_0x4f9f('0x2a')](_0x2412cd,_0x4f9f('0x27'));_0x530799[_0x4f9f('0x2f')]=_['keys'](_0x25b301[_0x4f9f('0x2f')]);_0x530799[_0x4f9f('0x30')]=_[_0x4f9f('0x31')](_0x530799['model'],_0x530799[_0x4f9f('0x2f')]);_0x3a0a70[_0x4f9f('0x32')]=_[_0x4f9f('0x31')](_0x530799[_0x4f9f('0x2e')],qs[_0x4f9f('0x33')](_0x25b301['query']['fields']));_0x3a0a70['attributes']=_0x3a0a70[_0x4f9f('0x32')][_0x4f9f('0x34')]?_0x3a0a70['attributes']:_0x530799[_0x4f9f('0x2e')];if(!_0x25b301[_0x4f9f('0x2f')][_0x4f9f('0x35')]('nolimit')){_0x3a0a70['limit']=qs[_0x4f9f('0x1c')](_0x25b301[_0x4f9f('0x2f')][_0x4f9f('0x1c')]);_0x3a0a70[_0x4f9f('0x1a')]=qs[_0x4f9f('0x1a')](_0x25b301[_0x4f9f('0x2f')][_0x4f9f('0x1a')]);}_0x3a0a70['order']=qs[_0x4f9f('0x36')](_0x25b301[_0x4f9f('0x2f')][_0x4f9f('0x36')]);_0x3a0a70[_0x4f9f('0x37')]=qs[_0x4f9f('0x30')](_[_0x4f9f('0x38')](_0x25b301[_0x4f9f('0x2f')],_0x530799[_0x4f9f('0x30')]),_0x2412cd);if(_0x25b301[_0x4f9f('0x2f')][_0x4f9f('0x39')]){_0x3a0a70[_0x4f9f('0x37')]=_[_0x4f9f('0x3a')](_0x3a0a70[_0x4f9f('0x37')],{'$or':_[_0x4f9f('0x2a')](_0x2412cd,function(_0x127de9){if(_0x127de9[_0x4f9f('0x2d')]!==_0x4f9f('0x3b')){var _0x308653={};_0x308653[_0x127de9[_0x4f9f('0x27')]]={'$like':'%'+_0x25b301[_0x4f9f('0x2f')][_0x4f9f('0x39')]+'%'};return _0x308653;}})});}_0x3a0a70=_['merge']({},_0x3a0a70,_0x25b301[_0x4f9f('0x3c')]);var _0x40c35b={'where':_0x3a0a70[_0x4f9f('0x37')]};return db['ZendeskConfiguration']['count'](_0x40c35b)[_0x4f9f('0x23')](function(_0x5d5477){_0x5a4c5f[_0x4f9f('0x3d')]=_0x5d5477;if(_0x25b301[_0x4f9f('0x2f')][_0x4f9f('0x3e')]){_0x3a0a70[_0x4f9f('0x3f')]=[{'all':!![]}];}return db[_0x4f9f('0x40')][_0x4f9f('0x41')](_0x3a0a70);})['then'](function(_0x2cc7c5){_0x5a4c5f[_0x4f9f('0x42')]=_0x2cc7c5;return _0x5a4c5f;})[_0x4f9f('0x23')](respondWithFilteredResult(_0xae87dd,_0x3a0a70))[_0x4f9f('0x43')](handleError(_0xae87dd,null));};exports[_0x4f9f('0x44')]=function(_0xa6a245,_0x2d56ad){var _0x4fbe75={'raw':![],'where':{'id':_0xa6a245[_0x4f9f('0x45')]['id']}},_0x5ca7fd={};_0x5ca7fd[_0x4f9f('0x2e')]=_[_0x4f9f('0x46')](db[_0x4f9f('0x40')]['rawAttributes']);_0x5ca7fd[_0x4f9f('0x2f')]=_['keys'](_0xa6a245[_0x4f9f('0x2f')]);_0x5ca7fd['filters']=_['intersection'](_0x5ca7fd[_0x4f9f('0x2e')],_0x5ca7fd[_0x4f9f('0x2f')]);_0x4fbe75[_0x4f9f('0x32')]=_[_0x4f9f('0x31')](_0x5ca7fd[_0x4f9f('0x2e')],qs[_0x4f9f('0x33')](_0xa6a245[_0x4f9f('0x2f')][_0x4f9f('0x33')]));_0x4fbe75[_0x4f9f('0x32')]=_0x4fbe75[_0x4f9f('0x32')][_0x4f9f('0x34')]?_0x4fbe75['attributes']:_0x5ca7fd[_0x4f9f('0x2e')];if(_0xa6a245[_0x4f9f('0x2f')][_0x4f9f('0x3e')]){_0x4fbe75[_0x4f9f('0x3f')]=[{'all':!![]}];}_0x4fbe75=_[_0x4f9f('0x3a')]({},_0x4fbe75,_0xa6a245[_0x4f9f('0x3c')]);return db['ZendeskConfiguration'][_0x4f9f('0x47')](_0x4fbe75)[_0x4f9f('0x23')](handleEntityNotFound(_0x2d56ad,null))[_0x4f9f('0x23')](respondWithResult(_0x2d56ad,null))[_0x4f9f('0x43')](handleError(_0x2d56ad,null));};exports[_0x4f9f('0x48')]=function(_0x4b5045,_0x59ad3b){return db[_0x4f9f('0x40')][_0x4f9f('0x48')](_0x4b5045['body'],{})['then'](respondWithResult(_0x59ad3b,0xc9))['catch'](handleError(_0x59ad3b,null));};exports['update']=function(_0x522b4b,_0x1e2e34){if(_0x522b4b[_0x4f9f('0x49')]['id']){delete _0x522b4b[_0x4f9f('0x49')]['id'];}return db['ZendeskConfiguration'][_0x4f9f('0x47')]({'where':{'id':_0x522b4b[_0x4f9f('0x45')]['id']}})[_0x4f9f('0x23')](handleEntityNotFound(_0x1e2e34,null))[_0x4f9f('0x23')](saveUpdates(_0x522b4b[_0x4f9f('0x49')],null))[_0x4f9f('0x23')](respondWithResult(_0x1e2e34,null))['catch'](handleError(_0x1e2e34,null));};exports[_0x4f9f('0x4a')]=function(_0x32da0e,_0x1da08e){return db['ZendeskConfiguration']['find']({'where':{'id':_0x32da0e['params']['id']}})[_0x4f9f('0x23')](handleEntityNotFound(_0x1da08e,null))[_0x4f9f('0x23')](removeEntity(_0x1da08e,null))[_0x4f9f('0x43')](handleError(_0x1da08e,null));};exports['getFields']=function(_0x58b4e9,_0x33f083,_0x43769c){var _0x4abec7={};var _0x302df7={};var _0x22550f;var _0x1acc9b;return db[_0x4f9f('0x40')][_0x4f9f('0x4b')]({'where':{'id':_0x58b4e9[_0x4f9f('0x45')]['id']}})['then'](handleEntityNotFound(_0x33f083,null))[_0x4f9f('0x23')](function(_0x5bc4df){if(_0x5bc4df){_0x22550f=_0x5bc4df;_0x302df7[_0x4f9f('0x2e')]=_['keys'](db[_0x4f9f('0x4c')][_0x4f9f('0x2b')]);_0x302df7[_0x4f9f('0x2f')]=_[_0x4f9f('0x46')](_0x58b4e9[_0x4f9f('0x2f')]);_0x302df7[_0x4f9f('0x30')]=_['intersection'](_0x302df7[_0x4f9f('0x2e')],_0x302df7[_0x4f9f('0x2f')]);_0x4abec7[_0x4f9f('0x32')]=_[_0x4f9f('0x31')](_0x302df7[_0x4f9f('0x2e')],qs[_0x4f9f('0x33')](_0x58b4e9['query']['fields']));_0x4abec7[_0x4f9f('0x32')]=_0x4abec7[_0x4f9f('0x32')][_0x4f9f('0x34')]?_0x4abec7['attributes']:_0x302df7[_0x4f9f('0x2e')];_0x4abec7[_0x4f9f('0x4d')]=qs['sort'](_0x58b4e9['query'][_0x4f9f('0x36')]);_0x4abec7[_0x4f9f('0x37')]=qs['filters'](_[_0x4f9f('0x38')](_0x58b4e9['query'],_0x302df7[_0x4f9f('0x30')]));if(_0x58b4e9[_0x4f9f('0x2f')][_0x4f9f('0x39')]){_0x4abec7[_0x4f9f('0x37')]=_[_0x4f9f('0x3a')](_0x4abec7[_0x4f9f('0x37')],{'$or':_[_0x4f9f('0x2a')](_0x4abec7[_0x4f9f('0x32')],function(_0x90de8f){var _0x102298={};_0x102298[_0x90de8f]={'$like':'%'+_0x58b4e9[_0x4f9f('0x2f')][_0x4f9f('0x39')]+'%'};return _0x102298;})});}_0x4abec7=_['merge']({},_0x4abec7,_0x58b4e9[_0x4f9f('0x3c')]);return _0x22550f[_0x4f9f('0x4e')](_0x4abec7);}})[_0x4f9f('0x23')](function(_0x554f2b){if(_0x554f2b){_0x1acc9b=_0x554f2b['length'];if(!_0x58b4e9['query'][_0x4f9f('0x35')](_0x4f9f('0x4f'))){_0x4abec7[_0x4f9f('0x1c')]=qs[_0x4f9f('0x1c')](_0x58b4e9['query'][_0x4f9f('0x1c')]);_0x4abec7[_0x4f9f('0x1a')]=qs[_0x4f9f('0x1a')](_0x58b4e9[_0x4f9f('0x2f')][_0x4f9f('0x1a')]);}return _0x22550f[_0x4f9f('0x4e')](_0x4abec7);}})[_0x4f9f('0x23')](function(_0x7142f2){if(_0x7142f2){return _0x7142f2?{'count':_0x1acc9b,'rows':_0x7142f2}:null;}})[_0x4f9f('0x23')](respondWithResult(_0x33f083,null))[_0x4f9f('0x43')](handleError(_0x33f083,null));};exports[_0x4f9f('0x50')]=function(_0x3a4d3b,_0x2f2751,_0x4a65bb){var _0xca773c={};var _0x4fac5a={};var _0x114e10;var _0x335c49;return db[_0x4f9f('0x40')]['findOne']({'where':{'id':_0x3a4d3b[_0x4f9f('0x45')]['id']}})[_0x4f9f('0x23')](handleEntityNotFound(_0x2f2751,null))[_0x4f9f('0x23')](function(_0x154bbc){if(_0x154bbc){_0x114e10=_0x154bbc;_0x4fac5a[_0x4f9f('0x2e')]=_[_0x4f9f('0x46')](db[_0x4f9f('0x4c')][_0x4f9f('0x2b')]);_0x4fac5a['query']=_[_0x4f9f('0x46')](_0x3a4d3b[_0x4f9f('0x2f')]);_0x4fac5a[_0x4f9f('0x30')]=_[_0x4f9f('0x31')](_0x4fac5a[_0x4f9f('0x2e')],_0x4fac5a['query']);_0xca773c[_0x4f9f('0x32')]=_[_0x4f9f('0x31')](_0x4fac5a[_0x4f9f('0x2e')],qs['fields'](_0x3a4d3b[_0x4f9f('0x2f')][_0x4f9f('0x33')]));_0xca773c[_0x4f9f('0x32')]=_0xca773c[_0x4f9f('0x32')]['length']?_0xca773c[_0x4f9f('0x32')]:_0x4fac5a['model'];_0xca773c[_0x4f9f('0x4d')]=qs[_0x4f9f('0x36')](_0x3a4d3b[_0x4f9f('0x2f')]['sort']);_0xca773c[_0x4f9f('0x37')]=qs['filters'](_[_0x4f9f('0x38')](_0x3a4d3b[_0x4f9f('0x2f')],_0x4fac5a[_0x4f9f('0x30')]));if(_0x3a4d3b[_0x4f9f('0x2f')]['filter']){_0xca773c[_0x4f9f('0x37')]=_[_0x4f9f('0x3a')](_0xca773c['where'],{'$or':_[_0x4f9f('0x2a')](_0xca773c[_0x4f9f('0x32')],function(_0x6e096b){var _0x513b98={};_0x513b98[_0x6e096b]={'$like':'%'+_0x3a4d3b[_0x4f9f('0x2f')][_0x4f9f('0x39')]+'%'};return _0x513b98;})});}_0xca773c=_[_0x4f9f('0x3a')]({},_0xca773c,_0x3a4d3b[_0x4f9f('0x3c')]);return _0x114e10[_0x4f9f('0x50')](_0xca773c);}})[_0x4f9f('0x23')](function(_0x38f3c6){if(_0x38f3c6){_0x335c49=_0x38f3c6[_0x4f9f('0x34')];if(!_0x3a4d3b[_0x4f9f('0x2f')]['hasOwnProperty']('nolimit')){_0xca773c[_0x4f9f('0x1c')]=qs[_0x4f9f('0x1c')](_0x3a4d3b['query'][_0x4f9f('0x1c')]);_0xca773c[_0x4f9f('0x1a')]=qs[_0x4f9f('0x1a')](_0x3a4d3b[_0x4f9f('0x2f')][_0x4f9f('0x1a')]);}return _0x114e10['getSubjects'](_0xca773c);}})[_0x4f9f('0x23')](function(_0x2722c9){if(_0x2722c9){return _0x2722c9?{'count':_0x335c49,'rows':_0x2722c9}:null;}})[_0x4f9f('0x23')](respondWithResult(_0x2f2751,null))[_0x4f9f('0x43')](handleError(_0x2f2751,null));};exports[_0x4f9f('0x51')]=function(_0x3ac66c,_0x561717,_0x1ae4c4){var _0xc35da8={};var _0x3473dc={};var _0x11bb96;var _0x74d79;return db[_0x4f9f('0x40')]['findOne']({'where':{'id':_0x3ac66c[_0x4f9f('0x45')]['id']}})['then'](handleEntityNotFound(_0x561717,null))[_0x4f9f('0x23')](function(_0x2a114d){if(_0x2a114d){_0x11bb96=_0x2a114d;_0x3473dc['model']=_[_0x4f9f('0x46')](db['ZendeskField'][_0x4f9f('0x2b')]);_0x3473dc[_0x4f9f('0x2f')]=_[_0x4f9f('0x46')](_0x3ac66c[_0x4f9f('0x2f')]);_0x3473dc[_0x4f9f('0x30')]=_['intersection'](_0x3473dc[_0x4f9f('0x2e')],_0x3473dc[_0x4f9f('0x2f')]);_0xc35da8[_0x4f9f('0x32')]=_[_0x4f9f('0x31')](_0x3473dc[_0x4f9f('0x2e')],qs[_0x4f9f('0x33')](_0x3ac66c['query']['fields']));_0xc35da8['attributes']=_0xc35da8[_0x4f9f('0x32')]['length']?_0xc35da8['attributes']:_0x3473dc['model'];_0xc35da8[_0x4f9f('0x4d')]=qs['sort'](_0x3ac66c[_0x4f9f('0x2f')][_0x4f9f('0x36')]);_0xc35da8['where']=qs['filters'](_[_0x4f9f('0x38')](_0x3ac66c[_0x4f9f('0x2f')],_0x3473dc[_0x4f9f('0x30')]));if(_0x3ac66c[_0x4f9f('0x2f')]['filter']){_0xc35da8[_0x4f9f('0x37')]=_[_0x4f9f('0x3a')](_0xc35da8[_0x4f9f('0x37')],{'$or':_['map'](_0xc35da8['attributes'],function(_0x690298){var _0x3371c0={};_0x3371c0[_0x690298]={'$like':'%'+_0x3ac66c[_0x4f9f('0x2f')]['filter']+'%'};return _0x3371c0;})});}_0xc35da8=_['merge']({},_0xc35da8,_0x3ac66c[_0x4f9f('0x3c')]);return _0x11bb96['getDescriptions'](_0xc35da8);}})[_0x4f9f('0x23')](function(_0x37babd){if(_0x37babd){_0x74d79=_0x37babd[_0x4f9f('0x34')];if(!_0x3ac66c['query'][_0x4f9f('0x35')](_0x4f9f('0x4f'))){_0xc35da8[_0x4f9f('0x1c')]=qs[_0x4f9f('0x1c')](_0x3ac66c[_0x4f9f('0x2f')]['limit']);_0xc35da8[_0x4f9f('0x1a')]=qs[_0x4f9f('0x1a')](_0x3ac66c['query'][_0x4f9f('0x1a')]);}return _0x11bb96['getDescriptions'](_0xc35da8);}})[_0x4f9f('0x23')](function(_0x28c126){if(_0x28c126){return _0x28c126?{'count':_0x74d79,'rows':_0x28c126}:null;}})[_0x4f9f('0x23')](respondWithResult(_0x561717,null))[_0x4f9f('0x43')](handleError(_0x561717,null));};exports['getTags']=function(_0x491c6,_0x20d315,_0x3fe050){var _0x1ec305={};var _0x5dfa8f={};var _0x5d8140;var _0x2425ee;return db[_0x4f9f('0x40')]['findOne']({'where':{'id':_0x491c6[_0x4f9f('0x45')]['id']}})[_0x4f9f('0x23')](handleEntityNotFound(_0x20d315,null))['then'](function(_0xcd1f9a){if(_0xcd1f9a){_0x5d8140=_0xcd1f9a;_0x5dfa8f[_0x4f9f('0x2e')]=_[_0x4f9f('0x46')](db['Tag']['rawAttributes']);_0x5dfa8f[_0x4f9f('0x2f')]=_[_0x4f9f('0x46')](_0x491c6[_0x4f9f('0x2f')]);_0x5dfa8f[_0x4f9f('0x30')]=_[_0x4f9f('0x31')](_0x5dfa8f['model'],_0x5dfa8f['query']);_0x1ec305[_0x4f9f('0x32')]=_[_0x4f9f('0x31')](_0x5dfa8f[_0x4f9f('0x2e')],qs['fields'](_0x491c6[_0x4f9f('0x2f')][_0x4f9f('0x33')]));_0x1ec305['attributes']=_0x1ec305[_0x4f9f('0x32')][_0x4f9f('0x34')]?_0x1ec305[_0x4f9f('0x32')]:_0x5dfa8f[_0x4f9f('0x2e')];_0x1ec305[_0x4f9f('0x4d')]=qs[_0x4f9f('0x36')](_0x491c6[_0x4f9f('0x2f')]['sort']);_0x1ec305['where']=qs[_0x4f9f('0x30')](_[_0x4f9f('0x38')](_0x491c6[_0x4f9f('0x2f')],_0x5dfa8f[_0x4f9f('0x30')]));if(_0x491c6['query'][_0x4f9f('0x39')]){_0x1ec305[_0x4f9f('0x37')]=_[_0x4f9f('0x3a')](_0x1ec305[_0x4f9f('0x37')],{'$or':_[_0x4f9f('0x2a')](_0x1ec305[_0x4f9f('0x32')],function(_0x17d871){var _0xa20837={};_0xa20837[_0x17d871]={'$like':'%'+_0x491c6[_0x4f9f('0x2f')]['filter']+'%'};return _0xa20837;})});}_0x1ec305=_[_0x4f9f('0x3a')]({},_0x1ec305,_0x491c6[_0x4f9f('0x3c')]);return _0x5d8140[_0x4f9f('0x52')](_0x1ec305);}})[_0x4f9f('0x23')](function(_0x4725ec){if(_0x4725ec){_0x2425ee=_0x4725ec[_0x4f9f('0x34')];if(!_0x491c6[_0x4f9f('0x2f')][_0x4f9f('0x35')](_0x4f9f('0x4f'))){_0x1ec305[_0x4f9f('0x1c')]=qs['limit'](_0x491c6[_0x4f9f('0x2f')]['limit']);_0x1ec305[_0x4f9f('0x1a')]=qs['offset'](_0x491c6[_0x4f9f('0x2f')]['offset']);}return _0x5d8140['getTags'](_0x1ec305);}})['then'](function(_0x2355ef){if(_0x2355ef){return _0x2355ef?{'count':_0x2425ee,'rows':_0x2355ef}:null;}})[_0x4f9f('0x23')](respondWithResult(_0x20d315,null))[_0x4f9f('0x43')](handleError(_0x20d315,null));};exports['setTags']=function(_0x91a49f,_0x3d5ca8,_0x422119){if(_0x91a49f['body']['id']){delete _0x91a49f['body']['id'];}return db[_0x4f9f('0x40')][_0x4f9f('0x4b')]({'where':{'id':_0x91a49f['params']['id']}})[_0x4f9f('0x23')](handleEntityNotFound(_0x3d5ca8,null))[_0x4f9f('0x23')](function(_0x1dcbf6){if(_0x1dcbf6){return _0x1dcbf6[_0x4f9f('0x53')](_0x91a49f[_0x4f9f('0x49')][_0x4f9f('0x54')]||[]);}return null;})[_0x4f9f('0x23')](respondWithResult(_0x3d5ca8,null))[_0x4f9f('0x43')](handleError(_0x3d5ca8,null));}; \ No newline at end of file +var _0x31e7=['merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','body','update','ZendeskField','options','getFields','getSubjects','findOne','hasOwnProperty','getDescriptions','nolimit','getTags','Tag','setTags','ids','rimraf','fast-json-patch','moment','bluebird','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','undefined','offset','count','Content-Range','json','reject','save','destroy','then','end','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter'];(function(_0x5509fc,_0x3129ff){var _0x483dfc=function(_0x236367){while(--_0x236367){_0x5509fc['push'](_0x5509fc['shift']());}};_0x483dfc(++_0x3129ff);}(_0x31e7,0x6b));var _0x731e=function(_0x3676a7,_0x324f8c){_0x3676a7=_0x3676a7-0x0;var _0x55cb49=_0x31e7[_0x3676a7];return _0x55cb49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x731e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x731e('0x1'));var rp=require('request-promise');var moment=require(_0x731e('0x2'));var BPromise=require(_0x731e('0x3'));var Mustache=require('mustache');var util=require(_0x731e('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x731e('0x5'));var squel=require(_0x731e('0x6'));var crypto=require(_0x731e('0x7'));var jsforce=require(_0x731e('0x8'));var deskjs=require(_0x731e('0x9'));var toCsv=require(_0x731e('0xa'));var querystring=require(_0x731e('0xb'));var Papa=require(_0x731e('0xc'));var Redis=require(_0x731e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x731e('0xe'));var as=require(_0x731e('0xf'));var hardwareService=require(_0x731e('0x10'));var logger=require(_0x731e('0x11'))(_0x731e('0x12'));var utils=require(_0x731e('0x13'));var config=require(_0x731e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x731e('0x15'))['db'];function respondWithStatusCode(_0x85459,_0x27f2a3){_0x27f2a3=_0x27f2a3||0xcc;return function(_0x4500c6){if(_0x4500c6){return _0x85459[_0x731e('0x16')](_0x27f2a3);}return _0x85459[_0x731e('0x17')](_0x27f2a3)['end']();};}function respondWithResult(_0x9c8252,_0x316b68){_0x316b68=_0x316b68||0xc8;return function(_0x501036){if(_0x501036){return _0x9c8252[_0x731e('0x17')](_0x316b68)['json'](_0x501036);}};}function respondWithFilteredResult(_0x151777,_0x404c98){return function(_0x2aa6a6){if(_0x2aa6a6){var _0x189f5f=typeof _0x404c98['offset']==='undefined'&&typeof _0x404c98[_0x731e('0x18')]===_0x731e('0x19');var _0x40270=_0x2aa6a6['count'];var _0x2d92d2=_0x189f5f?0x0:_0x404c98[_0x731e('0x1a')];var _0x56afc4=_0x189f5f?_0x2aa6a6[_0x731e('0x1b')]:_0x404c98['offset']+_0x404c98[_0x731e('0x18')];var _0xaa927f;if(_0x56afc4>=_0x40270){_0x56afc4=_0x40270;_0xaa927f=0xc8;}else{_0xaa927f=0xce;}_0x151777[_0x731e('0x17')](_0xaa927f);return _0x151777['set'](_0x731e('0x1c'),_0x2d92d2+'-'+_0x56afc4+'/'+_0x40270)[_0x731e('0x1d')](_0x2aa6a6);}return null;};}function patchUpdates(_0x5871fb){return function(_0x4a9124){try{jsonpatch['apply'](_0x4a9124,_0x5871fb,!![]);}catch(_0x44034a){return BPromise[_0x731e('0x1e')](_0x44034a);}return _0x4a9124[_0x731e('0x1f')]();};}function saveUpdates(_0x46724c,_0x47ae0c){return function(_0x24f982){if(_0x24f982){return _0x24f982['update'](_0x46724c)['then'](function(_0x11b057){return _0x11b057;});}return null;};}function removeEntity(_0x2a25a2,_0x18e4b4){return function(_0x4e13a2){if(_0x4e13a2){return _0x4e13a2[_0x731e('0x20')]()[_0x731e('0x21')](function(){_0x2a25a2[_0x731e('0x17')](0xcc)[_0x731e('0x22')]();});}};}function handleEntityNotFound(_0x44c1bb,_0x57c8d3){return function(_0x2436ec){if(!_0x2436ec){_0x44c1bb[_0x731e('0x16')](0x194);}return _0x2436ec;};}function handleError(_0x1c3168,_0x212d49){_0x212d49=_0x212d49||0x1f4;return function(_0x8e2f4d){logger[_0x731e('0x23')](_0x8e2f4d['stack']);if(_0x8e2f4d['name']){delete _0x8e2f4d[_0x731e('0x24')];}_0x1c3168[_0x731e('0x17')](_0x212d49)[_0x731e('0x25')](_0x8e2f4d);};}exports[_0x731e('0x26')]=function(_0x79fc39,_0x572380){var _0x54b9b0={},_0x269c0={},_0x430b48={'count':0x0,'rows':[]};var _0x1ea574=_[_0x731e('0x27')](db[_0x731e('0x28')][_0x731e('0x29')],function(_0x284164){return{'name':_0x284164[_0x731e('0x2a')],'type':_0x284164[_0x731e('0x2b')][_0x731e('0x2c')]};});_0x269c0['model']=_[_0x731e('0x27')](_0x1ea574,_0x731e('0x24'));_0x269c0[_0x731e('0x2d')]=_['keys'](_0x79fc39[_0x731e('0x2d')]);_0x269c0['filters']=_[_0x731e('0x2e')](_0x269c0[_0x731e('0x2f')],_0x269c0['query']);_0x54b9b0[_0x731e('0x30')]=_[_0x731e('0x2e')](_0x269c0[_0x731e('0x2f')],qs[_0x731e('0x31')](_0x79fc39['query'][_0x731e('0x31')]));_0x54b9b0[_0x731e('0x30')]=_0x54b9b0['attributes'][_0x731e('0x32')]?_0x54b9b0[_0x731e('0x30')]:_0x269c0[_0x731e('0x2f')];if(!_0x79fc39['query']['hasOwnProperty']('nolimit')){_0x54b9b0[_0x731e('0x18')]=qs[_0x731e('0x18')](_0x79fc39[_0x731e('0x2d')][_0x731e('0x18')]);_0x54b9b0[_0x731e('0x1a')]=qs[_0x731e('0x1a')](_0x79fc39[_0x731e('0x2d')][_0x731e('0x1a')]);}_0x54b9b0[_0x731e('0x33')]=qs[_0x731e('0x34')](_0x79fc39[_0x731e('0x2d')]['sort']);_0x54b9b0[_0x731e('0x35')]=qs[_0x731e('0x36')](_[_0x731e('0x37')](_0x79fc39['query'],_0x269c0[_0x731e('0x36')]),_0x1ea574);if(_0x79fc39[_0x731e('0x2d')][_0x731e('0x38')]){_0x54b9b0[_0x731e('0x35')]=_[_0x731e('0x39')](_0x54b9b0[_0x731e('0x35')],{'$or':_[_0x731e('0x27')](_0x1ea574,function(_0x9f59f5){if(_0x9f59f5[_0x731e('0x2b')]!==_0x731e('0x3a')){var _0x141a23={};_0x141a23[_0x9f59f5[_0x731e('0x24')]]={'$like':'%'+_0x79fc39['query'][_0x731e('0x38')]+'%'};return _0x141a23;}})});}_0x54b9b0=_[_0x731e('0x39')]({},_0x54b9b0,_0x79fc39['options']);var _0x1d8970={'where':_0x54b9b0[_0x731e('0x35')]};return db['ZendeskConfiguration'][_0x731e('0x1b')](_0x1d8970)[_0x731e('0x21')](function(_0x4cf1ae){_0x430b48['count']=_0x4cf1ae;if(_0x79fc39[_0x731e('0x2d')][_0x731e('0x3b')]){_0x54b9b0[_0x731e('0x3c')]=[{'all':!![]}];}return db[_0x731e('0x28')][_0x731e('0x3d')](_0x54b9b0);})[_0x731e('0x21')](function(_0x4b4646){_0x430b48[_0x731e('0x3e')]=_0x4b4646;return _0x430b48;})[_0x731e('0x21')](respondWithFilteredResult(_0x572380,_0x54b9b0))[_0x731e('0x3f')](handleError(_0x572380,null));};exports[_0x731e('0x40')]=function(_0x522dcc,_0xe4a0b1){var _0x3098a8={'raw':![],'where':{'id':_0x522dcc[_0x731e('0x41')]['id']}},_0x3a2461={};_0x3a2461[_0x731e('0x2f')]=_[_0x731e('0x42')](db[_0x731e('0x28')]['rawAttributes']);_0x3a2461[_0x731e('0x2d')]=_[_0x731e('0x42')](_0x522dcc[_0x731e('0x2d')]);_0x3a2461['filters']=_['intersection'](_0x3a2461[_0x731e('0x2f')],_0x3a2461[_0x731e('0x2d')]);_0x3098a8['attributes']=_[_0x731e('0x2e')](_0x3a2461[_0x731e('0x2f')],qs[_0x731e('0x31')](_0x522dcc[_0x731e('0x2d')][_0x731e('0x31')]));_0x3098a8[_0x731e('0x30')]=_0x3098a8[_0x731e('0x30')][_0x731e('0x32')]?_0x3098a8[_0x731e('0x30')]:_0x3a2461[_0x731e('0x2f')];if(_0x522dcc[_0x731e('0x2d')][_0x731e('0x3b')]){_0x3098a8[_0x731e('0x3c')]=[{'all':!![]}];}_0x3098a8=_[_0x731e('0x39')]({},_0x3098a8,_0x522dcc['options']);return db[_0x731e('0x28')][_0x731e('0x43')](_0x3098a8)[_0x731e('0x21')](handleEntityNotFound(_0xe4a0b1,null))[_0x731e('0x21')](respondWithResult(_0xe4a0b1,null))[_0x731e('0x3f')](handleError(_0xe4a0b1,null));};exports['create']=function(_0x111737,_0x170b33){return db[_0x731e('0x28')]['create'](_0x111737[_0x731e('0x44')],{})[_0x731e('0x21')](respondWithResult(_0x170b33,0xc9))[_0x731e('0x3f')](handleError(_0x170b33,null));};exports[_0x731e('0x45')]=function(_0x114efc,_0x10feae){if(_0x114efc[_0x731e('0x44')]['id']){delete _0x114efc[_0x731e('0x44')]['id'];}return db[_0x731e('0x28')][_0x731e('0x43')]({'where':{'id':_0x114efc[_0x731e('0x41')]['id']}})['then'](handleEntityNotFound(_0x10feae,null))['then'](saveUpdates(_0x114efc[_0x731e('0x44')],null))[_0x731e('0x21')](respondWithResult(_0x10feae,null))[_0x731e('0x3f')](handleError(_0x10feae,null));};exports[_0x731e('0x20')]=function(_0x403c41,_0x4ad13b){return db[_0x731e('0x28')][_0x731e('0x43')]({'where':{'id':_0x403c41[_0x731e('0x41')]['id']}})[_0x731e('0x21')](handleEntityNotFound(_0x4ad13b,null))[_0x731e('0x21')](removeEntity(_0x4ad13b,null))[_0x731e('0x3f')](handleError(_0x4ad13b,null));};exports['getFields']=function(_0x3c5667,_0x249288,_0x4b6a4b){var _0x46a009={};var _0x176694={};var _0x300bc9;var _0x5bdcac;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3c5667[_0x731e('0x41')]['id']}})[_0x731e('0x21')](handleEntityNotFound(_0x249288,null))[_0x731e('0x21')](function(_0x1273f0){if(_0x1273f0){_0x300bc9=_0x1273f0;_0x176694['model']=_[_0x731e('0x42')](db[_0x731e('0x46')][_0x731e('0x29')]);_0x176694[_0x731e('0x2d')]=_[_0x731e('0x42')](_0x3c5667[_0x731e('0x2d')]);_0x176694[_0x731e('0x36')]=_[_0x731e('0x2e')](_0x176694['model'],_0x176694[_0x731e('0x2d')]);_0x46a009['attributes']=_[_0x731e('0x2e')](_0x176694[_0x731e('0x2f')],qs[_0x731e('0x31')](_0x3c5667[_0x731e('0x2d')][_0x731e('0x31')]));_0x46a009[_0x731e('0x30')]=_0x46a009['attributes'][_0x731e('0x32')]?_0x46a009[_0x731e('0x30')]:_0x176694['model'];_0x46a009[_0x731e('0x33')]=qs['sort'](_0x3c5667['query'][_0x731e('0x34')]);_0x46a009['where']=qs[_0x731e('0x36')](_[_0x731e('0x37')](_0x3c5667[_0x731e('0x2d')],_0x176694[_0x731e('0x36')]));if(_0x3c5667[_0x731e('0x2d')]['filter']){_0x46a009[_0x731e('0x35')]=_[_0x731e('0x39')](_0x46a009['where'],{'$or':_[_0x731e('0x27')](_0x46a009['attributes'],function(_0x1fe6d1){var _0xe6276={};_0xe6276[_0x1fe6d1]={'$like':'%'+_0x3c5667[_0x731e('0x2d')][_0x731e('0x38')]+'%'};return _0xe6276;})});}_0x46a009=_[_0x731e('0x39')]({},_0x46a009,_0x3c5667[_0x731e('0x47')]);return _0x300bc9[_0x731e('0x48')](_0x46a009);}})['then'](function(_0x11a598){if(_0x11a598){_0x5bdcac=_0x11a598[_0x731e('0x32')];if(!_0x3c5667[_0x731e('0x2d')]['hasOwnProperty']('nolimit')){_0x46a009[_0x731e('0x18')]=qs[_0x731e('0x18')](_0x3c5667['query']['limit']);_0x46a009[_0x731e('0x1a')]=qs['offset'](_0x3c5667['query']['offset']);}return _0x300bc9[_0x731e('0x48')](_0x46a009);}})[_0x731e('0x21')](function(_0x15625d){if(_0x15625d){return _0x15625d?{'count':_0x5bdcac,'rows':_0x15625d}:null;}})[_0x731e('0x21')](respondWithResult(_0x249288,null))[_0x731e('0x3f')](handleError(_0x249288,null));};exports[_0x731e('0x49')]=function(_0x5e56fa,_0x14f2d7,_0x2a6d25){var _0x2dd129={};var _0x28f673={};var _0x170586;var _0x22a6f7;return db[_0x731e('0x28')][_0x731e('0x4a')]({'where':{'id':_0x5e56fa[_0x731e('0x41')]['id']}})[_0x731e('0x21')](handleEntityNotFound(_0x14f2d7,null))[_0x731e('0x21')](function(_0x24f31b){if(_0x24f31b){_0x170586=_0x24f31b;_0x28f673[_0x731e('0x2f')]=_[_0x731e('0x42')](db[_0x731e('0x46')][_0x731e('0x29')]);_0x28f673[_0x731e('0x2d')]=_['keys'](_0x5e56fa[_0x731e('0x2d')]);_0x28f673[_0x731e('0x36')]=_[_0x731e('0x2e')](_0x28f673[_0x731e('0x2f')],_0x28f673[_0x731e('0x2d')]);_0x2dd129[_0x731e('0x30')]=_[_0x731e('0x2e')](_0x28f673[_0x731e('0x2f')],qs[_0x731e('0x31')](_0x5e56fa[_0x731e('0x2d')][_0x731e('0x31')]));_0x2dd129[_0x731e('0x30')]=_0x2dd129['attributes']['length']?_0x2dd129[_0x731e('0x30')]:_0x28f673[_0x731e('0x2f')];_0x2dd129[_0x731e('0x33')]=qs[_0x731e('0x34')](_0x5e56fa[_0x731e('0x2d')][_0x731e('0x34')]);_0x2dd129[_0x731e('0x35')]=qs[_0x731e('0x36')](_[_0x731e('0x37')](_0x5e56fa[_0x731e('0x2d')],_0x28f673[_0x731e('0x36')]));if(_0x5e56fa[_0x731e('0x2d')][_0x731e('0x38')]){_0x2dd129[_0x731e('0x35')]=_[_0x731e('0x39')](_0x2dd129[_0x731e('0x35')],{'$or':_[_0x731e('0x27')](_0x2dd129[_0x731e('0x30')],function(_0x6465da){var _0x5a64d5={};_0x5a64d5[_0x6465da]={'$like':'%'+_0x5e56fa['query']['filter']+'%'};return _0x5a64d5;})});}_0x2dd129=_['merge']({},_0x2dd129,_0x5e56fa[_0x731e('0x47')]);return _0x170586[_0x731e('0x49')](_0x2dd129);}})['then'](function(_0xc4a4d){if(_0xc4a4d){_0x22a6f7=_0xc4a4d[_0x731e('0x32')];if(!_0x5e56fa[_0x731e('0x2d')][_0x731e('0x4b')]('nolimit')){_0x2dd129[_0x731e('0x18')]=qs[_0x731e('0x18')](_0x5e56fa[_0x731e('0x2d')]['limit']);_0x2dd129[_0x731e('0x1a')]=qs['offset'](_0x5e56fa[_0x731e('0x2d')][_0x731e('0x1a')]);}return _0x170586['getSubjects'](_0x2dd129);}})[_0x731e('0x21')](function(_0x1143b6){if(_0x1143b6){return _0x1143b6?{'count':_0x22a6f7,'rows':_0x1143b6}:null;}})[_0x731e('0x21')](respondWithResult(_0x14f2d7,null))[_0x731e('0x3f')](handleError(_0x14f2d7,null));};exports['getDescriptions']=function(_0x253772,_0x142933,_0x57764e){var _0x181b5f={};var _0x355a7a={};var _0x5f7b19;var _0x52ca17;return db['ZendeskConfiguration'][_0x731e('0x4a')]({'where':{'id':_0x253772[_0x731e('0x41')]['id']}})[_0x731e('0x21')](handleEntityNotFound(_0x142933,null))[_0x731e('0x21')](function(_0x266be6){if(_0x266be6){_0x5f7b19=_0x266be6;_0x355a7a[_0x731e('0x2f')]=_['keys'](db[_0x731e('0x46')][_0x731e('0x29')]);_0x355a7a['query']=_[_0x731e('0x42')](_0x253772[_0x731e('0x2d')]);_0x355a7a[_0x731e('0x36')]=_[_0x731e('0x2e')](_0x355a7a[_0x731e('0x2f')],_0x355a7a['query']);_0x181b5f['attributes']=_['intersection'](_0x355a7a['model'],qs[_0x731e('0x31')](_0x253772['query'][_0x731e('0x31')]));_0x181b5f[_0x731e('0x30')]=_0x181b5f[_0x731e('0x30')]['length']?_0x181b5f['attributes']:_0x355a7a[_0x731e('0x2f')];_0x181b5f[_0x731e('0x33')]=qs[_0x731e('0x34')](_0x253772[_0x731e('0x2d')]['sort']);_0x181b5f['where']=qs[_0x731e('0x36')](_[_0x731e('0x37')](_0x253772['query'],_0x355a7a['filters']));if(_0x253772[_0x731e('0x2d')]['filter']){_0x181b5f[_0x731e('0x35')]=_[_0x731e('0x39')](_0x181b5f['where'],{'$or':_[_0x731e('0x27')](_0x181b5f[_0x731e('0x30')],function(_0xed9a7c){var _0x5cb99e={};_0x5cb99e[_0xed9a7c]={'$like':'%'+_0x253772[_0x731e('0x2d')][_0x731e('0x38')]+'%'};return _0x5cb99e;})});}_0x181b5f=_['merge']({},_0x181b5f,_0x253772['options']);return _0x5f7b19[_0x731e('0x4c')](_0x181b5f);}})['then'](function(_0x650e4c){if(_0x650e4c){_0x52ca17=_0x650e4c[_0x731e('0x32')];if(!_0x253772[_0x731e('0x2d')][_0x731e('0x4b')](_0x731e('0x4d'))){_0x181b5f[_0x731e('0x18')]=qs[_0x731e('0x18')](_0x253772[_0x731e('0x2d')][_0x731e('0x18')]);_0x181b5f[_0x731e('0x1a')]=qs['offset'](_0x253772[_0x731e('0x2d')]['offset']);}return _0x5f7b19[_0x731e('0x4c')](_0x181b5f);}})[_0x731e('0x21')](function(_0x2eed6c){if(_0x2eed6c){return _0x2eed6c?{'count':_0x52ca17,'rows':_0x2eed6c}:null;}})[_0x731e('0x21')](respondWithResult(_0x142933,null))['catch'](handleError(_0x142933,null));};exports[_0x731e('0x4e')]=function(_0x235336,_0x1f520e,_0x3d98fe){var _0x5713a9={};var _0x3b9ab3={};var _0x3844cc;var _0x5778b2;return db['ZendeskConfiguration'][_0x731e('0x4a')]({'where':{'id':_0x235336[_0x731e('0x41')]['id']}})[_0x731e('0x21')](handleEntityNotFound(_0x1f520e,null))['then'](function(_0x5145e6){if(_0x5145e6){_0x3844cc=_0x5145e6;_0x3b9ab3[_0x731e('0x2f')]=_[_0x731e('0x42')](db[_0x731e('0x4f')][_0x731e('0x29')]);_0x3b9ab3[_0x731e('0x2d')]=_[_0x731e('0x42')](_0x235336['query']);_0x3b9ab3[_0x731e('0x36')]=_[_0x731e('0x2e')](_0x3b9ab3[_0x731e('0x2f')],_0x3b9ab3[_0x731e('0x2d')]);_0x5713a9[_0x731e('0x30')]=_[_0x731e('0x2e')](_0x3b9ab3['model'],qs[_0x731e('0x31')](_0x235336[_0x731e('0x2d')][_0x731e('0x31')]));_0x5713a9[_0x731e('0x30')]=_0x5713a9[_0x731e('0x30')][_0x731e('0x32')]?_0x5713a9[_0x731e('0x30')]:_0x3b9ab3[_0x731e('0x2f')];_0x5713a9['order']=qs['sort'](_0x235336['query'][_0x731e('0x34')]);_0x5713a9['where']=qs[_0x731e('0x36')](_[_0x731e('0x37')](_0x235336[_0x731e('0x2d')],_0x3b9ab3[_0x731e('0x36')]));if(_0x235336['query']['filter']){_0x5713a9[_0x731e('0x35')]=_[_0x731e('0x39')](_0x5713a9['where'],{'$or':_['map'](_0x5713a9[_0x731e('0x30')],function(_0x182ef9){var _0x7cf510={};_0x7cf510[_0x182ef9]={'$like':'%'+_0x235336['query']['filter']+'%'};return _0x7cf510;})});}_0x5713a9=_['merge']({},_0x5713a9,_0x235336['options']);return _0x3844cc[_0x731e('0x4e')](_0x5713a9);}})[_0x731e('0x21')](function(_0x203f03){if(_0x203f03){_0x5778b2=_0x203f03[_0x731e('0x32')];if(!_0x235336['query'][_0x731e('0x4b')](_0x731e('0x4d'))){_0x5713a9[_0x731e('0x18')]=qs['limit'](_0x235336[_0x731e('0x2d')][_0x731e('0x18')]);_0x5713a9[_0x731e('0x1a')]=qs[_0x731e('0x1a')](_0x235336['query']['offset']);}return _0x3844cc[_0x731e('0x4e')](_0x5713a9);}})[_0x731e('0x21')](function(_0x43b13e){if(_0x43b13e){return _0x43b13e?{'count':_0x5778b2,'rows':_0x43b13e}:null;}})[_0x731e('0x21')](respondWithResult(_0x1f520e,null))[_0x731e('0x3f')](handleError(_0x1f520e,null));};exports[_0x731e('0x50')]=function(_0x752119,_0x43e4dd,_0x297ff8){if(_0x752119[_0x731e('0x44')]['id']){delete _0x752119[_0x731e('0x44')]['id'];}return db['ZendeskConfiguration'][_0x731e('0x4a')]({'where':{'id':_0x752119[_0x731e('0x41')]['id']}})[_0x731e('0x21')](handleEntityNotFound(_0x43e4dd,null))[_0x731e('0x21')](function(_0x5ff6eb){if(_0x5ff6eb){return _0x5ff6eb[_0x731e('0x50')](_0x752119[_0x731e('0x44')][_0x731e('0x51')]||[]);}return null;})[_0x731e('0x21')](respondWithResult(_0x43e4dd,null))[_0x731e('0x3f')](handleError(_0x43e4dd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 532c420..c1e4c50 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 _0xeb74=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a45f1,_0x3dbade){var _0xbf5bc0=function(_0x70c503){while(--_0x70c503){_0x5a45f1['push'](_0x5a45f1['shift']());}};_0xbf5bc0(++_0x3dbade);}(_0xeb74,0xe3));var _0x4eb7=function(_0x2c4f7d,_0x1e8928){_0x2c4f7d=_0x2c4f7d-0x0;var _0x3822a3=_0xeb74[_0x2c4f7d];return _0x3822a3;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var logger=require(_0x4eb7('0x2'))(_0x4eb7('0x3'));var moment=require(_0x4eb7('0x4'));var BPromise=require(_0x4eb7('0x5'));var rp=require(_0x4eb7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var attributes=require(_0x4eb7('0x9'));module[_0x4eb7('0xa')]=function(_0xa6e086,_0x563d6e){return _0xa6e086[_0x4eb7('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x4eb7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf2f=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0xec8f78,_0x3b0b0b){var _0x2bf552=function(_0x29181e){while(--_0x29181e){_0xec8f78['push'](_0xec8f78['shift']());}};_0x2bf552(++_0x3b0b0b);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x4305db,_0x2812a2){_0x4305db=_0x4305db-0x0;var _0x432b2d=_0xcf2f[_0x4305db];return _0x432b2d;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var logger=require(_0xfcf2('0x2'))(_0xfcf2('0x3'));var moment=require(_0xfcf2('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcf2('0x5'));var fs=require('fs');var path=require(_0xfcf2('0x6'));var rimraf=require(_0xfcf2('0x7'));var config=require(_0xfcf2('0x8'));var attributes=require(_0xfcf2('0x9'));module[_0xfcf2('0xa')]=function(_0x1e6d99,_0x3a4950){return _0x1e6d99[_0xfcf2('0xb')](_0xfcf2('0xc'),attributes,{'tableName':_0xfcf2('0xd'),'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 ebe87f4..98de083 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 _0x4dfd=['../../config/environment','jayson/promise','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4dfd,0x1d5));var _0xd4df=function(_0x5d2756,_0x3a5de6){_0x5d2756=_0x5d2756-0x0;var _0x59fd04=_0x4dfd[_0x5d2756];return _0x59fd04;};'use strict';var _=require('lodash');var util=require(_0xd4df('0x0'));var moment=require(_0xd4df('0x1'));var BPromise=require('bluebird');var rs=require(_0xd4df('0x2'));var fs=require('fs');var Redis=require(_0xd4df('0x3'));var db=require(_0xd4df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd4df('0x5'));var config=require(_0xd4df('0x6'));var jayson=require(_0xd4df('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a10a,_0x1bf7b5,_0x2754b9){return new BPromise(function(_0x30b22d,_0x4d9cb1){return client[_0xd4df('0x8')](_0xb9a10a,_0x2754b9)[_0xd4df('0x9')](function(_0x144f96){logger[_0xd4df('0xa')](_0xd4df('0xb'),_0x1bf7b5,_0xd4df('0xc'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1bf7b5,_0xd4df('0xc'),JSON[_0xd4df('0xd')](_0x144f96));if(_0x144f96[_0xd4df('0xe')]){if(_0x144f96['error'][_0xd4df('0xf')]===0x1f4){logger['error'](_0xd4df('0xb'),_0x1bf7b5,_0x144f96[_0xd4df('0xe')][_0xd4df('0x10')]);return _0x4d9cb1(_0x144f96[_0xd4df('0xe')][_0xd4df('0x10')]);}logger['error'](_0xd4df('0xb'),_0x1bf7b5,_0x144f96[_0xd4df('0xe')]['message']);return _0x30b22d(_0x144f96[_0xd4df('0xe')][_0xd4df('0x10')]);}else{logger[_0xd4df('0xa')](_0xd4df('0xb'),_0x1bf7b5,_0xd4df('0xc'));_0x30b22d(_0x144f96[_0xd4df('0x11')]['message']);}})[_0xd4df('0x12')](function(_0xad4f80){logger['error'](_0xd4df('0xb'),_0x1bf7b5,_0xad4f80);_0x4d9cb1(_0xad4f80);});});} \ No newline at end of file +var _0x5f19=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x434a38,_0x1a4e32){var _0x30232e=function(_0x4979bb){while(--_0x4979bb){_0x434a38['push'](_0x434a38['shift']());}};_0x30232e(++_0x1a4e32);}(_0x5f19,0xd8));var _0x95f1=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x5f19[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x95f1('0x0'));var util=require(_0x95f1('0x1'));var moment=require('moment');var BPromise=require(_0x95f1('0x2'));var rs=require(_0x95f1('0x3'));var fs=require('fs');var Redis=require(_0x95f1('0x4'));var db=require(_0x95f1('0x5'))['db'];var utils=require(_0x95f1('0x6'));var logger=require(_0x95f1('0x7'))(_0x95f1('0x8'));var config=require('../../config/environment');var jayson=require(_0x95f1('0x9'));var client=jayson[_0x95f1('0xa')][_0x95f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28656e,_0x209a51,_0x15940f){return new BPromise(function(_0x16fb18,_0x106440){return client[_0x95f1('0xc')](_0x28656e,_0x15940f)[_0x95f1('0xd')](function(_0x2a74b3){logger[_0x95f1('0xe')](_0x95f1('0xf'),_0x209a51,_0x95f1('0x10'));logger['debug'](_0x95f1('0x11'),_0x209a51,_0x95f1('0x10'),JSON['stringify'](_0x2a74b3));if(_0x2a74b3['error']){if(_0x2a74b3[_0x95f1('0x12')]['code']===0x1f4){logger[_0x95f1('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x209a51,_0x2a74b3['error'][_0x95f1('0x13')]);return _0x106440(_0x2a74b3['error'][_0x95f1('0x13')]);}logger[_0x95f1('0x12')](_0x95f1('0xf'),_0x209a51,_0x2a74b3[_0x95f1('0x12')][_0x95f1('0x13')]);return _0x16fb18(_0x2a74b3[_0x95f1('0x12')][_0x95f1('0x13')]);}else{logger['info'](_0x95f1('0xf'),_0x209a51,_0x95f1('0x10'));_0x16fb18(_0x2a74b3['result'][_0x95f1('0x13')]);}})[_0x95f1('0x14')](function(_0x1cbf60){logger['error'](_0x95f1('0xf'),_0x209a51,_0x1cbf60);_0x106440(_0x1cbf60);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index db4a4f5..cd36468 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 _0x1bc6=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x16fad0,_0x57cfbd){var _0x30fb58=function(_0x2aa0c6){while(--_0x2aa0c6){_0x16fad0['push'](_0x16fad0['shift']());}};_0x30fb58(++_0x57cfbd);}(_0x1bc6,0x13e));var _0x61bc=function(_0x3e3bf6,_0x8021e9){_0x3e3bf6=_0x3e3bf6-0x0;var _0x57d0d0=_0x1bc6[_0x3e3bf6];return _0x57d0d0;};'use strict';var multer=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var path=require('path');var timeout=require(_0x61bc('0x2'));var express=require('express');var router=express[_0x61bc('0x3')]();var fs_extra=require(_0x61bc('0x4'));var auth=require(_0x61bc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x61bc('0x6'));var controller=require(_0x61bc('0x7'));router['get']('/',auth[_0x61bc('0x8')](),controller[_0x61bc('0x9')]);router[_0x61bc('0xa')](_0x61bc('0xb'),auth['isAuthenticated'](),controller[_0x61bc('0xc')]);router[_0x61bc('0xd')]('/',auth[_0x61bc('0x8')](),controller[_0x61bc('0xe')]);router[_0x61bc('0xf')](_0x61bc('0xb'),auth[_0x61bc('0x8')](),controller[_0x61bc('0x10')]);router[_0x61bc('0x11')](_0x61bc('0xb'),auth[_0x61bc('0x8')](),controller[_0x61bc('0x12')]);module[_0x61bc('0x13')]=router; \ No newline at end of file +var _0x3d4e=['/:id','post','create','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index'];(function(_0x27c50b,_0x2a700a){var _0x407bf1=function(_0x1c2268){while(--_0x1c2268){_0x27c50b['push'](_0x27c50b['shift']());}};_0x407bf1(++_0x2a700a);}(_0x3d4e,0xce));var _0xe3d4=function(_0x5a5267,_0x269cf7){_0x5a5267=_0x5a5267-0x0;var _0x13c022=_0x3d4e[_0x5a5267];return _0x13c022;};'use strict';var multer=require('multer');var util=require(_0xe3d4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3d4('0x1'));var router=express[_0xe3d4('0x2')]();var fs_extra=require(_0xe3d4('0x3'));var auth=require(_0xe3d4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe3d4('0x5'));var controller=require(_0xe3d4('0x6'));router[_0xe3d4('0x7')]('/',auth[_0xe3d4('0x8')](),controller[_0xe3d4('0x9')]);router[_0xe3d4('0x7')](_0xe3d4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe3d4('0xb')]('/',auth[_0xe3d4('0x8')](),controller[_0xe3d4('0xc')]);router[_0xe3d4('0xd')]('/:id',auth[_0xe3d4('0x8')](),controller[_0xe3d4('0xe')]);router[_0xe3d4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe3d4('0x10')]);module[_0xe3d4('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 90823bc..5980d97 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 _0xfdc9=['ENUM','customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize'];(function(_0x4b6e2d,_0x2cbca8){var _0x1eb728=function(_0x2ea781){while(--_0x2ea781){_0x4b6e2d['push'](_0x4b6e2d['shift']());}};_0x1eb728(++_0x2cbca8);}(_0xfdc9,0x98));var _0x9fdc=function(_0x498010,_0x3339e5){_0x498010=_0x498010-0x0;var _0x47b1dc=_0xfdc9[_0x498010];return _0x47b1dc;};'use strict';var Sequelize=require(_0x9fdc('0x0'));module['exports']={'type':{'type':Sequelize[_0x9fdc('0x1')]('string','variable',_0x9fdc('0x2'),_0x9fdc('0x3'),_0x9fdc('0x4')),'defaultValue':_0x9fdc('0x5')},'content':{'type':Sequelize[_0x9fdc('0x6')]},'key':{'type':Sequelize[_0x9fdc('0x6')]},'keyType':{'type':Sequelize[_0x9fdc('0x1')]('string',_0x9fdc('0x7'),_0x9fdc('0x2'))},'keyContent':{'type':Sequelize[_0x9fdc('0x6')]},'idField':{'type':Sequelize[_0x9fdc('0x6')]},'nameField':{'type':Sequelize[_0x9fdc('0x6')]},'customField':{'type':Sequelize[_0x9fdc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9fdc('0x6')]}}; \ No newline at end of file +var _0xeb64=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0xc8f4c2,_0x5905ca){var _0x17b8f2=function(_0x45e079){while(--_0x45e079){_0xc8f4c2['push'](_0xc8f4c2['shift']());}};_0x17b8f2(++_0x5905ca);}(_0xeb64,0x145));var _0x4eb6=function(_0x16a690,_0x17c364){_0x16a690=_0x16a690-0x0;var _0x43833c=_0xeb64[_0x16a690];return _0x43833c;};'use strict';var Sequelize=require(_0x4eb6('0x0'));module[_0x4eb6('0x1')]={'type':{'type':Sequelize[_0x4eb6('0x2')]('string','variable',_0x4eb6('0x3'),_0x4eb6('0x4'),_0x4eb6('0x5')),'defaultValue':_0x4eb6('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4eb6('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4eb6('0x6'),'variable',_0x4eb6('0x3'))},'keyContent':{'type':Sequelize[_0x4eb6('0x7')]},'idField':{'type':Sequelize[_0x4eb6('0x7')]},'nameField':{'type':Sequelize[_0x4eb6('0x7')]},'customField':{'type':Sequelize[_0x4eb6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4eb6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ed8c53e..ae7aaeb 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 _0xdd1d=['send','index','ZendeskField','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdd1d,0xb2));var _0xddd1=function(_0x15f852,_0x530d85){_0x15f852=_0x15f852-0x0;var _0x387460=_0xdd1d[_0x15f852];return _0x387460;};'use strict';var emlformat=require(_0xddd1('0x0'));var rimraf=require(_0xddd1('0x1'));var zipdir=require(_0xddd1('0x2'));var jsonpatch=require(_0xddd1('0x3'));var rp=require(_0xddd1('0x4'));var moment=require('moment');var BPromise=require(_0xddd1('0x5'));var Mustache=require(_0xddd1('0x6'));var util=require(_0xddd1('0x7'));var path=require('path');var sox=require(_0xddd1('0x8'));var csv=require('to-csv');var ejs=require(_0xddd1('0x9'));var fs=require('fs');var fs_extra=require(_0xddd1('0xa'));var _=require(_0xddd1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xddd1('0xc'));var deskjs=require(_0xddd1('0xd'));var toCsv=require(_0xddd1('0xe'));var querystring=require(_0xddd1('0xf'));var Papa=require(_0xddd1('0x10'));var Redis=require(_0xddd1('0x11'));var authService=require(_0xddd1('0x12'));var qs=require(_0xddd1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddd1('0x14'));var logger=require('../../config/logger')(_0xddd1('0x15'));var utils=require('../../config/utils');var config=require(_0xddd1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bc189,_0x61ab1f){_0x61ab1f=_0x61ab1f||0xcc;return function(_0x8f310e){if(_0x8f310e){return _0x1bc189['sendStatus'](_0x61ab1f);}return _0x1bc189[_0xddd1('0x17')](_0x61ab1f)['end']();};}function respondWithResult(_0x40d46c,_0x39f454){_0x39f454=_0x39f454||0xc8;return function(_0x322271){if(_0x322271){return _0x40d46c[_0xddd1('0x17')](_0x39f454)[_0xddd1('0x18')](_0x322271);}};}function respondWithFilteredResult(_0x2653da,_0x55bd2f){return function(_0x105992){if(_0x105992){var _0x25ca98=typeof _0x55bd2f[_0xddd1('0x19')]===_0xddd1('0x1a')&&typeof _0x55bd2f['limit']==='undefined';var _0x55f544=_0x105992[_0xddd1('0x1b')];var _0x5e5685=_0x25ca98?0x0:_0x55bd2f['offset'];var _0x1e02e6=_0x25ca98?_0x105992[_0xddd1('0x1b')]:_0x55bd2f['offset']+_0x55bd2f[_0xddd1('0x1c')];var _0x49a9cd;if(_0x1e02e6>=_0x55f544){_0x1e02e6=_0x55f544;_0x49a9cd=0xc8;}else{_0x49a9cd=0xce;}_0x2653da[_0xddd1('0x17')](_0x49a9cd);return _0x2653da['set'](_0xddd1('0x1d'),_0x5e5685+'-'+_0x1e02e6+'/'+_0x55f544)['json'](_0x105992);}return null;};}function patchUpdates(_0x29c843){return function(_0x4ecd1a){try{jsonpatch[_0xddd1('0x1e')](_0x4ecd1a,_0x29c843,!![]);}catch(_0x2e1dd2){return BPromise[_0xddd1('0x1f')](_0x2e1dd2);}return _0x4ecd1a[_0xddd1('0x20')]();};}function saveUpdates(_0x131e88,_0x380899){return function(_0x584361){if(_0x584361){return _0x584361[_0xddd1('0x21')](_0x131e88)[_0xddd1('0x22')](function(_0x292e60){return _0x292e60;});}return null;};}function removeEntity(_0x24a032,_0x2ab61e){return function(_0x3982f7){if(_0x3982f7){return _0x3982f7[_0xddd1('0x23')]()[_0xddd1('0x22')](function(){_0x24a032['status'](0xcc)[_0xddd1('0x24')]();});}};}function handleEntityNotFound(_0xa78f19,_0x14b43f){return function(_0x2f0e6e){if(!_0x2f0e6e){_0xa78f19[_0xddd1('0x25')](0x194);}return _0x2f0e6e;};}function handleError(_0x23f1fa,_0x4bc6a4){_0x4bc6a4=_0x4bc6a4||0x1f4;return function(_0x1898b7){logger[_0xddd1('0x26')](_0x1898b7[_0xddd1('0x27')]);if(_0x1898b7[_0xddd1('0x28')]){delete _0x1898b7['name'];}_0x23f1fa['status'](_0x4bc6a4)[_0xddd1('0x29')](_0x1898b7);};}exports[_0xddd1('0x2a')]=function(_0x4f7bd7,_0x58f8f9){var _0x4b8947={},_0x201b09={},_0x146bcb={'count':0x0,'rows':[]};var _0x49cc43=_['map'](db[_0xddd1('0x2b')][_0xddd1('0x2c')],function(_0x5e8bb0){return{'name':_0x5e8bb0[_0xddd1('0x2d')],'type':_0x5e8bb0[_0xddd1('0x2e')]['key']};});_0x201b09[_0xddd1('0x2f')]=_['map'](_0x49cc43,_0xddd1('0x28'));_0x201b09[_0xddd1('0x30')]=_['keys'](_0x4f7bd7[_0xddd1('0x30')]);_0x201b09['filters']=_[_0xddd1('0x31')](_0x201b09[_0xddd1('0x2f')],_0x201b09['query']);_0x4b8947['attributes']=_[_0xddd1('0x31')](_0x201b09['model'],qs[_0xddd1('0x32')](_0x4f7bd7['query']['fields']));_0x4b8947[_0xddd1('0x33')]=_0x4b8947[_0xddd1('0x33')][_0xddd1('0x34')]?_0x4b8947['attributes']:_0x201b09[_0xddd1('0x2f')];if(!_0x4f7bd7['query'][_0xddd1('0x35')]('nolimit')){_0x4b8947[_0xddd1('0x1c')]=qs[_0xddd1('0x1c')](_0x4f7bd7[_0xddd1('0x30')]['limit']);_0x4b8947['offset']=qs['offset'](_0x4f7bd7[_0xddd1('0x30')][_0xddd1('0x19')]);}_0x4b8947[_0xddd1('0x36')]=qs[_0xddd1('0x37')](_0x4f7bd7['query'][_0xddd1('0x37')]);_0x4b8947[_0xddd1('0x38')]=qs[_0xddd1('0x39')](_[_0xddd1('0x3a')](_0x4f7bd7[_0xddd1('0x30')],_0x201b09[_0xddd1('0x39')]),_0x49cc43);if(_0x4f7bd7[_0xddd1('0x30')]['filter']){_0x4b8947['where']=_['merge'](_0x4b8947[_0xddd1('0x38')],{'$or':_[_0xddd1('0x3b')](_0x49cc43,function(_0x184880){if(_0x184880[_0xddd1('0x2e')]!==_0xddd1('0x3c')){var _0x57a513={};_0x57a513[_0x184880[_0xddd1('0x28')]]={'$like':'%'+_0x4f7bd7['query']['filter']+'%'};return _0x57a513;}})});}_0x4b8947=_['merge']({},_0x4b8947,_0x4f7bd7[_0xddd1('0x3d')]);var _0x218891={'where':_0x4b8947[_0xddd1('0x38')]};return db['ZendeskField'][_0xddd1('0x1b')](_0x218891)[_0xddd1('0x22')](function(_0x132d46){_0x146bcb[_0xddd1('0x1b')]=_0x132d46;if(_0x4f7bd7[_0xddd1('0x30')][_0xddd1('0x3e')]){_0x4b8947[_0xddd1('0x3f')]=[{'all':!![]}];}return db[_0xddd1('0x2b')][_0xddd1('0x40')](_0x4b8947);})[_0xddd1('0x22')](function(_0x14f2e8){_0x146bcb['rows']=_0x14f2e8;return _0x146bcb;})[_0xddd1('0x22')](respondWithFilteredResult(_0x58f8f9,_0x4b8947))[_0xddd1('0x41')](handleError(_0x58f8f9,null));};exports[_0xddd1('0x42')]=function(_0x3f19ed,_0x36ea56){var _0x53b8e5={'raw':!![],'where':{'id':_0x3f19ed[_0xddd1('0x43')]['id']}},_0x3da1d2={};_0x3da1d2[_0xddd1('0x2f')]=_[_0xddd1('0x44')](db['ZendeskField'][_0xddd1('0x2c')]);_0x3da1d2[_0xddd1('0x30')]=_[_0xddd1('0x44')](_0x3f19ed['query']);_0x3da1d2[_0xddd1('0x39')]=_[_0xddd1('0x31')](_0x3da1d2['model'],_0x3da1d2[_0xddd1('0x30')]);_0x53b8e5[_0xddd1('0x33')]=_[_0xddd1('0x31')](_0x3da1d2[_0xddd1('0x2f')],qs[_0xddd1('0x32')](_0x3f19ed['query']['fields']));_0x53b8e5[_0xddd1('0x33')]=_0x53b8e5[_0xddd1('0x33')][_0xddd1('0x34')]?_0x53b8e5[_0xddd1('0x33')]:_0x3da1d2[_0xddd1('0x2f')];if(_0x3f19ed['query'][_0xddd1('0x3e')]){_0x53b8e5[_0xddd1('0x3f')]=[{'all':!![]}];}_0x53b8e5=_[_0xddd1('0x45')]({},_0x53b8e5,_0x3f19ed[_0xddd1('0x3d')]);return db[_0xddd1('0x2b')][_0xddd1('0x46')](_0x53b8e5)[_0xddd1('0x22')](handleEntityNotFound(_0x36ea56,null))[_0xddd1('0x22')](respondWithResult(_0x36ea56,null))[_0xddd1('0x41')](handleError(_0x36ea56,null));};exports['create']=function(_0x4237f6,_0x427698){return db[_0xddd1('0x2b')][_0xddd1('0x47')](_0x4237f6[_0xddd1('0x48')],{})[_0xddd1('0x22')](respondWithResult(_0x427698,0xc9))[_0xddd1('0x41')](handleError(_0x427698,null));};exports[_0xddd1('0x21')]=function(_0x2321ef,_0x432cef){if(_0x2321ef[_0xddd1('0x48')]['id']){delete _0x2321ef[_0xddd1('0x48')]['id'];}return db[_0xddd1('0x2b')][_0xddd1('0x46')]({'where':{'id':_0x2321ef[_0xddd1('0x43')]['id']}})[_0xddd1('0x22')](handleEntityNotFound(_0x432cef,null))['then'](saveUpdates(_0x2321ef[_0xddd1('0x48')],null))['then'](respondWithResult(_0x432cef,null))['catch'](handleError(_0x432cef,null));};exports['destroy']=function(_0x29c67,_0x4d4aa4){return db['ZendeskField'][_0xddd1('0x46')]({'where':{'id':_0x29c67[_0xddd1('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d4aa4,null))[_0xddd1('0x22')](removeEntity(_0x4d4aa4,null))[_0xddd1('0x41')](handleError(_0x4d4aa4,null));}; \ No newline at end of file +var _0xc188=['sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','stack','name','send','index','map','ZendeskField','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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/license/util','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc188,0xc8));var _0x8c18=function(_0x335f1d,_0x1af0b1){_0x335f1d=_0x335f1d-0x0;var _0x3f64e1=_0xc188[_0x335f1d];return _0x3f64e1;};'use strict';var emlformat=require(_0x8c18('0x0'));var rimraf=require(_0x8c18('0x1'));var zipdir=require(_0x8c18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c18('0x3'));var moment=require(_0x8c18('0x4'));var BPromise=require(_0x8c18('0x5'));var Mustache=require('mustache');var util=require(_0x8c18('0x6'));var path=require(_0x8c18('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c18('0x8'));var fs=require('fs');var fs_extra=require(_0x8c18('0x9'));var _=require(_0x8c18('0xa'));var squel=require(_0x8c18('0xb'));var crypto=require(_0x8c18('0xc'));var jsforce=require(_0x8c18('0xd'));var deskjs=require(_0x8c18('0xe'));var toCsv=require(_0x8c18('0xf'));var querystring=require('querystring');var Papa=require(_0x8c18('0x10'));var Redis=require(_0x8c18('0x11'));var authService=require(_0x8c18('0x12'));var qs=require(_0x8c18('0x13'));var as=require(_0x8c18('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c18('0x15'))(_0x8c18('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8c18('0x17'));var db=require(_0x8c18('0x18'))['db'];function respondWithStatusCode(_0x47bd77,_0xd1ea42){_0xd1ea42=_0xd1ea42||0xcc;return function(_0x2ded89){if(_0x2ded89){return _0x47bd77[_0x8c18('0x19')](_0xd1ea42);}return _0x47bd77['status'](_0xd1ea42)[_0x8c18('0x1a')]();};}function respondWithResult(_0x3dea61,_0x21769e){_0x21769e=_0x21769e||0xc8;return function(_0x38f78b){if(_0x38f78b){return _0x3dea61[_0x8c18('0x1b')](_0x21769e)[_0x8c18('0x1c')](_0x38f78b);}};}function respondWithFilteredResult(_0x1c7734,_0x4dc683){return function(_0x3b58ee){if(_0x3b58ee){var _0x37b250=typeof _0x4dc683['offset']===_0x8c18('0x1d')&&typeof _0x4dc683[_0x8c18('0x1e')]===_0x8c18('0x1d');var _0x40f9d4=_0x3b58ee[_0x8c18('0x1f')];var _0x4bab0e=_0x37b250?0x0:_0x4dc683[_0x8c18('0x20')];var _0x4974c7=_0x37b250?_0x3b58ee['count']:_0x4dc683[_0x8c18('0x20')]+_0x4dc683[_0x8c18('0x1e')];var _0x1e08b7;if(_0x4974c7>=_0x40f9d4){_0x4974c7=_0x40f9d4;_0x1e08b7=0xc8;}else{_0x1e08b7=0xce;}_0x1c7734['status'](_0x1e08b7);return _0x1c7734[_0x8c18('0x21')]('Content-Range',_0x4bab0e+'-'+_0x4974c7+'/'+_0x40f9d4)[_0x8c18('0x1c')](_0x3b58ee);}return null;};}function patchUpdates(_0x3cd0ea){return function(_0x5a6554){try{jsonpatch[_0x8c18('0x22')](_0x5a6554,_0x3cd0ea,!![]);}catch(_0x1fab50){return BPromise[_0x8c18('0x23')](_0x1fab50);}return _0x5a6554[_0x8c18('0x24')]();};}function saveUpdates(_0xf5192a,_0x256721){return function(_0x5b54f8){if(_0x5b54f8){return _0x5b54f8[_0x8c18('0x25')](_0xf5192a)['then'](function(_0x2ddb8e){return _0x2ddb8e;});}return null;};}function removeEntity(_0x1dc566,_0x3aaaf8){return function(_0x3d8c00){if(_0x3d8c00){return _0x3d8c00['destroy']()[_0x8c18('0x26')](function(){_0x1dc566[_0x8c18('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d8bc,_0x4527f5){return function(_0x32c3e4){if(!_0x32c3e4){_0x14d8bc['sendStatus'](0x194);}return _0x32c3e4;};}function handleError(_0x2113ec,_0x12f905){_0x12f905=_0x12f905||0x1f4;return function(_0x33cef0){logger['error'](_0x33cef0[_0x8c18('0x27')]);if(_0x33cef0[_0x8c18('0x28')]){delete _0x33cef0[_0x8c18('0x28')];}_0x2113ec[_0x8c18('0x1b')](_0x12f905)[_0x8c18('0x29')](_0x33cef0);};}exports[_0x8c18('0x2a')]=function(_0x260502,_0x2d93d1){var _0x44c8c6={},_0x12ffc6={},_0x2a05dc={'count':0x0,'rows':[]};var _0x146e0f=_[_0x8c18('0x2b')](db[_0x8c18('0x2c')]['rawAttributes'],function(_0x5938b1){return{'name':_0x5938b1['fieldName'],'type':_0x5938b1[_0x8c18('0x2d')][_0x8c18('0x2e')]};});_0x12ffc6[_0x8c18('0x2f')]=_[_0x8c18('0x2b')](_0x146e0f,_0x8c18('0x28'));_0x12ffc6[_0x8c18('0x30')]=_[_0x8c18('0x31')](_0x260502[_0x8c18('0x30')]);_0x12ffc6[_0x8c18('0x32')]=_[_0x8c18('0x33')](_0x12ffc6[_0x8c18('0x2f')],_0x12ffc6[_0x8c18('0x30')]);_0x44c8c6[_0x8c18('0x34')]=_['intersection'](_0x12ffc6['model'],qs['fields'](_0x260502['query'][_0x8c18('0x35')]));_0x44c8c6[_0x8c18('0x34')]=_0x44c8c6['attributes']['length']?_0x44c8c6[_0x8c18('0x34')]:_0x12ffc6['model'];if(!_0x260502[_0x8c18('0x30')][_0x8c18('0x36')](_0x8c18('0x37'))){_0x44c8c6[_0x8c18('0x1e')]=qs[_0x8c18('0x1e')](_0x260502['query'][_0x8c18('0x1e')]);_0x44c8c6[_0x8c18('0x20')]=qs['offset'](_0x260502[_0x8c18('0x30')][_0x8c18('0x20')]);}_0x44c8c6[_0x8c18('0x38')]=qs[_0x8c18('0x39')](_0x260502[_0x8c18('0x30')]['sort']);_0x44c8c6[_0x8c18('0x3a')]=qs['filters'](_[_0x8c18('0x3b')](_0x260502[_0x8c18('0x30')],_0x12ffc6[_0x8c18('0x32')]),_0x146e0f);if(_0x260502[_0x8c18('0x30')][_0x8c18('0x3c')]){_0x44c8c6[_0x8c18('0x3a')]=_[_0x8c18('0x3d')](_0x44c8c6[_0x8c18('0x3a')],{'$or':_['map'](_0x146e0f,function(_0x292901){if(_0x292901[_0x8c18('0x2d')]!==_0x8c18('0x3e')){var _0xbaf4c={};_0xbaf4c[_0x292901['name']]={'$like':'%'+_0x260502[_0x8c18('0x30')][_0x8c18('0x3c')]+'%'};return _0xbaf4c;}})});}_0x44c8c6=_[_0x8c18('0x3d')]({},_0x44c8c6,_0x260502['options']);var _0x147672={'where':_0x44c8c6[_0x8c18('0x3a')]};return db[_0x8c18('0x2c')][_0x8c18('0x1f')](_0x147672)['then'](function(_0x32359f){_0x2a05dc[_0x8c18('0x1f')]=_0x32359f;if(_0x260502[_0x8c18('0x30')][_0x8c18('0x3f')]){_0x44c8c6[_0x8c18('0x40')]=[{'all':!![]}];}return db[_0x8c18('0x2c')][_0x8c18('0x41')](_0x44c8c6);})[_0x8c18('0x26')](function(_0x51cf87){_0x2a05dc['rows']=_0x51cf87;return _0x2a05dc;})[_0x8c18('0x26')](respondWithFilteredResult(_0x2d93d1,_0x44c8c6))['catch'](handleError(_0x2d93d1,null));};exports[_0x8c18('0x42')]=function(_0x4ce660,_0x30cdba){var _0x38b155={'raw':!![],'where':{'id':_0x4ce660[_0x8c18('0x43')]['id']}},_0x24c049={};_0x24c049[_0x8c18('0x2f')]=_['keys'](db['ZendeskField'][_0x8c18('0x44')]);_0x24c049[_0x8c18('0x30')]=_[_0x8c18('0x31')](_0x4ce660[_0x8c18('0x30')]);_0x24c049[_0x8c18('0x32')]=_[_0x8c18('0x33')](_0x24c049[_0x8c18('0x2f')],_0x24c049['query']);_0x38b155['attributes']=_[_0x8c18('0x33')](_0x24c049[_0x8c18('0x2f')],qs[_0x8c18('0x35')](_0x4ce660[_0x8c18('0x30')]['fields']));_0x38b155[_0x8c18('0x34')]=_0x38b155[_0x8c18('0x34')]['length']?_0x38b155['attributes']:_0x24c049['model'];if(_0x4ce660[_0x8c18('0x30')][_0x8c18('0x3f')]){_0x38b155[_0x8c18('0x40')]=[{'all':!![]}];}_0x38b155=_[_0x8c18('0x3d')]({},_0x38b155,_0x4ce660[_0x8c18('0x45')]);return db[_0x8c18('0x2c')][_0x8c18('0x46')](_0x38b155)[_0x8c18('0x26')](handleEntityNotFound(_0x30cdba,null))[_0x8c18('0x26')](respondWithResult(_0x30cdba,null))[_0x8c18('0x47')](handleError(_0x30cdba,null));};exports[_0x8c18('0x48')]=function(_0x29a54d,_0x2caef5){return db[_0x8c18('0x2c')][_0x8c18('0x48')](_0x29a54d[_0x8c18('0x49')],{})[_0x8c18('0x26')](respondWithResult(_0x2caef5,0xc9))[_0x8c18('0x47')](handleError(_0x2caef5,null));};exports['update']=function(_0x1cbd49,_0x2446f7){if(_0x1cbd49[_0x8c18('0x49')]['id']){delete _0x1cbd49['body']['id'];}return db['ZendeskField'][_0x8c18('0x46')]({'where':{'id':_0x1cbd49[_0x8c18('0x43')]['id']}})[_0x8c18('0x26')](handleEntityNotFound(_0x2446f7,null))[_0x8c18('0x26')](saveUpdates(_0x1cbd49[_0x8c18('0x49')],null))[_0x8c18('0x26')](respondWithResult(_0x2446f7,null))[_0x8c18('0x47')](handleError(_0x2446f7,null));};exports[_0x8c18('0x4a')]=function(_0x289052,_0x4c1cdf){return db[_0x8c18('0x2c')]['find']({'where':{'id':_0x289052[_0x8c18('0x43')]['id']}})[_0x8c18('0x26')](handleEntityNotFound(_0x4c1cdf,null))[_0x8c18('0x26')](removeEntity(_0x4c1cdf,null))[_0x8c18('0x47')](handleError(_0x4c1cdf,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e3df4ee..55b1d8c 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 _0x01d3=['FieldId','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x59d726,_0x4d5832){var _0xe77ce1=function(_0xf18ec2){while(--_0xf18ec2){_0x59d726['push'](_0x59d726['shift']());}};_0xe77ce1(++_0x4d5832);}(_0x01d3,0x1eb));var _0x301d=function(_0x2dfce4,_0x5cae9f){_0x2dfce4=_0x2dfce4-0x0;var _0x51a8dc=_0x01d3[_0x2dfce4];return _0x51a8dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x301d('0x0'));var moment=require(_0x301d('0x1'));var BPromise=require(_0x301d('0x2'));var rp=require(_0x301d('0x3'));var fs=require('fs');var path=require(_0x301d('0x4'));var rimraf=require('rimraf');var config=require(_0x301d('0x5'));var attributes=require(_0x301d('0x6'));module[_0x301d('0x7')]=function(_0x8ddafd,_0x4a92ea){return _0x8ddafd[_0x301d('0x8')](_0x301d('0x9'),attributes,{'tableName':_0x301d('0xa'),'paranoid':![],'indexes':[{'name':_0x301d('0xb'),'fields':[_0x301d('0xc'),_0x301d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f47=['moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','util'];(function(_0x1610a9,_0x12b812){var _0x33a66e=function(_0x70738f){while(--_0x70738f){_0x1610a9['push'](_0x1610a9['shift']());}};_0x33a66e(++_0x12b812);}(_0x3f47,0x167));var _0x73f4=function(_0x19dc3f,_0x22c481){_0x19dc3f=_0x19dc3f-0x0;var _0x41ec2a=_0x3f47[_0x19dc3f];return _0x41ec2a;};'use strict';var _=require('lodash');var util=require(_0x73f4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x73f4('0x1'));var BPromise=require(_0x73f4('0x2'));var rp=require(_0x73f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x73f4('0x4'));var attributes=require(_0x73f4('0x5'));module[_0x73f4('0x6')]=function(_0x1074fc,_0xc432d7){return _0x1074fc[_0x73f4('0x7')](_0x73f4('0x8'),attributes,{'tableName':_0x73f4('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x73f4('0xa'),_0x73f4('0xb')],'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 20af202..efc996b 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 _0xfeaa=['client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a91a5,_0x1eb099){var _0x8f99de=function(_0x579b28){while(--_0x579b28){_0x5a91a5['push'](_0x5a91a5['shift']());}};_0x8f99de(++_0x1eb099);}(_0xfeaa,0xe5));var _0xafea=function(_0xe1f677,_0x7b5de){_0xe1f677=_0xe1f677-0x0;var _0x1e9701=_0xfeaa[_0xe1f677];return _0x1e9701;};'use strict';var _=require(_0xafea('0x0'));var util=require(_0xafea('0x1'));var moment=require(_0xafea('0x2'));var BPromise=require(_0xafea('0x3'));var rs=require(_0xafea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafea('0x5'))['db'];var utils=require(_0xafea('0x6'));var logger=require(_0xafea('0x7'))(_0xafea('0x8'));var config=require(_0xafea('0x9'));var jayson=require(_0xafea('0xa'));var client=jayson[_0xafea('0xb')][_0xafea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59e673,_0x5e44cb,_0x27df7a){return new BPromise(function(_0x3c20bc,_0x34cca3){return client[_0xafea('0xd')](_0x59e673,_0x27df7a)[_0xafea('0xe')](function(_0x4a28e3){logger[_0xafea('0xf')](_0xafea('0x10'),_0x5e44cb,_0xafea('0x11'));logger[_0xafea('0x12')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5e44cb,_0xafea('0x11'),JSON[_0xafea('0x13')](_0x4a28e3));if(_0x4a28e3[_0xafea('0x14')]){if(_0x4a28e3[_0xafea('0x14')]['code']===0x1f4){logger[_0xafea('0x14')](_0xafea('0x10'),_0x5e44cb,_0x4a28e3['error'][_0xafea('0x15')]);return _0x34cca3(_0x4a28e3['error']['message']);}logger['error'](_0xafea('0x10'),_0x5e44cb,_0x4a28e3['error'][_0xafea('0x15')]);return _0x3c20bc(_0x4a28e3[_0xafea('0x14')][_0xafea('0x15')]);}else{logger[_0xafea('0xf')](_0xafea('0x10'),_0x5e44cb,'request\x20sent');_0x3c20bc(_0x4a28e3[_0xafea('0x16')][_0xafea('0x15')]);}})[_0xafea('0x17')](function(_0x356a8a){logger[_0xafea('0x14')](_0xafea('0x10'),_0x5e44cb,_0x356a8a);_0x34cca3(_0x356a8a);});});} \ No newline at end of file +var _0xbece=['request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbece,0xd1));var _0xebec=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbece[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xebec('0x0'));var util=require(_0xebec('0x1'));var moment=require('moment');var BPromise=require(_0xebec('0x2'));var rs=require(_0xebec('0x3'));var fs=require('fs');var Redis=require(_0xebec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xebec('0x5'));var logger=require(_0xebec('0x6'))(_0xebec('0x7'));var config=require(_0xebec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xebec('0x9')][_0xebec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c6bcc,_0x26e844,_0x1f7790){return new BPromise(function(_0x59ace0,_0x4f0b40){return client[_0xebec('0xb')](_0x3c6bcc,_0x1f7790)[_0xebec('0xc')](function(_0x444737){logger[_0xebec('0xd')](_0xebec('0xe'),_0x26e844,'request\x20sent');logger[_0xebec('0xf')](_0xebec('0x10'),_0x26e844,_0xebec('0x11'),JSON[_0xebec('0x12')](_0x444737));if(_0x444737[_0xebec('0x13')]){if(_0x444737[_0xebec('0x13')]['code']===0x1f4){logger[_0xebec('0x13')](_0xebec('0xe'),_0x26e844,_0x444737[_0xebec('0x13')][_0xebec('0x14')]);return _0x4f0b40(_0x444737['error'][_0xebec('0x14')]);}logger[_0xebec('0x13')](_0xebec('0xe'),_0x26e844,_0x444737[_0xebec('0x13')][_0xebec('0x14')]);return _0x59ace0(_0x444737[_0xebec('0x13')]['message']);}else{logger[_0xebec('0xd')](_0xebec('0xe'),_0x26e844,_0xebec('0x11'));_0x59ace0(_0x444737['result'][_0xebec('0x14')]);}})[_0xebec('0x15')](function(_0x45b1d1){logger[_0xebec('0x13')](_0xebec('0xe'),_0x26e844,_0x45b1d1);_0x4f0b40(_0x45b1d1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6e7889f..e20627f 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 _0x5ec0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','isAuthenticated','delete','destroy','exports','multer','util','path'];(function(_0xf6dfd8,_0x353f79){var _0x2ff982=function(_0x41a5b3){while(--_0x41a5b3){_0xf6dfd8['push'](_0xf6dfd8['shift']());}};_0x2ff982(++_0x353f79);}(_0x5ec0,0x14d));var _0x05ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5ec0[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x05ec('0x0'));var util=require(_0x05ec('0x1'));var path=require(_0x05ec('0x2'));var timeout=require(_0x05ec('0x3'));var express=require('express');var router=express[_0x05ec('0x4')]();var fs_extra=require(_0x05ec('0x5'));var auth=require(_0x05ec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05ec('0x7'));var controller=require('./intZohoAccount.controller');router[_0x05ec('0x8')]('/',auth['isAuthenticated'](),controller[_0x05ec('0x9')]);router[_0x05ec('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x05ec('0xa')]);router[_0x05ec('0x8')](_0x05ec('0xb'),auth['isAuthenticated'](),controller[_0x05ec('0xc')]);router[_0x05ec('0x8')](_0x05ec('0xd'),auth['isAuthenticated'](),controller[_0x05ec('0xe')]);router[_0x05ec('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x05ec('0xf')](_0x05ec('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x05ec('0x10')]('/:id',auth[_0x05ec('0x11')](),controller['update']);router[_0x05ec('0x12')]('/:id',auth[_0x05ec('0x11')](),controller[_0x05ec('0x13')]);module[_0x05ec('0x14')]=router; \ No newline at end of file +var _0xe927=['/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id'];(function(_0x506cbf,_0x1abfcb){var _0x10ce86=function(_0x3dfef9){while(--_0x3dfef9){_0x506cbf['push'](_0x506cbf['shift']());}};_0x10ce86(++_0x1abfcb);}(_0xe927,0x88));var _0x7e92=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xe927[_0x5951e8];return _0x20a1f5;};'use strict';var multer=require(_0x7e92('0x0'));var util=require('util');var path=require(_0x7e92('0x1'));var timeout=require(_0x7e92('0x2'));var express=require(_0x7e92('0x3'));var router=express[_0x7e92('0x4')]();var fs_extra=require(_0x7e92('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e92('0x6'));var config=require(_0x7e92('0x7'));var controller=require(_0x7e92('0x8'));router[_0x7e92('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e92('0x9')](_0x7e92('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7e92('0x9')](_0x7e92('0xb'),auth['isAuthenticated'](),controller[_0x7e92('0xc')]);router[_0x7e92('0x9')](_0x7e92('0xd'),auth[_0x7e92('0xe')](),controller[_0x7e92('0xf')]);router[_0x7e92('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7e92('0x10')]('/:id/configurations',auth[_0x7e92('0xe')](),controller['addConfiguration']);router[_0x7e92('0x11')](_0x7e92('0xa'),auth[_0x7e92('0xe')](),controller['update']);router[_0x7e92('0x12')](_0x7e92('0xa'),auth[_0x7e92('0xe')](),controller[_0x7e92('0x13')]);module[_0x7e92('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1ff6fcb..32afb75 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 _0xf4eb=['sequelize','STRING'];(function(_0x1336e4,_0x13cad5){var _0xcd2452=function(_0x12ff7d){while(--_0x12ff7d){_0x1336e4['push'](_0x1336e4['shift']());}};_0xcd2452(++_0x13cad5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x34fb66,_0x3439ec){_0x34fb66=_0x34fb66-0x0;var _0x165441=_0xf4eb[_0x34fb66];return _0x165441;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbf4e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf4e('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xbf4e('0x1')]},'refreshToken':{'type':Sequelize[_0xbf4e('0x1')]}}; \ No newline at end of file +var _0xb4e6=['sequelize','STRING'];(function(_0x17f470,_0x382c0b){var _0x1c13cd=function(_0x274792){while(--_0x274792){_0x17f470['push'](_0x17f470['shift']());}};_0x1c13cd(++_0x382c0b);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xb4e6[_0x1afabf];return _0x497ff1;};'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 5611b33..9d58ae3 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 _0xecca=['set','then','destroy','error','stack','name','map','ZohoAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','sort','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','serverUrl','refreshToken','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x3165bc,_0x460004){var _0x5883c0=function(_0x27f685){while(--_0x27f685){_0x3165bc['push'](_0x3165bc['shift']());}};_0x5883c0(++_0x460004);}(_0xecca,0xe3));var _0xaecc=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xecca[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaecc('0x0'));var zipdir=require(_0xaecc('0x1'));var jsonpatch=require(_0xaecc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaecc('0x3'));var Mustache=require(_0xaecc('0x4'));var util=require(_0xaecc('0x5'));var path=require(_0xaecc('0x6'));var sox=require(_0xaecc('0x7'));var csv=require(_0xaecc('0x8'));var ejs=require(_0xaecc('0x9'));var fs=require('fs');var fs_extra=require(_0xaecc('0xa'));var _=require(_0xaecc('0xb'));var squel=require(_0xaecc('0xc'));var crypto=require(_0xaecc('0xd'));var jsforce=require(_0xaecc('0xe'));var deskjs=require(_0xaecc('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaecc('0x10'));var Papa=require(_0xaecc('0x11'));var Redis=require(_0xaecc('0x12'));var authService=require(_0xaecc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaecc('0x14'));var hardwareService=require(_0xaecc('0x15'));var logger=require('../../config/logger')(_0xaecc('0x16'));var utils=require(_0xaecc('0x17'));var config=require(_0xaecc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaecc('0x19'))['db'];var integrations=require(_0xaecc('0x1a'));function respondWithStatusCode(_0x2f8b14,_0x3ae48a){_0x3ae48a=_0x3ae48a||0xcc;return function(_0x12c882){if(_0x12c882){return _0x2f8b14[_0xaecc('0x1b')](_0x3ae48a);}return _0x2f8b14[_0xaecc('0x1c')](_0x3ae48a)[_0xaecc('0x1d')]();};}function respondWithResult(_0x9b8c46,_0x1cf76f){_0x1cf76f=_0x1cf76f||0xc8;return function(_0x40280d){if(_0x40280d){return _0x9b8c46['status'](_0x1cf76f)[_0xaecc('0x1e')](_0x40280d);}};}function respondWithFilteredResult(_0x230bc1,_0x4df9df){return function(_0x5c4a72){if(_0x5c4a72){var _0x9e2540=typeof _0x4df9df[_0xaecc('0x1f')]===_0xaecc('0x20')&&typeof _0x4df9df[_0xaecc('0x21')]===_0xaecc('0x20');var _0x426d6c=_0x5c4a72[_0xaecc('0x22')];var _0x54bda9=_0x9e2540?0x0:_0x4df9df['offset'];var _0x3037d7=_0x9e2540?_0x5c4a72['count']:_0x4df9df['offset']+_0x4df9df[_0xaecc('0x21')];var _0x2e6a31;if(_0x3037d7>=_0x426d6c){_0x3037d7=_0x426d6c;_0x2e6a31=0xc8;}else{_0x2e6a31=0xce;}_0x230bc1['status'](_0x2e6a31);return _0x230bc1[_0xaecc('0x23')]('Content-Range',_0x54bda9+'-'+_0x3037d7+'/'+_0x426d6c)[_0xaecc('0x1e')](_0x5c4a72);}return null;};}function patchUpdates(_0x426544){return function(_0x1ac94b){try{jsonpatch['apply'](_0x1ac94b,_0x426544,!![]);}catch(_0x5acff9){return BPromise['reject'](_0x5acff9);}return _0x1ac94b['save']();};}function saveUpdates(_0x2fe31a,_0x31ba9a){return function(_0x514ca8){if(_0x514ca8){return _0x514ca8['update'](_0x2fe31a)[_0xaecc('0x24')](function(_0x71a6f6){return _0x71a6f6;});}return null;};}function removeEntity(_0x4a0831,_0x52b534){return function(_0x24d3f0){if(_0x24d3f0){return _0x24d3f0[_0xaecc('0x25')]()[_0xaecc('0x24')](function(){_0x4a0831[_0xaecc('0x1c')](0xcc)[_0xaecc('0x1d')]();});}};}function handleEntityNotFound(_0x1a7533,_0x56c2d5){return function(_0x197e8f){if(!_0x197e8f){_0x1a7533[_0xaecc('0x1b')](0x194);}return _0x197e8f;};}function handleError(_0xa5e2fd,_0x173783){_0x173783=_0x173783||0x1f4;return function(_0x548bab){logger[_0xaecc('0x26')](_0x548bab[_0xaecc('0x27')]);if(_0x548bab[_0xaecc('0x28')]){delete _0x548bab[_0xaecc('0x28')];}_0xa5e2fd[_0xaecc('0x1c')](_0x173783)['send'](_0x548bab);};}exports['index']=function(_0x4402fd,_0x4dc278){var _0x4404a5={},_0xe3adbe={},_0x2bce0a={'count':0x0,'rows':[]};var _0xb2e90=_[_0xaecc('0x29')](db[_0xaecc('0x2a')]['rawAttributes'],function(_0x3b850a){return{'name':_0x3b850a[_0xaecc('0x2b')],'type':_0x3b850a[_0xaecc('0x2c')][_0xaecc('0x2d')]};});_0xe3adbe['model']=_[_0xaecc('0x29')](_0xb2e90,_0xaecc('0x28'));_0xe3adbe[_0xaecc('0x2e')]=_['keys'](_0x4402fd['query']);_0xe3adbe[_0xaecc('0x2f')]=_[_0xaecc('0x30')](_0xe3adbe[_0xaecc('0x31')],_0xe3adbe['query']);_0x4404a5[_0xaecc('0x32')]=_[_0xaecc('0x30')](_0xe3adbe[_0xaecc('0x31')],qs['fields'](_0x4402fd['query'][_0xaecc('0x33')]));_0x4404a5[_0xaecc('0x32')]=_0x4404a5[_0xaecc('0x32')]['length']?_0x4404a5['attributes']:_0xe3adbe['model'];if(!_0x4402fd[_0xaecc('0x2e')][_0xaecc('0x34')]('nolimit')){_0x4404a5[_0xaecc('0x21')]=qs[_0xaecc('0x21')](_0x4402fd[_0xaecc('0x2e')]['limit']);_0x4404a5[_0xaecc('0x1f')]=qs[_0xaecc('0x1f')](_0x4402fd[_0xaecc('0x2e')][_0xaecc('0x1f')]);}_0x4404a5[_0xaecc('0x35')]=qs['sort'](_0x4402fd[_0xaecc('0x2e')]['sort']);_0x4404a5[_0xaecc('0x36')]=qs[_0xaecc('0x2f')](_[_0xaecc('0x37')](_0x4402fd[_0xaecc('0x2e')],_0xe3adbe['filters']),_0xb2e90);if(_0x4402fd[_0xaecc('0x2e')][_0xaecc('0x38')]){_0x4404a5[_0xaecc('0x36')]=_[_0xaecc('0x39')](_0x4404a5[_0xaecc('0x36')],{'$or':_['map'](_0xb2e90,function(_0x4473e6){if(_0x4473e6['type']!==_0xaecc('0x3a')){var _0x4b679c={};_0x4b679c[_0x4473e6[_0xaecc('0x28')]]={'$like':'%'+_0x4402fd[_0xaecc('0x2e')][_0xaecc('0x38')]+'%'};return _0x4b679c;}})});}_0x4404a5=_[_0xaecc('0x39')]({},_0x4404a5,_0x4402fd['options']);var _0x295ae6={'where':_0x4404a5[_0xaecc('0x36')]};return db[_0xaecc('0x2a')]['count'](_0x295ae6)[_0xaecc('0x24')](function(_0x28c8a3){_0x2bce0a['count']=_0x28c8a3;if(_0x4402fd[_0xaecc('0x2e')][_0xaecc('0x3b')]){_0x4404a5[_0xaecc('0x3c')]=[{'all':!![]}];}return db[_0xaecc('0x2a')][_0xaecc('0x3d')](_0x4404a5);})[_0xaecc('0x24')](function(_0xdcf560){_0x2bce0a[_0xaecc('0x3e')]=_0xdcf560;return _0x2bce0a;})[_0xaecc('0x24')](respondWithFilteredResult(_0x4dc278,_0x4404a5))[_0xaecc('0x3f')](handleError(_0x4dc278,null));};exports[_0xaecc('0x40')]=function(_0x2116b1,_0x49d1f4){var _0x1d4c51={'raw':![],'where':{'id':_0x2116b1[_0xaecc('0x41')]['id']}},_0x3bcad2={};_0x3bcad2[_0xaecc('0x31')]=_[_0xaecc('0x42')](db[_0xaecc('0x2a')][_0xaecc('0x43')]);_0x3bcad2['query']=_[_0xaecc('0x42')](_0x2116b1[_0xaecc('0x2e')]);_0x3bcad2[_0xaecc('0x2f')]=_[_0xaecc('0x30')](_0x3bcad2[_0xaecc('0x31')],_0x3bcad2['query']);_0x1d4c51['attributes']=_[_0xaecc('0x30')](_0x3bcad2[_0xaecc('0x31')],qs[_0xaecc('0x33')](_0x2116b1['query']['fields']));_0x1d4c51[_0xaecc('0x32')]=_0x1d4c51[_0xaecc('0x32')][_0xaecc('0x44')]?_0x1d4c51[_0xaecc('0x32')]:_0x3bcad2['model'];if(_0x2116b1[_0xaecc('0x2e')]['includeAll']){_0x1d4c51['include']=[{'all':!![]}];}_0x1d4c51=_[_0xaecc('0x39')]({},_0x1d4c51,_0x2116b1[_0xaecc('0x45')]);return db['ZohoAccount'][_0xaecc('0x46')](_0x1d4c51)[_0xaecc('0x24')](handleEntityNotFound(_0x49d1f4,null))[_0xaecc('0x24')](respondWithResult(_0x49d1f4,null))[_0xaecc('0x3f')](handleError(_0x49d1f4,null));};exports[_0xaecc('0x47')]=function(_0x558266,_0x4dcd77){return db['ZohoAccount']['create'](_0x558266['body'],{})['then'](respondWithResult(_0x4dcd77,0xc9))[_0xaecc('0x3f')](handleError(_0x4dcd77,null));};exports['update']=function(_0x419b76,_0x305969){if(_0x419b76[_0xaecc('0x48')]['id']){delete _0x419b76[_0xaecc('0x48')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x419b76[_0xaecc('0x41')]['id']}})['then'](handleEntityNotFound(_0x305969,null))['then'](saveUpdates(_0x419b76[_0xaecc('0x48')],null))['then'](respondWithResult(_0x305969,null))['catch'](handleError(_0x305969,null));};exports[_0xaecc('0x25')]=function(_0x48387a,_0xfecaa6){return db[_0xaecc('0x2a')][_0xaecc('0x46')]({'where':{'id':_0x48387a[_0xaecc('0x41')]['id']}})[_0xaecc('0x24')](handleEntityNotFound(_0xfecaa6,null))[_0xaecc('0x24')](removeEntity(_0xfecaa6,null))['catch'](handleError(_0xfecaa6,null));};exports[_0xaecc('0x49')]=function(_0x24bc56,_0x46c9fc,_0x2c2389){var _0x144fd8={};var _0x4dec1d={};var _0x4dcbe6;var _0x1b17c4;return db[_0xaecc('0x2a')][_0xaecc('0x4a')]({'where':{'id':_0x24bc56[_0xaecc('0x41')]['id']}})[_0xaecc('0x24')](handleEntityNotFound(_0x46c9fc,null))[_0xaecc('0x24')](function(_0x266081){if(_0x266081){_0x4dcbe6=_0x266081;_0x4dec1d['model']=_['keys'](db[_0xaecc('0x4b')][_0xaecc('0x43')]);_0x4dec1d[_0xaecc('0x2e')]=_[_0xaecc('0x42')](_0x24bc56[_0xaecc('0x2e')]);_0x4dec1d[_0xaecc('0x2f')]=_[_0xaecc('0x30')](_0x4dec1d[_0xaecc('0x31')],_0x4dec1d['query']);_0x144fd8[_0xaecc('0x32')]=_[_0xaecc('0x30')](_0x4dec1d['model'],qs[_0xaecc('0x33')](_0x24bc56[_0xaecc('0x2e')][_0xaecc('0x33')]));_0x144fd8[_0xaecc('0x32')]=_0x144fd8['attributes']['length']?_0x144fd8['attributes']:_0x4dec1d['model'];_0x144fd8['order']=qs[_0xaecc('0x4c')](_0x24bc56[_0xaecc('0x2e')][_0xaecc('0x4c')]);_0x144fd8[_0xaecc('0x36')]=qs[_0xaecc('0x2f')](_[_0xaecc('0x37')](_0x24bc56[_0xaecc('0x2e')],_0x4dec1d['filters']));if(_0x24bc56[_0xaecc('0x2e')][_0xaecc('0x38')]){_0x144fd8[_0xaecc('0x36')]=_[_0xaecc('0x39')](_0x144fd8[_0xaecc('0x36')],{'$or':_['map'](_0x144fd8[_0xaecc('0x32')],function(_0x5cffda){var _0x27006b={};_0x27006b[_0x5cffda]={'$like':'%'+_0x24bc56[_0xaecc('0x2e')][_0xaecc('0x38')]+'%'};return _0x27006b;})});}_0x144fd8=_[_0xaecc('0x39')]({},_0x144fd8,_0x24bc56[_0xaecc('0x45')]);return _0x4dcbe6[_0xaecc('0x49')](_0x144fd8);}})[_0xaecc('0x24')](function(_0x21d2ac){if(_0x21d2ac){_0x1b17c4=_0x21d2ac[_0xaecc('0x44')];if(!_0x24bc56[_0xaecc('0x2e')][_0xaecc('0x34')]('nolimit')){_0x144fd8[_0xaecc('0x21')]=qs[_0xaecc('0x21')](_0x24bc56[_0xaecc('0x2e')][_0xaecc('0x21')]);_0x144fd8[_0xaecc('0x1f')]=qs[_0xaecc('0x1f')](_0x24bc56[_0xaecc('0x2e')][_0xaecc('0x1f')]);}return _0x4dcbe6[_0xaecc('0x49')](_0x144fd8);}})['then'](function(_0x3d49fa){if(_0x3d49fa){return _0x3d49fa?{'count':_0x1b17c4,'rows':_0x3d49fa}:null;}})[_0xaecc('0x24')](respondWithResult(_0x46c9fc,null))[_0xaecc('0x3f')](handleError(_0x46c9fc,null));};exports[_0xaecc('0x4d')]=function(_0x2f50f6,_0x2628ec,_0x1b0ae9){if(_0x2f50f6[_0xaecc('0x48')]['id']){delete _0x2f50f6[_0xaecc('0x48')]['id'];}return db[_0xaecc('0x2a')][_0xaecc('0x4a')]({'where':{'id':_0x2f50f6[_0xaecc('0x41')]['id']}})['then'](handleEntityNotFound(_0x2628ec,null))['then'](function(_0x29ffb1){if(_0x29ffb1){_0x2f50f6[_0xaecc('0x48')][_0xaecc('0x4e')]=_0x29ffb1['id'];_0x2f50f6[_0xaecc('0x48')][_0xaecc('0x4f')]=integrations['getSubjects'](_0x2f50f6[_0xaecc('0x48')][_0xaecc('0x50')],_0x2f50f6[_0xaecc('0x48')][_0xaecc('0x2c')]);_0x2f50f6[_0xaecc('0x48')]['Descriptions']=integrations[_0xaecc('0x51')](_0x2f50f6[_0xaecc('0x48')][_0xaecc('0x50')],_0x2f50f6[_0xaecc('0x48')][_0xaecc('0x2c')]);return db['ZohoConfiguration'][_0xaecc('0x47')](_0x2f50f6[_0xaecc('0x48')],{'include':[{'model':db[_0xaecc('0x52')],'as':_0xaecc('0x4f')},{'model':db['ZohoField'],'as':_0xaecc('0x53')}]});}return null;})[_0xaecc('0x24')](respondWithResult(_0x2628ec,null))[_0xaecc('0x3f')](handleError(_0x2628ec,null));};function getAccessToken(_0x151b96){return new Promise(function(_0xd3e252,_0x2066a1){var _0x1f287f;switch(_0x151b96[_0xaecc('0x54')]){case'US':_0x1f287f=_0xaecc('0x55');break;case'AU':_0x1f287f=_0xaecc('0x56');break;case'EU':_0x1f287f=_0xaecc('0x57');break;case'IN':_0x1f287f=_0xaecc('0x58');break;case'CN':_0x1f287f='https://accounts.zoho.com.cn';break;default:_0x1f287f=_0xaecc('0x57');break;}var _0xbe35e2={'method':_0xaecc('0x59'),'uri':_0x1f287f+_0xaecc('0x5a'),'qs':{'refresh_token':_0x151b96['refreshToken'],'client_id':_0x151b96['clientId'],'client_secret':_0x151b96[_0xaecc('0x5b')],'grant_type':_0xaecc('0x5c')},'json':!![]};return rp(_0xbe35e2)[_0xaecc('0x24')](function(_0x4dd33e){if(_0x4dd33e[_0xaecc('0x5d')]){_0xd3e252(_0x4dd33e['access_token']);}else{_0x2066a1(_0xaecc('0x5e'));}})[_0xaecc('0x3f')](function(_0x5defe6){_0x2066a1(_0x5defe6);});});}exports['getFields']=function(_0x6cb9e8,_0x2b1383,_0x8849c8){var _0x3b4f9a,_0x151758,_0x468257,_0x4d058f,_0x187ed5;return db['ZohoAccount'][_0xaecc('0x4a')]({'where':{'id':_0x6cb9e8['params']['id']},'attributes':['id',_0xaecc('0x5f'),_0xaecc('0x54'),_0xaecc('0x60'),_0xaecc('0x5b'),_0xaecc('0x61'),'code',_0xaecc('0x62')]})[_0xaecc('0x24')](handleEntityNotFound(_0x2b1383,null))['then'](function(_0x25dcb6){_0x187ed5=_0x25dcb6;_0x3b4f9a=_0x187ed5[_0xaecc('0x5f')];_0x151758=_0x3b4f9a===_0xaecc('0x63')?'eu':_0xaecc('0x64');_0x468257=_0x187ed5[_0xaecc('0x61')];var _0x2a95c3=_0x468257[_0xaecc('0x65')](-0x1);if(_0x2a95c3==='/'||_0x2a95c3==='\x5c'||_0x2a95c3===':'){_0x468257=_0x468257['substring'](0x0,_0x468257[_0xaecc('0x66')](_0x2a95c3));}if(!_0x187ed5['refreshToken']){throw new Error(_0xaecc('0x67'));}return getAccessToken(_0x187ed5);})[_0xaecc('0x24')](function(_0x384f6e){if(_0x384f6e){return rp({'method':_0xaecc('0x68'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x151758),'qs':{'module':_0xaecc('0x69')},'headers':{'Authorization':_0xaecc('0x6a')+_0x384f6e},'json':!![]});}})[_0xaecc('0x24')](function(_0x36b6fb){if(_0x36b6fb){if(_0x36b6fb['response']&&_0x36b6fb[_0xaecc('0x6b')][_0xaecc('0x26')]){throw new Error(_0x36b6fb[_0xaecc('0x6b')][_0xaecc('0x26')][_0xaecc('0x6c')]);}var _0x10c6e5=[];var _0x1312f0=[];var _0x3f6184=[_0xaecc('0x6d'),_0xaecc('0x6e'),_0xaecc('0x6f'),_0xaecc('0x70'),_0xaecc('0x71'),_0xaecc('0x72'),'Call_Start_Time',_0xaecc('0x73')];_0x1312f0=_[_0xaecc('0x74')](_0x36b6fb['fields'],function(_0x3a801b){return _0x3f6184['includes'](_0x3a801b[_0xaecc('0x75')]);});for(var _0x2efed5=0x0;_0x2efed5<_0x1312f0[_0xaecc('0x44')];_0x2efed5++){if(_0x1312f0[_0x2efed5][_0xaecc('0x76')]===![]){_0x10c6e5[_0xaecc('0x77')]({'id':_0x1312f0[_0x2efed5]['id'],'name':_0x1312f0[_0x2efed5]['display_label'],'custom':_0x1312f0[_0x2efed5][_0xaecc('0x78')],'options':_0x1312f0[_0x2efed5][_0xaecc('0x79')]===_0xaecc('0x7a')&&_0x1312f0[_0x2efed5][_0xaecc('0x7b')][_0xaecc('0x44')]>-0x1?_[_0xaecc('0x29')](_0x1312f0[_0x2efed5]['pick_list_values'],function(_0x18f877){return{'name':_0x18f877,'value':_0x18f877};}):[]});}}return{'count':_0x10c6e5[_0xaecc('0x44')],'rows':_0x10c6e5};}else{return{'count':0x0,'rows':[]};}})[_0xaecc('0x24')](respondWithResult(_0x2b1383,null))[_0xaecc('0x3f')](function(_0xe5600e){var _0x16716f=_0x6cb9e8[_0xaecc('0x2e')][_0xaecc('0x7c')]?0x1f4:_0xe5600e[_0xaecc('0x7d')]||0x1f4;logger[_0xaecc('0x26')](_0xaecc('0x7e'),_0xaecc('0x7f'),_0x16716f,JSON[_0xaecc('0x80')](_0xe5600e));delete _0xe5600e[_0xaecc('0x28')];if(_0x16716f===0x191){_0x16716f=0x190;}_0x2b1383['status'](_0x16716f)[_0xaecc('0x81')](_0x6cb9e8[_0xaecc('0x2e')]['test']?{'message':_0xaecc('0x82'),'statusCode':_0xe5600e[_0xaecc('0x7d')]}:_0xe5600e);});}; \ No newline at end of file +var _0x62d3=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','ZohoAccount','includeAll','rows','show','include','find','catch','create','body','params','getConfigurations','findOne','ZohoConfiguration','order','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','access_token','getFields','host','clientSecret','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x4dc332,_0x2c5462){var _0x766cf5=function(_0x2f4bb0){while(--_0x2f4bb0){_0x4dc332['push'](_0x4dc332['shift']());}};_0x766cf5(++_0x2c5462);}(_0x62d3,0x15d));var _0x362d=function(_0x509726,_0x36c837){_0x509726=_0x509726-0x0;var _0x277b7c=_0x62d3[_0x509726];return _0x277b7c;};'use strict';var emlformat=require(_0x362d('0x0'));var rimraf=require(_0x362d('0x1'));var zipdir=require(_0x362d('0x2'));var jsonpatch=require(_0x362d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x362d('0x4'));var util=require(_0x362d('0x5'));var path=require(_0x362d('0x6'));var sox=require(_0x362d('0x7'));var csv=require(_0x362d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x362d('0x9'));var squel=require(_0x362d('0xa'));var crypto=require(_0x362d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x362d('0xc'));var toCsv=require(_0x362d('0x8'));var querystring=require(_0x362d('0xd'));var Papa=require('papaparse');var Redis=require(_0x362d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x362d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x362d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x362d('0x11'));var config=require(_0x362d('0x12'));var licenseUtil=require(_0x362d('0x13'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7f76d5,_0x4651db){_0x4651db=_0x4651db||0xcc;return function(_0x35cd73){if(_0x35cd73){return _0x7f76d5[_0x362d('0x14')](_0x4651db);}return _0x7f76d5['status'](_0x4651db)['end']();};}function respondWithResult(_0x7e79c3,_0x25d0c9){_0x25d0c9=_0x25d0c9||0xc8;return function(_0x4c56b3){if(_0x4c56b3){return _0x7e79c3[_0x362d('0x15')](_0x25d0c9)[_0x362d('0x16')](_0x4c56b3);}};}function respondWithFilteredResult(_0x37c445,_0x248020){return function(_0x45ff50){if(_0x45ff50){var _0x1818f1=typeof _0x248020[_0x362d('0x17')]===_0x362d('0x18')&&typeof _0x248020[_0x362d('0x19')]==='undefined';var _0x32359d=_0x45ff50[_0x362d('0x1a')];var _0x3bbfd4=_0x1818f1?0x0:_0x248020[_0x362d('0x17')];var _0x131e8e=_0x1818f1?_0x45ff50['count']:_0x248020[_0x362d('0x17')]+_0x248020[_0x362d('0x19')];var _0x46bc11;if(_0x131e8e>=_0x32359d){_0x131e8e=_0x32359d;_0x46bc11=0xc8;}else{_0x46bc11=0xce;}_0x37c445['status'](_0x46bc11);return _0x37c445[_0x362d('0x1b')](_0x362d('0x1c'),_0x3bbfd4+'-'+_0x131e8e+'/'+_0x32359d)[_0x362d('0x16')](_0x45ff50);}return null;};}function patchUpdates(_0x502594){return function(_0x3f0c84){try{jsonpatch[_0x362d('0x1d')](_0x3f0c84,_0x502594,!![]);}catch(_0x3172b9){return BPromise[_0x362d('0x1e')](_0x3172b9);}return _0x3f0c84[_0x362d('0x1f')]();};}function saveUpdates(_0x1e1952,_0x1c1865){return function(_0x4df71c){if(_0x4df71c){return _0x4df71c['update'](_0x1e1952)[_0x362d('0x20')](function(_0x3d7014){return _0x3d7014;});}return null;};}function removeEntity(_0x130d90,_0x4851e9){return function(_0x38758c){if(_0x38758c){return _0x38758c[_0x362d('0x21')]()['then'](function(){_0x130d90[_0x362d('0x15')](0xcc)[_0x362d('0x22')]();});}};}function handleEntityNotFound(_0x6f9fd9,_0x142a27){return function(_0x578adb){if(!_0x578adb){_0x6f9fd9[_0x362d('0x14')](0x194);}return _0x578adb;};}function handleError(_0x4092f0,_0x468c39){_0x468c39=_0x468c39||0x1f4;return function(_0x4ed2f6){logger['error'](_0x4ed2f6[_0x362d('0x23')]);if(_0x4ed2f6[_0x362d('0x24')]){delete _0x4ed2f6[_0x362d('0x24')];}_0x4092f0[_0x362d('0x15')](_0x468c39)[_0x362d('0x25')](_0x4ed2f6);};}exports[_0x362d('0x26')]=function(_0x5e1a8d,_0x151bbe){var _0x3173fe={},_0x20ee8b={},_0x4986d4={'count':0x0,'rows':[]};var _0x5d515c=_[_0x362d('0x27')](db['ZohoAccount'][_0x362d('0x28')],function(_0xd82643){return{'name':_0xd82643[_0x362d('0x29')],'type':_0xd82643[_0x362d('0x2a')]['key']};});_0x20ee8b[_0x362d('0x2b')]=_[_0x362d('0x27')](_0x5d515c,'name');_0x20ee8b[_0x362d('0x2c')]=_[_0x362d('0x2d')](_0x5e1a8d[_0x362d('0x2c')]);_0x20ee8b[_0x362d('0x2e')]=_['intersection'](_0x20ee8b['model'],_0x20ee8b['query']);_0x3173fe[_0x362d('0x2f')]=_[_0x362d('0x30')](_0x20ee8b[_0x362d('0x2b')],qs['fields'](_0x5e1a8d[_0x362d('0x2c')][_0x362d('0x31')]));_0x3173fe[_0x362d('0x2f')]=_0x3173fe[_0x362d('0x2f')][_0x362d('0x32')]?_0x3173fe[_0x362d('0x2f')]:_0x20ee8b[_0x362d('0x2b')];if(!_0x5e1a8d[_0x362d('0x2c')][_0x362d('0x33')](_0x362d('0x34'))){_0x3173fe[_0x362d('0x19')]=qs[_0x362d('0x19')](_0x5e1a8d[_0x362d('0x2c')][_0x362d('0x19')]);_0x3173fe[_0x362d('0x17')]=qs[_0x362d('0x17')](_0x5e1a8d['query'][_0x362d('0x17')]);}_0x3173fe['order']=qs[_0x362d('0x35')](_0x5e1a8d[_0x362d('0x2c')][_0x362d('0x35')]);_0x3173fe['where']=qs[_0x362d('0x2e')](_[_0x362d('0x36')](_0x5e1a8d[_0x362d('0x2c')],_0x20ee8b[_0x362d('0x2e')]),_0x5d515c);if(_0x5e1a8d[_0x362d('0x2c')][_0x362d('0x37')]){_0x3173fe[_0x362d('0x38')]=_[_0x362d('0x39')](_0x3173fe[_0x362d('0x38')],{'$or':_[_0x362d('0x27')](_0x5d515c,function(_0x2bf8b1){if(_0x2bf8b1['type']!=='VIRTUAL'){var _0x368185={};_0x368185[_0x2bf8b1[_0x362d('0x24')]]={'$like':'%'+_0x5e1a8d[_0x362d('0x2c')][_0x362d('0x37')]+'%'};return _0x368185;}})});}_0x3173fe=_['merge']({},_0x3173fe,_0x5e1a8d[_0x362d('0x3a')]);var _0x27f63d={'where':_0x3173fe[_0x362d('0x38')]};return db[_0x362d('0x3b')][_0x362d('0x1a')](_0x27f63d)[_0x362d('0x20')](function(_0x41fca3){_0x4986d4[_0x362d('0x1a')]=_0x41fca3;if(_0x5e1a8d[_0x362d('0x2c')][_0x362d('0x3c')]){_0x3173fe['include']=[{'all':!![]}];}return db[_0x362d('0x3b')]['findAll'](_0x3173fe);})[_0x362d('0x20')](function(_0x316464){_0x4986d4[_0x362d('0x3d')]=_0x316464;return _0x4986d4;})['then'](respondWithFilteredResult(_0x151bbe,_0x3173fe))['catch'](handleError(_0x151bbe,null));};exports[_0x362d('0x3e')]=function(_0x221ddb,_0x895686){var _0xc79ff7={'raw':![],'where':{'id':_0x221ddb['params']['id']}},_0x288de2={};_0x288de2['model']=_[_0x362d('0x2d')](db[_0x362d('0x3b')]['rawAttributes']);_0x288de2[_0x362d('0x2c')]=_['keys'](_0x221ddb[_0x362d('0x2c')]);_0x288de2['filters']=_[_0x362d('0x30')](_0x288de2[_0x362d('0x2b')],_0x288de2[_0x362d('0x2c')]);_0xc79ff7[_0x362d('0x2f')]=_['intersection'](_0x288de2[_0x362d('0x2b')],qs[_0x362d('0x31')](_0x221ddb['query'][_0x362d('0x31')]));_0xc79ff7[_0x362d('0x2f')]=_0xc79ff7['attributes'][_0x362d('0x32')]?_0xc79ff7[_0x362d('0x2f')]:_0x288de2[_0x362d('0x2b')];if(_0x221ddb[_0x362d('0x2c')][_0x362d('0x3c')]){_0xc79ff7[_0x362d('0x3f')]=[{'all':!![]}];}_0xc79ff7=_['merge']({},_0xc79ff7,_0x221ddb['options']);return db[_0x362d('0x3b')][_0x362d('0x40')](_0xc79ff7)['then'](handleEntityNotFound(_0x895686,null))[_0x362d('0x20')](respondWithResult(_0x895686,null))[_0x362d('0x41')](handleError(_0x895686,null));};exports[_0x362d('0x42')]=function(_0x121bdc,_0x2e30fc){return db[_0x362d('0x3b')][_0x362d('0x42')](_0x121bdc[_0x362d('0x43')],{})[_0x362d('0x20')](respondWithResult(_0x2e30fc,0xc9))['catch'](handleError(_0x2e30fc,null));};exports['update']=function(_0x69ee76,_0x5d267e){if(_0x69ee76['body']['id']){delete _0x69ee76[_0x362d('0x43')]['id'];}return db[_0x362d('0x3b')][_0x362d('0x40')]({'where':{'id':_0x69ee76[_0x362d('0x44')]['id']}})[_0x362d('0x20')](handleEntityNotFound(_0x5d267e,null))[_0x362d('0x20')](saveUpdates(_0x69ee76['body'],null))['then'](respondWithResult(_0x5d267e,null))[_0x362d('0x41')](handleError(_0x5d267e,null));};exports[_0x362d('0x21')]=function(_0x6ec0d2,_0x231efb){return db[_0x362d('0x3b')][_0x362d('0x40')]({'where':{'id':_0x6ec0d2[_0x362d('0x44')]['id']}})[_0x362d('0x20')](handleEntityNotFound(_0x231efb,null))[_0x362d('0x20')](removeEntity(_0x231efb,null))[_0x362d('0x41')](handleError(_0x231efb,null));};exports[_0x362d('0x45')]=function(_0x35aef4,_0x43d1d7,_0x150b8a){var _0x576b59={};var _0x3b1da6={};var _0x1c9bfb;var _0x44ac99;return db['ZohoAccount'][_0x362d('0x46')]({'where':{'id':_0x35aef4[_0x362d('0x44')]['id']}})['then'](handleEntityNotFound(_0x43d1d7,null))['then'](function(_0x562729){if(_0x562729){_0x1c9bfb=_0x562729;_0x3b1da6['model']=_[_0x362d('0x2d')](db[_0x362d('0x47')]['rawAttributes']);_0x3b1da6[_0x362d('0x2c')]=_[_0x362d('0x2d')](_0x35aef4['query']);_0x3b1da6[_0x362d('0x2e')]=_[_0x362d('0x30')](_0x3b1da6[_0x362d('0x2b')],_0x3b1da6[_0x362d('0x2c')]);_0x576b59[_0x362d('0x2f')]=_[_0x362d('0x30')](_0x3b1da6['model'],qs['fields'](_0x35aef4[_0x362d('0x2c')][_0x362d('0x31')]));_0x576b59[_0x362d('0x2f')]=_0x576b59[_0x362d('0x2f')][_0x362d('0x32')]?_0x576b59[_0x362d('0x2f')]:_0x3b1da6[_0x362d('0x2b')];_0x576b59[_0x362d('0x48')]=qs[_0x362d('0x35')](_0x35aef4[_0x362d('0x2c')][_0x362d('0x35')]);_0x576b59[_0x362d('0x38')]=qs[_0x362d('0x2e')](_['pick'](_0x35aef4[_0x362d('0x2c')],_0x3b1da6[_0x362d('0x2e')]));if(_0x35aef4['query'][_0x362d('0x37')]){_0x576b59[_0x362d('0x38')]=_[_0x362d('0x39')](_0x576b59[_0x362d('0x38')],{'$or':_[_0x362d('0x27')](_0x576b59[_0x362d('0x2f')],function(_0x1c4660){var _0x46f0b1={};_0x46f0b1[_0x1c4660]={'$like':'%'+_0x35aef4[_0x362d('0x2c')][_0x362d('0x37')]+'%'};return _0x46f0b1;})});}_0x576b59=_[_0x362d('0x39')]({},_0x576b59,_0x35aef4[_0x362d('0x3a')]);return _0x1c9bfb[_0x362d('0x45')](_0x576b59);}})[_0x362d('0x20')](function(_0x131707){if(_0x131707){_0x44ac99=_0x131707[_0x362d('0x32')];if(!_0x35aef4[_0x362d('0x2c')][_0x362d('0x33')](_0x362d('0x34'))){_0x576b59[_0x362d('0x19')]=qs[_0x362d('0x19')](_0x35aef4[_0x362d('0x2c')][_0x362d('0x19')]);_0x576b59['offset']=qs[_0x362d('0x17')](_0x35aef4[_0x362d('0x2c')][_0x362d('0x17')]);}return _0x1c9bfb[_0x362d('0x45')](_0x576b59);}})[_0x362d('0x20')](function(_0x51b103){if(_0x51b103){return _0x51b103?{'count':_0x44ac99,'rows':_0x51b103}:null;}})['then'](respondWithResult(_0x43d1d7,null))['catch'](handleError(_0x43d1d7,null));};exports['addConfiguration']=function(_0x194e26,_0x206e63,_0xc6f35f){if(_0x194e26['body']['id']){delete _0x194e26[_0x362d('0x43')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x194e26['params']['id']}})['then'](handleEntityNotFound(_0x206e63,null))[_0x362d('0x20')](function(_0x585628){if(_0x585628){_0x194e26['body'][_0x362d('0x49')]=_0x585628['id'];_0x194e26['body'][_0x362d('0x4a')]=integrations[_0x362d('0x4b')](_0x194e26['body'][_0x362d('0x4c')],_0x194e26['body'][_0x362d('0x2a')]);_0x194e26[_0x362d('0x43')][_0x362d('0x4d')]=integrations[_0x362d('0x4e')](_0x194e26[_0x362d('0x43')][_0x362d('0x4c')],_0x194e26[_0x362d('0x43')][_0x362d('0x2a')]);return db[_0x362d('0x47')]['create'](_0x194e26[_0x362d('0x43')],{'include':[{'model':db[_0x362d('0x4f')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x362d('0x4d')}]});}return null;})[_0x362d('0x20')](respondWithResult(_0x206e63,null))[_0x362d('0x41')](handleError(_0x206e63,null));};function getAccessToken(_0x2da0d3){return new Promise(function(_0x210f52,_0x25e1eb){var _0x594a12;switch(_0x2da0d3[_0x362d('0x50')]){case'US':_0x594a12=_0x362d('0x51');break;case'AU':_0x594a12=_0x362d('0x52');break;case'EU':_0x594a12=_0x362d('0x53');break;case'IN':_0x594a12=_0x362d('0x54');break;case'CN':_0x594a12='https://accounts.zoho.com.cn';break;default:_0x594a12=_0x362d('0x53');break;}var _0x472ab5={'method':_0x362d('0x55'),'uri':_0x594a12+_0x362d('0x56'),'qs':{'refresh_token':_0x2da0d3['refreshToken'],'client_id':_0x2da0d3[_0x362d('0x57')],'client_secret':_0x2da0d3['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x472ab5)[_0x362d('0x20')](function(_0x1e8d99){if(_0x1e8d99['access_token']){_0x210f52(_0x1e8d99[_0x362d('0x58')]);}else{_0x25e1eb('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x362d('0x41')](function(_0x2add9e){_0x25e1eb(_0x2add9e);});});}exports[_0x362d('0x59')]=function(_0xb34d01,_0x41a29f,_0x49dcca){var _0x3f862c,_0x4df789,_0x202010,_0x5178e3,_0x34366a;return db[_0x362d('0x3b')][_0x362d('0x46')]({'where':{'id':_0xb34d01[_0x362d('0x44')]['id']},'attributes':['id',_0x362d('0x5a'),'zone','clientId',_0x362d('0x5b'),_0x362d('0x5c'),_0x362d('0x5d'),'refreshToken']})['then'](handleEntityNotFound(_0x41a29f,null))[_0x362d('0x20')](function(_0x2ab150){_0x34366a=_0x2ab150;_0x3f862c=_0x34366a[_0x362d('0x5a')];_0x4df789=_0x3f862c===_0x362d('0x5e')?'eu':_0x362d('0x5f');_0x202010=_0x34366a[_0x362d('0x5c')];var _0x25b889=_0x202010[_0x362d('0x60')](-0x1);if(_0x25b889==='/'||_0x25b889==='\x5c'||_0x25b889===':'){_0x202010=_0x202010[_0x362d('0x61')](0x0,_0x202010[_0x362d('0x62')](_0x25b889));}if(!_0x34366a['refreshToken']){throw new Error(_0x362d('0x63'));}return getAccessToken(_0x34366a);})['then'](function(_0x23c16f){if(_0x23c16f){return rp({'method':_0x362d('0x64'),'uri':util[_0x362d('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4df789),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23c16f},'json':!![]});}})['then'](function(_0x498828){if(_0x498828){if(_0x498828[_0x362d('0x66')]&&_0x498828[_0x362d('0x66')][_0x362d('0x67')]){throw new Error(_0x498828['response'][_0x362d('0x67')][_0x362d('0x68')]);}var _0x5c4f74=[];var _0x415480=[];var _0x2573a7=[_0x362d('0x69'),_0x362d('0x6a'),_0x362d('0x6b'),_0x362d('0x6c'),_0x362d('0x6d'),_0x362d('0x6e'),'Call_Start_Time',_0x362d('0x6f')];_0x415480=_['remove'](_0x498828[_0x362d('0x31')],function(_0x49f5fc){return _0x2573a7[_0x362d('0x70')](_0x49f5fc[_0x362d('0x71')]);});for(var _0x4a21c7=0x0;_0x4a21c7<_0x415480[_0x362d('0x32')];_0x4a21c7++){if(_0x415480[_0x4a21c7][_0x362d('0x72')]===![]){_0x5c4f74['push']({'id':_0x415480[_0x4a21c7]['id'],'name':_0x415480[_0x4a21c7][_0x362d('0x73')],'custom':_0x415480[_0x4a21c7][_0x362d('0x74')],'options':_0x415480[_0x4a21c7][_0x362d('0x75')]===_0x362d('0x76')&&_0x415480[_0x4a21c7][_0x362d('0x77')]['length']>-0x1?_[_0x362d('0x27')](_0x415480[_0x4a21c7][_0x362d('0x77')],function(_0x2dbd1f){return{'name':_0x2dbd1f,'value':_0x2dbd1f};}):[]});}}return{'count':_0x5c4f74[_0x362d('0x32')],'rows':_0x5c4f74};}else{return{'count':0x0,'rows':[]};}})[_0x362d('0x20')](respondWithResult(_0x41a29f,null))[_0x362d('0x41')](function(_0x1704aa){var _0x47e701=_0xb34d01['query'][_0x362d('0x78')]?0x1f4:_0x1704aa[_0x362d('0x79')]||0x1f4;logger[_0x362d('0x67')](_0x362d('0x7a'),_0x362d('0x59'),_0x47e701,JSON[_0x362d('0x7b')](_0x1704aa));delete _0x1704aa['name'];if(_0x47e701===0x191){_0x47e701=0x190;}_0x41a29f[_0x362d('0x15')](_0x47e701)[_0x362d('0x25')](_0xb34d01[_0x362d('0x2c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1704aa[_0x362d('0x79')]}:_0x1704aa);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1b6a26b..21bffb6 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 _0x1a6d=['then','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','https://accounts.zoho.com','parse','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0x1a6d,0x94));var _0xd1a6=function(_0x3359d4,_0x1bcb79){_0x3359d4=_0x3359d4-0x0;var _0xd9686c=_0x1a6d[_0x3359d4];return _0xd9686c;};'use strict';var _=require(_0xd1a6('0x0'));var util=require(_0xd1a6('0x1'));var logger=require(_0xd1a6('0x2'))(_0xd1a6('0x3'));var moment=require(_0xd1a6('0x4'));var BPromise=require(_0xd1a6('0x5'));var rp=require(_0xd1a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1a6('0x7'));var config=require(_0xd1a6('0x8'));var attributes=require(_0xd1a6('0x9'));var integrations=require(_0xd1a6('0xa'));module[_0xd1a6('0xb')]=function(_0x10d4c4,_0x424ece){return _0x10d4c4[_0xd1a6('0xc')](_0xd1a6('0xd'),attributes,{'tableName':_0xd1a6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59e5dc,_0x542ef3,_0x35d3fc){if(_0x59e5dc[_0xd1a6('0xf')](_0xd1a6('0x10'))||_0x59e5dc[_0xd1a6('0xf')]('serverUrl')||_0x59e5dc[_0xd1a6('0xf')]('clientId')||_0x59e5dc[_0xd1a6('0xf')](_0xd1a6('0x11'))||_0x59e5dc[_0xd1a6('0xf')](_0xd1a6('0x12'))||_0x59e5dc['changed'](_0xd1a6('0x13'))){var _0x3a9af7,_0x19d3ac;_0x3a9af7=_0x59e5dc[_0xd1a6('0x14')];var _0xa96467=_0x3a9af7[_0xd1a6('0x15')](-0x1);if(_0xa96467==='/'||_0xa96467==='\x5c'||_0xa96467===':'){_0x3a9af7=_0x3a9af7[_0xd1a6('0x16')](0x0,_0x3a9af7[_0xd1a6('0x17')](_0xa96467));}switch(_0x59e5dc[_0xd1a6('0x10')]){case'US':_0x19d3ac='https://accounts.zoho.com';break;case'AU':_0x19d3ac=_0xd1a6('0x18');break;case'IN':_0x19d3ac=_0xd1a6('0x19');break;case'CN':_0x19d3ac=_0xd1a6('0x1a');break;default:_0x19d3ac=_0xd1a6('0x1b');break;}var _0x401a6d={'method':'POST','uri':_0x19d3ac+_0xd1a6('0x1c'),'form':{'grant_type':_0xd1a6('0x1d'),'client_id':_0x59e5dc[_0xd1a6('0x1e')],'client_secret':_0x59e5dc[_0xd1a6('0x11')],'redirect_uri':_0x59e5dc['serverUrl'],'code':_0x59e5dc[_0xd1a6('0x12')]},'headers':{'Content-Type':_0xd1a6('0x1f')}};return rp(_0x401a6d)[_0xd1a6('0x20')](function(_0x5980d2){var _0x4ffb0e=JSON['parse'](_0x5980d2);if(_0x4ffb0e['refresh_token']){_0x59e5dc[_0xd1a6('0x21')]=_0x4ffb0e[_0xd1a6('0x22')];logger[_0xd1a6('0x23')](util['format'](_0xd1a6('0x24'),_0x59e5dc['name'],_0x59e5dc['id']));}else{logger['error'](util[_0xd1a6('0x25')](_0xd1a6('0x26'),_0x59e5dc[_0xd1a6('0x27')],_0x59e5dc['id']),util[_0xd1a6('0x28')](_0x4ffb0e,{'showHidden':![],'depth':null}));}return _0x35d3fc(null,_0x542ef3);})[_0xd1a6('0x29')](function(_0x42e71d){logger[_0xd1a6('0x2a')](util[_0xd1a6('0x25')](_0xd1a6('0x26'),_0x59e5dc['name'],_0x59e5dc['id']),util[_0xd1a6('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x35d3fc(_0x42e71d);});}else{return _0x35d3fc(null,_0x542ef3);}},'beforeUpdate':function(_0x21ab6f,_0x151471,_0x54586c){if(_0x21ab6f[_0xd1a6('0xf')](_0xd1a6('0x10'))||_0x21ab6f[_0xd1a6('0xf')]('serverUrl')||_0x21ab6f[_0xd1a6('0xf')](_0xd1a6('0x1e'))||_0x21ab6f[_0xd1a6('0xf')](_0xd1a6('0x11'))||_0x21ab6f[_0xd1a6('0xf')](_0xd1a6('0x12'))||_0x21ab6f[_0xd1a6('0xf')](_0xd1a6('0x13'))){var _0x16e81f,_0x526b1b;_0x16e81f=_0x21ab6f['serverUrl'];var _0x3f696a=_0x16e81f[_0xd1a6('0x15')](-0x1);if(_0x3f696a==='/'||_0x3f696a==='\x5c'||_0x3f696a===':'){_0x16e81f=_0x16e81f[_0xd1a6('0x16')](0x0,_0x16e81f[_0xd1a6('0x17')](_0x3f696a));}switch(_0x21ab6f[_0xd1a6('0x10')]){case'US':_0x526b1b=_0xd1a6('0x2b');break;case'AU':_0x526b1b=_0xd1a6('0x18');break;case'IN':_0x526b1b=_0xd1a6('0x19');break;case'CN':_0x526b1b=_0xd1a6('0x1a');break;default:_0x526b1b=_0xd1a6('0x1b');break;}var _0x3d5552={'method':'POST','uri':_0x526b1b+_0xd1a6('0x1c'),'form':{'grant_type':_0xd1a6('0x1d'),'client_id':_0x21ab6f[_0xd1a6('0x1e')],'client_secret':_0x21ab6f[_0xd1a6('0x11')],'redirect_uri':_0x21ab6f[_0xd1a6('0x14')],'code':_0x21ab6f[_0xd1a6('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3d5552)[_0xd1a6('0x20')](function(_0x191b81){var _0x5d519b=JSON[_0xd1a6('0x2c')](_0x191b81);if(_0x5d519b[_0xd1a6('0x22')]){_0x21ab6f['refreshToken']=_0x5d519b[_0xd1a6('0x22')];logger[_0xd1a6('0x23')](util[_0xd1a6('0x25')](_0xd1a6('0x24'),_0x21ab6f[_0xd1a6('0x27')],_0x21ab6f['id']));}else{logger[_0xd1a6('0x2a')](util[_0xd1a6('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x21ab6f[_0xd1a6('0x27')],_0x21ab6f['id']),util[_0xd1a6('0x28')](_0x5d519b,{'showHidden':![],'depth':null}));}return _0x54586c(null,_0x151471);})['catch'](function(_0x5e9ab0){logger[_0xd1a6('0x2a')](util[_0xd1a6('0x25')](_0xd1a6('0x26'),_0x21ab6f[_0xd1a6('0x27')],_0x21ab6f['id']),util[_0xd1a6('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x54586c(_0x5e9ab0);});}else{return _0x54586c(null,_0x151471);}}}});}; \ No newline at end of file +var _0x8e37=['code','slice','lodash','util','../../config/logger','api','moment','path','rimraf','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','format'];(function(_0x1cb3e1,_0x54a870){var _0x114812=function(_0x152ebf){while(--_0x152ebf){_0x1cb3e1['push'](_0x1cb3e1['shift']());}};_0x114812(++_0x54a870);}(_0x8e37,0x192));var _0x78e3=function(_0x2def6e,_0x2de89c){_0x2def6e=_0x2def6e-0x0;var _0x150205=_0x8e37[_0x2def6e];return _0x150205;};'use strict';var _=require(_0x78e3('0x0'));var util=require(_0x78e3('0x1'));var logger=require(_0x78e3('0x2'))(_0x78e3('0x3'));var moment=require(_0x78e3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78e3('0x5'));var rimraf=require(_0x78e3('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x78e3('0x7'));module[_0x78e3('0x8')]=function(_0x235b8c,_0x47106c){return _0x235b8c['define'](_0x78e3('0x9'),attributes,{'tableName':_0x78e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5ea959,_0x1b4477,_0x2d3b70){if(_0x5ea959[_0x78e3('0xb')](_0x78e3('0xc'))||_0x5ea959['changed'](_0x78e3('0xd'))||_0x5ea959[_0x78e3('0xb')]('clientId')||_0x5ea959[_0x78e3('0xb')](_0x78e3('0xe'))||_0x5ea959[_0x78e3('0xb')]('code')||_0x5ea959[_0x78e3('0xb')](_0x78e3('0xf'))){var _0x575cee,_0x39959d;_0x575cee=_0x5ea959[_0x78e3('0xd')];var _0x109ff7=_0x575cee['slice'](-0x1);if(_0x109ff7==='/'||_0x109ff7==='\x5c'||_0x109ff7===':'){_0x575cee=_0x575cee[_0x78e3('0x10')](0x0,_0x575cee[_0x78e3('0x11')](_0x109ff7));}switch(_0x5ea959[_0x78e3('0xc')]){case'US':_0x39959d=_0x78e3('0x12');break;case'AU':_0x39959d=_0x78e3('0x13');break;case'IN':_0x39959d='https://accounts.zoho.in';break;case'CN':_0x39959d=_0x78e3('0x14');break;default:_0x39959d=_0x78e3('0x15');break;}var _0x4c1b58={'method':_0x78e3('0x16'),'uri':_0x39959d+_0x78e3('0x17'),'form':{'grant_type':_0x78e3('0x18'),'client_id':_0x5ea959[_0x78e3('0x19')],'client_secret':_0x5ea959[_0x78e3('0xe')],'redirect_uri':_0x5ea959[_0x78e3('0xd')],'code':_0x5ea959['code']},'headers':{'Content-Type':_0x78e3('0x1a')}};return rp(_0x4c1b58)[_0x78e3('0x1b')](function(_0x38e628){var _0x25abca=JSON['parse'](_0x38e628);if(_0x25abca[_0x78e3('0x1c')]){_0x5ea959[_0x78e3('0x1d')]=_0x25abca[_0x78e3('0x1c')];logger[_0x78e3('0x1e')](util['format'](_0x78e3('0x1f'),_0x5ea959[_0x78e3('0x20')],_0x5ea959['id']));}else{logger[_0x78e3('0x21')](util['format'](_0x78e3('0x22'),_0x5ea959[_0x78e3('0x20')],_0x5ea959['id']),util[_0x78e3('0x23')](_0x25abca,{'showHidden':![],'depth':null}));}return _0x2d3b70(null,_0x1b4477);})[_0x78e3('0x24')](function(_0x15fbf6){logger['error'](util[_0x78e3('0x25')](_0x78e3('0x22'),_0x5ea959[_0x78e3('0x20')],_0x5ea959['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2d3b70(_0x15fbf6);});}else{return _0x2d3b70(null,_0x1b4477);}},'beforeUpdate':function(_0x275b97,_0x20fec1,_0x11214d){if(_0x275b97[_0x78e3('0xb')](_0x78e3('0xc'))||_0x275b97[_0x78e3('0xb')](_0x78e3('0xd'))||_0x275b97[_0x78e3('0xb')](_0x78e3('0x19'))||_0x275b97[_0x78e3('0xb')](_0x78e3('0xe'))||_0x275b97[_0x78e3('0xb')](_0x78e3('0x26'))||_0x275b97['changed'](_0x78e3('0xf'))){var _0x3fcce3,_0x28232a;_0x3fcce3=_0x275b97[_0x78e3('0xd')];var _0x5f060f=_0x3fcce3[_0x78e3('0x27')](-0x1);if(_0x5f060f==='/'||_0x5f060f==='\x5c'||_0x5f060f===':'){_0x3fcce3=_0x3fcce3[_0x78e3('0x10')](0x0,_0x3fcce3[_0x78e3('0x11')](_0x5f060f));}switch(_0x275b97[_0x78e3('0xc')]){case'US':_0x28232a='https://accounts.zoho.com';break;case'AU':_0x28232a='https://accounts.zoho.com.au';break;case'IN':_0x28232a='https://accounts.zoho.in';break;case'CN':_0x28232a='https://accounts.zoho.com.cn';break;default:_0x28232a=_0x78e3('0x15');break;}var _0x24cd18={'method':_0x78e3('0x16'),'uri':_0x28232a+_0x78e3('0x17'),'form':{'grant_type':_0x78e3('0x18'),'client_id':_0x275b97[_0x78e3('0x19')],'client_secret':_0x275b97[_0x78e3('0xe')],'redirect_uri':_0x275b97[_0x78e3('0xd')],'code':_0x275b97[_0x78e3('0x26')]},'headers':{'Content-Type':_0x78e3('0x1a')}};return rp(_0x24cd18)[_0x78e3('0x1b')](function(_0x13b3f7){var _0x1e6668=JSON['parse'](_0x13b3f7);if(_0x1e6668[_0x78e3('0x1c')]){_0x275b97[_0x78e3('0x1d')]=_0x1e6668['refresh_token'];logger['info'](util[_0x78e3('0x25')](_0x78e3('0x1f'),_0x275b97[_0x78e3('0x20')],_0x275b97['id']));}else{logger[_0x78e3('0x21')](util[_0x78e3('0x25')](_0x78e3('0x22'),_0x275b97['name'],_0x275b97['id']),util['inspect'](_0x1e6668,{'showHidden':![],'depth':null}));}return _0x11214d(null,_0x20fec1);})[_0x78e3('0x24')](function(_0x2b1eec){logger[_0x78e3('0x21')](util[_0x78e3('0x25')](_0x78e3('0x22'),_0x275b97[_0x78e3('0x20')],_0x275b97['id']),util[_0x78e3('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x11214d(_0x2b1eec);});}else{return _0x11214d(null,_0x20fec1);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 52f1f18..bda004a 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 _0xb7de=['http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','map','include','model','debug','stringify','ShowZohoAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4922a0,_0x4e5306){var _0x599067=function(_0x310ca4){while(--_0x310ca4){_0x4922a0['push'](_0x4922a0['shift']());}};_0x599067(++_0x4e5306);}(_0xb7de,0xc7));var _0xeb7d=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xb7de[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var moment=require(_0xeb7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb7d('0x3'));var fs=require('fs');var Redis=require(_0xeb7d('0x4'));var db=require(_0xeb7d('0x5'))['db'];var utils=require(_0xeb7d('0x6'));var logger=require(_0xeb7d('0x7'))('rpc');var config=require(_0xeb7d('0x8'));var jayson=require(_0xeb7d('0x9'));var client=jayson[_0xeb7d('0xa')][_0xeb7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc8bd99,_0x593170,_0x5e7556){return new BPromise(function(_0xb802e1,_0x13d376){return client[_0xeb7d('0xc')](_0xc8bd99,_0x5e7556)[_0xeb7d('0xd')](function(_0x4a880a){logger[_0xeb7d('0xe')](_0xeb7d('0xf'),_0x593170,_0xeb7d('0x10'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x593170,_0xeb7d('0x10'),JSON['stringify'](_0x4a880a));if(_0x4a880a[_0xeb7d('0x11')]){if(_0x4a880a[_0xeb7d('0x11')][_0xeb7d('0x12')]===0x1f4){logger[_0xeb7d('0x11')](_0xeb7d('0xf'),_0x593170,_0x4a880a[_0xeb7d('0x11')]['message']);return _0x13d376(_0x4a880a[_0xeb7d('0x11')][_0xeb7d('0x13')]);}logger[_0xeb7d('0x11')](_0xeb7d('0xf'),_0x593170,_0x4a880a[_0xeb7d('0x11')]['message']);return _0xb802e1(_0x4a880a[_0xeb7d('0x11')]['message']);}else{logger[_0xeb7d('0xe')](_0xeb7d('0xf'),_0x593170,_0xeb7d('0x10'));_0xb802e1(_0x4a880a['result']['message']);}})[_0xeb7d('0x14')](function(_0xfcbbce){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x593170,_0xfcbbce);_0x13d376(_0xfcbbce);});});}exports[_0xeb7d('0x15')]=function(_0x298c8d){var _0x598025=this;return new Promise(function(_0x1bfa8a,_0x4584c2){return db[_0xeb7d('0x16')][_0xeb7d('0x17')]({'raw':_0x298c8d[_0xeb7d('0x18')]?_0x298c8d[_0xeb7d('0x18')][_0xeb7d('0x19')]===undefined?!![]:![]:!![],'where':_0x298c8d[_0xeb7d('0x18')]?_0x298c8d[_0xeb7d('0x18')]['where']||null:null,'attributes':_0x298c8d[_0xeb7d('0x18')]?_0x298c8d['options'][_0xeb7d('0x1a')]||null:null,'limit':_0x298c8d[_0xeb7d('0x18')]?_0x298c8d[_0xeb7d('0x18')]['limit']||null:null,'include':_0x298c8d[_0xeb7d('0x18')]?_0x298c8d[_0xeb7d('0x18')]['include']?_[_0xeb7d('0x1b')](_0x298c8d[_0xeb7d('0x18')][_0xeb7d('0x1c')],function(_0x3666db){return{'model':db[_0x3666db[_0xeb7d('0x1d')]],'as':_0x3666db['as'],'attributes':_0x3666db[_0xeb7d('0x1a')],'include':_0x3666db[_0xeb7d('0x1c')]?_['map'](_0x3666db[_0xeb7d('0x1c')],function(_0x392ba1){return{'model':db[_0x392ba1[_0xeb7d('0x1d')]],'as':_0x392ba1['as'],'attributes':_0x392ba1[_0xeb7d('0x1a')],'include':_0x392ba1[_0xeb7d('0x1c')]?_[_0xeb7d('0x1b')](_0x392ba1[_0xeb7d('0x1c')],function(_0x529986){return{'model':db[_0x529986[_0xeb7d('0x1d')]],'as':_0x529986['as'],'attributes':_0x529986[_0xeb7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xeb7d('0xd')](function(_0xe0bf4f){logger[_0xeb7d('0xe')](_0xeb7d('0x15'),_0x298c8d);logger[_0xeb7d('0x1e')](_0xeb7d('0x15'),_0x298c8d,JSON[_0xeb7d('0x1f')](_0xe0bf4f));_0x1bfa8a(_0xe0bf4f);})['catch'](function(_0x3387ab){logger[_0xeb7d('0x11')](_0xeb7d('0x15'),_0x3387ab[_0xeb7d('0x13')],_0x298c8d);_0x4584c2(_0x598025[_0xeb7d('0x11')](0x1f4,_0x3387ab[_0xeb7d('0x13')]));});});};exports[_0xeb7d('0x20')]=function(_0x17dcee){var _0x42966f=this;return new Promise(function(_0x324d4a,_0x4426ec){return db[_0xeb7d('0x16')][_0xeb7d('0x21')]({'raw':_0x17dcee[_0xeb7d('0x18')]?_0x17dcee[_0xeb7d('0x18')][_0xeb7d('0x19')]===undefined?!![]:![]:!![],'where':_0x17dcee[_0xeb7d('0x18')]?_0x17dcee[_0xeb7d('0x18')][_0xeb7d('0x22')]||null:null,'attributes':_0x17dcee[_0xeb7d('0x18')]?_0x17dcee[_0xeb7d('0x18')][_0xeb7d('0x1a')]||null:null,'include':_0x17dcee[_0xeb7d('0x18')]?_0x17dcee[_0xeb7d('0x18')][_0xeb7d('0x1c')]?_[_0xeb7d('0x1b')](_0x17dcee[_0xeb7d('0x18')][_0xeb7d('0x1c')],function(_0x2ef72d){return{'model':db[_0x2ef72d[_0xeb7d('0x1d')]],'as':_0x2ef72d['as'],'attributes':_0x2ef72d[_0xeb7d('0x1a')],'include':_0x2ef72d['include']?_[_0xeb7d('0x1b')](_0x2ef72d[_0xeb7d('0x1c')],function(_0x1bb67e){return{'model':db[_0x1bb67e[_0xeb7d('0x1d')]],'as':_0x1bb67e['as'],'attributes':_0x1bb67e[_0xeb7d('0x1a')],'include':_0x1bb67e['include']?_[_0xeb7d('0x1b')](_0x1bb67e[_0xeb7d('0x1c')],function(_0x4d5dcc){return{'model':db[_0x4d5dcc[_0xeb7d('0x1d')]],'as':_0x4d5dcc['as'],'attributes':_0x4d5dcc[_0xeb7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xeb7d('0xd')](function(_0x8c4e94){logger[_0xeb7d('0xe')](_0xeb7d('0x20'),_0x17dcee);logger[_0xeb7d('0x1e')]('ShowZohoAccount',_0x17dcee,JSON[_0xeb7d('0x1f')](_0x8c4e94));_0x324d4a(_0x8c4e94);})['catch'](function(_0x2be41b){logger[_0xeb7d('0x11')](_0xeb7d('0x20'),_0x2be41b[_0xeb7d('0x13')],_0x17dcee);_0x4426ec(_0x42966f[_0xeb7d('0x11')](0x1f4,_0x2be41b[_0xeb7d('0x13')]));});});}; \ No newline at end of file +var _0x6a95=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','include','map','model','then','ShowZohoAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x376ffe,_0x2a7ec7){var _0x327b9f=function(_0x2ff0eb){while(--_0x2ff0eb){_0x376ffe['push'](_0x376ffe['shift']());}};_0x327b9f(++_0x2a7ec7);}(_0x6a95,0x1db));var _0x56a9=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6a95[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('ZohoAccount,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')]({'raw':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')][_0x56a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')]['where']||null:null,'attributes':_0x576bdf['options']?_0x576bdf[_0x56a9('0x1b')][_0x56a9('0x1d')]||null:null,'limit':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')]['limit']||null:null,'include':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')][_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x576bdf['options'][_0x56a9('0x1e')],function(_0x32839b){return{'model':db[_0x32839b[_0x56a9('0x20')]],'as':_0x32839b['as'],'attributes':_0x32839b[_0x56a9('0x1d')],'include':_0x32839b[_0x56a9('0x1e')]?_['map'](_0x32839b[_0x56a9('0x1e')],function(_0x217bda){return{'model':db[_0x217bda[_0x56a9('0x20')]],'as':_0x217bda['as'],'attributes':_0x217bda['attributes'],'include':_0x217bda[_0x56a9('0x1e')]?_['map'](_0x217bda[_0x56a9('0x1e')],function(_0x8d41d6){return{'model':db[_0x8d41d6[_0x56a9('0x20')]],'as':_0x8d41d6['as'],'attributes':_0x8d41d6[_0x56a9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56a9('0x21')](function(_0x1afe8a){logger[_0x56a9('0xd')](_0x56a9('0x18'),_0x576bdf);logger['debug'](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x1afe8a));_0x105fe5(_0x1afe8a);})['catch'](function(_0x4441ce){logger['error']('GetZohoAccount',_0x4441ce[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x4441ce[_0x56a9('0x15')]));});});};exports[_0x56a9('0x22')]=function(_0x2fbd5d){var _0x2c1c3d=this;return new Promise(function(_0x5879db,_0x332707){return db[_0x56a9('0x19')][_0x56a9('0x23')]({'raw':_0x2fbd5d[_0x56a9('0x1b')]?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2fbd5d[_0x56a9('0x1b')]?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x24')]||null:null,'attributes':_0x2fbd5d[_0x56a9('0x1b')]?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x1d')]||null:null,'include':_0x2fbd5d['options']?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x2fbd5d['options'][_0x56a9('0x1e')],function(_0x51ce05){return{'model':db[_0x51ce05['model']],'as':_0x51ce05['as'],'attributes':_0x51ce05['attributes'],'include':_0x51ce05[_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x51ce05['include'],function(_0x5473cb){return{'model':db[_0x5473cb[_0x56a9('0x20')]],'as':_0x5473cb['as'],'attributes':_0x5473cb[_0x56a9('0x1d')],'include':_0x5473cb[_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x5473cb[_0x56a9('0x1e')],function(_0x239601){return{'model':db[_0x239601[_0x56a9('0x20')]],'as':_0x239601['as'],'attributes':_0x239601[_0x56a9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56a9('0x21')](function(_0x189f13){logger['info']('ShowZohoAccount',_0x2fbd5d);logger['debug']('ShowZohoAccount',_0x2fbd5d,JSON[_0x56a9('0x12')](_0x189f13));_0x5879db(_0x189f13);})[_0x56a9('0x17')](function(_0x55b295){logger[_0x56a9('0x13')](_0x56a9('0x22'),_0x55b295[_0x56a9('0x15')],_0x2fbd5d);_0x332707(_0x2c1c3d[_0x56a9('0x13')](0x1f4,_0x55b295[_0x56a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d462006..044e042 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 _0x92f6=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util'];(function(_0x55d408,_0x25416e){var _0x46fec2=function(_0x287b60){while(--_0x287b60){_0x55d408['push'](_0x55d408['shift']());}};_0x46fec2(++_0x25416e);}(_0x92f6,0xe8));var _0x692f=function(_0x5e2da7,_0x2cfb12){_0x5e2da7=_0x5e2da7-0x0;var _0x8949eb=_0x92f6[_0x5e2da7];return _0x8949eb;};'use strict';var multer=require(_0x692f('0x0'));var util=require(_0x692f('0x1'));var path=require(_0x692f('0x2'));var timeout=require(_0x692f('0x3'));var express=require(_0x692f('0x4'));var router=express[_0x692f('0x5')]();var fs_extra=require(_0x692f('0x6'));var auth=require(_0x692f('0x7'));var interaction=require(_0x692f('0x8'));var config=require(_0x692f('0x9'));var controller=require(_0x692f('0xa'));router[_0x692f('0xb')]('/',auth[_0x692f('0xc')](),controller[_0x692f('0xd')]);router[_0x692f('0xb')](_0x692f('0xe'),auth[_0x692f('0xc')](),controller[_0x692f('0xf')]);router[_0x692f('0xb')](_0x692f('0x10'),auth[_0x692f('0xc')](),controller['getFields']);router['get'](_0x692f('0x11'),auth[_0x692f('0xc')](),controller[_0x692f('0x12')]);router[_0x692f('0xb')](_0x692f('0x13'),auth[_0x692f('0xc')](),controller['getDescriptions']);router[_0x692f('0x14')]('/',auth[_0x692f('0xc')](),controller['create']);router[_0x692f('0x15')](_0x692f('0xe'),auth['isAuthenticated'](),controller[_0x692f('0x16')]);router[_0x692f('0x17')](_0x692f('0xe'),auth['isAuthenticated'](),controller[_0x692f('0x18')]);module[_0x692f('0x19')]=router; \ No newline at end of file +var _0xe1bd=['post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','index','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x409f0c,_0x14ca22){var _0x20fc6d=function(_0x5f420d){while(--_0x5f420d){_0x409f0c['push'](_0x409f0c['shift']());}};_0x20fc6d(++_0x14ca22);}(_0xe1bd,0xcf));var _0xde1b=function(_0x340263,_0xbded71){_0x340263=_0x340263-0x0;var _0x28b4ba=_0xe1bd[_0x340263];return _0x28b4ba;};'use strict';var multer=require(_0xde1b('0x0'));var util=require(_0xde1b('0x1'));var path=require(_0xde1b('0x2'));var timeout=require(_0xde1b('0x3'));var express=require(_0xde1b('0x4'));var router=express[_0xde1b('0x5')]();var fs_extra=require(_0xde1b('0x6'));var auth=require(_0xde1b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde1b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xde1b('0x9')]);router[_0xde1b('0xa')]('/:id',auth[_0xde1b('0xb')](),controller['show']);router['get'](_0xde1b('0xc'),auth[_0xde1b('0xb')](),controller[_0xde1b('0xd')]);router['get'](_0xde1b('0xe'),auth[_0xde1b('0xb')](),controller[_0xde1b('0xf')]);router['get'](_0xde1b('0x10'),auth['isAuthenticated'](),controller[_0xde1b('0x11')]);router[_0xde1b('0x12')]('/',auth['isAuthenticated'](),controller[_0xde1b('0x13')]);router[_0xde1b('0x14')](_0xde1b('0x15'),auth[_0xde1b('0xb')](),controller['update']);router[_0xde1b('0x16')](_0xde1b('0x15'),auth['isAuthenticated'](),controller[_0xde1b('0x17')]);module[_0xde1b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 09ab7ce..02f6141 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 _0xcafc=['exports','contact','lead','contact_lead','STRING','sequelize'];(function(_0x18b5fb,_0x36862b){var _0x56f0e2=function(_0x1a1320){while(--_0x1a1320){_0x18b5fb['push'](_0x18b5fb['shift']());}};_0x56f0e2(++_0x36862b);}(_0xcafc,0x77));var _0xccaf=function(_0x184c2c,_0x5d087d){_0x184c2c=_0x184c2c-0x0;var _0xebde79=_0xcafc[_0x184c2c];return _0xebde79;};'use strict';var Sequelize=require(_0xccaf('0x0'));module[_0xccaf('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0xccaf('0x2'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xccaf('0x2'),_0xccaf('0x3')),'defaultValue':_0xccaf('0x4')},'description':{'type':Sequelize[_0xccaf('0x5')]}}; \ No newline at end of file +var _0x1829=['ENUM','lead','contact','nothing'];(function(_0x266244,_0x4d55a4){var _0x187672=function(_0x2b63d7){while(--_0x2b63d7){_0x266244['push'](_0x266244['shift']());}};_0x187672(++_0x4d55a4);}(_0x1829,0x13c));var _0x9182=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x1829[_0x32b542];return _0x554d54;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x9182('0x0')](_0x9182('0x1'),_0x9182('0x2'),_0x9182('0x3')),'defaultValue':_0x9182('0x1')},'moduleSearch':{'type':Sequelize[_0x9182('0x0')]('contact_lead',_0x9182('0x2'),_0x9182('0x1')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2c3e130..8c21f7c 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 _0xbdf0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2e52e3,_0x200273){var _0x562cf3=function(_0x5c8808){while(--_0x5c8808){_0x2e52e3['push'](_0x2e52e3['shift']());}};_0x562cf3(++_0x200273);}(_0xbdf0,0x120));var _0x0bdf=function(_0x5ee582,_0x5c1898){_0x5ee582=_0x5ee582-0x0;var _0x176a90=_0xbdf0[_0x5ee582];return _0x176a90;};'use strict';var emlformat=require(_0x0bdf('0x0'));var rimraf=require(_0x0bdf('0x1'));var zipdir=require(_0x0bdf('0x2'));var jsonpatch=require(_0x0bdf('0x3'));var rp=require(_0x0bdf('0x4'));var moment=require(_0x0bdf('0x5'));var BPromise=require(_0x0bdf('0x6'));var Mustache=require(_0x0bdf('0x7'));var util=require(_0x0bdf('0x8'));var path=require(_0x0bdf('0x9'));var sox=require('sox');var csv=require(_0x0bdf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0bdf('0xb'));var _=require(_0x0bdf('0xc'));var squel=require(_0x0bdf('0xd'));var crypto=require(_0x0bdf('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bdf('0xa'));var querystring=require(_0x0bdf('0xf'));var Papa=require(_0x0bdf('0x10'));var Redis=require(_0x0bdf('0x11'));var authService=require(_0x0bdf('0x12'));var qs=require(_0x0bdf('0x13'));var as=require(_0x0bdf('0x14'));var hardwareService=require(_0x0bdf('0x15'));var logger=require(_0x0bdf('0x16'))(_0x0bdf('0x17'));var utils=require('../../config/utils');var config=require(_0x0bdf('0x18'));var licenseUtil=require(_0x0bdf('0x19'));var db=require(_0x0bdf('0x1a'))['db'];function respondWithStatusCode(_0x64d115,_0xaf6dd8){_0xaf6dd8=_0xaf6dd8||0xcc;return function(_0x476ad8){if(_0x476ad8){return _0x64d115[_0x0bdf('0x1b')](_0xaf6dd8);}return _0x64d115['status'](_0xaf6dd8)[_0x0bdf('0x1c')]();};}function respondWithResult(_0x4933c5,_0x125624){_0x125624=_0x125624||0xc8;return function(_0x1b3bb9){if(_0x1b3bb9){return _0x4933c5[_0x0bdf('0x1d')](_0x125624)[_0x0bdf('0x1e')](_0x1b3bb9);}};}function respondWithFilteredResult(_0x41d676,_0x4776f3){return function(_0x2fac99){if(_0x2fac99){var _0x10e2eb=typeof _0x4776f3[_0x0bdf('0x1f')]===_0x0bdf('0x20')&&typeof _0x4776f3[_0x0bdf('0x21')]===_0x0bdf('0x20');var _0x3891f8=_0x2fac99[_0x0bdf('0x22')];var _0xb25e2f=_0x10e2eb?0x0:_0x4776f3[_0x0bdf('0x1f')];var _0xcde8ea=_0x10e2eb?_0x2fac99['count']:_0x4776f3[_0x0bdf('0x1f')]+_0x4776f3[_0x0bdf('0x21')];var _0x293f54;if(_0xcde8ea>=_0x3891f8){_0xcde8ea=_0x3891f8;_0x293f54=0xc8;}else{_0x293f54=0xce;}_0x41d676[_0x0bdf('0x1d')](_0x293f54);return _0x41d676[_0x0bdf('0x23')](_0x0bdf('0x24'),_0xb25e2f+'-'+_0xcde8ea+'/'+_0x3891f8)['json'](_0x2fac99);}return null;};}function patchUpdates(_0x437b23){return function(_0x1eb836){try{jsonpatch[_0x0bdf('0x25')](_0x1eb836,_0x437b23,!![]);}catch(_0xea8d9e){return BPromise[_0x0bdf('0x26')](_0xea8d9e);}return _0x1eb836[_0x0bdf('0x27')]();};}function saveUpdates(_0x4b9718,_0x369bee){return function(_0x440d4c){if(_0x440d4c){return _0x440d4c[_0x0bdf('0x28')](_0x4b9718)[_0x0bdf('0x29')](function(_0xd15595){return _0xd15595;});}return null;};}function removeEntity(_0x9a16c,_0x58150f){return function(_0x17052e){if(_0x17052e){return _0x17052e[_0x0bdf('0x2a')]()[_0x0bdf('0x29')](function(){_0x9a16c[_0x0bdf('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d1afe,_0xd7b1d7){return function(_0x224f3c){if(!_0x224f3c){_0x6d1afe[_0x0bdf('0x1b')](0x194);}return _0x224f3c;};}function handleError(_0x5f58b4,_0xa83e05){_0xa83e05=_0xa83e05||0x1f4;return function(_0xf0d06c){logger[_0x0bdf('0x2b')](_0xf0d06c[_0x0bdf('0x2c')]);if(_0xf0d06c[_0x0bdf('0x2d')]){delete _0xf0d06c[_0x0bdf('0x2d')];}_0x5f58b4['status'](_0xa83e05)[_0x0bdf('0x2e')](_0xf0d06c);};}exports[_0x0bdf('0x2f')]=function(_0x36f85c,_0x10a75e){var _0x4b5798={},_0x48f8ee={},_0x3697b9={'count':0x0,'rows':[]};var _0x352f58=_[_0x0bdf('0x30')](db[_0x0bdf('0x31')][_0x0bdf('0x32')],function(_0x1ff70f){return{'name':_0x1ff70f[_0x0bdf('0x33')],'type':_0x1ff70f[_0x0bdf('0x34')][_0x0bdf('0x35')]};});_0x48f8ee[_0x0bdf('0x36')]=_[_0x0bdf('0x30')](_0x352f58,_0x0bdf('0x2d'));_0x48f8ee[_0x0bdf('0x37')]=_[_0x0bdf('0x38')](_0x36f85c[_0x0bdf('0x37')]);_0x48f8ee[_0x0bdf('0x39')]=_[_0x0bdf('0x3a')](_0x48f8ee[_0x0bdf('0x36')],_0x48f8ee[_0x0bdf('0x37')]);_0x4b5798[_0x0bdf('0x3b')]=_[_0x0bdf('0x3a')](_0x48f8ee['model'],qs[_0x0bdf('0x3c')](_0x36f85c[_0x0bdf('0x37')]['fields']));_0x4b5798[_0x0bdf('0x3b')]=_0x4b5798['attributes'][_0x0bdf('0x3d')]?_0x4b5798[_0x0bdf('0x3b')]:_0x48f8ee[_0x0bdf('0x36')];if(!_0x36f85c[_0x0bdf('0x37')][_0x0bdf('0x3e')](_0x0bdf('0x3f'))){_0x4b5798[_0x0bdf('0x21')]=qs[_0x0bdf('0x21')](_0x36f85c[_0x0bdf('0x37')][_0x0bdf('0x21')]);_0x4b5798[_0x0bdf('0x1f')]=qs[_0x0bdf('0x1f')](_0x36f85c['query']['offset']);}_0x4b5798[_0x0bdf('0x40')]=qs[_0x0bdf('0x41')](_0x36f85c[_0x0bdf('0x37')][_0x0bdf('0x41')]);_0x4b5798[_0x0bdf('0x42')]=qs['filters'](_[_0x0bdf('0x43')](_0x36f85c[_0x0bdf('0x37')],_0x48f8ee[_0x0bdf('0x39')]),_0x352f58);if(_0x36f85c[_0x0bdf('0x37')][_0x0bdf('0x44')]){_0x4b5798[_0x0bdf('0x42')]=_['merge'](_0x4b5798['where'],{'$or':_[_0x0bdf('0x30')](_0x352f58,function(_0x282a7c){if(_0x282a7c[_0x0bdf('0x34')]!==_0x0bdf('0x45')){var _0x32f623={};_0x32f623[_0x282a7c[_0x0bdf('0x2d')]]={'$like':'%'+_0x36f85c[_0x0bdf('0x37')][_0x0bdf('0x44')]+'%'};return _0x32f623;}})});}_0x4b5798=_[_0x0bdf('0x46')]({},_0x4b5798,_0x36f85c[_0x0bdf('0x47')]);var _0x6b3fd9={'where':_0x4b5798[_0x0bdf('0x42')]};return db[_0x0bdf('0x31')][_0x0bdf('0x22')](_0x6b3fd9)['then'](function(_0x3677b5){_0x3697b9[_0x0bdf('0x22')]=_0x3677b5;if(_0x36f85c[_0x0bdf('0x37')][_0x0bdf('0x48')]){_0x4b5798[_0x0bdf('0x49')]=[{'all':!![]}];}return db[_0x0bdf('0x31')][_0x0bdf('0x4a')](_0x4b5798);})[_0x0bdf('0x29')](function(_0x5655b6){_0x3697b9[_0x0bdf('0x4b')]=_0x5655b6;return _0x3697b9;})[_0x0bdf('0x29')](respondWithFilteredResult(_0x10a75e,_0x4b5798))[_0x0bdf('0x4c')](handleError(_0x10a75e,null));};exports[_0x0bdf('0x4d')]=function(_0x4f5102,_0x5b833c){var _0x566303={'raw':![],'where':{'id':_0x4f5102[_0x0bdf('0x4e')]['id']}},_0x5f8d99={};_0x5f8d99['model']=_[_0x0bdf('0x38')](db[_0x0bdf('0x31')][_0x0bdf('0x32')]);_0x5f8d99[_0x0bdf('0x37')]=_[_0x0bdf('0x38')](_0x4f5102[_0x0bdf('0x37')]);_0x5f8d99[_0x0bdf('0x39')]=_[_0x0bdf('0x3a')](_0x5f8d99[_0x0bdf('0x36')],_0x5f8d99[_0x0bdf('0x37')]);_0x566303[_0x0bdf('0x3b')]=_[_0x0bdf('0x3a')](_0x5f8d99['model'],qs[_0x0bdf('0x3c')](_0x4f5102['query'][_0x0bdf('0x3c')]));_0x566303[_0x0bdf('0x3b')]=_0x566303[_0x0bdf('0x3b')][_0x0bdf('0x3d')]?_0x566303['attributes']:_0x5f8d99[_0x0bdf('0x36')];if(_0x4f5102[_0x0bdf('0x37')][_0x0bdf('0x48')]){_0x566303['include']=[{'all':!![]}];}_0x566303=_['merge']({},_0x566303,_0x4f5102[_0x0bdf('0x47')]);return db[_0x0bdf('0x31')]['find'](_0x566303)[_0x0bdf('0x29')](handleEntityNotFound(_0x5b833c,null))[_0x0bdf('0x29')](respondWithResult(_0x5b833c,null))[_0x0bdf('0x4c')](handleError(_0x5b833c,null));};exports[_0x0bdf('0x4f')]=function(_0x396065,_0x1e3817){return db['ZohoConfiguration'][_0x0bdf('0x4f')](_0x396065['body'],{})[_0x0bdf('0x29')](respondWithResult(_0x1e3817,0xc9))['catch'](handleError(_0x1e3817,null));};exports['update']=function(_0x1bee5d,_0x2b4dd7){if(_0x1bee5d['body']['id']){delete _0x1bee5d[_0x0bdf('0x50')]['id'];}return db['ZohoConfiguration'][_0x0bdf('0x51')]({'where':{'id':_0x1bee5d[_0x0bdf('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b4dd7,null))[_0x0bdf('0x29')](saveUpdates(_0x1bee5d[_0x0bdf('0x50')],null))['then'](respondWithResult(_0x2b4dd7,null))[_0x0bdf('0x4c')](handleError(_0x2b4dd7,null));};exports[_0x0bdf('0x2a')]=function(_0x4ed28e,_0x4830a5){return db[_0x0bdf('0x31')]['find']({'where':{'id':_0x4ed28e[_0x0bdf('0x4e')]['id']}})[_0x0bdf('0x29')](handleEntityNotFound(_0x4830a5,null))[_0x0bdf('0x29')](removeEntity(_0x4830a5,null))[_0x0bdf('0x4c')](handleError(_0x4830a5,null));};exports[_0x0bdf('0x52')]=function(_0x461c0e,_0x5166cd,_0x48694a){var _0xb051c2={};var _0xf26ce0={};var _0x1ff242;var _0x53b274;return db[_0x0bdf('0x31')][_0x0bdf('0x53')]({'where':{'id':_0x461c0e[_0x0bdf('0x4e')]['id']}})[_0x0bdf('0x29')](handleEntityNotFound(_0x5166cd,null))[_0x0bdf('0x29')](function(_0x50f595){if(_0x50f595){_0x1ff242=_0x50f595;_0xf26ce0['model']=_[_0x0bdf('0x38')](db[_0x0bdf('0x54')][_0x0bdf('0x32')]);_0xf26ce0[_0x0bdf('0x37')]=_['keys'](_0x461c0e[_0x0bdf('0x37')]);_0xf26ce0[_0x0bdf('0x39')]=_[_0x0bdf('0x3a')](_0xf26ce0['model'],_0xf26ce0[_0x0bdf('0x37')]);_0xb051c2['attributes']=_[_0x0bdf('0x3a')](_0xf26ce0['model'],qs['fields'](_0x461c0e['query'][_0x0bdf('0x3c')]));_0xb051c2[_0x0bdf('0x3b')]=_0xb051c2['attributes'][_0x0bdf('0x3d')]?_0xb051c2[_0x0bdf('0x3b')]:_0xf26ce0[_0x0bdf('0x36')];_0xb051c2[_0x0bdf('0x40')]=qs[_0x0bdf('0x41')](_0x461c0e[_0x0bdf('0x37')][_0x0bdf('0x41')]);_0xb051c2['where']=qs[_0x0bdf('0x39')](_[_0x0bdf('0x43')](_0x461c0e['query'],_0xf26ce0[_0x0bdf('0x39')]));if(_0x461c0e[_0x0bdf('0x37')][_0x0bdf('0x44')]){_0xb051c2[_0x0bdf('0x42')]=_[_0x0bdf('0x46')](_0xb051c2['where'],{'$or':_['map'](_0xb051c2[_0x0bdf('0x3b')],function(_0x58166c){var _0x2d132a={};_0x2d132a[_0x58166c]={'$like':'%'+_0x461c0e['query']['filter']+'%'};return _0x2d132a;})});}_0xb051c2=_['merge']({},_0xb051c2,_0x461c0e['options']);return _0x1ff242[_0x0bdf('0x52')](_0xb051c2);}})['then'](function(_0xb5d60f){if(_0xb5d60f){_0x53b274=_0xb5d60f[_0x0bdf('0x3d')];if(!_0x461c0e[_0x0bdf('0x37')][_0x0bdf('0x3e')](_0x0bdf('0x3f'))){_0xb051c2[_0x0bdf('0x21')]=qs[_0x0bdf('0x21')](_0x461c0e[_0x0bdf('0x37')][_0x0bdf('0x21')]);_0xb051c2[_0x0bdf('0x1f')]=qs['offset'](_0x461c0e[_0x0bdf('0x37')][_0x0bdf('0x1f')]);}return _0x1ff242[_0x0bdf('0x52')](_0xb051c2);}})[_0x0bdf('0x29')](function(_0x2fa554){if(_0x2fa554){return _0x2fa554?{'count':_0x53b274,'rows':_0x2fa554}:null;}})[_0x0bdf('0x29')](respondWithResult(_0x5166cd,null))[_0x0bdf('0x4c')](handleError(_0x5166cd,null));};exports[_0x0bdf('0x55')]=function(_0x46498b,_0x9afa81,_0x578fcc){var _0x3711d0={};var _0x433f89={};var _0x2fd7b7;var _0x1b0724;return db[_0x0bdf('0x31')][_0x0bdf('0x53')]({'where':{'id':_0x46498b[_0x0bdf('0x4e')]['id']}})[_0x0bdf('0x29')](handleEntityNotFound(_0x9afa81,null))[_0x0bdf('0x29')](function(_0x5b1a1a){if(_0x5b1a1a){_0x2fd7b7=_0x5b1a1a;_0x433f89[_0x0bdf('0x36')]=_[_0x0bdf('0x38')](db['ZohoField']['rawAttributes']);_0x433f89[_0x0bdf('0x37')]=_[_0x0bdf('0x38')](_0x46498b['query']);_0x433f89[_0x0bdf('0x39')]=_[_0x0bdf('0x3a')](_0x433f89[_0x0bdf('0x36')],_0x433f89[_0x0bdf('0x37')]);_0x3711d0[_0x0bdf('0x3b')]=_[_0x0bdf('0x3a')](_0x433f89[_0x0bdf('0x36')],qs['fields'](_0x46498b[_0x0bdf('0x37')][_0x0bdf('0x3c')]));_0x3711d0['attributes']=_0x3711d0[_0x0bdf('0x3b')][_0x0bdf('0x3d')]?_0x3711d0[_0x0bdf('0x3b')]:_0x433f89[_0x0bdf('0x36')];_0x3711d0[_0x0bdf('0x40')]=qs['sort'](_0x46498b[_0x0bdf('0x37')]['sort']);_0x3711d0[_0x0bdf('0x42')]=qs[_0x0bdf('0x39')](_['pick'](_0x46498b[_0x0bdf('0x37')],_0x433f89[_0x0bdf('0x39')]));if(_0x46498b[_0x0bdf('0x37')][_0x0bdf('0x44')]){_0x3711d0[_0x0bdf('0x42')]=_[_0x0bdf('0x46')](_0x3711d0[_0x0bdf('0x42')],{'$or':_['map'](_0x3711d0[_0x0bdf('0x3b')],function(_0x5590c1){var _0x31f63e={};_0x31f63e[_0x5590c1]={'$like':'%'+_0x46498b['query'][_0x0bdf('0x44')]+'%'};return _0x31f63e;})});}_0x3711d0=_['merge']({},_0x3711d0,_0x46498b[_0x0bdf('0x47')]);return _0x2fd7b7[_0x0bdf('0x55')](_0x3711d0);}})[_0x0bdf('0x29')](function(_0xdc7958){if(_0xdc7958){_0x1b0724=_0xdc7958[_0x0bdf('0x3d')];if(!_0x46498b['query'][_0x0bdf('0x3e')](_0x0bdf('0x3f'))){_0x3711d0[_0x0bdf('0x21')]=qs[_0x0bdf('0x21')](_0x46498b['query'][_0x0bdf('0x21')]);_0x3711d0[_0x0bdf('0x1f')]=qs['offset'](_0x46498b[_0x0bdf('0x37')][_0x0bdf('0x1f')]);}return _0x2fd7b7[_0x0bdf('0x55')](_0x3711d0);}})[_0x0bdf('0x29')](function(_0x300983){if(_0x300983){return _0x300983?{'count':_0x1b0724,'rows':_0x300983}:null;}})[_0x0bdf('0x29')](respondWithResult(_0x9afa81,null))[_0x0bdf('0x4c')](handleError(_0x9afa81,null));};exports[_0x0bdf('0x56')]=function(_0x35d642,_0x469641,_0x3339c4){var _0xdfea14={};var _0x4759f2={};var _0x4c6a6b;var _0x2c988a;return db['ZohoConfiguration'][_0x0bdf('0x53')]({'where':{'id':_0x35d642[_0x0bdf('0x4e')]['id']}})[_0x0bdf('0x29')](handleEntityNotFound(_0x469641,null))['then'](function(_0x2d4945){if(_0x2d4945){_0x4c6a6b=_0x2d4945;_0x4759f2[_0x0bdf('0x36')]=_[_0x0bdf('0x38')](db[_0x0bdf('0x54')]['rawAttributes']);_0x4759f2['query']=_[_0x0bdf('0x38')](_0x35d642[_0x0bdf('0x37')]);_0x4759f2['filters']=_[_0x0bdf('0x3a')](_0x4759f2[_0x0bdf('0x36')],_0x4759f2[_0x0bdf('0x37')]);_0xdfea14['attributes']=_[_0x0bdf('0x3a')](_0x4759f2[_0x0bdf('0x36')],qs['fields'](_0x35d642[_0x0bdf('0x37')][_0x0bdf('0x3c')]));_0xdfea14['attributes']=_0xdfea14[_0x0bdf('0x3b')][_0x0bdf('0x3d')]?_0xdfea14[_0x0bdf('0x3b')]:_0x4759f2[_0x0bdf('0x36')];_0xdfea14['order']=qs[_0x0bdf('0x41')](_0x35d642[_0x0bdf('0x37')]['sort']);_0xdfea14[_0x0bdf('0x42')]=qs[_0x0bdf('0x39')](_['pick'](_0x35d642[_0x0bdf('0x37')],_0x4759f2[_0x0bdf('0x39')]));if(_0x35d642[_0x0bdf('0x37')][_0x0bdf('0x44')]){_0xdfea14[_0x0bdf('0x42')]=_[_0x0bdf('0x46')](_0xdfea14[_0x0bdf('0x42')],{'$or':_[_0x0bdf('0x30')](_0xdfea14[_0x0bdf('0x3b')],function(_0x33035d){var _0x4aa5b8={};_0x4aa5b8[_0x33035d]={'$like':'%'+_0x35d642[_0x0bdf('0x37')][_0x0bdf('0x44')]+'%'};return _0x4aa5b8;})});}_0xdfea14=_[_0x0bdf('0x46')]({},_0xdfea14,_0x35d642[_0x0bdf('0x47')]);return _0x4c6a6b['getDescriptions'](_0xdfea14);}})[_0x0bdf('0x29')](function(_0x42ddfc){if(_0x42ddfc){_0x2c988a=_0x42ddfc[_0x0bdf('0x3d')];if(!_0x35d642['query'][_0x0bdf('0x3e')](_0x0bdf('0x3f'))){_0xdfea14[_0x0bdf('0x21')]=qs[_0x0bdf('0x21')](_0x35d642[_0x0bdf('0x37')][_0x0bdf('0x21')]);_0xdfea14['offset']=qs[_0x0bdf('0x1f')](_0x35d642[_0x0bdf('0x37')][_0x0bdf('0x1f')]);}return _0x4c6a6b[_0x0bdf('0x56')](_0xdfea14);}})[_0x0bdf('0x29')](function(_0x58759f){if(_0x58759f){return _0x58759f?{'count':_0x2c988a,'rows':_0x58759f}:null;}})['then'](respondWithResult(_0x469641,null))[_0x0bdf('0x4c')](handleError(_0x469641,null));}; \ No newline at end of file +var _0x1c2b=['Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','ZohoConfiguration','includeAll','rows','catch','keys','options','find','create','body','params','getFields','findOne','ZohoField','order','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set'];(function(_0x5994e6,_0x5a999f){var _0x1bf96b=function(_0x406237){while(--_0x406237){_0x5994e6['push'](_0x5994e6['shift']());}};_0x1bf96b(++_0x5a999f);}(_0x1c2b,0x123));var _0xb1c2=function(_0x148316,_0x6c9dc){_0x148316=_0x148316-0x0;var _0xdbe95d=_0x1c2b[_0x148316];return _0xdbe95d;};'use strict';var emlformat=require(_0xb1c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1c2('0x1'));var jsonpatch=require(_0xb1c2('0x2'));var rp=require(_0xb1c2('0x3'));var moment=require('moment');var BPromise=require(_0xb1c2('0x4'));var Mustache=require(_0xb1c2('0x5'));var util=require(_0xb1c2('0x6'));var path=require(_0xb1c2('0x7'));var sox=require(_0xb1c2('0x8'));var csv=require(_0xb1c2('0x9'));var ejs=require(_0xb1c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb1c2('0xb'));var crypto=require(_0xb1c2('0xc'));var jsforce=require(_0xb1c2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb1c2('0x9'));var querystring=require(_0xb1c2('0xe'));var Papa=require(_0xb1c2('0xf'));var Redis=require(_0xb1c2('0x10'));var authService=require(_0xb1c2('0x11'));var qs=require(_0xb1c2('0x12'));var as=require(_0xb1c2('0x13'));var hardwareService=require(_0xb1c2('0x14'));var logger=require('../../config/logger')(_0xb1c2('0x15'));var utils=require(_0xb1c2('0x16'));var config=require(_0xb1c2('0x17'));var licenseUtil=require(_0xb1c2('0x18'));var db=require(_0xb1c2('0x19'))['db'];function respondWithStatusCode(_0x553ba2,_0x15f9d8){_0x15f9d8=_0x15f9d8||0xcc;return function(_0x32893d){if(_0x32893d){return _0x553ba2['sendStatus'](_0x15f9d8);}return _0x553ba2[_0xb1c2('0x1a')](_0x15f9d8)['end']();};}function respondWithResult(_0x2db4e9,_0x370065){_0x370065=_0x370065||0xc8;return function(_0x11d0ed){if(_0x11d0ed){return _0x2db4e9['status'](_0x370065)[_0xb1c2('0x1b')](_0x11d0ed);}};}function respondWithFilteredResult(_0xf76f7d,_0xfc538){return function(_0x376dfe){if(_0x376dfe){var _0x226014=typeof _0xfc538[_0xb1c2('0x1c')]===_0xb1c2('0x1d')&&typeof _0xfc538[_0xb1c2('0x1e')]==='undefined';var _0x2542a3=_0x376dfe[_0xb1c2('0x1f')];var _0x2801e1=_0x226014?0x0:_0xfc538[_0xb1c2('0x1c')];var _0x54bec5=_0x226014?_0x376dfe[_0xb1c2('0x1f')]:_0xfc538[_0xb1c2('0x1c')]+_0xfc538['limit'];var _0x262680;if(_0x54bec5>=_0x2542a3){_0x54bec5=_0x2542a3;_0x262680=0xc8;}else{_0x262680=0xce;}_0xf76f7d[_0xb1c2('0x1a')](_0x262680);return _0xf76f7d[_0xb1c2('0x20')](_0xb1c2('0x21'),_0x2801e1+'-'+_0x54bec5+'/'+_0x2542a3)[_0xb1c2('0x1b')](_0x376dfe);}return null;};}function patchUpdates(_0x29d14c){return function(_0x3ea50d){try{jsonpatch[_0xb1c2('0x22')](_0x3ea50d,_0x29d14c,!![]);}catch(_0xe0033a){return BPromise[_0xb1c2('0x23')](_0xe0033a);}return _0x3ea50d[_0xb1c2('0x24')]();};}function saveUpdates(_0x5e8023,_0x4bbb50){return function(_0xe977c0){if(_0xe977c0){return _0xe977c0[_0xb1c2('0x25')](_0x5e8023)['then'](function(_0x5d5687){return _0x5d5687;});}return null;};}function removeEntity(_0x1dc4be,_0x869711){return function(_0x55eee2){if(_0x55eee2){return _0x55eee2[_0xb1c2('0x26')]()[_0xb1c2('0x27')](function(){_0x1dc4be[_0xb1c2('0x1a')](0xcc)[_0xb1c2('0x28')]();});}};}function handleEntityNotFound(_0x5dadb4,_0xfd5c16){return function(_0x516a49){if(!_0x516a49){_0x5dadb4[_0xb1c2('0x29')](0x194);}return _0x516a49;};}function handleError(_0x4b5c75,_0x2c3865){_0x2c3865=_0x2c3865||0x1f4;return function(_0xeda8fe){logger[_0xb1c2('0x2a')](_0xeda8fe[_0xb1c2('0x2b')]);if(_0xeda8fe[_0xb1c2('0x2c')]){delete _0xeda8fe[_0xb1c2('0x2c')];}_0x4b5c75[_0xb1c2('0x1a')](_0x2c3865)[_0xb1c2('0x2d')](_0xeda8fe);};}exports[_0xb1c2('0x2e')]=function(_0x57becc,_0x511a54){var _0x5a6942={},_0xf0f9c6={},_0x1561b7={'count':0x0,'rows':[]};var _0x3cac74=_[_0xb1c2('0x2f')](db['ZohoConfiguration'][_0xb1c2('0x30')],function(_0x13733d){return{'name':_0x13733d[_0xb1c2('0x31')],'type':_0x13733d[_0xb1c2('0x32')]['key']};});_0xf0f9c6[_0xb1c2('0x33')]=_[_0xb1c2('0x2f')](_0x3cac74,_0xb1c2('0x2c'));_0xf0f9c6[_0xb1c2('0x34')]=_['keys'](_0x57becc[_0xb1c2('0x34')]);_0xf0f9c6[_0xb1c2('0x35')]=_['intersection'](_0xf0f9c6[_0xb1c2('0x33')],_0xf0f9c6[_0xb1c2('0x34')]);_0x5a6942[_0xb1c2('0x36')]=_[_0xb1c2('0x37')](_0xf0f9c6[_0xb1c2('0x33')],qs['fields'](_0x57becc[_0xb1c2('0x34')][_0xb1c2('0x38')]));_0x5a6942[_0xb1c2('0x36')]=_0x5a6942[_0xb1c2('0x36')][_0xb1c2('0x39')]?_0x5a6942[_0xb1c2('0x36')]:_0xf0f9c6[_0xb1c2('0x33')];if(!_0x57becc[_0xb1c2('0x34')][_0xb1c2('0x3a')](_0xb1c2('0x3b'))){_0x5a6942[_0xb1c2('0x1e')]=qs[_0xb1c2('0x1e')](_0x57becc[_0xb1c2('0x34')]['limit']);_0x5a6942[_0xb1c2('0x1c')]=qs[_0xb1c2('0x1c')](_0x57becc['query']['offset']);}_0x5a6942['order']=qs['sort'](_0x57becc[_0xb1c2('0x34')][_0xb1c2('0x3c')]);_0x5a6942[_0xb1c2('0x3d')]=qs['filters'](_['pick'](_0x57becc[_0xb1c2('0x34')],_0xf0f9c6[_0xb1c2('0x35')]),_0x3cac74);if(_0x57becc[_0xb1c2('0x34')][_0xb1c2('0x3e')]){_0x5a6942[_0xb1c2('0x3d')]=_[_0xb1c2('0x3f')](_0x5a6942[_0xb1c2('0x3d')],{'$or':_['map'](_0x3cac74,function(_0x29d739){if(_0x29d739['type']!=='VIRTUAL'){var _0x520106={};_0x520106[_0x29d739[_0xb1c2('0x2c')]]={'$like':'%'+_0x57becc[_0xb1c2('0x34')][_0xb1c2('0x3e')]+'%'};return _0x520106;}})});}_0x5a6942=_[_0xb1c2('0x3f')]({},_0x5a6942,_0x57becc['options']);var _0x25c23b={'where':_0x5a6942[_0xb1c2('0x3d')]};return db[_0xb1c2('0x40')][_0xb1c2('0x1f')](_0x25c23b)[_0xb1c2('0x27')](function(_0x4153c8){_0x1561b7[_0xb1c2('0x1f')]=_0x4153c8;if(_0x57becc[_0xb1c2('0x34')][_0xb1c2('0x41')]){_0x5a6942['include']=[{'all':!![]}];}return db[_0xb1c2('0x40')]['findAll'](_0x5a6942);})['then'](function(_0x107c1a){_0x1561b7[_0xb1c2('0x42')]=_0x107c1a;return _0x1561b7;})[_0xb1c2('0x27')](respondWithFilteredResult(_0x511a54,_0x5a6942))[_0xb1c2('0x43')](handleError(_0x511a54,null));};exports['show']=function(_0x3c0973,_0x4815cc){var _0x300c6a={'raw':![],'where':{'id':_0x3c0973['params']['id']}},_0x3a52f2={};_0x3a52f2[_0xb1c2('0x33')]=_[_0xb1c2('0x44')](db[_0xb1c2('0x40')]['rawAttributes']);_0x3a52f2[_0xb1c2('0x34')]=_['keys'](_0x3c0973[_0xb1c2('0x34')]);_0x3a52f2[_0xb1c2('0x35')]=_[_0xb1c2('0x37')](_0x3a52f2[_0xb1c2('0x33')],_0x3a52f2[_0xb1c2('0x34')]);_0x300c6a[_0xb1c2('0x36')]=_['intersection'](_0x3a52f2[_0xb1c2('0x33')],qs[_0xb1c2('0x38')](_0x3c0973['query'][_0xb1c2('0x38')]));_0x300c6a[_0xb1c2('0x36')]=_0x300c6a[_0xb1c2('0x36')][_0xb1c2('0x39')]?_0x300c6a[_0xb1c2('0x36')]:_0x3a52f2[_0xb1c2('0x33')];if(_0x3c0973[_0xb1c2('0x34')]['includeAll']){_0x300c6a['include']=[{'all':!![]}];}_0x300c6a=_[_0xb1c2('0x3f')]({},_0x300c6a,_0x3c0973[_0xb1c2('0x45')]);return db[_0xb1c2('0x40')][_0xb1c2('0x46')](_0x300c6a)[_0xb1c2('0x27')](handleEntityNotFound(_0x4815cc,null))[_0xb1c2('0x27')](respondWithResult(_0x4815cc,null))[_0xb1c2('0x43')](handleError(_0x4815cc,null));};exports[_0xb1c2('0x47')]=function(_0x8b9dfd,_0x1e50f5){return db[_0xb1c2('0x40')][_0xb1c2('0x47')](_0x8b9dfd[_0xb1c2('0x48')],{})[_0xb1c2('0x27')](respondWithResult(_0x1e50f5,0xc9))[_0xb1c2('0x43')](handleError(_0x1e50f5,null));};exports[_0xb1c2('0x25')]=function(_0xfef92,_0x2ac128){if(_0xfef92[_0xb1c2('0x48')]['id']){delete _0xfef92['body']['id'];}return db[_0xb1c2('0x40')][_0xb1c2('0x46')]({'where':{'id':_0xfef92[_0xb1c2('0x49')]['id']}})[_0xb1c2('0x27')](handleEntityNotFound(_0x2ac128,null))[_0xb1c2('0x27')](saveUpdates(_0xfef92[_0xb1c2('0x48')],null))[_0xb1c2('0x27')](respondWithResult(_0x2ac128,null))['catch'](handleError(_0x2ac128,null));};exports['destroy']=function(_0x572315,_0x34d84f){return db[_0xb1c2('0x40')]['find']({'where':{'id':_0x572315['params']['id']}})[_0xb1c2('0x27')](handleEntityNotFound(_0x34d84f,null))['then'](removeEntity(_0x34d84f,null))[_0xb1c2('0x43')](handleError(_0x34d84f,null));};exports[_0xb1c2('0x4a')]=function(_0x210d4b,_0x256f13,_0xf29178){var _0x347701={};var _0x470e16={};var _0x46991f;var _0x2517f8;return db[_0xb1c2('0x40')][_0xb1c2('0x4b')]({'where':{'id':_0x210d4b[_0xb1c2('0x49')]['id']}})['then'](handleEntityNotFound(_0x256f13,null))[_0xb1c2('0x27')](function(_0x326845){if(_0x326845){_0x46991f=_0x326845;_0x470e16[_0xb1c2('0x33')]=_[_0xb1c2('0x44')](db[_0xb1c2('0x4c')][_0xb1c2('0x30')]);_0x470e16[_0xb1c2('0x34')]=_[_0xb1c2('0x44')](_0x210d4b[_0xb1c2('0x34')]);_0x470e16['filters']=_[_0xb1c2('0x37')](_0x470e16[_0xb1c2('0x33')],_0x470e16[_0xb1c2('0x34')]);_0x347701[_0xb1c2('0x36')]=_[_0xb1c2('0x37')](_0x470e16[_0xb1c2('0x33')],qs[_0xb1c2('0x38')](_0x210d4b[_0xb1c2('0x34')]['fields']));_0x347701[_0xb1c2('0x36')]=_0x347701[_0xb1c2('0x36')]['length']?_0x347701['attributes']:_0x470e16[_0xb1c2('0x33')];_0x347701[_0xb1c2('0x4d')]=qs[_0xb1c2('0x3c')](_0x210d4b[_0xb1c2('0x34')][_0xb1c2('0x3c')]);_0x347701[_0xb1c2('0x3d')]=qs[_0xb1c2('0x35')](_[_0xb1c2('0x4e')](_0x210d4b[_0xb1c2('0x34')],_0x470e16[_0xb1c2('0x35')]));if(_0x210d4b[_0xb1c2('0x34')][_0xb1c2('0x3e')]){_0x347701['where']=_[_0xb1c2('0x3f')](_0x347701[_0xb1c2('0x3d')],{'$or':_[_0xb1c2('0x2f')](_0x347701['attributes'],function(_0x10a950){var _0x363c1c={};_0x363c1c[_0x10a950]={'$like':'%'+_0x210d4b[_0xb1c2('0x34')][_0xb1c2('0x3e')]+'%'};return _0x363c1c;})});}_0x347701=_[_0xb1c2('0x3f')]({},_0x347701,_0x210d4b[_0xb1c2('0x45')]);return _0x46991f[_0xb1c2('0x4a')](_0x347701);}})[_0xb1c2('0x27')](function(_0x4b990b){if(_0x4b990b){_0x2517f8=_0x4b990b[_0xb1c2('0x39')];if(!_0x210d4b[_0xb1c2('0x34')][_0xb1c2('0x3a')](_0xb1c2('0x3b'))){_0x347701[_0xb1c2('0x1e')]=qs[_0xb1c2('0x1e')](_0x210d4b['query'][_0xb1c2('0x1e')]);_0x347701[_0xb1c2('0x1c')]=qs[_0xb1c2('0x1c')](_0x210d4b[_0xb1c2('0x34')][_0xb1c2('0x1c')]);}return _0x46991f['getFields'](_0x347701);}})[_0xb1c2('0x27')](function(_0x4d106d){if(_0x4d106d){return _0x4d106d?{'count':_0x2517f8,'rows':_0x4d106d}:null;}})[_0xb1c2('0x27')](respondWithResult(_0x256f13,null))[_0xb1c2('0x43')](handleError(_0x256f13,null));};exports[_0xb1c2('0x4f')]=function(_0x4f9c2f,_0x4ecb12,_0x3ff20f){var _0x238ccc={};var _0x14fc4a={};var _0x55f3df;var _0x143b9b;return db[_0xb1c2('0x40')]['findOne']({'where':{'id':_0x4f9c2f[_0xb1c2('0x49')]['id']}})[_0xb1c2('0x27')](handleEntityNotFound(_0x4ecb12,null))[_0xb1c2('0x27')](function(_0x54ece0){if(_0x54ece0){_0x55f3df=_0x54ece0;_0x14fc4a['model']=_[_0xb1c2('0x44')](db['ZohoField']['rawAttributes']);_0x14fc4a[_0xb1c2('0x34')]=_[_0xb1c2('0x44')](_0x4f9c2f[_0xb1c2('0x34')]);_0x14fc4a[_0xb1c2('0x35')]=_[_0xb1c2('0x37')](_0x14fc4a[_0xb1c2('0x33')],_0x14fc4a['query']);_0x238ccc[_0xb1c2('0x36')]=_['intersection'](_0x14fc4a[_0xb1c2('0x33')],qs[_0xb1c2('0x38')](_0x4f9c2f[_0xb1c2('0x34')]['fields']));_0x238ccc[_0xb1c2('0x36')]=_0x238ccc[_0xb1c2('0x36')][_0xb1c2('0x39')]?_0x238ccc['attributes']:_0x14fc4a[_0xb1c2('0x33')];_0x238ccc[_0xb1c2('0x4d')]=qs[_0xb1c2('0x3c')](_0x4f9c2f['query'][_0xb1c2('0x3c')]);_0x238ccc[_0xb1c2('0x3d')]=qs[_0xb1c2('0x35')](_[_0xb1c2('0x4e')](_0x4f9c2f[_0xb1c2('0x34')],_0x14fc4a[_0xb1c2('0x35')]));if(_0x4f9c2f['query']['filter']){_0x238ccc['where']=_['merge'](_0x238ccc[_0xb1c2('0x3d')],{'$or':_[_0xb1c2('0x2f')](_0x238ccc[_0xb1c2('0x36')],function(_0x24c199){var _0x5e1fda={};_0x5e1fda[_0x24c199]={'$like':'%'+_0x4f9c2f[_0xb1c2('0x34')][_0xb1c2('0x3e')]+'%'};return _0x5e1fda;})});}_0x238ccc=_[_0xb1c2('0x3f')]({},_0x238ccc,_0x4f9c2f[_0xb1c2('0x45')]);return _0x55f3df[_0xb1c2('0x4f')](_0x238ccc);}})[_0xb1c2('0x27')](function(_0x3f36c7){if(_0x3f36c7){_0x143b9b=_0x3f36c7['length'];if(!_0x4f9c2f[_0xb1c2('0x34')][_0xb1c2('0x3a')]('nolimit')){_0x238ccc['limit']=qs[_0xb1c2('0x1e')](_0x4f9c2f[_0xb1c2('0x34')]['limit']);_0x238ccc[_0xb1c2('0x1c')]=qs[_0xb1c2('0x1c')](_0x4f9c2f[_0xb1c2('0x34')][_0xb1c2('0x1c')]);}return _0x55f3df['getSubjects'](_0x238ccc);}})[_0xb1c2('0x27')](function(_0x2f86c8){if(_0x2f86c8){return _0x2f86c8?{'count':_0x143b9b,'rows':_0x2f86c8}:null;}})['then'](respondWithResult(_0x4ecb12,null))[_0xb1c2('0x43')](handleError(_0x4ecb12,null));};exports[_0xb1c2('0x50')]=function(_0x2a683f,_0x148f11,_0x46d06b){var _0x2d0fba={};var _0x4ce63a={};var _0x166d1e;var _0x43eceb;return db[_0xb1c2('0x40')]['findOne']({'where':{'id':_0x2a683f['params']['id']}})[_0xb1c2('0x27')](handleEntityNotFound(_0x148f11,null))[_0xb1c2('0x27')](function(_0x18ba12){if(_0x18ba12){_0x166d1e=_0x18ba12;_0x4ce63a[_0xb1c2('0x33')]=_['keys'](db[_0xb1c2('0x4c')][_0xb1c2('0x30')]);_0x4ce63a['query']=_[_0xb1c2('0x44')](_0x2a683f[_0xb1c2('0x34')]);_0x4ce63a[_0xb1c2('0x35')]=_['intersection'](_0x4ce63a[_0xb1c2('0x33')],_0x4ce63a[_0xb1c2('0x34')]);_0x2d0fba[_0xb1c2('0x36')]=_[_0xb1c2('0x37')](_0x4ce63a[_0xb1c2('0x33')],qs[_0xb1c2('0x38')](_0x2a683f[_0xb1c2('0x34')][_0xb1c2('0x38')]));_0x2d0fba[_0xb1c2('0x36')]=_0x2d0fba[_0xb1c2('0x36')][_0xb1c2('0x39')]?_0x2d0fba[_0xb1c2('0x36')]:_0x4ce63a[_0xb1c2('0x33')];_0x2d0fba[_0xb1c2('0x4d')]=qs[_0xb1c2('0x3c')](_0x2a683f[_0xb1c2('0x34')][_0xb1c2('0x3c')]);_0x2d0fba[_0xb1c2('0x3d')]=qs[_0xb1c2('0x35')](_[_0xb1c2('0x4e')](_0x2a683f[_0xb1c2('0x34')],_0x4ce63a[_0xb1c2('0x35')]));if(_0x2a683f[_0xb1c2('0x34')][_0xb1c2('0x3e')]){_0x2d0fba[_0xb1c2('0x3d')]=_[_0xb1c2('0x3f')](_0x2d0fba[_0xb1c2('0x3d')],{'$or':_[_0xb1c2('0x2f')](_0x2d0fba[_0xb1c2('0x36')],function(_0x51df01){var _0x3e503a={};_0x3e503a[_0x51df01]={'$like':'%'+_0x2a683f[_0xb1c2('0x34')][_0xb1c2('0x3e')]+'%'};return _0x3e503a;})});}_0x2d0fba=_['merge']({},_0x2d0fba,_0x2a683f['options']);return _0x166d1e[_0xb1c2('0x50')](_0x2d0fba);}})[_0xb1c2('0x27')](function(_0x3adaf3){if(_0x3adaf3){_0x43eceb=_0x3adaf3[_0xb1c2('0x39')];if(!_0x2a683f[_0xb1c2('0x34')]['hasOwnProperty']('nolimit')){_0x2d0fba[_0xb1c2('0x1e')]=qs[_0xb1c2('0x1e')](_0x2a683f[_0xb1c2('0x34')][_0xb1c2('0x1e')]);_0x2d0fba['offset']=qs[_0xb1c2('0x1c')](_0x2a683f[_0xb1c2('0x34')][_0xb1c2('0x1c')]);}return _0x166d1e[_0xb1c2('0x50')](_0x2d0fba);}})[_0xb1c2('0x27')](function(_0x510d11){if(_0x510d11){return _0x510d11?{'count':_0x43eceb,'rows':_0x510d11}:null;}})['then'](respondWithResult(_0x148f11,null))[_0xb1c2('0x43')](handleError(_0x148f11,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5cf987d..5be145d 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 _0x14e5=['../../config/environment','./intZohoConfiguration.attributes','define','lodash','api','moment','bluebird','rimraf'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x14e5,0xbb));var _0x514e=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x14e5[_0xd67723];return _0x53b62b;};'use strict';var _=require(_0x514e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x514e('0x1'));var moment=require(_0x514e('0x2'));var BPromise=require(_0x514e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x514e('0x4'));var config=require(_0x514e('0x5'));var attributes=require(_0x514e('0x6'));module['exports']=function(_0x3ee6f2,_0x5a3dc6){return _0x3ee6f2[_0x514e('0x7')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x183e=['../../config/environment','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x183e,0x112));var _0xe183=function(_0x3d94c2,_0x5efd47){_0x3d94c2=_0x3d94c2-0x0;var _0x2b358a=_0x183e[_0x3d94c2];return _0x2b358a;};'use strict';var _=require('lodash');var util=require(_0xe183('0x0'));var logger=require(_0xe183('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe183('0x2'));var rp=require(_0xe183('0x3'));var fs=require('fs');var path=require(_0xe183('0x4'));var rimraf=require(_0xe183('0x5'));var config=require(_0xe183('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x40d2f3,_0xd9dd09){return _0x40d2f3[_0xe183('0x7')](_0xe183('0x8'),attributes,{'tableName':_0xe183('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index f462490..810f05a 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 _0x8ec6=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x8ec6,0xe1));var _0x68ec=function(_0x30495f,_0x386f8f){_0x30495f=_0x30495f-0x0;var _0x442e18=_0x8ec6[_0x30495f];return _0x442e18;};'use strict';var _=require('lodash');var util=require(_0x68ec('0x0'));var moment=require(_0x68ec('0x1'));var BPromise=require(_0x68ec('0x2'));var rs=require(_0x68ec('0x3'));var fs=require('fs');var Redis=require(_0x68ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x68ec('0x5'));var logger=require(_0x68ec('0x6'))('rpc');var config=require(_0x68ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x68ec('0x8')][_0x68ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x242e2b,_0x3e0e91,_0x203ba9){return new BPromise(function(_0x2f77e0,_0x1d76e9){return client[_0x68ec('0xa')](_0x242e2b,_0x203ba9)[_0x68ec('0xb')](function(_0x3b720f){logger[_0x68ec('0xc')](_0x68ec('0xd'),_0x3e0e91,_0x68ec('0xe'));logger[_0x68ec('0xf')](_0x68ec('0x10'),_0x3e0e91,_0x68ec('0xe'),JSON['stringify'](_0x3b720f));if(_0x3b720f['error']){if(_0x3b720f[_0x68ec('0x11')][_0x68ec('0x12')]===0x1f4){logger[_0x68ec('0x11')](_0x68ec('0xd'),_0x3e0e91,_0x3b720f['error'][_0x68ec('0x13')]);return _0x1d76e9(_0x3b720f[_0x68ec('0x11')][_0x68ec('0x13')]);}logger[_0x68ec('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3e0e91,_0x3b720f[_0x68ec('0x11')]['message']);return _0x2f77e0(_0x3b720f[_0x68ec('0x11')]['message']);}else{logger['info'](_0x68ec('0xd'),_0x3e0e91,_0x68ec('0xe'));_0x2f77e0(_0x3b720f[_0x68ec('0x14')][_0x68ec('0x13')]);}})[_0x68ec('0x15')](function(_0x13ca09){logger[_0x68ec('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3e0e91,_0x13ca09);_0x1d76e9(_0x13ca09);});});} \ No newline at end of file +var _0xc2d6=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment'];(function(_0x5eabbc,_0x4301cb){var _0x4bb29=function(_0x2420f7){while(--_0x2420f7){_0x5eabbc['push'](_0x5eabbc['shift']());}};_0x4bb29(++_0x4301cb);}(_0xc2d6,0x10e));var _0x6c2d=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xc2d6[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x6c2d('0x0'));var util=require(_0x6c2d('0x1'));var moment=require(_0x6c2d('0x2'));var BPromise=require(_0x6c2d('0x3'));var rs=require(_0x6c2d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c2d('0x5'))['db'];var utils=require(_0x6c2d('0x6'));var logger=require('../../config/logger')(_0x6c2d('0x7'));var config=require(_0x6c2d('0x8'));var jayson=require(_0x6c2d('0x9'));var client=jayson['client'][_0x6c2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c392e,_0x1a5db0,_0x3d9703){return new BPromise(function(_0x4f850a,_0x23d4ee){return client['request'](_0x1c392e,_0x3d9703)[_0x6c2d('0xb')](function(_0x169385){logger[_0x6c2d('0xc')](_0x6c2d('0xd'),_0x1a5db0,_0x6c2d('0xe'));logger[_0x6c2d('0xf')](_0x6c2d('0x10'),_0x1a5db0,_0x6c2d('0xe'),JSON['stringify'](_0x169385));if(_0x169385[_0x6c2d('0x11')]){if(_0x169385[_0x6c2d('0x11')][_0x6c2d('0x12')]===0x1f4){logger['error'](_0x6c2d('0xd'),_0x1a5db0,_0x169385[_0x6c2d('0x11')][_0x6c2d('0x13')]);return _0x23d4ee(_0x169385['error'][_0x6c2d('0x13')]);}logger[_0x6c2d('0x11')](_0x6c2d('0xd'),_0x1a5db0,_0x169385['error'][_0x6c2d('0x13')]);return _0x4f850a(_0x169385['error'][_0x6c2d('0x13')]);}else{logger[_0x6c2d('0xc')](_0x6c2d('0xd'),_0x1a5db0,_0x6c2d('0xe'));_0x4f850a(_0x169385['result'][_0x6c2d('0x13')]);}})[_0x6c2d('0x14')](function(_0x354752){logger[_0x6c2d('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a5db0,_0x354752);_0x23d4ee(_0x354752);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5c6c70a..1413607 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 _0x4652=['post','put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0x4652,0x115));var _0x2465=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4652[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x2465('0x0'));var util=require(_0x2465('0x1'));var path=require(_0x2465('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2465('0x3'));var auth=require(_0x2465('0x4'));var interaction=require(_0x2465('0x5'));var config=require(_0x2465('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x2465('0x7')](),controller[_0x2465('0x8')]);router['get'](_0x2465('0x9'),auth['isAuthenticated'](),controller[_0x2465('0xa')]);router[_0x2465('0xb')]('/',auth[_0x2465('0x7')](),controller['create']);router[_0x2465('0xc')](_0x2465('0x9'),auth[_0x2465('0x7')](),controller[_0x2465('0xd')]);router[_0x2465('0xe')](_0x2465('0x9'),auth[_0x2465('0x7')](),controller['destroy']);module[_0x2465('0xf')]=router; \ No newline at end of file +var _0x7467=['express','Router','fs-extra','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0xc2c0c3,_0x2bf8a9){var _0x292acf=function(_0x192b73){while(--_0x192b73){_0xc2c0c3['push'](_0xc2c0c3['shift']());}};_0x292acf(++_0x2bf8a9);}(_0x7467,0x12c));var _0x7746=function(_0x2135a1,_0x400b3a){_0x2135a1=_0x2135a1-0x0;var _0x2f5dd9=_0x7467[_0x2135a1];return _0x2f5dd9;};'use strict';var multer=require(_0x7746('0x0'));var util=require(_0x7746('0x1'));var path=require(_0x7746('0x2'));var timeout=require(_0x7746('0x3'));var express=require(_0x7746('0x4'));var router=express[_0x7746('0x5')]();var fs_extra=require(_0x7746('0x6'));var auth=require(_0x7746('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7746('0x8'));router[_0x7746('0x9')]('/',auth[_0x7746('0xa')](),controller[_0x7746('0xb')]);router[_0x7746('0x9')](_0x7746('0xc'),auth['isAuthenticated'](),controller[_0x7746('0xd')]);router[_0x7746('0xe')]('/',auth[_0x7746('0xa')](),controller['create']);router[_0x7746('0xf')](_0x7746('0xc'),auth[_0x7746('0xa')](),controller[_0x7746('0x10')]);router[_0x7746('0x11')](_0x7746('0xc'),auth[_0x7746('0xa')](),controller['destroy']);module[_0x7746('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 969d72e..fc119c3 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 _0x262e=['exports','ENUM','string','variable','keyValue','picklist','customVariable','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x262e,0x7e));var _0xe262=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x262e[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0xe262('0x0')]={'type':{'type':Sequelize[_0xe262('0x1')](_0xe262('0x2'),_0xe262('0x3'),'customVariable',_0xe262('0x4'),_0xe262('0x5')),'defaultValue':_0xe262('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe262('0x1')](_0xe262('0x2'),_0xe262('0x3'),_0xe262('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe262('0x7')]},'nameField':{'type':Sequelize[_0xe262('0x7')]},'customField':{'type':Sequelize[_0xe262('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x921e=['ENUM','STRING','BOOLEAN','exports','string','variable','customVariable'];(function(_0x2b0471,_0x300519){var _0x34d9d6=function(_0x790de8){while(--_0x790de8){_0x2b0471['push'](_0x2b0471['shift']());}};_0x34d9d6(++_0x300519);}(_0x921e,0x8f));var _0xe921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x921e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe921('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe921('0x1'),_0xe921('0x2'),_0xe921('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe921('0x4')](_0xe921('0x1'),'variable',_0xe921('0x3'))},'keyContent':{'type':Sequelize[_0xe921('0x5')]},'idField':{'type':Sequelize[_0xe921('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe921('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8f6f455..050b49d 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 _0xcdf6=['then','error','name','send','index','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save'];(function(_0x376393,_0x3dedf4){var _0x425113=function(_0x551741){while(--_0x551741){_0x376393['push'](_0x376393['shift']());}};_0x425113(++_0x3dedf4);}(_0xcdf6,0xb3));var _0x6cdf=function(_0x493afb,_0x100168){_0x493afb=_0x493afb-0x0;var _0x2edcb4=_0xcdf6[_0x493afb];return _0x2edcb4;};'use strict';var emlformat=require(_0x6cdf('0x0'));var rimraf=require(_0x6cdf('0x1'));var zipdir=require(_0x6cdf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cdf('0x3'));var moment=require(_0x6cdf('0x4'));var BPromise=require(_0x6cdf('0x5'));var Mustache=require(_0x6cdf('0x6'));var util=require(_0x6cdf('0x7'));var path=require(_0x6cdf('0x8'));var sox=require(_0x6cdf('0x9'));var csv=require(_0x6cdf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cdf('0xb'));var _=require(_0x6cdf('0xc'));var squel=require(_0x6cdf('0xd'));var crypto=require('crypto');var jsforce=require(_0x6cdf('0xe'));var deskjs=require(_0x6cdf('0xf'));var toCsv=require(_0x6cdf('0xa'));var querystring=require('querystring');var Papa=require(_0x6cdf('0x10'));var Redis=require(_0x6cdf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6cdf('0x12'));var as=require(_0x6cdf('0x13'));var hardwareService=require(_0x6cdf('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6cdf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6cdf('0x16'));var db=require(_0x6cdf('0x17'))['db'];function respondWithStatusCode(_0xd318eb,_0x3f0cb8){_0x3f0cb8=_0x3f0cb8||0xcc;return function(_0x3a9a5a){if(_0x3a9a5a){return _0xd318eb[_0x6cdf('0x18')](_0x3f0cb8);}return _0xd318eb['status'](_0x3f0cb8)[_0x6cdf('0x19')]();};}function respondWithResult(_0x33cb4b,_0x21c019){_0x21c019=_0x21c019||0xc8;return function(_0x35d617){if(_0x35d617){return _0x33cb4b['status'](_0x21c019)[_0x6cdf('0x1a')](_0x35d617);}};}function respondWithFilteredResult(_0x12eb41,_0x595049){return function(_0x23ae66){if(_0x23ae66){var _0x25f04c=typeof _0x595049['offset']===_0x6cdf('0x1b')&&typeof _0x595049[_0x6cdf('0x1c')]===_0x6cdf('0x1b');var _0x3e3c4c=_0x23ae66[_0x6cdf('0x1d')];var _0x2383e4=_0x25f04c?0x0:_0x595049[_0x6cdf('0x1e')];var _0x32bfdf=_0x25f04c?_0x23ae66[_0x6cdf('0x1d')]:_0x595049[_0x6cdf('0x1e')]+_0x595049['limit'];var _0x343ea4;if(_0x32bfdf>=_0x3e3c4c){_0x32bfdf=_0x3e3c4c;_0x343ea4=0xc8;}else{_0x343ea4=0xce;}_0x12eb41[_0x6cdf('0x1f')](_0x343ea4);return _0x12eb41[_0x6cdf('0x20')](_0x6cdf('0x21'),_0x2383e4+'-'+_0x32bfdf+'/'+_0x3e3c4c)[_0x6cdf('0x1a')](_0x23ae66);}return null;};}function patchUpdates(_0x3c2fc5){return function(_0x54ce29){try{jsonpatch[_0x6cdf('0x22')](_0x54ce29,_0x3c2fc5,!![]);}catch(_0x341b62){return BPromise[_0x6cdf('0x23')](_0x341b62);}return _0x54ce29[_0x6cdf('0x24')]();};}function saveUpdates(_0x465a04,_0x5a973a){return function(_0x2991e7){if(_0x2991e7){return _0x2991e7['update'](_0x465a04)[_0x6cdf('0x25')](function(_0x1ea9c5){return _0x1ea9c5;});}return null;};}function removeEntity(_0x5e3f42,_0x1e923c){return function(_0x4d7ab7){if(_0x4d7ab7){return _0x4d7ab7['destroy']()[_0x6cdf('0x25')](function(){_0x5e3f42[_0x6cdf('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e1421,_0x41e8ef){return function(_0x1aa315){if(!_0x1aa315){_0x5e1421[_0x6cdf('0x18')](0x194);}return _0x1aa315;};}function handleError(_0x42bcdf,_0x4b296a){_0x4b296a=_0x4b296a||0x1f4;return function(_0x5a6451){logger[_0x6cdf('0x26')](_0x5a6451['stack']);if(_0x5a6451[_0x6cdf('0x27')]){delete _0x5a6451[_0x6cdf('0x27')];}_0x42bcdf[_0x6cdf('0x1f')](_0x4b296a)[_0x6cdf('0x28')](_0x5a6451);};}exports[_0x6cdf('0x29')]=function(_0x271ae8,_0x466100){var _0x1b7a14={},_0x726db6={},_0x42aa74={'count':0x0,'rows':[]};var _0x1329a2=_[_0x6cdf('0x2a')](db[_0x6cdf('0x2b')][_0x6cdf('0x2c')],function(_0xacdc06){return{'name':_0xacdc06[_0x6cdf('0x2d')],'type':_0xacdc06['type'][_0x6cdf('0x2e')]};});_0x726db6[_0x6cdf('0x2f')]=_[_0x6cdf('0x2a')](_0x1329a2,'name');_0x726db6[_0x6cdf('0x30')]=_[_0x6cdf('0x31')](_0x271ae8[_0x6cdf('0x30')]);_0x726db6[_0x6cdf('0x32')]=_['intersection'](_0x726db6[_0x6cdf('0x2f')],_0x726db6[_0x6cdf('0x30')]);_0x1b7a14[_0x6cdf('0x33')]=_[_0x6cdf('0x34')](_0x726db6[_0x6cdf('0x2f')],qs[_0x6cdf('0x35')](_0x271ae8[_0x6cdf('0x30')][_0x6cdf('0x35')]));_0x1b7a14[_0x6cdf('0x33')]=_0x1b7a14[_0x6cdf('0x33')]['length']?_0x1b7a14[_0x6cdf('0x33')]:_0x726db6[_0x6cdf('0x2f')];if(!_0x271ae8[_0x6cdf('0x30')][_0x6cdf('0x36')]('nolimit')){_0x1b7a14[_0x6cdf('0x1c')]=qs['limit'](_0x271ae8[_0x6cdf('0x30')]['limit']);_0x1b7a14[_0x6cdf('0x1e')]=qs[_0x6cdf('0x1e')](_0x271ae8[_0x6cdf('0x30')]['offset']);}_0x1b7a14['order']=qs['sort'](_0x271ae8['query']['sort']);_0x1b7a14[_0x6cdf('0x37')]=qs[_0x6cdf('0x32')](_[_0x6cdf('0x38')](_0x271ae8[_0x6cdf('0x30')],_0x726db6[_0x6cdf('0x32')]),_0x1329a2);if(_0x271ae8['query'][_0x6cdf('0x39')]){_0x1b7a14[_0x6cdf('0x37')]=_[_0x6cdf('0x3a')](_0x1b7a14[_0x6cdf('0x37')],{'$or':_[_0x6cdf('0x2a')](_0x1329a2,function(_0x2e5b84){if(_0x2e5b84[_0x6cdf('0x3b')]!==_0x6cdf('0x3c')){var _0x327593={};_0x327593[_0x2e5b84[_0x6cdf('0x27')]]={'$like':'%'+_0x271ae8[_0x6cdf('0x30')]['filter']+'%'};return _0x327593;}})});}_0x1b7a14=_[_0x6cdf('0x3a')]({},_0x1b7a14,_0x271ae8[_0x6cdf('0x3d')]);var _0x14211b={'where':_0x1b7a14[_0x6cdf('0x37')]};return db['ZohoField'][_0x6cdf('0x1d')](_0x14211b)[_0x6cdf('0x25')](function(_0x261443){_0x42aa74[_0x6cdf('0x1d')]=_0x261443;if(_0x271ae8[_0x6cdf('0x30')][_0x6cdf('0x3e')]){_0x1b7a14[_0x6cdf('0x3f')]=[{'all':!![]}];}return db[_0x6cdf('0x2b')][_0x6cdf('0x40')](_0x1b7a14);})[_0x6cdf('0x25')](function(_0x252df0){_0x42aa74[_0x6cdf('0x41')]=_0x252df0;return _0x42aa74;})[_0x6cdf('0x25')](respondWithFilteredResult(_0x466100,_0x1b7a14))[_0x6cdf('0x42')](handleError(_0x466100,null));};exports['show']=function(_0x3dfc75,_0x81d5e7){var _0x1f9ad5={'raw':!![],'where':{'id':_0x3dfc75[_0x6cdf('0x43')]['id']}},_0x3b26bc={};_0x3b26bc[_0x6cdf('0x2f')]=_['keys'](db[_0x6cdf('0x2b')][_0x6cdf('0x2c')]);_0x3b26bc[_0x6cdf('0x30')]=_['keys'](_0x3dfc75[_0x6cdf('0x30')]);_0x3b26bc[_0x6cdf('0x32')]=_[_0x6cdf('0x34')](_0x3b26bc[_0x6cdf('0x2f')],_0x3b26bc[_0x6cdf('0x30')]);_0x1f9ad5[_0x6cdf('0x33')]=_[_0x6cdf('0x34')](_0x3b26bc[_0x6cdf('0x2f')],qs[_0x6cdf('0x35')](_0x3dfc75['query'][_0x6cdf('0x35')]));_0x1f9ad5['attributes']=_0x1f9ad5[_0x6cdf('0x33')]['length']?_0x1f9ad5['attributes']:_0x3b26bc[_0x6cdf('0x2f')];if(_0x3dfc75['query']['includeAll']){_0x1f9ad5['include']=[{'all':!![]}];}_0x1f9ad5=_[_0x6cdf('0x3a')]({},_0x1f9ad5,_0x3dfc75[_0x6cdf('0x3d')]);return db[_0x6cdf('0x2b')][_0x6cdf('0x44')](_0x1f9ad5)['then'](handleEntityNotFound(_0x81d5e7,null))['then'](respondWithResult(_0x81d5e7,null))[_0x6cdf('0x42')](handleError(_0x81d5e7,null));};exports[_0x6cdf('0x45')]=function(_0x283149,_0xeaa4f7){return db[_0x6cdf('0x2b')][_0x6cdf('0x45')](_0x283149[_0x6cdf('0x46')],{})[_0x6cdf('0x25')](respondWithResult(_0xeaa4f7,0xc9))[_0x6cdf('0x42')](handleError(_0xeaa4f7,null));};exports[_0x6cdf('0x47')]=function(_0x23d5cb,_0x487b77){if(_0x23d5cb[_0x6cdf('0x46')]['id']){delete _0x23d5cb['body']['id'];}return db[_0x6cdf('0x2b')][_0x6cdf('0x44')]({'where':{'id':_0x23d5cb[_0x6cdf('0x43')]['id']}})[_0x6cdf('0x25')](handleEntityNotFound(_0x487b77,null))[_0x6cdf('0x25')](saveUpdates(_0x23d5cb[_0x6cdf('0x46')],null))[_0x6cdf('0x25')](respondWithResult(_0x487b77,null))['catch'](handleError(_0x487b77,null));};exports['destroy']=function(_0x3278dd,_0x1d22f3){return db['ZohoField'][_0x6cdf('0x44')]({'where':{'id':_0x3278dd[_0x6cdf('0x43')]['id']}})[_0x6cdf('0x25')](handleEntityNotFound(_0x1d22f3,null))[_0x6cdf('0x25')](removeEntity(_0x1d22f3,null))['catch'](handleError(_0x1d22f3,null));}; \ No newline at end of file +var _0xb40d=['set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','show','rawAttributes','includeAll','catch','create','body','find','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count'];(function(_0x338981,_0x4e2120){var _0xc8acbb=function(_0x5d1e29){while(--_0x5d1e29){_0x338981['push'](_0x338981['shift']());}};_0xc8acbb(++_0x4e2120);}(_0xb40d,0xc8));var _0xdb40=function(_0x5ca5ef,_0x5bf617){_0x5ca5ef=_0x5ca5ef-0x0;var _0x33c41d=_0xb40d[_0x5ca5ef];return _0x33c41d;};'use strict';var emlformat=require(_0xdb40('0x0'));var rimraf=require(_0xdb40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb40('0x2'));var rp=require(_0xdb40('0x3'));var moment=require(_0xdb40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb40('0x5'));var util=require('util');var path=require(_0xdb40('0x6'));var sox=require(_0xdb40('0x7'));var csv=require('to-csv');var ejs=require(_0xdb40('0x8'));var fs=require('fs');var fs_extra=require(_0xdb40('0x9'));var _=require(_0xdb40('0xa'));var squel=require(_0xdb40('0xb'));var crypto=require(_0xdb40('0xc'));var jsforce=require(_0xdb40('0xd'));var deskjs=require(_0xdb40('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdb40('0xf'));var Papa=require('papaparse');var Redis=require(_0xdb40('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdb40('0x11'));var as=require(_0xdb40('0x12'));var hardwareService=require(_0xdb40('0x13'));var logger=require(_0xdb40('0x14'))(_0xdb40('0x15'));var utils=require(_0xdb40('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb40('0x17'));var db=require(_0xdb40('0x18'))['db'];function respondWithStatusCode(_0x377a50,_0x5131fa){_0x5131fa=_0x5131fa||0xcc;return function(_0x21d17a){if(_0x21d17a){return _0x377a50[_0xdb40('0x19')](_0x5131fa);}return _0x377a50[_0xdb40('0x1a')](_0x5131fa)['end']();};}function respondWithResult(_0x39606d,_0x146767){_0x146767=_0x146767||0xc8;return function(_0xe8d9eb){if(_0xe8d9eb){return _0x39606d[_0xdb40('0x1a')](_0x146767)['json'](_0xe8d9eb);}};}function respondWithFilteredResult(_0x3ab6d4,_0x129ce3){return function(_0x42cb01){if(_0x42cb01){var _0x1238a4=typeof _0x129ce3[_0xdb40('0x1b')]===_0xdb40('0x1c')&&typeof _0x129ce3[_0xdb40('0x1d')]===_0xdb40('0x1c');var _0x557af8=_0x42cb01[_0xdb40('0x1e')];var _0xc37d23=_0x1238a4?0x0:_0x129ce3[_0xdb40('0x1b')];var _0x10fed0=_0x1238a4?_0x42cb01[_0xdb40('0x1e')]:_0x129ce3[_0xdb40('0x1b')]+_0x129ce3['limit'];var _0x37df11;if(_0x10fed0>=_0x557af8){_0x10fed0=_0x557af8;_0x37df11=0xc8;}else{_0x37df11=0xce;}_0x3ab6d4[_0xdb40('0x1a')](_0x37df11);return _0x3ab6d4[_0xdb40('0x1f')](_0xdb40('0x20'),_0xc37d23+'-'+_0x10fed0+'/'+_0x557af8)[_0xdb40('0x21')](_0x42cb01);}return null;};}function patchUpdates(_0x84b2ef){return function(_0x112af0){try{jsonpatch[_0xdb40('0x22')](_0x112af0,_0x84b2ef,!![]);}catch(_0x1ee380){return BPromise[_0xdb40('0x23')](_0x1ee380);}return _0x112af0[_0xdb40('0x24')]();};}function saveUpdates(_0x34473c,_0xc2d589){return function(_0x8b50a4){if(_0x8b50a4){return _0x8b50a4[_0xdb40('0x25')](_0x34473c)['then'](function(_0x384f6e){return _0x384f6e;});}return null;};}function removeEntity(_0xa0ca39,_0xad453){return function(_0x2e7333){if(_0x2e7333){return _0x2e7333['destroy']()[_0xdb40('0x26')](function(){_0xa0ca39['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17a409,_0x48ce42){return function(_0x2d4437){if(!_0x2d4437){_0x17a409[_0xdb40('0x19')](0x194);}return _0x2d4437;};}function handleError(_0x1e11b4,_0x3f5973){_0x3f5973=_0x3f5973||0x1f4;return function(_0x1e5936){logger[_0xdb40('0x27')](_0x1e5936[_0xdb40('0x28')]);if(_0x1e5936[_0xdb40('0x29')]){delete _0x1e5936[_0xdb40('0x29')];}_0x1e11b4[_0xdb40('0x1a')](_0x3f5973)[_0xdb40('0x2a')](_0x1e5936);};}exports[_0xdb40('0x2b')]=function(_0x4e9c5c,_0x597ba9){var _0x580fcf={},_0x14f195={},_0x3c9393={'count':0x0,'rows':[]};var _0x5b8450=_[_0xdb40('0x2c')](db[_0xdb40('0x2d')]['rawAttributes'],function(_0x1dd2b8){return{'name':_0x1dd2b8[_0xdb40('0x2e')],'type':_0x1dd2b8[_0xdb40('0x2f')][_0xdb40('0x30')]};});_0x14f195[_0xdb40('0x31')]=_[_0xdb40('0x2c')](_0x5b8450,_0xdb40('0x29'));_0x14f195[_0xdb40('0x32')]=_[_0xdb40('0x33')](_0x4e9c5c[_0xdb40('0x32')]);_0x14f195[_0xdb40('0x34')]=_['intersection'](_0x14f195[_0xdb40('0x31')],_0x14f195[_0xdb40('0x32')]);_0x580fcf['attributes']=_[_0xdb40('0x35')](_0x14f195['model'],qs[_0xdb40('0x36')](_0x4e9c5c[_0xdb40('0x32')][_0xdb40('0x36')]));_0x580fcf[_0xdb40('0x37')]=_0x580fcf[_0xdb40('0x37')][_0xdb40('0x38')]?_0x580fcf['attributes']:_0x14f195[_0xdb40('0x31')];if(!_0x4e9c5c[_0xdb40('0x32')][_0xdb40('0x39')](_0xdb40('0x3a'))){_0x580fcf[_0xdb40('0x1d')]=qs[_0xdb40('0x1d')](_0x4e9c5c[_0xdb40('0x32')][_0xdb40('0x1d')]);_0x580fcf[_0xdb40('0x1b')]=qs['offset'](_0x4e9c5c[_0xdb40('0x32')]['offset']);}_0x580fcf['order']=qs[_0xdb40('0x3b')](_0x4e9c5c['query'][_0xdb40('0x3b')]);_0x580fcf['where']=qs[_0xdb40('0x34')](_[_0xdb40('0x3c')](_0x4e9c5c[_0xdb40('0x32')],_0x14f195['filters']),_0x5b8450);if(_0x4e9c5c[_0xdb40('0x32')]['filter']){_0x580fcf[_0xdb40('0x3d')]=_['merge'](_0x580fcf[_0xdb40('0x3d')],{'$or':_[_0xdb40('0x2c')](_0x5b8450,function(_0x5c1724){if(_0x5c1724[_0xdb40('0x2f')]!==_0xdb40('0x3e')){var _0x3abc29={};_0x3abc29[_0x5c1724['name']]={'$like':'%'+_0x4e9c5c[_0xdb40('0x32')][_0xdb40('0x3f')]+'%'};return _0x3abc29;}})});}_0x580fcf=_[_0xdb40('0x40')]({},_0x580fcf,_0x4e9c5c[_0xdb40('0x41')]);var _0x22a291={'where':_0x580fcf[_0xdb40('0x3d')]};return db[_0xdb40('0x2d')][_0xdb40('0x1e')](_0x22a291)['then'](function(_0x4d629d){_0x3c9393[_0xdb40('0x1e')]=_0x4d629d;if(_0x4e9c5c[_0xdb40('0x32')]['includeAll']){_0x580fcf[_0xdb40('0x42')]=[{'all':!![]}];}return db['ZohoField'][_0xdb40('0x43')](_0x580fcf);})[_0xdb40('0x26')](function(_0x55144f){_0x3c9393['rows']=_0x55144f;return _0x3c9393;})['then'](respondWithFilteredResult(_0x597ba9,_0x580fcf))['catch'](handleError(_0x597ba9,null));};exports[_0xdb40('0x44')]=function(_0x507451,_0x72cd55){var _0x42dd60={'raw':!![],'where':{'id':_0x507451['params']['id']}},_0x17ac05={};_0x17ac05['model']=_['keys'](db['ZohoField'][_0xdb40('0x45')]);_0x17ac05[_0xdb40('0x32')]=_[_0xdb40('0x33')](_0x507451['query']);_0x17ac05[_0xdb40('0x34')]=_[_0xdb40('0x35')](_0x17ac05['model'],_0x17ac05[_0xdb40('0x32')]);_0x42dd60[_0xdb40('0x37')]=_[_0xdb40('0x35')](_0x17ac05['model'],qs['fields'](_0x507451[_0xdb40('0x32')]['fields']));_0x42dd60[_0xdb40('0x37')]=_0x42dd60[_0xdb40('0x37')][_0xdb40('0x38')]?_0x42dd60['attributes']:_0x17ac05['model'];if(_0x507451[_0xdb40('0x32')][_0xdb40('0x46')]){_0x42dd60[_0xdb40('0x42')]=[{'all':!![]}];}_0x42dd60=_['merge']({},_0x42dd60,_0x507451[_0xdb40('0x41')]);return db[_0xdb40('0x2d')]['find'](_0x42dd60)[_0xdb40('0x26')](handleEntityNotFound(_0x72cd55,null))['then'](respondWithResult(_0x72cd55,null))[_0xdb40('0x47')](handleError(_0x72cd55,null));};exports[_0xdb40('0x48')]=function(_0x58b62e,_0x25680f){return db[_0xdb40('0x2d')]['create'](_0x58b62e['body'],{})[_0xdb40('0x26')](respondWithResult(_0x25680f,0xc9))[_0xdb40('0x47')](handleError(_0x25680f,null));};exports[_0xdb40('0x25')]=function(_0x239227,_0xbc7488){if(_0x239227['body']['id']){delete _0x239227[_0xdb40('0x49')]['id'];}return db[_0xdb40('0x2d')][_0xdb40('0x4a')]({'where':{'id':_0x239227[_0xdb40('0x4b')]['id']}})[_0xdb40('0x26')](handleEntityNotFound(_0xbc7488,null))[_0xdb40('0x26')](saveUpdates(_0x239227[_0xdb40('0x49')],null))['then'](respondWithResult(_0xbc7488,null))[_0xdb40('0x47')](handleError(_0xbc7488,null));};exports[_0xdb40('0x4c')]=function(_0x48d45a,_0x1ddd61){return db[_0xdb40('0x2d')][_0xdb40('0x4a')]({'where':{'id':_0x48d45a[_0xdb40('0x4b')]['id']}})[_0xdb40('0x26')](handleEntityNotFound(_0x1ddd61,null))[_0xdb40('0x26')](removeEntity(_0x1ddd61,null))[_0xdb40('0x47')](handleError(_0x1ddd61,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b84d7ef..b20b5ed 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 _0xbff5=['request-promise','rimraf','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3c6e16,_0x1479c3){var _0x1a831e=function(_0x3e5884){while(--_0x3e5884){_0x3c6e16['push'](_0x3c6e16['shift']());}};_0x1a831e(++_0x1479c3);}(_0xbff5,0x1bc));var _0x5bff=function(_0x68f18,_0x435334){_0x68f18=_0x68f18-0x0;var _0x110043=_0xbff5[_0x68f18];return _0x110043;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x5bff('0x8')]=function(_0x1d8650,_0x151add){return _0x1d8650[_0x5bff('0x9')](_0x5bff('0xa'),attributes,{'tableName':_0x5bff('0xb'),'paranoid':![],'indexes':[{'name':_0x5bff('0xc'),'fields':[_0x5bff('0xd'),_0x5bff('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['bluebird','request-promise','path','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x20741b,_0x26ec9b){var _0x4ba16a=function(_0x48eba4){while(--_0x48eba4){_0x20741b['push'](_0x20741b['shift']());}};_0x4ba16a(++_0x26ec9b);}(_0xafc4,0x69));var _0x4afc=function(_0x575327,_0x37d5d3){_0x575327=_0x575327-0x0;var _0x5e2aa2=_0xafc4[_0x575327];return _0x5e2aa2;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x4afc('0xa'),_0x4afc('0xb')],'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 7d713d6..06d47a2 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 _0xbe2b=['jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4ac1ab,_0xf103d3){var _0x2e652f=function(_0x518bf9){while(--_0x518bf9){_0x4ac1ab['push'](_0x4ac1ab['shift']());}};_0x2e652f(++_0xf103d3);}(_0xbe2b,0x109));var _0xbbe2=function(_0x45661a,_0x35a7b3){_0x45661a=_0x45661a-0x0;var _0x2516a3=_0xbe2b[_0x45661a];return _0x2516a3;};'use strict';var _=require(_0xbbe2('0x0'));var util=require(_0xbbe2('0x1'));var moment=require(_0xbbe2('0x2'));var BPromise=require(_0xbbe2('0x3'));var rs=require(_0xbbe2('0x4'));var fs=require('fs');var Redis=require(_0xbbe2('0x5'));var db=require(_0xbbe2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbe2('0x7'))(_0xbbe2('0x8'));var config=require(_0xbbe2('0x9'));var jayson=require(_0xbbe2('0xa'));var client=jayson[_0xbbe2('0xb')][_0xbbe2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x246746,_0x1c5581,_0x254e01){return new BPromise(function(_0x33f76f,_0x541314){return client[_0xbbe2('0xd')](_0x246746,_0x254e01)[_0xbbe2('0xe')](function(_0x3343f8){logger[_0xbbe2('0xf')]('ZohoField,\x20%s,\x20%s',_0x1c5581,'request\x20sent');logger['debug'](_0xbbe2('0x10'),_0x1c5581,_0xbbe2('0x11'),JSON[_0xbbe2('0x12')](_0x3343f8));if(_0x3343f8[_0xbbe2('0x13')]){if(_0x3343f8[_0xbbe2('0x13')][_0xbbe2('0x14')]===0x1f4){logger[_0xbbe2('0x13')]('ZohoField,\x20%s,\x20%s',_0x1c5581,_0x3343f8[_0xbbe2('0x13')][_0xbbe2('0x15')]);return _0x541314(_0x3343f8[_0xbbe2('0x13')][_0xbbe2('0x15')]);}logger[_0xbbe2('0x13')](_0xbbe2('0x16'),_0x1c5581,_0x3343f8[_0xbbe2('0x13')]['message']);return _0x33f76f(_0x3343f8[_0xbbe2('0x13')][_0xbbe2('0x15')]);}else{logger[_0xbbe2('0xf')](_0xbbe2('0x16'),_0x1c5581,'request\x20sent');_0x33f76f(_0x3343f8[_0xbbe2('0x17')][_0xbbe2('0x15')]);}})[_0xbbe2('0x18')](function(_0x142adb){logger[_0xbbe2('0x13')](_0xbbe2('0x16'),_0x1c5581,_0x142adb);_0x541314(_0x142adb);});});} \ No newline at end of file +var _0x72dc=['jayson/promise','client','http','request','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x72dc,0x19d));var _0xc72d=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x72dc[_0x609988];return _0x159984;};'use strict';var _=require('lodash');var util=require(_0xc72d('0x0'));var moment=require(_0xc72d('0x1'));var BPromise=require(_0xc72d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc72d('0x3'));var db=require(_0xc72d('0x4'))['db'];var utils=require(_0xc72d('0x5'));var logger=require('../../config/logger')(_0xc72d('0x6'));var config=require('../../config/environment');var jayson=require(_0xc72d('0x7'));var client=jayson[_0xc72d('0x8')][_0xc72d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29636d,_0x4baf4c,_0x20ce6b){return new BPromise(function(_0x3aa204,_0x35cadc){return client[_0xc72d('0xa')](_0x29636d,_0x20ce6b)['then'](function(_0xb3ee74){logger[_0xc72d('0xb')]('ZohoField,\x20%s,\x20%s',_0x4baf4c,_0xc72d('0xc'));logger[_0xc72d('0xd')](_0xc72d('0xe'),_0x4baf4c,_0xc72d('0xc'),JSON[_0xc72d('0xf')](_0xb3ee74));if(_0xb3ee74[_0xc72d('0x10')]){if(_0xb3ee74[_0xc72d('0x10')][_0xc72d('0x11')]===0x1f4){logger[_0xc72d('0x10')](_0xc72d('0x12'),_0x4baf4c,_0xb3ee74[_0xc72d('0x10')]['message']);return _0x35cadc(_0xb3ee74[_0xc72d('0x10')][_0xc72d('0x13')]);}logger[_0xc72d('0x10')](_0xc72d('0x12'),_0x4baf4c,_0xb3ee74[_0xc72d('0x10')][_0xc72d('0x13')]);return _0x3aa204(_0xb3ee74[_0xc72d('0x10')]['message']);}else{logger[_0xc72d('0xb')](_0xc72d('0x12'),_0x4baf4c,_0xc72d('0xc'));_0x3aa204(_0xb3ee74['result'][_0xc72d('0x13')]);}})[_0xc72d('0x14')](function(_0x548ab3){logger['error'](_0xc72d('0x12'),_0x4baf4c,_0x548ab3);_0x35cadc(_0x548ab3);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 56d5343..3084e19 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xc1f776,_0x492579){var _0x1a2a51=function(_0x592292){while(--_0x592292){_0xc1f776['push'](_0xc1f776['shift']());}};_0x1a2a51(++_0x492579);}(_0x70e0,0x17b));var _0x070e=function(_0x1a7f92,_0x87d36f){_0x1a7f92=_0x1a7f92-0x0;var _0xf91400=_0x70e0[_0x1a7f92];return _0xf91400;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4e8666,_0x1752b4){var _0x36aca7=function(_0x52c2be){while(--_0x52c2be){_0x4e8666['push'](_0x4e8666['shift']());}};_0x36aca7(++_0x1752b4);}(_0xedd9,0xfc));var _0x9edd=function(_0x123a36,_0x1f2dc6){_0x123a36=_0x123a36-0x0;var _0x4c2f89=_0xedd9[_0x123a36];return _0x4c2f89;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index e83f70f..4e718b9 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 _0x738f=['exports','STRING','unique_name_and_version','BOOLEAN','state','sequelize'];(function(_0x1badb1,_0x375ec6){var _0x260dae=function(_0x2f3bbc){while(--_0x2f3bbc){_0x1badb1['push'](_0x1badb1['shift']());}};_0x260dae(++_0x375ec6);}(_0x738f,0xc5));var _0xf738=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x738f[_0x5cbf0e];return _0x1c76f8;};'use strict';var Sequelize=require(_0xf738('0x0'));module[_0xf738('0x1')]={'name':{'type':Sequelize[_0xf738('0x2')],'allowNull':![],'unique':_0xf738('0x3')},'version':{'type':Sequelize[_0xf738('0x2')],'allowNull':![],'unique':_0xf738('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf738('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf738('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xf738('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xf738('0x2')],'unique':_0xf738('0x5')},'description':{'type':Sequelize[_0xf738('0x2')]},'title':{'type':Sequelize[_0xf738('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xf738('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x5047=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x256d19,_0x2c846b){var _0x202db8=function(_0xfd1d8c){while(--_0xfd1d8c){_0x256d19['push'](_0x256d19['shift']());}};_0x202db8(++_0x2c846b);}(_0x5047,0xe0));var _0x7504=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x5047[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x7504('0x0'));module[_0x7504('0x1')]={'name':{'type':Sequelize[_0x7504('0x2')],'allowNull':![],'unique':_0x7504('0x3')},'version':{'type':Sequelize[_0x7504('0x2')],'allowNull':![],'unique':_0x7504('0x3')},'main':{'type':Sequelize[_0x7504('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x7504('0x2')]},'path':{'type':Sequelize[_0x7504('0x2')]},'type':{'type':Sequelize[_0x7504('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x7504('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x7504('0x2')]},'logo':{'type':Sequelize[_0x7504('0x2')]},'state':{'type':Sequelize[_0x7504('0x2')],'unique':_0x7504('0x5')},'description':{'type':Sequelize[_0x7504('0x2')]},'title':{'type':Sequelize[_0x7504('0x2')]},'remoteUri':{'type':Sequelize[_0x7504('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ebda62c..6483f1e 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 _0x430c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2d8b49,_0x267614){var _0xf4cb7=function(_0x2990b2){while(--_0x2990b2){_0x2d8b49['push'](_0x2d8b49['shift']());}};_0xf4cb7(++_0x267614);}(_0x430c,0x1a1));var _0xc430=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x430c[_0xea35d1];return _0x1d7a7c;};'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 hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));}; \ No newline at end of file +var _0x4975=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','Integration','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xa4837d,_0x4b70c9){var _0x48a632=function(_0x4ee701){while(--_0x4ee701){_0xa4837d['push'](_0xa4837d['shift']());}};_0x48a632(++_0x4b70c9);}(_0x4975,0x86));var _0x5497=function(_0x44ba3d,_0x34beb6){_0x44ba3d=_0x44ba3d-0x0;var _0xe291c=_0x4975[_0x44ba3d];return _0xe291c;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['Integration']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['Integration'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 5a4a310..af10a7f 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 _0x44f1=['../../config/logger','api','moment','request-promise','rimraf','./integration.attributes','exports','define','Integration','lodash','util'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x44f1,0x1ed));var _0x144f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x44f1[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x144f('0x0'));var util=require(_0x144f('0x1'));var logger=require(_0x144f('0x2'))(_0x144f('0x3'));var moment=require(_0x144f('0x4'));var BPromise=require('bluebird');var rp=require(_0x144f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x144f('0x6'));var config=require('../../config/environment');var attributes=require(_0x144f('0x7'));module[_0x144f('0x8')]=function(_0x229290,_0x28bb32){return _0x229290[_0x144f('0x9')](_0x144f('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc614=['rimraf','../../config/environment','./integration.attributes','define','Integration','lodash','util','api','bluebird','request-promise'];(function(_0x36335f,_0x31f3f9){var _0x2fad63=function(_0x452ef2){while(--_0x452ef2){_0x36335f['push'](_0x36335f['shift']());}};_0x2fad63(++_0x31f3f9);}(_0xc614,0x1bd));var _0x4c61=function(_0x56b215,_0xbcdd3f){_0x56b215=_0x56b215-0x0;var _0x35f197=_0xc614[_0x56b215];return _0x35f197;};'use strict';var _=require(_0x4c61('0x0'));var util=require(_0x4c61('0x1'));var logger=require('../../config/logger')(_0x4c61('0x2'));var moment=require('moment');var BPromise=require(_0x4c61('0x3'));var rp=require(_0x4c61('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c61('0x5'));var config=require(_0x4c61('0x6'));var attributes=require(_0x4c61('0x7'));module['exports']=function(_0xd0e331,_0x51431e){return _0xd0e331[_0x4c61('0x8')](_0x4c61('0x9'),attributes,{'tableName':'integrations','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 1892b06..0ebc6b1 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x23418a,_0x51d59b){var _0x1b7eb2=function(_0x13f232){while(--_0x13f232){_0x23418a['push'](_0x23418a['shift']());}};_0x1b7eb2(++_0x51d59b);}(_0x1a85,0x178));var _0x51a8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x1a85[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x5922d1,_0x565b26){var _0x56915b=function(_0x1e0853){while(--_0x1e0853){_0x5922d1['push'](_0x5922d1['shift']());}};_0x56915b(++_0x565b26);}(_0xba34,0x119));var _0x4ba3=function(_0x3938ab,_0x45acc4){_0x3938ab=_0x3938ab-0x0;var _0x1a9fdb=_0xba34[_0x3938ab];return _0x1a9fdb;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 58da776..e80879f 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1dde79,_0x54378f){var _0x3ddd7e=function(_0x193257){while(--_0x193257){_0x1dde79['push'](_0x1dde79['shift']());}};_0x3ddd7e(++_0x54378f);}(_0x4975,0x86));var _0x5497=function(_0x1dc753,_0xf41a69){_0x1dc753=_0x1dc753-0x0;var _0x1a7ae0=_0x4975[_0x1dc753];return _0x1a7ae0;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x39e3d4,_0x543f41){var _0x574a00=function(_0x67c2c1){while(--_0x67c2c1){_0x39e3d4['push'](_0x39e3d4['shift']());}};_0x574a00(++_0x543f41);}(_0x7a54,0x106));var _0x47a5=function(_0x316eda,_0xe450d){_0x316eda=_0x316eda-0x0;var _0x39e1bd=_0x7a54[_0x316eda];return _0x39e1bd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 3252ae8..c2c50e8 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 _0x180d=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x180d,0xd3));var _0xd180=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x180d[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0xd180('0x0'));module[_0xd180('0x1')]={'integration':{'type':Sequelize[_0xd180('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xd180('0x2')]},'ticketId':{'type':Sequelize[_0xd180('0x2')]},'integrationId':{'type':Sequelize[_0xd180('0x3')]},'contacts':{'type':Sequelize[_0xd180('0x2')]},'uniqueid':{'type':Sequelize[_0xd180('0x2')]},'calleridnum':{'type':Sequelize[_0xd180('0x2')]},'calleridname':{'type':Sequelize[_0xd180('0x2')]},'queue':{'type':Sequelize[_0xd180('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd180('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd180('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd180('0x3')]},'agentcomplete':{'type':Sequelize[_0xd180('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd180('0x4')]},'talktime':{'type':Sequelize[_0xd180('0x3')]},'agentacw':{'type':Sequelize[_0xd180('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd180('0x3')]},'reason':{'type':Sequelize[_0xd180('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xd180('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd180('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd180('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd180('0x2')]},'channelstate':{'type':Sequelize[_0xd180('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd180('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd180('0x2')]},'connectedlinename':{'type':Sequelize[_0xd180('0x2')]},'language':{'type':Sequelize[_0xd180('0x2')]},'accountcode':{'type':Sequelize[_0xd180('0x2')]},'context':{'type':Sequelize[_0xd180('0x2')]},'exten':{'type':Sequelize[_0xd180('0x2')]},'priority':{'type':Sequelize[_0xd180('0x2')]},'destchannel':{'type':Sequelize[_0xd180('0x2')]},'destchannelstate':{'type':Sequelize[_0xd180('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd180('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd180('0x2')]},'destcalleridname':{'type':Sequelize[_0xd180('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd180('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd180('0x2')]},'destlanguage':{'type':Sequelize[_0xd180('0x2')]},'destaccountcode':{'type':Sequelize[_0xd180('0x2')]},'destcontext':{'type':Sequelize[_0xd180('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd180('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xd180('0x2')]},'inReplyTo':{'type':Sequelize[_0xd180('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd180('0x2')]},'cc':{'type':Sequelize[_0xd180('0x2')]},'attachment':{'type':Sequelize[_0xd180('0x6')]},'html':{'type':Sequelize[_0xd180('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT',_0xd180('0x7'),_0xd180('0x8'),_0xd180('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xd180('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xae51=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xae51,0xfa));var _0x1ae5=function(_0x1c3202,_0x2fc7f8){_0x1c3202=_0x1c3202-0x0;var _0xfecadd=_0xae51[_0x1c3202];return _0xfecadd;};'use strict';var Sequelize=require(_0x1ae5('0x0'));module[_0x1ae5('0x1')]={'integration':{'type':Sequelize[_0x1ae5('0x2')]},'eventChannel':{'type':Sequelize[_0x1ae5('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1ae5('0x2')]},'integrationId':{'type':Sequelize[_0x1ae5('0x3')]},'contacts':{'type':Sequelize[_0x1ae5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1ae5('0x2')]},'calleridname':{'type':Sequelize[_0x1ae5('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1ae5('0x2')]},'membername':{'type':Sequelize[_0x1ae5('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1ae5('0x4')]},'agentconnectAt':{'type':Sequelize[_0x1ae5('0x4')]},'holdtime':{'type':Sequelize[_0x1ae5('0x3')]},'agentcomplete':{'type':Sequelize[_0x1ae5('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1ae5('0x4')]},'talktime':{'type':Sequelize[_0x1ae5('0x3')]},'agentacw':{'type':Sequelize[_0x1ae5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1ae5('0x3')]},'reason':{'type':Sequelize[_0x1ae5('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x1ae5('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1ae5('0x4')]},'agentdump':{'type':Sequelize[_0x1ae5('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1ae5('0x4')]},'lastevent':{'type':Sequelize[_0x1ae5('0x2')]},'channel':{'type':Sequelize[_0x1ae5('0x2')]},'channelstate':{'type':Sequelize[_0x1ae5('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1ae5('0x2')]},'connectedlinename':{'type':Sequelize[_0x1ae5('0x2')]},'language':{'type':Sequelize[_0x1ae5('0x2')]},'accountcode':{'type':Sequelize[_0x1ae5('0x2')]},'context':{'type':Sequelize[_0x1ae5('0x2')]},'exten':{'type':Sequelize[_0x1ae5('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1ae5('0x2')]},'destchannelstate':{'type':Sequelize[_0x1ae5('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x1ae5('0x2')]},'destcalleridname':{'type':Sequelize[_0x1ae5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1ae5('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1ae5('0x2')]},'destlanguage':{'type':Sequelize[_0x1ae5('0x2')]},'destaccountcode':{'type':Sequelize[_0x1ae5('0x2')]},'destcontext':{'type':Sequelize[_0x1ae5('0x2')]},'destexten':{'type':Sequelize[_0x1ae5('0x2')]},'destpriority':{'type':Sequelize[_0x1ae5('0x2')]},'destuniqueid':{'type':Sequelize[_0x1ae5('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1ae5('0x2')]},'subject':{'type':Sequelize[_0x1ae5('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1ae5('0x2')]},'cc':{'type':Sequelize[_0x1ae5('0x2')]},'attachment':{'type':Sequelize[_0x1ae5('0x6')]},'html':{'type':Sequelize[_0x1ae5('0x6')]},'text':{'type':Sequelize[_0x1ae5('0x6')]},'status':{'type':Sequelize['ENUM'](_0x1ae5('0x7'),_0x1ae5('0x8'),_0x1ae5('0x9'),_0x1ae5('0xa'))},'url':{'type':Sequelize[_0x1ae5('0x2')]},'app':{'type':Sequelize[_0x1ae5('0x2')]},'appdata':{'type':Sequelize[_0x1ae5('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index afdfadd..38ed550 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 _0x8f26=['mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x53d607,_0x5dc730){var _0x351861=function(_0xfce0b4){while(--_0xfce0b4){_0x53d607['push'](_0x53d607['shift']());}};_0x351861(++_0x5dc730);}(_0x8f26,0x95));var _0x68f2=function(_0x580397,_0x47c566){_0x580397=_0x580397-0x0;var _0x3685b8=_0x8f26[_0x580397];return _0x3685b8;};'use strict';var emlformat=require(_0x68f2('0x0'));var rimraf=require(_0x68f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68f2('0x2'));var rp=require(_0x68f2('0x3'));var moment=require(_0x68f2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x68f2('0x5'));var util=require('util');var path=require(_0x68f2('0x6'));var sox=require(_0x68f2('0x7'));var csv=require(_0x68f2('0x8'));var ejs=require(_0x68f2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68f2('0xa'));var squel=require(_0x68f2('0xb'));var crypto=require(_0x68f2('0xc'));var jsforce=require(_0x68f2('0xd'));var deskjs=require(_0x68f2('0xe'));var toCsv=require(_0x68f2('0x8'));var querystring=require(_0x68f2('0xf'));var Papa=require(_0x68f2('0x10'));var Redis=require('ioredis');var authService=require(_0x68f2('0x11'));var qs=require(_0x68f2('0x12'));var as=require(_0x68f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68f2('0x14'))(_0x68f2('0x15'));var utils=require(_0x68f2('0x16'));var config=require(_0x68f2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x68f2('0x18'))['db'];function respondWithStatusCode(_0x1c7ce4,_0x29bb35){_0x29bb35=_0x29bb35||0xcc;return function(_0x4c15f3){if(_0x4c15f3){return _0x1c7ce4[_0x68f2('0x19')](_0x29bb35);}return _0x1c7ce4[_0x68f2('0x1a')](_0x29bb35)[_0x68f2('0x1b')]();};}function respondWithResult(_0x55b344,_0x37d5f6){_0x37d5f6=_0x37d5f6||0xc8;return function(_0x14358d){if(_0x14358d){return _0x55b344['status'](_0x37d5f6)[_0x68f2('0x1c')](_0x14358d);}};}function respondWithFilteredResult(_0x4d7cc5,_0x289240){return function(_0x1cd19a){if(_0x1cd19a){var _0x55ea94=typeof _0x289240['offset']===_0x68f2('0x1d')&&typeof _0x289240[_0x68f2('0x1e')]==='undefined';var _0x112993=_0x1cd19a['count'];var _0x7ed80b=_0x55ea94?0x0:_0x289240[_0x68f2('0x1f')];var _0x4a4a12=_0x55ea94?_0x1cd19a['count']:_0x289240['offset']+_0x289240['limit'];var _0x575470;if(_0x4a4a12>=_0x112993){_0x4a4a12=_0x112993;_0x575470=0xc8;}else{_0x575470=0xce;}_0x4d7cc5[_0x68f2('0x1a')](_0x575470);return _0x4d7cc5[_0x68f2('0x20')](_0x68f2('0x21'),_0x7ed80b+'-'+_0x4a4a12+'/'+_0x112993)['json'](_0x1cd19a);}return null;};}function patchUpdates(_0x10680b){return function(_0x36f3b9){try{jsonpatch[_0x68f2('0x22')](_0x36f3b9,_0x10680b,!![]);}catch(_0x5e07db){return BPromise[_0x68f2('0x23')](_0x5e07db);}return _0x36f3b9['save']();};}function saveUpdates(_0x3cac0d,_0x55f29a){return function(_0x221150){if(_0x221150){return _0x221150[_0x68f2('0x24')](_0x3cac0d)[_0x68f2('0x25')](function(_0xeabc3d){return _0xeabc3d;});}return null;};}function removeEntity(_0x57f93c,_0x3ab3db){return function(_0x4d823d){if(_0x4d823d){return _0x4d823d[_0x68f2('0x26')]()[_0x68f2('0x25')](function(){_0x57f93c[_0x68f2('0x1a')](0xcc)[_0x68f2('0x1b')]();});}};}function handleEntityNotFound(_0x3e518b,_0x2a9bb8){return function(_0xb1459d){if(!_0xb1459d){_0x3e518b[_0x68f2('0x19')](0x194);}return _0xb1459d;};}function handleError(_0x434835,_0x4e531c){_0x4e531c=_0x4e531c||0x1f4;return function(_0x12ad8d){logger['error'](_0x12ad8d[_0x68f2('0x27')]);if(_0x12ad8d[_0x68f2('0x28')]){delete _0x12ad8d['name'];}_0x434835[_0x68f2('0x1a')](_0x4e531c)[_0x68f2('0x29')](_0x12ad8d);};}exports[_0x68f2('0x2a')]=function(_0x4c3fcf,_0x4f4fe8){var _0x4e20b5={},_0x187efe={},_0x4becd7={'count':0x0,'rows':[]};var _0x324c7a=_[_0x68f2('0x2b')](db[_0x68f2('0x2c')][_0x68f2('0x2d')],function(_0x3e64f2){return{'name':_0x3e64f2[_0x68f2('0x2e')],'type':_0x3e64f2['type']['key']};});_0x187efe['model']=_['map'](_0x324c7a,_0x68f2('0x28'));_0x187efe[_0x68f2('0x2f')]=_[_0x68f2('0x30')](_0x4c3fcf[_0x68f2('0x2f')]);_0x187efe[_0x68f2('0x31')]=_['intersection'](_0x187efe[_0x68f2('0x32')],_0x187efe['query']);_0x4e20b5[_0x68f2('0x33')]=_[_0x68f2('0x34')](_0x187efe['model'],qs[_0x68f2('0x35')](_0x4c3fcf[_0x68f2('0x2f')]['fields']));_0x4e20b5[_0x68f2('0x33')]=_0x4e20b5['attributes'][_0x68f2('0x36')]?_0x4e20b5[_0x68f2('0x33')]:_0x187efe['model'];if(!_0x4c3fcf[_0x68f2('0x2f')][_0x68f2('0x37')](_0x68f2('0x38'))){_0x4e20b5[_0x68f2('0x1e')]=qs[_0x68f2('0x1e')](_0x4c3fcf[_0x68f2('0x2f')][_0x68f2('0x1e')]);_0x4e20b5[_0x68f2('0x1f')]=qs[_0x68f2('0x1f')](_0x4c3fcf['query'][_0x68f2('0x1f')]);}_0x4e20b5[_0x68f2('0x39')]=qs[_0x68f2('0x3a')](_0x4c3fcf['query']['sort']);_0x4e20b5[_0x68f2('0x3b')]=qs[_0x68f2('0x31')](_[_0x68f2('0x3c')](_0x4c3fcf[_0x68f2('0x2f')],_0x187efe[_0x68f2('0x31')]),_0x324c7a);if(_0x4c3fcf[_0x68f2('0x2f')][_0x68f2('0x3d')]){_0x4e20b5[_0x68f2('0x3b')]=_[_0x68f2('0x3e')](_0x4e20b5['where'],{'$or':_['map'](_0x324c7a,function(_0x2bffaf){if(_0x2bffaf[_0x68f2('0x3f')]!=='VIRTUAL'){var _0x400fb5={};_0x400fb5[_0x2bffaf['name']]={'$like':'%'+_0x4c3fcf[_0x68f2('0x2f')][_0x68f2('0x3d')]+'%'};return _0x400fb5;}})});}_0x4e20b5=_[_0x68f2('0x3e')]({},_0x4e20b5,_0x4c3fcf[_0x68f2('0x40')]);var _0x48e82a={'where':_0x4e20b5[_0x68f2('0x3b')]};return db[_0x68f2('0x2c')][_0x68f2('0x41')](_0x48e82a)[_0x68f2('0x25')](function(_0x48240c){_0x4becd7[_0x68f2('0x41')]=_0x48240c;if(_0x4c3fcf[_0x68f2('0x2f')][_0x68f2('0x42')]){_0x4e20b5[_0x68f2('0x43')]=[{'all':!![]}];}return db[_0x68f2('0x2c')][_0x68f2('0x44')](_0x4e20b5);})[_0x68f2('0x25')](function(_0x365b99){_0x4becd7[_0x68f2('0x45')]=_0x365b99;return _0x4becd7;})[_0x68f2('0x25')](respondWithFilteredResult(_0x4f4fe8,_0x4e20b5))[_0x68f2('0x46')](handleError(_0x4f4fe8,null));};exports[_0x68f2('0x47')]=function(_0x5da57e,_0x3f3a17){var _0x4192dc={'raw':![],'where':{'id':_0x5da57e[_0x68f2('0x48')]['id']}},_0x5e7420={};_0x5e7420[_0x68f2('0x32')]=_['keys'](db['IntegrationReport'][_0x68f2('0x2d')]);_0x5e7420[_0x68f2('0x2f')]=_['keys'](_0x5da57e[_0x68f2('0x2f')]);_0x5e7420['filters']=_[_0x68f2('0x34')](_0x5e7420[_0x68f2('0x32')],_0x5e7420[_0x68f2('0x2f')]);_0x4192dc[_0x68f2('0x33')]=_[_0x68f2('0x34')](_0x5e7420[_0x68f2('0x32')],qs[_0x68f2('0x35')](_0x5da57e[_0x68f2('0x2f')]['fields']));_0x4192dc[_0x68f2('0x33')]=_0x4192dc[_0x68f2('0x33')][_0x68f2('0x36')]?_0x4192dc['attributes']:_0x5e7420[_0x68f2('0x32')];if(_0x5da57e[_0x68f2('0x2f')][_0x68f2('0x42')]){_0x4192dc['include']=[{'all':!![]}];}_0x4192dc=_['merge']({},_0x4192dc,_0x5da57e[_0x68f2('0x40')]);return db[_0x68f2('0x2c')][_0x68f2('0x49')](_0x4192dc)[_0x68f2('0x25')](handleEntityNotFound(_0x3f3a17,null))['then'](respondWithResult(_0x3f3a17,null))['catch'](handleError(_0x3f3a17,null));};exports[_0x68f2('0x4a')]=function(_0x477efe,_0x4e14cf){return db[_0x68f2('0x2c')][_0x68f2('0x4a')](_0x477efe['body'],{})[_0x68f2('0x25')](respondWithResult(_0x4e14cf,0xc9))[_0x68f2('0x46')](handleError(_0x4e14cf,null));};exports['update']=function(_0x4385a0,_0x4d12b5){if(_0x4385a0[_0x68f2('0x4b')]['id']){delete _0x4385a0[_0x68f2('0x4b')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x4385a0[_0x68f2('0x48')]['id']}})[_0x68f2('0x25')](handleEntityNotFound(_0x4d12b5,null))[_0x68f2('0x25')](saveUpdates(_0x4385a0[_0x68f2('0x4b')],null))[_0x68f2('0x25')](respondWithResult(_0x4d12b5,null))[_0x68f2('0x46')](handleError(_0x4d12b5,null));};exports[_0x68f2('0x26')]=function(_0x5b6991,_0x23d019){return db[_0x68f2('0x2c')]['find']({'where':{'id':_0x5b6991[_0x68f2('0x48')]['id']}})[_0x68f2('0x25')](handleEntityNotFound(_0x23d019,null))[_0x68f2('0x25')](removeEntity(_0x23d019,null))[_0x68f2('0x46')](handleError(_0x23d019,null));};exports[_0x68f2('0x4c')]=function(_0x10b2d4,_0x5cf5ab){return db[_0x68f2('0x2c')]['describe']()['then'](respondWithResult(_0x5cf5ab,null))[_0x68f2('0x46')](handleError(_0x5cf5ab,null));}; \ No newline at end of file +var _0xbb6d=['save','update','then','destroy','error','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','describe','rimraf','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','count','status','set','Content-Range','apply','reject'];(function(_0x22719f,_0x1bc934){var _0x5e9f99=function(_0x4f7328){while(--_0x4f7328){_0x22719f['push'](_0x22719f['shift']());}};_0x5e9f99(++_0x1bc934);}(_0xbb6d,0x162));var _0xdbb6=function(_0x295aa2,_0x3434d0){_0x295aa2=_0x295aa2-0x0;var _0x9f3c82=_0xbb6d[_0x295aa2];return _0x9f3c82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbb6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbb6('0x1'));var rp=require(_0xdbb6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdbb6('0x3'));var util=require(_0xdbb6('0x4'));var path=require(_0xdbb6('0x5'));var sox=require(_0xdbb6('0x6'));var csv=require(_0xdbb6('0x7'));var ejs=require(_0xdbb6('0x8'));var fs=require('fs');var fs_extra=require(_0xdbb6('0x9'));var _=require(_0xdbb6('0xa'));var squel=require(_0xdbb6('0xb'));var crypto=require(_0xdbb6('0xc'));var jsforce=require(_0xdbb6('0xd'));var deskjs=require(_0xdbb6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbb6('0xf'));var Papa=require(_0xdbb6('0x10'));var Redis=require(_0xdbb6('0x11'));var authService=require(_0xdbb6('0x12'));var qs=require(_0xdbb6('0x13'));var as=require(_0xdbb6('0x14'));var hardwareService=require(_0xdbb6('0x15'));var logger=require(_0xdbb6('0x16'))(_0xdbb6('0x17'));var utils=require(_0xdbb6('0x18'));var config=require(_0xdbb6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25ead6,_0x4d67a8){_0x4d67a8=_0x4d67a8||0xcc;return function(_0x11201d){if(_0x11201d){return _0x25ead6[_0xdbb6('0x1a')](_0x4d67a8);}return _0x25ead6['status'](_0x4d67a8)[_0xdbb6('0x1b')]();};}function respondWithResult(_0x4c03a3,_0x51650c){_0x51650c=_0x51650c||0xc8;return function(_0x523f51){if(_0x523f51){return _0x4c03a3['status'](_0x51650c)[_0xdbb6('0x1c')](_0x523f51);}};}function respondWithFilteredResult(_0x2b84be,_0x5dbac1){return function(_0xba570){if(_0xba570){var _0x26ab39=typeof _0x5dbac1[_0xdbb6('0x1d')]==='undefined'&&typeof _0x5dbac1['limit']==='undefined';var _0x2f0318=_0xba570[_0xdbb6('0x1e')];var _0x26a1e0=_0x26ab39?0x0:_0x5dbac1[_0xdbb6('0x1d')];var _0x4af495=_0x26ab39?_0xba570[_0xdbb6('0x1e')]:_0x5dbac1[_0xdbb6('0x1d')]+_0x5dbac1['limit'];var _0x1a5feb;if(_0x4af495>=_0x2f0318){_0x4af495=_0x2f0318;_0x1a5feb=0xc8;}else{_0x1a5feb=0xce;}_0x2b84be[_0xdbb6('0x1f')](_0x1a5feb);return _0x2b84be[_0xdbb6('0x20')](_0xdbb6('0x21'),_0x26a1e0+'-'+_0x4af495+'/'+_0x2f0318)['json'](_0xba570);}return null;};}function patchUpdates(_0x161eef){return function(_0x3ce052){try{jsonpatch[_0xdbb6('0x22')](_0x3ce052,_0x161eef,!![]);}catch(_0x4ca4ab){return BPromise[_0xdbb6('0x23')](_0x4ca4ab);}return _0x3ce052[_0xdbb6('0x24')]();};}function saveUpdates(_0x56d1ea,_0x25ed2b){return function(_0x265615){if(_0x265615){return _0x265615[_0xdbb6('0x25')](_0x56d1ea)[_0xdbb6('0x26')](function(_0x5a33d0){return _0x5a33d0;});}return null;};}function removeEntity(_0x58b884,_0x131f3b){return function(_0x35234e){if(_0x35234e){return _0x35234e[_0xdbb6('0x27')]()[_0xdbb6('0x26')](function(){_0x58b884[_0xdbb6('0x1f')](0xcc)[_0xdbb6('0x1b')]();});}};}function handleEntityNotFound(_0x554537,_0x505332){return function(_0x1b1be8){if(!_0x1b1be8){_0x554537[_0xdbb6('0x1a')](0x194);}return _0x1b1be8;};}function handleError(_0xeb500b,_0x57de08){_0x57de08=_0x57de08||0x1f4;return function(_0xeea444){logger[_0xdbb6('0x28')](_0xeea444[_0xdbb6('0x29')]);if(_0xeea444[_0xdbb6('0x2a')]){delete _0xeea444[_0xdbb6('0x2a')];}_0xeb500b[_0xdbb6('0x1f')](_0x57de08)['send'](_0xeea444);};}exports['index']=function(_0x56431a,_0x48a533){var _0x424c4f={},_0x34fa59={},_0x552e66={'count':0x0,'rows':[]};var _0x5664ec=_[_0xdbb6('0x2b')](db[_0xdbb6('0x2c')][_0xdbb6('0x2d')],function(_0x474dd5){return{'name':_0x474dd5[_0xdbb6('0x2e')],'type':_0x474dd5[_0xdbb6('0x2f')][_0xdbb6('0x30')]};});_0x34fa59[_0xdbb6('0x31')]=_['map'](_0x5664ec,_0xdbb6('0x2a'));_0x34fa59['query']=_[_0xdbb6('0x32')](_0x56431a[_0xdbb6('0x33')]);_0x34fa59[_0xdbb6('0x34')]=_[_0xdbb6('0x35')](_0x34fa59['model'],_0x34fa59[_0xdbb6('0x33')]);_0x424c4f['attributes']=_['intersection'](_0x34fa59[_0xdbb6('0x31')],qs['fields'](_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x36')]));_0x424c4f['attributes']=_0x424c4f[_0xdbb6('0x37')]['length']?_0x424c4f[_0xdbb6('0x37')]:_0x34fa59[_0xdbb6('0x31')];if(!_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x38')](_0xdbb6('0x39'))){_0x424c4f['limit']=qs[_0xdbb6('0x3a')](_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x3a')]);_0x424c4f['offset']=qs[_0xdbb6('0x1d')](_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x1d')]);}_0x424c4f[_0xdbb6('0x3b')]=qs[_0xdbb6('0x3c')](_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x3c')]);_0x424c4f[_0xdbb6('0x3d')]=qs[_0xdbb6('0x34')](_[_0xdbb6('0x3e')](_0x56431a['query'],_0x34fa59[_0xdbb6('0x34')]),_0x5664ec);if(_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x3f')]){_0x424c4f[_0xdbb6('0x3d')]=_['merge'](_0x424c4f['where'],{'$or':_['map'](_0x5664ec,function(_0x4b76b3){if(_0x4b76b3[_0xdbb6('0x2f')]!=='VIRTUAL'){var _0x4b1ab9={};_0x4b1ab9[_0x4b76b3[_0xdbb6('0x2a')]]={'$like':'%'+_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x3f')]+'%'};return _0x4b1ab9;}})});}_0x424c4f=_['merge']({},_0x424c4f,_0x56431a[_0xdbb6('0x40')]);var _0x58c584={'where':_0x424c4f[_0xdbb6('0x3d')]};return db['IntegrationReport'][_0xdbb6('0x1e')](_0x58c584)[_0xdbb6('0x26')](function(_0x4d00db){_0x552e66[_0xdbb6('0x1e')]=_0x4d00db;if(_0x56431a[_0xdbb6('0x33')][_0xdbb6('0x41')]){_0x424c4f[_0xdbb6('0x42')]=[{'all':!![]}];}return db[_0xdbb6('0x2c')][_0xdbb6('0x43')](_0x424c4f);})[_0xdbb6('0x26')](function(_0x1042f7){_0x552e66[_0xdbb6('0x44')]=_0x1042f7;return _0x552e66;})['then'](respondWithFilteredResult(_0x48a533,_0x424c4f))[_0xdbb6('0x45')](handleError(_0x48a533,null));};exports[_0xdbb6('0x46')]=function(_0x46a583,_0x3a6908){var _0x188ae1={'raw':![],'where':{'id':_0x46a583[_0xdbb6('0x47')]['id']}},_0x706608={};_0x706608[_0xdbb6('0x31')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x706608[_0xdbb6('0x33')]=_[_0xdbb6('0x32')](_0x46a583[_0xdbb6('0x33')]);_0x706608['filters']=_[_0xdbb6('0x35')](_0x706608[_0xdbb6('0x31')],_0x706608[_0xdbb6('0x33')]);_0x188ae1[_0xdbb6('0x37')]=_[_0xdbb6('0x35')](_0x706608[_0xdbb6('0x31')],qs[_0xdbb6('0x36')](_0x46a583[_0xdbb6('0x33')][_0xdbb6('0x36')]));_0x188ae1['attributes']=_0x188ae1[_0xdbb6('0x37')][_0xdbb6('0x48')]?_0x188ae1[_0xdbb6('0x37')]:_0x706608[_0xdbb6('0x31')];if(_0x46a583[_0xdbb6('0x33')][_0xdbb6('0x41')]){_0x188ae1[_0xdbb6('0x42')]=[{'all':!![]}];}_0x188ae1=_[_0xdbb6('0x49')]({},_0x188ae1,_0x46a583[_0xdbb6('0x40')]);return db['IntegrationReport'][_0xdbb6('0x4a')](_0x188ae1)[_0xdbb6('0x26')](handleEntityNotFound(_0x3a6908,null))[_0xdbb6('0x26')](respondWithResult(_0x3a6908,null))[_0xdbb6('0x45')](handleError(_0x3a6908,null));};exports[_0xdbb6('0x4b')]=function(_0x9ce2f4,_0x5b5fe1){return db[_0xdbb6('0x2c')][_0xdbb6('0x4b')](_0x9ce2f4[_0xdbb6('0x4c')],{})[_0xdbb6('0x26')](respondWithResult(_0x5b5fe1,0xc9))[_0xdbb6('0x45')](handleError(_0x5b5fe1,null));};exports['update']=function(_0x36b111,_0x362944){if(_0x36b111[_0xdbb6('0x4c')]['id']){delete _0x36b111[_0xdbb6('0x4c')]['id'];}return db[_0xdbb6('0x2c')][_0xdbb6('0x4a')]({'where':{'id':_0x36b111[_0xdbb6('0x47')]['id']}})[_0xdbb6('0x26')](handleEntityNotFound(_0x362944,null))[_0xdbb6('0x26')](saveUpdates(_0x36b111[_0xdbb6('0x4c')],null))[_0xdbb6('0x26')](respondWithResult(_0x362944,null))['catch'](handleError(_0x362944,null));};exports[_0xdbb6('0x27')]=function(_0x555647,_0x440c8f){return db[_0xdbb6('0x2c')][_0xdbb6('0x4a')]({'where':{'id':_0x555647[_0xdbb6('0x47')]['id']}})[_0xdbb6('0x26')](handleEntityNotFound(_0x440c8f,null))['then'](removeEntity(_0x440c8f,null))[_0xdbb6('0x45')](handleError(_0x440c8f,null));};exports[_0xdbb6('0x4d')]=function(_0x6d931c,_0x3ef006){return db['IntegrationReport'][_0xdbb6('0x4d')]()[_0xdbb6('0x26')](respondWithResult(_0x3ef006,null))[_0xdbb6('0x45')](handleError(_0x3ef006,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 29985d7..cc4406c 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 _0x07fb=['path','rimraf','../../config/environment','exports','define','../../config/logger','api','bluebird','request-promise'];(function(_0x1d8118,_0x59c5d4){var _0x514982=function(_0x3741c8){while(--_0x3741c8){_0x1d8118['push'](_0x1d8118['shift']());}};_0x514982(++_0x59c5d4);}(_0x07fb,0x176));var _0xb07f=function(_0x23a1ec,_0x2d521f){_0x23a1ec=_0x23a1ec-0x0;var _0x539cce=_0x07fb[_0x23a1ec];return _0x539cce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb07f('0x0'))(_0xb07f('0x1'));var moment=require('moment');var BPromise=require(_0xb07f('0x2'));var rp=require(_0xb07f('0x3'));var fs=require('fs');var path=require(_0xb07f('0x4'));var rimraf=require(_0xb07f('0x5'));var config=require(_0xb07f('0x6'));var attributes=require('./integrationReport.attributes');module[_0xb07f('0x7')]=function(_0x301e0f,_0x17c215){return _0x301e0f[_0xb07f('0x8')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67e8=['api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','lodash'];(function(_0x57f4af,_0x3413a3){var _0x297022=function(_0x4a2a8c){while(--_0x4a2a8c){_0x57f4af['push'](_0x57f4af['shift']());}};_0x297022(++_0x3413a3);}(_0x67e8,0x1f3));var _0x867e=function(_0xb72e21,_0x4aaef0){_0xb72e21=_0xb72e21-0x0;var _0x2904c8=_0x67e8[_0xb72e21];return _0x2904c8;};'use strict';var _=require(_0x867e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x867e('0x1'));var moment=require('moment');var BPromise=require(_0x867e('0x2'));var rp=require(_0x867e('0x3'));var fs=require('fs');var path=require(_0x867e('0x4'));var rimraf=require(_0x867e('0x5'));var config=require(_0x867e('0x6'));var attributes=require(_0x867e('0x7'));module['exports']=function(_0x1c217f,_0x2e910e){return _0x1c217f[_0x867e('0x8')](_0x867e('0x9'),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 828ccb3..977fae0 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x524e,0x15e));var _0xe524=function(_0x53baed,_0x2e2b64){_0x53baed=_0x53baed-0x0;var _0x37a981=_0x524e[_0x53baed];return _0x37a981;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\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(_0x46a887,_0x255b80){_0x46a887=_0x46a887-0x0;var _0x32de20=_0x7a54[_0x46a887];return _0x32de20;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 5b62840..9f9b2c4 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 _0x41fe=['getIntervals','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41fe,0xd1));var _0xe41f=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x41fe[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var path=require(_0xe41f('0x2'));var timeout=require(_0xe41f('0x3'));var express=require(_0xe41f('0x4'));var router=express[_0xe41f('0x5')]();var fs_extra=require(_0xe41f('0x6'));var auth=require(_0xe41f('0x7'));var interaction=require(_0xe41f('0x8'));var config=require(_0xe41f('0x9'));var controller=require(_0xe41f('0xa'));router[_0xe41f('0xb')]('/',auth[_0xe41f('0xc')](),controller[_0xe41f('0xd')]);router[_0xe41f('0xb')](_0xe41f('0xe'),auth[_0xe41f('0xc')](),controller['show']);router[_0xe41f('0xb')](_0xe41f('0xf'),auth['isAuthenticated'](),controller[_0xe41f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe41f('0x11')]('/:id/sub_intervals',auth['isAuthenticated'](),controller['addInterval']);router[_0xe41f('0x11')](_0xe41f('0x12'),auth[_0xe41f('0xc')](),controller[_0xe41f('0x13')]);router[_0xe41f('0x14')](_0xe41f('0xe'),auth[_0xe41f('0xc')](),controller[_0xe41f('0x15')]);router[_0xe41f('0x16')](_0xe41f('0xe'),auth['isAuthenticated'](),controller[_0xe41f('0x17')]);module[_0xe41f('0x18')]=router; \ No newline at end of file +var _0x7380=['/:id/sub_intervals','isAuthenticated','post','addIntervals','put','/:id','update','delete','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','index','get','show'];(function(_0x200267,_0x337398){var _0x101313=function(_0x245246){while(--_0x245246){_0x200267['push'](_0x200267['shift']());}};_0x101313(++_0x337398);}(_0x7380,0x172));var _0x0738=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7380[_0x298ed3];return _0x5aad28;};'use strict';var multer=require('multer');var util=require(_0x0738('0x0'));var path=require(_0x0738('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0738('0x2')]();var fs_extra=require(_0x0738('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0738('0x4'));var config=require(_0x0738('0x5'));var controller=require(_0x0738('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0738('0x7')]);router[_0x0738('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0738('0x9')]);router[_0x0738('0x8')](_0x0738('0xa'),auth[_0x0738('0xb')](),controller['getIntervals']);router['post']('/',auth[_0x0738('0xb')](),controller['create']);router[_0x0738('0xc')](_0x0738('0xa'),auth[_0x0738('0xb')](),controller['addInterval']);router[_0x0738('0xc')]('/:id/sub_intervals/create_many',auth[_0x0738('0xb')](),controller[_0x0738('0xd')]);router[_0x0738('0xe')](_0x0738('0xf'),auth[_0x0738('0xb')](),controller[_0x0738('0x10')]);router[_0x0738('0x11')](_0x0738('0xf'),auth[_0x0738('0xb')](),controller['destroy']);module[_0x0738('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e50b7b1..3f64b89 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 _0x0f1c=['exports','STRING'];(function(_0x4d6b13,_0x162899){var _0xd37420=function(_0x413308){while(--_0x413308){_0x4d6b13['push'](_0x4d6b13['shift']());}};_0xd37420(++_0x162899);}(_0x0f1c,0x1b6));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc0f1('0x0')]={'name':{'type':Sequelize[_0xc0f1('0x1')]},'description':{'type':Sequelize[_0xc0f1('0x1')]},'interval':{'type':Sequelize[_0xc0f1('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x9695=['exports','STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9695,0xbf));var _0x5969=function(_0x1cfe21,_0x166058){_0x1cfe21=_0x1cfe21-0x0;var _0x27f744=_0x9695[_0x1cfe21];return _0x27f744;};'use strict';var Sequelize=require(_0x5969('0x0'));module[_0x5969('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5969('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 9803bf9..4c9a8c2 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 _0x30d3=['findAll','rows','catch','show','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Intervals','UserProfileSection','userProfileId','autoAssociation','params','addInterval','IntervalId','getIntervals','findOne','pick','filter','options','transaction','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','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','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','UserProfileResource','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','type','merge','includeAll','include','Interval'];(function(_0x20ad30,_0x1f7ca7){var _0x55ee9b=function(_0x4bbff3){while(--_0x4bbff3){_0x20ad30['push'](_0x20ad30['shift']());}};_0x55ee9b(++_0x1f7ca7);}(_0x30d3,0xd2));var _0x330d=function(_0x52b441,_0x4c8456){_0x52b441=_0x52b441-0x0;var _0x572b19=_0x30d3[_0x52b441];return _0x572b19;};'use strict';var emlformat=require(_0x330d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x330d('0x1'));var jsonpatch=require(_0x330d('0x2'));var rp=require(_0x330d('0x3'));var moment=require('moment');var BPromise=require(_0x330d('0x4'));var Mustache=require(_0x330d('0x5'));var util=require(_0x330d('0x6'));var path=require(_0x330d('0x7'));var sox=require('sox');var csv=require(_0x330d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x330d('0x9'));var _=require(_0x330d('0xa'));var squel=require(_0x330d('0xb'));var crypto=require('crypto');var jsforce=require(_0x330d('0xc'));var deskjs=require(_0x330d('0xd'));var toCsv=require(_0x330d('0x8'));var querystring=require(_0x330d('0xe'));var Papa=require(_0x330d('0xf'));var Redis=require(_0x330d('0x10'));var authService=require(_0x330d('0x11'));var qs=require(_0x330d('0x12'));var as=require(_0x330d('0x13'));var hardwareService=require(_0x330d('0x14'));var logger=require(_0x330d('0x15'))(_0x330d('0x16'));var utils=require(_0x330d('0x17'));var config=require(_0x330d('0x18'));var licenseUtil=require(_0x330d('0x19'));var db=require('../../mysqldb')['db'];var extensions=require(_0x330d('0x1a'));function respondWithStatusCode(_0x434d1a,_0x348e11){_0x348e11=_0x348e11||0xcc;return function(_0x1f4ec1){if(_0x1f4ec1){return _0x434d1a[_0x330d('0x1b')](_0x348e11);}return _0x434d1a[_0x330d('0x1c')](_0x348e11)[_0x330d('0x1d')]();};}function respondWithResult(_0x3cdee7,_0x57556e){_0x57556e=_0x57556e||0xc8;return function(_0x46f5cd){if(_0x46f5cd){return _0x3cdee7[_0x330d('0x1c')](_0x57556e)[_0x330d('0x1e')](_0x46f5cd);}};}function respondWithFilteredResult(_0x2bef08,_0x4bfeec){return function(_0x171a75){if(_0x171a75){var _0x315a5c=typeof _0x4bfeec[_0x330d('0x1f')]===_0x330d('0x20')&&typeof _0x4bfeec[_0x330d('0x21')]===_0x330d('0x20');var _0x5ef17c=_0x171a75[_0x330d('0x22')];var _0x922229=_0x315a5c?0x0:_0x4bfeec[_0x330d('0x1f')];var _0x5131ea=_0x315a5c?_0x171a75[_0x330d('0x22')]:_0x4bfeec[_0x330d('0x1f')]+_0x4bfeec[_0x330d('0x21')];var _0x413de3;if(_0x5131ea>=_0x5ef17c){_0x5131ea=_0x5ef17c;_0x413de3=0xc8;}else{_0x413de3=0xce;}_0x2bef08[_0x330d('0x1c')](_0x413de3);return _0x2bef08[_0x330d('0x23')](_0x330d('0x24'),_0x922229+'-'+_0x5131ea+'/'+_0x5ef17c)[_0x330d('0x1e')](_0x171a75);}return null;};}function patchUpdates(_0x116612){return function(_0xf82b68){try{jsonpatch['apply'](_0xf82b68,_0x116612,!![]);}catch(_0x13385f){return BPromise[_0x330d('0x25')](_0x13385f);}return _0xf82b68['save']();};}function saveUpdates(_0x5cca68,_0x139c90){return function(_0x41bc89){if(_0x41bc89){return _0x41bc89[_0x330d('0x26')](_0x5cca68)['then'](function(_0x267e74){return _0x267e74;});}return null;};}function removeEntity(_0x4ca8df,_0xf05fbd){return function(_0x28d563){if(_0x28d563){return _0x28d563[_0x330d('0x27')]()[_0x330d('0x28')](function(){var _0xd7b3a7=_0x28d563['get']({'plain':!![]});var _0x56f1a4='Intervals';return db[_0x330d('0x29')][_0x330d('0x27')]({'where':{'type':_0x56f1a4,'resourceId':_0xd7b3a7['id']}})[_0x330d('0x28')](function(){return _0x28d563;});})['then'](function(){_0x4ca8df[_0x330d('0x1c')](0xcc)[_0x330d('0x1d')]();});}};}function handleEntityNotFound(_0x43e4fd,_0x53a467){return function(_0x432310){if(!_0x432310){_0x43e4fd[_0x330d('0x1b')](0x194);}return _0x432310;};}function handleError(_0x38ce30,_0x505866){_0x505866=_0x505866||0x1f4;return function(_0x124e96){logger[_0x330d('0x2a')](_0x124e96[_0x330d('0x2b')]);if(_0x124e96[_0x330d('0x2c')]){delete _0x124e96[_0x330d('0x2c')];}_0x38ce30[_0x330d('0x1c')](_0x505866)[_0x330d('0x2d')](_0x124e96);};}exports[_0x330d('0x2e')]=function(_0x569bdd,_0x55ce02){var _0x3358f8={},_0x49f4fe={},_0x24a8a2={'count':0x0,'rows':[]};var _0x10caa0=_[_0x330d('0x2f')](db['Interval']['rawAttributes'],function(_0x2afe72){return{'name':_0x2afe72[_0x330d('0x30')],'type':_0x2afe72['type'][_0x330d('0x31')]};});_0x49f4fe[_0x330d('0x32')]=_['map'](_0x10caa0,_0x330d('0x2c'));_0x49f4fe[_0x330d('0x33')]=_[_0x330d('0x34')](_0x569bdd[_0x330d('0x33')]);_0x49f4fe[_0x330d('0x35')]=_[_0x330d('0x36')](_0x49f4fe['model'],_0x49f4fe[_0x330d('0x33')]);_0x3358f8[_0x330d('0x37')]=_[_0x330d('0x36')](_0x49f4fe[_0x330d('0x32')],qs[_0x330d('0x38')](_0x569bdd[_0x330d('0x33')][_0x330d('0x38')]));_0x3358f8[_0x330d('0x37')]=_0x3358f8['attributes']['length']?_0x3358f8[_0x330d('0x37')]:_0x49f4fe['model'];if(!_0x569bdd[_0x330d('0x33')][_0x330d('0x39')](_0x330d('0x3a'))){_0x3358f8[_0x330d('0x21')]=qs[_0x330d('0x21')](_0x569bdd['query']['limit']);_0x3358f8[_0x330d('0x1f')]=qs[_0x330d('0x1f')](_0x569bdd[_0x330d('0x33')][_0x330d('0x1f')]);}_0x3358f8['order']=qs[_0x330d('0x3b')](_0x569bdd['query'][_0x330d('0x3b')]);_0x3358f8[_0x330d('0x3c')]=qs[_0x330d('0x35')](_['pick'](_0x569bdd[_0x330d('0x33')],_0x49f4fe['filters']),_0x10caa0);if(_0x569bdd[_0x330d('0x33')]['filter']){_0x3358f8[_0x330d('0x3c')]=_['merge'](_0x3358f8['where'],{'$or':_['map'](_0x10caa0,function(_0x5e7534){if(_0x5e7534[_0x330d('0x3d')]!=='VIRTUAL'){var _0x445166={};_0x445166[_0x5e7534[_0x330d('0x2c')]]={'$like':'%'+_0x569bdd[_0x330d('0x33')]['filter']+'%'};return _0x445166;}})});}_0x3358f8=_[_0x330d('0x3e')]({},_0x3358f8,_0x569bdd['options']);var _0x57f47e={'where':_0x3358f8['where']};return db['Interval']['count'](_0x57f47e)[_0x330d('0x28')](function(_0x212413){_0x24a8a2[_0x330d('0x22')]=_0x212413;if(_0x569bdd[_0x330d('0x33')][_0x330d('0x3f')]){_0x3358f8[_0x330d('0x40')]=[{'all':!![]}];}return db[_0x330d('0x41')][_0x330d('0x42')](_0x3358f8);})['then'](function(_0x21cb48){_0x24a8a2[_0x330d('0x43')]=_0x21cb48;return _0x24a8a2;})['then'](respondWithFilteredResult(_0x55ce02,_0x3358f8))[_0x330d('0x44')](handleError(_0x55ce02,null));};exports[_0x330d('0x45')]=function(_0x41ec6e,_0x64493e){var _0x260ea5={'raw':!![],'where':{'id':_0x41ec6e['params']['id']}},_0x42911b={};_0x42911b[_0x330d('0x32')]=_['keys'](db['Interval'][_0x330d('0x46')]);_0x42911b[_0x330d('0x33')]=_[_0x330d('0x34')](_0x41ec6e[_0x330d('0x33')]);_0x42911b[_0x330d('0x35')]=_['intersection'](_0x42911b[_0x330d('0x32')],_0x42911b['query']);_0x260ea5[_0x330d('0x37')]=_['intersection'](_0x42911b[_0x330d('0x32')],qs[_0x330d('0x38')](_0x41ec6e[_0x330d('0x33')]['fields']));_0x260ea5['attributes']=_0x260ea5[_0x330d('0x37')][_0x330d('0x47')]?_0x260ea5[_0x330d('0x37')]:_0x42911b[_0x330d('0x32')];if(_0x41ec6e[_0x330d('0x33')][_0x330d('0x3f')]){_0x260ea5[_0x330d('0x40')]=[{'all':!![]}];}_0x260ea5=_[_0x330d('0x3e')]({},_0x260ea5,_0x41ec6e['options']);return db[_0x330d('0x41')][_0x330d('0x48')](_0x260ea5)[_0x330d('0x28')](handleEntityNotFound(_0x64493e,null))[_0x330d('0x28')](respondWithResult(_0x64493e,null))[_0x330d('0x44')](handleError(_0x64493e,null));};exports[_0x330d('0x49')]=function(_0x1a0151,_0x25c793){return db[_0x330d('0x41')][_0x330d('0x49')](_0x1a0151[_0x330d('0x4a')],{})[_0x330d('0x28')](function(_0x353e40){var _0x53c2a9=_0x1a0151[_0x330d('0x4b')]['get']({'plain':!![]});if(!_0x53c2a9)throw new Error(_0x330d('0x4c'));if(_0x53c2a9[_0x330d('0x4d')]===_0x330d('0x4b')){var _0x19352d=_0x353e40[_0x330d('0x4e')]({'plain':!![]});var _0x2c5eb4=_0x330d('0x4f');return db[_0x330d('0x50')][_0x330d('0x48')]({'where':{'name':_0x2c5eb4,'userProfileId':_0x53c2a9[_0x330d('0x51')]},'raw':!![]})[_0x330d('0x28')](function(_0x4e046d){if(_0x4e046d&&_0x4e046d[_0x330d('0x52')]===0x0){return db[_0x330d('0x29')][_0x330d('0x49')]({'name':_0x19352d['name'],'resourceId':_0x19352d['id'],'type':_0x4e046d[_0x330d('0x2c')],'sectionId':_0x4e046d['id']},{})[_0x330d('0x28')](function(){return _0x353e40;});}else{return _0x353e40;}})[_0x330d('0x44')](function(_0x296da7){logger[_0x330d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x296da7);throw _0x296da7;});}return _0x353e40;})[_0x330d('0x28')](respondWithResult(_0x25c793,0xc9))['catch'](handleError(_0x25c793,null));};exports[_0x330d('0x26')]=function(_0x400575,_0x51cbd5){if(_0x400575[_0x330d('0x4a')]['id']){delete _0x400575[_0x330d('0x4a')]['id'];}return db[_0x330d('0x41')]['find']({'where':{'id':_0x400575[_0x330d('0x53')]['id']}})[_0x330d('0x28')](handleEntityNotFound(_0x51cbd5,null))[_0x330d('0x28')](saveUpdates(_0x400575['body'],null))[_0x330d('0x28')](respondWithResult(_0x51cbd5,null))[_0x330d('0x44')](handleError(_0x51cbd5,null));};exports[_0x330d('0x27')]=function(_0x5a490c,_0x29a5b6){return db[_0x330d('0x41')][_0x330d('0x48')]({'where':{'id':_0x5a490c[_0x330d('0x53')]['id']}})[_0x330d('0x28')](handleEntityNotFound(_0x29a5b6,null))[_0x330d('0x28')](removeEntity(_0x29a5b6,null))[_0x330d('0x44')](handleError(_0x29a5b6,null));};exports[_0x330d('0x54')]=function(_0x514255,_0x16fb65,_0x1951e8){if(_0x514255[_0x330d('0x4a')]['id']){delete _0x514255[_0x330d('0x4a')]['id'];}return db[_0x330d('0x41')][_0x330d('0x48')]({'where':{'id':_0x514255[_0x330d('0x53')]['id']}})[_0x330d('0x28')](handleEntityNotFound(_0x16fb65,null))['then'](function(_0x4049d4){if(_0x4049d4){_0x514255[_0x330d('0x4a')][_0x330d('0x55')]=_0x4049d4['id'];return db[_0x330d('0x41')]['create'](_0x514255[_0x330d('0x4a')]);}})[_0x330d('0x28')](respondWithResult(_0x16fb65,null))[_0x330d('0x44')](handleError(_0x16fb65,null));};exports[_0x330d('0x56')]=function(_0x5eb938,_0x1579d3,_0x22a368){var _0x37207c={};var _0x5409ac={};var _0x3e417d;var _0x5688e3;return db[_0x330d('0x41')][_0x330d('0x57')]({'where':{'id':_0x5eb938[_0x330d('0x53')]['id']}})[_0x330d('0x28')](handleEntityNotFound(_0x1579d3,null))[_0x330d('0x28')](function(_0x28b392){if(_0x28b392){_0x3e417d=_0x28b392;_0x5409ac[_0x330d('0x32')]=_[_0x330d('0x34')](db[_0x330d('0x41')]['rawAttributes']);_0x5409ac[_0x330d('0x33')]=_[_0x330d('0x34')](_0x5eb938[_0x330d('0x33')]);_0x5409ac[_0x330d('0x35')]=_['intersection'](_0x5409ac[_0x330d('0x32')],_0x5409ac[_0x330d('0x33')]);_0x37207c['attributes']=_[_0x330d('0x36')](_0x5409ac[_0x330d('0x32')],qs[_0x330d('0x38')](_0x5eb938['query'][_0x330d('0x38')]));_0x37207c['attributes']=_0x37207c[_0x330d('0x37')]['length']?_0x37207c[_0x330d('0x37')]:_0x5409ac[_0x330d('0x32')];_0x37207c['order']=qs[_0x330d('0x3b')](_0x5eb938['query']['sort']);_0x37207c[_0x330d('0x3c')]=qs[_0x330d('0x35')](_[_0x330d('0x58')](_0x5eb938[_0x330d('0x33')],_0x5409ac[_0x330d('0x35')]));if(_0x5eb938['query'][_0x330d('0x59')]){_0x37207c[_0x330d('0x3c')]=_[_0x330d('0x3e')](_0x37207c[_0x330d('0x3c')],{'$or':_[_0x330d('0x2f')](_0x37207c['attributes'],function(_0x4b7916){var _0x5265aa={};_0x5265aa[_0x4b7916]={'$like':'%'+_0x5eb938[_0x330d('0x33')][_0x330d('0x59')]+'%'};return _0x5265aa;})});}_0x37207c=_[_0x330d('0x3e')]({},_0x37207c,_0x5eb938[_0x330d('0x5a')]);return _0x3e417d[_0x330d('0x56')](_0x37207c);}})['then'](function(_0x276e56){if(_0x276e56){_0x5688e3=_0x276e56[_0x330d('0x47')];if(!_0x5eb938['query']['hasOwnProperty'](_0x330d('0x3a'))){_0x37207c[_0x330d('0x21')]=qs[_0x330d('0x21')](_0x5eb938[_0x330d('0x33')]['limit']);_0x37207c[_0x330d('0x1f')]=qs[_0x330d('0x1f')](_0x5eb938[_0x330d('0x33')][_0x330d('0x1f')]);}return _0x3e417d[_0x330d('0x56')](_0x37207c);}})[_0x330d('0x28')](function(_0x532292){if(_0x532292){return _0x532292?{'count':_0x5688e3,'rows':_0x532292}:null;}})['then'](respondWithResult(_0x1579d3,null))['catch'](handleError(_0x1579d3,null));};exports['addIntervals']=function(_0x1c62b9,_0x36c061,_0x43a00c){return db['Interval'][_0x330d('0x57')]({'where':{'id':_0x1c62b9['params']['id']}})[_0x330d('0x28')](handleEntityNotFound(_0x36c061,null))[_0x330d('0x28')](function(_0x2e0729){if(_0x2e0729){return db['sequelize'][_0x330d('0x5b')](function(_0x18a5fc){return db[_0x330d('0x41')][_0x330d('0x27')]({'where':{'IntervalId':_0x1c62b9[_0x330d('0x53')]['id']},'transaction':_0x18a5fc})[_0x330d('0x28')](function(_0x2e2e23){var _0x31fb36=_[_0x330d('0x2f')](_0x1c62b9[_0x330d('0x4a')],function(_0x2d91b4){delete _0x2d91b4['id'];_0x2d91b4['IntervalId']=_0x1c62b9[_0x330d('0x53')]['id'];return _0x2d91b4;});return db[_0x330d('0x41')]['bulkCreate'](_0x31fb36,{'transaction':_0x18a5fc});});})[_0x330d('0x28')](function(){return db[_0x330d('0x41')][_0x330d('0x42')]({'where':{'IntervalId':_0x1c62b9[_0x330d('0x53')]['id']}});});}})[_0x330d('0x28')](respondWithResult(_0x36c061,null))[_0x330d('0x44')](handleError(_0x36c061,null));}; \ No newline at end of file +var _0x7658=['UserProfileSection','userProfileId','autoAssociation','find','addInterval','IntervalId','getIntervals','findOne','order','sort','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','get','Intervals','UserProfileResource','error','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','where','filters','filter','VIRTUAL','merge','options','includeAll','include','Interval','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x7658,0x6a));var _0x8765=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7658[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8765('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8765('0x1'));var jsonpatch=require(_0x8765('0x2'));var rp=require(_0x8765('0x3'));var moment=require('moment');var BPromise=require(_0x8765('0x4'));var Mustache=require(_0x8765('0x5'));var util=require(_0x8765('0x6'));var path=require(_0x8765('0x7'));var sox=require(_0x8765('0x8'));var csv=require(_0x8765('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8765('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8765('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8765('0xc'));var toCsv=require(_0x8765('0x9'));var querystring=require(_0x8765('0xd'));var Papa=require(_0x8765('0xe'));var Redis=require(_0x8765('0xf'));var authService=require(_0x8765('0x10'));var qs=require(_0x8765('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8765('0x12'));var logger=require(_0x8765('0x13'))(_0x8765('0x14'));var utils=require('../../config/utils');var config=require(_0x8765('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x8765('0x16'));function respondWithStatusCode(_0x4e4d4f,_0x272604){_0x272604=_0x272604||0xcc;return function(_0x40ff6f){if(_0x40ff6f){return _0x4e4d4f[_0x8765('0x17')](_0x272604);}return _0x4e4d4f[_0x8765('0x18')](_0x272604)[_0x8765('0x19')]();};}function respondWithResult(_0x51e0f7,_0x3e97ec){_0x3e97ec=_0x3e97ec||0xc8;return function(_0x2675bf){if(_0x2675bf){return _0x51e0f7[_0x8765('0x18')](_0x3e97ec)[_0x8765('0x1a')](_0x2675bf);}};}function respondWithFilteredResult(_0xb3a525,_0x3b531b){return function(_0x3546f7){if(_0x3546f7){var _0x255a16=typeof _0x3b531b[_0x8765('0x1b')]===_0x8765('0x1c')&&typeof _0x3b531b['limit']===_0x8765('0x1c');var _0x4b4885=_0x3546f7[_0x8765('0x1d')];var _0x22366b=_0x255a16?0x0:_0x3b531b[_0x8765('0x1b')];var _0x520a5c=_0x255a16?_0x3546f7['count']:_0x3b531b[_0x8765('0x1b')]+_0x3b531b['limit'];var _0x3feea0;if(_0x520a5c>=_0x4b4885){_0x520a5c=_0x4b4885;_0x3feea0=0xc8;}else{_0x3feea0=0xce;}_0xb3a525['status'](_0x3feea0);return _0xb3a525[_0x8765('0x1e')]('Content-Range',_0x22366b+'-'+_0x520a5c+'/'+_0x4b4885)[_0x8765('0x1a')](_0x3546f7);}return null;};}function patchUpdates(_0x2b7953){return function(_0x3b9fe9){try{jsonpatch[_0x8765('0x1f')](_0x3b9fe9,_0x2b7953,!![]);}catch(_0x57f491){return BPromise[_0x8765('0x20')](_0x57f491);}return _0x3b9fe9[_0x8765('0x21')]();};}function saveUpdates(_0x1d48d7,_0x1a413f){return function(_0x50426e){if(_0x50426e){return _0x50426e[_0x8765('0x22')](_0x1d48d7)['then'](function(_0x3ccb2d){return _0x3ccb2d;});}return null;};}function removeEntity(_0x2cc858,_0x55fe3c){return function(_0x2b2651){if(_0x2b2651){return _0x2b2651[_0x8765('0x23')]()[_0x8765('0x24')](function(){var _0xf7b4b6=_0x2b2651[_0x8765('0x25')]({'plain':!![]});var _0x35b89f=_0x8765('0x26');return db[_0x8765('0x27')][_0x8765('0x23')]({'where':{'type':_0x35b89f,'resourceId':_0xf7b4b6['id']}})['then'](function(){return _0x2b2651;});})[_0x8765('0x24')](function(){_0x2cc858[_0x8765('0x18')](0xcc)[_0x8765('0x19')]();});}};}function handleEntityNotFound(_0x269648,_0x4ba283){return function(_0x211656){if(!_0x211656){_0x269648[_0x8765('0x17')](0x194);}return _0x211656;};}function handleError(_0x19d479,_0x102951){_0x102951=_0x102951||0x1f4;return function(_0x51d22f){logger[_0x8765('0x28')](_0x51d22f['stack']);if(_0x51d22f[_0x8765('0x29')]){delete _0x51d22f[_0x8765('0x29')];}_0x19d479[_0x8765('0x18')](_0x102951)['send'](_0x51d22f);};}exports[_0x8765('0x2a')]=function(_0x3ae1a3,_0x1e4b98){var _0x972596={},_0x154c96={},_0x3bd34a={'count':0x0,'rows':[]};var _0x280c8b=_[_0x8765('0x2b')](db['Interval']['rawAttributes'],function(_0x542cd5){return{'name':_0x542cd5[_0x8765('0x2c')],'type':_0x542cd5[_0x8765('0x2d')][_0x8765('0x2e')]};});_0x154c96[_0x8765('0x2f')]=_[_0x8765('0x2b')](_0x280c8b,_0x8765('0x29'));_0x154c96[_0x8765('0x30')]=_[_0x8765('0x31')](_0x3ae1a3[_0x8765('0x30')]);_0x154c96['filters']=_[_0x8765('0x32')](_0x154c96[_0x8765('0x2f')],_0x154c96[_0x8765('0x30')]);_0x972596[_0x8765('0x33')]=_[_0x8765('0x32')](_0x154c96['model'],qs[_0x8765('0x34')](_0x3ae1a3[_0x8765('0x30')][_0x8765('0x34')]));_0x972596[_0x8765('0x33')]=_0x972596[_0x8765('0x33')][_0x8765('0x35')]?_0x972596[_0x8765('0x33')]:_0x154c96[_0x8765('0x2f')];if(!_0x3ae1a3['query'][_0x8765('0x36')]('nolimit')){_0x972596['limit']=qs[_0x8765('0x37')](_0x3ae1a3['query'][_0x8765('0x37')]);_0x972596[_0x8765('0x1b')]=qs[_0x8765('0x1b')](_0x3ae1a3['query'][_0x8765('0x1b')]);}_0x972596['order']=qs['sort'](_0x3ae1a3[_0x8765('0x30')]['sort']);_0x972596[_0x8765('0x38')]=qs['filters'](_['pick'](_0x3ae1a3[_0x8765('0x30')],_0x154c96[_0x8765('0x39')]),_0x280c8b);if(_0x3ae1a3['query'][_0x8765('0x3a')]){_0x972596[_0x8765('0x38')]=_['merge'](_0x972596[_0x8765('0x38')],{'$or':_[_0x8765('0x2b')](_0x280c8b,function(_0x325db9){if(_0x325db9[_0x8765('0x2d')]!==_0x8765('0x3b')){var _0x28bc1c={};_0x28bc1c[_0x325db9[_0x8765('0x29')]]={'$like':'%'+_0x3ae1a3['query']['filter']+'%'};return _0x28bc1c;}})});}_0x972596=_[_0x8765('0x3c')]({},_0x972596,_0x3ae1a3[_0x8765('0x3d')]);var _0x48cb18={'where':_0x972596[_0x8765('0x38')]};return db['Interval']['count'](_0x48cb18)[_0x8765('0x24')](function(_0x495691){_0x3bd34a['count']=_0x495691;if(_0x3ae1a3[_0x8765('0x30')][_0x8765('0x3e')]){_0x972596[_0x8765('0x3f')]=[{'all':!![]}];}return db[_0x8765('0x40')][_0x8765('0x41')](_0x972596);})[_0x8765('0x24')](function(_0x58675e){_0x3bd34a[_0x8765('0x42')]=_0x58675e;return _0x3bd34a;})[_0x8765('0x24')](respondWithFilteredResult(_0x1e4b98,_0x972596))[_0x8765('0x43')](handleError(_0x1e4b98,null));};exports[_0x8765('0x44')]=function(_0x47220f,_0x111848){var _0x5691e3={'raw':!![],'where':{'id':_0x47220f[_0x8765('0x45')]['id']}},_0x31d976={};_0x31d976[_0x8765('0x2f')]=_[_0x8765('0x31')](db['Interval'][_0x8765('0x46')]);_0x31d976[_0x8765('0x30')]=_[_0x8765('0x31')](_0x47220f[_0x8765('0x30')]);_0x31d976[_0x8765('0x39')]=_[_0x8765('0x32')](_0x31d976[_0x8765('0x2f')],_0x31d976[_0x8765('0x30')]);_0x5691e3[_0x8765('0x33')]=_[_0x8765('0x32')](_0x31d976[_0x8765('0x2f')],qs[_0x8765('0x34')](_0x47220f[_0x8765('0x30')][_0x8765('0x34')]));_0x5691e3[_0x8765('0x33')]=_0x5691e3[_0x8765('0x33')][_0x8765('0x35')]?_0x5691e3['attributes']:_0x31d976['model'];if(_0x47220f['query'][_0x8765('0x3e')]){_0x5691e3[_0x8765('0x3f')]=[{'all':!![]}];}_0x5691e3=_['merge']({},_0x5691e3,_0x47220f['options']);return db['Interval']['find'](_0x5691e3)[_0x8765('0x24')](handleEntityNotFound(_0x111848,null))[_0x8765('0x24')](respondWithResult(_0x111848,null))[_0x8765('0x43')](handleError(_0x111848,null));};exports['create']=function(_0x121481,_0x1c350f){return db[_0x8765('0x40')][_0x8765('0x47')](_0x121481[_0x8765('0x48')],{})[_0x8765('0x24')](function(_0x5c336a){var _0x4c68fe=_0x121481[_0x8765('0x49')][_0x8765('0x25')]({'plain':!![]});if(!_0x4c68fe)throw new Error(_0x8765('0x4a'));if(_0x4c68fe[_0x8765('0x4b')]===_0x8765('0x49')){var _0x266d7e=_0x5c336a[_0x8765('0x25')]({'plain':!![]});var _0x251319=_0x8765('0x26');return db[_0x8765('0x4c')]['find']({'where':{'name':_0x251319,'userProfileId':_0x4c68fe[_0x8765('0x4d')]},'raw':!![]})[_0x8765('0x24')](function(_0x27560c){if(_0x27560c&&_0x27560c[_0x8765('0x4e')]===0x0){return db['UserProfileResource'][_0x8765('0x47')]({'name':_0x266d7e[_0x8765('0x29')],'resourceId':_0x266d7e['id'],'type':_0x27560c[_0x8765('0x29')],'sectionId':_0x27560c['id']},{})[_0x8765('0x24')](function(){return _0x5c336a;});}else{return _0x5c336a;}})[_0x8765('0x43')](function(_0x24723b){logger[_0x8765('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24723b);throw _0x24723b;});}return _0x5c336a;})['then'](respondWithResult(_0x1c350f,0xc9))['catch'](handleError(_0x1c350f,null));};exports[_0x8765('0x22')]=function(_0x394c85,_0x3ef1ae){if(_0x394c85['body']['id']){delete _0x394c85['body']['id'];}return db['Interval'][_0x8765('0x4f')]({'where':{'id':_0x394c85[_0x8765('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ef1ae,null))[_0x8765('0x24')](saveUpdates(_0x394c85[_0x8765('0x48')],null))['then'](respondWithResult(_0x3ef1ae,null))['catch'](handleError(_0x3ef1ae,null));};exports[_0x8765('0x23')]=function(_0x42cb86,_0x3dad29){return db[_0x8765('0x40')][_0x8765('0x4f')]({'where':{'id':_0x42cb86[_0x8765('0x45')]['id']}})[_0x8765('0x24')](handleEntityNotFound(_0x3dad29,null))[_0x8765('0x24')](removeEntity(_0x3dad29,null))[_0x8765('0x43')](handleError(_0x3dad29,null));};exports[_0x8765('0x50')]=function(_0x204059,_0x3d0001,_0xd85fbb){if(_0x204059[_0x8765('0x48')]['id']){delete _0x204059[_0x8765('0x48')]['id'];}return db[_0x8765('0x40')][_0x8765('0x4f')]({'where':{'id':_0x204059[_0x8765('0x45')]['id']}})[_0x8765('0x24')](handleEntityNotFound(_0x3d0001,null))[_0x8765('0x24')](function(_0x1bf671){if(_0x1bf671){_0x204059[_0x8765('0x48')][_0x8765('0x51')]=_0x1bf671['id'];return db['Interval'][_0x8765('0x47')](_0x204059[_0x8765('0x48')]);}})[_0x8765('0x24')](respondWithResult(_0x3d0001,null))[_0x8765('0x43')](handleError(_0x3d0001,null));};exports[_0x8765('0x52')]=function(_0x2e0d0a,_0x3a8797,_0x4196e3){var _0x208714={};var _0x2d54ba={};var _0xfa4511;var _0x39c10d;return db[_0x8765('0x40')][_0x8765('0x53')]({'where':{'id':_0x2e0d0a['params']['id']}})[_0x8765('0x24')](handleEntityNotFound(_0x3a8797,null))[_0x8765('0x24')](function(_0x1f1c15){if(_0x1f1c15){_0xfa4511=_0x1f1c15;_0x2d54ba['model']=_[_0x8765('0x31')](db[_0x8765('0x40')][_0x8765('0x46')]);_0x2d54ba[_0x8765('0x30')]=_[_0x8765('0x31')](_0x2e0d0a['query']);_0x2d54ba['filters']=_['intersection'](_0x2d54ba[_0x8765('0x2f')],_0x2d54ba[_0x8765('0x30')]);_0x208714[_0x8765('0x33')]=_['intersection'](_0x2d54ba[_0x8765('0x2f')],qs['fields'](_0x2e0d0a[_0x8765('0x30')]['fields']));_0x208714[_0x8765('0x33')]=_0x208714[_0x8765('0x33')]['length']?_0x208714[_0x8765('0x33')]:_0x2d54ba['model'];_0x208714[_0x8765('0x54')]=qs[_0x8765('0x55')](_0x2e0d0a['query'][_0x8765('0x55')]);_0x208714['where']=qs['filters'](_['pick'](_0x2e0d0a[_0x8765('0x30')],_0x2d54ba[_0x8765('0x39')]));if(_0x2e0d0a[_0x8765('0x30')][_0x8765('0x3a')]){_0x208714[_0x8765('0x38')]=_['merge'](_0x208714[_0x8765('0x38')],{'$or':_[_0x8765('0x2b')](_0x208714[_0x8765('0x33')],function(_0x59cdce){var _0x99cfed={};_0x99cfed[_0x59cdce]={'$like':'%'+_0x2e0d0a['query']['filter']+'%'};return _0x99cfed;})});}_0x208714=_[_0x8765('0x3c')]({},_0x208714,_0x2e0d0a[_0x8765('0x3d')]);return _0xfa4511[_0x8765('0x52')](_0x208714);}})['then'](function(_0xee9bed){if(_0xee9bed){_0x39c10d=_0xee9bed[_0x8765('0x35')];if(!_0x2e0d0a[_0x8765('0x30')][_0x8765('0x36')](_0x8765('0x56'))){_0x208714[_0x8765('0x37')]=qs[_0x8765('0x37')](_0x2e0d0a[_0x8765('0x30')]['limit']);_0x208714[_0x8765('0x1b')]=qs[_0x8765('0x1b')](_0x2e0d0a[_0x8765('0x30')][_0x8765('0x1b')]);}return _0xfa4511[_0x8765('0x52')](_0x208714);}})[_0x8765('0x24')](function(_0x374c99){if(_0x374c99){return _0x374c99?{'count':_0x39c10d,'rows':_0x374c99}:null;}})[_0x8765('0x24')](respondWithResult(_0x3a8797,null))[_0x8765('0x43')](handleError(_0x3a8797,null));};exports[_0x8765('0x57')]=function(_0x525825,_0x2e124d,_0x1a781f){return db[_0x8765('0x40')]['findOne']({'where':{'id':_0x525825[_0x8765('0x45')]['id']}})[_0x8765('0x24')](handleEntityNotFound(_0x2e124d,null))[_0x8765('0x24')](function(_0x1fd851){if(_0x1fd851){return db[_0x8765('0x58')][_0x8765('0x59')](function(_0x537ef8){return db['Interval'][_0x8765('0x23')]({'where':{'IntervalId':_0x525825['params']['id']},'transaction':_0x537ef8})[_0x8765('0x24')](function(_0x5751fe){var _0x96aaeb=_[_0x8765('0x2b')](_0x525825[_0x8765('0x48')],function(_0x4423c2){delete _0x4423c2['id'];_0x4423c2['IntervalId']=_0x525825['params']['id'];return _0x4423c2;});return db[_0x8765('0x40')][_0x8765('0x5a')](_0x96aaeb,{'transaction':_0x537ef8});});})[_0x8765('0x24')](function(){return db[_0x8765('0x40')][_0x8765('0x41')]({'where':{'IntervalId':_0x525825['params']['id']}});});}})[_0x8765('0x24')](respondWithResult(_0x2e124d,null))[_0x8765('0x43')](handleError(_0x2e124d,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bd8f993..c96da8a 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 _0x8450=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','rewrite','lodash'];(function(_0xffc56b,_0x5caa71){var _0xa0731b=function(_0x2f8357){while(--_0x2f8357){_0xffc56b['push'](_0xffc56b['shift']());}};_0xa0731b(++_0x5caa71);}(_0x8450,0x137));var _0x0845=function(_0x21480f,_0x255088){_0x21480f=_0x21480f-0x0;var _0x1e0f38=_0x8450[_0x21480f];return _0x1e0f38;};'use strict';var _=require(_0x0845('0x0'));var util=require(_0x0845('0x1'));var logger=require(_0x0845('0x2'))(_0x0845('0x3'));var moment=require(_0x0845('0x4'));var BPromise=require(_0x0845('0x5'));var rp=require(_0x0845('0x6'));var fs=require('fs');var path=require(_0x0845('0x7'));var rimraf=require(_0x0845('0x8'));var config=require(_0x0845('0x9'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0x0845('0xa')]=function(_0x522c11,_0x33ef06){return _0x522c11['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9732d6,_0x57eec7){extensions[_0x0845('0xb')](_0x522c11,_0x9732d6);},'afterBulkCreate':function(_0x48c6b0,_0x4a23c2,_0x4fd6fd){_0x4fd6fd();extensions['rewrite'](_0x522c11,_0x48c6b0[0x0]);},'afterUpdate':function(_0x5980bd,_0x3d0b33){extensions[_0x0845('0xb')](_0x522c11,_0x5980bd);},'afterDestroy':function(_0x12f635,_0xf2a910){extensions[_0x0845('0xb')](_0x522c11,_0x12f635);}}});}; \ No newline at end of file +var _0x3fe9=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','tools_intervals','rewrite','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3fe9,0x164));var _0x93fe=function(_0x5b8987,_0x158467){_0x5b8987=_0x5b8987-0x0;var _0xd68fde=_0x3fe9[_0x5b8987];return _0xd68fde;};'use strict';var _=require(_0x93fe('0x0'));var util=require(_0x93fe('0x1'));var logger=require('../../config/logger')(_0x93fe('0x2'));var moment=require(_0x93fe('0x3'));var BPromise=require(_0x93fe('0x4'));var rp=require(_0x93fe('0x5'));var fs=require('fs');var path=require(_0x93fe('0x6'));var rimraf=require(_0x93fe('0x7'));var config=require(_0x93fe('0x8'));var attributes=require(_0x93fe('0x9'));var extensions=require(_0x93fe('0xa'));module['exports']=function(_0x11e3ee,_0x7e6e47){return _0x11e3ee[_0x93fe('0xb')]('Interval',attributes,{'tableName':_0x93fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x72834d,_0xc9ac3b){extensions['rewrite'](_0x11e3ee,_0x72834d);},'afterBulkCreate':function(_0x5f4029,_0x19b037,_0x5f5de6){_0x5f5de6();extensions['rewrite'](_0x11e3ee,_0x5f4029[0x0]);},'afterUpdate':function(_0x562f3d,_0x16b5f1){extensions[_0x93fe('0xd')](_0x11e3ee,_0x562f3d);},'afterDestroy':function(_0x25852b,_0x270f59){extensions['rewrite'](_0x11e3ee,_0x25852b);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1fe1f99..727c97a 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(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_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);});});}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(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 4489d8b..d61e84c 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x464759,_0x3f6560){var _0x47ef45=function(_0x344ed0){while(--_0x344ed0){_0x464759['push'](_0x464759['shift']());}};_0x47ef45(++_0x3f6560);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5f3f2a,_0x3f7fcd){_0x5f3f2a=_0x5f3f2a-0x0;var _0x13a735=_0x5f2f[_0x5f3f2a];return _0x13a735;};'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')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x2a0094,_0x4eeaa2){var _0x3c2c9d=function(_0x22cc07){while(--_0x22cc07){_0x2a0094['push'](_0x2a0094['shift']());}};_0x3c2c9d(++_0x4eeaa2);}(_0x2ef3,0xba));var _0x32ef=function(_0xacd754,_0x1e042b){_0xacd754=_0xacd754-0x0;var _0x365415=_0x2ef3[_0xacd754];return _0x365415;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index bf8a67f..e109d38 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 _0x98ed=['bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','setEncoding','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','x-forwarded-for','remoteAddress','socket','connection'];(function(_0x2741b5,_0x53e6c8){var _0x30526f=function(_0x2abaab){while(--_0x2abaab){_0x2741b5['push'](_0x2741b5['shift']());}};_0x30526f(++_0x53e6c8);}(_0x98ed,0xa4));var _0xd98e=function(_0x4347cd,_0x562582){_0x4347cd=_0x4347cd-0x0;var _0x40c6d7=_0x98ed[_0x4347cd];return _0x40c6d7;};'use strict';var BPromise=require(_0xd98e('0x0'));var https=require(_0xd98e('0x1'));var logger=require('../../config/logger')(_0xd98e('0x2'));var USERNAME=_0xd98e('0x3');var PASSWORD=_0xd98e('0x4');function openIssue(_0x40a5e2,_0x2599bb){var _0x2f10f3={'fields':{'project':{'key':_0x40a5e2[_0xd98e('0x5')]||_0xd98e('0x6')},'summary':(_0x40a5e2['summary']||'Report')+'\x20from\x20'+_0x40a5e2['ip'],'description':_0x40a5e2[_0xd98e('0x7')]||JSON[_0xd98e('0x8')](_0x40a5e2),'issuetype':{'name':_0x40a5e2[_0xd98e('0x9')]||'Bug'}}};_0x2f10f3[_0xd98e('0xa')][_0xd98e('0xb')]=_0x40a5e2[_0xd98e('0xc')];_0x2f10f3['fields'][_0xd98e('0xd')]=_0x40a5e2[_0xd98e('0xe')];_0x2f10f3[_0xd98e('0xa')][_0xd98e('0xf')]=_0x40a5e2[_0xd98e('0x10')];_0x2f10f3[_0xd98e('0xa')][_0xd98e('0x11')]=_0x40a5e2[_0xd98e('0x12')];_0x2f10f3[_0xd98e('0xa')][_0xd98e('0x13')]=_0x40a5e2[_0xd98e('0x14')];_0x2f10f3['fields']['customfield_10102']=_0x40a5e2['ip'];var _0x1c9b48={'host':_0xd98e('0x15'),'port':0x1bb,'path':_0xd98e('0x16'),'method':_0xd98e('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xd98e('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd98e('0x19'))}};var _0x414fec=JSON[_0xd98e('0x8')](_0x2f10f3);var _0x5b55e6=https['request'](_0x1c9b48,function(_0x3b3b69){_0x3b3b69[_0xd98e('0x1a')]('utf8');var _0x5be971='';_0x3b3b69['on'](_0xd98e('0x1b'),function(_0x49bfca){_0x5be971+=_0x49bfca;});_0x3b3b69['on'](_0xd98e('0x1c'),function(){if(_0x2599bb){return _0x2599bb[_0xd98e('0x1d')](_0x3b3b69[_0xd98e('0x1e')])[_0xd98e('0x1f')](JSON['parse'](_0x5be971));}});});_0x5b55e6['on']('error',function(_0x571e8d){if(_0x2599bb){return _0x2599bb[_0xd98e('0x1d')](0x1f4)[_0xd98e('0x1f')]({'errors':[{'message':_0xd98e('0x20'),'type':_0xd98e('0x21')}]});}});_0x5b55e6[_0xd98e('0x22')](_0x414fec);_0x5b55e6[_0xd98e('0x1c')]();}exports[_0xd98e('0x23')]=openIssue;exports[_0xd98e('0x24')]=function(_0x2c3d23,_0x4d0e98){_0x2c3d23['body']['ip']=_0x2c3d23['headers'][_0xd98e('0x25')]||_0x2c3d23['connection'][_0xd98e('0x26')]||_0x2c3d23[_0xd98e('0x27')][_0xd98e('0x26')]||_0x2c3d23[_0xd98e('0x28')][_0xd98e('0x27')][_0xd98e('0x26')];return openIssue(_0x2c3d23['body'],_0x4d0e98);}; \ No newline at end of file +var _0x1e7b=['data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','support','summary','Report','description','stringify','issuetype','fields','customfield_11500','email','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','setEncoding'];(function(_0x3be577,_0x33c662){var _0x10bbd8=function(_0x42141f){while(--_0x42141f){_0x3be577['push'](_0x3be577['shift']());}};_0x10bbd8(++_0x33c662);}(_0x1e7b,0x64));var _0xb1e7=function(_0x9bcc0b,_0x120f6c){_0x9bcc0b=_0x9bcc0b-0x0;var _0x195399=_0x1e7b[_0x9bcc0b];return _0x195399;};'use strict';var BPromise=require(_0xb1e7('0x0'));var https=require(_0xb1e7('0x1'));var logger=require(_0xb1e7('0x2'))(_0xb1e7('0x3'));var USERNAME=_0xb1e7('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x163872,_0x37097e){var _0x29d3c3={'fields':{'project':{'key':_0x163872['key']||'MOTGUI'},'summary':(_0x163872[_0xb1e7('0x5')]||_0xb1e7('0x6'))+'\x20from\x20'+_0x163872['ip'],'description':_0x163872[_0xb1e7('0x7')]||JSON[_0xb1e7('0x8')](_0x163872),'issuetype':{'name':_0x163872[_0xb1e7('0x9')]||'Bug'}}};_0x29d3c3[_0xb1e7('0xa')][_0xb1e7('0xb')]=_0x163872[_0xb1e7('0xc')];_0x29d3c3['fields']['customfield_11501']=_0x163872[_0xb1e7('0xd')];_0x29d3c3[_0xb1e7('0xa')][_0xb1e7('0xe')]=_0x163872[_0xb1e7('0xf')];_0x29d3c3['fields']['customfield_11503']=_0x163872[_0xb1e7('0x10')];_0x29d3c3[_0xb1e7('0xa')][_0xb1e7('0x11')]=_0x163872[_0xb1e7('0x12')];_0x29d3c3['fields'][_0xb1e7('0x13')]=_0x163872['ip'];var _0x4d42c8={'host':_0xb1e7('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xb1e7('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xb1e7('0x16'),'Authorization':_0xb1e7('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xb1e7('0x18'))}};var _0x311a70=JSON['stringify'](_0x29d3c3);var _0x4615d5=https['request'](_0x4d42c8,function(_0x1fc095){_0x1fc095[_0xb1e7('0x19')]('utf8');var _0x503825='';_0x1fc095['on'](_0xb1e7('0x1a'),function(_0x2df964){_0x503825+=_0x2df964;});_0x1fc095['on'](_0xb1e7('0x1b'),function(){if(_0x37097e){return _0x37097e[_0xb1e7('0x1c')](_0x1fc095[_0xb1e7('0x1d')])[_0xb1e7('0x1e')](JSON[_0xb1e7('0x1f')](_0x503825));}});});_0x4615d5['on'](_0xb1e7('0x20'),function(_0x4c5310){if(_0x37097e){return _0x37097e[_0xb1e7('0x1c')](0x1f4)[_0xb1e7('0x1e')]({'errors':[{'message':_0xb1e7('0x21'),'type':'api.jira'}]});}});_0x4615d5['write'](_0x311a70);_0x4615d5['end']();}exports[_0xb1e7('0x22')]=openIssue;exports[_0xb1e7('0x23')]=function(_0x1fc1b1,_0x285f56){_0x1fc1b1[_0xb1e7('0x24')]['ip']=_0x1fc1b1[_0xb1e7('0x25')][_0xb1e7('0x26')]||_0x1fc1b1['connection'][_0xb1e7('0x27')]||_0x1fc1b1['socket'][_0xb1e7('0x27')]||_0x1fc1b1[_0xb1e7('0x28')][_0xb1e7('0x29')][_0xb1e7('0x27')];return openIssue(_0x1fc1b1[_0xb1e7('0x24')],_0x285f56);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d3ceaa8..4f73eaf 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 _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xaa88,0x137));var _0x8aa8=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xaa88[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file +var _0x6f0d=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x31c648,_0x391992){var _0x5ab3f6=function(_0x9a7c5b){while(--_0x9a7c5b){_0x31c648['push'](_0x31c648['shift']());}};_0x5ab3f6(++_0x391992);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x340403,_0x2e5f82){_0x340403=_0x340403-0x0;var _0x2e028d=_0x6f0d[_0x340403];return _0x2e028d;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['put'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0x12')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x13')]);module[_0xd6f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 37f7a66..f4982a8 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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2798a1,_0x20c603){_0x2798a1=_0x2798a1-0x0;var _0x595a2c=_0x7a54[_0x2798a1];return _0x595a2c;};'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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x1e4618,_0x5de319){_0x1e4618=_0x1e4618-0x0;var _0x3143ed=_0x7a54[_0x1e4618];return _0x3143ed;};'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 a555840..1ba197b 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 _0x236d=['undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','destroy','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4432f2,_0x22697a){var _0x1c97d6=function(_0x1ab5df){while(--_0x1ab5df){_0x4432f2['push'](_0x4432f2['shift']());}};_0x1c97d6(++_0x22697a);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd236('0x2'));var rp=require('request-promise');var moment=require(_0xd236('0x3'));var BPromise=require(_0xd236('0x4'));var Mustache=require(_0xd236('0x5'));var util=require(_0xd236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd236('0x7'));var ejs=require(_0xd236('0x8'));var fs=require('fs');var fs_extra=require(_0xd236('0x9'));var _=require(_0xd236('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd236('0xb'));var deskjs=require(_0xd236('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd236('0xd'));var Papa=require(_0xd236('0xe'));var Redis=require('ioredis');var authService=require(_0xd236('0xf'));var qs=require(_0xd236('0x10'));var as=require(_0xd236('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd236('0x12'))(_0xd236('0x13'));var utils=require(_0xd236('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd236('0x15'));var db=require(_0xd236('0x16'))['db'];function respondWithStatusCode(_0x3d1076,_0x160cb1){_0x160cb1=_0x160cb1||0xcc;return function(_0x21f27b){if(_0x21f27b){return _0x3d1076[_0xd236('0x17')](_0x160cb1);}return _0x3d1076[_0xd236('0x18')](_0x160cb1)[_0xd236('0x19')]();};}function respondWithResult(_0x22435c,_0x3d7465){_0x3d7465=_0x3d7465||0xc8;return function(_0x348734){if(_0x348734){return _0x22435c[_0xd236('0x18')](_0x3d7465)[_0xd236('0x1a')](_0x348734);}};}function respondWithFilteredResult(_0x3b60a7,_0xd851b5){return function(_0x3b2535){if(_0x3b2535){var _0x2a076d=typeof _0xd851b5[_0xd236('0x1b')]===_0xd236('0x1c')&&typeof _0xd851b5[_0xd236('0x1d')]==='undefined';var _0x4f06c6=_0x3b2535[_0xd236('0x1e')];var _0x1b02a5=_0x2a076d?0x0:_0xd851b5['offset'];var _0x11c6ec=_0x2a076d?_0x3b2535[_0xd236('0x1e')]:_0xd851b5[_0xd236('0x1b')]+_0xd851b5['limit'];var _0x355b65;if(_0x11c6ec>=_0x4f06c6){_0x11c6ec=_0x4f06c6;_0x355b65=0xc8;}else{_0x355b65=0xce;}_0x3b60a7[_0xd236('0x18')](_0x355b65);return _0x3b60a7[_0xd236('0x1f')]('Content-Range',_0x1b02a5+'-'+_0x11c6ec+'/'+_0x4f06c6)[_0xd236('0x1a')](_0x3b2535);}return null;};}function patchUpdates(_0x3b0a27){return function(_0x26c758){try{jsonpatch[_0xd236('0x20')](_0x26c758,_0x3b0a27,!![]);}catch(_0x2f512d){return BPromise['reject'](_0x2f512d);}return _0x26c758[_0xd236('0x21')]();};}function saveUpdates(_0x30e7aa,_0x1e4ddb){return function(_0x3d1e4e){if(_0x3d1e4e){return _0x3d1e4e[_0xd236('0x22')](_0x30e7aa)['then'](function(_0x4a35d0){return _0x4a35d0;});}return null;};}function removeEntity(_0x257f27,_0x4be5ac){return function(_0x22924d){if(_0x22924d){return _0x22924d['destroy']()[_0xd236('0x23')](function(){_0x257f27[_0xd236('0x18')](0xcc)[_0xd236('0x19')]();});}};}function handleEntityNotFound(_0x49d822,_0x41049a){return function(_0x339b08){if(!_0x339b08){_0x49d822[_0xd236('0x17')](0x194);}return _0x339b08;};}function handleError(_0x13ba7a,_0x3a30d8){_0x3a30d8=_0x3a30d8||0x1f4;return function(_0x17f927){logger[_0xd236('0x24')](_0x17f927[_0xd236('0x25')]);if(_0x17f927[_0xd236('0x26')]){delete _0x17f927[_0xd236('0x26')];}_0x13ba7a[_0xd236('0x18')](_0x3a30d8)[_0xd236('0x27')](_0x17f927);};}exports[_0xd236('0x28')]=function(_0x23714d,_0x3108f4){var _0x28175d={},_0x436a19={},_0x471ed6={'count':0x0,'rows':[]};var _0x463fc8=_[_0xd236('0x29')](db[_0xd236('0x2a')][_0xd236('0x2b')],function(_0x3c1617){return{'name':_0x3c1617[_0xd236('0x2c')],'type':_0x3c1617[_0xd236('0x2d')][_0xd236('0x2e')]};});_0x436a19[_0xd236('0x2f')]=_[_0xd236('0x29')](_0x463fc8,_0xd236('0x26'));_0x436a19['query']=_[_0xd236('0x30')](_0x23714d['query']);_0x436a19[_0xd236('0x31')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],_0x436a19['query']);_0x28175d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x23714d[_0xd236('0x35')][_0xd236('0x34')]));_0x28175d[_0xd236('0x33')]=_0x28175d['attributes'][_0xd236('0x36')]?_0x28175d['attributes']:_0x436a19[_0xd236('0x2f')];if(!_0x23714d['query'][_0xd236('0x37')](_0xd236('0x38'))){_0x28175d[_0xd236('0x1d')]=qs[_0xd236('0x1d')](_0x23714d[_0xd236('0x35')][_0xd236('0x1d')]);_0x28175d[_0xd236('0x1b')]=qs[_0xd236('0x1b')](_0x23714d[_0xd236('0x35')][_0xd236('0x1b')]);}_0x28175d[_0xd236('0x39')]=qs[_0xd236('0x3a')](_0x23714d[_0xd236('0x35')]['sort']);_0x28175d[_0xd236('0x3b')]=qs[_0xd236('0x31')](_[_0xd236('0x3c')](_0x23714d['query'],_0x436a19[_0xd236('0x31')]),_0x463fc8);if(_0x23714d[_0xd236('0x35')][_0xd236('0x3d')]){_0x28175d[_0xd236('0x3b')]=_[_0xd236('0x3e')](_0x28175d[_0xd236('0x3b')],{'$or':_['map'](_0x463fc8,function(_0x696bed){if(_0x696bed[_0xd236('0x2d')]!==_0xd236('0x3f')){var _0x3c798f={};_0x3c798f[_0x696bed[_0xd236('0x26')]]={'$like':'%'+_0x23714d[_0xd236('0x35')]['filter']+'%'};return _0x3c798f;}})});}_0x28175d=_[_0xd236('0x3e')]({},_0x28175d,_0x23714d[_0xd236('0x40')]);var _0x2ba3ae={'where':_0x28175d['where']};return db[_0xd236('0x2a')]['count'](_0x2ba3ae)[_0xd236('0x23')](function(_0x5793bf){_0x471ed6['count']=_0x5793bf;if(_0x23714d[_0xd236('0x35')][_0xd236('0x41')]){_0x28175d[_0xd236('0x42')]=[{'all':!![]}];}return db[_0xd236('0x2a')][_0xd236('0x43')](_0x28175d);})['then'](function(_0x4d0d65){_0x471ed6[_0xd236('0x44')]=_0x4d0d65;return _0x471ed6;})[_0xd236('0x23')](respondWithFilteredResult(_0x3108f4,_0x28175d))['catch'](handleError(_0x3108f4,null));};exports[_0xd236('0x45')]=function(_0x342fd5,_0x2d815b){var _0x55007d={'raw':!![],'where':{'id':_0x342fd5['params']['id']}},_0x58a93a={};_0x58a93a[_0xd236('0x2f')]=_['keys'](db['JscriptyAnswerReport'][_0xd236('0x2b')]);_0x58a93a[_0xd236('0x35')]=_[_0xd236('0x30')](_0x342fd5[_0xd236('0x35')]);_0x58a93a[_0xd236('0x31')]=_['intersection'](_0x58a93a['model'],_0x58a93a[_0xd236('0x35')]);_0x55007d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x58a93a[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x342fd5[_0xd236('0x35')]['fields']));_0x55007d[_0xd236('0x33')]=_0x55007d['attributes'][_0xd236('0x36')]?_0x55007d[_0xd236('0x33')]:_0x58a93a['model'];if(_0x342fd5['query']['includeAll']){_0x55007d['include']=[{'all':!![]}];}_0x55007d=_[_0xd236('0x3e')]({},_0x55007d,_0x342fd5[_0xd236('0x40')]);return db[_0xd236('0x2a')][_0xd236('0x46')](_0x55007d)[_0xd236('0x23')](handleEntityNotFound(_0x2d815b,null))['then'](respondWithResult(_0x2d815b,null))['catch'](handleError(_0x2d815b,null));};exports[_0xd236('0x47')]=function(_0x7c0650,_0xbf4ba9){return db[_0xd236('0x2a')][_0xd236('0x47')](_0x7c0650[_0xd236('0x48')],{})['then'](respondWithResult(_0xbf4ba9,0xc9))[_0xd236('0x49')](handleError(_0xbf4ba9,null));};exports['update']=function(_0x223a14,_0x2c8861){if(_0x223a14['body']['id']){delete _0x223a14[_0xd236('0x48')]['id'];}return db[_0xd236('0x2a')]['find']({'where':{'id':_0x223a14['params']['id']}})[_0xd236('0x23')](handleEntityNotFound(_0x2c8861,null))[_0xd236('0x23')](saveUpdates(_0x223a14[_0xd236('0x48')],null))[_0xd236('0x23')](respondWithResult(_0x2c8861,null))['catch'](handleError(_0x2c8861,null));};exports[_0xd236('0x4a')]=function(_0x43c12b,_0x3d8ca6){return db[_0xd236('0x2a')][_0xd236('0x46')]({'where':{'id':_0x43c12b[_0xd236('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d8ca6,null))['then'](removeEntity(_0x3d8ca6,null))[_0xd236('0x49')](handleError(_0x3d8ca6,null));};exports['describe']=function(_0xa39da6,_0x30c336){return db['JscriptyAnswerReport'][_0xd236('0x4c')]()[_0xd236('0x23')](respondWithResult(_0x30c336,null))['catch'](handleError(_0x30c336,null));}; \ No newline at end of file +var _0xcca7=['count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','offset','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','undefined'];(function(_0x28dff0,_0x52bcdc){var _0x1cde00=function(_0x159056){while(--_0x159056){_0x28dff0['push'](_0x28dff0['shift']());}};_0x1cde00(++_0x52bcdc);}(_0xcca7,0x1aa));var _0x7cca=function(_0x259ba1,_0x18665d){_0x259ba1=_0x259ba1-0x0;var _0xffb330=_0xcca7[_0x259ba1];return _0xffb330;};'use strict';var emlformat=require(_0x7cca('0x0'));var rimraf=require(_0x7cca('0x1'));var zipdir=require(_0x7cca('0x2'));var jsonpatch=require(_0x7cca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7cca('0x4'));var Mustache=require('mustache');var util=require(_0x7cca('0x5'));var path=require(_0x7cca('0x6'));var sox=require(_0x7cca('0x7'));var csv=require(_0x7cca('0x8'));var ejs=require(_0x7cca('0x9'));var fs=require('fs');var fs_extra=require(_0x7cca('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x8'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var licenseUtil=require(_0x7cca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a14cc,_0x41e0a2){_0x41e0a2=_0x41e0a2||0xcc;return function(_0x2854c7){if(_0x2854c7){return _0x2a14cc['sendStatus'](_0x41e0a2);}return _0x2a14cc['status'](_0x41e0a2)[_0x7cca('0x19')]();};}function respondWithResult(_0x20c1b2,_0x27d671){_0x27d671=_0x27d671||0xc8;return function(_0x847cce){if(_0x847cce){return _0x20c1b2[_0x7cca('0x1a')](_0x27d671)[_0x7cca('0x1b')](_0x847cce);}};}function respondWithFilteredResult(_0x45143d,_0x5a357d){return function(_0x216d4b){if(_0x216d4b){var _0x533608=typeof _0x5a357d['offset']==='undefined'&&typeof _0x5a357d[_0x7cca('0x1c')]===_0x7cca('0x1d');var _0x1dd043=_0x216d4b[_0x7cca('0x1e')];var _0x44294b=_0x533608?0x0:_0x5a357d['offset'];var _0xb35e1d=_0x533608?_0x216d4b['count']:_0x5a357d['offset']+_0x5a357d['limit'];var _0x370469;if(_0xb35e1d>=_0x1dd043){_0xb35e1d=_0x1dd043;_0x370469=0xc8;}else{_0x370469=0xce;}_0x45143d[_0x7cca('0x1a')](_0x370469);return _0x45143d[_0x7cca('0x1f')](_0x7cca('0x20'),_0x44294b+'-'+_0xb35e1d+'/'+_0x1dd043)[_0x7cca('0x1b')](_0x216d4b);}return null;};}function patchUpdates(_0x45db2f){return function(_0x2e023c){try{jsonpatch[_0x7cca('0x21')](_0x2e023c,_0x45db2f,!![]);}catch(_0x4d7804){return BPromise[_0x7cca('0x22')](_0x4d7804);}return _0x2e023c[_0x7cca('0x23')]();};}function saveUpdates(_0x165d13,_0x4343a3){return function(_0x55b689){if(_0x55b689){return _0x55b689[_0x7cca('0x24')](_0x165d13)[_0x7cca('0x25')](function(_0x4367f9){return _0x4367f9;});}return null;};}function removeEntity(_0x119d76,_0x823d7d){return function(_0x3fc157){if(_0x3fc157){return _0x3fc157[_0x7cca('0x26')]()[_0x7cca('0x25')](function(){_0x119d76['status'](0xcc)[_0x7cca('0x19')]();});}};}function handleEntityNotFound(_0x1dd3b3,_0x1774fc){return function(_0xdaf07f){if(!_0xdaf07f){_0x1dd3b3[_0x7cca('0x27')](0x194);}return _0xdaf07f;};}function handleError(_0x21da68,_0x35ebe8){_0x35ebe8=_0x35ebe8||0x1f4;return function(_0x40ac86){logger['error'](_0x40ac86[_0x7cca('0x28')]);if(_0x40ac86['name']){delete _0x40ac86[_0x7cca('0x29')];}_0x21da68[_0x7cca('0x1a')](_0x35ebe8)['send'](_0x40ac86);};}exports[_0x7cca('0x2a')]=function(_0x3d91b1,_0x5533fb){var _0x249442={},_0x1cd53a={},_0x100061={'count':0x0,'rows':[]};var _0x52fb40=_['map'](db[_0x7cca('0x2b')][_0x7cca('0x2c')],function(_0x3797f4){return{'name':_0x3797f4[_0x7cca('0x2d')],'type':_0x3797f4[_0x7cca('0x2e')][_0x7cca('0x2f')]};});_0x1cd53a[_0x7cca('0x30')]=_['map'](_0x52fb40,'name');_0x1cd53a[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x3d91b1[_0x7cca('0x31')]);_0x1cd53a['filters']=_[_0x7cca('0x33')](_0x1cd53a['model'],_0x1cd53a[_0x7cca('0x31')]);_0x249442[_0x7cca('0x34')]=_[_0x7cca('0x33')](_0x1cd53a[_0x7cca('0x30')],qs['fields'](_0x3d91b1[_0x7cca('0x31')][_0x7cca('0x35')]));_0x249442[_0x7cca('0x34')]=_0x249442['attributes']['length']?_0x249442['attributes']:_0x1cd53a[_0x7cca('0x30')];if(!_0x3d91b1[_0x7cca('0x31')]['hasOwnProperty'](_0x7cca('0x36'))){_0x249442[_0x7cca('0x1c')]=qs[_0x7cca('0x1c')](_0x3d91b1[_0x7cca('0x31')][_0x7cca('0x1c')]);_0x249442[_0x7cca('0x37')]=qs[_0x7cca('0x37')](_0x3d91b1['query'][_0x7cca('0x37')]);}_0x249442[_0x7cca('0x38')]=qs[_0x7cca('0x39')](_0x3d91b1[_0x7cca('0x31')]['sort']);_0x249442[_0x7cca('0x3a')]=qs[_0x7cca('0x3b')](_[_0x7cca('0x3c')](_0x3d91b1['query'],_0x1cd53a[_0x7cca('0x3b')]),_0x52fb40);if(_0x3d91b1['query'][_0x7cca('0x3d')]){_0x249442[_0x7cca('0x3a')]=_[_0x7cca('0x3e')](_0x249442[_0x7cca('0x3a')],{'$or':_[_0x7cca('0x3f')](_0x52fb40,function(_0x25b3a9){if(_0x25b3a9[_0x7cca('0x2e')]!==_0x7cca('0x40')){var _0x3617b8={};_0x3617b8[_0x25b3a9['name']]={'$like':'%'+_0x3d91b1['query'][_0x7cca('0x3d')]+'%'};return _0x3617b8;}})});}_0x249442=_[_0x7cca('0x3e')]({},_0x249442,_0x3d91b1['options']);var _0x48d87f={'where':_0x249442[_0x7cca('0x3a')]};return db[_0x7cca('0x2b')][_0x7cca('0x1e')](_0x48d87f)[_0x7cca('0x25')](function(_0x371c67){_0x100061['count']=_0x371c67;if(_0x3d91b1[_0x7cca('0x31')]['includeAll']){_0x249442['include']=[{'all':!![]}];}return db[_0x7cca('0x2b')][_0x7cca('0x41')](_0x249442);})['then'](function(_0x3b120b){_0x100061['rows']=_0x3b120b;return _0x100061;})[_0x7cca('0x25')](respondWithFilteredResult(_0x5533fb,_0x249442))[_0x7cca('0x42')](handleError(_0x5533fb,null));};exports[_0x7cca('0x43')]=function(_0x47e2e6,_0xb966da){var _0x207250={'raw':!![],'where':{'id':_0x47e2e6[_0x7cca('0x44')]['id']}},_0x2e8d97={};_0x2e8d97['model']=_[_0x7cca('0x32')](db[_0x7cca('0x2b')][_0x7cca('0x2c')]);_0x2e8d97[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x47e2e6[_0x7cca('0x31')]);_0x2e8d97['filters']=_['intersection'](_0x2e8d97['model'],_0x2e8d97['query']);_0x207250[_0x7cca('0x34')]=_['intersection'](_0x2e8d97['model'],qs[_0x7cca('0x35')](_0x47e2e6[_0x7cca('0x31')][_0x7cca('0x35')]));_0x207250[_0x7cca('0x34')]=_0x207250[_0x7cca('0x34')]['length']?_0x207250[_0x7cca('0x34')]:_0x2e8d97[_0x7cca('0x30')];if(_0x47e2e6[_0x7cca('0x31')][_0x7cca('0x45')]){_0x207250[_0x7cca('0x46')]=[{'all':!![]}];}_0x207250=_[_0x7cca('0x3e')]({},_0x207250,_0x47e2e6[_0x7cca('0x47')]);return db[_0x7cca('0x2b')][_0x7cca('0x48')](_0x207250)[_0x7cca('0x25')](handleEntityNotFound(_0xb966da,null))[_0x7cca('0x25')](respondWithResult(_0xb966da,null))['catch'](handleError(_0xb966da,null));};exports['create']=function(_0x36f12f,_0x5913eb){return db[_0x7cca('0x2b')][_0x7cca('0x49')](_0x36f12f[_0x7cca('0x4a')],{})[_0x7cca('0x25')](respondWithResult(_0x5913eb,0xc9))[_0x7cca('0x42')](handleError(_0x5913eb,null));};exports[_0x7cca('0x24')]=function(_0x184b56,_0xe0059e){if(_0x184b56[_0x7cca('0x4a')]['id']){delete _0x184b56[_0x7cca('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0x7cca('0x48')]({'where':{'id':_0x184b56[_0x7cca('0x44')]['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0xe0059e,null))[_0x7cca('0x25')](saveUpdates(_0x184b56[_0x7cca('0x4a')],null))[_0x7cca('0x25')](respondWithResult(_0xe0059e,null))[_0x7cca('0x42')](handleError(_0xe0059e,null));};exports[_0x7cca('0x26')]=function(_0x218114,_0x43c581){return db[_0x7cca('0x2b')][_0x7cca('0x48')]({'where':{'id':_0x218114[_0x7cca('0x44')]['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0x43c581,null))[_0x7cca('0x25')](removeEntity(_0x43c581,null))[_0x7cca('0x42')](handleError(_0x43c581,null));};exports[_0x7cca('0x4b')]=function(_0x27c527,_0x343a64){return db[_0x7cca('0x2b')][_0x7cca('0x4b')]()[_0x7cca('0x25')](respondWithResult(_0x343a64,null))[_0x7cca('0x42')](handleError(_0x343a64,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b052030..86c1d3f 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 _0xfc5f=['request-promise','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird'];(function(_0x14d8a9,_0x1fbcfb){var _0x2e7672=function(_0x1017d0){while(--_0x1017d0){_0x14d8a9['push'](_0x14d8a9['shift']());}};_0x2e7672(++_0x1fbcfb);}(_0xfc5f,0x1d1));var _0xffc5=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xfc5f[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xffc5('0x0'));var util=require(_0xffc5('0x1'));var logger=require(_0xffc5('0x2'))(_0xffc5('0x3'));var moment=require('moment');var BPromise=require(_0xffc5('0x4'));var rp=require(_0xffc5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xffc5('0x6'));var attributes=require(_0xffc5('0x7'));module['exports']=function(_0x3dab28,_0x5a5335){return _0x3dab28['define'](_0xffc5('0x8'),attributes,{'tableName':_0xffc5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac5b=['define','JscriptyAnswerReport','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x285a20,_0x563fd5){var _0x4c1daa=function(_0x4b8219){while(--_0x4b8219){_0x285a20['push'](_0x285a20['shift']());}};_0x4c1daa(++_0x563fd5);}(_0xac5b,0x1e6));var _0xbac5=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xac5b[_0x52684f];return _0x4a55f0;};'use strict';var _=require('lodash');var util=require(_0xbac5('0x0'));var logger=require(_0xbac5('0x1'))('api');var moment=require(_0xbac5('0x2'));var BPromise=require(_0xbac5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbac5('0x4'));var rimraf=require(_0xbac5('0x5'));var config=require(_0xbac5('0x6'));var attributes=require(_0xbac5('0x7'));module[_0xbac5('0x8')]=function(_0x198790,_0x4c2135){return _0x198790[_0xbac5('0x9')](_0xbac5('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 421d195..ae68765 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 _0xb328=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xb328,0x150));var _0x8b32=function(_0x49f5a3,_0x3e3857){_0x49f5a3=_0x49f5a3-0x0;var _0x31c138=_0xb328[_0x49f5a3];return _0x31c138;};'use strict';var _=require('lodash');var util=require(_0x8b32('0x0'));var moment=require(_0x8b32('0x1'));var BPromise=require(_0x8b32('0x2'));var rs=require(_0x8b32('0x3'));var fs=require('fs');var Redis=require(_0x8b32('0x4'));var db=require(_0x8b32('0x5'))['db'];var utils=require(_0x8b32('0x6'));var logger=require(_0x8b32('0x7'))(_0x8b32('0x8'));var config=require(_0x8b32('0x9'));var jayson=require(_0x8b32('0xa'));var client=jayson['client'][_0x8b32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x553f92,_0x5ea26a,_0x2274e4){return new BPromise(function(_0x5ace2f,_0x171fb1){return client['request'](_0x553f92,_0x2274e4)[_0x8b32('0xc')](function(_0x1becf2){logger['info'](_0x8b32('0xd'),_0x5ea26a,'request\x20sent');logger['debug'](_0x8b32('0xe'),_0x5ea26a,_0x8b32('0xf'),JSON[_0x8b32('0x10')](_0x1becf2));if(_0x1becf2['error']){if(_0x1becf2[_0x8b32('0x11')]['code']===0x1f4){logger['error'](_0x8b32('0xd'),_0x5ea26a,_0x1becf2[_0x8b32('0x11')][_0x8b32('0x12')]);return _0x171fb1(_0x1becf2[_0x8b32('0x11')][_0x8b32('0x12')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5ea26a,_0x1becf2['error'][_0x8b32('0x12')]);return _0x5ace2f(_0x1becf2['error'][_0x8b32('0x12')]);}else{logger['info'](_0x8b32('0xd'),_0x5ea26a,_0x8b32('0xf'));_0x5ace2f(_0x1becf2[_0x8b32('0x13')][_0x8b32('0x12')]);}})[_0x8b32('0x14')](function(_0x1df76c){logger[_0x8b32('0x11')](_0x8b32('0xd'),_0x5ea26a,_0x1df76c);_0x171fb1(_0x1df76c);});});} \ No newline at end of file +var _0x1db6=['then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x28f47a,_0x485b5d){var _0x326ee0=function(_0xac86c1){while(--_0xac86c1){_0x28f47a['push'](_0x28f47a['shift']());}};_0x326ee0(++_0x485b5d);}(_0x1db6,0x86));var _0x61db=function(_0x5212d1,_0x185d1e){_0x5212d1=_0x5212d1-0x0;var _0x2dbdba=_0x1db6[_0x5212d1];return _0x2dbdba;};'use strict';var _=require(_0x61db('0x0'));var util=require(_0x61db('0x1'));var moment=require(_0x61db('0x2'));var BPromise=require(_0x61db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x61db('0x5'));var logger=require(_0x61db('0x6'))(_0x61db('0x7'));var config=require(_0x61db('0x8'));var jayson=require(_0x61db('0x9'));var client=jayson[_0x61db('0xa')][_0x61db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x72300b,_0x45ffe3,_0x57131d){return new BPromise(function(_0x4e787e,_0x3252e7){return client[_0x61db('0xc')](_0x72300b,_0x57131d)[_0x61db('0xd')](function(_0x97cbad){logger[_0x61db('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x45ffe3,_0x61db('0xf'));logger['debug'](_0x61db('0x10'),_0x45ffe3,'request\x20sent',JSON['stringify'](_0x97cbad));if(_0x97cbad[_0x61db('0x11')]){if(_0x97cbad['error']['code']===0x1f4){logger['error'](_0x61db('0x12'),_0x45ffe3,_0x97cbad['error'][_0x61db('0x13')]);return _0x3252e7(_0x97cbad[_0x61db('0x11')][_0x61db('0x13')]);}logger[_0x61db('0x11')](_0x61db('0x12'),_0x45ffe3,_0x97cbad[_0x61db('0x11')][_0x61db('0x13')]);return _0x4e787e(_0x97cbad[_0x61db('0x11')][_0x61db('0x13')]);}else{logger[_0x61db('0xe')](_0x61db('0x12'),_0x45ffe3,'request\x20sent');_0x4e787e(_0x97cbad['result'][_0x61db('0x13')]);}})[_0x61db('0x14')](function(_0x2d394a){logger[_0x61db('0x11')](_0x61db('0x12'),_0x45ffe3,_0x2d394a);_0x3252e7(_0x2d394a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ae09fc8..c45c9fb 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 _0x1dca=['../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x1dca,0x1aa));var _0xa1dc=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x1dca[_0x30bd4d];return _0x306915;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa1dc('0x0'));var timeout=require(_0xa1dc('0x1'));var express=require(_0xa1dc('0x2'));var router=express[_0xa1dc('0x3')]();var fs_extra=require(_0xa1dc('0x4'));var auth=require(_0xa1dc('0x5'));var interaction=require(_0xa1dc('0x6'));var config=require('../../config/environment');var controller=require(_0xa1dc('0x7'));router['get']('/',auth[_0xa1dc('0x8')](),controller[_0xa1dc('0x9')]);router[_0xa1dc('0xa')](_0xa1dc('0xb'),auth[_0xa1dc('0x8')](),controller[_0xa1dc('0xc')]);router[_0xa1dc('0xa')](_0xa1dc('0xd'),auth[_0xa1dc('0x8')](),controller[_0xa1dc('0xe')]);router[_0xa1dc('0xa')](_0xa1dc('0xf'),auth[_0xa1dc('0x8')](),controller[_0xa1dc('0x10')]);router[_0xa1dc('0xa')](_0xa1dc('0x11'),auth[_0xa1dc('0x8')](),timeout('30s'),controller['getSummary']);router[_0xa1dc('0x12')]('/',auth[_0xa1dc('0x8')](),controller[_0xa1dc('0x13')]);router['post'](_0xa1dc('0x14'),auth[_0xa1dc('0x8')](),controller[_0xa1dc('0x15')]);router[_0xa1dc('0x16')](_0xa1dc('0xb'),auth[_0xa1dc('0x8')](),controller[_0xa1dc('0x17')]);router[_0xa1dc('0x18')](_0xa1dc('0xb'),auth[_0xa1dc('0x8')](),controller[_0xa1dc('0x19')]);module[_0xa1dc('0x1a')]=router; \ No newline at end of file +var _0x19b7=['getAnswers','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','/:id/sessions','getSessions'];(function(_0x38536d,_0xbe6f3d){var _0x5c222b=function(_0x22e8d5){while(--_0x22e8d5){_0x38536d['push'](_0x38536d['shift']());}};_0x5c222b(++_0xbe6f3d);}(_0x19b7,0x1d3));var _0x719b=function(_0x534dc1,_0x38cd45){_0x534dc1=_0x534dc1-0x0;var _0x1619c3=_0x19b7[_0x534dc1];return _0x1619c3;};'use strict';var multer=require(_0x719b('0x0'));var util=require(_0x719b('0x1'));var path=require('path');var timeout=require(_0x719b('0x2'));var express=require(_0x719b('0x3'));var router=express[_0x719b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x719b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x719b('0x6'));var controller=require(_0x719b('0x7'));router[_0x719b('0x8')]('/',auth[_0x719b('0x9')](),controller['index']);router['get'](_0x719b('0xa'),auth[_0x719b('0x9')](),controller['show']);router[_0x719b('0x8')](_0x719b('0xb'),auth[_0x719b('0x9')](),controller[_0x719b('0xc')]);router[_0x719b('0x8')]('/:id/answers',auth['isAuthenticated'](),controller[_0x719b('0xd')]);router[_0x719b('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout('30s'),controller[_0x719b('0xe')]);router[_0x719b('0xf')]('/',auth[_0x719b('0x9')](),controller[_0x719b('0x10')]);router['post'](_0x719b('0x11'),auth[_0x719b('0x9')](),controller[_0x719b('0x12')]);router[_0x719b('0x13')](_0x719b('0xa'),auth['isAuthenticated'](),controller[_0x719b('0x14')]);router[_0x719b('0x15')](_0x719b('0xa'),auth[_0x719b('0x9')](),controller[_0x719b('0x16')]);module[_0x719b('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 39680b0..195188d 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 _0x2a0c=['isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','STRING','name','TEXT','long'];(function(_0x28536e,_0x2ef64c){var _0x5be909=function(_0x5a0c9a){while(--_0x5a0c9a){_0x28536e['push'](_0x28536e['shift']());}};_0x5be909(++_0x2ef64c);}(_0x2a0c,0x1c9));var _0xc2a0=function(_0x5bc39d,_0x53260d){_0x5bc39d=_0x5bc39d-0x0;var _0x278775=_0x2a0c[_0x5bc39d];return _0x278775;};'use strict';var Sequelize=require(_0xc2a0('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xc2a0('0x1')],'unique':_0xc2a0('0x2')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc2a0('0x3')](_0xc2a0('0x4')),'set':function(_0x511c7e){if(_[_0xc2a0('0x5')](_0x511c7e)){this[_0xc2a0('0x6')]('formData',JSON[_0xc2a0('0x7')](_0x511c7e));}else if(_[_0xc2a0('0x8')](_0x511c7e)){this[_0xc2a0('0x6')](_0xc2a0('0x9'),_0x511c7e);}else{this[_0xc2a0('0x6')](_0xc2a0('0x9'),util[_0xc2a0('0xa')](_0xc2a0('0xb'),this[_0xc2a0('0xc')]('name')||'',this['getDataValue'](_0xc2a0('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x343d=['sequelize','lodash','exports','STRING','TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN'];(function(_0x186046,_0x456ae1){var _0x249be8=function(_0x4442d6){while(--_0x4442d6){_0x186046['push'](_0x186046['shift']());}};_0x249be8(++_0x456ae1);}(_0x343d,0x78));var _0xd343=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x343d[_0x3e0763];return _0x351ca2;};'use strict';var Sequelize=require(_0xd343('0x0'));var _=require(_0xd343('0x1'));var util=require('util');module[_0xd343('0x2')]={'name':{'type':Sequelize[_0xd343('0x3')],'unique':'name'},'description':{'type':Sequelize[_0xd343('0x3')]},'formData':{'type':Sequelize[_0xd343('0x4')](_0xd343('0x5')),'set':function(_0x1f8348){if(_[_0xd343('0x6')](_0x1f8348)){this['setDataValue']('formData',JSON[_0xd343('0x7')](_0x1f8348));}else if(_[_0xd343('0x8')](_0x1f8348)){this[_0xd343('0x9')](_0xd343('0xa'),_0x1f8348);}else{this['setDataValue']('formData',util[_0xd343('0xb')](_0xd343('0xc'),this[_0xd343('0xd')]('name')||'',this[_0xd343('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd343('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1f1bea9..ce5b960 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 _0x85de=['question','starttime','format','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','JscriptyProject','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getSessions','findOne','JscriptySessionReport','ProjectId','count','JscriptyAnswerReport','length','fromCharCode','toString','indexOf','replace','getSummary','parse','JscriptyQuestionReport','-createdAt','questionId'];(function(_0x1e8a13,_0x150633){var _0x1b5c34=function(_0x30c678){while(--_0x30c678){_0x1e8a13['push'](_0x1e8a13['shift']());}};_0x1b5c34(++_0x150633);}(_0x85de,0x1f0));var _0xe85d=function(_0xf967ca,_0x381488){_0xf967ca=_0xf967ca-0x0;var _0x3a975b=_0x85de[_0xf967ca];return _0x3a975b;};'use strict';var emlformat=require(_0xe85d('0x0'));var rimraf=require(_0xe85d('0x1'));var zipdir=require(_0xe85d('0x2'));var jsonpatch=require(_0xe85d('0x3'));var rp=require(_0xe85d('0x4'));var moment=require('moment');var BPromise=require(_0xe85d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe85d('0x6'));var sox=require(_0xe85d('0x7'));var csv=require('to-csv');var ejs=require(_0xe85d('0x8'));var fs=require('fs');var fs_extra=require(_0xe85d('0x9'));var _=require(_0xe85d('0xa'));var squel=require(_0xe85d('0xb'));var crypto=require(_0xe85d('0xc'));var jsforce=require(_0xe85d('0xd'));var deskjs=require(_0xe85d('0xe'));var toCsv=require(_0xe85d('0xf'));var querystring=require('querystring');var Papa=require(_0xe85d('0x10'));var Redis=require(_0xe85d('0x11'));var authService=require(_0xe85d('0x12'));var qs=require(_0xe85d('0x13'));var as=require(_0xe85d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85d('0x15'))('api');var utils=require(_0xe85d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe85d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec59a,_0x1fc972){_0x1fc972=_0x1fc972||0xcc;return function(_0x10dd73){if(_0x10dd73){return _0x3ec59a[_0xe85d('0x18')](_0x1fc972);}return _0x3ec59a[_0xe85d('0x19')](_0x1fc972)[_0xe85d('0x1a')]();};}function respondWithResult(_0xe3d1ca,_0x59382f){_0x59382f=_0x59382f||0xc8;return function(_0xe78813){if(_0xe78813){return _0xe3d1ca[_0xe85d('0x19')](_0x59382f)['json'](_0xe78813);}};}function respondWithFilteredResult(_0x2750e8,_0x11aa3d){return function(_0x174d06){if(_0x174d06){var _0x1e56c5=typeof _0x11aa3d[_0xe85d('0x1b')]===_0xe85d('0x1c')&&typeof _0x11aa3d[_0xe85d('0x1d')]===_0xe85d('0x1c');var _0x12cf32=_0x174d06['count'];var _0x2fc882=_0x1e56c5?0x0:_0x11aa3d['offset'];var _0x289384=_0x1e56c5?_0x174d06['count']:_0x11aa3d['offset']+_0x11aa3d['limit'];var _0xed29b9;if(_0x289384>=_0x12cf32){_0x289384=_0x12cf32;_0xed29b9=0xc8;}else{_0xed29b9=0xce;}_0x2750e8[_0xe85d('0x19')](_0xed29b9);return _0x2750e8[_0xe85d('0x1e')]('Content-Range',_0x2fc882+'-'+_0x289384+'/'+_0x12cf32)[_0xe85d('0x1f')](_0x174d06);}return null;};}function patchUpdates(_0x1cf621){return function(_0x44bab0){try{jsonpatch[_0xe85d('0x20')](_0x44bab0,_0x1cf621,!![]);}catch(_0x144380){return BPromise[_0xe85d('0x21')](_0x144380);}return _0x44bab0[_0xe85d('0x22')]();};}function saveUpdates(_0x2f77d8,_0x4d9970){return function(_0x296f02){if(_0x296f02){return _0x296f02[_0xe85d('0x23')](_0x2f77d8)[_0xe85d('0x24')](function(_0x3a95be){return _0x3a95be;});}return null;};}function removeEntity(_0x22a5c5,_0x58c73f){return function(_0x2672a3){if(_0x2672a3){return _0x2672a3[_0xe85d('0x25')]()['then'](function(){var _0x44a48c=_0x2672a3[_0xe85d('0x26')]({'plain':!![]});var _0x393902=_0xe85d('0x27');return db[_0xe85d('0x28')][_0xe85d('0x25')]({'where':{'type':_0x393902,'resourceId':_0x44a48c['id']}})[_0xe85d('0x24')](function(){return _0x2672a3;});})[_0xe85d('0x24')](function(){_0x22a5c5['status'](0xcc)[_0xe85d('0x1a')]();});}};}function handleEntityNotFound(_0x1ce626,_0x3c459c){return function(_0x591f7c){if(!_0x591f7c){_0x1ce626[_0xe85d('0x18')](0x194);}return _0x591f7c;};}function handleError(_0x29b4d5,_0xa88e5b){_0xa88e5b=_0xa88e5b||0x1f4;return function(_0x1a7892){logger['error'](_0x1a7892[_0xe85d('0x29')]);if(_0x1a7892[_0xe85d('0x2a')]){delete _0x1a7892[_0xe85d('0x2a')];}_0x29b4d5[_0xe85d('0x19')](_0xa88e5b)['send'](_0x1a7892);};}exports[_0xe85d('0x2b')]=function(_0xe86634,_0x36b263){var _0x3130cc={},_0x32b24c={},_0x14a8c8={'count':0x0,'rows':[]};var _0xf3f13c=_['map'](db['JscriptyProject'][_0xe85d('0x2c')],function(_0x2f60d6){return{'name':_0x2f60d6[_0xe85d('0x2d')],'type':_0x2f60d6[_0xe85d('0x2e')][_0xe85d('0x2f')]};});_0x32b24c['model']=_[_0xe85d('0x30')](_0xf3f13c,_0xe85d('0x2a'));_0x32b24c[_0xe85d('0x31')]=_[_0xe85d('0x32')](_0xe86634['query']);_0x32b24c[_0xe85d('0x33')]=_[_0xe85d('0x34')](_0x32b24c[_0xe85d('0x35')],_0x32b24c['query']);_0x3130cc[_0xe85d('0x36')]=_['intersection'](_0x32b24c[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0xe86634[_0xe85d('0x31')][_0xe85d('0x37')]));_0x3130cc[_0xe85d('0x36')]=_0x3130cc[_0xe85d('0x36')]['length']?_0x3130cc[_0xe85d('0x36')]:_0x32b24c['model'];if(!_0xe86634[_0xe85d('0x31')][_0xe85d('0x38')](_0xe85d('0x39'))){_0x3130cc['limit']=qs[_0xe85d('0x1d')](_0xe86634[_0xe85d('0x31')]['limit']);_0x3130cc[_0xe85d('0x1b')]=qs[_0xe85d('0x1b')](_0xe86634[_0xe85d('0x31')][_0xe85d('0x1b')]);}_0x3130cc[_0xe85d('0x3a')]=qs[_0xe85d('0x3b')](_0xe86634['query']['sort']);_0x3130cc[_0xe85d('0x3c')]=qs[_0xe85d('0x33')](_[_0xe85d('0x3d')](_0xe86634[_0xe85d('0x31')],_0x32b24c[_0xe85d('0x33')]),_0xf3f13c);if(_0xe86634['query'][_0xe85d('0x3e')]){_0x3130cc['where']=_['merge'](_0x3130cc['where'],{'$or':_[_0xe85d('0x30')](_0xf3f13c,function(_0x5fb38a){if(_0x5fb38a['type']!==_0xe85d('0x3f')){var _0x252892={};_0x252892[_0x5fb38a[_0xe85d('0x2a')]]={'$like':'%'+_0xe86634[_0xe85d('0x31')][_0xe85d('0x3e')]+'%'};return _0x252892;}})});}_0x3130cc=_[_0xe85d('0x40')]({},_0x3130cc,_0xe86634[_0xe85d('0x41')]);var _0x37f922={'where':_0x3130cc[_0xe85d('0x3c')]};return db[_0xe85d('0x42')]['count'](_0x37f922)[_0xe85d('0x24')](function(_0x2c0c99){_0x14a8c8['count']=_0x2c0c99;if(_0xe86634[_0xe85d('0x31')][_0xe85d('0x43')]){_0x3130cc[_0xe85d('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0xe85d('0x45')](_0x3130cc);})['then'](function(_0x4b4fe0){_0x14a8c8[_0xe85d('0x46')]=_0x4b4fe0;return _0x14a8c8;})[_0xe85d('0x24')](respondWithFilteredResult(_0x36b263,_0x3130cc))['catch'](handleError(_0x36b263,null));};exports[_0xe85d('0x47')]=function(_0x2f7b1f,_0x2da07c){var _0x57e71a={'raw':![],'where':{'id':_0x2f7b1f[_0xe85d('0x48')]['id']}},_0x5c45da={};_0x5c45da[_0xe85d('0x35')]=_[_0xe85d('0x32')](db['JscriptyProject'][_0xe85d('0x2c')]);_0x5c45da[_0xe85d('0x31')]=_['keys'](_0x2f7b1f[_0xe85d('0x31')]);_0x5c45da['filters']=_[_0xe85d('0x34')](_0x5c45da[_0xe85d('0x35')],_0x5c45da[_0xe85d('0x31')]);_0x57e71a[_0xe85d('0x36')]=_[_0xe85d('0x34')](_0x5c45da[_0xe85d('0x35')],qs['fields'](_0x2f7b1f[_0xe85d('0x31')][_0xe85d('0x37')]));_0x57e71a['attributes']=_0x57e71a[_0xe85d('0x36')]['length']?_0x57e71a[_0xe85d('0x36')]:_0x5c45da[_0xe85d('0x35')];if(_0x2f7b1f[_0xe85d('0x31')][_0xe85d('0x43')]){_0x57e71a['include']=[{'all':!![]}];}_0x57e71a=_[_0xe85d('0x40')]({},_0x57e71a,_0x2f7b1f[_0xe85d('0x41')]);return db['JscriptyProject'][_0xe85d('0x49')](_0x57e71a)[_0xe85d('0x24')](handleEntityNotFound(_0x2da07c,null))[_0xe85d('0x24')](respondWithResult(_0x2da07c,null))['catch'](handleError(_0x2da07c,null));};exports[_0xe85d('0x4a')]=function(_0x5e9641,_0x18966d){return db[_0xe85d('0x42')]['create'](_0x5e9641[_0xe85d('0x4b')],{})[_0xe85d('0x24')](function(_0x5a032f){var _0x2bf4c1=_0x5e9641[_0xe85d('0x4c')]['get']({'plain':!![]});if(!_0x2bf4c1)throw new Error(_0xe85d('0x4d'));if(_0x2bf4c1[_0xe85d('0x4e')]==='user'){var _0x340790=_0x5a032f[_0xe85d('0x26')]({'plain':!![]});var _0x4a860e=_0xe85d('0x27');return db[_0xe85d('0x4f')][_0xe85d('0x49')]({'where':{'name':_0x4a860e,'userProfileId':_0x2bf4c1[_0xe85d('0x50')]},'raw':!![]})['then'](function(_0x25e53f){if(_0x25e53f&&_0x25e53f['autoAssociation']===0x0){return db[_0xe85d('0x28')]['create']({'name':_0x340790[_0xe85d('0x2a')],'resourceId':_0x340790['id'],'type':_0x25e53f[_0xe85d('0x2a')],'sectionId':_0x25e53f['id']},{})[_0xe85d('0x24')](function(){return _0x5a032f;});}else{return _0x5a032f;}})[_0xe85d('0x51')](function(_0x43ead1){logger[_0xe85d('0x52')](_0xe85d('0x53'),_0x43ead1);throw _0x43ead1;});}return _0x5a032f;})[_0xe85d('0x24')](respondWithResult(_0x18966d,0xc9))[_0xe85d('0x51')](handleError(_0x18966d,null));};exports['clone']=function(_0xc53c90,_0x3021b5){var _0x3fcace={'where':{'id':_0xc53c90[_0xe85d('0x48')]['id']}},_0x22e667={};_0x22e667[_0xe85d('0x35')]=_[_0xe85d('0x32')](db[_0xe85d('0x42')]['rawAttributes']);_0x3fcace[_0xe85d('0x36')]=_['intersection'](_0x22e667[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0xc53c90[_0xe85d('0x31')]['fields']));_0x3fcace[_0xe85d('0x36')]=_0x3fcace[_0xe85d('0x36')]['length']?_0x3fcace['attributes']:_0x22e667[_0xe85d('0x35')];if(_0xc53c90[_0xe85d('0x31')][_0xe85d('0x43')]){_0x3fcace['include']=[{'all':!![]}];}_0x3fcace=_['merge']({},_0x3fcace,_0xc53c90[_0xe85d('0x41')]);return db[_0xe85d('0x42')][_0xe85d('0x49')](_0x3fcace)[_0xe85d('0x24')](handleEntityNotFound(_0x3021b5,null))['then'](function(_0x38b619){if(_0x38b619){var _0x325587=_0x38b619[_0xe85d('0x26')]({'plain':!![]});_0x325587=qs[_0xe85d('0x54')](_0x325587,['id','createdAt',_0xe85d('0x55')]);_0xc53c90[_0xe85d('0x4b')]=_[_0xe85d('0x54')](_0xc53c90['body'],['id',_0xe85d('0x56'),_0xe85d('0x55')]);return db[_0xe85d('0x42')][_0xe85d('0x4a')](_[_0xe85d('0x40')](_0x325587,_0xc53c90[_0xe85d('0x4b')]),{'include':_0xc53c90[_0xe85d('0x31')][_0xe85d('0x43')]?[{'all':!![]}]:undefined})[_0xe85d('0x24')](function(_0x2b0d9e){var _0x49c5f7=_0xc53c90[_0xe85d('0x4c')][_0xe85d('0x26')]({'plain':!![]});if(!_0x49c5f7)throw new Error(_0xe85d('0x4d'));if(_0x49c5f7[_0xe85d('0x4e')]===_0xe85d('0x4c')){var _0x41e95f=_0x2b0d9e[_0xe85d('0x26')]({'plain':!![]});var _0x5a83e1=_0xe85d('0x27');return db['UserProfileSection'][_0xe85d('0x49')]({'where':{'name':_0x5a83e1,'userProfileId':_0x49c5f7[_0xe85d('0x50')]},'raw':!![]})[_0xe85d('0x24')](function(_0x5c02ee){if(_0x5c02ee&&_0x5c02ee[_0xe85d('0x57')]===0x0){return db[_0xe85d('0x28')][_0xe85d('0x4a')]({'name':_0x41e95f['name'],'resourceId':_0x41e95f['id'],'type':_0x5c02ee[_0xe85d('0x2a')],'sectionId':_0x5c02ee['id']},{})[_0xe85d('0x24')](function(){return _0x2b0d9e;});}else{return _0x2b0d9e;}})[_0xe85d('0x51')](function(_0xcfe279){logger['error'](_0xe85d('0x53'),_0xcfe279);throw _0xcfe279;});}return _0x2b0d9e;});}})[_0xe85d('0x24')](respondWithResult(_0x3021b5,0xc9))['catch'](handleError(_0x3021b5,null));};exports[_0xe85d('0x23')]=function(_0x2c96ad,_0x237369){if(_0x2c96ad[_0xe85d('0x4b')]['id']){delete _0x2c96ad[_0xe85d('0x4b')]['id'];}return db[_0xe85d('0x42')][_0xe85d('0x49')]({'where':{'id':_0x2c96ad[_0xe85d('0x48')]['id']}})[_0xe85d('0x24')](handleEntityNotFound(_0x237369,null))[_0xe85d('0x24')](saveUpdates(_0x2c96ad[_0xe85d('0x4b')],null))[_0xe85d('0x24')](respondWithResult(_0x237369,null))[_0xe85d('0x51')](handleError(_0x237369,null));};exports['destroy']=function(_0x5c1dbb,_0x13eabf){return db['JscriptyProject'][_0xe85d('0x49')]({'where':{'id':_0x5c1dbb[_0xe85d('0x48')]['id']}})[_0xe85d('0x24')](handleEntityNotFound(_0x13eabf,null))['then'](removeEntity(_0x13eabf,null))['catch'](handleError(_0x13eabf,null));};exports[_0xe85d('0x58')]=function(_0x52f8f,_0x100454,_0x3e0bc9){var _0x5db07e={'raw':!![],'where':{}};var _0x567974={};var _0x40dcbb={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe85d('0x59')]({'where':{'id':_0x52f8f[_0xe85d('0x48')]['id']}})['then'](handleEntityNotFound(_0x100454,null))[_0xe85d('0x24')](function(_0x3a513c){if(_0x3a513c){_0x567974[_0xe85d('0x35')]=_[_0xe85d('0x32')](db[_0xe85d('0x5a')][_0xe85d('0x2c')]);_0x567974[_0xe85d('0x31')]=_['keys'](_0x52f8f['query']);_0x567974[_0xe85d('0x33')]=_[_0xe85d('0x34')](_0x567974[_0xe85d('0x35')],_0x567974['query']);_0x5db07e[_0xe85d('0x36')]=_[_0xe85d('0x34')](_0x567974[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0x52f8f[_0xe85d('0x31')][_0xe85d('0x37')]));_0x5db07e[_0xe85d('0x36')]=_0x5db07e['attributes']['length']?_0x5db07e[_0xe85d('0x36')]:_0x567974[_0xe85d('0x35')];if(!_0x52f8f[_0xe85d('0x31')][_0xe85d('0x38')](_0xe85d('0x39'))){_0x5db07e[_0xe85d('0x1d')]=qs['limit'](_0x52f8f['query'][_0xe85d('0x1d')]);_0x5db07e['offset']=qs[_0xe85d('0x1b')](_0x52f8f[_0xe85d('0x31')][_0xe85d('0x1b')]);}_0x5db07e[_0xe85d('0x3a')]=qs['sort'](_0x52f8f[_0xe85d('0x31')][_0xe85d('0x3b')]);_0x5db07e['where']=qs[_0xe85d('0x33')](_['pick'](_0x52f8f[_0xe85d('0x31')],_0x567974['filters']));_0x5db07e[_0xe85d('0x3c')][_0xe85d('0x5b')]=_0x3a513c['id'];if(_0x52f8f[_0xe85d('0x31')][_0xe85d('0x3e')]){_0x5db07e[_0xe85d('0x3c')]=_[_0xe85d('0x40')](_0x5db07e[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x30')](_0x5db07e[_0xe85d('0x36')],function(_0x595f9c){var _0x2bddb3={};_0x2bddb3[_0x595f9c]={'$like':'%'+_0x52f8f[_0xe85d('0x31')]['filter']+'%'};return _0x2bddb3;})});}_0x5db07e=_['merge']({},_0x5db07e,_0x52f8f['options']);return db[_0xe85d('0x5a')][_0xe85d('0x5c')]({'where':_0x5db07e['where']})[_0xe85d('0x24')](function(_0x535499){_0x40dcbb[_0xe85d('0x5c')]=_0x535499;if(_0x52f8f['query'][_0xe85d('0x43')]){_0x5db07e[_0xe85d('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xe85d('0x45')](_0x5db07e);})['then'](function(_0x486bc5){_0x40dcbb['rows']=_0x486bc5;return _0x40dcbb;});}})[_0xe85d('0x24')](respondWithFilteredResult(_0x100454,_0x5db07e))[_0xe85d('0x51')](handleError(_0x100454,null));};exports['getAnswers']=function(_0x4e24b2,_0x3aa054,_0x36a8c6){var _0x26da60={'raw':!![],'where':{}};var _0x4bd218={};var _0x33167f={'count':0x0,'rows':[]};return db[_0xe85d('0x42')]['findOne']({'where':{'id':_0x4e24b2[_0xe85d('0x48')]['id']}})[_0xe85d('0x24')](handleEntityNotFound(_0x3aa054,null))['then'](function(_0x1b2512){if(_0x1b2512){_0x4bd218['model']=_[_0xe85d('0x32')](db[_0xe85d('0x5d')][_0xe85d('0x2c')]);_0x4bd218['query']=_[_0xe85d('0x32')](_0x4e24b2['query']);_0x4bd218[_0xe85d('0x33')]=_[_0xe85d('0x34')](_0x4bd218['model'],_0x4bd218[_0xe85d('0x31')]);_0x26da60[_0xe85d('0x36')]=_[_0xe85d('0x34')](_0x4bd218[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0x4e24b2[_0xe85d('0x31')]['fields']));_0x26da60['attributes']=_0x26da60[_0xe85d('0x36')][_0xe85d('0x5e')]?_0x26da60[_0xe85d('0x36')]:_0x4bd218[_0xe85d('0x35')];if(!_0x4e24b2[_0xe85d('0x31')][_0xe85d('0x38')](_0xe85d('0x39'))){_0x26da60[_0xe85d('0x1d')]=qs[_0xe85d('0x1d')](_0x4e24b2[_0xe85d('0x31')][_0xe85d('0x1d')]);_0x26da60['offset']=qs[_0xe85d('0x1b')](_0x4e24b2[_0xe85d('0x31')][_0xe85d('0x1b')]);}_0x26da60['order']=qs[_0xe85d('0x3b')](_0x4e24b2[_0xe85d('0x31')]['sort']);_0x26da60[_0xe85d('0x3c')]=qs[_0xe85d('0x33')](_[_0xe85d('0x3d')](_0x4e24b2[_0xe85d('0x31')],_0x4bd218[_0xe85d('0x33')]));_0x26da60['where'][_0xe85d('0x5b')]=_0x1b2512['id'];if(_0x4e24b2['query'][_0xe85d('0x3e')]){_0x26da60['where']=_['merge'](_0x26da60[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x30')](_0x26da60[_0xe85d('0x36')],function(_0xe47ca7){var _0x23654a={};_0x23654a[_0xe47ca7]={'$like':'%'+_0x4e24b2[_0xe85d('0x31')]['filter']+'%'};return _0x23654a;})});}_0x26da60=_['merge']({},_0x26da60,_0x4e24b2[_0xe85d('0x41')]);return db['JscriptyAnswerReport'][_0xe85d('0x5c')]({'where':_0x26da60['where']})[_0xe85d('0x24')](function(_0x4655cb){_0x33167f['count']=_0x4655cb;if(_0x4e24b2[_0xe85d('0x31')]['includeAll']){_0x26da60[_0xe85d('0x44')]=[{'all':!![]}];}return db[_0xe85d('0x5d')]['findAll'](_0x26da60);})[_0xe85d('0x24')](function(_0x250d22){_0x33167f[_0xe85d('0x46')]=_0x250d22;return _0x33167f;});}})[_0xe85d('0x24')](respondWithFilteredResult(_0x3aa054,_0x26da60))['catch'](handleError(_0x3aa054,null));};function char(_0x3a704c){return'number'===typeof _0x3a704c?String[_0xe85d('0x5f')][_0xe85d('0x20')](null,arguments):_0x3a704c;}function needsEncapsulation(_0x399ce1){return!!_0x399ce1&&(_0x399ce1[_0xe85d('0x60')]()[_0xe85d('0x61')](char(0xd))>=0x0||_0x399ce1[_0xe85d('0x60')]()[_0xe85d('0x61')](char(0xa))>=0x0||_0x399ce1['toString']()[_0xe85d('0x61')](char(0x2c))>=0x0||_0x399ce1[_0xe85d('0x60')]()[_0xe85d('0x61')](char(0x22))>=0x0);}function encapsulate(_0x269cb8){var _0x5415d8=char(0x22),_0x1b7b74='\x5c'+char(0x22),_0x303557=_0x269cb8[_0xe85d('0x60')]()[_0xe85d('0x62')](new RegExp(_0x5415d8,'g'),_0x1b7b74);return _0x5415d8+_0x303557+_0x5415d8;}exports[_0xe85d('0x63')]=function(_0x2d0d49,_0x3add5c,_0x204dd2){var _0x2cbe2f,_0x2d22f5;var _0x4b1778={'where':{'ProjectId':_0x2d0d49[_0xe85d('0x48')]['id']}};if(_0x2d0d49['query']['startTime']){_0x4b1778[_0xe85d('0x3c')]['starttime']=JSON[_0xe85d('0x64')](_0x2d0d49[_0xe85d('0x31')]['startTime']);}return db[_0xe85d('0x5a')][_0xe85d('0x45')](_0x4b1778)[_0xe85d('0x24')](handleEntityNotFound(_0x3add5c,null))[_0xe85d('0x24')](function(_0x15fd9d){if(_0x15fd9d){_0x2cbe2f=_0x15fd9d;return db[_0xe85d('0x65')][_0xe85d('0x45')]({'where':{'SessionId':{'$in':_[_0xe85d('0x30')](_0x2cbe2f,'id')},'ProjectId':_0x2d0d49[_0xe85d('0x48')]['id']},'order':_0xe85d('0x66')});}})[_0xe85d('0x24')](handleEntityNotFound(_0x3add5c,null))[_0xe85d('0x24')](function(_0x18208b){if(_0x18208b){_0x2d22f5=_0x18208b;var _0x292a60={};for(var _0x2e1644=0x0,_0x2d2327=_0x2d22f5[_0xe85d('0x5e')];_0x2e1644<_0x2d2327;_0x2e1644++){if(!_0x292a60[_0xe85d('0x38')](_0x2d22f5[_0x2e1644][_0xe85d('0x67')])){_0x292a60[_0x2d22f5[_0x2e1644][_0xe85d('0x67')]]=needsEncapsulation(_0x2d22f5[_0x2e1644][_0xe85d('0x68')])?encapsulate(_0x2d22f5[_0x2e1644][_0xe85d('0x68')]):_0x2d22f5[_0x2e1644][_0xe85d('0x68')];}}var _0x29c15f=[],_0x114ab1={};for(var _0x1c871f=0x0,_0x1610df=_0x2cbe2f[_0xe85d('0x5e')];_0x1c871f<_0x1610df;_0x1c871f++){_0x114ab1={'ProjectId':_0x2d0d49[_0xe85d('0x48')]['id'],'SessionId':_0x2cbe2f[_0x1c871f]['id'],'StartTime':moment(_0x2cbe2f[_0x1c871f][_0xe85d('0x69')])[_0xe85d('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1aac1a=0x0,_0x1271bf=_0x2d22f5[_0xe85d('0x5e')];_0x1aac1a<_0x1271bf;_0x1aac1a++){if(_0x2d22f5[_0x1aac1a][_0xe85d('0x6b')]==_0x2cbe2f[_0x1c871f]['id']&&_0x292a60[_0xe85d('0x38')](_0x2d22f5[_0x1aac1a][_0xe85d('0x67')])){_0x114ab1[_0x292a60[_0x2d22f5[_0x1aac1a][_0xe85d('0x67')]]]=_0x2d22f5[_0x1aac1a][_0xe85d('0x6c')];}}for(var _0x29db51 in _0x292a60){if(!_0x114ab1[_0xe85d('0x38')](_0x292a60[_0x29db51])){_0x114ab1[_0x292a60[_0x29db51]]=null;}}_0x29c15f[_0xe85d('0x6d')](_0x114ab1);}return _0x29c15f;}})[_0xe85d('0x24')](function(_0x4ef0e8){if(!_['isEmpty'](_0x4ef0e8)){var _0x2083c5=toCsv(_0x4ef0e8);var _0x3c12f2=Date[_0xe85d('0x6e')]();fs[_0xe85d('0x6f')](util[_0xe85d('0x6a')](_0xe85d('0x70'),_0x2d0d49['params']['id'],_0x3c12f2),_0x2083c5);_0x3add5c[_0xe85d('0x71')](_0xe85d('0x72'),_0xe85d('0x73')+util[_0xe85d('0x6a')](_0xe85d('0x74'),_0x2d0d49[_0xe85d('0x48')]['id'],_0x3c12f2));_0x3add5c[_0xe85d('0x71')](_0xe85d('0x75'),_0xe85d('0x76'));return _0x3add5c[_0xe85d('0x77')](util[_0xe85d('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2d0d49[_0xe85d('0x48')]['id'],_0x3c12f2));}else{return _0x3add5c[_0xe85d('0x18')](0xcc);}})[_0xe85d('0x51')](handleError(_0x3add5c,null));}; \ No newline at end of file +var _0x0561=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Projects','destroy','error','stack','name','send','index','map','JscriptyProject','rawAttributes','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','user','userProfileId','JscriptySessionReport','pick','ProjectId','rows','getAnswers','findOne','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x483d8d,_0x54c6ed){var _0x6de0b7=function(_0x45f3ac){while(--_0x45f3ac){_0x483d8d['push'](_0x483d8d['shift']());}};_0x6de0b7(++_0x54c6ed);}(_0x0561,0x1e4));var _0x1056=function(_0x55fdc5,_0x250c08){_0x55fdc5=_0x55fdc5-0x0;var _0x550464=_0x0561[_0x55fdc5];return _0x550464;};'use strict';var emlformat=require(_0x1056('0x0'));var rimraf=require(_0x1056('0x1'));var zipdir=require(_0x1056('0x2'));var jsonpatch=require(_0x1056('0x3'));var rp=require('request-promise');var moment=require(_0x1056('0x4'));var BPromise=require(_0x1056('0x5'));var Mustache=require('mustache');var util=require(_0x1056('0x6'));var path=require(_0x1056('0x7'));var sox=require(_0x1056('0x8'));var csv=require(_0x1056('0x9'));var ejs=require(_0x1056('0xa'));var fs=require('fs');var fs_extra=require(_0x1056('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1056('0xc'));var jsforce=require(_0x1056('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1056('0x9'));var querystring=require(_0x1056('0xe'));var Papa=require(_0x1056('0xf'));var Redis=require(_0x1056('0x10'));var authService=require(_0x1056('0x11'));var qs=require(_0x1056('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1056('0x13'));var logger=require('../../config/logger')(_0x1056('0x14'));var utils=require(_0x1056('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1056('0x16'));var db=require(_0x1056('0x17'))['db'];function respondWithStatusCode(_0x52e2b5,_0x1cb098){_0x1cb098=_0x1cb098||0xcc;return function(_0x412757){if(_0x412757){return _0x52e2b5[_0x1056('0x18')](_0x1cb098);}return _0x52e2b5[_0x1056('0x19')](_0x1cb098)[_0x1056('0x1a')]();};}function respondWithResult(_0xc3fb9,_0xdd2c25){_0xdd2c25=_0xdd2c25||0xc8;return function(_0x82c3aa){if(_0x82c3aa){return _0xc3fb9['status'](_0xdd2c25)[_0x1056('0x1b')](_0x82c3aa);}};}function respondWithFilteredResult(_0x1068cb,_0x28683a){return function(_0x3fce72){if(_0x3fce72){var _0x1e4fdf=typeof _0x28683a[_0x1056('0x1c')]===_0x1056('0x1d')&&typeof _0x28683a[_0x1056('0x1e')]===_0x1056('0x1d');var _0x47c54a=_0x3fce72[_0x1056('0x1f')];var _0x37a53a=_0x1e4fdf?0x0:_0x28683a[_0x1056('0x1c')];var _0x153680=_0x1e4fdf?_0x3fce72[_0x1056('0x1f')]:_0x28683a[_0x1056('0x1c')]+_0x28683a[_0x1056('0x1e')];var _0x5b6d01;if(_0x153680>=_0x47c54a){_0x153680=_0x47c54a;_0x5b6d01=0xc8;}else{_0x5b6d01=0xce;}_0x1068cb['status'](_0x5b6d01);return _0x1068cb[_0x1056('0x20')](_0x1056('0x21'),_0x37a53a+'-'+_0x153680+'/'+_0x47c54a)[_0x1056('0x1b')](_0x3fce72);}return null;};}function patchUpdates(_0x33d0af){return function(_0x12a63b){try{jsonpatch[_0x1056('0x22')](_0x12a63b,_0x33d0af,!![]);}catch(_0x2c1c94){return BPromise[_0x1056('0x23')](_0x2c1c94);}return _0x12a63b[_0x1056('0x24')]();};}function saveUpdates(_0x31d7f0,_0xc319c){return function(_0x4a180a){if(_0x4a180a){return _0x4a180a[_0x1056('0x25')](_0x31d7f0)[_0x1056('0x26')](function(_0x444769){return _0x444769;});}return null;};}function removeEntity(_0x96debc,_0x524915){return function(_0x1243fb){if(_0x1243fb){return _0x1243fb['destroy']()[_0x1056('0x26')](function(){var _0x43bfc0=_0x1243fb[_0x1056('0x27')]({'plain':!![]});var _0x5464f6=_0x1056('0x28');return db['UserProfileResource'][_0x1056('0x29')]({'where':{'type':_0x5464f6,'resourceId':_0x43bfc0['id']}})[_0x1056('0x26')](function(){return _0x1243fb;});})[_0x1056('0x26')](function(){_0x96debc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x439cd2,_0xe89ddf){return function(_0x15c06e){if(!_0x15c06e){_0x439cd2[_0x1056('0x18')](0x194);}return _0x15c06e;};}function handleError(_0x37e424,_0x1f4909){_0x1f4909=_0x1f4909||0x1f4;return function(_0x242a75){logger[_0x1056('0x2a')](_0x242a75[_0x1056('0x2b')]);if(_0x242a75[_0x1056('0x2c')]){delete _0x242a75[_0x1056('0x2c')];}_0x37e424[_0x1056('0x19')](_0x1f4909)[_0x1056('0x2d')](_0x242a75);};}exports[_0x1056('0x2e')]=function(_0x345b78,_0x47856f){var _0x316dd7={},_0x1c3e30={},_0x27d593={'count':0x0,'rows':[]};var _0x4d3670=_[_0x1056('0x2f')](db[_0x1056('0x30')][_0x1056('0x31')],function(_0x150d48){return{'name':_0x150d48['fieldName'],'type':_0x150d48['type'][_0x1056('0x32')]};});_0x1c3e30[_0x1056('0x33')]=_[_0x1056('0x2f')](_0x4d3670,_0x1056('0x2c'));_0x1c3e30[_0x1056('0x34')]=_[_0x1056('0x35')](_0x345b78['query']);_0x1c3e30[_0x1056('0x36')]=_[_0x1056('0x37')](_0x1c3e30[_0x1056('0x33')],_0x1c3e30[_0x1056('0x34')]);_0x316dd7['attributes']=_[_0x1056('0x37')](_0x1c3e30[_0x1056('0x33')],qs[_0x1056('0x38')](_0x345b78[_0x1056('0x34')][_0x1056('0x38')]));_0x316dd7['attributes']=_0x316dd7['attributes'][_0x1056('0x39')]?_0x316dd7[_0x1056('0x3a')]:_0x1c3e30[_0x1056('0x33')];if(!_0x345b78[_0x1056('0x34')][_0x1056('0x3b')](_0x1056('0x3c'))){_0x316dd7['limit']=qs[_0x1056('0x1e')](_0x345b78['query'][_0x1056('0x1e')]);_0x316dd7[_0x1056('0x1c')]=qs[_0x1056('0x1c')](_0x345b78[_0x1056('0x34')]['offset']);}_0x316dd7[_0x1056('0x3d')]=qs[_0x1056('0x3e')](_0x345b78[_0x1056('0x34')][_0x1056('0x3e')]);_0x316dd7[_0x1056('0x3f')]=qs[_0x1056('0x36')](_['pick'](_0x345b78[_0x1056('0x34')],_0x1c3e30['filters']),_0x4d3670);if(_0x345b78[_0x1056('0x34')][_0x1056('0x40')]){_0x316dd7[_0x1056('0x3f')]=_[_0x1056('0x41')](_0x316dd7[_0x1056('0x3f')],{'$or':_['map'](_0x4d3670,function(_0x1d5df4){if(_0x1d5df4[_0x1056('0x42')]!==_0x1056('0x43')){var _0x9acbf8={};_0x9acbf8[_0x1d5df4['name']]={'$like':'%'+_0x345b78[_0x1056('0x34')][_0x1056('0x40')]+'%'};return _0x9acbf8;}})});}_0x316dd7=_[_0x1056('0x41')]({},_0x316dd7,_0x345b78[_0x1056('0x44')]);var _0x268800={'where':_0x316dd7[_0x1056('0x3f')]};return db['JscriptyProject']['count'](_0x268800)[_0x1056('0x26')](function(_0x51a208){_0x27d593['count']=_0x51a208;if(_0x345b78[_0x1056('0x34')][_0x1056('0x45')]){_0x316dd7[_0x1056('0x46')]=[{'all':!![]}];}return db[_0x1056('0x30')][_0x1056('0x47')](_0x316dd7);})[_0x1056('0x26')](function(_0x374c35){_0x27d593['rows']=_0x374c35;return _0x27d593;})['then'](respondWithFilteredResult(_0x47856f,_0x316dd7))[_0x1056('0x48')](handleError(_0x47856f,null));};exports[_0x1056('0x49')]=function(_0x394d55,_0x250503){var _0x45b68d={'raw':![],'where':{'id':_0x394d55[_0x1056('0x4a')]['id']}},_0x1c2cd5={};_0x1c2cd5[_0x1056('0x33')]=_[_0x1056('0x35')](db['JscriptyProject']['rawAttributes']);_0x1c2cd5[_0x1056('0x34')]=_[_0x1056('0x35')](_0x394d55[_0x1056('0x34')]);_0x1c2cd5[_0x1056('0x36')]=_[_0x1056('0x37')](_0x1c2cd5[_0x1056('0x33')],_0x1c2cd5['query']);_0x45b68d[_0x1056('0x3a')]=_[_0x1056('0x37')](_0x1c2cd5[_0x1056('0x33')],qs[_0x1056('0x38')](_0x394d55[_0x1056('0x34')][_0x1056('0x38')]));_0x45b68d[_0x1056('0x3a')]=_0x45b68d['attributes'][_0x1056('0x39')]?_0x45b68d[_0x1056('0x3a')]:_0x1c2cd5['model'];if(_0x394d55[_0x1056('0x34')][_0x1056('0x45')]){_0x45b68d[_0x1056('0x46')]=[{'all':!![]}];}_0x45b68d=_[_0x1056('0x41')]({},_0x45b68d,_0x394d55['options']);return db[_0x1056('0x30')][_0x1056('0x4b')](_0x45b68d)[_0x1056('0x26')](handleEntityNotFound(_0x250503,null))[_0x1056('0x26')](respondWithResult(_0x250503,null))['catch'](handleError(_0x250503,null));};exports[_0x1056('0x4c')]=function(_0x1343c2,_0x5d1c6c){return db[_0x1056('0x30')][_0x1056('0x4c')](_0x1343c2['body'],{})[_0x1056('0x26')](function(_0x2df06e){var _0x21e23b=_0x1343c2['user'][_0x1056('0x27')]({'plain':!![]});if(!_0x21e23b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21e23b[_0x1056('0x4d')]==='user'){var _0x4ade3a=_0x2df06e[_0x1056('0x27')]({'plain':!![]});var _0x21943c='Projects';return db[_0x1056('0x4e')][_0x1056('0x4b')]({'where':{'name':_0x21943c,'userProfileId':_0x21e23b['userProfileId']},'raw':!![]})[_0x1056('0x26')](function(_0x39ae70){if(_0x39ae70&&_0x39ae70[_0x1056('0x4f')]===0x0){return db[_0x1056('0x50')][_0x1056('0x4c')]({'name':_0x4ade3a[_0x1056('0x2c')],'resourceId':_0x4ade3a['id'],'type':_0x39ae70['name'],'sectionId':_0x39ae70['id']},{})[_0x1056('0x26')](function(){return _0x2df06e;});}else{return _0x2df06e;}})[_0x1056('0x48')](function(_0x4fedfa){logger['error'](_0x1056('0x51'),_0x4fedfa);throw _0x4fedfa;});}return _0x2df06e;})[_0x1056('0x26')](respondWithResult(_0x5d1c6c,0xc9))[_0x1056('0x48')](handleError(_0x5d1c6c,null));};exports[_0x1056('0x52')]=function(_0x3bf05c,_0xa50dd4){var _0x48367b={'where':{'id':_0x3bf05c[_0x1056('0x4a')]['id']}},_0xe5479c={};_0xe5479c[_0x1056('0x33')]=_[_0x1056('0x35')](db['JscriptyProject'][_0x1056('0x31')]);_0x48367b[_0x1056('0x3a')]=_[_0x1056('0x37')](_0xe5479c[_0x1056('0x33')],qs[_0x1056('0x38')](_0x3bf05c[_0x1056('0x34')][_0x1056('0x38')]));_0x48367b[_0x1056('0x3a')]=_0x48367b['attributes'][_0x1056('0x39')]?_0x48367b[_0x1056('0x3a')]:_0xe5479c[_0x1056('0x33')];if(_0x3bf05c['query']['includeAll']){_0x48367b[_0x1056('0x46')]=[{'all':!![]}];}_0x48367b=_['merge']({},_0x48367b,_0x3bf05c['options']);return db[_0x1056('0x30')][_0x1056('0x4b')](_0x48367b)[_0x1056('0x26')](handleEntityNotFound(_0xa50dd4,null))[_0x1056('0x26')](function(_0x826ce4){if(_0x826ce4){var _0x210587=_0x826ce4['get']({'plain':!![]});_0x210587=qs['omit'](_0x210587,['id',_0x1056('0x53'),_0x1056('0x54')]);_0x3bf05c[_0x1056('0x55')]=_[_0x1056('0x56')](_0x3bf05c[_0x1056('0x55')],['id',_0x1056('0x53'),_0x1056('0x54')]);return db[_0x1056('0x30')][_0x1056('0x4c')](_[_0x1056('0x41')](_0x210587,_0x3bf05c['body']),{'include':_0x3bf05c[_0x1056('0x34')][_0x1056('0x45')]?[{'all':!![]}]:undefined})[_0x1056('0x26')](function(_0x29dac3){var _0x81f101=_0x3bf05c[_0x1056('0x57')][_0x1056('0x27')]({'plain':!![]});if(!_0x81f101)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81f101['role']==='user'){var _0x5a704e=_0x29dac3[_0x1056('0x27')]({'plain':!![]});var _0x2647bb=_0x1056('0x28');return db[_0x1056('0x4e')][_0x1056('0x4b')]({'where':{'name':_0x2647bb,'userProfileId':_0x81f101[_0x1056('0x58')]},'raw':!![]})['then'](function(_0x5d1d24){if(_0x5d1d24&&_0x5d1d24[_0x1056('0x4f')]===0x0){return db[_0x1056('0x50')][_0x1056('0x4c')]({'name':_0x5a704e[_0x1056('0x2c')],'resourceId':_0x5a704e['id'],'type':_0x5d1d24[_0x1056('0x2c')],'sectionId':_0x5d1d24['id']},{})[_0x1056('0x26')](function(){return _0x29dac3;});}else{return _0x29dac3;}})[_0x1056('0x48')](function(_0x84a2c3){logger[_0x1056('0x2a')](_0x1056('0x51'),_0x84a2c3);throw _0x84a2c3;});}return _0x29dac3;});}})[_0x1056('0x26')](respondWithResult(_0xa50dd4,0xc9))[_0x1056('0x48')](handleError(_0xa50dd4,null));};exports[_0x1056('0x25')]=function(_0x2db1cc,_0x5b7fac){if(_0x2db1cc[_0x1056('0x55')]['id']){delete _0x2db1cc[_0x1056('0x55')]['id'];}return db[_0x1056('0x30')][_0x1056('0x4b')]({'where':{'id':_0x2db1cc[_0x1056('0x4a')]['id']}})[_0x1056('0x26')](handleEntityNotFound(_0x5b7fac,null))[_0x1056('0x26')](saveUpdates(_0x2db1cc[_0x1056('0x55')],null))['then'](respondWithResult(_0x5b7fac,null))[_0x1056('0x48')](handleError(_0x5b7fac,null));};exports[_0x1056('0x29')]=function(_0x8a2e42,_0x4d7b0d){return db['JscriptyProject'][_0x1056('0x4b')]({'where':{'id':_0x8a2e42[_0x1056('0x4a')]['id']}})[_0x1056('0x26')](handleEntityNotFound(_0x4d7b0d,null))[_0x1056('0x26')](removeEntity(_0x4d7b0d,null))[_0x1056('0x48')](handleError(_0x4d7b0d,null));};exports['getSessions']=function(_0x45c379,_0x331cc2,_0x4666c2){var _0x29c541={'raw':!![],'where':{}};var _0x4270ce={};var _0x25cc92={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x45c379[_0x1056('0x4a')]['id']}})['then'](handleEntityNotFound(_0x331cc2,null))[_0x1056('0x26')](function(_0x381669){if(_0x381669){_0x4270ce[_0x1056('0x33')]=_[_0x1056('0x35')](db[_0x1056('0x59')][_0x1056('0x31')]);_0x4270ce[_0x1056('0x34')]=_[_0x1056('0x35')](_0x45c379[_0x1056('0x34')]);_0x4270ce[_0x1056('0x36')]=_[_0x1056('0x37')](_0x4270ce[_0x1056('0x33')],_0x4270ce[_0x1056('0x34')]);_0x29c541[_0x1056('0x3a')]=_[_0x1056('0x37')](_0x4270ce['model'],qs[_0x1056('0x38')](_0x45c379[_0x1056('0x34')][_0x1056('0x38')]));_0x29c541[_0x1056('0x3a')]=_0x29c541['attributes']['length']?_0x29c541[_0x1056('0x3a')]:_0x4270ce['model'];if(!_0x45c379[_0x1056('0x34')][_0x1056('0x3b')](_0x1056('0x3c'))){_0x29c541[_0x1056('0x1e')]=qs[_0x1056('0x1e')](_0x45c379[_0x1056('0x34')]['limit']);_0x29c541[_0x1056('0x1c')]=qs['offset'](_0x45c379[_0x1056('0x34')][_0x1056('0x1c')]);}_0x29c541[_0x1056('0x3d')]=qs['sort'](_0x45c379['query'][_0x1056('0x3e')]);_0x29c541['where']=qs['filters'](_[_0x1056('0x5a')](_0x45c379[_0x1056('0x34')],_0x4270ce['filters']));_0x29c541[_0x1056('0x3f')][_0x1056('0x5b')]=_0x381669['id'];if(_0x45c379[_0x1056('0x34')][_0x1056('0x40')]){_0x29c541['where']=_[_0x1056('0x41')](_0x29c541[_0x1056('0x3f')],{'$or':_['map'](_0x29c541['attributes'],function(_0x4928ef){var _0x5cf4a8={};_0x5cf4a8[_0x4928ef]={'$like':'%'+_0x45c379[_0x1056('0x34')][_0x1056('0x40')]+'%'};return _0x5cf4a8;})});}_0x29c541=_['merge']({},_0x29c541,_0x45c379[_0x1056('0x44')]);return db['JscriptySessionReport'][_0x1056('0x1f')]({'where':_0x29c541[_0x1056('0x3f')]})[_0x1056('0x26')](function(_0x1682ec){_0x25cc92[_0x1056('0x1f')]=_0x1682ec;if(_0x45c379[_0x1056('0x34')][_0x1056('0x45')]){_0x29c541[_0x1056('0x46')]=[{'all':!![]}];}return db[_0x1056('0x59')][_0x1056('0x47')](_0x29c541);})[_0x1056('0x26')](function(_0xcbfee2){_0x25cc92[_0x1056('0x5c')]=_0xcbfee2;return _0x25cc92;});}})['then'](respondWithFilteredResult(_0x331cc2,_0x29c541))['catch'](handleError(_0x331cc2,null));};exports[_0x1056('0x5d')]=function(_0x4ef31c,_0x159d82,_0x26315d){var _0x15679f={'raw':!![],'where':{}};var _0x29f500={};var _0x51c3bd={'count':0x0,'rows':[]};return db[_0x1056('0x30')][_0x1056('0x5e')]({'where':{'id':_0x4ef31c['params']['id']}})[_0x1056('0x26')](handleEntityNotFound(_0x159d82,null))[_0x1056('0x26')](function(_0x259f7f){if(_0x259f7f){_0x29f500[_0x1056('0x33')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x29f500[_0x1056('0x34')]=_[_0x1056('0x35')](_0x4ef31c[_0x1056('0x34')]);_0x29f500[_0x1056('0x36')]=_[_0x1056('0x37')](_0x29f500[_0x1056('0x33')],_0x29f500[_0x1056('0x34')]);_0x15679f[_0x1056('0x3a')]=_['intersection'](_0x29f500[_0x1056('0x33')],qs[_0x1056('0x38')](_0x4ef31c[_0x1056('0x34')][_0x1056('0x38')]));_0x15679f[_0x1056('0x3a')]=_0x15679f[_0x1056('0x3a')]['length']?_0x15679f[_0x1056('0x3a')]:_0x29f500[_0x1056('0x33')];if(!_0x4ef31c[_0x1056('0x34')][_0x1056('0x3b')](_0x1056('0x3c'))){_0x15679f[_0x1056('0x1e')]=qs['limit'](_0x4ef31c[_0x1056('0x34')][_0x1056('0x1e')]);_0x15679f['offset']=qs[_0x1056('0x1c')](_0x4ef31c['query'][_0x1056('0x1c')]);}_0x15679f[_0x1056('0x3d')]=qs['sort'](_0x4ef31c[_0x1056('0x34')][_0x1056('0x3e')]);_0x15679f['where']=qs[_0x1056('0x36')](_[_0x1056('0x5a')](_0x4ef31c[_0x1056('0x34')],_0x29f500[_0x1056('0x36')]));_0x15679f[_0x1056('0x3f')][_0x1056('0x5b')]=_0x259f7f['id'];if(_0x4ef31c[_0x1056('0x34')][_0x1056('0x40')]){_0x15679f[_0x1056('0x3f')]=_[_0x1056('0x41')](_0x15679f[_0x1056('0x3f')],{'$or':_[_0x1056('0x2f')](_0x15679f[_0x1056('0x3a')],function(_0x1f329a){var _0x24b489={};_0x24b489[_0x1f329a]={'$like':'%'+_0x4ef31c['query'][_0x1056('0x40')]+'%'};return _0x24b489;})});}_0x15679f=_[_0x1056('0x41')]({},_0x15679f,_0x4ef31c['options']);return db['JscriptyAnswerReport']['count']({'where':_0x15679f['where']})[_0x1056('0x26')](function(_0x9748e5){_0x51c3bd[_0x1056('0x1f')]=_0x9748e5;if(_0x4ef31c[_0x1056('0x34')][_0x1056('0x45')]){_0x15679f[_0x1056('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1056('0x47')](_0x15679f);})['then'](function(_0x3e22da){_0x51c3bd[_0x1056('0x5c')]=_0x3e22da;return _0x51c3bd;});}})[_0x1056('0x26')](respondWithFilteredResult(_0x159d82,_0x15679f))[_0x1056('0x48')](handleError(_0x159d82,null));};function char(_0x451501){return _0x1056('0x5f')===typeof _0x451501?String[_0x1056('0x60')][_0x1056('0x22')](null,arguments):_0x451501;}function needsEncapsulation(_0xfaa558){return!!_0xfaa558&&(_0xfaa558['toString']()[_0x1056('0x61')](char(0xd))>=0x0||_0xfaa558[_0x1056('0x62')]()[_0x1056('0x61')](char(0xa))>=0x0||_0xfaa558[_0x1056('0x62')]()[_0x1056('0x61')](char(0x2c))>=0x0||_0xfaa558[_0x1056('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x215dd7){var _0x4194f5=char(0x22),_0x25ecec='\x5c'+char(0x22),_0x54633f=_0x215dd7[_0x1056('0x62')]()[_0x1056('0x63')](new RegExp(_0x4194f5,'g'),_0x25ecec);return _0x4194f5+_0x54633f+_0x4194f5;}exports[_0x1056('0x64')]=function(_0x51ef3d,_0x450336,_0x448bad){var _0x140cde,_0x2fb6c2;var _0x1b8156={'where':{'ProjectId':_0x51ef3d[_0x1056('0x4a')]['id']}};if(_0x51ef3d['query'][_0x1056('0x65')]){_0x1b8156['where'][_0x1056('0x66')]=JSON[_0x1056('0x67')](_0x51ef3d[_0x1056('0x34')][_0x1056('0x65')]);}return db[_0x1056('0x59')]['findAll'](_0x1b8156)['then'](handleEntityNotFound(_0x450336,null))[_0x1056('0x26')](function(_0x58b440){if(_0x58b440){_0x140cde=_0x58b440;return db[_0x1056('0x68')][_0x1056('0x47')]({'where':{'SessionId':{'$in':_[_0x1056('0x2f')](_0x140cde,'id')},'ProjectId':_0x51ef3d[_0x1056('0x4a')]['id']},'order':_0x1056('0x69')});}})[_0x1056('0x26')](handleEntityNotFound(_0x450336,null))[_0x1056('0x26')](function(_0x46ce1f){if(_0x46ce1f){_0x2fb6c2=_0x46ce1f;var _0x3df686={};for(var _0x39f179=0x0,_0xe57cc2=_0x2fb6c2[_0x1056('0x39')];_0x39f179<_0xe57cc2;_0x39f179++){if(!_0x3df686[_0x1056('0x3b')](_0x2fb6c2[_0x39f179][_0x1056('0x6a')])){_0x3df686[_0x2fb6c2[_0x39f179][_0x1056('0x6a')]]=needsEncapsulation(_0x2fb6c2[_0x39f179][_0x1056('0x6b')])?encapsulate(_0x2fb6c2[_0x39f179][_0x1056('0x6b')]):_0x2fb6c2[_0x39f179][_0x1056('0x6b')];}}var _0x3ec49f=[],_0x24bb0d={};for(var _0x1e1faa=0x0,_0x29af5c=_0x140cde[_0x1056('0x39')];_0x1e1faa<_0x29af5c;_0x1e1faa++){_0x24bb0d={'ProjectId':_0x51ef3d[_0x1056('0x4a')]['id'],'SessionId':_0x140cde[_0x1e1faa]['id'],'StartTime':moment(_0x140cde[_0x1e1faa]['starttime'])[_0x1056('0x6c')](_0x1056('0x6d'))};for(var _0x9c4765=0x0,_0x2e85cc=_0x2fb6c2[_0x1056('0x39')];_0x9c4765<_0x2e85cc;_0x9c4765++){if(_0x2fb6c2[_0x9c4765][_0x1056('0x6e')]==_0x140cde[_0x1e1faa]['id']&&_0x3df686[_0x1056('0x3b')](_0x2fb6c2[_0x9c4765][_0x1056('0x6a')])){_0x24bb0d[_0x3df686[_0x2fb6c2[_0x9c4765][_0x1056('0x6a')]]]=_0x2fb6c2[_0x9c4765][_0x1056('0x6f')];}}for(var _0xa43c0d in _0x3df686){if(!_0x24bb0d[_0x1056('0x3b')](_0x3df686[_0xa43c0d])){_0x24bb0d[_0x3df686[_0xa43c0d]]=null;}}_0x3ec49f['push'](_0x24bb0d);}return _0x3ec49f;}})[_0x1056('0x26')](function(_0x3fad3c){if(!_['isEmpty'](_0x3fad3c)){var _0x3aff3e=toCsv(_0x3fad3c);var _0x5b9048=Date[_0x1056('0x70')]();fs[_0x1056('0x71')](util['format'](_0x1056('0x72'),_0x51ef3d['params']['id'],_0x5b9048),_0x3aff3e);_0x450336[_0x1056('0x73')](_0x1056('0x74'),_0x1056('0x75')+util[_0x1056('0x6c')](_0x1056('0x76'),_0x51ef3d['params']['id'],_0x5b9048));_0x450336['setHeader'](_0x1056('0x77'),_0x1056('0x78'));return _0x450336[_0x1056('0x79')](util[_0x1056('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x51ef3d[_0x1056('0x4a')]['id'],_0x5b9048));}else{return _0x450336[_0x1056('0x18')](0xcc);}})[_0x1056('0x48')](handleError(_0x450336,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1b48d55..c47ebc1 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 _0xf185=['define','JscriptyProject','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x272538,_0x1e62a2){var _0x577775=function(_0x462fa5){while(--_0x462fa5){_0x272538['push'](_0x272538['shift']());}};_0x577775(++_0x1e62a2);}(_0xf185,0x1be));var _0x5f18=function(_0xa3adeb,_0x487efb){_0xa3adeb=_0xa3adeb-0x0;var _0x3b773c=_0xf185[_0xa3adeb];return _0x3b773c;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var logger=require(_0x5f18('0x1'))(_0x5f18('0x2'));var moment=require(_0x5f18('0x3'));var BPromise=require(_0x5f18('0x4'));var rp=require(_0x5f18('0x5'));var fs=require('fs');var path=require(_0x5f18('0x6'));var rimraf=require('rimraf');var config=require(_0x5f18('0x7'));var attributes=require(_0x5f18('0x8'));module[_0x5f18('0x9')]=function(_0x1cac08,_0x5b7cc5){return _0x1cac08[_0x5f18('0xa')](_0x5f18('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x740a=['jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','JscriptyProject'];(function(_0x2ec073,_0x337e55){var _0x5e9482=function(_0x4a27c9){while(--_0x4a27c9){_0x2ec073['push'](_0x2ec073['shift']());}};_0x5e9482(++_0x337e55);}(_0x740a,0x175));var _0xa740=function(_0x30d253,_0x1d6fd){_0x30d253=_0x30d253-0x0;var _0x5d29e9=_0x740a[_0x30d253];return _0x5d29e9;};'use strict';var _=require(_0xa740('0x0'));var util=require(_0xa740('0x1'));var logger=require(_0xa740('0x2'))(_0xa740('0x3'));var moment=require(_0xa740('0x4'));var BPromise=require(_0xa740('0x5'));var rp=require(_0xa740('0x6'));var fs=require('fs');var path=require(_0xa740('0x7'));var rimraf=require('rimraf');var config=require(_0xa740('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x1d3daa,_0x9583c8){return _0x1d3daa[_0xa740('0x9')](_0xa740('0xa'),attributes,{'tableName':_0xa740('0xb'),'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 84a84e4..1756809 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1a3c9b,_0x3eb0cb){var _0x57f1d8=function(_0x53662d){while(--_0x53662d){_0x1a3c9b['push'](_0x1a3c9b['shift']());}};_0x57f1d8(++_0x3eb0cb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x63f512,_0xb4672a){_0x63f512=_0x63f512-0x0;var _0x562aa1=_0xf4eb[_0x63f512];return _0x562aa1;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ 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','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x46fa36,_0x225053){var _0x49f596=function(_0x49d37e){while(--_0x49d37e){_0x46fa36['push'](_0x46fa36['shift']());}};_0x49f596(++_0x225053);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xcb91[_0x15ea09];return _0x3e9c78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 174d52b..3bc38d1 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 _0x4564=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x33be5a,_0x35871c){var _0x123f1a=function(_0x38768d){while(--_0x38768d){_0x33be5a['push'](_0x33be5a['shift']());}};_0x123f1a(++_0x35871c);}(_0x4564,0xae));var _0x4456=function(_0x3685f0,_0x10da58){_0x3685f0=_0x3685f0-0x0;var _0x3505d4=_0x4564[_0x3685f0];return _0x3505d4;};'use strict';var multer=require(_0x4456('0x0'));var util=require('util');var path=require(_0x4456('0x1'));var timeout=require(_0x4456('0x2'));var express=require(_0x4456('0x3'));var router=express[_0x4456('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4456('0x5'));var interaction=require(_0x4456('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x4456('0x7')]('/',auth[_0x4456('0x8')](),controller[_0x4456('0x9')]);router[_0x4456('0x7')](_0x4456('0xa'),auth['isAuthenticated'](),controller[_0x4456('0xb')]);router['get']('/:id',auth[_0x4456('0x8')](),controller['show']);router[_0x4456('0xc')]('/',auth['isAuthenticated'](),controller[_0x4456('0xd')]);router[_0x4456('0xe')](_0x4456('0xf'),auth[_0x4456('0x8')](),controller['update']);router[_0x4456('0x10')](_0x4456('0xf'),auth[_0x4456('0x8')](),controller[_0x4456('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb2d9=['./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x32c8f7,_0xca1fd5){var _0x724842=function(_0x18c755){while(--_0x18c755){_0x32c8f7['push'](_0x32c8f7['shift']());}};_0x724842(++_0xca1fd5);}(_0xb2d9,0x116));var _0x9b2d=function(_0x56a109,_0x578f06){_0x56a109=_0x56a109-0x0;var _0x4c8166=_0xb2d9[_0x56a109];return _0x4c8166;};'use strict';var multer=require(_0x9b2d('0x0'));var util=require('util');var path=require(_0x9b2d('0x1'));var timeout=require(_0x9b2d('0x2'));var express=require(_0x9b2d('0x3'));var router=express[_0x9b2d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9b2d('0x5'));var config=require(_0x9b2d('0x6'));var controller=require(_0x9b2d('0x7'));router[_0x9b2d('0x8')]('/',auth[_0x9b2d('0x9')](),controller['index']);router['get'](_0x9b2d('0xa'),auth[_0x9b2d('0x9')](),controller['describe']);router['get'](_0x9b2d('0xb'),auth[_0x9b2d('0x9')](),controller[_0x9b2d('0xc')]);router[_0x9b2d('0xd')]('/',auth[_0x9b2d('0x9')](),controller[_0x9b2d('0xe')]);router[_0x9b2d('0xf')](_0x9b2d('0xb'),auth[_0x9b2d('0x9')](),controller[_0x9b2d('0x10')]);router[_0x9b2d('0x11')](_0x9b2d('0xb'),auth[_0x9b2d('0x9')](),controller['destroy']);module[_0x9b2d('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 05324a6..61f3f8e 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x5f0362,_0x7fe6e){_0x5f0362=_0x5f0362-0x0;var _0x43b771=_0x7a54[_0x5f0362];return _0x43b771;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7a54,0x106));var _0x47a5=function(_0x309472,_0x3e4f3f){_0x309472=_0x309472-0x0;var _0x5c79c9=_0x7a54[_0x309472];return _0x5c79c9;};'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 c248d96..c2190d4 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 _0xf040=['pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','keys','include','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x34ae53,_0x31451a){var _0x4eabbd=function(_0x50098b){while(--_0x50098b){_0x34ae53['push'](_0x34ae53['shift']());}};_0x4eabbd(++_0x31451a);}(_0xf040,0x13d));var _0x0f04=function(_0xb6ea0a,_0x483190){_0xb6ea0a=_0xb6ea0a-0x0;var _0x397ff4=_0xf040[_0xb6ea0a];return _0x397ff4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f04('0x0'));var jsonpatch=require(_0x0f04('0x1'));var rp=require(_0x0f04('0x2'));var moment=require(_0x0f04('0x3'));var BPromise=require(_0x0f04('0x4'));var Mustache=require(_0x0f04('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0f04('0x6'));var csv=require(_0x0f04('0x7'));var ejs=require(_0x0f04('0x8'));var fs=require('fs');var fs_extra=require(_0x0f04('0x9'));var _=require('lodash');var squel=require(_0x0f04('0xa'));var crypto=require(_0x0f04('0xb'));var jsforce=require(_0x0f04('0xc'));var deskjs=require(_0x0f04('0xd'));var toCsv=require(_0x0f04('0x7'));var querystring=require(_0x0f04('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f04('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f04('0x10'));var logger=require(_0x0f04('0x11'))(_0x0f04('0x12'));var utils=require(_0x0f04('0x13'));var config=require(_0x0f04('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f04('0x15'))['db'];function respondWithStatusCode(_0x2eded4,_0x28a583){_0x28a583=_0x28a583||0xcc;return function(_0x2e87b5){if(_0x2e87b5){return _0x2eded4[_0x0f04('0x16')](_0x28a583);}return _0x2eded4[_0x0f04('0x17')](_0x28a583)[_0x0f04('0x18')]();};}function respondWithResult(_0xb69ff4,_0x333694){_0x333694=_0x333694||0xc8;return function(_0x5b9191){if(_0x5b9191){return _0xb69ff4['status'](_0x333694)[_0x0f04('0x19')](_0x5b9191);}};}function respondWithFilteredResult(_0x21c073,_0x20aaf0){return function(_0x331ee3){if(_0x331ee3){var _0x547baa=typeof _0x20aaf0['offset']===_0x0f04('0x1a')&&typeof _0x20aaf0[_0x0f04('0x1b')]===_0x0f04('0x1a');var _0xb93d1d=_0x331ee3[_0x0f04('0x1c')];var _0x287c3e=_0x547baa?0x0:_0x20aaf0[_0x0f04('0x1d')];var _0xbc9ac8=_0x547baa?_0x331ee3[_0x0f04('0x1c')]:_0x20aaf0[_0x0f04('0x1d')]+_0x20aaf0[_0x0f04('0x1b')];var _0x448e32;if(_0xbc9ac8>=_0xb93d1d){_0xbc9ac8=_0xb93d1d;_0x448e32=0xc8;}else{_0x448e32=0xce;}_0x21c073['status'](_0x448e32);return _0x21c073[_0x0f04('0x1e')](_0x0f04('0x1f'),_0x287c3e+'-'+_0xbc9ac8+'/'+_0xb93d1d)['json'](_0x331ee3);}return null;};}function patchUpdates(_0x53e604){return function(_0x2c75b0){try{jsonpatch[_0x0f04('0x20')](_0x2c75b0,_0x53e604,!![]);}catch(_0x551e3f){return BPromise[_0x0f04('0x21')](_0x551e3f);}return _0x2c75b0[_0x0f04('0x22')]();};}function saveUpdates(_0x3fa3ad,_0x140e6f){return function(_0x4abe3e){if(_0x4abe3e){return _0x4abe3e[_0x0f04('0x23')](_0x3fa3ad)[_0x0f04('0x24')](function(_0x32853c){return _0x32853c;});}return null;};}function removeEntity(_0x3cddb1,_0xaaff0b){return function(_0x1f5aa7){if(_0x1f5aa7){return _0x1f5aa7['destroy']()[_0x0f04('0x24')](function(){_0x3cddb1[_0x0f04('0x17')](0xcc)[_0x0f04('0x18')]();});}};}function handleEntityNotFound(_0x4bc0ff,_0x56a705){return function(_0x56a972){if(!_0x56a972){_0x4bc0ff[_0x0f04('0x16')](0x194);}return _0x56a972;};}function handleError(_0x1ab02d,_0x854a97){_0x854a97=_0x854a97||0x1f4;return function(_0x484141){logger[_0x0f04('0x25')](_0x484141[_0x0f04('0x26')]);if(_0x484141['name']){delete _0x484141['name'];}_0x1ab02d[_0x0f04('0x17')](_0x854a97)[_0x0f04('0x27')](_0x484141);};}exports[_0x0f04('0x28')]=function(_0x5a7875,_0x2ac65a){var _0x20b70e={},_0x3713d7={},_0x9085a4={'count':0x0,'rows':[]};var _0x3ce8dc=_[_0x0f04('0x29')](db[_0x0f04('0x2a')][_0x0f04('0x2b')],function(_0x27f092){return{'name':_0x27f092[_0x0f04('0x2c')],'type':_0x27f092['type']['key']};});_0x3713d7[_0x0f04('0x2d')]=_[_0x0f04('0x29')](_0x3ce8dc,_0x0f04('0x2e'));_0x3713d7[_0x0f04('0x2f')]=_['keys'](_0x5a7875[_0x0f04('0x2f')]);_0x3713d7[_0x0f04('0x30')]=_[_0x0f04('0x31')](_0x3713d7['model'],_0x3713d7[_0x0f04('0x2f')]);_0x20b70e[_0x0f04('0x32')]=_[_0x0f04('0x31')](_0x3713d7[_0x0f04('0x2d')],qs[_0x0f04('0x33')](_0x5a7875[_0x0f04('0x2f')][_0x0f04('0x33')]));_0x20b70e['attributes']=_0x20b70e[_0x0f04('0x32')][_0x0f04('0x34')]?_0x20b70e[_0x0f04('0x32')]:_0x3713d7['model'];if(!_0x5a7875[_0x0f04('0x2f')][_0x0f04('0x35')](_0x0f04('0x36'))){_0x20b70e['limit']=qs[_0x0f04('0x1b')](_0x5a7875['query'][_0x0f04('0x1b')]);_0x20b70e[_0x0f04('0x1d')]=qs[_0x0f04('0x1d')](_0x5a7875[_0x0f04('0x2f')]['offset']);}_0x20b70e[_0x0f04('0x37')]=qs['sort'](_0x5a7875[_0x0f04('0x2f')][_0x0f04('0x38')]);_0x20b70e[_0x0f04('0x39')]=qs['filters'](_[_0x0f04('0x3a')](_0x5a7875[_0x0f04('0x2f')],_0x3713d7[_0x0f04('0x30')]),_0x3ce8dc);if(_0x5a7875[_0x0f04('0x2f')][_0x0f04('0x3b')]){_0x20b70e[_0x0f04('0x39')]=_[_0x0f04('0x3c')](_0x20b70e[_0x0f04('0x39')],{'$or':_['map'](_0x3ce8dc,function(_0x280320){if(_0x280320[_0x0f04('0x3d')]!==_0x0f04('0x3e')){var _0x7ad128={};_0x7ad128[_0x280320[_0x0f04('0x2e')]]={'$like':'%'+_0x5a7875[_0x0f04('0x2f')][_0x0f04('0x3b')]+'%'};return _0x7ad128;}})});}_0x20b70e=_['merge']({},_0x20b70e,_0x5a7875[_0x0f04('0x3f')]);var _0x165086={'where':_0x20b70e[_0x0f04('0x39')]};return db[_0x0f04('0x2a')]['count'](_0x165086)[_0x0f04('0x24')](function(_0x2038f6){_0x9085a4[_0x0f04('0x1c')]=_0x2038f6;if(_0x5a7875[_0x0f04('0x2f')][_0x0f04('0x40')]){_0x20b70e['include']=[{'all':!![]}];}return db[_0x0f04('0x2a')]['findAll'](_0x20b70e);})[_0x0f04('0x24')](function(_0x4b6807){_0x9085a4['rows']=_0x4b6807;return _0x9085a4;})[_0x0f04('0x24')](respondWithFilteredResult(_0x2ac65a,_0x20b70e))[_0x0f04('0x41')](handleError(_0x2ac65a,null));};exports[_0x0f04('0x42')]=function(_0x13d225,_0x2feb74){var _0x33f543={'raw':!![],'where':{'id':_0x13d225[_0x0f04('0x43')]['id']}},_0xc4e987={};_0xc4e987['model']=_['keys'](db[_0x0f04('0x2a')][_0x0f04('0x2b')]);_0xc4e987[_0x0f04('0x2f')]=_[_0x0f04('0x44')](_0x13d225[_0x0f04('0x2f')]);_0xc4e987[_0x0f04('0x30')]=_['intersection'](_0xc4e987[_0x0f04('0x2d')],_0xc4e987[_0x0f04('0x2f')]);_0x33f543['attributes']=_['intersection'](_0xc4e987['model'],qs[_0x0f04('0x33')](_0x13d225[_0x0f04('0x2f')]['fields']));_0x33f543[_0x0f04('0x32')]=_0x33f543[_0x0f04('0x32')][_0x0f04('0x34')]?_0x33f543['attributes']:_0xc4e987[_0x0f04('0x2d')];if(_0x13d225['query'][_0x0f04('0x40')]){_0x33f543[_0x0f04('0x45')]=[{'all':!![]}];}_0x33f543=_[_0x0f04('0x3c')]({},_0x33f543,_0x13d225['options']);return db[_0x0f04('0x2a')][_0x0f04('0x46')](_0x33f543)[_0x0f04('0x24')](handleEntityNotFound(_0x2feb74,null))[_0x0f04('0x24')](respondWithResult(_0x2feb74,null))['catch'](handleError(_0x2feb74,null));};exports['create']=function(_0x51eab6,_0xa23e9d){return db[_0x0f04('0x2a')][_0x0f04('0x47')](_0x51eab6[_0x0f04('0x48')],{})[_0x0f04('0x24')](respondWithResult(_0xa23e9d,0xc9))['catch'](handleError(_0xa23e9d,null));};exports[_0x0f04('0x23')]=function(_0x491017,_0x404e44){if(_0x491017[_0x0f04('0x48')]['id']){delete _0x491017[_0x0f04('0x48')]['id'];}return db[_0x0f04('0x2a')]['find']({'where':{'id':_0x491017[_0x0f04('0x43')]['id']}})[_0x0f04('0x24')](handleEntityNotFound(_0x404e44,null))[_0x0f04('0x24')](saveUpdates(_0x491017[_0x0f04('0x48')],null))['then'](respondWithResult(_0x404e44,null))[_0x0f04('0x41')](handleError(_0x404e44,null));};exports[_0x0f04('0x49')]=function(_0x2326c3,_0x51ff9e){return db[_0x0f04('0x2a')][_0x0f04('0x46')]({'where':{'id':_0x2326c3['params']['id']}})['then'](handleEntityNotFound(_0x51ff9e,null))['then'](removeEntity(_0x51ff9e,null))[_0x0f04('0x41')](handleError(_0x51ff9e,null));};exports[_0x0f04('0x4a')]=function(_0x5306f8,_0x1393a8){return db[_0x0f04('0x2a')][_0x0f04('0x4a')]()[_0x0f04('0x24')](respondWithResult(_0x1393a8,null))[_0x0f04('0x41')](handleError(_0x1393a8,null));}; \ No newline at end of file +var _0x06e0=['where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','filters','query','fields','attributes','length','nolimit','order','sort','filter'];(function(_0x2cdffa,_0xcfe737){var _0x25c4d4=function(_0x6e355e){while(--_0x6e355e){_0x2cdffa['push'](_0x2cdffa['shift']());}};_0x25c4d4(++_0xcfe737);}(_0x06e0,0xad));var _0x006e=function(_0xd839e7,_0x4209e9){_0xd839e7=_0xd839e7-0x0;var _0xc3cf23=_0x06e0[_0xd839e7];return _0xc3cf23;};'use strict';var emlformat=require(_0x006e('0x0'));var rimraf=require(_0x006e('0x1'));var zipdir=require(_0x006e('0x2'));var jsonpatch=require(_0x006e('0x3'));var rp=require(_0x006e('0x4'));var moment=require('moment');var BPromise=require(_0x006e('0x5'));var Mustache=require(_0x006e('0x6'));var util=require(_0x006e('0x7'));var path=require(_0x006e('0x8'));var sox=require('sox');var csv=require(_0x006e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x006e('0xa'));var squel=require(_0x006e('0xb'));var crypto=require(_0x006e('0xc'));var jsforce=require(_0x006e('0xd'));var deskjs=require(_0x006e('0xe'));var toCsv=require(_0x006e('0x9'));var querystring=require(_0x006e('0xf'));var Papa=require(_0x006e('0x10'));var Redis=require(_0x006e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x006e('0x12'));var hardwareService=require(_0x006e('0x13'));var logger=require('../../config/logger')(_0x006e('0x14'));var utils=require(_0x006e('0x15'));var config=require(_0x006e('0x16'));var licenseUtil=require(_0x006e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33fb68,_0x11efa4){_0x11efa4=_0x11efa4||0xcc;return function(_0x3d586c){if(_0x3d586c){return _0x33fb68[_0x006e('0x18')](_0x11efa4);}return _0x33fb68[_0x006e('0x19')](_0x11efa4)['end']();};}function respondWithResult(_0x4ed223,_0x4b2838){_0x4b2838=_0x4b2838||0xc8;return function(_0x3f02b7){if(_0x3f02b7){return _0x4ed223['status'](_0x4b2838)[_0x006e('0x1a')](_0x3f02b7);}};}function respondWithFilteredResult(_0x58751f,_0x4a3980){return function(_0x4488be){if(_0x4488be){var _0x268d74=typeof _0x4a3980['offset']===_0x006e('0x1b')&&typeof _0x4a3980[_0x006e('0x1c')]==='undefined';var _0x89a5c7=_0x4488be[_0x006e('0x1d')];var _0x5db96d=_0x268d74?0x0:_0x4a3980[_0x006e('0x1e')];var _0x2edff2=_0x268d74?_0x4488be[_0x006e('0x1d')]:_0x4a3980[_0x006e('0x1e')]+_0x4a3980['limit'];var _0x2aff5f;if(_0x2edff2>=_0x89a5c7){_0x2edff2=_0x89a5c7;_0x2aff5f=0xc8;}else{_0x2aff5f=0xce;}_0x58751f[_0x006e('0x19')](_0x2aff5f);return _0x58751f[_0x006e('0x1f')](_0x006e('0x20'),_0x5db96d+'-'+_0x2edff2+'/'+_0x89a5c7)['json'](_0x4488be);}return null;};}function patchUpdates(_0x263517){return function(_0x3bdaa5){try{jsonpatch[_0x006e('0x21')](_0x3bdaa5,_0x263517,!![]);}catch(_0x27ce86){return BPromise[_0x006e('0x22')](_0x27ce86);}return _0x3bdaa5[_0x006e('0x23')]();};}function saveUpdates(_0xdf949b,_0x4f9e8f){return function(_0x4d33b3){if(_0x4d33b3){return _0x4d33b3['update'](_0xdf949b)[_0x006e('0x24')](function(_0x313323){return _0x313323;});}return null;};}function removeEntity(_0x585e40,_0x406b45){return function(_0x564d2b){if(_0x564d2b){return _0x564d2b[_0x006e('0x25')]()[_0x006e('0x24')](function(){_0x585e40[_0x006e('0x19')](0xcc)[_0x006e('0x26')]();});}};}function handleEntityNotFound(_0x4b017a,_0x407438){return function(_0x3028a0){if(!_0x3028a0){_0x4b017a[_0x006e('0x18')](0x194);}return _0x3028a0;};}function handleError(_0x2abc72,_0x32e4b6){_0x32e4b6=_0x32e4b6||0x1f4;return function(_0x1a74bb){logger[_0x006e('0x27')](_0x1a74bb[_0x006e('0x28')]);if(_0x1a74bb['name']){delete _0x1a74bb[_0x006e('0x29')];}_0x2abc72[_0x006e('0x19')](_0x32e4b6)[_0x006e('0x2a')](_0x1a74bb);};}exports[_0x006e('0x2b')]=function(_0x5b7441,_0x48446f){var _0xacfdb={},_0x414043={},_0x1de6ae={'count':0x0,'rows':[]};var _0x39a705=_[_0x006e('0x2c')](db[_0x006e('0x2d')][_0x006e('0x2e')],function(_0x584505){return{'name':_0x584505[_0x006e('0x2f')],'type':_0x584505['type']['key']};});_0x414043[_0x006e('0x30')]=_[_0x006e('0x2c')](_0x39a705,_0x006e('0x29'));_0x414043['query']=_['keys'](_0x5b7441['query']);_0x414043[_0x006e('0x31')]=_['intersection'](_0x414043[_0x006e('0x30')],_0x414043[_0x006e('0x32')]);_0xacfdb['attributes']=_['intersection'](_0x414043[_0x006e('0x30')],qs[_0x006e('0x33')](_0x5b7441[_0x006e('0x32')][_0x006e('0x33')]));_0xacfdb[_0x006e('0x34')]=_0xacfdb[_0x006e('0x34')][_0x006e('0x35')]?_0xacfdb['attributes']:_0x414043[_0x006e('0x30')];if(!_0x5b7441[_0x006e('0x32')]['hasOwnProperty'](_0x006e('0x36'))){_0xacfdb[_0x006e('0x1c')]=qs[_0x006e('0x1c')](_0x5b7441[_0x006e('0x32')]['limit']);_0xacfdb[_0x006e('0x1e')]=qs['offset'](_0x5b7441['query'][_0x006e('0x1e')]);}_0xacfdb[_0x006e('0x37')]=qs[_0x006e('0x38')](_0x5b7441['query'][_0x006e('0x38')]);_0xacfdb['where']=qs[_0x006e('0x31')](_['pick'](_0x5b7441[_0x006e('0x32')],_0x414043[_0x006e('0x31')]),_0x39a705);if(_0x5b7441[_0x006e('0x32')][_0x006e('0x39')]){_0xacfdb[_0x006e('0x3a')]=_['merge'](_0xacfdb[_0x006e('0x3a')],{'$or':_[_0x006e('0x2c')](_0x39a705,function(_0x2a5833){if(_0x2a5833[_0x006e('0x3b')]!==_0x006e('0x3c')){var _0x46f0f2={};_0x46f0f2[_0x2a5833['name']]={'$like':'%'+_0x5b7441[_0x006e('0x32')][_0x006e('0x39')]+'%'};return _0x46f0f2;}})});}_0xacfdb=_[_0x006e('0x3d')]({},_0xacfdb,_0x5b7441[_0x006e('0x3e')]);var _0x2c9072={'where':_0xacfdb[_0x006e('0x3a')]};return db[_0x006e('0x2d')][_0x006e('0x1d')](_0x2c9072)['then'](function(_0x1c017b){_0x1de6ae['count']=_0x1c017b;if(_0x5b7441[_0x006e('0x32')][_0x006e('0x3f')]){_0xacfdb[_0x006e('0x40')]=[{'all':!![]}];}return db[_0x006e('0x2d')][_0x006e('0x41')](_0xacfdb);})[_0x006e('0x24')](function(_0xc2cea0){_0x1de6ae[_0x006e('0x42')]=_0xc2cea0;return _0x1de6ae;})[_0x006e('0x24')](respondWithFilteredResult(_0x48446f,_0xacfdb))['catch'](handleError(_0x48446f,null));};exports[_0x006e('0x43')]=function(_0x50040e,_0x58c28c){var _0x37373e={'raw':!![],'where':{'id':_0x50040e[_0x006e('0x44')]['id']}},_0x533d1f={};_0x533d1f['model']=_[_0x006e('0x45')](db[_0x006e('0x2d')]['rawAttributes']);_0x533d1f[_0x006e('0x32')]=_[_0x006e('0x45')](_0x50040e[_0x006e('0x32')]);_0x533d1f[_0x006e('0x31')]=_[_0x006e('0x46')](_0x533d1f[_0x006e('0x30')],_0x533d1f[_0x006e('0x32')]);_0x37373e[_0x006e('0x34')]=_[_0x006e('0x46')](_0x533d1f[_0x006e('0x30')],qs['fields'](_0x50040e[_0x006e('0x32')][_0x006e('0x33')]));_0x37373e[_0x006e('0x34')]=_0x37373e['attributes']['length']?_0x37373e[_0x006e('0x34')]:_0x533d1f[_0x006e('0x30')];if(_0x50040e[_0x006e('0x32')][_0x006e('0x3f')]){_0x37373e[_0x006e('0x40')]=[{'all':!![]}];}_0x37373e=_[_0x006e('0x3d')]({},_0x37373e,_0x50040e[_0x006e('0x3e')]);return db[_0x006e('0x2d')][_0x006e('0x47')](_0x37373e)[_0x006e('0x24')](handleEntityNotFound(_0x58c28c,null))['then'](respondWithResult(_0x58c28c,null))[_0x006e('0x48')](handleError(_0x58c28c,null));};exports['create']=function(_0xca1619,_0x711838){return db[_0x006e('0x2d')][_0x006e('0x49')](_0xca1619['body'],{})[_0x006e('0x24')](respondWithResult(_0x711838,0xc9))[_0x006e('0x48')](handleError(_0x711838,null));};exports[_0x006e('0x4a')]=function(_0x4bde08,_0x54a759){if(_0x4bde08[_0x006e('0x4b')]['id']){delete _0x4bde08[_0x006e('0x4b')]['id'];}return db[_0x006e('0x2d')][_0x006e('0x47')]({'where':{'id':_0x4bde08['params']['id']}})[_0x006e('0x24')](handleEntityNotFound(_0x54a759,null))[_0x006e('0x24')](saveUpdates(_0x4bde08[_0x006e('0x4b')],null))[_0x006e('0x24')](respondWithResult(_0x54a759,null))[_0x006e('0x48')](handleError(_0x54a759,null));};exports['destroy']=function(_0x268323,_0x3f60cf){return db[_0x006e('0x2d')][_0x006e('0x47')]({'where':{'id':_0x268323[_0x006e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f60cf,null))[_0x006e('0x24')](removeEntity(_0x3f60cf,null))['catch'](handleError(_0x3f60cf,null));};exports[_0x006e('0x4c')]=function(_0x51de5d,_0x562cdf){return db[_0x006e('0x2d')][_0x006e('0x4c')]()[_0x006e('0x24')](respondWithResult(_0x562cdf,null))[_0x006e('0x48')](handleError(_0x562cdf,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index dc0213e..37f6603 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 _0xbbdd=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions'];(function(_0x538fe2,_0x5a5ce0){var _0x431f7d=function(_0x180071){while(--_0x180071){_0x538fe2['push'](_0x538fe2['shift']());}};_0x431f7d(++_0x5a5ce0);}(_0xbbdd,0x12c));var _0xdbbd=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xbbdd[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0xdbbd('0x0'));var util=require(_0xdbbd('0x1'));var logger=require(_0xdbbd('0x2'))(_0xdbbd('0x3'));var moment=require(_0xdbbd('0x4'));var BPromise=require(_0xdbbd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbbd('0x6'));var rimraf=require(_0xdbbd('0x7'));var config=require(_0xdbbd('0x8'));var attributes=require(_0xdbbd('0x9'));module[_0xdbbd('0xa')]=function(_0x137734,_0xfdd461){return _0x137734['define']('JscriptyQuestionReport',attributes,{'tableName':_0xdbbd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f69=['path','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise'];(function(_0x375157,_0x324f62){var _0xcede22=function(_0x3d20a4){while(--_0x3d20a4){_0x375157['push'](_0x375157['shift']());}};_0xcede22(++_0x324f62);}(_0x7f69,0x11a));var _0x97f6=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x7f69[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x97f6('0x0'));var util=require(_0x97f6('0x1'));var logger=require('../../config/logger')(_0x97f6('0x2'));var moment=require(_0x97f6('0x3'));var BPromise=require(_0x97f6('0x4'));var rp=require(_0x97f6('0x5'));var fs=require('fs');var path=require(_0x97f6('0x6'));var rimraf=require('rimraf');var config=require(_0x97f6('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x97f6('0x8')]=function(_0x2f9bb9,_0xd8b546){return _0x2f9bb9[_0x97f6('0x9')](_0x97f6('0xa'),attributes,{'tableName':_0x97f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 7e26af4..2017065 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 _0xf659=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2a68bf,_0x3b6a4a){var _0x18037e=function(_0x11c0a2){while(--_0x11c0a2){_0x2a68bf['push'](_0x2a68bf['shift']());}};_0x18037e(++_0x3b6a4a);}(_0xf659,0x12d));var _0x9f65=function(_0x11a985,_0x4149e6){_0x11a985=_0x11a985-0x0;var _0x4de293=_0xf659[_0x11a985];return _0x4de293;};'use strict';var _=require(_0x9f65('0x0'));var util=require(_0x9f65('0x1'));var moment=require(_0x9f65('0x2'));var BPromise=require(_0x9f65('0x3'));var rs=require(_0x9f65('0x4'));var fs=require('fs');var Redis=require(_0x9f65('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f65('0x6'));var logger=require(_0x9f65('0x7'))(_0x9f65('0x8'));var config=require(_0x9f65('0x9'));var jayson=require(_0x9f65('0xa'));var client=jayson[_0x9f65('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f29db,_0x34e48e,_0x7d3eb1){return new BPromise(function(_0x387ce6,_0x10ee8){return client['request'](_0x3f29db,_0x7d3eb1)[_0x9f65('0xc')](function(_0x25c7cb){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x34e48e,_0x9f65('0xd'));logger['debug'](_0x9f65('0xe'),_0x34e48e,'request\x20sent',JSON[_0x9f65('0xf')](_0x25c7cb));if(_0x25c7cb['error']){if(_0x25c7cb[_0x9f65('0x10')][_0x9f65('0x11')]===0x1f4){logger['error'](_0x9f65('0x12'),_0x34e48e,_0x25c7cb[_0x9f65('0x10')][_0x9f65('0x13')]);return _0x10ee8(_0x25c7cb[_0x9f65('0x10')]['message']);}logger[_0x9f65('0x10')](_0x9f65('0x12'),_0x34e48e,_0x25c7cb[_0x9f65('0x10')][_0x9f65('0x13')]);return _0x387ce6(_0x25c7cb[_0x9f65('0x10')][_0x9f65('0x13')]);}else{logger[_0x9f65('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x34e48e,'request\x20sent');_0x387ce6(_0x25c7cb[_0x9f65('0x15')][_0x9f65('0x13')]);}})['catch'](function(_0x13a106){logger[_0x9f65('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x34e48e,_0x13a106);_0x10ee8(_0x13a106);});});} \ No newline at end of file +var _0x9d03=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x9d03,0x19e));var _0x39d0=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9d03[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x39d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x39d0('0x1'));var fs=require('fs');var Redis=require(_0x39d0('0x2'));var db=require(_0x39d0('0x3'))['db'];var utils=require(_0x39d0('0x4'));var logger=require('../../config/logger')(_0x39d0('0x5'));var config=require(_0x39d0('0x6'));var jayson=require(_0x39d0('0x7'));var client=jayson[_0x39d0('0x8')][_0x39d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c93de,_0x4176dd,_0x4096b7){return new BPromise(function(_0x83929c,_0x4765d3){return client[_0x39d0('0xa')](_0x4c93de,_0x4096b7)['then'](function(_0xb6d10f){logger[_0x39d0('0xb')](_0x39d0('0xc'),_0x4176dd,'request\x20sent');logger[_0x39d0('0xd')](_0x39d0('0xe'),_0x4176dd,_0x39d0('0xf'),JSON[_0x39d0('0x10')](_0xb6d10f));if(_0xb6d10f[_0x39d0('0x11')]){if(_0xb6d10f[_0x39d0('0x11')][_0x39d0('0x12')]===0x1f4){logger[_0x39d0('0x11')](_0x39d0('0xc'),_0x4176dd,_0xb6d10f[_0x39d0('0x11')][_0x39d0('0x13')]);return _0x4765d3(_0xb6d10f[_0x39d0('0x11')][_0x39d0('0x13')]);}logger['error'](_0x39d0('0xc'),_0x4176dd,_0xb6d10f['error'][_0x39d0('0x13')]);return _0x83929c(_0xb6d10f[_0x39d0('0x11')][_0x39d0('0x13')]);}else{logger[_0x39d0('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4176dd,_0x39d0('0xf'));_0x83929c(_0xb6d10f[_0x39d0('0x14')][_0x39d0('0x13')]);}})[_0x39d0('0x15')](function(_0x1549d2){logger[_0x39d0('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4176dd,_0x1549d2);_0x4765d3(_0x1549d2);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index bab3a41..8a904aa 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 _0x85b6=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','update','multer'];(function(_0x5ce3c1,_0x2ab59b){var _0x585640=function(_0x44bacb){while(--_0x44bacb){_0x5ce3c1['push'](_0x5ce3c1['shift']());}};_0x585640(++_0x2ab59b);}(_0x85b6,0x71));var _0x685b=function(_0x56989c,_0x6781f0){_0x56989c=_0x56989c-0x0;var _0x22ab27=_0x85b6[_0x56989c];return _0x22ab27;};'use strict';var multer=require(_0x685b('0x0'));var util=require(_0x685b('0x1'));var path=require(_0x685b('0x2'));var timeout=require(_0x685b('0x3'));var express=require('express');var router=express[_0x685b('0x4')]();var fs_extra=require(_0x685b('0x5'));var auth=require(_0x685b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x685b('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x685b('0x8')](),controller['index']);router[_0x685b('0x9')](_0x685b('0xa'),auth[_0x685b('0x8')](),controller[_0x685b('0xb')]);router[_0x685b('0x9')](_0x685b('0xc'),auth[_0x685b('0x8')](),controller['show']);router[_0x685b('0x9')](_0x685b('0xd'),auth['isAuthenticated'](),controller[_0x685b('0xe')]);router[_0x685b('0xf')]('/',auth[_0x685b('0x8')](),controller[_0x685b('0x10')]);router[_0x685b('0x11')](_0x685b('0xc'),auth[_0x685b('0x8')](),controller[_0x685b('0x12')]);router['delete'](_0x685b('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1dc2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','getQuestions','post','create','put','update'];(function(_0xa47d85,_0x1246b2){var _0x291c90=function(_0x749b94){while(--_0x749b94){_0xa47d85['push'](_0xa47d85['shift']());}};_0x291c90(++_0x1246b2);}(_0x1dc2,0x173));var _0x21dc=function(_0x19dbc2,_0x3fd4e4){_0x19dbc2=_0x19dbc2-0x0;var _0x237de2=_0x1dc2[_0x19dbc2];return _0x237de2;};'use strict';var multer=require(_0x21dc('0x0'));var util=require(_0x21dc('0x1'));var path=require(_0x21dc('0x2'));var timeout=require(_0x21dc('0x3'));var express=require(_0x21dc('0x4'));var router=express[_0x21dc('0x5')]();var fs_extra=require(_0x21dc('0x6'));var auth=require(_0x21dc('0x7'));var interaction=require(_0x21dc('0x8'));var config=require(_0x21dc('0x9'));var controller=require('./jscriptySessionReport.controller');router[_0x21dc('0xa')]('/',auth[_0x21dc('0xb')](),controller['index']);router[_0x21dc('0xa')](_0x21dc('0xc'),auth[_0x21dc('0xb')](),controller['describe']);router[_0x21dc('0xa')](_0x21dc('0xd'),auth['isAuthenticated'](),controller[_0x21dc('0xe')]);router[_0x21dc('0xa')]('/:id/questions',auth[_0x21dc('0xb')](),controller[_0x21dc('0xf')]);router[_0x21dc('0x10')]('/',auth[_0x21dc('0xb')](),controller[_0x21dc('0x11')]);router[_0x21dc('0x12')](_0x21dc('0xd'),auth['isAuthenticated'](),controller[_0x21dc('0x13')]);router[_0x21dc('0x14')](_0x21dc('0xd'),auth[_0x21dc('0xb')](),controller[_0x21dc('0x15')]);module[_0x21dc('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index e059d68..362cb9d 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 _0x11d3=['exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x525792,_0x31e333){var _0x57a622=function(_0xd8a631){while(--_0xd8a631){_0x525792['push'](_0x525792['shift']());}};_0x57a622(++_0x31e333);}(_0x11d3,0x1ac));var _0x311d=function(_0x1f6d4a,_0xc7036f){_0x1f6d4a=_0x1f6d4a-0x0;var _0x342511=_0x11d3[_0x1f6d4a];return _0x342511;};'use strict';var moment=require(_0x311d('0x0'));var Sequelize=require(_0x311d('0x1'));module[_0x311d('0x2')]={'starttime':{'type':Sequelize[_0x311d('0x3')],'set':function(_0x36e192){this['setDataValue']('starttime',_0x36e192);this[_0x311d('0x4')](_0x311d('0x5'),moment()[_0x311d('0x6')](_0x311d('0x7')));}},'endtime':{'type':Sequelize[_0x311d('0x3')]},'membername':{'type':Sequelize[_0x311d('0x8')]},'projectname':{'type':Sequelize[_0x311d('0x8')]},'queue':{'type':Sequelize[_0x311d('0x8')]},'uniqueid':{'type':Sequelize[_0x311d('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x311d('0x8')]},'completed':{'type':Sequelize[_0x311d('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x4f3d=['exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x2a7e9f,_0x33d5d8){var _0x1225d2=function(_0x335b2b){while(--_0x335b2b){_0x2a7e9f['push'](_0x2a7e9f['shift']());}};_0x1225d2(++_0x33d5d8);}(_0x4f3d,0x171));var _0xd4f3=function(_0xe8a4b3,_0x3abef1){_0xe8a4b3=_0xe8a4b3-0x0;var _0x4a4b8b=_0x4f3d[_0xe8a4b3];return _0x4a4b8b;};'use strict';var moment=require(_0xd4f3('0x0'));var Sequelize=require('sequelize');module[_0xd4f3('0x1')]={'starttime':{'type':Sequelize[_0xd4f3('0x2')],'set':function(_0x3915a5){this[_0xd4f3('0x3')](_0xd4f3('0x4'),_0x3915a5);this['setDataValue'](_0xd4f3('0x5'),moment()[_0xd4f3('0x6')](_0xd4f3('0x7')));}},'endtime':{'type':Sequelize[_0xd4f3('0x2')]},'membername':{'type':Sequelize[_0xd4f3('0x8')]},'projectname':{'type':Sequelize[_0xd4f3('0x8')]},'queue':{'type':Sequelize[_0xd4f3('0x8')]},'uniqueid':{'type':Sequelize[_0xd4f3('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd4f3('0x8')]},'completed':{'type':Sequelize[_0xd4f3('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 929e750..9a20618 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 _0xc29c=['send','index','JscriptySessionReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','findOne','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','reject','save','then','destroy','error','stack','name'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0xc29c,0x73));var _0xcc29=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0xc29c[_0x4c8a8f];return _0x404500;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc29('0x0'));var zipdir=require(_0xcc29('0x1'));var jsonpatch=require(_0xcc29('0x2'));var rp=require(_0xcc29('0x3'));var moment=require(_0xcc29('0x4'));var BPromise=require(_0xcc29('0x5'));var Mustache=require(_0xcc29('0x6'));var util=require(_0xcc29('0x7'));var path=require(_0xcc29('0x8'));var sox=require('sox');var csv=require(_0xcc29('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc29('0xa'));var squel=require(_0xcc29('0xb'));var crypto=require(_0xcc29('0xc'));var jsforce=require(_0xcc29('0xd'));var deskjs=require(_0xcc29('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc29('0xf'));var Redis=require(_0xcc29('0x10'));var authService=require(_0xcc29('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcc29('0x12'));var hardwareService=require(_0xcc29('0x13'));var logger=require(_0xcc29('0x14'))(_0xcc29('0x15'));var utils=require(_0xcc29('0x16'));var config=require(_0xcc29('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc29('0x18'))['db'];function respondWithStatusCode(_0x1e3474,_0x2776a0){_0x2776a0=_0x2776a0||0xcc;return function(_0x32ba5e){if(_0x32ba5e){return _0x1e3474['sendStatus'](_0x2776a0);}return _0x1e3474[_0xcc29('0x19')](_0x2776a0)[_0xcc29('0x1a')]();};}function respondWithResult(_0x2dfeab,_0x25ccc2){_0x25ccc2=_0x25ccc2||0xc8;return function(_0xb702f6){if(_0xb702f6){return _0x2dfeab['status'](_0x25ccc2)[_0xcc29('0x1b')](_0xb702f6);}};}function respondWithFilteredResult(_0x141ab0,_0x3bddf1){return function(_0x4ce649){if(_0x4ce649){var _0x2d44cc=typeof _0x3bddf1[_0xcc29('0x1c')]===_0xcc29('0x1d')&&typeof _0x3bddf1['limit']===_0xcc29('0x1d');var _0x47b2ae=_0x4ce649[_0xcc29('0x1e')];var _0x152b4b=_0x2d44cc?0x0:_0x3bddf1[_0xcc29('0x1c')];var _0x34c33a=_0x2d44cc?_0x4ce649[_0xcc29('0x1e')]:_0x3bddf1['offset']+_0x3bddf1[_0xcc29('0x1f')];var _0x511c24;if(_0x34c33a>=_0x47b2ae){_0x34c33a=_0x47b2ae;_0x511c24=0xc8;}else{_0x511c24=0xce;}_0x141ab0[_0xcc29('0x19')](_0x511c24);return _0x141ab0['set']('Content-Range',_0x152b4b+'-'+_0x34c33a+'/'+_0x47b2ae)[_0xcc29('0x1b')](_0x4ce649);}return null;};}function patchUpdates(_0x36d1fb){return function(_0x402824){try{jsonpatch['apply'](_0x402824,_0x36d1fb,!![]);}catch(_0x293c76){return BPromise[_0xcc29('0x20')](_0x293c76);}return _0x402824[_0xcc29('0x21')]();};}function saveUpdates(_0x33de28,_0x2064c9){return function(_0x4468f5){if(_0x4468f5){return _0x4468f5['update'](_0x33de28)[_0xcc29('0x22')](function(_0x5a282f){return _0x5a282f;});}return null;};}function removeEntity(_0x549f33,_0x2f23ef){return function(_0x42a550){if(_0x42a550){return _0x42a550[_0xcc29('0x23')]()[_0xcc29('0x22')](function(){_0x549f33['status'](0xcc)[_0xcc29('0x1a')]();});}};}function handleEntityNotFound(_0x114751,_0x3e12a2){return function(_0x3e3943){if(!_0x3e3943){_0x114751['sendStatus'](0x194);}return _0x3e3943;};}function handleError(_0x70fb43,_0x19e363){_0x19e363=_0x19e363||0x1f4;return function(_0x573e33){logger[_0xcc29('0x24')](_0x573e33[_0xcc29('0x25')]);if(_0x573e33[_0xcc29('0x26')]){delete _0x573e33[_0xcc29('0x26')];}_0x70fb43[_0xcc29('0x19')](_0x19e363)[_0xcc29('0x27')](_0x573e33);};}exports[_0xcc29('0x28')]=function(_0x37ffa4,_0x165f61){var _0x128f67={},_0xf0490={},_0x3606aa={'count':0x0,'rows':[]};var _0x26e69a=_['map'](db[_0xcc29('0x29')][_0xcc29('0x2a')],function(_0x3fdb65){return{'name':_0x3fdb65[_0xcc29('0x2b')],'type':_0x3fdb65[_0xcc29('0x2c')]['key']};});_0xf0490['model']=_[_0xcc29('0x2d')](_0x26e69a,_0xcc29('0x26'));_0xf0490[_0xcc29('0x2e')]=_[_0xcc29('0x2f')](_0x37ffa4[_0xcc29('0x2e')]);_0xf0490[_0xcc29('0x30')]=_[_0xcc29('0x31')](_0xf0490[_0xcc29('0x32')],_0xf0490[_0xcc29('0x2e')]);_0x128f67[_0xcc29('0x33')]=_[_0xcc29('0x31')](_0xf0490['model'],qs[_0xcc29('0x34')](_0x37ffa4[_0xcc29('0x2e')][_0xcc29('0x34')]));_0x128f67['attributes']=_0x128f67[_0xcc29('0x33')][_0xcc29('0x35')]?_0x128f67[_0xcc29('0x33')]:_0xf0490['model'];if(!_0x37ffa4[_0xcc29('0x2e')][_0xcc29('0x36')](_0xcc29('0x37'))){_0x128f67[_0xcc29('0x1f')]=qs[_0xcc29('0x1f')](_0x37ffa4[_0xcc29('0x2e')][_0xcc29('0x1f')]);_0x128f67[_0xcc29('0x1c')]=qs[_0xcc29('0x1c')](_0x37ffa4['query'][_0xcc29('0x1c')]);}_0x128f67['order']=qs[_0xcc29('0x38')](_0x37ffa4[_0xcc29('0x2e')][_0xcc29('0x38')]);_0x128f67[_0xcc29('0x39')]=qs[_0xcc29('0x30')](_[_0xcc29('0x3a')](_0x37ffa4[_0xcc29('0x2e')],_0xf0490[_0xcc29('0x30')]),_0x26e69a);if(_0x37ffa4[_0xcc29('0x2e')][_0xcc29('0x3b')]){_0x128f67[_0xcc29('0x39')]=_[_0xcc29('0x3c')](_0x128f67[_0xcc29('0x39')],{'$or':_[_0xcc29('0x2d')](_0x26e69a,function(_0x10c982){if(_0x10c982[_0xcc29('0x2c')]!==_0xcc29('0x3d')){var _0xa7d7b8={};_0xa7d7b8[_0x10c982[_0xcc29('0x26')]]={'$like':'%'+_0x37ffa4[_0xcc29('0x2e')]['filter']+'%'};return _0xa7d7b8;}})});}_0x128f67=_[_0xcc29('0x3c')]({},_0x128f67,_0x37ffa4[_0xcc29('0x3e')]);var _0x45e65a={'where':_0x128f67[_0xcc29('0x39')]};return db[_0xcc29('0x29')][_0xcc29('0x1e')](_0x45e65a)['then'](function(_0x2d7963){_0x3606aa['count']=_0x2d7963;if(_0x37ffa4[_0xcc29('0x2e')][_0xcc29('0x3f')]){_0x128f67[_0xcc29('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xcc29('0x41')](_0x128f67);})[_0xcc29('0x22')](function(_0x2b5dd9){_0x3606aa[_0xcc29('0x42')]=_0x2b5dd9;return _0x3606aa;})[_0xcc29('0x22')](respondWithFilteredResult(_0x165f61,_0x128f67))[_0xcc29('0x43')](handleError(_0x165f61,null));};exports[_0xcc29('0x44')]=function(_0x51c74b,_0x65bb31){var _0x286bd6={'raw':!![],'where':{'id':_0x51c74b[_0xcc29('0x45')]['id']}},_0x2ea6fc={};_0x2ea6fc[_0xcc29('0x32')]=_[_0xcc29('0x2f')](db[_0xcc29('0x29')][_0xcc29('0x2a')]);_0x2ea6fc[_0xcc29('0x2e')]=_[_0xcc29('0x2f')](_0x51c74b[_0xcc29('0x2e')]);_0x2ea6fc['filters']=_['intersection'](_0x2ea6fc['model'],_0x2ea6fc['query']);_0x286bd6[_0xcc29('0x33')]=_[_0xcc29('0x31')](_0x2ea6fc[_0xcc29('0x32')],qs[_0xcc29('0x34')](_0x51c74b[_0xcc29('0x2e')][_0xcc29('0x34')]));_0x286bd6['attributes']=_0x286bd6[_0xcc29('0x33')][_0xcc29('0x35')]?_0x286bd6['attributes']:_0x2ea6fc[_0xcc29('0x32')];if(_0x51c74b[_0xcc29('0x2e')][_0xcc29('0x3f')]){_0x286bd6[_0xcc29('0x40')]=[{'all':!![]}];}_0x286bd6=_[_0xcc29('0x3c')]({},_0x286bd6,_0x51c74b[_0xcc29('0x3e')]);return db[_0xcc29('0x29')][_0xcc29('0x46')](_0x286bd6)[_0xcc29('0x22')](handleEntityNotFound(_0x65bb31,null))['then'](respondWithResult(_0x65bb31,null))[_0xcc29('0x43')](handleError(_0x65bb31,null));};exports[_0xcc29('0x47')]=function(_0x44a1ca,_0x31bdd3){return db['JscriptySessionReport'][_0xcc29('0x47')](_0x44a1ca[_0xcc29('0x48')],{})['then'](respondWithResult(_0x31bdd3,0xc9))[_0xcc29('0x43')](handleError(_0x31bdd3,null));};exports[_0xcc29('0x49')]=function(_0x1048fc,_0x1080da){if(_0x1048fc['body']['id']){delete _0x1048fc[_0xcc29('0x48')]['id'];}return db['JscriptySessionReport'][_0xcc29('0x46')]({'where':{'id':_0x1048fc[_0xcc29('0x45')]['id']}})[_0xcc29('0x22')](handleEntityNotFound(_0x1080da,null))[_0xcc29('0x22')](saveUpdates(_0x1048fc[_0xcc29('0x48')],null))[_0xcc29('0x22')](respondWithResult(_0x1080da,null))['catch'](handleError(_0x1080da,null));};exports[_0xcc29('0x23')]=function(_0x351a7c,_0x44ea2f){return db['JscriptySessionReport'][_0xcc29('0x46')]({'where':{'id':_0x351a7c['params']['id']}})[_0xcc29('0x22')](handleEntityNotFound(_0x44ea2f,null))[_0xcc29('0x22')](removeEntity(_0x44ea2f,null))[_0xcc29('0x43')](handleError(_0x44ea2f,null));};exports[_0xcc29('0x4a')]=function(_0xa43aeb,_0x507a16){return db[_0xcc29('0x29')][_0xcc29('0x4a')]()[_0xcc29('0x22')](respondWithResult(_0x507a16,null))['catch'](handleError(_0x507a16,null));};exports['getQuestions']=function(_0x1c6887,_0x4bdef2,_0x246176){var _0x170ba8={'raw':!![],'where':{}};var _0x2e3255={};var _0x962f09={'count':0x0,'rows':[]};return db[_0xcc29('0x29')][_0xcc29('0x4b')]({'where':{'id':_0x1c6887[_0xcc29('0x45')]['id']}})[_0xcc29('0x22')](handleEntityNotFound(_0x4bdef2,null))[_0xcc29('0x22')](function(_0x1d9bd8){if(_0x1d9bd8){_0x2e3255[_0xcc29('0x32')]=_['keys'](db[_0xcc29('0x4c')]['rawAttributes']);_0x2e3255[_0xcc29('0x2e')]=_[_0xcc29('0x2f')](_0x1c6887[_0xcc29('0x2e')]);_0x2e3255['filters']=_[_0xcc29('0x31')](_0x2e3255[_0xcc29('0x32')],_0x2e3255['query']);_0x170ba8[_0xcc29('0x33')]=_['intersection'](_0x2e3255[_0xcc29('0x32')],qs['fields'](_0x1c6887[_0xcc29('0x2e')][_0xcc29('0x34')]));_0x170ba8[_0xcc29('0x33')]=_0x170ba8[_0xcc29('0x33')]['length']?_0x170ba8['attributes']:_0x2e3255[_0xcc29('0x32')];if(!_0x1c6887[_0xcc29('0x2e')][_0xcc29('0x36')](_0xcc29('0x37'))){_0x170ba8['limit']=qs[_0xcc29('0x1f')](_0x1c6887[_0xcc29('0x2e')][_0xcc29('0x1f')]);_0x170ba8[_0xcc29('0x1c')]=qs[_0xcc29('0x1c')](_0x1c6887[_0xcc29('0x2e')][_0xcc29('0x1c')]);}_0x170ba8['order']=qs[_0xcc29('0x38')](_0x1c6887[_0xcc29('0x2e')][_0xcc29('0x38')]);_0x170ba8[_0xcc29('0x39')]=qs['filters'](_[_0xcc29('0x3a')](_0x1c6887['query'],_0x2e3255['filters']));_0x170ba8['where']['SessionId']=_0x1d9bd8['id'];if(_0x1c6887['query']['filter']){_0x170ba8['where']=_[_0xcc29('0x3c')](_0x170ba8[_0xcc29('0x39')],{'$or':_['map'](_0x170ba8[_0xcc29('0x33')],function(_0x449685){var _0x2f7efb={};_0x2f7efb[_0x449685]={'$like':'%'+_0x1c6887[_0xcc29('0x2e')][_0xcc29('0x3b')]+'%'};return _0x2f7efb;})});}_0x170ba8=_['merge']({},_0x170ba8,_0x1c6887['options']);return db[_0xcc29('0x4c')][_0xcc29('0x1e')]({'where':_0x170ba8[_0xcc29('0x39')]})['then'](function(_0x162046){_0x962f09['count']=_0x162046;if(_0x1c6887[_0xcc29('0x2e')][_0xcc29('0x3f')]){_0x170ba8['include']=[{'all':!![]}];}return db[_0xcc29('0x4c')][_0xcc29('0x41')](_0x170ba8);})[_0xcc29('0x22')](function(_0x52dc83){_0x962f09[_0xcc29('0x42')]=_0x52dc83;return _0x962f09;});}})[_0xcc29('0x22')](respondWithFilteredResult(_0x4bdef2,_0x170ba8))['catch'](handleError(_0x4bdef2,null));}; \ No newline at end of file +var _0xa9c7=['pick','filter','merge','options','includeAll','findAll','rows','catch','create','body','params','describe','findOne','JscriptyQuestionReport','SessionId','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x33c3b1,_0x32ef0e){var _0xfe3956=function(_0xef2ed1){while(--_0xef2ed1){_0x33c3b1['push'](_0x33c3b1['shift']());}};_0xfe3956(++_0x32ef0e);}(_0xa9c7,0x137));var _0x7a9c=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0xa9c7[_0x1fc4e2];return _0x2ba184;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7a9c('0x0'));var jsonpatch=require(_0x7a9c('0x1'));var rp=require(_0x7a9c('0x2'));var moment=require(_0x7a9c('0x3'));var BPromise=require(_0x7a9c('0x4'));var Mustache=require('mustache');var util=require(_0x7a9c('0x5'));var path=require(_0x7a9c('0x6'));var sox=require(_0x7a9c('0x7'));var csv=require(_0x7a9c('0x8'));var ejs=require(_0x7a9c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a9c('0xa'));var squel=require(_0x7a9c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a9c('0x8'));var querystring=require(_0x7a9c('0xc'));var Papa=require(_0x7a9c('0xd'));var Redis=require('ioredis');var authService=require(_0x7a9c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7a9c('0xf'));var hardwareService=require(_0x7a9c('0x10'));var logger=require(_0x7a9c('0x11'))('api');var utils=require(_0x7a9c('0x12'));var config=require(_0x7a9c('0x13'));var licenseUtil=require(_0x7a9c('0x14'));var db=require(_0x7a9c('0x15'))['db'];function respondWithStatusCode(_0x114ff6,_0x343ad4){_0x343ad4=_0x343ad4||0xcc;return function(_0x1185b4){if(_0x1185b4){return _0x114ff6[_0x7a9c('0x16')](_0x343ad4);}return _0x114ff6[_0x7a9c('0x17')](_0x343ad4)['end']();};}function respondWithResult(_0xf25656,_0x3fa3e1){_0x3fa3e1=_0x3fa3e1||0xc8;return function(_0x4fe0f8){if(_0x4fe0f8){return _0xf25656[_0x7a9c('0x17')](_0x3fa3e1)[_0x7a9c('0x18')](_0x4fe0f8);}};}function respondWithFilteredResult(_0x953b02,_0x35155c){return function(_0x228738){if(_0x228738){var _0x332fe6=typeof _0x35155c[_0x7a9c('0x19')]===_0x7a9c('0x1a')&&typeof _0x35155c[_0x7a9c('0x1b')]===_0x7a9c('0x1a');var _0x186380=_0x228738[_0x7a9c('0x1c')];var _0x3464ef=_0x332fe6?0x0:_0x35155c[_0x7a9c('0x19')];var _0x317fe3=_0x332fe6?_0x228738[_0x7a9c('0x1c')]:_0x35155c[_0x7a9c('0x19')]+_0x35155c[_0x7a9c('0x1b')];var _0x54f98d;if(_0x317fe3>=_0x186380){_0x317fe3=_0x186380;_0x54f98d=0xc8;}else{_0x54f98d=0xce;}_0x953b02['status'](_0x54f98d);return _0x953b02[_0x7a9c('0x1d')](_0x7a9c('0x1e'),_0x3464ef+'-'+_0x317fe3+'/'+_0x186380)[_0x7a9c('0x18')](_0x228738);}return null;};}function patchUpdates(_0x2996fb){return function(_0x2a35ae){try{jsonpatch[_0x7a9c('0x1f')](_0x2a35ae,_0x2996fb,!![]);}catch(_0x5aa979){return BPromise['reject'](_0x5aa979);}return _0x2a35ae['save']();};}function saveUpdates(_0x51f4a8,_0x34d704){return function(_0x3452f6){if(_0x3452f6){return _0x3452f6[_0x7a9c('0x20')](_0x51f4a8)[_0x7a9c('0x21')](function(_0x29fca3){return _0x29fca3;});}return null;};}function removeEntity(_0x1f79f4,_0x5261af){return function(_0x434814){if(_0x434814){return _0x434814[_0x7a9c('0x22')]()['then'](function(){_0x1f79f4['status'](0xcc)[_0x7a9c('0x23')]();});}};}function handleEntityNotFound(_0xe4e2a5,_0x48fdc8){return function(_0x3bd1d9){if(!_0x3bd1d9){_0xe4e2a5['sendStatus'](0x194);}return _0x3bd1d9;};}function handleError(_0x5e0373,_0x1f5b1d){_0x1f5b1d=_0x1f5b1d||0x1f4;return function(_0x87574c){logger[_0x7a9c('0x24')](_0x87574c[_0x7a9c('0x25')]);if(_0x87574c[_0x7a9c('0x26')]){delete _0x87574c[_0x7a9c('0x26')];}_0x5e0373['status'](_0x1f5b1d)[_0x7a9c('0x27')](_0x87574c);};}exports['index']=function(_0x4c6504,_0x456671){var _0x5da948={},_0x5ec01c={},_0x45f037={'count':0x0,'rows':[]};var _0x2cb16a=_['map'](db[_0x7a9c('0x28')][_0x7a9c('0x29')],function(_0x48a52a){return{'name':_0x48a52a[_0x7a9c('0x2a')],'type':_0x48a52a[_0x7a9c('0x2b')][_0x7a9c('0x2c')]};});_0x5ec01c['model']=_[_0x7a9c('0x2d')](_0x2cb16a,_0x7a9c('0x26'));_0x5ec01c[_0x7a9c('0x2e')]=_[_0x7a9c('0x2f')](_0x4c6504['query']);_0x5ec01c[_0x7a9c('0x30')]=_[_0x7a9c('0x31')](_0x5ec01c[_0x7a9c('0x32')],_0x5ec01c['query']);_0x5da948[_0x7a9c('0x33')]=_[_0x7a9c('0x31')](_0x5ec01c['model'],qs[_0x7a9c('0x34')](_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x34')]));_0x5da948[_0x7a9c('0x33')]=_0x5da948['attributes'][_0x7a9c('0x35')]?_0x5da948['attributes']:_0x5ec01c[_0x7a9c('0x32')];if(!_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x36')](_0x7a9c('0x37'))){_0x5da948[_0x7a9c('0x1b')]=qs[_0x7a9c('0x1b')](_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x1b')]);_0x5da948[_0x7a9c('0x19')]=qs['offset'](_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x19')]);}_0x5da948[_0x7a9c('0x38')]=qs[_0x7a9c('0x39')](_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x39')]);_0x5da948[_0x7a9c('0x3a')]=qs[_0x7a9c('0x30')](_[_0x7a9c('0x3b')](_0x4c6504['query'],_0x5ec01c[_0x7a9c('0x30')]),_0x2cb16a);if(_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x3c')]){_0x5da948['where']=_[_0x7a9c('0x3d')](_0x5da948[_0x7a9c('0x3a')],{'$or':_[_0x7a9c('0x2d')](_0x2cb16a,function(_0x197dce){if(_0x197dce[_0x7a9c('0x2b')]!=='VIRTUAL'){var _0x42a21a={};_0x42a21a[_0x197dce['name']]={'$like':'%'+_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x3c')]+'%'};return _0x42a21a;}})});}_0x5da948=_[_0x7a9c('0x3d')]({},_0x5da948,_0x4c6504[_0x7a9c('0x3e')]);var _0x2dd653={'where':_0x5da948[_0x7a9c('0x3a')]};return db[_0x7a9c('0x28')][_0x7a9c('0x1c')](_0x2dd653)[_0x7a9c('0x21')](function(_0x1fb2e9){_0x45f037[_0x7a9c('0x1c')]=_0x1fb2e9;if(_0x4c6504[_0x7a9c('0x2e')][_0x7a9c('0x3f')]){_0x5da948['include']=[{'all':!![]}];}return db[_0x7a9c('0x28')][_0x7a9c('0x40')](_0x5da948);})[_0x7a9c('0x21')](function(_0x513c4c){_0x45f037[_0x7a9c('0x41')]=_0x513c4c;return _0x45f037;})[_0x7a9c('0x21')](respondWithFilteredResult(_0x456671,_0x5da948))[_0x7a9c('0x42')](handleError(_0x456671,null));};exports['show']=function(_0x1727c3,_0x2e6cf4){var _0x160e3b={'raw':!![],'where':{'id':_0x1727c3['params']['id']}},_0x42495a={};_0x42495a['model']=_[_0x7a9c('0x2f')](db['JscriptySessionReport']['rawAttributes']);_0x42495a[_0x7a9c('0x2e')]=_[_0x7a9c('0x2f')](_0x1727c3[_0x7a9c('0x2e')]);_0x42495a[_0x7a9c('0x30')]=_[_0x7a9c('0x31')](_0x42495a[_0x7a9c('0x32')],_0x42495a[_0x7a9c('0x2e')]);_0x160e3b[_0x7a9c('0x33')]=_[_0x7a9c('0x31')](_0x42495a[_0x7a9c('0x32')],qs[_0x7a9c('0x34')](_0x1727c3[_0x7a9c('0x2e')][_0x7a9c('0x34')]));_0x160e3b[_0x7a9c('0x33')]=_0x160e3b[_0x7a9c('0x33')]['length']?_0x160e3b[_0x7a9c('0x33')]:_0x42495a[_0x7a9c('0x32')];if(_0x1727c3[_0x7a9c('0x2e')][_0x7a9c('0x3f')]){_0x160e3b['include']=[{'all':!![]}];}_0x160e3b=_[_0x7a9c('0x3d')]({},_0x160e3b,_0x1727c3['options']);return db['JscriptySessionReport']['find'](_0x160e3b)[_0x7a9c('0x21')](handleEntityNotFound(_0x2e6cf4,null))[_0x7a9c('0x21')](respondWithResult(_0x2e6cf4,null))[_0x7a9c('0x42')](handleError(_0x2e6cf4,null));};exports[_0x7a9c('0x43')]=function(_0x6c12ef,_0x2a778c){return db[_0x7a9c('0x28')][_0x7a9c('0x43')](_0x6c12ef['body'],{})[_0x7a9c('0x21')](respondWithResult(_0x2a778c,0xc9))[_0x7a9c('0x42')](handleError(_0x2a778c,null));};exports['update']=function(_0x1e9382,_0x535555){if(_0x1e9382[_0x7a9c('0x44')]['id']){delete _0x1e9382[_0x7a9c('0x44')]['id'];}return db[_0x7a9c('0x28')]['find']({'where':{'id':_0x1e9382[_0x7a9c('0x45')]['id']}})[_0x7a9c('0x21')](handleEntityNotFound(_0x535555,null))[_0x7a9c('0x21')](saveUpdates(_0x1e9382[_0x7a9c('0x44')],null))['then'](respondWithResult(_0x535555,null))[_0x7a9c('0x42')](handleError(_0x535555,null));};exports[_0x7a9c('0x22')]=function(_0x5748c9,_0x408a0c){return db[_0x7a9c('0x28')]['find']({'where':{'id':_0x5748c9['params']['id']}})[_0x7a9c('0x21')](handleEntityNotFound(_0x408a0c,null))[_0x7a9c('0x21')](removeEntity(_0x408a0c,null))['catch'](handleError(_0x408a0c,null));};exports['describe']=function(_0x41bf83,_0x1f6ad5){return db['JscriptySessionReport'][_0x7a9c('0x46')]()[_0x7a9c('0x21')](respondWithResult(_0x1f6ad5,null))[_0x7a9c('0x42')](handleError(_0x1f6ad5,null));};exports['getQuestions']=function(_0x2a067a,_0x12ec9b,_0x1b6c67){var _0x250bce={'raw':!![],'where':{}};var _0x2e0525={};var _0xc162bb={'count':0x0,'rows':[]};return db[_0x7a9c('0x28')][_0x7a9c('0x47')]({'where':{'id':_0x2a067a['params']['id']}})[_0x7a9c('0x21')](handleEntityNotFound(_0x12ec9b,null))[_0x7a9c('0x21')](function(_0x339a23){if(_0x339a23){_0x2e0525[_0x7a9c('0x32')]=_[_0x7a9c('0x2f')](db[_0x7a9c('0x48')]['rawAttributes']);_0x2e0525[_0x7a9c('0x2e')]=_['keys'](_0x2a067a[_0x7a9c('0x2e')]);_0x2e0525[_0x7a9c('0x30')]=_['intersection'](_0x2e0525[_0x7a9c('0x32')],_0x2e0525[_0x7a9c('0x2e')]);_0x250bce[_0x7a9c('0x33')]=_[_0x7a9c('0x31')](_0x2e0525[_0x7a9c('0x32')],qs['fields'](_0x2a067a[_0x7a9c('0x2e')][_0x7a9c('0x34')]));_0x250bce[_0x7a9c('0x33')]=_0x250bce['attributes'][_0x7a9c('0x35')]?_0x250bce[_0x7a9c('0x33')]:_0x2e0525[_0x7a9c('0x32')];if(!_0x2a067a[_0x7a9c('0x2e')][_0x7a9c('0x36')]('nolimit')){_0x250bce[_0x7a9c('0x1b')]=qs[_0x7a9c('0x1b')](_0x2a067a[_0x7a9c('0x2e')][_0x7a9c('0x1b')]);_0x250bce[_0x7a9c('0x19')]=qs[_0x7a9c('0x19')](_0x2a067a[_0x7a9c('0x2e')]['offset']);}_0x250bce['order']=qs[_0x7a9c('0x39')](_0x2a067a[_0x7a9c('0x2e')][_0x7a9c('0x39')]);_0x250bce['where']=qs[_0x7a9c('0x30')](_[_0x7a9c('0x3b')](_0x2a067a[_0x7a9c('0x2e')],_0x2e0525[_0x7a9c('0x30')]));_0x250bce[_0x7a9c('0x3a')][_0x7a9c('0x49')]=_0x339a23['id'];if(_0x2a067a[_0x7a9c('0x2e')][_0x7a9c('0x3c')]){_0x250bce['where']=_[_0x7a9c('0x3d')](_0x250bce[_0x7a9c('0x3a')],{'$or':_[_0x7a9c('0x2d')](_0x250bce[_0x7a9c('0x33')],function(_0x35fd97){var _0x6586b0={};_0x6586b0[_0x35fd97]={'$like':'%'+_0x2a067a[_0x7a9c('0x2e')][_0x7a9c('0x3c')]+'%'};return _0x6586b0;})});}_0x250bce=_[_0x7a9c('0x3d')]({},_0x250bce,_0x2a067a[_0x7a9c('0x3e')]);return db[_0x7a9c('0x48')][_0x7a9c('0x1c')]({'where':_0x250bce[_0x7a9c('0x3a')]})[_0x7a9c('0x21')](function(_0x5a18d4){_0xc162bb[_0x7a9c('0x1c')]=_0x5a18d4;if(_0x2a067a[_0x7a9c('0x2e')][_0x7a9c('0x3f')]){_0x250bce['include']=[{'all':!![]}];}return db[_0x7a9c('0x48')][_0x7a9c('0x40')](_0x250bce);})['then'](function(_0x4df063){_0xc162bb[_0x7a9c('0x41')]=_0x4df063;return _0xc162bb;});}})[_0x7a9c('0x21')](respondWithFilteredResult(_0x12ec9b,_0x250bce))[_0x7a9c('0x42')](handleError(_0x12ec9b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 45abbba..58b306a 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash'];(function(_0x21a869,_0x4c0bac){var _0x4c1900=function(_0x584801){while(--_0x584801){_0x21a869['push'](_0x21a869['shift']());}};_0x4c1900(++_0x4c0bac);}(_0xabce,0x103));var _0xeabc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xabce[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash'];(function(_0x21c521,_0x441100){var _0x13ae59=function(_0x2f4faf){while(--_0x2f4faf){_0x21c521['push'](_0x21c521['shift']());}};_0x13ae59(++_0x441100);}(_0x5496,0x175));var _0x6549=function(_0x3d9e33,_0x2bf857){_0x3d9e33=_0x3d9e33-0x0;var _0x2a017b=_0x5496[_0x3d9e33];return _0x2a017b;};'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'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x6549('0xa'),'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 c454348..72fa6b3 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 _0x7bd0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bd0,0x111));var _0x07bd=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x7bd0[_0x54a9e3];return _0x247cce;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});} \ No newline at end of file +var _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xd117,0x182));var _0x7d11=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xd117[_0x478c8a];return _0x3b6b3e;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index caad9d5..d89e8a2 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 _0x3ef4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','util','path','express','Router','fs-extra'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3ef4,0xeb));var _0x43ef=function(_0x5ecd9f,_0x5451fa){_0x5ecd9f=_0x5ecd9f-0x0;var _0x2e6980=_0x3ef4[_0x5ecd9f];return _0x2e6980;};'use strict';var multer=require('multer');var util=require(_0x43ef('0x0'));var path=require(_0x43ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x43ef('0x2'));var router=express[_0x43ef('0x3')]();var fs_extra=require(_0x43ef('0x4'));var auth=require(_0x43ef('0x5'));var interaction=require(_0x43ef('0x6'));var config=require(_0x43ef('0x7'));var controller=require(_0x43ef('0x8'));router[_0x43ef('0x9')]('/',controller['index']);router[_0x43ef('0xa')](_0x43ef('0xb'),auth[_0x43ef('0xc')](),controller['update']);router[_0x43ef('0x9')](_0x43ef('0xd'),auth[_0x43ef('0xc')](),controller[_0x43ef('0xe')]);module[_0x43ef('0xf')]=router; \ No newline at end of file +var _0x5adb=['index','put','isAuthenticated','update','/download_log_file','downloadLogFile','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x5adb,0x84));var _0xb5ad=function(_0xb98825,_0x554182){_0xb98825=_0xb98825-0x0;var _0x451d90=_0x5adb[_0xb98825];return _0x451d90;};'use strict';var multer=require('multer');var util=require(_0xb5ad('0x0'));var path=require(_0xb5ad('0x1'));var timeout=require('connect-timeout');var express=require(_0xb5ad('0x2'));var router=express['Router']();var fs_extra=require(_0xb5ad('0x3'));var auth=require(_0xb5ad('0x4'));var interaction=require(_0xb5ad('0x5'));var config=require('../../config/environment');var controller=require(_0xb5ad('0x6'));router[_0xb5ad('0x7')]('/',controller[_0xb5ad('0x8')]);router[_0xb5ad('0x9')]('/:id',auth[_0xb5ad('0xa')](),controller[_0xb5ad('0xb')]);router['get'](_0xb5ad('0xc'),auth[_0xb5ad('0xa')](),controller[_0xb5ad('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 51ca5f1..d29d830 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 _0x2d9a=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x40cb7a,_0x505484){var _0x246f9c=function(_0x3bd730){while(--_0x3bd730){_0x40cb7a['push'](_0x40cb7a['shift']());}};_0x246f9c(++_0x505484);}(_0x2d9a,0x1ec));var _0xa2d9=function(_0x409ad2,_0x5129c1){_0x409ad2=_0x409ad2-0x0;var _0x595b5f=_0x2d9a[_0x409ad2];return _0x595b5f;};'use strict';var Sequelize=require(_0xa2d9('0x0'));module[_0xa2d9('0x1')]={'license':{'type':Sequelize[_0xa2d9('0x2')]},'data1':{'type':Sequelize[_0xa2d9('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xffa2=['sequelize','exports','TEXT','STRING'];(function(_0x2a8073,_0x25ba25){var _0x11f16f=function(_0x1370bb){while(--_0x1370bb){_0x2a8073['push'](_0x2a8073['shift']());}};_0x11f16f(++_0x25ba25);}(_0xffa2,0xd8));var _0x2ffa=function(_0xa1f656,_0x2492e1){_0xa1f656=_0xa1f656-0x0;var _0x3cfe2a=_0xffa2[_0xa1f656];return _0x3cfe2a;};'use strict';var Sequelize=require(_0x2ffa('0x0'));module[_0x2ffa('0x1')]={'license':{'type':Sequelize[_0x2ffa('0x2')]},'data1':{'type':Sequelize[_0x2ffa('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 4a6ee6e..f69130e 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 _0xe53e=['downloadLogFile','license-info.log','/var','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','../../config/license/util','model','keys','License','query','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','find','params','get','key','demo'];(function(_0x3a13eb,_0x54565e){var _0x1a383b=function(_0x4ad88c){while(--_0x4ad88c){_0x3a13eb['push'](_0x3a13eb['shift']());}};_0x1a383b(++_0x54565e);}(_0xe53e,0xde));var _0xee53=function(_0x292df6,_0x1277ea){_0x292df6=_0x292df6-0x0;var _0x5bcc23=_0xe53e[_0x292df6];return _0x5bcc23;};'use strict';var emlformat=require(_0xee53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee53('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee53('0x2'));var util=require(_0xee53('0x3'));var path=require(_0xee53('0x4'));var sox=require(_0xee53('0x5'));var csv=require('to-csv');var ejs=require(_0xee53('0x6'));var fs=require('fs');var fs_extra=require(_0xee53('0x7'));var _=require(_0xee53('0x8'));var squel=require('squel');var crypto=require(_0xee53('0x9'));var jsforce=require(_0xee53('0xa'));var deskjs=require(_0xee53('0xb'));var toCsv=require(_0xee53('0xc'));var querystring=require(_0xee53('0xd'));var Papa=require(_0xee53('0xe'));var Redis=require(_0xee53('0xf'));var authService=require(_0xee53('0x10'));var qs=require(_0xee53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee53('0x12'));var logger=require(_0xee53('0x13'))('api');var utils=require(_0xee53('0x14'));var config=require(_0xee53('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xee53('0x16'))['db'];function respondWithStatusCode(_0x40b83c,_0x2686c4){_0x2686c4=_0x2686c4||0xcc;return function(_0xfda9cd){if(_0xfda9cd){return _0x40b83c[_0xee53('0x17')](_0x2686c4);}return _0x40b83c['status'](_0x2686c4)['end']();};}function respondWithResult(_0x12b884,_0x1bc08b){_0x1bc08b=_0x1bc08b||0xc8;return function(_0xd53f57){if(_0xd53f57){return _0x12b884[_0xee53('0x18')](_0x1bc08b)['json'](_0xd53f57);}};}function respondWithFilteredResult(_0x2493c3,_0x287df4){return function(_0xb023ee){if(_0xb023ee){var _0x185eae=typeof _0x287df4[_0xee53('0x19')]===_0xee53('0x1a')&&typeof _0x287df4[_0xee53('0x1b')]===_0xee53('0x1a');var _0x421338=_0xb023ee[_0xee53('0x1c')];var _0x31a3fb=_0x185eae?0x0:_0x287df4[_0xee53('0x19')];var _0x1833d7=_0x185eae?_0xb023ee[_0xee53('0x1c')]:_0x287df4[_0xee53('0x19')]+_0x287df4[_0xee53('0x1b')];var _0x19b330;if(_0x1833d7>=_0x421338){_0x1833d7=_0x421338;_0x19b330=0xc8;}else{_0x19b330=0xce;}_0x2493c3[_0xee53('0x18')](_0x19b330);return _0x2493c3[_0xee53('0x1d')]('Content-Range',_0x31a3fb+'-'+_0x1833d7+'/'+_0x421338)[_0xee53('0x1e')](_0xb023ee);}return null;};}function patchUpdates(_0x356bb5){return function(_0x177f23){try{jsonpatch[_0xee53('0x1f')](_0x177f23,_0x356bb5,!![]);}catch(_0x56f43b){return BPromise[_0xee53('0x20')](_0x56f43b);}return _0x177f23[_0xee53('0x21')]();};}function saveUpdates(_0xa25b67,_0x430ec4){return function(_0x463315){if(_0x463315){return _0x463315[_0xee53('0x22')](_0xa25b67)[_0xee53('0x23')](function(_0xb8c3be){return _0xb8c3be;});}return null;};}function removeEntity(_0x378c61,_0x43db6c){return function(_0x41584c){if(_0x41584c){return _0x41584c[_0xee53('0x24')]()[_0xee53('0x23')](function(){_0x378c61[_0xee53('0x18')](0xcc)[_0xee53('0x25')]();});}};}function handleEntityNotFound(_0x16fbaf,_0x4cc527){return function(_0x2845ef){if(!_0x2845ef){_0x16fbaf['sendStatus'](0x194);}return _0x2845ef;};}function handleError(_0x21c31d,_0x43411e){_0x43411e=_0x43411e||0x1f4;return function(_0x422bf3){logger[_0xee53('0x26')](_0x422bf3[_0xee53('0x27')]);if(_0x422bf3[_0xee53('0x28')]){delete _0x422bf3['name'];}_0x21c31d[_0xee53('0x18')](_0x43411e)[_0xee53('0x29')](_0x422bf3);};}var utilLicense=require(_0xee53('0x2a'));exports['index']=function(_0x26873b,_0x53e1cc){var _0x11b1db={'raw':!![],'where':{'id':0x1}},_0x468bf8={};_0x468bf8[_0xee53('0x2b')]=_[_0xee53('0x2c')](db[_0xee53('0x2d')]['rawAttributes']);_0x468bf8[_0xee53('0x2e')]=_['keys'](_0x26873b[_0xee53('0x2e')]);_0x468bf8[_0xee53('0x2f')]=_['intersection'](_0x468bf8[_0xee53('0x2b')],_0x468bf8['query']);_0x11b1db[_0xee53('0x30')]=_[_0xee53('0x31')](_0x468bf8[_0xee53('0x2b')],qs['fields'](_0x26873b[_0xee53('0x2e')][_0xee53('0x32')]));_0x11b1db[_0xee53('0x30')]=_0x11b1db[_0xee53('0x30')][_0xee53('0x33')]?_0x11b1db[_0xee53('0x30')]:_0x468bf8[_0xee53('0x2b')];_0x11b1db=_[_0xee53('0x34')]({},_0x11b1db,_0x26873b[_0xee53('0x35')]);return utilLicense[_0xee53('0x36')](_0x11b1db)[_0xee53('0x23')](respondWithResult(_0x53e1cc,null))[_0xee53('0x37')](handleError(_0x53e1cc,null));};exports['update']=function(_0x2a8229,_0x3dff7e){if(_0x2a8229['body']['id']){delete _0x2a8229[_0xee53('0x38')]['id'];}return db[_0xee53('0x2d')][_0xee53('0x39')]({'where':{'id':_0x2a8229[_0xee53('0x3a')]['id']}})[_0xee53('0x23')](handleEntityNotFound(_0x3dff7e,null))[_0xee53('0x23')](function(_0x4d16c8){var _0x283bb2=_0x4d16c8[_0xee53('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x283bb2,_0x2a8229[_0xee53('0x38')][_0xee53('0x3c')]);})[_0xee53('0x23')](function(_0xa8ed84){if(!_0xa8ed84[_0xee53('0x3d')]){return saveUpdates(_0x2a8229['body'],null);}return _0xa8ed84;})[_0xee53('0x23')](respondWithResult(_0x3dff7e,null))[_0xee53('0x37')](handleError(_0x3dff7e,null));};exports[_0xee53('0x3e')]=function(_0x17b24c,_0x49ec5a){var _0x43ca8d=_0xee53('0x3f');var _0x21b4f0=path['join'](_0xee53('0x40'),'log',_0xee53('0x41'),_0x43ca8d);_0x49ec5a['setHeader'](_0xee53('0x42'),_0xee53('0x43')+_0x43ca8d);_0x49ec5a[_0xee53('0x1d')](_0xee53('0x44'),_0xee53('0x45'));_0x49ec5a[_0xee53('0x46')](_0x21b4f0);}; \ No newline at end of file +var _0xac25=['offset','undefined','count','limit','set','Content-Range','apply','then','destroy','sendStatus','error','stack','name','send','index','model','License','keys','query','filters','intersection','fields','attributes','length','merge','options','getLicense','update','body','find','params','get','checkLicense','demo','downloadLogFile','license-info.log','/var','log','xcally','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x3b827c,_0x2585e0){var _0x5e531c=function(_0xa68b2c){while(--_0xa68b2c){_0x3b827c['push'](_0x3b827c['shift']());}};_0x5e531c(++_0x2585e0);}(_0xac25,0xbb));var _0x5ac2=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xac25[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require(_0x5ac2('0x0'));var rimraf=require(_0x5ac2('0x1'));var zipdir=require(_0x5ac2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ac2('0x3'));var BPromise=require(_0x5ac2('0x4'));var Mustache=require('mustache');var util=require(_0x5ac2('0x5'));var path=require(_0x5ac2('0x6'));var sox=require(_0x5ac2('0x7'));var csv=require(_0x5ac2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ac2('0x9'));var _=require(_0x5ac2('0xa'));var squel=require(_0x5ac2('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ac2('0xc'));var deskjs=require(_0x5ac2('0xd'));var toCsv=require(_0x5ac2('0x8'));var querystring=require(_0x5ac2('0xe'));var Papa=require(_0x5ac2('0xf'));var Redis=require(_0x5ac2('0x10'));var authService=require(_0x5ac2('0x11'));var qs=require(_0x5ac2('0x12'));var as=require(_0x5ac2('0x13'));var hardwareService=require(_0x5ac2('0x14'));var logger=require('../../config/logger')(_0x5ac2('0x15'));var utils=require(_0x5ac2('0x16'));var config=require(_0x5ac2('0x17'));var licenseUtil=require(_0x5ac2('0x18'));var db=require(_0x5ac2('0x19'))['db'];function respondWithStatusCode(_0x2800ea,_0x35f7a7){_0x35f7a7=_0x35f7a7||0xcc;return function(_0x352ee2){if(_0x352ee2){return _0x2800ea['sendStatus'](_0x35f7a7);}return _0x2800ea[_0x5ac2('0x1a')](_0x35f7a7)[_0x5ac2('0x1b')]();};}function respondWithResult(_0x4a6dd7,_0x38b789){_0x38b789=_0x38b789||0xc8;return function(_0x1b868e){if(_0x1b868e){return _0x4a6dd7[_0x5ac2('0x1a')](_0x38b789)[_0x5ac2('0x1c')](_0x1b868e);}};}function respondWithFilteredResult(_0x503802,_0x21126e){return function(_0x54f922){if(_0x54f922){var _0x2f28dc=typeof _0x21126e[_0x5ac2('0x1d')]===_0x5ac2('0x1e')&&typeof _0x21126e['limit']===_0x5ac2('0x1e');var _0x8dbcd7=_0x54f922['count'];var _0x2fb970=_0x2f28dc?0x0:_0x21126e[_0x5ac2('0x1d')];var _0x5603ec=_0x2f28dc?_0x54f922[_0x5ac2('0x1f')]:_0x21126e[_0x5ac2('0x1d')]+_0x21126e[_0x5ac2('0x20')];var _0x4d0b54;if(_0x5603ec>=_0x8dbcd7){_0x5603ec=_0x8dbcd7;_0x4d0b54=0xc8;}else{_0x4d0b54=0xce;}_0x503802[_0x5ac2('0x1a')](_0x4d0b54);return _0x503802[_0x5ac2('0x21')](_0x5ac2('0x22'),_0x2fb970+'-'+_0x5603ec+'/'+_0x8dbcd7)[_0x5ac2('0x1c')](_0x54f922);}return null;};}function patchUpdates(_0x2c44c1){return function(_0x38af4b){try{jsonpatch[_0x5ac2('0x23')](_0x38af4b,_0x2c44c1,!![]);}catch(_0x470a88){return BPromise['reject'](_0x470a88);}return _0x38af4b['save']();};}function saveUpdates(_0x340b6a,_0x1db268){return function(_0x3bfc82){if(_0x3bfc82){return _0x3bfc82['update'](_0x340b6a)[_0x5ac2('0x24')](function(_0x475f0d){return _0x475f0d;});}return null;};}function removeEntity(_0x4b2b78,_0x2454d6){return function(_0x202fb0){if(_0x202fb0){return _0x202fb0[_0x5ac2('0x25')]()['then'](function(){_0x4b2b78[_0x5ac2('0x1a')](0xcc)[_0x5ac2('0x1b')]();});}};}function handleEntityNotFound(_0x13af83,_0x3b081f){return function(_0x2916e3){if(!_0x2916e3){_0x13af83[_0x5ac2('0x26')](0x194);}return _0x2916e3;};}function handleError(_0xc597ac,_0x490dcb){_0x490dcb=_0x490dcb||0x1f4;return function(_0x43cd52){logger[_0x5ac2('0x27')](_0x43cd52[_0x5ac2('0x28')]);if(_0x43cd52[_0x5ac2('0x29')]){delete _0x43cd52['name'];}_0xc597ac['status'](_0x490dcb)[_0x5ac2('0x2a')](_0x43cd52);};}var utilLicense=require(_0x5ac2('0x18'));exports[_0x5ac2('0x2b')]=function(_0x58aa0b,_0x1da411){var _0x2fbcf1={'raw':!![],'where':{'id':0x1}},_0x57a75c={};_0x57a75c[_0x5ac2('0x2c')]=_['keys'](db[_0x5ac2('0x2d')]['rawAttributes']);_0x57a75c['query']=_[_0x5ac2('0x2e')](_0x58aa0b[_0x5ac2('0x2f')]);_0x57a75c[_0x5ac2('0x30')]=_[_0x5ac2('0x31')](_0x57a75c['model'],_0x57a75c['query']);_0x2fbcf1['attributes']=_[_0x5ac2('0x31')](_0x57a75c[_0x5ac2('0x2c')],qs[_0x5ac2('0x32')](_0x58aa0b[_0x5ac2('0x2f')]['fields']));_0x2fbcf1[_0x5ac2('0x33')]=_0x2fbcf1[_0x5ac2('0x33')][_0x5ac2('0x34')]?_0x2fbcf1[_0x5ac2('0x33')]:_0x57a75c[_0x5ac2('0x2c')];_0x2fbcf1=_[_0x5ac2('0x35')]({},_0x2fbcf1,_0x58aa0b[_0x5ac2('0x36')]);return utilLicense[_0x5ac2('0x37')](_0x2fbcf1)[_0x5ac2('0x24')](respondWithResult(_0x1da411,null))['catch'](handleError(_0x1da411,null));};exports[_0x5ac2('0x38')]=function(_0x34c2c8,_0x2845ae){if(_0x34c2c8[_0x5ac2('0x39')]['id']){delete _0x34c2c8[_0x5ac2('0x39')]['id'];}return db[_0x5ac2('0x2d')][_0x5ac2('0x3a')]({'where':{'id':_0x34c2c8[_0x5ac2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2845ae,null))[_0x5ac2('0x24')](function(_0x423ba6){var _0x1d6190=_0x423ba6[_0x5ac2('0x3c')]({'plain':!![]});return utilLicense[_0x5ac2('0x3d')](_0x1d6190,_0x34c2c8['body']['key']);})['then'](function(_0x4ad141){if(!_0x4ad141[_0x5ac2('0x3e')]){return saveUpdates(_0x34c2c8[_0x5ac2('0x39')],null);}return _0x4ad141;})[_0x5ac2('0x24')](respondWithResult(_0x2845ae,null))['catch'](handleError(_0x2845ae,null));};exports[_0x5ac2('0x3f')]=function(_0x2c2350,_0x2b23f1){var _0x23d454=_0x5ac2('0x40');var _0xf23454=path['join'](_0x5ac2('0x41'),_0x5ac2('0x42'),_0x5ac2('0x43'),_0x23d454);_0x2b23f1['setHeader'](_0x5ac2('0x44'),_0x5ac2('0x45')+_0x23d454);_0x2b23f1['set']('Content-Type',_0x5ac2('0x46'));_0x2b23f1[_0x5ac2('0x47')](_0xf23454);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 99daf9c..9eef61f 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 _0xbe64=['../../config/environment','define','license','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xbe64,0x123));var _0x4be6=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xbe64[_0x42020e];return _0x561551;};'use strict';var _=require(_0x4be6('0x0'));var util=require(_0x4be6('0x1'));var logger=require(_0x4be6('0x2'))(_0x4be6('0x3'));var moment=require('moment');var BPromise=require(_0x4be6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4be6('0x5'));var rimraf=require('rimraf');var config=require(_0x4be6('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x50d645,_0x140474){return _0x50d645[_0x4be6('0x7')]('License',attributes,{'tableName':_0x4be6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7d6=['./license.attributes','exports','License','license','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xa7d6,0xe0));var _0x6a7d=function(_0x57eb96,_0x2fd5d){_0x57eb96=_0x57eb96-0x0;var _0x46f586=_0xa7d6[_0x57eb96];return _0x46f586;};'use strict';var _=require(_0x6a7d('0x0'));var util=require(_0x6a7d('0x1'));var logger=require(_0x6a7d('0x2'))(_0x6a7d('0x3'));var moment=require(_0x6a7d('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a7d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6a7d('0x6'));var attributes=require(_0x6a7d('0x7'));module[_0x6a7d('0x8')]=function(_0x1c8cb5,_0x582e07){return _0x1c8cb5['define'](_0x6a7d('0x9'),attributes,{'tableName':_0x6a7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 0f12c48..1f00fff 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 _0x0c90=['../../config/utils','../../config/logger','rpc','jayson/promise','request','info','License,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','util','moment','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0c90,0xc0));var _0x00c9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c90[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x00c9('0x0'));var moment=require(_0x00c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00c9('0x2'))['db'];var utils=require(_0x00c9('0x3'));var logger=require(_0x00c9('0x4'))(_0x00c9('0x5'));var config=require('../../config/environment');var jayson=require(_0x00c9('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48fdea,_0x32190b,_0x4deae9){return new BPromise(function(_0x956ec,_0x41d237){return client[_0x00c9('0x7')](_0x48fdea,_0x4deae9)['then'](function(_0x18f114){logger[_0x00c9('0x8')](_0x00c9('0x9'),_0x32190b,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x32190b,'request\x20sent',JSON[_0x00c9('0xa')](_0x18f114));if(_0x18f114[_0x00c9('0xb')]){if(_0x18f114['error']['code']===0x1f4){logger[_0x00c9('0xb')](_0x00c9('0x9'),_0x32190b,_0x18f114[_0x00c9('0xb')][_0x00c9('0xc')]);return _0x41d237(_0x18f114[_0x00c9('0xb')]['message']);}logger['error'](_0x00c9('0x9'),_0x32190b,_0x18f114[_0x00c9('0xb')][_0x00c9('0xc')]);return _0x956ec(_0x18f114[_0x00c9('0xb')][_0x00c9('0xc')]);}else{logger[_0x00c9('0x8')]('License,\x20%s,\x20%s',_0x32190b,_0x00c9('0xd'));_0x956ec(_0x18f114['result']['message']);}})[_0x00c9('0xe')](function(_0x258210){logger[_0x00c9('0xb')](_0x00c9('0x9'),_0x32190b,_0x258210);_0x41d237(_0x258210);});});} \ No newline at end of file +var _0xce9b=['ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5d008b,_0x12b7b2){var _0x381807=function(_0x270f75){while(--_0x270f75){_0x5d008b['push'](_0x5d008b['shift']());}};_0x381807(++_0x12b7b2);}(_0xce9b,0x18b));var _0xbce9=function(_0x5bd34a,_0x897af8){_0x5bd34a=_0x5bd34a-0x0;var _0x55cb94=_0xce9b[_0x5bd34a];return _0x55cb94;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var moment=require('moment');var BPromise=require(_0xbce9('0x2'));var rs=require(_0xbce9('0x3'));var fs=require('fs');var Redis=require(_0xbce9('0x4'));var db=require(_0xbce9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbce9('0x6'));var config=require(_0xbce9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbce9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x422466,_0x159220,_0x225d69){return new BPromise(function(_0x434587,_0xb23644){return client[_0xbce9('0x9')](_0x422466,_0x225d69)[_0xbce9('0xa')](function(_0x30304b){logger[_0xbce9('0xb')](_0xbce9('0xc'),_0x159220,_0xbce9('0xd'));logger[_0xbce9('0xe')](_0xbce9('0xf'),_0x159220,_0xbce9('0xd'),JSON[_0xbce9('0x10')](_0x30304b));if(_0x30304b[_0xbce9('0x11')]){if(_0x30304b['error']['code']===0x1f4){logger[_0xbce9('0x11')](_0xbce9('0xc'),_0x159220,_0x30304b[_0xbce9('0x11')][_0xbce9('0x12')]);return _0xb23644(_0x30304b['error'][_0xbce9('0x12')]);}logger[_0xbce9('0x11')](_0xbce9('0xc'),_0x159220,_0x30304b[_0xbce9('0x11')][_0xbce9('0x12')]);return _0x434587(_0x30304b[_0xbce9('0x11')]['message']);}else{logger[_0xbce9('0xb')]('License,\x20%s,\x20%s',_0x159220,_0xbce9('0xd'));_0x434587(_0x30304b[_0xbce9('0x13')]['message']);}})[_0xbce9('0x14')](function(_0x38641b){logger[_0xbce9('0x11')](_0xbce9('0xc'),_0x159220,_0x38641b);_0xb23644(_0x38641b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 37ee08f..dc0d3c6 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 _0xe134=['/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addImap','addSmtp','addInteraction','send','addAgents','put','update','delete','removeAnswers','removeImap','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','./mailAccount.controller','isAuthenticated','index','get','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xe134,0xc3));var _0x4e13=function(_0x3f4dcf,_0x388cca){_0x3f4dcf=_0x3f4dcf-0x0;var _0x427da9=_0xe134[_0x3f4dcf];return _0x427da9;};'use strict';var multer=require(_0x4e13('0x0'));var util=require('util');var path=require(_0x4e13('0x1'));var timeout=require(_0x4e13('0x2'));var express=require(_0x4e13('0x3'));var router=express[_0x4e13('0x4')]();var fs_extra=require(_0x4e13('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4e13('0x6'));router['get']('/',auth[_0x4e13('0x7')](),controller[_0x4e13('0x8')]);router[_0x4e13('0x9')]('/describe',auth[_0x4e13('0x7')](),controller[_0x4e13('0xa')]);router[_0x4e13('0x9')](_0x4e13('0xb'),auth[_0x4e13('0x7')](),controller['show']);router['get'](_0x4e13('0xc'),auth[_0x4e13('0x7')](),controller[_0x4e13('0xd')]);router[_0x4e13('0x9')](_0x4e13('0xe'),auth[_0x4e13('0x7')](),controller[_0x4e13('0xf')]);router[_0x4e13('0x9')](_0x4e13('0x10'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x11')]);router['get'](_0x4e13('0x12'),auth[_0x4e13('0x7')](),controller['getSmtp']);router[_0x4e13('0x9')](_0x4e13('0x13'),auth[_0x4e13('0x7')](),controller['getInteractions']);router['get'](_0x4e13('0x14'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x15')]);router['get'](_0x4e13('0x16'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x17')]);router[_0x4e13('0x9')](_0x4e13('0x18'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x19')]);router[_0x4e13('0x9')](_0x4e13('0x1a'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x1b')]);router[_0x4e13('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4e13('0x1d')]);router[_0x4e13('0x1c')](_0x4e13('0xe'),auth[_0x4e13('0x7')](),controller['addAnswer']);router[_0x4e13('0x1c')]('/',auth[_0x4e13('0x7')](),controller[_0x4e13('0x1e')]);router[_0x4e13('0x1c')]('/:id/in_servers',auth[_0x4e13('0x7')](),controller[_0x4e13('0x1f')]);router[_0x4e13('0x1c')](_0x4e13('0x12'),auth['isAuthenticated'](),controller[_0x4e13('0x20')]);router[_0x4e13('0x1c')](_0x4e13('0x13'),auth['isAuthenticated'](),controller[_0x4e13('0x21')]);router[_0x4e13('0x1c')](_0x4e13('0x14'),auth[_0x4e13('0x7')](),controller['addApplications']);router[_0x4e13('0x1c')]('/:id/send',auth[_0x4e13('0x7')](),controller[_0x4e13('0x22')]);router[_0x4e13('0x1c')]('/:id/users',auth[_0x4e13('0x7')](),controller[_0x4e13('0x23')]);router[_0x4e13('0x24')]('/:id',auth[_0x4e13('0x7')](),controller[_0x4e13('0x25')]);router['delete']('/:id/dispositions',auth[_0x4e13('0x7')](),controller['removeDispositions']);router[_0x4e13('0x26')](_0x4e13('0xe'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x27')]);router[_0x4e13('0x26')](_0x4e13('0x10'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x28')]);router[_0x4e13('0x26')]('/:id/out_servers',auth['isAuthenticated'](),controller['removeSmtp']);router['delete'](_0x4e13('0xb'),auth[_0x4e13('0x7')](),controller[_0x4e13('0x29')]);router['delete'](_0x4e13('0x1a'),auth[_0x4e13('0x7')](),controller['removeAgents']);module[_0x4e13('0x2a')]=router; \ No newline at end of file +var _0xa9b4=['getSmtp','getInteractions','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','addDisposition','post','addAnswer','addImap','addSmtp','/:id/interactions','addInteraction','/:id/applications','addApplications','send','addAgents','put','update','removeDispositions','removeAnswers','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers'];(function(_0x3523ff,_0x4b8413){var _0xee01c1=function(_0x4c4724){while(--_0x4c4724){_0x3523ff['push'](_0x3523ff['shift']());}};_0xee01c1(++_0x4b8413);}(_0xa9b4,0xda));var _0x4a9b=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xa9b4[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x4a9b('0x0'));var util=require(_0x4a9b('0x1'));var path=require('path');var timeout=require(_0x4a9b('0x2'));var express=require(_0x4a9b('0x3'));var router=express[_0x4a9b('0x4')]();var fs_extra=require(_0x4a9b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4a9b('0x6'));var config=require(_0x4a9b('0x7'));var controller=require(_0x4a9b('0x8'));router[_0x4a9b('0x9')]('/',auth[_0x4a9b('0xa')](),controller['index']);router[_0x4a9b('0x9')](_0x4a9b('0xb'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0xc')]);router[_0x4a9b('0x9')](_0x4a9b('0xd'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0xe')]);router['get'](_0x4a9b('0xf'),auth['isAuthenticated'](),controller[_0x4a9b('0x10')]);router[_0x4a9b('0x9')](_0x4a9b('0x11'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x12')]);router['get'](_0x4a9b('0x13'),auth['isAuthenticated'](),controller[_0x4a9b('0x14')]);router['get'](_0x4a9b('0x15'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x16')]);router[_0x4a9b('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x4a9b('0x17')]);router[_0x4a9b('0x9')]('/:id/applications',auth[_0x4a9b('0xa')](),controller['getApplications']);router[_0x4a9b('0x9')](_0x4a9b('0x18'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x19')]);router['get'](_0x4a9b('0x1a'),auth[_0x4a9b('0xa')](),controller['verifySmtp']);router[_0x4a9b('0x9')](_0x4a9b('0x1b'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x1c')]);router['post'](_0x4a9b('0xf'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x1d')]);router[_0x4a9b('0x1e')](_0x4a9b('0x11'),auth['isAuthenticated'](),controller[_0x4a9b('0x1f')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/in_servers',auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x20')]);router[_0x4a9b('0x1e')](_0x4a9b('0x15'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x21')]);router[_0x4a9b('0x1e')](_0x4a9b('0x22'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x23')]);router[_0x4a9b('0x1e')](_0x4a9b('0x24'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x25')]);router['post']('/:id/send',auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x26')]);router[_0x4a9b('0x1e')](_0x4a9b('0x1b'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x27')]);router[_0x4a9b('0x28')](_0x4a9b('0xd'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x29')]);router['delete']('/:id/dispositions',auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x2a')]);router['delete']('/:id/canned_answers',auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x2b')]);router['delete'](_0x4a9b('0x13'),auth[_0x4a9b('0xa')](),controller['removeImap']);router[_0x4a9b('0x2c')](_0x4a9b('0x15'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x4a9b('0x2c')](_0x4a9b('0xd'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x2d')]);router[_0x4a9b('0x2c')](_0x4a9b('0x1b'),auth[_0x4a9b('0xa')](),controller[_0x4a9b('0x2e')]);module[_0x4a9b('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 5898bf1..4136309 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 _0xdbd1=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports'];(function(_0x4b1759,_0x28cfb1){var _0x12b1c2=function(_0x4fc02d){while(--_0x4fc02d){_0x4b1759['push'](_0x4b1759['shift']());}};_0x12b1c2(++_0x28cfb1);}(_0xdbd1,0xa9));var _0x1dbd=function(_0x553982,_0x17721f){_0x553982=_0x553982-0x0;var _0x2f0882=_0xdbd1[_0x553982];return _0x2f0882;};'use strict';var Sequelize=require(_0x1dbd('0x0'));module[_0x1dbd('0x1')]={'description':{'type':Sequelize[_0x1dbd('0x2')]},'name':{'type':Sequelize[_0x1dbd('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1dbd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1dbd('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1dbd('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1dbd('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x1dbd('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1dbd('0x5')},'fontSize':{'type':Sequelize[_0x1dbd('0x6')](0x2)[_0x1dbd('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1dbd('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[_0x1dbd('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1dbd('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1dbd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1dbd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1dbd('0x3')],'defaultValue':![],'comment':_0x1dbd('0x8'),'set':function(_0x26768e){if(!_0x26768e)this[_0x1dbd('0x9')](_0x1dbd('0xa'),null);this['setDataValue'](_0x1dbd('0xb'),_0x26768e);}},'provider':{'type':Sequelize[_0x1dbd('0xc')](_0x1dbd('0xd'),_0x1dbd('0xe'),_0x1dbd('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x1dbd('0x10')](_0x1dbd('0x11')))return _0x1dbd('0x12');return this['getDataValue']('provider');},'set':function(_0x2df6b2){if(_0x2df6b2===_0x1dbd('0x12'))_0x2df6b2=null;return this['setDataValue'](_0x1dbd('0x11'),_0x2df6b2);}}}; \ No newline at end of file +var _0x3e7b=['gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x3e7b,0x16f));var _0xb3e7=function(_0x2e9018,_0x46d802){_0x2e9018=_0x2e9018-0x0;var _0x346c49=_0x3e7b[_0x2e9018];return _0x346c49;};'use strict';var Sequelize=require(_0xb3e7('0x0'));module['exports']={'description':{'type':Sequelize[_0xb3e7('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xb3e7('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb3e7('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xb3e7('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xb3e7('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb3e7('0x1')],'allowNull':![],'defaultValue':_0xb3e7('0x4')},'fontSize':{'type':Sequelize[_0xb3e7('0x5')](0x2)[_0xb3e7('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb3e7('0x3')],'defaultValue':function(){return _0xb3e7('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb3e7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb3e7('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb3e7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb3e7('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb3e7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb3e7('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xb3e7('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb3e7('0x9'),'set':function(_0x471087){if(!_0x471087)this[_0xb3e7('0xa')](_0xb3e7('0xb'),null);this[_0xb3e7('0xa')](_0xb3e7('0xc'),_0x471087);}},'provider':{'type':Sequelize['ENUM'](_0xb3e7('0xd'),_0xb3e7('0xe'),_0xb3e7('0xf'),_0xb3e7('0x10')),'defaultValue':null,'get':function(){if(!this[_0xb3e7('0x11')](_0xb3e7('0x12')))return'custom';return this[_0xb3e7('0x11')]('provider');},'set':function(_0x1f1b58){if(_0x1f1b58===_0xb3e7('0x13'))_0x1f1b58=null;return this['setDataValue'](_0xb3e7('0x12'),_0x1f1b58);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 13ae996..c22c3d0 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 _0x43f8=['limit','count','offset','set','Content-Range','json','update','destroy','MailAccounts','UserProfileResource','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','include','body','provider','find','params','MailServerIn','describe','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','create','custom','email','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getImap','addImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','getSmtpOptions','SendMail','sendMail','defaults','out','messageId','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','undefined'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x43f8,0x161));var _0x843f=function(_0x7eca25,_0x3cb2c5){_0x7eca25=_0x7eca25-0x0;var _0x38a809=_0x43f8[_0x7eca25];return _0x38a809;};'use strict';var moment=require('moment');var BPromise=require(_0x843f('0x0'));var util=require(_0x843f('0x1'));var path=require(_0x843f('0x2'));var _=require(_0x843f('0x3'));var juice=require(_0x843f('0x4'));var Redis=require('ioredis');var qs=require(_0x843f('0x5'));var logger=require(_0x843f('0x6'))(_0x843f('0x7'));var config=require(_0x843f('0x8'));var db=require(_0x843f('0x9'))['db'];config[_0x843f('0xa')]=_['defaults'](config[_0x843f('0xa')],{'host':_0x843f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x843f('0xa')]));require('./mailAccount.socket')[_0x843f('0xc')](socket);var jayson=require(_0x843f('0xd'));var client=jayson[_0x843f('0xe')][_0x843f('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x1dda6d,_0xc29050,_0x25796a,_0x2a5acf){return new BPromise(function(_0x38181a,_0x13f1f1){var _0x133a6e=_0x2a5acf||client;return _0x133a6e[_0x843f('0x10')](_0x1dda6d,_0x25796a)[_0x843f('0x11')](function(_0x25044c){logger[_0x843f('0x12')](_0x843f('0x13'),_0xc29050,_0x843f('0x14'));logger['debug'](_0x843f('0x15'),_0xc29050,'request\x20sent',JSON[_0x843f('0x16')](_0x25044c));if(_0x25044c[_0x843f('0x17')]){if(_0x25044c[_0x843f('0x17')][_0x843f('0x18')]===0x1f4){logger[_0x843f('0x17')](_0x843f('0x13'),_0xc29050,_0x25044c['error'][_0x843f('0x19')]);return _0x13f1f1(_0x25044c[_0x843f('0x17')][_0x843f('0x19')]);}logger[_0x843f('0x17')](_0x843f('0x13'),_0xc29050,_0x25044c[_0x843f('0x17')][_0x843f('0x19')]);return _0x38181a(_0x25044c['error'][_0x843f('0x19')]);}else{logger[_0x843f('0x12')]('MailAccount,\x20%s,\x20%s',_0xc29050,'request\x20sent');_0x38181a(_0x25044c['result'][_0x843f('0x19')]);}})[_0x843f('0x1a')](function(_0x5b7507){logger[_0x843f('0x17')](_0x843f('0x13'),_0xc29050,_0x5b7507);_0x13f1f1(_0x5b7507);});});}function respondWithStatusCode(_0xd0cf6,_0x4d7acf){_0x4d7acf=_0x4d7acf||0xcc;return function(_0x56f055){if(_0x56f055){return _0xd0cf6[_0x843f('0x1b')](_0x4d7acf);}return _0xd0cf6['status'](_0x4d7acf)[_0x843f('0x1c')]();};}function respondWithResult(_0x20e273,_0xb9db0a){_0xb9db0a=_0xb9db0a||0xc8;return function(_0xdb1618){if(_0xdb1618){return _0x20e273[_0x843f('0x1d')](_0xb9db0a)['json'](_0xdb1618);}};}function respondWithFilteredResult(_0x3b2173,_0x5f1fe){return function(_0x12cefc){if(_0x12cefc){var _0x3a0f3a=typeof _0x5f1fe['offset']===_0x843f('0x1e')&&typeof _0x5f1fe[_0x843f('0x1f')]===_0x843f('0x1e');var _0x408df2=_0x12cefc[_0x843f('0x20')];var _0x4154b8=_0x3a0f3a?0x0:_0x5f1fe[_0x843f('0x21')];var _0x5041c3=_0x3a0f3a?_0x12cefc[_0x843f('0x20')]:_0x5f1fe[_0x843f('0x21')]+_0x5f1fe[_0x843f('0x1f')];var _0x484e77;if(_0x5041c3>=_0x408df2){_0x5041c3=_0x408df2;_0x484e77=0xc8;}else{_0x484e77=0xce;}_0x3b2173['status'](_0x484e77);return _0x3b2173[_0x843f('0x22')](_0x843f('0x23'),_0x4154b8+'-'+_0x5041c3+'/'+_0x408df2)[_0x843f('0x24')](_0x12cefc);}return null;};}function saveUpdates(_0x5a0350){return function(_0xb69a5b){if(_0xb69a5b){return _0xb69a5b[_0x843f('0x25')](_0x5a0350)[_0x843f('0x11')](function(_0x1d036c){return _0x1d036c;});}return null;};}function removeEntity(_0x5baeae){return function(_0x585a5c){if(_0x585a5c){return _0x585a5c[_0x843f('0x26')]()['then'](function(){var _0xd4b17a=_0x585a5c['get']({'plain':!![]});var _0xaac5c=_0x843f('0x27');return db[_0x843f('0x28')]['destroy']({'where':{'type':_0xaac5c,'resourceId':_0xd4b17a['id']}})['then'](function(){return _0x585a5c;});})['then'](function(){_0x5baeae[_0x843f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c610){return function(_0x213223){if(!_0x213223){_0x58c610[_0x843f('0x1b')](0x194);}return _0x213223;};}function handleError(_0x5b03d7,_0x34a5c8){_0x34a5c8=_0x34a5c8||0x1f4;return function(_0x500bbc){logger['error'](_0x500bbc[_0x843f('0x29')]);if(_0x500bbc[_0x843f('0x2a')]){delete _0x500bbc[_0x843f('0x2a')];}_0x5b03d7[_0x843f('0x1d')](_0x34a5c8)['send'](_0x500bbc);};}function getImapHost(_0x7d3b7e){switch(_0x7d3b7e){case _0x843f('0x2b'):return _0x843f('0x2c');case _0x843f('0x2d'):return _0x843f('0x2e');case _0x843f('0x2f'):return _0x843f('0x30');case _0x843f('0x31'):return _0x843f('0x32');}throw new Error(_0x843f('0x33'),_0x7d3b7e);}function getSmtpHost(_0x5405f3){switch(_0x5405f3){case _0x843f('0x2b'):return _0x843f('0x34');case _0x843f('0x2d'):return _0x843f('0x35');case _0x843f('0x2f'):return _0x843f('0x36');case _0x843f('0x31'):return _0x843f('0x37');}throw new Error(_0x843f('0x33'),_0x5405f3);}function getAuthenticationOptions(_0x1b41ba,_0x2d2daf){var _0x85a841={};var _0x256342={};if(_0x1b41ba){_0x85a841[_0x843f('0x38')]=_0x256342[_0x843f('0x38')]=_0x2d2daf[_0x843f('0x39')];_0x85a841[_0x843f('0x3a')]=_0x256342[_0x843f('0x3b')]=_0x2d2daf[_0x843f('0x3a')];if(_0x2d2daf[_0x843f('0x3c')]){_0x85a841['modernAuthentication']=_0x256342[_0x843f('0x3c')]=!![];_0x85a841[_0x843f('0x3d')]=_0x256342['CloudProviderId']=_0x2d2daf[_0x843f('0x3d')];_0x85a841['password']=_0x256342[_0x843f('0x3b')]=null;}else{_0x85a841['CloudProviderId']=_0x256342['CloudProviderId']=null;}_0x85a841['host']=getImapHost(_0x1b41ba);_0x85a841[_0x843f('0x3e')]=0x3e1;_0x256342[_0x843f('0x3f')]=getSmtpHost(_0x1b41ba);_0x256342[_0x843f('0x3e')]=0x24b;_0x256342[_0x843f('0x40')]=![];_0x85a841[_0x843f('0x41')]=_0x256342[_0x843f('0x41')]=null;}else{if(_0x2d2daf[_0x843f('0x42')]){_0x85a841['user']=_0x256342['user']=_0x2d2daf[_0x843f('0x39')];_0x85a841[_0x843f('0x3a')]=_0x256342[_0x843f('0x3b')]=_0x2d2daf[_0x843f('0x3a')];}else{_0x85a841[_0x843f('0x42')]=_0x256342[_0x843f('0x42')]=![];_0x85a841[_0x843f('0x38')]=_0x256342[_0x843f('0x38')]=null;_0x85a841[_0x843f('0x3a')]=_0x256342[_0x843f('0x3b')]=null;}_0x85a841['host']=_0x2d2daf[_0x843f('0x43')][_0x843f('0x3f')];_0x85a841[_0x843f('0x3e')]=_0x2d2daf[_0x843f('0x43')]['port'];_0x256342[_0x843f('0x3f')]=_0x2d2daf[_0x843f('0x44')][_0x843f('0x3f')];_0x256342[_0x843f('0x3e')]=_0x2d2daf[_0x843f('0x44')]['port'];}return{'Imap':_0x85a841,'Smtp':_0x256342};}exports['index']=function(_0x2668fd,_0x332ede){var _0x395b6f={'include':[{'model':db['MailServerIn'],'as':_0x843f('0x43')},{'model':db[_0x843f('0x45')],'as':'Smtp'},{'model':db[_0x843f('0x46')],'as':_0x843f('0x47')}]},_0x4e3f73={},_0x9c4f3c={'count':0x0,'rows':[]};var _0x4ad74d=_['map'](db[_0x843f('0x48')][_0x843f('0x49')],function(_0x35568c){return{'name':_0x35568c[_0x843f('0x4a')],'type':_0x35568c[_0x843f('0x4b')][_0x843f('0x4c')]};});_0x4e3f73[_0x843f('0x4d')]=_[_0x843f('0x4e')](_0x4ad74d,_0x843f('0x2a'));_0x4e3f73['query']=_[_0x843f('0x4f')](_0x2668fd['query']);_0x4e3f73[_0x843f('0x50')]=_[_0x843f('0x51')](_0x4e3f73[_0x843f('0x4d')],_0x4e3f73[_0x843f('0x52')]);_0x395b6f[_0x843f('0x53')]=_[_0x843f('0x51')](_0x4e3f73[_0x843f('0x4d')],qs[_0x843f('0x54')](_0x2668fd[_0x843f('0x52')][_0x843f('0x54')]));_0x395b6f[_0x843f('0x53')]=_0x395b6f[_0x843f('0x53')][_0x843f('0x55')]?_0x395b6f[_0x843f('0x53')]:_0x4e3f73[_0x843f('0x4d')];if(!_0x2668fd['query'][_0x843f('0x56')](_0x843f('0x57'))){_0x395b6f[_0x843f('0x1f')]=qs['limit'](_0x2668fd[_0x843f('0x52')][_0x843f('0x1f')]);_0x395b6f[_0x843f('0x21')]=qs['offset'](_0x2668fd[_0x843f('0x52')][_0x843f('0x21')]);}_0x395b6f[_0x843f('0x58')]=qs[_0x843f('0x59')](_0x2668fd[_0x843f('0x52')]['sort']);_0x395b6f[_0x843f('0x5a')]=qs[_0x843f('0x50')](_[_0x843f('0x5b')](_0x2668fd[_0x843f('0x52')],_0x4e3f73[_0x843f('0x50')]),_0x4ad74d);if(_0x2668fd[_0x843f('0x52')][_0x843f('0x5c')]){_0x395b6f['where']=_[_0x843f('0x5d')](_0x395b6f[_0x843f('0x5a')],{'$or':_['map'](_0x4ad74d,function(_0x53d37c){if(_0x53d37c[_0x843f('0x4b')]!=='VIRTUAL'){var _0x561fdf={};_0x561fdf[_0x53d37c[_0x843f('0x2a')]]={'$like':'%'+_0x2668fd[_0x843f('0x52')][_0x843f('0x5c')]+'%'};return _0x561fdf;}})});}_0x395b6f=_[_0x843f('0x5d')]({},_0x395b6f,_0x2668fd[_0x843f('0x5e')]);var _0x445e6c={'where':_0x395b6f['where']};return db[_0x843f('0x48')]['count'](_0x445e6c)[_0x843f('0x11')](function(_0x3d4424){_0x9c4f3c['count']=_0x3d4424;if(_0x2668fd[_0x843f('0x52')][_0x843f('0x5f')]){_0x395b6f['include']=[{'all':!![]}];}return db[_0x843f('0x48')][_0x843f('0x60')](_0x395b6f);})['then'](function(_0x1b2186){_0x9c4f3c[_0x843f('0x61')]=_0x1b2186;return _0x9c4f3c;})[_0x843f('0x11')](respondWithFilteredResult(_0x332ede,_0x395b6f))[_0x843f('0x1a')](handleError(_0x332ede,null));};exports[_0x843f('0x62')]=function(_0x402b8,_0x2c2e0b){var _0x118512={'raw':![],'where':{'id':_0x402b8['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x843f('0x43')},{'model':db[_0x843f('0x45')],'as':_0x843f('0x44')},{'model':db[_0x843f('0x46')],'as':_0x843f('0x47')}]},_0x3dd291={};_0x3dd291[_0x843f('0x4d')]=_[_0x843f('0x4f')](db[_0x843f('0x48')][_0x843f('0x49')]);_0x3dd291[_0x843f('0x52')]=_[_0x843f('0x4f')](_0x402b8['query']);_0x3dd291[_0x843f('0x50')]=_[_0x843f('0x51')](_0x3dd291['model'],_0x3dd291['query']);_0x118512['attributes']=_[_0x843f('0x51')](_0x3dd291[_0x843f('0x4d')],qs['fields'](_0x402b8[_0x843f('0x52')][_0x843f('0x54')]));_0x118512[_0x843f('0x53')]=_0x118512[_0x843f('0x53')][_0x843f('0x55')]?_0x118512[_0x843f('0x53')]:_0x3dd291[_0x843f('0x4d')];if(_0x402b8[_0x843f('0x52')][_0x843f('0x5f')]){_0x118512[_0x843f('0x63')]=[{'all':!![]}];}_0x118512=_[_0x843f('0x5d')]({},_0x118512,_0x402b8['options']);return db[_0x843f('0x48')]['find'](_0x118512)['then'](handleEntityNotFound(_0x2c2e0b,null))[_0x843f('0x11')](respondWithResult(_0x2c2e0b,null))[_0x843f('0x1a')](handleError(_0x2c2e0b,null));};exports[_0x843f('0x25')]=function(_0x38a59f,_0x319bc8){if(_0x38a59f[_0x843f('0x64')]['id']){delete _0x38a59f[_0x843f('0x64')]['id'];}var _0x3a1219=_0x38a59f['body'][_0x843f('0x65')]==='custom'?null:_0x38a59f[_0x843f('0x64')][_0x843f('0x65')];var _0x1d27f0=_0x38a59f[_0x843f('0x64')]['Imap']||{};var _0x413616=_0x38a59f[_0x843f('0x64')][_0x843f('0x44')]||{};if(_0x3a1219){_0x1d27f0[_0x843f('0x3f')]=getImapHost(_0x3a1219);_0x1d27f0[_0x843f('0x3e')]=0x3e1;_0x413616[_0x843f('0x3f')]=getSmtpHost(_0x3a1219);_0x413616[_0x843f('0x3e')]=0x24b;_0x413616[_0x843f('0x40')]=![];}if(_0x413616[_0x843f('0x3c')]){_0x413616['secure']=![];}else{_0x413616[_0x843f('0x3d')]=null;}if(!_0x1d27f0[_0x843f('0x3c')])_0x1d27f0[_0x843f('0x3d')]=null;_0x38a59f['body'][_0x843f('0x43')]=_0x1d27f0;_0x38a59f['body'][_0x843f('0x44')]=_0x413616;return db[_0x843f('0x48')][_0x843f('0x66')]({'where':{'id':_0x38a59f[_0x843f('0x67')]['id']},'include':[{'model':db[_0x843f('0x68')],'as':_0x843f('0x43')},{'model':db[_0x843f('0x45')],'as':_0x843f('0x44')},{'model':db[_0x843f('0x46')],'as':_0x843f('0x47')}]})[_0x843f('0x11')](handleEntityNotFound(_0x319bc8,null))[_0x843f('0x11')](function(_0xcb05c6){if(!_0xcb05c6)throw new Error('Mail\x20Account\x20not\x20found');if(_0xcb05c6[_0x843f('0x41')])delete _0x38a59f[_0x843f('0x64')]['Imap'];return _0xcb05c6;})[_0x843f('0x11')](saveUpdates(_0x38a59f[_0x843f('0x64')],null))[_0x843f('0x11')](function(_0x21c868){if(!_0x38a59f[_0x843f('0x64')]['Imap'])return _0x21c868;return db[_0x843f('0x68')][_0x843f('0x25')](_0x38a59f[_0x843f('0x64')][_0x843f('0x43')],{'where':{'MailAccountId':_0x21c868['id']}})[_0x843f('0x11')](function(){return _0x21c868;});})[_0x843f('0x11')](function(_0x196a34){if(!_0x38a59f[_0x843f('0x64')][_0x843f('0x44')])return _0x196a34;return db[_0x843f('0x45')][_0x843f('0x25')](_0x38a59f[_0x843f('0x64')][_0x843f('0x44')],{'where':{'MailAccountId':_0x196a34['id']}})[_0x843f('0x11')](function(){return _0x196a34;});})[_0x843f('0x11')](respondWithResult(_0x319bc8,null))['catch'](handleError(_0x319bc8,null));};exports[_0x843f('0x69')]=function(_0x319fa5,_0x502af8){return db[_0x843f('0x48')][_0x843f('0x69')]()[_0x843f('0x11')](respondWithResult(_0x502af8,null))[_0x843f('0x1a')](handleError(_0x502af8,null));};exports['addDisposition']=function(_0x2dd3ef,_0x3405f7){if(_0x2dd3ef['body']['id']){delete _0x2dd3ef[_0x843f('0x64')]['id'];}return db[_0x843f('0x48')][_0x843f('0x66')]({'where':{'id':_0x2dd3ef[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x3405f7,null))['then'](function(_0x254b0c){if(_0x254b0c){_0x2dd3ef['body'][_0x843f('0x6a')]=_0x254b0c['id'];return db[_0x843f('0x6b')]['create'](_0x2dd3ef['body']);}})[_0x843f('0x11')](respondWithResult(_0x3405f7,null))[_0x843f('0x1a')](handleError(_0x3405f7,null));};exports[_0x843f('0x6c')]=function(_0x472e25,_0x2cb077){var _0x222daf={'raw':![],'where':{}};var _0x390c62={};var _0x269daa={'count':0x0,'rows':[]};return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x472e25[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x2cb077,null))[_0x843f('0x11')](function(_0x580826){if(_0x580826){_0x390c62[_0x843f('0x4d')]=_[_0x843f('0x4f')](db[_0x843f('0x6b')][_0x843f('0x49')]);_0x390c62[_0x843f('0x52')]=_[_0x843f('0x4f')](_0x472e25['query']);_0x390c62[_0x843f('0x50')]=_[_0x843f('0x51')](_0x390c62[_0x843f('0x4d')],_0x390c62[_0x843f('0x52')]);_0x222daf['attributes']=_['intersection'](_0x390c62['model'],qs['fields'](_0x472e25[_0x843f('0x52')]['fields']));_0x222daf['attributes']=_0x222daf['attributes'][_0x843f('0x55')]?_0x222daf['attributes']:_0x390c62[_0x843f('0x4d')];if(!_0x472e25[_0x843f('0x52')][_0x843f('0x56')](_0x843f('0x57'))){_0x222daf[_0x843f('0x1f')]=qs[_0x843f('0x1f')](_0x472e25[_0x843f('0x52')]['limit']);_0x222daf[_0x843f('0x21')]=qs[_0x843f('0x21')](_0x472e25[_0x843f('0x52')][_0x843f('0x21')]);}_0x222daf[_0x843f('0x58')]=qs[_0x843f('0x59')](_0x472e25[_0x843f('0x52')][_0x843f('0x59')]);_0x222daf[_0x843f('0x5a')]=qs[_0x843f('0x50')](_[_0x843f('0x5b')](_0x472e25[_0x843f('0x52')],_0x390c62[_0x843f('0x50')]));_0x222daf[_0x843f('0x5a')][_0x843f('0x6a')]=_0x580826['id'];if(_0x472e25['query'][_0x843f('0x5c')]){_0x222daf['where']=_[_0x843f('0x5d')](_0x222daf[_0x843f('0x5a')],{'$or':_[_0x843f('0x4e')](_0x222daf[_0x843f('0x53')],function(_0x1d7338){var _0x1751e8={};_0x1751e8[_0x1d7338]={'$like':'%'+_0x472e25[_0x843f('0x52')]['filter']+'%'};return _0x1751e8;})});}_0x222daf=_['merge']({},_0x222daf,_0x472e25[_0x843f('0x5e')]);return db[_0x843f('0x6b')][_0x843f('0x20')]({'where':_0x222daf['where']})[_0x843f('0x11')](function(_0x1ebc0c){_0x269daa[_0x843f('0x20')]=_0x1ebc0c;if(_0x472e25[_0x843f('0x52')][_0x843f('0x5f')]){_0x222daf[_0x843f('0x63')]=[{'all':!![]}];}return db[_0x843f('0x6b')][_0x843f('0x60')](_0x222daf);})['then'](function(_0x26aa96){_0x269daa[_0x843f('0x61')]=_0x26aa96;return _0x269daa;});}})[_0x843f('0x11')](respondWithFilteredResult(_0x2cb077,_0x222daf))[_0x843f('0x1a')](handleError(_0x2cb077,null));};exports[_0x843f('0x6e')]=function(_0x2c9731,_0xb4b5b5){return db[_0x843f('0x48')][_0x843f('0x66')]({'where':{'id':_0x2c9731[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0xb4b5b5,null))[_0x843f('0x11')](function(_0x4d2ca7){if(_0x4d2ca7){return _0x4d2ca7['removeDispositions'](_0x2c9731[_0x843f('0x52')][_0x843f('0x6f')]);}})[_0x843f('0x11')](respondWithStatusCode(_0xb4b5b5,null))[_0x843f('0x1a')](handleError(_0xb4b5b5,null));};exports[_0x843f('0x70')]=function(_0x243d79,_0x23d588){if(_0x243d79[_0x843f('0x64')]['id']){delete _0x243d79[_0x843f('0x64')]['id'];}return db[_0x843f('0x48')]['find']({'where':{'id':_0x243d79[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x23d588,null))[_0x843f('0x11')](function(_0x11b7d6){if(_0x11b7d6){_0x243d79[_0x843f('0x64')]['MailAccountId']=_0x11b7d6['id'];return db['CannedAnswer']['create'](_0x243d79[_0x843f('0x64')]);}})[_0x843f('0x11')](respondWithResult(_0x23d588,null))[_0x843f('0x1a')](handleError(_0x23d588,null));};exports[_0x843f('0x71')]=function(_0x5cbdb3,_0x540d60){var _0x40b44f={'raw':![],'where':{}};var _0x2aa6fc={};var _0x253f63={'count':0x0,'rows':[]};return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x5cbdb3['params']['id']}})['then'](handleEntityNotFound(_0x540d60,null))['then'](function(_0x399adc){if(_0x399adc){_0x2aa6fc['model']=_[_0x843f('0x4f')](db[_0x843f('0x72')][_0x843f('0x49')]);_0x2aa6fc['query']=_[_0x843f('0x4f')](_0x5cbdb3[_0x843f('0x52')]);_0x2aa6fc[_0x843f('0x50')]=_['intersection'](_0x2aa6fc[_0x843f('0x4d')],_0x2aa6fc[_0x843f('0x52')]);_0x40b44f[_0x843f('0x53')]=_['intersection'](_0x2aa6fc['model'],qs[_0x843f('0x54')](_0x5cbdb3[_0x843f('0x52')][_0x843f('0x54')]));_0x40b44f[_0x843f('0x53')]=_0x40b44f[_0x843f('0x53')][_0x843f('0x55')]?_0x40b44f[_0x843f('0x53')]:_0x2aa6fc[_0x843f('0x4d')];if(!_0x5cbdb3[_0x843f('0x52')][_0x843f('0x56')](_0x843f('0x57'))){_0x40b44f[_0x843f('0x1f')]=qs[_0x843f('0x1f')](_0x5cbdb3[_0x843f('0x52')][_0x843f('0x1f')]);_0x40b44f[_0x843f('0x21')]=qs['offset'](_0x5cbdb3[_0x843f('0x52')][_0x843f('0x21')]);}_0x40b44f['order']=qs[_0x843f('0x59')](_0x5cbdb3[_0x843f('0x52')][_0x843f('0x59')]);_0x40b44f[_0x843f('0x5a')]=qs[_0x843f('0x50')](_[_0x843f('0x5b')](_0x5cbdb3[_0x843f('0x52')],_0x2aa6fc['filters']));_0x40b44f[_0x843f('0x5a')][_0x843f('0x6a')]=_0x399adc['id'];if(_0x5cbdb3[_0x843f('0x52')]['filter']){_0x40b44f[_0x843f('0x5a')]=_[_0x843f('0x5d')](_0x40b44f[_0x843f('0x5a')],{'$or':_[_0x843f('0x4e')](_0x40b44f[_0x843f('0x53')],function(_0x23d01e){var _0x3f74e4={};_0x3f74e4[_0x23d01e]={'$like':'%'+_0x5cbdb3[_0x843f('0x52')][_0x843f('0x5c')]+'%'};return _0x3f74e4;})});}_0x40b44f=_[_0x843f('0x5d')]({},_0x40b44f,_0x5cbdb3[_0x843f('0x5e')]);return db[_0x843f('0x72')][_0x843f('0x20')]({'where':_0x40b44f[_0x843f('0x5a')]})['then'](function(_0x102482){_0x253f63[_0x843f('0x20')]=_0x102482;if(_0x5cbdb3[_0x843f('0x52')]['includeAll']){_0x40b44f[_0x843f('0x63')]=[{'all':!![]}];}return db[_0x843f('0x72')]['findAll'](_0x40b44f);})[_0x843f('0x11')](function(_0x3e92e8){_0x253f63[_0x843f('0x61')]=_0x3e92e8;return _0x253f63;});}})[_0x843f('0x11')](respondWithFilteredResult(_0x540d60,_0x40b44f))['catch'](handleError(_0x540d60,null));};exports[_0x843f('0x73')]=function(_0x69e257,_0x18b2df){return db[_0x843f('0x48')][_0x843f('0x66')]({'where':{'id':_0x69e257[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x18b2df,null))[_0x843f('0x11')](function(_0x24150d){if(_0x24150d){return _0x24150d[_0x843f('0x73')](_0x69e257['query'][_0x843f('0x6f')]);}})['then'](respondWithStatusCode(_0x18b2df,null))[_0x843f('0x1a')](handleError(_0x18b2df,null));};exports[_0x843f('0x74')]=function(_0x312096,_0x144187){var _0x4b0267={'name':_0x312096[_0x843f('0x64')][_0x843f('0x2a')],'key':_0x312096[_0x843f('0x64')]['key'],'provider':_0x312096[_0x843f('0x64')][_0x843f('0x65')]===_0x843f('0x75')?null:_0x312096[_0x843f('0x64')][_0x843f('0x65')],'email':_0x312096['body'][_0x843f('0x76')],'ListId':_0x312096[_0x843f('0x64')][_0x843f('0x77')],'active':!_['isNil'](_0x312096[_0x843f('0x64')][_0x843f('0x78')])?_0x312096['body'][_0x843f('0x78')]:!![],'description':_0x312096['body'][_0x843f('0x79')]||null};var _0x160b2f=getAuthenticationOptions(_0x4b0267[_0x843f('0x65')],_0x312096[_0x843f('0x64')]);_0x4b0267[_0x843f('0x43')]=_0x160b2f[_0x843f('0x43')];_0x4b0267['Smtp']=_0x160b2f[_0x843f('0x44')];return db[_0x843f('0x48')][_0x843f('0x74')](_0x4b0267,{'include':[{'model':db[_0x843f('0x45')],'as':_0x843f('0x44')},{'model':db[_0x843f('0x68')],'as':'Imap'}]})['then'](function(_0x274276){var _0x48cd37=_0x312096[_0x843f('0x38')][_0x843f('0x7a')]({'plain':!![]});if(!_0x48cd37)throw new Error(_0x843f('0x7b'));if(_0x48cd37[_0x843f('0x7c')]===_0x843f('0x38')){var _0x290468=_0x274276[_0x843f('0x7a')]({'plain':!![]});return db[_0x843f('0x7d')][_0x843f('0x66')]({'where':{'name':_0x843f('0x27'),'userProfileId':_0x48cd37['userProfileId']},'raw':!![]})[_0x843f('0x11')](function(_0x2da973){if(_0x2da973&&_0x2da973[_0x843f('0x7e')]===0x0){return db[_0x843f('0x28')][_0x843f('0x74')]({'name':_0x290468[_0x843f('0x2a')],'resourceId':_0x290468['id'],'type':_0x2da973['name'],'sectionId':_0x2da973['id']},{})['then'](function(){return _0x274276;});}else{return _0x274276;}})[_0x843f('0x1a')](function(_0x23e886){logger[_0x843f('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23e886);throw _0x23e886;});}return _0x274276;})[_0x843f('0x11')](respondWithResult(_0x144187,0xc9))[_0x843f('0x1a')](handleError(_0x144187,null));};exports[_0x843f('0x7f')]=function(_0x41a5e9,_0xe13060){return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x41a5e9[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0xe13060,null))['then'](function(_0x3286c4){if(_0x3286c4){return _0x3286c4['getImap']();}return null;})['then'](respondWithResult(_0xe13060,null))[_0x843f('0x1a')](handleError(_0xe13060,null));};exports[_0x843f('0x80')]=function(_0x221bd3,_0x22fb50){if(_0x221bd3[_0x843f('0x64')]['id']){delete _0x221bd3[_0x843f('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x221bd3[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x22fb50,null))[_0x843f('0x11')](function(_0x58bf86){if(_0x58bf86){_0x221bd3[_0x843f('0x64')][_0x843f('0x6a')]=_0x58bf86['id'];return db[_0x843f('0x68')][_0x843f('0x74')](_0x221bd3[_0x843f('0x64')]);}})[_0x843f('0x11')](respondWithResult(_0x22fb50,null))[_0x843f('0x1a')](handleError(_0x22fb50,null));};exports['removeImap']=function(_0x2fc56c,_0x5772f8){return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x2fc56c[_0x843f('0x67')]['id']}})['then'](handleEntityNotFound(_0x5772f8,null))[_0x843f('0x11')](function(_0x4fcfc2){if(_0x4fcfc2){return _0x4fcfc2['setImap'](null);}return null;})[_0x843f('0x11')](respondWithStatusCode(_0x5772f8,null))[_0x843f('0x1a')](handleError(_0x5772f8,null));};exports[_0x843f('0x81')]=function(_0x1e51d9,_0x4e5def){return db['MailAccount'][_0x843f('0x6d')]({'where':{'id':_0x1e51d9['params']['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x4e5def,null))['then'](function(_0x43498a){if(_0x43498a){return _0x43498a['getSmtp']();}return null;})['then'](respondWithResult(_0x4e5def,null))[_0x843f('0x1a')](handleError(_0x4e5def,null));};exports['addSmtp']=function(_0x2f9a92,_0x3211c8){if(_0x2f9a92['body']['id']){delete _0x2f9a92['body']['id'];}return db[_0x843f('0x48')][_0x843f('0x66')]({'where':{'id':_0x2f9a92[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x3211c8,null))[_0x843f('0x11')](function(_0x10ad5c){if(_0x10ad5c){_0x2f9a92[_0x843f('0x64')][_0x843f('0x6a')]=_0x10ad5c['id'];return db[_0x843f('0x45')][_0x843f('0x74')](_0x2f9a92[_0x843f('0x64')]);}})[_0x843f('0x11')](respondWithResult(_0x3211c8,null))[_0x843f('0x1a')](handleError(_0x3211c8,null));};exports['removeSmtp']=function(_0x8cd444,_0x66c44d){return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x8cd444[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x66c44d,null))['then'](function(_0x4154a2){if(_0x4154a2){return _0x4154a2[_0x843f('0x82')](null);}return null;})[_0x843f('0x11')](respondWithStatusCode(_0x66c44d,null))[_0x843f('0x1a')](handleError(_0x66c44d,null));};exports[_0x843f('0x83')]=function(_0x46ffc2,_0x170792){return db[_0x843f('0x84')][_0x843f('0x66')]({'where':{'id':_0x46ffc2[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x170792,null))[_0x843f('0x11')](function(_0x124e23){if(_0x124e23){return _0x124e23[_0x843f('0x83')](_0x46ffc2['body'][_0x843f('0x6f')],_[_0x843f('0x85')](_0x46ffc2[_0x843f('0x64')],[_0x843f('0x6f'),'id'])||{});}})[_0x843f('0x11')](respondWithResult(_0x170792,null))['catch'](handleError(_0x170792,null));};exports['getInteractions']=function(_0x111696,_0x4ced0f){var _0x3f75b2={'raw':![],'where':{}};var _0x4e3db1={};var _0x39d10c={'count':0x0,'rows':[]};return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x111696['params']['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x4ced0f,null))[_0x843f('0x11')](function(_0x2c7112){if(_0x2c7112){_0x4e3db1[_0x843f('0x4d')]=_['keys'](db[_0x843f('0x84')][_0x843f('0x49')]);_0x4e3db1[_0x843f('0x52')]=_[_0x843f('0x4f')](_0x111696[_0x843f('0x52')]);_0x4e3db1[_0x843f('0x50')]=_[_0x843f('0x51')](_0x4e3db1[_0x843f('0x4d')],_0x4e3db1[_0x843f('0x52')]);_0x3f75b2[_0x843f('0x53')]=_['intersection'](_0x4e3db1[_0x843f('0x4d')],qs[_0x843f('0x54')](_0x111696[_0x843f('0x52')][_0x843f('0x54')]));_0x3f75b2['attributes']=_0x3f75b2['attributes'][_0x843f('0x55')]?_0x3f75b2[_0x843f('0x53')]:_0x4e3db1[_0x843f('0x4d')];if(!_0x111696[_0x843f('0x52')][_0x843f('0x56')](_0x843f('0x57'))){_0x3f75b2[_0x843f('0x1f')]=qs[_0x843f('0x1f')](_0x111696[_0x843f('0x52')][_0x843f('0x1f')]);_0x3f75b2[_0x843f('0x21')]=qs[_0x843f('0x21')](_0x111696[_0x843f('0x52')][_0x843f('0x21')]);}_0x3f75b2[_0x843f('0x58')]=qs[_0x843f('0x59')](_0x111696['query'][_0x843f('0x59')]);_0x3f75b2[_0x843f('0x5a')]=qs[_0x843f('0x50')](_[_0x843f('0x5b')](_0x111696['query'],_0x4e3db1[_0x843f('0x50')]));_0x3f75b2['where'][_0x843f('0x6a')]=_0x2c7112['id'];if(_0x111696[_0x843f('0x52')][_0x843f('0x5c')]){_0x3f75b2[_0x843f('0x5a')]=_['merge'](_0x3f75b2[_0x843f('0x5a')],{'$or':_['map'](_0x3f75b2[_0x843f('0x53')],function(_0x4c8770){var _0x48019d={};_0x48019d[_0x4c8770]={'$like':'%'+_0x111696[_0x843f('0x52')]['filter']+'%'};return _0x48019d;})});}_0x3f75b2=_['merge']({},_0x3f75b2,_0x111696[_0x843f('0x5e')]);return db['MailInteraction'][_0x843f('0x20')]({'where':_0x3f75b2[_0x843f('0x5a')]})[_0x843f('0x11')](function(_0x20b5d4){_0x39d10c[_0x843f('0x20')]=_0x20b5d4;if(_0x111696[_0x843f('0x52')][_0x843f('0x5f')]){_0x3f75b2[_0x843f('0x63')]=[{'model':db[_0x843f('0x86')],'as':_0x843f('0x87'),'required':![]},{'model':db[_0x843f('0x88')],'as':_0x843f('0x89'),'attributes':[_0x843f('0x2a'),_0x843f('0x8a'),'internal'],'required':![]},{'model':db[_0x843f('0x8b')],'as':_0x843f('0x8c'),'attributes':['id',_0x843f('0x2a'),_0x843f('0x8d')],'where':_0x111696[_0x843f('0x52')][_0x843f('0x8e')]?{'id':_0x111696[_0x843f('0x52')][_0x843f('0x8e')]}:undefined,'required':_0x111696[_0x843f('0x52')][_0x843f('0x8e')]?!![]:![]}];}return db[_0x843f('0x84')][_0x843f('0x60')](_0x3f75b2);})[_0x843f('0x11')](function(_0x42acf9){_0x39d10c[_0x843f('0x61')]=_0x42acf9;return _0x39d10c;});}})[_0x843f('0x11')](respondWithFilteredResult(_0x4ced0f,_0x3f75b2))[_0x843f('0x1a')](handleError(_0x4ced0f,null));};exports[_0x843f('0x8f')]=function addApplications(_0x4ae6f7,_0x91b6a9){var _0x44e316=_0x4ae6f7[_0x843f('0x67')]['id'];var _0x1bfece=_0x4ae6f7[_0x843f('0x64')];var _0x1be793=0xc8;var _0x3e4815=null;return db[_0x843f('0x90')]['transaction']({'isolationLevel':db[_0x843f('0x90')][_0x843f('0x91')][_0x843f('0x92')][_0x843f('0x93')]},function(_0x3b2967){return db[_0x843f('0x48')]['findOne']({'where':{'id':_0x44e316},'transaction':_0x3b2967})['then'](function(_0x46995b){if(_0x46995b){return db[_0x843f('0x94')]['destroy']({'where':{'MailAccountId':_0x44e316},'transaction':_0x3b2967})[_0x843f('0x11')](function(){var _0x59e508=_[_0x843f('0x4e')](_0x1bfece,function(_0x47d83b){_0x47d83b[_0x843f('0x6a')]=_0x44e316;return _0x47d83b;});return db['MailApplication'][_0x843f('0x95')](_0x59e508,{'transaction':_0x3b2967});});}else{_0x1be793=0x194;_0x3e4815=[];}});})[_0x843f('0x11')](function(){if(_0x1be793!==0x194){return db[_0x843f('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x44e316},'order':_0x843f('0x96')})[_0x843f('0x11')](function(_0x177df1){_0x3e4815=_0x177df1;});}})[_0x843f('0x1a')](function(_0x57579e){_0x1be793=0x1f4;logger[_0x843f('0x17')](_0x57579e['stack']);if(_0x57579e[_0x843f('0x2a')]){delete _0x57579e['name'];}_0x3e4815=_0x57579e;})[_0x843f('0x97')](function(){if(_0x3e4815===null){_0x91b6a9[_0x843f('0x1b')](_0x1be793);}else{if(_0x1be793===0x1f4){_0x91b6a9['status'](_0x1be793)[_0x843f('0x98')](_0x3e4815);}else{_0x91b6a9[_0x843f('0x1d')](_0x1be793)['json'](_0x3e4815);}}});};exports['getApplications']=function(_0x547ec4,_0xae7dc3){var _0x306dda={};var _0x277898={};var _0x4a2687;var _0x4d8c65;return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x547ec4['params']['id']}})['then'](handleEntityNotFound(_0xae7dc3,null))[_0x843f('0x11')](function(_0xa64a4d){if(_0xa64a4d){_0x4a2687=_0xa64a4d;_0x277898['model']=_[_0x843f('0x4f')](db['MailApplication']['rawAttributes']);_0x277898[_0x843f('0x52')]=_[_0x843f('0x4f')](_0x547ec4['query']);_0x277898[_0x843f('0x50')]=_[_0x843f('0x51')](_0x277898[_0x843f('0x4d')],_0x277898['query']);_0x306dda['attributes']=_[_0x843f('0x51')](_0x277898['model'],qs[_0x843f('0x54')](_0x547ec4[_0x843f('0x52')]['fields']));_0x306dda[_0x843f('0x53')]=_0x306dda[_0x843f('0x53')][_0x843f('0x55')]?_0x306dda[_0x843f('0x53')]:_0x277898[_0x843f('0x4d')];_0x306dda['order']=qs['sort'](_0x547ec4[_0x843f('0x52')][_0x843f('0x59')]);_0x306dda[_0x843f('0x5a')]=qs[_0x843f('0x50')](_['pick'](_0x547ec4[_0x843f('0x52')],_0x277898[_0x843f('0x50')]));if(_0x547ec4[_0x843f('0x52')][_0x843f('0x5c')]){_0x306dda['where']=_[_0x843f('0x5d')](_0x306dda[_0x843f('0x5a')],{'$or':_[_0x843f('0x4e')](_0x306dda[_0x843f('0x53')],function(_0xe252f4){var _0x3e19c8={};_0x3e19c8[_0xe252f4]={'$like':'%'+_0x547ec4['query'][_0x843f('0x5c')]+'%'};return _0x3e19c8;})});}_0x306dda=_[_0x843f('0x5d')]({},_0x306dda,_0x547ec4['options']);return _0x4a2687[_0x843f('0x99')](_0x306dda);}})['then'](function(_0x44100a){if(_0x44100a){_0x4d8c65=_0x44100a[_0x843f('0x55')];if(!_0x547ec4[_0x843f('0x52')][_0x843f('0x56')](_0x843f('0x57'))){_0x306dda[_0x843f('0x1f')]=qs[_0x843f('0x1f')](_0x547ec4[_0x843f('0x52')][_0x843f('0x1f')]);_0x306dda[_0x843f('0x21')]=qs[_0x843f('0x21')](_0x547ec4['query'][_0x843f('0x21')]);}return _0x4a2687[_0x843f('0x99')](_0x306dda);}})['then'](function(_0x549218){if(_0x549218){return _0x549218?{'count':_0x4d8c65,'rows':_0x549218}:null;}})['then'](respondWithResult(_0xae7dc3,null))[_0x843f('0x1a')](handleError(_0xae7dc3,null));};exports[_0x843f('0x9a')]=function(_0x50ed20,_0x2ca65b){var _0x42d71e={'raw':!![],'where':{}};var _0x2fd16d={};var _0xc6d615={'count':0x0,'rows':[]};return db[_0x843f('0x48')][_0x843f('0x6d')]({'where':{'id':_0x50ed20[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x2ca65b,null))['then'](function(_0x2b5817){if(_0x2b5817){_0x2fd16d[_0x843f('0x4d')]=_[_0x843f('0x4f')](db[_0x843f('0x9b')][_0x843f('0x49')]);_0x2fd16d[_0x843f('0x52')]=_[_0x843f('0x4f')](_0x50ed20[_0x843f('0x52')]);_0x2fd16d[_0x843f('0x50')]=_[_0x843f('0x51')](_0x2fd16d[_0x843f('0x4d')],_0x2fd16d['query']);_0x42d71e[_0x843f('0x53')]=_[_0x843f('0x51')](_0x2fd16d[_0x843f('0x4d')],qs[_0x843f('0x54')](_0x50ed20[_0x843f('0x52')][_0x843f('0x54')]));_0x42d71e[_0x843f('0x53')]=_0x42d71e[_0x843f('0x53')][_0x843f('0x55')]?_0x42d71e['attributes']:_0x2fd16d[_0x843f('0x4d')];if(!_0x50ed20['query'][_0x843f('0x56')]('nolimit')){_0x42d71e[_0x843f('0x1f')]=qs['limit'](_0x50ed20['query'][_0x843f('0x1f')]);_0x42d71e[_0x843f('0x21')]=qs['offset'](_0x50ed20[_0x843f('0x52')][_0x843f('0x21')]);}_0x42d71e[_0x843f('0x58')]=qs[_0x843f('0x59')](_0x50ed20['query'][_0x843f('0x59')]);_0x42d71e[_0x843f('0x5a')]=qs[_0x843f('0x50')](_['pick'](_0x50ed20[_0x843f('0x52')],_0x2fd16d[_0x843f('0x50')]));_0x42d71e['where']['MailAccountId']=_0x2b5817['id'];if(_0x50ed20[_0x843f('0x52')][_0x843f('0x5c')]){_0x42d71e['where']=_['merge'](_0x42d71e['where'],{'$or':_['map'](_0x42d71e[_0x843f('0x53')],function(_0x25c2cd){var _0x7a1efa={};_0x7a1efa[_0x25c2cd]={'$like':'%'+_0x50ed20[_0x843f('0x52')][_0x843f('0x5c')]+'%'};return _0x7a1efa;})});}if(_0x50ed20[_0x843f('0x52')]['$gte']){var _0x308197=_0x50ed20[_0x843f('0x52')][_0x843f('0x9c')][_0x843f('0x9d')](',');var _0x1a82fa={};_0x1a82fa[_0x308197[0x0]]={'$gte':moment(_0x308197[0x1])[_0x843f('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x42d71e['where']=_[_0x843f('0x5d')](_0x42d71e[_0x843f('0x5a')],_0x1a82fa);}_0x42d71e=_['merge']({},_0x42d71e,_0x50ed20[_0x843f('0x5e')]);return db[_0x843f('0x9b')][_0x843f('0x20')]({'where':_0x42d71e['where']})[_0x843f('0x11')](function(_0x9dcc98){_0xc6d615[_0x843f('0x20')]=_0x9dcc98;if(_0x50ed20[_0x843f('0x52')][_0x843f('0x5f')]){_0x42d71e[_0x843f('0x63')]=[{'all':!![]}];}return db[_0x843f('0x9b')][_0x843f('0x60')](_0x42d71e);})[_0x843f('0x11')](function(_0x168da1){if(_0x50ed20['query'][_0x843f('0x9f')]===_0x843f('0xa0')){for(var _0x2e1f1a=0x0;_0x2e1f1a<_0x168da1[_0x843f('0x55')];_0x2e1f1a++){_0x168da1[_0x2e1f1a][_0x843f('0x64')]=juice(_0x168da1[_0x2e1f1a]['body']);}}_0xc6d615['rows']=_0x168da1;return _0xc6d615;});}})[_0x843f('0x11')](respondWithFilteredResult(_0x2ca65b,_0x42d71e))[_0x843f('0x1a')](handleError(_0x2ca65b,null));};exports[_0x843f('0x98')]=function(_0x598964,_0xc764e1){var _0x15ca0e,_0x263217={},_0x478f68;if(_0x598964['body']['to']){_0x478f68=_0x598964[_0x843f('0x64')]['to'][_0x843f('0x9d')](',')[0x0];}return db['MailAccount'][_0x843f('0x66')]({'where':{'id':_0x598964[_0x843f('0x67')]['id']},'include':[{'model':db[_0x843f('0xa1')],'as':_0x843f('0xa2'),'include':[{'model':db['CmContact'],'as':_0x843f('0xa3'),'where':{'email':_0x478f68},'limit':0x1,'order':[[_0x843f('0xa4'),'DESC']]}]},{'model':db[_0x843f('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x843f('0xa5')],'as':_0x843f('0xa5'),'raw':!![]}]}]})[_0x843f('0x11')](handleEntityNotFound(_0xc764e1,null))[_0x843f('0x11')](function(_0x56677d){if(!_0x56677d)return;_0x15ca0e=_0x56677d;if(!_0x56677d[_0x843f('0x44')])throw new Error(_0x843f('0xa6'));if(_['isNil'](_0x598964[_0x843f('0x64')][_0x843f('0xa7')])){_0x598964['body'][_0x843f('0xa7')]=util[_0x843f('0x9e')]('%s\x20<%s>',_0x56677d['name'],_0x56677d[_0x843f('0x76')]||_0x56677d['Smtp'][_0x843f('0x38')]);}if(_0x598964['body'][_0x843f('0xa8')]&&_0x598964['body'][_0x843f('0xa8')][_0x843f('0x55')]){for(var _0x5231c2=0x0;_0x5231c2<_0x598964[_0x843f('0x64')]['attachments'][_0x843f('0x55')];_0x5231c2+=0x1){_0x598964[_0x843f('0x64')][_0x843f('0xa8')][_0x5231c2]={'filename':_0x598964[_0x843f('0x64')][_0x843f('0xa8')][_0x5231c2][_0x843f('0x2a')],'path':path[_0x843f('0xa9')](config[_0x843f('0xaa')],'server/files/attachments',_0x598964[_0x843f('0x64')]['attachments'][_0x5231c2]['basename'])};}}var _0xe6f291=_0x56677d[_0x843f('0xab')]();return respondWithRpcPromise(_0x843f('0xac'),_0x843f('0xad'),{'account':_0xe6f291,'message':_0x598964[_0x843f('0x64')]});})[_0x843f('0x11')](function(_0x3d5470){if(!_0x3d5470)return;_0x263217=_0x3d5470;if(!_0x15ca0e[_0x843f('0xa2')])throw new Error('List\x20not\x20found');if(_0x15ca0e[_0x843f('0xa2')]['Contacts'][_0x843f('0x55')])return _0x15ca0e[_0x843f('0xa2')][_0x843f('0xa3')][0x0];return db[_0x843f('0x86')][_0x843f('0x74')](_[_0x843f('0xae')](_0x598964[_0x843f('0x64')],{'firstName':_0x598964[_0x843f('0x64')]['to'],'email':_0x598964['body']['to'],'phone':_0x598964[_0x843f('0x64')]['to'],'ListId':_0x15ca0e[_0x843f('0x77')]}));})[_0x843f('0x11')](function(_0x900f8f){if(!_0x900f8f)return;var _0x32747f={'UserId':_0x598964[_0x843f('0x38')]['id'],'ContactId':_0x900f8f['id'],'MailAccountId':_0x15ca0e['id'],'inReplyTo':_0x263217['messageId'],'to':_0x598964[_0x843f('0x64')][_0x843f('0xa7')],'cc':_0x598964[_0x843f('0x64')]['cc'],'subject':_0x598964[_0x843f('0x64')]['subject'],'attach':_0x598964[_0x843f('0x64')]['attach'],'firstMsgDirection':_0x843f('0xaf'),'lastMsgAt':moment()[_0x843f('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x843f('0xaf'),'Messages':[_[_0x843f('0x5d')](_0x598964[_0x843f('0x64')],{'messageId':_0x263217[_0x843f('0xb0')],'sentAt':moment()[_0x843f('0x9e')](_0x843f('0xb1')),'read':!![],'MailAccountId':_0x15ca0e['id'],'UserId':_0x598964['user']['id'],'ContactId':_0x900f8f['id']})]};if(_0x598964[_0x843f('0x64')][_0x843f('0xb2')]){_0x32747f=_[_0x843f('0x5d')](_0x32747f,_0x598964['body'][_0x843f('0xb2')]);}return db[_0x843f('0x84')]['create'](_0x32747f,{'include':[{'model':db[_0x843f('0x9b')],'as':_0x843f('0xb3')}]});})[_0x843f('0x11')](respondWithResult(_0xc764e1,null))[_0x843f('0x1a')](handleError(_0xc764e1,null));};exports[_0x843f('0xb4')]=function(_0x2fa8e0,_0x1aa6ce){return db['MailAccount'][_0x843f('0x66')]({'where':{'id':_0x2fa8e0['params']['id']},'include':[{'model':db[_0x843f('0x45')],'as':_0x843f('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x843f('0xa5'),'raw':!![]}]}]})[_0x843f('0x11')](handleEntityNotFound(_0x1aa6ce,null))[_0x843f('0x11')](function(_0x420a54){if(!_0x420a54['Smtp'])return;var _0xab2fec=_0x420a54[_0x843f('0xab')]();return respondWithRpcPromise(_0x843f('0xb5'),'verifySmtp',{'account':_0xab2fec});})[_0x843f('0x11')](respondWithResult(_0x1aa6ce,null))[_0x843f('0x1a')](handleError(_0x1aa6ce,null));};exports[_0x843f('0x26')]=function(_0x502c22,_0x2e3957){return db[_0x843f('0x48')][_0x843f('0x66')]({'where':{'id':_0x502c22[_0x843f('0x67')]['id']}})['then'](handleEntityNotFound(_0x2e3957,null))[_0x843f('0x11')](function(_0x755fbf){if(_0x755fbf&&_0x755fbf[_0x843f('0x41')]){throw new db['Sequelize'][(_0x843f('0xb6'))](_0x843f('0xb7'));}return _0x755fbf;})['then'](removeEntity(_0x2e3957,null))['catch'](handleError(_0x2e3957,null));};exports[_0x843f('0xb8')]=function(_0x5c904c,_0x47cc49){return db[_0x843f('0x48')]['find']({'where':{'id':_0x5c904c[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x47cc49,null))[_0x843f('0x11')](function(_0x45bc5c){if(_0x45bc5c){return _0x45bc5c[_0x843f('0xb8')](_0x5c904c['body'][_0x843f('0x6f')],_[_0x843f('0x85')](_0x5c904c[_0x843f('0x64')],[_0x843f('0x6f'),'id'])||{})[_0x843f('0xb9')](function(_0x3db72f){for(var _0x1c2917=0x0;_0x1c2917<_0x5c904c[_0x843f('0x64')][_0x843f('0x6f')][_0x843f('0x55')];_0x1c2917+=0x1){socket[_0x843f('0xba')](_0x843f('0xbb'),{'UserId':Number(_0x5c904c[_0x843f('0x64')][_0x843f('0x6f')][_0x1c2917]),'MailAccountId':Number(_0x5c904c[_0x843f('0x67')]['id'])});}return _0x3db72f;});}})[_0x843f('0x11')](respondWithResult(_0x47cc49,null))[_0x843f('0x1a')](handleError(_0x47cc49,null));};exports[_0x843f('0xbc')]=function(_0x4c2a87,_0x3087b7){return db[_0x843f('0x48')][_0x843f('0x66')]({'where':{'id':_0x4c2a87[_0x843f('0x67')]['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x3087b7,null))['then'](function(_0x42803e){if(_0x42803e){return _0x42803e[_0x843f('0xbc')](_0x4c2a87[_0x843f('0x52')][_0x843f('0x6f')])['then'](function(){if(_[_0x843f('0xbd')](_0x4c2a87['query'][_0x843f('0x6f')])){for(var _0x120714=0x0;_0x120714<_0x4c2a87[_0x843f('0x52')][_0x843f('0x6f')][_0x843f('0x55')];_0x120714+=0x1){socket[_0x843f('0xba')](_0x843f('0xbe'),{'UserId':Number(_0x4c2a87[_0x843f('0x52')]['ids'][_0x120714]),'MailAccountId':Number(_0x4c2a87[_0x843f('0x67')]['id'])});}}else{socket['emit'](_0x843f('0xbe'),{'UserId':Number(_0x4c2a87[_0x843f('0x52')][_0x843f('0x6f')]),'MailAccountId':Number(_0x4c2a87[_0x843f('0x67')]['id'])});}});}})[_0x843f('0x11')](respondWithStatusCode(_0x3087b7,null))[_0x843f('0x1a')](handleError(_0x3087b7,null));};exports['getAgents']=function(_0x4e5b1f,_0x44dcff){var _0x317bcb={};var _0x206256={};var _0x477538;var _0x1fbc4f;return db[_0x843f('0x48')]['findOne']({'where':{'id':_0x4e5b1f['params']['id']}})[_0x843f('0x11')](handleEntityNotFound(_0x44dcff,null))[_0x843f('0x11')](function(_0x311204){if(_0x311204){_0x477538=_0x311204;_0x206256[_0x843f('0x4d')]=_['keys'](db[_0x843f('0x88')]['rawAttributes']);_0x206256['query']=_[_0x843f('0x4f')](_0x4e5b1f[_0x843f('0x52')]);_0x206256['filters']=_[_0x843f('0x51')](_0x206256[_0x843f('0x4d')],_0x206256[_0x843f('0x52')]);_0x317bcb[_0x843f('0x53')]=_['intersection'](_0x206256['model'],qs[_0x843f('0x54')](_0x4e5b1f[_0x843f('0x52')][_0x843f('0x54')]));_0x317bcb[_0x843f('0x53')]=_0x317bcb[_0x843f('0x53')][_0x843f('0x55')]?_0x317bcb['attributes']:_0x206256[_0x843f('0x4d')];_0x317bcb[_0x843f('0x58')]=qs[_0x843f('0x59')](_0x4e5b1f[_0x843f('0x52')]['sort']);_0x317bcb[_0x843f('0x5a')]=qs[_0x843f('0x50')](_[_0x843f('0x5b')](_0x4e5b1f[_0x843f('0x52')],_0x206256['filters']));if(_0x4e5b1f[_0x843f('0x52')][_0x843f('0x5c')]){_0x317bcb[_0x843f('0x5a')]=_[_0x843f('0x5d')](_0x317bcb[_0x843f('0x5a')],{'$or':_['map'](_0x317bcb[_0x843f('0x53')],function(_0x345954){var _0x414582={};_0x414582[_0x345954]={'$like':'%'+_0x4e5b1f['query'][_0x843f('0x5c')]+'%'};return _0x414582;})});}_0x317bcb=_[_0x843f('0x5d')]({},_0x317bcb,_0x4e5b1f[_0x843f('0x5e')]);return _0x477538[_0x843f('0xbf')](_0x317bcb);}})[_0x843f('0x11')](function(_0x279e22){if(_0x279e22){_0x1fbc4f=_0x279e22['length'];if(!_0x4e5b1f[_0x843f('0x52')][_0x843f('0x56')](_0x843f('0x57'))){_0x317bcb['limit']=qs[_0x843f('0x1f')](_0x4e5b1f['query'][_0x843f('0x1f')]);_0x317bcb[_0x843f('0x21')]=qs[_0x843f('0x21')](_0x4e5b1f[_0x843f('0x52')]['offset']);}return _0x477538['getAgents'](_0x317bcb);}})[_0x843f('0x11')](function(_0x4dbc87){if(_0x4dbc87){return _0x4dbc87?{'count':_0x1fbc4f,'rows':_0x4dbc87}:null;}})[_0x843f('0x11')](respondWithResult(_0x44dcff,null))['catch'](handleError(_0x44dcff,null));}; \ No newline at end of file +var _0xcbb6=['Mail\x20Account\x20not\x20found','catch','describe','addDisposition','create','getDispositions','findOne','Disposition','MailAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','stack','sendStatus','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','moment','util','path','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','limit','count','set','destroy','get','MailAccounts','UserProfileResource','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','Pause','mandatoryDispositionPause','keys','find','update','body','provider','custom'];(function(_0x5379c9,_0x2381de){var _0x1103ca=function(_0x5030cd){while(--_0x5030cd){_0x5379c9['push'](_0x5379c9['shift']());}};_0x1103ca(++_0x2381de);}(_0xcbb6,0x1de));var _0x6cbb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcbb6[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x6cbb('0x0'));var BPromise=require('bluebird');var util=require(_0x6cbb('0x1'));var path=require(_0x6cbb('0x2'));var _=require(_0x6cbb('0x3'));var juice=require('juice');var Redis=require(_0x6cbb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x6cbb('0x5'))('api');var config=require(_0x6cbb('0x6'));var db=require('../../mysqldb')['db'];config[_0x6cbb('0x7')]=_[_0x6cbb('0x8')](config['redis'],{'host':_0x6cbb('0x9'),'port':0x18eb});var socket=require(_0x6cbb('0xa'))(new Redis(config[_0x6cbb('0x7')]));require(_0x6cbb('0xb'))[_0x6cbb('0xc')](socket);var jayson=require(_0x6cbb('0xd'));var client=jayson[_0x6cbb('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0x166016,_0x3bd951,_0x4f54b1,_0xcdc3c7){return new BPromise(function(_0x462b7c,_0x3fbd46){var _0x2912cc=_0xcdc3c7||client;return _0x2912cc[_0x6cbb('0xf')](_0x166016,_0x4f54b1)[_0x6cbb('0x10')](function(_0xcad608){logger[_0x6cbb('0x11')]('MailAccount,\x20%s,\x20%s',_0x3bd951,'request\x20sent');logger[_0x6cbb('0x12')](_0x6cbb('0x13'),_0x3bd951,_0x6cbb('0x14'),JSON[_0x6cbb('0x15')](_0xcad608));if(_0xcad608[_0x6cbb('0x16')]){if(_0xcad608['error'][_0x6cbb('0x17')]===0x1f4){logger['error'](_0x6cbb('0x18'),_0x3bd951,_0xcad608[_0x6cbb('0x16')][_0x6cbb('0x19')]);return _0x3fbd46(_0xcad608['error'][_0x6cbb('0x19')]);}logger[_0x6cbb('0x16')](_0x6cbb('0x18'),_0x3bd951,_0xcad608['error'][_0x6cbb('0x19')]);return _0x462b7c(_0xcad608[_0x6cbb('0x16')][_0x6cbb('0x19')]);}else{logger[_0x6cbb('0x11')](_0x6cbb('0x18'),_0x3bd951,'request\x20sent');_0x462b7c(_0xcad608[_0x6cbb('0x1a')][_0x6cbb('0x19')]);}})['catch'](function(_0x3a1791){logger[_0x6cbb('0x16')](_0x6cbb('0x18'),_0x3bd951,_0x3a1791);_0x3fbd46(_0x3a1791);});});}function respondWithStatusCode(_0x2dc380,_0x2539bc){_0x2539bc=_0x2539bc||0xcc;return function(_0x532133){if(_0x532133){return _0x2dc380['sendStatus'](_0x2539bc);}return _0x2dc380[_0x6cbb('0x1b')](_0x2539bc)[_0x6cbb('0x1c')]();};}function respondWithResult(_0x22258d,_0xd2844f){_0xd2844f=_0xd2844f||0xc8;return function(_0x44031f){if(_0x44031f){return _0x22258d[_0x6cbb('0x1b')](_0xd2844f)[_0x6cbb('0x1d')](_0x44031f);}};}function respondWithFilteredResult(_0x41f07f,_0x4c73ce){return function(_0x27b8a8){if(_0x27b8a8){var _0x472e8c=typeof _0x4c73ce[_0x6cbb('0x1e')]===_0x6cbb('0x1f')&&typeof _0x4c73ce[_0x6cbb('0x20')]===_0x6cbb('0x1f');var _0x281461=_0x27b8a8[_0x6cbb('0x21')];var _0x55b622=_0x472e8c?0x0:_0x4c73ce['offset'];var _0x26733a=_0x472e8c?_0x27b8a8['count']:_0x4c73ce[_0x6cbb('0x1e')]+_0x4c73ce[_0x6cbb('0x20')];var _0x519e30;if(_0x26733a>=_0x281461){_0x26733a=_0x281461;_0x519e30=0xc8;}else{_0x519e30=0xce;}_0x41f07f['status'](_0x519e30);return _0x41f07f[_0x6cbb('0x22')]('Content-Range',_0x55b622+'-'+_0x26733a+'/'+_0x281461)['json'](_0x27b8a8);}return null;};}function saveUpdates(_0x20bdda){return function(_0x51271b){if(_0x51271b){return _0x51271b['update'](_0x20bdda)[_0x6cbb('0x10')](function(_0x55e67e){return _0x55e67e;});}return null;};}function removeEntity(_0x31a495){return function(_0x5b2466){if(_0x5b2466){return _0x5b2466[_0x6cbb('0x23')]()[_0x6cbb('0x10')](function(){var _0x576ca4=_0x5b2466[_0x6cbb('0x24')]({'plain':!![]});var _0x185ab5=_0x6cbb('0x25');return db[_0x6cbb('0x26')][_0x6cbb('0x23')]({'where':{'type':_0x185ab5,'resourceId':_0x576ca4['id']}})['then'](function(){return _0x5b2466;});})[_0x6cbb('0x10')](function(){_0x31a495['status'](0xcc)[_0x6cbb('0x1c')]();});}};}function handleEntityNotFound(_0xff5fc5){return function(_0x470973){if(!_0x470973){_0xff5fc5['sendStatus'](0x194);}return _0x470973;};}function handleError(_0x2b4389,_0x5d7417){_0x5d7417=_0x5d7417||0x1f4;return function(_0x7032d7){logger[_0x6cbb('0x16')](_0x7032d7['stack']);if(_0x7032d7[_0x6cbb('0x27')]){delete _0x7032d7[_0x6cbb('0x27')];}_0x2b4389[_0x6cbb('0x1b')](_0x5d7417)['send'](_0x7032d7);};}function getImapHost(_0x56d3e9){switch(_0x56d3e9){case _0x6cbb('0x28'):return _0x6cbb('0x29');case _0x6cbb('0x2a'):return _0x6cbb('0x2b');case'hotmail':return _0x6cbb('0x2c');case _0x6cbb('0x2d'):return _0x6cbb('0x2e');}throw new Error(_0x6cbb('0x2f'),_0x56d3e9);}function getSmtpHost(_0x1d7d2f){switch(_0x1d7d2f){case _0x6cbb('0x28'):return'smtp.gmail.com';case _0x6cbb('0x2a'):return _0x6cbb('0x30');case'hotmail':return'smtp-mail.outlook.com';case'outlook365':return _0x6cbb('0x31');}throw new Error(_0x6cbb('0x2f'),_0x1d7d2f);}function getAuthenticationOptions(_0x5fe647,_0x35e3aa){var _0x1317dd={};var _0x43fa62={};if(_0x5fe647){_0x1317dd[_0x6cbb('0x32')]=_0x43fa62['user']=_0x35e3aa[_0x6cbb('0x33')];_0x1317dd[_0x6cbb('0x34')]=_0x43fa62[_0x6cbb('0x35')]=_0x35e3aa[_0x6cbb('0x34')];if(_0x35e3aa[_0x6cbb('0x36')]){_0x1317dd[_0x6cbb('0x36')]=_0x43fa62[_0x6cbb('0x36')]=!![];_0x1317dd[_0x6cbb('0x37')]=_0x43fa62[_0x6cbb('0x37')]=_0x35e3aa['CloudProviderId'];_0x1317dd[_0x6cbb('0x34')]=_0x43fa62[_0x6cbb('0x35')]=null;}else{_0x1317dd[_0x6cbb('0x37')]=_0x43fa62[_0x6cbb('0x37')]=null;}_0x1317dd[_0x6cbb('0x38')]=getImapHost(_0x5fe647);_0x1317dd[_0x6cbb('0x39')]=0x3e1;_0x43fa62[_0x6cbb('0x38')]=getSmtpHost(_0x5fe647);_0x43fa62[_0x6cbb('0x39')]=0x24b;_0x43fa62[_0x6cbb('0x3a')]=![];_0x1317dd[_0x6cbb('0x3b')]=_0x43fa62[_0x6cbb('0x3b')]=null;}else{if(_0x35e3aa[_0x6cbb('0x3c')]){_0x1317dd[_0x6cbb('0x32')]=_0x43fa62['user']=_0x35e3aa[_0x6cbb('0x33')];_0x1317dd['password']=_0x43fa62['pass']=_0x35e3aa['password'];}else{_0x1317dd[_0x6cbb('0x3c')]=_0x43fa62[_0x6cbb('0x3c')]=![];_0x1317dd['user']=_0x43fa62[_0x6cbb('0x32')]=null;_0x1317dd[_0x6cbb('0x34')]=_0x43fa62[_0x6cbb('0x35')]=null;}_0x1317dd[_0x6cbb('0x38')]=_0x35e3aa[_0x6cbb('0x3d')]['host'];_0x1317dd['port']=_0x35e3aa[_0x6cbb('0x3d')][_0x6cbb('0x39')];_0x43fa62[_0x6cbb('0x38')]=_0x35e3aa[_0x6cbb('0x3e')]['host'];_0x43fa62['port']=_0x35e3aa[_0x6cbb('0x3e')][_0x6cbb('0x39')];}return{'Imap':_0x1317dd,'Smtp':_0x43fa62};}exports[_0x6cbb('0x3f')]=function(_0x4e1614,_0x614a4a){var _0x381237={'include':[{'model':db[_0x6cbb('0x40')],'as':_0x6cbb('0x3d')},{'model':db[_0x6cbb('0x41')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x558790={},_0x138fcc={'count':0x0,'rows':[]};var _0x116a90=_[_0x6cbb('0x42')](db[_0x6cbb('0x43')][_0x6cbb('0x44')],function(_0x24b00d){return{'name':_0x24b00d[_0x6cbb('0x45')],'type':_0x24b00d[_0x6cbb('0x46')][_0x6cbb('0x47')]};});_0x558790[_0x6cbb('0x48')]=_['map'](_0x116a90,_0x6cbb('0x27'));_0x558790[_0x6cbb('0x49')]=_['keys'](_0x4e1614[_0x6cbb('0x49')]);_0x558790[_0x6cbb('0x4a')]=_[_0x6cbb('0x4b')](_0x558790['model'],_0x558790['query']);_0x381237['attributes']=_[_0x6cbb('0x4b')](_0x558790['model'],qs[_0x6cbb('0x4c')](_0x4e1614[_0x6cbb('0x49')][_0x6cbb('0x4c')]));_0x381237[_0x6cbb('0x4d')]=_0x381237[_0x6cbb('0x4d')][_0x6cbb('0x4e')]?_0x381237[_0x6cbb('0x4d')]:_0x558790['model'];if(!_0x4e1614['query'][_0x6cbb('0x4f')](_0x6cbb('0x50'))){_0x381237[_0x6cbb('0x20')]=qs['limit'](_0x4e1614[_0x6cbb('0x49')][_0x6cbb('0x20')]);_0x381237[_0x6cbb('0x1e')]=qs[_0x6cbb('0x1e')](_0x4e1614[_0x6cbb('0x49')][_0x6cbb('0x1e')]);}_0x381237[_0x6cbb('0x51')]=qs[_0x6cbb('0x52')](_0x4e1614['query']['sort']);_0x381237[_0x6cbb('0x53')]=qs[_0x6cbb('0x4a')](_[_0x6cbb('0x54')](_0x4e1614[_0x6cbb('0x49')],_0x558790[_0x6cbb('0x4a')]),_0x116a90);if(_0x4e1614['query'][_0x6cbb('0x55')]){_0x381237['where']=_[_0x6cbb('0x56')](_0x381237[_0x6cbb('0x53')],{'$or':_[_0x6cbb('0x42')](_0x116a90,function(_0x5547cc){if(_0x5547cc[_0x6cbb('0x46')]!=='VIRTUAL'){var _0x21246d={};_0x21246d[_0x5547cc[_0x6cbb('0x27')]]={'$like':'%'+_0x4e1614[_0x6cbb('0x49')]['filter']+'%'};return _0x21246d;}})});}_0x381237=_[_0x6cbb('0x56')]({},_0x381237,_0x4e1614[_0x6cbb('0x57')]);var _0x581dfa={'where':_0x381237['where']};return db[_0x6cbb('0x43')][_0x6cbb('0x21')](_0x581dfa)[_0x6cbb('0x10')](function(_0x279cef){_0x138fcc[_0x6cbb('0x21')]=_0x279cef;if(_0x4e1614[_0x6cbb('0x49')][_0x6cbb('0x58')]){_0x381237[_0x6cbb('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0x6cbb('0x5a')](_0x381237);})['then'](function(_0x4d5820){_0x138fcc['rows']=_0x4d5820;return _0x138fcc;})[_0x6cbb('0x10')](respondWithFilteredResult(_0x614a4a,_0x381237))['catch'](handleError(_0x614a4a,null));};exports[_0x6cbb('0x5b')]=function(_0x3fcf61,_0x54bd9){var _0x3ee45e={'raw':![],'where':{'id':_0x3fcf61[_0x6cbb('0x5c')]['id']},'include':[{'model':db[_0x6cbb('0x40')],'as':_0x6cbb('0x3d')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x6cbb('0x5d')],'as':_0x6cbb('0x5e')}]},_0x422567={};_0x422567[_0x6cbb('0x48')]=_[_0x6cbb('0x5f')](db[_0x6cbb('0x43')][_0x6cbb('0x44')]);_0x422567[_0x6cbb('0x49')]=_[_0x6cbb('0x5f')](_0x3fcf61[_0x6cbb('0x49')]);_0x422567[_0x6cbb('0x4a')]=_['intersection'](_0x422567[_0x6cbb('0x48')],_0x422567[_0x6cbb('0x49')]);_0x3ee45e[_0x6cbb('0x4d')]=_[_0x6cbb('0x4b')](_0x422567[_0x6cbb('0x48')],qs[_0x6cbb('0x4c')](_0x3fcf61[_0x6cbb('0x49')][_0x6cbb('0x4c')]));_0x3ee45e[_0x6cbb('0x4d')]=_0x3ee45e[_0x6cbb('0x4d')][_0x6cbb('0x4e')]?_0x3ee45e[_0x6cbb('0x4d')]:_0x422567[_0x6cbb('0x48')];if(_0x3fcf61[_0x6cbb('0x49')][_0x6cbb('0x58')]){_0x3ee45e[_0x6cbb('0x59')]=[{'all':!![]}];}_0x3ee45e=_[_0x6cbb('0x56')]({},_0x3ee45e,_0x3fcf61['options']);return db[_0x6cbb('0x43')][_0x6cbb('0x60')](_0x3ee45e)[_0x6cbb('0x10')](handleEntityNotFound(_0x54bd9,null))['then'](respondWithResult(_0x54bd9,null))['catch'](handleError(_0x54bd9,null));};exports[_0x6cbb('0x61')]=function(_0xae5da4,_0x1a5012){if(_0xae5da4[_0x6cbb('0x62')]['id']){delete _0xae5da4[_0x6cbb('0x62')]['id'];}var _0xd900f=_0xae5da4['body'][_0x6cbb('0x63')]===_0x6cbb('0x64')?null:_0xae5da4[_0x6cbb('0x62')]['provider'];var _0x5b5e7c=_0xae5da4[_0x6cbb('0x62')][_0x6cbb('0x3d')]||{};var _0x4f1155=_0xae5da4['body'][_0x6cbb('0x3e')]||{};if(_0xd900f){_0x5b5e7c[_0x6cbb('0x38')]=getImapHost(_0xd900f);_0x5b5e7c['port']=0x3e1;_0x4f1155['host']=getSmtpHost(_0xd900f);_0x4f1155[_0x6cbb('0x39')]=0x24b;_0x4f1155[_0x6cbb('0x3a')]=![];}if(_0x4f1155[_0x6cbb('0x36')]){_0x4f1155[_0x6cbb('0x3a')]=![];}else{_0x4f1155[_0x6cbb('0x37')]=null;}if(!_0x5b5e7c[_0x6cbb('0x36')])_0x5b5e7c[_0x6cbb('0x37')]=null;_0xae5da4[_0x6cbb('0x62')][_0x6cbb('0x3d')]=_0x5b5e7c;_0xae5da4[_0x6cbb('0x62')]['Smtp']=_0x4f1155;return db[_0x6cbb('0x43')][_0x6cbb('0x60')]({'where':{'id':_0xae5da4[_0x6cbb('0x5c')]['id']},'include':[{'model':db[_0x6cbb('0x40')],'as':'Imap'},{'model':db[_0x6cbb('0x41')],'as':_0x6cbb('0x3e')},{'model':db[_0x6cbb('0x5d')],'as':_0x6cbb('0x5e')}]})['then'](handleEntityNotFound(_0x1a5012,null))[_0x6cbb('0x10')](function(_0x3bb8d6){if(!_0x3bb8d6)throw new Error(_0x6cbb('0x65'));if(_0x3bb8d6[_0x6cbb('0x3b')])delete _0xae5da4[_0x6cbb('0x62')]['Imap'];return _0x3bb8d6;})[_0x6cbb('0x10')](saveUpdates(_0xae5da4[_0x6cbb('0x62')],null))[_0x6cbb('0x10')](function(_0x3c29d3){if(!_0xae5da4[_0x6cbb('0x62')][_0x6cbb('0x3d')])return _0x3c29d3;return db[_0x6cbb('0x40')]['update'](_0xae5da4['body'][_0x6cbb('0x3d')],{'where':{'MailAccountId':_0x3c29d3['id']}})[_0x6cbb('0x10')](function(){return _0x3c29d3;});})['then'](function(_0xecc032){if(!_0xae5da4[_0x6cbb('0x62')][_0x6cbb('0x3e')])return _0xecc032;return db[_0x6cbb('0x41')][_0x6cbb('0x61')](_0xae5da4[_0x6cbb('0x62')][_0x6cbb('0x3e')],{'where':{'MailAccountId':_0xecc032['id']}})['then'](function(){return _0xecc032;});})[_0x6cbb('0x10')](respondWithResult(_0x1a5012,null))[_0x6cbb('0x66')](handleError(_0x1a5012,null));};exports[_0x6cbb('0x67')]=function(_0x16a415,_0x35d7a4){return db[_0x6cbb('0x43')][_0x6cbb('0x67')]()['then'](respondWithResult(_0x35d7a4,null))['catch'](handleError(_0x35d7a4,null));};exports[_0x6cbb('0x68')]=function(_0x17ede2,_0x261af5){if(_0x17ede2[_0x6cbb('0x62')]['id']){delete _0x17ede2[_0x6cbb('0x62')]['id'];}return db[_0x6cbb('0x43')]['find']({'where':{'id':_0x17ede2['params']['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x261af5,null))['then'](function(_0x2898c6){if(_0x2898c6){_0x17ede2[_0x6cbb('0x62')]['MailAccountId']=_0x2898c6['id'];return db['Disposition'][_0x6cbb('0x69')](_0x17ede2['body']);}})[_0x6cbb('0x10')](respondWithResult(_0x261af5,null))[_0x6cbb('0x66')](handleError(_0x261af5,null));};exports[_0x6cbb('0x6a')]=function(_0x5dbc89,_0x518804){var _0x38a13a={'raw':![],'where':{}};var _0x5b53a9={};var _0x728b50={'count':0x0,'rows':[]};return db[_0x6cbb('0x43')][_0x6cbb('0x6b')]({'where':{'id':_0x5dbc89[_0x6cbb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x518804,null))[_0x6cbb('0x10')](function(_0xbce658){if(_0xbce658){_0x5b53a9[_0x6cbb('0x48')]=_['keys'](db[_0x6cbb('0x6c')][_0x6cbb('0x44')]);_0x5b53a9['query']=_['keys'](_0x5dbc89['query']);_0x5b53a9[_0x6cbb('0x4a')]=_[_0x6cbb('0x4b')](_0x5b53a9[_0x6cbb('0x48')],_0x5b53a9['query']);_0x38a13a[_0x6cbb('0x4d')]=_['intersection'](_0x5b53a9[_0x6cbb('0x48')],qs[_0x6cbb('0x4c')](_0x5dbc89[_0x6cbb('0x49')][_0x6cbb('0x4c')]));_0x38a13a['attributes']=_0x38a13a[_0x6cbb('0x4d')][_0x6cbb('0x4e')]?_0x38a13a[_0x6cbb('0x4d')]:_0x5b53a9[_0x6cbb('0x48')];if(!_0x5dbc89[_0x6cbb('0x49')]['hasOwnProperty'](_0x6cbb('0x50'))){_0x38a13a[_0x6cbb('0x20')]=qs[_0x6cbb('0x20')](_0x5dbc89[_0x6cbb('0x49')][_0x6cbb('0x20')]);_0x38a13a[_0x6cbb('0x1e')]=qs[_0x6cbb('0x1e')](_0x5dbc89[_0x6cbb('0x49')]['offset']);}_0x38a13a[_0x6cbb('0x51')]=qs[_0x6cbb('0x52')](_0x5dbc89[_0x6cbb('0x49')]['sort']);_0x38a13a[_0x6cbb('0x53')]=qs[_0x6cbb('0x4a')](_[_0x6cbb('0x54')](_0x5dbc89['query'],_0x5b53a9[_0x6cbb('0x4a')]));_0x38a13a[_0x6cbb('0x53')][_0x6cbb('0x6d')]=_0xbce658['id'];if(_0x5dbc89[_0x6cbb('0x49')][_0x6cbb('0x55')]){_0x38a13a[_0x6cbb('0x53')]=_[_0x6cbb('0x56')](_0x38a13a[_0x6cbb('0x53')],{'$or':_[_0x6cbb('0x42')](_0x38a13a['attributes'],function(_0x514774){var _0x196153={};_0x196153[_0x514774]={'$like':'%'+_0x5dbc89[_0x6cbb('0x49')][_0x6cbb('0x55')]+'%'};return _0x196153;})});}_0x38a13a=_['merge']({},_0x38a13a,_0x5dbc89[_0x6cbb('0x57')]);return db[_0x6cbb('0x6c')][_0x6cbb('0x21')]({'where':_0x38a13a[_0x6cbb('0x53')]})[_0x6cbb('0x10')](function(_0x5cfc2d){_0x728b50['count']=_0x5cfc2d;if(_0x5dbc89[_0x6cbb('0x49')][_0x6cbb('0x58')]){_0x38a13a['include']=[{'all':!![]}];}return db['Disposition'][_0x6cbb('0x5a')](_0x38a13a);})[_0x6cbb('0x10')](function(_0x1e2e59){_0x728b50[_0x6cbb('0x6e')]=_0x1e2e59;return _0x728b50;});}})['then'](respondWithFilteredResult(_0x518804,_0x38a13a))['catch'](handleError(_0x518804,null));};exports[_0x6cbb('0x6f')]=function(_0x4a1317,_0x2ffe90){return db['MailAccount']['find']({'where':{'id':_0x4a1317[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x2ffe90,null))['then'](function(_0x404cb7){if(_0x404cb7){return _0x404cb7[_0x6cbb('0x6f')](_0x4a1317[_0x6cbb('0x49')][_0x6cbb('0x70')]);}})[_0x6cbb('0x10')](respondWithStatusCode(_0x2ffe90,null))['catch'](handleError(_0x2ffe90,null));};exports[_0x6cbb('0x71')]=function(_0x438ed1,_0x2b8e19){if(_0x438ed1['body']['id']){delete _0x438ed1['body']['id'];}return db['MailAccount'][_0x6cbb('0x60')]({'where':{'id':_0x438ed1['params']['id']}})['then'](handleEntityNotFound(_0x2b8e19,null))['then'](function(_0x48f15e){if(_0x48f15e){_0x438ed1[_0x6cbb('0x62')][_0x6cbb('0x6d')]=_0x48f15e['id'];return db['CannedAnswer'][_0x6cbb('0x69')](_0x438ed1[_0x6cbb('0x62')]);}})[_0x6cbb('0x10')](respondWithResult(_0x2b8e19,null))[_0x6cbb('0x66')](handleError(_0x2b8e19,null));};exports['getAnswers']=function(_0x4c160a,_0x46f67b){var _0x202dd6={'raw':![],'where':{}};var _0x394bbb={};var _0x3ece99={'count':0x0,'rows':[]};return db['MailAccount'][_0x6cbb('0x6b')]({'where':{'id':_0x4c160a['params']['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x46f67b,null))[_0x6cbb('0x10')](function(_0x3507d7){if(_0x3507d7){_0x394bbb[_0x6cbb('0x48')]=_['keys'](db[_0x6cbb('0x72')][_0x6cbb('0x44')]);_0x394bbb[_0x6cbb('0x49')]=_[_0x6cbb('0x5f')](_0x4c160a['query']);_0x394bbb[_0x6cbb('0x4a')]=_['intersection'](_0x394bbb[_0x6cbb('0x48')],_0x394bbb['query']);_0x202dd6[_0x6cbb('0x4d')]=_['intersection'](_0x394bbb[_0x6cbb('0x48')],qs['fields'](_0x4c160a[_0x6cbb('0x49')]['fields']));_0x202dd6['attributes']=_0x202dd6['attributes'][_0x6cbb('0x4e')]?_0x202dd6['attributes']:_0x394bbb['model'];if(!_0x4c160a[_0x6cbb('0x49')][_0x6cbb('0x4f')](_0x6cbb('0x50'))){_0x202dd6[_0x6cbb('0x20')]=qs[_0x6cbb('0x20')](_0x4c160a[_0x6cbb('0x49')][_0x6cbb('0x20')]);_0x202dd6[_0x6cbb('0x1e')]=qs['offset'](_0x4c160a['query'][_0x6cbb('0x1e')]);}_0x202dd6['order']=qs[_0x6cbb('0x52')](_0x4c160a[_0x6cbb('0x49')][_0x6cbb('0x52')]);_0x202dd6[_0x6cbb('0x53')]=qs[_0x6cbb('0x4a')](_[_0x6cbb('0x54')](_0x4c160a[_0x6cbb('0x49')],_0x394bbb[_0x6cbb('0x4a')]));_0x202dd6['where'][_0x6cbb('0x6d')]=_0x3507d7['id'];if(_0x4c160a['query'][_0x6cbb('0x55')]){_0x202dd6[_0x6cbb('0x53')]=_[_0x6cbb('0x56')](_0x202dd6[_0x6cbb('0x53')],{'$or':_[_0x6cbb('0x42')](_0x202dd6[_0x6cbb('0x4d')],function(_0x460fba){var _0x3a0201={};_0x3a0201[_0x460fba]={'$like':'%'+_0x4c160a[_0x6cbb('0x49')]['filter']+'%'};return _0x3a0201;})});}_0x202dd6=_[_0x6cbb('0x56')]({},_0x202dd6,_0x4c160a[_0x6cbb('0x57')]);return db[_0x6cbb('0x72')][_0x6cbb('0x21')]({'where':_0x202dd6[_0x6cbb('0x53')]})[_0x6cbb('0x10')](function(_0x2fdc75){_0x3ece99[_0x6cbb('0x21')]=_0x2fdc75;if(_0x4c160a[_0x6cbb('0x49')]['includeAll']){_0x202dd6[_0x6cbb('0x59')]=[{'all':!![]}];}return db[_0x6cbb('0x72')][_0x6cbb('0x5a')](_0x202dd6);})['then'](function(_0x2dc4a1){_0x3ece99[_0x6cbb('0x6e')]=_0x2dc4a1;return _0x3ece99;});}})[_0x6cbb('0x10')](respondWithFilteredResult(_0x46f67b,_0x202dd6))[_0x6cbb('0x66')](handleError(_0x46f67b,null));};exports[_0x6cbb('0x73')]=function(_0x5b2ccc,_0x4658ef){return db['MailAccount'][_0x6cbb('0x60')]({'where':{'id':_0x5b2ccc[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x4658ef,null))[_0x6cbb('0x10')](function(_0x2a1395){if(_0x2a1395){return _0x2a1395[_0x6cbb('0x73')](_0x5b2ccc['query']['ids']);}})[_0x6cbb('0x10')](respondWithStatusCode(_0x4658ef,null))[_0x6cbb('0x66')](handleError(_0x4658ef,null));};exports[_0x6cbb('0x69')]=function(_0x452f25,_0x219580){var _0x7e2fcc={'name':_0x452f25[_0x6cbb('0x62')]['name'],'key':_0x452f25[_0x6cbb('0x62')][_0x6cbb('0x47')],'provider':_0x452f25[_0x6cbb('0x62')][_0x6cbb('0x63')]===_0x6cbb('0x64')?null:_0x452f25[_0x6cbb('0x62')][_0x6cbb('0x63')],'email':_0x452f25['body'][_0x6cbb('0x74')],'ListId':_0x452f25['body']['ListId'],'active':!_[_0x6cbb('0x75')](_0x452f25['body'][_0x6cbb('0x76')])?_0x452f25[_0x6cbb('0x62')]['active']:!![],'description':_0x452f25[_0x6cbb('0x62')][_0x6cbb('0x77')]||null};var _0x39ed80=getAuthenticationOptions(_0x7e2fcc[_0x6cbb('0x63')],_0x452f25[_0x6cbb('0x62')]);_0x7e2fcc[_0x6cbb('0x3d')]=_0x39ed80['Imap'];_0x7e2fcc[_0x6cbb('0x3e')]=_0x39ed80[_0x6cbb('0x3e')];return db[_0x6cbb('0x43')]['create'](_0x7e2fcc,{'include':[{'model':db[_0x6cbb('0x41')],'as':_0x6cbb('0x3e')},{'model':db[_0x6cbb('0x40')],'as':_0x6cbb('0x3d')}]})[_0x6cbb('0x10')](function(_0x45458b){var _0x3b9fff=_0x452f25[_0x6cbb('0x32')][_0x6cbb('0x24')]({'plain':!![]});if(!_0x3b9fff)throw new Error(_0x6cbb('0x78'));if(_0x3b9fff[_0x6cbb('0x79')]===_0x6cbb('0x32')){var _0x5cc3d0=_0x45458b['get']({'plain':!![]});return db[_0x6cbb('0x7a')][_0x6cbb('0x60')]({'where':{'name':_0x6cbb('0x25'),'userProfileId':_0x3b9fff[_0x6cbb('0x7b')]},'raw':!![]})[_0x6cbb('0x10')](function(_0x5503dd){if(_0x5503dd&&_0x5503dd[_0x6cbb('0x7c')]===0x0){return db['UserProfileResource'][_0x6cbb('0x69')]({'name':_0x5cc3d0[_0x6cbb('0x27')],'resourceId':_0x5cc3d0['id'],'type':_0x5503dd[_0x6cbb('0x27')],'sectionId':_0x5503dd['id']},{})[_0x6cbb('0x10')](function(){return _0x45458b;});}else{return _0x45458b;}})['catch'](function(_0x4940fb){logger[_0x6cbb('0x16')](_0x6cbb('0x7d'),_0x4940fb);throw _0x4940fb;});}return _0x45458b;})[_0x6cbb('0x10')](respondWithResult(_0x219580,0xc9))[_0x6cbb('0x66')](handleError(_0x219580,null));};exports[_0x6cbb('0x7e')]=function(_0x37f72e,_0x46fdec){return db[_0x6cbb('0x43')][_0x6cbb('0x6b')]({'where':{'id':_0x37f72e[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x46fdec,null))[_0x6cbb('0x10')](function(_0x3f922a){if(_0x3f922a){return _0x3f922a['getImap']();}return null;})[_0x6cbb('0x10')](respondWithResult(_0x46fdec,null))['catch'](handleError(_0x46fdec,null));};exports['addImap']=function(_0x578307,_0x46b234){if(_0x578307['body']['id']){delete _0x578307[_0x6cbb('0x62')]['id'];}return db[_0x6cbb('0x43')][_0x6cbb('0x60')]({'where':{'id':_0x578307['params']['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x46b234,null))[_0x6cbb('0x10')](function(_0xc0b788){if(_0xc0b788){_0x578307[_0x6cbb('0x62')][_0x6cbb('0x6d')]=_0xc0b788['id'];return db[_0x6cbb('0x40')]['create'](_0x578307[_0x6cbb('0x62')]);}})[_0x6cbb('0x10')](respondWithResult(_0x46b234,null))['catch'](handleError(_0x46b234,null));};exports[_0x6cbb('0x7f')]=function(_0x1029ba,_0x228aeb){return db[_0x6cbb('0x43')][_0x6cbb('0x6b')]({'where':{'id':_0x1029ba[_0x6cbb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x228aeb,null))[_0x6cbb('0x10')](function(_0x4d097d){if(_0x4d097d){return _0x4d097d[_0x6cbb('0x80')](null);}return null;})[_0x6cbb('0x10')](respondWithStatusCode(_0x228aeb,null))[_0x6cbb('0x66')](handleError(_0x228aeb,null));};exports[_0x6cbb('0x81')]=function(_0x47a0bc,_0x497862){return db[_0x6cbb('0x43')]['findOne']({'where':{'id':_0x47a0bc[_0x6cbb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x497862,null))[_0x6cbb('0x10')](function(_0x4eebf3){if(_0x4eebf3){return _0x4eebf3['getSmtp']();}return null;})[_0x6cbb('0x10')](respondWithResult(_0x497862,null))[_0x6cbb('0x66')](handleError(_0x497862,null));};exports[_0x6cbb('0x82')]=function(_0x273bf8,_0x443ba9){if(_0x273bf8[_0x6cbb('0x62')]['id']){delete _0x273bf8[_0x6cbb('0x62')]['id'];}return db['MailAccount'][_0x6cbb('0x60')]({'where':{'id':_0x273bf8[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x443ba9,null))['then'](function(_0x164033){if(_0x164033){_0x273bf8[_0x6cbb('0x62')][_0x6cbb('0x6d')]=_0x164033['id'];return db['MailServerOut']['create'](_0x273bf8[_0x6cbb('0x62')]);}})['then'](respondWithResult(_0x443ba9,null))[_0x6cbb('0x66')](handleError(_0x443ba9,null));};exports[_0x6cbb('0x83')]=function(_0x3b568a,_0x58c59e){return db[_0x6cbb('0x43')][_0x6cbb('0x6b')]({'where':{'id':_0x3b568a[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x58c59e,null))[_0x6cbb('0x10')](function(_0x337475){if(_0x337475){return _0x337475[_0x6cbb('0x84')](null);}return null;})[_0x6cbb('0x10')](respondWithStatusCode(_0x58c59e,null))[_0x6cbb('0x66')](handleError(_0x58c59e,null));};exports[_0x6cbb('0x85')]=function(_0x37ca97,_0x9e43c8){return db[_0x6cbb('0x86')]['find']({'where':{'id':_0x37ca97[_0x6cbb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x9e43c8,null))['then'](function(_0x432ae4){if(_0x432ae4){return _0x432ae4[_0x6cbb('0x85')](_0x37ca97[_0x6cbb('0x62')]['ids'],_[_0x6cbb('0x87')](_0x37ca97[_0x6cbb('0x62')],[_0x6cbb('0x70'),'id'])||{});}})['then'](respondWithResult(_0x9e43c8,null))[_0x6cbb('0x66')](handleError(_0x9e43c8,null));};exports[_0x6cbb('0x88')]=function(_0x1fde34,_0x110009){var _0xfaa36a={'raw':![],'where':{}};var _0x2bd02e={};var _0x5aedbf={'count':0x0,'rows':[]};return db[_0x6cbb('0x43')][_0x6cbb('0x6b')]({'where':{'id':_0x1fde34['params']['id']}})['then'](handleEntityNotFound(_0x110009,null))[_0x6cbb('0x10')](function(_0x143275){if(_0x143275){_0x2bd02e[_0x6cbb('0x48')]=_[_0x6cbb('0x5f')](db[_0x6cbb('0x86')]['rawAttributes']);_0x2bd02e['query']=_[_0x6cbb('0x5f')](_0x1fde34[_0x6cbb('0x49')]);_0x2bd02e['filters']=_[_0x6cbb('0x4b')](_0x2bd02e['model'],_0x2bd02e[_0x6cbb('0x49')]);_0xfaa36a[_0x6cbb('0x4d')]=_[_0x6cbb('0x4b')](_0x2bd02e['model'],qs[_0x6cbb('0x4c')](_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x4c')]));_0xfaa36a[_0x6cbb('0x4d')]=_0xfaa36a['attributes']['length']?_0xfaa36a['attributes']:_0x2bd02e['model'];if(!_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x4f')]('nolimit')){_0xfaa36a[_0x6cbb('0x20')]=qs[_0x6cbb('0x20')](_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x20')]);_0xfaa36a[_0x6cbb('0x1e')]=qs[_0x6cbb('0x1e')](_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x1e')]);}_0xfaa36a['order']=qs[_0x6cbb('0x52')](_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x52')]);_0xfaa36a['where']=qs[_0x6cbb('0x4a')](_[_0x6cbb('0x54')](_0x1fde34[_0x6cbb('0x49')],_0x2bd02e[_0x6cbb('0x4a')]));_0xfaa36a[_0x6cbb('0x53')][_0x6cbb('0x6d')]=_0x143275['id'];if(_0x1fde34['query'][_0x6cbb('0x55')]){_0xfaa36a['where']=_[_0x6cbb('0x56')](_0xfaa36a[_0x6cbb('0x53')],{'$or':_[_0x6cbb('0x42')](_0xfaa36a['attributes'],function(_0x1db6f4){var _0x316d84={};_0x316d84[_0x1db6f4]={'$like':'%'+_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x55')]+'%'};return _0x316d84;})});}_0xfaa36a=_[_0x6cbb('0x56')]({},_0xfaa36a,_0x1fde34['options']);return db[_0x6cbb('0x86')]['count']({'where':_0xfaa36a[_0x6cbb('0x53')]})[_0x6cbb('0x10')](function(_0x414bf9){_0x5aedbf[_0x6cbb('0x21')]=_0x414bf9;if(_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x58')]){_0xfaa36a[_0x6cbb('0x59')]=[{'model':db[_0x6cbb('0x89')],'as':_0x6cbb('0x8a'),'required':![]},{'model':db[_0x6cbb('0x8b')],'as':'Owner','attributes':[_0x6cbb('0x27'),_0x6cbb('0x8c'),_0x6cbb('0x8d')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x6cbb('0x27'),_0x6cbb('0x8e')],'where':_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x8f')]?{'id':_0x1fde34['query']['tag']}:undefined,'required':_0x1fde34[_0x6cbb('0x49')][_0x6cbb('0x8f')]?!![]:![]}];}return db[_0x6cbb('0x86')][_0x6cbb('0x5a')](_0xfaa36a);})[_0x6cbb('0x10')](function(_0x5aeb1c){_0x5aedbf[_0x6cbb('0x6e')]=_0x5aeb1c;return _0x5aedbf;});}})['then'](respondWithFilteredResult(_0x110009,_0xfaa36a))[_0x6cbb('0x66')](handleError(_0x110009,null));};exports['addApplications']=function addApplications(_0x36614b,_0x5cfc71){var _0x260bed=_0x36614b[_0x6cbb('0x5c')]['id'];var _0xd356d3=_0x36614b[_0x6cbb('0x62')];var _0x525698=0xc8;var _0x5efd4d=null;return db[_0x6cbb('0x90')][_0x6cbb('0x91')]({'isolationLevel':db[_0x6cbb('0x90')][_0x6cbb('0x92')][_0x6cbb('0x93')]['READ_COMMITTED']},function(_0x360fe9){return db['MailAccount'][_0x6cbb('0x6b')]({'where':{'id':_0x260bed},'transaction':_0x360fe9})[_0x6cbb('0x10')](function(_0x1e7588){if(_0x1e7588){return db['MailApplication'][_0x6cbb('0x23')]({'where':{'MailAccountId':_0x260bed},'transaction':_0x360fe9})[_0x6cbb('0x10')](function(){var _0x2f64bb=_[_0x6cbb('0x42')](_0xd356d3,function(_0x39f2b0){_0x39f2b0[_0x6cbb('0x6d')]=_0x260bed;return _0x39f2b0;});return db[_0x6cbb('0x94')][_0x6cbb('0x95')](_0x2f64bb,{'transaction':_0x360fe9});});}else{_0x525698=0x194;_0x5efd4d=[];}});})[_0x6cbb('0x10')](function(){if(_0x525698!==0x194){return db[_0x6cbb('0x94')][_0x6cbb('0x96')]({'where':{'MailAccountId':_0x260bed},'order':'priority'})[_0x6cbb('0x10')](function(_0x5736cd){_0x5efd4d=_0x5736cd;});}})[_0x6cbb('0x66')](function(_0x8a0bfd){_0x525698=0x1f4;logger[_0x6cbb('0x16')](_0x8a0bfd[_0x6cbb('0x97')]);if(_0x8a0bfd['name']){delete _0x8a0bfd[_0x6cbb('0x27')];}_0x5efd4d=_0x8a0bfd;})['finally'](function(){if(_0x5efd4d===null){_0x5cfc71[_0x6cbb('0x98')](_0x525698);}else{if(_0x525698===0x1f4){_0x5cfc71['status'](_0x525698)[_0x6cbb('0x99')](_0x5efd4d);}else{_0x5cfc71[_0x6cbb('0x1b')](_0x525698)[_0x6cbb('0x1d')](_0x5efd4d);}}});};exports[_0x6cbb('0x9a')]=function(_0x4cd8d6,_0x594771){var _0x4f29d3={};var _0x4071f0={};var _0x3cfa44;var _0xf82e90;return db[_0x6cbb('0x43')][_0x6cbb('0x6b')]({'where':{'id':_0x4cd8d6[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x594771,null))[_0x6cbb('0x10')](function(_0x20dcce){if(_0x20dcce){_0x3cfa44=_0x20dcce;_0x4071f0[_0x6cbb('0x48')]=_['keys'](db[_0x6cbb('0x94')][_0x6cbb('0x44')]);_0x4071f0[_0x6cbb('0x49')]=_[_0x6cbb('0x5f')](_0x4cd8d6[_0x6cbb('0x49')]);_0x4071f0[_0x6cbb('0x4a')]=_['intersection'](_0x4071f0[_0x6cbb('0x48')],_0x4071f0[_0x6cbb('0x49')]);_0x4f29d3[_0x6cbb('0x4d')]=_[_0x6cbb('0x4b')](_0x4071f0[_0x6cbb('0x48')],qs[_0x6cbb('0x4c')](_0x4cd8d6['query'][_0x6cbb('0x4c')]));_0x4f29d3[_0x6cbb('0x4d')]=_0x4f29d3[_0x6cbb('0x4d')]['length']?_0x4f29d3['attributes']:_0x4071f0[_0x6cbb('0x48')];_0x4f29d3[_0x6cbb('0x51')]=qs[_0x6cbb('0x52')](_0x4cd8d6['query'][_0x6cbb('0x52')]);_0x4f29d3[_0x6cbb('0x53')]=qs[_0x6cbb('0x4a')](_[_0x6cbb('0x54')](_0x4cd8d6[_0x6cbb('0x49')],_0x4071f0['filters']));if(_0x4cd8d6['query'][_0x6cbb('0x55')]){_0x4f29d3[_0x6cbb('0x53')]=_['merge'](_0x4f29d3[_0x6cbb('0x53')],{'$or':_[_0x6cbb('0x42')](_0x4f29d3[_0x6cbb('0x4d')],function(_0x83c8bd){var _0x274dcb={};_0x274dcb[_0x83c8bd]={'$like':'%'+_0x4cd8d6[_0x6cbb('0x49')][_0x6cbb('0x55')]+'%'};return _0x274dcb;})});}_0x4f29d3=_[_0x6cbb('0x56')]({},_0x4f29d3,_0x4cd8d6[_0x6cbb('0x57')]);return _0x3cfa44[_0x6cbb('0x9a')](_0x4f29d3);}})[_0x6cbb('0x10')](function(_0x5d94a1){if(_0x5d94a1){_0xf82e90=_0x5d94a1[_0x6cbb('0x4e')];if(!_0x4cd8d6[_0x6cbb('0x49')][_0x6cbb('0x4f')](_0x6cbb('0x50'))){_0x4f29d3[_0x6cbb('0x20')]=qs[_0x6cbb('0x20')](_0x4cd8d6[_0x6cbb('0x49')]['limit']);_0x4f29d3['offset']=qs['offset'](_0x4cd8d6[_0x6cbb('0x49')]['offset']);}return _0x3cfa44[_0x6cbb('0x9a')](_0x4f29d3);}})[_0x6cbb('0x10')](function(_0x52d94b){if(_0x52d94b){return _0x52d94b?{'count':_0xf82e90,'rows':_0x52d94b}:null;}})[_0x6cbb('0x10')](respondWithResult(_0x594771,null))['catch'](handleError(_0x594771,null));};exports[_0x6cbb('0x9b')]=function(_0x5c33ab,_0x5694c9){var _0x39a61d={'raw':!![],'where':{}};var _0x596e35={};var _0x32033d={'count':0x0,'rows':[]};return db[_0x6cbb('0x43')][_0x6cbb('0x6b')]({'where':{'id':_0x5c33ab[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x5694c9,null))['then'](function(_0x29580e){if(_0x29580e){_0x596e35['model']=_['keys'](db['MailMessage'][_0x6cbb('0x44')]);_0x596e35[_0x6cbb('0x49')]=_[_0x6cbb('0x5f')](_0x5c33ab[_0x6cbb('0x49')]);_0x596e35[_0x6cbb('0x4a')]=_[_0x6cbb('0x4b')](_0x596e35['model'],_0x596e35[_0x6cbb('0x49')]);_0x39a61d[_0x6cbb('0x4d')]=_[_0x6cbb('0x4b')](_0x596e35[_0x6cbb('0x48')],qs[_0x6cbb('0x4c')](_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0x4c')]));_0x39a61d['attributes']=_0x39a61d['attributes']['length']?_0x39a61d[_0x6cbb('0x4d')]:_0x596e35[_0x6cbb('0x48')];if(!_0x5c33ab['query'][_0x6cbb('0x4f')](_0x6cbb('0x50'))){_0x39a61d[_0x6cbb('0x20')]=qs[_0x6cbb('0x20')](_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0x20')]);_0x39a61d['offset']=qs[_0x6cbb('0x1e')](_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0x1e')]);}_0x39a61d[_0x6cbb('0x51')]=qs[_0x6cbb('0x52')](_0x5c33ab['query'][_0x6cbb('0x52')]);_0x39a61d[_0x6cbb('0x53')]=qs[_0x6cbb('0x4a')](_[_0x6cbb('0x54')](_0x5c33ab[_0x6cbb('0x49')],_0x596e35[_0x6cbb('0x4a')]));_0x39a61d[_0x6cbb('0x53')][_0x6cbb('0x6d')]=_0x29580e['id'];if(_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0x55')]){_0x39a61d['where']=_[_0x6cbb('0x56')](_0x39a61d[_0x6cbb('0x53')],{'$or':_[_0x6cbb('0x42')](_0x39a61d['attributes'],function(_0x4f8263){var _0xb3d9a6={};_0xb3d9a6[_0x4f8263]={'$like':'%'+_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0x55')]+'%'};return _0xb3d9a6;})});}if(_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0x9c')]){var _0x46c1bb=_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0x9c')][_0x6cbb('0x9d')](',');var _0x19ec43={};_0x19ec43[_0x46c1bb[0x0]]={'$gte':moment(_0x46c1bb[0x1])[_0x6cbb('0x9e')](_0x6cbb('0x9f'))};_0x39a61d[_0x6cbb('0x53')]=_[_0x6cbb('0x56')](_0x39a61d[_0x6cbb('0x53')],_0x19ec43);}_0x39a61d=_['merge']({},_0x39a61d,_0x5c33ab['options']);return db[_0x6cbb('0xa0')][_0x6cbb('0x21')]({'where':_0x39a61d['where']})[_0x6cbb('0x10')](function(_0x5b109e){_0x32033d[_0x6cbb('0x21')]=_0x5b109e;if(_0x5c33ab[_0x6cbb('0x49')]['includeAll']){_0x39a61d[_0x6cbb('0x59')]=[{'all':!![]}];}return db[_0x6cbb('0xa0')][_0x6cbb('0x5a')](_0x39a61d);})[_0x6cbb('0x10')](function(_0x2d16c9){if(_0x5c33ab[_0x6cbb('0x49')][_0x6cbb('0xa1')]===_0x6cbb('0xa2')){for(var _0x472dbd=0x0;_0x472dbd<_0x2d16c9[_0x6cbb('0x4e')];_0x472dbd++){_0x2d16c9[_0x472dbd][_0x6cbb('0x62')]=juice(_0x2d16c9[_0x472dbd][_0x6cbb('0x62')]);}}_0x32033d[_0x6cbb('0x6e')]=_0x2d16c9;return _0x32033d;});}})[_0x6cbb('0x10')](respondWithFilteredResult(_0x5694c9,_0x39a61d))[_0x6cbb('0x66')](handleError(_0x5694c9,null));};exports[_0x6cbb('0x99')]=function(_0x446a41,_0x434825){var _0x46ddad,_0x402493={},_0x4f8dc2;if(_0x446a41[_0x6cbb('0x62')]['to']){_0x4f8dc2=_0x446a41['body']['to'][_0x6cbb('0x9d')](',')[0x0];}return db[_0x6cbb('0x43')][_0x6cbb('0x60')]({'where':{'id':_0x446a41[_0x6cbb('0x5c')]['id']},'include':[{'model':db[_0x6cbb('0xa3')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6cbb('0xa4'),'where':{'email':_0x4f8dc2},'limit':0x1,'order':[[_0x6cbb('0xa5'),_0x6cbb('0xa6')]]}]},{'model':db[_0x6cbb('0x41')],'as':_0x6cbb('0x3e'),'raw':!![],'include':[{'model':db[_0x6cbb('0xa7')],'as':_0x6cbb('0xa7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x434825,null))[_0x6cbb('0x10')](function(_0x14319b){if(!_0x14319b)return;_0x46ddad=_0x14319b;if(!_0x14319b['Smtp'])throw new Error(_0x6cbb('0xa8'));if(_[_0x6cbb('0x75')](_0x446a41[_0x6cbb('0x62')]['from'])){_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xa9')]=util['format']('%s\x20<%s>',_0x14319b['name'],_0x14319b[_0x6cbb('0x74')]||_0x14319b['Smtp'][_0x6cbb('0x32')]);}if(_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xaa')]&&_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xaa')]['length']){for(var _0x47260a=0x0;_0x47260a<_0x446a41['body'][_0x6cbb('0xaa')]['length'];_0x47260a+=0x1){_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xaa')][_0x47260a]={'filename':_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xaa')][_0x47260a]['name'],'path':path[_0x6cbb('0xab')](config['root'],'server/files/attachments',_0x446a41[_0x6cbb('0x62')]['attachments'][_0x47260a]['basename'])};}}var _0x3e471b=_0x14319b[_0x6cbb('0xac')]();return respondWithRpcPromise(_0x6cbb('0xad'),_0x6cbb('0xae'),{'account':_0x3e471b,'message':_0x446a41[_0x6cbb('0x62')]});})['then'](function(_0x150c1d){if(!_0x150c1d)return;_0x402493=_0x150c1d;if(!_0x46ddad[_0x6cbb('0xaf')])throw new Error(_0x6cbb('0xb0'));if(_0x46ddad[_0x6cbb('0xaf')]['Contacts'][_0x6cbb('0x4e')])return _0x46ddad['List']['Contacts'][0x0];return db[_0x6cbb('0x89')][_0x6cbb('0x69')](_['defaults'](_0x446a41[_0x6cbb('0x62')],{'firstName':_0x446a41[_0x6cbb('0x62')]['to'],'email':_0x446a41[_0x6cbb('0x62')]['to'],'phone':_0x446a41['body']['to'],'ListId':_0x46ddad[_0x6cbb('0xb1')]}));})[_0x6cbb('0x10')](function(_0x5c2044){if(!_0x5c2044)return;var _0x2c19a0={'UserId':_0x446a41[_0x6cbb('0x32')]['id'],'ContactId':_0x5c2044['id'],'MailAccountId':_0x46ddad['id'],'inReplyTo':_0x402493[_0x6cbb('0xb2')],'to':_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xa9')],'cc':_0x446a41[_0x6cbb('0x62')]['cc'],'subject':_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xb3')],'attach':_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x6cbb('0x9e')](_0x6cbb('0x9f')),'lastMsgDirection':_0x6cbb('0xb5'),'Messages':[_[_0x6cbb('0x56')](_0x446a41['body'],{'messageId':_0x402493['messageId'],'sentAt':moment()[_0x6cbb('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x46ddad['id'],'UserId':_0x446a41[_0x6cbb('0x32')]['id'],'ContactId':_0x5c2044['id']})]};if(_0x446a41[_0x6cbb('0x62')][_0x6cbb('0xb6')]){_0x2c19a0=_['merge'](_0x2c19a0,_0x446a41['body']['Interaction']);}return db[_0x6cbb('0x86')][_0x6cbb('0x69')](_0x2c19a0,{'include':[{'model':db[_0x6cbb('0xa0')],'as':'Messages'}]});})[_0x6cbb('0x10')](respondWithResult(_0x434825,null))[_0x6cbb('0x66')](handleError(_0x434825,null));};exports[_0x6cbb('0xb7')]=function(_0x202de7,_0xb44bb5){return db['MailAccount'][_0x6cbb('0x60')]({'where':{'id':_0x202de7[_0x6cbb('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x6cbb('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x6cbb('0x10')](handleEntityNotFound(_0xb44bb5,null))[_0x6cbb('0x10')](function(_0xcdec8b){if(!_0xcdec8b[_0x6cbb('0x3e')])return;var _0x3148be=_0xcdec8b['getSmtpOptions']();return respondWithRpcPromise(_0x6cbb('0xb8'),_0x6cbb('0xb7'),{'account':_0x3148be});})[_0x6cbb('0x10')](respondWithResult(_0xb44bb5,null))[_0x6cbb('0x66')](handleError(_0xb44bb5,null));};exports[_0x6cbb('0x23')]=function(_0x4cfbca,_0x3733ab){return db[_0x6cbb('0x43')][_0x6cbb('0x60')]({'where':{'id':_0x4cfbca[_0x6cbb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3733ab,null))[_0x6cbb('0x10')](function(_0x2cad24){if(_0x2cad24&&_0x2cad24[_0x6cbb('0x3b')]){throw new db['Sequelize'][(_0x6cbb('0xb9'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2cad24;})[_0x6cbb('0x10')](removeEntity(_0x3733ab,null))[_0x6cbb('0x66')](handleError(_0x3733ab,null));};exports[_0x6cbb('0xba')]=function(_0x116f5c,_0x1d7929){return db[_0x6cbb('0x43')][_0x6cbb('0x60')]({'where':{'id':_0x116f5c[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x1d7929,null))[_0x6cbb('0x10')](function(_0x43ee9f){if(_0x43ee9f){return _0x43ee9f[_0x6cbb('0xba')](_0x116f5c[_0x6cbb('0x62')][_0x6cbb('0x70')],_[_0x6cbb('0x87')](_0x116f5c[_0x6cbb('0x62')],[_0x6cbb('0x70'),'id'])||{})[_0x6cbb('0xbb')](function(_0x506947){for(var _0x4005d7=0x0;_0x4005d7<_0x116f5c[_0x6cbb('0x62')]['ids'][_0x6cbb('0x4e')];_0x4005d7+=0x1){socket[_0x6cbb('0xbc')](_0x6cbb('0xbd'),{'UserId':Number(_0x116f5c[_0x6cbb('0x62')][_0x6cbb('0x70')][_0x4005d7]),'MailAccountId':Number(_0x116f5c[_0x6cbb('0x5c')]['id'])});}return _0x506947;});}})[_0x6cbb('0x10')](respondWithResult(_0x1d7929,null))[_0x6cbb('0x66')](handleError(_0x1d7929,null));};exports[_0x6cbb('0xbe')]=function(_0x1514c2,_0x521889){return db[_0x6cbb('0x43')]['find']({'where':{'id':_0x1514c2[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x521889,null))['then'](function(_0x94fb5e){if(_0x94fb5e){return _0x94fb5e['removeAgents'](_0x1514c2[_0x6cbb('0x49')][_0x6cbb('0x70')])['then'](function(){if(_[_0x6cbb('0xbf')](_0x1514c2['query'][_0x6cbb('0x70')])){for(var _0x4041c7=0x0;_0x4041c7<_0x1514c2[_0x6cbb('0x49')][_0x6cbb('0x70')][_0x6cbb('0x4e')];_0x4041c7+=0x1){socket[_0x6cbb('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x1514c2['query'][_0x6cbb('0x70')][_0x4041c7]),'MailAccountId':Number(_0x1514c2[_0x6cbb('0x5c')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x1514c2[_0x6cbb('0x49')]['ids']),'MailAccountId':Number(_0x1514c2[_0x6cbb('0x5c')]['id'])});}});}})[_0x6cbb('0x10')](respondWithStatusCode(_0x521889,null))[_0x6cbb('0x66')](handleError(_0x521889,null));};exports[_0x6cbb('0xc0')]=function(_0x284618,_0x2b2648){var _0x4d4af0={};var _0x266049={};var _0x49e70e;var _0x38ac99;return db['MailAccount'][_0x6cbb('0x6b')]({'where':{'id':_0x284618[_0x6cbb('0x5c')]['id']}})[_0x6cbb('0x10')](handleEntityNotFound(_0x2b2648,null))[_0x6cbb('0x10')](function(_0x26e2d8){if(_0x26e2d8){_0x49e70e=_0x26e2d8;_0x266049[_0x6cbb('0x48')]=_[_0x6cbb('0x5f')](db['User'][_0x6cbb('0x44')]);_0x266049['query']=_[_0x6cbb('0x5f')](_0x284618[_0x6cbb('0x49')]);_0x266049[_0x6cbb('0x4a')]=_[_0x6cbb('0x4b')](_0x266049['model'],_0x266049[_0x6cbb('0x49')]);_0x4d4af0['attributes']=_[_0x6cbb('0x4b')](_0x266049[_0x6cbb('0x48')],qs[_0x6cbb('0x4c')](_0x284618[_0x6cbb('0x49')][_0x6cbb('0x4c')]));_0x4d4af0[_0x6cbb('0x4d')]=_0x4d4af0[_0x6cbb('0x4d')][_0x6cbb('0x4e')]?_0x4d4af0[_0x6cbb('0x4d')]:_0x266049[_0x6cbb('0x48')];_0x4d4af0[_0x6cbb('0x51')]=qs[_0x6cbb('0x52')](_0x284618[_0x6cbb('0x49')][_0x6cbb('0x52')]);_0x4d4af0[_0x6cbb('0x53')]=qs['filters'](_[_0x6cbb('0x54')](_0x284618['query'],_0x266049[_0x6cbb('0x4a')]));if(_0x284618['query'][_0x6cbb('0x55')]){_0x4d4af0[_0x6cbb('0x53')]=_[_0x6cbb('0x56')](_0x4d4af0['where'],{'$or':_[_0x6cbb('0x42')](_0x4d4af0[_0x6cbb('0x4d')],function(_0x30e75f){var _0x59181b={};_0x59181b[_0x30e75f]={'$like':'%'+_0x284618[_0x6cbb('0x49')][_0x6cbb('0x55')]+'%'};return _0x59181b;})});}_0x4d4af0=_[_0x6cbb('0x56')]({},_0x4d4af0,_0x284618[_0x6cbb('0x57')]);return _0x49e70e[_0x6cbb('0xc0')](_0x4d4af0);}})[_0x6cbb('0x10')](function(_0x4b5823){if(_0x4b5823){_0x38ac99=_0x4b5823[_0x6cbb('0x4e')];if(!_0x284618[_0x6cbb('0x49')][_0x6cbb('0x4f')](_0x6cbb('0x50'))){_0x4d4af0[_0x6cbb('0x20')]=qs[_0x6cbb('0x20')](_0x284618[_0x6cbb('0x49')][_0x6cbb('0x20')]);_0x4d4af0[_0x6cbb('0x1e')]=qs[_0x6cbb('0x1e')](_0x284618['query'][_0x6cbb('0x1e')]);}return _0x49e70e['getAgents'](_0x4d4af0);}})[_0x6cbb('0x10')](function(_0x446d89){if(_0x446d89){return _0x446d89?{'count':_0x38ac99,'rows':_0x446d89}:null;}})[_0x6cbb('0x10')](respondWithResult(_0x2b2648,null))[_0x6cbb('0x66')](handleError(_0x2b2648,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7b402db..50e8bcb 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 _0x839b=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0xc285b4,_0x569050){var _0x327c95=function(_0x140aec){while(--_0x140aec){_0xc285b4['push'](_0xc285b4['shift']());}};_0x327c95(++_0x569050);}(_0x839b,0x1d5));var _0xb839=function(_0x1ff4df,_0x446afc){_0x1ff4df=_0x1ff4df-0x0;var _0x29dde1=_0x839b[_0x1ff4df];return _0x29dde1;};'use strict';var EventEmitter=require(_0xb839('0x0'));var MailAccount=require(_0xb839('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb839('0x2')](0x0);var events={'afterCreate':_0xb839('0x3'),'afterUpdate':_0xb839('0x4'),'afterDestroy':'remove'};function emitEvent(_0x919227){return function(_0x5bda38,_0x1dd49a,_0x2b6ceb){MailAccountEvents[_0xb839('0x5')](_0x919227+':'+_0x5bda38['id'],_0x5bda38);MailAccountEvents[_0xb839('0x5')](_0x919227,_0x5bda38);_0x2b6ceb(null);};}for(var e in events){if(events[_0xb839('0x6')](e)){var event=events[e];MailAccount[_0xb839('0x7')](e,emitEvent(event));}}module[_0xb839('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xe5af=['emit','exports','../../mysqldb','MailAccount','save','update','remove'];(function(_0x46d812,_0x2acc86){var _0x6c1736=function(_0x5eb536){while(--_0x5eb536){_0x46d812['push'](_0x46d812['shift']());}};_0x6c1736(++_0x2acc86);}(_0xe5af,0x9c));var _0xfe5a=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0xe5af[_0x7a112];return _0x136dc5;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){MailAccountEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);MailAccountEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 157126f..3e743bf 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 _0x9b90=['./mailAccount.attributes','exports','MailAccount','mail_accounts','custom','service','provider','host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','pass'];(function(_0x16e87e,_0xf8071f){var _0x3e55c2=function(_0x15f42f){while(--_0x15f42f){_0x16e87e['push'](_0x16e87e['shift']());}};_0x3e55c2(++_0xf8071f);}(_0x9b90,0x156));var _0x09b9=function(_0x4b3dbe,_0x263168){_0x4b3dbe=_0x4b3dbe-0x0;var _0xe31c6a=_0x9b90[_0x4b3dbe];return _0xe31c6a;};'use strict';var attributes=require(_0x09b9('0x0'));module[_0x09b9('0x1')]=function(_0x332d02){return _0x332d02['define'](_0x09b9('0x2'),attributes,{'tableName':_0x09b9('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2a52fb=this;var _0x42b7fe={'id':_0x2a52fb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2a52fb['provider']!==_0x09b9('0x4')){_0x42b7fe[_0x09b9('0x5')]=_0x2a52fb[_0x09b9('0x6')];}else{_0x42b7fe[_0x09b9('0x7')]=_0x2a52fb[_0x09b9('0x8')][_0x09b9('0x7')];_0x42b7fe[_0x09b9('0x9')]=_0x2a52fb[_0x09b9('0x8')][_0x09b9('0x9')];_0x42b7fe['secure']=_0x2a52fb[_0x09b9('0x8')][_0x09b9('0xa')];}if(_0x2a52fb[_0x09b9('0x8')][_0x09b9('0xb')]){if(_0x2a52fb[_0x09b9('0x8')][_0x09b9('0xc')]){if(!_0x2a52fb['Smtp']['CloudProvider'])throw new Error(_0x09b9('0xd'));_0x42b7fe[_0x09b9('0xe')]={'type':_0x09b9('0xf'),'user':_0x2a52fb[_0x09b9('0x8')][_0x09b9('0x10')],'accessToken':_0x2a52fb['Smtp'][_0x09b9('0x11')]['data5']};}else{_0x42b7fe[_0x09b9('0xe')]={'user':_0x2a52fb['Smtp'][_0x09b9('0x10')],'pass':_0x2a52fb['Smtp'][_0x09b9('0x12')]};}}return _0x42b7fe;}}});}; \ No newline at end of file +var _0xac1b=['data5','pass','./mailAccount.attributes','define','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user'];(function(_0x4c1214,_0x1f293c){var _0x2af2d1=function(_0x54bb00){while(--_0x54bb00){_0x4c1214['push'](_0x4c1214['shift']());}};_0x2af2d1(++_0x1f293c);}(_0xac1b,0x19a));var _0xbac1=function(_0x48cb91,_0x4d4828){_0x48cb91=_0x48cb91-0x0;var _0xb88039=_0xac1b[_0x48cb91];return _0xb88039;};'use strict';var attributes=require(_0xbac1('0x0'));module['exports']=function(_0x173937){return _0x173937[_0xbac1('0x1')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xc8fb3c=this;var _0x31ab2e={'id':_0xc8fb3c['id'],'tls':{'rejectUnauthorized':![]}};if(_0xc8fb3c[_0xbac1('0x2')]!==_0xbac1('0x3')){_0x31ab2e[_0xbac1('0x4')]=_0xc8fb3c[_0xbac1('0x2')];}else{_0x31ab2e[_0xbac1('0x5')]=_0xc8fb3c[_0xbac1('0x6')]['host'];_0x31ab2e['port']=_0xc8fb3c[_0xbac1('0x6')][_0xbac1('0x7')];_0x31ab2e[_0xbac1('0x8')]=_0xc8fb3c[_0xbac1('0x6')]['secure'];}if(_0xc8fb3c[_0xbac1('0x6')][_0xbac1('0x9')]){if(_0xc8fb3c[_0xbac1('0x6')][_0xbac1('0xa')]){if(!_0xc8fb3c[_0xbac1('0x6')][_0xbac1('0xb')])throw new Error(_0xbac1('0xc'));_0x31ab2e['auth']={'type':_0xbac1('0xd'),'user':_0xc8fb3c[_0xbac1('0x6')][_0xbac1('0xe')],'accessToken':_0xc8fb3c['Smtp'][_0xbac1('0xb')][_0xbac1('0xf')]};}else{_0x31ab2e['auth']={'user':_0xc8fb3c[_0xbac1('0x6')]['user'],'pass':_0xc8fb3c[_0xbac1('0x6')][_0xbac1('0x10')]};}}return _0x31ab2e;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 316171a..875e6ec 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 _0x1967=['getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmContact','updatedAt','Applications','CloudProvider','List','get','applications','list','priority','asc','autoclose','push','close','*,*,*,*','Contacts','length','create','messageId','generate','subject','attach','format','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','attachments','originTo','originCc','bcc','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','findAll','options','where','attributes','limit','map','include','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x1967,0x173));var _0x7196=function(_0xb08589,_0x137671){_0xb08589=_0xb08589-0x0;var _0x3b02d1=_0x1967[_0xb08589];return _0x3b02d1;};'use strict';var _=require('lodash');var moment=require(_0x7196('0x0'));var BPromise=require(_0x7196('0x1'));var rs=require(_0x7196('0x2'));var Redis=require(_0x7196('0x3'));var db=require(_0x7196('0x4'))['db'];var logger=require(_0x7196('0x5'))(_0x7196('0x6'));var config=require(_0x7196('0x7'));var jayson=require(_0x7196('0x8'));var client=jayson[_0x7196('0x9')]['http']({'port':0x232c});config[_0x7196('0xa')]=_[_0x7196('0xb')](config[_0x7196('0xa')],{'host':_0x7196('0xc'),'port':0x18eb});var socket=require(_0x7196('0xd'))(new Redis(config[_0x7196('0xa')]));require('./mailAccount.socket')[_0x7196('0xe')](socket);function respondWithRpcPromise(_0xc6366f,_0x3f846e,_0x259b18){return new BPromise(function(_0x1e862d,_0x503070){return client['request'](_0xc6366f,_0x259b18)[_0x7196('0xf')](function(_0x10459b){logger[_0x7196('0x10')](_0x7196('0x11'),_0x3f846e,_0x7196('0x12'));logger[_0x7196('0x13')](_0x7196('0x14'),_0x3f846e,_0x7196('0x12'),JSON[_0x7196('0x15')](_0x10459b));if(_0x10459b[_0x7196('0x16')]){if(_0x10459b[_0x7196('0x16')]['code']===0x1f4){logger[_0x7196('0x16')](_0x7196('0x11'),_0x3f846e,_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);return _0x503070(_0x10459b['error'][_0x7196('0x17')]);}logger['error'](_0x7196('0x11'),_0x3f846e,_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);return _0x1e862d(_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);}else{logger[_0x7196('0x10')](_0x7196('0x11'),_0x3f846e,_0x7196('0x12'));_0x1e862d(_0x10459b[_0x7196('0x18')][_0x7196('0x17')]);}})[_0x7196('0x19')](function(_0x5b716a){logger['error'](_0x7196('0x11'),_0x3f846e,_0x5b716a);_0x503070(_0x5b716a);});});}exports[_0x7196('0x1a')]=function(_0x40418d){var _0x517a3e=this;return new Promise(function(_0x39b944,_0x539d8b){return db['MailAccount'][_0x7196('0x1b')]({'raw':_0x40418d[_0x7196('0x1c')]?_0x40418d[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x40418d['options']?_0x40418d[_0x7196('0x1c')][_0x7196('0x1d')]||null:null,'attributes':_0x40418d['options']?_0x40418d[_0x7196('0x1c')][_0x7196('0x1e')]||null:null,'limit':_0x40418d[_0x7196('0x1c')]?_0x40418d[_0x7196('0x1c')][_0x7196('0x1f')]||null:null,'include':_0x40418d['options']?_0x40418d[_0x7196('0x1c')]['include']?_[_0x7196('0x20')](_0x40418d[_0x7196('0x1c')][_0x7196('0x21')],function(_0xa69810){return{'model':db[_0xa69810[_0x7196('0x22')]],'as':_0xa69810['as'],'attributes':_0xa69810[_0x7196('0x1e')],'include':_0xa69810['include']?_['map'](_0xa69810[_0x7196('0x21')],function(_0x2d284f){return{'model':db[_0x2d284f[_0x7196('0x22')]],'as':_0x2d284f['as'],'attributes':_0x2d284f['attributes'],'include':_0x2d284f['include']?_[_0x7196('0x20')](_0x2d284f[_0x7196('0x21')],function(_0x675e64){return{'model':db[_0x675e64['model']],'as':_0x675e64['as'],'attributes':_0x675e64[_0x7196('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fd339){logger['info'](_0x7196('0x1a'),_0x40418d);logger[_0x7196('0x13')](_0x7196('0x1a'),_0x40418d,JSON['stringify'](_0x4fd339));_0x39b944(_0x4fd339);})[_0x7196('0x19')](function(_0x45d567){logger[_0x7196('0x16')](_0x7196('0x1a'),_0x45d567['message'],_0x40418d);_0x539d8b(_0x517a3e[_0x7196('0x16')](0x1f4,_0x45d567[_0x7196('0x17')]));});});};exports[_0x7196('0x23')]=function(_0x651d7e){var _0x4780e1=this;return new Promise(function(_0x2786f3,_0x15c5f0){return db[_0x7196('0x24')][_0x7196('0x25')]({'raw':_0x651d7e[_0x7196('0x1c')]?_0x651d7e[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x651d7e[_0x7196('0x1c')]?_0x651d7e['options'][_0x7196('0x1d')]||null:null,'attributes':_0x651d7e['options']?_0x651d7e[_0x7196('0x1c')][_0x7196('0x1e')]||null:null,'include':_0x651d7e['options']?_0x651d7e[_0x7196('0x1c')][_0x7196('0x21')]?_[_0x7196('0x20')](_0x651d7e[_0x7196('0x1c')][_0x7196('0x21')],function(_0x4a8580){return{'model':db[_0x4a8580[_0x7196('0x22')]],'as':_0x4a8580['as'],'attributes':_0x4a8580[_0x7196('0x1e')],'include':_0x4a8580[_0x7196('0x21')]?_[_0x7196('0x20')](_0x4a8580[_0x7196('0x21')],function(_0x123cad){return{'model':db[_0x123cad['model']],'as':_0x123cad['as'],'attributes':_0x123cad[_0x7196('0x1e')],'include':_0x123cad[_0x7196('0x21')]?_[_0x7196('0x20')](_0x123cad['include'],function(_0x33831a){return{'model':db[_0x33831a[_0x7196('0x22')]],'as':_0x33831a['as'],'attributes':_0x33831a[_0x7196('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7196('0xf')](function(_0x11d4ec){if(_0x651d7e[_0x7196('0x1c')][_0x7196('0x26')]===!![])_0x11d4ec[_0x7196('0x27')](_0x7196('0x28'),_0x11d4ec[_0x7196('0x29')]());logger['info'](_0x7196('0x23'),_0x651d7e);logger[_0x7196('0x13')]('ShowMailAccount',_0x651d7e,JSON[_0x7196('0x15')](_0x11d4ec));_0x2786f3(_0x11d4ec);})['catch'](function(_0x5bd701){logger[_0x7196('0x16')](_0x7196('0x23'),_0x5bd701['message'],_0x651d7e);_0x15c5f0(_0x4780e1['error'](0x1f4,_0x5bd701[_0x7196('0x17')]));});});};exports[_0x7196('0x2a')]=function(_0xed32cd){var _0x4c2341=this;return new Promise(function(_0x36a990,_0x2d13a5){var _0x29ba1c={'body':_0xed32cd[_0x7196('0x2b')],'channel':_0x7196('0x2c')};var _0x428d76=_[_0x7196('0x2d')](_[_0x7196('0x2e')](db['CmContact'][_0x7196('0x2f')]),[_0x7196('0x30'),'updatedAt',_0x7196('0x31'),_0x7196('0x32')]);var _0x48178f=![];if(_0xed32cd[_0x7196('0x2b')]['id']){delete _0xed32cd[_0x7196('0x2b')]['id'];}if(_[_0x7196('0x33')](_0xed32cd['body'][_0x7196('0x34')])){return _0x2d13a5(_0x4c2341[_0x7196('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x7196('0x33')](_0xed32cd[_0x7196('0x2b')]['body'])||_0xed32cd[_0x7196('0x2b')]['body']===''){return _0x2d13a5(_0x4c2341['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0xed32cd['body'][_0x7196('0x35')])){return _0x2d13a5(_0x4c2341['error'](0x1f4,_0x7196('0x36')+_0x428d76));}if(!_[_0x7196('0x37')](_0x428d76,_0xed32cd[_0x7196('0x2b')][_0x7196('0x35')])){return _0x2d13a5(_0x4c2341['error'](0x1f4,_0x7196('0x38')+_0x428d76));}var _0x56ffdd={};_0x56ffdd[_0xed32cd[_0x7196('0x2b')][_0x7196('0x35')]]=_0xed32cd[_0x7196('0x2b')]['from'];return db[_0x7196('0x24')][_0x7196('0x25')]({'where':{'id':_0xed32cd[_0x7196('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7196('0x3a')],'as':'Contacts','where':_0x56ffdd,'limit':0x1,'order':[[_0x7196('0x3b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x7196('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x7196('0x3d')}]}]})['then'](function(_0x48e3b5){if(_0x48e3b5&&_0x48e3b5[_0x7196('0x3e')]){var _0x182c8b=_0x48e3b5[_0x7196('0x3f')]({'plain':!![]});_0x29ba1c[_0x7196('0x39')]=_['omit'](_0x182c8b,[_0x7196('0x3c'),'List']);_0x29ba1c[_0x7196('0x39')][_0x7196('0x28')]=_0x48e3b5['getSmtpOptions']();_0x29ba1c[_0x7196('0x40')]=_0x182c8b[_0x7196('0x3c')];_0x29ba1c[_0x7196('0x41')]=_0x182c8b['List'];_0x29ba1c[_0x7196('0x40')]=_['orderBy'](_0x29ba1c[_0x7196('0x40')],[_0x7196('0x42')],[_0x7196('0x43')]);if(_0x29ba1c[_0x7196('0x39')]&&_0x29ba1c[_0x7196('0x39')][_0x7196('0x44')]){_0x29ba1c[_0x7196('0x40')][_0x7196('0x45')]({'id':0x0,'priority':_0x29ba1c['applications']['length']+0x1,'app':_0x7196('0x46'),'appdata':_0x7196('0x44'),'interval':_0x7196('0x47')});}if(_0x29ba1c[_0x7196('0x39')]['Applications']){delete _0x29ba1c[_0x7196('0x39')][_0x7196('0x3c')];}if(_0x29ba1c[_0x7196('0x39')][_0x7196('0x3e')]){delete _0x29ba1c[_0x7196('0x39')][_0x7196('0x3e')];}if(_0x182c8b[_0x7196('0x3e')][_0x7196('0x48')][_0x7196('0x49')]){return _0x182c8b[_0x7196('0x3e')][_0x7196('0x48')][0x0];}var _0x4940a2=_[_0x7196('0xb')](_0xed32cd[_0x7196('0x2b')],{'firstName':_0xed32cd[_0x7196('0x2b')]['from'],'ListId':_0x182c8b[_0x7196('0x32')]});_0x4940a2[_0xed32cd['body'][_0x7196('0x35')]]=_0xed32cd[_0x7196('0x2b')][_0x7196('0x34')];return db[_0x7196('0x3a')][_0x7196('0x4a')](_0x4940a2);}else{throw new Error('List\x20not\x20found');}})[_0x7196('0xf')](function(_0x5b77fc){_0x29ba1c['contact']=_0x5b77fc;if(_0x5b77fc){if(!_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x4b')]){_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4b')]=rs[_0x7196('0x4c')]()+'\x20'+_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x34')];}var _0x14dc43={'ContactId':_0x5b77fc['id'],'MailAccountId':_0xed32cd[_0x7196('0x39')]['id'],'inReplyTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['messageId'],'to':_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x34')],'cc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['cc'],'subject':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4d')],'attach':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'lastMsgAt':moment()[_0x7196('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x7196('0x50')][_0x7196('0x25')]({'where':{'closed':![],'MailAccountId':_0xed32cd[_0x7196('0x39')]['id']},'include':[{'model':db[_0x7196('0x51')],'as':'Messages','attributes':[_0x7196('0x4b')],'where':{'messageId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x52')]}}]})[_0x7196('0xf')](function(_0x3c3d64){if(_0x3c3d64){return[_0x3c3d64,![]];}return db[_0x7196('0x50')]['create'](_0x14dc43)[_0x7196('0xf')](function(_0x2c5cba){return[_0x2c5cba,!![]];});});}else{throw new Error(_0x7196('0x53'));}})[_0x7196('0x54')](function(_0x52827f,_0x418a7a){if(_0x52827f){_0x48178f=_0x418a7a;if(!_0x418a7a){return _0x52827f[_0x7196('0x55')]({'inReplyTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4b')],'to':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['from'],'cc':_0xed32cd['body']['message']['cc'],'subject':_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x4d')],'attach':_0x52827f[_0x7196('0x4e')]?_0x52827f[_0x7196('0x4e')]:_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'substatus':null,'substatusAt':moment()[_0x7196('0x4f')](_0x7196('0x56')),'lastMsgAt':moment()[_0x7196('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x52827f;}}})['then'](function(_0x4542c1){_0x29ba1c[_0x7196('0x57')]=_0x4542c1[_0x7196('0x3f')]({'plain':!![]});_0x29ba1c[_0x7196('0x57')][_0x7196('0x58')]=_0x48178f;return db[_0x7196('0x51')][_0x7196('0x4a')]({'body':_0xed32cd[_0x7196('0x2b')]['body'],'MailAccountId':_0xed32cd['account']['id'],'MailInteractionId':_0x4542c1['id'],'direction':'in','ContactId':_0x29ba1c[_0x7196('0x59')]['id'],'messageId':_0xed32cd['body'][_0x7196('0x17')]['messageId'],'from':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x34')],'to':_0xed32cd[_0x7196('0x2b')]['message']['to'],'cc':_0xed32cd['body'][_0x7196('0x17')]['cc'],'subject':_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x4d')],'attach':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'Attachments':_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x5a')],'originTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5b')],'originCc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5c')],'bcc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5d')],'ChatWebsiteId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['ChatWebsiteId']||null,'originChannel':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['originChannel']||'Email','ChatOfflineMessageId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x7196('0x5f')}]});})['then'](function(_0x218396){_0x29ba1c[_0x7196('0x17')]=_0x218396;if(_0x29ba1c['interaction'][_0x7196('0x60')]){return db['User']['find']({'attributes':['id',_0x7196('0x61')],'where':{'id':_0x29ba1c[_0x7196('0x57')][_0x7196('0x60')]}})['then'](function(_0x423b83){if(_0x423b83){_0x29ba1c['applications'][_0x7196('0x62')]({'id':0x0,'priority':0x0,'app':_0x7196('0x63'),'appdata':_0x423b83[_0x7196('0x61')]+','+(_0x29ba1c[_0x7196('0x39')][_0x7196('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7196('0x65'),_0x7196('0x66'),_0x29ba1c);});}return respondWithRpcPromise(_0x7196('0x65'),_0x7196('0x66'),_0x29ba1c);})[_0x7196('0xf')](function(_0x29bafd){_0x36a990(_0x29bafd);})[_0x7196('0x19')](function(_0x34633a){_0x2d13a5(_0x4c2341['error'](0x1f4,_0x34633a[_0x7196('0x17')]));});});}; \ No newline at end of file +var _0x896e=['createdAt','updatedAt','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','list','orderBy','asc','autoclose','applications','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','get','attachments','originTo','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','then','ShowMailAccount','find','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes'];(function(_0x1a2c4e,_0xf9b74){var _0x4938d8=function(_0x4df5d0){while(--_0x4df5d0){_0x1a2c4e['push'](_0x1a2c4e['shift']());}};_0x4938d8(++_0xf9b74);}(_0x896e,0x1e9));var _0xe896=function(_0x4d7d8f,_0x1c7223){_0x4d7d8f=_0x4d7d8f-0x0;var _0x358476=_0x896e[_0x4d7d8f];return _0x358476;};'use strict';var _=require(_0xe896('0x0'));var moment=require(_0xe896('0x1'));var BPromise=require(_0xe896('0x2'));var rs=require(_0xe896('0x3'));var Redis=require(_0xe896('0x4'));var db=require(_0xe896('0x5'))['db'];var logger=require(_0xe896('0x6'))(_0xe896('0x7'));var config=require(_0xe896('0x8'));var jayson=require(_0xe896('0x9'));var client=jayson[_0xe896('0xa')][_0xe896('0xb')]({'port':0x232c});config['redis']=_[_0xe896('0xc')](config[_0xe896('0xd')],{'host':_0xe896('0xe'),'port':0x18eb});var socket=require(_0xe896('0xf'))(new Redis(config[_0xe896('0xd')]));require('./mailAccount.socket')[_0xe896('0x10')](socket);function respondWithRpcPromise(_0x14b7e4,_0x37a90d,_0x4afd3f){return new BPromise(function(_0x305616,_0x48251e){return client[_0xe896('0x11')](_0x14b7e4,_0x4afd3f)['then'](function(_0x409eaf){logger[_0xe896('0x12')](_0xe896('0x13'),_0x37a90d,'request\x20sent');logger[_0xe896('0x14')](_0xe896('0x15'),_0x37a90d,_0xe896('0x16'),JSON['stringify'](_0x409eaf));if(_0x409eaf[_0xe896('0x17')]){if(_0x409eaf[_0xe896('0x17')][_0xe896('0x18')]===0x1f4){logger['error'](_0xe896('0x13'),_0x37a90d,_0x409eaf[_0xe896('0x17')][_0xe896('0x19')]);return _0x48251e(_0x409eaf['error']['message']);}logger[_0xe896('0x17')](_0xe896('0x13'),_0x37a90d,_0x409eaf['error']['message']);return _0x305616(_0x409eaf[_0xe896('0x17')][_0xe896('0x19')]);}else{logger['info'](_0xe896('0x13'),_0x37a90d,'request\x20sent');_0x305616(_0x409eaf[_0xe896('0x1a')][_0xe896('0x19')]);}})[_0xe896('0x1b')](function(_0x5dc89d){logger[_0xe896('0x17')](_0xe896('0x13'),_0x37a90d,_0x5dc89d);_0x48251e(_0x5dc89d);});});}exports[_0xe896('0x1c')]=function(_0xbebbe1){var _0x2693d6=this;return new Promise(function(_0x3ac8b8,_0x388c2e){return db[_0xe896('0x1d')]['findAll']({'raw':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1['options']['raw']===undefined?!![]:![]:!![],'where':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1[_0xe896('0x1e')][_0xe896('0x1f')]||null:null,'attributes':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1['options'][_0xe896('0x20')]||null:null,'limit':_0xbebbe1['options']?_0xbebbe1['options'][_0xe896('0x21')]||null:null,'include':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1[_0xe896('0x1e')][_0xe896('0x22')]?_[_0xe896('0x23')](_0xbebbe1[_0xe896('0x1e')][_0xe896('0x22')],function(_0x4b71cc){return{'model':db[_0x4b71cc[_0xe896('0x24')]],'as':_0x4b71cc['as'],'attributes':_0x4b71cc[_0xe896('0x20')],'include':_0x4b71cc[_0xe896('0x22')]?_['map'](_0x4b71cc[_0xe896('0x22')],function(_0xd50fe2){return{'model':db[_0xd50fe2[_0xe896('0x24')]],'as':_0xd50fe2['as'],'attributes':_0xd50fe2[_0xe896('0x20')],'include':_0xd50fe2[_0xe896('0x22')]?_[_0xe896('0x23')](_0xd50fe2['include'],function(_0x10adad){return{'model':db[_0x10adad[_0xe896('0x24')]],'as':_0x10adad['as'],'attributes':_0x10adad[_0xe896('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe896('0x25')](function(_0xace03f){logger['info']('GetMailAccount',_0xbebbe1);logger['debug']('GetMailAccount',_0xbebbe1,JSON['stringify'](_0xace03f));_0x3ac8b8(_0xace03f);})[_0xe896('0x1b')](function(_0x29a18e){logger[_0xe896('0x17')](_0xe896('0x1c'),_0x29a18e[_0xe896('0x19')],_0xbebbe1);_0x388c2e(_0x2693d6[_0xe896('0x17')](0x1f4,_0x29a18e[_0xe896('0x19')]));});});};exports[_0xe896('0x26')]=function(_0x4ab96b){var _0x4ce052=this;return new Promise(function(_0x142d29,_0x255dd1){return db[_0xe896('0x1d')][_0xe896('0x27')]({'raw':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')][_0xe896('0x1f')]||null:null,'attributes':_0x4ab96b[_0xe896('0x1e')]?_0x4ab96b['options']['attributes']||null:null,'include':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')][_0xe896('0x22')]?_[_0xe896('0x23')](_0x4ab96b[_0xe896('0x1e')][_0xe896('0x22')],function(_0x486eb5){return{'model':db[_0x486eb5[_0xe896('0x24')]],'as':_0x486eb5['as'],'attributes':_0x486eb5[_0xe896('0x20')],'include':_0x486eb5[_0xe896('0x22')]?_[_0xe896('0x23')](_0x486eb5[_0xe896('0x22')],function(_0x2cce09){return{'model':db[_0x2cce09[_0xe896('0x24')]],'as':_0x2cce09['as'],'attributes':_0x2cce09[_0xe896('0x20')],'include':_0x2cce09['include']?_[_0xe896('0x23')](_0x2cce09[_0xe896('0x22')],function(_0x5a2dd2){return{'model':db[_0x5a2dd2[_0xe896('0x24')]],'as':_0x5a2dd2['as'],'attributes':_0x5a2dd2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe896('0x25')](function(_0x4f164f){if(_0x4ab96b[_0xe896('0x1e')]['smtp']===!![])_0x4f164f[_0xe896('0x28')](_0xe896('0x29'),_0x4f164f[_0xe896('0x2a')]());logger[_0xe896('0x12')](_0xe896('0x26'),_0x4ab96b);logger['debug']('ShowMailAccount',_0x4ab96b,JSON[_0xe896('0x2b')](_0x4f164f));_0x142d29(_0x4f164f);})[_0xe896('0x1b')](function(_0x387cc6){logger[_0xe896('0x17')](_0xe896('0x26'),_0x387cc6['message'],_0x4ab96b);_0x255dd1(_0x4ce052['error'](0x1f4,_0x387cc6[_0xe896('0x19')]));});});};exports[_0xe896('0x2c')]=function(_0x5890b1){var _0x57e194=this;return new Promise(function(_0x19d2fd,_0x3b1de8){var _0x911adb={'body':_0x5890b1[_0xe896('0x2d')],'channel':_0xe896('0x2e')};var _0x41fa6f=_[_0xe896('0x2f')](_[_0xe896('0x30')](db[_0xe896('0x31')][_0xe896('0x32')]),[_0xe896('0x33'),_0xe896('0x34'),'CompanyId',_0xe896('0x35')]);var _0x143ad4=![];if(_0x5890b1['body']['id']){delete _0x5890b1['body']['id'];}if(_['isNil'](_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe896('0x37')](_0x5890b1[_0xe896('0x2d')]['body'])||_0x5890b1['body']['body']===''){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0xe896('0x38')));}if(_[_0xe896('0x37')](_0x5890b1[_0xe896('0x2d')][_0xe896('0x39')])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41fa6f));}if(!_[_0xe896('0x3a')](_0x41fa6f,_0x5890b1[_0xe896('0x2d')]['mapKey'])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0xe896('0x3b')+_0x41fa6f));}var _0x179fc2={};_0x179fc2[_0x5890b1[_0xe896('0x2d')]['mapKey']]=_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')];return db[_0xe896('0x1d')][_0xe896('0x27')]({'where':{'id':_0x5890b1[_0xe896('0x3c')]['id']},'include':[{'model':db[_0xe896('0x3d')],'as':'List','include':[{'model':db[_0xe896('0x31')],'as':'Contacts','where':_0x179fc2,'limit':0x1,'order':[[_0xe896('0x34'),_0xe896('0x3e')]]}]},{'model':db[_0xe896('0x3f')],'as':_0xe896('0x40')},{'model':db[_0xe896('0x41')],'as':_0xe896('0x42'),'include':[{'model':db['CloudProvider'],'as':_0xe896('0x43')}]}]})[_0xe896('0x25')](function(_0x4818cd){if(_0x4818cd&&_0x4818cd[_0xe896('0x44')]){var _0x355443=_0x4818cd['get']({'plain':!![]});_0x911adb[_0xe896('0x3c')]=_['omit'](_0x355443,[_0xe896('0x40'),_0xe896('0x44')]);_0x911adb[_0xe896('0x3c')][_0xe896('0x29')]=_0x4818cd[_0xe896('0x2a')]();_0x911adb['applications']=_0x355443[_0xe896('0x40')];_0x911adb[_0xe896('0x45')]=_0x355443[_0xe896('0x44')];_0x911adb['applications']=_[_0xe896('0x46')](_0x911adb['applications'],['priority'],[_0xe896('0x47')]);if(_0x911adb[_0xe896('0x3c')]&&_0x911adb['account'][_0xe896('0x48')]){_0x911adb[_0xe896('0x49')]['push']({'id':0x0,'priority':_0x911adb['applications'][_0xe896('0x4a')]+0x1,'app':_0xe896('0x4b'),'appdata':'autoclose','interval':_0xe896('0x4c')});}if(_0x911adb[_0xe896('0x3c')][_0xe896('0x40')]){delete _0x911adb[_0xe896('0x3c')][_0xe896('0x40')];}if(_0x911adb[_0xe896('0x3c')][_0xe896('0x44')]){delete _0x911adb[_0xe896('0x3c')][_0xe896('0x44')];}if(_0x355443[_0xe896('0x44')][_0xe896('0x4d')]['length']){return _0x355443[_0xe896('0x44')][_0xe896('0x4d')][0x0];}var _0x131c1c=_[_0xe896('0xc')](_0x5890b1[_0xe896('0x2d')],{'firstName':_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')],'ListId':_0x355443[_0xe896('0x35')]});_0x131c1c[_0x5890b1[_0xe896('0x2d')][_0xe896('0x39')]]=_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')];return db['CmContact'][_0xe896('0x4e')](_0x131c1c);}else{throw new Error(_0xe896('0x4f'));}})[_0xe896('0x25')](function(_0x5180b6){_0x911adb['contact']=_0x5180b6;if(_0x5180b6){if(!_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x50')]){_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['messageId']=rs[_0xe896('0x51')]()+'\x20'+_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x36')];}var _0x5d6c1c={'ContactId':_0x5180b6['id'],'MailAccountId':_0x5890b1[_0xe896('0x3c')]['id'],'inReplyTo':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x50')],'to':_0x5890b1[_0xe896('0x2d')]['message']['from'],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x52')],'attach':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x53')],'lastMsgAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x5890b1[_0xe896('0x3c')]['id']},'include':[{'model':db[_0xe896('0x56')],'as':'Messages','attributes':[_0xe896('0x50')],'where':{'messageId':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x57')]}}]})[_0xe896('0x25')](function(_0x3cc348){if(_0x3cc348){return[_0x3cc348,![]];}return db[_0xe896('0x58')][_0xe896('0x4e')](_0x5d6c1c)[_0xe896('0x25')](function(_0x117e92){return[_0x117e92,!![]];});});}else{throw new Error(_0xe896('0x59'));}})[_0xe896('0x5a')](function(_0xcb329a,_0x3248e6){if(_0xcb329a){_0x143ad4=_0x3248e6;if(!_0x3248e6){return _0xcb329a[_0xe896('0x5b')]({'inReplyTo':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x50')],'to':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x36')],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1[_0xe896('0x2d')]['message']['subject'],'attach':_0xcb329a[_0xe896('0x53')]?_0xcb329a[_0xe896('0x53')]:_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x53')],'substatus':null,'substatusAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgDirection':'in'});}else{return _0xcb329a;}}})[_0xe896('0x25')](function(_0x40e91d){_0x911adb[_0xe896('0x5c')]=_0x40e91d[_0xe896('0x5d')]({'plain':!![]});_0x911adb[_0xe896('0x5c')]['created']=_0x143ad4;return db[_0xe896('0x56')][_0xe896('0x4e')]({'body':_0x5890b1['body'][_0xe896('0x2d')],'MailAccountId':_0x5890b1['account']['id'],'MailInteractionId':_0x40e91d['id'],'direction':'in','ContactId':_0x911adb['contact']['id'],'messageId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['messageId'],'from':_0x5890b1['body'][_0xe896('0x19')]['from'],'to':_0x5890b1['body'][_0xe896('0x19')]['to'],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x52')],'attach':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x53')],'Attachments':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x5e')],'originTo':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x5f')],'originCc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['originCc'],'bcc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['bcc'],'ChatWebsiteId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x60')]||null,'originChannel':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x61')]||_0xe896('0x62'),'ChatOfflineMessageId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x63')]||null},{'include':[{'model':db[_0xe896('0x64')],'as':'Attachments'}]});})['then'](function(_0x48b523){_0x911adb[_0xe896('0x19')]=_0x48b523;if(_0x911adb[_0xe896('0x5c')][_0xe896('0x65')]){return db[_0xe896('0x66')][_0xe896('0x27')]({'attributes':['id',_0xe896('0x67')],'where':{'id':_0x911adb[_0xe896('0x5c')]['UserId']}})['then'](function(_0x4674ba){if(_0x4674ba){_0x911adb['applications'][_0xe896('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4674ba[_0xe896('0x67')]+','+(_0x911adb['account'][_0xe896('0x69')]||0xa),'interval':_0xe896('0x4c')});}return respondWithRpcPromise(_0xe896('0x6a'),_0xe896('0x6b'),_0x911adb);});}return respondWithRpcPromise(_0xe896('0x6a'),'startRouting',_0x911adb);})[_0xe896('0x25')](function(_0x35306d){_0x19d2fd(_0x35306d);})[_0xe896('0x1b')](function(_0x1bcfda){_0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0x1bcfda[_0xe896('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 75978c0..7dd90ab 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 _0x391f=['removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x327aaf,_0x235b02){var _0x597e3f=function(_0x409abd){while(--_0x409abd){_0x327aaf['push'](_0x327aaf['shift']());}};_0x597e3f(++_0x235b02);}(_0x391f,0x10c));var _0xf391=function(_0x4023a0,_0x67bd3){_0x4023a0=_0x4023a0-0x0;var _0x14d3e5=_0x391f[_0x4023a0];return _0x14d3e5;};'use strict';var MailAccountEvents=require(_0xf391('0x0'));var events=[_0xf391('0x1'),_0xf391('0x2'),_0xf391('0x3')];function createListener(_0x245cdf,_0x386c5b){return function(_0x1da1d9){_0x386c5b['emit'](_0x245cdf,_0x1da1d9);};}function removeListener(_0x3dc946,_0x145c4f){return function(){MailAccountEvents[_0xf391('0x4')](_0x3dc946,_0x145c4f);};}exports[_0xf391('0x5')]=function(_0x2c9be6){for(var _0x5885e7=0x0,_0x46eb7f=events[_0xf391('0x6')];_0x5885e7<_0x46eb7f;_0x5885e7++){var _0x25de03=events[_0x5885e7];var _0x202a8a=createListener(_0xf391('0x7')+_0x25de03,_0x2c9be6);MailAccountEvents['on'](_0x25de03,_0x202a8a);}}; \ No newline at end of file +var _0xf215=['update','emit','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x137d1d,_0x35c663){var _0x485108=function(_0x108a2a){while(--_0x108a2a){_0x137d1d['push'](_0x137d1d['shift']());}};_0x485108(++_0x35c663);}(_0xf215,0xec));var _0x5f21=function(_0x4c618e,_0x4b4c4f){_0x4c618e=_0x4c618e-0x0;var _0x2026cd=_0xf215[_0x4c618e];return _0x2026cd;};'use strict';var MailAccountEvents=require(_0x5f21('0x0'));var events=[_0x5f21('0x1'),'remove',_0x5f21('0x2')];function createListener(_0x3e489,_0x3490a7){return function(_0x592404){_0x3490a7[_0x5f21('0x3')](_0x3e489,_0x592404);};}function removeListener(_0x2326dd,_0x1e809b){return function(){MailAccountEvents[_0x5f21('0x4')](_0x2326dd,_0x1e809b);};}exports['register']=function(_0x5066a5){for(var _0x68b2bd=0x0,_0x76a890=events[_0x5f21('0x5')];_0x68b2bd<_0x76a890;_0x68b2bd++){var _0xb14013=events[_0x68b2bd];var _0x4a9f40=createListener(_0x5f21('0x6')+_0xb14013,_0x5066a5);MailAccountEvents['on'](_0xb14013,_0x4a9f40);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e99e342..ffd12c8 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 _0xe50e=['/:id','show','put','update','delete','isAuthenticated','destroy','exports','multer','path','express','fs-extra','../../config/environment','./mailApplication.controller'];(function(_0x39e1e5,_0xfe03b){var _0xa510a5=function(_0x179776){while(--_0x179776){_0x39e1e5['push'](_0x39e1e5['shift']());}};_0xa510a5(++_0xfe03b);}(_0xe50e,0x78));var _0xee50=function(_0x5d989f,_0x1868ba){_0x5d989f=_0x5d989f-0x0;var _0x3b5ac9=_0xe50e[_0x5d989f];return _0x3b5ac9;};'use strict';var multer=require(_0xee50('0x0'));var util=require('util');var path=require(_0xee50('0x1'));var timeout=require('connect-timeout');var express=require(_0xee50('0x2'));var router=express['Router']();var fs_extra=require(_0xee50('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee50('0x4'));var controller=require(_0xee50('0x5'));router['get'](_0xee50('0x6'),auth['isAuthenticated'](),controller[_0xee50('0x7')]);router[_0xee50('0x8')](_0xee50('0x6'),auth['isAuthenticated'](),controller[_0xee50('0x9')]);router[_0xee50('0xa')](_0xee50('0x6'),auth[_0xee50('0xb')](),controller[_0xee50('0xc')]);module[_0xee50('0xd')]=router; \ No newline at end of file +var _0xb906=['isAuthenticated','show','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id'];(function(_0x2da13f,_0x46c97d){var _0x2722be=function(_0xfe38dd){while(--_0xfe38dd){_0x2da13f['push'](_0x2da13f['shift']());}};_0x2722be(++_0x46c97d);}(_0xb906,0x186));var _0x6b90=function(_0x53058e,_0x577048){_0x53058e=_0x53058e-0x0;var _0x3293a5=_0xb906[_0x53058e];return _0x3293a5;};'use strict';var multer=require('multer');var util=require(_0x6b90('0x0'));var path=require('path');var timeout=require(_0x6b90('0x1'));var express=require(_0x6b90('0x2'));var router=express[_0x6b90('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b90('0x4'));var interaction=require(_0x6b90('0x5'));var config=require(_0x6b90('0x6'));var controller=require(_0x6b90('0x7'));router[_0x6b90('0x8')](_0x6b90('0x9'),auth[_0x6b90('0xa')](),controller[_0x6b90('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6b90('0xc')]);router[_0x6b90('0xd')](_0x6b90('0x9'),auth[_0x6b90('0xa')](),controller[_0x6b90('0xe')]);module[_0x6b90('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 5c9f92a..bb7a8bc 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 _0x29bb=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x29bb,0x1a4));var _0xb29b=function(_0x15df1b,_0x39ea33){_0x15df1b=_0x15df1b-0x0;var _0x3a3cfc=_0x29bb[_0x15df1b];return _0x3a3cfc;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb29b('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb29b('0x1')],'allowNull':![],'defaultValue':_0xb29b('0x2')},'appdata':{'type':Sequelize[_0xb29b('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb29b('0x1')],'defaultValue':_0xb29b('0x4')}}; \ No newline at end of file +var _0x44cc=['TEXT','STRING','*,*,*,*','INTEGER','noop'];(function(_0x1d23db,_0x48bbd0){var _0x10719b=function(_0x233ace){while(--_0x233ace){_0x1d23db['push'](_0x1d23db['shift']());}};_0x10719b(++_0x48bbd0);}(_0x44cc,0xda));var _0xc44c=function(_0x2cb2fb,_0xca9ad3){_0x2cb2fb=_0x2cb2fb-0x0;var _0x1df9ce=_0x44cc[_0x2cb2fb];return _0x1df9ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xc44c('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc44c('0x1')},'appdata':{'type':Sequelize[_0xc44c('0x2')]()},'description':{'type':Sequelize[_0xc44c('0x3')]},'interval':{'type':Sequelize[_0xc44c('0x3')],'defaultValue':_0xc44c('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b71355b..357d232 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x30c97c,_0x8d0ab4){var _0x294f66=function(_0x224067){while(--_0x224067){_0x30c97c['push'](_0x30c97c['shift']());}};_0x294f66(++_0x8d0ab4);}(_0xac4a,0x13f));var _0xaac4=function(_0x4cf45a,_0x88fb3b){_0x4cf45a=_0x4cf45a-0x0;var _0x1ec905=_0xac4a[_0x4cf45a];return _0x1ec905;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x51291d,_0x585080){var _0x3fb2fc=function(_0x2d61a7){while(--_0x2d61a7){_0x51291d['push'](_0x51291d['shift']());}};_0x3fb2fc(++_0x585080);}(_0xb43b,0x1b2));var _0xbb43=function(_0x40a296,_0x4a01dc){_0x40a296=_0x40a296-0x0;var _0x2fd131=_0xb43b[_0x40a296];return _0x2fd131;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e9650ee..e65d47e 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 _0xa477=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x2e8b52,_0x52796a){var _0x27c345=function(_0xcf1cb6){while(--_0xcf1cb6){_0x2e8b52['push'](_0x2e8b52['shift']());}};_0x27c345(++_0x52796a);}(_0xa477,0x177));var _0x7a47=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa477[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var logger=require('../../config/logger')(_0x7a47('0x2'));var moment=require('moment');var BPromise=require(_0x7a47('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a47('0x4'));var rimraf=require(_0x7a47('0x5'));var config=require(_0x7a47('0x6'));var attributes=require(_0x7a47('0x7'));module[_0x7a47('0x8')]=function(_0x1c34fb,_0x468541){return _0x1c34fb['define']('MailApplication',attributes,{'tableName':_0x7a47('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a47('0xa'),'collate':_0x7a47('0xb')});}; \ No newline at end of file +var _0x8142=['bluebird','request-promise','path','rimraf','../../config/environment','exports','MailApplication','utf8mb4','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8142,0x1e1));var _0x2814=function(_0x38a6c6,_0x4062ca){_0x38a6c6=_0x38a6c6-0x0;var _0x142f0a=_0x8142[_0x38a6c6];return _0x142f0a;};'use strict';var _=require(_0x2814('0x0'));var util=require(_0x2814('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2814('0x2'));var BPromise=require(_0x2814('0x3'));var rp=require(_0x2814('0x4'));var fs=require('fs');var path=require(_0x2814('0x5'));var rimraf=require(_0x2814('0x6'));var config=require(_0x2814('0x7'));var attributes=require('./mailApplication.attributes');module[_0x2814('0x8')]=function(_0x1c8b60,_0x49c560){return _0x1c8b60['define'](_0x2814('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2814('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 71a3348..2d486ab 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 _0xd6ed=['../../config/environment','jayson/promise','client','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','update','body','options','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xd6ed,0x1aa));var _0xdd6e=function(_0x2ecff8,_0x30e75e){_0x2ecff8=_0x2ecff8-0x0;var _0x1d434f=_0xd6ed[_0x2ecff8];return _0x1d434f;};'use strict';var _=require('lodash');var util=require(_0xdd6e('0x0'));var moment=require(_0xdd6e('0x1'));var BPromise=require(_0xdd6e('0x2'));var rs=require(_0xdd6e('0x3'));var fs=require('fs');var Redis=require(_0xdd6e('0x4'));var db=require(_0xdd6e('0x5'))['db'];var utils=require(_0xdd6e('0x6'));var logger=require(_0xdd6e('0x7'))(_0xdd6e('0x8'));var config=require(_0xdd6e('0x9'));var jayson=require(_0xdd6e('0xa'));var client=jayson[_0xdd6e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b77c8,_0x383586,_0x12ea94){return new BPromise(function(_0x24132e,_0x5ca057){return client['request'](_0x4b77c8,_0x12ea94)[_0xdd6e('0xc')](function(_0x4edc90){logger[_0xdd6e('0xd')](_0xdd6e('0xe'),_0x383586,_0xdd6e('0xf'));logger['debug'](_0xdd6e('0x10'),_0x383586,_0xdd6e('0xf'),JSON[_0xdd6e('0x11')](_0x4edc90));if(_0x4edc90[_0xdd6e('0x12')]){if(_0x4edc90['error']['code']===0x1f4){logger[_0xdd6e('0x12')]('MailApplication,\x20%s,\x20%s',_0x383586,_0x4edc90['error'][_0xdd6e('0x13')]);return _0x5ca057(_0x4edc90[_0xdd6e('0x12')][_0xdd6e('0x13')]);}logger[_0xdd6e('0x12')]('MailApplication,\x20%s,\x20%s',_0x383586,_0x4edc90[_0xdd6e('0x12')][_0xdd6e('0x13')]);return _0x24132e(_0x4edc90[_0xdd6e('0x12')][_0xdd6e('0x13')]);}else{logger[_0xdd6e('0xd')](_0xdd6e('0xe'),_0x383586,_0xdd6e('0xf'));_0x24132e(_0x4edc90[_0xdd6e('0x14')]['message']);}})[_0xdd6e('0x15')](function(_0x56909d){logger[_0xdd6e('0x12')](_0xdd6e('0xe'),_0x383586,_0x56909d);_0x5ca057(_0x56909d);});});}exports[_0xdd6e('0x16')]=function(_0x527c7b){var _0x341b68=this;return new Promise(function(_0x6bb629,_0x298c51){return db['MailApplication'][_0xdd6e('0x17')](_0x527c7b[_0xdd6e('0x18')],{'raw':_0x527c7b['options']?_0x527c7b[_0xdd6e('0x19')][_0xdd6e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x527c7b[_0xdd6e('0x19')]?_0x527c7b[_0xdd6e('0x19')]['where']||null:null,'attributes':_0x527c7b[_0xdd6e('0x19')]?_0x527c7b[_0xdd6e('0x19')][_0xdd6e('0x1b')]||null:null,'limit':_0x527c7b['options']?_0x527c7b[_0xdd6e('0x19')][_0xdd6e('0x1c')]||null:null})['then'](function(_0x459a0a){logger[_0xdd6e('0xd')](_0xdd6e('0x16'),_0x527c7b);logger['debug'](_0xdd6e('0x16'),_0x527c7b,JSON[_0xdd6e('0x11')](_0x459a0a));_0x6bb629(_0x459a0a);})[_0xdd6e('0x15')](function(_0xd14447){logger['error']('UpdateMailApplication',_0xd14447['message'],_0x527c7b);_0x298c51(_0x341b68[_0xdd6e('0x12')](0x1f4,_0xd14447[_0xdd6e('0x13')]));});});}; \ No newline at end of file +var _0x1d5d=['catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1d5d,0x19e));var _0xd1d5=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x1d5d[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xd1d5('0x0'));var util=require(_0xd1d5('0x1'));var moment=require('moment');var BPromise=require(_0xd1d5('0x2'));var rs=require(_0xd1d5('0x3'));var fs=require('fs');var Redis=require(_0xd1d5('0x4'));var db=require(_0xd1d5('0x5'))['db'];var utils=require(_0xd1d5('0x6'));var logger=require(_0xd1d5('0x7'))(_0xd1d5('0x8'));var config=require('../../config/environment');var jayson=require(_0xd1d5('0x9'));var client=jayson['client'][_0xd1d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c6747,_0x31adc3,_0x53fd31){return new BPromise(function(_0x5767db,_0x474672){return client['request'](_0x4c6747,_0x53fd31)[_0xd1d5('0xb')](function(_0xf1a7e3){logger['info'](_0xd1d5('0xc'),_0x31adc3,'request\x20sent');logger['debug'](_0xd1d5('0xd'),_0x31adc3,_0xd1d5('0xe'),JSON['stringify'](_0xf1a7e3));if(_0xf1a7e3[_0xd1d5('0xf')]){if(_0xf1a7e3[_0xd1d5('0xf')][_0xd1d5('0x10')]===0x1f4){logger['error'](_0xd1d5('0xc'),_0x31adc3,_0xf1a7e3[_0xd1d5('0xf')]['message']);return _0x474672(_0xf1a7e3[_0xd1d5('0xf')]['message']);}logger[_0xd1d5('0xf')](_0xd1d5('0xc'),_0x31adc3,_0xf1a7e3[_0xd1d5('0xf')][_0xd1d5('0x11')]);return _0x5767db(_0xf1a7e3[_0xd1d5('0xf')][_0xd1d5('0x11')]);}else{logger[_0xd1d5('0x12')](_0xd1d5('0xc'),_0x31adc3,'request\x20sent');_0x5767db(_0xf1a7e3[_0xd1d5('0x13')][_0xd1d5('0x11')]);}})[_0xd1d5('0x14')](function(_0x2e1b3b){logger[_0xd1d5('0xf')](_0xd1d5('0xc'),_0x31adc3,_0x2e1b3b);_0x474672(_0x2e1b3b);});});}exports[_0xd1d5('0x15')]=function(_0x368aee){var _0x2bb099=this;return new Promise(function(_0x334fff,_0x4fbf0e){return db[_0xd1d5('0x16')]['update'](_0x368aee[_0xd1d5('0x17')],{'raw':_0x368aee[_0xd1d5('0x18')]?_0x368aee[_0xd1d5('0x18')][_0xd1d5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x368aee[_0xd1d5('0x18')]?_0x368aee[_0xd1d5('0x18')][_0xd1d5('0x1a')]||null:null,'attributes':_0x368aee[_0xd1d5('0x18')]?_0x368aee[_0xd1d5('0x18')][_0xd1d5('0x1b')]||null:null,'limit':_0x368aee[_0xd1d5('0x18')]?_0x368aee[_0xd1d5('0x18')][_0xd1d5('0x1c')]||null:null})['then'](function(_0x5bfcf2){logger['info'](_0xd1d5('0x15'),_0x368aee);logger[_0xd1d5('0x1d')]('UpdateMailApplication',_0x368aee,JSON[_0xd1d5('0x1e')](_0x5bfcf2));_0x334fff(_0x5bfcf2);})[_0xd1d5('0x14')](function(_0x150ca2){logger[_0xd1d5('0xf')](_0xd1d5('0x15'),_0x150ca2[_0xd1d5('0x11')],_0x368aee);_0x4fbf0e(_0x2bb099['error'](0x1f4,_0x150ca2[_0xd1d5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a5fb544..91273a4 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 _0xc844=['exports','express','../../components/auth/service','./mailInteraction.controller','get','/describe','describe','/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','addMessage','addTags','put','tracked','mailinteraction:update','update','delete','mail','mailinteraction:destroy','destroy'];(function(_0x3e8d09,_0x5c8cd1){var _0x413bbc=function(_0x2c9f73){while(--_0x2c9f73){_0x3e8d09['push'](_0x3e8d09['shift']());}};_0x413bbc(++_0x5c8cd1);}(_0xc844,0x97));var _0x4c84=function(_0x5483cc,_0x495c42){_0x5483cc=_0x5483cc-0x0;var _0x53b9eb=_0xc844[_0x5483cc];return _0x53b9eb;};'use strict';var express=require(_0x4c84('0x0'));var router=express['Router']();var auth=require(_0x4c84('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x4c84('0x2'));router[_0x4c84('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4c84('0x4'),auth['isAuthenticated'](),controller[_0x4c84('0x5')]);router[_0x4c84('0x3')](_0x4c84('0x6'),auth['isAuthenticated'](),controller[_0x4c84('0x7')]);router[_0x4c84('0x3')](_0x4c84('0x8'),auth[_0x4c84('0x9')](),controller[_0x4c84('0xa')]);router[_0x4c84('0x3')](_0x4c84('0xb'),auth[_0x4c84('0x9')](),controller[_0x4c84('0xc')]);router[_0x4c84('0xd')]('/',auth[_0x4c84('0x9')](),controller['create']);router[_0x4c84('0xd')]('/:id/messages',auth[_0x4c84('0x9')](),controller[_0x4c84('0xe')]);router[_0x4c84('0xd')]('/:id/tags',auth[_0x4c84('0x9')](),interaction['tracked']('mail','mailinteraction:addtags'),controller[_0x4c84('0xf')]);router[_0x4c84('0x10')](_0x4c84('0x6'),auth[_0x4c84('0x9')](),interaction[_0x4c84('0x11')]('mail',_0x4c84('0x12')),controller[_0x4c84('0x13')]);router[_0x4c84('0x14')]('/:id',auth[_0x4c84('0x9')](),interaction[_0x4c84('0x11')](_0x4c84('0x15'),_0x4c84('0x16')),controller[_0x4c84('0x17')]);router[_0x4c84('0x14')]('/:id/tags',auth[_0x4c84('0x9')](),controller['removeTags']);module[_0x4c84('0x18')]=router; \ No newline at end of file +var _0x405f=['mailinteraction:destroy','destroy','delete','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','tracked'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0x405f,0x1c5));var _0xf405=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x405f[_0x7e2eb0];return _0xd92de4;};'use strict';var express=require(_0xf405('0x0'));var router=express['Router']();var auth=require(_0xf405('0x1'));var interaction=require(_0xf405('0x2'));var controller=require('./mailInteraction.controller');router[_0xf405('0x3')]('/',auth[_0xf405('0x4')](),controller[_0xf405('0x5')]);router[_0xf405('0x3')](_0xf405('0x6'),auth[_0xf405('0x4')](),controller['describe']);router[_0xf405('0x3')](_0xf405('0x7'),auth[_0xf405('0x4')](),controller[_0xf405('0x8')]);router['get'](_0xf405('0x9'),auth[_0xf405('0x4')](),controller[_0xf405('0xa')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf405('0xb')]);router['post']('/',auth[_0xf405('0x4')](),controller[_0xf405('0xc')]);router[_0xf405('0xd')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf405('0xe')]);router['post'](_0xf405('0xf'),auth[_0xf405('0x4')](),interaction['tracked']('mail',_0xf405('0x10')),controller[_0xf405('0x11')]);router[_0xf405('0x12')](_0xf405('0x7'),auth[_0xf405('0x4')](),interaction['tracked'](_0xf405('0x13'),_0xf405('0x14')),controller[_0xf405('0x15')]);router['delete'](_0xf405('0x7'),auth[_0xf405('0x4')](),interaction[_0xf405('0x16')](_0xf405('0x13'),_0xf405('0x17')),controller[_0xf405('0x18')]);router[_0xf405('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xf405('0x1a')]);module[_0xf405('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 b3b9d80..32b0dd6 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 _0x0cb4=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x0cb4,0x171));var _0x40cb=function(_0x5cf5fd,_0x4bca34){_0x5cf5fd=_0x5cf5fd-0x0;var _0x4a53ec=_0x0cb4[_0x5cf5fd];return _0x4a53ec;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x40cb('0x0'));module[_0x40cb('0x1')]={'closed':{'type':Sequelize[_0x40cb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x40cb('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x40cb('0x4')]},'thirdDisposition':{'type':Sequelize[_0x40cb('0x4')]},'note':{'type':Sequelize[_0x40cb('0x4')]},'inReplyTo':{'type':Sequelize[_0x40cb('0x4')](0x1fe)},'to':{'type':Sequelize[_0x40cb('0x4')]},'cc':{'type':Sequelize[_0x40cb('0x5')](_0x40cb('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x40cb('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x40cb('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x40cb('0x7')]('in',_0x40cb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x40cb('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x40cb('0x7')]('in',_0x40cb('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x40cb('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x88c6=['out','ENUM','sequelize','iconv','exports','DATE','STRING','TEXT','BOOLEAN'];(function(_0x8ffe3f,_0x5f4ed9){var _0x574cd4=function(_0x433d23){while(--_0x433d23){_0x8ffe3f['push'](_0x8ffe3f['shift']());}};_0x574cd4(++_0x5f4ed9);}(_0x88c6,0x18e));var _0x688c=function(_0x258d2a,_0x3a48f6){_0x258d2a=_0x258d2a-0x0;var _0x5d6ebe=_0x88c6[_0x258d2a];return _0x5d6ebe;};'use strict';var Sequelize=require(_0x688c('0x0'));var iconv=require(_0x688c('0x1'));module[_0x688c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x688c('0x3')]},'disposition':{'type':Sequelize[_0x688c('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x688c('0x4')](0x1fe)},'to':{'type':Sequelize[_0x688c('0x4')]},'cc':{'type':Sequelize[_0x688c('0x5')]('long')},'subject':{'type':Sequelize[_0x688c('0x5')]()},'attach':{'type':Sequelize[_0x688c('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x688c('0x3')]},'substatus':{'type':Sequelize[_0x688c('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x688c('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x688c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x688c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x688c('0x8')]('in',_0x688c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x688c('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 76f371f..2e9fa28 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 _0x57a9=['inlineCss','true','addTags','color','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','Messages','get','mkdirSync','each','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','util','lodash','juice','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','end','status','json','offset','limit','undefined','count','set','Content-Range','update','sendStatus','name','Users','map','fullname','TagIds','Tags','split','forEach','MailMessage','findOne','-id','lastMsgText','plainBody','catch','then','answered','unmanaged','closed','waiting','UserId','talking','total','index','MailInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$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?','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','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','MailAccountId','toString','sequelize','keyBy','fields','Account.key','a.mandatoryDisposition','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','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.email','Contact.email','Contact.phone','c.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','include','merge','options','create','body','params','destroy','describe','omit','ids','getMessages','format','includeAll','findAll'];(function(_0x405885,_0x402088){var _0x529708=function(_0x95f90f){while(--_0x95f90f){_0x405885['push'](_0x405885['shift']());}};_0x529708(++_0x402088);}(_0x57a9,0x1e9));var _0x957a=function(_0x45923b,_0x9284f8){_0x45923b=_0x45923b-0x0;var _0x337ee0=_0x57a9[_0x45923b];return _0x337ee0;};'use strict';var emlformat=require(_0x957a('0x0'));var rimraf=require(_0x957a('0x1'));var zipdir=require(_0x957a('0x2'));var moment=require(_0x957a('0x3'));var BPromise=require('bluebird');var util=require(_0x957a('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x957a('0x5'));var squel=require('squel');var juice=require(_0x957a('0x6'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x957a('0x7'))(_0x957a('0x8'));var config=require(_0x957a('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x957a('0xa')]=_[_0x957a('0xb')](config[_0x957a('0xa')],{'host':_0x957a('0xc'),'port':0x18eb});var socket=require(_0x957a('0xd'))(new Redis(config[_0x957a('0xa')]));require(_0x957a('0xe'))['register'](socket);function respondWithStatusCode(_0x32baf3,_0x286f78){_0x286f78=_0x286f78||0xcc;return function(_0x5aefa0){if(_0x5aefa0){return _0x32baf3['sendStatus'](_0x286f78);}return _0x32baf3['status'](_0x286f78)[_0x957a('0xf')]();};}function respondWithResult(_0x9dc41a,_0x4ab48a){_0x4ab48a=_0x4ab48a||0xc8;return function(_0x42fc56){if(_0x42fc56){return _0x9dc41a[_0x957a('0x10')](_0x4ab48a)[_0x957a('0x11')](_0x42fc56);}};}function respondWithFilteredResult(_0x3581c1,_0x5dde97){return function(_0x249261){if(_0x249261){var _0x19ec68=typeof _0x5dde97[_0x957a('0x12')]==='undefined'&&typeof _0x5dde97[_0x957a('0x13')]===_0x957a('0x14');var _0x2d2c82=_0x249261[_0x957a('0x15')];var _0x1b79d1=_0x19ec68?0x0:_0x5dde97[_0x957a('0x12')];var _0xb665e9=_0x19ec68?_0x249261['count']:_0x5dde97[_0x957a('0x12')]+_0x5dde97[_0x957a('0x13')];var _0x2bdd87;if(_0xb665e9>=_0x2d2c82){_0xb665e9=_0x2d2c82;_0x2bdd87=0xc8;}else{_0x2bdd87=0xce;}_0x3581c1[_0x957a('0x10')](_0x2bdd87);return _0x3581c1[_0x957a('0x16')](_0x957a('0x17'),_0x1b79d1+'-'+_0xb665e9+'/'+_0x2d2c82)[_0x957a('0x11')](_0x249261);}return null;};}function saveUpdates(_0x4428ac){return function(_0xa196f5){if(_0xa196f5){return _0xa196f5[_0x957a('0x18')](_0x4428ac)['then'](function(_0x139846){return _0x139846;});}return null;};}function removeEntity(_0x11d9ee){return function(_0x5e1bba){if(_0x5e1bba){return _0x5e1bba['destroy']()['then'](function(){_0x11d9ee[_0x957a('0x10')](0xcc)[_0x957a('0xf')]();});}};}function handleEntityNotFound(_0x2d3140){return function(_0x298934){if(!_0x298934){_0x2d3140[_0x957a('0x19')](0x194);}return _0x298934;};}function handleError(_0x247efd,_0x8d1a19){_0x8d1a19=_0x8d1a19||0x1f4;return function(_0x56e8f3){logger['error'](_0x56e8f3['stack']);if(_0x56e8f3[_0x957a('0x1a')]){delete _0x56e8f3[_0x957a('0x1a')];}_0x247efd['status'](_0x8d1a19)['send'](_0x56e8f3);};}function getInteractionUsers(_0x28e3d7,_0x30c68e){return new BPromise(function(_0x3886a4,_0x170d08){try{if(_0x30c68e[_0x28e3d7['id']]){_0x28e3d7[_0x957a('0x1b')]=_[_0x957a('0x1c')](_0x30c68e[_0x28e3d7['id']],function(_0xf0e240){return{'id':_0xf0e240['id'],'fullname':_0xf0e240[_0x957a('0x1d')]};});}}catch(_0x54ba44){_0x170d08(_0x54ba44);}_0x3886a4(_0x28e3d7);});}function getInteractionTags(_0x378340,_0x10562b){return new BPromise(function(_0x25c0c8,_0xad2c8b){try{if(_0x378340[_0x957a('0x1e')]){_0x378340[_0x957a('0x1f')]=[];_0x378340[_0x957a('0x1e')][_0x957a('0x20')](',')[_0x957a('0x21')](function(_0x3fbf6e){_0x378340[_0x957a('0x1f')]['push'](_0x10562b[_0x3fbf6e]);});}delete _0x378340[_0x957a('0x1e')];}catch(_0x431cb6){_0xad2c8b(_0x431cb6);}_0x25c0c8(_0x378340);});}function getLastMessageText(_0x2350d8){return new BPromise(function(_0x1dc476,_0x58666a){return db[_0x957a('0x22')][_0x957a('0x23')]({'where':{'$and':[{'MailInteractionId':_0x2350d8['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x957a('0x24'),'raw':!![]})['then'](function(_0x116d1f){if(_0x116d1f&&_0x116d1f['plainBody']){_0x2350d8[_0x957a('0x25')]=_['trimStart'](_0x116d1f[_0x957a('0x26')]);}_0x1dc476(_0x2350d8);})[_0x957a('0x27')](function(_0x297588){_0x58666a(_0x297588);});});}function updateMailInteraction(_0x5bf943,_0xc9acbb,_0x259d14,_0x46dcde){return new BPromise(function(_0x222aab,_0xf9b2a8){return getInteractionUsers(_0x5bf943,_0x259d14)[_0x957a('0x28')](function(_0x32af2c){return getInteractionTags(_0x32af2c,_0xc9acbb);})[_0x957a('0x28')](function(_0x30ae6e){return getStateInteraction(_0x30ae6e);})[_0x957a('0x28')](function(_0x26b315){if(_0x46dcde){_0x222aab(getLastMessageText(_0x26b315));}else{_0x222aab(_0x26b315);}})['catch'](function(_0x98e55f){_0xf9b2a8(_0x98e55f);});});}function getStateInteraction(_0x34692f){return new BPromise(function(_0x588154){_0x34692f['waiting']=0x0;_0x34692f['talking']=0x0;_0x34692f[_0x957a('0x29')]=0x0;_0x34692f[_0x957a('0x2a')]=0x0;_0x34692f['total']=0x0;if(!_0x34692f[_0x957a('0x2b')]&&!_0x34692f['UserId']){_0x34692f[_0x957a('0x2c')]+=0x1;}if(!_0x34692f[_0x957a('0x2b')]&&_0x34692f[_0x957a('0x2d')]){_0x34692f['talking']+=0x1;if(_0x34692f['waiting']){_0x34692f[_0x957a('0x2c')]-=0x1;}}if(_0x34692f[_0x957a('0x2b')]&&_0x34692f[_0x957a('0x2d')]){_0x34692f[_0x957a('0x29')]+=0x1;if(_0x34692f[_0x957a('0x2e')]){_0x34692f['talking']-=0x1;}}if(_0x34692f[_0x957a('0x2b')]&&!_0x34692f['UserId']){_0x34692f['unmanaged']+=0x1;if(_0x34692f[_0x957a('0x2c')]){_0x34692f[_0x957a('0x2c')]-=0x1;}}_0x34692f[_0x957a('0x2f')]+=0x1;_0x588154(_0x34692f);});}exports[_0x957a('0x30')]=function(_0x55a33a,_0x54c2dc){var _0x28fbde={},_0x370854={},_0x46c0fd={'count':0x0,'rows':[]};var _0x106938=_['map'](db[_0x957a('0x31')][_0x957a('0x32')],function(_0x1183c4){return{'name':_0x1183c4[_0x957a('0x33')],'type':_0x1183c4[_0x957a('0x34')][_0x957a('0x35')]};});_0x370854[_0x957a('0x36')]=_[_0x957a('0x1c')](_0x106938,_0x957a('0x1a'));_0x370854['query']=_[_0x957a('0x37')](_0x55a33a[_0x957a('0x38')]);_0x370854[_0x957a('0x39')]=_[_0x957a('0x3a')](_0x370854[_0x957a('0x36')],_0x370854[_0x957a('0x38')]);_0x28fbde[_0x957a('0x3b')]=_[_0x957a('0x3a')](_0x370854[_0x957a('0x36')],qs['fields'](_0x55a33a[_0x957a('0x38')]['fields']));_0x28fbde[_0x957a('0x3b')]=_0x28fbde['attributes']['length']?_0x28fbde[_0x957a('0x3b')]:_0x370854[_0x957a('0x36')];if(!_0x55a33a['query'][_0x957a('0x3c')](_0x957a('0x3d'))){_0x28fbde[_0x957a('0x13')]=qs[_0x957a('0x13')](_0x55a33a[_0x957a('0x38')]['limit']);_0x28fbde[_0x957a('0x12')]=qs[_0x957a('0x12')](_0x55a33a[_0x957a('0x38')]['offset']);}_0x28fbde[_0x957a('0x3e')]=qs['sort'](_0x55a33a['query'][_0x957a('0x3f')]);_0x28fbde[_0x957a('0x40')]=qs[_0x957a('0x39')](_[_0x957a('0x41')](_0x55a33a[_0x957a('0x38')],_0x370854[_0x957a('0x39')]),_0x106938);var _0x3804f2=[];var _0x53baf2=squel[_0x957a('0x42')]()[_0x957a('0x43')]('id')[_0x957a('0x43')](_0x957a('0x1a'))[_0x957a('0x43')]('color')[_0x957a('0x44')](_0x957a('0x45'));var _0x4ecf6f=squel[_0x957a('0x42')]()['field'](_0x957a('0x46'))[_0x957a('0x43')](_0x957a('0x47'))['field']('ui.MailInteractionId')[_0x957a('0x44')]('user_has_mail_interactions','ui')['left_join'](_0x957a('0x48'),'u',_0x957a('0x49'));var _0x28f550=squel[_0x957a('0x42')]()[_0x957a('0x44')](_0x957a('0x4a'),'i')['left_join'](_0x957a('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x957a('0x4c')]('users','o',_0x957a('0x4d'))[_0x957a('0x4c')](_0x957a('0x4e'),'a',_0x957a('0x4f'))[_0x957a('0x4c')](_0x957a('0x50'),'me',_0x957a('0x51'))[_0x957a('0x4c')](_0x957a('0x52'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x957a('0x45'),'t',_0x957a('0x53'));var _0x259e76=squel[_0x957a('0x54')]();var _0x3b0775=[];var _0x1791a2=squel[_0x957a('0x54')]();var _0x4c5e78;if(_0x55a33a[_0x957a('0x38')][_0x957a('0x55')]){_0x4c5e78=as[_0x957a('0x56')](_0x55a33a[_0x957a('0x38')][_0x957a('0x55')]);var _0x36f575=_0x4c5e78[_0x957a('0x57')];for(var _0x17c385=0x0;_0x17c385<_0x4c5e78[_0x957a('0x58')][_0x957a('0x59')];_0x17c385++){var _0x48c54b=_0x4c5e78[_0x957a('0x58')][_0x17c385];var _0x5304ef='i';var _0x32c8d7=_['find'](_0x106938,['name',_0x48c54b[_0x957a('0x43')]]);if(!_0x32c8d7){switch(_0x48c54b['field']){case _0x957a('0x5a'):if(_0x48c54b[_0x957a('0x5b')]==0x1){_0x28f550['having']('`'+_0x48c54b[_0x957a('0x43')]+_0x957a('0x5c'));}else{_0x28f550[_0x957a('0x5d')]('`'+_0x48c54b[_0x957a('0x43')]+'`\x20>\x200');}break;case _0x957a('0x5e'):if(_0x48c54b[_0x957a('0x5f')]==='$substring'){if(_0x48c54b[_0x957a('0x5b')][_0x957a('0x20')]('\x20')[_0x957a('0x59')]>0x1){_0x259e76[_0x36f575](_0x957a('0x60'),qs[_0x957a('0x61')](_0x48c54b[_0x957a('0x5b')]),null);}else{var _0x35b259='%'+_0x48c54b[_0x957a('0x5b')]+'%';_0x259e76[_0x36f575]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x35b259,_0x35b259,_0x35b259);}}else{_0x32c8d7=_[_0x957a('0x62')](_0x106938,[_0x957a('0x1a'),_0x957a('0x63')]);_0x48c54b[_0x957a('0x43')]=_0x957a('0x63');_0x236183=as[_0x957a('0x64')](_0x5304ef,_0x32c8d7[_0x957a('0x34')],_0x48c54b);_0x259e76[_0x36f575](_0x236183[_0x957a('0x65')],_0x236183[_0x957a('0x5b')][_0x957a('0x66')],_0x236183[_0x957a('0x5b')][_0x957a('0xf')]);}break;case _0x957a('0x67'):var _0x52a420=_0x48c54b[_0x957a('0x5b')][_0x957a('0x20')](',')[_0x957a('0x1c')](function(_0x159e50){return Number(_0x159e50);});_0x52a420[_0x957a('0x21')](function(_0x4f8e29){_0x1791a2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f8e29+',%');});_0x3b0775=_['union'](_0x3b0775,_0x52a420);break;case _0x957a('0x68'):if(_0x48c54b[_0x957a('0x5f')]==='$substring'){_0x259e76[_0x36f575](_0x957a('0x69'),'%'+_0x48c54b[_0x957a('0x5b')]+'%',null);}else{_0x32c8d7=_['find'](_0x106938,['name','UserId']);_0x48c54b['field']=_0x957a('0x2d');_0x236183=as[_0x957a('0x64')](_0x5304ef,_0x32c8d7[_0x957a('0x34')],_0x48c54b);_0x259e76[_0x36f575](_0x236183['text'],_0x236183[_0x957a('0x5b')][_0x957a('0x66')],_0x236183[_0x957a('0x5b')][_0x957a('0xf')]);}break;case'plainBody':_0x236183=as['buildExpression']('me',null,_0x48c54b);_0x259e76[_0x36f575](_0x236183[_0x957a('0x65')],_0x236183[_0x957a('0x5b')][_0x957a('0x66')],_0x236183[_0x957a('0x5b')][_0x957a('0xf')]);break;}}else{var _0x236183=as[_0x957a('0x64')](_0x5304ef,_0x32c8d7[_0x957a('0x34')],_0x48c54b);_0x259e76[_0x36f575](_0x236183[_0x957a('0x65')],_0x236183[_0x957a('0x5b')][_0x957a('0x66')],_0x236183[_0x957a('0x5b')][_0x957a('0xf')]);}}}else{var _0x13e02b=_(_0x55a33a[_0x957a('0x38')])[_0x957a('0x37')]()[_0x957a('0x1c')](function(_0x5256e2){return _[_0x957a('0x6a')](_0x106938,[_0x957a('0x1a'),_0x5256e2])?_0x5256e2:undefined;})[_0x957a('0x6b')]()[_0x957a('0x5b')]();if(!_[_0x957a('0x6c')](_0x13e02b)){_0x13e02b[_0x957a('0x21')](function(_0x46c028){if(_0x46c028==='MailAccountId'){_0x28f550[_0x957a('0x40')](_0x957a('0x6d'),[][_0x957a('0x6e')](_0x55a33a['query'][_0x46c028]));}else if(_0x46c028==='createdAt'){var _0x27203a=JSON[_0x957a('0x6f')](_0x55a33a['query'][_0x46c028])[_0x957a('0x70')];var _0x49d1a0=JSON[_0x957a('0x6f')](_0x55a33a[_0x957a('0x38')][_0x46c028])[_0x957a('0x71')];_0x28f550['where'](_0x957a('0x72'),_0x27203a,_0x49d1a0);}else{if(_0x55a33a['query'][_0x46c028]===_0x957a('0x73')){_0x28f550[_0x957a('0x40')]('i.'+_0x46c028+_0x957a('0x74'));}else{_0x28f550[_0x957a('0x40')]('i.'+_0x46c028+_0x957a('0x75'),_0x55a33a[_0x957a('0x38')][_0x46c028]);}}});}if(_0x55a33a[_0x957a('0x38')][_0x957a('0x76')]){if(_0x55a33a['query'][_0x957a('0x76')]==0x1){_0x28f550[_0x957a('0x5d')](_0x957a('0x77'));}else{_0x28f550['having']('`unreadMessages`\x20>\x200');}}if(_0x55a33a['query'][_0x957a('0x78')]){_0x3b0775=_[_0x957a('0x79')](_0x55a33a[_0x957a('0x38')][_0x957a('0x78')])?_0x55a33a[_0x957a('0x38')][_0x957a('0x78')]:new Array(_0x55a33a[_0x957a('0x38')][_0x957a('0x78')]);_0x3b0775[_0x957a('0x21')](function(_0x14ade9){_0x1791a2['or'](_0x957a('0x7a'),'%,'+_0x14ade9+',%');});}if(_0x55a33a[_0x957a('0x38')][_0x957a('0x7b')]){var _0x36a917=_0x55a33a['query'][_0x957a('0x7b')][_0x957a('0x7c')]('\x5c','\x5c\x5c')[_0x957a('0x7c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x36a917)){_0x259e76['or'](_0x957a('0x7d'),_0x36a917+'%');}else if(qs['isEmail'](_0x36a917)){_0x259e76['or'](_0x957a('0x7e'),_0x36a917+'%');}else{_0x259e76['or'](_0x957a('0x7f'),qs[_0x957a('0x61')](_0x36a917))['or'](_0x957a('0x80'),qs['getFullTextValue'](_0x36a917));}}}_0x28f550[_0x957a('0x40')](_0x259e76);_0x28f550[_0x957a('0x81')]('i.id');var _0x1f9edd={'type':db[_0x957a('0x82')][_0x957a('0x83')][_0x957a('0x84')],'raw':!![]};var _0xb2859c=_0x28f550[_0x957a('0x85')]();_0xb2859c[_0x957a('0x43')](_0x957a('0x86'));_0xb2859c[_0x957a('0x43')](_0x957a('0x87'),_0x957a('0x5a'));if(_0x28fbde['order']){_0x28fbde[_0x957a('0x3e')][_0x957a('0x21')](function(_0x58178e){var _0xebdcb5=_0x58178e[0x0]===_0x957a('0x88')?_0x58178e[0x0]:'i.'+_0x58178e[0x0];_0x28f550['order'](_0xebdcb5,_0x58178e[0x1]===_0x957a('0x89')?![]:!![]);});}if(!_[_0x957a('0x6c')](_0x3b0775)){_0x28f550[_0x957a('0x5d')](_0x1791a2);_0xb2859c['where']('t.id\x20IN\x20?',_0x3b0775);}BPromise[_0x957a('0x8a')]()[_0x957a('0x28')](function(){if(!_0x4c5e78){if(_0x55a33a['query']['MailAccountId'])return;_0xb2859c['where'](_0x957a('0x8b'));_0x28f550['where'](_0x957a('0x8b'));return;}if(_0x55a33a[_0x957a('0x8c')][_0x957a('0x8d')]!=='agent')return;return _0x55a33a[_0x957a('0x8c')][_0x957a('0x8e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x54bb7d){if(_[_0x957a('0x6c')](_0x54bb7d)){_0xb2859c[_0x957a('0x40')](_0x957a('0x8f'));_0x28f550[_0x957a('0x40')]('i.MailAccountId\x20IS\x20NULL');}else{_0xb2859c[_0x957a('0x40')](_0x957a('0x6d'),_['map'](_0x54bb7d,'id'));_0x28f550['where']('i.MailAccountId\x20IN\x20?',_['map'](_0x54bb7d,'id'));}});})[_0x957a('0x28')](function(){if(_0x55a33a['user'][_0x957a('0x8d')]===_0x957a('0x90')&&!_0x4c5e78&&!_0x55a33a[_0x957a('0x38')][_0x957a('0x91')])return[];return db['sequelize'][_0x957a('0x38')](_0xb2859c[_0x957a('0x92')](),_0x1f9edd);})[_0x957a('0x28')](function(_0x953b92){_0x46c0fd['count']=_0x953b92[_0x957a('0x59')];if(_0x46c0fd[_0x957a('0x15')]===0x0)return[];return db[_0x957a('0x93')][_0x957a('0x38')](_0x53baf2[_0x957a('0x92')](),_0x1f9edd)['then'](function(_0x2de5cb){_0x3804f2=_[_0x957a('0x94')](_0x2de5cb,'id');_0x1f9edd=_['merge'](_0x1f9edd,{'model':db[_0x957a('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x55a33a[_0x957a('0x38')][_0x957a('0x95')]){_0x28fbde[_0x957a('0x3b')][_0x957a('0x21')](function(_0x27c9b6){_0x28f550['field']('i.'+_0x27c9b6);});}else{_0x28f550[_0x957a('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x957a('0x5a'));_0x28f550[_0x957a('0x43')]('a.key',_0x957a('0x96'));_0x28f550[_0x957a('0x43')](_0x957a('0x97'),'Account.mandatoryDisposition');_0x28f550[_0x957a('0x43')]('a.email',_0x957a('0x98'));_0x28f550[_0x957a('0x43')](_0x957a('0x99'),_0x957a('0x88'));_0x28f550[_0x957a('0x43')]('i.id');_0x28f550['field']('i.createdAt');_0x28f550['field'](_0x957a('0x9a'));_0x28f550[_0x957a('0x43')](_0x957a('0x9b'));_0x28f550[_0x957a('0x43')](_0x957a('0x9c'));_0x28f550['field'](_0x957a('0x9d'));_0x28f550[_0x957a('0x43')](_0x957a('0x9e'));_0x28f550[_0x957a('0x43')]('i.lastMsgDirection');_0x28f550[_0x957a('0x43')](_0x957a('0x9f'));_0x28f550[_0x957a('0x43')](_0x957a('0xa0'));_0x28f550[_0x957a('0x43')](_0x957a('0xa1'));_0x28f550[_0x957a('0x43')](_0x957a('0xa2'));_0x28f550[_0x957a('0x43')](_0x957a('0xa3'));_0x28f550['field']('i.to');_0x28f550[_0x957a('0x43')]('i.ContactId');_0x28f550[_0x957a('0x43')](_0x957a('0xa4'));_0x28f550['field'](_0x957a('0xa5'));_0x28f550[_0x957a('0x43')](_0x957a('0xa6'),_0x957a('0xa7'));_0x28f550[_0x957a('0x43')]('c.lastName','Contact.lastName');_0x28f550[_0x957a('0x43')](_0x957a('0xa8'),_0x957a('0xa9'));_0x28f550[_0x957a('0x43')]('c.phone',_0x957a('0xaa'));_0x28f550[_0x957a('0x43')](_0x957a('0xab'),'Contact.mobile');_0x28f550['field']('c.fax','Contact.fax');_0x28f550[_0x957a('0x43')]('o.fullname',_0x957a('0xac'));_0x28f550[_0x957a('0x43')]('o.internal',_0x957a('0xad'));_0x28f550['field'](_0x957a('0xae'),_0x957a('0x1e'));}if(_0x28fbde['limit'])_0x28f550['limit'](_0x28fbde['limit']);if(_0x28fbde[_0x957a('0x12')])_0x28f550[_0x957a('0x12')](_0x28fbde[_0x957a('0x12')]);return db[_0x957a('0x93')][_0x957a('0x38')](_0x28f550[_0x957a('0x92')](),_0x1f9edd);})['then'](function(_0x417c24){if(_0x417c24[_0x957a('0x59')]>0x0)_0x4ecf6f[_0x957a('0x40')](_0x957a('0xaf'),_[_0x957a('0x1c')](_0x417c24,'id'));return db['sequelize'][_0x957a('0x38')](_0x4ecf6f[_0x957a('0x92')](),_0x1f9edd)[_0x957a('0x28')](function(_0x24b71d){var _0xf34acc=_[_0x957a('0xb0')](_0x24b71d,_0x957a('0xb1'));var _0x42c131=[];return db[_0x957a('0xb2')][_0x957a('0x23')]({'attributes':[_0x957a('0xb3')],'raw':!![]})[_0x957a('0x28')](function(_0x420ecd){var _0x29bfad=_0x420ecd[_0x957a('0xb3')];_0x417c24['forEach'](function(_0x1716bd){_0x42c131[_0x957a('0xb4')](updateMailInteraction(_0x1716bd,_0x3804f2,_0xf34acc,_0x29bfad));});return BPromise[_0x957a('0xb5')](_0x42c131);});});});})['then'](function(_0x1168c8){_0x46c0fd[_0x957a('0xb6')]=_0x1168c8;return _0x46c0fd;})[_0x957a('0x28')](respondWithFilteredResult(_0x54c2dc,_0x28fbde))['catch'](handleError(_0x54c2dc,null));};exports[_0x957a('0xb7')]=function(_0x1dfb55,_0x1cdae2){var _0x123868={'raw':![],'where':{'id':_0x1dfb55['params']['id']}},_0xa89c78={};_0xa89c78['model']=_[_0x957a('0x37')](db[_0x957a('0x31')]['rawAttributes']);_0xa89c78[_0x957a('0x38')]=_[_0x957a('0x37')](_0x1dfb55[_0x957a('0x38')]);_0xa89c78[_0x957a('0x39')]=_['intersection'](_0xa89c78[_0x957a('0x36')],_0xa89c78[_0x957a('0x38')]);_0x123868['attributes']=_['intersection'](_0xa89c78[_0x957a('0x36')],qs[_0x957a('0x95')](_0x1dfb55['query']['fields']));_0x123868[_0x957a('0x3b')]=_0x123868['attributes'][_0x957a('0x59')]?_0x123868['attributes']:_0xa89c78[_0x957a('0x36')];if(_0x1dfb55['query']['includeAll']){_0x123868[_0x957a('0xb8')]=[{'all':!![]}];}_0x123868=_[_0x957a('0xb9')]({},_0x123868,_0x1dfb55[_0x957a('0xba')]);return db[_0x957a('0x31')][_0x957a('0x62')](_0x123868)[_0x957a('0x28')](handleEntityNotFound(_0x1cdae2,null))[_0x957a('0x28')](respondWithResult(_0x1cdae2,null))[_0x957a('0x27')](handleError(_0x1cdae2,null));};exports['create']=function(_0x36afc9,_0x4dd43c){return db[_0x957a('0x31')][_0x957a('0xbb')](_0x36afc9[_0x957a('0xbc')],{})[_0x957a('0x28')](respondWithResult(_0x4dd43c,0xc9))[_0x957a('0x27')](handleError(_0x4dd43c,null));};exports[_0x957a('0x18')]=function(_0x4a5458,_0x313df1){if(_0x4a5458['body']['id']){delete _0x4a5458['body']['id'];}return db['MailInteraction'][_0x957a('0x62')]({'where':{'id':_0x4a5458[_0x957a('0xbd')]['id']}})[_0x957a('0x28')](handleEntityNotFound(_0x313df1,null))['then'](saveUpdates(_0x4a5458[_0x957a('0xbc')],null))['then'](respondWithResult(_0x313df1,null))[_0x957a('0x27')](handleError(_0x313df1,null));};exports[_0x957a('0xbe')]=function(_0x35ce3b,_0x3b9f3d){return db[_0x957a('0x31')]['find']({'where':{'id':_0x35ce3b[_0x957a('0xbd')]['id']}})[_0x957a('0x28')](handleEntityNotFound(_0x3b9f3d,null))[_0x957a('0x28')](removeEntity(_0x3b9f3d,null))[_0x957a('0x27')](handleError(_0x3b9f3d,null));};exports[_0x957a('0xbf')]=function(_0x1df61b,_0x183ed7){return db[_0x957a('0x31')][_0x957a('0xbf')]()[_0x957a('0x28')](respondWithResult(_0x183ed7,null))[_0x957a('0x27')](handleError(_0x183ed7,null));};exports['addMessage']=function(_0x39fc52,_0x52bfbd){return db[_0x957a('0x22')][_0x957a('0x62')]({'where':{'id':_0x39fc52[_0x957a('0xbd')]['id']}})[_0x957a('0x28')](handleEntityNotFound(_0x52bfbd,null))[_0x957a('0x28')](function(_0x45ab9d){if(_0x45ab9d){return _0x45ab9d['addMessage'](_0x39fc52[_0x957a('0xbc')]['ids'],_[_0x957a('0xc0')](_0x39fc52[_0x957a('0xbc')],[_0x957a('0xc1'),'id'])||{});}})[_0x957a('0x28')](respondWithResult(_0x52bfbd,null))[_0x957a('0x27')](handleError(_0x52bfbd,null));};exports[_0x957a('0xc2')]=function(_0x465911,_0x2a0958){var _0x139063={'raw':![],'where':{}};var _0x2beb9d={};var _0x59961a={'count':0x0,'rows':[]};return db[_0x957a('0x31')][_0x957a('0x23')]({'where':{'id':_0x465911['params']['id']}})[_0x957a('0x28')](handleEntityNotFound(_0x2a0958,null))[_0x957a('0x28')](function(_0x44d369){if(_0x44d369){_0x2beb9d[_0x957a('0x36')]=_[_0x957a('0x37')](db[_0x957a('0x22')][_0x957a('0x32')]);_0x2beb9d[_0x957a('0x38')]=_[_0x957a('0x37')](_0x465911['query']);_0x2beb9d[_0x957a('0x39')]=_[_0x957a('0x3a')](_0x2beb9d[_0x957a('0x36')],_0x2beb9d[_0x957a('0x38')]);_0x139063[_0x957a('0x3b')]=_[_0x957a('0x3a')](_0x2beb9d[_0x957a('0x36')],qs['fields'](_0x465911[_0x957a('0x38')][_0x957a('0x95')]));_0x139063[_0x957a('0x3b')]=_0x139063[_0x957a('0x3b')][_0x957a('0x59')]?_0x139063[_0x957a('0x3b')]:_0x2beb9d['model'];if(!_0x465911['query'][_0x957a('0x3c')]('nolimit')){_0x139063[_0x957a('0x13')]=qs[_0x957a('0x13')](_0x465911['query'][_0x957a('0x13')]);_0x139063[_0x957a('0x12')]=qs[_0x957a('0x12')](_0x465911[_0x957a('0x38')][_0x957a('0x12')]);}_0x139063[_0x957a('0x3e')]=qs[_0x957a('0x3f')](_0x465911[_0x957a('0x38')][_0x957a('0x3f')]);_0x139063[_0x957a('0x40')]=qs[_0x957a('0x39')](_['pick'](_0x465911['query'],_0x2beb9d[_0x957a('0x39')]));_0x139063[_0x957a('0x40')][_0x957a('0xb1')]=_0x44d369['id'];if(_0x465911['query']['filter']){_0x139063[_0x957a('0x40')]=_[_0x957a('0xb9')](_0x139063[_0x957a('0x40')],{'$or':_['map'](_0x139063[_0x957a('0x3b')],function(_0x318cde){var _0x2ae57b={};_0x2ae57b[_0x318cde]={'$like':'%'+_0x465911[_0x957a('0x38')][_0x957a('0x7b')]+'%'};return _0x2ae57b;})});}if(_0x465911[_0x957a('0x38')]['$gte']){var _0x52cdfc=_0x465911[_0x957a('0x38')]['$gte'][_0x957a('0x20')](',');var _0x4b920a={};_0x4b920a[_0x52cdfc[0x0]]={'$gte':moment(_0x52cdfc[0x1])[_0x957a('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x139063[_0x957a('0x40')]=_['merge'](_0x139063['where'],_0x4b920a);}_0x139063=_[_0x957a('0xb9')]({},_0x139063,_0x465911['options']);return db[_0x957a('0x22')][_0x957a('0x15')]({'where':_0x139063['where']})['then'](function(_0x4b27d5){_0x59961a['count']=_0x4b27d5;if(_0x465911['query'][_0x957a('0xc4')]){_0x139063[_0x957a('0xb8')]=[{'all':!![]}];}return db['MailMessage'][_0x957a('0xc5')](_0x139063);})[_0x957a('0x28')](function(_0xd53a96){if(_0x465911['query'][_0x957a('0xc6')]===_0x957a('0xc7')){for(var _0x21d8ad=0x0;_0x21d8ad<_0xd53a96[_0x957a('0x59')];_0x21d8ad++){_0xd53a96[_0x21d8ad][_0x957a('0xbc')]=juice(_0xd53a96[_0x21d8ad]['body']);}}_0x59961a[_0x957a('0xb6')]=_0xd53a96;return _0x59961a;});}})['then'](respondWithFilteredResult(_0x2a0958,_0x139063))['catch'](handleError(_0x2a0958,null));};exports[_0x957a('0xc8')]=function(_0x508f33,_0x3aee1e){return db[_0x957a('0x31')][_0x957a('0x62')]({'where':{'id':_0x508f33[_0x957a('0xbd')]['id']}})[_0x957a('0x28')](handleEntityNotFound(_0x3aee1e,null))[_0x957a('0x28')](function(_0x1d7df3){if(_0x1d7df3){return _0x1d7df3['setTags'](_0x508f33['body'][_0x957a('0xc1')],_['omit'](_0x508f33['body'],[_0x957a('0xc1'),'id'])||{})['spread'](function(){return db[_0x957a('0x67')][_0x957a('0xc5')]({'attributes':['id',_0x957a('0x1a'),_0x957a('0xc9')],'where':{'id':_0x508f33[_0x957a('0xbc')]['ids']}});})[_0x957a('0x28')](function(_0x2f470f){socket['emit'](_0x957a('0xca'),{'id':Number(_0x508f33[_0x957a('0xbd')]['id']),'tags':_0x2f470f||[]});return{'id':Number(_0x508f33[_0x957a('0xbd')]['id']),'tags':_0x2f470f||[]};});}})[_0x957a('0x28')](respondWithResult(_0x3aee1e,null))[_0x957a('0x27')](handleError(_0x3aee1e,null));};exports[_0x957a('0xcb')]=function(_0x191425,_0x1480ef){return db[_0x957a('0x31')]['find']({'where':{'id':_0x191425[_0x957a('0xbd')]['id']}})[_0x957a('0x28')](handleEntityNotFound(_0x1480ef,null))[_0x957a('0x28')](function(_0x28b634){if(_0x28b634){return _0x28b634['removeTags'](_0x191425[_0x957a('0x38')][_0x957a('0xc1')]);}})[_0x957a('0x28')](respondWithStatusCode(_0x1480ef,null))['catch'](handleError(_0x1480ef,null));};exports[_0x957a('0xcc')]=function(_0x405917,_0x40e3d6){var _0x503871=moment()[_0x957a('0xcd')]()[_0x957a('0x92')]();var _0x3585e6=path[_0x957a('0xce')](config[_0x957a('0xcf')],_0x957a('0xd0'),_0x957a('0xd1'),_0x957a('0xd2'));var _0x403261=path['join'](config[_0x957a('0xcf')],_0x957a('0xd0'),_0x957a('0xd1'),_0x957a('0xd3'));var _0x35bf38=path[_0x957a('0xce')](_0x3585e6,_0x503871);var _0x2f9c73=util[_0x957a('0xc3')](_0x957a('0xd4'),_0x405917[_0x957a('0xbd')]['id'],_0x503871);var _0xe72a31=path[_0x957a('0xce')](_0x3585e6,_0x2f9c73);var _0x23f722=[];if(_0x405917[_0x957a('0x38')][_0x957a('0xd3')]){_0x23f722[_0x957a('0xb4')]({'model':db[_0x957a('0xd5')],'as':_0x957a('0xd6'),'raw':!![]});}var _0x465255=[{'model':db[_0x957a('0x22')],'as':'Messages','attributes':['id',_0x957a('0xbc'),'from','to','cc',_0x957a('0xd7'),_0x957a('0xd8'),'createdAt'],'where':{'secret':![]},'order':qs[_0x957a('0x3f')]('id'),'include':_0x23f722}];return db[_0x957a('0x31')][_0x957a('0x62')]({'where':{'id':_0x405917[_0x957a('0xbd')]['id']},'include':_0x465255})[_0x957a('0x28')](handleEntityNotFound(_0x40e3d6,null))[_0x957a('0x28')](function(_0x18f50d){if(_0x18f50d&&_0x18f50d[_0x957a('0xd9')]){var _0x240e75=_0x18f50d[_0x957a('0xda')]({'plain':!![]});fs[_0x957a('0xdb')](_0x35bf38);return BPromise[_0x957a('0xdc')](_0x240e75[_0x957a('0xd9')],function(_0x5f5e07,_0x534280){var _0x569e43={'from':_0x5f5e07[_0x957a('0x44')],'to':_0x5f5e07['to'],'subject':_0x5f5e07[_0x957a('0xd8')],'html':htmlEntities[_0x957a('0xdd')](_0x5f5e07['body']),'headers':{'Date':moment(_0x5f5e07[_0x957a('0xde')])[_0x957a('0xc3')](_0x957a('0xdf'))},'attachments':[]};if(_0x5f5e07['cc']){_0x569e43[_0x957a('0xe0')]['Cc']=_0x5f5e07['cc'];}if(_0x5f5e07[_0x957a('0xd7')]){_0x569e43[_0x957a('0xe0')]['Bcc']=_0x5f5e07['bcc'];}return new BPromise(function(_0x243294,_0x4a0818){if(_0x5f5e07[_0x957a('0xd6')]){for(var _0x4961af=0x0;_0x4961af<_0x5f5e07['Attachments'][_0x957a('0x59')];_0x4961af++){var _0x49f8c5=_0x5f5e07['Attachments'][_0x4961af];var _0x2a3240=path[_0x957a('0xce')](_0x403261,_0x49f8c5['basename']);if(fs[_0x957a('0xe1')](_0x2a3240)){_0x569e43[_0x957a('0xd3')]['push']({'name':_0x49f8c5[_0x957a('0x1a')],'contentType':_0x49f8c5[_0x957a('0x34')],'data':fs[_0x957a('0xe2')](_0x2a3240)});}}}emlformat[_0x957a('0xe3')](_0x569e43,function(_0x179299,_0x2664cf){if(_0x179299)return _0x4a0818(_0x179299);fs['writeFileSync'](path[_0x957a('0xce')](_0x35bf38,util[_0x957a('0xc3')]('message%d.eml',_0x534280)),_0x2664cf);return _0x243294(_0x2664cf);});});})[_0x957a('0x28')](function(){return new BPromise(function(_0x202683,_0x2bc5ea){zipdir(_0x35bf38,{'saveTo':_0xe72a31},function(_0x43e169,_0x219c69){if(_0x43e169)return _0x2bc5ea(_0x43e169);return _0x202683(_0x219c69);});})[_0x957a('0x28')](function(){return new BPromise(function(_0x32548d,_0x323544){rimraf(_0x35bf38,function(_0x381035){if(_0x381035)_0x323544(_0x381035);return _0x32548d();});});})[_0x957a('0x28')](function(){return _0x40e3d6[_0x957a('0xcc')](_0xe72a31,_0x2f9c73,function(_0x2ad936){if(!_0x2ad936)fs[_0x957a('0xe4')](_0xe72a31);});});});}else{return _0x40e3d6['sendStatus'](0xc8);}})[_0x957a('0x27')](handleError(_0x40e3d6,null));}; \ No newline at end of file +var _0x54f3=['buildExpression','text','start','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','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','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','order','contactName','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.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','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','Setting','enableEmailPreview','all','rows','show','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','sort','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','join','root','server','files','attachments','Attachment','Attachments','Messages','bcc','subject','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','writeFileSync','download','unlinkSync','zip-dir','moment','bluebird','path','lodash','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','html-entities','redis','defaults','localhost','./mailInteraction.socket','sendStatus','status','offset','limit','undefined','count','Content-Range','update','then','destroy','end','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','MailInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','where','pick','select','color','tools_tags','field','u.id','u.fullname','left_join','u.id\x20=\x20ui.UserId','from','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\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?','ContactId'];(function(_0x3d92df,_0x48ca38){var _0x49a172=function(_0x387616){while(--_0x387616){_0x3d92df['push'](_0x3d92df['shift']());}};_0x49a172(++_0x48ca38);}(_0x54f3,0x16c));var _0x354f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x54f3[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x354f('0x0'));var moment=require(_0x354f('0x1'));var BPromise=require(_0x354f('0x2'));var util=require('util');var path=require(_0x354f('0x3'));var fs=require('fs');var _=require(_0x354f('0x4'));var squel=require(_0x354f('0x5'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x354f('0x6'));var as=require(_0x354f('0x7'));var logger=require(_0x354f('0x8'))(_0x354f('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x354f('0xa'));config[_0x354f('0xb')]=_[_0x354f('0xc')](config['redis'],{'host':_0x354f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x354f('0xb')]));require(_0x354f('0xe'))['register'](socket);function respondWithStatusCode(_0x4afc96,_0x3c46eb){_0x3c46eb=_0x3c46eb||0xcc;return function(_0x1c3094){if(_0x1c3094){return _0x4afc96[_0x354f('0xf')](_0x3c46eb);}return _0x4afc96['status'](_0x3c46eb)['end']();};}function respondWithResult(_0x476848,_0x507fdc){_0x507fdc=_0x507fdc||0xc8;return function(_0x455912){if(_0x455912){return _0x476848[_0x354f('0x10')](_0x507fdc)['json'](_0x455912);}};}function respondWithFilteredResult(_0x54e6b5,_0x3a2253){return function(_0x2ee0c5){if(_0x2ee0c5){var _0x111d3f=typeof _0x3a2253[_0x354f('0x11')]==='undefined'&&typeof _0x3a2253[_0x354f('0x12')]===_0x354f('0x13');var _0x3a089c=_0x2ee0c5['count'];var _0x51420c=_0x111d3f?0x0:_0x3a2253[_0x354f('0x11')];var _0x1f8653=_0x111d3f?_0x2ee0c5[_0x354f('0x14')]:_0x3a2253[_0x354f('0x11')]+_0x3a2253['limit'];var _0x24a6e8;if(_0x1f8653>=_0x3a089c){_0x1f8653=_0x3a089c;_0x24a6e8=0xc8;}else{_0x24a6e8=0xce;}_0x54e6b5[_0x354f('0x10')](_0x24a6e8);return _0x54e6b5['set'](_0x354f('0x15'),_0x51420c+'-'+_0x1f8653+'/'+_0x3a089c)['json'](_0x2ee0c5);}return null;};}function saveUpdates(_0x13a6fb){return function(_0x4dc727){if(_0x4dc727){return _0x4dc727[_0x354f('0x16')](_0x13a6fb)[_0x354f('0x17')](function(_0x477af6){return _0x477af6;});}return null;};}function removeEntity(_0x41a8f1){return function(_0x512279){if(_0x512279){return _0x512279[_0x354f('0x18')]()[_0x354f('0x17')](function(){_0x41a8f1[_0x354f('0x10')](0xcc)[_0x354f('0x19')]();});}};}function handleEntityNotFound(_0x127f71){return function(_0x15d247){if(!_0x15d247){_0x127f71[_0x354f('0xf')](0x194);}return _0x15d247;};}function handleError(_0xb5c596,_0x2d42a5){_0x2d42a5=_0x2d42a5||0x1f4;return function(_0x1a2885){logger['error'](_0x1a2885[_0x354f('0x1a')]);if(_0x1a2885[_0x354f('0x1b')]){delete _0x1a2885[_0x354f('0x1b')];}_0xb5c596[_0x354f('0x10')](_0x2d42a5)[_0x354f('0x1c')](_0x1a2885);};}function getInteractionUsers(_0x50a4a6,_0x31ea8e){return new BPromise(function(_0x27ba72,_0x27bbe7){try{if(_0x31ea8e[_0x50a4a6['id']]){_0x50a4a6[_0x354f('0x1d')]=_[_0x354f('0x1e')](_0x31ea8e[_0x50a4a6['id']],function(_0x37dc06){return{'id':_0x37dc06['id'],'fullname':_0x37dc06[_0x354f('0x1f')]};});}}catch(_0x435d09){_0x27bbe7(_0x435d09);}_0x27ba72(_0x50a4a6);});}function getInteractionTags(_0xad5d36,_0x3ae054){return new BPromise(function(_0x1b49ab,_0x3d63c8){try{if(_0xad5d36[_0x354f('0x20')]){_0xad5d36[_0x354f('0x21')]=[];_0xad5d36[_0x354f('0x20')][_0x354f('0x22')](',')[_0x354f('0x23')](function(_0x3ce54b){_0xad5d36[_0x354f('0x21')][_0x354f('0x24')](_0x3ae054[_0x3ce54b]);});}delete _0xad5d36[_0x354f('0x20')];}catch(_0x2d5c36){_0x3d63c8(_0x2d5c36);}_0x1b49ab(_0xad5d36);});}function getLastMessageText(_0x4eab36){return new BPromise(function(_0x1fa698,_0x58e6b3){return db[_0x354f('0x25')][_0x354f('0x26')]({'where':{'$and':[{'MailInteractionId':_0x4eab36['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x354f('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x354f('0x28')],'order':_0x354f('0x29'),'raw':!![]})[_0x354f('0x17')](function(_0x4ebc7d){if(_0x4ebc7d&&_0x4ebc7d['plainBody']){_0x4eab36[_0x354f('0x2a')]=_[_0x354f('0x2b')](_0x4ebc7d[_0x354f('0x28')]);}_0x1fa698(_0x4eab36);})[_0x354f('0x2c')](function(_0x50205e){_0x58e6b3(_0x50205e);});});}function updateMailInteraction(_0x259561,_0x3fa888,_0x229338,_0x3d842e){return new BPromise(function(_0x9a8757,_0x4871e0){return getInteractionUsers(_0x259561,_0x229338)[_0x354f('0x17')](function(_0xbd208f){return getInteractionTags(_0xbd208f,_0x3fa888);})[_0x354f('0x17')](function(_0x3b406d){return getStateInteraction(_0x3b406d);})['then'](function(_0x27bd72){if(_0x3d842e){_0x9a8757(getLastMessageText(_0x27bd72));}else{_0x9a8757(_0x27bd72);}})[_0x354f('0x2c')](function(_0x42f3f4){_0x4871e0(_0x42f3f4);});});}function getStateInteraction(_0x42c8e6){return new BPromise(function(_0x4ee2b4){_0x42c8e6[_0x354f('0x2d')]=0x0;_0x42c8e6['talking']=0x0;_0x42c8e6[_0x354f('0x2e')]=0x0;_0x42c8e6[_0x354f('0x2f')]=0x0;_0x42c8e6[_0x354f('0x30')]=0x0;if(!_0x42c8e6[_0x354f('0x31')]&&!_0x42c8e6['UserId']){_0x42c8e6[_0x354f('0x2d')]+=0x1;}if(!_0x42c8e6[_0x354f('0x31')]&&_0x42c8e6[_0x354f('0x32')]){_0x42c8e6['talking']+=0x1;if(_0x42c8e6[_0x354f('0x2d')]){_0x42c8e6[_0x354f('0x2d')]-=0x1;}}if(_0x42c8e6[_0x354f('0x31')]&&_0x42c8e6['UserId']){_0x42c8e6['answered']+=0x1;if(_0x42c8e6[_0x354f('0x33')]){_0x42c8e6['talking']-=0x1;}}if(_0x42c8e6['closed']&&!_0x42c8e6[_0x354f('0x32')]){_0x42c8e6[_0x354f('0x2f')]+=0x1;if(_0x42c8e6[_0x354f('0x2d')]){_0x42c8e6[_0x354f('0x2d')]-=0x1;}}_0x42c8e6[_0x354f('0x30')]+=0x1;_0x4ee2b4(_0x42c8e6);});}exports[_0x354f('0x34')]=function(_0x2754cd,_0x864ec2){var _0x35d302={},_0x50c957={},_0x1024ec={'count':0x0,'rows':[]};var _0x1f3abf=_[_0x354f('0x1e')](db[_0x354f('0x35')][_0x354f('0x36')],function(_0x378285){return{'name':_0x378285[_0x354f('0x37')],'type':_0x378285[_0x354f('0x38')][_0x354f('0x39')]};});_0x50c957['model']=_['map'](_0x1f3abf,_0x354f('0x1b'));_0x50c957[_0x354f('0x3a')]=_['keys'](_0x2754cd[_0x354f('0x3a')]);_0x50c957[_0x354f('0x3b')]=_[_0x354f('0x3c')](_0x50c957['model'],_0x50c957[_0x354f('0x3a')]);_0x35d302['attributes']=_[_0x354f('0x3c')](_0x50c957['model'],qs[_0x354f('0x3d')](_0x2754cd['query'][_0x354f('0x3d')]));_0x35d302['attributes']=_0x35d302[_0x354f('0x3e')][_0x354f('0x3f')]?_0x35d302[_0x354f('0x3e')]:_0x50c957[_0x354f('0x40')];if(!_0x2754cd[_0x354f('0x3a')][_0x354f('0x41')]('nolimit')){_0x35d302['limit']=qs[_0x354f('0x12')](_0x2754cd[_0x354f('0x3a')]['limit']);_0x35d302[_0x354f('0x11')]=qs['offset'](_0x2754cd[_0x354f('0x3a')][_0x354f('0x11')]);}_0x35d302['order']=qs['sort'](_0x2754cd[_0x354f('0x3a')]['sort']);_0x35d302[_0x354f('0x42')]=qs[_0x354f('0x3b')](_[_0x354f('0x43')](_0x2754cd['query'],_0x50c957[_0x354f('0x3b')]),_0x1f3abf);var _0x12639e=[];var _0xc0a4f0=squel[_0x354f('0x44')]()['field']('id')['field'](_0x354f('0x1b'))['field'](_0x354f('0x45'))['from'](_0x354f('0x46'));var _0x4611c0=squel[_0x354f('0x44')]()[_0x354f('0x47')](_0x354f('0x48'))[_0x354f('0x47')](_0x354f('0x49'))['field']('ui.MailInteractionId')['from']('user_has_mail_interactions','ui')[_0x354f('0x4a')]('users','u',_0x354f('0x4b'));var _0x504b60=squel[_0x354f('0x44')]()[_0x354f('0x4c')](_0x354f('0x4d'),'i')['left_join'](_0x354f('0x4e'),'c',_0x354f('0x4f'))[_0x354f('0x4a')](_0x354f('0x50'),'o',_0x354f('0x51'))[_0x354f('0x4a')](_0x354f('0x52'),'a',_0x354f('0x53'))[_0x354f('0x4a')](_0x354f('0x54'),'me',_0x354f('0x55'))[_0x354f('0x4a')](_0x354f('0x56'),'it','it.MailInteractionId\x20=\x20i.id')[_0x354f('0x4a')](_0x354f('0x46'),'t','t.id\x20=\x20it.TagId');var _0x390706=squel['expr']();var _0x47d677=[];var _0x471a28=squel[_0x354f('0x57')]();var _0x3314a2;if(_0x2754cd[_0x354f('0x3a')]['search']){_0x3314a2=as[_0x354f('0x58')](_0x2754cd[_0x354f('0x3a')][_0x354f('0x59')]);var _0x4b11a5=_0x3314a2[_0x354f('0x5a')];for(var _0x3c16a6=0x0;_0x3c16a6<_0x3314a2[_0x354f('0x5b')][_0x354f('0x3f')];_0x3c16a6++){var _0x981111=_0x3314a2[_0x354f('0x5b')][_0x3c16a6];var _0xdb8313='i';var _0x527071=_[_0x354f('0x5c')](_0x1f3abf,['name',_0x981111[_0x354f('0x47')]]);if(!_0x527071){switch(_0x981111[_0x354f('0x47')]){case'unreadMessages':if(_0x981111[_0x354f('0x5d')]==0x1){_0x504b60[_0x354f('0x5e')]('`'+_0x981111['field']+_0x354f('0x5f'));}else{_0x504b60[_0x354f('0x5e')]('`'+_0x981111['field']+_0x354f('0x60'));}break;case _0x354f('0x61'):if(_0x981111['operator']==='$substring'){if(_0x981111['value'][_0x354f('0x22')]('\x20')['length']>0x1){_0x390706[_0x4b11a5](_0x354f('0x62'),qs[_0x354f('0x63')](_0x981111['value']),null);}else{var _0x54e0a1='%'+_0x981111[_0x354f('0x5d')]+'%';_0x390706[_0x4b11a5](_0x354f('0x64'),_0x54e0a1,_0x54e0a1,_0x54e0a1);}}else{_0x527071=_[_0x354f('0x5c')](_0x1f3abf,[_0x354f('0x1b'),_0x354f('0x65')]);_0x981111['field']=_0x354f('0x65');_0x32130f=as[_0x354f('0x66')](_0xdb8313,_0x527071[_0x354f('0x38')],_0x981111);_0x390706[_0x4b11a5](_0x32130f[_0x354f('0x67')],_0x32130f[_0x354f('0x5d')][_0x354f('0x68')],_0x32130f[_0x354f('0x5d')]['end']);}break;case _0x354f('0x69'):var _0xafcb66=_0x981111[_0x354f('0x5d')]['split'](',')[_0x354f('0x1e')](function(_0x5a1a69){return Number(_0x5a1a69);});_0xafcb66['forEach'](function(_0x525906){_0x471a28['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x525906+',%');});_0x47d677=_[_0x354f('0x6a')](_0x47d677,_0xafcb66);break;case'User':if(_0x981111[_0x354f('0x6b')]==='$substring'){_0x390706[_0x4b11a5](_0x354f('0x6c'),'%'+_0x981111['value']+'%',null);}else{_0x527071=_[_0x354f('0x5c')](_0x1f3abf,[_0x354f('0x1b'),_0x354f('0x32')]);_0x981111[_0x354f('0x47')]='UserId';_0x32130f=as[_0x354f('0x66')](_0xdb8313,_0x527071[_0x354f('0x38')],_0x981111);_0x390706[_0x4b11a5](_0x32130f['text'],_0x32130f[_0x354f('0x5d')][_0x354f('0x68')],_0x32130f[_0x354f('0x5d')]['end']);}break;case _0x354f('0x28'):_0x32130f=as[_0x354f('0x66')]('me',null,_0x981111);_0x390706[_0x4b11a5](_0x32130f[_0x354f('0x67')],_0x32130f['value'][_0x354f('0x68')],_0x32130f[_0x354f('0x5d')][_0x354f('0x19')]);break;}}else{var _0x32130f=as[_0x354f('0x66')](_0xdb8313,_0x527071[_0x354f('0x38')],_0x981111);_0x390706[_0x4b11a5](_0x32130f[_0x354f('0x67')],_0x32130f[_0x354f('0x5d')][_0x354f('0x68')],_0x32130f['value'][_0x354f('0x19')]);}}}else{var _0x56ee3c=_(_0x2754cd[_0x354f('0x3a')])[_0x354f('0x6d')]()[_0x354f('0x1e')](function(_0xe5d638){return _[_0x354f('0x6e')](_0x1f3abf,[_0x354f('0x1b'),_0xe5d638])?_0xe5d638:undefined;})[_0x354f('0x6f')]()['value']();if(!_[_0x354f('0x70')](_0x56ee3c)){_0x56ee3c[_0x354f('0x23')](function(_0xc54a77){if(_0xc54a77==='MailAccountId'){_0x504b60[_0x354f('0x42')](_0x354f('0x71'),[][_0x354f('0x72')](_0x2754cd[_0x354f('0x3a')][_0xc54a77]));}else if(_0xc54a77===_0x354f('0x73')){var _0x40ef41=JSON[_0x354f('0x74')](_0x2754cd[_0x354f('0x3a')][_0xc54a77])[_0x354f('0x75')];var _0x38d28e=JSON[_0x354f('0x74')](_0x2754cd[_0x354f('0x3a')][_0xc54a77])['$lte'];_0x504b60[_0x354f('0x42')](_0x354f('0x76'),_0x40ef41,_0x38d28e);}else{if(_0x2754cd[_0x354f('0x3a')][_0xc54a77]===_0x354f('0x77')){_0x504b60['where']('i.'+_0xc54a77+_0x354f('0x78'));}else{_0x504b60[_0x354f('0x42')]('i.'+_0xc54a77+_0x354f('0x79'),_0x2754cd['query'][_0xc54a77]);}}});}if(_0x2754cd[_0x354f('0x3a')][_0x354f('0x7a')]){if(_0x2754cd[_0x354f('0x3a')][_0x354f('0x7a')]==0x1){_0x504b60[_0x354f('0x5e')](_0x354f('0x7b'));}else{_0x504b60[_0x354f('0x5e')](_0x354f('0x7c'));}}if(_0x2754cd[_0x354f('0x3a')]['tag']){_0x47d677=_['isArray'](_0x2754cd[_0x354f('0x3a')]['tag'])?_0x2754cd[_0x354f('0x3a')]['tag']:new Array(_0x2754cd['query'][_0x354f('0x7d')]);_0x47d677[_0x354f('0x23')](function(_0x41df12){_0x471a28['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x41df12+',%');});}if(_0x2754cd[_0x354f('0x3a')][_0x354f('0x7e')]){var _0x58bc14=_0x2754cd[_0x354f('0x3a')][_0x354f('0x7e')][_0x354f('0x7f')]('\x5c','\x5c\x5c')[_0x354f('0x7f')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x58bc14)){_0x390706['or'](_0x354f('0x80'),_0x58bc14+'%');}else if(qs[_0x354f('0x81')](_0x58bc14)){_0x390706['or'](_0x354f('0x82'),_0x58bc14+'%');}else{_0x390706['or'](_0x354f('0x83'),qs[_0x354f('0x63')](_0x58bc14))['or'](_0x354f('0x84'),qs['getFullTextValue'](_0x58bc14));}}}_0x504b60[_0x354f('0x42')](_0x390706);_0x504b60[_0x354f('0x85')](_0x354f('0x86'));var _0x5e03c7={'type':db[_0x354f('0x87')][_0x354f('0x88')][_0x354f('0x89')],'raw':!![]};var _0x58942e=_0x504b60[_0x354f('0x8a')]();_0x58942e[_0x354f('0x47')](_0x354f('0x86'));_0x58942e[_0x354f('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x354f('0x8b'));if(_0x35d302[_0x354f('0x8c')]){_0x35d302['order'][_0x354f('0x23')](function(_0x3db6fb){var _0xbc2af5=_0x3db6fb[0x0]===_0x354f('0x8d')?_0x3db6fb[0x0]:'i.'+_0x3db6fb[0x0];_0x504b60[_0x354f('0x8c')](_0xbc2af5,_0x3db6fb[0x1]==='DESC'?![]:!![]);});}if(!_[_0x354f('0x70')](_0x47d677)){_0x504b60[_0x354f('0x5e')](_0x471a28);_0x58942e[_0x354f('0x42')]('t.id\x20IN\x20?',_0x47d677);}BPromise['resolve']()[_0x354f('0x17')](function(){if(!_0x3314a2){if(_0x2754cd[_0x354f('0x3a')][_0x354f('0x8e')])return;_0x58942e['where'](_0x354f('0x8f'));_0x504b60[_0x354f('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2754cd[_0x354f('0x90')]['role']!=='agent')return;return _0x2754cd[_0x354f('0x90')][_0x354f('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x29999d){if(_[_0x354f('0x70')](_0x29999d)){_0x58942e['where'](_0x354f('0x92'));_0x504b60[_0x354f('0x42')](_0x354f('0x92'));}else{_0x58942e[_0x354f('0x42')]('i.MailAccountId\x20IN\x20?',_[_0x354f('0x1e')](_0x29999d,'id'));_0x504b60[_0x354f('0x42')](_0x354f('0x71'),_['map'](_0x29999d,'id'));}});})['then'](function(){if(_0x2754cd[_0x354f('0x90')]['role']===_0x354f('0x93')&&!_0x3314a2&&!_0x2754cd['query'][_0x354f('0x8e')])return[];return db[_0x354f('0x94')][_0x354f('0x3a')](_0x58942e[_0x354f('0x95')](),_0x5e03c7);})[_0x354f('0x17')](function(_0x42c462){_0x1024ec[_0x354f('0x14')]=_0x42c462[_0x354f('0x3f')];if(_0x1024ec[_0x354f('0x14')]===0x0)return[];return db[_0x354f('0x94')][_0x354f('0x3a')](_0xc0a4f0[_0x354f('0x95')](),_0x5e03c7)[_0x354f('0x17')](function(_0x410ce2){_0x12639e=_[_0x354f('0x96')](_0x410ce2,'id');_0x5e03c7=_[_0x354f('0x97')](_0x5e03c7,{'model':db[_0x354f('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2754cd[_0x354f('0x3a')][_0x354f('0x3d')]){_0x35d302[_0x354f('0x3e')][_0x354f('0x23')](function(_0x2d6c51){_0x504b60[_0x354f('0x47')]('i.'+_0x2d6c51);});}else{_0x504b60['field'](_0x354f('0x98'),'unreadMessages');_0x504b60[_0x354f('0x47')](_0x354f('0x99'),_0x354f('0x9a'));_0x504b60[_0x354f('0x47')]('a.mandatoryDisposition',_0x354f('0x9b'));_0x504b60[_0x354f('0x47')](_0x354f('0x9c'),'Account.email');_0x504b60['field'](_0x354f('0x9d'),_0x354f('0x8d'));_0x504b60['field'](_0x354f('0x86'));_0x504b60[_0x354f('0x47')](_0x354f('0x9e'));_0x504b60['field'](_0x354f('0x9f'));_0x504b60[_0x354f('0x47')](_0x354f('0xa0'));_0x504b60['field']('i.closedAt');_0x504b60[_0x354f('0x47')](_0x354f('0xa1'));_0x504b60[_0x354f('0x47')](_0x354f('0xa2'));_0x504b60[_0x354f('0x47')]('i.lastMsgDirection');_0x504b60[_0x354f('0x47')](_0x354f('0xa3'));_0x504b60[_0x354f('0x47')]('i.disposition');_0x504b60['field']('i.secondDisposition');_0x504b60[_0x354f('0x47')]('i.thirdDisposition');_0x504b60[_0x354f('0x47')](_0x354f('0xa4'));_0x504b60[_0x354f('0x47')](_0x354f('0xa5'));_0x504b60[_0x354f('0x47')](_0x354f('0xa6'));_0x504b60[_0x354f('0x47')](_0x354f('0xa7'));_0x504b60['field']('i.UserId');_0x504b60[_0x354f('0x47')](_0x354f('0xa8'),_0x354f('0xa9'));_0x504b60[_0x354f('0x47')](_0x354f('0xaa'),_0x354f('0xab'));_0x504b60[_0x354f('0x47')](_0x354f('0xac'),'Contact.email');_0x504b60[_0x354f('0x47')](_0x354f('0xad'),'Contact.phone');_0x504b60['field'](_0x354f('0xae'),_0x354f('0xaf'));_0x504b60[_0x354f('0x47')](_0x354f('0xb0'),_0x354f('0xb1'));_0x504b60[_0x354f('0x47')]('o.fullname',_0x354f('0xb2'));_0x504b60[_0x354f('0x47')](_0x354f('0xb3'),_0x354f('0xb4'));_0x504b60[_0x354f('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x354f('0x20'));}if(_0x35d302[_0x354f('0x12')])_0x504b60[_0x354f('0x12')](_0x35d302[_0x354f('0x12')]);if(_0x35d302['offset'])_0x504b60[_0x354f('0x11')](_0x35d302[_0x354f('0x11')]);return db['sequelize'][_0x354f('0x3a')](_0x504b60[_0x354f('0x95')](),_0x5e03c7);})['then'](function(_0x49347c){if(_0x49347c['length']>0x0)_0x4611c0[_0x354f('0x42')](_0x354f('0xb5'),_['map'](_0x49347c,'id'));return db[_0x354f('0x94')]['query'](_0x4611c0[_0x354f('0x95')](),_0x5e03c7)[_0x354f('0x17')](function(_0xacdc00){var _0x5a9a77=_['groupBy'](_0xacdc00,'MailInteractionId');var _0x5b5dca=[];return db[_0x354f('0xb6')][_0x354f('0x26')]({'attributes':[_0x354f('0xb7')],'raw':!![]})[_0x354f('0x17')](function(_0x2c3677){var _0x402e29=_0x2c3677[_0x354f('0xb7')];_0x49347c[_0x354f('0x23')](function(_0x324ffe){_0x5b5dca[_0x354f('0x24')](updateMailInteraction(_0x324ffe,_0x12639e,_0x5a9a77,_0x402e29));});return BPromise[_0x354f('0xb8')](_0x5b5dca);});});});})[_0x354f('0x17')](function(_0x3a4fa5){_0x1024ec[_0x354f('0xb9')]=_0x3a4fa5;return _0x1024ec;})[_0x354f('0x17')](respondWithFilteredResult(_0x864ec2,_0x35d302))[_0x354f('0x2c')](handleError(_0x864ec2,null));};exports[_0x354f('0xba')]=function(_0x227632,_0x2e733e){var _0x42a1f4={'raw':![],'where':{'id':_0x227632[_0x354f('0xbb')]['id']}},_0x3beff2={};_0x3beff2[_0x354f('0x40')]=_['keys'](db[_0x354f('0x35')][_0x354f('0x36')]);_0x3beff2['query']=_[_0x354f('0x6d')](_0x227632[_0x354f('0x3a')]);_0x3beff2[_0x354f('0x3b')]=_[_0x354f('0x3c')](_0x3beff2[_0x354f('0x40')],_0x3beff2[_0x354f('0x3a')]);_0x42a1f4[_0x354f('0x3e')]=_[_0x354f('0x3c')](_0x3beff2['model'],qs['fields'](_0x227632[_0x354f('0x3a')][_0x354f('0x3d')]));_0x42a1f4['attributes']=_0x42a1f4[_0x354f('0x3e')][_0x354f('0x3f')]?_0x42a1f4['attributes']:_0x3beff2['model'];if(_0x227632[_0x354f('0x3a')]['includeAll']){_0x42a1f4[_0x354f('0xbc')]=[{'all':!![]}];}_0x42a1f4=_[_0x354f('0x97')]({},_0x42a1f4,_0x227632[_0x354f('0xbd')]);return db[_0x354f('0x35')]['find'](_0x42a1f4)['then'](handleEntityNotFound(_0x2e733e,null))[_0x354f('0x17')](respondWithResult(_0x2e733e,null))[_0x354f('0x2c')](handleError(_0x2e733e,null));};exports[_0x354f('0xbe')]=function(_0x598711,_0x3f86b1){return db[_0x354f('0x35')][_0x354f('0xbe')](_0x598711[_0x354f('0xbf')],{})[_0x354f('0x17')](respondWithResult(_0x3f86b1,0xc9))['catch'](handleError(_0x3f86b1,null));};exports[_0x354f('0x16')]=function(_0x1c2721,_0x3824bc){if(_0x1c2721[_0x354f('0xbf')]['id']){delete _0x1c2721[_0x354f('0xbf')]['id'];}return db['MailInteraction'][_0x354f('0x5c')]({'where':{'id':_0x1c2721[_0x354f('0xbb')]['id']}})[_0x354f('0x17')](handleEntityNotFound(_0x3824bc,null))[_0x354f('0x17')](saveUpdates(_0x1c2721['body'],null))[_0x354f('0x17')](respondWithResult(_0x3824bc,null))[_0x354f('0x2c')](handleError(_0x3824bc,null));};exports['destroy']=function(_0x269955,_0x6b124e){return db[_0x354f('0x35')]['find']({'where':{'id':_0x269955[_0x354f('0xbb')]['id']}})[_0x354f('0x17')](handleEntityNotFound(_0x6b124e,null))[_0x354f('0x17')](removeEntity(_0x6b124e,null))[_0x354f('0x2c')](handleError(_0x6b124e,null));};exports[_0x354f('0xc0')]=function(_0x2fd8c8,_0x119d13){return db[_0x354f('0x35')][_0x354f('0xc0')]()[_0x354f('0x17')](respondWithResult(_0x119d13,null))[_0x354f('0x2c')](handleError(_0x119d13,null));};exports[_0x354f('0xc1')]=function(_0x41384d,_0x2e7018){return db[_0x354f('0x25')][_0x354f('0x5c')]({'where':{'id':_0x41384d[_0x354f('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2e7018,null))[_0x354f('0x17')](function(_0x536623){if(_0x536623){return _0x536623[_0x354f('0xc1')](_0x41384d[_0x354f('0xbf')][_0x354f('0xc2')],_[_0x354f('0xc3')](_0x41384d[_0x354f('0xbf')],[_0x354f('0xc2'),'id'])||{});}})[_0x354f('0x17')](respondWithResult(_0x2e7018,null))[_0x354f('0x2c')](handleError(_0x2e7018,null));};exports[_0x354f('0xc4')]=function(_0x926f8b,_0x32afb8){var _0x3a3644={'raw':![],'where':{}};var _0x8f2497={};var _0x417315={'count':0x0,'rows':[]};return db[_0x354f('0x35')]['findOne']({'where':{'id':_0x926f8b[_0x354f('0xbb')]['id']}})[_0x354f('0x17')](handleEntityNotFound(_0x32afb8,null))[_0x354f('0x17')](function(_0x54ed3d){if(_0x54ed3d){_0x8f2497[_0x354f('0x40')]=_[_0x354f('0x6d')](db[_0x354f('0x25')][_0x354f('0x36')]);_0x8f2497['query']=_[_0x354f('0x6d')](_0x926f8b[_0x354f('0x3a')]);_0x8f2497['filters']=_[_0x354f('0x3c')](_0x8f2497[_0x354f('0x40')],_0x8f2497[_0x354f('0x3a')]);_0x3a3644[_0x354f('0x3e')]=_[_0x354f('0x3c')](_0x8f2497[_0x354f('0x40')],qs[_0x354f('0x3d')](_0x926f8b['query'][_0x354f('0x3d')]));_0x3a3644[_0x354f('0x3e')]=_0x3a3644['attributes']['length']?_0x3a3644[_0x354f('0x3e')]:_0x8f2497[_0x354f('0x40')];if(!_0x926f8b[_0x354f('0x3a')][_0x354f('0x41')]('nolimit')){_0x3a3644[_0x354f('0x12')]=qs[_0x354f('0x12')](_0x926f8b['query'][_0x354f('0x12')]);_0x3a3644[_0x354f('0x11')]=qs[_0x354f('0x11')](_0x926f8b[_0x354f('0x3a')][_0x354f('0x11')]);}_0x3a3644[_0x354f('0x8c')]=qs['sort'](_0x926f8b[_0x354f('0x3a')][_0x354f('0xc5')]);_0x3a3644[_0x354f('0x42')]=qs[_0x354f('0x3b')](_[_0x354f('0x43')](_0x926f8b[_0x354f('0x3a')],_0x8f2497['filters']));_0x3a3644[_0x354f('0x42')][_0x354f('0xc6')]=_0x54ed3d['id'];if(_0x926f8b[_0x354f('0x3a')][_0x354f('0x7e')]){_0x3a3644['where']=_['merge'](_0x3a3644[_0x354f('0x42')],{'$or':_[_0x354f('0x1e')](_0x3a3644[_0x354f('0x3e')],function(_0x2e61d1){var _0x32a677={};_0x32a677[_0x2e61d1]={'$like':'%'+_0x926f8b[_0x354f('0x3a')][_0x354f('0x7e')]+'%'};return _0x32a677;})});}if(_0x926f8b[_0x354f('0x3a')][_0x354f('0x75')]){var _0x1dc879=_0x926f8b[_0x354f('0x3a')]['$gte'][_0x354f('0x22')](',');var _0x1f213c={};_0x1f213c[_0x1dc879[0x0]]={'$gte':moment(_0x1dc879[0x1])[_0x354f('0xc7')](_0x354f('0xc8'))};_0x3a3644[_0x354f('0x42')]=_[_0x354f('0x97')](_0x3a3644[_0x354f('0x42')],_0x1f213c);}_0x3a3644=_['merge']({},_0x3a3644,_0x926f8b[_0x354f('0xbd')]);return db[_0x354f('0x25')][_0x354f('0x14')]({'where':_0x3a3644[_0x354f('0x42')]})['then'](function(_0x16ec5b){_0x417315[_0x354f('0x14')]=_0x16ec5b;if(_0x926f8b[_0x354f('0x3a')][_0x354f('0xc9')]){_0x3a3644['include']=[{'all':!![]}];}return db[_0x354f('0x25')][_0x354f('0xca')](_0x3a3644);})[_0x354f('0x17')](function(_0x2deef6){if(_0x926f8b['query'][_0x354f('0xcb')]===_0x354f('0xcc')){for(var _0x331005=0x0;_0x331005<_0x2deef6[_0x354f('0x3f')];_0x331005++){_0x2deef6[_0x331005][_0x354f('0xbf')]=juice(_0x2deef6[_0x331005][_0x354f('0xbf')]);}}_0x417315[_0x354f('0xb9')]=_0x2deef6;return _0x417315;});}})[_0x354f('0x17')](respondWithFilteredResult(_0x32afb8,_0x3a3644))[_0x354f('0x2c')](handleError(_0x32afb8,null));};exports[_0x354f('0xcd')]=function(_0x11b4e3,_0xb14ff7){return db[_0x354f('0x35')][_0x354f('0x5c')]({'where':{'id':_0x11b4e3[_0x354f('0xbb')]['id']}})['then'](handleEntityNotFound(_0xb14ff7,null))['then'](function(_0x4da75e){if(_0x4da75e){return _0x4da75e[_0x354f('0xce')](_0x11b4e3['body'][_0x354f('0xc2')],_[_0x354f('0xc3')](_0x11b4e3[_0x354f('0xbf')],['ids','id'])||{})[_0x354f('0xcf')](function(){return db[_0x354f('0x69')]['findAll']({'attributes':['id','name',_0x354f('0x45')],'where':{'id':_0x11b4e3[_0x354f('0xbf')]['ids']}});})[_0x354f('0x17')](function(_0x5b660f){socket[_0x354f('0xd0')](_0x354f('0xd1'),{'id':Number(_0x11b4e3['params']['id']),'tags':_0x5b660f||[]});return{'id':Number(_0x11b4e3[_0x354f('0xbb')]['id']),'tags':_0x5b660f||[]};});}})[_0x354f('0x17')](respondWithResult(_0xb14ff7,null))['catch'](handleError(_0xb14ff7,null));};exports[_0x354f('0xd2')]=function(_0x5b23b0,_0x16f678){return db[_0x354f('0x35')]['find']({'where':{'id':_0x5b23b0[_0x354f('0xbb')]['id']}})[_0x354f('0x17')](handleEntityNotFound(_0x16f678,null))[_0x354f('0x17')](function(_0x317423){if(_0x317423){return _0x317423[_0x354f('0xd2')](_0x5b23b0[_0x354f('0x3a')][_0x354f('0xc2')]);}})[_0x354f('0x17')](respondWithStatusCode(_0x16f678,null))[_0x354f('0x2c')](handleError(_0x16f678,null));};exports['download']=function(_0x468ec4,_0x3d984d){var _0x49a5df=moment()['unix']()[_0x354f('0x95')]();var _0x1592ab=path[_0x354f('0xd3')](config[_0x354f('0xd4')],_0x354f('0xd5'),'files','tmp');var _0x8a85b0=path['join'](config[_0x354f('0xd4')],'server',_0x354f('0xd6'),_0x354f('0xd7'));var _0x31d841=path[_0x354f('0xd3')](_0x1592ab,_0x49a5df);var _0x5703a4=util[_0x354f('0xc7')]('transcript-%d-%s.zip',_0x468ec4[_0x354f('0xbb')]['id'],_0x49a5df);var _0x5a871a=path[_0x354f('0xd3')](_0x1592ab,_0x5703a4);var _0x121ba6=[];if(_0x468ec4[_0x354f('0x3a')][_0x354f('0xd7')]){_0x121ba6[_0x354f('0x24')]({'model':db[_0x354f('0xd8')],'as':_0x354f('0xd9'),'raw':!![]});}var _0x2ea951=[{'model':db[_0x354f('0x25')],'as':_0x354f('0xda'),'attributes':['id','body','from','to','cc',_0x354f('0xdb'),_0x354f('0xdc'),_0x354f('0x73')],'where':{'secret':![]},'order':qs[_0x354f('0xc5')]('id'),'include':_0x121ba6}];return db['MailInteraction'][_0x354f('0x5c')]({'where':{'id':_0x468ec4[_0x354f('0xbb')]['id']},'include':_0x2ea951})[_0x354f('0x17')](handleEntityNotFound(_0x3d984d,null))['then'](function(_0x3f5293){if(_0x3f5293&&_0x3f5293[_0x354f('0xda')]){var _0x286c85=_0x3f5293['get']({'plain':!![]});fs[_0x354f('0xdd')](_0x31d841);return BPromise[_0x354f('0xde')](_0x286c85[_0x354f('0xda')],function(_0x5e1902,_0x26ff4a){var _0x5a71c7={'from':_0x5e1902[_0x354f('0x4c')],'to':_0x5e1902['to'],'subject':_0x5e1902[_0x354f('0xdc')],'html':htmlEntities[_0x354f('0xdf')](_0x5e1902[_0x354f('0xbf')]),'headers':{'Date':moment(_0x5e1902[_0x354f('0x73')])[_0x354f('0xc7')](_0x354f('0xe0'))},'attachments':[]};if(_0x5e1902['cc']){_0x5a71c7['headers']['Cc']=_0x5e1902['cc'];}if(_0x5e1902[_0x354f('0xdb')]){_0x5a71c7[_0x354f('0xe1')][_0x354f('0xe2')]=_0x5e1902[_0x354f('0xdb')];}return new BPromise(function(_0x575639,_0x11773a){if(_0x5e1902[_0x354f('0xd9')]){for(var _0x48ec4f=0x0;_0x48ec4f<_0x5e1902[_0x354f('0xd9')][_0x354f('0x3f')];_0x48ec4f++){var _0x3eaf39=_0x5e1902[_0x354f('0xd9')][_0x48ec4f];var _0x58b180=path[_0x354f('0xd3')](_0x8a85b0,_0x3eaf39[_0x354f('0xe3')]);if(fs['existsSync'](_0x58b180)){_0x5a71c7[_0x354f('0xd7')][_0x354f('0x24')]({'name':_0x3eaf39[_0x354f('0x1b')],'contentType':_0x3eaf39['type'],'data':fs[_0x354f('0xe4')](_0x58b180)});}}}emlformat[_0x354f('0xe5')](_0x5a71c7,function(_0x552313,_0x351cfa){if(_0x552313)return _0x11773a(_0x552313);fs[_0x354f('0xe6')](path[_0x354f('0xd3')](_0x31d841,util[_0x354f('0xc7')]('message%d.eml',_0x26ff4a)),_0x351cfa);return _0x575639(_0x351cfa);});});})[_0x354f('0x17')](function(){return new BPromise(function(_0x104419,_0x4e6ba0){zipdir(_0x31d841,{'saveTo':_0x5a871a},function(_0x2be629,_0x3aeedd){if(_0x2be629)return _0x4e6ba0(_0x2be629);return _0x104419(_0x3aeedd);});})[_0x354f('0x17')](function(){return new BPromise(function(_0x5d7014,_0x2a23a7){rimraf(_0x31d841,function(_0x24fc72){if(_0x24fc72)_0x2a23a7(_0x24fc72);return _0x5d7014();});});})[_0x354f('0x17')](function(){return _0x3d984d[_0x354f('0xe7')](_0x5a871a,_0x5703a4,function(_0x4dff3f){if(!_0x4dff3f)fs[_0x354f('0xe8')](_0x5a871a);});});});}else{return _0x3d984d['sendStatus'](0xc8);}})[_0x354f('0x2c')](handleError(_0x3d984d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 5644f4c..9931da5 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 _0xdc40=['getUsers','then','setDataValue','Users','map','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdc40,0x118));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0dc4('0x0'));var MailInteraction=require(_0x0dc4('0x1'))['db'][_0x0dc4('0x2')];var MailMessage=require(_0x0dc4('0x1'))['db'][_0x0dc4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0dc4('0x4')](0x0);var events={'afterCreate':_0x0dc4('0x5'),'afterUpdate':_0x0dc4('0x6'),'afterDestroy':_0x0dc4('0x7')};function emitEvent(_0x5409e9){return function(_0x4482d6,_0xc6a299,_0x137bc6){_0x4482d6[_0x0dc4('0x8')]({'attributes':['id'],'raw':!![]})[_0x0dc4('0x9')](function(_0x49eb17){_0x4482d6[_0x0dc4('0xa')](_0x0dc4('0xb'),_0x49eb17[_0x0dc4('0xc')](function(_0x9ca182){return{'id':_0x9ca182['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x4482d6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0dc4('0x9')](function(_0x15cc8d){_0x4482d6['setDataValue']('unreadMessages',_0x15cc8d['length']);MailInteractionEvents[_0x0dc4('0xd')](_0x5409e9+':'+_0x4482d6['id'],_0x4482d6);MailInteractionEvents['emit'](_0x5409e9,_0x4482d6);_0x137bc6(null);})[_0x0dc4('0xe')](_0x137bc6(null));};}for(var e in events){if(events[_0x0dc4('0xf')](e)){var event=events[e];MailInteraction[_0x0dc4('0x10')](e,emitEvent(event));}}module[_0x0dc4('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xfdf8=['length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll'];(function(_0x399bb0,_0x24b458){var _0x9346f7=function(_0x459638){while(--_0x459638){_0x399bb0['push'](_0x399bb0['shift']());}};_0x9346f7(++_0x24b458);}(_0xfdf8,0x1ec));var _0x8fdf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfdf8[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x8fdf('0x0'))['db'][_0x8fdf('0x1')];var MailMessage=require(_0x8fdf('0x0'))['db'][_0x8fdf('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8fdf('0x3')](0x0);var events={'afterCreate':_0x8fdf('0x4'),'afterUpdate':_0x8fdf('0x5'),'afterDestroy':_0x8fdf('0x6')};function emitEvent(_0x5e8df6){return function(_0x102c3b,_0x45d5e3,_0x513032){_0x102c3b['getUsers']({'attributes':['id'],'raw':!![]})[_0x8fdf('0x7')](function(_0x9f8c2d){_0x102c3b[_0x8fdf('0x8')](_0x8fdf('0x9'),_0x9f8c2d[_0x8fdf('0xa')](function(_0x56af51){return{'id':_0x56af51['id']};}));return MailMessage[_0x8fdf('0xb')]({'where':{'MailInteractionId':_0x102c3b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8fdf('0x7')](function(_0x46c2dd){_0x102c3b[_0x8fdf('0x8')]('unreadMessages',_0x46c2dd[_0x8fdf('0xc')]);MailInteractionEvents[_0x8fdf('0xd')](_0x5e8df6+':'+_0x102c3b['id'],_0x102c3b);MailInteractionEvents[_0x8fdf('0xd')](_0x5e8df6,_0x102c3b);_0x513032(null);})[_0x8fdf('0xe')](_0x513032(null));};}for(var e in events){if(events[_0x8fdf('0xf')](e)){var event=events[e];MailInteraction[_0x8fdf('0x10')](e,emitEvent(event));}}module[_0x8fdf('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 65531f5..ea850a9 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 _0xc2d7=['then','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','get','update'];(function(_0x2fb0ec,_0x234df3){var _0x291b3c=function(_0x49afe1){while(--_0x49afe1){_0x2fb0ec['push'](_0x2fb0ec['shift']());}};_0x291b3c(++_0x234df3);}(_0xc2d7,0x1cb));var _0x7c2d=function(_0x43884a,_0x154135){_0x43884a=_0x43884a-0x0;var _0x55c82a=_0xc2d7[_0x43884a];return _0x55c82a;};'use strict';var _=require('lodash');var util=require(_0x7c2d('0x0'));var logger=require(_0x7c2d('0x1'))('api');var moment=require(_0x7c2d('0x2'));var BPromise=require(_0x7c2d('0x3'));var rp=require(_0x7c2d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c2d('0x5'));var config=require(_0x7c2d('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x7c2d('0x7')]=function(_0x329e27,_0x51dfca){return _0x329e27[_0x7c2d('0x8')]('MailInteraction',attributes,{'tableName':_0x7c2d('0x9'),'paranoid':![],'indexes':[{'name':_0x7c2d('0xa'),'fields':[_0x7c2d('0xb'),'to'],'type':_0x7c2d('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4fcb7e,_0x3d7ac4,_0x1096cf){if(_0x4fcb7e[_0x7c2d('0xd')]){_0x4fcb7e[_0x7c2d('0xe')]=moment()[_0x7c2d('0xf')](_0x7c2d('0x10'));}if(_0x4fcb7e[_0x7c2d('0x11')]){_0x4fcb7e[_0x7c2d('0x12')]=moment()[_0x7c2d('0xf')](_0x7c2d('0x10'));}_0x1096cf(null,_0x3d7ac4);},'beforeUpdate':function(_0x2c8d78,_0x2412ba,_0x4f84c8){if(_0x2c8d78['changed'](_0x7c2d('0xd'))){_0x2c8d78[_0x7c2d('0xe')]=_0x2c8d78['substatus']?moment()[_0x7c2d('0xf')](_0x7c2d('0x10')):null;}if(_0x2c8d78['changed'](_0x7c2d('0x11'))){_0x2c8d78[_0x7c2d('0x12')]=moment()[_0x7c2d('0xf')](_0x7c2d('0x10'));_0x2c8d78[_0x7c2d('0xd')]=null;_0x2c8d78[_0x7c2d('0xe')]=null;}_0x4f84c8(null,_0x2c8d78);},'afterUpdate':function(_0x1ac309,_0x347ad6,_0x16100d){var _0x2858d0=_0x329e27['models'];var _0x5d2bae=_0x1ac309[_0x7c2d('0x13')]({'plain':!![]});if(_0x5d2bae['closed']){return _0x2858d0['MailMessage'][_0x7c2d('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x5d2bae['id']}})[_0x7c2d('0x15')](function(){_0x16100d();})['catch'](function(_0x52a84b){_0x16100d(_0x52a84b);});}else{_0x16100d();}}},'charset':_0x7c2d('0x16'),'collate':_0x7c2d('0x17')});}; \ No newline at end of file +var _0xb826=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','substatus','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','get','update','then','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x358e3c,_0x245f07){var _0x125cf6=function(_0x306ffc){while(--_0x306ffc){_0x358e3c['push'](_0x358e3c['shift']());}};_0x125cf6(++_0x245f07);}(_0xb826,0x12a));var _0x6b82=function(_0x4a0c3d,_0x3bd256){_0x4a0c3d=_0x4a0c3d-0x0;var _0x51e6a7=_0xb826[_0x4a0c3d];return _0x51e6a7;};'use strict';var _=require(_0x6b82('0x0'));var util=require(_0x6b82('0x1'));var logger=require(_0x6b82('0x2'))('api');var moment=require(_0x6b82('0x3'));var BPromise=require(_0x6b82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b82('0x5'));var config=require(_0x6b82('0x6'));var attributes=require(_0x6b82('0x7'));module[_0x6b82('0x8')]=function(_0x21007e,_0xe4523f){return _0x21007e[_0x6b82('0x9')]('MailInteraction',attributes,{'tableName':_0x6b82('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32f127,_0x337d07,_0x29c52d){if(_0x32f127[_0x6b82('0xb')]){_0x32f127[_0x6b82('0xc')]=moment()[_0x6b82('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x32f127[_0x6b82('0xe')]){_0x32f127['closedAt']=moment()['format'](_0x6b82('0xf'));}_0x29c52d(null,_0x337d07);},'beforeUpdate':function(_0x3ddaf6,_0x4583ae,_0x3a2731){if(_0x3ddaf6[_0x6b82('0x10')]('substatus')){_0x3ddaf6[_0x6b82('0xc')]=_0x3ddaf6['substatus']?moment()[_0x6b82('0xd')](_0x6b82('0xf')):null;}if(_0x3ddaf6[_0x6b82('0x10')](_0x6b82('0xe'))){_0x3ddaf6[_0x6b82('0x11')]=moment()[_0x6b82('0xd')](_0x6b82('0xf'));_0x3ddaf6[_0x6b82('0xb')]=null;_0x3ddaf6[_0x6b82('0xc')]=null;}_0x3a2731(null,_0x3ddaf6);},'afterUpdate':function(_0x4870e9,_0x23873a,_0x30cc21){var _0x501035=_0x21007e['models'];var _0x57b4de=_0x4870e9[_0x6b82('0x12')]({'plain':!![]});if(_0x57b4de[_0x6b82('0xe')]){return _0x501035['MailMessage'][_0x6b82('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x57b4de['id']}})[_0x6b82('0x14')](function(){_0x30cc21();})['catch'](function(_0x118945){_0x30cc21(_0x118945);});}else{_0x30cc21();}}},'charset':_0x6b82('0x15'),'collate':_0x6b82('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 87105c4..3e57bdc 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 _0x40b7=['stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','attributes','limit','debug','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x393d6b,_0xbfb5fc){var _0x51dfe5=function(_0x16eda6){while(--_0x16eda6){_0x393d6b['push'](_0x393d6b['shift']());}};_0x51dfe5(++_0xbfb5fc);}(_0x40b7,0x1e2));var _0x740b=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x40b7[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x740b('0x0'));var util=require(_0x740b('0x1'));var moment=require(_0x740b('0x2'));var BPromise=require(_0x740b('0x3'));var rs=require(_0x740b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x740b('0x5'))['db'];var utils=require(_0x740b('0x6'));var logger=require(_0x740b('0x7'))(_0x740b('0x8'));var config=require(_0x740b('0x9'));var jayson=require(_0x740b('0xa'));var client=jayson['client'][_0x740b('0xb')]({'port':0x232a});config[_0x740b('0xc')]=_[_0x740b('0xd')](config[_0x740b('0xc')],{'host':_0x740b('0xe'),'port':0x18eb});var socket=require(_0x740b('0xf'))(new Redis(config[_0x740b('0xc')]));require(_0x740b('0x10'))[_0x740b('0x11')](socket);function respondWithRpcPromise(_0x7a9939,_0x11e891,_0x203752){return new BPromise(function(_0x39936d,_0x549e26){return client[_0x740b('0x12')](_0x7a9939,_0x203752)[_0x740b('0x13')](function(_0x466a31){logger[_0x740b('0x14')](_0x740b('0x15'),_0x11e891,_0x740b('0x16'));logger['debug'](_0x740b('0x17'),_0x11e891,_0x740b('0x16'),JSON[_0x740b('0x18')](_0x466a31));if(_0x466a31['error']){if(_0x466a31[_0x740b('0x19')][_0x740b('0x1a')]===0x1f4){logger[_0x740b('0x19')]('MailInteraction,\x20%s,\x20%s',_0x11e891,_0x466a31['error'][_0x740b('0x1b')]);return _0x549e26(_0x466a31[_0x740b('0x19')][_0x740b('0x1b')]);}logger[_0x740b('0x19')](_0x740b('0x15'),_0x11e891,_0x466a31[_0x740b('0x19')]['message']);return _0x39936d(_0x466a31['error'][_0x740b('0x1b')]);}else{logger[_0x740b('0x14')](_0x740b('0x15'),_0x11e891,_0x740b('0x16'));_0x39936d(_0x466a31[_0x740b('0x1c')][_0x740b('0x1b')]);}})[_0x740b('0x1d')](function(_0x336be0){logger[_0x740b('0x19')](_0x740b('0x15'),_0x11e891,_0x336be0);_0x549e26(_0x336be0);});});}exports[_0x740b('0x1e')]=function(_0x17643c){var _0x394875=this;return new Promise(function(_0x41a093,_0x2e9c4d){return db[_0x740b('0x1f')]['update'](_0x17643c[_0x740b('0x20')],{'raw':_0x17643c['options']?_0x17643c[_0x740b('0x21')][_0x740b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17643c[_0x740b('0x21')]?_0x17643c[_0x740b('0x21')]['where']||null:null,'attributes':_0x17643c[_0x740b('0x21')]?_0x17643c[_0x740b('0x21')][_0x740b('0x23')]||null:null,'limit':_0x17643c[_0x740b('0x21')]?_0x17643c[_0x740b('0x21')][_0x740b('0x24')]||null:null})[_0x740b('0x13')](function(_0x241416){logger[_0x740b('0x14')](_0x740b('0x1e'),_0x17643c);logger[_0x740b('0x25')](_0x740b('0x1e'),_0x17643c,JSON[_0x740b('0x18')](_0x241416));_0x41a093(_0x241416);})[_0x740b('0x1d')](function(_0x1ebdf3){logger[_0x740b('0x19')](_0x740b('0x1e'),_0x1ebdf3['message'],_0x17643c);_0x2e9c4d(_0x394875[_0x740b('0x19')](0x1f4,_0x1ebdf3[_0x740b('0x1b')]));});});};exports[_0x740b('0x26')]=function(_0xc9d05e){return new Promise(function(_0x48474b,_0x373502){return db['MailInteraction'][_0x740b('0x27')]({'where':_0xc9d05e[_0x740b('0x21')]?_0xc9d05e['options'][_0x740b('0x28')]||null:null})[_0x740b('0x13')](function(_0xd429b){if(_0xd429b){return _0xd429b[_0x740b('0x29')](_0xc9d05e[_0x740b('0x20')][_0x740b('0x2a')],_[_0x740b('0x2b')](_0xc9d05e['body'],[_0x740b('0x2a'),'id'])||{});}})[_0x740b('0x2c')](function(_0x45b29d){logger['info'](_0x740b('0x2d'),_0xc9d05e);logger[_0x740b('0x25')](_0x740b('0x2d'),_0xc9d05e,JSON[_0x740b('0x18')](_0x45b29d));_0x48474b(_0x45b29d);})[_0x740b('0x1d')](function(_0x18fd6d){logger[_0x740b('0x19')](_0x740b('0x2d'),_0x18fd6d['message'],_0xc9d05e);_0x373502(_this['error'](0x1f4,_0x18fd6d[_0x740b('0x1b')]));});});}; \ No newline at end of file +var _0x5b47=['AddTags','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','find','addTags','ids','omit','spread'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x5b47,0x120));var _0x75b4=function(_0x27832d,_0x4fdbf1){_0x27832d=_0x27832d-0x0;var _0x53a593=_0x5b47[_0x27832d];return _0x53a593;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x75b4('0x2'));var logger=require(_0x75b4('0x3'))(_0x75b4('0x4'));var config=require(_0x75b4('0x5'));var jayson=require(_0x75b4('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x75b4('0x7')](config['redis'],{'host':_0x75b4('0x8'),'port':0x18eb});var socket=require(_0x75b4('0x9'))(new Redis(config[_0x75b4('0xa')]));require(_0x75b4('0xb'))[_0x75b4('0xc')](socket);function respondWithRpcPromise(_0x4b2a75,_0x2cd75b,_0x2211a1){return new BPromise(function(_0x33f11d,_0x51b9a6){return client[_0x75b4('0xd')](_0x4b2a75,_0x2211a1)['then'](function(_0x690d5a){logger[_0x75b4('0xe')](_0x75b4('0xf'),_0x2cd75b,_0x75b4('0x10'));logger[_0x75b4('0x11')](_0x75b4('0x12'),_0x2cd75b,_0x75b4('0x10'),JSON[_0x75b4('0x13')](_0x690d5a));if(_0x690d5a['error']){if(_0x690d5a['error']['code']===0x1f4){logger[_0x75b4('0x14')](_0x75b4('0xf'),_0x2cd75b,_0x690d5a['error'][_0x75b4('0x15')]);return _0x51b9a6(_0x690d5a[_0x75b4('0x14')][_0x75b4('0x15')]);}logger['error'](_0x75b4('0xf'),_0x2cd75b,_0x690d5a[_0x75b4('0x14')][_0x75b4('0x15')]);return _0x33f11d(_0x690d5a[_0x75b4('0x14')]['message']);}else{logger[_0x75b4('0xe')](_0x75b4('0xf'),_0x2cd75b,_0x75b4('0x10'));_0x33f11d(_0x690d5a[_0x75b4('0x16')][_0x75b4('0x15')]);}})[_0x75b4('0x17')](function(_0x510967){logger[_0x75b4('0x14')](_0x75b4('0xf'),_0x2cd75b,_0x510967);_0x51b9a6(_0x510967);});});}exports[_0x75b4('0x18')]=function(_0x61d267){var _0x39af43=this;return new Promise(function(_0x34ecfe,_0x40afc5){return db[_0x75b4('0x19')][_0x75b4('0x1a')](_0x61d267[_0x75b4('0x1b')],{'raw':_0x61d267[_0x75b4('0x1c')]?_0x61d267[_0x75b4('0x1c')][_0x75b4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x61d267[_0x75b4('0x1c')]?_0x61d267[_0x75b4('0x1c')][_0x75b4('0x1e')]||null:null,'attributes':_0x61d267[_0x75b4('0x1c')]?_0x61d267['options'][_0x75b4('0x1f')]||null:null,'limit':_0x61d267['options']?_0x61d267[_0x75b4('0x1c')][_0x75b4('0x20')]||null:null})[_0x75b4('0x21')](function(_0x14e8b3){logger['info']('UpdateMailInteraction',_0x61d267);logger[_0x75b4('0x11')](_0x75b4('0x18'),_0x61d267,JSON['stringify'](_0x14e8b3));_0x34ecfe(_0x14e8b3);})[_0x75b4('0x17')](function(_0xd5b2cc){logger['error']('UpdateMailInteraction',_0xd5b2cc[_0x75b4('0x15')],_0x61d267);_0x40afc5(_0x39af43[_0x75b4('0x14')](0x1f4,_0xd5b2cc['message']));});});};exports[_0x75b4('0x22')]=function(_0x314c54){return new Promise(function(_0x1b1e1e,_0x3fc275){return db[_0x75b4('0x19')][_0x75b4('0x23')]({'where':_0x314c54['options']?_0x314c54['options'][_0x75b4('0x1e')]||null:null})[_0x75b4('0x21')](function(_0x251f03){if(_0x251f03){return _0x251f03[_0x75b4('0x24')](_0x314c54[_0x75b4('0x1b')][_0x75b4('0x25')],_[_0x75b4('0x26')](_0x314c54['body'],[_0x75b4('0x25'),'id'])||{});}})[_0x75b4('0x27')](function(_0x160273){logger[_0x75b4('0xe')](_0x75b4('0x28'),_0x314c54);logger['debug'](_0x75b4('0x28'),_0x314c54,JSON['stringify'](_0x160273));_0x1b1e1e(_0x160273);})[_0x75b4('0x17')](function(_0x906041){logger[_0x75b4('0x14')](_0x75b4('0x28'),_0x906041[_0x75b4('0x15')],_0x314c54);_0x3fc275(_this[_0x75b4('0x14')](0x1f4,_0x906041['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 836f374..423f4eb 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 _0xdaa8=['update','removeListener','register','length','mailInteraction:','save'];(function(_0x442c85,_0x189386){var _0x59ebd2=function(_0x60c5c3){while(--_0x60c5c3){_0x442c85['push'](_0x442c85['shift']());}};_0x59ebd2(++_0x189386);}(_0xdaa8,0xad));var _0x8daa=function(_0x78fbf1,_0x271174){_0x78fbf1=_0x78fbf1-0x0;var _0x5e806b=_0xdaa8[_0x78fbf1];return _0x5e806b;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x8daa('0x0'),'remove',_0x8daa('0x1')];function createListener(_0x3993ca,_0x13b40f){return function(_0x452ff8){_0x13b40f['emit'](_0x3993ca,_0x452ff8);};}function removeListener(_0x429970,_0x284a6e){return function(){MailInteractionEvents[_0x8daa('0x2')](_0x429970,_0x284a6e);};}exports[_0x8daa('0x3')]=function(_0x3056ed){for(var _0x451c6d=0x0,_0x2cd5e3=events[_0x8daa('0x4')];_0x451c6d<_0x2cd5e3;_0x451c6d++){var _0x34fb89=events[_0x451c6d];var _0x451d1a=createListener(_0x8daa('0x5')+_0x34fb89,_0x3056ed);MailInteractionEvents['on'](_0x34fb89,_0x451d1a);}}; \ No newline at end of file +var _0x97eb=['register','mailInteraction:','./mailInteraction.events','emit','removeListener'];(function(_0x30b65e,_0xa1efde){var _0x271cd5=function(_0x5cc9ea){while(--_0x5cc9ea){_0x30b65e['push'](_0x30b65e['shift']());}};_0x271cd5(++_0xa1efde);}(_0x97eb,0x1e7));var _0xb97e=function(_0x574a3e,_0x5309fc){_0x574a3e=_0x574a3e-0x0;var _0x4e700b=_0x97eb[_0x574a3e];return _0x4e700b;};'use strict';var MailInteractionEvents=require(_0xb97e('0x0'));var events=['save','remove','update'];function createListener(_0x7b0017,_0x4913d2){return function(_0x368a2c){_0x4913d2[_0xb97e('0x1')](_0x7b0017,_0x368a2c);};}function removeListener(_0x5c7d37,_0xd44550){return function(){MailInteractionEvents[_0xb97e('0x2')](_0x5c7d37,_0xd44550);};}exports[_0xb97e('0x3')]=function(_0x2783aa){for(var _0x27e309=0x0,_0xfe30c3=events['length'];_0x27e309<_0xfe30c3;_0x27e309++){var _0x20d726=events[_0x27e309];var _0x2f2ee5=createListener(_0xb97e('0x4')+_0x20d726,_0x2783aa);MailInteractionEvents['on'](_0x20d726,_0x2f2ee5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 19c02b2..c4aacd3 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 _0x462e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','post','tracked','mailmessage:create','create','put','accept','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2e0074,_0x112227){var _0x26fe29=function(_0x4207cd){while(--_0x4207cd){_0x2e0074['push'](_0x2e0074['shift']());}};_0x26fe29(++_0x112227);}(_0x462e,0x13c));var _0xe462=function(_0x2aed15,_0x271fbc){_0x2aed15=_0x2aed15-0x0;var _0x7d007f=_0x462e[_0x2aed15];return _0x7d007f;};'use strict';var multer=require(_0xe462('0x0'));var util=require(_0xe462('0x1'));var path=require(_0xe462('0x2'));var timeout=require(_0xe462('0x3'));var express=require(_0xe462('0x4'));var router=express['Router']();var fs_extra=require(_0xe462('0x5'));var auth=require(_0xe462('0x6'));var interaction=require(_0xe462('0x7'));var config=require(_0xe462('0x8'));var controller=require('./mailMessage.controller');router[_0xe462('0x9')]('/',auth[_0xe462('0xa')](),controller[_0xe462('0xb')]);router[_0xe462('0x9')](_0xe462('0xc'),auth['isAuthenticated'](),controller[_0xe462('0xd')]);router[_0xe462('0x9')](_0xe462('0xe'),auth[_0xe462('0xa')](),controller['show']);router[_0xe462('0x9')](_0xe462('0xf'),auth[_0xe462('0xa')](),controller['download']);router[_0xe462('0x10')]('/',auth[_0xe462('0xa')](),interaction[_0xe462('0x11')]('mail',_0xe462('0x12')),controller[_0xe462('0x13')]);router[_0xe462('0x14')]('/:id',auth[_0xe462('0xa')](),controller['update']);router[_0xe462('0x14')]('/:id/accept',auth[_0xe462('0xa')](),controller[_0xe462('0x15')]);router[_0xe462('0x14')]('/:id/reject',auth[_0xe462('0xa')](),controller['reject']);router[_0xe462('0x16')]('/:id',auth[_0xe462('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb62e=['/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x26e618,_0x43ac1f){var _0x5671c4=function(_0x15c122){while(--_0x15c122){_0x26e618['push'](_0x26e618['shift']());}};_0x5671c4(++_0x43ac1f);}(_0xb62e,0x1de));var _0xeb62=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb62e[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x12')](_0xeb62('0x13'),_0xeb62('0x14')),controller[_0xeb62('0x15')]);router['put'](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);router[_0xeb62('0x17')]('/:id/accept',auth[_0xeb62('0xa')](),controller[_0xeb62('0x18')]);router[_0xeb62('0x17')]('/:id/reject',auth[_0xeb62('0xa')](),controller[_0xeb62('0x19')]);router[_0xeb62('0x1a')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0x1b')]);module[_0xeb62('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 76f9001..33f59cb 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 _0x5a5a=['INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x528d93,_0x206f66){var _0x599ee3=function(_0x3ee78c){while(--_0x3ee78c){_0x528d93['push'](_0x528d93['shift']());}};_0x599ee3(++_0x206f66);}(_0x5a5a,0x65));var _0xa5a5=function(_0x4ab60b,_0x49e637){_0x4ab60b=_0x4ab60b-0x0;var _0x2497c7=_0x5a5a[_0x4ab60b];return _0x2497c7;};'use strict';var Sequelize=require(_0xa5a5('0x0'));var _=require(_0xa5a5('0x1'));module[_0xa5a5('0x2')]={'body':{'type':Sequelize[_0xa5a5('0x3')](_0xa5a5('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa5a5('0x3')](_0xa5a5('0x5'))},'read':{'type':Sequelize[_0xa5a5('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5a5('0x7')]('in',_0xa5a5('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa5a5('0x9')](0x1fe)},'from':{'type':Sequelize[_0xa5a5('0x9')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xa5a5('0x3')](_0xa5a5('0x4'))},'bcc':{'type':Sequelize[_0xa5a5('0x3')](_0xa5a5('0x4'))},'subject':{'type':Sequelize[_0xa5a5('0x3')]},'sentAt':{'type':Sequelize[_0xa5a5('0xa')]},'attach':{'type':Sequelize[_0xa5a5('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa5a5('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa5a5('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xa5a5('0x4'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize['ENUM'](_0xa5a5('0xc'),_0xa5a5('0xd')),'defaultValue':_0xa5a5('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x4ef9=['Email','Chat','sequelize','lodash','exports','long','TEXT','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4dccb4,_0x1d0061){var _0x59a77b=function(_0x526da8){while(--_0x526da8){_0x4dccb4['push'](_0x4dccb4['shift']());}};_0x59a77b(++_0x1d0061);}(_0x4ef9,0x144));var _0x94ef=function(_0x4557a4,_0x36f89c){_0x4557a4=_0x4557a4-0x0;var _0x4ceb15=_0x4ef9[_0x4557a4];return _0x4ceb15;};'use strict';var Sequelize=require(_0x94ef('0x0'));var _=require(_0x94ef('0x1'));module[_0x94ef('0x2')]={'body':{'type':Sequelize['TEXT'](_0x94ef('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x94ef('0x4')](_0x94ef('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x94ef('0x6')]('in',_0x94ef('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x94ef('0x8')](0x1fe)},'from':{'type':Sequelize[_0x94ef('0x8')]},'to':{'type':Sequelize[_0x94ef('0x4')](_0x94ef('0x3'))},'cc':{'type':Sequelize[_0x94ef('0x4')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x94ef('0x3'))},'subject':{'type':Sequelize[_0x94ef('0x4')]},'sentAt':{'type':Sequelize[_0x94ef('0x9')]},'attach':{'type':Sequelize[_0x94ef('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x94ef('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x94ef('0x9')]},'originTo':{'type':Sequelize[_0x94ef('0x4')](_0x94ef('0x3'))},'originCc':{'type':Sequelize[_0x94ef('0x4')]('long')},'originChannel':{'type':Sequelize[_0x94ef('0x6')](_0x94ef('0xc'),_0x94ef('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1b46caa..832dabe 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 _0xd413=['order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','find','body','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','read','readAt','UserId','user','agent','get','MailInteraction','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','email','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','contact','fullname','internal','rejectmessage','download','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','http','client','request','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','count','limit','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x5be745,_0x190739){var _0x39eac8=function(_0x4ff4bb){while(--_0x4ff4bb){_0x5be745['push'](_0x5be745['shift']());}};_0x39eac8(++_0x190739);}(_0xd413,0x104));var _0x3d41=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xd413[_0x295314];return _0x584b0c;};'use strict';var emlformat=require(_0x3d41('0x0'));var moment=require(_0x3d41('0x1'));var BPromise=require(_0x3d41('0x2'));var util=require(_0x3d41('0x3'));var path=require(_0x3d41('0x4'));var fs=require('fs');var _=require(_0x3d41('0x5'));var Redis=require(_0x3d41('0x6'));var htmlToText=require('html-to-text');var qs=require(_0x3d41('0x7'));var logger=require('../../config/logger')(_0x3d41('0x8'));var interaction_log=require(_0x3d41('0x9'))(_0x3d41('0xa'));var config=require(_0x3d41('0xb'));var db=require(_0x3d41('0xc'))['db'];config[_0x3d41('0xd')]=_[_0x3d41('0xe')](config[_0x3d41('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d41('0xf'))(new Redis(config[_0x3d41('0xd')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')['register'](socket);var jayson=require(_0x3d41('0x10'));var client=jayson['client'][_0x3d41('0x11')]({'port':0x232c});var client9003=jayson[_0x3d41('0x12')][_0x3d41('0x11')]({'port':0x232b});var client9002=jayson[_0x3d41('0x12')][_0x3d41('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2074e2,_0x380cd2,_0x18ce5b,_0x17cdc7){return new BPromise(function(_0x2a0de8,_0xca615e){var _0x260739=_0x17cdc7||client;return _0x260739[_0x3d41('0x13')](_0x2074e2,_0x18ce5b)['then'](function(_0x2e71d8){logger[_0x3d41('0x14')]('MailMessage,\x20%s,\x20%s',_0x380cd2,'request\x20sent');logger[_0x3d41('0x15')](_0x3d41('0x16'),_0x380cd2,'request\x20sent',JSON['stringify'](_0x2e71d8));if(_0x2e71d8[_0x3d41('0x17')]){if(_0x2e71d8[_0x3d41('0x17')][_0x3d41('0x18')]===0x1f4){logger[_0x3d41('0x17')](_0x3d41('0x19'),_0x380cd2,_0x2e71d8[_0x3d41('0x17')][_0x3d41('0x1a')]);return _0xca615e(_0x2e71d8[_0x3d41('0x17')][_0x3d41('0x1a')]);}logger['error'](_0x3d41('0x19'),_0x380cd2,_0x2e71d8[_0x3d41('0x17')][_0x3d41('0x1a')]);return _0x2a0de8(_0x2e71d8[_0x3d41('0x17')]['message']);}else{logger[_0x3d41('0x14')]('MailMessage,\x20%s,\x20%s',_0x380cd2,'request\x20sent');_0x2a0de8(_0x2e71d8['result'][_0x3d41('0x1a')]);}})[_0x3d41('0x1b')](function(_0x2b4ddf){logger[_0x3d41('0x17')]('MailMessage,\x20%s,\x20%s',_0x380cd2,_0x2b4ddf);_0xca615e(_0x2b4ddf);});});}function respondWithResult(_0x347e81,_0x435f6a){_0x435f6a=_0x435f6a||0xc8;return function(_0x1f605e){if(_0x1f605e){return _0x347e81[_0x3d41('0x1c')](_0x435f6a)[_0x3d41('0x1d')](_0x1f605e);}};}function respondWithFilteredResult(_0x18ce76,_0xca8ef9){return function(_0x419992){if(_0x419992){var _0x13a39d=typeof _0xca8ef9[_0x3d41('0x1e')]===_0x3d41('0x1f')&&typeof _0xca8ef9['limit']==='undefined';var _0xaabe94=_0x419992[_0x3d41('0x20')];var _0x35da1c=_0x13a39d?0x0:_0xca8ef9[_0x3d41('0x1e')];var _0x383d63=_0x13a39d?_0x419992['count']:_0xca8ef9[_0x3d41('0x1e')]+_0xca8ef9[_0x3d41('0x21')];var _0x2435f0;if(_0x383d63>=_0xaabe94){_0x383d63=_0xaabe94;_0x2435f0=0xc8;}else{_0x2435f0=0xce;}_0x18ce76['status'](_0x2435f0);return _0x18ce76['set'](_0x3d41('0x22'),_0x35da1c+'-'+_0x383d63+'/'+_0xaabe94)['json'](_0x419992);}return null;};}function saveUpdates(_0x2cbf17){return function(_0x2f5f14){if(_0x2f5f14){return _0x2f5f14[_0x3d41('0x23')](_0x2cbf17)['then'](function(_0x46811f){return _0x46811f;});}return null;};}function removeEntity(_0x1fa581){return function(_0x1afa36){if(_0x1afa36){return _0x1afa36[_0x3d41('0x24')]()[_0x3d41('0x25')](function(){_0x1fa581[_0x3d41('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a5f4){return function(_0x1de9e2){if(!_0x1de9e2){_0x21a5f4[_0x3d41('0x26')](0x194);}return _0x1de9e2;};}function handleError(_0x238289,_0x5d575a){_0x5d575a=_0x5d575a||0x1f4;return function(_0x529e13){logger[_0x3d41('0x17')](_0x529e13[_0x3d41('0x27')]);if(_0x529e13['name']){delete _0x529e13[_0x3d41('0x28')];}_0x238289[_0x3d41('0x1c')](_0x5d575a)[_0x3d41('0x29')](_0x529e13);};}exports[_0x3d41('0x2a')]=function(_0x414c12,_0x424266){var _0x4c3c39={},_0x4c097c={},_0x21ad5b={'count':0x0,'rows':[]};var _0x229ac5=_[_0x3d41('0x2b')](db[_0x3d41('0x2c')][_0x3d41('0x2d')],function(_0x34ded7){return{'name':_0x34ded7[_0x3d41('0x2e')],'type':_0x34ded7[_0x3d41('0x2f')][_0x3d41('0x30')]};});_0x4c097c[_0x3d41('0x31')]=_[_0x3d41('0x2b')](_0x229ac5,_0x3d41('0x28'));_0x4c097c[_0x3d41('0x32')]=_[_0x3d41('0x33')](_0x414c12[_0x3d41('0x32')]);_0x4c097c[_0x3d41('0x34')]=_[_0x3d41('0x35')](_0x4c097c[_0x3d41('0x31')],_0x4c097c[_0x3d41('0x32')]);_0x4c3c39[_0x3d41('0x36')]=_[_0x3d41('0x35')](_0x4c097c[_0x3d41('0x31')],qs[_0x3d41('0x37')](_0x414c12['query'][_0x3d41('0x37')]));_0x4c3c39['attributes']=_0x4c3c39[_0x3d41('0x36')][_0x3d41('0x38')]?_0x4c3c39['attributes']:_0x4c097c['model'];if(!_0x414c12[_0x3d41('0x32')][_0x3d41('0x39')]('nolimit')){_0x4c3c39[_0x3d41('0x21')]=qs[_0x3d41('0x21')](_0x414c12['query'][_0x3d41('0x21')]);_0x4c3c39[_0x3d41('0x1e')]=qs['offset'](_0x414c12[_0x3d41('0x32')][_0x3d41('0x1e')]);}_0x4c3c39[_0x3d41('0x3a')]=qs[_0x3d41('0x3b')](_0x414c12['query'][_0x3d41('0x3b')]);_0x4c3c39[_0x3d41('0x3c')]=qs[_0x3d41('0x34')](_['pick'](_0x414c12[_0x3d41('0x32')],_0x4c097c['filters']),_0x229ac5);if(_0x414c12[_0x3d41('0x32')][_0x3d41('0x3d')]){_0x4c3c39[_0x3d41('0x3c')]=_[_0x3d41('0x3e')](_0x4c3c39['where'],{'$or':_[_0x3d41('0x2b')](_0x229ac5,function(_0x2df5ee){if(_0x2df5ee['type']!==_0x3d41('0x3f')){var _0x1d7e67={};_0x1d7e67[_0x2df5ee[_0x3d41('0x28')]]={'$like':'%'+_0x414c12[_0x3d41('0x32')][_0x3d41('0x3d')]+'%'};return _0x1d7e67;}})});}_0x4c3c39=_[_0x3d41('0x3e')]({},_0x4c3c39,_0x414c12[_0x3d41('0x40')]);var _0x38c7df={'where':_0x4c3c39['where']};return db[_0x3d41('0x2c')]['count'](_0x38c7df)[_0x3d41('0x25')](function(_0x5d63f7){_0x21ad5b[_0x3d41('0x20')]=_0x5d63f7;if(_0x414c12['query']['includeAll']){_0x4c3c39[_0x3d41('0x41')]=[{'all':!![]}];}return db[_0x3d41('0x2c')][_0x3d41('0x42')](_0x4c3c39);})[_0x3d41('0x25')](function(_0x1206cd){_0x21ad5b[_0x3d41('0x43')]=_0x1206cd;return _0x21ad5b;})['then'](respondWithFilteredResult(_0x424266,_0x4c3c39))[_0x3d41('0x1b')](handleError(_0x424266,null));};exports[_0x3d41('0x44')]=function(_0x5ebc11,_0x2cee96){var _0x12a264={'raw':!![],'where':{'id':_0x5ebc11[_0x3d41('0x45')]['id']}},_0x31718e={};_0x31718e[_0x3d41('0x31')]=_[_0x3d41('0x33')](db[_0x3d41('0x2c')][_0x3d41('0x2d')]);_0x31718e[_0x3d41('0x32')]=_[_0x3d41('0x33')](_0x5ebc11['query']);_0x31718e[_0x3d41('0x34')]=_['intersection'](_0x31718e[_0x3d41('0x31')],_0x31718e[_0x3d41('0x32')]);_0x12a264[_0x3d41('0x36')]=_[_0x3d41('0x35')](_0x31718e[_0x3d41('0x31')],qs[_0x3d41('0x37')](_0x5ebc11[_0x3d41('0x32')]['fields']));_0x12a264[_0x3d41('0x36')]=_0x12a264['attributes'][_0x3d41('0x38')]?_0x12a264['attributes']:_0x31718e[_0x3d41('0x31')];if(_0x5ebc11[_0x3d41('0x32')]['includeAll']){_0x12a264[_0x3d41('0x41')]=[{'all':!![]}];}_0x12a264=_[_0x3d41('0x3e')]({},_0x12a264,_0x5ebc11[_0x3d41('0x40')]);return db[_0x3d41('0x2c')][_0x3d41('0x46')](_0x12a264)[_0x3d41('0x25')](handleEntityNotFound(_0x2cee96,null))[_0x3d41('0x25')](respondWithResult(_0x2cee96,null))[_0x3d41('0x1b')](handleError(_0x2cee96,null));};exports['update']=function(_0x189f9d,_0x48d559){if(_0x189f9d[_0x3d41('0x47')]['id']){delete _0x189f9d[_0x3d41('0x47')]['id'];}return db[_0x3d41('0x2c')]['find']({'where':{'id':_0x189f9d[_0x3d41('0x45')]['id']}})['then'](handleEntityNotFound(_0x48d559,null))['then'](saveUpdates(_0x189f9d['body'],null))[_0x3d41('0x25')](respondWithResult(_0x48d559,null))[_0x3d41('0x1b')](handleError(_0x48d559,null));};exports['destroy']=function(_0x1bfa0c,_0x4e4364){return db[_0x3d41('0x2c')]['find']({'where':{'id':_0x1bfa0c[_0x3d41('0x45')]['id']}})[_0x3d41('0x25')](handleEntityNotFound(_0x4e4364,null))[_0x3d41('0x25')](removeEntity(_0x4e4364,null))['catch'](handleError(_0x4e4364,null));};exports['describe']=function(_0x3b01b1,_0x4b67a5){return db['MailMessage']['describe']()[_0x3d41('0x25')](respondWithResult(_0x4b67a5,null))['catch'](handleError(_0x4b67a5,null));};exports[_0x3d41('0x48')]=function(_0x4c6c39,_0x5635fd){return db['MailMessage'][_0x3d41('0x48')](_0x4c6c39[_0x3d41('0x47')])[_0x3d41('0x25')](function(_0x178d93){if(_0x178d93){if(_0x178d93[_0x3d41('0x49')]==='out'&&!_0x178d93[_0x3d41('0x4a')]){var _0x569a80,_0x571b05,_0x1127a0;if(_0x4c6c39['body']['to']){_0x571b05=_0x4c6c39[_0x3d41('0x47')]['to'][_0x3d41('0x4b')](',')[0x0];}return db[_0x3d41('0x4c')][_0x3d41('0x4d')]({'where':{'id':_0x178d93[_0x3d41('0x4e')]},'include':[{'model':db[_0x3d41('0x4f')],'as':_0x3d41('0x50'),'include':[{'model':db[_0x3d41('0x51')],'as':_0x3d41('0x52'),'where':{'email':_0x571b05},'limit':0x1,'order':[[_0x3d41('0x53'),_0x3d41('0x54')]]}]},{'model':db[_0x3d41('0x55')],'as':_0x3d41('0x56'),'raw':!![],'include':[{'model':db[_0x3d41('0x57')],'as':_0x3d41('0x57'),'raw':!![]}]}]})[_0x3d41('0x25')](function(_0x1acda1){_0x569a80=_0x1acda1;if(!_0x569a80||!_0x569a80['Smtp'])return;var _0x23138d=_0x569a80[_0x3d41('0x58')]();if(_0x4c6c39['body']['attachments']&&_0x4c6c39[_0x3d41('0x47')][_0x3d41('0x59')][_0x3d41('0x38')]){for(var _0x3732c5=0x0;_0x3732c5<_0x4c6c39[_0x3d41('0x47')][_0x3d41('0x59')]['length'];_0x3732c5+=0x1){_0x4c6c39['body'][_0x3d41('0x59')][_0x3732c5]={'filename':_0x4c6c39[_0x3d41('0x47')][_0x3d41('0x59')][_0x3732c5][_0x3d41('0x28')],'path':path[_0x3d41('0x5a')](config['root'],_0x3d41('0x5b'),_0x4c6c39[_0x3d41('0x47')]['attachments'][_0x3732c5][_0x3d41('0x5c')])};}}_0x1127a0={'account':_0x23138d,'message':_0x4c6c39['body']};return;})['then'](function(){if(_0x569a80[_0x3d41('0x50')]){if(_0x569a80[_0x3d41('0x50')][_0x3d41('0x52')][_0x3d41('0x38')]){return _0x569a80['List'][_0x3d41('0x52')][0x0];}else{return db[_0x3d41('0x51')]['create'](_[_0x3d41('0xe')](_0x4c6c39[_0x3d41('0x47')],{'firstName':_0x4c6c39[_0x3d41('0x47')]['to'],'email':_0x4c6c39[_0x3d41('0x47')]['to'],'phone':_0x4c6c39['body']['to'],'ListId':_0x569a80[_0x3d41('0x5d')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x3d41('0x25')](function(){if(_0x1127a0){return respondWithRpcPromise(_0x3d41('0x5e'),_0x3d41('0x5f'),_0x1127a0,client9003)['then'](function(_0x2a1540){return _0x178d93[_0x3d41('0x23')]({'read':!![],'messageId':_0x2a1540[_0x3d41('0x60')],'sentAt':moment()['format'](_0x3d41('0x61'))});})[_0x3d41('0x1b')](function(_0x45794f){logger['error']('%s',JSON[_0x3d41('0x62')](_0x45794f));return _0x178d93;});}return _0x178d93;});}return _0x178d93;}})['then'](respondWithResult(_0x5635fd,0xc9))['catch'](handleError(_0x5635fd,null));};exports[_0x3d41('0x63')]=function(_0x2225c5,_0x16a473){var _0x2049d4={'agent':{},'channel':'mail'};if(_0x2225c5[_0x3d41('0x47')]['id']){delete _0x2225c5['body']['id'];}_0x2225c5[_0x3d41('0x47')][_0x3d41('0x64')]=!![];_0x2225c5['body'][_0x3d41('0x65')]=moment()['format'](_0x3d41('0x61'));_0x2225c5[_0x3d41('0x47')][_0x3d41('0x66')]=_0x2225c5[_0x3d41('0x47')]['UserId']||_0x2225c5[_0x3d41('0x67')]['id'];_0x2049d4[_0x3d41('0x68')]['id']=_0x2225c5[_0x3d41('0x47')]['UserId'];return db[_0x3d41('0x2c')][_0x3d41('0x46')]({'where':{'id':_0x2225c5['params']['id'],'UserId':null}})[_0x3d41('0x25')](handleEntityNotFound(_0x16a473,null))[_0x3d41('0x25')](saveUpdates(_0x2225c5['body'],null))['then'](function(_0x3f23f1){if(_0x3f23f1){_0x2049d4[_0x3d41('0x1a')]=_0x3f23f1[_0x3d41('0x69')]({'plain':!![]});return db[_0x3d41('0x6a')][_0x3d41('0x46')]({'where':{'id':_0x3f23f1['MailInteractionId']}});}return null;})[_0x3d41('0x25')](handleEntityNotFound(_0x16a473,null))[_0x3d41('0x25')](function(_0x2e4daf){if(_0x2e4daf){return _0x2e4daf[_0x3d41('0x23')]({'UserId':_0x2225c5[_0x3d41('0x47')]['UserId'],'read1stAt':_['isNil'](_0x2e4daf['read1stAt'])?moment()[_0x3d41('0x6b')](_0x3d41('0x61')):undefined});}return null;})['then'](function(_0x2de3b2){if(_0x2de3b2){_0x2049d4[_0x3d41('0x6c')]=_0x2de3b2[_0x3d41('0x69')]({'plain':!![]});interaction_log[_0x3d41('0x14')](_0x3d41('0x6d'),_0x2225c5[_0x3d41('0x67')]['id'],_0x2225c5[_0x3d41('0x67')]['name'],_0x2225c5[_0x3d41('0x67')][_0x3d41('0x6e')],_0x2049d4[_0x3d41('0x6c')]['id'],_0x2225c5[_0x3d41('0x47')]?JSON[_0x3d41('0x62')](_0x2225c5['body']):_0x3d41('0x6f'));return respondWithRpcPromise(_0x3d41('0x70'),_0x3d41('0x71'),_0x2049d4);}return null;})['then'](function(_0x48615c){var _0x3b489b=_0x3d41('0x72')+_0x48615c[_0x3d41('0x1a')][_0x3d41('0x73')];return db[_0x3d41('0x74')]['query'](_0x3b489b,{'type':db[_0x3d41('0x75')]['QueryTypes'][_0x3d41('0x76')],'raw':!![]})[_0x3d41('0x25')](function(_0x1edc8e){return _0x1edc8e;});})['then'](function(_0x44a021){if(_0x44a021){_0x2049d4[_0x3d41('0x1a')]['contact']=_0x44a021[0x0];if(!_0x2225c5['body'][_0x3d41('0x66')])return;return db[_0x3d41('0x77')]['find']({'where':{'id':_0x2225c5[_0x3d41('0x47')][_0x3d41('0x66')],'role':_0x3d41('0x68')},'attributes':['id','name','fullname',_0x3d41('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x16bd10){if(!_0x16bd10)return null;_0x2049d4[_0x3d41('0x1a')][_0x3d41('0x68')]=_0x16bd10;return _0x2049d4;})[_0x3d41('0x25')](function(_0x152012){if(_0x152012){if(_0x2225c5['body']['manual']){_0x2049d4[_0x3d41('0x1a')][_0x3d41('0x79')]=util[_0x3d41('0x6b')](_0x3d41('0x7a'),_0x2225c5[_0x3d41('0x67')][_0x3d41('0x28')]);_0x2049d4[_0x3d41('0x1a')][_0x3d41('0x7b')]=_0x2049d4[_0x3d41('0x7b')];_0x2049d4[_0x3d41('0x1a')][_0x3d41('0x7c')]=_0x2049d4[_0x3d41('0x7b')];_0x2049d4['message'][_0x3d41('0x7d')]=_0x3d41('0x63');_0x2049d4[_0x3d41('0x1a')][_0x3d41('0x47')]=htmlToText[_0x3d41('0x7e')](_0x2049d4[_0x3d41('0x1a')][_0x3d41('0x47')]);return respondWithRpcPromise(_0x3d41('0x7f'),_0x3d41('0x7f'),{'event':'acceptmessage','message':_0x2049d4['message']},client9002)[_0x3d41('0x25')](function(){return _0x2049d4;});}return _0x2049d4;}return null;})[_0x3d41('0x25')](respondWithResult(_0x16a473,null))[_0x3d41('0x1b')](handleError(_0x16a473,null));};exports[_0x3d41('0x80')]=function(_0x53e799,_0x3ef032){var _0x2b49c4={'agent':{},'channel':'mail'};if(_0x53e799[_0x3d41('0x47')]['id']){delete _0x53e799[_0x3d41('0x47')]['id'];}_0x53e799[_0x3d41('0x47')][_0x3d41('0x66')]=_0x53e799[_0x3d41('0x47')][_0x3d41('0x66')]||_0x53e799['user']['id'];_0x2b49c4[_0x3d41('0x68')]['id']=_0x53e799[_0x3d41('0x47')][_0x3d41('0x66')];return db[_0x3d41('0x2c')][_0x3d41('0x46')]({'where':{'id':_0x53e799[_0x3d41('0x45')]['id'],'UserId':null}})[_0x3d41('0x25')](handleEntityNotFound(_0x3ef032,null))[_0x3d41('0x25')](function(_0x4d86fa){if(_0x4d86fa){_0x2b49c4[_0x3d41('0x1a')]=_0x4d86fa[_0x3d41('0x69')]({'plain':!![]});return db[_0x3d41('0x6a')][_0x3d41('0x46')]({'where':{'id':_0x4d86fa[_0x3d41('0x81')]}});}return null;})[_0x3d41('0x25')](handleEntityNotFound(_0x3ef032,null))[_0x3d41('0x25')](function(_0x1014f0){if(_0x1014f0){_0x2b49c4[_0x3d41('0x6c')]=_0x1014f0[_0x3d41('0x69')]({'plain':!![]});interaction_log[_0x3d41('0x14')](_0x3d41('0x82'),_0x53e799[_0x3d41('0x67')]['id'],_0x53e799[_0x3d41('0x67')]['name'],_0x53e799['user'][_0x3d41('0x6e')],_0x2b49c4['interaction']['id'],_0x53e799[_0x3d41('0x47')]?JSON[_0x3d41('0x62')](_0x53e799[_0x3d41('0x47')]):_0x3d41('0x6f'));return respondWithRpcPromise(_0x3d41('0x83'),_0x3d41('0x84'),_0x2b49c4);}return null;})[_0x3d41('0x25')](function(_0x39e62b){var _0x4fce24=_0x3d41('0x72')+_0x39e62b['message'][_0x3d41('0x73')];return db[_0x3d41('0x74')]['query'](_0x4fce24,{'type':db['Sequelize'][_0x3d41('0x85')][_0x3d41('0x76')],'raw':!![]})[_0x3d41('0x25')](function(_0x49c04a){return _0x49c04a;});})[_0x3d41('0x25')](function(_0x5749d5){if(_0x5749d5){_0x2b49c4[_0x3d41('0x1a')][_0x3d41('0x86')]=_0x5749d5[0x0];if(!_0x53e799[_0x3d41('0x47')][_0x3d41('0x66')])return;return db[_0x3d41('0x77')][_0x3d41('0x46')]({'where':{'id':_0x53e799[_0x3d41('0x47')][_0x3d41('0x66')],'role':_0x3d41('0x68')},'attributes':['id',_0x3d41('0x28'),_0x3d41('0x87'),_0x3d41('0x78'),_0x3d41('0x88')],'raw':!![]});}return null;})['then'](function(_0x5b1ca2){if(!_0x5b1ca2)return null;_0x2b49c4[_0x3d41('0x1a')][_0x3d41('0x68')]=_0x5b1ca2;return _0x2b49c4;})[_0x3d41('0x25')](function(_0x5ec3f9){if(_0x5ec3f9){_0x5ec3f9['message'][_0x3d41('0x79')]=util[_0x3d41('0x6b')](_0x3d41('0x7a'),_0x53e799[_0x3d41('0x67')][_0x3d41('0x28')]);_0x5ec3f9[_0x3d41('0x1a')][_0x3d41('0x7b')]=_0x2b49c4[_0x3d41('0x7b')];_0x5ec3f9['message'][_0x3d41('0x7c')]=_0x2b49c4['channel'];_0x5ec3f9['message']['event']=_0x3d41('0x80');_0x5ec3f9[_0x3d41('0x1a')][_0x3d41('0x47')]=htmlToText[_0x3d41('0x7e')](_0x2b49c4[_0x3d41('0x1a')][_0x3d41('0x47')]);respondWithRpcPromise(_0x3d41('0x7f'),'EventManager',{'event':_0x3d41('0x89'),'message':_0x5ec3f9['message']},client9002);return _0x2b49c4;}return null;})[_0x3d41('0x25')](respondWithResult(_0x3ef032,null))[_0x3d41('0x1b')](handleError(_0x3ef032,null));};exports[_0x3d41('0x8a')]=function(_0x2625b1,_0x320d78){var _0x1be65b=moment()['unix']()[_0x3d41('0x8b')]();var _0x13dfb8=path[_0x3d41('0x5a')](config[_0x3d41('0x8c')],_0x3d41('0x8d'),_0x3d41('0x8e'),_0x3d41('0x8f'));var _0x36cd5f=path['join'](config[_0x3d41('0x8c')],'server',_0x3d41('0x8e'),_0x3d41('0x59'));var _0x2ee3da=util['format'](_0x3d41('0x90'),_0x1be65b);return db['MailMessage']['find']({'where':{'id':_0x2625b1['params']['id']},'attributes':['id',_0x3d41('0x47'),_0x3d41('0x91'),'to','cc',_0x3d41('0x92'),_0x3d41('0x93'),_0x3d41('0x94')],'include':_0x2625b1[_0x3d41('0x32')][_0x3d41('0x59')]?[{'model':db[_0x3d41('0x95')],'as':_0x3d41('0x96')}]:undefined})['then'](handleEntityNotFound(_0x320d78,null))[_0x3d41('0x25')](function(_0x39117e){if(_0x39117e){var _0xdf5874=_0x39117e;var _0x10ad1f={'from':_0xdf5874[_0x3d41('0x91')],'to':_0xdf5874['to'],'subject':_0xdf5874[_0x3d41('0x93')],'html':htmlEntities[_0x3d41('0x97')](_0xdf5874[_0x3d41('0x47')]),'headers':{'Date':moment(_0xdf5874['createdAt'])[_0x3d41('0x6b')](_0x3d41('0x98'))},'attachments':[]};if(_0x39117e['cc']){_0x10ad1f[_0x3d41('0x99')]['Cc']=_0x39117e['cc'];}if(_0x39117e[_0x3d41('0x92')]){_0x10ad1f[_0x3d41('0x99')][_0x3d41('0x9a')]=_0x39117e[_0x3d41('0x92')];}return new BPromise(function(_0x355d51,_0x1a02a8){if(_0x39117e[_0x3d41('0x96')]){for(var _0x50a433=0x0;_0x50a433<_0x39117e[_0x3d41('0x96')]['length'];_0x50a433++){var _0x5aa432=_0x39117e['Attachments'][_0x50a433];var _0x3ecdd5=path['join'](_0x36cd5f,_0x5aa432['basename']);if(fs['existsSync'](_0x3ecdd5)){_0x10ad1f[_0x3d41('0x59')][_0x3d41('0x9b')]({'name':_0x5aa432[_0x3d41('0x28')],'contentType':_0x5aa432[_0x3d41('0x2f')],'data':fs[_0x3d41('0x9c')](_0x3ecdd5)});}}}emlformat['build'](_0x10ad1f,function(_0x2ec284,_0x3d6eaa){if(_0x2ec284)return _0x1a02a8(_0x2ec284);fs[_0x3d41('0x9d')](path[_0x3d41('0x5a')](_0x13dfb8,_0x2ee3da),_0x3d6eaa);return _0x355d51(_0x3d6eaa);});});}})['then'](function(_0x21a64b){if(_0x21a64b){return _0x320d78[_0x3d41('0x8a')](path[_0x3d41('0x5a')](_0x13dfb8,_0x2ee3da),_0x2ee3da,function(_0x47dc51){if(!_0x47dc51)fs[_0x3d41('0x9e')](path[_0x3d41('0x5a')](_0x13dfb8,_0x2ee3da));});}})[_0x3d41('0x1b')](handleError(_0x320d78,null));}; \ No newline at end of file +var _0x0f3d=['redis','defaults','socket.io-emitter','html-entities','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','offset','undefined','limit','count','set','Content-Range','json','update','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','catch','params','include','options','find','body','destroy','describe','create','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','ListId','List\x20not\x20found','SendMail','messageId','format','stringify','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','interface','reject','rejectmessage','download','unix','tmp','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb'];(function(_0xabcd4d,_0x4b2104){var _0x40969a=function(_0x4521bc){while(--_0x4521bc){_0xabcd4d['push'](_0xabcd4d['shift']());}};_0x40969a(++_0x4b2104);}(_0x0f3d,0x1d4));var _0xd0f3=function(_0x6ae986,_0x51f323){_0x6ae986=_0x6ae986-0x0;var _0x5ee0d7=_0x0f3d[_0x6ae986];return _0x5ee0d7;};'use strict';var emlformat=require(_0xd0f3('0x0'));var moment=require(_0xd0f3('0x1'));var BPromise=require(_0xd0f3('0x2'));var util=require(_0xd0f3('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xd0f3('0x4'));var Redis=require(_0xd0f3('0x5'));var htmlToText=require(_0xd0f3('0x6'));var qs=require(_0xd0f3('0x7'));var logger=require(_0xd0f3('0x8'))(_0xd0f3('0x9'));var interaction_log=require(_0xd0f3('0x8'))(_0xd0f3('0xa'));var config=require('../../config/environment');var db=require(_0xd0f3('0xb'))['db'];config[_0xd0f3('0xc')]=_[_0xd0f3('0xd')](config[_0xd0f3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0f3('0xe'))(new Redis(config[_0xd0f3('0xc')]));var htmlEntities=require(_0xd0f3('0xf'));require('./mailMessage.socket')[_0xd0f3('0x10')](socket);var jayson=require(_0xd0f3('0x11'));var client=jayson[_0xd0f3('0x12')][_0xd0f3('0x13')]({'port':0x232c});var client9003=jayson[_0xd0f3('0x12')][_0xd0f3('0x13')]({'port':0x232b});var client9002=jayson[_0xd0f3('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4038ab,_0x5338e2,_0x373c1c,_0x3849b9){return new BPromise(function(_0x354d06,_0x211323){var _0x1c6cb7=_0x3849b9||client;return _0x1c6cb7['request'](_0x4038ab,_0x373c1c)[_0xd0f3('0x14')](function(_0x337595){logger[_0xd0f3('0x15')](_0xd0f3('0x16'),_0x5338e2,_0xd0f3('0x17'));logger[_0xd0f3('0x18')](_0xd0f3('0x19'),_0x5338e2,'request\x20sent',JSON['stringify'](_0x337595));if(_0x337595[_0xd0f3('0x1a')]){if(_0x337595[_0xd0f3('0x1a')][_0xd0f3('0x1b')]===0x1f4){logger[_0xd0f3('0x1a')](_0xd0f3('0x16'),_0x5338e2,_0x337595[_0xd0f3('0x1a')][_0xd0f3('0x1c')]);return _0x211323(_0x337595[_0xd0f3('0x1a')]['message']);}logger[_0xd0f3('0x1a')]('MailMessage,\x20%s,\x20%s',_0x5338e2,_0x337595['error'][_0xd0f3('0x1c')]);return _0x354d06(_0x337595[_0xd0f3('0x1a')][_0xd0f3('0x1c')]);}else{logger[_0xd0f3('0x15')]('MailMessage,\x20%s,\x20%s',_0x5338e2,_0xd0f3('0x17'));_0x354d06(_0x337595[_0xd0f3('0x1d')][_0xd0f3('0x1c')]);}})['catch'](function(_0x443979){logger['error'](_0xd0f3('0x16'),_0x5338e2,_0x443979);_0x211323(_0x443979);});});}function respondWithResult(_0x3d9f24,_0x4abf5d){_0x4abf5d=_0x4abf5d||0xc8;return function(_0x531127){if(_0x531127){return _0x3d9f24[_0xd0f3('0x1e')](_0x4abf5d)['json'](_0x531127);}};}function respondWithFilteredResult(_0x44bc0c,_0x356d8e){return function(_0x2b68fe){if(_0x2b68fe){var _0x5c6136=typeof _0x356d8e[_0xd0f3('0x1f')]===_0xd0f3('0x20')&&typeof _0x356d8e[_0xd0f3('0x21')]==='undefined';var _0x1a2b77=_0x2b68fe[_0xd0f3('0x22')];var _0x3b3cb9=_0x5c6136?0x0:_0x356d8e[_0xd0f3('0x1f')];var _0x414138=_0x5c6136?_0x2b68fe[_0xd0f3('0x22')]:_0x356d8e['offset']+_0x356d8e['limit'];var _0x2a3c3a;if(_0x414138>=_0x1a2b77){_0x414138=_0x1a2b77;_0x2a3c3a=0xc8;}else{_0x2a3c3a=0xce;}_0x44bc0c['status'](_0x2a3c3a);return _0x44bc0c[_0xd0f3('0x23')](_0xd0f3('0x24'),_0x3b3cb9+'-'+_0x414138+'/'+_0x1a2b77)[_0xd0f3('0x25')](_0x2b68fe);}return null;};}function saveUpdates(_0x36063c){return function(_0x30562a){if(_0x30562a){return _0x30562a[_0xd0f3('0x26')](_0x36063c)['then'](function(_0x1cc649){return _0x1cc649;});}return null;};}function removeEntity(_0x13c771){return function(_0x248250){if(_0x248250){return _0x248250['destroy']()[_0xd0f3('0x14')](function(){_0x13c771[_0xd0f3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11a839){return function(_0x4337e6){if(!_0x4337e6){_0x11a839['sendStatus'](0x194);}return _0x4337e6;};}function handleError(_0x1ef5f8,_0x5ef67f){_0x5ef67f=_0x5ef67f||0x1f4;return function(_0x76346f){logger[_0xd0f3('0x1a')](_0x76346f[_0xd0f3('0x27')]);if(_0x76346f['name']){delete _0x76346f[_0xd0f3('0x28')];}_0x1ef5f8[_0xd0f3('0x1e')](_0x5ef67f)[_0xd0f3('0x29')](_0x76346f);};}exports[_0xd0f3('0x2a')]=function(_0x1357a,_0x4e1cb){var _0x53fa7e={},_0x5a9508={},_0x269767={'count':0x0,'rows':[]};var _0x13c990=_[_0xd0f3('0x2b')](db[_0xd0f3('0x2c')][_0xd0f3('0x2d')],function(_0x2ac96f){return{'name':_0x2ac96f[_0xd0f3('0x2e')],'type':_0x2ac96f[_0xd0f3('0x2f')][_0xd0f3('0x30')]};});_0x5a9508[_0xd0f3('0x31')]=_[_0xd0f3('0x2b')](_0x13c990,_0xd0f3('0x28'));_0x5a9508['query']=_[_0xd0f3('0x32')](_0x1357a[_0xd0f3('0x33')]);_0x5a9508[_0xd0f3('0x34')]=_[_0xd0f3('0x35')](_0x5a9508[_0xd0f3('0x31')],_0x5a9508[_0xd0f3('0x33')]);_0x53fa7e[_0xd0f3('0x36')]=_[_0xd0f3('0x35')](_0x5a9508[_0xd0f3('0x31')],qs[_0xd0f3('0x37')](_0x1357a['query'][_0xd0f3('0x37')]));_0x53fa7e[_0xd0f3('0x36')]=_0x53fa7e['attributes'][_0xd0f3('0x38')]?_0x53fa7e[_0xd0f3('0x36')]:_0x5a9508[_0xd0f3('0x31')];if(!_0x1357a[_0xd0f3('0x33')][_0xd0f3('0x39')](_0xd0f3('0x3a'))){_0x53fa7e[_0xd0f3('0x21')]=qs[_0xd0f3('0x21')](_0x1357a[_0xd0f3('0x33')]['limit']);_0x53fa7e[_0xd0f3('0x1f')]=qs[_0xd0f3('0x1f')](_0x1357a[_0xd0f3('0x33')][_0xd0f3('0x1f')]);}_0x53fa7e[_0xd0f3('0x3b')]=qs[_0xd0f3('0x3c')](_0x1357a['query']['sort']);_0x53fa7e[_0xd0f3('0x3d')]=qs['filters'](_[_0xd0f3('0x3e')](_0x1357a[_0xd0f3('0x33')],_0x5a9508[_0xd0f3('0x34')]),_0x13c990);if(_0x1357a[_0xd0f3('0x33')][_0xd0f3('0x3f')]){_0x53fa7e[_0xd0f3('0x3d')]=_[_0xd0f3('0x40')](_0x53fa7e['where'],{'$or':_['map'](_0x13c990,function(_0x9b1caa){if(_0x9b1caa[_0xd0f3('0x2f')]!=='VIRTUAL'){var _0x2372b8={};_0x2372b8[_0x9b1caa[_0xd0f3('0x28')]]={'$like':'%'+_0x1357a[_0xd0f3('0x33')]['filter']+'%'};return _0x2372b8;}})});}_0x53fa7e=_['merge']({},_0x53fa7e,_0x1357a['options']);var _0x2598fd={'where':_0x53fa7e['where']};return db[_0xd0f3('0x2c')][_0xd0f3('0x22')](_0x2598fd)[_0xd0f3('0x14')](function(_0x3b3fe8){_0x269767[_0xd0f3('0x22')]=_0x3b3fe8;if(_0x1357a[_0xd0f3('0x33')][_0xd0f3('0x41')]){_0x53fa7e['include']=[{'all':!![]}];}return db[_0xd0f3('0x2c')][_0xd0f3('0x42')](_0x53fa7e);})[_0xd0f3('0x14')](function(_0x2dc3ba){_0x269767['rows']=_0x2dc3ba;return _0x269767;})[_0xd0f3('0x14')](respondWithFilteredResult(_0x4e1cb,_0x53fa7e))[_0xd0f3('0x43')](handleError(_0x4e1cb,null));};exports['show']=function(_0x58ff24,_0xb2d1d0){var _0xcb46c1={'raw':!![],'where':{'id':_0x58ff24[_0xd0f3('0x44')]['id']}},_0x37a004={};_0x37a004[_0xd0f3('0x31')]=_[_0xd0f3('0x32')](db['MailMessage'][_0xd0f3('0x2d')]);_0x37a004[_0xd0f3('0x33')]=_[_0xd0f3('0x32')](_0x58ff24[_0xd0f3('0x33')]);_0x37a004['filters']=_[_0xd0f3('0x35')](_0x37a004[_0xd0f3('0x31')],_0x37a004[_0xd0f3('0x33')]);_0xcb46c1[_0xd0f3('0x36')]=_['intersection'](_0x37a004['model'],qs[_0xd0f3('0x37')](_0x58ff24[_0xd0f3('0x33')]['fields']));_0xcb46c1[_0xd0f3('0x36')]=_0xcb46c1[_0xd0f3('0x36')][_0xd0f3('0x38')]?_0xcb46c1[_0xd0f3('0x36')]:_0x37a004[_0xd0f3('0x31')];if(_0x58ff24['query'][_0xd0f3('0x41')]){_0xcb46c1[_0xd0f3('0x45')]=[{'all':!![]}];}_0xcb46c1=_[_0xd0f3('0x40')]({},_0xcb46c1,_0x58ff24[_0xd0f3('0x46')]);return db[_0xd0f3('0x2c')][_0xd0f3('0x47')](_0xcb46c1)[_0xd0f3('0x14')](handleEntityNotFound(_0xb2d1d0,null))[_0xd0f3('0x14')](respondWithResult(_0xb2d1d0,null))[_0xd0f3('0x43')](handleError(_0xb2d1d0,null));};exports[_0xd0f3('0x26')]=function(_0x21f79f,_0x4945e3){if(_0x21f79f[_0xd0f3('0x48')]['id']){delete _0x21f79f['body']['id'];}return db['MailMessage'][_0xd0f3('0x47')]({'where':{'id':_0x21f79f[_0xd0f3('0x44')]['id']}})[_0xd0f3('0x14')](handleEntityNotFound(_0x4945e3,null))[_0xd0f3('0x14')](saveUpdates(_0x21f79f[_0xd0f3('0x48')],null))[_0xd0f3('0x14')](respondWithResult(_0x4945e3,null))[_0xd0f3('0x43')](handleError(_0x4945e3,null));};exports[_0xd0f3('0x49')]=function(_0x15f0c6,_0xfea142){return db[_0xd0f3('0x2c')][_0xd0f3('0x47')]({'where':{'id':_0x15f0c6[_0xd0f3('0x44')]['id']}})[_0xd0f3('0x14')](handleEntityNotFound(_0xfea142,null))[_0xd0f3('0x14')](removeEntity(_0xfea142,null))[_0xd0f3('0x43')](handleError(_0xfea142,null));};exports[_0xd0f3('0x4a')]=function(_0x28df91,_0x435408){return db[_0xd0f3('0x2c')]['describe']()['then'](respondWithResult(_0x435408,null))['catch'](handleError(_0x435408,null));};exports[_0xd0f3('0x4b')]=function(_0x278439,_0x34f826){return db[_0xd0f3('0x2c')][_0xd0f3('0x4b')](_0x278439[_0xd0f3('0x48')])['then'](function(_0x3489da){if(_0x3489da){if(_0x3489da['direction']===_0xd0f3('0x4c')&&!_0x3489da['secret']){var _0x4fdddf,_0x3d3f37,_0x51c30f;if(_0x278439[_0xd0f3('0x48')]['to']){_0x3d3f37=_0x278439['body']['to'][_0xd0f3('0x4d')](',')[0x0];}return db[_0xd0f3('0x4e')][_0xd0f3('0x4f')]({'where':{'id':_0x3489da[_0xd0f3('0x50')]},'include':[{'model':db[_0xd0f3('0x51')],'as':_0xd0f3('0x52'),'include':[{'model':db[_0xd0f3('0x53')],'as':_0xd0f3('0x54'),'where':{'email':_0x3d3f37},'limit':0x1,'order':[[_0xd0f3('0x55'),_0xd0f3('0x56')]]}]},{'model':db[_0xd0f3('0x57')],'as':_0xd0f3('0x58'),'raw':!![],'include':[{'model':db[_0xd0f3('0x59')],'as':'CloudProvider','raw':!![]}]}]})[_0xd0f3('0x14')](function(_0x1b3352){_0x4fdddf=_0x1b3352;if(!_0x4fdddf||!_0x4fdddf[_0xd0f3('0x58')])return;var _0xff9ba5=_0x4fdddf[_0xd0f3('0x5a')]();if(_0x278439[_0xd0f3('0x48')][_0xd0f3('0x5b')]&&_0x278439[_0xd0f3('0x48')][_0xd0f3('0x5b')]['length']){for(var _0x3775b7=0x0;_0x3775b7<_0x278439['body']['attachments'][_0xd0f3('0x38')];_0x3775b7+=0x1){_0x278439[_0xd0f3('0x48')][_0xd0f3('0x5b')][_0x3775b7]={'filename':_0x278439[_0xd0f3('0x48')][_0xd0f3('0x5b')][_0x3775b7][_0xd0f3('0x28')],'path':path[_0xd0f3('0x5c')](config[_0xd0f3('0x5d')],'server/files/attachments',_0x278439['body']['attachments'][_0x3775b7]['basename'])};}}_0x51c30f={'account':_0xff9ba5,'message':_0x278439[_0xd0f3('0x48')]};return;})[_0xd0f3('0x14')](function(){if(_0x4fdddf['List']){if(_0x4fdddf[_0xd0f3('0x52')][_0xd0f3('0x54')]['length']){return _0x4fdddf[_0xd0f3('0x52')]['Contacts'][0x0];}else{return db[_0xd0f3('0x53')]['create'](_[_0xd0f3('0xd')](_0x278439[_0xd0f3('0x48')],{'firstName':_0x278439['body']['to'],'email':_0x278439[_0xd0f3('0x48')]['to'],'phone':_0x278439[_0xd0f3('0x48')]['to'],'ListId':_0x4fdddf[_0xd0f3('0x5e')]}));}}else{throw new Error(_0xd0f3('0x5f'));}})['then'](function(){if(_0x51c30f){return respondWithRpcPromise(_0xd0f3('0x60'),'sendMail',_0x51c30f,client9003)[_0xd0f3('0x14')](function(_0x2955de){return _0x3489da[_0xd0f3('0x26')]({'read':!![],'messageId':_0x2955de[_0xd0f3('0x61')],'sentAt':moment()[_0xd0f3('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd0f3('0x43')](function(_0x39a274){logger[_0xd0f3('0x1a')]('%s',JSON[_0xd0f3('0x63')](_0x39a274));return _0x3489da;});}return _0x3489da;});}return _0x3489da;}})[_0xd0f3('0x14')](respondWithResult(_0x34f826,0xc9))[_0xd0f3('0x43')](handleError(_0x34f826,null));};exports[_0xd0f3('0x64')]=function(_0x20bd48,_0x2b3713){var _0x3d27f2={'agent':{},'channel':_0xd0f3('0x65')};if(_0x20bd48[_0xd0f3('0x48')]['id']){delete _0x20bd48[_0xd0f3('0x48')]['id'];}_0x20bd48[_0xd0f3('0x48')][_0xd0f3('0x66')]=!![];_0x20bd48[_0xd0f3('0x48')][_0xd0f3('0x67')]=moment()[_0xd0f3('0x62')](_0xd0f3('0x68'));_0x20bd48[_0xd0f3('0x48')]['UserId']=_0x20bd48[_0xd0f3('0x48')][_0xd0f3('0x69')]||_0x20bd48[_0xd0f3('0x6a')]['id'];_0x3d27f2['agent']['id']=_0x20bd48[_0xd0f3('0x48')][_0xd0f3('0x69')];return db[_0xd0f3('0x2c')][_0xd0f3('0x47')]({'where':{'id':_0x20bd48[_0xd0f3('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b3713,null))[_0xd0f3('0x14')](saveUpdates(_0x20bd48[_0xd0f3('0x48')],null))[_0xd0f3('0x14')](function(_0x4455c){if(_0x4455c){_0x3d27f2['message']=_0x4455c[_0xd0f3('0x6b')]({'plain':!![]});return db[_0xd0f3('0x6c')][_0xd0f3('0x47')]({'where':{'id':_0x4455c[_0xd0f3('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x2b3713,null))['then'](function(_0x56cf5c){if(_0x56cf5c){return _0x56cf5c[_0xd0f3('0x26')]({'UserId':_0x20bd48[_0xd0f3('0x48')]['UserId'],'read1stAt':_['isNil'](_0x56cf5c['read1stAt'])?moment()[_0xd0f3('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd0f3('0x14')](function(_0x31b027){if(_0x31b027){_0x3d27f2[_0xd0f3('0x6e')]=_0x31b027['get']({'plain':!![]});interaction_log[_0xd0f3('0x15')](_0xd0f3('0x6f'),_0x20bd48[_0xd0f3('0x6a')]['id'],_0x20bd48[_0xd0f3('0x6a')][_0xd0f3('0x28')],_0x20bd48[_0xd0f3('0x6a')][_0xd0f3('0x70')],_0x3d27f2[_0xd0f3('0x6e')]['id'],_0x20bd48[_0xd0f3('0x48')]?JSON[_0xd0f3('0x63')](_0x20bd48[_0xd0f3('0x48')]):_0xd0f3('0x71'));return respondWithRpcPromise('AcceptMessage',_0xd0f3('0x72'),_0x3d27f2);}return null;})[_0xd0f3('0x14')](function(_0x38059f){var _0x2f8b2=_0xd0f3('0x73')+_0x38059f[_0xd0f3('0x1c')][_0xd0f3('0x74')];return db['sequelize'][_0xd0f3('0x33')](_0x2f8b2,{'type':db[_0xd0f3('0x75')][_0xd0f3('0x76')][_0xd0f3('0x77')],'raw':!![]})[_0xd0f3('0x14')](function(_0x483ba7){return _0x483ba7;});})[_0xd0f3('0x14')](function(_0xc74530){if(_0xc74530){_0x3d27f2[_0xd0f3('0x1c')][_0xd0f3('0x78')]=_0xc74530[0x0];if(!_0x20bd48[_0xd0f3('0x48')][_0xd0f3('0x69')])return;return db[_0xd0f3('0x79')][_0xd0f3('0x47')]({'where':{'id':_0x20bd48[_0xd0f3('0x48')][_0xd0f3('0x69')],'role':'agent'},'attributes':['id',_0xd0f3('0x28'),_0xd0f3('0x7a'),_0xd0f3('0x7b'),_0xd0f3('0x7c')],'raw':!![]});}return null;})['then'](function(_0x2f9b02){if(!_0x2f9b02)return null;_0x3d27f2[_0xd0f3('0x1c')][_0xd0f3('0x7d')]=_0x2f9b02;return _0x3d27f2;})[_0xd0f3('0x14')](function(_0x46f5a){if(_0x46f5a){if(_0x20bd48[_0xd0f3('0x48')][_0xd0f3('0x7e')]){_0x3d27f2[_0xd0f3('0x1c')]['interface']=util['format'](_0xd0f3('0x7f'),_0x20bd48[_0xd0f3('0x6a')][_0xd0f3('0x28')]);_0x3d27f2[_0xd0f3('0x1c')][_0xd0f3('0x80')]=_0x3d27f2[_0xd0f3('0x80')];_0x3d27f2['message'][_0xd0f3('0x81')]=_0x3d27f2[_0xd0f3('0x80')];_0x3d27f2['message'][_0xd0f3('0x82')]='accept';_0x3d27f2[_0xd0f3('0x1c')]['body']=htmlToText[_0xd0f3('0x83')](_0x3d27f2[_0xd0f3('0x1c')][_0xd0f3('0x48')]);return respondWithRpcPromise(_0xd0f3('0x84'),'EventManager',{'event':_0xd0f3('0x85'),'message':_0x3d27f2[_0xd0f3('0x1c')]},client9002)[_0xd0f3('0x14')](function(){return _0x3d27f2;});}return _0x3d27f2;}return null;})[_0xd0f3('0x14')](respondWithResult(_0x2b3713,null))[_0xd0f3('0x43')](handleError(_0x2b3713,null));};exports['reject']=function(_0x2363d7,_0xc61746){var _0x56fb94={'agent':{},'channel':_0xd0f3('0x65')};if(_0x2363d7[_0xd0f3('0x48')]['id']){delete _0x2363d7['body']['id'];}_0x2363d7[_0xd0f3('0x48')][_0xd0f3('0x69')]=_0x2363d7[_0xd0f3('0x48')]['UserId']||_0x2363d7[_0xd0f3('0x6a')]['id'];_0x56fb94[_0xd0f3('0x7d')]['id']=_0x2363d7[_0xd0f3('0x48')][_0xd0f3('0x69')];return db[_0xd0f3('0x2c')][_0xd0f3('0x47')]({'where':{'id':_0x2363d7[_0xd0f3('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc61746,null))[_0xd0f3('0x14')](function(_0xf2e48c){if(_0xf2e48c){_0x56fb94[_0xd0f3('0x1c')]=_0xf2e48c['get']({'plain':!![]});return db[_0xd0f3('0x6c')][_0xd0f3('0x47')]({'where':{'id':_0xf2e48c[_0xd0f3('0x6d')]}});}return null;})[_0xd0f3('0x14')](handleEntityNotFound(_0xc61746,null))[_0xd0f3('0x14')](function(_0x5cee7d){if(_0x5cee7d){_0x56fb94['interaction']=_0x5cee7d['get']({'plain':!![]});interaction_log[_0xd0f3('0x15')](_0xd0f3('0x86'),_0x2363d7[_0xd0f3('0x6a')]['id'],_0x2363d7['user'][_0xd0f3('0x28')],_0x2363d7[_0xd0f3('0x6a')][_0xd0f3('0x70')],_0x56fb94[_0xd0f3('0x6e')]['id'],_0x2363d7[_0xd0f3('0x48')]?JSON[_0xd0f3('0x63')](_0x2363d7[_0xd0f3('0x48')]):_0xd0f3('0x71'));return respondWithRpcPromise(_0xd0f3('0x87'),_0xd0f3('0x88'),_0x56fb94);}return null;})[_0xd0f3('0x14')](function(_0x40ab15){var _0x237f12=_0xd0f3('0x73')+_0x40ab15[_0xd0f3('0x1c')][_0xd0f3('0x74')];return db[_0xd0f3('0x89')][_0xd0f3('0x33')](_0x237f12,{'type':db[_0xd0f3('0x75')][_0xd0f3('0x76')][_0xd0f3('0x77')],'raw':!![]})[_0xd0f3('0x14')](function(_0x81803d){return _0x81803d;});})[_0xd0f3('0x14')](function(_0x22d238){if(_0x22d238){_0x56fb94['message'][_0xd0f3('0x78')]=_0x22d238[0x0];if(!_0x2363d7[_0xd0f3('0x48')][_0xd0f3('0x69')])return;return db[_0xd0f3('0x79')][_0xd0f3('0x47')]({'where':{'id':_0x2363d7[_0xd0f3('0x48')][_0xd0f3('0x69')],'role':_0xd0f3('0x7d')},'attributes':['id',_0xd0f3('0x28'),_0xd0f3('0x7a'),_0xd0f3('0x7b'),_0xd0f3('0x7c')],'raw':!![]});}return null;})[_0xd0f3('0x14')](function(_0x226227){if(!_0x226227)return null;_0x56fb94[_0xd0f3('0x1c')][_0xd0f3('0x7d')]=_0x226227;return _0x56fb94;})[_0xd0f3('0x14')](function(_0x2837de){if(_0x2837de){_0x2837de['message'][_0xd0f3('0x8a')]=util[_0xd0f3('0x62')](_0xd0f3('0x7f'),_0x2363d7['user'][_0xd0f3('0x28')]);_0x2837de[_0xd0f3('0x1c')]['channel']=_0x56fb94[_0xd0f3('0x80')];_0x2837de[_0xd0f3('0x1c')][_0xd0f3('0x81')]=_0x56fb94['channel'];_0x2837de[_0xd0f3('0x1c')][_0xd0f3('0x82')]=_0xd0f3('0x8b');_0x2837de[_0xd0f3('0x1c')][_0xd0f3('0x48')]=htmlToText['fromString'](_0x56fb94[_0xd0f3('0x1c')]['body']);respondWithRpcPromise(_0xd0f3('0x84'),'EventManager',{'event':_0xd0f3('0x8c'),'message':_0x2837de['message']},client9002);return _0x56fb94;}return null;})[_0xd0f3('0x14')](respondWithResult(_0xc61746,null))['catch'](handleError(_0xc61746,null));};exports[_0xd0f3('0x8d')]=function(_0x18d6b0,_0xb4d9b7){var _0xd3d49d=moment()[_0xd0f3('0x8e')]()['toString']();var _0x4b094f=path[_0xd0f3('0x5c')](config[_0xd0f3('0x5d')],'server','files',_0xd0f3('0x8f'));var _0x4abc7c=path[_0xd0f3('0x5c')](config['root'],'server',_0xd0f3('0x90'),_0xd0f3('0x5b'));var _0x4d2d43=util[_0xd0f3('0x62')](_0xd0f3('0x91'),_0xd3d49d);return db[_0xd0f3('0x2c')][_0xd0f3('0x47')]({'where':{'id':_0x18d6b0[_0xd0f3('0x44')]['id']},'attributes':['id',_0xd0f3('0x48'),_0xd0f3('0x92'),'to','cc',_0xd0f3('0x93'),_0xd0f3('0x94'),_0xd0f3('0x95')],'include':_0x18d6b0[_0xd0f3('0x33')][_0xd0f3('0x5b')]?[{'model':db[_0xd0f3('0x96')],'as':_0xd0f3('0x97')}]:undefined})['then'](handleEntityNotFound(_0xb4d9b7,null))[_0xd0f3('0x14')](function(_0x17348e){if(_0x17348e){var _0x565064=_0x17348e;var _0x3157a1={'from':_0x565064[_0xd0f3('0x92')],'to':_0x565064['to'],'subject':_0x565064[_0xd0f3('0x94')],'html':htmlEntities[_0xd0f3('0x98')](_0x565064['body']),'headers':{'Date':moment(_0x565064[_0xd0f3('0x95')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x17348e['cc']){_0x3157a1[_0xd0f3('0x99')]['Cc']=_0x17348e['cc'];}if(_0x17348e[_0xd0f3('0x93')]){_0x3157a1['headers'][_0xd0f3('0x9a')]=_0x17348e[_0xd0f3('0x93')];}return new BPromise(function(_0xd23ad1,_0x4665ea){if(_0x17348e[_0xd0f3('0x97')]){for(var _0x4d4b12=0x0;_0x4d4b12<_0x17348e[_0xd0f3('0x97')]['length'];_0x4d4b12++){var _0x18c043=_0x17348e['Attachments'][_0x4d4b12];var _0x55a46b=path['join'](_0x4abc7c,_0x18c043['basename']);if(fs[_0xd0f3('0x9b')](_0x55a46b)){_0x3157a1[_0xd0f3('0x5b')]['push']({'name':_0x18c043[_0xd0f3('0x28')],'contentType':_0x18c043['type'],'data':fs[_0xd0f3('0x9c')](_0x55a46b)});}}}emlformat[_0xd0f3('0x9d')](_0x3157a1,function(_0xea8664,_0x25dbce){if(_0xea8664)return _0x4665ea(_0xea8664);fs[_0xd0f3('0x9e')](path[_0xd0f3('0x5c')](_0x4b094f,_0x4d2d43),_0x25dbce);return _0xd23ad1(_0x25dbce);});});}})['then'](function(_0x3e927c){if(_0x3e927c){return _0xb4d9b7[_0xd0f3('0x8d')](path[_0xd0f3('0x5c')](_0x4b094f,_0x4d2d43),_0x4d2d43,function(_0x1d2d32){if(!_0x1d2d32)fs[_0xd0f3('0x9f')](path['join'](_0x4b094f,_0x4d2d43));});}})['catch'](handleError(_0xb4d9b7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f85db6f..7b6dab8 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 _0x8ab8=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x2e49bf,_0xb6fb8e){var _0x392e50=function(_0x5dcfac){while(--_0x5dcfac){_0x2e49bf['push'](_0x2e49bf['shift']());}};_0x392e50(++_0xb6fb8e);}(_0x8ab8,0xd9));var _0x88ab=function(_0xfd328f,_0x382506){_0xfd328f=_0xfd328f-0x0;var _0x27687e=_0x8ab8[_0xfd328f];return _0x27687e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x88ab('0x0'))['db'][_0x88ab('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x88ab('0x2')](0x0);var events={'afterCreate':_0x88ab('0x3'),'afterUpdate':_0x88ab('0x4'),'afterDestroy':_0x88ab('0x5')};function emitEvent(_0x38e096){return function(_0x30e269,_0xa0883e,_0x2301e1){MailMessageEvents[_0x88ab('0x6')](_0x38e096+':'+_0x30e269['id'],_0x30e269);MailMessageEvents[_0x88ab('0x6')](_0x38e096,_0x30e269);_0x2301e1(null);};}for(var e in events){if(events[_0x88ab('0x7')](e)){var event=events[e];MailMessage[_0x88ab('0x8')](e,emitEvent(event));}}module[_0x88ab('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x2068=['exports','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x424d86,_0x3d932e){var _0x25f529=function(_0x308e45){while(--_0x308e45){_0x424d86['push'](_0x424d86['shift']());}};_0x25f529(++_0x3d932e);}(_0x2068,0xa9));var _0x8206=function(_0xa1a0b1,_0x10d6f6){_0xa1a0b1=_0xa1a0b1-0x0;var _0x22dea3=_0x2068[_0xa1a0b1];return _0x22dea3;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x8206('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8206('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8206('0x2'),'afterDestroy':_0x8206('0x3')};function emitEvent(_0x7e8e61){return function(_0x433602,_0x50e325,_0x3f674b){MailMessageEvents[_0x8206('0x4')](_0x7e8e61+':'+_0x433602['id'],_0x433602);MailMessageEvents['emit'](_0x7e8e61,_0x433602);_0x3f674b(null);};}for(var e in events){if(events[_0x8206('0x5')](e)){var event=events[e];MailMessage[_0x8206('0x6')](e,emitEvent(event));}}module[_0x8206('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 92a5f60..ba18cff 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 _0x71e8=['messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','mail_messages'];(function(_0x151132,_0x32026a){var _0x13c2ad=function(_0x4dcd81){while(--_0x4dcd81){_0x151132['push'](_0x151132['shift']());}};_0x13c2ad(++_0x32026a);}(_0x71e8,0x103));var _0x871e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71e8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x871e('0x0'));var util=require(_0x871e('0x1'));var logger=require(_0x871e('0x2'))(_0x871e('0x3'));var moment=require(_0x871e('0x4'));var BPromise=require('bluebird');var rp=require(_0x871e('0x5'));var htmlToText=require(_0x871e('0x6'));var fs=require('fs');var path=require(_0x871e('0x7'));var rimraf=require(_0x871e('0x8'));var config=require('../../config/environment');var attributes=require(_0x871e('0x9'));module[_0x871e('0xa')]=function(_0x38aa6c,_0x16cdc4){return _0x38aa6c[_0x871e('0xb')]('MailMessage',attributes,{'tableName':_0x871e('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x871e('0xd')]},{'name':_0x871e('0xe'),'fields':[_0x871e('0xf'),_0x871e('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31ca56,_0x40705d,_0x1cd368){if(_0x31ca56[_0x871e('0x11')]){_0x31ca56['plainBody']=htmlToText[_0x871e('0x12')](_0x31ca56[_0x871e('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1cd368(null,_0x40705d);},'afterCreate':function(_0x3fdf38,_0x4b456b,_0x4efd39){var _0x256834=_0x38aa6c[_0x871e('0x13')];var _0xbb2b96=_0x3fdf38[_0x871e('0x14')]({'plain':!![]});if(_0xbb2b96[_0x871e('0x15')][_0x871e('0x16')]()==='in'||_0xbb2b96[_0x871e('0x15')]['toLowerCase']()===_0x871e('0x17')&&!_0xbb2b96[_0x871e('0x18')]&&!_[_0x871e('0x19')](_0xbb2b96[_0x871e('0x1a')])){_0x256834[_0x871e('0x1b')][_0x871e('0x1c')]({'where':{'id':_0xbb2b96[_0x871e('0x1d')]}})['then'](function(_0x547570){if(_0x547570){_0x547570[_0x871e('0x1e')]({'lastMsgAt':_0xbb2b96['createdAt'],'lastMsgDirection':_0xbb2b96[_0x871e('0x15')]['toLowerCase']()});}})[_0x871e('0x1f')](function(_0x376926){console['error'](_0x376926);});}_0x4efd39();}},'charset':_0x871e('0x20'),'collate':_0x871e('0x21')});}; \ No newline at end of file +var _0xb8f0=['body','models','direction','toLowerCase','out','isNil','UserId','findOne','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0xb8f0,0xfc));var _0x0b8f=function(_0x3e5b7a,_0x58715a){_0x3e5b7a=_0x3e5b7a-0x0;var _0x412fc9=_0xb8f0[_0x3e5b7a];return _0x412fc9;};'use strict';var _=require(_0x0b8f('0x0'));var util=require(_0x0b8f('0x1'));var logger=require('../../config/logger')(_0x0b8f('0x2'));var moment=require(_0x0b8f('0x3'));var BPromise=require(_0x0b8f('0x4'));var rp=require('request-promise');var htmlToText=require(_0x0b8f('0x5'));var fs=require('fs');var path=require(_0x0b8f('0x6'));var rimraf=require(_0x0b8f('0x7'));var config=require(_0x0b8f('0x8'));var attributes=require(_0x0b8f('0x9'));module[_0x0b8f('0xa')]=function(_0x4261ac,_0x1e8038){return _0x4261ac[_0x0b8f('0xb')](_0x0b8f('0xc'),attributes,{'tableName':_0x0b8f('0xd'),'paranoid':![],'indexes':[{'name':_0x0b8f('0xe'),'fields':[_0x0b8f('0xe')]},{'name':_0x0b8f('0xf'),'fields':[_0x0b8f('0x10'),_0x0b8f('0x11')],'type':_0x0b8f('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x147f36,_0x59a0ac,_0x13256f){if(_0x147f36['body']){_0x147f36[_0x0b8f('0x10')]=htmlToText[_0x0b8f('0x13')](_0x147f36[_0x0b8f('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x13256f(null,_0x59a0ac);},'afterCreate':function(_0x37c5ac,_0x969d0b,_0x4cc159){var _0x5dbee5=_0x4261ac[_0x0b8f('0x15')];var _0x5af10f=_0x37c5ac['get']({'plain':!![]});if(_0x5af10f[_0x0b8f('0x16')][_0x0b8f('0x17')]()==='in'||_0x5af10f['direction'][_0x0b8f('0x17')]()===_0x0b8f('0x18')&&!_0x5af10f['secret']&&!_[_0x0b8f('0x19')](_0x5af10f[_0x0b8f('0x1a')])){_0x5dbee5['MailInteraction'][_0x0b8f('0x1b')]({'where':{'id':_0x5af10f['MailInteractionId']}})[_0x0b8f('0x1c')](function(_0x46527f){if(_0x46527f){_0x46527f['update']({'lastMsgAt':_0x5af10f[_0x0b8f('0x1d')],'lastMsgDirection':_0x5af10f['direction'][_0x0b8f('0x17')]()});}})[_0x0b8f('0x1e')](function(_0x1d131a){console[_0x0b8f('0x1f')](_0x1d131a);});}_0x4cc159();}},'charset':_0x0b8f('0x20'),'collate':_0x0b8f('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 5405b4e..727f3b3 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 _0xb44a=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x299687,_0x4f4e7d){var _0xfbfc48=function(_0x3288af){while(--_0x3288af){_0x299687['push'](_0x299687['shift']());}};_0xfbfc48(++_0x4f4e7d);}(_0xb44a,0x1c2));var _0xab44=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0xb44a[_0xba1760];return _0x1f3143;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});config[_0xab44('0x8')]=_[_0xab44('0x9')](config[_0xab44('0x8')],{'host':_0xab44('0xa'),'port':0x18eb});var socket=require(_0xab44('0xb'))(new Redis(config[_0xab44('0x8')]));require(_0xab44('0xc'))[_0xab44('0xd')](socket);function respondWithRpcPromise(_0x55c7d2,_0x2a670e,_0x500a9f){return new BPromise(function(_0x15e64e,_0x5168fa){return client['request'](_0x55c7d2,_0x500a9f)[_0xab44('0xe')](function(_0x6746cc){logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));logger[_0xab44('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2a670e,'request\x20sent',JSON[_0xab44('0x13')](_0x6746cc));if(_0x6746cc['error']){if(_0x6746cc[_0xab44('0x14')]['code']===0x1f4){logger[_0xab44('0x14')](_0xab44('0x10'),_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x5168fa(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x15e64e(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}else{logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));_0x15e64e(_0x6746cc[_0xab44('0x16')][_0xab44('0x15')]);}})[_0xab44('0x17')](function(_0x27fc7f){logger['error'](_0xab44('0x10'),_0x2a670e,_0x27fc7f);_0x5168fa(_0x27fc7f);});});}exports[_0xab44('0x18')]=function(_0x101a1b){var _0x2902ca=this;return new Promise(function(_0x29bb73,_0x5123b1){return db[_0xab44('0x19')]['create'](_0x101a1b[_0xab44('0x1a')],{'raw':_0x101a1b[_0xab44('0x1b')]?_0x101a1b[_0xab44('0x1b')][_0xab44('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3a2b1d){logger[_0xab44('0xf')](_0xab44('0x18'),_0x101a1b);logger[_0xab44('0x12')](_0xab44('0x18'),_0x101a1b,JSON[_0xab44('0x13')](_0x3a2b1d));_0x29bb73(_0x3a2b1d);})[_0xab44('0x17')](function(_0x554955){logger['error'](_0xab44('0x18'),_0x554955['message'],_0x101a1b);_0x5123b1(_0x2902ca[_0xab44('0x14')](0x1f4,_0x554955['message']));});});}; \ No newline at end of file +var _0xfef3=['raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xfef3,0x118));var _0x3fef=function(_0x352b49,_0x16a4ee){_0x352b49=_0x352b49-0x0;var _0x2e314a=_0xfef3[_0x352b49];return _0x2e314a;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});config[_0x3fef('0x9')]=_[_0x3fef('0xa')](config[_0x3fef('0x9')],{'host':_0x3fef('0xb'),'port':0x18eb});var socket=require(_0x3fef('0xc'))(new Redis(config[_0x3fef('0x9')]));require(_0x3fef('0xd'))[_0x3fef('0xe')](socket);function respondWithRpcPromise(_0x307586,_0x67cdd8,_0x16252b){return new BPromise(function(_0x1a7ef7,_0x7cc5b){return client['request'](_0x307586,_0x16252b)[_0x3fef('0xf')](function(_0x3560d9){logger[_0x3fef('0x10')]('MailMessage,\x20%s,\x20%s',_0x67cdd8,_0x3fef('0x11'));logger['debug'](_0x3fef('0x12'),_0x67cdd8,_0x3fef('0x11'),JSON[_0x3fef('0x13')](_0x3560d9));if(_0x3560d9['error']){if(_0x3560d9[_0x3fef('0x14')]['code']===0x1f4){logger[_0x3fef('0x14')](_0x3fef('0x15'),_0x67cdd8,_0x3560d9['error'][_0x3fef('0x16')]);return _0x7cc5b(_0x3560d9[_0x3fef('0x14')][_0x3fef('0x16')]);}logger[_0x3fef('0x14')](_0x3fef('0x15'),_0x67cdd8,_0x3560d9[_0x3fef('0x14')]['message']);return _0x1a7ef7(_0x3560d9[_0x3fef('0x14')][_0x3fef('0x16')]);}else{logger[_0x3fef('0x10')](_0x3fef('0x15'),_0x67cdd8,_0x3fef('0x11'));_0x1a7ef7(_0x3560d9[_0x3fef('0x17')]['message']);}})[_0x3fef('0x18')](function(_0x3eb287){logger['error'](_0x3fef('0x15'),_0x67cdd8,_0x3eb287);_0x7cc5b(_0x3eb287);});});}exports[_0x3fef('0x19')]=function(_0x42e095){var _0x218f91=this;return new Promise(function(_0x245332,_0x2b5226){return db[_0x3fef('0x1a')][_0x3fef('0x1b')](_0x42e095[_0x3fef('0x1c')],{'raw':_0x42e095[_0x3fef('0x1d')]?_0x42e095[_0x3fef('0x1d')][_0x3fef('0x1e')]===undefined?!![]:![]:!![]})[_0x3fef('0xf')](function(_0x39a8ea){logger[_0x3fef('0x10')]('CreateMailMessage',_0x42e095);logger['debug']('CreateMailMessage',_0x42e095,JSON[_0x3fef('0x13')](_0x39a8ea));_0x245332(_0x39a8ea);})[_0x3fef('0x18')](function(_0xa16dc){logger['error'](_0x3fef('0x19'),_0xa16dc['message'],_0x42e095);_0x2b5226(_0x218f91[_0x3fef('0x14')](0x1f4,_0xa16dc[_0x3fef('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index aee5b0a..53d966c 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 _0x8ca7=['removeListener','register','length','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca7,0x176));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x78ca('0x0'),_0x78ca('0x1'),_0x78ca('0x2')];function createListener(_0x464309,_0x29118d){return function(_0x37762d){_0x29118d[_0x78ca('0x3')](_0x464309,_0x37762d);};}function removeListener(_0x1efd94,_0x238d6f){return function(){MailMessageEvents[_0x78ca('0x4')](_0x1efd94,_0x238d6f);};}exports[_0x78ca('0x5')]=function(_0x823085){for(var _0x46d486=0x0,_0x520902=events[_0x78ca('0x6')];_0x46d486<_0x520902;_0x46d486++){var _0x462932=events[_0x46d486];var _0x39a3ca=createListener('mailMessage:'+_0x462932,_0x823085);MailMessageEvents['on'](_0x462932,_0x39a3ca);}}; \ No newline at end of file +var _0xf492=['update','emit','length','mailMessage:','./mailMessage.events','remove'];(function(_0x2cf130,_0x5c1ff3){var _0x4c1df8=function(_0x1c4da8){while(--_0x1c4da8){_0x2cf130['push'](_0x2cf130['shift']());}};_0x4c1df8(++_0x5c1ff3);}(_0xf492,0xb2));var _0x2f49=function(_0xf96f0d,_0x538223){_0xf96f0d=_0xf96f0d-0x0;var _0x59b4d4=_0xf492[_0xf96f0d];return _0x59b4d4;};'use strict';var MailMessageEvents=require(_0x2f49('0x0'));var events=['save',_0x2f49('0x1'),_0x2f49('0x2')];function createListener(_0x5d5362,_0x4d52e6){return function(_0x25999e){_0x4d52e6[_0x2f49('0x3')](_0x5d5362,_0x25999e);};}function removeListener(_0x2c6e38,_0xc4e27){return function(){MailMessageEvents['removeListener'](_0x2c6e38,_0xc4e27);};}exports['register']=function(_0x59426a){for(var _0xf74eda=0x0,_0x47dc4c=events[_0x2f49('0x4')];_0xf74eda<_0x47dc4c;_0xf74eda++){var _0x601c82=events[_0xf74eda];var _0x5277d1=createListener(_0x2f49('0x5')+_0x601c82,_0x59426a);MailMessageEvents['on'](_0x601c82,_0x5277d1);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9ad0643..7fb9384 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 _0xfb73=['post','/:id/teams','addAgents','put','update','destroy','delete','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','describe','/:id','isAuthenticated','show','getMembers','getTeams','getAgents'];(function(_0xdf5fc5,_0x37255b){var _0x52f5a5=function(_0x5e37aa){while(--_0x5e37aa){_0xdf5fc5['push'](_0xdf5fc5['shift']());}};_0x52f5a5(++_0x37255b);}(_0xfb73,0x128));var _0x3fb7=function(_0x50396b,_0x10a2e2){_0x50396b=_0x50396b-0x0;var _0x16961c=_0xfb73[_0x50396b];return _0x16961c;};'use strict';var multer=require('multer');var util=require(_0x3fb7('0x0'));var path=require('path');var timeout=require(_0x3fb7('0x1'));var express=require(_0x3fb7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3fb7('0x3'));var interaction=require(_0x3fb7('0x4'));var config=require(_0x3fb7('0x5'));var controller=require(_0x3fb7('0x6'));router[_0x3fb7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3fb7('0x8'),auth['isAuthenticated'](),controller[_0x3fb7('0x9')]);router[_0x3fb7('0x7')](_0x3fb7('0xa'),auth[_0x3fb7('0xb')](),controller[_0x3fb7('0xc')]);router[_0x3fb7('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x3fb7('0xd')]);router[_0x3fb7('0x7')]('/:id/teams',auth[_0x3fb7('0xb')](),controller[_0x3fb7('0xe')]);router[_0x3fb7('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x3fb7('0xf')]);router[_0x3fb7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3fb7('0x10')](_0x3fb7('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3fb7('0x10')]('/:id/users',auth[_0x3fb7('0xb')](),controller[_0x3fb7('0x12')]);router[_0x3fb7('0x13')](_0x3fb7('0xa'),auth[_0x3fb7('0xb')](),controller[_0x3fb7('0x14')]);router['delete'](_0x3fb7('0xa'),auth[_0x3fb7('0xb')](),controller[_0x3fb7('0x15')]);router[_0x3fb7('0x16')](_0x3fb7('0x11'),auth[_0x3fb7('0xb')](),controller['removeTeams']);router[_0x3fb7('0x16')]('/:id/users',auth[_0x3fb7('0xb')](),controller[_0x3fb7('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc3c4=['/:id/teams','getTeams','/:id/users','getAgents','create','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/members','getMembers'];(function(_0x5d984e,_0x40be4c){var _0x77fe9a=function(_0x118833){while(--_0x118833){_0x5d984e['push'](_0x5d984e['shift']());}};_0x77fe9a(++_0x40be4c);}(_0xc3c4,0x88));var _0x4c3c=function(_0x526704,_0x48c19c){_0x526704=_0x526704-0x0;var _0x324ef0=_0xc3c4[_0x526704];return _0x324ef0;};'use strict';var multer=require(_0x4c3c('0x0'));var util=require(_0x4c3c('0x1'));var path=require(_0x4c3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c3c('0x3'));var router=express[_0x4c3c('0x4')]();var fs_extra=require(_0x4c3c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4c3c('0x6'));var config=require(_0x4c3c('0x7'));var controller=require('./mailQueue.controller');router[_0x4c3c('0x8')]('/',auth[_0x4c3c('0x9')](),controller['index']);router['get'](_0x4c3c('0xa'),auth[_0x4c3c('0x9')](),controller['describe']);router[_0x4c3c('0x8')]('/:id',auth[_0x4c3c('0x9')](),controller[_0x4c3c('0xb')]);router['get'](_0x4c3c('0xc'),auth[_0x4c3c('0x9')](),controller[_0x4c3c('0xd')]);router[_0x4c3c('0x8')](_0x4c3c('0xe'),auth[_0x4c3c('0x9')](),controller[_0x4c3c('0xf')]);router[_0x4c3c('0x8')](_0x4c3c('0x10'),auth[_0x4c3c('0x9')](),controller[_0x4c3c('0x11')]);router['post']('/',auth[_0x4c3c('0x9')](),controller[_0x4c3c('0x12')]);router['post'](_0x4c3c('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x4c3c('0x10'),auth[_0x4c3c('0x9')](),controller['addAgents']);router['put'](_0x4c3c('0x13'),auth['isAuthenticated'](),controller[_0x4c3c('0x14')]);router['delete']('/:id',auth[_0x4c3c('0x9')](),controller['destroy']);router[_0x4c3c('0x15')](_0x4c3c('0xe'),auth[_0x4c3c('0x9')](),controller[_0x4c3c('0x16')]);router['delete']('/:id/users',auth[_0x4c3c('0x9')](),controller[_0x4c3c('0x17')]);module[_0x4c3c('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index eb2c170..dac71ba 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 _0xbc9a=['ENUM','beepall','roundrobin','sequelize','exports','INTEGER'];(function(_0x1df470,_0x43cff9){var _0x277849=function(_0x164f32){while(--_0x164f32){_0x1df470['push'](_0x1df470['shift']());}};_0x277849(++_0x43cff9);}(_0xbc9a,0x69));var _0xabc9=function(_0x4dadd0,_0xd02549){_0x4dadd0=_0x4dadd0-0x0;var _0x3daaac=_0xbc9a[_0x4dadd0];return _0x3daaac;};'use strict';var Sequelize=require(_0xabc9('0x0'));module[_0xabc9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xabc9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabc9('0x3')]('rrmemory',_0xabc9('0x4'),_0xabc9('0x5'))}}; \ No newline at end of file +var _0x1966=['exports','STRING','name','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x123de9,_0xe91090){var _0x4e20fb=function(_0x449bf7){while(--_0x449bf7){_0x123de9['push'](_0x123de9['shift']());}};_0x4e20fb(++_0xe91090);}(_0x1966,0x11e));var _0x6196=function(_0x361855,_0x11a72d){_0x361855=_0x361855-0x0;var _0x19b475=_0x1966[_0x361855];return _0x19b475;};'use strict';var Sequelize=require(_0x6196('0x0'));module[_0x6196('0x1')]={'name':{'type':Sequelize[_0x6196('0x2')],'unique':_0x6196('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6196('0x2')]},'timeout':{'type':Sequelize[_0x6196('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6196('0x5')](_0x6196('0x6'),'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 ef4a36d..1694c11 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 _0xa74e=['eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','MailQueues','UserProfileResource','then','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','QueryTypes','SELECT','all','compact','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','getAgents'];(function(_0x3454ba,_0x5dd876){var _0x16bf4f=function(_0x42e90c){while(--_0x42e90c){_0x3454ba['push'](_0x3454ba['shift']());}};_0x16bf4f(++_0x5dd876);}(_0xa74e,0x8d));var _0xea74=function(_0xe183ad,_0x42da9b){_0xe183ad=_0xe183ad-0x0;var _0x17e3af=_0xa74e[_0xe183ad];return _0x17e3af;};'use strict';var emlformat=require(_0xea74('0x0'));var rimraf=require(_0xea74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xea74('0x2'));var moment=require(_0xea74('0x3'));var BPromise=require(_0xea74('0x4'));var Mustache=require('mustache');var util=require(_0xea74('0x5'));var path=require(_0xea74('0x6'));var sox=require(_0xea74('0x7'));var csv=require(_0xea74('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea74('0x9'));var _=require(_0xea74('0xa'));var squel=require(_0xea74('0xb'));var crypto=require('crypto');var jsforce=require(_0xea74('0xc'));var deskjs=require(_0xea74('0xd'));var toCsv=require(_0xea74('0x8'));var querystring=require(_0xea74('0xe'));var Papa=require(_0xea74('0xf'));var Redis=require(_0xea74('0x10'));var authService=require(_0xea74('0x11'));var qs=require(_0xea74('0x12'));var as=require(_0xea74('0x13'));var hardwareService=require(_0xea74('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xea74('0x15'));var config=require(_0xea74('0x16'));var licenseUtil=require(_0xea74('0x17'));var db=require(_0xea74('0x18'))['db'];config[_0xea74('0x19')]=_[_0xea74('0x1a')](config[_0xea74('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xea74('0x1b'))(new Redis(config[_0xea74('0x19')]));require(_0xea74('0x1c'))['register'](socket);function respondWithStatusCode(_0x512ff1,_0x1dafcc){_0x1dafcc=_0x1dafcc||0xcc;return function(_0x6123a6){if(_0x6123a6){return _0x512ff1['sendStatus'](_0x1dafcc);}return _0x512ff1['status'](_0x1dafcc)[_0xea74('0x1d')]();};}function respondWithResult(_0x24eaf9,_0x4aa61e){_0x4aa61e=_0x4aa61e||0xc8;return function(_0x497332){if(_0x497332){return _0x24eaf9[_0xea74('0x1e')](_0x4aa61e)[_0xea74('0x1f')](_0x497332);}};}function respondWithFilteredResult(_0x1c685b,_0x58d2bc){return function(_0x2d794a){if(_0x2d794a){var _0x168205=typeof _0x58d2bc[_0xea74('0x20')]===_0xea74('0x21')&&typeof _0x58d2bc['limit']===_0xea74('0x21');var _0x46c588=_0x2d794a['count'];var _0x5af9e4=_0x168205?0x0:_0x58d2bc[_0xea74('0x20')];var _0x5e0456=_0x168205?_0x2d794a[_0xea74('0x22')]:_0x58d2bc[_0xea74('0x20')]+_0x58d2bc[_0xea74('0x23')];var _0x7ea1f1;if(_0x5e0456>=_0x46c588){_0x5e0456=_0x46c588;_0x7ea1f1=0xc8;}else{_0x7ea1f1=0xce;}_0x1c685b['status'](_0x7ea1f1);return _0x1c685b[_0xea74('0x24')](_0xea74('0x25'),_0x5af9e4+'-'+_0x5e0456+'/'+_0x46c588)[_0xea74('0x1f')](_0x2d794a);}return null;};}function patchUpdates(_0x13da21){return function(_0x43d880){try{jsonpatch[_0xea74('0x26')](_0x43d880,_0x13da21,!![]);}catch(_0x11cc75){return BPromise[_0xea74('0x27')](_0x11cc75);}return _0x43d880[_0xea74('0x28')]();};}function saveUpdates(_0x16d24c,_0x29e22d){return function(_0x4c29ae){if(_0x4c29ae){return _0x4c29ae[_0xea74('0x29')](_0x16d24c)['then'](function(_0x302ee5){return _0x302ee5;});}return null;};}function removeEntity(_0x19c123,_0x3ad3f8){return function(_0x183032){if(_0x183032){return _0x183032[_0xea74('0x2a')]()['then'](function(){var _0x5618e8=_0x183032['get']({'plain':!![]});var _0x4673a4=_0xea74('0x2b');return db[_0xea74('0x2c')][_0xea74('0x2a')]({'where':{'type':_0x4673a4,'resourceId':_0x5618e8['id']}})[_0xea74('0x2d')](function(){return _0x183032;});})[_0xea74('0x2d')](function(){_0x19c123[_0xea74('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x365529,_0x207ab2){return function(_0x2a0aa1){if(!_0x2a0aa1){_0x365529['sendStatus'](0x194);}return _0x2a0aa1;};}function handleError(_0x1ed62a,_0x44b5e4){_0x44b5e4=_0x44b5e4||0x1f4;return function(_0x285365){logger[_0xea74('0x2e')](_0x285365[_0xea74('0x2f')]);if(_0x285365['name']){delete _0x285365[_0xea74('0x30')];}_0x1ed62a[_0xea74('0x1e')](_0x44b5e4)[_0xea74('0x31')](_0x285365);};}exports[_0xea74('0x32')]=function(_0x23eb98,_0x3ea4aa){var _0x488922={},_0x305cb3={},_0x29cbc2={'count':0x0,'rows':[]};var _0x1c91a5=_['map'](db[_0xea74('0x33')][_0xea74('0x34')],function(_0x31b04a){return{'name':_0x31b04a[_0xea74('0x35')],'type':_0x31b04a[_0xea74('0x36')][_0xea74('0x37')]};});_0x305cb3[_0xea74('0x38')]=_[_0xea74('0x39')](_0x1c91a5,_0xea74('0x30'));_0x305cb3[_0xea74('0x3a')]=_[_0xea74('0x3b')](_0x23eb98[_0xea74('0x3a')]);_0x305cb3['filters']=_[_0xea74('0x3c')](_0x305cb3[_0xea74('0x38')],_0x305cb3[_0xea74('0x3a')]);_0x488922[_0xea74('0x3d')]=_[_0xea74('0x3c')](_0x305cb3[_0xea74('0x38')],qs[_0xea74('0x3e')](_0x23eb98['query'][_0xea74('0x3e')]));_0x488922['attributes']=_0x488922['attributes'][_0xea74('0x3f')]?_0x488922['attributes']:_0x305cb3[_0xea74('0x38')];if(!_0x23eb98[_0xea74('0x3a')][_0xea74('0x40')](_0xea74('0x41'))){_0x488922[_0xea74('0x23')]=qs[_0xea74('0x23')](_0x23eb98['query'][_0xea74('0x23')]);_0x488922[_0xea74('0x20')]=qs[_0xea74('0x20')](_0x23eb98[_0xea74('0x3a')][_0xea74('0x20')]);}_0x488922[_0xea74('0x42')]=qs['sort'](_0x23eb98[_0xea74('0x3a')][_0xea74('0x43')]);_0x488922[_0xea74('0x44')]=qs['filters'](_[_0xea74('0x45')](_0x23eb98[_0xea74('0x3a')],_0x305cb3[_0xea74('0x46')]),_0x1c91a5);if(_0x23eb98[_0xea74('0x3a')]['filter']){_0x488922[_0xea74('0x44')]=_[_0xea74('0x47')](_0x488922[_0xea74('0x44')],{'$or':_['map'](_0x1c91a5,function(_0x35afcc){if(_0x35afcc[_0xea74('0x36')]!==_0xea74('0x48')){var _0x2f9594={};_0x2f9594[_0x35afcc[_0xea74('0x30')]]={'$like':'%'+_0x23eb98[_0xea74('0x3a')][_0xea74('0x49')]+'%'};return _0x2f9594;}})});}_0x488922=_[_0xea74('0x47')]({},_0x488922,_0x23eb98[_0xea74('0x4a')]);var _0x1fda72={'where':_0x488922[_0xea74('0x44')]};return db['MailQueue'][_0xea74('0x22')](_0x1fda72)[_0xea74('0x2d')](function(_0x1ccafe){_0x29cbc2['count']=_0x1ccafe;if(_0x23eb98[_0xea74('0x3a')][_0xea74('0x4b')]){_0x488922[_0xea74('0x4c')]=[{'all':!![]}];}return db['MailQueue'][_0xea74('0x4d')](_0x488922);})['then'](function(_0x39ed37){_0x29cbc2[_0xea74('0x4e')]=_0x39ed37;return _0x29cbc2;})[_0xea74('0x2d')](respondWithFilteredResult(_0x3ea4aa,_0x488922))[_0xea74('0x4f')](handleError(_0x3ea4aa,null));};exports[_0xea74('0x50')]=function(_0x94080b,_0xda5e6e){var _0x11accf={'raw':!![],'where':{'id':_0x94080b[_0xea74('0x51')]['id']}},_0x316c08={};_0x316c08[_0xea74('0x38')]=_[_0xea74('0x3b')](db[_0xea74('0x33')]['rawAttributes']);_0x316c08['query']=_[_0xea74('0x3b')](_0x94080b[_0xea74('0x3a')]);_0x316c08['filters']=_[_0xea74('0x3c')](_0x316c08['model'],_0x316c08[_0xea74('0x3a')]);_0x11accf[_0xea74('0x3d')]=_['intersection'](_0x316c08['model'],qs[_0xea74('0x3e')](_0x94080b['query']['fields']));_0x11accf[_0xea74('0x3d')]=_0x11accf[_0xea74('0x3d')][_0xea74('0x3f')]?_0x11accf[_0xea74('0x3d')]:_0x316c08[_0xea74('0x38')];if(_0x94080b[_0xea74('0x3a')][_0xea74('0x4b')]){_0x11accf[_0xea74('0x4c')]=[{'all':!![]}];}_0x11accf=_[_0xea74('0x47')]({},_0x11accf,_0x94080b[_0xea74('0x4a')]);return db[_0xea74('0x33')]['find'](_0x11accf)[_0xea74('0x2d')](handleEntityNotFound(_0xda5e6e,null))[_0xea74('0x2d')](respondWithResult(_0xda5e6e,null))['catch'](handleError(_0xda5e6e,null));};exports[_0xea74('0x52')]=function(_0x445a52,_0x6a2738){return db[_0xea74('0x33')][_0xea74('0x52')](_0x445a52[_0xea74('0x53')],{})[_0xea74('0x2d')](function(_0x55d9e5){var _0x4f0f2b=_0x445a52[_0xea74('0x54')]['get']({'plain':!![]});if(!_0x4f0f2b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f0f2b[_0xea74('0x55')]==='user'){var _0x3afc67=_0x55d9e5[_0xea74('0x56')]({'plain':!![]});var _0x46d939=_0xea74('0x2b');return db[_0xea74('0x57')][_0xea74('0x58')]({'where':{'name':_0x46d939,'userProfileId':_0x4f0f2b[_0xea74('0x59')]},'raw':!![]})[_0xea74('0x2d')](function(_0x4ab4fc){if(_0x4ab4fc&&_0x4ab4fc[_0xea74('0x5a')]===0x0){return db[_0xea74('0x2c')][_0xea74('0x52')]({'name':_0x3afc67[_0xea74('0x30')],'resourceId':_0x3afc67['id'],'type':_0x4ab4fc[_0xea74('0x30')],'sectionId':_0x4ab4fc['id']},{})[_0xea74('0x2d')](function(){return _0x55d9e5;});}else{return _0x55d9e5;}})[_0xea74('0x4f')](function(_0x4a6631){logger[_0xea74('0x2e')](_0xea74('0x5b'),_0x4a6631);throw _0x4a6631;});}return _0x55d9e5;})[_0xea74('0x2d')](respondWithResult(_0x6a2738,0xc9))['catch'](handleError(_0x6a2738,null));};exports[_0xea74('0x29')]=function(_0x39f4e9,_0x22e7f6){if(_0x39f4e9[_0xea74('0x53')]['id']){delete _0x39f4e9[_0xea74('0x53')]['id'];}return db[_0xea74('0x33')][_0xea74('0x58')]({'where':{'id':_0x39f4e9[_0xea74('0x51')]['id']}})[_0xea74('0x2d')](handleEntityNotFound(_0x22e7f6,null))['then'](saveUpdates(_0x39f4e9['body'],null))['then'](respondWithResult(_0x22e7f6,null))[_0xea74('0x4f')](handleError(_0x22e7f6,null));};exports[_0xea74('0x2a')]=function(_0x332244,_0x5bee6d){return db[_0xea74('0x33')]['find']({'where':{'id':_0x332244[_0xea74('0x51')]['id']}})['then'](handleEntityNotFound(_0x5bee6d,null))['then'](removeEntity(_0x5bee6d,null))[_0xea74('0x4f')](handleError(_0x5bee6d,null));};exports[_0xea74('0x5c')]=function(_0x1f0470,_0x41c8b9){return db[_0xea74('0x33')][_0xea74('0x5c')]()['then'](respondWithResult(_0x41c8b9,null))[_0xea74('0x4f')](handleError(_0x41c8b9,null));};exports['getMembers']=function(_0x29955a,_0x515f9f,_0x5c50b3){var _0x129f52={'raw':!![],'where':{}},_0x114e1e={},_0x78d3cf;return db[_0xea74('0x33')]['findOne']({'where':{'id':_0x29955a[_0xea74('0x51')]['id']}})[_0xea74('0x2d')](handleEntityNotFound(_0x515f9f,null))[_0xea74('0x2d')](function(_0x2baded){if(_0x2baded){_0x78d3cf=_0x2baded[_0xea74('0x56')]({'plain':!![]});_0x114e1e[_0xea74('0x38')]=_['keys'](db[_0xea74('0x5d')][_0xea74('0x34')]);_0x114e1e[_0xea74('0x3a')]=_[_0xea74('0x3b')](_0x29955a[_0xea74('0x3a')]);_0x114e1e[_0xea74('0x46')]=_[_0xea74('0x3c')](_0x114e1e[_0xea74('0x38')],_0x114e1e[_0xea74('0x3a')]);_0x129f52[_0xea74('0x3d')]=_[_0xea74('0x3c')](_0x114e1e['model'],qs[_0xea74('0x3e')](_0x29955a[_0xea74('0x3a')][_0xea74('0x3e')]));_0x129f52[_0xea74('0x3d')]=_0x129f52['attributes'][_0xea74('0x3f')]?_0x129f52[_0xea74('0x3d')]:_0x114e1e[_0xea74('0x38')];if(!_0x29955a[_0xea74('0x3a')][_0xea74('0x40')](_0xea74('0x41'))){_0x129f52[_0xea74('0x23')]=qs[_0xea74('0x23')](_0x29955a[_0xea74('0x3a')][_0xea74('0x23')]);_0x129f52[_0xea74('0x20')]=qs['offset'](_0x29955a[_0xea74('0x3a')][_0xea74('0x20')]);}_0x129f52[_0xea74('0x42')]=qs[_0xea74('0x43')](_0x29955a['query'][_0xea74('0x43')]);_0x129f52[_0xea74('0x44')]=qs['filters'](_[_0xea74('0x45')](_0x29955a[_0xea74('0x3a')],_0x114e1e[_0xea74('0x46')]));_0x129f52[_0xea74('0x44')][_0xea74('0x5e')]=_0x2baded['id'];if(_0x29955a[_0xea74('0x3a')][_0xea74('0x49')]){_0x129f52['where']=_[_0xea74('0x47')](_0x129f52['where'],{'$or':_[_0xea74('0x39')](_0x129f52[_0xea74('0x3d')],function(_0x3ce554){var _0x4fbc1a={};_0x4fbc1a[_0x3ce554]={'$like':'%'+_0x29955a[_0xea74('0x3a')][_0xea74('0x49')]+'%'};return _0x4fbc1a;})});}_0x129f52=_[_0xea74('0x47')]({},_0x129f52,_0x29955a[_0xea74('0x4a')]);return db[_0xea74('0x5d')][_0xea74('0x4d')](_0x129f52);}})[_0xea74('0x2d')](function(_0x41fa02){if(_0x41fa02){return db['User'][_0xea74('0x5f')]({'where':{'id':_['map'](_0x41fa02,_0xea74('0x60')),'role':_0xea74('0x61')},'attributes':['id',_0xea74('0x30'),_0xea74('0x62'),_0xea74('0x63'),_0xea74('0x64')]});}})['then'](function(_0xca889d){if(_0xca889d){return{'count':_0xca889d[_0xea74('0x22')],'rows':_[_0xea74('0x39')](_0xca889d[_0xea74('0x4e')],function(_0x526e27){return{'membername':_0x526e27[_0xea74('0x30')],'UserId':_0x526e27['id'],'queue_name':_0x78d3cf[_0xea74('0x30')],'MailQueueId':_0x78d3cf['id'],'interface':util[_0xea74('0x65')](_0xea74('0x66'),_0xea74('0x67'),_0x526e27[_0xea74('0x30')]),'penalty':0x0,'paused':_0x526e27[_0xea74('0x62')],'createdAt':_0x526e27[_0xea74('0x64')],'updatedAt':_0x526e27[_0xea74('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea74('0x2d')](respondWithFilteredResult(_0x515f9f,_0x129f52))[_0xea74('0x4f')](handleError(_0x515f9f,null));};exports[_0xea74('0x68')]=function(_0x2259fd,_0x176b2c,_0x3067a1){var _0x5de8f0={};var _0x5269d4={};var _0x18818f;var _0x4fc39e;return db['MailQueue'][_0xea74('0x69')]({'where':{'id':_0x2259fd[_0xea74('0x51')]['id']}})[_0xea74('0x2d')](handleEntityNotFound(_0x176b2c,null))[_0xea74('0x2d')](function(_0x4440c9){if(_0x4440c9){_0x18818f=_0x4440c9;_0x5269d4['model']=_[_0xea74('0x3b')](db[_0xea74('0x6a')][_0xea74('0x34')]);_0x5269d4[_0xea74('0x3a')]=_[_0xea74('0x3b')](_0x2259fd[_0xea74('0x3a')]);_0x5269d4[_0xea74('0x46')]=_['intersection'](_0x5269d4[_0xea74('0x38')],_0x5269d4[_0xea74('0x3a')]);_0x5de8f0['attributes']=_['intersection'](_0x5269d4[_0xea74('0x38')],qs['fields'](_0x2259fd['query']['fields']));_0x5de8f0[_0xea74('0x3d')]=_0x5de8f0[_0xea74('0x3d')][_0xea74('0x3f')]?_0x5de8f0[_0xea74('0x3d')]:_0x5269d4[_0xea74('0x38')];_0x5de8f0[_0xea74('0x42')]=qs['sort'](_0x2259fd[_0xea74('0x3a')][_0xea74('0x43')]);_0x5de8f0[_0xea74('0x44')]=qs['filters'](_['pick'](_0x2259fd[_0xea74('0x3a')],_0x5269d4[_0xea74('0x46')]));if(_0x2259fd[_0xea74('0x3a')][_0xea74('0x49')]){_0x5de8f0[_0xea74('0x44')]=_['merge'](_0x5de8f0['where'],{'$or':_[_0xea74('0x39')](_0x5de8f0[_0xea74('0x3d')],function(_0x2be481){var _0x136769={};_0x136769[_0x2be481]={'$like':'%'+_0x2259fd[_0xea74('0x3a')]['filter']+'%'};return _0x136769;})});}_0x5de8f0=_[_0xea74('0x47')]({},_0x5de8f0,_0x2259fd['options']);return _0x18818f[_0xea74('0x68')](_0x5de8f0);}})[_0xea74('0x2d')](function(_0x4e00ad){if(_0x4e00ad){_0x4fc39e=_0x4e00ad['length'];if(!_0x2259fd[_0xea74('0x3a')][_0xea74('0x40')]('nolimit')){_0x5de8f0[_0xea74('0x23')]=qs[_0xea74('0x23')](_0x2259fd['query'][_0xea74('0x23')]);_0x5de8f0[_0xea74('0x20')]=qs[_0xea74('0x20')](_0x2259fd[_0xea74('0x3a')][_0xea74('0x20')]);}return _0x18818f[_0xea74('0x68')](_0x5de8f0);}})['then'](function(_0x8e9732){if(_0x8e9732){return _0x8e9732?{'count':_0x4fc39e,'rows':_0x8e9732}:null;}})[_0xea74('0x2d')](respondWithResult(_0x176b2c,null))['catch'](handleError(_0x176b2c,null));};exports[_0xea74('0x6b')]=function(_0x165ea4,_0x59be80,_0x1440cc){var _0x33cf02=_0x165ea4[_0xea74('0x53')][_0xea74('0x6c')];return db[_0xea74('0x6a')]['findAll']({'where':{'id':_0x33cf02},'attributes':['id'],'include':[{'model':db[_0xea74('0x6d')],'as':_0xea74('0x6e'),'attributes':['id',_0xea74('0x30'),'online',_0xea74('0x6f'),_0xea74('0x70')],'raw':!![]}]})[_0xea74('0x2d')](function(_0x1ca13e){if(_0x1ca13e){var _0x58f0ca=_[_0xea74('0x71')](_0x1ca13e,function(_0x591b6f){var _0x54ccc9=_0x591b6f['get']({'plain':!![]});return _0x54ccc9[_0xea74('0x6e')];});return db[_0xea74('0x33')][_0xea74('0x58')]({'where':{'id':_0x165ea4[_0xea74('0x51')]['id']}})['then'](function(_0x55d7b3){return db[_0xea74('0x72')][_0xea74('0x73')](function(_0x11cfaa){return _0x55d7b3[_0xea74('0x6b')](_0x33cf02,{'transaction':_0x11cfaa})[_0xea74('0x2d')](function(){return BPromise[_0xea74('0x74')](_0x58f0ca,function(_0x1ff457){return db['UserMailQueue'][_0xea74('0x75')]({'where':{'UserId':_0x1ff457['id'],'MailQueueId':_0x165ea4[_0xea74('0x51')]['id']},'transaction':_0x11cfaa});});})[_0xea74('0x2d')](function(){_0x58f0ca[_0xea74('0x76')](function(_0x989510){socket[_0xea74('0x77')](_0xea74('0x78'),{'UserId':_0x989510['id'],'MailQueueId':_0x55d7b3['id']});});});});});}})[_0xea74('0x2d')](respondWithStatusCode(_0x59be80,null))[_0xea74('0x4f')](handleError(_0x59be80,null));};exports[_0xea74('0x79')]=function(_0x249450,_0x407591,_0xc4f007){return db[_0xea74('0x6a')]['findAll']({'where':{'id':_0x249450[_0xea74('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xea74('0x6d')],'as':_0xea74('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xea74('0x2d')](handleEntityNotFound(_0x407591,null))[_0xea74('0x2d')](function(_0x1f35d8){var _0xe1aa09=_[_0xea74('0x39')](_0x1f35d8,'id');var _0x394078=[];var _0x59ce28=[];var _0x5ccac3=squel['select']();_0x5ccac3[_0xea74('0x7a')]('tq.TeamId')[_0xea74('0x7b')]('team_has_mail_queues','tq')[_0xea74('0x7c')](_0xea74('0x7d'),'ut',_0xea74('0x7e'))[_0xea74('0x44')](_0xea74('0x7f'),_0x249450[_0xea74('0x51')]['id']);for(var _0x5dc44a=0x0;_0x5dc44a<_0x1f35d8[_0xea74('0x3f')];_0x5dc44a+=0x1){let _0x4f22d9=_0x1f35d8[_0x5dc44a];for(var _0x5bacc3=0x0;_0x5bacc3<_0x4f22d9['Agents']['length'];_0x5bacc3+=0x1){let _0x519f36=_0x4f22d9['Agents'][_0x5bacc3];var _0x474cdc=_0x5ccac3[_0xea74('0x80')]();_0x474cdc[_0xea74('0x44')]('ut.UserId\x20=\x20?',_0x519f36['id']);_0x59ce28['push'](db[_0xea74('0x72')][_0xea74('0x3a')](_0x474cdc['toString'](),{'type':db[_0xea74('0x72')][_0xea74('0x81')][_0xea74('0x82')]})[_0xea74('0x2d')](function(_0x2b9249){if(_0x2b9249[_0xea74('0x3f')]===0x1){return _0x519f36['id'];}else{var _0x31df89=_['every'](_['map'](_0x2b9249,'TeamId'),function(_0x5857e1){return _['includes'](_0xe1aa09,_0x5857e1);});if(_0x31df89){return _0x519f36['id'];}}}));}}return BPromise[_0xea74('0x83')](_0x59ce28)['then'](function(_0x537d80){_0x394078=_(_0x394078)['union'](_0x537d80)[_0xea74('0x84')]()[_0xea74('0x85')]();return db[_0xea74('0x33')]['find']({'where':{'id':_0x249450[_0xea74('0x51')]['id']}})[_0xea74('0x2d')](function(_0x17fc90){return db[_0xea74('0x72')]['transaction'](function(_0x5b44cb){return _0x17fc90[_0xea74('0x79')](_0x249450[_0xea74('0x3a')][_0xea74('0x6c')],{'transaction':_0x5b44cb})[_0xea74('0x2d')](function(){if(!_[_0xea74('0x86')](_0x394078)){return _0x17fc90['removeAgents'](_0x394078,{'transaction':_0x5b44cb});}})['then'](function(){_0x394078['forEach'](function(_0x46cdde){socket[_0xea74('0x77')]('userMailQueue:remove',{'UserId':_0x46cdde,'MailQueueId':_0x17fc90['id']});});});});});});})[_0xea74('0x2d')](respondWithStatusCode(_0x407591,null))[_0xea74('0x4f')](handleError(_0x407591,null));};exports[_0xea74('0x87')]=function(_0x2003f1,_0x5b7f5b,_0x3d03b1){return db[_0xea74('0x33')][_0xea74('0x58')]({'where':{'id':_0x2003f1['params']['id']}})['then'](handleEntityNotFound(_0x5b7f5b,null))[_0xea74('0x2d')](function(_0x277099){if(_0x277099){return _0x277099['addAgents'](_0x2003f1[_0xea74('0x53')][_0xea74('0x6c')],_[_0xea74('0x88')](_0x2003f1[_0xea74('0x53')],[_0xea74('0x6c'),'id'])||{})[_0xea74('0x89')](function(_0x3e79bc){for(var _0x2371a4=0x0;_0x2371a4<_0x2003f1[_0xea74('0x53')]['ids']['length'];_0x2371a4+=0x1){socket['emit'](_0xea74('0x78'),{'UserId':Number(_0x2003f1[_0xea74('0x53')]['ids'][_0x2371a4]),'MailQueueId':Number(_0x2003f1[_0xea74('0x51')]['id'])});}return _0x3e79bc;});}})['then'](respondWithResult(_0x5b7f5b,null))[_0xea74('0x4f')](handleError(_0x5b7f5b,null));};exports[_0xea74('0x8a')]=function(_0x41516f,_0x298880,_0x3e18b4){return db['MailQueue'][_0xea74('0x58')]({'where':{'id':_0x41516f['params']['id']}})[_0xea74('0x2d')](handleEntityNotFound(_0x298880,null))[_0xea74('0x2d')](function(_0x382da0){if(_0x382da0){return _0x382da0[_0xea74('0x8a')](_0x41516f['query'][_0xea74('0x6c')])[_0xea74('0x2d')](function(){if(_[_0xea74('0x8b')](_0x41516f['query'][_0xea74('0x6c')])){for(var _0x2703f8=0x0;_0x2703f8<_0x41516f[_0xea74('0x3a')]['ids'][_0xea74('0x3f')];_0x2703f8+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x41516f[_0xea74('0x3a')][_0xea74('0x6c')][_0x2703f8]),'MailQueueId':Number(_0x41516f[_0xea74('0x51')]['id'])});}}else{socket[_0xea74('0x77')]('userMailQueue:remove',{'UserId':Number(_0x41516f['query'][_0xea74('0x6c')]),'MailQueueId':Number(_0x41516f[_0xea74('0x51')]['id'])});}});}})[_0xea74('0x2d')](respondWithStatusCode(_0x298880,null))[_0xea74('0x4f')](handleError(_0x298880,null));};exports['getAgents']=function(_0x1ec70f,_0x280581,_0x119b87){var _0x3e2df4={};var _0x1fc861={};var _0x2591a5;var _0x4451e1;return db[_0xea74('0x33')][_0xea74('0x69')]({'where':{'id':_0x1ec70f[_0xea74('0x51')]['id']}})[_0xea74('0x2d')](handleEntityNotFound(_0x280581,null))[_0xea74('0x2d')](function(_0x238657){if(_0x238657){_0x2591a5=_0x238657;_0x1fc861[_0xea74('0x38')]=_['keys'](db['User']['rawAttributes']);_0x1fc861[_0xea74('0x3a')]=_['keys'](_0x1ec70f[_0xea74('0x3a')]);_0x1fc861['filters']=_[_0xea74('0x3c')](_0x1fc861[_0xea74('0x38')],_0x1fc861[_0xea74('0x3a')]);_0x3e2df4[_0xea74('0x3d')]=_[_0xea74('0x3c')](_0x1fc861['model'],qs[_0xea74('0x3e')](_0x1ec70f[_0xea74('0x3a')]['fields']));_0x3e2df4[_0xea74('0x3d')]=_0x3e2df4[_0xea74('0x3d')][_0xea74('0x3f')]?_0x3e2df4[_0xea74('0x3d')]:_0x1fc861[_0xea74('0x38')];_0x3e2df4[_0xea74('0x42')]=qs['sort'](_0x1ec70f[_0xea74('0x3a')][_0xea74('0x43')]);_0x3e2df4[_0xea74('0x44')]=qs[_0xea74('0x46')](_['pick'](_0x1ec70f[_0xea74('0x3a')],_0x1fc861[_0xea74('0x46')]));if(_0x1ec70f[_0xea74('0x3a')][_0xea74('0x49')]){_0x3e2df4[_0xea74('0x44')]=_['merge'](_0x3e2df4[_0xea74('0x44')],{'$or':_[_0xea74('0x39')](_0x3e2df4['attributes'],function(_0x300ea6){var _0x4712b1={};_0x4712b1[_0x300ea6]={'$like':'%'+_0x1ec70f[_0xea74('0x3a')][_0xea74('0x49')]+'%'};return _0x4712b1;})});}_0x3e2df4=_[_0xea74('0x47')]({},_0x3e2df4,_0x1ec70f[_0xea74('0x4a')]);return _0x2591a5[_0xea74('0x8c')](_0x3e2df4);}})[_0xea74('0x2d')](function(_0x301919){if(_0x301919){_0x4451e1=_0x301919[_0xea74('0x3f')];if(!_0x1ec70f[_0xea74('0x3a')][_0xea74('0x40')](_0xea74('0x41'))){_0x3e2df4['limit']=qs['limit'](_0x1ec70f['query'][_0xea74('0x23')]);_0x3e2df4[_0xea74('0x20')]=qs[_0xea74('0x20')](_0x1ec70f[_0xea74('0x3a')][_0xea74('0x20')]);}return _0x2591a5[_0xea74('0x8c')](_0x3e2df4);}})[_0xea74('0x2d')](function(_0x4ccbb5){if(_0x4ccbb5){return _0x4ccbb5?{'count':_0x4451e1,'rows':_0x4ccbb5}:null;}})[_0xea74('0x2d')](respondWithResult(_0x280581,null))[_0xea74('0x4f')](handleError(_0x280581,null));}; \ No newline at end of file +var _0x996b=['removeTeams','select','field','tq.TeamId','user_has_teams','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','includes','all','isEmpty','userMailQueue:remove','addAgents','omit','spread','emit','userMailQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','end','error','stack','name','MailQueue','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','MailQueueId','User','findAndCountAll','UserId','agent','createdAt','mailPause','updatedAt','getTeams','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate'];(function(_0x413d5b,_0x283e5e){var _0x3963a2=function(_0x81d5a9){while(--_0x81d5a9){_0x413d5b['push'](_0x413d5b['shift']());}};_0x3963a2(++_0x283e5e);}(_0x996b,0x9b));var _0xb996=function(_0x41812a,_0x514c8b){_0x41812a=_0x41812a-0x0;var _0x15bf63=_0x996b[_0x41812a];return _0x15bf63;};'use strict';var emlformat=require(_0xb996('0x0'));var rimraf=require(_0xb996('0x1'));var zipdir=require(_0xb996('0x2'));var jsonpatch=require(_0xb996('0x3'));var rp=require(_0xb996('0x4'));var moment=require(_0xb996('0x5'));var BPromise=require(_0xb996('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb996('0x7'));var sox=require(_0xb996('0x8'));var csv=require(_0xb996('0x9'));var ejs=require(_0xb996('0xa'));var fs=require('fs');var fs_extra=require(_0xb996('0xb'));var _=require(_0xb996('0xc'));var squel=require(_0xb996('0xd'));var crypto=require('crypto');var jsforce=require(_0xb996('0xe'));var deskjs=require(_0xb996('0xf'));var toCsv=require(_0xb996('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb996('0x10'));var authService=require(_0xb996('0x11'));var qs=require(_0xb996('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb996('0x13'))(_0xb996('0x14'));var utils=require(_0xb996('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb996('0x16')]=_[_0xb996('0x17')](config[_0xb996('0x16')],{'host':_0xb996('0x18'),'port':0x18eb});var socket=require(_0xb996('0x19'))(new Redis(config[_0xb996('0x16')]));require(_0xb996('0x1a'))[_0xb996('0x1b')](socket);function respondWithStatusCode(_0x8fea15,_0x30ad12){_0x30ad12=_0x30ad12||0xcc;return function(_0x11b909){if(_0x11b909){return _0x8fea15[_0xb996('0x1c')](_0x30ad12);}return _0x8fea15[_0xb996('0x1d')](_0x30ad12)['end']();};}function respondWithResult(_0x383042,_0x39a56f){_0x39a56f=_0x39a56f||0xc8;return function(_0x22b78e){if(_0x22b78e){return _0x383042[_0xb996('0x1d')](_0x39a56f)[_0xb996('0x1e')](_0x22b78e);}};}function respondWithFilteredResult(_0x3ac440,_0x5ef935){return function(_0x8173b5){if(_0x8173b5){var _0x33a6f4=typeof _0x5ef935[_0xb996('0x1f')]==='undefined'&&typeof _0x5ef935[_0xb996('0x20')]==='undefined';var _0x276441=_0x8173b5[_0xb996('0x21')];var _0xec0ce6=_0x33a6f4?0x0:_0x5ef935[_0xb996('0x1f')];var _0x11c011=_0x33a6f4?_0x8173b5[_0xb996('0x21')]:_0x5ef935[_0xb996('0x1f')]+_0x5ef935[_0xb996('0x20')];var _0x1d7bd3;if(_0x11c011>=_0x276441){_0x11c011=_0x276441;_0x1d7bd3=0xc8;}else{_0x1d7bd3=0xce;}_0x3ac440['status'](_0x1d7bd3);return _0x3ac440[_0xb996('0x22')](_0xb996('0x23'),_0xec0ce6+'-'+_0x11c011+'/'+_0x276441)[_0xb996('0x1e')](_0x8173b5);}return null;};}function patchUpdates(_0x268b55){return function(_0x2d1c1a){try{jsonpatch[_0xb996('0x24')](_0x2d1c1a,_0x268b55,!![]);}catch(_0x315ed7){return BPromise['reject'](_0x315ed7);}return _0x2d1c1a[_0xb996('0x25')]();};}function saveUpdates(_0x376d1d,_0x3071ac){return function(_0x1f83b7){if(_0x1f83b7){return _0x1f83b7[_0xb996('0x26')](_0x376d1d)[_0xb996('0x27')](function(_0x44ff6e){return _0x44ff6e;});}return null;};}function removeEntity(_0xf23764,_0x28381d){return function(_0x7a4e3){if(_0x7a4e3){return _0x7a4e3['destroy']()[_0xb996('0x27')](function(){var _0x53c3e0=_0x7a4e3[_0xb996('0x28')]({'plain':!![]});var _0x43c303='MailQueues';return db[_0xb996('0x29')]['destroy']({'where':{'type':_0x43c303,'resourceId':_0x53c3e0['id']}})[_0xb996('0x27')](function(){return _0x7a4e3;});})['then'](function(){_0xf23764[_0xb996('0x1d')](0xcc)[_0xb996('0x2a')]();});}};}function handleEntityNotFound(_0x2473d2,_0x361eba){return function(_0x37f75c){if(!_0x37f75c){_0x2473d2[_0xb996('0x1c')](0x194);}return _0x37f75c;};}function handleError(_0x273de7,_0x12c155){_0x12c155=_0x12c155||0x1f4;return function(_0x5f0e76){logger[_0xb996('0x2b')](_0x5f0e76[_0xb996('0x2c')]);if(_0x5f0e76[_0xb996('0x2d')]){delete _0x5f0e76[_0xb996('0x2d')];}_0x273de7['status'](_0x12c155)['send'](_0x5f0e76);};}exports['index']=function(_0x56ef9d,_0x233849){var _0x328fba={},_0xfac18f={},_0x3caa2a={'count':0x0,'rows':[]};var _0x50ab7b=_['map'](db[_0xb996('0x2e')][_0xb996('0x2f')],function(_0x384e2a){return{'name':_0x384e2a[_0xb996('0x30')],'type':_0x384e2a['type']['key']};});_0xfac18f[_0xb996('0x31')]=_[_0xb996('0x32')](_0x50ab7b,_0xb996('0x2d'));_0xfac18f[_0xb996('0x33')]=_['keys'](_0x56ef9d[_0xb996('0x33')]);_0xfac18f[_0xb996('0x34')]=_[_0xb996('0x35')](_0xfac18f[_0xb996('0x31')],_0xfac18f['query']);_0x328fba[_0xb996('0x36')]=_[_0xb996('0x35')](_0xfac18f[_0xb996('0x31')],qs[_0xb996('0x37')](_0x56ef9d['query'][_0xb996('0x37')]));_0x328fba[_0xb996('0x36')]=_0x328fba[_0xb996('0x36')][_0xb996('0x38')]?_0x328fba[_0xb996('0x36')]:_0xfac18f['model'];if(!_0x56ef9d['query']['hasOwnProperty'](_0xb996('0x39'))){_0x328fba['limit']=qs[_0xb996('0x20')](_0x56ef9d['query']['limit']);_0x328fba[_0xb996('0x1f')]=qs['offset'](_0x56ef9d[_0xb996('0x33')]['offset']);}_0x328fba['order']=qs[_0xb996('0x3a')](_0x56ef9d['query']['sort']);_0x328fba[_0xb996('0x3b')]=qs[_0xb996('0x34')](_[_0xb996('0x3c')](_0x56ef9d[_0xb996('0x33')],_0xfac18f[_0xb996('0x34')]),_0x50ab7b);if(_0x56ef9d['query'][_0xb996('0x3d')]){_0x328fba['where']=_[_0xb996('0x3e')](_0x328fba['where'],{'$or':_[_0xb996('0x32')](_0x50ab7b,function(_0x4cd034){if(_0x4cd034[_0xb996('0x3f')]!==_0xb996('0x40')){var _0x40e569={};_0x40e569[_0x4cd034[_0xb996('0x2d')]]={'$like':'%'+_0x56ef9d[_0xb996('0x33')][_0xb996('0x3d')]+'%'};return _0x40e569;}})});}_0x328fba=_[_0xb996('0x3e')]({},_0x328fba,_0x56ef9d[_0xb996('0x41')]);var _0x395576={'where':_0x328fba[_0xb996('0x3b')]};return db['MailQueue'][_0xb996('0x21')](_0x395576)[_0xb996('0x27')](function(_0x1cbcf7){_0x3caa2a[_0xb996('0x21')]=_0x1cbcf7;if(_0x56ef9d[_0xb996('0x33')][_0xb996('0x42')]){_0x328fba['include']=[{'all':!![]}];}return db[_0xb996('0x2e')][_0xb996('0x43')](_0x328fba);})[_0xb996('0x27')](function(_0x2954a0){_0x3caa2a[_0xb996('0x44')]=_0x2954a0;return _0x3caa2a;})[_0xb996('0x27')](respondWithFilteredResult(_0x233849,_0x328fba))[_0xb996('0x45')](handleError(_0x233849,null));};exports[_0xb996('0x46')]=function(_0x10da79,_0x2a1813){var _0x4f8e06={'raw':!![],'where':{'id':_0x10da79['params']['id']}},_0x1926c8={};_0x1926c8[_0xb996('0x31')]=_[_0xb996('0x47')](db[_0xb996('0x2e')]['rawAttributes']);_0x1926c8[_0xb996('0x33')]=_[_0xb996('0x47')](_0x10da79[_0xb996('0x33')]);_0x1926c8[_0xb996('0x34')]=_[_0xb996('0x35')](_0x1926c8[_0xb996('0x31')],_0x1926c8[_0xb996('0x33')]);_0x4f8e06['attributes']=_[_0xb996('0x35')](_0x1926c8[_0xb996('0x31')],qs[_0xb996('0x37')](_0x10da79['query'][_0xb996('0x37')]));_0x4f8e06['attributes']=_0x4f8e06[_0xb996('0x36')]['length']?_0x4f8e06[_0xb996('0x36')]:_0x1926c8[_0xb996('0x31')];if(_0x10da79[_0xb996('0x33')]['includeAll']){_0x4f8e06['include']=[{'all':!![]}];}_0x4f8e06=_['merge']({},_0x4f8e06,_0x10da79[_0xb996('0x41')]);return db['MailQueue'][_0xb996('0x48')](_0x4f8e06)[_0xb996('0x27')](handleEntityNotFound(_0x2a1813,null))[_0xb996('0x27')](respondWithResult(_0x2a1813,null))[_0xb996('0x45')](handleError(_0x2a1813,null));};exports[_0xb996('0x49')]=function(_0x29a5a8,_0x27a0d8){return db[_0xb996('0x2e')]['create'](_0x29a5a8[_0xb996('0x4a')],{})[_0xb996('0x27')](function(_0x116442){var _0x3af09f=_0x29a5a8[_0xb996('0x4b')][_0xb996('0x28')]({'plain':!![]});if(!_0x3af09f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3af09f[_0xb996('0x4c')]===_0xb996('0x4b')){var _0x48d01d=_0x116442[_0xb996('0x28')]({'plain':!![]});var _0x2d4b63='MailQueues';return db[_0xb996('0x4d')][_0xb996('0x48')]({'where':{'name':_0x2d4b63,'userProfileId':_0x3af09f['userProfileId']},'raw':!![]})[_0xb996('0x27')](function(_0x1e81b7){if(_0x1e81b7&&_0x1e81b7[_0xb996('0x4e')]===0x0){return db[_0xb996('0x29')][_0xb996('0x49')]({'name':_0x48d01d[_0xb996('0x2d')],'resourceId':_0x48d01d['id'],'type':_0x1e81b7['name'],'sectionId':_0x1e81b7['id']},{})['then'](function(){return _0x116442;});}else{return _0x116442;}})[_0xb996('0x45')](function(_0x13cd58){logger[_0xb996('0x2b')](_0xb996('0x4f'),_0x13cd58);throw _0x13cd58;});}return _0x116442;})['then'](respondWithResult(_0x27a0d8,0xc9))['catch'](handleError(_0x27a0d8,null));};exports['update']=function(_0x499a3e,_0x4527d9){if(_0x499a3e[_0xb996('0x4a')]['id']){delete _0x499a3e[_0xb996('0x4a')]['id'];}return db[_0xb996('0x2e')][_0xb996('0x48')]({'where':{'id':_0x499a3e[_0xb996('0x50')]['id']}})['then'](handleEntityNotFound(_0x4527d9,null))[_0xb996('0x27')](saveUpdates(_0x499a3e[_0xb996('0x4a')],null))['then'](respondWithResult(_0x4527d9,null))[_0xb996('0x45')](handleError(_0x4527d9,null));};exports[_0xb996('0x51')]=function(_0x1c8a39,_0xc2ccbd){return db[_0xb996('0x2e')][_0xb996('0x48')]({'where':{'id':_0x1c8a39[_0xb996('0x50')]['id']}})[_0xb996('0x27')](handleEntityNotFound(_0xc2ccbd,null))['then'](removeEntity(_0xc2ccbd,null))[_0xb996('0x45')](handleError(_0xc2ccbd,null));};exports[_0xb996('0x52')]=function(_0x3fd416,_0x7209ca){return db[_0xb996('0x2e')]['describe']()['then'](respondWithResult(_0x7209ca,null))['catch'](handleError(_0x7209ca,null));};exports[_0xb996('0x53')]=function(_0x3f695e,_0x17f8e7,_0x333cd6){var _0x4e7a32={'raw':!![],'where':{}},_0x2a9885={},_0x5c2eae;return db['MailQueue'][_0xb996('0x54')]({'where':{'id':_0x3f695e[_0xb996('0x50')]['id']}})['then'](handleEntityNotFound(_0x17f8e7,null))[_0xb996('0x27')](function(_0x4f7386){if(_0x4f7386){_0x5c2eae=_0x4f7386[_0xb996('0x28')]({'plain':!![]});_0x2a9885['model']=_[_0xb996('0x47')](db[_0xb996('0x55')][_0xb996('0x2f')]);_0x2a9885['query']=_[_0xb996('0x47')](_0x3f695e['query']);_0x2a9885[_0xb996('0x34')]=_['intersection'](_0x2a9885[_0xb996('0x31')],_0x2a9885[_0xb996('0x33')]);_0x4e7a32[_0xb996('0x36')]=_['intersection'](_0x2a9885[_0xb996('0x31')],qs['fields'](_0x3f695e[_0xb996('0x33')][_0xb996('0x37')]));_0x4e7a32[_0xb996('0x36')]=_0x4e7a32[_0xb996('0x36')][_0xb996('0x38')]?_0x4e7a32[_0xb996('0x36')]:_0x2a9885['model'];if(!_0x3f695e[_0xb996('0x33')][_0xb996('0x56')](_0xb996('0x39'))){_0x4e7a32[_0xb996('0x20')]=qs['limit'](_0x3f695e[_0xb996('0x33')][_0xb996('0x20')]);_0x4e7a32[_0xb996('0x1f')]=qs[_0xb996('0x1f')](_0x3f695e[_0xb996('0x33')][_0xb996('0x1f')]);}_0x4e7a32[_0xb996('0x57')]=qs['sort'](_0x3f695e['query'][_0xb996('0x3a')]);_0x4e7a32['where']=qs[_0xb996('0x34')](_[_0xb996('0x3c')](_0x3f695e[_0xb996('0x33')],_0x2a9885[_0xb996('0x34')]));_0x4e7a32['where'][_0xb996('0x58')]=_0x4f7386['id'];if(_0x3f695e['query'][_0xb996('0x3d')]){_0x4e7a32['where']=_[_0xb996('0x3e')](_0x4e7a32[_0xb996('0x3b')],{'$or':_[_0xb996('0x32')](_0x4e7a32[_0xb996('0x36')],function(_0x1fdc68){var _0x3aa11e={};_0x3aa11e[_0x1fdc68]={'$like':'%'+_0x3f695e[_0xb996('0x33')]['filter']+'%'};return _0x3aa11e;})});}_0x4e7a32=_[_0xb996('0x3e')]({},_0x4e7a32,_0x3f695e[_0xb996('0x41')]);return db['UserMailQueue'][_0xb996('0x43')](_0x4e7a32);}})[_0xb996('0x27')](function(_0x30db62){if(_0x30db62){return db[_0xb996('0x59')][_0xb996('0x5a')]({'where':{'id':_[_0xb996('0x32')](_0x30db62,_0xb996('0x5b')),'role':_0xb996('0x5c')},'attributes':['id',_0xb996('0x2d'),'mailPause','updatedAt',_0xb996('0x5d')]});}})[_0xb996('0x27')](function(_0x806015){if(_0x806015){return{'count':_0x806015[_0xb996('0x21')],'rows':_[_0xb996('0x32')](_0x806015[_0xb996('0x44')],function(_0x2ad601){return{'membername':_0x2ad601[_0xb996('0x2d')],'UserId':_0x2ad601['id'],'queue_name':_0x5c2eae[_0xb996('0x2d')],'MailQueueId':_0x5c2eae['id'],'interface':util['format']('%s/%s','SIP',_0x2ad601['name']),'penalty':0x0,'paused':_0x2ad601[_0xb996('0x5e')],'createdAt':_0x2ad601[_0xb996('0x5d')],'updatedAt':_0x2ad601[_0xb996('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb996('0x27')](respondWithFilteredResult(_0x17f8e7,_0x4e7a32))['catch'](handleError(_0x17f8e7,null));};exports[_0xb996('0x60')]=function(_0x20b1e7,_0x1a5525,_0x55a591){var _0x3cab34={};var _0x13859b={};var _0x42c023;var _0x6dfa0d;return db[_0xb996('0x2e')][_0xb996('0x54')]({'where':{'id':_0x20b1e7['params']['id']}})[_0xb996('0x27')](handleEntityNotFound(_0x1a5525,null))['then'](function(_0x410240){if(_0x410240){_0x42c023=_0x410240;_0x13859b[_0xb996('0x31')]=_['keys'](db[_0xb996('0x61')][_0xb996('0x2f')]);_0x13859b[_0xb996('0x33')]=_[_0xb996('0x47')](_0x20b1e7['query']);_0x13859b['filters']=_[_0xb996('0x35')](_0x13859b[_0xb996('0x31')],_0x13859b[_0xb996('0x33')]);_0x3cab34['attributes']=_[_0xb996('0x35')](_0x13859b[_0xb996('0x31')],qs[_0xb996('0x37')](_0x20b1e7[_0xb996('0x33')][_0xb996('0x37')]));_0x3cab34[_0xb996('0x36')]=_0x3cab34[_0xb996('0x36')][_0xb996('0x38')]?_0x3cab34[_0xb996('0x36')]:_0x13859b[_0xb996('0x31')];_0x3cab34[_0xb996('0x57')]=qs[_0xb996('0x3a')](_0x20b1e7[_0xb996('0x33')][_0xb996('0x3a')]);_0x3cab34[_0xb996('0x3b')]=qs[_0xb996('0x34')](_[_0xb996('0x3c')](_0x20b1e7[_0xb996('0x33')],_0x13859b[_0xb996('0x34')]));if(_0x20b1e7[_0xb996('0x33')][_0xb996('0x3d')]){_0x3cab34[_0xb996('0x3b')]=_['merge'](_0x3cab34[_0xb996('0x3b')],{'$or':_['map'](_0x3cab34['attributes'],function(_0x3b7622){var _0x59e39f={};_0x59e39f[_0x3b7622]={'$like':'%'+_0x20b1e7[_0xb996('0x33')][_0xb996('0x3d')]+'%'};return _0x59e39f;})});}_0x3cab34=_['merge']({},_0x3cab34,_0x20b1e7[_0xb996('0x41')]);return _0x42c023['getTeams'](_0x3cab34);}})[_0xb996('0x27')](function(_0x50fd4f){if(_0x50fd4f){_0x6dfa0d=_0x50fd4f[_0xb996('0x38')];if(!_0x20b1e7['query'][_0xb996('0x56')]('nolimit')){_0x3cab34['limit']=qs[_0xb996('0x20')](_0x20b1e7['query']['limit']);_0x3cab34[_0xb996('0x1f')]=qs[_0xb996('0x1f')](_0x20b1e7[_0xb996('0x33')][_0xb996('0x1f')]);}return _0x42c023[_0xb996('0x60')](_0x3cab34);}})[_0xb996('0x27')](function(_0x368633){if(_0x368633){return _0x368633?{'count':_0x6dfa0d,'rows':_0x368633}:null;}})['then'](respondWithResult(_0x1a5525,null))[_0xb996('0x45')](handleError(_0x1a5525,null));};exports['addTeams']=function(_0x41b2b1,_0x5ee28c,_0x7a2de0){var _0x49d82f=_0x41b2b1[_0xb996('0x4a')][_0xb996('0x62')];return db['Team'][_0xb996('0x43')]({'where':{'id':_0x49d82f},'attributes':['id'],'include':[{'model':db[_0xb996('0x59')],'as':'Agents','attributes':['id','name',_0xb996('0x63'),_0xb996('0x64'),_0xb996('0x65')],'raw':!![]}]})[_0xb996('0x27')](function(_0x207331){if(_0x207331){var _0x58bfda=_[_0xb996('0x66')](_0x207331,function(_0x5b8957){var _0x33bacd=_0x5b8957[_0xb996('0x28')]({'plain':!![]});return _0x33bacd[_0xb996('0x67')];});return db[_0xb996('0x2e')][_0xb996('0x48')]({'where':{'id':_0x41b2b1[_0xb996('0x50')]['id']}})['then'](function(_0x27d3c4){return db[_0xb996('0x68')][_0xb996('0x69')](function(_0x169bca){return _0x27d3c4[_0xb996('0x6a')](_0x49d82f,{'transaction':_0x169bca})[_0xb996('0x27')](function(){return BPromise[_0xb996('0x6b')](_0x58bfda,function(_0x522b06){return db[_0xb996('0x55')][_0xb996('0x6c')]({'where':{'UserId':_0x522b06['id'],'MailQueueId':_0x41b2b1[_0xb996('0x50')]['id']},'transaction':_0x169bca});});})[_0xb996('0x27')](function(){_0x58bfda['forEach'](function(_0x356188){socket['emit']('userMailQueue:save',{'UserId':_0x356188['id'],'MailQueueId':_0x27d3c4['id']});});});});});}})[_0xb996('0x27')](respondWithStatusCode(_0x5ee28c,null))['catch'](handleError(_0x5ee28c,null));};exports[_0xb996('0x6d')]=function(_0x5392ef,_0x957709,_0x3fc709){return db[_0xb996('0x61')][_0xb996('0x43')]({'where':{'id':_0x5392ef['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb996('0x59')],'as':_0xb996('0x67'),'attributes':['id'],'raw':!![]}]})[_0xb996('0x27')](handleEntityNotFound(_0x957709,null))['then'](function(_0x2b3289){var _0x1ee7a3=_[_0xb996('0x32')](_0x2b3289,'id');var _0x4a3707=[];var _0x205ded=[];var _0x4d7e44=squel[_0xb996('0x6e')]();_0x4d7e44[_0xb996('0x6f')](_0xb996('0x70'))['from']('team_has_mail_queues','tq')['join'](_0xb996('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xb996('0x72'),_0x5392ef[_0xb996('0x50')]['id']);for(var _0x255df8=0x0;_0x255df8<_0x2b3289[_0xb996('0x38')];_0x255df8+=0x1){let _0x5e37d9=_0x2b3289[_0x255df8];for(var _0x10d527=0x0;_0x10d527<_0x5e37d9[_0xb996('0x67')][_0xb996('0x38')];_0x10d527+=0x1){let _0x282223=_0x5e37d9[_0xb996('0x67')][_0x10d527];var _0x31a729=_0x4d7e44[_0xb996('0x73')]();_0x31a729[_0xb996('0x3b')]('ut.UserId\x20=\x20?',_0x282223['id']);_0x205ded['push'](db['sequelize'][_0xb996('0x33')](_0x31a729[_0xb996('0x74')](),{'type':db[_0xb996('0x68')][_0xb996('0x75')][_0xb996('0x76')]})[_0xb996('0x27')](function(_0x5d650f){if(_0x5d650f[_0xb996('0x38')]===0x1){return _0x282223['id'];}else{var _0x4f5dfc=_[_0xb996('0x77')](_['map'](_0x5d650f,'TeamId'),function(_0xe706d5){return _[_0xb996('0x78')](_0x1ee7a3,_0xe706d5);});if(_0x4f5dfc){return _0x282223['id'];}}}));}}return BPromise[_0xb996('0x79')](_0x205ded)[_0xb996('0x27')](function(_0x43bf7e){_0x4a3707=_(_0x4a3707)['union'](_0x43bf7e)['compact']()['value']();return db[_0xb996('0x2e')][_0xb996('0x48')]({'where':{'id':_0x5392ef[_0xb996('0x50')]['id']}})[_0xb996('0x27')](function(_0x1bd1f8){return db['sequelize'][_0xb996('0x69')](function(_0x99bc27){return _0x1bd1f8[_0xb996('0x6d')](_0x5392ef[_0xb996('0x33')]['ids'],{'transaction':_0x99bc27})['then'](function(){if(!_[_0xb996('0x7a')](_0x4a3707)){return _0x1bd1f8['removeAgents'](_0x4a3707,{'transaction':_0x99bc27});}})[_0xb996('0x27')](function(){_0x4a3707['forEach'](function(_0x4f204e){socket['emit'](_0xb996('0x7b'),{'UserId':_0x4f204e,'MailQueueId':_0x1bd1f8['id']});});});});});});})[_0xb996('0x27')](respondWithStatusCode(_0x957709,null))['catch'](handleError(_0x957709,null));};exports[_0xb996('0x7c')]=function(_0x5bbbcb,_0x2b49be,_0xc1b6ba){return db[_0xb996('0x2e')][_0xb996('0x48')]({'where':{'id':_0x5bbbcb[_0xb996('0x50')]['id']}})[_0xb996('0x27')](handleEntityNotFound(_0x2b49be,null))[_0xb996('0x27')](function(_0x3afa2c){if(_0x3afa2c){return _0x3afa2c['addAgents'](_0x5bbbcb[_0xb996('0x4a')][_0xb996('0x62')],_[_0xb996('0x7d')](_0x5bbbcb['body'],[_0xb996('0x62'),'id'])||{})[_0xb996('0x7e')](function(_0x5bdfbe){for(var _0x541d31=0x0;_0x541d31<_0x5bbbcb[_0xb996('0x4a')][_0xb996('0x62')][_0xb996('0x38')];_0x541d31+=0x1){socket[_0xb996('0x7f')](_0xb996('0x80'),{'UserId':Number(_0x5bbbcb[_0xb996('0x4a')][_0xb996('0x62')][_0x541d31]),'MailQueueId':Number(_0x5bbbcb[_0xb996('0x50')]['id'])});}return _0x5bdfbe;});}})['then'](respondWithResult(_0x2b49be,null))[_0xb996('0x45')](handleError(_0x2b49be,null));};exports[_0xb996('0x81')]=function(_0x5e0d40,_0x1a2366,_0x58db42){return db[_0xb996('0x2e')][_0xb996('0x48')]({'where':{'id':_0x5e0d40[_0xb996('0x50')]['id']}})[_0xb996('0x27')](handleEntityNotFound(_0x1a2366,null))['then'](function(_0x531534){if(_0x531534){return _0x531534[_0xb996('0x81')](_0x5e0d40[_0xb996('0x33')][_0xb996('0x62')])[_0xb996('0x27')](function(){if(_[_0xb996('0x82')](_0x5e0d40[_0xb996('0x33')]['ids'])){for(var _0xaf2a6d=0x0;_0xaf2a6d<_0x5e0d40[_0xb996('0x33')][_0xb996('0x62')][_0xb996('0x38')];_0xaf2a6d+=0x1){socket[_0xb996('0x7f')](_0xb996('0x7b'),{'UserId':Number(_0x5e0d40[_0xb996('0x33')]['ids'][_0xaf2a6d]),'MailQueueId':Number(_0x5e0d40[_0xb996('0x50')]['id'])});}}else{socket[_0xb996('0x7f')](_0xb996('0x7b'),{'UserId':Number(_0x5e0d40[_0xb996('0x33')][_0xb996('0x62')]),'MailQueueId':Number(_0x5e0d40['params']['id'])});}});}})[_0xb996('0x27')](respondWithStatusCode(_0x1a2366,null))[_0xb996('0x45')](handleError(_0x1a2366,null));};exports['getAgents']=function(_0x375d8d,_0x39d2c1,_0x11183d){var _0x455611={};var _0x274962={};var _0x1f0d3d;var _0x5571f7;return db['MailQueue'][_0xb996('0x54')]({'where':{'id':_0x375d8d[_0xb996('0x50')]['id']}})[_0xb996('0x27')](handleEntityNotFound(_0x39d2c1,null))[_0xb996('0x27')](function(_0x12e7f1){if(_0x12e7f1){_0x1f0d3d=_0x12e7f1;_0x274962[_0xb996('0x31')]=_[_0xb996('0x47')](db[_0xb996('0x59')][_0xb996('0x2f')]);_0x274962[_0xb996('0x33')]=_[_0xb996('0x47')](_0x375d8d['query']);_0x274962[_0xb996('0x34')]=_['intersection'](_0x274962[_0xb996('0x31')],_0x274962[_0xb996('0x33')]);_0x455611[_0xb996('0x36')]=_['intersection'](_0x274962['model'],qs[_0xb996('0x37')](_0x375d8d[_0xb996('0x33')][_0xb996('0x37')]));_0x455611[_0xb996('0x36')]=_0x455611['attributes']['length']?_0x455611[_0xb996('0x36')]:_0x274962[_0xb996('0x31')];_0x455611[_0xb996('0x57')]=qs[_0xb996('0x3a')](_0x375d8d['query']['sort']);_0x455611['where']=qs[_0xb996('0x34')](_['pick'](_0x375d8d[_0xb996('0x33')],_0x274962[_0xb996('0x34')]));if(_0x375d8d['query'][_0xb996('0x3d')]){_0x455611[_0xb996('0x3b')]=_[_0xb996('0x3e')](_0x455611[_0xb996('0x3b')],{'$or':_[_0xb996('0x32')](_0x455611[_0xb996('0x36')],function(_0x48aebb){var _0xa7451c={};_0xa7451c[_0x48aebb]={'$like':'%'+_0x375d8d[_0xb996('0x33')]['filter']+'%'};return _0xa7451c;})});}_0x455611=_[_0xb996('0x3e')]({},_0x455611,_0x375d8d[_0xb996('0x41')]);return _0x1f0d3d[_0xb996('0x83')](_0x455611);}})['then'](function(_0x53838b){if(_0x53838b){_0x5571f7=_0x53838b[_0xb996('0x38')];if(!_0x375d8d[_0xb996('0x33')]['hasOwnProperty'](_0xb996('0x39'))){_0x455611[_0xb996('0x20')]=qs[_0xb996('0x20')](_0x375d8d[_0xb996('0x33')]['limit']);_0x455611['offset']=qs[_0xb996('0x1f')](_0x375d8d[_0xb996('0x33')]['offset']);}return _0x1f0d3d[_0xb996('0x83')](_0x455611);}})[_0xb996('0x27')](function(_0x246b83){if(_0x246b83){return _0x246b83?{'count':_0x5571f7,'rows':_0x246b83}:null;}})[_0xb996('0x27')](respondWithResult(_0x39d2c1,null))['catch'](handleError(_0x39d2c1,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f1c55d4..88e6222 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 _0x5495=['remove','emit','hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5495,0x69));var _0x5549=function(_0x367cb3,_0x46d60d){_0x367cb3=_0x367cb3-0x0;var _0x38cafc=_0x5495[_0x367cb3];return _0x38cafc;};'use strict';var EventEmitter=require(_0x5549('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x5549('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5549('0x2')](0x0);var events={'afterCreate':_0x5549('0x3'),'afterUpdate':_0x5549('0x4'),'afterDestroy':_0x5549('0x5')};function emitEvent(_0x23d204){return function(_0x235f59,_0x54ef99,_0x361e3f){MailQueueEvents['emit'](_0x23d204+':'+_0x235f59['id'],_0x235f59);MailQueueEvents[_0x5549('0x6')](_0x23d204,_0x235f59);_0x361e3f(null);};}for(var e in events){if(events[_0x5549('0x7')](e)){var event=events[e];MailQueue[_0x5549('0x8')](e,emitEvent(event));}}module[_0x5549('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x7bb7=['update','remove','emit','hook','exports','events','../../mysqldb','MailQueue','save'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x7bb7,0x9e));var _0x77bb=function(_0x4b064e,_0x803e39){_0x4b064e=_0x4b064e-0x0;var _0x3972fa=_0x7bb7[_0x4b064e];return _0x3972fa;};'use strict';var EventEmitter=require(_0x77bb('0x0'));var MailQueue=require(_0x77bb('0x1'))['db'][_0x77bb('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77bb('0x3'),'afterUpdate':_0x77bb('0x4'),'afterDestroy':_0x77bb('0x5')};function emitEvent(_0x4cff61){return function(_0x4c854f,_0x389b4c,_0x36a928){MailQueueEvents['emit'](_0x4cff61+':'+_0x4c854f['id'],_0x4c854f);MailQueueEvents[_0x77bb('0x6')](_0x4cff61,_0x4c854f);_0x36a928(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x77bb('0x7')](e,emitEvent(event));}}module[_0x77bb('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index abdf490..1fd765e 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 _0xce2e=['path','rimraf','../../config/environment','define','MailQueue','mail_queues','../../config/logger','moment','bluebird','request-promise'];(function(_0x16eadc,_0x3fc953){var _0x5b05c8=function(_0xd8b9cf){while(--_0xd8b9cf){_0x16eadc['push'](_0x16eadc['shift']());}};_0x5b05c8(++_0x3fc953);}(_0xce2e,0x1dc));var _0xece2=function(_0x267390,_0x1733f2){_0x267390=_0x267390-0x0;var _0x19c5a9=_0xce2e[_0x267390];return _0x19c5a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xece2('0x0'))('api');var moment=require(_0xece2('0x1'));var BPromise=require(_0xece2('0x2'));var rp=require(_0xece2('0x3'));var fs=require('fs');var path=require(_0xece2('0x4'));var rimraf=require(_0xece2('0x5'));var config=require(_0xece2('0x6'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x5ba9f1,_0x228134){return _0x5ba9f1[_0xece2('0x7')](_0xece2('0x8'),attributes,{'tableName':_0xece2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc276=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x2b5dcc,_0x15dabe){var _0x54fbc2=function(_0x5d66ec){while(--_0x5d66ec){_0x2b5dcc['push'](_0x2b5dcc['shift']());}};_0x54fbc2(++_0x15dabe);}(_0xc276,0x1e9));var _0x6c27=function(_0x1fd650,_0x86c410){_0x1fd650=_0x1fd650-0x0;var _0x34ef40=_0xc276[_0x1fd650];return _0x34ef40;};'use strict';var _=require('lodash');var util=require(_0x6c27('0x0'));var logger=require(_0x6c27('0x1'))(_0x6c27('0x2'));var moment=require('moment');var BPromise=require(_0x6c27('0x3'));var rp=require(_0x6c27('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c27('0x5'));var config=require(_0x6c27('0x6'));var attributes=require(_0x6c27('0x7'));module[_0x6c27('0x8')]=function(_0x5e47fb,_0x546b9a){return _0x5e47fb[_0x6c27('0x9')](_0x6c27('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 2a6c672..a99d96f 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 _0x0647=['where','attributes','limit','include','map','model','ShowMailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw'];(function(_0x411c38,_0xc5b5c6){var _0x295522=function(_0x576501){while(--_0x576501){_0x411c38['push'](_0x411c38['shift']());}};_0x295522(++_0xc5b5c6);}(_0x0647,0xd0));var _0x7064=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x0647[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0x7064('0x0'));var util=require('util');var moment=require(_0x7064('0x1'));var BPromise=require(_0x7064('0x2'));var rs=require(_0x7064('0x3'));var fs=require('fs');var Redis=require(_0x7064('0x4'));var db=require(_0x7064('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7064('0x6'));var config=require(_0x7064('0x7'));var jayson=require(_0x7064('0x8'));var client=jayson[_0x7064('0x9')][_0x7064('0xa')]({'port':0x232a});config[_0x7064('0xb')]=_['defaults'](config['redis'],{'host':_0x7064('0xc'),'port':0x18eb});var socket=require(_0x7064('0xd'))(new Redis(config[_0x7064('0xb')]));require('./mailQueue.socket')[_0x7064('0xe')](socket);function respondWithRpcPromise(_0x3f3bdd,_0x5f4ba5,_0xd2aec9){return new BPromise(function(_0x1465bd,_0x3fc84f){return client['request'](_0x3f3bdd,_0xd2aec9)[_0x7064('0xf')](function(_0x17a558){logger[_0x7064('0x10')](_0x7064('0x11'),_0x5f4ba5,'request\x20sent');logger[_0x7064('0x12')](_0x7064('0x13'),_0x5f4ba5,_0x7064('0x14'),JSON[_0x7064('0x15')](_0x17a558));if(_0x17a558[_0x7064('0x16')]){if(_0x17a558[_0x7064('0x16')][_0x7064('0x17')]===0x1f4){logger[_0x7064('0x16')]('MailQueue,\x20%s,\x20%s',_0x5f4ba5,_0x17a558['error']['message']);return _0x3fc84f(_0x17a558[_0x7064('0x16')][_0x7064('0x18')]);}logger[_0x7064('0x16')]('MailQueue,\x20%s,\x20%s',_0x5f4ba5,_0x17a558[_0x7064('0x16')][_0x7064('0x18')]);return _0x1465bd(_0x17a558['error'][_0x7064('0x18')]);}else{logger[_0x7064('0x10')](_0x7064('0x11'),_0x5f4ba5,_0x7064('0x14'));_0x1465bd(_0x17a558[_0x7064('0x19')][_0x7064('0x18')]);}})[_0x7064('0x1a')](function(_0x3e8d73){logger[_0x7064('0x16')](_0x7064('0x11'),_0x5f4ba5,_0x3e8d73);_0x3fc84f(_0x3e8d73);});});}exports[_0x7064('0x1b')]=function(_0x322cc8){var _0x17bfe4=this;return new Promise(function(_0x5c9de8,_0x431fac){return db[_0x7064('0x1c')][_0x7064('0x1d')]({'raw':_0x322cc8[_0x7064('0x1e')]?_0x322cc8['options'][_0x7064('0x1f')]===undefined?!![]:![]:!![],'where':_0x322cc8['options']?_0x322cc8[_0x7064('0x1e')][_0x7064('0x20')]||null:null,'attributes':_0x322cc8['options']?_0x322cc8[_0x7064('0x1e')][_0x7064('0x21')]||null:null,'limit':_0x322cc8[_0x7064('0x1e')]?_0x322cc8[_0x7064('0x1e')][_0x7064('0x22')]||null:null,'include':_0x322cc8['options']?_0x322cc8['options'][_0x7064('0x23')]?_['map'](_0x322cc8[_0x7064('0x1e')][_0x7064('0x23')],function(_0x25d627){return{'model':db[_0x25d627['model']],'as':_0x25d627['as'],'attributes':_0x25d627[_0x7064('0x21')],'include':_0x25d627[_0x7064('0x23')]?_[_0x7064('0x24')](_0x25d627[_0x7064('0x23')],function(_0x358e67){return{'model':db[_0x358e67['model']],'as':_0x358e67['as'],'attributes':_0x358e67['attributes'],'include':_0x358e67['include']?_['map'](_0x358e67[_0x7064('0x23')],function(_0x4aad53){return{'model':db[_0x4aad53[_0x7064('0x25')]],'as':_0x4aad53['as'],'attributes':_0x4aad53[_0x7064('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40a434){logger[_0x7064('0x10')](_0x7064('0x1b'),_0x322cc8);logger[_0x7064('0x12')](_0x7064('0x1b'),_0x322cc8,JSON['stringify'](_0x40a434));_0x5c9de8(_0x40a434);})[_0x7064('0x1a')](function(_0x230f24){logger[_0x7064('0x16')](_0x7064('0x1b'),_0x230f24['message'],_0x322cc8);_0x431fac(_0x17bfe4['error'](0x1f4,_0x230f24['message']));});});};exports[_0x7064('0x26')]=function(_0x5ebec7){var _0x34158c=this;return new Promise(function(_0x2f8686,_0x497c74){return db[_0x7064('0x1c')][_0x7064('0x27')]({'raw':_0x5ebec7[_0x7064('0x1e')]?_0x5ebec7[_0x7064('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5ebec7['options']?_0x5ebec7[_0x7064('0x1e')]['where']||null:null,'attributes':_0x5ebec7[_0x7064('0x1e')]?_0x5ebec7[_0x7064('0x1e')][_0x7064('0x21')]||null:null,'include':_0x5ebec7['options']?_0x5ebec7[_0x7064('0x1e')][_0x7064('0x23')]?_[_0x7064('0x24')](_0x5ebec7[_0x7064('0x1e')]['include'],function(_0x4ee3a2){return{'model':db[_0x4ee3a2[_0x7064('0x25')]],'as':_0x4ee3a2['as'],'attributes':_0x4ee3a2[_0x7064('0x21')],'include':_0x4ee3a2['include']?_[_0x7064('0x24')](_0x4ee3a2[_0x7064('0x23')],function(_0x2ac40d){return{'model':db[_0x2ac40d[_0x7064('0x25')]],'as':_0x2ac40d['as'],'attributes':_0x2ac40d[_0x7064('0x21')],'include':_0x2ac40d[_0x7064('0x23')]?_[_0x7064('0x24')](_0x2ac40d[_0x7064('0x23')],function(_0x58dff8){return{'model':db[_0x58dff8[_0x7064('0x25')]],'as':_0x58dff8['as'],'attributes':_0x58dff8[_0x7064('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42082f){logger[_0x7064('0x10')](_0x7064('0x26'),_0x5ebec7);logger[_0x7064('0x12')](_0x7064('0x26'),_0x5ebec7,JSON['stringify'](_0x42082f));_0x2f8686(_0x42082f);})[_0x7064('0x1a')](function(_0x28c5ff){logger[_0x7064('0x16')](_0x7064('0x26'),_0x28c5ff[_0x7064('0x18')],_0x5ebec7);_0x497c74(_0x34158c[_0x7064('0x16')](0x1f4,_0x28c5ff['message']));});});}; \ No newline at end of file +var _0x48fb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','debug','lodash','util','moment'];(function(_0x45c856,_0x5e6a1e){var _0x4961aa=function(_0x29f14d){while(--_0x29f14d){_0x45c856['push'](_0x45c856['shift']());}};_0x4961aa(++_0x5e6a1e);}(_0x48fb,0xdb));var _0xb48f=function(_0x23c011,_0x234d6b){_0x23c011=_0x23c011-0x0;var _0x85d3cb=_0x48fb[_0x23c011];return _0x85d3cb;};'use strict';var _=require(_0xb48f('0x0'));var util=require(_0xb48f('0x1'));var moment=require(_0xb48f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb48f('0x3'));var db=require(_0xb48f('0x4'))['db'];var utils=require(_0xb48f('0x5'));var logger=require(_0xb48f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb48f('0x7'));var client=jayson[_0xb48f('0x8')][_0xb48f('0x9')]({'port':0x232a});config['redis']=_[_0xb48f('0xa')](config[_0xb48f('0xb')],{'host':_0xb48f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3ad138,_0x22b591,_0x53c752){return new BPromise(function(_0x17fb76,_0xc4b7ad){return client[_0xb48f('0xd')](_0x3ad138,_0x53c752)[_0xb48f('0xe')](function(_0xc3d9d){logger[_0xb48f('0xf')](_0xb48f('0x10'),_0x22b591,_0xb48f('0x11'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x22b591,_0xb48f('0x11'),JSON[_0xb48f('0x12')](_0xc3d9d));if(_0xc3d9d[_0xb48f('0x13')]){if(_0xc3d9d[_0xb48f('0x13')][_0xb48f('0x14')]===0x1f4){logger[_0xb48f('0x13')](_0xb48f('0x10'),_0x22b591,_0xc3d9d[_0xb48f('0x13')]['message']);return _0xc4b7ad(_0xc3d9d['error'][_0xb48f('0x15')]);}logger[_0xb48f('0x13')](_0xb48f('0x10'),_0x22b591,_0xc3d9d[_0xb48f('0x13')]['message']);return _0x17fb76(_0xc3d9d[_0xb48f('0x13')][_0xb48f('0x15')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x22b591,_0xb48f('0x11'));_0x17fb76(_0xc3d9d[_0xb48f('0x16')][_0xb48f('0x15')]);}})[_0xb48f('0x17')](function(_0x454cf3){logger['error']('MailQueue,\x20%s,\x20%s',_0x22b591,_0x454cf3);_0xc4b7ad(_0x454cf3);});});}exports[_0xb48f('0x18')]=function(_0x483944){var _0x4dd983=this;return new Promise(function(_0x3f239b,_0x22a567){return db[_0xb48f('0x19')][_0xb48f('0x1a')]({'raw':_0x483944['options']?_0x483944[_0xb48f('0x1b')][_0xb48f('0x1c')]===undefined?!![]:![]:!![],'where':_0x483944['options']?_0x483944[_0xb48f('0x1b')][_0xb48f('0x1d')]||null:null,'attributes':_0x483944[_0xb48f('0x1b')]?_0x483944[_0xb48f('0x1b')][_0xb48f('0x1e')]||null:null,'limit':_0x483944[_0xb48f('0x1b')]?_0x483944['options'][_0xb48f('0x1f')]||null:null,'include':_0x483944[_0xb48f('0x1b')]?_0x483944[_0xb48f('0x1b')][_0xb48f('0x20')]?_[_0xb48f('0x21')](_0x483944[_0xb48f('0x1b')][_0xb48f('0x20')],function(_0x1944a0){return{'model':db[_0x1944a0['model']],'as':_0x1944a0['as'],'attributes':_0x1944a0[_0xb48f('0x1e')],'include':_0x1944a0[_0xb48f('0x20')]?_[_0xb48f('0x21')](_0x1944a0[_0xb48f('0x20')],function(_0x7f6cbc){return{'model':db[_0x7f6cbc['model']],'as':_0x7f6cbc['as'],'attributes':_0x7f6cbc[_0xb48f('0x1e')],'include':_0x7f6cbc['include']?_[_0xb48f('0x21')](_0x7f6cbc['include'],function(_0x1732b6){return{'model':db[_0x1732b6[_0xb48f('0x22')]],'as':_0x1732b6['as'],'attributes':_0x1732b6[_0xb48f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f26cb){logger[_0xb48f('0xf')](_0xb48f('0x18'),_0x483944);logger['debug']('GetMailQueue',_0x483944,JSON[_0xb48f('0x12')](_0x3f26cb));_0x3f239b(_0x3f26cb);})[_0xb48f('0x17')](function(_0x3eb02b){logger[_0xb48f('0x13')](_0xb48f('0x18'),_0x3eb02b['message'],_0x483944);_0x22a567(_0x4dd983['error'](0x1f4,_0x3eb02b[_0xb48f('0x15')]));});});};exports[_0xb48f('0x23')]=function(_0x3550c2){var _0x3a3667=this;return new Promise(function(_0x209eee,_0x3174d8){return db[_0xb48f('0x19')]['find']({'raw':_0x3550c2[_0xb48f('0x1b')]?_0x3550c2[_0xb48f('0x1b')][_0xb48f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3550c2['options']?_0x3550c2[_0xb48f('0x1b')][_0xb48f('0x1d')]||null:null,'attributes':_0x3550c2[_0xb48f('0x1b')]?_0x3550c2[_0xb48f('0x1b')][_0xb48f('0x1e')]||null:null,'include':_0x3550c2[_0xb48f('0x1b')]?_0x3550c2['options'][_0xb48f('0x20')]?_[_0xb48f('0x21')](_0x3550c2[_0xb48f('0x1b')][_0xb48f('0x20')],function(_0x614a10){return{'model':db[_0x614a10[_0xb48f('0x22')]],'as':_0x614a10['as'],'attributes':_0x614a10[_0xb48f('0x1e')],'include':_0x614a10['include']?_[_0xb48f('0x21')](_0x614a10[_0xb48f('0x20')],function(_0x217f2d){return{'model':db[_0x217f2d[_0xb48f('0x22')]],'as':_0x217f2d['as'],'attributes':_0x217f2d[_0xb48f('0x1e')],'include':_0x217f2d['include']?_[_0xb48f('0x21')](_0x217f2d[_0xb48f('0x20')],function(_0xe4db91){return{'model':db[_0xe4db91[_0xb48f('0x22')]],'as':_0xe4db91['as'],'attributes':_0xe4db91[_0xb48f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb48f('0xe')](function(_0x5b071a){logger['info']('ShowMailQueue',_0x3550c2);logger[_0xb48f('0x24')]('ShowMailQueue',_0x3550c2,JSON[_0xb48f('0x12')](_0x5b071a));_0x209eee(_0x5b071a);})[_0xb48f('0x17')](function(_0x43098e){logger['error'](_0xb48f('0x23'),_0x43098e[_0xb48f('0x15')],_0x3550c2);_0x3174d8(_0x3a3667[_0xb48f('0x13')](0x1f4,_0x43098e[_0xb48f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index aad9d83..f907a2a 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 _0x069d=['./mailQueue.events','remove','emit','removeListener','register','mailQueue:'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x069d,0x11a));var _0xd069=function(_0x4675a3,_0x1e11b1){_0x4675a3=_0x4675a3-0x0;var _0x2494a8=_0x069d[_0x4675a3];return _0x2494a8;};'use strict';var MailQueueEvents=require(_0xd069('0x0'));var events=['save',_0xd069('0x1'),'update'];function createListener(_0x17cee0,_0x17a266){return function(_0x5b2eb9){_0x17a266[_0xd069('0x2')](_0x17cee0,_0x5b2eb9);};}function removeListener(_0x441e2a,_0x4b64b3){return function(){MailQueueEvents[_0xd069('0x3')](_0x441e2a,_0x4b64b3);};}exports[_0xd069('0x4')]=function(_0x50ee01){for(var _0x2935b6=0x0,_0x349aaf=events['length'];_0x2935b6<_0x349aaf;_0x2935b6++){var _0x12428d=events[_0x2935b6];var _0x1c04de=createListener(_0xd069('0x5')+_0x12428d,_0x50ee01);MailQueueEvents['on'](_0x12428d,_0x1c04de);}}; \ No newline at end of file +var _0x4d6e=['save','remove','update','emit','removeListener','register','length','./mailQueue.events'];(function(_0xf6fc8f,_0x103282){var _0x43e809=function(_0x55eb13){while(--_0x55eb13){_0xf6fc8f['push'](_0xf6fc8f['shift']());}};_0x43e809(++_0x103282);}(_0x4d6e,0x77));var _0xe4d6=function(_0x115d8d,_0xacde78){_0x115d8d=_0x115d8d-0x0;var _0x250c76=_0x4d6e[_0x115d8d];return _0x250c76;};'use strict';var MailQueueEvents=require(_0xe4d6('0x0'));var events=[_0xe4d6('0x1'),_0xe4d6('0x2'),_0xe4d6('0x3')];function createListener(_0x4393ef,_0x542949){return function(_0xe2bdce){_0x542949[_0xe4d6('0x4')](_0x4393ef,_0xe2bdce);};}function removeListener(_0x339e47,_0x8d9190){return function(){MailQueueEvents[_0xe4d6('0x5')](_0x339e47,_0x8d9190);};}exports[_0xe4d6('0x6')]=function(_0x3a452a){for(var _0x2d08ae=0x0,_0x303058=events[_0xe4d6('0x7')];_0x2d08ae<_0x303058;_0x2d08ae++){var _0x352417=events[_0x2d08ae];var _0xe683ad=createListener('mailQueue:'+_0x352417,_0x3a452a);MailQueueEvents['on'](_0x352417,_0xe683ad);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 36291b1..84900b0 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 _0x0868=['show','post','create','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0868,0x1c8));var _0x8086=function(_0x64abe3,_0x12c78a){_0x64abe3=_0x64abe3-0x0;var _0x1ab10e=_0x0868[_0x64abe3];return _0x1ab10e;};'use strict';var multer=require(_0x8086('0x0'));var util=require('util');var path=require(_0x8086('0x1'));var timeout=require('connect-timeout');var express=require(_0x8086('0x2'));var router=express[_0x8086('0x3')]();var fs_extra=require(_0x8086('0x4'));var auth=require(_0x8086('0x5'));var interaction=require(_0x8086('0x6'));var config=require(_0x8086('0x7'));var controller=require('./mailQueueReport.controller');router[_0x8086('0x8')]('/',auth[_0x8086('0x9')](),controller['index']);router['get'](_0x8086('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8086('0x8')](_0x8086('0xb'),auth[_0x8086('0x9')](),controller[_0x8086('0xc')]);router[_0x8086('0xd')]('/',auth[_0x8086('0x9')](),controller[_0x8086('0xe')]);router[_0x8086('0xf')](_0x8086('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8086('0x10')]('/:id',auth[_0x8086('0x9')](),controller[_0x8086('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaec7=['fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports','path','express','Router'];(function(_0x1f4811,_0x53abb2){var _0x28b51a=function(_0x34ad4a){while(--_0x34ad4a){_0x1f4811['push'](_0x1f4811['shift']());}};_0x28b51a(++_0x53abb2);}(_0xaec7,0xe1));var _0x7aec=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xaec7[_0x3e531a];return _0x3c2574;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7aec('0x0'));var timeout=require('connect-timeout');var express=require(_0x7aec('0x1'));var router=express[_0x7aec('0x2')]();var fs_extra=require(_0x7aec('0x3'));var auth=require(_0x7aec('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7aec('0x5'));var controller=require(_0x7aec('0x6'));router[_0x7aec('0x7')]('/',auth[_0x7aec('0x8')](),controller[_0x7aec('0x9')]);router[_0x7aec('0x7')](_0x7aec('0xa'),auth[_0x7aec('0x8')](),controller[_0x7aec('0xb')]);router[_0x7aec('0x7')](_0x7aec('0xc'),auth[_0x7aec('0x8')](),controller['show']);router[_0x7aec('0xd')]('/',auth[_0x7aec('0x8')](),controller[_0x7aec('0xe')]);router[_0x7aec('0xf')](_0x7aec('0xc'),auth['isAuthenticated'](),controller[_0x7aec('0x10')]);router['delete'](_0x7aec('0xc'),auth[_0x7aec('0x8')](),controller[_0x7aec('0x11')]);module[_0x7aec('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 81b7ffe..f422ff4 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 _0x8109=['exports','STRING','DATE','moment'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0x8109,0xff));var _0x9810=function(_0x5e4312,_0x58a080){_0x5e4312=_0x5e4312-0x0;var _0x176724=_0x8109[_0x5e4312];return _0x176724;};'use strict';var moment=require(_0x9810('0x0'));var Sequelize=require('sequelize');module[_0x9810('0x1')]={'uniqueid':{'type':Sequelize[_0x9810('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9810('0x2')]},'joinAt':{'type':Sequelize[_0x9810('0x3')]},'leaveAt':{'type':Sequelize[_0x9810('0x3')]},'acceptAt':{'type':Sequelize[_0x9810('0x3')]},'exitAt':{'type':Sequelize[_0x9810('0x3')]},'reason':{'type':Sequelize[_0x9810('0x2')]}}; \ No newline at end of file +var _0xfa78=['sequelize','exports','STRING','DATE'];(function(_0x4f740b,_0x3f528e){var _0x2c0cb4=function(_0x14ae0e){while(--_0x14ae0e){_0x4f740b['push'](_0x4f740b['shift']());}};_0x2c0cb4(++_0x3f528e);}(_0xfa78,0x1d4));var _0x8fa7=function(_0x4e435c,_0x2a5b24){_0x4e435c=_0x4e435c-0x0;var _0x133d33=_0xfa78[_0x4e435c];return _0x133d33;};'use strict';var moment=require('moment');var Sequelize=require(_0x8fa7('0x0'));module[_0x8fa7('0x1')]={'uniqueid':{'type':Sequelize[_0x8fa7('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8fa7('0x3')]},'leaveAt':{'type':Sequelize[_0x8fa7('0x3')]},'acceptAt':{'type':Sequelize[_0x8fa7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8fa7('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e96432f..e516e13 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 _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x3f6392,_0x52ab30){var _0x5d58fa=function(_0x58e5ab){while(--_0x58e5ab){_0x3f6392['push'](_0x3f6392['shift']());}};_0x5d58fa(++_0x52ab30);}(_0xf61e,0x191));var _0xef61=function(_0x592518,_0xacb774){_0x592518=_0x592518-0x0;var _0x35502a=_0xf61e[_0x592518];return _0x35502a;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['MailQueueReport']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':!![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['MailQueueReport'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file +var _0xd4a2=['describe','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','MailQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body'];(function(_0x163c25,_0x15d223){var _0x46963d=function(_0x547417){while(--_0x547417){_0x163c25['push'](_0x163c25['shift']());}};_0x46963d(++_0x15d223);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2d1ac5,_0x2c6e27){_0x2d1ac5=_0x2d1ac5-0x0;var _0x3e7083=_0xd4a2[_0x2d1ac5];return _0x3e7083;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];function respondWithStatusCode(_0x45b9fb,_0x5ac803){_0x5ac803=_0x5ac803||0xcc;return function(_0x2f785f){if(_0x2f785f){return _0x45b9fb[_0x2d4a('0x17')](_0x5ac803);}return _0x45b9fb[_0x2d4a('0x18')](_0x5ac803)[_0x2d4a('0x19')]();};}function respondWithResult(_0x544622,_0x4be8b4){_0x4be8b4=_0x4be8b4||0xc8;return function(_0x2a1d0f){if(_0x2a1d0f){return _0x544622['status'](_0x4be8b4)[_0x2d4a('0x1a')](_0x2a1d0f);}};}function respondWithFilteredResult(_0x175bda,_0x11896d){return function(_0x3a3156){if(_0x3a3156){var _0x4c5287=typeof _0x11896d[_0x2d4a('0x1b')]==='undefined'&&typeof _0x11896d[_0x2d4a('0x1c')]==='undefined';var _0x435687=_0x3a3156[_0x2d4a('0x1d')];var _0x2188b2=_0x4c5287?0x0:_0x11896d[_0x2d4a('0x1b')];var _0x498956=_0x4c5287?_0x3a3156['count']:_0x11896d['offset']+_0x11896d[_0x2d4a('0x1c')];var _0x1966d1;if(_0x498956>=_0x435687){_0x498956=_0x435687;_0x1966d1=0xc8;}else{_0x1966d1=0xce;}_0x175bda[_0x2d4a('0x18')](_0x1966d1);return _0x175bda[_0x2d4a('0x1e')](_0x2d4a('0x1f'),_0x2188b2+'-'+_0x498956+'/'+_0x435687)[_0x2d4a('0x1a')](_0x3a3156);}return null;};}function patchUpdates(_0x56445a){return function(_0x49f378){try{jsonpatch[_0x2d4a('0x20')](_0x49f378,_0x56445a,!![]);}catch(_0x1f3e17){return BPromise[_0x2d4a('0x21')](_0x1f3e17);}return _0x49f378[_0x2d4a('0x22')]();};}function saveUpdates(_0x1a2d20,_0x2e7736){return function(_0x22dd0b){if(_0x22dd0b){return _0x22dd0b[_0x2d4a('0x23')](_0x1a2d20)['then'](function(_0x26e7b8){return _0x26e7b8;});}return null;};}function removeEntity(_0x3240a2,_0x2c3799){return function(_0x42d813){if(_0x42d813){return _0x42d813[_0x2d4a('0x24')]()[_0x2d4a('0x25')](function(){_0x3240a2[_0x2d4a('0x18')](0xcc)[_0x2d4a('0x19')]();});}};}function handleEntityNotFound(_0x54c910,_0x544b9b){return function(_0x5cc7d8){if(!_0x5cc7d8){_0x54c910[_0x2d4a('0x17')](0x194);}return _0x5cc7d8;};}function handleError(_0x5029f3,_0x410f7d){_0x410f7d=_0x410f7d||0x1f4;return function(_0x3a2fd3){logger[_0x2d4a('0x26')](_0x3a2fd3[_0x2d4a('0x27')]);if(_0x3a2fd3[_0x2d4a('0x28')]){delete _0x3a2fd3[_0x2d4a('0x28')];}_0x5029f3[_0x2d4a('0x18')](_0x410f7d)[_0x2d4a('0x29')](_0x3a2fd3);};}exports['index']=function(_0x436f53,_0x5ce262){var _0x221602={},_0x9bac28={},_0xc497ce={'count':0x0,'rows':[]};var _0x20b87d=_[_0x2d4a('0x2a')](db[_0x2d4a('0x2b')][_0x2d4a('0x2c')],function(_0x2e8063){return{'name':_0x2e8063['fieldName'],'type':_0x2e8063[_0x2d4a('0x2d')][_0x2d4a('0x2e')]};});_0x9bac28[_0x2d4a('0x2f')]=_[_0x2d4a('0x2a')](_0x20b87d,_0x2d4a('0x28'));_0x9bac28['query']=_[_0x2d4a('0x30')](_0x436f53[_0x2d4a('0x31')]);_0x9bac28[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],_0x9bac28['query']);_0x221602[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],qs[_0x2d4a('0x35')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x35')]));_0x221602['attributes']=_0x221602[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x221602[_0x2d4a('0x34')]:_0x9bac28[_0x2d4a('0x2f')];if(!_0x436f53[_0x2d4a('0x31')]['hasOwnProperty'](_0x2d4a('0x37'))){_0x221602[_0x2d4a('0x1c')]=qs['limit'](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1c')]);_0x221602[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1b')]);}_0x221602['order']=qs[_0x2d4a('0x38')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x38')]);_0x221602[_0x2d4a('0x39')]=qs[_0x2d4a('0x32')](_[_0x2d4a('0x3a')](_0x436f53['query'],_0x9bac28['filters']),_0x20b87d);if(_0x436f53[_0x2d4a('0x31')]['filter']){_0x221602[_0x2d4a('0x39')]=_[_0x2d4a('0x3b')](_0x221602['where'],{'$or':_[_0x2d4a('0x2a')](_0x20b87d,function(_0x275598){if(_0x275598[_0x2d4a('0x2d')]!==_0x2d4a('0x3c')){var _0x67bce3={};_0x67bce3[_0x275598[_0x2d4a('0x28')]]={'$like':'%'+_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x3d')]+'%'};return _0x67bce3;}})});}_0x221602=_[_0x2d4a('0x3b')]({},_0x221602,_0x436f53[_0x2d4a('0x3e')]);var _0x3bb0cc={'where':_0x221602['where']};return db[_0x2d4a('0x2b')][_0x2d4a('0x1d')](_0x3bb0cc)[_0x2d4a('0x25')](function(_0x2f1635){_0xc497ce[_0x2d4a('0x1d')]=_0x2f1635;if(_0x436f53['query']['includeAll']){_0x221602['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x2d4a('0x3f')](_0x221602);})[_0x2d4a('0x25')](function(_0xf39020){_0xc497ce[_0x2d4a('0x40')]=_0xf39020;return _0xc497ce;})['then'](respondWithFilteredResult(_0x5ce262,_0x221602))[_0x2d4a('0x41')](handleError(_0x5ce262,null));};exports[_0x2d4a('0x42')]=function(_0x5e9704,_0x189d2a){var _0x13b0f0={'raw':!![],'where':{'id':_0x5e9704[_0x2d4a('0x43')]['id']}},_0x8a9375={};_0x8a9375[_0x2d4a('0x2f')]=_[_0x2d4a('0x30')](db['MailQueueReport'][_0x2d4a('0x2c')]);_0x8a9375[_0x2d4a('0x31')]=_[_0x2d4a('0x30')](_0x5e9704[_0x2d4a('0x31')]);_0x8a9375[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x8a9375['model'],_0x8a9375[_0x2d4a('0x31')]);_0x13b0f0[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x8a9375['model'],qs[_0x2d4a('0x35')](_0x5e9704['query'][_0x2d4a('0x35')]));_0x13b0f0[_0x2d4a('0x34')]=_0x13b0f0[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x13b0f0[_0x2d4a('0x34')]:_0x8a9375['model'];if(_0x5e9704['query'][_0x2d4a('0x44')]){_0x13b0f0[_0x2d4a('0x45')]=[{'all':!![]}];}_0x13b0f0=_['merge']({},_0x13b0f0,_0x5e9704[_0x2d4a('0x3e')]);return db['MailQueueReport'][_0x2d4a('0x46')](_0x13b0f0)[_0x2d4a('0x25')](handleEntityNotFound(_0x189d2a,null))[_0x2d4a('0x25')](respondWithResult(_0x189d2a,null))['catch'](handleError(_0x189d2a,null));};exports[_0x2d4a('0x47')]=function(_0x541b93,_0x3806b8){return db[_0x2d4a('0x2b')][_0x2d4a('0x47')](_0x541b93[_0x2d4a('0x48')],{})[_0x2d4a('0x25')](respondWithResult(_0x3806b8,0xc9))[_0x2d4a('0x41')](handleError(_0x3806b8,null));};exports[_0x2d4a('0x23')]=function(_0x2b2f4b,_0x1ffb96){if(_0x2b2f4b[_0x2d4a('0x48')]['id']){delete _0x2b2f4b[_0x2d4a('0x48')]['id'];}return db['MailQueueReport'][_0x2d4a('0x46')]({'where':{'id':_0x2b2f4b[_0x2d4a('0x43')]['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x1ffb96,null))[_0x2d4a('0x25')](saveUpdates(_0x2b2f4b[_0x2d4a('0x48')],null))['then'](respondWithResult(_0x1ffb96,null))[_0x2d4a('0x41')](handleError(_0x1ffb96,null));};exports[_0x2d4a('0x24')]=function(_0x2123e8,_0x440625){return db[_0x2d4a('0x2b')]['find']({'where':{'id':_0x2123e8['params']['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x440625,null))[_0x2d4a('0x25')](removeEntity(_0x440625,null))['catch'](handleError(_0x440625,null));};exports[_0x2d4a('0x49')]=function(_0x33f413,_0x7f0807){return db[_0x2d4a('0x2b')]['describe']()[_0x2d4a('0x25')](respondWithResult(_0x7f0807,null))['catch'](handleError(_0x7f0807,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 238558b..57c2e9d 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 _0x2b4a=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x2e89d5,_0x2f787e){var _0x5ecc21=function(_0x5b10b4){while(--_0x5b10b4){_0x2e89d5['push'](_0x2e89d5['shift']());}};_0x5ecc21(++_0x2f787e);}(_0x2b4a,0x6a));var _0xa2b4=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x2b4a[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0xa2b4('0x0'));var util=require(_0xa2b4('0x1'));var logger=require(_0xa2b4('0x2'))('api');var moment=require(_0xa2b4('0x3'));var BPromise=require(_0xa2b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa2b4('0x5'));var config=require(_0xa2b4('0x6'));var attributes=require(_0xa2b4('0x7'));module[_0xa2b4('0x8')]=function(_0x1e372b,_0x4310f5){return _0x1e372b['define'](_0xa2b4('0x9'),attributes,{'tableName':_0xa2b4('0xa'),'paranoid':![],'indexes':[{'name':_0xa2b4('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd32=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x2097b8,_0x8f73bf){var _0x378dc2=function(_0x18a1b3){while(--_0x18a1b3){_0x2097b8['push'](_0x2097b8['shift']());}};_0x378dc2(++_0x8f73bf);}(_0xdd32,0x91));var _0x2dd3=function(_0x278143,_0xcc7c0e){_0x278143=_0x278143-0x0;var _0x47f8e5=_0xdd32[_0x278143];return _0x47f8e5;};'use strict';var _=require(_0x2dd3('0x0'));var util=require(_0x2dd3('0x1'));var logger=require('../../config/logger')(_0x2dd3('0x2'));var moment=require(_0x2dd3('0x3'));var BPromise=require(_0x2dd3('0x4'));var rp=require(_0x2dd3('0x5'));var fs=require('fs');var path=require(_0x2dd3('0x6'));var rimraf=require(_0x2dd3('0x7'));var config=require(_0x2dd3('0x8'));var attributes=require(_0x2dd3('0x9'));module[_0x2dd3('0xa')]=function(_0x4b91e6,_0x1bae6a){return _0x4b91e6[_0x2dd3('0xb')](_0x2dd3('0xc'),attributes,{'tableName':_0x2dd3('0xd'),'paranoid':![],'indexes':[{'name':_0x2dd3('0xe'),'fields':[_0x2dd3('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 134ad46..41ecf24 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf41992,_0x47c262){var _0x11dde6=function(_0x29fa92){while(--_0x29fa92){_0xf41992['push'](_0xf41992['shift']());}};_0x11dde6(++_0x47c262);}(_0x326f,0xd1));var _0xf326=function(_0x3447ca,_0x20c036){_0x3447ca=_0x3447ca-0x0;var _0x416039=_0x326f[_0x3447ca];return _0x416039;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x3fbf08,_0xaafe81){var _0x5c3497=function(_0x49e4e2){while(--_0x49e4e2){_0x3fbf08['push'](_0x3fbf08['shift']());}};_0x5c3497(++_0xaafe81);}(_0x7a54,0x106));var _0x47a5=function(_0x1744cc,_0xdc1aca){_0x1744cc=_0x1744cc-0x0;var _0x5c40d7=_0x7a54[_0x1744cc];return _0x5c40d7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c3751ae..a0332fd 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3f3420,_0x9f67fe){var _0x3875cd=function(_0x4a755e){while(--_0x4a755e){_0x3f3420['push'](_0x3f3420['shift']());}};_0x3875cd(++_0x9f67fe);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0xcb91[_0x38841c];return _0x500610;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x559f72,_0x44ec54){var _0x204b08=function(_0x2c2570){while(--_0x2c2570){_0x559f72['push'](_0x559f72['shift']());}};_0x204b08(++_0x44ec54);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0xcb91[_0x466bc5];return _0x138952;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d701860..8b3f584 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 _0x7a28=['STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x2f7023,_0x5cd4bd){var _0x47f18a=function(_0xe85984){while(--_0xe85984){_0x2f7023['push'](_0x2f7023['shift']());}};_0x47f18a(++_0x5cd4bd);}(_0x7a28,0x144));var _0x87a2=function(_0x44dff3,_0x27663c){_0x44dff3=_0x44dff3-0x0;var _0x2b1e66=_0x7a28[_0x44dff3];return _0x2b1e66;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x87a2('0x0')]},'authentication':{'type':Sequelize[_0x87a2('0x1')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x87a2('0x0')]},'port':{'type':Sequelize[_0x87a2('0x2')]},'tls':{'type':Sequelize[_0x87a2('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x87a2('0x0')],'defaultValue':_0x87a2('0x3')},'connTimeout':{'type':Sequelize[_0x87a2('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x87a2('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x87a2('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x503d=['INBOX','INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x28e262,_0x12beb0){var _0x5aa6c5=function(_0x5c63d9){while(--_0x5c63d9){_0x28e262['push'](_0x28e262['shift']());}};_0x5aa6c5(++_0x12beb0);}(_0x503d,0xd4));var _0xd503=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0x503d[_0x4fa166];return _0x5dd974;};'use strict';var Sequelize=require(_0xd503('0x0'));module['exports']={'description':{'type':Sequelize[_0xd503('0x1')]},'host':{'type':Sequelize[_0xd503('0x1')]},'authentication':{'type':Sequelize[_0xd503('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd503('0x1')]},'password':{'type':Sequelize[_0xd503('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd503('0x1')],'defaultValue':_0xd503('0x3')},'connTimeout':{'type':Sequelize[_0xd503('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd503('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd503('0x1')]},'modernAuthentication':{'type':Sequelize[_0xd503('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index fb6f5ea..4ac85b5 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 _0x0577=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0577,0x144));var _0x7057=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x0577[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x7057('0x0'));var logger=require(_0x7057('0x1'))('api');var moment=require(_0x7057('0x2'));var BPromise=require(_0x7057('0x3'));var rp=require(_0x7057('0x4'));var fs=require('fs');var path=require(_0x7057('0x5'));var rimraf=require(_0x7057('0x6'));var config=require(_0x7057('0x7'));var attributes=require(_0x7057('0x8'));module[_0x7057('0x9')]=function(_0x1229df,_0x1c3b3e){return _0x1229df['define'](_0x7057('0xa'),attributes,{'tableName':_0x7057('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb06=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x536b75,_0x1b7227){var _0x5509f6=function(_0x567195){while(--_0x567195){_0x536b75['push'](_0x536b75['shift']());}};_0x5509f6(++_0x1b7227);}(_0xdb06,0x74));var _0x6db0=function(_0x59e4f0,_0x5cce9a){_0x59e4f0=_0x59e4f0-0x0;var _0x162d69=_0xdb06[_0x59e4f0];return _0x162d69;};'use strict';var _=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var logger=require(_0x6db0('0x2'))(_0x6db0('0x3'));var moment=require(_0x6db0('0x4'));var BPromise=require(_0x6db0('0x5'));var rp=require(_0x6db0('0x6'));var fs=require('fs');var path=require(_0x6db0('0x7'));var rimraf=require(_0x6db0('0x8'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x6db0('0x9')]=function(_0x2d2c0c,_0x2b2516){return _0x2d2c0c[_0x6db0('0xa')](_0x6db0('0xb'),attributes,{'tableName':_0x6db0('0xc'),'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 d241bf1..d358226 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 _0xd240=['include','map','model','stringify','GetMailServerIn','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','findAll','options','where','attributes','limit'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xd240,0x1c7));var _0x0d24=function(_0x29845d,_0x14e451){_0x29845d=_0x29845d-0x0;var _0x11210a=_0xd240[_0x29845d];return _0x11210a;};'use strict';var _=require('lodash');var util=require(_0x0d24('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d24('0x1'));var fs=require('fs');var Redis=require(_0x0d24('0x2'));var db=require(_0x0d24('0x3'))['db'];var utils=require(_0x0d24('0x4'));var logger=require(_0x0d24('0x5'))(_0x0d24('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d24('0x7')][_0x0d24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1005ff,_0x250141,_0x48fb91){return new BPromise(function(_0xdb2d81,_0x2fdf4a){return client[_0x0d24('0x9')](_0x1005ff,_0x48fb91)[_0x0d24('0xa')](function(_0x58b925){logger[_0x0d24('0xb')](_0x0d24('0xc'),_0x250141,'request\x20sent');logger[_0x0d24('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x250141,_0x0d24('0xe'),JSON['stringify'](_0x58b925));if(_0x58b925[_0x0d24('0xf')]){if(_0x58b925[_0x0d24('0xf')][_0x0d24('0x10')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x250141,_0x58b925[_0x0d24('0xf')][_0x0d24('0x11')]);return _0x2fdf4a(_0x58b925[_0x0d24('0xf')]['message']);}logger[_0x0d24('0xf')](_0x0d24('0xc'),_0x250141,_0x58b925['error']['message']);return _0xdb2d81(_0x58b925[_0x0d24('0xf')][_0x0d24('0x11')]);}else{logger[_0x0d24('0xb')](_0x0d24('0xc'),_0x250141,_0x0d24('0xe'));_0xdb2d81(_0x58b925[_0x0d24('0x12')][_0x0d24('0x11')]);}})[_0x0d24('0x13')](function(_0x47ee4b){logger[_0x0d24('0xf')](_0x0d24('0xc'),_0x250141,_0x47ee4b);_0x2fdf4a(_0x47ee4b);});});}exports['GetMailServerIn']=function(_0xacfbd6){var _0x1c5899=this;return new Promise(function(_0x12204f,_0x151030){return db['MailServerIn'][_0x0d24('0x14')]({'raw':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6['options']['raw']===undefined?!![]:![]:!![],'where':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x16')]||null:null,'attributes':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x17')]||null:null,'limit':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x18')]||null:null,'include':_0xacfbd6['options']?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x19')]?_[_0x0d24('0x1a')](_0xacfbd6[_0x0d24('0x15')]['include'],function(_0x23440c){return{'model':db[_0x23440c[_0x0d24('0x1b')]],'as':_0x23440c['as'],'attributes':_0x23440c[_0x0d24('0x17')],'include':_0x23440c['include']?_[_0x0d24('0x1a')](_0x23440c[_0x0d24('0x19')],function(_0x425dd2){return{'model':db[_0x425dd2['model']],'as':_0x425dd2['as'],'attributes':_0x425dd2[_0x0d24('0x17')],'include':_0x425dd2[_0x0d24('0x19')]?_[_0x0d24('0x1a')](_0x425dd2['include'],function(_0x2226d6){return{'model':db[_0x2226d6[_0x0d24('0x1b')]],'as':_0x2226d6['as'],'attributes':_0x2226d6[_0x0d24('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0d24('0xa')](function(_0x2b472a){logger[_0x0d24('0xb')]('GetMailServerIn',_0xacfbd6);logger['debug']('GetMailServerIn',_0xacfbd6,JSON[_0x0d24('0x1c')](_0x2b472a));_0x12204f(_0x2b472a);})[_0x0d24('0x13')](function(_0x1a1ef7){logger[_0x0d24('0xf')](_0x0d24('0x1d'),_0x1a1ef7[_0x0d24('0x11')],_0xacfbd6);_0x151030(_0x1c5899[_0x0d24('0xf')](0x1f4,_0x1a1ef7[_0x0d24('0x11')]));});});}; \ No newline at end of file +var _0x00d6=['include','map','attributes','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','GetMailServerIn','findAll','raw','options','where'];(function(_0x55d276,_0x15002b){var _0x163244=function(_0x14d8d7){while(--_0x14d8d7){_0x55d276['push'](_0x55d276['shift']());}};_0x163244(++_0x15002b);}(_0x00d6,0x1e5));var _0x600d=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x00d6[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x600d('0x0'));var util=require(_0x600d('0x1'));var moment=require(_0x600d('0x2'));var BPromise=require(_0x600d('0x3'));var rs=require(_0x600d('0x4'));var fs=require('fs');var Redis=require(_0x600d('0x5'));var db=require(_0x600d('0x6'))['db'];var utils=require(_0x600d('0x7'));var logger=require(_0x600d('0x8'))(_0x600d('0x9'));var config=require(_0x600d('0xa'));var jayson=require(_0x600d('0xb'));var client=jayson[_0x600d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d6a0c,_0x43f76e,_0x5de536){return new BPromise(function(_0x260fc9,_0x1c2655){return client[_0x600d('0xd')](_0x5d6a0c,_0x5de536)[_0x600d('0xe')](function(_0x89077){logger[_0x600d('0xf')](_0x600d('0x10'),_0x43f76e,_0x600d('0x11'));logger['debug'](_0x600d('0x12'),_0x43f76e,_0x600d('0x11'),JSON[_0x600d('0x13')](_0x89077));if(_0x89077[_0x600d('0x14')]){if(_0x89077[_0x600d('0x14')]['code']===0x1f4){logger['error'](_0x600d('0x10'),_0x43f76e,_0x89077[_0x600d('0x14')][_0x600d('0x15')]);return _0x1c2655(_0x89077[_0x600d('0x14')][_0x600d('0x15')]);}logger[_0x600d('0x14')](_0x600d('0x10'),_0x43f76e,_0x89077[_0x600d('0x14')]['message']);return _0x260fc9(_0x89077[_0x600d('0x14')][_0x600d('0x15')]);}else{logger[_0x600d('0xf')](_0x600d('0x10'),_0x43f76e,_0x600d('0x11'));_0x260fc9(_0x89077['result'][_0x600d('0x15')]);}})['catch'](function(_0x35fd38){logger['error'](_0x600d('0x10'),_0x43f76e,_0x35fd38);_0x1c2655(_0x35fd38);});});}exports[_0x600d('0x16')]=function(_0x20b432){var _0x32d31a=this;return new Promise(function(_0x34be3c,_0x5911d3){return db['MailServerIn'][_0x600d('0x17')]({'raw':_0x20b432['options']?_0x20b432['options'][_0x600d('0x18')]===undefined?!![]:![]:!![],'where':_0x20b432['options']?_0x20b432[_0x600d('0x19')][_0x600d('0x1a')]||null:null,'attributes':_0x20b432['options']?_0x20b432[_0x600d('0x19')]['attributes']||null:null,'limit':_0x20b432[_0x600d('0x19')]?_0x20b432[_0x600d('0x19')]['limit']||null:null,'include':_0x20b432['options']?_0x20b432['options'][_0x600d('0x1b')]?_[_0x600d('0x1c')](_0x20b432[_0x600d('0x19')][_0x600d('0x1b')],function(_0x18cba0){return{'model':db[_0x18cba0['model']],'as':_0x18cba0['as'],'attributes':_0x18cba0['attributes'],'include':_0x18cba0[_0x600d('0x1b')]?_[_0x600d('0x1c')](_0x18cba0[_0x600d('0x1b')],function(_0x2a7d11){return{'model':db[_0x2a7d11['model']],'as':_0x2a7d11['as'],'attributes':_0x2a7d11[_0x600d('0x1d')],'include':_0x2a7d11['include']?_[_0x600d('0x1c')](_0x2a7d11[_0x600d('0x1b')],function(_0x30659b){return{'model':db[_0x30659b[_0x600d('0x1e')]],'as':_0x30659b['as'],'attributes':_0x30659b['attributes']};}):[]};}):[]};}):[]:[]})[_0x600d('0xe')](function(_0x2ca864){logger[_0x600d('0xf')](_0x600d('0x16'),_0x20b432);logger[_0x600d('0x1f')](_0x600d('0x16'),_0x20b432,JSON['stringify'](_0x2ca864));_0x34be3c(_0x2ca864);})['catch'](function(_0x47f226){logger['error'](_0x600d('0x16'),_0x47f226['message'],_0x20b432);_0x5911d3(_0x32d31a['error'](0x1f4,_0x47f226[_0x600d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index eb081ef..16cd7ef 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x36122b,_0x23a9bf){_0x36122b=_0x36122b-0x0;var _0x259412=_0x7a54[_0x36122b];return _0x259412;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x445b89,_0x4cba14){_0x445b89=_0x445b89-0x0;var _0x27db97=_0x7a54[_0x445b89];return _0x27db97;};'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 aa75fd0..9f38691 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 _0xda3f=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xda3f,0xec));var _0xfda3=function(_0x34a81b,_0xa570ae){_0x34a81b=_0x34a81b-0x0;var _0x2492e0=_0xda3f[_0x34a81b];return _0x2492e0;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'description':{'type':Sequelize[_0xfda3('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xfda3('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xfda3('0x1')]},'authentication':{'type':Sequelize[_0xfda3('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6e6c=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5c5872,_0x21a166){var _0x314c07=function(_0x36f8b7){while(--_0x36f8b7){_0x5c5872['push'](_0x5c5872['shift']());}};_0x314c07(++_0x21a166);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc6e6('0x2')]},'user':{'type':Sequelize[_0xc6e6('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8995587..6c9646c 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 _0x1d57=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','include','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x3743c1,_0x3a6cc1){var _0x4e703f=function(_0xb7226e){while(--_0xb7226e){_0x3743c1['push'](_0x3743c1['shift']());}};_0x4e703f(++_0x3a6cc1);}(_0x1d57,0xe7));var _0x71d5=function(_0xcfe0ed,_0x3feab1){_0xcfe0ed=_0xcfe0ed-0x0;var _0x15bdec=_0x1d57[_0xcfe0ed];return _0x15bdec;};'use strict';var emlformat=require(_0x71d5('0x0'));var rimraf=require(_0x71d5('0x1'));var zipdir=require(_0x71d5('0x2'));var jsonpatch=require(_0x71d5('0x3'));var rp=require('request-promise');var moment=require(_0x71d5('0x4'));var BPromise=require(_0x71d5('0x5'));var Mustache=require(_0x71d5('0x6'));var util=require('util');var path=require(_0x71d5('0x7'));var sox=require(_0x71d5('0x8'));var csv=require(_0x71d5('0x9'));var ejs=require(_0x71d5('0xa'));var fs=require('fs');var fs_extra=require(_0x71d5('0xb'));var _=require(_0x71d5('0xc'));var squel=require(_0x71d5('0xd'));var crypto=require(_0x71d5('0xe'));var jsforce=require(_0x71d5('0xf'));var deskjs=require(_0x71d5('0x10'));var toCsv=require(_0x71d5('0x9'));var querystring=require(_0x71d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x71d5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x71d5('0x13'));var as=require(_0x71d5('0x14'));var hardwareService=require(_0x71d5('0x15'));var logger=require(_0x71d5('0x16'))(_0x71d5('0x17'));var utils=require(_0x71d5('0x18'));var config=require(_0x71d5('0x19'));var licenseUtil=require(_0x71d5('0x1a'));var db=require(_0x71d5('0x1b'))['db'];function respondWithStatusCode(_0x4175f3,_0x41a53a){_0x41a53a=_0x41a53a||0xcc;return function(_0x3792a0){if(_0x3792a0){return _0x4175f3[_0x71d5('0x1c')](_0x41a53a);}return _0x4175f3[_0x71d5('0x1d')](_0x41a53a)[_0x71d5('0x1e')]();};}function respondWithResult(_0x409c8f,_0x442a04){_0x442a04=_0x442a04||0xc8;return function(_0x5ddf91){if(_0x5ddf91){return _0x409c8f[_0x71d5('0x1d')](_0x442a04)[_0x71d5('0x1f')](_0x5ddf91);}};}function respondWithFilteredResult(_0x23fd60,_0x192984){return function(_0x11d879){if(_0x11d879){var _0x33746b=typeof _0x192984[_0x71d5('0x20')]===_0x71d5('0x21')&&typeof _0x192984[_0x71d5('0x22')]==='undefined';var _0x441e31=_0x11d879[_0x71d5('0x23')];var _0x2dc03a=_0x33746b?0x0:_0x192984[_0x71d5('0x20')];var _0x3dabfa=_0x33746b?_0x11d879[_0x71d5('0x23')]:_0x192984[_0x71d5('0x20')]+_0x192984[_0x71d5('0x22')];var _0xcb4977;if(_0x3dabfa>=_0x441e31){_0x3dabfa=_0x441e31;_0xcb4977=0xc8;}else{_0xcb4977=0xce;}_0x23fd60[_0x71d5('0x1d')](_0xcb4977);return _0x23fd60[_0x71d5('0x24')]('Content-Range',_0x2dc03a+'-'+_0x3dabfa+'/'+_0x441e31)[_0x71d5('0x1f')](_0x11d879);}return null;};}function patchUpdates(_0x367b92){return function(_0x2bfed7){try{jsonpatch[_0x71d5('0x25')](_0x2bfed7,_0x367b92,!![]);}catch(_0x248291){return BPromise[_0x71d5('0x26')](_0x248291);}return _0x2bfed7[_0x71d5('0x27')]();};}function saveUpdates(_0x1ee1f4,_0x1f3d11){return function(_0x464c60){if(_0x464c60){return _0x464c60[_0x71d5('0x28')](_0x1ee1f4)[_0x71d5('0x29')](function(_0x449184){return _0x449184;});}return null;};}function removeEntity(_0x3b427a,_0x626988){return function(_0x3dc2bf){if(_0x3dc2bf){return _0x3dc2bf['destroy']()['then'](function(){_0x3b427a[_0x71d5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3485,_0x2c6323){return function(_0x4f3c94){if(!_0x4f3c94){_0x3c3485[_0x71d5('0x1c')](0x194);}return _0x4f3c94;};}function handleError(_0xdf7d86,_0x314852){_0x314852=_0x314852||0x1f4;return function(_0x5dff29){logger[_0x71d5('0x2a')](_0x5dff29[_0x71d5('0x2b')]);if(_0x5dff29[_0x71d5('0x2c')]){delete _0x5dff29[_0x71d5('0x2c')];}_0xdf7d86[_0x71d5('0x1d')](_0x314852)[_0x71d5('0x2d')](_0x5dff29);};}exports[_0x71d5('0x2e')]=function(_0x33b3a2,_0x45d717){var _0x570f1c={},_0xfa21b9={},_0x28af84={'count':0x0,'rows':[]};var _0x3c63f3=_[_0x71d5('0x2f')](db[_0x71d5('0x30')][_0x71d5('0x31')],function(_0x2b472f){return{'name':_0x2b472f[_0x71d5('0x32')],'type':_0x2b472f[_0x71d5('0x33')][_0x71d5('0x34')]};});_0xfa21b9[_0x71d5('0x35')]=_[_0x71d5('0x2f')](_0x3c63f3,_0x71d5('0x2c'));_0xfa21b9['query']=_[_0x71d5('0x36')](_0x33b3a2[_0x71d5('0x37')]);_0xfa21b9['filters']=_['intersection'](_0xfa21b9['model'],_0xfa21b9[_0x71d5('0x37')]);_0x570f1c[_0x71d5('0x38')]=_[_0x71d5('0x39')](_0xfa21b9[_0x71d5('0x35')],qs[_0x71d5('0x3a')](_0x33b3a2['query']['fields']));_0x570f1c[_0x71d5('0x38')]=_0x570f1c['attributes'][_0x71d5('0x3b')]?_0x570f1c[_0x71d5('0x38')]:_0xfa21b9[_0x71d5('0x35')];if(!_0x33b3a2[_0x71d5('0x37')]['hasOwnProperty'](_0x71d5('0x3c'))){_0x570f1c[_0x71d5('0x22')]=qs[_0x71d5('0x22')](_0x33b3a2['query']['limit']);_0x570f1c['offset']=qs[_0x71d5('0x20')](_0x33b3a2[_0x71d5('0x37')][_0x71d5('0x20')]);}_0x570f1c[_0x71d5('0x3d')]=qs[_0x71d5('0x3e')](_0x33b3a2['query']['sort']);_0x570f1c[_0x71d5('0x3f')]=qs[_0x71d5('0x40')](_[_0x71d5('0x41')](_0x33b3a2['query'],_0xfa21b9[_0x71d5('0x40')]),_0x3c63f3);if(_0x33b3a2[_0x71d5('0x37')][_0x71d5('0x42')]){_0x570f1c[_0x71d5('0x3f')]=_[_0x71d5('0x43')](_0x570f1c[_0x71d5('0x3f')],{'$or':_[_0x71d5('0x2f')](_0x3c63f3,function(_0x9ddea4){if(_0x9ddea4['type']!==_0x71d5('0x44')){var _0xed812f={};_0xed812f[_0x9ddea4[_0x71d5('0x2c')]]={'$like':'%'+_0x33b3a2[_0x71d5('0x37')][_0x71d5('0x42')]+'%'};return _0xed812f;}})});}_0x570f1c=_[_0x71d5('0x43')]({},_0x570f1c,_0x33b3a2[_0x71d5('0x45')]);var _0x5e5065={'where':_0x570f1c[_0x71d5('0x3f')]};return db[_0x71d5('0x30')][_0x71d5('0x23')](_0x5e5065)[_0x71d5('0x29')](function(_0x38dc91){_0x28af84[_0x71d5('0x23')]=_0x38dc91;if(_0x33b3a2[_0x71d5('0x37')][_0x71d5('0x46')]){_0x570f1c['include']=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x570f1c);})[_0x71d5('0x29')](function(_0x25dd12){_0x28af84[_0x71d5('0x47')]=_0x25dd12;return _0x28af84;})[_0x71d5('0x29')](respondWithFilteredResult(_0x45d717,_0x570f1c))[_0x71d5('0x48')](handleError(_0x45d717,null));};exports[_0x71d5('0x49')]=function(_0x3e7f85,_0x2b357f){var _0x511eda={'raw':!![],'where':{'id':_0x3e7f85['params']['id']}},_0x3e1fa8={};_0x3e1fa8['model']=_[_0x71d5('0x36')](db['MailServerOut'][_0x71d5('0x31')]);_0x3e1fa8[_0x71d5('0x37')]=_[_0x71d5('0x36')](_0x3e7f85[_0x71d5('0x37')]);_0x3e1fa8[_0x71d5('0x40')]=_[_0x71d5('0x39')](_0x3e1fa8['model'],_0x3e1fa8[_0x71d5('0x37')]);_0x511eda[_0x71d5('0x38')]=_['intersection'](_0x3e1fa8[_0x71d5('0x35')],qs[_0x71d5('0x3a')](_0x3e7f85['query'][_0x71d5('0x3a')]));_0x511eda['attributes']=_0x511eda[_0x71d5('0x38')][_0x71d5('0x3b')]?_0x511eda[_0x71d5('0x38')]:_0x3e1fa8[_0x71d5('0x35')];if(_0x3e7f85[_0x71d5('0x37')][_0x71d5('0x46')]){_0x511eda[_0x71d5('0x4a')]=[{'all':!![]}];}_0x511eda=_[_0x71d5('0x43')]({},_0x511eda,_0x3e7f85[_0x71d5('0x45')]);return db[_0x71d5('0x30')]['find'](_0x511eda)[_0x71d5('0x29')](handleEntityNotFound(_0x2b357f,null))[_0x71d5('0x29')](respondWithResult(_0x2b357f,null))[_0x71d5('0x48')](handleError(_0x2b357f,null));};exports[_0x71d5('0x4b')]=function(_0x18f941,_0x2c8866){return db[_0x71d5('0x30')][_0x71d5('0x4b')](_0x18f941[_0x71d5('0x4c')],{})[_0x71d5('0x29')](respondWithResult(_0x2c8866,0xc9))[_0x71d5('0x48')](handleError(_0x2c8866,null));};exports[_0x71d5('0x28')]=function(_0xcf9af4,_0x831ba3){if(_0xcf9af4['body']['id']){delete _0xcf9af4[_0x71d5('0x4c')]['id'];}return db['MailServerOut'][_0x71d5('0x4d')]({'where':{'id':_0xcf9af4[_0x71d5('0x4e')]['id']}})[_0x71d5('0x29')](handleEntityNotFound(_0x831ba3,null))[_0x71d5('0x29')](saveUpdates(_0xcf9af4[_0x71d5('0x4c')],null))[_0x71d5('0x29')](respondWithResult(_0x831ba3,null))[_0x71d5('0x48')](handleError(_0x831ba3,null));};exports[_0x71d5('0x4f')]=function(_0x2b47cd,_0x11dcca){return db[_0x71d5('0x30')][_0x71d5('0x4d')]({'where':{'id':_0x2b47cd[_0x71d5('0x4e')]['id']}})[_0x71d5('0x29')](handleEntityNotFound(_0x11dcca,null))['then'](removeEntity(_0x11dcca,null))[_0x71d5('0x48')](handleError(_0x11dcca,null));}; \ No newline at end of file +var _0x1946=['end','offset','undefined','count','limit','set','json','apply','reject','update','then','error','stack','name','send','index','map','MailServerOut','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1f120c,_0x22cd8f){var _0x3f43f5=function(_0x2e6eef){while(--_0x2e6eef){_0x1f120c['push'](_0x1f120c['shift']());}};_0x3f43f5(++_0x22cd8f);}(_0x1946,0x1ec));var _0x6194=function(_0x1329f5,_0x432e84){_0x1329f5=_0x1329f5-0x0;var _0x401714=_0x1946[_0x1329f5];return _0x401714;};'use strict';var emlformat=require(_0x6194('0x0'));var rimraf=require(_0x6194('0x1'));var zipdir=require(_0x6194('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6194('0x3'));var util=require(_0x6194('0x4'));var path=require(_0x6194('0x5'));var sox=require(_0x6194('0x6'));var csv=require(_0x6194('0x7'));var ejs=require(_0x6194('0x8'));var fs=require('fs');var fs_extra=require(_0x6194('0x9'));var _=require(_0x6194('0xa'));var squel=require(_0x6194('0xb'));var crypto=require(_0x6194('0xc'));var jsforce=require(_0x6194('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6194('0x7'));var querystring=require(_0x6194('0xe'));var Papa=require(_0x6194('0xf'));var Redis=require(_0x6194('0x10'));var authService=require(_0x6194('0x11'));var qs=require(_0x6194('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6194('0x13'));var logger=require('../../config/logger')(_0x6194('0x14'));var utils=require(_0x6194('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6194('0x16'));var db=require(_0x6194('0x17'))['db'];function respondWithStatusCode(_0x3618ff,_0x10d2c8){_0x10d2c8=_0x10d2c8||0xcc;return function(_0x23b027){if(_0x23b027){return _0x3618ff[_0x6194('0x18')](_0x10d2c8);}return _0x3618ff[_0x6194('0x19')](_0x10d2c8)[_0x6194('0x1a')]();};}function respondWithResult(_0x28bde6,_0x22a258){_0x22a258=_0x22a258||0xc8;return function(_0x44daa1){if(_0x44daa1){return _0x28bde6[_0x6194('0x19')](_0x22a258)['json'](_0x44daa1);}};}function respondWithFilteredResult(_0x275c03,_0x2ec2f3){return function(_0x43237f){if(_0x43237f){var _0x52bd38=typeof _0x2ec2f3[_0x6194('0x1b')]===_0x6194('0x1c')&&typeof _0x2ec2f3['limit']===_0x6194('0x1c');var _0x118ec6=_0x43237f[_0x6194('0x1d')];var _0x22fe84=_0x52bd38?0x0:_0x2ec2f3[_0x6194('0x1b')];var _0xe1d333=_0x52bd38?_0x43237f['count']:_0x2ec2f3[_0x6194('0x1b')]+_0x2ec2f3[_0x6194('0x1e')];var _0x49dd96;if(_0xe1d333>=_0x118ec6){_0xe1d333=_0x118ec6;_0x49dd96=0xc8;}else{_0x49dd96=0xce;}_0x275c03[_0x6194('0x19')](_0x49dd96);return _0x275c03[_0x6194('0x1f')]('Content-Range',_0x22fe84+'-'+_0xe1d333+'/'+_0x118ec6)[_0x6194('0x20')](_0x43237f);}return null;};}function patchUpdates(_0x3d6711){return function(_0x220fc0){try{jsonpatch[_0x6194('0x21')](_0x220fc0,_0x3d6711,!![]);}catch(_0x3fa40c){return BPromise[_0x6194('0x22')](_0x3fa40c);}return _0x220fc0['save']();};}function saveUpdates(_0x19f904,_0x5cf011){return function(_0x45de15){if(_0x45de15){return _0x45de15[_0x6194('0x23')](_0x19f904)['then'](function(_0x114776){return _0x114776;});}return null;};}function removeEntity(_0x94c7c7,_0x5a8842){return function(_0x5a0e9d){if(_0x5a0e9d){return _0x5a0e9d['destroy']()[_0x6194('0x24')](function(){_0x94c7c7[_0x6194('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a4f9,_0x3d4285){return function(_0x170ac7){if(!_0x170ac7){_0x13a4f9[_0x6194('0x18')](0x194);}return _0x170ac7;};}function handleError(_0xb64da,_0x10b010){_0x10b010=_0x10b010||0x1f4;return function(_0x531444){logger[_0x6194('0x25')](_0x531444[_0x6194('0x26')]);if(_0x531444[_0x6194('0x27')]){delete _0x531444['name'];}_0xb64da['status'](_0x10b010)[_0x6194('0x28')](_0x531444);};}exports[_0x6194('0x29')]=function(_0x45084a,_0x4f377c){var _0x4535e4={},_0x46dcc4={},_0x232ead={'count':0x0,'rows':[]};var _0x508684=_[_0x6194('0x2a')](db[_0x6194('0x2b')]['rawAttributes'],function(_0x4a2cc1){return{'name':_0x4a2cc1['fieldName'],'type':_0x4a2cc1[_0x6194('0x2c')][_0x6194('0x2d')]};});_0x46dcc4['model']=_[_0x6194('0x2a')](_0x508684,_0x6194('0x27'));_0x46dcc4[_0x6194('0x2e')]=_[_0x6194('0x2f')](_0x45084a[_0x6194('0x2e')]);_0x46dcc4[_0x6194('0x30')]=_[_0x6194('0x31')](_0x46dcc4[_0x6194('0x32')],_0x46dcc4[_0x6194('0x2e')]);_0x4535e4[_0x6194('0x33')]=_['intersection'](_0x46dcc4['model'],qs[_0x6194('0x34')](_0x45084a['query'][_0x6194('0x34')]));_0x4535e4[_0x6194('0x33')]=_0x4535e4[_0x6194('0x33')][_0x6194('0x35')]?_0x4535e4[_0x6194('0x33')]:_0x46dcc4['model'];if(!_0x45084a[_0x6194('0x2e')][_0x6194('0x36')](_0x6194('0x37'))){_0x4535e4['limit']=qs[_0x6194('0x1e')](_0x45084a[_0x6194('0x2e')][_0x6194('0x1e')]);_0x4535e4[_0x6194('0x1b')]=qs['offset'](_0x45084a[_0x6194('0x2e')][_0x6194('0x1b')]);}_0x4535e4['order']=qs[_0x6194('0x38')](_0x45084a[_0x6194('0x2e')][_0x6194('0x38')]);_0x4535e4[_0x6194('0x39')]=qs[_0x6194('0x30')](_[_0x6194('0x3a')](_0x45084a['query'],_0x46dcc4['filters']),_0x508684);if(_0x45084a[_0x6194('0x2e')]['filter']){_0x4535e4[_0x6194('0x39')]=_['merge'](_0x4535e4['where'],{'$or':_['map'](_0x508684,function(_0x32cd87){if(_0x32cd87['type']!==_0x6194('0x3b')){var _0x216f19={};_0x216f19[_0x32cd87[_0x6194('0x27')]]={'$like':'%'+_0x45084a['query'][_0x6194('0x3c')]+'%'};return _0x216f19;}})});}_0x4535e4=_[_0x6194('0x3d')]({},_0x4535e4,_0x45084a[_0x6194('0x3e')]);var _0x199265={'where':_0x4535e4[_0x6194('0x39')]};return db[_0x6194('0x2b')][_0x6194('0x1d')](_0x199265)['then'](function(_0x15ad58){_0x232ead[_0x6194('0x1d')]=_0x15ad58;if(_0x45084a[_0x6194('0x2e')][_0x6194('0x3f')]){_0x4535e4[_0x6194('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x6194('0x41')](_0x4535e4);})[_0x6194('0x24')](function(_0x15c29e){_0x232ead[_0x6194('0x42')]=_0x15c29e;return _0x232ead;})[_0x6194('0x24')](respondWithFilteredResult(_0x4f377c,_0x4535e4))[_0x6194('0x43')](handleError(_0x4f377c,null));};exports[_0x6194('0x44')]=function(_0x46ec77,_0xcd621a){var _0x1d5756={'raw':!![],'where':{'id':_0x46ec77[_0x6194('0x45')]['id']}},_0x2ec815={};_0x2ec815[_0x6194('0x32')]=_[_0x6194('0x2f')](db['MailServerOut'][_0x6194('0x46')]);_0x2ec815['query']=_['keys'](_0x46ec77[_0x6194('0x2e')]);_0x2ec815[_0x6194('0x30')]=_[_0x6194('0x31')](_0x2ec815[_0x6194('0x32')],_0x2ec815['query']);_0x1d5756[_0x6194('0x33')]=_[_0x6194('0x31')](_0x2ec815[_0x6194('0x32')],qs[_0x6194('0x34')](_0x46ec77['query'][_0x6194('0x34')]));_0x1d5756[_0x6194('0x33')]=_0x1d5756[_0x6194('0x33')]['length']?_0x1d5756[_0x6194('0x33')]:_0x2ec815[_0x6194('0x32')];if(_0x46ec77[_0x6194('0x2e')][_0x6194('0x3f')]){_0x1d5756['include']=[{'all':!![]}];}_0x1d5756=_[_0x6194('0x3d')]({},_0x1d5756,_0x46ec77['options']);return db[_0x6194('0x2b')][_0x6194('0x47')](_0x1d5756)[_0x6194('0x24')](handleEntityNotFound(_0xcd621a,null))[_0x6194('0x24')](respondWithResult(_0xcd621a,null))[_0x6194('0x43')](handleError(_0xcd621a,null));};exports['create']=function(_0x4d90bc,_0x3e7382){return db[_0x6194('0x2b')][_0x6194('0x48')](_0x4d90bc[_0x6194('0x49')],{})[_0x6194('0x24')](respondWithResult(_0x3e7382,0xc9))[_0x6194('0x43')](handleError(_0x3e7382,null));};exports['update']=function(_0x3a7db9,_0x1872b7){if(_0x3a7db9[_0x6194('0x49')]['id']){delete _0x3a7db9['body']['id'];}return db['MailServerOut'][_0x6194('0x47')]({'where':{'id':_0x3a7db9[_0x6194('0x45')]['id']}})[_0x6194('0x24')](handleEntityNotFound(_0x1872b7,null))['then'](saveUpdates(_0x3a7db9['body'],null))[_0x6194('0x24')](respondWithResult(_0x1872b7,null))[_0x6194('0x43')](handleError(_0x1872b7,null));};exports['destroy']=function(_0x31de24,_0x102bc1){return db[_0x6194('0x2b')]['find']({'where':{'id':_0x31de24[_0x6194('0x45')]['id']}})[_0x6194('0x24')](handleEntityNotFound(_0x102bc1,null))[_0x6194('0x24')](removeEntity(_0x102bc1,null))['catch'](handleError(_0x102bc1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b09505d..5720dfd 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 _0x6b0e=['MailServerOut','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x7c9f6d,_0x20b047){var _0x4155ec=function(_0x130d42){while(--_0x130d42){_0x7c9f6d['push'](_0x7c9f6d['shift']());}};_0x4155ec(++_0x20b047);}(_0x6b0e,0x17d));var _0xe6b0=function(_0x38426c,_0x29c0c8){_0x38426c=_0x38426c-0x0;var _0x51c665=_0x6b0e[_0x38426c];return _0x51c665;};'use strict';var _=require(_0xe6b0('0x0'));var util=require(_0xe6b0('0x1'));var logger=require('../../config/logger')(_0xe6b0('0x2'));var moment=require(_0xe6b0('0x3'));var BPromise=require(_0xe6b0('0x4'));var rp=require(_0xe6b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6b0('0x6'));var config=require(_0xe6b0('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xe6b0('0x8')]=function(_0x49761b,_0x3da3c6){return _0x49761b['define'](_0xe6b0('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fbb=['request-promise','path','rimraf','../../config/environment','exports','mail_servers_out','util','../../config/logger','bluebird'];(function(_0x14245a,_0x42d63a){var _0x223ac8=function(_0x5ad536){while(--_0x5ad536){_0x14245a['push'](_0x14245a['shift']());}};_0x223ac8(++_0x42d63a);}(_0x5fbb,0x189));var _0xb5fb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5fbb[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb5fb('0x0'));var logger=require(_0xb5fb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb5fb('0x2'));var rp=require(_0xb5fb('0x3'));var fs=require('fs');var path=require(_0xb5fb('0x4'));var rimraf=require(_0xb5fb('0x5'));var config=require(_0xb5fb('0x6'));var attributes=require('./mailServerOut.attributes');module[_0xb5fb('0x7')]=function(_0x34ce5f,_0x2c4a1c){return _0x34ce5f['define']('MailServerOut',attributes,{'tableName':_0xb5fb('0x8'),'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 878e957..c5b3fc4 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(_0x4b15a4,_0x4241fe){var _0x40a783=function(_0x1f3de1){while(--_0x1f3de1){_0x4b15a4['push'](_0x4b15a4['shift']());}};_0x40a783(++_0x4241fe);}(_0x2ef3,0xba));var _0x32ef=function(_0x10ae42,_0x8f1ff8){_0x10ae42=_0x10ae42-0x0;var _0x281bff=_0x2ef3[_0x10ae42];return _0x281bff;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x20aeff,_0x44ea3a){var _0x2ea56a=function(_0x5e51dd){while(--_0x5e51dd){_0x20aeff['push'](_0x20aeff['shift']());}};_0x2ea56a(++_0x44ea3a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b97f9,_0x3c3c1c){_0x1b97f9=_0x1b97f9-0x0;var _0x34f1ce=_0x5f2f[_0x1b97f9];return _0x34f1ce;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d93e909..45b89a0 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 _0x3c42=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailSubstatus.controller','get','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c42,0x165));var _0x23c4=function(_0x34e4af,_0x2de566){_0x34e4af=_0x34e4af-0x0;var _0x192500=_0x3c42[_0x34e4af];return _0x192500;};'use strict';var multer=require(_0x23c4('0x0'));var util=require(_0x23c4('0x1'));var path=require(_0x23c4('0x2'));var timeout=require(_0x23c4('0x3'));var express=require(_0x23c4('0x4'));var router=express[_0x23c4('0x5')]();var fs_extra=require(_0x23c4('0x6'));var auth=require(_0x23c4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x23c4('0x8'));router[_0x23c4('0x9')]('/',auth[_0x23c4('0xa')](),controller['index']);router['get']('/describe',auth[_0x23c4('0xa')](),controller[_0x23c4('0xb')]);router[_0x23c4('0x9')]('/:id',auth[_0x23c4('0xa')](),controller[_0x23c4('0xc')]);router['post']('/',auth[_0x23c4('0xa')](),controller[_0x23c4('0xd')]);router[_0x23c4('0xe')](_0x23c4('0xf'),auth[_0x23c4('0xa')](),controller[_0x23c4('0x10')]);router[_0x23c4('0x11')]('/:id',auth[_0x23c4('0xa')](),controller[_0x23c4('0x12')]);module[_0x23c4('0x13')]=router; \ No newline at end of file +var _0xd6dc=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x1d6914,_0x2f6a85){var _0x511d10=function(_0x470e70){while(--_0x470e70){_0x1d6914['push'](_0x1d6914['shift']());}};_0x511d10(++_0x2f6a85);}(_0xd6dc,0x65));var _0xcd6d=function(_0x165d75,_0x57cd54){_0x165d75=_0x165d75-0x0;var _0x35215d=_0xd6dc[_0x165d75];return _0x35215d;};'use strict';var multer=require(_0xcd6d('0x0'));var util=require(_0xcd6d('0x1'));var path=require(_0xcd6d('0x2'));var timeout=require(_0xcd6d('0x3'));var express=require(_0xcd6d('0x4'));var router=express[_0xcd6d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcd6d('0x6'));var interaction=require(_0xcd6d('0x7'));var config=require(_0xcd6d('0x8'));var controller=require(_0xcd6d('0x9'));router[_0xcd6d('0xa')]('/',auth[_0xcd6d('0xb')](),controller[_0xcd6d('0xc')]);router[_0xcd6d('0xa')](_0xcd6d('0xd'),auth[_0xcd6d('0xb')](),controller['describe']);router[_0xcd6d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xcd6d('0xe')]);router[_0xcd6d('0xf')]('/',auth[_0xcd6d('0xb')](),controller[_0xcd6d('0x10')]);router['put'](_0xcd6d('0x11'),auth[_0xcd6d('0xb')](),controller[_0xcd6d('0x12')]);router[_0xcd6d('0x13')](_0xcd6d('0x11'),auth['isAuthenticated'](),controller[_0xcd6d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 463242d..ae5c64d 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 _0x8375=['sequelize','exports','STRING'];(function(_0x34e553,_0x3935e1){var _0x4485b5=function(_0x5ebd36){while(--_0x5ebd36){_0x34e553['push'](_0x34e553['shift']());}};_0x4485b5(++_0x3935e1);}(_0x8375,0xa8));var _0x5837=function(_0xbb328b,_0x5db3b2){_0xbb328b=_0xbb328b-0x0;var _0x207e8d=_0x8375[_0xbb328b];return _0x207e8d;};'use strict';var Sequelize=require(_0x5837('0x0'));module[_0x5837('0x1')]={'name':{'type':Sequelize[_0x5837('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5837('0x2')]}}; \ No newline at end of file +var _0x0689=['name','STRING','exports'];(function(_0x348928,_0x38e7fc){var _0x308486=function(_0x152171){while(--_0x152171){_0x348928['push'](_0x348928['shift']());}};_0x308486(++_0x38e7fc);}(_0x0689,0x161));var _0x9068=function(_0x2b6e53,_0x4ed0d2){_0x2b6e53=_0x2b6e53-0x0;var _0x35bab1=_0x0689[_0x2b6e53];return _0x35bab1;};'use strict';var Sequelize=require('sequelize');module[_0x9068('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9068('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9068('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f229d21..dc5f3e2 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 _0x1650=['catch','show','keys','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','MailSubstatus','findAll','rows'];(function(_0x5407e4,_0x1a698c){var _0x100eda=function(_0xa85e7b){while(--_0xa85e7b){_0x5407e4['push'](_0x5407e4['shift']());}};_0x100eda(++_0x1a698c);}(_0x1650,0x130));var _0x0165=function(_0x4f8e06,_0x3226b1){_0x4f8e06=_0x4f8e06-0x0;var _0x327dad=_0x1650[_0x4f8e06];return _0x327dad;};'use strict';var emlformat=require(_0x0165('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0165('0x1'));var jsonpatch=require(_0x0165('0x2'));var rp=require('request-promise');var moment=require(_0x0165('0x3'));var BPromise=require(_0x0165('0x4'));var Mustache=require(_0x0165('0x5'));var util=require(_0x0165('0x6'));var path=require(_0x0165('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0165('0x8'));var squel=require(_0x0165('0x9'));var crypto=require(_0x0165('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0165('0xb'));var toCsv=require(_0x0165('0xc'));var querystring=require(_0x0165('0xd'));var Papa=require(_0x0165('0xe'));var Redis=require(_0x0165('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0165('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0165('0x11'));var logger=require(_0x0165('0x12'))(_0x0165('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0165('0x14'));var db=require(_0x0165('0x15'))['db'];function respondWithStatusCode(_0x3114d9,_0x12897e){_0x12897e=_0x12897e||0xcc;return function(_0x168f20){if(_0x168f20){return _0x3114d9[_0x0165('0x16')](_0x12897e);}return _0x3114d9['status'](_0x12897e)['end']();};}function respondWithResult(_0x440b7f,_0x212c92){_0x212c92=_0x212c92||0xc8;return function(_0x4f6e01){if(_0x4f6e01){return _0x440b7f['status'](_0x212c92)[_0x0165('0x17')](_0x4f6e01);}};}function respondWithFilteredResult(_0x16d4dd,_0x5ef9d9){return function(_0x41b7f4){if(_0x41b7f4){var _0x49a37f=typeof _0x5ef9d9[_0x0165('0x18')]===_0x0165('0x19')&&typeof _0x5ef9d9[_0x0165('0x1a')]===_0x0165('0x19');var _0x1d5a38=_0x41b7f4[_0x0165('0x1b')];var _0x358e21=_0x49a37f?0x0:_0x5ef9d9[_0x0165('0x18')];var _0x59c57a=_0x49a37f?_0x41b7f4[_0x0165('0x1b')]:_0x5ef9d9[_0x0165('0x18')]+_0x5ef9d9[_0x0165('0x1a')];var _0x276905;if(_0x59c57a>=_0x1d5a38){_0x59c57a=_0x1d5a38;_0x276905=0xc8;}else{_0x276905=0xce;}_0x16d4dd[_0x0165('0x1c')](_0x276905);return _0x16d4dd[_0x0165('0x1d')](_0x0165('0x1e'),_0x358e21+'-'+_0x59c57a+'/'+_0x1d5a38)['json'](_0x41b7f4);}return null;};}function patchUpdates(_0x73f5a5){return function(_0x44370d){try{jsonpatch[_0x0165('0x1f')](_0x44370d,_0x73f5a5,!![]);}catch(_0x2cb9b1){return BPromise[_0x0165('0x20')](_0x2cb9b1);}return _0x44370d[_0x0165('0x21')]();};}function saveUpdates(_0x42691f,_0x2c9eb9){return function(_0x2e7c04){if(_0x2e7c04){return _0x2e7c04[_0x0165('0x22')](_0x42691f)[_0x0165('0x23')](function(_0x402c8a){return _0x402c8a;});}return null;};}function removeEntity(_0x3dd94c,_0x36b45f){return function(_0x15e9c1){if(_0x15e9c1){return _0x15e9c1[_0x0165('0x24')]()['then'](function(){_0x3dd94c['status'](0xcc)[_0x0165('0x25')]();});}};}function handleEntityNotFound(_0x5ddb25,_0x7e75cc){return function(_0x473082){if(!_0x473082){_0x5ddb25[_0x0165('0x16')](0x194);}return _0x473082;};}function handleError(_0x3dd4af,_0x4e9f48){_0x4e9f48=_0x4e9f48||0x1f4;return function(_0x385654){logger[_0x0165('0x26')](_0x385654[_0x0165('0x27')]);if(_0x385654['name']){delete _0x385654[_0x0165('0x28')];}_0x3dd4af['status'](_0x4e9f48)[_0x0165('0x29')](_0x385654);};}exports['index']=function(_0x33b2bd,_0x44ecbd){var _0x11def6={},_0x4c65ba={},_0x5dc96d={'count':0x0,'rows':[]};var _0x3db7bc=_[_0x0165('0x2a')](db['MailSubstatus'][_0x0165('0x2b')],function(_0x2dd970){return{'name':_0x2dd970[_0x0165('0x2c')],'type':_0x2dd970[_0x0165('0x2d')][_0x0165('0x2e')]};});_0x4c65ba[_0x0165('0x2f')]=_['map'](_0x3db7bc,_0x0165('0x28'));_0x4c65ba['query']=_['keys'](_0x33b2bd[_0x0165('0x30')]);_0x4c65ba[_0x0165('0x31')]=_[_0x0165('0x32')](_0x4c65ba[_0x0165('0x2f')],_0x4c65ba['query']);_0x11def6[_0x0165('0x33')]=_[_0x0165('0x32')](_0x4c65ba[_0x0165('0x2f')],qs[_0x0165('0x34')](_0x33b2bd[_0x0165('0x30')][_0x0165('0x34')]));_0x11def6[_0x0165('0x33')]=_0x11def6[_0x0165('0x33')][_0x0165('0x35')]?_0x11def6[_0x0165('0x33')]:_0x4c65ba[_0x0165('0x2f')];if(!_0x33b2bd[_0x0165('0x30')][_0x0165('0x36')]('nolimit')){_0x11def6[_0x0165('0x1a')]=qs[_0x0165('0x1a')](_0x33b2bd[_0x0165('0x30')][_0x0165('0x1a')]);_0x11def6[_0x0165('0x18')]=qs[_0x0165('0x18')](_0x33b2bd['query'][_0x0165('0x18')]);}_0x11def6[_0x0165('0x37')]=qs[_0x0165('0x38')](_0x33b2bd[_0x0165('0x30')][_0x0165('0x38')]);_0x11def6[_0x0165('0x39')]=qs[_0x0165('0x31')](_[_0x0165('0x3a')](_0x33b2bd['query'],_0x4c65ba['filters']),_0x3db7bc);if(_0x33b2bd[_0x0165('0x30')][_0x0165('0x3b')]){_0x11def6[_0x0165('0x39')]=_[_0x0165('0x3c')](_0x11def6[_0x0165('0x39')],{'$or':_[_0x0165('0x2a')](_0x3db7bc,function(_0x874ac5){if(_0x874ac5[_0x0165('0x2d')]!=='VIRTUAL'){var _0x2ead30={};_0x2ead30[_0x874ac5['name']]={'$like':'%'+_0x33b2bd[_0x0165('0x30')][_0x0165('0x3b')]+'%'};return _0x2ead30;}})});}_0x11def6=_[_0x0165('0x3c')]({},_0x11def6,_0x33b2bd[_0x0165('0x3d')]);var _0x110671={'where':_0x11def6[_0x0165('0x39')]};return db['MailSubstatus'][_0x0165('0x1b')](_0x110671)[_0x0165('0x23')](function(_0x1319d8){_0x5dc96d[_0x0165('0x1b')]=_0x1319d8;if(_0x33b2bd[_0x0165('0x30')]['includeAll']){_0x11def6[_0x0165('0x3e')]=[{'all':!![]}];}return db[_0x0165('0x3f')][_0x0165('0x40')](_0x11def6);})['then'](function(_0x1706d4){_0x5dc96d[_0x0165('0x41')]=_0x1706d4;return _0x5dc96d;})[_0x0165('0x23')](respondWithFilteredResult(_0x44ecbd,_0x11def6))[_0x0165('0x42')](handleError(_0x44ecbd,null));};exports[_0x0165('0x43')]=function(_0x105d59,_0x397a37){var _0x29ed97={'raw':!![],'where':{'id':_0x105d59['params']['id']}},_0x525401={};_0x525401[_0x0165('0x2f')]=_['keys'](db[_0x0165('0x3f')][_0x0165('0x2b')]);_0x525401['query']=_[_0x0165('0x44')](_0x105d59[_0x0165('0x30')]);_0x525401[_0x0165('0x31')]=_[_0x0165('0x32')](_0x525401['model'],_0x525401[_0x0165('0x30')]);_0x29ed97[_0x0165('0x33')]=_[_0x0165('0x32')](_0x525401[_0x0165('0x2f')],qs[_0x0165('0x34')](_0x105d59['query'][_0x0165('0x34')]));_0x29ed97[_0x0165('0x33')]=_0x29ed97[_0x0165('0x33')][_0x0165('0x35')]?_0x29ed97[_0x0165('0x33')]:_0x525401[_0x0165('0x2f')];if(_0x105d59[_0x0165('0x30')][_0x0165('0x45')]){_0x29ed97[_0x0165('0x3e')]=[{'all':!![]}];}_0x29ed97=_[_0x0165('0x3c')]({},_0x29ed97,_0x105d59['options']);return db[_0x0165('0x3f')][_0x0165('0x46')](_0x29ed97)['then'](handleEntityNotFound(_0x397a37,null))[_0x0165('0x23')](respondWithResult(_0x397a37,null))[_0x0165('0x42')](handleError(_0x397a37,null));};exports[_0x0165('0x47')]=function(_0x15af51,_0x5a02a7){return db[_0x0165('0x3f')][_0x0165('0x47')](_0x15af51['body'],{})[_0x0165('0x23')](respondWithResult(_0x5a02a7,0xc9))['catch'](handleError(_0x5a02a7,null));};exports['update']=function(_0x2ee490,_0x5b7ced){if(_0x2ee490[_0x0165('0x48')]['id']){delete _0x2ee490[_0x0165('0x48')]['id'];}return db[_0x0165('0x3f')][_0x0165('0x46')]({'where':{'id':_0x2ee490[_0x0165('0x49')]['id']}})[_0x0165('0x23')](handleEntityNotFound(_0x5b7ced,null))[_0x0165('0x23')](saveUpdates(_0x2ee490[_0x0165('0x48')],null))[_0x0165('0x23')](respondWithResult(_0x5b7ced,null))[_0x0165('0x42')](handleError(_0x5b7ced,null));};exports[_0x0165('0x24')]=function(_0xcffb35,_0x451b6d){return db['MailSubstatus'][_0x0165('0x46')]({'where':{'id':_0xcffb35[_0x0165('0x49')]['id']}})['then'](handleEntityNotFound(_0x451b6d,null))[_0x0165('0x23')](removeEntity(_0x451b6d,null))[_0x0165('0x42')](handleError(_0x451b6d,null));};exports['describe']=function(_0x2ebc16,_0x206e18){return db[_0x0165('0x3f')]['describe']()[_0x0165('0x23')](respondWithResult(_0x206e18,null))[_0x0165('0x42')](handleError(_0x206e18,null));}; \ No newline at end of file +var _0xe385=['fields','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','catch','create','update','body','describe','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../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','then','destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xe385,0x152));var _0x5e38=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe385[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x5e38('0x0'));var rimraf=require(_0x5e38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e38('0x2'));var moment=require(_0x5e38('0x3'));var BPromise=require(_0x5e38('0x4'));var Mustache=require(_0x5e38('0x5'));var util=require(_0x5e38('0x6'));var path=require(_0x5e38('0x7'));var sox=require(_0x5e38('0x8'));var csv=require(_0x5e38('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e38('0xa'));var _=require(_0x5e38('0xb'));var squel=require('squel');var crypto=require(_0x5e38('0xc'));var jsforce=require(_0x5e38('0xd'));var deskjs=require(_0x5e38('0xe'));var toCsv=require(_0x5e38('0x9'));var querystring=require(_0x5e38('0xf'));var Papa=require(_0x5e38('0x10'));var Redis=require(_0x5e38('0x11'));var authService=require(_0x5e38('0x12'));var qs=require(_0x5e38('0x13'));var as=require(_0x5e38('0x14'));var hardwareService=require(_0x5e38('0x15'));var logger=require(_0x5e38('0x16'))('api');var utils=require(_0x5e38('0x17'));var config=require(_0x5e38('0x18'));var licenseUtil=require(_0x5e38('0x19'));var db=require(_0x5e38('0x1a'))['db'];function respondWithStatusCode(_0x259fd3,_0x160c03){_0x160c03=_0x160c03||0xcc;return function(_0x71ec74){if(_0x71ec74){return _0x259fd3[_0x5e38('0x1b')](_0x160c03);}return _0x259fd3[_0x5e38('0x1c')](_0x160c03)[_0x5e38('0x1d')]();};}function respondWithResult(_0x2798de,_0x3b3994){_0x3b3994=_0x3b3994||0xc8;return function(_0x267e01){if(_0x267e01){return _0x2798de[_0x5e38('0x1c')](_0x3b3994)['json'](_0x267e01);}};}function respondWithFilteredResult(_0xa9cf4f,_0x4ee608){return function(_0x5e53b2){if(_0x5e53b2){var _0x2075d1=typeof _0x4ee608[_0x5e38('0x1e')]===_0x5e38('0x1f')&&typeof _0x4ee608[_0x5e38('0x20')]===_0x5e38('0x1f');var _0x35e7da=_0x5e53b2[_0x5e38('0x21')];var _0x44c419=_0x2075d1?0x0:_0x4ee608['offset'];var _0x52cf5a=_0x2075d1?_0x5e53b2[_0x5e38('0x21')]:_0x4ee608[_0x5e38('0x1e')]+_0x4ee608[_0x5e38('0x20')];var _0x2c2877;if(_0x52cf5a>=_0x35e7da){_0x52cf5a=_0x35e7da;_0x2c2877=0xc8;}else{_0x2c2877=0xce;}_0xa9cf4f['status'](_0x2c2877);return _0xa9cf4f[_0x5e38('0x22')]('Content-Range',_0x44c419+'-'+_0x52cf5a+'/'+_0x35e7da)[_0x5e38('0x23')](_0x5e53b2);}return null;};}function patchUpdates(_0x156621){return function(_0x317b1d){try{jsonpatch[_0x5e38('0x24')](_0x317b1d,_0x156621,!![]);}catch(_0x39c754){return BPromise[_0x5e38('0x25')](_0x39c754);}return _0x317b1d[_0x5e38('0x26')]();};}function saveUpdates(_0x29c746,_0x50f1cc){return function(_0x56f6bc){if(_0x56f6bc){return _0x56f6bc['update'](_0x29c746)[_0x5e38('0x27')](function(_0x1ead36){return _0x1ead36;});}return null;};}function removeEntity(_0xb2ed0e,_0x5732e9){return function(_0x1e13ea){if(_0x1e13ea){return _0x1e13ea[_0x5e38('0x28')]()[_0x5e38('0x27')](function(){_0xb2ed0e[_0x5e38('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a72b,_0x187e93){return function(_0x305dff){if(!_0x305dff){_0x27a72b[_0x5e38('0x1b')](0x194);}return _0x305dff;};}function handleError(_0x45421c,_0x450fe1){_0x450fe1=_0x450fe1||0x1f4;return function(_0x2496b7){logger[_0x5e38('0x29')](_0x2496b7[_0x5e38('0x2a')]);if(_0x2496b7[_0x5e38('0x2b')]){delete _0x2496b7[_0x5e38('0x2b')];}_0x45421c['status'](_0x450fe1)[_0x5e38('0x2c')](_0x2496b7);};}exports[_0x5e38('0x2d')]=function(_0x1a43b7,_0x302064){var _0x805d74={},_0x1aef47={},_0xcafce={'count':0x0,'rows':[]};var _0x2f6475=_['map'](db[_0x5e38('0x2e')][_0x5e38('0x2f')],function(_0x3bbbfb){return{'name':_0x3bbbfb[_0x5e38('0x30')],'type':_0x3bbbfb[_0x5e38('0x31')][_0x5e38('0x32')]};});_0x1aef47[_0x5e38('0x33')]=_[_0x5e38('0x34')](_0x2f6475,_0x5e38('0x2b'));_0x1aef47[_0x5e38('0x35')]=_['keys'](_0x1a43b7['query']);_0x1aef47[_0x5e38('0x36')]=_[_0x5e38('0x37')](_0x1aef47[_0x5e38('0x33')],_0x1aef47[_0x5e38('0x35')]);_0x805d74[_0x5e38('0x38')]=_[_0x5e38('0x37')](_0x1aef47[_0x5e38('0x33')],qs[_0x5e38('0x39')](_0x1a43b7[_0x5e38('0x35')][_0x5e38('0x39')]));_0x805d74[_0x5e38('0x38')]=_0x805d74['attributes']['length']?_0x805d74[_0x5e38('0x38')]:_0x1aef47[_0x5e38('0x33')];if(!_0x1a43b7[_0x5e38('0x35')]['hasOwnProperty'](_0x5e38('0x3a'))){_0x805d74[_0x5e38('0x20')]=qs[_0x5e38('0x20')](_0x1a43b7[_0x5e38('0x35')][_0x5e38('0x20')]);_0x805d74[_0x5e38('0x1e')]=qs[_0x5e38('0x1e')](_0x1a43b7[_0x5e38('0x35')][_0x5e38('0x1e')]);}_0x805d74[_0x5e38('0x3b')]=qs['sort'](_0x1a43b7['query']['sort']);_0x805d74[_0x5e38('0x3c')]=qs[_0x5e38('0x36')](_[_0x5e38('0x3d')](_0x1a43b7[_0x5e38('0x35')],_0x1aef47['filters']),_0x2f6475);if(_0x1a43b7[_0x5e38('0x35')][_0x5e38('0x3e')]){_0x805d74['where']=_[_0x5e38('0x3f')](_0x805d74[_0x5e38('0x3c')],{'$or':_[_0x5e38('0x34')](_0x2f6475,function(_0x29aa49){if(_0x29aa49[_0x5e38('0x31')]!==_0x5e38('0x40')){var _0x3d1ec1={};_0x3d1ec1[_0x29aa49['name']]={'$like':'%'+_0x1a43b7[_0x5e38('0x35')]['filter']+'%'};return _0x3d1ec1;}})});}_0x805d74=_[_0x5e38('0x3f')]({},_0x805d74,_0x1a43b7[_0x5e38('0x41')]);var _0x1fcbd2={'where':_0x805d74[_0x5e38('0x3c')]};return db[_0x5e38('0x2e')][_0x5e38('0x21')](_0x1fcbd2)['then'](function(_0x5c825f){_0xcafce[_0x5e38('0x21')]=_0x5c825f;if(_0x1a43b7['query'][_0x5e38('0x42')]){_0x805d74[_0x5e38('0x43')]=[{'all':!![]}];}return db[_0x5e38('0x2e')]['findAll'](_0x805d74);})[_0x5e38('0x27')](function(_0x4f83cf){_0xcafce[_0x5e38('0x44')]=_0x4f83cf;return _0xcafce;})['then'](respondWithFilteredResult(_0x302064,_0x805d74))['catch'](handleError(_0x302064,null));};exports[_0x5e38('0x45')]=function(_0x5afceb,_0x22286d){var _0x58a4b0={'raw':!![],'where':{'id':_0x5afceb[_0x5e38('0x46')]['id']}},_0x454d41={};_0x454d41[_0x5e38('0x33')]=_[_0x5e38('0x47')](db['MailSubstatus']['rawAttributes']);_0x454d41[_0x5e38('0x35')]=_[_0x5e38('0x47')](_0x5afceb[_0x5e38('0x35')]);_0x454d41[_0x5e38('0x36')]=_[_0x5e38('0x37')](_0x454d41[_0x5e38('0x33')],_0x454d41['query']);_0x58a4b0[_0x5e38('0x38')]=_[_0x5e38('0x37')](_0x454d41[_0x5e38('0x33')],qs[_0x5e38('0x39')](_0x5afceb[_0x5e38('0x35')][_0x5e38('0x39')]));_0x58a4b0[_0x5e38('0x38')]=_0x58a4b0[_0x5e38('0x38')][_0x5e38('0x48')]?_0x58a4b0[_0x5e38('0x38')]:_0x454d41[_0x5e38('0x33')];if(_0x5afceb['query']['includeAll']){_0x58a4b0[_0x5e38('0x43')]=[{'all':!![]}];}_0x58a4b0=_[_0x5e38('0x3f')]({},_0x58a4b0,_0x5afceb[_0x5e38('0x41')]);return db[_0x5e38('0x2e')][_0x5e38('0x49')](_0x58a4b0)[_0x5e38('0x27')](handleEntityNotFound(_0x22286d,null))[_0x5e38('0x27')](respondWithResult(_0x22286d,null))[_0x5e38('0x4a')](handleError(_0x22286d,null));};exports[_0x5e38('0x4b')]=function(_0x399ca7,_0x24be80){return db[_0x5e38('0x2e')]['create'](_0x399ca7['body'],{})['then'](respondWithResult(_0x24be80,0xc9))['catch'](handleError(_0x24be80,null));};exports[_0x5e38('0x4c')]=function(_0x2297da,_0x58d42a){if(_0x2297da[_0x5e38('0x4d')]['id']){delete _0x2297da[_0x5e38('0x4d')]['id'];}return db['MailSubstatus'][_0x5e38('0x49')]({'where':{'id':_0x2297da[_0x5e38('0x46')]['id']}})[_0x5e38('0x27')](handleEntityNotFound(_0x58d42a,null))['then'](saveUpdates(_0x2297da['body'],null))[_0x5e38('0x27')](respondWithResult(_0x58d42a,null))[_0x5e38('0x4a')](handleError(_0x58d42a,null));};exports[_0x5e38('0x28')]=function(_0x5986e9,_0x3a4b24){return db[_0x5e38('0x2e')][_0x5e38('0x49')]({'where':{'id':_0x5986e9[_0x5e38('0x46')]['id']}})[_0x5e38('0x27')](handleEntityNotFound(_0x3a4b24,null))[_0x5e38('0x27')](removeEntity(_0x3a4b24,null))[_0x5e38('0x4a')](handleError(_0x3a4b24,null));};exports['describe']=function(_0x14b2cd,_0x2d3a36){return db[_0x5e38('0x2e')][_0x5e38('0x4e')]()['then'](respondWithResult(_0x2d3a36,null))[_0x5e38('0x4a')](handleError(_0x2d3a36,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 766b1aa..f45e10a 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 _0xaa7b=['hook','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x45fe7c,_0x2dddec){var _0x253cab=function(_0x2f3bc7){while(--_0x2f3bc7){_0x45fe7c['push'](_0x45fe7c['shift']());}};_0x253cab(++_0x2dddec);}(_0xaa7b,0x145));var _0xbaa7=function(_0x1fd64d,_0x2d5b24){_0x1fd64d=_0x1fd64d-0x0;var _0x1bd8e1=_0xaa7b[_0x1fd64d];return _0x1bd8e1;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0xbaa7('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xbaa7('0x1')](0x0);var events={'afterUpdate':_0xbaa7('0x2')};function emitEvent(_0x1446b2){return function(_0x459ed9,_0x33e458,_0x53562a){MailSubstatusEvents[_0xbaa7('0x3')](_0x1446b2+':'+_0x459ed9['id'],_0x459ed9);MailSubstatusEvents[_0xbaa7('0x3')](_0x1446b2,_0x459ed9);_0x53562a(null);};}for(var e in events){if(events[_0xbaa7('0x4')](e)){var event=events[e];MailSubstatus[_0xbaa7('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x21cd=['update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x164114,_0xd68cfa){var _0x161fee=function(_0x14d333){while(--_0x14d333){_0x164114['push'](_0x164114['shift']());}};_0x161fee(++_0xd68cfa);}(_0x21cd,0x88));var _0xd21c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x21cd[_0x4ff09b];return _0x3f5c2e;};'use strict';var EventEmitter=require(_0xd21c('0x0'));var MailSubstatus=require(_0xd21c('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xd21c('0x2')};function emitEvent(_0x49b372){return function(_0x448a31,_0x445c03,_0x26adaa){MailSubstatusEvents[_0xd21c('0x3')](_0x49b372+':'+_0x448a31['id'],_0x448a31);MailSubstatusEvents[_0xd21c('0x3')](_0x49b372,_0x448a31);_0x26adaa(null);};}for(var e in events){if(events[_0xd21c('0x4')](e)){var event=events[e];MailSubstatus[_0xd21c('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 738cf06..73d8064 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 _0x3787=['mail_substatuses','update','name','mailSubstatus','_previousDataValues','then','exports','models','define','MailSubstatus'];(function(_0x4b2c57,_0x2d8cd9){var _0x10ac0b=function(_0x48de8b){while(--_0x48de8b){_0x4b2c57['push'](_0x4b2c57['shift']());}};_0x10ac0b(++_0x2d8cd9);}(_0x3787,0x16e));var _0x7378=function(_0x13ea40,_0x2e9a64){_0x13ea40=_0x13ea40-0x0;var _0x2094ec=_0x3787[_0x13ea40];return _0x2094ec;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x7378('0x0')]=function(_0x5e4154){var _0x431a39=_0x5e4154[_0x7378('0x1')];return _0x5e4154[_0x7378('0x2')](_0x7378('0x3'),attributes,{'tableName':_0x7378('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x36fdf4,_0x40f933,_0x1b206e){return _0x431a39['Condition'][_0x7378('0x5')]({'value':_0x36fdf4[_0x7378('0x6')]},{'where':{'field':_0x7378('0x7'),'value':_0x36fdf4[_0x7378('0x8')][_0x7378('0x6')]}})[_0x7378('0x9')](function(){_0x1b206e();})['catch'](function(_0x1d4317){_0x1b206e(_0x1d4317);});}}});}; \ No newline at end of file +var _0x5272=['update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','MailSubstatus','mail_substatuses','Condition'];(function(_0x2e890d,_0x2993ce){var _0x46c591=function(_0x36285a){while(--_0x36285a){_0x2e890d['push'](_0x2e890d['shift']());}};_0x46c591(++_0x2993ce);}(_0x5272,0x14a));var _0x2527=function(_0x1ea8a5,_0x40a978){_0x1ea8a5=_0x1ea8a5-0x0;var _0x1f143d=_0x5272[_0x1ea8a5];return _0x1f143d;};'use strict';var attributes=require(_0x2527('0x0'));module[_0x2527('0x1')]=function(_0x4e55b5){var _0x53b031=_0x4e55b5[_0x2527('0x2')];return _0x4e55b5['define'](_0x2527('0x3'),attributes,{'tableName':_0x2527('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x43feab,_0x2ff9f3,_0x4526c7){return _0x53b031[_0x2527('0x5')][_0x2527('0x6')]({'value':_0x43feab[_0x2527('0x7')]},{'where':{'field':_0x2527('0x8'),'value':_0x43feab[_0x2527('0x9')][_0x2527('0x7')]}})[_0x2527('0xa')](function(){_0x4526c7();})[_0x2527('0xb')](function(_0x4b6680){_0x4526c7(_0x4b6680);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index eca4d20..2ce6f1d 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 _0xe918=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x7925b5,_0x1a1c23){var _0x280324=function(_0x22871f){while(--_0x22871f){_0x7925b5['push'](_0x7925b5['shift']());}};_0x280324(++_0x1a1c23);}(_0xe918,0x66));var _0x8e91=function(_0x3b58e2,_0x4fbf5f){_0x3b58e2=_0x3b58e2-0x0;var _0x5a6677=_0xe918[_0x3b58e2];return _0x5a6677;};'use strict';var _=require(_0x8e91('0x0'));var util=require(_0x8e91('0x1'));var moment=require(_0x8e91('0x2'));var BPromise=require(_0x8e91('0x3'));var rs=require(_0x8e91('0x4'));var fs=require('fs');var Redis=require(_0x8e91('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e91('0x6'));var config=require(_0x8e91('0x7'));var jayson=require(_0x8e91('0x8'));var client=jayson[_0x8e91('0x9')][_0x8e91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6d4b,_0xe34b53,_0x26c202){return new BPromise(function(_0x51dfde,_0x2d6fed){return client['request'](_0x4a6d4b,_0x26c202)[_0x8e91('0xb')](function(_0x3fa6d2){logger[_0x8e91('0xc')]('MailSubstatus,\x20%s,\x20%s',_0xe34b53,'request\x20sent');logger[_0x8e91('0xd')](_0x8e91('0xe'),_0xe34b53,'request\x20sent',JSON['stringify'](_0x3fa6d2));if(_0x3fa6d2['error']){if(_0x3fa6d2[_0x8e91('0xf')]['code']===0x1f4){logger['error'](_0x8e91('0x10'),_0xe34b53,_0x3fa6d2[_0x8e91('0xf')][_0x8e91('0x11')]);return _0x2d6fed(_0x3fa6d2[_0x8e91('0xf')][_0x8e91('0x11')]);}logger[_0x8e91('0xf')](_0x8e91('0x10'),_0xe34b53,_0x3fa6d2[_0x8e91('0xf')][_0x8e91('0x11')]);return _0x51dfde(_0x3fa6d2['error'][_0x8e91('0x11')]);}else{logger['info'](_0x8e91('0x10'),_0xe34b53,_0x8e91('0x12'));_0x51dfde(_0x3fa6d2[_0x8e91('0x13')][_0x8e91('0x11')]);}})[_0x8e91('0x14')](function(_0x45153e){logger[_0x8e91('0xf')]('MailSubstatus,\x20%s,\x20%s',_0xe34b53,_0x45153e);_0x2d6fed(_0x45153e);});});} \ No newline at end of file +var _0x7f70=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','code','error','result','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x49544f,_0x177ae9){var _0x25bbae=function(_0x2b12c6){while(--_0x2b12c6){_0x49544f['push'](_0x49544f['shift']());}};_0x25bbae(++_0x177ae9);}(_0x7f70,0x11d));var _0x07f7=function(_0x2d4cc0,_0xd2350){_0x2d4cc0=_0x2d4cc0-0x0;var _0x5d864a=_0x7f70[_0x2d4cc0];return _0x5d864a;};'use strict';var _=require(_0x07f7('0x0'));var util=require(_0x07f7('0x1'));var moment=require(_0x07f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x07f7('0x3'));var fs=require('fs');var Redis=require(_0x07f7('0x4'));var db=require(_0x07f7('0x5'))['db'];var utils=require(_0x07f7('0x6'));var logger=require(_0x07f7('0x7'))(_0x07f7('0x8'));var config=require('../../config/environment');var jayson=require(_0x07f7('0x9'));var client=jayson[_0x07f7('0xa')][_0x07f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x298842,_0x30aafd,_0x2415b4){return new BPromise(function(_0x5d9bdf,_0x31b69d){return client[_0x07f7('0xc')](_0x298842,_0x2415b4)['then'](function(_0x1b22ca){logger[_0x07f7('0xd')](_0x07f7('0xe'),_0x30aafd,_0x07f7('0xf'));logger[_0x07f7('0x10')](_0x07f7('0x11'),_0x30aafd,'request\x20sent',JSON['stringify'](_0x1b22ca));if(_0x1b22ca['error']){if(_0x1b22ca['error'][_0x07f7('0x12')]===0x1f4){logger[_0x07f7('0x13')](_0x07f7('0xe'),_0x30aafd,_0x1b22ca[_0x07f7('0x13')]['message']);return _0x31b69d(_0x1b22ca[_0x07f7('0x13')]['message']);}logger[_0x07f7('0x13')](_0x07f7('0xe'),_0x30aafd,_0x1b22ca[_0x07f7('0x13')]['message']);return _0x5d9bdf(_0x1b22ca['error']['message']);}else{logger[_0x07f7('0xd')](_0x07f7('0xe'),_0x30aafd,_0x07f7('0xf'));_0x5d9bdf(_0x1b22ca[_0x07f7('0x14')][_0x07f7('0x15')]);}})[_0x07f7('0x16')](function(_0x58200e){logger['error'](_0x07f7('0xe'),_0x30aafd,_0x58200e);_0x31b69d(_0x58200e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 76c4160..d2dc2cd 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 _0xad8d=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0xad8d,0x133));var _0xdad8=function(_0x389726,_0x282267){_0x389726=_0x389726-0x0;var _0x295a74=_0xad8d[_0x389726];return _0x295a74;};'use strict';var multer=require(_0xdad8('0x0'));var util=require(_0xdad8('0x1'));var path=require('path');var timeout=require(_0xdad8('0x2'));var express=require(_0xdad8('0x3'));var router=express[_0xdad8('0x4')]();var fs_extra=require(_0xdad8('0x5'));var auth=require(_0xdad8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdad8('0x7'));var controller=require(_0xdad8('0x8'));router[_0xdad8('0x9')]('/',auth[_0xdad8('0xa')](),controller['index']);router[_0xdad8('0x9')](_0xdad8('0xb'),auth[_0xdad8('0xa')](),controller[_0xdad8('0xc')]);router[_0xdad8('0x9')](_0xdad8('0xd'),auth['isAuthenticated'](),controller[_0xdad8('0xe')]);router[_0xdad8('0xf')]('/',auth[_0xdad8('0xa')](),controller[_0xdad8('0x10')]);router[_0xdad8('0x11')](_0xdad8('0xd'),auth[_0xdad8('0xa')](),controller[_0xdad8('0x12')]);router[_0xdad8('0x13')](_0xdad8('0xd'),auth[_0xdad8('0xa')](),controller[_0xdad8('0x14')]);module[_0xdad8('0x15')]=router; \ No newline at end of file +var _0x2f0e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','util','path','connect-timeout'];(function(_0xa5a68a,_0x5cb94f){var _0x3e7dd2=function(_0x17c6f8){while(--_0x17c6f8){_0xa5a68a['push'](_0xa5a68a['shift']());}};_0x3e7dd2(++_0x5cb94f);}(_0x2f0e,0x13d));var _0xe2f0=function(_0x2ee0e7,_0x16c90a){_0x2ee0e7=_0x2ee0e7-0x0;var _0x4e4296=_0x2f0e[_0x2ee0e7];return _0x4e4296;};'use strict';var multer=require('multer');var util=require(_0xe2f0('0x0'));var path=require(_0xe2f0('0x1'));var timeout=require(_0xe2f0('0x2'));var express=require(_0xe2f0('0x3'));var router=express[_0xe2f0('0x4')]();var fs_extra=require(_0xe2f0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2f0('0x6'));var config=require(_0xe2f0('0x7'));var controller=require(_0xe2f0('0x8'));router[_0xe2f0('0x9')]('/',auth[_0xe2f0('0xa')](),controller[_0xe2f0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe2f0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe2f0('0xc')]);router[_0xe2f0('0xd')]('/',auth[_0xe2f0('0xa')](),controller[_0xe2f0('0xe')]);router[_0xe2f0('0xf')](_0xe2f0('0x10'),auth[_0xe2f0('0xa')](),controller[_0xe2f0('0x11')]);router[_0xe2f0('0x12')](_0xe2f0('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xe2f0('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c45e4e9..42a30f4 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x5799c3,_0x21eb95){var _0x41d91a=function(_0x1b9bcf){while(--_0x1b9bcf){_0x5799c3['push'](_0x5799c3['shift']());}};_0x41d91a(++_0x21eb95);}(_0x4b84,0x1cc));var _0x44b8=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x4b84[_0x20cb20];return _0x2fcf4b;};'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 +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2262a7,_0x48f417){var _0x4d8132=function(_0x433e30){while(--_0x433e30){_0x2262a7['push'](_0x2262a7['shift']());}};_0x4d8132(++_0x48f417);}(_0xaa88,0x137));var _0x8aa8=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0xaa88[_0x5a27e8];return _0x4e38f7;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9073a96..afcb18e 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 _0xe514=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailTransferReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','includeAll','include','findAll','catch','show','params','merge','options','find','create','body','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x23b4b0,_0x19e0df){var _0x438704=function(_0x384669){while(--_0x384669){_0x23b4b0['push'](_0x23b4b0['shift']());}};_0x438704(++_0x19e0df);}(_0xe514,0x1d0));var _0x4e51=function(_0x3ea41b,_0x1253f1){_0x3ea41b=_0x3ea41b-0x0;var _0x3a0eb2=_0xe514[_0x3ea41b];return _0x3a0eb2;};'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(_0x4e51('0x0'));var moment=require('moment');var BPromise=require(_0x4e51('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e51('0x2'));var sox=require(_0x4e51('0x3'));var csv=require('to-csv');var ejs=require(_0x4e51('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e51('0x5'));var squel=require(_0x4e51('0x6'));var crypto=require(_0x4e51('0x7'));var jsforce=require(_0x4e51('0x8'));var deskjs=require(_0x4e51('0x9'));var toCsv=require('to-csv');var querystring=require(_0x4e51('0xa'));var Papa=require(_0x4e51('0xb'));var Redis=require('ioredis');var authService=require(_0x4e51('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x4e51('0xd'));var hardwareService=require(_0x4e51('0xe'));var logger=require(_0x4e51('0xf'))('api');var utils=require(_0x4e51('0x10'));var config=require(_0x4e51('0x11'));var licenseUtil=require(_0x4e51('0x12'));var db=require(_0x4e51('0x13'))['db'];function respondWithStatusCode(_0x52e69a,_0x2c55a9){_0x2c55a9=_0x2c55a9||0xcc;return function(_0x3b8a70){if(_0x3b8a70){return _0x52e69a[_0x4e51('0x14')](_0x2c55a9);}return _0x52e69a[_0x4e51('0x15')](_0x2c55a9)['end']();};}function respondWithResult(_0x19ecbc,_0x580a8d){_0x580a8d=_0x580a8d||0xc8;return function(_0x116dca){if(_0x116dca){return _0x19ecbc[_0x4e51('0x15')](_0x580a8d)[_0x4e51('0x16')](_0x116dca);}};}function respondWithFilteredResult(_0x2bda55,_0x3efb39){return function(_0x4d4264){if(_0x4d4264){var _0x17e9c8=typeof _0x3efb39[_0x4e51('0x17')]===_0x4e51('0x18')&&typeof _0x3efb39[_0x4e51('0x19')]===_0x4e51('0x18');var _0x5aedac=_0x4d4264[_0x4e51('0x1a')];var _0x597a28=_0x17e9c8?0x0:_0x3efb39['offset'];var _0x1a2d84=_0x17e9c8?_0x4d4264['count']:_0x3efb39['offset']+_0x3efb39[_0x4e51('0x19')];var _0xa44b11;if(_0x1a2d84>=_0x5aedac){_0x1a2d84=_0x5aedac;_0xa44b11=0xc8;}else{_0xa44b11=0xce;}_0x2bda55[_0x4e51('0x15')](_0xa44b11);return _0x2bda55['set'](_0x4e51('0x1b'),_0x597a28+'-'+_0x1a2d84+'/'+_0x5aedac)[_0x4e51('0x16')](_0x4d4264);}return null;};}function patchUpdates(_0x495d3){return function(_0x1140cf){try{jsonpatch[_0x4e51('0x1c')](_0x1140cf,_0x495d3,!![]);}catch(_0x2a3256){return BPromise[_0x4e51('0x1d')](_0x2a3256);}return _0x1140cf[_0x4e51('0x1e')]();};}function saveUpdates(_0x4ae96e,_0x1db72e){return function(_0x180e27){if(_0x180e27){return _0x180e27[_0x4e51('0x1f')](_0x4ae96e)[_0x4e51('0x20')](function(_0x3e4ff2){return _0x3e4ff2;});}return null;};}function removeEntity(_0x2880b0,_0x31d717){return function(_0x5945d8){if(_0x5945d8){return _0x5945d8[_0x4e51('0x21')]()['then'](function(){_0x2880b0[_0x4e51('0x15')](0xcc)[_0x4e51('0x22')]();});}};}function handleEntityNotFound(_0x3cf47c,_0x2e5fb6){return function(_0x19e354){if(!_0x19e354){_0x3cf47c[_0x4e51('0x14')](0x194);}return _0x19e354;};}function handleError(_0x37ed10,_0x2f55d2){_0x2f55d2=_0x2f55d2||0x1f4;return function(_0x478559){logger[_0x4e51('0x23')](_0x478559[_0x4e51('0x24')]);if(_0x478559[_0x4e51('0x25')]){delete _0x478559['name'];}_0x37ed10['status'](_0x2f55d2)[_0x4e51('0x26')](_0x478559);};}exports['index']=function(_0x47e525,_0x1e3fcd){var _0x3f790f={},_0x4fd169={},_0x1c6222={'count':0x0,'rows':[]};var _0x1fb86b=_[_0x4e51('0x27')](db[_0x4e51('0x28')][_0x4e51('0x29')],function(_0x57a76a){return{'name':_0x57a76a['fieldName'],'type':_0x57a76a[_0x4e51('0x2a')]['key']};});_0x4fd169[_0x4e51('0x2b')]=_[_0x4e51('0x27')](_0x1fb86b,_0x4e51('0x25'));_0x4fd169[_0x4e51('0x2c')]=_[_0x4e51('0x2d')](_0x47e525[_0x4e51('0x2c')]);_0x4fd169[_0x4e51('0x2e')]=_[_0x4e51('0x2f')](_0x4fd169[_0x4e51('0x2b')],_0x4fd169['query']);_0x3f790f['attributes']=_[_0x4e51('0x2f')](_0x4fd169[_0x4e51('0x2b')],qs[_0x4e51('0x30')](_0x47e525[_0x4e51('0x2c')][_0x4e51('0x30')]));_0x3f790f[_0x4e51('0x31')]=_0x3f790f['attributes'][_0x4e51('0x32')]?_0x3f790f[_0x4e51('0x31')]:_0x4fd169[_0x4e51('0x2b')];if(!_0x47e525[_0x4e51('0x2c')][_0x4e51('0x33')]('nolimit')){_0x3f790f[_0x4e51('0x19')]=qs['limit'](_0x47e525[_0x4e51('0x2c')][_0x4e51('0x19')]);_0x3f790f[_0x4e51('0x17')]=qs[_0x4e51('0x17')](_0x47e525[_0x4e51('0x2c')]['offset']);}_0x3f790f[_0x4e51('0x34')]=qs['sort'](_0x47e525['query'][_0x4e51('0x35')]);_0x3f790f[_0x4e51('0x36')]=qs[_0x4e51('0x2e')](_[_0x4e51('0x37')](_0x47e525[_0x4e51('0x2c')],_0x4fd169['filters']),_0x1fb86b);if(_0x47e525[_0x4e51('0x2c')][_0x4e51('0x38')]){_0x3f790f[_0x4e51('0x36')]=_['merge'](_0x3f790f[_0x4e51('0x36')],{'$or':_[_0x4e51('0x27')](_0x1fb86b,function(_0x7b2da2){if(_0x7b2da2[_0x4e51('0x2a')]!=='VIRTUAL'){var _0x4646eb={};_0x4646eb[_0x7b2da2[_0x4e51('0x25')]]={'$like':'%'+_0x47e525[_0x4e51('0x2c')][_0x4e51('0x38')]+'%'};return _0x4646eb;}})});}_0x3f790f=_['merge']({},_0x3f790f,_0x47e525['options']);var _0x5f8ce2={'where':_0x3f790f['where']};return db[_0x4e51('0x28')][_0x4e51('0x1a')](_0x5f8ce2)['then'](function(_0x38b1eb){_0x1c6222['count']=_0x38b1eb;if(_0x47e525[_0x4e51('0x2c')][_0x4e51('0x39')]){_0x3f790f[_0x4e51('0x3a')]=[{'all':!![]}];}return db[_0x4e51('0x28')][_0x4e51('0x3b')](_0x3f790f);})[_0x4e51('0x20')](function(_0x18698f){_0x1c6222['rows']=_0x18698f;return _0x1c6222;})[_0x4e51('0x20')](respondWithFilteredResult(_0x1e3fcd,_0x3f790f))[_0x4e51('0x3c')](handleError(_0x1e3fcd,null));};exports[_0x4e51('0x3d')]=function(_0xb5a0fd,_0x50bbdb){var _0x3c1db7={'raw':!![],'where':{'id':_0xb5a0fd[_0x4e51('0x3e')]['id']}},_0x2c03d8={};_0x2c03d8[_0x4e51('0x2b')]=_[_0x4e51('0x2d')](db[_0x4e51('0x28')][_0x4e51('0x29')]);_0x2c03d8['query']=_['keys'](_0xb5a0fd[_0x4e51('0x2c')]);_0x2c03d8[_0x4e51('0x2e')]=_[_0x4e51('0x2f')](_0x2c03d8[_0x4e51('0x2b')],_0x2c03d8[_0x4e51('0x2c')]);_0x3c1db7[_0x4e51('0x31')]=_[_0x4e51('0x2f')](_0x2c03d8[_0x4e51('0x2b')],qs[_0x4e51('0x30')](_0xb5a0fd[_0x4e51('0x2c')][_0x4e51('0x30')]));_0x3c1db7['attributes']=_0x3c1db7['attributes'][_0x4e51('0x32')]?_0x3c1db7[_0x4e51('0x31')]:_0x2c03d8['model'];if(_0xb5a0fd[_0x4e51('0x2c')][_0x4e51('0x39')]){_0x3c1db7[_0x4e51('0x3a')]=[{'all':!![]}];}_0x3c1db7=_[_0x4e51('0x3f')]({},_0x3c1db7,_0xb5a0fd[_0x4e51('0x40')]);return db[_0x4e51('0x28')][_0x4e51('0x41')](_0x3c1db7)[_0x4e51('0x20')](handleEntityNotFound(_0x50bbdb,null))[_0x4e51('0x20')](respondWithResult(_0x50bbdb,null))['catch'](handleError(_0x50bbdb,null));};exports['create']=function(_0x358640,_0xbda79a){return db[_0x4e51('0x28')][_0x4e51('0x42')](_0x358640[_0x4e51('0x43')],{})[_0x4e51('0x20')](respondWithResult(_0xbda79a,0xc9))[_0x4e51('0x3c')](handleError(_0xbda79a,null));};exports[_0x4e51('0x1f')]=function(_0x4c0eec,_0x1b5c32){if(_0x4c0eec[_0x4e51('0x43')]['id']){delete _0x4c0eec[_0x4e51('0x43')]['id'];}return db[_0x4e51('0x28')][_0x4e51('0x41')]({'where':{'id':_0x4c0eec['params']['id']}})[_0x4e51('0x20')](handleEntityNotFound(_0x1b5c32,null))[_0x4e51('0x20')](saveUpdates(_0x4c0eec[_0x4e51('0x43')],null))['then'](respondWithResult(_0x1b5c32,null))[_0x4e51('0x3c')](handleError(_0x1b5c32,null));};exports[_0x4e51('0x21')]=function(_0x582e7b,_0x17c6a5){return db[_0x4e51('0x28')][_0x4e51('0x41')]({'where':{'id':_0x582e7b[_0x4e51('0x3e')]['id']}})['then'](handleEntityNotFound(_0x17c6a5,null))['then'](removeEntity(_0x17c6a5,null))[_0x4e51('0x3c')](handleError(_0x17c6a5,null));};exports['describe']=function(_0x20ef37,_0x28acf8){return db[_0x4e51('0x28')]['describe']()[_0x4e51('0x20')](respondWithResult(_0x28acf8,null))[_0x4e51('0x3c')](handleError(_0x28acf8,null));}; \ No newline at end of file +var _0x1ffb=['includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','map','MailTransferReport','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','findAll','catch','params','rawAttributes','intersection'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x1ffb,0x1a9));var _0xb1ff=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x1ffb[_0x2650e9];return _0x3511c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1ff('0x0'));var zipdir=require(_0xb1ff('0x1'));var jsonpatch=require(_0xb1ff('0x2'));var rp=require(_0xb1ff('0x3'));var moment=require(_0xb1ff('0x4'));var BPromise=require(_0xb1ff('0x5'));var Mustache=require(_0xb1ff('0x6'));var util=require(_0xb1ff('0x7'));var path=require(_0xb1ff('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb1ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1ff('0xa'));var squel=require('squel');var crypto=require(_0xb1ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb1ff('0xc'));var toCsv=require(_0xb1ff('0xd'));var querystring=require(_0xb1ff('0xe'));var Papa=require(_0xb1ff('0xf'));var Redis=require(_0xb1ff('0x10'));var authService=require(_0xb1ff('0x11'));var qs=require(_0xb1ff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1ff('0x13'))('api');var utils=require(_0xb1ff('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb1ff('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd5fa3d,_0x234583){_0x234583=_0x234583||0xcc;return function(_0x521be6){if(_0x521be6){return _0xd5fa3d['sendStatus'](_0x234583);}return _0xd5fa3d[_0xb1ff('0x16')](_0x234583)['end']();};}function respondWithResult(_0x3c80f0,_0xf6e7f6){_0xf6e7f6=_0xf6e7f6||0xc8;return function(_0x37ad7d){if(_0x37ad7d){return _0x3c80f0[_0xb1ff('0x16')](_0xf6e7f6)[_0xb1ff('0x17')](_0x37ad7d);}};}function respondWithFilteredResult(_0x3c8f8b,_0x466fe5){return function(_0x3afc8b){if(_0x3afc8b){var _0x539eaf=typeof _0x466fe5[_0xb1ff('0x18')]===_0xb1ff('0x19')&&typeof _0x466fe5[_0xb1ff('0x1a')]===_0xb1ff('0x19');var _0x8b90a4=_0x3afc8b[_0xb1ff('0x1b')];var _0x555dc8=_0x539eaf?0x0:_0x466fe5[_0xb1ff('0x18')];var _0x46888c=_0x539eaf?_0x3afc8b[_0xb1ff('0x1b')]:_0x466fe5['offset']+_0x466fe5[_0xb1ff('0x1a')];var _0x46bae9;if(_0x46888c>=_0x8b90a4){_0x46888c=_0x8b90a4;_0x46bae9=0xc8;}else{_0x46bae9=0xce;}_0x3c8f8b['status'](_0x46bae9);return _0x3c8f8b[_0xb1ff('0x1c')](_0xb1ff('0x1d'),_0x555dc8+'-'+_0x46888c+'/'+_0x8b90a4)[_0xb1ff('0x17')](_0x3afc8b);}return null;};}function patchUpdates(_0x11b65c){return function(_0x212a1d){try{jsonpatch[_0xb1ff('0x1e')](_0x212a1d,_0x11b65c,!![]);}catch(_0x185a85){return BPromise[_0xb1ff('0x1f')](_0x185a85);}return _0x212a1d['save']();};}function saveUpdates(_0x175d74,_0x862c8e){return function(_0x5e5cdc){if(_0x5e5cdc){return _0x5e5cdc[_0xb1ff('0x20')](_0x175d74)[_0xb1ff('0x21')](function(_0x513209){return _0x513209;});}return null;};}function removeEntity(_0x3e5c2e,_0x578852){return function(_0x5c79d3){if(_0x5c79d3){return _0x5c79d3[_0xb1ff('0x22')]()['then'](function(){_0x3e5c2e[_0xb1ff('0x16')](0xcc)[_0xb1ff('0x23')]();});}};}function handleEntityNotFound(_0x381c34,_0x48187b){return function(_0x36b0ee){if(!_0x36b0ee){_0x381c34[_0xb1ff('0x24')](0x194);}return _0x36b0ee;};}function handleError(_0x16855c,_0x6d9115){_0x6d9115=_0x6d9115||0x1f4;return function(_0x27e1dd){logger[_0xb1ff('0x25')](_0x27e1dd[_0xb1ff('0x26')]);if(_0x27e1dd[_0xb1ff('0x27')]){delete _0x27e1dd[_0xb1ff('0x27')];}_0x16855c[_0xb1ff('0x16')](_0x6d9115)[_0xb1ff('0x28')](_0x27e1dd);};}exports['index']=function(_0x593c8b,_0x48b10b){var _0x632644={},_0x2a34e0={},_0x5ce018={'count':0x0,'rows':[]};var _0x22f648=_[_0xb1ff('0x29')](db[_0xb1ff('0x2a')]['rawAttributes'],function(_0x335b1e){return{'name':_0x335b1e['fieldName'],'type':_0x335b1e[_0xb1ff('0x2b')]['key']};});_0x2a34e0[_0xb1ff('0x2c')]=_[_0xb1ff('0x29')](_0x22f648,_0xb1ff('0x27'));_0x2a34e0[_0xb1ff('0x2d')]=_[_0xb1ff('0x2e')](_0x593c8b[_0xb1ff('0x2d')]);_0x2a34e0['filters']=_['intersection'](_0x2a34e0[_0xb1ff('0x2c')],_0x2a34e0[_0xb1ff('0x2d')]);_0x632644[_0xb1ff('0x2f')]=_['intersection'](_0x2a34e0['model'],qs[_0xb1ff('0x30')](_0x593c8b[_0xb1ff('0x2d')][_0xb1ff('0x30')]));_0x632644[_0xb1ff('0x2f')]=_0x632644[_0xb1ff('0x2f')][_0xb1ff('0x31')]?_0x632644['attributes']:_0x2a34e0[_0xb1ff('0x2c')];if(!_0x593c8b['query'][_0xb1ff('0x32')](_0xb1ff('0x33'))){_0x632644[_0xb1ff('0x1a')]=qs['limit'](_0x593c8b['query'][_0xb1ff('0x1a')]);_0x632644[_0xb1ff('0x18')]=qs[_0xb1ff('0x18')](_0x593c8b[_0xb1ff('0x2d')]['offset']);}_0x632644[_0xb1ff('0x34')]=qs[_0xb1ff('0x35')](_0x593c8b['query'][_0xb1ff('0x35')]);_0x632644[_0xb1ff('0x36')]=qs[_0xb1ff('0x37')](_['pick'](_0x593c8b[_0xb1ff('0x2d')],_0x2a34e0[_0xb1ff('0x37')]),_0x22f648);if(_0x593c8b[_0xb1ff('0x2d')]['filter']){_0x632644[_0xb1ff('0x36')]=_[_0xb1ff('0x38')](_0x632644[_0xb1ff('0x36')],{'$or':_[_0xb1ff('0x29')](_0x22f648,function(_0x26020f){if(_0x26020f[_0xb1ff('0x2b')]!==_0xb1ff('0x39')){var _0x352847={};_0x352847[_0x26020f['name']]={'$like':'%'+_0x593c8b[_0xb1ff('0x2d')][_0xb1ff('0x3a')]+'%'};return _0x352847;}})});}_0x632644=_[_0xb1ff('0x38')]({},_0x632644,_0x593c8b[_0xb1ff('0x3b')]);var _0x2788d8={'where':_0x632644[_0xb1ff('0x36')]};return db[_0xb1ff('0x2a')][_0xb1ff('0x1b')](_0x2788d8)[_0xb1ff('0x21')](function(_0x5d1287){_0x5ce018[_0xb1ff('0x1b')]=_0x5d1287;if(_0x593c8b[_0xb1ff('0x2d')]['includeAll']){_0x632644['include']=[{'all':!![]}];}return db[_0xb1ff('0x2a')][_0xb1ff('0x3c')](_0x632644);})['then'](function(_0x44ac84){_0x5ce018['rows']=_0x44ac84;return _0x5ce018;})[_0xb1ff('0x21')](respondWithFilteredResult(_0x48b10b,_0x632644))[_0xb1ff('0x3d')](handleError(_0x48b10b,null));};exports['show']=function(_0x4234e3,_0x51b757){var _0x30f958={'raw':!![],'where':{'id':_0x4234e3[_0xb1ff('0x3e')]['id']}},_0x14d1fa={};_0x14d1fa[_0xb1ff('0x2c')]=_[_0xb1ff('0x2e')](db[_0xb1ff('0x2a')][_0xb1ff('0x3f')]);_0x14d1fa[_0xb1ff('0x2d')]=_[_0xb1ff('0x2e')](_0x4234e3[_0xb1ff('0x2d')]);_0x14d1fa[_0xb1ff('0x37')]=_[_0xb1ff('0x40')](_0x14d1fa['model'],_0x14d1fa[_0xb1ff('0x2d')]);_0x30f958[_0xb1ff('0x2f')]=_[_0xb1ff('0x40')](_0x14d1fa[_0xb1ff('0x2c')],qs[_0xb1ff('0x30')](_0x4234e3['query'][_0xb1ff('0x30')]));_0x30f958['attributes']=_0x30f958[_0xb1ff('0x2f')][_0xb1ff('0x31')]?_0x30f958[_0xb1ff('0x2f')]:_0x14d1fa[_0xb1ff('0x2c')];if(_0x4234e3[_0xb1ff('0x2d')][_0xb1ff('0x41')]){_0x30f958['include']=[{'all':!![]}];}_0x30f958=_[_0xb1ff('0x38')]({},_0x30f958,_0x4234e3[_0xb1ff('0x3b')]);return db[_0xb1ff('0x2a')][_0xb1ff('0x42')](_0x30f958)[_0xb1ff('0x21')](handleEntityNotFound(_0x51b757,null))[_0xb1ff('0x21')](respondWithResult(_0x51b757,null))['catch'](handleError(_0x51b757,null));};exports[_0xb1ff('0x43')]=function(_0x48824d,_0x59fc58){return db[_0xb1ff('0x2a')][_0xb1ff('0x43')](_0x48824d[_0xb1ff('0x44')],{})[_0xb1ff('0x21')](respondWithResult(_0x59fc58,0xc9))[_0xb1ff('0x3d')](handleError(_0x59fc58,null));};exports[_0xb1ff('0x20')]=function(_0x5c6a80,_0xe157be){if(_0x5c6a80[_0xb1ff('0x44')]['id']){delete _0x5c6a80[_0xb1ff('0x44')]['id'];}return db[_0xb1ff('0x2a')][_0xb1ff('0x42')]({'where':{'id':_0x5c6a80['params']['id']}})[_0xb1ff('0x21')](handleEntityNotFound(_0xe157be,null))['then'](saveUpdates(_0x5c6a80[_0xb1ff('0x44')],null))[_0xb1ff('0x21')](respondWithResult(_0xe157be,null))[_0xb1ff('0x3d')](handleError(_0xe157be,null));};exports[_0xb1ff('0x22')]=function(_0x54e516,_0x483226){return db[_0xb1ff('0x2a')][_0xb1ff('0x42')]({'where':{'id':_0x54e516[_0xb1ff('0x3e')]['id']}})[_0xb1ff('0x21')](handleEntityNotFound(_0x483226,null))[_0xb1ff('0x21')](removeEntity(_0x483226,null))[_0xb1ff('0x3d')](handleError(_0x483226,null));};exports[_0xb1ff('0x45')]=function(_0x1399c6,_0x306910){return db[_0xb1ff('0x2a')][_0xb1ff('0x45')]()['then'](respondWithResult(_0x306910,null))[_0xb1ff('0x3d')](handleError(_0x306910,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7b64af2..b5dbcda 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 _0x3c7b=['util','../../config/logger','api','moment','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x2a5aa4,_0x380e6b){_0x2a5aa4=_0x2a5aa4-0x0;var _0x41ccc7=_0x3c7b[_0x2a5aa4];return _0x41ccc7;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'paranoid':![],'indexes':[{'name':_0xb3c7('0xa'),'fields':[_0xb3c7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcc7=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x38250f,_0xa18e96){var _0x425808=function(_0x23a11a){while(--_0x23a11a){_0x38250f['push'](_0x38250f['shift']());}};_0x425808(++_0xa18e96);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x5a8ddc,_0x50b491){_0x5a8ddc=_0x5a8ddc-0x0;var _0x40ad8f=_0xbcc7[_0x5a8ddc];return _0x40ad8f;};'use strict';var _=require(_0x7bcc('0x0'));var util=require(_0x7bcc('0x1'));var logger=require('../../config/logger')(_0x7bcc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7bcc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bcc('0x4'));var config=require(_0x7bcc('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0x7bcc('0x6')]=function(_0x24ff05,_0x82b2e1){return _0x24ff05[_0x7bcc('0x7')](_0x7bcc('0x8'),attributes,{'tableName':_0x7bcc('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7bcc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 6371bce..5ed3b0b 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 _0xdc1f=['jayson/promise','client','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d4484,_0x35285e){var _0x5730b5=function(_0x1cbfc4){while(--_0x1cbfc4){_0x5d4484['push'](_0x5d4484['shift']());}};_0x5730b5(++_0x35285e);}(_0xdc1f,0x1c4));var _0xfdc1=function(_0x6e9388,_0x1417ca){_0x6e9388=_0x6e9388-0x0;var _0x28dd64=_0xdc1f[_0x6e9388];return _0x28dd64;};'use strict';var _=require(_0xfdc1('0x0'));var util=require(_0xfdc1('0x1'));var moment=require(_0xfdc1('0x2'));var BPromise=require(_0xfdc1('0x3'));var rs=require(_0xfdc1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdc1('0x5'))['db'];var utils=require(_0xfdc1('0x6'));var logger=require(_0xfdc1('0x7'))(_0xfdc1('0x8'));var config=require(_0xfdc1('0x9'));var jayson=require(_0xfdc1('0xa'));var client=jayson[_0xfdc1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546e98,_0x81806a,_0xe1be0c){return new BPromise(function(_0xace832,_0x2864e8){return client[_0xfdc1('0xc')](_0x546e98,_0xe1be0c)['then'](function(_0x4c2ad5){logger[_0xfdc1('0xd')](_0xfdc1('0xe'),_0x81806a,_0xfdc1('0xf'));logger['debug'](_0xfdc1('0x10'),_0x81806a,'request\x20sent',JSON[_0xfdc1('0x11')](_0x4c2ad5));if(_0x4c2ad5['error']){if(_0x4c2ad5[_0xfdc1('0x12')][_0xfdc1('0x13')]===0x1f4){logger[_0xfdc1('0x12')](_0xfdc1('0xe'),_0x81806a,_0x4c2ad5[_0xfdc1('0x12')][_0xfdc1('0x14')]);return _0x2864e8(_0x4c2ad5[_0xfdc1('0x12')][_0xfdc1('0x14')]);}logger[_0xfdc1('0x12')](_0xfdc1('0xe'),_0x81806a,_0x4c2ad5[_0xfdc1('0x12')][_0xfdc1('0x14')]);return _0xace832(_0x4c2ad5['error'][_0xfdc1('0x14')]);}else{logger[_0xfdc1('0xd')](_0xfdc1('0xe'),_0x81806a,_0xfdc1('0xf'));_0xace832(_0x4c2ad5['result'][_0xfdc1('0x14')]);}})[_0xfdc1('0x15')](function(_0x41fe80){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x81806a,_0x41fe80);_0x2864e8(_0x41fe80);});});} \ No newline at end of file +var _0x60ed=['error','code','message','MailTransferReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3db17b,_0x154758){var _0x40035f=function(_0x58853c){while(--_0x58853c){_0x3db17b['push'](_0x3db17b['shift']());}};_0x40035f(++_0x154758);}(_0x60ed,0xff));var _0xd60e=function(_0x2fa024,_0x48d23f){_0x2fa024=_0x2fa024-0x0;var _0x4eab96=_0x60ed[_0x2fa024];return _0x4eab96;};'use strict';var _=require(_0xd60e('0x0'));var util=require(_0xd60e('0x1'));var moment=require(_0xd60e('0x2'));var BPromise=require(_0xd60e('0x3'));var rs=require(_0xd60e('0x4'));var fs=require('fs');var Redis=require(_0xd60e('0x5'));var db=require(_0xd60e('0x6'))['db'];var utils=require(_0xd60e('0x7'));var logger=require(_0xd60e('0x8'))(_0xd60e('0x9'));var config=require(_0xd60e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd60e('0xb')][_0xd60e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1aa21a,_0x2a8029,_0x340325){return new BPromise(function(_0x49381c,_0x77b62d){return client[_0xd60e('0xd')](_0x1aa21a,_0x340325)[_0xd60e('0xe')](function(_0x3db4a6){logger[_0xd60e('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x2a8029,_0xd60e('0x10'));logger[_0xd60e('0x11')](_0xd60e('0x12'),_0x2a8029,_0xd60e('0x10'),JSON[_0xd60e('0x13')](_0x3db4a6));if(_0x3db4a6[_0xd60e('0x14')]){if(_0x3db4a6[_0xd60e('0x14')][_0xd60e('0x15')]===0x1f4){logger[_0xd60e('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x2a8029,_0x3db4a6[_0xd60e('0x14')][_0xd60e('0x16')]);return _0x77b62d(_0x3db4a6[_0xd60e('0x14')]['message']);}logger['error'](_0xd60e('0x17'),_0x2a8029,_0x3db4a6[_0xd60e('0x14')]['message']);return _0x49381c(_0x3db4a6[_0xd60e('0x14')][_0xd60e('0x16')]);}else{logger[_0xd60e('0xf')](_0xd60e('0x17'),_0x2a8029,_0xd60e('0x10'));_0x49381c(_0x3db4a6[_0xd60e('0x18')][_0xd60e('0x16')]);}})['catch'](function(_0xc922d4){logger['error'](_0xd60e('0x17'),_0x2a8029,_0xc922d4);_0x77b62d(_0xc922d4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2d3d611..81272a2 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 _0xc190=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','show','create','put'];(function(_0x2cad1d,_0x95a8c7){var _0x4a900c=function(_0x4e5a6e){while(--_0x4e5a6e){_0x2cad1d['push'](_0x2cad1d['shift']());}};_0x4a900c(++_0x95a8c7);}(_0xc190,0x194));var _0x0c19=function(_0x2712e0,_0x5cdfc9){_0x2712e0=_0x2712e0-0x0;var _0x31d907=_0xc190[_0x2712e0];return _0x31d907;};'use strict';var multer=require(_0x0c19('0x0'));var util=require('util');var path=require(_0x0c19('0x1'));var timeout=require(_0x0c19('0x2'));var express=require(_0x0c19('0x3'));var router=express[_0x0c19('0x4')]();var fs_extra=require(_0x0c19('0x5'));var auth=require(_0x0c19('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c19('0x7'));var controller=require(_0x0c19('0x8'));router[_0x0c19('0x9')]('/',auth[_0x0c19('0xa')](),controller['index']);router[_0x0c19('0x9')](_0x0c19('0xb'),auth['isAuthenticated'](),controller[_0x0c19('0xc')]);router['get']('/:id',auth[_0x0c19('0xa')](),controller[_0x0c19('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0c19('0xe')]);router[_0x0c19('0xf')](_0x0c19('0x10'),auth[_0x0c19('0xa')](),controller[_0x0c19('0x11')]);router[_0x0c19('0x12')](_0x0c19('0x10'),auth[_0x0c19('0xa')](),controller[_0x0c19('0x13')]);module[_0x0c19('0x14')]=router; \ No newline at end of file +var _0xd709=['/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','isAuthenticated','show','post','create','put','update'];(function(_0x2b42bf,_0x2f1463){var _0x23c423=function(_0x464e69){while(--_0x464e69){_0x2b42bf['push'](_0x2b42bf['shift']());}};_0x23c423(++_0x2f1463);}(_0xd709,0x193));var _0x9d70=function(_0x43ccc0,_0x40a6b7){_0x43ccc0=_0x43ccc0-0x0;var _0x2e2a7c=_0xd709[_0x43ccc0];return _0x2e2a7c;};'use strict';var multer=require(_0x9d70('0x0'));var util=require(_0x9d70('0x1'));var path=require(_0x9d70('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d70('0x3'));var router=express[_0x9d70('0x4')]();var fs_extra=require(_0x9d70('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9d70('0x6'));var config=require(_0x9d70('0x7'));var controller=require(_0x9d70('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d70('0x9')]);router[_0x9d70('0xa')]('/describe',auth[_0x9d70('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9d70('0xc')]);router[_0x9d70('0xd')]('/',auth['isAuthenticated'](),controller[_0x9d70('0xe')]);router[_0x9d70('0xf')]('/:id',auth[_0x9d70('0xb')](),controller[_0x9d70('0x10')]);router['delete'](_0x9d70('0x11'),auth[_0x9d70('0xb')](),controller[_0x9d70('0x12')]);module[_0x9d70('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 fdcfa10..a2c6fd1 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 _0x78ce=['diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x11617b,_0x508624){var _0xa7239b=function(_0x45966f){while(--_0x45966f){_0x11617b['push'](_0x11617b['shift']());}};_0xa7239b(++_0x508624);}(_0x78ce,0xa0));var _0xe78c=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x78ce[_0x503ffd];return _0x160437;};'use strict';var Sequelize=require(_0xe78c('0x0'));var moment=require(_0xe78c('0x1'));module[_0xe78c('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe78c('0x3')]},'interface':{'type':Sequelize[_0xe78c('0x3')]},'type':{'type':Sequelize[_0xe78c('0x3')],'defaultValue':_0xe78c('0x4'),'comment':_0xe78c('0x5')},'duration':{'type':Sequelize[_0xe78c('0x6')]},'enterAt':{'type':Sequelize[_0xe78c('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x235b0d){var _0x1667e5=moment(_0x235b0d);var _0x118ac4=moment(this['getDataValue']('enterAt'));var _0x56c00b=_0x1667e5[_0xe78c('0x8')](_0x118ac4,_0xe78c('0x9'));this[_0xe78c('0xa')]('exitAt',_0x235b0d);this[_0xe78c('0xa')](_0xe78c('0xb'),_0x56c00b>=0x0?_0x56c00b:null);}},'data1':{'type':Sequelize[_0xe78c('0x3')],'comment':_0xe78c('0xc')},'data2':{'type':Sequelize[_0xe78c('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xe78c('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe78c('0x3')],'comment':_0xe78c('0xd')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc3c=['DATE','getDataValue','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x581211,_0x473c7f){var _0xfe4e6=function(_0x112605){while(--_0x112605){_0x581211['push'](_0x581211['shift']());}};_0xfe4e6(++_0x473c7f);}(_0xfc3c,0xbe));var _0xcfc3=function(_0x2c16ab,_0xaa3f47){_0x2c16ab=_0x2c16ab-0x0;var _0x50d50c=_0xfc3c[_0x2c16ab];return _0x50d50c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcfc3('0x0'));module[_0xcfc3('0x1')]={'channel':{'type':Sequelize[_0xcfc3('0x2')]},'membername':{'type':Sequelize[_0xcfc3('0x2')]},'interface':{'type':Sequelize[_0xcfc3('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xcfc3('0x3'),'comment':_0xcfc3('0x4')},'duration':{'type':Sequelize[_0xcfc3('0x5')]},'enterAt':{'type':Sequelize[_0xcfc3('0x6')]},'exitAt':{'type':Sequelize[_0xcfc3('0x6')],'set':function(_0x613d46){var _0x308c86=moment(_0x613d46);var _0x29d029=moment(this[_0xcfc3('0x7')]('enterAt'));var _0x23e317=_0x308c86['diff'](_0x29d029,_0xcfc3('0x8'));this[_0xcfc3('0x9')](_0xcfc3('0xa'),_0x613d46);this[_0xcfc3('0x9')]('duration',_0x23e317>=0x0?_0x23e317:null);}},'data1':{'type':Sequelize[_0xcfc3('0x2')],'comment':_0xcfc3('0xb')},'data2':{'type':Sequelize[_0xcfc3('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xcfc3('0x2')],'comment':_0xcfc3('0xc')},'data4':{'type':Sequelize[_0xcfc3('0x2')],'comment':_0xcfc3('0xd')},'data5':{'type':Sequelize[_0xcfc3('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xcfc3('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 812844e..6a26abd 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x55ca,0x126));var _0xa55c=function(_0x99692,_0x32528e){_0x99692=_0x99692-0x0;var _0xe5fbb4=_0x55ca[_0x99692];return _0xe5fbb4;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x55ca,0x126));var _0xa55c=function(_0x1bcc92,_0x4929b8){_0x1bcc92=_0x1bcc92-0x0;var _0x88406a=_0x55ca[_0x1bcc92];return _0x88406a;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 0862695..d6775ea 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 _0xcd3a=['../../config/environment','exports','define','MemberReport','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xcd3a,0x8e));var _0xacd3=function(_0x188fd8,_0x4b5c2e){_0x188fd8=_0x188fd8-0x0;var _0x22999d=_0xcd3a[_0x188fd8];return _0x22999d;};'use strict';var _=require('lodash');var util=require(_0xacd3('0x0'));var logger=require(_0xacd3('0x1'))(_0xacd3('0x2'));var moment=require(_0xacd3('0x3'));var BPromise=require(_0xacd3('0x4'));var rp=require(_0xacd3('0x5'));var fs=require('fs');var path=require(_0xacd3('0x6'));var rimraf=require(_0xacd3('0x7'));var config=require(_0xacd3('0x8'));var attributes=require('./memberReport.attributes');module[_0xacd3('0x9')]=function(_0x3ea033,_0x21c27a){return _0x3ea033[_0xacd3('0xa')](_0xacd3('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xacd3('0xc'),'fields':[_0xacd3('0xd'),_0xacd3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f3=['request-promise','path','rimraf','../../config/environment','exports','define','report_member','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2dfcee,_0x4382bd){var _0x45a39b=function(_0xf5d7e8){while(--_0xf5d7e8){_0x2dfcee['push'](_0x2dfcee['shift']());}};_0x45a39b(++_0x4382bd);}(_0xc4f3,0xbd));var _0x3c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c4f('0x0'));var util=require(_0x3c4f('0x1'));var logger=require(_0x3c4f('0x2'))(_0x3c4f('0x3'));var moment=require(_0x3c4f('0x4'));var BPromise=require(_0x3c4f('0x5'));var rp=require(_0x3c4f('0x6'));var fs=require('fs');var path=require(_0x3c4f('0x7'));var rimraf=require(_0x3c4f('0x8'));var config=require(_0x3c4f('0x9'));var attributes=require('./memberReport.attributes');module[_0x3c4f('0xa')]=function(_0x5073b3,_0x2dd9e3){return _0x5073b3[_0x3c4f('0xb')]('MemberReport',attributes,{'tableName':_0x3c4f('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x3c4f('0xd'),_0x3c4f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 9464019..01e36bb 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 _0x0d4d=['map','model','attributes','GetMemberReport','catch','CreateMemberReport','body','raw','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','MemberReport','options','where','limit','include'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x0d4d,0x132));var _0xd0d4=function(_0x1a9302,_0x34d5fe){_0x1a9302=_0x1a9302-0x0;var _0xe2b618=_0x0d4d[_0x1a9302];return _0xe2b618;};'use strict';var _=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var moment=require(_0xd0d4('0x2'));var BPromise=require(_0xd0d4('0x3'));var rs=require(_0xd0d4('0x4'));var fs=require('fs');var Redis=require(_0xd0d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0d4('0x6'));var logger=require('../../config/logger')(_0xd0d4('0x7'));var config=require(_0xd0d4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd0d4('0x9')][_0xd0d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c5d01,_0x5c8c7b,_0x5bfae8){return new BPromise(function(_0x5403c0,_0x3fdd50){return client['request'](_0x1c5d01,_0x5bfae8)[_0xd0d4('0xb')](function(_0x314cd5){logger[_0xd0d4('0xc')]('MemberReport,\x20%s,\x20%s',_0x5c8c7b,_0xd0d4('0xd'));logger[_0xd0d4('0xe')](_0xd0d4('0xf'),_0x5c8c7b,_0xd0d4('0xd'),JSON[_0xd0d4('0x10')](_0x314cd5));if(_0x314cd5[_0xd0d4('0x11')]){if(_0x314cd5['error'][_0xd0d4('0x12')]===0x1f4){logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x314cd5[_0xd0d4('0x11')][_0xd0d4('0x14')]);return _0x3fdd50(_0x314cd5[_0xd0d4('0x11')]['message']);}logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x314cd5[_0xd0d4('0x11')]['message']);return _0x5403c0(_0x314cd5['error'][_0xd0d4('0x14')]);}else{logger[_0xd0d4('0xc')]('MemberReport,\x20%s,\x20%s',_0x5c8c7b,_0xd0d4('0xd'));_0x5403c0(_0x314cd5[_0xd0d4('0x15')]['message']);}})['catch'](function(_0x1b64f){logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x1b64f);_0x3fdd50(_0x1b64f);});});}exports['GetMemberReport']=function(_0x5cf4c6){var _0x5eb5e4=this;return new Promise(function(_0x407cda,_0x1e46db){return db[_0xd0d4('0x16')]['findAll']({'raw':_0x5cf4c6['options']?_0x5cf4c6[_0xd0d4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5cf4c6[_0xd0d4('0x17')]?_0x5cf4c6[_0xd0d4('0x17')][_0xd0d4('0x18')]||null:null,'attributes':_0x5cf4c6['options']?_0x5cf4c6[_0xd0d4('0x17')]['attributes']||null:null,'limit':_0x5cf4c6['options']?_0x5cf4c6[_0xd0d4('0x17')][_0xd0d4('0x19')]||null:null,'include':_0x5cf4c6['options']?_0x5cf4c6['options'][_0xd0d4('0x1a')]?_[_0xd0d4('0x1b')](_0x5cf4c6[_0xd0d4('0x17')][_0xd0d4('0x1a')],function(_0x1d8033){return{'model':db[_0x1d8033[_0xd0d4('0x1c')]],'as':_0x1d8033['as'],'attributes':_0x1d8033['attributes'],'include':_0x1d8033[_0xd0d4('0x1a')]?_['map'](_0x1d8033[_0xd0d4('0x1a')],function(_0x1b03ef){return{'model':db[_0x1b03ef[_0xd0d4('0x1c')]],'as':_0x1b03ef['as'],'attributes':_0x1b03ef['attributes'],'include':_0x1b03ef['include']?_[_0xd0d4('0x1b')](_0x1b03ef['include'],function(_0x50e7f0){return{'model':db[_0x50e7f0[_0xd0d4('0x1c')]],'as':_0x50e7f0['as'],'attributes':_0x50e7f0[_0xd0d4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd0d4('0xb')](function(_0x320efe){logger['info'](_0xd0d4('0x1e'),_0x5cf4c6);logger[_0xd0d4('0xe')](_0xd0d4('0x1e'),_0x5cf4c6,JSON[_0xd0d4('0x10')](_0x320efe));_0x407cda(_0x320efe);})[_0xd0d4('0x1f')](function(_0xefce4f){logger[_0xd0d4('0x11')](_0xd0d4('0x1e'),_0xefce4f[_0xd0d4('0x14')],_0x5cf4c6);_0x1e46db(_0x5eb5e4['error'](0x1f4,_0xefce4f[_0xd0d4('0x14')]));});});};exports[_0xd0d4('0x20')]=function(_0x192f43){var _0x18096a=this;return new Promise(function(_0x2ea5d9,_0x198991){return db['MemberReport']['create'](_0x192f43[_0xd0d4('0x21')],{'raw':_0x192f43['options']?_0x192f43[_0xd0d4('0x17')][_0xd0d4('0x22')]===undefined?!![]:![]:!![]})[_0xd0d4('0xb')](function(_0x446763){logger[_0xd0d4('0xc')](_0xd0d4('0x20'),_0x192f43);logger[_0xd0d4('0xe')]('CreateMemberReport',_0x192f43,JSON['stringify'](_0x446763));_0x2ea5d9(_0x446763);})[_0xd0d4('0x1f')](function(_0x161d17){logger['error'](_0xd0d4('0x20'),_0x161d17['message'],_0x192f43);_0x198991(_0x18096a['error'](0x1f4,_0x161d17[_0xd0d4('0x14')]));});});};exports[_0xd0d4('0x23')]=function(_0x3fd1b1){var _0x26a080=this;return new Promise(function(_0x5011dd,_0x47e4c5){return db[_0xd0d4('0x16')][_0xd0d4('0x24')](_0x3fd1b1[_0xd0d4('0x21')],{'raw':_0x3fd1b1['options']?_0x3fd1b1[_0xd0d4('0x17')][_0xd0d4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd1b1[_0xd0d4('0x17')]?_0x3fd1b1[_0xd0d4('0x17')][_0xd0d4('0x18')]||null:null,'attributes':_0x3fd1b1[_0xd0d4('0x17')]?_0x3fd1b1[_0xd0d4('0x17')][_0xd0d4('0x1d')]||null:null,'limit':_0x3fd1b1['options']?_0x3fd1b1[_0xd0d4('0x17')]['limit']||null:null})['then'](function(_0x29434a){logger['info'](_0xd0d4('0x23'),_0x3fd1b1);logger[_0xd0d4('0xe')](_0xd0d4('0x23'),_0x3fd1b1,JSON[_0xd0d4('0x10')](_0x29434a));_0x5011dd(_0x29434a);})[_0xd0d4('0x1f')](function(_0x3b24c8){logger['error'](_0xd0d4('0x23'),_0x3b24c8[_0xd0d4('0x14')],_0x3fd1b1);_0x47e4c5(_0x26a080['error'](0x1f4,_0x3b24c8['message']));});});}; \ No newline at end of file +var _0x042a=['catch','GetMemberReport','MemberReport','options','where','attributes','limit','include','model','map','stringify','CreateMemberReport','create','raw','UpdateMemberReport','update','body','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x042a,0x1d9));var _0xa042=function(_0x10869c,_0x1bb765){_0x10869c=_0x10869c-0x0;var _0x32f9b3=_0x042a[_0x10869c];return _0x32f9b3;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var moment=require(_0xa042('0x1'));var BPromise=require(_0xa042('0x2'));var rs=require(_0xa042('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa042('0x4'))['db'];var utils=require(_0xa042('0x5'));var logger=require(_0xa042('0x6'))(_0xa042('0x7'));var config=require(_0xa042('0x8'));var jayson=require(_0xa042('0x9'));var client=jayson[_0xa042('0xa')][_0xa042('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47981b,_0x15774e,_0x5cfa15){return new BPromise(function(_0x58a031,_0x36fd79){return client['request'](_0x47981b,_0x5cfa15)[_0xa042('0xc')](function(_0xd80124){logger[_0xa042('0xd')](_0xa042('0xe'),_0x15774e,_0xa042('0xf'));logger[_0xa042('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x15774e,_0xa042('0xf'),JSON['stringify'](_0xd80124));if(_0xd80124[_0xa042('0x11')]){if(_0xd80124['error'][_0xa042('0x12')]===0x1f4){logger[_0xa042('0x11')](_0xa042('0xe'),_0x15774e,_0xd80124['error'][_0xa042('0x13')]);return _0x36fd79(_0xd80124[_0xa042('0x11')][_0xa042('0x13')]);}logger['error'](_0xa042('0xe'),_0x15774e,_0xd80124[_0xa042('0x11')][_0xa042('0x13')]);return _0x58a031(_0xd80124[_0xa042('0x11')]['message']);}else{logger[_0xa042('0xd')](_0xa042('0xe'),_0x15774e,_0xa042('0xf'));_0x58a031(_0xd80124[_0xa042('0x14')][_0xa042('0x13')]);}})[_0xa042('0x15')](function(_0x5a4fbf){logger['error'](_0xa042('0xe'),_0x15774e,_0x5a4fbf);_0x36fd79(_0x5a4fbf);});});}exports[_0xa042('0x16')]=function(_0x1752bf){var _0x3271fd=this;return new Promise(function(_0x20879b,_0xab379){return db[_0xa042('0x17')]['findAll']({'raw':_0x1752bf['options']?_0x1752bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x1752bf['options']?_0x1752bf[_0xa042('0x18')][_0xa042('0x19')]||null:null,'attributes':_0x1752bf[_0xa042('0x18')]?_0x1752bf[_0xa042('0x18')][_0xa042('0x1a')]||null:null,'limit':_0x1752bf[_0xa042('0x18')]?_0x1752bf['options'][_0xa042('0x1b')]||null:null,'include':_0x1752bf[_0xa042('0x18')]?_0x1752bf[_0xa042('0x18')][_0xa042('0x1c')]?_['map'](_0x1752bf[_0xa042('0x18')][_0xa042('0x1c')],function(_0x384d9e){return{'model':db[_0x384d9e[_0xa042('0x1d')]],'as':_0x384d9e['as'],'attributes':_0x384d9e[_0xa042('0x1a')],'include':_0x384d9e[_0xa042('0x1c')]?_[_0xa042('0x1e')](_0x384d9e[_0xa042('0x1c')],function(_0x3b4ec8){return{'model':db[_0x3b4ec8[_0xa042('0x1d')]],'as':_0x3b4ec8['as'],'attributes':_0x3b4ec8[_0xa042('0x1a')],'include':_0x3b4ec8[_0xa042('0x1c')]?_[_0xa042('0x1e')](_0x3b4ec8[_0xa042('0x1c')],function(_0x4b41f0){return{'model':db[_0x4b41f0[_0xa042('0x1d')]],'as':_0x4b41f0['as'],'attributes':_0x4b41f0[_0xa042('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44b518){logger[_0xa042('0xd')]('GetMemberReport',_0x1752bf);logger[_0xa042('0x10')](_0xa042('0x16'),_0x1752bf,JSON[_0xa042('0x1f')](_0x44b518));_0x20879b(_0x44b518);})[_0xa042('0x15')](function(_0x3baff3){logger[_0xa042('0x11')](_0xa042('0x16'),_0x3baff3[_0xa042('0x13')],_0x1752bf);_0xab379(_0x3271fd[_0xa042('0x11')](0x1f4,_0x3baff3[_0xa042('0x13')]));});});};exports[_0xa042('0x20')]=function(_0x5e963d){var _0x566665=this;return new Promise(function(_0x2c499b,_0xadc429){return db[_0xa042('0x17')][_0xa042('0x21')](_0x5e963d['body'],{'raw':_0x5e963d[_0xa042('0x18')]?_0x5e963d['options'][_0xa042('0x22')]===undefined?!![]:![]:!![]})[_0xa042('0xc')](function(_0x4be891){logger['info']('CreateMemberReport',_0x5e963d);logger['debug'](_0xa042('0x20'),_0x5e963d,JSON['stringify'](_0x4be891));_0x2c499b(_0x4be891);})[_0xa042('0x15')](function(_0x315137){logger['error'](_0xa042('0x20'),_0x315137['message'],_0x5e963d);_0xadc429(_0x566665['error'](0x1f4,_0x315137[_0xa042('0x13')]));});});};exports[_0xa042('0x23')]=function(_0x38e09d){var _0x411ba4=this;return new Promise(function(_0x2d4d97,_0x152ff0){return db[_0xa042('0x17')][_0xa042('0x24')](_0x38e09d[_0xa042('0x25')],{'raw':_0x38e09d[_0xa042('0x18')]?_0x38e09d[_0xa042('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38e09d['options']?_0x38e09d['options'][_0xa042('0x19')]||null:null,'attributes':_0x38e09d['options']?_0x38e09d[_0xa042('0x18')][_0xa042('0x1a')]||null:null,'limit':_0x38e09d[_0xa042('0x18')]?_0x38e09d[_0xa042('0x18')]['limit']||null:null})[_0xa042('0xc')](function(_0x4b97dc){logger['info'](_0xa042('0x23'),_0x38e09d);logger['debug'](_0xa042('0x23'),_0x38e09d,JSON[_0xa042('0x1f')](_0x4b97dc));_0x2d4d97(_0x4b97dc);})[_0xa042('0x15')](function(_0xad343e){logger[_0xa042('0x11')]('UpdateMemberReport',_0xad343e[_0xa042('0x13')],_0x38e09d);_0x152ff0(_0x411ba4[_0xa042('0x11')](0x1f4,_0xad343e[_0xa042('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2097cc8..3e76051 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 _0x8015=['express','Router','fs-extra','../../components/interaction/service','./migration.controller','get','exports','multer','path','connect-timeout'];(function(_0x28eb88,_0x659a98){var _0x5e00bd=function(_0x2a0b9f){while(--_0x2a0b9f){_0x28eb88['push'](_0x28eb88['shift']());}};_0x5e00bd(++_0x659a98);}(_0x8015,0x1c9));var _0x5801=function(_0x5ed503,_0x96dfe){_0x5ed503=_0x5ed503-0x0;var _0x34f3c0=_0x8015[_0x5ed503];return _0x34f3c0;};'use strict';var multer=require(_0x5801('0x0'));var util=require('util');var path=require(_0x5801('0x1'));var timeout=require(_0x5801('0x2'));var express=require(_0x5801('0x3'));var router=express[_0x5801('0x4')]();var fs_extra=require(_0x5801('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5801('0x6'));var config=require('../../config/environment');var controller=require(_0x5801('0x7'));router[_0x5801('0x8')]('/',controller['index']);module[_0x5801('0x9')]=router; \ No newline at end of file +var _0x6d6b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','multer','path','express','Router','fs-extra'];(function(_0x6cbf80,_0x217500){var _0x2c201a=function(_0x4bb805){while(--_0x4bb805){_0x6cbf80['push'](_0x6cbf80['shift']());}};_0x2c201a(++_0x217500);}(_0x6d6b,0x7d));var _0xb6d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d6b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb6d6('0x0'));var util=require('util');var path=require(_0xb6d6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb6d6('0x2'));var router=express[_0xb6d6('0x3')]();var fs_extra=require(_0xb6d6('0x4'));var auth=require(_0xb6d6('0x5'));var interaction=require(_0xb6d6('0x6'));var config=require(_0xb6d6('0x7'));var controller=require(_0xb6d6('0x8'));router['get']('/',controller[_0xb6d6('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 f195599..8087622 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 _0x1a4a=['exports','STRING','version','sequelize'];(function(_0x4d281f,_0x55e16f){var _0xd9b390=function(_0x53d5e9){while(--_0x53d5e9){_0x4d281f['push'](_0x4d281f['shift']());}};_0xd9b390(++_0x55e16f);}(_0x1a4a,0x18b));var _0xa1a4=function(_0x3855fd,_0x58391b){_0x3855fd=_0x3855fd-0x0;var _0x12d07d=_0x1a4a[_0x3855fd];return _0x12d07d;};'use strict';var Sequelize=require(_0xa1a4('0x0'));module[_0xa1a4('0x1')]={'version':{'type':Sequelize[_0xa1a4('0x2')],'unique':_0xa1a4('0x3')}}; \ No newline at end of file +var _0xd04d=['sequelize'];(function(_0x54eeb0,_0x448f9e){var _0x50eb86=function(_0x42b9d2){while(--_0x42b9d2){_0x54eeb0['push'](_0x54eeb0['shift']());}};_0x50eb86(++_0x448f9e);}(_0xd04d,0x9d));var _0xdd04=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd04d[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xdd04('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 3a65414..bfd995f 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 _0xa1c6=['reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','merge','options','eml-format','zip-dir','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x2bbe8d,_0x5156c2){var _0x539e7a=function(_0x518447){while(--_0x518447){_0x2bbe8d['push'](_0x2bbe8d['shift']());}};_0x539e7a(++_0x5156c2);}(_0xa1c6,0x96));var _0x6a1c=function(_0x24421c,_0x5559d1){_0x24421c=_0x24421c-0x0;var _0x7fa923=_0xa1c6[_0x24421c];return _0x7fa923;};'use strict';var emlformat=require(_0x6a1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6a1c('0x2'));var Mustache=require(_0x6a1c('0x3'));var util=require(_0x6a1c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x6a1c('0x5'));var ejs=require(_0x6a1c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a1c('0x7'));var squel=require(_0x6a1c('0x8'));var crypto=require(_0x6a1c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6a1c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a1c('0xb'));var qs=require(_0x6a1c('0xc'));var as=require(_0x6a1c('0xd'));var hardwareService=require(_0x6a1c('0xe'));var logger=require(_0x6a1c('0xf'))(_0x6a1c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a1c('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d5b1d,_0x44ff61){_0x44ff61=_0x44ff61||0xcc;return function(_0x2963ea){if(_0x2963ea){return _0x5d5b1d['sendStatus'](_0x44ff61);}return _0x5d5b1d[_0x6a1c('0x12')](_0x44ff61)['end']();};}function respondWithResult(_0x3118ec,_0x53c3e7){_0x53c3e7=_0x53c3e7||0xc8;return function(_0x24b58b){if(_0x24b58b){return _0x3118ec[_0x6a1c('0x12')](_0x53c3e7)[_0x6a1c('0x13')](_0x24b58b);}};}function respondWithFilteredResult(_0x130cb7,_0x408cae){return function(_0x46807e){if(_0x46807e){var _0x18594a=typeof _0x408cae[_0x6a1c('0x14')]===_0x6a1c('0x15')&&typeof _0x408cae[_0x6a1c('0x16')]===_0x6a1c('0x15');var _0x567870=_0x46807e[_0x6a1c('0x17')];var _0x487eb5=_0x18594a?0x0:_0x408cae[_0x6a1c('0x14')];var _0x4756c2=_0x18594a?_0x46807e[_0x6a1c('0x17')]:_0x408cae['offset']+_0x408cae[_0x6a1c('0x16')];var _0x30f15f;if(_0x4756c2>=_0x567870){_0x4756c2=_0x567870;_0x30f15f=0xc8;}else{_0x30f15f=0xce;}_0x130cb7[_0x6a1c('0x12')](_0x30f15f);return _0x130cb7[_0x6a1c('0x18')](_0x6a1c('0x19'),_0x487eb5+'-'+_0x4756c2+'/'+_0x567870)[_0x6a1c('0x13')](_0x46807e);}return null;};}function patchUpdates(_0x3ffd73){return function(_0x4bbb4d){try{jsonpatch[_0x6a1c('0x1a')](_0x4bbb4d,_0x3ffd73,!![]);}catch(_0x4692a6){return BPromise[_0x6a1c('0x1b')](_0x4692a6);}return _0x4bbb4d[_0x6a1c('0x1c')]();};}function saveUpdates(_0x564ecf,_0x5c06b9){return function(_0x28bbd4){if(_0x28bbd4){return _0x28bbd4[_0x6a1c('0x1d')](_0x564ecf)[_0x6a1c('0x1e')](function(_0x4852df){return _0x4852df;});}return null;};}function removeEntity(_0x44a3d2,_0xc5bce8){return function(_0x1c77de){if(_0x1c77de){return _0x1c77de[_0x6a1c('0x1f')]()['then'](function(){_0x44a3d2['status'](0xcc)[_0x6a1c('0x20')]();});}};}function handleEntityNotFound(_0x545768,_0x3a5294){return function(_0x56ea92){if(!_0x56ea92){_0x545768[_0x6a1c('0x21')](0x194);}return _0x56ea92;};}function handleError(_0x25ec91,_0x11462e){_0x11462e=_0x11462e||0x1f4;return function(_0x441e58){logger['error'](_0x441e58[_0x6a1c('0x22')]);if(_0x441e58[_0x6a1c('0x23')]){delete _0x441e58['name'];}_0x25ec91[_0x6a1c('0x12')](_0x11462e)[_0x6a1c('0x24')](_0x441e58);};}exports[_0x6a1c('0x25')]=function(_0x2c6df9,_0x3d5a5f){var _0x394838={},_0x6a395a={},_0x3ee5c4={'count':0x0,'rows':[]};var _0x4a47f5=_[_0x6a1c('0x26')](db[_0x6a1c('0x27')][_0x6a1c('0x28')],function(_0x1de32d){return{'name':_0x1de32d[_0x6a1c('0x29')],'type':_0x1de32d[_0x6a1c('0x2a')][_0x6a1c('0x2b')]};});_0x6a395a['model']=_[_0x6a1c('0x26')](_0x4a47f5,'name');_0x6a395a[_0x6a1c('0x2c')]=_[_0x6a1c('0x2d')](_0x2c6df9[_0x6a1c('0x2c')]);_0x6a395a[_0x6a1c('0x2e')]=_[_0x6a1c('0x2f')](_0x6a395a[_0x6a1c('0x30')],_0x6a395a[_0x6a1c('0x2c')]);_0x394838[_0x6a1c('0x31')]=_['intersection'](_0x6a395a['model'],qs[_0x6a1c('0x32')](_0x2c6df9[_0x6a1c('0x2c')][_0x6a1c('0x32')]));_0x394838[_0x6a1c('0x31')]=_0x394838[_0x6a1c('0x31')][_0x6a1c('0x33')]?_0x394838[_0x6a1c('0x31')]:_0x6a395a[_0x6a1c('0x30')];if(!_0x2c6df9[_0x6a1c('0x2c')]['hasOwnProperty'](_0x6a1c('0x34'))){_0x394838['limit']=qs[_0x6a1c('0x16')](_0x2c6df9[_0x6a1c('0x2c')][_0x6a1c('0x16')]);_0x394838[_0x6a1c('0x14')]=qs[_0x6a1c('0x14')](_0x2c6df9[_0x6a1c('0x2c')][_0x6a1c('0x14')]);}_0x394838[_0x6a1c('0x35')]=qs[_0x6a1c('0x36')](_0x2c6df9[_0x6a1c('0x2c')]['sort']);_0x394838['where']=qs['filters'](_['pick'](_0x2c6df9['query'],_0x6a395a[_0x6a1c('0x2e')]),_0x4a47f5);if(_0x2c6df9[_0x6a1c('0x2c')]['filter']){_0x394838[_0x6a1c('0x37')]=_['merge'](_0x394838[_0x6a1c('0x37')],{'$or':_[_0x6a1c('0x26')](_0x4a47f5,function(_0x301b4c){if(_0x301b4c[_0x6a1c('0x2a')]!==_0x6a1c('0x38')){var _0x476597={};_0x476597[_0x301b4c[_0x6a1c('0x23')]]={'$like':'%'+_0x2c6df9['query']['filter']+'%'};return _0x476597;}})});}_0x394838=_[_0x6a1c('0x39')]({},_0x394838,_0x2c6df9[_0x6a1c('0x3a')]);var _0x422e81={'where':_0x394838[_0x6a1c('0x37')]};return db[_0x6a1c('0x27')][_0x6a1c('0x17')](_0x422e81)['then'](function(_0x3540ff){_0x3ee5c4[_0x6a1c('0x17')]=_0x3540ff;if(_0x2c6df9['query']['includeAll']){_0x394838['include']=[{'all':!![]}];}return db[_0x6a1c('0x27')]['findAll'](_0x394838);})[_0x6a1c('0x1e')](function(_0x532aea){_0x3ee5c4['rows']=_0x532aea;return _0x3ee5c4;})['then'](respondWithFilteredResult(_0x3d5a5f,_0x394838))['catch'](handleError(_0x3d5a5f,null));}; \ No newline at end of file +var _0x786d=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Migration','includeAll','include','findAll','rows','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xdaebf3,_0x1cfd7a){var _0x55c554=function(_0x2aaee1){while(--_0x2aaee1){_0xdaebf3['push'](_0xdaebf3['shift']());}};_0x55c554(++_0x1cfd7a);}(_0x786d,0x1de));var _0xd786=function(_0x300df6,_0x1de7ea){_0x300df6=_0x300df6-0x0;var _0x16e975=_0x786d[_0x300df6];return _0x16e975;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd786('0x0'));var jsonpatch=require(_0xd786('0x1'));var rp=require(_0xd786('0x2'));var moment=require(_0xd786('0x3'));var BPromise=require(_0xd786('0x4'));var Mustache=require(_0xd786('0x5'));var util=require(_0xd786('0x6'));var path=require('path');var sox=require(_0xd786('0x7'));var csv=require(_0xd786('0x8'));var ejs=require(_0xd786('0x9'));var fs=require('fs');var fs_extra=require(_0xd786('0xa'));var _=require(_0xd786('0xb'));var squel=require(_0xd786('0xc'));var crypto=require(_0xd786('0xd'));var jsforce=require(_0xd786('0xe'));var deskjs=require(_0xd786('0xf'));var toCsv=require(_0xd786('0x8'));var querystring=require('querystring');var Papa=require(_0xd786('0x10'));var Redis=require(_0xd786('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd786('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd786('0x13'))(_0xd786('0x14'));var utils=require(_0xd786('0x15'));var config=require(_0xd786('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd786('0x17'))['db'];function respondWithStatusCode(_0x38ffb2,_0x1f28ee){_0x1f28ee=_0x1f28ee||0xcc;return function(_0x44d71b){if(_0x44d71b){return _0x38ffb2[_0xd786('0x18')](_0x1f28ee);}return _0x38ffb2[_0xd786('0x19')](_0x1f28ee)[_0xd786('0x1a')]();};}function respondWithResult(_0x222169,_0x14cde3){_0x14cde3=_0x14cde3||0xc8;return function(_0x2319ca){if(_0x2319ca){return _0x222169[_0xd786('0x19')](_0x14cde3)[_0xd786('0x1b')](_0x2319ca);}};}function respondWithFilteredResult(_0xa093da,_0x4f38e7){return function(_0x47ac49){if(_0x47ac49){var _0x5374b1=typeof _0x4f38e7[_0xd786('0x1c')]===_0xd786('0x1d')&&typeof _0x4f38e7[_0xd786('0x1e')]===_0xd786('0x1d');var _0x389f2c=_0x47ac49[_0xd786('0x1f')];var _0xe33325=_0x5374b1?0x0:_0x4f38e7[_0xd786('0x1c')];var _0x2207d4=_0x5374b1?_0x47ac49['count']:_0x4f38e7[_0xd786('0x1c')]+_0x4f38e7[_0xd786('0x1e')];var _0x1194ec;if(_0x2207d4>=_0x389f2c){_0x2207d4=_0x389f2c;_0x1194ec=0xc8;}else{_0x1194ec=0xce;}_0xa093da[_0xd786('0x19')](_0x1194ec);return _0xa093da[_0xd786('0x20')](_0xd786('0x21'),_0xe33325+'-'+_0x2207d4+'/'+_0x389f2c)['json'](_0x47ac49);}return null;};}function patchUpdates(_0x4a9629){return function(_0x59e1df){try{jsonpatch['apply'](_0x59e1df,_0x4a9629,!![]);}catch(_0x3e520b){return BPromise[_0xd786('0x22')](_0x3e520b);}return _0x59e1df[_0xd786('0x23')]();};}function saveUpdates(_0x112ff1,_0x48051a){return function(_0xb86db2){if(_0xb86db2){return _0xb86db2[_0xd786('0x24')](_0x112ff1)['then'](function(_0x51e72e){return _0x51e72e;});}return null;};}function removeEntity(_0xc0a803,_0x17d84b){return function(_0x352e3c){if(_0x352e3c){return _0x352e3c['destroy']()[_0xd786('0x25')](function(){_0xc0a803[_0xd786('0x19')](0xcc)[_0xd786('0x1a')]();});}};}function handleEntityNotFound(_0x4feed9,_0x585061){return function(_0x2a2169){if(!_0x2a2169){_0x4feed9['sendStatus'](0x194);}return _0x2a2169;};}function handleError(_0x4511ca,_0x52443e){_0x52443e=_0x52443e||0x1f4;return function(_0x5ea144){logger[_0xd786('0x26')](_0x5ea144[_0xd786('0x27')]);if(_0x5ea144[_0xd786('0x28')]){delete _0x5ea144['name'];}_0x4511ca[_0xd786('0x19')](_0x52443e)[_0xd786('0x29')](_0x5ea144);};}exports['index']=function(_0x19dfc2,_0x2f49fb){var _0x226a3a={},_0x36cecb={},_0x1c91a1={'count':0x0,'rows':[]};var _0x182165=_[_0xd786('0x2a')](db['Migration'][_0xd786('0x2b')],function(_0x6ee912){return{'name':_0x6ee912[_0xd786('0x2c')],'type':_0x6ee912[_0xd786('0x2d')][_0xd786('0x2e')]};});_0x36cecb['model']=_[_0xd786('0x2a')](_0x182165,_0xd786('0x28'));_0x36cecb[_0xd786('0x2f')]=_[_0xd786('0x30')](_0x19dfc2[_0xd786('0x2f')]);_0x36cecb[_0xd786('0x31')]=_[_0xd786('0x32')](_0x36cecb[_0xd786('0x33')],_0x36cecb[_0xd786('0x2f')]);_0x226a3a['attributes']=_[_0xd786('0x32')](_0x36cecb['model'],qs['fields'](_0x19dfc2[_0xd786('0x2f')][_0xd786('0x34')]));_0x226a3a[_0xd786('0x35')]=_0x226a3a[_0xd786('0x35')][_0xd786('0x36')]?_0x226a3a[_0xd786('0x35')]:_0x36cecb[_0xd786('0x33')];if(!_0x19dfc2[_0xd786('0x2f')][_0xd786('0x37')](_0xd786('0x38'))){_0x226a3a[_0xd786('0x1e')]=qs[_0xd786('0x1e')](_0x19dfc2[_0xd786('0x2f')][_0xd786('0x1e')]);_0x226a3a[_0xd786('0x1c')]=qs[_0xd786('0x1c')](_0x19dfc2['query'][_0xd786('0x1c')]);}_0x226a3a[_0xd786('0x39')]=qs['sort'](_0x19dfc2[_0xd786('0x2f')][_0xd786('0x3a')]);_0x226a3a[_0xd786('0x3b')]=qs[_0xd786('0x31')](_[_0xd786('0x3c')](_0x19dfc2['query'],_0x36cecb[_0xd786('0x31')]),_0x182165);if(_0x19dfc2[_0xd786('0x2f')][_0xd786('0x3d')]){_0x226a3a['where']=_['merge'](_0x226a3a[_0xd786('0x3b')],{'$or':_[_0xd786('0x2a')](_0x182165,function(_0xe1ec56){if(_0xe1ec56['type']!==_0xd786('0x3e')){var _0x2d6e01={};_0x2d6e01[_0xe1ec56[_0xd786('0x28')]]={'$like':'%'+_0x19dfc2[_0xd786('0x2f')][_0xd786('0x3d')]+'%'};return _0x2d6e01;}})});}_0x226a3a=_[_0xd786('0x3f')]({},_0x226a3a,_0x19dfc2[_0xd786('0x40')]);var _0x4ff538={'where':_0x226a3a[_0xd786('0x3b')]};return db[_0xd786('0x41')]['count'](_0x4ff538)[_0xd786('0x25')](function(_0x41d667){_0x1c91a1[_0xd786('0x1f')]=_0x41d667;if(_0x19dfc2[_0xd786('0x2f')][_0xd786('0x42')]){_0x226a3a[_0xd786('0x43')]=[{'all':!![]}];}return db[_0xd786('0x41')][_0xd786('0x44')](_0x226a3a);})['then'](function(_0x695535){_0x1c91a1[_0xd786('0x45')]=_0x695535;return _0x1c91a1;})[_0xd786('0x25')](respondWithFilteredResult(_0x2f49fb,_0x226a3a))['catch'](handleError(_0x2f49fb,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a1c9281..c5e4cdc 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 _0x5160=['request-promise','path','rimraf','../../config/environment','./migration.attributes','define','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x4f7733,_0x441d24){var _0x5757d7=function(_0x370359){while(--_0x370359){_0x4f7733['push'](_0x4f7733['shift']());}};_0x5757d7(++_0x441d24);}(_0x5160,0x19f));var _0x0516=function(_0x259006,_0x337157){_0x259006=_0x259006-0x0;var _0x597743=_0x5160[_0x259006];return _0x597743;};'use strict';var _=require(_0x0516('0x0'));var util=require(_0x0516('0x1'));var logger=require(_0x0516('0x2'))(_0x0516('0x3'));var moment=require(_0x0516('0x4'));var BPromise=require('bluebird');var rp=require(_0x0516('0x5'));var fs=require('fs');var path=require(_0x0516('0x6'));var rimraf=require(_0x0516('0x7'));var config=require(_0x0516('0x8'));var attributes=require(_0x0516('0x9'));module['exports']=function(_0x36b2c9,_0xcdb034){return _0x36b2c9[_0x0516('0xa')]('Migration',attributes,{'tableName':_0x0516('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7bc=['bluebird','path','../../config/environment','exports','define','Migration','migrations','lodash','../../config/logger','api'];(function(_0x1b123a,_0x3f7612){var _0x8868c2=function(_0x4761e5){while(--_0x4761e5){_0x1b123a['push'](_0x1b123a['shift']());}};_0x8868c2(++_0x3f7612);}(_0xa7bc,0x1e7));var _0xca7b=function(_0x179de4,_0x3d61a6){_0x179de4=_0x179de4-0x0;var _0x31e4c7=_0xa7bc[_0x179de4];return _0x31e4c7;};'use strict';var _=require(_0xca7b('0x0'));var util=require('util');var logger=require(_0xca7b('0x1'))(_0xca7b('0x2'));var moment=require('moment');var BPromise=require(_0xca7b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca7b('0x4'));var rimraf=require('rimraf');var config=require(_0xca7b('0x5'));var attributes=require('./migration.attributes');module[_0xca7b('0x6')]=function(_0x4b1e9e,_0x402615){return _0x4b1e9e[_0xca7b('0x7')](_0xca7b('0x8'),attributes,{'tableName':_0xca7b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 0356f52..74a80b4 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 _0x98b7=['message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4eb9e4,_0x10cb49){var _0x2c510b=function(_0x3dae8a){while(--_0x3dae8a){_0x4eb9e4['push'](_0x4eb9e4['shift']());}};_0x2c510b(++_0x10cb49);}(_0x98b7,0xc1));var _0x798b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x98b7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var moment=require(_0x798b('0x2'));var BPromise=require(_0x798b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x798b('0x4'));var logger=require(_0x798b('0x5'))(_0x798b('0x6'));var config=require(_0x798b('0x7'));var jayson=require(_0x798b('0x8'));var client=jayson['client'][_0x798b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d70b2,_0x2b904b,_0xbf4c6c){return new BPromise(function(_0x3fb4de,_0x14994d){return client[_0x798b('0xa')](_0x5d70b2,_0xbf4c6c)['then'](function(_0x24b028){logger['info'](_0x798b('0xb'),_0x2b904b,'request\x20sent');logger[_0x798b('0xc')](_0x798b('0xd'),_0x2b904b,_0x798b('0xe'),JSON['stringify'](_0x24b028));if(_0x24b028['error']){if(_0x24b028[_0x798b('0xf')][_0x798b('0x10')]===0x1f4){logger[_0x798b('0xf')]('Migration,\x20%s,\x20%s',_0x2b904b,_0x24b028[_0x798b('0xf')]['message']);return _0x14994d(_0x24b028[_0x798b('0xf')]['message']);}logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);return _0x3fb4de(_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);}else{logger[_0x798b('0x12')]('Migration,\x20%s,\x20%s',_0x2b904b,'request\x20sent');_0x3fb4de(_0x24b028[_0x798b('0x13')][_0x798b('0x11')]);}})[_0x798b('0x14')](function(_0x19b15c){logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x19b15c);_0x14994d(_0x19b15c);});});} \ No newline at end of file +var _0x6d2e=['message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x6d2e,0x97));var _0xe6d2=function(_0x20c47c,_0x443272){_0x20c47c=_0x20c47c-0x0;var _0x1cfcd7=_0x6d2e[_0x20c47c];return _0x1cfcd7;};'use strict';var _=require('lodash');var util=require(_0xe6d2('0x0'));var moment=require(_0xe6d2('0x1'));var BPromise=require(_0xe6d2('0x2'));var rs=require(_0xe6d2('0x3'));var fs=require('fs');var Redis=require(_0xe6d2('0x4'));var db=require(_0xe6d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6d2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe6d2('0x7'));var client=jayson[_0xe6d2('0x8')][_0xe6d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d9c9f,_0x36d6ad,_0x53906e){return new BPromise(function(_0x2e227e,_0x2ce8cb){return client['request'](_0x4d9c9f,_0x53906e)[_0xe6d2('0xa')](function(_0xa7d0e1){logger['info'](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));logger['debug'](_0xe6d2('0xd'),_0x36d6ad,_0xe6d2('0xc'),JSON[_0xe6d2('0xe')](_0xa7d0e1));if(_0xa7d0e1[_0xe6d2('0xf')]){if(_0xa7d0e1['error'][_0xe6d2('0x10')]===0x1f4){logger[_0xe6d2('0xf')]('Migration,\x20%s,\x20%s',_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2ce8cb(_0xa7d0e1['error'][_0xe6d2('0x11')]);}logger[_0xe6d2('0xf')](_0xe6d2('0xb'),_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2e227e(_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);}else{logger[_0xe6d2('0x12')](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));_0x2e227e(_0xa7d0e1[_0xe6d2('0x13')][_0xe6d2('0x11')]);}})[_0xe6d2('0x14')](function(_0x2ad072){logger[_0xe6d2('0xf')]('Migration,\x20%s,\x20%s',_0x36d6ad,_0x2ad072);_0x2ce8cb(_0x2ad072);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5861576..dc8140d 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 _0x5c21=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','put','update','destroy','exports'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x5c21,0x90));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x15c2('0x0'));var path=require(_0x15c2('0x1'));var timeout=require(_0x15c2('0x2'));var express=require(_0x15c2('0x3'));var router=express['Router']();var fs_extra=require(_0x15c2('0x4'));var auth=require(_0x15c2('0x5'));var interaction=require(_0x15c2('0x6'));var config=require(_0x15c2('0x7'));var controller=require(_0x15c2('0x8'));router[_0x15c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x15c2('0xa')]);router['get'](_0x15c2('0xb'),auth[_0x15c2('0xc')](),controller[_0x15c2('0xd')]);router['post']('/',auth[_0x15c2('0xc')](),controller['create']);router[_0x15c2('0xe')](_0x15c2('0xb'),auth[_0x15c2('0xc')](),controller[_0x15c2('0xf')]);router['delete'](_0x15c2('0xb'),auth['isAuthenticated'](),controller[_0x15c2('0x10')]);module[_0x15c2('0x11')]=router; \ No newline at end of file +var _0x06ae=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','update','destroy','util','path'];(function(_0x35ec9a,_0x174edd){var _0x491fa3=function(_0x45eea8){while(--_0x45eea8){_0x35ec9a['push'](_0x35ec9a['shift']());}};_0x491fa3(++_0x174edd);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe06a('0x0'));var path=require(_0xe06a('0x1'));var timeout=require(_0xe06a('0x2'));var express=require(_0xe06a('0x3'));var router=express[_0xe06a('0x4')]();var fs_extra=require(_0xe06a('0x5'));var auth=require(_0xe06a('0x6'));var interaction=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe06a('0x9')]);router[_0xe06a('0xa')](_0xe06a('0xb'),auth[_0xe06a('0xc')](),controller[_0xe06a('0xd')]);router['post']('/',auth[_0xe06a('0xc')](),controller['create']);router['put'](_0xe06a('0xb'),auth['isAuthenticated'](),controller[_0xe06a('0xe')]);router['delete']('/:id',auth[_0xe06a('0xc')](),controller[_0xe06a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 3624599..092259d 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 _0x9677=['exports','ENUM','localnet','stun','STRING'];(function(_0xb6ce27,_0x2bec6e){var _0x49f3e1=function(_0x51eddf){while(--_0x51eddf){_0xb6ce27['push'](_0xb6ce27['shift']());}};_0x49f3e1(++_0x2bec6e);}(_0x9677,0x186));var _0x7967=function(_0x1c101f,_0x52141d){_0x1c101f=_0x1c101f-0x0;var _0xe02ee4=_0x9677[_0x1c101f];return _0xe02ee4;};'use strict';var Sequelize=require('sequelize');module[_0x7967('0x0')]={'type':{'type':Sequelize[_0x7967('0x1')](_0x7967('0x2'),'externip',_0x7967('0x3'),'turn')},'value':{'type':Sequelize[_0x7967('0x4')]},'username':{'type':Sequelize[_0x7967('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca06=['STRING','sequelize','exports','ENUM','externip','stun','turn'];(function(_0x59f289,_0xb39ebc){var _0x4917c3=function(_0x17d867){while(--_0x17d867){_0x59f289['push'](_0x59f289['shift']());}};_0x4917c3(++_0xb39ebc);}(_0xca06,0x19e));var _0x6ca0=function(_0xa1169,_0x2cb8f9){_0xa1169=_0xa1169-0x0;var _0x2a1a2f=_0xca06[_0xa1169];return _0x2a1a2f;};'use strict';var Sequelize=require(_0x6ca0('0x0'));module[_0x6ca0('0x1')]={'type':{'type':Sequelize[_0x6ca0('0x2')]('localnet',_0x6ca0('0x3'),_0x6ca0('0x4'),_0x6ca0('0x5'))},'value':{'type':Sequelize[_0x6ca0('0x6')]},'username':{'type':Sequelize[_0x6ca0('0x6')]},'password':{'type':Sequelize[_0x6ca0('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 78c872e..3d38b5d 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 _0xaea3=['map','Network','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','chan_sip.so','update','format','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','lodash','../../components/parsers/qs','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','json','offset','undefined','count','limit','status','set','Content-Range','then','destroy','end','sendStatus','name','index'];(function(_0x313e77,_0x2c4581){var _0x400440=function(_0x5e1dcf){while(--_0x5e1dcf){_0x313e77['push'](_0x313e77['shift']());}};_0x400440(++_0x2c4581);}(_0xaea3,0x1c9));var _0x3aea=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaea3[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x3aea('0x0'));var path=require(_0x3aea('0x1'));var ejs=require(_0x3aea('0x2'));var fs=require('fs');var _=require(_0x3aea('0x3'));var qs=require(_0x3aea('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x3aea('0x5'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3aea('0x6'));var client=jayson[_0x3aea('0x7')][_0x3aea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x198247,_0xf3c57c,_0x3c725f,_0x4ff693){return new Promise(function(_0x51fa43,_0x5944f6){var _0x5789e6=_0x4ff693||client;return _0x5789e6[_0x3aea('0x9')](_0x198247,_0x3c725f)['then'](function(_0x524800){logger['info']('Network,\x20%s,\x20%s',_0xf3c57c,_0x3aea('0xa'));logger[_0x3aea('0xb')](_0x3aea('0xc'),_0xf3c57c,_0x3aea('0xa'),JSON[_0x3aea('0xd')](_0x524800));if(_0x524800[_0x3aea('0xe')]){if(_0x524800[_0x3aea('0xe')][_0x3aea('0xf')]===0x1f4){logger[_0x3aea('0xe')](_0x3aea('0x10'),_0xf3c57c,_0x524800['error'][_0x3aea('0x11')]);return _0x5944f6(_0x524800[_0x3aea('0xe')]['message']);}logger[_0x3aea('0xe')](_0x3aea('0x10'),_0xf3c57c,_0x524800['error']['message']);return _0x51fa43(_0x524800[_0x3aea('0xe')][_0x3aea('0x11')]);}else{logger[_0x3aea('0x12')](_0x3aea('0x10'),_0xf3c57c,'request\x20sent');_0x51fa43(_0x524800[_0x3aea('0x13')][_0x3aea('0x11')]);}})[_0x3aea('0x14')](function(_0x2fd3ae){logger[_0x3aea('0xe')](_0x3aea('0x10'),_0xf3c57c,_0x2fd3ae);_0x5944f6(_0x2fd3ae);});});}function respondWithResult(_0x20953c,_0x33437d){_0x33437d=_0x33437d||0xc8;return function(_0x1448e4){if(_0x1448e4){return _0x20953c['status'](_0x33437d)[_0x3aea('0x15')](_0x1448e4);}};}function respondWithFilteredResult(_0x4c133c,_0x35ad7d){return function(_0x24619c){if(_0x24619c){var _0x4b0e9f=typeof _0x35ad7d[_0x3aea('0x16')]===_0x3aea('0x17')&&typeof _0x35ad7d['limit']===_0x3aea('0x17');var _0x4d12fc=_0x24619c[_0x3aea('0x18')];var _0x5ec173=_0x4b0e9f?0x0:_0x35ad7d['offset'];var _0x3d868b=_0x4b0e9f?_0x24619c['count']:_0x35ad7d[_0x3aea('0x16')]+_0x35ad7d[_0x3aea('0x19')];var _0x22e222;if(_0x3d868b>=_0x4d12fc){_0x3d868b=_0x4d12fc;_0x22e222=0xc8;}else{_0x22e222=0xce;}_0x4c133c[_0x3aea('0x1a')](_0x22e222);return _0x4c133c[_0x3aea('0x1b')](_0x3aea('0x1c'),_0x5ec173+'-'+_0x3d868b+'/'+_0x4d12fc)[_0x3aea('0x15')](_0x24619c);}return null;};}function saveUpdates(_0x5a0295){return function(_0x52b0bf){if(_0x52b0bf){return _0x52b0bf['update'](_0x5a0295)[_0x3aea('0x1d')](function(_0x3ac2cb){return _0x3ac2cb;});}return null;};}function removeEntity(_0x4fb851){return function(_0x41b15a){if(_0x41b15a){return _0x41b15a[_0x3aea('0x1e')]()[_0x3aea('0x1d')](function(){_0x4fb851[_0x3aea('0x1a')](0xcc)[_0x3aea('0x1f')]();});}};}function handleEntityNotFound(_0x25cba1){return function(_0x4f4c50){if(!_0x4f4c50){_0x25cba1[_0x3aea('0x20')](0x194);}return _0x4f4c50;};}function handleError(_0x27dde5,_0xae213f){_0xae213f=_0xae213f||0x1f4;return function(_0x47167f){logger[_0x3aea('0xe')](_0x47167f['stack']);if(_0x47167f[_0x3aea('0x21')]){delete _0x47167f[_0x3aea('0x21')];}_0x27dde5[_0x3aea('0x1a')](_0xae213f)['send'](_0x47167f);};}exports[_0x3aea('0x22')]=function(_0x64ff38,_0x500979){var _0x483360={},_0x36bec5={},_0x25053e={'count':0x0,'rows':[]};var _0x42f4aa=_[_0x3aea('0x23')](db[_0x3aea('0x24')][_0x3aea('0x25')],function(_0x6b9abe){return{'name':_0x6b9abe['fieldName'],'type':_0x6b9abe[_0x3aea('0x26')][_0x3aea('0x27')]};});_0x36bec5[_0x3aea('0x28')]=_[_0x3aea('0x23')](_0x42f4aa,'name');_0x36bec5['query']=_[_0x3aea('0x29')](_0x64ff38[_0x3aea('0x2a')]);_0x36bec5[_0x3aea('0x2b')]=_[_0x3aea('0x2c')](_0x36bec5[_0x3aea('0x28')],_0x36bec5[_0x3aea('0x2a')]);_0x483360['attributes']=_[_0x3aea('0x2c')](_0x36bec5[_0x3aea('0x28')],qs[_0x3aea('0x2d')](_0x64ff38['query']['fields']));_0x483360[_0x3aea('0x2e')]=_0x483360[_0x3aea('0x2e')]['length']?_0x483360['attributes']:_0x36bec5['model'];if(!_0x64ff38[_0x3aea('0x2a')]['hasOwnProperty']('nolimit')){_0x483360[_0x3aea('0x19')]=qs['limit'](_0x64ff38[_0x3aea('0x2a')][_0x3aea('0x19')]);_0x483360[_0x3aea('0x16')]=qs[_0x3aea('0x16')](_0x64ff38[_0x3aea('0x2a')][_0x3aea('0x16')]);}_0x483360['order']=qs['sort'](_0x64ff38['query'][_0x3aea('0x2f')]);_0x483360[_0x3aea('0x30')]=qs['filters'](_['pick'](_0x64ff38['query'],_0x36bec5[_0x3aea('0x2b')]),_0x42f4aa);if(_0x64ff38['query'][_0x3aea('0x31')]){_0x483360['where']=_[_0x3aea('0x32')](_0x483360[_0x3aea('0x30')],{'$or':_['map'](_0x42f4aa,function(_0x647200){if(_0x647200[_0x3aea('0x26')]!==_0x3aea('0x33')){var _0x4fd9c9={};_0x4fd9c9[_0x647200['name']]={'$like':'%'+_0x64ff38[_0x3aea('0x2a')]['filter']+'%'};return _0x4fd9c9;}})});}_0x483360=_[_0x3aea('0x32')]({},_0x483360,_0x64ff38[_0x3aea('0x34')]);var _0x383a44={'where':_0x483360[_0x3aea('0x30')]};return db['Network'][_0x3aea('0x18')](_0x383a44)['then'](function(_0xf25f62){_0x25053e['count']=_0xf25f62;if(_0x64ff38[_0x3aea('0x2a')][_0x3aea('0x35')]){_0x483360[_0x3aea('0x36')]=[{'all':!![]}];}return db[_0x3aea('0x24')][_0x3aea('0x37')](_0x483360);})[_0x3aea('0x1d')](function(_0x4b1d32){_0x25053e['rows']=_0x4b1d32;return _0x25053e;})['then'](respondWithFilteredResult(_0x500979,_0x483360))[_0x3aea('0x14')](handleError(_0x500979,null));};exports[_0x3aea('0x38')]=function(_0x2c1153,_0x4f634b){var _0x35f201={'raw':!![],'where':{'id':_0x2c1153[_0x3aea('0x39')]['id']}},_0x54d5e6={};_0x54d5e6['model']=_[_0x3aea('0x29')](db[_0x3aea('0x24')][_0x3aea('0x25')]);_0x54d5e6[_0x3aea('0x2a')]=_[_0x3aea('0x29')](_0x2c1153[_0x3aea('0x2a')]);_0x54d5e6[_0x3aea('0x2b')]=_[_0x3aea('0x2c')](_0x54d5e6[_0x3aea('0x28')],_0x54d5e6['query']);_0x35f201[_0x3aea('0x2e')]=_['intersection'](_0x54d5e6[_0x3aea('0x28')],qs[_0x3aea('0x2d')](_0x2c1153[_0x3aea('0x2a')]['fields']));_0x35f201[_0x3aea('0x2e')]=_0x35f201[_0x3aea('0x2e')]['length']?_0x35f201[_0x3aea('0x2e')]:_0x54d5e6['model'];if(_0x2c1153[_0x3aea('0x2a')][_0x3aea('0x35')]){_0x35f201[_0x3aea('0x36')]=[{'all':!![]}];}_0x35f201=_[_0x3aea('0x32')]({},_0x35f201,_0x2c1153[_0x3aea('0x34')]);return db[_0x3aea('0x24')][_0x3aea('0x3a')](_0x35f201)[_0x3aea('0x1d')](handleEntityNotFound(_0x4f634b,null))['then'](respondWithResult(_0x4f634b,null))[_0x3aea('0x14')](handleError(_0x4f634b,null));};exports['create']=function(_0x314ab4,_0x5d4b9d){var _0x192c11;return db['Network'][_0x3aea('0x3b')](_0x314ab4[_0x3aea('0x3c')],{'raw':!![]})[_0x3aea('0x1d')](function(_0x5a6894){_0x192c11=_0x5a6894;return db[_0x3aea('0x24')][_0x3aea('0x37')]({'where':{'type':_0x314ab4[_0x3aea('0x3c')][_0x3aea('0x26')]},'raw':!![]});})['then'](function(_0x134a16){if(_0x192c11[_0x3aea('0x26')][_0x3aea('0x3d')]()==_0x3aea('0x3e')){var _0x3f665b=fs[_0x3aea('0x3f')](path['join'](config[_0x3aea('0x40')],_0x3aea('0x41')),_0x3aea('0x42'));var _0x572302=ejs['render'](_0x3f665b,{'networks':_0x134a16||[]});fs[_0x3aea('0x43')](_0x3aea('0x44'),_0x572302);return respondWithRpcPromise(_0x3aea('0x45'),_0x3aea('0x3b'),{'module':_0x3aea('0x46')});}else if(_0x192c11['type'][_0x3aea('0x3d')]()==_0x3aea('0x47')){var _0x6bcf32=fs['readFileSync'](path[_0x3aea('0x48')](config['root'],_0x3aea('0x49')),_0x3aea('0x42'));var _0x40eb72=ejs[_0x3aea('0x4a')](_0x6bcf32,{'networks':_0x134a16||[]});fs[_0x3aea('0x43')](_0x3aea('0x4b'),_0x40eb72);return respondWithRpcPromise(_0x3aea('0x45'),'create',{'module':'res_stun_monitor.so'});}else{var _0x23a065=fs[_0x3aea('0x3f')](path[_0x3aea('0x48')](config['root'],_0x3aea('0x4c')),_0x3aea('0x42'));var _0xde1f3=ejs[_0x3aea('0x4a')](_0x23a065,{'networks':_0x134a16||[]});fs[_0x3aea('0x43')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x314ab4[_0x3aea('0x3c')][_0x3aea('0x26')][_0x3aea('0x4d')]()),_0xde1f3);return respondWithRpcPromise(_0x3aea('0x45'),'create',{'module':_0x3aea('0x4e')});}})['then'](function(){return _0x192c11;})['then'](respondWithResult(_0x5d4b9d,0xc9))[_0x3aea('0x14')](handleError(_0x5d4b9d,null));};exports[_0x3aea('0x4f')]=function(_0x4f78cf,_0x188c6b){var _0xbc1fd2;return db['Network'][_0x3aea('0x3a')]({'where':{'id':_0x4f78cf[_0x3aea('0x39')]['id']}})[_0x3aea('0x1d')](handleEntityNotFound(_0x188c6b,null))[_0x3aea('0x1d')](saveUpdates(_0x4f78cf[_0x3aea('0x3c')],null))[_0x3aea('0x1d')](function(_0x4c8f5b){if(_0x4c8f5b){_0xbc1fd2=_0x4c8f5b;return db[_0x3aea('0x24')][_0x3aea('0x37')]({'where':{'type':_0xbc1fd2['type']},'raw':!![]});}return null;})['then'](function(_0x333ac9){if(_0xbc1fd2[_0x3aea('0x26')][_0x3aea('0x3d')]()==_0x3aea('0x3e')){var _0x58b7a8=fs[_0x3aea('0x3f')](path[_0x3aea('0x48')](config[_0x3aea('0x40')],'server/files/templates/stun_multiple.ejs'),_0x3aea('0x42'));var _0x558772=ejs[_0x3aea('0x4a')](_0x58b7a8,{'networks':_0x333ac9||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x558772);return respondWithRpcPromise(_0x3aea('0x45'),_0x3aea('0x4f'),{'module':_0x3aea('0x46')});}else if(_0xbc1fd2[_0x3aea('0x26')][_0x3aea('0x3d')]()==_0x3aea('0x47')){var _0x5b2a16=fs[_0x3aea('0x3f')](path['join'](config['root'],_0x3aea('0x49')),'utf8');var _0x40053=ejs[_0x3aea('0x4a')](_0x5b2a16,{'networks':_0x333ac9||[]});fs[_0x3aea('0x43')](_0x3aea('0x4b'),_0x40053);return respondWithRpcPromise(_0x3aea('0x45'),_0x3aea('0x4f'),{'module':_0x3aea('0x46')});}else{var _0x564ed7=fs[_0x3aea('0x3f')](path[_0x3aea('0x48')](config['root'],_0x3aea('0x4c')),_0x3aea('0x42'));var _0x3d5424=ejs['render'](_0x564ed7,{'networks':_0x333ac9||[]});fs[_0x3aea('0x43')](util[_0x3aea('0x50')](_0x3aea('0x51'),_0x4f78cf['body'][_0x3aea('0x26')][_0x3aea('0x4d')]()),_0x3d5424);return respondWithRpcPromise(_0x3aea('0x45'),_0x3aea('0x4f'),{'module':_0x3aea('0x4e')});}})[_0x3aea('0x1d')](function(_0x4c6ec7){if(_0x4c6ec7){return _0xbc1fd2;}return null;})[_0x3aea('0x1d')](respondWithResult(_0x188c6b,null))['catch'](handleError(_0x188c6b,null));};exports['destroy']=function(_0x2504a4,_0x12fd5e){var _0x377ab4;return db['Network'][_0x3aea('0x3a')]({'where':{'id':_0x2504a4['params']['id']}})[_0x3aea('0x1d')](function(_0x94db77){_0x377ab4=_0x94db77;return _0x94db77;})[_0x3aea('0x1d')](handleEntityNotFound(_0x12fd5e,null))[_0x3aea('0x1d')](removeEntity(_0x12fd5e,null))['then'](function(){if(_0x377ab4){return db[_0x3aea('0x24')]['findAll']({'where':{'type':_0x377ab4[_0x3aea('0x26')]},'raw':!![]});}})['then'](function(_0x38804e){if(_0x377ab4[_0x3aea('0x26')][_0x3aea('0x3d')]()=='STUN'){var _0x33874c=fs['readFileSync'](path[_0x3aea('0x48')](config[_0x3aea('0x40')],_0x3aea('0x41')),'utf8');var _0x274907=ejs['render'](_0x33874c,{'networks':_0x38804e||[]});fs[_0x3aea('0x43')]('/etc/asterisk/stun_xcally.conf',_0x274907);return respondWithRpcPromise('Reload',_0x3aea('0x1e'),{'module':_0x3aea('0x46')});}else if(_0x377ab4['type']['toUpperCase']()==_0x3aea('0x47')){var _0x50be6f=fs[_0x3aea('0x3f')](path[_0x3aea('0x48')](config[_0x3aea('0x40')],_0x3aea('0x49')),_0x3aea('0x42'));var _0x3e0f2f=ejs[_0x3aea('0x4a')](_0x50be6f,{'networks':_0x38804e||[]});fs[_0x3aea('0x43')]('/etc/asterisk/turn_xcally.conf',_0x3e0f2f);return respondWithRpcPromise(_0x3aea('0x45'),_0x3aea('0x1e'),{'module':_0x3aea('0x46')});}else{var _0x5a5b24=fs[_0x3aea('0x3f')](path[_0x3aea('0x48')](config[_0x3aea('0x40')],_0x3aea('0x4c')),_0x3aea('0x42'));var _0x209551=ejs[_0x3aea('0x4a')](_0x5a5b24,{'networks':_0x38804e||[]});fs[_0x3aea('0x43')](util[_0x3aea('0x50')](_0x3aea('0x51'),_0x377ab4[_0x3aea('0x26')][_0x3aea('0x4d')]()),_0x209551);return respondWithRpcPromise(_0x3aea('0x45'),_0x3aea('0x1e'),{'module':_0x3aea('0x4e')});}})[_0x3aea('0x14')](handleError(_0x12fd5e,null));}; \ No newline at end of file +var _0xb61e=['order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','params','includeAll','options','create','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','format','body','toLowerCase','chan_sip.so','update','find','STUN','TURN','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','destroy','/etc/asterisk/stun_xcally.conf','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','then','end','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x573fdf,_0x16cc8f){var _0x269299=function(_0x1c34cc){while(--_0x1c34cc){_0x573fdf['push'](_0x573fdf['shift']());}};_0x269299(++_0x16cc8f);}(_0xb61e,0xd8));var _0xeb61=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xb61e[_0x2c27ed];return _0x597bd1;};'use strict';var util=require(_0xeb61('0x0'));var path=require(_0xeb61('0x1'));var ejs=require(_0xeb61('0x2'));var fs=require('fs');var _=require(_0xeb61('0x3'));var qs=require(_0xeb61('0x4'));var logger=require(_0xeb61('0x5'))(_0xeb61('0x6'));var config=require('../../config/environment');var db=require(_0xeb61('0x7'))['db'];var jayson=require(_0xeb61('0x8'));var client=jayson[_0xeb61('0x9')][_0xeb61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25e4e4,_0x2db44f,_0x129258,_0x465a0b){return new Promise(function(_0x3d6479,_0x31b986){var _0x17e3af=_0x465a0b||client;return _0x17e3af[_0xeb61('0xb')](_0x25e4e4,_0x129258)['then'](function(_0x53887c){logger[_0xeb61('0xc')](_0xeb61('0xd'),_0x2db44f,'request\x20sent');logger[_0xeb61('0xe')](_0xeb61('0xf'),_0x2db44f,_0xeb61('0x10'),JSON['stringify'](_0x53887c));if(_0x53887c['error']){if(_0x53887c['error'][_0xeb61('0x11')]===0x1f4){logger[_0xeb61('0x12')](_0xeb61('0xd'),_0x2db44f,_0x53887c[_0xeb61('0x12')][_0xeb61('0x13')]);return _0x31b986(_0x53887c['error'][_0xeb61('0x13')]);}logger['error'](_0xeb61('0xd'),_0x2db44f,_0x53887c[_0xeb61('0x12')]['message']);return _0x3d6479(_0x53887c[_0xeb61('0x12')][_0xeb61('0x13')]);}else{logger[_0xeb61('0xc')]('Network,\x20%s,\x20%s',_0x2db44f,_0xeb61('0x10'));_0x3d6479(_0x53887c[_0xeb61('0x14')][_0xeb61('0x13')]);}})[_0xeb61('0x15')](function(_0x27974f){logger[_0xeb61('0x12')]('Network,\x20%s,\x20%s',_0x2db44f,_0x27974f);_0x31b986(_0x27974f);});});}function respondWithResult(_0x29386d,_0xc199bb){_0xc199bb=_0xc199bb||0xc8;return function(_0x291773){if(_0x291773){return _0x29386d[_0xeb61('0x16')](_0xc199bb)[_0xeb61('0x17')](_0x291773);}};}function respondWithFilteredResult(_0xa99f7,_0x1748e4){return function(_0x1149c){if(_0x1149c){var _0x2f9d21=typeof _0x1748e4[_0xeb61('0x18')]===_0xeb61('0x19')&&typeof _0x1748e4[_0xeb61('0x1a')]===_0xeb61('0x19');var _0x4cf2a1=_0x1149c[_0xeb61('0x1b')];var _0x487656=_0x2f9d21?0x0:_0x1748e4['offset'];var _0x3bbd84=_0x2f9d21?_0x1149c[_0xeb61('0x1b')]:_0x1748e4[_0xeb61('0x18')]+_0x1748e4['limit'];var _0xb91ca8;if(_0x3bbd84>=_0x4cf2a1){_0x3bbd84=_0x4cf2a1;_0xb91ca8=0xc8;}else{_0xb91ca8=0xce;}_0xa99f7[_0xeb61('0x16')](_0xb91ca8);return _0xa99f7[_0xeb61('0x1c')](_0xeb61('0x1d'),_0x487656+'-'+_0x3bbd84+'/'+_0x4cf2a1)[_0xeb61('0x17')](_0x1149c);}return null;};}function saveUpdates(_0x4bc9e3){return function(_0x1a7f3d){if(_0x1a7f3d){return _0x1a7f3d['update'](_0x4bc9e3)[_0xeb61('0x1e')](function(_0x19cc0c){return _0x19cc0c;});}return null;};}function removeEntity(_0x2686a4){return function(_0x19958d){if(_0x19958d){return _0x19958d['destroy']()['then'](function(){_0x2686a4[_0xeb61('0x16')](0xcc)[_0xeb61('0x1f')]();});}};}function handleEntityNotFound(_0xd32d6c){return function(_0x4e1734){if(!_0x4e1734){_0xd32d6c['sendStatus'](0x194);}return _0x4e1734;};}function handleError(_0x3ae793,_0x70772e){_0x70772e=_0x70772e||0x1f4;return function(_0x3e8782){logger[_0xeb61('0x12')](_0x3e8782[_0xeb61('0x20')]);if(_0x3e8782[_0xeb61('0x21')]){delete _0x3e8782[_0xeb61('0x21')];}_0x3ae793[_0xeb61('0x16')](_0x70772e)[_0xeb61('0x22')](_0x3e8782);};}exports['index']=function(_0xfd9dfd,_0x1439ae){var _0x27c8b7={},_0x386dbb={},_0xebe7ab={'count':0x0,'rows':[]};var _0x29b8b8=_[_0xeb61('0x23')](db[_0xeb61('0x24')][_0xeb61('0x25')],function(_0x1a5eae){return{'name':_0x1a5eae[_0xeb61('0x26')],'type':_0x1a5eae[_0xeb61('0x27')][_0xeb61('0x28')]};});_0x386dbb[_0xeb61('0x29')]=_['map'](_0x29b8b8,'name');_0x386dbb[_0xeb61('0x2a')]=_[_0xeb61('0x2b')](_0xfd9dfd[_0xeb61('0x2a')]);_0x386dbb[_0xeb61('0x2c')]=_[_0xeb61('0x2d')](_0x386dbb[_0xeb61('0x29')],_0x386dbb['query']);_0x27c8b7[_0xeb61('0x2e')]=_['intersection'](_0x386dbb['model'],qs['fields'](_0xfd9dfd[_0xeb61('0x2a')][_0xeb61('0x2f')]));_0x27c8b7[_0xeb61('0x2e')]=_0x27c8b7[_0xeb61('0x2e')][_0xeb61('0x30')]?_0x27c8b7['attributes']:_0x386dbb['model'];if(!_0xfd9dfd[_0xeb61('0x2a')][_0xeb61('0x31')](_0xeb61('0x32'))){_0x27c8b7[_0xeb61('0x1a')]=qs['limit'](_0xfd9dfd[_0xeb61('0x2a')][_0xeb61('0x1a')]);_0x27c8b7[_0xeb61('0x18')]=qs[_0xeb61('0x18')](_0xfd9dfd['query']['offset']);}_0x27c8b7[_0xeb61('0x33')]=qs[_0xeb61('0x34')](_0xfd9dfd[_0xeb61('0x2a')]['sort']);_0x27c8b7[_0xeb61('0x35')]=qs['filters'](_[_0xeb61('0x36')](_0xfd9dfd[_0xeb61('0x2a')],_0x386dbb[_0xeb61('0x2c')]),_0x29b8b8);if(_0xfd9dfd[_0xeb61('0x2a')][_0xeb61('0x37')]){_0x27c8b7['where']=_[_0xeb61('0x38')](_0x27c8b7['where'],{'$or':_[_0xeb61('0x23')](_0x29b8b8,function(_0x43dec2){if(_0x43dec2[_0xeb61('0x27')]!==_0xeb61('0x39')){var _0x388e57={};_0x388e57[_0x43dec2[_0xeb61('0x21')]]={'$like':'%'+_0xfd9dfd[_0xeb61('0x2a')][_0xeb61('0x37')]+'%'};return _0x388e57;}})});}_0x27c8b7=_[_0xeb61('0x38')]({},_0x27c8b7,_0xfd9dfd['options']);var _0x24b059={'where':_0x27c8b7[_0xeb61('0x35')]};return db[_0xeb61('0x24')][_0xeb61('0x1b')](_0x24b059)[_0xeb61('0x1e')](function(_0x378647){_0xebe7ab['count']=_0x378647;if(_0xfd9dfd[_0xeb61('0x2a')]['includeAll']){_0x27c8b7[_0xeb61('0x3a')]=[{'all':!![]}];}return db[_0xeb61('0x24')][_0xeb61('0x3b')](_0x27c8b7);})['then'](function(_0x31b721){_0xebe7ab[_0xeb61('0x3c')]=_0x31b721;return _0xebe7ab;})[_0xeb61('0x1e')](respondWithFilteredResult(_0x1439ae,_0x27c8b7))[_0xeb61('0x15')](handleError(_0x1439ae,null));};exports['show']=function(_0x391350,_0x45394a){var _0x24fe47={'raw':!![],'where':{'id':_0x391350[_0xeb61('0x3d')]['id']}},_0x552f5b={};_0x552f5b[_0xeb61('0x29')]=_[_0xeb61('0x2b')](db['Network'][_0xeb61('0x25')]);_0x552f5b[_0xeb61('0x2a')]=_[_0xeb61('0x2b')](_0x391350[_0xeb61('0x2a')]);_0x552f5b[_0xeb61('0x2c')]=_[_0xeb61('0x2d')](_0x552f5b['model'],_0x552f5b[_0xeb61('0x2a')]);_0x24fe47[_0xeb61('0x2e')]=_[_0xeb61('0x2d')](_0x552f5b[_0xeb61('0x29')],qs[_0xeb61('0x2f')](_0x391350[_0xeb61('0x2a')]['fields']));_0x24fe47['attributes']=_0x24fe47['attributes'][_0xeb61('0x30')]?_0x24fe47[_0xeb61('0x2e')]:_0x552f5b[_0xeb61('0x29')];if(_0x391350[_0xeb61('0x2a')][_0xeb61('0x3e')]){_0x24fe47[_0xeb61('0x3a')]=[{'all':!![]}];}_0x24fe47=_[_0xeb61('0x38')]({},_0x24fe47,_0x391350[_0xeb61('0x3f')]);return db[_0xeb61('0x24')]['find'](_0x24fe47)[_0xeb61('0x1e')](handleEntityNotFound(_0x45394a,null))[_0xeb61('0x1e')](respondWithResult(_0x45394a,null))[_0xeb61('0x15')](handleError(_0x45394a,null));};exports[_0xeb61('0x40')]=function(_0x58c160,_0x4e821d){var _0x58f65e;return db[_0xeb61('0x24')][_0xeb61('0x40')](_0x58c160['body'],{'raw':!![]})[_0xeb61('0x1e')](function(_0xac1756){_0x58f65e=_0xac1756;return db['Network'][_0xeb61('0x3b')]({'where':{'type':_0x58c160['body'][_0xeb61('0x27')]},'raw':!![]});})[_0xeb61('0x1e')](function(_0x18efb0){if(_0x58f65e[_0xeb61('0x27')][_0xeb61('0x41')]()=='STUN'){var _0x54ed07=fs[_0xeb61('0x42')](path[_0xeb61('0x43')](config[_0xeb61('0x44')],_0xeb61('0x45')),_0xeb61('0x46'));var _0x3c9e79=ejs[_0xeb61('0x47')](_0x54ed07,{'networks':_0x18efb0||[]});fs[_0xeb61('0x48')]('/etc/asterisk/stun_xcally.conf',_0x3c9e79);return respondWithRpcPromise('Reload',_0xeb61('0x40'),{'module':_0xeb61('0x49')});}else if(_0x58f65e[_0xeb61('0x27')]['toUpperCase']()=='TURN'){var _0x2dcdd0=fs[_0xeb61('0x42')](path[_0xeb61('0x43')](config[_0xeb61('0x44')],_0xeb61('0x4a')),_0xeb61('0x46'));var _0x323b01=ejs[_0xeb61('0x47')](_0x2dcdd0,{'networks':_0x18efb0||[]});fs[_0xeb61('0x48')](_0xeb61('0x4b'),_0x323b01);return respondWithRpcPromise(_0xeb61('0x4c'),_0xeb61('0x40'),{'module':_0xeb61('0x49')});}else{var _0x2c4065=fs[_0xeb61('0x42')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xeb61('0x46'));var _0x499a98=ejs[_0xeb61('0x47')](_0x2c4065,{'networks':_0x18efb0||[]});fs[_0xeb61('0x48')](util[_0xeb61('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x58c160[_0xeb61('0x4e')][_0xeb61('0x27')][_0xeb61('0x4f')]()),_0x499a98);return respondWithRpcPromise(_0xeb61('0x4c'),_0xeb61('0x40'),{'module':_0xeb61('0x50')});}})[_0xeb61('0x1e')](function(){return _0x58f65e;})[_0xeb61('0x1e')](respondWithResult(_0x4e821d,0xc9))[_0xeb61('0x15')](handleError(_0x4e821d,null));};exports[_0xeb61('0x51')]=function(_0x118dd3,_0x229c5d){var _0x2d1796;return db[_0xeb61('0x24')][_0xeb61('0x52')]({'where':{'id':_0x118dd3[_0xeb61('0x3d')]['id']}})['then'](handleEntityNotFound(_0x229c5d,null))[_0xeb61('0x1e')](saveUpdates(_0x118dd3['body'],null))[_0xeb61('0x1e')](function(_0xe8674e){if(_0xe8674e){_0x2d1796=_0xe8674e;return db[_0xeb61('0x24')]['findAll']({'where':{'type':_0x2d1796[_0xeb61('0x27')]},'raw':!![]});}return null;})[_0xeb61('0x1e')](function(_0x381770){if(_0x2d1796[_0xeb61('0x27')][_0xeb61('0x41')]()==_0xeb61('0x53')){var _0x292fa0=fs[_0xeb61('0x42')](path[_0xeb61('0x43')](config[_0xeb61('0x44')],_0xeb61('0x45')),_0xeb61('0x46'));var _0x6bcaec=ejs['render'](_0x292fa0,{'networks':_0x381770||[]});fs[_0xeb61('0x48')]('/etc/asterisk/stun_xcally.conf',_0x6bcaec);return respondWithRpcPromise(_0xeb61('0x4c'),_0xeb61('0x51'),{'module':_0xeb61('0x49')});}else if(_0x2d1796[_0xeb61('0x27')][_0xeb61('0x41')]()==_0xeb61('0x54')){var _0x5f2233=fs[_0xeb61('0x42')](path[_0xeb61('0x43')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xeb61('0x46'));var _0x31b0ef=ejs[_0xeb61('0x47')](_0x5f2233,{'networks':_0x381770||[]});fs[_0xeb61('0x48')]('/etc/asterisk/turn_xcally.conf',_0x31b0ef);return respondWithRpcPromise(_0xeb61('0x4c'),_0xeb61('0x51'),{'module':_0xeb61('0x49')});}else{var _0x3a944d=fs[_0xeb61('0x42')](path[_0xeb61('0x43')](config[_0xeb61('0x44')],_0xeb61('0x55')),'utf8');var _0x417880=ejs[_0xeb61('0x47')](_0x3a944d,{'networks':_0x381770||[]});fs[_0xeb61('0x48')](util[_0xeb61('0x4d')](_0xeb61('0x56'),_0x118dd3[_0xeb61('0x4e')][_0xeb61('0x27')][_0xeb61('0x4f')]()),_0x417880);return respondWithRpcPromise(_0xeb61('0x4c'),_0xeb61('0x51'),{'module':_0xeb61('0x50')});}})['then'](function(_0x5d0e32){if(_0x5d0e32){return _0x2d1796;}return null;})[_0xeb61('0x1e')](respondWithResult(_0x229c5d,null))['catch'](handleError(_0x229c5d,null));};exports[_0xeb61('0x57')]=function(_0x36befd,_0x4cb8d8){var _0x1a76d2;return db[_0xeb61('0x24')]['find']({'where':{'id':_0x36befd[_0xeb61('0x3d')]['id']}})[_0xeb61('0x1e')](function(_0x9c3ceb){_0x1a76d2=_0x9c3ceb;return _0x9c3ceb;})[_0xeb61('0x1e')](handleEntityNotFound(_0x4cb8d8,null))['then'](removeEntity(_0x4cb8d8,null))[_0xeb61('0x1e')](function(){if(_0x1a76d2){return db[_0xeb61('0x24')][_0xeb61('0x3b')]({'where':{'type':_0x1a76d2['type']},'raw':!![]});}})[_0xeb61('0x1e')](function(_0x5ca855){if(_0x1a76d2[_0xeb61('0x27')]['toUpperCase']()==_0xeb61('0x53')){var _0x20c2b9=fs[_0xeb61('0x42')](path['join'](config[_0xeb61('0x44')],_0xeb61('0x45')),_0xeb61('0x46'));var _0x227f94=ejs[_0xeb61('0x47')](_0x20c2b9,{'networks':_0x5ca855||[]});fs['writeFileSync'](_0xeb61('0x58'),_0x227f94);return respondWithRpcPromise(_0xeb61('0x4c'),_0xeb61('0x57'),{'module':'res_stun_monitor.so'});}else if(_0x1a76d2['type'][_0xeb61('0x41')]()==_0xeb61('0x54')){var _0x9fa192=fs[_0xeb61('0x42')](path[_0xeb61('0x43')](config[_0xeb61('0x44')],'server/files/templates/turn_multiple.ejs'),_0xeb61('0x46'));var _0x26e437=ejs['render'](_0x9fa192,{'networks':_0x5ca855||[]});fs[_0xeb61('0x48')]('/etc/asterisk/turn_xcally.conf',_0x26e437);return respondWithRpcPromise(_0xeb61('0x4c'),'destroy',{'module':_0xeb61('0x49')});}else{var _0xc19f0c=fs['readFileSync'](path['join'](config[_0xeb61('0x44')],'server/files/templates/network.ejs'),_0xeb61('0x46'));var _0x1cf180=ejs[_0xeb61('0x47')](_0xc19f0c,{'networks':_0x5ca855||[]});fs[_0xeb61('0x48')](util[_0xeb61('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x1a76d2[_0xeb61('0x27')]['toLowerCase']()),_0x1cf180);return respondWithRpcPromise('Reload','destroy',{'module':_0xeb61('0x50')});}})[_0xeb61('0x15')](handleError(_0x4cb8d8,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9cf06ec..cc38aeb 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 _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network','network'];(function(_0xcf6b84,_0x380ac5){var _0x5cf7d0=function(_0x80ff18){while(--_0x80ff18){_0xcf6b84['push'](_0xcf6b84['shift']());}};_0x5cf7d0(++_0x380ac5);}(_0x2dae,0xc3));var _0xe2da=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x2dae[_0x1d7037];return _0x4d6568;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec56=['define','Network','network','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x197a7b,_0x2785cd){var _0x2f853c=function(_0x50d160){while(--_0x50d160){_0x197a7b['push'](_0x197a7b['shift']());}};_0x2f853c(++_0x2785cd);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1c0012,_0xf44e65){_0x1c0012=_0x1c0012-0x0;var _0x54c666=_0xec56[_0x1c0012];return _0x54c666;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'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 8259a1c..83a28fa 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x2977d0,_0x269728){_0x2977d0=_0x2977d0-0x0;var _0x6b289=_0x7a54[_0x2977d0];return _0x6b289;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x36f77b,_0x3273c1){_0x36f77b=_0x36f77b-0x0;var _0x3ed4da=_0x7a54[_0x36f77b];return _0x3ed4da;};'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 34702c0..c484d70 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 _0x9f87=['update','destroy','delete','removeAnswers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getApplications','getInteractions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','put'];(function(_0x14ccdb,_0x3df5f5){var _0x431075=function(_0xd00356){while(--_0xd00356){_0x14ccdb['push'](_0x14ccdb['shift']());}};_0x431075(++_0x3df5f5);}(_0x9f87,0x9e));var _0x79f8=function(_0x5864c0,_0x3b5531){_0x5864c0=_0x5864c0-0x0;var _0x10cc0a=_0x9f87[_0x5864c0];return _0x10cc0a;};'use strict';var multer=require(_0x79f8('0x0'));var util=require('util');var path=require(_0x79f8('0x1'));var timeout=require('connect-timeout');var express=require(_0x79f8('0x2'));var router=express[_0x79f8('0x3')]();var fs_extra=require(_0x79f8('0x4'));var auth=require(_0x79f8('0x5'));var interaction=require(_0x79f8('0x6'));var config=require(_0x79f8('0x7'));var controller=require('./openchannelAccount.controller');router[_0x79f8('0x8')]('/',auth[_0x79f8('0x9')](),controller[_0x79f8('0xa')]);router[_0x79f8('0x8')](_0x79f8('0xb'),auth[_0x79f8('0x9')](),controller['describe']);router[_0x79f8('0x8')](_0x79f8('0xc'),auth[_0x79f8('0x9')](),controller[_0x79f8('0xd')]);router['get'](_0x79f8('0xe'),auth[_0x79f8('0x9')](),controller[_0x79f8('0xf')]);router[_0x79f8('0x8')]('/:id/canned_answers',auth[_0x79f8('0x9')](),controller[_0x79f8('0x10')]);router[_0x79f8('0x8')]('/:id/applications',auth[_0x79f8('0x9')](),controller[_0x79f8('0x11')]);router[_0x79f8('0x8')]('/:id/interactions',auth[_0x79f8('0x9')](),controller[_0x79f8('0x12')]);router['get']('/:id/users',auth[_0x79f8('0x9')](),controller[_0x79f8('0x13')]);router[_0x79f8('0x14')]('/',auth[_0x79f8('0x9')](),controller[_0x79f8('0x15')]);router[_0x79f8('0x14')](_0x79f8('0xe'),auth['isAuthenticated'](),controller[_0x79f8('0x16')]);router[_0x79f8('0x14')](_0x79f8('0x17'),auth[_0x79f8('0x9')](),controller[_0x79f8('0x18')]);router[_0x79f8('0x14')](_0x79f8('0x19'),controller[_0x79f8('0x1a')]);router['post'](_0x79f8('0x1b'),auth[_0x79f8('0x9')](),controller[_0x79f8('0x1c')]);router[_0x79f8('0x14')]('/:id/users',auth[_0x79f8('0x9')](),controller[_0x79f8('0x1d')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x79f8('0x1e')]);router[_0x79f8('0x1f')]('/:id',auth[_0x79f8('0x9')](),controller[_0x79f8('0x20')]);router['delete'](_0x79f8('0xc'),auth[_0x79f8('0x9')](),controller[_0x79f8('0x21')]);router[_0x79f8('0x22')](_0x79f8('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x79f8('0x17'),auth['isAuthenticated'](),controller[_0x79f8('0x23')]);router[_0x79f8('0x22')]('/:id/users',auth[_0x79f8('0x9')](),controller[_0x79f8('0x24')]);module[_0x79f8('0x25')]=router; \ No newline at end of file +var _0x8d31=['send','put','/:id','update','delete','destroy','removeAnswers','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer','notify','addAgents','/:id/send'];(function(_0x52a8da,_0x5d9213){var _0x5e9460=function(_0x191193){while(--_0x191193){_0x52a8da['push'](_0x52a8da['shift']());}};_0x5e9460(++_0x5d9213);}(_0x8d31,0x1b4));var _0x18d3=function(_0x1ddfd9,_0x4bb072){_0x1ddfd9=_0x1ddfd9-0x0;var _0x36afe5=_0x8d31[_0x1ddfd9];return _0x36afe5;};'use strict';var multer=require('multer');var util=require(_0x18d3('0x0'));var path=require(_0x18d3('0x1'));var timeout=require(_0x18d3('0x2'));var express=require(_0x18d3('0x3'));var router=express[_0x18d3('0x4')]();var fs_extra=require(_0x18d3('0x5'));var auth=require(_0x18d3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x18d3('0x7'));var controller=require('./openchannelAccount.controller');router[_0x18d3('0x8')]('/',auth[_0x18d3('0x9')](),controller[_0x18d3('0xa')]);router[_0x18d3('0x8')](_0x18d3('0xb'),auth[_0x18d3('0x9')](),controller[_0x18d3('0xc')]);router[_0x18d3('0x8')]('/:id',auth[_0x18d3('0x9')](),controller[_0x18d3('0xd')]);router[_0x18d3('0x8')](_0x18d3('0xe'),auth[_0x18d3('0x9')](),controller['getDispositions']);router[_0x18d3('0x8')](_0x18d3('0xf'),auth[_0x18d3('0x9')](),controller['getAnswers']);router[_0x18d3('0x8')]('/:id/applications',auth[_0x18d3('0x9')](),controller['getApplications']);router[_0x18d3('0x8')](_0x18d3('0x10'),auth[_0x18d3('0x9')](),controller[_0x18d3('0x11')]);router['get'](_0x18d3('0x12'),auth['isAuthenticated'](),controller[_0x18d3('0x13')]);router['post']('/',auth[_0x18d3('0x9')](),controller[_0x18d3('0x14')]);router[_0x18d3('0x15')]('/:id/dispositions',auth[_0x18d3('0x9')](),controller['addDisposition']);router[_0x18d3('0x15')]('/:id/canned_answers',auth[_0x18d3('0x9')](),controller[_0x18d3('0x16')]);router[_0x18d3('0x15')]('/:id/notify',controller[_0x18d3('0x17')]);router[_0x18d3('0x15')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x18d3('0x15')](_0x18d3('0x12'),auth['isAuthenticated'](),controller[_0x18d3('0x18')]);router[_0x18d3('0x15')](_0x18d3('0x19'),auth[_0x18d3('0x9')](),controller[_0x18d3('0x1a')]);router[_0x18d3('0x1b')](_0x18d3('0x1c'),auth[_0x18d3('0x9')](),controller[_0x18d3('0x1d')]);router[_0x18d3('0x1e')](_0x18d3('0x1c'),auth[_0x18d3('0x9')](),controller[_0x18d3('0x1f')]);router[_0x18d3('0x1e')](_0x18d3('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x18d3('0x1e')](_0x18d3('0xf'),auth['isAuthenticated'](),controller[_0x18d3('0x20')]);router['delete'](_0x18d3('0x12'),auth[_0x18d3('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index bd820ac..19d64a0 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 _0x5926=['sequelize','exports','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x496c61,_0x178551){var _0x2d2bbd=function(_0xbb98c7){while(--_0xbb98c7){_0x496c61['push'](_0x496c61['shift']());}};_0x2d2bbd(++_0x178551);}(_0x5926,0xd8));var _0x6592=function(_0x20ce78,_0x24b264){_0x20ce78=_0x20ce78-0x0;var _0x5f3207=_0x5926[_0x20ce78];return _0x5f3207;};'use strict';var Sequelize=require(_0x6592('0x0'));var rs=require('randomstring');module[_0x6592('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6592('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6592('0x3')]();}},'replyUri':{'type':Sequelize[_0x6592('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6592('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6592('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6592('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6592('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6592('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6592('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6592('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6592('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6592('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x6592('0x5')],'defaultValue':![],'comment':_0x6592('0x8'),'set':function(_0x3b5490){if(!_0x3b5490)this[_0x6592('0x9')](_0x6592('0xa'),null);this['setDataValue'](_0x6592('0xb'),_0x3b5490);}}}; \ No newline at end of file +var _0x54b8=['sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x59faad,_0x1b6026){var _0x1162eb=function(_0xa97f0b){while(--_0xa97f0b){_0x59faad['push'](_0x59faad['shift']());}};_0x1162eb(++_0x1b6026);}(_0x54b8,0xee));var _0x854b=function(_0x16c054,_0x181e46){_0x16c054=_0x16c054-0x0;var _0x290fba=_0x54b8[_0x16c054];return _0x290fba;};'use strict';var Sequelize=require(_0x854b('0x0'));var rs=require(_0x854b('0x1'));module['exports']={'name':{'type':Sequelize[_0x854b('0x2')],'unique':_0x854b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x854b('0x2')],'defaultValue':function(){return rs[_0x854b('0x4')]();}},'replyUri':{'type':Sequelize[_0x854b('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x854b('0x5')],'defaultValue':function(){return _0x854b('0x6');}},'notificationSound':{'type':Sequelize[_0x854b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x854b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x854b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x854b('0x2')]},'queueTransfer':{'type':Sequelize[_0x854b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x854b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x854b('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x854b('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x854b('0x7')],'defaultValue':![],'comment':_0x854b('0xa'),'set':function(_0x5044cb){if(!_0x5044cb)this[_0x854b('0xb')](_0x854b('0xc'),null);this['setDataValue'](_0x854b('0xd'),_0x5044cb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 82a954a..20437e5 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 _0xb07f=['updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','finally','getApplications','getInteractions','CmContact','Contact','Owner','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','emit','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','options','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x3e851d,_0x26792c){var _0x12cfa9=function(_0x547f2d){while(--_0x547f2d){_0x3e851d['push'](_0x3e851d['shift']());}};_0x12cfa9(++_0x26792c);}(_0xb07f,0x109));var _0xfb07=function(_0x496066,_0x39b14f){_0x496066=_0x496066-0x0;var _0x2419f9=_0xb07f[_0x496066];return _0x2419f9;};'use strict';var emlformat=require(_0xfb07('0x0'));var rimraf=require(_0xfb07('0x1'));var zipdir=require(_0xfb07('0x2'));var jsonpatch=require(_0xfb07('0x3'));var rp=require(_0xfb07('0x4'));var moment=require(_0xfb07('0x5'));var BPromise=require(_0xfb07('0x6'));var Mustache=require(_0xfb07('0x7'));var util=require(_0xfb07('0x8'));var path=require(_0xfb07('0x9'));var sox=require(_0xfb07('0xa'));var csv=require('to-csv');var ejs=require(_0xfb07('0xb'));var fs=require('fs');var fs_extra=require(_0xfb07('0xc'));var _=require(_0xfb07('0xd'));var squel=require(_0xfb07('0xe'));var crypto=require(_0xfb07('0xf'));var jsforce=require(_0xfb07('0x10'));var deskjs=require(_0xfb07('0x11'));var toCsv=require(_0xfb07('0x12'));var querystring=require(_0xfb07('0x13'));var Papa=require(_0xfb07('0x14'));var Redis=require(_0xfb07('0x15'));var authService=require(_0xfb07('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb07('0x17'))(_0xfb07('0x18'));var utils=require('../../config/utils');var config=require(_0xfb07('0x19'));var licenseUtil=require(_0xfb07('0x1a'));var db=require(_0xfb07('0x1b'))['db'];config[_0xfb07('0x1c')]=_[_0xfb07('0x1d')](config[_0xfb07('0x1c')],{'host':_0xfb07('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb07('0x1c')]));require(_0xfb07('0x1f'))[_0xfb07('0x20')](socket);var jayson=require(_0xfb07('0x21'));var client=jayson[_0xfb07('0x22')][_0xfb07('0x23')]({'port':0x232c});var client9002=jayson[_0xfb07('0x22')][_0xfb07('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2363d6,_0x6a14e0,_0x3dde76,_0x1cfc43){return new BPromise(function(_0x1e42c4,_0x12854c){var _0x4ebcc3=_0x1cfc43||client;return _0x4ebcc3['request'](_0x2363d6,_0x3dde76)[_0xfb07('0x24')](function(_0x44b9c4){logger[_0xfb07('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x6a14e0,_0xfb07('0x26'));logger[_0xfb07('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x6a14e0,'request\x20sent',JSON[_0xfb07('0x28')](_0x44b9c4));if(_0x44b9c4[_0xfb07('0x29')]){if(_0x44b9c4[_0xfb07('0x29')][_0xfb07('0x2a')]===0x1f4){logger[_0xfb07('0x29')](_0xfb07('0x2b'),_0x6a14e0,_0x44b9c4[_0xfb07('0x29')][_0xfb07('0x2c')]);return _0x12854c(_0x44b9c4[_0xfb07('0x29')]['message']);}logger[_0xfb07('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x6a14e0,_0x44b9c4[_0xfb07('0x29')][_0xfb07('0x2c')]);return _0x1e42c4(_0x44b9c4[_0xfb07('0x29')][_0xfb07('0x2c')]);}else{logger[_0xfb07('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x6a14e0,_0xfb07('0x26'));_0x1e42c4(_0x44b9c4[_0xfb07('0x2d')][_0xfb07('0x2c')]);}})[_0xfb07('0x2e')](function(_0x3b14fa){logger[_0xfb07('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x6a14e0,_0x3b14fa);_0x12854c(_0x3b14fa);});});}function respondWithStatusCode(_0x36d6f3,_0x28f33a){_0x28f33a=_0x28f33a||0xcc;return function(_0x581508){if(_0x581508){return _0x36d6f3[_0xfb07('0x2f')](_0x28f33a);}return _0x36d6f3[_0xfb07('0x30')](_0x28f33a)[_0xfb07('0x31')]();};}function respondWithResult(_0x149ac0,_0x46927a){_0x46927a=_0x46927a||0xc8;return function(_0x2b0650){if(_0x2b0650){return _0x149ac0[_0xfb07('0x30')](_0x46927a)[_0xfb07('0x32')](_0x2b0650);}};}function respondWithFilteredResult(_0x95f1d,_0x27668f){return function(_0x1332e1){if(_0x1332e1){var _0x49b06e=typeof _0x27668f[_0xfb07('0x33')]===_0xfb07('0x34')&&typeof _0x27668f[_0xfb07('0x35')]===_0xfb07('0x34');var _0x5dd4c9=_0x1332e1[_0xfb07('0x36')];var _0xd5290c=_0x49b06e?0x0:_0x27668f['offset'];var _0x36da2a=_0x49b06e?_0x1332e1['count']:_0x27668f[_0xfb07('0x33')]+_0x27668f['limit'];var _0x56b48c;if(_0x36da2a>=_0x5dd4c9){_0x36da2a=_0x5dd4c9;_0x56b48c=0xc8;}else{_0x56b48c=0xce;}_0x95f1d['status'](_0x56b48c);return _0x95f1d[_0xfb07('0x37')](_0xfb07('0x38'),_0xd5290c+'-'+_0x36da2a+'/'+_0x5dd4c9)[_0xfb07('0x32')](_0x1332e1);}return null;};}function patchUpdates(_0x4452d7){return function(_0xcc81ce){try{jsonpatch[_0xfb07('0x39')](_0xcc81ce,_0x4452d7,!![]);}catch(_0x586c15){return BPromise['reject'](_0x586c15);}return _0xcc81ce[_0xfb07('0x3a')]();};}function saveUpdates(_0x1cccdd,_0x394e67){return function(_0x3ea36f){if(_0x3ea36f){return _0x3ea36f['update'](_0x1cccdd)['then'](function(_0x22ef8c){return _0x22ef8c;});}return null;};}function removeEntity(_0x3e0d11,_0x4757f2){return function(_0x1162ec){if(_0x1162ec){return _0x1162ec[_0xfb07('0x3b')]()[_0xfb07('0x24')](function(){var _0x4b61d7=_0x1162ec['get']({'plain':!![]});var _0x4a5055=_0xfb07('0x3c');return db[_0xfb07('0x3d')][_0xfb07('0x3b')]({'where':{'type':_0x4a5055,'resourceId':_0x4b61d7['id']}})[_0xfb07('0x24')](function(){return _0x1162ec;});})['then'](function(){_0x3e0d11['status'](0xcc)[_0xfb07('0x31')]();});}};}function handleEntityNotFound(_0x1d0132,_0x59c27d){return function(_0x56a3eb){if(!_0x56a3eb){_0x1d0132['sendStatus'](0x194);}return _0x56a3eb;};}function handleError(_0x23e510,_0x10cd8b){_0x10cd8b=_0x10cd8b||0x1f4;return function(_0x55de52){logger['error'](_0x55de52[_0xfb07('0x3e')]);if(_0x55de52[_0xfb07('0x3f')]){delete _0x55de52[_0xfb07('0x3f')];}_0x23e510[_0xfb07('0x30')](_0x10cd8b)[_0xfb07('0x40')](_0x55de52);};}exports['index']=function(_0x1644e8,_0x122365){var _0xac769b={'include':[{'model':db['Pause'],'as':_0xfb07('0x41')}]},_0x39aa48={},_0x5a3a98={'count':0x0,'rows':[]};var _0x7a274c=_[_0xfb07('0x42')](db[_0xfb07('0x43')][_0xfb07('0x44')],function(_0x37de83){return{'name':_0x37de83[_0xfb07('0x45')],'type':_0x37de83['type']['key']};});_0x39aa48[_0xfb07('0x46')]=_[_0xfb07('0x42')](_0x7a274c,'name');_0x39aa48['query']=_[_0xfb07('0x47')](_0x1644e8[_0xfb07('0x48')]);_0x39aa48[_0xfb07('0x49')]=_['intersection'](_0x39aa48['model'],_0x39aa48[_0xfb07('0x48')]);_0xac769b[_0xfb07('0x4a')]=_[_0xfb07('0x4b')](_0x39aa48[_0xfb07('0x46')],qs[_0xfb07('0x4c')](_0x1644e8[_0xfb07('0x48')][_0xfb07('0x4c')]));_0xac769b[_0xfb07('0x4a')]=_0xac769b[_0xfb07('0x4a')]['length']?_0xac769b[_0xfb07('0x4a')]:_0x39aa48[_0xfb07('0x46')];if(!_0x1644e8[_0xfb07('0x48')][_0xfb07('0x4d')](_0xfb07('0x4e'))){_0xac769b[_0xfb07('0x35')]=qs[_0xfb07('0x35')](_0x1644e8[_0xfb07('0x48')][_0xfb07('0x35')]);_0xac769b[_0xfb07('0x33')]=qs['offset'](_0x1644e8['query'][_0xfb07('0x33')]);}_0xac769b[_0xfb07('0x4f')]=qs['sort'](_0x1644e8[_0xfb07('0x48')][_0xfb07('0x50')]);_0xac769b[_0xfb07('0x51')]=qs[_0xfb07('0x49')](_[_0xfb07('0x52')](_0x1644e8['query'],_0x39aa48['filters']),_0x7a274c);if(_0x1644e8[_0xfb07('0x48')][_0xfb07('0x53')]){_0xac769b[_0xfb07('0x51')]=_[_0xfb07('0x54')](_0xac769b[_0xfb07('0x51')],{'$or':_[_0xfb07('0x42')](_0x7a274c,function(_0x36744a){if(_0x36744a[_0xfb07('0x55')]!==_0xfb07('0x56')){var _0x28e66f={};_0x28e66f[_0x36744a['name']]={'$like':'%'+_0x1644e8['query']['filter']+'%'};return _0x28e66f;}})});}_0xac769b=_[_0xfb07('0x54')]({},_0xac769b,_0x1644e8['options']);var _0x2397f8={'where':_0xac769b[_0xfb07('0x51')]};return db[_0xfb07('0x43')][_0xfb07('0x36')](_0x2397f8)[_0xfb07('0x24')](function(_0x18c7ab){_0x5a3a98['count']=_0x18c7ab;if(_0x1644e8[_0xfb07('0x48')][_0xfb07('0x57')]){_0xac769b[_0xfb07('0x58')]=[{'all':!![]}];}return db[_0xfb07('0x43')][_0xfb07('0x59')](_0xac769b);})['then'](function(_0x3cfb89){_0x5a3a98[_0xfb07('0x5a')]=_0x3cfb89;return _0x5a3a98;})[_0xfb07('0x24')](respondWithFilteredResult(_0x122365,_0xac769b))[_0xfb07('0x2e')](handleError(_0x122365,null));};exports[_0xfb07('0x5b')]=function(_0x5179c2,_0x25787c){var _0x42ea0b={'raw':![],'where':{'id':_0x5179c2[_0xfb07('0x5c')]['id']},'include':[{'model':db[_0xfb07('0x5d')],'as':'mandatoryDispositionPause'}]},_0x38b30e={};_0x38b30e[_0xfb07('0x46')]=_[_0xfb07('0x47')](db[_0xfb07('0x43')][_0xfb07('0x44')]);_0x38b30e['query']=_[_0xfb07('0x47')](_0x5179c2[_0xfb07('0x48')]);_0x38b30e[_0xfb07('0x49')]=_[_0xfb07('0x4b')](_0x38b30e[_0xfb07('0x46')],_0x38b30e[_0xfb07('0x48')]);_0x42ea0b[_0xfb07('0x4a')]=_[_0xfb07('0x4b')](_0x38b30e[_0xfb07('0x46')],qs[_0xfb07('0x4c')](_0x5179c2['query'][_0xfb07('0x4c')]));_0x42ea0b['attributes']=_0x42ea0b[_0xfb07('0x4a')][_0xfb07('0x5e')]?_0x42ea0b[_0xfb07('0x4a')]:_0x38b30e[_0xfb07('0x46')];if(_0x5179c2[_0xfb07('0x48')][_0xfb07('0x57')]){_0x42ea0b[_0xfb07('0x58')]=[{'all':!![]}];}_0x42ea0b=_['merge']({},_0x42ea0b,_0x5179c2['options']);return db['OpenchannelAccount'][_0xfb07('0x5f')](_0x42ea0b)[_0xfb07('0x24')](handleEntityNotFound(_0x25787c,null))[_0xfb07('0x24')](respondWithResult(_0x25787c,null))['catch'](handleError(_0x25787c,null));};exports[_0xfb07('0x60')]=function(_0x4ef1a4,_0x9d8f4c){return db[_0xfb07('0x43')]['create'](_0x4ef1a4[_0xfb07('0x61')],{})[_0xfb07('0x24')](function(_0x18d0de){var _0xc122ae=_0x4ef1a4[_0xfb07('0x62')][_0xfb07('0x63')]({'plain':!![]});if(!_0xc122ae)throw new Error(_0xfb07('0x64'));if(_0xc122ae[_0xfb07('0x65')]===_0xfb07('0x62')){var _0xfaa64b=_0x18d0de[_0xfb07('0x63')]({'plain':!![]});var _0x338e85=_0xfb07('0x3c');return db[_0xfb07('0x66')]['find']({'where':{'name':_0x338e85,'userProfileId':_0xc122ae[_0xfb07('0x67')]},'raw':!![]})[_0xfb07('0x24')](function(_0x56fb6c){if(_0x56fb6c&&_0x56fb6c['autoAssociation']===0x0){return db[_0xfb07('0x3d')][_0xfb07('0x60')]({'name':_0xfaa64b[_0xfb07('0x3f')],'resourceId':_0xfaa64b['id'],'type':_0x56fb6c['name'],'sectionId':_0x56fb6c['id']},{})[_0xfb07('0x24')](function(){return _0x18d0de;});}else{return _0x18d0de;}})['catch'](function(_0x4e323f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e323f);throw _0x4e323f;});}return _0x18d0de;})[_0xfb07('0x24')](respondWithResult(_0x9d8f4c,0xc9))[_0xfb07('0x2e')](handleError(_0x9d8f4c,null));};exports[_0xfb07('0x68')]=function(_0x3ebfa9,_0x469ad){if(_0x3ebfa9[_0xfb07('0x61')]['id']){delete _0x3ebfa9[_0xfb07('0x61')]['id'];}return db['OpenchannelAccount'][_0xfb07('0x5f')]({'where':{'id':_0x3ebfa9[_0xfb07('0x5c')]['id']},'include':[{'model':db[_0xfb07('0x5d')],'as':_0xfb07('0x41')}]})[_0xfb07('0x24')](handleEntityNotFound(_0x469ad,null))[_0xfb07('0x24')](saveUpdates(_0x3ebfa9[_0xfb07('0x61')],null))[_0xfb07('0x24')](respondWithResult(_0x469ad,null))['catch'](handleError(_0x469ad,null));};exports[_0xfb07('0x3b')]=function(_0x3eea5f,_0x3831bf){return db[_0xfb07('0x43')][_0xfb07('0x5f')]({'where':{'id':_0x3eea5f['params']['id']}})['then'](handleEntityNotFound(_0x3831bf,null))[_0xfb07('0x24')](removeEntity(_0x3831bf,null))[_0xfb07('0x2e')](handleError(_0x3831bf,null));};exports['describe']=function(_0x18ccd6,_0x311c6d){return db[_0xfb07('0x43')][_0xfb07('0x69')]()[_0xfb07('0x24')](respondWithResult(_0x311c6d,null))[_0xfb07('0x2e')](handleError(_0x311c6d,null));};exports[_0xfb07('0x6a')]=function(_0x59cef1,_0x4c1238,_0x1a64e0){if(_0x59cef1['body']['id']){delete _0x59cef1[_0xfb07('0x61')]['id'];}return db[_0xfb07('0x43')][_0xfb07('0x5f')]({'where':{'id':_0x59cef1[_0xfb07('0x5c')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x4c1238,null))[_0xfb07('0x24')](function(_0x40892d){if(_0x40892d){_0x59cef1[_0xfb07('0x61')][_0xfb07('0x6b')]=_0x40892d['id'];return db['Disposition'][_0xfb07('0x60')](_0x59cef1[_0xfb07('0x61')]);}})[_0xfb07('0x24')](respondWithResult(_0x4c1238,null))[_0xfb07('0x2e')](handleError(_0x4c1238,null));};exports[_0xfb07('0x6c')]=function(_0x5e0399,_0x1e63aa,_0xa63ed5){var _0x23125f={'raw':![],'where':{}};var _0xdf1463={};var _0x572afa={'count':0x0,'rows':[]};return db[_0xfb07('0x43')]['findOne']({'where':{'id':_0x5e0399['params']['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x1e63aa,null))[_0xfb07('0x24')](function(_0x1ac120){if(_0x1ac120){_0xdf1463[_0xfb07('0x46')]=_[_0xfb07('0x47')](db[_0xfb07('0x6d')]['rawAttributes']);_0xdf1463[_0xfb07('0x48')]=_[_0xfb07('0x47')](_0x5e0399[_0xfb07('0x48')]);_0xdf1463[_0xfb07('0x49')]=_[_0xfb07('0x4b')](_0xdf1463[_0xfb07('0x46')],_0xdf1463[_0xfb07('0x48')]);_0x23125f[_0xfb07('0x4a')]=_[_0xfb07('0x4b')](_0xdf1463[_0xfb07('0x46')],qs[_0xfb07('0x4c')](_0x5e0399[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x23125f[_0xfb07('0x4a')]=_0x23125f[_0xfb07('0x4a')][_0xfb07('0x5e')]?_0x23125f['attributes']:_0xdf1463[_0xfb07('0x46')];if(!_0x5e0399[_0xfb07('0x48')][_0xfb07('0x4d')](_0xfb07('0x4e'))){_0x23125f[_0xfb07('0x35')]=qs[_0xfb07('0x35')](_0x5e0399[_0xfb07('0x48')][_0xfb07('0x35')]);_0x23125f[_0xfb07('0x33')]=qs[_0xfb07('0x33')](_0x5e0399[_0xfb07('0x48')]['offset']);}_0x23125f['order']=qs[_0xfb07('0x50')](_0x5e0399[_0xfb07('0x48')][_0xfb07('0x50')]);_0x23125f['where']=qs[_0xfb07('0x49')](_[_0xfb07('0x52')](_0x5e0399[_0xfb07('0x48')],_0xdf1463['filters']));_0x23125f[_0xfb07('0x51')][_0xfb07('0x6b')]=_0x1ac120['id'];if(_0x5e0399[_0xfb07('0x48')][_0xfb07('0x53')]){_0x23125f['where']=_[_0xfb07('0x54')](_0x23125f[_0xfb07('0x51')],{'$or':_[_0xfb07('0x42')](_0x23125f[_0xfb07('0x4a')],function(_0x5b91b0){var _0x3f0842={};_0x3f0842[_0x5b91b0]={'$like':'%'+_0x5e0399[_0xfb07('0x48')]['filter']+'%'};return _0x3f0842;})});}_0x23125f=_['merge']({},_0x23125f,_0x5e0399[_0xfb07('0x6e')]);return db[_0xfb07('0x6d')]['count']({'where':_0x23125f['where']})[_0xfb07('0x24')](function(_0x22b68c){_0x572afa[_0xfb07('0x36')]=_0x22b68c;if(_0x5e0399['query'][_0xfb07('0x57')]){_0x23125f['include']=[{'all':!![]}];}return db[_0xfb07('0x6d')][_0xfb07('0x59')](_0x23125f);})[_0xfb07('0x24')](function(_0x149286){_0x572afa[_0xfb07('0x5a')]=_0x149286;return _0x572afa;});}})[_0xfb07('0x24')](respondWithFilteredResult(_0x1e63aa,_0x23125f))['catch'](handleError(_0x1e63aa,null));};exports['removeDispositions']=function(_0x27e5d4,_0x3c7319,_0x1e0029){return db[_0xfb07('0x43')]['find']({'where':{'id':_0x27e5d4[_0xfb07('0x5c')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x3c7319,null))[_0xfb07('0x24')](function(_0x1a1edf){if(_0x1a1edf){return _0x1a1edf[_0xfb07('0x6f')](_0x27e5d4[_0xfb07('0x48')]['ids']);}})[_0xfb07('0x24')](respondWithStatusCode(_0x3c7319,null))[_0xfb07('0x2e')](handleError(_0x3c7319,null));};exports[_0xfb07('0x70')]=function(_0x2ebe85,_0x257f9f,_0x1eb6f1){if(_0x2ebe85[_0xfb07('0x61')]['id']){delete _0x2ebe85[_0xfb07('0x61')]['id'];}return db[_0xfb07('0x43')]['find']({'where':{'id':_0x2ebe85[_0xfb07('0x5c')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x257f9f,null))[_0xfb07('0x24')](function(_0x51482c){if(_0x51482c){_0x2ebe85[_0xfb07('0x61')][_0xfb07('0x6b')]=_0x51482c['id'];return db['CannedAnswer'][_0xfb07('0x60')](_0x2ebe85[_0xfb07('0x61')]);}})[_0xfb07('0x24')](respondWithResult(_0x257f9f,null))[_0xfb07('0x2e')](handleError(_0x257f9f,null));};exports['getAnswers']=function(_0x13a626,_0x3600f8,_0x713031){var _0x40f78a={'raw':![],'where':{}};var _0x3a75dd={};var _0x4f3e2e={'count':0x0,'rows':[]};return db[_0xfb07('0x43')]['findOne']({'where':{'id':_0x13a626[_0xfb07('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3600f8,null))[_0xfb07('0x24')](function(_0x3f36f0){if(_0x3f36f0){_0x3a75dd[_0xfb07('0x46')]=_[_0xfb07('0x47')](db[_0xfb07('0x71')][_0xfb07('0x44')]);_0x3a75dd[_0xfb07('0x48')]=_[_0xfb07('0x47')](_0x13a626[_0xfb07('0x48')]);_0x3a75dd[_0xfb07('0x49')]=_[_0xfb07('0x4b')](_0x3a75dd[_0xfb07('0x46')],_0x3a75dd[_0xfb07('0x48')]);_0x40f78a[_0xfb07('0x4a')]=_['intersection'](_0x3a75dd[_0xfb07('0x46')],qs['fields'](_0x13a626[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x40f78a[_0xfb07('0x4a')]=_0x40f78a[_0xfb07('0x4a')]['length']?_0x40f78a[_0xfb07('0x4a')]:_0x3a75dd[_0xfb07('0x46')];if(!_0x13a626[_0xfb07('0x48')][_0xfb07('0x4d')]('nolimit')){_0x40f78a[_0xfb07('0x35')]=qs['limit'](_0x13a626[_0xfb07('0x48')][_0xfb07('0x35')]);_0x40f78a[_0xfb07('0x33')]=qs[_0xfb07('0x33')](_0x13a626[_0xfb07('0x48')][_0xfb07('0x33')]);}_0x40f78a[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x13a626[_0xfb07('0x48')][_0xfb07('0x50')]);_0x40f78a['where']=qs[_0xfb07('0x49')](_[_0xfb07('0x52')](_0x13a626['query'],_0x3a75dd[_0xfb07('0x49')]));_0x40f78a[_0xfb07('0x51')][_0xfb07('0x6b')]=_0x3f36f0['id'];if(_0x13a626['query'][_0xfb07('0x53')]){_0x40f78a['where']=_[_0xfb07('0x54')](_0x40f78a[_0xfb07('0x51')],{'$or':_[_0xfb07('0x42')](_0x40f78a[_0xfb07('0x4a')],function(_0x4220b8){var _0x2b1b3a={};_0x2b1b3a[_0x4220b8]={'$like':'%'+_0x13a626['query'][_0xfb07('0x53')]+'%'};return _0x2b1b3a;})});}_0x40f78a=_[_0xfb07('0x54')]({},_0x40f78a,_0x13a626['options']);return db[_0xfb07('0x71')][_0xfb07('0x36')]({'where':_0x40f78a[_0xfb07('0x51')]})[_0xfb07('0x24')](function(_0xb6f6b3){_0x4f3e2e[_0xfb07('0x36')]=_0xb6f6b3;if(_0x13a626['query'][_0xfb07('0x57')]){_0x40f78a[_0xfb07('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfb07('0x59')](_0x40f78a);})[_0xfb07('0x24')](function(_0x1eebf4){_0x4f3e2e[_0xfb07('0x5a')]=_0x1eebf4;return _0x4f3e2e;});}})[_0xfb07('0x24')](respondWithFilteredResult(_0x3600f8,_0x40f78a))[_0xfb07('0x2e')](handleError(_0x3600f8,null));};exports[_0xfb07('0x72')]=function(_0x24f77c,_0x2a7d25,_0x3a6fde){return db[_0xfb07('0x43')][_0xfb07('0x5f')]({'where':{'id':_0x24f77c[_0xfb07('0x5c')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x2a7d25,null))[_0xfb07('0x24')](function(_0x11bbb0){if(_0x11bbb0){return _0x11bbb0[_0xfb07('0x72')](_0x24f77c[_0xfb07('0x48')][_0xfb07('0x73')]);}})[_0xfb07('0x24')](respondWithStatusCode(_0x2a7d25,null))[_0xfb07('0x2e')](handleError(_0x2a7d25,null));};exports[_0xfb07('0x74')]=function(_0x2ded6f,_0xa3a9ea,_0x2c35db){var _0xd26714={'body':_0x2ded6f['body'],'channel':_0xfb07('0x75')};var _0x5f9e06=[];var _0x129af1=[];var _0xb1ac6f={};var _0x1e9bc9=![];return db['CmContact'][_0xfb07('0x69')]()[_0xfb07('0x24')](function(_0xec7d03){if(!_0xec7d03){throw new db[(_0xfb07('0x76'))][(_0xfb07('0x77'))](_0xfb07('0x78'));}_0x5f9e06=_[_0xfb07('0x79')](_[_0xfb07('0x47')](_0xec7d03),[_0xfb07('0x7a'),_0xfb07('0x7b')]);_0x129af1=_[_0xfb07('0x79')](_[_0xfb07('0x47')](_0xec7d03),[_0xfb07('0x7a'),'updatedAt',_0xfb07('0x7c'),_0xfb07('0x7d')]);if(_0x2ded6f[_0xfb07('0x61')]['id']){delete _0x2ded6f[_0xfb07('0x61')]['id'];}if(_[_0xfb07('0x7e')](_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x7f')])){throw new db[(_0xfb07('0x76'))][(_0xfb07('0x77'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x61')])||_0x2ded6f[_0xfb07('0x61')]['body']===''){throw new db['Sequelize'][(_0xfb07('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfb07('0x7e')](_0x2ded6f['body'][_0xfb07('0x80')])){throw new db['Sequelize']['ValidationError'](_0xfb07('0x81')+_0x129af1);}if(!_[_0xfb07('0x82')](_0x129af1,_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x80')])){throw new db[(_0xfb07('0x76'))][(_0xfb07('0x77'))](_0xfb07('0x83')+_0x129af1);}_0xb1ac6f[_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x80')]]=_0x2ded6f[_0xfb07('0x61')]['from'];})[_0xfb07('0x24')](function(){return db[_0xfb07('0x43')][_0xfb07('0x5f')]({'where':{'id':_0x2ded6f['params']['id']},'include':[{'model':db[_0xfb07('0x84')],'as':_0xfb07('0x85'),'include':[{'model':db['CmContact'],'as':_0xfb07('0x86'),'where':_0xb1ac6f,'limit':0x1,'order':[[_0xfb07('0x7b'),_0xfb07('0x87')]]}]},{'model':db[_0xfb07('0x88')],'as':_0xfb07('0x89')}]});})[_0xfb07('0x24')](handleEntityNotFound(_0xa3a9ea,null))['then'](function(_0x2cc111){if(_0x2cc111&&_0x2cc111['List']){_0xd26714[_0xfb07('0x8a')]=_0x2cc111;_0xd26714[_0xfb07('0x8b')]=_0x2cc111['Applications'];_0xd26714['list']=_0x2cc111[_0xfb07('0x85')];_0xd26714['applications']=_[_0xfb07('0x8c')](_0xd26714['applications'],[_0xfb07('0x8d')],[_0xfb07('0x8e')]);if(_0xd26714[_0xfb07('0x8a')][_0xfb07('0x89')]){delete _0xd26714[_0xfb07('0x8a')]['Applications'];}if(_0xd26714['account'][_0xfb07('0x85')]&&_0xd26714[_0xfb07('0x8a')][_0xfb07('0x85')][_0xfb07('0x86')]['length']){return _0xd26714['account'][_0xfb07('0x85')][_0xfb07('0x86')][0x0];}var _0x36b854=_[_0xfb07('0x1d')](_0x2ded6f['body'],{'firstName':_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x7f')],'ListId':_0x2cc111[_0xfb07('0x7d')]});_0x36b854[_0x2ded6f['body'][_0xfb07('0x80')]]=_0x2ded6f['body'][_0xfb07('0x7f')];return db['CmContact']['create'](_0x36b854,{'fields':_0x5f9e06,'raw':!![]});}})[_0xfb07('0x24')](handleEntityNotFound(_0xa3a9ea,null))[_0xfb07('0x24')](function(_0x6a6e05){_0xd26714['contact']=_0x6a6e05;if(_0x6a6e05){var _0xef6ba4={'ContactId':_0x6a6e05['id'],'OpenchannelAccountId':_0x2ded6f[_0xfb07('0x5c')]['id'],'from':(_0x6a6e05['firstName']||'')+'\x20'+(_0x6a6e05[_0xfb07('0x8f')]||'')};var _0x389664={'OpenchannelAccountId':_0x2ded6f[_0xfb07('0x5c')]['id'],'closed':![]};if(_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x90')]){_0x389664['threadId']=_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x90')];return db[_0xfb07('0x91')][_0xfb07('0x5f')]({'where':_0x389664})[_0xfb07('0x24')](function(_0x5cbd03){if(_0x5cbd03){return[_0x5cbd03,![]];}_0xef6ba4[_0xfb07('0x90')]=_0x2ded6f[_0xfb07('0x61')]['threadId'];_0xef6ba4['externalUrl']=_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x92')];return db[_0xfb07('0x91')][_0xfb07('0x60')](_0xef6ba4)[_0xfb07('0x24')](function(_0x4cf6e8){return[_0x4cf6e8,!![]];});});}else{_0x389664['threadId']=null;}_0x389664[_0xfb07('0x93')]=_0x6a6e05['id'];return db[_0xfb07('0x91')]['find']({'where':_0x389664})[_0xfb07('0x24')](function(_0x287a65){if(_0x287a65){return[_0x287a65,![]];}return db[_0xfb07('0x91')][_0xfb07('0x60')](_0xef6ba4)[_0xfb07('0x24')](function(_0xbb8a84){return[_0xbb8a84,!![]];});});}})[_0xfb07('0x94')](function(_0x5de450,_0x16251a){if(_0x5de450){_0x1e9bc9=_0x16251a;if(!_0x16251a){var _0x4c83ba={'from':(_0xd26714[_0xfb07('0x95')][_0xfb07('0x96')]||'')+'\x20'+(_0xd26714[_0xfb07('0x95')]['lastName']||'')};if(_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x90')]&&_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x97')]&&_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x90')]!=_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x97')]){_0x4c83ba['threadId']=_0x2ded6f[_0xfb07('0x61')]['messageId'];}return _0x5de450[_0xfb07('0x68')](_0x4c83ba);}else{return _0x5de450;}}})[_0xfb07('0x24')](function(_0x538e80){_0xd26714[_0xfb07('0x98')]=_0x538e80[_0xfb07('0x63')]({'plain':!![]});_0xd26714[_0xfb07('0x98')]['created']=_0x1e9bc9;if(_0xd26714[_0xfb07('0x98')][_0xfb07('0x99')]){if(_0xd26714[_0xfb07('0x8a')]['autoclose']){_0xd26714[_0xfb07('0x8b')][_0xfb07('0x9a')]({'id':0x0,'priority':_0xd26714[_0xfb07('0x8b')][_0xfb07('0x5e')]+0x1,'app':_0xfb07('0x9b'),'appdata':_0xfb07('0x9c'),'interval':_0xfb07('0x9d')});}}return db[_0xfb07('0x9e')][_0xfb07('0x60')]({'body':_0x2ded6f[_0xfb07('0x61')][_0xfb07('0x61')],'OpenchannelAccountId':_0x2ded6f['params']['id'],'OpenchannelInteractionId':_0x538e80['id'],'direction':'in','ContactId':_0xd26714['contact']['id'],'AttachmentId':_0x2ded6f['body'][_0xfb07('0x9f')]});})['then'](function(_0x3cc6f2){_0xd26714[_0xfb07('0x2c')]=_0x3cc6f2;if(_0xd26714['interaction']['UserId']){return db[_0xfb07('0xa0')]['find']({'attributes':['id',_0xfb07('0x3f')],'where':{'id':_0xd26714['interaction'][_0xfb07('0xa1')]}})[_0xfb07('0x24')](function(_0x5c6412){if(_0x5c6412){_0xd26714['applications'][_0xfb07('0xa2')]({'id':0x0,'priority':0x0,'app':_0xfb07('0xa3'),'appdata':_0x5c6412['name']+','+(_0xd26714['account']['waitForTheAssignedAgent']||0xa),'interval':_0xfb07('0x9d')});_0xd26714[_0xfb07('0xa4')]=![];}return respondWithRpcPromise('Start',_0xfb07('0xa5'),_0xd26714);});}return respondWithRpcPromise(_0xfb07('0xa6'),_0xfb07('0xa5'),_0xd26714);})[_0xfb07('0x24')](function(_0x49b488){respondWithRpcPromise(_0xfb07('0xa7'),_0xfb07('0xa7'),{'event':_0xfb07('0x74'),'message':_0x49b488},client9002);return _0x49b488;})[_0xfb07('0x24')](respondWithResult(_0xa3a9ea,null))['catch'](handleError(_0xa3a9ea,null));};exports[_0xfb07('0xa8')]=function(_0x5b7a4c,_0x393947){var _0xbe5376=_0x5b7a4c[_0xfb07('0x5c')]['id'];var _0x136d57=_0x5b7a4c['body'];var _0x46d68e=0xc8;var _0x3014a8=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xfb07('0xa9')]['Transaction'][_0xfb07('0xaa')][_0xfb07('0xab')]},function(_0x385752){return db['OpenchannelAccount'][_0xfb07('0xac')]({'where':{'id':_0xbe5376},'transaction':_0x385752})[_0xfb07('0x24')](function(_0x1ba47e){if(_0x1ba47e){return db[_0xfb07('0x88')][_0xfb07('0x3b')]({'where':{'OpenchannelAccountId':_0xbe5376},'transaction':_0x385752})[_0xfb07('0x24')](function(){var _0x5e426c=_['map'](_0x136d57,function(_0x457121){_0x457121[_0xfb07('0x6b')]=_0xbe5376;return _0x457121;});return db[_0xfb07('0x88')]['bulkCreate'](_0x5e426c,{'transaction':_0x385752});});}else{_0x46d68e=0x194;_0x3014a8=[];}});})[_0xfb07('0x24')](function(){if(_0x46d68e!==0x194){return db['OpenchannelApplication'][_0xfb07('0xad')]({'where':{'OpenchannelAccountId':_0xbe5376},'order':_0xfb07('0x8d')})['then'](function(_0x55d973){_0x3014a8=_0x55d973;});}})[_0xfb07('0x2e')](function(_0x3895ec){_0x46d68e=0x1f4;logger[_0xfb07('0x29')](_0x3895ec[_0xfb07('0x3e')]);if(_0x3895ec[_0xfb07('0x3f')]){delete _0x3895ec[_0xfb07('0x3f')];}_0x3014a8=_0x3895ec;})[_0xfb07('0xae')](function(){if(_0x3014a8===null){_0x393947['sendStatus'](_0x46d68e);}else{if(_0x46d68e===0x1f4){_0x393947['status'](_0x46d68e)['send'](_0x3014a8);}else{_0x393947[_0xfb07('0x30')](_0x46d68e)[_0xfb07('0x32')](_0x3014a8);}}});};exports['getApplications']=function(_0x4d54db,_0x45ea8d,_0x4323a0){var _0x1f186c={};var _0x3bf2ef={};var _0x58ac5d;var _0x5bd376;return db[_0xfb07('0x43')][_0xfb07('0xac')]({'where':{'id':_0x4d54db[_0xfb07('0x5c')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x45ea8d,null))['then'](function(_0xe4e1fb){if(_0xe4e1fb){_0x58ac5d=_0xe4e1fb;_0x3bf2ef['model']=_[_0xfb07('0x47')](db[_0xfb07('0x88')]['rawAttributes']);_0x3bf2ef[_0xfb07('0x48')]=_[_0xfb07('0x47')](_0x4d54db['query']);_0x3bf2ef[_0xfb07('0x49')]=_[_0xfb07('0x4b')](_0x3bf2ef['model'],_0x3bf2ef[_0xfb07('0x48')]);_0x1f186c['attributes']=_['intersection'](_0x3bf2ef['model'],qs[_0xfb07('0x4c')](_0x4d54db['query']['fields']));_0x1f186c[_0xfb07('0x4a')]=_0x1f186c['attributes'][_0xfb07('0x5e')]?_0x1f186c[_0xfb07('0x4a')]:_0x3bf2ef['model'];_0x1f186c[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x4d54db[_0xfb07('0x48')][_0xfb07('0x50')]);_0x1f186c['where']=qs[_0xfb07('0x49')](_[_0xfb07('0x52')](_0x4d54db[_0xfb07('0x48')],_0x3bf2ef[_0xfb07('0x49')]));if(_0x4d54db['query'][_0xfb07('0x53')]){_0x1f186c[_0xfb07('0x51')]=_[_0xfb07('0x54')](_0x1f186c[_0xfb07('0x51')],{'$or':_[_0xfb07('0x42')](_0x1f186c['attributes'],function(_0x1ea73b){var _0x52e702={};_0x52e702[_0x1ea73b]={'$like':'%'+_0x4d54db[_0xfb07('0x48')][_0xfb07('0x53')]+'%'};return _0x52e702;})});}_0x1f186c=_['merge']({},_0x1f186c,_0x4d54db['options']);return _0x58ac5d['getApplications'](_0x1f186c);}})[_0xfb07('0x24')](function(_0x162c98){if(_0x162c98){_0x5bd376=_0x162c98[_0xfb07('0x5e')];if(!_0x4d54db[_0xfb07('0x48')]['hasOwnProperty'](_0xfb07('0x4e'))){_0x1f186c['limit']=qs[_0xfb07('0x35')](_0x4d54db[_0xfb07('0x48')]['limit']);_0x1f186c[_0xfb07('0x33')]=qs['offset'](_0x4d54db[_0xfb07('0x48')][_0xfb07('0x33')]);}return _0x58ac5d[_0xfb07('0xaf')](_0x1f186c);}})['then'](function(_0x45c4d0){if(_0x45c4d0){return _0x45c4d0?{'count':_0x5bd376,'rows':_0x45c4d0}:null;}})[_0xfb07('0x24')](respondWithResult(_0x45ea8d,null))[_0xfb07('0x2e')](handleError(_0x45ea8d,null));};exports[_0xfb07('0xb0')]=function(_0x6a436c,_0x449634,_0x1b37ed){var _0x3d7afc={'raw':![],'where':{}};var _0x3047a9={};var _0x11bb88={'count':0x0,'rows':[]};return db[_0xfb07('0x43')][_0xfb07('0xac')]({'where':{'id':_0x6a436c[_0xfb07('0x5c')]['id']}})['then'](handleEntityNotFound(_0x449634,null))[_0xfb07('0x24')](function(_0x27daa6){if(_0x27daa6){_0x3047a9['model']=_[_0xfb07('0x47')](db[_0xfb07('0x91')][_0xfb07('0x44')]);_0x3047a9[_0xfb07('0x48')]=_[_0xfb07('0x47')](_0x6a436c['query']);_0x3047a9[_0xfb07('0x49')]=_[_0xfb07('0x4b')](_0x3047a9[_0xfb07('0x46')],_0x3047a9[_0xfb07('0x48')]);_0x3d7afc[_0xfb07('0x4a')]=_[_0xfb07('0x4b')](_0x3047a9[_0xfb07('0x46')],qs[_0xfb07('0x4c')](_0x6a436c[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x3d7afc['attributes']=_0x3d7afc[_0xfb07('0x4a')]['length']?_0x3d7afc[_0xfb07('0x4a')]:_0x3047a9['model'];if(!_0x6a436c[_0xfb07('0x48')]['hasOwnProperty'](_0xfb07('0x4e'))){_0x3d7afc[_0xfb07('0x35')]=qs[_0xfb07('0x35')](_0x6a436c[_0xfb07('0x48')][_0xfb07('0x35')]);_0x3d7afc['offset']=qs[_0xfb07('0x33')](_0x6a436c[_0xfb07('0x48')][_0xfb07('0x33')]);}_0x3d7afc[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x6a436c[_0xfb07('0x48')][_0xfb07('0x50')]);_0x3d7afc['where']=qs[_0xfb07('0x49')](_[_0xfb07('0x52')](_0x6a436c['query'],_0x3047a9[_0xfb07('0x49')]));_0x3d7afc['where'][_0xfb07('0x6b')]=_0x27daa6['id'];if(_0x6a436c[_0xfb07('0x48')][_0xfb07('0x53')]){_0x3d7afc[_0xfb07('0x51')]=_[_0xfb07('0x54')](_0x3d7afc[_0xfb07('0x51')],{'$or':_[_0xfb07('0x42')](_0x3d7afc[_0xfb07('0x4a')],function(_0x16b9e0){var _0x5ce2d5={};_0x5ce2d5[_0x16b9e0]={'$like':'%'+_0x6a436c[_0xfb07('0x48')]['filter']+'%'};return _0x5ce2d5;})});}_0x3d7afc=_[_0xfb07('0x54')]({},_0x3d7afc,_0x6a436c['options']);return db[_0xfb07('0x91')]['count']({'where':_0x3d7afc[_0xfb07('0x51')]})['then'](function(_0x304d5a){_0x11bb88[_0xfb07('0x36')]=_0x304d5a;if(_0x6a436c[_0xfb07('0x48')][_0xfb07('0x57')]){_0x3d7afc['include']=[{'model':db[_0xfb07('0xb1')],'as':_0xfb07('0xb2'),'required':![]},{'model':db[_0xfb07('0xa0')],'as':_0xfb07('0xb3'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xfb07('0xb4'),'attributes':['id',_0xfb07('0x3f'),_0xfb07('0xb5')],'where':_0x6a436c[_0xfb07('0x48')][_0xfb07('0xb6')]?{'id':_0x6a436c[_0xfb07('0x48')][_0xfb07('0xb6')]}:undefined,'required':_0x6a436c[_0xfb07('0x48')][_0xfb07('0xb6')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xfb07('0x59')](_0x3d7afc);})[_0xfb07('0x24')](function(_0x4412a3){_0x11bb88[_0xfb07('0x5a')]=_0x4412a3;return _0x11bb88;});}})[_0xfb07('0x24')](respondWithFilteredResult(_0x449634,_0x3d7afc))[_0xfb07('0x2e')](handleError(_0x449634,null));};exports[_0xfb07('0xb7')]=function(_0x16e3b9,_0x48bff1,_0x31d0af){return db['OpenchannelAccount']['find']({'where':{'id':_0x16e3b9[_0xfb07('0x5c')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x48bff1,null))[_0xfb07('0x24')](function(_0x13194b){if(_0x13194b){return _0x13194b[_0xfb07('0xb7')](_0x16e3b9[_0xfb07('0x61')][_0xfb07('0x73')],_[_0xfb07('0xb8')](_0x16e3b9[_0xfb07('0x61')],[_0xfb07('0x73'),'id'])||{})['spread'](function(_0x3780e0){for(var _0x3d62bf=0x0;_0x3d62bf<_0x16e3b9[_0xfb07('0x61')]['ids'][_0xfb07('0x5e')];_0x3d62bf+=0x1){socket['emit'](_0xfb07('0xb9'),{'UserId':Number(_0x16e3b9[_0xfb07('0x61')][_0xfb07('0x73')][_0x3d62bf]),'OpenchannelAccountId':Number(_0x16e3b9[_0xfb07('0x5c')]['id'])});}return _0x3780e0;});}})[_0xfb07('0x24')](respondWithResult(_0x48bff1,null))['catch'](handleError(_0x48bff1,null));};exports[_0xfb07('0xba')]=function(_0x4b8991,_0x326467,_0x488cbd){return db[_0xfb07('0x43')]['find']({'where':{'id':_0x4b8991[_0xfb07('0x5c')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x326467,null))[_0xfb07('0x24')](function(_0x2202e4){if(_0x2202e4){return _0x2202e4[_0xfb07('0xba')](_0x4b8991[_0xfb07('0x48')][_0xfb07('0x73')])[_0xfb07('0x24')](function(){if(_['isArray'](_0x4b8991[_0xfb07('0x48')]['ids'])){for(var _0x349940=0x0;_0x349940<_0x4b8991[_0xfb07('0x48')][_0xfb07('0x73')][_0xfb07('0x5e')];_0x349940+=0x1){socket['emit'](_0xfb07('0xbb'),{'UserId':Number(_0x4b8991['query'][_0xfb07('0x73')][_0x349940]),'OpenchannelAccountId':Number(_0x4b8991['params']['id'])});}}else{socket[_0xfb07('0xbc')](_0xfb07('0xbb'),{'UserId':Number(_0x4b8991[_0xfb07('0x48')][_0xfb07('0x73')]),'OpenchannelAccountId':Number(_0x4b8991[_0xfb07('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x326467,null))[_0xfb07('0x2e')](handleError(_0x326467,null));};exports['getAgents']=function(_0x3148c3,_0x526c92,_0xdb656c){var _0x82e233={};var _0x3f568d={};var _0x308b97;var _0x3813af;return db[_0xfb07('0x43')][_0xfb07('0xac')]({'where':{'id':_0x3148c3['params']['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x526c92,null))[_0xfb07('0x24')](function(_0x21c6fa){if(_0x21c6fa){_0x308b97=_0x21c6fa;_0x3f568d[_0xfb07('0x46')]=_[_0xfb07('0x47')](db[_0xfb07('0xa0')][_0xfb07('0x44')]);_0x3f568d['query']=_[_0xfb07('0x47')](_0x3148c3[_0xfb07('0x48')]);_0x3f568d[_0xfb07('0x49')]=_[_0xfb07('0x4b')](_0x3f568d[_0xfb07('0x46')],_0x3f568d['query']);_0x82e233['attributes']=_[_0xfb07('0x4b')](_0x3f568d[_0xfb07('0x46')],qs[_0xfb07('0x4c')](_0x3148c3[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x82e233['attributes']=_0x82e233['attributes'][_0xfb07('0x5e')]?_0x82e233[_0xfb07('0x4a')]:_0x3f568d[_0xfb07('0x46')];_0x82e233[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x3148c3[_0xfb07('0x48')][_0xfb07('0x50')]);_0x82e233[_0xfb07('0x51')]=qs['filters'](_[_0xfb07('0x52')](_0x3148c3['query'],_0x3f568d[_0xfb07('0x49')]));if(_0x3148c3[_0xfb07('0x48')][_0xfb07('0x53')]){_0x82e233[_0xfb07('0x51')]=_[_0xfb07('0x54')](_0x82e233[_0xfb07('0x51')],{'$or':_['map'](_0x82e233[_0xfb07('0x4a')],function(_0x36512e){var _0x33a72e={};_0x33a72e[_0x36512e]={'$like':'%'+_0x3148c3[_0xfb07('0x48')][_0xfb07('0x53')]+'%'};return _0x33a72e;})});}_0x82e233=_[_0xfb07('0x54')]({},_0x82e233,_0x3148c3[_0xfb07('0x6e')]);return _0x308b97[_0xfb07('0xbd')](_0x82e233);}})[_0xfb07('0x24')](function(_0x32ccc0){if(_0x32ccc0){_0x3813af=_0x32ccc0[_0xfb07('0x5e')];if(!_0x3148c3[_0xfb07('0x48')][_0xfb07('0x4d')]('nolimit')){_0x82e233[_0xfb07('0x35')]=qs[_0xfb07('0x35')](_0x3148c3[_0xfb07('0x48')]['limit']);_0x82e233[_0xfb07('0x33')]=qs[_0xfb07('0x33')](_0x3148c3[_0xfb07('0x48')]['offset']);}return _0x308b97['getAgents'](_0x82e233);}})['then'](function(_0x2dc9df){if(_0x2dc9df){return _0x2dc9df?{'count':_0x3813af,'rows':_0x2dc9df}:null;}})['then'](respondWithResult(_0x526c92,null))[_0xfb07('0x2e')](handleError(_0x526c92,null));};exports['send']=function(_0x2ede28,_0x220fad,_0x55a80e){var _0x25a1a4,_0x4aa1d8,_0x29ee04;if(_[_0xfb07('0x7e')](_0x2ede28[_0xfb07('0x61')]['body'])||_0x2ede28[_0xfb07('0x61')][_0xfb07('0x61')]===''){throw new db[(_0xfb07('0x76'))][(_0xfb07('0x77'))](_0xfb07('0xbe'));}if(_[_0xfb07('0x7e')](_0x2ede28['body']['to'])){}_0x25a1a4=_0x2ede28[_0xfb07('0x61')]['to'];return db['OpenchannelAccount'][_0xfb07('0xac')]({'where':{'id':_0x2ede28[_0xfb07('0x5c')]['id']}})['then'](handleEntityNotFound(_0x220fad,null))['then'](function(_0x1223f9){if(_0x1223f9){return db['OpenchannelAccount'][_0xfb07('0x5f')]({'where':{'id':_0x1223f9['id']},'include':[{'model':db[_0xfb07('0x84')],'as':_0xfb07('0x85'),'include':[{'model':db['CmContact'],'as':_0xfb07('0x86'),'where':{[_0x1223f9[_0xfb07('0x80')]]:_0x25a1a4},'limit':0x1,'order':[[_0xfb07('0x7b'),_0xfb07('0x87')]]}]}]})[_0xfb07('0x24')](handleEntityNotFound(_0x220fad,null))['then'](function(_0x547676){if(_0x547676&&_0x547676['List']){_0x4aa1d8=_0x547676[_0xfb07('0x63')]({'plain':!![]});if(_0x4aa1d8['List']&&_0x4aa1d8[_0xfb07('0x85')]['Contacts'][_0xfb07('0x5e')]){return _0x4aa1d8[_0xfb07('0x85')][_0xfb07('0x86')][0x0];}return db[_0xfb07('0xb1')]['create'](_[_0xfb07('0x1d')](_0x2ede28['body'],{'firstName':_0x25a1a4,[_0x547676['mapKey']]:_0x25a1a4,'phone':_0x25a1a4,'ListId':_0x4aa1d8[_0xfb07('0x7d')]}));}})[_0xfb07('0x24')](handleEntityNotFound(_0x220fad,null))[_0xfb07('0x24')](function(_0x303c0c){if(_0x303c0c){_0x29ee04=_0x303c0c;return db[_0xfb07('0x91')][_0xfb07('0x5f')]({'where':{'ContactId':_0x29ee04['id'],'closed':![],'OpenchannelAccountId':_0x4aa1d8['id']}})[_0xfb07('0x24')](function(_0x1fea03){if(_0x1fea03){return[_0x1fea03,![]];}return db[_0xfb07('0x91')][_0xfb07('0x60')]({'UserId':_0x2ede28[_0xfb07('0x62')]['id'],'ContactId':_0x29ee04['id'],'OpenchannelAccountId':_0x4aa1d8['id'],'lastMsgDirection':'out','firstMsgDirection':_0xfb07('0xbf'),'Messages':[_[_0xfb07('0x54')](_0x2ede28[_0xfb07('0x61')],{'read':![],'body':_0x2ede28[_0xfb07('0x61')][_0xfb07('0x61')],'OpenchannelAccountId':_0x4aa1d8['id'],'UserId':_0x2ede28[_0xfb07('0x62')]['id'],'ContactId':_0x29ee04['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x5d60f5){return[_0x5d60f5,!![]];});});}})[_0xfb07('0x94')](function(_0x5f2e80,_0x46f862){if(_0x46f862){return _0x5f2e80;}return db['OpenchannelMessage'][_0xfb07('0x60')](_['merge'](_0x2ede28['body'],{'read':![],'body':_0x2ede28[_0xfb07('0x61')][_0xfb07('0x61')],'OpenchannelAccountId':_0x4aa1d8['id'],'OpenchannelInteractionId':_0x5f2e80['id'],'UserId':_0x2ede28[_0xfb07('0x62')]['id'],'ContactId':_0x29ee04['id']}))[_0xfb07('0x24')](function(_0x30860c){_0x5f2e80[_0xfb07('0xc0')][_0xfb07('0xc1')]=[];_0x5f2e80[_0xfb07('0xc0')]['Messages']['push'](_0x30860c[_0xfb07('0xc0')]);return _0x5f2e80;});});}})['then'](respondWithResult(_0x220fad,null))[_0xfb07('0x2e')](handleError(_0x220fad,null));}; \ No newline at end of file +var _0x3645=['info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','OpenchannelAccounts','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','OpenchannelAccount','findAll','rows','show','params','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','DESC','OpenchannelApplication','applications','Applications','List','orderBy','asc','account','Contacts','length','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','autoclose','push','close','unmanaged','OpenchannelMessage','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','priority','stack','finally','send','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','updatedAt','out','Messages','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1cdedf,_0x294ea){var _0x4152f4=function(_0x7ffa9c){while(--_0x7ffa9c){_0x1cdedf['push'](_0x1cdedf['shift']());}};_0x4152f4(++_0x294ea);}(_0x3645,0x157));var _0x5364=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x3645[_0x5179a5];return _0x15c8ce;};'use strict';var emlformat=require(_0x5364('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5364('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5364('0x2'));var moment=require(_0x5364('0x3'));var BPromise=require(_0x5364('0x4'));var Mustache=require(_0x5364('0x5'));var util=require('util');var path=require(_0x5364('0x6'));var sox=require(_0x5364('0x7'));var csv=require(_0x5364('0x8'));var ejs=require(_0x5364('0x9'));var fs=require('fs');var fs_extra=require(_0x5364('0xa'));var _=require('lodash');var squel=require(_0x5364('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5364('0xc'));var toCsv=require(_0x5364('0x8'));var querystring=require(_0x5364('0xd'));var Papa=require(_0x5364('0xe'));var Redis=require(_0x5364('0xf'));var authService=require(_0x5364('0x10'));var qs=require(_0x5364('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5364('0x12'));var logger=require(_0x5364('0x13'))(_0x5364('0x14'));var utils=require(_0x5364('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5364('0x16'));var db=require(_0x5364('0x17'))['db'];config[_0x5364('0x18')]=_[_0x5364('0x19')](config[_0x5364('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5364('0x18')]));require('./openchannelAccount.socket')[_0x5364('0x1a')](socket);var jayson=require(_0x5364('0x1b'));var client=jayson[_0x5364('0x1c')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x419238,_0x20ed97,_0x687385,_0x954a70){return new BPromise(function(_0x2bd4c2,_0x38ec48){var _0x4cdf34=_0x954a70||client;return _0x4cdf34['request'](_0x419238,_0x687385)['then'](function(_0xf2a4d){logger['info'](_0x5364('0x1d'),_0x20ed97,'request\x20sent');logger[_0x5364('0x1e')](_0x5364('0x1f'),_0x20ed97,_0x5364('0x20'),JSON[_0x5364('0x21')](_0xf2a4d));if(_0xf2a4d[_0x5364('0x22')]){if(_0xf2a4d[_0x5364('0x22')][_0x5364('0x23')]===0x1f4){logger[_0x5364('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x20ed97,_0xf2a4d[_0x5364('0x22')][_0x5364('0x24')]);return _0x38ec48(_0xf2a4d[_0x5364('0x22')][_0x5364('0x24')]);}logger['error'](_0x5364('0x1d'),_0x20ed97,_0xf2a4d['error'][_0x5364('0x24')]);return _0x2bd4c2(_0xf2a4d[_0x5364('0x22')][_0x5364('0x24')]);}else{logger[_0x5364('0x25')](_0x5364('0x1d'),_0x20ed97,_0x5364('0x20'));_0x2bd4c2(_0xf2a4d[_0x5364('0x26')][_0x5364('0x24')]);}})[_0x5364('0x27')](function(_0x51d4e8){logger[_0x5364('0x22')](_0x5364('0x1d'),_0x20ed97,_0x51d4e8);_0x38ec48(_0x51d4e8);});});}function respondWithStatusCode(_0x43e22d,_0x53f3f3){_0x53f3f3=_0x53f3f3||0xcc;return function(_0x24c2fb){if(_0x24c2fb){return _0x43e22d[_0x5364('0x28')](_0x53f3f3);}return _0x43e22d[_0x5364('0x29')](_0x53f3f3)[_0x5364('0x2a')]();};}function respondWithResult(_0x3afdd7,_0x561f60){_0x561f60=_0x561f60||0xc8;return function(_0x55bb6e){if(_0x55bb6e){return _0x3afdd7[_0x5364('0x29')](_0x561f60)[_0x5364('0x2b')](_0x55bb6e);}};}function respondWithFilteredResult(_0x358f46,_0x484ebd){return function(_0x242184){if(_0x242184){var _0x3d0d8a=typeof _0x484ebd[_0x5364('0x2c')]==='undefined'&&typeof _0x484ebd[_0x5364('0x2d')]==='undefined';var _0x16c397=_0x242184['count'];var _0x2f512d=_0x3d0d8a?0x0:_0x484ebd[_0x5364('0x2c')];var _0x2d0ca6=_0x3d0d8a?_0x242184['count']:_0x484ebd['offset']+_0x484ebd[_0x5364('0x2d')];var _0x1c0862;if(_0x2d0ca6>=_0x16c397){_0x2d0ca6=_0x16c397;_0x1c0862=0xc8;}else{_0x1c0862=0xce;}_0x358f46[_0x5364('0x29')](_0x1c0862);return _0x358f46[_0x5364('0x2e')](_0x5364('0x2f'),_0x2f512d+'-'+_0x2d0ca6+'/'+_0x16c397)[_0x5364('0x2b')](_0x242184);}return null;};}function patchUpdates(_0x12f206){return function(_0x34791e){try{jsonpatch['apply'](_0x34791e,_0x12f206,!![]);}catch(_0x2bd91b){return BPromise[_0x5364('0x30')](_0x2bd91b);}return _0x34791e[_0x5364('0x31')]();};}function saveUpdates(_0x10b3cc,_0x44d485){return function(_0x3ebb24){if(_0x3ebb24){return _0x3ebb24[_0x5364('0x32')](_0x10b3cc)['then'](function(_0x1b1829){return _0x1b1829;});}return null;};}function removeEntity(_0x1fc824,_0x458b85){return function(_0x4fbe12){if(_0x4fbe12){return _0x4fbe12[_0x5364('0x33')]()[_0x5364('0x34')](function(){var _0x28575e=_0x4fbe12[_0x5364('0x35')]({'plain':!![]});var _0xb279b6=_0x5364('0x36');return db['UserProfileResource'][_0x5364('0x33')]({'where':{'type':_0xb279b6,'resourceId':_0x28575e['id']}})[_0x5364('0x34')](function(){return _0x4fbe12;});})[_0x5364('0x34')](function(){_0x1fc824['status'](0xcc)[_0x5364('0x2a')]();});}};}function handleEntityNotFound(_0x3eb3c6,_0x1f8d89){return function(_0x367989){if(!_0x367989){_0x3eb3c6[_0x5364('0x28')](0x194);}return _0x367989;};}function handleError(_0x13b8dc,_0x34e511){_0x34e511=_0x34e511||0x1f4;return function(_0x52edde){logger[_0x5364('0x22')](_0x52edde['stack']);if(_0x52edde[_0x5364('0x37')]){delete _0x52edde[_0x5364('0x37')];}_0x13b8dc[_0x5364('0x29')](_0x34e511)['send'](_0x52edde);};}exports[_0x5364('0x38')]=function(_0x135874,_0x1ba0eb){var _0xd42b3e={'include':[{'model':db[_0x5364('0x39')],'as':_0x5364('0x3a')}]},_0x3cb747={},_0x21a240={'count':0x0,'rows':[]};var _0x5041a1=_[_0x5364('0x3b')](db['OpenchannelAccount'][_0x5364('0x3c')],function(_0x4605c6){return{'name':_0x4605c6[_0x5364('0x3d')],'type':_0x4605c6[_0x5364('0x3e')][_0x5364('0x3f')]};});_0x3cb747[_0x5364('0x40')]=_[_0x5364('0x3b')](_0x5041a1,_0x5364('0x37'));_0x3cb747[_0x5364('0x41')]=_[_0x5364('0x42')](_0x135874['query']);_0x3cb747['filters']=_[_0x5364('0x43')](_0x3cb747[_0x5364('0x40')],_0x3cb747[_0x5364('0x41')]);_0xd42b3e[_0x5364('0x44')]=_[_0x5364('0x43')](_0x3cb747[_0x5364('0x40')],qs[_0x5364('0x45')](_0x135874[_0x5364('0x41')][_0x5364('0x45')]));_0xd42b3e[_0x5364('0x44')]=_0xd42b3e[_0x5364('0x44')]['length']?_0xd42b3e[_0x5364('0x44')]:_0x3cb747[_0x5364('0x40')];if(!_0x135874[_0x5364('0x41')][_0x5364('0x46')]('nolimit')){_0xd42b3e[_0x5364('0x2d')]=qs[_0x5364('0x2d')](_0x135874['query'][_0x5364('0x2d')]);_0xd42b3e[_0x5364('0x2c')]=qs[_0x5364('0x2c')](_0x135874[_0x5364('0x41')][_0x5364('0x2c')]);}_0xd42b3e[_0x5364('0x47')]=qs['sort'](_0x135874[_0x5364('0x41')][_0x5364('0x48')]);_0xd42b3e[_0x5364('0x49')]=qs[_0x5364('0x4a')](_[_0x5364('0x4b')](_0x135874[_0x5364('0x41')],_0x3cb747[_0x5364('0x4a')]),_0x5041a1);if(_0x135874[_0x5364('0x41')][_0x5364('0x4c')]){_0xd42b3e[_0x5364('0x49')]=_[_0x5364('0x4d')](_0xd42b3e['where'],{'$or':_[_0x5364('0x3b')](_0x5041a1,function(_0x14c340){if(_0x14c340[_0x5364('0x3e')]!==_0x5364('0x4e')){var _0x1f3eb2={};_0x1f3eb2[_0x14c340[_0x5364('0x37')]]={'$like':'%'+_0x135874[_0x5364('0x41')][_0x5364('0x4c')]+'%'};return _0x1f3eb2;}})});}_0xd42b3e=_[_0x5364('0x4d')]({},_0xd42b3e,_0x135874['options']);var _0x5dbf67={'where':_0xd42b3e[_0x5364('0x49')]};return db['OpenchannelAccount']['count'](_0x5dbf67)[_0x5364('0x34')](function(_0x1d45ce){_0x21a240[_0x5364('0x4f')]=_0x1d45ce;if(_0x135874[_0x5364('0x41')][_0x5364('0x50')]){_0xd42b3e[_0x5364('0x51')]=[{'all':!![]}];}return db[_0x5364('0x52')][_0x5364('0x53')](_0xd42b3e);})[_0x5364('0x34')](function(_0xb12341){_0x21a240[_0x5364('0x54')]=_0xb12341;return _0x21a240;})[_0x5364('0x34')](respondWithFilteredResult(_0x1ba0eb,_0xd42b3e))[_0x5364('0x27')](handleError(_0x1ba0eb,null));};exports[_0x5364('0x55')]=function(_0xb00643,_0x3d444b){var _0x406534={'raw':![],'where':{'id':_0xb00643[_0x5364('0x56')]['id']},'include':[{'model':db[_0x5364('0x39')],'as':_0x5364('0x3a')}]},_0x4cb8b6={};_0x4cb8b6['model']=_[_0x5364('0x42')](db[_0x5364('0x52')][_0x5364('0x3c')]);_0x4cb8b6[_0x5364('0x41')]=_['keys'](_0xb00643[_0x5364('0x41')]);_0x4cb8b6[_0x5364('0x4a')]=_[_0x5364('0x43')](_0x4cb8b6[_0x5364('0x40')],_0x4cb8b6[_0x5364('0x41')]);_0x406534[_0x5364('0x44')]=_[_0x5364('0x43')](_0x4cb8b6[_0x5364('0x40')],qs[_0x5364('0x45')](_0xb00643['query'][_0x5364('0x45')]));_0x406534[_0x5364('0x44')]=_0x406534[_0x5364('0x44')]['length']?_0x406534[_0x5364('0x44')]:_0x4cb8b6[_0x5364('0x40')];if(_0xb00643[_0x5364('0x41')][_0x5364('0x50')]){_0x406534[_0x5364('0x51')]=[{'all':!![]}];}_0x406534=_[_0x5364('0x4d')]({},_0x406534,_0xb00643[_0x5364('0x57')]);return db[_0x5364('0x52')]['find'](_0x406534)[_0x5364('0x34')](handleEntityNotFound(_0x3d444b,null))[_0x5364('0x34')](respondWithResult(_0x3d444b,null))[_0x5364('0x27')](handleError(_0x3d444b,null));};exports[_0x5364('0x58')]=function(_0x43ae48,_0x2504b8){return db[_0x5364('0x52')]['create'](_0x43ae48['body'],{})[_0x5364('0x34')](function(_0x109337){var _0xb33ac=_0x43ae48[_0x5364('0x59')][_0x5364('0x35')]({'plain':!![]});if(!_0xb33ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb33ac[_0x5364('0x5a')]===_0x5364('0x59')){var _0x863805=_0x109337[_0x5364('0x35')]({'plain':!![]});var _0x3420ea=_0x5364('0x36');return db[_0x5364('0x5b')][_0x5364('0x5c')]({'where':{'name':_0x3420ea,'userProfileId':_0xb33ac[_0x5364('0x5d')]},'raw':!![]})['then'](function(_0x36a79b){if(_0x36a79b&&_0x36a79b[_0x5364('0x5e')]===0x0){return db[_0x5364('0x5f')][_0x5364('0x58')]({'name':_0x863805[_0x5364('0x37')],'resourceId':_0x863805['id'],'type':_0x36a79b[_0x5364('0x37')],'sectionId':_0x36a79b['id']},{})[_0x5364('0x34')](function(){return _0x109337;});}else{return _0x109337;}})[_0x5364('0x27')](function(_0x3f7e60){logger[_0x5364('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f7e60);throw _0x3f7e60;});}return _0x109337;})['then'](respondWithResult(_0x2504b8,0xc9))[_0x5364('0x27')](handleError(_0x2504b8,null));};exports['update']=function(_0x59afa0,_0x4337a7){if(_0x59afa0[_0x5364('0x60')]['id']){delete _0x59afa0[_0x5364('0x60')]['id'];}return db[_0x5364('0x52')][_0x5364('0x5c')]({'where':{'id':_0x59afa0[_0x5364('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x5364('0x3a')}]})[_0x5364('0x34')](handleEntityNotFound(_0x4337a7,null))['then'](saveUpdates(_0x59afa0[_0x5364('0x60')],null))[_0x5364('0x34')](respondWithResult(_0x4337a7,null))[_0x5364('0x27')](handleError(_0x4337a7,null));};exports[_0x5364('0x33')]=function(_0x2d1762,_0x1e7e60){return db['OpenchannelAccount']['find']({'where':{'id':_0x2d1762['params']['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x1e7e60,null))[_0x5364('0x34')](removeEntity(_0x1e7e60,null))['catch'](handleError(_0x1e7e60,null));};exports[_0x5364('0x61')]=function(_0x347014,_0x25aeec){return db['OpenchannelAccount'][_0x5364('0x61')]()[_0x5364('0x34')](respondWithResult(_0x25aeec,null))[_0x5364('0x27')](handleError(_0x25aeec,null));};exports[_0x5364('0x62')]=function(_0x13ada7,_0x195d5b,_0x292091){if(_0x13ada7[_0x5364('0x60')]['id']){delete _0x13ada7[_0x5364('0x60')]['id'];}return db[_0x5364('0x52')][_0x5364('0x5c')]({'where':{'id':_0x13ada7['params']['id']}})['then'](handleEntityNotFound(_0x195d5b,null))[_0x5364('0x34')](function(_0x43b4d7){if(_0x43b4d7){_0x13ada7[_0x5364('0x60')][_0x5364('0x63')]=_0x43b4d7['id'];return db[_0x5364('0x64')]['create'](_0x13ada7[_0x5364('0x60')]);}})[_0x5364('0x34')](respondWithResult(_0x195d5b,null))[_0x5364('0x27')](handleError(_0x195d5b,null));};exports[_0x5364('0x65')]=function(_0x33967b,_0x181ffb,_0xb5cd6b){var _0xfd259={'raw':![],'where':{}};var _0x542c1a={};var _0x5b30d4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5364('0x66')]({'where':{'id':_0x33967b[_0x5364('0x56')]['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x181ffb,null))[_0x5364('0x34')](function(_0x24ddbd){if(_0x24ddbd){_0x542c1a[_0x5364('0x40')]=_[_0x5364('0x42')](db['Disposition']['rawAttributes']);_0x542c1a['query']=_[_0x5364('0x42')](_0x33967b[_0x5364('0x41')]);_0x542c1a[_0x5364('0x4a')]=_[_0x5364('0x43')](_0x542c1a[_0x5364('0x40')],_0x542c1a[_0x5364('0x41')]);_0xfd259['attributes']=_[_0x5364('0x43')](_0x542c1a[_0x5364('0x40')],qs[_0x5364('0x45')](_0x33967b[_0x5364('0x41')][_0x5364('0x45')]));_0xfd259[_0x5364('0x44')]=_0xfd259[_0x5364('0x44')]['length']?_0xfd259[_0x5364('0x44')]:_0x542c1a['model'];if(!_0x33967b[_0x5364('0x41')][_0x5364('0x46')](_0x5364('0x67'))){_0xfd259[_0x5364('0x2d')]=qs['limit'](_0x33967b[_0x5364('0x41')][_0x5364('0x2d')]);_0xfd259[_0x5364('0x2c')]=qs[_0x5364('0x2c')](_0x33967b[_0x5364('0x41')]['offset']);}_0xfd259[_0x5364('0x47')]=qs[_0x5364('0x48')](_0x33967b[_0x5364('0x41')][_0x5364('0x48')]);_0xfd259['where']=qs[_0x5364('0x4a')](_[_0x5364('0x4b')](_0x33967b[_0x5364('0x41')],_0x542c1a['filters']));_0xfd259['where'][_0x5364('0x63')]=_0x24ddbd['id'];if(_0x33967b[_0x5364('0x41')][_0x5364('0x4c')]){_0xfd259[_0x5364('0x49')]=_[_0x5364('0x4d')](_0xfd259[_0x5364('0x49')],{'$or':_[_0x5364('0x3b')](_0xfd259[_0x5364('0x44')],function(_0x41b80c){var _0x49f8e5={};_0x49f8e5[_0x41b80c]={'$like':'%'+_0x33967b[_0x5364('0x41')][_0x5364('0x4c')]+'%'};return _0x49f8e5;})});}_0xfd259=_['merge']({},_0xfd259,_0x33967b['options']);return db[_0x5364('0x64')][_0x5364('0x4f')]({'where':_0xfd259[_0x5364('0x49')]})[_0x5364('0x34')](function(_0x396178){_0x5b30d4[_0x5364('0x4f')]=_0x396178;if(_0x33967b['query'][_0x5364('0x50')]){_0xfd259[_0x5364('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x5364('0x53')](_0xfd259);})[_0x5364('0x34')](function(_0x1381dd){_0x5b30d4['rows']=_0x1381dd;return _0x5b30d4;});}})['then'](respondWithFilteredResult(_0x181ffb,_0xfd259))[_0x5364('0x27')](handleError(_0x181ffb,null));};exports[_0x5364('0x68')]=function(_0x42fc7f,_0x4219db,_0xf91502){return db[_0x5364('0x52')][_0x5364('0x5c')]({'where':{'id':_0x42fc7f[_0x5364('0x56')]['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x4219db,null))[_0x5364('0x34')](function(_0x3cbc0f){if(_0x3cbc0f){return _0x3cbc0f[_0x5364('0x68')](_0x42fc7f[_0x5364('0x41')]['ids']);}})[_0x5364('0x34')](respondWithStatusCode(_0x4219db,null))[_0x5364('0x27')](handleError(_0x4219db,null));};exports[_0x5364('0x69')]=function(_0x2ae43c,_0x46609d,_0x3c0bb5){if(_0x2ae43c[_0x5364('0x60')]['id']){delete _0x2ae43c['body']['id'];}return db['OpenchannelAccount'][_0x5364('0x5c')]({'where':{'id':_0x2ae43c[_0x5364('0x56')]['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x46609d,null))[_0x5364('0x34')](function(_0x565e74){if(_0x565e74){_0x2ae43c['body'][_0x5364('0x63')]=_0x565e74['id'];return db[_0x5364('0x6a')][_0x5364('0x58')](_0x2ae43c['body']);}})[_0x5364('0x34')](respondWithResult(_0x46609d,null))[_0x5364('0x27')](handleError(_0x46609d,null));};exports[_0x5364('0x6b')]=function(_0x3672a9,_0x21d3b3,_0x36a425){var _0x4d4236={'raw':![],'where':{}};var _0x2f2b42={};var _0x50af8c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5364('0x66')]({'where':{'id':_0x3672a9[_0x5364('0x56')]['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x21d3b3,null))[_0x5364('0x34')](function(_0x5506c3){if(_0x5506c3){_0x2f2b42[_0x5364('0x40')]=_[_0x5364('0x42')](db[_0x5364('0x6a')]['rawAttributes']);_0x2f2b42[_0x5364('0x41')]=_[_0x5364('0x42')](_0x3672a9[_0x5364('0x41')]);_0x2f2b42['filters']=_[_0x5364('0x43')](_0x2f2b42['model'],_0x2f2b42['query']);_0x4d4236[_0x5364('0x44')]=_[_0x5364('0x43')](_0x2f2b42[_0x5364('0x40')],qs[_0x5364('0x45')](_0x3672a9[_0x5364('0x41')][_0x5364('0x45')]));_0x4d4236['attributes']=_0x4d4236[_0x5364('0x44')]['length']?_0x4d4236[_0x5364('0x44')]:_0x2f2b42[_0x5364('0x40')];if(!_0x3672a9[_0x5364('0x41')][_0x5364('0x46')](_0x5364('0x67'))){_0x4d4236['limit']=qs[_0x5364('0x2d')](_0x3672a9[_0x5364('0x41')][_0x5364('0x2d')]);_0x4d4236[_0x5364('0x2c')]=qs[_0x5364('0x2c')](_0x3672a9[_0x5364('0x41')][_0x5364('0x2c')]);}_0x4d4236[_0x5364('0x47')]=qs['sort'](_0x3672a9[_0x5364('0x41')][_0x5364('0x48')]);_0x4d4236[_0x5364('0x49')]=qs[_0x5364('0x4a')](_['pick'](_0x3672a9[_0x5364('0x41')],_0x2f2b42[_0x5364('0x4a')]));_0x4d4236[_0x5364('0x49')]['OpenchannelAccountId']=_0x5506c3['id'];if(_0x3672a9[_0x5364('0x41')]['filter']){_0x4d4236[_0x5364('0x49')]=_[_0x5364('0x4d')](_0x4d4236[_0x5364('0x49')],{'$or':_[_0x5364('0x3b')](_0x4d4236[_0x5364('0x44')],function(_0x58cd92){var _0x5c738b={};_0x5c738b[_0x58cd92]={'$like':'%'+_0x3672a9['query']['filter']+'%'};return _0x5c738b;})});}_0x4d4236=_[_0x5364('0x4d')]({},_0x4d4236,_0x3672a9[_0x5364('0x57')]);return db['CannedAnswer'][_0x5364('0x4f')]({'where':_0x4d4236[_0x5364('0x49')]})[_0x5364('0x34')](function(_0x2cd303){_0x50af8c['count']=_0x2cd303;if(_0x3672a9[_0x5364('0x41')]['includeAll']){_0x4d4236['include']=[{'all':!![]}];}return db[_0x5364('0x6a')]['findAll'](_0x4d4236);})[_0x5364('0x34')](function(_0x28bf94){_0x50af8c['rows']=_0x28bf94;return _0x50af8c;});}})[_0x5364('0x34')](respondWithFilteredResult(_0x21d3b3,_0x4d4236))[_0x5364('0x27')](handleError(_0x21d3b3,null));};exports['removeAnswers']=function(_0x59b593,_0x3d9a15,_0x1857ab){return db[_0x5364('0x52')][_0x5364('0x5c')]({'where':{'id':_0x59b593[_0x5364('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d9a15,null))[_0x5364('0x34')](function(_0x3eedd4){if(_0x3eedd4){return _0x3eedd4[_0x5364('0x6c')](_0x59b593['query'][_0x5364('0x6d')]);}})[_0x5364('0x34')](respondWithStatusCode(_0x3d9a15,null))[_0x5364('0x27')](handleError(_0x3d9a15,null));};exports[_0x5364('0x6e')]=function(_0x372732,_0x8bf899,_0x501cd9){var _0x36afa1={'body':_0x372732[_0x5364('0x60')],'channel':_0x5364('0x6f')};var _0x2d55c5=[];var _0x58e675=[];var _0x251177={};var _0x2848dc=![];return db[_0x5364('0x70')][_0x5364('0x61')]()[_0x5364('0x34')](function(_0x4dca7d){if(!_0x4dca7d){throw new db[(_0x5364('0x71'))]['ValidationError'](_0x5364('0x72'));}_0x2d55c5=_[_0x5364('0x73')](_['keys'](_0x4dca7d),[_0x5364('0x74'),'updatedAt']);_0x58e675=_[_0x5364('0x73')](_['keys'](_0x4dca7d),[_0x5364('0x74'),'updatedAt',_0x5364('0x75'),'ListId']);if(_0x372732[_0x5364('0x60')]['id']){delete _0x372732['body']['id'];}if(_[_0x5364('0x76')](_0x372732[_0x5364('0x60')]['from'])){throw new db[(_0x5364('0x71'))][(_0x5364('0x77'))](_0x5364('0x78'));}if(_[_0x5364('0x76')](_0x372732[_0x5364('0x60')][_0x5364('0x60')])||_0x372732[_0x5364('0x60')]['body']===''){throw new db[(_0x5364('0x71'))][(_0x5364('0x77'))](_0x5364('0x79'));}if(_[_0x5364('0x76')](_0x372732['body'][_0x5364('0x7a')])){throw new db[(_0x5364('0x71'))]['ValidationError'](_0x5364('0x7b')+_0x58e675);}if(!_[_0x5364('0x7c')](_0x58e675,_0x372732['body'][_0x5364('0x7a')])){throw new db[(_0x5364('0x71'))][(_0x5364('0x77'))](_0x5364('0x7d')+_0x58e675);}_0x251177[_0x372732[_0x5364('0x60')][_0x5364('0x7a')]]=_0x372732[_0x5364('0x60')][_0x5364('0x7e')];})[_0x5364('0x34')](function(){return db[_0x5364('0x52')]['find']({'where':{'id':_0x372732[_0x5364('0x56')]['id']},'include':[{'model':db[_0x5364('0x7f')],'as':'List','include':[{'model':db[_0x5364('0x70')],'as':'Contacts','where':_0x251177,'limit':0x1,'order':[['updatedAt',_0x5364('0x80')]]}]},{'model':db[_0x5364('0x81')],'as':'Applications'}]});})[_0x5364('0x34')](handleEntityNotFound(_0x8bf899,null))[_0x5364('0x34')](function(_0x2336e4){if(_0x2336e4&&_0x2336e4['List']){_0x36afa1['account']=_0x2336e4;_0x36afa1[_0x5364('0x82')]=_0x2336e4[_0x5364('0x83')];_0x36afa1['list']=_0x2336e4[_0x5364('0x84')];_0x36afa1[_0x5364('0x82')]=_[_0x5364('0x85')](_0x36afa1[_0x5364('0x82')],['priority'],[_0x5364('0x86')]);if(_0x36afa1[_0x5364('0x87')][_0x5364('0x83')]){delete _0x36afa1['account'][_0x5364('0x83')];}if(_0x36afa1[_0x5364('0x87')]['List']&&_0x36afa1[_0x5364('0x87')][_0x5364('0x84')][_0x5364('0x88')][_0x5364('0x89')]){return _0x36afa1[_0x5364('0x87')][_0x5364('0x84')][_0x5364('0x88')][0x0];}var _0x3147e7=_[_0x5364('0x19')](_0x372732[_0x5364('0x60')],{'firstName':_0x372732[_0x5364('0x60')]['from'],'ListId':_0x2336e4[_0x5364('0x8a')]});_0x3147e7[_0x372732[_0x5364('0x60')][_0x5364('0x7a')]]=_0x372732['body'][_0x5364('0x7e')];return db[_0x5364('0x70')][_0x5364('0x58')](_0x3147e7,{'fields':_0x2d55c5,'raw':!![]});}})['then'](handleEntityNotFound(_0x8bf899,null))[_0x5364('0x34')](function(_0x2458b3){_0x36afa1[_0x5364('0x8b')]=_0x2458b3;if(_0x2458b3){var _0xdbe6ee={'ContactId':_0x2458b3['id'],'OpenchannelAccountId':_0x372732['params']['id'],'from':(_0x2458b3[_0x5364('0x8c')]||'')+'\x20'+(_0x2458b3[_0x5364('0x8d')]||'')};var _0x3cee58={'OpenchannelAccountId':_0x372732[_0x5364('0x56')]['id'],'closed':![]};if(_0x372732['body'][_0x5364('0x8e')]){_0x3cee58[_0x5364('0x8e')]=_0x372732[_0x5364('0x60')][_0x5364('0x8e')];return db[_0x5364('0x8f')][_0x5364('0x5c')]({'where':_0x3cee58})['then'](function(_0x1ceff2){if(_0x1ceff2){return[_0x1ceff2,![]];}_0xdbe6ee[_0x5364('0x8e')]=_0x372732[_0x5364('0x60')][_0x5364('0x8e')];_0xdbe6ee[_0x5364('0x90')]=_0x372732[_0x5364('0x60')][_0x5364('0x90')];return db[_0x5364('0x8f')][_0x5364('0x58')](_0xdbe6ee)[_0x5364('0x34')](function(_0x1e142b){return[_0x1e142b,!![]];});});}else{_0x3cee58[_0x5364('0x8e')]=null;}_0x3cee58['ContactId']=_0x2458b3['id'];return db[_0x5364('0x8f')][_0x5364('0x5c')]({'where':_0x3cee58})[_0x5364('0x34')](function(_0x23509d){if(_0x23509d){return[_0x23509d,![]];}return db[_0x5364('0x8f')][_0x5364('0x58')](_0xdbe6ee)[_0x5364('0x34')](function(_0x18d072){return[_0x18d072,!![]];});});}})[_0x5364('0x91')](function(_0x5748d3,_0x5001fc){if(_0x5748d3){_0x2848dc=_0x5001fc;if(!_0x5001fc){var _0x49ad5e={'from':(_0x36afa1[_0x5364('0x8b')][_0x5364('0x8c')]||'')+'\x20'+(_0x36afa1[_0x5364('0x8b')][_0x5364('0x8d')]||'')};if(_0x372732['body'][_0x5364('0x8e')]&&_0x372732['body'][_0x5364('0x92')]&&_0x372732[_0x5364('0x60')]['threadId']!=_0x372732[_0x5364('0x60')][_0x5364('0x92')]){_0x49ad5e[_0x5364('0x8e')]=_0x372732['body']['messageId'];}return _0x5748d3[_0x5364('0x32')](_0x49ad5e);}else{return _0x5748d3;}}})[_0x5364('0x34')](function(_0xd0391a){_0x36afa1[_0x5364('0x93')]=_0xd0391a[_0x5364('0x35')]({'plain':!![]});_0x36afa1[_0x5364('0x93')]['created']=_0x2848dc;if(_0x36afa1[_0x5364('0x93')]['created']){if(_0x36afa1[_0x5364('0x87')][_0x5364('0x94')]){_0x36afa1[_0x5364('0x82')][_0x5364('0x95')]({'id':0x0,'priority':_0x36afa1[_0x5364('0x82')][_0x5364('0x89')]+0x1,'app':_0x5364('0x96'),'appdata':_0x5364('0x97'),'interval':'*,*,*,*'});}}return db[_0x5364('0x98')]['create']({'body':_0x372732[_0x5364('0x60')][_0x5364('0x60')],'OpenchannelAccountId':_0x372732[_0x5364('0x56')]['id'],'OpenchannelInteractionId':_0xd0391a['id'],'direction':'in','ContactId':_0x36afa1[_0x5364('0x8b')]['id'],'AttachmentId':_0x372732[_0x5364('0x60')]['AttachmentId']});})[_0x5364('0x34')](function(_0x5f3be2){_0x36afa1[_0x5364('0x24')]=_0x5f3be2;if(_0x36afa1[_0x5364('0x93')]['UserId']){return db['User'][_0x5364('0x5c')]({'attributes':['id',_0x5364('0x37')],'where':{'id':_0x36afa1[_0x5364('0x93')]['UserId']}})[_0x5364('0x34')](function(_0x15bdb8){if(_0x15bdb8){_0x36afa1[_0x5364('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5364('0x99'),'appdata':_0x15bdb8['name']+','+(_0x36afa1[_0x5364('0x87')][_0x5364('0x9a')]||0xa),'interval':'*,*,*,*'});_0x36afa1[_0x5364('0x9b')]=![];}return respondWithRpcPromise(_0x5364('0x9c'),_0x5364('0x9d'),_0x36afa1);});}return respondWithRpcPromise(_0x5364('0x9c'),_0x5364('0x9d'),_0x36afa1);})['then'](function(_0x2027ea){respondWithRpcPromise(_0x5364('0x9e'),'EventManager',{'event':'notify','message':_0x2027ea},client9002);return _0x2027ea;})['then'](respondWithResult(_0x8bf899,null))[_0x5364('0x27')](handleError(_0x8bf899,null));};exports[_0x5364('0x9f')]=function(_0x3ee42f,_0x4f615c){var _0x33fc2d=_0x3ee42f[_0x5364('0x56')]['id'];var _0x5c9ee0=_0x3ee42f['body'];var _0x161a3e=0xc8;var _0x5c284b=null;return db[_0x5364('0xa0')][_0x5364('0xa1')]({'isolationLevel':db[_0x5364('0xa0')][_0x5364('0xa2')][_0x5364('0xa3')][_0x5364('0xa4')]},function(_0x2882c5){return db[_0x5364('0x52')][_0x5364('0x66')]({'where':{'id':_0x33fc2d},'transaction':_0x2882c5})['then'](function(_0x4c6f34){if(_0x4c6f34){return db[_0x5364('0x81')][_0x5364('0x33')]({'where':{'OpenchannelAccountId':_0x33fc2d},'transaction':_0x2882c5})[_0x5364('0x34')](function(){var _0x473587=_[_0x5364('0x3b')](_0x5c9ee0,function(_0xf37e6c){_0xf37e6c[_0x5364('0x63')]=_0x33fc2d;return _0xf37e6c;});return db['OpenchannelApplication']['bulkCreate'](_0x473587,{'transaction':_0x2882c5});});}else{_0x161a3e=0x194;_0x5c284b=[];}});})[_0x5364('0x34')](function(){if(_0x161a3e!==0x194){return db[_0x5364('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x33fc2d},'order':_0x5364('0xa5')})[_0x5364('0x34')](function(_0x1d23cf){_0x5c284b=_0x1d23cf;});}})[_0x5364('0x27')](function(_0x4f53b1){_0x161a3e=0x1f4;logger[_0x5364('0x22')](_0x4f53b1[_0x5364('0xa6')]);if(_0x4f53b1[_0x5364('0x37')]){delete _0x4f53b1[_0x5364('0x37')];}_0x5c284b=_0x4f53b1;})[_0x5364('0xa7')](function(){if(_0x5c284b===null){_0x4f615c[_0x5364('0x28')](_0x161a3e);}else{if(_0x161a3e===0x1f4){_0x4f615c[_0x5364('0x29')](_0x161a3e)[_0x5364('0xa8')](_0x5c284b);}else{_0x4f615c[_0x5364('0x29')](_0x161a3e)[_0x5364('0x2b')](_0x5c284b);}}});};exports[_0x5364('0xa9')]=function(_0x5d0775,_0x5e76af,_0x8abddf){var _0x4c496d={};var _0x2c1f7e={};var _0x468e4a;var _0x466915;return db[_0x5364('0x52')][_0x5364('0x66')]({'where':{'id':_0x5d0775[_0x5364('0x56')]['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x5e76af,null))[_0x5364('0x34')](function(_0x266fee){if(_0x266fee){_0x468e4a=_0x266fee;_0x2c1f7e[_0x5364('0x40')]=_[_0x5364('0x42')](db[_0x5364('0x81')]['rawAttributes']);_0x2c1f7e[_0x5364('0x41')]=_[_0x5364('0x42')](_0x5d0775['query']);_0x2c1f7e[_0x5364('0x4a')]=_[_0x5364('0x43')](_0x2c1f7e[_0x5364('0x40')],_0x2c1f7e[_0x5364('0x41')]);_0x4c496d[_0x5364('0x44')]=_['intersection'](_0x2c1f7e[_0x5364('0x40')],qs[_0x5364('0x45')](_0x5d0775[_0x5364('0x41')]['fields']));_0x4c496d[_0x5364('0x44')]=_0x4c496d[_0x5364('0x44')][_0x5364('0x89')]?_0x4c496d[_0x5364('0x44')]:_0x2c1f7e[_0x5364('0x40')];_0x4c496d['order']=qs[_0x5364('0x48')](_0x5d0775['query'][_0x5364('0x48')]);_0x4c496d[_0x5364('0x49')]=qs[_0x5364('0x4a')](_['pick'](_0x5d0775['query'],_0x2c1f7e['filters']));if(_0x5d0775['query'][_0x5364('0x4c')]){_0x4c496d[_0x5364('0x49')]=_['merge'](_0x4c496d[_0x5364('0x49')],{'$or':_[_0x5364('0x3b')](_0x4c496d[_0x5364('0x44')],function(_0x18bfbb){var _0x12419a={};_0x12419a[_0x18bfbb]={'$like':'%'+_0x5d0775[_0x5364('0x41')]['filter']+'%'};return _0x12419a;})});}_0x4c496d=_[_0x5364('0x4d')]({},_0x4c496d,_0x5d0775[_0x5364('0x57')]);return _0x468e4a[_0x5364('0xa9')](_0x4c496d);}})['then'](function(_0x5e0327){if(_0x5e0327){_0x466915=_0x5e0327[_0x5364('0x89')];if(!_0x5d0775[_0x5364('0x41')]['hasOwnProperty'](_0x5364('0x67'))){_0x4c496d[_0x5364('0x2d')]=qs[_0x5364('0x2d')](_0x5d0775['query']['limit']);_0x4c496d[_0x5364('0x2c')]=qs[_0x5364('0x2c')](_0x5d0775['query'][_0x5364('0x2c')]);}return _0x468e4a[_0x5364('0xa9')](_0x4c496d);}})[_0x5364('0x34')](function(_0x26283c){if(_0x26283c){return _0x26283c?{'count':_0x466915,'rows':_0x26283c}:null;}})['then'](respondWithResult(_0x5e76af,null))['catch'](handleError(_0x5e76af,null));};exports[_0x5364('0xaa')]=function(_0x165c75,_0x280a66,_0x2a029c){var _0x332ba0={'raw':![],'where':{}};var _0x5815cf={};var _0x22e042={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5364('0x66')]({'where':{'id':_0x165c75[_0x5364('0x56')]['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x280a66,null))['then'](function(_0xabfd1e){if(_0xabfd1e){_0x5815cf[_0x5364('0x40')]=_[_0x5364('0x42')](db[_0x5364('0x8f')][_0x5364('0x3c')]);_0x5815cf[_0x5364('0x41')]=_[_0x5364('0x42')](_0x165c75[_0x5364('0x41')]);_0x5815cf[_0x5364('0x4a')]=_[_0x5364('0x43')](_0x5815cf[_0x5364('0x40')],_0x5815cf[_0x5364('0x41')]);_0x332ba0['attributes']=_['intersection'](_0x5815cf['model'],qs[_0x5364('0x45')](_0x165c75[_0x5364('0x41')][_0x5364('0x45')]));_0x332ba0['attributes']=_0x332ba0[_0x5364('0x44')][_0x5364('0x89')]?_0x332ba0[_0x5364('0x44')]:_0x5815cf[_0x5364('0x40')];if(!_0x165c75[_0x5364('0x41')][_0x5364('0x46')](_0x5364('0x67'))){_0x332ba0[_0x5364('0x2d')]=qs[_0x5364('0x2d')](_0x165c75['query']['limit']);_0x332ba0['offset']=qs['offset'](_0x165c75['query'][_0x5364('0x2c')]);}_0x332ba0['order']=qs[_0x5364('0x48')](_0x165c75[_0x5364('0x41')]['sort']);_0x332ba0['where']=qs[_0x5364('0x4a')](_['pick'](_0x165c75['query'],_0x5815cf[_0x5364('0x4a')]));_0x332ba0[_0x5364('0x49')]['OpenchannelAccountId']=_0xabfd1e['id'];if(_0x165c75[_0x5364('0x41')][_0x5364('0x4c')]){_0x332ba0[_0x5364('0x49')]=_[_0x5364('0x4d')](_0x332ba0[_0x5364('0x49')],{'$or':_[_0x5364('0x3b')](_0x332ba0[_0x5364('0x44')],function(_0x4db705){var _0x8d92cc={};_0x8d92cc[_0x4db705]={'$like':'%'+_0x165c75[_0x5364('0x41')]['filter']+'%'};return _0x8d92cc;})});}_0x332ba0=_[_0x5364('0x4d')]({},_0x332ba0,_0x165c75[_0x5364('0x57')]);return db[_0x5364('0x8f')]['count']({'where':_0x332ba0[_0x5364('0x49')]})[_0x5364('0x34')](function(_0x515d80){_0x22e042['count']=_0x515d80;if(_0x165c75[_0x5364('0x41')][_0x5364('0x50')]){_0x332ba0['include']=[{'model':db[_0x5364('0x70')],'as':_0x5364('0xab'),'required':![]},{'model':db[_0x5364('0xac')],'as':_0x5364('0xad'),'attributes':[_0x5364('0x37'),_0x5364('0xae'),'internal'],'required':![]},{'model':db[_0x5364('0xaf')],'as':'Tags','attributes':['id',_0x5364('0x37'),_0x5364('0xb0')],'where':_0x165c75[_0x5364('0x41')][_0x5364('0xb1')]?{'id':_0x165c75[_0x5364('0x41')][_0x5364('0xb1')]}:undefined,'required':_0x165c75[_0x5364('0x41')][_0x5364('0xb1')]?!![]:![]}];}return db[_0x5364('0x8f')][_0x5364('0x53')](_0x332ba0);})[_0x5364('0x34')](function(_0x1ff66a){_0x22e042['rows']=_0x1ff66a;return _0x22e042;});}})[_0x5364('0x34')](respondWithFilteredResult(_0x280a66,_0x332ba0))['catch'](handleError(_0x280a66,null));};exports[_0x5364('0xb2')]=function(_0x25ecfd,_0x2c92e,_0x300f9f){return db[_0x5364('0x52')][_0x5364('0x5c')]({'where':{'id':_0x25ecfd['params']['id']}})[_0x5364('0x34')](handleEntityNotFound(_0x2c92e,null))[_0x5364('0x34')](function(_0xf7b7a9){if(_0xf7b7a9){return _0xf7b7a9['addAgents'](_0x25ecfd['body'][_0x5364('0x6d')],_[_0x5364('0xb3')](_0x25ecfd[_0x5364('0x60')],[_0x5364('0x6d'),'id'])||{})[_0x5364('0x91')](function(_0x231592){for(var _0x4bdc9b=0x0;_0x4bdc9b<_0x25ecfd[_0x5364('0x60')][_0x5364('0x6d')]['length'];_0x4bdc9b+=0x1){socket[_0x5364('0xb4')](_0x5364('0xb5'),{'UserId':Number(_0x25ecfd[_0x5364('0x60')][_0x5364('0x6d')][_0x4bdc9b]),'OpenchannelAccountId':Number(_0x25ecfd[_0x5364('0x56')]['id'])});}return _0x231592;});}})[_0x5364('0x34')](respondWithResult(_0x2c92e,null))['catch'](handleError(_0x2c92e,null));};exports[_0x5364('0xb6')]=function(_0x2e86f8,_0xb1768b,_0x5dfb1b){return db[_0x5364('0x52')][_0x5364('0x5c')]({'where':{'id':_0x2e86f8['params']['id']}})[_0x5364('0x34')](handleEntityNotFound(_0xb1768b,null))[_0x5364('0x34')](function(_0x12e267){if(_0x12e267){return _0x12e267['removeAgents'](_0x2e86f8[_0x5364('0x41')]['ids'])[_0x5364('0x34')](function(){if(_[_0x5364('0xb7')](_0x2e86f8[_0x5364('0x41')][_0x5364('0x6d')])){for(var _0x53f18c=0x0;_0x53f18c<_0x2e86f8[_0x5364('0x41')]['ids'][_0x5364('0x89')];_0x53f18c+=0x1){socket[_0x5364('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2e86f8[_0x5364('0x41')][_0x5364('0x6d')][_0x53f18c]),'OpenchannelAccountId':Number(_0x2e86f8['params']['id'])});}}else{socket[_0x5364('0xb4')](_0x5364('0xb8'),{'UserId':Number(_0x2e86f8[_0x5364('0x41')][_0x5364('0x6d')]),'OpenchannelAccountId':Number(_0x2e86f8[_0x5364('0x56')]['id'])});}});}})[_0x5364('0x34')](respondWithStatusCode(_0xb1768b,null))['catch'](handleError(_0xb1768b,null));};exports[_0x5364('0xb9')]=function(_0x506323,_0x1c8b8c,_0x3fcd4d){var _0x5e5478={};var _0x518ed6={};var _0x1fd8f3;var _0x96a51c;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x506323[_0x5364('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c8b8c,null))[_0x5364('0x34')](function(_0x1fbe44){if(_0x1fbe44){_0x1fd8f3=_0x1fbe44;_0x518ed6[_0x5364('0x40')]=_[_0x5364('0x42')](db[_0x5364('0xac')][_0x5364('0x3c')]);_0x518ed6[_0x5364('0x41')]=_[_0x5364('0x42')](_0x506323[_0x5364('0x41')]);_0x518ed6[_0x5364('0x4a')]=_['intersection'](_0x518ed6[_0x5364('0x40')],_0x518ed6[_0x5364('0x41')]);_0x5e5478['attributes']=_['intersection'](_0x518ed6['model'],qs['fields'](_0x506323[_0x5364('0x41')][_0x5364('0x45')]));_0x5e5478['attributes']=_0x5e5478[_0x5364('0x44')][_0x5364('0x89')]?_0x5e5478['attributes']:_0x518ed6[_0x5364('0x40')];_0x5e5478[_0x5364('0x47')]=qs[_0x5364('0x48')](_0x506323['query'][_0x5364('0x48')]);_0x5e5478[_0x5364('0x49')]=qs[_0x5364('0x4a')](_[_0x5364('0x4b')](_0x506323[_0x5364('0x41')],_0x518ed6[_0x5364('0x4a')]));if(_0x506323['query'][_0x5364('0x4c')]){_0x5e5478[_0x5364('0x49')]=_['merge'](_0x5e5478[_0x5364('0x49')],{'$or':_[_0x5364('0x3b')](_0x5e5478[_0x5364('0x44')],function(_0x4b5743){var _0x50119b={};_0x50119b[_0x4b5743]={'$like':'%'+_0x506323[_0x5364('0x41')][_0x5364('0x4c')]+'%'};return _0x50119b;})});}_0x5e5478=_[_0x5364('0x4d')]({},_0x5e5478,_0x506323['options']);return _0x1fd8f3[_0x5364('0xb9')](_0x5e5478);}})[_0x5364('0x34')](function(_0x2e7c6a){if(_0x2e7c6a){_0x96a51c=_0x2e7c6a[_0x5364('0x89')];if(!_0x506323['query'][_0x5364('0x46')]('nolimit')){_0x5e5478[_0x5364('0x2d')]=qs[_0x5364('0x2d')](_0x506323['query'][_0x5364('0x2d')]);_0x5e5478['offset']=qs[_0x5364('0x2c')](_0x506323[_0x5364('0x41')]['offset']);}return _0x1fd8f3[_0x5364('0xb9')](_0x5e5478);}})[_0x5364('0x34')](function(_0x239dcc){if(_0x239dcc){return _0x239dcc?{'count':_0x96a51c,'rows':_0x239dcc}:null;}})[_0x5364('0x34')](respondWithResult(_0x1c8b8c,null))[_0x5364('0x27')](handleError(_0x1c8b8c,null));};exports['send']=function(_0x311c75,_0x1085b7,_0x164fe2){var _0x374681,_0x159b02,_0x327fe4;if(_['isNil'](_0x311c75[_0x5364('0x60')]['body'])||_0x311c75[_0x5364('0x60')][_0x5364('0x60')]===''){throw new db['Sequelize'][(_0x5364('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5364('0x76')](_0x311c75[_0x5364('0x60')]['to'])){}_0x374681=_0x311c75[_0x5364('0x60')]['to'];return db[_0x5364('0x52')][_0x5364('0x66')]({'where':{'id':_0x311c75['params']['id']}})['then'](handleEntityNotFound(_0x1085b7,null))[_0x5364('0x34')](function(_0x59e5df){if(_0x59e5df){return db[_0x5364('0x52')]['find']({'where':{'id':_0x59e5df['id']},'include':[{'model':db[_0x5364('0x7f')],'as':_0x5364('0x84'),'include':[{'model':db[_0x5364('0x70')],'as':_0x5364('0x88'),'where':{[_0x59e5df['mapKey']]:_0x374681},'limit':0x1,'order':[[_0x5364('0xba'),'DESC']]}]}]})[_0x5364('0x34')](handleEntityNotFound(_0x1085b7,null))[_0x5364('0x34')](function(_0x18a820){if(_0x18a820&&_0x18a820[_0x5364('0x84')]){_0x159b02=_0x18a820[_0x5364('0x35')]({'plain':!![]});if(_0x159b02['List']&&_0x159b02['List'][_0x5364('0x88')][_0x5364('0x89')]){return _0x159b02[_0x5364('0x84')]['Contacts'][0x0];}return db[_0x5364('0x70')]['create'](_[_0x5364('0x19')](_0x311c75['body'],{'firstName':_0x374681,[_0x18a820[_0x5364('0x7a')]]:_0x374681,'phone':_0x374681,'ListId':_0x159b02[_0x5364('0x8a')]}));}})[_0x5364('0x34')](handleEntityNotFound(_0x1085b7,null))[_0x5364('0x34')](function(_0x2f92bc){if(_0x2f92bc){_0x327fe4=_0x2f92bc;return db['OpenchannelInteraction'][_0x5364('0x5c')]({'where':{'ContactId':_0x327fe4['id'],'closed':![],'OpenchannelAccountId':_0x159b02['id']}})['then'](function(_0x26e0f0){if(_0x26e0f0){return[_0x26e0f0,![]];}return db[_0x5364('0x8f')][_0x5364('0x58')]({'UserId':_0x311c75['user']['id'],'ContactId':_0x327fe4['id'],'OpenchannelAccountId':_0x159b02['id'],'lastMsgDirection':_0x5364('0xbb'),'firstMsgDirection':_0x5364('0xbb'),'Messages':[_[_0x5364('0x4d')](_0x311c75[_0x5364('0x60')],{'read':![],'body':_0x311c75[_0x5364('0x60')]['body'],'OpenchannelAccountId':_0x159b02['id'],'UserId':_0x311c75[_0x5364('0x59')]['id'],'ContactId':_0x327fe4['id']})]},{'include':[{'model':db[_0x5364('0x98')],'as':_0x5364('0xbc')}]})['then'](function(_0x98c5a4){return[_0x98c5a4,!![]];});});}})[_0x5364('0x91')](function(_0x19f013,_0x251129){if(_0x251129){return _0x19f013;}return db['OpenchannelMessage']['create'](_[_0x5364('0x4d')](_0x311c75['body'],{'read':![],'body':_0x311c75[_0x5364('0x60')][_0x5364('0x60')],'OpenchannelAccountId':_0x159b02['id'],'OpenchannelInteractionId':_0x19f013['id'],'UserId':_0x311c75[_0x5364('0x59')]['id'],'ContactId':_0x327fe4['id']}))['then'](function(_0x76a53b){_0x19f013[_0x5364('0xbd')][_0x5364('0xbc')]=[];_0x19f013[_0x5364('0xbd')][_0x5364('0xbc')][_0x5364('0x95')](_0x76a53b[_0x5364('0xbd')]);return _0x19f013;});});}})[_0x5364('0x34')](respondWithResult(_0x1085b7,null))[_0x5364('0x27')](handleError(_0x1085b7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b4d9f02..ee4bbbc 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 _0x4ea3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x16a74d,_0x15923c){var _0x522497=function(_0x53761){while(--_0x53761){_0x16a74d['push'](_0x16a74d['shift']());}};_0x522497(++_0x15923c);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x34ea('0x0'));var OpenchannelAccount=require(_0x34ea('0x1'))['db'][_0x34ea('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x34ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x34ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x269d4c){return function(_0x571f1b,_0x5e5a84,_0x2ce955){OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c+':'+_0x571f1b['id'],_0x571f1b);OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c,_0x571f1b);_0x2ce955(null);};}for(var e in events){if(events[_0x34ea('0x6')](e)){var event=events[e];OpenchannelAccount[_0x34ea('0x7')](e,emitEvent(event));}}module[_0x34ea('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5ff3=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove'];(function(_0x11f538,_0x440a98){var _0x4ad7a4=function(_0x707812){while(--_0x707812){_0x11f538['push'](_0x11f538['shift']());}};_0x4ad7a4(++_0x440a98);}(_0x5ff3,0x17d));var _0x35ff=function(_0x15d45d,_0x4c6179){_0x15d45d=_0x15d45d-0x0;var _0xb9e64d=_0x5ff3[_0x15d45d];return _0xb9e64d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x35ff('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x35ff('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ff('0x2'),'afterDestroy':_0x35ff('0x3')};function emitEvent(_0x3bd66a){return function(_0xd0846d,_0x551514,_0x2fcb74){OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a+':'+_0xd0846d['id'],_0xd0846d);OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a,_0xd0846d);_0x2fcb74(null);};}for(var e in events){if(events[_0x35ff('0x5')](e)){var event=events[e];OpenchannelAccount[_0x35ff('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index beb27fa..6e34278 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(_0x184d7d,_0x3923b7){var _0x546fc1=function(_0xd5dc7){while(--_0xd5dc7){_0x184d7d['push'](_0x184d7d['shift']());}};_0x546fc1(++_0x3923b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x26f2e6,_0x1cccb2){var _0x43e964=function(_0x2328ea){while(--_0x2328ea){_0x26f2e6['push'](_0x26f2e6['shift']());}};_0x43e964(++_0x1cccb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 ac43fc9..09ab997 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 _0x073e=['../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../config/utils'];(function(_0x126285,_0x317706){var _0x4d926e=function(_0x3ae352){while(--_0x3ae352){_0x126285['push'](_0x126285['shift']());}};_0x4d926e(++_0x317706);}(_0x073e,0x181));var _0xe073=function(_0x32d8ca,_0x3bd6f9){_0x32d8ca=_0x32d8ca-0x0;var _0x46d9f2=_0x073e[_0x32d8ca];return _0x46d9f2;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var moment=require(_0xe073('0x2'));var BPromise=require(_0xe073('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe073('0x4'));var logger=require(_0xe073('0x5'))(_0xe073('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe073('0x7')]({'port':0x232a});config[_0xe073('0x8')]=_[_0xe073('0x9')](config[_0xe073('0x8')],{'host':_0xe073('0xa'),'port':0x18eb});var socket=require(_0xe073('0xb'))(new Redis(config['redis']));require(_0xe073('0xc'))[_0xe073('0xd')](socket);function respondWithRpcPromise(_0x46757c,_0x118048,_0x4fccb1){return new BPromise(function(_0x47ac27,_0x32878f){return client[_0xe073('0xe')](_0x46757c,_0x4fccb1)[_0xe073('0xf')](function(_0x3a9df1){logger[_0xe073('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x118048,_0xe073('0x11'));logger['debug'](_0xe073('0x12'),_0x118048,'request\x20sent',JSON[_0xe073('0x13')](_0x3a9df1));if(_0x3a9df1['error']){if(_0x3a9df1[_0xe073('0x14')][_0xe073('0x15')]===0x1f4){logger[_0xe073('0x14')](_0xe073('0x16'),_0x118048,_0x3a9df1[_0xe073('0x14')][_0xe073('0x17')]);return _0x32878f(_0x3a9df1[_0xe073('0x14')][_0xe073('0x17')]);}logger[_0xe073('0x14')](_0xe073('0x16'),_0x118048,_0x3a9df1[_0xe073('0x14')]['message']);return _0x47ac27(_0x3a9df1['error']['message']);}else{logger[_0xe073('0x10')](_0xe073('0x16'),_0x118048,_0xe073('0x11'));_0x47ac27(_0x3a9df1[_0xe073('0x18')]['message']);}})[_0xe073('0x19')](function(_0x103a51){logger[_0xe073('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x118048,_0x103a51);_0x32878f(_0x103a51);});});} \ No newline at end of file +var _0x0427=['./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x329470,_0x40e736){var _0x3ebbb4=function(_0x38bd93){while(--_0x38bd93){_0x329470['push'](_0x329470['shift']());}};_0x3ebbb4(++_0x40e736);}(_0x0427,0x137));var _0x7042=function(_0x2898e5,_0x328520){_0x2898e5=_0x2898e5-0x0;var _0x1e29bd=_0x0427[_0x2898e5];return _0x1e29bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});config[_0x7042('0xa')]=_[_0x7042('0xb')](config[_0x7042('0xa')],{'host':_0x7042('0xc'),'port':0x18eb});var socket=require(_0x7042('0xd'))(new Redis(config[_0x7042('0xa')]));require(_0x7042('0xe'))[_0x7042('0xf')](socket);function respondWithRpcPromise(_0x5a29aa,_0x326210,_0x5c3f0f){return new BPromise(function(_0x5cf853,_0x50eefb){return client['request'](_0x5a29aa,_0x5c3f0f)[_0x7042('0x10')](function(_0x5636e8){logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x326210,_0x7042('0x13'),JSON[_0x7042('0x14')](_0x5636e8));if(_0x5636e8[_0x7042('0x15')]){if(_0x5636e8[_0x7042('0x15')][_0x7042('0x16')]===0x1f4){logger[_0x7042('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x326210,_0x5636e8[_0x7042('0x15')][_0x7042('0x17')]);return _0x50eefb(_0x5636e8[_0x7042('0x15')]['message']);}logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x5636e8['error'][_0x7042('0x17')]);return _0x5cf853(_0x5636e8['error']['message']);}else{logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));_0x5cf853(_0x5636e8[_0x7042('0x18')][_0x7042('0x17')]);}})['catch'](function(_0x438084){logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x438084);_0x50eefb(_0x438084);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f5f0de2..6c3ab57 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 _0x1da6=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0xfc4ad0,_0x51c8b6){var _0x4d98e2=function(_0x3839f5){while(--_0x3839f5){_0xfc4ad0['push'](_0xfc4ad0['shift']());}};_0x4d98e2(++_0x51c8b6);}(_0x1da6,0x7c));var _0x61da=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x1da6[_0x1ee0a1];return _0x1d2d5b;};'use strict';var OpenchannelAccountEvents=require(_0x61da('0x0'));var events=[_0x61da('0x1'),_0x61da('0x2'),_0x61da('0x3')];function createListener(_0x19474a,_0xbe2d90){return function(_0x1cec74){_0xbe2d90[_0x61da('0x4')](_0x19474a,_0x1cec74);};}function removeListener(_0xf7a566,_0xe55a12){return function(){OpenchannelAccountEvents[_0x61da('0x5')](_0xf7a566,_0xe55a12);};}exports[_0x61da('0x6')]=function(_0x16cd66){for(var _0x2c40c6=0x0,_0x2bb2c7=events[_0x61da('0x7')];_0x2c40c6<_0x2bb2c7;_0x2c40c6++){var _0x196162=events[_0x2c40c6];var _0x352ac4=createListener(_0x61da('0x8')+_0x196162,_0x16cd66);OpenchannelAccountEvents['on'](_0x196162,_0x352ac4);}}; \ No newline at end of file +var _0x6a24=['save','update','emit','removeListener','./openchannelAccount.events'];(function(_0x15e94c,_0x557119){var _0x372f78=function(_0x242989){while(--_0x242989){_0x15e94c['push'](_0x15e94c['shift']());}};_0x372f78(++_0x557119);}(_0x6a24,0xd1));var _0x46a2=function(_0x2ace02,_0x49f046){_0x2ace02=_0x2ace02-0x0;var _0x331bfe=_0x6a24[_0x2ace02];return _0x331bfe;};'use strict';var OpenchannelAccountEvents=require(_0x46a2('0x0'));var events=[_0x46a2('0x1'),'remove',_0x46a2('0x2')];function createListener(_0x3be5d8,_0x1186b2){return function(_0x237c8b){_0x1186b2[_0x46a2('0x3')](_0x3be5d8,_0x237c8b);};}function removeListener(_0x59a55c,_0x30bf8b){return function(){OpenchannelAccountEvents[_0x46a2('0x4')](_0x59a55c,_0x30bf8b);};}exports['register']=function(_0x22de0d){for(var _0x8b6541=0x0,_0x506698=events['length'];_0x8b6541<_0x506698;_0x8b6541++){var _0x2092f3=events[_0x8b6541];var _0x321b88=createListener('openchannelAccount:'+_0x2092f3,_0x22de0d);OpenchannelAccountEvents['on'](_0x2092f3,_0x321b88);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index ad43264..efb4b68 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 _0x4534=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x43a839,_0x458067){var _0xb9a365=function(_0x4045f6){while(--_0x4045f6){_0x43a839['push'](_0x43a839['shift']());}};_0xb9a365(++_0x458067);}(_0x4534,0x1e8));var _0x4453=function(_0x5cf1ad,_0x13d86a){_0x5cf1ad=_0x5cf1ad-0x0;var _0x87649a=_0x4534[_0x5cf1ad];return _0x87649a;};'use strict';var multer=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var path=require(_0x4453('0x2'));var timeout=require(_0x4453('0x3'));var express=require(_0x4453('0x4'));var router=express[_0x4453('0x5')]();var fs_extra=require(_0x4453('0x6'));var auth=require(_0x4453('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4453('0x8'));var controller=require(_0x4453('0x9'));router[_0x4453('0xa')]('/',auth[_0x4453('0xb')](),controller[_0x4453('0xc')]);router[_0x4453('0xa')](_0x4453('0xd'),auth[_0x4453('0xb')](),controller[_0x4453('0xe')]);router[_0x4453('0xf')]('/',auth[_0x4453('0xb')](),controller['create']);router[_0x4453('0x10')](_0x4453('0xd'),auth['isAuthenticated'](),controller[_0x4453('0x11')]);router[_0x4453('0x12')](_0x4453('0xd'),auth[_0x4453('0xb')](),controller[_0x4453('0x13')]);module[_0x4453('0x14')]=router; \ No newline at end of file +var _0x58a6=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x144ba6,_0x195e93){var _0x4e68e1=function(_0x323b56){while(--_0x323b56){_0x144ba6['push'](_0x144ba6['shift']());}};_0x4e68e1(++_0x195e93);}(_0x58a6,0x6d));var _0x658a=function(_0x11638a,_0x2890d0){_0x11638a=_0x11638a-0x0;var _0x415918=_0x58a6[_0x11638a];return _0x415918;};'use strict';var multer=require(_0x658a('0x0'));var util=require(_0x658a('0x1'));var path=require(_0x658a('0x2'));var timeout=require(_0x658a('0x3'));var express=require(_0x658a('0x4'));var router=express[_0x658a('0x5')]();var fs_extra=require(_0x658a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x658a('0x7'));var config=require(_0x658a('0x8'));var controller=require('./openchannelApplication.controller');router[_0x658a('0x9')]('/',auth[_0x658a('0xa')](),controller[_0x658a('0xb')]);router[_0x658a('0x9')](_0x658a('0xc'),auth[_0x658a('0xa')](),controller[_0x658a('0xd')]);router[_0x658a('0xe')]('/',auth[_0x658a('0xa')](),controller[_0x658a('0xf')]);router['put'](_0x658a('0xc'),auth[_0x658a('0xa')](),controller[_0x658a('0x10')]);router[_0x658a('0x11')](_0x658a('0xc'),auth[_0x658a('0xa')](),controller['destroy']);module[_0x658a('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 af1dfc8..1d9e711 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 _0x89f5=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x89f5,0x118));var _0x589f=function(_0xb1f2b2,_0x32e802){_0xb1f2b2=_0xb1f2b2-0x0;var _0x5bbffc=_0x89f5[_0xb1f2b2];return _0x5bbffc;};'use strict';var Sequelize=require(_0x589f('0x0'));module[_0x589f('0x1')]={'priority':{'type':Sequelize[_0x589f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x589f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x589f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x589f('0x5')}}; \ No newline at end of file +var _0xe62e=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xa3c18c,_0x42876b){var _0x5c0f6f=function(_0x19cf40){while(--_0x19cf40){_0xa3c18c['push'](_0xa3c18c['shift']());}};_0x5c0f6f(++_0x42876b);}(_0xe62e,0x1ac));var _0xee62=function(_0x43d723,_0x1c7fa5){_0x43d723=_0x43d723-0x0;var _0x5af076=_0xe62e[_0x43d723];return _0x5af076;};'use strict';var Sequelize=require(_0xee62('0x0'));module[_0xee62('0x1')]={'priority':{'type':Sequelize[_0xee62('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xee62('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xee62('0x4')]()},'description':{'type':Sequelize[_0xee62('0x3')]},'interval':{'type':Sequelize[_0xee62('0x3')],'defaultValue':_0xee62('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 58ed51a..4aed456 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 _0x90df=['options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','length'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x90df,0x16d));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf90d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf90d('0x1'));var jsonpatch=require(_0xf90d('0x2'));var rp=require(_0xf90d('0x3'));var moment=require(_0xf90d('0x4'));var BPromise=require(_0xf90d('0x5'));var Mustache=require('mustache');var util=require(_0xf90d('0x6'));var path=require(_0xf90d('0x7'));var sox=require(_0xf90d('0x8'));var csv=require('to-csv');var ejs=require(_0xf90d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf90d('0xa'));var squel=require(_0xf90d('0xb'));var crypto=require(_0xf90d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf90d('0xd'));var Papa=require(_0xf90d('0xe'));var Redis=require(_0xf90d('0xf'));var authService=require(_0xf90d('0x10'));var qs=require(_0xf90d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf90d('0x12'));var logger=require(_0xf90d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf90d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf90d('0x15'))['db'];function respondWithStatusCode(_0x5eb805,_0xecbae){_0xecbae=_0xecbae||0xcc;return function(_0x6988cd){if(_0x6988cd){return _0x5eb805[_0xf90d('0x16')](_0xecbae);}return _0x5eb805[_0xf90d('0x17')](_0xecbae)[_0xf90d('0x18')]();};}function respondWithResult(_0x3d9d3d,_0x3d5ef6){_0x3d5ef6=_0x3d5ef6||0xc8;return function(_0x27897f){if(_0x27897f){return _0x3d9d3d[_0xf90d('0x17')](_0x3d5ef6)[_0xf90d('0x19')](_0x27897f);}};}function respondWithFilteredResult(_0x53464e,_0x3b5b66){return function(_0x406ad6){if(_0x406ad6){var _0x411949=typeof _0x3b5b66[_0xf90d('0x1a')]===_0xf90d('0x1b')&&typeof _0x3b5b66[_0xf90d('0x1c')]===_0xf90d('0x1b');var _0x2ba8f0=_0x406ad6[_0xf90d('0x1d')];var _0xff575e=_0x411949?0x0:_0x3b5b66['offset'];var _0x33793f=_0x411949?_0x406ad6['count']:_0x3b5b66['offset']+_0x3b5b66[_0xf90d('0x1c')];var _0xb90d00;if(_0x33793f>=_0x2ba8f0){_0x33793f=_0x2ba8f0;_0xb90d00=0xc8;}else{_0xb90d00=0xce;}_0x53464e[_0xf90d('0x17')](_0xb90d00);return _0x53464e[_0xf90d('0x1e')]('Content-Range',_0xff575e+'-'+_0x33793f+'/'+_0x2ba8f0)[_0xf90d('0x19')](_0x406ad6);}return null;};}function patchUpdates(_0x7db2e){return function(_0x5a55b4){try{jsonpatch[_0xf90d('0x1f')](_0x5a55b4,_0x7db2e,!![]);}catch(_0x4b6251){return BPromise[_0xf90d('0x20')](_0x4b6251);}return _0x5a55b4[_0xf90d('0x21')]();};}function saveUpdates(_0x1cae61,_0x54be38){return function(_0x2f52fa){if(_0x2f52fa){return _0x2f52fa[_0xf90d('0x22')](_0x1cae61)[_0xf90d('0x23')](function(_0x3a6519){return _0x3a6519;});}return null;};}function removeEntity(_0x54559f,_0x5c7f03){return function(_0x4ed5e8){if(_0x4ed5e8){return _0x4ed5e8['destroy']()[_0xf90d('0x23')](function(){_0x54559f[_0xf90d('0x17')](0xcc)[_0xf90d('0x18')]();});}};}function handleEntityNotFound(_0x50acce,_0x2f67fb){return function(_0x1e6a24){if(!_0x1e6a24){_0x50acce[_0xf90d('0x16')](0x194);}return _0x1e6a24;};}function handleError(_0x23eff1,_0x4b9e9f){_0x4b9e9f=_0x4b9e9f||0x1f4;return function(_0x10dcc8){logger[_0xf90d('0x24')](_0x10dcc8[_0xf90d('0x25')]);if(_0x10dcc8[_0xf90d('0x26')]){delete _0x10dcc8[_0xf90d('0x26')];}_0x23eff1[_0xf90d('0x17')](_0x4b9e9f)[_0xf90d('0x27')](_0x10dcc8);};}exports['index']=function(_0x53f845,_0x328bd9){var _0x5998be={},_0x1a8e47={},_0x3f33f0={'count':0x0,'rows':[]};var _0x4057c1=_[_0xf90d('0x28')](db[_0xf90d('0x29')][_0xf90d('0x2a')],function(_0x2e08b7){return{'name':_0x2e08b7['fieldName'],'type':_0x2e08b7[_0xf90d('0x2b')][_0xf90d('0x2c')]};});_0x1a8e47[_0xf90d('0x2d')]=_[_0xf90d('0x28')](_0x4057c1,_0xf90d('0x26'));_0x1a8e47['query']=_[_0xf90d('0x2e')](_0x53f845[_0xf90d('0x2f')]);_0x1a8e47[_0xf90d('0x30')]=_[_0xf90d('0x31')](_0x1a8e47[_0xf90d('0x2d')],_0x1a8e47[_0xf90d('0x2f')]);_0x5998be[_0xf90d('0x32')]=_[_0xf90d('0x31')](_0x1a8e47[_0xf90d('0x2d')],qs[_0xf90d('0x33')](_0x53f845[_0xf90d('0x2f')][_0xf90d('0x33')]));_0x5998be[_0xf90d('0x32')]=_0x5998be[_0xf90d('0x32')]['length']?_0x5998be['attributes']:_0x1a8e47['model'];if(!_0x53f845['query'][_0xf90d('0x34')](_0xf90d('0x35'))){_0x5998be[_0xf90d('0x1c')]=qs[_0xf90d('0x1c')](_0x53f845[_0xf90d('0x2f')][_0xf90d('0x1c')]);_0x5998be[_0xf90d('0x1a')]=qs[_0xf90d('0x1a')](_0x53f845[_0xf90d('0x2f')][_0xf90d('0x1a')]);}_0x5998be[_0xf90d('0x36')]=qs[_0xf90d('0x37')](_0x53f845['query'][_0xf90d('0x37')]);_0x5998be[_0xf90d('0x38')]=qs['filters'](_[_0xf90d('0x39')](_0x53f845[_0xf90d('0x2f')],_0x1a8e47[_0xf90d('0x30')]),_0x4057c1);if(_0x53f845[_0xf90d('0x2f')][_0xf90d('0x3a')]){_0x5998be['where']=_[_0xf90d('0x3b')](_0x5998be[_0xf90d('0x38')],{'$or':_[_0xf90d('0x28')](_0x4057c1,function(_0x1e9d94){if(_0x1e9d94[_0xf90d('0x2b')]!=='VIRTUAL'){var _0x4d1542={};_0x4d1542[_0x1e9d94['name']]={'$like':'%'+_0x53f845[_0xf90d('0x2f')][_0xf90d('0x3a')]+'%'};return _0x4d1542;}})});}_0x5998be=_[_0xf90d('0x3b')]({},_0x5998be,_0x53f845['options']);var _0x4e5d04={'where':_0x5998be['where']};return db[_0xf90d('0x29')][_0xf90d('0x1d')](_0x4e5d04)[_0xf90d('0x23')](function(_0x32a78d){_0x3f33f0['count']=_0x32a78d;if(_0x53f845[_0xf90d('0x2f')]['includeAll']){_0x5998be[_0xf90d('0x3c')]=[{'all':!![]}];}return db[_0xf90d('0x29')][_0xf90d('0x3d')](_0x5998be);})[_0xf90d('0x23')](function(_0x5bbdc9){_0x3f33f0[_0xf90d('0x3e')]=_0x5bbdc9;return _0x3f33f0;})['then'](respondWithFilteredResult(_0x328bd9,_0x5998be))[_0xf90d('0x3f')](handleError(_0x328bd9,null));};exports[_0xf90d('0x40')]=function(_0x3de631,_0x56028d){var _0x4b770b={'raw':!![],'where':{'id':_0x3de631[_0xf90d('0x41')]['id']}},_0x5e4919={};_0x5e4919[_0xf90d('0x2d')]=_[_0xf90d('0x2e')](db['OpenchannelApplication'][_0xf90d('0x2a')]);_0x5e4919[_0xf90d('0x2f')]=_[_0xf90d('0x2e')](_0x3de631['query']);_0x5e4919[_0xf90d('0x30')]=_[_0xf90d('0x31')](_0x5e4919[_0xf90d('0x2d')],_0x5e4919[_0xf90d('0x2f')]);_0x4b770b[_0xf90d('0x32')]=_[_0xf90d('0x31')](_0x5e4919[_0xf90d('0x2d')],qs[_0xf90d('0x33')](_0x3de631[_0xf90d('0x2f')]['fields']));_0x4b770b['attributes']=_0x4b770b[_0xf90d('0x32')][_0xf90d('0x42')]?_0x4b770b[_0xf90d('0x32')]:_0x5e4919[_0xf90d('0x2d')];if(_0x3de631[_0xf90d('0x2f')]['includeAll']){_0x4b770b[_0xf90d('0x3c')]=[{'all':!![]}];}_0x4b770b=_[_0xf90d('0x3b')]({},_0x4b770b,_0x3de631[_0xf90d('0x43')]);return db[_0xf90d('0x29')][_0xf90d('0x44')](_0x4b770b)['then'](handleEntityNotFound(_0x56028d,null))[_0xf90d('0x23')](respondWithResult(_0x56028d,null))[_0xf90d('0x3f')](handleError(_0x56028d,null));};exports[_0xf90d('0x45')]=function(_0x2c3086,_0x55057d){return db[_0xf90d('0x29')][_0xf90d('0x45')](_0x2c3086['body'],{})[_0xf90d('0x23')](respondWithResult(_0x55057d,0xc9))[_0xf90d('0x3f')](handleError(_0x55057d,null));};exports[_0xf90d('0x22')]=function(_0x130ba6,_0x9e8235){if(_0x130ba6['body']['id']){delete _0x130ba6[_0xf90d('0x46')]['id'];}return db[_0xf90d('0x29')]['find']({'where':{'id':_0x130ba6[_0xf90d('0x41')]['id']}})[_0xf90d('0x23')](handleEntityNotFound(_0x9e8235,null))[_0xf90d('0x23')](saveUpdates(_0x130ba6[_0xf90d('0x46')],null))['then'](respondWithResult(_0x9e8235,null))[_0xf90d('0x3f')](handleError(_0x9e8235,null));};exports[_0xf90d('0x47')]=function(_0x4a8be3,_0x5bd612){return db['OpenchannelApplication'][_0xf90d('0x44')]({'where':{'id':_0x4a8be3[_0xf90d('0x41')]['id']}})[_0xf90d('0x23')](handleEntityNotFound(_0x5bd612,null))['then'](removeEntity(_0x5bd612,null))[_0xf90d('0x3f')](handleError(_0x5bd612,null));}; \ No newline at end of file +var _0x2b0f=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','catch','show','params','rawAttributes','includeAll','include','merge','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0x5c724a,_0x68ea9){var _0x243331=function(_0x535951){while(--_0x535951){_0x5c724a['push'](_0x5c724a['shift']());}};_0x243331(++_0x68ea9);}(_0x2b0f,0x1b5));var _0xf2b0=function(_0x4d8e5e,_0x40daf6){_0x4d8e5e=_0x4d8e5e-0x0;var _0x1c5fe0=_0x2b0f[_0x4d8e5e];return _0x1c5fe0;};'use strict';var emlformat=require(_0xf2b0('0x0'));var rimraf=require(_0xf2b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2b0('0x2'));var rp=require(_0xf2b0('0x3'));var moment=require(_0xf2b0('0x4'));var BPromise=require(_0xf2b0('0x5'));var Mustache=require('mustache');var util=require(_0xf2b0('0x6'));var path=require(_0xf2b0('0x7'));var sox=require(_0xf2b0('0x8'));var csv=require(_0xf2b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2b0('0xa'));var _=require('lodash');var squel=require(_0xf2b0('0xb'));var crypto=require(_0xf2b0('0xc'));var jsforce=require(_0xf2b0('0xd'));var deskjs=require(_0xf2b0('0xe'));var toCsv=require(_0xf2b0('0x9'));var querystring=require('querystring');var Papa=require(_0xf2b0('0xf'));var Redis=require(_0xf2b0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf2b0('0x11'));var as=require(_0xf2b0('0x12'));var hardwareService=require(_0xf2b0('0x13'));var logger=require(_0xf2b0('0x14'))(_0xf2b0('0x15'));var utils=require(_0xf2b0('0x16'));var config=require(_0xf2b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2b0('0x18'))['db'];function respondWithStatusCode(_0x4f0139,_0x180898){_0x180898=_0x180898||0xcc;return function(_0x20ace2){if(_0x20ace2){return _0x4f0139[_0xf2b0('0x19')](_0x180898);}return _0x4f0139[_0xf2b0('0x1a')](_0x180898)[_0xf2b0('0x1b')]();};}function respondWithResult(_0x1498e6,_0x3c2898){_0x3c2898=_0x3c2898||0xc8;return function(_0x47c755){if(_0x47c755){return _0x1498e6[_0xf2b0('0x1a')](_0x3c2898)[_0xf2b0('0x1c')](_0x47c755);}};}function respondWithFilteredResult(_0x4c9941,_0x15ecd9){return function(_0xa544ce){if(_0xa544ce){var _0x3d774c=typeof _0x15ecd9[_0xf2b0('0x1d')]==='undefined'&&typeof _0x15ecd9[_0xf2b0('0x1e')]===_0xf2b0('0x1f');var _0x556dcc=_0xa544ce['count'];var _0x283ae8=_0x3d774c?0x0:_0x15ecd9[_0xf2b0('0x1d')];var _0x54cdb8=_0x3d774c?_0xa544ce[_0xf2b0('0x20')]:_0x15ecd9[_0xf2b0('0x1d')]+_0x15ecd9[_0xf2b0('0x1e')];var _0x1ae8a6;if(_0x54cdb8>=_0x556dcc){_0x54cdb8=_0x556dcc;_0x1ae8a6=0xc8;}else{_0x1ae8a6=0xce;}_0x4c9941[_0xf2b0('0x1a')](_0x1ae8a6);return _0x4c9941['set'](_0xf2b0('0x21'),_0x283ae8+'-'+_0x54cdb8+'/'+_0x556dcc)[_0xf2b0('0x1c')](_0xa544ce);}return null;};}function patchUpdates(_0x45c5fc){return function(_0x139bb6){try{jsonpatch[_0xf2b0('0x22')](_0x139bb6,_0x45c5fc,!![]);}catch(_0x44a2f9){return BPromise[_0xf2b0('0x23')](_0x44a2f9);}return _0x139bb6[_0xf2b0('0x24')]();};}function saveUpdates(_0x3d0404,_0x4d5151){return function(_0x290539){if(_0x290539){return _0x290539['update'](_0x3d0404)[_0xf2b0('0x25')](function(_0x3cffb8){return _0x3cffb8;});}return null;};}function removeEntity(_0x5e9b36,_0x2baedd){return function(_0x207574){if(_0x207574){return _0x207574[_0xf2b0('0x26')]()[_0xf2b0('0x25')](function(){_0x5e9b36[_0xf2b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b12b4,_0x46f7f1){return function(_0x4186e2){if(!_0x4186e2){_0x2b12b4[_0xf2b0('0x19')](0x194);}return _0x4186e2;};}function handleError(_0x38c775,_0xe3c301){_0xe3c301=_0xe3c301||0x1f4;return function(_0x4b5be0){logger[_0xf2b0('0x27')](_0x4b5be0[_0xf2b0('0x28')]);if(_0x4b5be0[_0xf2b0('0x29')]){delete _0x4b5be0[_0xf2b0('0x29')];}_0x38c775[_0xf2b0('0x1a')](_0xe3c301)[_0xf2b0('0x2a')](_0x4b5be0);};}exports[_0xf2b0('0x2b')]=function(_0x59c36d,_0x5c59f3){var _0x10c2c7={},_0x4e0755={},_0x51f511={'count':0x0,'rows':[]};var _0x235e0e=_[_0xf2b0('0x2c')](db[_0xf2b0('0x2d')]['rawAttributes'],function(_0x248e9d){return{'name':_0x248e9d[_0xf2b0('0x2e')],'type':_0x248e9d[_0xf2b0('0x2f')]['key']};});_0x4e0755['model']=_[_0xf2b0('0x2c')](_0x235e0e,_0xf2b0('0x29'));_0x4e0755[_0xf2b0('0x30')]=_[_0xf2b0('0x31')](_0x59c36d[_0xf2b0('0x30')]);_0x4e0755[_0xf2b0('0x32')]=_[_0xf2b0('0x33')](_0x4e0755[_0xf2b0('0x34')],_0x4e0755['query']);_0x10c2c7[_0xf2b0('0x35')]=_[_0xf2b0('0x33')](_0x4e0755['model'],qs[_0xf2b0('0x36')](_0x59c36d[_0xf2b0('0x30')][_0xf2b0('0x36')]));_0x10c2c7[_0xf2b0('0x35')]=_0x10c2c7['attributes'][_0xf2b0('0x37')]?_0x10c2c7[_0xf2b0('0x35')]:_0x4e0755[_0xf2b0('0x34')];if(!_0x59c36d[_0xf2b0('0x30')][_0xf2b0('0x38')](_0xf2b0('0x39'))){_0x10c2c7[_0xf2b0('0x1e')]=qs['limit'](_0x59c36d[_0xf2b0('0x30')][_0xf2b0('0x1e')]);_0x10c2c7['offset']=qs[_0xf2b0('0x1d')](_0x59c36d['query'][_0xf2b0('0x1d')]);}_0x10c2c7[_0xf2b0('0x3a')]=qs[_0xf2b0('0x3b')](_0x59c36d[_0xf2b0('0x30')]['sort']);_0x10c2c7[_0xf2b0('0x3c')]=qs['filters'](_[_0xf2b0('0x3d')](_0x59c36d[_0xf2b0('0x30')],_0x4e0755[_0xf2b0('0x32')]),_0x235e0e);if(_0x59c36d[_0xf2b0('0x30')][_0xf2b0('0x3e')]){_0x10c2c7[_0xf2b0('0x3c')]=_['merge'](_0x10c2c7[_0xf2b0('0x3c')],{'$or':_[_0xf2b0('0x2c')](_0x235e0e,function(_0x51957a){if(_0x51957a['type']!==_0xf2b0('0x3f')){var _0x5bc430={};_0x5bc430[_0x51957a[_0xf2b0('0x29')]]={'$like':'%'+_0x59c36d[_0xf2b0('0x30')]['filter']+'%'};return _0x5bc430;}})});}_0x10c2c7=_['merge']({},_0x10c2c7,_0x59c36d[_0xf2b0('0x40')]);var _0x1216c3={'where':_0x10c2c7[_0xf2b0('0x3c')]};return db[_0xf2b0('0x2d')][_0xf2b0('0x20')](_0x1216c3)[_0xf2b0('0x25')](function(_0x636de9){_0x51f511[_0xf2b0('0x20')]=_0x636de9;if(_0x59c36d[_0xf2b0('0x30')]['includeAll']){_0x10c2c7['include']=[{'all':!![]}];}return db[_0xf2b0('0x2d')]['findAll'](_0x10c2c7);})[_0xf2b0('0x25')](function(_0x4b3632){_0x51f511['rows']=_0x4b3632;return _0x51f511;})['then'](respondWithFilteredResult(_0x5c59f3,_0x10c2c7))[_0xf2b0('0x41')](handleError(_0x5c59f3,null));};exports[_0xf2b0('0x42')]=function(_0x2f0717,_0x3b5aba){var _0x3d53c0={'raw':!![],'where':{'id':_0x2f0717[_0xf2b0('0x43')]['id']}},_0x304f91={};_0x304f91[_0xf2b0('0x34')]=_[_0xf2b0('0x31')](db[_0xf2b0('0x2d')][_0xf2b0('0x44')]);_0x304f91[_0xf2b0('0x30')]=_['keys'](_0x2f0717[_0xf2b0('0x30')]);_0x304f91[_0xf2b0('0x32')]=_[_0xf2b0('0x33')](_0x304f91[_0xf2b0('0x34')],_0x304f91[_0xf2b0('0x30')]);_0x3d53c0[_0xf2b0('0x35')]=_[_0xf2b0('0x33')](_0x304f91[_0xf2b0('0x34')],qs[_0xf2b0('0x36')](_0x2f0717[_0xf2b0('0x30')][_0xf2b0('0x36')]));_0x3d53c0['attributes']=_0x3d53c0[_0xf2b0('0x35')]['length']?_0x3d53c0['attributes']:_0x304f91[_0xf2b0('0x34')];if(_0x2f0717[_0xf2b0('0x30')][_0xf2b0('0x45')]){_0x3d53c0[_0xf2b0('0x46')]=[{'all':!![]}];}_0x3d53c0=_[_0xf2b0('0x47')]({},_0x3d53c0,_0x2f0717[_0xf2b0('0x40')]);return db[_0xf2b0('0x2d')][_0xf2b0('0x48')](_0x3d53c0)[_0xf2b0('0x25')](handleEntityNotFound(_0x3b5aba,null))['then'](respondWithResult(_0x3b5aba,null))[_0xf2b0('0x41')](handleError(_0x3b5aba,null));};exports[_0xf2b0('0x49')]=function(_0x7beda5,_0x2edc3f){return db[_0xf2b0('0x2d')][_0xf2b0('0x49')](_0x7beda5[_0xf2b0('0x4a')],{})[_0xf2b0('0x25')](respondWithResult(_0x2edc3f,0xc9))[_0xf2b0('0x41')](handleError(_0x2edc3f,null));};exports['update']=function(_0x37d3a3,_0x5df349){if(_0x37d3a3[_0xf2b0('0x4a')]['id']){delete _0x37d3a3[_0xf2b0('0x4a')]['id'];}return db[_0xf2b0('0x2d')]['find']({'where':{'id':_0x37d3a3[_0xf2b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x5df349,null))[_0xf2b0('0x25')](saveUpdates(_0x37d3a3['body'],null))[_0xf2b0('0x25')](respondWithResult(_0x5df349,null))[_0xf2b0('0x41')](handleError(_0x5df349,null));};exports[_0xf2b0('0x26')]=function(_0x15cf94,_0x41df00){return db[_0xf2b0('0x2d')][_0xf2b0('0x48')]({'where':{'id':_0x15cf94[_0xf2b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x41df00,null))[_0xf2b0('0x25')](removeEntity(_0x41df00,null))['catch'](handleError(_0x41df00,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b9c863b..bff8a79 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 _0x2c37=['rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4358b8,_0x23dd5c){var _0x33857e=function(_0x1ed5ef){while(--_0x1ed5ef){_0x4358b8['push'](_0x4358b8['shift']());}};_0x33857e(++_0x23dd5c);}(_0x2c37,0xfe));var _0x72c3=function(_0x418d53,_0xc80bfd){_0x418d53=_0x418d53-0x0;var _0x15e092=_0x2c37[_0x418d53];return _0x15e092;};'use strict';var _=require(_0x72c3('0x0'));var util=require('util');var logger=require(_0x72c3('0x1'))('api');var moment=require(_0x72c3('0x2'));var BPromise=require(_0x72c3('0x3'));var rp=require(_0x72c3('0x4'));var fs=require('fs');var path=require(_0x72c3('0x5'));var rimraf=require(_0x72c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x72c3('0x7'));module[_0x72c3('0x8')]=function(_0x1b4240,_0x14062a){return _0x1b4240[_0x72c3('0x9')](_0x72c3('0xa'),attributes,{'tableName':_0x72c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x72c3('0xc')});}; \ No newline at end of file +var _0xea26=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','util','api','moment'];(function(_0x1d7f30,_0x49d94a){var _0xabebbe=function(_0x44f95f){while(--_0x44f95f){_0x1d7f30['push'](_0x1d7f30['shift']());}};_0xabebbe(++_0x49d94a);}(_0xea26,0x129));var _0x6ea2=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xea26[_0x34021d];return _0x16597b;};'use strict';var _=require('lodash');var util=require(_0x6ea2('0x0'));var logger=require('../../config/logger')(_0x6ea2('0x1'));var moment=require(_0x6ea2('0x2'));var BPromise=require(_0x6ea2('0x3'));var rp=require(_0x6ea2('0x4'));var fs=require('fs');var path=require(_0x6ea2('0x5'));var rimraf=require(_0x6ea2('0x6'));var config=require(_0x6ea2('0x7'));var attributes=require(_0x6ea2('0x8'));module['exports']=function(_0x49d858,_0xe039ea){return _0x49d858[_0x6ea2('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x6ea2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ea2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 763c0b0..21af13d 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 _0xadd7=['info','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','limit'];(function(_0x38a211,_0x1c21ff){var _0x78f594=function(_0x2cd0f3){while(--_0x2cd0f3){_0x38a211['push'](_0x38a211['shift']());}};_0x78f594(++_0x1c21ff);}(_0xadd7,0x12f));var _0x7add=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xadd7[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7add('0x0'));var util=require(_0x7add('0x1'));var moment=require(_0x7add('0x2'));var BPromise=require(_0x7add('0x3'));var rs=require(_0x7add('0x4'));var fs=require('fs');var Redis=require(_0x7add('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7add('0x6'));var config=require(_0x7add('0x7'));var jayson=require(_0x7add('0x8'));var client=jayson[_0x7add('0x9')][_0x7add('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x94d679,_0x3d5d34,_0x38d767){return new BPromise(function(_0x3294e0,_0x55224f){return client[_0x7add('0xb')](_0x94d679,_0x38d767)[_0x7add('0xc')](function(_0x2c8ba6){logger['info'](_0x7add('0xd'),_0x3d5d34,_0x7add('0xe'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3d5d34,_0x7add('0xe'),JSON['stringify'](_0x2c8ba6));if(_0x2c8ba6[_0x7add('0xf')]){if(_0x2c8ba6[_0x7add('0xf')]['code']===0x1f4){logger[_0x7add('0xf')](_0x7add('0xd'),_0x3d5d34,_0x2c8ba6[_0x7add('0xf')][_0x7add('0x10')]);return _0x55224f(_0x2c8ba6[_0x7add('0xf')]['message']);}logger[_0x7add('0xf')](_0x7add('0xd'),_0x3d5d34,_0x2c8ba6['error'][_0x7add('0x10')]);return _0x3294e0(_0x2c8ba6[_0x7add('0xf')]['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3d5d34,'request\x20sent');_0x3294e0(_0x2c8ba6[_0x7add('0x11')][_0x7add('0x10')]);}})[_0x7add('0x12')](function(_0x26a1af){logger[_0x7add('0xf')](_0x7add('0xd'),_0x3d5d34,_0x26a1af);_0x55224f(_0x26a1af);});});}exports[_0x7add('0x13')]=function(_0x1b0200){var _0x5b16bf=this;return new Promise(function(_0x21ba7f,_0x164ffb){return db[_0x7add('0x14')]['update'](_0x1b0200[_0x7add('0x15')],{'raw':_0x1b0200[_0x7add('0x16')]?_0x1b0200[_0x7add('0x16')][_0x7add('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0200[_0x7add('0x16')]?_0x1b0200['options'][_0x7add('0x18')]||null:null,'attributes':_0x1b0200[_0x7add('0x16')]?_0x1b0200['options'][_0x7add('0x19')]||null:null,'limit':_0x1b0200[_0x7add('0x16')]?_0x1b0200['options'][_0x7add('0x1a')]||null:null})['then'](function(_0x58fea6){logger[_0x7add('0x1b')](_0x7add('0x13'),_0x1b0200);logger[_0x7add('0x1c')](_0x7add('0x13'),_0x1b0200,JSON[_0x7add('0x1d')](_0x58fea6));_0x21ba7f(_0x58fea6);})[_0x7add('0x12')](function(_0x539bf8){logger['error'](_0x7add('0x13'),_0x539bf8[_0x7add('0x10')],_0x1b0200);_0x164ffb(_0x5b16bf[_0x7add('0xf')](0x1f4,_0x539bf8[_0x7add('0x10')]));});});}; \ No newline at end of file +var _0xb35d=['OpenchannelApplication','update','body','options','raw','where','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xb35d,0xb0));var _0xdb35=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0xb35d[_0x5805d7];return _0x170fe4;};'use strict';var _=require(_0xdb35('0x0'));var util=require(_0xdb35('0x1'));var moment=require(_0xdb35('0x2'));var BPromise=require(_0xdb35('0x3'));var rs=require(_0xdb35('0x4'));var fs=require('fs');var Redis=require(_0xdb35('0x5'));var db=require(_0xdb35('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdb35('0x7'));var config=require('../../config/environment');var jayson=require(_0xdb35('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3178,_0xfd7804,_0x5e0de7){return new BPromise(function(_0x7090c,_0x7a70fd){return client[_0xdb35('0x9')](_0x5f3178,_0x5e0de7)[_0xdb35('0xa')](function(_0x4c6ec2){logger[_0xdb35('0xb')](_0xdb35('0xc'),_0xfd7804,_0xdb35('0xd'));logger[_0xdb35('0xe')](_0xdb35('0xf'),_0xfd7804,_0xdb35('0xd'),JSON[_0xdb35('0x10')](_0x4c6ec2));if(_0x4c6ec2[_0xdb35('0x11')]){if(_0x4c6ec2['error']['code']===0x1f4){logger['error'](_0xdb35('0xc'),_0xfd7804,_0x4c6ec2['error'][_0xdb35('0x12')]);return _0x7a70fd(_0x4c6ec2['error'][_0xdb35('0x12')]);}logger[_0xdb35('0x11')](_0xdb35('0xc'),_0xfd7804,_0x4c6ec2['error']['message']);return _0x7090c(_0x4c6ec2[_0xdb35('0x11')]['message']);}else{logger[_0xdb35('0xb')](_0xdb35('0xc'),_0xfd7804,_0xdb35('0xd'));_0x7090c(_0x4c6ec2[_0xdb35('0x13')]['message']);}})['catch'](function(_0x971bc2){logger[_0xdb35('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0xfd7804,_0x971bc2);_0x7a70fd(_0x971bc2);});});}exports['UpdateOpenchannelApplication']=function(_0x52b08a){var _0x720cb9=this;return new Promise(function(_0x42037f,_0x125ecb){return db[_0xdb35('0x14')][_0xdb35('0x15')](_0x52b08a[_0xdb35('0x16')],{'raw':_0x52b08a[_0xdb35('0x17')]?_0x52b08a[_0xdb35('0x17')][_0xdb35('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52b08a['options']?_0x52b08a[_0xdb35('0x17')][_0xdb35('0x19')]||null:null,'attributes':_0x52b08a[_0xdb35('0x17')]?_0x52b08a[_0xdb35('0x17')]['attributes']||null:null,'limit':_0x52b08a[_0xdb35('0x17')]?_0x52b08a[_0xdb35('0x17')][_0xdb35('0x1a')]||null:null})[_0xdb35('0xa')](function(_0x5325d1){logger[_0xdb35('0xb')](_0xdb35('0x1b'),_0x52b08a);logger[_0xdb35('0xe')]('UpdateOpenchannelApplication',_0x52b08a,JSON[_0xdb35('0x10')](_0x5325d1));_0x42037f(_0x5325d1);})['catch'](function(_0x3dd83a){logger[_0xdb35('0x11')]('UpdateOpenchannelApplication',_0x3dd83a['message'],_0x52b08a);_0x125ecb(_0x720cb9['error'](0x1f4,_0x3dd83a[_0xdb35('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 8683ecf..f1e627b 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 _0x4156=['/:id/tags','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4156,0x137));var _0x6415=function(_0xc00f86,_0x545054){_0xc00f86=_0xc00f86-0x0;var _0x1f0f76=_0x4156[_0xc00f86];return _0x1f0f76;};'use strict';var multer=require(_0x6415('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6415('0x1'));var express=require(_0x6415('0x2'));var router=express[_0x6415('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6415('0x4'));var interaction=require(_0x6415('0x5'));var config=require(_0x6415('0x6'));var controller=require(_0x6415('0x7'));router[_0x6415('0x8')]('/',auth[_0x6415('0x9')](),controller['index']);router[_0x6415('0x8')]('/describe',auth[_0x6415('0x9')](),controller[_0x6415('0xa')]);router['get'](_0x6415('0xb'),auth[_0x6415('0x9')](),controller[_0x6415('0xc')]);router[_0x6415('0x8')](_0x6415('0xd'),auth[_0x6415('0x9')](),controller['getMessages']);router[_0x6415('0x8')](_0x6415('0xe'),auth[_0x6415('0x9')](),controller[_0x6415('0xf')]);router['post']('/',auth[_0x6415('0x9')](),controller[_0x6415('0x10')]);router[_0x6415('0x11')](_0x6415('0xd'),auth[_0x6415('0x9')](),controller[_0x6415('0x12')]);router[_0x6415('0x11')](_0x6415('0x13'),auth[_0x6415('0x9')](),interaction['tracked']('openchannel',_0x6415('0x14')),controller['addTags']);router[_0x6415('0x15')](_0x6415('0xb'),auth['isAuthenticated'](),interaction[_0x6415('0x16')]('openchannel',_0x6415('0x17')),controller[_0x6415('0x18')]);router[_0x6415('0x19')](_0x6415('0xb'),auth['isAuthenticated'](),interaction[_0x6415('0x16')](_0x6415('0x1a'),_0x6415('0x1b')),controller[_0x6415('0x1c')]);router[_0x6415('0x19')]('/:id/tags',auth[_0x6415('0x9')](),controller['removeTags']);module[_0x6415('0x1d')]=router; \ No newline at end of file +var _0xe091=['index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated'];(function(_0x22ddf7,_0x3f61e0){var _0x3a7e29=function(_0xcc258d){while(--_0xcc258d){_0x22ddf7['push'](_0x22ddf7['shift']());}};_0x3a7e29(++_0x3f61e0);}(_0xe091,0xa5));var _0x1e09=function(_0x535213,_0x2d8d73){_0x535213=_0x535213-0x0;var _0x571ae3=_0xe091[_0x535213];return _0x571ae3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e09('0x0'));var timeout=require(_0x1e09('0x1'));var express=require(_0x1e09('0x2'));var router=express['Router']();var fs_extra=require(_0x1e09('0x3'));var auth=require(_0x1e09('0x4'));var interaction=require(_0x1e09('0x5'));var config=require('../../config/environment');var controller=require(_0x1e09('0x6'));router[_0x1e09('0x7')]('/',auth[_0x1e09('0x8')](),controller[_0x1e09('0x9')]);router['get'](_0x1e09('0xa'),auth[_0x1e09('0x8')](),controller[_0x1e09('0xb')]);router['get'](_0x1e09('0xc'),auth[_0x1e09('0x8')](),controller['show']);router[_0x1e09('0x7')](_0x1e09('0xd'),auth[_0x1e09('0x8')](),controller[_0x1e09('0xe')]);router[_0x1e09('0x7')](_0x1e09('0xf'),auth[_0x1e09('0x8')](),controller['download']);router[_0x1e09('0x10')]('/',auth[_0x1e09('0x8')](),controller[_0x1e09('0x11')]);router[_0x1e09('0x10')](_0x1e09('0xd'),auth[_0x1e09('0x8')](),controller[_0x1e09('0x12')]);router['post'](_0x1e09('0x13'),auth[_0x1e09('0x8')](),interaction[_0x1e09('0x14')]('openchannel',_0x1e09('0x15')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x1e09('0x14')](_0x1e09('0x16'),_0x1e09('0x17')),controller[_0x1e09('0x18')]);router[_0x1e09('0x19')](_0x1e09('0xc'),auth[_0x1e09('0x8')](),interaction[_0x1e09('0x14')](_0x1e09('0x16'),_0x1e09('0x1a')),controller[_0x1e09('0x1b')]);router[_0x1e09('0x19')](_0x1e09('0x13'),auth[_0x1e09('0x8')](),controller['removeTags']);module[_0x1e09('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7f42f90..9e0713a 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 _0x225c=['ENUM','out','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x16bc5a,_0x7f3c97){var _0x310ae5=function(_0x12f304){while(--_0x12f304){_0x16bc5a['push'](_0x16bc5a['shift']());}};_0x310ae5(++_0x7f3c97);}(_0x225c,0x106));var _0xc225=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x225c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc225('0x0'));module[_0xc225('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc225('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc225('0x2')]},'note':{'type':Sequelize[_0xc225('0x2')]},'read1stAt':{'type':Sequelize[_0xc225('0x3')]},'threadId':{'type':Sequelize[_0xc225('0x2')]},'externalUrl':{'type':Sequelize[_0xc225('0x2')]},'lastMsgAt':{'type':Sequelize[_0xc225('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc225('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xc225('0x4')]('in',_0xc225('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc225('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xc225('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x6364=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x35d66a,_0x29b936){var _0x5cb57e=function(_0x2897f9){while(--_0x2897f9){_0x35d66a['push'](_0x35d66a['shift']());}};_0x5cb57e(++_0x29b936);}(_0x6364,0x8f));var _0x4636=function(_0xbdd93d,_0x1c0726){_0xbdd93d=_0xbdd93d-0x0;var _0x565767=_0x6364[_0xbdd93d];return _0x565767;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4636('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4636('0x1')]},'disposition':{'type':Sequelize[_0x4636('0x2')]},'secondDisposition':{'type':Sequelize[_0x4636('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4636('0x2')]},'note':{'type':Sequelize[_0x4636('0x2')]},'read1stAt':{'type':Sequelize[_0x4636('0x1')]},'threadId':{'type':Sequelize[_0x4636('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x4636('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x4636('0x3')]('in',_0x4636('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x4636('0x3')]('in',_0x4636('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x4636('0x0')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e8be9e7..78cb537 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 _0x1b43=['unix','root','server','files','join','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','Public','Private','existsSync','createReadStream','createWriteStream','basename','out','System','Contact','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','Users','map','fullname','TagIds','split','Tags','push','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','OpenchannelInteraction','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','field','from','select','u.fullname','ui.OpenchannelInteractionId','left_join','users','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','getFullTextValue','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?','union','User','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','includeAll','options','update','describe','addMessage','ids','omit','OpenchannelMessage','pick','filter','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','findAll','color','openchannelInteractionTags:save','removeTags','download'];(function(_0x7fbceb,_0x7112d0){var _0xc6ba34=function(_0x240971){while(--_0x240971){_0x7fbceb['push'](_0x7fbceb['shift']());}};_0xc6ba34(++_0x7112d0);}(_0x1b43,0x11c));var _0x31b4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1b43[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x31b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31b4('0x1'));var jsonpatch=require(_0x31b4('0x2'));var rp=require(_0x31b4('0x3'));var moment=require(_0x31b4('0x4'));var BPromise=require(_0x31b4('0x5'));var Mustache=require(_0x31b4('0x6'));var util=require(_0x31b4('0x7'));var path=require(_0x31b4('0x8'));var sox=require(_0x31b4('0x9'));var csv=require(_0x31b4('0xa'));var ejs=require(_0x31b4('0xb'));var fs=require('fs');var fs_extra=require(_0x31b4('0xc'));var _=require(_0x31b4('0xd'));var squel=require(_0x31b4('0xe'));var crypto=require('crypto');var jsforce=require(_0x31b4('0xf'));var deskjs=require(_0x31b4('0x10'));var toCsv=require(_0x31b4('0xa'));var querystring=require(_0x31b4('0x11'));var Papa=require(_0x31b4('0x12'));var Redis=require(_0x31b4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31b4('0x14'));var as=require(_0x31b4('0x15'));var pdf=require(_0x31b4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31b4('0x17'))(_0x31b4('0x18'));var utils=require(_0x31b4('0x19'));var config=require(_0x31b4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x31b4('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x31b4('0x1c'),'port':0x18eb});var socket=require(_0x31b4('0x1d'))(new Redis(config['redis']));require(_0x31b4('0x1e'))[_0x31b4('0x1f')](socket);function respondWithStatusCode(_0x1a5778,_0x45eae6){_0x45eae6=_0x45eae6||0xcc;return function(_0x3733b4){if(_0x3733b4){return _0x1a5778[_0x31b4('0x20')](_0x45eae6);}return _0x1a5778[_0x31b4('0x21')](_0x45eae6)[_0x31b4('0x22')]();};}function respondWithResult(_0x584ab4,_0xc216a5){_0xc216a5=_0xc216a5||0xc8;return function(_0x381bc7){if(_0x381bc7){return _0x584ab4[_0x31b4('0x21')](_0xc216a5)[_0x31b4('0x23')](_0x381bc7);}};}function respondWithFilteredResult(_0x147355,_0x10a462){return function(_0x356c74){if(_0x356c74){var _0x5b0c73=typeof _0x10a462[_0x31b4('0x24')]===_0x31b4('0x25')&&typeof _0x10a462[_0x31b4('0x26')]===_0x31b4('0x25');var _0x2225be=_0x356c74[_0x31b4('0x27')];var _0x465453=_0x5b0c73?0x0:_0x10a462[_0x31b4('0x24')];var _0x137e85=_0x5b0c73?_0x356c74[_0x31b4('0x27')]:_0x10a462['offset']+_0x10a462[_0x31b4('0x26')];var _0x27f0e7;if(_0x137e85>=_0x2225be){_0x137e85=_0x2225be;_0x27f0e7=0xc8;}else{_0x27f0e7=0xce;}_0x147355[_0x31b4('0x21')](_0x27f0e7);return _0x147355[_0x31b4('0x28')]('Content-Range',_0x465453+'-'+_0x137e85+'/'+_0x2225be)[_0x31b4('0x23')](_0x356c74);}return null;};}function patchUpdates(_0x12fe2d){return function(_0x2c2fd7){try{jsonpatch[_0x31b4('0x29')](_0x2c2fd7,_0x12fe2d,!![]);}catch(_0xfb5d83){return BPromise[_0x31b4('0x2a')](_0xfb5d83);}return _0x2c2fd7[_0x31b4('0x2b')]();};}function saveUpdates(_0x36d08d,_0x8398a0){return function(_0x42fcbb){if(_0x42fcbb){return _0x42fcbb['update'](_0x36d08d)[_0x31b4('0x2c')](function(_0x523a19){return _0x523a19;});}return null;};}function removeEntity(_0x224e55,_0x49a265){return function(_0x22ffdd){if(_0x22ffdd){return _0x22ffdd[_0x31b4('0x2d')]()[_0x31b4('0x2c')](function(){_0x224e55[_0x31b4('0x21')](0xcc)[_0x31b4('0x22')]();});}};}function handleEntityNotFound(_0x179d6a,_0x1e3986){return function(_0x1482be){if(!_0x1482be){_0x179d6a[_0x31b4('0x20')](0x194);}return _0x1482be;};}function handleError(_0x5b3a31,_0xa52720){_0xa52720=_0xa52720||0x1f4;return function(_0x5c9d62){logger[_0x31b4('0x2e')](_0x5c9d62['stack']);if(_0x5c9d62[_0x31b4('0x2f')]){delete _0x5c9d62[_0x31b4('0x2f')];}_0x5b3a31[_0x31b4('0x21')](_0xa52720)[_0x31b4('0x30')](_0x5c9d62);};}function getInteractionUsers(_0x1ba745,_0x4a1e59){return new BPromise(function(_0x3440c8,_0x4a4ffd){try{if(_0x4a1e59[_0x1ba745['id']]){_0x1ba745[_0x31b4('0x31')]=_[_0x31b4('0x32')](_0x4a1e59[_0x1ba745['id']],function(_0xdf2dc3){return{'id':_0xdf2dc3['id'],'fullname':_0xdf2dc3[_0x31b4('0x33')]};});}}catch(_0x1a65c2){_0x4a4ffd(_0x1a65c2);}_0x3440c8(_0x1ba745);});}function getInteractionTags(_0x3b3a62,_0x21f8dc){return new BPromise(function(_0x1e70a5,_0x4df7b5){try{if(_0x3b3a62[_0x31b4('0x34')]){_0x3b3a62['Tags']=[];_0x3b3a62[_0x31b4('0x34')][_0x31b4('0x35')](',')['forEach'](function(_0x42279a){_0x3b3a62[_0x31b4('0x36')][_0x31b4('0x37')](_0x21f8dc[_0x42279a]);});}delete _0x3b3a62[_0x31b4('0x34')];}catch(_0x3da975){_0x4df7b5(_0x3da975);}_0x1e70a5(_0x3b3a62);});}function updateOpenchannelInteraction(_0x467457,_0x5335d0,_0x1e9489){return new BPromise(function(_0x29551b,_0x34ebb5){return getInteractionUsers(_0x467457,_0x1e9489)['then'](function(_0x50ec37){return getInteractionTags(_0x50ec37,_0x5335d0);})[_0x31b4('0x2c')](function(_0x4e8d9c){return getStateInteraction(_0x4e8d9c);})[_0x31b4('0x2c')](function(_0x40b290){_0x29551b(_0x40b290);})[_0x31b4('0x38')](function(_0x236991){_0x34ebb5(_0x236991);});});}function getStateInteraction(_0x2eba08){return new BPromise(function(_0x25af62){_0x2eba08[_0x31b4('0x39')]=0x0;_0x2eba08['talking']=0x0;_0x2eba08[_0x31b4('0x3a')]=0x0;_0x2eba08[_0x31b4('0x3b')]=0x0;_0x2eba08[_0x31b4('0x3c')]=0x0;if(!_0x2eba08[_0x31b4('0x3d')]&&!_0x2eba08[_0x31b4('0x3e')]){_0x2eba08['waiting']+=0x1;}if(!_0x2eba08['closed']&&_0x2eba08[_0x31b4('0x3e')]){_0x2eba08[_0x31b4('0x3f')]+=0x1;if(_0x2eba08['waiting']){_0x2eba08['waiting']-=0x1;}}if(_0x2eba08[_0x31b4('0x3d')]&&_0x2eba08[_0x31b4('0x3e')]){_0x2eba08['answered']+=0x1;if(_0x2eba08[_0x31b4('0x3f')]){_0x2eba08[_0x31b4('0x3f')]-=0x1;}}if(_0x2eba08[_0x31b4('0x3d')]&&!_0x2eba08[_0x31b4('0x3e')]){_0x2eba08['unmanaged']+=0x1;if(_0x2eba08[_0x31b4('0x39')]){_0x2eba08[_0x31b4('0x39')]-=0x1;}}_0x2eba08[_0x31b4('0x3c')]+=0x1;_0x25af62(_0x2eba08);});}exports[_0x31b4('0x40')]=function(_0x59a883,_0x241b4f){var _0x2b6a9e={},_0x2a46a0={},_0x14c2f8={'count':0x0,'rows':[]};var _0x1c982e=_[_0x31b4('0x32')](db[_0x31b4('0x41')][_0x31b4('0x42')],function(_0x4d946f){return{'name':_0x4d946f[_0x31b4('0x43')],'type':_0x4d946f['type'][_0x31b4('0x44')]};});_0x2a46a0['model']=_['map'](_0x1c982e,_0x31b4('0x2f'));_0x2a46a0['query']=_[_0x31b4('0x45')](_0x59a883[_0x31b4('0x46')]);_0x2a46a0['filters']=_[_0x31b4('0x47')](_0x2a46a0[_0x31b4('0x48')],_0x2a46a0[_0x31b4('0x46')]);_0x2b6a9e[_0x31b4('0x49')]=_['intersection'](_0x2a46a0['model'],qs[_0x31b4('0x4a')](_0x59a883[_0x31b4('0x46')][_0x31b4('0x4a')]));_0x2b6a9e[_0x31b4('0x49')]=_0x2b6a9e[_0x31b4('0x49')][_0x31b4('0x4b')]?_0x2b6a9e[_0x31b4('0x49')]:_0x2a46a0[_0x31b4('0x48')];if(!_0x59a883[_0x31b4('0x46')][_0x31b4('0x4c')](_0x31b4('0x4d'))){_0x2b6a9e[_0x31b4('0x26')]=qs[_0x31b4('0x26')](_0x59a883[_0x31b4('0x46')][_0x31b4('0x26')]);_0x2b6a9e['offset']=qs[_0x31b4('0x24')](_0x59a883[_0x31b4('0x46')][_0x31b4('0x24')]);}_0x2b6a9e[_0x31b4('0x4e')]=qs[_0x31b4('0x4f')](_0x59a883[_0x31b4('0x46')][_0x31b4('0x4f')]);_0x2b6a9e[_0x31b4('0x50')]=qs[_0x31b4('0x51')](_['pick'](_0x59a883['query'],_0x2a46a0[_0x31b4('0x51')]),_0x1c982e);var _0x501122=[];var _0x534620=squel['select']()[_0x31b4('0x52')]('id')['field'](_0x31b4('0x2f'))[_0x31b4('0x52')]('color')[_0x31b4('0x53')]('tools_tags');var _0x6f1e20=squel[_0x31b4('0x54')]()['field']('u.id')[_0x31b4('0x52')](_0x31b4('0x55'))[_0x31b4('0x52')](_0x31b4('0x56'))[_0x31b4('0x53')]('user_has_openchannel_interactions','ui')[_0x31b4('0x57')](_0x31b4('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x294c80=squel[_0x31b4('0x54')]()[_0x31b4('0x53')](_0x31b4('0x59'),'i')[_0x31b4('0x57')]('cm_contacts','c',_0x31b4('0x5a'))[_0x31b4('0x57')](_0x31b4('0x58'),'o','o.id\x20=\x20i.UserId')[_0x31b4('0x57')]('openchannel_accounts','a',_0x31b4('0x5b'))[_0x31b4('0x57')](_0x31b4('0x5c'),'me',_0x31b4('0x5d'))[_0x31b4('0x57')](_0x31b4('0x5e'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x31b4('0x57')](_0x31b4('0x5f'),'t',_0x31b4('0x60'));var _0x42ceb1=squel['expr']();var _0xfaaa13=[];var _0xc9934f=squel[_0x31b4('0x61')]();var _0x4a174f;if(_0x59a883[_0x31b4('0x46')][_0x31b4('0x62')]){_0x4a174f=as['parseSearch'](_0x59a883[_0x31b4('0x46')][_0x31b4('0x62')]);var _0xd7ee69=_0x4a174f[_0x31b4('0x63')];for(var _0x18019f=0x0;_0x18019f<_0x4a174f[_0x31b4('0x64')][_0x31b4('0x4b')];_0x18019f++){var _0xefc15a=_0x4a174f[_0x31b4('0x64')][_0x18019f];var _0x18bb8e='i';var _0x3cba22=_[_0x31b4('0x65')](_0x1c982e,['name',_0xefc15a[_0x31b4('0x52')]]);if(!_0x3cba22){switch(_0xefc15a[_0x31b4('0x52')]){case'unreadMessages':if(_0xefc15a[_0x31b4('0x66')]==0x1){_0x294c80['having']('`'+_0xefc15a[_0x31b4('0x52')]+_0x31b4('0x67'));}else{_0x294c80[_0x31b4('0x68')]('`'+_0xefc15a[_0x31b4('0x52')]+_0x31b4('0x69'));}break;case'Contact':if(_0xefc15a[_0x31b4('0x6a')]===_0x31b4('0x6b')){if(_0xefc15a[_0x31b4('0x66')][_0x31b4('0x35')]('\x20')[_0x31b4('0x4b')]>0x1){_0x42ceb1[_0xd7ee69]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x31b4('0x6c')](_0xefc15a[_0x31b4('0x66')]),null);}else{var _0x54cbdd='%'+_0xefc15a['value']+'%';_0x42ceb1[_0xd7ee69](_0x31b4('0x6d'),_0x54cbdd,_0x54cbdd,_0x54cbdd);}}else{_0x3cba22=_[_0x31b4('0x65')](_0x1c982e,[_0x31b4('0x2f'),'ContactId']);_0xefc15a[_0x31b4('0x52')]=_0x31b4('0x6e');_0xbe4b74=as[_0x31b4('0x6f')](_0x18bb8e,_0x3cba22[_0x31b4('0x70')],_0xefc15a);_0x42ceb1[_0xd7ee69](_0xbe4b74[_0x31b4('0x71')],_0xbe4b74[_0x31b4('0x66')][_0x31b4('0x72')],_0xbe4b74[_0x31b4('0x66')][_0x31b4('0x22')]);}break;case _0x31b4('0x73'):var _0x4a6aca=_0xefc15a[_0x31b4('0x66')]['split'](',')['map'](function(_0x3ad3ec){return Number(_0x3ad3ec);});_0x4a6aca[_0x31b4('0x74')](function(_0xb7be1d){_0xc9934f['or'](_0x31b4('0x75'),'%,'+_0xb7be1d+',%');});_0xfaaa13=_[_0x31b4('0x76')](_0xfaaa13,_0x4a6aca);break;case _0x31b4('0x77'):if(_0xefc15a[_0x31b4('0x6a')]===_0x31b4('0x6b')){_0x42ceb1[_0xd7ee69]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xefc15a[_0x31b4('0x66')]+'%',null);}else{_0x3cba22=_[_0x31b4('0x65')](_0x1c982e,['name',_0x31b4('0x3e')]);_0xefc15a[_0x31b4('0x52')]='UserId';_0xbe4b74=as[_0x31b4('0x6f')](_0x18bb8e,_0x3cba22[_0x31b4('0x70')],_0xefc15a);_0x42ceb1[_0xd7ee69](_0xbe4b74['text'],_0xbe4b74['value'][_0x31b4('0x72')],_0xbe4b74[_0x31b4('0x66')][_0x31b4('0x22')]);}break;case _0x31b4('0x78'):_0xbe4b74=as[_0x31b4('0x6f')]('me',null,_0xefc15a);_0x42ceb1[_0xd7ee69](_0xbe4b74['text'],_0xbe4b74[_0x31b4('0x66')][_0x31b4('0x72')],_0xbe4b74['value'][_0x31b4('0x22')]);break;}}else{var _0xbe4b74=as[_0x31b4('0x6f')](_0x18bb8e,_0x3cba22[_0x31b4('0x70')],_0xefc15a);_0x42ceb1[_0xd7ee69](_0xbe4b74['text'],_0xbe4b74[_0x31b4('0x66')]['start'],_0xbe4b74['value'][_0x31b4('0x22')]);}}}else{var _0x7bf47e=_(_0x59a883[_0x31b4('0x46')])[_0x31b4('0x45')]()[_0x31b4('0x32')](function(_0x1e2ecd){return _[_0x31b4('0x79')](_0x1c982e,[_0x31b4('0x2f'),_0x1e2ecd])?_0x1e2ecd:undefined;})[_0x31b4('0x7a')]()[_0x31b4('0x66')]();if(!_[_0x31b4('0x7b')](_0x7bf47e)){_0x7bf47e[_0x31b4('0x74')](function(_0x165feb){if(_0x165feb===_0x31b4('0x7c')){_0x294c80[_0x31b4('0x50')](_0x31b4('0x7d'),[][_0x31b4('0x7e')](_0x59a883[_0x31b4('0x46')][_0x165feb]));}else if(_0x165feb==='createdAt'){var _0x444eed=JSON[_0x31b4('0x7f')](_0x59a883[_0x31b4('0x46')][_0x165feb])[_0x31b4('0x80')];var _0x409820=JSON[_0x31b4('0x7f')](_0x59a883[_0x31b4('0x46')][_0x165feb])['$lte'];_0x294c80[_0x31b4('0x50')](_0x31b4('0x81'),_0x444eed,_0x409820);}else{if(_0x59a883[_0x31b4('0x46')][_0x165feb]===_0x31b4('0x82')){_0x294c80[_0x31b4('0x50')]('i.'+_0x165feb+'\x20IS\x20NULL');}else{_0x294c80[_0x31b4('0x50')]('i.'+_0x165feb+_0x31b4('0x83'),_0x59a883[_0x31b4('0x46')][_0x165feb]);}}});}if(_0x59a883[_0x31b4('0x46')]['read']){if(_0x59a883['query'][_0x31b4('0x84')]==0x1){_0x294c80[_0x31b4('0x68')](_0x31b4('0x85'));}else{_0x294c80[_0x31b4('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x59a883[_0x31b4('0x46')][_0x31b4('0x86')]){_0xfaaa13=_['isArray'](_0x59a883[_0x31b4('0x46')][_0x31b4('0x86')])?_0x59a883[_0x31b4('0x46')][_0x31b4('0x86')]:new Array(_0x59a883[_0x31b4('0x46')]['tag']);_0xfaaa13[_0x31b4('0x74')](function(_0x4f4de9){_0xc9934f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f4de9+',%');});}if(_0x59a883['query']['filter']){var _0x547893=_0x59a883[_0x31b4('0x46')]['filter'][_0x31b4('0x87')]('\x5c','\x5c\x5c')[_0x31b4('0x87')](/'/g,'\x27\x27');if(qs[_0x31b4('0x88')](_0x547893)){_0x42ceb1['or'](_0x31b4('0x89'),_0x547893+'%');}else{_0x42ceb1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x547893))['or'](_0x31b4('0x8a'),_0x547893+'%')['or'](_0x31b4('0x8b'),_0x547893+'%');}}}_0x294c80[_0x31b4('0x50')](_0x42ceb1);_0x294c80[_0x31b4('0x8c')]('i.id');var _0x3ec512={'type':db['Sequelize'][_0x31b4('0x8d')][_0x31b4('0x8e')],'raw':!![]};var _0x3b6f45=_0x294c80[_0x31b4('0x8f')]();_0x3b6f45[_0x31b4('0x52')](_0x31b4('0x90'));_0x3b6f45[_0x31b4('0x52')](_0x31b4('0x91'),_0x31b4('0x92'));if(_0x2b6a9e[_0x31b4('0x4e')]){_0x2b6a9e[_0x31b4('0x4e')][_0x31b4('0x74')](function(_0x157767){var _0x381cda=_0x157767[0x0]===_0x31b4('0x93')?_0x157767[0x0]:'i.'+_0x157767[0x0];_0x294c80[_0x31b4('0x4e')](_0x381cda,_0x157767[0x1]===_0x31b4('0x94')?![]:!![]);});}if(!_[_0x31b4('0x7b')](_0xfaaa13)){_0x294c80['having'](_0xc9934f);_0x3b6f45[_0x31b4('0x50')](_0x31b4('0x95'),_0xfaaa13);}BPromise['resolve']()['then'](function(){if(!_0x4a174f){if(_0x59a883[_0x31b4('0x46')][_0x31b4('0x7c')])return;_0x3b6f45[_0x31b4('0x50')](_0x31b4('0x96'));_0x294c80['where'](_0x31b4('0x96'));return;}if(_0x59a883[_0x31b4('0x97')][_0x31b4('0x98')]!==_0x31b4('0x99'))return;return _0x59a883[_0x31b4('0x97')][_0x31b4('0x9a')]({'attributes':['id'],'raw':!![]})[_0x31b4('0x2c')](function(_0x38104a){if(_[_0x31b4('0x7b')](_0x38104a)){_0x3b6f45[_0x31b4('0x50')](_0x31b4('0x9b'));_0x294c80[_0x31b4('0x50')](_0x31b4('0x9b'));}else{_0x3b6f45[_0x31b4('0x50')](_0x31b4('0x7d'),_[_0x31b4('0x32')](_0x38104a,'id'));_0x294c80[_0x31b4('0x50')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x31b4('0x32')](_0x38104a,'id'));}});})['then'](function(){if(_0x59a883[_0x31b4('0x97')][_0x31b4('0x98')]===_0x31b4('0x99')&&!_0x4a174f&&!_0x59a883[_0x31b4('0x46')][_0x31b4('0x7c')])return[];return db[_0x31b4('0x9c')][_0x31b4('0x46')](_0x3b6f45[_0x31b4('0x9d')](),_0x3ec512);})[_0x31b4('0x2c')](function(_0x57ed9e){_0x14c2f8[_0x31b4('0x27')]=_0x57ed9e['length'];if(_0x14c2f8['count']===0x0)return[];return db['sequelize'][_0x31b4('0x46')](_0x534620['toString'](),_0x3ec512)[_0x31b4('0x2c')](function(_0x69060){_0x501122=_[_0x31b4('0x9e')](_0x69060,'id');_0x3ec512=_[_0x31b4('0x9f')](_0x3ec512,{'model':db[_0x31b4('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59a883[_0x31b4('0x46')]['fields']){_0x2b6a9e[_0x31b4('0x49')]['forEach'](function(_0x43f887){_0x294c80[_0x31b4('0x52')]('i.'+_0x43f887);});}else{_0x294c80['field'](_0x31b4('0x91'),'unreadMessages');_0x294c80[_0x31b4('0x52')](_0x31b4('0xa0'),_0x31b4('0xa1'));_0x294c80[_0x31b4('0x52')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x294c80[_0x31b4('0x52')](_0x31b4('0xa2'),_0x31b4('0x93'));_0x294c80[_0x31b4('0x52')](_0x31b4('0xa3'));_0x294c80[_0x31b4('0x52')](_0x31b4('0xa4'),'Contact.firstName');_0x294c80[_0x31b4('0x52')](_0x31b4('0xa5'),_0x31b4('0xa6'));_0x294c80['field'](_0x31b4('0xa7'),_0x31b4('0xa8'));_0x294c80[_0x31b4('0x52')](_0x31b4('0xa9'),_0x31b4('0xaa'));_0x294c80[_0x31b4('0x52')](_0x31b4('0xab'),_0x31b4('0xac'));_0x294c80[_0x31b4('0x52')](_0x31b4('0xad'),'Contact.fax');_0x294c80['field']('o.fullname',_0x31b4('0xae'));_0x294c80[_0x31b4('0x52')]('o.internal',_0x31b4('0xaf'));_0x294c80['field'](_0x31b4('0xb0'),_0x31b4('0x34'));}if(_0x2b6a9e[_0x31b4('0x26')])_0x294c80[_0x31b4('0x26')](_0x2b6a9e[_0x31b4('0x26')]);if(_0x2b6a9e[_0x31b4('0x24')])_0x294c80[_0x31b4('0x24')](_0x2b6a9e[_0x31b4('0x24')]);return db[_0x31b4('0x9c')][_0x31b4('0x46')](_0x294c80[_0x31b4('0x9d')](),_0x3ec512);})['then'](function(_0xd02d58){if(_0xd02d58[_0x31b4('0x4b')]>0x0)_0x6f1e20[_0x31b4('0x50')](_0x31b4('0xb1'),_['map'](_0xd02d58,'id'));return db[_0x31b4('0x9c')][_0x31b4('0x46')](_0x6f1e20['toString'](),_0x3ec512)['then'](function(_0xad73b7){var _0x12e352=_[_0x31b4('0xb2')](_0xad73b7,_0x31b4('0xb3'));var _0x1f9325=[];_0xd02d58['forEach'](function(_0x18e465){_0x1f9325[_0x31b4('0x37')](updateOpenchannelInteraction(_0x18e465,_0x501122,_0x12e352));});return BPromise[_0x31b4('0xb4')](_0x1f9325);});});})['then'](function(_0x3df01c){_0x14c2f8['rows']=_0x3df01c;return _0x14c2f8;})[_0x31b4('0x2c')](respondWithFilteredResult(_0x241b4f,_0x2b6a9e))['catch'](handleError(_0x241b4f,null));};exports['show']=function(_0x1b9bae,_0x42f17f){var _0x160131={};if(_0x1b9bae[_0x31b4('0x46')][_0x31b4('0x70')]&&_0x1b9bae[_0x31b4('0x46')][_0x31b4('0x70')]===_0x31b4('0x53')){_0x160131[_0x31b4('0x53')]=_0x1b9bae['params']['id'];}else{_0x160131['id']=_0x1b9bae[_0x31b4('0xb5')]['id'];}var _0x1ab1d3={'raw':![],'where':_0x160131},_0x247b15={};_0x247b15[_0x31b4('0x48')]=_['keys'](db[_0x31b4('0x41')][_0x31b4('0x42')]);_0x247b15[_0x31b4('0x46')]=_[_0x31b4('0x45')](_0x1b9bae[_0x31b4('0x46')]);_0x247b15[_0x31b4('0x51')]=_[_0x31b4('0x47')](_0x247b15[_0x31b4('0x48')],_0x247b15[_0x31b4('0x46')]);_0x1ab1d3['attributes']=_[_0x31b4('0x47')](_0x247b15[_0x31b4('0x48')],qs[_0x31b4('0x4a')](_0x1b9bae[_0x31b4('0x46')]['fields']));_0x1ab1d3[_0x31b4('0x49')]=_0x1ab1d3[_0x31b4('0x49')][_0x31b4('0x4b')]?_0x1ab1d3[_0x31b4('0x49')]:_0x247b15[_0x31b4('0x48')];if(_0x1b9bae[_0x31b4('0x46')][_0x31b4('0xb6')]){_0x1ab1d3['include']=[{'all':!![]}];}_0x1ab1d3=_['merge']({},_0x1ab1d3,_0x1b9bae[_0x31b4('0xb7')]);return db[_0x31b4('0x41')]['find'](_0x1ab1d3)[_0x31b4('0x2c')](handleEntityNotFound(_0x42f17f,null))['then'](respondWithResult(_0x42f17f,null))[_0x31b4('0x38')](handleError(_0x42f17f,null));};exports['create']=function(_0x74a440,_0x5a428c){return db['OpenchannelInteraction']['create'](_0x74a440['body'],{})[_0x31b4('0x2c')](respondWithResult(_0x5a428c,0xc9))[_0x31b4('0x38')](handleError(_0x5a428c,null));};exports[_0x31b4('0xb8')]=function(_0x22c7b1,_0x876678){if(_0x22c7b1[_0x31b4('0x78')]['id']){delete _0x22c7b1[_0x31b4('0x78')]['id'];}return db[_0x31b4('0x41')][_0x31b4('0x65')]({'where':{'id':_0x22c7b1['params']['id']}})[_0x31b4('0x2c')](handleEntityNotFound(_0x876678,null))[_0x31b4('0x2c')](saveUpdates(_0x22c7b1[_0x31b4('0x78')],null))[_0x31b4('0x2c')](respondWithResult(_0x876678,null))[_0x31b4('0x38')](handleError(_0x876678,null));};exports[_0x31b4('0x2d')]=function(_0x543fc8,_0x3092fa){return db['OpenchannelInteraction'][_0x31b4('0x65')]({'where':{'id':_0x543fc8[_0x31b4('0xb5')]['id']}})[_0x31b4('0x2c')](handleEntityNotFound(_0x3092fa,null))[_0x31b4('0x2c')](removeEntity(_0x3092fa,null))['catch'](handleError(_0x3092fa,null));};exports[_0x31b4('0xb9')]=function(_0x107165,_0x5a7b15){return db[_0x31b4('0x41')][_0x31b4('0xb9')]()[_0x31b4('0x2c')](respondWithResult(_0x5a7b15,null))[_0x31b4('0x38')](handleError(_0x5a7b15,null));};exports[_0x31b4('0xba')]=function(_0x12af71,_0x1a9fdf,_0x1c1b86){return db['OpenchannelMessage'][_0x31b4('0x65')]({'where':{'id':_0x12af71[_0x31b4('0xb5')]['id']}})[_0x31b4('0x2c')](handleEntityNotFound(_0x1a9fdf,null))[_0x31b4('0x2c')](function(_0x4d569c){if(_0x4d569c){return _0x4d569c[_0x31b4('0xba')](_0x12af71['body'][_0x31b4('0xbb')],_[_0x31b4('0xbc')](_0x12af71['body'],[_0x31b4('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x1a9fdf,null))[_0x31b4('0x38')](handleError(_0x1a9fdf,null));};exports['getMessages']=function(_0x43be94,_0xc126ac,_0x4548dc){var _0x444678={'raw':![],'where':{}};var _0x187bb9={};var _0x9487ad={'count':0x0,'rows':[]};return db[_0x31b4('0x41')]['findOne']({'where':{'id':_0x43be94[_0x31b4('0xb5')]['id']}})[_0x31b4('0x2c')](handleEntityNotFound(_0xc126ac,null))[_0x31b4('0x2c')](function(_0x5ed078){if(_0x5ed078){_0x187bb9[_0x31b4('0x48')]=_[_0x31b4('0x45')](db[_0x31b4('0xbd')][_0x31b4('0x42')]);_0x187bb9['query']=_['keys'](_0x43be94['query']);_0x187bb9['filters']=_[_0x31b4('0x47')](_0x187bb9[_0x31b4('0x48')],_0x187bb9[_0x31b4('0x46')]);_0x444678['attributes']=_[_0x31b4('0x47')](_0x187bb9[_0x31b4('0x48')],qs[_0x31b4('0x4a')](_0x43be94[_0x31b4('0x46')][_0x31b4('0x4a')]));_0x444678[_0x31b4('0x49')]=_0x444678['attributes'][_0x31b4('0x4b')]?_0x444678['attributes']:_0x187bb9['model'];if(!_0x43be94['query']['hasOwnProperty']('nolimit')){_0x444678['limit']=qs[_0x31b4('0x26')](_0x43be94[_0x31b4('0x46')][_0x31b4('0x26')]);_0x444678[_0x31b4('0x24')]=qs['offset'](_0x43be94[_0x31b4('0x46')]['offset']);}_0x444678[_0x31b4('0x4e')]=qs[_0x31b4('0x4f')](_0x43be94[_0x31b4('0x46')][_0x31b4('0x4f')]);_0x444678[_0x31b4('0x50')]=qs['filters'](_[_0x31b4('0xbe')](_0x43be94[_0x31b4('0x46')],_0x187bb9[_0x31b4('0x51')]));_0x444678[_0x31b4('0x50')][_0x31b4('0xb3')]=_0x5ed078['id'];if(_0x43be94[_0x31b4('0x46')][_0x31b4('0xbf')]){_0x444678['where']=_[_0x31b4('0x9f')](_0x444678['where'],{'$or':_[_0x31b4('0x32')](_0x444678[_0x31b4('0x49')],function(_0x266fe9){var _0x36a4f1={};_0x36a4f1[_0x266fe9]={'$like':'%'+_0x43be94[_0x31b4('0x46')][_0x31b4('0xbf')]+'%'};return _0x36a4f1;})});}if(_0x43be94[_0x31b4('0x46')][_0x31b4('0x80')]){var _0x475795=_0x43be94[_0x31b4('0x46')][_0x31b4('0x80')][_0x31b4('0x35')](',');var _0x854cfc={};_0x854cfc[_0x475795[0x0]]={'$gte':moment(_0x475795[0x1])[_0x31b4('0xc0')](_0x31b4('0xc1'))};_0x444678[_0x31b4('0x50')]=_[_0x31b4('0x9f')](_0x444678[_0x31b4('0x50')],_0x854cfc);}_0x444678=_[_0x31b4('0x9f')]({},_0x444678,_0x43be94[_0x31b4('0xb7')]);return db[_0x31b4('0xbd')][_0x31b4('0x27')]({'where':_0x444678['where']})['then'](function(_0x22a9b3){_0x9487ad[_0x31b4('0x27')]=_0x22a9b3;if(_0x43be94[_0x31b4('0x46')]['includeAll']){_0x444678[_0x31b4('0xc2')]=[{'all':!![]}];}return db[_0x31b4('0xbd')]['findAll'](_0x444678);})[_0x31b4('0x2c')](function(_0x1e1115){_0x9487ad[_0x31b4('0xc3')]=_0x1e1115;return _0x9487ad;});}})['then'](respondWithFilteredResult(_0xc126ac,_0x444678))[_0x31b4('0x38')](handleError(_0xc126ac,null));};exports[_0x31b4('0xc4')]=function(_0x5c1ae8,_0x495f00,_0x23103c){return db[_0x31b4('0x41')][_0x31b4('0x65')]({'where':{'id':_0x5c1ae8['params']['id']}})[_0x31b4('0x2c')](handleEntityNotFound(_0x495f00,null))[_0x31b4('0x2c')](function(_0x1f5188){if(_0x1f5188){return _0x1f5188[_0x31b4('0xc5')](_0x5c1ae8['body'][_0x31b4('0xbb')],_['omit'](_0x5c1ae8[_0x31b4('0x78')],[_0x31b4('0xbb'),'id'])||{})[_0x31b4('0xc6')](function(){return db[_0x31b4('0x73')][_0x31b4('0xc7')]({'attributes':['id',_0x31b4('0x2f'),_0x31b4('0xc8')],'where':{'id':_0x5c1ae8['body'][_0x31b4('0xbb')]}});})['then'](function(_0x14214c){socket['emit'](_0x31b4('0xc9'),{'id':Number(_0x5c1ae8[_0x31b4('0xb5')]['id']),'tags':_0x14214c||[]});return{'id':Number(_0x5c1ae8['params']['id']),'tags':_0x14214c||[]};});}})['then'](respondWithResult(_0x495f00,null))[_0x31b4('0x38')](handleError(_0x495f00,null));};exports[_0x31b4('0xca')]=function(_0x54c94b,_0x57d972,_0x115a3e){return db[_0x31b4('0x41')][_0x31b4('0x65')]({'where':{'id':_0x54c94b['params']['id']}})['then'](handleEntityNotFound(_0x57d972,null))['then'](function(_0x3b81eb){if(_0x3b81eb){return _0x3b81eb[_0x31b4('0xca')](_0x54c94b[_0x31b4('0x46')][_0x31b4('0xbb')]);}})['then'](respondWithStatusCode(_0x57d972,null))['catch'](handleError(_0x57d972,null));};exports[_0x31b4('0xcb')]=function(_0x2a45f0,_0x5597a3){var _0x4e61a8=moment()[_0x31b4('0xcc')]()[_0x31b4('0x9d')]();var _0x4e82ab=path['join'](config[_0x31b4('0xcd')],_0x31b4('0xce'),_0x31b4('0xcf'),'tmp');var _0x8fbc50=path[_0x31b4('0xd0')](config[_0x31b4('0xcd')],_0x31b4('0xce'),_0x31b4('0xcf'),_0x31b4('0xd1'));var _0x5a1da1=path[_0x31b4('0xd0')](_0x4e82ab,_0x4e61a8);var _0x5970b9=util['format'](_0x31b4('0xd2'),_0x2a45f0[_0x31b4('0xb5')]['id'],_0x4e61a8);var _0x3ed838=path[_0x31b4('0xd0')](_0x4e82ab,_0x5970b9);var _0x23d4c4=[];_0x23d4c4[_0x31b4('0x37')]({'model':db[_0x31b4('0x77')],'as':_0x31b4('0x77'),'attributes':['id',_0x31b4('0x33')],'raw':!![]});_0x23d4c4[_0x31b4('0x37')]({'model':db[_0x31b4('0xd3')],'as':'Contact','attributes':['id',_0x31b4('0xd4'),_0x31b4('0xd5')],'raw':!![]});if(_0x2a45f0[_0x31b4('0x46')]['attachments']){_0x23d4c4[_0x31b4('0x37')]({'model':db[_0x31b4('0xd6')],'as':_0x31b4('0xd6'),'raw':!![]});}var _0x54a8ee=[{'model':db[_0x31b4('0xbd')],'as':_0x31b4('0xd7'),'attributes':['id',_0x31b4('0x78'),_0x31b4('0xd8'),_0x31b4('0xd9'),_0x31b4('0xda'),'read'],'include':_0x23d4c4}];_0x54a8ee[_0x31b4('0x37')]({'model':db[_0x31b4('0xdb')],'as':_0x31b4('0xdc'),'attributes':['id',_0x31b4('0x2f')]});_0x54a8ee[_0x31b4('0x37')]({'model':db[_0x31b4('0x77')],'as':_0x31b4('0xdd'),'attributes':['id',_0x31b4('0x33')]});return db[_0x31b4('0x41')]['find']({'where':{'id':_0x2a45f0[_0x31b4('0xb5')]['id']},'include':_0x54a8ee})[_0x31b4('0x2c')](handleEntityNotFound(_0x5597a3,null))[_0x31b4('0x2c')](function(_0x226d0a){if(_0x226d0a){var _0x3df9ef=_0x226d0a[_0x31b4('0xde')]({'plain':!![]});fs[_0x31b4('0xdf')](_0x5a1da1);var _0x49c415={'channel':_0x31b4('0xe0'),'account':_0x3df9ef['Account'][_0x31b4('0x2f')],'agent':_0x3df9ef[_0x31b4('0xdd')]?_0x3df9ef[_0x31b4('0xdd')][_0x31b4('0x33')]:_0x31b4('0xe1'),'createdAt':moment(_0x3df9ef[_0x31b4('0xd8')])['format'](_0x31b4('0xc1'))[_0x31b4('0x9d')](),'closedAt':_0x3df9ef[_0x31b4('0x3d')]?moment(_0x3df9ef[_0x31b4('0xe2')])[_0x31b4('0xc0')](_0x31b4('0xc1'))[_0x31b4('0x9d')]():'','disposition':_0x3df9ef[_0x31b4('0xe3')],'visibility':_0x3df9ef['threadId']?_0x31b4('0xe4'):_0x31b4('0xe5'),'messages':_(_0x3df9ef['Messages'])['filter']({'secret':![]})[_0x31b4('0x32')](function(_0xfed5b5){if(_0xfed5b5['Attachment']){var _0x39b1e6=path[_0x31b4('0xd0')](_0x8fbc50,_0xfed5b5[_0x31b4('0xd6')]['basename']);if(fs[_0x31b4('0xe6')](_0x39b1e6)){fs[_0x31b4('0xe7')](_0x39b1e6)['pipe'](fs[_0x31b4('0xe8')](path[_0x31b4('0xd0')](_0x5a1da1,_0xfed5b5[_0x31b4('0xd6')][_0x31b4('0xe9')])));}}return{'date':moment(_0xfed5b5[_0x31b4('0xd8')])[_0x31b4('0xc0')](_0x31b4('0xc1'))[_0x31b4('0x9d')](),'sender':_0xfed5b5[_0x31b4('0xd9')]===_0x31b4('0xea')?_0xfed5b5[_0x31b4('0x77')]?_0xfed5b5[_0x31b4('0x77')][_0x31b4('0x33')]:_0x31b4('0xeb'):_0xfed5b5['Contact'][_0x31b4('0xd4')]+(_0xfed5b5['Contact'][_0x31b4('0xd5')]?'\x20'+_0xfed5b5[_0x31b4('0xec')]['lastName']:''),'body':_0xfed5b5[_0x31b4('0xd6')]?_0xfed5b5[_0x31b4('0xd6')][_0x31b4('0xe9')]:_0xfed5b5[_0x31b4('0x78')],'direction':_0xfed5b5[_0x31b4('0xd9')]===_0x31b4('0xea')?'A':'C','secret':_0xfed5b5['secret'],'read':_0xfed5b5[_0x31b4('0x84')],'attachment':_0xfed5b5[_0x31b4('0xd6')]};})[_0x31b4('0x66')]()};return ejs['renderFile'](path[_0x31b4('0xd0')](config[_0x31b4('0xcd')],_0x31b4('0xce'),_0x31b4('0xed'),_0x31b4('0xee')),{'interaction':_0x49c415})[_0x31b4('0x2c')](function(_0x128ad5){var _0x219f87=path[_0x31b4('0xd0')](_0x5a1da1,'transcript-'+_0x3df9ef['id']+'-'+_0x4e61a8+_0x31b4('0xef'));var _0x1a4814={'path':_0x219f87,'channel':_0x31b4('0xe0'),'interactionId':_0x3df9ef['id']};return pdf[_0x31b4('0xf0')](_0x128ad5,_0x1a4814);})['then'](function(){return new BPromise(function(_0x281a4a,_0x346393){zipdir(_0x5a1da1,{'saveTo':_0x3ed838},function(_0x260de7,_0x79eb08){if(_0x260de7)return _0x346393(_0x260de7);return _0x281a4a(_0x79eb08);});})[_0x31b4('0x2c')](function(){return new BPromise(function(_0xaf8fa4,_0x2df8a7){rimraf(_0x5a1da1,function(_0x4276e7){if(_0x4276e7)_0x2df8a7(_0x4276e7);return _0xaf8fa4();});});})[_0x31b4('0x2c')](function(){return _0x5597a3['download'](_0x3ed838,_0x5970b9,function(_0x37cb6d){if(_0x37cb6d){console[_0x31b4('0xf1')](_0x31b4('0xf2'),_0x37cb6d);}else{fs[_0x31b4('0xf3')](_0x3ed838);}});});});}else{return _0x5597a3[_0x31b4('0x20')](0xc8);}})['catch'](handleError(_0x5597a3,null));}; \ No newline at end of file +var _0x128c=['request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','redis','socket.io-emitter','register','end','json','offset','undefined','count','limit','apply','reject','then','destroy','status','sendStatus','error','stack','name','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','OpenchannelInteraction','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','start','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','OpenchannelMessage','$gte','format','includeAll','findAll','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','root','attachments','transcript-%d-%s.zip','CmContact','Attachment','Messages','direction','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','Private','basename','existsSync','createWriteStream','out','Contact','firstName','lastName','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1fe0cb,_0x4b7fba){var _0x5a4082=function(_0x1ff4d7){while(--_0x1ff4d7){_0x1fe0cb['push'](_0x1fe0cb['shift']());}};_0x5a4082(++_0x4b7fba);}(_0x128c,0xe7));var _0xc128=function(_0x3cdb3a,_0x31982b){_0x3cdb3a=_0x3cdb3a-0x0;var _0x31aaef=_0x128c[_0x3cdb3a];return _0x31aaef;};'use strict';var emlformat=require(_0xc128('0x0'));var rimraf=require(_0xc128('0x1'));var zipdir=require(_0xc128('0x2'));var jsonpatch=require(_0xc128('0x3'));var rp=require(_0xc128('0x4'));var moment=require(_0xc128('0x5'));var BPromise=require(_0xc128('0x6'));var Mustache=require('mustache');var util=require(_0xc128('0x7'));var path=require(_0xc128('0x8'));var sox=require(_0xc128('0x9'));var csv=require(_0xc128('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc128('0xb'));var _=require('lodash');var squel=require(_0xc128('0xc'));var crypto=require(_0xc128('0xd'));var jsforce=require(_0xc128('0xe'));var deskjs=require(_0xc128('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc128('0x10'));var Papa=require(_0xc128('0x11'));var Redis=require(_0xc128('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc128('0x13'));var pdf=require(_0xc128('0x14'));var hardwareService=require(_0xc128('0x15'));var logger=require(_0xc128('0x16'))(_0xc128('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc128('0x18')]=_['defaults'](config[_0xc128('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc128('0x19'))(new Redis(config[_0xc128('0x18')]));require('./openchannelInteraction.socket')[_0xc128('0x1a')](socket);function respondWithStatusCode(_0x9d4479,_0x453674){_0x453674=_0x453674||0xcc;return function(_0x220b3a){if(_0x220b3a){return _0x9d4479['sendStatus'](_0x453674);}return _0x9d4479['status'](_0x453674)[_0xc128('0x1b')]();};}function respondWithResult(_0x555a2a,_0x1f62be){_0x1f62be=_0x1f62be||0xc8;return function(_0x4852b6){if(_0x4852b6){return _0x555a2a['status'](_0x1f62be)[_0xc128('0x1c')](_0x4852b6);}};}function respondWithFilteredResult(_0x19579d,_0x17a3c4){return function(_0x38829a){if(_0x38829a){var _0x22fc26=typeof _0x17a3c4[_0xc128('0x1d')]===_0xc128('0x1e')&&typeof _0x17a3c4['limit']==='undefined';var _0x5d3a38=_0x38829a[_0xc128('0x1f')];var _0x4d7721=_0x22fc26?0x0:_0x17a3c4[_0xc128('0x1d')];var _0x5e6b3f=_0x22fc26?_0x38829a[_0xc128('0x1f')]:_0x17a3c4[_0xc128('0x1d')]+_0x17a3c4[_0xc128('0x20')];var _0x36384f;if(_0x5e6b3f>=_0x5d3a38){_0x5e6b3f=_0x5d3a38;_0x36384f=0xc8;}else{_0x36384f=0xce;}_0x19579d['status'](_0x36384f);return _0x19579d['set']('Content-Range',_0x4d7721+'-'+_0x5e6b3f+'/'+_0x5d3a38)['json'](_0x38829a);}return null;};}function patchUpdates(_0x3db8b0){return function(_0x18cdc2){try{jsonpatch[_0xc128('0x21')](_0x18cdc2,_0x3db8b0,!![]);}catch(_0x203440){return BPromise[_0xc128('0x22')](_0x203440);}return _0x18cdc2['save']();};}function saveUpdates(_0x51aa02,_0x1ad11c){return function(_0x14eec6){if(_0x14eec6){return _0x14eec6['update'](_0x51aa02)[_0xc128('0x23')](function(_0x518745){return _0x518745;});}return null;};}function removeEntity(_0x5b1968,_0x42cb41){return function(_0x5038b3){if(_0x5038b3){return _0x5038b3[_0xc128('0x24')]()[_0xc128('0x23')](function(){_0x5b1968[_0xc128('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x139653,_0x56769d){return function(_0xb41b4b){if(!_0xb41b4b){_0x139653[_0xc128('0x26')](0x194);}return _0xb41b4b;};}function handleError(_0x966325,_0x517bfc){_0x517bfc=_0x517bfc||0x1f4;return function(_0x445ab1){logger[_0xc128('0x27')](_0x445ab1[_0xc128('0x28')]);if(_0x445ab1['name']){delete _0x445ab1[_0xc128('0x29')];}_0x966325[_0xc128('0x25')](_0x517bfc)['send'](_0x445ab1);};}function getInteractionUsers(_0x5eb788,_0x379c4e){return new BPromise(function(_0x308429,_0x2bcdb6){try{if(_0x379c4e[_0x5eb788['id']]){_0x5eb788[_0xc128('0x2a')]=_[_0xc128('0x2b')](_0x379c4e[_0x5eb788['id']],function(_0x3d68b3){return{'id':_0x3d68b3['id'],'fullname':_0x3d68b3[_0xc128('0x2c')]};});}}catch(_0x32ab8a){_0x2bcdb6(_0x32ab8a);}_0x308429(_0x5eb788);});}function getInteractionTags(_0x1c2844,_0x1b21be){return new BPromise(function(_0x4bff46,_0x46c94f){try{if(_0x1c2844[_0xc128('0x2d')]){_0x1c2844['Tags']=[];_0x1c2844[_0xc128('0x2d')][_0xc128('0x2e')](',')[_0xc128('0x2f')](function(_0x3323c2){_0x1c2844[_0xc128('0x30')][_0xc128('0x31')](_0x1b21be[_0x3323c2]);});}delete _0x1c2844[_0xc128('0x2d')];}catch(_0x19d0ee){_0x46c94f(_0x19d0ee);}_0x4bff46(_0x1c2844);});}function updateOpenchannelInteraction(_0x5127cf,_0x46b493,_0x3a9987){return new BPromise(function(_0x35eeb5,_0x34f3af){return getInteractionUsers(_0x5127cf,_0x3a9987)['then'](function(_0x4f9c42){return getInteractionTags(_0x4f9c42,_0x46b493);})[_0xc128('0x23')](function(_0x4b5798){return getStateInteraction(_0x4b5798);})[_0xc128('0x23')](function(_0x36c1ed){_0x35eeb5(_0x36c1ed);})[_0xc128('0x32')](function(_0x401570){_0x34f3af(_0x401570);});});}function getStateInteraction(_0x1c2162){return new BPromise(function(_0x103b6f){_0x1c2162[_0xc128('0x33')]=0x0;_0x1c2162[_0xc128('0x34')]=0x0;_0x1c2162['answered']=0x0;_0x1c2162[_0xc128('0x35')]=0x0;_0x1c2162[_0xc128('0x36')]=0x0;if(!_0x1c2162[_0xc128('0x37')]&&!_0x1c2162['UserId']){_0x1c2162[_0xc128('0x33')]+=0x1;}if(!_0x1c2162[_0xc128('0x37')]&&_0x1c2162[_0xc128('0x38')]){_0x1c2162[_0xc128('0x34')]+=0x1;if(_0x1c2162[_0xc128('0x33')]){_0x1c2162[_0xc128('0x33')]-=0x1;}}if(_0x1c2162[_0xc128('0x37')]&&_0x1c2162['UserId']){_0x1c2162[_0xc128('0x39')]+=0x1;if(_0x1c2162[_0xc128('0x34')]){_0x1c2162[_0xc128('0x34')]-=0x1;}}if(_0x1c2162['closed']&&!_0x1c2162['UserId']){_0x1c2162[_0xc128('0x35')]+=0x1;if(_0x1c2162[_0xc128('0x33')]){_0x1c2162[_0xc128('0x33')]-=0x1;}}_0x1c2162[_0xc128('0x36')]+=0x1;_0x103b6f(_0x1c2162);});}exports['index']=function(_0x4456c0,_0x41ab96){var _0x579629={},_0x359e13={},_0x1e427c={'count':0x0,'rows':[]};var _0x271584=_[_0xc128('0x2b')](db[_0xc128('0x3a')][_0xc128('0x3b')],function(_0x42c869){return{'name':_0x42c869['fieldName'],'type':_0x42c869['type']['key']};});_0x359e13[_0xc128('0x3c')]=_[_0xc128('0x2b')](_0x271584,_0xc128('0x29'));_0x359e13[_0xc128('0x3d')]=_[_0xc128('0x3e')](_0x4456c0[_0xc128('0x3d')]);_0x359e13[_0xc128('0x3f')]=_[_0xc128('0x40')](_0x359e13[_0xc128('0x3c')],_0x359e13[_0xc128('0x3d')]);_0x579629[_0xc128('0x41')]=_[_0xc128('0x40')](_0x359e13[_0xc128('0x3c')],qs[_0xc128('0x42')](_0x4456c0['query'][_0xc128('0x42')]));_0x579629[_0xc128('0x41')]=_0x579629[_0xc128('0x41')][_0xc128('0x43')]?_0x579629['attributes']:_0x359e13[_0xc128('0x3c')];if(!_0x4456c0[_0xc128('0x3d')][_0xc128('0x44')](_0xc128('0x45'))){_0x579629['limit']=qs[_0xc128('0x20')](_0x4456c0[_0xc128('0x3d')][_0xc128('0x20')]);_0x579629['offset']=qs[_0xc128('0x1d')](_0x4456c0[_0xc128('0x3d')]['offset']);}_0x579629[_0xc128('0x46')]=qs[_0xc128('0x47')](_0x4456c0[_0xc128('0x3d')][_0xc128('0x47')]);_0x579629[_0xc128('0x48')]=qs['filters'](_[_0xc128('0x49')](_0x4456c0[_0xc128('0x3d')],_0x359e13['filters']),_0x271584);var _0x149c02=[];var _0x4b658d=squel[_0xc128('0x4a')]()[_0xc128('0x4b')]('id')[_0xc128('0x4b')]('name')['field']('color')[_0xc128('0x4c')]('tools_tags');var _0x4c6900=squel[_0xc128('0x4a')]()['field']('u.id')[_0xc128('0x4b')]('u.fullname')[_0xc128('0x4b')](_0xc128('0x4d'))[_0xc128('0x4c')]('user_has_openchannel_interactions','ui')[_0xc128('0x4e')]('users','u',_0xc128('0x4f'));var _0x1b1df6=squel['select']()[_0xc128('0x4c')](_0xc128('0x50'),'i')[_0xc128('0x4e')](_0xc128('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc128('0x4e')](_0xc128('0x52'),'o',_0xc128('0x53'))[_0xc128('0x4e')](_0xc128('0x54'),'a',_0xc128('0x55'))[_0xc128('0x4e')](_0xc128('0x56'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xc128('0x4e')](_0xc128('0x57'),'it',_0xc128('0x58'))[_0xc128('0x4e')](_0xc128('0x59'),'t','t.id\x20=\x20it.TagId');var _0x595ebf=squel[_0xc128('0x5a')]();var _0x1dac62=[];var _0x543cdf=squel[_0xc128('0x5a')]();var _0x44d712;if(_0x4456c0[_0xc128('0x3d')][_0xc128('0x5b')]){_0x44d712=as[_0xc128('0x5c')](_0x4456c0[_0xc128('0x3d')]['search']);var _0x2996c2=_0x44d712[_0xc128('0x5d')];for(var _0x5271de=0x0;_0x5271de<_0x44d712['conditions'][_0xc128('0x43')];_0x5271de++){var _0x47c4d6=_0x44d712[_0xc128('0x5e')][_0x5271de];var _0x4f91fc='i';var _0x21f998=_[_0xc128('0x5f')](_0x271584,['name',_0x47c4d6[_0xc128('0x4b')]]);if(!_0x21f998){switch(_0x47c4d6[_0xc128('0x4b')]){case _0xc128('0x60'):if(_0x47c4d6[_0xc128('0x61')]==0x1){_0x1b1df6[_0xc128('0x62')]('`'+_0x47c4d6[_0xc128('0x4b')]+_0xc128('0x63'));}else{_0x1b1df6[_0xc128('0x62')]('`'+_0x47c4d6['field']+_0xc128('0x64'));}break;case'Contact':if(_0x47c4d6[_0xc128('0x65')]==='$substring'){if(_0x47c4d6['value'][_0xc128('0x2e')]('\x20')[_0xc128('0x43')]>0x1){_0x595ebf[_0x2996c2](_0xc128('0x66'),qs[_0xc128('0x67')](_0x47c4d6[_0xc128('0x61')]),null);}else{var _0x5b6610='%'+_0x47c4d6[_0xc128('0x61')]+'%';_0x595ebf[_0x2996c2](_0xc128('0x68'),_0x5b6610,_0x5b6610,_0x5b6610);}}else{_0x21f998=_[_0xc128('0x5f')](_0x271584,[_0xc128('0x29'),_0xc128('0x69')]);_0x47c4d6[_0xc128('0x4b')]=_0xc128('0x69');_0xae8817=as['buildExpression'](_0x4f91fc,_0x21f998[_0xc128('0x6a')],_0x47c4d6);_0x595ebf[_0x2996c2](_0xae8817['text'],_0xae8817['value'][_0xc128('0x6b')],_0xae8817[_0xc128('0x61')][_0xc128('0x1b')]);}break;case'Tag':var _0x5c8766=_0x47c4d6[_0xc128('0x61')][_0xc128('0x2e')](',')['map'](function(_0x55ae5f){return Number(_0x55ae5f);});_0x5c8766['forEach'](function(_0x3377c3){_0x543cdf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3377c3+',%');});_0x1dac62=_[_0xc128('0x6c')](_0x1dac62,_0x5c8766);break;case _0xc128('0x6d'):if(_0x47c4d6[_0xc128('0x65')]===_0xc128('0x6e')){_0x595ebf[_0x2996c2](_0xc128('0x6f'),'%'+_0x47c4d6[_0xc128('0x61')]+'%',null);}else{_0x21f998=_['find'](_0x271584,[_0xc128('0x29'),'UserId']);_0x47c4d6[_0xc128('0x4b')]=_0xc128('0x38');_0xae8817=as[_0xc128('0x70')](_0x4f91fc,_0x21f998[_0xc128('0x6a')],_0x47c4d6);_0x595ebf[_0x2996c2](_0xae8817[_0xc128('0x71')],_0xae8817['value'][_0xc128('0x6b')],_0xae8817[_0xc128('0x61')][_0xc128('0x1b')]);}break;case'body':_0xae8817=as['buildExpression']('me',null,_0x47c4d6);_0x595ebf[_0x2996c2](_0xae8817['text'],_0xae8817[_0xc128('0x61')][_0xc128('0x6b')],_0xae8817[_0xc128('0x61')][_0xc128('0x1b')]);break;}}else{var _0xae8817=as[_0xc128('0x70')](_0x4f91fc,_0x21f998[_0xc128('0x6a')],_0x47c4d6);_0x595ebf[_0x2996c2](_0xae8817[_0xc128('0x71')],_0xae8817[_0xc128('0x61')]['start'],_0xae8817[_0xc128('0x61')][_0xc128('0x1b')]);}}}else{var _0x4f006d=_(_0x4456c0[_0xc128('0x3d')])[_0xc128('0x3e')]()['map'](function(_0xa55f43){return _[_0xc128('0x72')](_0x271584,[_0xc128('0x29'),_0xa55f43])?_0xa55f43:undefined;})[_0xc128('0x73')]()[_0xc128('0x61')]();if(!_[_0xc128('0x74')](_0x4f006d)){_0x4f006d[_0xc128('0x2f')](function(_0x43f8a6){if(_0x43f8a6===_0xc128('0x75')){_0x1b1df6[_0xc128('0x48')](_0xc128('0x76'),[][_0xc128('0x77')](_0x4456c0[_0xc128('0x3d')][_0x43f8a6]));}else if(_0x43f8a6===_0xc128('0x78')){var _0x9133c1=JSON[_0xc128('0x79')](_0x4456c0['query'][_0x43f8a6])['$gte'];var _0x4b6f90=JSON[_0xc128('0x79')](_0x4456c0['query'][_0x43f8a6])[_0xc128('0x7a')];_0x1b1df6['where'](_0xc128('0x7b'),_0x9133c1,_0x4b6f90);}else{if(_0x4456c0[_0xc128('0x3d')][_0x43f8a6]===_0xc128('0x7c')){_0x1b1df6[_0xc128('0x48')]('i.'+_0x43f8a6+_0xc128('0x7d'));}else{_0x1b1df6[_0xc128('0x48')]('i.'+_0x43f8a6+_0xc128('0x7e'),_0x4456c0['query'][_0x43f8a6]);}}});}if(_0x4456c0['query']['read']){if(_0x4456c0[_0xc128('0x3d')][_0xc128('0x7f')]==0x1){_0x1b1df6[_0xc128('0x62')]('`unreadMessages`\x20=\x200');}else{_0x1b1df6[_0xc128('0x62')](_0xc128('0x80'));}}if(_0x4456c0['query']['tag']){_0x1dac62=_[_0xc128('0x81')](_0x4456c0[_0xc128('0x3d')][_0xc128('0x82')])?_0x4456c0[_0xc128('0x3d')]['tag']:new Array(_0x4456c0[_0xc128('0x3d')][_0xc128('0x82')]);_0x1dac62[_0xc128('0x2f')](function(_0x34c733){_0x543cdf['or'](_0xc128('0x83'),'%,'+_0x34c733+',%');});}if(_0x4456c0[_0xc128('0x3d')]['filter']){var _0x34fdc0=_0x4456c0['query'][_0xc128('0x84')][_0xc128('0x85')]('\x5c','\x5c\x5c')[_0xc128('0x85')](/'/g,'\x27\x27');if(qs[_0xc128('0x86')](_0x34fdc0)){_0x595ebf['or'](_0xc128('0x87'),_0x34fdc0+'%');}else{_0x595ebf['or'](_0xc128('0x88'),qs['getFullTextValue'](_0x34fdc0))['or'](_0xc128('0x89'),_0x34fdc0+'%')['or'](_0xc128('0x8a'),_0x34fdc0+'%');}}}_0x1b1df6[_0xc128('0x48')](_0x595ebf);_0x1b1df6[_0xc128('0x8b')](_0xc128('0x8c'));var _0x2c5f42={'type':db[_0xc128('0x8d')]['QueryTypes'][_0xc128('0x8e')],'raw':!![]};var _0x30a5e9=_0x1b1df6['clone']();_0x30a5e9[_0xc128('0x4b')](_0xc128('0x8c'));_0x30a5e9[_0xc128('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x579629[_0xc128('0x46')]){_0x579629[_0xc128('0x46')][_0xc128('0x2f')](function(_0x22b152){var _0xbc58b7=_0x22b152[0x0]===_0xc128('0x8f')?_0x22b152[0x0]:'i.'+_0x22b152[0x0];_0x1b1df6[_0xc128('0x46')](_0xbc58b7,_0x22b152[0x1]===_0xc128('0x90')?![]:!![]);});}if(!_[_0xc128('0x74')](_0x1dac62)){_0x1b1df6['having'](_0x543cdf);_0x30a5e9[_0xc128('0x48')](_0xc128('0x91'),_0x1dac62);}BPromise[_0xc128('0x92')]()[_0xc128('0x23')](function(){if(!_0x44d712){if(_0x4456c0[_0xc128('0x3d')][_0xc128('0x75')])return;_0x30a5e9[_0xc128('0x48')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1b1df6[_0xc128('0x48')](_0xc128('0x93'));return;}if(_0x4456c0[_0xc128('0x94')][_0xc128('0x95')]!=='agent')return;return _0x4456c0[_0xc128('0x94')][_0xc128('0x96')]({'attributes':['id'],'raw':!![]})[_0xc128('0x23')](function(_0xc39243){if(_[_0xc128('0x74')](_0xc39243)){_0x30a5e9[_0xc128('0x48')](_0xc128('0x97'));_0x1b1df6[_0xc128('0x48')](_0xc128('0x97'));}else{_0x30a5e9[_0xc128('0x48')](_0xc128('0x76'),_[_0xc128('0x2b')](_0xc39243,'id'));_0x1b1df6[_0xc128('0x48')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xc128('0x2b')](_0xc39243,'id'));}});})['then'](function(){if(_0x4456c0['user'][_0xc128('0x95')]==='agent'&&!_0x44d712&&!_0x4456c0[_0xc128('0x3d')][_0xc128('0x75')])return[];return db[_0xc128('0x98')]['query'](_0x30a5e9['toString'](),_0x2c5f42);})[_0xc128('0x23')](function(_0x46a958){_0x1e427c[_0xc128('0x1f')]=_0x46a958[_0xc128('0x43')];if(_0x1e427c[_0xc128('0x1f')]===0x0)return[];return db[_0xc128('0x98')]['query'](_0x4b658d[_0xc128('0x99')](),_0x2c5f42)[_0xc128('0x23')](function(_0x2689f2){_0x149c02=_['keyBy'](_0x2689f2,'id');_0x2c5f42=_[_0xc128('0x9a')](_0x2c5f42,{'model':db[_0xc128('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4456c0['query']['fields']){_0x579629[_0xc128('0x41')][_0xc128('0x2f')](function(_0x4cbbb7){_0x1b1df6[_0xc128('0x4b')]('i.'+_0x4cbbb7);});}else{_0x1b1df6['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc128('0x60'));_0x1b1df6[_0xc128('0x4b')](_0xc128('0x9b'),_0xc128('0x9c'));_0x1b1df6['field']('a.mandatoryDisposition',_0xc128('0x9d'));_0x1b1df6[_0xc128('0x4b')](_0xc128('0x9e'),_0xc128('0x8f'));_0x1b1df6[_0xc128('0x4b')](_0xc128('0x9f'));_0x1b1df6[_0xc128('0x4b')](_0xc128('0xa0'),'Contact.firstName');_0x1b1df6[_0xc128('0x4b')](_0xc128('0xa1'),'Contact.lastName');_0x1b1df6[_0xc128('0x4b')](_0xc128('0xa2'),'Contact.email');_0x1b1df6[_0xc128('0x4b')]('c.phone',_0xc128('0xa3'));_0x1b1df6[_0xc128('0x4b')](_0xc128('0xa4'),_0xc128('0xa5'));_0x1b1df6[_0xc128('0x4b')]('c.fax','Contact.fax');_0x1b1df6[_0xc128('0x4b')](_0xc128('0xa6'),_0xc128('0xa7'));_0x1b1df6[_0xc128('0x4b')](_0xc128('0xa8'),_0xc128('0xa9'));_0x1b1df6[_0xc128('0x4b')](_0xc128('0xaa'),_0xc128('0x2d'));}if(_0x579629[_0xc128('0x20')])_0x1b1df6[_0xc128('0x20')](_0x579629[_0xc128('0x20')]);if(_0x579629[_0xc128('0x1d')])_0x1b1df6[_0xc128('0x1d')](_0x579629['offset']);return db[_0xc128('0x98')][_0xc128('0x3d')](_0x1b1df6[_0xc128('0x99')](),_0x2c5f42);})['then'](function(_0x22bd24){if(_0x22bd24[_0xc128('0x43')]>0x0)_0x4c6900[_0xc128('0x48')](_0xc128('0xab'),_[_0xc128('0x2b')](_0x22bd24,'id'));return db[_0xc128('0x98')][_0xc128('0x3d')](_0x4c6900['toString'](),_0x2c5f42)[_0xc128('0x23')](function(_0x318f8d){var _0x43a2fa=_['groupBy'](_0x318f8d,_0xc128('0xac'));var _0x5bc215=[];_0x22bd24[_0xc128('0x2f')](function(_0x17b7a2){_0x5bc215[_0xc128('0x31')](updateOpenchannelInteraction(_0x17b7a2,_0x149c02,_0x43a2fa));});return BPromise[_0xc128('0xad')](_0x5bc215);});});})[_0xc128('0x23')](function(_0x17abf9){_0x1e427c['rows']=_0x17abf9;return _0x1e427c;})[_0xc128('0x23')](respondWithFilteredResult(_0x41ab96,_0x579629))['catch'](handleError(_0x41ab96,null));};exports['show']=function(_0x51b4b0,_0x3e61df){var _0x4bd4eb={};if(_0x51b4b0['query']['type']&&_0x51b4b0[_0xc128('0x3d')]['type']===_0xc128('0x4c')){_0x4bd4eb[_0xc128('0x4c')]=_0x51b4b0[_0xc128('0xae')]['id'];}else{_0x4bd4eb['id']=_0x51b4b0[_0xc128('0xae')]['id'];}var _0xddace9={'raw':![],'where':_0x4bd4eb},_0x3fe30f={};_0x3fe30f[_0xc128('0x3c')]=_[_0xc128('0x3e')](db[_0xc128('0x3a')][_0xc128('0x3b')]);_0x3fe30f[_0xc128('0x3d')]=_[_0xc128('0x3e')](_0x51b4b0[_0xc128('0x3d')]);_0x3fe30f['filters']=_[_0xc128('0x40')](_0x3fe30f['model'],_0x3fe30f[_0xc128('0x3d')]);_0xddace9[_0xc128('0x41')]=_[_0xc128('0x40')](_0x3fe30f[_0xc128('0x3c')],qs[_0xc128('0x42')](_0x51b4b0[_0xc128('0x3d')][_0xc128('0x42')]));_0xddace9[_0xc128('0x41')]=_0xddace9['attributes'][_0xc128('0x43')]?_0xddace9[_0xc128('0x41')]:_0x3fe30f['model'];if(_0x51b4b0[_0xc128('0x3d')]['includeAll']){_0xddace9[_0xc128('0xaf')]=[{'all':!![]}];}_0xddace9=_[_0xc128('0x9a')]({},_0xddace9,_0x51b4b0[_0xc128('0xb0')]);return db[_0xc128('0x3a')][_0xc128('0x5f')](_0xddace9)[_0xc128('0x23')](handleEntityNotFound(_0x3e61df,null))[_0xc128('0x23')](respondWithResult(_0x3e61df,null))[_0xc128('0x32')](handleError(_0x3e61df,null));};exports[_0xc128('0xb1')]=function(_0x2692f5,_0x163d38){return db[_0xc128('0x3a')][_0xc128('0xb1')](_0x2692f5['body'],{})[_0xc128('0x23')](respondWithResult(_0x163d38,0xc9))[_0xc128('0x32')](handleError(_0x163d38,null));};exports['update']=function(_0x2241b2,_0x91537){if(_0x2241b2[_0xc128('0xb2')]['id']){delete _0x2241b2[_0xc128('0xb2')]['id'];}return db[_0xc128('0x3a')]['find']({'where':{'id':_0x2241b2[_0xc128('0xae')]['id']}})[_0xc128('0x23')](handleEntityNotFound(_0x91537,null))[_0xc128('0x23')](saveUpdates(_0x2241b2[_0xc128('0xb2')],null))[_0xc128('0x23')](respondWithResult(_0x91537,null))[_0xc128('0x32')](handleError(_0x91537,null));};exports[_0xc128('0x24')]=function(_0x58ffab,_0x5d2108){return db[_0xc128('0x3a')][_0xc128('0x5f')]({'where':{'id':_0x58ffab[_0xc128('0xae')]['id']}})[_0xc128('0x23')](handleEntityNotFound(_0x5d2108,null))[_0xc128('0x23')](removeEntity(_0x5d2108,null))['catch'](handleError(_0x5d2108,null));};exports['describe']=function(_0x540aa3,_0x3413c1){return db['OpenchannelInteraction'][_0xc128('0xb3')]()['then'](respondWithResult(_0x3413c1,null))[_0xc128('0x32')](handleError(_0x3413c1,null));};exports[_0xc128('0xb4')]=function(_0x825df6,_0x17ddc6,_0x4112de){return db['OpenchannelMessage']['find']({'where':{'id':_0x825df6[_0xc128('0xae')]['id']}})[_0xc128('0x23')](handleEntityNotFound(_0x17ddc6,null))['then'](function(_0x4e818f){if(_0x4e818f){return _0x4e818f['addMessage'](_0x825df6[_0xc128('0xb2')][_0xc128('0xb5')],_[_0xc128('0xb6')](_0x825df6[_0xc128('0xb2')],[_0xc128('0xb5'),'id'])||{});}})[_0xc128('0x23')](respondWithResult(_0x17ddc6,null))[_0xc128('0x32')](handleError(_0x17ddc6,null));};exports[_0xc128('0xb7')]=function(_0x37c914,_0xc4f50f,_0xcd2945){var _0x190ec0={'raw':![],'where':{}};var _0x59a145={};var _0x171eec={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x37c914[_0xc128('0xae')]['id']}})[_0xc128('0x23')](handleEntityNotFound(_0xc4f50f,null))[_0xc128('0x23')](function(_0x57e318){if(_0x57e318){_0x59a145[_0xc128('0x3c')]=_[_0xc128('0x3e')](db[_0xc128('0xb8')][_0xc128('0x3b')]);_0x59a145[_0xc128('0x3d')]=_[_0xc128('0x3e')](_0x37c914[_0xc128('0x3d')]);_0x59a145['filters']=_[_0xc128('0x40')](_0x59a145[_0xc128('0x3c')],_0x59a145['query']);_0x190ec0[_0xc128('0x41')]=_[_0xc128('0x40')](_0x59a145[_0xc128('0x3c')],qs[_0xc128('0x42')](_0x37c914[_0xc128('0x3d')]['fields']));_0x190ec0['attributes']=_0x190ec0['attributes'][_0xc128('0x43')]?_0x190ec0[_0xc128('0x41')]:_0x59a145[_0xc128('0x3c')];if(!_0x37c914[_0xc128('0x3d')][_0xc128('0x44')](_0xc128('0x45'))){_0x190ec0[_0xc128('0x20')]=qs[_0xc128('0x20')](_0x37c914['query'][_0xc128('0x20')]);_0x190ec0[_0xc128('0x1d')]=qs[_0xc128('0x1d')](_0x37c914[_0xc128('0x3d')][_0xc128('0x1d')]);}_0x190ec0['order']=qs[_0xc128('0x47')](_0x37c914['query']['sort']);_0x190ec0['where']=qs[_0xc128('0x3f')](_[_0xc128('0x49')](_0x37c914[_0xc128('0x3d')],_0x59a145[_0xc128('0x3f')]));_0x190ec0['where'][_0xc128('0xac')]=_0x57e318['id'];if(_0x37c914[_0xc128('0x3d')][_0xc128('0x84')]){_0x190ec0['where']=_[_0xc128('0x9a')](_0x190ec0[_0xc128('0x48')],{'$or':_[_0xc128('0x2b')](_0x190ec0[_0xc128('0x41')],function(_0x328c05){var _0x43babe={};_0x43babe[_0x328c05]={'$like':'%'+_0x37c914[_0xc128('0x3d')]['filter']+'%'};return _0x43babe;})});}if(_0x37c914[_0xc128('0x3d')][_0xc128('0xb9')]){var _0x62e09=_0x37c914['query'][_0xc128('0xb9')][_0xc128('0x2e')](',');var _0x5ece94={};_0x5ece94[_0x62e09[0x0]]={'$gte':moment(_0x62e09[0x1])[_0xc128('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x190ec0['where']=_['merge'](_0x190ec0[_0xc128('0x48')],_0x5ece94);}_0x190ec0=_[_0xc128('0x9a')]({},_0x190ec0,_0x37c914[_0xc128('0xb0')]);return db[_0xc128('0xb8')]['count']({'where':_0x190ec0[_0xc128('0x48')]})[_0xc128('0x23')](function(_0x54a948){_0x171eec['count']=_0x54a948;if(_0x37c914[_0xc128('0x3d')][_0xc128('0xbb')]){_0x190ec0[_0xc128('0xaf')]=[{'all':!![]}];}return db[_0xc128('0xb8')][_0xc128('0xbc')](_0x190ec0);})['then'](function(_0x16f243){_0x171eec[_0xc128('0xbd')]=_0x16f243;return _0x171eec;});}})['then'](respondWithFilteredResult(_0xc4f50f,_0x190ec0))[_0xc128('0x32')](handleError(_0xc4f50f,null));};exports[_0xc128('0xbe')]=function(_0x5e4046,_0x28868a,_0x295a91){return db[_0xc128('0x3a')][_0xc128('0x5f')]({'where':{'id':_0x5e4046[_0xc128('0xae')]['id']}})[_0xc128('0x23')](handleEntityNotFound(_0x28868a,null))[_0xc128('0x23')](function(_0x425fa1){if(_0x425fa1){return _0x425fa1[_0xc128('0xbf')](_0x5e4046[_0xc128('0xb2')]['ids'],_[_0xc128('0xb6')](_0x5e4046[_0xc128('0xb2')],[_0xc128('0xb5'),'id'])||{})[_0xc128('0xc0')](function(){return db['Tag'][_0xc128('0xbc')]({'attributes':['id',_0xc128('0x29'),_0xc128('0xc1')],'where':{'id':_0x5e4046[_0xc128('0xb2')][_0xc128('0xb5')]}});})[_0xc128('0x23')](function(_0x12850b){socket[_0xc128('0xc2')](_0xc128('0xc3'),{'id':Number(_0x5e4046[_0xc128('0xae')]['id']),'tags':_0x12850b||[]});return{'id':Number(_0x5e4046[_0xc128('0xae')]['id']),'tags':_0x12850b||[]};});}})[_0xc128('0x23')](respondWithResult(_0x28868a,null))['catch'](handleError(_0x28868a,null));};exports[_0xc128('0xc4')]=function(_0x13f898,_0xecdc11,_0x417678){return db[_0xc128('0x3a')]['find']({'where':{'id':_0x13f898[_0xc128('0xae')]['id']}})['then'](handleEntityNotFound(_0xecdc11,null))[_0xc128('0x23')](function(_0x398cf2){if(_0x398cf2){return _0x398cf2[_0xc128('0xc4')](_0x13f898['query']['ids']);}})[_0xc128('0x23')](respondWithStatusCode(_0xecdc11,null))[_0xc128('0x32')](handleError(_0xecdc11,null));};exports[_0xc128('0xc5')]=function(_0x225ead,_0x450c47){var _0x420525=moment()[_0xc128('0xc6')]()[_0xc128('0x99')]();var _0x26c1e4=path[_0xc128('0xc7')](config['root'],_0xc128('0xc8'),_0xc128('0xc9'),'tmp');var _0x57078e=path[_0xc128('0xc7')](config[_0xc128('0xca')],_0xc128('0xc8'),_0xc128('0xc9'),_0xc128('0xcb'));var _0x196e58=path['join'](_0x26c1e4,_0x420525);var _0x39c327=util[_0xc128('0xba')](_0xc128('0xcc'),_0x225ead['params']['id'],_0x420525);var _0x5f291e=path[_0xc128('0xc7')](_0x26c1e4,_0x39c327);var _0x5bc4c8=[];_0x5bc4c8[_0xc128('0x31')]({'model':db[_0xc128('0x6d')],'as':'User','attributes':['id',_0xc128('0x2c')],'raw':!![]});_0x5bc4c8[_0xc128('0x31')]({'model':db[_0xc128('0xcd')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x225ead[_0xc128('0x3d')]['attachments']){_0x5bc4c8['push']({'model':db[_0xc128('0xce')],'as':_0xc128('0xce'),'raw':!![]});}var _0x3582a4=[{'model':db[_0xc128('0xb8')],'as':_0xc128('0xcf'),'attributes':['id',_0xc128('0xb2'),_0xc128('0x78'),_0xc128('0xd0'),'secret',_0xc128('0x7f')],'include':_0x5bc4c8}];_0x3582a4[_0xc128('0x31')]({'model':db['OpenchannelAccount'],'as':_0xc128('0xd1'),'attributes':['id',_0xc128('0x29')]});_0x3582a4['push']({'model':db[_0xc128('0x6d')],'as':_0xc128('0xd2'),'attributes':['id',_0xc128('0x2c')]});return db[_0xc128('0x3a')][_0xc128('0x5f')]({'where':{'id':_0x225ead[_0xc128('0xae')]['id']},'include':_0x3582a4})[_0xc128('0x23')](handleEntityNotFound(_0x450c47,null))[_0xc128('0x23')](function(_0x2c5765){if(_0x2c5765){var _0x3edb0e=_0x2c5765[_0xc128('0xd3')]({'plain':!![]});fs[_0xc128('0xd4')](_0x196e58);var _0x14fd3e={'channel':_0xc128('0xd5'),'account':_0x3edb0e[_0xc128('0xd1')][_0xc128('0x29')],'agent':_0x3edb0e[_0xc128('0xd2')]?_0x3edb0e[_0xc128('0xd2')][_0xc128('0x2c')]:_0xc128('0xd6'),'createdAt':moment(_0x3edb0e[_0xc128('0x78')])[_0xc128('0xba')](_0xc128('0xd7'))[_0xc128('0x99')](),'closedAt':_0x3edb0e[_0xc128('0x37')]?moment(_0x3edb0e['closedAt'])[_0xc128('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc128('0x99')]():'','disposition':_0x3edb0e[_0xc128('0xd8')],'visibility':_0x3edb0e['threadId']?'Public':_0xc128('0xd9'),'messages':_(_0x3edb0e['Messages'])[_0xc128('0x84')]({'secret':![]})[_0xc128('0x2b')](function(_0x3a60be){if(_0x3a60be[_0xc128('0xce')]){var _0x147c3f=path[_0xc128('0xc7')](_0x57078e,_0x3a60be[_0xc128('0xce')][_0xc128('0xda')]);if(fs[_0xc128('0xdb')](_0x147c3f)){fs['createReadStream'](_0x147c3f)['pipe'](fs[_0xc128('0xdc')](path['join'](_0x196e58,_0x3a60be[_0xc128('0xce')][_0xc128('0xda')])));}}return{'date':moment(_0x3a60be[_0xc128('0x78')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc128('0x99')](),'sender':_0x3a60be['direction']===_0xc128('0xdd')?_0x3a60be['User']?_0x3a60be[_0xc128('0x6d')]['fullname']:'System':_0x3a60be[_0xc128('0xde')][_0xc128('0xdf')]+(_0x3a60be[_0xc128('0xde')]['lastName']?'\x20'+_0x3a60be['Contact'][_0xc128('0xe0')]:''),'body':_0x3a60be[_0xc128('0xce')]?_0x3a60be[_0xc128('0xce')][_0xc128('0xda')]:_0x3a60be[_0xc128('0xb2')],'direction':_0x3a60be['direction']===_0xc128('0xdd')?'A':'C','secret':_0x3a60be[_0xc128('0xe1')],'read':_0x3a60be[_0xc128('0x7f')],'attachment':_0x3a60be[_0xc128('0xce')]};})[_0xc128('0x61')]()};return ejs[_0xc128('0xe2')](path[_0xc128('0xc7')](config[_0xc128('0xca')],_0xc128('0xc8'),_0xc128('0xe3'),_0xc128('0xe4')),{'interaction':_0x14fd3e})[_0xc128('0x23')](function(_0x54392c){var _0x5b4d3d=path[_0xc128('0xc7')](_0x196e58,_0xc128('0xe5')+_0x3edb0e['id']+'-'+_0x420525+_0xc128('0xe6'));var _0x2d74fc={'path':_0x5b4d3d,'channel':_0xc128('0xd5'),'interactionId':_0x3edb0e['id']};return pdf[_0xc128('0xe7')](_0x54392c,_0x2d74fc);})[_0xc128('0x23')](function(){return new BPromise(function(_0x53b14e,_0x18e396){zipdir(_0x196e58,{'saveTo':_0x5f291e},function(_0x31e546,_0xcf928){if(_0x31e546)return _0x18e396(_0x31e546);return _0x53b14e(_0xcf928);});})[_0xc128('0x23')](function(){return new BPromise(function(_0x516652,_0x5bc858){rimraf(_0x196e58,function(_0x32181f){if(_0x32181f)_0x5bc858(_0x32181f);return _0x516652();});});})[_0xc128('0x23')](function(){return _0x450c47[_0xc128('0xc5')](_0x5f291e,_0x39c327,function(_0xa2bf81){if(_0xa2bf81){console[_0xc128('0xe8')](_0xc128('0xe9'),_0xa2bf81);}else{fs[_0xc128('0xea')](_0x5f291e);}});});});}else{return _0x450c47['sendStatus'](0xc8);}})[_0xc128('0x32')](handleError(_0x450c47,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 52cf107..6dc0031 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 _0xa366=['Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','remove','getUsers','setDataValue'];(function(_0x38bf53,_0x3e065a){var _0x5cfc5a=function(_0x26fd19){while(--_0x26fd19){_0x38bf53['push'](_0x38bf53['shift']());}};_0x5cfc5a(++_0x3e065a);}(_0xa366,0x1ac));var _0x6a36=function(_0x157d45,_0x1ee465){_0x157d45=_0x157d45-0x0;var _0x1222b1=_0xa366[_0x157d45];return _0x1222b1;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x6a36('0x0'))['db'][_0x6a36('0x1')];var OpenchannelMessage=require(_0x6a36('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6a36('0x2')](0x0);var events={'afterCreate':_0x6a36('0x3'),'afterUpdate':'update','afterDestroy':_0x6a36('0x4')};function emitEvent(_0x2374a0){return function(_0x407228,_0x168be0,_0x42d513){_0x407228[_0x6a36('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x48a2bb){_0x407228[_0x6a36('0x6')](_0x6a36('0x7'),_0x48a2bb[_0x6a36('0x8')](function(_0x45aed1){return{'id':_0x45aed1['id']};}));return OpenchannelMessage[_0x6a36('0x9')]({'where':{'OpenchannelInteractionId':_0x407228['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x42b139){_0x407228[_0x6a36('0x6')](_0x6a36('0xa'),_0x42b139['length']);OpenchannelInteractionEvents[_0x6a36('0xb')](_0x2374a0+':'+_0x407228['id'],_0x407228);OpenchannelInteractionEvents[_0x6a36('0xb')](_0x2374a0,_0x407228);_0x42d513(null);})['catch'](_0x42d513(null));};}for(var e in events){if(events[_0x6a36('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x6a36('0xd')](e,emitEvent(event));}}module[_0x6a36('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x42d2=['remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','save','update'];(function(_0x5e13af,_0x5461e0){var _0x3dbfa0=function(_0x44c302){while(--_0x44c302){_0x5e13af['push'](_0x5e13af['shift']());}};_0x3dbfa0(++_0x5461e0);}(_0x42d2,0x127));var _0x242d=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x42d2[_0x37e886];return _0x57c5cd;};'use strict';var EventEmitter=require(_0x242d('0x0'));var OpenchannelInteraction=require(_0x242d('0x1'))['db'][_0x242d('0x2')];var OpenchannelMessage=require(_0x242d('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x242d('0x3'),'afterUpdate':_0x242d('0x4'),'afterDestroy':_0x242d('0x5')};function emitEvent(_0xfe48ec){return function(_0xa34219,_0x15a96a,_0xec039f){_0xa34219[_0x242d('0x6')]({'attributes':['id'],'raw':!![]})[_0x242d('0x7')](function(_0x538464){_0xa34219[_0x242d('0x8')]('Users',_0x538464['map'](function(_0x1b6eb2){return{'id':_0x1b6eb2['id']};}));return OpenchannelMessage[_0x242d('0x9')]({'where':{'OpenchannelInteractionId':_0xa34219['id'],'direction':'in','read':![]},'raw':!![]});})[_0x242d('0x7')](function(_0x4e6848){_0xa34219['setDataValue'](_0x242d('0xa'),_0x4e6848[_0x242d('0xb')]);OpenchannelInteractionEvents[_0x242d('0xc')](_0xfe48ec+':'+_0xa34219['id'],_0xa34219);OpenchannelInteractionEvents['emit'](_0xfe48ec,_0xa34219);_0xec039f(null);})[_0x242d('0xd')](_0xec039f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x242d('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 10ad953..e7387d0 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 _0x341c=['moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x341c,0x137));var _0xc341=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0x341c[_0x4fa489];return _0x41d2ce;};'use strict';var _=require(_0xc341('0x0'));var util=require(_0xc341('0x1'));var logger=require(_0xc341('0x2'))(_0xc341('0x3'));var moment=require(_0xc341('0x4'));var BPromise=require(_0xc341('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc341('0x6'));var rimraf=require(_0xc341('0x7'));var config=require(_0xc341('0x8'));var attributes=require(_0xc341('0x9'));module[_0xc341('0xa')]=function(_0x53b8dd,_0x4052dd){return _0x53b8dd[_0xc341('0xb')](_0xc341('0xc'),attributes,{'tableName':_0xc341('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc341('0xe'),'collate':_0xc341('0xf'),'hooks':{'beforeUpdate':function(_0x2314e9,_0x163d19,_0x3addfe){if(_0x2314e9[_0xc341('0x10')](_0xc341('0x11'))){_0x2314e9[_0xc341('0x12')]=moment()[_0xc341('0x13')](_0xc341('0x14'));}_0x3addfe(null,_0x2314e9);}}});}; \ No newline at end of file +var _0xbb79=['moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','lodash','util','../../config/logger','api'];(function(_0x3652b4,_0x3072b3){var _0x492b4=function(_0x2eebaa){while(--_0x2eebaa){_0x3652b4['push'](_0x3652b4['shift']());}};_0x492b4(++_0x3072b3);}(_0xbb79,0x164));var _0x9bb7=function(_0x23d41a,_0xd839a5){_0x23d41a=_0x23d41a-0x0;var _0x395d4c=_0xbb79[_0x23d41a];return _0x395d4c;};'use strict';var _=require(_0x9bb7('0x0'));var util=require(_0x9bb7('0x1'));var logger=require(_0x9bb7('0x2'))(_0x9bb7('0x3'));var moment=require(_0x9bb7('0x4'));var BPromise=require(_0x9bb7('0x5'));var rp=require(_0x9bb7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bb7('0x7'));var config=require(_0x9bb7('0x8'));var attributes=require(_0x9bb7('0x9'));module[_0x9bb7('0xa')]=function(_0x4149a7,_0x27191f){return _0x4149a7[_0x9bb7('0xb')](_0x9bb7('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bb7('0xd'),'collate':_0x9bb7('0xe'),'hooks':{'beforeUpdate':function(_0x829db9,_0x35d99d,_0x24b595){if(_0x829db9[_0x9bb7('0xf')](_0x9bb7('0x10'))){_0x829db9['closedAt']=moment()[_0x9bb7('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x24b595(null,_0x829db9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 370e933..ba87b66 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 _0xeac1=['addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','find','where'];(function(_0x351249,_0x552ec9){var _0x4594b8=function(_0x296861){while(--_0x296861){_0x351249['push'](_0x351249['shift']());}};_0x4594b8(++_0x552ec9);}(_0xeac1,0xee));var _0x1eac=function(_0x24c869,_0x4e7299){_0x24c869=_0x24c869-0x0;var _0x2eb7ce=_0xeac1[_0x24c869];return _0x2eb7ce;};'use strict';var _=require('lodash');var util=require(_0x1eac('0x0'));var moment=require(_0x1eac('0x1'));var BPromise=require(_0x1eac('0x2'));var rs=require(_0x1eac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1eac('0x4'))(_0x1eac('0x5'));var config=require('../../config/environment');var jayson=require(_0x1eac('0x6'));var client=jayson[_0x1eac('0x7')][_0x1eac('0x8')]({'port':0x232a});config[_0x1eac('0x9')]=_['defaults'](config[_0x1eac('0x9')],{'host':_0x1eac('0xa'),'port':0x18eb});var socket=require(_0x1eac('0xb'))(new Redis(config[_0x1eac('0x9')]));require(_0x1eac('0xc'))[_0x1eac('0xd')](socket);function respondWithRpcPromise(_0x274f9a,_0x4bb425,_0x308aa6){return new BPromise(function(_0x1beed1,_0x4c2fb9){return client['request'](_0x274f9a,_0x308aa6)[_0x1eac('0xe')](function(_0x32eb83){logger[_0x1eac('0xf')](_0x1eac('0x10'),_0x4bb425,'request\x20sent');logger[_0x1eac('0x11')](_0x1eac('0x12'),_0x4bb425,_0x1eac('0x13'),JSON[_0x1eac('0x14')](_0x32eb83));if(_0x32eb83[_0x1eac('0x15')]){if(_0x32eb83[_0x1eac('0x15')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4bb425,_0x32eb83[_0x1eac('0x15')][_0x1eac('0x16')]);return _0x4c2fb9(_0x32eb83['error'][_0x1eac('0x16')]);}logger[_0x1eac('0x15')](_0x1eac('0x10'),_0x4bb425,_0x32eb83[_0x1eac('0x15')][_0x1eac('0x16')]);return _0x1beed1(_0x32eb83[_0x1eac('0x15')]['message']);}else{logger[_0x1eac('0xf')](_0x1eac('0x10'),_0x4bb425,_0x1eac('0x13'));_0x1beed1(_0x32eb83[_0x1eac('0x17')]['message']);}})[_0x1eac('0x18')](function(_0x17ac83){logger[_0x1eac('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4bb425,_0x17ac83);_0x4c2fb9(_0x17ac83);});});}exports[_0x1eac('0x19')]=function(_0x88af65){var _0x148644=this;return new Promise(function(_0x55d9c0,_0x322139){return db[_0x1eac('0x1a')][_0x1eac('0x1b')](_0x88af65[_0x1eac('0x1c')],{'raw':_0x88af65[_0x1eac('0x1d')]?_0x88af65[_0x1eac('0x1d')][_0x1eac('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x88af65[_0x1eac('0x1d')]?_0x88af65[_0x1eac('0x1d')]['where']||null:null,'attributes':_0x88af65['options']?_0x88af65['options'][_0x1eac('0x1f')]||null:null,'limit':_0x88af65[_0x1eac('0x1d')]?_0x88af65[_0x1eac('0x1d')][_0x1eac('0x20')]||null:null})[_0x1eac('0xe')](function(_0x89fc6a){logger[_0x1eac('0xf')](_0x1eac('0x19'),_0x88af65);logger[_0x1eac('0x11')](_0x1eac('0x19'),_0x88af65,JSON[_0x1eac('0x14')](_0x89fc6a));_0x55d9c0(_0x89fc6a);})[_0x1eac('0x18')](function(_0x50035f){logger[_0x1eac('0x15')](_0x1eac('0x19'),_0x50035f[_0x1eac('0x16')],_0x88af65);_0x322139(_0x148644['error'](0x1f4,_0x50035f[_0x1eac('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x3c89f9){return new Promise(function(_0x257f87,_0x1fcb47){return db[_0x1eac('0x1a')][_0x1eac('0x21')]({'where':_0x3c89f9[_0x1eac('0x1d')]?_0x3c89f9[_0x1eac('0x1d')][_0x1eac('0x22')]||null:null})[_0x1eac('0xe')](function(_0x4a1c54){if(_0x4a1c54){return _0x4a1c54[_0x1eac('0x23')](_0x3c89f9[_0x1eac('0x1c')][_0x1eac('0x24')],_[_0x1eac('0x25')](_0x3c89f9[_0x1eac('0x1c')],[_0x1eac('0x24'),'id'])||{});}})['spread'](function(_0x315542){logger[_0x1eac('0xf')](_0x1eac('0x26'),_0x3c89f9);logger['debug'](_0x1eac('0x26'),_0x3c89f9,JSON[_0x1eac('0x14')](_0x315542));_0x257f87(_0x315542);})[_0x1eac('0x18')](function(_0x1d7a35){logger[_0x1eac('0x15')]('AddTags',_0x1d7a35[_0x1eac('0x16')],_0x3c89f9);_0x1fcb47(_this[_0x1eac('0x15')](0x1f4,_0x1d7a35[_0x1eac('0x16')]));});});}; \ No newline at end of file +var _0x1078=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','body','ids','spread','AddTags'];(function(_0x4812c5,_0x41efc0){var _0x96646=function(_0x4351d4){while(--_0x4351d4){_0x4812c5['push'](_0x4812c5['shift']());}};_0x96646(++_0x41efc0);}(_0x1078,0x102));var _0x8107=function(_0x5b6aba,_0x46841d){_0x5b6aba=_0x5b6aba-0x0;var _0x1466f8=_0x1078[_0x5b6aba];return _0x1466f8;};'use strict';var _=require(_0x8107('0x0'));var util=require('util');var moment=require(_0x8107('0x1'));var BPromise=require(_0x8107('0x2'));var rs=require(_0x8107('0x3'));var fs=require('fs');var Redis=require(_0x8107('0x4'));var db=require(_0x8107('0x5'))['db'];var utils=require(_0x8107('0x6'));var logger=require(_0x8107('0x7'))(_0x8107('0x8'));var config=require('../../config/environment');var jayson=require(_0x8107('0x9'));var client=jayson[_0x8107('0xa')][_0x8107('0xb')]({'port':0x232a});config['redis']=_[_0x8107('0xc')](config[_0x8107('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8107('0xd')]));require(_0x8107('0xe'))[_0x8107('0xf')](socket);function respondWithRpcPromise(_0x2897ed,_0x3f38f0,_0x896009){return new BPromise(function(_0x5bcc5b,_0x3e62de){return client[_0x8107('0x10')](_0x2897ed,_0x896009)[_0x8107('0x11')](function(_0x51bb4e){logger['info'](_0x8107('0x12'),_0x3f38f0,_0x8107('0x13'));logger[_0x8107('0x14')](_0x8107('0x15'),_0x3f38f0,_0x8107('0x13'),JSON['stringify'](_0x51bb4e));if(_0x51bb4e[_0x8107('0x16')]){if(_0x51bb4e[_0x8107('0x16')][_0x8107('0x17')]===0x1f4){logger[_0x8107('0x16')](_0x8107('0x12'),_0x3f38f0,_0x51bb4e[_0x8107('0x16')][_0x8107('0x18')]);return _0x3e62de(_0x51bb4e[_0x8107('0x16')][_0x8107('0x18')]);}logger[_0x8107('0x16')](_0x8107('0x12'),_0x3f38f0,_0x51bb4e[_0x8107('0x16')][_0x8107('0x18')]);return _0x5bcc5b(_0x51bb4e[_0x8107('0x16')][_0x8107('0x18')]);}else{logger[_0x8107('0x19')](_0x8107('0x12'),_0x3f38f0,_0x8107('0x13'));_0x5bcc5b(_0x51bb4e['result'][_0x8107('0x18')]);}})[_0x8107('0x1a')](function(_0x576615){logger[_0x8107('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3f38f0,_0x576615);_0x3e62de(_0x576615);});});}exports[_0x8107('0x1b')]=function(_0x5562c2){var _0xd599e6=this;return new Promise(function(_0x4f0ffc,_0x4f490c){return db[_0x8107('0x1c')][_0x8107('0x1d')](_0x5562c2['body'],{'raw':_0x5562c2[_0x8107('0x1e')]?_0x5562c2[_0x8107('0x1e')][_0x8107('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5562c2['options']?_0x5562c2['options'][_0x8107('0x20')]||null:null,'attributes':_0x5562c2[_0x8107('0x1e')]?_0x5562c2[_0x8107('0x1e')][_0x8107('0x21')]||null:null,'limit':_0x5562c2[_0x8107('0x1e')]?_0x5562c2[_0x8107('0x1e')][_0x8107('0x22')]||null:null})[_0x8107('0x11')](function(_0x58d350){logger['info'](_0x8107('0x1b'),_0x5562c2);logger[_0x8107('0x14')](_0x8107('0x1b'),_0x5562c2,JSON[_0x8107('0x23')](_0x58d350));_0x4f0ffc(_0x58d350);})[_0x8107('0x1a')](function(_0x40d608){logger[_0x8107('0x16')](_0x8107('0x1b'),_0x40d608['message'],_0x5562c2);_0x4f490c(_0xd599e6[_0x8107('0x16')](0x1f4,_0x40d608['message']));});});};exports[_0x8107('0x24')]=function(_0x147335){return new Promise(function(_0x589120,_0x34b352){return db[_0x8107('0x1c')][_0x8107('0x25')]({'where':_0x147335[_0x8107('0x1e')]?_0x147335[_0x8107('0x1e')][_0x8107('0x20')]||null:null})['then'](function(_0x5ab8d0){if(_0x5ab8d0){return _0x5ab8d0[_0x8107('0x26')](_0x147335[_0x8107('0x27')][_0x8107('0x28')],_['omit'](_0x147335[_0x8107('0x27')],['ids','id'])||{});}})[_0x8107('0x29')](function(_0x56a1ac){logger[_0x8107('0x19')]('AddTags',_0x147335);logger[_0x8107('0x14')](_0x8107('0x2a'),_0x147335,JSON[_0x8107('0x23')](_0x56a1ac));_0x589120(_0x56a1ac);})[_0x8107('0x1a')](function(_0x101aac){logger[_0x8107('0x16')]('AddTags',_0x101aac[_0x8107('0x18')],_0x147335);_0x34b352(_this['error'](0x1f4,_0x101aac[_0x8107('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6cd2989..6920b61 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 _0x5718=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5718,0xda));var _0x8571=function(_0x5e3bda,_0x49d767){_0x5e3bda=_0x5e3bda-0x0;var _0x26ae30=_0x5718[_0x5e3bda];return _0x26ae30;};'use strict';var OpenchannelInteractionEvents=require(_0x8571('0x0'));var events=[_0x8571('0x1'),_0x8571('0x2'),_0x8571('0x3')];function createListener(_0x246072,_0x2f30ca){return function(_0x5cb672){_0x2f30ca[_0x8571('0x4')](_0x246072,_0x5cb672);};}function removeListener(_0x247413,_0x599fdf){return function(){OpenchannelInteractionEvents[_0x8571('0x5')](_0x247413,_0x599fdf);};}exports['register']=function(_0x454797){for(var _0x586eae=0x0,_0x2cc9fc=events[_0x8571('0x6')];_0x586eae<_0x2cc9fc;_0x586eae++){var _0x19fd6d=events[_0x586eae];var _0x1b433f=createListener(_0x8571('0x7')+_0x19fd6d,_0x454797);OpenchannelInteractionEvents['on'](_0x19fd6d,_0x1b433f);}}; \ No newline at end of file +var _0x2075=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x2075,0x18f));var _0x5207=function(_0x112db5,_0x38a06d){_0x112db5=_0x112db5-0x0;var _0x1d7d06=_0x2075[_0x112db5];return _0x1d7d06;};'use strict';var OpenchannelInteractionEvents=require(_0x5207('0x0'));var events=[_0x5207('0x1'),_0x5207('0x2'),_0x5207('0x3')];function createListener(_0x6ca449,_0x37ce56){return function(_0x2211f9){_0x37ce56[_0x5207('0x4')](_0x6ca449,_0x2211f9);};}function removeListener(_0x362dcf,_0x3e8760){return function(){OpenchannelInteractionEvents[_0x5207('0x5')](_0x362dcf,_0x3e8760);};}exports[_0x5207('0x6')]=function(_0x3f98c1){for(var _0x2af0dd=0x0,_0x10f8be=events[_0x5207('0x7')];_0x2af0dd<_0x10f8be;_0x2af0dd++){var _0x2ee163=events[_0x2af0dd];var _0x39b3b7=createListener(_0x5207('0x8')+_0x2ee163,_0x3f98c1);OpenchannelInteractionEvents['on'](_0x2ee163,_0x39b3b7);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 89e3c0e..13427ed 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x129e6e,_0x42d711){var _0x189707=function(_0xd9d0fe){while(--_0xd9d0fe){_0x129e6e['push'](_0x129e6e['shift']());}};_0x189707(++_0x42d711);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0xe377d2,_0x3c9e76){var _0x3d3fab=function(_0x5c829f){while(--_0x5c829f){_0xe377d2['push'](_0xe377d2['shift']());}};_0x3d3fab(++_0x3c9e76);}(_0xedd9,0xfc));var _0x9edd=function(_0x8c82f2,_0x23b221){_0x8c82f2=_0x8c82f2-0x0;var _0x1bee45=_0xedd9[_0x8c82f2];return _0x1bee45;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 54c0e3f..3e4cf42 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 _0x9158=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0x9158,0x16e));var _0x8915=function(_0x317fb2,_0x4c8ddc){_0x317fb2=_0x317fb2-0x0;var _0x59ad2b=_0x9158[_0x317fb2];return _0x59ad2b;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'body':{'type':Sequelize[_0x8915('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8915('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8915('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8915('0x5')]},'providerName':{'type':Sequelize[_0x8915('0x6')]},'providerResponse':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file +var _0x3306=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x3cec8c,_0x3f6c1d){var _0x38032e=function(_0x4ef75b){while(--_0x4ef75b){_0x3cec8c['push'](_0x3cec8c['shift']());}};_0x38032e(++_0x3f6c1d);}(_0x3306,0x107));var _0x6330=function(_0x2a152f,_0x136e73){_0x2a152f=_0x2a152f-0x0;var _0x119d57=_0x3306[_0x2a152f];return _0x119d57;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'body':{'type':Sequelize[_0x6330('0x2')](_0x6330('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6330('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6330('0x5')]('in',_0x6330('0x6')),'defaultValue':_0x6330('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6330('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6aa3d67..a771b6e 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 _0xd8a3=['catch','show','params','intersection','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','../../config/logger','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','stack','name','send','index','map','OpenchannelMessage','rawAttributes','key','query','keys','filters','model','fields','attributes','length','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows'];(function(_0x5a9141,_0x2ccd7f){var _0x1a18a8=function(_0x3c3815){while(--_0x3c3815){_0x5a9141['push'](_0x5a9141['shift']());}};_0x1a18a8(++_0x2ccd7f);}(_0xd8a3,0xb2));var _0x3d8a=function(_0x4c2c64,_0x19c31a){_0x4c2c64=_0x4c2c64-0x0;var _0x43dd8e=_0xd8a3[_0x4c2c64];return _0x43dd8e;};'use strict';var emlformat=require(_0x3d8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d8a('0x1'));var jsonpatch=require(_0x3d8a('0x2'));var rp=require(_0x3d8a('0x3'));var moment=require(_0x3d8a('0x4'));var BPromise=require(_0x3d8a('0x5'));var Mustache=require(_0x3d8a('0x6'));var util=require(_0x3d8a('0x7'));var path=require('path');var sox=require(_0x3d8a('0x8'));var csv=require(_0x3d8a('0x9'));var ejs=require(_0x3d8a('0xa'));var fs=require('fs');var fs_extra=require(_0x3d8a('0xb'));var _=require(_0x3d8a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d8a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d8a('0x9'));var querystring=require(_0x3d8a('0xe'));var Papa=require('papaparse');var Redis=require(_0x3d8a('0xf'));var authService=require(_0x3d8a('0x10'));var qs=require(_0x3d8a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d8a('0x12'));var utils=require(_0x3d8a('0x13'));var config=require(_0x3d8a('0x14'));var licenseUtil=require(_0x3d8a('0x15'));var db=require(_0x3d8a('0x16'))['db'];config[_0x3d8a('0x17')]=_[_0x3d8a('0x18')](config[_0x3d8a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d8a('0x19'))(new Redis(config[_0x3d8a('0x17')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x3d8a('0x1a'));var client=jayson[_0x3d8a('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x3d8a('0x1b')][_0x3d8a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x355fa3,_0x51ec56,_0xeabf16,_0x463e62){return new BPromise(function(_0x1f4902,_0x3c0ccd){var _0x14bd3c=_0x463e62||client;return _0x14bd3c[_0x3d8a('0x1d')](_0x355fa3,_0xeabf16)[_0x3d8a('0x1e')](function(_0x46d8c4){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x51ec56,_0x3d8a('0x1f'));logger[_0x3d8a('0x20')](_0x3d8a('0x21'),_0x51ec56,_0x3d8a('0x1f'),JSON[_0x3d8a('0x22')](_0x46d8c4));if(_0x46d8c4[_0x3d8a('0x23')]){if(_0x46d8c4['error'][_0x3d8a('0x24')]===0x1f4){logger[_0x3d8a('0x23')](_0x3d8a('0x25'),_0x51ec56,_0x46d8c4[_0x3d8a('0x23')][_0x3d8a('0x26')]);return _0x3c0ccd(_0x46d8c4['error'][_0x3d8a('0x26')]);}logger[_0x3d8a('0x23')](_0x3d8a('0x25'),_0x51ec56,_0x46d8c4[_0x3d8a('0x23')][_0x3d8a('0x26')]);return _0x1f4902(_0x46d8c4['error'][_0x3d8a('0x26')]);}else{logger[_0x3d8a('0x27')](_0x3d8a('0x25'),_0x51ec56,_0x3d8a('0x1f'));_0x1f4902(_0x46d8c4[_0x3d8a('0x28')]['message']);}})['catch'](function(_0x1dd815){logger[_0x3d8a('0x23')](_0x3d8a('0x25'),_0x51ec56,_0x1dd815);_0x3c0ccd(_0x1dd815);});});}function respondWithStatusCode(_0x2fff77,_0x33f9b0){_0x33f9b0=_0x33f9b0||0xcc;return function(_0xd6a9ef){if(_0xd6a9ef){return _0x2fff77[_0x3d8a('0x29')](_0x33f9b0);}return _0x2fff77[_0x3d8a('0x2a')](_0x33f9b0)['end']();};}function respondWithResult(_0x5e600e,_0x325452){_0x325452=_0x325452||0xc8;return function(_0x3c5cf3){if(_0x3c5cf3){return _0x5e600e[_0x3d8a('0x2a')](_0x325452)['json'](_0x3c5cf3);}};}function respondWithFilteredResult(_0x1063c2,_0x289aa4){return function(_0x9ec154){if(_0x9ec154){var _0x3c1410=typeof _0x289aa4[_0x3d8a('0x2b')]==='undefined'&&typeof _0x289aa4[_0x3d8a('0x2c')]===_0x3d8a('0x2d');var _0x3274d0=_0x9ec154[_0x3d8a('0x2e')];var _0x32395c=_0x3c1410?0x0:_0x289aa4['offset'];var _0x2359bc=_0x3c1410?_0x9ec154[_0x3d8a('0x2e')]:_0x289aa4[_0x3d8a('0x2b')]+_0x289aa4[_0x3d8a('0x2c')];var _0x231b3d;if(_0x2359bc>=_0x3274d0){_0x2359bc=_0x3274d0;_0x231b3d=0xc8;}else{_0x231b3d=0xce;}_0x1063c2['status'](_0x231b3d);return _0x1063c2[_0x3d8a('0x2f')](_0x3d8a('0x30'),_0x32395c+'-'+_0x2359bc+'/'+_0x3274d0)[_0x3d8a('0x31')](_0x9ec154);}return null;};}function patchUpdates(_0x2b156a){return function(_0x57a0a7){try{jsonpatch['apply'](_0x57a0a7,_0x2b156a,!![]);}catch(_0x1bb966){return BPromise[_0x3d8a('0x32')](_0x1bb966);}return _0x57a0a7[_0x3d8a('0x33')]();};}function saveUpdates(_0x22c48b,_0x28af26){return function(_0x325fee){if(_0x325fee){return _0x325fee[_0x3d8a('0x34')](_0x22c48b)['then'](function(_0x31ea51){return _0x31ea51;});}return null;};}function removeEntity(_0x52712b,_0x2a43b2){return function(_0x43052d){if(_0x43052d){return _0x43052d['destroy']()[_0x3d8a('0x1e')](function(){_0x52712b[_0x3d8a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57eede,_0x243e12){return function(_0x156617){if(!_0x156617){_0x57eede[_0x3d8a('0x29')](0x194);}return _0x156617;};}function handleError(_0x29d1b0,_0x1505f1){_0x1505f1=_0x1505f1||0x1f4;return function(_0x5efc55){logger[_0x3d8a('0x23')](_0x5efc55[_0x3d8a('0x35')]);if(_0x5efc55['name']){delete _0x5efc55[_0x3d8a('0x36')];}_0x29d1b0[_0x3d8a('0x2a')](_0x1505f1)[_0x3d8a('0x37')](_0x5efc55);};}exports[_0x3d8a('0x38')]=function(_0x5e6da1,_0x24a21b){var _0x5c2ad6={},_0x2a585f={},_0x593ee5={'count':0x0,'rows':[]};var _0x1388eb=_[_0x3d8a('0x39')](db[_0x3d8a('0x3a')][_0x3d8a('0x3b')],function(_0x2b3e15){return{'name':_0x2b3e15['fieldName'],'type':_0x2b3e15['type'][_0x3d8a('0x3c')]};});_0x2a585f['model']=_['map'](_0x1388eb,_0x3d8a('0x36'));_0x2a585f[_0x3d8a('0x3d')]=_[_0x3d8a('0x3e')](_0x5e6da1[_0x3d8a('0x3d')]);_0x2a585f[_0x3d8a('0x3f')]=_['intersection'](_0x2a585f[_0x3d8a('0x40')],_0x2a585f[_0x3d8a('0x3d')]);_0x5c2ad6['attributes']=_['intersection'](_0x2a585f[_0x3d8a('0x40')],qs[_0x3d8a('0x41')](_0x5e6da1['query'][_0x3d8a('0x41')]));_0x5c2ad6[_0x3d8a('0x42')]=_0x5c2ad6[_0x3d8a('0x42')][_0x3d8a('0x43')]?_0x5c2ad6[_0x3d8a('0x42')]:_0x2a585f['model'];if(!_0x5e6da1[_0x3d8a('0x3d')]['hasOwnProperty']('nolimit')){_0x5c2ad6[_0x3d8a('0x2c')]=qs[_0x3d8a('0x2c')](_0x5e6da1[_0x3d8a('0x3d')]['limit']);_0x5c2ad6[_0x3d8a('0x2b')]=qs[_0x3d8a('0x2b')](_0x5e6da1['query']['offset']);}_0x5c2ad6[_0x3d8a('0x44')]=qs[_0x3d8a('0x45')](_0x5e6da1[_0x3d8a('0x3d')]['sort']);_0x5c2ad6[_0x3d8a('0x46')]=qs[_0x3d8a('0x3f')](_[_0x3d8a('0x47')](_0x5e6da1[_0x3d8a('0x3d')],_0x2a585f[_0x3d8a('0x3f')]),_0x1388eb);if(_0x5e6da1[_0x3d8a('0x3d')][_0x3d8a('0x48')]){_0x5c2ad6[_0x3d8a('0x46')]=_[_0x3d8a('0x49')](_0x5c2ad6[_0x3d8a('0x46')],{'$or':_['map'](_0x1388eb,function(_0x1d46b6){if(_0x1d46b6[_0x3d8a('0x4a')]!=='VIRTUAL'){var _0x2fdfe9={};_0x2fdfe9[_0x1d46b6[_0x3d8a('0x36')]]={'$like':'%'+_0x5e6da1['query'][_0x3d8a('0x48')]+'%'};return _0x2fdfe9;}})});}_0x5c2ad6=_[_0x3d8a('0x49')]({},_0x5c2ad6,_0x5e6da1[_0x3d8a('0x4b')]);var _0x42f1e0={'where':_0x5c2ad6['where']};return db[_0x3d8a('0x3a')][_0x3d8a('0x2e')](_0x42f1e0)[_0x3d8a('0x1e')](function(_0x3a1379){_0x593ee5[_0x3d8a('0x2e')]=_0x3a1379;if(_0x5e6da1[_0x3d8a('0x3d')][_0x3d8a('0x4c')]){_0x5c2ad6[_0x3d8a('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3d8a('0x4e')](_0x5c2ad6);})['then'](function(_0x24c9a0){_0x593ee5[_0x3d8a('0x4f')]=_0x24c9a0;return _0x593ee5;})['then'](respondWithFilteredResult(_0x24a21b,_0x5c2ad6))[_0x3d8a('0x50')](handleError(_0x24a21b,null));};exports[_0x3d8a('0x51')]=function(_0x3a8bc9,_0x2ea72f){var _0x2bca88={'raw':!![],'where':{'id':_0x3a8bc9[_0x3d8a('0x52')]['id']}},_0x3876df={};_0x3876df[_0x3d8a('0x40')]=_[_0x3d8a('0x3e')](db[_0x3d8a('0x3a')][_0x3d8a('0x3b')]);_0x3876df['query']=_[_0x3d8a('0x3e')](_0x3a8bc9['query']);_0x3876df['filters']=_[_0x3d8a('0x53')](_0x3876df['model'],_0x3876df[_0x3d8a('0x3d')]);_0x2bca88['attributes']=_[_0x3d8a('0x53')](_0x3876df['model'],qs['fields'](_0x3a8bc9[_0x3d8a('0x3d')]['fields']));_0x2bca88[_0x3d8a('0x42')]=_0x2bca88[_0x3d8a('0x42')][_0x3d8a('0x43')]?_0x2bca88[_0x3d8a('0x42')]:_0x3876df['model'];if(_0x3a8bc9[_0x3d8a('0x3d')][_0x3d8a('0x4c')]){_0x2bca88[_0x3d8a('0x4d')]=[{'all':!![]}];}_0x2bca88=_[_0x3d8a('0x49')]({},_0x2bca88,_0x3a8bc9[_0x3d8a('0x4b')]);return db['OpenchannelMessage'][_0x3d8a('0x54')](_0x2bca88)['then'](handleEntityNotFound(_0x2ea72f,null))[_0x3d8a('0x1e')](respondWithResult(_0x2ea72f,null))[_0x3d8a('0x50')](handleError(_0x2ea72f,null));};exports['create']=function(_0x7b6e9d,_0x18d5fb){return db[_0x3d8a('0x3a')][_0x3d8a('0x55')](_0x7b6e9d[_0x3d8a('0x56')],{})['then'](respondWithResult(_0x18d5fb,0xc9))['catch'](handleError(_0x18d5fb,null));};exports[_0x3d8a('0x34')]=function(_0x124ef1,_0x1e2987){if(_0x124ef1[_0x3d8a('0x56')]['id']){delete _0x124ef1['body']['id'];}return db[_0x3d8a('0x3a')][_0x3d8a('0x54')]({'where':{'id':_0x124ef1[_0x3d8a('0x52')]['id']}})[_0x3d8a('0x1e')](handleEntityNotFound(_0x1e2987,null))[_0x3d8a('0x1e')](saveUpdates(_0x124ef1[_0x3d8a('0x56')],null))[_0x3d8a('0x1e')](respondWithResult(_0x1e2987,null))[_0x3d8a('0x50')](handleError(_0x1e2987,null));};exports['destroy']=function(_0x4c3bc4,_0x14d3b5){return db[_0x3d8a('0x3a')][_0x3d8a('0x54')]({'where':{'id':_0x4c3bc4['params']['id']}})['then'](handleEntityNotFound(_0x14d3b5,null))[_0x3d8a('0x1e')](removeEntity(_0x14d3b5,null))[_0x3d8a('0x50')](handleError(_0x14d3b5,null));};exports[_0x3d8a('0x57')]=function(_0x5e4206,_0x30affb){return db[_0x3d8a('0x3a')][_0x3d8a('0x57')]()['then'](respondWithResult(_0x30affb,null))['catch'](handleError(_0x30affb,null));};var interaction_log=require('../../config/logger')(_0x3d8a('0x58'));exports['accept']=function(_0x571b78,_0x5cbdb9,_0x37b715){var _0x189c70={'agent':{},'channel':_0x3d8a('0x59')};if(_0x571b78['body']['id']){delete _0x571b78['body']['id'];}_0x571b78[_0x3d8a('0x56')][_0x3d8a('0x5a')]=!![];_0x571b78[_0x3d8a('0x56')][_0x3d8a('0x5b')]=moment()[_0x3d8a('0x5c')](_0x3d8a('0x5d'));_0x571b78[_0x3d8a('0x56')]['UserId']=_0x571b78[_0x3d8a('0x56')][_0x3d8a('0x5e')]||_0x571b78[_0x3d8a('0x5f')]['id'];_0x189c70['agent']['id']=_0x571b78[_0x3d8a('0x56')][_0x3d8a('0x5e')];return db[_0x3d8a('0x3a')]['find']({'where':{'id':_0x571b78[_0x3d8a('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5cbdb9,null))['then'](saveUpdates(_0x571b78[_0x3d8a('0x56')],null))[_0x3d8a('0x1e')](function(_0xb24b60){if(_0xb24b60){_0x189c70[_0x3d8a('0x26')]=_0xb24b60[_0x3d8a('0x60')]({'plain':!![]});return db[_0x3d8a('0x61')][_0x3d8a('0x54')]({'where':{'id':_0xb24b60[_0x3d8a('0x62')]}});}return null;})[_0x3d8a('0x1e')](handleEntityNotFound(_0x5cbdb9,null))[_0x3d8a('0x1e')](function(_0x4b5aab){if(_0x4b5aab){return _0x4b5aab[_0x3d8a('0x34')]({'UserId':_0x571b78[_0x3d8a('0x56')][_0x3d8a('0x5e')],'read1stAt':_[_0x3d8a('0x63')](_0x4b5aab[_0x3d8a('0x64')])?moment()[_0x3d8a('0x5c')](_0x3d8a('0x5d')):undefined});}return null;})[_0x3d8a('0x1e')](function(_0xa3afe2){if(_0xa3afe2){_0x189c70[_0x3d8a('0x65')]=_0xa3afe2[_0x3d8a('0x60')]({'plain':!![]});interaction_log[_0x3d8a('0x27')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x571b78[_0x3d8a('0x5f')]['id'],_0x571b78[_0x3d8a('0x5f')][_0x3d8a('0x36')],_0x571b78[_0x3d8a('0x5f')][_0x3d8a('0x66')],_0x189c70[_0x3d8a('0x65')]['id'],_0x571b78[_0x3d8a('0x56')]?JSON[_0x3d8a('0x22')](_0x571b78[_0x3d8a('0x56')]):_0x3d8a('0x67'));return respondWithRpcPromise(_0x3d8a('0x68'),'acceptMessage',_0x189c70);}return null;})[_0x3d8a('0x1e')](function(_0x3241e3){var _0x4bcc84=_0x3d8a('0x69')+_0x3241e3[_0x3d8a('0x26')]['ContactId'];return db[_0x3d8a('0x6a')][_0x3d8a('0x3d')](_0x4bcc84,{'type':db['Sequelize'][_0x3d8a('0x6b')][_0x3d8a('0x6c')],'raw':!![]})[_0x3d8a('0x1e')](function(_0x4b2a49){return _0x4b2a49;});})[_0x3d8a('0x1e')](function(_0x2dfb7e){if(_0x2dfb7e){_0x189c70[_0x3d8a('0x26')][_0x3d8a('0x6d')]=_0x2dfb7e[0x0];if(!_0x571b78[_0x3d8a('0x56')][_0x3d8a('0x5e')])return;return db[_0x3d8a('0x6e')]['find']({'where':{'id':_0x571b78[_0x3d8a('0x56')][_0x3d8a('0x5e')],'role':_0x3d8a('0x6f')},'attributes':['id',_0x3d8a('0x36'),_0x3d8a('0x70'),_0x3d8a('0x71'),_0x3d8a('0x72')],'raw':!![]});}return null;})['then'](function(_0x5cf25e){if(!_0x5cf25e)return null;_0x189c70[_0x3d8a('0x26')][_0x3d8a('0x6f')]=_0x5cf25e;return _0x189c70;})[_0x3d8a('0x1e')](function(_0x71f84d){if(_0x71f84d){if(_0x571b78['body'][_0x3d8a('0x73')]){_0x189c70[_0x3d8a('0x26')][_0x3d8a('0x74')]=util[_0x3d8a('0x5c')](_0x3d8a('0x75'),_0x571b78['user'][_0x3d8a('0x36')]);_0x189c70[_0x3d8a('0x26')][_0x3d8a('0x76')]=_0x189c70[_0x3d8a('0x76')];_0x189c70['message']['motionChannel']=_0x189c70[_0x3d8a('0x76')];_0x189c70[_0x3d8a('0x26')][_0x3d8a('0x77')]=_0x3d8a('0x78');return respondWithRpcPromise(_0x3d8a('0x79'),_0x3d8a('0x79'),{'event':_0x3d8a('0x7a'),'message':_0x189c70['message']},client9002)[_0x3d8a('0x1e')](function(){return _0x189c70;});}return _0x189c70;}return null;})[_0x3d8a('0x1e')](respondWithResult(_0x5cbdb9,null))['catch'](handleError(_0x5cbdb9,null));};var interaction_log=require(_0x3d8a('0x7b'))(_0x3d8a('0x58'));exports[_0x3d8a('0x32')]=function(_0xeed1f,_0x3dc23e,_0x325b37){var _0x1eaf19={'agent':{},'channel':_0x3d8a('0x59')};if(_0xeed1f[_0x3d8a('0x56')]['id']){delete _0xeed1f['body']['id'];}_0xeed1f['body'][_0x3d8a('0x5e')]=_0xeed1f[_0x3d8a('0x56')]['UserId']||_0xeed1f[_0x3d8a('0x5f')]['id'];_0x1eaf19[_0x3d8a('0x6f')]['id']=_0xeed1f[_0x3d8a('0x56')][_0x3d8a('0x5e')];return db[_0x3d8a('0x3a')][_0x3d8a('0x54')]({'where':{'id':_0xeed1f[_0x3d8a('0x52')]['id'],'UserId':null}})[_0x3d8a('0x1e')](handleEntityNotFound(_0x3dc23e,null))[_0x3d8a('0x1e')](function(_0x1a23de){if(_0x1a23de){_0x1eaf19[_0x3d8a('0x26')]=_0x1a23de[_0x3d8a('0x60')]({'plain':!![]});return db[_0x3d8a('0x61')][_0x3d8a('0x54')]({'where':{'id':_0x1a23de[_0x3d8a('0x62')]}});}return null;})[_0x3d8a('0x1e')](handleEntityNotFound(_0x3dc23e,null))[_0x3d8a('0x1e')](function(_0x4b99a4){if(_0x4b99a4){_0x1eaf19[_0x3d8a('0x65')]=_0x4b99a4[_0x3d8a('0x60')]({'plain':!![]});interaction_log['info'](_0x3d8a('0x7c'),_0xeed1f['user']['id'],_0xeed1f[_0x3d8a('0x5f')][_0x3d8a('0x36')],_0xeed1f[_0x3d8a('0x5f')][_0x3d8a('0x66')],_0x1eaf19[_0x3d8a('0x65')]['id'],_0xeed1f['body']?JSON[_0x3d8a('0x22')](_0xeed1f[_0x3d8a('0x56')]):_0x3d8a('0x67'));return respondWithRpcPromise(_0x3d8a('0x7d'),_0x3d8a('0x7e'),_0x1eaf19);}return null;})[_0x3d8a('0x1e')](function(_0x3dc748){var _0x575892=_0x3d8a('0x69')+_0x3dc748['message']['ContactId'];return db[_0x3d8a('0x6a')][_0x3d8a('0x3d')](_0x575892,{'type':db[_0x3d8a('0x7f')]['QueryTypes'][_0x3d8a('0x6c')],'raw':!![]})[_0x3d8a('0x1e')](function(_0x49d026){return _0x49d026;});})[_0x3d8a('0x1e')](function(_0x43d7e4){if(_0x43d7e4){_0x1eaf19[_0x3d8a('0x26')]['contact']=_0x43d7e4[0x0];if(!_0xeed1f['body'][_0x3d8a('0x5e')])return;return db[_0x3d8a('0x6e')]['find']({'where':{'id':_0xeed1f[_0x3d8a('0x56')][_0x3d8a('0x5e')],'role':_0x3d8a('0x6f')},'attributes':['id',_0x3d8a('0x36'),_0x3d8a('0x70'),_0x3d8a('0x71'),_0x3d8a('0x72')],'raw':!![]});}return null;})['then'](function(_0x5cbfb8){if(!_0x5cbfb8)return null;_0x1eaf19['message'][_0x3d8a('0x6f')]=_0x5cbfb8;return _0x1eaf19;})[_0x3d8a('0x1e')](function(_0xd0c9e7){if(_0xd0c9e7){_0xd0c9e7['message'][_0x3d8a('0x74')]=util[_0x3d8a('0x5c')]('SIP/%s',_0xeed1f[_0x3d8a('0x5f')][_0x3d8a('0x36')]);_0xd0c9e7[_0x3d8a('0x26')]['channel']=_0x1eaf19[_0x3d8a('0x76')];_0xd0c9e7['message']['motionChannel']=_0x1eaf19[_0x3d8a('0x76')];_0xd0c9e7[_0x3d8a('0x26')][_0x3d8a('0x77')]=_0x3d8a('0x32');respondWithRpcPromise(_0x3d8a('0x79'),_0x3d8a('0x79'),{'event':_0x3d8a('0x80'),'message':_0xd0c9e7[_0x3d8a('0x26')]},client9002);return _0x1eaf19;}return null;})[_0x3d8a('0x1e')](respondWithResult(_0x3dc23e,null))['catch'](handleError(_0x3dc23e,null));}; \ No newline at end of file +var _0x4984=['result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','name','send','index','map','OpenchannelMessage','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','describe','../../config/logger','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./openchannelMessage.socket','jayson/promise','client','http','request','then','request\x20sent','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','info'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0x4984,0x154));var _0x4498=function(_0x3d2a8d,_0x367f9b){_0x3d2a8d=_0x3d2a8d-0x0;var _0x344314=_0x4984[_0x3d2a8d];return _0x344314;};'use strict';var emlformat=require(_0x4498('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4498('0x1'));var jsonpatch=require(_0x4498('0x2'));var rp=require(_0x4498('0x3'));var moment=require(_0x4498('0x4'));var BPromise=require(_0x4498('0x5'));var Mustache=require('mustache');var util=require(_0x4498('0x6'));var path=require(_0x4498('0x7'));var sox=require(_0x4498('0x8'));var csv=require(_0x4498('0x9'));var ejs=require(_0x4498('0xa'));var fs=require('fs');var fs_extra=require(_0x4498('0xb'));var _=require(_0x4498('0xc'));var squel=require(_0x4498('0xd'));var crypto=require(_0x4498('0xe'));var jsforce=require(_0x4498('0xf'));var deskjs=require(_0x4498('0x10'));var toCsv=require(_0x4498('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4498('0x11'));var authService=require(_0x4498('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4498('0x13'));var hardwareService=require(_0x4498('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4498('0x15'));var config=require(_0x4498('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4498('0x17'))['db'];config[_0x4498('0x18')]=_[_0x4498('0x19')](config[_0x4498('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4498('0x18')]));require(_0x4498('0x1a'))['register'](socket);var jayson=require(_0x4498('0x1b'));var client=jayson[_0x4498('0x1c')][_0x4498('0x1d')]({'port':0x232c});var client9002=jayson[_0x4498('0x1c')][_0x4498('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x126d28,_0x37ef94,_0x537594,_0x3a5d8a){return new BPromise(function(_0x2794bb,_0x18eba){var _0x58a7ca=_0x3a5d8a||client;return _0x58a7ca[_0x4498('0x1e')](_0x126d28,_0x537594)[_0x4498('0x1f')](function(_0x5db7e3){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x37ef94,_0x4498('0x20'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x37ef94,'request\x20sent',JSON[_0x4498('0x21')](_0x5db7e3));if(_0x5db7e3[_0x4498('0x22')]){if(_0x5db7e3[_0x4498('0x22')]['code']===0x1f4){logger[_0x4498('0x22')](_0x4498('0x23'),_0x37ef94,_0x5db7e3[_0x4498('0x22')][_0x4498('0x24')]);return _0x18eba(_0x5db7e3['error'][_0x4498('0x24')]);}logger[_0x4498('0x22')](_0x4498('0x23'),_0x37ef94,_0x5db7e3[_0x4498('0x22')][_0x4498('0x24')]);return _0x2794bb(_0x5db7e3[_0x4498('0x22')][_0x4498('0x24')]);}else{logger[_0x4498('0x25')](_0x4498('0x23'),_0x37ef94,'request\x20sent');_0x2794bb(_0x5db7e3[_0x4498('0x26')][_0x4498('0x24')]);}})['catch'](function(_0x3b95b3){logger[_0x4498('0x22')](_0x4498('0x23'),_0x37ef94,_0x3b95b3);_0x18eba(_0x3b95b3);});});}function respondWithStatusCode(_0x4ce0bb,_0x1122dc){_0x1122dc=_0x1122dc||0xcc;return function(_0x3054db){if(_0x3054db){return _0x4ce0bb[_0x4498('0x27')](_0x1122dc);}return _0x4ce0bb[_0x4498('0x28')](_0x1122dc)[_0x4498('0x29')]();};}function respondWithResult(_0x23bf09,_0x3c7384){_0x3c7384=_0x3c7384||0xc8;return function(_0x5ac08f){if(_0x5ac08f){return _0x23bf09['status'](_0x3c7384)['json'](_0x5ac08f);}};}function respondWithFilteredResult(_0x182896,_0x2a8b53){return function(_0x59a6b4){if(_0x59a6b4){var _0x27e545=typeof _0x2a8b53[_0x4498('0x2a')]===_0x4498('0x2b')&&typeof _0x2a8b53['limit']===_0x4498('0x2b');var _0x430125=_0x59a6b4[_0x4498('0x2c')];var _0x589148=_0x27e545?0x0:_0x2a8b53['offset'];var _0x2b88af=_0x27e545?_0x59a6b4['count']:_0x2a8b53[_0x4498('0x2a')]+_0x2a8b53[_0x4498('0x2d')];var _0x44552b;if(_0x2b88af>=_0x430125){_0x2b88af=_0x430125;_0x44552b=0xc8;}else{_0x44552b=0xce;}_0x182896[_0x4498('0x28')](_0x44552b);return _0x182896[_0x4498('0x2e')](_0x4498('0x2f'),_0x589148+'-'+_0x2b88af+'/'+_0x430125)[_0x4498('0x30')](_0x59a6b4);}return null;};}function patchUpdates(_0x2be5f3){return function(_0x44cffb){try{jsonpatch[_0x4498('0x31')](_0x44cffb,_0x2be5f3,!![]);}catch(_0x383daf){return BPromise[_0x4498('0x32')](_0x383daf);}return _0x44cffb['save']();};}function saveUpdates(_0x55d23a,_0x253767){return function(_0x2f6467){if(_0x2f6467){return _0x2f6467[_0x4498('0x33')](_0x55d23a)[_0x4498('0x1f')](function(_0x1e970c){return _0x1e970c;});}return null;};}function removeEntity(_0x8e4ae9,_0xc3c93a){return function(_0x546612){if(_0x546612){return _0x546612['destroy']()['then'](function(){_0x8e4ae9[_0x4498('0x28')](0xcc)[_0x4498('0x29')]();});}};}function handleEntityNotFound(_0x5e034f,_0x5a3e77){return function(_0x13ccf4){if(!_0x13ccf4){_0x5e034f[_0x4498('0x27')](0x194);}return _0x13ccf4;};}function handleError(_0x37b3f6,_0x558c49){_0x558c49=_0x558c49||0x1f4;return function(_0x25c046){logger[_0x4498('0x22')](_0x25c046['stack']);if(_0x25c046[_0x4498('0x34')]){delete _0x25c046[_0x4498('0x34')];}_0x37b3f6[_0x4498('0x28')](_0x558c49)[_0x4498('0x35')](_0x25c046);};}exports[_0x4498('0x36')]=function(_0x473b34,_0x528472){var _0x2f1d92={},_0x162a4d={},_0x57b428={'count':0x0,'rows':[]};var _0x5b8780=_[_0x4498('0x37')](db[_0x4498('0x38')][_0x4498('0x39')],function(_0x124e9b){return{'name':_0x124e9b['fieldName'],'type':_0x124e9b['type']['key']};});_0x162a4d[_0x4498('0x3a')]=_[_0x4498('0x37')](_0x5b8780,'name');_0x162a4d[_0x4498('0x3b')]=_[_0x4498('0x3c')](_0x473b34[_0x4498('0x3b')]);_0x162a4d[_0x4498('0x3d')]=_[_0x4498('0x3e')](_0x162a4d['model'],_0x162a4d[_0x4498('0x3b')]);_0x2f1d92[_0x4498('0x3f')]=_[_0x4498('0x3e')](_0x162a4d['model'],qs[_0x4498('0x40')](_0x473b34['query'][_0x4498('0x40')]));_0x2f1d92[_0x4498('0x3f')]=_0x2f1d92[_0x4498('0x3f')][_0x4498('0x41')]?_0x2f1d92['attributes']:_0x162a4d[_0x4498('0x3a')];if(!_0x473b34[_0x4498('0x3b')]['hasOwnProperty'](_0x4498('0x42'))){_0x2f1d92['limit']=qs[_0x4498('0x2d')](_0x473b34[_0x4498('0x3b')][_0x4498('0x2d')]);_0x2f1d92[_0x4498('0x2a')]=qs[_0x4498('0x2a')](_0x473b34[_0x4498('0x3b')][_0x4498('0x2a')]);}_0x2f1d92['order']=qs[_0x4498('0x43')](_0x473b34['query'][_0x4498('0x43')]);_0x2f1d92[_0x4498('0x44')]=qs[_0x4498('0x3d')](_['pick'](_0x473b34[_0x4498('0x3b')],_0x162a4d[_0x4498('0x3d')]),_0x5b8780);if(_0x473b34[_0x4498('0x3b')][_0x4498('0x45')]){_0x2f1d92['where']=_[_0x4498('0x46')](_0x2f1d92[_0x4498('0x44')],{'$or':_[_0x4498('0x37')](_0x5b8780,function(_0x25ca84){if(_0x25ca84[_0x4498('0x47')]!==_0x4498('0x48')){var _0x2d1b52={};_0x2d1b52[_0x25ca84[_0x4498('0x34')]]={'$like':'%'+_0x473b34[_0x4498('0x3b')][_0x4498('0x45')]+'%'};return _0x2d1b52;}})});}_0x2f1d92=_['merge']({},_0x2f1d92,_0x473b34[_0x4498('0x49')]);var _0x20c116={'where':_0x2f1d92['where']};return db[_0x4498('0x38')][_0x4498('0x2c')](_0x20c116)[_0x4498('0x1f')](function(_0x5432fc){_0x57b428[_0x4498('0x2c')]=_0x5432fc;if(_0x473b34[_0x4498('0x3b')]['includeAll']){_0x2f1d92['include']=[{'all':!![]}];}return db[_0x4498('0x38')][_0x4498('0x4a')](_0x2f1d92);})[_0x4498('0x1f')](function(_0x2e94b5){_0x57b428[_0x4498('0x4b')]=_0x2e94b5;return _0x57b428;})['then'](respondWithFilteredResult(_0x528472,_0x2f1d92))[_0x4498('0x4c')](handleError(_0x528472,null));};exports[_0x4498('0x4d')]=function(_0x3e63a7,_0x5652bb){var _0x379c40={'raw':!![],'where':{'id':_0x3e63a7[_0x4498('0x4e')]['id']}},_0x5bc817={};_0x5bc817[_0x4498('0x3a')]=_[_0x4498('0x3c')](db[_0x4498('0x38')][_0x4498('0x39')]);_0x5bc817['query']=_[_0x4498('0x3c')](_0x3e63a7['query']);_0x5bc817['filters']=_['intersection'](_0x5bc817['model'],_0x5bc817[_0x4498('0x3b')]);_0x379c40[_0x4498('0x3f')]=_[_0x4498('0x3e')](_0x5bc817['model'],qs[_0x4498('0x40')](_0x3e63a7['query'][_0x4498('0x40')]));_0x379c40[_0x4498('0x3f')]=_0x379c40[_0x4498('0x3f')][_0x4498('0x41')]?_0x379c40[_0x4498('0x3f')]:_0x5bc817[_0x4498('0x3a')];if(_0x3e63a7['query'][_0x4498('0x4f')]){_0x379c40[_0x4498('0x50')]=[{'all':!![]}];}_0x379c40=_[_0x4498('0x46')]({},_0x379c40,_0x3e63a7['options']);return db['OpenchannelMessage'][_0x4498('0x51')](_0x379c40)['then'](handleEntityNotFound(_0x5652bb,null))[_0x4498('0x1f')](respondWithResult(_0x5652bb,null))[_0x4498('0x4c')](handleError(_0x5652bb,null));};exports[_0x4498('0x52')]=function(_0x28a700,_0x23db56){return db[_0x4498('0x38')]['create'](_0x28a700[_0x4498('0x53')],{})['then'](respondWithResult(_0x23db56,0xc9))[_0x4498('0x4c')](handleError(_0x23db56,null));};exports[_0x4498('0x33')]=function(_0x31d6e4,_0x250580){if(_0x31d6e4[_0x4498('0x53')]['id']){delete _0x31d6e4[_0x4498('0x53')]['id'];}return db[_0x4498('0x38')][_0x4498('0x51')]({'where':{'id':_0x31d6e4[_0x4498('0x4e')]['id']}})['then'](handleEntityNotFound(_0x250580,null))[_0x4498('0x1f')](saveUpdates(_0x31d6e4[_0x4498('0x53')],null))[_0x4498('0x1f')](respondWithResult(_0x250580,null))[_0x4498('0x4c')](handleError(_0x250580,null));};exports[_0x4498('0x54')]=function(_0x116595,_0x2c046f){return db['OpenchannelMessage'][_0x4498('0x51')]({'where':{'id':_0x116595[_0x4498('0x4e')]['id']}})[_0x4498('0x1f')](handleEntityNotFound(_0x2c046f,null))['then'](removeEntity(_0x2c046f,null))[_0x4498('0x4c')](handleError(_0x2c046f,null));};exports[_0x4498('0x55')]=function(_0x2fbc6d,_0x139ff4){return db['OpenchannelMessage'][_0x4498('0x55')]()['then'](respondWithResult(_0x139ff4,null))[_0x4498('0x4c')](handleError(_0x139ff4,null));};var interaction_log=require(_0x4498('0x56'))(_0x4498('0x57'));exports[_0x4498('0x58')]=function(_0x39d16a,_0x2aad93,_0x543021){var _0x462e31={'agent':{},'channel':_0x4498('0x59')};if(_0x39d16a[_0x4498('0x53')]['id']){delete _0x39d16a['body']['id'];}_0x39d16a[_0x4498('0x53')]['read']=!![];_0x39d16a[_0x4498('0x53')][_0x4498('0x5a')]=moment()[_0x4498('0x5b')](_0x4498('0x5c'));_0x39d16a[_0x4498('0x53')][_0x4498('0x5d')]=_0x39d16a[_0x4498('0x53')][_0x4498('0x5d')]||_0x39d16a[_0x4498('0x5e')]['id'];_0x462e31['agent']['id']=_0x39d16a['body']['UserId'];return db[_0x4498('0x38')][_0x4498('0x51')]({'where':{'id':_0x39d16a[_0x4498('0x4e')]['id'],'UserId':null}})[_0x4498('0x1f')](handleEntityNotFound(_0x2aad93,null))['then'](saveUpdates(_0x39d16a[_0x4498('0x53')],null))['then'](function(_0xb5ff33){if(_0xb5ff33){_0x462e31['message']=_0xb5ff33[_0x4498('0x5f')]({'plain':!![]});return db[_0x4498('0x60')][_0x4498('0x51')]({'where':{'id':_0xb5ff33[_0x4498('0x61')]}});}return null;})[_0x4498('0x1f')](handleEntityNotFound(_0x2aad93,null))[_0x4498('0x1f')](function(_0x10239f){if(_0x10239f){return _0x10239f[_0x4498('0x33')]({'UserId':_0x39d16a['body'][_0x4498('0x5d')],'read1stAt':_[_0x4498('0x62')](_0x10239f[_0x4498('0x63')])?moment()[_0x4498('0x5b')](_0x4498('0x5c')):undefined});}return null;})[_0x4498('0x1f')](function(_0xd29b65){if(_0xd29b65){_0x462e31[_0x4498('0x64')]=_0xd29b65[_0x4498('0x5f')]({'plain':!![]});interaction_log[_0x4498('0x25')](_0x4498('0x65'),_0x39d16a['user']['id'],_0x39d16a['user'][_0x4498('0x34')],_0x39d16a[_0x4498('0x5e')][_0x4498('0x66')],_0x462e31[_0x4498('0x64')]['id'],_0x39d16a[_0x4498('0x53')]?JSON['stringify'](_0x39d16a[_0x4498('0x53')]):_0x4498('0x67'));return respondWithRpcPromise('AcceptMessage',_0x4498('0x68'),_0x462e31);}return null;})[_0x4498('0x1f')](function(_0xb151c0){var _0x3396e2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb151c0[_0x4498('0x24')][_0x4498('0x69')];return db[_0x4498('0x6a')][_0x4498('0x3b')](_0x3396e2,{'type':db[_0x4498('0x6b')][_0x4498('0x6c')][_0x4498('0x6d')],'raw':!![]})[_0x4498('0x1f')](function(_0x402d45){return _0x402d45;});})['then'](function(_0x191011){if(_0x191011){_0x462e31[_0x4498('0x24')][_0x4498('0x6e')]=_0x191011[0x0];if(!_0x39d16a[_0x4498('0x53')][_0x4498('0x5d')])return;return db[_0x4498('0x6f')][_0x4498('0x51')]({'where':{'id':_0x39d16a[_0x4498('0x53')][_0x4498('0x5d')],'role':_0x4498('0x70')},'attributes':['id','name','fullname',_0x4498('0x71'),_0x4498('0x72')],'raw':!![]});}return null;})[_0x4498('0x1f')](function(_0x46e0b6){if(!_0x46e0b6)return null;_0x462e31['message'][_0x4498('0x70')]=_0x46e0b6;return _0x462e31;})[_0x4498('0x1f')](function(_0x389986){if(_0x389986){if(_0x39d16a['body'][_0x4498('0x73')]){_0x462e31['message'][_0x4498('0x74')]=util[_0x4498('0x5b')](_0x4498('0x75'),_0x39d16a[_0x4498('0x5e')][_0x4498('0x34')]);_0x462e31['message']['channel']=_0x462e31[_0x4498('0x76')];_0x462e31[_0x4498('0x24')][_0x4498('0x77')]=_0x462e31[_0x4498('0x76')];_0x462e31[_0x4498('0x24')][_0x4498('0x78')]='accept';return respondWithRpcPromise('EventManager',_0x4498('0x79'),{'event':'acceptmessage','message':_0x462e31[_0x4498('0x24')]},client9002)['then'](function(){return _0x462e31;});}return _0x462e31;}return null;})[_0x4498('0x1f')](respondWithResult(_0x2aad93,null))[_0x4498('0x4c')](handleError(_0x2aad93,null));};var interaction_log=require(_0x4498('0x56'))('openchannel-interactions');exports[_0x4498('0x32')]=function(_0x13180a,_0x4ec88b,_0x2c2749){var _0x4156da={'agent':{},'channel':_0x4498('0x59')};if(_0x13180a['body']['id']){delete _0x13180a['body']['id'];}_0x13180a[_0x4498('0x53')][_0x4498('0x5d')]=_0x13180a[_0x4498('0x53')]['UserId']||_0x13180a[_0x4498('0x5e')]['id'];_0x4156da[_0x4498('0x70')]['id']=_0x13180a['body'][_0x4498('0x5d')];return db[_0x4498('0x38')]['find']({'where':{'id':_0x13180a[_0x4498('0x4e')]['id'],'UserId':null}})[_0x4498('0x1f')](handleEntityNotFound(_0x4ec88b,null))[_0x4498('0x1f')](function(_0x189692){if(_0x189692){_0x4156da[_0x4498('0x24')]=_0x189692[_0x4498('0x5f')]({'plain':!![]});return db[_0x4498('0x60')][_0x4498('0x51')]({'where':{'id':_0x189692['OpenchannelInteractionId']}});}return null;})[_0x4498('0x1f')](handleEntityNotFound(_0x4ec88b,null))[_0x4498('0x1f')](function(_0x337a57){if(_0x337a57){_0x4156da[_0x4498('0x64')]=_0x337a57[_0x4498('0x5f')]({'plain':!![]});interaction_log[_0x4498('0x25')](_0x4498('0x7a'),_0x13180a['user']['id'],_0x13180a['user']['name'],_0x13180a[_0x4498('0x5e')][_0x4498('0x66')],_0x4156da[_0x4498('0x64')]['id'],_0x13180a[_0x4498('0x53')]?JSON['stringify'](_0x13180a[_0x4498('0x53')]):_0x4498('0x67'));return respondWithRpcPromise(_0x4498('0x7b'),'rejectMessage',_0x4156da);}return null;})[_0x4498('0x1f')](function(_0x526e37){var _0x950878=_0x4498('0x7c')+_0x526e37[_0x4498('0x24')]['ContactId'];return db[_0x4498('0x6a')][_0x4498('0x3b')](_0x950878,{'type':db[_0x4498('0x6b')][_0x4498('0x6c')][_0x4498('0x6d')],'raw':!![]})[_0x4498('0x1f')](function(_0xca918e){return _0xca918e;});})[_0x4498('0x1f')](function(_0x2d4d93){if(_0x2d4d93){_0x4156da['message'][_0x4498('0x6e')]=_0x2d4d93[0x0];if(!_0x13180a[_0x4498('0x53')][_0x4498('0x5d')])return;return db[_0x4498('0x6f')][_0x4498('0x51')]({'where':{'id':_0x13180a[_0x4498('0x53')]['UserId'],'role':_0x4498('0x70')},'attributes':['id',_0x4498('0x34'),_0x4498('0x7d'),'email',_0x4498('0x72')],'raw':!![]});}return null;})['then'](function(_0x1391e1){if(!_0x1391e1)return null;_0x4156da[_0x4498('0x24')][_0x4498('0x70')]=_0x1391e1;return _0x4156da;})[_0x4498('0x1f')](function(_0x53b7c0){if(_0x53b7c0){_0x53b7c0['message']['interface']=util[_0x4498('0x5b')](_0x4498('0x75'),_0x13180a[_0x4498('0x5e')][_0x4498('0x34')]);_0x53b7c0[_0x4498('0x24')][_0x4498('0x76')]=_0x4156da[_0x4498('0x76')];_0x53b7c0[_0x4498('0x24')]['motionChannel']=_0x4156da[_0x4498('0x76')];_0x53b7c0['message']['event']=_0x4498('0x32');respondWithRpcPromise(_0x4498('0x79'),'EventManager',{'event':'rejectmessage','message':_0x53b7c0['message']},client9002);return _0x4156da;}return null;})[_0x4498('0x1f')](respondWithResult(_0x4ec88b,null))[_0x4498('0x4c')](handleError(_0x4ec88b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0867999..7ed76d7 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 _0xf893=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x437b14,_0xcf17d4){var _0x1ad24e=function(_0x44b236){while(--_0x44b236){_0x437b14['push'](_0x437b14['shift']());}};_0x1ad24e(++_0xcf17d4);}(_0xf893,0x1a5));var _0x3f89=function(_0x36294b,_0x3b6463){_0x36294b=_0x36294b-0x0;var _0x3e853c=_0xf893[_0x36294b];return _0x3e853c;};'use strict';var EventEmitter=require(_0x3f89('0x0'));var OpenchannelMessage=require(_0x3f89('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3f89('0x2')](0x0);var events={'afterCreate':_0x3f89('0x3'),'afterUpdate':_0x3f89('0x4'),'afterDestroy':_0x3f89('0x5')};function emitEvent(_0x42786d){return function(_0x3b6148,_0x5aba01,_0xfb087c){OpenchannelMessageEvents[_0x3f89('0x6')](_0x42786d+':'+_0x3b6148['id'],_0x3b6148);OpenchannelMessageEvents[_0x3f89('0x6')](_0x42786d,_0x3b6148);_0xfb087c(null);};}for(var e in events){if(events[_0x3f89('0x7')](e)){var event=events[e];OpenchannelMessage[_0x3f89('0x8')](e,emitEvent(event));}}module[_0x3f89('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x631f=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x414c2c,_0x4b6dc4){var _0x5a9bcd=function(_0x26a906){while(--_0x26a906){_0x414c2c['push'](_0x414c2c['shift']());}};_0x5a9bcd(++_0x4b6dc4);}(_0x631f,0x116));var _0xf631=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x631f[_0x273f77];return _0x71e147;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xf631('0x0'))['db'][_0xf631('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf631('0x2')](0x0);var events={'afterCreate':_0xf631('0x3'),'afterUpdate':_0xf631('0x4'),'afterDestroy':_0xf631('0x5')};function emitEvent(_0x13e791){return function(_0x5e9232,_0x11cf4f,_0x4640b9){OpenchannelMessageEvents[_0xf631('0x6')](_0x13e791+':'+_0x5e9232['id'],_0x5e9232);OpenchannelMessageEvents['emit'](_0x13e791,_0x5e9232);_0x4640b9(null);};}for(var e in events){if(events[_0xf631('0x7')](e)){var event=events[e];OpenchannelMessage[_0xf631('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 919d057..b6fe90e 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 _0x51c7=['POST','method','GET','threadId','error','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','CmContact','describe','then','OpenchannelAccount','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction'];(function(_0x5b4914,_0x2b12c3){var _0x58e389=function(_0x899e8f){while(--_0x899e8f){_0x5b4914['push'](_0x5b4914['shift']());}};_0x58e389(++_0x2b12c3);}(_0x51c7,0xd4));var _0x751c=function(_0x253ac6,_0x2c4e61){_0x253ac6=_0x253ac6-0x0;var _0x53c386=_0x51c7[_0x253ac6];return _0x53c386;};'use strict';var _=require(_0x751c('0x0'));var util=require(_0x751c('0x1'));var logger=require(_0x751c('0x2'))(_0x751c('0x3'));var moment=require(_0x751c('0x4'));var BPromise=require(_0x751c('0x5'));var rp=require(_0x751c('0x6'));var fs=require('fs');var path=require(_0x751c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x751c('0x8'));module[_0x751c('0x9')]=function(_0x11599d,_0x3f22e3){return _0x11599d[_0x751c('0xa')](_0x751c('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x751c('0xc'),'fields':[_0x751c('0xd')],'type':_0x751c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7def03,_0x4af093,_0x2b2861){var _0x418397=_0x11599d[_0x751c('0xf')];var _0xc07341=_0x7def03[_0x751c('0x10')]({'plain':!![]});if(_0xc07341[_0x751c('0x11')][_0x751c('0x12')]()==='in'||_0xc07341['direction'][_0x751c('0x12')]()===_0x751c('0x13')&&!_0xc07341[_0x751c('0x14')]&&!_['isNil'](_0xc07341[_0x751c('0x15')])){_0x418397[_0x751c('0x16')]['findOne']({'where':{'id':_0xc07341[_0x751c('0x17')]}})['then'](function(_0x5450af){if(_0x5450af){_0x5450af[_0x751c('0x18')]({'lastMsgAt':_0xc07341[_0x751c('0x19')],'lastMsgDirection':_0xc07341[_0x751c('0x11')][_0x751c('0x12')]()});}})[_0x751c('0x1a')](function(_0x5a23bb){console['error'](_0x5a23bb);});}if(_0xc07341[_0x751c('0x11')]===_0x751c('0x13')&&!_0xc07341[_0x751c('0x14')]){var _0x28970b;_0x418397[_0x751c('0x1b')][_0x751c('0x1c')]()[_0x751c('0x1d')](function(_0x1a517b){return _0x418397[_0x751c('0x1e')][_0x751c('0x1f')]({'where':{'id':_0xc07341['OpenchannelAccountId']},'include':[{'model':_0x418397[_0x751c('0x16')],'as':_0x751c('0x20'),'where':{'id':_0xc07341[_0x751c('0x17')]},'limit':0x1,'include':[{'model':_0x418397['CmContact'],'as':_0x751c('0x21'),'attributes':_[_0x751c('0x22')](_0x1a517b)}]}]});})[_0x751c('0x1d')](function(_0x301a38){_0x28970b=_0x301a38[_0x751c('0x10')]({'plain':!![]});if(_0x28970b&&_0x28970b[_0x751c('0x23')]){logger[_0x751c('0x24')](_0x751c('0x25'),_0x751c('0x26'),util[_0x751c('0x27')](_0x751c('0x28'),_0xc07341['id'],_0x28970b[_0x751c('0x23')]));if(_0x28970b[_0x751c('0x20')]&&_0x28970b[_0x751c('0x20')][_0x751c('0x29')]){_0xc07341[_0x751c('0x2a')]=_['omit'](_0x28970b[_0x751c('0x20')][0x0],_0x751c('0x21'));_0xc07341[_0x751c('0x21')]=_0x28970b[_0x751c('0x20')][0x0][_0x751c('0x21')];}var _0x4af093={'method':_0x751c('0x2b'),'uri':encodeURI(_0x28970b[_0x751c('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4af093[_0x751c('0x2c')]){case _0x751c('0x2d'):_0x4af093['qs']=_0xc07341;break;case'POST':_0x4af093['body']=_0xc07341;break;}return rp(_0x4af093)[_0x751c('0x1d')](function(_0x3f01b3){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x751c('0x26'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0xc07341['id'],_0x28970b[_0x751c('0x23')]));if(_0x3f01b3[_0x751c('0xd')]['threadId']&&_0x3f01b3[_0x751c('0xd')][_0x751c('0x2e')]!=_0xc07341[_0x751c('0x2a')]['threadId']){return _0x418397[_0x751c('0x16')]['update']({'threadId':_0x3f01b3[_0x751c('0xd')][_0x751c('0x2e')]},{'where':{'id':_0xc07341[_0x751c('0x2a')]['id']}});}else{return;}})[_0x751c('0x1d')](function(){return _0x7def03[_0x751c('0x18')]({'read':!![]});})[_0x751c('0x1a')](function(_0x9a64b2){logger[_0x751c('0x2f')](_0x751c('0x25'),'afterCreate',util[_0x751c('0x30')](_0x9a64b2,{'showHidden':![],'depth':null}));_0x2b2861();});}else{_0x2b2861();}})[_0x751c('0x31')](function(){_0x2b2861();});}else{_0x2b2861();}}},'charset':_0x751c('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xefe7=['openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteractionId','then','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','GET','info','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','update','catch','error','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage'];(function(_0x2a3c0a,_0x163f5c){var _0x1703a2=function(_0x471dfe){while(--_0x471dfe){_0x2a3c0a['push'](_0x2a3c0a['shift']());}};_0x1703a2(++_0x163f5c);}(_0xefe7,0x19b));var _0x7efe=function(_0x32f4ee,_0x4c89eb){_0x32f4ee=_0x32f4ee-0x0;var _0x4c6c7f=_0xefe7[_0x32f4ee];return _0x4c6c7f;};'use strict';var _=require(_0x7efe('0x0'));var util=require(_0x7efe('0x1'));var logger=require(_0x7efe('0x2'))(_0x7efe('0x3'));var moment=require(_0x7efe('0x4'));var BPromise=require(_0x7efe('0x5'));var rp=require(_0x7efe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7efe('0x7'));var config=require(_0x7efe('0x8'));var attributes=require(_0x7efe('0x9'));module[_0x7efe('0xa')]=function(_0x1c24eb,_0x70d47b){return _0x1c24eb[_0x7efe('0xb')](_0x7efe('0xc'),attributes,{'tableName':_0x7efe('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x7efe('0xe')],'type':_0x7efe('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2403f2,_0x2dac1b,_0xfe9237){var _0x3ef710=_0x1c24eb[_0x7efe('0x10')];var _0x4e2b6=_0x2403f2[_0x7efe('0x11')]({'plain':!![]});if(_0x4e2b6[_0x7efe('0x12')][_0x7efe('0x13')]()==='in'||_0x4e2b6['direction'][_0x7efe('0x13')]()===_0x7efe('0x14')&&!_0x4e2b6[_0x7efe('0x15')]&&!_[_0x7efe('0x16')](_0x4e2b6[_0x7efe('0x17')])){_0x3ef710['OpenchannelInteraction']['findOne']({'where':{'id':_0x4e2b6[_0x7efe('0x18')]}})[_0x7efe('0x19')](function(_0x3d2d8d){if(_0x3d2d8d){_0x3d2d8d['update']({'lastMsgAt':_0x4e2b6['createdAt'],'lastMsgDirection':_0x4e2b6[_0x7efe('0x12')][_0x7efe('0x13')]()});}})['catch'](function(_0x2099ae){console['error'](_0x2099ae);});}if(_0x4e2b6['direction']===_0x7efe('0x14')&&!_0x4e2b6[_0x7efe('0x15')]){var _0x20200f;_0x3ef710['CmContact'][_0x7efe('0x1a')]()[_0x7efe('0x19')](function(_0x556939){return _0x3ef710[_0x7efe('0x1b')][_0x7efe('0x1c')]({'where':{'id':_0x4e2b6[_0x7efe('0x1d')]},'include':[{'model':_0x3ef710['OpenchannelInteraction'],'as':_0x7efe('0x1e'),'where':{'id':_0x4e2b6[_0x7efe('0x18')]},'limit':0x1,'include':[{'model':_0x3ef710[_0x7efe('0x1f')],'as':'Contact','attributes':_[_0x7efe('0x20')](_0x556939)}]}]});})[_0x7efe('0x19')](function(_0x54ca5b){_0x20200f=_0x54ca5b[_0x7efe('0x11')]({'plain':!![]});if(_0x20200f&&_0x20200f[_0x7efe('0x21')]){logger['info'](_0x7efe('0x22'),'afterCreate',util['format'](_0x7efe('0x23'),_0x4e2b6['id'],_0x20200f[_0x7efe('0x21')]));if(_0x20200f[_0x7efe('0x1e')]&&_0x20200f[_0x7efe('0x1e')]['length']){_0x4e2b6[_0x7efe('0x24')]=_[_0x7efe('0x25')](_0x20200f[_0x7efe('0x1e')][0x0],_0x7efe('0x26'));_0x4e2b6[_0x7efe('0x26')]=_0x20200f[_0x7efe('0x1e')][0x0]['Contact'];}var _0x2dac1b={'method':_0x7efe('0x27'),'uri':encodeURI(_0x20200f[_0x7efe('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2dac1b[_0x7efe('0x28')]){case _0x7efe('0x29'):_0x2dac1b['qs']=_0x4e2b6;break;case _0x7efe('0x27'):_0x2dac1b[_0x7efe('0xe')]=_0x4e2b6;break;}return rp(_0x2dac1b)[_0x7efe('0x19')](function(_0x242ea3){logger[_0x7efe('0x2a')](_0x7efe('0x22'),_0x7efe('0x2b'),util[_0x7efe('0x2c')](_0x7efe('0x2d'),_0x4e2b6['id'],_0x20200f[_0x7efe('0x21')]));if(_0x242ea3[_0x7efe('0xe')]['threadId']&&_0x242ea3[_0x7efe('0xe')][_0x7efe('0x2e')]!=_0x4e2b6['Interaction'][_0x7efe('0x2e')]){return _0x3ef710[_0x7efe('0x2f')][_0x7efe('0x30')]({'threadId':_0x242ea3['body'][_0x7efe('0x2e')]},{'where':{'id':_0x4e2b6['Interaction']['id']}});}else{return;}})[_0x7efe('0x19')](function(){return _0x2403f2[_0x7efe('0x30')]({'read':!![]});})[_0x7efe('0x31')](function(_0xdd9776){logger[_0x7efe('0x32')](_0x7efe('0x22'),_0x7efe('0x2b'),util[_0x7efe('0x33')](_0xdd9776,{'showHidden':![],'depth':null}));_0xfe9237();});}else{_0xfe9237();}})['finally'](function(){_0xfe9237();});}else{_0xfe9237();}}},'charset':'utf8mb4','collate':_0x7efe('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 41083ae..f286e9b 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x323be1,_0x428499){var _0xc4ad91=function(_0x150aa4){while(--_0x150aa4){_0x323be1['push'](_0x323be1['shift']());}};_0xc4ad91(++_0x428499);}(_0x2ef3,0xba));var _0x32ef=function(_0x1acaf6,_0x2fcf64){_0x1acaf6=_0x1acaf6-0x0;var _0x4119b2=_0x2ef3[_0x1acaf6];return _0x4119b2;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b056f,_0xe0289){var _0x4811df=function(_0x4c8c86){while(--_0x4c8c86){_0x1b056f['push'](_0x1b056f['shift']());}};_0x4811df(++_0xe0289);}(_0x1261,0x144));var _0x1126=function(_0x1ee5ef,_0x38d42b){_0x1ee5ef=_0x1ee5ef-0x0;var _0x448ab8=_0x1261[_0x1ee5ef];return _0x448ab8;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7806b03..d663e1b 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 _0x7f27=['register','openchannelMessage:','./openchannelMessage.events','save','emit'];(function(_0x41af7c,_0x51a65b){var _0x567636=function(_0x50aa24){while(--_0x50aa24){_0x41af7c['push'](_0x41af7c['shift']());}};_0x567636(++_0x51a65b);}(_0x7f27,0x12e));var _0x77f2=function(_0x4f5994,_0x454430){_0x4f5994=_0x4f5994-0x0;var _0x5ba0e3=_0x7f27[_0x4f5994];return _0x5ba0e3;};'use strict';var OpenchannelMessageEvents=require(_0x77f2('0x0'));var events=[_0x77f2('0x1'),'remove','update'];function createListener(_0x247b55,_0x483b6e){return function(_0x526d89){_0x483b6e[_0x77f2('0x2')](_0x247b55,_0x526d89);};}function removeListener(_0x2bde11,_0x276e49){return function(){OpenchannelMessageEvents['removeListener'](_0x2bde11,_0x276e49);};}exports[_0x77f2('0x3')]=function(_0x5da5eb){for(var _0x292221=0x0,_0xd68cb5=events['length'];_0x292221<_0xd68cb5;_0x292221++){var _0x1c1228=events[_0x292221];var _0x43121f=createListener(_0x77f2('0x4')+_0x1c1228,_0x5da5eb);OpenchannelMessageEvents['on'](_0x1c1228,_0x43121f);}}; \ No newline at end of file +var _0xb4f2=['./openchannelMessage.events','remove','update','emit','removeListener','length','openchannelMessage:'];(function(_0x54d245,_0x16c55a){var _0xe0b238=function(_0x477871){while(--_0x477871){_0x54d245['push'](_0x54d245['shift']());}};_0xe0b238(++_0x16c55a);}(_0xb4f2,0x196));var _0x2b4f=function(_0x33e7fe,_0x54a08b){_0x33e7fe=_0x33e7fe-0x0;var _0x415d6e=_0xb4f2[_0x33e7fe];return _0x415d6e;};'use strict';var OpenchannelMessageEvents=require(_0x2b4f('0x0'));var events=['save',_0x2b4f('0x1'),_0x2b4f('0x2')];function createListener(_0x281880,_0x3ccc32){return function(_0x11593e){_0x3ccc32[_0x2b4f('0x3')](_0x281880,_0x11593e);};}function removeListener(_0x5a69d3,_0x1e7b8b){return function(){OpenchannelMessageEvents[_0x2b4f('0x4')](_0x5a69d3,_0x1e7b8b);};}exports['register']=function(_0x3dab6a){for(var _0x239eff=0x0,_0x23d28d=events[_0x2b4f('0x5')];_0x239eff<_0x23d28d;_0x239eff++){var _0x1bf118=events[_0x239eff];var _0x5d9e7c=createListener(_0x2b4f('0x6')+_0x1bf118,_0x3dab6a);OpenchannelMessageEvents['on'](_0x1bf118,_0x5d9e7c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index abaf054..08d67b9 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 _0x0089=['../../config/environment','isAuthenticated','get','/describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','/:id/users','put','update','delete','destroy','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xf2402e,_0x54c196){var _0x3d4c53=function(_0x397278){while(--_0x397278){_0xf2402e['push'](_0xf2402e['shift']());}};_0x3d4c53(++_0x54c196);}(_0x0089,0x1d5));var _0x9008=function(_0x94b103,_0xaccf87){_0x94b103=_0x94b103-0x0;var _0x181728=_0x0089[_0x94b103];return _0x181728;};'use strict';var multer=require(_0x9008('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9008('0x1'));var express=require(_0x9008('0x2'));var router=express[_0x9008('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9008('0x4'));var interaction=require(_0x9008('0x5'));var config=require(_0x9008('0x6'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x9008('0x7')](),controller['index']);router[_0x9008('0x8')](_0x9008('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x9008('0x8')](_0x9008('0xa'),auth[_0x9008('0x7')](),controller[_0x9008('0xb')]);router[_0x9008('0x8')](_0x9008('0xc'),auth[_0x9008('0x7')](),controller['getMembers']);router[_0x9008('0x8')](_0x9008('0xd'),auth['isAuthenticated'](),controller[_0x9008('0xe')]);router[_0x9008('0x8')]('/:id/users',auth[_0x9008('0x7')](),controller[_0x9008('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9008('0x10')]);router[_0x9008('0x11')]('/:id/teams',auth[_0x9008('0x7')](),controller['addTeams']);router[_0x9008('0x11')](_0x9008('0x12'),auth[_0x9008('0x7')](),controller['addAgents']);router[_0x9008('0x13')](_0x9008('0xa'),auth[_0x9008('0x7')](),controller[_0x9008('0x14')]);router[_0x9008('0x15')](_0x9008('0xa'),auth[_0x9008('0x7')](),controller[_0x9008('0x16')]);router[_0x9008('0x15')](_0x9008('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x9008('0x7')](),controller[_0x9008('0x17')]);module[_0x9008('0x18')]=router; \ No newline at end of file +var _0x4451=['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','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents'];(function(_0x3a6bd4,_0x1e4e51){var _0x4002a4=function(_0x5194fe){while(--_0x5194fe){_0x3a6bd4['push'](_0x3a6bd4['shift']());}};_0x4002a4(++_0x1e4e51);}(_0x4451,0x12a));var _0x1445=function(_0x342b0d,_0x5cbcd0){_0x342b0d=_0x342b0d-0x0;var _0x3a27f0=_0x4451[_0x342b0d];return _0x3a27f0;};'use strict';var multer=require(_0x1445('0x0'));var util=require(_0x1445('0x1'));var path=require(_0x1445('0x2'));var timeout=require(_0x1445('0x3'));var express=require(_0x1445('0x4'));var router=express[_0x1445('0x5')]();var fs_extra=require(_0x1445('0x6'));var auth=require(_0x1445('0x7'));var interaction=require(_0x1445('0x8'));var config=require(_0x1445('0x9'));var controller=require('./openchannelQueue.controller');router[_0x1445('0xa')]('/',auth['isAuthenticated'](),controller[_0x1445('0xb')]);router[_0x1445('0xa')](_0x1445('0xc'),auth[_0x1445('0xd')](),controller[_0x1445('0xe')]);router['get'](_0x1445('0xf'),auth[_0x1445('0xd')](),controller[_0x1445('0x10')]);router[_0x1445('0xa')](_0x1445('0x11'),auth[_0x1445('0xd')](),controller[_0x1445('0x12')]);router[_0x1445('0xa')]('/:id/teams',auth[_0x1445('0xd')](),controller[_0x1445('0x13')]);router[_0x1445('0xa')](_0x1445('0x14'),auth['isAuthenticated'](),controller[_0x1445('0x15')]);router['post']('/',auth[_0x1445('0xd')](),controller['create']);router[_0x1445('0x16')]('/:id/teams',auth[_0x1445('0xd')](),controller[_0x1445('0x17')]);router[_0x1445('0x16')](_0x1445('0x14'),auth['isAuthenticated'](),controller[_0x1445('0x18')]);router[_0x1445('0x19')]('/:id',auth[_0x1445('0xd')](),controller[_0x1445('0x1a')]);router[_0x1445('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x1445('0x1c')]);router[_0x1445('0x1b')](_0x1445('0x1d'),auth[_0x1445('0xd')](),controller[_0x1445('0x1e')]);router['delete'](_0x1445('0x14'),auth[_0x1445('0xd')](),controller[_0x1445('0x1f')]);module[_0x1445('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4362972..a1b6b09 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 _0xd5d8=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd5d8,0x152));var _0x8d5d=function(_0x42e9fd,_0x1d7177){_0x42e9fd=_0x42e9fd-0x0;var _0x86adff=_0xd5d8[_0x42e9fd];return _0x86adff;};'use strict';var Sequelize=require(_0x8d5d('0x0'));module[_0x8d5d('0x1')]={'name':{'type':Sequelize[_0x8d5d('0x2')],'unique':_0x8d5d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8d5d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8d5d('0x5'),_0x8d5d('0x6'),_0x8d5d('0x7'))}}; \ No newline at end of file +var _0x5559=['INTEGER','beepall','roundrobin','exports','STRING'];(function(_0x11722b,_0x247eb2){var _0x2065f0=function(_0x102b0f){while(--_0x102b0f){_0x11722b['push'](_0x11722b['shift']());}};_0x2065f0(++_0x247eb2);}(_0x5559,0xc1));var _0x9555=function(_0x5b0ed4,_0x4cf9d1){_0x5b0ed4=_0x5b0ed4-0x0;var _0x24d816=_0x5559[_0x5b0ed4];return _0x24d816;};'use strict';var Sequelize=require('sequelize');module[_0x9555('0x0')]={'name':{'type':Sequelize[_0x9555('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9555('0x1')]},'timeout':{'type':Sequelize[_0x9555('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x9555('0x3'),_0x9555('0x4'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8e4306b..95991e7 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 _0x1e53=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','body','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','order','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','OpenchannelQueues','then','error','stack','name','send','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','map','includeAll','include','findAll','show','params','OpenchannelQueue','rawAttributes','intersection','options','find','create','user','get'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x1e53,0xcc));var _0x31e5=function(_0x3baca5,_0x47638e){_0x3baca5=_0x3baca5-0x0;var _0x5f26d8=_0x1e53[_0x3baca5];return _0x5f26d8;};'use strict';var emlformat=require(_0x31e5('0x0'));var rimraf=require(_0x31e5('0x1'));var zipdir=require(_0x31e5('0x2'));var jsonpatch=require(_0x31e5('0x3'));var rp=require(_0x31e5('0x4'));var moment=require(_0x31e5('0x5'));var BPromise=require(_0x31e5('0x6'));var Mustache=require(_0x31e5('0x7'));var util=require('util');var path=require('path');var sox=require(_0x31e5('0x8'));var csv=require('to-csv');var ejs=require(_0x31e5('0x9'));var fs=require('fs');var fs_extra=require(_0x31e5('0xa'));var _=require(_0x31e5('0xb'));var squel=require('squel');var crypto=require(_0x31e5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x31e5('0xd'));var toCsv=require(_0x31e5('0xe'));var querystring=require(_0x31e5('0xf'));var Papa=require(_0x31e5('0x10'));var Redis=require(_0x31e5('0x11'));var authService=require(_0x31e5('0x12'));var qs=require(_0x31e5('0x13'));var as=require(_0x31e5('0x14'));var hardwareService=require(_0x31e5('0x15'));var logger=require(_0x31e5('0x16'))(_0x31e5('0x17'));var utils=require('../../config/utils');var config=require(_0x31e5('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x31e5('0x19')]=_[_0x31e5('0x1a')](config[_0x31e5('0x19')],{'host':_0x31e5('0x1b'),'port':0x18eb});var socket=require(_0x31e5('0x1c'))(new Redis(config[_0x31e5('0x19')]));require(_0x31e5('0x1d'))[_0x31e5('0x1e')](socket);function respondWithStatusCode(_0x52cc0d,_0xc2281e){_0xc2281e=_0xc2281e||0xcc;return function(_0x477626){if(_0x477626){return _0x52cc0d[_0x31e5('0x1f')](_0xc2281e);}return _0x52cc0d[_0x31e5('0x20')](_0xc2281e)[_0x31e5('0x21')]();};}function respondWithResult(_0x5c6ddc,_0x59dd41){_0x59dd41=_0x59dd41||0xc8;return function(_0x43fc1d){if(_0x43fc1d){return _0x5c6ddc[_0x31e5('0x20')](_0x59dd41)[_0x31e5('0x22')](_0x43fc1d);}};}function respondWithFilteredResult(_0x2dfe91,_0x501bb7){return function(_0x30c637){if(_0x30c637){var _0x4f5a84=typeof _0x501bb7[_0x31e5('0x23')]===_0x31e5('0x24')&&typeof _0x501bb7[_0x31e5('0x25')]===_0x31e5('0x24');var _0x16ee1a=_0x30c637['count'];var _0x3ed2ac=_0x4f5a84?0x0:_0x501bb7[_0x31e5('0x23')];var _0x3af60c=_0x4f5a84?_0x30c637[_0x31e5('0x26')]:_0x501bb7['offset']+_0x501bb7['limit'];var _0xd05dd8;if(_0x3af60c>=_0x16ee1a){_0x3af60c=_0x16ee1a;_0xd05dd8=0xc8;}else{_0xd05dd8=0xce;}_0x2dfe91[_0x31e5('0x20')](_0xd05dd8);return _0x2dfe91[_0x31e5('0x27')]('Content-Range',_0x3ed2ac+'-'+_0x3af60c+'/'+_0x16ee1a)['json'](_0x30c637);}return null;};}function patchUpdates(_0x1b2d66){return function(_0x2b4a9e){try{jsonpatch[_0x31e5('0x28')](_0x2b4a9e,_0x1b2d66,!![]);}catch(_0x314f9f){return BPromise[_0x31e5('0x29')](_0x314f9f);}return _0x2b4a9e['save']();};}function saveUpdates(_0x2f07dc,_0xe5299e){return function(_0x284584){if(_0x284584){return _0x284584[_0x31e5('0x2a')](_0x2f07dc)['then'](function(_0xae4e73){return _0xae4e73;});}return null;};}function removeEntity(_0xd4ec2,_0x189162){return function(_0x400d43){if(_0x400d43){return _0x400d43[_0x31e5('0x2b')]()['then'](function(){var _0x820462=_0x400d43['get']({'plain':!![]});var _0x52aab8=_0x31e5('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x52aab8,'resourceId':_0x820462['id']}})[_0x31e5('0x2d')](function(){return _0x400d43;});})[_0x31e5('0x2d')](function(){_0xd4ec2[_0x31e5('0x20')](0xcc)[_0x31e5('0x21')]();});}};}function handleEntityNotFound(_0x4d657f,_0x201fde){return function(_0x47a102){if(!_0x47a102){_0x4d657f[_0x31e5('0x1f')](0x194);}return _0x47a102;};}function handleError(_0x4d46b6,_0x2f27c6){_0x2f27c6=_0x2f27c6||0x1f4;return function(_0x459149){logger[_0x31e5('0x2e')](_0x459149[_0x31e5('0x2f')]);if(_0x459149[_0x31e5('0x30')]){delete _0x459149[_0x31e5('0x30')];}_0x4d46b6['status'](_0x2f27c6)[_0x31e5('0x31')](_0x459149);};}exports['index']=function(_0x3a2e4b,_0x49e4b2){var _0x19c521={},_0x221256={},_0x1dbc53={'count':0x0,'rows':[]};var _0x1fd054=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x4513cb){return{'name':_0x4513cb['fieldName'],'type':_0x4513cb[_0x31e5('0x32')][_0x31e5('0x33')]};});_0x221256[_0x31e5('0x34')]=_['map'](_0x1fd054,_0x31e5('0x30'));_0x221256['query']=_[_0x31e5('0x35')](_0x3a2e4b[_0x31e5('0x36')]);_0x221256[_0x31e5('0x37')]=_['intersection'](_0x221256['model'],_0x221256[_0x31e5('0x36')]);_0x19c521[_0x31e5('0x38')]=_['intersection'](_0x221256[_0x31e5('0x34')],qs[_0x31e5('0x39')](_0x3a2e4b[_0x31e5('0x36')][_0x31e5('0x39')]));_0x19c521['attributes']=_0x19c521[_0x31e5('0x38')][_0x31e5('0x3a')]?_0x19c521[_0x31e5('0x38')]:_0x221256['model'];if(!_0x3a2e4b[_0x31e5('0x36')][_0x31e5('0x3b')]('nolimit')){_0x19c521[_0x31e5('0x25')]=qs[_0x31e5('0x25')](_0x3a2e4b[_0x31e5('0x36')][_0x31e5('0x25')]);_0x19c521[_0x31e5('0x23')]=qs['offset'](_0x3a2e4b['query'][_0x31e5('0x23')]);}_0x19c521['order']=qs['sort'](_0x3a2e4b[_0x31e5('0x36')][_0x31e5('0x3c')]);_0x19c521[_0x31e5('0x3d')]=qs['filters'](_['pick'](_0x3a2e4b[_0x31e5('0x36')],_0x221256['filters']),_0x1fd054);if(_0x3a2e4b[_0x31e5('0x36')][_0x31e5('0x3e')]){_0x19c521[_0x31e5('0x3d')]=_[_0x31e5('0x3f')](_0x19c521['where'],{'$or':_[_0x31e5('0x40')](_0x1fd054,function(_0x12b197){if(_0x12b197['type']!=='VIRTUAL'){var _0x2b7081={};_0x2b7081[_0x12b197[_0x31e5('0x30')]]={'$like':'%'+_0x3a2e4b[_0x31e5('0x36')][_0x31e5('0x3e')]+'%'};return _0x2b7081;}})});}_0x19c521=_['merge']({},_0x19c521,_0x3a2e4b['options']);var _0x293781={'where':_0x19c521[_0x31e5('0x3d')]};return db['OpenchannelQueue'][_0x31e5('0x26')](_0x293781)['then'](function(_0x3707b3){_0x1dbc53[_0x31e5('0x26')]=_0x3707b3;if(_0x3a2e4b[_0x31e5('0x36')][_0x31e5('0x41')]){_0x19c521[_0x31e5('0x42')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x31e5('0x43')](_0x19c521);})[_0x31e5('0x2d')](function(_0x137484){_0x1dbc53['rows']=_0x137484;return _0x1dbc53;})[_0x31e5('0x2d')](respondWithFilteredResult(_0x49e4b2,_0x19c521))['catch'](handleError(_0x49e4b2,null));};exports[_0x31e5('0x44')]=function(_0x3ce935,_0x417741){var _0x51ce6f={'raw':!![],'where':{'id':_0x3ce935[_0x31e5('0x45')]['id']}},_0x5759bd={};_0x5759bd[_0x31e5('0x34')]=_['keys'](db[_0x31e5('0x46')][_0x31e5('0x47')]);_0x5759bd[_0x31e5('0x36')]=_[_0x31e5('0x35')](_0x3ce935[_0x31e5('0x36')]);_0x5759bd[_0x31e5('0x37')]=_[_0x31e5('0x48')](_0x5759bd[_0x31e5('0x34')],_0x5759bd[_0x31e5('0x36')]);_0x51ce6f['attributes']=_[_0x31e5('0x48')](_0x5759bd[_0x31e5('0x34')],qs[_0x31e5('0x39')](_0x3ce935[_0x31e5('0x36')][_0x31e5('0x39')]));_0x51ce6f['attributes']=_0x51ce6f[_0x31e5('0x38')][_0x31e5('0x3a')]?_0x51ce6f[_0x31e5('0x38')]:_0x5759bd[_0x31e5('0x34')];if(_0x3ce935[_0x31e5('0x36')][_0x31e5('0x41')]){_0x51ce6f['include']=[{'all':!![]}];}_0x51ce6f=_[_0x31e5('0x3f')]({},_0x51ce6f,_0x3ce935[_0x31e5('0x49')]);return db[_0x31e5('0x46')][_0x31e5('0x4a')](_0x51ce6f)[_0x31e5('0x2d')](handleEntityNotFound(_0x417741,null))['then'](respondWithResult(_0x417741,null))['catch'](handleError(_0x417741,null));};exports[_0x31e5('0x4b')]=function(_0x273286,_0xeab372){return db[_0x31e5('0x46')]['create'](_0x273286['body'],{})[_0x31e5('0x2d')](function(_0x199324){var _0x1d797f=_0x273286[_0x31e5('0x4c')][_0x31e5('0x4d')]({'plain':!![]});if(!_0x1d797f)throw new Error(_0x31e5('0x4e'));if(_0x1d797f['role']===_0x31e5('0x4c')){var _0x4d35f6=_0x199324['get']({'plain':!![]});var _0x1befef=_0x31e5('0x2c');return db[_0x31e5('0x4f')][_0x31e5('0x4a')]({'where':{'name':_0x1befef,'userProfileId':_0x1d797f['userProfileId']},'raw':!![]})[_0x31e5('0x2d')](function(_0x57eeda){if(_0x57eeda&&_0x57eeda[_0x31e5('0x50')]===0x0){return db['UserProfileResource'][_0x31e5('0x4b')]({'name':_0x4d35f6[_0x31e5('0x30')],'resourceId':_0x4d35f6['id'],'type':_0x57eeda[_0x31e5('0x30')],'sectionId':_0x57eeda['id']},{})[_0x31e5('0x2d')](function(){return _0x199324;});}else{return _0x199324;}})[_0x31e5('0x51')](function(_0x2b96f9){logger[_0x31e5('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b96f9);throw _0x2b96f9;});}return _0x199324;})[_0x31e5('0x2d')](respondWithResult(_0xeab372,0xc9))[_0x31e5('0x51')](handleError(_0xeab372,null));};exports[_0x31e5('0x2a')]=function(_0x29e600,_0x2aae03){if(_0x29e600[_0x31e5('0x52')]['id']){delete _0x29e600[_0x31e5('0x52')]['id'];}return db[_0x31e5('0x46')][_0x31e5('0x4a')]({'where':{'id':_0x29e600[_0x31e5('0x45')]['id']}})[_0x31e5('0x2d')](handleEntityNotFound(_0x2aae03,null))[_0x31e5('0x2d')](saveUpdates(_0x29e600[_0x31e5('0x52')],null))[_0x31e5('0x2d')](respondWithResult(_0x2aae03,null))[_0x31e5('0x51')](handleError(_0x2aae03,null));};exports['destroy']=function(_0x3e5744,_0x4c196d){return db[_0x31e5('0x46')][_0x31e5('0x4a')]({'where':{'id':_0x3e5744[_0x31e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c196d,null))[_0x31e5('0x2d')](removeEntity(_0x4c196d,null))[_0x31e5('0x51')](handleError(_0x4c196d,null));};exports[_0x31e5('0x53')]=function(_0x130700,_0x5ce5d4){return db[_0x31e5('0x46')][_0x31e5('0x53')]()[_0x31e5('0x2d')](respondWithResult(_0x5ce5d4,null))[_0x31e5('0x51')](handleError(_0x5ce5d4,null));};exports[_0x31e5('0x54')]=function(_0x1c6242,_0x458456,_0x363950){var _0x406055={'raw':!![],'where':{}},_0x5d6493={},_0x5000dd;return db[_0x31e5('0x46')][_0x31e5('0x55')]({'where':{'id':_0x1c6242[_0x31e5('0x45')]['id']}})[_0x31e5('0x2d')](handleEntityNotFound(_0x458456,null))[_0x31e5('0x2d')](function(_0x46f105){if(_0x46f105){_0x5000dd=_0x46f105[_0x31e5('0x4d')]({'plain':!![]});_0x5d6493[_0x31e5('0x34')]=_['keys'](db[_0x31e5('0x56')][_0x31e5('0x47')]);_0x5d6493[_0x31e5('0x36')]=_['keys'](_0x1c6242[_0x31e5('0x36')]);_0x5d6493[_0x31e5('0x37')]=_['intersection'](_0x5d6493[_0x31e5('0x34')],_0x5d6493[_0x31e5('0x36')]);_0x406055[_0x31e5('0x38')]=_[_0x31e5('0x48')](_0x5d6493['model'],qs[_0x31e5('0x39')](_0x1c6242[_0x31e5('0x36')][_0x31e5('0x39')]));_0x406055[_0x31e5('0x38')]=_0x406055['attributes']['length']?_0x406055[_0x31e5('0x38')]:_0x5d6493[_0x31e5('0x34')];if(!_0x1c6242['query'][_0x31e5('0x3b')](_0x31e5('0x57'))){_0x406055[_0x31e5('0x25')]=qs['limit'](_0x1c6242['query'][_0x31e5('0x25')]);_0x406055[_0x31e5('0x23')]=qs['offset'](_0x1c6242[_0x31e5('0x36')][_0x31e5('0x23')]);}_0x406055['order']=qs[_0x31e5('0x3c')](_0x1c6242['query'][_0x31e5('0x3c')]);_0x406055[_0x31e5('0x3d')]=qs[_0x31e5('0x37')](_[_0x31e5('0x58')](_0x1c6242[_0x31e5('0x36')],_0x5d6493[_0x31e5('0x37')]));_0x406055[_0x31e5('0x3d')][_0x31e5('0x59')]=_0x46f105['id'];if(_0x1c6242[_0x31e5('0x36')]['filter']){_0x406055[_0x31e5('0x3d')]=_[_0x31e5('0x3f')](_0x406055[_0x31e5('0x3d')],{'$or':_[_0x31e5('0x40')](_0x406055[_0x31e5('0x38')],function(_0x4aadf7){var _0x43dbf5={};_0x43dbf5[_0x4aadf7]={'$like':'%'+_0x1c6242['query'][_0x31e5('0x3e')]+'%'};return _0x43dbf5;})});}_0x406055=_[_0x31e5('0x3f')]({},_0x406055,_0x1c6242['options']);return db[_0x31e5('0x56')][_0x31e5('0x43')](_0x406055);}})[_0x31e5('0x2d')](function(_0x2937d0){if(_0x2937d0){return db[_0x31e5('0x5a')][_0x31e5('0x5b')]({'where':{'id':_[_0x31e5('0x40')](_0x2937d0,'UserId'),'role':_0x31e5('0x5c')},'attributes':['id','name',_0x31e5('0x5d'),_0x31e5('0x5e'),_0x31e5('0x5f')]});}})['then'](function(_0x1f2e49){if(_0x1f2e49){return{'count':_0x1f2e49[_0x31e5('0x26')],'rows':_[_0x31e5('0x40')](_0x1f2e49[_0x31e5('0x60')],function(_0x227fe6){return{'membername':_0x227fe6[_0x31e5('0x30')],'UserId':_0x227fe6['id'],'queue_name':_0x5000dd[_0x31e5('0x30')],'OpenchannelQueueId':_0x5000dd['id'],'interface':util[_0x31e5('0x61')](_0x31e5('0x62'),_0x31e5('0x63'),_0x227fe6[_0x31e5('0x30')]),'penalty':0x0,'paused':_0x227fe6['openchannelPause'],'createdAt':_0x227fe6[_0x31e5('0x5f')],'updatedAt':_0x227fe6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x458456,_0x406055))[_0x31e5('0x51')](handleError(_0x458456,null));};exports['getTeams']=function(_0x3023c3,_0x7cd5b,_0x389971){var _0x4c7007={};var _0x34fd6c={};var _0x5e3818;var _0x43171a;return db[_0x31e5('0x46')][_0x31e5('0x55')]({'where':{'id':_0x3023c3['params']['id']}})[_0x31e5('0x2d')](handleEntityNotFound(_0x7cd5b,null))[_0x31e5('0x2d')](function(_0x529216){if(_0x529216){_0x5e3818=_0x529216;_0x34fd6c[_0x31e5('0x34')]=_[_0x31e5('0x35')](db[_0x31e5('0x64')][_0x31e5('0x47')]);_0x34fd6c[_0x31e5('0x36')]=_[_0x31e5('0x35')](_0x3023c3[_0x31e5('0x36')]);_0x34fd6c[_0x31e5('0x37')]=_['intersection'](_0x34fd6c['model'],_0x34fd6c['query']);_0x4c7007[_0x31e5('0x38')]=_[_0x31e5('0x48')](_0x34fd6c['model'],qs[_0x31e5('0x39')](_0x3023c3[_0x31e5('0x36')]['fields']));_0x4c7007[_0x31e5('0x38')]=_0x4c7007[_0x31e5('0x38')][_0x31e5('0x3a')]?_0x4c7007[_0x31e5('0x38')]:_0x34fd6c[_0x31e5('0x34')];_0x4c7007[_0x31e5('0x65')]=qs['sort'](_0x3023c3['query'][_0x31e5('0x3c')]);_0x4c7007[_0x31e5('0x3d')]=qs[_0x31e5('0x37')](_['pick'](_0x3023c3[_0x31e5('0x36')],_0x34fd6c['filters']));if(_0x3023c3[_0x31e5('0x36')]['filter']){_0x4c7007[_0x31e5('0x3d')]=_[_0x31e5('0x3f')](_0x4c7007[_0x31e5('0x3d')],{'$or':_[_0x31e5('0x40')](_0x4c7007[_0x31e5('0x38')],function(_0x487e74){var _0x264eab={};_0x264eab[_0x487e74]={'$like':'%'+_0x3023c3[_0x31e5('0x36')][_0x31e5('0x3e')]+'%'};return _0x264eab;})});}_0x4c7007=_[_0x31e5('0x3f')]({},_0x4c7007,_0x3023c3[_0x31e5('0x49')]);return _0x5e3818['getTeams'](_0x4c7007);}})['then'](function(_0x401aaf){if(_0x401aaf){_0x43171a=_0x401aaf[_0x31e5('0x3a')];if(!_0x3023c3[_0x31e5('0x36')][_0x31e5('0x3b')](_0x31e5('0x57'))){_0x4c7007[_0x31e5('0x25')]=qs[_0x31e5('0x25')](_0x3023c3['query'][_0x31e5('0x25')]);_0x4c7007[_0x31e5('0x23')]=qs[_0x31e5('0x23')](_0x3023c3[_0x31e5('0x36')][_0x31e5('0x23')]);}return _0x5e3818[_0x31e5('0x66')](_0x4c7007);}})['then'](function(_0x2917a9){if(_0x2917a9){return _0x2917a9?{'count':_0x43171a,'rows':_0x2917a9}:null;}})['then'](respondWithResult(_0x7cd5b,null))[_0x31e5('0x51')](handleError(_0x7cd5b,null));};exports[_0x31e5('0x67')]=function(_0x58d8bc,_0x16a612,_0x2b0462){var _0x307ae1=_0x58d8bc[_0x31e5('0x52')][_0x31e5('0x68')];return db['Team'][_0x31e5('0x43')]({'where':{'id':_0x307ae1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x31e5('0x69'),'attributes':['id','name',_0x31e5('0x6a'),_0x31e5('0x6b'),_0x31e5('0x6c')],'raw':!![]}]})[_0x31e5('0x2d')](function(_0x530049){if(_0x530049){var _0x101d81=_['flatMap'](_0x530049,function(_0x1ec4dc){var _0x501a39=_0x1ec4dc[_0x31e5('0x4d')]({'plain':!![]});return _0x501a39[_0x31e5('0x69')];});return db[_0x31e5('0x46')][_0x31e5('0x4a')]({'where':{'id':_0x58d8bc[_0x31e5('0x45')]['id']}})[_0x31e5('0x2d')](function(_0x240d8f){return db[_0x31e5('0x6d')][_0x31e5('0x6e')](function(_0x72eca2){return _0x240d8f[_0x31e5('0x67')](_0x307ae1,{'transaction':_0x72eca2})['then'](function(){return BPromise[_0x31e5('0x6f')](_0x101d81,function(_0x5d7bb4){return db[_0x31e5('0x56')][_0x31e5('0x70')]({'where':{'UserId':_0x5d7bb4['id'],'OpenchannelQueueId':_0x58d8bc[_0x31e5('0x45')]['id']},'transaction':_0x72eca2});});})[_0x31e5('0x2d')](function(){_0x101d81[_0x31e5('0x71')](function(_0x2ff143){socket['emit'](_0x31e5('0x72'),{'UserId':_0x2ff143['id'],'OpenchannelQueueId':_0x240d8f['id']});});});});});}})[_0x31e5('0x2d')](respondWithStatusCode(_0x16a612,null))[_0x31e5('0x51')](handleError(_0x16a612,null));};exports[_0x31e5('0x73')]=function(_0xe7f03d,_0x40505d,_0x35a060){return db[_0x31e5('0x64')][_0x31e5('0x43')]({'where':{'id':_0xe7f03d['query'][_0x31e5('0x68')]},'attributes':['id'],'include':[{'model':db[_0x31e5('0x5a')],'as':_0x31e5('0x69'),'attributes':['id'],'raw':!![]}]})[_0x31e5('0x2d')](handleEntityNotFound(_0x40505d,null))[_0x31e5('0x2d')](function(_0x4640ca){var _0x58ef44=_[_0x31e5('0x40')](_0x4640ca,'id');var _0x2e039f=[];var _0x599686=[];var _0x1f4dbd=squel['select']();_0x1f4dbd[_0x31e5('0x74')](_0x31e5('0x75'))[_0x31e5('0x76')](_0x31e5('0x77'),'tq')[_0x31e5('0x78')](_0x31e5('0x79'),'ut',_0x31e5('0x7a'))[_0x31e5('0x3d')](_0x31e5('0x7b'),_0xe7f03d[_0x31e5('0x45')]['id']);for(var _0x4172f0=0x0;_0x4172f0<_0x4640ca[_0x31e5('0x3a')];_0x4172f0+=0x1){let _0x2defd8=_0x4640ca[_0x4172f0];for(var _0x52a2c6=0x0;_0x52a2c6<_0x2defd8[_0x31e5('0x69')][_0x31e5('0x3a')];_0x52a2c6+=0x1){let _0x377742=_0x2defd8[_0x31e5('0x69')][_0x52a2c6];var _0x5964a7=_0x1f4dbd[_0x31e5('0x7c')]();_0x5964a7[_0x31e5('0x3d')]('ut.UserId\x20=\x20?',_0x377742['id']);_0x599686['push'](db[_0x31e5('0x6d')]['query'](_0x5964a7['toString'](),{'type':db[_0x31e5('0x6d')][_0x31e5('0x7d')][_0x31e5('0x7e')]})['then'](function(_0x26a192){if(_0x26a192['length']===0x1){return _0x377742['id'];}else{var _0x588e1b=_[_0x31e5('0x7f')](_[_0x31e5('0x40')](_0x26a192,_0x31e5('0x80')),function(_0x235cd8){return _[_0x31e5('0x81')](_0x58ef44,_0x235cd8);});if(_0x588e1b){return _0x377742['id'];}}}));}}return BPromise['all'](_0x599686)[_0x31e5('0x2d')](function(_0x10c04c){_0x2e039f=_(_0x2e039f)[_0x31e5('0x82')](_0x10c04c)[_0x31e5('0x83')]()[_0x31e5('0x84')]();return db['OpenchannelQueue']['find']({'where':{'id':_0xe7f03d[_0x31e5('0x45')]['id']}})[_0x31e5('0x2d')](function(_0x44f804){return db[_0x31e5('0x6d')][_0x31e5('0x6e')](function(_0x253687){return _0x44f804[_0x31e5('0x73')](_0xe7f03d[_0x31e5('0x36')][_0x31e5('0x68')],{'transaction':_0x253687})[_0x31e5('0x2d')](function(){if(!_[_0x31e5('0x85')](_0x2e039f)){return _0x44f804[_0x31e5('0x86')](_0x2e039f,{'transaction':_0x253687});}})[_0x31e5('0x2d')](function(){_0x2e039f[_0x31e5('0x71')](function(_0xdf1305){socket[_0x31e5('0x87')](_0x31e5('0x88'),{'UserId':_0xdf1305,'OpenchannelQueueId':_0x44f804['id']});});});});});});})[_0x31e5('0x2d')](respondWithStatusCode(_0x40505d,null))[_0x31e5('0x51')](handleError(_0x40505d,null));};exports[_0x31e5('0x89')]=function(_0x3ceef5,_0x4360d9,_0x542d8f){return db[_0x31e5('0x46')]['find']({'where':{'id':_0x3ceef5[_0x31e5('0x45')]['id']}})[_0x31e5('0x2d')](handleEntityNotFound(_0x4360d9,null))[_0x31e5('0x2d')](function(_0x137fbd){if(_0x137fbd){return _0x137fbd[_0x31e5('0x89')](_0x3ceef5['body']['ids'],_[_0x31e5('0x8a')](_0x3ceef5[_0x31e5('0x52')],[_0x31e5('0x68'),'id'])||{})['spread'](function(_0x254ca9){for(var _0x4c82a9=0x0;_0x4c82a9<_0x3ceef5['body'][_0x31e5('0x68')][_0x31e5('0x3a')];_0x4c82a9+=0x1){socket[_0x31e5('0x87')](_0x31e5('0x72'),{'UserId':Number(_0x3ceef5[_0x31e5('0x52')][_0x31e5('0x68')][_0x4c82a9]),'OpenchannelQueueId':Number(_0x3ceef5['params']['id'])});}return _0x254ca9;});}})[_0x31e5('0x2d')](respondWithResult(_0x4360d9,null))[_0x31e5('0x51')](handleError(_0x4360d9,null));};exports[_0x31e5('0x86')]=function(_0x5ba25b,_0x267049,_0x5d1c7e){return db[_0x31e5('0x46')][_0x31e5('0x4a')]({'where':{'id':_0x5ba25b[_0x31e5('0x45')]['id']}})[_0x31e5('0x2d')](handleEntityNotFound(_0x267049,null))[_0x31e5('0x2d')](function(_0x1b7a3b){if(_0x1b7a3b){return _0x1b7a3b[_0x31e5('0x86')](_0x5ba25b[_0x31e5('0x36')][_0x31e5('0x68')])['then'](function(){if(_[_0x31e5('0x8b')](_0x5ba25b['query'][_0x31e5('0x68')])){for(var _0x1448ca=0x0;_0x1448ca<_0x5ba25b['query'][_0x31e5('0x68')][_0x31e5('0x3a')];_0x1448ca+=0x1){socket[_0x31e5('0x87')](_0x31e5('0x88'),{'UserId':Number(_0x5ba25b[_0x31e5('0x36')][_0x31e5('0x68')][_0x1448ca]),'OpenchannelQueueId':Number(_0x5ba25b[_0x31e5('0x45')]['id'])});}}else{socket['emit'](_0x31e5('0x88'),{'UserId':Number(_0x5ba25b['query'][_0x31e5('0x68')]),'OpenchannelQueueId':Number(_0x5ba25b[_0x31e5('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x267049,null))[_0x31e5('0x51')](handleError(_0x267049,null));};exports['getAgents']=function(_0x2d4f4d,_0xa9147e,_0x5261bc){var _0x3cec89={};var _0x18046e={};var _0x245d05;var _0x37649d;return db[_0x31e5('0x46')][_0x31e5('0x55')]({'where':{'id':_0x2d4f4d[_0x31e5('0x45')]['id']}})[_0x31e5('0x2d')](handleEntityNotFound(_0xa9147e,null))['then'](function(_0xe78e15){if(_0xe78e15){_0x245d05=_0xe78e15;_0x18046e['model']=_[_0x31e5('0x35')](db['User'][_0x31e5('0x47')]);_0x18046e['query']=_[_0x31e5('0x35')](_0x2d4f4d['query']);_0x18046e[_0x31e5('0x37')]=_[_0x31e5('0x48')](_0x18046e[_0x31e5('0x34')],_0x18046e[_0x31e5('0x36')]);_0x3cec89[_0x31e5('0x38')]=_[_0x31e5('0x48')](_0x18046e[_0x31e5('0x34')],qs['fields'](_0x2d4f4d[_0x31e5('0x36')]['fields']));_0x3cec89['attributes']=_0x3cec89[_0x31e5('0x38')]['length']?_0x3cec89[_0x31e5('0x38')]:_0x18046e[_0x31e5('0x34')];_0x3cec89['order']=qs[_0x31e5('0x3c')](_0x2d4f4d[_0x31e5('0x36')]['sort']);_0x3cec89[_0x31e5('0x3d')]=qs[_0x31e5('0x37')](_[_0x31e5('0x58')](_0x2d4f4d['query'],_0x18046e[_0x31e5('0x37')]));if(_0x2d4f4d[_0x31e5('0x36')]['filter']){_0x3cec89[_0x31e5('0x3d')]=_[_0x31e5('0x3f')](_0x3cec89[_0x31e5('0x3d')],{'$or':_[_0x31e5('0x40')](_0x3cec89['attributes'],function(_0x558e62){var _0x1587d0={};_0x1587d0[_0x558e62]={'$like':'%'+_0x2d4f4d[_0x31e5('0x36')][_0x31e5('0x3e')]+'%'};return _0x1587d0;})});}_0x3cec89=_['merge']({},_0x3cec89,_0x2d4f4d[_0x31e5('0x49')]);return _0x245d05[_0x31e5('0x8c')](_0x3cec89);}})[_0x31e5('0x2d')](function(_0x469b7f){if(_0x469b7f){_0x37649d=_0x469b7f['length'];if(!_0x2d4f4d['query'][_0x31e5('0x3b')]('nolimit')){_0x3cec89[_0x31e5('0x25')]=qs[_0x31e5('0x25')](_0x2d4f4d[_0x31e5('0x36')][_0x31e5('0x25')]);_0x3cec89[_0x31e5('0x23')]=qs[_0x31e5('0x23')](_0x2d4f4d[_0x31e5('0x36')][_0x31e5('0x23')]);}return _0x245d05['getAgents'](_0x3cec89);}})[_0x31e5('0x2d')](function(_0x59552b){if(_0x59552b){return _0x59552b?{'count':_0x37649d,'rows':_0x59552b}:null;}})[_0x31e5('0x2d')](respondWithResult(_0xa9147e,null))[_0x31e5('0x51')](handleError(_0xa9147e,null));}; \ No newline at end of file +var _0x1adb=['union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','includeAll','include','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','findOne','UserOpenchannelQueue','pick','options','User','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','all'];(function(_0x152b42,_0x1a0408){var _0x38b701=function(_0xece97c){while(--_0xece97c){_0x152b42['push'](_0x152b42['shift']());}};_0x38b701(++_0x1a0408);}(_0x1adb,0x97));var _0xb1ad=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1adb[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xb1ad('0x0'));var rimraf=require(_0xb1ad('0x1'));var zipdir=require(_0xb1ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb1ad('0x3'));var BPromise=require(_0xb1ad('0x4'));var Mustache=require('mustache');var util=require(_0xb1ad('0x5'));var path=require(_0xb1ad('0x6'));var sox=require(_0xb1ad('0x7'));var csv=require(_0xb1ad('0x8'));var ejs=require(_0xb1ad('0x9'));var fs=require('fs');var fs_extra=require(_0xb1ad('0xa'));var _=require(_0xb1ad('0xb'));var squel=require('squel');var crypto=require(_0xb1ad('0xc'));var jsforce=require(_0xb1ad('0xd'));var deskjs=require(_0xb1ad('0xe'));var toCsv=require(_0xb1ad('0x8'));var querystring=require('querystring');var Papa=require(_0xb1ad('0xf'));var Redis=require(_0xb1ad('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1ad('0x11'));var logger=require(_0xb1ad('0x12'))(_0xb1ad('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xb1ad('0x14')](config[_0xb1ad('0x15')],{'host':_0xb1ad('0x16'),'port':0x18eb});var socket=require(_0xb1ad('0x17'))(new Redis(config['redis']));require(_0xb1ad('0x18'))[_0xb1ad('0x19')](socket);function respondWithStatusCode(_0x2e77c5,_0x448b0e){_0x448b0e=_0x448b0e||0xcc;return function(_0x3df834){if(_0x3df834){return _0x2e77c5[_0xb1ad('0x1a')](_0x448b0e);}return _0x2e77c5[_0xb1ad('0x1b')](_0x448b0e)[_0xb1ad('0x1c')]();};}function respondWithResult(_0x3d31df,_0x5c237b){_0x5c237b=_0x5c237b||0xc8;return function(_0x466533){if(_0x466533){return _0x3d31df[_0xb1ad('0x1b')](_0x5c237b)[_0xb1ad('0x1d')](_0x466533);}};}function respondWithFilteredResult(_0x51443a,_0x26a2f5){return function(_0x5e0379){if(_0x5e0379){var _0x4ade2f=typeof _0x26a2f5[_0xb1ad('0x1e')]===_0xb1ad('0x1f')&&typeof _0x26a2f5['limit']===_0xb1ad('0x1f');var _0x1787ff=_0x5e0379[_0xb1ad('0x20')];var _0x17690c=_0x4ade2f?0x0:_0x26a2f5['offset'];var _0x21c82f=_0x4ade2f?_0x5e0379[_0xb1ad('0x20')]:_0x26a2f5[_0xb1ad('0x1e')]+_0x26a2f5[_0xb1ad('0x21')];var _0x2f72b3;if(_0x21c82f>=_0x1787ff){_0x21c82f=_0x1787ff;_0x2f72b3=0xc8;}else{_0x2f72b3=0xce;}_0x51443a[_0xb1ad('0x1b')](_0x2f72b3);return _0x51443a[_0xb1ad('0x22')](_0xb1ad('0x23'),_0x17690c+'-'+_0x21c82f+'/'+_0x1787ff)[_0xb1ad('0x1d')](_0x5e0379);}return null;};}function patchUpdates(_0x104ab0){return function(_0x4a16db){try{jsonpatch[_0xb1ad('0x24')](_0x4a16db,_0x104ab0,!![]);}catch(_0x5943b5){return BPromise[_0xb1ad('0x25')](_0x5943b5);}return _0x4a16db[_0xb1ad('0x26')]();};}function saveUpdates(_0xfc14f2,_0x534a06){return function(_0x21b2f5){if(_0x21b2f5){return _0x21b2f5[_0xb1ad('0x27')](_0xfc14f2)[_0xb1ad('0x28')](function(_0xb5e5c3){return _0xb5e5c3;});}return null;};}function removeEntity(_0x598ea6,_0x33bcd2){return function(_0x270377){if(_0x270377){return _0x270377[_0xb1ad('0x29')]()['then'](function(){var _0x146394=_0x270377[_0xb1ad('0x2a')]({'plain':!![]});var _0x597dce=_0xb1ad('0x2b');return db[_0xb1ad('0x2c')]['destroy']({'where':{'type':_0x597dce,'resourceId':_0x146394['id']}})['then'](function(){return _0x270377;});})['then'](function(){_0x598ea6['status'](0xcc)[_0xb1ad('0x1c')]();});}};}function handleEntityNotFound(_0x3683dd,_0x2f33c4){return function(_0x480a93){if(!_0x480a93){_0x3683dd[_0xb1ad('0x1a')](0x194);}return _0x480a93;};}function handleError(_0x2f3b3f,_0x553bff){_0x553bff=_0x553bff||0x1f4;return function(_0x57b44e){logger['error'](_0x57b44e[_0xb1ad('0x2d')]);if(_0x57b44e['name']){delete _0x57b44e['name'];}_0x2f3b3f[_0xb1ad('0x1b')](_0x553bff)[_0xb1ad('0x2e')](_0x57b44e);};}exports[_0xb1ad('0x2f')]=function(_0x5f3950,_0x465d92){var _0x2edd70={},_0x27a5ac={},_0x4c0ec8={'count':0x0,'rows':[]};var _0x57ca80=_[_0xb1ad('0x30')](db[_0xb1ad('0x31')][_0xb1ad('0x32')],function(_0x3b7701){return{'name':_0x3b7701[_0xb1ad('0x33')],'type':_0x3b7701[_0xb1ad('0x34')][_0xb1ad('0x35')]};});_0x27a5ac[_0xb1ad('0x36')]=_[_0xb1ad('0x30')](_0x57ca80,_0xb1ad('0x37'));_0x27a5ac[_0xb1ad('0x38')]=_[_0xb1ad('0x39')](_0x5f3950[_0xb1ad('0x38')]);_0x27a5ac[_0xb1ad('0x3a')]=_[_0xb1ad('0x3b')](_0x27a5ac[_0xb1ad('0x36')],_0x27a5ac[_0xb1ad('0x38')]);_0x2edd70[_0xb1ad('0x3c')]=_['intersection'](_0x27a5ac['model'],qs[_0xb1ad('0x3d')](_0x5f3950[_0xb1ad('0x38')][_0xb1ad('0x3d')]));_0x2edd70[_0xb1ad('0x3c')]=_0x2edd70[_0xb1ad('0x3c')][_0xb1ad('0x3e')]?_0x2edd70[_0xb1ad('0x3c')]:_0x27a5ac['model'];if(!_0x5f3950[_0xb1ad('0x38')][_0xb1ad('0x3f')](_0xb1ad('0x40'))){_0x2edd70[_0xb1ad('0x21')]=qs[_0xb1ad('0x21')](_0x5f3950[_0xb1ad('0x38')][_0xb1ad('0x21')]);_0x2edd70[_0xb1ad('0x1e')]=qs['offset'](_0x5f3950['query'][_0xb1ad('0x1e')]);}_0x2edd70[_0xb1ad('0x41')]=qs[_0xb1ad('0x42')](_0x5f3950[_0xb1ad('0x38')][_0xb1ad('0x42')]);_0x2edd70[_0xb1ad('0x43')]=qs['filters'](_['pick'](_0x5f3950[_0xb1ad('0x38')],_0x27a5ac[_0xb1ad('0x3a')]),_0x57ca80);if(_0x5f3950[_0xb1ad('0x38')][_0xb1ad('0x44')]){_0x2edd70[_0xb1ad('0x43')]=_[_0xb1ad('0x45')](_0x2edd70[_0xb1ad('0x43')],{'$or':_[_0xb1ad('0x30')](_0x57ca80,function(_0x498c40){if(_0x498c40['type']!==_0xb1ad('0x46')){var _0x3a0755={};_0x3a0755[_0x498c40[_0xb1ad('0x37')]]={'$like':'%'+_0x5f3950[_0xb1ad('0x38')][_0xb1ad('0x44')]+'%'};return _0x3a0755;}})});}_0x2edd70=_[_0xb1ad('0x45')]({},_0x2edd70,_0x5f3950['options']);var _0x51543e={'where':_0x2edd70[_0xb1ad('0x43')]};return db[_0xb1ad('0x31')][_0xb1ad('0x20')](_0x51543e)[_0xb1ad('0x28')](function(_0x30a215){_0x4c0ec8[_0xb1ad('0x20')]=_0x30a215;if(_0x5f3950[_0xb1ad('0x38')]['includeAll']){_0x2edd70['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0xb1ad('0x47')](_0x2edd70);})[_0xb1ad('0x28')](function(_0x323db2){_0x4c0ec8[_0xb1ad('0x48')]=_0x323db2;return _0x4c0ec8;})[_0xb1ad('0x28')](respondWithFilteredResult(_0x465d92,_0x2edd70))[_0xb1ad('0x49')](handleError(_0x465d92,null));};exports[_0xb1ad('0x4a')]=function(_0x5c894d,_0x27c642){var _0x1a8299={'raw':!![],'where':{'id':_0x5c894d['params']['id']}},_0x424f57={};_0x424f57['model']=_[_0xb1ad('0x39')](db['OpenchannelQueue']['rawAttributes']);_0x424f57[_0xb1ad('0x38')]=_['keys'](_0x5c894d[_0xb1ad('0x38')]);_0x424f57['filters']=_[_0xb1ad('0x3b')](_0x424f57[_0xb1ad('0x36')],_0x424f57['query']);_0x1a8299[_0xb1ad('0x3c')]=_[_0xb1ad('0x3b')](_0x424f57[_0xb1ad('0x36')],qs[_0xb1ad('0x3d')](_0x5c894d[_0xb1ad('0x38')]['fields']));_0x1a8299[_0xb1ad('0x3c')]=_0x1a8299[_0xb1ad('0x3c')][_0xb1ad('0x3e')]?_0x1a8299[_0xb1ad('0x3c')]:_0x424f57[_0xb1ad('0x36')];if(_0x5c894d['query'][_0xb1ad('0x4b')]){_0x1a8299[_0xb1ad('0x4c')]=[{'all':!![]}];}_0x1a8299=_[_0xb1ad('0x45')]({},_0x1a8299,_0x5c894d['options']);return db[_0xb1ad('0x31')]['find'](_0x1a8299)[_0xb1ad('0x28')](handleEntityNotFound(_0x27c642,null))['then'](respondWithResult(_0x27c642,null))[_0xb1ad('0x49')](handleError(_0x27c642,null));};exports[_0xb1ad('0x4d')]=function(_0x19d23a,_0x37333a){return db[_0xb1ad('0x31')][_0xb1ad('0x4d')](_0x19d23a['body'],{})[_0xb1ad('0x28')](function(_0x1cd92b){var _0x4fa039=_0x19d23a[_0xb1ad('0x4e')][_0xb1ad('0x2a')]({'plain':!![]});if(!_0x4fa039)throw new Error(_0xb1ad('0x4f'));if(_0x4fa039[_0xb1ad('0x50')]==='user'){var _0xf55e8b=_0x1cd92b[_0xb1ad('0x2a')]({'plain':!![]});var _0x1cfe30=_0xb1ad('0x2b');return db[_0xb1ad('0x51')][_0xb1ad('0x52')]({'where':{'name':_0x1cfe30,'userProfileId':_0x4fa039[_0xb1ad('0x53')]},'raw':!![]})[_0xb1ad('0x28')](function(_0x1757ab){if(_0x1757ab&&_0x1757ab[_0xb1ad('0x54')]===0x0){return db['UserProfileResource'][_0xb1ad('0x4d')]({'name':_0xf55e8b['name'],'resourceId':_0xf55e8b['id'],'type':_0x1757ab[_0xb1ad('0x37')],'sectionId':_0x1757ab['id']},{})[_0xb1ad('0x28')](function(){return _0x1cd92b;});}else{return _0x1cd92b;}})[_0xb1ad('0x49')](function(_0x56cf05){logger['error'](_0xb1ad('0x55'),_0x56cf05);throw _0x56cf05;});}return _0x1cd92b;})[_0xb1ad('0x28')](respondWithResult(_0x37333a,0xc9))[_0xb1ad('0x49')](handleError(_0x37333a,null));};exports[_0xb1ad('0x27')]=function(_0x5c1ee5,_0x5f2ada){if(_0x5c1ee5[_0xb1ad('0x56')]['id']){delete _0x5c1ee5[_0xb1ad('0x56')]['id'];}return db[_0xb1ad('0x31')][_0xb1ad('0x52')]({'where':{'id':_0x5c1ee5[_0xb1ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f2ada,null))[_0xb1ad('0x28')](saveUpdates(_0x5c1ee5[_0xb1ad('0x56')],null))['then'](respondWithResult(_0x5f2ada,null))['catch'](handleError(_0x5f2ada,null));};exports[_0xb1ad('0x29')]=function(_0x188ece,_0x504fcd){return db[_0xb1ad('0x31')][_0xb1ad('0x52')]({'where':{'id':_0x188ece[_0xb1ad('0x57')]['id']}})[_0xb1ad('0x28')](handleEntityNotFound(_0x504fcd,null))['then'](removeEntity(_0x504fcd,null))[_0xb1ad('0x49')](handleError(_0x504fcd,null));};exports[_0xb1ad('0x58')]=function(_0x243d18,_0x5a0674){return db[_0xb1ad('0x31')]['describe']()[_0xb1ad('0x28')](respondWithResult(_0x5a0674,null))['catch'](handleError(_0x5a0674,null));};exports[_0xb1ad('0x59')]=function(_0x3c2c3b,_0x35d85f,_0x19b24e){var _0x22572e={'raw':!![],'where':{}},_0x2005ee={},_0x30e38a;return db[_0xb1ad('0x31')][_0xb1ad('0x5a')]({'where':{'id':_0x3c2c3b[_0xb1ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x35d85f,null))[_0xb1ad('0x28')](function(_0x24e369){if(_0x24e369){_0x30e38a=_0x24e369['get']({'plain':!![]});_0x2005ee['model']=_[_0xb1ad('0x39')](db[_0xb1ad('0x5b')][_0xb1ad('0x32')]);_0x2005ee[_0xb1ad('0x38')]=_['keys'](_0x3c2c3b['query']);_0x2005ee['filters']=_[_0xb1ad('0x3b')](_0x2005ee['model'],_0x2005ee[_0xb1ad('0x38')]);_0x22572e[_0xb1ad('0x3c')]=_[_0xb1ad('0x3b')](_0x2005ee[_0xb1ad('0x36')],qs[_0xb1ad('0x3d')](_0x3c2c3b[_0xb1ad('0x38')][_0xb1ad('0x3d')]));_0x22572e[_0xb1ad('0x3c')]=_0x22572e['attributes'][_0xb1ad('0x3e')]?_0x22572e[_0xb1ad('0x3c')]:_0x2005ee[_0xb1ad('0x36')];if(!_0x3c2c3b[_0xb1ad('0x38')][_0xb1ad('0x3f')]('nolimit')){_0x22572e[_0xb1ad('0x21')]=qs['limit'](_0x3c2c3b[_0xb1ad('0x38')][_0xb1ad('0x21')]);_0x22572e[_0xb1ad('0x1e')]=qs['offset'](_0x3c2c3b[_0xb1ad('0x38')][_0xb1ad('0x1e')]);}_0x22572e[_0xb1ad('0x41')]=qs['sort'](_0x3c2c3b[_0xb1ad('0x38')]['sort']);_0x22572e[_0xb1ad('0x43')]=qs[_0xb1ad('0x3a')](_[_0xb1ad('0x5c')](_0x3c2c3b[_0xb1ad('0x38')],_0x2005ee['filters']));_0x22572e[_0xb1ad('0x43')]['OpenchannelQueueId']=_0x24e369['id'];if(_0x3c2c3b[_0xb1ad('0x38')][_0xb1ad('0x44')]){_0x22572e[_0xb1ad('0x43')]=_['merge'](_0x22572e[_0xb1ad('0x43')],{'$or':_[_0xb1ad('0x30')](_0x22572e['attributes'],function(_0x44a9a1){var _0x221678={};_0x221678[_0x44a9a1]={'$like':'%'+_0x3c2c3b[_0xb1ad('0x38')][_0xb1ad('0x44')]+'%'};return _0x221678;})});}_0x22572e=_[_0xb1ad('0x45')]({},_0x22572e,_0x3c2c3b[_0xb1ad('0x5d')]);return db[_0xb1ad('0x5b')]['findAll'](_0x22572e);}})[_0xb1ad('0x28')](function(_0x38601b){if(_0x38601b){return db[_0xb1ad('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x38601b,_0xb1ad('0x5f')),'role':_0xb1ad('0x60')},'attributes':['id',_0xb1ad('0x37'),_0xb1ad('0x61'),_0xb1ad('0x62'),_0xb1ad('0x63')]});}})['then'](function(_0xfdb5f8){if(_0xfdb5f8){return{'count':_0xfdb5f8[_0xb1ad('0x20')],'rows':_[_0xb1ad('0x30')](_0xfdb5f8[_0xb1ad('0x48')],function(_0x30507c){return{'membername':_0x30507c[_0xb1ad('0x37')],'UserId':_0x30507c['id'],'queue_name':_0x30e38a[_0xb1ad('0x37')],'OpenchannelQueueId':_0x30e38a['id'],'interface':util['format'](_0xb1ad('0x64'),'SIP',_0x30507c[_0xb1ad('0x37')]),'penalty':0x0,'paused':_0x30507c[_0xb1ad('0x61')],'createdAt':_0x30507c[_0xb1ad('0x63')],'updatedAt':_0x30507c[_0xb1ad('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb1ad('0x28')](respondWithFilteredResult(_0x35d85f,_0x22572e))[_0xb1ad('0x49')](handleError(_0x35d85f,null));};exports[_0xb1ad('0x65')]=function(_0x16ebed,_0x14193f,_0x3dda5c){var _0x20b6b1={};var _0x365c58={};var _0x46488e;var _0x4689d8;return db[_0xb1ad('0x31')][_0xb1ad('0x5a')]({'where':{'id':_0x16ebed[_0xb1ad('0x57')]['id']}})[_0xb1ad('0x28')](handleEntityNotFound(_0x14193f,null))['then'](function(_0x28a437){if(_0x28a437){_0x46488e=_0x28a437;_0x365c58['model']=_['keys'](db[_0xb1ad('0x66')]['rawAttributes']);_0x365c58[_0xb1ad('0x38')]=_['keys'](_0x16ebed[_0xb1ad('0x38')]);_0x365c58[_0xb1ad('0x3a')]=_[_0xb1ad('0x3b')](_0x365c58['model'],_0x365c58[_0xb1ad('0x38')]);_0x20b6b1['attributes']=_[_0xb1ad('0x3b')](_0x365c58[_0xb1ad('0x36')],qs[_0xb1ad('0x3d')](_0x16ebed[_0xb1ad('0x38')]['fields']));_0x20b6b1[_0xb1ad('0x3c')]=_0x20b6b1[_0xb1ad('0x3c')][_0xb1ad('0x3e')]?_0x20b6b1[_0xb1ad('0x3c')]:_0x365c58['model'];_0x20b6b1[_0xb1ad('0x41')]=qs[_0xb1ad('0x42')](_0x16ebed['query']['sort']);_0x20b6b1['where']=qs[_0xb1ad('0x3a')](_[_0xb1ad('0x5c')](_0x16ebed[_0xb1ad('0x38')],_0x365c58[_0xb1ad('0x3a')]));if(_0x16ebed[_0xb1ad('0x38')][_0xb1ad('0x44')]){_0x20b6b1['where']=_[_0xb1ad('0x45')](_0x20b6b1[_0xb1ad('0x43')],{'$or':_[_0xb1ad('0x30')](_0x20b6b1['attributes'],function(_0x2c6531){var _0x2c6fea={};_0x2c6fea[_0x2c6531]={'$like':'%'+_0x16ebed[_0xb1ad('0x38')][_0xb1ad('0x44')]+'%'};return _0x2c6fea;})});}_0x20b6b1=_[_0xb1ad('0x45')]({},_0x20b6b1,_0x16ebed['options']);return _0x46488e[_0xb1ad('0x65')](_0x20b6b1);}})[_0xb1ad('0x28')](function(_0x3b9774){if(_0x3b9774){_0x4689d8=_0x3b9774[_0xb1ad('0x3e')];if(!_0x16ebed[_0xb1ad('0x38')][_0xb1ad('0x3f')]('nolimit')){_0x20b6b1['limit']=qs[_0xb1ad('0x21')](_0x16ebed[_0xb1ad('0x38')][_0xb1ad('0x21')]);_0x20b6b1[_0xb1ad('0x1e')]=qs['offset'](_0x16ebed[_0xb1ad('0x38')]['offset']);}return _0x46488e['getTeams'](_0x20b6b1);}})[_0xb1ad('0x28')](function(_0x24f307){if(_0x24f307){return _0x24f307?{'count':_0x4689d8,'rows':_0x24f307}:null;}})[_0xb1ad('0x28')](respondWithResult(_0x14193f,null))[_0xb1ad('0x49')](handleError(_0x14193f,null));};exports[_0xb1ad('0x67')]=function(_0x5b010a,_0x245058,_0x9792ad){var _0x86ebc8=_0x5b010a[_0xb1ad('0x56')][_0xb1ad('0x68')];return db[_0xb1ad('0x66')][_0xb1ad('0x47')]({'where':{'id':_0x86ebc8},'attributes':['id'],'include':[{'model':db[_0xb1ad('0x5e')],'as':_0xb1ad('0x69'),'attributes':['id',_0xb1ad('0x37'),_0xb1ad('0x6a'),_0xb1ad('0x6b'),_0xb1ad('0x6c')],'raw':!![]}]})['then'](function(_0x5c60ff){if(_0x5c60ff){var _0x1febd5=_['flatMap'](_0x5c60ff,function(_0x35c251){var _0x56ffc1=_0x35c251[_0xb1ad('0x2a')]({'plain':!![]});return _0x56ffc1[_0xb1ad('0x69')];});return db[_0xb1ad('0x31')]['find']({'where':{'id':_0x5b010a[_0xb1ad('0x57')]['id']}})['then'](function(_0x5cb717){return db[_0xb1ad('0x6d')][_0xb1ad('0x6e')](function(_0x32a722){return _0x5cb717[_0xb1ad('0x67')](_0x86ebc8,{'transaction':_0x32a722})[_0xb1ad('0x28')](function(){return BPromise[_0xb1ad('0x6f')](_0x1febd5,function(_0x4ad01f){return db[_0xb1ad('0x5b')][_0xb1ad('0x70')]({'where':{'UserId':_0x4ad01f['id'],'OpenchannelQueueId':_0x5b010a[_0xb1ad('0x57')]['id']},'transaction':_0x32a722});});})[_0xb1ad('0x28')](function(){_0x1febd5[_0xb1ad('0x71')](function(_0xafcbc4){socket[_0xb1ad('0x72')]('userOpenchannelQueue:save',{'UserId':_0xafcbc4['id'],'OpenchannelQueueId':_0x5cb717['id']});});});});});}})[_0xb1ad('0x28')](respondWithStatusCode(_0x245058,null))['catch'](handleError(_0x245058,null));};exports[_0xb1ad('0x73')]=function(_0x42adc3,_0x460275,_0x9e6b8f){return db['Team']['findAll']({'where':{'id':_0x42adc3[_0xb1ad('0x38')][_0xb1ad('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb1ad('0x69'),'attributes':['id'],'raw':!![]}]})[_0xb1ad('0x28')](handleEntityNotFound(_0x460275,null))[_0xb1ad('0x28')](function(_0x2800a0){var _0x1b5f7e=_[_0xb1ad('0x30')](_0x2800a0,'id');var _0x2fe4d4=[];var _0x4431dd=[];var _0x5b5024=squel['select']();_0x5b5024[_0xb1ad('0x74')](_0xb1ad('0x75'))[_0xb1ad('0x76')](_0xb1ad('0x77'),'tq')['join'](_0xb1ad('0x78'),'ut',_0xb1ad('0x79'))['where'](_0xb1ad('0x7a'),_0x42adc3[_0xb1ad('0x57')]['id']);for(var _0x15a19a=0x0;_0x15a19a<_0x2800a0[_0xb1ad('0x3e')];_0x15a19a+=0x1){let _0x54be9a=_0x2800a0[_0x15a19a];for(var _0x16493a=0x0;_0x16493a<_0x54be9a[_0xb1ad('0x69')][_0xb1ad('0x3e')];_0x16493a+=0x1){let _0x96ff62=_0x54be9a['Agents'][_0x16493a];var _0x1e737e=_0x5b5024[_0xb1ad('0x7b')]();_0x1e737e[_0xb1ad('0x43')]('ut.UserId\x20=\x20?',_0x96ff62['id']);_0x4431dd['push'](db[_0xb1ad('0x6d')][_0xb1ad('0x38')](_0x1e737e[_0xb1ad('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0xb1ad('0x7d')]})['then'](function(_0x4e5936){if(_0x4e5936['length']===0x1){return _0x96ff62['id'];}else{var _0x242e67=_[_0xb1ad('0x7e')](_[_0xb1ad('0x30')](_0x4e5936,_0xb1ad('0x7f')),function(_0x23fe1f){return _['includes'](_0x1b5f7e,_0x23fe1f);});if(_0x242e67){return _0x96ff62['id'];}}}));}}return BPromise[_0xb1ad('0x80')](_0x4431dd)[_0xb1ad('0x28')](function(_0x4088c5){_0x2fe4d4=_(_0x2fe4d4)[_0xb1ad('0x81')](_0x4088c5)['compact']()[_0xb1ad('0x82')]();return db[_0xb1ad('0x31')][_0xb1ad('0x52')]({'where':{'id':_0x42adc3[_0xb1ad('0x57')]['id']}})[_0xb1ad('0x28')](function(_0x261bc6){return db[_0xb1ad('0x6d')][_0xb1ad('0x6e')](function(_0x4e85bd){return _0x261bc6[_0xb1ad('0x73')](_0x42adc3['query']['ids'],{'transaction':_0x4e85bd})[_0xb1ad('0x28')](function(){if(!_[_0xb1ad('0x83')](_0x2fe4d4)){return _0x261bc6[_0xb1ad('0x84')](_0x2fe4d4,{'transaction':_0x4e85bd});}})[_0xb1ad('0x28')](function(){_0x2fe4d4['forEach'](function(_0x2d114c){socket['emit'](_0xb1ad('0x85'),{'UserId':_0x2d114c,'OpenchannelQueueId':_0x261bc6['id']});});});});});});})[_0xb1ad('0x28')](respondWithStatusCode(_0x460275,null))['catch'](handleError(_0x460275,null));};exports[_0xb1ad('0x86')]=function(_0x96fb27,_0x169402,_0x472750){return db[_0xb1ad('0x31')][_0xb1ad('0x52')]({'where':{'id':_0x96fb27[_0xb1ad('0x57')]['id']}})[_0xb1ad('0x28')](handleEntityNotFound(_0x169402,null))[_0xb1ad('0x28')](function(_0x5efbc9){if(_0x5efbc9){return _0x5efbc9['addAgents'](_0x96fb27['body'][_0xb1ad('0x68')],_[_0xb1ad('0x87')](_0x96fb27[_0xb1ad('0x56')],[_0xb1ad('0x68'),'id'])||{})[_0xb1ad('0x88')](function(_0x2cb6eb){for(var _0x2e388d=0x0;_0x2e388d<_0x96fb27['body'][_0xb1ad('0x68')]['length'];_0x2e388d+=0x1){socket['emit'](_0xb1ad('0x89'),{'UserId':Number(_0x96fb27[_0xb1ad('0x56')][_0xb1ad('0x68')][_0x2e388d]),'OpenchannelQueueId':Number(_0x96fb27[_0xb1ad('0x57')]['id'])});}return _0x2cb6eb;});}})[_0xb1ad('0x28')](respondWithResult(_0x169402,null))[_0xb1ad('0x49')](handleError(_0x169402,null));};exports[_0xb1ad('0x84')]=function(_0x47fe8d,_0x128081,_0x566468){return db[_0xb1ad('0x31')][_0xb1ad('0x52')]({'where':{'id':_0x47fe8d[_0xb1ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x128081,null))[_0xb1ad('0x28')](function(_0x4a7962){if(_0x4a7962){return _0x4a7962[_0xb1ad('0x84')](_0x47fe8d[_0xb1ad('0x38')]['ids'])[_0xb1ad('0x28')](function(){if(_[_0xb1ad('0x8a')](_0x47fe8d[_0xb1ad('0x38')][_0xb1ad('0x68')])){for(var _0x9da57e=0x0;_0x9da57e<_0x47fe8d['query'][_0xb1ad('0x68')]['length'];_0x9da57e+=0x1){socket[_0xb1ad('0x72')](_0xb1ad('0x85'),{'UserId':Number(_0x47fe8d['query'][_0xb1ad('0x68')][_0x9da57e]),'OpenchannelQueueId':Number(_0x47fe8d[_0xb1ad('0x57')]['id'])});}}else{socket[_0xb1ad('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x47fe8d[_0xb1ad('0x38')][_0xb1ad('0x68')]),'OpenchannelQueueId':Number(_0x47fe8d['params']['id'])});}});}})[_0xb1ad('0x28')](respondWithStatusCode(_0x128081,null))[_0xb1ad('0x49')](handleError(_0x128081,null));};exports[_0xb1ad('0x8b')]=function(_0x34d87c,_0x943810,_0x2bdc47){var _0x19afd7={};var _0x5948dc={};var _0x5768e9;var _0x1e831a;return db['OpenchannelQueue'][_0xb1ad('0x5a')]({'where':{'id':_0x34d87c[_0xb1ad('0x57')]['id']}})[_0xb1ad('0x28')](handleEntityNotFound(_0x943810,null))[_0xb1ad('0x28')](function(_0x30d5f1){if(_0x30d5f1){_0x5768e9=_0x30d5f1;_0x5948dc['model']=_[_0xb1ad('0x39')](db[_0xb1ad('0x5e')][_0xb1ad('0x32')]);_0x5948dc[_0xb1ad('0x38')]=_[_0xb1ad('0x39')](_0x34d87c['query']);_0x5948dc['filters']=_[_0xb1ad('0x3b')](_0x5948dc[_0xb1ad('0x36')],_0x5948dc[_0xb1ad('0x38')]);_0x19afd7['attributes']=_[_0xb1ad('0x3b')](_0x5948dc[_0xb1ad('0x36')],qs[_0xb1ad('0x3d')](_0x34d87c[_0xb1ad('0x38')][_0xb1ad('0x3d')]));_0x19afd7['attributes']=_0x19afd7[_0xb1ad('0x3c')][_0xb1ad('0x3e')]?_0x19afd7[_0xb1ad('0x3c')]:_0x5948dc[_0xb1ad('0x36')];_0x19afd7[_0xb1ad('0x41')]=qs['sort'](_0x34d87c[_0xb1ad('0x38')]['sort']);_0x19afd7[_0xb1ad('0x43')]=qs['filters'](_[_0xb1ad('0x5c')](_0x34d87c[_0xb1ad('0x38')],_0x5948dc[_0xb1ad('0x3a')]));if(_0x34d87c[_0xb1ad('0x38')][_0xb1ad('0x44')]){_0x19afd7['where']=_['merge'](_0x19afd7[_0xb1ad('0x43')],{'$or':_['map'](_0x19afd7[_0xb1ad('0x3c')],function(_0x2e0a0f){var _0x342aaa={};_0x342aaa[_0x2e0a0f]={'$like':'%'+_0x34d87c['query'][_0xb1ad('0x44')]+'%'};return _0x342aaa;})});}_0x19afd7=_[_0xb1ad('0x45')]({},_0x19afd7,_0x34d87c[_0xb1ad('0x5d')]);return _0x5768e9[_0xb1ad('0x8b')](_0x19afd7);}})['then'](function(_0x59cd1f){if(_0x59cd1f){_0x1e831a=_0x59cd1f[_0xb1ad('0x3e')];if(!_0x34d87c[_0xb1ad('0x38')][_0xb1ad('0x3f')](_0xb1ad('0x40'))){_0x19afd7[_0xb1ad('0x21')]=qs[_0xb1ad('0x21')](_0x34d87c['query'][_0xb1ad('0x21')]);_0x19afd7[_0xb1ad('0x1e')]=qs[_0xb1ad('0x1e')](_0x34d87c['query'][_0xb1ad('0x1e')]);}return _0x5768e9[_0xb1ad('0x8b')](_0x19afd7);}})[_0xb1ad('0x28')](function(_0x449f57){if(_0x449f57){return _0x449f57?{'count':_0x1e831a,'rows':_0x449f57}:null;}})[_0xb1ad('0x28')](respondWithResult(_0x943810,null))[_0xb1ad('0x49')](handleError(_0x943810,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 29b7772..3738d31 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 _0x4efc=['OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4efc,0x10c));var _0xc4ef=function(_0x2dc3b8,_0x3da0b5){_0x2dc3b8=_0x2dc3b8-0x0;var _0x33c437=_0x4efc[_0x2dc3b8];return _0x33c437;};'use strict';var EventEmitter=require(_0xc4ef('0x0'));var OpenchannelQueue=require(_0xc4ef('0x1'))['db'][_0xc4ef('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc4ef('0x3')](0x0);var events={'afterCreate':_0xc4ef('0x4'),'afterUpdate':'update','afterDestroy':_0xc4ef('0x5')};function emitEvent(_0x297efa){return function(_0x22c62d,_0x2236e1,_0x467145){OpenchannelQueueEvents[_0xc4ef('0x6')](_0x297efa+':'+_0x22c62d['id'],_0x22c62d);OpenchannelQueueEvents[_0xc4ef('0x6')](_0x297efa,_0x22c62d);_0x467145(null);};}for(var e in events){if(events[_0xc4ef('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xc4ef('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xf577=['save','update','remove','emit','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0xf577,0x12e));var _0x7f57=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xf577[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require(_0x7f57('0x0'));var OpenchannelQueue=require(_0x7f57('0x1'))['db'][_0x7f57('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7f57('0x3')](0x0);var events={'afterCreate':_0x7f57('0x4'),'afterUpdate':_0x7f57('0x5'),'afterDestroy':_0x7f57('0x6')};function emitEvent(_0x47b3b6){return function(_0x9a48c,_0x386ef8,_0x4c0189){OpenchannelQueueEvents[_0x7f57('0x7')](_0x47b3b6+':'+_0x9a48c['id'],_0x9a48c);OpenchannelQueueEvents[_0x7f57('0x7')](_0x47b3b6,_0x9a48c);_0x4c0189(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x7f57('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 4fd7a1b..113c6b3 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 _0xa849=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0xc73fb0,_0x282d0){var _0x4b082a=function(_0x41dcd0){while(--_0x41dcd0){_0xc73fb0['push'](_0xc73fb0['shift']());}};_0x4b082a(++_0x282d0);}(_0xa849,0x113));var _0x9a84=function(_0x198e37,_0x5cb7c4){_0x198e37=_0x198e37-0x0;var _0x482c3f=_0xa849[_0x198e37];return _0x482c3f;};'use strict';var _=require(_0x9a84('0x0'));var util=require('util');var logger=require(_0x9a84('0x1'))(_0x9a84('0x2'));var moment=require(_0x9a84('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a84('0x4'));var fs=require('fs');var path=require(_0x9a84('0x5'));var rimraf=require(_0x9a84('0x6'));var config=require(_0x9a84('0x7'));var attributes=require(_0x9a84('0x8'));module[_0x9a84('0x9')]=function(_0xf7273a,_0x493f5e){return _0xf7273a[_0x9a84('0xa')](_0x9a84('0xb'),attributes,{'tableName':_0x9a84('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa20=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x52ba0b,_0x4c8819){var _0x4f24cb=function(_0x2d18dd){while(--_0x2d18dd){_0x52ba0b['push'](_0x52ba0b['shift']());}};_0x4f24cb(++_0x4c8819);}(_0xaa20,0x1b1));var _0x0aa2=function(_0x19b600,_0x2c5860){_0x19b600=_0x19b600-0x0;var _0x32aff8=_0xaa20[_0x19b600];return _0x32aff8;};'use strict';var _=require(_0x0aa2('0x0'));var util=require('util');var logger=require(_0x0aa2('0x1'))('api');var moment=require(_0x0aa2('0x2'));var BPromise=require(_0x0aa2('0x3'));var rp=require(_0x0aa2('0x4'));var fs=require('fs');var path=require(_0x0aa2('0x5'));var rimraf=require('rimraf');var config=require(_0x0aa2('0x6'));var attributes=require(_0x0aa2('0x7'));module[_0x0aa2('0x8')]=function(_0x54c455,_0x58fc33){return _0x54c455[_0x0aa2('0x9')](_0x0aa2('0xa'),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 a51120f..94a7f7e 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 _0xe8df=['randomstring','ioredis','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find','catch','lodash','util','moment','bluebird'];(function(_0xf3e51,_0x55988e){var _0x1d7286=function(_0x567888){while(--_0x567888){_0xf3e51['push'](_0xf3e51['shift']());}};_0x1d7286(++_0x55988e);}(_0xe8df,0x134));var _0xfe8d=function(_0x3e25a9,_0xdded41){_0x3e25a9=_0x3e25a9-0x0;var _0x2d7e63=_0xe8df[_0x3e25a9];return _0x2d7e63;};'use strict';var _=require(_0xfe8d('0x0'));var util=require(_0xfe8d('0x1'));var moment=require(_0xfe8d('0x2'));var BPromise=require(_0xfe8d('0x3'));var rs=require(_0xfe8d('0x4'));var fs=require('fs');var Redis=require(_0xfe8d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfe8d('0x6'));var config=require(_0xfe8d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe8d('0x8')][_0xfe8d('0x9')]({'port':0x232a});config['redis']=_[_0xfe8d('0xa')](config[_0xfe8d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe8d('0xc'))(new Redis(config[_0xfe8d('0xb')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x285f63,_0x3e10ee,_0x3463bd){return new BPromise(function(_0x545da,_0x1e37df){return client[_0xfe8d('0xd')](_0x285f63,_0x3463bd)[_0xfe8d('0xe')](function(_0x586973){logger[_0xfe8d('0xf')](_0xfe8d('0x10'),_0x3e10ee,_0xfe8d('0x11'));logger['debug'](_0xfe8d('0x12'),_0x3e10ee,'request\x20sent',JSON[_0xfe8d('0x13')](_0x586973));if(_0x586973[_0xfe8d('0x14')]){if(_0x586973[_0xfe8d('0x14')][_0xfe8d('0x15')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3e10ee,_0x586973[_0xfe8d('0x14')][_0xfe8d('0x16')]);return _0x1e37df(_0x586973[_0xfe8d('0x14')][_0xfe8d('0x16')]);}logger[_0xfe8d('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x3e10ee,_0x586973['error'][_0xfe8d('0x16')]);return _0x545da(_0x586973[_0xfe8d('0x14')]['message']);}else{logger[_0xfe8d('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x3e10ee,'request\x20sent');_0x545da(_0x586973[_0xfe8d('0x17')][_0xfe8d('0x16')]);}})['catch'](function(_0x38096d){logger['error'](_0xfe8d('0x10'),_0x3e10ee,_0x38096d);_0x1e37df(_0x38096d);});});}exports[_0xfe8d('0x18')]=function(_0x2b3777){var _0x4cc4d3=this;return new Promise(function(_0x46b968,_0x55eef9){return db[_0xfe8d('0x19')][_0xfe8d('0x1a')]({'raw':_0x2b3777[_0xfe8d('0x1b')]?_0x2b3777[_0xfe8d('0x1b')][_0xfe8d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b3777['options']?_0x2b3777[_0xfe8d('0x1b')][_0xfe8d('0x1d')]||null:null,'attributes':_0x2b3777[_0xfe8d('0x1b')]?_0x2b3777['options'][_0xfe8d('0x1e')]||null:null,'limit':_0x2b3777[_0xfe8d('0x1b')]?_0x2b3777[_0xfe8d('0x1b')][_0xfe8d('0x1f')]||null:null,'include':_0x2b3777[_0xfe8d('0x1b')]?_0x2b3777[_0xfe8d('0x1b')][_0xfe8d('0x20')]?_[_0xfe8d('0x21')](_0x2b3777[_0xfe8d('0x1b')]['include'],function(_0x4334){return{'model':db[_0x4334[_0xfe8d('0x22')]],'as':_0x4334['as'],'attributes':_0x4334['attributes'],'include':_0x4334[_0xfe8d('0x20')]?_[_0xfe8d('0x21')](_0x4334['include'],function(_0x342224){return{'model':db[_0x342224[_0xfe8d('0x22')]],'as':_0x342224['as'],'attributes':_0x342224[_0xfe8d('0x1e')],'include':_0x342224[_0xfe8d('0x20')]?_[_0xfe8d('0x21')](_0x342224['include'],function(_0x54bc4b){return{'model':db[_0x54bc4b['model']],'as':_0x54bc4b['as'],'attributes':_0x54bc4b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x196204){logger[_0xfe8d('0xf')](_0xfe8d('0x18'),_0x2b3777);logger[_0xfe8d('0x23')]('GetOpenchannelQueue',_0x2b3777,JSON['stringify'](_0x196204));_0x46b968(_0x196204);})['catch'](function(_0x4f9c4){logger['error']('GetOpenchannelQueue',_0x4f9c4[_0xfe8d('0x16')],_0x2b3777);_0x55eef9(_0x4cc4d3[_0xfe8d('0x14')](0x1f4,_0x4f9c4[_0xfe8d('0x16')]));});});};exports[_0xfe8d('0x24')]=function(_0x1ec6c9){var _0x26090e=this;return new Promise(function(_0x12b4a0,_0x28e6e6){return db[_0xfe8d('0x19')][_0xfe8d('0x25')]({'raw':_0x1ec6c9['options']?_0x1ec6c9['options'][_0xfe8d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ec6c9[_0xfe8d('0x1b')]?_0x1ec6c9[_0xfe8d('0x1b')]['where']||null:null,'attributes':_0x1ec6c9[_0xfe8d('0x1b')]?_0x1ec6c9[_0xfe8d('0x1b')][_0xfe8d('0x1e')]||null:null,'include':_0x1ec6c9[_0xfe8d('0x1b')]?_0x1ec6c9[_0xfe8d('0x1b')][_0xfe8d('0x20')]?_[_0xfe8d('0x21')](_0x1ec6c9[_0xfe8d('0x1b')][_0xfe8d('0x20')],function(_0x51be23){return{'model':db[_0x51be23[_0xfe8d('0x22')]],'as':_0x51be23['as'],'attributes':_0x51be23[_0xfe8d('0x1e')],'include':_0x51be23[_0xfe8d('0x20')]?_['map'](_0x51be23['include'],function(_0x5ee486){return{'model':db[_0x5ee486[_0xfe8d('0x22')]],'as':_0x5ee486['as'],'attributes':_0x5ee486[_0xfe8d('0x1e')],'include':_0x5ee486[_0xfe8d('0x20')]?_[_0xfe8d('0x21')](_0x5ee486['include'],function(_0x10d9cd){return{'model':db[_0x10d9cd[_0xfe8d('0x22')]],'as':_0x10d9cd['as'],'attributes':_0x10d9cd[_0xfe8d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49bc3b){logger[_0xfe8d('0xf')](_0xfe8d('0x24'),_0x1ec6c9);logger[_0xfe8d('0x23')]('ShowOpenchannelQueue',_0x1ec6c9,JSON[_0xfe8d('0x13')](_0x49bc3b));_0x12b4a0(_0x49bc3b);})[_0xfe8d('0x26')](function(_0x2de6d7){logger[_0xfe8d('0x14')](_0xfe8d('0x24'),_0x2de6d7[_0xfe8d('0x16')],_0x1ec6c9);_0x28e6e6(_0x26090e[_0xfe8d('0x14')](0x1f4,_0x2de6d7[_0xfe8d('0x16')]));});});}; \ No newline at end of file +var _0xddf5=['request\x20sent','stringify','code','error','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xddf5,0x12b));var _0x5ddf=function(_0xc19935,_0x39c20b){_0xc19935=_0xc19935-0x0;var _0x18590a=_0xddf5[_0xc19935];return _0x18590a;};'use strict';var _=require(_0x5ddf('0x0'));var util=require(_0x5ddf('0x1'));var moment=require('moment');var BPromise=require(_0x5ddf('0x2'));var rs=require(_0x5ddf('0x3'));var fs=require('fs');var Redis=require(_0x5ddf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ddf('0x5'));var logger=require('../../config/logger')(_0x5ddf('0x6'));var config=require(_0x5ddf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ddf('0x8')][_0x5ddf('0x9')]({'port':0x232a});config[_0x5ddf('0xa')]=_[_0x5ddf('0xb')](config[_0x5ddf('0xa')],{'host':_0x5ddf('0xc'),'port':0x18eb});var socket=require(_0x5ddf('0xd'))(new Redis(config[_0x5ddf('0xa')]));require(_0x5ddf('0xe'))[_0x5ddf('0xf')](socket);function respondWithRpcPromise(_0x2e67f6,_0x13f86b,_0x37c533){return new BPromise(function(_0x3832fc,_0x429715){return client[_0x5ddf('0x10')](_0x2e67f6,_0x37c533)[_0x5ddf('0x11')](function(_0x8a9dc3){logger[_0x5ddf('0x12')](_0x5ddf('0x13'),_0x13f86b,'request\x20sent');logger[_0x5ddf('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x13f86b,_0x5ddf('0x15'),JSON[_0x5ddf('0x16')](_0x8a9dc3));if(_0x8a9dc3['error']){if(_0x8a9dc3['error'][_0x5ddf('0x17')]===0x1f4){logger[_0x5ddf('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x13f86b,_0x8a9dc3['error'][_0x5ddf('0x19')]);return _0x429715(_0x8a9dc3[_0x5ddf('0x18')][_0x5ddf('0x19')]);}logger['error'](_0x5ddf('0x13'),_0x13f86b,_0x8a9dc3[_0x5ddf('0x18')]['message']);return _0x3832fc(_0x8a9dc3[_0x5ddf('0x18')][_0x5ddf('0x19')]);}else{logger[_0x5ddf('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x13f86b,_0x5ddf('0x15'));_0x3832fc(_0x8a9dc3[_0x5ddf('0x1a')][_0x5ddf('0x19')]);}})[_0x5ddf('0x1b')](function(_0x38689b){logger['error'](_0x5ddf('0x13'),_0x13f86b,_0x38689b);_0x429715(_0x38689b);});});}exports['GetOpenchannelQueue']=function(_0x299803){var _0x1a28fd=this;return new Promise(function(_0x5c139d,_0x2c5e42){return db[_0x5ddf('0x1c')][_0x5ddf('0x1d')]({'raw':_0x299803[_0x5ddf('0x1e')]?_0x299803[_0x5ddf('0x1e')][_0x5ddf('0x1f')]===undefined?!![]:![]:!![],'where':_0x299803['options']?_0x299803[_0x5ddf('0x1e')][_0x5ddf('0x20')]||null:null,'attributes':_0x299803['options']?_0x299803[_0x5ddf('0x1e')][_0x5ddf('0x21')]||null:null,'limit':_0x299803[_0x5ddf('0x1e')]?_0x299803[_0x5ddf('0x1e')]['limit']||null:null,'include':_0x299803[_0x5ddf('0x1e')]?_0x299803[_0x5ddf('0x1e')][_0x5ddf('0x22')]?_[_0x5ddf('0x23')](_0x299803[_0x5ddf('0x1e')][_0x5ddf('0x22')],function(_0x5ec6c3){return{'model':db[_0x5ec6c3[_0x5ddf('0x24')]],'as':_0x5ec6c3['as'],'attributes':_0x5ec6c3[_0x5ddf('0x21')],'include':_0x5ec6c3['include']?_[_0x5ddf('0x23')](_0x5ec6c3['include'],function(_0xde0e39){return{'model':db[_0xde0e39[_0x5ddf('0x24')]],'as':_0xde0e39['as'],'attributes':_0xde0e39[_0x5ddf('0x21')],'include':_0xde0e39[_0x5ddf('0x22')]?_[_0x5ddf('0x23')](_0xde0e39[_0x5ddf('0x22')],function(_0x45bcab){return{'model':db[_0x45bcab[_0x5ddf('0x24')]],'as':_0x45bcab['as'],'attributes':_0x45bcab[_0x5ddf('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b7104){logger['info'](_0x5ddf('0x25'),_0x299803);logger['debug'](_0x5ddf('0x25'),_0x299803,JSON['stringify'](_0x1b7104));_0x5c139d(_0x1b7104);})[_0x5ddf('0x1b')](function(_0x2fade9){logger[_0x5ddf('0x18')](_0x5ddf('0x25'),_0x2fade9['message'],_0x299803);_0x2c5e42(_0x1a28fd['error'](0x1f4,_0x2fade9[_0x5ddf('0x19')]));});});};exports[_0x5ddf('0x26')]=function(_0x360a82){var _0xec585c=this;return new Promise(function(_0x4b070c,_0xff17e0){return db[_0x5ddf('0x1c')][_0x5ddf('0x27')]({'raw':_0x360a82['options']?_0x360a82[_0x5ddf('0x1e')][_0x5ddf('0x1f')]===undefined?!![]:![]:!![],'where':_0x360a82['options']?_0x360a82['options']['where']||null:null,'attributes':_0x360a82[_0x5ddf('0x1e')]?_0x360a82[_0x5ddf('0x1e')][_0x5ddf('0x21')]||null:null,'include':_0x360a82['options']?_0x360a82[_0x5ddf('0x1e')][_0x5ddf('0x22')]?_['map'](_0x360a82[_0x5ddf('0x1e')][_0x5ddf('0x22')],function(_0x195061){return{'model':db[_0x195061[_0x5ddf('0x24')]],'as':_0x195061['as'],'attributes':_0x195061[_0x5ddf('0x21')],'include':_0x195061[_0x5ddf('0x22')]?_[_0x5ddf('0x23')](_0x195061[_0x5ddf('0x22')],function(_0x437074){return{'model':db[_0x437074[_0x5ddf('0x24')]],'as':_0x437074['as'],'attributes':_0x437074[_0x5ddf('0x21')],'include':_0x437074[_0x5ddf('0x22')]?_[_0x5ddf('0x23')](_0x437074[_0x5ddf('0x22')],function(_0x58028f){return{'model':db[_0x58028f[_0x5ddf('0x24')]],'as':_0x58028f['as'],'attributes':_0x58028f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ddf('0x11')](function(_0x3caa4a){logger[_0x5ddf('0x12')]('ShowOpenchannelQueue',_0x360a82);logger[_0x5ddf('0x14')]('ShowOpenchannelQueue',_0x360a82,JSON['stringify'](_0x3caa4a));_0x4b070c(_0x3caa4a);})[_0x5ddf('0x1b')](function(_0x5aeabb){logger[_0x5ddf('0x18')](_0x5ddf('0x26'),_0x5aeabb[_0x5ddf('0x19')],_0x360a82);_0xff17e0(_0xec585c[_0x5ddf('0x18')](0x1f4,_0x5aeabb[_0x5ddf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index abb40c1..9b692aa 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 _0x07f4=['save','update','emit','removeListener','openchannelQueue:','./openchannelQueue.events'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x07f4,0xf5));var _0x407f=function(_0x4cedb2,_0x19aea1){_0x4cedb2=_0x4cedb2-0x0;var _0x42e068=_0x07f4[_0x4cedb2];return _0x42e068;};'use strict';var OpenchannelQueueEvents=require(_0x407f('0x0'));var events=[_0x407f('0x1'),'remove',_0x407f('0x2')];function createListener(_0x272e16,_0x35ad0c){return function(_0x537a2f){_0x35ad0c[_0x407f('0x3')](_0x272e16,_0x537a2f);};}function removeListener(_0x5a20ff,_0x1e3695){return function(){OpenchannelQueueEvents[_0x407f('0x4')](_0x5a20ff,_0x1e3695);};}exports['register']=function(_0x40cc93){for(var _0x4fb251=0x0,_0xd458df=events['length'];_0x4fb251<_0xd458df;_0x4fb251++){var _0x5e6cfa=events[_0x4fb251];var _0x223e79=createListener(_0x407f('0x5')+_0x5e6cfa,_0x40cc93);OpenchannelQueueEvents['on'](_0x5e6cfa,_0x223e79);}}; \ No newline at end of file +var _0xe426=['register','length','openchannelQueue:','./openchannelQueue.events','remove','update','removeListener'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xe426,0xf8));var _0x6e42=function(_0x27f448,_0x2ecd11){_0x27f448=_0x27f448-0x0;var _0x5e4f6e=_0xe426[_0x27f448];return _0x5e4f6e;};'use strict';var OpenchannelQueueEvents=require(_0x6e42('0x0'));var events=['save',_0x6e42('0x1'),_0x6e42('0x2')];function createListener(_0x1917b2,_0x29ce3c){return function(_0x239c39){_0x29ce3c['emit'](_0x1917b2,_0x239c39);};}function removeListener(_0x43c991,_0xf0aeca){return function(){OpenchannelQueueEvents[_0x6e42('0x3')](_0x43c991,_0xf0aeca);};}exports[_0x6e42('0x4')]=function(_0x534446){for(var _0x7807d8=0x0,_0xfaf712=events[_0x6e42('0x5')];_0x7807d8<_0xfaf712;_0x7807d8++){var _0x4d5d96=events[_0x7807d8];var _0x190e17=createListener(_0x6e42('0x6')+_0x4d5d96,_0x534446);OpenchannelQueueEvents['on'](_0x4d5d96,_0x190e17);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d085f3c..081f0c5 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 _0xed9d=['express','Router','fs-extra','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x5ce1d6,_0x5ac756){var _0x16fae8=function(_0x3c715c){while(--_0x3c715c){_0x5ce1d6['push'](_0x5ce1d6['shift']());}};_0x16fae8(++_0x5ac756);}(_0xed9d,0x107));var _0xded9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xed9d[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xded9('0x0'));var util=require(_0xded9('0x1'));var path=require('path');var timeout=require(_0xded9('0x2'));var express=require(_0xded9('0x3'));var router=express[_0xded9('0x4')]();var fs_extra=require(_0xded9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xded9('0x6'));var config=require('../../config/environment');var controller=require(_0xded9('0x7'));router['get']('/',auth[_0xded9('0x8')](),controller[_0xded9('0x9')]);router['get'](_0xded9('0xa'),auth[_0xded9('0x8')](),controller['describe']);router['get'](_0xded9('0xb'),auth[_0xded9('0x8')](),controller[_0xded9('0xc')]);router[_0xded9('0xd')]('/',auth[_0xded9('0x8')](),controller[_0xded9('0xe')]);router[_0xded9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xded9('0x10')]);router[_0xded9('0x11')](_0xded9('0xb'),auth[_0xded9('0x8')](),controller['destroy']);module[_0xded9('0x12')]=router; \ No newline at end of file +var _0x7263=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x7263,0xb7));var _0x3726=function(_0x34ed48,_0x138f2a){_0x34ed48=_0x34ed48-0x0;var _0xd114f4=_0x7263[_0x34ed48];return _0xd114f4;};'use strict';var multer=require(_0x3726('0x0'));var util=require(_0x3726('0x1'));var path=require(_0x3726('0x2'));var timeout=require('connect-timeout');var express=require(_0x3726('0x3'));var router=express[_0x3726('0x4')]();var fs_extra=require(_0x3726('0x5'));var auth=require(_0x3726('0x6'));var interaction=require(_0x3726('0x7'));var config=require(_0x3726('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x3726('0x9')]('/',auth[_0x3726('0xa')](),controller[_0x3726('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3726('0xc')]);router[_0x3726('0x9')](_0x3726('0xd'),auth['isAuthenticated'](),controller[_0x3726('0xe')]);router['post']('/',auth[_0x3726('0xa')](),controller['create']);router[_0x3726('0xf')](_0x3726('0xd'),auth[_0x3726('0xa')](),controller[_0x3726('0x10')]);router[_0x3726('0x11')](_0x3726('0xd'),auth[_0x3726('0xa')](),controller[_0x3726('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 338852a..cc982d4 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 _0x1134=['moment','sequelize','STRING','DATE'];(function(_0x4d0887,_0x457af5){var _0x13005e=function(_0xac0e57){while(--_0xac0e57){_0x4d0887['push'](_0x4d0887['shift']());}};_0x13005e(++_0x457af5);}(_0x1134,0x19c));var _0x4113=function(_0x2855e4,_0x37f348){_0x2855e4=_0x2855e4-0x0;var _0x3622c1=_0x1134[_0x2855e4];return _0x3622c1;};'use strict';var moment=require(_0x4113('0x0'));var Sequelize=require(_0x4113('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4113('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4113('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4113('0x3')]},'acceptAt':{'type':Sequelize[_0x4113('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4113('0x2')]}}; \ No newline at end of file +var _0xdc03=['STRING','DATE','sequelize','exports'];(function(_0x660dca,_0x463d81){var _0x5790b6=function(_0x18ce82){while(--_0x18ce82){_0x660dca['push'](_0x660dca['shift']());}};_0x5790b6(++_0x463d81);}(_0xdc03,0x122));var _0x3dc0=function(_0x57252e,_0x1c963a){_0x57252e=_0x57252e-0x0;var _0x4a9b26=_0xdc03[_0x57252e];return _0x4a9b26;};'use strict';var moment=require('moment');var Sequelize=require(_0x3dc0('0x0'));module[_0x3dc0('0x1')]={'uniqueid':{'type':Sequelize[_0x3dc0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3dc0('0x2')]},'joinAt':{'type':Sequelize[_0x3dc0('0x3')]},'leaveAt':{'type':Sequelize[_0x3dc0('0x3')]},'acceptAt':{'type':Sequelize[_0x3dc0('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3dc0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index bc2e193..bf50bea 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 _0xc0a3=['end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelQueueReport','findAll','rows','show','params','keys','rawAttributes','length','catch','create','body','destroy','find','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x447549,_0x17b900){var _0x428b4d=function(_0x4617d5){while(--_0x4617d5){_0x447549['push'](_0x447549['shift']());}};_0x428b4d(++_0x17b900);}(_0xc0a3,0x117));var _0x3c0a=function(_0x3d3e03,_0x322473){_0x3d3e03=_0x3d3e03-0x0;var _0x2fb8a5=_0xc0a3[_0x3d3e03];return _0x2fb8a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c0a('0x0'));var zipdir=require(_0x3c0a('0x1'));var jsonpatch=require(_0x3c0a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3c0a('0x3'));var util=require('util');var path=require(_0x3c0a('0x4'));var sox=require(_0x3c0a('0x5'));var csv=require(_0x3c0a('0x6'));var ejs=require(_0x3c0a('0x7'));var fs=require('fs');var fs_extra=require(_0x3c0a('0x8'));var _=require(_0x3c0a('0x9'));var squel=require(_0x3c0a('0xa'));var crypto=require(_0x3c0a('0xb'));var jsforce=require(_0x3c0a('0xc'));var deskjs=require(_0x3c0a('0xd'));var toCsv=require(_0x3c0a('0x6'));var querystring=require(_0x3c0a('0xe'));var Papa=require(_0x3c0a('0xf'));var Redis=require(_0x3c0a('0x10'));var authService=require(_0x3c0a('0x11'));var qs=require(_0x3c0a('0x12'));var as=require(_0x3c0a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c0a('0x14'))('api');var utils=require(_0x3c0a('0x15'));var config=require(_0x3c0a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x483eb0,_0x32f50c){_0x32f50c=_0x32f50c||0xcc;return function(_0x1c2418){if(_0x1c2418){return _0x483eb0[_0x3c0a('0x17')](_0x32f50c);}return _0x483eb0[_0x3c0a('0x18')](_0x32f50c)[_0x3c0a('0x19')]();};}function respondWithResult(_0x2fa389,_0x3e01b6){_0x3e01b6=_0x3e01b6||0xc8;return function(_0x573764){if(_0x573764){return _0x2fa389['status'](_0x3e01b6)[_0x3c0a('0x1a')](_0x573764);}};}function respondWithFilteredResult(_0xf97745,_0x582af7){return function(_0x4475de){if(_0x4475de){var _0x2fd287=typeof _0x582af7['offset']===_0x3c0a('0x1b')&&typeof _0x582af7['limit']==='undefined';var _0x404e49=_0x4475de[_0x3c0a('0x1c')];var _0x4e6116=_0x2fd287?0x0:_0x582af7[_0x3c0a('0x1d')];var _0x309280=_0x2fd287?_0x4475de['count']:_0x582af7['offset']+_0x582af7[_0x3c0a('0x1e')];var _0x1e62d2;if(_0x309280>=_0x404e49){_0x309280=_0x404e49;_0x1e62d2=0xc8;}else{_0x1e62d2=0xce;}_0xf97745[_0x3c0a('0x18')](_0x1e62d2);return _0xf97745[_0x3c0a('0x1f')](_0x3c0a('0x20'),_0x4e6116+'-'+_0x309280+'/'+_0x404e49)[_0x3c0a('0x1a')](_0x4475de);}return null;};}function patchUpdates(_0x2f36c8){return function(_0x2f7749){try{jsonpatch[_0x3c0a('0x21')](_0x2f7749,_0x2f36c8,!![]);}catch(_0x59baf2){return BPromise[_0x3c0a('0x22')](_0x59baf2);}return _0x2f7749[_0x3c0a('0x23')]();};}function saveUpdates(_0x5decb,_0x143bfd){return function(_0x1fe39c){if(_0x1fe39c){return _0x1fe39c[_0x3c0a('0x24')](_0x5decb)[_0x3c0a('0x25')](function(_0x4a5a87){return _0x4a5a87;});}return null;};}function removeEntity(_0x1033e8,_0x56a6d4){return function(_0x2d6e51){if(_0x2d6e51){return _0x2d6e51['destroy']()[_0x3c0a('0x25')](function(){_0x1033e8['status'](0xcc)[_0x3c0a('0x19')]();});}};}function handleEntityNotFound(_0x51d446,_0x3157fa){return function(_0x3f318d){if(!_0x3f318d){_0x51d446[_0x3c0a('0x17')](0x194);}return _0x3f318d;};}function handleError(_0x119d9d,_0x3e433d){_0x3e433d=_0x3e433d||0x1f4;return function(_0x2ac832){logger[_0x3c0a('0x26')](_0x2ac832[_0x3c0a('0x27')]);if(_0x2ac832[_0x3c0a('0x28')]){delete _0x2ac832[_0x3c0a('0x28')];}_0x119d9d[_0x3c0a('0x18')](_0x3e433d)[_0x3c0a('0x29')](_0x2ac832);};}exports['index']=function(_0x2e1476,_0x4cacaa){var _0x229470={},_0x5c5417={},_0x31c238={'count':0x0,'rows':[]};var _0x2c30f2=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x580a63){return{'name':_0x580a63[_0x3c0a('0x2a')],'type':_0x580a63[_0x3c0a('0x2b')][_0x3c0a('0x2c')]};});_0x5c5417[_0x3c0a('0x2d')]=_[_0x3c0a('0x2e')](_0x2c30f2,_0x3c0a('0x28'));_0x5c5417[_0x3c0a('0x2f')]=_['keys'](_0x2e1476[_0x3c0a('0x2f')]);_0x5c5417[_0x3c0a('0x30')]=_['intersection'](_0x5c5417[_0x3c0a('0x2d')],_0x5c5417[_0x3c0a('0x2f')]);_0x229470[_0x3c0a('0x31')]=_[_0x3c0a('0x32')](_0x5c5417['model'],qs[_0x3c0a('0x33')](_0x2e1476[_0x3c0a('0x2f')]['fields']));_0x229470['attributes']=_0x229470['attributes']['length']?_0x229470[_0x3c0a('0x31')]:_0x5c5417[_0x3c0a('0x2d')];if(!_0x2e1476['query']['hasOwnProperty'](_0x3c0a('0x34'))){_0x229470[_0x3c0a('0x1e')]=qs['limit'](_0x2e1476['query'][_0x3c0a('0x1e')]);_0x229470[_0x3c0a('0x1d')]=qs[_0x3c0a('0x1d')](_0x2e1476[_0x3c0a('0x2f')][_0x3c0a('0x1d')]);}_0x229470[_0x3c0a('0x35')]=qs[_0x3c0a('0x36')](_0x2e1476[_0x3c0a('0x2f')][_0x3c0a('0x36')]);_0x229470[_0x3c0a('0x37')]=qs[_0x3c0a('0x30')](_[_0x3c0a('0x38')](_0x2e1476[_0x3c0a('0x2f')],_0x5c5417[_0x3c0a('0x30')]),_0x2c30f2);if(_0x2e1476[_0x3c0a('0x2f')][_0x3c0a('0x39')]){_0x229470[_0x3c0a('0x37')]=_[_0x3c0a('0x3a')](_0x229470[_0x3c0a('0x37')],{'$or':_[_0x3c0a('0x2e')](_0x2c30f2,function(_0x265244){if(_0x265244['type']!==_0x3c0a('0x3b')){var _0x26743d={};_0x26743d[_0x265244[_0x3c0a('0x28')]]={'$like':'%'+_0x2e1476[_0x3c0a('0x2f')][_0x3c0a('0x39')]+'%'};return _0x26743d;}})});}_0x229470=_['merge']({},_0x229470,_0x2e1476[_0x3c0a('0x3c')]);var _0x5d27d6={'where':_0x229470['where']};return db['OpenchannelQueueReport']['count'](_0x5d27d6)['then'](function(_0x278473){_0x31c238[_0x3c0a('0x1c')]=_0x278473;if(_0x2e1476['query'][_0x3c0a('0x3d')]){_0x229470[_0x3c0a('0x3e')]=[{'all':!![]}];}return db[_0x3c0a('0x3f')][_0x3c0a('0x40')](_0x229470);})[_0x3c0a('0x25')](function(_0x2e746d){_0x31c238[_0x3c0a('0x41')]=_0x2e746d;return _0x31c238;})[_0x3c0a('0x25')](respondWithFilteredResult(_0x4cacaa,_0x229470))['catch'](handleError(_0x4cacaa,null));};exports[_0x3c0a('0x42')]=function(_0xc350c8,_0xf63deb){var _0x175d4c={'raw':!![],'where':{'id':_0xc350c8[_0x3c0a('0x43')]['id']}},_0x41661c={};_0x41661c['model']=_[_0x3c0a('0x44')](db[_0x3c0a('0x3f')][_0x3c0a('0x45')]);_0x41661c['query']=_[_0x3c0a('0x44')](_0xc350c8['query']);_0x41661c[_0x3c0a('0x30')]=_['intersection'](_0x41661c[_0x3c0a('0x2d')],_0x41661c['query']);_0x175d4c[_0x3c0a('0x31')]=_['intersection'](_0x41661c[_0x3c0a('0x2d')],qs[_0x3c0a('0x33')](_0xc350c8[_0x3c0a('0x2f')][_0x3c0a('0x33')]));_0x175d4c['attributes']=_0x175d4c[_0x3c0a('0x31')][_0x3c0a('0x46')]?_0x175d4c[_0x3c0a('0x31')]:_0x41661c[_0x3c0a('0x2d')];if(_0xc350c8[_0x3c0a('0x2f')][_0x3c0a('0x3d')]){_0x175d4c[_0x3c0a('0x3e')]=[{'all':!![]}];}_0x175d4c=_[_0x3c0a('0x3a')]({},_0x175d4c,_0xc350c8[_0x3c0a('0x3c')]);return db[_0x3c0a('0x3f')]['find'](_0x175d4c)[_0x3c0a('0x25')](handleEntityNotFound(_0xf63deb,null))[_0x3c0a('0x25')](respondWithResult(_0xf63deb,null))[_0x3c0a('0x47')](handleError(_0xf63deb,null));};exports[_0x3c0a('0x48')]=function(_0x2f01a4,_0x23145b){return db[_0x3c0a('0x3f')][_0x3c0a('0x48')](_0x2f01a4[_0x3c0a('0x49')],{})[_0x3c0a('0x25')](respondWithResult(_0x23145b,0xc9))[_0x3c0a('0x47')](handleError(_0x23145b,null));};exports[_0x3c0a('0x24')]=function(_0x46b734,_0x26b917){if(_0x46b734[_0x3c0a('0x49')]['id']){delete _0x46b734[_0x3c0a('0x49')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x46b734[_0x3c0a('0x43')]['id']}})[_0x3c0a('0x25')](handleEntityNotFound(_0x26b917,null))[_0x3c0a('0x25')](saveUpdates(_0x46b734['body'],null))[_0x3c0a('0x25')](respondWithResult(_0x26b917,null))['catch'](handleError(_0x26b917,null));};exports[_0x3c0a('0x4a')]=function(_0x52372e,_0x50a3f0){return db[_0x3c0a('0x3f')][_0x3c0a('0x4b')]({'where':{'id':_0x52372e[_0x3c0a('0x43')]['id']}})[_0x3c0a('0x25')](handleEntityNotFound(_0x50a3f0,null))[_0x3c0a('0x25')](removeEntity(_0x50a3f0,null))[_0x3c0a('0x47')](handleError(_0x50a3f0,null));};exports['describe']=function(_0x8fe2db,_0x20ad0b){return db[_0x3c0a('0x3f')]['describe']()[_0x3c0a('0x25')](respondWithResult(_0x20ad0b,null))[_0x3c0a('0x47')](handleError(_0x20ad0b,null));}; \ No newline at end of file +var _0x1930=['params','keys','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show'];(function(_0x56f2c7,_0x2fc2c8){var _0x1a235a=function(_0x4ddac5){while(--_0x4ddac5){_0x56f2c7['push'](_0x56f2c7['shift']());}};_0x1a235a(++_0x2fc2c8);}(_0x1930,0x14c));var _0x0193=function(_0x325821,_0x294d91){_0x325821=_0x325821-0x0;var _0xcf8dad=_0x1930[_0x325821];return _0xcf8dad;};'use strict';var emlformat=require(_0x0193('0x0'));var rimraf=require(_0x0193('0x1'));var zipdir=require(_0x0193('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0193('0x3'));var moment=require(_0x0193('0x4'));var BPromise=require(_0x0193('0x5'));var Mustache=require('mustache');var util=require(_0x0193('0x6'));var path=require(_0x0193('0x7'));var sox=require(_0x0193('0x8'));var csv=require(_0x0193('0x9'));var ejs=require(_0x0193('0xa'));var fs=require('fs');var fs_extra=require(_0x0193('0xb'));var _=require(_0x0193('0xc'));var squel=require(_0x0193('0xd'));var crypto=require(_0x0193('0xe'));var jsforce=require(_0x0193('0xf'));var deskjs=require(_0x0193('0x10'));var toCsv=require(_0x0193('0x9'));var querystring=require(_0x0193('0x11'));var Papa=require(_0x0193('0x12'));var Redis=require(_0x0193('0x13'));var authService=require(_0x0193('0x14'));var qs=require(_0x0193('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0193('0x16'));var logger=require(_0x0193('0x17'))(_0x0193('0x18'));var utils=require(_0x0193('0x19'));var config=require(_0x0193('0x1a'));var licenseUtil=require(_0x0193('0x1b'));var db=require(_0x0193('0x1c'))['db'];function respondWithStatusCode(_0x118ebf,_0x9a260a){_0x9a260a=_0x9a260a||0xcc;return function(_0x5ab7b0){if(_0x5ab7b0){return _0x118ebf[_0x0193('0x1d')](_0x9a260a);}return _0x118ebf['status'](_0x9a260a)[_0x0193('0x1e')]();};}function respondWithResult(_0x199c43,_0x408e87){_0x408e87=_0x408e87||0xc8;return function(_0x5bd6c1){if(_0x5bd6c1){return _0x199c43[_0x0193('0x1f')](_0x408e87)['json'](_0x5bd6c1);}};}function respondWithFilteredResult(_0xf68066,_0x5b7eef){return function(_0x5c743f){if(_0x5c743f){var _0x295f7b=typeof _0x5b7eef['offset']===_0x0193('0x20')&&typeof _0x5b7eef[_0x0193('0x21')]===_0x0193('0x20');var _0x15f448=_0x5c743f[_0x0193('0x22')];var _0x152579=_0x295f7b?0x0:_0x5b7eef[_0x0193('0x23')];var _0x20114b=_0x295f7b?_0x5c743f[_0x0193('0x22')]:_0x5b7eef['offset']+_0x5b7eef[_0x0193('0x21')];var _0x346db3;if(_0x20114b>=_0x15f448){_0x20114b=_0x15f448;_0x346db3=0xc8;}else{_0x346db3=0xce;}_0xf68066[_0x0193('0x1f')](_0x346db3);return _0xf68066['set'](_0x0193('0x24'),_0x152579+'-'+_0x20114b+'/'+_0x15f448)[_0x0193('0x25')](_0x5c743f);}return null;};}function patchUpdates(_0x3f7501){return function(_0x85d783){try{jsonpatch['apply'](_0x85d783,_0x3f7501,!![]);}catch(_0x28662d){return BPromise[_0x0193('0x26')](_0x28662d);}return _0x85d783[_0x0193('0x27')]();};}function saveUpdates(_0x4c4059,_0x37abd8){return function(_0x57c1fa){if(_0x57c1fa){return _0x57c1fa[_0x0193('0x28')](_0x4c4059)[_0x0193('0x29')](function(_0x12abcd){return _0x12abcd;});}return null;};}function removeEntity(_0x4362b8,_0x3f2f3e){return function(_0x21d050){if(_0x21d050){return _0x21d050['destroy']()['then'](function(){_0x4362b8[_0x0193('0x1f')](0xcc)[_0x0193('0x1e')]();});}};}function handleEntityNotFound(_0x591d29,_0x5260b4){return function(_0x44b287){if(!_0x44b287){_0x591d29[_0x0193('0x1d')](0x194);}return _0x44b287;};}function handleError(_0x483749,_0x1a9bd9){_0x1a9bd9=_0x1a9bd9||0x1f4;return function(_0x17a21c){logger[_0x0193('0x2a')](_0x17a21c['stack']);if(_0x17a21c['name']){delete _0x17a21c[_0x0193('0x2b')];}_0x483749[_0x0193('0x1f')](_0x1a9bd9)[_0x0193('0x2c')](_0x17a21c);};}exports[_0x0193('0x2d')]=function(_0x4be303,_0x300034){var _0x403858={},_0x22d0fa={},_0x45a76f={'count':0x0,'rows':[]};var _0x5200ac=_[_0x0193('0x2e')](db[_0x0193('0x2f')][_0x0193('0x30')],function(_0x201e68){return{'name':_0x201e68[_0x0193('0x31')],'type':_0x201e68[_0x0193('0x32')][_0x0193('0x33')]};});_0x22d0fa[_0x0193('0x34')]=_['map'](_0x5200ac,_0x0193('0x2b'));_0x22d0fa[_0x0193('0x35')]=_['keys'](_0x4be303[_0x0193('0x35')]);_0x22d0fa[_0x0193('0x36')]=_[_0x0193('0x37')](_0x22d0fa['model'],_0x22d0fa[_0x0193('0x35')]);_0x403858[_0x0193('0x38')]=_[_0x0193('0x37')](_0x22d0fa['model'],qs[_0x0193('0x39')](_0x4be303['query']['fields']));_0x403858[_0x0193('0x38')]=_0x403858[_0x0193('0x38')]['length']?_0x403858['attributes']:_0x22d0fa['model'];if(!_0x4be303[_0x0193('0x35')][_0x0193('0x3a')](_0x0193('0x3b'))){_0x403858[_0x0193('0x21')]=qs[_0x0193('0x21')](_0x4be303[_0x0193('0x35')]['limit']);_0x403858[_0x0193('0x23')]=qs['offset'](_0x4be303[_0x0193('0x35')][_0x0193('0x23')]);}_0x403858[_0x0193('0x3c')]=qs['sort'](_0x4be303['query'][_0x0193('0x3d')]);_0x403858[_0x0193('0x3e')]=qs[_0x0193('0x36')](_[_0x0193('0x3f')](_0x4be303[_0x0193('0x35')],_0x22d0fa[_0x0193('0x36')]),_0x5200ac);if(_0x4be303[_0x0193('0x35')][_0x0193('0x40')]){_0x403858[_0x0193('0x3e')]=_['merge'](_0x403858[_0x0193('0x3e')],{'$or':_[_0x0193('0x2e')](_0x5200ac,function(_0x3937a0){if(_0x3937a0[_0x0193('0x32')]!==_0x0193('0x41')){var _0x48413b={};_0x48413b[_0x3937a0[_0x0193('0x2b')]]={'$like':'%'+_0x4be303['query'][_0x0193('0x40')]+'%'};return _0x48413b;}})});}_0x403858=_[_0x0193('0x42')]({},_0x403858,_0x4be303[_0x0193('0x43')]);var _0x5bceb7={'where':_0x403858[_0x0193('0x3e')]};return db[_0x0193('0x2f')][_0x0193('0x22')](_0x5bceb7)['then'](function(_0x53c910){_0x45a76f[_0x0193('0x22')]=_0x53c910;if(_0x4be303[_0x0193('0x35')]['includeAll']){_0x403858[_0x0193('0x44')]=[{'all':!![]}];}return db[_0x0193('0x2f')][_0x0193('0x45')](_0x403858);})[_0x0193('0x29')](function(_0x375c9a){_0x45a76f[_0x0193('0x46')]=_0x375c9a;return _0x45a76f;})['then'](respondWithFilteredResult(_0x300034,_0x403858))[_0x0193('0x47')](handleError(_0x300034,null));};exports[_0x0193('0x48')]=function(_0x4920a6,_0x32aaef){var _0x1ba930={'raw':!![],'where':{'id':_0x4920a6[_0x0193('0x49')]['id']}},_0x60a8e5={};_0x60a8e5[_0x0193('0x34')]=_[_0x0193('0x4a')](db[_0x0193('0x2f')][_0x0193('0x30')]);_0x60a8e5[_0x0193('0x35')]=_['keys'](_0x4920a6[_0x0193('0x35')]);_0x60a8e5[_0x0193('0x36')]=_[_0x0193('0x37')](_0x60a8e5[_0x0193('0x34')],_0x60a8e5[_0x0193('0x35')]);_0x1ba930['attributes']=_['intersection'](_0x60a8e5['model'],qs[_0x0193('0x39')](_0x4920a6['query'][_0x0193('0x39')]));_0x1ba930['attributes']=_0x1ba930[_0x0193('0x38')][_0x0193('0x4b')]?_0x1ba930[_0x0193('0x38')]:_0x60a8e5['model'];if(_0x4920a6[_0x0193('0x35')]['includeAll']){_0x1ba930['include']=[{'all':!![]}];}_0x1ba930=_[_0x0193('0x42')]({},_0x1ba930,_0x4920a6[_0x0193('0x43')]);return db[_0x0193('0x2f')][_0x0193('0x4c')](_0x1ba930)[_0x0193('0x29')](handleEntityNotFound(_0x32aaef,null))[_0x0193('0x29')](respondWithResult(_0x32aaef,null))[_0x0193('0x47')](handleError(_0x32aaef,null));};exports[_0x0193('0x4d')]=function(_0x33a732,_0xb90c20){return db['OpenchannelQueueReport']['create'](_0x33a732[_0x0193('0x4e')],{})['then'](respondWithResult(_0xb90c20,0xc9))[_0x0193('0x47')](handleError(_0xb90c20,null));};exports[_0x0193('0x28')]=function(_0x2e002f,_0x106cbe){if(_0x2e002f[_0x0193('0x4e')]['id']){delete _0x2e002f[_0x0193('0x4e')]['id'];}return db[_0x0193('0x2f')]['find']({'where':{'id':_0x2e002f[_0x0193('0x49')]['id']}})[_0x0193('0x29')](handleEntityNotFound(_0x106cbe,null))[_0x0193('0x29')](saveUpdates(_0x2e002f[_0x0193('0x4e')],null))[_0x0193('0x29')](respondWithResult(_0x106cbe,null))['catch'](handleError(_0x106cbe,null));};exports[_0x0193('0x4f')]=function(_0x1448ee,_0x37084a){return db[_0x0193('0x2f')][_0x0193('0x4c')]({'where':{'id':_0x1448ee[_0x0193('0x49')]['id']}})[_0x0193('0x29')](handleEntityNotFound(_0x37084a,null))[_0x0193('0x29')](removeEntity(_0x37084a,null))[_0x0193('0x47')](handleError(_0x37084a,null));};exports[_0x0193('0x50')]=function(_0x22f363,_0x40e555){return db[_0x0193('0x2f')]['describe']()[_0x0193('0x29')](respondWithResult(_0x40e555,null))['catch'](handleError(_0x40e555,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 293a3bb..e5f66bb 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x30628c,_0x3f7251){var _0x15002d=function(_0x3f4e7d){while(--_0x3f4e7d){_0x30628c['push'](_0x30628c['shift']());}};_0x15002d(++_0x3f7251);}(_0xe14b,0x93));var _0xbe14=function(_0x1aeba6,_0x2ca4a3){_0x1aeba6=_0x1aeba6-0x0;var _0x31f61c=_0xe14b[_0x1aeba6];return _0x31f61c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x938a4a,_0x2d23a1){var _0x3c0a4d=function(_0x4d73aa){while(--_0x4d73aa){_0x938a4a['push'](_0x938a4a['shift']());}};_0x3c0a4d(++_0x2d23a1);}(_0x7a54,0x106));var _0x47a5=function(_0xf9df55,_0x4ecdf9){_0xf9df55=_0xf9df55-0x0;var _0x4d982b=_0x7a54[_0xf9df55];return _0x4d982b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index bbc0761..e3bc187 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 _0x8cda=['catch','create','body','options','raw','then','CreateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent'];(function(_0x11f0e1,_0x520662){var _0x383b23=function(_0x397ed4){while(--_0x397ed4){_0x11f0e1['push'](_0x11f0e1['shift']());}};_0x383b23(++_0x520662);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var moment=require(_0xa8cd('0x1'));var BPromise=require(_0xa8cd('0x2'));var rs=require(_0xa8cd('0x3'));var fs=require('fs');var Redis=require(_0xa8cd('0x4'));var db=require(_0xa8cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8cd('0x6'))(_0xa8cd('0x7'));var config=require(_0xa8cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8cd('0x9')][_0xa8cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1362c3,_0x273d2f,_0x2b9b51){return new BPromise(function(_0x2481ba,_0x13f394){return client[_0xa8cd('0xb')](_0x1362c3,_0x2b9b51)['then'](function(_0x50b8ee){logger['info'](_0xa8cd('0xc'),_0x273d2f,'request\x20sent');logger[_0xa8cd('0xd')](_0xa8cd('0xe'),_0x273d2f,'request\x20sent',JSON[_0xa8cd('0xf')](_0x50b8ee));if(_0x50b8ee[_0xa8cd('0x10')]){if(_0x50b8ee['error']['code']===0x1f4){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x50b8ee[_0xa8cd('0x10')][_0xa8cd('0x11')]);return _0x13f394(_0x50b8ee[_0xa8cd('0x10')]['message']);}logger[_0xa8cd('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x273d2f,_0x50b8ee[_0xa8cd('0x10')]['message']);return _0x2481ba(_0x50b8ee[_0xa8cd('0x10')]['message']);}else{logger[_0xa8cd('0x12')](_0xa8cd('0xc'),_0x273d2f,_0xa8cd('0x13'));_0x2481ba(_0x50b8ee['result']['message']);}})[_0xa8cd('0x14')](function(_0x6d5f40){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x6d5f40);_0x13f394(_0x6d5f40);});});}exports['CreateOpenchannelQueueReport']=function(_0x128a90){var _0x52252b=this;return new Promise(function(_0x1cacd5,_0x2ef224){return db['OpenchannelQueueReport'][_0xa8cd('0x15')](_0x128a90[_0xa8cd('0x16')],{'raw':_0x128a90['options']?_0x128a90[_0xa8cd('0x17')][_0xa8cd('0x18')]===undefined?!![]:![]:!![]})[_0xa8cd('0x19')](function(_0x289cb6){logger[_0xa8cd('0x12')]('CreateOpenchannelQueueReport',_0x128a90);logger[_0xa8cd('0xd')](_0xa8cd('0x1a'),_0x128a90,JSON[_0xa8cd('0xf')](_0x289cb6));_0x1cacd5(_0x289cb6);})[_0xa8cd('0x14')](function(_0x4f4093){logger[_0xa8cd('0x10')]('CreateOpenchannelQueueReport',_0x4f4093['message'],_0x128a90);_0x2ef224(_0x52252b[_0xa8cd('0x10')](0x1f4,_0x4f4093[_0xa8cd('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1c7b31){var _0x26d35a=this;return new Promise(function(_0xfd170,_0x43462d){return db[_0xa8cd('0x1b')][_0xa8cd('0x1c')](_0x1c7b31[_0xa8cd('0x16')],{'raw':_0x1c7b31['options']?_0x1c7b31[_0xa8cd('0x17')][_0xa8cd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7b31[_0xa8cd('0x17')]?_0x1c7b31[_0xa8cd('0x17')][_0xa8cd('0x1d')]||null:null,'attributes':_0x1c7b31[_0xa8cd('0x17')]?_0x1c7b31['options'][_0xa8cd('0x1e')]||null:null,'limit':_0x1c7b31[_0xa8cd('0x17')]?_0x1c7b31[_0xa8cd('0x17')][_0xa8cd('0x1f')]||null:null})[_0xa8cd('0x19')](function(_0x2241f8){logger[_0xa8cd('0x12')](_0xa8cd('0x20'),_0x1c7b31);logger[_0xa8cd('0xd')](_0xa8cd('0x20'),_0x1c7b31,JSON[_0xa8cd('0xf')](_0x2241f8));_0xfd170(_0x2241f8);})[_0xa8cd('0x14')](function(_0x471052){logger[_0xa8cd('0x10')](_0xa8cd('0x20'),_0x471052[_0xa8cd('0x11')],_0x1c7b31);_0x43462d(_0x26d35a['error'](0x1f4,_0x471052['message']));});});}; \ No newline at end of file +var _0xe1e3=['raw','debug','catch','OpenchannelQueueReport','update','body','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','CreateOpenchannelQueueReport','options'];(function(_0x209653,_0x3cef6f){var _0x28feae=function(_0x2659e2){while(--_0x2659e2){_0x209653['push'](_0x209653['shift']());}};_0x28feae(++_0x3cef6f);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x5e1997,_0x41c17e){_0x5e1997=_0x5e1997-0x0;var _0x257c01=_0xe1e3[_0x5e1997];return _0x257c01;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['OpenchannelQueueReport']['create'](_0x1d786c['body'],{'raw':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c5acd){logger['info'](_0x3e1e('0x14'),_0x1d786c);logger[_0x3e1e('0x17')](_0x3e1e('0x14'),_0x1d786c,JSON['stringify'](_0x1c5acd));_0x791ed8(_0x1c5acd);})[_0x3e1e('0x18')](function(_0x96396){logger[_0x3e1e('0xf')]('CreateOpenchannelQueueReport',_0x96396['message'],_0x1d786c);_0x1c181b(_0x39eaa7[_0x3e1e('0xf')](0x1f4,_0x96396[_0x3e1e('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x60e6bc){var _0x56ae51=this;return new Promise(function(_0x164b15,_0x33bf0f){return db[_0x3e1e('0x19')][_0x3e1e('0x1a')](_0x60e6bc[_0x3e1e('0x1b')],{'raw':_0x60e6bc[_0x3e1e('0x15')]?_0x60e6bc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60e6bc[_0x3e1e('0x15')]?_0x60e6bc[_0x3e1e('0x15')]['where']||null:null,'attributes':_0x60e6bc['options']?_0x60e6bc['options'][_0x3e1e('0x1c')]||null:null,'limit':_0x60e6bc[_0x3e1e('0x15')]?_0x60e6bc['options'][_0x3e1e('0x1d')]||null:null})['then'](function(_0xdfcd93){logger[_0x3e1e('0x12')]('UpdateOpenchannelQueueReport',_0x60e6bc);logger[_0x3e1e('0x17')](_0x3e1e('0x1e'),_0x60e6bc,JSON[_0x3e1e('0xe')](_0xdfcd93));_0x164b15(_0xdfcd93);})['catch'](function(_0xdef39){logger['error']('UpdateOpenchannelQueueReport',_0xdef39['message'],_0x60e6bc);_0x33bf0f(_0x56ae51[_0x3e1e('0xf')](0x1f4,_0xdef39['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1dfd1ad..67e74f4 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 _0xcf37=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put'];(function(_0x7b4bd8,_0x383ae8){var _0x1b70ce=function(_0x597000){while(--_0x597000){_0x7b4bd8['push'](_0x7b4bd8['shift']());}};_0x1b70ce(++_0x383ae8);}(_0xcf37,0x132));var _0x7cf3=function(_0x231198,_0x5b21fd){_0x231198=_0x231198-0x0;var _0x34e028=_0xcf37[_0x231198];return _0x34e028;};'use strict';var multer=require(_0x7cf3('0x0'));var util=require(_0x7cf3('0x1'));var path=require(_0x7cf3('0x2'));var timeout=require(_0x7cf3('0x3'));var express=require(_0x7cf3('0x4'));var router=express[_0x7cf3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7cf3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7cf3('0x7'));router[_0x7cf3('0x8')]('/',auth['isAuthenticated'](),controller[_0x7cf3('0x9')]);router['get'](_0x7cf3('0xa'),auth[_0x7cf3('0xb')](),controller[_0x7cf3('0xc')]);router[_0x7cf3('0x8')](_0x7cf3('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7cf3('0xe')]('/',auth[_0x7cf3('0xb')](),controller[_0x7cf3('0xf')]);router[_0x7cf3('0x10')](_0x7cf3('0xd'),auth[_0x7cf3('0xb')](),controller[_0x7cf3('0x11')]);router['delete'](_0x7cf3('0xd'),auth[_0x7cf3('0xb')](),controller['destroy']);module[_0x7cf3('0x12')]=router; \ No newline at end of file +var _0x6383=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2312c7,_0x1d1ada){var _0x4fd05f=function(_0x351e9f){while(--_0x351e9f){_0x2312c7['push'](_0x2312c7['shift']());}};_0x4fd05f(++_0x1d1ada);}(_0x6383,0x115));var _0x3638=function(_0x14c89f,_0x57c681){_0x14c89f=_0x14c89f-0x0;var _0x4bf582=_0x6383[_0x14c89f];return _0x4bf582;};'use strict';var multer=require(_0x3638('0x0'));var util=require(_0x3638('0x1'));var path=require(_0x3638('0x2'));var timeout=require('connect-timeout');var express=require(_0x3638('0x3'));var router=express[_0x3638('0x4')]();var fs_extra=require(_0x3638('0x5'));var auth=require(_0x3638('0x6'));var interaction=require(_0x3638('0x7'));var config=require('../../config/environment');var controller=require(_0x3638('0x8'));router[_0x3638('0x9')]('/',auth[_0x3638('0xa')](),controller[_0x3638('0xb')]);router[_0x3638('0x9')](_0x3638('0xc'),auth['isAuthenticated'](),controller[_0x3638('0xd')]);router[_0x3638('0x9')](_0x3638('0xe'),auth[_0x3638('0xa')](),controller[_0x3638('0xf')]);router[_0x3638('0x10')]('/',auth[_0x3638('0xa')](),controller[_0x3638('0x11')]);router[_0x3638('0x12')](_0x3638('0xe'),auth[_0x3638('0xa')](),controller[_0x3638('0x13')]);router[_0x3638('0x14')](_0x3638('0xe'),auth[_0x3638('0xa')](),controller[_0x3638('0x15')]);module[_0x3638('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 53b505c..bd32665 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5df3ab,_0x4a0a7e){var _0x42cce5=function(_0x430d0a){while(--_0x430d0a){_0x5df3ab['push'](_0x5df3ab['shift']());}};_0x42cce5(++_0x4a0a7e);}(_0x008c,0x188));var _0xc008=function(_0x4f1651,_0xc4ac4f){_0x4f1651=_0x4f1651-0x0;var _0x44868e=_0x008c[_0x4f1651];return _0x44868e;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1e1317,_0x1808ed){var _0x36758d=function(_0x153797){while(--_0x153797){_0x1e1317['push'](_0x1e1317['shift']());}};_0x36758d(++_0x1808ed);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d28106d..ec94e4a 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 _0x98d6=['then','destroy','error','name','send','index','OpenchannelTransferReport','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update'];(function(_0x4883a2,_0x206839){var _0x21bba1=function(_0x472081){while(--_0x472081){_0x4883a2['push'](_0x4883a2['shift']());}};_0x21bba1(++_0x206839);}(_0x98d6,0xf2));var _0x698d=function(_0x404de7,_0x217340){_0x404de7=_0x404de7-0x0;var _0x573ca4=_0x98d6[_0x404de7];return _0x573ca4;};'use strict';var emlformat=require(_0x698d('0x0'));var rimraf=require(_0x698d('0x1'));var zipdir=require(_0x698d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x698d('0x3'));var Mustache=require(_0x698d('0x4'));var util=require('util');var path=require(_0x698d('0x5'));var sox=require(_0x698d('0x6'));var csv=require(_0x698d('0x7'));var ejs=require(_0x698d('0x8'));var fs=require('fs');var fs_extra=require(_0x698d('0x9'));var _=require('lodash');var squel=require(_0x698d('0xa'));var crypto=require(_0x698d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x698d('0x7'));var querystring=require(_0x698d('0xc'));var Papa=require(_0x698d('0xd'));var Redis=require('ioredis');var authService=require(_0x698d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x698d('0xf'));var hardwareService=require(_0x698d('0x10'));var logger=require(_0x698d('0x11'))(_0x698d('0x12'));var utils=require(_0x698d('0x13'));var config=require(_0x698d('0x14'));var licenseUtil=require(_0x698d('0x15'));var db=require(_0x698d('0x16'))['db'];function respondWithStatusCode(_0xba9249,_0x376c13){_0x376c13=_0x376c13||0xcc;return function(_0x56bdcd){if(_0x56bdcd){return _0xba9249[_0x698d('0x17')](_0x376c13);}return _0xba9249[_0x698d('0x18')](_0x376c13)['end']();};}function respondWithResult(_0x528c9d,_0x41e1a1){_0x41e1a1=_0x41e1a1||0xc8;return function(_0x99f31a){if(_0x99f31a){return _0x528c9d[_0x698d('0x18')](_0x41e1a1)[_0x698d('0x19')](_0x99f31a);}};}function respondWithFilteredResult(_0x26492e,_0x424b8d){return function(_0x7d3c7e){if(_0x7d3c7e){var _0x53f9a0=typeof _0x424b8d[_0x698d('0x1a')]===_0x698d('0x1b')&&typeof _0x424b8d[_0x698d('0x1c')]===_0x698d('0x1b');var _0x2ef238=_0x7d3c7e[_0x698d('0x1d')];var _0x326eb0=_0x53f9a0?0x0:_0x424b8d[_0x698d('0x1a')];var _0x59f68d=_0x53f9a0?_0x7d3c7e[_0x698d('0x1d')]:_0x424b8d[_0x698d('0x1a')]+_0x424b8d[_0x698d('0x1c')];var _0x37a575;if(_0x59f68d>=_0x2ef238){_0x59f68d=_0x2ef238;_0x37a575=0xc8;}else{_0x37a575=0xce;}_0x26492e[_0x698d('0x18')](_0x37a575);return _0x26492e['set'](_0x698d('0x1e'),_0x326eb0+'-'+_0x59f68d+'/'+_0x2ef238)[_0x698d('0x19')](_0x7d3c7e);}return null;};}function patchUpdates(_0x54c7b2){return function(_0x4135f3){try{jsonpatch['apply'](_0x4135f3,_0x54c7b2,!![]);}catch(_0x112e8a){return BPromise[_0x698d('0x1f')](_0x112e8a);}return _0x4135f3[_0x698d('0x20')]();};}function saveUpdates(_0x8be8f0,_0x45c980){return function(_0x461517){if(_0x461517){return _0x461517[_0x698d('0x21')](_0x8be8f0)[_0x698d('0x22')](function(_0x5cf72c){return _0x5cf72c;});}return null;};}function removeEntity(_0x178388,_0x50ca29){return function(_0x287777){if(_0x287777){return _0x287777[_0x698d('0x23')]()[_0x698d('0x22')](function(){_0x178388['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x400d13,_0x391ee1){return function(_0x3cf1b0){if(!_0x3cf1b0){_0x400d13[_0x698d('0x17')](0x194);}return _0x3cf1b0;};}function handleError(_0x4e7ab8,_0x58bd78){_0x58bd78=_0x58bd78||0x1f4;return function(_0x10ed2f){logger[_0x698d('0x24')](_0x10ed2f['stack']);if(_0x10ed2f[_0x698d('0x25')]){delete _0x10ed2f[_0x698d('0x25')];}_0x4e7ab8[_0x698d('0x18')](_0x58bd78)[_0x698d('0x26')](_0x10ed2f);};}exports[_0x698d('0x27')]=function(_0x426073,_0x1dca41){var _0x2f53ad={},_0xc3dcc={},_0x2c603f={'count':0x0,'rows':[]};var _0x2d4deb=_['map'](db[_0x698d('0x28')][_0x698d('0x29')],function(_0x529aa6){return{'name':_0x529aa6['fieldName'],'type':_0x529aa6['type']['key']};});_0xc3dcc['model']=_[_0x698d('0x2a')](_0x2d4deb,_0x698d('0x25'));_0xc3dcc[_0x698d('0x2b')]=_[_0x698d('0x2c')](_0x426073[_0x698d('0x2b')]);_0xc3dcc[_0x698d('0x2d')]=_[_0x698d('0x2e')](_0xc3dcc[_0x698d('0x2f')],_0xc3dcc[_0x698d('0x2b')]);_0x2f53ad[_0x698d('0x30')]=_[_0x698d('0x2e')](_0xc3dcc['model'],qs[_0x698d('0x31')](_0x426073[_0x698d('0x2b')][_0x698d('0x31')]));_0x2f53ad[_0x698d('0x30')]=_0x2f53ad['attributes'][_0x698d('0x32')]?_0x2f53ad[_0x698d('0x30')]:_0xc3dcc['model'];if(!_0x426073['query']['hasOwnProperty'](_0x698d('0x33'))){_0x2f53ad[_0x698d('0x1c')]=qs['limit'](_0x426073[_0x698d('0x2b')][_0x698d('0x1c')]);_0x2f53ad[_0x698d('0x1a')]=qs[_0x698d('0x1a')](_0x426073[_0x698d('0x2b')][_0x698d('0x1a')]);}_0x2f53ad['order']=qs['sort'](_0x426073[_0x698d('0x2b')][_0x698d('0x34')]);_0x2f53ad['where']=qs[_0x698d('0x2d')](_['pick'](_0x426073['query'],_0xc3dcc[_0x698d('0x2d')]),_0x2d4deb);if(_0x426073[_0x698d('0x2b')][_0x698d('0x35')]){_0x2f53ad['where']=_[_0x698d('0x36')](_0x2f53ad[_0x698d('0x37')],{'$or':_['map'](_0x2d4deb,function(_0x5d2f44){if(_0x5d2f44[_0x698d('0x38')]!==_0x698d('0x39')){var _0x59e138={};_0x59e138[_0x5d2f44[_0x698d('0x25')]]={'$like':'%'+_0x426073[_0x698d('0x2b')][_0x698d('0x35')]+'%'};return _0x59e138;}})});}_0x2f53ad=_[_0x698d('0x36')]({},_0x2f53ad,_0x426073[_0x698d('0x3a')]);var _0x26b0ff={'where':_0x2f53ad[_0x698d('0x37')]};return db[_0x698d('0x28')]['count'](_0x26b0ff)[_0x698d('0x22')](function(_0x2b8dcd){_0x2c603f['count']=_0x2b8dcd;if(_0x426073[_0x698d('0x2b')][_0x698d('0x3b')]){_0x2f53ad[_0x698d('0x3c')]=[{'all':!![]}];}return db[_0x698d('0x28')][_0x698d('0x3d')](_0x2f53ad);})[_0x698d('0x22')](function(_0x9fed56){_0x2c603f['rows']=_0x9fed56;return _0x2c603f;})[_0x698d('0x22')](respondWithFilteredResult(_0x1dca41,_0x2f53ad))[_0x698d('0x3e')](handleError(_0x1dca41,null));};exports[_0x698d('0x3f')]=function(_0x112172,_0x21294e){var _0x5af570={'raw':!![],'where':{'id':_0x112172[_0x698d('0x40')]['id']}},_0xdd3584={};_0xdd3584[_0x698d('0x2f')]=_[_0x698d('0x2c')](db[_0x698d('0x28')][_0x698d('0x29')]);_0xdd3584[_0x698d('0x2b')]=_[_0x698d('0x2c')](_0x112172['query']);_0xdd3584[_0x698d('0x2d')]=_[_0x698d('0x2e')](_0xdd3584['model'],_0xdd3584['query']);_0x5af570[_0x698d('0x30')]=_[_0x698d('0x2e')](_0xdd3584[_0x698d('0x2f')],qs[_0x698d('0x31')](_0x112172[_0x698d('0x2b')][_0x698d('0x31')]));_0x5af570[_0x698d('0x30')]=_0x5af570[_0x698d('0x30')][_0x698d('0x32')]?_0x5af570[_0x698d('0x30')]:_0xdd3584[_0x698d('0x2f')];if(_0x112172['query'][_0x698d('0x3b')]){_0x5af570['include']=[{'all':!![]}];}_0x5af570=_[_0x698d('0x36')]({},_0x5af570,_0x112172['options']);return db[_0x698d('0x28')][_0x698d('0x41')](_0x5af570)[_0x698d('0x22')](handleEntityNotFound(_0x21294e,null))[_0x698d('0x22')](respondWithResult(_0x21294e,null))[_0x698d('0x3e')](handleError(_0x21294e,null));};exports[_0x698d('0x42')]=function(_0x4f980a,_0x5c0729){return db[_0x698d('0x28')][_0x698d('0x42')](_0x4f980a[_0x698d('0x43')],{})['then'](respondWithResult(_0x5c0729,0xc9))[_0x698d('0x3e')](handleError(_0x5c0729,null));};exports[_0x698d('0x21')]=function(_0x2de950,_0xa93998){if(_0x2de950[_0x698d('0x43')]['id']){delete _0x2de950[_0x698d('0x43')]['id'];}return db[_0x698d('0x28')][_0x698d('0x41')]({'where':{'id':_0x2de950[_0x698d('0x40')]['id']}})['then'](handleEntityNotFound(_0xa93998,null))[_0x698d('0x22')](saveUpdates(_0x2de950[_0x698d('0x43')],null))[_0x698d('0x22')](respondWithResult(_0xa93998,null))[_0x698d('0x3e')](handleError(_0xa93998,null));};exports[_0x698d('0x23')]=function(_0x14b653,_0x57eb39){return db[_0x698d('0x28')][_0x698d('0x41')]({'where':{'id':_0x14b653[_0x698d('0x40')]['id']}})['then'](handleEntityNotFound(_0x57eb39,null))['then'](removeEntity(_0x57eb39,null))[_0x698d('0x3e')](handleError(_0x57eb39,null));};exports['describe']=function(_0x39584f,_0x4df27c){return db[_0x698d('0x28')][_0x698d('0x44')]()['then'](respondWithResult(_0x4df27c,null))[_0x698d('0x3e')](handleError(_0x4df27c,null));}; \ No newline at end of file +var _0xe315=['undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelTransferReport','findAll','rows','catch','show','keys','rawAttributes','includeAll','include','options','find','create','body','params','describe','rimraf','zip-dir','bluebird','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset'];(function(_0x1084d2,_0xaa3a77){var _0x3aa7de=function(_0x1ab1b9){while(--_0x1ab1b9){_0x1084d2['push'](_0x1084d2['shift']());}};_0x3aa7de(++_0xaa3a77);}(_0xe315,0xcf));var _0x5e31=function(_0x40c5b3,_0x477fe0){_0x40c5b3=_0x40c5b3-0x0;var _0x188147=_0xe315[_0x40c5b3];return _0x188147;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e31('0x0'));var zipdir=require(_0x5e31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5e31('0x2'));var Mustache=require('mustache');var util=require(_0x5e31('0x3'));var path=require(_0x5e31('0x4'));var sox=require(_0x5e31('0x5'));var csv=require(_0x5e31('0x6'));var ejs=require(_0x5e31('0x7'));var fs=require('fs');var fs_extra=require(_0x5e31('0x8'));var _=require(_0x5e31('0x9'));var squel=require(_0x5e31('0xa'));var crypto=require(_0x5e31('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5e31('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e31('0xd'));var Redis=require(_0x5e31('0xe'));var authService=require(_0x5e31('0xf'));var qs=require(_0x5e31('0x10'));var as=require(_0x5e31('0x11'));var hardwareService=require(_0x5e31('0x12'));var logger=require(_0x5e31('0x13'))(_0x5e31('0x14'));var utils=require('../../config/utils');var config=require(_0x5e31('0x15'));var licenseUtil=require(_0x5e31('0x16'));var db=require(_0x5e31('0x17'))['db'];function respondWithStatusCode(_0x247256,_0x4dc03a){_0x4dc03a=_0x4dc03a||0xcc;return function(_0x48b281){if(_0x48b281){return _0x247256[_0x5e31('0x18')](_0x4dc03a);}return _0x247256[_0x5e31('0x19')](_0x4dc03a)['end']();};}function respondWithResult(_0x102b10,_0x52764a){_0x52764a=_0x52764a||0xc8;return function(_0x131a34){if(_0x131a34){return _0x102b10[_0x5e31('0x19')](_0x52764a)['json'](_0x131a34);}};}function respondWithFilteredResult(_0x10bd69,_0xc0ff3c){return function(_0x2b5817){if(_0x2b5817){var _0x8923a=typeof _0xc0ff3c[_0x5e31('0x1a')]==='undefined'&&typeof _0xc0ff3c['limit']===_0x5e31('0x1b');var _0x43c4fe=_0x2b5817[_0x5e31('0x1c')];var _0x3235d0=_0x8923a?0x0:_0xc0ff3c[_0x5e31('0x1a')];var _0x10a0ac=_0x8923a?_0x2b5817[_0x5e31('0x1c')]:_0xc0ff3c[_0x5e31('0x1a')]+_0xc0ff3c[_0x5e31('0x1d')];var _0xddcd80;if(_0x10a0ac>=_0x43c4fe){_0x10a0ac=_0x43c4fe;_0xddcd80=0xc8;}else{_0xddcd80=0xce;}_0x10bd69[_0x5e31('0x19')](_0xddcd80);return _0x10bd69[_0x5e31('0x1e')](_0x5e31('0x1f'),_0x3235d0+'-'+_0x10a0ac+'/'+_0x43c4fe)[_0x5e31('0x20')](_0x2b5817);}return null;};}function patchUpdates(_0x30fabf){return function(_0x4ecced){try{jsonpatch[_0x5e31('0x21')](_0x4ecced,_0x30fabf,!![]);}catch(_0x5623b9){return BPromise[_0x5e31('0x22')](_0x5623b9);}return _0x4ecced[_0x5e31('0x23')]();};}function saveUpdates(_0x3aaec4,_0x12b5e0){return function(_0x6fbc7c){if(_0x6fbc7c){return _0x6fbc7c[_0x5e31('0x24')](_0x3aaec4)[_0x5e31('0x25')](function(_0x1f07d){return _0x1f07d;});}return null;};}function removeEntity(_0x2426d7,_0x206620){return function(_0x390084){if(_0x390084){return _0x390084[_0x5e31('0x26')]()['then'](function(){_0x2426d7[_0x5e31('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d3eb,_0x28a1e2){return function(_0x2404a1){if(!_0x2404a1){_0x29d3eb['sendStatus'](0x194);}return _0x2404a1;};}function handleError(_0x30cd1b,_0x1cf4ca){_0x1cf4ca=_0x1cf4ca||0x1f4;return function(_0xf28c81){logger['error'](_0xf28c81[_0x5e31('0x27')]);if(_0xf28c81['name']){delete _0xf28c81[_0x5e31('0x28')];}_0x30cd1b[_0x5e31('0x19')](_0x1cf4ca)[_0x5e31('0x29')](_0xf28c81);};}exports[_0x5e31('0x2a')]=function(_0x1cf1d3,_0xcefcec){var _0x25fa08={},_0x48bbac={},_0x27d6b3={'count':0x0,'rows':[]};var _0x27e2ae=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x10c6d0){return{'name':_0x10c6d0[_0x5e31('0x2b')],'type':_0x10c6d0[_0x5e31('0x2c')][_0x5e31('0x2d')]};});_0x48bbac[_0x5e31('0x2e')]=_[_0x5e31('0x2f')](_0x27e2ae,_0x5e31('0x28'));_0x48bbac['query']=_['keys'](_0x1cf1d3[_0x5e31('0x30')]);_0x48bbac[_0x5e31('0x31')]=_[_0x5e31('0x32')](_0x48bbac[_0x5e31('0x2e')],_0x48bbac['query']);_0x25fa08['attributes']=_['intersection'](_0x48bbac[_0x5e31('0x2e')],qs[_0x5e31('0x33')](_0x1cf1d3[_0x5e31('0x30')]['fields']));_0x25fa08['attributes']=_0x25fa08[_0x5e31('0x34')][_0x5e31('0x35')]?_0x25fa08[_0x5e31('0x34')]:_0x48bbac['model'];if(!_0x1cf1d3[_0x5e31('0x30')][_0x5e31('0x36')](_0x5e31('0x37'))){_0x25fa08['limit']=qs[_0x5e31('0x1d')](_0x1cf1d3['query'][_0x5e31('0x1d')]);_0x25fa08[_0x5e31('0x1a')]=qs[_0x5e31('0x1a')](_0x1cf1d3['query'][_0x5e31('0x1a')]);}_0x25fa08[_0x5e31('0x38')]=qs[_0x5e31('0x39')](_0x1cf1d3['query'][_0x5e31('0x39')]);_0x25fa08[_0x5e31('0x3a')]=qs[_0x5e31('0x31')](_[_0x5e31('0x3b')](_0x1cf1d3[_0x5e31('0x30')],_0x48bbac[_0x5e31('0x31')]),_0x27e2ae);if(_0x1cf1d3[_0x5e31('0x30')][_0x5e31('0x3c')]){_0x25fa08[_0x5e31('0x3a')]=_[_0x5e31('0x3d')](_0x25fa08[_0x5e31('0x3a')],{'$or':_['map'](_0x27e2ae,function(_0x46f139){if(_0x46f139[_0x5e31('0x2c')]!==_0x5e31('0x3e')){var _0x25053e={};_0x25053e[_0x46f139[_0x5e31('0x28')]]={'$like':'%'+_0x1cf1d3['query'][_0x5e31('0x3c')]+'%'};return _0x25053e;}})});}_0x25fa08=_[_0x5e31('0x3d')]({},_0x25fa08,_0x1cf1d3['options']);var _0x15e4e6={'where':_0x25fa08[_0x5e31('0x3a')]};return db[_0x5e31('0x3f')]['count'](_0x15e4e6)['then'](function(_0x11843b){_0x27d6b3[_0x5e31('0x1c')]=_0x11843b;if(_0x1cf1d3[_0x5e31('0x30')]['includeAll']){_0x25fa08['include']=[{'all':!![]}];}return db[_0x5e31('0x3f')][_0x5e31('0x40')](_0x25fa08);})[_0x5e31('0x25')](function(_0x2ca2d1){_0x27d6b3[_0x5e31('0x41')]=_0x2ca2d1;return _0x27d6b3;})['then'](respondWithFilteredResult(_0xcefcec,_0x25fa08))[_0x5e31('0x42')](handleError(_0xcefcec,null));};exports[_0x5e31('0x43')]=function(_0x158e71,_0x292d0a){var _0x422d3b={'raw':!![],'where':{'id':_0x158e71['params']['id']}},_0x106e13={};_0x106e13[_0x5e31('0x2e')]=_[_0x5e31('0x44')](db[_0x5e31('0x3f')][_0x5e31('0x45')]);_0x106e13[_0x5e31('0x30')]=_[_0x5e31('0x44')](_0x158e71[_0x5e31('0x30')]);_0x106e13[_0x5e31('0x31')]=_[_0x5e31('0x32')](_0x106e13[_0x5e31('0x2e')],_0x106e13[_0x5e31('0x30')]);_0x422d3b[_0x5e31('0x34')]=_[_0x5e31('0x32')](_0x106e13[_0x5e31('0x2e')],qs[_0x5e31('0x33')](_0x158e71[_0x5e31('0x30')][_0x5e31('0x33')]));_0x422d3b[_0x5e31('0x34')]=_0x422d3b['attributes']['length']?_0x422d3b[_0x5e31('0x34')]:_0x106e13[_0x5e31('0x2e')];if(_0x158e71['query'][_0x5e31('0x46')]){_0x422d3b[_0x5e31('0x47')]=[{'all':!![]}];}_0x422d3b=_['merge']({},_0x422d3b,_0x158e71[_0x5e31('0x48')]);return db[_0x5e31('0x3f')][_0x5e31('0x49')](_0x422d3b)[_0x5e31('0x25')](handleEntityNotFound(_0x292d0a,null))[_0x5e31('0x25')](respondWithResult(_0x292d0a,null))[_0x5e31('0x42')](handleError(_0x292d0a,null));};exports[_0x5e31('0x4a')]=function(_0x50147a,_0x101cbb){return db[_0x5e31('0x3f')][_0x5e31('0x4a')](_0x50147a[_0x5e31('0x4b')],{})[_0x5e31('0x25')](respondWithResult(_0x101cbb,0xc9))[_0x5e31('0x42')](handleError(_0x101cbb,null));};exports[_0x5e31('0x24')]=function(_0x4db5ef,_0x278c14){if(_0x4db5ef[_0x5e31('0x4b')]['id']){delete _0x4db5ef[_0x5e31('0x4b')]['id'];}return db[_0x5e31('0x3f')][_0x5e31('0x49')]({'where':{'id':_0x4db5ef[_0x5e31('0x4c')]['id']}})[_0x5e31('0x25')](handleEntityNotFound(_0x278c14,null))[_0x5e31('0x25')](saveUpdates(_0x4db5ef['body'],null))[_0x5e31('0x25')](respondWithResult(_0x278c14,null))[_0x5e31('0x42')](handleError(_0x278c14,null));};exports[_0x5e31('0x26')]=function(_0x444c83,_0x29c2aa){return db['OpenchannelTransferReport'][_0x5e31('0x49')]({'where':{'id':_0x444c83[_0x5e31('0x4c')]['id']}})[_0x5e31('0x25')](handleEntityNotFound(_0x29c2aa,null))[_0x5e31('0x25')](removeEntity(_0x29c2aa,null))[_0x5e31('0x42')](handleError(_0x29c2aa,null));};exports[_0x5e31('0x4d')]=function(_0x281d59,_0x532539){return db[_0x5e31('0x3f')]['describe']()[_0x5e31('0x25')](respondWithResult(_0x532539,null))[_0x5e31('0x42')](handleError(_0x532539,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f7f330b..47541be 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 _0x4609=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0xa7e305,_0x1cf42d){var _0x1d1ae4=function(_0x44e41e){while(--_0x44e41e){_0xa7e305['push'](_0xa7e305['shift']());}};_0x1d1ae4(++_0x1cf42d);}(_0x4609,0x1bd));var _0x9460=function(_0x1a09dd,_0xc31264){_0x1a09dd=_0x1a09dd-0x0;var _0x21a497=_0x4609[_0x1a09dd];return _0x21a497;};'use strict';var _=require(_0x9460('0x0'));var util=require(_0x9460('0x1'));var logger=require(_0x9460('0x2'))(_0x9460('0x3'));var moment=require(_0x9460('0x4'));var BPromise=require(_0x9460('0x5'));var rp=require(_0x9460('0x6'));var fs=require('fs');var path=require(_0x9460('0x7'));var rimraf=require(_0x9460('0x8'));var config=require(_0x9460('0x9'));var attributes=require(_0x9460('0xa'));module[_0x9460('0xb')]=function(_0x5cac22,_0x3df59a){return _0x5cac22[_0x9460('0xc')](_0x9460('0xd'),attributes,{'tableName':_0x9460('0xe'),'paranoid':![],'indexes':[{'name':_0x9460('0xf'),'fields':[_0x9460('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x882d=['../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x882d,0x132));var _0xd882=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x882d[_0x2998db];return _0x115fea;};'use strict';var _=require(_0xd882('0x0'));var util=require(_0xd882('0x1'));var logger=require(_0xd882('0x2'))(_0xd882('0x3'));var moment=require(_0xd882('0x4'));var BPromise=require(_0xd882('0x5'));var rp=require(_0xd882('0x6'));var fs=require('fs');var path=require(_0xd882('0x7'));var rimraf=require(_0xd882('0x8'));var config=require(_0xd882('0x9'));var attributes=require('./openchannelTransferReport.attributes');module[_0xd882('0xa')]=function(_0x4ee89c,_0x5f1979){return _0x4ee89c[_0xd882('0xb')](_0xd882('0xc'),attributes,{'tableName':_0xd882('0xd'),'paranoid':![],'indexes':[{'name':_0xd882('0xe'),'fields':[_0xd882('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 18c0b88..fa7381d 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 _0x86f4=['info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x703117,_0x4e14b7){var _0x312c19=function(_0x8c7900){while(--_0x8c7900){_0x703117['push'](_0x703117['shift']());}};_0x312c19(++_0x4e14b7);}(_0x86f4,0x18a));var _0x486f=function(_0x1122a1,_0x5f3be8){_0x1122a1=_0x1122a1-0x0;var _0x585150=_0x86f4[_0x1122a1];return _0x585150;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var moment=require(_0x486f('0x2'));var BPromise=require(_0x486f('0x3'));var rs=require(_0x486f('0x4'));var fs=require('fs');var Redis=require(_0x486f('0x5'));var db=require(_0x486f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x486f('0x7'))(_0x486f('0x8'));var config=require('../../config/environment');var jayson=require(_0x486f('0x9'));var client=jayson[_0x486f('0xa')][_0x486f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x207201,_0x3c6469,_0x3a0791){return new BPromise(function(_0x5bfabc,_0x33363d){return client[_0x486f('0xc')](_0x207201,_0x3a0791)[_0x486f('0xd')](function(_0x468a82){logger[_0x486f('0xe')](_0x486f('0xf'),_0x3c6469,_0x486f('0x10'));logger[_0x486f('0x11')](_0x486f('0x12'),_0x3c6469,_0x486f('0x10'),JSON[_0x486f('0x13')](_0x468a82));if(_0x468a82[_0x486f('0x14')]){if(_0x468a82[_0x486f('0x14')][_0x486f('0x15')]===0x1f4){logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x468a82[_0x486f('0x14')]['message']);return _0x33363d(_0x468a82[_0x486f('0x14')]['message']);}logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x468a82[_0x486f('0x14')]['message']);return _0x5bfabc(_0x468a82['error'][_0x486f('0x16')]);}else{logger[_0x486f('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3c6469,_0x486f('0x10'));_0x5bfabc(_0x468a82[_0x486f('0x17')][_0x486f('0x16')]);}})['catch'](function(_0x53561a){logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x53561a);_0x33363d(_0x53561a);});});} \ No newline at end of file +var _0x3148=['then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2c6190,_0x4bc224){var _0x55f2f4=function(_0x5925ed){while(--_0x5925ed){_0x2c6190['push'](_0x2c6190['shift']());}};_0x55f2f4(++_0x4bc224);}(_0x3148,0x1d3));var _0x8314=function(_0x22e953,_0x10a297){_0x22e953=_0x22e953-0x0;var _0x2d4bdc=_0x3148[_0x22e953];return _0x2d4bdc;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd913,_0x4dd36d,_0x837c1f){return new BPromise(function(_0x4df2b0,_0x35b464){return client[_0x8314('0xc')](_0x1bd913,_0x837c1f)[_0x8314('0xd')](function(_0x357031){logger[_0x8314('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,'request\x20sent');logger[_0x8314('0xf')](_0x8314('0x10'),_0x4dd36d,_0x8314('0x11'),JSON[_0x8314('0x12')](_0x357031));if(_0x357031['error']){if(_0x357031[_0x8314('0x13')][_0x8314('0x14')]===0x1f4){logger['error'](_0x8314('0x15'),_0x4dd36d,_0x357031['error']['message']);return _0x35b464(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}logger[_0x8314('0x13')](_0x8314('0x15'),_0x4dd36d,_0x357031['error'][_0x8314('0x16')]);return _0x4df2b0(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}else{logger[_0x8314('0xe')](_0x8314('0x15'),_0x4dd36d,_0x8314('0x11'));_0x4df2b0(_0x357031['result']['message']);}})[_0x8314('0x17')](function(_0xf0ad31){logger[_0x8314('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,_0xf0ad31);_0x35b464(_0xf0ad31);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 81c65ba..30d7b8e 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 _0x14d6=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0x2a958a,_0x215867){var _0xe9876d=function(_0x5dd041){while(--_0x5dd041){_0x2a958a['push'](_0x2a958a['shift']());}};_0xe9876d(++_0x215867);}(_0x14d6,0x12b));var _0x614d=function(_0x4b67cd,_0x2bbf25){_0x4b67cd=_0x4b67cd-0x0;var _0x53e9e0=_0x14d6[_0x4b67cd];return _0x53e9e0;};'use strict';var multer=require(_0x614d('0x0'));var util=require(_0x614d('0x1'));var path=require(_0x614d('0x2'));var timeout=require(_0x614d('0x3'));var express=require('express');var router=express[_0x614d('0x4')]();var fs_extra=require(_0x614d('0x5'));var auth=require(_0x614d('0x6'));var interaction=require(_0x614d('0x7'));var config=require(_0x614d('0x8'));var controller=require(_0x614d('0x9'));router['get']('/',auth[_0x614d('0xa')](),controller[_0x614d('0xb')]);router[_0x614d('0xc')](_0x614d('0xd'),auth[_0x614d('0xa')](),controller['show']);router[_0x614d('0xe')]('/',auth[_0x614d('0xa')](),controller[_0x614d('0xf')]);router[_0x614d('0x10')](_0x614d('0xd'),auth[_0x614d('0xa')](),controller['update']);router[_0x614d('0x11')](_0x614d('0xd'),auth['isAuthenticated'](),controller[_0x614d('0x12')]);module[_0x614d('0x13')]=router; \ No newline at end of file +var _0x53b2=['create','put','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x53b2,0xa8));var _0x253b=function(_0x463f0f,_0x543b02){_0x463f0f=_0x463f0f-0x0;var _0x311651=_0x53b2[_0x463f0f];return _0x311651;};'use strict';var multer=require(_0x253b('0x0'));var util=require(_0x253b('0x1'));var path=require(_0x253b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x253b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x253b('0x4'));var interaction=require(_0x253b('0x5'));var config=require(_0x253b('0x6'));var controller=require('./pause.controller');router[_0x253b('0x7')]('/',auth[_0x253b('0x8')](),controller[_0x253b('0x9')]);router[_0x253b('0x7')](_0x253b('0xa'),auth['isAuthenticated'](),controller[_0x253b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x253b('0xc')]);router[_0x253b('0xd')]('/:id',auth[_0x253b('0x8')](),controller[_0x253b('0xe')]);router['delete'](_0x253b('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 095b99f..ac89b8d 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 _0x6289=['exports','name','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6289,0x1ec));var _0x9628=function(_0x13ae3b,_0x4ddd7c){_0x13ae3b=_0x13ae3b-0x0;var _0x145764=_0x6289[_0x13ae3b];return _0x145764;};'use strict';var Sequelize=require('sequelize');module[_0x9628('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9628('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x9628('0x2')]}}; \ No newline at end of file +var _0xbf3a=['name','sequelize','STRING'];(function(_0x33ab9c,_0xe794c6){var _0x2e6499=function(_0x55d553){while(--_0x55d553){_0x33ab9c['push'](_0x33ab9c['shift']());}};_0x2e6499(++_0xe794c6);}(_0xbf3a,0x142));var _0xabf3=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xbf3a[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require(_0xabf3('0x0'));module['exports']={'name':{'type':Sequelize[_0xabf3('0x1')],'unique':_0xabf3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xabf3('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 546d2f6..570cd6e 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 _0x36d2=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','sendStatus','error','name','index','map','Pause','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2b6cdc,_0x5c0d98){var _0x31bd91=function(_0x1dda36){while(--_0x1dda36){_0x2b6cdc['push'](_0x2b6cdc['shift']());}};_0x31bd91(++_0x5c0d98);}(_0x36d2,0xaa));var _0x236d=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0x36d2[_0x3eb4a9];return _0x48dbad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x236d('0x0'));var zipdir=require(_0x236d('0x1'));var jsonpatch=require(_0x236d('0x2'));var rp=require(_0x236d('0x3'));var moment=require(_0x236d('0x4'));var BPromise=require(_0x236d('0x5'));var Mustache=require(_0x236d('0x6'));var util=require(_0x236d('0x7'));var path=require('path');var sox=require(_0x236d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x236d('0x9'));var squel=require(_0x236d('0xa'));var crypto=require(_0x236d('0xb'));var jsforce=require(_0x236d('0xc'));var deskjs=require(_0x236d('0xd'));var toCsv=require(_0x236d('0xe'));var querystring=require(_0x236d('0xf'));var Papa=require('papaparse');var Redis=require(_0x236d('0x10'));var authService=require(_0x236d('0x11'));var qs=require(_0x236d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x236d('0x13'));var logger=require(_0x236d('0x14'))(_0x236d('0x15'));var utils=require(_0x236d('0x16'));var config=require(_0x236d('0x17'));var licenseUtil=require(_0x236d('0x18'));var db=require(_0x236d('0x19'))['db'];function respondWithStatusCode(_0x5ebda2,_0x296c6e){_0x296c6e=_0x296c6e||0xcc;return function(_0x2e56aa){if(_0x2e56aa){return _0x5ebda2['sendStatus'](_0x296c6e);}return _0x5ebda2[_0x236d('0x1a')](_0x296c6e)[_0x236d('0x1b')]();};}function respondWithResult(_0x15c1ff,_0x3cb6dc){_0x3cb6dc=_0x3cb6dc||0xc8;return function(_0x2007cc){if(_0x2007cc){return _0x15c1ff[_0x236d('0x1a')](_0x3cb6dc)['json'](_0x2007cc);}};}function respondWithFilteredResult(_0x2c67e6,_0xec09b2){return function(_0x12fb75){if(_0x12fb75){var _0x45b468=typeof _0xec09b2['offset']===_0x236d('0x1c')&&typeof _0xec09b2[_0x236d('0x1d')]==='undefined';var _0x143940=_0x12fb75[_0x236d('0x1e')];var _0x563327=_0x45b468?0x0:_0xec09b2[_0x236d('0x1f')];var _0x4ae2c4=_0x45b468?_0x12fb75[_0x236d('0x1e')]:_0xec09b2[_0x236d('0x1f')]+_0xec09b2[_0x236d('0x1d')];var _0x1e4a88;if(_0x4ae2c4>=_0x143940){_0x4ae2c4=_0x143940;_0x1e4a88=0xc8;}else{_0x1e4a88=0xce;}_0x2c67e6[_0x236d('0x1a')](_0x1e4a88);return _0x2c67e6[_0x236d('0x20')](_0x236d('0x21'),_0x563327+'-'+_0x4ae2c4+'/'+_0x143940)['json'](_0x12fb75);}return null;};}function patchUpdates(_0x2134e5){return function(_0x3ec153){try{jsonpatch[_0x236d('0x22')](_0x3ec153,_0x2134e5,!![]);}catch(_0x73b285){return BPromise[_0x236d('0x23')](_0x73b285);}return _0x3ec153[_0x236d('0x24')]();};}function saveUpdates(_0x572de7,_0x3c58c4){return function(_0x246c09){if(_0x246c09){return _0x246c09[_0x236d('0x25')](_0x572de7)['then'](function(_0x47fc8b){return _0x47fc8b;});}return null;};}function removeEntity(_0x134b11,_0x31f0eb){return function(_0x4ac009){if(_0x4ac009){return _0x4ac009[_0x236d('0x26')]()[_0x236d('0x27')](function(){var _0x12b56a=_0x4ac009[_0x236d('0x28')]({'plain':!![]});var _0x50d927='Pauses';return db['UserProfileResource'][_0x236d('0x26')]({'where':{'type':_0x50d927,'resourceId':_0x12b56a['id']}})[_0x236d('0x27')](function(){return _0x4ac009;});})[_0x236d('0x27')](function(){_0x134b11[_0x236d('0x1a')](0xcc)[_0x236d('0x1b')]();});}};}function handleEntityNotFound(_0x25bf3f,_0x419e56){return function(_0xe15ddf){if(!_0xe15ddf){_0x25bf3f[_0x236d('0x29')](0x194);}return _0xe15ddf;};}function handleError(_0x139be6,_0x1f9d5c){_0x1f9d5c=_0x1f9d5c||0x1f4;return function(_0x341f48){logger[_0x236d('0x2a')](_0x341f48['stack']);if(_0x341f48[_0x236d('0x2b')]){delete _0x341f48[_0x236d('0x2b')];}_0x139be6[_0x236d('0x1a')](_0x1f9d5c)['send'](_0x341f48);};}exports[_0x236d('0x2c')]=function(_0x47b2e7,_0x5792f4){var _0x2814cb={},_0x2a0455={},_0x1e961b={'count':0x0,'rows':[]};var _0x9460bf=_[_0x236d('0x2d')](db[_0x236d('0x2e')]['rawAttributes'],function(_0x346365){return{'name':_0x346365[_0x236d('0x2f')],'type':_0x346365['type'][_0x236d('0x30')]};});_0x2a0455[_0x236d('0x31')]=_[_0x236d('0x2d')](_0x9460bf,_0x236d('0x2b'));_0x2a0455[_0x236d('0x32')]=_[_0x236d('0x33')](_0x47b2e7[_0x236d('0x32')]);_0x2a0455[_0x236d('0x34')]=_['intersection'](_0x2a0455[_0x236d('0x31')],_0x2a0455[_0x236d('0x32')]);_0x2814cb[_0x236d('0x35')]=_[_0x236d('0x36')](_0x2a0455[_0x236d('0x31')],qs[_0x236d('0x37')](_0x47b2e7[_0x236d('0x32')]['fields']));_0x2814cb['attributes']=_0x2814cb['attributes']['length']?_0x2814cb[_0x236d('0x35')]:_0x2a0455['model'];if(!_0x47b2e7[_0x236d('0x32')][_0x236d('0x38')]('nolimit')){_0x2814cb['limit']=qs[_0x236d('0x1d')](_0x47b2e7[_0x236d('0x32')][_0x236d('0x1d')]);_0x2814cb[_0x236d('0x1f')]=qs[_0x236d('0x1f')](_0x47b2e7[_0x236d('0x32')][_0x236d('0x1f')]);}_0x2814cb[_0x236d('0x39')]=qs[_0x236d('0x3a')](_0x47b2e7[_0x236d('0x32')][_0x236d('0x3a')]);_0x2814cb[_0x236d('0x3b')]=qs[_0x236d('0x34')](_[_0x236d('0x3c')](_0x47b2e7[_0x236d('0x32')],_0x2a0455[_0x236d('0x34')]),_0x9460bf);if(_0x47b2e7[_0x236d('0x32')]['filter']){_0x2814cb[_0x236d('0x3b')]=_[_0x236d('0x3d')](_0x2814cb[_0x236d('0x3b')],{'$or':_[_0x236d('0x2d')](_0x9460bf,function(_0x13f28c){if(_0x13f28c[_0x236d('0x3e')]!==_0x236d('0x3f')){var _0x18075b={};_0x18075b[_0x13f28c[_0x236d('0x2b')]]={'$like':'%'+_0x47b2e7[_0x236d('0x32')][_0x236d('0x40')]+'%'};return _0x18075b;}})});}_0x2814cb=_[_0x236d('0x3d')]({},_0x2814cb,_0x47b2e7[_0x236d('0x41')]);var _0x23a239={'where':_0x2814cb[_0x236d('0x3b')]};return db[_0x236d('0x2e')][_0x236d('0x1e')](_0x23a239)[_0x236d('0x27')](function(_0x557653){_0x1e961b[_0x236d('0x1e')]=_0x557653;if(_0x47b2e7[_0x236d('0x32')][_0x236d('0x42')]){_0x2814cb['include']=[{'all':!![]}];}return db['Pause'][_0x236d('0x43')](_0x2814cb);})['then'](function(_0x5459c9){_0x1e961b[_0x236d('0x44')]=_0x5459c9;return _0x1e961b;})[_0x236d('0x27')](respondWithFilteredResult(_0x5792f4,_0x2814cb))[_0x236d('0x45')](handleError(_0x5792f4,null));};exports[_0x236d('0x46')]=function(_0x58a684,_0x53ddb5){var _0x33db9e={'raw':!![],'where':{'id':_0x58a684[_0x236d('0x47')]['id']}},_0x45dac3={};_0x45dac3[_0x236d('0x31')]=_['keys'](db[_0x236d('0x2e')][_0x236d('0x48')]);_0x45dac3[_0x236d('0x32')]=_['keys'](_0x58a684['query']);_0x45dac3[_0x236d('0x34')]=_['intersection'](_0x45dac3[_0x236d('0x31')],_0x45dac3[_0x236d('0x32')]);_0x33db9e[_0x236d('0x35')]=_[_0x236d('0x36')](_0x45dac3['model'],qs['fields'](_0x58a684[_0x236d('0x32')][_0x236d('0x37')]));_0x33db9e[_0x236d('0x35')]=_0x33db9e['attributes']['length']?_0x33db9e[_0x236d('0x35')]:_0x45dac3['model'];if(_0x58a684[_0x236d('0x32')][_0x236d('0x42')]){_0x33db9e[_0x236d('0x49')]=[{'all':!![]}];}_0x33db9e=_[_0x236d('0x3d')]({},_0x33db9e,_0x58a684[_0x236d('0x41')]);return db[_0x236d('0x2e')][_0x236d('0x4a')](_0x33db9e)[_0x236d('0x27')](handleEntityNotFound(_0x53ddb5,null))[_0x236d('0x27')](respondWithResult(_0x53ddb5,null))[_0x236d('0x45')](handleError(_0x53ddb5,null));};exports[_0x236d('0x4b')]=function(_0x5a9b87,_0x59c8a4){return db['Pause']['create'](_0x5a9b87[_0x236d('0x4c')],{})['then'](function(_0x481935){var _0x423654=_0x5a9b87[_0x236d('0x4d')][_0x236d('0x28')]({'plain':!![]});if(!_0x423654)throw new Error(_0x236d('0x4e'));if(_0x423654[_0x236d('0x4f')]===_0x236d('0x4d')){var _0x30a40d=_0x481935[_0x236d('0x28')]({'plain':!![]});var _0x31230b=_0x236d('0x50');return db[_0x236d('0x51')][_0x236d('0x4a')]({'where':{'name':_0x31230b,'userProfileId':_0x423654[_0x236d('0x52')]},'raw':!![]})[_0x236d('0x27')](function(_0x587544){if(_0x587544&&_0x587544['autoAssociation']===0x0){return db[_0x236d('0x53')][_0x236d('0x4b')]({'name':_0x30a40d['name'],'resourceId':_0x30a40d['id'],'type':_0x587544[_0x236d('0x2b')],'sectionId':_0x587544['id']},{})['then'](function(){return _0x481935;});}else{return _0x481935;}})[_0x236d('0x45')](function(_0x25fcf6){logger['error'](_0x236d('0x54'),_0x25fcf6);throw _0x25fcf6;});}return _0x481935;})[_0x236d('0x27')](respondWithResult(_0x59c8a4,0xc9))['catch'](handleError(_0x59c8a4,null));};exports[_0x236d('0x25')]=function(_0x1d546e,_0x41d8ef){if(_0x1d546e[_0x236d('0x4c')]['id']){delete _0x1d546e[_0x236d('0x4c')]['id'];}return db[_0x236d('0x2e')]['find']({'where':{'id':_0x1d546e[_0x236d('0x47')]['id']}})[_0x236d('0x27')](handleEntityNotFound(_0x41d8ef,null))[_0x236d('0x27')](saveUpdates(_0x1d546e['body'],null))[_0x236d('0x27')](respondWithResult(_0x41d8ef,null))[_0x236d('0x45')](handleError(_0x41d8ef,null));};exports[_0x236d('0x26')]=function(_0x58c7df,_0x32a733){return db[_0x236d('0x2e')][_0x236d('0x4a')]({'where':{'id':_0x58c7df[_0x236d('0x47')]['id']}})[_0x236d('0x27')](handleEntityNotFound(_0x32a733,null))['then'](removeEntity(_0x32a733,null))[_0x236d('0x45')](handleError(_0x32a733,null));}; \ No newline at end of file +var _0x2284=['find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','type','merge','includeAll','include','rows','catch','params','intersection','options'];(function(_0x2e9a8f,_0x37c8b2){var _0x4ba021=function(_0x4331e8){while(--_0x4331e8){_0x2e9a8f['push'](_0x2e9a8f['shift']());}};_0x4ba021(++_0x37c8b2);}(_0x2284,0x1a4));var _0x4228=function(_0x37f0ef,_0x33c627){_0x37f0ef=_0x37f0ef-0x0;var _0x47c95e=_0x2284[_0x37f0ef];return _0x47c95e;};'use strict';var emlformat=require(_0x4228('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4228('0x1'));var jsonpatch=require(_0x4228('0x2'));var rp=require(_0x4228('0x3'));var moment=require(_0x4228('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4228('0x5'));var path=require(_0x4228('0x6'));var sox=require(_0x4228('0x7'));var csv=require(_0x4228('0x8'));var ejs=require(_0x4228('0x9'));var fs=require('fs');var fs_extra=require(_0x4228('0xa'));var _=require(_0x4228('0xb'));var squel=require(_0x4228('0xc'));var crypto=require(_0x4228('0xd'));var jsforce=require(_0x4228('0xe'));var deskjs=require(_0x4228('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4228('0x10'));var Papa=require('papaparse');var Redis=require(_0x4228('0x11'));var authService=require(_0x4228('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4228('0x13'))(_0x4228('0x14'));var utils=require(_0x4228('0x15'));var config=require(_0x4228('0x16'));var licenseUtil=require(_0x4228('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3f87,_0x172596){_0x172596=_0x172596||0xcc;return function(_0x392dd1){if(_0x392dd1){return _0x5c3f87['sendStatus'](_0x172596);}return _0x5c3f87[_0x4228('0x18')](_0x172596)[_0x4228('0x19')]();};}function respondWithResult(_0x523fe4,_0x29abfd){_0x29abfd=_0x29abfd||0xc8;return function(_0x558f65){if(_0x558f65){return _0x523fe4[_0x4228('0x18')](_0x29abfd)['json'](_0x558f65);}};}function respondWithFilteredResult(_0x38e692,_0x34cc6b){return function(_0x36c580){if(_0x36c580){var _0x4a8ab2=typeof _0x34cc6b[_0x4228('0x1a')]===_0x4228('0x1b')&&typeof _0x34cc6b[_0x4228('0x1c')]===_0x4228('0x1b');var _0x5a6ce8=_0x36c580[_0x4228('0x1d')];var _0x1e8b5a=_0x4a8ab2?0x0:_0x34cc6b[_0x4228('0x1a')];var _0x5788e9=_0x4a8ab2?_0x36c580[_0x4228('0x1d')]:_0x34cc6b['offset']+_0x34cc6b['limit'];var _0x440cb1;if(_0x5788e9>=_0x5a6ce8){_0x5788e9=_0x5a6ce8;_0x440cb1=0xc8;}else{_0x440cb1=0xce;}_0x38e692[_0x4228('0x18')](_0x440cb1);return _0x38e692['set'](_0x4228('0x1e'),_0x1e8b5a+'-'+_0x5788e9+'/'+_0x5a6ce8)['json'](_0x36c580);}return null;};}function patchUpdates(_0x3d3578){return function(_0x1214a8){try{jsonpatch[_0x4228('0x1f')](_0x1214a8,_0x3d3578,!![]);}catch(_0x51773c){return BPromise[_0x4228('0x20')](_0x51773c);}return _0x1214a8[_0x4228('0x21')]();};}function saveUpdates(_0xfa5d1e,_0x2a0472){return function(_0x379a94){if(_0x379a94){return _0x379a94[_0x4228('0x22')](_0xfa5d1e)[_0x4228('0x23')](function(_0x225d77){return _0x225d77;});}return null;};}function removeEntity(_0x7a97ac,_0x315da9){return function(_0x1d6a19){if(_0x1d6a19){return _0x1d6a19['destroy']()['then'](function(){var _0x399549=_0x1d6a19[_0x4228('0x24')]({'plain':!![]});var _0x5d3dca=_0x4228('0x25');return db[_0x4228('0x26')][_0x4228('0x27')]({'where':{'type':_0x5d3dca,'resourceId':_0x399549['id']}})[_0x4228('0x23')](function(){return _0x1d6a19;});})[_0x4228('0x23')](function(){_0x7a97ac[_0x4228('0x18')](0xcc)[_0x4228('0x19')]();});}};}function handleEntityNotFound(_0x1e2f66,_0x460f50){return function(_0x61c1ea){if(!_0x61c1ea){_0x1e2f66[_0x4228('0x28')](0x194);}return _0x61c1ea;};}function handleError(_0xa657f9,_0x4c5b43){_0x4c5b43=_0x4c5b43||0x1f4;return function(_0x7d54e5){logger[_0x4228('0x29')](_0x7d54e5[_0x4228('0x2a')]);if(_0x7d54e5[_0x4228('0x2b')]){delete _0x7d54e5['name'];}_0xa657f9[_0x4228('0x18')](_0x4c5b43)[_0x4228('0x2c')](_0x7d54e5);};}exports[_0x4228('0x2d')]=function(_0x8478d2,_0x5b5663){var _0x271420={},_0x520bd9={},_0x6c6016={'count':0x0,'rows':[]};var _0x376908=_[_0x4228('0x2e')](db[_0x4228('0x2f')][_0x4228('0x30')],function(_0x37b2fd){return{'name':_0x37b2fd[_0x4228('0x31')],'type':_0x37b2fd['type'][_0x4228('0x32')]};});_0x520bd9['model']=_[_0x4228('0x2e')](_0x376908,'name');_0x520bd9[_0x4228('0x33')]=_[_0x4228('0x34')](_0x8478d2[_0x4228('0x33')]);_0x520bd9[_0x4228('0x35')]=_['intersection'](_0x520bd9[_0x4228('0x36')],_0x520bd9['query']);_0x271420[_0x4228('0x37')]=_['intersection'](_0x520bd9[_0x4228('0x36')],qs[_0x4228('0x38')](_0x8478d2[_0x4228('0x33')][_0x4228('0x38')]));_0x271420[_0x4228('0x37')]=_0x271420['attributes'][_0x4228('0x39')]?_0x271420[_0x4228('0x37')]:_0x520bd9[_0x4228('0x36')];if(!_0x8478d2[_0x4228('0x33')][_0x4228('0x3a')](_0x4228('0x3b'))){_0x271420[_0x4228('0x1c')]=qs[_0x4228('0x1c')](_0x8478d2[_0x4228('0x33')][_0x4228('0x1c')]);_0x271420[_0x4228('0x1a')]=qs[_0x4228('0x1a')](_0x8478d2['query']['offset']);}_0x271420[_0x4228('0x3c')]=qs['sort'](_0x8478d2[_0x4228('0x33')]['sort']);_0x271420[_0x4228('0x3d')]=qs['filters'](_['pick'](_0x8478d2[_0x4228('0x33')],_0x520bd9[_0x4228('0x35')]),_0x376908);if(_0x8478d2[_0x4228('0x33')][_0x4228('0x3e')]){_0x271420['where']=_['merge'](_0x271420['where'],{'$or':_[_0x4228('0x2e')](_0x376908,function(_0x307747){if(_0x307747[_0x4228('0x3f')]!=='VIRTUAL'){var _0x325cb1={};_0x325cb1[_0x307747['name']]={'$like':'%'+_0x8478d2[_0x4228('0x33')][_0x4228('0x3e')]+'%'};return _0x325cb1;}})});}_0x271420=_[_0x4228('0x40')]({},_0x271420,_0x8478d2['options']);var _0xa4b4e6={'where':_0x271420['where']};return db['Pause']['count'](_0xa4b4e6)[_0x4228('0x23')](function(_0x332667){_0x6c6016[_0x4228('0x1d')]=_0x332667;if(_0x8478d2[_0x4228('0x33')][_0x4228('0x41')]){_0x271420[_0x4228('0x42')]=[{'all':!![]}];}return db[_0x4228('0x2f')]['findAll'](_0x271420);})[_0x4228('0x23')](function(_0x2f030e){_0x6c6016[_0x4228('0x43')]=_0x2f030e;return _0x6c6016;})['then'](respondWithFilteredResult(_0x5b5663,_0x271420))[_0x4228('0x44')](handleError(_0x5b5663,null));};exports['show']=function(_0x4705cf,_0x4cd21c){var _0x4244fa={'raw':!![],'where':{'id':_0x4705cf[_0x4228('0x45')]['id']}},_0xe37d8d={};_0xe37d8d[_0x4228('0x36')]=_['keys'](db['Pause'][_0x4228('0x30')]);_0xe37d8d['query']=_[_0x4228('0x34')](_0x4705cf[_0x4228('0x33')]);_0xe37d8d['filters']=_[_0x4228('0x46')](_0xe37d8d[_0x4228('0x36')],_0xe37d8d[_0x4228('0x33')]);_0x4244fa[_0x4228('0x37')]=_[_0x4228('0x46')](_0xe37d8d[_0x4228('0x36')],qs[_0x4228('0x38')](_0x4705cf[_0x4228('0x33')][_0x4228('0x38')]));_0x4244fa[_0x4228('0x37')]=_0x4244fa[_0x4228('0x37')][_0x4228('0x39')]?_0x4244fa['attributes']:_0xe37d8d['model'];if(_0x4705cf[_0x4228('0x33')]['includeAll']){_0x4244fa['include']=[{'all':!![]}];}_0x4244fa=_[_0x4228('0x40')]({},_0x4244fa,_0x4705cf[_0x4228('0x47')]);return db[_0x4228('0x2f')][_0x4228('0x48')](_0x4244fa)[_0x4228('0x23')](handleEntityNotFound(_0x4cd21c,null))[_0x4228('0x23')](respondWithResult(_0x4cd21c,null))[_0x4228('0x44')](handleError(_0x4cd21c,null));};exports[_0x4228('0x49')]=function(_0x2f518b,_0x3eb227){return db[_0x4228('0x2f')]['create'](_0x2f518b['body'],{})[_0x4228('0x23')](function(_0x5101e5){var _0x478136=_0x2f518b[_0x4228('0x4a')]['get']({'plain':!![]});if(!_0x478136)throw new Error(_0x4228('0x4b'));if(_0x478136[_0x4228('0x4c')]===_0x4228('0x4a')){var _0x2ca838=_0x5101e5[_0x4228('0x24')]({'plain':!![]});var _0x1706f1='Pauses';return db[_0x4228('0x4d')][_0x4228('0x48')]({'where':{'name':_0x1706f1,'userProfileId':_0x478136[_0x4228('0x4e')]},'raw':!![]})[_0x4228('0x23')](function(_0x1d07da){if(_0x1d07da&&_0x1d07da[_0x4228('0x4f')]===0x0){return db[_0x4228('0x26')]['create']({'name':_0x2ca838[_0x4228('0x2b')],'resourceId':_0x2ca838['id'],'type':_0x1d07da[_0x4228('0x2b')],'sectionId':_0x1d07da['id']},{})[_0x4228('0x23')](function(){return _0x5101e5;});}else{return _0x5101e5;}})[_0x4228('0x44')](function(_0x26496d){logger[_0x4228('0x29')](_0x4228('0x50'),_0x26496d);throw _0x26496d;});}return _0x5101e5;})[_0x4228('0x23')](respondWithResult(_0x3eb227,0xc9))['catch'](handleError(_0x3eb227,null));};exports['update']=function(_0x1c0fcf,_0x1595e4){if(_0x1c0fcf[_0x4228('0x51')]['id']){delete _0x1c0fcf[_0x4228('0x51')]['id'];}return db[_0x4228('0x2f')][_0x4228('0x48')]({'where':{'id':_0x1c0fcf['params']['id']}})[_0x4228('0x23')](handleEntityNotFound(_0x1595e4,null))[_0x4228('0x23')](saveUpdates(_0x1c0fcf[_0x4228('0x51')],null))[_0x4228('0x23')](respondWithResult(_0x1595e4,null))[_0x4228('0x44')](handleError(_0x1595e4,null));};exports[_0x4228('0x27')]=function(_0x345638,_0xa9788c){return db[_0x4228('0x2f')][_0x4228('0x48')]({'where':{'id':_0x345638['params']['id']}})[_0x4228('0x23')](handleEntityNotFound(_0xa9788c,null))['then'](removeEntity(_0xa9788c,null))[_0x4228('0x44')](handleError(_0xa9788c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c16ece7..75c15ea 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x337cb4,_0x44e92e){var _0x2bc983=function(_0x3cea0f){while(--_0x3cea0f){_0x337cb4['push'](_0x337cb4['shift']());}};_0x2bc983(++_0x44e92e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x5fc3[_0x41d02a];return _0x4c3983;};'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 +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x2f37c3,_0x3f7bca){var _0x1d4563=function(_0x136cd7){while(--_0x136cd7){_0x2f37c3['push'](_0x2f37c3['shift']());}};_0x1d4563(++_0x3f7bca);}(_0xe14b,0x93));var _0xbe14=function(_0x3af8b4,_0x9f7c74){_0x3af8b4=_0x3af8b4-0x0;var _0x5adf0b=_0xe14b[_0x3af8b4];return _0x5adf0b;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index fc0bfc5..3e8de03 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(_0x27a7c7,_0x5dc841){var _0x1b59fc=function(_0x2eef37){while(--_0x2eef37){_0x27a7c7['push'](_0x27a7c7['shift']());}};_0x1b59fc(++_0x5dc841);}(_0xb10b,0x12a));var _0xbb10=function(_0x16ca8e,_0x60f267){_0x16ca8e=_0x16ca8e-0x0;var _0x4c560e=_0xb10b[_0x16ca8e];return _0x4c560e;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x301e95,_0x3ac2ef){var _0x30000a=function(_0x378d4c){while(--_0x378d4c){_0x301e95['push'](_0x301e95['shift']());}};_0x30000a(++_0x3ac2ef);}(_0x7a54,0x106));var _0x47a5=function(_0xf7708f,_0x28c6ed){_0xf7708f=_0xf7708f-0x0;var _0x57fe6a=_0x7a54[_0xf7708f];return _0x57fe6a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 799edd7..9370e18 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 _0x008c=['/:id','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','single','file','upload','post','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet'];(function(_0xf64e72,_0x25e758){var _0x52b5c1=function(_0x4d35aa){while(--_0x4d35aa){_0xf64e72['push'](_0xf64e72['shift']());}};_0x52b5c1(++_0x25e758);}(_0x008c,0x188));var _0xc008=function(_0x477270,_0x4adea6){_0x477270=_0x477270-0x0;var _0x21ae0d=_0x008c[_0x477270];return _0x21ae0d;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/webhook',controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xa')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eacfa,_0xc881aa,_0x5b2004){_0x5b2004(null,path[_0xc008('0x10')](config[_0xc008('0x11')],_0xc008('0x12')));},'filename':function(_0x2a5b4e,_0x9ffa93,_0x1819c6){_0x9ffa93[_0xc008('0x13')]=_0x9ffa93['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1819c6(null,util[_0xc008('0x14')]('%s-%s%s',path[_0xc008('0x15')](_0x9ffa93[_0xc008('0x13')],path[_0xc008('0x16')](_0x9ffa93[_0xc008('0x13')])),Date[_0xc008('0x17')](),path['extname'](_0x9ffa93['originalname'])));}})});router['post']('/',upload[_0xc008('0x18')](_0xc008('0x19')),controller[_0xc008('0x1a')]);router[_0xc008('0x1b')]('/webhook',controller['webhookPost']);router['put']('/:id',auth[_0xc008('0xb')](),controller[_0xc008('0x1c')]);router['delete'](_0xc008('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x72b1=['./plugin.controller','get','isAuthenticated','index','/webhook','show','/:id/download','download','diskStorage','join','root','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1d36f3,_0x29547e){var _0x83aebc=function(_0x1a5d47){while(--_0x1a5d47){_0x1d36f3['push'](_0x1d36f3['shift']());}};_0x83aebc(++_0x29547e);}(_0x72b1,0x16e));var _0x172b=function(_0x31e58e,_0x17cdb3){_0x31e58e=_0x31e58e-0x0;var _0x3cd349=_0x72b1[_0x31e58e];return _0x3cd349;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var fs_extra=require(_0x172b('0x5'));var auth=require(_0x172b('0x6'));var interaction=require(_0x172b('0x7'));var config=require('../../config/environment');var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller[_0x172b('0xb')]);router['get'](_0x172b('0xc'),controller['webhookGet']);router[_0x172b('0x9')]('/:id',auth[_0x172b('0xa')](),controller[_0x172b('0xd')]);router[_0x172b('0x9')](_0x172b('0xe'),auth['isAuthenticated'](),controller[_0x172b('0xf')]);var upload=multer({'storage':multer[_0x172b('0x10')]({'destination':function(_0x28aaad,_0x161c7c,_0xa4ada9){_0xa4ada9(null,path[_0x172b('0x11')](config[_0x172b('0x12')],'server/files/plugins'));},'filename':function(_0x13d285,_0x82727f,_0xdf832e){_0x82727f['originalname']=_0x82727f[_0x172b('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xdf832e(null,util[_0x172b('0x14')](_0x172b('0x15'),path['basename'](_0x82727f[_0x172b('0x13')],path[_0x172b('0x16')](_0x82727f[_0x172b('0x13')])),Date[_0x172b('0x17')](),path['extname'](_0x82727f['originalname'])));}})});router[_0x172b('0x18')]('/',upload[_0x172b('0x19')](_0x172b('0x1a')),controller[_0x172b('0x1b')]);router['post']('/webhook',controller[_0x172b('0x1c')]);router[_0x172b('0x1d')](_0x172b('0x1e'),auth[_0x172b('0xa')](),controller[_0x172b('0x1f')]);router['delete'](_0x172b('0x1e'),auth[_0x172b('0xa')](),controller[_0x172b('0x20')]);module[_0x172b('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6c2f6a5..8811f9d 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 _0x5e91=['STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x41fca8,_0x5b0cdb){var _0xfe1ad5=function(_0x487fd1){while(--_0x487fd1){_0x41fca8['push'](_0x41fca8['shift']());}};_0xfe1ad5(++_0x5b0cdb);}(_0x5e91,0x1cc));var _0x15e9=function(_0x187c30,_0x238119){_0x187c30=_0x187c30-0x0;var _0x391824=_0x5e91[_0x187c30];return _0x391824;};'use strict';var Sequelize=require(_0x15e9('0x0'));module[_0x15e9('0x1')]={'name':{'type':Sequelize[_0x15e9('0x2')]},'type':{'type':Sequelize[_0x15e9('0x3')]('html',_0x15e9('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x15e9('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x15e9('0x6')},'active':{'type':Sequelize[_0x15e9('0x7')],'defaultValue':0x0,'comment':_0x15e9('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x15e9('0x9'),_0x15e9('0xa'),_0x15e9('0xb'),_0x15e9('0xc')),'defaultValue':_0x15e9('0xb'),'comment':_0x15e9('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x15e9('0x2')]},'scriptPath':{'type':Sequelize[_0x15e9('0x2')]}}; \ No newline at end of file +var _0x080e=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x4b6b4f,_0x25a285){var _0x1250b7=function(_0xcec426){while(--_0xcec426){_0x4b6b4f['push'](_0x4b6b4f['shift']());}};_0x1250b7(++_0x25a285);}(_0x080e,0x110));var _0xe080=function(_0x4a456e,_0x5318dd){_0x4a456e=_0x4a456e-0x0;var _0x7428f5=_0x080e[_0x4a456e];return _0x7428f5;};'use strict';var Sequelize=require(_0xe080('0x0'));module[_0xe080('0x1')]={'name':{'type':Sequelize[_0xe080('0x2')]},'type':{'type':Sequelize[_0xe080('0x3')](_0xe080('0x4'),'script')},'description':{'type':Sequelize[_0xe080('0x5')]},'version':{'type':Sequelize[_0xe080('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0xe080('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xe080('0x3')](_0xe080('0x7'),'agentOnly',_0xe080('0x8'),_0xe080('0x9')),'defaultValue':_0xe080('0x8'),'comment':_0xe080('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xe080('0x2')]},'agentUrl':{'type':Sequelize[_0xe080('0x2')]},'scriptName':{'type':Sequelize[_0xe080('0x2')]},'scriptPath':{'type':Sequelize[_0xe080('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b438f93..c4c0668 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 _0xed2c=['offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','where','pick','filter','merge','options','include','findAll','catch','show','length','includeAll','find','download','params','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','join','root','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','filename','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','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','bluebird','mustache','path','fs-extra','squel','desk.js','to-csv','querystring','archiver','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./plugin.socket','sendStatus','status','end','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed2c,0x88));var _0xced2=function(_0x5b620e,_0x266273){_0x5b620e=_0x5b620e-0x0;var _0x6b7008=_0xed2c[_0x5b620e];return _0x6b7008;};'use strict';var emlformat=require(_0xced2('0x0'));var rimraf=require(_0xced2('0x1'));var zipdir=require(_0xced2('0x2'));var jsonpatch=require(_0xced2('0x3'));var rp=require(_0xced2('0x4'));var moment=require(_0xced2('0x5'));var BPromise=require(_0xced2('0x6'));var Mustache=require(_0xced2('0x7'));var util=require('util');var path=require(_0xced2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xced2('0x9'));var _=require('lodash');var squel=require(_0xced2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xced2('0xb'));var toCsv=require(_0xced2('0xc'));var querystring=require(_0xced2('0xd'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xced2('0x1'));var archiver=require(_0xced2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xced2('0xf'));var hardwareService=require(_0xced2('0x10'));var logger=require(_0xced2('0x11'))(_0xced2('0x12'));var utils=require(_0xced2('0x13'));var config=require(_0xced2('0x14'));var licenseUtil=require(_0xced2('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xced2('0x16')](config[_0xced2('0x17')],{'host':_0xced2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xced2('0x17')]));require(_0xced2('0x19'))['register'](socket);function respondWithStatusCode(_0x19d8c1,_0x33d6c0){_0x33d6c0=_0x33d6c0||0xcc;return function(_0x4603bd){if(_0x4603bd){return _0x19d8c1[_0xced2('0x1a')](_0x33d6c0);}return _0x19d8c1[_0xced2('0x1b')](_0x33d6c0)[_0xced2('0x1c')]();};}function respondWithResult(_0x48bfc3,_0x4b6f96){_0x4b6f96=_0x4b6f96||0xc8;return function(_0x1850cc){if(_0x1850cc){return _0x48bfc3[_0xced2('0x1b')](_0x4b6f96)[_0xced2('0x1d')](_0x1850cc);}};}function respondWithFilteredResult(_0x303a3e,_0x165765){return function(_0x5ea067){if(_0x5ea067){var _0x187aea=typeof _0x165765[_0xced2('0x1e')]===_0xced2('0x1f')&&typeof _0x165765['limit']===_0xced2('0x1f');var _0x5b0e36=_0x5ea067[_0xced2('0x20')];var _0x283bd6=_0x187aea?0x0:_0x165765[_0xced2('0x1e')];var _0xc589c=_0x187aea?_0x5ea067['count']:_0x165765[_0xced2('0x1e')]+_0x165765[_0xced2('0x21')];var _0x4ce122;if(_0xc589c>=_0x5b0e36){_0xc589c=_0x5b0e36;_0x4ce122=0xc8;}else{_0x4ce122=0xce;}_0x303a3e['status'](_0x4ce122);return _0x303a3e[_0xced2('0x22')](_0xced2('0x23'),_0x283bd6+'-'+_0xc589c+'/'+_0x5b0e36)['json'](_0x5ea067);}return null;};}function patchUpdates(_0x6b013a){return function(_0x5b8949){try{jsonpatch[_0xced2('0x24')](_0x5b8949,_0x6b013a,!![]);}catch(_0x2fe979){return BPromise[_0xced2('0x25')](_0x2fe979);}return _0x5b8949['save']();};}function saveUpdates(_0x12414c,_0x5892f5){return function(_0x2dea56){if(_0x2dea56){return _0x2dea56[_0xced2('0x26')](_0x12414c)[_0xced2('0x27')](function(_0x26d74c){return _0x26d74c;});}return null;};}function removeEntity(_0x60f8d7,_0x3509e4){return function(_0x55e5f5){if(_0x55e5f5){return _0x55e5f5['destroy']()[_0xced2('0x27')](function(){var _0x27f3b7=_0x55e5f5['get']({'plain':!![]});var _0x8973d0=_0xced2('0x28');return db[_0xced2('0x29')]['destroy']({'where':{'type':_0x8973d0,'resourceId':_0x27f3b7['id']}})[_0xced2('0x27')](function(){return _0x55e5f5;});})[_0xced2('0x27')](function(){_0x60f8d7[_0xced2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11a983,_0x1dd9f7){return function(_0x226c17){if(!_0x226c17){_0x11a983['sendStatus'](0x194);}return _0x226c17;};}function handleError(_0x1cd69e,_0x456fa8){_0x456fa8=_0x456fa8||0x1f4;return function(_0x46962e){logger[_0xced2('0x2a')](_0x46962e[_0xced2('0x2b')]);if(_0x46962e[_0xced2('0x2c')]){delete _0x46962e[_0xced2('0x2c')];}_0x1cd69e['status'](_0x456fa8)[_0xced2('0x2d')](_0x46962e);};}exports[_0xced2('0x2e')]=function(_0x17cd12,_0x480902){var _0x3a1c31={},_0x2a48bf={},_0x2895d9={'count':0x0,'rows':[]};var _0x2789f9=_['map'](db[_0xced2('0x2f')][_0xced2('0x30')],function(_0xa40965){return{'name':_0xa40965[_0xced2('0x31')],'type':_0xa40965[_0xced2('0x32')][_0xced2('0x33')]};});_0x2a48bf[_0xced2('0x34')]=_[_0xced2('0x35')](_0x2789f9,_0xced2('0x2c'));_0x2a48bf[_0xced2('0x36')]=_[_0xced2('0x37')](_0x17cd12[_0xced2('0x36')]);_0x2a48bf[_0xced2('0x38')]=_['intersection'](_0x2a48bf[_0xced2('0x34')],_0x2a48bf[_0xced2('0x36')]);_0x3a1c31[_0xced2('0x39')]=_[_0xced2('0x3a')](_0x2a48bf['model'],qs[_0xced2('0x3b')](_0x17cd12['query'][_0xced2('0x3b')]));_0x3a1c31[_0xced2('0x39')]=_0x3a1c31['attributes']['length']?_0x3a1c31[_0xced2('0x39')]:_0x2a48bf['model'];if(!_0x17cd12[_0xced2('0x36')][_0xced2('0x3c')](_0xced2('0x3d'))){_0x3a1c31[_0xced2('0x21')]=qs[_0xced2('0x21')](_0x17cd12[_0xced2('0x36')]['limit']);_0x3a1c31[_0xced2('0x1e')]=qs['offset'](_0x17cd12[_0xced2('0x36')][_0xced2('0x1e')]);}_0x3a1c31['order']=qs['sort'](_0x17cd12[_0xced2('0x36')]['sort']);_0x3a1c31[_0xced2('0x3e')]=qs[_0xced2('0x38')](_[_0xced2('0x3f')](_0x17cd12[_0xced2('0x36')],_0x2a48bf[_0xced2('0x38')]),_0x2789f9);if(_0x17cd12['query'][_0xced2('0x40')]){_0x3a1c31[_0xced2('0x3e')]=_['merge'](_0x3a1c31['where'],{'$or':_['map'](_0x2789f9,function(_0x103ffc){if(_0x103ffc[_0xced2('0x32')]!=='VIRTUAL'){var _0x4c5b5c={};_0x4c5b5c[_0x103ffc[_0xced2('0x2c')]]={'$like':'%'+_0x17cd12[_0xced2('0x36')]['filter']+'%'};return _0x4c5b5c;}})});}_0x3a1c31=_[_0xced2('0x41')]({},_0x3a1c31,_0x17cd12[_0xced2('0x42')]);var _0x546a23={'where':_0x3a1c31[_0xced2('0x3e')]};return db[_0xced2('0x2f')][_0xced2('0x20')](_0x546a23)[_0xced2('0x27')](function(_0x44cca4){_0x2895d9['count']=_0x44cca4;if(_0x17cd12[_0xced2('0x36')]['includeAll']){_0x3a1c31[_0xced2('0x43')]=[{'all':!![]}];}return db['Plugin'][_0xced2('0x44')](_0x3a1c31);})[_0xced2('0x27')](function(_0x18fed3){_0x2895d9['rows']=_0x18fed3;return _0x2895d9;})['then'](respondWithFilteredResult(_0x480902,_0x3a1c31))[_0xced2('0x45')](handleError(_0x480902,null));};exports[_0xced2('0x46')]=function(_0x4b2474,_0x17d45e){var _0x4fe452={'raw':!![],'where':{'id':_0x4b2474['params']['id']}},_0x54dc29={};_0x54dc29[_0xced2('0x34')]=_[_0xced2('0x37')](db['Plugin'][_0xced2('0x30')]);_0x54dc29[_0xced2('0x36')]=_['keys'](_0x4b2474[_0xced2('0x36')]);_0x54dc29[_0xced2('0x38')]=_[_0xced2('0x3a')](_0x54dc29[_0xced2('0x34')],_0x54dc29['query']);_0x4fe452[_0xced2('0x39')]=_[_0xced2('0x3a')](_0x54dc29['model'],qs['fields'](_0x4b2474['query'][_0xced2('0x3b')]));_0x4fe452[_0xced2('0x39')]=_0x4fe452[_0xced2('0x39')][_0xced2('0x47')]?_0x4fe452[_0xced2('0x39')]:_0x54dc29[_0xced2('0x34')];if(_0x4b2474['query'][_0xced2('0x48')]){_0x4fe452[_0xced2('0x43')]=[{'all':!![]}];}_0x4fe452=_[_0xced2('0x41')]({},_0x4fe452,_0x4b2474['options']);return db[_0xced2('0x2f')][_0xced2('0x49')](_0x4fe452)['then'](handleEntityNotFound(_0x17d45e,null))[_0xced2('0x27')](respondWithResult(_0x17d45e,null))['catch'](handleError(_0x17d45e,null));};exports[_0xced2('0x4a')]=function(_0x2484f3,_0x3dd74c,_0x5198da){return db['Plugin'][_0xced2('0x49')]({'where':{'id':_0x2484f3[_0xced2('0x4b')]['id']},'attributes':[_0xced2('0x2c'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x3dd74c,null))[_0xced2('0x27')](function(_0x1b0cba){if(_0x1b0cba){var _0x56f314=path['join'](config['root'],_0xced2('0x4c'),util[_0xced2('0x4d')](_0xced2('0x4e'),path[_0xced2('0x4f')](_0x1b0cba[_0xced2('0x8')])));var _0x3ccf7a=fs[_0xced2('0x50')](_0x56f314);var _0x1232c6=archiver(_0xced2('0x51'),{'zlib':{'level':0x9}});_0x1232c6['on']('warning',function(_0x317644){if(_0x317644[_0xced2('0x52')]===_0xced2('0x53')){logger[_0xced2('0x2a')](_0x317644);}else{throw new db[(_0xced2('0x54'))]['Error'](_0xced2('0x55'));}});_0x1232c6['on'](_0xced2('0x2a'),function(_0x3903fc){throw new db['Sequelize'][(_0xced2('0x56'))](_0xced2('0x55'));});_0x1232c6[_0xced2('0x57')](_0x3ccf7a);_0x1232c6[_0xced2('0x58')](_0xced2('0x59'),{'cwd':path[_0xced2('0x5a')](config[_0xced2('0x5b')],_0xced2('0x4c'),path[_0xced2('0x5c')](_0x1b0cba['path'])),'ignore':[path[_0xced2('0x5a')](path[_0xced2('0x4f')](_0x1b0cba[_0xced2('0x8')]),_0xced2('0x5d')),path[_0xced2('0x5a')](path[_0xced2('0x4f')](_0x1b0cba[_0xced2('0x8')]),_0xced2('0x5e'))],'nodir':!![]})[_0xced2('0x5f')]();_0x3ccf7a['on']('close',function(){if(!fs[_0xced2('0x60')](_0x56f314)){throw new db[(_0xced2('0x54'))][(_0xced2('0x56'))](_0xced2('0x61'));}return _0x3dd74c[_0xced2('0x4a')](_0x56f314,util['format'](_0xced2('0x4e'),path[_0xced2('0x4f')](_0x1b0cba[_0xced2('0x8')])),function(_0x4a02f4){if(_0x4a02f4){throw new db[(_0xced2('0x54'))][(_0xced2('0x56'))](_0xced2('0x62'));}fs[_0xced2('0x63')](_0x56f314);logger[_0xced2('0x64')]('Download\x20completed');logger['info'](_0xced2('0x65'));});});}return null;})[_0xced2('0x45')](handleError(_0x3dd74c,null));};exports[_0xced2('0x66')]=function(_0x11402c,_0x3a0c1f,_0x1064bf){var _0x24a14c=path[_0xced2('0x4f')](_0x11402c['file'][_0xced2('0x67')],path['extname'](_0x11402c[_0xced2('0x68')][_0xced2('0x67')]));var _0x2ae579=path[_0xced2('0x5a')](config[_0xced2('0x5b')],'server/files/plugins',_0x11402c[_0xced2('0x68')][_0xced2('0x67')]);var _0x467f80=path[_0xced2('0x5a')](config[_0xced2('0x5b')],_0xced2('0x4c'),_0x24a14c);logger[_0xced2('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x2ae579);logger[_0xced2('0x64')](_0xced2('0x69'),_0x467f80);try{fs[_0xced2('0x6a')](_0x2ae579,parseInt('0777',0x8));extract(_0x2ae579,{'dir':_0x467f80},function(_0x1155e2){if(_0x1155e2){logger[_0xced2('0x2a')](_0x1155e2);handleError(_0x1155e2,!![]);};var _0x2b8053=fs['readdirSync'](_0x467f80);if(_0x2b8053['length']>0x1){removeReferences(_0x2ae579,_0x467f80);logger[_0xced2('0x2a')](_0xced2('0x6b'));return _0x1064bf(new Error(_0xced2('0x6b')));}var _0x1df153=fs[_0xced2('0x6c')](path['join'](_0x467f80,_0x2b8053[0x0]));if(_0x1df153[_0xced2('0x6d')]()){removeReferences(_0x2ae579,_0x467f80);logger['error'](_0xced2('0x6b'));return _0x1064bf(new Error(_0xced2('0x6b')));}if(_0x1df153[_0xced2('0x6e')]()){var _0x88bde3=fs[_0xced2('0x6f')](path[_0xced2('0x5a')](_0x467f80,_0x2b8053[0x0]));if(_0x88bde3[_0xced2('0x47')]===0x0){removeReferences(_0x2ae579,_0x467f80);logger[_0xced2('0x2a')](_0xced2('0x6b'));return _0x1064bf(new Error(_0xced2('0x6b')));}var _0x5f0385=_0x88bde3[_0xced2('0x70')](function(_0x9213fa){return _0x9213fa===_0xced2('0x71');});if(!_0x5f0385){return _0x1064bf(new Error(_0xced2('0x72')));}var _0x4b5222=fs['readFileSync'](path['join'](_0x467f80,_0x2b8053[0x0],_0xced2('0x71')));var _0x121e1c=JSON[_0xced2('0x73')](_0x4b5222);if(_0xced2('0x1f')==typeof _0x121e1c['name']){return _0x1064bf(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x121e1c[_0xced2('0x32')]){return _0x1064bf(new Error(_0xced2('0x74')));}if('undefined'==typeof _0x121e1c[_0xced2('0x75')]){return _0x1064bf(new Error(_0xced2('0x76')));}if(_0xced2('0x1f')==typeof _0x121e1c['parameters']){return _0x1064bf(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x121e1c[_0xced2('0x32')]===_0xced2('0x77')){if(_0xced2('0x1f')==typeof _0x121e1c['parameters'][_0xced2('0x78')]){return _0x1064bf(new Error(_0xced2('0x79')));}if(_0xced2('0x1f')==typeof _0x121e1c[_0xced2('0x7a')][_0xced2('0x78')][_0xced2('0x7b')]&&_0xced2('0x1f')==typeof _0x121e1c['parameters'][_0xced2('0x78')]['agent']){return _0x1064bf(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x121e1c[_0xced2('0x32')]===_0xced2('0x7c')){if(_0xced2('0x1f')==typeof _0x121e1c['parameters'][_0xced2('0x7d')]){return _0x1064bf(new Error(_0xced2('0x7e')));}if(_0xced2('0x1f')==typeof _0x121e1c[_0xced2('0x7a')]['scriptPath']){return _0x1064bf(new Error(_0xced2('0x7f')));}}else{return _0x1064bf(new Error(_0xced2('0x80')));}var _0x34d99a=_0x121e1c['name'];var _0x509622=_0x121e1c['description'];var _0x430034=_0x121e1c[_0xced2('0x32')];var _0x2fad84=_0x121e1c['sidebar']?_0x121e1c[_0xced2('0x81')]:'always';var _0x294162=_0x121e1c[_0xced2('0x82')]?_0x121e1c[_0xced2('0x82')]:_0xced2('0x83');var _0x22f5d7='';var _0x4d3f96='';var _0x6f9b0e='';var _0x28d3cd='';var _0x27c68c=_0x121e1c[_0xced2('0x75')];if(_0x430034===_0xced2('0x77')){if(_0xced2('0x1f')!=typeof _0x121e1c[_0xced2('0x7a')]['views'][_0xced2('0x7b')]){var _0x5de783=_0x121e1c['parameters'][_0xced2('0x78')][_0xced2('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xced2('0x84')](_0x5de783)){_0x22f5d7=path[_0xced2('0x5a')](_0xced2('0x85'),_0x24a14c,_0x2b8053[0x0],_0x5de783);}else{_0x22f5d7=_0x5de783;}}else{logger[_0xced2('0x64')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x121e1c['parameters'][_0xced2('0x78')]['agent']){var _0x3f1441=_0x121e1c['parameters'][_0xced2('0x78')][_0xced2('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xced2('0x84')](_0x3f1441)){_0x4d3f96=path[_0xced2('0x5a')](_0xced2('0x85'),_0x24a14c,_0x2b8053[0x0],_0x3f1441);}else{_0x4d3f96=_0x3f1441;}}else{logger[_0xced2('0x64')](_0xced2('0x87'));}}else if(_0x430034===_0xced2('0x7c')){_0x6f9b0e=_0x121e1c[_0xced2('0x7a')]['scriptName'];_0x28d3cd=_0x121e1c[_0xced2('0x7a')][_0xced2('0x88')];if('undefined'!=typeof _0x121e1c[_0xced2('0x7a')]['views']){if(_0xced2('0x1f')!=typeof _0x121e1c[_0xced2('0x7a')]['views'][_0xced2('0x7b')]){var _0x5de783=_0x121e1c[_0xced2('0x7a')]['views'][_0xced2('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xced2('0x84')](_0x5de783)){_0x22f5d7=path[_0xced2('0x5a')](_0xced2('0x85'),_0x24a14c,_0x2b8053[0x0],_0x5de783);}else{_0x22f5d7=_0x5de783;}}if(_0xced2('0x1f')!=typeof _0x121e1c['parameters'][_0xced2('0x78')]['agent']){var _0x3f1441=_0x121e1c[_0xced2('0x7a')]['views'][_0xced2('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xced2('0x84')](_0x3f1441)){_0x4d3f96=path[_0xced2('0x5a')](_0xced2('0x85'),_0x24a14c,_0x2b8053[0x0],_0x3f1441);}else{_0x4d3f96=_0x3f1441;}}}}var _0x2ee3f2={'name':_0x34d99a,'description':_0x509622,'path':path[_0xced2('0x5a')](_0x24a14c,_0x2b8053[0x0]),'type':_0x430034,'sidebar':_0x2fad84,'icon':_0x294162,'adminUrl':_0x22f5d7,'agentUrl':_0x4d3f96,'scriptName':_0x6f9b0e,'scriptPath':_0x28d3cd,'version':_0x27c68c};removeReferences(_0x2ae579,null);return db['Plugin'][_0xced2('0x89')](_0x2ee3f2)[_0xced2('0x27')](function(_0x1f3e29){var _0x22ac68={'role':_0x11402c[_0xced2('0x8a')]['role'],'userProfileId':_0x11402c[_0xced2('0x8a')][_0xced2('0x8b')]};if(!_0x22ac68)throw new Error(_0xced2('0x8c'));if(_0x22ac68[_0xced2('0x8d')]===_0xced2('0x8e')){var _0x364068=_0x1f3e29[_0xced2('0x8f')]({'plain':!![]});return db[_0xced2('0x90')][_0xced2('0x49')]({'where':{'name':_0xced2('0x28'),'userProfileId':_0x22ac68[_0xced2('0x8b')]},'raw':!![]})[_0xced2('0x27')](function(_0x2429e5){if(_0x2429e5&&_0x2429e5[_0xced2('0x91')]===0x0){return db[_0xced2('0x29')]['create']({'name':_0x364068['name'],'resourceId':_0x364068['id'],'type':_0x2429e5[_0xced2('0x2c')],'sectionId':_0x2429e5['id']},{})[_0xced2('0x27')](function(){return _0x1f3e29;});}else{return _0x1f3e29;}})[_0xced2('0x45')](function(_0x5044cc){logger[_0xced2('0x2a')](_0xced2('0x92'),_0x5044cc);throw _0x5044cc;});}return _0x1f3e29;})[_0xced2('0x27')](respondWithResult(_0x3a0c1f,null))[_0xced2('0x45')](handleError(_0x3a0c1f,null));}});}catch(_0x170e69){_0x3a0c1f[_0xced2('0x1b')](0x1f4)[_0xced2('0x2d')](_0x170e69);}};function removeReferences(_0x1fe9d7,_0x1888ba){try{if(_0x1fe9d7){fs['unlinkSync'](_0x1fe9d7);logger[_0xced2('0x64')]('Zip\x20archive\x20removed');}if(_0x1888ba){rimraf(_0x1888ba,function(){});logger[_0xced2('0x64')](_0xced2('0x93'));}}catch(_0x55aab2){logger[_0xced2('0x2a')](_0x55aab2);}}exports[_0xced2('0x26')]=function(_0x5c94ca,_0x268034,_0x252f2f){return db[_0xced2('0x2f')][_0xced2('0x49')]({'where':{'id':_0x5c94ca[_0xced2('0x4b')]['id']}})[_0xced2('0x27')](handleEntityNotFound(_0x268034,null))[_0xced2('0x27')](saveUpdates(_0x5c94ca[_0xced2('0x8a')],null))[_0xced2('0x27')](respondWithResult(_0x268034,null))[_0xced2('0x45')](handleError(_0x268034,null));};exports[_0xced2('0x94')]=function(_0x1f17e9,_0x5e9584,_0x430b12){return db[_0xced2('0x2f')][_0xced2('0x49')]({'where':{'id':_0x1f17e9['params']['id']}})[_0xced2('0x27')](function(_0x3819e8){if(_0x3819e8){return _0x3819e8[_0xced2('0x95')]();}})[_0xced2('0x27')](function(_0x389085){rimraf(path[_0xced2('0x5a')](config['root'],_0xced2('0x4c'),path[_0xced2('0x5c')](_0x389085[_0xced2('0x8')])),function(){});return _0x389085;})[_0xced2('0x27')](handleEntityNotFound(_0x5e9584,null))['then'](respondWithStatusCode(_0x5e9584,null))['catch'](handleError(_0x5e9584,null));};exports[_0xced2('0x96')]=function(_0x5a3198,_0x31fa08,_0x593abb){return BPromise[_0xced2('0x97')]()[_0xced2('0x27')](function(){if(!_0x5a3198['query'][_0xced2('0x8')]){throw new Error(_0xced2('0x98'));}if(!_0x5a3198['query']['port']){throw new Error(_0xced2('0x99'));}var _0x1d61a9=_0x5a3198['query'][_0xced2('0x9a')]?_0x5a3198[_0xced2('0x36')][_0xced2('0x9a')]+':'+_0x5a3198[_0xced2('0x36')][_0xced2('0x9b')]:_0xced2('0x9c')+_0x5a3198[_0xced2('0x36')]['port'];var _0x153883=_0x5a3198[_0xced2('0x36')][_0xced2('0x1d')]?_0x5a3198[_0xced2('0x36')][_0xced2('0x1d')]:!![];var _0x5240a3=_0x5a3198[_0xced2('0x36')][_0xced2('0x9d')]?_0x5a3198['query'][_0xced2('0x9d')]:null;var _0x1fd611={'method':_0x5a3198[_0xced2('0x9e')],'uri':util['format'](_0xced2('0x9f'),_0x1d61a9,_0x5a3198[_0xced2('0x36')][_0xced2('0x8')]),'json':_0x153883,'resolveWithFullResponse':!![],'encoding':_0x5240a3,'qs':_0x5a3198[_0xced2('0x36')]};if(_0x5a3198[_0xced2('0xa0')]){_0x1fd611['headers']=_0x5a3198[_0xced2('0xa0')];if(_0x1fd611[_0xced2('0xa0')][_0xced2('0xa1')]){delete _0x1fd611['headers'][_0xced2('0xa1')];}}if(_0x1fd611[_0xced2('0xa0')]['content-type']){delete _0x1fd611[_0xced2('0xa0')][_0xced2('0xa2')];}return rp(_0x1fd611);})[_0xced2('0x27')](function(_0x4ae40c){if(_0x4ae40c){_0x31fa08['set'](_0x4ae40c['headers']);logger['info'](_0x4ae40c[_0xced2('0x8a')]);if(_[_0xced2('0xa3')](_0x5a3198[_0xced2('0x36')][_0xced2('0x8')],_0xced2('0x4a'))&&_0x4ae40c['statusCode']==0x1f4){return _0x31fa08[_0xced2('0x1a')](_0x4ae40c[_0xced2('0xa4')]);}else{return _0x31fa08[_0xced2('0x1b')](_0x4ae40c[_0xced2('0xa4')])[_0xced2('0x2d')](_0x4ae40c[_0xced2('0x8a')]);}}else{return _0x31fa08[_0xced2('0x1a')](0xc8);}})[_0xced2('0x45')](handleError(_0x31fa08,null));};exports[_0xced2('0xa5')]=function(_0x3019b6,_0x5cc714,_0x223d38){return BPromise[_0xced2('0x97')]()[_0xced2('0x27')](function(){if(!_0x3019b6['query'][_0xced2('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3019b6[_0xced2('0x36')][_0xced2('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x209f46=_0x3019b6['query'][_0xced2('0x9a')]?_0x3019b6[_0xced2('0x36')][_0xced2('0x9a')]+':'+_0x3019b6[_0xced2('0x36')]['port']:_0xced2('0x9c')+_0x3019b6[_0xced2('0x36')][_0xced2('0x9b')];var _0x40721d=_0x3019b6[_0xced2('0x36')][_0xced2('0x1d')]?_0x3019b6[_0xced2('0x36')]['json']:!![];var _0x477503=_0x3019b6['query'][_0xced2('0x9d')]?_0x3019b6[_0xced2('0x36')][_0xced2('0x9d')]:null;var _0x26b75d={'method':_0x3019b6[_0xced2('0x9e')],'uri':util['format'](_0xced2('0x9f'),_0x209f46,_0x3019b6[_0xced2('0x36')][_0xced2('0x8')]),'json':_0x40721d,'resolveWithFullResponse':!![],'encoding':_0x477503,'body':_0x3019b6[_0xced2('0x8a')]};if(_0x3019b6[_0xced2('0xa0')]){_0x26b75d[_0xced2('0xa0')]=_0x3019b6['headers'];if(_0x26b75d[_0xced2('0xa0')][_0xced2('0xa1')]){delete _0x26b75d[_0xced2('0xa0')][_0xced2('0xa1')];}}if(_0x26b75d[_0xced2('0xa0')][_0xced2('0xa2')]){delete _0x26b75d[_0xced2('0xa0')][_0xced2('0xa2')];}return rp(_0x26b75d);})[_0xced2('0x27')](function(_0x377d01){if(_0x377d01){_0x5cc714[_0xced2('0x22')](_0x377d01['headers']);logger[_0xced2('0x64')](_0x377d01[_0xced2('0x8a')]);return _0x5cc714[_0xced2('0x1b')](_0x377d01['statusCode'])[_0xced2('0x2d')](_0x377d01[_0xced2('0x8a')]);}else{return _0x5cc714[_0xced2('0x1a')](0xc8);}})['catch'](handleError(_0x5cc714,null));}; \ No newline at end of file +var _0x62bf=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','offset','undefined','limit','Content-Range','apply','reject','then','destroy','get','Plugins','sendStatus','name','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','json','%s%s'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x62bf,0xae));var _0xf62b=function(_0x589ee8,_0x9a25b0){_0x589ee8=_0x589ee8-0x0;var _0x8f023b=_0x62bf[_0x589ee8];return _0x8f023b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf62b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf62b('0x1'));var rp=require('request-promise');var moment=require(_0xf62b('0x2'));var BPromise=require(_0xf62b('0x3'));var Mustache=require(_0xf62b('0x4'));var util=require(_0xf62b('0x5'));var path=require(_0xf62b('0x6'));var sox=require(_0xf62b('0x7'));var csv=require('to-csv');var ejs=require(_0xf62b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf62b('0x9'));var squel=require(_0xf62b('0xa'));var crypto=require(_0xf62b('0xb'));var jsforce=require(_0xf62b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf62b('0xd'));var querystring=require(_0xf62b('0xe'));var Papa=require(_0xf62b('0xf'));var extract=require(_0xf62b('0x10'));var rimraf=require('rimraf');var archiver=require(_0xf62b('0x11'));var Redis=require(_0xf62b('0x12'));var authService=require(_0xf62b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf62b('0x14'));var hardwareService=require(_0xf62b('0x15'));var logger=require(_0xf62b('0x16'))(_0xf62b('0x17'));var utils=require(_0xf62b('0x18'));var config=require(_0xf62b('0x19'));var licenseUtil=require(_0xf62b('0x1a'));var db=require(_0xf62b('0x1b'))['db'];config[_0xf62b('0x1c')]=_[_0xf62b('0x1d')](config[_0xf62b('0x1c')],{'host':_0xf62b('0x1e'),'port':0x18eb});var socket=require(_0xf62b('0x1f'))(new Redis(config[_0xf62b('0x1c')]));require(_0xf62b('0x20'))[_0xf62b('0x21')](socket);function respondWithStatusCode(_0x54c437,_0x35f46f){_0x35f46f=_0x35f46f||0xcc;return function(_0x1d3b53){if(_0x1d3b53){return _0x54c437['sendStatus'](_0x35f46f);}return _0x54c437[_0xf62b('0x22')](_0x35f46f)[_0xf62b('0x23')]();};}function respondWithResult(_0xf1553a,_0x5a9b91){_0x5a9b91=_0x5a9b91||0xc8;return function(_0x103c8c){if(_0x103c8c){return _0xf1553a[_0xf62b('0x22')](_0x5a9b91)['json'](_0x103c8c);}};}function respondWithFilteredResult(_0x100ecf,_0x17c6eb){return function(_0x2f4f55){if(_0x2f4f55){var _0x46d194=typeof _0x17c6eb[_0xf62b('0x24')]===_0xf62b('0x25')&&typeof _0x17c6eb[_0xf62b('0x26')]===_0xf62b('0x25');var _0x47eb6f=_0x2f4f55['count'];var _0x385619=_0x46d194?0x0:_0x17c6eb[_0xf62b('0x24')];var _0x4749d8=_0x46d194?_0x2f4f55['count']:_0x17c6eb[_0xf62b('0x24')]+_0x17c6eb[_0xf62b('0x26')];var _0x280b47;if(_0x4749d8>=_0x47eb6f){_0x4749d8=_0x47eb6f;_0x280b47=0xc8;}else{_0x280b47=0xce;}_0x100ecf[_0xf62b('0x22')](_0x280b47);return _0x100ecf['set'](_0xf62b('0x27'),_0x385619+'-'+_0x4749d8+'/'+_0x47eb6f)['json'](_0x2f4f55);}return null;};}function patchUpdates(_0x193ac1){return function(_0x42ec83){try{jsonpatch[_0xf62b('0x28')](_0x42ec83,_0x193ac1,!![]);}catch(_0x381633){return BPromise[_0xf62b('0x29')](_0x381633);}return _0x42ec83['save']();};}function saveUpdates(_0x17be98,_0x12894d){return function(_0x58a25c){if(_0x58a25c){return _0x58a25c['update'](_0x17be98)[_0xf62b('0x2a')](function(_0x246b82){return _0x246b82;});}return null;};}function removeEntity(_0x47a33d,_0x257257){return function(_0x45a0d6){if(_0x45a0d6){return _0x45a0d6[_0xf62b('0x2b')]()[_0xf62b('0x2a')](function(){var _0x9bead7=_0x45a0d6[_0xf62b('0x2c')]({'plain':!![]});var _0x39b550=_0xf62b('0x2d');return db['UserProfileResource'][_0xf62b('0x2b')]({'where':{'type':_0x39b550,'resourceId':_0x9bead7['id']}})['then'](function(){return _0x45a0d6;});})[_0xf62b('0x2a')](function(){_0x47a33d['status'](0xcc)[_0xf62b('0x23')]();});}};}function handleEntityNotFound(_0x33aaf3,_0x26b34a){return function(_0x480fcd){if(!_0x480fcd){_0x33aaf3[_0xf62b('0x2e')](0x194);}return _0x480fcd;};}function handleError(_0x573e99,_0x2f7af3){_0x2f7af3=_0x2f7af3||0x1f4;return function(_0x113dd3){logger['error'](_0x113dd3['stack']);if(_0x113dd3[_0xf62b('0x2f')]){delete _0x113dd3[_0xf62b('0x2f')];}_0x573e99[_0xf62b('0x22')](_0x2f7af3)['send'](_0x113dd3);};}exports['index']=function(_0x2f8e07,_0x241a70){var _0x3d3173={},_0x5633a1={},_0x5aed4b={'count':0x0,'rows':[]};var _0xb6659f=_[_0xf62b('0x30')](db[_0xf62b('0x31')][_0xf62b('0x32')],function(_0x367d9d){return{'name':_0x367d9d[_0xf62b('0x33')],'type':_0x367d9d[_0xf62b('0x34')][_0xf62b('0x35')]};});_0x5633a1[_0xf62b('0x36')]=_[_0xf62b('0x30')](_0xb6659f,_0xf62b('0x2f'));_0x5633a1[_0xf62b('0x37')]=_[_0xf62b('0x38')](_0x2f8e07[_0xf62b('0x37')]);_0x5633a1[_0xf62b('0x39')]=_[_0xf62b('0x3a')](_0x5633a1['model'],_0x5633a1[_0xf62b('0x37')]);_0x3d3173['attributes']=_[_0xf62b('0x3a')](_0x5633a1['model'],qs[_0xf62b('0x3b')](_0x2f8e07[_0xf62b('0x37')][_0xf62b('0x3b')]));_0x3d3173['attributes']=_0x3d3173['attributes'][_0xf62b('0x3c')]?_0x3d3173[_0xf62b('0x3d')]:_0x5633a1['model'];if(!_0x2f8e07['query'][_0xf62b('0x3e')]('nolimit')){_0x3d3173[_0xf62b('0x26')]=qs[_0xf62b('0x26')](_0x2f8e07['query'][_0xf62b('0x26')]);_0x3d3173['offset']=qs[_0xf62b('0x24')](_0x2f8e07[_0xf62b('0x37')][_0xf62b('0x24')]);}_0x3d3173['order']=qs['sort'](_0x2f8e07[_0xf62b('0x37')][_0xf62b('0x3f')]);_0x3d3173[_0xf62b('0x40')]=qs[_0xf62b('0x39')](_[_0xf62b('0x41')](_0x2f8e07[_0xf62b('0x37')],_0x5633a1[_0xf62b('0x39')]),_0xb6659f);if(_0x2f8e07[_0xf62b('0x37')][_0xf62b('0x42')]){_0x3d3173[_0xf62b('0x40')]=_['merge'](_0x3d3173[_0xf62b('0x40')],{'$or':_[_0xf62b('0x30')](_0xb6659f,function(_0x4bdf4e){if(_0x4bdf4e[_0xf62b('0x34')]!==_0xf62b('0x43')){var _0xa6a4ba={};_0xa6a4ba[_0x4bdf4e[_0xf62b('0x2f')]]={'$like':'%'+_0x2f8e07['query'][_0xf62b('0x42')]+'%'};return _0xa6a4ba;}})});}_0x3d3173=_[_0xf62b('0x44')]({},_0x3d3173,_0x2f8e07[_0xf62b('0x45')]);var _0x314594={'where':_0x3d3173['where']};return db[_0xf62b('0x31')][_0xf62b('0x46')](_0x314594)['then'](function(_0xec011c){_0x5aed4b[_0xf62b('0x46')]=_0xec011c;if(_0x2f8e07[_0xf62b('0x37')][_0xf62b('0x47')]){_0x3d3173[_0xf62b('0x48')]=[{'all':!![]}];}return db[_0xf62b('0x31')][_0xf62b('0x49')](_0x3d3173);})[_0xf62b('0x2a')](function(_0x5b718d){_0x5aed4b[_0xf62b('0x4a')]=_0x5b718d;return _0x5aed4b;})[_0xf62b('0x2a')](respondWithFilteredResult(_0x241a70,_0x3d3173))[_0xf62b('0x4b')](handleError(_0x241a70,null));};exports[_0xf62b('0x4c')]=function(_0x5a3c1a,_0x15e1b9){var _0x24b127={'raw':!![],'where':{'id':_0x5a3c1a[_0xf62b('0x4d')]['id']}},_0x1b85ec={};_0x1b85ec[_0xf62b('0x36')]=_['keys'](db[_0xf62b('0x31')][_0xf62b('0x32')]);_0x1b85ec[_0xf62b('0x37')]=_['keys'](_0x5a3c1a[_0xf62b('0x37')]);_0x1b85ec[_0xf62b('0x39')]=_[_0xf62b('0x3a')](_0x1b85ec['model'],_0x1b85ec['query']);_0x24b127[_0xf62b('0x3d')]=_[_0xf62b('0x3a')](_0x1b85ec[_0xf62b('0x36')],qs[_0xf62b('0x3b')](_0x5a3c1a['query']['fields']));_0x24b127[_0xf62b('0x3d')]=_0x24b127['attributes'][_0xf62b('0x3c')]?_0x24b127[_0xf62b('0x3d')]:_0x1b85ec[_0xf62b('0x36')];if(_0x5a3c1a[_0xf62b('0x37')]['includeAll']){_0x24b127[_0xf62b('0x48')]=[{'all':!![]}];}_0x24b127=_[_0xf62b('0x44')]({},_0x24b127,_0x5a3c1a[_0xf62b('0x45')]);return db['Plugin']['find'](_0x24b127)['then'](handleEntityNotFound(_0x15e1b9,null))['then'](respondWithResult(_0x15e1b9,null))[_0xf62b('0x4b')](handleError(_0x15e1b9,null));};exports[_0xf62b('0x4e')]=function(_0x468a2b,_0x5255e6,_0x5b9fe6){return db[_0xf62b('0x31')][_0xf62b('0x4f')]({'where':{'id':_0x468a2b['params']['id']},'attributes':[_0xf62b('0x2f'),_0xf62b('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x5255e6,null))[_0xf62b('0x2a')](function(_0x124f12){if(_0x124f12){var _0x29055c=path[_0xf62b('0x50')](config[_0xf62b('0x51')],_0xf62b('0x52'),util[_0xf62b('0x53')](_0xf62b('0x54'),path[_0xf62b('0x55')](_0x124f12['path'])));var _0x520bf2=fs[_0xf62b('0x56')](_0x29055c);var _0x11e338=archiver(_0xf62b('0x57'),{'zlib':{'level':0x9}});_0x11e338['on'](_0xf62b('0x58'),function(_0x5b68e7){if(_0x5b68e7[_0xf62b('0x59')]===_0xf62b('0x5a')){logger[_0xf62b('0x5b')](_0x5b68e7);}else{throw new db[(_0xf62b('0x5c'))]['Error'](_0xf62b('0x5d'));}});_0x11e338['on']('error',function(_0x245a6c){throw new db[(_0xf62b('0x5c'))][(_0xf62b('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x11e338['pipe'](_0x520bf2);_0x11e338[_0xf62b('0x5f')](_0xf62b('0x60'),{'cwd':path[_0xf62b('0x50')](config[_0xf62b('0x51')],_0xf62b('0x52'),path[_0xf62b('0x61')](_0x124f12[_0xf62b('0x6')])),'ignore':[path[_0xf62b('0x50')](path[_0xf62b('0x55')](_0x124f12[_0xf62b('0x6')]),_0xf62b('0x62')),path['join'](path[_0xf62b('0x55')](_0x124f12['path']),_0xf62b('0x63'))],'nodir':!![]})[_0xf62b('0x64')]();_0x520bf2['on'](_0xf62b('0x65'),function(){if(!fs[_0xf62b('0x66')](_0x29055c)){throw new db[(_0xf62b('0x5c'))][(_0xf62b('0x5e'))](_0xf62b('0x67'));}return _0x5255e6[_0xf62b('0x4e')](_0x29055c,util['format'](_0xf62b('0x54'),path[_0xf62b('0x55')](_0x124f12[_0xf62b('0x6')])),function(_0x4a01a8){if(_0x4a01a8){throw new db[(_0xf62b('0x5c'))][(_0xf62b('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xf62b('0x68')](_0x29055c);logger[_0xf62b('0x69')](_0xf62b('0x6a'));logger['info'](_0xf62b('0x6b'));});});}return null;})[_0xf62b('0x4b')](handleError(_0x5255e6,null));};exports['upload']=function(_0xa9bd6b,_0x2b1baa,_0x4896ea){var _0x96565=path['basename'](_0xa9bd6b[_0xf62b('0x6c')]['filename'],path[_0xf62b('0x6d')](_0xa9bd6b[_0xf62b('0x6c')][_0xf62b('0x6e')]));var _0x228bc6=path[_0xf62b('0x50')](config[_0xf62b('0x51')],'server/files/plugins',_0xa9bd6b['file'][_0xf62b('0x6e')]);var _0x42dded=path[_0xf62b('0x50')](config[_0xf62b('0x51')],_0xf62b('0x52'),_0x96565);logger[_0xf62b('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x228bc6);logger['info'](_0xf62b('0x6f'),_0x42dded);try{fs[_0xf62b('0x70')](_0x228bc6,parseInt(_0xf62b('0x71'),0x8));extract(_0x228bc6,{'dir':_0x42dded},function(_0x229bc4){if(_0x229bc4){logger[_0xf62b('0x5b')](_0x229bc4);handleError(_0x229bc4,!![]);};var _0x2a58b6=fs[_0xf62b('0x72')](_0x42dded);if(_0x2a58b6[_0xf62b('0x3c')]>0x1){removeReferences(_0x228bc6,_0x42dded);logger[_0xf62b('0x5b')](_0xf62b('0x73'));return _0x4896ea(new Error(_0xf62b('0x73')));}var _0x29c3a7=fs[_0xf62b('0x74')](path['join'](_0x42dded,_0x2a58b6[0x0]));if(_0x29c3a7[_0xf62b('0x75')]()){removeReferences(_0x228bc6,_0x42dded);logger[_0xf62b('0x5b')](_0xf62b('0x73'));return _0x4896ea(new Error(_0xf62b('0x73')));}if(_0x29c3a7[_0xf62b('0x76')]()){var _0x3829ee=fs['readdirSync'](path[_0xf62b('0x50')](_0x42dded,_0x2a58b6[0x0]));if(_0x3829ee[_0xf62b('0x3c')]===0x0){removeReferences(_0x228bc6,_0x42dded);logger['error'](_0xf62b('0x73'));return _0x4896ea(new Error(_0xf62b('0x73')));}var _0x3f2bee=_0x3829ee[_0xf62b('0x77')](function(_0x880bf0){return _0x880bf0==='manifest.json';});if(!_0x3f2bee){return _0x4896ea(new Error(_0xf62b('0x78')));}var _0x4e7a52=fs[_0xf62b('0x79')](path[_0xf62b('0x50')](_0x42dded,_0x2a58b6[0x0],'manifest.json'));var _0x5a23ee=JSON['parse'](_0x4e7a52);if(_0xf62b('0x25')==typeof _0x5a23ee[_0xf62b('0x2f')]){return _0x4896ea(new Error(_0xf62b('0x7a')));}if(_0xf62b('0x25')==typeof _0x5a23ee[_0xf62b('0x34')]){return _0x4896ea(new Error(_0xf62b('0x7b')));}if(_0xf62b('0x25')==typeof _0x5a23ee[_0xf62b('0x7c')]){return _0x4896ea(new Error(_0xf62b('0x7d')));}if(_0xf62b('0x25')==typeof _0x5a23ee[_0xf62b('0x7e')]){return _0x4896ea(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5a23ee[_0xf62b('0x34')]===_0xf62b('0x7f')){if(_0xf62b('0x25')==typeof _0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')]){return _0x4896ea(new Error(_0xf62b('0x81')));}if('undefined'==typeof _0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')][_0xf62b('0x82')]&&_0xf62b('0x25')==typeof _0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')][_0xf62b('0x83')]){return _0x4896ea(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5a23ee[_0xf62b('0x34')]==='script'){if('undefined'==typeof _0x5a23ee[_0xf62b('0x7e')]['scriptName']){return _0x4896ea(new Error(_0xf62b('0x84')));}if(_0xf62b('0x25')==typeof _0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x85')]){return _0x4896ea(new Error(_0xf62b('0x86')));}}else{return _0x4896ea(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x3045ca=_0x5a23ee['name'];var _0x3a95b2=_0x5a23ee['description'];var _0x58369c=_0x5a23ee[_0xf62b('0x34')];var _0x39a87e=_0x5a23ee[_0xf62b('0x87')]?_0x5a23ee[_0xf62b('0x87')]:'always';var _0x1eecff=_0x5a23ee[_0xf62b('0x88')]?_0x5a23ee['icon']:'icon-apps';var _0x571c91='';var _0x9ad9c6='';var _0x1ae858='';var _0x36c48d='';var _0x6f0f99=_0x5a23ee[_0xf62b('0x7c')];if(_0x58369c===_0xf62b('0x7f')){if(_0xf62b('0x25')!=typeof _0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')][_0xf62b('0x82')]){var _0x1b02ab=_0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')][_0xf62b('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xf62b('0x89')](_0x1b02ab)){_0x571c91=path['join'](_0xf62b('0x8a'),_0x96565,_0x2a58b6[0x0],_0x1b02ab);}else{_0x571c91=_0x1b02ab;}}else{logger[_0xf62b('0x69')](_0xf62b('0x8b'));}if(_0xf62b('0x25')!=typeof _0x5a23ee['parameters']['views']['agent']){var _0x1cd2a9=_0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xf62b('0x89')](_0x1cd2a9)){_0x9ad9c6=path[_0xf62b('0x50')](_0xf62b('0x8a'),_0x96565,_0x2a58b6[0x0],_0x1cd2a9);}else{_0x9ad9c6=_0x1cd2a9;}}else{logger[_0xf62b('0x69')](_0xf62b('0x8c'));}}else if(_0x58369c===_0xf62b('0x8d')){_0x1ae858=_0x5a23ee['parameters'][_0xf62b('0x8e')];_0x36c48d=_0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x85')];if(_0xf62b('0x25')!=typeof _0x5a23ee['parameters'][_0xf62b('0x80')]){if(_0xf62b('0x25')!=typeof _0x5a23ee['parameters'][_0xf62b('0x80')][_0xf62b('0x82')]){var _0x1b02ab=_0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')][_0xf62b('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xf62b('0x89')](_0x1b02ab)){_0x571c91=path[_0xf62b('0x50')](_0xf62b('0x8a'),_0x96565,_0x2a58b6[0x0],_0x1b02ab);}else{_0x571c91=_0x1b02ab;}}if(_0xf62b('0x25')!=typeof _0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')][_0xf62b('0x83')]){var _0x1cd2a9=_0x5a23ee[_0xf62b('0x7e')][_0xf62b('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xf62b('0x89')](_0x1cd2a9)){_0x9ad9c6=path[_0xf62b('0x50')]('plugins',_0x96565,_0x2a58b6[0x0],_0x1cd2a9);}else{_0x9ad9c6=_0x1cd2a9;}}}}var _0x59b5ba={'name':_0x3045ca,'description':_0x3a95b2,'path':path[_0xf62b('0x50')](_0x96565,_0x2a58b6[0x0]),'type':_0x58369c,'sidebar':_0x39a87e,'icon':_0x1eecff,'adminUrl':_0x571c91,'agentUrl':_0x9ad9c6,'scriptName':_0x1ae858,'scriptPath':_0x36c48d,'version':_0x6f0f99};removeReferences(_0x228bc6,null);return db[_0xf62b('0x31')][_0xf62b('0x8f')](_0x59b5ba)[_0xf62b('0x2a')](function(_0x26fab9){var _0x1d4920={'role':_0xa9bd6b['body'][_0xf62b('0x90')],'userProfileId':_0xa9bd6b[_0xf62b('0x91')]['userProfileId']};if(!_0x1d4920)throw new Error(_0xf62b('0x92'));if(_0x1d4920['role']===_0xf62b('0x93')){var _0x15e254=_0x26fab9[_0xf62b('0x2c')]({'plain':!![]});return db[_0xf62b('0x94')][_0xf62b('0x4f')]({'where':{'name':_0xf62b('0x2d'),'userProfileId':_0x1d4920[_0xf62b('0x95')]},'raw':!![]})['then'](function(_0x5e478c){if(_0x5e478c&&_0x5e478c[_0xf62b('0x96')]===0x0){return db[_0xf62b('0x97')]['create']({'name':_0x15e254[_0xf62b('0x2f')],'resourceId':_0x15e254['id'],'type':_0x5e478c['name'],'sectionId':_0x5e478c['id']},{})[_0xf62b('0x2a')](function(){return _0x26fab9;});}else{return _0x26fab9;}})['catch'](function(_0x54f5fb){logger[_0xf62b('0x5b')](_0xf62b('0x98'),_0x54f5fb);throw _0x54f5fb;});}return _0x26fab9;})[_0xf62b('0x2a')](respondWithResult(_0x2b1baa,null))[_0xf62b('0x4b')](handleError(_0x2b1baa,null));}});}catch(_0x30ddb3){_0x2b1baa['status'](0x1f4)[_0xf62b('0x99')](_0x30ddb3);}};function removeReferences(_0x704c33,_0x5b2167){try{if(_0x704c33){fs['unlinkSync'](_0x704c33);logger[_0xf62b('0x69')](_0xf62b('0x9a'));}if(_0x5b2167){rimraf(_0x5b2167,function(){});logger[_0xf62b('0x69')](_0xf62b('0x9b'));}}catch(_0x38c238){logger[_0xf62b('0x5b')](_0x38c238);}}exports[_0xf62b('0x9c')]=function(_0x370e92,_0x2a1a53,_0x3b842a){return db['Plugin'][_0xf62b('0x4f')]({'where':{'id':_0x370e92[_0xf62b('0x4d')]['id']}})[_0xf62b('0x2a')](handleEntityNotFound(_0x2a1a53,null))[_0xf62b('0x2a')](saveUpdates(_0x370e92[_0xf62b('0x91')],null))[_0xf62b('0x2a')](respondWithResult(_0x2a1a53,null))[_0xf62b('0x4b')](handleError(_0x2a1a53,null));};exports['delete']=function(_0x11a6eb,_0x4aec4a,_0x52dd88){return db[_0xf62b('0x31')][_0xf62b('0x4f')]({'where':{'id':_0x11a6eb[_0xf62b('0x4d')]['id']}})[_0xf62b('0x2a')](function(_0x5b0813){if(_0x5b0813){return _0x5b0813['destroy']();}})[_0xf62b('0x2a')](function(_0x485a2d){rimraf(path['join'](config[_0xf62b('0x51')],_0xf62b('0x52'),path[_0xf62b('0x61')](_0x485a2d[_0xf62b('0x6')])),function(){});return _0x485a2d;})[_0xf62b('0x2a')](handleEntityNotFound(_0x4aec4a,null))[_0xf62b('0x2a')](respondWithStatusCode(_0x4aec4a,null))[_0xf62b('0x4b')](handleError(_0x4aec4a,null));};exports[_0xf62b('0x9d')]=function(_0x1b2611,_0x4879bc,_0x423876){return BPromise['resolve']()[_0xf62b('0x2a')](function(){if(!_0x1b2611[_0xf62b('0x37')][_0xf62b('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1b2611[_0xf62b('0x37')][_0xf62b('0x9e')]){throw new Error(_0xf62b('0x9f'));}var _0x1555ba=_0x1b2611['query'][_0xf62b('0xa0')]?_0x1b2611[_0xf62b('0x37')]['hostname']+':'+_0x1b2611[_0xf62b('0x37')][_0xf62b('0x9e')]:_0xf62b('0xa1')+_0x1b2611[_0xf62b('0x37')]['port'];var _0x3a265d=_0x1b2611[_0xf62b('0x37')]['json']?_0x1b2611[_0xf62b('0x37')]['json']:!![];var _0x23ed87=_0x1b2611[_0xf62b('0x37')][_0xf62b('0xa2')]?_0x1b2611[_0xf62b('0x37')]['encoding']:null;var _0x13ec66={'method':_0x1b2611[_0xf62b('0xa3')],'uri':util['format']('%s%s',_0x1555ba,_0x1b2611[_0xf62b('0x37')][_0xf62b('0x6')]),'json':_0x3a265d,'resolveWithFullResponse':!![],'encoding':_0x23ed87,'qs':_0x1b2611[_0xf62b('0x37')]};if(_0x1b2611[_0xf62b('0xa4')]){_0x13ec66[_0xf62b('0xa4')]=_0x1b2611[_0xf62b('0xa4')];if(_0x13ec66['headers']['content-length']){delete _0x13ec66[_0xf62b('0xa4')][_0xf62b('0xa5')];}}if(_0x13ec66[_0xf62b('0xa4')][_0xf62b('0xa6')]){delete _0x13ec66[_0xf62b('0xa4')][_0xf62b('0xa6')];}return rp(_0x13ec66);})['then'](function(_0x11ebf3){if(_0x11ebf3){_0x4879bc[_0xf62b('0xa7')](_0x11ebf3[_0xf62b('0xa4')]);logger['info'](_0x11ebf3[_0xf62b('0x91')]);if(_['endsWith'](_0x1b2611[_0xf62b('0x37')][_0xf62b('0x6')],_0xf62b('0x4e'))&&_0x11ebf3[_0xf62b('0xa8')]==0x1f4){return _0x4879bc[_0xf62b('0x2e')](_0x11ebf3[_0xf62b('0xa8')]);}else{return _0x4879bc[_0xf62b('0x22')](_0x11ebf3[_0xf62b('0xa8')])[_0xf62b('0x99')](_0x11ebf3[_0xf62b('0x91')]);}}else{return _0x4879bc['sendStatus'](0xc8);}})['catch'](handleError(_0x4879bc,null));};exports[_0xf62b('0xa9')]=function(_0x1bf9ed,_0x490642,_0x58f506){return BPromise[_0xf62b('0xaa')]()[_0xf62b('0x2a')](function(){if(!_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0x6')]){throw new Error(_0xf62b('0xab'));}if(!_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0x9e')]){throw new Error(_0xf62b('0x9f'));}var _0x403cb4=_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0xa0')]?_0x1bf9ed['query'][_0xf62b('0xa0')]+':'+_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0x9e')]:_0xf62b('0xa1')+_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0x9e')];var _0x13c026=_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0xac')]?_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0xac')]:!![];var _0x2f60fa=_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0xa2')]?_0x1bf9ed[_0xf62b('0x37')][_0xf62b('0xa2')]:null;var _0x1ce008={'method':_0x1bf9ed['method'],'uri':util[_0xf62b('0x53')](_0xf62b('0xad'),_0x403cb4,_0x1bf9ed[_0xf62b('0x37')]['path']),'json':_0x13c026,'resolveWithFullResponse':!![],'encoding':_0x2f60fa,'body':_0x1bf9ed[_0xf62b('0x91')]};if(_0x1bf9ed[_0xf62b('0xa4')]){_0x1ce008[_0xf62b('0xa4')]=_0x1bf9ed[_0xf62b('0xa4')];if(_0x1ce008[_0xf62b('0xa4')][_0xf62b('0xa5')]){delete _0x1ce008[_0xf62b('0xa4')][_0xf62b('0xa5')];}}if(_0x1ce008[_0xf62b('0xa4')][_0xf62b('0xa6')]){delete _0x1ce008['headers']['content-type'];}return rp(_0x1ce008);})[_0xf62b('0x2a')](function(_0x4acd37){if(_0x4acd37){_0x490642[_0xf62b('0xa7')](_0x4acd37[_0xf62b('0xa4')]);logger['info'](_0x4acd37[_0xf62b('0x91')]);return _0x490642[_0xf62b('0x22')](_0x4acd37[_0xf62b('0xa8')])[_0xf62b('0x99')](_0x4acd37[_0xf62b('0x91')]);}else{return _0x490642[_0xf62b('0x2e')](0xc8);}})['catch'](handleError(_0x490642,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 04aa99c..ed7015b 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 _0xa2c8=['events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x8a2c('0x0'));var Plugin=require(_0x8a2c('0x1'))['db'][_0x8a2c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8a2c('0x3')](0x0);var events={'afterCreate':_0x8a2c('0x4'),'afterUpdate':_0x8a2c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b1142){return function(_0x590508,_0x486724,_0x48c1cb){PluginEvents[_0x8a2c('0x6')](_0x1b1142+':'+_0x590508['id'],_0x590508);PluginEvents[_0x8a2c('0x6')](_0x1b1142,_0x590508);_0x48c1cb(null);};}for(var e in events){if(events[_0x8a2c('0x7')](e)){var event=events[e];Plugin[_0x8a2c('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x5ff9=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ff9,0xa0));var _0x95ff=function(_0x468917,_0x44cd1a){_0x468917=_0x468917-0x0;var _0x11c0fa=_0x5ff9[_0x468917];return _0x11c0fa;};'use strict';var EventEmitter=require(_0x95ff('0x0'));var Plugin=require(_0x95ff('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x95ff('0x2')](0x0);var events={'afterCreate':_0x95ff('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d1ce4){return function(_0x58eb5d,_0x5b1bee,_0x174f9d){PluginEvents[_0x95ff('0x4')](_0x3d1ce4+':'+_0x58eb5d['id'],_0x58eb5d);PluginEvents['emit'](_0x3d1ce4,_0x58eb5d);_0x174f9d(null);};}for(var e in events){if(events[_0x95ff('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x95ff('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 86f655d..90d6dbb 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 _0xec82=['api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0x3ff65a,_0x253a58){var _0x1dfe12=function(_0x3852a4){while(--_0x3852a4){_0x3ff65a['push'](_0x3ff65a['shift']());}};_0x1dfe12(++_0x253a58);}(_0xec82,0x83));var _0x2ec8=function(_0x174ac1,_0x14cc0c){_0x174ac1=_0x174ac1-0x0;var _0x1e954d=_0xec82[_0x174ac1];return _0x1e954d;};'use strict';var _=require(_0x2ec8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ec8('0x1'));var moment=require(_0x2ec8('0x2'));var BPromise=require('bluebird');var rp=require(_0x2ec8('0x3'));var fs=require('fs');var path=require(_0x2ec8('0x4'));var rimraf=require(_0x2ec8('0x5'));var config=require(_0x2ec8('0x6'));var attributes=require(_0x2ec8('0x7'));module[_0x2ec8('0x8')]=function(_0x3da5fe,_0x5f3342){return _0x3da5fe[_0x2ec8('0x9')](_0x2ec8('0xa'),attributes,{'tableName':_0x2ec8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1768=['./plugin.attributes','define','lodash','util','api','request-promise','path','../../config/environment'];(function(_0x5afa42,_0x30a006){var _0x10e567=function(_0x1d58f8){while(--_0x1d58f8){_0x5afa42['push'](_0x5afa42['shift']());}};_0x10e567(++_0x30a006);}(_0x1768,0x1d2));var _0x8176=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x1768[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x8176('0x0'));var util=require(_0x8176('0x1'));var logger=require('../../config/logger')(_0x8176('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8176('0x3'));var fs=require('fs');var path=require(_0x8176('0x4'));var rimraf=require('rimraf');var config=require(_0x8176('0x5'));var attributes=require(_0x8176('0x6'));module['exports']=function(_0x19f42e,_0x404844){return _0x19f42e[_0x8176('0x7')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index c8e1a01..406dd11 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 _0x8e2f=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','request','then','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreatePlugin','Plugin','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x432cbf,_0x42a69c){var _0x4cb147=function(_0x366cb4){while(--_0x366cb4){_0x432cbf['push'](_0x432cbf['shift']());}};_0x4cb147(++_0x42a69c);}(_0x8e2f,0x179));var _0xf8e2=function(_0x1dbcb4,_0xbdcee0){_0x1dbcb4=_0x1dbcb4-0x0;var _0x28c086=_0x8e2f[_0x1dbcb4];return _0x28c086;};'use strict';var _=require('lodash');var util=require(_0xf8e2('0x0'));var moment=require(_0xf8e2('0x1'));var BPromise=require(_0xf8e2('0x2'));var rs=require(_0xf8e2('0x3'));var fs=require('fs');var Redis=require(_0xf8e2('0x4'));var db=require(_0xf8e2('0x5'))['db'];var utils=require(_0xf8e2('0x6'));var logger=require(_0xf8e2('0x7'))(_0xf8e2('0x8'));var config=require(_0xf8e2('0x9'));var jayson=require(_0xf8e2('0xa'));var client=jayson[_0xf8e2('0xb')][_0xf8e2('0xc')]({'port':0x232a});config[_0xf8e2('0xd')]=_[_0xf8e2('0xe')](config['redis'],{'host':_0xf8e2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8e2('0xd')]));require(_0xf8e2('0x10'))[_0xf8e2('0x11')](socket);function respondWithRpcPromise(_0x2de0b0,_0x651692,_0x53ba0d){return new BPromise(function(_0x51d9b3,_0x53273d){return client[_0xf8e2('0x12')](_0x2de0b0,_0x53ba0d)[_0xf8e2('0x13')](function(_0x4e03e8){logger['info']('Plugin,\x20%s,\x20%s',_0x651692,'request\x20sent');logger[_0xf8e2('0x14')](_0xf8e2('0x15'),_0x651692,'request\x20sent',JSON[_0xf8e2('0x16')](_0x4e03e8));if(_0x4e03e8[_0xf8e2('0x17')]){if(_0x4e03e8['error']['code']===0x1f4){logger[_0xf8e2('0x17')](_0xf8e2('0x18'),_0x651692,_0x4e03e8['error'][_0xf8e2('0x19')]);return _0x53273d(_0x4e03e8['error'][_0xf8e2('0x19')]);}logger[_0xf8e2('0x17')](_0xf8e2('0x18'),_0x651692,_0x4e03e8['error'][_0xf8e2('0x19')]);return _0x51d9b3(_0x4e03e8[_0xf8e2('0x17')]['message']);}else{logger[_0xf8e2('0x1a')](_0xf8e2('0x18'),_0x651692,_0xf8e2('0x1b'));_0x51d9b3(_0x4e03e8[_0xf8e2('0x1c')][_0xf8e2('0x19')]);}})[_0xf8e2('0x1d')](function(_0x420071){logger[_0xf8e2('0x17')](_0xf8e2('0x18'),_0x651692,_0x420071);_0x53273d(_0x420071);});});}exports[_0xf8e2('0x1e')]=function(_0xdef6e0){var _0xf1d334=this;return new Promise(function(_0x4fa1ae,_0x138cb4){return db[_0xf8e2('0x1f')]['create'](_0xdef6e0[_0xf8e2('0x20')],{'raw':_0xdef6e0[_0xf8e2('0x21')]?_0xdef6e0[_0xf8e2('0x21')][_0xf8e2('0x22')]===undefined?!![]:![]:!![]})[_0xf8e2('0x13')](function(_0x398faa){logger[_0xf8e2('0x1a')](_0xf8e2('0x1e'),_0xdef6e0);logger[_0xf8e2('0x14')]('CreatePlugin',_0xdef6e0,JSON['stringify'](_0x398faa));_0x4fa1ae(_0x398faa);})[_0xf8e2('0x1d')](function(_0xa5f6ec){logger[_0xf8e2('0x17')]('CreatePlugin',_0xa5f6ec[_0xf8e2('0x19')],_0xdef6e0);_0x138cb4(_0xf1d334[_0xf8e2('0x17')](0x1f4,_0xa5f6ec[_0xf8e2('0x19')]));});});}; \ No newline at end of file +var _0xe82c=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','Plugin,\x20%s,\x20%s','result','Plugin','create','body','options','raw','CreatePlugin','debug'];(function(_0x318e72,_0x45505d){var _0x16844b=function(_0x24b379){while(--_0x24b379){_0x318e72['push'](_0x318e72['shift']());}};_0x16844b(++_0x45505d);}(_0xe82c,0x1dd));var _0xce82=function(_0x1adb2a,_0x3fe9eb){_0x1adb2a=_0x1adb2a-0x0;var _0x387e01=_0xe82c[_0x1adb2a];return _0x387e01;};'use strict';var _=require(_0xce82('0x0'));var util=require(_0xce82('0x1'));var moment=require(_0xce82('0x2'));var BPromise=require('bluebird');var rs=require(_0xce82('0x3'));var fs=require('fs');var Redis=require(_0xce82('0x4'));var db=require(_0xce82('0x5'))['db'];var utils=require(_0xce82('0x6'));var logger=require(_0xce82('0x7'))('rpc');var config=require(_0xce82('0x8'));var jayson=require(_0xce82('0x9'));var client=jayson[_0xce82('0xa')][_0xce82('0xb')]({'port':0x232a});config['redis']=_[_0xce82('0xc')](config[_0xce82('0xd')],{'host':_0xce82('0xe'),'port':0x18eb});var socket=require(_0xce82('0xf'))(new Redis(config[_0xce82('0xd')]));require('./plugin.socket')[_0xce82('0x10')](socket);function respondWithRpcPromise(_0x26cd8f,_0x5d522a,_0x386439){return new BPromise(function(_0x16b2ed,_0x1356cf){return client['request'](_0x26cd8f,_0x386439)[_0xce82('0x11')](function(_0x4e2372){logger[_0xce82('0x12')]('Plugin,\x20%s,\x20%s',_0x5d522a,_0xce82('0x13'));logger['debug'](_0xce82('0x14'),_0x5d522a,_0xce82('0x13'),JSON[_0xce82('0x15')](_0x4e2372));if(_0x4e2372[_0xce82('0x16')]){if(_0x4e2372[_0xce82('0x16')]['code']===0x1f4){logger[_0xce82('0x16')]('Plugin,\x20%s,\x20%s',_0x5d522a,_0x4e2372[_0xce82('0x16')]['message']);return _0x1356cf(_0x4e2372[_0xce82('0x16')][_0xce82('0x17')]);}logger[_0xce82('0x16')](_0xce82('0x18'),_0x5d522a,_0x4e2372[_0xce82('0x16')][_0xce82('0x17')]);return _0x16b2ed(_0x4e2372[_0xce82('0x16')][_0xce82('0x17')]);}else{logger[_0xce82('0x12')](_0xce82('0x18'),_0x5d522a,_0xce82('0x13'));_0x16b2ed(_0x4e2372[_0xce82('0x19')][_0xce82('0x17')]);}})['catch'](function(_0x211124){logger[_0xce82('0x16')](_0xce82('0x18'),_0x5d522a,_0x211124);_0x1356cf(_0x211124);});});}exports['CreatePlugin']=function(_0x50b632){var _0x5e41b2=this;return new Promise(function(_0x126f85,_0x4730c8){return db[_0xce82('0x1a')][_0xce82('0x1b')](_0x50b632[_0xce82('0x1c')],{'raw':_0x50b632[_0xce82('0x1d')]?_0x50b632[_0xce82('0x1d')][_0xce82('0x1e')]===undefined?!![]:![]:!![]})[_0xce82('0x11')](function(_0x4181c4){logger[_0xce82('0x12')](_0xce82('0x1f'),_0x50b632);logger[_0xce82('0x20')]('CreatePlugin',_0x50b632,JSON[_0xce82('0x15')](_0x4181c4));_0x126f85(_0x4181c4);})[_0xce82('0x21')](function(_0x59a376){logger[_0xce82('0x16')](_0xce82('0x1f'),_0x59a376['message'],_0x50b632);_0x4730c8(_0x5e41b2['error'](0x1f4,_0x59a376[_0xce82('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f9bb17f..0e1a221 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 _0xb16c=['remove','update','emit','removeListener','length','plugin:','./plugin.events','save'];(function(_0x16c470,_0x35c619){var _0x424be7=function(_0x3c47fe){while(--_0x3c47fe){_0x16c470['push'](_0x16c470['shift']());}};_0x424be7(++_0x35c619);}(_0xb16c,0x176));var _0xcb16=function(_0x175e06,_0x245172){_0x175e06=_0x175e06-0x0;var _0x2d0230=_0xb16c[_0x175e06];return _0x2d0230;};'use strict';var PluginEvents=require(_0xcb16('0x0'));var events=[_0xcb16('0x1'),_0xcb16('0x2'),_0xcb16('0x3')];function createListener(_0x23f956,_0x407609){return function(_0x49de28){_0x407609[_0xcb16('0x4')](_0x23f956,_0x49de28);};}function removeListener(_0x2cce82,_0x1b4ab9){return function(){PluginEvents[_0xcb16('0x5')](_0x2cce82,_0x1b4ab9);};}exports['register']=function(_0x134894){for(var _0x51b058=0x0,_0x1badcd=events[_0xcb16('0x6')];_0x51b058<_0x1badcd;_0x51b058++){var _0x42f570=events[_0x51b058];var _0x27f7ee=createListener(_0xcb16('0x7')+_0x42f570,_0x134894);PluginEvents['on'](_0x42f570,_0x27f7ee);}}; \ No newline at end of file +var _0xac0e=['register','length','plugin:','./plugin.events','save','update','emit','removeListener'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xac0e,0x133));var _0xeac0=function(_0x3a5de5,_0x5ee543){_0x3a5de5=_0x3a5de5-0x0;var _0x25932c=_0xac0e[_0x3a5de5];return _0x25932c;};'use strict';var PluginEvents=require(_0xeac0('0x0'));var events=[_0xeac0('0x1'),'remove',_0xeac0('0x2')];function createListener(_0xbf2f19,_0x4e9f7b){return function(_0x5781c3){_0x4e9f7b[_0xeac0('0x3')](_0xbf2f19,_0x5781c3);};}function removeListener(_0x20b41f,_0x2437ef){return function(){PluginEvents[_0xeac0('0x4')](_0x20b41f,_0x2437ef);};}exports[_0xeac0('0x5')]=function(_0x550bc0){for(var _0x263d90=0x0,_0x3f8cca=events[_0xeac0('0x6')];_0x263d90<_0x3f8cca;_0x263d90++){var _0x5322ad=events[_0x263d90];var _0x5501a5=createListener(_0xeac0('0x7')+_0x5322ad,_0x550bc0);PluginEvents['on'](_0x5322ad,_0x5501a5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ac37b51..ed16aba 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(_0x5cc262,_0x3e69a7){var _0x13ab22=function(_0x19a331){while(--_0x19a331){_0x5cc262['push'](_0x5cc262['shift']());}};_0x13ab22(++_0x3e69a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x4c9b37,_0x29fa6d){var _0x294d64=function(_0x493dc0){while(--_0x493dc0){_0x4c9b37['push'](_0x4c9b37['shift']());}};_0x294d64(++_0x29fa6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 1ca2f6c..18f81ab 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57f8=['error','name','npm\x20install','info','index','list','express','length','then','catch','show','describe','params','body','script','../../files/plugins','cwd','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json'];(function(_0x2b9cce,_0xbb8890){var _0x4e4ddf=function(_0x5ef3cd){while(--_0x5ef3cd){_0x2b9cce['push'](_0x2b9cce['shift']());}};_0x4e4ddf(++_0xbb8890);}(_0x57f8,0x198));var _0x857f=function(_0x496d3c,_0x3eab1e){_0x496d3c=_0x496d3c-0x0;var _0x3700b8=_0x57f8[_0x496d3c];return _0x3700b8;};'use strict';var _=require('lodash');var pm2=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var path=require(_0x857f('0x3'));var exec=require(_0x857f('0x4'))[_0x857f('0x5')];var BPromise=require(_0x857f('0x6'));function handleEntityNotFound(_0x6f054b,_0x318050){return function(_0xced48e){if(!_0xced48e){_0x6f054b[_0x857f('0x7')](0x194);;}return _0xced48e;};}function respondWithResult(_0x369c40,_0x5d22e4){_0x5d22e4=_0x5d22e4||0xc8;return function(_0x8380e8){if(_0x8380e8){return _0x369c40[_0x857f('0x8')](_0x5d22e4)[_0x857f('0x9')](_0x8380e8);}return null;};}function handleError(_0x577fc3,_0x5f6a66){_0x5f6a66=_0x5f6a66||0x1f4;return function(_0x135855){logger[_0x857f('0xa')](_0x135855['stack']);if(_0x135855[_0x857f('0xb')]){delete _0x135855[_0x857f('0xb')];}_0x577fc3[_0x857f('0x8')](_0x5f6a66)['send'](_0x135855);};}function execChildProcess(){return new BPromise(function(_0xefee53,_0x360827){exec(_0x857f('0xc'),function(_0x11adfd,_0x268f9d,_0x3eb530){logger[_0x857f('0xd')](_0x268f9d);logger['info'](_0x3eb530);if(_0x11adfd){logger[_0x857f('0xa')](_0x11adfd);return _0x360827(_0x11adfd);}return _0xefee53(_0x268f9d);});});}exports[_0x857f('0xe')]=function(_0x373333,_0x2caf29){return pm2[_0x857f('0xf')]()['then'](function(_0x4bc590){if(_0x4bc590){var _0x3b09d9=_['reject'](_0x4bc590,function(_0x1fafbe){return _0x1fafbe['name']===_0x857f('0x10')||_0x1fafbe[_0x857f('0xb')]==='motion2';});return{'rows':_0x3b09d9,'count':_0x3b09d9[_0x857f('0x11')]};}return null;})[_0x857f('0x12')](respondWithResult(_0x2caf29,null))[_0x857f('0x13')](handleError(_0x2caf29,null));};exports[_0x857f('0x14')]=function(_0x279e74,_0x38a3c2){return pm2[_0x857f('0x15')](_0x279e74[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x38a3c2,null))[_0x857f('0x12')](handleEntityNotFound(_0x38a3c2,null))[_0x857f('0x13')](handleError(_0x38a3c2,null));};exports['create']=function(_0x1729d8,_0x1e8fd4){if(_0x1729d8['body'][_0x857f('0xb')]&&_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]){var _0x484035=path['join'](__dirname,_0x857f('0x19'),_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]);var _0x4fa031=process[_0x857f('0x1a')]();process[_0x857f('0x1b')](path[_0x857f('0x1c')](_0x484035));return execChildProcess()['then'](function(_0x1961ea){process[_0x857f('0x1b')](_0x4fa031);return pm2['start']({'name':_0x1729d8[_0x857f('0x17')][_0x857f('0xb')],'script':_0x484035});})[_0x857f('0x12')](function(_0x44ff23){pm2[_0x857f('0x1d')]();return _0x44ff23[0x0];})[_0x857f('0x12')](respondWithResult(_0x1e8fd4,0xc9))[_0x857f('0x13')](handleError(_0x1e8fd4,null));}else{return _0x1e8fd4[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x1f')});}};exports[_0x857f('0x20')]=function(_0x4782ab,_0x250731){if(_0x4782ab[_0x857f('0x17')]['id']){delete _0x4782ab['body']['id'];}var _0x17e415={'online':_0x857f('0x21'),'stopped':_0x857f('0x22')};if(_0x17e415[_0x857f('0x23')](_0x4782ab['body'][_0x857f('0x8')])){return pm2[_0x17e415[_0x4782ab['body'][_0x857f('0x8')]]](_0x4782ab[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x250731,0xc8))[_0x857f('0x13')](handleError(_0x250731,null));}else{return _0x250731[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x24')});}};exports[_0x857f('0x25')]=function(_0x17e7b6,_0x41f832){if(_0x17e7b6[_0x857f('0x17')]['id']){delete _0x17e7b6[_0x857f('0x17')]['id'];}if(_0x17e7b6[_0x857f('0x16')]['id']){return pm2['delete'](_0x17e7b6[_0x857f('0x16')]['id'])[_0x857f('0x12')](function(_0x55e69f){pm2[_0x857f('0x1d')]();return _0x55e69f[0x0];})[_0x857f('0x12')](respondWithResult(_0x41f832,null))['catch'](handleError(_0x41f832,null));}else{return _0x41f832[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x4e81=['npm\x20install','info','index','then','express','length','catch','show','describe','params','create','body','script','join','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','exec','bluebird','sendStatus','status','json','error','stack','name','send'];(function(_0x10c68d,_0x2e97f8){var _0xad19e2=function(_0x1b353c){while(--_0x1b353c){_0x10c68d['push'](_0x10c68d['shift']());}};_0xad19e2(++_0x2e97f8);}(_0x4e81,0x1bc));var _0x14e8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4e81[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x14e8('0x0'));var pm2=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var path=require('path');var exec=require('child_process')[_0x14e8('0x3')];var BPromise=require(_0x14e8('0x4'));function handleEntityNotFound(_0x224121,_0x436444){return function(_0x325325){if(!_0x325325){_0x224121[_0x14e8('0x5')](0x194);;}return _0x325325;};}function respondWithResult(_0x56a266,_0x57c79b){_0x57c79b=_0x57c79b||0xc8;return function(_0x3e73d2){if(_0x3e73d2){return _0x56a266[_0x14e8('0x6')](_0x57c79b)[_0x14e8('0x7')](_0x3e73d2);}return null;};}function handleError(_0x3c1b93,_0x11ec3b){_0x11ec3b=_0x11ec3b||0x1f4;return function(_0x20f053){logger[_0x14e8('0x8')](_0x20f053[_0x14e8('0x9')]);if(_0x20f053[_0x14e8('0xa')]){delete _0x20f053['name'];}_0x3c1b93[_0x14e8('0x6')](_0x11ec3b)[_0x14e8('0xb')](_0x20f053);};}function execChildProcess(){return new BPromise(function(_0x43bfcd,_0x2906b3){exec(_0x14e8('0xc'),function(_0x3ce648,_0x3bed91,_0x30df66){logger['info'](_0x3bed91);logger[_0x14e8('0xd')](_0x30df66);if(_0x3ce648){logger['error'](_0x3ce648);return _0x2906b3(_0x3ce648);}return _0x43bfcd(_0x3bed91);});});}exports[_0x14e8('0xe')]=function(_0x341d40,_0x32a01d){return pm2['list']()[_0x14e8('0xf')](function(_0x4e1064){if(_0x4e1064){var _0x458e4a=_['reject'](_0x4e1064,function(_0x347216){return _0x347216[_0x14e8('0xa')]===_0x14e8('0x10')||_0x347216[_0x14e8('0xa')]==='motion2';});return{'rows':_0x458e4a,'count':_0x458e4a[_0x14e8('0x11')]};}return null;})[_0x14e8('0xf')](respondWithResult(_0x32a01d,null))[_0x14e8('0x12')](handleError(_0x32a01d,null));};exports[_0x14e8('0x13')]=function(_0xd4d6b2,_0x1f1a0d){return pm2[_0x14e8('0x14')](_0xd4d6b2[_0x14e8('0x15')]['id'])['then'](respondWithResult(_0x1f1a0d,null))[_0x14e8('0xf')](handleEntityNotFound(_0x1f1a0d,null))[_0x14e8('0x12')](handleError(_0x1f1a0d,null));};exports[_0x14e8('0x16')]=function(_0x7b10f2,_0x246c5d){if(_0x7b10f2['body'][_0x14e8('0xa')]&&_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]){var _0x48e30a=path[_0x14e8('0x19')](__dirname,'../../files/plugins',_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]);var _0x3e8d5c=process[_0x14e8('0x1a')]();process[_0x14e8('0x1b')](path['dirname'](_0x48e30a));return execChildProcess()[_0x14e8('0xf')](function(_0x5b11f9){process[_0x14e8('0x1b')](_0x3e8d5c);return pm2[_0x14e8('0x1c')]({'name':_0x7b10f2['body']['name'],'script':_0x48e30a});})['then'](function(_0x4a758c){pm2[_0x14e8('0x1d')]();return _0x4a758c[0x0];})[_0x14e8('0xf')](respondWithResult(_0x246c5d,0xc9))[_0x14e8('0x12')](handleError(_0x246c5d,null));}else{return _0x246c5d[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x1e')});}};exports[_0x14e8('0x1f')]=function(_0x3c09cb,_0x2f5818){if(_0x3c09cb[_0x14e8('0x17')]['id']){delete _0x3c09cb[_0x14e8('0x17')]['id'];}var _0x2813ae={'online':'restart','stopped':_0x14e8('0x20')};if(_0x2813ae[_0x14e8('0x21')](_0x3c09cb[_0x14e8('0x17')]['status'])){return pm2[_0x2813ae[_0x3c09cb['body']['status']]](_0x3c09cb[_0x14e8('0x15')]['id'])[_0x14e8('0xf')](respondWithResult(_0x2f5818,0xc8))['catch'](handleError(_0x2f5818,null));}else{return _0x2f5818[_0x14e8('0x6')](0x1f4)[_0x14e8('0xb')]({'message':_0x14e8('0x22')});}};exports[_0x14e8('0x23')]=function(_0x5c2635,_0x1f1259){if(_0x5c2635[_0x14e8('0x17')]['id']){delete _0x5c2635[_0x14e8('0x17')]['id'];}if(_0x5c2635[_0x14e8('0x15')]['id']){return pm2[_0x14e8('0x24')](_0x5c2635['params']['id'])[_0x14e8('0xf')](function(_0x29ee7a){pm2[_0x14e8('0x1d')]();return _0x29ee7a[0x0];})[_0x14e8('0xf')](respondWithResult(_0x1f1259,null))['catch'](handleError(_0x1f1259,null));}else{return _0x1f1259[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 0cd1739..cda5b23 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 _0x4e54=['isAuthenticated','getAgents','/queues','getQueues','express','../../components/auth/service','get'];(function(_0x43ff96,_0xd9bcbc){var _0x3919c7=function(_0x25d93c){while(--_0x25d93c){_0x43ff96['push'](_0x43ff96['shift']());}};_0x3919c7(++_0xd9bcbc);}(_0x4e54,0x1af));var _0x44e5=function(_0x20eb3d,_0x58c78b){_0x20eb3d=_0x20eb3d-0x0;var _0x2d1021=_0x4e54[_0x20eb3d];return _0x2d1021;};'use strict';var express=require(_0x44e5('0x0'));var router=express['Router']();var auth=require(_0x44e5('0x1'));var controller=require('./realtime.controller');router[_0x44e5('0x2')]('/agents',auth[_0x44e5('0x3')](),controller[_0x44e5('0x4')]);router[_0x44e5('0x2')](_0x44e5('0x5'),auth[_0x44e5('0x3')](),controller[_0x44e5('0x6')]);module['exports']=router; \ No newline at end of file +var _0x552d=['get','getAgents','/queues','isAuthenticated','getQueues','exports','express','Router','./realtime.controller'];(function(_0xad0b84,_0x11d6a6){var _0x5274bb=function(_0x5167ef){while(--_0x5167ef){_0xad0b84['push'](_0xad0b84['shift']());}};_0x5274bb(++_0x11d6a6);}(_0x552d,0x114));var _0xd552=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x552d[_0x8c43de];return _0xa6591b;};'use strict';var express=require(_0xd552('0x0'));var router=express[_0xd552('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd552('0x2'));router[_0xd552('0x3')]('/agents',auth['isAuthenticated'](),controller[_0xd552('0x4')]);router[_0xd552('0x3')](_0xd552('0x5'),auth[_0xd552('0x6')](),controller[_0xd552('0x7')]);module[_0xd552('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 335c21b..c7bd8af 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 _0xf85c=['VoiceQueuesChannels','loggedIn','waiting','talking','paused','outbound','pTalking','originated','message','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','available','busy','pick','filter','queue','length','some','connectedlinenum','internal','toString','find','getMembers','UserId','accountcode','online','voiceStatus','push','User','Pause','findAll','startCase','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','openchannelPause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','*pause','chat','sms','openchannel','fax','whatsapp','toLowerCase','Invalid\x20channel','isArray','findOne','getAgents','all','uniq','value','split','fields','includes','globalStatus','order','startsWith','DESC','ASC','sort','pauseType','userpic','lastLoginAt','lastPauseAt','address','mailPause','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','whatsappCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','smsPause','resolve','query','channel','join','globalQueueFilter','rawAttributes','fieldName','key','role','agent','raw','isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','globalStatusFilter','pauseTypeFilter','type','getOptions','QueueCampaigns','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','offset','undefined','count','limit','Content-Range','json','error','stack','name','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','voice','Queues','format','result','catch'];(function(_0x4936b0,_0x45573e){var _0x3254a0=function(_0xd17ee9){while(--_0xd17ee9){_0x4936b0['push'](_0x4936b0['shift']());}};_0x3254a0(++_0x45573e);}(_0xf85c,0x1d8));var _0xcf85=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xf85c[_0x13b02f];return _0x12e9a6;};'use strict';var util=require('util');var _=require(_0xcf85('0x0'));var jayson=require(_0xcf85('0x1'));var qs=require(_0xcf85('0x2'));var logger=require(_0xcf85('0x3'))(_0xcf85('0x4'));var db=require(_0xcf85('0x5'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xcf85('0x6')]['http']({'port':0x232c});function respondWithFilteredResult(_0x10ed45,_0x85275b){return function(_0x4ee6ed){if(_0x4ee6ed){var _0x18e1a3=typeof _0x85275b[_0xcf85('0x7')]===_0xcf85('0x8')&&typeof _0x85275b['limit']===_0xcf85('0x8');var _0x24673=_0x4ee6ed[_0xcf85('0x9')];var _0x38b464=_0x18e1a3?0x0:_0x85275b[_0xcf85('0x7')];var _0x538ed5=_0x18e1a3?_0x4ee6ed['count']:_0x85275b[_0xcf85('0x7')]+_0x85275b[_0xcf85('0xa')];var _0x3406cf;if(_0x538ed5>=_0x24673){_0x538ed5=_0x24673;_0x3406cf=0xc8;}else{_0x3406cf=0xce;}_0x10ed45['status'](_0x3406cf);return _0x10ed45['set'](_0xcf85('0xb'),_0x38b464+'-'+_0x538ed5+'/'+_0x24673)[_0xcf85('0xc')](_0x4ee6ed);}return null;};}function handleError(_0x18d466,_0x4d4c40){_0x4d4c40=_0x4d4c40||0x1f4;return function(_0x3c60ec){logger[_0xcf85('0xd')](_0x3c60ec[_0xcf85('0xe')]);if(_0x3c60ec[_0xcf85('0xf')]){delete _0x3c60ec[_0xcf85('0xf')];}_0x18d466['status'](_0x4d4c40)['send'](_0x3c60ec);};}function getRealtimeAgents(){return new Promise(function(_0x1a3098,_0xfaec6){return amiClient['request']('Agents',{})[_0xcf85('0x10')](function(_0x95a2){if(_0x95a2[_0xcf85('0xd')])throw new Error(_0xcf85('0x11'));var _0x2be774=_0x95a2['result'];return routingClient[_0xcf85('0x12')]('Agents',{})[_0xcf85('0x10')](function(_0x33ac04){if(_0x33ac04['error'])throw new Error(_0xcf85('0x13'));var _0x4d923e=_0x33ac04['result'];return _0x1a3098(_[_0xcf85('0x14')]({},_0x2be774,_0x4d923e));});})['catch'](function(_0x37ce2e){_0xfaec6(_0x37ce2e);});});}function getRealtimeQueues(_0x4526aa,_0x39404e){return new Promise(function(_0x4486e0,_0x27de3b){var _0x3fd97e=_0x39404e===_0xcf85('0x15')?amiClient:routingClient;return _0x3fd97e[_0xcf85('0x12')](_['startCase'](_0x39404e)+_0xcf85('0x16'),_0x4526aa)['then'](function(_0x40c5a2){if(_0x40c5a2['error'])throw new Error(util[_0xcf85('0x17')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x39404e));return _0x4486e0(_0x40c5a2[_0xcf85('0x18')]);})[_0xcf85('0x19')](function(_0x4d42a8){_0x27de3b(_0x4d42a8);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x54a17e,_0x42309b){return amiClient[_0xcf85('0x12')](_0xcf85('0x1a'),{})[_0xcf85('0x10')](function(_0x3e040b){if(_0x3e040b[_0xcf85('0xd')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x54a17e(_0x3e040b[_0xcf85('0x18')]);})[_0xcf85('0x19')](function(_0x5719eb){_0x42309b(_0x5719eb);});});}function initializeQueues(_0x525964,_0x237108,_0x3efedc,_0x1782c4){var _0x1d8d4c=[_0xcf85('0x1b'),'available',_0xcf85('0x1c'),_0xcf85('0x1d'),_0xcf85('0x1e')];if(_0x3efedc===_0xcf85('0x15')&&_0x1782c4===_0xcf85('0x1f')){_0x1d8d4c['push'](_0xcf85('0x20'),_0xcf85('0x21'),_0xcf85('0x22'),'dialActive',_0xcf85('0x23'),_0xcf85('0x24'),_0xcf85('0x25'),_0xcf85('0x26'),'erlangCalls',_0xcf85('0x27'),_0xcf85('0x28'),_0xcf85('0x29'),_0xcf85('0x2a'),_0xcf85('0x2b'),_0xcf85('0x2c'),'predictiveIntervalAvailable',_0xcf85('0x2d'),'predictiveIntervalAnsweredCalls',_0xcf85('0x2e'),_0xcf85('0x2f'),_0xcf85('0x30'),_0xcf85('0x31'));}return _0x525964[_0xcf85('0x32')](function(_0x2554a6){var _0x4edf65=_0x2554a6[_0xcf85('0x33')]({'plain':!![]});_0x4edf65[_0xcf85('0x34')]=[];_0x4edf65[_0xcf85('0x1e')]=0x0;_0x4edf65[_0xcf85('0x35')]=0x0;_0x4edf65[_0xcf85('0x1b')]=0x0;_0x4edf65[_0xcf85('0x36')]=0x0;_0x4edf65[_0xcf85('0x1c')]=0x0;if(_0x3efedc==='voice'){_0x4edf65[_0xcf85('0x1d')]=0x0;_0x4edf65[_0xcf85('0x37')]=0x0;if(_0x1782c4==='outbound'){_0x4edf65['pTalking']=0x0;_0x4edf65[_0xcf85('0x21')]=0x0;}}var _0x46f5ab=_['find'](_0x237108,['id',_0x4edf65['id']]);if(_0x46f5ab)_[_0xcf85('0x14')](_0x4edf65,_[_0xcf85('0x38')](_0x46f5ab,_0x1d8d4c));return _0x4edf65;});}function updateAgentVoiceStatus(_0x419cd4,_0x4f580b,_0x3e27bd){var _0x1c528a=_[_0xcf85('0x39')](_0x3e27bd,[_0xcf85('0x3a'),_0x4f580b[_0xcf85('0xf')]]);if(_0x1c528a[_0xcf85('0x3b')]===0x0)return _0x419cd4[_0xcf85('0x37')]=!![];if(_[_0xcf85('0x3c')](_0x1c528a,[_0xcf85('0x3d'),_0x419cd4[_0xcf85('0x3e')][_0xcf85('0x3f')]()]))return _0x419cd4[_0xcf85('0x1d')]=!![];if(!_0x419cd4[_0xcf85('0x1d')])return _0x419cd4[_0xcf85('0x37')]=!![];}function getVoiceQueueAgents(_0x2a1d5d,_0x13f776,_0xd941ab,_0x122ab4){var _0x1ff9dc=_[_0xcf85('0x40')](_0x13f776,['id',_0x2a1d5d['id']]);if(!_0x1ff9dc)return _0x2a1d5d;return _0x1ff9dc[_0xcf85('0x41')]({'raw':!![]})[_0xcf85('0x10')](function(_0xffd52c){for(var _0x15d897=0x0;_0x15d897<_0xffd52c[_0xcf85('0x3b')];_0x15d897++){var _0x2fd3d1=_[_0xcf85('0x40')](_0xd941ab,['id',_0xffd52c[_0x15d897][_0xcf85('0x42')]]);if(!_0x2fd3d1){_0x2fd3d1={'id':_0xffd52c[_0x15d897][_0xcf85('0x42')],'name':_0xffd52c[_0x15d897][_0xcf85('0x42')],'accountcode':'','online':![]};}var _0x4e5e2c={'id':_0x2fd3d1['id'],'name':_0x2fd3d1[_0xcf85('0xf')],'internal':_0x2fd3d1[_0xcf85('0x43')],'online':Boolean(_0x2fd3d1[_0xcf85('0x44')]),'paused':Boolean(_0xffd52c[_0x15d897][_0xcf85('0x1e')])};if(_0x2fd3d1[_0xcf85('0x45')]===_0xcf85('0x1d'))updateAgentVoiceStatus(_0x4e5e2c,_0x2a1d5d,_0x122ab4);if(_0x4e5e2c['online'])_0x2a1d5d[_0xcf85('0x35')]++;if(_0x4e5e2c[_0xcf85('0x37')])_0x2a1d5d['busy']++;if(_0x4e5e2c[_0xcf85('0x1e')]&&!_0x4e5e2c[_0xcf85('0x37')]&&!_0x4e5e2c[_0xcf85('0x1d')])_0x2a1d5d[_0xcf85('0x1e')]++;_0x2a1d5d[_0xcf85('0x34')][_0xcf85('0x46')](_0x4e5e2c);}return _0x2a1d5d;});}function getQueueAgents(_0x40d704,_0x58b6fb,_0x17b5ac){var _0x509c53=_0xcf85('0x47')+_['startCase'](_0x17b5ac)+'Queue';var _0x3cfdcd=_0x17b5ac+_0xcf85('0x48');return db[_0x509c53][_0xcf85('0x49')]({'where':{[_[_0xcf85('0x4a')](_0x17b5ac)+_0xcf85('0x4b')]:_0x40d704['id']},'raw':!![]})[_0xcf85('0x10')](function(_0x2ff4f5){for(var _0x57f7bc=0x0;_0x57f7bc<_0x2ff4f5[_0xcf85('0x3b')];_0x57f7bc++){var _0x44c33f=_[_0xcf85('0x40')](_0x58b6fb,['id',_0x2ff4f5[_0x57f7bc][_0xcf85('0x42')]]);if(!_0x44c33f){_0x44c33f={'id':_0x2ff4f5[_0x57f7bc][_0xcf85('0x42')],'name':_0x2ff4f5[_0x57f7bc][_0xcf85('0x42')],'online':![],['pauseField']:![]};}var _0x421164={'id':_0x44c33f['id'],'name':_0x44c33f[_0xcf85('0xf')],'online':Boolean(_0x44c33f['online']),'paused':Boolean(_0x44c33f[_0x3cfdcd])};if(_0x421164['online'])_0x40d704[_0xcf85('0x35')]++;_0x40d704['agents'][_0xcf85('0x46')](_0x421164);}return _0x40d704;});}function isIdle(_0x3e6001){return _0x3e6001===_0xcf85('0x4c')||_0x3e6001===_0xcf85('0x4d')||_0x3e6001===_0xcf85('0x4e')||_0x3e6001===_0xcf85('0x4f')||_[_0xcf85('0x50')](_0x3e6001);}function isAgentPaused(_0x541a94,_0x3522d7){var _0x5c20cd=[_0x541a94[_0xcf85('0x51')],_0x541a94[_0xcf85('0x52')],_0x541a94['mailPause'],_0x541a94[_0xcf85('0x53')],_0x541a94['smsPause'],_0x541a94['voicePause'],_0x541a94[_0xcf85('0x54')]];if(!_0x3522d7)return _[_0xcf85('0x55')](_0x5c20cd);var _0x53977a=_[_0xcf85('0x39')](_0x5c20cd);return _0x53977a[_0xcf85('0x3b')]>0x0&&_0x53977a[_0xcf85('0x3b')]<_0x5c20cd['length']?!![]:![];}function isAgentIdle(_0x3528f3){if(_0x3528f3[_0xcf85('0x45')]!==_0xcf85('0x4c')&&_0x3528f3['voicePause']){_0x3528f3[_0xcf85('0x45')]=_0xcf85('0x56');return![];}return _[_0xcf85('0x55')]([_0x3528f3[_0xcf85('0x57')],_0x3528f3[_0xcf85('0x58')],_0x3528f3[_0xcf85('0x59')],_0x3528f3[_0xcf85('0x5a')],_0x3528f3[_0xcf85('0x5b')],_0x3528f3[_0xcf85('0x45')],_0x3528f3['whatsappStatus']],isIdle);}function getAgentStatus(_0x346233){var _0xe55de9=_0xcf85('0x4d');if(isAgentPaused(_0x346233))_0xe55de9=_0xcf85('0x56');else if(isAgentPaused(_0x346233,!![]))_0xe55de9=_0xcf85('0x5c');else if(isAgentIdle(_0x346233))_0xe55de9=_0xcf85('0x4c');else _0xe55de9=_0xcf85('0x37');return _0xe55de9;}function validateChannel(_0x2452a4){var _0x3348c1=['mail',_0xcf85('0x5d'),_0xcf85('0x5e'),_0xcf85('0x5f'),_0xcf85('0x60'),_0xcf85('0x61'),_0xcf85('0x15')];if(!_['includes'](_0x3348c1,_0x2452a4[_0xcf85('0x62')]()))throw new Error(_0xcf85('0x63'));return _0x2452a4[_0xcf85('0x62')]();}function getFilteredAgentIds(_0x2d2a16,_0x4645f8){var _0x24aa3c=_[_0xcf85('0x64')](_0x2d2a16)?_0x2d2a16:[_0x2d2a16];var _0x130e55=_[_0xcf85('0x32')](_0x24aa3c,function(_0x2cca34){return db[_0x4645f8][_0xcf85('0x65')]({'where':{'name':_0x2cca34}})[_0xcf85('0x10')](function(_0x129c52){if(!_0x129c52)return[];return _0x129c52[_0xcf85('0x66')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xcf85('0x67')](_0x130e55)[_0xcf85('0x10')](function(_0x128091){var _0x307f20=_(_0x128091)['flatten']()[_0xcf85('0x32')]('id')[_0xcf85('0x68')]()[_0xcf85('0x69')]();return _0x307f20;});}function getUpdatedSortOptions(_0x393878){var _0x2daf31={'fields':[],'order':null};var _0x101e0b=_0x393878[_0xcf85('0x6a')](',');_0x2daf31[_0xcf85('0x6b')]=_[_0xcf85('0x39')](_0x101e0b,function(_0x295182){if(!_0x295182[_0xcf85('0x6c')](_0xcf85('0x6d')))return!![];_0x2daf31[_0xcf85('0x6e')]=_[_0xcf85('0x6f')](_0x295182,'-')?_0xcf85('0x70'):_0xcf85('0x71');return![];});return _0x2daf31;}function orderAgentsByStatus(_0x1c833c,_0x26338b){return _0x1c833c[_0xcf85('0x72')](function(_0x4f4642,_0x5821e0){if(_0x4f4642[_0xcf85('0x6d')]===_0x5821e0[_0xcf85('0x6d')]&&_0x4f4642[_0xcf85('0x6d')]==='pause'){if(_0x26338b===_0xcf85('0x70'))return(_0x4f4642[_0xcf85('0x73')]||'')<(_0x5821e0['pauseType']||'')?0x1:-0x1;return _0x4f4642[_0xcf85('0x73')]<_0x5821e0['pauseType']?-0x1:0x1;}else{if(_0x26338b==='DESC')return _0x4f4642[_0xcf85('0x6d')]<_0x5821e0[_0xcf85('0x6d')]?0x1:-0x1;return _0x4f4642['globalStatus']<_0x5821e0[_0xcf85('0x6d')]?-0x1:0x1;}});}exports[_0xcf85('0x66')]=function(_0x45f351,_0x2b5ade){var _0x239201={'count':0x0,'rows':[]},_0x23eccb={},_0xde3388,_0x5ce78d,_0x124585,_0x5dfee5,_0x337150=[_0xcf85('0x74'),_0xcf85('0x44'),_0xcf85('0x75'),_0xcf85('0x76'),_0xcf85('0x73'),_0xcf85('0x76'),_0xcf85('0x3e'),_0xcf85('0x77'),'chatPause','openchannelPause',_0xcf85('0x78'),'smsPause',_0xcf85('0x54'),_0xcf85('0x52'),'voicePause','chatCapacity',_0xcf85('0x79'),_0xcf85('0x7a'),_0xcf85('0x7b'),'whatsappCapacity',_0xcf85('0x7c'),_0xcf85('0x7d'),'openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity',_0xcf85('0x7e'),'faxCurrentCapacity',_0xcf85('0x57'),'openchannelStatus',_0xcf85('0x59'),_0xcf85('0x5b'),_0xcf85('0x7f'),'faxStatus',_0xcf85('0x45'),_0xcf85('0x80'),_0xcf85('0x81'),_0xcf85('0x82'),_0xcf85('0x83'),_0xcf85('0x84'),_0xcf85('0x85'),_0xcf85('0x86'),_0xcf85('0x3a'),_0xcf85('0x87'),_0xcf85('0x88'),_0xcf85('0x89'),_0xcf85('0x8a'),_0xcf85('0x8b')],_0x4293c3=['chatPause','openchannelPause',_0xcf85('0x78'),_0xcf85('0x8c'),_0xcf85('0x54'),_0xcf85('0x52'),'voicePause','online'];Promise[_0xcf85('0x8d')]()[_0xcf85('0x10')](function(){if(_0x45f351[_0xcf85('0x8e')][_0xcf85('0x8f')])_0xde3388=validateChannel(_0x45f351[_0xcf85('0x8e')]['channel']);if(!_0x45f351[_0xcf85('0x8e')][_0xcf85('0x72')]||!_0x45f351[_0xcf85('0x8e')]['sort'][_0xcf85('0x6c')](_0xcf85('0x6d')))return;var _0x149ffb=getUpdatedSortOptions(_0x45f351['query'][_0xcf85('0x72')]);_0x45f351[_0xcf85('0x8e')][_0xcf85('0x72')]=_0x149ffb['fields'][_0xcf85('0x90')](',');_0x5ce78d=_0x149ffb[_0xcf85('0x6e')];})[_0xcf85('0x10')](function(){if(!_0x45f351[_0xcf85('0x8e')][_0xcf85('0x91')])return[];var _0x28da65=_[_0xcf85('0x4a')](_0xde3388)+'Queue';return getFilteredAgentIds(_0x45f351[_0xcf85('0x8e')][_0xcf85('0x91')],_0x28da65);})[_0xcf85('0x10')](function(_0x3a6f90){var _0x174456=_['map'](db[_0xcf85('0x47')][_0xcf85('0x92')],function(_0x53565c){return{'name':_0x53565c[_0xcf85('0x93')],'type':_0x53565c['type'][_0xcf85('0x94')]};});_0x45f351[_0xcf85('0x8e')][_0xcf85('0x95')]=_0xcf85('0x96');_0x45f351[_0xcf85('0x8e')]['online']=!![];_0x23eccb=qs['getOptions'](_0x174456,_0x45f351);_0x23eccb[_0xcf85('0x97')]=!![];if(!_[_0xcf85('0x98')](_0x3a6f90)){_0x23eccb['where']=_[_0xcf85('0x14')](_0x23eccb[_0xcf85('0x99')],{'$and':[{'id':{'$in':_0x3a6f90}}]});}else if(!_['isEmpty'](_0x45f351['query'][_0xcf85('0x91')])){return _0x239201;}if(_0x45f351[_0xcf85('0x9a')]['role']==='user'){var _0x5466b7={'params':{'id':_0x45f351[_0xcf85('0x9a')][_0xcf85('0x9b')]},'query':{'section':'Agents','role':_0xcf85('0x96'),'online':!![],'nolimit':_0x45f351[_0xcf85('0x8e')][_0xcf85('0x9c')],'sort':_0x45f351[_0xcf85('0x8e')][_0xcf85('0x72')],'filter':_0x45f351[_0xcf85('0x8e')][_0xcf85('0x39')],'raw':!![],'ids':_0x3a6f90}};return db[_0xcf85('0x9d')][_0xcf85('0x9e')](_0x5466b7);}return db[_0xcf85('0x47')][_0xcf85('0x9f')](_0x23eccb);})[_0xcf85('0x10')](function(_0x1b0281){_0x239201[_0xcf85('0x9')]=_0x1b0281[_0xcf85('0x9')];_0x124585=_0x1b0281[_0xcf85('0xa0')];return getRealtimeAgents();})[_0xcf85('0x10')](function(_0x36b19f){_0x5dfee5=_0x36b19f[_0xcf85('0xa0')];return _0x124585[_0xcf85('0x32')](function(_0x68d3d0){var _0x56c875=_[_0xcf85('0x40')](_0x5dfee5,['id',_0x68d3d0['id']]);if(_0x56c875)_[_0xcf85('0x14')](_0x68d3d0,_[_0xcf85('0x38')](_['omit'](_0x56c875,_0x4293c3),_0x337150));_0x68d3d0[_0xcf85('0x6d')]=getAgentStatus(_0x68d3d0);return _0x68d3d0;});})[_0xcf85('0x10')](function(_0xe5e11){var _0x165be3;if(_0x45f351['query'][_0xcf85('0xa1')]){_0x165be3=_[_0xcf85('0x39')](_0xe5e11,['globalStatus',_0x45f351[_0xcf85('0x8e')][_0xcf85('0xa1')]]);if(_0x45f351[_0xcf85('0x8e')][_0xcf85('0xa2')]){_0x165be3=_[_0xcf85('0x39')](_0x165be3,[_0xcf85('0x73'),_0x45f351['query'][_0xcf85('0xa2')]]);}}if(_0x165be3)_0xe5e11=_0x165be3;if(!_0x5ce78d)return _0xe5e11;return orderAgentsByStatus(_0xe5e11,_0x5ce78d);})[_0xcf85('0x10')](function(_0x26e714){_0x239201[_0xcf85('0xa0')]=_0x26e714;return _0x239201;})[_0xcf85('0x10')](respondWithFilteredResult(_0x2b5ade,_0x23eccb))[_0xcf85('0x19')](handleError(_0x2b5ade,null));};exports['getQueues']=function(_0x1b89cc,_0x4d0542){var _0x59cdcb={'count':0x0,'rows':[]},_0x30fc77={},_0x294d3b,_0x659c07,_0x4f1dbc,_0xe280c4,_0x397a4e;Promise[_0xcf85('0x8d')]()[_0xcf85('0x10')](function(){if(_0x1b89cc['query']['channel'])_0x294d3b=validateChannel(_0x1b89cc[_0xcf85('0x8e')]['channel']);var _0xe9b004=_[_0xcf85('0x4a')](_0x294d3b)+'Queue';var _0x44c11b=_['map'](db[_0xe9b004][_0xcf85('0x92')],function(_0x21c36f){return{'name':_0x21c36f[_0xcf85('0x93')],'type':_0x21c36f[_0xcf85('0xa3')][_0xcf85('0x94')]};});_0x30fc77=qs[_0xcf85('0xa4')](_0x44c11b,_0x1b89cc);if(_0x1b89cc[_0xcf85('0x9a')]['role']===_0xcf85('0x9a')){var _0x3ee0f6={'params':{'id':_0x1b89cc['user'][_0xcf85('0x9b')]},'query':{'section':_0x294d3b===_0xcf85('0x15')&&_0x1b89cc[_0xcf85('0x8e')]['type']===_0xcf85('0x1f')?_0xcf85('0xa5'):_[_0xcf85('0x4a')](_0x294d3b)+_0xcf85('0x16'),'type':_0x1b89cc[_0xcf85('0x8e')][_0xcf85('0xa3')],'nolimit':!![],'sort':_0xcf85('0xf'),'filter':_0x1b89cc[_0xcf85('0x8e')][_0xcf85('0x39')]}};return db[_0xcf85('0x9d')][_0xcf85('0x9e')](_0x3ee0f6);}return db[_0xe9b004][_0xcf85('0x9f')](_0x30fc77);})[_0xcf85('0x10')](function(_0x2ba101){_0x59cdcb[_0xcf85('0x9')]=_0x2ba101[_0xcf85('0x9')];_0x659c07=_0x2ba101[_0xcf85('0xa0')];return getRealtimeQueues(_0x1b89cc,_0x294d3b);})[_0xcf85('0x10')](function(_0x564941){_0xe280c4=_0x564941[_0xcf85('0xa0')];return getRealtimeAgents();})[_0xcf85('0x10')](function(_0x17be94){_0x4f1dbc=_0x17be94['rows'];if(_0x294d3b!=_0xcf85('0x15'))return;return getRealtimeVoiceQueueChannels();})[_0xcf85('0x10')](function(_0x3df669){_0x397a4e=_0x3df669?_0x3df669[_0xcf85('0xa0')]:[];return initializeQueues(_0x659c07,_0xe280c4,_0x294d3b,_0x1b89cc[_0xcf85('0x8e')][_0xcf85('0xa3')]);})[_0xcf85('0x10')](function(_0x262d5a){var _0x4596dc=_0x262d5a['map'](function(_0x3089d0){if(_0x294d3b===_0xcf85('0x15'))return getVoiceQueueAgents(_0x3089d0,_0x659c07,_0x4f1dbc,_0x397a4e);else return getQueueAgents(_0x3089d0,_0x4f1dbc,_0x294d3b);});return Promise['all'](_0x4596dc);})[_0xcf85('0x10')](function(_0x2c1b37){_0x59cdcb[_0xcf85('0xa0')]=_0x2c1b37;return _0x59cdcb;})['then'](respondWithFilteredResult(_0x4d0542,_0x30fc77))[_0xcf85('0x19')](handleError(_0x4d0542,null));}; \ No newline at end of file +var _0x48da=['unavailable','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','sms','openchannel','fax','whatsapp','toLowerCase','Invalid\x20channel','isArray','findOne','all','flatten','uniq','split','fields','includes','globalStatus','order','startsWith','DESC','sort','pauseType','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','resolve','query','channel','join','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','isEmpty','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','getOptions','outbound','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','set','json','error','name','send','Agents','then','result','merge','catch','voice','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','request','loggedIn','available','waiting','talking','paused','push','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','pTalking','find','pick','filter','queue','length','some','connectedlinenum','internal','toString','UserId','accountcode','voiceStatus','User','startCase','Queue','findAll','online','idle','unknown'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x48da,0x101));var _0xa48d=function(_0x4c6ba2,_0x12c98b){_0x4c6ba2=_0x4c6ba2-0x0;var _0xe7b6cc=_0x48da[_0x4c6ba2];return _0xe7b6cc;};'use strict';var util=require(_0xa48d('0x0'));var _=require(_0xa48d('0x1'));var jayson=require(_0xa48d('0x2'));var qs=require(_0xa48d('0x3'));var logger=require(_0xa48d('0x4'))(_0xa48d('0x5'));var db=require(_0xa48d('0x6'))['db'];var amiClient=jayson[_0xa48d('0x7')][_0xa48d('0x8')]({'port':0x232a});var routingClient=jayson[_0xa48d('0x7')][_0xa48d('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x2f694b,_0x2c54fc){return function(_0x3fe95b){if(_0x3fe95b){var _0x479ac5=typeof _0x2c54fc[_0xa48d('0x9')]===_0xa48d('0xa')&&typeof _0x2c54fc['limit']===_0xa48d('0xa');var _0x183e7d=_0x3fe95b[_0xa48d('0xb')];var _0x29574a=_0x479ac5?0x0:_0x2c54fc[_0xa48d('0x9')];var _0x46eb65=_0x479ac5?_0x3fe95b[_0xa48d('0xb')]:_0x2c54fc[_0xa48d('0x9')]+_0x2c54fc[_0xa48d('0xc')];var _0x5d07ed;if(_0x46eb65>=_0x183e7d){_0x46eb65=_0x183e7d;_0x5d07ed=0xc8;}else{_0x5d07ed=0xce;}_0x2f694b[_0xa48d('0xd')](_0x5d07ed);return _0x2f694b[_0xa48d('0xe')]('Content-Range',_0x29574a+'-'+_0x46eb65+'/'+_0x183e7d)[_0xa48d('0xf')](_0x3fe95b);}return null;};}function handleError(_0x2c60a0,_0x48baf2){_0x48baf2=_0x48baf2||0x1f4;return function(_0x4d51ef){logger[_0xa48d('0x10')](_0x4d51ef['stack']);if(_0x4d51ef[_0xa48d('0x11')]){delete _0x4d51ef['name'];}_0x2c60a0[_0xa48d('0xd')](_0x48baf2)[_0xa48d('0x12')](_0x4d51ef);};}function getRealtimeAgents(){return new Promise(function(_0x3e89b2,_0x20602a){return amiClient['request'](_0xa48d('0x13'),{})[_0xa48d('0x14')](function(_0x5c4877){if(_0x5c4877[_0xa48d('0x10')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x4084b7=_0x5c4877['result'];return routingClient['request'](_0xa48d('0x13'),{})['then'](function(_0x50e580){if(_0x50e580[_0xa48d('0x10')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x76650e=_0x50e580[_0xa48d('0x15')];return _0x3e89b2(_[_0xa48d('0x16')]({},_0x4084b7,_0x76650e));});})[_0xa48d('0x17')](function(_0x2939ec){_0x20602a(_0x2939ec);});});}function getRealtimeQueues(_0x4b7a52,_0x4488a1){return new Promise(function(_0x3f7cd0,_0x4282bc){var _0x5c732f=_0x4488a1===_0xa48d('0x18')?amiClient:routingClient;return _0x5c732f['request'](_['startCase'](_0x4488a1)+_0xa48d('0x19'),_0x4b7a52)[_0xa48d('0x14')](function(_0xf856f8){if(_0xf856f8['error'])throw new Error(util['format'](_0xa48d('0x1a'),_0x4488a1));return _0x3f7cd0(_0xf856f8[_0xa48d('0x15')]);})[_0xa48d('0x17')](function(_0x350fce){_0x4282bc(_0x350fce);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x115736,_0x1d58a6){return amiClient[_0xa48d('0x1b')]('VoiceQueuesChannels',{})[_0xa48d('0x14')](function(_0x141864){if(_0x141864[_0xa48d('0x10')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x115736(_0x141864[_0xa48d('0x15')]);})[_0xa48d('0x17')](function(_0x237711){_0x1d58a6(_0x237711);});});}function initializeQueues(_0x4fc8fb,_0x278f6e,_0x47ca6c,_0x58df37){var _0x271d7c=[_0xa48d('0x1c'),_0xa48d('0x1d'),_0xa48d('0x1e'),_0xa48d('0x1f'),_0xa48d('0x20')];if(_0x47ca6c===_0xa48d('0x18')&&_0x58df37==='outbound'){_0x271d7c[_0xa48d('0x21')]('pTalking',_0xa48d('0x22'),_0xa48d('0x23'),_0xa48d('0x24'),'dialMethod',_0xa48d('0x25'),_0xa48d('0x26'),_0xa48d('0x27'),'erlangCalls',_0xa48d('0x28'),_0xa48d('0x29'),_0xa48d('0x2a'),_0xa48d('0x2b'),_0xa48d('0x2c'),_0xa48d('0x2d'),_0xa48d('0x2e'),'predictiveIntervalTotalCalls',_0xa48d('0x2f'),_0xa48d('0x30'),_0xa48d('0x31'),_0xa48d('0x32'),_0xa48d('0x33'));}return _0x4fc8fb[_0xa48d('0x34')](function(_0x5f020a){var _0x4bfe1f=_0x5f020a[_0xa48d('0x35')]({'plain':!![]});_0x4bfe1f[_0xa48d('0x36')]=[];_0x4bfe1f['paused']=0x0;_0x4bfe1f[_0xa48d('0x37')]=0x0;_0x4bfe1f[_0xa48d('0x1c')]=0x0;_0x4bfe1f[_0xa48d('0x1d')]=0x0;_0x4bfe1f['waiting']=0x0;if(_0x47ca6c===_0xa48d('0x18')){_0x4bfe1f['talking']=0x0;_0x4bfe1f[_0xa48d('0x38')]=0x0;if(_0x58df37==='outbound'){_0x4bfe1f[_0xa48d('0x39')]=0x0;_0x4bfe1f[_0xa48d('0x22')]=0x0;}}var _0x1c97f9=_[_0xa48d('0x3a')](_0x278f6e,['id',_0x4bfe1f['id']]);if(_0x1c97f9)_[_0xa48d('0x16')](_0x4bfe1f,_[_0xa48d('0x3b')](_0x1c97f9,_0x271d7c));return _0x4bfe1f;});}function updateAgentVoiceStatus(_0x47d1ab,_0x311b48,_0x3bef39){var _0xff5ff4=_[_0xa48d('0x3c')](_0x3bef39,[_0xa48d('0x3d'),_0x311b48['name']]);if(_0xff5ff4[_0xa48d('0x3e')]===0x0)return _0x47d1ab[_0xa48d('0x38')]=!![];if(_[_0xa48d('0x3f')](_0xff5ff4,[_0xa48d('0x40'),_0x47d1ab[_0xa48d('0x41')][_0xa48d('0x42')]()]))return _0x47d1ab[_0xa48d('0x1f')]=!![];if(!_0x47d1ab[_0xa48d('0x1f')])return _0x47d1ab[_0xa48d('0x38')]=!![];}function getVoiceQueueAgents(_0x34e069,_0x330a45,_0x158bbc,_0x565950){var _0x3336fa=_['find'](_0x330a45,['id',_0x34e069['id']]);if(!_0x3336fa)return _0x34e069;return _0x3336fa['getMembers']({'raw':!![]})['then'](function(_0x46653a){for(var _0x2bf143=0x0;_0x2bf143<_0x46653a['length'];_0x2bf143++){var _0x5591b7=_[_0xa48d('0x3a')](_0x158bbc,['id',_0x46653a[_0x2bf143][_0xa48d('0x43')]]);if(!_0x5591b7){_0x5591b7={'id':_0x46653a[_0x2bf143]['UserId'],'name':_0x46653a[_0x2bf143][_0xa48d('0x43')],'accountcode':'','online':![]};}var _0x585f85={'id':_0x5591b7['id'],'name':_0x5591b7[_0xa48d('0x11')],'internal':_0x5591b7[_0xa48d('0x44')],'online':Boolean(_0x5591b7['online']),'paused':Boolean(_0x46653a[_0x2bf143][_0xa48d('0x20')])};if(_0x5591b7[_0xa48d('0x45')]==='talking')updateAgentVoiceStatus(_0x585f85,_0x34e069,_0x565950);if(_0x585f85['online'])_0x34e069['loggedInDb']++;if(_0x585f85[_0xa48d('0x38')])_0x34e069[_0xa48d('0x38')]++;if(_0x585f85[_0xa48d('0x20')]&&!_0x585f85[_0xa48d('0x38')]&&!_0x585f85[_0xa48d('0x1f')])_0x34e069['paused']++;_0x34e069['agents'][_0xa48d('0x21')](_0x585f85);}return _0x34e069;});}function getQueueAgents(_0x22eea8,_0x49f582,_0x2cf1b5){var _0x49a3eb=_0xa48d('0x46')+_[_0xa48d('0x47')](_0x2cf1b5)+_0xa48d('0x48');var _0x2f6a68=_0x2cf1b5+'Pause';return db[_0x49a3eb][_0xa48d('0x49')]({'where':{[_[_0xa48d('0x47')](_0x2cf1b5)+'QueueId']:_0x22eea8['id']},'raw':!![]})[_0xa48d('0x14')](function(_0x5653a4){for(var _0x462d97=0x0;_0x462d97<_0x5653a4[_0xa48d('0x3e')];_0x462d97++){var _0x276267=_[_0xa48d('0x3a')](_0x49f582,['id',_0x5653a4[_0x462d97][_0xa48d('0x43')]]);if(!_0x276267){_0x276267={'id':_0x5653a4[_0x462d97][_0xa48d('0x43')],'name':_0x5653a4[_0x462d97][_0xa48d('0x43')],'online':![],['pauseField']:![]};}var _0x3c0da0={'id':_0x276267['id'],'name':_0x276267[_0xa48d('0x11')],'online':Boolean(_0x276267[_0xa48d('0x4a')]),'paused':Boolean(_0x276267[_0x2f6a68])};if(_0x3c0da0[_0xa48d('0x4a')])_0x22eea8[_0xa48d('0x37')]++;_0x22eea8[_0xa48d('0x36')][_0xa48d('0x21')](_0x3c0da0);}return _0x22eea8;});}function isIdle(_0x5d284e){return _0x5d284e===_0xa48d('0x4b')||_0x5d284e===_0xa48d('0x4c')||_0x5d284e===_0xa48d('0x4d')||_0x5d284e==='ringing'||_[_0xa48d('0x4e')](_0x5d284e);}function isAgentPaused(_0x53fd36,_0x2b4936){var _0x209313=[_0x53fd36[_0xa48d('0x4f')],_0x53fd36[_0xa48d('0x50')],_0x53fd36[_0xa48d('0x51')],_0x53fd36[_0xa48d('0x52')],_0x53fd36[_0xa48d('0x53')],_0x53fd36[_0xa48d('0x54')],_0x53fd36[_0xa48d('0x55')]];if(!_0x2b4936)return _[_0xa48d('0x56')](_0x209313);var _0xe56a6d=_['filter'](_0x209313);return _0xe56a6d['length']>0x0&&_0xe56a6d[_0xa48d('0x3e')]<_0x209313[_0xa48d('0x3e')]?!![]:![];}function isAgentIdle(_0x3aa5a4){if(_0x3aa5a4[_0xa48d('0x45')]!==_0xa48d('0x4b')&&_0x3aa5a4[_0xa48d('0x54')]){_0x3aa5a4[_0xa48d('0x45')]=_0xa48d('0x57');return![];}return _['every']([_0x3aa5a4[_0xa48d('0x58')],_0x3aa5a4[_0xa48d('0x59')],_0x3aa5a4[_0xa48d('0x5a')],_0x3aa5a4[_0xa48d('0x5b')],_0x3aa5a4[_0xa48d('0x5c')],_0x3aa5a4['voiceStatus'],_0x3aa5a4[_0xa48d('0x5d')]],isIdle);}function getAgentStatus(_0x205a17){var _0xfe0d96='unknown';if(isAgentPaused(_0x205a17))_0xfe0d96=_0xa48d('0x57');else if(isAgentPaused(_0x205a17,!![]))_0xfe0d96=_0xa48d('0x5e');else if(isAgentIdle(_0x205a17))_0xfe0d96=_0xa48d('0x4b');else _0xfe0d96='busy';return _0xfe0d96;}function validateChannel(_0xb05f4e){var _0x1dc5ec=[_0xa48d('0x5f'),_0xa48d('0x60'),_0xa48d('0x61'),_0xa48d('0x62'),_0xa48d('0x63'),_0xa48d('0x64'),_0xa48d('0x18')];if(!_['includes'](_0x1dc5ec,_0xb05f4e[_0xa48d('0x65')]()))throw new Error(_0xa48d('0x66'));return _0xb05f4e[_0xa48d('0x65')]();}function getFilteredAgentIds(_0xf20de3,_0x2ac171){var _0x1d7791=_[_0xa48d('0x67')](_0xf20de3)?_0xf20de3:[_0xf20de3];var _0x2999fb=_[_0xa48d('0x34')](_0x1d7791,function(_0x4fb9f4){return db[_0x2ac171][_0xa48d('0x68')]({'where':{'name':_0x4fb9f4}})[_0xa48d('0x14')](function(_0x3995ee){if(!_0x3995ee)return[];return _0x3995ee['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xa48d('0x69')](_0x2999fb)[_0xa48d('0x14')](function(_0x2a4813){var _0x584c21=_(_0x2a4813)[_0xa48d('0x6a')]()[_0xa48d('0x34')]('id')[_0xa48d('0x6b')]()['value']();return _0x584c21;});}function getUpdatedSortOptions(_0x454a7d){var _0x12720d={'fields':[],'order':null};var _0x38e549=_0x454a7d[_0xa48d('0x6c')](',');_0x12720d[_0xa48d('0x6d')]=_[_0xa48d('0x3c')](_0x38e549,function(_0x4a262f){if(!_0x4a262f[_0xa48d('0x6e')](_0xa48d('0x6f')))return!![];_0x12720d[_0xa48d('0x70')]=_[_0xa48d('0x71')](_0x4a262f,'-')?_0xa48d('0x72'):'ASC';return![];});return _0x12720d;}function orderAgentsByStatus(_0x570e32,_0x4acd70){return _0x570e32[_0xa48d('0x73')](function(_0x1b9f0f,_0x10c439){if(_0x1b9f0f[_0xa48d('0x6f')]===_0x10c439[_0xa48d('0x6f')]&&_0x1b9f0f[_0xa48d('0x6f')]==='pause'){if(_0x4acd70===_0xa48d('0x72'))return(_0x1b9f0f[_0xa48d('0x74')]||'')<(_0x10c439[_0xa48d('0x74')]||'')?0x1:-0x1;return _0x1b9f0f[_0xa48d('0x74')]<_0x10c439[_0xa48d('0x74')]?-0x1:0x1;}else{if(_0x4acd70===_0xa48d('0x72'))return _0x1b9f0f['globalStatus']<_0x10c439['globalStatus']?0x1:-0x1;return _0x1b9f0f[_0xa48d('0x6f')]<_0x10c439[_0xa48d('0x6f')]?-0x1:0x1;}});}exports['getAgents']=function(_0xfe18c,_0x653932){var _0x4664a4={'count':0x0,'rows':[]},_0x101482={},_0x36d9df,_0x2fdf2f,_0x533560,_0x17de8f,_0x1709ab=[_0xa48d('0x75'),_0xa48d('0x4a'),_0xa48d('0x76'),_0xa48d('0x77'),'pauseType','lastPauseAt','internal',_0xa48d('0x78'),_0xa48d('0x4f'),_0xa48d('0x52'),'mailPause','smsPause',_0xa48d('0x55'),_0xa48d('0x50'),_0xa48d('0x54'),_0xa48d('0x79'),_0xa48d('0x7a'),_0xa48d('0x7b'),_0xa48d('0x7c'),_0xa48d('0x7d'),_0xa48d('0x7e'),_0xa48d('0x7f'),_0xa48d('0x80'),_0xa48d('0x81'),_0xa48d('0x82'),_0xa48d('0x83'),_0xa48d('0x84'),'chatStatus',_0xa48d('0x5b'),_0xa48d('0x5a'),_0xa48d('0x5c'),'whatsappStatus','faxStatus',_0xa48d('0x45'),_0xa48d('0x85'),_0xa48d('0x86'),_0xa48d('0x87'),_0xa48d('0x88'),_0xa48d('0x89'),'faxStatusTime','voiceStatusTime',_0xa48d('0x3d'),'destconnectedlinenum',_0xa48d('0x8a'),_0xa48d('0x8b'),'phoneBarEnableAutomaticScreenRecording',_0xa48d('0x8c')],_0x3b5958=[_0xa48d('0x4f'),_0xa48d('0x52'),_0xa48d('0x51'),_0xa48d('0x53'),_0xa48d('0x55'),_0xa48d('0x50'),'voicePause',_0xa48d('0x4a')];Promise[_0xa48d('0x8d')]()['then'](function(){if(_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x8f')])_0x36d9df=validateChannel(_0xfe18c['query'][_0xa48d('0x8f')]);if(!_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x73')]||!_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x73')][_0xa48d('0x6e')]('globalStatus'))return;var _0x2f4a48=getUpdatedSortOptions(_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x73')]);_0xfe18c['query'][_0xa48d('0x73')]=_0x2f4a48['fields'][_0xa48d('0x90')](',');_0x2fdf2f=_0x2f4a48[_0xa48d('0x70')];})[_0xa48d('0x14')](function(){if(!_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x91')])return[];var _0x2edb86=_['startCase'](_0x36d9df)+_0xa48d('0x48');return getFilteredAgentIds(_0xfe18c['query']['globalQueueFilter'],_0x2edb86);})['then'](function(_0x13a9a3){var _0x4b14ca=_['map'](db['User'][_0xa48d('0x92')],function(_0x25bc4b){return{'name':_0x25bc4b[_0xa48d('0x93')],'type':_0x25bc4b[_0xa48d('0x94')][_0xa48d('0x95')]};});_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x96')]=_0xa48d('0x97');_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x4a')]=!![];_0x101482=qs['getOptions'](_0x4b14ca,_0xfe18c);_0x101482['raw']=!![];if(!_['isEmpty'](_0x13a9a3)){_0x101482['where']=_[_0xa48d('0x16')](_0x101482['where'],{'$and':[{'id':{'$in':_0x13a9a3}}]});}else if(!_[_0xa48d('0x98')](_0xfe18c['query'][_0xa48d('0x91')])){return _0x4664a4;}if(_0xfe18c[_0xa48d('0x99')]['role']===_0xa48d('0x99')){var _0x5de205={'params':{'id':_0xfe18c[_0xa48d('0x99')][_0xa48d('0x9a')]},'query':{'section':_0xa48d('0x13'),'role':'agent','online':!![],'nolimit':_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x9b')],'sort':_0xfe18c['query'][_0xa48d('0x73')],'filter':_0xfe18c[_0xa48d('0x8e')][_0xa48d('0x3c')],'raw':!![],'ids':_0x13a9a3}};return db[_0xa48d('0x9c')][_0xa48d('0x9d')](_0x5de205);}return db[_0xa48d('0x46')][_0xa48d('0x9e')](_0x101482);})[_0xa48d('0x14')](function(_0x4f9650){_0x4664a4['count']=_0x4f9650[_0xa48d('0xb')];_0x533560=_0x4f9650['rows'];return getRealtimeAgents();})[_0xa48d('0x14')](function(_0x10b66f){_0x17de8f=_0x10b66f[_0xa48d('0x9f')];return _0x533560[_0xa48d('0x34')](function(_0x49af1d){var _0x4a9fbc=_['find'](_0x17de8f,['id',_0x49af1d['id']]);if(_0x4a9fbc)_[_0xa48d('0x16')](_0x49af1d,_[_0xa48d('0x3b')](_[_0xa48d('0xa0')](_0x4a9fbc,_0x3b5958),_0x1709ab));_0x49af1d[_0xa48d('0x6f')]=getAgentStatus(_0x49af1d);return _0x49af1d;});})[_0xa48d('0x14')](function(_0x1c69af){var _0x44be48;if(_0xfe18c[_0xa48d('0x8e')][_0xa48d('0xa1')]){_0x44be48=_[_0xa48d('0x3c')](_0x1c69af,[_0xa48d('0x6f'),_0xfe18c[_0xa48d('0x8e')]['globalStatusFilter']]);if(_0xfe18c[_0xa48d('0x8e')][_0xa48d('0xa2')]){_0x44be48=_[_0xa48d('0x3c')](_0x44be48,[_0xa48d('0x74'),_0xfe18c[_0xa48d('0x8e')][_0xa48d('0xa2')]]);}}if(_0x44be48)_0x1c69af=_0x44be48;if(!_0x2fdf2f)return _0x1c69af;return orderAgentsByStatus(_0x1c69af,_0x2fdf2f);})[_0xa48d('0x14')](function(_0x192a24){_0x4664a4[_0xa48d('0x9f')]=_0x192a24;return _0x4664a4;})[_0xa48d('0x14')](respondWithFilteredResult(_0x653932,_0x101482))['catch'](handleError(_0x653932,null));};exports[_0xa48d('0xa3')]=function(_0x5c93b1,_0x2ed7d8){var _0x24c28a={'count':0x0,'rows':[]},_0x1c6133={},_0x96c8d1,_0x4b86d1,_0x5ad64e,_0x2942e2,_0x33011a;Promise['resolve']()['then'](function(){if(_0x5c93b1[_0xa48d('0x8e')][_0xa48d('0x8f')])_0x96c8d1=validateChannel(_0x5c93b1['query'][_0xa48d('0x8f')]);var _0xab42a8=_[_0xa48d('0x47')](_0x96c8d1)+_0xa48d('0x48');var _0x3ae6e0=_[_0xa48d('0x34')](db[_0xab42a8][_0xa48d('0x92')],function(_0x4a101c){return{'name':_0x4a101c[_0xa48d('0x93')],'type':_0x4a101c['type']['key']};});_0x1c6133=qs[_0xa48d('0xa4')](_0x3ae6e0,_0x5c93b1);if(_0x5c93b1[_0xa48d('0x99')][_0xa48d('0x96')]===_0xa48d('0x99')){var _0x2b2907={'params':{'id':_0x5c93b1[_0xa48d('0x99')][_0xa48d('0x9a')]},'query':{'section':_0x96c8d1==='voice'&&_0x5c93b1[_0xa48d('0x8e')]['type']===_0xa48d('0xa5')?_0xa48d('0xa6'):_[_0xa48d('0x47')](_0x96c8d1)+_0xa48d('0x19'),'type':_0x5c93b1[_0xa48d('0x8e')][_0xa48d('0x94')],'nolimit':!![],'sort':_0xa48d('0x11'),'filter':_0x5c93b1['query'][_0xa48d('0x3c')]}};return db['UserProfile']['getResources'](_0x2b2907);}return db[_0xab42a8][_0xa48d('0x9e')](_0x1c6133);})[_0xa48d('0x14')](function(_0x72635d){_0x24c28a[_0xa48d('0xb')]=_0x72635d[_0xa48d('0xb')];_0x4b86d1=_0x72635d['rows'];return getRealtimeQueues(_0x5c93b1,_0x96c8d1);})['then'](function(_0x26f748){_0x2942e2=_0x26f748['rows'];return getRealtimeAgents();})[_0xa48d('0x14')](function(_0x4d7811){_0x5ad64e=_0x4d7811['rows'];if(_0x96c8d1!=_0xa48d('0x18'))return;return getRealtimeVoiceQueueChannels();})[_0xa48d('0x14')](function(_0x2af57d){_0x33011a=_0x2af57d?_0x2af57d[_0xa48d('0x9f')]:[];return initializeQueues(_0x4b86d1,_0x2942e2,_0x96c8d1,_0x5c93b1['query'][_0xa48d('0x94')]);})[_0xa48d('0x14')](function(_0xb9d4a6){var _0x1e8e67=_0xb9d4a6[_0xa48d('0x34')](function(_0x44770f){if(_0x96c8d1===_0xa48d('0x18'))return getVoiceQueueAgents(_0x44770f,_0x4b86d1,_0x5ad64e,_0x33011a);else return getQueueAgents(_0x44770f,_0x5ad64e,_0x96c8d1);});return Promise[_0xa48d('0x69')](_0x1e8e67);})[_0xa48d('0x14')](function(_0x3b1733){_0x24c28a[_0xa48d('0x9f')]=_0x3b1733;return _0x24c28a;})[_0xa48d('0x14')](respondWithFilteredResult(_0x2ed7d8,_0x1c6133))['catch'](handleError(_0x2ed7d8,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0f2debe..7d50ed7 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3a76cc,_0x43c78d){var _0x1204f8=function(_0x455c75){while(--_0x455c75){_0x3a76cc['push'](_0x3a76cc['shift']());}};_0x1204f8(++_0x43c78d);}(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1c0a71,_0x651dc8){var _0x191442=function(_0xa77d2e){while(--_0xa77d2e){_0x1c0a71['push'](_0x1c0a71['shift']());}};_0x191442(++_0x651dc8);}(_0xe706,0xa3));var _0x6e70=function(_0x1c36a8,_0x49c835){_0x1c36a8=_0x1c36a8-0x0;var _0xb622c5=_0xe706[_0x1c36a8];return _0xb622c5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 978e862..88c11c6 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 _0x0324=['exports','INTEGER','STRING','DATE'];(function(_0x28acd7,_0x2d7d6a){var _0x4fcc45=function(_0x5e0522){while(--_0x5e0522){_0x28acd7['push'](_0x28acd7['shift']());}};_0x4fcc45(++_0x2d7d6a);}(_0x0324,0x90));var _0x4032=function(_0x19a15d,_0x58decf){_0x19a15d=_0x19a15d-0x0;var _0x2e5e90=_0x0324[_0x19a15d];return _0x2e5e90;};'use strict';var Sequelize=require('sequelize');module[_0x4032('0x0')]={'state':{'type':Sequelize[_0x4032('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4032('0x2')]},'scheduledat':{'type':Sequelize[_0x4032('0x3')]},'uniqueid':{'type':Sequelize[_0x4032('0x2')]},'starttime':{'type':Sequelize[_0x4032('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4032('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4032('0x2')]},'campaigntype':{'type':Sequelize[_0x4032('0x2')]},'membername':{'type':Sequelize[_0x4032('0x2')]}}; \ No newline at end of file +var _0x5078=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x3c0b01,_0x1eb82f){var _0x291391=function(_0x41fa0f){while(--_0x41fa0f){_0x3c0b01['push'](_0x3c0b01['shift']());}};_0x291391(++_0x1eb82f);}(_0x5078,0x148));var _0x8507=function(_0xf43cb,_0x465374){_0xf43cb=_0xf43cb-0x0;var _0x14e869=_0x5078[_0xf43cb];return _0x14e869;};'use strict';var Sequelize=require(_0x8507('0x0'));module[_0x8507('0x1')]={'state':{'type':Sequelize[_0x8507('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8507('0x3')]},'scheduledat':{'type':Sequelize[_0x8507('0x4')]},'uniqueid':{'type':Sequelize[_0x8507('0x3')]},'starttime':{'type':Sequelize[_0x8507('0x4')]},'responsetime':{'type':Sequelize[_0x8507('0x4')]},'ringtime':{'type':Sequelize[_0x8507('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8507('0x3')]},'campaigntype':{'type':Sequelize[_0x8507('0x3')]},'membername':{'type':Sequelize[_0x8507('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index dc04bb5..0ed1717 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 _0x7755=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x1c2ce6,_0x1efe73){var _0x150504=function(_0x1a5898){while(--_0x1a5898){_0x1c2ce6['push'](_0x1c2ce6['shift']());}};_0x150504(++_0x1efe73);}(_0x7755,0x176));var _0x5775=function(_0x15af84,_0x7a5b4d){_0x15af84=_0x15af84-0x0;var _0x5ac0a4=_0x7755[_0x15af84];return _0x5ac0a4;};'use strict';var _=require(_0x5775('0x0'));var util=require(_0x5775('0x1'));var logger=require(_0x5775('0x2'))(_0x5775('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5775('0x4'));var fs=require('fs');var path=require(_0x5775('0x5'));var rimraf=require(_0x5775('0x6'));var config=require('../../config/environment');var attributes=require(_0x5775('0x7'));module[_0x5775('0x8')]=function(_0x3d4d7c,_0x2ed226){return _0x3d4d7c[_0x5775('0x9')](_0x5775('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd92d=['define','ReportAgentPreview','report_agent_preview','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1b1820,_0x1b6186){var _0x41b59b=function(_0x4fed7b){while(--_0x4fed7b){_0x1b1820['push'](_0x1b1820['shift']());}};_0x41b59b(++_0x1b6186);}(_0xd92d,0x123));var _0xdd92=function(_0x5bce14,_0x46fd0b){_0x5bce14=_0x5bce14-0x0;var _0x276eff=_0xd92d[_0x5bce14];return _0x276eff;};'use strict';var _=require('lodash');var util=require(_0xdd92('0x0'));var logger=require('../../config/logger')(_0xdd92('0x1'));var moment=require(_0xdd92('0x2'));var BPromise=require(_0xdd92('0x3'));var rp=require(_0xdd92('0x4'));var fs=require('fs');var path=require(_0xdd92('0x5'));var rimraf=require(_0xdd92('0x6'));var config=require(_0xdd92('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0xdd92('0x8')]=function(_0x142366,_0x11d720){return _0x142366[_0xdd92('0x9')](_0xdd92('0xa'),attributes,{'tableName':_0xdd92('0xb'),'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 15cf445..14b271e 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 _0x94b7=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent'];(function(_0x17aa0c,_0x252084){var _0xd0e05f=function(_0x1c896c){while(--_0x1c896c){_0x17aa0c['push'](_0x17aa0c['shift']());}};_0xd0e05f(++_0x252084);}(_0x94b7,0x126));var _0x794b=function(_0x107010,_0x2595a8){_0x107010=_0x107010-0x0;var _0x57ca85=_0x94b7[_0x107010];return _0x57ca85;};'use strict';var _=require(_0x794b('0x0'));var util=require('util');var moment=require(_0x794b('0x1'));var BPromise=require(_0x794b('0x2'));var rs=require(_0x794b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x794b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x794b('0x5'))(_0x794b('0x6'));var config=require(_0x794b('0x7'));var jayson=require(_0x794b('0x8'));var client=jayson[_0x794b('0x9')][_0x794b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51b383,_0x542469,_0xda8c3e){return new BPromise(function(_0x443b6a,_0xd4096b){return client[_0x794b('0xb')](_0x51b383,_0xda8c3e)['then'](function(_0x5fedd1){logger['info'](_0x794b('0xc'),_0x542469,_0x794b('0xd'));logger[_0x794b('0xe')](_0x794b('0xf'),_0x542469,_0x794b('0xd'),JSON[_0x794b('0x10')](_0x5fedd1));if(_0x5fedd1[_0x794b('0x11')]){if(_0x5fedd1[_0x794b('0x11')][_0x794b('0x12')]===0x1f4){logger['error'](_0x794b('0xc'),_0x542469,_0x5fedd1['error'][_0x794b('0x13')]);return _0xd4096b(_0x5fedd1[_0x794b('0x11')][_0x794b('0x13')]);}logger[_0x794b('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x542469,_0x5fedd1[_0x794b('0x11')][_0x794b('0x13')]);return _0x443b6a(_0x5fedd1[_0x794b('0x11')][_0x794b('0x13')]);}else{logger[_0x794b('0x14')](_0x794b('0xc'),_0x542469,_0x794b('0xd'));_0x443b6a(_0x5fedd1[_0x794b('0x15')]['message']);}})[_0x794b('0x16')](function(_0x1c56ae){logger['error'](_0x794b('0xc'),_0x542469,_0x1c56ae);_0xd4096b(_0x1c56ae);});});}exports[_0x794b('0x17')]=function(_0x53fd57){var _0x4febfa=this;return new Promise(function(_0x2f65c5,_0xd07c9b){return db[_0x794b('0x18')][_0x794b('0x19')](_0x53fd57['body'],{'raw':_0x53fd57['options']?_0x53fd57['options'][_0x794b('0x1a')]===undefined?!![]:![]:!![]})[_0x794b('0x1b')](function(_0x15cc01){logger[_0x794b('0x14')](_0x794b('0x17'),_0x53fd57);logger[_0x794b('0xe')]('CreateReportAgentPreview',_0x53fd57,JSON[_0x794b('0x10')](_0x15cc01));_0x2f65c5(_0x15cc01);})[_0x794b('0x16')](function(_0xaee23e){logger[_0x794b('0x11')](_0x794b('0x17'),_0xaee23e[_0x794b('0x13')],_0x53fd57);_0xd07c9b(_0x4febfa[_0x794b('0x11')](0x1f4,_0xaee23e[_0x794b('0x13')]));});});}; \ No newline at end of file +var _0x11a9=['../../config/environment','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x2e8fcb,_0xf390de){var _0x2dff7f=function(_0x457bf2){while(--_0x457bf2){_0x2e8fcb['push'](_0x2e8fcb['shift']());}};_0x2dff7f(++_0xf390de);}(_0x11a9,0xe2));var _0x911a=function(_0x387125,_0x1a816a){_0x387125=_0x387125-0x0;var _0x46ecd3=_0x11a9[_0x387125];return _0x46ecd3;};'use strict';var _=require(_0x911a('0x0'));var util=require(_0x911a('0x1'));var moment=require(_0x911a('0x2'));var BPromise=require(_0x911a('0x3'));var rs=require(_0x911a('0x4'));var fs=require('fs');var Redis=require(_0x911a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x911a('0x6'))(_0x911a('0x7'));var config=require(_0x911a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x911a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cd9ae,_0x35aad7,_0x49f405){return new BPromise(function(_0x5590e2,_0x5aa32e){return client[_0x911a('0xa')](_0x5cd9ae,_0x49f405)[_0x911a('0xb')](function(_0x89fc3){logger[_0x911a('0xc')](_0x911a('0xd'),_0x35aad7,_0x911a('0xe'));logger[_0x911a('0xf')](_0x911a('0x10'),_0x35aad7,_0x911a('0xe'),JSON[_0x911a('0x11')](_0x89fc3));if(_0x89fc3[_0x911a('0x12')]){if(_0x89fc3[_0x911a('0x12')]['code']===0x1f4){logger[_0x911a('0x12')](_0x911a('0xd'),_0x35aad7,_0x89fc3[_0x911a('0x12')][_0x911a('0x13')]);return _0x5aa32e(_0x89fc3[_0x911a('0x12')][_0x911a('0x13')]);}logger[_0x911a('0x12')](_0x911a('0xd'),_0x35aad7,_0x89fc3[_0x911a('0x12')][_0x911a('0x13')]);return _0x5590e2(_0x89fc3[_0x911a('0x12')]['message']);}else{logger[_0x911a('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x35aad7,_0x911a('0xe'));_0x5590e2(_0x89fc3[_0x911a('0x14')]['message']);}})[_0x911a('0x15')](function(_0x14c800){logger[_0x911a('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x35aad7,_0x14c800);_0x5aa32e(_0x14c800);});});}exports[_0x911a('0x16')]=function(_0x55c278){var _0x4c5130=this;return new Promise(function(_0x145bef,_0x4ac1f3){return db[_0x911a('0x17')][_0x911a('0x18')](_0x55c278['body'],{'raw':_0x55c278['options']?_0x55c278[_0x911a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x911a('0xb')](function(_0x217b39){logger[_0x911a('0xc')](_0x911a('0x16'),_0x55c278);logger[_0x911a('0xf')](_0x911a('0x16'),_0x55c278,JSON[_0x911a('0x11')](_0x217b39));_0x145bef(_0x217b39);})[_0x911a('0x15')](function(_0x439891){logger[_0x911a('0x12')](_0x911a('0x16'),_0x439891[_0x911a('0x13')],_0x55c278);_0x4ac1f3(_0x4c5130[_0x911a('0x12')](0x1f4,_0x439891['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index eac392f..8deaa5f 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 _0x5b01=['agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents'];(function(_0x3e436c,_0xebf949){var _0x3e4924=function(_0xab2179){while(--_0xab2179){_0x3e436c['push'](_0x3e436c['shift']());}};_0x3e4924(++_0xebf949);}(_0x5b01,0x176));var _0x15b0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5b01[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x15b0('0x0'));var util=require(_0x15b0('0x1'));var path=require(_0x15b0('0x2'));var express=require(_0x15b0('0x3'));var router=express[_0x15b0('0x4')]();var auth=require(_0x15b0('0x5'));var controller=require(_0x15b0('0x6'));router[_0x15b0('0x7')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router[_0x15b0('0x7')](_0x15b0('0x8'),auth[_0x15b0('0x9')](),controller[_0x15b0('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x15b0('0x9')](),controller[_0x15b0('0xb')]);router[_0x15b0('0x7')](_0x15b0('0xc'),auth[_0x15b0('0x9')](),controller[_0x15b0('0xd')]);router[_0x15b0('0x7')](_0x15b0('0xe'),auth[_0x15b0('0x9')](),controller[_0x15b0('0xf')]);router[_0x15b0('0x7')]('/mail/queues',auth[_0x15b0('0x9')](),controller['mailQueues']);router['get'](_0x15b0('0x10'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x11')]);router['get'](_0x15b0('0x12'),auth[_0x15b0('0x9')](),controller['openchannelQueues']);router['get'](_0x15b0('0x13'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x14')]);router[_0x15b0('0x7')](_0x15b0('0x15'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x16')]);router[_0x15b0('0x7')](_0x15b0('0x17'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x18')]);router['get'](_0x15b0('0x19'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x1a')]);router[_0x15b0('0x7')](_0x15b0('0x1b'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x1c')]);router[_0x15b0('0x7')](_0x15b0('0x1d'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x1e')]);router[_0x15b0('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x15b0('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0x15b0('0x1f'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x20')]);router[_0x15b0('0x7')](_0x15b0('0x21'),auth['isAuthenticated'](),controller[_0x15b0('0x22')]);router['put'](_0x15b0('0x21'),auth['isAuthenticated'](),controller[_0x15b0('0x23')]);router[_0x15b0('0x7')](_0x15b0('0x24'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x25')]);router[_0x15b0('0x7')](_0x15b0('0x26'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x27')]);router['get'](_0x15b0('0x28'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x29')]);router[_0x15b0('0x2a')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x15b0('0x2b')]);router[_0x15b0('0x7')](_0x15b0('0x2c'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x2d')]);router[_0x15b0('0x7')](_0x15b0('0x2e'),auth['isAuthenticated'](),controller[_0x15b0('0x2f')]);router[_0x15b0('0x7')](_0x15b0('0x30'),auth['isAuthenticated'](),controller['campaigns']);router[_0x15b0('0x7')](_0x15b0('0x31'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x32')]);router[_0x15b0('0x7')](_0x15b0('0x33'),auth[_0x15b0('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x15b0('0x7')](_0x15b0('0x34'),auth[_0x15b0('0x9')](),controller['mailQueuesWaitingInteractions']);router['get']('/openchannel/queues/waitinginteractions',auth[_0x15b0('0x9')](),controller[_0x15b0('0x35')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x15b0('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x15b0('0x7')](_0x15b0('0x36'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x37')]);router[_0x15b0('0x7')](_0x15b0('0x38'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x39')]);router[_0x15b0('0x7')]('/fax/queues/waitinginteractions',auth[_0x15b0('0x9')](),controller[_0x15b0('0x3a')]);router[_0x15b0('0x3b')](_0x15b0('0x3c'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x3d')](_0x15b0('0x3e')));router[_0x15b0('0x7')]('/mail/queues/:id',auth[_0x15b0('0x9')](),controller[_0x15b0('0x3f')]);router['post'](_0x15b0('0x40'),auth[_0x15b0('0x9')](),controller['queueNotify'](_0x15b0('0x41')));router[_0x15b0('0x7')](_0x15b0('0x42'),auth['isAuthenticated'](),controller[_0x15b0('0x43')]);router[_0x15b0('0x3b')](_0x15b0('0x44'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x3d')]('fax'));router[_0x15b0('0x7')]('/fax/queues/:id',auth[_0x15b0('0x9')](),controller[_0x15b0('0x45')]);router[_0x15b0('0x3b')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x15b0('0x3d')](_0x15b0('0x46')));router[_0x15b0('0x7')](_0x15b0('0x47'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x48')]);router[_0x15b0('0x3b')](_0x15b0('0x49'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x3d')]('sms'));router['post'](_0x15b0('0x4a'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x3d')](_0x15b0('0x4b')));router[_0x15b0('0x7')](_0x15b0('0x4c'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x4d')]);router[_0x15b0('0x7')](_0x15b0('0x4e'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x4f')]);router[_0x15b0('0x3b')](_0x15b0('0x50'),auth[_0x15b0('0x9')](),controller[_0x15b0('0x51')]);module[_0x15b0('0x52')]=router; \ No newline at end of file +var _0x562f=['/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','agentCapacity','/telephones','/trunks','trunks','/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail'];(function(_0x5a5322,_0x1d8e4d){var _0x3541db=function(_0x134246){while(--_0x134246){_0x5a5322['push'](_0x5a5322['shift']());}};_0x3541db(++_0x1d8e4d);}(_0x562f,0x10b));var _0xf562=function(_0x36a073,_0x2ce3ce){_0x36a073=_0x36a073-0x0;var _0xc9762b=_0x562f[_0x36a073];return _0xc9762b;};'use strict';var multer=require(_0xf562('0x0'));var util=require(_0xf562('0x1'));var path=require(_0xf562('0x2'));var express=require(_0xf562('0x3'));var router=express[_0xf562('0x4')]();var auth=require(_0xf562('0x5'));var controller=require(_0xf562('0x6'));router[_0xf562('0x7')]('/voice/channels',auth[_0xf562('0x8')](),controller[_0xf562('0x9')]);router[_0xf562('0x7')](_0xf562('0xa'),auth[_0xf562('0x8')](),controller[_0xf562('0xb')]);router[_0xf562('0x7')](_0xf562('0xc'),auth[_0xf562('0x8')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xf562('0xd'),auth['isAuthenticated'](),controller[_0xf562('0xe')]);router[_0xf562('0x7')]('/chat/queues',auth['isAuthenticated'](),controller[_0xf562('0xf')]);router[_0xf562('0x7')](_0xf562('0x10'),auth[_0xf562('0x8')](),controller[_0xf562('0x11')]);router[_0xf562('0x7')]('/mail/accounts',auth[_0xf562('0x8')](),controller[_0xf562('0x12')]);router[_0xf562('0x7')](_0xf562('0x13'),auth['isAuthenticated'](),controller[_0xf562('0x14')]);router['get']('/sms/queues',auth[_0xf562('0x8')](),controller['smsQueues']);router[_0xf562('0x7')](_0xf562('0x15'),auth[_0xf562('0x8')](),controller['whatsappQueues']);router[_0xf562('0x7')](_0xf562('0x16'),auth[_0xf562('0x8')](),controller[_0xf562('0x17')]);router['get'](_0xf562('0x18'),auth[_0xf562('0x8')](),controller[_0xf562('0x19')]);router[_0xf562('0x7')]('/voice/queues/channels',auth[_0xf562('0x8')](),controller[_0xf562('0x1a')]);router[_0xf562('0x7')](_0xf562('0x1b'),auth[_0xf562('0x8')](),controller['voiceQueuesChannel']);router[_0xf562('0x7')](_0xf562('0x1c'),auth[_0xf562('0x8')](),controller[_0xf562('0x1d')]);router[_0xf562('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0xf562('0x1e')]);router[_0xf562('0x7')](_0xf562('0x1f'),auth[_0xf562('0x8')](),controller[_0xf562('0x20')]);router[_0xf562('0x21')](_0xf562('0x1f'),auth[_0xf562('0x8')](),controller[_0xf562('0x22')]);router[_0xf562('0x7')](_0xf562('0x23'),auth[_0xf562('0x8')](),controller[_0xf562('0x24')]);router[_0xf562('0x7')](_0xf562('0x25'),auth[_0xf562('0x8')](),controller['outboundChannels']);router[_0xf562('0x7')](_0xf562('0x26'),auth[_0xf562('0x8')](),controller[_0xf562('0x27')]);router[_0xf562('0x21')]('/agents/:id/capacity',auth[_0xf562('0x8')](),controller[_0xf562('0x28')]);router[_0xf562('0x7')](_0xf562('0x29'),auth['isAuthenticated'](),controller['telephones']);router[_0xf562('0x7')](_0xf562('0x2a'),auth['isAuthenticated'](),controller[_0xf562('0x2b')]);router[_0xf562('0x7')]('/campaigns',auth['isAuthenticated'](),controller['campaigns']);router[_0xf562('0x7')](_0xf562('0x2c'),auth['isAuthenticated'](),controller[_0xf562('0x2d')]);router[_0xf562('0x7')]('/chat/queues/waitinginteractions',auth[_0xf562('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xf562('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf562('0x2e')]);router[_0xf562('0x7')](_0xf562('0x2f'),auth[_0xf562('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xf562('0x7')](_0xf562('0x30'),auth[_0xf562('0x8')](),controller[_0xf562('0x31')]);router[_0xf562('0x7')]('/sms/queues/waitinginteractions',auth[_0xf562('0x8')](),controller[_0xf562('0x32')]);router[_0xf562('0x7')](_0xf562('0x33'),auth[_0xf562('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0xf562('0x7')](_0xf562('0x34'),auth[_0xf562('0x8')](),controller[_0xf562('0x35')]);router['post'](_0xf562('0x36'),auth[_0xf562('0x8')](),controller[_0xf562('0x37')](_0xf562('0x38')));router[_0xf562('0x7')](_0xf562('0x39'),auth[_0xf562('0x8')](),controller[_0xf562('0x3a')]);router[_0xf562('0x3b')](_0xf562('0x3c'),auth[_0xf562('0x8')](),controller[_0xf562('0x37')](_0xf562('0x3d')));router[_0xf562('0x7')](_0xf562('0x3e'),auth[_0xf562('0x8')](),controller[_0xf562('0x3f')]);router[_0xf562('0x3b')](_0xf562('0x40'),auth['isAuthenticated'](),controller[_0xf562('0x37')](_0xf562('0x41')));router['get'](_0xf562('0x42'),auth[_0xf562('0x8')](),controller[_0xf562('0x43')]);router[_0xf562('0x3b')](_0xf562('0x44'),auth[_0xf562('0x8')](),controller[_0xf562('0x37')](_0xf562('0x45')));router[_0xf562('0x7')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xf562('0x46')]);router[_0xf562('0x3b')](_0xf562('0x47'),auth[_0xf562('0x8')](),controller[_0xf562('0x37')](_0xf562('0x48')));router['post'](_0xf562('0x49'),auth[_0xf562('0x8')](),controller['queueNotify'](_0xf562('0x4a')));router[_0xf562('0x7')]('/sms/queues/:id',auth[_0xf562('0x8')](),controller[_0xf562('0x4b')]);router[_0xf562('0x7')](_0xf562('0x4c'),auth[_0xf562('0x8')](),controller[_0xf562('0x4d')]);router['post'](_0xf562('0x4e'),auth[_0xf562('0x8')](),controller[_0xf562('0x4f')]);module[_0xf562('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index eed2340..273e1c9 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 _0x8958=['faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','agentNotify','channel','Agent\x20not\x20found','Message','Start','agentTransferTimeout','*,*,*,*','moment','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','interaction','MemberReport','findAll','user','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions'];(function(_0x32e602,_0x29d37f){var _0x39208e=function(_0x571730){while(--_0x571730){_0x32e602['push'](_0x32e602['shift']());}};_0x39208e(++_0x29d37f);}(_0x8958,0x93));var _0x8895=function(_0x5591cf,_0x50274f){_0x5591cf=_0x5591cf-0x0;var _0x2882ec=_0x8958[_0x5591cf];return _0x2882ec;};'use strict';var BPromise=require('bluebird');var moment=require(_0x8895('0x0'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8895('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232a});var mailClient=jayson[_0x8895('0x2')]['http']({'port':0x232b});var routingClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232c});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){var _0xc2be9f=_0x33013a?_0x33013a:amiClient;return _0xc2be9f[_0x8895('0x4')](_0x124e1e,_0x40cec6)[_0x8895('0x5')](function(_0x6eab1e){if(_0x6eab1e[_0x8895('0x6')]){if(_0x6eab1e[_0x8895('0x6')][_0x8895('0x7')]===0x1f4){return _0xe018b8(_0x6eab1e[_0x8895('0x6')][_0x8895('0x8')]);}return _0x51376b(_0x6eab1e['error'][_0x8895('0x8')]);}else{_0x51376b(_0x6eab1e[_0x8895('0x9')]);}})[_0x8895('0xa')](function(_0x301bec){_0xe018b8(_0x301bec);});});}function respondWithResult(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xc8;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0xb')](_0xaf93bc)[_0x8895('0xc')](_0x5af0ef);}return _0x446e1a[_0x8895('0xd')](0x194);};}function handleError(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0x1f4;return function(_0x9191b8){logger['error'](_0x9191b8[_0x8895('0xe')]);if(_0x9191b8[_0x8895('0xf')]){delete _0x9191b8[_0x8895('0xf')];}_0x57d40a[_0x8895('0xb')](_0x47b9fe)[_0x8895('0x10')](_0x9191b8);};}function findById(_0x5b4c2e){return function(_0x4128e2){if(!_[_0x8895('0x11')](_0x5b4c2e)&&!_[_0x8895('0x11')](_0x4128e2)&&!_[_0x8895('0x11')](_0x4128e2[_0x8895('0x12')])){return _[_0x8895('0x13')](_0x4128e2[_0x8895('0x12')],function(_0x26cee0){return _0x26cee0['id']==_0x5b4c2e;});}return null;};}exports[_0x8895('0x14')]=function(_0x2da618,_0x24fef0){return respondWithRpcPromise(_0x8895('0x15'),_0x2da618[_0x8895('0x16')])['then'](respondWithResult(_0x24fef0,null))['catch'](handleError(_0x24fef0,null));};exports['voiceChannelMixMonitor']=function(_0x3daf43,_0x456282){return respondWithRpcPromise(_0x8895('0x17'),_[_0x8895('0x18')](_0x3daf43[_0x8895('0x16')],_0x3daf43[_0x8895('0x19')]))[_0x8895('0x5')](respondWithResult(_0x456282,null))[_0x8895('0xa')](handleError(_0x456282,null));};exports['voiceChannelStopMixMonitor']=function(_0x1a4c5b,_0x5db3a0){return respondWithRpcPromise(_0x8895('0x1a'),_[_0x8895('0x18')](_0x1a4c5b[_0x8895('0x16')],_0x1a4c5b['params']))['then'](respondWithResult(_0x5db3a0,null))[_0x8895('0xa')](handleError(_0x5db3a0,null));};exports[_0x8895('0x1b')]=function(_0x38f7ad,_0x24a376){return respondWithRpcPromise('VoiceQueues',_0x38f7ad[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x24a376,null))[_0x8895('0xa')](handleError(_0x24a376,null));};exports['showVoiceQueues']=function(_0x4aee03,_0x78b57){return respondWithRpcPromise('VoiceQueues',_0x4aee03[_0x8895('0x16')])[_0x8895('0x5')](findById(_0x4aee03[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x78b57,null))[_0x8895('0xa')](handleError(_0x78b57,null));};exports['updateVoiceQueue']=function(_0x4d567a,_0x6e449d){return respondWithRpcPromise(_0x8895('0x1c'),_[_0x8895('0x18')](_0x4d567a[_0x8895('0x1d')],_0x4d567a[_0x8895('0x19')]))['then'](respondWithResult(_0x6e449d,null))['catch'](handleError(_0x6e449d,null));};exports[_0x8895('0x1e')]=function(_0x848a11,_0x1c16f6){return respondWithRpcPromise(_0x8895('0x1f'),_[_0x8895('0x18')](_0x848a11['query'],_0x848a11[_0x8895('0x19')]))['then'](respondWithResult(_0x1c16f6,null))[_0x8895('0xa')](handleError(_0x1c16f6,null));};exports['voiceQueuesChannels']=function(_0x40ba14,_0x1a3fe5){return respondWithRpcPromise(_0x8895('0x20'),_0x40ba14[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1a3fe5,null))['catch'](handleError(_0x1a3fe5,null));};exports[_0x8895('0x21')]=function(_0xcba076,_0x1b5359){return respondWithRpcPromise(_0x8895('0x22'),_[_0x8895('0x18')](_0xcba076['query'],_0xcba076[_0x8895('0x19')]))['then'](respondWithResult(_0x1b5359,null))[_0x8895('0xa')](handleError(_0x1b5359,null));};exports['voiceQueuesChannelHangup']=function(_0x21c22b,_0x15a865){return respondWithRpcPromise(_0x8895('0x23'),_[_0x8895('0x18')](_0x21c22b[_0x8895('0x16')],_0x21c22b['params']))[_0x8895('0x5')](respondWithResult(_0x15a865,null))['catch'](handleError(_0x15a865,null));};exports[_0x8895('0x24')]=function(_0xcc735f,_0x36e13b){return respondWithRpcPromise(_0x8895('0x25'),_[_0x8895('0x18')](_0xcc735f[_0x8895('0x16')],_0xcc735f['params']))[_0x8895('0x5')](respondWithResult(_0x36e13b,null))[_0x8895('0xa')](handleError(_0x36e13b,null));};exports['outbound']=function(_0x2557fc,_0x54ca09){return respondWithRpcPromise(_0x8895('0x26'),_0x2557fc[_0x8895('0x16')])['then'](respondWithResult(_0x54ca09,null))[_0x8895('0xa')](handleError(_0x54ca09,null));};exports[_0x8895('0x27')]=function(_0x5b7204,_0x58751a){return respondWithRpcPromise(_0x8895('0x28'),_0x5b7204[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x58751a,null))[_0x8895('0xa')](handleError(_0x58751a,null));};exports[_0x8895('0x29')]=function(_0x4917d1,_0x42ed1f){var _0x25c854;return respondWithRpcPromise(_0x8895('0x2a'),_0x4917d1[_0x8895('0x16')])[_0x8895('0x5')](function(_0x534876){_0x25c854=_0x534876;return respondWithRpcPromise('Agents',_0x4917d1[_0x8895('0x16')],routingClient);})['then'](function(_0x20a521){return _[_0x8895('0x18')]({},_0x20a521,_0x25c854);})['then'](respondWithResult(_0x42ed1f,null))[_0x8895('0xa')](handleError(_0x42ed1f,null));};exports['agentCapacity']=function(_0x1e6395,_0x5e6413){if(_0x1e6395['body']&&_0x1e6395['body']['interaction']&&_0x1e6395['user']&&_0x1e6395['user'][_0x8895('0xf')]){for(var _0x206f57 in _0x1e6395['body']['interaction']){if(_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')]['hasOwnProperty'](_0x206f57)){db[_0x8895('0x2c')][_0x8895('0x2d')]({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')],'type':_0x8895('0x2f'),'exitAt':null,'uniqueid':_0x1e6395['body']['interaction'][_0x206f57]&&_0x1e6395['body'][_0x8895('0x2b')][_0x206f57]['length']?{'$notIn':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57]}:{'$ne':null}}})[_0x8895('0x5')](function(_0x28aaa9){var _0x587ccb=moment()[_0x8895('0x30')](_0x8895('0x31'));for(var _0x3413cd=0x0,_0x167302=_0x28aaa9[_0x8895('0x32')];_0x3413cd<_0x167302;_0x3413cd+=0x1){_0x28aaa9[_0x3413cd][_0x8895('0x33')]({'exitAt':_0x587ccb});}});for(var _0x14295a=0x0;_0x14295a<_0x1e6395[_0x8895('0x1d')]['interaction'][_0x206f57][_0x8895('0x32')];_0x14295a+=0x1){db[_0x8895('0x2c')]['findOrCreate']({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'type':'INTERACTION','uniqueid':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57][_0x14295a],'exitAt':null},'defaults':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'interface':_[_0x8895('0x11')](_0x1e6395['user'][_0x8895('0x34')])?util[_0x8895('0x30')](_0x8895('0x35'),_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')]):_0x1e6395[_0x8895('0x2e')][_0x8895('0x34')],'type':'INTERACTION','enterAt':moment()['format'](_0x8895('0x31')),'role':_0x8895('0x36'),'internal':_0x1e6395['user'][_0x8895('0x37')],'uniqueid':_0x1e6395['body']['interaction'][_0x206f57][_0x14295a]}});}}}}return respondWithRpcPromise(_0x8895('0x38'),{'id':_0x1e6395['params']['id'],'capacity':_0x1e6395[_0x8895('0x1d')][_0x8895('0x39')]},routingClient)[_0x8895('0x5')](respondWithResult(_0x5e6413,null))[_0x8895('0xa')](handleError(_0x5e6413,null));};exports[_0x8895('0x3a')]=function(_0x39a1d9,_0x306481){return respondWithRpcPromise(_0x8895('0x3b'),_0x39a1d9['query'])[_0x8895('0x5')](respondWithResult(_0x306481,null))[_0x8895('0xa')](handleError(_0x306481,null));};exports[_0x8895('0x3c')]=function(_0x5a5bc6,_0x1935aa){return respondWithRpcPromise(_0x8895('0x3d'),_0x5a5bc6[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1935aa,null))[_0x8895('0xa')](handleError(_0x1935aa,null));};exports[_0x8895('0x3e')]=function(_0x434ab8,_0x216e6e){return respondWithRpcPromise(_0x8895('0x3f'),_0x434ab8[_0x8895('0x16')])['then'](respondWithResult(_0x216e6e,null))[_0x8895('0xa')](handleError(_0x216e6e,null));};exports[_0x8895('0x40')]=function(_0xb3d1ab,_0x10560a){return respondWithRpcPromise(_0x8895('0x41'),_0xb3d1ab['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x10560a,null))[_0x8895('0xa')](handleError(_0x10560a,null));};exports[_0x8895('0x42')]=function(_0x3d17bd,_0x37a7b4){return respondWithRpcPromise('ChatQueues',_0x3d17bd[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x3d17bd[_0x8895('0x19')]['id']))['then'](respondWithResult(_0x37a7b4,null))[_0x8895('0xa')](handleError(_0x37a7b4,null));};exports[_0x8895('0x43')]=function(_0x2c777b,_0x4ec8eb){return respondWithRpcPromise(_0x8895('0x44'),_0x2c777b[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x4ec8eb,null))[_0x8895('0xa')](handleError(_0x4ec8eb,null));};exports[_0x8895('0x45')]=function(_0x5198f8,_0x2f990a){return respondWithRpcPromise(_0x8895('0x44'),_0x5198f8[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x5198f8['params']['id']))['then'](respondWithResult(_0x2f990a,null))[_0x8895('0xa')](handleError(_0x2f990a,null));};exports[_0x8895('0x46')]=function(_0x49877,_0x51eb9c){return respondWithRpcPromise(_0x8895('0x47'),_0x49877[_0x8895('0x16')],mailClient)['then'](respondWithResult(_0x51eb9c,null))[_0x8895('0xa')](handleError(_0x51eb9c,null));};exports['openchannelQueues']=function(_0x435e36,_0x2bd955){return respondWithRpcPromise(_0x8895('0x48'),_0x435e36[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x2bd955,null))['catch'](handleError(_0x2bd955,null));};exports['showOpenchannelQueues']=function(_0x239401,_0x216abb){return respondWithRpcPromise('OpenchannelQueues',_0x239401[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x239401[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x216abb,null))['catch'](handleError(_0x216abb,null));};exports[_0x8895('0x49')]=function(_0x2d2bf9,_0x1b1bc0){return respondWithRpcPromise(_0x8895('0x4a'),_0x2d2bf9[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x1b1bc0,null))[_0x8895('0xa')](handleError(_0x1b1bc0,null));};exports[_0x8895('0x4b')]=function(_0x2bffd7,_0x21c7bb){return respondWithRpcPromise(_0x8895('0x4a'),_0x2bffd7[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x2bffd7[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x21c7bb,null))['catch'](handleError(_0x21c7bb,null));};exports['whatsappQueues']=function(_0x5b96fe,_0x13b143){return respondWithRpcPromise(_0x8895('0x4c'),_0x5b96fe[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x13b143,null))[_0x8895('0xa')](handleError(_0x13b143,null));};exports['showWhatsappQueues']=function(_0x816803,_0xc6af80){return respondWithRpcPromise('WhatsappQueues',_0x816803[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x816803[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0xc6af80,null))[_0x8895('0xa')](handleError(_0xc6af80,null));};exports['faxQueues']=function(_0x6440ea,_0x3c318c){return respondWithRpcPromise(_0x8895('0x4d'),_0x6440ea[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x3c318c,null))[_0x8895('0xa')](handleError(_0x3c318c,null));};exports[_0x8895('0x4e')]=function(_0x5e7048,_0x10d395){return respondWithRpcPromise(_0x8895('0x4d'),_0x5e7048['query'],routingClient)[_0x8895('0x5')](findById(_0x5e7048[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x10d395,null))[_0x8895('0xa')](handleError(_0x10d395,null));};exports[_0x8895('0x4f')]=function(_0x560381,_0x16cd17){return respondWithRpcPromise('FaxAccounts',_0x560381[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x16cd17,null))['catch'](handleError(_0x16cd17,null));};exports[_0x8895('0x50')]=function(_0x24f1c5,_0x140b2a){return respondWithRpcPromise(_0x8895('0x51'),_0x24f1c5['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x140b2a,null))['catch'](handleError(_0x140b2a,null));};exports['mailQueuesWaitingInteractions']=function(_0x1a198d,_0x185351){return respondWithRpcPromise(_0x8895('0x52'),_0x1a198d['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x185351,null))['catch'](handleError(_0x185351,null));};exports[_0x8895('0x53')]=function(_0x930a13,_0x3893fb){return respondWithRpcPromise(_0x8895('0x54'),_0x930a13[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x3893fb,null))['catch'](handleError(_0x3893fb,null));};exports[_0x8895('0x55')]=function(_0x5517a2,_0x3707a6){return respondWithRpcPromise(_0x8895('0x54'),_0x5517a2['query'],routingClient)[_0x8895('0x5')](function(_0xd9637a){if(_0x5517a2[_0x8895('0x16')][_0x8895('0x56')]!==undefined){var _0x166e9a=_(_0xd9637a['rows'])[_0x8895('0x57')]([_0x5517a2['query']['type'],_0x5517a2[_0x8895('0x19')]['id']])['map'](_0x8895('0x58'))[_0x8895('0x59')]()[_0x8895('0x5a')]();return _0xd9637a[_0x8895('0x12')]['filter'](function(_0x4d802e){return _0x166e9a['indexOf'](_0x4d802e[_0x8895('0x58')])>-0x1;});}else{return _0xd9637a[_0x8895('0x12')][_0x8895('0x57')](function(_0x14fd1f){return _0x14fd1f[_0x8895('0x58')]===parseInt(_0x5517a2[_0x8895('0x19')]['id']);});}})['then'](respondWithResult(_0x3707a6,null))[_0x8895('0xa')](handleError(_0x3707a6,null));};exports[_0x8895('0x5b')]=function(_0x4deccc,_0x584a1f){return respondWithRpcPromise(_0x8895('0x5c'),_0x4deccc['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x584a1f,null))['catch'](handleError(_0x584a1f,null));};exports[_0x8895('0x5d')]=function(_0x452756,_0x553437){return respondWithRpcPromise(_0x8895('0x5e'),_0x452756[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x553437,null))[_0x8895('0xa')](handleError(_0x553437,null));};exports[_0x8895('0x5f')]=function(_0x2af98f,_0xef59db){return respondWithRpcPromise(_0x8895('0x60'),_0x2af98f[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0xef59db,null))['catch'](handleError(_0xef59db,null));};exports[_0x8895('0x61')]=function(_0x5ada19){return function(_0x330506,_0x1f583a){var _0x32d52c,_0x325597;var _0x4e6691=_[_0x8895('0x62')](_0x5ada19);var _0x1d50f6=_0x5ada19===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db[_0x4e6691+_0x8895('0x66')][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x330506[_0x8895('0x19')]['id']}})['then'](function(_0x3b4092){if(_[_0x8895('0x11')](_0x3b4092)){throw new Error(_0x4e6691+'\x20Queue\x20not\x20found');}_0x32d52c=_0x3b4092;return db[_0x4e6691+'Message'][_0x8895('0x67')]({'where':{'id':_0x330506[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x4e6691+_0x8895('0x69')],'as':'Interaction'},{'model':db[_0x4e6691+_0x1d50f6],'as':'Account'}]});})[_0x8895('0x5')](function(_0x42ebe2){if(_[_0x8895('0x11')](_0x42ebe2)){throw new Error(_0x4e6691+_0x8895('0x6a'));}_0x325597=_0x42ebe2;return _0x42ebe2[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2cd8b0={'uniqueid':_0x5ada19+'.'+_0x325597['id']+'.'+_0x325597[_0x8895('0x69')]['id'],'FromUserId':_0x330506['user']['id'],'type':_0x8895('0x6c')};_0x2cd8b0[_0x4e6691+_0x8895('0x6d')]=_0x325597['id'];_0x2cd8b0[_0x4e6691+_0x8895('0x6e')]=_0x325597[_0x8895('0x69')]['id'];_0x2cd8b0[_0x8895('0x6f')+_0x4e6691+_0x1d50f6+'Id']=_0x325597[_0x8895('0x65')]['id'];_0x2cd8b0['To'+_0x4e6691+'QueueId']=_0x32d52c['id'];return db[_0x4e6691+_0x8895('0x70')][_0x8895('0x71')](_0x2cd8b0);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5ada19,'interaction':_0x325597['Interaction'],'message':_0x325597,'account':_0x325597[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8895('0x6c'),'appdata':_0x32d52c['name']+','+(_0x325597[_0x8895('0x65')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1f583a,null))[_0x8895('0xa')](handleError(_0x1f583a,null));};};exports[_0x8895('0x72')]=function(_0x28d7ab,_0x20b607){var _0x605f47,_0x54cf18;if(_[_0x8895('0x11')](_0x28d7ab[_0x8895('0x1d')][_0x8895('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4a4d4b=_0x28d7ab['body'][_0x8895('0x73')];var _0x1d796a=_[_0x8895('0x62')](_0x4a4d4b);var _0x2084b1=_0x4a4d4b===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db['User'][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x28d7ab['params']['id'],'role':_0x8895('0x36')}})['then'](function(_0x2f2908){if(_[_0x8895('0x11')](_0x2f2908)){throw new Error(_0x8895('0x74'));}_0x605f47=_0x2f2908;return db[_0x1d796a+_0x8895('0x75')][_0x8895('0x67')]({'where':{'id':_0x28d7ab[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x1d796a+'Interaction'],'as':_0x8895('0x69')},{'model':db[_0x1d796a+_0x2084b1],'as':_0x8895('0x65')}]});})[_0x8895('0x5')](function(_0x3ce240){if(_[_0x8895('0x11')](_0x3ce240)){throw new Error(_0x1d796a+'\x20Message\x20not\x20found');}_0x54cf18=_0x3ce240;return _0x3ce240[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x20f574={'uniqueid':_0x4a4d4b+'.'+_0x54cf18['id']+'.'+_0x54cf18[_0x8895('0x69')]['id'],'FromUserId':_0x28d7ab[_0x8895('0x2e')]['id'],'type':_0x8895('0x6c'),'ToUserId':_0x605f47['id']};_0x20f574[_0x1d796a+_0x8895('0x6d')]=_0x54cf18['id'];_0x20f574[_0x1d796a+_0x8895('0x6e')]=_0x54cf18[_0x8895('0x69')]['id'];_0x20f574[_0x8895('0x6f')+_0x1d796a+_0x2084b1+'Id']=_0x54cf18[_0x8895('0x65')]['id'];return db[_0x1d796a+'TransferReport'][_0x8895('0x71')](_0x20f574);})['then'](function(){return respondWithRpcPromise(_0x8895('0x76'),{'channel':_0x4a4d4b,'interaction':_0x54cf18[_0x8895('0x69')],'message':_0x54cf18,'account':_0x54cf18[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x605f47[_0x8895('0xf')]+','+(_0x54cf18['Account'][_0x8895('0x77')]||0x12c),'interval':_0x8895('0x78')}]},routingClient);})[_0x8895('0x5')](respondWithResult(_0x20b607,null))[_0x8895('0xa')](handleError(_0x20b607,null));}; \ No newline at end of file +var _0xbd51=['chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','client','http','request','error','code','message','catch','status','json','stack','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts'];(function(_0x5380cd,_0x1ea634){var _0x25dd61=function(_0x277132){while(--_0x277132){_0x5380cd['push'](_0x5380cd['shift']());}};_0x25dd61(++_0x1ea634);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2ce2d8,_0x565df7){_0x2ce2d8=_0x2ce2d8-0x0;var _0x402eb7=_0xbd51[_0x2ce2d8];return _0x402eb7;};'use strict';var BPromise=require(_0x1bd5('0x0'));var moment=require('moment');var _=require(_0x1bd5('0x1'));var util=require(_0x1bd5('0x2'));var db=require(_0x1bd5('0x3'))['db'];var logger=require(_0x1bd5('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x1bd5('0x5')][_0x1bd5('0x6')]({'port':0x232b});var routingClient=jayson[_0x1bd5('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){var _0x4a7f90=_0x19077c?_0x19077c:amiClient;return _0x4a7f90[_0x1bd5('0x7')](_0x29abea,_0x30a385)['then'](function(_0x2bd975){if(_0x2bd975[_0x1bd5('0x8')]){if(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0x9')]===0x1f4){return _0xd8418f(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0xa')]);}return _0x27d58f(_0x2bd975['error'][_0x1bd5('0xa')]);}else{_0x27d58f(_0x2bd975['result']);}})[_0x1bd5('0xb')](function(_0x24e38c){_0xd8418f(_0x24e38c);});});}function respondWithResult(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xc8;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0xc')](_0x14606b)[_0x1bd5('0xd')](_0x177be0);}return _0x37e8e1['sendStatus'](0x194);};}function handleError(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0x1f4;return function(_0x6d2c40){logger[_0x1bd5('0x8')](_0x6d2c40[_0x1bd5('0xe')]);if(_0x6d2c40['name']){delete _0x6d2c40['name'];}_0x5650b5[_0x1bd5('0xc')](_0x8b2390)[_0x1bd5('0xf')](_0x6d2c40);};}function findById(_0x2b2c57){return function(_0x4793dd){if(!_[_0x1bd5('0x10')](_0x2b2c57)&&!_[_0x1bd5('0x10')](_0x4793dd)&&!_[_0x1bd5('0x10')](_0x4793dd[_0x1bd5('0x11')])){return _[_0x1bd5('0x12')](_0x4793dd['rows'],function(_0x53ad5e){return _0x53ad5e['id']==_0x2b2c57;});}return null;};}exports[_0x1bd5('0x13')]=function(_0x260827,_0x476bd1){return respondWithRpcPromise(_0x1bd5('0x14'),_0x260827[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x476bd1,null))[_0x1bd5('0xb')](handleError(_0x476bd1,null));};exports[_0x1bd5('0x17')]=function(_0x456051,_0xb1ac1e){return respondWithRpcPromise(_0x1bd5('0x18'),_[_0x1bd5('0x19')](_0x456051[_0x1bd5('0x15')],_0x456051[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0xb1ac1e,null))[_0x1bd5('0xb')](handleError(_0xb1ac1e,null));};exports[_0x1bd5('0x1b')]=function(_0x29c340,_0x5567c9){return respondWithRpcPromise(_0x1bd5('0x1c'),_['merge'](_0x29c340[_0x1bd5('0x15')],_0x29c340[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x5567c9,null))['catch'](handleError(_0x5567c9,null));};exports[_0x1bd5('0x1d')]=function(_0x4fa37c,_0x2ed551){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x4fa37c[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x2ed551,null))['catch'](handleError(_0x2ed551,null));};exports[_0x1bd5('0x1f')]=function(_0x69bb17,_0x20245c){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x69bb17['query'])[_0x1bd5('0x16')](findById(_0x69bb17[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x20245c,null))[_0x1bd5('0xb')](handleError(_0x20245c,null));};exports[_0x1bd5('0x20')]=function(_0xc73670,_0x4e72b2){return respondWithRpcPromise(_0x1bd5('0x21'),_[_0x1bd5('0x19')](_0xc73670[_0x1bd5('0x22')],_0xc73670['params']))[_0x1bd5('0x16')](respondWithResult(_0x4e72b2,null))[_0x1bd5('0xb')](handleError(_0x4e72b2,null));};exports[_0x1bd5('0x23')]=function(_0x3430bf,_0x1f4456){return respondWithRpcPromise(_0x1bd5('0x24'),_['merge'](_0x3430bf['query'],_0x3430bf[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x1f4456,null))['catch'](handleError(_0x1f4456,null));};exports[_0x1bd5('0x25')]=function(_0x198b88,_0x1efa8c){return respondWithRpcPromise(_0x1bd5('0x26'),_0x198b88['query'])[_0x1bd5('0x16')](respondWithResult(_0x1efa8c,null))[_0x1bd5('0xb')](handleError(_0x1efa8c,null));};exports[_0x1bd5('0x27')]=function(_0x233743,_0x209ce1){return respondWithRpcPromise(_0x1bd5('0x28'),_[_0x1bd5('0x19')](_0x233743[_0x1bd5('0x15')],_0x233743['params']))[_0x1bd5('0x16')](respondWithResult(_0x209ce1,null))[_0x1bd5('0xb')](handleError(_0x209ce1,null));};exports[_0x1bd5('0x29')]=function(_0x24c92e,_0x11a6d2){return respondWithRpcPromise(_0x1bd5('0x2a'),_[_0x1bd5('0x19')](_0x24c92e['query'],_0x24c92e[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x11a6d2,null))[_0x1bd5('0xb')](handleError(_0x11a6d2,null));};exports[_0x1bd5('0x2b')]=function(_0x3cf898,_0x192ca7){return respondWithRpcPromise(_0x1bd5('0x2c'),_['merge'](_0x3cf898['query'],_0x3cf898[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x192ca7,null))[_0x1bd5('0xb')](handleError(_0x192ca7,null));};exports['outbound']=function(_0x4595a0,_0x5af974){return respondWithRpcPromise(_0x1bd5('0x2d'),_0x4595a0[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5af974,null))[_0x1bd5('0xb')](handleError(_0x5af974,null));};exports[_0x1bd5('0x2e')]=function(_0x2470ec,_0x41096d){return respondWithRpcPromise(_0x1bd5('0x2f'),_0x2470ec['query'])[_0x1bd5('0x16')](respondWithResult(_0x41096d,null))[_0x1bd5('0xb')](handleError(_0x41096d,null));};exports['agents']=function(_0x3b5a0d,_0x77ebcf){var _0x20b25c;return respondWithRpcPromise('Agents',_0x3b5a0d[_0x1bd5('0x15')])[_0x1bd5('0x16')](function(_0x2997a2){_0x20b25c=_0x2997a2;return respondWithRpcPromise(_0x1bd5('0x30'),_0x3b5a0d['query'],routingClient);})[_0x1bd5('0x16')](function(_0x22f437){return _[_0x1bd5('0x19')]({},_0x22f437,_0x20b25c);})[_0x1bd5('0x16')](respondWithResult(_0x77ebcf,null))['catch'](handleError(_0x77ebcf,null));};exports['agentCapacity']=function(_0x40eeff,_0x35afc7){if(_0x40eeff[_0x1bd5('0x22')]&&_0x40eeff['body'][_0x1bd5('0x31')]&&_0x40eeff[_0x1bd5('0x32')]&&_0x40eeff['user'][_0x1bd5('0x33')]){for(var _0x5761b8 in _0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')]){if(_0x40eeff['body'][_0x1bd5('0x31')][_0x1bd5('0x34')](_0x5761b8)){db[_0x1bd5('0x35')][_0x1bd5('0x36')]({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'exitAt':null,'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]&&_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x1bd5('0x38')]?{'$notIn':_0x40eeff['body'][_0x1bd5('0x31')][_0x5761b8]}:{'$ne':null}}})[_0x1bd5('0x16')](function(_0x335125){var _0x52ade4=moment()[_0x1bd5('0x39')](_0x1bd5('0x3a'));for(var _0x5bb8a6=0x0,_0x1dbde9=_0x335125['length'];_0x5bb8a6<_0x1dbde9;_0x5bb8a6+=0x1){_0x335125[_0x5bb8a6][_0x1bd5('0x3b')]({'exitAt':_0x52ade4});}});for(var _0x558fec=0x0;_0x558fec<_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]['length'];_0x558fec+=0x1){db[_0x1bd5('0x35')]['findOrCreate']({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x558fec],'exitAt':null},'defaults':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'interface':_[_0x1bd5('0x10')](_0x40eeff['user'][_0x1bd5('0x3c')])?util[_0x1bd5('0x39')](_0x1bd5('0x3d'),_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')]):_0x40eeff[_0x1bd5('0x32')]['interface'],'type':_0x1bd5('0x37'),'enterAt':moment()[_0x1bd5('0x39')](_0x1bd5('0x3a')),'role':_0x1bd5('0x3e'),'internal':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x3f')],'uniqueid':_0x40eeff[_0x1bd5('0x22')]['interaction'][_0x5761b8][_0x558fec]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x40eeff[_0x1bd5('0x1a')]['id'],'capacity':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x40')]},routingClient)['then'](respondWithResult(_0x35afc7,null))[_0x1bd5('0xb')](handleError(_0x35afc7,null));};exports[_0x1bd5('0x41')]=function(_0x1ad2ff,_0x1f2d7e){return respondWithRpcPromise(_0x1bd5('0x42'),_0x1ad2ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x1f2d7e,null))['catch'](handleError(_0x1f2d7e,null));};exports[_0x1bd5('0x43')]=function(_0x2bcd23,_0x4f2d91){return respondWithRpcPromise(_0x1bd5('0x44'),_0x2bcd23['query'])[_0x1bd5('0x16')](respondWithResult(_0x4f2d91,null))['catch'](handleError(_0x4f2d91,null));};exports[_0x1bd5('0x45')]=function(_0x555ba1,_0x5a011e){return respondWithRpcPromise(_0x1bd5('0x46'),_0x555ba1[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5a011e,null))[_0x1bd5('0xb')](handleError(_0x5a011e,null));};exports[_0x1bd5('0x47')]=function(_0x33f011,_0x35c478){return respondWithRpcPromise('ChatQueues',_0x33f011[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x35c478,null))[_0x1bd5('0xb')](handleError(_0x35c478,null));};exports[_0x1bd5('0x48')]=function(_0x2cc5ba,_0x5a8132){return respondWithRpcPromise('ChatQueues',_0x2cc5ba[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x2cc5ba[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x5a8132,null))[_0x1bd5('0xb')](handleError(_0x5a8132,null));};exports[_0x1bd5('0x49')]=function(_0x46e36c,_0x383a68){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x46e36c[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x383a68,null))[_0x1bd5('0xb')](handleError(_0x383a68,null));};exports['showMailQueues']=function(_0x2fe8f4,_0x34d93b){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x2fe8f4['query'],routingClient)[_0x1bd5('0x16')](findById(_0x2fe8f4[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x34d93b,null))['catch'](handleError(_0x34d93b,null));};exports[_0x1bd5('0x4b')]=function(_0x10103a,_0x39f973){return respondWithRpcPromise(_0x1bd5('0x4c'),_0x10103a['query'],mailClient)['then'](respondWithResult(_0x39f973,null))[_0x1bd5('0xb')](handleError(_0x39f973,null));};exports[_0x1bd5('0x4d')]=function(_0x1790af,_0x54a8c4){return respondWithRpcPromise('OpenchannelQueues',_0x1790af[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x54a8c4,null))[_0x1bd5('0xb')](handleError(_0x54a8c4,null));};exports[_0x1bd5('0x4e')]=function(_0x5068ae,_0x32f646){return respondWithRpcPromise('OpenchannelQueues',_0x5068ae[_0x1bd5('0x15')],routingClient)['then'](findById(_0x5068ae[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x32f646,null))['catch'](handleError(_0x32f646,null));};exports[_0x1bd5('0x4f')]=function(_0x19f765,_0x47ca3f){return respondWithRpcPromise('SmsQueues',_0x19f765[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x47ca3f,null))['catch'](handleError(_0x47ca3f,null));};exports[_0x1bd5('0x50')]=function(_0x40b508,_0x5da595){return respondWithRpcPromise('SmsQueues',_0x40b508[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x40b508[_0x1bd5('0x1a')]['id']))['then'](respondWithResult(_0x5da595,null))[_0x1bd5('0xb')](handleError(_0x5da595,null));};exports[_0x1bd5('0x51')]=function(_0x5c1db7,_0x4b317d){return respondWithRpcPromise(_0x1bd5('0x52'),_0x5c1db7[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x4b317d,null))[_0x1bd5('0xb')](handleError(_0x4b317d,null));};exports[_0x1bd5('0x53')]=function(_0x53c6de,_0x3827d7){return respondWithRpcPromise('WhatsappQueues',_0x53c6de[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x53c6de[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x3827d7,null))['catch'](handleError(_0x3827d7,null));};exports['faxQueues']=function(_0x3a7dd6,_0x36d62e){return respondWithRpcPromise(_0x1bd5('0x54'),_0x3a7dd6[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x36d62e,null))[_0x1bd5('0xb')](handleError(_0x36d62e,null));};exports[_0x1bd5('0x55')]=function(_0xc080d5,_0x1a35cf){return respondWithRpcPromise(_0x1bd5('0x54'),_0xc080d5[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0xc080d5[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x1a35cf,null))[_0x1bd5('0xb')](handleError(_0x1a35cf,null));};exports[_0x1bd5('0x56')]=function(_0x1b99ff,_0x195176){return respondWithRpcPromise(_0x1bd5('0x57'),_0x1b99ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x195176,null))[_0x1bd5('0xb')](handleError(_0x195176,null));};exports[_0x1bd5('0x58')]=function(_0x3ddf27,_0x56e99c){return respondWithRpcPromise(_0x1bd5('0x59'),_0x3ddf27[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x56e99c,null))[_0x1bd5('0xb')](handleError(_0x56e99c,null));};exports[_0x1bd5('0x5a')]=function(_0x37a6f3,_0x1e282c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x37a6f3[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x1e282c,null))[_0x1bd5('0xb')](handleError(_0x1e282c,null));};exports[_0x1bd5('0x5b')]=function(_0x590b3d,_0x2ed59d){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x590b3d[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x2ed59d,null))[_0x1bd5('0xb')](handleError(_0x2ed59d,null));};exports[_0x1bd5('0x5d')]=function(_0x32a878,_0x4cc7a5){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x32a878['query'],routingClient)['then'](function(_0x34f98c){if(_0x32a878['query'][_0x1bd5('0x5e')]!==undefined){var _0x1a4ee6=_(_0x34f98c['rows'])[_0x1bd5('0x5f')]([_0x32a878[_0x1bd5('0x15')][_0x1bd5('0x5e')],_0x32a878[_0x1bd5('0x1a')]['id']])[_0x1bd5('0x60')](_0x1bd5('0x61'))['uniq']()[_0x1bd5('0x62')]();return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x1c9cec){return _0x1a4ee6['indexOf'](_0x1c9cec['queue_id'])>-0x1;});}else{return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x2fe037){return _0x2fe037[_0x1bd5('0x61')]===parseInt(_0x32a878['params']['id']);});}})[_0x1bd5('0x16')](respondWithResult(_0x4cc7a5,null))['catch'](handleError(_0x4cc7a5,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a203f,_0x5045f9){return respondWithRpcPromise(_0x1bd5('0x63'),_0x3a203f[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x5045f9,null))[_0x1bd5('0xb')](handleError(_0x5045f9,null));};exports[_0x1bd5('0x64')]=function(_0xab4ed6,_0x232077){return respondWithRpcPromise(_0x1bd5('0x65'),_0xab4ed6[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x232077,null))[_0x1bd5('0xb')](handleError(_0x232077,null));};exports['faxQueuesWaitingInteractions']=function(_0x58c715,_0x59b491){return respondWithRpcPromise(_0x1bd5('0x66'),_0x58c715['query'],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x59b491,null))[_0x1bd5('0xb')](handleError(_0x59b491,null));};exports[_0x1bd5('0x67')]=function(_0x4a3f74){return function(_0x201968,_0x91bcf8){var _0x3410f8,_0x52cd5f;var _0xfc9282=_['capitalize'](_0x4a3f74);var _0x327eb6=_0x4a3f74===_0x1bd5('0x68')?_0x1bd5('0x69'):'Account';return db[_0xfc9282+'Queue'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x201968['params']['id']}})[_0x1bd5('0x16')](function(_0x53be05){if(_[_0x1bd5('0x10')](_0x53be05)){throw new Error(_0xfc9282+_0x1bd5('0x6b'));}_0x3410f8=_0x53be05;return db[_0xfc9282+_0x1bd5('0x6c')][_0x1bd5('0x6a')]({'where':{'id':_0x201968[_0x1bd5('0x22')][_0x1bd5('0x6d')]},'include':[{'model':db[_0xfc9282+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0xfc9282+_0x327eb6],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x3c90dc){if(_[_0x1bd5('0x10')](_0x3c90dc)){throw new Error(_0xfc9282+_0x1bd5('0x70'));}_0x52cd5f=_0x3c90dc;return _0x3c90dc[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2a1b4a={'uniqueid':_0x4a3f74+'.'+_0x52cd5f['id']+'.'+_0x52cd5f[_0x1bd5('0x6e')]['id'],'FromUserId':_0x201968[_0x1bd5('0x32')]['id'],'type':'queue'};_0x2a1b4a[_0xfc9282+_0x1bd5('0x72')]=_0x52cd5f['id'];_0x2a1b4a[_0xfc9282+_0x1bd5('0x73')]=_0x52cd5f['Interaction']['id'];_0x2a1b4a[_0x1bd5('0x74')+_0xfc9282+_0x327eb6+'Id']=_0x52cd5f[_0x1bd5('0x6f')]['id'];_0x2a1b4a['To'+_0xfc9282+_0x1bd5('0x75')]=_0x3410f8['id'];return db[_0xfc9282+'TransferReport'][_0x1bd5('0x76')](_0x2a1b4a);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x4a3f74,'interaction':_0x52cd5f[_0x1bd5('0x6e')],'message':_0x52cd5f,'account':_0x52cd5f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x78'),'appdata':_0x3410f8[_0x1bd5('0x33')]+','+(_0x52cd5f[_0x1bd5('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x91bcf8,null))['catch'](handleError(_0x91bcf8,null));};};exports['agentNotify']=function(_0x4230e9,_0x182d75){var _0x5c9098,_0x5d6b17;if(_[_0x1bd5('0x10')](_0x4230e9['body']['channel'])){throw new Error(_0x1bd5('0x7a'));}var _0x5cb13d=_0x4230e9[_0x1bd5('0x22')][_0x1bd5('0x7b')];var _0x5df043=_[_0x1bd5('0x7c')](_0x5cb13d);var _0x254c8d=_0x5cb13d===_0x1bd5('0x68')?'Website':_0x1bd5('0x6f');return db['User'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x4230e9[_0x1bd5('0x1a')]['id'],'role':_0x1bd5('0x3e')}})[_0x1bd5('0x16')](function(_0x2f9dff){if(_['isNil'](_0x2f9dff)){throw new Error(_0x1bd5('0x7d'));}_0x5c9098=_0x2f9dff;return db[_0x5df043+'Message'][_0x1bd5('0x6a')]({'where':{'id':_0x4230e9['body']['messageId']},'include':[{'model':db[_0x5df043+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0x5df043+_0x254c8d],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x4c9931){if(_[_0x1bd5('0x10')](_0x4c9931)){throw new Error(_0x5df043+_0x1bd5('0x70'));}_0x5d6b17=_0x4c9931;return _0x4c9931[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1bd5('0x16')](function(){var _0x15e584={'uniqueid':_0x5cb13d+'.'+_0x5d6b17['id']+'.'+_0x5d6b17[_0x1bd5('0x6e')]['id'],'FromUserId':_0x4230e9[_0x1bd5('0x32')]['id'],'type':_0x1bd5('0x78'),'ToUserId':_0x5c9098['id']};_0x15e584[_0x5df043+_0x1bd5('0x72')]=_0x5d6b17['id'];_0x15e584[_0x5df043+_0x1bd5('0x73')]=_0x5d6b17[_0x1bd5('0x6e')]['id'];_0x15e584[_0x1bd5('0x74')+_0x5df043+_0x254c8d+'Id']=_0x5d6b17[_0x1bd5('0x6f')]['id'];return db[_0x5df043+_0x1bd5('0x7e')]['create'](_0x15e584);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x5cb13d,'interaction':_0x5d6b17[_0x1bd5('0x6e')],'message':_0x5d6b17,'account':_0x5d6b17[_0x1bd5('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x3e'),'appdata':_0x5c9098[_0x1bd5('0x33')]+','+(_0x5d6b17[_0x1bd5('0x6f')][_0x1bd5('0x7f')]||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x182d75,null))[_0x1bd5('0xb')](handleError(_0x182d75,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 5502124..8c48ff7 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 _0xbbbb=['./schedule.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f7d88,_0x4aa8de){var _0x3e99ee=function(_0x24b0d7){while(--_0x24b0d7){_0x2f7d88['push'](_0x2f7d88['shift']());}};_0x3e99ee(++_0x4aa8de);}(_0xbbbb,0x13d));var _0xbbbb=function(_0x950f6b,_0x2a26b3){_0x950f6b=_0x950f6b-0x0;var _0x59de05=_0xbbbb[_0x950f6b];return _0x59de05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbbbb('0x0'));var timeout=require(_0xbbbb('0x1'));var express=require(_0xbbbb('0x2'));var router=express['Router']();var fs_extra=require(_0xbbbb('0x3'));var auth=require(_0xbbbb('0x4'));var interaction=require(_0xbbbb('0x5'));var config=require(_0xbbbb('0x6'));var controller=require(_0xbbbb('0x7'));router[_0xbbbb('0x8')]('/',auth[_0xbbbb('0x9')](),controller[_0xbbbb('0xa')]);router[_0xbbbb('0x8')](_0xbbbb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbbbb('0x8')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0xbbbb('0x9')](),controller[_0xbbbb('0xc')]);router[_0xbbbb('0xd')](_0xbbbb('0xb'),auth[_0xbbbb('0x9')](),controller[_0xbbbb('0xe')]);router[_0xbbbb('0xf')](_0xbbbb('0xb'),auth[_0xbbbb('0x9')](),controller[_0xbbbb('0x10')]);module[_0xbbbb('0x11')]=router; \ No newline at end of file +var _0xb835=['show','/:id/run','run','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated'];(function(_0x1a35d1,_0x4137a0){var _0x3a54f4=function(_0x21737d){while(--_0x21737d){_0x1a35d1['push'](_0x1a35d1['shift']());}};_0x3a54f4(++_0x4137a0);}(_0xb835,0x1c2));var _0x5b83=function(_0x1efd13,_0x79b0c8){_0x1efd13=_0x1efd13-0x0;var _0x420857=_0xb835[_0x1efd13];return _0x420857;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5b83('0x0'));var express=require(_0x5b83('0x1'));var router=express[_0x5b83('0x2')]();var fs_extra=require(_0x5b83('0x3'));var auth=require(_0x5b83('0x4'));var interaction=require(_0x5b83('0x5'));var config=require(_0x5b83('0x6'));var controller=require(_0x5b83('0x7'));router[_0x5b83('0x8')]('/',auth['isAuthenticated'](),controller[_0x5b83('0x9')]);router[_0x5b83('0x8')](_0x5b83('0xa'),auth[_0x5b83('0xb')](),controller[_0x5b83('0xc')]);router[_0x5b83('0x8')](_0x5b83('0xd'),auth[_0x5b83('0xb')](),controller[_0x5b83('0xe')]);router[_0x5b83('0xf')]('/',auth['isAuthenticated'](),controller[_0x5b83('0x10')]);router[_0x5b83('0x11')](_0x5b83('0xa'),auth[_0x5b83('0xb')](),controller[_0x5b83('0x12')]);router[_0x5b83('0x13')](_0x5b83('0xa'),auth['isAuthenticated'](),controller[_0x5b83('0x14')]);module[_0x5b83('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 98e0d4d..8489754 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 _0x4352=['STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','hours','minutes','days','csv','pdf','default','custom','BOOLEAN','TEXT','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4352,0xcb));var _0x2435=function(_0x26b0ba,_0x257159){_0x26b0ba=_0x26b0ba-0x0;var _0x2c4573=_0x4352[_0x26b0ba];return _0x2c4573;};'use strict';var Sequelize=require(_0x2435('0x0'));module['exports']={'name':{'type':Sequelize[_0x2435('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2435('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2435('0x1')],'allowNull':![],'defaultValue':_0x2435('0x2')},'startAt':{'type':Sequelize[_0x2435('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2435('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2435('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2435('0x5')](_0x2435('0x6'),'quarters',_0x2435('0x7'),'weeks','days',_0x2435('0x8'),_0x2435('0x9')),'allowNull':![],'defaultValue':_0x2435('0xa')},'output':{'type':Sequelize['ENUM'](_0x2435('0xb'),_0x2435('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x2435('0x5')]('custom',_0x2435('0xd')),'allowNull':![],'defaultValue':_0x2435('0xe')},'sendMail':{'type':Sequelize[_0x2435('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0x2435('0x1')]},'cc':{'type':Sequelize[_0x2435('0x10')]},'bcc':{'type':Sequelize[_0x2435('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa115=['days','ENUM','csv','pdf','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','months','weeks','hours','minutes'];(function(_0x5729e6,_0x3a947b){var _0x32e86b=function(_0x1d2f9e){while(--_0x1d2f9e){_0x5729e6['push'](_0x5729e6['shift']());}};_0x32e86b(++_0x3a947b);}(_0xa115,0xa7));var _0x5a11=function(_0x3df9e1,_0xccedca){_0x3df9e1=_0x3df9e1-0x0;var _0x1dcc25=_0xa115[_0x3df9e1];return _0x1dcc25;};'use strict';var Sequelize=require(_0x5a11('0x0'));module[_0x5a11('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5a11('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5a11('0x2')],'allowNull':![],'defaultValue':_0x5a11('0x3')},'startAt':{'type':Sequelize[_0x5a11('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5a11('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters',_0x5a11('0x5'),_0x5a11('0x6'),'days',_0x5a11('0x7'),_0x5a11('0x8')),'allowNull':![],'defaultValue':_0x5a11('0x9')},'output':{'type':Sequelize[_0x5a11('0xa')](_0x5a11('0xb'),_0x5a11('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x5a11('0xb')},'type':{'type':Sequelize[_0x5a11('0xa')]('custom',_0x5a11('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x5a11('0xe')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5a11('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x5a11('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 30da404..dbc311d 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 _0x48b5=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','include','findAll','catch','params','rawAttributes','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run'];(function(_0x98cc40,_0x332002){var _0x23e335=function(_0x3ab266){while(--_0x3ab266){_0x98cc40['push'](_0x98cc40['shift']());}};_0x23e335(++_0x332002);}(_0x48b5,0x154));var _0x548b=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x48b5[_0x5a79e2];return _0x266c45;};'use strict';var emlformat=require(_0x548b('0x0'));var rimraf=require(_0x548b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x548b('0x2'));var moment=require(_0x548b('0x3'));var BPromise=require(_0x548b('0x4'));var Mustache=require(_0x548b('0x5'));var util=require(_0x548b('0x6'));var path=require(_0x548b('0x7'));var sox=require(_0x548b('0x8'));var csv=require('to-csv');var ejs=require(_0x548b('0x9'));var fs=require('fs');var fs_extra=require(_0x548b('0xa'));var _=require(_0x548b('0xb'));var squel=require(_0x548b('0xc'));var crypto=require(_0x548b('0xd'));var jsforce=require(_0x548b('0xe'));var deskjs=require(_0x548b('0xf'));var toCsv=require(_0x548b('0x10'));var querystring=require(_0x548b('0x11'));var Papa=require(_0x548b('0x12'));var Redis=require(_0x548b('0x13'));var authService=require(_0x548b('0x14'));var qs=require(_0x548b('0x15'));var as=require(_0x548b('0x16'));var hardwareService=require(_0x548b('0x17'));var logger=require(_0x548b('0x18'))(_0x548b('0x19'));var utils=require(_0x548b('0x1a'));var config=require(_0x548b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x548b('0x1c'))['db'];function respondWithStatusCode(_0x116e55,_0x4b0266){_0x4b0266=_0x4b0266||0xcc;return function(_0x37df6d){if(_0x37df6d){return _0x116e55[_0x548b('0x1d')](_0x4b0266);}return _0x116e55[_0x548b('0x1e')](_0x4b0266)[_0x548b('0x1f')]();};}function respondWithResult(_0x4a6546,_0x2214e3){_0x2214e3=_0x2214e3||0xc8;return function(_0x1949b8){if(_0x1949b8){return _0x4a6546[_0x548b('0x1e')](_0x2214e3)[_0x548b('0x20')](_0x1949b8);}};}function respondWithFilteredResult(_0x4fb1e8,_0x5b4fa5){return function(_0x4a3efe){if(_0x4a3efe){var _0x45dae9=typeof _0x5b4fa5[_0x548b('0x21')]===_0x548b('0x22')&&typeof _0x5b4fa5[_0x548b('0x23')]===_0x548b('0x22');var _0x237bc4=_0x4a3efe[_0x548b('0x24')];var _0x26c6bb=_0x45dae9?0x0:_0x5b4fa5[_0x548b('0x21')];var _0x4f6531=_0x45dae9?_0x4a3efe[_0x548b('0x24')]:_0x5b4fa5[_0x548b('0x21')]+_0x5b4fa5[_0x548b('0x23')];var _0x2d21c5;if(_0x4f6531>=_0x237bc4){_0x4f6531=_0x237bc4;_0x2d21c5=0xc8;}else{_0x2d21c5=0xce;}_0x4fb1e8['status'](_0x2d21c5);return _0x4fb1e8[_0x548b('0x25')](_0x548b('0x26'),_0x26c6bb+'-'+_0x4f6531+'/'+_0x237bc4)[_0x548b('0x20')](_0x4a3efe);}return null;};}function patchUpdates(_0x541198){return function(_0x3ca037){try{jsonpatch[_0x548b('0x27')](_0x3ca037,_0x541198,!![]);}catch(_0x1bad8f){return BPromise[_0x548b('0x28')](_0x1bad8f);}return _0x3ca037['save']();};}function saveUpdates(_0xa3e6b1,_0x5dce52){return function(_0x57fb7e){if(_0x57fb7e){return _0x57fb7e[_0x548b('0x29')](_0xa3e6b1)[_0x548b('0x2a')](function(_0x2c2403){return _0x2c2403;});}return null;};}function removeEntity(_0x32c6de,_0x183839){return function(_0x2e14d1){if(_0x2e14d1){return _0x2e14d1[_0x548b('0x2b')]()[_0x548b('0x2a')](function(){var _0x11aedb=_0x2e14d1[_0x548b('0x2c')]({'plain':!![]});var _0xcde1bd='Scheduler';return db[_0x548b('0x2d')]['destroy']({'where':{'type':_0xcde1bd,'resourceId':_0x11aedb['id']}})[_0x548b('0x2a')](function(){return _0x2e14d1;});})[_0x548b('0x2a')](function(){_0x32c6de[_0x548b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9fe3,_0x313324){return function(_0x106a75){if(!_0x106a75){_0x4f9fe3[_0x548b('0x1d')](0x194);}return _0x106a75;};}function handleError(_0x2ba1ee,_0x147f26){_0x147f26=_0x147f26||0x1f4;return function(_0x5a5b92){logger[_0x548b('0x2e')](_0x5a5b92[_0x548b('0x2f')]);if(_0x5a5b92[_0x548b('0x30')]){delete _0x5a5b92['name'];}_0x2ba1ee[_0x548b('0x1e')](_0x147f26)[_0x548b('0x31')](_0x5a5b92);};}exports[_0x548b('0x32')]=function(_0x3bf0e1,_0x549313){var _0x4a47c5={},_0x1b371c={},_0x53370d={'count':0x0,'rows':[]};var _0x16396d=_[_0x548b('0x33')](db[_0x548b('0x34')]['rawAttributes'],function(_0x365876){return{'name':_0x365876[_0x548b('0x35')],'type':_0x365876[_0x548b('0x36')][_0x548b('0x37')]};});_0x1b371c[_0x548b('0x38')]=_[_0x548b('0x33')](_0x16396d,_0x548b('0x30'));_0x1b371c[_0x548b('0x39')]=_[_0x548b('0x3a')](_0x3bf0e1[_0x548b('0x39')]);_0x1b371c[_0x548b('0x3b')]=_[_0x548b('0x3c')](_0x1b371c[_0x548b('0x38')],_0x1b371c[_0x548b('0x39')]);_0x4a47c5[_0x548b('0x3d')]=_[_0x548b('0x3c')](_0x1b371c[_0x548b('0x38')],qs['fields'](_0x3bf0e1[_0x548b('0x39')][_0x548b('0x3e')]));_0x4a47c5['attributes']=_0x4a47c5[_0x548b('0x3d')][_0x548b('0x3f')]?_0x4a47c5[_0x548b('0x3d')]:_0x1b371c[_0x548b('0x38')];if(!_0x3bf0e1[_0x548b('0x39')][_0x548b('0x40')](_0x548b('0x41'))){_0x4a47c5[_0x548b('0x23')]=qs[_0x548b('0x23')](_0x3bf0e1[_0x548b('0x39')][_0x548b('0x23')]);_0x4a47c5['offset']=qs[_0x548b('0x21')](_0x3bf0e1[_0x548b('0x39')][_0x548b('0x21')]);}_0x4a47c5[_0x548b('0x42')]=qs['sort'](_0x3bf0e1[_0x548b('0x39')]['sort']);_0x4a47c5[_0x548b('0x43')]=qs[_0x548b('0x3b')](_[_0x548b('0x44')](_0x3bf0e1[_0x548b('0x39')],_0x1b371c[_0x548b('0x3b')]),_0x16396d);if(_0x3bf0e1[_0x548b('0x39')][_0x548b('0x45')]){_0x4a47c5[_0x548b('0x43')]=_[_0x548b('0x46')](_0x4a47c5[_0x548b('0x43')],{'$or':_[_0x548b('0x33')](_0x16396d,function(_0x23f22a){if(_0x23f22a[_0x548b('0x36')]!=='VIRTUAL'){var _0x4627f2={};_0x4627f2[_0x23f22a['name']]={'$like':'%'+_0x3bf0e1['query'][_0x548b('0x45')]+'%'};return _0x4627f2;}})});}_0x4a47c5=_[_0x548b('0x46')]({},_0x4a47c5,_0x3bf0e1['options']);var _0x4c58fb={'where':_0x4a47c5['where']};return db[_0x548b('0x34')][_0x548b('0x24')](_0x4c58fb)[_0x548b('0x2a')](function(_0xebdd18){_0x53370d['count']=_0xebdd18;if(_0x3bf0e1['query']['includeAll']){_0x4a47c5[_0x548b('0x47')]=[{'all':!![]}];}return db[_0x548b('0x34')][_0x548b('0x48')](_0x4a47c5);})[_0x548b('0x2a')](function(_0x1196f9){_0x53370d['rows']=_0x1196f9;return _0x53370d;})['then'](respondWithFilteredResult(_0x549313,_0x4a47c5))[_0x548b('0x49')](handleError(_0x549313,null));};exports['show']=function(_0x4043f4,_0x5a786b){var _0x39fb04={'raw':![],'where':{'id':_0x4043f4[_0x548b('0x4a')]['id']}},_0x220531={};_0x220531[_0x548b('0x38')]=_[_0x548b('0x3a')](db[_0x548b('0x34')][_0x548b('0x4b')]);_0x220531[_0x548b('0x39')]=_['keys'](_0x4043f4[_0x548b('0x39')]);_0x220531[_0x548b('0x3b')]=_[_0x548b('0x3c')](_0x220531['model'],_0x220531['query']);_0x39fb04[_0x548b('0x3d')]=_[_0x548b('0x3c')](_0x220531[_0x548b('0x38')],qs[_0x548b('0x3e')](_0x4043f4[_0x548b('0x39')][_0x548b('0x3e')]));_0x39fb04['attributes']=_0x39fb04['attributes']['length']?_0x39fb04[_0x548b('0x3d')]:_0x220531[_0x548b('0x38')];if(_0x4043f4['query'][_0x548b('0x4c')]){_0x39fb04[_0x548b('0x47')]=[{'all':!![]}];}_0x39fb04=_[_0x548b('0x46')]({},_0x39fb04,_0x4043f4['options']);return db['Schedule']['find'](_0x39fb04)[_0x548b('0x2a')](handleEntityNotFound(_0x5a786b,null))[_0x548b('0x2a')](respondWithResult(_0x5a786b,null))['catch'](handleError(_0x5a786b,null));};exports[_0x548b('0x4d')]=function(_0x4eeb94,_0x16da73){return db[_0x548b('0x34')]['create'](_0x4eeb94[_0x548b('0x4e')],{})[_0x548b('0x2a')](function(_0x58879c){var _0x380f68=_0x4eeb94['user'][_0x548b('0x2c')]({'plain':!![]});if(!_0x380f68)throw new Error(_0x548b('0x4f'));if(_0x380f68[_0x548b('0x50')]==='user'){var _0x1e350e=_0x58879c[_0x548b('0x2c')]({'plain':!![]});var _0x213f02=_0x548b('0x51');return db['UserProfileSection'][_0x548b('0x52')]({'where':{'name':_0x213f02,'userProfileId':_0x380f68['userProfileId']},'raw':!![]})[_0x548b('0x2a')](function(_0x262b8e){if(_0x262b8e&&_0x262b8e['autoAssociation']===0x0){return db[_0x548b('0x2d')][_0x548b('0x4d')]({'name':_0x1e350e['name'],'resourceId':_0x1e350e['id'],'type':_0x262b8e[_0x548b('0x30')],'sectionId':_0x262b8e['id']},{})[_0x548b('0x2a')](function(){return _0x58879c;});}else{return _0x58879c;}})['catch'](function(_0x45015b){logger[_0x548b('0x2e')](_0x548b('0x53'),_0x45015b);throw _0x45015b;});}return _0x58879c;})[_0x548b('0x2a')](respondWithResult(_0x16da73,0xc9))['catch'](handleError(_0x16da73,null));};exports[_0x548b('0x29')]=function(_0x1b9d56,_0x309d7a){if(_0x1b9d56['body']['id']){delete _0x1b9d56[_0x548b('0x4e')]['id'];}return db[_0x548b('0x34')][_0x548b('0x52')]({'where':{'id':_0x1b9d56[_0x548b('0x4a')]['id']}})[_0x548b('0x2a')](handleEntityNotFound(_0x309d7a,null))[_0x548b('0x2a')](saveUpdates(_0x1b9d56[_0x548b('0x4e')],null))[_0x548b('0x2a')](respondWithResult(_0x309d7a,null))[_0x548b('0x49')](handleError(_0x309d7a,null));};exports[_0x548b('0x2b')]=function(_0x30ad7d,_0x11e3c4){return db[_0x548b('0x34')][_0x548b('0x52')]({'where':{'id':_0x30ad7d[_0x548b('0x4a')]['id']}})[_0x548b('0x2a')](handleEntityNotFound(_0x11e3c4,null))['then'](removeEntity(_0x11e3c4,null))[_0x548b('0x49')](handleError(_0x11e3c4,null));};exports['run']=function(_0x1fb797,_0x42b3c6,_0x1a0cda){var _0x75a5cc=require('../../config/schedule');return db['Schedule'][_0x548b('0x52')]({'where':{'id':_0x1fb797['params']['id']},'raw':!![]})[_0x548b('0x2a')](handleEntityNotFound(_0x42b3c6,null))[_0x548b('0x2a')](function(){_0x75a5cc[_0x548b('0x54')](_0x1fb797[_0x548b('0x4a')]['id']);})[_0x548b('0x2a')](respondWithStatusCode(_0x42b3c6,null))[_0x548b('0x49')](handleError(_0x42b3c6,null));}; \ No newline at end of file +var _0x86e1=['Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','../../config/schedule','run','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','include','findAll','rows','catch','show','params','rawAttributes','includeAll','merge','options','find','create','body','user'];(function(_0x3460c9,_0x565510){var _0x1d8283=function(_0x8a51bd){while(--_0x8a51bd){_0x3460c9['push'](_0x3460c9['shift']());}};_0x1d8283(++_0x565510);}(_0x86e1,0x1b0));var _0x186e=function(_0x136f2d,_0x1460b9){_0x136f2d=_0x136f2d-0x0;var _0x55f3f7=_0x86e1[_0x136f2d];return _0x55f3f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x186e('0x0'));var zipdir=require(_0x186e('0x1'));var jsonpatch=require(_0x186e('0x2'));var rp=require(_0x186e('0x3'));var moment=require(_0x186e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x186e('0x5'));var util=require('util');var path=require(_0x186e('0x6'));var sox=require(_0x186e('0x7'));var csv=require(_0x186e('0x8'));var ejs=require(_0x186e('0x9'));var fs=require('fs');var fs_extra=require(_0x186e('0xa'));var _=require(_0x186e('0xb'));var squel=require(_0x186e('0xc'));var crypto=require(_0x186e('0xd'));var jsforce=require(_0x186e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x186e('0xf'));var Papa=require(_0x186e('0x10'));var Redis=require(_0x186e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x186e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x186e('0x13'));var logger=require(_0x186e('0x14'))(_0x186e('0x15'));var utils=require(_0x186e('0x16'));var config=require(_0x186e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x186e('0x18'))['db'];function respondWithStatusCode(_0x3844e0,_0x20e7c1){_0x20e7c1=_0x20e7c1||0xcc;return function(_0x51bd7f){if(_0x51bd7f){return _0x3844e0[_0x186e('0x19')](_0x20e7c1);}return _0x3844e0[_0x186e('0x1a')](_0x20e7c1)[_0x186e('0x1b')]();};}function respondWithResult(_0x1cc0fc,_0x573ea9){_0x573ea9=_0x573ea9||0xc8;return function(_0x4f7309){if(_0x4f7309){return _0x1cc0fc[_0x186e('0x1a')](_0x573ea9)[_0x186e('0x1c')](_0x4f7309);}};}function respondWithFilteredResult(_0xccad12,_0x3fb4f9){return function(_0x285f66){if(_0x285f66){var _0x556839=typeof _0x3fb4f9[_0x186e('0x1d')]===_0x186e('0x1e')&&typeof _0x3fb4f9['limit']==='undefined';var _0x319f99=_0x285f66[_0x186e('0x1f')];var _0x268a4b=_0x556839?0x0:_0x3fb4f9[_0x186e('0x1d')];var _0x2e3ecc=_0x556839?_0x285f66[_0x186e('0x1f')]:_0x3fb4f9['offset']+_0x3fb4f9['limit'];var _0x49fc94;if(_0x2e3ecc>=_0x319f99){_0x2e3ecc=_0x319f99;_0x49fc94=0xc8;}else{_0x49fc94=0xce;}_0xccad12[_0x186e('0x1a')](_0x49fc94);return _0xccad12[_0x186e('0x20')](_0x186e('0x21'),_0x268a4b+'-'+_0x2e3ecc+'/'+_0x319f99)[_0x186e('0x1c')](_0x285f66);}return null;};}function patchUpdates(_0x5131e0){return function(_0x127552){try{jsonpatch[_0x186e('0x22')](_0x127552,_0x5131e0,!![]);}catch(_0x4b1ae2){return BPromise[_0x186e('0x23')](_0x4b1ae2);}return _0x127552[_0x186e('0x24')]();};}function saveUpdates(_0x58d016,_0x48b151){return function(_0x4041f8){if(_0x4041f8){return _0x4041f8['update'](_0x58d016)[_0x186e('0x25')](function(_0x21161a){return _0x21161a;});}return null;};}function removeEntity(_0x412768,_0x129d68){return function(_0x53a0d5){if(_0x53a0d5){return _0x53a0d5[_0x186e('0x26')]()[_0x186e('0x25')](function(){var _0x5a007e=_0x53a0d5['get']({'plain':!![]});var _0x3d66b6=_0x186e('0x27');return db[_0x186e('0x28')]['destroy']({'where':{'type':_0x3d66b6,'resourceId':_0x5a007e['id']}})[_0x186e('0x25')](function(){return _0x53a0d5;});})[_0x186e('0x25')](function(){_0x412768[_0x186e('0x1a')](0xcc)[_0x186e('0x1b')]();});}};}function handleEntityNotFound(_0x336e1a,_0x500753){return function(_0x2bb666){if(!_0x2bb666){_0x336e1a['sendStatus'](0x194);}return _0x2bb666;};}function handleError(_0x54fe61,_0x94b6a4){_0x94b6a4=_0x94b6a4||0x1f4;return function(_0x366fec){logger[_0x186e('0x29')](_0x366fec[_0x186e('0x2a')]);if(_0x366fec['name']){delete _0x366fec[_0x186e('0x2b')];}_0x54fe61[_0x186e('0x1a')](_0x94b6a4)[_0x186e('0x2c')](_0x366fec);};}exports[_0x186e('0x2d')]=function(_0x3aa492,_0x11b4a3){var _0x34bb23={},_0x15d319={},_0x36492b={'count':0x0,'rows':[]};var _0x45cc2d=_['map'](db[_0x186e('0x2e')]['rawAttributes'],function(_0x1c9d23){return{'name':_0x1c9d23['fieldName'],'type':_0x1c9d23[_0x186e('0x2f')][_0x186e('0x30')]};});_0x15d319['model']=_[_0x186e('0x31')](_0x45cc2d,_0x186e('0x2b'));_0x15d319[_0x186e('0x32')]=_[_0x186e('0x33')](_0x3aa492[_0x186e('0x32')]);_0x15d319[_0x186e('0x34')]=_[_0x186e('0x35')](_0x15d319[_0x186e('0x36')],_0x15d319[_0x186e('0x32')]);_0x34bb23[_0x186e('0x37')]=_[_0x186e('0x35')](_0x15d319[_0x186e('0x36')],qs[_0x186e('0x38')](_0x3aa492['query'][_0x186e('0x38')]));_0x34bb23[_0x186e('0x37')]=_0x34bb23[_0x186e('0x37')]['length']?_0x34bb23[_0x186e('0x37')]:_0x15d319['model'];if(!_0x3aa492[_0x186e('0x32')][_0x186e('0x39')](_0x186e('0x3a'))){_0x34bb23[_0x186e('0x3b')]=qs[_0x186e('0x3b')](_0x3aa492[_0x186e('0x32')]['limit']);_0x34bb23['offset']=qs[_0x186e('0x1d')](_0x3aa492[_0x186e('0x32')][_0x186e('0x1d')]);}_0x34bb23[_0x186e('0x3c')]=qs['sort'](_0x3aa492['query'][_0x186e('0x3d')]);_0x34bb23[_0x186e('0x3e')]=qs['filters'](_['pick'](_0x3aa492[_0x186e('0x32')],_0x15d319[_0x186e('0x34')]),_0x45cc2d);if(_0x3aa492[_0x186e('0x32')][_0x186e('0x3f')]){_0x34bb23[_0x186e('0x3e')]=_['merge'](_0x34bb23[_0x186e('0x3e')],{'$or':_[_0x186e('0x31')](_0x45cc2d,function(_0x119fbd){if(_0x119fbd[_0x186e('0x2f')]!=='VIRTUAL'){var _0x131429={};_0x131429[_0x119fbd[_0x186e('0x2b')]]={'$like':'%'+_0x3aa492['query'][_0x186e('0x3f')]+'%'};return _0x131429;}})});}_0x34bb23=_['merge']({},_0x34bb23,_0x3aa492['options']);var _0x4d1822={'where':_0x34bb23[_0x186e('0x3e')]};return db[_0x186e('0x2e')]['count'](_0x4d1822)[_0x186e('0x25')](function(_0x4f5332){_0x36492b['count']=_0x4f5332;if(_0x3aa492['query']['includeAll']){_0x34bb23[_0x186e('0x40')]=[{'all':!![]}];}return db[_0x186e('0x2e')][_0x186e('0x41')](_0x34bb23);})['then'](function(_0x50f84f){_0x36492b[_0x186e('0x42')]=_0x50f84f;return _0x36492b;})[_0x186e('0x25')](respondWithFilteredResult(_0x11b4a3,_0x34bb23))[_0x186e('0x43')](handleError(_0x11b4a3,null));};exports[_0x186e('0x44')]=function(_0x97a664,_0x38fbbe){var _0xec822a={'raw':![],'where':{'id':_0x97a664[_0x186e('0x45')]['id']}},_0x502557={};_0x502557[_0x186e('0x36')]=_['keys'](db[_0x186e('0x2e')][_0x186e('0x46')]);_0x502557[_0x186e('0x32')]=_[_0x186e('0x33')](_0x97a664[_0x186e('0x32')]);_0x502557['filters']=_[_0x186e('0x35')](_0x502557['model'],_0x502557[_0x186e('0x32')]);_0xec822a['attributes']=_[_0x186e('0x35')](_0x502557['model'],qs[_0x186e('0x38')](_0x97a664['query'][_0x186e('0x38')]));_0xec822a[_0x186e('0x37')]=_0xec822a[_0x186e('0x37')]['length']?_0xec822a['attributes']:_0x502557[_0x186e('0x36')];if(_0x97a664['query'][_0x186e('0x47')]){_0xec822a[_0x186e('0x40')]=[{'all':!![]}];}_0xec822a=_[_0x186e('0x48')]({},_0xec822a,_0x97a664[_0x186e('0x49')]);return db[_0x186e('0x2e')][_0x186e('0x4a')](_0xec822a)['then'](handleEntityNotFound(_0x38fbbe,null))[_0x186e('0x25')](respondWithResult(_0x38fbbe,null))[_0x186e('0x43')](handleError(_0x38fbbe,null));};exports['create']=function(_0x3830fc,_0x3421b8){return db[_0x186e('0x2e')][_0x186e('0x4b')](_0x3830fc[_0x186e('0x4c')],{})[_0x186e('0x25')](function(_0x24d8dd){var _0x1e38f4=_0x3830fc[_0x186e('0x4d')]['get']({'plain':!![]});if(!_0x1e38f4)throw new Error(_0x186e('0x4e'));if(_0x1e38f4['role']==='user'){var _0x4946ae=_0x24d8dd[_0x186e('0x4f')]({'plain':!![]});var _0x436168=_0x186e('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x436168,'userProfileId':_0x1e38f4[_0x186e('0x50')]},'raw':!![]})[_0x186e('0x25')](function(_0x216209){if(_0x216209&&_0x216209['autoAssociation']===0x0){return db[_0x186e('0x28')][_0x186e('0x4b')]({'name':_0x4946ae['name'],'resourceId':_0x4946ae['id'],'type':_0x216209[_0x186e('0x2b')],'sectionId':_0x216209['id']},{})['then'](function(){return _0x24d8dd;});}else{return _0x24d8dd;}})[_0x186e('0x43')](function(_0x4f406){logger[_0x186e('0x29')](_0x186e('0x51'),_0x4f406);throw _0x4f406;});}return _0x24d8dd;})[_0x186e('0x25')](respondWithResult(_0x3421b8,0xc9))['catch'](handleError(_0x3421b8,null));};exports[_0x186e('0x52')]=function(_0x165dcb,_0x5c6f5a){if(_0x165dcb['body']['id']){delete _0x165dcb[_0x186e('0x4c')]['id'];}return db['Schedule'][_0x186e('0x4a')]({'where':{'id':_0x165dcb[_0x186e('0x45')]['id']}})[_0x186e('0x25')](handleEntityNotFound(_0x5c6f5a,null))[_0x186e('0x25')](saveUpdates(_0x165dcb[_0x186e('0x4c')],null))[_0x186e('0x25')](respondWithResult(_0x5c6f5a,null))[_0x186e('0x43')](handleError(_0x5c6f5a,null));};exports[_0x186e('0x26')]=function(_0x1b77ad,_0x1edc2f){return db['Schedule'][_0x186e('0x4a')]({'where':{'id':_0x1b77ad[_0x186e('0x45')]['id']}})[_0x186e('0x25')](handleEntityNotFound(_0x1edc2f,null))['then'](removeEntity(_0x1edc2f,null))[_0x186e('0x43')](handleError(_0x1edc2f,null));};exports['run']=function(_0x5502a8,_0x297ab6,_0x1a07c8){var _0x119fe9=require(_0x186e('0x53'));return db[_0x186e('0x2e')][_0x186e('0x4a')]({'where':{'id':_0x5502a8['params']['id']},'raw':!![]})[_0x186e('0x25')](handleEntityNotFound(_0x297ab6,null))[_0x186e('0x25')](function(){_0x119fe9[_0x186e('0x54')](_0x5502a8[_0x186e('0x45')]['id']);})[_0x186e('0x25')](respondWithStatusCode(_0x297ab6,null))[_0x186e('0x43')](handleError(_0x297ab6,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6f944f2..80c1ccc 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 _0xbb17=['define','Schedule','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./schedule.attributes','exports'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xbb17,0x136));var _0x7bb1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbb17[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7bb1('0x0'));var util=require(_0x7bb1('0x1'));var logger=require(_0x7bb1('0x2'))(_0x7bb1('0x3'));var moment=require('moment');var BPromise=require(_0x7bb1('0x4'));var rp=require(_0x7bb1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bb1('0x6'));var config=require('../../config/environment');var attributes=require(_0x7bb1('0x7'));module[_0x7bb1('0x8')]=function(_0x2cc84f,_0x44a7be){return _0x2cc84f[_0x7bb1('0x9')](_0x7bb1('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0561=['Schedule','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./schedule.attributes','define'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x0561,0x169));var _0x1056=function(_0xa51f0f,_0x37685a){_0xa51f0f=_0xa51f0f-0x0;var _0x823d9d=_0x0561[_0xa51f0f];return _0x823d9d;};'use strict';var _=require('lodash');var util=require(_0x1056('0x0'));var logger=require(_0x1056('0x1'))(_0x1056('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1056('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1056('0x4'));var config=require(_0x1056('0x5'));var attributes=require(_0x1056('0x6'));module['exports']=function(_0x57c91b,_0x170b11){return _0x57c91b[_0x1056('0x7')](_0x1056('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index d56f92f..a41e951 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 _0xba04=['../../config/logger','../../config/environment','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xba04,0x180));var _0x4ba0=function(_0x3afc75,_0x32dc5b){_0x3afc75=_0x3afc75-0x0;var _0x16f415=_0xba04[_0x3afc75];return _0x16f415;};'use strict';var _=require(_0x4ba0('0x0'));var util=require(_0x4ba0('0x1'));var moment=require(_0x4ba0('0x2'));var BPromise=require(_0x4ba0('0x3'));var rs=require(_0x4ba0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ba0('0x5'))['db'];var utils=require(_0x4ba0('0x6'));var logger=require(_0x4ba0('0x7'))('rpc');var config=require(_0x4ba0('0x8'));var jayson=require(_0x4ba0('0x9'));var client=jayson['client'][_0x4ba0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x186a80,_0x274c2e,_0xf7cb23){return new BPromise(function(_0x22a702,_0x26ab0d){return client['request'](_0x186a80,_0xf7cb23)[_0x4ba0('0xb')](function(_0x129683){logger[_0x4ba0('0xc')](_0x4ba0('0xd'),_0x274c2e,'request\x20sent');logger[_0x4ba0('0xe')](_0x4ba0('0xf'),_0x274c2e,_0x4ba0('0x10'),JSON[_0x4ba0('0x11')](_0x129683));if(_0x129683[_0x4ba0('0x12')]){if(_0x129683[_0x4ba0('0x12')][_0x4ba0('0x13')]===0x1f4){logger[_0x4ba0('0x12')](_0x4ba0('0xd'),_0x274c2e,_0x129683['error'][_0x4ba0('0x14')]);return _0x26ab0d(_0x129683[_0x4ba0('0x12')][_0x4ba0('0x14')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x274c2e,_0x129683[_0x4ba0('0x12')][_0x4ba0('0x14')]);return _0x22a702(_0x129683[_0x4ba0('0x12')]['message']);}else{logger[_0x4ba0('0xc')](_0x4ba0('0xd'),_0x274c2e,'request\x20sent');_0x22a702(_0x129683[_0x4ba0('0x15')][_0x4ba0('0x14')]);}})[_0x4ba0('0x16')](function(_0x38acc0){logger[_0x4ba0('0x12')](_0x4ba0('0xd'),_0x274c2e,_0x38acc0);_0x26ab0d(_0x38acc0);});});} \ No newline at end of file +var _0xc634=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x409a9f,_0x9ca0c2){var _0x75d37b=function(_0x24f9dd){while(--_0x24f9dd){_0x409a9f['push'](_0x409a9f['shift']());}};_0x75d37b(++_0x9ca0c2);}(_0xc634,0x1a9));var _0x4c63=function(_0x55c8d7,_0x2a4369){_0x55c8d7=_0x55c8d7-0x0;var _0x523dce=_0xc634[_0x55c8d7];return _0x523dce;};'use strict';var _=require(_0x4c63('0x0'));var util=require('util');var moment=require(_0x4c63('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c63('0x2'));var fs=require('fs');var Redis=require(_0x4c63('0x3'));var db=require(_0x4c63('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4c63('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4c63('0x6')][_0x4c63('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f2f05,_0x1e2b3a,_0x562c00){return new BPromise(function(_0x1eb7cd,_0x53afb8){return client[_0x4c63('0x8')](_0x5f2f05,_0x562c00)['then'](function(_0x4e7c08){logger[_0x4c63('0x9')](_0x4c63('0xa'),_0x1e2b3a,_0x4c63('0xb'));logger[_0x4c63('0xc')](_0x4c63('0xd'),_0x1e2b3a,_0x4c63('0xb'),JSON[_0x4c63('0xe')](_0x4e7c08));if(_0x4e7c08[_0x4c63('0xf')]){if(_0x4e7c08['error'][_0x4c63('0x10')]===0x1f4){logger[_0x4c63('0xf')](_0x4c63('0xa'),_0x1e2b3a,_0x4e7c08[_0x4c63('0xf')][_0x4c63('0x11')]);return _0x53afb8(_0x4e7c08['error'][_0x4c63('0x11')]);}logger[_0x4c63('0xf')](_0x4c63('0xa'),_0x1e2b3a,_0x4e7c08[_0x4c63('0xf')][_0x4c63('0x11')]);return _0x1eb7cd(_0x4e7c08['error']['message']);}else{logger[_0x4c63('0x9')](_0x4c63('0xa'),_0x1e2b3a,_0x4c63('0xb'));_0x1eb7cd(_0x4e7c08[_0x4c63('0x12')]['message']);}})[_0x4c63('0x13')](function(_0x436fd1){logger['error'](_0x4c63('0xa'),_0x1e2b3a,_0x436fd1);_0x53afb8(_0x436fd1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b13a9c1..87b112d 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 _0x03f5=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','create'];(function(_0x535e65,_0x2485ca){var _0x4e1878=function(_0xef47f0){while(--_0xef47f0){_0x535e65['push'](_0x535e65['shift']());}};_0x4e1878(++_0x2485ca);}(_0x03f5,0x6c));var _0x503f=function(_0x597156,_0x3c65ec){_0x597156=_0x597156-0x0;var _0x758f52=_0x03f5[_0x597156];return _0x758f52;};'use strict';var multer=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var path=require(_0x503f('0x2'));var timeout=require(_0x503f('0x3'));var express=require(_0x503f('0x4'));var router=express[_0x503f('0x5')]();var fs_extra=require(_0x503f('0x6'));var auth=require(_0x503f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x503f('0x8'));router[_0x503f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x503f('0x9')](_0x503f('0xa'),auth[_0x503f('0xb')](),controller[_0x503f('0xc')]);router[_0x503f('0x9')](_0x503f('0xd'),auth[_0x503f('0xb')](),controller[_0x503f('0xe')]);router[_0x503f('0x9')](_0x503f('0xf'),auth[_0x503f('0xb')](),controller['download']);router[_0x503f('0x10')]('/',auth['isAuthenticated'](),controller[_0x503f('0x11')]);router[_0x503f('0x12')](_0x503f('0xd'),auth[_0x503f('0xb')](),controller['update']);router[_0x503f('0x13')](_0x503f('0xd'),auth['isAuthenticated'](),controller[_0x503f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6659=['Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','index','get','/describe','describe','/:id','/:id/download','download','isAuthenticated','create','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1e62b8,_0x5eed4c){var _0x2ab271=function(_0x20f14e){while(--_0x20f14e){_0x1e62b8['push'](_0x1e62b8['shift']());}};_0x2ab271(++_0x5eed4c);}(_0x6659,0x100));var _0x9665=function(_0x5f23fd,_0x20d46e){_0x5f23fd=_0x5f23fd-0x0;var _0x23b1d0=_0x6659[_0x5f23fd];return _0x23b1d0;};'use strict';var multer=require(_0x9665('0x0'));var util=require('util');var path=require(_0x9665('0x1'));var timeout=require(_0x9665('0x2'));var express=require(_0x9665('0x3'));var router=express[_0x9665('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9665('0x5'));var interaction=require(_0x9665('0x6'));var config=require('../../config/environment');var controller=require(_0x9665('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9665('0x8')]);router[_0x9665('0x9')](_0x9665('0xa'),auth['isAuthenticated'](),controller[_0x9665('0xb')]);router[_0x9665('0x9')](_0x9665('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9665('0xd'),auth['isAuthenticated'](),controller[_0x9665('0xe')]);router['post']('/',auth[_0x9665('0xf')](),controller[_0x9665('0x10')]);router['put'](_0x9665('0xc'),auth[_0x9665('0xf')](),controller[_0x9665('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9665('0x12')]);module[_0x9665('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 824b213..c138d18 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 _0xd290=['sequelize','moment','../../config/environment','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt'];(function(_0xd94171,_0x33729a){var _0x4dc7bf=function(_0x26cf0d){while(--_0x26cf0d){_0xd94171['push'](_0xd94171['shift']());}};_0x4dc7bf(++_0x33729a);}(_0xd290,0x165));var _0x0d29=function(_0x1f5bd9,_0x2ed6b4){_0x1f5bd9=_0x1f5bd9-0x0;var _0x2e7379=_0xd290[_0x1f5bd9];return _0x2e7379;};'use strict';var Sequelize=require(_0x0d29('0x0'));var moment=require(_0x0d29('0x1'));var path=require('path');var config=require(_0x0d29('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0d29('0x3')](_0x0d29('0x4'))?path[_0x0d29('0x5')](this[_0x0d29('0x3')](_0x0d29('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0d29('0x6')]},'value':{'type':Sequelize[_0x0d29('0x6')],'set':function(_0x151d32){var _0x376d19=_0x151d32[_0x0d29('0x7')](/\\/g,'/');this['setDataValue'](_0x0d29('0x4'),_0x376d19);}},'rating':{'type':Sequelize[_0x0d29('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0d29('0x8')],'set':function(_0x4b876e){this[_0x0d29('0x9')](_0x0d29('0xa'),moment()['subtract'](_0x4b876e,'ms'));this[_0x0d29('0x9')](_0x0d29('0xb'),moment());this['setDataValue'](_0x0d29('0xc'),_0x4b876e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0d29('0x3')](_0x0d29('0xa')))[_0x0d29('0xd')](_0x0d29('0xe'))[_0x0d29('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0d29('0x3')](_0x0d29('0xb')))[_0x0d29('0xd')](_0x0d29('0xe'))[_0x0d29('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x0d29('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x0d29('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0d29('0x3')](_0x0d29('0x10')))[_0x0d29('0xd')](_0x0d29('0xe'))[_0x0d29('0xf')]();}}}; \ No newline at end of file +var _0x45c2=['INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue'];(function(_0x1a89b9,_0x3536be){var _0xd96914=function(_0x5e31dd){while(--_0x5e31dd){_0x1a89b9['push'](_0x1a89b9['shift']());}};_0xd96914(++_0x3536be);}(_0x45c2,0x68));var _0x245c=function(_0x380168,_0x40546c){_0x380168=_0x380168-0x0;var _0x12e86d=_0x45c2[_0x380168];return _0x12e86d;};'use strict';var Sequelize=require(_0x245c('0x0'));var moment=require(_0x245c('0x1'));var path=require(_0x245c('0x2'));var config=require(_0x245c('0x3'));module['exports']={'format':{'type':Sequelize[_0x245c('0x4')],'get':function(){return this[_0x245c('0x5')](_0x245c('0x6'))?path['extname'](this[_0x245c('0x5')](_0x245c('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x245c('0x7')]},'channel':{'type':Sequelize[_0x245c('0x7')]},'value':{'type':Sequelize[_0x245c('0x7')],'set':function(_0x2e1860){var _0x20a6d7=_0x2e1860[_0x245c('0x8')](/\\/g,'/');this[_0x245c('0x9')](_0x245c('0x6'),_0x20a6d7);}},'rating':{'type':Sequelize[_0x245c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x245c('0xa')],'set':function(_0x558ef3){this[_0x245c('0x9')](_0x245c('0xb'),moment()[_0x245c('0xc')](_0x558ef3,'ms'));this['setDataValue']('closedAt',moment());this[_0x245c('0x9')](_0x245c('0xd'),_0x558ef3);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x245c('0x5')]('startedAt'))[_0x245c('0xe')](_0x245c('0xf'))[_0x245c('0x10')]();}},'closedAt':{'type':Sequelize[_0x245c('0x11')],'get':function(){return moment(this[_0x245c('0x5')]('closedAt'))[_0x245c('0xe')](_0x245c('0xf'))[_0x245c('0x10')]();}},'createdAt':{'type':Sequelize[_0x245c('0x11')],'get':function(){return moment(this['getDataValue'](_0x245c('0x12')))['format'](_0x245c('0xf'))[_0x245c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x245c('0x11')],'get':function(){return moment(this[_0x245c('0x5')]('updatedAt'))[_0x245c('0xe')](_0x245c('0xf'))[_0x245c('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a6ac2ba..cee19f9 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 _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x19cf5e,_0x17a6e5){var _0xe37546=function(_0x35dfd8){while(--_0x35dfd8){_0x19cf5e['push'](_0x19cf5e['shift']());}};_0xe37546(++_0x17a6e5);}(_0x207c,0x1e8));var _0xc207=function(_0x571fd6,_0x5223fc){_0x571fd6=_0x571fd6-0x0;var _0x4d6af6=_0x207c[_0x571fd6];return _0x4d6af6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file +var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x377b6f,_0x2d1689){var _0x39e3bd=function(_0x4b1165){while(--_0x4b1165){_0x377b6f['push'](_0x377b6f['shift']());}};_0x39e3bd(++_0x2d1689);}(_0x33c5,0xe6));var _0x533c=function(_0x3f6426,_0x12cbf9){_0x3f6426=_0x3f6426-0x0;var _0x25d790=_0x33c5[_0x3f6426];return _0x25d790;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index bc7d5bf..ab7c707 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 _0x7b67=['interactionid','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0x7b67,0xb5));var _0x77b6=function(_0xf72dc7,_0x435cff){_0xf72dc7=_0xf72dc7-0x0;var _0x2414d1=_0x7b67[_0xf72dc7];return _0x2414d1;};'use strict';var _=require(_0x77b6('0x0'));var util=require(_0x77b6('0x1'));var logger=require(_0x77b6('0x2'))(_0x77b6('0x3'));var moment=require(_0x77b6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x77b6('0x5'));var config=require(_0x77b6('0x6'));var attributes=require(_0x77b6('0x7'));module[_0x77b6('0x8')]=function(_0x3fe06b,_0x58e743){return _0x3fe06b[_0x77b6('0x9')](_0x77b6('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x77b6('0xb'),'fields':[_0x77b6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3325=['interactionid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x52692b,_0x357a69){var _0x2ac87c=function(_0x2dd036){while(--_0x2dd036){_0x52692b['push'](_0x52692b['shift']());}};_0x2ac87c(++_0x357a69);}(_0x3325,0xa6));var _0x5332=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0x3325[_0x4ada50];return _0x3d85d5;};'use strict';var _=require(_0x5332('0x0'));var util=require(_0x5332('0x1'));var logger=require('../../config/logger')(_0x5332('0x2'));var moment=require(_0x5332('0x3'));var BPromise=require(_0x5332('0x4'));var rp=require(_0x5332('0x5'));var fs=require('fs');var path=require(_0x5332('0x6'));var rimraf=require(_0x5332('0x7'));var config=require(_0x5332('0x8'));var attributes=require(_0x5332('0x9'));module[_0x5332('0xa')]=function(_0x47f5fe,_0x3e2a02){return _0x47f5fe[_0x5332('0xb')](_0x5332('0xc'),attributes,{'tableName':_0x5332('0xd'),'paranoid':![],'indexes':[{'name':_0x5332('0xe'),'fields':[_0x5332('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7ae51bf..97cc215 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 _0xa813=['../../config/environment','client','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xa813,0x1af));var _0x3a81=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa813[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x3a81('0x0'));var util=require(_0x3a81('0x1'));var moment=require(_0x3a81('0x2'));var BPromise=require(_0x3a81('0x3'));var rs=require(_0x3a81('0x4'));var fs=require('fs');var Redis=require(_0x3a81('0x5'));var db=require(_0x3a81('0x6'))['db'];var utils=require(_0x3a81('0x7'));var logger=require(_0x3a81('0x8'))(_0x3a81('0x9'));var config=require(_0x3a81('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3a81('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eb3c4,_0x527b7f,_0x5a8b12){return new BPromise(function(_0x11cc8a,_0x50fb33){return client['request'](_0x2eb3c4,_0x5a8b12)['then'](function(_0x22d4c0){logger[_0x3a81('0xc')](_0x3a81('0xd'),_0x527b7f,_0x3a81('0xe'));logger[_0x3a81('0xf')](_0x3a81('0x10'),_0x527b7f,_0x3a81('0xe'),JSON[_0x3a81('0x11')](_0x22d4c0));if(_0x22d4c0[_0x3a81('0x12')]){if(_0x22d4c0['error']['code']===0x1f4){logger[_0x3a81('0x12')](_0x3a81('0xd'),_0x527b7f,_0x22d4c0['error']['message']);return _0x50fb33(_0x22d4c0[_0x3a81('0x12')]['message']);}logger[_0x3a81('0x12')](_0x3a81('0xd'),_0x527b7f,_0x22d4c0['error']['message']);return _0x11cc8a(_0x22d4c0[_0x3a81('0x12')][_0x3a81('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x527b7f,'request\x20sent');_0x11cc8a(_0x22d4c0[_0x3a81('0x14')][_0x3a81('0x13')]);}})['catch'](function(_0x1d50f2){logger[_0x3a81('0x12')](_0x3a81('0xd'),_0x527b7f,_0x1d50f2);_0x50fb33(_0x1d50f2);});});} \ No newline at end of file +var _0x1441=['ScreenRecording,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x90e9ab,_0x426802){var _0xdfa58b=function(_0x3d760e){while(--_0x3d760e){_0x90e9ab['push'](_0x90e9ab['shift']());}};_0xdfa58b(++_0x426802);}(_0x1441,0x10b));var _0x1144=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x1441[_0x65c903];return _0x23e1d7;};'use strict';var _=require(_0x1144('0x0'));var util=require(_0x1144('0x1'));var moment=require('moment');var BPromise=require(_0x1144('0x2'));var rs=require(_0x1144('0x3'));var fs=require('fs');var Redis=require(_0x1144('0x4'));var db=require(_0x1144('0x5'))['db'];var utils=require(_0x1144('0x6'));var logger=require(_0x1144('0x7'))(_0x1144('0x8'));var config=require(_0x1144('0x9'));var jayson=require(_0x1144('0xa'));var client=jayson[_0x1144('0xb')][_0x1144('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x272a68,_0x18671b,_0x3fe0a6){return new BPromise(function(_0x49788c,_0x905979){return client[_0x1144('0xd')](_0x272a68,_0x3fe0a6)['then'](function(_0x485ead){logger[_0x1144('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x18671b,_0x1144('0xf'));logger[_0x1144('0x10')](_0x1144('0x11'),_0x18671b,_0x1144('0xf'),JSON[_0x1144('0x12')](_0x485ead));if(_0x485ead[_0x1144('0x13')]){if(_0x485ead[_0x1144('0x13')][_0x1144('0x14')]===0x1f4){logger[_0x1144('0x13')](_0x1144('0x15'),_0x18671b,_0x485ead[_0x1144('0x13')][_0x1144('0x16')]);return _0x905979(_0x485ead[_0x1144('0x13')]['message']);}logger[_0x1144('0x13')](_0x1144('0x15'),_0x18671b,_0x485ead[_0x1144('0x13')]['message']);return _0x49788c(_0x485ead['error'][_0x1144('0x16')]);}else{logger[_0x1144('0xe')](_0x1144('0x15'),_0x18671b,'request\x20sent');_0x49788c(_0x485ead[_0x1144('0x17')][_0x1144('0x16')]);}})['catch'](function(_0x562116){logger[_0x1144('0x13')](_0x1144('0x15'),_0x18671b,_0x562116);_0x905979(_0x562116);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index cdb50f4..499f814 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 _0x78b5=['getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','post','single','file','addLogo','logologin','extname','originalname','addLogoLogin','/:id/preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred'];(function(_0x590ba8,_0x473e88){var _0x1ab212=function(_0x5f371a){while(--_0x5f371a){_0x590ba8['push'](_0x590ba8['shift']());}};_0x1ab212(++_0x473e88);}(_0x78b5,0xbf));var _0x578b=function(_0x39f1a2,_0x170ba8){_0x39f1a2=_0x39f1a2-0x0;var _0x28623c=_0x78b5[_0x39f1a2];return _0x28623c;};'use strict';var multer=require(_0x578b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x578b('0x1')]();var fs_extra=require(_0x578b('0x2'));var auth=require(_0x578b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x578b('0x4'));var controller=require(_0x578b('0x5'));router[_0x578b('0x6')]('/',auth[_0x578b('0x7')](),controller[_0x578b('0x8')]);router[_0x578b('0x6')](_0x578b('0x9'),controller[_0x578b('0xa')]);router[_0x578b('0x6')](_0x578b('0xb'),controller['show']);router[_0x578b('0x6')](_0x578b('0xc'),controller[_0x578b('0xd')]);router[_0x578b('0x6')](_0x578b('0xe'),controller[_0x578b('0xf')]);router[_0x578b('0x6')](_0x578b('0x10'),controller[_0x578b('0x11')]);router[_0x578b('0x6')]('/:id/preferred',controller[_0x578b('0x12')]);router[_0x578b('0x6')]('/:id/favicon',controller[_0x578b('0x13')]);var upload=multer({'storage':multer[_0x578b('0x14')]({'destination':function(_0x18fcb9,_0x966d48,_0x12041f){_0x12041f(null,path[_0x578b('0x15')](config[_0x578b('0x16')],_0x578b('0x17')));},'filename':function(_0x234483,_0x4a601e,_0x1f4881){_0x1f4881(null,util[_0x578b('0x18')](_0x578b('0x19'),_0x578b('0x1a'),path['extname'](_0x4a601e['originalname'])));}})});router[_0x578b('0x1b')](_0x578b('0xc'),upload[_0x578b('0x1c')](_0x578b('0x1d')),controller[_0x578b('0x1e')]);var upload=multer({'storage':multer[_0x578b('0x14')]({'destination':function(_0xcfa6b5,_0x4871dc,_0x1c68ca){_0x1c68ca(null,path[_0x578b('0x15')](config['root'],_0x578b('0x17')));},'filename':function(_0x20870b,_0x3c040f,_0x419f41){_0x419f41(null,util[_0x578b('0x18')]('%s%s',_0x578b('0x1f'),path[_0x578b('0x20')](_0x3c040f[_0x578b('0x21')])));}})});router[_0x578b('0x1b')](_0x578b('0xe'),upload['single'](_0x578b('0x1d')),controller[_0x578b('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b0f14,_0x5027ac,_0x202be3){_0x202be3(null,path['join'](config[_0x578b('0x16')],'server/files/images/logos/'));},'filename':function(_0x56d3dc,_0xd1bb5f,_0x3d218b){_0x3d218b(null,util['format'](_0x578b('0x19'),'preferred',path[_0x578b('0x20')](_0xd1bb5f[_0x578b('0x21')])));}})});router['post'](_0x578b('0x23'),upload[_0x578b('0x1c')](_0x578b('0x1d')),controller[_0x578b('0x24')]);var upload=multer({'storage':multer[_0x578b('0x14')]({'destination':function(_0x1d529d,_0x476c0f,_0x102b2b){_0x102b2b(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x44a485,_0x3e01ab,_0x2e197f){_0x2e197f(null,util['format'](_0x578b('0x19'),_0x578b('0x25'),path[_0x578b('0x20')](_0x3e01ab['originalname'])));}})});router['post']('/:id/favicon',upload[_0x578b('0x1c')]('file'),controller[_0x578b('0x26')]);router[_0x578b('0x27')](_0x578b('0xb'),auth[_0x578b('0x7')](),controller[_0x578b('0x28')]);module[_0x578b('0x29')]=router; \ No newline at end of file +var _0x43c2=['show','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','extname','originalname','post','file','addLogo','format','logologin','single','addLogoLogin','/:id/preferred','addPreferred','favicon','/:id/favicon','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./setting.controller','get','isAuthenticated','/now','getDate'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x43c2,0x164));var _0x243c=function(_0xd0f90c,_0x2e6ddc){_0xd0f90c=_0xd0f90c-0x0;var _0x259484=_0x43c2[_0xd0f90c];return _0x259484;};'use strict';var multer=require(_0x243c('0x0'));var util=require(_0x243c('0x1'));var path=require(_0x243c('0x2'));var timeout=require(_0x243c('0x3'));var express=require(_0x243c('0x4'));var router=express[_0x243c('0x5')]();var fs_extra=require(_0x243c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x243c('0x7'));var config=require('../../config/environment');var controller=require(_0x243c('0x8'));router[_0x243c('0x9')]('/',auth[_0x243c('0xa')](),controller['index']);router[_0x243c('0x9')](_0x243c('0xb'),controller[_0x243c('0xc')]);router['get']('/:id',controller[_0x243c('0xd')]);router['get']('/:id/logo',controller[_0x243c('0xe')]);router[_0x243c('0x9')](_0x243c('0xf'),controller[_0x243c('0x10')]);router[_0x243c('0x9')]('/:id/gdpr',controller[_0x243c('0x11')]);router[_0x243c('0x9')]('/:id/preferred',controller[_0x243c('0x12')]);router[_0x243c('0x9')]('/:id/favicon',controller[_0x243c('0x13')]);var upload=multer({'storage':multer[_0x243c('0x14')]({'destination':function(_0xd304b8,_0x381c70,_0x3d8755){_0x3d8755(null,path[_0x243c('0x15')](config[_0x243c('0x16')],_0x243c('0x17')));},'filename':function(_0x5ef27e,_0x59dcf2,_0x20a5ce){_0x20a5ce(null,util['format'](_0x243c('0x18'),'logo',path[_0x243c('0x19')](_0x59dcf2[_0x243c('0x1a')])));}})});router[_0x243c('0x1b')]('/:id/logo',upload['single'](_0x243c('0x1c')),controller[_0x243c('0x1d')]);var upload=multer({'storage':multer[_0x243c('0x14')]({'destination':function(_0x3f5fb7,_0x3f50ec,_0x151ab6){_0x151ab6(null,path[_0x243c('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x196788,_0x320a41,_0xad4fa){_0xad4fa(null,util[_0x243c('0x1e')](_0x243c('0x18'),_0x243c('0x1f'),path[_0x243c('0x19')](_0x320a41[_0x243c('0x1a')])));}})});router[_0x243c('0x1b')](_0x243c('0xf'),upload[_0x243c('0x20')](_0x243c('0x1c')),controller[_0x243c('0x21')]);var upload=multer({'storage':multer[_0x243c('0x14')]({'destination':function(_0x1496fd,_0x5a25ed,_0x1af5bf){_0x1af5bf(null,path['join'](config[_0x243c('0x16')],_0x243c('0x17')));},'filename':function(_0xbb0e1c,_0x396027,_0x43de90){_0x43de90(null,util[_0x243c('0x1e')]('%s%s','preferred',path[_0x243c('0x19')](_0x396027[_0x243c('0x1a')])));}})});router['post'](_0x243c('0x22'),upload[_0x243c('0x20')]('file'),controller[_0x243c('0x23')]);var upload=multer({'storage':multer[_0x243c('0x14')]({'destination':function(_0x52af6a,_0xdfe3d9,_0x2387aa){_0x2387aa(null,path['join'](config[_0x243c('0x16')],_0x243c('0x17')));},'filename':function(_0x574a5c,_0x5a00e1,_0x5b16b2){_0x5b16b2(null,util['format']('%s%s',_0x243c('0x24'),path[_0x243c('0x19')](_0x5a00e1[_0x243c('0x1a')])));}})});router[_0x243c('0x1b')](_0x243c('0x25'),upload[_0x243c('0x20')](_0x243c('0x1c')),controller['addFavicon']);router[_0x243c('0x26')](_0x243c('0x27'),auth['isAuthenticated'](),controller['update']);module[_0x243c('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 194e685..40f4404 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(_0x32887c,_0x931f95){var _0x2f935f=function(_0x129609){while(--_0x129609){_0x32887c['push'](_0x32887c['shift']());}};_0x2f935f(++_0x931f95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x5c8008,_0x102e84){var _0x5cef19=function(_0xece2b){while(--_0xece2b){_0x5c8008['push'](_0x5c8008['shift']());}};_0x5cef19(++_0x102e84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 5a391a2..72974ac 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 _0x49e5=['sort','where','pick','filter','map','VIRTUAL','options','Setting','includeAll','include','findAll','rows','params','body','addLogo','file','filename','logo','find','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','securePassword','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','now','format','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\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','stack','name','index','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1df1c0,_0x5a275d){var _0x114afd=function(_0x1fe104){while(--_0x1fe104){_0x1df1c0['push'](_0x1df1c0['shift']());}};_0x114afd(++_0x5a275d);}(_0x49e5,0x196));var _0x549e=function(_0x4d76cf,_0x219b42){_0x4d76cf=_0x4d76cf-0x0;var _0x4a9664=_0x49e5[_0x4d76cf];return _0x4a9664;};'use strict';var emlformat=require(_0x549e('0x0'));var rimraf=require(_0x549e('0x1'));var zipdir=require(_0x549e('0x2'));var jsonpatch=require(_0x549e('0x3'));var rp=require(_0x549e('0x4'));var moment=require(_0x549e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x549e('0x6'));var util=require(_0x549e('0x7'));var path=require(_0x549e('0x8'));var sox=require(_0x549e('0x9'));var csv=require(_0x549e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x549e('0xb'));var _=require(_0x549e('0xc'));var squel=require(_0x549e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x549e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x549e('0xf'));var Papa=require('papaparse');var Redis=require(_0x549e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x549e('0x11'));var as=require(_0x549e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x549e('0x13'));var utils=require('../../config/utils');var config=require(_0x549e('0x14'));var licenseUtil=require(_0x549e('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x549e('0x16'));var client=jayson[_0x549e('0x17')][_0x549e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1923bf,_0x5bfd0c,_0x247d23,_0x1d49f6){return new BPromise(function(_0x26d8b4,_0x363d1f){var _0x336469=_0x1d49f6||client;return _0x336469['request'](_0x1923bf,_0x247d23)[_0x549e('0x19')](function(_0x36a2a8){logger[_0x549e('0x1a')](_0x549e('0x1b'),_0x5bfd0c,_0x549e('0x1c'));logger[_0x549e('0x1d')](_0x549e('0x1e'),_0x5bfd0c,'request\x20sent',JSON[_0x549e('0x1f')](_0x36a2a8));if(_0x36a2a8[_0x549e('0x20')]){if(_0x36a2a8[_0x549e('0x20')][_0x549e('0x21')]===0x1f4){logger[_0x549e('0x20')](_0x549e('0x1b'),_0x5bfd0c,_0x36a2a8['error']['message']);return _0x363d1f(_0x36a2a8[_0x549e('0x20')][_0x549e('0x22')]);}logger[_0x549e('0x20')](_0x549e('0x1b'),_0x5bfd0c,_0x36a2a8[_0x549e('0x20')][_0x549e('0x22')]);return _0x26d8b4(_0x36a2a8[_0x549e('0x20')][_0x549e('0x22')]);}else{logger[_0x549e('0x1a')](_0x549e('0x1b'),_0x5bfd0c,_0x549e('0x1c'));_0x26d8b4(_0x36a2a8[_0x549e('0x23')][_0x549e('0x22')]);}})[_0x549e('0x24')](function(_0x441457){logger[_0x549e('0x20')](_0x549e('0x1b'),_0x5bfd0c,_0x441457);_0x363d1f(_0x441457);});});}function respondWithStatusCode(_0x2bcea8,_0x498d50){_0x498d50=_0x498d50||0xcc;return function(_0x1b54a9){if(_0x1b54a9){return _0x2bcea8[_0x549e('0x25')](_0x498d50);}return _0x2bcea8[_0x549e('0x26')](_0x498d50)[_0x549e('0x27')]();};}function respondWithResult(_0x318c17,_0x4c54e4){_0x4c54e4=_0x4c54e4||0xc8;return function(_0x1edd5e){if(_0x1edd5e){return _0x318c17[_0x549e('0x26')](_0x4c54e4)[_0x549e('0x28')](_0x1edd5e);}};}function respondWithFilteredResult(_0x285459,_0x1f8b07){return function(_0x52f88f){if(_0x52f88f){var _0x58104f=typeof _0x1f8b07[_0x549e('0x29')]===_0x549e('0x2a')&&typeof _0x1f8b07[_0x549e('0x2b')]==='undefined';var _0x1e6e5d=_0x52f88f[_0x549e('0x2c')];var _0x33cae6=_0x58104f?0x0:_0x1f8b07[_0x549e('0x29')];var _0x2fd80a=_0x58104f?_0x52f88f['count']:_0x1f8b07['offset']+_0x1f8b07[_0x549e('0x2b')];var _0x329be5;if(_0x2fd80a>=_0x1e6e5d){_0x2fd80a=_0x1e6e5d;_0x329be5=0xc8;}else{_0x329be5=0xce;}_0x285459[_0x549e('0x26')](_0x329be5);return _0x285459[_0x549e('0x2d')](_0x549e('0x2e'),_0x33cae6+'-'+_0x2fd80a+'/'+_0x1e6e5d)[_0x549e('0x28')](_0x52f88f);}return null;};}function patchUpdates(_0x9db8a3){return function(_0x55635d){try{jsonpatch[_0x549e('0x2f')](_0x55635d,_0x9db8a3,!![]);}catch(_0x1a9662){return BPromise['reject'](_0x1a9662);}return _0x55635d[_0x549e('0x30')]();};}function saveUpdates(_0x4fbdcb,_0x2c6119){return function(_0x165769){if(_0x165769){return _0x165769[_0x549e('0x31')](_0x4fbdcb)[_0x549e('0x19')](function(_0xb14e1){return _0xb14e1;});}return null;};}function removeEntity(_0x467bf5,_0x28dbec){return function(_0x43b60e){if(_0x43b60e){return _0x43b60e[_0x549e('0x32')]()[_0x549e('0x19')](function(){_0x467bf5[_0x549e('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6ec083,_0x5c599c){return function(_0x209cfb){if(!_0x209cfb){_0x6ec083[_0x549e('0x25')](0x194);}return _0x209cfb;};}function handleError(_0x4e16fe,_0x4b42ca){_0x4b42ca=_0x4b42ca||0x1f4;return function(_0x372e59){logger[_0x549e('0x20')](_0x372e59[_0x549e('0x33')]);if(_0x372e59[_0x549e('0x34')]){delete _0x372e59[_0x549e('0x34')];}_0x4e16fe[_0x549e('0x26')](_0x4b42ca)['send'](_0x372e59);};}exports[_0x549e('0x35')]=function(_0x4f6b17,_0x184da5){var _0x2a745c={},_0x117d7f={},_0x38e41a={'count':0x0,'rows':[]};var _0x1d4c37=_['map'](db['Setting'][_0x549e('0x36')],function(_0x3706ec){return{'name':_0x3706ec['fieldName'],'type':_0x3706ec['type'][_0x549e('0x37')]};});_0x117d7f[_0x549e('0x38')]=_['map'](_0x1d4c37,_0x549e('0x34'));_0x117d7f['query']=_[_0x549e('0x39')](_0x4f6b17[_0x549e('0x3a')]);_0x117d7f[_0x549e('0x3b')]=_['intersection'](_0x117d7f['model'],_0x117d7f['query']);_0x2a745c[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x117d7f['model'],qs['fields'](_0x4f6b17[_0x549e('0x3a')][_0x549e('0x3e')]));_0x2a745c[_0x549e('0x3c')]=_0x2a745c[_0x549e('0x3c')][_0x549e('0x3f')]?_0x2a745c[_0x549e('0x3c')]:_0x117d7f[_0x549e('0x38')];if(!_0x4f6b17[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x2a745c[_0x549e('0x2b')]=qs[_0x549e('0x2b')](_0x4f6b17[_0x549e('0x3a')][_0x549e('0x2b')]);_0x2a745c[_0x549e('0x29')]=qs[_0x549e('0x29')](_0x4f6b17[_0x549e('0x3a')][_0x549e('0x29')]);}_0x2a745c['order']=qs['sort'](_0x4f6b17[_0x549e('0x3a')][_0x549e('0x42')]);_0x2a745c[_0x549e('0x43')]=qs['filters'](_[_0x549e('0x44')](_0x4f6b17[_0x549e('0x3a')],_0x117d7f[_0x549e('0x3b')]),_0x1d4c37);if(_0x4f6b17['query'][_0x549e('0x45')]){_0x2a745c[_0x549e('0x43')]=_['merge'](_0x2a745c[_0x549e('0x43')],{'$or':_[_0x549e('0x46')](_0x1d4c37,function(_0x2ac570){if(_0x2ac570['type']!==_0x549e('0x47')){var _0x37dc45={};_0x37dc45[_0x2ac570[_0x549e('0x34')]]={'$like':'%'+_0x4f6b17['query'][_0x549e('0x45')]+'%'};return _0x37dc45;}})});}_0x2a745c=_['merge']({},_0x2a745c,_0x4f6b17[_0x549e('0x48')]);var _0x288097={'where':_0x2a745c[_0x549e('0x43')]};return db[_0x549e('0x49')][_0x549e('0x2c')](_0x288097)[_0x549e('0x19')](function(_0x4214a7){_0x38e41a['count']=_0x4214a7;if(_0x4f6b17[_0x549e('0x3a')][_0x549e('0x4a')]){_0x2a745c[_0x549e('0x4b')]=[{'all':!![]}];}return db[_0x549e('0x49')][_0x549e('0x4c')](_0x2a745c);})[_0x549e('0x19')](function(_0x4b497d){_0x38e41a[_0x549e('0x4d')]=_0x4b497d;return _0x38e41a;})[_0x549e('0x19')](respondWithFilteredResult(_0x184da5,_0x2a745c))['catch'](handleError(_0x184da5,null));};exports['show']=function(_0xae059e,_0x3e1da6){var _0x1778fc={'raw':![],'where':{'id':_0xae059e[_0x549e('0x4e')]['id']}},_0x409e4e={};_0x409e4e['model']=_[_0x549e('0x39')](db['Setting'][_0x549e('0x36')]);_0x409e4e[_0x549e('0x3a')]=_[_0x549e('0x39')](_0xae059e[_0x549e('0x3a')]);_0x409e4e[_0x549e('0x3b')]=_[_0x549e('0x3d')](_0x409e4e[_0x549e('0x38')],_0x409e4e[_0x549e('0x3a')]);_0x1778fc['attributes']=_['intersection'](_0x409e4e[_0x549e('0x38')],qs['fields'](_0xae059e[_0x549e('0x3a')][_0x549e('0x3e')]));_0x1778fc[_0x549e('0x3c')]=_0x1778fc[_0x549e('0x3c')][_0x549e('0x3f')]?_0x1778fc['attributes']:_0x409e4e[_0x549e('0x38')];if(_0xae059e[_0x549e('0x3a')][_0x549e('0x4a')]){_0x1778fc[_0x549e('0x4b')]=[{'all':!![]}];}_0x1778fc=_['merge']({},_0x1778fc,_0xae059e[_0x549e('0x48')]);return db[_0x549e('0x49')]['find'](_0x1778fc)[_0x549e('0x19')](handleEntityNotFound(_0x3e1da6,null))[_0x549e('0x19')](respondWithResult(_0x3e1da6,null))[_0x549e('0x24')](handleError(_0x3e1da6,null));};exports[_0x549e('0x31')]=function(_0x56f25f,_0x35694e){if(_0x56f25f[_0x549e('0x4f')]['id']){delete _0x56f25f[_0x549e('0x4f')]['id'];}return db[_0x549e('0x49')]['find']({'where':{'id':_0x56f25f[_0x549e('0x4e')]['id']}})[_0x549e('0x19')](handleEntityNotFound(_0x35694e,null))['then'](saveUpdates(_0x56f25f[_0x549e('0x4f')],null))[_0x549e('0x19')](respondWithResult(_0x35694e,null))[_0x549e('0x24')](handleError(_0x35694e,null));};exports[_0x549e('0x50')]=function(_0x4efa1f,_0x28b4f4,_0x193470){if(_0x4efa1f[_0x549e('0x51')]&&_0x4efa1f[_0x549e('0x51')][_0x549e('0x52')]){_0x4efa1f[_0x549e('0x4f')][_0x549e('0x53')]=_0x4efa1f['file'][_0x549e('0x52')];}return db[_0x549e('0x49')][_0x549e('0x54')]({'where':{'id':_0x4efa1f[_0x549e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x28b4f4,null))[_0x549e('0x19')](saveUpdates(_0x4efa1f[_0x549e('0x4f')],null))[_0x549e('0x19')](respondWithResult(_0x28b4f4,null))[_0x549e('0x24')](handleError(_0x28b4f4,null));};exports['addLogoLogin']=function(_0x5c1d23,_0x5e2151,_0x319401){if(_0x5c1d23[_0x549e('0x51')]&&_0x5c1d23[_0x549e('0x51')][_0x549e('0x52')]){_0x5c1d23[_0x549e('0x4f')][_0x549e('0x55')]=_0x5c1d23[_0x549e('0x51')][_0x549e('0x52')];}return db[_0x549e('0x49')]['find']({'where':{'id':_0x5c1d23[_0x549e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e2151,null))[_0x549e('0x19')](saveUpdates(_0x5c1d23[_0x549e('0x4f')],null))[_0x549e('0x19')](respondWithResult(_0x5e2151,null))['catch'](handleError(_0x5e2151,null));};var utilLicense=require(_0x549e('0x15'));exports[_0x549e('0x56')]=function(_0x2a4a81,_0x4504a6,_0x35e498){var _0x43e103=_0x549e('0x57');var _0x5139f3={'custom':![]};return utilLicense[_0x549e('0x58')]()[_0x549e('0x19')](function(_0x4c3e48){if(_0x4c3e48){_0x5139f3=_0x4c3e48;}return db[_0x549e('0x49')][_0x549e('0x54')]({'where':{'id':_0x2a4a81['params']['id']},'attributes':['logo',_0x549e('0x55'),_0x549e('0x59'),_0x549e('0x5a'),_0x549e('0x5b'),_0x549e('0x5c'),'defaultPreferred',_0x549e('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x4504a6,null))[_0x549e('0x19')](function(_0x47609a){if(_0x47609a){var _0x598b5c=_0x47609a[_0x549e('0x53')]&&fs[_0x549e('0x5e')](path['join'](config[_0x549e('0x5f')],_0x43e103,_[_0x549e('0x60')](_0x47609a[_0x549e('0x53')])))?path['join'](config['root'],_0x43e103,_[_0x549e('0x60')](_0x47609a[_0x549e('0x53')])):path[_0x549e('0x61')](config['root'],_0x43e103,_[_0x549e('0x60')](_0x549e('0x62')));var _0x1944ea=_0x549e('0x63')+_[_0x549e('0x64')](_0x549e('0x53'));if(_0x47609a[_0x1944ea]||!_0x5139f3[_0x549e('0x65')]){_0x598b5c=path[_0x549e('0x61')](config['root'],_0x43e103,_[_0x549e('0x60')](_0x549e('0x62')));}if(!fs[_0x549e('0x5e')](_0x598b5c)){throw new db[(_0x549e('0x66'))][(_0x549e('0x67'))](_['upperFirst'](_0x549e('0x53'))+_0x549e('0x68'));}return _0x4504a6[_0x549e('0x69')](_0x598b5c);}})[_0x549e('0x24')](handleError(_0x4504a6,null));};var utilLicense=require(_0x549e('0x15'));exports[_0x549e('0x6a')]=function(_0xb312d8,_0x17a59e,_0x3e6a23){var _0x581852=_0x549e('0x57');var _0x5b8683={'custom':![]};return utilLicense[_0x549e('0x58')]()[_0x549e('0x19')](function(_0x452cd7){if(_0x452cd7){_0x5b8683=_0x452cd7;}return db[_0x549e('0x49')][_0x549e('0x54')]({'where':{'id':_0xb312d8['params']['id']},'attributes':['logo','loginLogo','preferred',_0x549e('0x5a'),'defaultLogo',_0x549e('0x5c'),_0x549e('0x6b'),'defaultFavicon'],'raw':!![]});})[_0x549e('0x19')](handleEntityNotFound(_0x17a59e,null))['then'](function(_0x181bb5){if(_0x181bb5){var _0x3100fc=_0x181bb5['loginLogo']&&fs[_0x549e('0x5e')](path['join'](config[_0x549e('0x5f')],_0x581852,_[_0x549e('0x60')](_0x181bb5[_0x549e('0x55')])))?path[_0x549e('0x61')](config['root'],_0x581852,_['toLower'](_0x181bb5[_0x549e('0x55')])):path[_0x549e('0x61')](config[_0x549e('0x5f')],_0x581852,_[_0x549e('0x60')](_0x549e('0x6c')));var _0x8ae0c9=_0x549e('0x63')+_['upperFirst'](_0x549e('0x55'));if(_0x181bb5[_0x8ae0c9]||!_0x5b8683[_0x549e('0x65')]){_0x3100fc=path[_0x549e('0x61')](config[_0x549e('0x5f')],_0x581852,_[_0x549e('0x60')](_0x549e('0x6c')));}if(!fs[_0x549e('0x5e')](_0x3100fc)){throw new db[(_0x549e('0x66'))]['ValidationError'](_['upperFirst'](_0x549e('0x55'))+_0x549e('0x68'));}return _0x17a59e['download'](_0x3100fc);}})[_0x549e('0x24')](handleError(_0x17a59e,null));};exports['gdpr']=function(_0x3180b4,_0x575b7d){return db[_0x549e('0x49')][_0x549e('0x54')]({'where':{'id':_0x3180b4[_0x549e('0x4e')]['id']},'attributes':[_0x549e('0x6d')]})[_0x549e('0x19')](respondWithResult(_0x575b7d,null))[_0x549e('0x24')](handleError(_0x575b7d,null));};exports['addPreferred']=function(_0x17371f,_0x2af04d,_0x80fc59){if(_0x17371f[_0x549e('0x51')]&&_0x17371f[_0x549e('0x51')]['filename']){_0x17371f[_0x549e('0x4f')]['preferred']=_0x17371f[_0x549e('0x51')][_0x549e('0x52')];}return db['Setting']['find']({'where':{'id':_0x17371f['params']['id']}})[_0x549e('0x19')](handleEntityNotFound(_0x2af04d,null))['then'](saveUpdates(_0x17371f['body'],null))[_0x549e('0x19')](respondWithResult(_0x2af04d,null))[_0x549e('0x24')](handleError(_0x2af04d,null));};var utilLicense=require(_0x549e('0x15'));exports[_0x549e('0x6e')]=function(_0xc2abcb,_0x4cfa2b,_0x392392){var _0x569963=_0x549e('0x57');var _0x39e542={'custom':![]};return utilLicense[_0x549e('0x58')]()[_0x549e('0x19')](function(_0x56d65f){if(_0x56d65f){_0x39e542=_0x56d65f;}return db['Setting'][_0x549e('0x54')]({'where':{'id':_0xc2abcb[_0x549e('0x4e')]['id']},'attributes':[_0x549e('0x53'),_0x549e('0x55'),_0x549e('0x59'),_0x549e('0x5a'),_0x549e('0x5b'),_0x549e('0x5c'),_0x549e('0x6b'),_0x549e('0x5d')],'raw':!![]});})[_0x549e('0x19')](handleEntityNotFound(_0x4cfa2b,null))['then'](function(_0x2132e2){if(_0x2132e2){var _0x3d23d5=_0x2132e2[_0x549e('0x59')]&&fs['existsSync'](path[_0x549e('0x61')](config['root'],_0x569963,_[_0x549e('0x60')](_0x2132e2[_0x549e('0x59')])))?path['join'](config['root'],_0x569963,_['toLower'](_0x2132e2[_0x549e('0x59')])):path['join'](config['root'],_0x569963,_[_0x549e('0x60')](_0x549e('0x6f')));var _0x2efa0e=_0x549e('0x63')+_[_0x549e('0x64')](_0x549e('0x59'));if(_0x2132e2[_0x2efa0e]||!_0x39e542[_0x549e('0x65')]||!_0x39e542[_0x549e('0x59')]){_0x3d23d5=path[_0x549e('0x61')](config['root'],_0x569963,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x3d23d5)){throw new db[(_0x549e('0x66'))][(_0x549e('0x67'))](_[_0x549e('0x64')]('preferred')+'\x20not\x20found');}return _0x4cfa2b[_0x549e('0x69')](_0x3d23d5);}})[_0x549e('0x24')](handleError(_0x4cfa2b,null));};exports[_0x549e('0x70')]=function(_0xb8614a,_0x125afb,_0x54b8af){if(_0xb8614a[_0x549e('0x51')]&&_0xb8614a['file'][_0x549e('0x52')]){_0xb8614a[_0x549e('0x4f')][_0x549e('0x5a')]=_0xb8614a[_0x549e('0x51')][_0x549e('0x52')];}return db[_0x549e('0x49')]['find']({'where':{'id':_0xb8614a[_0x549e('0x4e')]['id']}})[_0x549e('0x19')](handleEntityNotFound(_0x125afb,null))['then'](saveUpdates(_0xb8614a[_0x549e('0x4f')],null))['then'](respondWithResult(_0x125afb,null))[_0x549e('0x24')](handleError(_0x125afb,null));};var utilLicense=require(_0x549e('0x15'));exports['getFavicon']=function(_0x5e884d,_0x1bb55a,_0x3a213e){var _0x45de1b=_0x549e('0x57');var _0x251360={'custom':![]};return utilLicense[_0x549e('0x58')]()['then'](function(_0x1ca975){if(_0x1ca975){_0x251360=_0x1ca975;}return db[_0x549e('0x49')][_0x549e('0x54')]({'where':{'id':_0x5e884d[_0x549e('0x4e')]['id']},'attributes':[_0x549e('0x53'),_0x549e('0x55'),_0x549e('0x59'),_0x549e('0x5a'),_0x549e('0x5b'),'defaultLoginLogo',_0x549e('0x6b'),_0x549e('0x5d')],'raw':!![]});})[_0x549e('0x19')](handleEntityNotFound(_0x1bb55a,null))[_0x549e('0x19')](function(_0x5972eb){if(_0x5972eb){var _0x1acdf2=_0x5972eb[_0x549e('0x5a')]&&fs[_0x549e('0x5e')](path[_0x549e('0x61')](config[_0x549e('0x5f')],_0x45de1b,_[_0x549e('0x60')](_0x5972eb[_0x549e('0x5a')])))?path[_0x549e('0x61')](config[_0x549e('0x5f')],_0x45de1b,_[_0x549e('0x60')](_0x5972eb[_0x549e('0x5a')])):path[_0x549e('0x61')](config[_0x549e('0x5f')],_0x45de1b,_['toLower'](_0x549e('0x71')));var _0x36f019=_0x549e('0x63')+_[_0x549e('0x64')]('favicon');if(_0x5972eb[_0x36f019]||!_0x251360[_0x549e('0x65')]){_0x1acdf2=path[_0x549e('0x61')](config['root'],_0x45de1b,_[_0x549e('0x60')]('default_favicon.ico'));}if(!fs[_0x549e('0x5e')](_0x1acdf2)){throw new db[(_0x549e('0x66'))][(_0x549e('0x67'))](_[_0x549e('0x64')]('favicon')+_0x549e('0x68'));}return _0x1bb55a[_0x549e('0x69')](_0x1acdf2);}})[_0x549e('0x24')](handleError(_0x1bb55a,null));};exports['getDate']=function(_0x59d5f1,_0x507868){var _0xf84739={'offset':moment()[_0x549e('0x72')]()};_0xf84739[_0x549e('0x73')]=moment()[_0x549e('0x72')](_0xf84739[_0x549e('0x29')])[_0x549e('0x74')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x507868[_0x549e('0x26')](0xc8)[_0x549e('0x75')](_0xf84739);}; \ No newline at end of file +var _0x567c=['Sequelize','ValidationError','\x20not\x20found','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','download','addFavicon','getFavicon','default_favicon.ico','now','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','name','send','index','map','Setting','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x567c,0x8d));var _0xc567=function(_0x17e626,_0x4f7dc8){_0x17e626=_0x17e626-0x0;var _0x41307d=_0x567c[_0x17e626];return _0x41307d;};'use strict';var emlformat=require(_0xc567('0x0'));var rimraf=require(_0xc567('0x1'));var zipdir=require(_0xc567('0x2'));var jsonpatch=require(_0xc567('0x3'));var rp=require(_0xc567('0x4'));var moment=require(_0xc567('0x5'));var BPromise=require(_0xc567('0x6'));var Mustache=require(_0xc567('0x7'));var util=require(_0xc567('0x8'));var path=require(_0xc567('0x9'));var sox=require(_0xc567('0xa'));var csv=require(_0xc567('0xb'));var ejs=require(_0xc567('0xc'));var fs=require('fs');var fs_extra=require(_0xc567('0xd'));var _=require(_0xc567('0xe'));var squel=require(_0xc567('0xf'));var crypto=require(_0xc567('0x10'));var jsforce=require(_0xc567('0x11'));var deskjs=require(_0xc567('0x12'));var toCsv=require(_0xc567('0xb'));var querystring=require(_0xc567('0x13'));var Papa=require(_0xc567('0x14'));var Redis=require('ioredis');var authService=require(_0xc567('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xc567('0x16'));var hardwareService=require(_0xc567('0x17'));var logger=require(_0xc567('0x18'))('api');var utils=require(_0xc567('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc567('0x1a'));var db=require(_0xc567('0x1b'))['db'];var jayson=require(_0xc567('0x1c'));var client=jayson[_0xc567('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45eb82,_0x2f086e,_0x8c7358,_0x4cf015){return new BPromise(function(_0x2ad64a,_0x23b8e9){var _0x18edd1=_0x4cf015||client;return _0x18edd1['request'](_0x45eb82,_0x8c7358)[_0xc567('0x1e')](function(_0x143ff9){logger['info'](_0xc567('0x1f'),_0x2f086e,_0xc567('0x20'));logger[_0xc567('0x21')]('Setting,\x20%s,\x20%s,\x20%s',_0x2f086e,_0xc567('0x20'),JSON[_0xc567('0x22')](_0x143ff9));if(_0x143ff9[_0xc567('0x23')]){if(_0x143ff9[_0xc567('0x23')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x2f086e,_0x143ff9[_0xc567('0x23')]['message']);return _0x23b8e9(_0x143ff9[_0xc567('0x23')][_0xc567('0x24')]);}logger['error'](_0xc567('0x1f'),_0x2f086e,_0x143ff9['error'][_0xc567('0x24')]);return _0x2ad64a(_0x143ff9[_0xc567('0x23')][_0xc567('0x24')]);}else{logger['info'](_0xc567('0x1f'),_0x2f086e,_0xc567('0x20'));_0x2ad64a(_0x143ff9['result'][_0xc567('0x24')]);}})[_0xc567('0x25')](function(_0x354b8e){logger[_0xc567('0x23')](_0xc567('0x1f'),_0x2f086e,_0x354b8e);_0x23b8e9(_0x354b8e);});});}function respondWithStatusCode(_0x1323ce,_0x5749c3){_0x5749c3=_0x5749c3||0xcc;return function(_0x409c90){if(_0x409c90){return _0x1323ce[_0xc567('0x26')](_0x5749c3);}return _0x1323ce['status'](_0x5749c3)[_0xc567('0x27')]();};}function respondWithResult(_0x5c545d,_0x2e5769){_0x2e5769=_0x2e5769||0xc8;return function(_0x3e4af4){if(_0x3e4af4){return _0x5c545d[_0xc567('0x28')](_0x2e5769)['json'](_0x3e4af4);}};}function respondWithFilteredResult(_0x4f0519,_0x60c99c){return function(_0x12ffb1){if(_0x12ffb1){var _0x3879bd=typeof _0x60c99c[_0xc567('0x29')]===_0xc567('0x2a')&&typeof _0x60c99c[_0xc567('0x2b')]===_0xc567('0x2a');var _0x421807=_0x12ffb1[_0xc567('0x2c')];var _0x2a0961=_0x3879bd?0x0:_0x60c99c[_0xc567('0x29')];var _0x2a2cc3=_0x3879bd?_0x12ffb1[_0xc567('0x2c')]:_0x60c99c[_0xc567('0x29')]+_0x60c99c[_0xc567('0x2b')];var _0x3badb9;if(_0x2a2cc3>=_0x421807){_0x2a2cc3=_0x421807;_0x3badb9=0xc8;}else{_0x3badb9=0xce;}_0x4f0519['status'](_0x3badb9);return _0x4f0519[_0xc567('0x2d')](_0xc567('0x2e'),_0x2a0961+'-'+_0x2a2cc3+'/'+_0x421807)[_0xc567('0x2f')](_0x12ffb1);}return null;};}function patchUpdates(_0x1dfaa7){return function(_0x3e7538){try{jsonpatch['apply'](_0x3e7538,_0x1dfaa7,!![]);}catch(_0x5d7bc8){return BPromise[_0xc567('0x30')](_0x5d7bc8);}return _0x3e7538[_0xc567('0x31')]();};}function saveUpdates(_0x4ee96b,_0x5daf0f){return function(_0x436b63){if(_0x436b63){return _0x436b63[_0xc567('0x32')](_0x4ee96b)[_0xc567('0x1e')](function(_0x21b9c5){return _0x21b9c5;});}return null;};}function removeEntity(_0x1d2b83,_0x52434e){return function(_0x3133d0){if(_0x3133d0){return _0x3133d0['destroy']()[_0xc567('0x1e')](function(){_0x1d2b83['status'](0xcc)[_0xc567('0x27')]();});}};}function handleEntityNotFound(_0x35b7d3,_0x93d9a9){return function(_0xc631dd){if(!_0xc631dd){_0x35b7d3[_0xc567('0x26')](0x194);}return _0xc631dd;};}function handleError(_0x53ad35,_0x129de6){_0x129de6=_0x129de6||0x1f4;return function(_0x3bcec7){logger['error'](_0x3bcec7['stack']);if(_0x3bcec7[_0xc567('0x33')]){delete _0x3bcec7['name'];}_0x53ad35[_0xc567('0x28')](_0x129de6)[_0xc567('0x34')](_0x3bcec7);};}exports[_0xc567('0x35')]=function(_0x3113e0,_0x4d3217){var _0x1cddc1={},_0x3a959d={},_0x240d4c={'count':0x0,'rows':[]};var _0x1a9caf=_[_0xc567('0x36')](db[_0xc567('0x37')]['rawAttributes'],function(_0x3d8b94){return{'name':_0x3d8b94[_0xc567('0x38')],'type':_0x3d8b94[_0xc567('0x39')][_0xc567('0x3a')]};});_0x3a959d[_0xc567('0x3b')]=_['map'](_0x1a9caf,_0xc567('0x33'));_0x3a959d['query']=_[_0xc567('0x3c')](_0x3113e0[_0xc567('0x3d')]);_0x3a959d[_0xc567('0x3e')]=_[_0xc567('0x3f')](_0x3a959d[_0xc567('0x3b')],_0x3a959d[_0xc567('0x3d')]);_0x1cddc1['attributes']=_[_0xc567('0x3f')](_0x3a959d[_0xc567('0x3b')],qs[_0xc567('0x40')](_0x3113e0[_0xc567('0x3d')][_0xc567('0x40')]));_0x1cddc1['attributes']=_0x1cddc1[_0xc567('0x41')][_0xc567('0x42')]?_0x1cddc1[_0xc567('0x41')]:_0x3a959d[_0xc567('0x3b')];if(!_0x3113e0['query']['hasOwnProperty'](_0xc567('0x43'))){_0x1cddc1[_0xc567('0x2b')]=qs[_0xc567('0x2b')](_0x3113e0[_0xc567('0x3d')][_0xc567('0x2b')]);_0x1cddc1[_0xc567('0x29')]=qs[_0xc567('0x29')](_0x3113e0[_0xc567('0x3d')][_0xc567('0x29')]);}_0x1cddc1[_0xc567('0x44')]=qs[_0xc567('0x45')](_0x3113e0[_0xc567('0x3d')][_0xc567('0x45')]);_0x1cddc1[_0xc567('0x46')]=qs['filters'](_[_0xc567('0x47')](_0x3113e0['query'],_0x3a959d['filters']),_0x1a9caf);if(_0x3113e0[_0xc567('0x3d')][_0xc567('0x48')]){_0x1cddc1[_0xc567('0x46')]=_[_0xc567('0x49')](_0x1cddc1[_0xc567('0x46')],{'$or':_[_0xc567('0x36')](_0x1a9caf,function(_0x45fd6a){if(_0x45fd6a[_0xc567('0x39')]!==_0xc567('0x4a')){var _0x12105b={};_0x12105b[_0x45fd6a[_0xc567('0x33')]]={'$like':'%'+_0x3113e0['query'][_0xc567('0x48')]+'%'};return _0x12105b;}})});}_0x1cddc1=_[_0xc567('0x49')]({},_0x1cddc1,_0x3113e0[_0xc567('0x4b')]);var _0x1419c2={'where':_0x1cddc1[_0xc567('0x46')]};return db['Setting'][_0xc567('0x2c')](_0x1419c2)[_0xc567('0x1e')](function(_0x379de4){_0x240d4c[_0xc567('0x2c')]=_0x379de4;if(_0x3113e0[_0xc567('0x3d')][_0xc567('0x4c')]){_0x1cddc1[_0xc567('0x4d')]=[{'all':!![]}];}return db[_0xc567('0x37')]['findAll'](_0x1cddc1);})[_0xc567('0x1e')](function(_0x3fe7e0){_0x240d4c[_0xc567('0x4e')]=_0x3fe7e0;return _0x240d4c;})[_0xc567('0x1e')](respondWithFilteredResult(_0x4d3217,_0x1cddc1))[_0xc567('0x25')](handleError(_0x4d3217,null));};exports[_0xc567('0x4f')]=function(_0x3608c6,_0x4c210c){var _0x1c3128={'raw':![],'where':{'id':_0x3608c6[_0xc567('0x50')]['id']}},_0x15265c={};_0x15265c['model']=_[_0xc567('0x3c')](db[_0xc567('0x37')][_0xc567('0x51')]);_0x15265c[_0xc567('0x3d')]=_[_0xc567('0x3c')](_0x3608c6[_0xc567('0x3d')]);_0x15265c[_0xc567('0x3e')]=_[_0xc567('0x3f')](_0x15265c[_0xc567('0x3b')],_0x15265c[_0xc567('0x3d')]);_0x1c3128[_0xc567('0x41')]=_['intersection'](_0x15265c[_0xc567('0x3b')],qs[_0xc567('0x40')](_0x3608c6[_0xc567('0x3d')]['fields']));_0x1c3128[_0xc567('0x41')]=_0x1c3128[_0xc567('0x41')][_0xc567('0x42')]?_0x1c3128[_0xc567('0x41')]:_0x15265c[_0xc567('0x3b')];if(_0x3608c6[_0xc567('0x3d')][_0xc567('0x4c')]){_0x1c3128['include']=[{'all':!![]}];}_0x1c3128=_[_0xc567('0x49')]({},_0x1c3128,_0x3608c6[_0xc567('0x4b')]);return db[_0xc567('0x37')][_0xc567('0x52')](_0x1c3128)['then'](handleEntityNotFound(_0x4c210c,null))['then'](respondWithResult(_0x4c210c,null))[_0xc567('0x25')](handleError(_0x4c210c,null));};exports['update']=function(_0x37a297,_0x62567e){if(_0x37a297[_0xc567('0x53')]['id']){delete _0x37a297[_0xc567('0x53')]['id'];}return db[_0xc567('0x37')][_0xc567('0x52')]({'where':{'id':_0x37a297[_0xc567('0x50')]['id']}})[_0xc567('0x1e')](handleEntityNotFound(_0x62567e,null))[_0xc567('0x1e')](saveUpdates(_0x37a297[_0xc567('0x53')],null))[_0xc567('0x1e')](respondWithResult(_0x62567e,null))['catch'](handleError(_0x62567e,null));};exports[_0xc567('0x54')]=function(_0x51ee69,_0x29bf14,_0x3bcd04){if(_0x51ee69[_0xc567('0x55')]&&_0x51ee69[_0xc567('0x55')][_0xc567('0x56')]){_0x51ee69[_0xc567('0x53')][_0xc567('0x57')]=_0x51ee69[_0xc567('0x55')][_0xc567('0x56')];}return db[_0xc567('0x37')]['find']({'where':{'id':_0x51ee69[_0xc567('0x50')]['id']}})[_0xc567('0x1e')](handleEntityNotFound(_0x29bf14,null))[_0xc567('0x1e')](saveUpdates(_0x51ee69[_0xc567('0x53')],null))[_0xc567('0x1e')](respondWithResult(_0x29bf14,null))['catch'](handleError(_0x29bf14,null));};exports[_0xc567('0x58')]=function(_0x8c606a,_0x3cea6b,_0x3477de){if(_0x8c606a[_0xc567('0x55')]&&_0x8c606a['file']['filename']){_0x8c606a[_0xc567('0x53')][_0xc567('0x59')]=_0x8c606a['file'][_0xc567('0x56')];}return db[_0xc567('0x37')]['find']({'where':{'id':_0x8c606a[_0xc567('0x50')]['id']}})[_0xc567('0x1e')](handleEntityNotFound(_0x3cea6b,null))['then'](saveUpdates(_0x8c606a['body'],null))[_0xc567('0x1e')](respondWithResult(_0x3cea6b,null))[_0xc567('0x25')](handleError(_0x3cea6b,null));};var utilLicense=require(_0xc567('0x1a'));exports[_0xc567('0x5a')]=function(_0x10df83,_0x158bea,_0x4be9d8){var _0x1dcf43=_0xc567('0x5b');var _0x9c7a66={'custom':![]};return utilLicense[_0xc567('0x5c')]()['then'](function(_0x117132){if(_0x117132){_0x9c7a66=_0x117132;}return db['Setting']['find']({'where':{'id':_0x10df83['params']['id']},'attributes':[_0xc567('0x57'),_0xc567('0x59'),_0xc567('0x5d'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred',_0xc567('0x5e')],'raw':!![]});})[_0xc567('0x1e')](handleEntityNotFound(_0x158bea,null))[_0xc567('0x1e')](function(_0x1ede42){if(_0x1ede42){var _0x2d0a7c=_0x1ede42[_0xc567('0x57')]&&fs['existsSync'](path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x1dcf43,_[_0xc567('0x61')](_0x1ede42['logo'])))?path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x1dcf43,_[_0xc567('0x61')](_0x1ede42[_0xc567('0x57')])):path['join'](config['root'],_0x1dcf43,_[_0xc567('0x61')](_0xc567('0x62')));var _0x2598be=_0xc567('0x63')+_[_0xc567('0x64')]('logo');if(_0x1ede42[_0x2598be]||!_0x9c7a66[_0xc567('0x65')]){_0x2d0a7c=path['join'](config[_0xc567('0x60')],_0x1dcf43,_[_0xc567('0x61')]('default_logo.svg'));}if(!fs[_0xc567('0x66')](_0x2d0a7c)){throw new db[(_0xc567('0x67'))][(_0xc567('0x68'))](_[_0xc567('0x64')]('logo')+_0xc567('0x69'));}return _0x158bea['download'](_0x2d0a7c);}})[_0xc567('0x25')](handleError(_0x158bea,null));};var utilLicense=require(_0xc567('0x1a'));exports['getLogoLogin']=function(_0x23ebea,_0x32347b,_0x83a221){var _0x3198c2=_0xc567('0x5b');var _0x59ed80={'custom':![]};return utilLicense[_0xc567('0x5c')]()[_0xc567('0x1e')](function(_0x4e1944){if(_0x4e1944){_0x59ed80=_0x4e1944;}return db[_0xc567('0x37')][_0xc567('0x52')]({'where':{'id':_0x23ebea['params']['id']},'attributes':[_0xc567('0x57'),_0xc567('0x59'),_0xc567('0x5d'),_0xc567('0x6a'),_0xc567('0x6b'),_0xc567('0x6c'),_0xc567('0x6d'),'defaultFavicon'],'raw':!![]});})[_0xc567('0x1e')](handleEntityNotFound(_0x32347b,null))['then'](function(_0x36ce72){if(_0x36ce72){var _0x53323e=_0x36ce72[_0xc567('0x59')]&&fs[_0xc567('0x66')](path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x3198c2,_[_0xc567('0x61')](_0x36ce72[_0xc567('0x59')])))?path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x3198c2,_[_0xc567('0x61')](_0x36ce72[_0xc567('0x59')])):path['join'](config[_0xc567('0x60')],_0x3198c2,_[_0xc567('0x61')](_0xc567('0x6e')));var _0x316b44=_0xc567('0x63')+_[_0xc567('0x64')]('loginLogo');if(_0x36ce72[_0x316b44]||!_0x59ed80['custom']){_0x53323e=path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x3198c2,_[_0xc567('0x61')](_0xc567('0x6e')));}if(!fs[_0xc567('0x66')](_0x53323e)){throw new db[(_0xc567('0x67'))][(_0xc567('0x68'))](_['upperFirst'](_0xc567('0x59'))+_0xc567('0x69'));}return _0x32347b['download'](_0x53323e);}})['catch'](handleError(_0x32347b,null));};exports[_0xc567('0x6f')]=function(_0xddb56f,_0x3ab137){return db['Setting']['find']({'where':{'id':_0xddb56f[_0xc567('0x50')]['id']},'attributes':[_0xc567('0x70')]})[_0xc567('0x1e')](respondWithResult(_0x3ab137,null))[_0xc567('0x25')](handleError(_0x3ab137,null));};exports[_0xc567('0x71')]=function(_0x7be4f8,_0x76b2c9,_0x21e0fc){if(_0x7be4f8['file']&&_0x7be4f8['file'][_0xc567('0x56')]){_0x7be4f8['body'][_0xc567('0x5d')]=_0x7be4f8[_0xc567('0x55')][_0xc567('0x56')];}return db['Setting']['find']({'where':{'id':_0x7be4f8[_0xc567('0x50')]['id']}})['then'](handleEntityNotFound(_0x76b2c9,null))[_0xc567('0x1e')](saveUpdates(_0x7be4f8[_0xc567('0x53')],null))['then'](respondWithResult(_0x76b2c9,null))[_0xc567('0x25')](handleError(_0x76b2c9,null));};var utilLicense=require('../../config/license/util');exports[_0xc567('0x72')]=function(_0x425a9e,_0xbe05fd,_0x5d29ef){var _0x182d02=_0xc567('0x5b');var _0x36d30f={'custom':![]};return utilLicense[_0xc567('0x5c')]()[_0xc567('0x1e')](function(_0x51ad1d){if(_0x51ad1d){_0x36d30f=_0x51ad1d;}return db['Setting'][_0xc567('0x52')]({'where':{'id':_0x425a9e[_0xc567('0x50')]['id']},'attributes':['logo',_0xc567('0x59'),'preferred',_0xc567('0x6a'),'defaultLogo',_0xc567('0x6c'),_0xc567('0x6d'),_0xc567('0x5e')],'raw':!![]});})[_0xc567('0x1e')](handleEntityNotFound(_0xbe05fd,null))[_0xc567('0x1e')](function(_0x5ea5b7){if(_0x5ea5b7){var _0x5f11b6=_0x5ea5b7[_0xc567('0x5d')]&&fs[_0xc567('0x66')](path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x182d02,_[_0xc567('0x61')](_0x5ea5b7[_0xc567('0x5d')])))?path[_0xc567('0x5f')](config['root'],_0x182d02,_['toLower'](_0x5ea5b7['preferred'])):path['join'](config[_0xc567('0x60')],_0x182d02,_[_0xc567('0x61')]('default_preferred.png'));var _0x252cf3='default'+_['upperFirst'](_0xc567('0x5d'));if(_0x5ea5b7[_0x252cf3]||!_0x36d30f[_0xc567('0x65')]||!_0x36d30f[_0xc567('0x5d')]){_0x5f11b6=path[_0xc567('0x5f')](config['root'],_0x182d02,_[_0xc567('0x61')]('default_preferred.png'));}if(!fs[_0xc567('0x66')](_0x5f11b6)){throw new db[(_0xc567('0x67'))]['ValidationError'](_[_0xc567('0x64')](_0xc567('0x5d'))+_0xc567('0x69'));}return _0xbe05fd[_0xc567('0x73')](_0x5f11b6);}})[_0xc567('0x25')](handleError(_0xbe05fd,null));};exports[_0xc567('0x74')]=function(_0x2f0718,_0x3c5be6,_0x38fb3a){if(_0x2f0718[_0xc567('0x55')]&&_0x2f0718['file'][_0xc567('0x56')]){_0x2f0718[_0xc567('0x53')][_0xc567('0x6a')]=_0x2f0718[_0xc567('0x55')]['filename'];}return db[_0xc567('0x37')][_0xc567('0x52')]({'where':{'id':_0x2f0718['params']['id']}})['then'](handleEntityNotFound(_0x3c5be6,null))[_0xc567('0x1e')](saveUpdates(_0x2f0718[_0xc567('0x53')],null))[_0xc567('0x1e')](respondWithResult(_0x3c5be6,null))['catch'](handleError(_0x3c5be6,null));};var utilLicense=require(_0xc567('0x1a'));exports[_0xc567('0x75')]=function(_0x4b4cdd,_0x51f24b,_0xae3220){var _0x185fb8=_0xc567('0x5b');var _0x43f7b5={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x56be6f){if(_0x56be6f){_0x43f7b5=_0x56be6f;}return db[_0xc567('0x37')][_0xc567('0x52')]({'where':{'id':_0x4b4cdd[_0xc567('0x50')]['id']},'attributes':[_0xc567('0x57'),_0xc567('0x59'),_0xc567('0x5d'),'favicon','defaultLogo',_0xc567('0x6c'),_0xc567('0x6d'),_0xc567('0x5e')],'raw':!![]});})[_0xc567('0x1e')](handleEntityNotFound(_0x51f24b,null))[_0xc567('0x1e')](function(_0x948286){if(_0x948286){var _0x9febee=_0x948286['favicon']&&fs[_0xc567('0x66')](path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x185fb8,_['toLower'](_0x948286[_0xc567('0x6a')])))?path[_0xc567('0x5f')](config['root'],_0x185fb8,_[_0xc567('0x61')](_0x948286[_0xc567('0x6a')])):path[_0xc567('0x5f')](config[_0xc567('0x60')],_0x185fb8,_[_0xc567('0x61')](_0xc567('0x76')));var _0x3655dd=_0xc567('0x63')+_[_0xc567('0x64')](_0xc567('0x6a'));if(_0x948286[_0x3655dd]||!_0x43f7b5[_0xc567('0x65')]){_0x9febee=path['join'](config[_0xc567('0x60')],_0x185fb8,_[_0xc567('0x61')](_0xc567('0x76')));}if(!fs[_0xc567('0x66')](_0x9febee)){throw new db['Sequelize'][(_0xc567('0x68'))](_[_0xc567('0x64')](_0xc567('0x6a'))+_0xc567('0x69'));}return _0x51f24b[_0xc567('0x73')](_0x9febee);}})[_0xc567('0x25')](handleError(_0x51f24b,null));};exports['getDate']=function(_0x28606b,_0xdf54ad){var _0x6ee3ba={'offset':moment()['utcOffset']()};_0x6ee3ba[_0xc567('0x77')]=moment()[_0xc567('0x78')](_0x6ee3ba[_0xc567('0x29')])[_0xc567('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xdf54ad[_0xc567('0x28')](0xc8)[_0xc567('0x34')](_0x6ee3ba);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 48de1a7..da7560e 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0x55ca,0x126));var _0xa55c=function(_0x29215d,_0x39143f){_0x29215d=_0x29215d-0x0;var _0x265037=_0x55ca[_0x29215d];return _0x265037;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x3e74,0x175));var _0x43e7=function(_0x48084d,_0x27e693){_0x48084d=_0x48084d-0x0;var _0x3227a9=_0x3e74[_0x48084d];return _0x3227a9;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3927abb..f514172 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 _0xe906=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','find','options','where','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x6a175a,_0x3ade4e){var _0xd3e8a=function(_0x5930f1){while(--_0x5930f1){_0x6a175a['push'](_0x6a175a['shift']());}};_0xd3e8a(++_0x3ade4e);}(_0xe906,0x196));var _0x6e90=function(_0x31bf1f,_0x465d36){_0x31bf1f=_0x31bf1f-0x0;var _0x4bec2a=_0xe906[_0x31bf1f];return _0x4bec2a;};'use strict';var _=require(_0x6e90('0x0'));var util=require(_0x6e90('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e90('0x2'));var fs=require('fs');var Redis=require(_0x6e90('0x3'));var db=require(_0x6e90('0x4'))['db'];var utils=require(_0x6e90('0x5'));var logger=require(_0x6e90('0x6'))('rpc');var config=require(_0x6e90('0x7'));var jayson=require(_0x6e90('0x8'));var client=jayson[_0x6e90('0x9')][_0x6e90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a8ae1,_0x28ae99,_0x4df15b){return new BPromise(function(_0x49bddb,_0x2d875e){return client[_0x6e90('0xb')](_0x1a8ae1,_0x4df15b)[_0x6e90('0xc')](function(_0x588347){logger[_0x6e90('0xd')](_0x6e90('0xe'),_0x28ae99,_0x6e90('0xf'));logger[_0x6e90('0x10')](_0x6e90('0x11'),_0x28ae99,_0x6e90('0xf'),JSON[_0x6e90('0x12')](_0x588347));if(_0x588347['error']){if(_0x588347[_0x6e90('0x13')][_0x6e90('0x14')]===0x1f4){logger[_0x6e90('0x13')](_0x6e90('0xe'),_0x28ae99,_0x588347[_0x6e90('0x13')][_0x6e90('0x15')]);return _0x2d875e(_0x588347[_0x6e90('0x13')][_0x6e90('0x15')]);}logger[_0x6e90('0x13')](_0x6e90('0xe'),_0x28ae99,_0x588347['error'][_0x6e90('0x15')]);return _0x49bddb(_0x588347['error'][_0x6e90('0x15')]);}else{logger[_0x6e90('0xd')]('Setting,\x20%s,\x20%s',_0x28ae99,_0x6e90('0xf'));_0x49bddb(_0x588347['result']['message']);}})[_0x6e90('0x16')](function(_0x47654e){logger[_0x6e90('0x13')](_0x6e90('0xe'),_0x28ae99,_0x47654e);_0x2d875e(_0x47654e);});});}exports[_0x6e90('0x17')]=function(_0x696ed1){var _0x1ef535=this;return new Promise(function(_0x1a10af,_0x1b1f1d){return db[_0x6e90('0x18')][_0x6e90('0x19')]({'raw':_0x696ed1[_0x6e90('0x1a')]?_0x696ed1[_0x6e90('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x696ed1[_0x6e90('0x1a')]?_0x696ed1[_0x6e90('0x1a')][_0x6e90('0x1b')]||null:null,'attributes':_0x696ed1[_0x6e90('0x1a')]?_0x696ed1[_0x6e90('0x1a')][_0x6e90('0x1c')]||null:null,'include':_0x696ed1[_0x6e90('0x1a')]?_0x696ed1['options'][_0x6e90('0x1d')]?_['map'](_0x696ed1['options'][_0x6e90('0x1d')],function(_0x2ee5bd){return{'model':db[_0x2ee5bd['model']],'as':_0x2ee5bd['as'],'attributes':_0x2ee5bd[_0x6e90('0x1c')],'include':_0x2ee5bd[_0x6e90('0x1d')]?_[_0x6e90('0x1e')](_0x2ee5bd['include'],function(_0x21ed79){return{'model':db[_0x21ed79[_0x6e90('0x1f')]],'as':_0x21ed79['as'],'attributes':_0x21ed79[_0x6e90('0x1c')],'include':_0x21ed79[_0x6e90('0x1d')]?_[_0x6e90('0x1e')](_0x21ed79[_0x6e90('0x1d')],function(_0x2b7c2c){return{'model':db[_0x2b7c2c[_0x6e90('0x1f')]],'as':_0x2b7c2c['as'],'attributes':_0x2b7c2c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a13cf){logger['info'](_0x6e90('0x17'),_0x696ed1);logger['debug'](_0x6e90('0x17'),_0x696ed1,JSON['stringify'](_0x4a13cf));_0x1a10af(_0x4a13cf);})['catch'](function(_0x4afbca){logger[_0x6e90('0x13')](_0x6e90('0x17'),_0x4afbca[_0x6e90('0x15')],_0x696ed1);_0x1b1f1d(_0x1ef535[_0x6e90('0x13')](0x1f4,_0x4afbca[_0x6e90('0x15')]));});});}; \ No newline at end of file +var _0xc767=['options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','code','error','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0xc767,0x84));var _0x7c76=function(_0x522453,_0x3f05a3){_0x522453=_0x522453-0x0;var _0x1f9be5=_0xc767[_0x522453];return _0x1f9be5;};'use strict';var _=require(_0x7c76('0x0'));var util=require(_0x7c76('0x1'));var moment=require(_0x7c76('0x2'));var BPromise=require(_0x7c76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c76('0x4'));var db=require(_0x7c76('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c76('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c76('0x7'));var client=jayson[_0x7c76('0x8')][_0x7c76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bd55f,_0x3f1ebd,_0x13ce5c){return new BPromise(function(_0x4c6381,_0x49f3ac){return client[_0x7c76('0xa')](_0x4bd55f,_0x13ce5c)[_0x7c76('0xb')](function(_0x55fdcc){logger[_0x7c76('0xc')]('Setting,\x20%s,\x20%s',_0x3f1ebd,_0x7c76('0xd'));logger[_0x7c76('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x3f1ebd,'request\x20sent',JSON['stringify'](_0x55fdcc));if(_0x55fdcc['error']){if(_0x55fdcc['error'][_0x7c76('0xf')]===0x1f4){logger[_0x7c76('0x10')](_0x7c76('0x11'),_0x3f1ebd,_0x55fdcc[_0x7c76('0x10')][_0x7c76('0x12')]);return _0x49f3ac(_0x55fdcc[_0x7c76('0x10')][_0x7c76('0x12')]);}logger[_0x7c76('0x10')](_0x7c76('0x11'),_0x3f1ebd,_0x55fdcc[_0x7c76('0x10')]['message']);return _0x4c6381(_0x55fdcc['error'][_0x7c76('0x12')]);}else{logger[_0x7c76('0xc')]('Setting,\x20%s,\x20%s',_0x3f1ebd,_0x7c76('0xd'));_0x4c6381(_0x55fdcc[_0x7c76('0x13')][_0x7c76('0x12')]);}})[_0x7c76('0x14')](function(_0x40e300){logger['error'](_0x7c76('0x11'),_0x3f1ebd,_0x40e300);_0x49f3ac(_0x40e300);});});}exports[_0x7c76('0x15')]=function(_0x35cba0){var _0x3a0c5f=this;return new Promise(function(_0x5a9a56,_0x26b2f3){return db[_0x7c76('0x16')]['find']({'raw':_0x35cba0[_0x7c76('0x17')]?_0x35cba0[_0x7c76('0x17')][_0x7c76('0x18')]===undefined?!![]:![]:!![],'where':_0x35cba0[_0x7c76('0x17')]?_0x35cba0['options'][_0x7c76('0x19')]||null:null,'attributes':_0x35cba0[_0x7c76('0x17')]?_0x35cba0[_0x7c76('0x17')][_0x7c76('0x1a')]||null:null,'include':_0x35cba0[_0x7c76('0x17')]?_0x35cba0[_0x7c76('0x17')][_0x7c76('0x1b')]?_[_0x7c76('0x1c')](_0x35cba0[_0x7c76('0x17')]['include'],function(_0x5253bf){return{'model':db[_0x5253bf[_0x7c76('0x1d')]],'as':_0x5253bf['as'],'attributes':_0x5253bf[_0x7c76('0x1a')],'include':_0x5253bf[_0x7c76('0x1b')]?_['map'](_0x5253bf[_0x7c76('0x1b')],function(_0x2f62d8){return{'model':db[_0x2f62d8[_0x7c76('0x1d')]],'as':_0x2f62d8['as'],'attributes':_0x2f62d8[_0x7c76('0x1a')],'include':_0x2f62d8[_0x7c76('0x1b')]?_[_0x7c76('0x1c')](_0x2f62d8[_0x7c76('0x1b')],function(_0x3bf25a){return{'model':db[_0x3bf25a['model']],'as':_0x3bf25a['as'],'attributes':_0x3bf25a[_0x7c76('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b6d51){logger[_0x7c76('0xc')]('ShowSetting',_0x35cba0);logger['debug'](_0x7c76('0x15'),_0x35cba0,JSON[_0x7c76('0x1e')](_0x4b6d51));_0x5a9a56(_0x4b6d51);})[_0x7c76('0x14')](function(_0x3f8193){logger[_0x7c76('0x10')](_0x7c76('0x15'),_0x3f8193['message'],_0x35cba0);_0x26b2f3(_0x3a0c5f[_0x7c76('0x10')](0x1f4,_0x3f8193[_0x7c76('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index deafd4b..b30da20 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(_0x41c11a,_0x4bbb07){_0x41c11a=_0x41c11a-0x0;var _0x1b1a4a=_0xf494[_0x41c11a];return _0x1b1a4a;};'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 _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x207be5,_0x344a2c){var _0x1bf58e=function(_0x595b2d){while(--_0x595b2d){_0x207be5['push'](_0x207be5['shift']());}};_0x1bf58e(++_0x344a2c);}(_0x5fab,0x177));var _0xb5fa=function(_0x5b674c,_0xc560b){_0x5b674c=_0x5b674c-0x0;var _0x3da567=_0x5fab[_0x5b674c];return _0x3da567;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e1796fb..bfd325f 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 _0xe26e=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xe26e,0x16c));var _0xee26=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe26e[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xee26('0x0'),'allowNull':![]},'key':{'type':Sequelize[_0xee26('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xee26('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xee26('0x1')],'defaultValue':function(){return rs[_0xee26('0x2')]();}},'phone':{'type':Sequelize[_0xee26('0x1')]},'type':{'type':Sequelize[_0xee26('0x3')](_0xee26('0x4'),_0xee26('0x5'),_0xee26('0x6'),_0xee26('0x7'),_0xee26('0x8'),_0xee26('0x9'),_0xee26('0xa'),'csc',_0xee26('0xb'),_0xee26('0xc'))},'accountSid':{'type':Sequelize[_0xee26('0x1')]},'authId':{'type':Sequelize[_0xee26('0x1')]},'authToken':{'type':Sequelize[_0xee26('0x1')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xee26('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xee26('0x1')]},'accountId':{'type':Sequelize[_0xee26('0x1')]},'senderString':{'type':Sequelize[_0xee26('0x1')]},'deliveryReport':{'type':Sequelize[_0xee26('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xee26('0x1')]},'notificationTemplate':{'type':Sequelize[_0xee26('0xe')],'defaultValue':function(){return _0xee26('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xee26('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xee26('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee26('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xee26('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xee26('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xee26('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xee26('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xee26('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xee26('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x34df8f){if(!_0x34df8f)this[_0xee26('0x12')]('mandatoryDispositionPauseId',null);this[_0xee26('0x12')](_0xee26('0x13'),_0x34df8f);}}}; \ No newline at end of file +var _0x2872=['STRING','generate','ENUM','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports'];(function(_0x534bd4,_0x1f0a65){var _0x433f58=function(_0x147781){while(--_0x147781){_0x534bd4['push'](_0x534bd4['shift']());}};_0x433f58(++_0x1f0a65);}(_0x2872,0xd0));var _0x2287=function(_0x4d90e3,_0x588ad9){_0x4d90e3=_0x4d90e3-0x0;var _0x37754a=_0x2872[_0x4d90e3];return _0x37754a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2287('0x0'));module[_0x2287('0x1')]={'name':{'type':Sequelize[_0x2287('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x2287('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x2287('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2287('0x3')]();}},'phone':{'type':Sequelize[_0x2287('0x2')]},'type':{'type':Sequelize[_0x2287('0x4')]('twilio',_0x2287('0x5'),_0x2287('0x6'),_0x2287('0x7'),_0x2287('0x8'),'clickatell',_0x2287('0x9'),_0x2287('0xa'),_0x2287('0xb'),_0x2287('0xc'))},'accountSid':{'type':Sequelize[_0x2287('0x2')]},'authId':{'type':Sequelize[_0x2287('0x2')]},'authToken':{'type':Sequelize[_0x2287('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x2287('0x2')]},'password':{'type':Sequelize[_0x2287('0x2')]},'apiKey':{'type':Sequelize[_0x2287('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x2287('0x2')]},'senderString':{'type':Sequelize[_0x2287('0x2')]},'deliveryReport':{'type':Sequelize[_0x2287('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x2287('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2287('0xe')],'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[_0x2287('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2287('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2287('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2287('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2287('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2287('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x2287('0xd')],'defaultValue':![],'comment':_0x2287('0x11'),'set':function(_0x2516fd){if(!_0x2516fd)this['setDataValue'](_0x2287('0x12'),null);this[_0x2287('0x13')](_0x2287('0x14'),_0x2516fd);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ca476cc..a99bf40 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 _0xb38f=['error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','SmsAccounts','UserProfileResource','stack','send','index','Pause','SmsAccount','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','name','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','getDispositions','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sms','SmsApplication','applications','orderBy','Applications','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','refid','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','bandwidth','intelepeer','redif','DELIVERED','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x302295,_0x2f8994){var _0x4e2db9=function(_0x33b9a4){while(--_0x33b9a4){_0x302295['push'](_0x302295['shift']());}};_0x4e2db9(++_0x2f8994);}(_0xb38f,0x1af));var _0xfb38=function(_0x44a329,_0x45f280){_0x44a329=_0x44a329-0x0;var _0x45f2a3=_0xb38f[_0x44a329];return _0x45f2a3;};'use strict';var emlformat=require(_0xfb38('0x0'));var rimraf=require(_0xfb38('0x1'));var zipdir=require(_0xfb38('0x2'));var jsonpatch=require(_0xfb38('0x3'));var rp=require('request-promise');var moment=require(_0xfb38('0x4'));var BPromise=require(_0xfb38('0x5'));var Mustache=require(_0xfb38('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfb38('0x7'));var csv=require(_0xfb38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb38('0x9'));var _=require(_0xfb38('0xa'));var squel=require(_0xfb38('0xb'));var crypto=require(_0xfb38('0xc'));var jsforce=require(_0xfb38('0xd'));var deskjs=require(_0xfb38('0xe'));var toCsv=require(_0xfb38('0x8'));var querystring=require('querystring');var Papa=require(_0xfb38('0xf'));var Redis=require(_0xfb38('0x10'));var authService=require(_0xfb38('0x11'));var qs=require(_0xfb38('0x12'));var as=require(_0xfb38('0x13'));var hardwareService=require(_0xfb38('0x14'));var logger=require(_0xfb38('0x15'))(_0xfb38('0x16'));var utils=require('../../config/utils');var config=require(_0xfb38('0x17'));var licenseUtil=require(_0xfb38('0x18'));var db=require(_0xfb38('0x19'))['db'];config[_0xfb38('0x1a')]=_[_0xfb38('0x1b')](config[_0xfb38('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb38('0x1c'))(new Redis(config['redis']));require(_0xfb38('0x1d'))[_0xfb38('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfb38('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x33d08a,_0x161e1e,_0xbf2767,_0x58f484){return new BPromise(function(_0x3e36e0,_0x4f1f12){var _0x1df8c6=_0x58f484||client;return _0x1df8c6[_0xfb38('0x20')](_0x33d08a,_0xbf2767)[_0xfb38('0x21')](function(_0x2b0880){logger[_0xfb38('0x22')](_0xfb38('0x23'),_0x161e1e,_0xfb38('0x24'));logger[_0xfb38('0x25')](_0xfb38('0x26'),_0x161e1e,_0xfb38('0x24'),JSON['stringify'](_0x2b0880));if(_0x2b0880[_0xfb38('0x27')]){if(_0x2b0880[_0xfb38('0x27')][_0xfb38('0x28')]===0x1f4){logger[_0xfb38('0x27')](_0xfb38('0x23'),_0x161e1e,_0x2b0880[_0xfb38('0x27')]['message']);return _0x4f1f12(_0x2b0880[_0xfb38('0x27')]['message']);}logger[_0xfb38('0x27')](_0xfb38('0x23'),_0x161e1e,_0x2b0880[_0xfb38('0x27')]['message']);return _0x3e36e0(_0x2b0880[_0xfb38('0x27')][_0xfb38('0x29')]);}else{logger[_0xfb38('0x22')](_0xfb38('0x23'),_0x161e1e,'request\x20sent');_0x3e36e0(_0x2b0880['result'][_0xfb38('0x29')]);}})[_0xfb38('0x2a')](function(_0x18087e){logger['error'](_0xfb38('0x23'),_0x161e1e,_0x18087e);_0x4f1f12(_0x18087e);});});}function respondWithStatusCode(_0x472899,_0x41c285){_0x41c285=_0x41c285||0xcc;return function(_0x35cc78){if(_0x35cc78){return _0x472899[_0xfb38('0x2b')](_0x41c285);}return _0x472899[_0xfb38('0x2c')](_0x41c285)[_0xfb38('0x2d')]();};}function respondWithResult(_0x188b87,_0x2336f8){_0x2336f8=_0x2336f8||0xc8;return function(_0x514d11){if(_0x514d11){return _0x188b87[_0xfb38('0x2c')](_0x2336f8)[_0xfb38('0x2e')](_0x514d11);}};}function respondWithFilteredResult(_0x110efa,_0x65c72d){return function(_0x517bfe){if(_0x517bfe){var _0x2dc143=typeof _0x65c72d[_0xfb38('0x2f')]===_0xfb38('0x30')&&typeof _0x65c72d[_0xfb38('0x31')]===_0xfb38('0x30');var _0x1d7746=_0x517bfe[_0xfb38('0x32')];var _0x287d97=_0x2dc143?0x0:_0x65c72d[_0xfb38('0x2f')];var _0x4eb95e=_0x2dc143?_0x517bfe[_0xfb38('0x32')]:_0x65c72d[_0xfb38('0x2f')]+_0x65c72d[_0xfb38('0x31')];var _0x1cc5d4;if(_0x4eb95e>=_0x1d7746){_0x4eb95e=_0x1d7746;_0x1cc5d4=0xc8;}else{_0x1cc5d4=0xce;}_0x110efa[_0xfb38('0x2c')](_0x1cc5d4);return _0x110efa[_0xfb38('0x33')]('Content-Range',_0x287d97+'-'+_0x4eb95e+'/'+_0x1d7746)[_0xfb38('0x2e')](_0x517bfe);}return null;};}function patchUpdates(_0x4c194a){return function(_0x396b0b){try{jsonpatch['apply'](_0x396b0b,_0x4c194a,!![]);}catch(_0x445e2e){return BPromise[_0xfb38('0x34')](_0x445e2e);}return _0x396b0b['save']();};}function saveUpdates(_0x10bbd9,_0x463fd6){return function(_0x220761){if(_0x220761){return _0x220761[_0xfb38('0x35')](_0x10bbd9)[_0xfb38('0x21')](function(_0x55a31e){return _0x55a31e;});}return null;};}function removeEntity(_0x553ab8,_0x3c50e4){return function(_0x1aa6a1){if(_0x1aa6a1){return _0x1aa6a1[_0xfb38('0x36')]()[_0xfb38('0x21')](function(){var _0x21c070=_0x1aa6a1['get']({'plain':!![]});var _0x16eaf5=_0xfb38('0x37');return db[_0xfb38('0x38')][_0xfb38('0x36')]({'where':{'type':_0x16eaf5,'resourceId':_0x21c070['id']}})['then'](function(){return _0x1aa6a1;});})['then'](function(){_0x553ab8[_0xfb38('0x2c')](0xcc)[_0xfb38('0x2d')]();});}};}function handleEntityNotFound(_0x37a6f1,_0x209e40){return function(_0x4d1e4d){if(!_0x4d1e4d){_0x37a6f1[_0xfb38('0x2b')](0x194);}return _0x4d1e4d;};}function handleError(_0x185f15,_0x4b5bea){_0x4b5bea=_0x4b5bea||0x1f4;return function(_0x2cffc2){logger[_0xfb38('0x27')](_0x2cffc2[_0xfb38('0x39')]);if(_0x2cffc2['name']){delete _0x2cffc2['name'];}_0x185f15[_0xfb38('0x2c')](_0x4b5bea)[_0xfb38('0x3a')](_0x2cffc2);};}exports[_0xfb38('0x3b')]=function(_0xd9900,_0x25de6f){var _0x9c4196={'include':[{'model':db[_0xfb38('0x3c')],'as':'mandatoryDispositionPause'}]},_0x24a1df={},_0x1f9249={'count':0x0,'rows':[]};var _0x30d698=_['map'](db[_0xfb38('0x3d')]['rawAttributes'],function(_0x8059f0){return{'name':_0x8059f0[_0xfb38('0x3e')],'type':_0x8059f0[_0xfb38('0x3f')][_0xfb38('0x40')]};});_0x24a1df['model']=_[_0xfb38('0x41')](_0x30d698,'name');_0x24a1df['query']=_[_0xfb38('0x42')](_0xd9900[_0xfb38('0x43')]);_0x24a1df[_0xfb38('0x44')]=_[_0xfb38('0x45')](_0x24a1df[_0xfb38('0x46')],_0x24a1df[_0xfb38('0x43')]);_0x9c4196[_0xfb38('0x47')]=_[_0xfb38('0x45')](_0x24a1df[_0xfb38('0x46')],qs[_0xfb38('0x48')](_0xd9900['query']['fields']));_0x9c4196[_0xfb38('0x47')]=_0x9c4196[_0xfb38('0x47')][_0xfb38('0x49')]?_0x9c4196[_0xfb38('0x47')]:_0x24a1df[_0xfb38('0x46')];if(!_0xd9900[_0xfb38('0x43')][_0xfb38('0x4a')](_0xfb38('0x4b'))){_0x9c4196['limit']=qs['limit'](_0xd9900['query']['limit']);_0x9c4196[_0xfb38('0x2f')]=qs[_0xfb38('0x2f')](_0xd9900[_0xfb38('0x43')][_0xfb38('0x2f')]);}_0x9c4196[_0xfb38('0x4c')]=qs['sort'](_0xd9900['query'][_0xfb38('0x4d')]);_0x9c4196['where']=qs[_0xfb38('0x44')](_['pick'](_0xd9900['query'],_0x24a1df[_0xfb38('0x44')]),_0x30d698);if(_0xd9900['query'][_0xfb38('0x4e')]){_0x9c4196[_0xfb38('0x4f')]=_['merge'](_0x9c4196[_0xfb38('0x4f')],{'$or':_[_0xfb38('0x41')](_0x30d698,function(_0x52836d){if(_0x52836d['type']!==_0xfb38('0x50')){var _0x4cb83c={};_0x4cb83c[_0x52836d[_0xfb38('0x51')]]={'$like':'%'+_0xd9900['query'][_0xfb38('0x4e')]+'%'};return _0x4cb83c;}})});}_0x9c4196=_['merge']({},_0x9c4196,_0xd9900[_0xfb38('0x52')]);var _0x3cc4ef={'where':_0x9c4196[_0xfb38('0x4f')]};return db['SmsAccount'][_0xfb38('0x32')](_0x3cc4ef)['then'](function(_0x30f194){_0x1f9249[_0xfb38('0x32')]=_0x30f194;if(_0xd9900['query'][_0xfb38('0x53')]){_0x9c4196[_0xfb38('0x54')]=[{'all':!![]}];}return db[_0xfb38('0x3d')][_0xfb38('0x55')](_0x9c4196);})[_0xfb38('0x21')](function(_0x5a08e3){_0x1f9249[_0xfb38('0x56')]=_0x5a08e3;return _0x1f9249;})['then'](respondWithFilteredResult(_0x25de6f,_0x9c4196))['catch'](handleError(_0x25de6f,null));};exports[_0xfb38('0x57')]=function(_0x57ea8b,_0xd70ea0){var _0x4a97ac={'raw':![],'where':{'id':_0x57ea8b[_0xfb38('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xfb38('0x59')}]},_0x8fc571={};_0x8fc571['model']=_[_0xfb38('0x42')](db[_0xfb38('0x3d')][_0xfb38('0x5a')]);_0x8fc571[_0xfb38('0x43')]=_['keys'](_0x57ea8b[_0xfb38('0x43')]);_0x8fc571['filters']=_[_0xfb38('0x45')](_0x8fc571[_0xfb38('0x46')],_0x8fc571['query']);_0x4a97ac[_0xfb38('0x47')]=_[_0xfb38('0x45')](_0x8fc571['model'],qs['fields'](_0x57ea8b[_0xfb38('0x43')][_0xfb38('0x48')]));_0x4a97ac[_0xfb38('0x47')]=_0x4a97ac['attributes'][_0xfb38('0x49')]?_0x4a97ac[_0xfb38('0x47')]:_0x8fc571[_0xfb38('0x46')];if(_0x57ea8b[_0xfb38('0x43')][_0xfb38('0x53')]){_0x4a97ac[_0xfb38('0x54')]=[{'all':!![]}];}_0x4a97ac=_[_0xfb38('0x5b')]({},_0x4a97ac,_0x57ea8b[_0xfb38('0x52')]);return db[_0xfb38('0x3d')][_0xfb38('0x5c')](_0x4a97ac)[_0xfb38('0x21')](handleEntityNotFound(_0xd70ea0,null))[_0xfb38('0x21')](respondWithResult(_0xd70ea0,null))[_0xfb38('0x2a')](handleError(_0xd70ea0,null));};exports[_0xfb38('0x5d')]=function(_0x3d06d3,_0x30f2db){return db[_0xfb38('0x3d')][_0xfb38('0x5d')](_0x3d06d3['body'],{})[_0xfb38('0x21')](function(_0x239f6e){var _0x5c5bf5=_0x3d06d3[_0xfb38('0x5e')][_0xfb38('0x5f')]({'plain':!![]});if(!_0x5c5bf5)throw new Error(_0xfb38('0x60'));if(_0x5c5bf5[_0xfb38('0x61')]===_0xfb38('0x5e')){var _0x773e0d=_0x239f6e[_0xfb38('0x5f')]({'plain':!![]});var _0x191677=_0xfb38('0x37');return db['UserProfileSection'][_0xfb38('0x5c')]({'where':{'name':_0x191677,'userProfileId':_0x5c5bf5[_0xfb38('0x62')]},'raw':!![]})[_0xfb38('0x21')](function(_0x5532b8){if(_0x5532b8&&_0x5532b8[_0xfb38('0x63')]===0x0){return db[_0xfb38('0x38')]['create']({'name':_0x773e0d['name'],'resourceId':_0x773e0d['id'],'type':_0x5532b8[_0xfb38('0x51')],'sectionId':_0x5532b8['id']},{})[_0xfb38('0x21')](function(){return _0x239f6e;});}else{return _0x239f6e;}})['catch'](function(_0x483910){logger['error'](_0xfb38('0x64'),_0x483910);throw _0x483910;});}return _0x239f6e;})[_0xfb38('0x21')](respondWithResult(_0x30f2db,0xc9))[_0xfb38('0x2a')](handleError(_0x30f2db,null));};exports[_0xfb38('0x35')]=function(_0x413233,_0x3b20a9){if(_0x413233[_0xfb38('0x65')]['id']){delete _0x413233[_0xfb38('0x65')]['id'];}return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x413233[_0xfb38('0x58')]['id']},'include':[{'model':db[_0xfb38('0x3c')],'as':_0xfb38('0x59')}]})[_0xfb38('0x21')](handleEntityNotFound(_0x3b20a9,null))[_0xfb38('0x21')](saveUpdates(_0x413233[_0xfb38('0x65')],null))[_0xfb38('0x21')](respondWithResult(_0x3b20a9,null))[_0xfb38('0x2a')](handleError(_0x3b20a9,null));};exports['destroy']=function(_0x543746,_0x2763fb){return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x543746[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x2763fb,null))[_0xfb38('0x21')](removeEntity(_0x2763fb,null))['catch'](handleError(_0x2763fb,null));};exports[_0xfb38('0x66')]=function(_0x3eea7e,_0x419858){return db['SmsAccount'][_0xfb38('0x66')]()[_0xfb38('0x21')](respondWithResult(_0x419858,null))[_0xfb38('0x2a')](handleError(_0x419858,null));};exports[_0xfb38('0x67')]=function(_0x3ae4f6,_0xe639bf,_0xd43b9c){if(_0x3ae4f6['body']['id']){delete _0x3ae4f6[_0xfb38('0x65')]['id'];}return db[_0xfb38('0x3d')]['find']({'where':{'id':_0x3ae4f6['params']['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0xe639bf,null))['then'](function(_0x384e12){if(_0x384e12){_0x3ae4f6['body'][_0xfb38('0x68')]=_0x384e12['id'];return db['Disposition'][_0xfb38('0x5d')](_0x3ae4f6[_0xfb38('0x65')]);}})['then'](respondWithResult(_0xe639bf,null))[_0xfb38('0x2a')](handleError(_0xe639bf,null));};exports[_0xfb38('0x69')]=function(_0xbc975f,_0x1172f9,_0x275188){var _0x420b81={'raw':![],'where':{}};var _0x222091={};var _0x353552={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xbc975f['params']['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x1172f9,null))[_0xfb38('0x21')](function(_0xafc0f9){if(_0xafc0f9){_0x222091[_0xfb38('0x46')]=_[_0xfb38('0x42')](db[_0xfb38('0x6a')][_0xfb38('0x5a')]);_0x222091[_0xfb38('0x43')]=_['keys'](_0xbc975f[_0xfb38('0x43')]);_0x222091[_0xfb38('0x44')]=_[_0xfb38('0x45')](_0x222091[_0xfb38('0x46')],_0x222091['query']);_0x420b81['attributes']=_[_0xfb38('0x45')](_0x222091[_0xfb38('0x46')],qs['fields'](_0xbc975f[_0xfb38('0x43')][_0xfb38('0x48')]));_0x420b81[_0xfb38('0x47')]=_0x420b81[_0xfb38('0x47')][_0xfb38('0x49')]?_0x420b81[_0xfb38('0x47')]:_0x222091[_0xfb38('0x46')];if(!_0xbc975f[_0xfb38('0x43')]['hasOwnProperty'](_0xfb38('0x4b'))){_0x420b81['limit']=qs[_0xfb38('0x31')](_0xbc975f[_0xfb38('0x43')][_0xfb38('0x31')]);_0x420b81['offset']=qs[_0xfb38('0x2f')](_0xbc975f['query']['offset']);}_0x420b81[_0xfb38('0x4c')]=qs[_0xfb38('0x4d')](_0xbc975f[_0xfb38('0x43')]['sort']);_0x420b81[_0xfb38('0x4f')]=qs[_0xfb38('0x44')](_[_0xfb38('0x6b')](_0xbc975f[_0xfb38('0x43')],_0x222091[_0xfb38('0x44')]));_0x420b81[_0xfb38('0x4f')][_0xfb38('0x68')]=_0xafc0f9['id'];if(_0xbc975f[_0xfb38('0x43')][_0xfb38('0x4e')]){_0x420b81[_0xfb38('0x4f')]=_[_0xfb38('0x5b')](_0x420b81[_0xfb38('0x4f')],{'$or':_[_0xfb38('0x41')](_0x420b81[_0xfb38('0x47')],function(_0x40efc2){var _0x4a4180={};_0x4a4180[_0x40efc2]={'$like':'%'+_0xbc975f[_0xfb38('0x43')]['filter']+'%'};return _0x4a4180;})});}_0x420b81=_[_0xfb38('0x5b')]({},_0x420b81,_0xbc975f[_0xfb38('0x52')]);return db[_0xfb38('0x6a')][_0xfb38('0x32')]({'where':_0x420b81[_0xfb38('0x4f')]})[_0xfb38('0x21')](function(_0x9884fc){_0x353552[_0xfb38('0x32')]=_0x9884fc;if(_0xbc975f[_0xfb38('0x43')][_0xfb38('0x53')]){_0x420b81[_0xfb38('0x54')]=[{'all':!![]}];}return db[_0xfb38('0x6a')][_0xfb38('0x55')](_0x420b81);})[_0xfb38('0x21')](function(_0x1cca02){_0x353552['rows']=_0x1cca02;return _0x353552;});}})[_0xfb38('0x21')](respondWithFilteredResult(_0x1172f9,_0x420b81))[_0xfb38('0x2a')](handleError(_0x1172f9,null));};exports[_0xfb38('0x6c')]=function(_0x32cb08,_0x94a98d,_0x496ac8){return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x32cb08[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x94a98d,null))[_0xfb38('0x21')](function(_0x1d1706){if(_0x1d1706){return _0x1d1706[_0xfb38('0x6c')](_0x32cb08[_0xfb38('0x43')][_0xfb38('0x6d')]);}})['then'](respondWithStatusCode(_0x94a98d,null))[_0xfb38('0x2a')](handleError(_0x94a98d,null));};exports[_0xfb38('0x6e')]=function(_0x351a56,_0xcaa085,_0x20a282){if(_0x351a56[_0xfb38('0x65')]['id']){delete _0x351a56['body']['id'];}return db[_0xfb38('0x3d')]['find']({'where':{'id':_0x351a56['params']['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0xcaa085,null))[_0xfb38('0x21')](function(_0xdc3bc4){if(_0xdc3bc4){_0x351a56['body']['SmsAccountId']=_0xdc3bc4['id'];return db[_0xfb38('0x6f')]['create'](_0x351a56[_0xfb38('0x65')]);}})[_0xfb38('0x21')](respondWithResult(_0xcaa085,null))[_0xfb38('0x2a')](handleError(_0xcaa085,null));};exports[_0xfb38('0x70')]=function(_0x1c9344,_0x18513e,_0x508bca){var _0x417038={'raw':![],'where':{}};var _0x44ff1c={};var _0x5639d6={'count':0x0,'rows':[]};return db[_0xfb38('0x3d')][_0xfb38('0x71')]({'where':{'id':_0x1c9344[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x18513e,null))[_0xfb38('0x21')](function(_0x3d062f){if(_0x3d062f){_0x44ff1c['model']=_[_0xfb38('0x42')](db[_0xfb38('0x6f')][_0xfb38('0x5a')]);_0x44ff1c['query']=_[_0xfb38('0x42')](_0x1c9344[_0xfb38('0x43')]);_0x44ff1c[_0xfb38('0x44')]=_[_0xfb38('0x45')](_0x44ff1c[_0xfb38('0x46')],_0x44ff1c['query']);_0x417038['attributes']=_[_0xfb38('0x45')](_0x44ff1c[_0xfb38('0x46')],qs[_0xfb38('0x48')](_0x1c9344['query'][_0xfb38('0x48')]));_0x417038[_0xfb38('0x47')]=_0x417038[_0xfb38('0x47')]['length']?_0x417038[_0xfb38('0x47')]:_0x44ff1c[_0xfb38('0x46')];if(!_0x1c9344[_0xfb38('0x43')][_0xfb38('0x4a')](_0xfb38('0x4b'))){_0x417038[_0xfb38('0x31')]=qs[_0xfb38('0x31')](_0x1c9344[_0xfb38('0x43')][_0xfb38('0x31')]);_0x417038['offset']=qs[_0xfb38('0x2f')](_0x1c9344[_0xfb38('0x43')][_0xfb38('0x2f')]);}_0x417038[_0xfb38('0x4c')]=qs['sort'](_0x1c9344[_0xfb38('0x43')][_0xfb38('0x4d')]);_0x417038['where']=qs['filters'](_['pick'](_0x1c9344[_0xfb38('0x43')],_0x44ff1c[_0xfb38('0x44')]));_0x417038['where']['SmsAccountId']=_0x3d062f['id'];if(_0x1c9344[_0xfb38('0x43')][_0xfb38('0x4e')]){_0x417038[_0xfb38('0x4f')]=_[_0xfb38('0x5b')](_0x417038[_0xfb38('0x4f')],{'$or':_[_0xfb38('0x41')](_0x417038[_0xfb38('0x47')],function(_0x1dba8c){var _0x475f1c={};_0x475f1c[_0x1dba8c]={'$like':'%'+_0x1c9344[_0xfb38('0x43')][_0xfb38('0x4e')]+'%'};return _0x475f1c;})});}_0x417038=_['merge']({},_0x417038,_0x1c9344[_0xfb38('0x52')]);return db[_0xfb38('0x6f')]['count']({'where':_0x417038[_0xfb38('0x4f')]})[_0xfb38('0x21')](function(_0xa4c219){_0x5639d6[_0xfb38('0x32')]=_0xa4c219;if(_0x1c9344[_0xfb38('0x43')]['includeAll']){_0x417038[_0xfb38('0x54')]=[{'all':!![]}];}return db[_0xfb38('0x6f')]['findAll'](_0x417038);})['then'](function(_0x1e4f94){_0x5639d6[_0xfb38('0x56')]=_0x1e4f94;return _0x5639d6;});}})[_0xfb38('0x21')](respondWithFilteredResult(_0x18513e,_0x417038))[_0xfb38('0x2a')](handleError(_0x18513e,null));};exports[_0xfb38('0x72')]=function(_0x529ca2,_0x2a5bca,_0x4d4f16){return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x529ca2[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x2a5bca,null))['then'](function(_0x41e88d){if(_0x41e88d){return _0x41e88d[_0xfb38('0x72')](_0x529ca2['query'][_0xfb38('0x6d')]);}})['then'](respondWithStatusCode(_0x2a5bca,null))[_0xfb38('0x2a')](handleError(_0x2a5bca,null));};exports['notify']=function(_0x186302,_0x4c2065,_0x1e798a){var _0x40416d={'channel':_0xfb38('0x73')};var _0x5e8ba6=[];var _0x1b925d=[];var _0x1ad2c9={};return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x186302[_0xfb38('0x58')]['id']},'include':[{'model':db[_0xfb38('0x74')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x4c2065,null))['then'](function(_0x296600){_0x40416d['account']=_0x296600;_0x40416d[_0xfb38('0x75')]=_[_0xfb38('0x76')](_0x296600[_0xfb38('0x77')],['priority'],['asc']);if(_0x40416d[_0xfb38('0x78')][_0xfb38('0x77')]){delete _0x40416d[_0xfb38('0x78')]['Applications'];}return db[_0xfb38('0x79')][_0xfb38('0x66')]();})[_0xfb38('0x21')](function(_0x36fee3){if(!_0x36fee3){throw new db['Sequelize'][(_0xfb38('0x7a'))](_0xfb38('0x7b'));}_0x5e8ba6=_[_0xfb38('0x7c')](_[_0xfb38('0x42')](_0x36fee3),[_0xfb38('0x7d'),_0xfb38('0x7e')]);_0x1b925d=_[_0xfb38('0x7c')](_[_0xfb38('0x42')](_0x36fee3),['createdAt',_0xfb38('0x7e'),'CompanyId',_0xfb38('0x7f')]);_0x40416d['body']={'mapKey':_0xfb38('0x80')};if(_0x40416d['account'][_0xfb38('0x3f')]){switch(_0x40416d['account'][_0xfb38('0x3f')]){case _0xfb38('0x81'):_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x83')];_0x40416d['body'][_0xfb38('0x65')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x84')];_0x40416d[_0xfb38('0x65')][_0xfb38('0x85')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x86')];break;case _0xfb38('0x87'):_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')]='+'+_0x186302[_0xfb38('0x65')][_0xfb38('0x88')];_0x40416d['body']['body']=_0x186302[_0xfb38('0x65')][_0xfb38('0x89')];break;case _0xfb38('0x8a'):_0x40416d[_0xfb38('0x65')]['from']=_0x186302['body'][_0xfb38('0x82')];_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')]=_0x186302['body'][_0xfb38('0x29')];break;case _0xfb38('0x8b'):_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x82')];_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x65')];_0x40416d['body'][_0xfb38('0x85')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x8c')];break;case _0xfb38('0x8d'):_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')]=_0x186302['body'][_0xfb38('0x83')];_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x8e')];_0x40416d[_0xfb38('0x65')]['messageId']=_0x186302[_0xfb38('0x65')][_0xfb38('0x8f')];break;case _0xfb38('0x90'):_0x40416d[_0xfb38('0x65')]['from']='+'+_0x186302[_0xfb38('0x65')][_0xfb38('0x91')][0x0][_0xfb38('0x82')];_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')]=_0x186302['body'][_0xfb38('0x91')][0x0][_0xfb38('0x89')];_0x40416d[_0xfb38('0x65')]['messageId']=_0x186302[_0xfb38('0x65')]['results'][0x0][_0xfb38('0x85')];break;case _0xfb38('0x92'):_0x40416d['body'][_0xfb38('0x82')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x93')];_0x40416d['body'][_0xfb38('0x65')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x94')][_0xfb38('0x29')];break;case _0xfb38('0x95'):_0x40416d[_0xfb38('0x65')]['from']=_0x186302['body'][_0xfb38('0x96')];_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x89')];_0x40416d[_0xfb38('0x65')][_0xfb38('0x85')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x97')];break;case'bandwidth':_0x40416d[_0xfb38('0x65')][_0xfb38('0x85')]=_0x186302[_0xfb38('0x65')][0x0][_0xfb38('0x29')]['id'];_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')]=_0x186302[_0xfb38('0x65')][0x0][_0xfb38('0x29')]['from'];_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')]=_0x186302[_0xfb38('0x65')][0x0][_0xfb38('0x29')][_0xfb38('0x89')];break;case'intelepeer':_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x82')];_0x40416d['body'][_0xfb38('0x65')]=_0x186302['body']['message'];_0x40416d['body'][_0xfb38('0x85')]=_0x186302[_0xfb38('0x65')][_0xfb38('0x98')];break;}}if(_0x40416d[_0xfb38('0x65')]['id']){delete _0x40416d[_0xfb38('0x65')]['id'];}if(_['isNil'](_0x40416d[_0xfb38('0x65')]['from'])){throw new db[(_0xfb38('0x99'))]['ValidationError'](_0xfb38('0x9a'));}if(_[_0xfb38('0x9b')](_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')])||_0x40416d[_0xfb38('0x65')][_0xfb38('0x65')]===''){throw new db[(_0xfb38('0x99'))]['ValidationError'](_0xfb38('0x9c'));}if(_['isNil'](_0x40416d['body'][_0xfb38('0x9d')])){throw new db['Sequelize'][(_0xfb38('0x7a'))](_0xfb38('0x9e')+_0x1b925d);}if(!_['includes'](_0x1b925d,_0x40416d['body']['mapKey'])){throw new db[(_0xfb38('0x99'))][(_0xfb38('0x7a'))](_0xfb38('0x9f')+_0x1b925d);}_0x1ad2c9[_0x40416d[_0xfb38('0x65')][_0xfb38('0x9d')]]=_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')];return db[_0xfb38('0xa0')][_0xfb38('0x5c')]({'where':{'id':_0x40416d[_0xfb38('0x78')][_0xfb38('0x7f')]},'include':[{'model':db[_0xfb38('0x79')],'as':_0xfb38('0xa1'),'where':_0x1ad2c9,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xfb38('0x21')](handleEntityNotFound(_0x4c2065,null))[_0xfb38('0x21')](function(_0x3695dc){if(_0x3695dc){_0x40416d[_0xfb38('0xa2')]=_[_0xfb38('0xa3')](_0x3695dc,[_0xfb38('0xa1')]);if(_0x3695dc[_0xfb38('0xa1')]['length']){return _0x3695dc['Contacts'][0x0];}var _0x2b7242=_[_0xfb38('0x1b')](_0x40416d[_0xfb38('0x65')],{'firstName':_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')],'ListId':_0x3695dc['id']});_0x2b7242[_0x40416d[_0xfb38('0x65')]['mapKey']]=_0x40416d[_0xfb38('0x65')]['from'];return db['CmContact'][_0xfb38('0x5d')](_0x2b7242,{'fields':_0x5e8ba6,'raw':!![]});}})['then'](handleEntityNotFound(_0x4c2065,null))['then'](function(_0x213c52){if(_0x213c52){_0x40416d[_0xfb38('0xa4')]=_0x213c52;var _0x5d8881={'ContactId':_0x213c52['id'],'phone':_0x40416d[_0xfb38('0x65')][_0xfb38('0x82')],'SmsAccountId':_0x186302[_0xfb38('0x58')]['id']};var _0xf2847a={'ContactId':_0x213c52['id'],'SmsAccountId':_0x186302[_0xfb38('0x58')]['id'],'closed':![]};return db[_0xfb38('0xa5')][_0xfb38('0x5c')]({'where':_0xf2847a})['then'](function(_0x48c293){if(_0x48c293){return[_0x48c293,![]];}return db[_0xfb38('0xa5')]['create'](_0x5d8881)[_0xfb38('0x21')](function(_0xf2a844){return[_0xf2a844,!![]];});});}})[_0xfb38('0xa6')](function(_0x2ea3c0,_0x5d1f82){_0x40416d[_0xfb38('0xa7')]=_0x2ea3c0[_0xfb38('0x5f')]({'plain':!![]});_0x40416d[_0xfb38('0xa7')][_0xfb38('0xa8')]=![];if(_0x5d1f82){if(_0x40416d['account'][_0xfb38('0xa9')]){_0x40416d[_0xfb38('0x75')][_0xfb38('0xaa')]({'id':0x0,'priority':_0x40416d[_0xfb38('0x75')]['length']+0x1,'app':'close','appdata':_0xfb38('0xab'),'interval':'*,*,*,*'});}_0x40416d['interaction'][_0xfb38('0xa8')]=!![];}return db['SmsMessage'][_0xfb38('0x5d')]({'phone':_0x40416d['body'][_0xfb38('0x82')],'messageId':_0x40416d[_0xfb38('0x65')][_0xfb38('0x85')],'body':_0x40416d['body']['body'],'SmsAccountId':_0x186302[_0xfb38('0x58')]['id'],'SmsInteractionId':_0x2ea3c0['id'],'direction':'in','ContactId':_0x2ea3c0[_0xfb38('0xac')],'AttachmentId':_0x40416d['body'][_0xfb38('0xad')]});})[_0xfb38('0x21')](function(_0x33f834){_0x40416d['message']=_0x33f834;if(_0x40416d['interaction'][_0xfb38('0xae')]){return db[_0xfb38('0xaf')][_0xfb38('0x5c')]({'attributes':['id','name'],'where':{'id':_0x40416d[_0xfb38('0xa7')][_0xfb38('0xae')]}})[_0xfb38('0x21')](function(_0x5789cf){if(_0x5789cf){_0x40416d['applications'][_0xfb38('0xb0')]({'id':0x0,'priority':0x0,'app':_0xfb38('0xb1'),'appdata':_0x5789cf[_0xfb38('0x51')]+','+(_0x40416d['account'][_0xfb38('0xb2')]||0xa),'interval':_0xfb38('0xb3')});}return respondWithRpcPromise('Start',_0xfb38('0xb4'),_0x40416d);});}return respondWithRpcPromise(_0xfb38('0xb5'),_0xfb38('0xb4'),_0x40416d);})[_0xfb38('0x21')](function(_0x543c98){if(_0x543c98){var _0x1c4161=0xc8;var _0x514753=_0xfb38('0xb6');logger[_0xfb38('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x514753,_0x1c4161,_0xfb38('0xb7'));logger['debug'](_0xfb38('0xb8'),_0x514753,_0x1c4161,'entity\x20found',JSON[_0xfb38('0xb9')](_0x543c98));if(_0x40416d[_0xfb38('0x78')][_0xfb38('0x3f')]==='twilio'){return _0x4c2065['status'](_0x1c4161)[_0xfb38('0x33')](_0xfb38('0xba'),_0xfb38('0xbb'))[_0xfb38('0x3a')](_0xfb38('0xbc'));}else{return _0x4c2065['status'](_0x1c4161)['json'](_0x543c98);}}})[_0xfb38('0x2a')](handleError(_0x4c2065,null));};exports[_0xfb38('0xbd')]=function(_0x5311e9,_0x188970){var _0x14bd37=_0x5311e9[_0xfb38('0x58')]['id'];var _0x3613c4=_0x5311e9['body'];var _0x267538=0xc8;var _0x4c0109=null;return db['sequelize'][_0xfb38('0xbe')]({'isolationLevel':db[_0xfb38('0xbf')]['Transaction']['ISOLATION_LEVELS'][_0xfb38('0xc0')]},function(_0x55c3cd){return db[_0xfb38('0x3d')][_0xfb38('0x71')]({'where':{'id':_0x14bd37},'transaction':_0x55c3cd})[_0xfb38('0x21')](function(_0x4e6ba7){if(_0x4e6ba7){return db['SmsApplication'][_0xfb38('0x36')]({'where':{'SmsAccountId':_0x14bd37},'transaction':_0x55c3cd})[_0xfb38('0x21')](function(){var _0x28bb06=_[_0xfb38('0x41')](_0x3613c4,function(_0x1a88b3){_0x1a88b3['SmsAccountId']=_0x14bd37;return _0x1a88b3;});return db[_0xfb38('0x74')][_0xfb38('0xc1')](_0x28bb06,{'transaction':_0x55c3cd});});}else{_0x267538=0x194;_0x4c0109=[];}});})[_0xfb38('0x21')](function(){if(_0x267538!==0x194){return db[_0xfb38('0x74')][_0xfb38('0xc2')]({'where':{'SmsAccountId':_0x14bd37},'order':'priority'})['then'](function(_0x39b5cf){_0x4c0109=_0x39b5cf;});}})[_0xfb38('0x2a')](function(_0x39ad4e){_0x267538=0x1f4;logger[_0xfb38('0x27')](_0x39ad4e[_0xfb38('0x39')]);if(_0x39ad4e[_0xfb38('0x51')]){delete _0x39ad4e[_0xfb38('0x51')];}_0x4c0109=_0x39ad4e;})[_0xfb38('0xc3')](function(){if(_0x4c0109===null){_0x188970[_0xfb38('0x2b')](_0x267538);}else{if(_0x267538===0x1f4){_0x188970[_0xfb38('0x2c')](_0x267538)[_0xfb38('0x3a')](_0x4c0109);}else{_0x188970[_0xfb38('0x2c')](_0x267538)[_0xfb38('0x2e')](_0x4c0109);}}});};exports[_0xfb38('0xc4')]=function(_0x433b8e,_0x4eab6e,_0x1ea9c5){var _0x1bf309={};var _0x3cb549={};var _0x54b28b;var _0x16fd3a;return db[_0xfb38('0x3d')][_0xfb38('0x71')]({'where':{'id':_0x433b8e[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x4eab6e,null))[_0xfb38('0x21')](function(_0x54fd41){if(_0x54fd41){_0x54b28b=_0x54fd41;_0x3cb549[_0xfb38('0x46')]=_['keys'](db[_0xfb38('0x74')]['rawAttributes']);_0x3cb549['query']=_[_0xfb38('0x42')](_0x433b8e[_0xfb38('0x43')]);_0x3cb549['filters']=_[_0xfb38('0x45')](_0x3cb549[_0xfb38('0x46')],_0x3cb549[_0xfb38('0x43')]);_0x1bf309[_0xfb38('0x47')]=_['intersection'](_0x3cb549[_0xfb38('0x46')],qs['fields'](_0x433b8e[_0xfb38('0x43')][_0xfb38('0x48')]));_0x1bf309[_0xfb38('0x47')]=_0x1bf309['attributes'][_0xfb38('0x49')]?_0x1bf309[_0xfb38('0x47')]:_0x3cb549[_0xfb38('0x46')];_0x1bf309[_0xfb38('0x4c')]=qs['sort'](_0x433b8e['query'][_0xfb38('0x4d')]);_0x1bf309['where']=qs[_0xfb38('0x44')](_[_0xfb38('0x6b')](_0x433b8e[_0xfb38('0x43')],_0x3cb549[_0xfb38('0x44')]));if(_0x433b8e[_0xfb38('0x43')][_0xfb38('0x4e')]){_0x1bf309['where']=_[_0xfb38('0x5b')](_0x1bf309[_0xfb38('0x4f')],{'$or':_[_0xfb38('0x41')](_0x1bf309[_0xfb38('0x47')],function(_0x54805b){var _0x302c0b={};_0x302c0b[_0x54805b]={'$like':'%'+_0x433b8e[_0xfb38('0x43')][_0xfb38('0x4e')]+'%'};return _0x302c0b;})});}_0x1bf309=_[_0xfb38('0x5b')]({},_0x1bf309,_0x433b8e[_0xfb38('0x52')]);return _0x54b28b[_0xfb38('0xc4')](_0x1bf309);}})['then'](function(_0x134ce1){if(_0x134ce1){_0x16fd3a=_0x134ce1[_0xfb38('0x49')];if(!_0x433b8e['query'][_0xfb38('0x4a')](_0xfb38('0x4b'))){_0x1bf309[_0xfb38('0x31')]=qs[_0xfb38('0x31')](_0x433b8e[_0xfb38('0x43')][_0xfb38('0x31')]);_0x1bf309[_0xfb38('0x2f')]=qs[_0xfb38('0x2f')](_0x433b8e[_0xfb38('0x43')][_0xfb38('0x2f')]);}return _0x54b28b[_0xfb38('0xc4')](_0x1bf309);}})['then'](function(_0x1d1913){if(_0x1d1913){return _0x1d1913?{'count':_0x16fd3a,'rows':_0x1d1913}:null;}})[_0xfb38('0x21')](respondWithResult(_0x4eab6e,null))[_0xfb38('0x2a')](handleError(_0x4eab6e,null));};exports[_0xfb38('0xc5')]=function(_0x5dd8f0,_0x1fe25c,_0x2587b7){var _0x6217ea={'raw':![],'where':{}};var _0x2bf0a4={};var _0x12ef44={'count':0x0,'rows':[]};return db[_0xfb38('0x3d')][_0xfb38('0x71')]({'where':{'id':_0x5dd8f0[_0xfb38('0x58')]['id']}})['then'](handleEntityNotFound(_0x1fe25c,null))[_0xfb38('0x21')](function(_0x26b6dd){if(_0x26b6dd){_0x2bf0a4['model']=_['keys'](db[_0xfb38('0xa5')][_0xfb38('0x5a')]);_0x2bf0a4[_0xfb38('0x43')]=_[_0xfb38('0x42')](_0x5dd8f0[_0xfb38('0x43')]);_0x2bf0a4[_0xfb38('0x44')]=_[_0xfb38('0x45')](_0x2bf0a4[_0xfb38('0x46')],_0x2bf0a4[_0xfb38('0x43')]);_0x6217ea['attributes']=_[_0xfb38('0x45')](_0x2bf0a4['model'],qs['fields'](_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0x48')]));_0x6217ea[_0xfb38('0x47')]=_0x6217ea[_0xfb38('0x47')][_0xfb38('0x49')]?_0x6217ea['attributes']:_0x2bf0a4['model'];if(!_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0x4a')](_0xfb38('0x4b'))){_0x6217ea[_0xfb38('0x31')]=qs[_0xfb38('0x31')](_0x5dd8f0['query'][_0xfb38('0x31')]);_0x6217ea['offset']=qs[_0xfb38('0x2f')](_0x5dd8f0['query'][_0xfb38('0x2f')]);}_0x6217ea[_0xfb38('0x4c')]=qs[_0xfb38('0x4d')](_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0x4d')]);_0x6217ea[_0xfb38('0x4f')]=qs[_0xfb38('0x44')](_[_0xfb38('0x6b')](_0x5dd8f0['query'],_0x2bf0a4['filters']));_0x6217ea[_0xfb38('0x4f')][_0xfb38('0x68')]=_0x26b6dd['id'];if(_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0x4e')]){_0x6217ea['where']=_[_0xfb38('0x5b')](_0x6217ea[_0xfb38('0x4f')],{'$or':_[_0xfb38('0x41')](_0x6217ea[_0xfb38('0x47')],function(_0x52582e){var _0x1117f8={};_0x1117f8[_0x52582e]={'$like':'%'+_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0x4e')]+'%'};return _0x1117f8;})});}_0x6217ea=_[_0xfb38('0x5b')]({},_0x6217ea,_0x5dd8f0[_0xfb38('0x52')]);return db[_0xfb38('0xa5')]['count']({'where':_0x6217ea[_0xfb38('0x4f')]})['then'](function(_0x56e09c){_0x12ef44['count']=_0x56e09c;if(_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0x53')]){_0x6217ea[_0xfb38('0x54')]=[{'model':db[_0xfb38('0x79')],'as':_0xfb38('0xc6'),'required':![]},{'model':db[_0xfb38('0xaf')],'as':_0xfb38('0xc7'),'attributes':[_0xfb38('0x51'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xfb38('0xc8'),'attributes':['id',_0xfb38('0x51'),_0xfb38('0xc9')],'where':_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0xca')]?{'id':_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0xca')]}:undefined,'required':_0x5dd8f0[_0xfb38('0x43')][_0xfb38('0xca')]?!![]:![]}];}return db[_0xfb38('0xa5')][_0xfb38('0x55')](_0x6217ea);})[_0xfb38('0x21')](function(_0x311e59){_0x12ef44[_0xfb38('0x56')]=_0x311e59;return _0x12ef44;});}})[_0xfb38('0x21')](respondWithFilteredResult(_0x1fe25c,_0x6217ea))[_0xfb38('0x2a')](handleError(_0x1fe25c,null));};exports[_0xfb38('0x3a')]=function(_0x4b9bf5,_0xfb83fc,_0x2e9083){var _0x420545,_0xb6d321,_0x3e6b4b;if(_['isNil'](_0x4b9bf5[_0xfb38('0x65')][_0xfb38('0x65')])||_0x4b9bf5[_0xfb38('0x65')]['body']===''){throw new db['Sequelize'][(_0xfb38('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfb38('0x9b')](_0x4b9bf5[_0xfb38('0x65')]['to'])){throw new db['Sequelize'][(_0xfb38('0x7a'))](_0xfb38('0xcb'));}_0x420545=_0x4b9bf5[_0xfb38('0x65')]['to'];return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x4b9bf5[_0xfb38('0x58')]['id']},'include':[{'model':db[_0xfb38('0xa0')],'as':_0xfb38('0xcc'),'include':[{'model':db[_0xfb38('0x79')],'as':_0xfb38('0xa1'),'where':{'mobile':_0x420545},'limit':0x1,'order':[['updatedAt',_0xfb38('0xcd')]]}]}]})[_0xfb38('0x21')](handleEntityNotFound(_0xfb83fc,null))[_0xfb38('0x21')](function(_0x7cb961){if(_0x7cb961&&_0x7cb961['List']){_0xb6d321=_0x7cb961[_0xfb38('0x5f')]({'plain':!![]});if(_0xb6d321[_0xfb38('0xcc')]&&_0xb6d321[_0xfb38('0xcc')][_0xfb38('0xa1')][_0xfb38('0x49')]){return _0xb6d321[_0xfb38('0xcc')][_0xfb38('0xa1')][0x0];}return db[_0xfb38('0x79')][_0xfb38('0x5d')](_['defaults'](_0x4b9bf5[_0xfb38('0x65')],{'firstName':_0x420545,'mobile':_0x420545,'phone':_0x420545,'ListId':_0xb6d321[_0xfb38('0x7f')]}));}})[_0xfb38('0x21')](handleEntityNotFound(_0xfb83fc,null))['then'](function(_0x59da3b){if(_0x59da3b){_0x3e6b4b=_0x59da3b;return db[_0xfb38('0xa5')][_0xfb38('0x5c')]({'where':{'ContactId':_0x3e6b4b['id'],'closed':![],'SmsAccountId':_0xb6d321['id']}})[_0xfb38('0x21')](function(_0x3ea093){if(_0x3ea093){return[_0x3ea093,![]];}return db[_0xfb38('0xa5')][_0xfb38('0x5d')]({'UserId':_0x4b9bf5[_0xfb38('0x5e')]['id'],'ContactId':_0x3e6b4b['id'],'SmsAccountId':_0xb6d321['id'],'phone':_0x420545,'firstMsgDirection':_0xfb38('0xce'),'Messages':[_[_0xfb38('0x5b')](_0x4b9bf5[_0xfb38('0x65')],{'read':![],'body':_0x4b9bf5[_0xfb38('0x65')]['body'],'phone':_0x420545,'SmsAccountId':_0xb6d321['id'],'UserId':_0x4b9bf5[_0xfb38('0x5e')]['id'],'ContactId':_0x3e6b4b['id']})]},{'include':[{'model':db[_0xfb38('0xcf')],'as':_0xfb38('0xd0')}]})[_0xfb38('0x21')](function(_0x7f2772){return[_0x7f2772,!![]];});});}})[_0xfb38('0xa6')](function(_0x5705fa,_0x3b47c2){if(_0x3b47c2){return _0x5705fa;}return db[_0xfb38('0xcf')]['create'](_[_0xfb38('0x5b')](_0x4b9bf5['body'],{'read':![],'body':_0x4b9bf5[_0xfb38('0x65')][_0xfb38('0x65')],'phone':_0x420545,'SmsAccountId':_0xb6d321['id'],'SmsInteractionId':_0x5705fa['id'],'UserId':_0x4b9bf5[_0xfb38('0x5e')]['id'],'ContactId':_0x3e6b4b['id']}))['then'](function(_0x153533){_0x5705fa[_0xfb38('0xd1')][_0xfb38('0xd0')]=[];_0x5705fa[_0xfb38('0xd1')]['Messages'][_0xfb38('0xaa')](_0x153533[_0xfb38('0xd1')]);return _0x5705fa;});})[_0xfb38('0x21')](respondWithResult(_0xfb83fc,null))['catch'](handleError(_0xfb83fc,null));};exports[_0xfb38('0x2c')]=function(_0x5b0a71,_0x2e746d,_0x55f837){if(_0x5b0a71['body']['id']){delete _0x5b0a71[_0xfb38('0x65')]['id'];}var _0x25261c,_0x5ecf81,_0x40e00d;return db['SmsAccount'][_0xfb38('0x5c')]({'where':{'id':_0x5b0a71[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x2e746d,null))[_0xfb38('0x21')](function(_0x484430){if(_0x484430){_0x40e00d=_0x484430;logger[_0xfb38('0x25')](_0xfb38('0x26'),'status',_0xfb38('0xd2'),_0x484430[_0xfb38('0x3f')],util[_0xfb38('0xd3')](_0x5b0a71[_0xfb38('0x65')],{'showHidden':![],'depth':null}));switch(_0x484430[_0xfb38('0x3f')]){case'skebby':if(_0x5b0a71['body'][_0xfb38('0xd4')]&&_0x5b0a71[_0xfb38('0x65')][_0xfb38('0x2c')]){_0x5ecf81=_0x5b0a71['body'][_0xfb38('0x2c')];return db[_0xfb38('0xcf')][_0xfb38('0x5c')]({'where':{'messageId':_0x5b0a71['body'][_0xfb38('0xd4')]}});}break;case _0xfb38('0x8a'):if(_0x5b0a71[_0xfb38('0x65')][_0xfb38('0xd5')]&&_0x5b0a71[_0xfb38('0x65')][_0xfb38('0xd6')]){_0x5ecf81=_0x5b0a71[_0xfb38('0x65')][_0xfb38('0xd6')];return db[_0xfb38('0xcf')][_0xfb38('0x5c')]({'where':{'messageId':_0x5b0a71['body'][_0xfb38('0xd5')]}});}break;case'clicksend':if(_0x5b0a71[_0xfb38('0x65')][_0xfb38('0x8c')]&&_0x5b0a71[_0xfb38('0x65')][_0xfb38('0xd7')]){_0x5ecf81=_0x5b0a71[_0xfb38('0x65')][_0xfb38('0xd7')];return db['SmsMessage'][_0xfb38('0x5c')]({'where':{'messageId':_0x5b0a71[_0xfb38('0x65')][_0xfb38('0x8c')]}});}break;case'infobip':var _0x2b128e=_0x5b0a71['body'][_0xfb38('0x91')][0x0];if(_0x2b128e[_0xfb38('0x85')]&&_0x2b128e[_0xfb38('0x2c')]['groupName']==='DELIVERED'){_0x5ecf81=_0x2b128e[_0xfb38('0x2c')][_0xfb38('0xd8')];return db[_0xfb38('0xcf')][_0xfb38('0x5c')]({'where':{'messageId':_0x2b128e['messageId']}});}break;case _0xfb38('0x95'):if(_0x5b0a71['body']['messageId']&&_0x5b0a71[_0xfb38('0x65')]['status']){_0x5ecf81=_0x5b0a71[_0xfb38('0x65')][_0xfb38('0x2c')];return db[_0xfb38('0xcf')][_0xfb38('0x5c')]({'where':{'messageId':_0x5b0a71['body'][_0xfb38('0x85')]}});}break;case _0xfb38('0xd9'):if(_0x5b0a71['body'][0x0]['message']['id']){_0x5ecf81=_0x5b0a71[_0xfb38('0x65')][0x0][_0xfb38('0x3f')];return db[_0xfb38('0xcf')][_0xfb38('0x5c')]({'where':{'messageId':_0x5b0a71[_0xfb38('0x65')][0x0][_0xfb38('0x29')]['id']}});}break;case _0xfb38('0xda'):if(_0x5b0a71['body'][_0xfb38('0xdb')]&&_0x5b0a71[_0xfb38('0x65')][_0xfb38('0x2c')]){_0x5ecf81=_0x5b0a71[_0xfb38('0x65')]['status'];return db[_0xfb38('0xcf')][_0xfb38('0x5c')]({'where':{'messageId':_0x5b0a71['body'][_0xfb38('0xdb')]}});}break;}}})[_0xfb38('0x21')](handleEntityNotFound(_0x2e746d,null))[_0xfb38('0x21')](function(_0x5e2b0){if(_0x5e2b0){_0x25261c=_0x5e2b0;switch(_0x40e00d[_0xfb38('0x3f')]){case'skebby':if(_0x5ecf81===_0xfb38('0xdc')){return _0x25261c['update']({'read':!![]});}else{logger[_0xfb38('0x27')](_0xfb38('0x26'),'status',_0xfb38('0x87'),util[_0xfb38('0xd3')](_0x5b0a71['body'],{'showHidden':![],'depth':null}));}break;case _0xfb38('0x8a'):if(_0x5ecf81==='1'){return _0x25261c[_0xfb38('0x35')]({'read':!![]});}else{logger['error'](_0xfb38('0x26'),'status',_0xfb38('0x87'),util[_0xfb38('0xd3')](_0x5b0a71['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5b0a71[_0xfb38('0x65')]['error_code']&&_0x5ecf81>=0xc8&&_0x5ecf81<=0xce){return _0x25261c[_0xfb38('0x35')]({'read':!![]});}else{logger[_0xfb38('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xfb38('0x8b'),util['inspect'](_0x5b0a71[_0xfb38('0x65')],{'showHidden':![],'depth':null}));}break;case _0xfb38('0x90'):var _0x868763=_0x5b0a71[_0xfb38('0x65')][_0xfb38('0x91')][0x0];if(_0x868763[_0xfb38('0x2c')][_0xfb38('0xd8')]===_0xfb38('0xdc')){return _0x25261c[_0xfb38('0x35')]({'read':!![]});}else{logger[_0xfb38('0x27')](_0xfb38('0x26'),'status',_0xfb38('0x90'),util[_0xfb38('0xd3')](_0x5b0a71[_0xfb38('0x65')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5ecf81=='DELIVERED_TO_GATEWAY'||_0x5ecf81==_0xfb38('0xdd')){return _0x25261c[_0xfb38('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xfb38('0x95'),util[_0xfb38('0xd3')](_0x5b0a71[_0xfb38('0x65')],{'showHidden':![],'depth':null}));}break;case _0xfb38('0xd9'):if(_0x5ecf81==_0xfb38('0xde')){return _0x25261c[_0xfb38('0x35')]({'read':!![]});}else{logger[_0xfb38('0x27')](_0xfb38('0x26'),_0xfb38('0x2c'),'bandwidth',util['inspect'](_0x5b0a71['body'],{'showHidden':![],'depth':null}));}break;case _0xfb38('0xda'):if(_0x5ecf81===_0xfb38('0xdf')||_0x5ecf81===_0xfb38('0xe0')){return _0x25261c['update']({'read':!![]});}else{logger['error'](_0xfb38('0x26'),'status','intelepeer',util[_0xfb38('0xd3')](_0x5b0a71[_0xfb38('0x65')],{'showHidden':![],'depth':null}));}break;}return _0x25261c;}})[_0xfb38('0x21')](respondWithResult(_0x2e746d,null))[_0xfb38('0x2a')](handleError(_0x2e746d,null));};exports[_0xfb38('0xe1')]=function(_0x477906,_0xadfad8,_0x5c29b2){var _0x5bae85,_0x44e115,_0x156ae3;return db['SmsAccount'][_0xfb38('0x5c')]({'where':{'id':_0x477906['params']['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0xadfad8,null))['then'](function(_0x48a1de){if(_0x48a1de){_0x156ae3=_0x48a1de;logger['debug'](_0xfb38('0x26'),_0xfb38('0x2c'),_0xfb38('0xd2'),_0x48a1de[_0xfb38('0x3f')],util[_0xfb38('0xd3')](_0x477906[_0xfb38('0x43')],{'showHidden':![],'depth':null}));switch(_0x48a1de[_0xfb38('0x3f')]){case _0xfb38('0x92'):if(_0x477906[_0xfb38('0x43')]['message-id']&&_0x477906[_0xfb38('0x43')][_0xfb38('0xe2')]){_0x44e115=_0x477906['query'][_0xfb38('0xe2')];return db[_0xfb38('0xcf')][_0xfb38('0x5c')]({'where':{'messageId':_0x477906[_0xfb38('0x43')][_0xfb38('0xe3')]}});}break;}}})[_0xfb38('0x21')](handleEntityNotFound(_0xadfad8,null))[_0xfb38('0x21')](function(_0x4fc814){if(_0x4fc814){_0x5bae85=_0x4fc814;switch(_0x156ae3[_0xfb38('0x3f')]){case _0xfb38('0x92'):if(_0x44e115==='2'||_0x44e115==='6'){return _0x5bae85[_0xfb38('0x35')]({'read':!![]});}else{logger[_0xfb38('0x27')](_0xfb38('0x26'),_0xfb38('0x2c'),_0xfb38('0x92'),util['inspect'](_0x477906[_0xfb38('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x5bae85;}})[_0xfb38('0x21')](respondWithResult(_0xadfad8,null))[_0xfb38('0x2a')](handleError(_0xadfad8,null));};exports[_0xfb38('0xe4')]=function(_0x1491e1,_0x24b43f,_0x53e121){return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x1491e1[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x24b43f,null))[_0xfb38('0x21')](function(_0x775fdc){if(_0x775fdc){return _0x775fdc[_0xfb38('0xe4')](_0x1491e1['body'][_0xfb38('0x6d')],_[_0xfb38('0xa3')](_0x1491e1[_0xfb38('0x65')],[_0xfb38('0x6d'),'id'])||{})[_0xfb38('0xa6')](function(_0xbb8b1){for(var _0x403cb1=0x0;_0x403cb1<_0x1491e1[_0xfb38('0x65')][_0xfb38('0x6d')][_0xfb38('0x49')];_0x403cb1+=0x1){socket['emit'](_0xfb38('0xe5'),{'UserId':Number(_0x1491e1['body'][_0xfb38('0x6d')][_0x403cb1]),'SmsAccountId':Number(_0x1491e1[_0xfb38('0x58')]['id'])});}return _0xbb8b1;});}})[_0xfb38('0x21')](respondWithResult(_0x24b43f,null))[_0xfb38('0x2a')](handleError(_0x24b43f,null));};exports[_0xfb38('0xe6')]=function(_0x43a8bd,_0x3f938c,_0x3684d4){return db[_0xfb38('0x3d')][_0xfb38('0x5c')]({'where':{'id':_0x43a8bd['params']['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x3f938c,null))[_0xfb38('0x21')](function(_0x3e735d){if(_0x3e735d){return _0x3e735d[_0xfb38('0xe6')](_0x43a8bd[_0xfb38('0x43')][_0xfb38('0x6d')])[_0xfb38('0x21')](function(){if(_[_0xfb38('0xe7')](_0x43a8bd['query'][_0xfb38('0x6d')])){for(var _0x171adb=0x0;_0x171adb<_0x43a8bd[_0xfb38('0x43')][_0xfb38('0x6d')][_0xfb38('0x49')];_0x171adb+=0x1){socket[_0xfb38('0xe8')]('userSmsAccount:remove',{'UserId':Number(_0x43a8bd[_0xfb38('0x43')][_0xfb38('0x6d')][_0x171adb]),'SmsAccountId':Number(_0x43a8bd['params']['id'])});}}else{socket[_0xfb38('0xe8')](_0xfb38('0xe9'),{'UserId':Number(_0x43a8bd[_0xfb38('0x43')][_0xfb38('0x6d')]),'SmsAccountId':Number(_0x43a8bd[_0xfb38('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3f938c,null))[_0xfb38('0x2a')](handleError(_0x3f938c,null));};exports['getAgents']=function(_0x2fee96,_0x2b7139,_0x388979){var _0x5cf36c={};var _0x5afc9f={};var _0x227783;var _0x3474a5;return db[_0xfb38('0x3d')][_0xfb38('0x71')]({'where':{'id':_0x2fee96[_0xfb38('0x58')]['id']}})[_0xfb38('0x21')](handleEntityNotFound(_0x2b7139,null))[_0xfb38('0x21')](function(_0x535168){if(_0x535168){_0x227783=_0x535168;_0x5afc9f[_0xfb38('0x46')]=_[_0xfb38('0x42')](db['User'][_0xfb38('0x5a')]);_0x5afc9f['query']=_['keys'](_0x2fee96[_0xfb38('0x43')]);_0x5afc9f['filters']=_[_0xfb38('0x45')](_0x5afc9f[_0xfb38('0x46')],_0x5afc9f[_0xfb38('0x43')]);_0x5cf36c[_0xfb38('0x47')]=_[_0xfb38('0x45')](_0x5afc9f[_0xfb38('0x46')],qs['fields'](_0x2fee96[_0xfb38('0x43')][_0xfb38('0x48')]));_0x5cf36c[_0xfb38('0x47')]=_0x5cf36c[_0xfb38('0x47')][_0xfb38('0x49')]?_0x5cf36c[_0xfb38('0x47')]:_0x5afc9f[_0xfb38('0x46')];_0x5cf36c[_0xfb38('0x4c')]=qs[_0xfb38('0x4d')](_0x2fee96['query'][_0xfb38('0x4d')]);_0x5cf36c[_0xfb38('0x4f')]=qs['filters'](_[_0xfb38('0x6b')](_0x2fee96[_0xfb38('0x43')],_0x5afc9f[_0xfb38('0x44')]));if(_0x2fee96[_0xfb38('0x43')][_0xfb38('0x4e')]){_0x5cf36c[_0xfb38('0x4f')]=_[_0xfb38('0x5b')](_0x5cf36c[_0xfb38('0x4f')],{'$or':_[_0xfb38('0x41')](_0x5cf36c[_0xfb38('0x47')],function(_0x5ae08a){var _0x3cfbc9={};_0x3cfbc9[_0x5ae08a]={'$like':'%'+_0x2fee96[_0xfb38('0x43')][_0xfb38('0x4e')]+'%'};return _0x3cfbc9;})});}_0x5cf36c=_[_0xfb38('0x5b')]({},_0x5cf36c,_0x2fee96[_0xfb38('0x52')]);return _0x227783['getAgents'](_0x5cf36c);}})[_0xfb38('0x21')](function(_0x4d89d4){if(_0x4d89d4){_0x3474a5=_0x4d89d4[_0xfb38('0x49')];if(!_0x2fee96['query'][_0xfb38('0x4a')](_0xfb38('0x4b'))){_0x5cf36c[_0xfb38('0x31')]=qs['limit'](_0x2fee96['query'][_0xfb38('0x31')]);_0x5cf36c['offset']=qs[_0xfb38('0x2f')](_0x2fee96[_0xfb38('0x43')][_0xfb38('0x2f')]);}return _0x227783[_0xfb38('0xea')](_0x5cf36c);}})[_0xfb38('0x21')](function(_0x55242e){if(_0x55242e){return _0x55242e?{'count':_0x3474a5,'rows':_0x55242e}:null;}})[_0xfb38('0x21')](respondWithResult(_0x2b7139,null))[_0xfb38('0x2a')](handleError(_0x2b7139,null));}; \ No newline at end of file +var _0xba81=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','From','messageId','MessageSid','skebby','sender','text','connectel','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','stringify','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','message_id','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','order','sort','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sms','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xba81,0x70));var _0x1ba8=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0xba81[_0x1f1fb4];return _0x12fa15;};'use strict';var emlformat=require(_0x1ba8('0x0'));var rimraf=require(_0x1ba8('0x1'));var zipdir=require(_0x1ba8('0x2'));var jsonpatch=require(_0x1ba8('0x3'));var rp=require(_0x1ba8('0x4'));var moment=require(_0x1ba8('0x5'));var BPromise=require(_0x1ba8('0x6'));var Mustache=require('mustache');var util=require(_0x1ba8('0x7'));var path=require(_0x1ba8('0x8'));var sox=require(_0x1ba8('0x9'));var csv=require(_0x1ba8('0xa'));var ejs=require(_0x1ba8('0xb'));var fs=require('fs');var fs_extra=require(_0x1ba8('0xc'));var _=require('lodash');var squel=require(_0x1ba8('0xd'));var crypto=require(_0x1ba8('0xe'));var jsforce=require(_0x1ba8('0xf'));var deskjs=require(_0x1ba8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1ba8('0x11'));var Papa=require(_0x1ba8('0x12'));var Redis=require(_0x1ba8('0x13'));var authService=require(_0x1ba8('0x14'));var qs=require(_0x1ba8('0x15'));var as=require(_0x1ba8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ba8('0x17'))(_0x1ba8('0x18'));var utils=require(_0x1ba8('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1ba8('0x1a')]=_[_0x1ba8('0x1b')](config[_0x1ba8('0x1a')],{'host':_0x1ba8('0x1c'),'port':0x18eb});var socket=require(_0x1ba8('0x1d'))(new Redis(config['redis']));require(_0x1ba8('0x1e'))[_0x1ba8('0x1f')](socket);var jayson=require(_0x1ba8('0x20'));var client=jayson[_0x1ba8('0x21')][_0x1ba8('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x33842f,_0x32364c,_0x1a353b,_0x24e974){return new BPromise(function(_0x3dfbdf,_0x4ea335){var _0x19057d=_0x24e974||client;return _0x19057d[_0x1ba8('0x23')](_0x33842f,_0x1a353b)[_0x1ba8('0x24')](function(_0x4fdbc0){logger[_0x1ba8('0x25')](_0x1ba8('0x26'),_0x32364c,_0x1ba8('0x27'));logger[_0x1ba8('0x28')](_0x1ba8('0x29'),_0x32364c,_0x1ba8('0x27'),JSON['stringify'](_0x4fdbc0));if(_0x4fdbc0[_0x1ba8('0x2a')]){if(_0x4fdbc0[_0x1ba8('0x2a')][_0x1ba8('0x2b')]===0x1f4){logger[_0x1ba8('0x2a')](_0x1ba8('0x26'),_0x32364c,_0x4fdbc0['error']['message']);return _0x4ea335(_0x4fdbc0[_0x1ba8('0x2a')]['message']);}logger[_0x1ba8('0x2a')](_0x1ba8('0x26'),_0x32364c,_0x4fdbc0[_0x1ba8('0x2a')][_0x1ba8('0x2c')]);return _0x3dfbdf(_0x4fdbc0[_0x1ba8('0x2a')][_0x1ba8('0x2c')]);}else{logger[_0x1ba8('0x25')](_0x1ba8('0x26'),_0x32364c,'request\x20sent');_0x3dfbdf(_0x4fdbc0['result'][_0x1ba8('0x2c')]);}})[_0x1ba8('0x2d')](function(_0x79b5e5){logger[_0x1ba8('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x32364c,_0x79b5e5);_0x4ea335(_0x79b5e5);});});}function respondWithStatusCode(_0x9d06ed,_0x1a3e83){_0x1a3e83=_0x1a3e83||0xcc;return function(_0x17586f){if(_0x17586f){return _0x9d06ed[_0x1ba8('0x2e')](_0x1a3e83);}return _0x9d06ed[_0x1ba8('0x2f')](_0x1a3e83)[_0x1ba8('0x30')]();};}function respondWithResult(_0x3d7528,_0x2a8d05){_0x2a8d05=_0x2a8d05||0xc8;return function(_0x1a7f7d){if(_0x1a7f7d){return _0x3d7528[_0x1ba8('0x2f')](_0x2a8d05)[_0x1ba8('0x31')](_0x1a7f7d);}};}function respondWithFilteredResult(_0x3d12b9,_0x431865){return function(_0x2fa96f){if(_0x2fa96f){var _0x187a27=typeof _0x431865[_0x1ba8('0x32')]===_0x1ba8('0x33')&&typeof _0x431865[_0x1ba8('0x34')]===_0x1ba8('0x33');var _0x16ab47=_0x2fa96f[_0x1ba8('0x35')];var _0x11ec31=_0x187a27?0x0:_0x431865[_0x1ba8('0x32')];var _0x4db928=_0x187a27?_0x2fa96f['count']:_0x431865[_0x1ba8('0x32')]+_0x431865[_0x1ba8('0x34')];var _0x205264;if(_0x4db928>=_0x16ab47){_0x4db928=_0x16ab47;_0x205264=0xc8;}else{_0x205264=0xce;}_0x3d12b9['status'](_0x205264);return _0x3d12b9[_0x1ba8('0x36')](_0x1ba8('0x37'),_0x11ec31+'-'+_0x4db928+'/'+_0x16ab47)[_0x1ba8('0x31')](_0x2fa96f);}return null;};}function patchUpdates(_0x14b8b9){return function(_0x2fd655){try{jsonpatch[_0x1ba8('0x38')](_0x2fd655,_0x14b8b9,!![]);}catch(_0x384a60){return BPromise[_0x1ba8('0x39')](_0x384a60);}return _0x2fd655[_0x1ba8('0x3a')]();};}function saveUpdates(_0x136ce8,_0x1e9f9b){return function(_0x2a7ea1){if(_0x2a7ea1){return _0x2a7ea1[_0x1ba8('0x3b')](_0x136ce8)[_0x1ba8('0x24')](function(_0x1b074b){return _0x1b074b;});}return null;};}function removeEntity(_0x4a9a23,_0x93fba3){return function(_0x58ea77){if(_0x58ea77){return _0x58ea77[_0x1ba8('0x3c')]()[_0x1ba8('0x24')](function(){var _0x176b83=_0x58ea77[_0x1ba8('0x3d')]({'plain':!![]});var _0x565e58=_0x1ba8('0x3e');return db[_0x1ba8('0x3f')][_0x1ba8('0x3c')]({'where':{'type':_0x565e58,'resourceId':_0x176b83['id']}})['then'](function(){return _0x58ea77;});})[_0x1ba8('0x24')](function(){_0x4a9a23[_0x1ba8('0x2f')](0xcc)[_0x1ba8('0x30')]();});}};}function handleEntityNotFound(_0x25ccf1,_0xbc83d6){return function(_0x1ba86d){if(!_0x1ba86d){_0x25ccf1['sendStatus'](0x194);}return _0x1ba86d;};}function handleError(_0x405123,_0x212a19){_0x212a19=_0x212a19||0x1f4;return function(_0x267835){logger[_0x1ba8('0x2a')](_0x267835[_0x1ba8('0x40')]);if(_0x267835[_0x1ba8('0x41')]){delete _0x267835[_0x1ba8('0x41')];}_0x405123['status'](_0x212a19)[_0x1ba8('0x42')](_0x267835);};}exports[_0x1ba8('0x43')]=function(_0x8a5d29,_0x93ec68){var _0x1613b5={'include':[{'model':db[_0x1ba8('0x44')],'as':_0x1ba8('0x45')}]},_0x50abf4={},_0x4a13e1={'count':0x0,'rows':[]};var _0x1c2510=_[_0x1ba8('0x46')](db[_0x1ba8('0x47')][_0x1ba8('0x48')],function(_0x585a85){return{'name':_0x585a85['fieldName'],'type':_0x585a85['type']['key']};});_0x50abf4['model']=_[_0x1ba8('0x46')](_0x1c2510,_0x1ba8('0x41'));_0x50abf4[_0x1ba8('0x49')]=_[_0x1ba8('0x4a')](_0x8a5d29[_0x1ba8('0x49')]);_0x50abf4['filters']=_[_0x1ba8('0x4b')](_0x50abf4[_0x1ba8('0x4c')],_0x50abf4[_0x1ba8('0x49')]);_0x1613b5[_0x1ba8('0x4d')]=_[_0x1ba8('0x4b')](_0x50abf4['model'],qs[_0x1ba8('0x4e')](_0x8a5d29['query'][_0x1ba8('0x4e')]));_0x1613b5[_0x1ba8('0x4d')]=_0x1613b5[_0x1ba8('0x4d')][_0x1ba8('0x4f')]?_0x1613b5[_0x1ba8('0x4d')]:_0x50abf4[_0x1ba8('0x4c')];if(!_0x8a5d29[_0x1ba8('0x49')][_0x1ba8('0x50')](_0x1ba8('0x51'))){_0x1613b5[_0x1ba8('0x34')]=qs[_0x1ba8('0x34')](_0x8a5d29[_0x1ba8('0x49')][_0x1ba8('0x34')]);_0x1613b5[_0x1ba8('0x32')]=qs[_0x1ba8('0x32')](_0x8a5d29[_0x1ba8('0x49')]['offset']);}_0x1613b5['order']=qs['sort'](_0x8a5d29['query']['sort']);_0x1613b5[_0x1ba8('0x52')]=qs['filters'](_[_0x1ba8('0x53')](_0x8a5d29[_0x1ba8('0x49')],_0x50abf4[_0x1ba8('0x54')]),_0x1c2510);if(_0x8a5d29[_0x1ba8('0x49')]['filter']){_0x1613b5[_0x1ba8('0x52')]=_['merge'](_0x1613b5[_0x1ba8('0x52')],{'$or':_[_0x1ba8('0x46')](_0x1c2510,function(_0xd4fe3d){if(_0xd4fe3d['type']!==_0x1ba8('0x55')){var _0x28b8c3={};_0x28b8c3[_0xd4fe3d[_0x1ba8('0x41')]]={'$like':'%'+_0x8a5d29[_0x1ba8('0x49')][_0x1ba8('0x56')]+'%'};return _0x28b8c3;}})});}_0x1613b5=_[_0x1ba8('0x57')]({},_0x1613b5,_0x8a5d29[_0x1ba8('0x58')]);var _0x12b40d={'where':_0x1613b5[_0x1ba8('0x52')]};return db[_0x1ba8('0x47')][_0x1ba8('0x35')](_0x12b40d)[_0x1ba8('0x24')](function(_0x456bff){_0x4a13e1[_0x1ba8('0x35')]=_0x456bff;if(_0x8a5d29[_0x1ba8('0x49')][_0x1ba8('0x59')]){_0x1613b5['include']=[{'all':!![]}];}return db[_0x1ba8('0x47')][_0x1ba8('0x5a')](_0x1613b5);})[_0x1ba8('0x24')](function(_0x153cd8){_0x4a13e1[_0x1ba8('0x5b')]=_0x153cd8;return _0x4a13e1;})['then'](respondWithFilteredResult(_0x93ec68,_0x1613b5))[_0x1ba8('0x2d')](handleError(_0x93ec68,null));};exports['show']=function(_0x27453d,_0x2de41e){var _0x2b43e8={'raw':![],'where':{'id':_0x27453d[_0x1ba8('0x5c')]['id']},'include':[{'model':db[_0x1ba8('0x44')],'as':_0x1ba8('0x45')}]},_0x3281cd={};_0x3281cd[_0x1ba8('0x4c')]=_[_0x1ba8('0x4a')](db[_0x1ba8('0x47')][_0x1ba8('0x48')]);_0x3281cd['query']=_[_0x1ba8('0x4a')](_0x27453d[_0x1ba8('0x49')]);_0x3281cd[_0x1ba8('0x54')]=_[_0x1ba8('0x4b')](_0x3281cd['model'],_0x3281cd['query']);_0x2b43e8[_0x1ba8('0x4d')]=_[_0x1ba8('0x4b')](_0x3281cd[_0x1ba8('0x4c')],qs['fields'](_0x27453d[_0x1ba8('0x49')][_0x1ba8('0x4e')]));_0x2b43e8[_0x1ba8('0x4d')]=_0x2b43e8['attributes'][_0x1ba8('0x4f')]?_0x2b43e8['attributes']:_0x3281cd[_0x1ba8('0x4c')];if(_0x27453d[_0x1ba8('0x49')][_0x1ba8('0x59')]){_0x2b43e8[_0x1ba8('0x5d')]=[{'all':!![]}];}_0x2b43e8=_[_0x1ba8('0x57')]({},_0x2b43e8,_0x27453d[_0x1ba8('0x58')]);return db['SmsAccount']['find'](_0x2b43e8)[_0x1ba8('0x24')](handleEntityNotFound(_0x2de41e,null))['then'](respondWithResult(_0x2de41e,null))[_0x1ba8('0x2d')](handleError(_0x2de41e,null));};exports[_0x1ba8('0x5e')]=function(_0x3553df,_0x558791){return db['SmsAccount'][_0x1ba8('0x5e')](_0x3553df['body'],{})['then'](function(_0x33f388){var _0x144016=_0x3553df[_0x1ba8('0x5f')][_0x1ba8('0x3d')]({'plain':!![]});if(!_0x144016)throw new Error(_0x1ba8('0x60'));if(_0x144016[_0x1ba8('0x61')]===_0x1ba8('0x5f')){var _0x1aa856=_0x33f388[_0x1ba8('0x3d')]({'plain':!![]});var _0x479330=_0x1ba8('0x3e');return db[_0x1ba8('0x62')][_0x1ba8('0x63')]({'where':{'name':_0x479330,'userProfileId':_0x144016['userProfileId']},'raw':!![]})['then'](function(_0x484927){if(_0x484927&&_0x484927[_0x1ba8('0x64')]===0x0){return db[_0x1ba8('0x3f')]['create']({'name':_0x1aa856['name'],'resourceId':_0x1aa856['id'],'type':_0x484927['name'],'sectionId':_0x484927['id']},{})[_0x1ba8('0x24')](function(){return _0x33f388;});}else{return _0x33f388;}})[_0x1ba8('0x2d')](function(_0xfa0720){logger['error'](_0x1ba8('0x65'),_0xfa0720);throw _0xfa0720;});}return _0x33f388;})[_0x1ba8('0x24')](respondWithResult(_0x558791,0xc9))['catch'](handleError(_0x558791,null));};exports[_0x1ba8('0x3b')]=function(_0x61e1c4,_0x4e15c2){if(_0x61e1c4[_0x1ba8('0x66')]['id']){delete _0x61e1c4[_0x1ba8('0x66')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x61e1c4[_0x1ba8('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x1ba8('0x45')}]})[_0x1ba8('0x24')](handleEntityNotFound(_0x4e15c2,null))[_0x1ba8('0x24')](saveUpdates(_0x61e1c4['body'],null))[_0x1ba8('0x24')](respondWithResult(_0x4e15c2,null))[_0x1ba8('0x2d')](handleError(_0x4e15c2,null));};exports[_0x1ba8('0x3c')]=function(_0x3ee6fc,_0x5f1d3d){return db[_0x1ba8('0x47')][_0x1ba8('0x63')]({'where':{'id':_0x3ee6fc[_0x1ba8('0x5c')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x5f1d3d,null))['then'](removeEntity(_0x5f1d3d,null))['catch'](handleError(_0x5f1d3d,null));};exports[_0x1ba8('0x67')]=function(_0x6e9e88,_0x38c995){return db[_0x1ba8('0x47')][_0x1ba8('0x67')]()[_0x1ba8('0x24')](respondWithResult(_0x38c995,null))['catch'](handleError(_0x38c995,null));};exports[_0x1ba8('0x68')]=function(_0x20254c,_0x2c140f,_0x11877c){if(_0x20254c[_0x1ba8('0x66')]['id']){delete _0x20254c['body']['id'];}return db[_0x1ba8('0x47')][_0x1ba8('0x63')]({'where':{'id':_0x20254c[_0x1ba8('0x5c')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x2c140f,null))['then'](function(_0x366f48){if(_0x366f48){_0x20254c[_0x1ba8('0x66')][_0x1ba8('0x69')]=_0x366f48['id'];return db[_0x1ba8('0x6a')]['create'](_0x20254c[_0x1ba8('0x66')]);}})['then'](respondWithResult(_0x2c140f,null))[_0x1ba8('0x2d')](handleError(_0x2c140f,null));};exports[_0x1ba8('0x6b')]=function(_0x41c9d7,_0x1db04d,_0x22c031){var _0x23b59e={'raw':![],'where':{}};var _0x294cb0={};var _0xfb0e7b={'count':0x0,'rows':[]};return db[_0x1ba8('0x47')]['findOne']({'where':{'id':_0x41c9d7[_0x1ba8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1db04d,null))[_0x1ba8('0x24')](function(_0x458a65){if(_0x458a65){_0x294cb0[_0x1ba8('0x4c')]=_[_0x1ba8('0x4a')](db[_0x1ba8('0x6a')][_0x1ba8('0x48')]);_0x294cb0[_0x1ba8('0x49')]=_[_0x1ba8('0x4a')](_0x41c9d7[_0x1ba8('0x49')]);_0x294cb0[_0x1ba8('0x54')]=_[_0x1ba8('0x4b')](_0x294cb0[_0x1ba8('0x4c')],_0x294cb0['query']);_0x23b59e[_0x1ba8('0x4d')]=_[_0x1ba8('0x4b')](_0x294cb0[_0x1ba8('0x4c')],qs[_0x1ba8('0x4e')](_0x41c9d7[_0x1ba8('0x49')][_0x1ba8('0x4e')]));_0x23b59e[_0x1ba8('0x4d')]=_0x23b59e[_0x1ba8('0x4d')]['length']?_0x23b59e[_0x1ba8('0x4d')]:_0x294cb0['model'];if(!_0x41c9d7[_0x1ba8('0x49')][_0x1ba8('0x50')](_0x1ba8('0x51'))){_0x23b59e['limit']=qs[_0x1ba8('0x34')](_0x41c9d7[_0x1ba8('0x49')]['limit']);_0x23b59e['offset']=qs[_0x1ba8('0x32')](_0x41c9d7[_0x1ba8('0x49')]['offset']);}_0x23b59e[_0x1ba8('0x6c')]=qs[_0x1ba8('0x6d')](_0x41c9d7[_0x1ba8('0x49')][_0x1ba8('0x6d')]);_0x23b59e['where']=qs[_0x1ba8('0x54')](_[_0x1ba8('0x53')](_0x41c9d7[_0x1ba8('0x49')],_0x294cb0[_0x1ba8('0x54')]));_0x23b59e[_0x1ba8('0x52')][_0x1ba8('0x69')]=_0x458a65['id'];if(_0x41c9d7['query'][_0x1ba8('0x56')]){_0x23b59e[_0x1ba8('0x52')]=_[_0x1ba8('0x57')](_0x23b59e['where'],{'$or':_[_0x1ba8('0x46')](_0x23b59e[_0x1ba8('0x4d')],function(_0x277b1a){var _0x4a8353={};_0x4a8353[_0x277b1a]={'$like':'%'+_0x41c9d7['query']['filter']+'%'};return _0x4a8353;})});}_0x23b59e=_[_0x1ba8('0x57')]({},_0x23b59e,_0x41c9d7[_0x1ba8('0x58')]);return db[_0x1ba8('0x6a')][_0x1ba8('0x35')]({'where':_0x23b59e['where']})['then'](function(_0x3e3413){_0xfb0e7b['count']=_0x3e3413;if(_0x41c9d7[_0x1ba8('0x49')][_0x1ba8('0x59')]){_0x23b59e[_0x1ba8('0x5d')]=[{'all':!![]}];}return db[_0x1ba8('0x6a')][_0x1ba8('0x5a')](_0x23b59e);})['then'](function(_0x347348){_0xfb0e7b[_0x1ba8('0x5b')]=_0x347348;return _0xfb0e7b;});}})['then'](respondWithFilteredResult(_0x1db04d,_0x23b59e))[_0x1ba8('0x2d')](handleError(_0x1db04d,null));};exports[_0x1ba8('0x6e')]=function(_0x45720d,_0x152d23,_0x2c8f31){return db[_0x1ba8('0x47')][_0x1ba8('0x63')]({'where':{'id':_0x45720d[_0x1ba8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x152d23,null))[_0x1ba8('0x24')](function(_0x157af2){if(_0x157af2){return _0x157af2[_0x1ba8('0x6e')](_0x45720d[_0x1ba8('0x49')][_0x1ba8('0x6f')]);}})['then'](respondWithStatusCode(_0x152d23,null))[_0x1ba8('0x2d')](handleError(_0x152d23,null));};exports[_0x1ba8('0x70')]=function(_0x4f8093,_0x22a3de,_0x5ed7f9){if(_0x4f8093['body']['id']){delete _0x4f8093[_0x1ba8('0x66')]['id'];}return db['SmsAccount'][_0x1ba8('0x63')]({'where':{'id':_0x4f8093[_0x1ba8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x22a3de,null))[_0x1ba8('0x24')](function(_0xeedea0){if(_0xeedea0){_0x4f8093['body'][_0x1ba8('0x69')]=_0xeedea0['id'];return db['CannedAnswer'][_0x1ba8('0x5e')](_0x4f8093[_0x1ba8('0x66')]);}})[_0x1ba8('0x24')](respondWithResult(_0x22a3de,null))['catch'](handleError(_0x22a3de,null));};exports[_0x1ba8('0x71')]=function(_0x484c93,_0x20cb7d,_0x6dd63){var _0x184b0b={'raw':![],'where':{}};var _0x2ad5d7={};var _0x537fc6={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1ba8('0x72')]({'where':{'id':_0x484c93[_0x1ba8('0x5c')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x20cb7d,null))[_0x1ba8('0x24')](function(_0x2bae9a){if(_0x2bae9a){_0x2ad5d7[_0x1ba8('0x4c')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x2ad5d7['query']=_[_0x1ba8('0x4a')](_0x484c93[_0x1ba8('0x49')]);_0x2ad5d7[_0x1ba8('0x54')]=_['intersection'](_0x2ad5d7['model'],_0x2ad5d7[_0x1ba8('0x49')]);_0x184b0b[_0x1ba8('0x4d')]=_['intersection'](_0x2ad5d7[_0x1ba8('0x4c')],qs[_0x1ba8('0x4e')](_0x484c93[_0x1ba8('0x49')]['fields']));_0x184b0b[_0x1ba8('0x4d')]=_0x184b0b[_0x1ba8('0x4d')][_0x1ba8('0x4f')]?_0x184b0b[_0x1ba8('0x4d')]:_0x2ad5d7['model'];if(!_0x484c93[_0x1ba8('0x49')][_0x1ba8('0x50')]('nolimit')){_0x184b0b[_0x1ba8('0x34')]=qs[_0x1ba8('0x34')](_0x484c93['query'][_0x1ba8('0x34')]);_0x184b0b[_0x1ba8('0x32')]=qs[_0x1ba8('0x32')](_0x484c93[_0x1ba8('0x49')]['offset']);}_0x184b0b['order']=qs[_0x1ba8('0x6d')](_0x484c93['query'][_0x1ba8('0x6d')]);_0x184b0b[_0x1ba8('0x52')]=qs['filters'](_[_0x1ba8('0x53')](_0x484c93['query'],_0x2ad5d7[_0x1ba8('0x54')]));_0x184b0b[_0x1ba8('0x52')][_0x1ba8('0x69')]=_0x2bae9a['id'];if(_0x484c93['query'][_0x1ba8('0x56')]){_0x184b0b[_0x1ba8('0x52')]=_[_0x1ba8('0x57')](_0x184b0b['where'],{'$or':_[_0x1ba8('0x46')](_0x184b0b[_0x1ba8('0x4d')],function(_0x826144){var _0x2b565e={};_0x2b565e[_0x826144]={'$like':'%'+_0x484c93[_0x1ba8('0x49')]['filter']+'%'};return _0x2b565e;})});}_0x184b0b=_['merge']({},_0x184b0b,_0x484c93[_0x1ba8('0x58')]);return db['CannedAnswer'][_0x1ba8('0x35')]({'where':_0x184b0b[_0x1ba8('0x52')]})[_0x1ba8('0x24')](function(_0x28f566){_0x537fc6[_0x1ba8('0x35')]=_0x28f566;if(_0x484c93[_0x1ba8('0x49')][_0x1ba8('0x59')]){_0x184b0b[_0x1ba8('0x5d')]=[{'all':!![]}];}return db[_0x1ba8('0x73')][_0x1ba8('0x5a')](_0x184b0b);})[_0x1ba8('0x24')](function(_0x31e88c){_0x537fc6[_0x1ba8('0x5b')]=_0x31e88c;return _0x537fc6;});}})[_0x1ba8('0x24')](respondWithFilteredResult(_0x20cb7d,_0x184b0b))['catch'](handleError(_0x20cb7d,null));};exports[_0x1ba8('0x74')]=function(_0x5091a9,_0x5016e7,_0x429c04){return db[_0x1ba8('0x47')][_0x1ba8('0x63')]({'where':{'id':_0x5091a9[_0x1ba8('0x5c')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x5016e7,null))[_0x1ba8('0x24')](function(_0x6e80d7){if(_0x6e80d7){return _0x6e80d7[_0x1ba8('0x74')](_0x5091a9[_0x1ba8('0x49')]['ids']);}})[_0x1ba8('0x24')](respondWithStatusCode(_0x5016e7,null))[_0x1ba8('0x2d')](handleError(_0x5016e7,null));};exports['notify']=function(_0x333318,_0x447766,_0x20d124){var _0x4967a0={'channel':_0x1ba8('0x75')};var _0x3722a7=[];var _0x123dc7=[];var _0x40d546={};return db[_0x1ba8('0x47')][_0x1ba8('0x63')]({'where':{'id':_0x333318[_0x1ba8('0x5c')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x1ba8('0x76')}]})[_0x1ba8('0x24')](handleEntityNotFound(_0x447766,null))['then'](function(_0x457c56){_0x4967a0[_0x1ba8('0x77')]=_0x457c56;_0x4967a0[_0x1ba8('0x78')]=_[_0x1ba8('0x79')](_0x457c56[_0x1ba8('0x76')],['priority'],[_0x1ba8('0x7a')]);if(_0x4967a0[_0x1ba8('0x77')][_0x1ba8('0x76')]){delete _0x4967a0[_0x1ba8('0x77')][_0x1ba8('0x76')];}return db[_0x1ba8('0x7b')][_0x1ba8('0x67')]();})[_0x1ba8('0x24')](function(_0x104ba1){if(!_0x104ba1){throw new db[(_0x1ba8('0x7c'))][(_0x1ba8('0x7d'))](_0x1ba8('0x7e'));}_0x3722a7=_[_0x1ba8('0x7f')](_['keys'](_0x104ba1),[_0x1ba8('0x80'),_0x1ba8('0x81')]);_0x123dc7=_[_0x1ba8('0x7f')](_[_0x1ba8('0x4a')](_0x104ba1),['createdAt','updatedAt',_0x1ba8('0x82'),_0x1ba8('0x83')]);_0x4967a0[_0x1ba8('0x66')]={'mapKey':_0x1ba8('0x84')};if(_0x4967a0['account'][_0x1ba8('0x85')]){switch(_0x4967a0['account'][_0x1ba8('0x85')]){case _0x1ba8('0x86'):_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x88')];_0x4967a0['body'][_0x1ba8('0x66')]=_0x333318[_0x1ba8('0x66')]['Body'];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x89')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x8a')];break;case _0x1ba8('0x8b'):_0x4967a0['body'][_0x1ba8('0x87')]='+'+_0x333318[_0x1ba8('0x66')][_0x1ba8('0x8c')];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x66')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x8d')];break;case _0x1ba8('0x8e'):_0x4967a0[_0x1ba8('0x66')]['from']=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x87')];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x66')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x2c')];break;case'clicksend':_0x4967a0[_0x1ba8('0x66')]['from']=_0x333318[_0x1ba8('0x66')]['from'];_0x4967a0['body']['body']=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x66')];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x89')]=_0x333318[_0x1ba8('0x66')]['message_id'];break;case'plivo':_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x88')];_0x4967a0['body'][_0x1ba8('0x66')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x8f')];_0x4967a0[_0x1ba8('0x66')]['messageId']=_0x333318[_0x1ba8('0x66')]['MessageUUID'];break;case _0x1ba8('0x90'):_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')]='+'+_0x333318[_0x1ba8('0x66')][_0x1ba8('0x91')][0x0][_0x1ba8('0x87')];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x66')]=_0x333318[_0x1ba8('0x66')]['results'][0x0][_0x1ba8('0x8d')];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x89')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x91')][0x0]['messageId'];break;case _0x1ba8('0x92'):_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x93')];_0x4967a0[_0x1ba8('0x66')]['body']=_0x333318['body'][_0x1ba8('0x94')][_0x1ba8('0x2c')];break;case _0x1ba8('0x95'):_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')]=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x96')];_0x4967a0[_0x1ba8('0x66')]['body']=_0x333318[_0x1ba8('0x66')]['text'];_0x4967a0[_0x1ba8('0x66')]['messageId']=_0x333318[_0x1ba8('0x66')][_0x1ba8('0x97')];break;case _0x1ba8('0x98'):_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x89')]=_0x333318[_0x1ba8('0x66')][0x0][_0x1ba8('0x2c')]['id'];_0x4967a0['body'][_0x1ba8('0x87')]=_0x333318[_0x1ba8('0x66')][0x0][_0x1ba8('0x2c')]['from'];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x66')]=_0x333318['body'][0x0][_0x1ba8('0x2c')][_0x1ba8('0x8d')];break;case _0x1ba8('0x99'):_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')]=_0x333318['body'][_0x1ba8('0x87')];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x66')]=_0x333318[_0x1ba8('0x66')]['message'];_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x89')]=_0x333318['body'][_0x1ba8('0x9a')];break;}}if(_0x4967a0[_0x1ba8('0x66')]['id']){delete _0x4967a0[_0x1ba8('0x66')]['id'];}if(_[_0x1ba8('0x9b')](_0x4967a0['body'][_0x1ba8('0x87')])){throw new db['Sequelize']['ValidationError'](_0x1ba8('0x9c'));}if(_[_0x1ba8('0x9b')](_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x66')])||_0x4967a0['body'][_0x1ba8('0x66')]===''){throw new db['Sequelize'][(_0x1ba8('0x7d'))](_0x1ba8('0x9d'));}if(_[_0x1ba8('0x9b')](_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x9e')])){throw new db[(_0x1ba8('0x7c'))][(_0x1ba8('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x123dc7);}if(!_[_0x1ba8('0x9f')](_0x123dc7,_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x9e')])){throw new db['Sequelize']['ValidationError'](_0x1ba8('0xa0')+_0x123dc7);}_0x40d546[_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x9e')]]=_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')];return db[_0x1ba8('0xa1')]['find']({'where':{'id':_0x4967a0[_0x1ba8('0x77')][_0x1ba8('0x83')]},'include':[{'model':db['CmContact'],'as':_0x1ba8('0xa2'),'where':_0x40d546,'limit':0x1,'order':[[_0x1ba8('0x81'),'DESC']]}]});})['then'](handleEntityNotFound(_0x447766,null))[_0x1ba8('0x24')](function(_0x619465){if(_0x619465){_0x4967a0[_0x1ba8('0xa3')]=_[_0x1ba8('0xa4')](_0x619465,['Contacts']);if(_0x619465[_0x1ba8('0xa2')][_0x1ba8('0x4f')]){return _0x619465['Contacts'][0x0];}var _0x4909d3=_[_0x1ba8('0x1b')](_0x4967a0[_0x1ba8('0x66')],{'firstName':_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')],'ListId':_0x619465['id']});_0x4909d3[_0x4967a0[_0x1ba8('0x66')]['mapKey']]=_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')];return db[_0x1ba8('0x7b')][_0x1ba8('0x5e')](_0x4909d3,{'fields':_0x3722a7,'raw':!![]});}})[_0x1ba8('0x24')](handleEntityNotFound(_0x447766,null))[_0x1ba8('0x24')](function(_0x4e22cf){if(_0x4e22cf){_0x4967a0[_0x1ba8('0xa5')]=_0x4e22cf;var _0xf180be={'ContactId':_0x4e22cf['id'],'phone':_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x87')],'SmsAccountId':_0x333318[_0x1ba8('0x5c')]['id']};var _0x39acc6={'ContactId':_0x4e22cf['id'],'SmsAccountId':_0x333318[_0x1ba8('0x5c')]['id'],'closed':![]};return db[_0x1ba8('0xa6')][_0x1ba8('0x63')]({'where':_0x39acc6})[_0x1ba8('0x24')](function(_0x438a5d){if(_0x438a5d){return[_0x438a5d,![]];}return db[_0x1ba8('0xa6')][_0x1ba8('0x5e')](_0xf180be)[_0x1ba8('0x24')](function(_0x1cc56a){return[_0x1cc56a,!![]];});});}})[_0x1ba8('0xa7')](function(_0x543da0,_0x561871){_0x4967a0[_0x1ba8('0xa8')]=_0x543da0['get']({'plain':!![]});_0x4967a0[_0x1ba8('0xa8')]['created']=![];if(_0x561871){if(_0x4967a0[_0x1ba8('0x77')][_0x1ba8('0xa9')]){_0x4967a0[_0x1ba8('0x78')][_0x1ba8('0xaa')]({'id':0x0,'priority':_0x4967a0[_0x1ba8('0x78')][_0x1ba8('0x4f')]+0x1,'app':_0x1ba8('0xab'),'appdata':_0x1ba8('0xac'),'interval':_0x1ba8('0xad')});}_0x4967a0[_0x1ba8('0xa8')]['created']=!![];}return db[_0x1ba8('0xae')][_0x1ba8('0x5e')]({'phone':_0x4967a0[_0x1ba8('0x66')]['from'],'messageId':_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0x89')],'body':_0x4967a0['body'][_0x1ba8('0x66')],'SmsAccountId':_0x333318[_0x1ba8('0x5c')]['id'],'SmsInteractionId':_0x543da0['id'],'direction':'in','ContactId':_0x543da0[_0x1ba8('0xaf')],'AttachmentId':_0x4967a0[_0x1ba8('0x66')][_0x1ba8('0xb0')]});})['then'](function(_0x1f8e62){_0x4967a0[_0x1ba8('0x2c')]=_0x1f8e62;if(_0x4967a0['interaction'][_0x1ba8('0xb1')]){return db[_0x1ba8('0xb2')][_0x1ba8('0x63')]({'attributes':['id',_0x1ba8('0x41')],'where':{'id':_0x4967a0[_0x1ba8('0xa8')][_0x1ba8('0xb1')]}})['then'](function(_0x3b55b0){if(_0x3b55b0){_0x4967a0[_0x1ba8('0x78')][_0x1ba8('0xb3')]({'id':0x0,'priority':0x0,'app':_0x1ba8('0xb4'),'appdata':_0x3b55b0[_0x1ba8('0x41')]+','+(_0x4967a0['account'][_0x1ba8('0xb5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1ba8('0xb6'),_0x4967a0);});}return respondWithRpcPromise(_0x1ba8('0xb7'),_0x1ba8('0xb6'),_0x4967a0);})[_0x1ba8('0x24')](function(_0x4c0155){if(_0x4c0155){var _0x3f8a9b=0xc8;var _0x118670=_0x1ba8('0xb8');logger[_0x1ba8('0x25')](_0x1ba8('0x29'),_0x118670,_0x3f8a9b,_0x1ba8('0xb9'));logger[_0x1ba8('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x118670,_0x3f8a9b,_0x1ba8('0xb9'),JSON[_0x1ba8('0xba')](_0x4c0155));if(_0x4967a0[_0x1ba8('0x77')][_0x1ba8('0x85')]===_0x1ba8('0x86')){return _0x447766[_0x1ba8('0x2f')](_0x3f8a9b)[_0x1ba8('0x36')]('Content-Type',_0x1ba8('0xbb'))[_0x1ba8('0x42')](_0x1ba8('0xbc'));}else{return _0x447766[_0x1ba8('0x2f')](_0x3f8a9b)['json'](_0x4c0155);}}})[_0x1ba8('0x2d')](handleError(_0x447766,null));};exports[_0x1ba8('0xbd')]=function(_0x35ee95,_0x436bde){var _0x8e1154=_0x35ee95[_0x1ba8('0x5c')]['id'];var _0x1d021a=_0x35ee95[_0x1ba8('0x66')];var _0x2ad780=0xc8;var _0x1bb0fb=null;return db[_0x1ba8('0xbe')][_0x1ba8('0xbf')]({'isolationLevel':db['sequelize'][_0x1ba8('0xc0')][_0x1ba8('0xc1')]['READ_COMMITTED']},function(_0x26370a){return db['SmsAccount'][_0x1ba8('0x72')]({'where':{'id':_0x8e1154},'transaction':_0x26370a})[_0x1ba8('0x24')](function(_0x147643){if(_0x147643){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x8e1154},'transaction':_0x26370a})[_0x1ba8('0x24')](function(){var _0x3a3627=_[_0x1ba8('0x46')](_0x1d021a,function(_0x9fd11){_0x9fd11[_0x1ba8('0x69')]=_0x8e1154;return _0x9fd11;});return db[_0x1ba8('0xc2')][_0x1ba8('0xc3')](_0x3a3627,{'transaction':_0x26370a});});}else{_0x2ad780=0x194;_0x1bb0fb=[];}});})[_0x1ba8('0x24')](function(){if(_0x2ad780!==0x194){return db[_0x1ba8('0xc2')][_0x1ba8('0xc4')]({'where':{'SmsAccountId':_0x8e1154},'order':_0x1ba8('0xc5')})[_0x1ba8('0x24')](function(_0x10c557){_0x1bb0fb=_0x10c557;});}})[_0x1ba8('0x2d')](function(_0x3fcca3){_0x2ad780=0x1f4;logger[_0x1ba8('0x2a')](_0x3fcca3[_0x1ba8('0x40')]);if(_0x3fcca3['name']){delete _0x3fcca3[_0x1ba8('0x41')];}_0x1bb0fb=_0x3fcca3;})[_0x1ba8('0xc6')](function(){if(_0x1bb0fb===null){_0x436bde['sendStatus'](_0x2ad780);}else{if(_0x2ad780===0x1f4){_0x436bde['status'](_0x2ad780)[_0x1ba8('0x42')](_0x1bb0fb);}else{_0x436bde[_0x1ba8('0x2f')](_0x2ad780)[_0x1ba8('0x31')](_0x1bb0fb);}}});};exports[_0x1ba8('0xc7')]=function(_0x320395,_0x3138f0,_0x929649){var _0x15e1d8={};var _0x49fafe={};var _0x158a88;var _0x554938;return db[_0x1ba8('0x47')]['findOne']({'where':{'id':_0x320395['params']['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x3138f0,null))['then'](function(_0x1c28dc){if(_0x1c28dc){_0x158a88=_0x1c28dc;_0x49fafe[_0x1ba8('0x4c')]=_[_0x1ba8('0x4a')](db[_0x1ba8('0xc2')][_0x1ba8('0x48')]);_0x49fafe[_0x1ba8('0x49')]=_[_0x1ba8('0x4a')](_0x320395[_0x1ba8('0x49')]);_0x49fafe['filters']=_[_0x1ba8('0x4b')](_0x49fafe[_0x1ba8('0x4c')],_0x49fafe['query']);_0x15e1d8[_0x1ba8('0x4d')]=_['intersection'](_0x49fafe[_0x1ba8('0x4c')],qs[_0x1ba8('0x4e')](_0x320395[_0x1ba8('0x49')][_0x1ba8('0x4e')]));_0x15e1d8[_0x1ba8('0x4d')]=_0x15e1d8[_0x1ba8('0x4d')][_0x1ba8('0x4f')]?_0x15e1d8[_0x1ba8('0x4d')]:_0x49fafe[_0x1ba8('0x4c')];_0x15e1d8[_0x1ba8('0x6c')]=qs['sort'](_0x320395[_0x1ba8('0x49')][_0x1ba8('0x6d')]);_0x15e1d8[_0x1ba8('0x52')]=qs['filters'](_[_0x1ba8('0x53')](_0x320395[_0x1ba8('0x49')],_0x49fafe[_0x1ba8('0x54')]));if(_0x320395['query'][_0x1ba8('0x56')]){_0x15e1d8[_0x1ba8('0x52')]=_['merge'](_0x15e1d8[_0x1ba8('0x52')],{'$or':_[_0x1ba8('0x46')](_0x15e1d8[_0x1ba8('0x4d')],function(_0x494e2f){var _0x3fbd73={};_0x3fbd73[_0x494e2f]={'$like':'%'+_0x320395['query'][_0x1ba8('0x56')]+'%'};return _0x3fbd73;})});}_0x15e1d8=_['merge']({},_0x15e1d8,_0x320395['options']);return _0x158a88[_0x1ba8('0xc7')](_0x15e1d8);}})[_0x1ba8('0x24')](function(_0x2c89c4){if(_0x2c89c4){_0x554938=_0x2c89c4[_0x1ba8('0x4f')];if(!_0x320395[_0x1ba8('0x49')]['hasOwnProperty']('nolimit')){_0x15e1d8['limit']=qs['limit'](_0x320395[_0x1ba8('0x49')][_0x1ba8('0x34')]);_0x15e1d8[_0x1ba8('0x32')]=qs[_0x1ba8('0x32')](_0x320395['query'][_0x1ba8('0x32')]);}return _0x158a88[_0x1ba8('0xc7')](_0x15e1d8);}})[_0x1ba8('0x24')](function(_0x3c3afe){if(_0x3c3afe){return _0x3c3afe?{'count':_0x554938,'rows':_0x3c3afe}:null;}})[_0x1ba8('0x24')](respondWithResult(_0x3138f0,null))[_0x1ba8('0x2d')](handleError(_0x3138f0,null));};exports[_0x1ba8('0xc8')]=function(_0x373178,_0x5e9156,_0x21f871){var _0x3b3bf3={'raw':![],'where':{}};var _0x1d0e09={};var _0x5d7665={'count':0x0,'rows':[]};return db[_0x1ba8('0x47')][_0x1ba8('0x72')]({'where':{'id':_0x373178[_0x1ba8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5e9156,null))[_0x1ba8('0x24')](function(_0x1af601){if(_0x1af601){_0x1d0e09['model']=_['keys'](db[_0x1ba8('0xa6')][_0x1ba8('0x48')]);_0x1d0e09['query']=_[_0x1ba8('0x4a')](_0x373178[_0x1ba8('0x49')]);_0x1d0e09['filters']=_[_0x1ba8('0x4b')](_0x1d0e09[_0x1ba8('0x4c')],_0x1d0e09[_0x1ba8('0x49')]);_0x3b3bf3['attributes']=_['intersection'](_0x1d0e09['model'],qs[_0x1ba8('0x4e')](_0x373178[_0x1ba8('0x49')]['fields']));_0x3b3bf3[_0x1ba8('0x4d')]=_0x3b3bf3[_0x1ba8('0x4d')][_0x1ba8('0x4f')]?_0x3b3bf3['attributes']:_0x1d0e09[_0x1ba8('0x4c')];if(!_0x373178['query'][_0x1ba8('0x50')](_0x1ba8('0x51'))){_0x3b3bf3[_0x1ba8('0x34')]=qs[_0x1ba8('0x34')](_0x373178[_0x1ba8('0x49')][_0x1ba8('0x34')]);_0x3b3bf3[_0x1ba8('0x32')]=qs[_0x1ba8('0x32')](_0x373178[_0x1ba8('0x49')][_0x1ba8('0x32')]);}_0x3b3bf3['order']=qs[_0x1ba8('0x6d')](_0x373178[_0x1ba8('0x49')][_0x1ba8('0x6d')]);_0x3b3bf3[_0x1ba8('0x52')]=qs[_0x1ba8('0x54')](_[_0x1ba8('0x53')](_0x373178[_0x1ba8('0x49')],_0x1d0e09['filters']));_0x3b3bf3[_0x1ba8('0x52')][_0x1ba8('0x69')]=_0x1af601['id'];if(_0x373178[_0x1ba8('0x49')][_0x1ba8('0x56')]){_0x3b3bf3[_0x1ba8('0x52')]=_[_0x1ba8('0x57')](_0x3b3bf3[_0x1ba8('0x52')],{'$or':_[_0x1ba8('0x46')](_0x3b3bf3[_0x1ba8('0x4d')],function(_0x583f4d){var _0x484e95={};_0x484e95[_0x583f4d]={'$like':'%'+_0x373178[_0x1ba8('0x49')][_0x1ba8('0x56')]+'%'};return _0x484e95;})});}_0x3b3bf3=_['merge']({},_0x3b3bf3,_0x373178[_0x1ba8('0x58')]);return db['SmsInteraction'][_0x1ba8('0x35')]({'where':_0x3b3bf3[_0x1ba8('0x52')]})['then'](function(_0x37670e){_0x5d7665[_0x1ba8('0x35')]=_0x37670e;if(_0x373178[_0x1ba8('0x49')][_0x1ba8('0x59')]){_0x3b3bf3[_0x1ba8('0x5d')]=[{'model':db[_0x1ba8('0x7b')],'as':_0x1ba8('0xc9'),'required':![]},{'model':db[_0x1ba8('0xb2')],'as':_0x1ba8('0xca'),'attributes':[_0x1ba8('0x41'),_0x1ba8('0xcb'),_0x1ba8('0xcc')],'required':![]},{'model':db[_0x1ba8('0xcd')],'as':_0x1ba8('0xce'),'attributes':['id','name','color'],'where':_0x373178[_0x1ba8('0x49')][_0x1ba8('0xcf')]?{'id':_0x373178[_0x1ba8('0x49')][_0x1ba8('0xcf')]}:undefined,'required':_0x373178[_0x1ba8('0x49')][_0x1ba8('0xcf')]?!![]:![]}];}return db[_0x1ba8('0xa6')][_0x1ba8('0x5a')](_0x3b3bf3);})[_0x1ba8('0x24')](function(_0x4f725e){_0x5d7665['rows']=_0x4f725e;return _0x5d7665;});}})[_0x1ba8('0x24')](respondWithFilteredResult(_0x5e9156,_0x3b3bf3))['catch'](handleError(_0x5e9156,null));};exports[_0x1ba8('0x42')]=function(_0x221dd5,_0x1f41ec,_0x11755c){var _0x4ac55c,_0x490ae3,_0x758593;if(_['isNil'](_0x221dd5[_0x1ba8('0x66')][_0x1ba8('0x66')])||_0x221dd5[_0x1ba8('0x66')][_0x1ba8('0x66')]===''){throw new db['Sequelize'][(_0x1ba8('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x221dd5[_0x1ba8('0x66')]['to'])){throw new db[(_0x1ba8('0x7c'))][(_0x1ba8('0x7d'))]('to\x20is\x20mandatory');}_0x4ac55c=_0x221dd5[_0x1ba8('0x66')]['to'];return db[_0x1ba8('0x47')][_0x1ba8('0x63')]({'where':{'id':_0x221dd5[_0x1ba8('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x1ba8('0xd0'),'include':[{'model':db[_0x1ba8('0x7b')],'as':_0x1ba8('0xa2'),'where':{'mobile':_0x4ac55c},'limit':0x1,'order':[[_0x1ba8('0x81'),_0x1ba8('0xd1')]]}]}]})[_0x1ba8('0x24')](handleEntityNotFound(_0x1f41ec,null))['then'](function(_0x1e9b2a){if(_0x1e9b2a&&_0x1e9b2a[_0x1ba8('0xd0')]){_0x490ae3=_0x1e9b2a['get']({'plain':!![]});if(_0x490ae3[_0x1ba8('0xd0')]&&_0x490ae3[_0x1ba8('0xd0')][_0x1ba8('0xa2')][_0x1ba8('0x4f')]){return _0x490ae3['List'][_0x1ba8('0xa2')][0x0];}return db[_0x1ba8('0x7b')][_0x1ba8('0x5e')](_[_0x1ba8('0x1b')](_0x221dd5[_0x1ba8('0x66')],{'firstName':_0x4ac55c,'mobile':_0x4ac55c,'phone':_0x4ac55c,'ListId':_0x490ae3['ListId']}));}})[_0x1ba8('0x24')](handleEntityNotFound(_0x1f41ec,null))[_0x1ba8('0x24')](function(_0x50c054){if(_0x50c054){_0x758593=_0x50c054;return db[_0x1ba8('0xa6')][_0x1ba8('0x63')]({'where':{'ContactId':_0x758593['id'],'closed':![],'SmsAccountId':_0x490ae3['id']}})[_0x1ba8('0x24')](function(_0x3f8f31){if(_0x3f8f31){return[_0x3f8f31,![]];}return db[_0x1ba8('0xa6')][_0x1ba8('0x5e')]({'UserId':_0x221dd5[_0x1ba8('0x5f')]['id'],'ContactId':_0x758593['id'],'SmsAccountId':_0x490ae3['id'],'phone':_0x4ac55c,'firstMsgDirection':_0x1ba8('0xd2'),'Messages':[_[_0x1ba8('0x57')](_0x221dd5['body'],{'read':![],'body':_0x221dd5[_0x1ba8('0x66')][_0x1ba8('0x66')],'phone':_0x4ac55c,'SmsAccountId':_0x490ae3['id'],'UserId':_0x221dd5[_0x1ba8('0x5f')]['id'],'ContactId':_0x758593['id']})]},{'include':[{'model':db[_0x1ba8('0xae')],'as':_0x1ba8('0xd3')}]})[_0x1ba8('0x24')](function(_0x18408b){return[_0x18408b,!![]];});});}})[_0x1ba8('0xa7')](function(_0xf32895,_0x55eb5d){if(_0x55eb5d){return _0xf32895;}return db[_0x1ba8('0xae')][_0x1ba8('0x5e')](_[_0x1ba8('0x57')](_0x221dd5[_0x1ba8('0x66')],{'read':![],'body':_0x221dd5[_0x1ba8('0x66')][_0x1ba8('0x66')],'phone':_0x4ac55c,'SmsAccountId':_0x490ae3['id'],'SmsInteractionId':_0xf32895['id'],'UserId':_0x221dd5['user']['id'],'ContactId':_0x758593['id']}))[_0x1ba8('0x24')](function(_0x30e829){_0xf32895['dataValues']['Messages']=[];_0xf32895['dataValues'][_0x1ba8('0xd3')]['push'](_0x30e829[_0x1ba8('0xd4')]);return _0xf32895;});})['then'](respondWithResult(_0x1f41ec,null))[_0x1ba8('0x2d')](handleError(_0x1f41ec,null));};exports[_0x1ba8('0x2f')]=function(_0x17c964,_0xb50cc2,_0x15c183){if(_0x17c964[_0x1ba8('0x66')]['id']){delete _0x17c964[_0x1ba8('0x66')]['id'];}var _0x56aaab,_0x66f7c,_0x20aa1c;return db[_0x1ba8('0x47')]['find']({'where':{'id':_0x17c964[_0x1ba8('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb50cc2,null))[_0x1ba8('0x24')](function(_0x36d481){if(_0x36d481){_0x20aa1c=_0x36d481;logger['debug'](_0x1ba8('0x29'),_0x1ba8('0x2f'),_0x1ba8('0xd5'),_0x36d481[_0x1ba8('0x85')],util[_0x1ba8('0xd6')](_0x17c964[_0x1ba8('0x66')],{'showHidden':![],'depth':null}));switch(_0x36d481[_0x1ba8('0x85')]){case _0x1ba8('0x8b'):if(_0x17c964[_0x1ba8('0x66')][_0x1ba8('0xd7')]&&_0x17c964[_0x1ba8('0x66')][_0x1ba8('0x2f')]){_0x66f7c=_0x17c964[_0x1ba8('0x66')]['status'];return db[_0x1ba8('0xae')]['find']({'where':{'messageId':_0x17c964[_0x1ba8('0x66')][_0x1ba8('0xd7')]}});}break;case _0x1ba8('0x8e'):if(_0x17c964[_0x1ba8('0x66')][_0x1ba8('0xd8')]&&_0x17c964[_0x1ba8('0x66')][_0x1ba8('0xd9')]){_0x66f7c=_0x17c964[_0x1ba8('0x66')][_0x1ba8('0xd9')];return db['SmsMessage'][_0x1ba8('0x63')]({'where':{'messageId':_0x17c964['body']['requestid']}});}break;case _0x1ba8('0xda'):if(_0x17c964[_0x1ba8('0x66')]['message_id']&&_0x17c964[_0x1ba8('0x66')][_0x1ba8('0xdb')]){_0x66f7c=_0x17c964[_0x1ba8('0x66')]['status_code'];return db[_0x1ba8('0xae')]['find']({'where':{'messageId':_0x17c964[_0x1ba8('0x66')][_0x1ba8('0xdc')]}});}break;case _0x1ba8('0x90'):var _0x2b5aac=_0x17c964[_0x1ba8('0x66')][_0x1ba8('0x91')][0x0];if(_0x2b5aac['messageId']&&_0x2b5aac[_0x1ba8('0x2f')][_0x1ba8('0xdd')]===_0x1ba8('0xde')){_0x66f7c=_0x2b5aac[_0x1ba8('0x2f')][_0x1ba8('0xdd')];return db[_0x1ba8('0xae')][_0x1ba8('0x63')]({'where':{'messageId':_0x2b5aac['messageId']}});}break;case _0x1ba8('0x95'):if(_0x17c964[_0x1ba8('0x66')][_0x1ba8('0x89')]&&_0x17c964['body'][_0x1ba8('0x2f')]){_0x66f7c=_0x17c964['body'][_0x1ba8('0x2f')];return db[_0x1ba8('0xae')][_0x1ba8('0x63')]({'where':{'messageId':_0x17c964['body'][_0x1ba8('0x89')]}});}break;case _0x1ba8('0x98'):if(_0x17c964[_0x1ba8('0x66')][0x0]['message']['id']){_0x66f7c=_0x17c964[_0x1ba8('0x66')][0x0]['type'];return db[_0x1ba8('0xae')]['find']({'where':{'messageId':_0x17c964['body'][0x0]['message']['id']}});}break;case _0x1ba8('0x99'):if(_0x17c964['body'][_0x1ba8('0xdf')]&&_0x17c964[_0x1ba8('0x66')]['status']){_0x66f7c=_0x17c964[_0x1ba8('0x66')][_0x1ba8('0x2f')];return db[_0x1ba8('0xae')][_0x1ba8('0x63')]({'where':{'messageId':_0x17c964[_0x1ba8('0x66')]['redif']}});}break;}}})[_0x1ba8('0x24')](handleEntityNotFound(_0xb50cc2,null))[_0x1ba8('0x24')](function(_0x58b46d){if(_0x58b46d){_0x56aaab=_0x58b46d;switch(_0x20aa1c[_0x1ba8('0x85')]){case'skebby':if(_0x66f7c===_0x1ba8('0xde')){return _0x56aaab[_0x1ba8('0x3b')]({'read':!![]});}else{logger[_0x1ba8('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1ba8('0x2f'),_0x1ba8('0x8b'),util[_0x1ba8('0xd6')](_0x17c964[_0x1ba8('0x66')],{'showHidden':![],'depth':null}));}break;case _0x1ba8('0x8e'):if(_0x66f7c==='1'){return _0x56aaab[_0x1ba8('0x3b')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1ba8('0x8b'),util['inspect'](_0x17c964['body'],{'showHidden':![],'depth':null}));}break;case _0x1ba8('0xda'):if(!_0x17c964['body'][_0x1ba8('0xe0')]&&_0x66f7c>=0xc8&&_0x66f7c<=0xce){return _0x56aaab['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0x1ba8('0xd6')](_0x17c964[_0x1ba8('0x66')],{'showHidden':![],'depth':null}));}break;case _0x1ba8('0x90'):var _0x2807e8=_0x17c964[_0x1ba8('0x66')][_0x1ba8('0x91')][0x0];if(_0x2807e8[_0x1ba8('0x2f')]['groupName']===_0x1ba8('0xde')){return _0x56aaab[_0x1ba8('0x3b')]({'read':!![]});}else{logger['error'](_0x1ba8('0x29'),_0x1ba8('0x2f'),_0x1ba8('0x90'),util[_0x1ba8('0xd6')](_0x17c964[_0x1ba8('0x66')],{'showHidden':![],'depth':null}));}break;case _0x1ba8('0x95'):if(_0x66f7c==_0x1ba8('0xe1')||_0x66f7c=='RECEIVED_BY_RECIPIENT'){return _0x56aaab[_0x1ba8('0x3b')]({'read':!![]});}else{logger[_0x1ba8('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clickatell',util['inspect'](_0x17c964[_0x1ba8('0x66')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x66f7c==_0x1ba8('0xe2')){return _0x56aaab['update']({'read':!![]});}else{logger[_0x1ba8('0x2a')](_0x1ba8('0x29'),'status',_0x1ba8('0x98'),util[_0x1ba8('0xd6')](_0x17c964[_0x1ba8('0x66')],{'showHidden':![],'depth':null}));}break;case _0x1ba8('0x99'):if(_0x66f7c===_0x1ba8('0xe3')||_0x66f7c===_0x1ba8('0xe4')){return _0x56aaab[_0x1ba8('0x3b')]({'read':!![]});}else{logger[_0x1ba8('0x2a')](_0x1ba8('0x29'),_0x1ba8('0x2f'),_0x1ba8('0x99'),util[_0x1ba8('0xd6')](_0x17c964['body'],{'showHidden':![],'depth':null}));}break;}return _0x56aaab;}})[_0x1ba8('0x24')](respondWithResult(_0xb50cc2,null))[_0x1ba8('0x2d')](handleError(_0xb50cc2,null));};exports[_0x1ba8('0xe5')]=function(_0x2ea124,_0x5e7ffc,_0xee431f){var _0x1aed05,_0xd4e79e,_0x421f7c;return db['SmsAccount']['find']({'where':{'id':_0x2ea124[_0x1ba8('0x5c')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x5e7ffc,null))[_0x1ba8('0x24')](function(_0x2584c8){if(_0x2584c8){_0x421f7c=_0x2584c8;logger[_0x1ba8('0x28')](_0x1ba8('0x29'),'status',_0x1ba8('0xd5'),_0x2584c8['type'],util[_0x1ba8('0xd6')](_0x2ea124['query'],{'showHidden':![],'depth':null}));switch(_0x2584c8[_0x1ba8('0x85')]){case'csc':if(_0x2ea124[_0x1ba8('0x49')][_0x1ba8('0xe6')]&&_0x2ea124[_0x1ba8('0x49')]['state']){_0xd4e79e=_0x2ea124[_0x1ba8('0x49')][_0x1ba8('0xe7')];return db['SmsMessage'][_0x1ba8('0x63')]({'where':{'messageId':_0x2ea124[_0x1ba8('0x49')][_0x1ba8('0xe6')]}});}break;}}})[_0x1ba8('0x24')](handleEntityNotFound(_0x5e7ffc,null))['then'](function(_0x24300b){if(_0x24300b){_0x1aed05=_0x24300b;switch(_0x421f7c['type']){case'csc':if(_0xd4e79e==='2'||_0xd4e79e==='6'){return _0x1aed05[_0x1ba8('0x3b')]({'read':!![]});}else{logger[_0x1ba8('0x2a')](_0x1ba8('0x29'),_0x1ba8('0x2f'),_0x1ba8('0x92'),util[_0x1ba8('0xd6')](_0x2ea124[_0x1ba8('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x1aed05;}})[_0x1ba8('0x24')](respondWithResult(_0x5e7ffc,null))[_0x1ba8('0x2d')](handleError(_0x5e7ffc,null));};exports[_0x1ba8('0xe8')]=function(_0x445915,_0x78c919,_0x4dd3fc){return db['SmsAccount']['find']({'where':{'id':_0x445915['params']['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x78c919,null))[_0x1ba8('0x24')](function(_0x452126){if(_0x452126){return _0x452126[_0x1ba8('0xe8')](_0x445915[_0x1ba8('0x66')][_0x1ba8('0x6f')],_[_0x1ba8('0xa4')](_0x445915[_0x1ba8('0x66')],['ids','id'])||{})[_0x1ba8('0xa7')](function(_0x1b6487){for(var _0x3d0743=0x0;_0x3d0743<_0x445915[_0x1ba8('0x66')][_0x1ba8('0x6f')]['length'];_0x3d0743+=0x1){socket[_0x1ba8('0xe9')](_0x1ba8('0xea'),{'UserId':Number(_0x445915['body'][_0x1ba8('0x6f')][_0x3d0743]),'SmsAccountId':Number(_0x445915['params']['id'])});}return _0x1b6487;});}})['then'](respondWithResult(_0x78c919,null))[_0x1ba8('0x2d')](handleError(_0x78c919,null));};exports[_0x1ba8('0xeb')]=function(_0x4245ee,_0x4f069b,_0x4780c7){return db[_0x1ba8('0x47')][_0x1ba8('0x63')]({'where':{'id':_0x4245ee['params']['id']}})['then'](handleEntityNotFound(_0x4f069b,null))[_0x1ba8('0x24')](function(_0x2d9c29){if(_0x2d9c29){return _0x2d9c29[_0x1ba8('0xeb')](_0x4245ee['query'][_0x1ba8('0x6f')])[_0x1ba8('0x24')](function(){if(_[_0x1ba8('0xec')](_0x4245ee[_0x1ba8('0x49')][_0x1ba8('0x6f')])){for(var _0xdcea02=0x0;_0xdcea02<_0x4245ee[_0x1ba8('0x49')][_0x1ba8('0x6f')][_0x1ba8('0x4f')];_0xdcea02+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x4245ee['query'][_0x1ba8('0x6f')][_0xdcea02]),'SmsAccountId':Number(_0x4245ee[_0x1ba8('0x5c')]['id'])});}}else{socket[_0x1ba8('0xe9')]('userSmsAccount:remove',{'UserId':Number(_0x4245ee[_0x1ba8('0x49')][_0x1ba8('0x6f')]),'SmsAccountId':Number(_0x4245ee['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4f069b,null))[_0x1ba8('0x2d')](handleError(_0x4f069b,null));};exports[_0x1ba8('0xed')]=function(_0x424239,_0x45e920,_0x20cd37){var _0x3e07b3={};var _0xed8337={};var _0x1f389b;var _0xcc5392;return db['SmsAccount'][_0x1ba8('0x72')]({'where':{'id':_0x424239[_0x1ba8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x45e920,null))['then'](function(_0x3162c6){if(_0x3162c6){_0x1f389b=_0x3162c6;_0xed8337[_0x1ba8('0x4c')]=_[_0x1ba8('0x4a')](db[_0x1ba8('0xb2')][_0x1ba8('0x48')]);_0xed8337[_0x1ba8('0x49')]=_['keys'](_0x424239[_0x1ba8('0x49')]);_0xed8337[_0x1ba8('0x54')]=_[_0x1ba8('0x4b')](_0xed8337['model'],_0xed8337[_0x1ba8('0x49')]);_0x3e07b3[_0x1ba8('0x4d')]=_['intersection'](_0xed8337['model'],qs[_0x1ba8('0x4e')](_0x424239[_0x1ba8('0x49')][_0x1ba8('0x4e')]));_0x3e07b3[_0x1ba8('0x4d')]=_0x3e07b3[_0x1ba8('0x4d')]['length']?_0x3e07b3[_0x1ba8('0x4d')]:_0xed8337[_0x1ba8('0x4c')];_0x3e07b3[_0x1ba8('0x6c')]=qs[_0x1ba8('0x6d')](_0x424239[_0x1ba8('0x49')][_0x1ba8('0x6d')]);_0x3e07b3[_0x1ba8('0x52')]=qs[_0x1ba8('0x54')](_['pick'](_0x424239[_0x1ba8('0x49')],_0xed8337[_0x1ba8('0x54')]));if(_0x424239[_0x1ba8('0x49')][_0x1ba8('0x56')]){_0x3e07b3['where']=_[_0x1ba8('0x57')](_0x3e07b3['where'],{'$or':_[_0x1ba8('0x46')](_0x3e07b3['attributes'],function(_0x58eeb9){var _0x171d5a={};_0x171d5a[_0x58eeb9]={'$like':'%'+_0x424239['query'][_0x1ba8('0x56')]+'%'};return _0x171d5a;})});}_0x3e07b3=_[_0x1ba8('0x57')]({},_0x3e07b3,_0x424239['options']);return _0x1f389b[_0x1ba8('0xed')](_0x3e07b3);}})['then'](function(_0x2a0f38){if(_0x2a0f38){_0xcc5392=_0x2a0f38[_0x1ba8('0x4f')];if(!_0x424239[_0x1ba8('0x49')][_0x1ba8('0x50')](_0x1ba8('0x51'))){_0x3e07b3[_0x1ba8('0x34')]=qs[_0x1ba8('0x34')](_0x424239[_0x1ba8('0x49')][_0x1ba8('0x34')]);_0x3e07b3[_0x1ba8('0x32')]=qs[_0x1ba8('0x32')](_0x424239['query']['offset']);}return _0x1f389b[_0x1ba8('0xed')](_0x3e07b3);}})[_0x1ba8('0x24')](function(_0xa8cfc9){if(_0xa8cfc9){return _0xa8cfc9?{'count':_0xcc5392,'rows':_0xa8cfc9}:null;}})[_0x1ba8('0x24')](respondWithResult(_0x45e920,null))[_0x1ba8('0x2d')](handleError(_0x45e920,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d411cdf..3d1974c 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 _0x3527=['../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','exports'];(function(_0x20352e,_0x1ee2ac){var _0x5a9319=function(_0x168ac4){while(--_0x168ac4){_0x20352e['push'](_0x20352e['shift']());}};_0x5a9319(++_0x1ee2ac);}(_0x3527,0x111));var _0x7352=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x3527[_0x367a3d];return _0x460539;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x7352('0x0'))['db'][_0x7352('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7352('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7352('0x3'),'afterDestroy':_0x7352('0x4')};function emitEvent(_0x4eef3d){return function(_0xb975f9,_0x4f2855,_0x2b0d65){SmsAccountEvents[_0x7352('0x5')](_0x4eef3d+':'+_0xb975f9['id'],_0xb975f9);SmsAccountEvents[_0x7352('0x5')](_0x4eef3d,_0xb975f9);_0x2b0d65(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x7352('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x0468=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xf93076,_0x1acb30){var _0x33d1da=function(_0x29e6bf){while(--_0x29e6bf){_0xf93076['push'](_0xf93076['shift']());}};_0x33d1da(++_0x1acb30);}(_0x0468,0x183));var _0x8046=function(_0x49ee40,_0x347294){_0x49ee40=_0x49ee40-0x0;var _0x5e5b12=_0x0468[_0x49ee40];return _0x5e5b12;};'use strict';var EventEmitter=require(_0x8046('0x0'));var SmsAccount=require(_0x8046('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8046('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d2b08){return function(_0x312e45,_0x9eb395,_0x1baafa){SmsAccountEvents['emit'](_0x3d2b08+':'+_0x312e45['id'],_0x312e45);SmsAccountEvents['emit'](_0x3d2b08,_0x312e45);_0x1baafa(null);};}for(var e in events){if(events[_0x8046('0x3')](e)){var event=events[e];SmsAccount[_0x8046('0x4')](e,emitEvent(event));}}module[_0x8046('0x5')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9aaaf4a..84b15e8 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 _0x9a49=['./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x58da8a,_0x1fb6ff){var _0x5294b9=function(_0x684dd6){while(--_0x684dd6){_0x58da8a['push'](_0x58da8a['shift']());}};_0x5294b9(++_0x1fb6ff);}(_0x9a49,0xeb));var _0x99a4=function(_0x1b19a2,_0x41eb4c){_0x1b19a2=_0x1b19a2-0x0;var _0x2a91de=_0x9a49[_0x1b19a2];return _0x2a91de;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x99a4('0x0'))(_0x99a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x99a4('0x2'));var rimraf=require(_0x99a4('0x3'));var config=require(_0x99a4('0x4'));var attributes=require(_0x99a4('0x5'));module[_0x99a4('0x6')]=function(_0x594b40,_0x4c64fe){return _0x594b40[_0x99a4('0x7')](_0x99a4('0x8'),attributes,{'tableName':_0x99a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30f7=['util','api','moment','bluebird','request-promise','../../config/environment','./smsAccount.attributes','exports','define','lodash'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x30f7,0x8b));var _0x730f=function(_0x192b01,_0xfbc42e){_0x192b01=_0x192b01-0x0;var _0x4de477=_0x30f7[_0x192b01];return _0x4de477;};'use strict';var _=require(_0x730f('0x0'));var util=require(_0x730f('0x1'));var logger=require('../../config/logger')(_0x730f('0x2'));var moment=require(_0x730f('0x3'));var BPromise=require(_0x730f('0x4'));var rp=require(_0x730f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x730f('0x6'));var attributes=require(_0x730f('0x7'));module[_0x730f('0x8')]=function(_0x4f8190,_0x542a98){return _0x4f8190[_0x730f('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 53630dc..503bfe8 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 _0x68ab=['model','include','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','map'];(function(_0x348b9c,_0x5fc30d){var _0x123f11=function(_0x2ee46b){while(--_0x2ee46b){_0x348b9c['push'](_0x348b9c['shift']());}};_0x123f11(++_0x5fc30d);}(_0x68ab,0x150));var _0xb68a=function(_0x1b925b,_0x1ab3c9){_0x1b925b=_0x1b925b-0x0;var _0x275f07=_0x68ab[_0x1b925b];return _0x275f07;};'use strict';var _=require(_0xb68a('0x0'));var util=require(_0xb68a('0x1'));var moment=require(_0xb68a('0x2'));var BPromise=require(_0xb68a('0x3'));var rs=require(_0xb68a('0x4'));var fs=require('fs');var Redis=require(_0xb68a('0x5'));var db=require(_0xb68a('0x6'))['db'];var utils=require(_0xb68a('0x7'));var logger=require('../../config/logger')(_0xb68a('0x8'));var config=require(_0xb68a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb68a('0xa')]({'port':0x232a});config[_0xb68a('0xb')]=_[_0xb68a('0xc')](config[_0xb68a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb68a('0xd'))(new Redis(config[_0xb68a('0xb')]));require(_0xb68a('0xe'))[_0xb68a('0xf')](socket);function respondWithRpcPromise(_0x26b03d,_0x30ec89,_0x8f6a29){return new BPromise(function(_0x5c631b,_0x5333b0){return client[_0xb68a('0x10')](_0x26b03d,_0x8f6a29)['then'](function(_0x14f886){logger[_0xb68a('0x11')]('SmsAccount,\x20%s,\x20%s',_0x30ec89,'request\x20sent');logger[_0xb68a('0x12')](_0xb68a('0x13'),_0x30ec89,_0xb68a('0x14'),JSON['stringify'](_0x14f886));if(_0x14f886[_0xb68a('0x15')]){if(_0x14f886[_0xb68a('0x15')][_0xb68a('0x16')]===0x1f4){logger[_0xb68a('0x15')]('SmsAccount,\x20%s,\x20%s',_0x30ec89,_0x14f886[_0xb68a('0x15')][_0xb68a('0x17')]);return _0x5333b0(_0x14f886[_0xb68a('0x15')][_0xb68a('0x17')]);}logger[_0xb68a('0x15')](_0xb68a('0x18'),_0x30ec89,_0x14f886['error'][_0xb68a('0x17')]);return _0x5c631b(_0x14f886[_0xb68a('0x15')][_0xb68a('0x17')]);}else{logger[_0xb68a('0x11')](_0xb68a('0x18'),_0x30ec89,_0xb68a('0x14'));_0x5c631b(_0x14f886[_0xb68a('0x19')]['message']);}})[_0xb68a('0x1a')](function(_0x3387a2){logger[_0xb68a('0x15')]('SmsAccount,\x20%s,\x20%s',_0x30ec89,_0x3387a2);_0x5333b0(_0x3387a2);});});}exports[_0xb68a('0x1b')]=function(_0x1cadec){var _0x2d9635=this;return new Promise(function(_0x279751,_0x215885){return db[_0xb68a('0x1c')][_0xb68a('0x1d')]({'raw':_0x1cadec['options']?_0x1cadec[_0xb68a('0x1e')][_0xb68a('0x1f')]===undefined?!![]:![]:!![],'where':_0x1cadec[_0xb68a('0x1e')]?_0x1cadec[_0xb68a('0x1e')]['where']||null:null,'attributes':_0x1cadec['options']?_0x1cadec[_0xb68a('0x1e')][_0xb68a('0x20')]||null:null,'include':_0x1cadec['options']?_0x1cadec[_0xb68a('0x1e')]['include']?_[_0xb68a('0x21')](_0x1cadec[_0xb68a('0x1e')]['include'],function(_0x13d752){return{'model':db[_0x13d752[_0xb68a('0x22')]],'as':_0x13d752['as'],'attributes':_0x13d752[_0xb68a('0x20')],'include':_0x13d752['include']?_[_0xb68a('0x21')](_0x13d752[_0xb68a('0x23')],function(_0x18837a){return{'model':db[_0x18837a['model']],'as':_0x18837a['as'],'attributes':_0x18837a[_0xb68a('0x20')],'include':_0x18837a['include']?_[_0xb68a('0x21')](_0x18837a['include'],function(_0x320231){return{'model':db[_0x320231[_0xb68a('0x22')]],'as':_0x320231['as'],'attributes':_0x320231['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d0a5){logger[_0xb68a('0x11')](_0xb68a('0x1b'),_0x1cadec);logger[_0xb68a('0x12')](_0xb68a('0x1b'),_0x1cadec,JSON[_0xb68a('0x24')](_0x31d0a5));_0x279751(_0x31d0a5);})[_0xb68a('0x1a')](function(_0x3a0722){logger[_0xb68a('0x15')](_0xb68a('0x1b'),_0x3a0722[_0xb68a('0x17')],_0x1cadec);_0x215885(_0x2d9635[_0xb68a('0x15')](0x1f4,_0x3a0722[_0xb68a('0x17')]));});});}; \ No newline at end of file +var _0x2fba=['moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','options','raw','attributes','include','map','model','util'];(function(_0x4b7487,_0x15823b){var _0x7860a5=function(_0x5b7648){while(--_0x5b7648){_0x4b7487['push'](_0x4b7487['shift']());}};_0x7860a5(++_0x15823b);}(_0x2fba,0x197));var _0xa2fb=function(_0x1d1f4a,_0x16f322){_0x1d1f4a=_0x1d1f4a-0x0;var _0x4bee32=_0x2fba[_0x1d1f4a];return _0x4bee32;};'use strict';var _=require('lodash');var util=require(_0xa2fb('0x0'));var moment=require(_0xa2fb('0x1'));var BPromise=require(_0xa2fb('0x2'));var rs=require(_0xa2fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa2fb('0x4'))(_0xa2fb('0x5'));var config=require(_0xa2fb('0x6'));var jayson=require(_0xa2fb('0x7'));var client=jayson[_0xa2fb('0x8')][_0xa2fb('0x9')]({'port':0x232a});config[_0xa2fb('0xa')]=_[_0xa2fb('0xb')](config[_0xa2fb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2fb('0xc'))(new Redis(config[_0xa2fb('0xa')]));require(_0xa2fb('0xd'))[_0xa2fb('0xe')](socket);function respondWithRpcPromise(_0x2479ba,_0x1b303e,_0x968bec){return new BPromise(function(_0x55ec53,_0x40b952){return client[_0xa2fb('0xf')](_0x2479ba,_0x968bec)[_0xa2fb('0x10')](function(_0x57a5ca){logger[_0xa2fb('0x11')](_0xa2fb('0x12'),_0x1b303e,_0xa2fb('0x13'));logger[_0xa2fb('0x14')](_0xa2fb('0x15'),_0x1b303e,_0xa2fb('0x13'),JSON['stringify'](_0x57a5ca));if(_0x57a5ca['error']){if(_0x57a5ca[_0xa2fb('0x16')][_0xa2fb('0x17')]===0x1f4){logger[_0xa2fb('0x16')](_0xa2fb('0x12'),_0x1b303e,_0x57a5ca[_0xa2fb('0x16')]['message']);return _0x40b952(_0x57a5ca[_0xa2fb('0x16')][_0xa2fb('0x18')]);}logger[_0xa2fb('0x16')](_0xa2fb('0x12'),_0x1b303e,_0x57a5ca[_0xa2fb('0x16')][_0xa2fb('0x18')]);return _0x55ec53(_0x57a5ca[_0xa2fb('0x16')][_0xa2fb('0x18')]);}else{logger[_0xa2fb('0x11')](_0xa2fb('0x12'),_0x1b303e,'request\x20sent');_0x55ec53(_0x57a5ca[_0xa2fb('0x19')][_0xa2fb('0x18')]);}})[_0xa2fb('0x1a')](function(_0x1b5275){logger[_0xa2fb('0x16')](_0xa2fb('0x12'),_0x1b303e,_0x1b5275);_0x40b952(_0x1b5275);});});}exports[_0xa2fb('0x1b')]=function(_0x3ab337){var _0x40663a=this;return new Promise(function(_0x108e61,_0x4a24f5){return db['SmsAccount']['find']({'raw':_0x3ab337[_0xa2fb('0x1c')]?_0x3ab337['options'][_0xa2fb('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ab337['options']?_0x3ab337['options']['where']||null:null,'attributes':_0x3ab337[_0xa2fb('0x1c')]?_0x3ab337[_0xa2fb('0x1c')][_0xa2fb('0x1e')]||null:null,'include':_0x3ab337[_0xa2fb('0x1c')]?_0x3ab337[_0xa2fb('0x1c')][_0xa2fb('0x1f')]?_[_0xa2fb('0x20')](_0x3ab337[_0xa2fb('0x1c')][_0xa2fb('0x1f')],function(_0x481e1b){return{'model':db[_0x481e1b[_0xa2fb('0x21')]],'as':_0x481e1b['as'],'attributes':_0x481e1b[_0xa2fb('0x1e')],'include':_0x481e1b['include']?_['map'](_0x481e1b[_0xa2fb('0x1f')],function(_0x1d3d54){return{'model':db[_0x1d3d54[_0xa2fb('0x21')]],'as':_0x1d3d54['as'],'attributes':_0x1d3d54['attributes'],'include':_0x1d3d54[_0xa2fb('0x1f')]?_['map'](_0x1d3d54['include'],function(_0xe22146){return{'model':db[_0xe22146['model']],'as':_0xe22146['as'],'attributes':_0xe22146['attributes']};}):[]};}):[]};}):[]:[]})[_0xa2fb('0x10')](function(_0xa143b6){logger['info'](_0xa2fb('0x1b'),_0x3ab337);logger[_0xa2fb('0x14')]('ShowSmsAccount',_0x3ab337,JSON['stringify'](_0xa143b6));_0x108e61(_0xa143b6);})[_0xa2fb('0x1a')](function(_0x203161){logger['error'](_0xa2fb('0x1b'),_0x203161[_0xa2fb('0x18')],_0x3ab337);_0x4a24f5(_0x40663a[_0xa2fb('0x16')](0x1f4,_0x203161[_0xa2fb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b703f4a..1246b8c 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 49daf41..3284016 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(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 536add7..beba712 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 _0x6aff=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x55f4a7,_0x349427){var _0x565f2a=function(_0x38dfe0){while(--_0x38dfe0){_0x55f4a7['push'](_0x55f4a7['shift']());}};_0x565f2a(++_0x349427);}(_0x6aff,0x157));var _0xf6af=function(_0x217f77,_0x2b17ed){_0x217f77=_0x217f77-0x0;var _0x43d08d=_0x6aff[_0x217f77];return _0x43d08d;};'use strict';var Sequelize=require(_0xf6af('0x0'));module[_0xf6af('0x1')]={'priority':{'type':Sequelize[_0xf6af('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf6af('0x3')},'appdata':{'type':Sequelize[_0xf6af('0x4')]()},'description':{'type':Sequelize[_0xf6af('0x5')]},'interval':{'type':Sequelize[_0xf6af('0x5')],'defaultValue':_0xf6af('0x6')}}; \ No newline at end of file +var _0x3581=['TEXT','exports','INTEGER','STRING'];(function(_0x28a095,_0x5ba639){var _0x115dd5=function(_0x34dd99){while(--_0x34dd99){_0x28a095['push'](_0x28a095['shift']());}};_0x115dd5(++_0x5ba639);}(_0x3581,0x139));var _0x1358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3581[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1358('0x0')]={'priority':{'type':Sequelize[_0x1358('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1358('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1358('0x3')]()},'description':{'type':Sequelize[_0x1358('0x2')]},'interval':{'type':Sequelize[_0x1358('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5555416..66a661b 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 _0xf38f=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','status','error','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','include','show','includeAll','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x43377f,_0x24a116){var _0x248beb=function(_0x4d4837){while(--_0x4d4837){_0x43377f['push'](_0x43377f['shift']());}};_0x248beb(++_0x24a116);}(_0xf38f,0x1c5));var _0xff38=function(_0x27deda,_0x300d08){_0x27deda=_0x27deda-0x0;var _0x29c0eb=_0xf38f[_0x27deda];return _0x29c0eb;};'use strict';var emlformat=require(_0xff38('0x0'));var rimraf=require(_0xff38('0x1'));var zipdir=require(_0xff38('0x2'));var jsonpatch=require(_0xff38('0x3'));var rp=require(_0xff38('0x4'));var moment=require(_0xff38('0x5'));var BPromise=require(_0xff38('0x6'));var Mustache=require(_0xff38('0x7'));var util=require('util');var path=require(_0xff38('0x8'));var sox=require('sox');var csv=require(_0xff38('0x9'));var ejs=require(_0xff38('0xa'));var fs=require('fs');var fs_extra=require(_0xff38('0xb'));var _=require(_0xff38('0xc'));var squel=require(_0xff38('0xd'));var crypto=require(_0xff38('0xe'));var jsforce=require(_0xff38('0xf'));var deskjs=require(_0xff38('0x10'));var toCsv=require(_0xff38('0x9'));var querystring=require(_0xff38('0x11'));var Papa=require(_0xff38('0x12'));var Redis=require(_0xff38('0x13'));var authService=require(_0xff38('0x14'));var qs=require(_0xff38('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xff38('0x16'))(_0xff38('0x17'));var utils=require(_0xff38('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff38('0x19'))['db'];function respondWithStatusCode(_0xc0c084,_0x142bc6){_0x142bc6=_0x142bc6||0xcc;return function(_0x559143){if(_0x559143){return _0xc0c084[_0xff38('0x1a')](_0x142bc6);}return _0xc0c084['status'](_0x142bc6)[_0xff38('0x1b')]();};}function respondWithResult(_0x4df379,_0x19cca4){_0x19cca4=_0x19cca4||0xc8;return function(_0x21dad8){if(_0x21dad8){return _0x4df379['status'](_0x19cca4)[_0xff38('0x1c')](_0x21dad8);}};}function respondWithFilteredResult(_0x3b272b,_0x1573ba){return function(_0x5d4ea3){if(_0x5d4ea3){var _0x7d7f3b=typeof _0x1573ba[_0xff38('0x1d')]===_0xff38('0x1e')&&typeof _0x1573ba[_0xff38('0x1f')]===_0xff38('0x1e');var _0x18e094=_0x5d4ea3['count'];var _0xf5e905=_0x7d7f3b?0x0:_0x1573ba[_0xff38('0x1d')];var _0x467d53=_0x7d7f3b?_0x5d4ea3[_0xff38('0x20')]:_0x1573ba['offset']+_0x1573ba['limit'];var _0x1d4769;if(_0x467d53>=_0x18e094){_0x467d53=_0x18e094;_0x1d4769=0xc8;}else{_0x1d4769=0xce;}_0x3b272b['status'](_0x1d4769);return _0x3b272b[_0xff38('0x21')](_0xff38('0x22'),_0xf5e905+'-'+_0x467d53+'/'+_0x18e094)[_0xff38('0x1c')](_0x5d4ea3);}return null;};}function patchUpdates(_0x11e960){return function(_0x23ac95){try{jsonpatch[_0xff38('0x23')](_0x23ac95,_0x11e960,!![]);}catch(_0x2f3218){return BPromise[_0xff38('0x24')](_0x2f3218);}return _0x23ac95['save']();};}function saveUpdates(_0x41dd42,_0x2c4bb2){return function(_0x29b5ff){if(_0x29b5ff){return _0x29b5ff[_0xff38('0x25')](_0x41dd42)['then'](function(_0x58275f){return _0x58275f;});}return null;};}function removeEntity(_0x40f856,_0x3c0edf){return function(_0x1d1ade){if(_0x1d1ade){return _0x1d1ade[_0xff38('0x26')]()['then'](function(){_0x40f856[_0xff38('0x27')](0xcc)[_0xff38('0x1b')]();});}};}function handleEntityNotFound(_0x204dcf,_0x2bee89){return function(_0x5b2088){if(!_0x5b2088){_0x204dcf[_0xff38('0x1a')](0x194);}return _0x5b2088;};}function handleError(_0x92db42,_0x429455){_0x429455=_0x429455||0x1f4;return function(_0x37af82){logger[_0xff38('0x28')](_0x37af82['stack']);if(_0x37af82[_0xff38('0x29')]){delete _0x37af82[_0xff38('0x29')];}_0x92db42[_0xff38('0x27')](_0x429455)[_0xff38('0x2a')](_0x37af82);};}exports[_0xff38('0x2b')]=function(_0x554103,_0x24f8c6){var _0x49c699={},_0xdbd681={},_0x16aa88={'count':0x0,'rows':[]};var _0x4d3981=_['map'](db[_0xff38('0x2c')][_0xff38('0x2d')],function(_0x1090ae){return{'name':_0x1090ae[_0xff38('0x2e')],'type':_0x1090ae[_0xff38('0x2f')][_0xff38('0x30')]};});_0xdbd681[_0xff38('0x31')]=_[_0xff38('0x32')](_0x4d3981,_0xff38('0x29'));_0xdbd681[_0xff38('0x33')]=_[_0xff38('0x34')](_0x554103['query']);_0xdbd681['filters']=_[_0xff38('0x35')](_0xdbd681[_0xff38('0x31')],_0xdbd681['query']);_0x49c699[_0xff38('0x36')]=_['intersection'](_0xdbd681[_0xff38('0x31')],qs[_0xff38('0x37')](_0x554103[_0xff38('0x33')][_0xff38('0x37')]));_0x49c699[_0xff38('0x36')]=_0x49c699['attributes'][_0xff38('0x38')]?_0x49c699[_0xff38('0x36')]:_0xdbd681[_0xff38('0x31')];if(!_0x554103['query'][_0xff38('0x39')](_0xff38('0x3a'))){_0x49c699[_0xff38('0x1f')]=qs['limit'](_0x554103[_0xff38('0x33')][_0xff38('0x1f')]);_0x49c699[_0xff38('0x1d')]=qs['offset'](_0x554103[_0xff38('0x33')][_0xff38('0x1d')]);}_0x49c699[_0xff38('0x3b')]=qs['sort'](_0x554103[_0xff38('0x33')][_0xff38('0x3c')]);_0x49c699[_0xff38('0x3d')]=qs[_0xff38('0x3e')](_[_0xff38('0x3f')](_0x554103[_0xff38('0x33')],_0xdbd681['filters']),_0x4d3981);if(_0x554103[_0xff38('0x33')][_0xff38('0x40')]){_0x49c699['where']=_[_0xff38('0x41')](_0x49c699[_0xff38('0x3d')],{'$or':_[_0xff38('0x32')](_0x4d3981,function(_0x17d25c){if(_0x17d25c[_0xff38('0x2f')]!==_0xff38('0x42')){var _0x2161bc={};_0x2161bc[_0x17d25c[_0xff38('0x29')]]={'$like':'%'+_0x554103[_0xff38('0x33')]['filter']+'%'};return _0x2161bc;}})});}_0x49c699=_['merge']({},_0x49c699,_0x554103[_0xff38('0x43')]);var _0x2a50f2={'where':_0x49c699[_0xff38('0x3d')]};return db[_0xff38('0x2c')][_0xff38('0x20')](_0x2a50f2)[_0xff38('0x44')](function(_0x10d275){_0x16aa88['count']=_0x10d275;if(_0x554103['query']['includeAll']){_0x49c699[_0xff38('0x45')]=[{'all':!![]}];}return db[_0xff38('0x2c')]['findAll'](_0x49c699);})[_0xff38('0x44')](function(_0x1c86d6){_0x16aa88['rows']=_0x1c86d6;return _0x16aa88;})[_0xff38('0x44')](respondWithFilteredResult(_0x24f8c6,_0x49c699))['catch'](handleError(_0x24f8c6,null));};exports[_0xff38('0x46')]=function(_0x5d94c3,_0x112226){var _0x563599={'raw':!![],'where':{'id':_0x5d94c3['params']['id']}},_0x93778c={};_0x93778c[_0xff38('0x31')]=_[_0xff38('0x34')](db[_0xff38('0x2c')]['rawAttributes']);_0x93778c['query']=_[_0xff38('0x34')](_0x5d94c3['query']);_0x93778c['filters']=_[_0xff38('0x35')](_0x93778c[_0xff38('0x31')],_0x93778c[_0xff38('0x33')]);_0x563599['attributes']=_[_0xff38('0x35')](_0x93778c['model'],qs[_0xff38('0x37')](_0x5d94c3[_0xff38('0x33')][_0xff38('0x37')]));_0x563599[_0xff38('0x36')]=_0x563599['attributes']['length']?_0x563599[_0xff38('0x36')]:_0x93778c[_0xff38('0x31')];if(_0x5d94c3[_0xff38('0x33')][_0xff38('0x47')]){_0x563599[_0xff38('0x45')]=[{'all':!![]}];}_0x563599=_[_0xff38('0x41')]({},_0x563599,_0x5d94c3['options']);return db[_0xff38('0x2c')][_0xff38('0x48')](_0x563599)[_0xff38('0x44')](handleEntityNotFound(_0x112226,null))['then'](respondWithResult(_0x112226,null))[_0xff38('0x49')](handleError(_0x112226,null));};exports['create']=function(_0x54a735,_0x41e7ae){return db[_0xff38('0x2c')][_0xff38('0x4a')](_0x54a735[_0xff38('0x4b')],{})[_0xff38('0x44')](respondWithResult(_0x41e7ae,0xc9))['catch'](handleError(_0x41e7ae,null));};exports[_0xff38('0x25')]=function(_0x3542f1,_0x352459){if(_0x3542f1[_0xff38('0x4b')]['id']){delete _0x3542f1[_0xff38('0x4b')]['id'];}return db[_0xff38('0x2c')][_0xff38('0x48')]({'where':{'id':_0x3542f1[_0xff38('0x4c')]['id']}})[_0xff38('0x44')](handleEntityNotFound(_0x352459,null))[_0xff38('0x44')](saveUpdates(_0x3542f1['body'],null))[_0xff38('0x44')](respondWithResult(_0x352459,null))[_0xff38('0x49')](handleError(_0x352459,null));};exports['destroy']=function(_0x536c59,_0x3093f1){return db[_0xff38('0x2c')][_0xff38('0x48')]({'where':{'id':_0x536c59[_0xff38('0x4c')]['id']}})[_0xff38('0x44')](handleEntityNotFound(_0x3093f1,null))[_0xff38('0x44')](removeEntity(_0x3093f1,null))['catch'](handleError(_0x3093f1,null));}; \ No newline at end of file +var _0xc1a8=['map','type','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','SmsApplication','findAll','catch','show','params','merge','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','end','stack','send','index'];(function(_0x34098e,_0x50e5b3){var _0x285f9d=function(_0x38ab48){while(--_0x38ab48){_0x34098e['push'](_0x34098e['shift']());}};_0x285f9d(++_0x50e5b3);}(_0xc1a8,0x190));var _0x8c1a=function(_0x5954d2,_0x15db93){_0x5954d2=_0x5954d2-0x0;var _0x316928=_0xc1a8[_0x5954d2];return _0x316928;};'use strict';var emlformat=require(_0x8c1a('0x0'));var rimraf=require(_0x8c1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c1a('0x2'));var rp=require(_0x8c1a('0x3'));var moment=require(_0x8c1a('0x4'));var BPromise=require(_0x8c1a('0x5'));var Mustache=require(_0x8c1a('0x6'));var util=require(_0x8c1a('0x7'));var path=require(_0x8c1a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c1a('0x9'));var _=require(_0x8c1a('0xa'));var squel=require(_0x8c1a('0xb'));var crypto=require(_0x8c1a('0xc'));var jsforce=require(_0x8c1a('0xd'));var deskjs=require(_0x8c1a('0xe'));var toCsv=require(_0x8c1a('0xf'));var querystring=require(_0x8c1a('0x10'));var Papa=require(_0x8c1a('0x11'));var Redis=require(_0x8c1a('0x12'));var authService=require(_0x8c1a('0x13'));var qs=require(_0x8c1a('0x14'));var as=require(_0x8c1a('0x15'));var hardwareService=require(_0x8c1a('0x16'));var logger=require(_0x8c1a('0x17'))(_0x8c1a('0x18'));var utils=require(_0x8c1a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8c1a('0x1a'));var db=require(_0x8c1a('0x1b'))['db'];function respondWithStatusCode(_0x122df1,_0x221178){_0x221178=_0x221178||0xcc;return function(_0x5677a2){if(_0x5677a2){return _0x122df1[_0x8c1a('0x1c')](_0x221178);}return _0x122df1[_0x8c1a('0x1d')](_0x221178)['end']();};}function respondWithResult(_0x4c880c,_0x52dafc){_0x52dafc=_0x52dafc||0xc8;return function(_0x538845){if(_0x538845){return _0x4c880c['status'](_0x52dafc)[_0x8c1a('0x1e')](_0x538845);}};}function respondWithFilteredResult(_0x2b4b46,_0x3cfce3){return function(_0x14ed20){if(_0x14ed20){var _0x291b95=typeof _0x3cfce3[_0x8c1a('0x1f')]==='undefined'&&typeof _0x3cfce3[_0x8c1a('0x20')]===_0x8c1a('0x21');var _0x47a0cf=_0x14ed20[_0x8c1a('0x22')];var _0x153c12=_0x291b95?0x0:_0x3cfce3[_0x8c1a('0x1f')];var _0x256850=_0x291b95?_0x14ed20['count']:_0x3cfce3[_0x8c1a('0x1f')]+_0x3cfce3[_0x8c1a('0x20')];var _0x138187;if(_0x256850>=_0x47a0cf){_0x256850=_0x47a0cf;_0x138187=0xc8;}else{_0x138187=0xce;}_0x2b4b46[_0x8c1a('0x1d')](_0x138187);return _0x2b4b46[_0x8c1a('0x23')]('Content-Range',_0x153c12+'-'+_0x256850+'/'+_0x47a0cf)[_0x8c1a('0x1e')](_0x14ed20);}return null;};}function patchUpdates(_0x3234ae){return function(_0x5d154f){try{jsonpatch['apply'](_0x5d154f,_0x3234ae,!![]);}catch(_0x34ca82){return BPromise[_0x8c1a('0x24')](_0x34ca82);}return _0x5d154f[_0x8c1a('0x25')]();};}function saveUpdates(_0x26cbee,_0x1d467e){return function(_0x3c2ef7){if(_0x3c2ef7){return _0x3c2ef7['update'](_0x26cbee)[_0x8c1a('0x26')](function(_0xaa0d02){return _0xaa0d02;});}return null;};}function removeEntity(_0x2c050d,_0x19f25b){return function(_0x5cbe9b){if(_0x5cbe9b){return _0x5cbe9b[_0x8c1a('0x27')]()[_0x8c1a('0x26')](function(){_0x2c050d[_0x8c1a('0x1d')](0xcc)[_0x8c1a('0x28')]();});}};}function handleEntityNotFound(_0x27f654,_0xc4f97b){return function(_0xcd9ffb){if(!_0xcd9ffb){_0x27f654[_0x8c1a('0x1c')](0x194);}return _0xcd9ffb;};}function handleError(_0x4c7c8c,_0x10f849){_0x10f849=_0x10f849||0x1f4;return function(_0x5b7dbe){logger['error'](_0x5b7dbe[_0x8c1a('0x29')]);if(_0x5b7dbe['name']){delete _0x5b7dbe['name'];}_0x4c7c8c[_0x8c1a('0x1d')](_0x10f849)[_0x8c1a('0x2a')](_0x5b7dbe);};}exports[_0x8c1a('0x2b')]=function(_0x2c05d0,_0x5457da){var _0x54596f={},_0x26e8f3={},_0x420178={'count':0x0,'rows':[]};var _0x3ef06a=_[_0x8c1a('0x2c')](db['SmsApplication']['rawAttributes'],function(_0x3d7a97){return{'name':_0x3d7a97['fieldName'],'type':_0x3d7a97[_0x8c1a('0x2d')]['key']};});_0x26e8f3[_0x8c1a('0x2e')]=_[_0x8c1a('0x2c')](_0x3ef06a,_0x8c1a('0x2f'));_0x26e8f3['query']=_[_0x8c1a('0x30')](_0x2c05d0[_0x8c1a('0x31')]);_0x26e8f3[_0x8c1a('0x32')]=_[_0x8c1a('0x33')](_0x26e8f3[_0x8c1a('0x2e')],_0x26e8f3[_0x8c1a('0x31')]);_0x54596f['attributes']=_[_0x8c1a('0x33')](_0x26e8f3['model'],qs[_0x8c1a('0x34')](_0x2c05d0[_0x8c1a('0x31')][_0x8c1a('0x34')]));_0x54596f[_0x8c1a('0x35')]=_0x54596f[_0x8c1a('0x35')][_0x8c1a('0x36')]?_0x54596f[_0x8c1a('0x35')]:_0x26e8f3[_0x8c1a('0x2e')];if(!_0x2c05d0[_0x8c1a('0x31')]['hasOwnProperty'](_0x8c1a('0x37'))){_0x54596f['limit']=qs[_0x8c1a('0x20')](_0x2c05d0[_0x8c1a('0x31')]['limit']);_0x54596f[_0x8c1a('0x1f')]=qs[_0x8c1a('0x1f')](_0x2c05d0[_0x8c1a('0x31')][_0x8c1a('0x1f')]);}_0x54596f[_0x8c1a('0x38')]=qs['sort'](_0x2c05d0['query']['sort']);_0x54596f[_0x8c1a('0x39')]=qs['filters'](_[_0x8c1a('0x3a')](_0x2c05d0['query'],_0x26e8f3['filters']),_0x3ef06a);if(_0x2c05d0[_0x8c1a('0x31')][_0x8c1a('0x3b')]){_0x54596f['where']=_['merge'](_0x54596f[_0x8c1a('0x39')],{'$or':_[_0x8c1a('0x2c')](_0x3ef06a,function(_0x3539e6){if(_0x3539e6[_0x8c1a('0x2d')]!==_0x8c1a('0x3c')){var _0x1a1ca7={};_0x1a1ca7[_0x3539e6[_0x8c1a('0x2f')]]={'$like':'%'+_0x2c05d0[_0x8c1a('0x31')][_0x8c1a('0x3b')]+'%'};return _0x1a1ca7;}})});}_0x54596f=_['merge']({},_0x54596f,_0x2c05d0[_0x8c1a('0x3d')]);var _0x17ea56={'where':_0x54596f['where']};return db['SmsApplication'][_0x8c1a('0x22')](_0x17ea56)[_0x8c1a('0x26')](function(_0x39539c){_0x420178[_0x8c1a('0x22')]=_0x39539c;if(_0x2c05d0[_0x8c1a('0x31')][_0x8c1a('0x3e')]){_0x54596f[_0x8c1a('0x3f')]=[{'all':!![]}];}return db[_0x8c1a('0x40')][_0x8c1a('0x41')](_0x54596f);})[_0x8c1a('0x26')](function(_0x592b3a){_0x420178['rows']=_0x592b3a;return _0x420178;})[_0x8c1a('0x26')](respondWithFilteredResult(_0x5457da,_0x54596f))[_0x8c1a('0x42')](handleError(_0x5457da,null));};exports[_0x8c1a('0x43')]=function(_0x5d9257,_0x45b5de){var _0x5548b5={'raw':!![],'where':{'id':_0x5d9257[_0x8c1a('0x44')]['id']}},_0x4e4be3={};_0x4e4be3['model']=_[_0x8c1a('0x30')](db[_0x8c1a('0x40')]['rawAttributes']);_0x4e4be3['query']=_[_0x8c1a('0x30')](_0x5d9257[_0x8c1a('0x31')]);_0x4e4be3[_0x8c1a('0x32')]=_[_0x8c1a('0x33')](_0x4e4be3['model'],_0x4e4be3[_0x8c1a('0x31')]);_0x5548b5[_0x8c1a('0x35')]=_[_0x8c1a('0x33')](_0x4e4be3[_0x8c1a('0x2e')],qs[_0x8c1a('0x34')](_0x5d9257[_0x8c1a('0x31')][_0x8c1a('0x34')]));_0x5548b5[_0x8c1a('0x35')]=_0x5548b5['attributes']['length']?_0x5548b5['attributes']:_0x4e4be3['model'];if(_0x5d9257['query']['includeAll']){_0x5548b5[_0x8c1a('0x3f')]=[{'all':!![]}];}_0x5548b5=_[_0x8c1a('0x45')]({},_0x5548b5,_0x5d9257[_0x8c1a('0x3d')]);return db[_0x8c1a('0x40')]['find'](_0x5548b5)[_0x8c1a('0x26')](handleEntityNotFound(_0x45b5de,null))['then'](respondWithResult(_0x45b5de,null))['catch'](handleError(_0x45b5de,null));};exports[_0x8c1a('0x46')]=function(_0x3d8c14,_0x4cf44f){return db['SmsApplication'][_0x8c1a('0x46')](_0x3d8c14[_0x8c1a('0x47')],{})['then'](respondWithResult(_0x4cf44f,0xc9))['catch'](handleError(_0x4cf44f,null));};exports[_0x8c1a('0x48')]=function(_0x18c5ac,_0x2888e9){if(_0x18c5ac[_0x8c1a('0x47')]['id']){delete _0x18c5ac[_0x8c1a('0x47')]['id'];}return db[_0x8c1a('0x40')][_0x8c1a('0x49')]({'where':{'id':_0x18c5ac[_0x8c1a('0x44')]['id']}})[_0x8c1a('0x26')](handleEntityNotFound(_0x2888e9,null))[_0x8c1a('0x26')](saveUpdates(_0x18c5ac['body'],null))[_0x8c1a('0x26')](respondWithResult(_0x2888e9,null))[_0x8c1a('0x42')](handleError(_0x2888e9,null));};exports[_0x8c1a('0x27')]=function(_0xdc08a3,_0x5a9e79){return db[_0x8c1a('0x40')]['find']({'where':{'id':_0xdc08a3[_0x8c1a('0x44')]['id']}})[_0x8c1a('0x26')](handleEntityNotFound(_0x5a9e79,null))['then'](removeEntity(_0x5a9e79,null))[_0x8c1a('0x42')](handleError(_0x5a9e79,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d3fdfbd..eedd32c 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 _0x15e1=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x46d20f,_0x326507){var _0x5da3bd=function(_0x13a61c){while(--_0x13a61c){_0x46d20f['push'](_0x46d20f['shift']());}};_0x5da3bd(++_0x326507);}(_0x15e1,0x1c1));var _0x115e=function(_0x1443c4,_0x291ebe){_0x1443c4=_0x1443c4-0x0;var _0x493131=_0x15e1[_0x1443c4];return _0x493131;};'use strict';var _=require(_0x115e('0x0'));var util=require(_0x115e('0x1'));var logger=require(_0x115e('0x2'))(_0x115e('0x3'));var moment=require(_0x115e('0x4'));var BPromise=require('bluebird');var rp=require(_0x115e('0x5'));var fs=require('fs');var path=require(_0x115e('0x6'));var rimraf=require(_0x115e('0x7'));var config=require(_0x115e('0x8'));var attributes=require(_0x115e('0x9'));module[_0x115e('0xa')]=function(_0x1d2a13,_0x583fba){return _0x1d2a13['define'](_0x115e('0xb'),attributes,{'tableName':_0x115e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x115e('0xd'),'collate':_0x115e('0xe')});}; \ No newline at end of file +var _0x685f=['exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x30853f,_0x4aa320){var _0x3c416d=function(_0x15d3d2){while(--_0x15d3d2){_0x30853f['push'](_0x30853f['shift']());}};_0x3c416d(++_0x4aa320);}(_0x685f,0x180));var _0xf685=function(_0x947f8d,_0x255647){_0x947f8d=_0x947f8d-0x0;var _0x8ccbc3=_0x685f[_0x947f8d];return _0x8ccbc3;};'use strict';var _=require('lodash');var util=require(_0xf685('0x0'));var logger=require(_0xf685('0x1'))(_0xf685('0x2'));var moment=require('moment');var BPromise=require(_0xf685('0x3'));var rp=require(_0xf685('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf685('0x5'));var config=require(_0xf685('0x6'));var attributes=require(_0xf685('0x7'));module[_0xf685('0x8')]=function(_0x321c34,_0x355538){return _0x321c34[_0xf685('0x9')](_0xf685('0xa'),attributes,{'tableName':_0xf685('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf685('0xc'),'collate':_0xf685('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c02ac0f..492a24d 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 _0x9805=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3056cd,_0x5838f6){var _0x4a8064=function(_0x10b770){while(--_0x10b770){_0x3056cd['push'](_0x3056cd['shift']());}};_0x4a8064(++_0x5838f6);}(_0x9805,0x18f));var _0x5980=function(_0x91d498,_0x482a89){_0x91d498=_0x91d498-0x0;var _0x1e0294=_0x9805[_0x91d498];return _0x1e0294;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var moment=require(_0x5980('0x2'));var BPromise=require(_0x5980('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5980('0x4'))['db'];var utils=require(_0x5980('0x5'));var logger=require(_0x5980('0x6'))(_0x5980('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5980('0x8')][_0x5980('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x326b9b,_0x1d6536,_0x175728){return new BPromise(function(_0x3399a9,_0xf8b3c0){return client[_0x5980('0xa')](_0x326b9b,_0x175728)[_0x5980('0xb')](function(_0x35b0ad){logger[_0x5980('0xc')](_0x5980('0xd'),_0x1d6536,'request\x20sent');logger['debug'](_0x5980('0xe'),_0x1d6536,_0x5980('0xf'),JSON[_0x5980('0x10')](_0x35b0ad));if(_0x35b0ad[_0x5980('0x11')]){if(_0x35b0ad['error'][_0x5980('0x12')]===0x1f4){logger[_0x5980('0x11')]('SmsApplication,\x20%s,\x20%s',_0x1d6536,_0x35b0ad['error'][_0x5980('0x13')]);return _0xf8b3c0(_0x35b0ad[_0x5980('0x11')][_0x5980('0x13')]);}logger[_0x5980('0x11')](_0x5980('0xd'),_0x1d6536,_0x35b0ad[_0x5980('0x11')][_0x5980('0x13')]);return _0x3399a9(_0x35b0ad[_0x5980('0x11')]['message']);}else{logger[_0x5980('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1d6536,_0x5980('0xf'));_0x3399a9(_0x35b0ad[_0x5980('0x14')][_0x5980('0x13')]);}})[_0x5980('0x15')](function(_0x183261){logger['error'](_0x5980('0xd'),_0x1d6536,_0x183261);_0xf8b3c0(_0x183261);});});} \ No newline at end of file +var _0xa282=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash'];(function(_0x6a66f1,_0x3c06da){var _0x42381d=function(_0x292875){while(--_0x292875){_0x6a66f1['push'](_0x6a66f1['shift']());}};_0x42381d(++_0x3c06da);}(_0xa282,0x1f3));var _0x2a28=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa282[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x2a28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2a28('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a28('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a28('0x3'));var logger=require(_0x2a28('0x4'))(_0x2a28('0x5'));var config=require(_0x2a28('0x6'));var jayson=require(_0x2a28('0x7'));var client=jayson[_0x2a28('0x8')][_0x2a28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36635c,_0x3d379c,_0x84908){return new BPromise(function(_0x24c7f5,_0x91d789){return client[_0x2a28('0xa')](_0x36635c,_0x84908)['then'](function(_0x1e20b3){logger['info'](_0x2a28('0xb'),_0x3d379c,_0x2a28('0xc'));logger[_0x2a28('0xd')](_0x2a28('0xe'),_0x3d379c,_0x2a28('0xc'),JSON[_0x2a28('0xf')](_0x1e20b3));if(_0x1e20b3[_0x2a28('0x10')]){if(_0x1e20b3['error']['code']===0x1f4){logger[_0x2a28('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3d379c,_0x1e20b3[_0x2a28('0x10')][_0x2a28('0x11')]);return _0x91d789(_0x1e20b3[_0x2a28('0x10')][_0x2a28('0x11')]);}logger[_0x2a28('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3d379c,_0x1e20b3['error'][_0x2a28('0x11')]);return _0x24c7f5(_0x1e20b3[_0x2a28('0x10')]['message']);}else{logger[_0x2a28('0x12')](_0x2a28('0xb'),_0x3d379c,'request\x20sent');_0x24c7f5(_0x1e20b3['result'][_0x2a28('0x11')]);}})[_0x2a28('0x13')](function(_0x506493){logger[_0x2a28('0x10')](_0x2a28('0xb'),_0x3d379c,_0x506493);_0x91d789(_0x506493);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 43c5151..6fa77dd 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 _0x34b7=['/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','delete','destroy'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x34b7,0x196));var _0x734b=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x34b7[_0x30faee];return _0x3a90ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x734b('0x7')]('/:id/messages',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0x7')](_0x734b('0xd'),auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xf')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0xf')](_0x734b('0x11'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0xf')]('/:id/tags',auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x15')),controller[_0x734b('0x16')]);router[_0x734b('0x17')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x19')),controller['update']);router[_0x734b('0x1a')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')]('sms','smsinteraction:destroy'),controller[_0x734b('0x1b')]);router[_0x734b('0x1a')](_0x734b('0x1c'),auth[_0x734b('0x8')](),controller[_0x734b('0x1d')]);module[_0x734b('0x1e')]=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','delete','exports','multer'];(function(_0x40a737,_0x52a664){var _0x38ceaa=function(_0x1ed60f){while(--_0x1ed60f){_0x40a737['push'](_0x40a737['shift']());}};_0x38ceaa(++_0x52a664);}(_0x0b0e,0x187));var _0xe0b0=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x0b0e[_0x522ae8];return _0x3189b9;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/download',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x11')](_0xe0b0('0xe'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x13')]);router['post'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')](_0xe0b0('0x16'),_0xe0b0('0x17')),controller['addTags']);router[_0xe0b0('0x18')]('/:id',auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')]('sms',_0xe0b0('0x19')),controller['update']);router[_0xe0b0('0x1a')](_0xe0b0('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xe0b0('0x16'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0xe0b0('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe0b0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index de44c0d..6139f4e 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 _0x9c48=['BOOLEAN','sequelize','moment','exports','DATE','STRING','out','ENUM'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x9c48,0xa1));var _0x89c4=function(_0x63e376,_0x43084d){_0x63e376=_0x63e376-0x0;var _0x43bc68=_0x9c48[_0x63e376];return _0x43bc68;};'use strict';var Sequelize=require(_0x89c4('0x0'));var moment=require(_0x89c4('0x1'));module[_0x89c4('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x89c4('0x3')]},'disposition':{'type':Sequelize[_0x89c4('0x4')]},'secondDisposition':{'type':Sequelize[_0x89c4('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x89c4('0x4')]},'read1stAt':{'type':Sequelize[_0x89c4('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x89c4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x89c4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x89c4('0x6')]('in',_0x89c4('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x89c4('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x1670=['sequelize','moment','BOOLEAN','STRING','ENUM','out','DATE'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0x1670,0x9a));var _0x0167=function(_0x56a7c7,_0x35b150){_0x56a7c7=_0x56a7c7-0x0;var _0x285fcb=_0x1670[_0x56a7c7];return _0x285fcb;};'use strict';var Sequelize=require(_0x0167('0x0'));var moment=require(_0x0167('0x1'));module['exports']={'closed':{'type':Sequelize[_0x0167('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0167('0x3')]},'secondDisposition':{'type':Sequelize[_0x0167('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0167('0x3')]},'note':{'type':Sequelize[_0x0167('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0167('0x4')]('in',_0x0167('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0167('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x0167('0x4')]('in',_0x0167('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0167('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 37c306c..81cbbbf 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 _0x9691=['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','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','text','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','filter','replace','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','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','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','c.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','show','include','create','body','params','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','server','tmp','files','transcript-%d-%s.zip','CmContact','firstName','lastName','direction','SmsAccount','Account','Owner','Sms','N.A.','closedAt','out','System','read','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','end','status','offset','undefined','count','limit','set','save','update','then','destroy','sendStatus','error','stack','name','send','Users','fullname','TagIds','Tags','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','split','length'];(function(_0x46c397,_0x300569){var _0x1b17bd=function(_0x10f87c){while(--_0x10f87c){_0x46c397['push'](_0x46c397['shift']());}};_0x1b17bd(++_0x300569);}(_0x9691,0x163));var _0x1969=function(_0x1a05d4,_0x3e9c2f){_0x1a05d4=_0x1a05d4-0x0;var _0x3d27c2=_0x9691[_0x1a05d4];return _0x3d27c2;};'use strict';var emlformat=require(_0x1969('0x0'));var rimraf=require(_0x1969('0x1'));var zipdir=require(_0x1969('0x2'));var jsonpatch=require(_0x1969('0x3'));var rp=require('request-promise');var moment=require(_0x1969('0x4'));var BPromise=require(_0x1969('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1969('0x6'));var csv=require('to-csv');var ejs=require(_0x1969('0x7'));var fs=require('fs');var fs_extra=require(_0x1969('0x8'));var _=require(_0x1969('0x9'));var squel=require('squel');var crypto=require(_0x1969('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1969('0xb'));var toCsv=require(_0x1969('0xc'));var querystring=require('querystring');var Papa=require(_0x1969('0xd'));var Redis=require(_0x1969('0xe'));var authService=require(_0x1969('0xf'));var qs=require(_0x1969('0x10'));var as=require(_0x1969('0x11'));var pdf=require(_0x1969('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1969('0x13'))(_0x1969('0x14'));var utils=require(_0x1969('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1969('0x16'));var db=require(_0x1969('0x17'))['db'];config[_0x1969('0x18')]=_[_0x1969('0x19')](config[_0x1969('0x18')],{'host':_0x1969('0x1a'),'port':0x18eb});var socket=require(_0x1969('0x1b'))(new Redis(config['redis']));require(_0x1969('0x1c'))[_0x1969('0x1d')](socket);function respondWithStatusCode(_0x25e1da,_0x459730){_0x459730=_0x459730||0xcc;return function(_0xa3ecf4){if(_0xa3ecf4){return _0x25e1da['sendStatus'](_0x459730);}return _0x25e1da['status'](_0x459730)[_0x1969('0x1e')]();};}function respondWithResult(_0x42c08e,_0x5411cb){_0x5411cb=_0x5411cb||0xc8;return function(_0x1c68a3){if(_0x1c68a3){return _0x42c08e[_0x1969('0x1f')](_0x5411cb)['json'](_0x1c68a3);}};}function respondWithFilteredResult(_0x21d2aa,_0x2f0eaa){return function(_0x32362f){if(_0x32362f){var _0x487f96=typeof _0x2f0eaa[_0x1969('0x20')]==='undefined'&&typeof _0x2f0eaa['limit']===_0x1969('0x21');var _0x1e91d1=_0x32362f[_0x1969('0x22')];var _0x375624=_0x487f96?0x0:_0x2f0eaa['offset'];var _0xed0348=_0x487f96?_0x32362f[_0x1969('0x22')]:_0x2f0eaa[_0x1969('0x20')]+_0x2f0eaa[_0x1969('0x23')];var _0x6f5266;if(_0xed0348>=_0x1e91d1){_0xed0348=_0x1e91d1;_0x6f5266=0xc8;}else{_0x6f5266=0xce;}_0x21d2aa[_0x1969('0x1f')](_0x6f5266);return _0x21d2aa[_0x1969('0x24')]('Content-Range',_0x375624+'-'+_0xed0348+'/'+_0x1e91d1)['json'](_0x32362f);}return null;};}function patchUpdates(_0x23dd43){return function(_0x120077){try{jsonpatch['apply'](_0x120077,_0x23dd43,!![]);}catch(_0x549d38){return BPromise['reject'](_0x549d38);}return _0x120077[_0x1969('0x25')]();};}function saveUpdates(_0x3f85ef,_0x3601e0){return function(_0x3d6075){if(_0x3d6075){return _0x3d6075[_0x1969('0x26')](_0x3f85ef)[_0x1969('0x27')](function(_0x9337a5){return _0x9337a5;});}return null;};}function removeEntity(_0x516e73,_0x2f95bf){return function(_0x1ad8b6){if(_0x1ad8b6){return _0x1ad8b6[_0x1969('0x28')]()['then'](function(){_0x516e73[_0x1969('0x1f')](0xcc)[_0x1969('0x1e')]();});}};}function handleEntityNotFound(_0x1a23d5,_0x58a722){return function(_0x32d72f){if(!_0x32d72f){_0x1a23d5[_0x1969('0x29')](0x194);}return _0x32d72f;};}function handleError(_0x2bc266,_0x29beec){_0x29beec=_0x29beec||0x1f4;return function(_0x5765aa){logger[_0x1969('0x2a')](_0x5765aa[_0x1969('0x2b')]);if(_0x5765aa['name']){delete _0x5765aa[_0x1969('0x2c')];}_0x2bc266[_0x1969('0x1f')](_0x29beec)[_0x1969('0x2d')](_0x5765aa);};}function getInteractionUsers(_0x469e03,_0x2aab11){return new BPromise(function(_0x15ad79,_0x34d415){try{if(_0x2aab11[_0x469e03['id']]){_0x469e03[_0x1969('0x2e')]=_['map'](_0x2aab11[_0x469e03['id']],function(_0xd7d780){return{'id':_0xd7d780['id'],'fullname':_0xd7d780[_0x1969('0x2f')]};});}}catch(_0x50dc76){_0x34d415(_0x50dc76);}_0x15ad79(_0x469e03);});}function getInteractionTags(_0x260709,_0xaa848c){return new BPromise(function(_0x39f42f,_0x3d8c77){try{if(_0x260709[_0x1969('0x30')]){_0x260709[_0x1969('0x31')]=[];_0x260709[_0x1969('0x30')]['split'](',')['forEach'](function(_0x5a0ffa){_0x260709[_0x1969('0x31')][_0x1969('0x32')](_0xaa848c[_0x5a0ffa]);});}delete _0x260709['TagIds'];}catch(_0x48f71b){_0x3d8c77(_0x48f71b);}_0x39f42f(_0x260709);});}function updateSmsInteraction(_0x233218,_0x2c60cf,_0x15c15b){return new BPromise(function(_0x35ff41,_0x5f288d){return getInteractionUsers(_0x233218,_0x15c15b)[_0x1969('0x27')](function(_0x1e3f78){return getInteractionTags(_0x1e3f78,_0x2c60cf);})['then'](function(_0x1b4bb8){return getStateInteraction(_0x1b4bb8);})['then'](function(_0x59e4e4){_0x35ff41(_0x59e4e4);})[_0x1969('0x33')](function(_0x554c0f){_0x5f288d(_0x554c0f);});});}function getStateInteraction(_0x199fbc){return new BPromise(function(_0xbf5392){_0x199fbc[_0x1969('0x34')]=0x0;_0x199fbc[_0x1969('0x35')]=0x0;_0x199fbc[_0x1969('0x36')]=0x0;_0x199fbc[_0x1969('0x37')]=0x0;_0x199fbc[_0x1969('0x38')]=0x0;if(!_0x199fbc['closed']&&!_0x199fbc[_0x1969('0x39')]){_0x199fbc[_0x1969('0x34')]+=0x1;}if(!_0x199fbc[_0x1969('0x3a')]&&_0x199fbc[_0x1969('0x39')]){_0x199fbc[_0x1969('0x35')]+=0x1;if(_0x199fbc[_0x1969('0x34')]){_0x199fbc[_0x1969('0x34')]-=0x1;}}if(_0x199fbc[_0x1969('0x3a')]&&_0x199fbc[_0x1969('0x39')]){_0x199fbc[_0x1969('0x36')]+=0x1;if(_0x199fbc[_0x1969('0x35')]){_0x199fbc[_0x1969('0x35')]-=0x1;}}if(_0x199fbc[_0x1969('0x3a')]&&!_0x199fbc['UserId']){_0x199fbc['unmanaged']+=0x1;if(_0x199fbc[_0x1969('0x34')]){_0x199fbc['waiting']-=0x1;}}_0x199fbc[_0x1969('0x38')]+=0x1;_0xbf5392(_0x199fbc);});}exports[_0x1969('0x3b')]=function(_0x143833,_0x24744c){var _0x17e1cc={},_0x9ed834={},_0x5085a3={'count':0x0,'rows':[]};var _0x94e2b4=_['map'](db['SmsInteraction'][_0x1969('0x3c')],function(_0xe89a6d){return{'name':_0xe89a6d['fieldName'],'type':_0xe89a6d[_0x1969('0x3d')][_0x1969('0x3e')]};});_0x9ed834[_0x1969('0x3f')]=_[_0x1969('0x40')](_0x94e2b4,_0x1969('0x2c'));_0x9ed834[_0x1969('0x41')]=_[_0x1969('0x42')](_0x143833[_0x1969('0x41')]);_0x9ed834[_0x1969('0x43')]=_['intersection'](_0x9ed834[_0x1969('0x3f')],_0x9ed834[_0x1969('0x41')]);_0x17e1cc[_0x1969('0x44')]=_[_0x1969('0x45')](_0x9ed834[_0x1969('0x3f')],qs[_0x1969('0x46')](_0x143833[_0x1969('0x41')][_0x1969('0x46')]));_0x17e1cc[_0x1969('0x44')]=_0x17e1cc[_0x1969('0x44')]['length']?_0x17e1cc[_0x1969('0x44')]:_0x9ed834['model'];if(!_0x143833['query'][_0x1969('0x47')]('nolimit')){_0x17e1cc[_0x1969('0x23')]=qs[_0x1969('0x23')](_0x143833[_0x1969('0x41')][_0x1969('0x23')]);_0x17e1cc['offset']=qs[_0x1969('0x20')](_0x143833['query'][_0x1969('0x20')]);}_0x17e1cc[_0x1969('0x48')]=qs[_0x1969('0x49')](_0x143833[_0x1969('0x41')][_0x1969('0x49')]);_0x17e1cc[_0x1969('0x4a')]=qs['filters'](_[_0x1969('0x4b')](_0x143833[_0x1969('0x41')],_0x9ed834[_0x1969('0x43')]),_0x94e2b4);var _0x581a29=[];var _0x146dfb=squel[_0x1969('0x4c')]()[_0x1969('0x4d')]('id')[_0x1969('0x4d')](_0x1969('0x2c'))[_0x1969('0x4d')](_0x1969('0x4e'))[_0x1969('0x4f')](_0x1969('0x50'));var _0x557637=squel['select']()[_0x1969('0x4d')](_0x1969('0x51'))[_0x1969('0x4d')](_0x1969('0x52'))[_0x1969('0x4d')](_0x1969('0x53'))[_0x1969('0x4f')](_0x1969('0x54'),'ui')['left_join'](_0x1969('0x55'),'u',_0x1969('0x56'));var _0x2777de=squel['select']()[_0x1969('0x4f')](_0x1969('0x57'),'i')['left_join'](_0x1969('0x58'),'c',_0x1969('0x59'))[_0x1969('0x5a')]('users','o',_0x1969('0x5b'))[_0x1969('0x5a')](_0x1969('0x5c'),'a','a.id\x20=\x20i.SmsAccountId')[_0x1969('0x5a')](_0x1969('0x5d'),'me',_0x1969('0x5e'))[_0x1969('0x5a')](_0x1969('0x5f'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x1969('0x50'),'t',_0x1969('0x60'));var _0xe78501=squel[_0x1969('0x61')]();var _0x46f4e4=[];var _0x408f6c=squel[_0x1969('0x61')]();var _0x3546c8;if(_0x143833[_0x1969('0x41')][_0x1969('0x62')]){_0x3546c8=as[_0x1969('0x63')](_0x143833[_0x1969('0x41')][_0x1969('0x62')]);var _0xddaa0a=_0x3546c8[_0x1969('0x64')];for(var _0x117bb7=0x0;_0x117bb7<_0x3546c8[_0x1969('0x65')]['length'];_0x117bb7++){var _0x690c73=_0x3546c8[_0x1969('0x65')][_0x117bb7];var _0x42613c='i';var _0x26a6f5=_[_0x1969('0x66')](_0x94e2b4,['name',_0x690c73[_0x1969('0x4d')]]);if(!_0x26a6f5){switch(_0x690c73[_0x1969('0x4d')]){case _0x1969('0x67'):if(_0x690c73[_0x1969('0x68')]==0x1){_0x2777de['having']('`'+_0x690c73[_0x1969('0x4d')]+_0x1969('0x69'));}else{_0x2777de[_0x1969('0x6a')]('`'+_0x690c73['field']+_0x1969('0x6b'));}break;case _0x1969('0x6c'):if(_0x690c73[_0x1969('0x6d')]===_0x1969('0x6e')){if(_0x690c73[_0x1969('0x68')][_0x1969('0x6f')]('\x20')[_0x1969('0x70')]>0x1){_0xe78501[_0xddaa0a](_0x1969('0x71'),qs[_0x1969('0x72')](_0x690c73[_0x1969('0x68')]),null);}else{var _0x1cf3ff='%'+_0x690c73[_0x1969('0x68')]+'%';_0xe78501[_0xddaa0a](_0x1969('0x73'),_0x1cf3ff,_0x1cf3ff,_0x1cf3ff);}}else{_0x26a6f5=_[_0x1969('0x66')](_0x94e2b4,[_0x1969('0x2c'),_0x1969('0x74')]);_0x690c73[_0x1969('0x4d')]='ContactId';_0x124a45=as[_0x1969('0x75')](_0x42613c,_0x26a6f5['type'],_0x690c73);_0xe78501[_0xddaa0a](_0x124a45['text'],_0x124a45[_0x1969('0x68')][_0x1969('0x76')],_0x124a45[_0x1969('0x68')][_0x1969('0x1e')]);}break;case _0x1969('0x77'):var _0x57e90e=_0x690c73['value']['split'](',')[_0x1969('0x40')](function(_0x395f37){return Number(_0x395f37);});_0x57e90e[_0x1969('0x78')](function(_0x4d6281){_0x408f6c['or'](_0x1969('0x79'),'%,'+_0x4d6281+',%');});_0x46f4e4=_['union'](_0x46f4e4,_0x57e90e);break;case _0x1969('0x7a'):if(_0x690c73[_0x1969('0x6d')]==='$substring'){_0xe78501[_0xddaa0a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x690c73[_0x1969('0x68')]+'%',null);}else{_0x26a6f5=_[_0x1969('0x66')](_0x94e2b4,[_0x1969('0x2c'),_0x1969('0x39')]);_0x690c73['field']='UserId';_0x124a45=as['buildExpression'](_0x42613c,_0x26a6f5[_0x1969('0x3d')],_0x690c73);_0xe78501[_0xddaa0a](_0x124a45[_0x1969('0x7b')],_0x124a45[_0x1969('0x68')][_0x1969('0x76')],_0x124a45[_0x1969('0x68')][_0x1969('0x1e')]);}break;case'body':_0x124a45=as[_0x1969('0x75')]('me',null,_0x690c73);_0xe78501[_0xddaa0a](_0x124a45[_0x1969('0x7b')],_0x124a45[_0x1969('0x68')]['start'],_0x124a45[_0x1969('0x68')]['end']);break;}}else{var _0x124a45=as['buildExpression'](_0x42613c,_0x26a6f5[_0x1969('0x3d')],_0x690c73);_0xe78501[_0xddaa0a](_0x124a45[_0x1969('0x7b')],_0x124a45[_0x1969('0x68')][_0x1969('0x76')],_0x124a45[_0x1969('0x68')][_0x1969('0x1e')]);}}}else{var _0x5961b0=_(_0x143833['query'])['keys']()[_0x1969('0x40')](function(_0x1bb69a){return _[_0x1969('0x7c')](_0x94e2b4,[_0x1969('0x2c'),_0x1bb69a])?_0x1bb69a:undefined;})[_0x1969('0x7d')]()[_0x1969('0x68')]();if(!_[_0x1969('0x7e')](_0x5961b0)){_0x5961b0[_0x1969('0x78')](function(_0xda1cdc){if(_0xda1cdc===_0x1969('0x7f')){_0x2777de[_0x1969('0x4a')](_0x1969('0x80'),[]['concat'](_0x143833['query'][_0xda1cdc]));}else if(_0xda1cdc===_0x1969('0x81')){var _0x566d2d=JSON[_0x1969('0x82')](_0x143833[_0x1969('0x41')][_0xda1cdc])[_0x1969('0x83')];var _0x56ef93=JSON[_0x1969('0x82')](_0x143833[_0x1969('0x41')][_0xda1cdc])['$lte'];_0x2777de[_0x1969('0x4a')](_0x1969('0x84'),_0x566d2d,_0x56ef93);}else{if(_0x143833[_0x1969('0x41')][_0xda1cdc]==='null'){_0x2777de['where']('i.'+_0xda1cdc+_0x1969('0x85'));}else{_0x2777de[_0x1969('0x4a')]('i.'+_0xda1cdc+_0x1969('0x86'),_0x143833[_0x1969('0x41')][_0xda1cdc]);}}});}if(_0x143833['query']['read']){if(_0x143833[_0x1969('0x41')]['read']==0x1){_0x2777de[_0x1969('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x2777de[_0x1969('0x6a')](_0x1969('0x87'));}}if(_0x143833[_0x1969('0x41')][_0x1969('0x88')]){_0x46f4e4=_['isArray'](_0x143833[_0x1969('0x41')][_0x1969('0x88')])?_0x143833['query'][_0x1969('0x88')]:new Array(_0x143833[_0x1969('0x41')]['tag']);_0x46f4e4[_0x1969('0x78')](function(_0x2d4ca0){_0x408f6c['or'](_0x1969('0x79'),'%,'+_0x2d4ca0+',%');});}if(_0x143833['query'][_0x1969('0x89')]){var _0x43948b=_0x143833[_0x1969('0x41')]['filter']['replace']('\x5c','\x5c\x5c')[_0x1969('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x43948b)){_0xe78501['or'](_0x1969('0x8b'),_0x43948b+'%')['or'](_0x1969('0x8c'),_0x43948b+'%');}else{_0xe78501['or'](_0x1969('0x8d'),qs[_0x1969('0x72')](_0x43948b))['or'](_0x1969('0x8e'),_0x43948b+'%');}}}_0x2777de[_0x1969('0x4a')](_0xe78501);_0x2777de[_0x1969('0x8f')]('i.id');var _0x5a620c={'type':db[_0x1969('0x90')][_0x1969('0x91')][_0x1969('0x92')],'raw':!![]};var _0x2a5e39=_0x2777de[_0x1969('0x93')]();_0x2a5e39[_0x1969('0x4d')](_0x1969('0x94'));_0x2a5e39['field'](_0x1969('0x95'),_0x1969('0x67'));if(_0x17e1cc[_0x1969('0x48')]){_0x17e1cc[_0x1969('0x48')][_0x1969('0x78')](function(_0x36ef2f){var _0x5ccd84=_0x36ef2f[0x0]===_0x1969('0x96')?_0x36ef2f[0x0]:'i.'+_0x36ef2f[0x0];_0x2777de['order'](_0x5ccd84,_0x36ef2f[0x1]===_0x1969('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x46f4e4)){_0x2777de[_0x1969('0x6a')](_0x408f6c);_0x2a5e39[_0x1969('0x4a')](_0x1969('0x98'),_0x46f4e4);}BPromise[_0x1969('0x99')]()[_0x1969('0x27')](function(){if(!_0x3546c8){if(_0x143833[_0x1969('0x41')][_0x1969('0x7f')])return;_0x2a5e39[_0x1969('0x4a')](_0x1969('0x9a'));_0x2777de['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x143833[_0x1969('0x9b')][_0x1969('0x9c')]!==_0x1969('0x9d'))return;return _0x143833[_0x1969('0x9b')][_0x1969('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c8676){if(_[_0x1969('0x7e')](_0x2c8676)){_0x2a5e39[_0x1969('0x4a')](_0x1969('0x9f'));_0x2777de['where'](_0x1969('0x9f'));}else{_0x2a5e39[_0x1969('0x4a')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x2c8676,'id'));_0x2777de[_0x1969('0x4a')]('i.SmsAccountId\x20IN\x20?',_[_0x1969('0x40')](_0x2c8676,'id'));}});})[_0x1969('0x27')](function(){if(_0x143833[_0x1969('0x9b')]['role']==='agent'&&!_0x3546c8&&!_0x143833[_0x1969('0x41')][_0x1969('0x7f')])return[];return db[_0x1969('0xa0')][_0x1969('0x41')](_0x2a5e39[_0x1969('0xa1')](),_0x5a620c);})[_0x1969('0x27')](function(_0x217d99){_0x5085a3[_0x1969('0x22')]=_0x217d99[_0x1969('0x70')];if(_0x5085a3['count']===0x0)return[];return db[_0x1969('0xa0')][_0x1969('0x41')](_0x146dfb[_0x1969('0xa1')](),_0x5a620c)[_0x1969('0x27')](function(_0x2268b2){_0x581a29=_[_0x1969('0xa2')](_0x2268b2,'id');_0x5a620c=_[_0x1969('0xa3')](_0x5a620c,{'model':db[_0x1969('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x143833['query'][_0x1969('0x46')]){_0x17e1cc[_0x1969('0x44')]['forEach'](function(_0x1ad711){_0x2777de[_0x1969('0x4d')]('i.'+_0x1ad711);});}else{_0x2777de[_0x1969('0x4d')](_0x1969('0x95'),'unreadMessages');_0x2777de[_0x1969('0x4d')](_0x1969('0xa5'),'Account.key');_0x2777de[_0x1969('0x4d')](_0x1969('0xa6'),_0x1969('0xa7'));_0x2777de[_0x1969('0x4d')](_0x1969('0xa8'),'contactName');_0x2777de[_0x1969('0x4d')]('i.*');_0x2777de[_0x1969('0x4d')](_0x1969('0xa9'),'Contact.firstName');_0x2777de[_0x1969('0x4d')](_0x1969('0xaa'),_0x1969('0xab'));_0x2777de['field'](_0x1969('0xac'),'Contact.email');_0x2777de[_0x1969('0x4d')]('c.phone',_0x1969('0xad'));_0x2777de[_0x1969('0x4d')](_0x1969('0xae'),_0x1969('0xaf'));_0x2777de[_0x1969('0x4d')](_0x1969('0xb0'),_0x1969('0xb1'));_0x2777de[_0x1969('0x4d')](_0x1969('0xb2'),_0x1969('0xb3'));_0x2777de[_0x1969('0x4d')](_0x1969('0xb4'),'Owner.internal');_0x2777de[_0x1969('0x4d')](_0x1969('0xb5'),_0x1969('0x30'));}if(_0x17e1cc[_0x1969('0x23')])_0x2777de[_0x1969('0x23')](_0x17e1cc[_0x1969('0x23')]);if(_0x17e1cc[_0x1969('0x20')])_0x2777de[_0x1969('0x20')](_0x17e1cc[_0x1969('0x20')]);return db['sequelize'][_0x1969('0x41')](_0x2777de[_0x1969('0xa1')](),_0x5a620c);})[_0x1969('0x27')](function(_0x25d958){if(_0x25d958[_0x1969('0x70')]>0x0)_0x557637[_0x1969('0x4a')]('ui.SmsInteractionId\x20IN\x20?',_[_0x1969('0x40')](_0x25d958,'id'));return db['sequelize'][_0x1969('0x41')](_0x557637[_0x1969('0xa1')](),_0x5a620c)[_0x1969('0x27')](function(_0x5d9004){var _0x5a1e9b=_[_0x1969('0xb6')](_0x5d9004,_0x1969('0xb7'));var _0x1cd69d=[];_0x25d958[_0x1969('0x78')](function(_0x5e9abb){_0x1cd69d['push'](updateSmsInteraction(_0x5e9abb,_0x581a29,_0x5a1e9b));});return BPromise[_0x1969('0xb8')](_0x1cd69d);});});})[_0x1969('0x27')](function(_0x308d39){_0x5085a3[_0x1969('0xb9')]=_0x308d39;return _0x5085a3;})[_0x1969('0x27')](respondWithFilteredResult(_0x24744c,_0x17e1cc))[_0x1969('0x33')](handleError(_0x24744c,null));};exports[_0x1969('0xba')]=function(_0x84bdec,_0x481758){var _0x79c05d={'raw':![],'where':{'id':_0x84bdec['params']['id']}},_0x53cc55={};_0x53cc55[_0x1969('0x3f')]=_['keys'](db[_0x1969('0xa4')][_0x1969('0x3c')]);_0x53cc55[_0x1969('0x41')]=_[_0x1969('0x42')](_0x84bdec[_0x1969('0x41')]);_0x53cc55[_0x1969('0x43')]=_[_0x1969('0x45')](_0x53cc55[_0x1969('0x3f')],_0x53cc55[_0x1969('0x41')]);_0x79c05d['attributes']=_[_0x1969('0x45')](_0x53cc55[_0x1969('0x3f')],qs['fields'](_0x84bdec[_0x1969('0x41')][_0x1969('0x46')]));_0x79c05d['attributes']=_0x79c05d[_0x1969('0x44')]['length']?_0x79c05d[_0x1969('0x44')]:_0x53cc55[_0x1969('0x3f')];if(_0x84bdec[_0x1969('0x41')]['includeAll']){_0x79c05d[_0x1969('0xbb')]=[{'all':!![]}];}_0x79c05d=_[_0x1969('0xa3')]({},_0x79c05d,_0x84bdec['options']);return db['SmsInteraction']['find'](_0x79c05d)[_0x1969('0x27')](handleEntityNotFound(_0x481758,null))[_0x1969('0x27')](respondWithResult(_0x481758,null))[_0x1969('0x33')](handleError(_0x481758,null));};exports['create']=function(_0x276cb0,_0x359a74){return db[_0x1969('0xa4')][_0x1969('0xbc')](_0x276cb0['body'],{})[_0x1969('0x27')](respondWithResult(_0x359a74,0xc9))[_0x1969('0x33')](handleError(_0x359a74,null));};exports[_0x1969('0x26')]=function(_0x5a09f0,_0x2eaddf){if(_0x5a09f0[_0x1969('0xbd')]['id']){delete _0x5a09f0[_0x1969('0xbd')]['id'];}return db[_0x1969('0xa4')][_0x1969('0x66')]({'where':{'id':_0x5a09f0[_0x1969('0xbe')]['id']}})[_0x1969('0x27')](handleEntityNotFound(_0x2eaddf,null))[_0x1969('0x27')](saveUpdates(_0x5a09f0[_0x1969('0xbd')],null))[_0x1969('0x27')](respondWithResult(_0x2eaddf,null))[_0x1969('0x33')](handleError(_0x2eaddf,null));};exports[_0x1969('0x28')]=function(_0x2bd926,_0x35c7ae){return db[_0x1969('0xa4')][_0x1969('0x66')]({'where':{'id':_0x2bd926[_0x1969('0xbe')]['id']}})[_0x1969('0x27')](handleEntityNotFound(_0x35c7ae,null))[_0x1969('0x27')](removeEntity(_0x35c7ae,null))[_0x1969('0x33')](handleError(_0x35c7ae,null));};exports[_0x1969('0xbf')]=function(_0x67c27e,_0x2030c4){return db[_0x1969('0xa4')][_0x1969('0xbf')]()[_0x1969('0x27')](respondWithResult(_0x2030c4,null))['catch'](handleError(_0x2030c4,null));};exports['addMessage']=function(_0x3ad09d,_0x14e70b,_0x46bf70){return db[_0x1969('0xc0')][_0x1969('0x66')]({'where':{'id':_0x3ad09d[_0x1969('0xbe')]['id']}})[_0x1969('0x27')](handleEntityNotFound(_0x14e70b,null))['then'](function(_0x2768d7){if(_0x2768d7){return _0x2768d7[_0x1969('0xc1')](_0x3ad09d[_0x1969('0xbd')][_0x1969('0xc2')],_[_0x1969('0xc3')](_0x3ad09d['body'],[_0x1969('0xc2'),'id'])||{});}})[_0x1969('0x27')](respondWithResult(_0x14e70b,null))[_0x1969('0x33')](handleError(_0x14e70b,null));};exports[_0x1969('0xc4')]=function(_0x101a67,_0x4e8264,_0xbd5ff2){var _0x197373={'raw':![],'where':{}};var _0x407991={};var _0x584b1f={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x1969('0xc5')]({'where':{'id':_0x101a67['params']['id']}})[_0x1969('0x27')](handleEntityNotFound(_0x4e8264,null))['then'](function(_0x216cf9){if(_0x216cf9){_0x407991[_0x1969('0x3f')]=_['keys'](db[_0x1969('0xc0')]['rawAttributes']);_0x407991[_0x1969('0x41')]=_[_0x1969('0x42')](_0x101a67['query']);_0x407991[_0x1969('0x43')]=_[_0x1969('0x45')](_0x407991[_0x1969('0x3f')],_0x407991[_0x1969('0x41')]);_0x197373[_0x1969('0x44')]=_[_0x1969('0x45')](_0x407991[_0x1969('0x3f')],qs[_0x1969('0x46')](_0x101a67['query'][_0x1969('0x46')]));_0x197373[_0x1969('0x44')]=_0x197373[_0x1969('0x44')][_0x1969('0x70')]?_0x197373[_0x1969('0x44')]:_0x407991[_0x1969('0x3f')];if(!_0x101a67[_0x1969('0x41')][_0x1969('0x47')]('nolimit')){_0x197373[_0x1969('0x23')]=qs[_0x1969('0x23')](_0x101a67[_0x1969('0x41')]['limit']);_0x197373['offset']=qs['offset'](_0x101a67[_0x1969('0x41')]['offset']);}_0x197373[_0x1969('0x48')]=qs['sort'](_0x101a67['query'][_0x1969('0x49')]);_0x197373[_0x1969('0x4a')]=qs[_0x1969('0x43')](_['pick'](_0x101a67[_0x1969('0x41')],_0x407991['filters']));_0x197373[_0x1969('0x4a')][_0x1969('0xb7')]=_0x216cf9['id'];if(_0x101a67[_0x1969('0x41')][_0x1969('0x89')]){_0x197373[_0x1969('0x4a')]=_[_0x1969('0xa3')](_0x197373[_0x1969('0x4a')],{'$or':_['map'](_0x197373[_0x1969('0x44')],function(_0x10eae1){var _0x4a24ea={};_0x4a24ea[_0x10eae1]={'$like':'%'+_0x101a67[_0x1969('0x41')][_0x1969('0x89')]+'%'};return _0x4a24ea;})});}if(_0x101a67[_0x1969('0x41')]['$gte']){var _0x1758bd=_0x101a67[_0x1969('0x41')][_0x1969('0x83')]['split'](',');var _0x1a17f3={};_0x1a17f3[_0x1758bd[0x0]]={'$gte':moment(_0x1758bd[0x1])[_0x1969('0xc6')](_0x1969('0xc7'))};_0x197373['where']=_[_0x1969('0xa3')](_0x197373['where'],_0x1a17f3);}_0x197373=_[_0x1969('0xa3')]({},_0x197373,_0x101a67['options']);return db[_0x1969('0xc0')][_0x1969('0x22')]({'where':_0x197373['where']})[_0x1969('0x27')](function(_0x2a5362){_0x584b1f[_0x1969('0x22')]=_0x2a5362;if(_0x101a67[_0x1969('0x41')]['includeAll']){_0x197373['include']=[{'all':!![]}];}return db[_0x1969('0xc0')][_0x1969('0xc8')](_0x197373);})[_0x1969('0x27')](function(_0x6a33a2){_0x584b1f[_0x1969('0xb9')]=_0x6a33a2;return _0x584b1f;});}})['then'](respondWithFilteredResult(_0x4e8264,_0x197373))[_0x1969('0x33')](handleError(_0x4e8264,null));};exports[_0x1969('0xc9')]=function(_0x24a1c1,_0x27e2e2,_0x52f020){return db[_0x1969('0xa4')][_0x1969('0x66')]({'where':{'id':_0x24a1c1['params']['id']}})[_0x1969('0x27')](handleEntityNotFound(_0x27e2e2,null))[_0x1969('0x27')](function(_0x518519){if(_0x518519){return _0x518519[_0x1969('0xca')](_0x24a1c1[_0x1969('0xbd')][_0x1969('0xc2')],_[_0x1969('0xc3')](_0x24a1c1[_0x1969('0xbd')],['ids','id'])||{})[_0x1969('0xcb')](function(){return db[_0x1969('0x77')][_0x1969('0xc8')]({'attributes':['id',_0x1969('0x2c'),_0x1969('0x4e')],'where':{'id':_0x24a1c1['body'][_0x1969('0xc2')]}});})['then'](function(_0x49ab24){socket[_0x1969('0xcc')](_0x1969('0xcd'),{'id':Number(_0x24a1c1[_0x1969('0xbe')]['id']),'tags':_0x49ab24||[]});return{'id':Number(_0x24a1c1[_0x1969('0xbe')]['id']),'tags':_0x49ab24||[]};});}})[_0x1969('0x27')](respondWithResult(_0x27e2e2,null))[_0x1969('0x33')](handleError(_0x27e2e2,null));};exports[_0x1969('0xce')]=function(_0x4401fd,_0x4c4d89,_0x41b87a){return db[_0x1969('0xa4')]['find']({'where':{'id':_0x4401fd['params']['id']}})['then'](handleEntityNotFound(_0x4c4d89,null))[_0x1969('0x27')](function(_0x50f2a5){if(_0x50f2a5){return _0x50f2a5['removeTags'](_0x4401fd['query'][_0x1969('0xc2')]);}})['then'](respondWithStatusCode(_0x4c4d89,null))[_0x1969('0x33')](handleError(_0x4c4d89,null));};exports['download']=function(_0x2c2c47,_0x427e00){var _0x32d589=moment()[_0x1969('0xcf')]()[_0x1969('0xa1')]();var _0xe315cb=path[_0x1969('0xd0')](config[_0x1969('0xd1')],_0x1969('0xd2'),'files',_0x1969('0xd3'));var _0x2d3966=path['join'](config[_0x1969('0xd1')],_0x1969('0xd2'),_0x1969('0xd4'),'attachments');var _0x50b745=path[_0x1969('0xd0')](_0xe315cb,_0x32d589);var _0x14b45a=util[_0x1969('0xc6')](_0x1969('0xd5'),_0x2c2c47[_0x1969('0xbe')]['id'],_0x32d589);var _0x49597f=path[_0x1969('0xd0')](_0xe315cb,_0x14b45a);var _0x19374f=[];_0x19374f['push']({'model':db[_0x1969('0x7a')],'as':_0x1969('0x7a'),'attributes':['id','fullname'],'raw':!![]});_0x19374f[_0x1969('0x32')]({'model':db[_0x1969('0xd6')],'as':'Contact','attributes':['id',_0x1969('0xd7'),_0x1969('0xd8')],'raw':!![]});var _0x3741b0=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x1969('0xbd'),_0x1969('0x81'),_0x1969('0xd9'),'secret','read'],'include':_0x19374f}];_0x3741b0[_0x1969('0x32')]({'model':db[_0x1969('0xda')],'as':_0x1969('0xdb'),'attributes':['id','name']});_0x3741b0[_0x1969('0x32')]({'model':db[_0x1969('0x7a')],'as':_0x1969('0xdc'),'attributes':['id',_0x1969('0x2f')]});return db['SmsInteraction'][_0x1969('0x66')]({'where':{'id':_0x2c2c47[_0x1969('0xbe')]['id']},'include':_0x3741b0})[_0x1969('0x27')](handleEntityNotFound(_0x427e00,null))[_0x1969('0x27')](function(_0x36365a){if(_0x36365a){var _0x363176=_0x36365a['get']({'plain':!![]});fs['mkdirSync'](_0x50b745);var _0x352b7d={'channel':_0x1969('0xdd'),'account':_0x363176['Account'][_0x1969('0x2c')],'agent':_0x363176[_0x1969('0xdc')]?_0x363176[_0x1969('0xdc')][_0x1969('0x2f')]:_0x1969('0xde'),'createdAt':moment(_0x363176[_0x1969('0x81')])[_0x1969('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1969('0xa1')](),'closedAt':_0x363176[_0x1969('0x3a')]?moment(_0x363176[_0x1969('0xdf')])['format'](_0x1969('0xc7'))[_0x1969('0xa1')]():'','disposition':_0x363176['disposition'],'messages':_(_0x363176['Messages'])['filter']({'secret':![]})[_0x1969('0x40')](function(_0xc36489){return{'date':moment(_0xc36489[_0x1969('0x81')])[_0x1969('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1969('0xa1')](),'sender':_0xc36489[_0x1969('0xd9')]===_0x1969('0xe0')?_0xc36489[_0x1969('0x7a')]?_0xc36489[_0x1969('0x7a')][_0x1969('0x2f')]:_0x1969('0xe1'):_0xc36489['Contact']['firstName']+(_0xc36489[_0x1969('0x6c')]['lastName']?'\x20'+_0xc36489[_0x1969('0x6c')][_0x1969('0xd8')]:''),'body':_0xc36489[_0x1969('0xbd')],'direction':_0xc36489['direction']===_0x1969('0xe0')?'A':'C','secret':_0xc36489['secret'],'read':_0xc36489[_0x1969('0xe2')]};})[_0x1969('0x68')]()};return ejs['renderFile'](path[_0x1969('0xd0')](config['root'],_0x1969('0xd2'),_0x1969('0xe3'),_0x1969('0xe4')),{'interaction':_0x352b7d})[_0x1969('0x27')](function(_0x43f933){var _0x3feb52=path[_0x1969('0xd0')](_0x50b745,_0x1969('0xe5')+_0x363176['id']+'-'+_0x32d589+_0x1969('0xe6'));var _0x4066f0={'path':_0x3feb52,'channel':_0x1969('0xdd'),'interactionId':_0x363176['id']};return pdf[_0x1969('0xe7')](_0x43f933,_0x4066f0);})[_0x1969('0x27')](function(){return new BPromise(function(_0x3b62fe,_0x3c1455){zipdir(_0x50b745,{'saveTo':_0x49597f},function(_0x12e8e5,_0x418803){if(_0x12e8e5)return _0x3c1455(_0x12e8e5);return _0x3b62fe(_0x418803);});})[_0x1969('0x27')](function(){return new BPromise(function(_0xbe3f52,_0xd807dc){rimraf(_0x50b745,function(_0x4dd7d5){if(_0x4dd7d5)_0xd807dc(_0x4dd7d5);return _0xbe3f52();});});})['then'](function(){return _0x427e00['download'](_0x49597f,_0x14b45a,function(_0x2037be){if(_0x2037be){console['log'](_0x1969('0xe8'),_0x2037be);}else{fs[_0x1969('0xe9')](_0x49597f);}});});});}else{return _0x427e00[_0x1969('0x29')](0xc8);}})[_0x1969('0x33')](handleError(_0x427e00,null));}; \ No newline at end of file +var _0xd2ab=['sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.phone\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','count','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','intersection','includeAll','include','options','create','update','params','describe','addMessage','SmsMessage','ids','findOne','hasOwnProperty','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Messages','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','direction','out','System','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','unlinkSync','eml-format','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','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','error','name','send','map','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','SmsInteraction','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users'];(function(_0x47ac59,_0x1b84fe){var _0x258a2e=function(_0x113d19){while(--_0x113d19){_0x47ac59['push'](_0x47ac59['shift']());}};_0x258a2e(++_0x1b84fe);}(_0xd2ab,0x91));var _0xbd2a=function(_0x1afb9f,_0x16e609){_0x1afb9f=_0x1afb9f-0x0;var _0x15568e=_0xd2ab[_0x1afb9f];return _0x15568e;};'use strict';var emlformat=require(_0xbd2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbd2a('0x1'));var rp=require('request-promise');var moment=require(_0xbd2a('0x2'));var BPromise=require(_0xbd2a('0x3'));var Mustache=require(_0xbd2a('0x4'));var util=require(_0xbd2a('0x5'));var path=require(_0xbd2a('0x6'));var sox=require(_0xbd2a('0x7'));var csv=require(_0xbd2a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd2a('0x9'));var _=require(_0xbd2a('0xa'));var squel=require(_0xbd2a('0xb'));var crypto=require(_0xbd2a('0xc'));var jsforce=require(_0xbd2a('0xd'));var deskjs=require(_0xbd2a('0xe'));var toCsv=require(_0xbd2a('0x8'));var querystring=require(_0xbd2a('0xf'));var Papa=require(_0xbd2a('0x10'));var Redis=require(_0xbd2a('0x11'));var authService=require(_0xbd2a('0x12'));var qs=require(_0xbd2a('0x13'));var as=require(_0xbd2a('0x14'));var pdf=require(_0xbd2a('0x15'));var hardwareService=require(_0xbd2a('0x16'));var logger=require(_0xbd2a('0x17'))(_0xbd2a('0x18'));var utils=require(_0xbd2a('0x19'));var config=require(_0xbd2a('0x1a'));var licenseUtil=require(_0xbd2a('0x1b'));var db=require(_0xbd2a('0x1c'))['db'];config[_0xbd2a('0x1d')]=_[_0xbd2a('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbd2a('0x1f'))(new Redis(config['redis']));require(_0xbd2a('0x20'))['register'](socket);function respondWithStatusCode(_0x58d8c5,_0x214833){_0x214833=_0x214833||0xcc;return function(_0x491006){if(_0x491006){return _0x58d8c5[_0xbd2a('0x21')](_0x214833);}return _0x58d8c5[_0xbd2a('0x22')](_0x214833)[_0xbd2a('0x23')]();};}function respondWithResult(_0x49eb1c,_0x4c28dc){_0x4c28dc=_0x4c28dc||0xc8;return function(_0x48fae3){if(_0x48fae3){return _0x49eb1c[_0xbd2a('0x22')](_0x4c28dc)[_0xbd2a('0x24')](_0x48fae3);}};}function respondWithFilteredResult(_0x5b73b6,_0x484c66){return function(_0x540760){if(_0x540760){var _0x26028e=typeof _0x484c66[_0xbd2a('0x25')]===_0xbd2a('0x26')&&typeof _0x484c66[_0xbd2a('0x27')]==='undefined';var _0x5ad218=_0x540760['count'];var _0x276e7a=_0x26028e?0x0:_0x484c66['offset'];var _0x3a3fbc=_0x26028e?_0x540760['count']:_0x484c66[_0xbd2a('0x25')]+_0x484c66[_0xbd2a('0x27')];var _0x52eacf;if(_0x3a3fbc>=_0x5ad218){_0x3a3fbc=_0x5ad218;_0x52eacf=0xc8;}else{_0x52eacf=0xce;}_0x5b73b6[_0xbd2a('0x22')](_0x52eacf);return _0x5b73b6[_0xbd2a('0x28')](_0xbd2a('0x29'),_0x276e7a+'-'+_0x3a3fbc+'/'+_0x5ad218)[_0xbd2a('0x24')](_0x540760);}return null;};}function patchUpdates(_0x3245f1){return function(_0xab09e5){try{jsonpatch[_0xbd2a('0x2a')](_0xab09e5,_0x3245f1,!![]);}catch(_0x23b434){return BPromise['reject'](_0x23b434);}return _0xab09e5[_0xbd2a('0x2b')]();};}function saveUpdates(_0x462698,_0x1f1316){return function(_0x48fd72){if(_0x48fd72){return _0x48fd72['update'](_0x462698)[_0xbd2a('0x2c')](function(_0x4c682e){return _0x4c682e;});}return null;};}function removeEntity(_0x307b74,_0x4662f5){return function(_0x12c48b){if(_0x12c48b){return _0x12c48b[_0xbd2a('0x2d')]()[_0xbd2a('0x2c')](function(){_0x307b74['status'](0xcc)[_0xbd2a('0x23')]();});}};}function handleEntityNotFound(_0x2ee24e,_0x119c26){return function(_0x3d6a3c){if(!_0x3d6a3c){_0x2ee24e[_0xbd2a('0x21')](0x194);}return _0x3d6a3c;};}function handleError(_0x18aa6e,_0x2e7a1a){_0x2e7a1a=_0x2e7a1a||0x1f4;return function(_0x3b870e){logger[_0xbd2a('0x2e')](_0x3b870e['stack']);if(_0x3b870e[_0xbd2a('0x2f')]){delete _0x3b870e[_0xbd2a('0x2f')];}_0x18aa6e['status'](_0x2e7a1a)[_0xbd2a('0x30')](_0x3b870e);};}function getInteractionUsers(_0x49aaf8,_0x3d3703){return new BPromise(function(_0x66f9f2,_0x2c48da){try{if(_0x3d3703[_0x49aaf8['id']]){_0x49aaf8['Users']=_[_0xbd2a('0x31')](_0x3d3703[_0x49aaf8['id']],function(_0x52a52b){return{'id':_0x52a52b['id'],'fullname':_0x52a52b['fullname']};});}}catch(_0x5ad7bb){_0x2c48da(_0x5ad7bb);}_0x66f9f2(_0x49aaf8);});}function getInteractionTags(_0x1299ac,_0x26d50d){return new BPromise(function(_0x5b93e1,_0x32b9e5){try{if(_0x1299ac[_0xbd2a('0x32')]){_0x1299ac[_0xbd2a('0x33')]=[];_0x1299ac['TagIds'][_0xbd2a('0x34')](',')[_0xbd2a('0x35')](function(_0x4d2cf2){_0x1299ac[_0xbd2a('0x33')][_0xbd2a('0x36')](_0x26d50d[_0x4d2cf2]);});}delete _0x1299ac[_0xbd2a('0x32')];}catch(_0x1610da){_0x32b9e5(_0x1610da);}_0x5b93e1(_0x1299ac);});}function updateSmsInteraction(_0x2c44f1,_0x2b7c4c,_0x5403d0){return new BPromise(function(_0x11bc71,_0x3fbd14){return getInteractionUsers(_0x2c44f1,_0x5403d0)['then'](function(_0x4eba9e){return getInteractionTags(_0x4eba9e,_0x2b7c4c);})[_0xbd2a('0x2c')](function(_0x5c7dbd){return getStateInteraction(_0x5c7dbd);})[_0xbd2a('0x2c')](function(_0x17b90b){_0x11bc71(_0x17b90b);})[_0xbd2a('0x37')](function(_0x8e9bfd){_0x3fbd14(_0x8e9bfd);});});}function getStateInteraction(_0x2b7fb2){return new BPromise(function(_0x2b3078){_0x2b7fb2[_0xbd2a('0x38')]=0x0;_0x2b7fb2[_0xbd2a('0x39')]=0x0;_0x2b7fb2[_0xbd2a('0x3a')]=0x0;_0x2b7fb2[_0xbd2a('0x3b')]=0x0;_0x2b7fb2[_0xbd2a('0x3c')]=0x0;if(!_0x2b7fb2['closed']&&!_0x2b7fb2[_0xbd2a('0x3d')]){_0x2b7fb2['waiting']+=0x1;}if(!_0x2b7fb2[_0xbd2a('0x3e')]&&_0x2b7fb2['UserId']){_0x2b7fb2[_0xbd2a('0x39')]+=0x1;if(_0x2b7fb2[_0xbd2a('0x38')]){_0x2b7fb2['waiting']-=0x1;}}if(_0x2b7fb2['closed']&&_0x2b7fb2[_0xbd2a('0x3d')]){_0x2b7fb2[_0xbd2a('0x3a')]+=0x1;if(_0x2b7fb2[_0xbd2a('0x39')]){_0x2b7fb2['talking']-=0x1;}}if(_0x2b7fb2[_0xbd2a('0x3e')]&&!_0x2b7fb2[_0xbd2a('0x3d')]){_0x2b7fb2[_0xbd2a('0x3b')]+=0x1;if(_0x2b7fb2[_0xbd2a('0x38')]){_0x2b7fb2[_0xbd2a('0x38')]-=0x1;}}_0x2b7fb2[_0xbd2a('0x3c')]+=0x1;_0x2b3078(_0x2b7fb2);});}exports['index']=function(_0x3be739,_0x4fc510){var _0x38fbd1={},_0x4b5241={},_0x28c6b8={'count':0x0,'rows':[]};var _0x50e6df=_[_0xbd2a('0x31')](db[_0xbd2a('0x3f')][_0xbd2a('0x40')],function(_0x1cbb37){return{'name':_0x1cbb37[_0xbd2a('0x41')],'type':_0x1cbb37[_0xbd2a('0x42')]['key']};});_0x4b5241[_0xbd2a('0x43')]=_['map'](_0x50e6df,_0xbd2a('0x2f'));_0x4b5241[_0xbd2a('0x44')]=_[_0xbd2a('0x45')](_0x3be739['query']);_0x4b5241[_0xbd2a('0x46')]=_['intersection'](_0x4b5241[_0xbd2a('0x43')],_0x4b5241[_0xbd2a('0x44')]);_0x38fbd1[_0xbd2a('0x47')]=_['intersection'](_0x4b5241[_0xbd2a('0x43')],qs[_0xbd2a('0x48')](_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x48')]));_0x38fbd1[_0xbd2a('0x47')]=_0x38fbd1[_0xbd2a('0x47')][_0xbd2a('0x49')]?_0x38fbd1[_0xbd2a('0x47')]:_0x4b5241['model'];if(!_0x3be739[_0xbd2a('0x44')]['hasOwnProperty'](_0xbd2a('0x4a'))){_0x38fbd1[_0xbd2a('0x27')]=qs[_0xbd2a('0x27')](_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x27')]);_0x38fbd1[_0xbd2a('0x25')]=qs[_0xbd2a('0x25')](_0x3be739[_0xbd2a('0x44')]['offset']);}_0x38fbd1[_0xbd2a('0x4b')]=qs[_0xbd2a('0x4c')](_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x4c')]);_0x38fbd1[_0xbd2a('0x4d')]=qs[_0xbd2a('0x46')](_[_0xbd2a('0x4e')](_0x3be739['query'],_0x4b5241[_0xbd2a('0x46')]),_0x50e6df);var _0x5b4007=[];var _0x1ea570=squel[_0xbd2a('0x4f')]()[_0xbd2a('0x50')]('id')[_0xbd2a('0x50')](_0xbd2a('0x2f'))[_0xbd2a('0x50')](_0xbd2a('0x51'))[_0xbd2a('0x52')](_0xbd2a('0x53'));var _0x27ddc5=squel[_0xbd2a('0x4f')]()[_0xbd2a('0x50')]('u.id')[_0xbd2a('0x50')](_0xbd2a('0x54'))[_0xbd2a('0x50')](_0xbd2a('0x55'))[_0xbd2a('0x52')](_0xbd2a('0x56'),'ui')[_0xbd2a('0x57')](_0xbd2a('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x10654d=squel[_0xbd2a('0x4f')]()[_0xbd2a('0x52')](_0xbd2a('0x59'),'i')[_0xbd2a('0x57')](_0xbd2a('0x5a'),'c',_0xbd2a('0x5b'))['left_join'](_0xbd2a('0x58'),'o',_0xbd2a('0x5c'))[_0xbd2a('0x57')](_0xbd2a('0x5d'),'a',_0xbd2a('0x5e'))[_0xbd2a('0x57')](_0xbd2a('0x5f'),'me',_0xbd2a('0x60'))[_0xbd2a('0x57')]('sms_interaction_has_tags','it',_0xbd2a('0x61'))[_0xbd2a('0x57')](_0xbd2a('0x53'),'t',_0xbd2a('0x62'));var _0x2843c3=squel[_0xbd2a('0x63')]();var _0x37afce=[];var _0x18392e=squel[_0xbd2a('0x63')]();var _0x2bb18e;if(_0x3be739[_0xbd2a('0x44')]['search']){_0x2bb18e=as[_0xbd2a('0x64')](_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x65')]);var _0x5824e1=_0x2bb18e['sqlOperator'];for(var _0x1ce239=0x0;_0x1ce239<_0x2bb18e[_0xbd2a('0x66')][_0xbd2a('0x49')];_0x1ce239++){var _0x3578c0=_0x2bb18e['conditions'][_0x1ce239];var _0x5b5484='i';var _0x17373c=_[_0xbd2a('0x67')](_0x50e6df,['name',_0x3578c0['field']]);if(!_0x17373c){switch(_0x3578c0['field']){case _0xbd2a('0x68'):if(_0x3578c0[_0xbd2a('0x69')]==0x1){_0x10654d[_0xbd2a('0x6a')]('`'+_0x3578c0[_0xbd2a('0x50')]+'`\x20=\x200');}else{_0x10654d[_0xbd2a('0x6a')]('`'+_0x3578c0[_0xbd2a('0x50')]+_0xbd2a('0x6b'));}break;case _0xbd2a('0x6c'):if(_0x3578c0[_0xbd2a('0x6d')]===_0xbd2a('0x6e')){if(_0x3578c0['value'][_0xbd2a('0x34')]('\x20')[_0xbd2a('0x49')]>0x1){_0x2843c3[_0x5824e1]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbd2a('0x6f')](_0x3578c0[_0xbd2a('0x69')]),null);}else{var _0x54b787='%'+_0x3578c0[_0xbd2a('0x69')]+'%';_0x2843c3[_0x5824e1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x54b787,_0x54b787,_0x54b787);}}else{_0x17373c=_['find'](_0x50e6df,[_0xbd2a('0x2f'),'ContactId']);_0x3578c0['field']=_0xbd2a('0x70');_0x15ada1=as['buildExpression'](_0x5b5484,_0x17373c['type'],_0x3578c0);_0x2843c3[_0x5824e1](_0x15ada1[_0xbd2a('0x71')],_0x15ada1[_0xbd2a('0x69')][_0xbd2a('0x72')],_0x15ada1[_0xbd2a('0x69')][_0xbd2a('0x23')]);}break;case _0xbd2a('0x73'):var _0x1b413b=_0x3578c0[_0xbd2a('0x69')][_0xbd2a('0x34')](',')['map'](function(_0x109578){return Number(_0x109578);});_0x1b413b['forEach'](function(_0xf48181){_0x18392e['or'](_0xbd2a('0x74'),'%,'+_0xf48181+',%');});_0x37afce=_[_0xbd2a('0x75')](_0x37afce,_0x1b413b);break;case'User':if(_0x3578c0[_0xbd2a('0x6d')]===_0xbd2a('0x6e')){_0x2843c3[_0x5824e1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3578c0[_0xbd2a('0x69')]+'%',null);}else{_0x17373c=_[_0xbd2a('0x67')](_0x50e6df,['name',_0xbd2a('0x3d')]);_0x3578c0['field']='UserId';_0x15ada1=as['buildExpression'](_0x5b5484,_0x17373c[_0xbd2a('0x42')],_0x3578c0);_0x2843c3[_0x5824e1](_0x15ada1['text'],_0x15ada1[_0xbd2a('0x69')][_0xbd2a('0x72')],_0x15ada1[_0xbd2a('0x69')][_0xbd2a('0x23')]);}break;case _0xbd2a('0x76'):_0x15ada1=as['buildExpression']('me',null,_0x3578c0);_0x2843c3[_0x5824e1](_0x15ada1[_0xbd2a('0x71')],_0x15ada1[_0xbd2a('0x69')]['start'],_0x15ada1[_0xbd2a('0x69')]['end']);break;}}else{var _0x15ada1=as['buildExpression'](_0x5b5484,_0x17373c['type'],_0x3578c0);_0x2843c3[_0x5824e1](_0x15ada1['text'],_0x15ada1[_0xbd2a('0x69')][_0xbd2a('0x72')],_0x15ada1[_0xbd2a('0x69')][_0xbd2a('0x23')]);}}}else{var _0x35d053=_(_0x3be739[_0xbd2a('0x44')])[_0xbd2a('0x45')]()[_0xbd2a('0x31')](function(_0x5dd751){return _[_0xbd2a('0x77')](_0x50e6df,[_0xbd2a('0x2f'),_0x5dd751])?_0x5dd751:undefined;})[_0xbd2a('0x78')]()[_0xbd2a('0x69')]();if(!_[_0xbd2a('0x79')](_0x35d053)){_0x35d053[_0xbd2a('0x35')](function(_0x883a1a){if(_0x883a1a===_0xbd2a('0x7a')){_0x10654d['where'](_0xbd2a('0x7b'),[][_0xbd2a('0x7c')](_0x3be739[_0xbd2a('0x44')][_0x883a1a]));}else if(_0x883a1a===_0xbd2a('0x7d')){var _0x2fae51=JSON[_0xbd2a('0x7e')](_0x3be739[_0xbd2a('0x44')][_0x883a1a])[_0xbd2a('0x7f')];var _0x59f268=JSON[_0xbd2a('0x7e')](_0x3be739[_0xbd2a('0x44')][_0x883a1a])['$lte'];_0x10654d[_0xbd2a('0x4d')](_0xbd2a('0x80'),_0x2fae51,_0x59f268);}else{if(_0x3be739['query'][_0x883a1a]==='null'){_0x10654d[_0xbd2a('0x4d')]('i.'+_0x883a1a+_0xbd2a('0x81'));}else{_0x10654d[_0xbd2a('0x4d')]('i.'+_0x883a1a+_0xbd2a('0x82'),_0x3be739[_0xbd2a('0x44')][_0x883a1a]);}}});}if(_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x83')]){if(_0x3be739[_0xbd2a('0x44')]['read']==0x1){_0x10654d[_0xbd2a('0x6a')](_0xbd2a('0x84'));}else{_0x10654d[_0xbd2a('0x6a')](_0xbd2a('0x85'));}}if(_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x86')]){_0x37afce=_['isArray'](_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x86')])?_0x3be739[_0xbd2a('0x44')]['tag']:new Array(_0x3be739[_0xbd2a('0x44')]['tag']);_0x37afce[_0xbd2a('0x35')](function(_0x314525){_0x18392e['or'](_0xbd2a('0x74'),'%,'+_0x314525+',%');});}if(_0x3be739['query'][_0xbd2a('0x87')]){var _0x205e6f=_0x3be739['query'][_0xbd2a('0x87')][_0xbd2a('0x88')]('\x5c','\x5c\x5c')[_0xbd2a('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x205e6f)){_0x2843c3['or']('i.id\x20LIKE\x20?',_0x205e6f+'%')['or'](_0xbd2a('0x89'),_0x205e6f+'%');}else{_0x2843c3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x205e6f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x205e6f+'%');}}}_0x10654d[_0xbd2a('0x4d')](_0x2843c3);_0x10654d[_0xbd2a('0x8a')]('i.id');var _0x5e28f2={'type':db[_0xbd2a('0x8b')][_0xbd2a('0x8c')][_0xbd2a('0x8d')],'raw':!![]};var _0x3df0da=_0x10654d[_0xbd2a('0x8e')]();_0x3df0da[_0xbd2a('0x50')]('i.id');_0x3df0da[_0xbd2a('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbd2a('0x68'));if(_0x38fbd1[_0xbd2a('0x4b')]){_0x38fbd1[_0xbd2a('0x4b')][_0xbd2a('0x35')](function(_0x59f68f){var _0x36cb87=_0x59f68f[0x0]===_0xbd2a('0x8f')?_0x59f68f[0x0]:'i.'+_0x59f68f[0x0];_0x10654d[_0xbd2a('0x4b')](_0x36cb87,_0x59f68f[0x1]===_0xbd2a('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x37afce)){_0x10654d['having'](_0x18392e);_0x3df0da[_0xbd2a('0x4d')](_0xbd2a('0x91'),_0x37afce);}BPromise[_0xbd2a('0x92')]()[_0xbd2a('0x2c')](function(){if(!_0x2bb18e){if(_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x7a')])return;_0x3df0da[_0xbd2a('0x4d')](_0xbd2a('0x93'));_0x10654d[_0xbd2a('0x4d')](_0xbd2a('0x93'));return;}if(_0x3be739[_0xbd2a('0x94')]['role']!==_0xbd2a('0x95'))return;return _0x3be739[_0xbd2a('0x94')][_0xbd2a('0x96')]({'attributes':['id'],'raw':!![]})[_0xbd2a('0x2c')](function(_0x4a0ee2){if(_[_0xbd2a('0x79')](_0x4a0ee2)){_0x3df0da['where'](_0xbd2a('0x97'));_0x10654d[_0xbd2a('0x4d')](_0xbd2a('0x97'));}else{_0x3df0da['where'](_0xbd2a('0x7b'),_['map'](_0x4a0ee2,'id'));_0x10654d[_0xbd2a('0x4d')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x4a0ee2,'id'));}});})[_0xbd2a('0x2c')](function(){if(_0x3be739[_0xbd2a('0x94')]['role']===_0xbd2a('0x95')&&!_0x2bb18e&&!_0x3be739[_0xbd2a('0x44')]['SmsAccountId'])return[];return db[_0xbd2a('0x98')][_0xbd2a('0x44')](_0x3df0da['toString'](),_0x5e28f2);})[_0xbd2a('0x2c')](function(_0x1123c9){_0x28c6b8[_0xbd2a('0x99')]=_0x1123c9[_0xbd2a('0x49')];if(_0x28c6b8[_0xbd2a('0x99')]===0x0)return[];return db[_0xbd2a('0x98')][_0xbd2a('0x44')](_0x1ea570[_0xbd2a('0x9a')](),_0x5e28f2)['then'](function(_0x41c949){_0x5b4007=_[_0xbd2a('0x9b')](_0x41c949,'id');_0x5e28f2=_['merge'](_0x5e28f2,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3be739[_0xbd2a('0x44')][_0xbd2a('0x48')]){_0x38fbd1['attributes'][_0xbd2a('0x35')](function(_0xd362f9){_0x10654d[_0xbd2a('0x50')]('i.'+_0xd362f9);});}else{_0x10654d[_0xbd2a('0x50')](_0xbd2a('0x9c'),_0xbd2a('0x68'));_0x10654d[_0xbd2a('0x50')](_0xbd2a('0x9d'),_0xbd2a('0x9e'));_0x10654d[_0xbd2a('0x50')](_0xbd2a('0x9f'),'Account.mandatoryDisposition');_0x10654d[_0xbd2a('0x50')](_0xbd2a('0xa0'),_0xbd2a('0x8f'));_0x10654d[_0xbd2a('0x50')](_0xbd2a('0xa1'));_0x10654d['field']('c.firstName',_0xbd2a('0xa2'));_0x10654d[_0xbd2a('0x50')](_0xbd2a('0xa3'),'Contact.lastName');_0x10654d[_0xbd2a('0x50')](_0xbd2a('0xa4'),'Contact.email');_0x10654d[_0xbd2a('0x50')]('c.phone',_0xbd2a('0xa5'));_0x10654d[_0xbd2a('0x50')](_0xbd2a('0xa6'),_0xbd2a('0xa7'));_0x10654d[_0xbd2a('0x50')](_0xbd2a('0xa8'),_0xbd2a('0xa9'));_0x10654d[_0xbd2a('0x50')]('o.fullname',_0xbd2a('0xaa'));_0x10654d['field'](_0xbd2a('0xab'),_0xbd2a('0xac'));_0x10654d[_0xbd2a('0x50')](_0xbd2a('0xad'),_0xbd2a('0x32'));}if(_0x38fbd1['limit'])_0x10654d[_0xbd2a('0x27')](_0x38fbd1[_0xbd2a('0x27')]);if(_0x38fbd1[_0xbd2a('0x25')])_0x10654d[_0xbd2a('0x25')](_0x38fbd1['offset']);return db['sequelize'][_0xbd2a('0x44')](_0x10654d[_0xbd2a('0x9a')](),_0x5e28f2);})[_0xbd2a('0x2c')](function(_0x66c297){if(_0x66c297[_0xbd2a('0x49')]>0x0)_0x27ddc5['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xbd2a('0x31')](_0x66c297,'id'));return db[_0xbd2a('0x98')][_0xbd2a('0x44')](_0x27ddc5['toString'](),_0x5e28f2)['then'](function(_0x4e766f){var _0x5ef442=_[_0xbd2a('0xae')](_0x4e766f,'SmsInteractionId');var _0x527d11=[];_0x66c297[_0xbd2a('0x35')](function(_0x578349){_0x527d11[_0xbd2a('0x36')](updateSmsInteraction(_0x578349,_0x5b4007,_0x5ef442));});return BPromise[_0xbd2a('0xaf')](_0x527d11);});});})[_0xbd2a('0x2c')](function(_0x3f67ca){_0x28c6b8[_0xbd2a('0xb0')]=_0x3f67ca;return _0x28c6b8;})[_0xbd2a('0x2c')](respondWithFilteredResult(_0x4fc510,_0x38fbd1))[_0xbd2a('0x37')](handleError(_0x4fc510,null));};exports[_0xbd2a('0xb1')]=function(_0x8bb114,_0x59f936){var _0x2ebf92={'raw':![],'where':{'id':_0x8bb114['params']['id']}},_0x176fe2={};_0x176fe2['model']=_['keys'](db[_0xbd2a('0x3f')][_0xbd2a('0x40')]);_0x176fe2[_0xbd2a('0x44')]=_[_0xbd2a('0x45')](_0x8bb114['query']);_0x176fe2[_0xbd2a('0x46')]=_[_0xbd2a('0xb2')](_0x176fe2[_0xbd2a('0x43')],_0x176fe2[_0xbd2a('0x44')]);_0x2ebf92[_0xbd2a('0x47')]=_[_0xbd2a('0xb2')](_0x176fe2['model'],qs[_0xbd2a('0x48')](_0x8bb114[_0xbd2a('0x44')][_0xbd2a('0x48')]));_0x2ebf92[_0xbd2a('0x47')]=_0x2ebf92['attributes'][_0xbd2a('0x49')]?_0x2ebf92[_0xbd2a('0x47')]:_0x176fe2[_0xbd2a('0x43')];if(_0x8bb114[_0xbd2a('0x44')][_0xbd2a('0xb3')]){_0x2ebf92[_0xbd2a('0xb4')]=[{'all':!![]}];}_0x2ebf92=_['merge']({},_0x2ebf92,_0x8bb114[_0xbd2a('0xb5')]);return db['SmsInteraction'][_0xbd2a('0x67')](_0x2ebf92)[_0xbd2a('0x2c')](handleEntityNotFound(_0x59f936,null))[_0xbd2a('0x2c')](respondWithResult(_0x59f936,null))['catch'](handleError(_0x59f936,null));};exports[_0xbd2a('0xb6')]=function(_0x158356,_0x308147){return db[_0xbd2a('0x3f')][_0xbd2a('0xb6')](_0x158356[_0xbd2a('0x76')],{})[_0xbd2a('0x2c')](respondWithResult(_0x308147,0xc9))[_0xbd2a('0x37')](handleError(_0x308147,null));};exports[_0xbd2a('0xb7')]=function(_0x19a328,_0x2598f5){if(_0x19a328['body']['id']){delete _0x19a328['body']['id'];}return db[_0xbd2a('0x3f')][_0xbd2a('0x67')]({'where':{'id':_0x19a328['params']['id']}})[_0xbd2a('0x2c')](handleEntityNotFound(_0x2598f5,null))['then'](saveUpdates(_0x19a328[_0xbd2a('0x76')],null))[_0xbd2a('0x2c')](respondWithResult(_0x2598f5,null))['catch'](handleError(_0x2598f5,null));};exports[_0xbd2a('0x2d')]=function(_0x4c7052,_0x3bf630){return db[_0xbd2a('0x3f')]['find']({'where':{'id':_0x4c7052[_0xbd2a('0xb8')]['id']}})[_0xbd2a('0x2c')](handleEntityNotFound(_0x3bf630,null))[_0xbd2a('0x2c')](removeEntity(_0x3bf630,null))[_0xbd2a('0x37')](handleError(_0x3bf630,null));};exports['describe']=function(_0x1736cc,_0x25cb97){return db['SmsInteraction'][_0xbd2a('0xb9')]()[_0xbd2a('0x2c')](respondWithResult(_0x25cb97,null))[_0xbd2a('0x37')](handleError(_0x25cb97,null));};exports[_0xbd2a('0xba')]=function(_0x56134e,_0x358a13,_0x594452){return db[_0xbd2a('0xbb')][_0xbd2a('0x67')]({'where':{'id':_0x56134e[_0xbd2a('0xb8')]['id']}})[_0xbd2a('0x2c')](handleEntityNotFound(_0x358a13,null))[_0xbd2a('0x2c')](function(_0x5c5144){if(_0x5c5144){return _0x5c5144['addMessage'](_0x56134e['body'][_0xbd2a('0xbc')],_['omit'](_0x56134e[_0xbd2a('0x76')],[_0xbd2a('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x358a13,null))[_0xbd2a('0x37')](handleError(_0x358a13,null));};exports['getMessages']=function(_0x83f8ce,_0x2a0426,_0x1eb8c0){var _0x4157a0={'raw':![],'where':{}};var _0x4abaf6={};var _0x112719={'count':0x0,'rows':[]};return db[_0xbd2a('0x3f')][_0xbd2a('0xbd')]({'where':{'id':_0x83f8ce['params']['id']}})[_0xbd2a('0x2c')](handleEntityNotFound(_0x2a0426,null))[_0xbd2a('0x2c')](function(_0x107d9c){if(_0x107d9c){_0x4abaf6[_0xbd2a('0x43')]=_['keys'](db['SmsMessage'][_0xbd2a('0x40')]);_0x4abaf6[_0xbd2a('0x44')]=_['keys'](_0x83f8ce['query']);_0x4abaf6['filters']=_['intersection'](_0x4abaf6[_0xbd2a('0x43')],_0x4abaf6[_0xbd2a('0x44')]);_0x4157a0['attributes']=_['intersection'](_0x4abaf6[_0xbd2a('0x43')],qs[_0xbd2a('0x48')](_0x83f8ce[_0xbd2a('0x44')][_0xbd2a('0x48')]));_0x4157a0[_0xbd2a('0x47')]=_0x4157a0['attributes'][_0xbd2a('0x49')]?_0x4157a0[_0xbd2a('0x47')]:_0x4abaf6['model'];if(!_0x83f8ce[_0xbd2a('0x44')][_0xbd2a('0xbe')](_0xbd2a('0x4a'))){_0x4157a0[_0xbd2a('0x27')]=qs[_0xbd2a('0x27')](_0x83f8ce['query'][_0xbd2a('0x27')]);_0x4157a0[_0xbd2a('0x25')]=qs[_0xbd2a('0x25')](_0x83f8ce['query'][_0xbd2a('0x25')]);}_0x4157a0[_0xbd2a('0x4b')]=qs['sort'](_0x83f8ce[_0xbd2a('0x44')]['sort']);_0x4157a0[_0xbd2a('0x4d')]=qs[_0xbd2a('0x46')](_[_0xbd2a('0x4e')](_0x83f8ce['query'],_0x4abaf6[_0xbd2a('0x46')]));_0x4157a0['where']['SmsInteractionId']=_0x107d9c['id'];if(_0x83f8ce['query']['filter']){_0x4157a0[_0xbd2a('0x4d')]=_[_0xbd2a('0xbf')](_0x4157a0['where'],{'$or':_[_0xbd2a('0x31')](_0x4157a0[_0xbd2a('0x47')],function(_0xe83452){var _0x2c35d8={};_0x2c35d8[_0xe83452]={'$like':'%'+_0x83f8ce[_0xbd2a('0x44')][_0xbd2a('0x87')]+'%'};return _0x2c35d8;})});}if(_0x83f8ce['query'][_0xbd2a('0x7f')]){var _0x9c2805=_0x83f8ce[_0xbd2a('0x44')]['$gte']['split'](',');var _0x2765cd={};_0x2765cd[_0x9c2805[0x0]]={'$gte':moment(_0x9c2805[0x1])[_0xbd2a('0xc0')](_0xbd2a('0xc1'))};_0x4157a0[_0xbd2a('0x4d')]=_[_0xbd2a('0xbf')](_0x4157a0['where'],_0x2765cd);}_0x4157a0=_['merge']({},_0x4157a0,_0x83f8ce[_0xbd2a('0xb5')]);return db[_0xbd2a('0xbb')][_0xbd2a('0x99')]({'where':_0x4157a0[_0xbd2a('0x4d')]})[_0xbd2a('0x2c')](function(_0x554a84){_0x112719['count']=_0x554a84;if(_0x83f8ce['query'][_0xbd2a('0xb3')]){_0x4157a0['include']=[{'all':!![]}];}return db[_0xbd2a('0xbb')][_0xbd2a('0xc2')](_0x4157a0);})[_0xbd2a('0x2c')](function(_0x2809c2){_0x112719[_0xbd2a('0xb0')]=_0x2809c2;return _0x112719;});}})[_0xbd2a('0x2c')](respondWithFilteredResult(_0x2a0426,_0x4157a0))[_0xbd2a('0x37')](handleError(_0x2a0426,null));};exports[_0xbd2a('0xc3')]=function(_0x161fff,_0xc56a81,_0x455b87){return db[_0xbd2a('0x3f')][_0xbd2a('0x67')]({'where':{'id':_0x161fff[_0xbd2a('0xb8')]['id']}})[_0xbd2a('0x2c')](handleEntityNotFound(_0xc56a81,null))[_0xbd2a('0x2c')](function(_0x10f34f){if(_0x10f34f){return _0x10f34f[_0xbd2a('0xc4')](_0x161fff['body']['ids'],_['omit'](_0x161fff['body'],[_0xbd2a('0xbc'),'id'])||{})[_0xbd2a('0xc5')](function(){return db[_0xbd2a('0x73')]['findAll']({'attributes':['id',_0xbd2a('0x2f'),_0xbd2a('0x51')],'where':{'id':_0x161fff[_0xbd2a('0x76')][_0xbd2a('0xbc')]}});})[_0xbd2a('0x2c')](function(_0x5d7651){socket[_0xbd2a('0xc6')]('smsInteractionTags:save',{'id':Number(_0x161fff[_0xbd2a('0xb8')]['id']),'tags':_0x5d7651||[]});return{'id':Number(_0x161fff[_0xbd2a('0xb8')]['id']),'tags':_0x5d7651||[]};});}})[_0xbd2a('0x2c')](respondWithResult(_0xc56a81,null))[_0xbd2a('0x37')](handleError(_0xc56a81,null));};exports[_0xbd2a('0xc7')]=function(_0x14548f,_0x3e701a,_0x14ab56){return db['SmsInteraction'][_0xbd2a('0x67')]({'where':{'id':_0x14548f[_0xbd2a('0xb8')]['id']}})[_0xbd2a('0x2c')](handleEntityNotFound(_0x3e701a,null))[_0xbd2a('0x2c')](function(_0x319459){if(_0x319459){return _0x319459[_0xbd2a('0xc7')](_0x14548f['query'][_0xbd2a('0xbc')]);}})[_0xbd2a('0x2c')](respondWithStatusCode(_0x3e701a,null))['catch'](handleError(_0x3e701a,null));};exports['download']=function(_0x1e8ff1,_0x1f3b69){var _0x993b45=moment()['unix']()[_0xbd2a('0x9a')]();var _0x36fb84=path[_0xbd2a('0xc8')](config[_0xbd2a('0xc9')],_0xbd2a('0xca'),_0xbd2a('0xcb'),_0xbd2a('0xcc'));var _0x3a4acb=path[_0xbd2a('0xc8')](config[_0xbd2a('0xc9')],_0xbd2a('0xca'),_0xbd2a('0xcb'),_0xbd2a('0xcd'));var _0x28ae2e=path[_0xbd2a('0xc8')](_0x36fb84,_0x993b45);var _0x33b153=util[_0xbd2a('0xc0')](_0xbd2a('0xce'),_0x1e8ff1[_0xbd2a('0xb8')]['id'],_0x993b45);var _0x27c897=path[_0xbd2a('0xc8')](_0x36fb84,_0x33b153);var _0x327ed6=[];_0x327ed6['push']({'model':db[_0xbd2a('0xcf')],'as':_0xbd2a('0xcf'),'attributes':['id',_0xbd2a('0xd0')],'raw':!![]});_0x327ed6[_0xbd2a('0x36')]({'model':db[_0xbd2a('0xd1')],'as':_0xbd2a('0x6c'),'attributes':['id',_0xbd2a('0xd2'),_0xbd2a('0xd3')],'raw':!![]});var _0x4335fc=[{'model':db[_0xbd2a('0xbb')],'as':_0xbd2a('0xd4'),'attributes':['id','body','createdAt','direction',_0xbd2a('0xd5'),'read'],'include':_0x327ed6}];_0x4335fc[_0xbd2a('0x36')]({'model':db[_0xbd2a('0xd6')],'as':_0xbd2a('0xd7'),'attributes':['id',_0xbd2a('0x2f')]});_0x4335fc['push']({'model':db[_0xbd2a('0xcf')],'as':'Owner','attributes':['id',_0xbd2a('0xd0')]});return db[_0xbd2a('0x3f')][_0xbd2a('0x67')]({'where':{'id':_0x1e8ff1[_0xbd2a('0xb8')]['id']},'include':_0x4335fc})[_0xbd2a('0x2c')](handleEntityNotFound(_0x1f3b69,null))[_0xbd2a('0x2c')](function(_0x434b19){if(_0x434b19){var _0x1f9f4d=_0x434b19[_0xbd2a('0xd8')]({'plain':!![]});fs[_0xbd2a('0xd9')](_0x28ae2e);var _0x47721b={'channel':_0xbd2a('0xda'),'account':_0x1f9f4d['Account'][_0xbd2a('0x2f')],'agent':_0x1f9f4d[_0xbd2a('0xdb')]?_0x1f9f4d['Owner']['fullname']:_0xbd2a('0xdc'),'createdAt':moment(_0x1f9f4d[_0xbd2a('0x7d')])[_0xbd2a('0xc0')](_0xbd2a('0xc1'))[_0xbd2a('0x9a')](),'closedAt':_0x1f9f4d[_0xbd2a('0x3e')]?moment(_0x1f9f4d[_0xbd2a('0xdd')])[_0xbd2a('0xc0')](_0xbd2a('0xc1'))['toString']():'','disposition':_0x1f9f4d[_0xbd2a('0xde')],'messages':_(_0x1f9f4d['Messages'])[_0xbd2a('0x87')]({'secret':![]})[_0xbd2a('0x31')](function(_0x720ba9){return{'date':moment(_0x720ba9[_0xbd2a('0x7d')])[_0xbd2a('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbd2a('0x9a')](),'sender':_0x720ba9[_0xbd2a('0xdf')]===_0xbd2a('0xe0')?_0x720ba9['User']?_0x720ba9['User'][_0xbd2a('0xd0')]:_0xbd2a('0xe1'):_0x720ba9[_0xbd2a('0x6c')]['firstName']+(_0x720ba9['Contact'][_0xbd2a('0xd3')]?'\x20'+_0x720ba9[_0xbd2a('0x6c')][_0xbd2a('0xd3')]:''),'body':_0x720ba9[_0xbd2a('0x76')],'direction':_0x720ba9[_0xbd2a('0xdf')]===_0xbd2a('0xe0')?'A':'C','secret':_0x720ba9[_0xbd2a('0xd5')],'read':_0x720ba9['read']};})['value']()};return ejs[_0xbd2a('0xe2')](path['join'](config[_0xbd2a('0xc9')],_0xbd2a('0xca'),_0xbd2a('0xe3'),_0xbd2a('0xe4')),{'interaction':_0x47721b})[_0xbd2a('0x2c')](function(_0x2144e8){var _0x101030=path[_0xbd2a('0xc8')](_0x28ae2e,_0xbd2a('0xe5')+_0x1f9f4d['id']+'-'+_0x993b45+'.pdf');var _0x45185c={'path':_0x101030,'channel':_0xbd2a('0xda'),'interactionId':_0x1f9f4d['id']};return pdf[_0xbd2a('0xe6')](_0x2144e8,_0x45185c);})[_0xbd2a('0x2c')](function(){return new BPromise(function(_0x5a92ff,_0x26c410){zipdir(_0x28ae2e,{'saveTo':_0x27c897},function(_0x4b5cca,_0x3e7bd2){if(_0x4b5cca)return _0x26c410(_0x4b5cca);return _0x5a92ff(_0x3e7bd2);});})[_0xbd2a('0x2c')](function(){return new BPromise(function(_0x43cd26,_0x39f341){rimraf(_0x28ae2e,function(_0x7fb190){if(_0x7fb190)_0x39f341(_0x7fb190);return _0x43cd26();});});})['then'](function(){return _0x1f3b69[_0xbd2a('0xe7')](_0x27c897,_0x33b153,function(_0x502e16){if(_0x502e16){console[_0xbd2a('0xe8')]('err',_0x502e16);}else{fs[_0xbd2a('0xe9')](_0x27c897);}});});});}else{return _0x1f3b69[_0xbd2a('0x21')](0xc8);}})[_0xbd2a('0x37')](handleError(_0x1f3b69,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 429517a..c582ba3 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 _0x8952=['Users','map','findAll','unreadMessages','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x4b26b9,_0x18f82a){var _0x5c173e=function(_0x1d0633){while(--_0x1d0633){_0x4b26b9['push'](_0x4b26b9['shift']());}};_0x5c173e(++_0x18f82a);}(_0x8952,0x17e));var _0x2895=function(_0x337e6a,_0x372d65){_0x337e6a=_0x337e6a-0x0;var _0x485845=_0x8952[_0x337e6a];return _0x485845;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2895('0x0'))['db'][_0x2895('0x1')];var SmsMessage=require(_0x2895('0x0'))['db'][_0x2895('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2895('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2895('0x4'),'afterDestroy':_0x2895('0x5')};function emitEvent(_0x1f69f6){return function(_0x5b28c6,_0x32429c,_0x73c245){_0x5b28c6[_0x2895('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x526c32){_0x5b28c6[_0x2895('0x7')](_0x2895('0x8'),_0x526c32[_0x2895('0x9')](function(_0x294446){return{'id':_0x294446['id']};}));return SmsMessage[_0x2895('0xa')]({'where':{'SmsInteractionId':_0x5b28c6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x14fb67){_0x5b28c6['setDataValue'](_0x2895('0xb'),_0x14fb67['length']);SmsInteractionEvents['emit'](_0x1f69f6+':'+_0x5b28c6['id'],_0x5b28c6);SmsInteractionEvents['emit'](_0x1f69f6,_0x5b28c6);_0x73c245(null);})[_0x2895('0xc')](_0x73c245(null));};}for(var e in events){if(events[_0x2895('0xd')](e)){var event=events[e];SmsInteraction[_0x2895('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x236c=['length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','unreadMessages'];(function(_0x5a388a,_0x51b003){var _0x2f0b41=function(_0x4c8324){while(--_0x4c8324){_0x5a388a['push'](_0x5a388a['shift']());}};_0x2f0b41(++_0x51b003);}(_0x236c,0x155));var _0xc236=function(_0x3de28b,_0x5c791d){_0x3de28b=_0x3de28b-0x0;var _0x5a923d=_0x236c[_0x3de28b];return _0x5a923d;};'use strict';var EventEmitter=require(_0xc236('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xc236('0x1')];var SmsMessage=require(_0xc236('0x2'))['db'][_0xc236('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc236('0x4')](0x0);var events={'afterCreate':_0xc236('0x5'),'afterUpdate':'update','afterDestroy':_0xc236('0x6')};function emitEvent(_0x36e87d){return function(_0x33bc57,_0xd582f6,_0x23d3cc){_0x33bc57[_0xc236('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd612c6){_0x33bc57[_0xc236('0x8')]('Users',_0xd612c6['map'](function(_0x5cdee5){return{'id':_0x5cdee5['id']};}));return SmsMessage[_0xc236('0x9')]({'where':{'SmsInteractionId':_0x33bc57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a28d){_0x33bc57[_0xc236('0x8')](_0xc236('0xa'),_0x30a28d[_0xc236('0xb')]);SmsInteractionEvents[_0xc236('0xc')](_0x36e87d+':'+_0x33bc57['id'],_0x33bc57);SmsInteractionEvents['emit'](_0x36e87d,_0x33bc57);_0x23d3cc(null);})[_0xc236('0xd')](_0x23d3cc(null));};}for(var e in events){if(events[_0xc236('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc236('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6afa44b..8cb2dfc 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 _0x3ebc=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','path','rimraf','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x3ebc,0xf6));var _0xc3eb=function(_0x432ef8,_0x37fecc){_0x432ef8=_0x432ef8-0x0;var _0x2bf89f=_0x3ebc[_0x432ef8];return _0x2bf89f;};'use strict';var _=require('lodash');var util=require(_0xc3eb('0x0'));var logger=require(_0xc3eb('0x1'))(_0xc3eb('0x2'));var moment=require(_0xc3eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3eb('0x4'));var rimraf=require(_0xc3eb('0x5'));var config=require('../../config/environment');var attributes=require(_0xc3eb('0x6'));module[_0xc3eb('0x7')]=function(_0x375678,_0x4aa6ff){return _0x375678['define'](_0xc3eb('0x8'),attributes,{'tableName':_0xc3eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x220943,_0x51df67,_0x3f4008){if(_0x220943[_0xc3eb('0xa')](_0xc3eb('0xb'))){_0x220943[_0xc3eb('0xc')]=moment()[_0xc3eb('0xd')](_0xc3eb('0xe'));}_0x3f4008(null,_0x220943);}}});}; \ No newline at end of file +var _0x66bb=['sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SmsInteraction'];(function(_0x1ef671,_0x5cc1e9){var _0x43674a=function(_0x4b44f8){while(--_0x4b44f8){_0x1ef671['push'](_0x1ef671['shift']());}};_0x43674a(++_0x5cc1e9);}(_0x66bb,0x1a9));var _0xb66b=function(_0x2ca300,_0x22e382){_0x2ca300=_0x2ca300-0x0;var _0x483de5=_0x66bb[_0x2ca300];return _0x483de5;};'use strict';var _=require('lodash');var util=require(_0xb66b('0x0'));var logger=require(_0xb66b('0x1'))(_0xb66b('0x2'));var moment=require(_0xb66b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb66b('0x4'));var fs=require('fs');var path=require(_0xb66b('0x5'));var rimraf=require(_0xb66b('0x6'));var config=require(_0xb66b('0x7'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x2c1bf7,_0x42468a){return _0x2c1bf7[_0xb66b('0x8')](_0xb66b('0x9'),attributes,{'tableName':_0xb66b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b3b34,_0x30a292,_0x304e89){if(_0x3b3b34[_0xb66b('0xb')](_0xb66b('0xc'))){_0x3b3b34[_0xb66b('0xd')]=moment()['format'](_0xb66b('0xe'));}_0x304e89(null,_0x3b3b34);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 03ee5d8..b23ebc6 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 _0x0bd7=['../../config/environment','jayson/promise','client','redis','defaults','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','limit','AddTagsToSmsInteraction','find','where','body','ids','AddTags','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2587b7,_0xc2d056){var _0x480053=function(_0x30832c){while(--_0x30832c){_0x2587b7['push'](_0x2587b7['shift']());}};_0x480053(++_0xc2d056);}(_0x0bd7,0xc0));var _0x70bd=function(_0x4a4c78,_0x13d5b7){_0x4a4c78=_0x4a4c78-0x0;var _0xd58f32=_0x0bd7[_0x4a4c78];return _0xd58f32;};'use strict';var _=require(_0x70bd('0x0'));var util=require('util');var moment=require(_0x70bd('0x1'));var BPromise=require('bluebird');var rs=require(_0x70bd('0x2'));var fs=require('fs');var Redis=require(_0x70bd('0x3'));var db=require(_0x70bd('0x4'))['db'];var utils=require(_0x70bd('0x5'));var logger=require(_0x70bd('0x6'))(_0x70bd('0x7'));var config=require(_0x70bd('0x8'));var jayson=require(_0x70bd('0x9'));var client=jayson[_0x70bd('0xa')]['http']({'port':0x232a});config[_0x70bd('0xb')]=_[_0x70bd('0xc')](config[_0x70bd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70bd('0xb')]));require('./smsInteraction.socket')[_0x70bd('0xd')](socket);function respondWithRpcPromise(_0x70f393,_0x113c6e,_0x4eb1e5){return new BPromise(function(_0x33cf42,_0xa2c47b){return client[_0x70bd('0xe')](_0x70f393,_0x4eb1e5)[_0x70bd('0xf')](function(_0x1b87d1){logger[_0x70bd('0x10')](_0x70bd('0x11'),_0x113c6e,_0x70bd('0x12'));logger[_0x70bd('0x13')](_0x70bd('0x14'),_0x113c6e,_0x70bd('0x12'),JSON['stringify'](_0x1b87d1));if(_0x1b87d1[_0x70bd('0x15')]){if(_0x1b87d1[_0x70bd('0x15')][_0x70bd('0x16')]===0x1f4){logger[_0x70bd('0x15')](_0x70bd('0x11'),_0x113c6e,_0x1b87d1[_0x70bd('0x15')][_0x70bd('0x17')]);return _0xa2c47b(_0x1b87d1[_0x70bd('0x15')]['message']);}logger['error'](_0x70bd('0x11'),_0x113c6e,_0x1b87d1[_0x70bd('0x15')]['message']);return _0x33cf42(_0x1b87d1[_0x70bd('0x15')][_0x70bd('0x17')]);}else{logger['info'](_0x70bd('0x11'),_0x113c6e,_0x70bd('0x12'));_0x33cf42(_0x1b87d1[_0x70bd('0x18')][_0x70bd('0x17')]);}})[_0x70bd('0x19')](function(_0x133e60){logger[_0x70bd('0x15')](_0x70bd('0x11'),_0x113c6e,_0x133e60);_0xa2c47b(_0x133e60);});});}exports[_0x70bd('0x1a')]=function(_0x206f20){var _0x48ae22=this;return new Promise(function(_0x4bc60b,_0x1651b5){return db[_0x70bd('0x1b')][_0x70bd('0x1c')](_0x206f20['body'],{'raw':_0x206f20[_0x70bd('0x1d')]?_0x206f20[_0x70bd('0x1d')][_0x70bd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x206f20[_0x70bd('0x1d')]?_0x206f20['options']['where']||null:null,'attributes':_0x206f20[_0x70bd('0x1d')]?_0x206f20['options'][_0x70bd('0x1f')]||null:null,'limit':_0x206f20[_0x70bd('0x1d')]?_0x206f20['options'][_0x70bd('0x20')]||null:null})[_0x70bd('0xf')](function(_0x4c84a6){logger[_0x70bd('0x10')](_0x70bd('0x1a'),_0x206f20);logger[_0x70bd('0x13')]('UpdateSmsInteraction',_0x206f20,JSON['stringify'](_0x4c84a6));_0x4bc60b(_0x4c84a6);})['catch'](function(_0xe564f9){logger[_0x70bd('0x15')](_0x70bd('0x1a'),_0xe564f9['message'],_0x206f20);_0x1651b5(_0x48ae22['error'](0x1f4,_0xe564f9[_0x70bd('0x17')]));});});};exports[_0x70bd('0x21')]=function(_0xf7b773){return new Promise(function(_0x35daeb,_0x18ef27){return db[_0x70bd('0x1b')][_0x70bd('0x22')]({'where':_0xf7b773[_0x70bd('0x1d')]?_0xf7b773['options'][_0x70bd('0x23')]||null:null})[_0x70bd('0xf')](function(_0x1b38d6){if(_0x1b38d6){return _0x1b38d6['addTags'](_0xf7b773[_0x70bd('0x24')]['ids'],_['omit'](_0xf7b773[_0x70bd('0x24')],[_0x70bd('0x25'),'id'])||{});}})['spread'](function(_0x7bad66){logger[_0x70bd('0x10')](_0x70bd('0x26'),_0xf7b773);logger[_0x70bd('0x13')](_0x70bd('0x26'),_0xf7b773,JSON[_0x70bd('0x27')](_0x7bad66));_0x35daeb(_0x7bad66);})[_0x70bd('0x19')](function(_0x5409fe){logger[_0x70bd('0x15')](_0x70bd('0x26'),_0x5409fe['message'],_0xf7b773);_0x18ef27(_this[_0x70bd('0x15')](0x1f4,_0x5409fe[_0x70bd('0x17')]));});});}; \ No newline at end of file +var _0xdde6=['localhost','socket.io-emitter','./smsInteraction.socket','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateSmsInteraction','body','options','limit','AddTagsToSmsInteraction','SmsInteraction','find','then','addTags','ids','omit','spread','AddTags','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis'];(function(_0x552df3,_0x5a52df){var _0x50decd=function(_0x4f0b7f){while(--_0x4f0b7f){_0x552df3['push'](_0x552df3['shift']());}};_0x50decd(++_0x5a52df);}(_0xdde6,0xab));var _0x6dde=function(_0x41f735,_0x3d9faf){_0x41f735=_0x41f735-0x0;var _0x4abbc4=_0xdde6[_0x41f735];return _0x4abbc4;};'use strict';var _=require('lodash');var util=require(_0x6dde('0x0'));var moment=require(_0x6dde('0x1'));var BPromise=require('bluebird');var rs=require(_0x6dde('0x2'));var fs=require('fs');var Redis=require(_0x6dde('0x3'));var db=require(_0x6dde('0x4'))['db'];var utils=require(_0x6dde('0x5'));var logger=require(_0x6dde('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6dde('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x6dde('0x8')],{'host':_0x6dde('0x9'),'port':0x18eb});var socket=require(_0x6dde('0xa'))(new Redis(config[_0x6dde('0x8')]));require(_0x6dde('0xb'))['register'](socket);function respondWithRpcPromise(_0xda56d2,_0x6b14b2,_0x454280){return new BPromise(function(_0x49af4c,_0x4e901f){return client['request'](_0xda56d2,_0x454280)['then'](function(_0x44874c){logger['info'](_0x6dde('0xc'),_0x6b14b2,'request\x20sent');logger[_0x6dde('0xd')](_0x6dde('0xe'),_0x6b14b2,_0x6dde('0xf'),JSON['stringify'](_0x44874c));if(_0x44874c[_0x6dde('0x10')]){if(_0x44874c[_0x6dde('0x10')][_0x6dde('0x11')]===0x1f4){logger[_0x6dde('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x6b14b2,_0x44874c['error'][_0x6dde('0x12')]);return _0x4e901f(_0x44874c[_0x6dde('0x10')]['message']);}logger[_0x6dde('0x10')](_0x6dde('0xc'),_0x6b14b2,_0x44874c[_0x6dde('0x10')]['message']);return _0x49af4c(_0x44874c[_0x6dde('0x10')][_0x6dde('0x12')]);}else{logger[_0x6dde('0x13')](_0x6dde('0xc'),_0x6b14b2,'request\x20sent');_0x49af4c(_0x44874c[_0x6dde('0x14')][_0x6dde('0x12')]);}})[_0x6dde('0x15')](function(_0x288db7){logger[_0x6dde('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x6b14b2,_0x288db7);_0x4e901f(_0x288db7);});});}exports[_0x6dde('0x16')]=function(_0x296abc){var _0x492d8e=this;return new Promise(function(_0x4cc090,_0x2865ee){return db['SmsInteraction']['update'](_0x296abc[_0x6dde('0x17')],{'raw':_0x296abc[_0x6dde('0x18')]?_0x296abc[_0x6dde('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x296abc['options']?_0x296abc[_0x6dde('0x18')]['where']||null:null,'attributes':_0x296abc['options']?_0x296abc[_0x6dde('0x18')]['attributes']||null:null,'limit':_0x296abc[_0x6dde('0x18')]?_0x296abc[_0x6dde('0x18')][_0x6dde('0x19')]||null:null})['then'](function(_0x39ef9f){logger[_0x6dde('0x13')](_0x6dde('0x16'),_0x296abc);logger[_0x6dde('0xd')](_0x6dde('0x16'),_0x296abc,JSON['stringify'](_0x39ef9f));_0x4cc090(_0x39ef9f);})[_0x6dde('0x15')](function(_0x697da3){logger[_0x6dde('0x10')](_0x6dde('0x16'),_0x697da3['message'],_0x296abc);_0x2865ee(_0x492d8e[_0x6dde('0x10')](0x1f4,_0x697da3[_0x6dde('0x12')]));});});};exports[_0x6dde('0x1a')]=function(_0x45464e){return new Promise(function(_0x2dacdc,_0x4f6737){return db[_0x6dde('0x1b')][_0x6dde('0x1c')]({'where':_0x45464e[_0x6dde('0x18')]?_0x45464e[_0x6dde('0x18')]['where']||null:null})[_0x6dde('0x1d')](function(_0x430a0b){if(_0x430a0b){return _0x430a0b[_0x6dde('0x1e')](_0x45464e['body'][_0x6dde('0x1f')],_[_0x6dde('0x20')](_0x45464e[_0x6dde('0x17')],[_0x6dde('0x1f'),'id'])||{});}})[_0x6dde('0x21')](function(_0x4c113d){logger[_0x6dde('0x13')](_0x6dde('0x22'),_0x45464e);logger['debug'](_0x6dde('0x22'),_0x45464e,JSON[_0x6dde('0x23')](_0x4c113d));_0x2dacdc(_0x4c113d);})[_0x6dde('0x15')](function(_0x23a33e){logger[_0x6dde('0x10')](_0x6dde('0x22'),_0x23a33e['message'],_0x45464e);_0x4f6737(_this[_0x6dde('0x10')](0x1f4,_0x23a33e[_0x6dde('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e03efb2..7414a9d 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 _0x70e5=['emit','register','length','smsInteraction:','./smsInteraction.events','remove'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x70e5,0x15a));var _0x570e=function(_0x18b20e,_0x46903c){_0x18b20e=_0x18b20e-0x0;var _0xadd3a9=_0x70e5[_0x18b20e];return _0xadd3a9;};'use strict';var SmsInteractionEvents=require(_0x570e('0x0'));var events=['save',_0x570e('0x1'),'update'];function createListener(_0x250832,_0x3d0197){return function(_0x49c7cf){_0x3d0197[_0x570e('0x2')](_0x250832,_0x49c7cf);};}function removeListener(_0x5702ab,_0x6ae13b){return function(){SmsInteractionEvents['removeListener'](_0x5702ab,_0x6ae13b);};}exports[_0x570e('0x3')]=function(_0x41b6fb){for(var _0x219a04=0x0,_0x6c1794=events[_0x570e('0x4')];_0x219a04<_0x6c1794;_0x219a04++){var _0x2e9e96=events[_0x219a04];var _0x3d3b8e=createListener(_0x570e('0x5')+_0x2e9e96,_0x41b6fb);SmsInteractionEvents['on'](_0x2e9e96,_0x3d3b8e);}}; \ No newline at end of file +var _0xe598=['save','remove','update','register','smsInteraction:','./smsInteraction.events'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0xe598,0xc5));var _0x8e59=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xe598[_0x3d4ef1];return _0x409423;};'use strict';var SmsInteractionEvents=require(_0x8e59('0x0'));var events=[_0x8e59('0x1'),_0x8e59('0x2'),_0x8e59('0x3')];function createListener(_0x1ec6e0,_0x3fca86){return function(_0x13b9e8){_0x3fca86['emit'](_0x1ec6e0,_0x13b9e8);};}function removeListener(_0x1f1fa8,_0x1b14c6){return function(){SmsInteractionEvents['removeListener'](_0x1f1fa8,_0x1b14c6);};}exports[_0x8e59('0x4')]=function(_0x345a4d){for(var _0x40f81a=0x0,_0x175d51=events['length'];_0x40f81a<_0x175d51;_0x40f81a++){var _0x272f38=events[_0x40f81a];var _0x16c58d=createListener(_0x8e59('0x5')+_0x272f38,_0x345a4d);SmsInteractionEvents['on'](_0x272f38,_0x16c58d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 8027de5..1abce63 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 _0xd80d=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','show','post','tracked','sms','smsmessage:create','create','/:id/status','/:id','update','accept','put','delete'];(function(_0x2c0102,_0x13c812){var _0x215422=function(_0x463fa3){while(--_0x463fa3){_0x2c0102['push'](_0x2c0102['shift']());}};_0x215422(++_0x13c812);}(_0xd80d,0x1c1));var _0xdd80=function(_0x572737,_0x8422db){_0x572737=_0x572737-0x0;var _0x1c1424=_0xd80d[_0x572737];return _0x1c1424;};'use strict';var multer=require(_0xdd80('0x0'));var util=require(_0xdd80('0x1'));var path=require(_0xdd80('0x2'));var timeout=require(_0xdd80('0x3'));var express=require(_0xdd80('0x4'));var router=express[_0xdd80('0x5')]();var fs_extra=require(_0xdd80('0x6'));var auth=require(_0xdd80('0x7'));var interaction=require(_0xdd80('0x8'));var config=require(_0xdd80('0x9'));var controller=require(_0xdd80('0xa'));router[_0xdd80('0xb')]('/',auth['isAuthenticated'](),controller[_0xdd80('0xc')]);router[_0xdd80('0xb')](_0xdd80('0xd'),auth[_0xdd80('0xe')](),controller['describe']);router[_0xdd80('0xb')]('/:id',auth[_0xdd80('0xe')](),controller[_0xdd80('0xf')]);router[_0xdd80('0x10')]('/',auth['isAuthenticated'](),interaction[_0xdd80('0x11')](_0xdd80('0x12'),_0xdd80('0x13')),controller[_0xdd80('0x14')]);router[_0xdd80('0x10')](_0xdd80('0x15'),controller['status']);router['put'](_0xdd80('0x16'),auth[_0xdd80('0xe')](),controller[_0xdd80('0x17')]);router['put']('/:id/accept',auth[_0xdd80('0xe')](),controller[_0xdd80('0x18')]);router[_0xdd80('0x19')]('/:id/reject',auth[_0xdd80('0xe')](),controller['reject']);router[_0xdd80('0x1a')](_0xdd80('0x16'),auth['isAuthenticated'](),controller[_0xdd80('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x675e=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','tracked','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete'];(function(_0x152977,_0xfcf9b6){var _0x573c3b=function(_0x3d7415){while(--_0x3d7415){_0x152977['push'](_0x152977['shift']());}};_0x573c3b(++_0xfcf9b6);}(_0x675e,0x18a));var _0xe675=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x675e[_0x212a37];return _0x5d0bf9;};'use strict';var multer=require('multer');var util=require(_0xe675('0x0'));var path=require(_0xe675('0x1'));var timeout=require(_0xe675('0x2'));var express=require(_0xe675('0x3'));var router=express['Router']();var fs_extra=require(_0xe675('0x4'));var auth=require(_0xe675('0x5'));var interaction=require(_0xe675('0x6'));var config=require(_0xe675('0x7'));var controller=require(_0xe675('0x8'));router['get']('/',auth[_0xe675('0x9')](),controller[_0xe675('0xa')]);router[_0xe675('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xe675('0xc')]);router[_0xe675('0xb')](_0xe675('0xd'),auth[_0xe675('0x9')](),controller[_0xe675('0xe')]);router[_0xe675('0xf')]('/',auth[_0xe675('0x9')](),interaction[_0xe675('0x10')]('sms','smsmessage:create'),controller[_0xe675('0x11')]);router[_0xe675('0xf')](_0xe675('0x12'),controller[_0xe675('0x13')]);router[_0xe675('0x14')](_0xe675('0xd'),auth['isAuthenticated'](),controller[_0xe675('0x15')]);router[_0xe675('0x14')](_0xe675('0x16'),auth['isAuthenticated'](),controller[_0xe675('0x17')]);router[_0xe675('0x14')](_0xe675('0x18'),auth[_0xe675('0x9')](),controller['reject']);router[_0xe675('0x19')](_0xe675('0xd'),auth[_0xe675('0x9')](),controller[_0xe675('0x1a')]);module[_0xe675('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 0f3c013..e2f20a1 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 _0xbf3c=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbf3c,0x163));var _0xcbf3=function(_0x5f1da7,_0x4dd337){_0x5f1da7=_0x5f1da7-0x0;var _0x4bdc02=_0xbf3c[_0x5f1da7];return _0x4bdc02;};'use strict';var Sequelize=require(_0xcbf3('0x0'));module['exports']={'body':{'type':Sequelize[_0xcbf3('0x1')](_0xcbf3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcbf3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcbf3('0x4')]('in',_0xcbf3('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xcbf3('0x6')](0xbe)},'phone':{'type':Sequelize[_0xcbf3('0x6')]},'readAt':{'type':Sequelize[_0xcbf3('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcbf3('0x6')]},'providerResponse':{'type':Sequelize[_0xcbf3('0x1')]}}; \ No newline at end of file +var _0x9bcc=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0xc94a58,_0x2adba5){var _0x29edce=function(_0x5083b5){while(--_0x5083b5){_0xc94a58['push'](_0xc94a58['shift']());}};_0x29edce(++_0x2adba5);}(_0x9bcc,0x1b7));var _0xc9bc=function(_0x4cb0f8,_0x326bb1){_0x4cb0f8=_0x4cb0f8-0x0;var _0x8516e3=_0x9bcc[_0x4cb0f8];return _0x8516e3;};'use strict';var Sequelize=require(_0xc9bc('0x0'));module[_0xc9bc('0x1')]={'body':{'type':Sequelize[_0xc9bc('0x2')](_0xc9bc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc9bc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc9bc('0x5')]('in',_0xc9bc('0x6')),'defaultValue':_0xc9bc('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc9bc('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc9bc('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc9bc('0x7')]},'providerResponse':{'type':Sequelize[_0xc9bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0129225..8d7d468 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 _0x084b=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','intersection','find','create','body','sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage','ContactId','SELECT','SIP/%s','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','eml-format','request-promise','moment','mustache','util','path','to-csv','fs-extra','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/environment','../../config/license/util','defaults','socket.io-emitter','redis','jayson/promise','client','http','request','then','info','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x3062b8,_0x5df5ec){var _0x29f781=function(_0x1922ff){while(--_0x1922ff){_0x3062b8['push'](_0x3062b8['shift']());}};_0x29f781(++_0x5df5ec);}(_0x084b,0xd5));var _0xb084=function(_0x1c14e9,_0x219494){_0x1c14e9=_0x1c14e9-0x0;var _0x431536=_0x084b[_0x1c14e9];return _0x431536;};'use strict';var emlformat=require(_0xb084('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb084('0x1'));var moment=require(_0xb084('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb084('0x3'));var util=require(_0xb084('0x4'));var path=require(_0xb084('0x5'));var sox=require('sox');var csv=require(_0xb084('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb084('0x7'));var _=require(_0xb084('0x8'));var squel=require(_0xb084('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb084('0xa'));var toCsv=require(_0xb084('0x6'));var querystring=require(_0xb084('0xb'));var Papa=require(_0xb084('0xc'));var Redis=require(_0xb084('0xd'));var authService=require(_0xb084('0xe'));var qs=require(_0xb084('0xf'));var as=require(_0xb084('0x10'));var hardwareService=require(_0xb084('0x11'));var logger=require(_0xb084('0x12'))(_0xb084('0x13'));var utils=require(_0xb084('0x14'));var config=require(_0xb084('0x15'));var licenseUtil=require(_0xb084('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb084('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb084('0x18'))(new Redis(config[_0xb084('0x19')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xb084('0x1a'));var client=jayson[_0xb084('0x1b')][_0xb084('0x1c')]({'port':0x232c});var client9002=jayson[_0xb084('0x1b')][_0xb084('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5a5d11,_0x240838,_0x357391,_0x17bd4e){return new BPromise(function(_0xbcdb1f,_0x481a00){var _0x2cce88=_0x17bd4e||client;return _0x2cce88[_0xb084('0x1d')](_0x5a5d11,_0x357391)[_0xb084('0x1e')](function(_0x13b3e4){logger[_0xb084('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x240838,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x240838,_0xb084('0x20'),JSON['stringify'](_0x13b3e4));if(_0x13b3e4[_0xb084('0x21')]){if(_0x13b3e4[_0xb084('0x21')][_0xb084('0x22')]===0x1f4){logger[_0xb084('0x21')](_0xb084('0x23'),_0x240838,_0x13b3e4[_0xb084('0x21')][_0xb084('0x24')]);return _0x481a00(_0x13b3e4[_0xb084('0x21')]['message']);}logger['error'](_0xb084('0x23'),_0x240838,_0x13b3e4[_0xb084('0x21')][_0xb084('0x24')]);return _0xbcdb1f(_0x13b3e4[_0xb084('0x21')][_0xb084('0x24')]);}else{logger['info'](_0xb084('0x23'),_0x240838,_0xb084('0x20'));_0xbcdb1f(_0x13b3e4['result'][_0xb084('0x24')]);}})['catch'](function(_0x1f4983){logger[_0xb084('0x21')]('SmsMessage,\x20%s,\x20%s',_0x240838,_0x1f4983);_0x481a00(_0x1f4983);});});}function respondWithStatusCode(_0x18e172,_0x3d467e){_0x3d467e=_0x3d467e||0xcc;return function(_0x1ecb58){if(_0x1ecb58){return _0x18e172['sendStatus'](_0x3d467e);}return _0x18e172[_0xb084('0x25')](_0x3d467e)['end']();};}function respondWithResult(_0x2f26d3,_0x623fe8){_0x623fe8=_0x623fe8||0xc8;return function(_0x54f3a8){if(_0x54f3a8){return _0x2f26d3[_0xb084('0x25')](_0x623fe8)[_0xb084('0x26')](_0x54f3a8);}};}function respondWithFilteredResult(_0x49cbd6,_0x4587e7){return function(_0x1a7726){if(_0x1a7726){var _0x57406f=typeof _0x4587e7[_0xb084('0x27')]===_0xb084('0x28')&&typeof _0x4587e7['limit']===_0xb084('0x28');var _0x1e2662=_0x1a7726[_0xb084('0x29')];var _0x257833=_0x57406f?0x0:_0x4587e7[_0xb084('0x27')];var _0x5afdf1=_0x57406f?_0x1a7726[_0xb084('0x29')]:_0x4587e7[_0xb084('0x27')]+_0x4587e7[_0xb084('0x2a')];var _0x2173da;if(_0x5afdf1>=_0x1e2662){_0x5afdf1=_0x1e2662;_0x2173da=0xc8;}else{_0x2173da=0xce;}_0x49cbd6['status'](_0x2173da);return _0x49cbd6[_0xb084('0x2b')](_0xb084('0x2c'),_0x257833+'-'+_0x5afdf1+'/'+_0x1e2662)[_0xb084('0x26')](_0x1a7726);}return null;};}function patchUpdates(_0x11552c){return function(_0x222098){try{jsonpatch['apply'](_0x222098,_0x11552c,!![]);}catch(_0x5f05bf){return BPromise[_0xb084('0x2d')](_0x5f05bf);}return _0x222098['save']();};}function saveUpdates(_0x45a5c0,_0x5da912){return function(_0x46b887){if(_0x46b887){return _0x46b887[_0xb084('0x2e')](_0x45a5c0)[_0xb084('0x1e')](function(_0x2e09d4){return _0x2e09d4;});}return null;};}function removeEntity(_0x5bba55,_0x3931db){return function(_0x2afc9b){if(_0x2afc9b){return _0x2afc9b[_0xb084('0x2f')]()[_0xb084('0x1e')](function(){_0x5bba55[_0xb084('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x84e9d8,_0xc5900e){return function(_0x4a29d7){if(!_0x4a29d7){_0x84e9d8['sendStatus'](0x194);}return _0x4a29d7;};}function handleError(_0x300383,_0xa34175){_0xa34175=_0xa34175||0x1f4;return function(_0xa55c17){logger[_0xb084('0x21')](_0xa55c17[_0xb084('0x30')]);if(_0xa55c17[_0xb084('0x31')]){delete _0xa55c17[_0xb084('0x31')];}_0x300383[_0xb084('0x25')](_0xa34175)['send'](_0xa55c17);};}exports[_0xb084('0x32')]=function(_0x3da0e9,_0x4d1361){var _0x3d5f37={},_0x4b59ab={},_0xd88374={'count':0x0,'rows':[]};var _0xc5667c=_[_0xb084('0x33')](db[_0xb084('0x34')][_0xb084('0x35')],function(_0x2254a3){return{'name':_0x2254a3[_0xb084('0x36')],'type':_0x2254a3[_0xb084('0x37')][_0xb084('0x38')]};});_0x4b59ab[_0xb084('0x39')]=_[_0xb084('0x33')](_0xc5667c,_0xb084('0x31'));_0x4b59ab[_0xb084('0x3a')]=_[_0xb084('0x3b')](_0x3da0e9[_0xb084('0x3a')]);_0x4b59ab[_0xb084('0x3c')]=_['intersection'](_0x4b59ab['model'],_0x4b59ab[_0xb084('0x3a')]);_0x3d5f37[_0xb084('0x3d')]=_['intersection'](_0x4b59ab['model'],qs[_0xb084('0x3e')](_0x3da0e9[_0xb084('0x3a')][_0xb084('0x3e')]));_0x3d5f37['attributes']=_0x3d5f37[_0xb084('0x3d')][_0xb084('0x3f')]?_0x3d5f37[_0xb084('0x3d')]:_0x4b59ab['model'];if(!_0x3da0e9[_0xb084('0x3a')][_0xb084('0x40')](_0xb084('0x41'))){_0x3d5f37[_0xb084('0x2a')]=qs['limit'](_0x3da0e9[_0xb084('0x3a')][_0xb084('0x2a')]);_0x3d5f37[_0xb084('0x27')]=qs[_0xb084('0x27')](_0x3da0e9['query'][_0xb084('0x27')]);}_0x3d5f37[_0xb084('0x42')]=qs[_0xb084('0x43')](_0x3da0e9[_0xb084('0x3a')][_0xb084('0x43')]);_0x3d5f37[_0xb084('0x44')]=qs[_0xb084('0x3c')](_[_0xb084('0x45')](_0x3da0e9[_0xb084('0x3a')],_0x4b59ab[_0xb084('0x3c')]),_0xc5667c);if(_0x3da0e9[_0xb084('0x3a')][_0xb084('0x46')]){_0x3d5f37[_0xb084('0x44')]=_[_0xb084('0x47')](_0x3d5f37[_0xb084('0x44')],{'$or':_['map'](_0xc5667c,function(_0x2126bc){if(_0x2126bc[_0xb084('0x37')]!==_0xb084('0x48')){var _0x1de1c0={};_0x1de1c0[_0x2126bc[_0xb084('0x31')]]={'$like':'%'+_0x3da0e9[_0xb084('0x3a')]['filter']+'%'};return _0x1de1c0;}})});}_0x3d5f37=_[_0xb084('0x47')]({},_0x3d5f37,_0x3da0e9[_0xb084('0x49')]);var _0x7951d={'where':_0x3d5f37[_0xb084('0x44')]};return db[_0xb084('0x34')][_0xb084('0x29')](_0x7951d)[_0xb084('0x1e')](function(_0x48e48d){_0xd88374[_0xb084('0x29')]=_0x48e48d;if(_0x3da0e9[_0xb084('0x3a')][_0xb084('0x4a')]){_0x3d5f37[_0xb084('0x4b')]=[{'all':!![]}];}return db[_0xb084('0x34')][_0xb084('0x4c')](_0x3d5f37);})[_0xb084('0x1e')](function(_0x461b1f){_0xd88374['rows']=_0x461b1f;return _0xd88374;})[_0xb084('0x1e')](respondWithFilteredResult(_0x4d1361,_0x3d5f37))[_0xb084('0x4d')](handleError(_0x4d1361,null));};exports['show']=function(_0xb45473,_0x40afee){var _0x8d5673={'raw':!![],'where':{'id':_0xb45473[_0xb084('0x4e')]['id']}},_0x3bf880={};_0x3bf880['model']=_[_0xb084('0x3b')](db['SmsMessage'][_0xb084('0x35')]);_0x3bf880[_0xb084('0x3a')]=_[_0xb084('0x3b')](_0xb45473[_0xb084('0x3a')]);_0x3bf880[_0xb084('0x3c')]=_[_0xb084('0x4f')](_0x3bf880[_0xb084('0x39')],_0x3bf880['query']);_0x8d5673['attributes']=_['intersection'](_0x3bf880[_0xb084('0x39')],qs[_0xb084('0x3e')](_0xb45473[_0xb084('0x3a')][_0xb084('0x3e')]));_0x8d5673[_0xb084('0x3d')]=_0x8d5673[_0xb084('0x3d')][_0xb084('0x3f')]?_0x8d5673[_0xb084('0x3d')]:_0x3bf880[_0xb084('0x39')];if(_0xb45473[_0xb084('0x3a')][_0xb084('0x4a')]){_0x8d5673['include']=[{'all':!![]}];}_0x8d5673=_[_0xb084('0x47')]({},_0x8d5673,_0xb45473[_0xb084('0x49')]);return db[_0xb084('0x34')][_0xb084('0x50')](_0x8d5673)[_0xb084('0x1e')](handleEntityNotFound(_0x40afee,null))[_0xb084('0x1e')](respondWithResult(_0x40afee,null))[_0xb084('0x4d')](handleError(_0x40afee,null));};exports[_0xb084('0x51')]=function(_0x5bf706,_0x2ff1b4){return db['SmsMessage']['create'](_0x5bf706[_0xb084('0x52')],{})[_0xb084('0x1e')](respondWithResult(_0x2ff1b4,0xc9))[_0xb084('0x4d')](handleError(_0x2ff1b4,null));};exports[_0xb084('0x2e')]=function(_0x4bee98,_0x2e4833){if(_0x4bee98['body']['id']){delete _0x4bee98[_0xb084('0x52')]['id'];}return db[_0xb084('0x34')][_0xb084('0x50')]({'where':{'id':_0x4bee98['params']['id']}})[_0xb084('0x1e')](handleEntityNotFound(_0x2e4833,null))[_0xb084('0x1e')](saveUpdates(_0x4bee98['body'],null))[_0xb084('0x1e')](respondWithResult(_0x2e4833,null))[_0xb084('0x4d')](handleError(_0x2e4833,null));};exports[_0xb084('0x2f')]=function(_0x193175,_0x7c2302){return db[_0xb084('0x34')]['find']({'where':{'id':_0x193175[_0xb084('0x4e')]['id']}})[_0xb084('0x1e')](handleEntityNotFound(_0x7c2302,null))[_0xb084('0x1e')](removeEntity(_0x7c2302,null))[_0xb084('0x4d')](handleError(_0x7c2302,null));};exports['describe']=function(_0x14aa6e,_0x22d1e0){return db[_0xb084('0x34')]['describe']()[_0xb084('0x1e')](respondWithResult(_0x22d1e0,null))['catch'](handleError(_0x22d1e0,null));};var interaction_log=require(_0xb084('0x12'))(_0xb084('0x53'));exports[_0xb084('0x54')]=function(_0x50bfab,_0x5aee29,_0x34d7da){var _0x4c510b={'agent':{},'channel':_0xb084('0x55')};if(_0x50bfab[_0xb084('0x52')]['id']){delete _0x50bfab[_0xb084('0x52')]['id'];}_0x50bfab[_0xb084('0x52')]['read']=!![];_0x50bfab['body']['readAt']=moment()[_0xb084('0x56')](_0xb084('0x57'));_0x50bfab[_0xb084('0x52')][_0xb084('0x58')]=_0x50bfab[_0xb084('0x52')][_0xb084('0x58')]||_0x50bfab[_0xb084('0x59')]['id'];_0x4c510b['agent']['id']=_0x50bfab[_0xb084('0x52')][_0xb084('0x58')];return db[_0xb084('0x34')][_0xb084('0x50')]({'where':{'id':_0x50bfab[_0xb084('0x4e')]['id'],'UserId':null}})[_0xb084('0x1e')](handleEntityNotFound(_0x5aee29,null))[_0xb084('0x1e')](saveUpdates(_0x50bfab['body'],null))[_0xb084('0x1e')](function(_0xbfde66){if(_0xbfde66){_0x4c510b[_0xb084('0x24')]=_0xbfde66[_0xb084('0x5a')]({'plain':!![]});return db[_0xb084('0x5b')][_0xb084('0x50')]({'where':{'id':_0xbfde66[_0xb084('0x5c')]}});}return null;})[_0xb084('0x1e')](handleEntityNotFound(_0x5aee29,null))['then'](function(_0x20bb4e){if(_0x20bb4e){return _0x20bb4e[_0xb084('0x2e')]({'UserId':_0x50bfab['body'][_0xb084('0x58')],'read1stAt':_[_0xb084('0x5d')](_0x20bb4e['read1stAt'])?moment()['format'](_0xb084('0x57')):undefined});}return null;})[_0xb084('0x1e')](function(_0x5ab790){if(_0x5ab790){_0x4c510b['interaction']=_0x5ab790[_0xb084('0x5a')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x50bfab[_0xb084('0x59')]['id'],_0x50bfab[_0xb084('0x59')][_0xb084('0x31')],_0x50bfab[_0xb084('0x59')][_0xb084('0x5e')],_0x4c510b['interaction']['id'],_0x50bfab[_0xb084('0x52')]?JSON[_0xb084('0x5f')](_0x50bfab[_0xb084('0x52')]):_0xb084('0x60'));return respondWithRpcPromise('AcceptMessage',_0xb084('0x61'),_0x4c510b);}return null;})[_0xb084('0x1e')](function(_0x32ea2c){var _0x332230=_0xb084('0x62')+_0x32ea2c['message']['ContactId'];return db[_0xb084('0x63')][_0xb084('0x3a')](_0x332230,{'type':db[_0xb084('0x64')][_0xb084('0x65')]['SELECT'],'raw':!![]})[_0xb084('0x1e')](function(_0x320fc0){return _0x320fc0;});})[_0xb084('0x1e')](function(_0x162f28){if(_0x162f28){_0x4c510b['message'][_0xb084('0x66')]=_0x162f28[0x0];if(!_0x50bfab[_0xb084('0x52')][_0xb084('0x58')])return;return db[_0xb084('0x67')][_0xb084('0x50')]({'where':{'id':_0x50bfab['body'][_0xb084('0x58')],'role':_0xb084('0x68')},'attributes':['id','name',_0xb084('0x69'),_0xb084('0x6a'),_0xb084('0x6b')],'raw':!![]});}return null;})[_0xb084('0x1e')](function(_0xd1c6a4){if(!_0xd1c6a4)return null;_0x4c510b[_0xb084('0x24')]['agent']=_0xd1c6a4;return _0x4c510b;})[_0xb084('0x1e')](function(_0x28a473){if(_0x28a473){if(_0x50bfab[_0xb084('0x52')][_0xb084('0x6c')]){_0x4c510b['message'][_0xb084('0x6d')]=util[_0xb084('0x56')]('SIP/%s',_0x50bfab[_0xb084('0x59')][_0xb084('0x31')]);_0x4c510b[_0xb084('0x24')][_0xb084('0x6e')]=_0x4c510b[_0xb084('0x6e')];_0x4c510b[_0xb084('0x24')][_0xb084('0x6f')]=_0x4c510b[_0xb084('0x6e')];_0x4c510b[_0xb084('0x24')][_0xb084('0x70')]=_0xb084('0x54');return respondWithRpcPromise(_0xb084('0x71'),_0xb084('0x71'),{'event':_0xb084('0x72'),'message':_0x4c510b[_0xb084('0x24')]},client9002)[_0xb084('0x1e')](function(){return _0x4c510b;});}return _0x4c510b;}return null;})['then'](respondWithResult(_0x5aee29,null))[_0xb084('0x4d')](handleError(_0x5aee29,null));};var interaction_log=require(_0xb084('0x12'))('sms-interactions');exports[_0xb084('0x2d')]=function(_0x3dba8e,_0x9e14ef,_0x204787){var _0xeb243f={'agent':{},'channel':'sms'};if(_0x3dba8e['body']['id']){delete _0x3dba8e[_0xb084('0x52')]['id'];}_0x3dba8e[_0xb084('0x52')][_0xb084('0x58')]=_0x3dba8e[_0xb084('0x52')][_0xb084('0x58')]||_0x3dba8e['user']['id'];_0xeb243f[_0xb084('0x68')]['id']=_0x3dba8e['body'][_0xb084('0x58')];return db[_0xb084('0x34')][_0xb084('0x50')]({'where':{'id':_0x3dba8e['params']['id'],'UserId':null}})[_0xb084('0x1e')](handleEntityNotFound(_0x9e14ef,null))['then'](function(_0x344f84){if(_0x344f84){_0xeb243f[_0xb084('0x24')]=_0x344f84[_0xb084('0x5a')]({'plain':!![]});return db[_0xb084('0x5b')][_0xb084('0x50')]({'where':{'id':_0x344f84[_0xb084('0x5c')]}});}return null;})[_0xb084('0x1e')](handleEntityNotFound(_0x9e14ef,null))['then'](function(_0x23f770){if(_0x23f770){_0xeb243f['interaction']=_0x23f770['get']({'plain':!![]});interaction_log[_0xb084('0x1f')](_0xb084('0x73'),_0x3dba8e['user']['id'],_0x3dba8e[_0xb084('0x59')][_0xb084('0x31')],_0x3dba8e[_0xb084('0x59')][_0xb084('0x5e')],_0xeb243f[_0xb084('0x74')]['id'],_0x3dba8e[_0xb084('0x52')]?JSON[_0xb084('0x5f')](_0x3dba8e[_0xb084('0x52')]):_0xb084('0x60'));return respondWithRpcPromise(_0xb084('0x75'),_0xb084('0x76'),_0xeb243f);}return null;})[_0xb084('0x1e')](function(_0x35885b){var _0x495581=_0xb084('0x62')+_0x35885b['message'][_0xb084('0x77')];return db[_0xb084('0x63')][_0xb084('0x3a')](_0x495581,{'type':db[_0xb084('0x64')][_0xb084('0x65')][_0xb084('0x78')],'raw':!![]})[_0xb084('0x1e')](function(_0xd94984){return _0xd94984;});})[_0xb084('0x1e')](function(_0x1e9eb8){if(_0x1e9eb8){_0xeb243f['message']['contact']=_0x1e9eb8[0x0];if(!_0x3dba8e[_0xb084('0x52')][_0xb084('0x58')])return;return db[_0xb084('0x67')][_0xb084('0x50')]({'where':{'id':_0x3dba8e[_0xb084('0x52')][_0xb084('0x58')],'role':_0xb084('0x68')},'attributes':['id',_0xb084('0x31'),_0xb084('0x69'),'email','internal'],'raw':!![]});}return null;})[_0xb084('0x1e')](function(_0x4ebcf7){if(!_0x4ebcf7)return null;_0xeb243f['message'][_0xb084('0x68')]=_0x4ebcf7;return _0xeb243f;})['then'](function(_0x48d852){if(_0x48d852){_0x48d852[_0xb084('0x24')]['interface']=util['format'](_0xb084('0x79'),_0x3dba8e[_0xb084('0x59')][_0xb084('0x31')]);_0x48d852[_0xb084('0x24')][_0xb084('0x6e')]=_0xeb243f[_0xb084('0x6e')];_0x48d852[_0xb084('0x24')][_0xb084('0x6f')]=_0xeb243f[_0xb084('0x6e')];_0x48d852[_0xb084('0x24')][_0xb084('0x70')]=_0xb084('0x2d');respondWithRpcPromise(_0xb084('0x71'),_0xb084('0x71'),{'event':'rejectmessage','message':_0x48d852[_0xb084('0x24')]},client9002);return _0xeb243f;}return null;})[_0xb084('0x1e')](respondWithResult(_0x9e14ef,null))[_0xb084('0x4d')](handleError(_0x9e14ef,null));};exports[_0xb084('0x25')]=function(_0x3be968,_0x34bd4f,_0x7ca5c){if(_0x3be968[_0xb084('0x52')]['id']){delete _0x3be968[_0xb084('0x52')]['id'];}var _0x1a9787;return db[_0xb084('0x34')][_0xb084('0x50')]({'where':{'id':_0x3be968[_0xb084('0x4e')]['id']}})[_0xb084('0x1e')](handleEntityNotFound(_0x34bd4f,null))[_0xb084('0x1e')](function(_0x9539cd){if(_0x9539cd){_0x1a9787=_0x9539cd;return db[_0xb084('0x7a')]['find']({'where':{'id':_0x9539cd[_0xb084('0x7b')]}});}})[_0xb084('0x1e')](handleEntityNotFound(_0x34bd4f,null))[_0xb084('0x1e')](function(_0x29d9d3){if(_0x29d9d3){logger[_0xb084('0x7c')](_0xb084('0x7d'),_0xb084('0x25'),_0xb084('0x7e'),_0x29d9d3[_0xb084('0x37')],util[_0xb084('0x7f')](_0x3be968[_0xb084('0x52')],{'showHidden':![],'depth':null}));switch(_0x29d9d3[_0xb084('0x37')]){case _0xb084('0x80'):if(_0x3be968[_0xb084('0x52')][_0xb084('0x81')]&&_0x3be968[_0xb084('0x52')][_0xb084('0x81')]===_0x1a9787[_0xb084('0x82')]){return _0x1a9787[_0xb084('0x2e')]({'read':!![]});}else{logger[_0xb084('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0xb084('0x7f')](_0x3be968[_0xb084('0x52')],{'showHidden':![],'depth':null}));}break;case _0xb084('0x83'):if(_0x3be968['body']['MessageUUID']&&_0x3be968['body'][_0xb084('0x84')]===_0x1a9787[_0xb084('0x82')]&&_[_0xb084('0x85')]([_0xb084('0x86'),_0xb084('0x87')],_0x3be968[_0xb084('0x52')][_0xb084('0x88')])>=0x0){return _0x1a9787[_0xb084('0x2e')]({'read':!![]});}else{logger['error'](_0xb084('0x89'),_0xb084('0x25'),'plivio',util[_0xb084('0x7f')](_0x3be968[_0xb084('0x52')],{'showHidden':![],'depth':null}));}break;case _0xb084('0x8a'):var _0x2e6a41=_0x3be968[_0xb084('0x52')][_0xb084('0x8b')][0x0];if(_0x2e6a41[_0xb084('0x25')]['groupName']==='DELIVERED'){return _0x1a9787[_0xb084('0x2e')]({'read':!![]});}else{logger[_0xb084('0x21')](_0xb084('0x89'),_0xb084('0x25'),_0xb084('0x8a'),util['inspect'](_0x3be968[_0xb084('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x1a9787;}})[_0xb084('0x1e')](respondWithResult(_0x34bd4f,null))[_0xb084('0x4d')](handleError(_0x34bd4f,null));}; \ No newline at end of file +var _0x8b29=['QueryTypes','SELECT','User','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','fullname','email','interface','motionChannel','reject','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','groupName','DELIVERED','infobip','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','offset','undefined','count','limit','set','json','destroy','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','nolimit','query','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize'];(function(_0x422967,_0x4c6776){var _0x1d0d83=function(_0x13f5b1){while(--_0x13f5b1){_0x422967['push'](_0x422967['shift']());}};_0x1d0d83(++_0x4c6776);}(_0x8b29,0x14f));var _0x98b2=function(_0x13812f,_0x422b84){_0x13812f=_0x13812f-0x0;var _0x1329a5=_0x8b29[_0x13812f];return _0x1329a5;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x98b2('0x1'));var rp=require(_0x98b2('0x2'));var moment=require(_0x98b2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x98b2('0x4'));var util=require(_0x98b2('0x5'));var path=require(_0x98b2('0x6'));var sox=require('sox');var csv=require(_0x98b2('0x7'));var ejs=require(_0x98b2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98b2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x98b2('0xc'));var Papa=require(_0x98b2('0xd'));var Redis=require(_0x98b2('0xe'));var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98b2('0x11'));var logger=require(_0x98b2('0x12'))('api');var utils=require(_0x98b2('0x13'));var config=require(_0x98b2('0x14'));var licenseUtil=require(_0x98b2('0x15'));var db=require('../../mysqldb')['db'];config[_0x98b2('0x16')]=_[_0x98b2('0x17')](config[_0x98b2('0x16')],{'host':_0x98b2('0x18'),'port':0x18eb});var socket=require(_0x98b2('0x19'))(new Redis(config[_0x98b2('0x16')]));require(_0x98b2('0x1a'))[_0x98b2('0x1b')](socket);var jayson=require(_0x98b2('0x1c'));var client=jayson[_0x98b2('0x1d')][_0x98b2('0x1e')]({'port':0x232c});var client9002=jayson[_0x98b2('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36424b,_0x2bc44f,_0x171628,_0x597362){return new BPromise(function(_0x5786e7,_0x3e2fed){var _0x3352a0=_0x597362||client;return _0x3352a0[_0x98b2('0x1f')](_0x36424b,_0x171628)[_0x98b2('0x20')](function(_0x2302eb){logger[_0x98b2('0x21')](_0x98b2('0x22'),_0x2bc44f,_0x98b2('0x23'));logger[_0x98b2('0x24')](_0x98b2('0x25'),_0x2bc44f,_0x98b2('0x23'),JSON[_0x98b2('0x26')](_0x2302eb));if(_0x2302eb['error']){if(_0x2302eb[_0x98b2('0x27')][_0x98b2('0x28')]===0x1f4){logger[_0x98b2('0x27')](_0x98b2('0x22'),_0x2bc44f,_0x2302eb['error']['message']);return _0x3e2fed(_0x2302eb['error'][_0x98b2('0x29')]);}logger['error'](_0x98b2('0x22'),_0x2bc44f,_0x2302eb[_0x98b2('0x27')][_0x98b2('0x29')]);return _0x5786e7(_0x2302eb[_0x98b2('0x27')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x2bc44f,_0x98b2('0x23'));_0x5786e7(_0x2302eb[_0x98b2('0x2a')][_0x98b2('0x29')]);}})[_0x98b2('0x2b')](function(_0x2c7cea){logger[_0x98b2('0x27')](_0x98b2('0x22'),_0x2bc44f,_0x2c7cea);_0x3e2fed(_0x2c7cea);});});}function respondWithStatusCode(_0x1fc445,_0x1c0bee){_0x1c0bee=_0x1c0bee||0xcc;return function(_0x28e8a7){if(_0x28e8a7){return _0x1fc445['sendStatus'](_0x1c0bee);}return _0x1fc445['status'](_0x1c0bee)[_0x98b2('0x2c')]();};}function respondWithResult(_0x1c9f1d,_0x36fe29){_0x36fe29=_0x36fe29||0xc8;return function(_0x194fd5){if(_0x194fd5){return _0x1c9f1d[_0x98b2('0x2d')](_0x36fe29)['json'](_0x194fd5);}};}function respondWithFilteredResult(_0x48f386,_0xbe755){return function(_0x1eff76){if(_0x1eff76){var _0x2f4565=typeof _0xbe755[_0x98b2('0x2e')]===_0x98b2('0x2f')&&typeof _0xbe755['limit']===_0x98b2('0x2f');var _0x1d6390=_0x1eff76[_0x98b2('0x30')];var _0x49da6f=_0x2f4565?0x0:_0xbe755[_0x98b2('0x2e')];var _0x14ffcd=_0x2f4565?_0x1eff76['count']:_0xbe755['offset']+_0xbe755[_0x98b2('0x31')];var _0xce993b;if(_0x14ffcd>=_0x1d6390){_0x14ffcd=_0x1d6390;_0xce993b=0xc8;}else{_0xce993b=0xce;}_0x48f386[_0x98b2('0x2d')](_0xce993b);return _0x48f386[_0x98b2('0x32')]('Content-Range',_0x49da6f+'-'+_0x14ffcd+'/'+_0x1d6390)[_0x98b2('0x33')](_0x1eff76);}return null;};}function patchUpdates(_0x144a65){return function(_0x492a29){try{jsonpatch['apply'](_0x492a29,_0x144a65,!![]);}catch(_0x1b481e){return BPromise['reject'](_0x1b481e);}return _0x492a29['save']();};}function saveUpdates(_0x57575b,_0x4a3234){return function(_0x2ddffc){if(_0x2ddffc){return _0x2ddffc['update'](_0x57575b)[_0x98b2('0x20')](function(_0x40459e){return _0x40459e;});}return null;};}function removeEntity(_0xf80a2b,_0xba177d){return function(_0x4f2142){if(_0x4f2142){return _0x4f2142[_0x98b2('0x34')]()[_0x98b2('0x20')](function(){_0xf80a2b[_0x98b2('0x2d')](0xcc)[_0x98b2('0x2c')]();});}};}function handleEntityNotFound(_0x141c39,_0x29900a){return function(_0x193ff8){if(!_0x193ff8){_0x141c39[_0x98b2('0x35')](0x194);}return _0x193ff8;};}function handleError(_0x5c4828,_0x1198ed){_0x1198ed=_0x1198ed||0x1f4;return function(_0x2246d4){logger['error'](_0x2246d4[_0x98b2('0x36')]);if(_0x2246d4['name']){delete _0x2246d4[_0x98b2('0x37')];}_0x5c4828[_0x98b2('0x2d')](_0x1198ed)[_0x98b2('0x38')](_0x2246d4);};}exports[_0x98b2('0x39')]=function(_0x53745d,_0x11deac){var _0x362c7c={},_0xbb9582={},_0x5a101f={'count':0x0,'rows':[]};var _0x387748=_[_0x98b2('0x3a')](db[_0x98b2('0x3b')][_0x98b2('0x3c')],function(_0x52023a){return{'name':_0x52023a[_0x98b2('0x3d')],'type':_0x52023a[_0x98b2('0x3e')][_0x98b2('0x3f')]};});_0xbb9582[_0x98b2('0x40')]=_[_0x98b2('0x3a')](_0x387748,'name');_0xbb9582['query']=_[_0x98b2('0x41')](_0x53745d['query']);_0xbb9582[_0x98b2('0x42')]=_[_0x98b2('0x43')](_0xbb9582['model'],_0xbb9582['query']);_0x362c7c[_0x98b2('0x44')]=_[_0x98b2('0x43')](_0xbb9582[_0x98b2('0x40')],qs['fields'](_0x53745d['query'][_0x98b2('0x45')]));_0x362c7c['attributes']=_0x362c7c[_0x98b2('0x44')][_0x98b2('0x46')]?_0x362c7c[_0x98b2('0x44')]:_0xbb9582[_0x98b2('0x40')];if(!_0x53745d['query']['hasOwnProperty'](_0x98b2('0x47'))){_0x362c7c[_0x98b2('0x31')]=qs[_0x98b2('0x31')](_0x53745d[_0x98b2('0x48')]['limit']);_0x362c7c[_0x98b2('0x2e')]=qs['offset'](_0x53745d['query']['offset']);}_0x362c7c[_0x98b2('0x49')]=qs[_0x98b2('0x4a')](_0x53745d['query']['sort']);_0x362c7c[_0x98b2('0x4b')]=qs[_0x98b2('0x42')](_[_0x98b2('0x4c')](_0x53745d[_0x98b2('0x48')],_0xbb9582['filters']),_0x387748);if(_0x53745d['query'][_0x98b2('0x4d')]){_0x362c7c[_0x98b2('0x4b')]=_[_0x98b2('0x4e')](_0x362c7c[_0x98b2('0x4b')],{'$or':_[_0x98b2('0x3a')](_0x387748,function(_0x323b85){if(_0x323b85[_0x98b2('0x3e')]!==_0x98b2('0x4f')){var _0x585a5c={};_0x585a5c[_0x323b85[_0x98b2('0x37')]]={'$like':'%'+_0x53745d[_0x98b2('0x48')][_0x98b2('0x4d')]+'%'};return _0x585a5c;}})});}_0x362c7c=_[_0x98b2('0x4e')]({},_0x362c7c,_0x53745d[_0x98b2('0x50')]);var _0x205d62={'where':_0x362c7c[_0x98b2('0x4b')]};return db['SmsMessage']['count'](_0x205d62)[_0x98b2('0x20')](function(_0x207805){_0x5a101f[_0x98b2('0x30')]=_0x207805;if(_0x53745d[_0x98b2('0x48')][_0x98b2('0x51')]){_0x362c7c[_0x98b2('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x98b2('0x53')](_0x362c7c);})['then'](function(_0x4fd062){_0x5a101f[_0x98b2('0x54')]=_0x4fd062;return _0x5a101f;})[_0x98b2('0x20')](respondWithFilteredResult(_0x11deac,_0x362c7c))[_0x98b2('0x2b')](handleError(_0x11deac,null));};exports[_0x98b2('0x55')]=function(_0x5388a3,_0x1311e5){var _0x523248={'raw':!![],'where':{'id':_0x5388a3[_0x98b2('0x56')]['id']}},_0x581062={};_0x581062[_0x98b2('0x40')]=_[_0x98b2('0x41')](db[_0x98b2('0x3b')]['rawAttributes']);_0x581062[_0x98b2('0x48')]=_[_0x98b2('0x41')](_0x5388a3['query']);_0x581062[_0x98b2('0x42')]=_[_0x98b2('0x43')](_0x581062[_0x98b2('0x40')],_0x581062[_0x98b2('0x48')]);_0x523248[_0x98b2('0x44')]=_[_0x98b2('0x43')](_0x581062[_0x98b2('0x40')],qs[_0x98b2('0x45')](_0x5388a3[_0x98b2('0x48')][_0x98b2('0x45')]));_0x523248[_0x98b2('0x44')]=_0x523248[_0x98b2('0x44')]['length']?_0x523248[_0x98b2('0x44')]:_0x581062[_0x98b2('0x40')];if(_0x5388a3[_0x98b2('0x48')][_0x98b2('0x51')]){_0x523248[_0x98b2('0x52')]=[{'all':!![]}];}_0x523248=_[_0x98b2('0x4e')]({},_0x523248,_0x5388a3['options']);return db['SmsMessage'][_0x98b2('0x57')](_0x523248)[_0x98b2('0x20')](handleEntityNotFound(_0x1311e5,null))['then'](respondWithResult(_0x1311e5,null))[_0x98b2('0x2b')](handleError(_0x1311e5,null));};exports['create']=function(_0x131228,_0xc29083){return db[_0x98b2('0x3b')][_0x98b2('0x58')](_0x131228[_0x98b2('0x59')],{})[_0x98b2('0x20')](respondWithResult(_0xc29083,0xc9))[_0x98b2('0x2b')](handleError(_0xc29083,null));};exports[_0x98b2('0x5a')]=function(_0x3e7c8e,_0x13c90b){if(_0x3e7c8e['body']['id']){delete _0x3e7c8e[_0x98b2('0x59')]['id'];}return db[_0x98b2('0x3b')][_0x98b2('0x57')]({'where':{'id':_0x3e7c8e['params']['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x13c90b,null))[_0x98b2('0x20')](saveUpdates(_0x3e7c8e[_0x98b2('0x59')],null))[_0x98b2('0x20')](respondWithResult(_0x13c90b,null))[_0x98b2('0x2b')](handleError(_0x13c90b,null));};exports[_0x98b2('0x34')]=function(_0x2d4cc8,_0x530e28){return db[_0x98b2('0x3b')]['find']({'where':{'id':_0x2d4cc8[_0x98b2('0x56')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x530e28,null))[_0x98b2('0x20')](removeEntity(_0x530e28,null))[_0x98b2('0x2b')](handleError(_0x530e28,null));};exports[_0x98b2('0x5b')]=function(_0x2986f3,_0x298a93){return db['SmsMessage'][_0x98b2('0x5b')]()['then'](respondWithResult(_0x298a93,null))['catch'](handleError(_0x298a93,null));};var interaction_log=require(_0x98b2('0x12'))(_0x98b2('0x5c'));exports[_0x98b2('0x5d')]=function(_0x12146d,_0x340c24,_0x1ad859){var _0xaac913={'agent':{},'channel':'sms'};if(_0x12146d['body']['id']){delete _0x12146d[_0x98b2('0x59')]['id'];}_0x12146d['body']['read']=!![];_0x12146d[_0x98b2('0x59')][_0x98b2('0x5e')]=moment()[_0x98b2('0x5f')](_0x98b2('0x60'));_0x12146d[_0x98b2('0x59')][_0x98b2('0x61')]=_0x12146d[_0x98b2('0x59')][_0x98b2('0x61')]||_0x12146d[_0x98b2('0x62')]['id'];_0xaac913[_0x98b2('0x63')]['id']=_0x12146d[_0x98b2('0x59')][_0x98b2('0x61')];return db[_0x98b2('0x3b')][_0x98b2('0x57')]({'where':{'id':_0x12146d[_0x98b2('0x56')]['id'],'UserId':null}})[_0x98b2('0x20')](handleEntityNotFound(_0x340c24,null))[_0x98b2('0x20')](saveUpdates(_0x12146d[_0x98b2('0x59')],null))['then'](function(_0xa147bc){if(_0xa147bc){_0xaac913[_0x98b2('0x29')]=_0xa147bc[_0x98b2('0x64')]({'plain':!![]});return db[_0x98b2('0x65')][_0x98b2('0x57')]({'where':{'id':_0xa147bc[_0x98b2('0x66')]}});}return null;})[_0x98b2('0x20')](handleEntityNotFound(_0x340c24,null))[_0x98b2('0x20')](function(_0x1d9a6c){if(_0x1d9a6c){return _0x1d9a6c[_0x98b2('0x5a')]({'UserId':_0x12146d[_0x98b2('0x59')]['UserId'],'read1stAt':_['isNil'](_0x1d9a6c[_0x98b2('0x67')])?moment()[_0x98b2('0x5f')](_0x98b2('0x60')):undefined});}return null;})['then'](function(_0x4f9609){if(_0x4f9609){_0xaac913[_0x98b2('0x68')]=_0x4f9609[_0x98b2('0x64')]({'plain':!![]});interaction_log[_0x98b2('0x21')](_0x98b2('0x69'),_0x12146d[_0x98b2('0x62')]['id'],_0x12146d['user'][_0x98b2('0x37')],_0x12146d[_0x98b2('0x62')]['role'],_0xaac913['interaction']['id'],_0x12146d['body']?JSON[_0x98b2('0x26')](_0x12146d[_0x98b2('0x59')]):_0x98b2('0x6a'));return respondWithRpcPromise(_0x98b2('0x6b'),_0x98b2('0x6c'),_0xaac913);}return null;})[_0x98b2('0x20')](function(_0x274821){var _0x234552='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x274821[_0x98b2('0x29')][_0x98b2('0x6d')];return db[_0x98b2('0x6e')][_0x98b2('0x48')](_0x234552,{'type':db[_0x98b2('0x6f')][_0x98b2('0x70')][_0x98b2('0x71')],'raw':!![]})[_0x98b2('0x20')](function(_0x589f39){return _0x589f39;});})[_0x98b2('0x20')](function(_0x2e729b){if(_0x2e729b){_0xaac913[_0x98b2('0x29')]['contact']=_0x2e729b[0x0];if(!_0x12146d['body']['UserId'])return;return db[_0x98b2('0x72')][_0x98b2('0x57')]({'where':{'id':_0x12146d[_0x98b2('0x59')][_0x98b2('0x61')],'role':_0x98b2('0x63')},'attributes':['id',_0x98b2('0x37'),'fullname','email',_0x98b2('0x73')],'raw':!![]});}return null;})[_0x98b2('0x20')](function(_0x1e5bd2){if(!_0x1e5bd2)return null;_0xaac913[_0x98b2('0x29')][_0x98b2('0x63')]=_0x1e5bd2;return _0xaac913;})[_0x98b2('0x20')](function(_0x759ac5){if(_0x759ac5){if(_0x12146d['body'][_0x98b2('0x74')]){_0xaac913[_0x98b2('0x29')]['interface']=util[_0x98b2('0x5f')](_0x98b2('0x75'),_0x12146d[_0x98b2('0x62')][_0x98b2('0x37')]);_0xaac913['message'][_0x98b2('0x76')]=_0xaac913['channel'];_0xaac913['message']['motionChannel']=_0xaac913[_0x98b2('0x76')];_0xaac913[_0x98b2('0x29')][_0x98b2('0x77')]=_0x98b2('0x5d');return respondWithRpcPromise('EventManager',_0x98b2('0x78'),{'event':_0x98b2('0x79'),'message':_0xaac913['message']},client9002)['then'](function(){return _0xaac913;});}return _0xaac913;}return null;})[_0x98b2('0x20')](respondWithResult(_0x340c24,null))[_0x98b2('0x2b')](handleError(_0x340c24,null));};var interaction_log=require(_0x98b2('0x12'))(_0x98b2('0x5c'));exports['reject']=function(_0xb4d7bb,_0x776d0d,_0x5cf5a6){var _0x3c0b47={'agent':{},'channel':'sms'};if(_0xb4d7bb[_0x98b2('0x59')]['id']){delete _0xb4d7bb['body']['id'];}_0xb4d7bb[_0x98b2('0x59')][_0x98b2('0x61')]=_0xb4d7bb['body']['UserId']||_0xb4d7bb[_0x98b2('0x62')]['id'];_0x3c0b47[_0x98b2('0x63')]['id']=_0xb4d7bb[_0x98b2('0x59')][_0x98b2('0x61')];return db[_0x98b2('0x3b')][_0x98b2('0x57')]({'where':{'id':_0xb4d7bb[_0x98b2('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x776d0d,null))[_0x98b2('0x20')](function(_0x5335ff){if(_0x5335ff){_0x3c0b47[_0x98b2('0x29')]=_0x5335ff[_0x98b2('0x64')]({'plain':!![]});return db[_0x98b2('0x65')]['find']({'where':{'id':_0x5335ff[_0x98b2('0x66')]}});}return null;})[_0x98b2('0x20')](handleEntityNotFound(_0x776d0d,null))['then'](function(_0x2a24ee){if(_0x2a24ee){_0x3c0b47[_0x98b2('0x68')]=_0x2a24ee[_0x98b2('0x64')]({'plain':!![]});interaction_log['info'](_0x98b2('0x7a'),_0xb4d7bb[_0x98b2('0x62')]['id'],_0xb4d7bb['user'][_0x98b2('0x37')],_0xb4d7bb[_0x98b2('0x62')]['role'],_0x3c0b47[_0x98b2('0x68')]['id'],_0xb4d7bb[_0x98b2('0x59')]?JSON[_0x98b2('0x26')](_0xb4d7bb[_0x98b2('0x59')]):_0x98b2('0x6a'));return respondWithRpcPromise(_0x98b2('0x7b'),_0x98b2('0x7c'),_0x3c0b47);}return null;})[_0x98b2('0x20')](function(_0x175af1){var _0x5e5df0=_0x98b2('0x7d')+_0x175af1[_0x98b2('0x29')][_0x98b2('0x6d')];return db['sequelize'][_0x98b2('0x48')](_0x5e5df0,{'type':db[_0x98b2('0x6f')]['QueryTypes'][_0x98b2('0x71')],'raw':!![]})[_0x98b2('0x20')](function(_0x669b49){return _0x669b49;});})['then'](function(_0x30108b){if(_0x30108b){_0x3c0b47[_0x98b2('0x29')][_0x98b2('0x7e')]=_0x30108b[0x0];if(!_0xb4d7bb['body'][_0x98b2('0x61')])return;return db[_0x98b2('0x72')][_0x98b2('0x57')]({'where':{'id':_0xb4d7bb[_0x98b2('0x59')][_0x98b2('0x61')],'role':'agent'},'attributes':['id',_0x98b2('0x37'),_0x98b2('0x7f'),_0x98b2('0x80'),'internal'],'raw':!![]});}return null;})[_0x98b2('0x20')](function(_0x3a95c2){if(!_0x3a95c2)return null;_0x3c0b47['message'][_0x98b2('0x63')]=_0x3a95c2;return _0x3c0b47;})[_0x98b2('0x20')](function(_0x1979ef){if(_0x1979ef){_0x1979ef[_0x98b2('0x29')][_0x98b2('0x81')]=util[_0x98b2('0x5f')](_0x98b2('0x75'),_0xb4d7bb['user'][_0x98b2('0x37')]);_0x1979ef[_0x98b2('0x29')][_0x98b2('0x76')]=_0x3c0b47['channel'];_0x1979ef['message'][_0x98b2('0x82')]=_0x3c0b47[_0x98b2('0x76')];_0x1979ef['message'][_0x98b2('0x77')]=_0x98b2('0x83');respondWithRpcPromise(_0x98b2('0x78'),_0x98b2('0x78'),{'event':'rejectmessage','message':_0x1979ef[_0x98b2('0x29')]},client9002);return _0x3c0b47;}return null;})[_0x98b2('0x20')](respondWithResult(_0x776d0d,null))['catch'](handleError(_0x776d0d,null));};exports['status']=function(_0x452bfb,_0x29a3df,_0x1850bb){if(_0x452bfb[_0x98b2('0x59')]['id']){delete _0x452bfb[_0x98b2('0x59')]['id'];}var _0x1cecc6;return db[_0x98b2('0x3b')]['find']({'where':{'id':_0x452bfb[_0x98b2('0x56')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x29a3df,null))[_0x98b2('0x20')](function(_0x4e454a){if(_0x4e454a){_0x1cecc6=_0x4e454a;return db[_0x98b2('0x84')][_0x98b2('0x57')]({'where':{'id':_0x4e454a[_0x98b2('0x85')]}});}})[_0x98b2('0x20')](handleEntityNotFound(_0x29a3df,null))[_0x98b2('0x20')](function(_0x228ee7){if(_0x228ee7){logger[_0x98b2('0x24')](_0x98b2('0x25'),_0x98b2('0x2d'),_0x98b2('0x86'),_0x228ee7[_0x98b2('0x3e')],util[_0x98b2('0x87')](_0x452bfb['body'],{'showHidden':![],'depth':null}));switch(_0x228ee7[_0x98b2('0x3e')]){case _0x98b2('0x88'):if(_0x452bfb[_0x98b2('0x59')][_0x98b2('0x89')]&&_0x452bfb[_0x98b2('0x59')][_0x98b2('0x89')]===_0x1cecc6[_0x98b2('0x8a')]){return _0x1cecc6[_0x98b2('0x5a')]({'read':!![]});}else{logger[_0x98b2('0x27')](_0x98b2('0x8b'),_0x98b2('0x2d'),_0x98b2('0x88'),util[_0x98b2('0x87')](_0x452bfb[_0x98b2('0x59')],{'showHidden':![],'depth':null}));}break;case _0x98b2('0x8c'):if(_0x452bfb['body'][_0x98b2('0x8d')]&&_0x452bfb[_0x98b2('0x59')]['MessageUUID']===_0x1cecc6[_0x98b2('0x8a')]&&_[_0x98b2('0x8e')](['sent',_0x98b2('0x8f')],_0x452bfb['body'][_0x98b2('0x90')])>=0x0){return _0x1cecc6[_0x98b2('0x5a')]({'read':!![]});}else{logger[_0x98b2('0x27')](_0x98b2('0x8b'),_0x98b2('0x2d'),_0x98b2('0x91'),util[_0x98b2('0x87')](_0x452bfb['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2e6335=_0x452bfb[_0x98b2('0x59')]['results'][0x0];if(_0x2e6335[_0x98b2('0x2d')][_0x98b2('0x92')]===_0x98b2('0x93')){return _0x1cecc6[_0x98b2('0x5a')]({'read':!![]});}else{logger['error'](_0x98b2('0x8b'),_0x98b2('0x2d'),_0x98b2('0x94'),util['inspect'](_0x452bfb[_0x98b2('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1cecc6;}})[_0x98b2('0x20')](respondWithResult(_0x29a3df,null))[_0x98b2('0x2b')](handleError(_0x29a3df,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a380c44..9157859 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 _0xa323=['../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4104e7,_0x46346f){var _0x388140=function(_0x346043){while(--_0x346043){_0x4104e7['push'](_0x4104e7['shift']());}};_0x388140(++_0x46346f);}(_0xa323,0x8b));var _0x3a32=function(_0x4b1b3a,_0x239438){_0x4b1b3a=_0x4b1b3a-0x0;var _0x203002=_0xa323[_0x4b1b3a];return _0x203002;};'use strict';var EventEmitter=require(_0x3a32('0x0'));var SmsMessage=require(_0x3a32('0x1'))['db'][_0x3a32('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3a32('0x3')](0x0);var events={'afterCreate':_0x3a32('0x4'),'afterUpdate':'update','afterDestroy':_0x3a32('0x5')};function emitEvent(_0x29e527){return function(_0x3d7820,_0x5a0181,_0x5b2b24){SmsMessageEvents[_0x3a32('0x6')](_0x29e527+':'+_0x3d7820['id'],_0x3d7820);SmsMessageEvents[_0x3a32('0x6')](_0x29e527,_0x3d7820);_0x5b2b24(null);};}for(var e in events){if(events[_0x3a32('0x7')](e)){var event=events[e];SmsMessage[_0x3a32('0x8')](e,emitEvent(event));}}module[_0x3a32('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x3ac2=['hasOwnProperty','hook','exports','setMaxListeners','save','remove','emit'];(function(_0x216ecb,_0x5527b1){var _0x537c17=function(_0x18e448){while(--_0x18e448){_0x216ecb['push'](_0x216ecb['shift']());}};_0x537c17(++_0x5527b1);}(_0x3ac2,0x1ca));var _0x23ac=function(_0x2ec300,_0x5abcd6){_0x2ec300=_0x2ec300-0x0;var _0x95bf44=_0x3ac2[_0x2ec300];return _0x95bf44;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x23ac('0x0')](0x0);var events={'afterCreate':_0x23ac('0x1'),'afterUpdate':'update','afterDestroy':_0x23ac('0x2')};function emitEvent(_0x16cd95){return function(_0x39a420,_0x25156e,_0x29afad){SmsMessageEvents[_0x23ac('0x3')](_0x16cd95+':'+_0x39a420['id'],_0x39a420);SmsMessageEvents[_0x23ac('0x3')](_0x16cd95,_0x39a420);_0x29afad(null);};}for(var e in events){if(events[_0x23ac('0x4')](e)){var event=events[e];SmsMessage[_0x23ac('0x5')](e,emitEvent(event));}}module[_0x23ac('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2d3be14..79b322b 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 _0xa4a1=['session_key','total_sent','internal_order_id','read','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','format','base64','http_code','data','queued_count','head','clickSend','plivo','authId','Basic\x20%s','toString','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','IBSSO\x20','csc','apiKey','login','timestamp','keys','sort','length','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','body','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','password','GET','sms','POST','user_key'];(function(_0x3f9812,_0x51e06f){var _0x2d6f1c=function(_0x577cba){while(--_0x577cba){_0x3f9812['push'](_0x3f9812['shift']());}};_0x2d6f1c(++_0x51e06f);}(_0xa4a1,0x131));var _0x1a4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4a1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a4a('0x0'));var util=require(_0x1a4a('0x1'));var logger=require(_0x1a4a('0x2'))(_0x1a4a('0x3'));var moment=require(_0x1a4a('0x4'));var BPromise=require(_0x1a4a('0x5'));var rp=require(_0x1a4a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a4a('0x7'));var config=require(_0x1a4a('0x8'));var attributes=require(_0x1a4a('0x9'));module['exports']=function(_0x468f73,_0x53ad07){return _0x468f73[_0x1a4a('0xa')](_0x1a4a('0xb'),attributes,{'tableName':_0x1a4a('0xc'),'paranoid':![],'indexes':[{'name':_0x1a4a('0xd'),'fields':[_0x1a4a('0xd')]},{'name':_0x1a4a('0xe'),'fields':['body'],'type':_0x1a4a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40749f,_0x1492b5,_0x2f12a7){var _0x1eb904=_0x468f73[_0x1a4a('0x10')];var _0x28b2f8=_0x40749f[_0x1a4a('0x11')]({'plain':!![]});if(_0x28b2f8[_0x1a4a('0x12')]['toLowerCase']()==='in'||_0x28b2f8[_0x1a4a('0x12')][_0x1a4a('0x13')]()===_0x1a4a('0x14')&&!_0x28b2f8[_0x1a4a('0x15')]&&!_[_0x1a4a('0x16')](_0x28b2f8[_0x1a4a('0x17')])&&!_['isNil'](_0x28b2f8[_0x1a4a('0x18')])){_0x1eb904[_0x1a4a('0x19')][_0x1a4a('0x1a')]({'where':{'id':_0x28b2f8['SmsInteractionId']}})[_0x1a4a('0x1b')](function(_0x26178f){if(_0x26178f){_0x26178f[_0x1a4a('0x1c')]({'lastMsgAt':_0x28b2f8['createdAt'],'lastMsgDirection':_0x28b2f8[_0x1a4a('0x12')][_0x1a4a('0x13')]()});}})[_0x1a4a('0x1d')](function(_0x31c713){console[_0x1a4a('0x1e')](_0x31c713);});}if(_0x28b2f8[_0x1a4a('0x12')]===_0x1a4a('0x14')&&!_0x28b2f8[_0x1a4a('0x15')]){var _0x374dc7;_0x1eb904[_0x1a4a('0x1f')][_0x1a4a('0x20')]({'where':{'id':_0x28b2f8['SmsAccountId']},'raw':!![]})[_0x1a4a('0x1b')](function(_0x480f90){_0x374dc7=_0x480f90;if(_0x374dc7&&_0x374dc7[_0x1a4a('0x21')]){switch(_0x374dc7[_0x1a4a('0x21')]){case _0x1a4a('0x22'):var _0x18f309=require(_0x1a4a('0x22'));if(_0x374dc7[_0x1a4a('0x23')]&&_0x374dc7[_0x1a4a('0x24')]&&_0x374dc7[_0x1a4a('0x25')]){var _0x2f3593=new _0x18f309(_0x374dc7[_0x1a4a('0x23')],_0x374dc7['authToken']);_0x2f3593[_0x1a4a('0x26')][_0x1a4a('0x27')]({'body':_0x28b2f8[_0x1a4a('0x28')],'to':_0x28b2f8[_0x1a4a('0x25')],'from':_0x374dc7['phone'],'statusCallback':_0x374dc7['remote']+_0x1a4a('0x29')+_0x28b2f8['id']+_0x1a4a('0x2a')+_0x374dc7[_0x1a4a('0x2b')]})[_0x1a4a('0x1b')](function(_0x47943e){if(_0x47943e[_0x1a4a('0x2c')]){return _0x40749f['update']({'messageId':_0x47943e[_0x1a4a('0x2c')]});}})['catch'](function(_0x3079ee){logger['error'](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x22'),util['inspect'](_0x3079ee,{'showHidden':![],'depth':null}));});}else{logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),'afterCreate',_0x1a4a('0x22'),_0x1a4a('0x2f'));}break;case _0x1a4a('0x30'):var _0x18c3c7=_0x1a4a('0x31');if(_0x374dc7[_0x1a4a('0x32')]&&_0x374dc7['password']){var _0x54473f={'recipient':[_0x28b2f8['phone']],'message':_0x28b2f8[_0x1a4a('0x28')],'message_type':_0x374dc7['smsMethod']};if(_0x374dc7['smsMethod']&&_0x374dc7[_0x1a4a('0x33')]!=='SI'){_0x54473f[_0x1a4a('0x34')]=_0x374dc7[_0x1a4a('0x25')];}var _0x442165={'url':_0x18c3c7+'login?username='+_0x374dc7[_0x1a4a('0x32')]+'&password='+_0x374dc7[_0x1a4a('0x35')],'method':_0x1a4a('0x36')};rp(_0x442165)[_0x1a4a('0x1b')](function(_0x1e8bf7){var _0x3054d6=_0x1e8bf7['split'](';');var _0x3715af={'user_key':_0x3054d6[0x0],'session_key':_0x3054d6[0x1]};_0x442165={'url':_0x18c3c7+_0x1a4a('0x37'),'method':_0x1a4a('0x38'),'headers':{'user_key':_0x3715af[_0x1a4a('0x39')],'Session_key':_0x3715af[_0x1a4a('0x3a')]},'json':!![],'body':_0x54473f};return rp(_0x442165);})['then'](function(_0x5c47b8){if(_0x5c47b8[_0x1a4a('0x3b')]>=0x1){var _0x2ad5b5={'messageId':_0x5c47b8[_0x1a4a('0x3c')]};if(_0x374dc7[_0x1a4a('0x33')]!=='GP'||!_0x374dc7['deliveryReport']){_0x2ad5b5[_0x1a4a('0x3d')]=!![];}return _0x40749f['update'](_0x2ad5b5);}else{return logger[_0x1a4a('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1a4a('0x30'),util[_0x1a4a('0x3e')](_0x5c47b8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x131f46){return logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x30'),util[_0x1a4a('0x3e')](_0x131f46,{'showHidden':![],'depth':null}));});}else{logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x30'),_0x1a4a('0x3f'));}break;case'connectel':if(_0x374dc7[_0x1a4a('0x24')]){var _0x2d37e5={'recipient':_0x28b2f8['phone'],'message':_0x28b2f8[_0x1a4a('0x28')],'sender':_0x374dc7[_0x1a4a('0x40')]||_0x374dc7['phone'],'authorization':_0x374dc7[_0x1a4a('0x24')]};var _0x1492b5={'method':_0x1a4a('0x38'),'uri':_0x1a4a('0x41'),'body':_0x2d37e5,'json':!![]};rp(_0x1492b5)[_0x1a4a('0x1b')](function(_0x1df1f3){var _0x19fb86={'messageId':_0x1df1f3[_0x1a4a('0x42')]};if(!_0x374dc7[_0x1a4a('0x43')]){_0x19fb86[_0x1a4a('0x3d')]=!![];}return _0x40749f[_0x1a4a('0x1c')](_0x19fb86);})[_0x1a4a('0x1d')](function(_0x22276e){logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),'connectel',util[_0x1a4a('0x3e')](_0x22276e,{'showHidden':![],'depth':null}));});}else{logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x44'),_0x1a4a('0x45'));}break;case'clicksend':if(_0x374dc7[_0x1a4a('0x32')]&&_0x374dc7[_0x1a4a('0x35')]){var _0x2d37e5={'messages':[{'source':_0x1a4a('0x46'),'to':_0x28b2f8['phone'],'body':_0x28b2f8[_0x1a4a('0x28')],'from':_0x374dc7[_0x1a4a('0x40')]||_0x374dc7[_0x1a4a('0x25')]}]};var _0x20fe6a=util['format']('%s:%s',_0x374dc7[_0x1a4a('0x32')],_0x374dc7[_0x1a4a('0x35')]);var _0x1492b5={'method':'POST','uri':_0x1a4a('0x47'),'body':_0x2d37e5,'headers':{'Authorization':util[_0x1a4a('0x48')]('Basic\x20%s',new Buffer(_0x20fe6a)['toString'](_0x1a4a('0x49')))},'json':!![]};rp(_0x1492b5)[_0x1a4a('0x1b')](function(_0x38c9fc){if(_0x38c9fc[_0x1a4a('0x4a')]>=0xc8&&_0x38c9fc[_0x1a4a('0x4a')]<=0xce){if(_0x38c9fc[_0x1a4a('0x4b')]&&_0x38c9fc[_0x1a4a('0x4b')][_0x1a4a('0x4c')]>0x0){var _0xdb51b5=_[_0x1a4a('0x4d')](_0x38c9fc[_0x1a4a('0x4b')][_0x1a4a('0x26')]);var _0x2c632d={'messageId':_0xdb51b5['message_id']};if(!_0x374dc7['deliveryReport']){_0x2c632d[_0x1a4a('0x3d')]=!![];}return _0x40749f['update'](_0x2c632d);}else{logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),'afterCreate',_0x1a4a('0x4e'),util['inspect'](_0x38c9fc,{'showHidden':![],'depth':null}));}}else{logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),'afterCreate',_0x1a4a('0x4e'),util[_0x1a4a('0x3e')](_0x38c9fc,{'showHidden':![],'depth':null}));}})[_0x1a4a('0x1d')](function(_0x5d7dc2){logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),'afterCreate','clickSend',util['inspect'](_0x5d7dc2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1a4a('0x2d'),_0x1a4a('0x2e'),'clickSend',_0x1a4a('0x3f'));}break;case _0x1a4a('0x4f'):if(_0x374dc7['authId']&&_0x374dc7[_0x1a4a('0x24')]){var _0x2d37e5={'dst':_0x28b2f8[_0x1a4a('0x25')],'text':_0x28b2f8[_0x1a4a('0x28')],'src':_0x374dc7['senderString']||_0x374dc7['phone'],'url':_0x374dc7['remote']+_0x1a4a('0x29')+_0x28b2f8['id']+_0x1a4a('0x2a')+_0x374dc7[_0x1a4a('0x2b')]};var _0x20fe6a=util['format']('%s:%s',_0x374dc7[_0x1a4a('0x50')],_0x374dc7[_0x1a4a('0x24')]);var _0x1492b5={'method':_0x1a4a('0x38'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x374dc7['authId']),'body':_0x2d37e5,'headers':{'Authorization':util[_0x1a4a('0x48')](_0x1a4a('0x51'),new Buffer(_0x20fe6a)[_0x1a4a('0x52')](_0x1a4a('0x49')))},'json':!![]};rp(_0x1492b5)[_0x1a4a('0x1b')](function(_0x4dc791){var _0x3840ce={'messageId':_0x4dc791[_0x1a4a('0x53')][0x0]};return _0x40749f[_0x1a4a('0x1c')](_0x3840ce);})['catch'](function(_0x209456){logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),'plivo',util[_0x1a4a('0x3e')](_0x209456,{'showHidden':![],'depth':null}));});}else{logger[_0x1a4a('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1a4a('0x2e'),_0x1a4a('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x1a4a('0x54'):if(_0x374dc7['username']&&_0x374dc7['password']){if(_0x374dc7[_0x1a4a('0x55')]){var _0x514789={'method':_0x1a4a('0x38'),'uri':_0x374dc7[_0x1a4a('0x55')]+_0x1a4a('0x56'),'body':{'username':_0x374dc7[_0x1a4a('0x32')],'password':_0x374dc7[_0x1a4a('0x35')]},'json':!![]};return rp(_0x514789)['then'](function(_0x28e06d){var _0x1bebf2={'method':'POST','uri':_0x374dc7[_0x1a4a('0x55')]+_0x1a4a('0x57'),'body':{'messages':[{'from':_0x374dc7[_0x1a4a('0x25')],'destinations':[{'to':_0x28b2f8['phone']}],'text':_0x28b2f8[_0x1a4a('0x28')],'notifyUrl':_0x374dc7[_0x1a4a('0x58')]+'/api/sms/messages/'+_0x28b2f8['id']+_0x1a4a('0x2a')+_0x374dc7['token'],'notifyContentType':'application/json','callbackData':_0x374dc7['phone']+';'+_0x28b2f8[_0x1a4a('0x28')]}]},'headers':{'Authorization':_0x1a4a('0x59')+_0x28e06d[_0x1a4a('0x2b')]},'json':!![]};return rp(_0x1bebf2)[_0x1a4a('0x1b')](function(_0x1c2530){if(_0x1c2530['messages']){var _0x4707fd={'messageId':_0x1c2530[_0x1a4a('0x26')][0x0][_0x1a4a('0xd')]};if(!_0x374dc7[_0x1a4a('0x43')]){_0x4707fd['read']=!![];}return _0x40749f[_0x1a4a('0x1c')](_0x4707fd);}else{return logger['error'](_0x1a4a('0x2d'),'afterCreate',_0x1a4a('0x54'),util[_0x1a4a('0x3e')](_0x1c2530,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3261e0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1a4a('0x2e'),_0x1a4a('0x54'),util['inspect'](_0x3261e0,{'showHidden':![],'depth':null}));});}else{logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),'infobip',_0x1a4a('0x3f'));}break;case _0x1a4a('0x5a'):var _0x4341fb=require('crypto');if(_0x374dc7[_0x1a4a('0x5b')]){var _0x5ef8e3={};_0x5ef8e3[_0x1a4a('0x5c')]=_0x374dc7['username'];_0x5ef8e3[_0x1a4a('0x25')]=_0x28b2f8[_0x1a4a('0x25')];_0x5ef8e3[_0x1a4a('0x34')]=_0x374dc7[_0x1a4a('0x25')];_0x5ef8e3['text']=_0x28b2f8['body'];_0x5ef8e3[_0x1a4a('0x5d')]=+new Date();var _0xcba439='';var _0xfaf3be='';var _0x39fece=Object[_0x1a4a('0x5e')](_0x5ef8e3);_0x39fece[_0x1a4a('0x5f')]();for(var _0x2821ae=0x0;_0x2821ae<_0x39fece[_0x1a4a('0x60')];_0x2821ae++){if(_0xcba439!=''){_0xcba439+='&';}_0xcba439+=_0x39fece[_0x2821ae]+'='+encodeURIComponent(_0x5ef8e3[_0x39fece[_0x2821ae]]);_0xfaf3be+=_0x5ef8e3[_0x39fece[_0x2821ae]];}_0xfaf3be+=_0x374dc7[_0x1a4a('0x5b')];_0xfaf3be=_0x4341fb['createHash']('md5')[_0x1a4a('0x1c')](_0xfaf3be)[_0x1a4a('0x61')]('hex');if(_0xcba439!==''){_0xcba439+='&';}_0xcba439+=_0x1a4a('0x62')+_0xfaf3be;var _0x442165={'method':_0x1a4a('0x36'),'uri':_0x374dc7[_0x1a4a('0x55')]+_0x1a4a('0x63')+_0xcba439,'json':!![]};return rp(_0x442165)['then'](function(_0x10f402){var _0x20eb04=Object['keys'](_0x10f402);if(_0x10f402[_0x20eb04[0x0]]['error']&&parseInt(_0x10f402[_0x20eb04[0x0]][_0x1a4a('0x1e')])===0x0){var _0x4b2af5={'messageId':_0x10f402[_0x20eb04[0x0]][_0x1a4a('0x64')]};if(!_0x374dc7['deliveryReport']){_0x4b2af5[_0x1a4a('0x3d')]=!![];}return _0x40749f[_0x1a4a('0x1c')](_0x4b2af5);}else{return logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),'csc',util[_0x1a4a('0x3e')](_0x10f402['error'],{'showHidden':![],'depth':null}));}})[_0x1a4a('0x1d')](function(_0x2aa4c0){return logger['error'](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x5a'),util[_0x1a4a('0x3e')](_0x2aa4c0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1a4a('0x2d'),'afterCreate',_0x1a4a('0x5a'),_0x1a4a('0x65'));}break;case _0x1a4a('0x66'):if(_0x374dc7[_0x1a4a('0x5b')]){var _0x598c06={'method':_0x1a4a('0x38'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x374dc7[_0x1a4a('0x5b')]},'body':{'content':_0x28b2f8[_0x1a4a('0x28')],'to':[_0x28b2f8['phone']],'from':_0x374dc7[_0x1a4a('0x25')],'binary':![],'clientMessageId':_0x1a4a('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x598c06)[_0x1a4a('0x1b')](function(_0x3a0f04){if(!_0x3a0f04[_0x1a4a('0x1e')]){var _0x63e045={'messageId':_0x3a0f04[_0x1a4a('0x26')][0x0]['apiMessageId']};if(!_0x374dc7[_0x1a4a('0x43')]){_0x63e045[_0x1a4a('0x3d')]=!![];}return _0x40749f['update'](_0x63e045);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1a4a('0x2e'),_0x1a4a('0x66'),util['inspect'](_0x3a0f04[_0x1a4a('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x515b60){return logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x66'),util[_0x1a4a('0x3e')](_0x515b60,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1a4a('0x2e'),_0x1a4a('0x66'),_0x1a4a('0x65'));}break;case _0x1a4a('0x68'):if(_0x374dc7[_0x1a4a('0x32')]&&_0x374dc7['password']){var _0x20fe6a=util['format'](_0x1a4a('0x69'),_0x374dc7[_0x1a4a('0x32')],_0x374dc7[_0x1a4a('0x35')]);var _0x1492b5={'method':_0x1a4a('0x38'),'uri':_0x1a4a('0x6a')+_0x374dc7['accountId']+_0x1a4a('0x6b'),'body':{'to':[_0x28b2f8[_0x1a4a('0x25')]],'text':_0x28b2f8[_0x1a4a('0x28')],'from':_0x374dc7[_0x1a4a('0x25')],'applicationId':_0x374dc7[_0x1a4a('0x6c')]},'headers':{'Authorization':util[_0x1a4a('0x48')](_0x1a4a('0x51'),new Buffer(_0x20fe6a)[_0x1a4a('0x52')](_0x1a4a('0x49')))},'json':!![]};rp(_0x1492b5)[_0x1a4a('0x1b')](function(_0x3f8624){if(_0x3f8624['id']){var _0x1b4570={'messageId':_0x3f8624['id']};return _0x40749f['update'](_0x1b4570);}else{logger['error'](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x68'),util[_0x1a4a('0x3e')](_0x3f8624,{'showHidden':![],'depth':null}));}})[_0x1a4a('0x1d')](function(_0x249975){logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),'bandwidth',util['inspect'](_0x249975,{'showHidden':![],'depth':null}));});}else{logger[_0x1a4a('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',_0x1a4a('0x3f'));}break;case _0x1a4a('0x6d'):if(_0x374dc7[_0x1a4a('0x5b')]){var _0x20889f={};var _0x442165={'method':_0x1a4a('0x38'),'uri':_0x1a4a('0x6e'),'headers':{'Authorization':_0x1a4a('0x6f')+_0x374dc7[_0x1a4a('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x374dc7[_0x1a4a('0x25')],'to':_0x28b2f8[_0x1a4a('0x25')],'text':_0x28b2f8['body']},'json':!![]};return rp(_0x442165)[_0x1a4a('0x1b')](function(_0x506dfa){if(_0x506dfa[_0x1a4a('0x70')]==0xca){_0x20889f[_0x1a4a('0x71')]=_0x506dfa;var _0x591223={'method':_0x1a4a('0x38'),'uri':_0x1a4a('0x72'),'headers':{'Authorization':_0x1a4a('0x6f')+_0x374dc7[_0x1a4a('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x20889f[_0x1a4a('0x71')][_0x1a4a('0x73')]},'json':!![]};return rp(_0x591223)['then'](function(_0x3d5733){_0x20889f[_0x1a4a('0x74')]=_0x3d5733;var _0x45a5a7={'messageId':_0x20889f[_0x1a4a('0x71')][_0x1a4a('0x73')],'read':!![]};return _0x40749f[_0x1a4a('0x1c')](_0x45a5a7);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1a4a('0x2e'),_0x1a4a('0x6d'),util[_0x1a4a('0x3e')](_0x506dfa,{'showHidden':![],'depth':null}));}})[_0x1a4a('0x1d')](function(_0x50c720){return logger[_0x1a4a('0x1e')](_0x1a4a('0x2d'),_0x1a4a('0x2e'),_0x1a4a('0x6d'),util['inspect'](_0x50c720,{'showHidden':![],'depth':null}));});}else{return logger[_0x1a4a('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1a4a('0x2e'),_0x1a4a('0x6d'),_0x1a4a('0x75'));}break;}}})[_0x1a4a('0x76')](function(){_0x2f12a7();});}else{_0x2f12a7();}}},'charset':_0x1a4a('0x77'),'collate':_0x1a4a('0x78')});}; \ No newline at end of file +var _0xb445=['request-promise','./smsMessage.attributes','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','toLowerCase','direction','out','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','remote','/api/sms/messages/','/status?token=','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','token','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','base64','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x4a284f,_0x2bdf0a){var _0x470cc3=function(_0x10a0a3){while(--_0x10a0a3){_0x4a284f['push'](_0x4a284f['shift']());}};_0x470cc3(++_0x2bdf0a);}(_0xb445,0x1e7));var _0x5b44=function(_0x2a9113,_0x1ee9b0){_0x2a9113=_0x2a9113-0x0;var _0x233771=_0xb445[_0x2a9113];return _0x233771;};'use strict';var _=require('lodash');var util=require(_0x5b44('0x0'));var logger=require(_0x5b44('0x1'))(_0x5b44('0x2'));var moment=require(_0x5b44('0x3'));var BPromise=require(_0x5b44('0x4'));var rp=require(_0x5b44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5b44('0x6'));module['exports']=function(_0x4a542e,_0x395103){return _0x4a542e['define'](_0x5b44('0x7'),attributes,{'tableName':_0x5b44('0x8'),'paranoid':![],'indexes':[{'name':_0x5b44('0x9'),'fields':['messageId']},{'name':_0x5b44('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x294ea4,_0x102fbc,_0x1c7b0f){var _0x4c40c8=_0x4a542e[_0x5b44('0xb')];var _0x554caa=_0x294ea4[_0x5b44('0xc')]({'plain':!![]});if(_0x554caa['direction'][_0x5b44('0xd')]()==='in'||_0x554caa[_0x5b44('0xe')][_0x5b44('0xd')]()===_0x5b44('0xf')&&!_0x554caa[_0x5b44('0x10')]&&!_['isNil'](_0x554caa[_0x5b44('0x11')])&&!_[_0x5b44('0x12')](_0x554caa['SmsInteractionId'])){_0x4c40c8[_0x5b44('0x13')][_0x5b44('0x14')]({'where':{'id':_0x554caa[_0x5b44('0x15')]}})['then'](function(_0x144d54){if(_0x144d54){_0x144d54[_0x5b44('0x16')]({'lastMsgAt':_0x554caa[_0x5b44('0x17')],'lastMsgDirection':_0x554caa[_0x5b44('0xe')][_0x5b44('0xd')]()});}})[_0x5b44('0x18')](function(_0x5bd59c){console[_0x5b44('0x19')](_0x5bd59c);});}if(_0x554caa[_0x5b44('0xe')]===_0x5b44('0xf')&&!_0x554caa['secret']){var _0x2326eb;_0x4c40c8['SmsAccount']['find']({'where':{'id':_0x554caa[_0x5b44('0x1a')]},'raw':!![]})['then'](function(_0x236bc9){_0x2326eb=_0x236bc9;if(_0x2326eb&&_0x2326eb['type']){switch(_0x2326eb[_0x5b44('0x1b')]){case _0x5b44('0x1c'):var _0x26a393=require(_0x5b44('0x1c'));if(_0x2326eb[_0x5b44('0x1d')]&&_0x2326eb[_0x5b44('0x1e')]&&_0x2326eb['phone']){var _0x4dc034=new _0x26a393(_0x2326eb[_0x5b44('0x1d')],_0x2326eb[_0x5b44('0x1e')]);_0x4dc034[_0x5b44('0x1f')][_0x5b44('0x20')]({'body':_0x554caa[_0x5b44('0x21')],'to':_0x554caa[_0x5b44('0x22')],'from':_0x2326eb[_0x5b44('0x22')],'statusCallback':_0x2326eb[_0x5b44('0x23')]+_0x5b44('0x24')+_0x554caa['id']+_0x5b44('0x25')+_0x2326eb['token']})[_0x5b44('0x26')](function(_0x16dd51){if(_0x16dd51['sid']){return _0x294ea4[_0x5b44('0x16')]({'messageId':_0x16dd51[_0x5b44('0x27')]});}})[_0x5b44('0x18')](function(_0x56c415){logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x1c'),util['inspect'](_0x56c415,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b44('0x29'),_0x5b44('0x1c'),_0x5b44('0x2a'));}break;case'skebby':var _0x5aef25=_0x5b44('0x2b');if(_0x2326eb[_0x5b44('0x2c')]&&_0x2326eb[_0x5b44('0x2d')]){var _0x3c8af9={'recipient':[_0x554caa[_0x5b44('0x22')]],'message':_0x554caa[_0x5b44('0x21')],'message_type':_0x2326eb[_0x5b44('0x2e')]};if(_0x2326eb[_0x5b44('0x2e')]&&_0x2326eb[_0x5b44('0x2e')]!=='SI'){_0x3c8af9['sender']=_0x2326eb[_0x5b44('0x22')];}var _0x2962ba={'url':_0x5aef25+_0x5b44('0x2f')+_0x2326eb['username']+_0x5b44('0x30')+_0x2326eb['password'],'method':_0x5b44('0x31')};rp(_0x2962ba)[_0x5b44('0x26')](function(_0x1c7ef4){var _0x4c2862=_0x1c7ef4[_0x5b44('0x32')](';');var _0x1c8504={'user_key':_0x4c2862[0x0],'session_key':_0x4c2862[0x1]};_0x2962ba={'url':_0x5aef25+'sms','method':_0x5b44('0x33'),'headers':{'user_key':_0x1c8504[_0x5b44('0x34')],'Session_key':_0x1c8504[_0x5b44('0x35')]},'json':!![],'body':_0x3c8af9};return rp(_0x2962ba);})[_0x5b44('0x26')](function(_0x3daa40){if(_0x3daa40[_0x5b44('0x36')]>=0x1){var _0x429c74={'messageId':_0x3daa40[_0x5b44('0x37')]};if(_0x2326eb[_0x5b44('0x2e')]!=='GP'||!_0x2326eb[_0x5b44('0x38')]){_0x429c74[_0x5b44('0x39')]=!![];}return _0x294ea4[_0x5b44('0x16')](_0x429c74);}else{return logger[_0x5b44('0x19')](_0x5b44('0x28'),'afterCreate',_0x5b44('0x3a'),util[_0x5b44('0x3b')](_0x3daa40,{'showHidden':![],'depth':null}));}})[_0x5b44('0x18')](function(_0x545cb0){return logger[_0x5b44('0x19')](_0x5b44('0x28'),'afterCreate','skebby',util['inspect'](_0x545cb0,{'showHidden':![],'depth':null}));});}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x3a'),_0x5b44('0x3c'));}break;case _0x5b44('0x3d'):if(_0x2326eb[_0x5b44('0x1e')]){var _0x2b74e9={'recipient':_0x554caa[_0x5b44('0x22')],'message':_0x554caa[_0x5b44('0x21')],'sender':_0x2326eb[_0x5b44('0x3e')]||_0x2326eb['phone'],'authorization':_0x2326eb[_0x5b44('0x1e')]};var _0x102fbc={'method':_0x5b44('0x33'),'uri':_0x5b44('0x3f'),'body':_0x2b74e9,'json':!![]};rp(_0x102fbc)[_0x5b44('0x26')](function(_0x242f86){var _0x56294c={'messageId':_0x242f86[_0x5b44('0x40')]};if(!_0x2326eb[_0x5b44('0x38')]){_0x56294c[_0x5b44('0x39')]=!![];}return _0x294ea4['update'](_0x56294c);})['catch'](function(_0x2307f3){logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),'connectel',util['inspect'](_0x2307f3,{'showHidden':![],'depth':null}));});}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),'afterCreate',_0x5b44('0x3d'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x2326eb['username']&&_0x2326eb[_0x5b44('0x2d')]){var _0x2b74e9={'messages':[{'source':_0x5b44('0x41'),'to':_0x554caa['phone'],'body':_0x554caa[_0x5b44('0x21')],'from':_0x2326eb[_0x5b44('0x3e')]||_0x2326eb['phone']}]};var _0x124c91=util['format'](_0x5b44('0x42'),_0x2326eb[_0x5b44('0x2c')],_0x2326eb['password']);var _0x102fbc={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2b74e9,'headers':{'Authorization':util[_0x5b44('0x43')](_0x5b44('0x44'),new Buffer(_0x124c91)[_0x5b44('0x45')]('base64'))},'json':!![]};rp(_0x102fbc)['then'](function(_0x5571e4){if(_0x5571e4[_0x5b44('0x46')]>=0xc8&&_0x5571e4['http_code']<=0xce){if(_0x5571e4[_0x5b44('0x47')]&&_0x5571e4['data'][_0x5b44('0x48')]>0x0){var _0x35bfa0=_[_0x5b44('0x49')](_0x5571e4[_0x5b44('0x47')][_0x5b44('0x1f')]);var _0x2c441c={'messageId':_0x35bfa0['message_id']};if(!_0x2326eb[_0x5b44('0x38')]){_0x2c441c[_0x5b44('0x39')]=!![];}return _0x294ea4['update'](_0x2c441c);}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),'clickSend',util['inspect'](_0x5571e4,{'showHidden':![],'depth':null}));}}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x4a'),util['inspect'](_0x5571e4,{'showHidden':![],'depth':null}));}})[_0x5b44('0x18')](function(_0x3cc2e8){logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),'clickSend',util[_0x5b44('0x3b')](_0x3cc2e8,{'showHidden':![],'depth':null}));});}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),'afterCreate',_0x5b44('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x2326eb['authId']&&_0x2326eb[_0x5b44('0x1e')]){var _0x2b74e9={'dst':_0x554caa['phone'],'text':_0x554caa['body'],'src':_0x2326eb[_0x5b44('0x3e')]||_0x2326eb['phone'],'url':_0x2326eb[_0x5b44('0x23')]+'/api/sms/messages/'+_0x554caa['id']+_0x5b44('0x25')+_0x2326eb[_0x5b44('0x4b')]};var _0x124c91=util[_0x5b44('0x43')](_0x5b44('0x42'),_0x2326eb[_0x5b44('0x4c')],_0x2326eb[_0x5b44('0x1e')]);var _0x102fbc={'method':'POST','uri':util[_0x5b44('0x43')](_0x5b44('0x4d'),_0x2326eb[_0x5b44('0x4c')]),'body':_0x2b74e9,'headers':{'Authorization':util[_0x5b44('0x43')](_0x5b44('0x44'),new Buffer(_0x124c91)['toString']('base64'))},'json':!![]};rp(_0x102fbc)[_0x5b44('0x26')](function(_0x59580f){var _0x4cd337={'messageId':_0x59580f[_0x5b44('0x4e')][0x0]};return _0x294ea4[_0x5b44('0x16')](_0x4cd337);})['catch'](function(_0xeb4ab0){logger[_0x5b44('0x19')](_0x5b44('0x28'),'afterCreate',_0x5b44('0x4f'),util[_0x5b44('0x3b')](_0xeb4ab0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5b44('0x28'),_0x5b44('0x29'),'plivo',_0x5b44('0x50'));}break;case _0x5b44('0x51'):if(_0x2326eb['username']&&_0x2326eb[_0x5b44('0x2d')]){if(_0x2326eb[_0x5b44('0x52')]){var _0x435d9b={'method':_0x5b44('0x33'),'uri':_0x2326eb['baseUrl']+'/auth/1/session','body':{'username':_0x2326eb['username'],'password':_0x2326eb[_0x5b44('0x2d')]},'json':!![]};return rp(_0x435d9b)[_0x5b44('0x26')](function(_0x161989){var _0x4f9a6c={'method':_0x5b44('0x33'),'uri':_0x2326eb['baseUrl']+_0x5b44('0x53'),'body':{'messages':[{'from':_0x2326eb[_0x5b44('0x22')],'destinations':[{'to':_0x554caa[_0x5b44('0x22')]}],'text':_0x554caa[_0x5b44('0x21')],'notifyUrl':_0x2326eb[_0x5b44('0x23')]+_0x5b44('0x24')+_0x554caa['id']+_0x5b44('0x25')+_0x2326eb[_0x5b44('0x4b')],'notifyContentType':_0x5b44('0x54'),'callbackData':_0x2326eb[_0x5b44('0x22')]+';'+_0x554caa[_0x5b44('0x21')]}]},'headers':{'Authorization':_0x5b44('0x55')+_0x161989['token']},'json':!![]};return rp(_0x4f9a6c)[_0x5b44('0x26')](function(_0x15824e){if(_0x15824e['messages']){var _0x54921a={'messageId':_0x15824e[_0x5b44('0x1f')][0x0][_0x5b44('0x9')]};if(!_0x2326eb[_0x5b44('0x38')]){_0x54921a['read']=!![];}return _0x294ea4[_0x5b44('0x16')](_0x54921a);}else{return logger[_0x5b44('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5b44('0x51'),util[_0x5b44('0x3b')](_0x15824e,{'showHidden':![],'depth':null}));}});})[_0x5b44('0x18')](function(_0x60bc8b){return logger[_0x5b44('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b44('0x29'),_0x5b44('0x51'),util[_0x5b44('0x3b')](_0x60bc8b,{'showHidden':![],'depth':null}));});}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),'infobip',_0x5b44('0x56'));}}else{logger['error'](_0x5b44('0x28'),'afterCreate','infobip',_0x5b44('0x3c'));}break;case _0x5b44('0x57'):var _0x6181f5=require(_0x5b44('0x58'));if(_0x2326eb[_0x5b44('0x59')]){var _0x5f1d85={};_0x5f1d85[_0x5b44('0x5a')]=_0x2326eb['username'];_0x5f1d85[_0x5b44('0x22')]=_0x554caa[_0x5b44('0x22')];_0x5f1d85[_0x5b44('0x5b')]=_0x2326eb[_0x5b44('0x22')];_0x5f1d85[_0x5b44('0x5c')]=_0x554caa['body'];_0x5f1d85[_0x5b44('0x5d')]=+new Date();var _0x59321b='';var _0x408104='';var _0x5b1ab9=Object['keys'](_0x5f1d85);_0x5b1ab9[_0x5b44('0x5e')]();for(var _0x26a937=0x0;_0x26a937<_0x5b1ab9[_0x5b44('0x5f')];_0x26a937++){if(_0x59321b!=''){_0x59321b+='&';}_0x59321b+=_0x5b1ab9[_0x26a937]+'='+encodeURIComponent(_0x5f1d85[_0x5b1ab9[_0x26a937]]);_0x408104+=_0x5f1d85[_0x5b1ab9[_0x26a937]];}_0x408104+=_0x2326eb[_0x5b44('0x59')];_0x408104=_0x6181f5[_0x5b44('0x60')](_0x5b44('0x61'))[_0x5b44('0x16')](_0x408104)[_0x5b44('0x62')](_0x5b44('0x63'));if(_0x59321b!==''){_0x59321b+='&';}_0x59321b+=_0x5b44('0x64')+_0x408104;var _0x2962ba={'method':'GET','uri':_0x2326eb[_0x5b44('0x52')]+_0x5b44('0x65')+_0x59321b,'json':!![]};return rp(_0x2962ba)[_0x5b44('0x26')](function(_0x20b1b2){var _0x4e1812=Object['keys'](_0x20b1b2);if(_0x20b1b2[_0x4e1812[0x0]][_0x5b44('0x19')]&&parseInt(_0x20b1b2[_0x4e1812[0x0]][_0x5b44('0x19')])===0x0){var _0x6255ac={'messageId':_0x20b1b2[_0x4e1812[0x0]][_0x5b44('0x66')]};if(!_0x2326eb[_0x5b44('0x38')]){_0x6255ac[_0x5b44('0x39')]=!![];}return _0x294ea4[_0x5b44('0x16')](_0x6255ac);}else{return logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x57'),util[_0x5b44('0x3b')](_0x20b1b2[_0x5b44('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x41789a){return logger['error'](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x57'),util[_0x5b44('0x3b')](_0x41789a,{'showHidden':![],'depth':null}));});}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x57'),_0x5b44('0x67'));}break;case _0x5b44('0x68'):if(_0x2326eb[_0x5b44('0x59')]){var _0x39423a={'method':_0x5b44('0x33'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2326eb['apiKey']},'body':{'content':_0x554caa[_0x5b44('0x21')],'to':[_0x554caa[_0x5b44('0x22')]],'from':_0x2326eb[_0x5b44('0x22')],'binary':![],'clientMessageId':_0x5b44('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x39423a)[_0x5b44('0x26')](function(_0x50032c){if(!_0x50032c[_0x5b44('0x19')]){var _0x465a91={'messageId':_0x50032c[_0x5b44('0x1f')][0x0][_0x5b44('0x6a')]};if(!_0x2326eb[_0x5b44('0x38')]){_0x465a91['read']=!![];}return _0x294ea4[_0x5b44('0x16')](_0x465a91);}else{return logger['error'](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x68'),util[_0x5b44('0x3b')](_0x50032c['error'],{'showHidden':![],'depth':null}));}})[_0x5b44('0x18')](function(_0x3ebf61){return logger['error'](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x68'),util[_0x5b44('0x3b')](_0x3ebf61,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5b44('0x68'),_0x5b44('0x67'));}break;case _0x5b44('0x6b'):if(_0x2326eb[_0x5b44('0x2c')]&&_0x2326eb[_0x5b44('0x2d')]){var _0x124c91=util[_0x5b44('0x43')](_0x5b44('0x42'),_0x2326eb[_0x5b44('0x2c')],_0x2326eb[_0x5b44('0x2d')]);var _0x102fbc={'method':_0x5b44('0x33'),'uri':_0x5b44('0x6c')+_0x2326eb[_0x5b44('0x6d')]+_0x5b44('0x6e'),'body':{'to':[_0x554caa[_0x5b44('0x22')]],'text':_0x554caa[_0x5b44('0x21')],'from':_0x2326eb[_0x5b44('0x22')],'applicationId':_0x2326eb[_0x5b44('0x6f')]},'headers':{'Authorization':util[_0x5b44('0x43')](_0x5b44('0x44'),new Buffer(_0x124c91)['toString'](_0x5b44('0x70')))},'json':!![]};rp(_0x102fbc)[_0x5b44('0x26')](function(_0x5a9fba){if(_0x5a9fba['id']){var _0xfb4bd1={'messageId':_0x5a9fba['id']};return _0x294ea4[_0x5b44('0x16')](_0xfb4bd1);}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),'bandwidth',util[_0x5b44('0x3b')](_0x5a9fba,{'showHidden':![],'depth':null}));}})['catch'](function(_0x15fe65){logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),'bandwidth',util[_0x5b44('0x3b')](_0x15fe65,{'showHidden':![],'depth':null}));});}else{logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5b44('0x71'):if(_0x2326eb[_0x5b44('0x59')]){var _0x10dace={};var _0x2962ba={'method':_0x5b44('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x5b44('0x72')+_0x2326eb[_0x5b44('0x59')],'Content-Type':'application/json'},'body':{'from':_0x2326eb['phone'],'to':_0x554caa[_0x5b44('0x22')],'text':_0x554caa[_0x5b44('0x21')]},'json':!![]};return rp(_0x2962ba)['then'](function(_0x155400){if(_0x155400[_0x5b44('0x73')]==0xca){_0x10dace[_0x5b44('0x74')]=_0x155400;var _0x46b134={'method':_0x5b44('0x33'),'uri':_0x5b44('0x75'),'headers':{'Authorization':_0x5b44('0x72')+_0x2326eb[_0x5b44('0x59')],'Content-Type':_0x5b44('0x54')},'body':{'refid':_0x10dace[_0x5b44('0x74')][_0x5b44('0x76')]},'json':!![]};return rp(_0x46b134)[_0x5b44('0x26')](function(_0xdd4fc){_0x10dace[_0x5b44('0x77')]=_0xdd4fc;var _0x5a6e04={'messageId':_0x10dace[_0x5b44('0x74')][_0x5b44('0x76')],'read':!![]};return _0x294ea4[_0x5b44('0x16')](_0x5a6e04);});}else{return logger[_0x5b44('0x19')](_0x5b44('0x28'),'afterCreate',_0x5b44('0x71'),util[_0x5b44('0x3b')](_0x155400,{'showHidden':![],'depth':null}));}})[_0x5b44('0x18')](function(_0x47d8de){return logger[_0x5b44('0x19')](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x71'),util['inspect'](_0x47d8de,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x5b44('0x28'),_0x5b44('0x29'),_0x5b44('0x71'),'Token\x20not\x20received');}break;}}})[_0x5b44('0x78')](function(){_0x1c7b0f();});}else{_0x1c7b0f();}}},'charset':_0x5b44('0x79'),'collate':_0x5b44('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 14f397c..a8ddaf2 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 _0x2b3f=['stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x381bff,_0x19d01f){var _0x201ab1=function(_0x7d6446){while(--_0x7d6446){_0x381bff['push'](_0x381bff['shift']());}};_0x201ab1(++_0x19d01f);}(_0x2b3f,0x94));var _0xf2b3=function(_0x2be3a1,_0x56e62f){_0x2be3a1=_0x2be3a1-0x0;var _0x1c2260=_0x2b3f[_0x2be3a1];return _0x1c2260;};'use strict';var _=require(_0xf2b3('0x0'));var util=require('util');var moment=require(_0xf2b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xf2b3('0x2'));var fs=require('fs');var Redis=require(_0xf2b3('0x3'));var db=require(_0xf2b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2b3('0x5'))(_0xf2b3('0x6'));var config=require(_0xf2b3('0x7'));var jayson=require(_0xf2b3('0x8'));var client=jayson[_0xf2b3('0x9')][_0xf2b3('0xa')]({'port':0x232a});config[_0xf2b3('0xb')]=_[_0xf2b3('0xc')](config[_0xf2b3('0xb')],{'host':_0xf2b3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf2b3('0xb')]));require(_0xf2b3('0xe'))[_0xf2b3('0xf')](socket);function respondWithRpcPromise(_0x4fb8c6,_0x50599d,_0x5322da){return new BPromise(function(_0x6fe18e,_0x19fe1f){return client[_0xf2b3('0x10')](_0x4fb8c6,_0x5322da)[_0xf2b3('0x11')](function(_0x26b835){logger[_0xf2b3('0x12')]('SmsMessage,\x20%s,\x20%s',_0x50599d,'request\x20sent');logger[_0xf2b3('0x13')](_0xf2b3('0x14'),_0x50599d,_0xf2b3('0x15'),JSON[_0xf2b3('0x16')](_0x26b835));if(_0x26b835[_0xf2b3('0x17')]){if(_0x26b835['error'][_0xf2b3('0x18')]===0x1f4){logger[_0xf2b3('0x17')]('SmsMessage,\x20%s,\x20%s',_0x50599d,_0x26b835['error']['message']);return _0x19fe1f(_0x26b835[_0xf2b3('0x17')]['message']);}logger[_0xf2b3('0x17')](_0xf2b3('0x19'),_0x50599d,_0x26b835[_0xf2b3('0x17')]['message']);return _0x6fe18e(_0x26b835['error'][_0xf2b3('0x1a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x50599d,_0xf2b3('0x15'));_0x6fe18e(_0x26b835['result'][_0xf2b3('0x1a')]);}})[_0xf2b3('0x1b')](function(_0x114b8e){logger[_0xf2b3('0x17')](_0xf2b3('0x19'),_0x50599d,_0x114b8e);_0x19fe1f(_0x114b8e);});});}exports[_0xf2b3('0x1c')]=function(_0xcd50db){var _0x554cfb=this;return new Promise(function(_0x475511,_0x587c4e){return db[_0xf2b3('0x1d')][_0xf2b3('0x1e')](_0xcd50db[_0xf2b3('0x1f')],{'raw':_0xcd50db[_0xf2b3('0x20')]?_0xcd50db[_0xf2b3('0x20')][_0xf2b3('0x21')]===undefined?!![]:![]:!![]})[_0xf2b3('0x11')](function(_0x5498ff){logger[_0xf2b3('0x12')](_0xf2b3('0x1c'),_0xcd50db);logger[_0xf2b3('0x13')](_0xf2b3('0x1c'),_0xcd50db,JSON[_0xf2b3('0x16')](_0x5498ff));_0x475511(_0x5498ff);})['catch'](function(_0x511ba8){logger[_0xf2b3('0x17')](_0xf2b3('0x1c'),_0x511ba8['message'],_0xcd50db);_0x587c4e(_0x554cfb['error'](0x1f4,_0x511ba8[_0xf2b3('0x1a')]));});});}; \ No newline at end of file +var _0x906e=['rpc','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','raw','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xad09f,_0x4b72a8){var _0xf1baf4=function(_0x4f11d6){while(--_0x4f11d6){_0xad09f['push'](_0xad09f['shift']());}};_0xf1baf4(++_0x4b72a8);}(_0x906e,0x71));var _0xe906=function(_0x3543e7,_0x501fcf){_0x3543e7=_0x3543e7-0x0;var _0x42df23=_0x906e[_0x3543e7];return _0x42df23;};'use strict';var _=require('lodash');var util=require(_0xe906('0x0'));var moment=require('moment');var BPromise=require(_0xe906('0x1'));var rs=require(_0xe906('0x2'));var fs=require('fs');var Redis=require(_0xe906('0x3'));var db=require(_0xe906('0x4'))['db'];var utils=require(_0xe906('0x5'));var logger=require(_0xe906('0x6'))(_0xe906('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe906('0x8')]({'port':0x232a});config[_0xe906('0x9')]=_[_0xe906('0xa')](config[_0xe906('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe906('0xb'))(new Redis(config[_0xe906('0x9')]));require('./smsMessage.socket')[_0xe906('0xc')](socket);function respondWithRpcPromise(_0x2da14a,_0x84c240,_0x282842){return new BPromise(function(_0x41cfa6,_0x192c4f){return client[_0xe906('0xd')](_0x2da14a,_0x282842)[_0xe906('0xe')](function(_0x2f5178){logger[_0xe906('0xf')](_0xe906('0x10'),_0x84c240,_0xe906('0x11'));logger['debug'](_0xe906('0x12'),_0x84c240,'request\x20sent',JSON[_0xe906('0x13')](_0x2f5178));if(_0x2f5178[_0xe906('0x14')]){if(_0x2f5178[_0xe906('0x14')][_0xe906('0x15')]===0x1f4){logger[_0xe906('0x14')](_0xe906('0x10'),_0x84c240,_0x2f5178[_0xe906('0x14')][_0xe906('0x16')]);return _0x192c4f(_0x2f5178['error']['message']);}logger[_0xe906('0x14')](_0xe906('0x10'),_0x84c240,_0x2f5178[_0xe906('0x14')][_0xe906('0x16')]);return _0x41cfa6(_0x2f5178[_0xe906('0x14')][_0xe906('0x16')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x84c240,_0xe906('0x11'));_0x41cfa6(_0x2f5178[_0xe906('0x17')][_0xe906('0x16')]);}})[_0xe906('0x18')](function(_0x1ce5e5){logger[_0xe906('0x14')](_0xe906('0x10'),_0x84c240,_0x1ce5e5);_0x192c4f(_0x1ce5e5);});});}exports[_0xe906('0x19')]=function(_0x5b3886){var _0x4fe558=this;return new Promise(function(_0x2dede7,_0x40326f){return db['SmsMessage'][_0xe906('0x1a')](_0x5b3886[_0xe906('0x1b')],{'raw':_0x5b3886['options']?_0x5b3886['options'][_0xe906('0x1c')]===undefined?!![]:![]:!![]})[_0xe906('0xe')](function(_0x2a1eb4){logger[_0xe906('0xf')](_0xe906('0x19'),_0x5b3886);logger[_0xe906('0x1d')](_0xe906('0x19'),_0x5b3886,JSON[_0xe906('0x13')](_0x2a1eb4));_0x2dede7(_0x2a1eb4);})[_0xe906('0x18')](function(_0x2c779c){logger[_0xe906('0x14')](_0xe906('0x19'),_0x2c779c[_0xe906('0x16')],_0x5b3886);_0x40326f(_0x4fe558['error'](0x1f4,_0x2c779c[_0xe906('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 99caeed..aa9699e 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 _0x5348=['register','length','smsMessage:','./smsMessage.events','save','remove','update','removeListener'];(function(_0x35f5a5,_0x506e83){var _0x2619e4=function(_0x2928b5){while(--_0x2928b5){_0x35f5a5['push'](_0x35f5a5['shift']());}};_0x2619e4(++_0x506e83);}(_0x5348,0x6b));var _0x8534=function(_0x8193e0,_0x361918){_0x8193e0=_0x8193e0-0x0;var _0x10a904=_0x5348[_0x8193e0];return _0x10a904;};'use strict';var SmsMessageEvents=require(_0x8534('0x0'));var events=[_0x8534('0x1'),_0x8534('0x2'),_0x8534('0x3')];function createListener(_0x230ddc,_0x4a371c){return function(_0x5a4280){_0x4a371c['emit'](_0x230ddc,_0x5a4280);};}function removeListener(_0x25d470,_0x194e1f){return function(){SmsMessageEvents[_0x8534('0x4')](_0x25d470,_0x194e1f);};}exports[_0x8534('0x5')]=function(_0xd558a7){for(var _0x407a49=0x0,_0x255c5f=events[_0x8534('0x6')];_0x407a49<_0x255c5f;_0x407a49++){var _0xd9abea=events[_0x407a49];var _0x5c1dee=createListener(_0x8534('0x7')+_0xd9abea,_0xd558a7);SmsMessageEvents['on'](_0xd9abea,_0x5c1dee);}}; \ No newline at end of file +var _0x8eb7=['./smsMessage.events','remove','removeListener','register','length','smsMessage:'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x8eb7,0xe4));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x78eb('0x0'));var events=['save',_0x78eb('0x1'),'update'];function createListener(_0x1dcc08,_0xd6ea0f){return function(_0x5bfcfe){_0xd6ea0f['emit'](_0x1dcc08,_0x5bfcfe);};}function removeListener(_0x571f42,_0x575279){return function(){SmsMessageEvents[_0x78eb('0x2')](_0x571f42,_0x575279);};}exports[_0x78eb('0x3')]=function(_0x2a871d){for(var _0x3ba316=0x0,_0x4fed17=events[_0x78eb('0x4')];_0x3ba316<_0x4fed17;_0x3ba316++){var _0x5044f3=events[_0x3ba316];var _0x26bc42=createListener(_0x78eb('0x5')+_0x5044f3,_0x2a871d);SmsMessageEvents['on'](_0x5044f3,_0x26bc42);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e21a06d..9eb983e 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 _0x486e=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','update','delete','/:id','destroy','removeTeams','exports'];(function(_0xb3a764,_0x22fdc0){var _0x2de877=function(_0xf052){while(--_0xf052){_0xb3a764['push'](_0xb3a764['shift']());}};_0x2de877(++_0x22fdc0);}(_0x486e,0x1e6));var _0xe486=function(_0x38394c,_0x2d014d){_0x38394c=_0x38394c-0x0;var _0x42a1c8=_0x486e[_0x38394c];return _0x42a1c8;};'use strict';var multer=require(_0xe486('0x0'));var util=require(_0xe486('0x1'));var path=require(_0xe486('0x2'));var timeout=require(_0xe486('0x3'));var express=require('express');var router=express[_0xe486('0x4')]();var fs_extra=require(_0xe486('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe486('0x6'));var config=require(_0xe486('0x7'));var controller=require('./smsQueue.controller');router[_0xe486('0x8')]('/',auth[_0xe486('0x9')](),controller[_0xe486('0xa')]);router[_0xe486('0x8')]('/describe',auth[_0xe486('0x9')](),controller[_0xe486('0xb')]);router[_0xe486('0x8')]('/:id',auth[_0xe486('0x9')](),controller[_0xe486('0xc')]);router['get']('/:id/members',auth[_0xe486('0x9')](),controller[_0xe486('0xd')]);router['get']('/:id/teams',auth[_0xe486('0x9')](),controller[_0xe486('0xe')]);router[_0xe486('0x8')](_0xe486('0xf'),auth[_0xe486('0x9')](),controller['getAgents']);router['post']('/',auth[_0xe486('0x9')](),controller[_0xe486('0x10')]);router[_0xe486('0x11')](_0xe486('0x12'),auth[_0xe486('0x9')](),controller[_0xe486('0x13')]);router[_0xe486('0x11')](_0xe486('0xf'),auth[_0xe486('0x9')](),controller[_0xe486('0x14')]);router['put']('/:id',auth[_0xe486('0x9')](),controller[_0xe486('0x15')]);router[_0xe486('0x16')](_0xe486('0x17'),auth[_0xe486('0x9')](),controller[_0xe486('0x18')]);router['delete'](_0xe486('0x12'),auth['isAuthenticated'](),controller[_0xe486('0x19')]);router['delete']('/:id/users',auth[_0xe486('0x9')](),controller['removeAgents']);module[_0xe486('0x1a')]=router; \ No newline at end of file +var _0x158e=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','get','/describe','describe','show','/:id/members','getMembers'];(function(_0x31ac19,_0x2e88d9){var _0x470da5=function(_0x3d494d){while(--_0x3d494d){_0x31ac19['push'](_0x31ac19['shift']());}};_0x470da5(++_0x2e88d9);}(_0x158e,0x1f0));var _0xe158=function(_0x11ba4f,_0x276ea2){_0x11ba4f=_0x11ba4f-0x0;var _0x182c8c=_0x158e[_0x11ba4f];return _0x182c8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe158('0x0'));var timeout=require(_0xe158('0x1'));var express=require(_0xe158('0x2'));var router=express[_0xe158('0x3')]();var fs_extra=require(_0xe158('0x4'));var auth=require(_0xe158('0x5'));var interaction=require(_0xe158('0x6'));var config=require(_0xe158('0x7'));var controller=require(_0xe158('0x8'));router['get']('/',auth[_0xe158('0x9')](),controller['index']);router[_0xe158('0xa')](_0xe158('0xb'),auth[_0xe158('0x9')](),controller[_0xe158('0xc')]);router['get']('/:id',auth[_0xe158('0x9')](),controller[_0xe158('0xd')]);router[_0xe158('0xa')](_0xe158('0xe'),auth['isAuthenticated'](),controller[_0xe158('0xf')]);router[_0xe158('0xa')](_0xe158('0x10'),auth[_0xe158('0x9')](),controller[_0xe158('0x11')]);router['get'](_0xe158('0x12'),auth[_0xe158('0x9')](),controller[_0xe158('0x13')]);router[_0xe158('0x14')]('/',auth['isAuthenticated'](),controller[_0xe158('0x15')]);router[_0xe158('0x14')](_0xe158('0x10'),auth[_0xe158('0x9')](),controller[_0xe158('0x16')]);router['post']('/:id/users',auth[_0xe158('0x9')](),controller[_0xe158('0x17')]);router[_0xe158('0x18')](_0xe158('0x19'),auth['isAuthenticated'](),controller[_0xe158('0x1a')]);router[_0xe158('0x1b')](_0xe158('0x19'),auth[_0xe158('0x9')](),controller[_0xe158('0x1c')]);router['delete']('/:id/teams',auth[_0xe158('0x9')](),controller[_0xe158('0x1d')]);router[_0xe158('0x1b')]('/:id/users',auth[_0xe158('0x9')](),controller[_0xe158('0x1e')]);module[_0xe158('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 28273ca..c284d61 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 _0xaace=['STRING','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2bd0dd,_0x167fb0){var _0x4637bb=function(_0x1bf601){while(--_0x1bf601){_0x2bd0dd['push'](_0x2bd0dd['shift']());}};_0x4637bb(++_0x167fb0);}(_0xaace,0x1da));var _0xeaac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaace[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xeaac('0x0'));module[_0xeaac('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeaac('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeaac('0x3')](_0xeaac('0x4'),_0xeaac('0x5'),_0xeaac('0x6'))}}; \ No newline at end of file +var _0x50ec=['sequelize','name','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4d8744,_0x203345){var _0x17fb37=function(_0x216209){while(--_0x216209){_0x4d8744['push'](_0x4d8744['shift']());}};_0x17fb37(++_0x203345);}(_0x50ec,0x15e));var _0xc50e=function(_0x52259b,_0x23bd24){_0x52259b=_0x52259b-0x0;var _0x3ecf06=_0x50ec[_0x52259b];return _0x3ecf06;};'use strict';var Sequelize=require(_0xc50e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc50e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc50e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc50e('0x3')](_0xc50e('0x4'),_0xc50e('0x5'),_0xc50e('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 15bcf19..a06e42f 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 _0xc767=['socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SmsQueue','include','rows','catch','show','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Team','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','value','isEmpty','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost'];(function(_0x3c1a14,_0x4912cb){var _0x31e595=function(_0xd4b038){while(--_0xd4b038){_0x3c1a14['push'](_0x3c1a14['shift']());}};_0x31e595(++_0x4912cb);}(_0xc767,0x108));var _0x7c76=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0xc767[_0x2cc569];return _0x1bfc2e;};'use strict';var emlformat=require(_0x7c76('0x0'));var rimraf=require(_0x7c76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7c76('0x2'));var moment=require(_0x7c76('0x3'));var BPromise=require(_0x7c76('0x4'));var Mustache=require(_0x7c76('0x5'));var util=require('util');var path=require(_0x7c76('0x6'));var sox=require(_0x7c76('0x7'));var csv=require(_0x7c76('0x8'));var ejs=require(_0x7c76('0x9'));var fs=require('fs');var fs_extra=require(_0x7c76('0xa'));var _=require(_0x7c76('0xb'));var squel=require(_0x7c76('0xc'));var crypto=require(_0x7c76('0xd'));var jsforce=require(_0x7c76('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7c76('0x8'));var querystring=require(_0x7c76('0xf'));var Papa=require('papaparse');var Redis=require(_0x7c76('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7c76('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c76('0x12'));var logger=require(_0x7c76('0x13'))('api');var utils=require(_0x7c76('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7c76('0x15'));var db=require('../../mysqldb')['db'];config[_0x7c76('0x16')]=_['defaults'](config[_0x7c76('0x16')],{'host':_0x7c76('0x17'),'port':0x18eb});var socket=require(_0x7c76('0x18'))(new Redis(config[_0x7c76('0x16')]));require(_0x7c76('0x19'))[_0x7c76('0x1a')](socket);function respondWithStatusCode(_0x2f559f,_0x33173f){_0x33173f=_0x33173f||0xcc;return function(_0x1cbdec){if(_0x1cbdec){return _0x2f559f[_0x7c76('0x1b')](_0x33173f);}return _0x2f559f[_0x7c76('0x1c')](_0x33173f)[_0x7c76('0x1d')]();};}function respondWithResult(_0x27b23e,_0x23dc86){_0x23dc86=_0x23dc86||0xc8;return function(_0x1be8ff){if(_0x1be8ff){return _0x27b23e['status'](_0x23dc86)[_0x7c76('0x1e')](_0x1be8ff);}};}function respondWithFilteredResult(_0x42c848,_0x12a42d){return function(_0x1690e5){if(_0x1690e5){var _0x4fc890=typeof _0x12a42d[_0x7c76('0x1f')]==='undefined'&&typeof _0x12a42d[_0x7c76('0x20')]===_0x7c76('0x21');var _0x18a938=_0x1690e5['count'];var _0x5e843b=_0x4fc890?0x0:_0x12a42d[_0x7c76('0x1f')];var _0x9c5179=_0x4fc890?_0x1690e5[_0x7c76('0x22')]:_0x12a42d['offset']+_0x12a42d[_0x7c76('0x20')];var _0x279385;if(_0x9c5179>=_0x18a938){_0x9c5179=_0x18a938;_0x279385=0xc8;}else{_0x279385=0xce;}_0x42c848[_0x7c76('0x1c')](_0x279385);return _0x42c848[_0x7c76('0x23')](_0x7c76('0x24'),_0x5e843b+'-'+_0x9c5179+'/'+_0x18a938)[_0x7c76('0x1e')](_0x1690e5);}return null;};}function patchUpdates(_0x4a6c24){return function(_0xe38150){try{jsonpatch[_0x7c76('0x25')](_0xe38150,_0x4a6c24,!![]);}catch(_0x43ab){return BPromise[_0x7c76('0x26')](_0x43ab);}return _0xe38150[_0x7c76('0x27')]();};}function saveUpdates(_0x7cb6d1,_0x185451){return function(_0x2d5524){if(_0x2d5524){return _0x2d5524[_0x7c76('0x28')](_0x7cb6d1)[_0x7c76('0x29')](function(_0x40eff3){return _0x40eff3;});}return null;};}function removeEntity(_0x5b2ab6,_0x5f43b5){return function(_0x2bc4d9){if(_0x2bc4d9){return _0x2bc4d9[_0x7c76('0x2a')]()['then'](function(){var _0x1ae7ec=_0x2bc4d9[_0x7c76('0x2b')]({'plain':!![]});var _0x54e1bf=_0x7c76('0x2c');return db[_0x7c76('0x2d')][_0x7c76('0x2a')]({'where':{'type':_0x54e1bf,'resourceId':_0x1ae7ec['id']}})[_0x7c76('0x29')](function(){return _0x2bc4d9;});})[_0x7c76('0x29')](function(){_0x5b2ab6[_0x7c76('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1749ba,_0x5586f7){return function(_0x44a7e1){if(!_0x44a7e1){_0x1749ba[_0x7c76('0x1b')](0x194);}return _0x44a7e1;};}function handleError(_0x82d51,_0x15e9f3){_0x15e9f3=_0x15e9f3||0x1f4;return function(_0x3e8c3e){logger[_0x7c76('0x2e')](_0x3e8c3e[_0x7c76('0x2f')]);if(_0x3e8c3e['name']){delete _0x3e8c3e['name'];}_0x82d51[_0x7c76('0x1c')](_0x15e9f3)[_0x7c76('0x30')](_0x3e8c3e);};}exports[_0x7c76('0x31')]=function(_0x3327b2,_0x3f690f){var _0x187cf4={},_0x3ca4d4={},_0x17d3f0={'count':0x0,'rows':[]};var _0x256a27=_[_0x7c76('0x32')](db['SmsQueue']['rawAttributes'],function(_0x4bbf9c){return{'name':_0x4bbf9c[_0x7c76('0x33')],'type':_0x4bbf9c[_0x7c76('0x34')][_0x7c76('0x35')]};});_0x3ca4d4[_0x7c76('0x36')]=_[_0x7c76('0x32')](_0x256a27,'name');_0x3ca4d4[_0x7c76('0x37')]=_[_0x7c76('0x38')](_0x3327b2[_0x7c76('0x37')]);_0x3ca4d4[_0x7c76('0x39')]=_[_0x7c76('0x3a')](_0x3ca4d4['model'],_0x3ca4d4[_0x7c76('0x37')]);_0x187cf4['attributes']=_[_0x7c76('0x3a')](_0x3ca4d4[_0x7c76('0x36')],qs[_0x7c76('0x3b')](_0x3327b2[_0x7c76('0x37')][_0x7c76('0x3b')]));_0x187cf4[_0x7c76('0x3c')]=_0x187cf4[_0x7c76('0x3c')][_0x7c76('0x3d')]?_0x187cf4[_0x7c76('0x3c')]:_0x3ca4d4[_0x7c76('0x36')];if(!_0x3327b2['query'][_0x7c76('0x3e')](_0x7c76('0x3f'))){_0x187cf4[_0x7c76('0x20')]=qs[_0x7c76('0x20')](_0x3327b2[_0x7c76('0x37')][_0x7c76('0x20')]);_0x187cf4[_0x7c76('0x1f')]=qs[_0x7c76('0x1f')](_0x3327b2[_0x7c76('0x37')][_0x7c76('0x1f')]);}_0x187cf4[_0x7c76('0x40')]=qs['sort'](_0x3327b2[_0x7c76('0x37')][_0x7c76('0x41')]);_0x187cf4['where']=qs[_0x7c76('0x39')](_[_0x7c76('0x42')](_0x3327b2['query'],_0x3ca4d4[_0x7c76('0x39')]),_0x256a27);if(_0x3327b2[_0x7c76('0x37')][_0x7c76('0x43')]){_0x187cf4[_0x7c76('0x44')]=_[_0x7c76('0x45')](_0x187cf4[_0x7c76('0x44')],{'$or':_[_0x7c76('0x32')](_0x256a27,function(_0x3f685f){if(_0x3f685f[_0x7c76('0x34')]!==_0x7c76('0x46')){var _0x556020={};_0x556020[_0x3f685f['name']]={'$like':'%'+_0x3327b2[_0x7c76('0x37')][_0x7c76('0x43')]+'%'};return _0x556020;}})});}_0x187cf4=_[_0x7c76('0x45')]({},_0x187cf4,_0x3327b2['options']);var _0x3e603c={'where':_0x187cf4['where']};return db[_0x7c76('0x47')][_0x7c76('0x22')](_0x3e603c)[_0x7c76('0x29')](function(_0x42f548){_0x17d3f0[_0x7c76('0x22')]=_0x42f548;if(_0x3327b2[_0x7c76('0x37')]['includeAll']){_0x187cf4[_0x7c76('0x48')]=[{'all':!![]}];}return db[_0x7c76('0x47')]['findAll'](_0x187cf4);})[_0x7c76('0x29')](function(_0x1ad477){_0x17d3f0[_0x7c76('0x49')]=_0x1ad477;return _0x17d3f0;})[_0x7c76('0x29')](respondWithFilteredResult(_0x3f690f,_0x187cf4))[_0x7c76('0x4a')](handleError(_0x3f690f,null));};exports[_0x7c76('0x4b')]=function(_0x1fd88b,_0x4f190b){var _0x528080={'raw':!![],'where':{'id':_0x1fd88b['params']['id']}},_0x3fc6a0={};_0x3fc6a0['model']=_[_0x7c76('0x38')](db[_0x7c76('0x47')][_0x7c76('0x4c')]);_0x3fc6a0[_0x7c76('0x37')]=_['keys'](_0x1fd88b[_0x7c76('0x37')]);_0x3fc6a0[_0x7c76('0x39')]=_[_0x7c76('0x3a')](_0x3fc6a0[_0x7c76('0x36')],_0x3fc6a0[_0x7c76('0x37')]);_0x528080[_0x7c76('0x3c')]=_['intersection'](_0x3fc6a0['model'],qs[_0x7c76('0x3b')](_0x1fd88b[_0x7c76('0x37')][_0x7c76('0x3b')]));_0x528080[_0x7c76('0x3c')]=_0x528080['attributes'][_0x7c76('0x3d')]?_0x528080['attributes']:_0x3fc6a0[_0x7c76('0x36')];if(_0x1fd88b[_0x7c76('0x37')][_0x7c76('0x4d')]){_0x528080[_0x7c76('0x48')]=[{'all':!![]}];}_0x528080=_[_0x7c76('0x45')]({},_0x528080,_0x1fd88b[_0x7c76('0x4e')]);return db['SmsQueue'][_0x7c76('0x4f')](_0x528080)[_0x7c76('0x29')](handleEntityNotFound(_0x4f190b,null))[_0x7c76('0x29')](respondWithResult(_0x4f190b,null))[_0x7c76('0x4a')](handleError(_0x4f190b,null));};exports[_0x7c76('0x50')]=function(_0x50206a,_0x39dc4d){return db[_0x7c76('0x47')][_0x7c76('0x50')](_0x50206a['body'],{})[_0x7c76('0x29')](function(_0x1ab371){var _0x3f4d32=_0x50206a[_0x7c76('0x51')]['get']({'plain':!![]});if(!_0x3f4d32)throw new Error(_0x7c76('0x52'));if(_0x3f4d32['role']===_0x7c76('0x51')){var _0x1970ad=_0x1ab371['get']({'plain':!![]});var _0x7ff792='SmsQueues';return db[_0x7c76('0x53')][_0x7c76('0x4f')]({'where':{'name':_0x7ff792,'userProfileId':_0x3f4d32['userProfileId']},'raw':!![]})[_0x7c76('0x29')](function(_0x55346b){if(_0x55346b&&_0x55346b[_0x7c76('0x54')]===0x0){return db[_0x7c76('0x2d')][_0x7c76('0x50')]({'name':_0x1970ad[_0x7c76('0x55')],'resourceId':_0x1970ad['id'],'type':_0x55346b[_0x7c76('0x55')],'sectionId':_0x55346b['id']},{})[_0x7c76('0x29')](function(){return _0x1ab371;});}else{return _0x1ab371;}})[_0x7c76('0x4a')](function(_0x439be5){logger[_0x7c76('0x2e')](_0x7c76('0x56'),_0x439be5);throw _0x439be5;});}return _0x1ab371;})['then'](respondWithResult(_0x39dc4d,0xc9))[_0x7c76('0x4a')](handleError(_0x39dc4d,null));};exports[_0x7c76('0x28')]=function(_0x335ac3,_0x275a15){if(_0x335ac3[_0x7c76('0x57')]['id']){delete _0x335ac3['body']['id'];}return db[_0x7c76('0x47')]['find']({'where':{'id':_0x335ac3[_0x7c76('0x58')]['id']}})[_0x7c76('0x29')](handleEntityNotFound(_0x275a15,null))[_0x7c76('0x29')](saveUpdates(_0x335ac3[_0x7c76('0x57')],null))[_0x7c76('0x29')](respondWithResult(_0x275a15,null))[_0x7c76('0x4a')](handleError(_0x275a15,null));};exports['destroy']=function(_0x101d22,_0x165a56){return db[_0x7c76('0x47')][_0x7c76('0x4f')]({'where':{'id':_0x101d22['params']['id']}})[_0x7c76('0x29')](handleEntityNotFound(_0x165a56,null))[_0x7c76('0x29')](removeEntity(_0x165a56,null))[_0x7c76('0x4a')](handleError(_0x165a56,null));};exports['describe']=function(_0x21c741,_0x48cef4){return db[_0x7c76('0x47')][_0x7c76('0x59')]()[_0x7c76('0x29')](respondWithResult(_0x48cef4,null))[_0x7c76('0x4a')](handleError(_0x48cef4,null));};exports['getMembers']=function(_0x454b27,_0x285eba,_0x4781eb){var _0x1f3ac8={'raw':!![],'where':{}},_0x3beef8={},_0x2cd0d6;return db[_0x7c76('0x47')][_0x7c76('0x5a')]({'where':{'id':_0x454b27[_0x7c76('0x58')]['id']}})[_0x7c76('0x29')](handleEntityNotFound(_0x285eba,null))[_0x7c76('0x29')](function(_0x46d5e3){if(_0x46d5e3){_0x2cd0d6=_0x46d5e3[_0x7c76('0x2b')]({'plain':!![]});_0x3beef8[_0x7c76('0x36')]=_[_0x7c76('0x38')](db[_0x7c76('0x5b')][_0x7c76('0x4c')]);_0x3beef8['query']=_[_0x7c76('0x38')](_0x454b27['query']);_0x3beef8[_0x7c76('0x39')]=_[_0x7c76('0x3a')](_0x3beef8[_0x7c76('0x36')],_0x3beef8[_0x7c76('0x37')]);_0x1f3ac8[_0x7c76('0x3c')]=_['intersection'](_0x3beef8['model'],qs[_0x7c76('0x3b')](_0x454b27[_0x7c76('0x37')][_0x7c76('0x3b')]));_0x1f3ac8[_0x7c76('0x3c')]=_0x1f3ac8[_0x7c76('0x3c')]['length']?_0x1f3ac8['attributes']:_0x3beef8[_0x7c76('0x36')];if(!_0x454b27[_0x7c76('0x37')][_0x7c76('0x3e')](_0x7c76('0x3f'))){_0x1f3ac8[_0x7c76('0x20')]=qs[_0x7c76('0x20')](_0x454b27[_0x7c76('0x37')][_0x7c76('0x20')]);_0x1f3ac8[_0x7c76('0x1f')]=qs[_0x7c76('0x1f')](_0x454b27[_0x7c76('0x37')][_0x7c76('0x1f')]);}_0x1f3ac8[_0x7c76('0x40')]=qs['sort'](_0x454b27[_0x7c76('0x37')][_0x7c76('0x41')]);_0x1f3ac8[_0x7c76('0x44')]=qs['filters'](_['pick'](_0x454b27['query'],_0x3beef8[_0x7c76('0x39')]));_0x1f3ac8[_0x7c76('0x44')][_0x7c76('0x5c')]=_0x46d5e3['id'];if(_0x454b27['query'][_0x7c76('0x43')]){_0x1f3ac8[_0x7c76('0x44')]=_[_0x7c76('0x45')](_0x1f3ac8[_0x7c76('0x44')],{'$or':_['map'](_0x1f3ac8['attributes'],function(_0xec3894){var _0x606fbb={};_0x606fbb[_0xec3894]={'$like':'%'+_0x454b27[_0x7c76('0x37')]['filter']+'%'};return _0x606fbb;})});}_0x1f3ac8=_[_0x7c76('0x45')]({},_0x1f3ac8,_0x454b27[_0x7c76('0x4e')]);return db[_0x7c76('0x5b')][_0x7c76('0x5d')](_0x1f3ac8);}})[_0x7c76('0x29')](function(_0x5ec4eb){if(_0x5ec4eb){return db[_0x7c76('0x5e')][_0x7c76('0x5f')]({'where':{'id':_['map'](_0x5ec4eb,_0x7c76('0x60')),'role':_0x7c76('0x61')},'attributes':['id','name',_0x7c76('0x62'),_0x7c76('0x63'),_0x7c76('0x64')]});}})[_0x7c76('0x29')](function(_0x475caf){if(_0x475caf){return{'count':_0x475caf['count'],'rows':_[_0x7c76('0x32')](_0x475caf[_0x7c76('0x49')],function(_0x29a356){return{'membername':_0x29a356['name'],'UserId':_0x29a356['id'],'queue_name':_0x2cd0d6['name'],'SmsQueueId':_0x2cd0d6['id'],'interface':util[_0x7c76('0x65')]('%s/%s',_0x7c76('0x66'),_0x29a356[_0x7c76('0x55')]),'penalty':0x0,'paused':_0x29a356['smsPause'],'createdAt':_0x29a356[_0x7c76('0x64')],'updatedAt':_0x29a356[_0x7c76('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7c76('0x29')](respondWithFilteredResult(_0x285eba,_0x1f3ac8))[_0x7c76('0x4a')](handleError(_0x285eba,null));};exports[_0x7c76('0x67')]=function(_0x240a54,_0x5a0435,_0x184358){var _0x14125b={};var _0x550923={};var _0x26d244;var _0x14760a;return db[_0x7c76('0x47')]['findOne']({'where':{'id':_0x240a54['params']['id']}})['then'](handleEntityNotFound(_0x5a0435,null))[_0x7c76('0x29')](function(_0x2b42d7){if(_0x2b42d7){_0x26d244=_0x2b42d7;_0x550923[_0x7c76('0x36')]=_[_0x7c76('0x38')](db['Team'][_0x7c76('0x4c')]);_0x550923[_0x7c76('0x37')]=_[_0x7c76('0x38')](_0x240a54[_0x7c76('0x37')]);_0x550923['filters']=_[_0x7c76('0x3a')](_0x550923[_0x7c76('0x36')],_0x550923['query']);_0x14125b[_0x7c76('0x3c')]=_[_0x7c76('0x3a')](_0x550923[_0x7c76('0x36')],qs[_0x7c76('0x3b')](_0x240a54[_0x7c76('0x37')][_0x7c76('0x3b')]));_0x14125b[_0x7c76('0x3c')]=_0x14125b[_0x7c76('0x3c')][_0x7c76('0x3d')]?_0x14125b['attributes']:_0x550923[_0x7c76('0x36')];_0x14125b['order']=qs[_0x7c76('0x41')](_0x240a54[_0x7c76('0x37')][_0x7c76('0x41')]);_0x14125b[_0x7c76('0x44')]=qs[_0x7c76('0x39')](_['pick'](_0x240a54['query'],_0x550923[_0x7c76('0x39')]));if(_0x240a54[_0x7c76('0x37')]['filter']){_0x14125b[_0x7c76('0x44')]=_[_0x7c76('0x45')](_0x14125b['where'],{'$or':_[_0x7c76('0x32')](_0x14125b[_0x7c76('0x3c')],function(_0x344dc5){var _0x4f2fc2={};_0x4f2fc2[_0x344dc5]={'$like':'%'+_0x240a54[_0x7c76('0x37')]['filter']+'%'};return _0x4f2fc2;})});}_0x14125b=_[_0x7c76('0x45')]({},_0x14125b,_0x240a54[_0x7c76('0x4e')]);return _0x26d244[_0x7c76('0x67')](_0x14125b);}})[_0x7c76('0x29')](function(_0x2034f4){if(_0x2034f4){_0x14760a=_0x2034f4['length'];if(!_0x240a54['query'][_0x7c76('0x3e')](_0x7c76('0x3f'))){_0x14125b[_0x7c76('0x20')]=qs[_0x7c76('0x20')](_0x240a54[_0x7c76('0x37')][_0x7c76('0x20')]);_0x14125b[_0x7c76('0x1f')]=qs['offset'](_0x240a54[_0x7c76('0x37')][_0x7c76('0x1f')]);}return _0x26d244[_0x7c76('0x67')](_0x14125b);}})[_0x7c76('0x29')](function(_0x8bd551){if(_0x8bd551){return _0x8bd551?{'count':_0x14760a,'rows':_0x8bd551}:null;}})['then'](respondWithResult(_0x5a0435,null))[_0x7c76('0x4a')](handleError(_0x5a0435,null));};exports[_0x7c76('0x68')]=function(_0xbabf3f,_0xb25586,_0xfa3245){var _0x2d08d9=_0xbabf3f[_0x7c76('0x57')][_0x7c76('0x69')];return db['Team']['findAll']({'where':{'id':_0x2d08d9},'attributes':['id'],'include':[{'model':db[_0x7c76('0x5e')],'as':_0x7c76('0x6a'),'attributes':['id','name',_0x7c76('0x6b'),_0x7c76('0x6c'),_0x7c76('0x6d')],'raw':!![]}]})[_0x7c76('0x29')](function(_0x591974){if(_0x591974){var _0x1dcf5a=_[_0x7c76('0x6e')](_0x591974,function(_0x39e992){var _0x4c80b3=_0x39e992[_0x7c76('0x2b')]({'plain':!![]});return _0x4c80b3[_0x7c76('0x6a')];});return db[_0x7c76('0x47')][_0x7c76('0x4f')]({'where':{'id':_0xbabf3f[_0x7c76('0x58')]['id']}})[_0x7c76('0x29')](function(_0x4afa3f){return db[_0x7c76('0x6f')][_0x7c76('0x70')](function(_0x4e7a58){return _0x4afa3f['addTeams'](_0x2d08d9,{'transaction':_0x4e7a58})[_0x7c76('0x29')](function(){return BPromise[_0x7c76('0x71')](_0x1dcf5a,function(_0x19a6b0){return db[_0x7c76('0x5b')][_0x7c76('0x72')]({'where':{'UserId':_0x19a6b0['id'],'SmsQueueId':_0xbabf3f['params']['id']},'transaction':_0x4e7a58});});})[_0x7c76('0x29')](function(){_0x1dcf5a[_0x7c76('0x73')](function(_0x963001){socket[_0x7c76('0x74')](_0x7c76('0x75'),{'UserId':_0x963001['id'],'SmsQueueId':_0x4afa3f['id']});});});});});}})['then'](respondWithStatusCode(_0xb25586,null))[_0x7c76('0x4a')](handleError(_0xb25586,null));};exports[_0x7c76('0x76')]=function(_0x1786fb,_0x1bf308,_0x1b5381){return db[_0x7c76('0x77')][_0x7c76('0x5d')]({'where':{'id':_0x1786fb[_0x7c76('0x37')][_0x7c76('0x69')]},'attributes':['id'],'include':[{'model':db[_0x7c76('0x5e')],'as':_0x7c76('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x7c76('0x29')](handleEntityNotFound(_0x1bf308,null))[_0x7c76('0x29')](function(_0x515697){var _0x521e94=_[_0x7c76('0x32')](_0x515697,'id');var _0x38c73a=[];var _0x5610e4=[];var _0x37fe5e=squel[_0x7c76('0x78')]();_0x37fe5e['field'](_0x7c76('0x79'))[_0x7c76('0x7a')](_0x7c76('0x7b'),'tq')[_0x7c76('0x7c')](_0x7c76('0x7d'),'ut',_0x7c76('0x7e'))[_0x7c76('0x44')](_0x7c76('0x7f'),_0x1786fb[_0x7c76('0x58')]['id']);for(var _0x2b0696=0x0;_0x2b0696<_0x515697[_0x7c76('0x3d')];_0x2b0696+=0x1){let _0x5f518d=_0x515697[_0x2b0696];for(var _0x3441cd=0x0;_0x3441cd<_0x5f518d[_0x7c76('0x6a')][_0x7c76('0x3d')];_0x3441cd+=0x1){let _0x44e464=_0x5f518d[_0x7c76('0x6a')][_0x3441cd];var _0x4e0c4f=_0x37fe5e['clone']();_0x4e0c4f['where'](_0x7c76('0x80'),_0x44e464['id']);_0x5610e4[_0x7c76('0x81')](db['sequelize']['query'](_0x4e0c4f['toString'](),{'type':db[_0x7c76('0x6f')][_0x7c76('0x82')][_0x7c76('0x83')]})[_0x7c76('0x29')](function(_0xa7fb20){if(_0xa7fb20[_0x7c76('0x3d')]===0x1){return _0x44e464['id'];}else{var _0x447a29=_['every'](_[_0x7c76('0x32')](_0xa7fb20,_0x7c76('0x84')),function(_0x4ad21c){return _[_0x7c76('0x85')](_0x521e94,_0x4ad21c);});if(_0x447a29){return _0x44e464['id'];}}}));}}return BPromise[_0x7c76('0x86')](_0x5610e4)[_0x7c76('0x29')](function(_0x397113){_0x38c73a=_(_0x38c73a)[_0x7c76('0x87')](_0x397113)['compact']()[_0x7c76('0x88')]();return db[_0x7c76('0x47')]['find']({'where':{'id':_0x1786fb['params']['id']}})[_0x7c76('0x29')](function(_0x380a9e){return db[_0x7c76('0x6f')][_0x7c76('0x70')](function(_0x241763){return _0x380a9e[_0x7c76('0x76')](_0x1786fb[_0x7c76('0x37')]['ids'],{'transaction':_0x241763})[_0x7c76('0x29')](function(){if(!_[_0x7c76('0x89')](_0x38c73a)){return _0x380a9e['removeAgents'](_0x38c73a,{'transaction':_0x241763});}})['then'](function(){_0x38c73a['forEach'](function(_0x4313b1){socket[_0x7c76('0x74')](_0x7c76('0x8a'),{'UserId':_0x4313b1,'SmsQueueId':_0x380a9e['id']});});});});});});})['then'](respondWithStatusCode(_0x1bf308,null))['catch'](handleError(_0x1bf308,null));};exports[_0x7c76('0x8b')]=function(_0x24536c,_0xe94218,_0x3567e8){return db[_0x7c76('0x47')][_0x7c76('0x4f')]({'where':{'id':_0x24536c[_0x7c76('0x58')]['id']}})[_0x7c76('0x29')](handleEntityNotFound(_0xe94218,null))[_0x7c76('0x29')](function(_0x425911){if(_0x425911){return _0x425911[_0x7c76('0x8b')](_0x24536c[_0x7c76('0x57')][_0x7c76('0x69')],_[_0x7c76('0x8c')](_0x24536c[_0x7c76('0x57')],[_0x7c76('0x69'),'id'])||{})[_0x7c76('0x8d')](function(_0x1eb678){for(var _0x4746a7=0x0;_0x4746a7<_0x24536c[_0x7c76('0x57')][_0x7c76('0x69')]['length'];_0x4746a7+=0x1){socket['emit'](_0x7c76('0x75'),{'UserId':Number(_0x24536c[_0x7c76('0x57')][_0x7c76('0x69')][_0x4746a7]),'SmsQueueId':Number(_0x24536c[_0x7c76('0x58')]['id'])});}return _0x1eb678;});}})[_0x7c76('0x29')](respondWithResult(_0xe94218,null))['catch'](handleError(_0xe94218,null));};exports['removeAgents']=function(_0x19772a,_0x15f731,_0x653e8){return db[_0x7c76('0x47')][_0x7c76('0x4f')]({'where':{'id':_0x19772a[_0x7c76('0x58')]['id']}})[_0x7c76('0x29')](handleEntityNotFound(_0x15f731,null))[_0x7c76('0x29')](function(_0xd4916e){if(_0xd4916e){return _0xd4916e['removeAgents'](_0x19772a[_0x7c76('0x37')]['ids'])[_0x7c76('0x29')](function(){if(_[_0x7c76('0x8e')](_0x19772a['query'][_0x7c76('0x69')])){for(var _0x295933=0x0;_0x295933<_0x19772a['query']['ids'][_0x7c76('0x3d')];_0x295933+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x19772a[_0x7c76('0x37')][_0x7c76('0x69')][_0x295933]),'SmsQueueId':Number(_0x19772a[_0x7c76('0x58')]['id'])});}}else{socket[_0x7c76('0x74')](_0x7c76('0x8a'),{'UserId':Number(_0x19772a[_0x7c76('0x37')][_0x7c76('0x69')]),'SmsQueueId':Number(_0x19772a[_0x7c76('0x58')]['id'])});}});}})[_0x7c76('0x29')](respondWithStatusCode(_0x15f731,null))[_0x7c76('0x4a')](handleError(_0x15f731,null));};exports[_0x7c76('0x8f')]=function(_0x4cf62d,_0x270373,_0x5f1fc5){var _0xc40950={};var _0xd51719={};var _0xb35bca;var _0x314678;return db['SmsQueue'][_0x7c76('0x5a')]({'where':{'id':_0x4cf62d[_0x7c76('0x58')]['id']}})[_0x7c76('0x29')](handleEntityNotFound(_0x270373,null))[_0x7c76('0x29')](function(_0x3fa82e){if(_0x3fa82e){_0xb35bca=_0x3fa82e;_0xd51719['model']=_['keys'](db['User'][_0x7c76('0x4c')]);_0xd51719['query']=_['keys'](_0x4cf62d[_0x7c76('0x37')]);_0xd51719[_0x7c76('0x39')]=_[_0x7c76('0x3a')](_0xd51719[_0x7c76('0x36')],_0xd51719['query']);_0xc40950['attributes']=_['intersection'](_0xd51719[_0x7c76('0x36')],qs[_0x7c76('0x3b')](_0x4cf62d[_0x7c76('0x37')][_0x7c76('0x3b')]));_0xc40950[_0x7c76('0x3c')]=_0xc40950[_0x7c76('0x3c')][_0x7c76('0x3d')]?_0xc40950[_0x7c76('0x3c')]:_0xd51719[_0x7c76('0x36')];_0xc40950[_0x7c76('0x40')]=qs[_0x7c76('0x41')](_0x4cf62d[_0x7c76('0x37')][_0x7c76('0x41')]);_0xc40950['where']=qs[_0x7c76('0x39')](_['pick'](_0x4cf62d[_0x7c76('0x37')],_0xd51719[_0x7c76('0x39')]));if(_0x4cf62d[_0x7c76('0x37')][_0x7c76('0x43')]){_0xc40950[_0x7c76('0x44')]=_['merge'](_0xc40950[_0x7c76('0x44')],{'$or':_[_0x7c76('0x32')](_0xc40950[_0x7c76('0x3c')],function(_0x1d38ab){var _0x5c25d0={};_0x5c25d0[_0x1d38ab]={'$like':'%'+_0x4cf62d['query'][_0x7c76('0x43')]+'%'};return _0x5c25d0;})});}_0xc40950=_[_0x7c76('0x45')]({},_0xc40950,_0x4cf62d[_0x7c76('0x4e')]);return _0xb35bca[_0x7c76('0x8f')](_0xc40950);}})['then'](function(_0x6d06c1){if(_0x6d06c1){_0x314678=_0x6d06c1[_0x7c76('0x3d')];if(!_0x4cf62d['query'][_0x7c76('0x3e')](_0x7c76('0x3f'))){_0xc40950[_0x7c76('0x20')]=qs[_0x7c76('0x20')](_0x4cf62d['query'][_0x7c76('0x20')]);_0xc40950[_0x7c76('0x1f')]=qs[_0x7c76('0x1f')](_0x4cf62d['query'][_0x7c76('0x1f')]);}return _0xb35bca[_0x7c76('0x8f')](_0xc40950);}})['then'](function(_0x34c48d){if(_0x34c48d){return _0x34c48d?{'count':_0x314678,'rows':_0x34c48d}:null;}})['then'](respondWithResult(_0x270373,null))['catch'](handleError(_0x270373,null));}; \ No newline at end of file +var _0xacb5=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','UserSmsQueue','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','get','SmsQueues','destroy','end','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SmsQueue','include','rows','catch','params','rawAttributes','length','includeAll','find'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0xacb5,0xe0));var _0x5acb=function(_0x4dfe8f,_0x15d58a){_0x4dfe8f=_0x4dfe8f-0x0;var _0x525088=_0xacb5[_0x4dfe8f];return _0x525088;};'use strict';var emlformat=require(_0x5acb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5acb('0x1'));var jsonpatch=require(_0x5acb('0x2'));var rp=require(_0x5acb('0x3'));var moment=require(_0x5acb('0x4'));var BPromise=require(_0x5acb('0x5'));var Mustache=require(_0x5acb('0x6'));var util=require('util');var path=require(_0x5acb('0x7'));var sox=require(_0x5acb('0x8'));var csv=require(_0x5acb('0x9'));var ejs=require(_0x5acb('0xa'));var fs=require('fs');var fs_extra=require(_0x5acb('0xb'));var _=require(_0x5acb('0xc'));var squel=require('squel');var crypto=require(_0x5acb('0xd'));var jsforce=require(_0x5acb('0xe'));var deskjs=require(_0x5acb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5acb('0x10'));var Papa=require(_0x5acb('0x11'));var Redis=require(_0x5acb('0x12'));var authService=require(_0x5acb('0x13'));var qs=require(_0x5acb('0x14'));var as=require(_0x5acb('0x15'));var hardwareService=require(_0x5acb('0x16'));var logger=require(_0x5acb('0x17'))(_0x5acb('0x18'));var utils=require(_0x5acb('0x19'));var config=require(_0x5acb('0x1a'));var licenseUtil=require(_0x5acb('0x1b'));var db=require(_0x5acb('0x1c'))['db'];config['redis']=_[_0x5acb('0x1d')](config[_0x5acb('0x1e')],{'host':_0x5acb('0x1f'),'port':0x18eb});var socket=require(_0x5acb('0x20'))(new Redis(config[_0x5acb('0x1e')]));require(_0x5acb('0x21'))[_0x5acb('0x22')](socket);function respondWithStatusCode(_0x16bd28,_0x24d0f4){_0x24d0f4=_0x24d0f4||0xcc;return function(_0x26569f){if(_0x26569f){return _0x16bd28[_0x5acb('0x23')](_0x24d0f4);}return _0x16bd28[_0x5acb('0x24')](_0x24d0f4)['end']();};}function respondWithResult(_0x13cdcc,_0x47c461){_0x47c461=_0x47c461||0xc8;return function(_0x17f1cb){if(_0x17f1cb){return _0x13cdcc[_0x5acb('0x24')](_0x47c461)['json'](_0x17f1cb);}};}function respondWithFilteredResult(_0x5b4a8b,_0x287e75){return function(_0x25e9d0){if(_0x25e9d0){var _0x5954ef=typeof _0x287e75[_0x5acb('0x25')]===_0x5acb('0x26')&&typeof _0x287e75['limit']==='undefined';var _0x599e96=_0x25e9d0[_0x5acb('0x27')];var _0x3d07b8=_0x5954ef?0x0:_0x287e75[_0x5acb('0x25')];var _0x399e20=_0x5954ef?_0x25e9d0[_0x5acb('0x27')]:_0x287e75[_0x5acb('0x25')]+_0x287e75[_0x5acb('0x28')];var _0x574d26;if(_0x399e20>=_0x599e96){_0x399e20=_0x599e96;_0x574d26=0xc8;}else{_0x574d26=0xce;}_0x5b4a8b[_0x5acb('0x24')](_0x574d26);return _0x5b4a8b[_0x5acb('0x29')](_0x5acb('0x2a'),_0x3d07b8+'-'+_0x399e20+'/'+_0x599e96)[_0x5acb('0x2b')](_0x25e9d0);}return null;};}function patchUpdates(_0x2b93cb){return function(_0x283460){try{jsonpatch[_0x5acb('0x2c')](_0x283460,_0x2b93cb,!![]);}catch(_0x5f06bd){return BPromise[_0x5acb('0x2d')](_0x5f06bd);}return _0x283460[_0x5acb('0x2e')]();};}function saveUpdates(_0x4c6747,_0x23373c){return function(_0x8c250b){if(_0x8c250b){return _0x8c250b['update'](_0x4c6747)[_0x5acb('0x2f')](function(_0x3030ac){return _0x3030ac;});}return null;};}function removeEntity(_0xa0b441,_0x2017fd){return function(_0x4f1566){if(_0x4f1566){return _0x4f1566['destroy']()[_0x5acb('0x2f')](function(){var _0x3c7b7c=_0x4f1566[_0x5acb('0x30')]({'plain':!![]});var _0x58bfdf=_0x5acb('0x31');return db['UserProfileResource'][_0x5acb('0x32')]({'where':{'type':_0x58bfdf,'resourceId':_0x3c7b7c['id']}})[_0x5acb('0x2f')](function(){return _0x4f1566;});})[_0x5acb('0x2f')](function(){_0xa0b441[_0x5acb('0x24')](0xcc)[_0x5acb('0x33')]();});}};}function handleEntityNotFound(_0x45295f,_0x40b06b){return function(_0x16c9b1){if(!_0x16c9b1){_0x45295f['sendStatus'](0x194);}return _0x16c9b1;};}function handleError(_0x492b26,_0x278f3e){_0x278f3e=_0x278f3e||0x1f4;return function(_0x48608f){logger[_0x5acb('0x34')](_0x48608f[_0x5acb('0x35')]);if(_0x48608f[_0x5acb('0x36')]){delete _0x48608f[_0x5acb('0x36')];}_0x492b26[_0x5acb('0x24')](_0x278f3e)[_0x5acb('0x37')](_0x48608f);};}exports[_0x5acb('0x38')]=function(_0xf21f6b,_0x34c53b){var _0x2cc20f={},_0x90968e={},_0x24b654={'count':0x0,'rows':[]};var _0x10f45e=_[_0x5acb('0x39')](db['SmsQueue']['rawAttributes'],function(_0x3ed2d2){return{'name':_0x3ed2d2[_0x5acb('0x3a')],'type':_0x3ed2d2[_0x5acb('0x3b')][_0x5acb('0x3c')]};});_0x90968e['model']=_[_0x5acb('0x39')](_0x10f45e,_0x5acb('0x36'));_0x90968e[_0x5acb('0x3d')]=_[_0x5acb('0x3e')](_0xf21f6b[_0x5acb('0x3d')]);_0x90968e[_0x5acb('0x3f')]=_[_0x5acb('0x40')](_0x90968e['model'],_0x90968e['query']);_0x2cc20f['attributes']=_[_0x5acb('0x40')](_0x90968e[_0x5acb('0x41')],qs[_0x5acb('0x42')](_0xf21f6b[_0x5acb('0x3d')][_0x5acb('0x42')]));_0x2cc20f[_0x5acb('0x43')]=_0x2cc20f['attributes']['length']?_0x2cc20f[_0x5acb('0x43')]:_0x90968e[_0x5acb('0x41')];if(!_0xf21f6b[_0x5acb('0x3d')]['hasOwnProperty'](_0x5acb('0x44'))){_0x2cc20f[_0x5acb('0x28')]=qs[_0x5acb('0x28')](_0xf21f6b[_0x5acb('0x3d')][_0x5acb('0x28')]);_0x2cc20f[_0x5acb('0x25')]=qs[_0x5acb('0x25')](_0xf21f6b[_0x5acb('0x3d')][_0x5acb('0x25')]);}_0x2cc20f[_0x5acb('0x45')]=qs[_0x5acb('0x46')](_0xf21f6b[_0x5acb('0x3d')][_0x5acb('0x46')]);_0x2cc20f['where']=qs['filters'](_[_0x5acb('0x47')](_0xf21f6b['query'],_0x90968e[_0x5acb('0x3f')]),_0x10f45e);if(_0xf21f6b['query'][_0x5acb('0x48')]){_0x2cc20f[_0x5acb('0x49')]=_[_0x5acb('0x4a')](_0x2cc20f[_0x5acb('0x49')],{'$or':_['map'](_0x10f45e,function(_0x15898a){if(_0x15898a[_0x5acb('0x3b')]!==_0x5acb('0x4b')){var _0x10dc1a={};_0x10dc1a[_0x15898a[_0x5acb('0x36')]]={'$like':'%'+_0xf21f6b['query'][_0x5acb('0x48')]+'%'};return _0x10dc1a;}})});}_0x2cc20f=_['merge']({},_0x2cc20f,_0xf21f6b[_0x5acb('0x4c')]);var _0x614afe={'where':_0x2cc20f[_0x5acb('0x49')]};return db[_0x5acb('0x4d')][_0x5acb('0x27')](_0x614afe)[_0x5acb('0x2f')](function(_0x991c5a){_0x24b654[_0x5acb('0x27')]=_0x991c5a;if(_0xf21f6b[_0x5acb('0x3d')]['includeAll']){_0x2cc20f[_0x5acb('0x4e')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x2cc20f);})[_0x5acb('0x2f')](function(_0x42c701){_0x24b654[_0x5acb('0x4f')]=_0x42c701;return _0x24b654;})[_0x5acb('0x2f')](respondWithFilteredResult(_0x34c53b,_0x2cc20f))[_0x5acb('0x50')](handleError(_0x34c53b,null));};exports['show']=function(_0x90e2a9,_0x1ffd1a){var _0x5de0ae={'raw':!![],'where':{'id':_0x90e2a9[_0x5acb('0x51')]['id']}},_0x4fbfb1={};_0x4fbfb1[_0x5acb('0x41')]=_['keys'](db['SmsQueue'][_0x5acb('0x52')]);_0x4fbfb1[_0x5acb('0x3d')]=_[_0x5acb('0x3e')](_0x90e2a9[_0x5acb('0x3d')]);_0x4fbfb1[_0x5acb('0x3f')]=_[_0x5acb('0x40')](_0x4fbfb1[_0x5acb('0x41')],_0x4fbfb1[_0x5acb('0x3d')]);_0x5de0ae[_0x5acb('0x43')]=_['intersection'](_0x4fbfb1[_0x5acb('0x41')],qs[_0x5acb('0x42')](_0x90e2a9[_0x5acb('0x3d')][_0x5acb('0x42')]));_0x5de0ae[_0x5acb('0x43')]=_0x5de0ae[_0x5acb('0x43')][_0x5acb('0x53')]?_0x5de0ae['attributes']:_0x4fbfb1[_0x5acb('0x41')];if(_0x90e2a9[_0x5acb('0x3d')][_0x5acb('0x54')]){_0x5de0ae['include']=[{'all':!![]}];}_0x5de0ae=_[_0x5acb('0x4a')]({},_0x5de0ae,_0x90e2a9[_0x5acb('0x4c')]);return db[_0x5acb('0x4d')][_0x5acb('0x55')](_0x5de0ae)['then'](handleEntityNotFound(_0x1ffd1a,null))['then'](respondWithResult(_0x1ffd1a,null))['catch'](handleError(_0x1ffd1a,null));};exports[_0x5acb('0x56')]=function(_0xc36176,_0x20cfec){return db[_0x5acb('0x4d')][_0x5acb('0x56')](_0xc36176['body'],{})[_0x5acb('0x2f')](function(_0x10dce5){var _0x4cde42=_0xc36176['user'][_0x5acb('0x30')]({'plain':!![]});if(!_0x4cde42)throw new Error(_0x5acb('0x57'));if(_0x4cde42[_0x5acb('0x58')]==='user'){var _0xc3bc80=_0x10dce5[_0x5acb('0x30')]({'plain':!![]});var _0x2102a6=_0x5acb('0x31');return db[_0x5acb('0x59')][_0x5acb('0x55')]({'where':{'name':_0x2102a6,'userProfileId':_0x4cde42[_0x5acb('0x5a')]},'raw':!![]})[_0x5acb('0x2f')](function(_0x5808bb){if(_0x5808bb&&_0x5808bb[_0x5acb('0x5b')]===0x0){return db[_0x5acb('0x5c')][_0x5acb('0x56')]({'name':_0xc3bc80['name'],'resourceId':_0xc3bc80['id'],'type':_0x5808bb[_0x5acb('0x36')],'sectionId':_0x5808bb['id']},{})[_0x5acb('0x2f')](function(){return _0x10dce5;});}else{return _0x10dce5;}})['catch'](function(_0x3cfa86){logger['error'](_0x5acb('0x5d'),_0x3cfa86);throw _0x3cfa86;});}return _0x10dce5;})[_0x5acb('0x2f')](respondWithResult(_0x20cfec,0xc9))['catch'](handleError(_0x20cfec,null));};exports['update']=function(_0x52346f,_0x356180){if(_0x52346f[_0x5acb('0x5e')]['id']){delete _0x52346f[_0x5acb('0x5e')]['id'];}return db[_0x5acb('0x4d')]['find']({'where':{'id':_0x52346f[_0x5acb('0x51')]['id']}})[_0x5acb('0x2f')](handleEntityNotFound(_0x356180,null))[_0x5acb('0x2f')](saveUpdates(_0x52346f[_0x5acb('0x5e')],null))['then'](respondWithResult(_0x356180,null))[_0x5acb('0x50')](handleError(_0x356180,null));};exports['destroy']=function(_0x2567ac,_0x3543b6){return db[_0x5acb('0x4d')][_0x5acb('0x55')]({'where':{'id':_0x2567ac['params']['id']}})[_0x5acb('0x2f')](handleEntityNotFound(_0x3543b6,null))[_0x5acb('0x2f')](removeEntity(_0x3543b6,null))[_0x5acb('0x50')](handleError(_0x3543b6,null));};exports['describe']=function(_0x1ca0a3,_0x35c259){return db[_0x5acb('0x4d')][_0x5acb('0x5f')]()[_0x5acb('0x2f')](respondWithResult(_0x35c259,null))[_0x5acb('0x50')](handleError(_0x35c259,null));};exports[_0x5acb('0x60')]=function(_0xccdf37,_0x15dba0,_0x397085){var _0x483c3f={'raw':!![],'where':{}},_0x11c6d2={},_0x156470;return db['SmsQueue'][_0x5acb('0x61')]({'where':{'id':_0xccdf37['params']['id']}})[_0x5acb('0x2f')](handleEntityNotFound(_0x15dba0,null))[_0x5acb('0x2f')](function(_0x10b457){if(_0x10b457){_0x156470=_0x10b457[_0x5acb('0x30')]({'plain':!![]});_0x11c6d2[_0x5acb('0x41')]=_[_0x5acb('0x3e')](db['UserSmsQueue'][_0x5acb('0x52')]);_0x11c6d2['query']=_['keys'](_0xccdf37[_0x5acb('0x3d')]);_0x11c6d2[_0x5acb('0x3f')]=_[_0x5acb('0x40')](_0x11c6d2[_0x5acb('0x41')],_0x11c6d2['query']);_0x483c3f[_0x5acb('0x43')]=_[_0x5acb('0x40')](_0x11c6d2[_0x5acb('0x41')],qs[_0x5acb('0x42')](_0xccdf37[_0x5acb('0x3d')][_0x5acb('0x42')]));_0x483c3f[_0x5acb('0x43')]=_0x483c3f[_0x5acb('0x43')][_0x5acb('0x53')]?_0x483c3f['attributes']:_0x11c6d2[_0x5acb('0x41')];if(!_0xccdf37['query'][_0x5acb('0x62')](_0x5acb('0x44'))){_0x483c3f[_0x5acb('0x28')]=qs[_0x5acb('0x28')](_0xccdf37['query']['limit']);_0x483c3f['offset']=qs[_0x5acb('0x25')](_0xccdf37['query']['offset']);}_0x483c3f['order']=qs['sort'](_0xccdf37[_0x5acb('0x3d')][_0x5acb('0x46')]);_0x483c3f['where']=qs[_0x5acb('0x3f')](_[_0x5acb('0x47')](_0xccdf37[_0x5acb('0x3d')],_0x11c6d2[_0x5acb('0x3f')]));_0x483c3f['where'][_0x5acb('0x63')]=_0x10b457['id'];if(_0xccdf37[_0x5acb('0x3d')][_0x5acb('0x48')]){_0x483c3f[_0x5acb('0x49')]=_[_0x5acb('0x4a')](_0x483c3f[_0x5acb('0x49')],{'$or':_[_0x5acb('0x39')](_0x483c3f[_0x5acb('0x43')],function(_0x4932f1){var _0x1e1e50={};_0x1e1e50[_0x4932f1]={'$like':'%'+_0xccdf37['query']['filter']+'%'};return _0x1e1e50;})});}_0x483c3f=_[_0x5acb('0x4a')]({},_0x483c3f,_0xccdf37['options']);return db['UserSmsQueue'][_0x5acb('0x64')](_0x483c3f);}})[_0x5acb('0x2f')](function(_0x51db09){if(_0x51db09){return db[_0x5acb('0x65')][_0x5acb('0x66')]({'where':{'id':_[_0x5acb('0x39')](_0x51db09,_0x5acb('0x67')),'role':_0x5acb('0x68')},'attributes':['id',_0x5acb('0x36'),_0x5acb('0x69'),_0x5acb('0x6a'),'createdAt']});}})['then'](function(_0x5b93ac){if(_0x5b93ac){return{'count':_0x5b93ac['count'],'rows':_[_0x5acb('0x39')](_0x5b93ac[_0x5acb('0x4f')],function(_0x59386c){return{'membername':_0x59386c[_0x5acb('0x36')],'UserId':_0x59386c['id'],'queue_name':_0x156470[_0x5acb('0x36')],'SmsQueueId':_0x156470['id'],'interface':util[_0x5acb('0x6b')](_0x5acb('0x6c'),_0x5acb('0x6d'),_0x59386c[_0x5acb('0x36')]),'penalty':0x0,'paused':_0x59386c['smsPause'],'createdAt':_0x59386c[_0x5acb('0x6e')],'updatedAt':_0x59386c[_0x5acb('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x15dba0,_0x483c3f))[_0x5acb('0x50')](handleError(_0x15dba0,null));};exports[_0x5acb('0x6f')]=function(_0x1ac170,_0x4f7540,_0x4f84cc){var _0x53c874={};var _0xa4a0b0={};var _0x48e16f;var _0x5e357b;return db['SmsQueue'][_0x5acb('0x61')]({'where':{'id':_0x1ac170[_0x5acb('0x51')]['id']}})[_0x5acb('0x2f')](handleEntityNotFound(_0x4f7540,null))[_0x5acb('0x2f')](function(_0x82f723){if(_0x82f723){_0x48e16f=_0x82f723;_0xa4a0b0['model']=_[_0x5acb('0x3e')](db['Team'][_0x5acb('0x52')]);_0xa4a0b0[_0x5acb('0x3d')]=_[_0x5acb('0x3e')](_0x1ac170[_0x5acb('0x3d')]);_0xa4a0b0[_0x5acb('0x3f')]=_[_0x5acb('0x40')](_0xa4a0b0[_0x5acb('0x41')],_0xa4a0b0['query']);_0x53c874[_0x5acb('0x43')]=_[_0x5acb('0x40')](_0xa4a0b0[_0x5acb('0x41')],qs[_0x5acb('0x42')](_0x1ac170[_0x5acb('0x3d')]['fields']));_0x53c874[_0x5acb('0x43')]=_0x53c874['attributes'][_0x5acb('0x53')]?_0x53c874['attributes']:_0xa4a0b0[_0x5acb('0x41')];_0x53c874[_0x5acb('0x45')]=qs[_0x5acb('0x46')](_0x1ac170['query'][_0x5acb('0x46')]);_0x53c874[_0x5acb('0x49')]=qs[_0x5acb('0x3f')](_[_0x5acb('0x47')](_0x1ac170[_0x5acb('0x3d')],_0xa4a0b0[_0x5acb('0x3f')]));if(_0x1ac170[_0x5acb('0x3d')][_0x5acb('0x48')]){_0x53c874['where']=_['merge'](_0x53c874['where'],{'$or':_[_0x5acb('0x39')](_0x53c874['attributes'],function(_0x538026){var _0x5d6f86={};_0x5d6f86[_0x538026]={'$like':'%'+_0x1ac170['query'][_0x5acb('0x48')]+'%'};return _0x5d6f86;})});}_0x53c874=_[_0x5acb('0x4a')]({},_0x53c874,_0x1ac170[_0x5acb('0x4c')]);return _0x48e16f[_0x5acb('0x6f')](_0x53c874);}})[_0x5acb('0x2f')](function(_0x138301){if(_0x138301){_0x5e357b=_0x138301[_0x5acb('0x53')];if(!_0x1ac170[_0x5acb('0x3d')]['hasOwnProperty']('nolimit')){_0x53c874['limit']=qs[_0x5acb('0x28')](_0x1ac170[_0x5acb('0x3d')][_0x5acb('0x28')]);_0x53c874['offset']=qs[_0x5acb('0x25')](_0x1ac170['query'][_0x5acb('0x25')]);}return _0x48e16f[_0x5acb('0x6f')](_0x53c874);}})[_0x5acb('0x2f')](function(_0x3c4509){if(_0x3c4509){return _0x3c4509?{'count':_0x5e357b,'rows':_0x3c4509}:null;}})[_0x5acb('0x2f')](respondWithResult(_0x4f7540,null))[_0x5acb('0x50')](handleError(_0x4f7540,null));};exports[_0x5acb('0x70')]=function(_0x61e639,_0x517222,_0x1f6262){var _0x1f8ea1=_0x61e639[_0x5acb('0x5e')][_0x5acb('0x71')];return db[_0x5acb('0x72')]['findAll']({'where':{'id':_0x1f8ea1},'attributes':['id'],'include':[{'model':db[_0x5acb('0x65')],'as':_0x5acb('0x73'),'attributes':['id',_0x5acb('0x36'),_0x5acb('0x74'),_0x5acb('0x75'),_0x5acb('0x76')],'raw':!![]}]})['then'](function(_0x43e567){if(_0x43e567){var _0x174d0e=_[_0x5acb('0x77')](_0x43e567,function(_0xa9915b){var _0x56f946=_0xa9915b[_0x5acb('0x30')]({'plain':!![]});return _0x56f946[_0x5acb('0x73')];});return db[_0x5acb('0x4d')][_0x5acb('0x55')]({'where':{'id':_0x61e639[_0x5acb('0x51')]['id']}})[_0x5acb('0x2f')](function(_0x25c9ba){return db[_0x5acb('0x78')][_0x5acb('0x79')](function(_0x7e2c4f){return _0x25c9ba[_0x5acb('0x70')](_0x1f8ea1,{'transaction':_0x7e2c4f})['then'](function(){return BPromise[_0x5acb('0x7a')](_0x174d0e,function(_0x3d4243){return db[_0x5acb('0x7b')][_0x5acb('0x7c')]({'where':{'UserId':_0x3d4243['id'],'SmsQueueId':_0x61e639[_0x5acb('0x51')]['id']},'transaction':_0x7e2c4f});});})['then'](function(){_0x174d0e[_0x5acb('0x7d')](function(_0x5cf8b0){socket['emit'](_0x5acb('0x7e'),{'UserId':_0x5cf8b0['id'],'SmsQueueId':_0x25c9ba['id']});});});});});}})[_0x5acb('0x2f')](respondWithStatusCode(_0x517222,null))[_0x5acb('0x50')](handleError(_0x517222,null));};exports[_0x5acb('0x7f')]=function(_0xd5d9be,_0x19a672,_0x1181b2){return db['Team'][_0x5acb('0x64')]({'where':{'id':_0xd5d9be[_0x5acb('0x3d')][_0x5acb('0x71')]},'attributes':['id'],'include':[{'model':db[_0x5acb('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5acb('0x2f')](handleEntityNotFound(_0x19a672,null))['then'](function(_0x511fc0){var _0xa8b3cd=_[_0x5acb('0x39')](_0x511fc0,'id');var _0x8aaeb8=[];var _0x5a7320=[];var _0xff1353=squel[_0x5acb('0x80')]();_0xff1353[_0x5acb('0x81')]('tq.TeamId')[_0x5acb('0x82')](_0x5acb('0x83'),'tq')[_0x5acb('0x84')](_0x5acb('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5acb('0x49')](_0x5acb('0x86'),_0xd5d9be[_0x5acb('0x51')]['id']);for(var _0x10dc65=0x0;_0x10dc65<_0x511fc0['length'];_0x10dc65+=0x1){let _0x32aa8a=_0x511fc0[_0x10dc65];for(var _0x7fe8cf=0x0;_0x7fe8cf<_0x32aa8a[_0x5acb('0x73')]['length'];_0x7fe8cf+=0x1){let _0x3744c3=_0x32aa8a[_0x5acb('0x73')][_0x7fe8cf];var _0x4247b8=_0xff1353[_0x5acb('0x87')]();_0x4247b8[_0x5acb('0x49')](_0x5acb('0x88'),_0x3744c3['id']);_0x5a7320[_0x5acb('0x89')](db['sequelize'][_0x5acb('0x3d')](_0x4247b8[_0x5acb('0x8a')](),{'type':db[_0x5acb('0x78')][_0x5acb('0x8b')][_0x5acb('0x8c')]})[_0x5acb('0x2f')](function(_0x472da1){if(_0x472da1['length']===0x1){return _0x3744c3['id'];}else{var _0x2ec846=_[_0x5acb('0x8d')](_[_0x5acb('0x39')](_0x472da1,_0x5acb('0x8e')),function(_0x5588fe){return _['includes'](_0xa8b3cd,_0x5588fe);});if(_0x2ec846){return _0x3744c3['id'];}}}));}}return BPromise[_0x5acb('0x8f')](_0x5a7320)[_0x5acb('0x2f')](function(_0x55652f){_0x8aaeb8=_(_0x8aaeb8)['union'](_0x55652f)[_0x5acb('0x90')]()[_0x5acb('0x91')]();return db[_0x5acb('0x4d')][_0x5acb('0x55')]({'where':{'id':_0xd5d9be[_0x5acb('0x51')]['id']}})[_0x5acb('0x2f')](function(_0x515eca){return db['sequelize'][_0x5acb('0x79')](function(_0x2175a6){return _0x515eca[_0x5acb('0x7f')](_0xd5d9be[_0x5acb('0x3d')][_0x5acb('0x71')],{'transaction':_0x2175a6})[_0x5acb('0x2f')](function(){if(!_[_0x5acb('0x92')](_0x8aaeb8)){return _0x515eca[_0x5acb('0x93')](_0x8aaeb8,{'transaction':_0x2175a6});}})[_0x5acb('0x2f')](function(){_0x8aaeb8[_0x5acb('0x7d')](function(_0xbec58){socket[_0x5acb('0x94')]('userSmsQueue:remove',{'UserId':_0xbec58,'SmsQueueId':_0x515eca['id']});});});});});});})[_0x5acb('0x2f')](respondWithStatusCode(_0x19a672,null))[_0x5acb('0x50')](handleError(_0x19a672,null));};exports[_0x5acb('0x95')]=function(_0x2b52b4,_0x5bdfce,_0x51483e){return db['SmsQueue'][_0x5acb('0x55')]({'where':{'id':_0x2b52b4[_0x5acb('0x51')]['id']}})['then'](handleEntityNotFound(_0x5bdfce,null))[_0x5acb('0x2f')](function(_0x599aab){if(_0x599aab){return _0x599aab['addAgents'](_0x2b52b4[_0x5acb('0x5e')][_0x5acb('0x71')],_[_0x5acb('0x96')](_0x2b52b4[_0x5acb('0x5e')],[_0x5acb('0x71'),'id'])||{})[_0x5acb('0x97')](function(_0x57ea4f){for(var _0x2e309c=0x0;_0x2e309c<_0x2b52b4[_0x5acb('0x5e')][_0x5acb('0x71')][_0x5acb('0x53')];_0x2e309c+=0x1){socket['emit'](_0x5acb('0x7e'),{'UserId':Number(_0x2b52b4[_0x5acb('0x5e')][_0x5acb('0x71')][_0x2e309c]),'SmsQueueId':Number(_0x2b52b4['params']['id'])});}return _0x57ea4f;});}})[_0x5acb('0x2f')](respondWithResult(_0x5bdfce,null))[_0x5acb('0x50')](handleError(_0x5bdfce,null));};exports[_0x5acb('0x93')]=function(_0x3a65ab,_0x5f2baa,_0x5b62ca){return db['SmsQueue'][_0x5acb('0x55')]({'where':{'id':_0x3a65ab['params']['id']}})[_0x5acb('0x2f')](handleEntityNotFound(_0x5f2baa,null))['then'](function(_0x187ae9){if(_0x187ae9){return _0x187ae9['removeAgents'](_0x3a65ab[_0x5acb('0x3d')][_0x5acb('0x71')])[_0x5acb('0x2f')](function(){if(_[_0x5acb('0x98')](_0x3a65ab[_0x5acb('0x3d')][_0x5acb('0x71')])){for(var _0x2f5f62=0x0;_0x2f5f62<_0x3a65ab['query'][_0x5acb('0x71')][_0x5acb('0x53')];_0x2f5f62+=0x1){socket[_0x5acb('0x94')]('userSmsQueue:remove',{'UserId':Number(_0x3a65ab[_0x5acb('0x3d')][_0x5acb('0x71')][_0x2f5f62]),'SmsQueueId':Number(_0x3a65ab[_0x5acb('0x51')]['id'])});}}else{socket[_0x5acb('0x94')](_0x5acb('0x99'),{'UserId':Number(_0x3a65ab[_0x5acb('0x3d')]['ids']),'SmsQueueId':Number(_0x3a65ab['params']['id'])});}});}})[_0x5acb('0x2f')](respondWithStatusCode(_0x5f2baa,null))[_0x5acb('0x50')](handleError(_0x5f2baa,null));};exports[_0x5acb('0x9a')]=function(_0x37bb1d,_0x4f261c,_0x47fd29){var _0x5327e8={};var _0x263faf={};var _0x1cde5d;var _0x296a1f;return db[_0x5acb('0x4d')][_0x5acb('0x61')]({'where':{'id':_0x37bb1d[_0x5acb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4f261c,null))[_0x5acb('0x2f')](function(_0x3249d8){if(_0x3249d8){_0x1cde5d=_0x3249d8;_0x263faf[_0x5acb('0x41')]=_['keys'](db[_0x5acb('0x65')][_0x5acb('0x52')]);_0x263faf[_0x5acb('0x3d')]=_['keys'](_0x37bb1d['query']);_0x263faf[_0x5acb('0x3f')]=_[_0x5acb('0x40')](_0x263faf[_0x5acb('0x41')],_0x263faf[_0x5acb('0x3d')]);_0x5327e8[_0x5acb('0x43')]=_['intersection'](_0x263faf['model'],qs['fields'](_0x37bb1d[_0x5acb('0x3d')][_0x5acb('0x42')]));_0x5327e8[_0x5acb('0x43')]=_0x5327e8[_0x5acb('0x43')][_0x5acb('0x53')]?_0x5327e8[_0x5acb('0x43')]:_0x263faf[_0x5acb('0x41')];_0x5327e8['order']=qs[_0x5acb('0x46')](_0x37bb1d['query']['sort']);_0x5327e8[_0x5acb('0x49')]=qs[_0x5acb('0x3f')](_['pick'](_0x37bb1d[_0x5acb('0x3d')],_0x263faf['filters']));if(_0x37bb1d['query'][_0x5acb('0x48')]){_0x5327e8[_0x5acb('0x49')]=_['merge'](_0x5327e8[_0x5acb('0x49')],{'$or':_[_0x5acb('0x39')](_0x5327e8['attributes'],function(_0x458ccd){var _0x13c02e={};_0x13c02e[_0x458ccd]={'$like':'%'+_0x37bb1d[_0x5acb('0x3d')][_0x5acb('0x48')]+'%'};return _0x13c02e;})});}_0x5327e8=_[_0x5acb('0x4a')]({},_0x5327e8,_0x37bb1d[_0x5acb('0x4c')]);return _0x1cde5d[_0x5acb('0x9a')](_0x5327e8);}})[_0x5acb('0x2f')](function(_0x147954){if(_0x147954){_0x296a1f=_0x147954[_0x5acb('0x53')];if(!_0x37bb1d[_0x5acb('0x3d')][_0x5acb('0x62')](_0x5acb('0x44'))){_0x5327e8['limit']=qs[_0x5acb('0x28')](_0x37bb1d[_0x5acb('0x3d')][_0x5acb('0x28')]);_0x5327e8[_0x5acb('0x25')]=qs[_0x5acb('0x25')](_0x37bb1d[_0x5acb('0x3d')][_0x5acb('0x25')]);}return _0x1cde5d[_0x5acb('0x9a')](_0x5327e8);}})[_0x5acb('0x2f')](function(_0x3f68a3){if(_0x3f68a3){return _0x3f68a3?{'count':_0x296a1f,'rows':_0x3f68a3}:null;}})[_0x5acb('0x2f')](respondWithResult(_0x4f261c,null))[_0x5acb('0x50')](handleError(_0x4f261c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 372e2aa..d8d9f26 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 _0x28fa=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x28fa,0x87));var _0xa28f=function(_0x1c629a,_0x5ead7f){_0x1c629a=_0x1c629a-0x0;var _0x4e995b=_0x28fa[_0x1c629a];return _0x4e995b;};'use strict';var EventEmitter=require(_0xa28f('0x0'));var SmsQueue=require(_0xa28f('0x1'))['db'][_0xa28f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa28f('0x3')](0x0);var events={'afterCreate':_0xa28f('0x4'),'afterUpdate':_0xa28f('0x5'),'afterDestroy':_0xa28f('0x6')};function emitEvent(_0x4fb9e4){return function(_0x41cdfe,_0x25a447,_0x2798a0){SmsQueueEvents[_0xa28f('0x7')](_0x4fb9e4+':'+_0x41cdfe['id'],_0x41cdfe);SmsQueueEvents['emit'](_0x4fb9e4,_0x41cdfe);_0x2798a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xa28f('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x8ebb=['exports','events','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3bec2d,_0x35aca2){var _0x47fbfb=function(_0x439195){while(--_0x439195){_0x3bec2d['push'](_0x3bec2d['shift']());}};_0x47fbfb(++_0x35aca2);}(_0x8ebb,0x88));var _0xb8eb=function(_0x30e423,_0x53e326){_0x30e423=_0x30e423-0x0;var _0x526e94=_0x8ebb[_0x30e423];return _0x526e94;};'use strict';var EventEmitter=require(_0xb8eb('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xb8eb('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb8eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb8eb('0x3'),'afterDestroy':_0xb8eb('0x4')};function emitEvent(_0x11853e){return function(_0xd062f5,_0x315c5f,_0x13831f){SmsQueueEvents[_0xb8eb('0x5')](_0x11853e+':'+_0xd062f5['id'],_0xd062f5);SmsQueueEvents[_0xb8eb('0x5')](_0x11853e,_0xd062f5);_0x13831f(null);};}for(var e in events){if(events[_0xb8eb('0x6')](e)){var event=events[e];SmsQueue[_0xb8eb('0x7')](e,emitEvent(event));}}module[_0xb8eb('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 3c5b538..a4b9c85 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 _0x84fc=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x418dad,_0x3e8397){var _0x32dd2c=function(_0x3d9f19){while(--_0x3d9f19){_0x418dad['push'](_0x418dad['shift']());}};_0x32dd2c(++_0x3e8397);}(_0x84fc,0x7b));var _0xc84f=function(_0x1d1722,_0x759c36){_0x1d1722=_0x1d1722-0x0;var _0x100055=_0x84fc[_0x1d1722];return _0x100055;};'use strict';var _=require(_0xc84f('0x0'));var util=require(_0xc84f('0x1'));var logger=require(_0xc84f('0x2'))(_0xc84f('0x3'));var moment=require('moment');var BPromise=require(_0xc84f('0x4'));var rp=require(_0xc84f('0x5'));var fs=require('fs');var path=require(_0xc84f('0x6'));var rimraf=require('rimraf');var config=require(_0xc84f('0x7'));var attributes=require(_0xc84f('0x8'));module[_0xc84f('0x9')]=function(_0x1db617,_0x580f74){return _0x1db617[_0xc84f('0xa')](_0xc84f('0xb'),attributes,{'tableName':_0xc84f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc224=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','SmsQueue','sms_queues'];(function(_0x28ea86,_0x15dee1){var _0x45bf56=function(_0x20013f){while(--_0x20013f){_0x28ea86['push'](_0x28ea86['shift']());}};_0x45bf56(++_0x15dee1);}(_0xc224,0xe4));var _0x4c22=function(_0x3409e7,_0x33daad){_0x3409e7=_0x3409e7-0x0;var _0x146f86=_0xc224[_0x3409e7];return _0x146f86;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var logger=require(_0x4c22('0x2'))(_0x4c22('0x3'));var moment=require('moment');var BPromise=require(_0x4c22('0x4'));var rp=require(_0x4c22('0x5'));var fs=require('fs');var path=require(_0x4c22('0x6'));var rimraf=require('rimraf');var config=require(_0x4c22('0x7'));var attributes=require('./smsQueue.attributes');module[_0x4c22('0x8')]=function(_0x4fb258,_0x4b2aa2){return _0x4fb258[_0x4c22('0x9')](_0x4c22('0xa'),attributes,{'tableName':_0x4c22('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 dcdf946..bc87a3a 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 _0x5db8=['rpc','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','include','map','model','stringify','ShowSmsQueue','find','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3b4618,_0x16390f){var _0x58e676=function(_0x3c31b7){while(--_0x3c31b7){_0x3b4618['push'](_0x3b4618['shift']());}};_0x58e676(++_0x16390f);}(_0x5db8,0x113));var _0x85db=function(_0x311374,_0x132c28){_0x311374=_0x311374-0x0;var _0x1bf041=_0x5db8[_0x311374];return _0x1bf041;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require('moment');var BPromise=require(_0x85db('0x2'));var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x5'));var config=require(_0x85db('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x85db('0x7')]=_[_0x85db('0x8')](config[_0x85db('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x85db('0x9'))(new Redis(config['redis']));require(_0x85db('0xa'))['register'](socket);function respondWithRpcPromise(_0x57587e,_0x104e40,_0x30e58b){return new BPromise(function(_0x19fd4b,_0xf09997){return client[_0x85db('0xb')](_0x57587e,_0x30e58b)[_0x85db('0xc')](function(_0x137d0e){logger[_0x85db('0xd')](_0x85db('0xe'),_0x104e40,_0x85db('0xf'));logger[_0x85db('0x10')](_0x85db('0x11'),_0x104e40,_0x85db('0xf'),JSON['stringify'](_0x137d0e));if(_0x137d0e[_0x85db('0x12')]){if(_0x137d0e[_0x85db('0x12')][_0x85db('0x13')]===0x1f4){logger['error'](_0x85db('0xe'),_0x104e40,_0x137d0e[_0x85db('0x12')][_0x85db('0x14')]);return _0xf09997(_0x137d0e[_0x85db('0x12')][_0x85db('0x14')]);}logger[_0x85db('0x12')](_0x85db('0xe'),_0x104e40,_0x137d0e['error'][_0x85db('0x14')]);return _0x19fd4b(_0x137d0e[_0x85db('0x12')][_0x85db('0x14')]);}else{logger[_0x85db('0xd')]('SmsQueue,\x20%s,\x20%s',_0x104e40,_0x85db('0xf'));_0x19fd4b(_0x137d0e[_0x85db('0x15')]['message']);}})[_0x85db('0x16')](function(_0x151042){logger['error']('SmsQueue,\x20%s,\x20%s',_0x104e40,_0x151042);_0xf09997(_0x151042);});});}exports[_0x85db('0x17')]=function(_0x4a98da){var _0x31c07c=this;return new Promise(function(_0x395649,_0x1974d2){return db[_0x85db('0x18')][_0x85db('0x19')]({'raw':_0x4a98da[_0x85db('0x1a')]?_0x4a98da[_0x85db('0x1a')][_0x85db('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a98da[_0x85db('0x1a')]?_0x4a98da['options']['where']||null:null,'attributes':_0x4a98da['options']?_0x4a98da['options'][_0x85db('0x1c')]||null:null,'limit':_0x4a98da[_0x85db('0x1a')]?_0x4a98da[_0x85db('0x1a')]['limit']||null:null,'include':_0x4a98da[_0x85db('0x1a')]?_0x4a98da['options'][_0x85db('0x1d')]?_[_0x85db('0x1e')](_0x4a98da[_0x85db('0x1a')][_0x85db('0x1d')],function(_0xfe6131){return{'model':db[_0xfe6131[_0x85db('0x1f')]],'as':_0xfe6131['as'],'attributes':_0xfe6131[_0x85db('0x1c')],'include':_0xfe6131['include']?_[_0x85db('0x1e')](_0xfe6131[_0x85db('0x1d')],function(_0x11e2cd){return{'model':db[_0x11e2cd[_0x85db('0x1f')]],'as':_0x11e2cd['as'],'attributes':_0x11e2cd['attributes'],'include':_0x11e2cd[_0x85db('0x1d')]?_['map'](_0x11e2cd[_0x85db('0x1d')],function(_0x2a0c15){return{'model':db[_0x2a0c15[_0x85db('0x1f')]],'as':_0x2a0c15['as'],'attributes':_0x2a0c15[_0x85db('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85db('0xc')](function(_0x59c625){logger[_0x85db('0xd')](_0x85db('0x17'),_0x4a98da);logger['debug'](_0x85db('0x17'),_0x4a98da,JSON[_0x85db('0x20')](_0x59c625));_0x395649(_0x59c625);})[_0x85db('0x16')](function(_0x4fdef8){logger['error'](_0x85db('0x17'),_0x4fdef8[_0x85db('0x14')],_0x4a98da);_0x1974d2(_0x31c07c[_0x85db('0x12')](0x1f4,_0x4fdef8[_0x85db('0x14')]));});});};exports[_0x85db('0x21')]=function(_0x490b95){var _0x15d62c=this;return new Promise(function(_0x4622d3,_0x28c108){return db[_0x85db('0x18')][_0x85db('0x22')]({'raw':_0x490b95['options']?_0x490b95[_0x85db('0x1a')][_0x85db('0x1b')]===undefined?!![]:![]:!![],'where':_0x490b95['options']?_0x490b95[_0x85db('0x1a')]['where']||null:null,'attributes':_0x490b95[_0x85db('0x1a')]?_0x490b95[_0x85db('0x1a')]['attributes']||null:null,'include':_0x490b95[_0x85db('0x1a')]?_0x490b95[_0x85db('0x1a')][_0x85db('0x1d')]?_['map'](_0x490b95['options'][_0x85db('0x1d')],function(_0x58f565){return{'model':db[_0x58f565['model']],'as':_0x58f565['as'],'attributes':_0x58f565[_0x85db('0x1c')],'include':_0x58f565[_0x85db('0x1d')]?_[_0x85db('0x1e')](_0x58f565[_0x85db('0x1d')],function(_0x78369c){return{'model':db[_0x78369c[_0x85db('0x1f')]],'as':_0x78369c['as'],'attributes':_0x78369c['attributes'],'include':_0x78369c[_0x85db('0x1d')]?_[_0x85db('0x1e')](_0x78369c['include'],function(_0x4e6381){return{'model':db[_0x4e6381['model']],'as':_0x4e6381['as'],'attributes':_0x4e6381['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2984b1){logger[_0x85db('0xd')](_0x85db('0x21'),_0x490b95);logger['debug'](_0x85db('0x21'),_0x490b95,JSON[_0x85db('0x20')](_0x2984b1));_0x4622d3(_0x2984b1);})[_0x85db('0x16')](function(_0xefa471){logger[_0x85db('0x12')](_0x85db('0x21'),_0xefa471[_0x85db('0x14')],_0x490b95);_0x28c108(_0x15d62c[_0x85db('0x12')](0x1f4,_0xefa471[_0x85db('0x14')]));});});}; \ No newline at end of file +var _0x6ceb=['model','then','GetSmsQueue','debug','catch','ShowSmsQueue','find','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsQueue','findAll','options','raw','attributes','limit','map','include'];(function(_0x5dcb6f,_0x33c695){var _0x3cbbb4=function(_0x31d9bd){while(--_0x31d9bd){_0x5dcb6f['push'](_0x5dcb6f['shift']());}};_0x3cbbb4(++_0x33c695);}(_0x6ceb,0x83));var _0xb6ce=function(_0x4ccf95,_0x26ecc5){_0x4ccf95=_0x4ccf95-0x0;var _0x212f82=_0x6ceb[_0x4ccf95];return _0x212f82;};'use strict';var _=require(_0xb6ce('0x0'));var util=require(_0xb6ce('0x1'));var moment=require(_0xb6ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6ce('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb6ce('0x5'));var jayson=require(_0xb6ce('0x6'));var client=jayson[_0xb6ce('0x7')]['http']({'port':0x232a});config[_0xb6ce('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6ce('0x8')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3d435f,_0x1f7d66,_0xf8014d){return new BPromise(function(_0x4743b7,_0x1de1f8){return client['request'](_0x3d435f,_0xf8014d)['then'](function(_0x3bf81c){logger[_0xb6ce('0x9')](_0xb6ce('0xa'),_0x1f7d66,_0xb6ce('0xb'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1f7d66,_0xb6ce('0xb'),JSON[_0xb6ce('0xc')](_0x3bf81c));if(_0x3bf81c['error']){if(_0x3bf81c[_0xb6ce('0xd')][_0xb6ce('0xe')]===0x1f4){logger['error'](_0xb6ce('0xa'),_0x1f7d66,_0x3bf81c[_0xb6ce('0xd')][_0xb6ce('0xf')]);return _0x1de1f8(_0x3bf81c['error'][_0xb6ce('0xf')]);}logger[_0xb6ce('0xd')](_0xb6ce('0xa'),_0x1f7d66,_0x3bf81c[_0xb6ce('0xd')][_0xb6ce('0xf')]);return _0x4743b7(_0x3bf81c[_0xb6ce('0xd')]['message']);}else{logger['info'](_0xb6ce('0xa'),_0x1f7d66,_0xb6ce('0xb'));_0x4743b7(_0x3bf81c['result']['message']);}})['catch'](function(_0xeef231){logger[_0xb6ce('0xd')]('SmsQueue,\x20%s,\x20%s',_0x1f7d66,_0xeef231);_0x1de1f8(_0xeef231);});});}exports['GetSmsQueue']=function(_0x54f4f1){var _0x8c7768=this;return new Promise(function(_0x48416b,_0x284ae5){return db[_0xb6ce('0x10')][_0xb6ce('0x11')]({'raw':_0x54f4f1[_0xb6ce('0x12')]?_0x54f4f1[_0xb6ce('0x12')][_0xb6ce('0x13')]===undefined?!![]:![]:!![],'where':_0x54f4f1[_0xb6ce('0x12')]?_0x54f4f1[_0xb6ce('0x12')]['where']||null:null,'attributes':_0x54f4f1[_0xb6ce('0x12')]?_0x54f4f1['options'][_0xb6ce('0x14')]||null:null,'limit':_0x54f4f1[_0xb6ce('0x12')]?_0x54f4f1[_0xb6ce('0x12')][_0xb6ce('0x15')]||null:null,'include':_0x54f4f1[_0xb6ce('0x12')]?_0x54f4f1[_0xb6ce('0x12')]['include']?_[_0xb6ce('0x16')](_0x54f4f1[_0xb6ce('0x12')][_0xb6ce('0x17')],function(_0x4829c0){return{'model':db[_0x4829c0['model']],'as':_0x4829c0['as'],'attributes':_0x4829c0['attributes'],'include':_0x4829c0['include']?_[_0xb6ce('0x16')](_0x4829c0[_0xb6ce('0x17')],function(_0x38e670){return{'model':db[_0x38e670[_0xb6ce('0x18')]],'as':_0x38e670['as'],'attributes':_0x38e670[_0xb6ce('0x14')],'include':_0x38e670['include']?_['map'](_0x38e670['include'],function(_0x11588a){return{'model':db[_0x11588a[_0xb6ce('0x18')]],'as':_0x11588a['as'],'attributes':_0x11588a[_0xb6ce('0x14')]};}):[]};}):[]};}):[]:[]})[_0xb6ce('0x19')](function(_0x4da6d3){logger[_0xb6ce('0x9')](_0xb6ce('0x1a'),_0x54f4f1);logger[_0xb6ce('0x1b')](_0xb6ce('0x1a'),_0x54f4f1,JSON[_0xb6ce('0xc')](_0x4da6d3));_0x48416b(_0x4da6d3);})[_0xb6ce('0x1c')](function(_0x55afd2){logger[_0xb6ce('0xd')]('GetSmsQueue',_0x55afd2[_0xb6ce('0xf')],_0x54f4f1);_0x284ae5(_0x8c7768[_0xb6ce('0xd')](0x1f4,_0x55afd2[_0xb6ce('0xf')]));});});};exports[_0xb6ce('0x1d')]=function(_0x50664a){var _0x4b66af=this;return new Promise(function(_0x4ad3ee,_0xf595fa){return db[_0xb6ce('0x10')][_0xb6ce('0x1e')]({'raw':_0x50664a[_0xb6ce('0x12')]?_0x50664a[_0xb6ce('0x12')][_0xb6ce('0x13')]===undefined?!![]:![]:!![],'where':_0x50664a[_0xb6ce('0x12')]?_0x50664a[_0xb6ce('0x12')]['where']||null:null,'attributes':_0x50664a[_0xb6ce('0x12')]?_0x50664a['options'][_0xb6ce('0x14')]||null:null,'include':_0x50664a[_0xb6ce('0x12')]?_0x50664a[_0xb6ce('0x12')][_0xb6ce('0x17')]?_['map'](_0x50664a['options']['include'],function(_0x1d2fec){return{'model':db[_0x1d2fec[_0xb6ce('0x18')]],'as':_0x1d2fec['as'],'attributes':_0x1d2fec[_0xb6ce('0x14')],'include':_0x1d2fec[_0xb6ce('0x17')]?_['map'](_0x1d2fec['include'],function(_0x3f371a){return{'model':db[_0x3f371a[_0xb6ce('0x18')]],'as':_0x3f371a['as'],'attributes':_0x3f371a[_0xb6ce('0x14')],'include':_0x3f371a[_0xb6ce('0x17')]?_[_0xb6ce('0x16')](_0x3f371a['include'],function(_0x594248){return{'model':db[_0x594248[_0xb6ce('0x18')]],'as':_0x594248['as'],'attributes':_0x594248[_0xb6ce('0x14')]};}):[]};}):[]};}):[]:[]})[_0xb6ce('0x19')](function(_0x1151bc){logger[_0xb6ce('0x9')](_0xb6ce('0x1d'),_0x50664a);logger['debug'](_0xb6ce('0x1d'),_0x50664a,JSON[_0xb6ce('0xc')](_0x1151bc));_0x4ad3ee(_0x1151bc);})[_0xb6ce('0x1c')](function(_0x52219b){logger[_0xb6ce('0xd')](_0xb6ce('0x1d'),_0x52219b['message'],_0x50664a);_0xf595fa(_0x4b66af[_0xb6ce('0xd')](0x1f4,_0x52219b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8c85161..64ece63 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 _0xdc6d=['length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x13f794,_0x99cb51){var _0x1c79a4=function(_0x3b76d6){while(--_0x3b76d6){_0x13f794['push'](_0x13f794['shift']());}};_0x1c79a4(++_0x99cb51);}(_0xdc6d,0x1c2));var _0xddc6=function(_0xb47014,_0x2d4403){_0xb47014=_0xb47014-0x0;var _0x273abd=_0xdc6d[_0xb47014];return _0x273abd;};'use strict';var SmsQueueEvents=require(_0xddc6('0x0'));var events=[_0xddc6('0x1'),_0xddc6('0x2'),_0xddc6('0x3')];function createListener(_0x4af2c1,_0xa134d1){return function(_0x424375){_0xa134d1[_0xddc6('0x4')](_0x4af2c1,_0x424375);};}function removeListener(_0x1644f7,_0x39b76e){return function(){SmsQueueEvents[_0xddc6('0x5')](_0x1644f7,_0x39b76e);};}exports['register']=function(_0x4f730d){for(var _0x2121bf=0x0,_0x4641ee=events[_0xddc6('0x6')];_0x2121bf<_0x4641ee;_0x2121bf++){var _0x3115e2=events[_0x2121bf];var _0x4b70b7=createListener(_0xddc6('0x7')+_0x3115e2,_0x4f730d);SmsQueueEvents['on'](_0x3115e2,_0x4b70b7);}}; \ No newline at end of file +var _0x6ea9=['register','length','smsQueue:','./smsQueue.events','save','remove','emit'];(function(_0x13f35d,_0x17dac2){var _0x37f759=function(_0x538366){while(--_0x538366){_0x13f35d['push'](_0x13f35d['shift']());}};_0x37f759(++_0x17dac2);}(_0x6ea9,0x1f4));var _0x96ea=function(_0x4cb12f,_0x4ffa2e){_0x4cb12f=_0x4cb12f-0x0;var _0x4bdf36=_0x6ea9[_0x4cb12f];return _0x4bdf36;};'use strict';var SmsQueueEvents=require(_0x96ea('0x0'));var events=[_0x96ea('0x1'),_0x96ea('0x2'),'update'];function createListener(_0x133272,_0x75b770){return function(_0x4101ca){_0x75b770[_0x96ea('0x3')](_0x133272,_0x4101ca);};}function removeListener(_0x3169a6,_0x4202eb){return function(){SmsQueueEvents['removeListener'](_0x3169a6,_0x4202eb);};}exports[_0x96ea('0x4')]=function(_0x215a01){for(var _0x3bdc79=0x0,_0x2e12ae=events[_0x96ea('0x5')];_0x3bdc79<_0x2e12ae;_0x3bdc79++){var _0x2eb609=events[_0x3bdc79];var _0x58679a=createListener(_0x96ea('0x6')+_0x2eb609,_0x215a01);SmsQueueEvents['on'](_0x2eb609,_0x58679a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6b3a4b1..b9b49ae 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 _0x74d4=['destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','post','create','delete'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x74d4,0x112));var _0x474d=function(_0x1f4810,_0x185dbf){_0x1f4810=_0x1f4810-0x0;var _0x2ef9e4=_0x74d4[_0x1f4810];return _0x2ef9e4;};'use strict';var multer=require(_0x474d('0x0'));var util=require(_0x474d('0x1'));var path=require(_0x474d('0x2'));var timeout=require('connect-timeout');var express=require(_0x474d('0x3'));var router=express['Router']();var fs_extra=require(_0x474d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x474d('0x5'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x474d('0x6')]('/',auth[_0x474d('0x7')](),controller[_0x474d('0x8')]);router[_0x474d('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x474d('0x9')]);router[_0x474d('0x6')](_0x474d('0xa'),auth['isAuthenticated'](),controller[_0x474d('0xb')]);router[_0x474d('0xc')]('/',auth[_0x474d('0x7')](),controller[_0x474d('0xd')]);router['put'](_0x474d('0xa'),auth[_0x474d('0x7')](),controller['update']);router[_0x474d('0xe')](_0x474d('0xa'),auth[_0x474d('0x7')](),controller[_0x474d('0xf')]);module[_0x474d('0x10')]=router; \ No newline at end of file +var _0x5cd7=['get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x4149e3,_0x3ee3c4){var _0x2af871=function(_0x59fae4){while(--_0x59fae4){_0x4149e3['push'](_0x4149e3['shift']());}};_0x2af871(++_0x3ee3c4);}(_0x5cd7,0x102));var _0x75cd=function(_0x3cd91d,_0x163516){_0x3cd91d=_0x3cd91d-0x0;var _0x3b4fab=_0x5cd7[_0x3cd91d];return _0x3b4fab;};'use strict';var multer=require(_0x75cd('0x0'));var util=require('util');var path=require(_0x75cd('0x1'));var timeout=require(_0x75cd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x75cd('0x3'));var auth=require(_0x75cd('0x4'));var interaction=require(_0x75cd('0x5'));var config=require(_0x75cd('0x6'));var controller=require(_0x75cd('0x7'));router[_0x75cd('0x8')]('/',auth[_0x75cd('0x9')](),controller[_0x75cd('0xa')]);router[_0x75cd('0x8')]('/describe',auth[_0x75cd('0x9')](),controller[_0x75cd('0xb')]);router[_0x75cd('0x8')](_0x75cd('0xc'),auth[_0x75cd('0x9')](),controller[_0x75cd('0xd')]);router[_0x75cd('0xe')]('/',auth[_0x75cd('0x9')](),controller[_0x75cd('0xf')]);router[_0x75cd('0x10')]('/:id',auth[_0x75cd('0x9')](),controller['update']);router[_0x75cd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x75cd('0x12')]);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 527790b..090ff24 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 _0x08aa=['STRING','DATE','sequelize','exports'];(function(_0x2a047c,_0x5c1827){var _0x5c98c9=function(_0x53fd0c){while(--_0x53fd0c){_0x2a047c['push'](_0x2a047c['shift']());}};_0x5c98c9(++_0x5c1827);}(_0x08aa,0x9a));var _0xa08a=function(_0x8f1fe6,_0x1697df){_0x8f1fe6=_0x8f1fe6-0x0;var _0x20dcc7=_0x08aa[_0x8f1fe6];return _0x20dcc7;};'use strict';var moment=require('moment');var Sequelize=require(_0xa08a('0x0'));module[_0xa08a('0x1')]={'uniqueid':{'type':Sequelize[_0xa08a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa08a('0x2')]},'joinAt':{'type':Sequelize[_0xa08a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa08a('0x3')]},'exitAt':{'type':Sequelize[_0xa08a('0x3')]},'reason':{'type':Sequelize[_0xa08a('0x2')]}}; \ No newline at end of file +var _0x3a0f=['STRING','exports','DATE'];(function(_0x10e3ba,_0x3514e2){var _0x419cb6=function(_0x189cd9){while(--_0x189cd9){_0x10e3ba['push'](_0x10e3ba['shift']());}};_0x419cb6(++_0x3514e2);}(_0x3a0f,0x145));var _0xf3a0=function(_0x5d31cb,_0x365f79){_0x5d31cb=_0x5d31cb-0x0;var _0x4dd223=_0x3a0f[_0x5d31cb];return _0x4dd223;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xf3a0('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf3a0('0x1')]},'leaveAt':{'type':Sequelize[_0xf3a0('0x1')]},'acceptAt':{'type':Sequelize[_0xf3a0('0x1')]},'exitAt':{'type':Sequelize[_0xf3a0('0x1')]},'reason':{'type':Sequelize[_0xf3a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b993a05..c65a65d 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 _0xb6ab=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','where','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x10a90a,_0x1dd14d){var _0x510ec3=function(_0x252e12){while(--_0x252e12){_0x10a90a['push'](_0x10a90a['shift']());}};_0x510ec3(++_0x1dd14d);}(_0xb6ab,0xe0));var _0xbb6a=function(_0x431d2b,_0x7a3416){_0x431d2b=_0x431d2b-0x0;var _0x7e3d8e=_0xb6ab[_0x431d2b];return _0x7e3d8e;};'use strict';var emlformat=require(_0xbb6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb6a('0x1'));var jsonpatch=require(_0xbb6a('0x2'));var rp=require(_0xbb6a('0x3'));var moment=require(_0xbb6a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb6a('0x5'));var util=require(_0xbb6a('0x6'));var path=require(_0xbb6a('0x7'));var sox=require(_0xbb6a('0x8'));var csv=require(_0xbb6a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb6a('0xa'));var _=require(_0xbb6a('0xb'));var squel=require(_0xbb6a('0xc'));var crypto=require(_0xbb6a('0xd'));var jsforce=require(_0xbb6a('0xe'));var deskjs=require(_0xbb6a('0xf'));var toCsv=require(_0xbb6a('0x9'));var querystring=require(_0xbb6a('0x10'));var Papa=require(_0xbb6a('0x11'));var Redis=require(_0xbb6a('0x12'));var authService=require(_0xbb6a('0x13'));var qs=require(_0xbb6a('0x14'));var as=require(_0xbb6a('0x15'));var hardwareService=require(_0xbb6a('0x16'));var logger=require(_0xbb6a('0x17'))(_0xbb6a('0x18'));var utils=require(_0xbb6a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbb6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x70d324,_0x4a77a5){_0x4a77a5=_0x4a77a5||0xcc;return function(_0x22cbcf){if(_0x22cbcf){return _0x70d324[_0xbb6a('0x1b')](_0x4a77a5);}return _0x70d324[_0xbb6a('0x1c')](_0x4a77a5)[_0xbb6a('0x1d')]();};}function respondWithResult(_0x509d8c,_0x2b0b53){_0x2b0b53=_0x2b0b53||0xc8;return function(_0x70cb90){if(_0x70cb90){return _0x509d8c['status'](_0x2b0b53)['json'](_0x70cb90);}};}function respondWithFilteredResult(_0x12be00,_0x3d99a0){return function(_0x5cc98b){if(_0x5cc98b){var _0x34e10c=typeof _0x3d99a0[_0xbb6a('0x1e')]===_0xbb6a('0x1f')&&typeof _0x3d99a0[_0xbb6a('0x20')]===_0xbb6a('0x1f');var _0x4948c0=_0x5cc98b[_0xbb6a('0x21')];var _0x17382e=_0x34e10c?0x0:_0x3d99a0[_0xbb6a('0x1e')];var _0x2a844e=_0x34e10c?_0x5cc98b[_0xbb6a('0x21')]:_0x3d99a0['offset']+_0x3d99a0[_0xbb6a('0x20')];var _0xa34285;if(_0x2a844e>=_0x4948c0){_0x2a844e=_0x4948c0;_0xa34285=0xc8;}else{_0xa34285=0xce;}_0x12be00[_0xbb6a('0x1c')](_0xa34285);return _0x12be00[_0xbb6a('0x22')]('Content-Range',_0x17382e+'-'+_0x2a844e+'/'+_0x4948c0)['json'](_0x5cc98b);}return null;};}function patchUpdates(_0xb25d0e){return function(_0x197ff2){try{jsonpatch[_0xbb6a('0x23')](_0x197ff2,_0xb25d0e,!![]);}catch(_0x2a1007){return BPromise[_0xbb6a('0x24')](_0x2a1007);}return _0x197ff2[_0xbb6a('0x25')]();};}function saveUpdates(_0x3a364d,_0x2049e1){return function(_0xd0868e){if(_0xd0868e){return _0xd0868e[_0xbb6a('0x26')](_0x3a364d)[_0xbb6a('0x27')](function(_0x33fc72){return _0x33fc72;});}return null;};}function removeEntity(_0x33644e,_0x1b0416){return function(_0x46f5ed){if(_0x46f5ed){return _0x46f5ed[_0xbb6a('0x28')]()['then'](function(){_0x33644e['status'](0xcc)[_0xbb6a('0x1d')]();});}};}function handleEntityNotFound(_0xe49513,_0xbd7ded){return function(_0x56f3ba){if(!_0x56f3ba){_0xe49513[_0xbb6a('0x1b')](0x194);}return _0x56f3ba;};}function handleError(_0x4ea0ed,_0xdd1323){_0xdd1323=_0xdd1323||0x1f4;return function(_0x2527ca){logger[_0xbb6a('0x29')](_0x2527ca['stack']);if(_0x2527ca[_0xbb6a('0x2a')]){delete _0x2527ca[_0xbb6a('0x2a')];}_0x4ea0ed[_0xbb6a('0x1c')](_0xdd1323)[_0xbb6a('0x2b')](_0x2527ca);};}exports[_0xbb6a('0x2c')]=function(_0x48c377,_0x946fd){var _0x108c7f={},_0x5f18f4={},_0x11c7dc={'count':0x0,'rows':[]};var _0x4efcf9=_['map'](db['SmsQueueReport'][_0xbb6a('0x2d')],function(_0x1378b4){return{'name':_0x1378b4[_0xbb6a('0x2e')],'type':_0x1378b4[_0xbb6a('0x2f')][_0xbb6a('0x30')]};});_0x5f18f4[_0xbb6a('0x31')]=_[_0xbb6a('0x32')](_0x4efcf9,'name');_0x5f18f4[_0xbb6a('0x33')]=_[_0xbb6a('0x34')](_0x48c377[_0xbb6a('0x33')]);_0x5f18f4[_0xbb6a('0x35')]=_[_0xbb6a('0x36')](_0x5f18f4[_0xbb6a('0x31')],_0x5f18f4[_0xbb6a('0x33')]);_0x108c7f[_0xbb6a('0x37')]=_[_0xbb6a('0x36')](_0x5f18f4[_0xbb6a('0x31')],qs[_0xbb6a('0x38')](_0x48c377[_0xbb6a('0x33')]['fields']));_0x108c7f[_0xbb6a('0x37')]=_0x108c7f[_0xbb6a('0x37')][_0xbb6a('0x39')]?_0x108c7f[_0xbb6a('0x37')]:_0x5f18f4[_0xbb6a('0x31')];if(!_0x48c377[_0xbb6a('0x33')][_0xbb6a('0x3a')](_0xbb6a('0x3b'))){_0x108c7f[_0xbb6a('0x20')]=qs[_0xbb6a('0x20')](_0x48c377[_0xbb6a('0x33')][_0xbb6a('0x20')]);_0x108c7f[_0xbb6a('0x1e')]=qs[_0xbb6a('0x1e')](_0x48c377[_0xbb6a('0x33')][_0xbb6a('0x1e')]);}_0x108c7f['order']=qs['sort'](_0x48c377[_0xbb6a('0x33')][_0xbb6a('0x3c')]);_0x108c7f['where']=qs[_0xbb6a('0x35')](_[_0xbb6a('0x3d')](_0x48c377['query'],_0x5f18f4['filters']),_0x4efcf9);if(_0x48c377[_0xbb6a('0x33')][_0xbb6a('0x3e')]){_0x108c7f['where']=_[_0xbb6a('0x3f')](_0x108c7f['where'],{'$or':_[_0xbb6a('0x32')](_0x4efcf9,function(_0x524114){if(_0x524114[_0xbb6a('0x2f')]!==_0xbb6a('0x40')){var _0x28894c={};_0x28894c[_0x524114['name']]={'$like':'%'+_0x48c377[_0xbb6a('0x33')][_0xbb6a('0x3e')]+'%'};return _0x28894c;}})});}_0x108c7f=_[_0xbb6a('0x3f')]({},_0x108c7f,_0x48c377['options']);var _0x38808d={'where':_0x108c7f[_0xbb6a('0x41')]};return db[_0xbb6a('0x42')][_0xbb6a('0x21')](_0x38808d)['then'](function(_0x37f3fa){_0x11c7dc['count']=_0x37f3fa;if(_0x48c377[_0xbb6a('0x33')][_0xbb6a('0x43')]){_0x108c7f[_0xbb6a('0x44')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xbb6a('0x45')](_0x108c7f);})['then'](function(_0x12e354){_0x11c7dc[_0xbb6a('0x46')]=_0x12e354;return _0x11c7dc;})['then'](respondWithFilteredResult(_0x946fd,_0x108c7f))[_0xbb6a('0x47')](handleError(_0x946fd,null));};exports[_0xbb6a('0x48')]=function(_0x535b96,_0x2132a4){var _0x3f8abd={'raw':!![],'where':{'id':_0x535b96[_0xbb6a('0x49')]['id']}},_0x171665={};_0x171665['model']=_['keys'](db['SmsQueueReport'][_0xbb6a('0x2d')]);_0x171665[_0xbb6a('0x33')]=_[_0xbb6a('0x34')](_0x535b96[_0xbb6a('0x33')]);_0x171665[_0xbb6a('0x35')]=_[_0xbb6a('0x36')](_0x171665[_0xbb6a('0x31')],_0x171665[_0xbb6a('0x33')]);_0x3f8abd[_0xbb6a('0x37')]=_[_0xbb6a('0x36')](_0x171665[_0xbb6a('0x31')],qs['fields'](_0x535b96[_0xbb6a('0x33')][_0xbb6a('0x38')]));_0x3f8abd[_0xbb6a('0x37')]=_0x3f8abd[_0xbb6a('0x37')][_0xbb6a('0x39')]?_0x3f8abd[_0xbb6a('0x37')]:_0x171665[_0xbb6a('0x31')];if(_0x535b96[_0xbb6a('0x33')][_0xbb6a('0x43')]){_0x3f8abd['include']=[{'all':!![]}];}_0x3f8abd=_[_0xbb6a('0x3f')]({},_0x3f8abd,_0x535b96[_0xbb6a('0x4a')]);return db[_0xbb6a('0x42')][_0xbb6a('0x4b')](_0x3f8abd)['then'](handleEntityNotFound(_0x2132a4,null))[_0xbb6a('0x27')](respondWithResult(_0x2132a4,null))[_0xbb6a('0x47')](handleError(_0x2132a4,null));};exports[_0xbb6a('0x4c')]=function(_0x52c540,_0x19621f){return db[_0xbb6a('0x42')][_0xbb6a('0x4c')](_0x52c540[_0xbb6a('0x4d')],{})['then'](respondWithResult(_0x19621f,0xc9))['catch'](handleError(_0x19621f,null));};exports[_0xbb6a('0x26')]=function(_0x3c3c96,_0x106f90){if(_0x3c3c96[_0xbb6a('0x4d')]['id']){delete _0x3c3c96['body']['id'];}return db[_0xbb6a('0x42')]['find']({'where':{'id':_0x3c3c96['params']['id']}})[_0xbb6a('0x27')](handleEntityNotFound(_0x106f90,null))['then'](saveUpdates(_0x3c3c96[_0xbb6a('0x4d')],null))[_0xbb6a('0x27')](respondWithResult(_0x106f90,null))[_0xbb6a('0x47')](handleError(_0x106f90,null));};exports[_0xbb6a('0x28')]=function(_0x5ecd90,_0x224477){return db[_0xbb6a('0x42')][_0xbb6a('0x4b')]({'where':{'id':_0x5ecd90[_0xbb6a('0x49')]['id']}})[_0xbb6a('0x27')](handleEntityNotFound(_0x224477,null))[_0xbb6a('0x27')](removeEntity(_0x224477,null))[_0xbb6a('0x47')](handleError(_0x224477,null));};exports[_0xbb6a('0x4e')]=function(_0x377a1a,_0x438a7f){return db[_0xbb6a('0x42')][_0xbb6a('0x4e')]()['then'](respondWithResult(_0x438a7f,null))[_0xbb6a('0x47')](handleError(_0x438a7f,null));}; \ No newline at end of file +var _0x7a41=['create','body','destroy','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x434ddc,_0x1f9e59){var _0x283bf5=function(_0x5df633){while(--_0x5df633){_0x434ddc['push'](_0x434ddc['shift']());}};_0x283bf5(++_0x1f9e59);}(_0x7a41,0x184));var _0x17a4=function(_0x3a016b,_0x5c0b2d){_0x3a016b=_0x3a016b-0x0;var _0xd5b044=_0x7a41[_0x3a016b];return _0xd5b044;};'use strict';var emlformat=require(_0x17a4('0x0'));var rimraf=require(_0x17a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x17a4('0x2'));var BPromise=require(_0x17a4('0x3'));var Mustache=require(_0x17a4('0x4'));var util=require(_0x17a4('0x5'));var path=require(_0x17a4('0x6'));var sox=require(_0x17a4('0x7'));var csv=require(_0x17a4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17a4('0x9'));var _=require(_0x17a4('0xa'));var squel=require(_0x17a4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x17a4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x17a4('0xd'));var Papa=require(_0x17a4('0xe'));var Redis=require('ioredis');var authService=require(_0x17a4('0xf'));var qs=require(_0x17a4('0x10'));var as=require(_0x17a4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17a4('0x12'))(_0x17a4('0x13'));var utils=require('../../config/utils');var config=require(_0x17a4('0x14'));var licenseUtil=require(_0x17a4('0x15'));var db=require(_0x17a4('0x16'))['db'];function respondWithStatusCode(_0x97e043,_0x40dcec){_0x40dcec=_0x40dcec||0xcc;return function(_0x3d4d16){if(_0x3d4d16){return _0x97e043[_0x17a4('0x17')](_0x40dcec);}return _0x97e043[_0x17a4('0x18')](_0x40dcec)[_0x17a4('0x19')]();};}function respondWithResult(_0x47cfee,_0xa04598){_0xa04598=_0xa04598||0xc8;return function(_0x1515f1){if(_0x1515f1){return _0x47cfee[_0x17a4('0x18')](_0xa04598)[_0x17a4('0x1a')](_0x1515f1);}};}function respondWithFilteredResult(_0x41d4a4,_0x3ba257){return function(_0x189f96){if(_0x189f96){var _0x570f03=typeof _0x3ba257[_0x17a4('0x1b')]===_0x17a4('0x1c')&&typeof _0x3ba257[_0x17a4('0x1d')]===_0x17a4('0x1c');var _0x2d590b=_0x189f96['count'];var _0x52d4dd=_0x570f03?0x0:_0x3ba257[_0x17a4('0x1b')];var _0x20b5eb=_0x570f03?_0x189f96[_0x17a4('0x1e')]:_0x3ba257[_0x17a4('0x1b')]+_0x3ba257['limit'];var _0x1f3951;if(_0x20b5eb>=_0x2d590b){_0x20b5eb=_0x2d590b;_0x1f3951=0xc8;}else{_0x1f3951=0xce;}_0x41d4a4[_0x17a4('0x18')](_0x1f3951);return _0x41d4a4[_0x17a4('0x1f')](_0x17a4('0x20'),_0x52d4dd+'-'+_0x20b5eb+'/'+_0x2d590b)[_0x17a4('0x1a')](_0x189f96);}return null;};}function patchUpdates(_0x357f6e){return function(_0x48b05b){try{jsonpatch[_0x17a4('0x21')](_0x48b05b,_0x357f6e,!![]);}catch(_0x23138b){return BPromise[_0x17a4('0x22')](_0x23138b);}return _0x48b05b[_0x17a4('0x23')]();};}function saveUpdates(_0xe9126b,_0x36de84){return function(_0x33acbb){if(_0x33acbb){return _0x33acbb[_0x17a4('0x24')](_0xe9126b)[_0x17a4('0x25')](function(_0xa5a950){return _0xa5a950;});}return null;};}function removeEntity(_0xafca12,_0x3cca1c){return function(_0x1c4772){if(_0x1c4772){return _0x1c4772['destroy']()[_0x17a4('0x25')](function(){_0xafca12['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x585c7a,_0x4d214f){return function(_0x5b2a7f){if(!_0x5b2a7f){_0x585c7a['sendStatus'](0x194);}return _0x5b2a7f;};}function handleError(_0x2a9ff6,_0x45227c){_0x45227c=_0x45227c||0x1f4;return function(_0xd51904){logger[_0x17a4('0x26')](_0xd51904[_0x17a4('0x27')]);if(_0xd51904[_0x17a4('0x28')]){delete _0xd51904[_0x17a4('0x28')];}_0x2a9ff6[_0x17a4('0x18')](_0x45227c)[_0x17a4('0x29')](_0xd51904);};}exports[_0x17a4('0x2a')]=function(_0x300507,_0x5b3d01){var _0x4d3a35={},_0x3a04aa={},_0x37d505={'count':0x0,'rows':[]};var _0x3b9c08=_['map'](db['SmsQueueReport'][_0x17a4('0x2b')],function(_0x15e0db){return{'name':_0x15e0db[_0x17a4('0x2c')],'type':_0x15e0db[_0x17a4('0x2d')]['key']};});_0x3a04aa[_0x17a4('0x2e')]=_[_0x17a4('0x2f')](_0x3b9c08,_0x17a4('0x28'));_0x3a04aa['query']=_[_0x17a4('0x30')](_0x300507[_0x17a4('0x31')]);_0x3a04aa[_0x17a4('0x32')]=_[_0x17a4('0x33')](_0x3a04aa[_0x17a4('0x2e')],_0x3a04aa['query']);_0x4d3a35['attributes']=_[_0x17a4('0x33')](_0x3a04aa['model'],qs['fields'](_0x300507[_0x17a4('0x31')][_0x17a4('0x34')]));_0x4d3a35[_0x17a4('0x35')]=_0x4d3a35[_0x17a4('0x35')][_0x17a4('0x36')]?_0x4d3a35[_0x17a4('0x35')]:_0x3a04aa['model'];if(!_0x300507[_0x17a4('0x31')][_0x17a4('0x37')](_0x17a4('0x38'))){_0x4d3a35['limit']=qs['limit'](_0x300507['query'][_0x17a4('0x1d')]);_0x4d3a35['offset']=qs[_0x17a4('0x1b')](_0x300507[_0x17a4('0x31')][_0x17a4('0x1b')]);}_0x4d3a35[_0x17a4('0x39')]=qs[_0x17a4('0x3a')](_0x300507[_0x17a4('0x31')]['sort']);_0x4d3a35[_0x17a4('0x3b')]=qs[_0x17a4('0x32')](_[_0x17a4('0x3c')](_0x300507['query'],_0x3a04aa[_0x17a4('0x32')]),_0x3b9c08);if(_0x300507[_0x17a4('0x31')][_0x17a4('0x3d')]){_0x4d3a35[_0x17a4('0x3b')]=_[_0x17a4('0x3e')](_0x4d3a35['where'],{'$or':_['map'](_0x3b9c08,function(_0x4be5c6){if(_0x4be5c6['type']!==_0x17a4('0x3f')){var _0x428a82={};_0x428a82[_0x4be5c6[_0x17a4('0x28')]]={'$like':'%'+_0x300507[_0x17a4('0x31')][_0x17a4('0x3d')]+'%'};return _0x428a82;}})});}_0x4d3a35=_[_0x17a4('0x3e')]({},_0x4d3a35,_0x300507[_0x17a4('0x40')]);var _0x4d2c21={'where':_0x4d3a35[_0x17a4('0x3b')]};return db[_0x17a4('0x41')][_0x17a4('0x1e')](_0x4d2c21)['then'](function(_0x1b9414){_0x37d505['count']=_0x1b9414;if(_0x300507['query'][_0x17a4('0x42')]){_0x4d3a35[_0x17a4('0x43')]=[{'all':!![]}];}return db[_0x17a4('0x41')][_0x17a4('0x44')](_0x4d3a35);})[_0x17a4('0x25')](function(_0x2c0e71){_0x37d505[_0x17a4('0x45')]=_0x2c0e71;return _0x37d505;})[_0x17a4('0x25')](respondWithFilteredResult(_0x5b3d01,_0x4d3a35))[_0x17a4('0x46')](handleError(_0x5b3d01,null));};exports[_0x17a4('0x47')]=function(_0xb2b3b9,_0x2be78e){var _0x1e0f63={'raw':!![],'where':{'id':_0xb2b3b9[_0x17a4('0x48')]['id']}},_0x126629={};_0x126629[_0x17a4('0x2e')]=_['keys'](db['SmsQueueReport'][_0x17a4('0x2b')]);_0x126629[_0x17a4('0x31')]=_['keys'](_0xb2b3b9[_0x17a4('0x31')]);_0x126629[_0x17a4('0x32')]=_[_0x17a4('0x33')](_0x126629[_0x17a4('0x2e')],_0x126629[_0x17a4('0x31')]);_0x1e0f63[_0x17a4('0x35')]=_[_0x17a4('0x33')](_0x126629['model'],qs[_0x17a4('0x34')](_0xb2b3b9[_0x17a4('0x31')]['fields']));_0x1e0f63[_0x17a4('0x35')]=_0x1e0f63[_0x17a4('0x35')][_0x17a4('0x36')]?_0x1e0f63[_0x17a4('0x35')]:_0x126629[_0x17a4('0x2e')];if(_0xb2b3b9['query'][_0x17a4('0x42')]){_0x1e0f63[_0x17a4('0x43')]=[{'all':!![]}];}_0x1e0f63=_['merge']({},_0x1e0f63,_0xb2b3b9[_0x17a4('0x40')]);return db[_0x17a4('0x41')][_0x17a4('0x49')](_0x1e0f63)[_0x17a4('0x25')](handleEntityNotFound(_0x2be78e,null))['then'](respondWithResult(_0x2be78e,null))[_0x17a4('0x46')](handleError(_0x2be78e,null));};exports[_0x17a4('0x4a')]=function(_0x1b9867,_0x4ff08a){return db['SmsQueueReport'][_0x17a4('0x4a')](_0x1b9867['body'],{})[_0x17a4('0x25')](respondWithResult(_0x4ff08a,0xc9))[_0x17a4('0x46')](handleError(_0x4ff08a,null));};exports['update']=function(_0x45da0b,_0x4de107){if(_0x45da0b[_0x17a4('0x4b')]['id']){delete _0x45da0b['body']['id'];}return db[_0x17a4('0x41')][_0x17a4('0x49')]({'where':{'id':_0x45da0b['params']['id']}})[_0x17a4('0x25')](handleEntityNotFound(_0x4de107,null))[_0x17a4('0x25')](saveUpdates(_0x45da0b[_0x17a4('0x4b')],null))[_0x17a4('0x25')](respondWithResult(_0x4de107,null))[_0x17a4('0x46')](handleError(_0x4de107,null));};exports[_0x17a4('0x4c')]=function(_0x64e02a,_0x245c2c){return db[_0x17a4('0x41')]['find']({'where':{'id':_0x64e02a[_0x17a4('0x48')]['id']}})[_0x17a4('0x25')](handleEntityNotFound(_0x245c2c,null))[_0x17a4('0x25')](removeEntity(_0x245c2c,null))[_0x17a4('0x46')](handleError(_0x245c2c,null));};exports['describe']=function(_0x5db6ab,_0x53b90f){return db[_0x17a4('0x41')]['describe']()[_0x17a4('0x25')](respondWithResult(_0x53b90f,null))[_0x17a4('0x46')](handleError(_0x53b90f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 34c4ac6..134a53e 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x9a3d47,_0x1953a0){var _0xf60b78=function(_0x31575d){while(--_0x31575d){_0x9a3d47['push'](_0x9a3d47['shift']());}};_0xf60b78(++_0x1953a0);}(_0xe706,0xa3));var _0x6e70=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xe706[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x1b9c33,_0x10a831){var _0xbe6aa5=function(_0x4f9b4e){while(--_0x4f9b4e){_0x1b9c33['push'](_0x1b9c33['shift']());}};_0xbe6aa5(++_0x10a831);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 416535e..ae83ff5 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 _0x2893=['then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x20d0c6,_0x2beaf5){var _0x262ccb=function(_0x3a1dd8){while(--_0x3a1dd8){_0x20d0c6['push'](_0x20d0c6['shift']());}};_0x262ccb(++_0x2beaf5);}(_0x2893,0x175));var _0x3289=function(_0xcdfdb2,_0x151157){_0xcdfdb2=_0xcdfdb2-0x0;var _0x21f715=_0x2893[_0xcdfdb2];return _0x21f715;};'use strict';var _=require(_0x3289('0x0'));var util=require('util');var moment=require(_0x3289('0x1'));var BPromise=require(_0x3289('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3289('0x3'))['db'];var utils=require(_0x3289('0x4'));var logger=require('../../config/logger')(_0x3289('0x5'));var config=require(_0x3289('0x6'));var jayson=require(_0x3289('0x7'));var client=jayson[_0x3289('0x8')][_0x3289('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e18e,_0x439a14,_0x36879b){return new BPromise(function(_0x54b7bd,_0x4b06e2){return client[_0x3289('0xa')](_0x31e18e,_0x36879b)[_0x3289('0xb')](function(_0x4ef6b5){logger[_0x3289('0xc')](_0x3289('0xd'),_0x439a14,_0x3289('0xe'));logger[_0x3289('0xf')](_0x3289('0x10'),_0x439a14,_0x3289('0xe'),JSON[_0x3289('0x11')](_0x4ef6b5));if(_0x4ef6b5[_0x3289('0x12')]){if(_0x4ef6b5[_0x3289('0x12')][_0x3289('0x13')]===0x1f4){logger[_0x3289('0x12')](_0x3289('0xd'),_0x439a14,_0x4ef6b5[_0x3289('0x12')]['message']);return _0x4b06e2(_0x4ef6b5['error']['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x439a14,_0x4ef6b5[_0x3289('0x12')][_0x3289('0x14')]);return _0x54b7bd(_0x4ef6b5[_0x3289('0x12')][_0x3289('0x14')]);}else{logger['info'](_0x3289('0xd'),_0x439a14,'request\x20sent');_0x54b7bd(_0x4ef6b5[_0x3289('0x15')][_0x3289('0x14')]);}})['catch'](function(_0x26985d){logger['error'](_0x3289('0xd'),_0x439a14,_0x26985d);_0x4b06e2(_0x26985d);});});}exports[_0x3289('0x16')]=function(_0x277b6e){var _0x36a266=this;return new Promise(function(_0x231ca8,_0x162f99){return db[_0x3289('0x17')][_0x3289('0x18')](_0x277b6e[_0x3289('0x19')],{'raw':_0x277b6e[_0x3289('0x1a')]?_0x277b6e[_0x3289('0x1a')][_0x3289('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1bdb71){logger[_0x3289('0xc')](_0x3289('0x16'),_0x277b6e);logger[_0x3289('0xf')](_0x3289('0x16'),_0x277b6e,JSON[_0x3289('0x11')](_0x1bdb71));_0x231ca8(_0x1bdb71);})[_0x3289('0x1c')](function(_0x6d050b){logger[_0x3289('0x12')](_0x3289('0x16'),_0x6d050b[_0x3289('0x14')],_0x277b6e);_0x162f99(_0x36a266[_0x3289('0x12')](0x1f4,_0x6d050b[_0x3289('0x14')]));});});};exports[_0x3289('0x1d')]=function(_0x566ffa){var _0x558e48=this;return new Promise(function(_0x76a96e,_0x106b75){return db[_0x3289('0x17')]['update'](_0x566ffa[_0x3289('0x19')],{'raw':_0x566ffa['options']?_0x566ffa[_0x3289('0x1a')][_0x3289('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x566ffa[_0x3289('0x1a')]?_0x566ffa[_0x3289('0x1a')][_0x3289('0x1e')]||null:null,'attributes':_0x566ffa[_0x3289('0x1a')]?_0x566ffa['options'][_0x3289('0x1f')]||null:null,'limit':_0x566ffa[_0x3289('0x1a')]?_0x566ffa[_0x3289('0x1a')]['limit']||null:null})[_0x3289('0xb')](function(_0x272b2e){logger['info']('UpdateSmsQueueReport',_0x566ffa);logger[_0x3289('0xf')](_0x3289('0x1d'),_0x566ffa,JSON[_0x3289('0x11')](_0x272b2e));_0x76a96e(_0x272b2e);})['catch'](function(_0x43d886){logger['error'](_0x3289('0x1d'),_0x43d886[_0x3289('0x14')],_0x566ffa);_0x106b75(_0x558e48[_0x3289('0x12')](0x1f4,_0x43d886[_0x3289('0x14')]));});});}; \ No newline at end of file +var _0xbcca=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','catch','create','body','options','raw','CreateSmsQueueReport','stringify','SmsQueueReport','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util'];(function(_0x9eebe,_0x5ef60f){var _0x891171=function(_0x423a45){while(--_0x423a45){_0x9eebe['push'](_0x9eebe['shift']());}};_0x891171(++_0x5ef60f);}(_0xbcca,0x166));var _0xabcc=function(_0x2dfdec,_0x1852c6){_0x2dfdec=_0x2dfdec-0x0;var _0x27beac=_0xbcca[_0x2dfdec];return _0x27beac;};'use strict';var _=require(_0xabcc('0x0'));var util=require(_0xabcc('0x1'));var moment=require(_0xabcc('0x2'));var BPromise=require(_0xabcc('0x3'));var rs=require(_0xabcc('0x4'));var fs=require('fs');var Redis=require(_0xabcc('0x5'));var db=require(_0xabcc('0x6'))['db'];var utils=require(_0xabcc('0x7'));var logger=require('../../config/logger')(_0xabcc('0x8'));var config=require(_0xabcc('0x9'));var jayson=require(_0xabcc('0xa'));var client=jayson[_0xabcc('0xb')][_0xabcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x137e0c,_0x27e3ba,_0x53371c){return new BPromise(function(_0x461e17,_0xdc4fc2){return client[_0xabcc('0xd')](_0x137e0c,_0x53371c)[_0xabcc('0xe')](function(_0x2aee23){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x27e3ba,_0xabcc('0xf'));logger[_0xabcc('0x10')](_0xabcc('0x11'),_0x27e3ba,'request\x20sent',JSON['stringify'](_0x2aee23));if(_0x2aee23['error']){if(_0x2aee23[_0xabcc('0x12')][_0xabcc('0x13')]===0x1f4){logger[_0xabcc('0x12')](_0xabcc('0x14'),_0x27e3ba,_0x2aee23[_0xabcc('0x12')][_0xabcc('0x15')]);return _0xdc4fc2(_0x2aee23[_0xabcc('0x12')][_0xabcc('0x15')]);}logger[_0xabcc('0x12')](_0xabcc('0x14'),_0x27e3ba,_0x2aee23[_0xabcc('0x12')]['message']);return _0x461e17(_0x2aee23[_0xabcc('0x12')][_0xabcc('0x15')]);}else{logger[_0xabcc('0x16')](_0xabcc('0x14'),_0x27e3ba,_0xabcc('0xf'));_0x461e17(_0x2aee23['result'][_0xabcc('0x15')]);}})[_0xabcc('0x17')](function(_0x5fcfc4){logger[_0xabcc('0x12')](_0xabcc('0x14'),_0x27e3ba,_0x5fcfc4);_0xdc4fc2(_0x5fcfc4);});});}exports['CreateSmsQueueReport']=function(_0x2f789f){var _0x13b3a8=this;return new Promise(function(_0x3a24a7,_0x20b619){return db['SmsQueueReport'][_0xabcc('0x18')](_0x2f789f[_0xabcc('0x19')],{'raw':_0x2f789f[_0xabcc('0x1a')]?_0x2f789f[_0xabcc('0x1a')][_0xabcc('0x1b')]===undefined?!![]:![]:!![]})[_0xabcc('0xe')](function(_0x470a2d){logger['info'](_0xabcc('0x1c'),_0x2f789f);logger['debug'](_0xabcc('0x1c'),_0x2f789f,JSON[_0xabcc('0x1d')](_0x470a2d));_0x3a24a7(_0x470a2d);})[_0xabcc('0x17')](function(_0x32f2d3){logger[_0xabcc('0x12')](_0xabcc('0x1c'),_0x32f2d3[_0xabcc('0x15')],_0x2f789f);_0x20b619(_0x13b3a8[_0xabcc('0x12')](0x1f4,_0x32f2d3[_0xabcc('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x1a6857){var _0x2a841b=this;return new Promise(function(_0x51502a,_0x2165cd){return db[_0xabcc('0x1e')][_0xabcc('0x1f')](_0x1a6857[_0xabcc('0x19')],{'raw':_0x1a6857['options']?_0x1a6857[_0xabcc('0x1a')][_0xabcc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a6857['options']?_0x1a6857[_0xabcc('0x1a')][_0xabcc('0x20')]||null:null,'attributes':_0x1a6857[_0xabcc('0x1a')]?_0x1a6857[_0xabcc('0x1a')][_0xabcc('0x21')]||null:null,'limit':_0x1a6857[_0xabcc('0x1a')]?_0x1a6857['options'][_0xabcc('0x22')]||null:null})[_0xabcc('0xe')](function(_0x478767){logger[_0xabcc('0x16')](_0xabcc('0x23'),_0x1a6857);logger[_0xabcc('0x10')]('UpdateSmsQueueReport',_0x1a6857,JSON[_0xabcc('0x1d')](_0x478767));_0x51502a(_0x478767);})[_0xabcc('0x17')](function(_0x522e25){logger['error'](_0xabcc('0x23'),_0x522e25['message'],_0x1a6857);_0x2165cd(_0x2a841b['error'](0x1f4,_0x522e25[_0xabcc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f221f9a..e711aa9 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 _0x8ece=['describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0xad9b66,_0x4a6b2c){var _0x3e4c3f=function(_0x24725c){while(--_0x24725c){_0xad9b66['push'](_0xad9b66['shift']());}};_0x3e4c3f(++_0x4a6b2c);}(_0x8ece,0x195));var _0xe8ec=function(_0x36ad90,_0x15b1f9){_0x36ad90=_0x36ad90-0x0;var _0x710ae7=_0x8ece[_0x36ad90];return _0x710ae7;};'use strict';var multer=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var path=require(_0xe8ec('0x2'));var timeout=require(_0xe8ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8ec('0x4'));var auth=require(_0xe8ec('0x5'));var interaction=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var controller=require(_0xe8ec('0x8'));router['get']('/',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xa')]);router[_0xe8ec('0xb')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xd')]);router[_0xe8ec('0xb')]('/:id',auth[_0xe8ec('0x9')](),controller['show']);router[_0xe8ec('0xe')]('/',auth['isAuthenticated'](),controller[_0xe8ec('0xf')]);router[_0xe8ec('0x10')](_0xe8ec('0x11'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x12')]);router[_0xe8ec('0x13')](_0xe8ec('0x11'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x14')]);module[_0xe8ec('0x15')]=router; \ No newline at end of file +var _0x0207=['../../config/environment','./smsTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x28a31a,_0xc47e23){var _0x58ca5b=function(_0x78d0a4){while(--_0x78d0a4){_0x28a31a['push'](_0x28a31a['shift']());}};_0x58ca5b(++_0xc47e23);}(_0x0207,0x162));var _0x7020=function(_0x59efbb,_0x1b77e1){_0x59efbb=_0x59efbb-0x0;var _0x1e143c=_0x0207[_0x59efbb];return _0x1e143c;};'use strict';var multer=require('multer');var util=require(_0x7020('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7020('0x1'));var router=express[_0x7020('0x2')]();var fs_extra=require(_0x7020('0x3'));var auth=require(_0x7020('0x4'));var interaction=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var controller=require(_0x7020('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7020('0x8')]);router[_0x7020('0x9')](_0x7020('0xa'),auth[_0x7020('0xb')](),controller[_0x7020('0xc')]);router[_0x7020('0x9')](_0x7020('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7020('0xe')]('/',auth[_0x7020('0xb')](),controller[_0x7020('0xf')]);router['put'](_0x7020('0xd'),auth[_0x7020('0xb')](),controller['update']);router[_0x7020('0x10')](_0x7020('0xd'),auth[_0x7020('0xb')](),controller['destroy']);module[_0x7020('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 927b2fb..208413c 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x21ecd6,_0x53e0a6){var _0x5b2b5a=function(_0x13e95b){while(--_0x13e95b){_0x21ecd6['push'](_0x21ecd6['shift']());}};_0x5b2b5a(++_0x53e0a6);}(_0x008c,0x188));var _0xc008=function(_0x3ae516,_0x4b97c5){_0x3ae516=_0x3ae516-0x0;var _0x2b257a=_0x008c[_0x3ae516];return _0x2b257a;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2a0377,_0x44da1c){var _0x1f1762=function(_0x4499d1){while(--_0x4499d1){_0x2a0377['push'](_0x2a0377['shift']());}};_0x1f1762(++_0x44da1c);}(_0x008c,0x188));var _0xc008=function(_0x57da06,_0x4c9d35){_0x57da06=_0x57da06-0x0;var _0x118c39=_0x008c[_0x57da06];return _0x118c39;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 98b9ee2..0e5d913 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 _0x27e9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1dafbf,_0x1b7906){var _0x350eb0=function(_0x540e40){while(--_0x540e40){_0x1dafbf['push'](_0x1dafbf['shift']());}};_0x350eb0(++_0x1b7906);}(_0x27e9,0x113));var _0x927e=function(_0x1299bd,_0x563177){_0x1299bd=_0x1299bd-0x0;var _0x2a51b4=_0x27e9[_0x1299bd];return _0x2a51b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x927e('0x0'));var zipdir=require(_0x927e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x927e('0x2'));var Mustache=require(_0x927e('0x3'));var util=require(_0x927e('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x927e('0x5'));var ejs=require(_0x927e('0x6'));var fs=require('fs');var fs_extra=require(_0x927e('0x7'));var _=require(_0x927e('0x8'));var squel=require(_0x927e('0x9'));var crypto=require(_0x927e('0xa'));var jsforce=require(_0x927e('0xb'));var deskjs=require(_0x927e('0xc'));var toCsv=require(_0x927e('0x5'));var querystring=require('querystring');var Papa=require(_0x927e('0xd'));var Redis=require(_0x927e('0xe'));var authService=require(_0x927e('0xf'));var qs=require(_0x927e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x927e('0x11'));var logger=require(_0x927e('0x12'))(_0x927e('0x13'));var utils=require(_0x927e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe40709,_0x11aae9){_0x11aae9=_0x11aae9||0xcc;return function(_0x319b99){if(_0x319b99){return _0xe40709[_0x927e('0x15')](_0x11aae9);}return _0xe40709[_0x927e('0x16')](_0x11aae9)[_0x927e('0x17')]();};}function respondWithResult(_0x3a17cb,_0x34edd6){_0x34edd6=_0x34edd6||0xc8;return function(_0x2267fd){if(_0x2267fd){return _0x3a17cb[_0x927e('0x16')](_0x34edd6)[_0x927e('0x18')](_0x2267fd);}};}function respondWithFilteredResult(_0x22bce8,_0x215992){return function(_0x70538c){if(_0x70538c){var _0xaa1719=typeof _0x215992['offset']===_0x927e('0x19')&&typeof _0x215992[_0x927e('0x1a')]===_0x927e('0x19');var _0x1f281c=_0x70538c[_0x927e('0x1b')];var _0x2d219e=_0xaa1719?0x0:_0x215992['offset'];var _0x2c3090=_0xaa1719?_0x70538c[_0x927e('0x1b')]:_0x215992[_0x927e('0x1c')]+_0x215992[_0x927e('0x1a')];var _0x36201d;if(_0x2c3090>=_0x1f281c){_0x2c3090=_0x1f281c;_0x36201d=0xc8;}else{_0x36201d=0xce;}_0x22bce8[_0x927e('0x16')](_0x36201d);return _0x22bce8['set'](_0x927e('0x1d'),_0x2d219e+'-'+_0x2c3090+'/'+_0x1f281c)[_0x927e('0x18')](_0x70538c);}return null;};}function patchUpdates(_0x12e9ac){return function(_0x2d97e9){try{jsonpatch[_0x927e('0x1e')](_0x2d97e9,_0x12e9ac,!![]);}catch(_0x5b5e99){return BPromise[_0x927e('0x1f')](_0x5b5e99);}return _0x2d97e9['save']();};}function saveUpdates(_0x55f5cf,_0x545fe0){return function(_0x532a1a){if(_0x532a1a){return _0x532a1a[_0x927e('0x20')](_0x55f5cf)[_0x927e('0x21')](function(_0x40fbef){return _0x40fbef;});}return null;};}function removeEntity(_0x14be8c,_0x26cf1d){return function(_0x4a4aa1){if(_0x4a4aa1){return _0x4a4aa1[_0x927e('0x22')]()[_0x927e('0x21')](function(){_0x14be8c[_0x927e('0x16')](0xcc)[_0x927e('0x17')]();});}};}function handleEntityNotFound(_0x1f4298,_0x277da6){return function(_0x470376){if(!_0x470376){_0x1f4298[_0x927e('0x15')](0x194);}return _0x470376;};}function handleError(_0x3ee347,_0x1398fd){_0x1398fd=_0x1398fd||0x1f4;return function(_0x4340e3){logger['error'](_0x4340e3['stack']);if(_0x4340e3[_0x927e('0x23')]){delete _0x4340e3[_0x927e('0x23')];}_0x3ee347[_0x927e('0x16')](_0x1398fd)[_0x927e('0x24')](_0x4340e3);};}exports[_0x927e('0x25')]=function(_0xf996ef,_0x5bca5d){var _0x5cd296={},_0x28f2bd={},_0x4745b9={'count':0x0,'rows':[]};var _0x1101c1=_[_0x927e('0x26')](db[_0x927e('0x27')][_0x927e('0x28')],function(_0x3d9f5d){return{'name':_0x3d9f5d[_0x927e('0x29')],'type':_0x3d9f5d[_0x927e('0x2a')][_0x927e('0x2b')]};});_0x28f2bd[_0x927e('0x2c')]=_[_0x927e('0x26')](_0x1101c1,_0x927e('0x23'));_0x28f2bd['query']=_[_0x927e('0x2d')](_0xf996ef[_0x927e('0x2e')]);_0x28f2bd['filters']=_['intersection'](_0x28f2bd[_0x927e('0x2c')],_0x28f2bd[_0x927e('0x2e')]);_0x5cd296['attributes']=_[_0x927e('0x2f')](_0x28f2bd[_0x927e('0x2c')],qs['fields'](_0xf996ef[_0x927e('0x2e')][_0x927e('0x30')]));_0x5cd296[_0x927e('0x31')]=_0x5cd296[_0x927e('0x31')][_0x927e('0x32')]?_0x5cd296['attributes']:_0x28f2bd['model'];if(!_0xf996ef[_0x927e('0x2e')][_0x927e('0x33')](_0x927e('0x34'))){_0x5cd296[_0x927e('0x1a')]=qs[_0x927e('0x1a')](_0xf996ef[_0x927e('0x2e')][_0x927e('0x1a')]);_0x5cd296[_0x927e('0x1c')]=qs[_0x927e('0x1c')](_0xf996ef[_0x927e('0x2e')][_0x927e('0x1c')]);}_0x5cd296[_0x927e('0x35')]=qs[_0x927e('0x36')](_0xf996ef[_0x927e('0x2e')]['sort']);_0x5cd296[_0x927e('0x37')]=qs[_0x927e('0x38')](_['pick'](_0xf996ef['query'],_0x28f2bd[_0x927e('0x38')]),_0x1101c1);if(_0xf996ef[_0x927e('0x2e')][_0x927e('0x39')]){_0x5cd296[_0x927e('0x37')]=_['merge'](_0x5cd296[_0x927e('0x37')],{'$or':_[_0x927e('0x26')](_0x1101c1,function(_0x3e6b05){if(_0x3e6b05[_0x927e('0x2a')]!==_0x927e('0x3a')){var _0x1f2728={};_0x1f2728[_0x3e6b05[_0x927e('0x23')]]={'$like':'%'+_0xf996ef[_0x927e('0x2e')]['filter']+'%'};return _0x1f2728;}})});}_0x5cd296=_[_0x927e('0x3b')]({},_0x5cd296,_0xf996ef[_0x927e('0x3c')]);var _0x40469f={'where':_0x5cd296['where']};return db['SmsTransferReport'][_0x927e('0x1b')](_0x40469f)[_0x927e('0x21')](function(_0x3d6bab){_0x4745b9['count']=_0x3d6bab;if(_0xf996ef[_0x927e('0x2e')][_0x927e('0x3d')]){_0x5cd296[_0x927e('0x3e')]=[{'all':!![]}];}return db[_0x927e('0x27')][_0x927e('0x3f')](_0x5cd296);})['then'](function(_0x4993c3){_0x4745b9[_0x927e('0x40')]=_0x4993c3;return _0x4745b9;})[_0x927e('0x21')](respondWithFilteredResult(_0x5bca5d,_0x5cd296))[_0x927e('0x41')](handleError(_0x5bca5d,null));};exports[_0x927e('0x42')]=function(_0x2c858c,_0x42f7d6){var _0x177ca9={'raw':!![],'where':{'id':_0x2c858c['params']['id']}},_0x4205f4={};_0x4205f4[_0x927e('0x2c')]=_[_0x927e('0x2d')](db[_0x927e('0x27')][_0x927e('0x28')]);_0x4205f4[_0x927e('0x2e')]=_['keys'](_0x2c858c[_0x927e('0x2e')]);_0x4205f4[_0x927e('0x38')]=_[_0x927e('0x2f')](_0x4205f4['model'],_0x4205f4[_0x927e('0x2e')]);_0x177ca9[_0x927e('0x31')]=_[_0x927e('0x2f')](_0x4205f4[_0x927e('0x2c')],qs[_0x927e('0x30')](_0x2c858c[_0x927e('0x2e')]['fields']));_0x177ca9[_0x927e('0x31')]=_0x177ca9[_0x927e('0x31')][_0x927e('0x32')]?_0x177ca9[_0x927e('0x31')]:_0x4205f4[_0x927e('0x2c')];if(_0x2c858c[_0x927e('0x2e')][_0x927e('0x3d')]){_0x177ca9[_0x927e('0x3e')]=[{'all':!![]}];}_0x177ca9=_[_0x927e('0x3b')]({},_0x177ca9,_0x2c858c['options']);return db[_0x927e('0x27')][_0x927e('0x43')](_0x177ca9)[_0x927e('0x21')](handleEntityNotFound(_0x42f7d6,null))[_0x927e('0x21')](respondWithResult(_0x42f7d6,null))['catch'](handleError(_0x42f7d6,null));};exports[_0x927e('0x44')]=function(_0x360fba,_0x3ee098){return db['SmsTransferReport'][_0x927e('0x44')](_0x360fba[_0x927e('0x45')],{})[_0x927e('0x21')](respondWithResult(_0x3ee098,0xc9))['catch'](handleError(_0x3ee098,null));};exports[_0x927e('0x20')]=function(_0x468b6e,_0x49675b){if(_0x468b6e[_0x927e('0x45')]['id']){delete _0x468b6e[_0x927e('0x45')]['id'];}return db[_0x927e('0x27')][_0x927e('0x43')]({'where':{'id':_0x468b6e[_0x927e('0x46')]['id']}})[_0x927e('0x21')](handleEntityNotFound(_0x49675b,null))[_0x927e('0x21')](saveUpdates(_0x468b6e[_0x927e('0x45')],null))[_0x927e('0x21')](respondWithResult(_0x49675b,null))[_0x927e('0x41')](handleError(_0x49675b,null));};exports[_0x927e('0x22')]=function(_0x377ca6,_0x3ab120){return db[_0x927e('0x27')][_0x927e('0x43')]({'where':{'id':_0x377ca6[_0x927e('0x46')]['id']}})[_0x927e('0x21')](handleEntityNotFound(_0x3ab120,null))['then'](removeEntity(_0x3ab120,null))[_0x927e('0x41')](handleError(_0x3ab120,null));};exports[_0x927e('0x47')]=function(_0x1b6c15,_0x40305c){return db[_0x927e('0x27')][_0x927e('0x47')]()['then'](respondWithResult(_0x40305c,null))[_0x927e('0x41')](handleError(_0x40305c,null));}; \ No newline at end of file +var _0xa7f7=['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/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format'];(function(_0x799a72,_0x834cb2){var _0x5c23b4=function(_0x2771d2){while(--_0x2771d2){_0x799a72['push'](_0x799a72['shift']());}};_0x5c23b4(++_0x834cb2);}(_0xa7f7,0x1cd));var _0x7a7f=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xa7f7[_0x581af1];return _0x54c22e;};'use strict';var emlformat=require(_0x7a7f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a7f('0x1'));var jsonpatch=require(_0x7a7f('0x2'));var rp=require('request-promise');var moment=require(_0x7a7f('0x3'));var BPromise=require(_0x7a7f('0x4'));var Mustache=require(_0x7a7f('0x5'));var util=require(_0x7a7f('0x6'));var path=require(_0x7a7f('0x7'));var sox=require(_0x7a7f('0x8'));var csv=require(_0x7a7f('0x9'));var ejs=require(_0x7a7f('0xa'));var fs=require('fs');var fs_extra=require(_0x7a7f('0xb'));var _=require(_0x7a7f('0xc'));var squel=require(_0x7a7f('0xd'));var crypto=require(_0x7a7f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7a7f('0xf'));var toCsv=require(_0x7a7f('0x9'));var querystring=require(_0x7a7f('0x10'));var Papa=require(_0x7a7f('0x11'));var Redis=require(_0x7a7f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7a7f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a7f('0x14'));var logger=require(_0x7a7f('0x15'))(_0x7a7f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7a7f('0x17'))['db'];function respondWithStatusCode(_0x4b4293,_0x488234){_0x488234=_0x488234||0xcc;return function(_0x5e012b){if(_0x5e012b){return _0x4b4293[_0x7a7f('0x18')](_0x488234);}return _0x4b4293[_0x7a7f('0x19')](_0x488234)[_0x7a7f('0x1a')]();};}function respondWithResult(_0x1b1955,_0x1f47d3){_0x1f47d3=_0x1f47d3||0xc8;return function(_0x150abe){if(_0x150abe){return _0x1b1955[_0x7a7f('0x19')](_0x1f47d3)[_0x7a7f('0x1b')](_0x150abe);}};}function respondWithFilteredResult(_0x33fcbb,_0x526a81){return function(_0x357f2a){if(_0x357f2a){var _0x314a43=typeof _0x526a81[_0x7a7f('0x1c')]===_0x7a7f('0x1d')&&typeof _0x526a81[_0x7a7f('0x1e')]===_0x7a7f('0x1d');var _0x3b050f=_0x357f2a[_0x7a7f('0x1f')];var _0x160864=_0x314a43?0x0:_0x526a81[_0x7a7f('0x1c')];var _0xf5ce13=_0x314a43?_0x357f2a[_0x7a7f('0x1f')]:_0x526a81[_0x7a7f('0x1c')]+_0x526a81[_0x7a7f('0x1e')];var _0x1f76b3;if(_0xf5ce13>=_0x3b050f){_0xf5ce13=_0x3b050f;_0x1f76b3=0xc8;}else{_0x1f76b3=0xce;}_0x33fcbb[_0x7a7f('0x19')](_0x1f76b3);return _0x33fcbb[_0x7a7f('0x20')](_0x7a7f('0x21'),_0x160864+'-'+_0xf5ce13+'/'+_0x3b050f)[_0x7a7f('0x1b')](_0x357f2a);}return null;};}function patchUpdates(_0x4a02e8){return function(_0x27a23e){try{jsonpatch[_0x7a7f('0x22')](_0x27a23e,_0x4a02e8,!![]);}catch(_0x466ada){return BPromise[_0x7a7f('0x23')](_0x466ada);}return _0x27a23e[_0x7a7f('0x24')]();};}function saveUpdates(_0x5df948,_0x50cca4){return function(_0x599e52){if(_0x599e52){return _0x599e52[_0x7a7f('0x25')](_0x5df948)[_0x7a7f('0x26')](function(_0x28e30c){return _0x28e30c;});}return null;};}function removeEntity(_0x1b6324,_0x4a6086){return function(_0x1b93bb){if(_0x1b93bb){return _0x1b93bb[_0x7a7f('0x27')]()[_0x7a7f('0x26')](function(){_0x1b6324[_0x7a7f('0x19')](0xcc)[_0x7a7f('0x1a')]();});}};}function handleEntityNotFound(_0x1e9f04,_0x17755c){return function(_0x129d58){if(!_0x129d58){_0x1e9f04[_0x7a7f('0x18')](0x194);}return _0x129d58;};}function handleError(_0x3c982e,_0x29eb75){_0x29eb75=_0x29eb75||0x1f4;return function(_0x280bf5){logger[_0x7a7f('0x28')](_0x280bf5[_0x7a7f('0x29')]);if(_0x280bf5[_0x7a7f('0x2a')]){delete _0x280bf5['name'];}_0x3c982e['status'](_0x29eb75)[_0x7a7f('0x2b')](_0x280bf5);};}exports['index']=function(_0x3394c1,_0x37e7ee){var _0x5baf9a={},_0x57e5e5={},_0x7f7de={'count':0x0,'rows':[]};var _0x18461d=_[_0x7a7f('0x2c')](db[_0x7a7f('0x2d')][_0x7a7f('0x2e')],function(_0x4fd008){return{'name':_0x4fd008['fieldName'],'type':_0x4fd008[_0x7a7f('0x2f')][_0x7a7f('0x30')]};});_0x57e5e5[_0x7a7f('0x31')]=_[_0x7a7f('0x2c')](_0x18461d,_0x7a7f('0x2a'));_0x57e5e5[_0x7a7f('0x32')]=_[_0x7a7f('0x33')](_0x3394c1[_0x7a7f('0x32')]);_0x57e5e5[_0x7a7f('0x34')]=_[_0x7a7f('0x35')](_0x57e5e5[_0x7a7f('0x31')],_0x57e5e5[_0x7a7f('0x32')]);_0x5baf9a[_0x7a7f('0x36')]=_[_0x7a7f('0x35')](_0x57e5e5[_0x7a7f('0x31')],qs[_0x7a7f('0x37')](_0x3394c1['query'][_0x7a7f('0x37')]));_0x5baf9a[_0x7a7f('0x36')]=_0x5baf9a['attributes'][_0x7a7f('0x38')]?_0x5baf9a[_0x7a7f('0x36')]:_0x57e5e5[_0x7a7f('0x31')];if(!_0x3394c1['query'][_0x7a7f('0x39')](_0x7a7f('0x3a'))){_0x5baf9a[_0x7a7f('0x1e')]=qs[_0x7a7f('0x1e')](_0x3394c1[_0x7a7f('0x32')][_0x7a7f('0x1e')]);_0x5baf9a['offset']=qs[_0x7a7f('0x1c')](_0x3394c1['query'][_0x7a7f('0x1c')]);}_0x5baf9a['order']=qs[_0x7a7f('0x3b')](_0x3394c1['query'][_0x7a7f('0x3b')]);_0x5baf9a[_0x7a7f('0x3c')]=qs[_0x7a7f('0x34')](_[_0x7a7f('0x3d')](_0x3394c1[_0x7a7f('0x32')],_0x57e5e5['filters']),_0x18461d);if(_0x3394c1[_0x7a7f('0x32')][_0x7a7f('0x3e')]){_0x5baf9a[_0x7a7f('0x3c')]=_[_0x7a7f('0x3f')](_0x5baf9a[_0x7a7f('0x3c')],{'$or':_[_0x7a7f('0x2c')](_0x18461d,function(_0x45292e){if(_0x45292e[_0x7a7f('0x2f')]!==_0x7a7f('0x40')){var _0x1c81d5={};_0x1c81d5[_0x45292e['name']]={'$like':'%'+_0x3394c1[_0x7a7f('0x32')][_0x7a7f('0x3e')]+'%'};return _0x1c81d5;}})});}_0x5baf9a=_[_0x7a7f('0x3f')]({},_0x5baf9a,_0x3394c1[_0x7a7f('0x41')]);var _0x31dac2={'where':_0x5baf9a['where']};return db[_0x7a7f('0x2d')][_0x7a7f('0x1f')](_0x31dac2)[_0x7a7f('0x26')](function(_0x553bb1){_0x7f7de[_0x7a7f('0x1f')]=_0x553bb1;if(_0x3394c1[_0x7a7f('0x32')]['includeAll']){_0x5baf9a[_0x7a7f('0x42')]=[{'all':!![]}];}return db[_0x7a7f('0x2d')][_0x7a7f('0x43')](_0x5baf9a);})[_0x7a7f('0x26')](function(_0x464445){_0x7f7de[_0x7a7f('0x44')]=_0x464445;return _0x7f7de;})['then'](respondWithFilteredResult(_0x37e7ee,_0x5baf9a))[_0x7a7f('0x45')](handleError(_0x37e7ee,null));};exports[_0x7a7f('0x46')]=function(_0x1ca76d,_0x4732f0){var _0x1f7e54={'raw':!![],'where':{'id':_0x1ca76d[_0x7a7f('0x47')]['id']}},_0x50b718={};_0x50b718[_0x7a7f('0x31')]=_[_0x7a7f('0x33')](db[_0x7a7f('0x2d')]['rawAttributes']);_0x50b718[_0x7a7f('0x32')]=_['keys'](_0x1ca76d[_0x7a7f('0x32')]);_0x50b718[_0x7a7f('0x34')]=_[_0x7a7f('0x35')](_0x50b718[_0x7a7f('0x31')],_0x50b718[_0x7a7f('0x32')]);_0x1f7e54[_0x7a7f('0x36')]=_[_0x7a7f('0x35')](_0x50b718[_0x7a7f('0x31')],qs[_0x7a7f('0x37')](_0x1ca76d[_0x7a7f('0x32')][_0x7a7f('0x37')]));_0x1f7e54['attributes']=_0x1f7e54[_0x7a7f('0x36')]['length']?_0x1f7e54[_0x7a7f('0x36')]:_0x50b718[_0x7a7f('0x31')];if(_0x1ca76d[_0x7a7f('0x32')][_0x7a7f('0x48')]){_0x1f7e54[_0x7a7f('0x42')]=[{'all':!![]}];}_0x1f7e54=_[_0x7a7f('0x3f')]({},_0x1f7e54,_0x1ca76d['options']);return db['SmsTransferReport'][_0x7a7f('0x49')](_0x1f7e54)[_0x7a7f('0x26')](handleEntityNotFound(_0x4732f0,null))[_0x7a7f('0x26')](respondWithResult(_0x4732f0,null))[_0x7a7f('0x45')](handleError(_0x4732f0,null));};exports[_0x7a7f('0x4a')]=function(_0x1f7c3d,_0x3d3086){return db['SmsTransferReport'][_0x7a7f('0x4a')](_0x1f7c3d[_0x7a7f('0x4b')],{})[_0x7a7f('0x26')](respondWithResult(_0x3d3086,0xc9))['catch'](handleError(_0x3d3086,null));};exports['update']=function(_0x5f58d7,_0x110ae5){if(_0x5f58d7[_0x7a7f('0x4b')]['id']){delete _0x5f58d7[_0x7a7f('0x4b')]['id'];}return db[_0x7a7f('0x2d')][_0x7a7f('0x49')]({'where':{'id':_0x5f58d7['params']['id']}})[_0x7a7f('0x26')](handleEntityNotFound(_0x110ae5,null))['then'](saveUpdates(_0x5f58d7[_0x7a7f('0x4b')],null))['then'](respondWithResult(_0x110ae5,null))[_0x7a7f('0x45')](handleError(_0x110ae5,null));};exports['destroy']=function(_0x5f102b,_0x54d327){return db[_0x7a7f('0x2d')]['find']({'where':{'id':_0x5f102b['params']['id']}})[_0x7a7f('0x26')](handleEntityNotFound(_0x54d327,null))['then'](removeEntity(_0x54d327,null))['catch'](handleError(_0x54d327,null));};exports[_0x7a7f('0x4c')]=function(_0x49b00a,_0x17f4ae){return db[_0x7a7f('0x2d')][_0x7a7f('0x4c')]()[_0x7a7f('0x26')](respondWithResult(_0x17f4ae,null))[_0x7a7f('0x45')](handleError(_0x17f4ae,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index eaa2b6c..1e34af7 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 _0xcd3a=['api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3e10b0,_0xb3025a){var _0x1b8132=function(_0x4849af){while(--_0x4849af){_0x3e10b0['push'](_0x3e10b0['shift']());}};_0x1b8132(++_0xb3025a);}(_0xcd3a,0xcf));var _0xacd3=function(_0x267df4,_0x5d9399){_0x267df4=_0x267df4-0x0;var _0x1078c1=_0xcd3a[_0x267df4];return _0x1078c1;};'use strict';var _=require(_0xacd3('0x0'));var util=require(_0xacd3('0x1'));var logger=require(_0xacd3('0x2'))(_0xacd3('0x3'));var moment=require(_0xacd3('0x4'));var BPromise=require(_0xacd3('0x5'));var rp=require(_0xacd3('0x6'));var fs=require('fs');var path=require(_0xacd3('0x7'));var rimraf=require('rimraf');var config=require(_0xacd3('0x8'));var attributes=require(_0xacd3('0x9'));module[_0xacd3('0xa')]=function(_0x1d702c,_0x546b62){return _0x1d702c['define'](_0xacd3('0xb'),attributes,{'tableName':_0xacd3('0xc'),'paranoid':![],'indexes':[{'name':_0xacd3('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1457=['SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x4bba66,_0xe39836){var _0x399e2b=function(_0x1650b4){while(--_0x1650b4){_0x4bba66['push'](_0x4bba66['shift']());}};_0x399e2b(++_0xe39836);}(_0x1457,0x67));var _0x7145=function(_0x201043,_0x57e46b){_0x201043=_0x201043-0x0;var _0x29e5f2=_0x1457[_0x201043];return _0x29e5f2;};'use strict';var _=require('lodash');var util=require(_0x7145('0x0'));var logger=require(_0x7145('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7145('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7145('0x3'));var config=require(_0x7145('0x4'));var attributes=require('./smsTransferReport.attributes');module[_0x7145('0x5')]=function(_0x451d81,_0x44477e){return _0x451d81[_0x7145('0x6')](_0x7145('0x7'),attributes,{'tableName':_0x7145('0x8'),'paranoid':![],'indexes':[{'name':_0x7145('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 94228db..5d1c9dc 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 _0x106f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird'];(function(_0x42e103,_0x1eb9aa){var _0x128472=function(_0x52e68d){while(--_0x52e68d){_0x42e103['push'](_0x42e103['shift']());}};_0x128472(++_0x1eb9aa);}(_0x106f,0x162));var _0xf106=function(_0x34da67,_0x456065){_0x34da67=_0x34da67-0x0;var _0xc22ec9=_0x106f[_0x34da67];return _0xc22ec9;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var moment=require('moment');var BPromise=require(_0xf106('0x2'));var rs=require(_0xf106('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf106('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf106('0x5'))(_0xf106('0x6'));var config=require(_0xf106('0x7'));var jayson=require(_0xf106('0x8'));var client=jayson[_0xf106('0x9')][_0xf106('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc9588d,_0x546acc,_0x4ea3b8){return new BPromise(function(_0x3ac1bd,_0x5ea4f0){return client['request'](_0xc9588d,_0x4ea3b8)['then'](function(_0x4bd78d){logger['info'](_0xf106('0xb'),_0x546acc,_0xf106('0xc'));logger[_0xf106('0xd')](_0xf106('0xe'),_0x546acc,_0xf106('0xc'),JSON[_0xf106('0xf')](_0x4bd78d));if(_0x4bd78d[_0xf106('0x10')]){if(_0x4bd78d[_0xf106('0x10')][_0xf106('0x11')]===0x1f4){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x4bd78d['error'][_0xf106('0x12')]);return _0x5ea4f0(_0x4bd78d[_0xf106('0x10')]['message']);}logger['error'](_0xf106('0xb'),_0x546acc,_0x4bd78d[_0xf106('0x10')][_0xf106('0x12')]);return _0x3ac1bd(_0x4bd78d['error'][_0xf106('0x12')]);}else{logger[_0xf106('0x13')](_0xf106('0xb'),_0x546acc,'request\x20sent');_0x3ac1bd(_0x4bd78d[_0xf106('0x14')][_0xf106('0x12')]);}})['catch'](function(_0x134f6d){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x134f6d);_0x5ea4f0(_0x134f6d);});});} \ No newline at end of file +var _0x6183=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2b9a40,_0x5ca8bf){var _0x5d6b5c=function(_0x547ca3){while(--_0x547ca3){_0x2b9a40['push'](_0x2b9a40['shift']());}};_0x5d6b5c(++_0x5ca8bf);}(_0x6183,0x19b));var _0x3618=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x6183[_0x10dbf6];return _0x452147;};'use strict';var _=require('lodash');var util=require(_0x3618('0x0'));var moment=require(_0x3618('0x1'));var BPromise=require(_0x3618('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3618('0x3'));var db=require(_0x3618('0x4'))['db'];var utils=require(_0x3618('0x5'));var logger=require(_0x3618('0x6'))(_0x3618('0x7'));var config=require(_0x3618('0x8'));var jayson=require(_0x3618('0x9'));var client=jayson[_0x3618('0xa')][_0x3618('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fe4b5,_0x4f910c,_0x50b4ab){return new BPromise(function(_0x42e73a,_0x1b03fc){return client[_0x3618('0xc')](_0x1fe4b5,_0x50b4ab)[_0x3618('0xd')](function(_0x2cee16){logger[_0x3618('0xe')](_0x3618('0xf'),_0x4f910c,_0x3618('0x10'));logger[_0x3618('0x11')](_0x3618('0x12'),_0x4f910c,_0x3618('0x10'),JSON[_0x3618('0x13')](_0x2cee16));if(_0x2cee16['error']){if(_0x2cee16['error'][_0x3618('0x14')]===0x1f4){logger['error'](_0x3618('0xf'),_0x4f910c,_0x2cee16[_0x3618('0x15')]['message']);return _0x1b03fc(_0x2cee16[_0x3618('0x15')][_0x3618('0x16')]);}logger[_0x3618('0x15')](_0x3618('0xf'),_0x4f910c,_0x2cee16[_0x3618('0x15')][_0x3618('0x16')]);return _0x42e73a(_0x2cee16[_0x3618('0x15')][_0x3618('0x16')]);}else{logger['info'](_0x3618('0xf'),_0x4f910c,'request\x20sent');_0x42e73a(_0x2cee16[_0x3618('0x17')][_0x3618('0x16')]);}})[_0x3618('0x18')](function(_0x57e005){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4f910c,_0x57e005);_0x1b03fc(_0x57e005);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 908c918..26a0237 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 _0x3aed=['create','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','now','single','file'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3aed,0x19a));var _0xd3ae=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x3aed[_0xf79bae];return _0x5d2cb7;};'use strict';var multer=require(_0xd3ae('0x0'));var util=require('util');var path=require(_0xd3ae('0x1'));var timeout=require(_0xd3ae('0x2'));var express=require(_0xd3ae('0x3'));var router=express['Router']();var fs_extra=require(_0xd3ae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd3ae('0x5'));var config=require(_0xd3ae('0x6'));var controller=require('./sound.controller');router[_0xd3ae('0x7')]('/',auth[_0xd3ae('0x8')](),controller[_0xd3ae('0x9')]);router[_0xd3ae('0x7')](_0xd3ae('0xa'),auth[_0xd3ae('0x8')](),controller[_0xd3ae('0xb')]);router[_0xd3ae('0x7')](_0xd3ae('0xc'),auth[_0xd3ae('0x8')](),controller[_0xd3ae('0xd')]);var upload=multer({'storage':multer[_0xd3ae('0xe')]({'destination':function(_0x3eebc5,_0x24be99,_0xde2158){_0xde2158(null,path['join'](config[_0xd3ae('0xf')],'server/files/sounds/original/'));},'filename':function(_0x2659f6,_0x2fb133,_0x1b8715){_0x2fb133[_0xd3ae('0x10')]=_0x2fb133[_0xd3ae('0x10')][_0xd3ae('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b8715(null,util[_0xd3ae('0x12')](_0xd3ae('0x13'),path[_0xd3ae('0x14')](_0x2fb133[_0xd3ae('0x10')],path[_0xd3ae('0x15')](_0x2fb133[_0xd3ae('0x10')])),Date[_0xd3ae('0x16')](),path['extname'](_0x2fb133[_0xd3ae('0x10')])));}})});router['post']('/',upload[_0xd3ae('0x17')](_0xd3ae('0x18')),controller[_0xd3ae('0x19')]);router[_0xd3ae('0x1a')](_0xd3ae('0xa'),auth[_0xd3ae('0x8')](),controller[_0xd3ae('0x1b')]);router['delete']('/:id',auth[_0xd3ae('0x8')](),controller['delete']);module[_0xd3ae('0x1c')]=router; \ No newline at end of file +var _0x92d6=['Router','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x1aa787,_0x55779){var _0x872b7d=function(_0x1a6a91){while(--_0x1a6a91){_0x1aa787['push'](_0x1aa787['shift']());}};_0x872b7d(++_0x55779);}(_0x92d6,0x75));var _0x692d=function(_0x1aaf62,_0x49f3b1){_0x1aaf62=_0x1aaf62-0x0;var _0x2e5fd2=_0x92d6[_0x1aaf62];return _0x2e5fd2;};'use strict';var multer=require(_0x692d('0x0'));var util=require('util');var path=require(_0x692d('0x1'));var timeout=require(_0x692d('0x2'));var express=require('express');var router=express[_0x692d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x692d('0x4'));var config=require('../../config/environment');var controller=require(_0x692d('0x5'));router[_0x692d('0x6')]('/',auth[_0x692d('0x7')](),controller[_0x692d('0x8')]);router['get'](_0x692d('0x9'),auth[_0x692d('0x7')](),controller[_0x692d('0xa')]);router[_0x692d('0x6')](_0x692d('0xb'),auth[_0x692d('0x7')](),controller['download']);var upload=multer({'storage':multer[_0x692d('0xc')]({'destination':function(_0x2c7a28,_0xa96542,_0x38a88b){_0x38a88b(null,path[_0x692d('0xd')](config[_0x692d('0xe')],_0x692d('0xf')));},'filename':function(_0x5dc2ee,_0x1c5a6e,_0x33455c){_0x1c5a6e[_0x692d('0x10')]=_0x1c5a6e[_0x692d('0x10')][_0x692d('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33455c(null,util[_0x692d('0x12')](_0x692d('0x13'),path[_0x692d('0x14')](_0x1c5a6e[_0x692d('0x10')],path[_0x692d('0x15')](_0x1c5a6e[_0x692d('0x10')])),Date[_0x692d('0x16')](),path[_0x692d('0x15')](_0x1c5a6e[_0x692d('0x10')])));}})});router[_0x692d('0x17')]('/',upload[_0x692d('0x18')]('file'),controller[_0x692d('0x19')]);router[_0x692d('0x1a')]('/:id',auth[_0x692d('0x7')](),controller[_0x692d('0x1b')]);router[_0x692d('0x1c')](_0x692d('0x9'),auth[_0x692d('0x7')](),controller[_0x692d('0x1c')]);module[_0x692d('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 820841b..6cdaca3 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 _0x90a1=['sequelize','exports','name','STRING','BIGINT','INTEGER','FLOAT'];(function(_0x2074c7,_0x186848){var _0x3d0326=function(_0x2e2ae6){while(--_0x2e2ae6){_0x2074c7['push'](_0x2074c7['shift']());}};_0x3d0326(++_0x186848);}(_0x90a1,0xa1));var _0x190a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x90a1[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0x190a('0x0'));module[_0x190a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x190a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x190a('0x3')]},'display_name':{'type':Sequelize[_0x190a('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x190a('0x3')]},'original_format':{'type':Sequelize[_0x190a('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x190a('0x4')]},'original_channelCount':{'type':Sequelize[_0x190a('0x5')]},'original_bitRate':{'type':Sequelize[_0x190a('0x4')]},'original_sampleRate':{'type':Sequelize[_0x190a('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x190a('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x190a('0x4')]},'converted_channelCount':{'type':Sequelize[_0x190a('0x5')]},'converted_bitRate':{'type':Sequelize[_0x190a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x190a('0x5')]}}; \ No newline at end of file +var _0x2795=['FLOAT','sequelize','exports','STRING','BIGINT','INTEGER'];(function(_0x1a4881,_0x32d37c){var _0x314f48=function(_0x2bea67){while(--_0x2bea67){_0x1a4881['push'](_0x1a4881['shift']());}};_0x314f48(++_0x32d37c);}(_0x2795,0x157));var _0x5279=function(_0xaa345,_0xa0a8a1){_0xaa345=_0xaa345-0x0;var _0x412491=_0x2795[_0xaa345];return _0x412491;};'use strict';var Sequelize=require(_0x5279('0x0'));module[_0x5279('0x1')]={'name':{'type':Sequelize[_0x5279('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x5279('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x5279('0x2')]},'original_format':{'type':Sequelize[_0x5279('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x5279('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5279('0x4')]},'converted_format':{'type':Sequelize[_0x5279('0x2')]},'converted_duration':{'type':Sequelize[_0x5279('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x5279('0x3')]},'converted_channelCount':{'type':Sequelize[_0x5279('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 73d6436..81e883e 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 _0x68bd=['0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','chmodSync','create','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','body','description','delete','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','Sound','include','findAll','rows','catch','params','length','includeAll','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x68bd,0x113));var _0xd68b=function(_0x26f4a8,_0x9bdd19){_0x26f4a8=_0x26f4a8-0x0;var _0x2c3ad6=_0x68bd[_0x26f4a8];return _0x2c3ad6;};'use strict';var emlformat=require(_0xd68b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd68b('0x1'));var jsonpatch=require(_0xd68b('0x2'));var rp=require('request-promise');var moment=require(_0xd68b('0x3'));var BPromise=require(_0xd68b('0x4'));var Mustache=require(_0xd68b('0x5'));var util=require(_0xd68b('0x6'));var path=require('path');var sox=require(_0xd68b('0x7'));var csv=require(_0xd68b('0x8'));var ejs=require(_0xd68b('0x9'));var fs=require('fs');var fs_extra=require(_0xd68b('0xa'));var _=require('lodash');var squel=require(_0xd68b('0xb'));var crypto=require(_0xd68b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd68b('0xd'));var toCsv=require(_0xd68b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd68b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd68b('0xf'));var as=require(_0xd68b('0x10'));var hardwareService=require(_0xd68b('0x11'));var logger=require(_0xd68b('0x12'))(_0xd68b('0x13'));var utils=require(_0xd68b('0x14'));var config=require(_0xd68b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd68b('0x16'))['db'];function respondWithStatusCode(_0x5d4023,_0x4f888f){_0x4f888f=_0x4f888f||0xcc;return function(_0x2ad305){if(_0x2ad305){return _0x5d4023[_0xd68b('0x17')](_0x4f888f);}return _0x5d4023[_0xd68b('0x18')](_0x4f888f)[_0xd68b('0x19')]();};}function respondWithResult(_0x2c2893,_0x540742){_0x540742=_0x540742||0xc8;return function(_0x4aa7a2){if(_0x4aa7a2){return _0x2c2893['status'](_0x540742)['json'](_0x4aa7a2);}};}function respondWithFilteredResult(_0x2baf05,_0x2049f8){return function(_0x230d1c){if(_0x230d1c){var _0x22ab99=typeof _0x2049f8['offset']===_0xd68b('0x1a')&&typeof _0x2049f8[_0xd68b('0x1b')]==='undefined';var _0x31da16=_0x230d1c[_0xd68b('0x1c')];var _0x321a98=_0x22ab99?0x0:_0x2049f8[_0xd68b('0x1d')];var _0x450ef0=_0x22ab99?_0x230d1c[_0xd68b('0x1c')]:_0x2049f8[_0xd68b('0x1d')]+_0x2049f8['limit'];var _0x5495c4;if(_0x450ef0>=_0x31da16){_0x450ef0=_0x31da16;_0x5495c4=0xc8;}else{_0x5495c4=0xce;}_0x2baf05['status'](_0x5495c4);return _0x2baf05['set'](_0xd68b('0x1e'),_0x321a98+'-'+_0x450ef0+'/'+_0x31da16)[_0xd68b('0x1f')](_0x230d1c);}return null;};}function patchUpdates(_0x394456){return function(_0x4b08b5){try{jsonpatch[_0xd68b('0x20')](_0x4b08b5,_0x394456,!![]);}catch(_0x15fb91){return BPromise[_0xd68b('0x21')](_0x15fb91);}return _0x4b08b5[_0xd68b('0x22')]();};}function saveUpdates(_0x2a8551,_0x2f941a){return function(_0x2e94ba){if(_0x2e94ba){return _0x2e94ba[_0xd68b('0x23')](_0x2a8551)['then'](function(_0x10c1fe){return _0x10c1fe;});}return null;};}function removeEntity(_0x4fe58d,_0x366d23){return function(_0x855094){if(_0x855094){return _0x855094[_0xd68b('0x24')]()[_0xd68b('0x25')](function(){var _0x57929b=_0x855094[_0xd68b('0x26')]({'plain':!![]});var _0x36ad16=_0xd68b('0x27');return db[_0xd68b('0x28')][_0xd68b('0x24')]({'where':{'type':_0x36ad16,'resourceId':_0x57929b['id']}})[_0xd68b('0x25')](function(){return _0x855094;});})['then'](function(){_0x4fe58d[_0xd68b('0x18')](0xcc)[_0xd68b('0x19')]();});}};}function handleEntityNotFound(_0x58ebe0,_0x24e264){return function(_0x594397){if(!_0x594397){_0x58ebe0[_0xd68b('0x17')](0x194);}return _0x594397;};}function handleError(_0x1eca17,_0x3e88c4){_0x3e88c4=_0x3e88c4||0x1f4;return function(_0x1a0078){logger[_0xd68b('0x29')](_0x1a0078[_0xd68b('0x2a')]);if(_0x1a0078[_0xd68b('0x2b')]){delete _0x1a0078[_0xd68b('0x2b')];}_0x1eca17['status'](_0x3e88c4)[_0xd68b('0x2c')](_0x1a0078);};}exports['index']=function(_0x3dfceb,_0x462c56){var _0x1ffafe={},_0x1aad11={},_0x5c247e={'count':0x0,'rows':[]};var _0x3e606c=_[_0xd68b('0x2d')](db['Sound'][_0xd68b('0x2e')],function(_0x47689c){return{'name':_0x47689c[_0xd68b('0x2f')],'type':_0x47689c[_0xd68b('0x30')][_0xd68b('0x31')]};});_0x1aad11['model']=_[_0xd68b('0x2d')](_0x3e606c,'name');_0x1aad11['query']=_[_0xd68b('0x32')](_0x3dfceb[_0xd68b('0x33')]);_0x1aad11[_0xd68b('0x34')]=_[_0xd68b('0x35')](_0x1aad11[_0xd68b('0x36')],_0x1aad11[_0xd68b('0x33')]);_0x1ffafe[_0xd68b('0x37')]=_['intersection'](_0x1aad11['model'],qs[_0xd68b('0x38')](_0x3dfceb[_0xd68b('0x33')][_0xd68b('0x38')]));_0x1ffafe[_0xd68b('0x37')]=_0x1ffafe['attributes']['length']?_0x1ffafe[_0xd68b('0x37')]:_0x1aad11[_0xd68b('0x36')];if(!_0x3dfceb['query'][_0xd68b('0x39')]('nolimit')){_0x1ffafe[_0xd68b('0x1b')]=qs[_0xd68b('0x1b')](_0x3dfceb[_0xd68b('0x33')][_0xd68b('0x1b')]);_0x1ffafe[_0xd68b('0x1d')]=qs[_0xd68b('0x1d')](_0x3dfceb[_0xd68b('0x33')][_0xd68b('0x1d')]);}_0x1ffafe[_0xd68b('0x3a')]=qs[_0xd68b('0x3b')](_0x3dfceb['query'][_0xd68b('0x3b')]);_0x1ffafe[_0xd68b('0x3c')]=qs[_0xd68b('0x34')](_[_0xd68b('0x3d')](_0x3dfceb['query'],_0x1aad11['filters']),_0x3e606c);if(_0x3dfceb['query'][_0xd68b('0x3e')]){_0x1ffafe[_0xd68b('0x3c')]=_['merge'](_0x1ffafe[_0xd68b('0x3c')],{'$or':_[_0xd68b('0x2d')](_0x3e606c,function(_0xa52deb){if(_0xa52deb[_0xd68b('0x30')]!==_0xd68b('0x3f')){var _0xd3c66f={};_0xd3c66f[_0xa52deb[_0xd68b('0x2b')]]={'$like':'%'+_0x3dfceb['query'][_0xd68b('0x3e')]+'%'};return _0xd3c66f;}})});}_0x1ffafe=_[_0xd68b('0x40')]({},_0x1ffafe,_0x3dfceb[_0xd68b('0x41')]);var _0xa5f4a0={'where':_0x1ffafe[_0xd68b('0x3c')]};return db[_0xd68b('0x42')][_0xd68b('0x1c')](_0xa5f4a0)[_0xd68b('0x25')](function(_0x144492){_0x5c247e[_0xd68b('0x1c')]=_0x144492;if(_0x3dfceb[_0xd68b('0x33')]['includeAll']){_0x1ffafe[_0xd68b('0x43')]=[{'all':!![]}];}return db['Sound'][_0xd68b('0x44')](_0x1ffafe);})['then'](function(_0x559ce5){_0x5c247e[_0xd68b('0x45')]=_0x559ce5;return _0x5c247e;})[_0xd68b('0x25')](respondWithFilteredResult(_0x462c56,_0x1ffafe))[_0xd68b('0x46')](handleError(_0x462c56,null));};exports['show']=function(_0x524601,_0x406f62){var _0x221361={'raw':!![],'where':{'id':_0x524601[_0xd68b('0x47')]['id']}},_0xc5fa30={};_0xc5fa30[_0xd68b('0x36')]=_['keys'](db[_0xd68b('0x42')][_0xd68b('0x2e')]);_0xc5fa30[_0xd68b('0x33')]=_['keys'](_0x524601[_0xd68b('0x33')]);_0xc5fa30[_0xd68b('0x34')]=_['intersection'](_0xc5fa30['model'],_0xc5fa30[_0xd68b('0x33')]);_0x221361[_0xd68b('0x37')]=_[_0xd68b('0x35')](_0xc5fa30[_0xd68b('0x36')],qs[_0xd68b('0x38')](_0x524601[_0xd68b('0x33')][_0xd68b('0x38')]));_0x221361[_0xd68b('0x37')]=_0x221361[_0xd68b('0x37')][_0xd68b('0x48')]?_0x221361[_0xd68b('0x37')]:_0xc5fa30[_0xd68b('0x36')];if(_0x524601[_0xd68b('0x33')][_0xd68b('0x49')]){_0x221361[_0xd68b('0x43')]=[{'all':!![]}];}_0x221361=_['merge']({},_0x221361,_0x524601[_0xd68b('0x41')]);return db['Sound'][_0xd68b('0x4a')](_0x221361)[_0xd68b('0x25')](handleEntityNotFound(_0x406f62,null))['then'](respondWithResult(_0x406f62,null))[_0xd68b('0x46')](handleError(_0x406f62,null));};exports[_0xd68b('0x4b')]=function(_0x46c7de,_0x956e30,_0x152bd6){return db[_0xd68b('0x42')][_0xd68b('0x4a')]({'where':{'id':_0x46c7de[_0xd68b('0x47')]['id']},'attributes':[_0xd68b('0x2b'),_0xd68b('0x4c'),_0xd68b('0x4d')],'raw':!![]})[_0xd68b('0x25')](handleEntityNotFound(_0x956e30,null))[_0xd68b('0x25')](function(_0x4425e1){if(_0x4425e1){if(!fs['existsSync'](path[_0xd68b('0x4e')](config[_0xd68b('0x4f')],_0xd68b('0x50'),_0x4425e1[_0xd68b('0x4c')]+'.'+_0x4425e1[_0xd68b('0x4d')]))){throw new db[(_0xd68b('0x51'))][(_0xd68b('0x52'))](_0xd68b('0x53'));}return _0x956e30['download'](path[_0xd68b('0x4e')](config[_0xd68b('0x4f')],'server/files/sounds/converted',util[_0xd68b('0x54')](_0xd68b('0x55'),_0x4425e1[_0xd68b('0x4c')],_0x4425e1[_0xd68b('0x4d')])),util[_0xd68b('0x54')](_0xd68b('0x55'),_0x4425e1['name'],_0x4425e1[_0xd68b('0x4d')]));}return null;})['catch'](handleError(_0x956e30,null));};exports['create']=function(_0x5cd418,_0x1a813f,_0x4bd887){var _0x35d940={'name':path[_0xd68b('0x56')](_0x5cd418[_0xd68b('0x57')][_0xd68b('0x58')],path[_0xd68b('0x59')](_0x5cd418[_0xd68b('0x57')][_0xd68b('0x58')])),'save_name':path[_0xd68b('0x56')](_0x5cd418['file'][_0xd68b('0x5a')],path[_0xd68b('0x59')](_0x5cd418[_0xd68b('0x57')][_0xd68b('0x5a')])),'original_format':path[_0xd68b('0x59')](_0x5cd418[_0xd68b('0x57')][_0xd68b('0x58')])[_0xd68b('0x5b')](0x1),'converted_format':_0xd68b('0x5c')};var _0x4455ad=path[_0xd68b('0x4e')](config[_0xd68b('0x4f')],_0xd68b('0x5d'),_0x5cd418[_0xd68b('0x57')][_0xd68b('0x5a')]);var _0x2666fc=path['join'](config[_0xd68b('0x4f')],_0xd68b('0x50'),util['format']('%s.%s',path[_0xd68b('0x56')](_0x5cd418[_0xd68b('0x57')][_0xd68b('0x5a')],path[_0xd68b('0x59')](_0x5cd418[_0xd68b('0x57')][_0xd68b('0x5a')])),_0x35d940['converted_format']));logger[_0xd68b('0x5e')](_0xd68b('0x5f'),_0x4455ad);logger[_0xd68b('0x5e')](_0xd68b('0x60'),_0x2666fc);try{fs['chmodSync'](_0x4455ad,parseInt(_0xd68b('0x61'),0x8));var _0x592df8=sox[_0xd68b('0x62')](_0x4455ad,_0x2666fc,{'sampleRate':0x1f40,'format':_0xd68b('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x592df8['on'](_0xd68b('0x29'),function(_0x1589e9){fs[_0xd68b('0x63')](_0x4455ad);_0x1a813f[_0xd68b('0x18')](0x1f4)[_0xd68b('0x2c')](_0x1589e9);});_0x592df8['on'](_0xd68b('0x64'),function(_0x4ff51d){_0x35d940['original_duration']=isNaN(_0x4ff51d[_0xd68b('0x65')])?null:_0x4ff51d[_0xd68b('0x65')]*0x3e8;_0x35d940[_0xd68b('0x66')]=isNaN(_0x4ff51d['sampleCount'])?null:_0x4ff51d[_0xd68b('0x67')];_0x35d940[_0xd68b('0x68')]=isNaN(_0x4ff51d[_0xd68b('0x69')])?null:_0x4ff51d[_0xd68b('0x69')];_0x35d940[_0xd68b('0x6a')]=isNaN(_0x4ff51d[_0xd68b('0x6b')])?null:_0x4ff51d[_0xd68b('0x6b')];_0x35d940['original_sampleRate']=isNaN(_0x4ff51d[_0xd68b('0x6c')])?null:_0x4ff51d[_0xd68b('0x6c')];});_0x592df8['on'](_0xd68b('0x6d'),function(_0x47d046){_0x35d940[_0xd68b('0x6e')]=isNaN(_0x47d046['duration'])?null:_0x47d046[_0xd68b('0x65')]*0x3e8;_0x35d940[_0xd68b('0x6f')]=isNaN(_0x47d046['sampleCount'])?null:_0x47d046[_0xd68b('0x67')];_0x35d940['converted_channelCount']=isNaN(_0x47d046[_0xd68b('0x69')])?null:_0x47d046[_0xd68b('0x69')];_0x35d940[_0xd68b('0x70')]=isNaN(_0x47d046['bitRate'])?null:_0x47d046['bitRate'];_0x35d940['converted_sampleRate']=isNaN(_0x47d046['sampleRate'])?null:_0x47d046['sampleRate'];});_0x592df8['on'](_0xd68b('0x19'),function(){fs[_0xd68b('0x71')](_0x2666fc,parseInt(_0xd68b('0x61'),0x8));return db['Sound'][_0xd68b('0x72')](_0x35d940)[_0xd68b('0x25')](function(_0x14cc84){var _0x33f24e={'role':_0x5cd418['body']['role'],'userProfileId':_0x5cd418['body'][_0xd68b('0x73')]};if(!_0x33f24e)throw new Error(_0xd68b('0x74'));if(_0x33f24e[_0xd68b('0x75')]===_0xd68b('0x76')){var _0x53c2eb=_0x14cc84[_0xd68b('0x26')]({'plain':!![]});return db[_0xd68b('0x77')][_0xd68b('0x4a')]({'where':{'name':_0xd68b('0x27'),'userProfileId':_0x33f24e['userProfileId']},'raw':!![]})[_0xd68b('0x25')](function(_0x185f81){if(_0x185f81&&_0x185f81[_0xd68b('0x78')]===0x0){return db[_0xd68b('0x28')]['create']({'name':_0x53c2eb[_0xd68b('0x2b')],'resourceId':_0x53c2eb['id'],'type':_0x185f81[_0xd68b('0x2b')],'sectionId':_0x185f81['id']},{})[_0xd68b('0x25')](function(){return _0x14cc84;});}else{return _0x14cc84;}})[_0xd68b('0x46')](function(_0x3560be){logger[_0xd68b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3560be);throw _0x3560be;});}return _0x14cc84;})[_0xd68b('0x25')](respondWithResult(_0x1a813f,null))['catch'](handleError(_0x1a813f,null));});_0x592df8['start']();}catch(_0x586cfc){_0x1a813f['status'](0x1f4)['send'](_0x586cfc);}};exports[_0xd68b('0x23')]=function(_0x3e4bb3,_0x527b97,_0x1c80eb){return db[_0xd68b('0x42')][_0xd68b('0x4a')]({'where':{'id':_0x3e4bb3[_0xd68b('0x47')]['id']}})[_0xd68b('0x25')](handleEntityNotFound(_0x527b97,null))[_0xd68b('0x25')](saveUpdates(_[_0xd68b('0x3d')](_0x3e4bb3[_0xd68b('0x79')],[_0xd68b('0x2b'),_0xd68b('0x7a')]),null))['then'](respondWithResult(_0x527b97,null))['catch'](handleError(_0x527b97,null));};exports[_0xd68b('0x7b')]=function(_0x501cb2,_0x2b7272,_0x277e93){return db[_0xd68b('0x42')]['find']({'where':{'id':_0x501cb2[_0xd68b('0x47')]['id']}})[_0xd68b('0x25')](function(_0x43cc1b){if(_0x43cc1b){return _0x43cc1b['destroy']();}})[_0xd68b('0x25')](function(_0xf4e9ec){var _0x11f752=path[_0xd68b('0x4e')](config[_0xd68b('0x4f')],'server/files/sounds/original',util[_0xd68b('0x54')](_0xd68b('0x55'),_0xf4e9ec['save_name'],_0xf4e9ec['original_format']));var _0x296d72=path[_0xd68b('0x4e')](config['root'],_0xd68b('0x50'),util['format']('%s.%s',_0xf4e9ec[_0xd68b('0x4c')],_0xf4e9ec[_0xd68b('0x4d')]));fs[_0xd68b('0x63')](_0x11f752);fs[_0xd68b('0x63')](_0x296d72);return _0xf4e9ec;})[_0xd68b('0x25')](function(_0x381969){if(_0x381969){return _0x2b7272[_0xd68b('0x18')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2b7272,null))[_0xd68b('0x46')](handleError(_0x2b7272,null));}; \ No newline at end of file +var _0xf252=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','name','index','Sound','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','nolimit','order','sort','filters','filter','where','map','type','merge','options','include','findAll','catch','show','length','includeAll','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','extname','originalname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','create','role','body','userProfileId','user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','params','pick','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf252,0x64));var _0x2f25=function(_0xe5b450,_0x537c91){_0xe5b450=_0xe5b450-0x0;var _0x142a1a=_0xf252[_0xe5b450];return _0x142a1a;};'use strict';var emlformat=require(_0x2f25('0x0'));var rimraf=require(_0x2f25('0x1'));var zipdir=require(_0x2f25('0x2'));var jsonpatch=require(_0x2f25('0x3'));var rp=require('request-promise');var moment=require(_0x2f25('0x4'));var BPromise=require(_0x2f25('0x5'));var Mustache=require(_0x2f25('0x6'));var util=require('util');var path=require(_0x2f25('0x7'));var sox=require('sox');var csv=require(_0x2f25('0x8'));var ejs=require(_0x2f25('0x9'));var fs=require('fs');var fs_extra=require(_0x2f25('0xa'));var _=require(_0x2f25('0xb'));var squel=require(_0x2f25('0xc'));var crypto=require(_0x2f25('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2f25('0xe'));var toCsv=require(_0x2f25('0x8'));var querystring=require(_0x2f25('0xf'));var Papa=require(_0x2f25('0x10'));var Redis=require(_0x2f25('0x11'));var authService=require(_0x2f25('0x12'));var qs=require(_0x2f25('0x13'));var as=require(_0x2f25('0x14'));var hardwareService=require(_0x2f25('0x15'));var logger=require(_0x2f25('0x16'))(_0x2f25('0x17'));var utils=require(_0x2f25('0x18'));var config=require(_0x2f25('0x19'));var licenseUtil=require(_0x2f25('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aa09d,_0x89471a){_0x89471a=_0x89471a||0xcc;return function(_0x1f2814){if(_0x1f2814){return _0x3aa09d[_0x2f25('0x1b')](_0x89471a);}return _0x3aa09d[_0x2f25('0x1c')](_0x89471a)[_0x2f25('0x1d')]();};}function respondWithResult(_0x47d6ad,_0x4023a0){_0x4023a0=_0x4023a0||0xc8;return function(_0x5604cc){if(_0x5604cc){return _0x47d6ad[_0x2f25('0x1c')](_0x4023a0)[_0x2f25('0x1e')](_0x5604cc);}};}function respondWithFilteredResult(_0x2eb08d,_0x3d1c0c){return function(_0x5e2ade){if(_0x5e2ade){var _0x3b0033=typeof _0x3d1c0c[_0x2f25('0x1f')]===_0x2f25('0x20')&&typeof _0x3d1c0c['limit']===_0x2f25('0x20');var _0x42a023=_0x5e2ade['count'];var _0xe8154d=_0x3b0033?0x0:_0x3d1c0c[_0x2f25('0x1f')];var _0x1c5b00=_0x3b0033?_0x5e2ade[_0x2f25('0x21')]:_0x3d1c0c[_0x2f25('0x1f')]+_0x3d1c0c[_0x2f25('0x22')];var _0x3bfa2f;if(_0x1c5b00>=_0x42a023){_0x1c5b00=_0x42a023;_0x3bfa2f=0xc8;}else{_0x3bfa2f=0xce;}_0x2eb08d[_0x2f25('0x1c')](_0x3bfa2f);return _0x2eb08d[_0x2f25('0x23')](_0x2f25('0x24'),_0xe8154d+'-'+_0x1c5b00+'/'+_0x42a023)[_0x2f25('0x1e')](_0x5e2ade);}return null;};}function patchUpdates(_0x407bf8){return function(_0x20ff44){try{jsonpatch[_0x2f25('0x25')](_0x20ff44,_0x407bf8,!![]);}catch(_0x116ccd){return BPromise[_0x2f25('0x26')](_0x116ccd);}return _0x20ff44[_0x2f25('0x27')]();};}function saveUpdates(_0x3f1511,_0x16124c){return function(_0x159fac){if(_0x159fac){return _0x159fac[_0x2f25('0x28')](_0x3f1511)[_0x2f25('0x29')](function(_0x18963b){return _0x18963b;});}return null;};}function removeEntity(_0x8f1abf,_0x53ba13){return function(_0xaecaff){if(_0xaecaff){return _0xaecaff[_0x2f25('0x2a')]()['then'](function(){var _0x16ade2=_0xaecaff['get']({'plain':!![]});var _0x12d90b=_0x2f25('0x2b');return db[_0x2f25('0x2c')]['destroy']({'where':{'type':_0x12d90b,'resourceId':_0x16ade2['id']}})[_0x2f25('0x29')](function(){return _0xaecaff;});})[_0x2f25('0x29')](function(){_0x8f1abf[_0x2f25('0x1c')](0xcc)[_0x2f25('0x1d')]();});}};}function handleEntityNotFound(_0x47627e,_0x18f40a){return function(_0x1bb213){if(!_0x1bb213){_0x47627e[_0x2f25('0x1b')](0x194);}return _0x1bb213;};}function handleError(_0x4e53d0,_0x1f2b77){_0x1f2b77=_0x1f2b77||0x1f4;return function(_0x2d1874){logger[_0x2f25('0x2d')](_0x2d1874['stack']);if(_0x2d1874[_0x2f25('0x2e')]){delete _0x2d1874[_0x2f25('0x2e')];}_0x4e53d0[_0x2f25('0x1c')](_0x1f2b77)['send'](_0x2d1874);};}exports[_0x2f25('0x2f')]=function(_0x53a6c6,_0x4e5f49){var _0x7286f9={},_0x45573d={},_0x265ca8={'count':0x0,'rows':[]};var _0x5e1fdc=_['map'](db[_0x2f25('0x30')][_0x2f25('0x31')],function(_0x518207){return{'name':_0x518207[_0x2f25('0x32')],'type':_0x518207['type']['key']};});_0x45573d[_0x2f25('0x33')]=_['map'](_0x5e1fdc,_0x2f25('0x2e'));_0x45573d[_0x2f25('0x34')]=_[_0x2f25('0x35')](_0x53a6c6[_0x2f25('0x34')]);_0x45573d['filters']=_[_0x2f25('0x36')](_0x45573d[_0x2f25('0x33')],_0x45573d['query']);_0x7286f9['attributes']=_['intersection'](_0x45573d['model'],qs[_0x2f25('0x37')](_0x53a6c6[_0x2f25('0x34')][_0x2f25('0x37')]));_0x7286f9[_0x2f25('0x38')]=_0x7286f9['attributes']['length']?_0x7286f9['attributes']:_0x45573d['model'];if(!_0x53a6c6[_0x2f25('0x34')]['hasOwnProperty'](_0x2f25('0x39'))){_0x7286f9[_0x2f25('0x22')]=qs[_0x2f25('0x22')](_0x53a6c6[_0x2f25('0x34')]['limit']);_0x7286f9[_0x2f25('0x1f')]=qs[_0x2f25('0x1f')](_0x53a6c6[_0x2f25('0x34')][_0x2f25('0x1f')]);}_0x7286f9[_0x2f25('0x3a')]=qs[_0x2f25('0x3b')](_0x53a6c6['query'][_0x2f25('0x3b')]);_0x7286f9['where']=qs[_0x2f25('0x3c')](_['pick'](_0x53a6c6[_0x2f25('0x34')],_0x45573d[_0x2f25('0x3c')]),_0x5e1fdc);if(_0x53a6c6[_0x2f25('0x34')][_0x2f25('0x3d')]){_0x7286f9[_0x2f25('0x3e')]=_['merge'](_0x7286f9[_0x2f25('0x3e')],{'$or':_[_0x2f25('0x3f')](_0x5e1fdc,function(_0x286584){if(_0x286584[_0x2f25('0x40')]!=='VIRTUAL'){var _0x43a63d={};_0x43a63d[_0x286584[_0x2f25('0x2e')]]={'$like':'%'+_0x53a6c6['query'][_0x2f25('0x3d')]+'%'};return _0x43a63d;}})});}_0x7286f9=_[_0x2f25('0x41')]({},_0x7286f9,_0x53a6c6[_0x2f25('0x42')]);var _0x51ebb4={'where':_0x7286f9[_0x2f25('0x3e')]};return db[_0x2f25('0x30')][_0x2f25('0x21')](_0x51ebb4)['then'](function(_0x5697e7){_0x265ca8['count']=_0x5697e7;if(_0x53a6c6[_0x2f25('0x34')]['includeAll']){_0x7286f9[_0x2f25('0x43')]=[{'all':!![]}];}return db[_0x2f25('0x30')][_0x2f25('0x44')](_0x7286f9);})[_0x2f25('0x29')](function(_0x246c24){_0x265ca8['rows']=_0x246c24;return _0x265ca8;})[_0x2f25('0x29')](respondWithFilteredResult(_0x4e5f49,_0x7286f9))[_0x2f25('0x45')](handleError(_0x4e5f49,null));};exports[_0x2f25('0x46')]=function(_0x476043,_0x32f043){var _0x15c905={'raw':!![],'where':{'id':_0x476043['params']['id']}},_0x590396={};_0x590396[_0x2f25('0x33')]=_[_0x2f25('0x35')](db[_0x2f25('0x30')][_0x2f25('0x31')]);_0x590396[_0x2f25('0x34')]=_[_0x2f25('0x35')](_0x476043['query']);_0x590396['filters']=_[_0x2f25('0x36')](_0x590396[_0x2f25('0x33')],_0x590396[_0x2f25('0x34')]);_0x15c905[_0x2f25('0x38')]=_[_0x2f25('0x36')](_0x590396['model'],qs[_0x2f25('0x37')](_0x476043[_0x2f25('0x34')][_0x2f25('0x37')]));_0x15c905[_0x2f25('0x38')]=_0x15c905[_0x2f25('0x38')][_0x2f25('0x47')]?_0x15c905[_0x2f25('0x38')]:_0x590396[_0x2f25('0x33')];if(_0x476043[_0x2f25('0x34')][_0x2f25('0x48')]){_0x15c905[_0x2f25('0x43')]=[{'all':!![]}];}_0x15c905=_[_0x2f25('0x41')]({},_0x15c905,_0x476043[_0x2f25('0x42')]);return db[_0x2f25('0x30')][_0x2f25('0x49')](_0x15c905)[_0x2f25('0x29')](handleEntityNotFound(_0x32f043,null))[_0x2f25('0x29')](respondWithResult(_0x32f043,null))[_0x2f25('0x45')](handleError(_0x32f043,null));};exports[_0x2f25('0x4a')]=function(_0x35dc41,_0x3e01f7,_0x10a5ff){return db[_0x2f25('0x30')]['find']({'where':{'id':_0x35dc41['params']['id']},'attributes':[_0x2f25('0x2e'),'save_name',_0x2f25('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3e01f7,null))[_0x2f25('0x29')](function(_0x2e5a51){if(_0x2e5a51){if(!fs[_0x2f25('0x4c')](path[_0x2f25('0x4d')](config[_0x2f25('0x4e')],_0x2f25('0x4f'),_0x2e5a51[_0x2f25('0x50')]+'.'+_0x2e5a51['converted_format']))){throw new db[(_0x2f25('0x51'))][(_0x2f25('0x52'))](_0x2f25('0x53'));}return _0x3e01f7[_0x2f25('0x4a')](path['join'](config['root'],_0x2f25('0x4f'),util[_0x2f25('0x54')](_0x2f25('0x55'),_0x2e5a51[_0x2f25('0x50')],_0x2e5a51[_0x2f25('0x4b')])),util['format'](_0x2f25('0x55'),_0x2e5a51[_0x2f25('0x2e')],_0x2e5a51[_0x2f25('0x4b')]));}return null;})['catch'](handleError(_0x3e01f7,null));};exports['create']=function(_0x92c7ba,_0x3cad26,_0x2fbbdf){var _0xe47b26={'name':path['basename'](_0x92c7ba[_0x2f25('0x56')]['originalname'],path[_0x2f25('0x57')](_0x92c7ba[_0x2f25('0x56')][_0x2f25('0x58')])),'save_name':path['basename'](_0x92c7ba[_0x2f25('0x56')][_0x2f25('0x59')],path['extname'](_0x92c7ba[_0x2f25('0x56')][_0x2f25('0x59')])),'original_format':path[_0x2f25('0x57')](_0x92c7ba[_0x2f25('0x56')]['originalname'])[_0x2f25('0x5a')](0x1),'converted_format':_0x2f25('0x5b')};var _0x374d28=path[_0x2f25('0x4d')](config[_0x2f25('0x4e')],'server/files/sounds/original',_0x92c7ba[_0x2f25('0x56')][_0x2f25('0x59')]);var _0x5ad762=path[_0x2f25('0x4d')](config[_0x2f25('0x4e')],'server/files/sounds/converted',util['format']('%s.%s',path['basename'](_0x92c7ba[_0x2f25('0x56')][_0x2f25('0x59')],path[_0x2f25('0x57')](_0x92c7ba[_0x2f25('0x56')]['filename'])),_0xe47b26[_0x2f25('0x4b')]));logger[_0x2f25('0x5c')](_0x2f25('0x5d'),_0x374d28);logger['info'](_0x2f25('0x5e'),_0x5ad762);try{fs[_0x2f25('0x5f')](_0x374d28,parseInt(_0x2f25('0x60'),0x8));var _0x10b51c=sox['transcode'](_0x374d28,_0x5ad762,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x10b51c['on'](_0x2f25('0x2d'),function(_0x1fd302){fs[_0x2f25('0x61')](_0x374d28);_0x3cad26[_0x2f25('0x1c')](0x1f4)['send'](_0x1fd302);});_0x10b51c['on']('src',function(_0x379720){_0xe47b26[_0x2f25('0x62')]=isNaN(_0x379720[_0x2f25('0x63')])?null:_0x379720[_0x2f25('0x63')]*0x3e8;_0xe47b26[_0x2f25('0x64')]=isNaN(_0x379720['sampleCount'])?null:_0x379720[_0x2f25('0x65')];_0xe47b26[_0x2f25('0x66')]=isNaN(_0x379720[_0x2f25('0x67')])?null:_0x379720[_0x2f25('0x67')];_0xe47b26[_0x2f25('0x68')]=isNaN(_0x379720[_0x2f25('0x69')])?null:_0x379720[_0x2f25('0x69')];_0xe47b26[_0x2f25('0x6a')]=isNaN(_0x379720[_0x2f25('0x6b')])?null:_0x379720[_0x2f25('0x6b')];});_0x10b51c['on'](_0x2f25('0x6c'),function(_0xf24a49){_0xe47b26[_0x2f25('0x6d')]=isNaN(_0xf24a49[_0x2f25('0x63')])?null:_0xf24a49[_0x2f25('0x63')]*0x3e8;_0xe47b26[_0x2f25('0x6e')]=isNaN(_0xf24a49[_0x2f25('0x65')])?null:_0xf24a49[_0x2f25('0x65')];_0xe47b26['converted_channelCount']=isNaN(_0xf24a49[_0x2f25('0x67')])?null:_0xf24a49[_0x2f25('0x67')];_0xe47b26[_0x2f25('0x6f')]=isNaN(_0xf24a49[_0x2f25('0x69')])?null:_0xf24a49[_0x2f25('0x69')];_0xe47b26['converted_sampleRate']=isNaN(_0xf24a49[_0x2f25('0x6b')])?null:_0xf24a49[_0x2f25('0x6b')];});_0x10b51c['on']('end',function(){fs['chmodSync'](_0x5ad762,parseInt('0777',0x8));return db['Sound'][_0x2f25('0x70')](_0xe47b26)[_0x2f25('0x29')](function(_0x279927){var _0x2e61ef={'role':_0x92c7ba['body'][_0x2f25('0x71')],'userProfileId':_0x92c7ba[_0x2f25('0x72')][_0x2f25('0x73')]};if(!_0x2e61ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e61ef['role']===_0x2f25('0x74')){var _0x377be9=_0x279927[_0x2f25('0x75')]({'plain':!![]});return db[_0x2f25('0x76')][_0x2f25('0x49')]({'where':{'name':_0x2f25('0x2b'),'userProfileId':_0x2e61ef['userProfileId']},'raw':!![]})[_0x2f25('0x29')](function(_0xc1956d){if(_0xc1956d&&_0xc1956d['autoAssociation']===0x0){return db[_0x2f25('0x2c')][_0x2f25('0x70')]({'name':_0x377be9[_0x2f25('0x2e')],'resourceId':_0x377be9['id'],'type':_0xc1956d[_0x2f25('0x2e')],'sectionId':_0xc1956d['id']},{})['then'](function(){return _0x279927;});}else{return _0x279927;}})[_0x2f25('0x45')](function(_0x36e7c6){logger[_0x2f25('0x2d')](_0x2f25('0x77'),_0x36e7c6);throw _0x36e7c6;});}return _0x279927;})[_0x2f25('0x29')](respondWithResult(_0x3cad26,null))[_0x2f25('0x45')](handleError(_0x3cad26,null));});_0x10b51c[_0x2f25('0x78')]();}catch(_0x152593){_0x3cad26[_0x2f25('0x1c')](0x1f4)[_0x2f25('0x79')](_0x152593);}};exports[_0x2f25('0x28')]=function(_0x27a671,_0x1062e7,_0xa9f7e8){return db['Sound']['find']({'where':{'id':_0x27a671[_0x2f25('0x7a')]['id']}})['then'](handleEntityNotFound(_0x1062e7,null))[_0x2f25('0x29')](saveUpdates(_[_0x2f25('0x7b')](_0x27a671[_0x2f25('0x72')],[_0x2f25('0x2e'),_0x2f25('0x7c')]),null))[_0x2f25('0x29')](respondWithResult(_0x1062e7,null))['catch'](handleError(_0x1062e7,null));};exports[_0x2f25('0x7d')]=function(_0x39ffec,_0x4a0c22,_0x11ee7d){return db['Sound'][_0x2f25('0x49')]({'where':{'id':_0x39ffec[_0x2f25('0x7a')]['id']}})[_0x2f25('0x29')](function(_0x55d5e8){if(_0x55d5e8){return _0x55d5e8[_0x2f25('0x2a')]();}})[_0x2f25('0x29')](function(_0x37735c){var _0x57acff=path[_0x2f25('0x4d')](config['root'],'server/files/sounds/original',util[_0x2f25('0x54')](_0x2f25('0x55'),_0x37735c[_0x2f25('0x50')],_0x37735c[_0x2f25('0x7e')]));var _0x3475e9=path['join'](config[_0x2f25('0x4e')],_0x2f25('0x4f'),util[_0x2f25('0x54')](_0x2f25('0x55'),_0x37735c[_0x2f25('0x50')],_0x37735c[_0x2f25('0x4b')]));fs[_0x2f25('0x61')](_0x57acff);fs[_0x2f25('0x61')](_0x3475e9);return _0x37735c;})[_0x2f25('0x29')](function(_0x5e2502){if(_0x5e2502){return _0x4a0c22[_0x2f25('0x1c')](0xcc)[_0x2f25('0x1d')]();}})[_0x2f25('0x29')](handleEntityNotFound(_0x4a0c22,null))['catch'](handleError(_0x4a0c22,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 14327fc..210d254 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 _0xb618=['tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define'];(function(_0xb7add4,_0x58482c){var _0x785238=function(_0x4ef639){while(--_0x4ef639){_0xb7add4['push'](_0xb7add4['shift']());}};_0x785238(++_0x58482c);}(_0xb618,0x6f));var _0x8b61=function(_0x1eb915,_0x4f9dc6){_0x1eb915=_0x1eb915-0x0;var _0x451d05=_0xb618[_0x1eb915];return _0x451d05;};'use strict';var _=require('lodash');var util=require(_0x8b61('0x0'));var logger=require(_0x8b61('0x1'))(_0x8b61('0x2'));var moment=require(_0x8b61('0x3'));var BPromise=require(_0x8b61('0x4'));var rp=require(_0x8b61('0x5'));var fs=require('fs');var path=require(_0x8b61('0x6'));var rimraf=require(_0x8b61('0x7'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x40c2c6,_0x56efa0){return _0x40c2c6[_0x8b61('0x8')]('Sound',attributes,{'tableName':_0x8b61('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f62=['./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x53d578,_0x4ca37f){var _0x5ce805=function(_0x237705){while(--_0x237705){_0x53d578['push'](_0x53d578['shift']());}};_0x5ce805(++_0x4ca37f);}(_0x3f62,0x64));var _0x23f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3f62[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x23f6('0x0'));var util=require(_0x23f6('0x1'));var logger=require(_0x23f6('0x2'))(_0x23f6('0x3'));var moment=require(_0x23f6('0x4'));var BPromise=require('bluebird');var rp=require(_0x23f6('0x5'));var fs=require('fs');var path=require(_0x23f6('0x6'));var rimraf=require('rimraf');var config=require(_0x23f6('0x7'));var attributes=require(_0x23f6('0x8'));module[_0x23f6('0x9')]=function(_0x2ad29a,_0x41e0c0){return _0x2ad29a[_0x23f6('0xa')](_0x23f6('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 659928f..6525132 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 _0xb2fb=['error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xb2fb,0x137));var _0xbb2f=function(_0x20500c,_0xe09892){_0x20500c=_0x20500c-0x0;var _0x27279b=_0xb2fb[_0x20500c];return _0x27279b;};'use strict';var _=require(_0xbb2f('0x0'));var util=require(_0xbb2f('0x1'));var moment=require(_0xbb2f('0x2'));var BPromise=require(_0xbb2f('0x3'));var rs=require(_0xbb2f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbb2f('0x5'));var logger=require('../../config/logger')(_0xbb2f('0x6'));var config=require(_0xbb2f('0x7'));var jayson=require(_0xbb2f('0x8'));var client=jayson[_0xbb2f('0x9')][_0xbb2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c1b55,_0x3db925,_0x200305){return new BPromise(function(_0x23d40c,_0x8e421d){return client[_0xbb2f('0xb')](_0x2c1b55,_0x200305)[_0xbb2f('0xc')](function(_0x5d1ae4){logger[_0xbb2f('0xd')](_0xbb2f('0xe'),_0x3db925,'request\x20sent');logger[_0xbb2f('0xf')](_0xbb2f('0x10'),_0x3db925,_0xbb2f('0x11'),JSON[_0xbb2f('0x12')](_0x5d1ae4));if(_0x5d1ae4[_0xbb2f('0x13')]){if(_0x5d1ae4[_0xbb2f('0x13')][_0xbb2f('0x14')]===0x1f4){logger[_0xbb2f('0x13')](_0xbb2f('0xe'),_0x3db925,_0x5d1ae4['error'][_0xbb2f('0x15')]);return _0x8e421d(_0x5d1ae4[_0xbb2f('0x13')][_0xbb2f('0x15')]);}logger[_0xbb2f('0x13')](_0xbb2f('0xe'),_0x3db925,_0x5d1ae4[_0xbb2f('0x13')][_0xbb2f('0x15')]);return _0x23d40c(_0x5d1ae4['error'][_0xbb2f('0x15')]);}else{logger[_0xbb2f('0xd')](_0xbb2f('0xe'),_0x3db925,_0xbb2f('0x11'));_0x23d40c(_0x5d1ae4[_0xbb2f('0x16')][_0xbb2f('0x15')]);}})[_0xbb2f('0x17')](function(_0x20e398){logger[_0xbb2f('0x13')](_0xbb2f('0xe'),_0x3db925,_0x20e398);_0x8e421d(_0x20e398);});});}exports[_0xbb2f('0x18')]=function(_0x43b22f){var _0x927633=this;return new Promise(function(_0x29dae8,_0x3fe118){return db[_0xbb2f('0x19')][_0xbb2f('0x1a')]({'raw':_0x43b22f[_0xbb2f('0x1b')]?_0x43b22f['options'][_0xbb2f('0x1c')]===undefined?!![]:![]:!![],'where':_0x43b22f[_0xbb2f('0x1b')]?_0x43b22f[_0xbb2f('0x1b')][_0xbb2f('0x1d')]||null:null,'attributes':_0x43b22f[_0xbb2f('0x1b')]?_0x43b22f[_0xbb2f('0x1b')][_0xbb2f('0x1e')]||null:null,'include':_0x43b22f[_0xbb2f('0x1b')]?_0x43b22f[_0xbb2f('0x1b')][_0xbb2f('0x1f')]?_[_0xbb2f('0x20')](_0x43b22f['options']['include'],function(_0x18a768){return{'model':db[_0x18a768['model']],'as':_0x18a768['as'],'attributes':_0x18a768['attributes'],'include':_0x18a768[_0xbb2f('0x1f')]?_[_0xbb2f('0x20')](_0x18a768['include'],function(_0x2b22e4){return{'model':db[_0x2b22e4['model']],'as':_0x2b22e4['as'],'attributes':_0x2b22e4[_0xbb2f('0x1e')],'include':_0x2b22e4[_0xbb2f('0x1f')]?_['map'](_0x2b22e4[_0xbb2f('0x1f')],function(_0x231016){return{'model':db[_0x231016['model']],'as':_0x231016['as'],'attributes':_0x231016[_0xbb2f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbb2f('0xc')](function(_0x21ab25){logger[_0xbb2f('0xd')](_0xbb2f('0x18'),_0x43b22f);logger[_0xbb2f('0xf')](_0xbb2f('0x18'),_0x43b22f,JSON[_0xbb2f('0x12')](_0x21ab25));_0x29dae8(_0x21ab25);})[_0xbb2f('0x17')](function(_0x1263f5){logger['error']('ShowSound',_0x1263f5[_0xbb2f('0x15')],_0x43b22f);_0x3fe118(_0x927633[_0xbb2f('0x13')](0x1f4,_0x1263f5[_0xbb2f('0x15')]));});});}; \ No newline at end of file +var _0x9727=['http','request','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Sound,\x20%s,\x20%s','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9727,0x6c));var _0x7972=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9727[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x7972('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7972('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7972('0x2'));var db=require(_0x7972('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7972('0x4'))(_0x7972('0x5'));var config=require(_0x7972('0x6'));var jayson=require(_0x7972('0x7'));var client=jayson['client'][_0x7972('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57a83c,_0x3a02ef,_0x275701){return new BPromise(function(_0xebe330,_0xc0e366){return client[_0x7972('0x9')](_0x57a83c,_0x275701)['then'](function(_0x171763){logger[_0x7972('0xa')]('Sound,\x20%s,\x20%s',_0x3a02ef,'request\x20sent');logger[_0x7972('0xb')](_0x7972('0xc'),_0x3a02ef,_0x7972('0xd'),JSON['stringify'](_0x171763));if(_0x171763[_0x7972('0xe')]){if(_0x171763[_0x7972('0xe')]['code']===0x1f4){logger[_0x7972('0xe')]('Sound,\x20%s,\x20%s',_0x3a02ef,_0x171763[_0x7972('0xe')][_0x7972('0xf')]);return _0xc0e366(_0x171763['error'][_0x7972('0xf')]);}logger[_0x7972('0xe')](_0x7972('0x10'),_0x3a02ef,_0x171763['error'][_0x7972('0xf')]);return _0xebe330(_0x171763[_0x7972('0xe')][_0x7972('0xf')]);}else{logger[_0x7972('0xa')]('Sound,\x20%s,\x20%s',_0x3a02ef,'request\x20sent');_0xebe330(_0x171763[_0x7972('0x11')][_0x7972('0xf')]);}})[_0x7972('0x12')](function(_0x44aaf3){logger[_0x7972('0xe')](_0x7972('0x10'),_0x3a02ef,_0x44aaf3);_0xc0e366(_0x44aaf3);});});}exports[_0x7972('0x13')]=function(_0x98d16f){var _0x2a3388=this;return new Promise(function(_0x2f50ca,_0x2410c1){return db[_0x7972('0x14')][_0x7972('0x15')]({'raw':_0x98d16f[_0x7972('0x16')]?_0x98d16f[_0x7972('0x16')][_0x7972('0x17')]===undefined?!![]:![]:!![],'where':_0x98d16f[_0x7972('0x16')]?_0x98d16f[_0x7972('0x16')][_0x7972('0x18')]||null:null,'attributes':_0x98d16f[_0x7972('0x16')]?_0x98d16f[_0x7972('0x16')][_0x7972('0x19')]||null:null,'include':_0x98d16f[_0x7972('0x16')]?_0x98d16f[_0x7972('0x16')][_0x7972('0x1a')]?_['map'](_0x98d16f['options']['include'],function(_0x128dc5){return{'model':db[_0x128dc5[_0x7972('0x1b')]],'as':_0x128dc5['as'],'attributes':_0x128dc5[_0x7972('0x19')],'include':_0x128dc5['include']?_[_0x7972('0x1c')](_0x128dc5['include'],function(_0x69965){return{'model':db[_0x69965[_0x7972('0x1b')]],'as':_0x69965['as'],'attributes':_0x69965[_0x7972('0x19')],'include':_0x69965['include']?_[_0x7972('0x1c')](_0x69965[_0x7972('0x1a')],function(_0x57d7e0){return{'model':db[_0x57d7e0[_0x7972('0x1b')]],'as':_0x57d7e0['as'],'attributes':_0x57d7e0[_0x7972('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50902e){logger[_0x7972('0xa')](_0x7972('0x13'),_0x98d16f);logger[_0x7972('0xb')](_0x7972('0x13'),_0x98d16f,JSON['stringify'](_0x50902e));_0x2f50ca(_0x50902e);})[_0x7972('0x12')](function(_0x317e02){logger[_0x7972('0xe')](_0x7972('0x13'),_0x317e02[_0x7972('0xf')],_0x98d16f);_0x2410c1(_0x2a3388[_0x7972('0xe')](0x1f4,_0x317e02[_0x7972('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b3f7c01..649b2a1 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x4a4219,_0x55d299){var _0x1bb2a7=function(_0x48202c){while(--_0x48202c){_0x4a4219['push'](_0x4a4219['shift']());}};_0x1bb2a7(++_0x55d299);}(_0x14a0,0x8e));var _0x014a=function(_0x1c557a,_0x554e3b){_0x1c557a=_0x1c557a-0x0;var _0x30fc54=_0x14a0[_0x1c557a];return _0x30fc54;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x60d16b,_0x572343){var _0x53eea3=function(_0x22ed4c){while(--_0x22ed4c){_0x60d16b['push'](_0x60d16b['shift']());}};_0x53eea3(++_0x572343);}(_0x14a0,0x8e));var _0x014a=function(_0x24e064,_0x240373){_0x24e064=_0x24e064-0x0;var _0x34abec=_0x14a0[_0x24e064];return _0x34abec;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index aebbb74..5e91af4 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 _0x295f=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x213abd,_0x437f9d){var _0x4ae277=function(_0x4f0de6){while(--_0x4f0de6){_0x213abd['push'](_0x213abd['shift']());}};_0x4ae277(++_0x437f9d);}(_0x295f,0x19e));var _0xf295=function(_0x1e9468,_0xc18ad){_0x1e9468=_0x1e9468-0x0;var _0x5dc741=_0x295f[_0x1e9468];return _0x5dc741;};'use strict';var Sequelize=require(_0xf295('0x0'));module[_0xf295('0x1')]={'uniqueid':{'type':Sequelize[_0xf295('0x2')]},'body':{'type':Sequelize[_0xf295('0x3')](_0xf295('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xf295('0x5')]('in',_0xf295('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xf295('0x2')]},'providerResponse':{'type':Sequelize[_0xf295('0x3')]}}; \ No newline at end of file +var _0xbed2=['ENUM','out','STRING','exports','TEXT','medium'];(function(_0x9305f7,_0x25ec0b){var _0x2ced20=function(_0x174f7f){while(--_0x174f7f){_0x9305f7['push'](_0x9305f7['shift']());}};_0x2ced20(++_0x25ec0b);}(_0xbed2,0x1bf));var _0x2bed=function(_0x27906a,_0x3d58c8){_0x27906a=_0x27906a-0x0;var _0x3c956b=_0xbed2[_0x27906a];return _0x3c956b;};'use strict';var Sequelize=require('sequelize');module[_0x2bed('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x2bed('0x1')](_0x2bed('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x2bed('0x3')]('in',_0x2bed('0x4')),'defaultValue':_0x2bed('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x2bed('0x5')]},'providerResponse':{'type':Sequelize[_0x2bed('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5d9c23d..0fcdc87 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 _0xe0dc=['apply','update','then','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','model','query','keys','intersection','attributes','nolimit','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x560c7a,_0x17451a){var _0x394dd5=function(_0x3a512b){while(--_0x3a512b){_0x560c7a['push'](_0x560c7a['shift']());}};_0x394dd5(++_0x17451a);}(_0xe0dc,0x190));var _0xce0d=function(_0x154b4c,_0xa38e2){_0x154b4c=_0x154b4c-0x0;var _0x100586=_0xe0dc[_0x154b4c];return _0x100586;};'use strict';var emlformat=require(_0xce0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce0d('0x1'));var jsonpatch=require(_0xce0d('0x2'));var rp=require('request-promise');var moment=require(_0xce0d('0x3'));var BPromise=require(_0xce0d('0x4'));var Mustache=require(_0xce0d('0x5'));var util=require(_0xce0d('0x6'));var path=require('path');var sox=require(_0xce0d('0x7'));var csv=require('to-csv');var ejs=require(_0xce0d('0x8'));var fs=require('fs');var fs_extra=require(_0xce0d('0x9'));var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0xf'));var querystring=require(_0xce0d('0x10'));var Papa=require(_0xce0d('0x11'));var Redis=require(_0xce0d('0x12'));var authService=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var as=require(_0xce0d('0x15'));var hardwareService=require(_0xce0d('0x16'));var logger=require(_0xce0d('0x17'))(_0xce0d('0x18'));var utils=require(_0xce0d('0x19'));var config=require(_0xce0d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0d('0x1b'))['db'];function respondWithStatusCode(_0x419b8a,_0x2a802c){_0x2a802c=_0x2a802c||0xcc;return function(_0x29a87c){if(_0x29a87c){return _0x419b8a[_0xce0d('0x1c')](_0x2a802c);}return _0x419b8a[_0xce0d('0x1d')](_0x2a802c)[_0xce0d('0x1e')]();};}function respondWithResult(_0x178400,_0x18a96e){_0x18a96e=_0x18a96e||0xc8;return function(_0xfba354){if(_0xfba354){return _0x178400[_0xce0d('0x1d')](_0x18a96e)[_0xce0d('0x1f')](_0xfba354);}};}function respondWithFilteredResult(_0x2a2f69,_0x3bedc2){return function(_0xef9e5f){if(_0xef9e5f){var _0x176c81=typeof _0x3bedc2[_0xce0d('0x20')]===_0xce0d('0x21')&&typeof _0x3bedc2[_0xce0d('0x22')]===_0xce0d('0x21');var _0x2044df=_0xef9e5f[_0xce0d('0x23')];var _0x1dc8aa=_0x176c81?0x0:_0x3bedc2[_0xce0d('0x20')];var _0x3378f2=_0x176c81?_0xef9e5f[_0xce0d('0x23')]:_0x3bedc2[_0xce0d('0x20')]+_0x3bedc2[_0xce0d('0x22')];var _0x37aae8;if(_0x3378f2>=_0x2044df){_0x3378f2=_0x2044df;_0x37aae8=0xc8;}else{_0x37aae8=0xce;}_0x2a2f69[_0xce0d('0x1d')](_0x37aae8);return _0x2a2f69[_0xce0d('0x24')](_0xce0d('0x25'),_0x1dc8aa+'-'+_0x3378f2+'/'+_0x2044df)[_0xce0d('0x1f')](_0xef9e5f);}return null;};}function patchUpdates(_0x1fb46d){return function(_0x8388e3){try{jsonpatch[_0xce0d('0x26')](_0x8388e3,_0x1fb46d,!![]);}catch(_0x16788f){return BPromise['reject'](_0x16788f);}return _0x8388e3['save']();};}function saveUpdates(_0xa0277a,_0x4da3f6){return function(_0x2727c2){if(_0x2727c2){return _0x2727c2[_0xce0d('0x27')](_0xa0277a)[_0xce0d('0x28')](function(_0x58d7c5){return _0x58d7c5;});}return null;};}function removeEntity(_0x1ff817,_0x542d3d){return function(_0x298f3e){if(_0x298f3e){return _0x298f3e['destroy']()[_0xce0d('0x28')](function(){_0x1ff817[_0xce0d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516609,_0x31300f){return function(_0x201167){if(!_0x201167){_0x516609[_0xce0d('0x1c')](0x194);}return _0x201167;};}function handleError(_0x41b228,_0xdab05c){_0xdab05c=_0xdab05c||0x1f4;return function(_0x4cbaf4){logger[_0xce0d('0x29')](_0x4cbaf4[_0xce0d('0x2a')]);if(_0x4cbaf4[_0xce0d('0x2b')]){delete _0x4cbaf4['name'];}_0x41b228[_0xce0d('0x1d')](_0xdab05c)['send'](_0x4cbaf4);};}exports[_0xce0d('0x2c')]=function(_0x1eb234,_0x328842){var _0x435fd2={},_0x1a7f8c={},_0x3c4ec8={'count':0x0,'rows':[]};var _0x2c9c1b=_[_0xce0d('0x2d')](db[_0xce0d('0x2e')][_0xce0d('0x2f')],function(_0x4171cb){return{'name':_0x4171cb[_0xce0d('0x30')],'type':_0x4171cb['type']['key']};});_0x1a7f8c[_0xce0d('0x31')]=_[_0xce0d('0x2d')](_0x2c9c1b,_0xce0d('0x2b'));_0x1a7f8c[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x1eb234['query']);_0x1a7f8c['filters']=_[_0xce0d('0x34')](_0x1a7f8c[_0xce0d('0x31')],_0x1a7f8c['query']);_0x435fd2['attributes']=_['intersection'](_0x1a7f8c[_0xce0d('0x31')],qs['fields'](_0x1eb234['query']['fields']));_0x435fd2[_0xce0d('0x35')]=_0x435fd2['attributes']['length']?_0x435fd2['attributes']:_0x1a7f8c['model'];if(!_0x1eb234['query']['hasOwnProperty'](_0xce0d('0x36'))){_0x435fd2[_0xce0d('0x22')]=qs[_0xce0d('0x22')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x22')]);_0x435fd2[_0xce0d('0x20')]=qs[_0xce0d('0x20')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x20')]);}_0x435fd2['order']=qs[_0xce0d('0x37')](_0x1eb234[_0xce0d('0x32')]['sort']);_0x435fd2[_0xce0d('0x38')]=qs[_0xce0d('0x39')](_['pick'](_0x1eb234['query'],_0x1a7f8c[_0xce0d('0x39')]),_0x2c9c1b);if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x435fd2[_0xce0d('0x38')]=_[_0xce0d('0x3b')](_0x435fd2['where'],{'$or':_['map'](_0x2c9c1b,function(_0x27d599){if(_0x27d599[_0xce0d('0x3c')]!=='VIRTUAL'){var _0x4d4297={};_0x4d4297[_0x27d599[_0xce0d('0x2b')]]={'$like':'%'+_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]+'%'};return _0x4d4297;}})});}_0x435fd2=_[_0xce0d('0x3b')]({},_0x435fd2,_0x1eb234[_0xce0d('0x3d')]);var _0x1cfa6c={'where':_0x435fd2['where']};return db[_0xce0d('0x2e')][_0xce0d('0x23')](_0x1cfa6c)[_0xce0d('0x28')](function(_0x18a56f){_0x3c4ec8[_0xce0d('0x23')]=_0x18a56f;if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x435fd2[_0xce0d('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0xce0d('0x40')](_0x435fd2);})['then'](function(_0x6352f9){_0x3c4ec8[_0xce0d('0x41')]=_0x6352f9;return _0x3c4ec8;})[_0xce0d('0x28')](respondWithFilteredResult(_0x328842,_0x435fd2))[_0xce0d('0x42')](handleError(_0x328842,null));};exports[_0xce0d('0x43')]=function(_0x4abd42,_0x118d68){var _0x1d19ed={'raw':!![],'where':{'id':_0x4abd42[_0xce0d('0x44')]['id']}},_0x5457d8={};_0x5457d8['model']=_[_0xce0d('0x33')](db[_0xce0d('0x2e')][_0xce0d('0x2f')]);_0x5457d8['query']=_[_0xce0d('0x33')](_0x4abd42[_0xce0d('0x32')]);_0x5457d8['filters']=_['intersection'](_0x5457d8[_0xce0d('0x31')],_0x5457d8[_0xce0d('0x32')]);_0x1d19ed[_0xce0d('0x35')]=_[_0xce0d('0x34')](_0x5457d8[_0xce0d('0x31')],qs['fields'](_0x4abd42['query']['fields']));_0x1d19ed[_0xce0d('0x35')]=_0x1d19ed[_0xce0d('0x35')][_0xce0d('0x45')]?_0x1d19ed[_0xce0d('0x35')]:_0x5457d8[_0xce0d('0x31')];if(_0x4abd42[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x1d19ed['include']=[{'all':!![]}];}_0x1d19ed=_['merge']({},_0x1d19ed,_0x4abd42[_0xce0d('0x3d')]);return db[_0xce0d('0x2e')][_0xce0d('0x46')](_0x1d19ed)[_0xce0d('0x28')](handleEntityNotFound(_0x118d68,null))[_0xce0d('0x28')](respondWithResult(_0x118d68,null))[_0xce0d('0x42')](handleError(_0x118d68,null));};exports[_0xce0d('0x47')]=function(_0x47daa0,_0x362827){return db['SquareMessage']['create'](_0x47daa0[_0xce0d('0x48')],{})[_0xce0d('0x28')](respondWithResult(_0x362827,0xc9))[_0xce0d('0x42')](handleError(_0x362827,null));};exports['update']=function(_0x641547,_0x36f502){if(_0x641547['body']['id']){delete _0x641547[_0xce0d('0x48')]['id'];}return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x641547[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x36f502,null))[_0xce0d('0x28')](saveUpdates(_0x641547[_0xce0d('0x48')],null))[_0xce0d('0x28')](respondWithResult(_0x36f502,null))[_0xce0d('0x42')](handleError(_0x36f502,null));};exports['destroy']=function(_0x327487,_0x4438e3){return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x327487['params']['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x4438e3,null))[_0xce0d('0x28')](removeEntity(_0x4438e3,null))['catch'](handleError(_0x4438e3,null));}; \ No newline at end of file +var _0x1472=['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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareMessage','then','includeAll','findAll','rows','params','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x3e8a2f,_0x3f5d01){var _0x4fd0c5=function(_0x1408bf){while(--_0x1408bf){_0x3e8a2f['push'](_0x3e8a2f['shift']());}};_0x4fd0c5(++_0x3f5d01);}(_0x1472,0x1e1));var _0x2147=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0x1472[_0x12fcbd];return _0x28ec2a;};'use strict';var emlformat=require(_0x2147('0x0'));var rimraf=require(_0x2147('0x1'));var zipdir=require(_0x2147('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var Mustache=require(_0x2147('0x6'));var util=require(_0x2147('0x7'));var path=require(_0x2147('0x8'));var sox=require(_0x2147('0x9'));var csv=require(_0x2147('0xa'));var ejs=require(_0x2147('0xb'));var fs=require('fs');var fs_extra=require(_0x2147('0xc'));var _=require(_0x2147('0xd'));var squel=require(_0x2147('0xe'));var crypto=require(_0x2147('0xf'));var jsforce=require(_0x2147('0x10'));var deskjs=require(_0x2147('0x11'));var toCsv=require(_0x2147('0xa'));var querystring=require(_0x2147('0x12'));var Papa=require(_0x2147('0x13'));var Redis=require(_0x2147('0x14'));var authService=require(_0x2147('0x15'));var qs=require(_0x2147('0x16'));var as=require(_0x2147('0x17'));var hardwareService=require(_0x2147('0x18'));var logger=require(_0x2147('0x19'))('api');var utils=require(_0x2147('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x2147('0x1b'));var db=require(_0x2147('0x1c'))['db'];function respondWithStatusCode(_0x543061,_0x5d02df){_0x5d02df=_0x5d02df||0xcc;return function(_0xf75584){if(_0xf75584){return _0x543061[_0x2147('0x1d')](_0x5d02df);}return _0x543061[_0x2147('0x1e')](_0x5d02df)[_0x2147('0x1f')]();};}function respondWithResult(_0x3f31cb,_0x384ffd){_0x384ffd=_0x384ffd||0xc8;return function(_0x94f7f1){if(_0x94f7f1){return _0x3f31cb['status'](_0x384ffd)[_0x2147('0x20')](_0x94f7f1);}};}function respondWithFilteredResult(_0x4542,_0x8e4c5){return function(_0x5292c1){if(_0x5292c1){var _0x2f2947=typeof _0x8e4c5[_0x2147('0x21')]==='undefined'&&typeof _0x8e4c5[_0x2147('0x22')]===_0x2147('0x23');var _0x5add8b=_0x5292c1[_0x2147('0x24')];var _0x1672e2=_0x2f2947?0x0:_0x8e4c5['offset'];var _0x2f0ba6=_0x2f2947?_0x5292c1['count']:_0x8e4c5[_0x2147('0x21')]+_0x8e4c5[_0x2147('0x22')];var _0x83a469;if(_0x2f0ba6>=_0x5add8b){_0x2f0ba6=_0x5add8b;_0x83a469=0xc8;}else{_0x83a469=0xce;}_0x4542[_0x2147('0x1e')](_0x83a469);return _0x4542[_0x2147('0x25')](_0x2147('0x26'),_0x1672e2+'-'+_0x2f0ba6+'/'+_0x5add8b)[_0x2147('0x20')](_0x5292c1);}return null;};}function patchUpdates(_0x32e6a0){return function(_0x3a2b56){try{jsonpatch[_0x2147('0x27')](_0x3a2b56,_0x32e6a0,!![]);}catch(_0x13bc5a){return BPromise['reject'](_0x13bc5a);}return _0x3a2b56[_0x2147('0x28')]();};}function saveUpdates(_0x27688b,_0x548f43){return function(_0x3fcfe3){if(_0x3fcfe3){return _0x3fcfe3['update'](_0x27688b)['then'](function(_0x36783f){return _0x36783f;});}return null;};}function removeEntity(_0x57a0e9,_0x1a3a14){return function(_0x2bf4f7){if(_0x2bf4f7){return _0x2bf4f7[_0x2147('0x29')]()['then'](function(){_0x57a0e9[_0x2147('0x1e')](0xcc)[_0x2147('0x1f')]();});}};}function handleEntityNotFound(_0x3db051,_0x3527e0){return function(_0x287cc2){if(!_0x287cc2){_0x3db051[_0x2147('0x1d')](0x194);}return _0x287cc2;};}function handleError(_0xacd1de,_0x3b9cab){_0x3b9cab=_0x3b9cab||0x1f4;return function(_0x44de2e){logger[_0x2147('0x2a')](_0x44de2e[_0x2147('0x2b')]);if(_0x44de2e[_0x2147('0x2c')]){delete _0x44de2e['name'];}_0xacd1de[_0x2147('0x1e')](_0x3b9cab)[_0x2147('0x2d')](_0x44de2e);};}exports[_0x2147('0x2e')]=function(_0x485736,_0x43ae2a){var _0x86705c={},_0x536d0c={},_0x552d21={'count':0x0,'rows':[]};var _0x4f9655=_[_0x2147('0x2f')](db['SquareMessage'][_0x2147('0x30')],function(_0x5d9fe8){return{'name':_0x5d9fe8[_0x2147('0x31')],'type':_0x5d9fe8[_0x2147('0x32')][_0x2147('0x33')]};});_0x536d0c[_0x2147('0x34')]=_[_0x2147('0x2f')](_0x4f9655,'name');_0x536d0c[_0x2147('0x35')]=_[_0x2147('0x36')](_0x485736['query']);_0x536d0c[_0x2147('0x37')]=_[_0x2147('0x38')](_0x536d0c['model'],_0x536d0c[_0x2147('0x35')]);_0x86705c[_0x2147('0x39')]=_[_0x2147('0x38')](_0x536d0c[_0x2147('0x34')],qs[_0x2147('0x3a')](_0x485736[_0x2147('0x35')][_0x2147('0x3a')]));_0x86705c[_0x2147('0x39')]=_0x86705c[_0x2147('0x39')][_0x2147('0x3b')]?_0x86705c[_0x2147('0x39')]:_0x536d0c['model'];if(!_0x485736[_0x2147('0x35')][_0x2147('0x3c')](_0x2147('0x3d'))){_0x86705c[_0x2147('0x22')]=qs[_0x2147('0x22')](_0x485736[_0x2147('0x35')][_0x2147('0x22')]);_0x86705c['offset']=qs['offset'](_0x485736['query'][_0x2147('0x21')]);}_0x86705c[_0x2147('0x3e')]=qs[_0x2147('0x3f')](_0x485736[_0x2147('0x35')][_0x2147('0x3f')]);_0x86705c[_0x2147('0x40')]=qs['filters'](_[_0x2147('0x41')](_0x485736[_0x2147('0x35')],_0x536d0c['filters']),_0x4f9655);if(_0x485736[_0x2147('0x35')][_0x2147('0x42')]){_0x86705c['where']=_[_0x2147('0x43')](_0x86705c['where'],{'$or':_[_0x2147('0x2f')](_0x4f9655,function(_0x38a731){if(_0x38a731[_0x2147('0x32')]!==_0x2147('0x44')){var _0x43ff82={};_0x43ff82[_0x38a731['name']]={'$like':'%'+_0x485736[_0x2147('0x35')]['filter']+'%'};return _0x43ff82;}})});}_0x86705c=_[_0x2147('0x43')]({},_0x86705c,_0x485736['options']);var _0x9c0d85={'where':_0x86705c['where']};return db[_0x2147('0x45')][_0x2147('0x24')](_0x9c0d85)[_0x2147('0x46')](function(_0x547158){_0x552d21[_0x2147('0x24')]=_0x547158;if(_0x485736[_0x2147('0x35')][_0x2147('0x47')]){_0x86705c['include']=[{'all':!![]}];}return db[_0x2147('0x45')][_0x2147('0x48')](_0x86705c);})[_0x2147('0x46')](function(_0x14c47f){_0x552d21[_0x2147('0x49')]=_0x14c47f;return _0x552d21;})[_0x2147('0x46')](respondWithFilteredResult(_0x43ae2a,_0x86705c))['catch'](handleError(_0x43ae2a,null));};exports['show']=function(_0x1b88e3,_0x10c517){var _0x902db7={'raw':!![],'where':{'id':_0x1b88e3[_0x2147('0x4a')]['id']}},_0x2b47f0={};_0x2b47f0[_0x2147('0x34')]=_[_0x2147('0x36')](db[_0x2147('0x45')][_0x2147('0x30')]);_0x2b47f0[_0x2147('0x35')]=_[_0x2147('0x36')](_0x1b88e3[_0x2147('0x35')]);_0x2b47f0[_0x2147('0x37')]=_['intersection'](_0x2b47f0[_0x2147('0x34')],_0x2b47f0['query']);_0x902db7[_0x2147('0x39')]=_[_0x2147('0x38')](_0x2b47f0[_0x2147('0x34')],qs['fields'](_0x1b88e3[_0x2147('0x35')][_0x2147('0x3a')]));_0x902db7['attributes']=_0x902db7[_0x2147('0x39')]['length']?_0x902db7[_0x2147('0x39')]:_0x2b47f0[_0x2147('0x34')];if(_0x1b88e3[_0x2147('0x35')]['includeAll']){_0x902db7[_0x2147('0x4b')]=[{'all':!![]}];}_0x902db7=_['merge']({},_0x902db7,_0x1b88e3[_0x2147('0x4c')]);return db[_0x2147('0x45')][_0x2147('0x4d')](_0x902db7)[_0x2147('0x46')](handleEntityNotFound(_0x10c517,null))[_0x2147('0x46')](respondWithResult(_0x10c517,null))[_0x2147('0x4e')](handleError(_0x10c517,null));};exports[_0x2147('0x4f')]=function(_0x123830,_0x1a5f82){return db[_0x2147('0x45')][_0x2147('0x4f')](_0x123830[_0x2147('0x50')],{})[_0x2147('0x46')](respondWithResult(_0x1a5f82,0xc9))[_0x2147('0x4e')](handleError(_0x1a5f82,null));};exports['update']=function(_0x3d366d,_0xd42dba){if(_0x3d366d[_0x2147('0x50')]['id']){delete _0x3d366d[_0x2147('0x50')]['id'];}return db[_0x2147('0x45')][_0x2147('0x4d')]({'where':{'id':_0x3d366d[_0x2147('0x4a')]['id']}})[_0x2147('0x46')](handleEntityNotFound(_0xd42dba,null))[_0x2147('0x46')](saveUpdates(_0x3d366d[_0x2147('0x50')],null))[_0x2147('0x46')](respondWithResult(_0xd42dba,null))[_0x2147('0x4e')](handleError(_0xd42dba,null));};exports['destroy']=function(_0x15d624,_0x146097){return db['SquareMessage']['find']({'where':{'id':_0x15d624[_0x2147('0x4a')]['id']}})[_0x2147('0x46')](handleEntityNotFound(_0x146097,null))[_0x2147('0x46')](removeEntity(_0x146097,null))[_0x2147('0x4e')](handleError(_0x146097,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 60536fd..25d8a24 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 _0xcc0d=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xcc0d,0x6a));var _0xdcc0=function(_0x50a676,_0x889c36){_0x50a676=_0x50a676-0x0;var _0x1965a9=_0xcc0d[_0x50a676];return _0x1965a9;};'use strict';var _=require(_0xdcc0('0x0'));var util=require(_0xdcc0('0x1'));var logger=require(_0xdcc0('0x2'))('api');var moment=require(_0xdcc0('0x3'));var BPromise=require(_0xdcc0('0x4'));var rp=require(_0xdcc0('0x5'));var fs=require('fs');var path=require(_0xdcc0('0x6'));var rimraf=require('rimraf');var config=require(_0xdcc0('0x7'));var attributes=require(_0xdcc0('0x8'));module[_0xdcc0('0x9')]=function(_0x5a57f0,_0x4b1271){return _0x5a57f0['define'](_0xdcc0('0xa'),attributes,{'tableName':_0xdcc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x829b=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x829b,0x104));var _0xb829=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x829b[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0xb829('0x0'));var util=require('util');var logger=require(_0xb829('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb829('0x2'));var rp=require(_0xb829('0x3'));var fs=require('fs');var path=require(_0xb829('0x4'));var rimraf=require(_0xb829('0x5'));var config=require(_0xb829('0x6'));var attributes=require(_0xb829('0x7'));module[_0xb829('0x8')]=function(_0x1d767b,_0x1db0ae){return _0x1d767b[_0xb829('0x9')]('SquareMessage',attributes,{'tableName':_0xb829('0xa'),'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 ec0eed0..c5027bb 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 _0x25c6=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x25c6,0x118));var _0x625c=function(_0x47b63a,_0x3a3c6f){_0x47b63a=_0x47b63a-0x0;var _0x19e9ce=_0x25c6[_0x47b63a];return _0x19e9ce;};'use strict';var _=require('lodash');var util=require(_0x625c('0x0'));var moment=require(_0x625c('0x1'));var BPromise=require(_0x625c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x625c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x625c('0x4'));var logger=require(_0x625c('0x5'))(_0x625c('0x6'));var config=require(_0x625c('0x7'));var jayson=require(_0x625c('0x8'));var client=jayson[_0x625c('0x9')][_0x625c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30ba85,_0x31d4e6,_0x333e13){return new BPromise(function(_0x90f23e,_0x1cacfc){return client[_0x625c('0xb')](_0x30ba85,_0x333e13)[_0x625c('0xc')](function(_0x17137f){logger[_0x625c('0xd')]('SquareMessage,\x20%s,\x20%s',_0x31d4e6,_0x625c('0xe'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x31d4e6,_0x625c('0xe'),JSON[_0x625c('0xf')](_0x17137f));if(_0x17137f[_0x625c('0x10')]){if(_0x17137f[_0x625c('0x10')]['code']===0x1f4){logger[_0x625c('0x10')](_0x625c('0x11'),_0x31d4e6,_0x17137f['error'][_0x625c('0x12')]);return _0x1cacfc(_0x17137f[_0x625c('0x10')][_0x625c('0x12')]);}logger[_0x625c('0x10')](_0x625c('0x11'),_0x31d4e6,_0x17137f[_0x625c('0x10')][_0x625c('0x12')]);return _0x90f23e(_0x17137f[_0x625c('0x10')]['message']);}else{logger[_0x625c('0xd')](_0x625c('0x11'),_0x31d4e6,_0x625c('0xe'));_0x90f23e(_0x17137f[_0x625c('0x13')][_0x625c('0x12')]);}})[_0x625c('0x14')](function(_0x257f4b){logger[_0x625c('0x10')](_0x625c('0x11'),_0x31d4e6,_0x257f4b);_0x1cacfc(_0x257f4b);});});}exports[_0x625c('0x15')]=function(_0x3c067b){var _0x42d556=this;return new Promise(function(_0x158f64,_0x9875f6){return db[_0x625c('0x16')][_0x625c('0x17')](_0x3c067b[_0x625c('0x18')],{'raw':_0x3c067b[_0x625c('0x19')]?_0x3c067b[_0x625c('0x19')][_0x625c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x47c51e){logger[_0x625c('0xd')](_0x625c('0x15'),_0x3c067b);logger[_0x625c('0x1b')](_0x625c('0x15'),_0x3c067b,JSON[_0x625c('0xf')](_0x47c51e));_0x158f64(_0x47c51e);})[_0x625c('0x14')](function(_0x5a73e7){logger[_0x625c('0x10')](_0x625c('0x15'),_0x5a73e7[_0x625c('0x12')],_0x3c067b);_0x9875f6(_0x42d556[_0x625c('0x10')](0x1f4,_0x5a73e7[_0x625c('0x12')]));});});}; \ No newline at end of file +var _0xd1e4=['result','catch','create','body','options','raw','CreateSquareMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message'];(function(_0x49a6e0,_0x2cfd05){var _0xed28f1=function(_0x405a4f){while(--_0x405a4f){_0x49a6e0['push'](_0x49a6e0['shift']());}};_0xed28f1(++_0x2cfd05);}(_0xd1e4,0x13b));var _0x4d1e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd1e4[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x4d1e('0x0'));var moment=require(_0x4d1e('0x1'));var BPromise=require(_0x4d1e('0x2'));var rs=require(_0x4d1e('0x3'));var fs=require('fs');var Redis=require(_0x4d1e('0x4'));var db=require(_0x4d1e('0x5'))['db'];var utils=require(_0x4d1e('0x6'));var logger=require(_0x4d1e('0x7'))(_0x4d1e('0x8'));var config=require(_0x4d1e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4d1e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x378c5f,_0x902106,_0x318ed3){return new BPromise(function(_0x31c5a4,_0x5aaa4f){return client[_0x4d1e('0xb')](_0x378c5f,_0x318ed3)[_0x4d1e('0xc')](function(_0x7a71a1){logger[_0x4d1e('0xd')]('SquareMessage,\x20%s,\x20%s',_0x902106,_0x4d1e('0xe'));logger[_0x4d1e('0xf')](_0x4d1e('0x10'),_0x902106,_0x4d1e('0xe'),JSON[_0x4d1e('0x11')](_0x7a71a1));if(_0x7a71a1[_0x4d1e('0x12')]){if(_0x7a71a1[_0x4d1e('0x12')]['code']===0x1f4){logger[_0x4d1e('0x12')](_0x4d1e('0x13'),_0x902106,_0x7a71a1[_0x4d1e('0x12')]['message']);return _0x5aaa4f(_0x7a71a1[_0x4d1e('0x12')][_0x4d1e('0x14')]);}logger[_0x4d1e('0x12')](_0x4d1e('0x13'),_0x902106,_0x7a71a1[_0x4d1e('0x12')]['message']);return _0x31c5a4(_0x7a71a1['error'][_0x4d1e('0x14')]);}else{logger[_0x4d1e('0xd')](_0x4d1e('0x13'),_0x902106,_0x4d1e('0xe'));_0x31c5a4(_0x7a71a1[_0x4d1e('0x15')][_0x4d1e('0x14')]);}})[_0x4d1e('0x16')](function(_0x4c1aef){logger['error']('SquareMessage,\x20%s,\x20%s',_0x902106,_0x4c1aef);_0x5aaa4f(_0x4c1aef);});});}exports['CreateSquareMessage']=function(_0x4c8327){var _0x1a947f=this;return new Promise(function(_0x265a8c,_0x168e57){return db['SquareMessage'][_0x4d1e('0x17')](_0x4c8327[_0x4d1e('0x18')],{'raw':_0x4c8327[_0x4d1e('0x19')]?_0x4c8327[_0x4d1e('0x19')][_0x4d1e('0x1a')]===undefined?!![]:![]:!![]})[_0x4d1e('0xc')](function(_0x2813aa){logger['info'](_0x4d1e('0x1b'),_0x4c8327);logger[_0x4d1e('0xf')](_0x4d1e('0x1b'),_0x4c8327,JSON['stringify'](_0x2813aa));_0x265a8c(_0x2813aa);})['catch'](function(_0x6830f7){logger[_0x4d1e('0x12')](_0x4d1e('0x1b'),_0x6830f7['message'],_0x4c8327);_0x168e57(_0x1a947f[_0x4d1e('0x12')](0x1f4,_0x6830f7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4e1fa40..e291de6 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 _0xddbd=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x4ec26c,_0x486039){var _0x161637=function(_0x47139f){while(--_0x47139f){_0x4ec26c['push'](_0x4ec26c['shift']());}};_0x161637(++_0x486039);}(_0xddbd,0x150));var _0xdddb=function(_0xa64531,_0x48c65f){_0xa64531=_0xa64531-0x0;var _0x1b1f42=_0xddbd[_0xa64531];return _0x1b1f42;};'use strict';var multer=require(_0xdddb('0x0'));var util=require(_0xdddb('0x1'));var path=require(_0xdddb('0x2'));var timeout=require(_0xdddb('0x3'));var express=require('express');var router=express[_0xdddb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdddb('0x5'));var config=require(_0xdddb('0x6'));var controller=require('./squareOdbc.controller');router[_0xdddb('0x7')]('/',auth[_0xdddb('0x8')](),controller[_0xdddb('0x9')]);router[_0xdddb('0x7')](_0xdddb('0xa'),auth[_0xdddb('0x8')](),controller[_0xdddb('0xb')]);router['get'](_0xdddb('0xc'),auth[_0xdddb('0x8')](),timeout(_0xdddb('0xd')),controller[_0xdddb('0xe')]);router[_0xdddb('0xf')]('/',auth['isAuthenticated'](),controller[_0xdddb('0x10')]);router[_0xdddb('0x11')]('/:id',auth[_0xdddb('0x8')](),controller[_0xdddb('0x12')]);router[_0xdddb('0x13')](_0xdddb('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x74ef=['exports','multer','path','express','Router','../../components/auth/service','./squareOdbc.controller','get','index','isAuthenticated','show','/:id/test','15s','post','create','put','/:id','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74ef,0x105));var _0xf74e=function(_0x1e6773,_0x138124){_0x1e6773=_0x1e6773-0x0;var _0x4c81a0=_0x74ef[_0x1e6773];return _0x4c81a0;};'use strict';var multer=require(_0xf74e('0x0'));var util=require('util');var path=require(_0xf74e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf74e('0x2'));var router=express[_0xf74e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf74e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf74e('0x5'));router[_0xf74e('0x6')]('/',auth['isAuthenticated'](),controller[_0xf74e('0x7')]);router['get']('/:id',auth[_0xf74e('0x8')](),controller[_0xf74e('0x9')]);router[_0xf74e('0x6')](_0xf74e('0xa'),auth[_0xf74e('0x8')](),timeout(_0xf74e('0xb')),controller['test']);router[_0xf74e('0xc')]('/',auth[_0xf74e('0x8')](),controller[_0xf74e('0xd')]);router[_0xf74e('0xe')](_0xf74e('0xf'),auth['isAuthenticated'](),controller[_0xf74e('0x10')]);router[_0xf74e('0x11')](_0xf74e('0xf'),auth[_0xf74e('0x8')](),controller[_0xf74e('0x12')]);module[_0xf74e('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1e49f6a..9c6cda6 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 _0x948b=['STRING','name','sequelize','exports'];(function(_0x530873,_0x314062){var _0x223abd=function(_0x11d93e){while(--_0x11d93e){_0x530873['push'](_0x530873['shift']());}};_0x223abd(++_0x314062);}(_0x948b,0x176));var _0xb948=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x948b[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0xb948('0x0'));module[_0xb948('0x1')]={'name':{'type':Sequelize[_0xb948('0x2')],'unique':_0xb948('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb948('0x2')]},'description':{'type':Sequelize[_0xb948('0x2')]}}; \ No newline at end of file +var _0x876d=['exports','STRING','name','sequelize'];(function(_0x4ffb7e,_0x2735e3){var _0x2d5bab=function(_0x773310){while(--_0x773310){_0x4ffb7e['push'](_0x4ffb7e['shift']());}};_0x2d5bab(++_0x2735e3);}(_0x876d,0x67));var _0xd876=function(_0x139f98,_0x533fd3){_0x139f98=_0x139f98-0x0;var _0x276303=_0x876d[_0x139f98];return _0x276303;};'use strict';var Sequelize=require(_0xd876('0x0'));module[_0xd876('0x1')]={'name':{'type':Sequelize[_0xd876('0x2')],'unique':_0xd876('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd876('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0d396e0..b852aec 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 _0x5e43=['get','ODBC','UserProfileResource','destroy','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','intersection','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x5e43,0x18c));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35e4('0x0'));var zipdir=require(_0x35e4('0x1'));var jsonpatch=require(_0x35e4('0x2'));var rp=require('request-promise');var moment=require(_0x35e4('0x3'));var BPromise=require(_0x35e4('0x4'));var Mustache=require(_0x35e4('0x5'));var util=require('util');var path=require(_0x35e4('0x6'));var sox=require('sox');var csv=require(_0x35e4('0x7'));var ejs=require(_0x35e4('0x8'));var fs=require('fs');var fs_extra=require(_0x35e4('0x9'));var _=require(_0x35e4('0xa'));var squel=require('squel');var crypto=require(_0x35e4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x35e4('0x7'));var querystring=require(_0x35e4('0xc'));var Papa=require('papaparse');var Redis=require(_0x35e4('0xd'));var authService=require(_0x35e4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x35e4('0xf'));var hardwareService=require(_0x35e4('0x10'));var logger=require(_0x35e4('0x11'))(_0x35e4('0x12'));var utils=require(_0x35e4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x35e4('0x14'))['db'];function respondWithStatusCode(_0x20f7dd,_0x16cb54){_0x16cb54=_0x16cb54||0xcc;return function(_0x481516){if(_0x481516){return _0x20f7dd[_0x35e4('0x15')](_0x16cb54);}return _0x20f7dd[_0x35e4('0x16')](_0x16cb54)[_0x35e4('0x17')]();};}function respondWithResult(_0x5ef7b2,_0x4268a7){_0x4268a7=_0x4268a7||0xc8;return function(_0x4cb28e){if(_0x4cb28e){return _0x5ef7b2[_0x35e4('0x16')](_0x4268a7)['json'](_0x4cb28e);}};}function respondWithFilteredResult(_0x3ea9e5,_0x1ab73c){return function(_0x428428){if(_0x428428){var _0x5f5992=typeof _0x1ab73c[_0x35e4('0x18')]==='undefined'&&typeof _0x1ab73c['limit']===_0x35e4('0x19');var _0x31a7b5=_0x428428[_0x35e4('0x1a')];var _0x1e05a4=_0x5f5992?0x0:_0x1ab73c[_0x35e4('0x18')];var _0x1d1755=_0x5f5992?_0x428428[_0x35e4('0x1a')]:_0x1ab73c[_0x35e4('0x18')]+_0x1ab73c[_0x35e4('0x1b')];var _0x26d2ea;if(_0x1d1755>=_0x31a7b5){_0x1d1755=_0x31a7b5;_0x26d2ea=0xc8;}else{_0x26d2ea=0xce;}_0x3ea9e5['status'](_0x26d2ea);return _0x3ea9e5[_0x35e4('0x1c')](_0x35e4('0x1d'),_0x1e05a4+'-'+_0x1d1755+'/'+_0x31a7b5)['json'](_0x428428);}return null;};}function patchUpdates(_0x5350f2){return function(_0x458a39){try{jsonpatch[_0x35e4('0x1e')](_0x458a39,_0x5350f2,!![]);}catch(_0x2a86cf){return BPromise[_0x35e4('0x1f')](_0x2a86cf);}return _0x458a39[_0x35e4('0x20')]();};}function saveUpdates(_0x1ab59e,_0xb98136){return function(_0x540f03){if(_0x540f03){return _0x540f03['update'](_0x1ab59e)[_0x35e4('0x21')](function(_0x274f4e){return _0x274f4e;});}return null;};}function removeEntity(_0x3288e8,_0x4c8c4b){return function(_0x364dca){if(_0x364dca){return _0x364dca['destroy']()[_0x35e4('0x21')](function(){var _0x59fa2a=_0x364dca[_0x35e4('0x22')]({'plain':!![]});var _0x10af73=_0x35e4('0x23');return db[_0x35e4('0x24')][_0x35e4('0x25')]({'where':{'type':_0x10af73,'resourceId':_0x59fa2a['id']}})[_0x35e4('0x21')](function(){return _0x364dca;});})[_0x35e4('0x21')](function(){_0x3288e8[_0x35e4('0x16')](0xcc)[_0x35e4('0x17')]();});}};}function handleEntityNotFound(_0x3582e9,_0xab05cc){return function(_0x3b15){if(!_0x3b15){_0x3582e9['sendStatus'](0x194);}return _0x3b15;};}function handleError(_0x1f1091,_0x3a70d9){_0x3a70d9=_0x3a70d9||0x1f4;return function(_0x7bfb0c){logger[_0x35e4('0x26')](_0x7bfb0c[_0x35e4('0x27')]);if(_0x7bfb0c[_0x35e4('0x28')]){delete _0x7bfb0c['name'];}_0x1f1091[_0x35e4('0x16')](_0x3a70d9)[_0x35e4('0x29')](_0x7bfb0c);};}exports['index']=function(_0x5be30d,_0x2b4429){var _0x40fc9f={},_0x34f7d8={},_0x4189f3={'count':0x0,'rows':[]};var _0x380119=_[_0x35e4('0x2a')](db[_0x35e4('0x2b')][_0x35e4('0x2c')],function(_0x4e25e1){return{'name':_0x4e25e1[_0x35e4('0x2d')],'type':_0x4e25e1[_0x35e4('0x2e')][_0x35e4('0x2f')]};});_0x34f7d8[_0x35e4('0x30')]=_['map'](_0x380119,_0x35e4('0x28'));_0x34f7d8['query']=_['keys'](_0x5be30d[_0x35e4('0x31')]);_0x34f7d8[_0x35e4('0x32')]=_['intersection'](_0x34f7d8[_0x35e4('0x30')],_0x34f7d8['query']);_0x40fc9f[_0x35e4('0x33')]=_['intersection'](_0x34f7d8[_0x35e4('0x30')],qs[_0x35e4('0x34')](_0x5be30d[_0x35e4('0x31')][_0x35e4('0x34')]));_0x40fc9f['attributes']=_0x40fc9f[_0x35e4('0x33')][_0x35e4('0x35')]?_0x40fc9f[_0x35e4('0x33')]:_0x34f7d8[_0x35e4('0x30')];if(!_0x5be30d[_0x35e4('0x31')][_0x35e4('0x36')](_0x35e4('0x37'))){_0x40fc9f[_0x35e4('0x1b')]=qs['limit'](_0x5be30d[_0x35e4('0x31')]['limit']);_0x40fc9f[_0x35e4('0x18')]=qs[_0x35e4('0x18')](_0x5be30d['query']['offset']);}_0x40fc9f[_0x35e4('0x38')]=qs[_0x35e4('0x39')](_0x5be30d['query'][_0x35e4('0x39')]);_0x40fc9f[_0x35e4('0x3a')]=qs[_0x35e4('0x32')](_[_0x35e4('0x3b')](_0x5be30d['query'],_0x34f7d8[_0x35e4('0x32')]),_0x380119);if(_0x5be30d[_0x35e4('0x31')][_0x35e4('0x3c')]){_0x40fc9f[_0x35e4('0x3a')]=_[_0x35e4('0x3d')](_0x40fc9f[_0x35e4('0x3a')],{'$or':_[_0x35e4('0x2a')](_0x380119,function(_0x1b9718){if(_0x1b9718[_0x35e4('0x2e')]!==_0x35e4('0x3e')){var _0x3f1e4c={};_0x3f1e4c[_0x1b9718[_0x35e4('0x28')]]={'$like':'%'+_0x5be30d[_0x35e4('0x31')][_0x35e4('0x3c')]+'%'};return _0x3f1e4c;}})});}_0x40fc9f=_['merge']({},_0x40fc9f,_0x5be30d['options']);var _0x21133d={'where':_0x40fc9f[_0x35e4('0x3a')]};return db[_0x35e4('0x2b')][_0x35e4('0x1a')](_0x21133d)[_0x35e4('0x21')](function(_0x473a1a){_0x4189f3[_0x35e4('0x1a')]=_0x473a1a;if(_0x5be30d['query'][_0x35e4('0x3f')]){_0x40fc9f[_0x35e4('0x40')]=[{'all':!![]}];}return db[_0x35e4('0x2b')]['findAll'](_0x40fc9f);})[_0x35e4('0x21')](function(_0x52667f){_0x4189f3[_0x35e4('0x41')]=_0x52667f;return _0x4189f3;})['then'](respondWithFilteredResult(_0x2b4429,_0x40fc9f))[_0x35e4('0x42')](handleError(_0x2b4429,null));};exports[_0x35e4('0x43')]=function(_0xe370fd,_0x1d5e08){var _0x337b4c={'raw':!![],'where':{'id':_0xe370fd[_0x35e4('0x44')]['id']}},_0x2cb84e={};_0x2cb84e[_0x35e4('0x30')]=_['keys'](db[_0x35e4('0x2b')][_0x35e4('0x2c')]);_0x2cb84e[_0x35e4('0x31')]=_[_0x35e4('0x45')](_0xe370fd['query']);_0x2cb84e['filters']=_[_0x35e4('0x46')](_0x2cb84e[_0x35e4('0x30')],_0x2cb84e[_0x35e4('0x31')]);_0x337b4c['attributes']=_[_0x35e4('0x46')](_0x2cb84e['model'],qs[_0x35e4('0x34')](_0xe370fd['query'][_0x35e4('0x34')]));_0x337b4c[_0x35e4('0x33')]=_0x337b4c[_0x35e4('0x33')][_0x35e4('0x35')]?_0x337b4c[_0x35e4('0x33')]:_0x2cb84e[_0x35e4('0x30')];if(_0xe370fd['query'][_0x35e4('0x3f')]){_0x337b4c[_0x35e4('0x40')]=[{'all':!![]}];}_0x337b4c=_[_0x35e4('0x3d')]({},_0x337b4c,_0xe370fd[_0x35e4('0x47')]);return db[_0x35e4('0x2b')]['find'](_0x337b4c)[_0x35e4('0x21')](handleEntityNotFound(_0x1d5e08,null))[_0x35e4('0x21')](respondWithResult(_0x1d5e08,null))[_0x35e4('0x42')](handleError(_0x1d5e08,null));};exports[_0x35e4('0x48')]=function(_0x259640,_0x38eb7e){return db[_0x35e4('0x2b')][_0x35e4('0x48')](_0x259640['body'],{})[_0x35e4('0x21')](function(_0x1b513f){var _0x3383ae=_0x259640[_0x35e4('0x49')][_0x35e4('0x22')]({'plain':!![]});if(!_0x3383ae)throw new Error(_0x35e4('0x4a'));if(_0x3383ae[_0x35e4('0x4b')]===_0x35e4('0x49')){var _0x557aa2=_0x1b513f[_0x35e4('0x22')]({'plain':!![]});var _0x51a08f=_0x35e4('0x23');return db[_0x35e4('0x4c')][_0x35e4('0x4d')]({'where':{'name':_0x51a08f,'userProfileId':_0x3383ae[_0x35e4('0x4e')]},'raw':!![]})[_0x35e4('0x21')](function(_0x46811d){if(_0x46811d&&_0x46811d[_0x35e4('0x4f')]===0x0){return db[_0x35e4('0x24')][_0x35e4('0x48')]({'name':_0x557aa2[_0x35e4('0x28')],'resourceId':_0x557aa2['id'],'type':_0x46811d[_0x35e4('0x28')],'sectionId':_0x46811d['id']},{})[_0x35e4('0x21')](function(){return _0x1b513f;});}else{return _0x1b513f;}})[_0x35e4('0x42')](function(_0xbfcf46){logger[_0x35e4('0x26')](_0x35e4('0x50'),_0xbfcf46);throw _0xbfcf46;});}return _0x1b513f;})['then'](respondWithResult(_0x38eb7e,0xc9))[_0x35e4('0x42')](handleError(_0x38eb7e,null));};exports[_0x35e4('0x51')]=function(_0x4de62d,_0x5d31ff){if(_0x4de62d[_0x35e4('0x52')]['id']){delete _0x4de62d[_0x35e4('0x52')]['id'];}return db[_0x35e4('0x2b')][_0x35e4('0x4d')]({'where':{'id':_0x4de62d['params']['id']}})[_0x35e4('0x21')](handleEntityNotFound(_0x5d31ff,null))[_0x35e4('0x21')](saveUpdates(_0x4de62d[_0x35e4('0x52')],null))[_0x35e4('0x21')](respondWithResult(_0x5d31ff,null))['catch'](handleError(_0x5d31ff,null));};exports[_0x35e4('0x25')]=function(_0x22a6d2,_0x1de602){return db['SquareOdbc'][_0x35e4('0x4d')]({'where':{'id':_0x22a6d2[_0x35e4('0x44')]['id']}})[_0x35e4('0x21')](handleEntityNotFound(_0x1de602,null))[_0x35e4('0x21')](removeEntity(_0x1de602,null))[_0x35e4('0x42')](handleError(_0x1de602,null));};exports['test']=function(_0x5ef686,_0x384511,_0x25330c){var _0x138f6e;return db['SquareOdbc']['find']({'where':{'id':_0x5ef686[_0x35e4('0x44')]['id']},'attributes':['id',_0x35e4('0x53')]})['then'](handleEntityNotFound(_0x384511,null))['then'](function(_0x225d32){if(_0x225d32){var _0x399834=require('odbc')();_0x399834[_0x35e4('0x54')](_0x225d32[_0x35e4('0x53')]);_0x399834[_0x35e4('0x55')]();return _0x225d32;}})[_0x35e4('0x21')](respondWithResult(_0x384511,null))[_0x35e4('0x42')](handleError(_0x384511,null));}; \ No newline at end of file +var _0xfbf1=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','filters','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','test','dsn','rimraf','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','ODBC','UserProfileResource','destroy','end','name','send','index','map','SquareOdbc','fieldName','key','model','keys','query','intersection','attributes','fields'];(function(_0x1c0e0d,_0x5e2291){var _0x310efe=function(_0x577a87){while(--_0x577a87){_0x1c0e0d['push'](_0x1c0e0d['shift']());}};_0x310efe(++_0x5e2291);}(_0xfbf1,0x115));var _0x1fbf=function(_0x1829cc,_0x2c4475){_0x1829cc=_0x1829cc-0x0;var _0x481bc0=_0xfbf1[_0x1829cc];return _0x481bc0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1fbf('0x1'));var moment=require(_0x1fbf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1fbf('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1fbf('0x4'));var ejs=require(_0x1fbf('0x5'));var fs=require('fs');var fs_extra=require(_0x1fbf('0x6'));var _=require(_0x1fbf('0x7'));var squel=require('squel');var crypto=require(_0x1fbf('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1fbf('0x9'));var toCsv=require('to-csv');var querystring=require(_0x1fbf('0xa'));var Papa=require(_0x1fbf('0xb'));var Redis=require(_0x1fbf('0xc'));var authService=require(_0x1fbf('0xd'));var qs=require(_0x1fbf('0xe'));var as=require(_0x1fbf('0xf'));var hardwareService=require(_0x1fbf('0x10'));var logger=require('../../config/logger')(_0x1fbf('0x11'));var utils=require(_0x1fbf('0x12'));var config=require(_0x1fbf('0x13'));var licenseUtil=require(_0x1fbf('0x14'));var db=require(_0x1fbf('0x15'))['db'];function respondWithStatusCode(_0x32f248,_0x3b6292){_0x3b6292=_0x3b6292||0xcc;return function(_0x429ceb){if(_0x429ceb){return _0x32f248[_0x1fbf('0x16')](_0x3b6292);}return _0x32f248[_0x1fbf('0x17')](_0x3b6292)['end']();};}function respondWithResult(_0x4703ca,_0x3080c5){_0x3080c5=_0x3080c5||0xc8;return function(_0x2b3c42){if(_0x2b3c42){return _0x4703ca[_0x1fbf('0x17')](_0x3080c5)[_0x1fbf('0x18')](_0x2b3c42);}};}function respondWithFilteredResult(_0x335350,_0x50fc1b){return function(_0x544a52){if(_0x544a52){var _0x38dd7b=typeof _0x50fc1b[_0x1fbf('0x19')]===_0x1fbf('0x1a')&&typeof _0x50fc1b[_0x1fbf('0x1b')]===_0x1fbf('0x1a');var _0xe985b0=_0x544a52[_0x1fbf('0x1c')];var _0x3e14bf=_0x38dd7b?0x0:_0x50fc1b[_0x1fbf('0x19')];var _0x2c4a84=_0x38dd7b?_0x544a52[_0x1fbf('0x1c')]:_0x50fc1b['offset']+_0x50fc1b[_0x1fbf('0x1b')];var _0x237427;if(_0x2c4a84>=_0xe985b0){_0x2c4a84=_0xe985b0;_0x237427=0xc8;}else{_0x237427=0xce;}_0x335350[_0x1fbf('0x17')](_0x237427);return _0x335350[_0x1fbf('0x1d')](_0x1fbf('0x1e'),_0x3e14bf+'-'+_0x2c4a84+'/'+_0xe985b0)['json'](_0x544a52);}return null;};}function patchUpdates(_0x54969d){return function(_0x332f64){try{jsonpatch['apply'](_0x332f64,_0x54969d,!![]);}catch(_0x5f3759){return BPromise[_0x1fbf('0x1f')](_0x5f3759);}return _0x332f64[_0x1fbf('0x20')]();};}function saveUpdates(_0x15f74e,_0x26a07b){return function(_0x5dfaa5){if(_0x5dfaa5){return _0x5dfaa5['update'](_0x15f74e)['then'](function(_0x360b6f){return _0x360b6f;});}return null;};}function removeEntity(_0x389d83,_0x3df1ec){return function(_0x86b861){if(_0x86b861){return _0x86b861['destroy']()[_0x1fbf('0x21')](function(){var _0x52e631=_0x86b861['get']({'plain':!![]});var _0x6c7219=_0x1fbf('0x22');return db[_0x1fbf('0x23')][_0x1fbf('0x24')]({'where':{'type':_0x6c7219,'resourceId':_0x52e631['id']}})['then'](function(){return _0x86b861;});})[_0x1fbf('0x21')](function(){_0x389d83[_0x1fbf('0x17')](0xcc)[_0x1fbf('0x25')]();});}};}function handleEntityNotFound(_0x385981,_0x480a2f){return function(_0x2bae35){if(!_0x2bae35){_0x385981[_0x1fbf('0x16')](0x194);}return _0x2bae35;};}function handleError(_0x185464,_0x2dc8f9){_0x2dc8f9=_0x2dc8f9||0x1f4;return function(_0x36efeb){logger['error'](_0x36efeb['stack']);if(_0x36efeb[_0x1fbf('0x26')]){delete _0x36efeb[_0x1fbf('0x26')];}_0x185464[_0x1fbf('0x17')](_0x2dc8f9)[_0x1fbf('0x27')](_0x36efeb);};}exports[_0x1fbf('0x28')]=function(_0x432185,_0x5db3b1){var _0x29bdd6={},_0xd2df94={},_0x422d55={'count':0x0,'rows':[]};var _0x3d288e=_[_0x1fbf('0x29')](db[_0x1fbf('0x2a')]['rawAttributes'],function(_0x36f12a){return{'name':_0x36f12a[_0x1fbf('0x2b')],'type':_0x36f12a['type'][_0x1fbf('0x2c')]};});_0xd2df94[_0x1fbf('0x2d')]=_['map'](_0x3d288e,_0x1fbf('0x26'));_0xd2df94['query']=_[_0x1fbf('0x2e')](_0x432185[_0x1fbf('0x2f')]);_0xd2df94['filters']=_[_0x1fbf('0x30')](_0xd2df94[_0x1fbf('0x2d')],_0xd2df94['query']);_0x29bdd6[_0x1fbf('0x31')]=_[_0x1fbf('0x30')](_0xd2df94[_0x1fbf('0x2d')],qs[_0x1fbf('0x32')](_0x432185[_0x1fbf('0x2f')][_0x1fbf('0x32')]));_0x29bdd6[_0x1fbf('0x31')]=_0x29bdd6[_0x1fbf('0x31')][_0x1fbf('0x33')]?_0x29bdd6[_0x1fbf('0x31')]:_0xd2df94[_0x1fbf('0x2d')];if(!_0x432185[_0x1fbf('0x2f')][_0x1fbf('0x34')](_0x1fbf('0x35'))){_0x29bdd6[_0x1fbf('0x1b')]=qs['limit'](_0x432185[_0x1fbf('0x2f')]['limit']);_0x29bdd6['offset']=qs[_0x1fbf('0x19')](_0x432185[_0x1fbf('0x2f')][_0x1fbf('0x19')]);}_0x29bdd6[_0x1fbf('0x36')]=qs[_0x1fbf('0x37')](_0x432185[_0x1fbf('0x2f')][_0x1fbf('0x37')]);_0x29bdd6[_0x1fbf('0x38')]=qs['filters'](_[_0x1fbf('0x39')](_0x432185[_0x1fbf('0x2f')],_0xd2df94['filters']),_0x3d288e);if(_0x432185[_0x1fbf('0x2f')][_0x1fbf('0x3a')]){_0x29bdd6[_0x1fbf('0x38')]=_[_0x1fbf('0x3b')](_0x29bdd6[_0x1fbf('0x38')],{'$or':_['map'](_0x3d288e,function(_0x1b8c16){if(_0x1b8c16['type']!==_0x1fbf('0x3c')){var _0x272b8a={};_0x272b8a[_0x1b8c16[_0x1fbf('0x26')]]={'$like':'%'+_0x432185[_0x1fbf('0x2f')][_0x1fbf('0x3a')]+'%'};return _0x272b8a;}})});}_0x29bdd6=_[_0x1fbf('0x3b')]({},_0x29bdd6,_0x432185[_0x1fbf('0x3d')]);var _0x488aac={'where':_0x29bdd6['where']};return db[_0x1fbf('0x2a')]['count'](_0x488aac)['then'](function(_0x331b24){_0x422d55[_0x1fbf('0x1c')]=_0x331b24;if(_0x432185[_0x1fbf('0x2f')][_0x1fbf('0x3e')]){_0x29bdd6[_0x1fbf('0x3f')]=[{'all':!![]}];}return db[_0x1fbf('0x2a')]['findAll'](_0x29bdd6);})[_0x1fbf('0x21')](function(_0x1cc23d){_0x422d55[_0x1fbf('0x40')]=_0x1cc23d;return _0x422d55;})[_0x1fbf('0x21')](respondWithFilteredResult(_0x5db3b1,_0x29bdd6))[_0x1fbf('0x41')](handleError(_0x5db3b1,null));};exports[_0x1fbf('0x42')]=function(_0x245dc7,_0x29f348){var _0x458dbc={'raw':!![],'where':{'id':_0x245dc7[_0x1fbf('0x43')]['id']}},_0x8a53d2={};_0x8a53d2[_0x1fbf('0x2d')]=_[_0x1fbf('0x2e')](db[_0x1fbf('0x2a')][_0x1fbf('0x44')]);_0x8a53d2[_0x1fbf('0x2f')]=_[_0x1fbf('0x2e')](_0x245dc7[_0x1fbf('0x2f')]);_0x8a53d2[_0x1fbf('0x45')]=_[_0x1fbf('0x30')](_0x8a53d2['model'],_0x8a53d2[_0x1fbf('0x2f')]);_0x458dbc['attributes']=_['intersection'](_0x8a53d2[_0x1fbf('0x2d')],qs['fields'](_0x245dc7[_0x1fbf('0x2f')][_0x1fbf('0x32')]));_0x458dbc[_0x1fbf('0x31')]=_0x458dbc['attributes']['length']?_0x458dbc[_0x1fbf('0x31')]:_0x8a53d2[_0x1fbf('0x2d')];if(_0x245dc7[_0x1fbf('0x2f')][_0x1fbf('0x3e')]){_0x458dbc[_0x1fbf('0x3f')]=[{'all':!![]}];}_0x458dbc=_[_0x1fbf('0x3b')]({},_0x458dbc,_0x245dc7[_0x1fbf('0x3d')]);return db[_0x1fbf('0x2a')][_0x1fbf('0x46')](_0x458dbc)['then'](handleEntityNotFound(_0x29f348,null))[_0x1fbf('0x21')](respondWithResult(_0x29f348,null))[_0x1fbf('0x41')](handleError(_0x29f348,null));};exports[_0x1fbf('0x47')]=function(_0x2e5a40,_0x3cbe58){return db[_0x1fbf('0x2a')]['create'](_0x2e5a40[_0x1fbf('0x48')],{})[_0x1fbf('0x21')](function(_0x1224cd){var _0x20d18e=_0x2e5a40[_0x1fbf('0x49')][_0x1fbf('0x4a')]({'plain':!![]});if(!_0x20d18e)throw new Error(_0x1fbf('0x4b'));if(_0x20d18e[_0x1fbf('0x4c')]===_0x1fbf('0x49')){var _0x3d28ad=_0x1224cd[_0x1fbf('0x4a')]({'plain':!![]});var _0x24e2b5=_0x1fbf('0x22');return db['UserProfileSection'][_0x1fbf('0x46')]({'where':{'name':_0x24e2b5,'userProfileId':_0x20d18e[_0x1fbf('0x4d')]},'raw':!![]})[_0x1fbf('0x21')](function(_0x3690fd){if(_0x3690fd&&_0x3690fd[_0x1fbf('0x4e')]===0x0){return db[_0x1fbf('0x23')][_0x1fbf('0x47')]({'name':_0x3d28ad[_0x1fbf('0x26')],'resourceId':_0x3d28ad['id'],'type':_0x3690fd[_0x1fbf('0x26')],'sectionId':_0x3690fd['id']},{})['then'](function(){return _0x1224cd;});}else{return _0x1224cd;}})['catch'](function(_0x58cd0e){logger[_0x1fbf('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58cd0e);throw _0x58cd0e;});}return _0x1224cd;})['then'](respondWithResult(_0x3cbe58,0xc9))['catch'](handleError(_0x3cbe58,null));};exports['update']=function(_0x39cb32,_0x1dc9b9){if(_0x39cb32[_0x1fbf('0x48')]['id']){delete _0x39cb32[_0x1fbf('0x48')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x39cb32[_0x1fbf('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dc9b9,null))[_0x1fbf('0x21')](saveUpdates(_0x39cb32[_0x1fbf('0x48')],null))[_0x1fbf('0x21')](respondWithResult(_0x1dc9b9,null))[_0x1fbf('0x41')](handleError(_0x1dc9b9,null));};exports['destroy']=function(_0x3c2bab,_0x517a60){return db[_0x1fbf('0x2a')][_0x1fbf('0x46')]({'where':{'id':_0x3c2bab[_0x1fbf('0x43')]['id']}})[_0x1fbf('0x21')](handleEntityNotFound(_0x517a60,null))[_0x1fbf('0x21')](removeEntity(_0x517a60,null))[_0x1fbf('0x41')](handleError(_0x517a60,null));};exports[_0x1fbf('0x50')]=function(_0x43c979,_0x1046ba,_0xd2652){var _0x981aa5;return db['SquareOdbc']['find']({'where':{'id':_0x43c979['params']['id']},'attributes':['id',_0x1fbf('0x51')]})[_0x1fbf('0x21')](handleEntityNotFound(_0x1046ba,null))[_0x1fbf('0x21')](function(_0x5494ab){if(_0x5494ab){var _0x433146=require('odbc')();_0x433146['openSync'](_0x5494ab[_0x1fbf('0x51')]);_0x433146['closeSync']();return _0x5494ab;}})['then'](respondWithResult(_0x1046ba,null))[_0x1fbf('0x41')](handleError(_0x1046ba,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 20bef4a..0a459e2 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 _0x3d2c=['SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x24c135,_0xdb4450){var _0x290c66=function(_0x537cf8){while(--_0x537cf8){_0x24c135['push'](_0x24c135['shift']());}};_0x290c66(++_0xdb4450);}(_0x3d2c,0x9c));var _0xc3d2=function(_0xb75f6a,_0x8ee249){_0xb75f6a=_0xb75f6a-0x0;var _0x231063=_0x3d2c[_0xb75f6a];return _0x231063;};'use strict';var _=require(_0xc3d2('0x0'));var util=require('util');var logger=require(_0xc3d2('0x1'))(_0xc3d2('0x2'));var moment=require(_0xc3d2('0x3'));var BPromise=require(_0xc3d2('0x4'));var rp=require(_0xc3d2('0x5'));var fs=require('fs');var path=require(_0xc3d2('0x6'));var rimraf=require(_0xc3d2('0x7'));var config=require(_0xc3d2('0x8'));var attributes=require(_0xc3d2('0x9'));module[_0xc3d2('0xa')]=function(_0x1301cd,_0x12a0e8){return _0x1301cd[_0xc3d2('0xb')](_0xc3d2('0xc'),attributes,{'tableName':_0xc3d2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98ad=['SquareOdbc','square_odbc','lodash','util','api','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x98ad,0x110));var _0xd98a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x98ad[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd98a('0x0'));var util=require(_0xd98a('0x1'));var logger=require('../../config/logger')(_0xd98a('0x2'));var moment=require('moment');var BPromise=require(_0xd98a('0x3'));var rp=require(_0xd98a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd98a('0x5'));var attributes=require(_0xd98a('0x6'));module[_0xd98a('0x7')]=function(_0x4e151d,_0x4c6aae){return _0x4e151d['define'](_0xd98a('0x8'),attributes,{'tableName':_0xd98a('0x9'),'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 6956fed..cb57a0e 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 _0xb679=['where','include','map','attributes','model','ShowSquareOdbc','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SquareOdbc','find','options'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xb679,0x92));var _0x9b67=function(_0xcf9785,_0x39c64b){_0xcf9785=_0xcf9785-0x0;var _0x3d2f02=_0xb679[_0xcf9785];return _0x3d2f02;};'use strict';var _=require(_0x9b67('0x0'));var util=require(_0x9b67('0x1'));var moment=require(_0x9b67('0x2'));var BPromise=require(_0x9b67('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b67('0x4'));var db=require(_0x9b67('0x5'))['db'];var utils=require(_0x9b67('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9b67('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ac5d5,_0x54680c,_0x584ac2){return new BPromise(function(_0x4f419c,_0x2db606){return client[_0x9b67('0x8')](_0x1ac5d5,_0x584ac2)[_0x9b67('0x9')](function(_0x166287){logger[_0x9b67('0xa')](_0x9b67('0xb'),_0x54680c,'request\x20sent');logger[_0x9b67('0xc')](_0x9b67('0xd'),_0x54680c,_0x9b67('0xe'),JSON['stringify'](_0x166287));if(_0x166287[_0x9b67('0xf')]){if(_0x166287[_0x9b67('0xf')]['code']===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x54680c,_0x166287[_0x9b67('0xf')][_0x9b67('0x10')]);return _0x2db606(_0x166287[_0x9b67('0xf')][_0x9b67('0x10')]);}logger['error'](_0x9b67('0xb'),_0x54680c,_0x166287[_0x9b67('0xf')]['message']);return _0x4f419c(_0x166287[_0x9b67('0xf')][_0x9b67('0x10')]);}else{logger[_0x9b67('0xa')](_0x9b67('0xb'),_0x54680c,_0x9b67('0xe'));_0x4f419c(_0x166287[_0x9b67('0x11')][_0x9b67('0x10')]);}})[_0x9b67('0x12')](function(_0x30d34c){logger[_0x9b67('0xf')](_0x9b67('0xb'),_0x54680c,_0x30d34c);_0x2db606(_0x30d34c);});});}exports['ShowSquareOdbc']=function(_0x4b972b){var _0x348dcd=this;return new Promise(function(_0x16ab98,_0xdc94e3){return db[_0x9b67('0x13')][_0x9b67('0x14')]({'raw':_0x4b972b['options']?_0x4b972b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b972b['options']?_0x4b972b[_0x9b67('0x15')][_0x9b67('0x16')]||null:null,'attributes':_0x4b972b['options']?_0x4b972b[_0x9b67('0x15')]['attributes']||null:null,'include':_0x4b972b[_0x9b67('0x15')]?_0x4b972b[_0x9b67('0x15')][_0x9b67('0x17')]?_[_0x9b67('0x18')](_0x4b972b['options'][_0x9b67('0x17')],function(_0x36a4ff){return{'model':db[_0x36a4ff['model']],'as':_0x36a4ff['as'],'attributes':_0x36a4ff[_0x9b67('0x19')],'include':_0x36a4ff['include']?_['map'](_0x36a4ff[_0x9b67('0x17')],function(_0x161ed7){return{'model':db[_0x161ed7['model']],'as':_0x161ed7['as'],'attributes':_0x161ed7['attributes'],'include':_0x161ed7['include']?_[_0x9b67('0x18')](_0x161ed7[_0x9b67('0x17')],function(_0x226c21){return{'model':db[_0x226c21[_0x9b67('0x1a')]],'as':_0x226c21['as'],'attributes':_0x226c21[_0x9b67('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23e921){logger[_0x9b67('0xa')](_0x9b67('0x1b'),_0x4b972b);logger['debug'](_0x9b67('0x1b'),_0x4b972b,JSON['stringify'](_0x23e921));_0x16ab98(_0x23e921);})[_0x9b67('0x12')](function(_0x3dc052){logger[_0x9b67('0xf')](_0x9b67('0x1b'),_0x3dc052[_0x9b67('0x10')],_0x4b972b);_0xdc94e3(_0x348dcd[_0x9b67('0xf')](0x1f4,_0x3dc052[_0x9b67('0x10')]));});});}; \ No newline at end of file +var _0x637d=['util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','then'];(function(_0x48381d,_0x4ee067){var _0x1431d3=function(_0x492d96){while(--_0x492d96){_0x48381d['push'](_0x48381d['shift']());}};_0x1431d3(++_0x4ee067);}(_0x637d,0x16c));var _0xd637=function(_0x5bff3f,_0x2ca217){_0x5bff3f=_0x5bff3f-0x0;var _0x52113e=_0x637d[_0x5bff3f];return _0x52113e;};'use strict';var _=require('lodash');var util=require(_0xd637('0x0'));var moment=require(_0xd637('0x1'));var BPromise=require('bluebird');var rs=require(_0xd637('0x2'));var fs=require('fs');var Redis=require(_0xd637('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd637('0x4'));var config=require(_0xd637('0x5'));var jayson=require(_0xd637('0x6'));var client=jayson['client'][_0xd637('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54c258,_0x223616,_0x179fde){return new BPromise(function(_0x5e5439,_0xd965d0){return client[_0xd637('0x8')](_0x54c258,_0x179fde)['then'](function(_0x4bf17a){logger['info'](_0xd637('0x9'),_0x223616,_0xd637('0xa'));logger[_0xd637('0xb')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x223616,_0xd637('0xa'),JSON[_0xd637('0xc')](_0x4bf17a));if(_0x4bf17a[_0xd637('0xd')]){if(_0x4bf17a[_0xd637('0xd')]['code']===0x1f4){logger[_0xd637('0xd')](_0xd637('0x9'),_0x223616,_0x4bf17a['error'][_0xd637('0xe')]);return _0xd965d0(_0x4bf17a[_0xd637('0xd')][_0xd637('0xe')]);}logger[_0xd637('0xd')](_0xd637('0x9'),_0x223616,_0x4bf17a[_0xd637('0xd')][_0xd637('0xe')]);return _0x5e5439(_0x4bf17a[_0xd637('0xd')][_0xd637('0xe')]);}else{logger[_0xd637('0xf')](_0xd637('0x9'),_0x223616,_0xd637('0xa'));_0x5e5439(_0x4bf17a[_0xd637('0x10')][_0xd637('0xe')]);}})[_0xd637('0x11')](function(_0x2b438f){logger[_0xd637('0xd')](_0xd637('0x9'),_0x223616,_0x2b438f);_0xd965d0(_0x2b438f);});});}exports[_0xd637('0x12')]=function(_0x3c47d8){var _0x6b4173=this;return new Promise(function(_0x443639,_0x44969a){return db[_0xd637('0x13')][_0xd637('0x14')]({'raw':_0x3c47d8[_0xd637('0x15')]?_0x3c47d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c47d8[_0xd637('0x15')]?_0x3c47d8[_0xd637('0x15')][_0xd637('0x16')]||null:null,'attributes':_0x3c47d8[_0xd637('0x15')]?_0x3c47d8['options'][_0xd637('0x17')]||null:null,'include':_0x3c47d8[_0xd637('0x15')]?_0x3c47d8[_0xd637('0x15')][_0xd637('0x18')]?_[_0xd637('0x19')](_0x3c47d8[_0xd637('0x15')][_0xd637('0x18')],function(_0x417a5f){return{'model':db[_0x417a5f['model']],'as':_0x417a5f['as'],'attributes':_0x417a5f['attributes'],'include':_0x417a5f[_0xd637('0x18')]?_[_0xd637('0x19')](_0x417a5f[_0xd637('0x18')],function(_0x3b90ae){return{'model':db[_0x3b90ae[_0xd637('0x1a')]],'as':_0x3b90ae['as'],'attributes':_0x3b90ae[_0xd637('0x17')],'include':_0x3b90ae[_0xd637('0x18')]?_[_0xd637('0x19')](_0x3b90ae['include'],function(_0x46b6ae){return{'model':db[_0x46b6ae['model']],'as':_0x46b6ae['as'],'attributes':_0x46b6ae[_0xd637('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd637('0x1b')](function(_0x1e0df3){logger[_0xd637('0xf')](_0xd637('0x12'),_0x3c47d8);logger['debug'](_0xd637('0x12'),_0x3c47d8,JSON[_0xd637('0xc')](_0x1e0df3));_0x443639(_0x1e0df3);})[_0xd637('0x11')](function(_0x5b987c){logger[_0xd637('0xd')](_0xd637('0x12'),_0x5b987c[_0xd637('0xe')],_0x3c47d8);_0x44969a(_0x6b4173[_0xd637('0xd')](0x1f4,_0x5b987c[_0xd637('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5459235..3e1703f 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 _0x641b=['isAuthenticated','index','/:id','show','getUsers','post','create','/:id/users','addUsers','update','destroy','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x641b,0xca));var _0xb641=function(_0x1fa4d0,_0x44f765){_0x1fa4d0=_0x1fa4d0-0x0;var _0x226ac1=_0x641b[_0x1fa4d0];return _0x226ac1;};'use strict';var multer=require(_0xb641('0x0'));var util=require('util');var path=require(_0xb641('0x1'));var timeout=require(_0xb641('0x2'));var express=require(_0xb641('0x3'));var router=express[_0xb641('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb641('0x5'));var interaction=require(_0xb641('0x6'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xb641('0x7')]('/',auth[_0xb641('0x8')](),controller[_0xb641('0x9')]);router[_0xb641('0x7')](_0xb641('0xa'),auth[_0xb641('0x8')](),controller[_0xb641('0xb')]);router[_0xb641('0x7')]('/:id/users',auth[_0xb641('0x8')](),controller[_0xb641('0xc')]);router[_0xb641('0xd')]('/',auth[_0xb641('0x8')](),controller[_0xb641('0xe')]);router[_0xb641('0xd')](_0xb641('0xf'),auth[_0xb641('0x8')](),controller[_0xb641('0x10')]);router['put']('/:id',auth[_0xb641('0x8')](),controller[_0xb641('0x11')]);router['delete'](_0xb641('0xa'),auth['isAuthenticated'](),controller[_0xb641('0x12')]);router[_0xb641('0x13')]('/:id/users',auth['isAuthenticated'](),controller['removeUsers']);module[_0xb641('0x14')]=router; \ No newline at end of file +var _0xbe58=['destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','create','put','update','delete'];(function(_0x118439,_0x1907d9){var _0x209b67=function(_0x51e946){while(--_0x51e946){_0x118439['push'](_0x118439['shift']());}};_0x209b67(++_0x1907d9);}(_0xbe58,0x19f));var _0x8be5=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xbe58[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8be5('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8be5('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x8be5('0x2'));var interaction=require(_0x8be5('0x3'));var config=require(_0x8be5('0x4'));var controller=require(_0x8be5('0x5'));router[_0x8be5('0x6')]('/',auth[_0x8be5('0x7')](),controller['index']);router['get'](_0x8be5('0x8'),auth[_0x8be5('0x7')](),controller[_0x8be5('0x9')]);router[_0x8be5('0x6')](_0x8be5('0xa'),auth['isAuthenticated'](),controller[_0x8be5('0xb')]);router[_0x8be5('0xc')]('/',auth[_0x8be5('0x7')](),controller[_0x8be5('0xd')]);router['post']('/:id/users',auth[_0x8be5('0x7')](),controller['addUsers']);router[_0x8be5('0xe')](_0x8be5('0x8'),auth[_0x8be5('0x7')](),controller[_0x8be5('0xf')]);router[_0x8be5('0x10')]('/:id',auth[_0x8be5('0x7')](),controller[_0x8be5('0x11')]);router['delete'](_0x8be5('0xa'),auth[_0x8be5('0x7')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f2e3022..f352691 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 _0xe14a=['utf8','long','production','DATE','TEXT','BLOB','getDataValue','preproduction','toString'];(function(_0x1648f8,_0x1f6ff9){var _0x18c387=function(_0x47194b){while(--_0x47194b){_0x1648f8['push'](_0x1648f8['shift']());}};_0x18c387(++_0x1f6ff9);}(_0xe14a,0x94));var _0xae14=function(_0x59c616,_0x940245){_0x59c616=_0x59c616-0x0;var _0xcf2313=_0xe14a[_0x59c616];return _0xcf2313;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xae14('0x0')]},'preproduction':{'type':Sequelize[_0xae14('0x1')]('long'),'get':function(){if(this[_0xae14('0x2')](_0xae14('0x3'))){return this[_0xae14('0x2')](_0xae14('0x3'))[_0xae14('0x4')](_0xae14('0x5'));}}},'production':{'type':Sequelize[_0xae14('0x1')](_0xae14('0x6')),'get':function(){if(this[_0xae14('0x2')](_0xae14('0x7'))){return this[_0xae14('0x2')](_0xae14('0x7'))[_0xae14('0x4')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xae14('0x8')]}}; \ No newline at end of file +var _0xe683=['toString','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x47ad2b,_0x17b0e7){var _0x274d62=function(_0xdc1360){while(--_0xdc1360){_0x47ad2b['push'](_0x47ad2b['shift']());}};_0x274d62(++_0x17b0e7);}(_0xe683,0x1d7));var _0x3e68=function(_0x14f636,_0x1aefa4){_0x14f636=_0x14f636-0x0;var _0x2b906f=_0xe683[_0x14f636];return _0x2b906f;};'use strict';var Sequelize=require(_0x3e68('0x0'));module[_0x3e68('0x1')]={'name':{'type':Sequelize[_0x3e68('0x2')],'unique':_0x3e68('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3e68('0x2')]},'notes':{'type':Sequelize[_0x3e68('0x4')]},'preproduction':{'type':Sequelize[_0x3e68('0x5')](_0x3e68('0x6')),'get':function(){if(this[_0x3e68('0x7')]('preproduction')){return this['getDataValue'](_0x3e68('0x8'))[_0x3e68('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x3e68('0x5')](_0x3e68('0x6')),'get':function(){if(this['getDataValue']('production')){return this[_0x3e68('0x7')](_0x3e68('0xa'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x3e68('0xb')]},'publishedAt':{'type':Sequelize[_0x3e68('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e585e64..9cf011a 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 _0x4991=['userSquareProject:remove','findOne','User','getUsers','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','then','destroy','SquareProjects','UserProfileResource','publish','agi','stringify','error','name','send','index','map','SquareProject','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','intersection','options','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','production','addUsers','ids','omit','removeUsers','isArray','emit'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x4991,0xf7));var _0x1499=function(_0x6f461f,_0x1c023c){_0x6f461f=_0x6f461f-0x0;var _0x2ffbef=_0x4991[_0x6f461f];return _0x2ffbef;};'use strict';var _=require(_0x1499('0x0'));var Redis=require('ioredis');var qs=require(_0x1499('0x1'));var logger=require('../../config/logger')(_0x1499('0x2'));var config=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];config[_0x1499('0x5')]=_[_0x1499('0x6')](config[_0x1499('0x5')],{'host':_0x1499('0x7'),'port':0x18eb});var socket=require(_0x1499('0x8'))(new Redis(config['redis']));require(_0x1499('0x9'))[_0x1499('0xa')](socket);function respondWithStatusCode(_0x1c65c3,_0x33b261){_0x33b261=_0x33b261||0xcc;return function(_0x133bae){if(_0x133bae){return _0x1c65c3[_0x1499('0xb')](_0x33b261);}return _0x1c65c3[_0x1499('0xc')](_0x33b261)[_0x1499('0xd')]();};}function respondWithResult(_0x48d2ca,_0x16e8ad){_0x16e8ad=_0x16e8ad||0xc8;return function(_0x36a053){if(_0x36a053){return _0x48d2ca['status'](_0x16e8ad)[_0x1499('0xe')](_0x36a053);}};}function respondWithFilteredResult(_0x352180,_0x4c2bd2){return function(_0x4407c2){if(_0x4407c2){var _0x2867b1=typeof _0x4c2bd2['offset']==='undefined'&&typeof _0x4c2bd2['limit']===_0x1499('0xf');var _0x274bc1=_0x4407c2[_0x1499('0x10')];var _0x334d7e=_0x2867b1?0x0:_0x4c2bd2[_0x1499('0x11')];var _0x57a0a2=_0x2867b1?_0x4407c2['count']:_0x4c2bd2[_0x1499('0x11')]+_0x4c2bd2['limit'];var _0x37d99e;if(_0x57a0a2>=_0x274bc1){_0x57a0a2=_0x274bc1;_0x37d99e=0xc8;}else{_0x37d99e=0xce;}_0x352180[_0x1499('0xc')](_0x37d99e);return _0x352180[_0x1499('0x12')](_0x1499('0x13'),_0x334d7e+'-'+_0x57a0a2+'/'+_0x274bc1)['json'](_0x4407c2);}return null;};}function saveUpdates(_0x1ed43b){return function(_0x373f57){if(_0x373f57){return _0x373f57['update'](_0x1ed43b)[_0x1499('0x14')](function(_0x2d405f){return _0x2d405f;});}return null;};}function removeEntity(_0x46b364){return function(_0xc92272){if(_0xc92272){return _0xc92272[_0x1499('0x15')]()[_0x1499('0x14')](function(){var _0x5b9859=_0xc92272['get']({'plain':!![]});var _0x5bcb5f=_0x1499('0x16');return db[_0x1499('0x17')]['destroy']({'where':{'type':_0x5bcb5f,'resourceId':_0x5b9859['id']}})[_0x1499('0x14')](function(){return _0xc92272;});})[_0x1499('0x14')](function(){var _0x28dff3=new Redis(config[_0x1499('0x5')]);_0x28dff3[_0x1499('0x18')](_0x1499('0x19'),JSON[_0x1499('0x1a')]({'id':_0xc92272['id'],'deleted':!![]}));})[_0x1499('0x14')](function(){_0x46b364[_0x1499('0xc')](0xcc)[_0x1499('0xd')]();});}};}function handleEntityNotFound(_0x2bb71f){return function(_0x836081){if(!_0x836081){_0x2bb71f[_0x1499('0xb')](0x194);}return _0x836081;};}function handleError(_0x3b73f6,_0x4ec57a){_0x4ec57a=_0x4ec57a||0x1f4;return function(_0x1e2c51){logger[_0x1499('0x1b')](_0x1e2c51['stack']);if(_0x1e2c51[_0x1499('0x1c')]){delete _0x1e2c51[_0x1499('0x1c')];}_0x3b73f6[_0x1499('0xc')](_0x4ec57a)[_0x1499('0x1d')](_0x1e2c51);};}exports[_0x1499('0x1e')]=function(_0x16d036,_0x54f3c2){var _0x501c0d={},_0x12739b={},_0x3c9aca={'count':0x0,'rows':[]};var _0x3b9259=_[_0x1499('0x1f')](db[_0x1499('0x20')]['rawAttributes'],function(_0x3e5ed1){return{'name':_0x3e5ed1['fieldName'],'type':_0x3e5ed1['type']['key']};});_0x12739b[_0x1499('0x21')]=_[_0x1499('0x1f')](_0x3b9259,_0x1499('0x1c'));_0x12739b[_0x1499('0x22')]=_[_0x1499('0x23')](_0x16d036[_0x1499('0x22')]);_0x12739b[_0x1499('0x24')]=_['intersection'](_0x12739b[_0x1499('0x21')],_0x12739b[_0x1499('0x22')]);_0x501c0d[_0x1499('0x25')]=_['intersection'](_0x12739b[_0x1499('0x21')],qs[_0x1499('0x26')](_0x16d036['query'][_0x1499('0x26')]));_0x501c0d[_0x1499('0x25')]=_0x501c0d['attributes'][_0x1499('0x27')]?_0x501c0d[_0x1499('0x25')]:_0x12739b[_0x1499('0x21')];if(!_0x16d036[_0x1499('0x22')][_0x1499('0x28')](_0x1499('0x29'))){_0x501c0d[_0x1499('0x2a')]=qs[_0x1499('0x2a')](_0x16d036[_0x1499('0x22')][_0x1499('0x2a')]);_0x501c0d[_0x1499('0x11')]=qs[_0x1499('0x11')](_0x16d036[_0x1499('0x22')][_0x1499('0x11')]);}_0x501c0d[_0x1499('0x2b')]=qs[_0x1499('0x2c')](_0x16d036[_0x1499('0x22')][_0x1499('0x2c')]);_0x501c0d[_0x1499('0x2d')]=qs[_0x1499('0x24')](_['pick'](_0x16d036[_0x1499('0x22')],_0x12739b[_0x1499('0x24')]),_0x3b9259);if(_0x16d036[_0x1499('0x22')][_0x1499('0x2e')]){_0x501c0d[_0x1499('0x2d')]=_[_0x1499('0x2f')](_0x501c0d[_0x1499('0x2d')],{'$or':_[_0x1499('0x1f')](_0x3b9259,function(_0x12cf93){if(_0x12cf93[_0x1499('0x30')]!==_0x1499('0x31')){var _0x4e3ca2={};_0x4e3ca2[_0x12cf93['name']]={'$like':'%'+_0x16d036[_0x1499('0x22')]['filter']+'%'};return _0x4e3ca2;}})});}_0x501c0d=_[_0x1499('0x2f')]({},_0x501c0d,_0x16d036['options']);var _0x30dc0c={'where':_0x501c0d[_0x1499('0x2d')]};return db[_0x1499('0x20')][_0x1499('0x10')](_0x30dc0c)['then'](function(_0x2b6eeb){_0x3c9aca['count']=_0x2b6eeb;if(_0x16d036[_0x1499('0x22')][_0x1499('0x32')]){_0x501c0d[_0x1499('0x33')]=[{'all':!![]}];}return db[_0x1499('0x20')]['findAll'](_0x501c0d);})[_0x1499('0x14')](function(_0x815a99){_0x3c9aca[_0x1499('0x34')]=_0x815a99;return _0x3c9aca;})[_0x1499('0x14')](respondWithFilteredResult(_0x54f3c2,_0x501c0d))['catch'](handleError(_0x54f3c2,null));};exports[_0x1499('0x35')]=function(_0x4cc411,_0x3770b5){var _0x38f449={'raw':![],'where':{'id':_0x4cc411[_0x1499('0x36')]['id']}},_0x2a2441={};_0x2a2441[_0x1499('0x21')]=_[_0x1499('0x23')](db[_0x1499('0x20')][_0x1499('0x37')]);_0x2a2441[_0x1499('0x22')]=_[_0x1499('0x23')](_0x4cc411['query']);_0x2a2441[_0x1499('0x24')]=_['intersection'](_0x2a2441[_0x1499('0x21')],_0x2a2441[_0x1499('0x22')]);_0x38f449['attributes']=_[_0x1499('0x38')](_0x2a2441[_0x1499('0x21')],qs[_0x1499('0x26')](_0x4cc411[_0x1499('0x22')][_0x1499('0x26')]));_0x38f449['attributes']=_0x38f449['attributes'][_0x1499('0x27')]?_0x38f449[_0x1499('0x25')]:_0x2a2441['model'];if(_0x4cc411[_0x1499('0x22')][_0x1499('0x32')]){_0x38f449['include']=[{'all':!![]}];}_0x38f449=_['merge']({},_0x38f449,_0x4cc411[_0x1499('0x39')]);return db[_0x1499('0x20')][_0x1499('0x3a')](_0x38f449)['then'](handleEntityNotFound(_0x3770b5,null))[_0x1499('0x14')](respondWithResult(_0x3770b5,null))[_0x1499('0x3b')](handleError(_0x3770b5,null));};exports[_0x1499('0x3c')]=function(_0x360394,_0x5a364a){return db[_0x1499('0x20')][_0x1499('0x3c')](_0x360394[_0x1499('0x3d')],{})[_0x1499('0x14')](function(_0x49cce1){var _0x2e425c=_0x360394[_0x1499('0x3e')][_0x1499('0x3f')]({'plain':!![]});if(!_0x2e425c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e425c['role']===_0x1499('0x3e')){var _0x491777=_0x49cce1[_0x1499('0x3f')]({'plain':!![]});var _0x34f35c=_0x1499('0x16');return db[_0x1499('0x40')][_0x1499('0x3a')]({'where':{'name':_0x34f35c,'userProfileId':_0x2e425c[_0x1499('0x41')]},'raw':!![]})[_0x1499('0x14')](function(_0x591aa8){if(_0x591aa8&&_0x591aa8[_0x1499('0x42')]===0x0){return db['UserProfileResource'][_0x1499('0x3c')]({'name':_0x491777[_0x1499('0x1c')],'resourceId':_0x491777['id'],'type':_0x591aa8['name'],'sectionId':_0x591aa8['id']},{})[_0x1499('0x14')](function(){return _0x49cce1;});}else{return _0x49cce1;}})[_0x1499('0x3b')](function(_0x3de674){logger['error'](_0x1499('0x43'),_0x3de674);throw _0x3de674;});}return _0x49cce1;})[_0x1499('0x14')](respondWithResult(_0x5a364a,0xc9))[_0x1499('0x3b')](handleError(_0x5a364a,null));};exports[_0x1499('0x44')]=function(_0x305599,_0x11aafe){if(_0x305599[_0x1499('0x3d')]['id']){delete _0x305599[_0x1499('0x3d')]['id'];}return db[_0x1499('0x20')][_0x1499('0x3a')]({'where':{'id':_0x305599['params']['id']}})[_0x1499('0x14')](handleEntityNotFound(_0x11aafe,null))[_0x1499('0x14')](saveUpdates(_0x305599[_0x1499('0x3d')],null))['then'](function(_0x339471){if(!_0x339471)return;var _0x2a7614=_0x339471['get']({'plain':!![]});return _0x2a7614;})[_0x1499('0x14')](function(_0x162ddb){var _0x54134d=new Redis(config[_0x1499('0x5')]);_0x54134d[_0x1499('0x18')](_0x1499('0x19'),JSON[_0x1499('0x1a')](_[_0x1499('0x45')](_0x162ddb,['id',_0x1499('0x1c'),_0x1499('0x46')])));return _0x162ddb;})['then'](respondWithResult(_0x11aafe,null))[_0x1499('0x3b')](handleError(_0x11aafe,null));};exports[_0x1499('0x15')]=function(_0xf2e353,_0x175b8d){return db['SquareProject']['find']({'where':{'id':_0xf2e353[_0x1499('0x36')]['id']}})[_0x1499('0x14')](handleEntityNotFound(_0x175b8d,null))['then'](removeEntity(_0x175b8d,null))[_0x1499('0x3b')](handleError(_0x175b8d,null));};exports[_0x1499('0x47')]=function(_0xf09b4c,_0x55b6ed){return db['SquareProject']['find']({'where':{'id':_0xf09b4c[_0x1499('0x36')]['id']}})[_0x1499('0x14')](handleEntityNotFound(_0x55b6ed,null))[_0x1499('0x14')](function(_0x51af9e){if(_0x51af9e){return _0x51af9e[_0x1499('0x47')](_0xf09b4c['body'][_0x1499('0x48')],_[_0x1499('0x49')](_0xf09b4c[_0x1499('0x3d')],[_0x1499('0x48'),'id'])||{});}})['then'](respondWithResult(_0x55b6ed,null))['catch'](handleError(_0x55b6ed,null));};exports['removeUsers']=function(_0x403832,_0x42629d){return db[_0x1499('0x20')][_0x1499('0x3a')]({'where':{'id':_0x403832['params']['id']}})[_0x1499('0x14')](handleEntityNotFound(_0x42629d,null))[_0x1499('0x14')](function(_0x517f15){if(_0x517f15){return _0x517f15[_0x1499('0x4a')](_0x403832['query'][_0x1499('0x48')])[_0x1499('0x14')](function(){if(_[_0x1499('0x4b')](_0x403832['query'][_0x1499('0x48')])){for(var _0xca5326=0x0;_0xca5326<_0x403832[_0x1499('0x22')]['ids'][_0x1499('0x27')];_0xca5326+=0x1){socket[_0x1499('0x4c')](_0x1499('0x4d'),{'UserId':Number(_0x403832['query'][_0x1499('0x48')][_0xca5326]),'SquareProjectId':Number(_0x403832[_0x1499('0x36')]['id'])});}}else{socket[_0x1499('0x4c')](_0x1499('0x4d'),{'UserId':Number(_0x403832[_0x1499('0x22')][_0x1499('0x48')]),'SquareProjectId':Number(_0x403832['params']['id'])});}});}})[_0x1499('0x14')](respondWithStatusCode(_0x42629d,null))[_0x1499('0x3b')](handleError(_0x42629d,null));};exports['getUsers']=function(_0x3839da,_0x258555){var _0x26cc61={};var _0x1eba4e={};var _0x46b626;var _0x34436f;return db['SquareProject'][_0x1499('0x4e')]({'where':{'id':_0x3839da[_0x1499('0x36')]['id']}})[_0x1499('0x14')](handleEntityNotFound(_0x258555,null))['then'](function(_0x1ff29d){if(_0x1ff29d){_0x46b626=_0x1ff29d;_0x1eba4e[_0x1499('0x21')]=_['keys'](db[_0x1499('0x4f')][_0x1499('0x37')]);_0x1eba4e[_0x1499('0x22')]=_[_0x1499('0x23')](_0x3839da[_0x1499('0x22')]);_0x1eba4e['filters']=_['intersection'](_0x1eba4e[_0x1499('0x21')],_0x1eba4e['query']);_0x26cc61['attributes']=_[_0x1499('0x38')](_0x1eba4e[_0x1499('0x21')],qs['fields'](_0x3839da[_0x1499('0x22')][_0x1499('0x26')]));_0x26cc61[_0x1499('0x25')]=_0x26cc61['attributes']['length']?_0x26cc61[_0x1499('0x25')]:_0x1eba4e[_0x1499('0x21')];_0x26cc61[_0x1499('0x2b')]=qs[_0x1499('0x2c')](_0x3839da[_0x1499('0x22')]['sort']);_0x26cc61[_0x1499('0x2d')]=qs[_0x1499('0x24')](_['pick'](_0x3839da[_0x1499('0x22')],_0x1eba4e[_0x1499('0x24')]));if(_0x3839da[_0x1499('0x22')]['filter']){_0x26cc61[_0x1499('0x2d')]=_[_0x1499('0x2f')](_0x26cc61[_0x1499('0x2d')],{'$or':_[_0x1499('0x1f')](_0x26cc61['attributes'],function(_0x325614){var _0x74e09b={};_0x74e09b[_0x325614]={'$like':'%'+_0x3839da[_0x1499('0x22')]['filter']+'%'};return _0x74e09b;})});}_0x26cc61=_[_0x1499('0x2f')]({},_0x26cc61,_0x3839da[_0x1499('0x39')]);return _0x46b626[_0x1499('0x50')](_0x26cc61);}})[_0x1499('0x14')](function(_0x199516){if(_0x199516){_0x34436f=_0x199516[_0x1499('0x27')];if(!_0x3839da['query'][_0x1499('0x28')]('nolimit')){_0x26cc61['limit']=qs[_0x1499('0x2a')](_0x3839da[_0x1499('0x22')][_0x1499('0x2a')]);_0x26cc61['offset']=qs['offset'](_0x3839da[_0x1499('0x22')][_0x1499('0x11')]);}return _0x46b626['getUsers'](_0x26cc61);}})[_0x1499('0x14')](function(_0x254fc7){if(_0x254fc7){return _0x254fc7?{'count':_0x34436f,'rows':_0x254fc7}:null;}})[_0x1499('0x14')](respondWithResult(_0x258555,null))[_0x1499('0x3b')](handleError(_0x258555,null));}; \ No newline at end of file +var _0x1a85=['name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','pick','production','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','order','getUsers','../../components/parsers/qs','../../config/logger','api','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','end','stack'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x1a85,0x178));var _0x51a8=function(_0x4febcd,_0x141f0c){_0x4febcd=_0x4febcd-0x0;var _0x253421=_0x1a85[_0x4febcd];return _0x253421;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x51a8('0x0'));var logger=require(_0x51a8('0x1'))(_0x51a8('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x51a8('0x3')]=_[_0x51a8('0x4')](config[_0x51a8('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0x5'))(new Redis(config['redis']));require(_0x51a8('0x6'))['register'](socket);function respondWithStatusCode(_0x331117,_0x16a21e){_0x16a21e=_0x16a21e||0xcc;return function(_0x4f3919){if(_0x4f3919){return _0x331117[_0x51a8('0x7')](_0x16a21e);}return _0x331117['status'](_0x16a21e)['end']();};}function respondWithResult(_0x39e06a,_0x2f276b){_0x2f276b=_0x2f276b||0xc8;return function(_0x1a476d){if(_0x1a476d){return _0x39e06a[_0x51a8('0x8')](_0x2f276b)[_0x51a8('0x9')](_0x1a476d);}};}function respondWithFilteredResult(_0x421fa4,_0x3f93c7){return function(_0x273a3f){if(_0x273a3f){var _0x34c887=typeof _0x3f93c7[_0x51a8('0xa')]===_0x51a8('0xb')&&typeof _0x3f93c7[_0x51a8('0xc')]===_0x51a8('0xb');var _0x1827e6=_0x273a3f[_0x51a8('0xd')];var _0x2e1629=_0x34c887?0x0:_0x3f93c7[_0x51a8('0xa')];var _0x47b988=_0x34c887?_0x273a3f[_0x51a8('0xd')]:_0x3f93c7[_0x51a8('0xa')]+_0x3f93c7[_0x51a8('0xc')];var _0x50d992;if(_0x47b988>=_0x1827e6){_0x47b988=_0x1827e6;_0x50d992=0xc8;}else{_0x50d992=0xce;}_0x421fa4[_0x51a8('0x8')](_0x50d992);return _0x421fa4['set'](_0x51a8('0xe'),_0x2e1629+'-'+_0x47b988+'/'+_0x1827e6)[_0x51a8('0x9')](_0x273a3f);}return null;};}function saveUpdates(_0x39cd45){return function(_0x2b0521){if(_0x2b0521){return _0x2b0521[_0x51a8('0xf')](_0x39cd45)[_0x51a8('0x10')](function(_0x1f49ee){return _0x1f49ee;});}return null;};}function removeEntity(_0x516abc){return function(_0x1c2f25){if(_0x1c2f25){return _0x1c2f25[_0x51a8('0x11')]()[_0x51a8('0x10')](function(){var _0x23539e=_0x1c2f25[_0x51a8('0x12')]({'plain':!![]});var _0x544886='SquareProjects';return db[_0x51a8('0x13')][_0x51a8('0x11')]({'where':{'type':_0x544886,'resourceId':_0x23539e['id']}})[_0x51a8('0x10')](function(){return _0x1c2f25;});})[_0x51a8('0x10')](function(){var _0x2a4c4c=new Redis(config[_0x51a8('0x3')]);_0x2a4c4c[_0x51a8('0x14')](_0x51a8('0x15'),JSON['stringify']({'id':_0x1c2f25['id'],'deleted':!![]}));})[_0x51a8('0x10')](function(){_0x516abc['status'](0xcc)[_0x51a8('0x16')]();});}};}function handleEntityNotFound(_0x12c029){return function(_0x8bda40){if(!_0x8bda40){_0x12c029[_0x51a8('0x7')](0x194);}return _0x8bda40;};}function handleError(_0x51f737,_0xae3588){_0xae3588=_0xae3588||0x1f4;return function(_0x4b9cdd){logger['error'](_0x4b9cdd[_0x51a8('0x17')]);if(_0x4b9cdd['name']){delete _0x4b9cdd[_0x51a8('0x18')];}_0x51f737[_0x51a8('0x8')](_0xae3588)[_0x51a8('0x19')](_0x4b9cdd);};}exports[_0x51a8('0x1a')]=function(_0x157554,_0x2f2f05){var _0x291ed6={},_0x1326a2={},_0x5b3f49={'count':0x0,'rows':[]};var _0x273ce2=_[_0x51a8('0x1b')](db[_0x51a8('0x1c')][_0x51a8('0x1d')],function(_0x1c150d){return{'name':_0x1c150d[_0x51a8('0x1e')],'type':_0x1c150d[_0x51a8('0x1f')][_0x51a8('0x20')]};});_0x1326a2[_0x51a8('0x21')]=_[_0x51a8('0x1b')](_0x273ce2,_0x51a8('0x18'));_0x1326a2[_0x51a8('0x22')]=_['keys'](_0x157554[_0x51a8('0x22')]);_0x1326a2['filters']=_[_0x51a8('0x23')](_0x1326a2[_0x51a8('0x21')],_0x1326a2[_0x51a8('0x22')]);_0x291ed6[_0x51a8('0x24')]=_[_0x51a8('0x23')](_0x1326a2['model'],qs[_0x51a8('0x25')](_0x157554['query'][_0x51a8('0x25')]));_0x291ed6[_0x51a8('0x24')]=_0x291ed6[_0x51a8('0x24')]['length']?_0x291ed6[_0x51a8('0x24')]:_0x1326a2['model'];if(!_0x157554[_0x51a8('0x22')][_0x51a8('0x26')](_0x51a8('0x27'))){_0x291ed6[_0x51a8('0xc')]=qs[_0x51a8('0xc')](_0x157554['query'][_0x51a8('0xc')]);_0x291ed6['offset']=qs[_0x51a8('0xa')](_0x157554[_0x51a8('0x22')][_0x51a8('0xa')]);}_0x291ed6['order']=qs[_0x51a8('0x28')](_0x157554[_0x51a8('0x22')][_0x51a8('0x28')]);_0x291ed6[_0x51a8('0x29')]=qs[_0x51a8('0x2a')](_['pick'](_0x157554['query'],_0x1326a2['filters']),_0x273ce2);if(_0x157554[_0x51a8('0x22')][_0x51a8('0x2b')]){_0x291ed6['where']=_[_0x51a8('0x2c')](_0x291ed6['where'],{'$or':_[_0x51a8('0x1b')](_0x273ce2,function(_0x38aa25){if(_0x38aa25[_0x51a8('0x1f')]!==_0x51a8('0x2d')){var _0x256cda={};_0x256cda[_0x38aa25[_0x51a8('0x18')]]={'$like':'%'+_0x157554['query']['filter']+'%'};return _0x256cda;}})});}_0x291ed6=_[_0x51a8('0x2c')]({},_0x291ed6,_0x157554['options']);var _0x5d7214={'where':_0x291ed6['where']};return db[_0x51a8('0x1c')][_0x51a8('0xd')](_0x5d7214)[_0x51a8('0x10')](function(_0x5956b8){_0x5b3f49[_0x51a8('0xd')]=_0x5956b8;if(_0x157554[_0x51a8('0x22')][_0x51a8('0x2e')]){_0x291ed6[_0x51a8('0x2f')]=[{'all':!![]}];}return db['SquareProject'][_0x51a8('0x30')](_0x291ed6);})[_0x51a8('0x10')](function(_0x1b0333){_0x5b3f49['rows']=_0x1b0333;return _0x5b3f49;})[_0x51a8('0x10')](respondWithFilteredResult(_0x2f2f05,_0x291ed6))['catch'](handleError(_0x2f2f05,null));};exports[_0x51a8('0x31')]=function(_0x1e637a,_0x2a98bd){var _0x37d50b={'raw':![],'where':{'id':_0x1e637a[_0x51a8('0x32')]['id']}},_0x5c44a9={};_0x5c44a9[_0x51a8('0x21')]=_[_0x51a8('0x33')](db[_0x51a8('0x1c')][_0x51a8('0x1d')]);_0x5c44a9[_0x51a8('0x22')]=_[_0x51a8('0x33')](_0x1e637a[_0x51a8('0x22')]);_0x5c44a9[_0x51a8('0x2a')]=_['intersection'](_0x5c44a9[_0x51a8('0x21')],_0x5c44a9[_0x51a8('0x22')]);_0x37d50b['attributes']=_['intersection'](_0x5c44a9[_0x51a8('0x21')],qs[_0x51a8('0x25')](_0x1e637a[_0x51a8('0x22')][_0x51a8('0x25')]));_0x37d50b[_0x51a8('0x24')]=_0x37d50b[_0x51a8('0x24')][_0x51a8('0x34')]?_0x37d50b[_0x51a8('0x24')]:_0x5c44a9[_0x51a8('0x21')];if(_0x1e637a[_0x51a8('0x22')]['includeAll']){_0x37d50b[_0x51a8('0x2f')]=[{'all':!![]}];}_0x37d50b=_[_0x51a8('0x2c')]({},_0x37d50b,_0x1e637a[_0x51a8('0x35')]);return db[_0x51a8('0x1c')][_0x51a8('0x36')](_0x37d50b)[_0x51a8('0x10')](handleEntityNotFound(_0x2a98bd,null))['then'](respondWithResult(_0x2a98bd,null))[_0x51a8('0x37')](handleError(_0x2a98bd,null));};exports['create']=function(_0xa215ab,_0x3a33f3){return db[_0x51a8('0x1c')][_0x51a8('0x38')](_0xa215ab[_0x51a8('0x39')],{})['then'](function(_0x513586){var _0x4653e3=_0xa215ab[_0x51a8('0x3a')][_0x51a8('0x12')]({'plain':!![]});if(!_0x4653e3)throw new Error(_0x51a8('0x3b'));if(_0x4653e3[_0x51a8('0x3c')]==='user'){var _0x504a43=_0x513586[_0x51a8('0x12')]({'plain':!![]});var _0x108131=_0x51a8('0x3d');return db[_0x51a8('0x3e')][_0x51a8('0x36')]({'where':{'name':_0x108131,'userProfileId':_0x4653e3[_0x51a8('0x3f')]},'raw':!![]})[_0x51a8('0x10')](function(_0x1103a3){if(_0x1103a3&&_0x1103a3[_0x51a8('0x40')]===0x0){return db['UserProfileResource']['create']({'name':_0x504a43['name'],'resourceId':_0x504a43['id'],'type':_0x1103a3[_0x51a8('0x18')],'sectionId':_0x1103a3['id']},{})[_0x51a8('0x10')](function(){return _0x513586;});}else{return _0x513586;}})[_0x51a8('0x37')](function(_0x5259f3){logger[_0x51a8('0x41')](_0x51a8('0x42'),_0x5259f3);throw _0x5259f3;});}return _0x513586;})['then'](respondWithResult(_0x3a33f3,0xc9))[_0x51a8('0x37')](handleError(_0x3a33f3,null));};exports['update']=function(_0x50a2f8,_0xbf828b){if(_0x50a2f8[_0x51a8('0x39')]['id']){delete _0x50a2f8[_0x51a8('0x39')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x50a2f8[_0x51a8('0x32')]['id']}})['then'](handleEntityNotFound(_0xbf828b,null))[_0x51a8('0x10')](saveUpdates(_0x50a2f8[_0x51a8('0x39')],null))[_0x51a8('0x10')](function(_0x1ace5b){if(!_0x1ace5b)return;var _0xee9bee=_0x1ace5b[_0x51a8('0x12')]({'plain':!![]});return _0xee9bee;})[_0x51a8('0x10')](function(_0x406a87){var _0x29d31e=new Redis(config['redis']);_0x29d31e[_0x51a8('0x14')](_0x51a8('0x15'),JSON[_0x51a8('0x43')](_[_0x51a8('0x44')](_0x406a87,['id','name',_0x51a8('0x45')])));return _0x406a87;})['then'](respondWithResult(_0xbf828b,null))[_0x51a8('0x37')](handleError(_0xbf828b,null));};exports[_0x51a8('0x11')]=function(_0x5c66e8,_0x56dd7a){return db[_0x51a8('0x1c')][_0x51a8('0x36')]({'where':{'id':_0x5c66e8[_0x51a8('0x32')]['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x56dd7a,null))[_0x51a8('0x10')](removeEntity(_0x56dd7a,null))['catch'](handleError(_0x56dd7a,null));};exports[_0x51a8('0x46')]=function(_0xd1ddd5,_0x7a9dc){return db[_0x51a8('0x1c')][_0x51a8('0x36')]({'where':{'id':_0xd1ddd5['params']['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x7a9dc,null))[_0x51a8('0x10')](function(_0x3656ac){if(_0x3656ac){return _0x3656ac[_0x51a8('0x46')](_0xd1ddd5[_0x51a8('0x39')][_0x51a8('0x47')],_['omit'](_0xd1ddd5['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x7a9dc,null))[_0x51a8('0x37')](handleError(_0x7a9dc,null));};exports[_0x51a8('0x48')]=function(_0x51f9f7,_0x7ac0ae){return db['SquareProject'][_0x51a8('0x36')]({'where':{'id':_0x51f9f7['params']['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x7ac0ae,null))[_0x51a8('0x10')](function(_0x53ed73){if(_0x53ed73){return _0x53ed73['removeUsers'](_0x51f9f7['query'][_0x51a8('0x47')])[_0x51a8('0x10')](function(){if(_[_0x51a8('0x49')](_0x51f9f7[_0x51a8('0x22')][_0x51a8('0x47')])){for(var _0x21c8e0=0x0;_0x21c8e0<_0x51f9f7[_0x51a8('0x22')][_0x51a8('0x47')]['length'];_0x21c8e0+=0x1){socket[_0x51a8('0x4a')](_0x51a8('0x4b'),{'UserId':Number(_0x51f9f7['query'][_0x51a8('0x47')][_0x21c8e0]),'SquareProjectId':Number(_0x51f9f7[_0x51a8('0x32')]['id'])});}}else{socket[_0x51a8('0x4a')](_0x51a8('0x4b'),{'UserId':Number(_0x51f9f7[_0x51a8('0x22')][_0x51a8('0x47')]),'SquareProjectId':Number(_0x51f9f7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x7ac0ae,null))[_0x51a8('0x37')](handleError(_0x7ac0ae,null));};exports['getUsers']=function(_0x4ca01a,_0x50a6ad){var _0x4ec2ee={};var _0x483a5a={};var _0x426aec;var _0x529b2f;return db[_0x51a8('0x1c')][_0x51a8('0x4c')]({'where':{'id':_0x4ca01a[_0x51a8('0x32')]['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x50a6ad,null))[_0x51a8('0x10')](function(_0x2d8b9b){if(_0x2d8b9b){_0x426aec=_0x2d8b9b;_0x483a5a[_0x51a8('0x21')]=_[_0x51a8('0x33')](db[_0x51a8('0x4d')][_0x51a8('0x1d')]);_0x483a5a['query']=_[_0x51a8('0x33')](_0x4ca01a[_0x51a8('0x22')]);_0x483a5a[_0x51a8('0x2a')]=_['intersection'](_0x483a5a['model'],_0x483a5a['query']);_0x4ec2ee[_0x51a8('0x24')]=_[_0x51a8('0x23')](_0x483a5a[_0x51a8('0x21')],qs[_0x51a8('0x25')](_0x4ca01a[_0x51a8('0x22')][_0x51a8('0x25')]));_0x4ec2ee[_0x51a8('0x24')]=_0x4ec2ee[_0x51a8('0x24')][_0x51a8('0x34')]?_0x4ec2ee[_0x51a8('0x24')]:_0x483a5a[_0x51a8('0x21')];_0x4ec2ee[_0x51a8('0x4e')]=qs[_0x51a8('0x28')](_0x4ca01a['query'][_0x51a8('0x28')]);_0x4ec2ee[_0x51a8('0x29')]=qs['filters'](_[_0x51a8('0x44')](_0x4ca01a['query'],_0x483a5a['filters']));if(_0x4ca01a['query'][_0x51a8('0x2b')]){_0x4ec2ee[_0x51a8('0x29')]=_[_0x51a8('0x2c')](_0x4ec2ee[_0x51a8('0x29')],{'$or':_[_0x51a8('0x1b')](_0x4ec2ee[_0x51a8('0x24')],function(_0x8fe514){var _0x5a37c1={};_0x5a37c1[_0x8fe514]={'$like':'%'+_0x4ca01a['query']['filter']+'%'};return _0x5a37c1;})});}_0x4ec2ee=_[_0x51a8('0x2c')]({},_0x4ec2ee,_0x4ca01a[_0x51a8('0x35')]);return _0x426aec[_0x51a8('0x4f')](_0x4ec2ee);}})[_0x51a8('0x10')](function(_0x32a40b){if(_0x32a40b){_0x529b2f=_0x32a40b[_0x51a8('0x34')];if(!_0x4ca01a['query'][_0x51a8('0x26')]('nolimit')){_0x4ec2ee[_0x51a8('0xc')]=qs[_0x51a8('0xc')](_0x4ca01a[_0x51a8('0x22')][_0x51a8('0xc')]);_0x4ec2ee[_0x51a8('0xa')]=qs[_0x51a8('0xa')](_0x4ca01a[_0x51a8('0x22')][_0x51a8('0xa')]);}return _0x426aec[_0x51a8('0x4f')](_0x4ec2ee);}})[_0x51a8('0x10')](function(_0x2289d9){if(_0x2289d9){return _0x2289d9?{'count':_0x529b2f,'rows':_0x2289d9}:null;}})['then'](respondWithResult(_0x50a6ad,null))['catch'](handleError(_0x50a6ad,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ba4c446..5c86b38 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 _0xb375=['SquareProject','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5407ec,_0x4f7c88){var _0x3f3bb5=function(_0x3eae88){while(--_0x3eae88){_0x5407ec['push'](_0x5407ec['shift']());}};_0x3f3bb5(++_0x4f7c88);}(_0xb375,0xe0));var _0x5b37=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb375[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x5b37('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5b37('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b37('0x2'),'afterDestroy':_0x5b37('0x3')};function emitEvent(_0x580924){return function(_0x43cd02,_0xfff898,_0x1cf764){SquareProjectEvents[_0x5b37('0x4')](_0x580924+':'+_0x43cd02['id'],_0x43cd02);SquareProjectEvents[_0x5b37('0x4')](_0x580924,_0x43cd02);_0x1cf764(null);};}for(var e in events){if(events[_0x5b37('0x5')](e)){var event=events[e];SquareProject[_0x5b37('0x6')](e,emitEvent(event));}}module[_0x5b37('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x1113=['update','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x4bab13,_0x191907){var _0x52bfbb=function(_0x1d6ee0){while(--_0x1d6ee0){_0x4bab13['push'](_0x4bab13['shift']());}};_0x52bfbb(++_0x191907);}(_0x1113,0x164));var _0x3111=function(_0x2af627,_0x33d47f){_0x2af627=_0x2af627-0x0;var _0x14eda9=_0x1113[_0x2af627];return _0x14eda9;};'use strict';var EventEmitter=require(_0x3111('0x0'));var SquareProject=require(_0x3111('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3111('0x2')](0x0);var events={'afterCreate':_0x3111('0x3'),'afterUpdate':_0x3111('0x4'),'afterDestroy':'remove'};function emitEvent(_0x50d4ca){return function(_0x50efdb,_0x5b8e2f,_0x4eeea8){SquareProjectEvents['emit'](_0x50d4ca+':'+_0x50efdb['id'],_0x50efdb);SquareProjectEvents['emit'](_0x50d4ca,_0x50efdb);_0x4eeea8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x3111('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3a726b9..60fdba4 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 _0x1bb7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1bb7,0x94));var _0x71bb=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1bb7[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x71bb('0x0'));var util=require(_0x71bb('0x1'));var logger=require(_0x71bb('0x2'))(_0x71bb('0x3'));var moment=require('moment');var BPromise=require(_0x71bb('0x4'));var rp=require(_0x71bb('0x5'));var fs=require('fs');var path=require(_0x71bb('0x6'));var rimraf=require(_0x71bb('0x7'));var config=require(_0x71bb('0x8'));var attributes=require('./squareProject.attributes');module[_0x71bb('0x9')]=function(_0x3d8d8c,_0x1e8f90){return _0x3d8d8c[_0x71bb('0xa')](_0x71bb('0xb'),attributes,{'tableName':_0x71bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e44ba,_0x685f2,_0x3e98d9){if(_0x2e44ba[_0x71bb('0xd')]('preproduction')){_0x2e44ba[_0x71bb('0xe')]=moment()[_0x71bb('0xf')](_0x71bb('0x10'));}if(_0x2e44ba['changed'](_0x71bb('0x11'))){_0x2e44ba[_0x71bb('0x12')]=moment()[_0x71bb('0xf')](_0x71bb('0x10'));}_0x3e98d9(null,_0x2e44ba);}}});}; \ No newline at end of file +var _0x974d=['production','bluebird','request-promise','rimraf','../../config/environment','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3d3ed7,_0x1e26b6){var _0x207505=function(_0x5c5ef0){while(--_0x5c5ef0){_0x3d3ed7['push'](_0x3d3ed7['shift']());}};_0x207505(++_0x1e26b6);}(_0x974d,0xf8));var _0xd974=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x974d[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd974('0x0'));var rp=require(_0xd974('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd974('0x2'));var config=require(_0xd974('0x3'));var attributes=require('./squareProject.attributes');module[_0xd974('0x4')]=function(_0x30b6b7,_0xa97cce){return _0x30b6b7[_0xd974('0x5')]('SquareProject',attributes,{'tableName':_0xd974('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d961b,_0x179c35,_0x6ff58d){if(_0x1d961b[_0xd974('0x7')](_0xd974('0x8'))){_0x1d961b[_0xd974('0x9')]=moment()[_0xd974('0xa')](_0xd974('0xb'));}if(_0x1d961b[_0xd974('0x7')](_0xd974('0xc'))){_0x1d961b['publishedAt']=moment()[_0xd974('0xa')](_0xd974('0xb'));}_0x6ff58d(null,_0x1d961b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index db06a5e..7728a88 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 _0x7a8f=['./squareProject.socket','register','SquareProject','findAll','options','raw','attributes','limit','include','map','model','then','info','GetSquareProjects','catch','error','message','ShowSquareProject','find','where','debug','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x55e066,_0x14ec7d){var _0x21c1c1=function(_0x418aea){while(--_0x418aea){_0x55e066['push'](_0x55e066['shift']());}};_0x21c1c1(++_0x14ec7d);}(_0x7a8f,0x1e6));var _0xf7a8=function(_0x2d2329,_0x3848e7){_0x2d2329=_0x2d2329-0x0;var _0x5adf51=_0x7a8f[_0x2d2329];return _0x5adf51;};'use strict';var _=require(_0xf7a8('0x0'));var Redis=require(_0xf7a8('0x1'));var db=require(_0xf7a8('0x2'))['db'];var logger=require(_0xf7a8('0x3'))(_0xf7a8('0x4'));var config=require(_0xf7a8('0x5'));config[_0xf7a8('0x6')]=_[_0xf7a8('0x7')](config[_0xf7a8('0x6')],{'host':_0xf7a8('0x8'),'port':0x18eb});var socket=require(_0xf7a8('0x9'))(new Redis(config[_0xf7a8('0x6')]));require(_0xf7a8('0xa'))[_0xf7a8('0xb')](socket);exports['GetSquareProjects']=function(_0x2f3a59){var _0x11df52=this;return new Promise(function(_0x3794d8,_0x1d8102){return db[_0xf7a8('0xc')][_0xf7a8('0xd')]({'raw':_0x2f3a59[_0xf7a8('0xe')]?_0x2f3a59[_0xf7a8('0xe')][_0xf7a8('0xf')]===undefined?!![]:![]:!![],'where':_0x2f3a59[_0xf7a8('0xe')]?_0x2f3a59[_0xf7a8('0xe')]['where']||null:null,'attributes':_0x2f3a59['options']?_0x2f3a59[_0xf7a8('0xe')][_0xf7a8('0x10')]||null:null,'limit':_0x2f3a59[_0xf7a8('0xe')]?_0x2f3a59[_0xf7a8('0xe')][_0xf7a8('0x11')]||null:null,'include':_0x2f3a59[_0xf7a8('0xe')]?_0x2f3a59[_0xf7a8('0xe')][_0xf7a8('0x12')]?_[_0xf7a8('0x13')](_0x2f3a59['options'][_0xf7a8('0x12')],function(_0x1a1a78){return{'model':db[_0x1a1a78['model']],'as':_0x1a1a78['as'],'attributes':_0x1a1a78[_0xf7a8('0x10')],'include':_0x1a1a78[_0xf7a8('0x12')]?_[_0xf7a8('0x13')](_0x1a1a78['include'],function(_0x48fca8){return{'model':db[_0x48fca8[_0xf7a8('0x14')]],'as':_0x48fca8['as'],'attributes':_0x48fca8[_0xf7a8('0x10')],'include':_0x48fca8['include']?_[_0xf7a8('0x13')](_0x48fca8[_0xf7a8('0x12')],function(_0x519fe2){return{'model':db[_0x519fe2[_0xf7a8('0x14')]],'as':_0x519fe2['as'],'attributes':_0x519fe2[_0xf7a8('0x10')]};}):[]};}):[]};}):[]:[]})[_0xf7a8('0x15')](function(_0xc958f6){logger[_0xf7a8('0x16')](_0xf7a8('0x17'),_0x2f3a59);logger['debug']('GetSquareProjects',_0x2f3a59,JSON['stringify'](_0xc958f6));_0x3794d8(_0xc958f6);})[_0xf7a8('0x18')](function(_0x422273){logger[_0xf7a8('0x19')](_0xf7a8('0x17'),_0x422273['message'],_0x2f3a59);_0x1d8102(_0x11df52[_0xf7a8('0x19')](0x1f4,_0x422273[_0xf7a8('0x1a')]));});});};exports[_0xf7a8('0x1b')]=function(_0x282fca){var _0x1c64e0=this;return new Promise(function(_0x5d1112,_0x1e8e39){return db[_0xf7a8('0xc')][_0xf7a8('0x1c')]({'raw':_0x282fca['options']?_0x282fca['options']['raw']===undefined?!![]:![]:!![],'where':_0x282fca[_0xf7a8('0xe')]?_0x282fca['options'][_0xf7a8('0x1d')]||null:null,'attributes':_0x282fca[_0xf7a8('0xe')]?_0x282fca[_0xf7a8('0xe')][_0xf7a8('0x10')]||null:null,'include':_0x282fca[_0xf7a8('0xe')]?_0x282fca['options'][_0xf7a8('0x12')]?_[_0xf7a8('0x13')](_0x282fca[_0xf7a8('0xe')]['include'],function(_0x169c72){return{'model':db[_0x169c72['model']],'as':_0x169c72['as'],'attributes':_0x169c72[_0xf7a8('0x10')],'include':_0x169c72[_0xf7a8('0x12')]?_['map'](_0x169c72[_0xf7a8('0x12')],function(_0x498962){return{'model':db[_0x498962[_0xf7a8('0x14')]],'as':_0x498962['as'],'attributes':_0x498962[_0xf7a8('0x10')],'include':_0x498962['include']?_[_0xf7a8('0x13')](_0x498962[_0xf7a8('0x12')],function(_0x993fab){return{'model':db[_0x993fab['model']],'as':_0x993fab['as'],'attributes':_0x993fab[_0xf7a8('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x912bc2){logger[_0xf7a8('0x16')](_0xf7a8('0x1b'),_0x282fca);logger[_0xf7a8('0x1e')]('ShowSquareProject',_0x282fca,JSON['stringify'](_0x912bc2));_0x5d1112(_0x912bc2);})[_0xf7a8('0x18')](function(_0x34f8ed){logger['error']('ShowSquareProject',_0x34f8ed[_0xf7a8('0x1a')],_0x282fca);_0x1e8e39(_0x1c64e0[_0xf7a8('0x19')](0x1f4,_0x34f8ed[_0xf7a8('0x1a')]));});});}; \ No newline at end of file +var _0x40cf=['../../config/logger','rpc','../../config/environment','defaults','redis','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','model','map','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','raw','ioredis','../../mysqldb'];(function(_0x7490db,_0x474cd1){var _0x1e8589=function(_0x27c739){while(--_0x27c739){_0x7490db['push'](_0x7490db['shift']());}};_0x1e8589(++_0x474cd1);}(_0x40cf,0xac));var _0xf40c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x40cf[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var Redis=require(_0xf40c('0x0'));var db=require(_0xf40c('0x1'))['db'];var logger=require(_0xf40c('0x2'))(_0xf40c('0x3'));var config=require(_0xf40c('0x4'));config['redis']=_[_0xf40c('0x5')](config[_0xf40c('0x6')],{'host':_0xf40c('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf40c('0x6')]));require(_0xf40c('0x8'))[_0xf40c('0x9')](socket);exports[_0xf40c('0xa')]=function(_0x498343){var _0x383dc2=this;return new Promise(function(_0x4f44d1,_0x51152a){return db[_0xf40c('0xb')][_0xf40c('0xc')]({'raw':_0x498343[_0xf40c('0xd')]?_0x498343[_0xf40c('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x498343[_0xf40c('0xd')]?_0x498343[_0xf40c('0xd')][_0xf40c('0xe')]||null:null,'attributes':_0x498343['options']?_0x498343[_0xf40c('0xd')][_0xf40c('0xf')]||null:null,'limit':_0x498343['options']?_0x498343[_0xf40c('0xd')]['limit']||null:null,'include':_0x498343[_0xf40c('0xd')]?_0x498343['options'][_0xf40c('0x10')]?_['map'](_0x498343['options'][_0xf40c('0x10')],function(_0x520338){return{'model':db[_0x520338[_0xf40c('0x11')]],'as':_0x520338['as'],'attributes':_0x520338[_0xf40c('0xf')],'include':_0x520338[_0xf40c('0x10')]?_[_0xf40c('0x12')](_0x520338[_0xf40c('0x10')],function(_0x1ed1d2){return{'model':db[_0x1ed1d2[_0xf40c('0x11')]],'as':_0x1ed1d2['as'],'attributes':_0x1ed1d2[_0xf40c('0xf')],'include':_0x1ed1d2['include']?_[_0xf40c('0x12')](_0x1ed1d2[_0xf40c('0x10')],function(_0x2b28f4){return{'model':db[_0x2b28f4['model']],'as':_0x2b28f4['as'],'attributes':_0x2b28f4[_0xf40c('0xf')]};}):[]};}):[]};}):[]:[]})[_0xf40c('0x13')](function(_0x3eb23c){logger[_0xf40c('0x14')](_0xf40c('0xa'),_0x498343);logger[_0xf40c('0x15')]('GetSquareProjects',_0x498343,JSON[_0xf40c('0x16')](_0x3eb23c));_0x4f44d1(_0x3eb23c);})[_0xf40c('0x17')](function(_0x43ee55){logger[_0xf40c('0x18')]('GetSquareProjects',_0x43ee55[_0xf40c('0x19')],_0x498343);_0x51152a(_0x383dc2[_0xf40c('0x18')](0x1f4,_0x43ee55[_0xf40c('0x19')]));});});};exports[_0xf40c('0x1a')]=function(_0x37940f){var _0x46c3c8=this;return new Promise(function(_0x1834df,_0x46142a){return db['SquareProject'][_0xf40c('0x1b')]({'raw':_0x37940f['options']?_0x37940f[_0xf40c('0xd')][_0xf40c('0x1c')]===undefined?!![]:![]:!![],'where':_0x37940f['options']?_0x37940f[_0xf40c('0xd')][_0xf40c('0xe')]||null:null,'attributes':_0x37940f[_0xf40c('0xd')]?_0x37940f[_0xf40c('0xd')][_0xf40c('0xf')]||null:null,'include':_0x37940f['options']?_0x37940f[_0xf40c('0xd')][_0xf40c('0x10')]?_[_0xf40c('0x12')](_0x37940f[_0xf40c('0xd')][_0xf40c('0x10')],function(_0x2479c8){return{'model':db[_0x2479c8[_0xf40c('0x11')]],'as':_0x2479c8['as'],'attributes':_0x2479c8[_0xf40c('0xf')],'include':_0x2479c8[_0xf40c('0x10')]?_[_0xf40c('0x12')](_0x2479c8[_0xf40c('0x10')],function(_0x526a24){return{'model':db[_0x526a24['model']],'as':_0x526a24['as'],'attributes':_0x526a24[_0xf40c('0xf')],'include':_0x526a24[_0xf40c('0x10')]?_[_0xf40c('0x12')](_0x526a24[_0xf40c('0x10')],function(_0x26c12c){return{'model':db[_0x26c12c['model']],'as':_0x26c12c['as'],'attributes':_0x26c12c[_0xf40c('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e025a){logger[_0xf40c('0x14')](_0xf40c('0x1a'),_0x37940f);logger['debug']('ShowSquareProject',_0x37940f,JSON[_0xf40c('0x16')](_0x5e025a));_0x1834df(_0x5e025a);})[_0xf40c('0x17')](function(_0x35a7f8){logger[_0xf40c('0x18')](_0xf40c('0x1a'),_0x35a7f8[_0xf40c('0x19')],_0x37940f);_0x46142a(_0x46c3c8['error'](0x1f4,_0x35a7f8[_0xf40c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index bec9ea2..9d0628d 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 _0x1923=['./squareProject.events','save','emit','length','squareProject:'];(function(_0x414e78,_0x99ff89){var _0x445a4b=function(_0x345739){while(--_0x345739){_0x414e78['push'](_0x414e78['shift']());}};_0x445a4b(++_0x99ff89);}(_0x1923,0xd7));var _0x3192=function(_0x5bbdff,_0x571362){_0x5bbdff=_0x5bbdff-0x0;var _0xa74617=_0x1923[_0x5bbdff];return _0xa74617;};'use strict';var SquareProjectEvents=require(_0x3192('0x0'));var events=[_0x3192('0x1'),'remove','update'];function createListener(_0x46710b,_0x356db8){return function(_0x12a7e6){_0x356db8[_0x3192('0x2')](_0x46710b,_0x12a7e6);};}function removeListener(_0xd439a6,_0x7aba24){return function(){SquareProjectEvents['removeListener'](_0xd439a6,_0x7aba24);};}exports['register']=function(_0x25c080){for(var _0x46979d=0x0,_0x17adec=events[_0x3192('0x3')];_0x46979d<_0x17adec;_0x46979d++){var _0xf6c8=events[_0x46979d];var _0x32b7ef=createListener(_0x3192('0x4')+_0xf6c8,_0x25c080);SquareProjectEvents['on'](_0xf6c8,_0x32b7ef);}}; \ No newline at end of file +var _0x8cbd=['update','emit','removeListener','register','length','squareProject:','save'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x8cbd,0xae));var _0xd8cb=function(_0x21fbb1,_0x120f56){_0x21fbb1=_0x21fbb1-0x0;var _0x2f7b69=_0x8cbd[_0x21fbb1];return _0x2f7b69;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xd8cb('0x0'),'remove',_0xd8cb('0x1')];function createListener(_0x2152ab,_0x105a44){return function(_0x2cac1d){_0x105a44[_0xd8cb('0x2')](_0x2152ab,_0x2cac1d);};}function removeListener(_0xd072e6,_0x455d12){return function(){SquareProjectEvents[_0xd8cb('0x3')](_0xd072e6,_0x455d12);};}exports[_0xd8cb('0x4')]=function(_0x555208){for(var _0x54491b=0x0,_0x315ee9=events[_0xd8cb('0x5')];_0x54491b<_0x315ee9;_0x54491b++){var _0xad8d39=events[_0x54491b];var _0x5275ae=createListener(_0xd8cb('0x6')+_0xad8d39,_0x555208);SquareProjectEvents['on'](_0xad8d39,_0x5275ae);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 60e01ea..7212fcf 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 _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x9f52b4,_0x4c3d94){var _0xaf2fe9=function(_0x49df0d){while(--_0x49df0d){_0x9f52b4['push'](_0x9f52b4['shift']());}};_0xaf2fe9(++_0x4c3d94);}(_0xf494,0x1c6));var _0x4f49=function(_0x238e59,_0x3d5bd8){_0x238e59=_0x238e59-0x0;var _0x2cdb69=_0xf494[_0x238e59];return _0x2cdb69;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x29e76a,_0x28c013){var _0xfefea=function(_0x33c7ef){while(--_0x33c7ef){_0x29e76a['push'](_0x29e76a['shift']());}};_0xfefea(++_0x28c013);}(_0x1261,0x144));var _0x1126=function(_0x18a01c,_0xd1a13a){_0x18a01c=_0x18a01c-0x0;var _0x2b0cd6=_0x1261[_0x18a01c];return _0x2b0cd6;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0037ba8..b10e99c 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 _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x50117f,_0x1fd074){var _0x519c4e=function(_0x5ca6b0){while(--_0x5ca6b0){_0x50117f['push'](_0x50117f['shift']());}};_0x519c4e(++_0x1fd074);}(_0x032e,0x124));var _0xe032=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x032e[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file +var _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x4acc55,_0x331d65){var _0x5d9ac0=function(_0x49a275){while(--_0x49a275){_0x4acc55['push'](_0x4acc55['shift']());}};_0x5d9ac0(++_0x331d65);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3e3c52,_0x3fd32f){_0x3e3c52=_0x3e3c52-0x0;var _0x23a98d=_0x9c5a[_0x3e3c52];return _0x23a98d;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 61ece54..93cd71f 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 _0x2ad8=['hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','rows','catch','params','keys','options','create','body','update','find','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','ValidationError','filename','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','length','attributes'];(function(_0x5628d5,_0x390bbe){var _0x5c8a2e=function(_0x84386){while(--_0x84386){_0x5628d5['push'](_0x5628d5['shift']());}};_0x5c8a2e(++_0x390bbe);}(_0x2ad8,0x199));var _0x82ad=function(_0x273f3a,_0x3c3708){_0x273f3a=_0x273f3a-0x0;var _0x3272ab=_0x2ad8[_0x273f3a];return _0x3272ab;};'use strict';var emlformat=require(_0x82ad('0x0'));var rimraf=require(_0x82ad('0x1'));var zipdir=require(_0x82ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82ad('0x3'));var moment=require(_0x82ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82ad('0x5'));var util=require(_0x82ad('0x6'));var path=require(_0x82ad('0x7'));var sox=require(_0x82ad('0x8'));var csv=require(_0x82ad('0x9'));var ejs=require(_0x82ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82ad('0xb'));var squel=require(_0x82ad('0xc'));var crypto=require('crypto');var jsforce=require(_0x82ad('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x82ad('0xe'));var Redis=require(_0x82ad('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x82ad('0x10'));var as=require(_0x82ad('0x11'));var hardwareService=require(_0x82ad('0x12'));var logger=require(_0x82ad('0x13'))(_0x82ad('0x14'));var utils=require('../../config/utils');var config=require(_0x82ad('0x15'));var licenseUtil=require(_0x82ad('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x168255,_0x34f2c7){_0x34f2c7=_0x34f2c7||0xcc;return function(_0x4c689d){if(_0x4c689d){return _0x168255[_0x82ad('0x17')](_0x34f2c7);}return _0x168255[_0x82ad('0x18')](_0x34f2c7)[_0x82ad('0x19')]();};}function respondWithResult(_0x4a6906,_0x52fc1d){_0x52fc1d=_0x52fc1d||0xc8;return function(_0x42b604){if(_0x42b604){return _0x4a6906['status'](_0x52fc1d)[_0x82ad('0x1a')](_0x42b604);}};}function respondWithFilteredResult(_0x5ac5f9,_0x4d8db6){return function(_0x55add6){if(_0x55add6){var _0x533774=typeof _0x4d8db6[_0x82ad('0x1b')]===_0x82ad('0x1c')&&typeof _0x4d8db6[_0x82ad('0x1d')]===_0x82ad('0x1c');var _0x187879=_0x55add6[_0x82ad('0x1e')];var _0x4ac0e2=_0x533774?0x0:_0x4d8db6[_0x82ad('0x1b')];var _0xb76425=_0x533774?_0x55add6[_0x82ad('0x1e')]:_0x4d8db6[_0x82ad('0x1b')]+_0x4d8db6['limit'];var _0x17e30c;if(_0xb76425>=_0x187879){_0xb76425=_0x187879;_0x17e30c=0xc8;}else{_0x17e30c=0xce;}_0x5ac5f9['status'](_0x17e30c);return _0x5ac5f9[_0x82ad('0x1f')](_0x82ad('0x20'),_0x4ac0e2+'-'+_0xb76425+'/'+_0x187879)['json'](_0x55add6);}return null;};}function patchUpdates(_0x18cf11){return function(_0x415836){try{jsonpatch[_0x82ad('0x21')](_0x415836,_0x18cf11,!![]);}catch(_0x165270){return BPromise[_0x82ad('0x22')](_0x165270);}return _0x415836[_0x82ad('0x23')]();};}function saveUpdates(_0x59df34,_0x3bb035){return function(_0xb900ae){if(_0xb900ae){return _0xb900ae['update'](_0x59df34)[_0x82ad('0x24')](function(_0x8e5e69){return _0x8e5e69;});}return null;};}function removeEntity(_0x283cd8,_0x4f455b){return function(_0x285133){if(_0x285133){return _0x285133[_0x82ad('0x25')]()[_0x82ad('0x24')](function(){_0x283cd8['status'](0xcc)[_0x82ad('0x19')]();});}};}function handleEntityNotFound(_0x49f2d7,_0x450c1c){return function(_0x4eca54){if(!_0x4eca54){_0x49f2d7[_0x82ad('0x17')](0x194);}return _0x4eca54;};}function handleError(_0x4cd447,_0x37705d){_0x37705d=_0x37705d||0x1f4;return function(_0x3c0a5e){logger[_0x82ad('0x26')](_0x3c0a5e[_0x82ad('0x27')]);if(_0x3c0a5e[_0x82ad('0x28')]){delete _0x3c0a5e['name'];}_0x4cd447[_0x82ad('0x18')](_0x37705d)[_0x82ad('0x29')](_0x3c0a5e);};}exports[_0x82ad('0x2a')]=function(_0x3a2f15,_0x2768a3){var _0x52fc89={},_0x191bfd={},_0xa3b1df={'count':0x0,'rows':[]};var _0xb8540d=_[_0x82ad('0x2b')](db[_0x82ad('0x2c')][_0x82ad('0x2d')],function(_0x53a956){return{'name':_0x53a956[_0x82ad('0x2e')],'type':_0x53a956[_0x82ad('0x2f')][_0x82ad('0x30')]};});_0x191bfd['model']=_[_0x82ad('0x2b')](_0xb8540d,_0x82ad('0x28'));_0x191bfd[_0x82ad('0x31')]=_['keys'](_0x3a2f15[_0x82ad('0x31')]);_0x191bfd[_0x82ad('0x32')]=_[_0x82ad('0x33')](_0x191bfd[_0x82ad('0x34')],_0x191bfd[_0x82ad('0x31')]);_0x52fc89['attributes']=_[_0x82ad('0x33')](_0x191bfd[_0x82ad('0x34')],qs[_0x82ad('0x35')](_0x3a2f15['query'][_0x82ad('0x35')]));_0x52fc89['attributes']=_0x52fc89['attributes'][_0x82ad('0x36')]?_0x52fc89[_0x82ad('0x37')]:_0x191bfd[_0x82ad('0x34')];if(!_0x3a2f15[_0x82ad('0x31')][_0x82ad('0x38')](_0x82ad('0x39'))){_0x52fc89['limit']=qs[_0x82ad('0x1d')](_0x3a2f15['query']['limit']);_0x52fc89[_0x82ad('0x1b')]=qs['offset'](_0x3a2f15[_0x82ad('0x31')][_0x82ad('0x1b')]);}_0x52fc89[_0x82ad('0x3a')]=qs[_0x82ad('0x3b')](_0x3a2f15[_0x82ad('0x31')]['sort']);_0x52fc89[_0x82ad('0x3c')]=qs[_0x82ad('0x32')](_['pick'](_0x3a2f15[_0x82ad('0x31')],_0x191bfd[_0x82ad('0x32')]),_0xb8540d);if(_0x3a2f15[_0x82ad('0x31')]['filter']){_0x52fc89[_0x82ad('0x3c')]=_[_0x82ad('0x3d')](_0x52fc89[_0x82ad('0x3c')],{'$or':_['map'](_0xb8540d,function(_0x901d98){if(_0x901d98['type']!==_0x82ad('0x3e')){var _0x4a2402={};_0x4a2402[_0x901d98[_0x82ad('0x28')]]={'$like':'%'+_0x3a2f15['query'][_0x82ad('0x3f')]+'%'};return _0x4a2402;}})});}_0x52fc89=_[_0x82ad('0x3d')]({},_0x52fc89,_0x3a2f15['options']);var _0x480606={'where':_0x52fc89[_0x82ad('0x3c')]};return db[_0x82ad('0x2c')]['count'](_0x480606)[_0x82ad('0x24')](function(_0x6ad15c){_0xa3b1df[_0x82ad('0x1e')]=_0x6ad15c;if(_0x3a2f15['query']['includeAll']){_0x52fc89[_0x82ad('0x40')]=[{'all':!![]}];}return db[_0x82ad('0x2c')]['findAll'](_0x52fc89);})[_0x82ad('0x24')](function(_0x34cc93){_0xa3b1df[_0x82ad('0x41')]=_0x34cc93;return _0xa3b1df;})[_0x82ad('0x24')](respondWithFilteredResult(_0x2768a3,_0x52fc89))[_0x82ad('0x42')](handleError(_0x2768a3,null));};exports['show']=function(_0x140e40,_0xfc0974){var _0x2e26ce={'raw':!![],'where':{'id':_0x140e40[_0x82ad('0x43')]['id']}},_0x3cc031={};_0x3cc031[_0x82ad('0x34')]=_[_0x82ad('0x44')](db['SquareRecording']['rawAttributes']);_0x3cc031['query']=_['keys'](_0x140e40[_0x82ad('0x31')]);_0x3cc031[_0x82ad('0x32')]=_[_0x82ad('0x33')](_0x3cc031[_0x82ad('0x34')],_0x3cc031[_0x82ad('0x31')]);_0x2e26ce['attributes']=_['intersection'](_0x3cc031[_0x82ad('0x34')],qs[_0x82ad('0x35')](_0x140e40[_0x82ad('0x31')][_0x82ad('0x35')]));_0x2e26ce[_0x82ad('0x37')]=_0x2e26ce[_0x82ad('0x37')][_0x82ad('0x36')]?_0x2e26ce[_0x82ad('0x37')]:_0x3cc031[_0x82ad('0x34')];if(_0x140e40['query']['includeAll']){_0x2e26ce['include']=[{'all':!![]}];}_0x2e26ce=_['merge']({},_0x2e26ce,_0x140e40[_0x82ad('0x45')]);return db[_0x82ad('0x2c')]['find'](_0x2e26ce)[_0x82ad('0x24')](handleEntityNotFound(_0xfc0974,null))[_0x82ad('0x24')](respondWithResult(_0xfc0974,null))['catch'](handleError(_0xfc0974,null));};exports[_0x82ad('0x46')]=function(_0xf3c6be,_0x10b68d){return db[_0x82ad('0x2c')][_0x82ad('0x46')](_0xf3c6be[_0x82ad('0x47')],{})[_0x82ad('0x24')](respondWithResult(_0x10b68d,0xc9))[_0x82ad('0x42')](handleError(_0x10b68d,null));};exports[_0x82ad('0x48')]=function(_0x5912e1,_0x3c72e7){if(_0x5912e1[_0x82ad('0x47')]['id']){delete _0x5912e1[_0x82ad('0x47')]['id'];}return db[_0x82ad('0x2c')][_0x82ad('0x49')]({'where':{'id':_0x5912e1['params']['id']}})[_0x82ad('0x24')](handleEntityNotFound(_0x3c72e7,null))['then'](saveUpdates(_0x5912e1['body'],null))['then'](respondWithResult(_0x3c72e7,null))[_0x82ad('0x42')](handleError(_0x3c72e7,null));};exports[_0x82ad('0x4a')]=function(_0x25ef0c,_0xa23be7,_0x5b48cc){var _0x448743=require(_0x82ad('0x4b'));var _0x4e3e6c=![];var _0x3d6d05={};if(_0x25ef0c['query'][_0x82ad('0x2f')]&&_0x25ef0c[_0x82ad('0x31')][_0x82ad('0x2f')]===_0x82ad('0x4c')){_0x3d6d05['uniqueid']=_0x25ef0c[_0x82ad('0x43')]['id'];}else{_0x3d6d05['id']=_0x25ef0c['params']['id'];}return db[_0x82ad('0x2c')][_0x82ad('0x49')]({'where':_0x3d6d05,'attributes':['id',_0x82ad('0x4d'),'filename'],'raw':!![]})[_0x82ad('0x24')](handleEntityNotFound(_0xa23be7,null))[_0x82ad('0x24')](function(_0x5e3f02){if(_0x5e3f02){var _0x3084b0=_0x5e3f02[_0x82ad('0x4d')];var _0x317426=util['format'](_0x82ad('0x4e'),_0x3084b0);if(fs[_0x82ad('0x4f')](_0x317426)){_0x4e3e6c=!![];return _0x448743[_0x82ad('0x50')](_0x317426,_0x3084b0,config[_0x82ad('0x51')]['recording'])['then'](function(){return _0x5e3f02;});}return _0x5e3f02;}})['then'](function(_0x53ee39){if(_0x53ee39){var _0x76a72e=_0x53ee39['savePath'];if(!fs['existsSync'](_0x76a72e)){throw new db['Sequelize'][(_0x82ad('0x52'))]('SquareRecording\x20not\x20found');}if(_0x53ee39[_0x82ad('0x53')]){return _0xa23be7[_0x82ad('0x4a')](_0x76a72e,_0x53ee39[_0x82ad('0x53')]+path['extname'](_0x76a72e),function(){if(_0x4e3e6c){fs['unlink'](_0x76a72e);}});}else{return _0xa23be7['download'](_0x76a72e,function(_0x5b4065){if(_0x4e3e6c){fs['unlink'](_0x76a72e);}});}}})[_0x82ad('0x42')](function(_0x3488a6){if(_0x3488a6['message']===_0x82ad('0x54')){_0xa23be7[_0x82ad('0x18')](0x194)['send'](_0x82ad('0x55'));}else{return handleError(_0xa23be7,null);}});};exports['destroy']=function(_0x5d475d,_0x162b92){return db[_0x82ad('0x2c')][_0x82ad('0x49')]({'where':{'id':_0x5d475d[_0x82ad('0x43')]['id']}})['then'](function(_0x4c104c){if(_['isNil'](_0x4c104c)){throw new ReferenceError(_0x82ad('0x56'));}return _0x4c104c;})[_0x82ad('0x24')](function(_0x5e951f){var _0x5968b3=_0x5e951f[_0x82ad('0x4d')];logger[_0x82ad('0x57')]('cancellazione\x20fisica\x20documento\x20%s',_0x5968b3);if(!_[_0x82ad('0x58')](_0x5e951f[_0x82ad('0x4d')])&&fs[_0x82ad('0x4f')](_0x5968b3)){logger[_0x82ad('0x57')](_0x82ad('0x59')+_0x5968b3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x82ad('0x5a')](_0x5968b3);}_0x5968b3=_0x5968b3+_0x82ad('0x5b');if(!_[_0x82ad('0x58')](_0x5e951f[_0x82ad('0x4d')])&&fs['existsSync'](_0x5968b3)){logger[_0x82ad('0x57')](_0x82ad('0x59')+_0x5968b3+_0x82ad('0x5c'));fs['unlinkSync'](_0x5968b3);}return _0x5e951f;})['then'](function(_0x4faabe){if(!_0x4faabe)throw new InternalError();return _0x4faabe[_0x82ad('0x25')]();})[_0x82ad('0x24')](function(){_0x162b92[_0x82ad('0x18')](0xcc)['end']();})[_0x82ad('0x42')](handleError(_0x162b92,null));}; \ No newline at end of file +var _0x8750=['findAll','rows','catch','show','params','length','find','body','update','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','then','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x49a24f,_0x3e60b1){var _0x25b6b0=function(_0x1bb133){while(--_0x1bb133){_0x49a24f['push'](_0x49a24f['shift']());}};_0x25b6b0(++_0x3e60b1);}(_0x8750,0x1f1));var _0x0875=function(_0x2fd8bc,_0x5a0f05){_0x2fd8bc=_0x2fd8bc-0x0;var _0x32f450=_0x8750[_0x2fd8bc];return _0x32f450;};'use strict';var emlformat=require(_0x0875('0x0'));var rimraf=require(_0x0875('0x1'));var zipdir=require(_0x0875('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0875('0x3'));var moment=require(_0x0875('0x4'));var BPromise=require(_0x0875('0x5'));var Mustache=require(_0x0875('0x6'));var util=require('util');var path=require(_0x0875('0x7'));var sox=require('sox');var csv=require(_0x0875('0x8'));var ejs=require(_0x0875('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0875('0xa'));var squel=require('squel');var crypto=require(_0x0875('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0875('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0875('0xd'));var Papa=require(_0x0875('0xe'));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(_0x0875('0xf'));var logger=require(_0x0875('0x10'))(_0x0875('0x11'));var utils=require('../../config/utils');var config=require(_0x0875('0x12'));var licenseUtil=require(_0x0875('0x13'));var db=require(_0x0875('0x14'))['db'];function respondWithStatusCode(_0x559fc3,_0x5a9c45){_0x5a9c45=_0x5a9c45||0xcc;return function(_0x57ef3e){if(_0x57ef3e){return _0x559fc3[_0x0875('0x15')](_0x5a9c45);}return _0x559fc3[_0x0875('0x16')](_0x5a9c45)[_0x0875('0x17')]();};}function respondWithResult(_0x5d9c26,_0x282f61){_0x282f61=_0x282f61||0xc8;return function(_0x56f339){if(_0x56f339){return _0x5d9c26[_0x0875('0x16')](_0x282f61)['json'](_0x56f339);}};}function respondWithFilteredResult(_0x30df6b,_0x361354){return function(_0x44e9f9){if(_0x44e9f9){var _0x5b53fd=typeof _0x361354[_0x0875('0x18')]==='undefined'&&typeof _0x361354[_0x0875('0x19')]===_0x0875('0x1a');var _0x261386=_0x44e9f9[_0x0875('0x1b')];var _0x8cd276=_0x5b53fd?0x0:_0x361354[_0x0875('0x18')];var _0x412613=_0x5b53fd?_0x44e9f9[_0x0875('0x1b')]:_0x361354[_0x0875('0x18')]+_0x361354[_0x0875('0x19')];var _0x5d87b4;if(_0x412613>=_0x261386){_0x412613=_0x261386;_0x5d87b4=0xc8;}else{_0x5d87b4=0xce;}_0x30df6b[_0x0875('0x16')](_0x5d87b4);return _0x30df6b['set'](_0x0875('0x1c'),_0x8cd276+'-'+_0x412613+'/'+_0x261386)[_0x0875('0x1d')](_0x44e9f9);}return null;};}function patchUpdates(_0x2c1fae){return function(_0x39f2bd){try{jsonpatch[_0x0875('0x1e')](_0x39f2bd,_0x2c1fae,!![]);}catch(_0x5b8ec4){return BPromise['reject'](_0x5b8ec4);}return _0x39f2bd[_0x0875('0x1f')]();};}function saveUpdates(_0x2a9c45,_0x4d6108){return function(_0x460805){if(_0x460805){return _0x460805['update'](_0x2a9c45)['then'](function(_0x3f2936){return _0x3f2936;});}return null;};}function removeEntity(_0x48e559,_0x29460b){return function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc['destroy']()[_0x0875('0x20')](function(){_0x48e559[_0x0875('0x16')](0xcc)[_0x0875('0x17')]();});}};}function handleEntityNotFound(_0xa908d9,_0x54e9f9){return function(_0xb37e10){if(!_0xb37e10){_0xa908d9['sendStatus'](0x194);}return _0xb37e10;};}function handleError(_0x4e5620,_0x54abc6){_0x54abc6=_0x54abc6||0x1f4;return function(_0x4a96c4){logger[_0x0875('0x21')](_0x4a96c4[_0x0875('0x22')]);if(_0x4a96c4[_0x0875('0x23')]){delete _0x4a96c4[_0x0875('0x23')];}_0x4e5620[_0x0875('0x16')](_0x54abc6)['send'](_0x4a96c4);};}exports[_0x0875('0x24')]=function(_0x4e63b9,_0x18e2f9){var _0x47bd1d={},_0x10f3ce={},_0x37a227={'count':0x0,'rows':[]};var _0x16bc55=_[_0x0875('0x25')](db[_0x0875('0x26')][_0x0875('0x27')],function(_0x24ed87){return{'name':_0x24ed87[_0x0875('0x28')],'type':_0x24ed87[_0x0875('0x29')][_0x0875('0x2a')]};});_0x10f3ce[_0x0875('0x2b')]=_[_0x0875('0x25')](_0x16bc55,'name');_0x10f3ce[_0x0875('0x2c')]=_[_0x0875('0x2d')](_0x4e63b9[_0x0875('0x2c')]);_0x10f3ce[_0x0875('0x2e')]=_['intersection'](_0x10f3ce['model'],_0x10f3ce[_0x0875('0x2c')]);_0x47bd1d[_0x0875('0x2f')]=_[_0x0875('0x30')](_0x10f3ce[_0x0875('0x2b')],qs[_0x0875('0x31')](_0x4e63b9[_0x0875('0x2c')][_0x0875('0x31')]));_0x47bd1d['attributes']=_0x47bd1d[_0x0875('0x2f')]['length']?_0x47bd1d[_0x0875('0x2f')]:_0x10f3ce[_0x0875('0x2b')];if(!_0x4e63b9[_0x0875('0x2c')][_0x0875('0x32')]('nolimit')){_0x47bd1d[_0x0875('0x19')]=qs['limit'](_0x4e63b9[_0x0875('0x2c')][_0x0875('0x19')]);_0x47bd1d[_0x0875('0x18')]=qs[_0x0875('0x18')](_0x4e63b9[_0x0875('0x2c')][_0x0875('0x18')]);}_0x47bd1d[_0x0875('0x33')]=qs[_0x0875('0x34')](_0x4e63b9['query']['sort']);_0x47bd1d[_0x0875('0x35')]=qs[_0x0875('0x2e')](_[_0x0875('0x36')](_0x4e63b9[_0x0875('0x2c')],_0x10f3ce[_0x0875('0x2e')]),_0x16bc55);if(_0x4e63b9[_0x0875('0x2c')][_0x0875('0x37')]){_0x47bd1d[_0x0875('0x35')]=_[_0x0875('0x38')](_0x47bd1d['where'],{'$or':_[_0x0875('0x25')](_0x16bc55,function(_0x1d9582){if(_0x1d9582[_0x0875('0x29')]!==_0x0875('0x39')){var _0x5e706e={};_0x5e706e[_0x1d9582['name']]={'$like':'%'+_0x4e63b9['query'][_0x0875('0x37')]+'%'};return _0x5e706e;}})});}_0x47bd1d=_[_0x0875('0x38')]({},_0x47bd1d,_0x4e63b9[_0x0875('0x3a')]);var _0x2e99ee={'where':_0x47bd1d['where']};return db[_0x0875('0x26')][_0x0875('0x1b')](_0x2e99ee)[_0x0875('0x20')](function(_0x2041cf){_0x37a227['count']=_0x2041cf;if(_0x4e63b9[_0x0875('0x2c')][_0x0875('0x3b')]){_0x47bd1d[_0x0875('0x3c')]=[{'all':!![]}];}return db[_0x0875('0x26')][_0x0875('0x3d')](_0x47bd1d);})[_0x0875('0x20')](function(_0x380f3b){_0x37a227[_0x0875('0x3e')]=_0x380f3b;return _0x37a227;})[_0x0875('0x20')](respondWithFilteredResult(_0x18e2f9,_0x47bd1d))[_0x0875('0x3f')](handleError(_0x18e2f9,null));};exports[_0x0875('0x40')]=function(_0x13aac9,_0x4a6455){var _0x2af6f0={'raw':!![],'where':{'id':_0x13aac9[_0x0875('0x41')]['id']}},_0x2d0191={};_0x2d0191[_0x0875('0x2b')]=_[_0x0875('0x2d')](db[_0x0875('0x26')][_0x0875('0x27')]);_0x2d0191[_0x0875('0x2c')]=_['keys'](_0x13aac9['query']);_0x2d0191[_0x0875('0x2e')]=_[_0x0875('0x30')](_0x2d0191['model'],_0x2d0191[_0x0875('0x2c')]);_0x2af6f0[_0x0875('0x2f')]=_['intersection'](_0x2d0191[_0x0875('0x2b')],qs[_0x0875('0x31')](_0x13aac9[_0x0875('0x2c')][_0x0875('0x31')]));_0x2af6f0[_0x0875('0x2f')]=_0x2af6f0['attributes'][_0x0875('0x42')]?_0x2af6f0[_0x0875('0x2f')]:_0x2d0191[_0x0875('0x2b')];if(_0x13aac9[_0x0875('0x2c')][_0x0875('0x3b')]){_0x2af6f0[_0x0875('0x3c')]=[{'all':!![]}];}_0x2af6f0=_['merge']({},_0x2af6f0,_0x13aac9['options']);return db['SquareRecording'][_0x0875('0x43')](_0x2af6f0)['then'](handleEntityNotFound(_0x4a6455,null))[_0x0875('0x20')](respondWithResult(_0x4a6455,null))[_0x0875('0x3f')](handleError(_0x4a6455,null));};exports['create']=function(_0x5a59b0,_0x2c1298){return db[_0x0875('0x26')]['create'](_0x5a59b0[_0x0875('0x44')],{})['then'](respondWithResult(_0x2c1298,0xc9))[_0x0875('0x3f')](handleError(_0x2c1298,null));};exports[_0x0875('0x45')]=function(_0x44df07,_0x4c14b1){if(_0x44df07[_0x0875('0x44')]['id']){delete _0x44df07[_0x0875('0x44')]['id'];}return db['SquareRecording'][_0x0875('0x43')]({'where':{'id':_0x44df07[_0x0875('0x41')]['id']}})[_0x0875('0x20')](handleEntityNotFound(_0x4c14b1,null))['then'](saveUpdates(_0x44df07['body'],null))['then'](respondWithResult(_0x4c14b1,null))['catch'](handleError(_0x4c14b1,null));};exports['download']=function(_0xedc0d0,_0x5d975e,_0x417649){var _0x319ee4=require('../../components/encryptor');var _0x1fb3fb=![];var _0x239950={};if(_0xedc0d0[_0x0875('0x2c')][_0x0875('0x29')]&&_0xedc0d0['query']['type']===_0x0875('0x46')){_0x239950['uniqueid']=_0xedc0d0[_0x0875('0x41')]['id'];}else{_0x239950['id']=_0xedc0d0[_0x0875('0x41')]['id'];}return db['SquareRecording']['find']({'where':_0x239950,'attributes':['id','savePath',_0x0875('0x47')],'raw':!![]})[_0x0875('0x20')](handleEntityNotFound(_0x5d975e,null))[_0x0875('0x20')](function(_0x52f37e){if(_0x52f37e){var _0x409640=_0x52f37e[_0x0875('0x48')];var _0x5315e0=util[_0x0875('0x49')](_0x0875('0x4a'),_0x409640);if(fs[_0x0875('0x4b')](_0x5315e0)){_0x1fb3fb=!![];return _0x319ee4[_0x0875('0x4c')](_0x5315e0,_0x409640,config[_0x0875('0x4d')]['recording'])['then'](function(){return _0x52f37e;});}return _0x52f37e;}})[_0x0875('0x20')](function(_0x30d504){if(_0x30d504){var _0x489ab4=_0x30d504[_0x0875('0x48')];if(!fs[_0x0875('0x4b')](_0x489ab4)){throw new db[(_0x0875('0x4e'))][(_0x0875('0x4f'))](_0x0875('0x50'));}if(_0x30d504[_0x0875('0x47')]){return _0x5d975e['download'](_0x489ab4,_0x30d504[_0x0875('0x47')]+path[_0x0875('0x51')](_0x489ab4),function(){if(_0x1fb3fb){fs[_0x0875('0x52')](_0x489ab4);}});}else{return _0x5d975e['download'](_0x489ab4,function(_0x5243f8){if(_0x1fb3fb){fs[_0x0875('0x52')](_0x489ab4);}});}}})[_0x0875('0x3f')](function(_0xc15097){if(_0xc15097[_0x0875('0x53')]===_0x0875('0x50')){_0x5d975e['status'](0x194)[_0x0875('0x54')]('Not\x20found');}else{return handleError(_0x5d975e,null);}});};exports['destroy']=function(_0x14d698,_0x1cc2ad){return db[_0x0875('0x26')][_0x0875('0x43')]({'where':{'id':_0x14d698[_0x0875('0x41')]['id']}})[_0x0875('0x20')](function(_0x52edb6){if(_['isNil'](_0x52edb6)){throw new ReferenceError(_0x0875('0x55'));}return _0x52edb6;})[_0x0875('0x20')](function(_0x5a9862){var _0x3b3d35=_0x5a9862[_0x0875('0x48')];logger['info'](_0x0875('0x56'),_0x3b3d35);if(!_[_0x0875('0x57')](_0x5a9862['savePath'])&&fs[_0x0875('0x4b')](_0x3b3d35)){logger[_0x0875('0x58')](_0x0875('0x59')+_0x3b3d35+_0x0875('0x5a'));fs['unlinkSync'](_0x3b3d35);}_0x3b3d35=_0x3b3d35+'.cypher';if(!_[_0x0875('0x57')](_0x5a9862[_0x0875('0x48')])&&fs[_0x0875('0x4b')](_0x3b3d35)){logger['info'](_0x0875('0x59')+_0x3b3d35+_0x0875('0x5a'));fs[_0x0875('0x5b')](_0x3b3d35);}return _0x5a9862;})[_0x0875('0x20')](function(_0x1045c4){if(!_0x1045c4)throw new InternalError();return _0x1045c4[_0x0875('0x5c')]();})[_0x0875('0x20')](function(){_0x1cc2ad['status'](0xcc)[_0x0875('0x17')]();})['catch'](handleError(_0x1cc2ad,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 804b280..f4f6255 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 _0xfc65=['SquareRecording','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0xc09b83,_0x4a8f7c){var _0x986879=function(_0x55f96f){while(--_0x55f96f){_0xc09b83['push'](_0xc09b83['shift']());}};_0x986879(++_0x4a8f7c);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x38dd8a,_0x23b848){_0x38dd8a=_0x38dd8a-0x0;var _0x1ea8fa=_0xfc65[_0x38dd8a];return _0x1ea8fa;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5fc6('0x1'));var moment=require(_0x5fc6('0x2'));var BPromise=require(_0x5fc6('0x3'));var rp=require(_0x5fc6('0x4'));var fs=require('fs');var path=require(_0x5fc6('0x5'));var rimraf=require(_0x5fc6('0x6'));var config=require(_0x5fc6('0x7'));var attributes=require(_0x5fc6('0x8'));module[_0x5fc6('0x9')]=function(_0x441b3e,_0x3100b4){return _0x441b3e[_0x5fc6('0xa')](_0x5fc6('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4991=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x548907,_0x2505a8){var _0x19e494=function(_0x18f208){while(--_0x18f208){_0x548907['push'](_0x548907['shift']());}};_0x19e494(++_0x2505a8);}(_0x4991,0xf7));var _0x1499=function(_0x4c2722,_0x16668c){_0x4c2722=_0x4c2722-0x0;var _0x25336d=_0x4991[_0x4c2722];return _0x25336d;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));module[_0x1499('0x9')]=function(_0x4b6154,_0x2a8e96){return _0x4b6154[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('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 c037805..49db92a 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 _0xef82=['message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x48bc42,_0x2d5e2c){var _0x24402b=function(_0x87d071){while(--_0x87d071){_0x48bc42['push'](_0x48bc42['shift']());}};_0x24402b(++_0x2d5e2c);}(_0xef82,0x164));var _0x2ef8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xef82[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x2ef8('0x0'));var util=require(_0x2ef8('0x1'));var moment=require(_0x2ef8('0x2'));var BPromise=require(_0x2ef8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ef8('0x4'));var db=require(_0x2ef8('0x5'))['db'];var utils=require(_0x2ef8('0x6'));var logger=require(_0x2ef8('0x7'))('rpc');var config=require(_0x2ef8('0x8'));var jayson=require(_0x2ef8('0x9'));var client=jayson[_0x2ef8('0xa')][_0x2ef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x198798,_0x27df4f,_0x5a4ffd){return new BPromise(function(_0xffaec0,_0x227462){return client[_0x2ef8('0xc')](_0x198798,_0x5a4ffd)['then'](function(_0x588703){logger[_0x2ef8('0xd')](_0x2ef8('0xe'),_0x27df4f,_0x2ef8('0xf'));logger[_0x2ef8('0x10')](_0x2ef8('0x11'),_0x27df4f,'request\x20sent',JSON[_0x2ef8('0x12')](_0x588703));if(_0x588703[_0x2ef8('0x13')]){if(_0x588703['error'][_0x2ef8('0x14')]===0x1f4){logger[_0x2ef8('0x13')](_0x2ef8('0xe'),_0x27df4f,_0x588703['error'][_0x2ef8('0x15')]);return _0x227462(_0x588703[_0x2ef8('0x13')]['message']);}logger[_0x2ef8('0x13')](_0x2ef8('0xe'),_0x27df4f,_0x588703['error']['message']);return _0xffaec0(_0x588703['error'][_0x2ef8('0x15')]);}else{logger['info'](_0x2ef8('0xe'),_0x27df4f,_0x2ef8('0xf'));_0xffaec0(_0x588703[_0x2ef8('0x16')]['message']);}})[_0x2ef8('0x17')](function(_0x547652){logger[_0x2ef8('0x13')](_0x2ef8('0xe'),_0x27df4f,_0x547652);_0x227462(_0x547652);});});}exports[_0x2ef8('0x18')]=function(_0x3d9db9){var _0x5dcb09=this;return new Promise(function(_0x3c22aa,_0x17d350){return db[_0x2ef8('0x19')]['create'](_0x3d9db9[_0x2ef8('0x1a')],{'raw':_0x3d9db9['options']?_0x3d9db9[_0x2ef8('0x1b')][_0x2ef8('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1a7b08){logger[_0x2ef8('0xd')](_0x2ef8('0x18'),_0x3d9db9);logger[_0x2ef8('0x10')]('CreateSquareRecording',_0x3d9db9,JSON[_0x2ef8('0x12')](_0x1a7b08));_0x3c22aa(_0x1a7b08);})['catch'](function(_0x4609e6){logger[_0x2ef8('0x13')](_0x2ef8('0x18'),_0x4609e6[_0x2ef8('0x15')],_0x3d9db9);_0x17d350(_0x5dcb09['error'](0x1f4,_0x4609e6[_0x2ef8('0x15')]));});});}; \ No newline at end of file +var _0x9f43=['options','raw','stringify','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateSquareRecording','body'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9f43,0x80));var _0x39f4=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x9f43[_0x2fb87c];return _0x43038b;};'use strict';var _=require('lodash');var util=require(_0x39f4('0x0'));var moment=require(_0x39f4('0x1'));var BPromise=require(_0x39f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x39f4('0x4'))('rpc');var config=require(_0x39f4('0x5'));var jayson=require(_0x39f4('0x6'));var client=jayson['client'][_0x39f4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4292fc,_0x206a90,_0x5bfd5d){return new BPromise(function(_0x46075e,_0x475cb6){return client[_0x39f4('0x8')](_0x4292fc,_0x5bfd5d)[_0x39f4('0x9')](function(_0x3e76a0){logger['info'](_0x39f4('0xa'),_0x206a90,'request\x20sent');logger[_0x39f4('0xb')](_0x39f4('0xc'),_0x206a90,_0x39f4('0xd'),JSON['stringify'](_0x3e76a0));if(_0x3e76a0['error']){if(_0x3e76a0[_0x39f4('0xe')][_0x39f4('0xf')]===0x1f4){logger[_0x39f4('0xe')](_0x39f4('0xa'),_0x206a90,_0x3e76a0[_0x39f4('0xe')][_0x39f4('0x10')]);return _0x475cb6(_0x3e76a0[_0x39f4('0xe')]['message']);}logger['error'](_0x39f4('0xa'),_0x206a90,_0x3e76a0[_0x39f4('0xe')][_0x39f4('0x10')]);return _0x46075e(_0x3e76a0['error']['message']);}else{logger[_0x39f4('0x11')](_0x39f4('0xa'),_0x206a90,_0x39f4('0xd'));_0x46075e(_0x3e76a0[_0x39f4('0x12')][_0x39f4('0x10')]);}})[_0x39f4('0x13')](function(_0x717b98){logger[_0x39f4('0xe')](_0x39f4('0xa'),_0x206a90,_0x717b98);_0x475cb6(_0x717b98);});});}exports[_0x39f4('0x14')]=function(_0x4b444c){var _0x50f348=this;return new Promise(function(_0x2f9aba,_0x15a3d9){return db['SquareRecording']['create'](_0x4b444c[_0x39f4('0x15')],{'raw':_0x4b444c[_0x39f4('0x16')]?_0x4b444c['options'][_0x39f4('0x17')]===undefined?!![]:![]:!![]})[_0x39f4('0x9')](function(_0x186c66){logger['info'](_0x39f4('0x14'),_0x4b444c);logger['debug'](_0x39f4('0x14'),_0x4b444c,JSON[_0x39f4('0x18')](_0x186c66));_0x2f9aba(_0x186c66);})['catch'](function(_0x31c7de){logger['error'](_0x39f4('0x14'),_0x31c7de[_0x39f4('0x10')],_0x4b444c);_0x15a3d9(_0x50f348[_0x39f4('0xe')](0x1f4,_0x31c7de['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a501ecb..8a8cf07 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 _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(_0x5e9f06,_0x3dd75c){var _0x4c9dd5=function(_0x5dc2e1){while(--_0x5dc2e1){_0x5e9f06['push'](_0x5e9f06['shift']());}};_0x4c9dd5(++_0x3dd75c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 59712f0..58e7223 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 _0x3114=['BOOLEAN','exports','STRING','DATE'];(function(_0x5690a4,_0x572d64){var _0x170f91=function(_0x5458c1){while(--_0x5458c1){_0x5690a4['push'](_0x5690a4['shift']());}};_0x170f91(++_0x572d64);}(_0x3114,0xdd));var _0x4311=function(_0x3f34e3,_0x192576){_0x3f34e3=_0x3f34e3-0x0;var _0x14d366=_0x3114[_0x3f34e3];return _0x14d366;};'use strict';var Sequelize=require('sequelize');module[_0x4311('0x0')]={'network':{'type':Sequelize[_0x4311('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4311('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4311('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4311('0x1')]},'version':{'type':Sequelize[_0x4311('0x1')]},'callerid':{'type':Sequelize[_0x4311('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x4311('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4311('0x1')]},'callingtns':{'type':Sequelize[_0x4311('0x1')]},'dnid':{'type':Sequelize[_0x4311('0x1')]},'rdnis':{'type':Sequelize[_0x4311('0x1')]},'context':{'type':Sequelize[_0x4311('0x1')]},'extension':{'type':Sequelize[_0x4311('0x1')]},'priority':{'type':Sequelize[_0x4311('0x1')]},'enhanced':{'type':Sequelize[_0x4311('0x1')]},'accountcode':{'type':Sequelize[_0x4311('0x1')]},'threadid':{'type':Sequelize[_0x4311('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4311('0x2')]},'leaveAt':{'type':Sequelize[_0x4311('0x2')]},'bot':{'type':Sequelize[_0x4311('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x53c7=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3f14df,_0x57effb){var _0x142e15=function(_0x225e41){while(--_0x225e41){_0x3f14df['push'](_0x3f14df['shift']());}};_0x142e15(++_0x57effb);}(_0x53c7,0x1e9));var _0x753c=function(_0x40474c,_0x2504f0){_0x40474c=_0x40474c-0x0;var _0x5daeaf=_0x53c7[_0x40474c];return _0x5daeaf;};'use strict';var Sequelize=require(_0x753c('0x0'));module[_0x753c('0x1')]={'network':{'type':Sequelize[_0x753c('0x2')]},'network_script':{'type':Sequelize[_0x753c('0x2')]},'request':{'type':Sequelize[_0x753c('0x2')]},'channel':{'type':Sequelize[_0x753c('0x2')]},'language':{'type':Sequelize[_0x753c('0x2')]},'type':{'type':Sequelize[_0x753c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x753c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x753c('0x2')]},'callington':{'type':Sequelize[_0x753c('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x753c('0x2')]},'rdnis':{'type':Sequelize[_0x753c('0x2')]},'context':{'type':Sequelize[_0x753c('0x2')]},'extension':{'type':Sequelize[_0x753c('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x753c('0x2')]},'threadid':{'type':Sequelize[_0x753c('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x753c('0x3')]},'leaveAt':{'type':Sequelize[_0x753c('0x3')]},'bot':{'type':Sequelize[_0x753c('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6210528..f3b1931 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 _0x4ecf=['keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','stack','send','map','SquareReport','fieldName','type','model','query'];(function(_0x403ff7,_0x2d950f){var _0x299d8b=function(_0x56620f){while(--_0x56620f){_0x403ff7['push'](_0x403ff7['shift']());}};_0x299d8b(++_0x2d950f);}(_0x4ecf,0x13a));var _0xf4ec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4ecf[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xf4ec('0x0'));var rimraf=require(_0xf4ec('0x1'));var zipdir=require(_0xf4ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ec('0x3'));var moment=require(_0xf4ec('0x4'));var BPromise=require(_0xf4ec('0x5'));var Mustache=require('mustache');var util=require(_0xf4ec('0x6'));var path=require('path');var sox=require(_0xf4ec('0x7'));var csv=require(_0xf4ec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4ec('0x9'));var _=require('lodash');var squel=require(_0xf4ec('0xa'));var crypto=require('crypto');var jsforce=require(_0xf4ec('0xb'));var deskjs=require(_0xf4ec('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf4ec('0xd'));var Papa=require(_0xf4ec('0xe'));var Redis=require(_0xf4ec('0xf'));var authService=require(_0xf4ec('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf4ec('0x11'));var hardwareService=require(_0xf4ec('0x12'));var logger=require(_0xf4ec('0x13'))(_0xf4ec('0x14'));var utils=require('../../config/utils');var config=require(_0xf4ec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4ec('0x16'))['db'];function respondWithStatusCode(_0x52c90f,_0x5d6e11){_0x5d6e11=_0x5d6e11||0xcc;return function(_0x42fb26){if(_0x42fb26){return _0x52c90f['sendStatus'](_0x5d6e11);}return _0x52c90f[_0xf4ec('0x17')](_0x5d6e11)[_0xf4ec('0x18')]();};}function respondWithResult(_0x1015a5,_0x4bd483){_0x4bd483=_0x4bd483||0xc8;return function(_0x571ed0){if(_0x571ed0){return _0x1015a5['status'](_0x4bd483)['json'](_0x571ed0);}};}function respondWithFilteredResult(_0x21f69c,_0x42a96c){return function(_0x18a83b){if(_0x18a83b){var _0x188f5e=typeof _0x42a96c[_0xf4ec('0x19')]===_0xf4ec('0x1a')&&typeof _0x42a96c[_0xf4ec('0x1b')]==='undefined';var _0x5320f6=_0x18a83b[_0xf4ec('0x1c')];var _0x2c6261=_0x188f5e?0x0:_0x42a96c[_0xf4ec('0x19')];var _0x7ecdec=_0x188f5e?_0x18a83b[_0xf4ec('0x1c')]:_0x42a96c[_0xf4ec('0x19')]+_0x42a96c[_0xf4ec('0x1b')];var _0x46b4ca;if(_0x7ecdec>=_0x5320f6){_0x7ecdec=_0x5320f6;_0x46b4ca=0xc8;}else{_0x46b4ca=0xce;}_0x21f69c['status'](_0x46b4ca);return _0x21f69c[_0xf4ec('0x1d')](_0xf4ec('0x1e'),_0x2c6261+'-'+_0x7ecdec+'/'+_0x5320f6)[_0xf4ec('0x1f')](_0x18a83b);}return null;};}function patchUpdates(_0x147614){return function(_0x54f2bc){try{jsonpatch[_0xf4ec('0x20')](_0x54f2bc,_0x147614,!![]);}catch(_0x5a61de){return BPromise['reject'](_0x5a61de);}return _0x54f2bc['save']();};}function saveUpdates(_0x60ce32,_0x45e746){return function(_0x47da23){if(_0x47da23){return _0x47da23[_0xf4ec('0x21')](_0x60ce32)[_0xf4ec('0x22')](function(_0x5361d6){return _0x5361d6;});}return null;};}function removeEntity(_0x41622a,_0x3f3392){return function(_0x27551f){if(_0x27551f){return _0x27551f[_0xf4ec('0x23')]()[_0xf4ec('0x22')](function(){_0x41622a[_0xf4ec('0x17')](0xcc)[_0xf4ec('0x18')]();});}};}function handleEntityNotFound(_0x3189c6,_0x541e3b){return function(_0x17a890){if(!_0x17a890){_0x3189c6[_0xf4ec('0x24')](0x194);}return _0x17a890;};}function handleError(_0x46a66a,_0x33f831){_0x33f831=_0x33f831||0x1f4;return function(_0x350142){logger[_0xf4ec('0x25')](_0x350142[_0xf4ec('0x26')]);if(_0x350142['name']){delete _0x350142['name'];}_0x46a66a[_0xf4ec('0x17')](_0x33f831)[_0xf4ec('0x27')](_0x350142);};}exports['index']=function(_0x1776c4,_0x10e41d){var _0x5a8135={},_0x233d19={},_0x41560d={'count':0x0,'rows':[]};var _0x3d7354=_[_0xf4ec('0x28')](db[_0xf4ec('0x29')]['rawAttributes'],function(_0x51761e){return{'name':_0x51761e[_0xf4ec('0x2a')],'type':_0x51761e[_0xf4ec('0x2b')]['key']};});_0x233d19[_0xf4ec('0x2c')]=_[_0xf4ec('0x28')](_0x3d7354,'name');_0x233d19[_0xf4ec('0x2d')]=_[_0xf4ec('0x2e')](_0x1776c4['query']);_0x233d19[_0xf4ec('0x2f')]=_['intersection'](_0x233d19['model'],_0x233d19[_0xf4ec('0x2d')]);_0x5a8135[_0xf4ec('0x30')]=_['intersection'](_0x233d19[_0xf4ec('0x2c')],qs[_0xf4ec('0x31')](_0x1776c4[_0xf4ec('0x2d')][_0xf4ec('0x31')]));_0x5a8135['attributes']=_0x5a8135['attributes']['length']?_0x5a8135['attributes']:_0x233d19[_0xf4ec('0x2c')];if(!_0x1776c4[_0xf4ec('0x2d')]['hasOwnProperty'](_0xf4ec('0x32'))){_0x5a8135[_0xf4ec('0x1b')]=qs[_0xf4ec('0x1b')](_0x1776c4[_0xf4ec('0x2d')]['limit']);_0x5a8135[_0xf4ec('0x19')]=qs[_0xf4ec('0x19')](_0x1776c4[_0xf4ec('0x2d')]['offset']);}_0x5a8135[_0xf4ec('0x33')]=qs[_0xf4ec('0x34')](_0x1776c4['query'][_0xf4ec('0x34')]);_0x5a8135[_0xf4ec('0x35')]=qs['filters'](_[_0xf4ec('0x36')](_0x1776c4[_0xf4ec('0x2d')],_0x233d19[_0xf4ec('0x2f')]),_0x3d7354);if(_0x1776c4['query'][_0xf4ec('0x37')]){_0x5a8135['where']=_[_0xf4ec('0x38')](_0x5a8135[_0xf4ec('0x35')],{'$or':_[_0xf4ec('0x28')](_0x3d7354,function(_0xb30a1d){if(_0xb30a1d[_0xf4ec('0x2b')]!=='VIRTUAL'){var _0x2832fa={};_0x2832fa[_0xb30a1d['name']]={'$like':'%'+_0x1776c4[_0xf4ec('0x2d')][_0xf4ec('0x37')]+'%'};return _0x2832fa;}})});}_0x5a8135=_[_0xf4ec('0x38')]({},_0x5a8135,_0x1776c4['options']);var _0x4071a0={'where':_0x5a8135[_0xf4ec('0x35')]};return db[_0xf4ec('0x29')][_0xf4ec('0x1c')](_0x4071a0)[_0xf4ec('0x22')](function(_0x27d14b){_0x41560d[_0xf4ec('0x1c')]=_0x27d14b;if(_0x1776c4[_0xf4ec('0x2d')][_0xf4ec('0x39')]){_0x5a8135[_0xf4ec('0x3a')]=[{'all':!![]}];}return db[_0xf4ec('0x29')][_0xf4ec('0x3b')](_0x5a8135);})['then'](function(_0x173ade){_0x41560d[_0xf4ec('0x3c')]=_0x173ade;return _0x41560d;})[_0xf4ec('0x22')](respondWithFilteredResult(_0x10e41d,_0x5a8135))[_0xf4ec('0x3d')](handleError(_0x10e41d,null));};exports[_0xf4ec('0x3e')]=function(_0x560f0a,_0x47cf80){var _0x40e6e4={'raw':!![],'where':{'id':_0x560f0a[_0xf4ec('0x3f')]['id']}},_0x45936b={};_0x45936b[_0xf4ec('0x2c')]=_['keys'](db[_0xf4ec('0x29')][_0xf4ec('0x40')]);_0x45936b['query']=_[_0xf4ec('0x2e')](_0x560f0a[_0xf4ec('0x2d')]);_0x45936b[_0xf4ec('0x2f')]=_['intersection'](_0x45936b['model'],_0x45936b['query']);_0x40e6e4[_0xf4ec('0x30')]=_[_0xf4ec('0x41')](_0x45936b['model'],qs[_0xf4ec('0x31')](_0x560f0a[_0xf4ec('0x2d')][_0xf4ec('0x31')]));_0x40e6e4[_0xf4ec('0x30')]=_0x40e6e4['attributes'][_0xf4ec('0x42')]?_0x40e6e4['attributes']:_0x45936b[_0xf4ec('0x2c')];if(_0x560f0a[_0xf4ec('0x2d')][_0xf4ec('0x39')]){_0x40e6e4[_0xf4ec('0x3a')]=[{'all':!![]}];}_0x40e6e4=_[_0xf4ec('0x38')]({},_0x40e6e4,_0x560f0a[_0xf4ec('0x43')]);return db['SquareReport'][_0xf4ec('0x44')](_0x40e6e4)[_0xf4ec('0x22')](handleEntityNotFound(_0x47cf80,null))[_0xf4ec('0x22')](respondWithResult(_0x47cf80,null))[_0xf4ec('0x3d')](handleError(_0x47cf80,null));};exports[_0xf4ec('0x45')]=function(_0x484776,_0x1a267f){return db[_0xf4ec('0x29')][_0xf4ec('0x45')](_0x484776['body'],{})[_0xf4ec('0x22')](respondWithResult(_0x1a267f,0xc9))[_0xf4ec('0x3d')](handleError(_0x1a267f,null));};exports[_0xf4ec('0x21')]=function(_0x1f4529,_0x37ccc8){if(_0x1f4529[_0xf4ec('0x46')]['id']){delete _0x1f4529[_0xf4ec('0x46')]['id'];}return db['SquareReport'][_0xf4ec('0x44')]({'where':{'id':_0x1f4529[_0xf4ec('0x3f')]['id']}})[_0xf4ec('0x22')](handleEntityNotFound(_0x37ccc8,null))[_0xf4ec('0x22')](saveUpdates(_0x1f4529[_0xf4ec('0x46')],null))['then'](respondWithResult(_0x37ccc8,null))[_0xf4ec('0x3d')](handleError(_0x37ccc8,null));};exports['destroy']=function(_0xc6293b,_0x13e385){return db['SquareReport'][_0xf4ec('0x44')]({'where':{'id':_0xc6293b[_0xf4ec('0x3f')]['id']}})[_0xf4ec('0x22')](handleEntityNotFound(_0x13e385,null))[_0xf4ec('0x22')](removeEntity(_0x13e385,null))[_0xf4ec('0x3d')](handleError(_0x13e385,null));};exports[_0xf4ec('0x47')]=function(_0x43359c,_0x15e8b9){return db[_0xf4ec('0x29')]['describe']()[_0xf4ec('0x22')](respondWithResult(_0x15e8b9,null))['catch'](handleError(_0x15e8b9,null));}; \ No newline at end of file +var _0x6cc7=['request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','destroy','then','error','stack','name','index','map','SquareReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x440ca0,_0x596071){var _0x1346bc=function(_0x49a219){while(--_0x49a219){_0x440ca0['push'](_0x440ca0['shift']());}};_0x1346bc(++_0x596071);}(_0x6cc7,0x16f));var _0x76cc=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x6cc7[_0x57cb4f];return _0x29bb45;};'use strict';var emlformat=require(_0x76cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76cc('0x1'));var jsonpatch=require(_0x76cc('0x2'));var rp=require(_0x76cc('0x3'));var moment=require(_0x76cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76cc('0x5'));var util=require(_0x76cc('0x6'));var path=require(_0x76cc('0x7'));var sox=require(_0x76cc('0x8'));var csv=require('to-csv');var ejs=require(_0x76cc('0x9'));var fs=require('fs');var fs_extra=require(_0x76cc('0xa'));var _=require(_0x76cc('0xb'));var squel=require('squel');var crypto=require(_0x76cc('0xc'));var jsforce=require(_0x76cc('0xd'));var deskjs=require(_0x76cc('0xe'));var toCsv=require(_0x76cc('0xf'));var querystring=require(_0x76cc('0x10'));var Papa=require(_0x76cc('0x11'));var Redis=require('ioredis');var authService=require(_0x76cc('0x12'));var qs=require(_0x76cc('0x13'));var as=require(_0x76cc('0x14'));var hardwareService=require(_0x76cc('0x15'));var logger=require(_0x76cc('0x16'))(_0x76cc('0x17'));var utils=require(_0x76cc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x76cc('0x19'));var db=require(_0x76cc('0x1a'))['db'];function respondWithStatusCode(_0x36f169,_0x155682){_0x155682=_0x155682||0xcc;return function(_0x325d91){if(_0x325d91){return _0x36f169[_0x76cc('0x1b')](_0x155682);}return _0x36f169[_0x76cc('0x1c')](_0x155682)[_0x76cc('0x1d')]();};}function respondWithResult(_0x3bcd5f,_0x13a15c){_0x13a15c=_0x13a15c||0xc8;return function(_0x5390da){if(_0x5390da){return _0x3bcd5f[_0x76cc('0x1c')](_0x13a15c)[_0x76cc('0x1e')](_0x5390da);}};}function respondWithFilteredResult(_0xb67cac,_0x2c6e84){return function(_0x4ab6fe){if(_0x4ab6fe){var _0x53838e=typeof _0x2c6e84['offset']===_0x76cc('0x1f')&&typeof _0x2c6e84[_0x76cc('0x20')]===_0x76cc('0x1f');var _0x326d1e=_0x4ab6fe[_0x76cc('0x21')];var _0x1bffbd=_0x53838e?0x0:_0x2c6e84['offset'];var _0x2450e2=_0x53838e?_0x4ab6fe[_0x76cc('0x21')]:_0x2c6e84[_0x76cc('0x22')]+_0x2c6e84[_0x76cc('0x20')];var _0x88f5bd;if(_0x2450e2>=_0x326d1e){_0x2450e2=_0x326d1e;_0x88f5bd=0xc8;}else{_0x88f5bd=0xce;}_0xb67cac[_0x76cc('0x1c')](_0x88f5bd);return _0xb67cac[_0x76cc('0x23')]('Content-Range',_0x1bffbd+'-'+_0x2450e2+'/'+_0x326d1e)[_0x76cc('0x1e')](_0x4ab6fe);}return null;};}function patchUpdates(_0x14f149){return function(_0x209f3c){try{jsonpatch['apply'](_0x209f3c,_0x14f149,!![]);}catch(_0xb52882){return BPromise[_0x76cc('0x24')](_0xb52882);}return _0x209f3c['save']();};}function saveUpdates(_0x2b847f,_0x1a1fb4){return function(_0x4cc3ea){if(_0x4cc3ea){return _0x4cc3ea['update'](_0x2b847f)['then'](function(_0x82918a){return _0x82918a;});}return null;};}function removeEntity(_0x2de068,_0x3dbb20){return function(_0x55c5ce){if(_0x55c5ce){return _0x55c5ce[_0x76cc('0x25')]()[_0x76cc('0x26')](function(){_0x2de068['status'](0xcc)[_0x76cc('0x1d')]();});}};}function handleEntityNotFound(_0x468c2f,_0xdc5486){return function(_0x40e1ec){if(!_0x40e1ec){_0x468c2f[_0x76cc('0x1b')](0x194);}return _0x40e1ec;};}function handleError(_0x19f7d2,_0x2ac788){_0x2ac788=_0x2ac788||0x1f4;return function(_0x526939){logger[_0x76cc('0x27')](_0x526939[_0x76cc('0x28')]);if(_0x526939['name']){delete _0x526939[_0x76cc('0x29')];}_0x19f7d2[_0x76cc('0x1c')](_0x2ac788)['send'](_0x526939);};}exports[_0x76cc('0x2a')]=function(_0x33fdde,_0x5894f6){var _0x4bd317={},_0x523583={},_0xdfdfd9={'count':0x0,'rows':[]};var _0x24545a=_[_0x76cc('0x2b')](db[_0x76cc('0x2c')]['rawAttributes'],function(_0x350711){return{'name':_0x350711[_0x76cc('0x2d')],'type':_0x350711[_0x76cc('0x2e')][_0x76cc('0x2f')]};});_0x523583[_0x76cc('0x30')]=_['map'](_0x24545a,_0x76cc('0x29'));_0x523583[_0x76cc('0x31')]=_[_0x76cc('0x32')](_0x33fdde[_0x76cc('0x31')]);_0x523583['filters']=_[_0x76cc('0x33')](_0x523583['model'],_0x523583[_0x76cc('0x31')]);_0x4bd317[_0x76cc('0x34')]=_['intersection'](_0x523583['model'],qs[_0x76cc('0x35')](_0x33fdde[_0x76cc('0x31')][_0x76cc('0x35')]));_0x4bd317[_0x76cc('0x34')]=_0x4bd317[_0x76cc('0x34')][_0x76cc('0x36')]?_0x4bd317[_0x76cc('0x34')]:_0x523583[_0x76cc('0x30')];if(!_0x33fdde[_0x76cc('0x31')][_0x76cc('0x37')]('nolimit')){_0x4bd317[_0x76cc('0x20')]=qs[_0x76cc('0x20')](_0x33fdde['query'][_0x76cc('0x20')]);_0x4bd317[_0x76cc('0x22')]=qs['offset'](_0x33fdde['query'][_0x76cc('0x22')]);}_0x4bd317[_0x76cc('0x38')]=qs['sort'](_0x33fdde[_0x76cc('0x31')][_0x76cc('0x39')]);_0x4bd317['where']=qs[_0x76cc('0x3a')](_[_0x76cc('0x3b')](_0x33fdde['query'],_0x523583[_0x76cc('0x3a')]),_0x24545a);if(_0x33fdde[_0x76cc('0x31')][_0x76cc('0x3c')]){_0x4bd317[_0x76cc('0x3d')]=_['merge'](_0x4bd317['where'],{'$or':_[_0x76cc('0x2b')](_0x24545a,function(_0xf1f020){if(_0xf1f020[_0x76cc('0x2e')]!==_0x76cc('0x3e')){var _0x419be7={};_0x419be7[_0xf1f020[_0x76cc('0x29')]]={'$like':'%'+_0x33fdde[_0x76cc('0x31')][_0x76cc('0x3c')]+'%'};return _0x419be7;}})});}_0x4bd317=_[_0x76cc('0x3f')]({},_0x4bd317,_0x33fdde[_0x76cc('0x40')]);var _0x23dddd={'where':_0x4bd317[_0x76cc('0x3d')]};return db[_0x76cc('0x2c')][_0x76cc('0x21')](_0x23dddd)['then'](function(_0xe63c04){_0xdfdfd9[_0x76cc('0x21')]=_0xe63c04;if(_0x33fdde[_0x76cc('0x31')][_0x76cc('0x41')]){_0x4bd317[_0x76cc('0x42')]=[{'all':!![]}];}return db[_0x76cc('0x2c')]['findAll'](_0x4bd317);})['then'](function(_0x4ebdf4){_0xdfdfd9[_0x76cc('0x43')]=_0x4ebdf4;return _0xdfdfd9;})['then'](respondWithFilteredResult(_0x5894f6,_0x4bd317))[_0x76cc('0x44')](handleError(_0x5894f6,null));};exports['show']=function(_0x34c3a4,_0x5f4920){var _0x2f34ac={'raw':!![],'where':{'id':_0x34c3a4[_0x76cc('0x45')]['id']}},_0xd095b7={};_0xd095b7['model']=_[_0x76cc('0x32')](db[_0x76cc('0x2c')]['rawAttributes']);_0xd095b7[_0x76cc('0x31')]=_[_0x76cc('0x32')](_0x34c3a4['query']);_0xd095b7['filters']=_['intersection'](_0xd095b7[_0x76cc('0x30')],_0xd095b7[_0x76cc('0x31')]);_0x2f34ac['attributes']=_['intersection'](_0xd095b7['model'],qs[_0x76cc('0x35')](_0x34c3a4[_0x76cc('0x31')][_0x76cc('0x35')]));_0x2f34ac[_0x76cc('0x34')]=_0x2f34ac[_0x76cc('0x34')][_0x76cc('0x36')]?_0x2f34ac['attributes']:_0xd095b7[_0x76cc('0x30')];if(_0x34c3a4[_0x76cc('0x31')][_0x76cc('0x41')]){_0x2f34ac[_0x76cc('0x42')]=[{'all':!![]}];}_0x2f34ac=_[_0x76cc('0x3f')]({},_0x2f34ac,_0x34c3a4[_0x76cc('0x40')]);return db[_0x76cc('0x2c')][_0x76cc('0x46')](_0x2f34ac)[_0x76cc('0x26')](handleEntityNotFound(_0x5f4920,null))[_0x76cc('0x26')](respondWithResult(_0x5f4920,null))[_0x76cc('0x44')](handleError(_0x5f4920,null));};exports[_0x76cc('0x47')]=function(_0x39b439,_0x45fb2){return db[_0x76cc('0x2c')][_0x76cc('0x47')](_0x39b439['body'],{})['then'](respondWithResult(_0x45fb2,0xc9))[_0x76cc('0x44')](handleError(_0x45fb2,null));};exports['update']=function(_0x5196a5,_0x40b6ee){if(_0x5196a5[_0x76cc('0x48')]['id']){delete _0x5196a5[_0x76cc('0x48')]['id'];}return db[_0x76cc('0x2c')][_0x76cc('0x46')]({'where':{'id':_0x5196a5['params']['id']}})[_0x76cc('0x26')](handleEntityNotFound(_0x40b6ee,null))[_0x76cc('0x26')](saveUpdates(_0x5196a5['body'],null))['then'](respondWithResult(_0x40b6ee,null))[_0x76cc('0x44')](handleError(_0x40b6ee,null));};exports[_0x76cc('0x25')]=function(_0x1504ae,_0x110fd5){return db[_0x76cc('0x2c')][_0x76cc('0x46')]({'where':{'id':_0x1504ae[_0x76cc('0x45')]['id']}})[_0x76cc('0x26')](handleEntityNotFound(_0x110fd5,null))[_0x76cc('0x26')](removeEntity(_0x110fd5,null))['catch'](handleError(_0x110fd5,null));};exports[_0x76cc('0x49')]=function(_0x5c3f51,_0x56b295){return db[_0x76cc('0x2c')][_0x76cc('0x49')]()[_0x76cc('0x26')](respondWithResult(_0x56b295,null))[_0x76cc('0x44')](handleError(_0x56b295,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0d1c59a..ece5fb8 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 _0x0551=['define','uid_pname','uniqueid','project_name','leaveAt','util','api','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports'];(function(_0x284ee8,_0x43078b){var _0x2d66a9=function(_0x31d816){while(--_0x31d816){_0x284ee8['push'](_0x284ee8['shift']());}};_0x2d66a9(++_0x43078b);}(_0x0551,0x94));var _0x1055=function(_0x5e7990,_0x20fcbe){_0x5e7990=_0x5e7990-0x0;var _0x5d5b2e=_0x0551[_0x5e7990];return _0x5d5b2e;};'use strict';var _=require('lodash');var util=require(_0x1055('0x0'));var logger=require('../../config/logger')(_0x1055('0x1'));var moment=require('moment');var BPromise=require(_0x1055('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1055('0x3'));var rimraf=require(_0x1055('0x4'));var config=require(_0x1055('0x5'));var attributes=require(_0x1055('0x6'));module[_0x1055('0x7')]=function(_0x2c6fe2,_0x16684e){return _0x2c6fe2[_0x1055('0x8')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x1055('0x9'),'fields':[_0x1055('0xa'),_0x1055('0xb')]},{'name':_0x1055('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6904=['uniqueid','project_name','lodash','../../config/logger','api','bluebird','request-promise','path','./squareReport.attributes','SquareReport','report_square','uid_pname'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0x6904,0x1be));var _0x4690=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x6904[_0x363ef8];return _0x148822;};'use strict';var _=require(_0x4690('0x0'));var util=require('util');var logger=require(_0x4690('0x1'))(_0x4690('0x2'));var moment=require('moment');var BPromise=require(_0x4690('0x3'));var rp=require(_0x4690('0x4'));var fs=require('fs');var path=require(_0x4690('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4690('0x6'));module['exports']=function(_0x711623,_0x411b63){return _0x711623['define'](_0x4690('0x7'),attributes,{'tableName':_0x4690('0x8'),'paranoid':![],'indexes':[{'name':_0x4690('0x9'),'fields':[_0x4690('0xa'),_0x4690('0xb')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f6ad00f..434e52f 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 _0xedf0=['SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport','update','where','attributes','limit','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x52bf81,_0x42e4bd){var _0x42a666=function(_0xd233a4){while(--_0xd233a4){_0x52bf81['push'](_0x52bf81['shift']());}};_0x42a666(++_0x42e4bd);}(_0xedf0,0x101));var _0x0edf=function(_0x185a5a,_0x19442b){_0x185a5a=_0x185a5a-0x0;var _0x39bd2d=_0xedf0[_0x185a5a];return _0x39bd2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0edf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0edf('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x0edf('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0edf('0x3'));var client=jayson[_0x0edf('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4afa4d,_0x460061,_0x26e1b9){return new BPromise(function(_0xea2ab3,_0x5a7438){return client[_0x0edf('0x5')](_0x4afa4d,_0x26e1b9)[_0x0edf('0x6')](function(_0x1189fa){logger[_0x0edf('0x7')]('SquareReport,\x20%s,\x20%s',_0x460061,_0x0edf('0x8'));logger[_0x0edf('0x9')](_0x0edf('0xa'),_0x460061,_0x0edf('0x8'),JSON[_0x0edf('0xb')](_0x1189fa));if(_0x1189fa[_0x0edf('0xc')]){if(_0x1189fa[_0x0edf('0xc')]['code']===0x1f4){logger[_0x0edf('0xc')](_0x0edf('0xd'),_0x460061,_0x1189fa['error'][_0x0edf('0xe')]);return _0x5a7438(_0x1189fa[_0x0edf('0xc')]['message']);}logger[_0x0edf('0xc')](_0x0edf('0xd'),_0x460061,_0x1189fa[_0x0edf('0xc')]['message']);return _0xea2ab3(_0x1189fa[_0x0edf('0xc')][_0x0edf('0xe')]);}else{logger[_0x0edf('0x7')](_0x0edf('0xd'),_0x460061,_0x0edf('0x8'));_0xea2ab3(_0x1189fa[_0x0edf('0xf')][_0x0edf('0xe')]);}})[_0x0edf('0x10')](function(_0x4b145b){logger[_0x0edf('0xc')](_0x0edf('0xd'),_0x460061,_0x4b145b);_0x5a7438(_0x4b145b);});});}exports[_0x0edf('0x11')]=function(_0x46ad3c){var _0x52dadd=this;return new Promise(function(_0x35354f,_0x352ec8){return db[_0x0edf('0x12')]['create'](_0x46ad3c[_0x0edf('0x13')],{'raw':_0x46ad3c[_0x0edf('0x14')]?_0x46ad3c[_0x0edf('0x14')][_0x0edf('0x15')]===undefined?!![]:![]:!![]})[_0x0edf('0x6')](function(_0x5b46d6){logger[_0x0edf('0x7')]('CreateSquareReport',_0x46ad3c);logger[_0x0edf('0x9')](_0x0edf('0x11'),_0x46ad3c,JSON[_0x0edf('0xb')](_0x5b46d6));_0x35354f(_0x5b46d6);})[_0x0edf('0x10')](function(_0x58a42d){logger[_0x0edf('0xc')](_0x0edf('0x11'),_0x58a42d[_0x0edf('0xe')],_0x46ad3c);_0x352ec8(_0x52dadd[_0x0edf('0xc')](0x1f4,_0x58a42d[_0x0edf('0xe')]));});});};exports[_0x0edf('0x16')]=function(_0x2dbc78){var _0x473cab=this;return new Promise(function(_0x3a00eb,_0x383a55){return db[_0x0edf('0x12')][_0x0edf('0x17')](_0x2dbc78['body'],{'raw':_0x2dbc78[_0x0edf('0x14')]?_0x2dbc78[_0x0edf('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dbc78[_0x0edf('0x14')]?_0x2dbc78[_0x0edf('0x14')][_0x0edf('0x18')]||null:null,'attributes':_0x2dbc78[_0x0edf('0x14')]?_0x2dbc78[_0x0edf('0x14')][_0x0edf('0x19')]||null:null,'limit':_0x2dbc78[_0x0edf('0x14')]?_0x2dbc78[_0x0edf('0x14')][_0x0edf('0x1a')]||null:null})[_0x0edf('0x6')](function(_0x4b3ae0){logger[_0x0edf('0x7')](_0x0edf('0x16'),_0x2dbc78);logger[_0x0edf('0x9')]('UpdateSquareReport',_0x2dbc78,JSON['stringify'](_0x4b3ae0));_0x3a00eb(_0x4b3ae0);})['catch'](function(_0x1cd860){logger[_0x0edf('0xc')](_0x0edf('0x16'),_0x1cd860[_0x0edf('0xe')],_0x2dbc78);_0x383a55(_0x473cab[_0x0edf('0xc')](0x1f4,_0x1cd860[_0x0edf('0xe')]));});});}; \ No newline at end of file +var _0xd96e=['create','options','raw','UpdateSquareReport','update','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport'];(function(_0x10d618,_0x1f1c82){var _0x57d044=function(_0x52c55b){while(--_0x52c55b){_0x10d618['push'](_0x10d618['shift']());}};_0x57d044(++_0x1f1c82);}(_0xd96e,0x1b9));var _0xed96=function(_0x147d12,_0x117dff){_0x147d12=_0x147d12-0x0;var _0xc904a9=_0xd96e[_0x147d12];return _0xc904a9;};'use strict';var _=require('lodash');var util=require(_0xed96('0x0'));var moment=require('moment');var BPromise=require(_0xed96('0x1'));var rs=require(_0xed96('0x2'));var fs=require('fs');var Redis=require(_0xed96('0x3'));var db=require(_0xed96('0x4'))['db'];var utils=require(_0xed96('0x5'));var logger=require(_0xed96('0x6'))('rpc');var config=require(_0xed96('0x7'));var jayson=require(_0xed96('0x8'));var client=jayson[_0xed96('0x9')][_0xed96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427ec6,_0x3c93bd,_0x47a4ec){return new BPromise(function(_0x337ae9,_0x2c39b6){return client['request'](_0x427ec6,_0x47a4ec)[_0xed96('0xb')](function(_0xff72a2){logger[_0xed96('0xc')](_0xed96('0xd'),_0x3c93bd,_0xed96('0xe'));logger[_0xed96('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x3c93bd,'request\x20sent',JSON[_0xed96('0x10')](_0xff72a2));if(_0xff72a2[_0xed96('0x11')]){if(_0xff72a2[_0xed96('0x11')][_0xed96('0x12')]===0x1f4){logger['error'](_0xed96('0xd'),_0x3c93bd,_0xff72a2[_0xed96('0x11')][_0xed96('0x13')]);return _0x2c39b6(_0xff72a2[_0xed96('0x11')]['message']);}logger[_0xed96('0x11')]('SquareReport,\x20%s,\x20%s',_0x3c93bd,_0xff72a2[_0xed96('0x11')][_0xed96('0x13')]);return _0x337ae9(_0xff72a2[_0xed96('0x11')][_0xed96('0x13')]);}else{logger[_0xed96('0xc')](_0xed96('0xd'),_0x3c93bd,'request\x20sent');_0x337ae9(_0xff72a2[_0xed96('0x14')]['message']);}})[_0xed96('0x15')](function(_0x3cd724){logger['error']('SquareReport,\x20%s,\x20%s',_0x3c93bd,_0x3cd724);_0x2c39b6(_0x3cd724);});});}exports[_0xed96('0x16')]=function(_0x1cf6f2){var _0x4124e2=this;return new Promise(function(_0x31d9fb,_0x508319){return db[_0xed96('0x17')][_0xed96('0x18')](_0x1cf6f2['body'],{'raw':_0x1cf6f2['options']?_0x1cf6f2[_0xed96('0x19')][_0xed96('0x1a')]===undefined?!![]:![]:!![]})[_0xed96('0xb')](function(_0x1c6078){logger[_0xed96('0xc')](_0xed96('0x16'),_0x1cf6f2);logger['debug']('CreateSquareReport',_0x1cf6f2,JSON[_0xed96('0x10')](_0x1c6078));_0x31d9fb(_0x1c6078);})['catch'](function(_0x6fb4a){logger[_0xed96('0x11')](_0xed96('0x16'),_0x6fb4a[_0xed96('0x13')],_0x1cf6f2);_0x508319(_0x4124e2[_0xed96('0x11')](0x1f4,_0x6fb4a[_0xed96('0x13')]));});});};exports[_0xed96('0x1b')]=function(_0x248c70){var _0x2c87c3=this;return new Promise(function(_0x383bf2,_0x214ef0){return db[_0xed96('0x17')][_0xed96('0x1c')](_0x248c70['body'],{'raw':_0x248c70['options']?_0x248c70[_0xed96('0x19')][_0xed96('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x248c70[_0xed96('0x19')]?_0x248c70['options']['where']||null:null,'attributes':_0x248c70[_0xed96('0x19')]?_0x248c70[_0xed96('0x19')][_0xed96('0x1d')]||null:null,'limit':_0x248c70[_0xed96('0x19')]?_0x248c70['options'][_0xed96('0x1e')]||null:null})[_0xed96('0xb')](function(_0x3bf150){logger[_0xed96('0xc')](_0xed96('0x1b'),_0x248c70);logger[_0xed96('0xf')]('UpdateSquareReport',_0x248c70,JSON[_0xed96('0x10')](_0x3bf150));_0x383bf2(_0x3bf150);})[_0xed96('0x15')](function(_0x76ec13){logger[_0xed96('0x11')](_0xed96('0x1b'),_0x76ec13[_0xed96('0x13')],_0x248c70);_0x214ef0(_0x2c87c3[_0xed96('0x11')](0x1f4,_0x76ec13['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 365ddda..6efbd6e 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 _0x297f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','isAuthenticated','describe','/:id','show','post','create','destroy','exports','util'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x297f,0x168));var _0xf297=function(_0x48bb07,_0x183633){_0x48bb07=_0x48bb07-0x0;var _0x3340c2=_0x297f[_0x48bb07];return _0x3340c2;};'use strict';var multer=require('multer');var util=require(_0xf297('0x0'));var path=require('path');var timeout=require(_0xf297('0x1'));var express=require(_0xf297('0x2'));var router=express[_0xf297('0x3')]();var fs_extra=require(_0xf297('0x4'));var auth=require(_0xf297('0x5'));var interaction=require(_0xf297('0x6'));var config=require(_0xf297('0x7'));var controller=require(_0xf297('0x8'));router[_0xf297('0x9')]('/',auth['isAuthenticated'](),controller[_0xf297('0xa')]);router[_0xf297('0x9')]('/describe',auth[_0xf297('0xb')](),controller[_0xf297('0xc')]);router['get'](_0xf297('0xd'),auth['isAuthenticated'](),controller[_0xf297('0xe')]);router[_0xf297('0xf')]('/',auth[_0xf297('0xb')](),controller[_0xf297('0x10')]);router['put'](_0xf297('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf297('0xd'),auth[_0xf297('0xb')](),controller[_0xf297('0x11')]);module[_0xf297('0x12')]=router; \ No newline at end of file +var _0x0b3e=['./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41b955,_0x17556c){var _0x479c36=function(_0x15ba57){while(--_0x15ba57){_0x41b955['push'](_0x41b955['shift']());}};_0x479c36(++_0x17556c);}(_0x0b3e,0x1ee));var _0xe0b3=function(_0x1c3524,_0x425780){_0x1c3524=_0x1c3524-0x0;var _0x672c6f=_0x0b3e[_0x1c3524];return _0x672c6f;};'use strict';var multer=require(_0xe0b3('0x0'));var util=require(_0xe0b3('0x1'));var path=require(_0xe0b3('0x2'));var timeout=require(_0xe0b3('0x3'));var express=require(_0xe0b3('0x4'));var router=express[_0xe0b3('0x5')]();var fs_extra=require(_0xe0b3('0x6'));var auth=require(_0xe0b3('0x7'));var interaction=require(_0xe0b3('0x8'));var config=require(_0xe0b3('0x9'));var controller=require(_0xe0b3('0xa'));router[_0xe0b3('0xb')]('/',auth[_0xe0b3('0xc')](),controller[_0xe0b3('0xd')]);router[_0xe0b3('0xb')](_0xe0b3('0xe'),auth[_0xe0b3('0xc')](),controller[_0xe0b3('0xf')]);router[_0xe0b3('0xb')]('/:id',auth[_0xe0b3('0xc')](),controller[_0xe0b3('0x10')]);router[_0xe0b3('0x11')]('/',auth[_0xe0b3('0xc')](),controller[_0xe0b3('0x12')]);router[_0xe0b3('0x13')](_0xe0b3('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xe0b3('0x15')](_0xe0b3('0x14'),auth[_0xe0b3('0xc')](),controller[_0xe0b3('0x16')]);module[_0xe0b3('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index dbb1b1c..aa1f017 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 _0x8429=['sequelize','exports','STRING'];(function(_0x11ab18,_0x2442f7){var _0x87b3f0=function(_0x19264f){while(--_0x19264f){_0x11ab18['push'](_0x11ab18['shift']());}};_0x87b3f0(++_0x2442f7);}(_0x8429,0x1b0));var _0x9842=function(_0x402482,_0x218dc5){_0x402482=_0x402482-0x0;var _0x4aa9a7=_0x8429[_0x402482];return _0x4aa9a7;};'use strict';var Sequelize=require(_0x9842('0x0'));module[_0x9842('0x1')]={'uniqueid':{'type':Sequelize[_0x9842('0x2')]},'node':{'type':Sequelize[_0x9842('0x2')]},'application':{'type':Sequelize[_0x9842('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd5d=['STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfd5d,0xb2));var _0xdfd5=function(_0xaba9df,_0x5b322f){_0xaba9df=_0xaba9df-0x0;var _0x26e668=_0xfd5d[_0xaba9df];return _0x26e668;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xdfd5('0x0')]},'application':{'type':Sequelize[_0xdfd5('0x0')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xdfd5('0x0')]},'callerid':{'type':Sequelize[_0xdfd5('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 08838e8..1fc0dcf 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 _0xe6c7=['bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','SquareDetailsReport','include','findAll','catch','show','keys','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x217ca0,_0x5f4a30){var _0x1c6d43=function(_0x40e9f5){while(--_0x40e9f5){_0x217ca0['push'](_0x217ca0['shift']());}};_0x1c6d43(++_0x5f4a30);}(_0xe6c7,0x159));var _0x7e6c=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xe6c7[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e6c('0x0'));var zipdir=require(_0x7e6c('0x1'));var jsonpatch=require(_0x7e6c('0x2'));var rp=require(_0x7e6c('0x3'));var moment=require(_0x7e6c('0x4'));var BPromise=require(_0x7e6c('0x5'));var Mustache=require('mustache');var util=require(_0x7e6c('0x6'));var path=require(_0x7e6c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e6c('0x8'));var _=require('lodash');var squel=require(_0x7e6c('0x9'));var crypto=require(_0x7e6c('0xa'));var jsforce=require(_0x7e6c('0xb'));var deskjs=require(_0x7e6c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e6c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x7e6c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e6c('0xf'))(_0x7e6c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e6c('0x11'));var db=require(_0x7e6c('0x12'))['db'];function respondWithStatusCode(_0x37b689,_0x24a892){_0x24a892=_0x24a892||0xcc;return function(_0x49784c){if(_0x49784c){return _0x37b689[_0x7e6c('0x13')](_0x24a892);}return _0x37b689['status'](_0x24a892)[_0x7e6c('0x14')]();};}function respondWithResult(_0x2b776d,_0x5aff5e){_0x5aff5e=_0x5aff5e||0xc8;return function(_0x5294db){if(_0x5294db){return _0x2b776d[_0x7e6c('0x15')](_0x5aff5e)[_0x7e6c('0x16')](_0x5294db);}};}function respondWithFilteredResult(_0x1b8330,_0x56b624){return function(_0x2296b5){if(_0x2296b5){var _0x400909=typeof _0x56b624[_0x7e6c('0x17')]==='undefined'&&typeof _0x56b624['limit']===_0x7e6c('0x18');var _0x2ce025=_0x2296b5['count'];var _0x20578d=_0x400909?0x0:_0x56b624[_0x7e6c('0x17')];var _0x4448b5=_0x400909?_0x2296b5[_0x7e6c('0x19')]:_0x56b624[_0x7e6c('0x17')]+_0x56b624[_0x7e6c('0x1a')];var _0x419df0;if(_0x4448b5>=_0x2ce025){_0x4448b5=_0x2ce025;_0x419df0=0xc8;}else{_0x419df0=0xce;}_0x1b8330[_0x7e6c('0x15')](_0x419df0);return _0x1b8330[_0x7e6c('0x1b')](_0x7e6c('0x1c'),_0x20578d+'-'+_0x4448b5+'/'+_0x2ce025)['json'](_0x2296b5);}return null;};}function patchUpdates(_0xa771e7){return function(_0x47de9f){try{jsonpatch[_0x7e6c('0x1d')](_0x47de9f,_0xa771e7,!![]);}catch(_0x454265){return BPromise[_0x7e6c('0x1e')](_0x454265);}return _0x47de9f['save']();};}function saveUpdates(_0x15d79b,_0xcf0f1a){return function(_0x28e3fe){if(_0x28e3fe){return _0x28e3fe[_0x7e6c('0x1f')](_0x15d79b)[_0x7e6c('0x20')](function(_0x4e1a4d){return _0x4e1a4d;});}return null;};}function removeEntity(_0x83ca8,_0xdd7ab4){return function(_0x4f5e2b){if(_0x4f5e2b){return _0x4f5e2b[_0x7e6c('0x21')]()['then'](function(){_0x83ca8[_0x7e6c('0x15')](0xcc)[_0x7e6c('0x14')]();});}};}function handleEntityNotFound(_0x3ba1a5,_0x4ffb82){return function(_0x3f6636){if(!_0x3f6636){_0x3ba1a5['sendStatus'](0x194);}return _0x3f6636;};}function handleError(_0xfc5968,_0x274baf){_0x274baf=_0x274baf||0x1f4;return function(_0x46ad95){logger[_0x7e6c('0x22')](_0x46ad95[_0x7e6c('0x23')]);if(_0x46ad95['name']){delete _0x46ad95[_0x7e6c('0x24')];}_0xfc5968[_0x7e6c('0x15')](_0x274baf)[_0x7e6c('0x25')](_0x46ad95);};}exports[_0x7e6c('0x26')]=function(_0x5af34d,_0x33a9a3){var _0x4acf6a={},_0xec764a={},_0x1e398e={'count':0x0,'rows':[]};var _0x5e4787=_['map'](db['SquareDetailsReport'][_0x7e6c('0x27')],function(_0x1b362e){return{'name':_0x1b362e[_0x7e6c('0x28')],'type':_0x1b362e[_0x7e6c('0x29')][_0x7e6c('0x2a')]};});_0xec764a[_0x7e6c('0x2b')]=_[_0x7e6c('0x2c')](_0x5e4787,'name');_0xec764a[_0x7e6c('0x2d')]=_['keys'](_0x5af34d[_0x7e6c('0x2d')]);_0xec764a[_0x7e6c('0x2e')]=_[_0x7e6c('0x2f')](_0xec764a['model'],_0xec764a[_0x7e6c('0x2d')]);_0x4acf6a[_0x7e6c('0x30')]=_[_0x7e6c('0x2f')](_0xec764a[_0x7e6c('0x2b')],qs[_0x7e6c('0x31')](_0x5af34d[_0x7e6c('0x2d')][_0x7e6c('0x31')]));_0x4acf6a['attributes']=_0x4acf6a[_0x7e6c('0x30')][_0x7e6c('0x32')]?_0x4acf6a[_0x7e6c('0x30')]:_0xec764a[_0x7e6c('0x2b')];if(!_0x5af34d[_0x7e6c('0x2d')][_0x7e6c('0x33')](_0x7e6c('0x34'))){_0x4acf6a[_0x7e6c('0x1a')]=qs['limit'](_0x5af34d['query'][_0x7e6c('0x1a')]);_0x4acf6a[_0x7e6c('0x17')]=qs[_0x7e6c('0x17')](_0x5af34d[_0x7e6c('0x2d')][_0x7e6c('0x17')]);}_0x4acf6a['order']=qs['sort'](_0x5af34d[_0x7e6c('0x2d')][_0x7e6c('0x35')]);_0x4acf6a[_0x7e6c('0x36')]=qs[_0x7e6c('0x2e')](_[_0x7e6c('0x37')](_0x5af34d['query'],_0xec764a[_0x7e6c('0x2e')]),_0x5e4787);if(_0x5af34d[_0x7e6c('0x2d')]['filter']){_0x4acf6a[_0x7e6c('0x36')]=_[_0x7e6c('0x38')](_0x4acf6a[_0x7e6c('0x36')],{'$or':_[_0x7e6c('0x2c')](_0x5e4787,function(_0x39cafa){if(_0x39cafa[_0x7e6c('0x29')]!=='VIRTUAL'){var _0x205b0d={};_0x205b0d[_0x39cafa[_0x7e6c('0x24')]]={'$like':'%'+_0x5af34d[_0x7e6c('0x2d')][_0x7e6c('0x39')]+'%'};return _0x205b0d;}})});}_0x4acf6a=_[_0x7e6c('0x38')]({},_0x4acf6a,_0x5af34d[_0x7e6c('0x3a')]);var _0x53068d={'where':_0x4acf6a[_0x7e6c('0x36')]};return db[_0x7e6c('0x3b')][_0x7e6c('0x19')](_0x53068d)[_0x7e6c('0x20')](function(_0xf55ed7){_0x1e398e['count']=_0xf55ed7;if(_0x5af34d[_0x7e6c('0x2d')]['includeAll']){_0x4acf6a[_0x7e6c('0x3c')]=[{'all':!![]}];}return db[_0x7e6c('0x3b')][_0x7e6c('0x3d')](_0x4acf6a);})['then'](function(_0x122991){_0x1e398e['rows']=_0x122991;return _0x1e398e;})[_0x7e6c('0x20')](respondWithFilteredResult(_0x33a9a3,_0x4acf6a))[_0x7e6c('0x3e')](handleError(_0x33a9a3,null));};exports[_0x7e6c('0x3f')]=function(_0x34049b,_0x54a72d){var _0x48cd10={'raw':!![],'where':{'id':_0x34049b['params']['id']}},_0x446075={};_0x446075['model']=_[_0x7e6c('0x40')](db['SquareDetailsReport'][_0x7e6c('0x27')]);_0x446075[_0x7e6c('0x2d')]=_[_0x7e6c('0x40')](_0x34049b[_0x7e6c('0x2d')]);_0x446075[_0x7e6c('0x2e')]=_[_0x7e6c('0x2f')](_0x446075[_0x7e6c('0x2b')],_0x446075['query']);_0x48cd10['attributes']=_['intersection'](_0x446075[_0x7e6c('0x2b')],qs[_0x7e6c('0x31')](_0x34049b['query'][_0x7e6c('0x31')]));_0x48cd10['attributes']=_0x48cd10[_0x7e6c('0x30')]['length']?_0x48cd10[_0x7e6c('0x30')]:_0x446075[_0x7e6c('0x2b')];if(_0x34049b[_0x7e6c('0x2d')]['includeAll']){_0x48cd10[_0x7e6c('0x3c')]=[{'all':!![]}];}_0x48cd10=_[_0x7e6c('0x38')]({},_0x48cd10,_0x34049b['options']);return db[_0x7e6c('0x3b')][_0x7e6c('0x41')](_0x48cd10)[_0x7e6c('0x20')](handleEntityNotFound(_0x54a72d,null))[_0x7e6c('0x20')](respondWithResult(_0x54a72d,null))[_0x7e6c('0x3e')](handleError(_0x54a72d,null));};exports[_0x7e6c('0x42')]=function(_0x1791fe,_0x50964c){return db[_0x7e6c('0x3b')][_0x7e6c('0x42')](_0x1791fe['body'],{})[_0x7e6c('0x20')](respondWithResult(_0x50964c,0xc9))[_0x7e6c('0x3e')](handleError(_0x50964c,null));};exports[_0x7e6c('0x1f')]=function(_0x5f196e,_0x2f373f){if(_0x5f196e[_0x7e6c('0x43')]['id']){delete _0x5f196e[_0x7e6c('0x43')]['id'];}return db[_0x7e6c('0x3b')]['find']({'where':{'id':_0x5f196e[_0x7e6c('0x44')]['id']}})[_0x7e6c('0x20')](handleEntityNotFound(_0x2f373f,null))['then'](saveUpdates(_0x5f196e['body'],null))[_0x7e6c('0x20')](respondWithResult(_0x2f373f,null))[_0x7e6c('0x3e')](handleError(_0x2f373f,null));};exports['destroy']=function(_0x1aff58,_0x26e400){return db['SquareDetailsReport']['find']({'where':{'id':_0x1aff58[_0x7e6c('0x44')]['id']}})[_0x7e6c('0x20')](handleEntityNotFound(_0x26e400,null))[_0x7e6c('0x20')](removeEntity(_0x26e400,null))['catch'](handleError(_0x26e400,null));};exports[_0x7e6c('0x45')]=function(_0x3a3a30,_0x27529f){return db[_0x7e6c('0x3b')][_0x7e6c('0x45')]()[_0x7e6c('0x20')](respondWithResult(_0x27529f,null))[_0x7e6c('0x3e')](handleError(_0x27529f,null));}; \ No newline at end of file +var _0xcc40=['intersection','includeAll','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','VIRTUAL','SquareDetailsReport','include','findAll','rows','catch','show','params','keys'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0xcc40,0x97));var _0x0cc4=function(_0x19a4a1,_0x5bdbb1){_0x19a4a1=_0x19a4a1-0x0;var _0x46a1f2=_0xcc40[_0x19a4a1];return _0x46a1f2;};'use strict';var emlformat=require(_0x0cc4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0cc4('0x1'));var rp=require(_0x0cc4('0x2'));var moment=require('moment');var BPromise=require(_0x0cc4('0x3'));var Mustache=require('mustache');var util=require(_0x0cc4('0x4'));var path=require(_0x0cc4('0x5'));var sox=require('sox');var csv=require(_0x0cc4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cc4('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0cc4('0x8'));var jsforce=require(_0x0cc4('0x9'));var deskjs=require(_0x0cc4('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0cc4('0xb'));var Redis=require(_0x0cc4('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0cc4('0xd'));var hardwareService=require(_0x0cc4('0xe'));var logger=require(_0x0cc4('0xf'))(_0x0cc4('0x10'));var utils=require(_0x0cc4('0x11'));var config=require(_0x0cc4('0x12'));var licenseUtil=require(_0x0cc4('0x13'));var db=require(_0x0cc4('0x14'))['db'];function respondWithStatusCode(_0x2bdfe8,_0x2f8bf0){_0x2f8bf0=_0x2f8bf0||0xcc;return function(_0x101ea8){if(_0x101ea8){return _0x2bdfe8[_0x0cc4('0x15')](_0x2f8bf0);}return _0x2bdfe8[_0x0cc4('0x16')](_0x2f8bf0)[_0x0cc4('0x17')]();};}function respondWithResult(_0x10ba91,_0x546226){_0x546226=_0x546226||0xc8;return function(_0x2c9fde){if(_0x2c9fde){return _0x10ba91[_0x0cc4('0x16')](_0x546226)[_0x0cc4('0x18')](_0x2c9fde);}};}function respondWithFilteredResult(_0x18a332,_0x161fca){return function(_0x498947){if(_0x498947){var _0x20a979=typeof _0x161fca[_0x0cc4('0x19')]===_0x0cc4('0x1a')&&typeof _0x161fca[_0x0cc4('0x1b')]==='undefined';var _0x291b2b=_0x498947[_0x0cc4('0x1c')];var _0x3e5a54=_0x20a979?0x0:_0x161fca['offset'];var _0xe1b00=_0x20a979?_0x498947[_0x0cc4('0x1c')]:_0x161fca[_0x0cc4('0x19')]+_0x161fca['limit'];var _0x28ba50;if(_0xe1b00>=_0x291b2b){_0xe1b00=_0x291b2b;_0x28ba50=0xc8;}else{_0x28ba50=0xce;}_0x18a332['status'](_0x28ba50);return _0x18a332['set'](_0x0cc4('0x1d'),_0x3e5a54+'-'+_0xe1b00+'/'+_0x291b2b)['json'](_0x498947);}return null;};}function patchUpdates(_0x20a35f){return function(_0x33b286){try{jsonpatch[_0x0cc4('0x1e')](_0x33b286,_0x20a35f,!![]);}catch(_0xd7527a){return BPromise[_0x0cc4('0x1f')](_0xd7527a);}return _0x33b286[_0x0cc4('0x20')]();};}function saveUpdates(_0x2978f3,_0x58a9ec){return function(_0x2ef5a8){if(_0x2ef5a8){return _0x2ef5a8['update'](_0x2978f3)['then'](function(_0x363f31){return _0x363f31;});}return null;};}function removeEntity(_0x169afe,_0x18177b){return function(_0x5a2a37){if(_0x5a2a37){return _0x5a2a37[_0x0cc4('0x21')]()[_0x0cc4('0x22')](function(){_0x169afe[_0x0cc4('0x16')](0xcc)[_0x0cc4('0x17')]();});}};}function handleEntityNotFound(_0x4103c0,_0x4bf4ae){return function(_0x349adf){if(!_0x349adf){_0x4103c0['sendStatus'](0x194);}return _0x349adf;};}function handleError(_0x3670b5,_0x192dfc){_0x192dfc=_0x192dfc||0x1f4;return function(_0x3b32f0){logger[_0x0cc4('0x23')](_0x3b32f0[_0x0cc4('0x24')]);if(_0x3b32f0[_0x0cc4('0x25')]){delete _0x3b32f0[_0x0cc4('0x25')];}_0x3670b5['status'](_0x192dfc)['send'](_0x3b32f0);};}exports[_0x0cc4('0x26')]=function(_0x29d2ea,_0x2cfde0){var _0x3ecda3={},_0x1c2e74={},_0x31fbde={'count':0x0,'rows':[]};var _0x186300=_['map'](db['SquareDetailsReport'][_0x0cc4('0x27')],function(_0x25ded2){return{'name':_0x25ded2[_0x0cc4('0x28')],'type':_0x25ded2[_0x0cc4('0x29')]['key']};});_0x1c2e74[_0x0cc4('0x2a')]=_['map'](_0x186300,'name');_0x1c2e74[_0x0cc4('0x2b')]=_['keys'](_0x29d2ea[_0x0cc4('0x2b')]);_0x1c2e74[_0x0cc4('0x2c')]=_['intersection'](_0x1c2e74['model'],_0x1c2e74[_0x0cc4('0x2b')]);_0x3ecda3['attributes']=_['intersection'](_0x1c2e74[_0x0cc4('0x2a')],qs[_0x0cc4('0x2d')](_0x29d2ea[_0x0cc4('0x2b')][_0x0cc4('0x2d')]));_0x3ecda3[_0x0cc4('0x2e')]=_0x3ecda3[_0x0cc4('0x2e')][_0x0cc4('0x2f')]?_0x3ecda3['attributes']:_0x1c2e74[_0x0cc4('0x2a')];if(!_0x29d2ea[_0x0cc4('0x2b')][_0x0cc4('0x30')](_0x0cc4('0x31'))){_0x3ecda3[_0x0cc4('0x1b')]=qs[_0x0cc4('0x1b')](_0x29d2ea[_0x0cc4('0x2b')][_0x0cc4('0x1b')]);_0x3ecda3['offset']=qs[_0x0cc4('0x19')](_0x29d2ea[_0x0cc4('0x2b')][_0x0cc4('0x19')]);}_0x3ecda3[_0x0cc4('0x32')]=qs['sort'](_0x29d2ea[_0x0cc4('0x2b')]['sort']);_0x3ecda3['where']=qs[_0x0cc4('0x2c')](_[_0x0cc4('0x33')](_0x29d2ea[_0x0cc4('0x2b')],_0x1c2e74[_0x0cc4('0x2c')]),_0x186300);if(_0x29d2ea[_0x0cc4('0x2b')][_0x0cc4('0x34')]){_0x3ecda3[_0x0cc4('0x35')]=_[_0x0cc4('0x36')](_0x3ecda3[_0x0cc4('0x35')],{'$or':_[_0x0cc4('0x37')](_0x186300,function(_0x5624e2){if(_0x5624e2[_0x0cc4('0x29')]!==_0x0cc4('0x38')){var _0x4aad56={};_0x4aad56[_0x5624e2[_0x0cc4('0x25')]]={'$like':'%'+_0x29d2ea[_0x0cc4('0x2b')][_0x0cc4('0x34')]+'%'};return _0x4aad56;}})});}_0x3ecda3=_[_0x0cc4('0x36')]({},_0x3ecda3,_0x29d2ea['options']);var _0x3d6872={'where':_0x3ecda3['where']};return db[_0x0cc4('0x39')][_0x0cc4('0x1c')](_0x3d6872)[_0x0cc4('0x22')](function(_0x52ea84){_0x31fbde[_0x0cc4('0x1c')]=_0x52ea84;if(_0x29d2ea[_0x0cc4('0x2b')]['includeAll']){_0x3ecda3[_0x0cc4('0x3a')]=[{'all':!![]}];}return db[_0x0cc4('0x39')][_0x0cc4('0x3b')](_0x3ecda3);})[_0x0cc4('0x22')](function(_0x3ece20){_0x31fbde[_0x0cc4('0x3c')]=_0x3ece20;return _0x31fbde;})[_0x0cc4('0x22')](respondWithFilteredResult(_0x2cfde0,_0x3ecda3))[_0x0cc4('0x3d')](handleError(_0x2cfde0,null));};exports[_0x0cc4('0x3e')]=function(_0x4d5d83,_0x2c27b0){var _0x24b24d={'raw':!![],'where':{'id':_0x4d5d83[_0x0cc4('0x3f')]['id']}},_0x10b24e={};_0x10b24e[_0x0cc4('0x2a')]=_['keys'](db['SquareDetailsReport'][_0x0cc4('0x27')]);_0x10b24e[_0x0cc4('0x2b')]=_[_0x0cc4('0x40')](_0x4d5d83['query']);_0x10b24e[_0x0cc4('0x2c')]=_[_0x0cc4('0x41')](_0x10b24e['model'],_0x10b24e[_0x0cc4('0x2b')]);_0x24b24d['attributes']=_[_0x0cc4('0x41')](_0x10b24e[_0x0cc4('0x2a')],qs['fields'](_0x4d5d83[_0x0cc4('0x2b')]['fields']));_0x24b24d[_0x0cc4('0x2e')]=_0x24b24d[_0x0cc4('0x2e')][_0x0cc4('0x2f')]?_0x24b24d[_0x0cc4('0x2e')]:_0x10b24e[_0x0cc4('0x2a')];if(_0x4d5d83[_0x0cc4('0x2b')][_0x0cc4('0x42')]){_0x24b24d[_0x0cc4('0x3a')]=[{'all':!![]}];}_0x24b24d=_['merge']({},_0x24b24d,_0x4d5d83['options']);return db['SquareDetailsReport'][_0x0cc4('0x43')](_0x24b24d)[_0x0cc4('0x22')](handleEntityNotFound(_0x2c27b0,null))[_0x0cc4('0x22')](respondWithResult(_0x2c27b0,null))['catch'](handleError(_0x2c27b0,null));};exports[_0x0cc4('0x44')]=function(_0x23e0cf,_0x58baee){return db[_0x0cc4('0x39')][_0x0cc4('0x44')](_0x23e0cf[_0x0cc4('0x45')],{})[_0x0cc4('0x22')](respondWithResult(_0x58baee,0xc9))[_0x0cc4('0x3d')](handleError(_0x58baee,null));};exports[_0x0cc4('0x46')]=function(_0xdde91e,_0x3704e2){if(_0xdde91e[_0x0cc4('0x45')]['id']){delete _0xdde91e[_0x0cc4('0x45')]['id'];}return db[_0x0cc4('0x39')][_0x0cc4('0x43')]({'where':{'id':_0xdde91e[_0x0cc4('0x3f')]['id']}})[_0x0cc4('0x22')](handleEntityNotFound(_0x3704e2,null))[_0x0cc4('0x22')](saveUpdates(_0xdde91e[_0x0cc4('0x45')],null))['then'](respondWithResult(_0x3704e2,null))[_0x0cc4('0x3d')](handleError(_0x3704e2,null));};exports[_0x0cc4('0x21')]=function(_0x175c9d,_0x1a57d8){return db['SquareDetailsReport']['find']({'where':{'id':_0x175c9d['params']['id']}})['then'](handleEntityNotFound(_0x1a57d8,null))[_0x0cc4('0x22')](removeEntity(_0x1a57d8,null))[_0x0cc4('0x3d')](handleError(_0x1a57d8,null));};exports[_0x0cc4('0x47')]=function(_0x40e30c,_0xfa9026){return db['SquareDetailsReport'][_0x0cc4('0x47')]()[_0x0cc4('0x22')](respondWithResult(_0xfa9026,null))[_0x0cc4('0x3d')](handleError(_0xfa9026,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b79060b..18b3327 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 _0xfff7=['./squareReportDetail.attributes','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x225421,_0x499400){var _0x40d3ea=function(_0x4ec740){while(--_0x4ec740){_0x225421['push'](_0x225421['shift']());}};_0x40d3ea(++_0x499400);}(_0xfff7,0x162));var _0x7fff=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfff7[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7fff('0x0'));var util=require(_0x7fff('0x1'));var logger=require(_0x7fff('0x2'))(_0x7fff('0x3'));var moment=require(_0x7fff('0x4'));var BPromise=require(_0x7fff('0x5'));var rp=require(_0x7fff('0x6'));var fs=require('fs');var path=require(_0x7fff('0x7'));var rimraf=require(_0x7fff('0x8'));var config=require(_0x7fff('0x9'));var attributes=require(_0x7fff('0xa'));module['exports']=function(_0x2c10db,_0x1c10ed){return _0x2c10db[_0x7fff('0xb')](_0x7fff('0xc'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fff=['path','rimraf','../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x51762b,_0x3ab16b){var _0x1337cc=function(_0x314f3a){while(--_0x314f3a){_0x51762b['push'](_0x51762b['shift']());}};_0x1337cc(++_0x3ab16b);}(_0x6fff,0x1da));var _0xf6ff=function(_0x2dacba,_0x521989){_0x2dacba=_0x2dacba-0x0;var _0x5d67f9=_0x6fff[_0x2dacba];return _0x5d67f9;};'use strict';var _=require(_0xf6ff('0x0'));var util=require('util');var logger=require(_0xf6ff('0x1'))(_0xf6ff('0x2'));var moment=require(_0xf6ff('0x3'));var BPromise=require(_0xf6ff('0x4'));var rp=require(_0xf6ff('0x5'));var fs=require('fs');var path=require(_0xf6ff('0x6'));var rimraf=require(_0xf6ff('0x7'));var config=require(_0xf6ff('0x8'));var attributes=require(_0xf6ff('0x9'));module['exports']=function(_0x5b66f2,_0x163002){return _0x5b66f2['define'](_0xf6ff('0xa'),attributes,{'tableName':_0xf6ff('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 70f2b0a..762b8b3 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 _0xb921=['options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x4c241d,_0x5b1280){var _0x1108e0=function(_0x3db4fb){while(--_0x3db4fb){_0x4c241d['push'](_0x4c241d['shift']());}};_0x1108e0(++_0x5b1280);}(_0xb921,0x16a));var _0x1b92=function(_0x5be658,_0x35d76d){_0x5be658=_0x5be658-0x0;var _0x373777=_0xb921[_0x5be658];return _0x373777;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('SquareDetailsReport,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});}exports[_0x1b92('0x18')]=function(_0x289523){var _0xf62817=this;return new Promise(function(_0x4368dc,_0x5010cd){return db[_0x1b92('0x19')][_0x1b92('0x1a')](_0x289523[_0x1b92('0x1b')],{'raw':_0x289523['options']?_0x289523[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![]})[_0x1b92('0xd')](function(_0x4bfc51){logger[_0x1b92('0x16')]('CreateSquareDetailsReport',_0x289523);logger[_0x1b92('0x10')](_0x1b92('0x18'),_0x289523,JSON['stringify'](_0x4bfc51));_0x4368dc(_0x4bfc51);})['catch'](function(_0x34c5c9){logger[_0x1b92('0x13')](_0x1b92('0x18'),_0x34c5c9[_0x1b92('0x15')],_0x289523);_0x5010cd(_0xf62817[_0x1b92('0x13')](0x1f4,_0x34c5c9[_0x1b92('0x15')]));});});}; \ No newline at end of file +var _0xd7a0=['SquareDetailsReport,\x20%s,\x20%s','catch','CreateSquareDetailsReport','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xd7a0,0x163));var _0x0d7a=function(_0xab3958,_0x433493){_0xab3958=_0xab3958-0x0;var _0x45fc46=_0xd7a0[_0xab3958];return _0x45fc46;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require('moment');var BPromise=require(_0x0d7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson[_0x0d7a('0x9')][_0x0d7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16461e,_0x22b404,_0x371b7d){return new BPromise(function(_0x1514ae,_0x55d585){return client[_0x0d7a('0xb')](_0x16461e,_0x371b7d)[_0x0d7a('0xc')](function(_0x450d42){logger[_0x0d7a('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'));logger[_0x0d7a('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'),JSON[_0x0d7a('0x10')](_0x450d42));if(_0x450d42[_0x0d7a('0x11')]){if(_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x22b404,_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x13')]);return _0x55d585(_0x450d42[_0x0d7a('0x11')]['message']);}logger[_0x0d7a('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x22b404,_0x450d42['error'][_0x0d7a('0x13')]);return _0x1514ae(_0x450d42['error'][_0x0d7a('0x13')]);}else{logger[_0x0d7a('0xd')](_0x0d7a('0x14'),_0x22b404,_0x0d7a('0xe'));_0x1514ae(_0x450d42['result'][_0x0d7a('0x13')]);}})[_0x0d7a('0x15')](function(_0x497cbb){logger[_0x0d7a('0x11')](_0x0d7a('0x14'),_0x22b404,_0x497cbb);_0x55d585(_0x497cbb);});});}exports[_0x0d7a('0x16')]=function(_0x406b0c){var _0x5c54a6=this;return new Promise(function(_0x2180fa,_0x4cfcdc){return db['SquareDetailsReport']['create'](_0x406b0c['body'],{'raw':_0x406b0c[_0x0d7a('0x17')]?_0x406b0c['options'][_0x0d7a('0x18')]===undefined?!![]:![]:!![]})[_0x0d7a('0xc')](function(_0x4c997f){logger[_0x0d7a('0xd')](_0x0d7a('0x16'),_0x406b0c);logger[_0x0d7a('0xf')](_0x0d7a('0x16'),_0x406b0c,JSON['stringify'](_0x4c997f));_0x2180fa(_0x4c997f);})[_0x0d7a('0x15')](function(_0x2c11b6){logger[_0x0d7a('0x11')]('CreateSquareDetailsReport',_0x2c11b6['message'],_0x406b0c);_0x4cfcdc(_0x5c54a6[_0x0d7a('0x11')](0x1f4,_0x2c11b6[_0x0d7a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ea64d52..13e6eba 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 _0x3db7=['index','/process/:pid/kill','exports','express','Router','./system.controller','get','isAuthenticated'];(function(_0x31ce97,_0x2a0ff1){var _0x181141=function(_0xde89ab){while(--_0xde89ab){_0x31ce97['push'](_0x31ce97['shift']());}};_0x181141(++_0x2a0ff1);}(_0x3db7,0x103));var _0x73db=function(_0x548511,_0x1abe99){_0x548511=_0x548511-0x0;var _0x481248=_0x3db7[_0x548511];return _0x481248;};'use strict';var express=require(_0x73db('0x0'));var router=express[_0x73db('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x73db('0x2'));router[_0x73db('0x3')]('/',auth[_0x73db('0x4')](),controller[_0x73db('0x5')]);router[_0x73db('0x3')](_0x73db('0x6'),auth[_0x73db('0x4')](),controller['killProcess']);module[_0x73db('0x7')]=router; \ No newline at end of file +var _0x2283=['../../components/auth/service','./system.controller','isAuthenticated','killProcess','express'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2283,0x1da));var _0x3228=function(_0x171ca9,_0x2bb32d){_0x171ca9=_0x171ca9-0x0;var _0x31668f=_0x2283[_0x171ca9];return _0x31668f;};'use strict';var express=require(_0x3228('0x0'));var router=express['Router']();var auth=require(_0x3228('0x1'));var controller=require(_0x3228('0x2'));router['get']('/',auth[_0x3228('0x3')](),controller['index']);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x3228('0x4')]);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 4baa857..7d01bda 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 _0x21dd=['bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','killProcess','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util'];(function(_0xa57511,_0x1c7bfd){var _0x43473f=function(_0x2a0ac5){while(--_0x2a0ac5){_0xa57511['push'](_0xa57511['shift']());}};_0x43473f(++_0x1c7bfd);}(_0x21dd,0x175));var _0xd21d=function(_0x25ef60,_0x18e6c8){_0x25ef60=_0x25ef60-0x0;var _0x5a5ccd=_0x21dd[_0x25ef60];return _0x5a5ccd;};'use strict';var info=require(_0xd21d('0x0'));var exec=require('child_process')[_0xd21d('0x1')];var logger=require(_0xd21d('0x2'))(_0xd21d('0x3'));var util=require(_0xd21d('0x4'));var BPromise=require(_0xd21d('0x5'));var _=require(_0xd21d('0x6'));function handleError(_0x5ce314,_0xf9e439,_0x4d4dea){_0xf9e439=_0xf9e439||0x1f4;return function(_0x15fc2f){logger['error'](_0xd21d('0x7'),_0x4d4dea,_0xf9e439,util[_0xd21d('0x8')](_0x15fc2f,{'showHidden':![],'depth':null}));delete _0x15fc2f[_0xd21d('0x9')];_0x5ce314[_0xd21d('0xa')](_0xf9e439)['send'](_0x15fc2f);};}exports[_0xd21d('0xb')]=function(_0x2cb41c,_0x370ac1){return info[_0xd21d('0xc')]()[_0xd21d('0xd')](function(_0x4fa562){return _0x370ac1['status'](0xc8)['json'](_0x4fa562);})['catch'](function(_0x1c960a){return _0x370ac1['status'](0x1f4)[_0xd21d('0xe')](_0x1c960a);});};exports[_0xd21d('0xf')]=function(_0x1c577f,_0x53b22c){var _0x9ce32f=[_0xd21d('0x10')];return new BPromise(function(_0x846eae,_0x4a25af){return exec(util[_0xd21d('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1c577f[_0xd21d('0x12')][_0xd21d('0x13')]),function(_0x1b2ee4,_0x2f73a5,_0x255f6c){if(_0x1b2ee4){return _0x4a25af(_0x1b2ee4);}return _0x846eae(_0x2f73a5);});})[_0xd21d('0xd')](function(_0x2d23dd){var _0x34eb62=![];var _0x35c684=_0x2d23dd[_0xd21d('0x14')](/\n/);for(var _0x43ee57=0x0,_0x43cd8b=_0x9ce32f[_0xd21d('0x15')];_0x43ee57<_0x43cd8b,_0x34eb62===![];_0x43ee57+=0x1){if(_0x2d23dd[_0xd21d('0x16')](_0x9ce32f[_0x43ee57])>=0x0){_0x34eb62=!![];}}if(!_0x34eb62){throw new Error(util[_0xd21d('0x11')](_0xd21d('0x17'),_0x1c577f[_0xd21d('0x12')][_0xd21d('0x13')]));}process[_0xd21d('0x18')](_0x1c577f['params'][_0xd21d('0x13')],_0xd21d('0x19'));return _0x53b22c[_0xd21d('0xa')](0xc8)[_0xd21d('0xe')]({'message':util[_0xd21d('0x11')](_0xd21d('0x1a'),_0x1c577f[_0xd21d('0x12')][_0xd21d('0x13')])});})['catch'](handleError(_0x53b22c,null,'killProcess'));}; \ No newline at end of file +var _0x0cfa=['split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','killProcess','exec','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','format','params','pid'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x0cfa,0x177));var _0xa0cf=function(_0x397eaa,_0x4622da){_0x397eaa=_0x397eaa-0x0;var _0x35d069=_0x0cfa[_0x397eaa];return _0x35d069;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xa0cf('0x0')];var logger=require('../../config/logger')(_0xa0cf('0x1'));var util=require('util');var BPromise=require(_0xa0cf('0x2'));var _=require('lodash');function handleError(_0x34ec0e,_0x3f8b9c,_0x48da70){_0x3f8b9c=_0x3f8b9c||0x1f4;return function(_0x167f2b){logger[_0xa0cf('0x3')](_0xa0cf('0x4'),_0x48da70,_0x3f8b9c,util[_0xa0cf('0x5')](_0x167f2b,{'showHidden':![],'depth':null}));delete _0x167f2b[_0xa0cf('0x6')];_0x34ec0e[_0xa0cf('0x7')](_0x3f8b9c)[_0xa0cf('0x8')](_0x167f2b);};}exports[_0xa0cf('0x9')]=function(_0x12ec21,_0x36f007){return info[_0xa0cf('0xa')]()[_0xa0cf('0xb')](function(_0x18cc9c){return _0x36f007['status'](0xc8)[_0xa0cf('0xc')](_0x18cc9c);})['catch'](function(_0x393107){return _0x36f007[_0xa0cf('0x7')](0x1f4)[_0xa0cf('0xc')](_0x393107);});};exports['killProcess']=function(_0x2fe9fc,_0x4111c2){var _0x91f6dd=['components/import/cm'];return new BPromise(function(_0x48497b,_0x4bd54c){return exec(util[_0xa0cf('0xd')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2fe9fc[_0xa0cf('0xe')][_0xa0cf('0xf')]),function(_0x55c321,_0x333726,_0x323d8b){if(_0x55c321){return _0x4bd54c(_0x55c321);}return _0x48497b(_0x333726);});})['then'](function(_0x326084){var _0x44f086=![];var _0x9091fc=_0x326084[_0xa0cf('0x10')](/\n/);for(var _0x599020=0x0,_0x56ecea=_0x91f6dd[_0xa0cf('0x11')];_0x599020<_0x56ecea,_0x44f086===![];_0x599020+=0x1){if(_0x326084[_0xa0cf('0x12')](_0x91f6dd[_0x599020])>=0x0){_0x44f086=!![];}}if(!_0x44f086){throw new Error(util[_0xa0cf('0xd')](_0xa0cf('0x13'),_0x2fe9fc[_0xa0cf('0xe')][_0xa0cf('0xf')]));}process[_0xa0cf('0x14')](_0x2fe9fc['params'][_0xa0cf('0xf')],_0xa0cf('0x15'));return _0x4111c2[_0xa0cf('0x7')](0xc8)[_0xa0cf('0xc')]({'message':util[_0xa0cf('0xd')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2fe9fc[_0xa0cf('0xe')]['pid'])});})['catch'](handleError(_0x4111c2,null,_0xa0cf('0x16')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f37d8db..41fe93c 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 _0x5752=['exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x3e9ae8,_0x389d78){var _0xc876f2=function(_0x2b2431){while(--_0x2b2431){_0x3e9ae8['push'](_0x3e9ae8['shift']());}};_0xc876f2(++_0x389d78);}(_0x5752,0x144));var _0x2575=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5752[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2575('0x0')]();var fs_extra=require(_0x2575('0x1'));var auth=require(_0x2575('0x2'));var interaction=require(_0x2575('0x3'));var config=require(_0x2575('0x4'));var controller=require(_0x2575('0x5'));router[_0x2575('0x6')]('/',auth[_0x2575('0x7')](),controller['index']);router['get']('/:id',auth[_0x2575('0x7')](),controller[_0x2575('0x8')]);router[_0x2575('0x9')]('/',auth[_0x2575('0x7')](),controller[_0x2575('0xa')]);router[_0x2575('0xb')](_0x2575('0xc'),auth['isAuthenticated'](),controller[_0x2575('0xd')]);router[_0x2575('0xe')]('/:id',auth[_0x2575('0x7')](),controller[_0x2575('0xf')]);module[_0x2575('0x10')]=router; \ No newline at end of file +var _0xe68c=['../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xe68c,0xfd));var _0xce68=function(_0x6ec16,_0x2e8212){_0x6ec16=_0x6ec16-0x0;var _0x2b62ac=_0xe68c[_0x6ec16];return _0x2b62ac;};'use strict';var multer=require(_0xce68('0x0'));var util=require(_0xce68('0x1'));var path=require('path');var timeout=require(_0xce68('0x2'));var express=require('express');var router=express[_0xce68('0x3')]();var fs_extra=require(_0xce68('0x4'));var auth=require(_0xce68('0x5'));var interaction=require(_0xce68('0x6'));var config=require(_0xce68('0x7'));var controller=require(_0xce68('0x8'));router['get']('/',auth[_0xce68('0x9')](),controller[_0xce68('0xa')]);router[_0xce68('0xb')](_0xce68('0xc'),auth[_0xce68('0x9')](),controller[_0xce68('0xd')]);router[_0xce68('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xce68('0xf')]('/:id',auth[_0xce68('0x9')](),controller[_0xce68('0x10')]);router[_0xce68('0x11')](_0xce68('0xc'),auth[_0xce68('0x9')](),controller[_0xce68('0x12')]);module[_0xce68('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 49a3d04..bd0d371 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 _0x8e44=['sequelize','exports','STRING','#0091EA'];(function(_0x10a9c9,_0xe6e356){var _0x361117=function(_0x38ebbc){while(--_0x38ebbc){_0x10a9c9['push'](_0x10a9c9['shift']());}};_0x361117(++_0xe6e356);}(_0x8e44,0x1ac));var _0x48e4=function(_0x873a46,_0x3ecd08){_0x873a46=_0x873a46-0x0;var _0x44fd26=_0x8e44[_0x873a46];return _0x44fd26;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'name':{'type':Sequelize[_0x48e4('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x48e4('0x3')},'description':{'type':Sequelize[_0x48e4('0x2')]}}; \ No newline at end of file +var _0x20df=['exports','STRING','name','#0091EA','sequelize'];(function(_0x2a572a,_0x129afd){var _0x73d2e2=function(_0x117513){while(--_0x117513){_0x2a572a['push'](_0x2a572a['shift']());}};_0x73d2e2(++_0x129afd);}(_0x20df,0x7c));var _0xf20d=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x20df[_0x14e27a];return _0x288688;};'use strict';var Sequelize=require(_0xf20d('0x0'));module[_0xf20d('0x1')]={'name':{'type':Sequelize[_0xf20d('0x2')],'unique':_0xf20d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xf20d('0x4')},'description':{'type':Sequelize[_0xf20d('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9bc4e9a..0c1fc88 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 _0x19ea=['findAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','type','key','keys','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge','options','includeAll','include'];(function(_0x6dc630,_0x209e6f){var _0x3c5800=function(_0x912427){while(--_0x912427){_0x6dc630['push'](_0x6dc630['shift']());}};_0x3c5800(++_0x209e6f);}(_0x19ea,0xfe));var _0xa19e=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x19ea[_0x59162a];return _0x35e50d;};'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(){var _0x504437=_0x536386[_0xa19e('0x26')]({'plain':!![]});var _0x1d3ce6='Tags';return db[_0xa19e('0x27')][_0xa19e('0x25')]({'where':{'type':_0x1d3ce6,'resourceId':_0x504437['id']}})['then'](function(){return _0x536386;});})[_0xa19e('0x24')](function(){_0x20a649[_0xa19e('0x18')](0xcc)[_0xa19e('0x19')]();});}};}function handleEntityNotFound(_0x21c9ca,_0x2076c5){return function(_0x180407){if(!_0x180407){_0x21c9ca[_0xa19e('0x28')](0x194);}return _0x180407;};}function handleError(_0x3f5ac6,_0x18c96f){_0x18c96f=_0x18c96f||0x1f4;return function(_0x24dd51){logger[_0xa19e('0x29')](_0x24dd51[_0xa19e('0x2a')]);if(_0x24dd51[_0xa19e('0x2b')]){delete _0x24dd51[_0xa19e('0x2b')];}_0x3f5ac6[_0xa19e('0x18')](_0x18c96f)[_0xa19e('0x2c')](_0x24dd51);};}exports[_0xa19e('0x2d')]=function(_0x27f3a0,_0x3dcd74){var _0x114656={},_0x557439={},_0x121c37={'count':0x0,'rows':[]};var _0x1311c5=_[_0xa19e('0x2e')](db[_0xa19e('0x2f')][_0xa19e('0x30')],function(_0x355fd9){return{'name':_0x355fd9['fieldName'],'type':_0x355fd9[_0xa19e('0x31')][_0xa19e('0x32')]};});_0x557439['model']=_[_0xa19e('0x2e')](_0x1311c5,'name');_0x557439['query']=_[_0xa19e('0x33')](_0x27f3a0['query']);_0x557439['filters']=_['intersection'](_0x557439[_0xa19e('0x34')],_0x557439[_0xa19e('0x35')]);_0x114656[_0xa19e('0x36')]=_['intersection'](_0x557439[_0xa19e('0x34')],qs[_0xa19e('0x37')](_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x37')]));_0x114656[_0xa19e('0x36')]=_0x114656[_0xa19e('0x36')]['length']?_0x114656[_0xa19e('0x36')]:_0x557439[_0xa19e('0x34')];if(!_0x27f3a0['query'][_0xa19e('0x38')](_0xa19e('0x39'))){_0x114656[_0xa19e('0x1c')]=qs['limit'](_0x27f3a0['query'][_0xa19e('0x1c')]);_0x114656['offset']=qs[_0xa19e('0x1e')](_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x1e')]);}_0x114656[_0xa19e('0x3a')]=qs['sort'](_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x3b')]);_0x114656['where']=qs[_0xa19e('0x3c')](_['pick'](_0x27f3a0[_0xa19e('0x35')],_0x557439[_0xa19e('0x3c')]),_0x1311c5);if(_0x27f3a0[_0xa19e('0x35')]['filter']){_0x114656[_0xa19e('0x3d')]=_[_0xa19e('0x3e')](_0x114656[_0xa19e('0x3d')],{'$or':_['map'](_0x1311c5,function(_0xfcf01a){if(_0xfcf01a[_0xa19e('0x31')]!=='VIRTUAL'){var _0x561608={};_0x561608[_0xfcf01a[_0xa19e('0x2b')]]={'$like':'%'+_0x27f3a0[_0xa19e('0x35')]['filter']+'%'};return _0x561608;}})});}_0x114656=_[_0xa19e('0x3e')]({},_0x114656,_0x27f3a0[_0xa19e('0x3f')]);var _0x4b64d7={'where':_0x114656[_0xa19e('0x3d')]};return db[_0xa19e('0x2f')][_0xa19e('0x1d')](_0x4b64d7)[_0xa19e('0x24')](function(_0x30fdfb){_0x121c37['count']=_0x30fdfb;if(_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x40')]){_0x114656[_0xa19e('0x41')]=[{'all':!![]}];}return db[_0xa19e('0x2f')][_0xa19e('0x42')](_0x114656);})['then'](function(_0x315341){_0x121c37['rows']=_0x315341;return _0x121c37;})[_0xa19e('0x24')](respondWithFilteredResult(_0x3dcd74,_0x114656))[_0xa19e('0x43')](handleError(_0x3dcd74,null));};exports['show']=function(_0x8dfa7e,_0x19a712){var _0x48e370={'raw':!![],'where':{'id':_0x8dfa7e['params']['id']}},_0x41d7ae={};_0x41d7ae[_0xa19e('0x34')]=_[_0xa19e('0x33')](db[_0xa19e('0x2f')][_0xa19e('0x30')]);_0x41d7ae[_0xa19e('0x35')]=_[_0xa19e('0x33')](_0x8dfa7e[_0xa19e('0x35')]);_0x41d7ae[_0xa19e('0x3c')]=_['intersection'](_0x41d7ae[_0xa19e('0x34')],_0x41d7ae[_0xa19e('0x35')]);_0x48e370['attributes']=_['intersection'](_0x41d7ae[_0xa19e('0x34')],qs[_0xa19e('0x37')](_0x8dfa7e[_0xa19e('0x35')]['fields']));_0x48e370[_0xa19e('0x36')]=_0x48e370[_0xa19e('0x36')]['length']?_0x48e370[_0xa19e('0x36')]:_0x41d7ae[_0xa19e('0x34')];if(_0x8dfa7e[_0xa19e('0x35')]['includeAll']){_0x48e370[_0xa19e('0x41')]=[{'all':!![]}];}_0x48e370=_['merge']({},_0x48e370,_0x8dfa7e[_0xa19e('0x3f')]);return db[_0xa19e('0x2f')][_0xa19e('0x44')](_0x48e370)[_0xa19e('0x24')](handleEntityNotFound(_0x19a712,null))[_0xa19e('0x24')](respondWithResult(_0x19a712,null))['catch'](handleError(_0x19a712,null));};exports[_0xa19e('0x45')]=function(_0x4c90fe,_0x4779d8){return db['Tag'][_0xa19e('0x45')](_0x4c90fe[_0xa19e('0x46')],{})[_0xa19e('0x24')](function(_0x203c03){var _0x538c9a=_0x4c90fe[_0xa19e('0x47')][_0xa19e('0x26')]({'plain':!![]});if(!_0x538c9a)throw new Error(_0xa19e('0x48'));if(_0x538c9a[_0xa19e('0x49')]==='user'){var _0x454c9f=_0x203c03['get']({'plain':!![]});var _0x2c58c8=_0xa19e('0x4a');return db[_0xa19e('0x4b')]['find']({'where':{'name':_0x2c58c8,'userProfileId':_0x538c9a[_0xa19e('0x4c')]},'raw':!![]})[_0xa19e('0x24')](function(_0x5bd756){if(_0x5bd756&&_0x5bd756[_0xa19e('0x4d')]===0x0){return db[_0xa19e('0x27')][_0xa19e('0x45')]({'name':_0x454c9f[_0xa19e('0x2b')],'resourceId':_0x454c9f['id'],'type':_0x5bd756['name'],'sectionId':_0x5bd756['id']},{})['then'](function(){return _0x203c03;});}else{return _0x203c03;}})[_0xa19e('0x43')](function(_0x239a3b){logger['error'](_0xa19e('0x4e'),_0x239a3b);throw _0x239a3b;});}return _0x203c03;})[_0xa19e('0x24')](respondWithResult(_0x4779d8,0xc9))['catch'](handleError(_0x4779d8,null));};exports[_0xa19e('0x23')]=function(_0x68e0d1,_0x44a946){if(_0x68e0d1[_0xa19e('0x46')]['id']){delete _0x68e0d1[_0xa19e('0x46')]['id'];}return db[_0xa19e('0x2f')][_0xa19e('0x44')]({'where':{'id':_0x68e0d1[_0xa19e('0x4f')]['id']}})[_0xa19e('0x24')](handleEntityNotFound(_0x44a946,null))[_0xa19e('0x24')](saveUpdates(_0x68e0d1[_0xa19e('0x46')],null))['then'](respondWithResult(_0x44a946,null))['catch'](handleError(_0x44a946,null));};exports[_0xa19e('0x25')]=function(_0x1a41a0,_0x17ac29){return db['Tag']['find']({'where':{'id':_0x1a41a0['params']['id']}})[_0xa19e('0x24')](handleEntityNotFound(_0x17ac29,null))['then'](removeEntity(_0x17ac29,null))[_0xa19e('0x43')](handleError(_0x17ac29,null));}; \ No newline at end of file +var _0xe130=['destroy','then','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe130,0x127));var _0x0e13=function(_0x3ecf17,_0x21a80e){_0x3ecf17=_0x3ecf17-0x0;var _0x307d8a=_0xe130[_0x3ecf17];return _0x307d8a;};'use strict';var emlformat=require(_0x0e13('0x0'));var rimraf=require(_0x0e13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e13('0x2'));var rp=require(_0x0e13('0x3'));var moment=require(_0x0e13('0x4'));var BPromise=require(_0x0e13('0x5'));var Mustache=require(_0x0e13('0x6'));var util=require('util');var path=require(_0x0e13('0x7'));var sox=require(_0x0e13('0x8'));var csv=require(_0x0e13('0x9'));var ejs=require(_0x0e13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e13('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0e13('0xc'));var toCsv=require(_0x0e13('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e13('0xd'));var authService=require(_0x0e13('0xe'));var qs=require(_0x0e13('0xf'));var as=require(_0x0e13('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e13('0x11'));var utils=require(_0x0e13('0x12'));var config=require(_0x0e13('0x13'));var licenseUtil=require(_0x0e13('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4391,_0x4d9ea0){_0x4d9ea0=_0x4d9ea0||0xcc;return function(_0x2ef77e){if(_0x2ef77e){return _0x1b4391[_0x0e13('0x15')](_0x4d9ea0);}return _0x1b4391[_0x0e13('0x16')](_0x4d9ea0)[_0x0e13('0x17')]();};}function respondWithResult(_0x2f0d82,_0x1ec6ad){_0x1ec6ad=_0x1ec6ad||0xc8;return function(_0x27c3cf){if(_0x27c3cf){return _0x2f0d82[_0x0e13('0x16')](_0x1ec6ad)[_0x0e13('0x18')](_0x27c3cf);}};}function respondWithFilteredResult(_0x530f82,_0x302763){return function(_0xbc1617){if(_0xbc1617){var _0x2057fe=typeof _0x302763[_0x0e13('0x19')]===_0x0e13('0x1a')&&typeof _0x302763[_0x0e13('0x1b')]==='undefined';var _0x11ec50=_0xbc1617[_0x0e13('0x1c')];var _0x510a2b=_0x2057fe?0x0:_0x302763['offset'];var _0x3b85fd=_0x2057fe?_0xbc1617['count']:_0x302763[_0x0e13('0x19')]+_0x302763['limit'];var _0x294aea;if(_0x3b85fd>=_0x11ec50){_0x3b85fd=_0x11ec50;_0x294aea=0xc8;}else{_0x294aea=0xce;}_0x530f82[_0x0e13('0x16')](_0x294aea);return _0x530f82[_0x0e13('0x1d')](_0x0e13('0x1e'),_0x510a2b+'-'+_0x3b85fd+'/'+_0x11ec50)[_0x0e13('0x18')](_0xbc1617);}return null;};}function patchUpdates(_0x5ef062){return function(_0x5cfba8){try{jsonpatch['apply'](_0x5cfba8,_0x5ef062,!![]);}catch(_0x2dddef){return BPromise[_0x0e13('0x1f')](_0x2dddef);}return _0x5cfba8['save']();};}function saveUpdates(_0x515222,_0x295eb0){return function(_0x296ed3){if(_0x296ed3){return _0x296ed3[_0x0e13('0x20')](_0x515222)['then'](function(_0x400e87){return _0x400e87;});}return null;};}function removeEntity(_0x70c3db,_0x22cc15){return function(_0x20303b){if(_0x20303b){return _0x20303b[_0x0e13('0x21')]()[_0x0e13('0x22')](function(){var _0x4240e7=_0x20303b[_0x0e13('0x23')]({'plain':!![]});var _0x3d6abf=_0x0e13('0x24');return db[_0x0e13('0x25')][_0x0e13('0x21')]({'where':{'type':_0x3d6abf,'resourceId':_0x4240e7['id']}})[_0x0e13('0x22')](function(){return _0x20303b;});})[_0x0e13('0x22')](function(){_0x70c3db[_0x0e13('0x16')](0xcc)[_0x0e13('0x17')]();});}};}function handleEntityNotFound(_0x1edc48,_0x59ae33){return function(_0x37fe42){if(!_0x37fe42){_0x1edc48[_0x0e13('0x15')](0x194);}return _0x37fe42;};}function handleError(_0x3684bb,_0x5f520a){_0x5f520a=_0x5f520a||0x1f4;return function(_0x2182ae){logger[_0x0e13('0x26')](_0x2182ae[_0x0e13('0x27')]);if(_0x2182ae[_0x0e13('0x28')]){delete _0x2182ae['name'];}_0x3684bb[_0x0e13('0x16')](_0x5f520a)[_0x0e13('0x29')](_0x2182ae);};}exports[_0x0e13('0x2a')]=function(_0x269a66,_0x2e65e2){var _0x29dc67={},_0x22fcfb={},_0x439e87={'count':0x0,'rows':[]};var _0x48d47b=_[_0x0e13('0x2b')](db[_0x0e13('0x2c')][_0x0e13('0x2d')],function(_0x53ef0a){return{'name':_0x53ef0a[_0x0e13('0x2e')],'type':_0x53ef0a[_0x0e13('0x2f')][_0x0e13('0x30')]};});_0x22fcfb[_0x0e13('0x31')]=_[_0x0e13('0x2b')](_0x48d47b,_0x0e13('0x28'));_0x22fcfb[_0x0e13('0x32')]=_[_0x0e13('0x33')](_0x269a66[_0x0e13('0x32')]);_0x22fcfb['filters']=_[_0x0e13('0x34')](_0x22fcfb[_0x0e13('0x31')],_0x22fcfb[_0x0e13('0x32')]);_0x29dc67['attributes']=_[_0x0e13('0x34')](_0x22fcfb['model'],qs[_0x0e13('0x35')](_0x269a66[_0x0e13('0x32')][_0x0e13('0x35')]));_0x29dc67[_0x0e13('0x36')]=_0x29dc67[_0x0e13('0x36')][_0x0e13('0x37')]?_0x29dc67[_0x0e13('0x36')]:_0x22fcfb['model'];if(!_0x269a66['query'][_0x0e13('0x38')](_0x0e13('0x39'))){_0x29dc67[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x269a66[_0x0e13('0x32')][_0x0e13('0x1b')]);_0x29dc67[_0x0e13('0x19')]=qs['offset'](_0x269a66[_0x0e13('0x32')][_0x0e13('0x19')]);}_0x29dc67[_0x0e13('0x3a')]=qs[_0x0e13('0x3b')](_0x269a66[_0x0e13('0x32')]['sort']);_0x29dc67[_0x0e13('0x3c')]=qs[_0x0e13('0x3d')](_[_0x0e13('0x3e')](_0x269a66['query'],_0x22fcfb[_0x0e13('0x3d')]),_0x48d47b);if(_0x269a66['query'][_0x0e13('0x3f')]){_0x29dc67['where']=_[_0x0e13('0x40')](_0x29dc67['where'],{'$or':_[_0x0e13('0x2b')](_0x48d47b,function(_0x158541){if(_0x158541[_0x0e13('0x2f')]!==_0x0e13('0x41')){var _0x11e209={};_0x11e209[_0x158541[_0x0e13('0x28')]]={'$like':'%'+_0x269a66['query'][_0x0e13('0x3f')]+'%'};return _0x11e209;}})});}_0x29dc67=_[_0x0e13('0x40')]({},_0x29dc67,_0x269a66[_0x0e13('0x42')]);var _0xa7d7b7={'where':_0x29dc67[_0x0e13('0x3c')]};return db[_0x0e13('0x2c')][_0x0e13('0x1c')](_0xa7d7b7)['then'](function(_0x164720){_0x439e87['count']=_0x164720;if(_0x269a66['query']['includeAll']){_0x29dc67[_0x0e13('0x43')]=[{'all':!![]}];}return db[_0x0e13('0x2c')][_0x0e13('0x44')](_0x29dc67);})[_0x0e13('0x22')](function(_0x3ee751){_0x439e87[_0x0e13('0x45')]=_0x3ee751;return _0x439e87;})[_0x0e13('0x22')](respondWithFilteredResult(_0x2e65e2,_0x29dc67))['catch'](handleError(_0x2e65e2,null));};exports[_0x0e13('0x46')]=function(_0x4f9f28,_0x5af31e){var _0x45e8be={'raw':!![],'where':{'id':_0x4f9f28[_0x0e13('0x47')]['id']}},_0x3bacaf={};_0x3bacaf[_0x0e13('0x31')]=_['keys'](db[_0x0e13('0x2c')][_0x0e13('0x2d')]);_0x3bacaf['query']=_[_0x0e13('0x33')](_0x4f9f28[_0x0e13('0x32')]);_0x3bacaf[_0x0e13('0x3d')]=_[_0x0e13('0x34')](_0x3bacaf[_0x0e13('0x31')],_0x3bacaf[_0x0e13('0x32')]);_0x45e8be[_0x0e13('0x36')]=_[_0x0e13('0x34')](_0x3bacaf[_0x0e13('0x31')],qs[_0x0e13('0x35')](_0x4f9f28['query']['fields']));_0x45e8be[_0x0e13('0x36')]=_0x45e8be[_0x0e13('0x36')][_0x0e13('0x37')]?_0x45e8be[_0x0e13('0x36')]:_0x3bacaf[_0x0e13('0x31')];if(_0x4f9f28['query'][_0x0e13('0x48')]){_0x45e8be[_0x0e13('0x43')]=[{'all':!![]}];}_0x45e8be=_[_0x0e13('0x40')]({},_0x45e8be,_0x4f9f28['options']);return db[_0x0e13('0x2c')]['find'](_0x45e8be)[_0x0e13('0x22')](handleEntityNotFound(_0x5af31e,null))[_0x0e13('0x22')](respondWithResult(_0x5af31e,null))[_0x0e13('0x49')](handleError(_0x5af31e,null));};exports[_0x0e13('0x4a')]=function(_0x35249c,_0x47e5b8){return db[_0x0e13('0x2c')]['create'](_0x35249c[_0x0e13('0x4b')],{})[_0x0e13('0x22')](function(_0x56b148){var _0x2da0bb=_0x35249c[_0x0e13('0x4c')][_0x0e13('0x23')]({'plain':!![]});if(!_0x2da0bb)throw new Error(_0x0e13('0x4d'));if(_0x2da0bb['role']===_0x0e13('0x4c')){var _0x359de5=_0x56b148['get']({'plain':!![]});var _0x35d849='Tags';return db['UserProfileSection']['find']({'where':{'name':_0x35d849,'userProfileId':_0x2da0bb[_0x0e13('0x4e')]},'raw':!![]})['then'](function(_0x247867){if(_0x247867&&_0x247867[_0x0e13('0x4f')]===0x0){return db[_0x0e13('0x25')][_0x0e13('0x4a')]({'name':_0x359de5[_0x0e13('0x28')],'resourceId':_0x359de5['id'],'type':_0x247867['name'],'sectionId':_0x247867['id']},{})[_0x0e13('0x22')](function(){return _0x56b148;});}else{return _0x56b148;}})[_0x0e13('0x49')](function(_0x383fde){logger[_0x0e13('0x26')](_0x0e13('0x50'),_0x383fde);throw _0x383fde;});}return _0x56b148;})[_0x0e13('0x22')](respondWithResult(_0x47e5b8,0xc9))[_0x0e13('0x49')](handleError(_0x47e5b8,null));};exports[_0x0e13('0x20')]=function(_0x54676e,_0xdbd8e2){if(_0x54676e[_0x0e13('0x4b')]['id']){delete _0x54676e[_0x0e13('0x4b')]['id'];}return db['Tag'][_0x0e13('0x51')]({'where':{'id':_0x54676e['params']['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0xdbd8e2,null))[_0x0e13('0x22')](saveUpdates(_0x54676e['body'],null))[_0x0e13('0x22')](respondWithResult(_0xdbd8e2,null))[_0x0e13('0x49')](handleError(_0xdbd8e2,null));};exports['destroy']=function(_0x220aaa,_0x65111c){return db[_0x0e13('0x2c')][_0x0e13('0x51')]({'where':{'id':_0x220aaa['params']['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x65111c,null))[_0x0e13('0x22')](removeEntity(_0x65111c,null))[_0x0e13('0x49')](handleError(_0x65111c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b044eb0..b8a00ea 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 _0x3faa=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','Tag','tools_tags'];(function(_0x299ac6,_0x2cd0ea){var _0x56a6f8=function(_0x1dc81f){while(--_0x1dc81f){_0x299ac6['push'](_0x299ac6['shift']());}};_0x56a6f8(++_0x2cd0ea);}(_0x3faa,0x14a));var _0xa3fa=function(_0x5b4f69,_0x2c6773){_0x5b4f69=_0x5b4f69-0x0;var _0x559e77=_0x3faa[_0x5b4f69];return _0x559e77;};'use strict';var _=require(_0xa3fa('0x0'));var util=require(_0xa3fa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa3fa('0x2'));var BPromise=require(_0xa3fa('0x3'));var rp=require(_0xa3fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3fa('0x5'));var config=require(_0xa3fa('0x6'));var attributes=require('./tag.attributes');module[_0xa3fa('0x7')]=function(_0x21afe8,_0x318245){return _0x21afe8['define'](_0xa3fa('0x8'),attributes,{'tableName':_0xa3fa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa573=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x3a1e75,_0x38b52d){var _0x1245da=function(_0x7a5ae7){while(--_0x7a5ae7){_0x3a1e75['push'](_0x3a1e75['shift']());}};_0x1245da(++_0x38b52d);}(_0xa573,0x95));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a57('0x0'));var util=require(_0x3a57('0x1'));var logger=require(_0x3a57('0x2'))(_0x3a57('0x3'));var moment=require(_0x3a57('0x4'));var BPromise=require(_0x3a57('0x5'));var rp=require(_0x3a57('0x6'));var fs=require('fs');var path=require(_0x3a57('0x7'));var rimraf=require(_0x3a57('0x8'));var config=require(_0x3a57('0x9'));var attributes=require(_0x3a57('0xa'));module[_0x3a57('0xb')]=function(_0x10f25f,_0x432330){return _0x10f25f[_0x3a57('0xc')](_0x3a57('0xd'),attributes,{'tableName':_0x3a57('0xe'),'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 fa7a16f..34a2163 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 _0xf0ba=['rpc','jayson/promise','then','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var moment=require(_0xaf0b('0x2'));var BPromise=require(_0xaf0b('0x3'));var rs=require(_0xaf0b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf0b('0x5'))['db'];var utils=require(_0xaf0b('0x6'));var logger=require('../../config/logger')(_0xaf0b('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf0b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53b32d,_0x1d260e,_0x17b6d5){return new BPromise(function(_0x3439d5,_0xd67a9){return client['request'](_0x53b32d,_0x17b6d5)[_0xaf0b('0x9')](function(_0x4242b1){logger[_0xaf0b('0xa')]('Tag,\x20%s,\x20%s',_0x1d260e,_0xaf0b('0xb'));logger['debug'](_0xaf0b('0xc'),_0x1d260e,_0xaf0b('0xb'),JSON[_0xaf0b('0xd')](_0x4242b1));if(_0x4242b1['error']){if(_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0xf')]===0x1f4){logger[_0xaf0b('0xe')](_0xaf0b('0x10'),_0x1d260e,_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0x11')]);return _0xd67a9(_0x4242b1['error'][_0xaf0b('0x11')]);}logger[_0xaf0b('0xe')](_0xaf0b('0x10'),_0x1d260e,_0x4242b1[_0xaf0b('0xe')]['message']);return _0x3439d5(_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0x11')]);}else{logger[_0xaf0b('0xa')](_0xaf0b('0x10'),_0x1d260e,_0xaf0b('0xb'));_0x3439d5(_0x4242b1[_0xaf0b('0x12')][_0xaf0b('0x11')]);}})[_0xaf0b('0x13')](function(_0x4885da){logger[_0xaf0b('0xe')]('Tag,\x20%s,\x20%s',_0x1d260e,_0x4885da);_0xd67a9(_0x4885da);});});} \ No newline at end of file +var _0x6a24=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x5a75f2,_0x35c25b){var _0x2cbfa9=function(_0x308d21){while(--_0x308d21){_0x5a75f2['push'](_0x5a75f2['shift']());}};_0x2cbfa9(++_0x35c25b);}(_0x6a24,0xd1));var _0x46a2=function(_0xe2fa12,_0x52ca3){_0xe2fa12=_0xe2fa12-0x0;var _0x3fa3a3=_0x6a24[_0xe2fa12];return _0x3fa3a3;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 72f071c..c05904c 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 759ad71..0832013 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 _0x0713=['STRING','name'];(function(_0xbdc56,_0x2ab855){var _0x254d02=function(_0x399d49){while(--_0x399d49){_0xbdc56['push'](_0xbdc56['shift']());}};_0x254d02(++_0x2ab855);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c346376..df915de 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 _0x3c4c=['rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','Sequelize','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','send','findOne','channel','ValidationError','Unknown\x20channel','capitalize','Queue','order','pick','toLowerCase','Queues','isValidChannel','add','removeQueues','remove','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','spread','removeAgents','isArray','Queue:remove','getAgents','filter','rimraf','zip-dir','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./team.socket','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','index','Team'];(function(_0x4406f9,_0x53835c){var _0x5290e5=function(_0x267312){while(--_0x267312){_0x4406f9['push'](_0x4406f9['shift']());}};_0x5290e5(++_0x53835c);}(_0x3c4c,0x6e));var _0xc3c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3c4c[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3c4('0x0'));var zipdir=require(_0xc3c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3c4('0x2'));var moment=require(_0xc3c4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc3c4('0x4'));var path=require(_0xc3c4('0x5'));var sox=require(_0xc3c4('0x6'));var csv=require(_0xc3c4('0x7'));var ejs=require(_0xc3c4('0x8'));var fs=require('fs');var fs_extra=require(_0xc3c4('0x9'));var _=require(_0xc3c4('0xa'));var squel=require(_0xc3c4('0xb'));var crypto=require(_0xc3c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc3c4('0xd'));var toCsv=require(_0xc3c4('0x7'));var querystring=require(_0xc3c4('0xe'));var Papa=require(_0xc3c4('0xf'));var Redis=require(_0xc3c4('0x10'));var authService=require(_0xc3c4('0x11'));var qs=require(_0xc3c4('0x12'));var as=require(_0xc3c4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3c4('0x14'));var utils=require('../../config/utils');var config=require(_0xc3c4('0x15'));var licenseUtil=require(_0xc3c4('0x16'));var db=require(_0xc3c4('0x17'))['db'];config['redis']=_[_0xc3c4('0x18')](config['redis'],{'host':_0xc3c4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3c4('0x1a')]));require(_0xc3c4('0x1b'))['register'](socket);function respondWithStatusCode(_0x33078c,_0x192c5b){_0x192c5b=_0x192c5b||0xcc;return function(_0x12c3a0){if(_0x12c3a0){return _0x33078c['sendStatus'](_0x192c5b);}return _0x33078c[_0xc3c4('0x1c')](_0x192c5b)[_0xc3c4('0x1d')]();};}function respondWithResult(_0x4c2d2d,_0x2f7aa8){_0x2f7aa8=_0x2f7aa8||0xc8;return function(_0x4208e7){if(_0x4208e7){return _0x4c2d2d['status'](_0x2f7aa8)['json'](_0x4208e7);}};}function respondWithFilteredResult(_0xa40d57,_0x2c16ac){return function(_0x4c93cf){if(_0x4c93cf){var _0x27816c=typeof _0x2c16ac['offset']===_0xc3c4('0x1e')&&typeof _0x2c16ac[_0xc3c4('0x1f')]===_0xc3c4('0x1e');var _0x3ff3df=_0x4c93cf[_0xc3c4('0x20')];var _0x58037f=_0x27816c?0x0:_0x2c16ac['offset'];var _0x20bf64=_0x27816c?_0x4c93cf[_0xc3c4('0x20')]:_0x2c16ac[_0xc3c4('0x21')]+_0x2c16ac[_0xc3c4('0x1f')];var _0x3f2723;if(_0x20bf64>=_0x3ff3df){_0x20bf64=_0x3ff3df;_0x3f2723=0xc8;}else{_0x3f2723=0xce;}_0xa40d57[_0xc3c4('0x1c')](_0x3f2723);return _0xa40d57[_0xc3c4('0x22')](_0xc3c4('0x23'),_0x58037f+'-'+_0x20bf64+'/'+_0x3ff3df)[_0xc3c4('0x24')](_0x4c93cf);}return null;};}function patchUpdates(_0x372665){return function(_0x161102){try{jsonpatch[_0xc3c4('0x25')](_0x161102,_0x372665,!![]);}catch(_0x4d8fa6){return BPromise['reject'](_0x4d8fa6);}return _0x161102[_0xc3c4('0x26')]();};}function saveUpdates(_0x3eb8ed,_0x1c63ce){return function(_0x436bb8){if(_0x436bb8){return _0x436bb8[_0xc3c4('0x27')](_0x3eb8ed)[_0xc3c4('0x28')](function(_0x359c17){return _0x359c17;});}return null;};}function handleEntityNotFound(_0x4673a8,_0x598467){return function(_0x54d71d){if(!_0x54d71d){_0x4673a8[_0xc3c4('0x29')](0x194);}return _0x54d71d;};}function handleError(_0x59f81c,_0x492327){_0x492327=_0x492327||0x1f4;return function(_0x475347){logger[_0xc3c4('0x2a')](_0x475347[_0xc3c4('0x2b')]);if(_0x475347[_0xc3c4('0x2c')]){delete _0x475347[_0xc3c4('0x2c')];}_0x59f81c[_0xc3c4('0x1c')](_0x492327)['send'](_0x475347);};}exports[_0xc3c4('0x2d')]=function(_0x2f0044,_0x1e5728){var _0x25134c={},_0x2fadb3={},_0x54af5d={'count':0x0,'rows':[]};var _0x21d0d9=_['map'](db[_0xc3c4('0x2e')][_0xc3c4('0x2f')],function(_0x4a6098){return{'name':_0x4a6098[_0xc3c4('0x30')],'type':_0x4a6098[_0xc3c4('0x31')][_0xc3c4('0x32')]};});_0x2fadb3[_0xc3c4('0x33')]=_[_0xc3c4('0x34')](_0x21d0d9,_0xc3c4('0x2c'));_0x2fadb3['query']=_[_0xc3c4('0x35')](_0x2f0044[_0xc3c4('0x36')]);_0x2fadb3[_0xc3c4('0x37')]=_[_0xc3c4('0x38')](_0x2fadb3['model'],_0x2fadb3[_0xc3c4('0x36')]);_0x25134c[_0xc3c4('0x39')]=_[_0xc3c4('0x38')](_0x2fadb3[_0xc3c4('0x33')],qs[_0xc3c4('0x3a')](_0x2f0044[_0xc3c4('0x36')][_0xc3c4('0x3a')]));_0x25134c[_0xc3c4('0x39')]=_0x25134c[_0xc3c4('0x39')][_0xc3c4('0x3b')]?_0x25134c['attributes']:_0x2fadb3['model'];if(!_0x2f0044[_0xc3c4('0x36')][_0xc3c4('0x3c')](_0xc3c4('0x3d'))){_0x25134c['limit']=qs[_0xc3c4('0x1f')](_0x2f0044[_0xc3c4('0x36')][_0xc3c4('0x1f')]);_0x25134c['offset']=qs[_0xc3c4('0x21')](_0x2f0044[_0xc3c4('0x36')][_0xc3c4('0x21')]);}_0x25134c['order']=qs['sort'](_0x2f0044[_0xc3c4('0x36')][_0xc3c4('0x3e')]);_0x25134c[_0xc3c4('0x3f')]=qs[_0xc3c4('0x37')](_['pick'](_0x2f0044[_0xc3c4('0x36')],_0x2fadb3[_0xc3c4('0x37')]),_0x21d0d9);if(_0x2f0044[_0xc3c4('0x36')]['filter']){_0x25134c[_0xc3c4('0x3f')]=_[_0xc3c4('0x40')](_0x25134c[_0xc3c4('0x3f')],{'$or':_[_0xc3c4('0x34')](_0x21d0d9,function(_0x193a1c){if(_0x193a1c[_0xc3c4('0x31')]!==_0xc3c4('0x41')){var _0xdf7542={};_0xdf7542[_0x193a1c[_0xc3c4('0x2c')]]={'$like':'%'+_0x2f0044['query']['filter']+'%'};return _0xdf7542;}})});}_0x25134c=_[_0xc3c4('0x40')]({},_0x25134c,_0x2f0044[_0xc3c4('0x42')]);var _0x5991b2={'where':_0x25134c['where']};return db[_0xc3c4('0x2e')][_0xc3c4('0x20')](_0x5991b2)['then'](function(_0xad9482){_0x54af5d[_0xc3c4('0x20')]=_0xad9482;if(_0x2f0044[_0xc3c4('0x36')][_0xc3c4('0x43')]){_0x25134c['include']=[{'all':!![]}];}return db[_0xc3c4('0x2e')][_0xc3c4('0x44')](_0x25134c);})[_0xc3c4('0x28')](function(_0x299149){_0x54af5d[_0xc3c4('0x45')]=_0x299149;return _0x54af5d;})[_0xc3c4('0x28')](respondWithFilteredResult(_0x1e5728,_0x25134c))[_0xc3c4('0x46')](handleError(_0x1e5728,null));};exports[_0xc3c4('0x47')]=function(_0x4a2899,_0x42af8b){var _0x13a619={'raw':![],'where':{'id':_0x4a2899['params']['id']}},_0x3112db={};_0x3112db['model']=_[_0xc3c4('0x35')](db[_0xc3c4('0x2e')][_0xc3c4('0x2f')]);_0x3112db[_0xc3c4('0x36')]=_[_0xc3c4('0x35')](_0x4a2899[_0xc3c4('0x36')]);_0x3112db['filters']=_['intersection'](_0x3112db['model'],_0x3112db[_0xc3c4('0x36')]);_0x13a619[_0xc3c4('0x39')]=_[_0xc3c4('0x38')](_0x3112db['model'],qs[_0xc3c4('0x3a')](_0x4a2899[_0xc3c4('0x36')][_0xc3c4('0x3a')]));_0x13a619[_0xc3c4('0x39')]=_0x13a619[_0xc3c4('0x39')]['length']?_0x13a619[_0xc3c4('0x39')]:_0x3112db[_0xc3c4('0x33')];if(_0x4a2899[_0xc3c4('0x36')][_0xc3c4('0x43')]){_0x13a619[_0xc3c4('0x48')]=[{'all':!![]}];}_0x13a619=_['merge']({},_0x13a619,_0x4a2899[_0xc3c4('0x42')]);return db['Team'][_0xc3c4('0x49')](_0x13a619)[_0xc3c4('0x28')](handleEntityNotFound(_0x42af8b,null))[_0xc3c4('0x28')](respondWithResult(_0x42af8b,null))[_0xc3c4('0x46')](handleError(_0x42af8b,null));};exports['create']=function(_0xb1eb4a,_0x1a93a8){return db['Team']['create'](_0xb1eb4a[_0xc3c4('0x4a')],{})[_0xc3c4('0x28')](function(_0x37ae53){var _0x181e4f=_0xb1eb4a[_0xc3c4('0x4b')][_0xc3c4('0x4c')]({'plain':!![]});if(!_0x181e4f)throw new Error(_0xc3c4('0x4d'));if(_0x181e4f['role']===_0xc3c4('0x4b')){var _0x567754=_0x37ae53['get']({'plain':!![]});var _0x3f2678='Teams';return db[_0xc3c4('0x4e')][_0xc3c4('0x49')]({'where':{'name':_0x3f2678,'userProfileId':_0x181e4f[_0xc3c4('0x4f')]},'raw':!![]})[_0xc3c4('0x28')](function(_0x3792ee){if(_0x3792ee&&_0x3792ee[_0xc3c4('0x50')]===0x0){return db[_0xc3c4('0x51')][_0xc3c4('0x52')]({'name':_0x567754['name'],'resourceId':_0x567754['id'],'type':_0x3792ee[_0xc3c4('0x2c')],'sectionId':_0x3792ee['id']},{})['then'](function(){return _0x37ae53;});}else{return _0x37ae53;}})[_0xc3c4('0x46')](function(_0x48c16e){logger[_0xc3c4('0x2a')](_0xc3c4('0x53'),_0x48c16e);throw _0x48c16e;});}return _0x37ae53;})[_0xc3c4('0x28')](respondWithResult(_0x1a93a8,0xc9))[_0xc3c4('0x46')](handleError(_0x1a93a8,null));};exports[_0xc3c4('0x27')]=function(_0x157448,_0x3e44d6){if(_0x157448['body']['id']){delete _0x157448['body']['id'];}return db[_0xc3c4('0x2e')]['find']({'where':{'id':_0x157448[_0xc3c4('0x54')]['id']}})[_0xc3c4('0x28')](handleEntityNotFound(_0x3e44d6,null))[_0xc3c4('0x28')](saveUpdates(_0x157448['body'],null))[_0xc3c4('0x28')](respondWithResult(_0x3e44d6,null))[_0xc3c4('0x46')](handleError(_0x3e44d6,null));};exports['destroy']=function(_0x67d5e0,_0x50d2be){var _0x3bc991=_0x67d5e0[_0xc3c4('0x54')]['id'];var _0x148cc6=[];return db[_0xc3c4('0x55')]['transaction'](function(_0x4c7877){var _0x496313=_0xc3c4('0x56')+_0x3bc991;return db[_0xc3c4('0x55')][_0xc3c4('0x36')](_0x496313,{'type':db['Sequelize'][_0xc3c4('0x57')][_0xc3c4('0x58')],'raw':!![],'transaction':_0x4c7877})[_0xc3c4('0x28')](function(_0x1a1323){_0x148cc6=_[_0xc3c4('0x34')](_0x1a1323,function(_0x27ee65){return Number(_0x27ee65[_0xc3c4('0x59')]);});})['then'](function(){var _0x193dc3='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3bc991;return db[_0xc3c4('0x55')][_0xc3c4('0x36')](_0x193dc3,{'type':db[_0xc3c4('0x5a')][_0xc3c4('0x57')][_0xc3c4('0x58')],'raw':!![],'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(_0x137b68){var _0x40c83f=_[_0xc3c4('0x34')](_0x137b68,function(_0x5927be){return Number(_0x5927be['VoiceQueueId']);});return db[_0xc3c4('0x5b')][_0xc3c4('0x5c')]({'where':{'UserId':{'$in':_0x148cc6},'VoiceQueueId':{'$in':_0x40c83f}},'transaction':_0x4c7877});})['then'](function(){var _0x556eba=_0xc3c4('0x5d')+_0x3bc991;return db[_0xc3c4('0x55')]['query'](_0x556eba,{'type':db['Sequelize'][_0xc3c4('0x57')][_0xc3c4('0x58')],'raw':!![],'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(_0x3f0444){var _0x5ac0f0=_['map'](_0x3f0444,function(_0xa628c1){return Number(_0xa628c1[_0xc3c4('0x5e')]);});return db['UserMailQueue'][_0xc3c4('0x5c')]({'where':{'UserId':{'$in':_0x148cc6},'MailQueueId':{'$in':_0x5ac0f0}},'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(){var _0x16991d=_0xc3c4('0x5f')+_0x3bc991;return db[_0xc3c4('0x55')]['query'](_0x16991d,{'type':db[_0xc3c4('0x5a')][_0xc3c4('0x57')][_0xc3c4('0x58')],'raw':!![],'transaction':_0x4c7877});})['then'](function(_0x3aaf7e){var _0x43b643=_[_0xc3c4('0x34')](_0x3aaf7e,function(_0x27c53b){return Number(_0x27c53b['SmsQueueId']);});return db[_0xc3c4('0x60')]['destroy']({'where':{'UserId':{'$in':_0x148cc6},'SmsQueueId':{'$in':_0x43b643}},'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(){var _0x227c8b=_0xc3c4('0x61')+_0x3bc991;return db[_0xc3c4('0x55')][_0xc3c4('0x36')](_0x227c8b,{'type':db[_0xc3c4('0x5a')]['QueryTypes'][_0xc3c4('0x58')],'raw':!![],'transaction':_0x4c7877});})['then'](function(_0x481c6b){var _0x44b20d=_['map'](_0x481c6b,function(_0x2dc5eb){return Number(_0x2dc5eb[_0xc3c4('0x62')]);});return db[_0xc3c4('0x63')][_0xc3c4('0x5c')]({'where':{'UserId':{'$in':_0x148cc6},'ChatQueueId':{'$in':_0x44b20d}},'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(){var _0x8bcc02=_0xc3c4('0x64')+_0x3bc991;return db[_0xc3c4('0x55')][_0xc3c4('0x36')](_0x8bcc02,{'type':db[_0xc3c4('0x5a')][_0xc3c4('0x57')][_0xc3c4('0x58')],'raw':!![],'transaction':_0x4c7877});})['then'](function(_0x20f5c5){var _0x231254=_[_0xc3c4('0x34')](_0x20f5c5,function(_0x59daa5){return Number(_0x59daa5[_0xc3c4('0x65')]);});return db[_0xc3c4('0x66')][_0xc3c4('0x5c')]({'where':{'UserId':{'$in':_0x148cc6},'FaxQueueId':{'$in':_0x231254}},'transaction':_0x4c7877});})['then'](function(){var _0x4ec336=_0xc3c4('0x67')+_0x3bc991;return db[_0xc3c4('0x55')]['query'](_0x4ec336,{'type':db[_0xc3c4('0x5a')]['QueryTypes'][_0xc3c4('0x58')],'raw':!![],'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(_0x4fc285){var _0x36cdbf=_[_0xc3c4('0x34')](_0x4fc285,function(_0x272f2c){return Number(_0x272f2c[_0xc3c4('0x68')]);});return db[_0xc3c4('0x69')][_0xc3c4('0x5c')]({'where':{'UserId':{'$in':_0x148cc6},'OpenchannelQueueId':{'$in':_0x36cdbf}},'transaction':_0x4c7877});})['then'](function(){var _0x1a7738='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3bc991;return db[_0xc3c4('0x55')][_0xc3c4('0x36')](_0x1a7738,{'type':db[_0xc3c4('0x5a')][_0xc3c4('0x57')]['SELECT'],'raw':!![],'transaction':_0x4c7877});})['then'](function(_0x3fecc1){var _0xbe7cb5=_[_0xc3c4('0x34')](_0x3fecc1,function(_0x31d894){return Number(_0x31d894[_0xc3c4('0x6a')]);});return db[_0xc3c4('0x6b')][_0xc3c4('0x5c')]({'where':{'UserId':{'$in':_0x148cc6},'WhatsappQueueId':{'$in':_0xbe7cb5}},'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(){return db[_0xc3c4('0x6c')]['find']({'where':{'TeamId':_0x3bc991}});})[_0xc3c4('0x28')](function(_0x42d0fa){if(_0x42d0fa===null){return;}return db[_0xc3c4('0x6d')][_0xc3c4('0x5c')]({'where':{'UserId':{'$in':_0x148cc6},'VoicePrefixId':_0x42d0fa[_0xc3c4('0x6e')]},'transaction':_0x4c7877});})['then'](function(){return db[_0xc3c4('0x2e')][_0xc3c4('0x5c')]({'where':{'id':_0x3bc991},'cascade':!![],'transaction':_0x4c7877});})[_0xc3c4('0x28')](function(_0x10ec1b){if(_0x10ec1b===0x0){_0x50d2be[_0xc3c4('0x29')](0x194);}else{return db['UserProfileResource'][_0xc3c4('0x5c')]({'where':{'type':_0xc3c4('0x6f'),'resourceId':_0x3bc991},'cascade':!![],'transaction':_0x4c7877})[_0xc3c4('0x28')](function(){_0x50d2be['status'](0xcc)[_0xc3c4('0x1d')]();});}})[_0xc3c4('0x46')](function(_0x352de3){_0x50d2be['status'](0x1f4)[_0xc3c4('0x70')](_0x352de3);});});};exports['getQueues']=function(_0x135dc8,_0x16c0eb,_0x526223){return db[_0xc3c4('0x2e')][_0xc3c4('0x71')]({'where':{'id':_0x135dc8[_0xc3c4('0x54')]['id']}})[_0xc3c4('0x28')](handleEntityNotFound(_0x16c0eb,null))[_0xc3c4('0x28')](function(_0x36d4cf){if(!_0x135dc8[_0xc3c4('0x36')]['channel']||!utils['isValidChannel'](_0x135dc8[_0xc3c4('0x36')][_0xc3c4('0x72')])){throw new db[(_0xc3c4('0x5a'))][(_0xc3c4('0x73'))](_0xc3c4('0x74'));}var _0x528bd1={};var _0xd76c17={};_0xd76c17[_0xc3c4('0x33')]=_['keys'](db[_[_0xc3c4('0x75')](_0x135dc8[_0xc3c4('0x36')][_0xc3c4('0x72')]['toLowerCase']())+_0xc3c4('0x76')][_0xc3c4('0x2f')]);_0xd76c17[_0xc3c4('0x36')]=_[_0xc3c4('0x35')](_0x135dc8['query']);_0xd76c17[_0xc3c4('0x37')]=_['intersection'](_0xd76c17[_0xc3c4('0x33')],_0xd76c17[_0xc3c4('0x36')]);_0x528bd1[_0xc3c4('0x39')]=_[_0xc3c4('0x38')](_0xd76c17[_0xc3c4('0x33')],qs[_0xc3c4('0x3a')](_0x135dc8[_0xc3c4('0x36')][_0xc3c4('0x3a')]));_0x528bd1['attributes']=_0x528bd1[_0xc3c4('0x39')][_0xc3c4('0x3b')]?_0x528bd1['attributes']:_0xd76c17[_0xc3c4('0x33')];_0x528bd1[_0xc3c4('0x1f')]=qs[_0xc3c4('0x1f')](_0x135dc8[_0xc3c4('0x36')]['limit']);_0x528bd1[_0xc3c4('0x21')]=qs[_0xc3c4('0x21')](_0x135dc8[_0xc3c4('0x36')][_0xc3c4('0x21')]);_0x528bd1[_0xc3c4('0x77')]=qs[_0xc3c4('0x3e')](_0x135dc8[_0xc3c4('0x36')][_0xc3c4('0x3e')]);_0x528bd1[_0xc3c4('0x3f')]=qs['filters'](_[_0xc3c4('0x78')](_0x135dc8['query'],_0xd76c17['filters']));_0x528bd1=_[_0xc3c4('0x40')]({},_0x528bd1,_0x135dc8[_0xc3c4('0x42')]);return _0x36d4cf[_0xc3c4('0x4c')+_[_0xc3c4('0x75')](_0x135dc8[_0xc3c4('0x36')]['channel'][_0xc3c4('0x79')]())+_0xc3c4('0x7a')](_0x528bd1);})[_0xc3c4('0x28')](respondWithResult(_0x16c0eb,null))[_0xc3c4('0x46')](handleError(_0x16c0eb,null));};exports['addQueues']=function(_0x4d6eff,_0x8d6340,_0x196263){return db['Team']['findOne']({'where':{'id':_0x4d6eff[_0xc3c4('0x54')]['id']}})[_0xc3c4('0x28')](function(_0x1cdac7){if(_0x1cdac7){if(!_0x4d6eff['body'][_0xc3c4('0x72')]||!utils[_0xc3c4('0x7b')](_0x4d6eff[_0xc3c4('0x4a')][_0xc3c4('0x72')])){throw new db[(_0xc3c4('0x5a'))][(_0xc3c4('0x73'))]('Unknown\x20channel');}return _0x1cdac7[_0xc3c4('0x7c')+_['capitalize'](_0x4d6eff[_0xc3c4('0x4a')][_0xc3c4('0x72')]['toLowerCase']())+_0xc3c4('0x7a')](_0x4d6eff['body']['ids']);}return null;})[_0xc3c4('0x28')](handleEntityNotFound(_0x8d6340,null))['then'](respondWithStatusCode(_0x8d6340,null))[_0xc3c4('0x46')](handleError(_0x8d6340,null));};exports[_0xc3c4('0x7d')]=function(_0x123ca2,_0x4debc7,_0x243001){return db['Team'][_0xc3c4('0x71')]({'where':{'id':_0x123ca2[_0xc3c4('0x54')]['id']}})['then'](function(_0x36c1f4){if(_0x36c1f4){if(!_0x123ca2[_0xc3c4('0x36')][_0xc3c4('0x72')]||!utils[_0xc3c4('0x7b')](_0x123ca2[_0xc3c4('0x36')][_0xc3c4('0x72')])){throw new db[(_0xc3c4('0x5a'))][(_0xc3c4('0x73'))](_0xc3c4('0x74'));}return _0x36c1f4[_0xc3c4('0x7e')+_[_0xc3c4('0x75')](_0x123ca2[_0xc3c4('0x36')][_0xc3c4('0x72')]['toLowerCase']())+'Queues'](_0x123ca2[_0xc3c4('0x36')][_0xc3c4('0x7f')]);}return null;})[_0xc3c4('0x28')](handleEntityNotFound(_0x4debc7,null))[_0xc3c4('0x28')](respondWithStatusCode(_0x4debc7,null))[_0xc3c4('0x46')](handleError(_0x4debc7,null));};exports[_0xc3c4('0x80')]=function(_0xa75723,_0x16c0bf){var _0x56cfd7=_['isArray'](_0xa75723[_0xc3c4('0x4a')][_0xc3c4('0x7f')])?_0xa75723[_0xc3c4('0x4a')][_0xc3c4('0x7f')]:[_0xa75723[_0xc3c4('0x4a')][_0xc3c4('0x7f')]];var _0x11bd10=_0xa75723['params']['id'];return db[_0xc3c4('0x2e')][_0xc3c4('0x49')]({'where':{'id':_0x11bd10}})[_0xc3c4('0x28')](handleEntityNotFound(_0x16c0bf,null))[_0xc3c4('0x28')](function(_0xd1d28c){if(_0xd1d28c){var _0x281b4d=[_0xc3c4('0x81'),_0xc3c4('0x82'),_0xc3c4('0x83'),_0xc3c4('0x84'),_0xc3c4('0x85'),_0xc3c4('0x86'),_0xc3c4('0x87')];return db[_0xc3c4('0x55')][_0xc3c4('0x88')](function(_0x45a176){var _0x51e6e6=_['map'](_0x281b4d,function(_0x1e5119){var _0xc9f346={'attributes':['id',_0xc3c4('0x2c')]};if(_0x1e5119==='Voice'){_0xc9f346['through']={'attributes':[_0xc3c4('0x89')]};}return _0xd1d28c['get'+_0x1e5119+_0xc3c4('0x7a')](_0xc9f346)['then'](function(_0x3a7989){var _0x59a631=_[_0xc3c4('0x34')](_0x3a7989,function(_0x56f37f){var _0x87550d=_[_0xc3c4('0x34')](_0x56cfd7,function(_0x3b10da){var _0x5a901d={'where':{'UserId':_0x3b10da,[_0x1e5119+_0xc3c4('0x8a')]:_0x56f37f['id']},'transaction':_0x45a176};if(_0x1e5119==='Voice'){_0x5a901d[_0xc3c4('0x18')]={'penalty':_0x56f37f[_0xc3c4('0x8b')]['penalty']};}return db[_0xc3c4('0x8c')+_0x1e5119+_0xc3c4('0x76')][_0xc3c4('0x8d')](_0x5a901d)[_0xc3c4('0x28')](function(){socket[_0xc3c4('0x8e')]('user'+_0x1e5119+'Queue:save',{'UserId':_0x3b10da,[_0x1e5119+'QueueId']:_0x56f37f['id']});if(_0x1e5119!=='Voice'){return;}return db[_0xc3c4('0x8c')][_0xc3c4('0x44')]({'where':{'id':_0x56cfd7,'online':0x1},'attributes':['id',_0xc3c4('0x2c'),_0xc3c4('0x8f'),_0xc3c4('0x90'),_0xc3c4('0x91')],'raw':!![]})[_0xc3c4('0x28')](function(_0x184a01){var _0x265df5=_[_0xc3c4('0x34')](_0x184a01,function(_0x4531b4){return db[_0xc3c4('0x92')][_0xc3c4('0x93')]({'membername':_0x4531b4['name'],'UserId':_0x4531b4['id'],'queue_name':_0x56f37f[_0xc3c4('0x2c')],'VoiceQueueId':_0x56f37f['id'],'interface':_[_0xc3c4('0x94')](_0x4531b4[_0xc3c4('0x91')])?util[_0xc3c4('0x95')]('SIP/%s',_0x4531b4['name']):_0x4531b4[_0xc3c4('0x91')],'paused':_0x4531b4[_0xc3c4('0x90')]||![],'penalty':_0x56f37f[_0xc3c4('0x8b')]['penalty']},{'transaction':_0x45a176});});return Promise[_0xc3c4('0x96')](_0x265df5);});});});return Promise[_0xc3c4('0x96')](_0x87550d);});return Promise['all'](_0x59a631);})[_0xc3c4('0x28')](function(){return db[_0xc3c4('0x6c')][_0xc3c4('0x71')]({'where':{'teamId':_0x11bd10}})['then'](function(_0x63edb7){if(_0x63edb7){var _0x4ce478=_[_0xc3c4('0x34')](_0x56cfd7,function(_0x662215){db[_0xc3c4('0x6d')][_0xc3c4('0x93')]({'UserId':_0x662215,'VoicePrefixId':_0x63edb7[_0xc3c4('0x6e')]});});return Promise['all'](_0x4ce478);}});});});return Promise['all'](_0x51e6e6)[_0xc3c4('0x28')](function(){return _0xd1d28c[_0xc3c4('0x80')](_0x56cfd7,{'transaction':_0x45a176})[_0xc3c4('0x97')](function(_0x165ddb){return _0x165ddb;});});});}})[_0xc3c4('0x28')](respondWithResult(_0x16c0bf,null))['catch'](handleError(_0x16c0bf,null));};exports[_0xc3c4('0x98')]=function(_0x7044d4,_0x153f59){var _0x3e2e5f=_[_0xc3c4('0x99')](_0x7044d4[_0xc3c4('0x36')][_0xc3c4('0x7f')])?_0x7044d4[_0xc3c4('0x36')][_0xc3c4('0x7f')]:[_0x7044d4[_0xc3c4('0x36')][_0xc3c4('0x7f')]];var _0x5808a1=_0x7044d4[_0xc3c4('0x54')]['id'];return db[_0xc3c4('0x2e')][_0xc3c4('0x49')]({'where':{'id':_0x5808a1}})[_0xc3c4('0x28')](handleEntityNotFound(_0x153f59,null))['then'](function(_0x532e76){if(_0x532e76){var _0x94e0a3=[_0xc3c4('0x81'),'Chat',_0xc3c4('0x83'),_0xc3c4('0x84'),_0xc3c4('0x85'),_0xc3c4('0x86'),_0xc3c4('0x87')];return db['sequelize']['transaction'](function(_0x54c8e8){var _0x5a19d3=_['map'](_0x94e0a3,function(_0x420616){var _0x842a75={'attributes':['id','name']};return _0x532e76[_0xc3c4('0x4c')+_0x420616+_0xc3c4('0x7a')](_0x842a75)[_0xc3c4('0x28')](function(_0x18cea4){var _0x10ce1d=_[_0xc3c4('0x34')](_0x18cea4,function(_0x2c6ccf){return _0x2c6ccf['removeAgents'](_0x3e2e5f,{'transaction':_0x54c8e8})[_0xc3c4('0x28')](function(){var _0x358d63=_[_0xc3c4('0x34')](_0x3e2e5f,function(_0x2930cb){socket['emit'](_0xc3c4('0x4b')+_0x420616+_0xc3c4('0x9a'),{'UserId':Number(_0x2930cb),[_0x420616+_0xc3c4('0x8a')]:_0x2c6ccf['id']});if(_0x420616!==_0xc3c4('0x81')){return;}return db[_0xc3c4('0x92')]['destroy']({'where':{'VoiceQueueId':_0x2c6ccf['id'],'UserId':_0x2930cb},'transaction':_0x54c8e8});});return Promise[_0xc3c4('0x96')](_0x358d63);});});return Promise[_0xc3c4('0x96')](_0x10ce1d);});});return Promise[_0xc3c4('0x96')](_0x5a19d3)[_0xc3c4('0x28')](function(){return _0x532e76['removeAgents'](_0x3e2e5f,{'transaction':_0x54c8e8});})[_0xc3c4('0x28')](function(){return db[_0xc3c4('0x6c')][_0xc3c4('0x71')]({'where':{'teamId':_0x5808a1}})[_0xc3c4('0x28')](function(_0x9313d3){if(_0x9313d3){var _0x357fe7=_['map'](_0x3e2e5f,function(_0x50bb94){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x50bb94,'VoicePrefixId':_0x9313d3[_0xc3c4('0x6e')]}});});return Promise[_0xc3c4('0x96')](_0x357fe7);}});});});}})[_0xc3c4('0x28')](respondWithStatusCode(_0x153f59,null))['catch'](handleError(_0x153f59,null));};exports[_0xc3c4('0x9b')]=function(_0x5c0820,_0x1252fb,_0x38e40f){var _0xd98a5c={};var _0x9d518f={};var _0x565dc2;var _0x330e6f;return db[_0xc3c4('0x2e')]['findOne']({'where':{'id':_0x5c0820['params']['id']}})[_0xc3c4('0x28')](handleEntityNotFound(_0x1252fb,null))[_0xc3c4('0x28')](function(_0x455f5c){if(_0x455f5c){_0x565dc2=_0x455f5c;_0x9d518f[_0xc3c4('0x33')]=_[_0xc3c4('0x35')](db[_0xc3c4('0x8c')][_0xc3c4('0x2f')]);_0x9d518f[_0xc3c4('0x36')]=_['keys'](_0x5c0820[_0xc3c4('0x36')]);_0x9d518f[_0xc3c4('0x37')]=_[_0xc3c4('0x38')](_0x9d518f[_0xc3c4('0x33')],_0x9d518f[_0xc3c4('0x36')]);_0xd98a5c[_0xc3c4('0x39')]=_[_0xc3c4('0x38')](_0x9d518f[_0xc3c4('0x33')],qs[_0xc3c4('0x3a')](_0x5c0820[_0xc3c4('0x36')][_0xc3c4('0x3a')]));_0xd98a5c[_0xc3c4('0x39')]=_0xd98a5c[_0xc3c4('0x39')]['length']?_0xd98a5c[_0xc3c4('0x39')]:_0x9d518f['model'];_0xd98a5c[_0xc3c4('0x77')]=qs['sort'](_0x5c0820['query'][_0xc3c4('0x3e')]);_0xd98a5c['where']=qs['filters'](_[_0xc3c4('0x78')](_0x5c0820[_0xc3c4('0x36')],_0x9d518f[_0xc3c4('0x37')]));if(_0x5c0820[_0xc3c4('0x36')][_0xc3c4('0x9c')]){_0xd98a5c[_0xc3c4('0x3f')]=_[_0xc3c4('0x40')](_0xd98a5c[_0xc3c4('0x3f')],{'$or':_[_0xc3c4('0x34')](_0xd98a5c[_0xc3c4('0x39')],function(_0x5d5b63){var _0x2f086a={};_0x2f086a[_0x5d5b63]={'$like':'%'+_0x5c0820['query']['filter']+'%'};return _0x2f086a;})});}_0xd98a5c=_[_0xc3c4('0x40')]({},_0xd98a5c,_0x5c0820[_0xc3c4('0x42')]);return _0x565dc2[_0xc3c4('0x9b')](_0xd98a5c);}})[_0xc3c4('0x28')](function(_0x4139c){if(_0x4139c){_0x330e6f=_0x4139c[_0xc3c4('0x3b')];if(!_0x5c0820[_0xc3c4('0x36')]['hasOwnProperty'](_0xc3c4('0x3d'))){_0xd98a5c[_0xc3c4('0x1f')]=qs[_0xc3c4('0x1f')](_0x5c0820[_0xc3c4('0x36')][_0xc3c4('0x1f')]);_0xd98a5c['offset']=qs[_0xc3c4('0x21')](_0x5c0820[_0xc3c4('0x36')]['offset']);}return _0x565dc2[_0xc3c4('0x9b')](_0xd98a5c);}})[_0xc3c4('0x28')](function(_0x46d12c){if(_0x46d12c){return _0x46d12c?{'count':_0x330e6f,'rows':_0x46d12c}:null;}})['then'](respondWithResult(_0x1252fb,null))[_0xc3c4('0x46')](handleError(_0x1252fb,null));}; \ No newline at end of file +var _0xf267=['bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','map','Team','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','params','rawAttributes','include','options','catch','create','user','get','role','Teams','userProfileId','autoAssociation','UserProfileResource','body','find','destroy','sequelize','transaction','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','pick','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','QueueId','User','Queue','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','isArray','Openchannel','Queue:remove','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf267,0x1c4));var _0x7f26=function(_0x3bdaca,_0x43d738){_0x3bdaca=_0x3bdaca-0x0;var _0x2867a3=_0xf267[_0x3bdaca];return _0x2867a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f26('0x0'));var zipdir=require(_0x7f26('0x1'));var jsonpatch=require(_0x7f26('0x2'));var rp=require(_0x7f26('0x3'));var moment=require('moment');var BPromise=require(_0x7f26('0x4'));var Mustache=require(_0x7f26('0x5'));var util=require(_0x7f26('0x6'));var path=require(_0x7f26('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f26('0x8'));var _=require(_0x7f26('0x9'));var squel=require(_0x7f26('0xa'));var crypto=require(_0x7f26('0xb'));var jsforce=require(_0x7f26('0xc'));var deskjs=require(_0x7f26('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f26('0xe'));var Papa=require(_0x7f26('0xf'));var Redis=require(_0x7f26('0x10'));var authService=require(_0x7f26('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f26('0x12'));var hardwareService=require(_0x7f26('0x13'));var logger=require('../../config/logger')(_0x7f26('0x14'));var utils=require(_0x7f26('0x15'));var config=require(_0x7f26('0x16'));var licenseUtil=require(_0x7f26('0x17'));var db=require(_0x7f26('0x18'))['db'];config[_0x7f26('0x19')]=_[_0x7f26('0x1a')](config[_0x7f26('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f26('0x1b'))(new Redis(config[_0x7f26('0x19')]));require(_0x7f26('0x1c'))[_0x7f26('0x1d')](socket);function respondWithStatusCode(_0x3e9c39,_0x2992b1){_0x2992b1=_0x2992b1||0xcc;return function(_0x4e788d){if(_0x4e788d){return _0x3e9c39[_0x7f26('0x1e')](_0x2992b1);}return _0x3e9c39['status'](_0x2992b1)['end']();};}function respondWithResult(_0x56ecc8,_0x4d86fa){_0x4d86fa=_0x4d86fa||0xc8;return function(_0x52bf48){if(_0x52bf48){return _0x56ecc8[_0x7f26('0x1f')](_0x4d86fa)[_0x7f26('0x20')](_0x52bf48);}};}function respondWithFilteredResult(_0x433f8b,_0x206491){return function(_0x5144cc){if(_0x5144cc){var _0x3b0ed6=typeof _0x206491[_0x7f26('0x21')]===_0x7f26('0x22')&&typeof _0x206491[_0x7f26('0x23')]===_0x7f26('0x22');var _0x4d6c27=_0x5144cc[_0x7f26('0x24')];var _0x513ac6=_0x3b0ed6?0x0:_0x206491['offset'];var _0x275862=_0x3b0ed6?_0x5144cc['count']:_0x206491['offset']+_0x206491[_0x7f26('0x23')];var _0x2a600d;if(_0x275862>=_0x4d6c27){_0x275862=_0x4d6c27;_0x2a600d=0xc8;}else{_0x2a600d=0xce;}_0x433f8b[_0x7f26('0x1f')](_0x2a600d);return _0x433f8b[_0x7f26('0x25')](_0x7f26('0x26'),_0x513ac6+'-'+_0x275862+'/'+_0x4d6c27)[_0x7f26('0x20')](_0x5144cc);}return null;};}function patchUpdates(_0x254cd1){return function(_0x1dc050){try{jsonpatch['apply'](_0x1dc050,_0x254cd1,!![]);}catch(_0x1ac8b7){return BPromise['reject'](_0x1ac8b7);}return _0x1dc050[_0x7f26('0x27')]();};}function saveUpdates(_0x34a806,_0x45075b){return function(_0x3efea9){if(_0x3efea9){return _0x3efea9[_0x7f26('0x28')](_0x34a806)[_0x7f26('0x29')](function(_0x5f2d79){return _0x5f2d79;});}return null;};}function handleEntityNotFound(_0x524ffa,_0x395b3e){return function(_0x3d21e5){if(!_0x3d21e5){_0x524ffa[_0x7f26('0x1e')](0x194);}return _0x3d21e5;};}function handleError(_0xc15e2b,_0x3048b3){_0x3048b3=_0x3048b3||0x1f4;return function(_0x25e39e){logger[_0x7f26('0x2a')](_0x25e39e[_0x7f26('0x2b')]);if(_0x25e39e[_0x7f26('0x2c')]){delete _0x25e39e[_0x7f26('0x2c')];}_0xc15e2b['status'](_0x3048b3)[_0x7f26('0x2d')](_0x25e39e);};}exports[_0x7f26('0x2e')]=function(_0x1bcafa,_0x4145ec){var _0x5c2039={},_0x2240af={},_0x4f0908={'count':0x0,'rows':[]};var _0x330b92=_[_0x7f26('0x2f')](db[_0x7f26('0x30')]['rawAttributes'],function(_0x4f45d3){return{'name':_0x4f45d3[_0x7f26('0x31')],'type':_0x4f45d3['type'][_0x7f26('0x32')]};});_0x2240af['model']=_[_0x7f26('0x2f')](_0x330b92,_0x7f26('0x2c'));_0x2240af[_0x7f26('0x33')]=_[_0x7f26('0x34')](_0x1bcafa[_0x7f26('0x33')]);_0x2240af[_0x7f26('0x35')]=_[_0x7f26('0x36')](_0x2240af[_0x7f26('0x37')],_0x2240af[_0x7f26('0x33')]);_0x5c2039[_0x7f26('0x38')]=_[_0x7f26('0x36')](_0x2240af[_0x7f26('0x37')],qs[_0x7f26('0x39')](_0x1bcafa[_0x7f26('0x33')][_0x7f26('0x39')]));_0x5c2039[_0x7f26('0x38')]=_0x5c2039[_0x7f26('0x38')][_0x7f26('0x3a')]?_0x5c2039[_0x7f26('0x38')]:_0x2240af[_0x7f26('0x37')];if(!_0x1bcafa[_0x7f26('0x33')][_0x7f26('0x3b')]('nolimit')){_0x5c2039[_0x7f26('0x23')]=qs[_0x7f26('0x23')](_0x1bcafa[_0x7f26('0x33')]['limit']);_0x5c2039['offset']=qs[_0x7f26('0x21')](_0x1bcafa[_0x7f26('0x33')][_0x7f26('0x21')]);}_0x5c2039[_0x7f26('0x3c')]=qs[_0x7f26('0x3d')](_0x1bcafa[_0x7f26('0x33')]['sort']);_0x5c2039[_0x7f26('0x3e')]=qs[_0x7f26('0x35')](_['pick'](_0x1bcafa[_0x7f26('0x33')],_0x2240af['filters']),_0x330b92);if(_0x1bcafa['query'][_0x7f26('0x3f')]){_0x5c2039[_0x7f26('0x3e')]=_[_0x7f26('0x40')](_0x5c2039[_0x7f26('0x3e')],{'$or':_[_0x7f26('0x2f')](_0x330b92,function(_0x46fc19){if(_0x46fc19[_0x7f26('0x41')]!==_0x7f26('0x42')){var _0x1ed05d={};_0x1ed05d[_0x46fc19[_0x7f26('0x2c')]]={'$like':'%'+_0x1bcafa[_0x7f26('0x33')][_0x7f26('0x3f')]+'%'};return _0x1ed05d;}})});}_0x5c2039=_[_0x7f26('0x40')]({},_0x5c2039,_0x1bcafa['options']);var _0x14be59={'where':_0x5c2039[_0x7f26('0x3e')]};return db['Team']['count'](_0x14be59)[_0x7f26('0x29')](function(_0xfbef71){_0x4f0908[_0x7f26('0x24')]=_0xfbef71;if(_0x1bcafa[_0x7f26('0x33')][_0x7f26('0x43')]){_0x5c2039['include']=[{'all':!![]}];}return db[_0x7f26('0x30')][_0x7f26('0x44')](_0x5c2039);})['then'](function(_0x999147){_0x4f0908['rows']=_0x999147;return _0x4f0908;})[_0x7f26('0x29')](respondWithFilteredResult(_0x4145ec,_0x5c2039))['catch'](handleError(_0x4145ec,null));};exports['show']=function(_0x892529,_0x4b6df2){var _0x18cc23={'raw':![],'where':{'id':_0x892529[_0x7f26('0x45')]['id']}},_0x78819f={};_0x78819f[_0x7f26('0x37')]=_[_0x7f26('0x34')](db[_0x7f26('0x30')][_0x7f26('0x46')]);_0x78819f[_0x7f26('0x33')]=_[_0x7f26('0x34')](_0x892529[_0x7f26('0x33')]);_0x78819f[_0x7f26('0x35')]=_[_0x7f26('0x36')](_0x78819f[_0x7f26('0x37')],_0x78819f['query']);_0x18cc23[_0x7f26('0x38')]=_[_0x7f26('0x36')](_0x78819f[_0x7f26('0x37')],qs[_0x7f26('0x39')](_0x892529[_0x7f26('0x33')][_0x7f26('0x39')]));_0x18cc23['attributes']=_0x18cc23[_0x7f26('0x38')][_0x7f26('0x3a')]?_0x18cc23[_0x7f26('0x38')]:_0x78819f[_0x7f26('0x37')];if(_0x892529['query'][_0x7f26('0x43')]){_0x18cc23[_0x7f26('0x47')]=[{'all':!![]}];}_0x18cc23=_[_0x7f26('0x40')]({},_0x18cc23,_0x892529[_0x7f26('0x48')]);return db[_0x7f26('0x30')]['find'](_0x18cc23)[_0x7f26('0x29')](handleEntityNotFound(_0x4b6df2,null))[_0x7f26('0x29')](respondWithResult(_0x4b6df2,null))[_0x7f26('0x49')](handleError(_0x4b6df2,null));};exports[_0x7f26('0x4a')]=function(_0x58a1eb,_0x18921b){return db['Team'][_0x7f26('0x4a')](_0x58a1eb['body'],{})[_0x7f26('0x29')](function(_0x3e5b76){var _0x50eb2f=_0x58a1eb[_0x7f26('0x4b')][_0x7f26('0x4c')]({'plain':!![]});if(!_0x50eb2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50eb2f[_0x7f26('0x4d')]===_0x7f26('0x4b')){var _0x1bbabd=_0x3e5b76['get']({'plain':!![]});var _0x559730=_0x7f26('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x559730,'userProfileId':_0x50eb2f[_0x7f26('0x4f')]},'raw':!![]})[_0x7f26('0x29')](function(_0x323af3){if(_0x323af3&&_0x323af3[_0x7f26('0x50')]===0x0){return db[_0x7f26('0x51')][_0x7f26('0x4a')]({'name':_0x1bbabd[_0x7f26('0x2c')],'resourceId':_0x1bbabd['id'],'type':_0x323af3[_0x7f26('0x2c')],'sectionId':_0x323af3['id']},{})[_0x7f26('0x29')](function(){return _0x3e5b76;});}else{return _0x3e5b76;}})['catch'](function(_0x4c8add){logger[_0x7f26('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c8add);throw _0x4c8add;});}return _0x3e5b76;})[_0x7f26('0x29')](respondWithResult(_0x18921b,0xc9))[_0x7f26('0x49')](handleError(_0x18921b,null));};exports[_0x7f26('0x28')]=function(_0x1cf5fd,_0x3b1995){if(_0x1cf5fd['body']['id']){delete _0x1cf5fd[_0x7f26('0x52')]['id'];}return db[_0x7f26('0x30')][_0x7f26('0x53')]({'where':{'id':_0x1cf5fd['params']['id']}})['then'](handleEntityNotFound(_0x3b1995,null))[_0x7f26('0x29')](saveUpdates(_0x1cf5fd[_0x7f26('0x52')],null))[_0x7f26('0x29')](respondWithResult(_0x3b1995,null))[_0x7f26('0x49')](handleError(_0x3b1995,null));};exports[_0x7f26('0x54')]=function(_0x4d1384,_0x54cde8){var _0x52a26f=_0x4d1384[_0x7f26('0x45')]['id'];var _0x49ee9b=[];return db[_0x7f26('0x55')][_0x7f26('0x56')](function(_0x12e214){var _0x2ca633='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x52a26f;return db[_0x7f26('0x55')][_0x7f26('0x33')](_0x2ca633,{'type':db['Sequelize'][_0x7f26('0x57')][_0x7f26('0x58')],'raw':!![],'transaction':_0x12e214})[_0x7f26('0x29')](function(_0x1f980c){_0x49ee9b=_[_0x7f26('0x2f')](_0x1f980c,function(_0x3585de){return Number(_0x3585de[_0x7f26('0x59')]);});})['then'](function(){var _0x47eea0=_0x7f26('0x5a')+_0x52a26f;return db[_0x7f26('0x55')][_0x7f26('0x33')](_0x47eea0,{'type':db[_0x7f26('0x5b')][_0x7f26('0x57')]['SELECT'],'raw':!![],'transaction':_0x12e214});})[_0x7f26('0x29')](function(_0x5b574c){var _0x4f676e=_[_0x7f26('0x2f')](_0x5b574c,function(_0x275f98){return Number(_0x275f98[_0x7f26('0x5c')]);});return db[_0x7f26('0x5d')][_0x7f26('0x54')]({'where':{'UserId':{'$in':_0x49ee9b},'VoiceQueueId':{'$in':_0x4f676e}},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){var _0x2ae0c9=_0x7f26('0x5e')+_0x52a26f;return db['sequelize'][_0x7f26('0x33')](_0x2ae0c9,{'type':db[_0x7f26('0x5b')][_0x7f26('0x57')][_0x7f26('0x58')],'raw':!![],'transaction':_0x12e214});})[_0x7f26('0x29')](function(_0x191856){var _0x40122e=_[_0x7f26('0x2f')](_0x191856,function(_0x5b6f7){return Number(_0x5b6f7['MailQueueId']);});return db[_0x7f26('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x49ee9b},'MailQueueId':{'$in':_0x40122e}},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){var _0x91622c='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x52a26f;return db['sequelize'][_0x7f26('0x33')](_0x91622c,{'type':db[_0x7f26('0x5b')][_0x7f26('0x57')][_0x7f26('0x58')],'raw':!![],'transaction':_0x12e214});})[_0x7f26('0x29')](function(_0x40a6f3){var _0x4169cc=_['map'](_0x40a6f3,function(_0x1aa20e){return Number(_0x1aa20e[_0x7f26('0x60')]);});return db[_0x7f26('0x61')][_0x7f26('0x54')]({'where':{'UserId':{'$in':_0x49ee9b},'SmsQueueId':{'$in':_0x4169cc}},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){var _0xb76611=_0x7f26('0x62')+_0x52a26f;return db[_0x7f26('0x55')][_0x7f26('0x33')](_0xb76611,{'type':db['Sequelize'][_0x7f26('0x57')][_0x7f26('0x58')],'raw':!![],'transaction':_0x12e214});})[_0x7f26('0x29')](function(_0x56e9c2){var _0x1ed6b2=_[_0x7f26('0x2f')](_0x56e9c2,function(_0x48813f){return Number(_0x48813f['ChatQueueId']);});return db[_0x7f26('0x63')]['destroy']({'where':{'UserId':{'$in':_0x49ee9b},'ChatQueueId':{'$in':_0x1ed6b2}},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){var _0x2ad48e=_0x7f26('0x64')+_0x52a26f;return db['sequelize']['query'](_0x2ad48e,{'type':db[_0x7f26('0x5b')]['QueryTypes'][_0x7f26('0x58')],'raw':!![],'transaction':_0x12e214});})['then'](function(_0x5b8863){var _0x566c12=_[_0x7f26('0x2f')](_0x5b8863,function(_0x56a812){return Number(_0x56a812['FaxQueueId']);});return db[_0x7f26('0x65')][_0x7f26('0x54')]({'where':{'UserId':{'$in':_0x49ee9b},'FaxQueueId':{'$in':_0x566c12}},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){var _0x56d8c9=_0x7f26('0x66')+_0x52a26f;return db['sequelize'][_0x7f26('0x33')](_0x56d8c9,{'type':db[_0x7f26('0x5b')][_0x7f26('0x57')][_0x7f26('0x58')],'raw':!![],'transaction':_0x12e214});})[_0x7f26('0x29')](function(_0x4059de){var _0xede332=_[_0x7f26('0x2f')](_0x4059de,function(_0x87bb0e){return Number(_0x87bb0e['OpenchannelQueueId']);});return db[_0x7f26('0x67')]['destroy']({'where':{'UserId':{'$in':_0x49ee9b},'OpenchannelQueueId':{'$in':_0xede332}},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){var _0x21c807='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x52a26f;return db[_0x7f26('0x55')][_0x7f26('0x33')](_0x21c807,{'type':db[_0x7f26('0x5b')][_0x7f26('0x57')][_0x7f26('0x58')],'raw':!![],'transaction':_0x12e214});})[_0x7f26('0x29')](function(_0x2f47c8){var _0x3b02a7=_['map'](_0x2f47c8,function(_0x2c1e53){return Number(_0x2c1e53[_0x7f26('0x68')]);});return db['UserWhatsappQueue'][_0x7f26('0x54')]({'where':{'UserId':{'$in':_0x49ee9b},'WhatsappQueueId':{'$in':_0x3b02a7}},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x52a26f}});})[_0x7f26('0x29')](function(_0x242b25){if(_0x242b25===null){return;}return db[_0x7f26('0x69')]['destroy']({'where':{'UserId':{'$in':_0x49ee9b},'VoicePrefixId':_0x242b25[_0x7f26('0x6a')]},'transaction':_0x12e214});})[_0x7f26('0x29')](function(){return db[_0x7f26('0x30')][_0x7f26('0x54')]({'where':{'id':_0x52a26f},'cascade':!![],'transaction':_0x12e214});})['then'](function(_0x176176){if(_0x176176===0x0){_0x54cde8['sendStatus'](0x194);}else{return db[_0x7f26('0x51')][_0x7f26('0x54')]({'where':{'type':_0x7f26('0x4e'),'resourceId':_0x52a26f},'cascade':!![],'transaction':_0x12e214})[_0x7f26('0x29')](function(){_0x54cde8[_0x7f26('0x1f')](0xcc)['end']();});}})[_0x7f26('0x49')](function(_0x40755a){_0x54cde8[_0x7f26('0x1f')](0x1f4)[_0x7f26('0x2d')](_0x40755a);});});};exports[_0x7f26('0x6b')]=function(_0x4708e2,_0x1ab59d,_0x5166e1){return db['Team'][_0x7f26('0x6c')]({'where':{'id':_0x4708e2[_0x7f26('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ab59d,null))[_0x7f26('0x29')](function(_0x2470a2){if(!_0x4708e2[_0x7f26('0x33')][_0x7f26('0x6d')]||!utils[_0x7f26('0x6e')](_0x4708e2[_0x7f26('0x33')][_0x7f26('0x6d')])){throw new db[(_0x7f26('0x5b'))][(_0x7f26('0x6f'))](_0x7f26('0x70'));}var _0x2d29f4={};var _0x5c60af={};_0x5c60af[_0x7f26('0x37')]=_[_0x7f26('0x34')](db[_['capitalize'](_0x4708e2[_0x7f26('0x33')][_0x7f26('0x6d')][_0x7f26('0x71')]())+'Queue'][_0x7f26('0x46')]);_0x5c60af[_0x7f26('0x33')]=_[_0x7f26('0x34')](_0x4708e2['query']);_0x5c60af[_0x7f26('0x35')]=_['intersection'](_0x5c60af[_0x7f26('0x37')],_0x5c60af[_0x7f26('0x33')]);_0x2d29f4[_0x7f26('0x38')]=_[_0x7f26('0x36')](_0x5c60af['model'],qs[_0x7f26('0x39')](_0x4708e2['query'][_0x7f26('0x39')]));_0x2d29f4[_0x7f26('0x38')]=_0x2d29f4[_0x7f26('0x38')]['length']?_0x2d29f4['attributes']:_0x5c60af[_0x7f26('0x37')];_0x2d29f4[_0x7f26('0x23')]=qs[_0x7f26('0x23')](_0x4708e2[_0x7f26('0x33')]['limit']);_0x2d29f4[_0x7f26('0x21')]=qs[_0x7f26('0x21')](_0x4708e2[_0x7f26('0x33')][_0x7f26('0x21')]);_0x2d29f4[_0x7f26('0x3c')]=qs[_0x7f26('0x3d')](_0x4708e2[_0x7f26('0x33')][_0x7f26('0x3d')]);_0x2d29f4[_0x7f26('0x3e')]=qs[_0x7f26('0x35')](_[_0x7f26('0x72')](_0x4708e2[_0x7f26('0x33')],_0x5c60af['filters']));_0x2d29f4=_['merge']({},_0x2d29f4,_0x4708e2[_0x7f26('0x48')]);return _0x2470a2[_0x7f26('0x4c')+_['capitalize'](_0x4708e2[_0x7f26('0x33')][_0x7f26('0x6d')][_0x7f26('0x71')]())+_0x7f26('0x73')](_0x2d29f4);})[_0x7f26('0x29')](respondWithResult(_0x1ab59d,null))['catch'](handleError(_0x1ab59d,null));};exports[_0x7f26('0x74')]=function(_0x5bfe8d,_0x8cd430,_0x36b05e){return db['Team'][_0x7f26('0x6c')]({'where':{'id':_0x5bfe8d[_0x7f26('0x45')]['id']}})[_0x7f26('0x29')](function(_0x125158){if(_0x125158){if(!_0x5bfe8d[_0x7f26('0x52')][_0x7f26('0x6d')]||!utils[_0x7f26('0x6e')](_0x5bfe8d[_0x7f26('0x52')][_0x7f26('0x6d')])){throw new db[(_0x7f26('0x5b'))]['ValidationError'](_0x7f26('0x70'));}return _0x125158[_0x7f26('0x75')+_['capitalize'](_0x5bfe8d[_0x7f26('0x52')][_0x7f26('0x6d')][_0x7f26('0x71')]())+_0x7f26('0x73')](_0x5bfe8d['body'][_0x7f26('0x76')]);}return null;})['then'](handleEntityNotFound(_0x8cd430,null))[_0x7f26('0x29')](respondWithStatusCode(_0x8cd430,null))[_0x7f26('0x49')](handleError(_0x8cd430,null));};exports[_0x7f26('0x77')]=function(_0x40e87b,_0x505c99,_0xf6fc71){return db[_0x7f26('0x30')][_0x7f26('0x6c')]({'where':{'id':_0x40e87b[_0x7f26('0x45')]['id']}})[_0x7f26('0x29')](function(_0xbc916f){if(_0xbc916f){if(!_0x40e87b[_0x7f26('0x33')]['channel']||!utils[_0x7f26('0x6e')](_0x40e87b['query'][_0x7f26('0x6d')])){throw new db[(_0x7f26('0x5b'))]['ValidationError'](_0x7f26('0x70'));}return _0xbc916f[_0x7f26('0x78')+_['capitalize'](_0x40e87b['query'][_0x7f26('0x6d')][_0x7f26('0x71')]())+'Queues'](_0x40e87b[_0x7f26('0x33')][_0x7f26('0x76')]);}return null;})[_0x7f26('0x29')](handleEntityNotFound(_0x505c99,null))[_0x7f26('0x29')](respondWithStatusCode(_0x505c99,null))[_0x7f26('0x49')](handleError(_0x505c99,null));};exports[_0x7f26('0x79')]=function(_0x1957e1,_0x499d90){var _0x368118=_['isArray'](_0x1957e1['body']['ids'])?_0x1957e1['body'][_0x7f26('0x76')]:[_0x1957e1['body']['ids']];var _0x926025=_0x1957e1[_0x7f26('0x45')]['id'];return db[_0x7f26('0x30')][_0x7f26('0x53')]({'where':{'id':_0x926025}})[_0x7f26('0x29')](handleEntityNotFound(_0x499d90,null))[_0x7f26('0x29')](function(_0x47832c){if(_0x47832c){var _0x3eab00=[_0x7f26('0x7a'),_0x7f26('0x7b'),_0x7f26('0x7c'),_0x7f26('0x7d'),_0x7f26('0x7e'),'Openchannel',_0x7f26('0x7f')];return db['sequelize'][_0x7f26('0x56')](function(_0x1be757){var _0x594dd0=_[_0x7f26('0x2f')](_0x3eab00,function(_0x5d9bbc){var _0x4c1d6e={'attributes':['id',_0x7f26('0x2c')]};if(_0x5d9bbc===_0x7f26('0x7a')){_0x4c1d6e[_0x7f26('0x80')]={'attributes':[_0x7f26('0x81')]};}return _0x47832c[_0x7f26('0x4c')+_0x5d9bbc+_0x7f26('0x73')](_0x4c1d6e)['then'](function(_0x4af2bf){var _0x4c1abb=_[_0x7f26('0x2f')](_0x4af2bf,function(_0x241768){var _0x24e753=_[_0x7f26('0x2f')](_0x368118,function(_0x896ee9){var _0x514218={'where':{'UserId':_0x896ee9,[_0x5d9bbc+_0x7f26('0x82')]:_0x241768['id']},'transaction':_0x1be757};if(_0x5d9bbc===_0x7f26('0x7a')){_0x514218['defaults']={'penalty':_0x241768['TeamVoiceQueue']['penalty']};}return db[_0x7f26('0x83')+_0x5d9bbc+_0x7f26('0x84')][_0x7f26('0x85')](_0x514218)[_0x7f26('0x29')](function(){socket[_0x7f26('0x86')](_0x7f26('0x4b')+_0x5d9bbc+_0x7f26('0x87'),{'UserId':_0x896ee9,[_0x5d9bbc+'QueueId']:_0x241768['id']});if(_0x5d9bbc!==_0x7f26('0x7a')){return;}return db[_0x7f26('0x83')][_0x7f26('0x44')]({'where':{'id':_0x368118,'online':0x1},'attributes':['id',_0x7f26('0x2c'),'online',_0x7f26('0x88'),_0x7f26('0x89')],'raw':!![]})['then'](function(_0x36d662){var _0x19db97=_[_0x7f26('0x2f')](_0x36d662,function(_0x2e21bd){return db[_0x7f26('0x8a')][_0x7f26('0x8b')]({'membername':_0x2e21bd[_0x7f26('0x2c')],'UserId':_0x2e21bd['id'],'queue_name':_0x241768[_0x7f26('0x2c')],'VoiceQueueId':_0x241768['id'],'interface':_[_0x7f26('0x8c')](_0x2e21bd['interface'])?util['format'](_0x7f26('0x8d'),_0x2e21bd[_0x7f26('0x2c')]):_0x2e21bd[_0x7f26('0x89')],'paused':_0x2e21bd[_0x7f26('0x88')]||![],'penalty':_0x241768[_0x7f26('0x8e')][_0x7f26('0x81')]},{'transaction':_0x1be757});});return Promise[_0x7f26('0x8f')](_0x19db97);});});});return Promise[_0x7f26('0x8f')](_0x24e753);});return Promise[_0x7f26('0x8f')](_0x4c1abb);})['then'](function(){return db[_0x7f26('0x90')][_0x7f26('0x6c')]({'where':{'teamId':_0x926025}})[_0x7f26('0x29')](function(_0x5ed0b5){if(_0x5ed0b5){var _0x4dc7b1=_[_0x7f26('0x2f')](_0x368118,function(_0x375e70){db[_0x7f26('0x69')][_0x7f26('0x8b')]({'UserId':_0x375e70,'VoicePrefixId':_0x5ed0b5['VoicePrefixId']});});return Promise[_0x7f26('0x8f')](_0x4dc7b1);}});});});return Promise['all'](_0x594dd0)[_0x7f26('0x29')](function(){return _0x47832c[_0x7f26('0x79')](_0x368118,{'transaction':_0x1be757})[_0x7f26('0x91')](function(_0x422ecf){return _0x422ecf;});});});}})[_0x7f26('0x29')](respondWithResult(_0x499d90,null))[_0x7f26('0x49')](handleError(_0x499d90,null));};exports[_0x7f26('0x92')]=function(_0x4e4f15,_0x370a7e){var _0x4d24f0=_[_0x7f26('0x93')](_0x4e4f15[_0x7f26('0x33')][_0x7f26('0x76')])?_0x4e4f15['query']['ids']:[_0x4e4f15[_0x7f26('0x33')][_0x7f26('0x76')]];var _0x25abeb=_0x4e4f15[_0x7f26('0x45')]['id'];return db[_0x7f26('0x30')][_0x7f26('0x53')]({'where':{'id':_0x25abeb}})[_0x7f26('0x29')](handleEntityNotFound(_0x370a7e,null))[_0x7f26('0x29')](function(_0x2c27b6){if(_0x2c27b6){var _0x1e348f=[_0x7f26('0x7a'),_0x7f26('0x7b'),_0x7f26('0x7c'),_0x7f26('0x7d'),_0x7f26('0x7e'),_0x7f26('0x94'),_0x7f26('0x7f')];return db[_0x7f26('0x55')][_0x7f26('0x56')](function(_0x1e4a40){var _0x379e64=_[_0x7f26('0x2f')](_0x1e348f,function(_0x13ade1){var _0x2018b2={'attributes':['id',_0x7f26('0x2c')]};return _0x2c27b6[_0x7f26('0x4c')+_0x13ade1+_0x7f26('0x73')](_0x2018b2)[_0x7f26('0x29')](function(_0x2d8562){var _0x2030c4=_[_0x7f26('0x2f')](_0x2d8562,function(_0x1da58b){return _0x1da58b['removeAgents'](_0x4d24f0,{'transaction':_0x1e4a40})[_0x7f26('0x29')](function(){var _0x40e5b1=_['map'](_0x4d24f0,function(_0x4be687){socket[_0x7f26('0x86')](_0x7f26('0x4b')+_0x13ade1+_0x7f26('0x95'),{'UserId':Number(_0x4be687),[_0x13ade1+_0x7f26('0x82')]:_0x1da58b['id']});if(_0x13ade1!==_0x7f26('0x7a')){return;}return db[_0x7f26('0x8a')][_0x7f26('0x54')]({'where':{'VoiceQueueId':_0x1da58b['id'],'UserId':_0x4be687},'transaction':_0x1e4a40});});return Promise['all'](_0x40e5b1);});});return Promise['all'](_0x2030c4);});});return Promise[_0x7f26('0x8f')](_0x379e64)[_0x7f26('0x29')](function(){return _0x2c27b6[_0x7f26('0x92')](_0x4d24f0,{'transaction':_0x1e4a40});})['then'](function(){return db[_0x7f26('0x90')][_0x7f26('0x6c')]({'where':{'teamId':_0x25abeb}})[_0x7f26('0x29')](function(_0x28e017){if(_0x28e017){var _0x5877c0=_[_0x7f26('0x2f')](_0x4d24f0,function(_0x414641){db[_0x7f26('0x69')][_0x7f26('0x54')]({'where':{'UserId':_0x414641,'VoicePrefixId':_0x28e017['VoicePrefixId']}});});return Promise['all'](_0x5877c0);}});});});}})[_0x7f26('0x29')](respondWithStatusCode(_0x370a7e,null))[_0x7f26('0x49')](handleError(_0x370a7e,null));};exports[_0x7f26('0x96')]=function(_0x44eb1f,_0x32874a,_0x490cb2){var _0x3fc945={};var _0x8cf183={};var _0x3a6d28;var _0x58abbb;return db[_0x7f26('0x30')]['findOne']({'where':{'id':_0x44eb1f[_0x7f26('0x45')]['id']}})['then'](handleEntityNotFound(_0x32874a,null))[_0x7f26('0x29')](function(_0x569d6b){if(_0x569d6b){_0x3a6d28=_0x569d6b;_0x8cf183[_0x7f26('0x37')]=_['keys'](db[_0x7f26('0x83')]['rawAttributes']);_0x8cf183[_0x7f26('0x33')]=_['keys'](_0x44eb1f[_0x7f26('0x33')]);_0x8cf183[_0x7f26('0x35')]=_['intersection'](_0x8cf183[_0x7f26('0x37')],_0x8cf183[_0x7f26('0x33')]);_0x3fc945['attributes']=_[_0x7f26('0x36')](_0x8cf183[_0x7f26('0x37')],qs['fields'](_0x44eb1f[_0x7f26('0x33')][_0x7f26('0x39')]));_0x3fc945[_0x7f26('0x38')]=_0x3fc945[_0x7f26('0x38')][_0x7f26('0x3a')]?_0x3fc945[_0x7f26('0x38')]:_0x8cf183[_0x7f26('0x37')];_0x3fc945[_0x7f26('0x3c')]=qs[_0x7f26('0x3d')](_0x44eb1f[_0x7f26('0x33')]['sort']);_0x3fc945[_0x7f26('0x3e')]=qs[_0x7f26('0x35')](_[_0x7f26('0x72')](_0x44eb1f[_0x7f26('0x33')],_0x8cf183[_0x7f26('0x35')]));if(_0x44eb1f['query'][_0x7f26('0x3f')]){_0x3fc945['where']=_[_0x7f26('0x40')](_0x3fc945[_0x7f26('0x3e')],{'$or':_[_0x7f26('0x2f')](_0x3fc945[_0x7f26('0x38')],function(_0x5bbf90){var _0x577a96={};_0x577a96[_0x5bbf90]={'$like':'%'+_0x44eb1f[_0x7f26('0x33')][_0x7f26('0x3f')]+'%'};return _0x577a96;})});}_0x3fc945=_[_0x7f26('0x40')]({},_0x3fc945,_0x44eb1f[_0x7f26('0x48')]);return _0x3a6d28[_0x7f26('0x96')](_0x3fc945);}})[_0x7f26('0x29')](function(_0x3d7bff){if(_0x3d7bff){_0x58abbb=_0x3d7bff[_0x7f26('0x3a')];if(!_0x44eb1f[_0x7f26('0x33')][_0x7f26('0x3b')](_0x7f26('0x97'))){_0x3fc945[_0x7f26('0x23')]=qs['limit'](_0x44eb1f[_0x7f26('0x33')][_0x7f26('0x23')]);_0x3fc945[_0x7f26('0x21')]=qs['offset'](_0x44eb1f[_0x7f26('0x33')][_0x7f26('0x21')]);}return _0x3a6d28[_0x7f26('0x96')](_0x3fc945);}})['then'](function(_0x581418){if(_0x581418){return _0x581418?{'count':_0x58abbb,'rows':_0x581418}:null;}})[_0x7f26('0x29')](respondWithResult(_0x32874a,null))[_0x7f26('0x49')](handleError(_0x32874a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ffb35f5..c4437e6 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 _0xd84e=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','Team'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0xd84e,0x166));var _0xed84=function(_0x3e600d,_0x2b0806){_0x3e600d=_0x3e600d-0x0;var _0x35fd90=_0xd84e[_0x3e600d];return _0x35fd90;};'use strict';var EventEmitter=require('events');var Team=require(_0xed84('0x0'))['db'][_0xed84('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xed84('0x2')](0x0);var events={'afterCreate':_0xed84('0x3'),'afterUpdate':_0xed84('0x4'),'afterDestroy':'remove'};function emitEvent(_0x40bf5a){return function(_0x5241cd,_0x4fcec7,_0x2285b2){TeamEvents[_0xed84('0x5')](_0x40bf5a+':'+_0x5241cd['id'],_0x5241cd);TeamEvents['emit'](_0x40bf5a,_0x5241cd);_0x2285b2(null);};}for(var e in events){if(events[_0xed84('0x6')](e)){var event=events[e];Team[_0xed84('0x7')](e,emitEvent(event));}}module[_0xed84('0x8')]=TeamEvents; \ No newline at end of file +var _0xf9c1=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','Team','save'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xf9c1,0x17d));var _0x1f9c=function(_0x1fbc1e,_0x396324){_0x1fbc1e=_0x1fbc1e-0x0;var _0x2f30ef=_0xf9c1[_0x1fbc1e];return _0x2f30ef;};'use strict';var EventEmitter=require('events');var Team=require(_0x1f9c('0x0'))['db'][_0x1f9c('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f9c('0x2'),'afterUpdate':_0x1f9c('0x3'),'afterDestroy':_0x1f9c('0x4')};function emitEvent(_0x3699a1){return function(_0x11e13a,_0x5dcbd0,_0x495da9){TeamEvents['emit'](_0x3699a1+':'+_0x11e13a['id'],_0x11e13a);TeamEvents['emit'](_0x3699a1,_0x11e13a);_0x495da9(null);};}for(var e in events){if(events[_0x1f9c('0x5')](e)){var event=events[e];Team[_0x1f9c('0x6')](e,emitEvent(event));}}module[_0x1f9c('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6055a18..b47e7ba 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 _0xc92c=['Team','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','all','lodash','Queues','then','map','setDataValue','channel','catch','exports','define'];(function(_0x45bb5a,_0x4833ba){var _0x4d2119=function(_0x50b6ec){while(--_0x50b6ec){_0x45bb5a['push'](_0x45bb5a['shift']());}};_0x4d2119(++_0x4833ba);}(_0xc92c,0x17e));var _0xcc92=function(_0x28b4bd,_0x5175c7){_0x28b4bd=_0x28b4bd-0x0;var _0x5dbeed=_0xc92c[_0x28b4bd];return _0x5dbeed;};'use strict';var _=require(_0xcc92('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x46a0e7,_0x55b519){var _0x14a909='get'+_0x55b519+_0xcc92('0x1');return _0x46a0e7[_0x14a909]()[_0xcc92('0x2')](function(_0x3aeb34){return _[_0xcc92('0x3')](_0x3aeb34,function(_0x3fc793){_0x3fc793[_0xcc92('0x4')](_0xcc92('0x5'),_0x55b519);return _0x3fc793;});})[_0xcc92('0x6')](function(_0x2e1220){throw _0x2e1220;});}module[_0xcc92('0x7')]=function(_0x48b39c){return _0x48b39c[_0xcc92('0x8')](_0xcc92('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5dddb4=this;var _0x36d38e=[_0xcc92('0xa'),_0xcc92('0xb'),'Mail',_0xcc92('0xc'),_0xcc92('0xd'),_0xcc92('0xe'),_0xcc92('0xf')];return Promise['resolve']()[_0xcc92('0x2')](function(){var _0x478f0d=_[_0xcc92('0x3')](_0x36d38e,function(_0xb7acd3){return getQueuesByChannel(_0x5dddb4,_0xb7acd3);});return Promise[_0xcc92('0x10')](_0x478f0d);})[_0xcc92('0x6')](function(_0x19258e){throw _0x19258e;});}}});}; \ No newline at end of file +var _0xb1de=['catch','exports','teams','Chat','Mail','Sms','Voice','Whatsapp','resolve','then','all','./team.attributes','get','map','setDataValue','channel'];(function(_0x23cb11,_0x238827){var _0x7a0e1=function(_0x592471){while(--_0x592471){_0x23cb11['push'](_0x23cb11['shift']());}};_0x7a0e1(++_0x238827);}(_0xb1de,0x13b));var _0xeb1d=function(_0x5ed02d,_0x52395b){_0x5ed02d=_0x5ed02d-0x0;var _0xa24935=_0xb1de[_0x5ed02d];return _0xa24935;};'use strict';var _=require('lodash');var attributes=require(_0xeb1d('0x0'));function getQueuesByChannel(_0x568048,_0x1f287f){var _0x35499c=_0xeb1d('0x1')+_0x1f287f+'Queues';return _0x568048[_0x35499c]()['then'](function(_0x5239e6){return _[_0xeb1d('0x2')](_0x5239e6,function(_0x41e90c){_0x41e90c[_0xeb1d('0x3')](_0xeb1d('0x4'),_0x1f287f);return _0x41e90c;});})[_0xeb1d('0x5')](function(_0x187bb9){throw _0x187bb9;});}module[_0xeb1d('0x6')]=function(_0x399443){return _0x399443['define']('Team',attributes,{'tableName':_0xeb1d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3e417e=this;var _0x257480=[_0xeb1d('0x8'),'Fax',_0xeb1d('0x9'),'Openchannel',_0xeb1d('0xa'),_0xeb1d('0xb'),_0xeb1d('0xc')];return Promise[_0xeb1d('0xd')]()[_0xeb1d('0xe')](function(){var _0x56f5f1=_[_0xeb1d('0x2')](_0x257480,function(_0x4a70fd){return getQueuesByChannel(_0x3e417e,_0x4a70fd);});return Promise[_0xeb1d('0xf')](_0x56f5f1);})[_0xeb1d('0x5')](function(_0x41e32c){throw _0x41e32c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 01e9834..67647cd 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 _0x5009=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5279c4,_0x11ea12){var _0x84b733=function(_0x33dd31){while(--_0x33dd31){_0x5279c4['push'](_0x5279c4['shift']());}};_0x84b733(++_0x11ea12);}(_0x5009,0x17b));var _0x9500=function(_0x3ac7fa,_0x3bcca4){_0x3ac7fa=_0x3ac7fa-0x0;var _0x264a67=_0x5009[_0x3ac7fa];return _0x264a67;};'use strict';var _=require('lodash');var util=require(_0x9500('0x0'));var moment=require(_0x9500('0x1'));var BPromise=require(_0x9500('0x2'));var rs=require(_0x9500('0x3'));var fs=require('fs');var Redis=require(_0x9500('0x4'));var db=require(_0x9500('0x5'))['db'];var utils=require(_0x9500('0x6'));var logger=require(_0x9500('0x7'))(_0x9500('0x8'));var config=require(_0x9500('0x9'));var jayson=require(_0x9500('0xa'));var client=jayson[_0x9500('0xb')][_0x9500('0xc')]({'port':0x232a});config['redis']=_[_0x9500('0xd')](config[_0x9500('0xe')],{'host':_0x9500('0xf'),'port':0x18eb});var socket=require(_0x9500('0x10'))(new Redis(config['redis']));require(_0x9500('0x11'))[_0x9500('0x12')](socket);function respondWithRpcPromise(_0xfffc5a,_0x3da357,_0x34e539){return new BPromise(function(_0x1be728,_0x36cf09){return client['request'](_0xfffc5a,_0x34e539)[_0x9500('0x13')](function(_0x494ee3){logger[_0x9500('0x14')](_0x9500('0x15'),_0x3da357,_0x9500('0x16'));logger['debug'](_0x9500('0x17'),_0x3da357,_0x9500('0x16'),JSON['stringify'](_0x494ee3));if(_0x494ee3[_0x9500('0x18')]){if(_0x494ee3[_0x9500('0x18')][_0x9500('0x19')]===0x1f4){logger[_0x9500('0x18')](_0x9500('0x15'),_0x3da357,_0x494ee3['error'][_0x9500('0x1a')]);return _0x36cf09(_0x494ee3[_0x9500('0x18')][_0x9500('0x1a')]);}logger[_0x9500('0x18')](_0x9500('0x15'),_0x3da357,_0x494ee3['error'][_0x9500('0x1a')]);return _0x1be728(_0x494ee3['error'][_0x9500('0x1a')]);}else{logger[_0x9500('0x14')]('Team,\x20%s,\x20%s',_0x3da357,_0x9500('0x16'));_0x1be728(_0x494ee3[_0x9500('0x1b')][_0x9500('0x1a')]);}})[_0x9500('0x1c')](function(_0x9fc22){logger[_0x9500('0x18')]('Team,\x20%s,\x20%s',_0x3da357,_0x9fc22);_0x36cf09(_0x9fc22);});});} \ No newline at end of file +var _0xe6ca=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','request','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x35acc6,_0x16faa5){var _0x92ae83=function(_0x20d924){while(--_0x20d924){_0x35acc6['push'](_0x35acc6['shift']());}};_0x92ae83(++_0x16faa5);}(_0xe6ca,0xf6));var _0xae6c=function(_0x342453,_0x4a0029){_0x342453=_0x342453-0x0;var _0x5ec965=_0xe6ca[_0x342453];return _0x5ec965;};'use strict';var _=require(_0xae6c('0x0'));var util=require('util');var moment=require(_0xae6c('0x1'));var BPromise=require(_0xae6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae6c('0x3'));var db=require(_0xae6c('0x4'))['db'];var utils=require(_0xae6c('0x5'));var logger=require('../../config/logger')(_0xae6c('0x6'));var config=require(_0xae6c('0x7'));var jayson=require(_0xae6c('0x8'));var client=jayson[_0xae6c('0x9')][_0xae6c('0xa')]({'port':0x232a});config['redis']=_[_0xae6c('0xb')](config[_0xae6c('0xc')],{'host':_0xae6c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x344cff,_0x1e6539,_0x1cd80e){return new BPromise(function(_0x1f8fd0,_0xb1e78c){return client[_0xae6c('0xe')](_0x344cff,_0x1cd80e)[_0xae6c('0xf')](function(_0x7faf29){logger['info'](_0xae6c('0x10'),_0x1e6539,'request\x20sent');logger[_0xae6c('0x11')](_0xae6c('0x12'),_0x1e6539,_0xae6c('0x13'),JSON[_0xae6c('0x14')](_0x7faf29));if(_0x7faf29[_0xae6c('0x15')]){if(_0x7faf29['error'][_0xae6c('0x16')]===0x1f4){logger[_0xae6c('0x15')](_0xae6c('0x10'),_0x1e6539,_0x7faf29[_0xae6c('0x15')][_0xae6c('0x17')]);return _0xb1e78c(_0x7faf29[_0xae6c('0x15')][_0xae6c('0x17')]);}logger['error']('Team,\x20%s,\x20%s',_0x1e6539,_0x7faf29[_0xae6c('0x15')][_0xae6c('0x17')]);return _0x1f8fd0(_0x7faf29[_0xae6c('0x15')][_0xae6c('0x17')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x1e6539,_0xae6c('0x13'));_0x1f8fd0(_0x7faf29['result']['message']);}})[_0xae6c('0x18')](function(_0x318e96){logger[_0xae6c('0x15')]('Team,\x20%s,\x20%s',_0x1e6539,_0x318e96);_0xb1e78c(_0x318e96);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 80fa09b..b47345a 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 _0xaecf=['./team.events','save','remove','emit','removeListener','register','length'];(function(_0x46fdbb,_0x217295){var _0x219d7e=function(_0x1350b8){while(--_0x1350b8){_0x46fdbb['push'](_0x46fdbb['shift']());}};_0x219d7e(++_0x217295);}(_0xaecf,0x149));var _0xfaec=function(_0x204972,_0x31b43f){_0x204972=_0x204972-0x0;var _0x9d1538=_0xaecf[_0x204972];return _0x9d1538;};'use strict';var TeamEvents=require(_0xfaec('0x0'));var events=[_0xfaec('0x1'),_0xfaec('0x2'),'update'];function createListener(_0x25cf61,_0x504c06){return function(_0x306efe){_0x504c06[_0xfaec('0x3')](_0x25cf61,_0x306efe);};}function removeListener(_0x5e7729,_0x494a31){return function(){TeamEvents[_0xfaec('0x4')](_0x5e7729,_0x494a31);};}exports[_0xfaec('0x5')]=function(_0x1d1bcd){for(var _0x2b9785=0x0,_0x5e362f=events[_0xfaec('0x6')];_0x2b9785<_0x5e362f;_0x2b9785++){var _0x51da3b=events[_0x2b9785];var _0x229a96=createListener('team:'+_0x51da3b,_0x1d1bcd);TeamEvents['on'](_0x51da3b,_0x229a96);}}; \ No newline at end of file +var _0x4679=['register','team:','./team.events','remove','update','emit'];(function(_0x13683c,_0x1629ec){var _0x45d791=function(_0x2f0cf4){while(--_0x2f0cf4){_0x13683c['push'](_0x13683c['shift']());}};_0x45d791(++_0x1629ec);}(_0x4679,0xb0));var _0x9467=function(_0x27f0f8,_0x3b8e1a){_0x27f0f8=_0x27f0f8-0x0;var _0x5a0f91=_0x4679[_0x27f0f8];return _0x5a0f91;};'use strict';var TeamEvents=require(_0x9467('0x0'));var events=['save',_0x9467('0x1'),_0x9467('0x2')];function createListener(_0x6af717,_0x4a9b94){return function(_0x2f254a){_0x4a9b94[_0x9467('0x3')](_0x6af717,_0x2f254a);};}function removeListener(_0x51cd08,_0x58c5f7){return function(){TeamEvents['removeListener'](_0x51cd08,_0x58c5f7);};}exports[_0x9467('0x4')]=function(_0x27775d){for(var _0x2209ee=0x0,_0x4fa23c=events['length'];_0x2209ee<_0x4fa23c;_0x2209ee++){var _0x426744=events[_0x2209ee];var _0x4a5b90=createListener(_0x9467('0x5')+_0x426744,_0x27775d);TeamEvents['on'](_0x426744,_0x4a5b90);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0cc5679..9a775f2 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 _0x878f=['INTEGER','exports'];(function(_0x3a8875,_0x3b21ce){var _0x410a69=function(_0x26c08b){while(--_0x26c08b){_0x3a8875['push'](_0x3a8875['shift']());}};_0x410a69(++_0x3b21ce);}(_0x878f,0x173));var _0xf878=function(_0x97c9ca,_0x469f02){_0x97c9ca=_0x97c9ca-0x0;var _0x23d5ce=_0x878f[_0x97c9ca];return _0x23d5ce;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'TeamId':{'type':Sequelize[_0xf878('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0xe0c0=['INTEGER','sequelize'];(function(_0x53004a,_0x246ab3){var _0x5f5afc=function(_0x5771e2){while(--_0x5771e2){_0x53004a['push'](_0x53004a['shift']());}};_0x5f5afc(++_0x246ab3);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x10414c,_0x35c7b0){_0x10414c=_0x10414c-0x0;var _0x325256=_0xe0c0[_0x10414c];return _0x325256;};'use strict';var Sequelize=require(_0x0e0c('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x0e0c('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x0e0c('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 124b2a9..0fac696 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 _0xc901=['TeamVoicePrefix','team_has_voice_prefixes','lodash','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define'];(function(_0x597c42,_0x58ac13){var _0x25d777=function(_0x318b4c){while(--_0x318b4c){_0x597c42['push'](_0x597c42['shift']());}};_0x25d777(++_0x58ac13);}(_0xc901,0x142));var _0x1c90=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc901[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1c90('0x1'));var rp=require(_0x1c90('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c90('0x3'));var config=require(_0x1c90('0x4'));var attributes=require(_0x1c90('0x5'));module[_0x1c90('0x6')]=function(_0x1c9021,_0x14eb4f){return _0x1c9021[_0x1c90('0x7')](_0x1c90('0x8'),attributes,{'tableName':_0x1c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f3e=['exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require(_0xe6f3('0x1'));var logger=require(_0xe6f3('0x2'))(_0xe6f3('0x3'));var moment=require(_0xe6f3('0x4'));var BPromise=require(_0xe6f3('0x5'));var rp=require(_0xe6f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6f3('0x7'));var config=require(_0xe6f3('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0xe6f3('0x9')]=function(_0x46e7ef,_0x2723be){return _0x46e7ef['define'](_0xe6f3('0xa'),attributes,{'tableName':_0xe6f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1401dc0..9201372 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4fd701,_0x4dd637){var _0xb61e42=function(_0x56eff4){while(--_0x56eff4){_0x4fd701['push'](_0x4fd701['shift']());}};_0xb61e42(++_0x4dd637);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2e409e,_0x2d227e){var _0xe6e039=function(_0x47195d){while(--_0x47195d){_0x2e409e['push'](_0x2e409e['shift']());}};_0xe6e039(++_0x2d227e);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1bac09f..d921b79 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 _0x37ea=['exports','INTEGER','sequelize'];(function(_0x49e0cd,_0x542032){var _0x362ccb=function(_0x1d1d19){while(--_0x1d1d19){_0x49e0cd['push'](_0x49e0cd['shift']());}};_0x362ccb(++_0x542032);}(_0x37ea,0xe3));var _0xa37e=function(_0x22091d,_0x529c38){_0x22091d=_0x22091d-0x0;var _0x1d6d2c=_0x37ea[_0x22091d];return _0x1d6d2c;};'use strict';var Sequelize=require(_0xa37e('0x0'));module[_0xa37e('0x1')]={'penalty':{'type':Sequelize[_0xa37e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc1a=['INTEGER','sequelize','exports'];(function(_0x1008c7,_0x225521){var _0x53aa5d=function(_0x4af883){while(--_0x4af883){_0x1008c7['push'](_0x1008c7['shift']());}};_0x53aa5d(++_0x225521);}(_0xfc1a,0x1c0));var _0xafc1=function(_0x3756f4,_0x807df2){_0x3756f4=_0x3756f4-0x0;var _0x126810=_0xfc1a[_0x3756f4];return _0x126810;};'use strict';var Sequelize=require(_0xafc1('0x0'));module[_0xafc1('0x1')]={'penalty':{'type':Sequelize[_0xafc1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index dc3498a..56e36a8 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 _0x3351=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a8d0f,_0x42983b){var _0xf4cc50=function(_0x15f048){while(--_0x15f048){_0x2a8d0f['push'](_0x2a8d0f['shift']());}};_0xf4cc50(++_0x42983b);}(_0x3351,0x1b4));var _0x1335=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x3351[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x1335('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1335('0x1'));var moment=require(_0x1335('0x2'));var BPromise=require(_0x1335('0x3'));var rp=require(_0x1335('0x4'));var fs=require('fs');var path=require(_0x1335('0x5'));var rimraf=require(_0x1335('0x6'));var config=require(_0x1335('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0x1335('0x8')]=function(_0x1b951c,_0x2ee73b){return _0x1b951c[_0x1335('0x9')](_0x1335('0xa'),attributes,{'tableName':_0x1335('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb717=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x413111,_0x28e59d){var _0x415eb3=function(_0x5b84e8){while(--_0x5b84e8){_0x413111['push'](_0x413111['shift']());}};_0x415eb3(++_0x28e59d);}(_0xb717,0x1b4));var _0x7b71=function(_0x170355,_0x3b37e6){_0x170355=_0x170355-0x0;var _0x25282f=_0xb717[_0x170355];return _0x25282f;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var logger=require(_0x7b71('0x1'))('api');var moment=require(_0x7b71('0x2'));var BPromise=require(_0x7b71('0x3'));var rp=require(_0x7b71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b71('0x5'));var config=require(_0x7b71('0x6'));var attributes=require(_0x7b71('0x7'));module[_0x7b71('0x8')]=function(_0x3d3643,_0x593c15){return _0x3d3643[_0x7b71('0x9')](_0x7b71('0xa'),attributes,{'tableName':_0x7b71('0xb'),'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 ca9b8a7..19004f7 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 _0x1c73=['ioredis','../../config/utils','../../config/logger','rpc','client','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x233a41,_0x190a2b){var _0x5a0d71=function(_0x449cb9){while(--_0x449cb9){_0x233a41['push'](_0x233a41['shift']());}};_0x5a0d71(++_0x190a2b);}(_0x1c73,0xc2));var _0x31c7=function(_0x217e5b,_0x53776f){_0x217e5b=_0x217e5b-0x0;var _0x38f156=_0x1c73[_0x217e5b];return _0x38f156;};'use strict';var _=require(_0x31c7('0x0'));var util=require('util');var moment=require(_0x31c7('0x1'));var BPromise=require(_0x31c7('0x2'));var rs=require(_0x31c7('0x3'));var fs=require('fs');var Redis=require(_0x31c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x31c7('0x5'));var logger=require(_0x31c7('0x6'))(_0x31c7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x31c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2d13,_0x3a7133,_0xb1014e){return new BPromise(function(_0x31fdc8,_0x79992b){return client['request'](_0x5b2d13,_0xb1014e)['then'](function(_0x4e3441){logger[_0x31c7('0x9')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3a7133,'request\x20sent');logger[_0x31c7('0xa')](_0x31c7('0xb'),_0x3a7133,_0x31c7('0xc'),JSON['stringify'](_0x4e3441));if(_0x4e3441[_0x31c7('0xd')]){if(_0x4e3441[_0x31c7('0xd')]['code']===0x1f4){logger[_0x31c7('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3a7133,_0x4e3441['error'][_0x31c7('0xe')]);return _0x79992b(_0x4e3441['error']['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3a7133,_0x4e3441[_0x31c7('0xd')][_0x31c7('0xe')]);return _0x31fdc8(_0x4e3441[_0x31c7('0xd')][_0x31c7('0xe')]);}else{logger[_0x31c7('0x9')](_0x31c7('0xf'),_0x3a7133,'request\x20sent');_0x31fdc8(_0x4e3441[_0x31c7('0x10')][_0x31c7('0xe')]);}})[_0x31c7('0x11')](function(_0x381762){logger[_0x31c7('0xd')](_0x31c7('0xf'),_0x3a7133,_0x381762);_0x79992b(_0x381762);});});} \ No newline at end of file +var _0x9f75=['debug','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x46e979,_0x589a5f){var _0x12ec3c=function(_0x2a8eef){while(--_0x2a8eef){_0x46e979['push'](_0x46e979['shift']());}};_0x12ec3c(++_0x589a5f);}(_0x9f75,0x15a));var _0x59f7=function(_0x307bf2,_0x204bad){_0x307bf2=_0x307bf2-0x0;var _0x3eb120=_0x9f75[_0x307bf2];return _0x3eb120;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var moment=require(_0x59f7('0x1'));var BPromise=require(_0x59f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59f7('0x3'))['db'];var utils=require(_0x59f7('0x4'));var logger=require(_0x59f7('0x5'))(_0x59f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x59f7('0x7'));var client=jayson[_0x59f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5483bc,_0xeb6d1e,_0x15903b){return new BPromise(function(_0x3bf8e1,_0x21e3e5){return client[_0x59f7('0x9')](_0x5483bc,_0x15903b)[_0x59f7('0xa')](function(_0x553357){logger[_0x59f7('0xb')](_0x59f7('0xc'),_0xeb6d1e,_0x59f7('0xd'));logger[_0x59f7('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0xeb6d1e,_0x59f7('0xd'),JSON['stringify'](_0x553357));if(_0x553357[_0x59f7('0xf')]){if(_0x553357['error'][_0x59f7('0x10')]===0x1f4){logger[_0x59f7('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0xeb6d1e,_0x553357['error'][_0x59f7('0x11')]);return _0x21e3e5(_0x553357[_0x59f7('0xf')][_0x59f7('0x11')]);}logger[_0x59f7('0xf')](_0x59f7('0xc'),_0xeb6d1e,_0x553357[_0x59f7('0xf')]['message']);return _0x3bf8e1(_0x553357['error']['message']);}else{logger[_0x59f7('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0xeb6d1e,_0x59f7('0xd'));_0x3bf8e1(_0x553357[_0x59f7('0x12')][_0x59f7('0x11')]);}})[_0x59f7('0x13')](function(_0x34a5d7){logger[_0x59f7('0xf')](_0x59f7('0xc'),_0xeb6d1e,_0x34a5d7);_0x21e3e5(_0x34a5d7);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e18aad6..0030a7b 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 _0x44fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x21d84d,_0x1a359e){var _0x2f885a=function(_0xf612f8){while(--_0xf612f8){_0x21d84d['push'](_0x21d84d['shift']());}};_0x2f885a(++_0x1a359e);}(_0x44fe,0x16f));var _0xe44f=function(_0x2841cb,_0x3ca7d8){_0x2841cb=_0x2841cb-0x0;var _0x14b4b1=_0x44fe[_0x2841cb];return _0x14b4b1;};'use strict';var multer=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var path=require(_0xe44f('0x2'));var timeout=require(_0xe44f('0x3'));var express=require(_0xe44f('0x4'));var router=express[_0xe44f('0x5')]();var fs_extra=require(_0xe44f('0x6'));var auth=require(_0xe44f('0x7'));var interaction=require(_0xe44f('0x8'));var config=require(_0xe44f('0x9'));var controller=require(_0xe44f('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xe44f('0xb')]);router[_0xe44f('0xc')]('/:id',auth[_0xe44f('0xd')](),controller[_0xe44f('0xe')]);router[_0xe44f('0xf')]('/',auth[_0xe44f('0xd')](),controller[_0xe44f('0x10')]);router['put'](_0xe44f('0x11'),auth[_0xe44f('0xd')](),controller[_0xe44f('0x12')]);router[_0xe44f('0x13')](_0xe44f('0x11'),auth[_0xe44f('0xd')](),controller[_0xe44f('0x14')]);module[_0xe44f('0x15')]=router; \ No newline at end of file +var _0xf470=['../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1253e8,_0x1933ba){var _0x31a72b=function(_0x23dc60){while(--_0x23dc60){_0x1253e8['push'](_0x1253e8['shift']());}};_0x31a72b(++_0x1933ba);}(_0xf470,0xfd));var _0x0f47=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xf470[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0x0f47('0x0'));var util=require(_0x0f47('0x1'));var path=require(_0x0f47('0x2'));var timeout=require(_0x0f47('0x3'));var express=require(_0x0f47('0x4'));var router=express[_0x0f47('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0f47('0x6'));var interaction=require(_0x0f47('0x7'));var config=require('../../config/environment');var controller=require(_0x0f47('0x8'));router[_0x0f47('0x9')]('/',auth[_0x0f47('0xa')](),controller[_0x0f47('0xb')]);router[_0x0f47('0x9')](_0x0f47('0xc'),auth[_0x0f47('0xa')](),controller[_0x0f47('0xd')]);router[_0x0f47('0xe')]('/',auth[_0x0f47('0xa')](),controller[_0x0f47('0xf')]);router[_0x0f47('0x10')](_0x0f47('0xc'),auth[_0x0f47('0xa')](),controller[_0x0f47('0x11')]);router[_0x0f47('0x12')](_0x0f47('0xc'),auth[_0x0f47('0xa')](),controller[_0x0f47('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 19659f3..2593166 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 _0x92bd=['exports','STRING','TEXT','sequelize'];(function(_0x56d49b,_0x482208){var _0x14edc7=function(_0x48ba38){while(--_0x48ba38){_0x56d49b['push'](_0x56d49b['shift']());}};_0x14edc7(++_0x482208);}(_0x92bd,0x1bf));var _0xd92b=function(_0x393f67,_0x27ae29){_0x393f67=_0x393f67-0x0;var _0x4e93e5=_0x92bd[_0x393f67];return _0x4e93e5;};'use strict';var Sequelize=require(_0xd92b('0x0'));module[_0xd92b('0x1')]={'name':{'type':Sequelize[_0xd92b('0x2')]},'description':{'type':Sequelize[_0xd92b('0x2')]},'html':{'type':Sequelize[_0xd92b('0x3')]}}; \ No newline at end of file +var _0xfc5f=['TEXT','sequelize','exports','STRING'];(function(_0x9d770d,_0x316bdc){var _0x115f1a=function(_0x4510e7){while(--_0x4510e7){_0x9d770d['push'](_0x9d770d['shift']());}};_0x115f1a(++_0x316bdc);}(_0xfc5f,0xed));var _0xffc5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfc5f[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xffc5('0x0'));module[_0xffc5('0x1')]={'name':{'type':Sequelize[_0xffc5('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xffc5('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b7d39db..1d78e91 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 _0x0a55=['merge','options','includeAll','rows','catch','show','intersection','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','get','Templates','name','send','index','Template','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x384ff3,_0x423db0){var _0x6129a8=function(_0x483229){while(--_0x483229){_0x384ff3['push'](_0x384ff3['shift']());}};_0x6129a8(++_0x423db0);}(_0x0a55,0x67));var _0x50a5=function(_0x1501e6,_0x2d42b9){_0x1501e6=_0x1501e6-0x0;var _0x3368=_0x0a55[_0x1501e6];return _0x3368;};'use strict';var emlformat=require(_0x50a5('0x0'));var rimraf=require(_0x50a5('0x1'));var zipdir=require(_0x50a5('0x2'));var jsonpatch=require(_0x50a5('0x3'));var rp=require(_0x50a5('0x4'));var moment=require(_0x50a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x50a5('0x6'));var util=require(_0x50a5('0x7'));var path=require(_0x50a5('0x8'));var sox=require(_0x50a5('0x9'));var csv=require(_0x50a5('0xa'));var ejs=require(_0x50a5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50a5('0xc'));var squel=require(_0x50a5('0xd'));var crypto=require(_0x50a5('0xe'));var jsforce=require(_0x50a5('0xf'));var deskjs=require(_0x50a5('0x10'));var toCsv=require(_0x50a5('0xa'));var querystring=require('querystring');var Papa=require(_0x50a5('0x11'));var Redis=require('ioredis');var authService=require(_0x50a5('0x12'));var qs=require(_0x50a5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x50a5('0x14'))(_0x50a5('0x15'));var utils=require(_0x50a5('0x16'));var config=require(_0x50a5('0x17'));var licenseUtil=require(_0x50a5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f1419,_0x2f39ac){_0x2f39ac=_0x2f39ac||0xcc;return function(_0x3ece12){if(_0x3ece12){return _0x2f1419[_0x50a5('0x19')](_0x2f39ac);}return _0x2f1419['status'](_0x2f39ac)[_0x50a5('0x1a')]();};}function respondWithResult(_0x48d524,_0x22221e){_0x22221e=_0x22221e||0xc8;return function(_0x464535){if(_0x464535){return _0x48d524['status'](_0x22221e)[_0x50a5('0x1b')](_0x464535);}};}function respondWithFilteredResult(_0x33d6b1,_0x1036f3){return function(_0x446684){if(_0x446684){var _0x5a5e96=typeof _0x1036f3[_0x50a5('0x1c')]==='undefined'&&typeof _0x1036f3[_0x50a5('0x1d')]===_0x50a5('0x1e');var _0x2d59fa=_0x446684[_0x50a5('0x1f')];var _0x527c1b=_0x5a5e96?0x0:_0x1036f3[_0x50a5('0x1c')];var _0x331abe=_0x5a5e96?_0x446684[_0x50a5('0x1f')]:_0x1036f3[_0x50a5('0x1c')]+_0x1036f3['limit'];var _0x3d34cd;if(_0x331abe>=_0x2d59fa){_0x331abe=_0x2d59fa;_0x3d34cd=0xc8;}else{_0x3d34cd=0xce;}_0x33d6b1[_0x50a5('0x20')](_0x3d34cd);return _0x33d6b1[_0x50a5('0x21')](_0x50a5('0x22'),_0x527c1b+'-'+_0x331abe+'/'+_0x2d59fa)[_0x50a5('0x1b')](_0x446684);}return null;};}function patchUpdates(_0x7d01c7){return function(_0x1cc3f5){try{jsonpatch['apply'](_0x1cc3f5,_0x7d01c7,!![]);}catch(_0x373c9c){return BPromise[_0x50a5('0x23')](_0x373c9c);}return _0x1cc3f5[_0x50a5('0x24')]();};}function saveUpdates(_0x3b1005,_0x3fabc0){return function(_0x3fe5c5){if(_0x3fe5c5){return _0x3fe5c5[_0x50a5('0x25')](_0x3b1005)[_0x50a5('0x26')](function(_0x1787a7){return _0x1787a7;});}return null;};}function removeEntity(_0xe1088b,_0x6e8a59){return function(_0x5d1353){if(_0x5d1353){return _0x5d1353[_0x50a5('0x27')]()[_0x50a5('0x26')](function(){var _0x33751d=_0x5d1353[_0x50a5('0x28')]({'plain':!![]});var _0x20a8ca=_0x50a5('0x29');return db['UserProfileResource'][_0x50a5('0x27')]({'where':{'type':_0x20a8ca,'resourceId':_0x33751d['id']}})[_0x50a5('0x26')](function(){return _0x5d1353;});})['then'](function(){_0xe1088b[_0x50a5('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1c74,_0x2f8146){return function(_0x18d559){if(!_0x18d559){_0x4b1c74[_0x50a5('0x19')](0x194);}return _0x18d559;};}function handleError(_0x5ea3ab,_0x36692c){_0x36692c=_0x36692c||0x1f4;return function(_0x5ef990){logger['error'](_0x5ef990['stack']);if(_0x5ef990[_0x50a5('0x2a')]){delete _0x5ef990[_0x50a5('0x2a')];}_0x5ea3ab[_0x50a5('0x20')](_0x36692c)[_0x50a5('0x2b')](_0x5ef990);};}exports[_0x50a5('0x2c')]=function(_0x321754,_0x5db0b5){var _0xdf7722={},_0x1e3179={},_0x4b64d3={'count':0x0,'rows':[]};var _0x4e7b98=_['map'](db[_0x50a5('0x2d')][_0x50a5('0x2e')],function(_0x521161){return{'name':_0x521161[_0x50a5('0x2f')],'type':_0x521161[_0x50a5('0x30')][_0x50a5('0x31')]};});_0x1e3179[_0x50a5('0x32')]=_[_0x50a5('0x33')](_0x4e7b98,_0x50a5('0x2a'));_0x1e3179[_0x50a5('0x34')]=_[_0x50a5('0x35')](_0x321754[_0x50a5('0x34')]);_0x1e3179[_0x50a5('0x36')]=_['intersection'](_0x1e3179['model'],_0x1e3179[_0x50a5('0x34')]);_0xdf7722[_0x50a5('0x37')]=_['intersection'](_0x1e3179[_0x50a5('0x32')],qs[_0x50a5('0x38')](_0x321754[_0x50a5('0x34')][_0x50a5('0x38')]));_0xdf7722[_0x50a5('0x37')]=_0xdf7722[_0x50a5('0x37')]['length']?_0xdf7722[_0x50a5('0x37')]:_0x1e3179[_0x50a5('0x32')];if(!_0x321754[_0x50a5('0x34')][_0x50a5('0x39')]('nolimit')){_0xdf7722['limit']=qs[_0x50a5('0x1d')](_0x321754[_0x50a5('0x34')][_0x50a5('0x1d')]);_0xdf7722['offset']=qs[_0x50a5('0x1c')](_0x321754[_0x50a5('0x34')][_0x50a5('0x1c')]);}_0xdf7722[_0x50a5('0x3a')]=qs[_0x50a5('0x3b')](_0x321754['query']['sort']);_0xdf7722['where']=qs['filters'](_[_0x50a5('0x3c')](_0x321754[_0x50a5('0x34')],_0x1e3179['filters']),_0x4e7b98);if(_0x321754[_0x50a5('0x34')][_0x50a5('0x3d')]){_0xdf7722[_0x50a5('0x3e')]=_[_0x50a5('0x3f')](_0xdf7722[_0x50a5('0x3e')],{'$or':_[_0x50a5('0x33')](_0x4e7b98,function(_0x2b8152){if(_0x2b8152[_0x50a5('0x30')]!=='VIRTUAL'){var _0x5f3a08={};_0x5f3a08[_0x2b8152[_0x50a5('0x2a')]]={'$like':'%'+_0x321754[_0x50a5('0x34')][_0x50a5('0x3d')]+'%'};return _0x5f3a08;}})});}_0xdf7722=_[_0x50a5('0x3f')]({},_0xdf7722,_0x321754[_0x50a5('0x40')]);var _0x5400e6={'where':_0xdf7722[_0x50a5('0x3e')]};return db[_0x50a5('0x2d')][_0x50a5('0x1f')](_0x5400e6)[_0x50a5('0x26')](function(_0x3902f0){_0x4b64d3[_0x50a5('0x1f')]=_0x3902f0;if(_0x321754['query'][_0x50a5('0x41')]){_0xdf7722['include']=[{'all':!![]}];}return db[_0x50a5('0x2d')]['findAll'](_0xdf7722);})[_0x50a5('0x26')](function(_0x295dde){_0x4b64d3[_0x50a5('0x42')]=_0x295dde;return _0x4b64d3;})[_0x50a5('0x26')](respondWithFilteredResult(_0x5db0b5,_0xdf7722))[_0x50a5('0x43')](handleError(_0x5db0b5,null));};exports[_0x50a5('0x44')]=function(_0x3a3a6b,_0x1df840){var _0xf9df04={'raw':!![],'where':{'id':_0x3a3a6b['params']['id']}},_0x444792={};_0x444792['model']=_[_0x50a5('0x35')](db[_0x50a5('0x2d')][_0x50a5('0x2e')]);_0x444792['query']=_[_0x50a5('0x35')](_0x3a3a6b[_0x50a5('0x34')]);_0x444792[_0x50a5('0x36')]=_[_0x50a5('0x45')](_0x444792['model'],_0x444792[_0x50a5('0x34')]);_0xf9df04[_0x50a5('0x37')]=_[_0x50a5('0x45')](_0x444792[_0x50a5('0x32')],qs['fields'](_0x3a3a6b[_0x50a5('0x34')][_0x50a5('0x38')]));_0xf9df04['attributes']=_0xf9df04[_0x50a5('0x37')][_0x50a5('0x46')]?_0xf9df04['attributes']:_0x444792[_0x50a5('0x32')];if(_0x3a3a6b[_0x50a5('0x34')][_0x50a5('0x41')]){_0xf9df04[_0x50a5('0x47')]=[{'all':!![]}];}_0xf9df04=_[_0x50a5('0x3f')]({},_0xf9df04,_0x3a3a6b[_0x50a5('0x40')]);return db[_0x50a5('0x2d')]['find'](_0xf9df04)[_0x50a5('0x26')](handleEntityNotFound(_0x1df840,null))[_0x50a5('0x26')](respondWithResult(_0x1df840,null))[_0x50a5('0x43')](handleError(_0x1df840,null));};exports['create']=function(_0x2b800b,_0x36cde3){return db[_0x50a5('0x2d')][_0x50a5('0x48')](_0x2b800b[_0x50a5('0x49')],{})[_0x50a5('0x26')](function(_0x4afd9e){var _0x301e91=_0x2b800b[_0x50a5('0x4a')][_0x50a5('0x28')]({'plain':!![]});if(!_0x301e91)throw new Error(_0x50a5('0x4b'));if(_0x301e91['role']==='user'){var _0x52b2de=_0x4afd9e[_0x50a5('0x28')]({'plain':!![]});var _0x148670=_0x50a5('0x29');return db[_0x50a5('0x4c')][_0x50a5('0x4d')]({'where':{'name':_0x148670,'userProfileId':_0x301e91[_0x50a5('0x4e')]},'raw':!![]})[_0x50a5('0x26')](function(_0x49960d){if(_0x49960d&&_0x49960d[_0x50a5('0x4f')]===0x0){return db[_0x50a5('0x50')][_0x50a5('0x48')]({'name':_0x52b2de[_0x50a5('0x2a')],'resourceId':_0x52b2de['id'],'type':_0x49960d[_0x50a5('0x2a')],'sectionId':_0x49960d['id']},{})[_0x50a5('0x26')](function(){return _0x4afd9e;});}else{return _0x4afd9e;}})[_0x50a5('0x43')](function(_0x48d847){logger[_0x50a5('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48d847);throw _0x48d847;});}return _0x4afd9e;})[_0x50a5('0x26')](respondWithResult(_0x36cde3,0xc9))['catch'](handleError(_0x36cde3,null));};exports[_0x50a5('0x25')]=function(_0x204031,_0x5bb24d){if(_0x204031[_0x50a5('0x49')]['id']){delete _0x204031[_0x50a5('0x49')]['id'];}return db[_0x50a5('0x2d')][_0x50a5('0x4d')]({'where':{'id':_0x204031[_0x50a5('0x52')]['id']}})[_0x50a5('0x26')](handleEntityNotFound(_0x5bb24d,null))[_0x50a5('0x26')](saveUpdates(_0x204031[_0x50a5('0x49')],null))[_0x50a5('0x26')](respondWithResult(_0x5bb24d,null))['catch'](handleError(_0x5bb24d,null));};exports[_0x50a5('0x27')]=function(_0x49a5da,_0x3fa885){return db[_0x50a5('0x2d')][_0x50a5('0x4d')]({'where':{'id':_0x49a5da['params']['id']}})['then'](handleEntityNotFound(_0x3fa885,null))[_0x50a5('0x26')](removeEntity(_0x3fa885,null))[_0x50a5('0x43')](handleError(_0x3fa885,null));}; \ No newline at end of file +var _0xd4c9=['Template','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','get','Templates','destroy','error','stack','name','send','index','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge'];(function(_0x58f03e,_0x1e9bcb){var _0x1b1d79=function(_0x5dcb9b){while(--_0x5dcb9b){_0x58f03e['push'](_0x58f03e['shift']());}};_0x1b1d79(++_0x1e9bcb);}(_0xd4c9,0x1b7));var _0x9d4c=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xd4c9[_0x3a16d4];return _0x31ea9c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d4c('0x0'));var zipdir=require(_0x9d4c('0x1'));var jsonpatch=require(_0x9d4c('0x2'));var rp=require(_0x9d4c('0x3'));var moment=require('moment');var BPromise=require(_0x9d4c('0x4'));var Mustache=require(_0x9d4c('0x5'));var util=require(_0x9d4c('0x6'));var path=require(_0x9d4c('0x7'));var sox=require(_0x9d4c('0x8'));var csv=require(_0x9d4c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d4c('0xa'));var squel=require(_0x9d4c('0xb'));var crypto=require(_0x9d4c('0xc'));var jsforce=require(_0x9d4c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9d4c('0x9'));var querystring=require(_0x9d4c('0xe'));var Papa=require('papaparse');var Redis=require(_0x9d4c('0xf'));var authService=require(_0x9d4c('0x10'));var qs=require(_0x9d4c('0x11'));var as=require(_0x9d4c('0x12'));var hardwareService=require(_0x9d4c('0x13'));var logger=require(_0x9d4c('0x14'))(_0x9d4c('0x15'));var utils=require(_0x9d4c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9d4c('0x17'));var db=require(_0x9d4c('0x18'))['db'];function respondWithStatusCode(_0x472d74,_0x1459d2){_0x1459d2=_0x1459d2||0xcc;return function(_0x2ac6d7){if(_0x2ac6d7){return _0x472d74['sendStatus'](_0x1459d2);}return _0x472d74[_0x9d4c('0x19')](_0x1459d2)[_0x9d4c('0x1a')]();};}function respondWithResult(_0x1fc3ff,_0x22a035){_0x22a035=_0x22a035||0xc8;return function(_0x5dba97){if(_0x5dba97){return _0x1fc3ff[_0x9d4c('0x19')](_0x22a035)[_0x9d4c('0x1b')](_0x5dba97);}};}function respondWithFilteredResult(_0x28cd6c,_0xf59c9d){return function(_0x225c30){if(_0x225c30){var _0x27267f=typeof _0xf59c9d[_0x9d4c('0x1c')]==='undefined'&&typeof _0xf59c9d[_0x9d4c('0x1d')]===_0x9d4c('0x1e');var _0x2226e7=_0x225c30[_0x9d4c('0x1f')];var _0x329117=_0x27267f?0x0:_0xf59c9d[_0x9d4c('0x1c')];var _0x76ee70=_0x27267f?_0x225c30[_0x9d4c('0x1f')]:_0xf59c9d[_0x9d4c('0x1c')]+_0xf59c9d['limit'];var _0x295a8b;if(_0x76ee70>=_0x2226e7){_0x76ee70=_0x2226e7;_0x295a8b=0xc8;}else{_0x295a8b=0xce;}_0x28cd6c[_0x9d4c('0x19')](_0x295a8b);return _0x28cd6c[_0x9d4c('0x20')](_0x9d4c('0x21'),_0x329117+'-'+_0x76ee70+'/'+_0x2226e7)['json'](_0x225c30);}return null;};}function patchUpdates(_0x34f9ec){return function(_0x2d7bbf){try{jsonpatch[_0x9d4c('0x22')](_0x2d7bbf,_0x34f9ec,!![]);}catch(_0x1598cf){return BPromise[_0x9d4c('0x23')](_0x1598cf);}return _0x2d7bbf['save']();};}function saveUpdates(_0x166a33,_0x79b54a){return function(_0x43a822){if(_0x43a822){return _0x43a822[_0x9d4c('0x24')](_0x166a33)[_0x9d4c('0x25')](function(_0x110beb){return _0x110beb;});}return null;};}function removeEntity(_0x4dfd53,_0x38e925){return function(_0x9dc8e8){if(_0x9dc8e8){return _0x9dc8e8['destroy']()['then'](function(){var _0x17aea4=_0x9dc8e8[_0x9d4c('0x26')]({'plain':!![]});var _0x5cbc5c=_0x9d4c('0x27');return db['UserProfileResource'][_0x9d4c('0x28')]({'where':{'type':_0x5cbc5c,'resourceId':_0x17aea4['id']}})[_0x9d4c('0x25')](function(){return _0x9dc8e8;});})[_0x9d4c('0x25')](function(){_0x4dfd53['status'](0xcc)[_0x9d4c('0x1a')]();});}};}function handleEntityNotFound(_0x33e9ba,_0x59bafb){return function(_0xf57511){if(!_0xf57511){_0x33e9ba['sendStatus'](0x194);}return _0xf57511;};}function handleError(_0x7157a7,_0x2aaeef){_0x2aaeef=_0x2aaeef||0x1f4;return function(_0x5e964c){logger[_0x9d4c('0x29')](_0x5e964c[_0x9d4c('0x2a')]);if(_0x5e964c[_0x9d4c('0x2b')]){delete _0x5e964c[_0x9d4c('0x2b')];}_0x7157a7['status'](_0x2aaeef)[_0x9d4c('0x2c')](_0x5e964c);};}exports[_0x9d4c('0x2d')]=function(_0x108e58,_0x21c83c){var _0x52d937={},_0x7e0b2e={},_0x9810a2={'count':0x0,'rows':[]};var _0x5c9b01=_['map'](db['Template']['rawAttributes'],function(_0x1635ba){return{'name':_0x1635ba[_0x9d4c('0x2e')],'type':_0x1635ba[_0x9d4c('0x2f')][_0x9d4c('0x30')]};});_0x7e0b2e['model']=_['map'](_0x5c9b01,_0x9d4c('0x2b'));_0x7e0b2e[_0x9d4c('0x31')]=_[_0x9d4c('0x32')](_0x108e58['query']);_0x7e0b2e[_0x9d4c('0x33')]=_[_0x9d4c('0x34')](_0x7e0b2e['model'],_0x7e0b2e['query']);_0x52d937[_0x9d4c('0x35')]=_['intersection'](_0x7e0b2e[_0x9d4c('0x36')],qs[_0x9d4c('0x37')](_0x108e58[_0x9d4c('0x31')][_0x9d4c('0x37')]));_0x52d937[_0x9d4c('0x35')]=_0x52d937[_0x9d4c('0x35')]['length']?_0x52d937[_0x9d4c('0x35')]:_0x7e0b2e[_0x9d4c('0x36')];if(!_0x108e58[_0x9d4c('0x31')][_0x9d4c('0x38')](_0x9d4c('0x39'))){_0x52d937['limit']=qs[_0x9d4c('0x1d')](_0x108e58[_0x9d4c('0x31')][_0x9d4c('0x1d')]);_0x52d937[_0x9d4c('0x1c')]=qs[_0x9d4c('0x1c')](_0x108e58[_0x9d4c('0x31')][_0x9d4c('0x1c')]);}_0x52d937[_0x9d4c('0x3a')]=qs[_0x9d4c('0x3b')](_0x108e58[_0x9d4c('0x31')][_0x9d4c('0x3b')]);_0x52d937['where']=qs[_0x9d4c('0x33')](_[_0x9d4c('0x3c')](_0x108e58['query'],_0x7e0b2e['filters']),_0x5c9b01);if(_0x108e58['query']['filter']){_0x52d937[_0x9d4c('0x3d')]=_['merge'](_0x52d937[_0x9d4c('0x3d')],{'$or':_['map'](_0x5c9b01,function(_0x4c9a67){if(_0x4c9a67['type']!==_0x9d4c('0x3e')){var _0x57c039={};_0x57c039[_0x4c9a67[_0x9d4c('0x2b')]]={'$like':'%'+_0x108e58[_0x9d4c('0x31')][_0x9d4c('0x3f')]+'%'};return _0x57c039;}})});}_0x52d937=_[_0x9d4c('0x40')]({},_0x52d937,_0x108e58['options']);var _0x1dc46f={'where':_0x52d937[_0x9d4c('0x3d')]};return db[_0x9d4c('0x41')][_0x9d4c('0x1f')](_0x1dc46f)[_0x9d4c('0x25')](function(_0x49c937){_0x9810a2[_0x9d4c('0x1f')]=_0x49c937;if(_0x108e58[_0x9d4c('0x31')][_0x9d4c('0x42')]){_0x52d937[_0x9d4c('0x43')]=[{'all':!![]}];}return db[_0x9d4c('0x41')][_0x9d4c('0x44')](_0x52d937);})[_0x9d4c('0x25')](function(_0x27ea9a){_0x9810a2[_0x9d4c('0x45')]=_0x27ea9a;return _0x9810a2;})[_0x9d4c('0x25')](respondWithFilteredResult(_0x21c83c,_0x52d937))[_0x9d4c('0x46')](handleError(_0x21c83c,null));};exports[_0x9d4c('0x47')]=function(_0x4d86ff,_0x247b43){var _0x576462={'raw':!![],'where':{'id':_0x4d86ff[_0x9d4c('0x48')]['id']}},_0x4d12b1={};_0x4d12b1['model']=_[_0x9d4c('0x32')](db[_0x9d4c('0x41')]['rawAttributes']);_0x4d12b1['query']=_[_0x9d4c('0x32')](_0x4d86ff['query']);_0x4d12b1[_0x9d4c('0x33')]=_[_0x9d4c('0x34')](_0x4d12b1[_0x9d4c('0x36')],_0x4d12b1[_0x9d4c('0x31')]);_0x576462[_0x9d4c('0x35')]=_['intersection'](_0x4d12b1[_0x9d4c('0x36')],qs['fields'](_0x4d86ff[_0x9d4c('0x31')][_0x9d4c('0x37')]));_0x576462[_0x9d4c('0x35')]=_0x576462[_0x9d4c('0x35')][_0x9d4c('0x49')]?_0x576462[_0x9d4c('0x35')]:_0x4d12b1[_0x9d4c('0x36')];if(_0x4d86ff[_0x9d4c('0x31')][_0x9d4c('0x42')]){_0x576462[_0x9d4c('0x43')]=[{'all':!![]}];}_0x576462=_['merge']({},_0x576462,_0x4d86ff['options']);return db[_0x9d4c('0x41')][_0x9d4c('0x4a')](_0x576462)[_0x9d4c('0x25')](handleEntityNotFound(_0x247b43,null))['then'](respondWithResult(_0x247b43,null))[_0x9d4c('0x46')](handleError(_0x247b43,null));};exports[_0x9d4c('0x4b')]=function(_0x45d982,_0x9fe285){return db[_0x9d4c('0x41')][_0x9d4c('0x4b')](_0x45d982['body'],{})[_0x9d4c('0x25')](function(_0x4bdb82){var _0x355517=_0x45d982[_0x9d4c('0x4c')][_0x9d4c('0x26')]({'plain':!![]});if(!_0x355517)throw new Error(_0x9d4c('0x4d'));if(_0x355517['role']===_0x9d4c('0x4c')){var _0x2af438=_0x4bdb82['get']({'plain':!![]});var _0x5c9c15=_0x9d4c('0x27');return db[_0x9d4c('0x4e')][_0x9d4c('0x4a')]({'where':{'name':_0x5c9c15,'userProfileId':_0x355517[_0x9d4c('0x4f')]},'raw':!![]})[_0x9d4c('0x25')](function(_0x1e53db){if(_0x1e53db&&_0x1e53db[_0x9d4c('0x50')]===0x0){return db[_0x9d4c('0x51')][_0x9d4c('0x4b')]({'name':_0x2af438['name'],'resourceId':_0x2af438['id'],'type':_0x1e53db[_0x9d4c('0x2b')],'sectionId':_0x1e53db['id']},{})[_0x9d4c('0x25')](function(){return _0x4bdb82;});}else{return _0x4bdb82;}})[_0x9d4c('0x46')](function(_0x389943){logger[_0x9d4c('0x29')](_0x9d4c('0x52'),_0x389943);throw _0x389943;});}return _0x4bdb82;})[_0x9d4c('0x25')](respondWithResult(_0x9fe285,0xc9))[_0x9d4c('0x46')](handleError(_0x9fe285,null));};exports['update']=function(_0x150d2e,_0x270a21){if(_0x150d2e[_0x9d4c('0x53')]['id']){delete _0x150d2e[_0x9d4c('0x53')]['id'];}return db[_0x9d4c('0x41')]['find']({'where':{'id':_0x150d2e[_0x9d4c('0x48')]['id']}})[_0x9d4c('0x25')](handleEntityNotFound(_0x270a21,null))['then'](saveUpdates(_0x150d2e[_0x9d4c('0x53')],null))[_0x9d4c('0x25')](respondWithResult(_0x270a21,null))[_0x9d4c('0x46')](handleError(_0x270a21,null));};exports['destroy']=function(_0x13f2d0,_0x5775bc){return db['Template'][_0x9d4c('0x4a')]({'where':{'id':_0x13f2d0['params']['id']}})[_0x9d4c('0x25')](handleEntityNotFound(_0x5775bc,null))[_0x9d4c('0x25')](removeEntity(_0x5775bc,null))[_0x9d4c('0x46')](handleError(_0x5775bc,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9eecb31..04fea5f 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 _0xc7ba=['rimraf','./template.attributes','exports','tools_templates','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xc7ba,0x112));var _0xac7b=function(_0x55ffc5,_0x229aa7){_0x55ffc5=_0x55ffc5-0x0;var _0x3578fb=_0xc7ba[_0x55ffc5];return _0x3578fb;};'use strict';var _=require(_0xac7b('0x0'));var util=require('util');var logger=require(_0xac7b('0x1'))('api');var moment=require(_0xac7b('0x2'));var BPromise=require(_0xac7b('0x3'));var rp=require(_0xac7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac7b('0x5'));var config=require('../../config/environment');var attributes=require(_0xac7b('0x6'));module[_0xac7b('0x7')]=function(_0x586b66,_0x30ec66){return _0x586b66['define']('Template',attributes,{'tableName':_0xac7b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e38=['util','moment','path','rimraf','./template.attributes','exports','tools_templates'];(function(_0x5a7874,_0xee30eb){var _0x5600cc=function(_0x1900dd){while(--_0x1900dd){_0x5a7874['push'](_0x5a7874['shift']());}};_0x5600cc(++_0xee30eb);}(_0x1e38,0xf5));var _0x81e3=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0x1e38[_0x198446];return _0x38d7b7;};'use strict';var _=require('lodash');var util=require(_0x81e3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x81e3('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x81e3('0x2'));var rimraf=require(_0x81e3('0x3'));var config=require('../../config/environment');var attributes=require(_0x81e3('0x4'));module[_0x81e3('0x5')]=function(_0x50297d,_0x2c1793){return _0x50297d['define']('Template',attributes,{'tableName':_0x81e3('0x6'),'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 a7f9b82..c0371c9 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 _0xdeed=['GetTemplate','Template','findAll','options','where','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x382994,_0x281003){var _0x42e8d0=function(_0x3e35da){while(--_0x3e35da){_0x382994['push'](_0x382994['shift']());}};_0x42e8d0(++_0x281003);}(_0xdeed,0xd5));var _0xddee=function(_0xbdb077,_0x42fff0){_0xbdb077=_0xbdb077-0x0;var _0x3120ea=_0xdeed[_0xbdb077];return _0x3120ea;};'use strict';var _=require(_0xddee('0x0'));var util=require('util');var moment=require(_0xddee('0x1'));var BPromise=require(_0xddee('0x2'));var rs=require(_0xddee('0x3'));var fs=require('fs');var Redis=require(_0xddee('0x4'));var db=require(_0xddee('0x5'))['db'];var utils=require(_0xddee('0x6'));var logger=require(_0xddee('0x7'))(_0xddee('0x8'));var config=require(_0xddee('0x9'));var jayson=require(_0xddee('0xa'));var client=jayson[_0xddee('0xb')][_0xddee('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12f4e3,_0x470518,_0x4cb151){return new BPromise(function(_0xffae37,_0x253905){return client[_0xddee('0xd')](_0x12f4e3,_0x4cb151)[_0xddee('0xe')](function(_0x91294e){logger[_0xddee('0xf')](_0xddee('0x10'),_0x470518,_0xddee('0x11'));logger[_0xddee('0x12')](_0xddee('0x13'),_0x470518,_0xddee('0x11'),JSON[_0xddee('0x14')](_0x91294e));if(_0x91294e[_0xddee('0x15')]){if(_0x91294e[_0xddee('0x15')]['code']===0x1f4){logger[_0xddee('0x15')](_0xddee('0x10'),_0x470518,_0x91294e['error'][_0xddee('0x16')]);return _0x253905(_0x91294e[_0xddee('0x15')][_0xddee('0x16')]);}logger[_0xddee('0x15')]('Template,\x20%s,\x20%s',_0x470518,_0x91294e[_0xddee('0x15')][_0xddee('0x16')]);return _0xffae37(_0x91294e[_0xddee('0x15')][_0xddee('0x16')]);}else{logger[_0xddee('0xf')](_0xddee('0x10'),_0x470518,_0xddee('0x11'));_0xffae37(_0x91294e[_0xddee('0x17')][_0xddee('0x16')]);}})[_0xddee('0x18')](function(_0x6352c5){logger['error'](_0xddee('0x10'),_0x470518,_0x6352c5);_0x253905(_0x6352c5);});});}exports[_0xddee('0x19')]=function(_0x1f8ea4){var _0x11c640=this;return new Promise(function(_0x1692da,_0x3e5bad){return db[_0xddee('0x1a')][_0xddee('0x1b')]({'raw':_0x1f8ea4['options']?_0x1f8ea4['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f8ea4[_0xddee('0x1c')]?_0x1f8ea4[_0xddee('0x1c')][_0xddee('0x1d')]||null:null,'attributes':_0x1f8ea4[_0xddee('0x1c')]?_0x1f8ea4[_0xddee('0x1c')]['attributes']||null:null,'limit':_0x1f8ea4[_0xddee('0x1c')]?_0x1f8ea4[_0xddee('0x1c')]['limit']||null:null,'include':_0x1f8ea4[_0xddee('0x1c')]?_0x1f8ea4[_0xddee('0x1c')][_0xddee('0x1e')]?_[_0xddee('0x1f')](_0x1f8ea4['options'][_0xddee('0x1e')],function(_0x250f1b){return{'model':db[_0x250f1b[_0xddee('0x20')]],'as':_0x250f1b['as'],'attributes':_0x250f1b[_0xddee('0x21')],'include':_0x250f1b[_0xddee('0x1e')]?_[_0xddee('0x1f')](_0x250f1b['include'],function(_0x91016c){return{'model':db[_0x91016c[_0xddee('0x20')]],'as':_0x91016c['as'],'attributes':_0x91016c[_0xddee('0x21')],'include':_0x91016c[_0xddee('0x1e')]?_[_0xddee('0x1f')](_0x91016c['include'],function(_0x1378aa){return{'model':db[_0x1378aa[_0xddee('0x20')]],'as':_0x1378aa['as'],'attributes':_0x1378aa[_0xddee('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x334cc6){logger[_0xddee('0xf')]('GetTemplate',_0x1f8ea4);logger[_0xddee('0x12')](_0xddee('0x19'),_0x1f8ea4,JSON[_0xddee('0x14')](_0x334cc6));_0x1692da(_0x334cc6);})[_0xddee('0x18')](function(_0x35b97f){logger[_0xddee('0x15')](_0xddee('0x19'),_0x35b97f['message'],_0x1f8ea4);_0x3e5bad(_0x11c640[_0xddee('0x15')](0x1f4,_0x35b97f['message']));});});}; \ No newline at end of file +var _0x1e9c=['rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','Template','findAll','options','where','attributes','limit','include','map','model','GetTemplate','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0xa77016,_0x1de579){var _0x30ed8c=function(_0x4b6d60){while(--_0x4b6d60){_0xa77016['push'](_0xa77016['shift']());}};_0x30ed8c(++_0x1de579);}(_0x1e9c,0x1d9));var _0xc1e9=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x1e9c[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xc1e9('0x0'));var util=require(_0xc1e9('0x1'));var moment=require(_0xc1e9('0x2'));var BPromise=require(_0xc1e9('0x3'));var rs=require(_0xc1e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc1e9('0x5'));var logger=require(_0xc1e9('0x6'))(_0xc1e9('0x7'));var config=require(_0xc1e9('0x8'));var jayson=require(_0xc1e9('0x9'));var client=jayson[_0xc1e9('0xa')][_0xc1e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31b19b,_0x3bc857,_0x3b0e0e){return new BPromise(function(_0x32a7d7,_0x2d5428){return client['request'](_0x31b19b,_0x3b0e0e)[_0xc1e9('0xc')](function(_0x584283){logger[_0xc1e9('0xd')](_0xc1e9('0xe'),_0x3bc857,'request\x20sent');logger[_0xc1e9('0xf')](_0xc1e9('0x10'),_0x3bc857,_0xc1e9('0x11'),JSON[_0xc1e9('0x12')](_0x584283));if(_0x584283[_0xc1e9('0x13')]){if(_0x584283['error']['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x3bc857,_0x584283[_0xc1e9('0x13')][_0xc1e9('0x14')]);return _0x2d5428(_0x584283[_0xc1e9('0x13')][_0xc1e9('0x14')]);}logger[_0xc1e9('0x13')](_0xc1e9('0xe'),_0x3bc857,_0x584283['error'][_0xc1e9('0x14')]);return _0x32a7d7(_0x584283[_0xc1e9('0x13')]['message']);}else{logger[_0xc1e9('0xd')](_0xc1e9('0xe'),_0x3bc857,'request\x20sent');_0x32a7d7(_0x584283[_0xc1e9('0x15')]['message']);}})['catch'](function(_0x49c70d){logger[_0xc1e9('0x13')](_0xc1e9('0xe'),_0x3bc857,_0x49c70d);_0x2d5428(_0x49c70d);});});}exports['GetTemplate']=function(_0xd7024a){var _0x28a541=this;return new Promise(function(_0x3daaf7,_0x4bad4){return db[_0xc1e9('0x16')][_0xc1e9('0x17')]({'raw':_0xd7024a[_0xc1e9('0x18')]?_0xd7024a[_0xc1e9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd7024a[_0xc1e9('0x18')]?_0xd7024a[_0xc1e9('0x18')][_0xc1e9('0x19')]||null:null,'attributes':_0xd7024a[_0xc1e9('0x18')]?_0xd7024a[_0xc1e9('0x18')][_0xc1e9('0x1a')]||null:null,'limit':_0xd7024a['options']?_0xd7024a[_0xc1e9('0x18')][_0xc1e9('0x1b')]||null:null,'include':_0xd7024a['options']?_0xd7024a['options'][_0xc1e9('0x1c')]?_[_0xc1e9('0x1d')](_0xd7024a[_0xc1e9('0x18')][_0xc1e9('0x1c')],function(_0x6d64d6){return{'model':db[_0x6d64d6[_0xc1e9('0x1e')]],'as':_0x6d64d6['as'],'attributes':_0x6d64d6[_0xc1e9('0x1a')],'include':_0x6d64d6[_0xc1e9('0x1c')]?_[_0xc1e9('0x1d')](_0x6d64d6['include'],function(_0x81bec3){return{'model':db[_0x81bec3[_0xc1e9('0x1e')]],'as':_0x81bec3['as'],'attributes':_0x81bec3[_0xc1e9('0x1a')],'include':_0x81bec3['include']?_[_0xc1e9('0x1d')](_0x81bec3['include'],function(_0x210144){return{'model':db[_0x210144['model']],'as':_0x210144['as'],'attributes':_0x210144[_0xc1e9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc1e9('0xc')](function(_0x1bf3d0){logger[_0xc1e9('0xd')](_0xc1e9('0x1f'),_0xd7024a);logger[_0xc1e9('0xf')](_0xc1e9('0x1f'),_0xd7024a,JSON[_0xc1e9('0x12')](_0x1bf3d0));_0x3daaf7(_0x1bf3d0);})['catch'](function(_0x3a5ee2){logger[_0xc1e9('0x13')]('GetTemplate',_0x3a5ee2['message'],_0xd7024a);_0x4bad4(_0x28a541['error'](0x1f4,_0x3a5ee2[_0xc1e9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8f97234..3b29961 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 _0xb9be=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','create','post','addAnyCondition','addAction','put','update','delete','destroy'];(function(_0x5122cd,_0x111d88){var _0x25412e=function(_0x5b1385){while(--_0x5b1385){_0x5122cd['push'](_0x5122cd['shift']());}};_0x25412e(++_0x111d88);}(_0xb9be,0xc5));var _0xeb9b=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xb9be[_0x59d0cc];return _0x2ae79f;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var fs_extra=require(_0xeb9b('0x6'));var auth=require(_0xeb9b('0x7'));var interaction=require(_0xeb9b('0x8'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xeb9b('0x9')]('/',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xb')]);router['get'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xd')]);router[_0xeb9b('0x9')](_0xeb9b('0xe'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xf')]);router[_0xeb9b('0x9')](_0xeb9b('0x10'),auth['isAuthenticated'](),controller[_0xeb9b('0x11')]);router['get']('/:id/actions',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x12')]);router['post']('/',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x13')]);router[_0xeb9b('0x14')](_0xeb9b('0xe'),auth['isAuthenticated'](),controller['addAllCondition']);router['post'](_0xeb9b('0x10'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x15')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0xeb9b('0x16')]);router[_0xeb9b('0x17')](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x18')]);router[_0xeb9b('0x19')](_0xeb9b('0xc'),auth['isAuthenticated'](),controller[_0xeb9b('0x1a')]);module[_0xeb9b('0x1b')]=router; \ No newline at end of file +var _0x18ba=['/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show'];(function(_0x1d7bc0,_0x50a455){var _0x15a179=function(_0x378a42){while(--_0x378a42){_0x1d7bc0['push'](_0x1d7bc0['shift']());}};_0x15a179(++_0x50a455);}(_0x18ba,0x1a3));var _0xa18b=function(_0x23d297,_0x594318){_0x23d297=_0x23d297-0x0;var _0x1d0b0c=_0x18ba[_0x23d297];return _0x1d0b0c;};'use strict';var multer=require(_0xa18b('0x0'));var util=require(_0xa18b('0x1'));var path=require('path');var timeout=require(_0xa18b('0x2'));var express=require(_0xa18b('0x3'));var router=express[_0xa18b('0x4')]();var fs_extra=require(_0xa18b('0x5'));var auth=require(_0xa18b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa18b('0x7'));var controller=require(_0xa18b('0x8'));router[_0xa18b('0x9')]('/',auth[_0xa18b('0xa')](),controller[_0xa18b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa18b('0xc')]);router[_0xa18b('0x9')](_0xa18b('0xd'),auth['isAuthenticated'](),controller[_0xa18b('0xe')]);router[_0xa18b('0x9')](_0xa18b('0xf'),auth[_0xa18b('0xa')](),controller[_0xa18b('0x10')]);router[_0xa18b('0x9')](_0xa18b('0x11'),auth['isAuthenticated'](),controller[_0xa18b('0x12')]);router[_0xa18b('0x13')]('/',auth[_0xa18b('0xa')](),controller[_0xa18b('0x14')]);router[_0xa18b('0x13')](_0xa18b('0xd'),auth[_0xa18b('0xa')](),controller[_0xa18b('0x15')]);router[_0xa18b('0x13')](_0xa18b('0xf'),auth[_0xa18b('0xa')](),controller['addAnyCondition']);router[_0xa18b('0x13')](_0xa18b('0x11'),auth[_0xa18b('0xa')](),controller[_0xa18b('0x16')]);router[_0xa18b('0x17')](_0xa18b('0x18'),auth[_0xa18b('0xa')](),controller[_0xa18b('0x19')]);router['delete'](_0xa18b('0x18'),auth[_0xa18b('0xa')](),controller['destroy']);module[_0xa18b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0667ed4..39791a0 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 _0x5c4c=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4fbf65,_0x5a05bf){var _0x7e4e0f=function(_0x582123){while(--_0x582123){_0x4fbf65['push'](_0x4fbf65['shift']());}};_0x7e4e0f(++_0x5a05bf);}(_0x5c4c,0x1b7));var _0xc5c4=function(_0x4587ca,_0x2c47bc){_0x4587ca=_0x4587ca-0x0;var _0x57c9da=_0x5c4c[_0x4587ca];return _0x57c9da;};'use strict';var Sequelize=require(_0xc5c4('0x0'));module[_0xc5c4('0x1')]={'name':{'type':Sequelize[_0xc5c4('0x2')]},'channel':{'type':Sequelize[_0xc5c4('0x2')]},'description':{'type':Sequelize[_0xc5c4('0x2')]},'status':{'type':Sequelize[_0xc5c4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ab7=['STRING','BOOLEAN','exports'];(function(_0x38b9a8,_0x3e97e2){var _0x23087e=function(_0x564377){while(--_0x564377){_0x38b9a8['push'](_0x38b9a8['shift']());}};_0x23087e(++_0x3e97e2);}(_0x3ab7,0x1f1));var _0x73ab=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3ab7[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x73ab('0x0')]={'name':{'type':Sequelize[_0x73ab('0x1')]},'channel':{'type':Sequelize[_0x73ab('0x1')]},'description':{'type':Sequelize[_0x73ab('0x1')]},'status':{'type':Sequelize[_0x73ab('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 2b3161f..11c5066 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 _0xbe64=['json','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','catch','show','body','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','order','filter','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','crypto','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0xbe64,0x19d));var _0x4be6=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xbe64[_0x2fc012];return _0x2891f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4be6('0x0'));var zipdir=require(_0x4be6('0x1'));var jsonpatch=require(_0x4be6('0x2'));var rp=require(_0x4be6('0x3'));var moment=require(_0x4be6('0x4'));var BPromise=require(_0x4be6('0x5'));var Mustache=require('mustache');var util=require(_0x4be6('0x6'));var path=require(_0x4be6('0x7'));var sox=require(_0x4be6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4be6('0x9'));var crypto=require(_0x4be6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4be6('0xb'));var querystring=require(_0x4be6('0xc'));var Papa=require('papaparse');var Redis=require(_0x4be6('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4be6('0xe'));var logger=require(_0x4be6('0xf'))(_0x4be6('0x10'));var utils=require(_0x4be6('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4be6('0x12'))['db'];function respondWithStatusCode(_0x11d6dd,_0x44dd4c){_0x44dd4c=_0x44dd4c||0xcc;return function(_0x2faf75){if(_0x2faf75){return _0x11d6dd[_0x4be6('0x13')](_0x44dd4c);}return _0x11d6dd[_0x4be6('0x14')](_0x44dd4c)[_0x4be6('0x15')]();};}function respondWithResult(_0x2e3d10,_0x2a6b30){_0x2a6b30=_0x2a6b30||0xc8;return function(_0x25b24f){if(_0x25b24f){return _0x2e3d10[_0x4be6('0x14')](_0x2a6b30)['json'](_0x25b24f);}};}function respondWithFilteredResult(_0xcdcd49,_0x425b4a){return function(_0x35e366){if(_0x35e366){var _0x3f5697=typeof _0x425b4a[_0x4be6('0x16')]===_0x4be6('0x17')&&typeof _0x425b4a[_0x4be6('0x18')]===_0x4be6('0x17');var _0x78663e=_0x35e366[_0x4be6('0x19')];var _0x123bc6=_0x3f5697?0x0:_0x425b4a[_0x4be6('0x16')];var _0xdeb7e5=_0x3f5697?_0x35e366[_0x4be6('0x19')]:_0x425b4a[_0x4be6('0x16')]+_0x425b4a['limit'];var _0x49e4ce;if(_0xdeb7e5>=_0x78663e){_0xdeb7e5=_0x78663e;_0x49e4ce=0xc8;}else{_0x49e4ce=0xce;}_0xcdcd49[_0x4be6('0x14')](_0x49e4ce);return _0xcdcd49['set'](_0x4be6('0x1a'),_0x123bc6+'-'+_0xdeb7e5+'/'+_0x78663e)[_0x4be6('0x1b')](_0x35e366);}return null;};}function patchUpdates(_0x50d1b2){return function(_0x1774aa){try{jsonpatch['apply'](_0x1774aa,_0x50d1b2,!![]);}catch(_0x635ad5){return BPromise['reject'](_0x635ad5);}return _0x1774aa[_0x4be6('0x1c')]();};}function saveUpdates(_0x300c9c,_0x267806){return function(_0x5383b4){if(_0x5383b4){return _0x5383b4[_0x4be6('0x1d')](_0x300c9c)[_0x4be6('0x1e')](function(_0x451763){return _0x451763;});}return null;};}function removeEntity(_0x36fd12,_0x3c59f0){return function(_0x569c0d){if(_0x569c0d){return _0x569c0d[_0x4be6('0x1f')]()[_0x4be6('0x1e')](function(){var _0x41f2a3=_0x569c0d[_0x4be6('0x20')]({'plain':!![]});var _0x531039=_0x4be6('0x21');return db[_0x4be6('0x22')]['destroy']({'where':{'type':_0x531039,'resourceId':_0x41f2a3['id']}})[_0x4be6('0x1e')](function(){return _0x569c0d;});})['then'](function(){_0x36fd12[_0x4be6('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe082d6,_0x34629e){return function(_0x7ce2e5){if(!_0x7ce2e5){_0xe082d6[_0x4be6('0x13')](0x194);}return _0x7ce2e5;};}function handleError(_0x158283,_0x4a434b){_0x4a434b=_0x4a434b||0x1f4;return function(_0x511fab){logger[_0x4be6('0x23')](_0x511fab[_0x4be6('0x24')]);if(_0x511fab[_0x4be6('0x25')]){delete _0x511fab['name'];}_0x158283['status'](_0x4a434b)[_0x4be6('0x26')](_0x511fab);};}exports[_0x4be6('0x27')]=function(_0xa99c89,_0x9853f5){var _0xc9cb70={},_0xe5cae2={},_0x23a1d3={'count':0x0,'rows':[]};var _0x4ec894=_[_0x4be6('0x28')](db[_0x4be6('0x29')][_0x4be6('0x2a')],function(_0x4afda4){return{'name':_0x4afda4[_0x4be6('0x2b')],'type':_0x4afda4[_0x4be6('0x2c')][_0x4be6('0x2d')]};});_0xe5cae2[_0x4be6('0x2e')]=_['map'](_0x4ec894,_0x4be6('0x25'));_0xe5cae2[_0x4be6('0x2f')]=_[_0x4be6('0x30')](_0xa99c89[_0x4be6('0x2f')]);_0xe5cae2[_0x4be6('0x31')]=_[_0x4be6('0x32')](_0xe5cae2[_0x4be6('0x2e')],_0xe5cae2['query']);_0xc9cb70[_0x4be6('0x33')]=_['intersection'](_0xe5cae2[_0x4be6('0x2e')],qs[_0x4be6('0x34')](_0xa99c89[_0x4be6('0x2f')][_0x4be6('0x34')]));_0xc9cb70[_0x4be6('0x33')]=_0xc9cb70[_0x4be6('0x33')][_0x4be6('0x35')]?_0xc9cb70['attributes']:_0xe5cae2[_0x4be6('0x2e')];if(!_0xa99c89[_0x4be6('0x2f')][_0x4be6('0x36')](_0x4be6('0x37'))){_0xc9cb70['limit']=qs['limit'](_0xa99c89[_0x4be6('0x2f')]['limit']);_0xc9cb70[_0x4be6('0x16')]=qs['offset'](_0xa99c89[_0x4be6('0x2f')][_0x4be6('0x16')]);}_0xc9cb70['order']=qs[_0x4be6('0x38')](_0xa99c89['query'][_0x4be6('0x38')]);_0xc9cb70['where']=qs['filters'](_[_0x4be6('0x39')](_0xa99c89[_0x4be6('0x2f')],_0xe5cae2[_0x4be6('0x31')]),_0x4ec894);if(_0xa99c89[_0x4be6('0x2f')]['filter']){_0xc9cb70[_0x4be6('0x3a')]=_[_0x4be6('0x3b')](_0xc9cb70[_0x4be6('0x3a')],{'$or':_[_0x4be6('0x28')](_0x4ec894,function(_0x96f85a){if(_0x96f85a['type']!==_0x4be6('0x3c')){var _0x355e1c={};_0x355e1c[_0x96f85a[_0x4be6('0x25')]]={'$like':'%'+_0xa99c89[_0x4be6('0x2f')]['filter']+'%'};return _0x355e1c;}})});}_0xc9cb70=_[_0x4be6('0x3b')]({},_0xc9cb70,_0xa99c89[_0x4be6('0x3d')]);var _0x2a577d={'where':_0xc9cb70[_0x4be6('0x3a')]};return db[_0x4be6('0x29')][_0x4be6('0x19')](_0x2a577d)['then'](function(_0x1ec7be){_0x23a1d3['count']=_0x1ec7be;if(_0xa99c89['query'][_0x4be6('0x3e')]){_0xc9cb70[_0x4be6('0x3f')]=[{'all':!![]}];}return db[_0x4be6('0x29')]['findAll'](_0xc9cb70);})[_0x4be6('0x1e')](function(_0x4e17f0){_0x23a1d3['rows']=_0x4e17f0;return _0x23a1d3;})[_0x4be6('0x1e')](respondWithFilteredResult(_0x9853f5,_0xc9cb70))[_0x4be6('0x40')](handleError(_0x9853f5,null));};exports[_0x4be6('0x41')]=function(_0x24a143,_0x1839f6){var _0x423c91={'raw':![],'where':{'id':_0x24a143['params']['id']}},_0x18f935={};_0x18f935[_0x4be6('0x2e')]=_[_0x4be6('0x30')](db[_0x4be6('0x29')][_0x4be6('0x2a')]);_0x18f935['query']=_[_0x4be6('0x30')](_0x24a143[_0x4be6('0x2f')]);_0x18f935[_0x4be6('0x31')]=_[_0x4be6('0x32')](_0x18f935[_0x4be6('0x2e')],_0x18f935[_0x4be6('0x2f')]);_0x423c91[_0x4be6('0x33')]=_['intersection'](_0x18f935[_0x4be6('0x2e')],qs[_0x4be6('0x34')](_0x24a143['query']['fields']));_0x423c91['attributes']=_0x423c91['attributes'][_0x4be6('0x35')]?_0x423c91[_0x4be6('0x33')]:_0x18f935[_0x4be6('0x2e')];if(_0x24a143['query'][_0x4be6('0x3e')]){_0x423c91[_0x4be6('0x3f')]=[{'all':!![]}];}_0x423c91=_['merge']({},_0x423c91,_0x24a143['options']);return db[_0x4be6('0x29')]['find'](_0x423c91)['then'](handleEntityNotFound(_0x1839f6,null))['then'](respondWithResult(_0x1839f6,null))[_0x4be6('0x40')](handleError(_0x1839f6,null));};exports['create']=function(_0x54312f,_0x41d6b2){return db[_0x4be6('0x29')]['create'](_0x54312f[_0x4be6('0x42')],{})[_0x4be6('0x1e')](function(_0x30c902){var _0x1a307e=_0x54312f['user'][_0x4be6('0x20')]({'plain':!![]});if(!_0x1a307e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a307e[_0x4be6('0x43')]==='user'){var _0x2a3d01=_0x30c902['get']({'plain':!![]});var _0x5f02b4=_0x4be6('0x21');return db['UserProfileSection'][_0x4be6('0x44')]({'where':{'name':_0x5f02b4,'userProfileId':_0x1a307e[_0x4be6('0x45')]},'raw':!![]})['then'](function(_0x1d3c60){if(_0x1d3c60&&_0x1d3c60[_0x4be6('0x46')]===0x0){return db[_0x4be6('0x22')][_0x4be6('0x47')]({'name':_0x2a3d01['name'],'resourceId':_0x2a3d01['id'],'type':_0x1d3c60[_0x4be6('0x25')],'sectionId':_0x1d3c60['id']},{})['then'](function(){return _0x30c902;});}else{return _0x30c902;}})[_0x4be6('0x40')](function(_0x2465ee){logger['error'](_0x4be6('0x48'),_0x2465ee);throw _0x2465ee;});}return _0x30c902;})[_0x4be6('0x1e')](respondWithResult(_0x41d6b2,0xc9))['catch'](handleError(_0x41d6b2,null));};exports['update']=function(_0x1b33f6,_0x1e77f5){if(_0x1b33f6[_0x4be6('0x42')]['id']){delete _0x1b33f6['body']['id'];}return db[_0x4be6('0x29')][_0x4be6('0x44')]({'where':{'id':_0x1b33f6[_0x4be6('0x49')]['id']}})[_0x4be6('0x1e')](handleEntityNotFound(_0x1e77f5,null))['then'](saveUpdates(_0x1b33f6['body'],null))[_0x4be6('0x1e')](respondWithResult(_0x1e77f5,null))[_0x4be6('0x40')](handleError(_0x1e77f5,null));};exports[_0x4be6('0x1f')]=function(_0x20d643,_0x1113ac){return db[_0x4be6('0x29')][_0x4be6('0x44')]({'where':{'id':_0x20d643[_0x4be6('0x49')]['id']}})['then'](handleEntityNotFound(_0x1113ac,null))['then'](removeEntity(_0x1113ac,null))[_0x4be6('0x40')](handleError(_0x1113ac,null));};exports[_0x4be6('0x4a')]=function(_0x2dd82b,_0x52c81b,_0x2fa623){if(_0x2dd82b[_0x4be6('0x42')]['id']){delete _0x2dd82b[_0x4be6('0x42')]['id'];}return db['Trigger'][_0x4be6('0x44')]({'where':{'id':_0x2dd82b[_0x4be6('0x49')]['id']}})[_0x4be6('0x1e')](handleEntityNotFound(_0x52c81b,null))[_0x4be6('0x1e')](function(_0x21aa93){if(_0x21aa93){_0x2dd82b[_0x4be6('0x42')][_0x4be6('0x4b')]=_0x21aa93['id'];return db[_0x4be6('0x4c')][_0x4be6('0x47')](_0x2dd82b[_0x4be6('0x42')]);}})['then'](respondWithResult(_0x52c81b,null))[_0x4be6('0x40')](handleError(_0x52c81b,null));};exports[_0x4be6('0x4d')]=function(_0x166512,_0x2fdc18,_0x571b82){if(_0x166512[_0x4be6('0x42')]['id']){delete _0x166512[_0x4be6('0x42')]['id'];}return db[_0x4be6('0x29')]['find']({'where':{'id':_0x166512[_0x4be6('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fdc18,null))[_0x4be6('0x1e')](function(_0x2ac2f6){if(_0x2ac2f6){_0x166512['body'][_0x4be6('0x4e')]=_0x2ac2f6['id'];return db[_0x4be6('0x4c')][_0x4be6('0x47')](_0x166512[_0x4be6('0x42')]);}})[_0x4be6('0x1e')](respondWithResult(_0x2fdc18,null))[_0x4be6('0x40')](handleError(_0x2fdc18,null));};exports['getAllConditions']=function(_0x9e7e4d,_0x44c495,_0x437a43){var _0x51a4d2={};var _0x5ce74b={};var _0x373e5a;var _0x550732;return db[_0x4be6('0x29')]['findOne']({'where':{'id':_0x9e7e4d[_0x4be6('0x49')]['id']}})[_0x4be6('0x1e')](handleEntityNotFound(_0x44c495,null))[_0x4be6('0x1e')](function(_0x19d8f8){if(_0x19d8f8){_0x373e5a=_0x19d8f8;_0x5ce74b[_0x4be6('0x2e')]=_['keys'](db[_0x4be6('0x4c')]['rawAttributes']);_0x5ce74b[_0x4be6('0x2f')]=_['keys'](_0x9e7e4d[_0x4be6('0x2f')]);_0x5ce74b['filters']=_['intersection'](_0x5ce74b[_0x4be6('0x2e')],_0x5ce74b[_0x4be6('0x2f')]);_0x51a4d2['attributes']=_[_0x4be6('0x32')](_0x5ce74b[_0x4be6('0x2e')],qs['fields'](_0x9e7e4d['query'][_0x4be6('0x34')]));_0x51a4d2['attributes']=_0x51a4d2['attributes'][_0x4be6('0x35')]?_0x51a4d2[_0x4be6('0x33')]:_0x5ce74b[_0x4be6('0x2e')];_0x51a4d2[_0x4be6('0x4f')]=qs[_0x4be6('0x38')](_0x9e7e4d['query'][_0x4be6('0x38')]);_0x51a4d2['where']=qs[_0x4be6('0x31')](_['pick'](_0x9e7e4d[_0x4be6('0x2f')],_0x5ce74b['filters']));if(_0x9e7e4d[_0x4be6('0x2f')][_0x4be6('0x50')]){_0x51a4d2[_0x4be6('0x3a')]=_[_0x4be6('0x3b')](_0x51a4d2[_0x4be6('0x3a')],{'$or':_['map'](_0x51a4d2[_0x4be6('0x33')],function(_0x1062a9){var _0x25d237={};_0x25d237[_0x1062a9]={'$like':'%'+_0x9e7e4d['query'][_0x4be6('0x50')]+'%'};return _0x25d237;})});}_0x51a4d2=_[_0x4be6('0x3b')]({},_0x51a4d2,_0x9e7e4d[_0x4be6('0x3d')]);return _0x373e5a[_0x4be6('0x51')](_0x51a4d2);}})[_0x4be6('0x1e')](function(_0x43b85c){if(_0x43b85c){_0x550732=_0x43b85c[_0x4be6('0x35')];if(!_0x9e7e4d['query']['hasOwnProperty'](_0x4be6('0x37'))){_0x51a4d2[_0x4be6('0x18')]=qs[_0x4be6('0x18')](_0x9e7e4d['query'][_0x4be6('0x18')]);_0x51a4d2[_0x4be6('0x16')]=qs['offset'](_0x9e7e4d[_0x4be6('0x2f')]['offset']);}return _0x373e5a[_0x4be6('0x51')](_0x51a4d2);}})[_0x4be6('0x1e')](function(_0x6acfad){if(_0x6acfad){return _0x6acfad?{'count':_0x550732,'rows':_0x6acfad}:null;}})[_0x4be6('0x1e')](respondWithResult(_0x44c495,null))[_0x4be6('0x40')](handleError(_0x44c495,null));};exports['getAnyConditions']=function(_0xf899af,_0xa10d04,_0x1e313d){var _0x21b1a9={};var _0x3f9f4a={};var _0x9d90a5;var _0x519865;return db['Trigger'][_0x4be6('0x52')]({'where':{'id':_0xf899af[_0x4be6('0x49')]['id']}})[_0x4be6('0x1e')](handleEntityNotFound(_0xa10d04,null))[_0x4be6('0x1e')](function(_0x236c18){if(_0x236c18){_0x9d90a5=_0x236c18;_0x3f9f4a[_0x4be6('0x2e')]=_[_0x4be6('0x30')](db[_0x4be6('0x4c')][_0x4be6('0x2a')]);_0x3f9f4a[_0x4be6('0x2f')]=_[_0x4be6('0x30')](_0xf899af[_0x4be6('0x2f')]);_0x3f9f4a['filters']=_['intersection'](_0x3f9f4a[_0x4be6('0x2e')],_0x3f9f4a[_0x4be6('0x2f')]);_0x21b1a9[_0x4be6('0x33')]=_[_0x4be6('0x32')](_0x3f9f4a['model'],qs['fields'](_0xf899af[_0x4be6('0x2f')]['fields']));_0x21b1a9[_0x4be6('0x33')]=_0x21b1a9[_0x4be6('0x33')]['length']?_0x21b1a9[_0x4be6('0x33')]:_0x3f9f4a[_0x4be6('0x2e')];_0x21b1a9[_0x4be6('0x4f')]=qs[_0x4be6('0x38')](_0xf899af[_0x4be6('0x2f')]['sort']);_0x21b1a9[_0x4be6('0x3a')]=qs[_0x4be6('0x31')](_[_0x4be6('0x39')](_0xf899af[_0x4be6('0x2f')],_0x3f9f4a[_0x4be6('0x31')]));if(_0xf899af['query'][_0x4be6('0x50')]){_0x21b1a9[_0x4be6('0x3a')]=_[_0x4be6('0x3b')](_0x21b1a9[_0x4be6('0x3a')],{'$or':_[_0x4be6('0x28')](_0x21b1a9[_0x4be6('0x33')],function(_0x3e6396){var _0x240c4a={};_0x240c4a[_0x3e6396]={'$like':'%'+_0xf899af['query'][_0x4be6('0x50')]+'%'};return _0x240c4a;})});}_0x21b1a9=_['merge']({},_0x21b1a9,_0xf899af[_0x4be6('0x3d')]);return _0x9d90a5[_0x4be6('0x53')](_0x21b1a9);}})[_0x4be6('0x1e')](function(_0x538d8e){if(_0x538d8e){_0x519865=_0x538d8e[_0x4be6('0x35')];if(!_0xf899af[_0x4be6('0x2f')][_0x4be6('0x36')](_0x4be6('0x37'))){_0x21b1a9[_0x4be6('0x18')]=qs[_0x4be6('0x18')](_0xf899af[_0x4be6('0x2f')]['limit']);_0x21b1a9[_0x4be6('0x16')]=qs['offset'](_0xf899af[_0x4be6('0x2f')][_0x4be6('0x16')]);}return _0x9d90a5[_0x4be6('0x53')](_0x21b1a9);}})[_0x4be6('0x1e')](function(_0xa5c8cd){if(_0xa5c8cd){return _0xa5c8cd?{'count':_0x519865,'rows':_0xa5c8cd}:null;}})['then'](respondWithResult(_0xa10d04,null))['catch'](handleError(_0xa10d04,null));};exports[_0x4be6('0x54')]=function(_0x265acc,_0x914359,_0x4970a7){if(_0x265acc[_0x4be6('0x42')]['id']){delete _0x265acc['body']['id'];}return db['Trigger'][_0x4be6('0x44')]({'where':{'id':_0x265acc['params']['id']}})[_0x4be6('0x1e')](handleEntityNotFound(_0x914359,null))[_0x4be6('0x1e')](function(_0x3ce63f){if(_0x3ce63f){_0x265acc['body'][_0x4be6('0x55')]=_0x3ce63f['id'];return db['Action']['create'](_0x265acc['body']);}})[_0x4be6('0x1e')](respondWithResult(_0x914359,null))[_0x4be6('0x40')](handleError(_0x914359,null));};exports[_0x4be6('0x56')]=function(_0x34fb9e,_0x27d80d,_0x3d0417){var _0xc4a426={};var _0x42cb46={};var _0x4e1a3c;var _0x132c6a;return db[_0x4be6('0x29')][_0x4be6('0x52')]({'where':{'id':_0x34fb9e['params']['id']}})['then'](handleEntityNotFound(_0x27d80d,null))[_0x4be6('0x1e')](function(_0x6d17cf){if(_0x6d17cf){_0x4e1a3c=_0x6d17cf;_0x42cb46[_0x4be6('0x2e')]=_['keys'](db[_0x4be6('0x57')][_0x4be6('0x2a')]);_0x42cb46[_0x4be6('0x2f')]=_['keys'](_0x34fb9e[_0x4be6('0x2f')]);_0x42cb46[_0x4be6('0x31')]=_['intersection'](_0x42cb46['model'],_0x42cb46[_0x4be6('0x2f')]);_0xc4a426['attributes']=_['intersection'](_0x42cb46['model'],qs[_0x4be6('0x34')](_0x34fb9e['query']['fields']));_0xc4a426[_0x4be6('0x33')]=_0xc4a426[_0x4be6('0x33')][_0x4be6('0x35')]?_0xc4a426['attributes']:_0x42cb46[_0x4be6('0x2e')];_0xc4a426[_0x4be6('0x4f')]=qs[_0x4be6('0x38')](_0x34fb9e[_0x4be6('0x2f')][_0x4be6('0x38')]);_0xc4a426[_0x4be6('0x3a')]=qs[_0x4be6('0x31')](_[_0x4be6('0x39')](_0x34fb9e[_0x4be6('0x2f')],_0x42cb46[_0x4be6('0x31')]));if(_0x34fb9e[_0x4be6('0x2f')]['filter']){_0xc4a426[_0x4be6('0x3a')]=_[_0x4be6('0x3b')](_0xc4a426[_0x4be6('0x3a')],{'$or':_['map'](_0xc4a426['attributes'],function(_0x46a70d){var _0x47a72f={};_0x47a72f[_0x46a70d]={'$like':'%'+_0x34fb9e[_0x4be6('0x2f')][_0x4be6('0x50')]+'%'};return _0x47a72f;})});}_0xc4a426=_[_0x4be6('0x3b')]({},_0xc4a426,_0x34fb9e[_0x4be6('0x3d')]);return _0x4e1a3c['getActions'](_0xc4a426);}})[_0x4be6('0x1e')](function(_0x2c4a42){if(_0x2c4a42){_0x132c6a=_0x2c4a42[_0x4be6('0x35')];if(!_0x34fb9e[_0x4be6('0x2f')][_0x4be6('0x36')](_0x4be6('0x37'))){_0xc4a426[_0x4be6('0x18')]=qs[_0x4be6('0x18')](_0x34fb9e[_0x4be6('0x2f')][_0x4be6('0x18')]);_0xc4a426['offset']=qs[_0x4be6('0x16')](_0x34fb9e[_0x4be6('0x2f')]['offset']);}return _0x4e1a3c[_0x4be6('0x56')](_0xc4a426);}})[_0x4be6('0x1e')](function(_0x1e5898){if(_0x1e5898){return _0x1e5898?{'count':_0x132c6a,'rows':_0x1e5898}:null;}})[_0x4be6('0x1e')](respondWithResult(_0x27d80d,null))[_0x4be6('0x40')](handleError(_0x27d80d,null));}; \ No newline at end of file +var _0x3773=['map','Trigger','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Triggers','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','index'];(function(_0x1326f5,_0x5d67dd){var _0x22ddb4=function(_0x3062e9){while(--_0x3062e9){_0x1326f5['push'](_0x1326f5['shift']());}};_0x22ddb4(++_0x5d67dd);}(_0x3773,0x1af));var _0x3377=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3773[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x3377('0x0'));var rimraf=require(_0x3377('0x1'));var zipdir=require(_0x3377('0x2'));var jsonpatch=require(_0x3377('0x3'));var rp=require(_0x3377('0x4'));var moment=require('moment');var BPromise=require(_0x3377('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3377('0x6'));var sox=require(_0x3377('0x7'));var csv=require(_0x3377('0x8'));var ejs=require(_0x3377('0x9'));var fs=require('fs');var fs_extra=require(_0x3377('0xa'));var _=require(_0x3377('0xb'));var squel=require(_0x3377('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3377('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3377('0xe'));var Redis=require(_0x3377('0xf'));var authService=require(_0x3377('0x10'));var qs=require(_0x3377('0x11'));var as=require(_0x3377('0x12'));var hardwareService=require(_0x3377('0x13'));var logger=require(_0x3377('0x14'))(_0x3377('0x15'));var utils=require(_0x3377('0x16'));var config=require(_0x3377('0x17'));var licenseUtil=require(_0x3377('0x18'));var db=require(_0x3377('0x19'))['db'];function respondWithStatusCode(_0x54f8ec,_0x3e6b0f){_0x3e6b0f=_0x3e6b0f||0xcc;return function(_0x5c8bef){if(_0x5c8bef){return _0x54f8ec[_0x3377('0x1a')](_0x3e6b0f);}return _0x54f8ec[_0x3377('0x1b')](_0x3e6b0f)[_0x3377('0x1c')]();};}function respondWithResult(_0x4cb7fe,_0x5e7c8f){_0x5e7c8f=_0x5e7c8f||0xc8;return function(_0x150813){if(_0x150813){return _0x4cb7fe[_0x3377('0x1b')](_0x5e7c8f)[_0x3377('0x1d')](_0x150813);}};}function respondWithFilteredResult(_0x190223,_0x1194e1){return function(_0x414b2c){if(_0x414b2c){var _0x55a827=typeof _0x1194e1[_0x3377('0x1e')]===_0x3377('0x1f')&&typeof _0x1194e1[_0x3377('0x20')]===_0x3377('0x1f');var _0x2ba2de=_0x414b2c[_0x3377('0x21')];var _0x2bc8e5=_0x55a827?0x0:_0x1194e1[_0x3377('0x1e')];var _0x2c6ce0=_0x55a827?_0x414b2c[_0x3377('0x21')]:_0x1194e1[_0x3377('0x1e')]+_0x1194e1['limit'];var _0x16993b;if(_0x2c6ce0>=_0x2ba2de){_0x2c6ce0=_0x2ba2de;_0x16993b=0xc8;}else{_0x16993b=0xce;}_0x190223[_0x3377('0x1b')](_0x16993b);return _0x190223['set']('Content-Range',_0x2bc8e5+'-'+_0x2c6ce0+'/'+_0x2ba2de)[_0x3377('0x1d')](_0x414b2c);}return null;};}function patchUpdates(_0xe9267d){return function(_0x2d9c2a){try{jsonpatch[_0x3377('0x22')](_0x2d9c2a,_0xe9267d,!![]);}catch(_0x596c19){return BPromise[_0x3377('0x23')](_0x596c19);}return _0x2d9c2a[_0x3377('0x24')]();};}function saveUpdates(_0x348f0c,_0x298ba4){return function(_0x4f47b5){if(_0x4f47b5){return _0x4f47b5[_0x3377('0x25')](_0x348f0c)[_0x3377('0x26')](function(_0x3bea90){return _0x3bea90;});}return null;};}function removeEntity(_0x5c52bf,_0x99f031){return function(_0x4e2a3c){if(_0x4e2a3c){return _0x4e2a3c[_0x3377('0x27')]()[_0x3377('0x26')](function(){var _0x48d032=_0x4e2a3c['get']({'plain':!![]});var _0x167501='Triggers';return db[_0x3377('0x28')]['destroy']({'where':{'type':_0x167501,'resourceId':_0x48d032['id']}})[_0x3377('0x26')](function(){return _0x4e2a3c;});})[_0x3377('0x26')](function(){_0x5c52bf[_0x3377('0x1b')](0xcc)[_0x3377('0x1c')]();});}};}function handleEntityNotFound(_0x4ca077,_0x1200b3){return function(_0x21ca05){if(!_0x21ca05){_0x4ca077[_0x3377('0x1a')](0x194);}return _0x21ca05;};}function handleError(_0x45ff68,_0x555318){_0x555318=_0x555318||0x1f4;return function(_0x608545){logger['error'](_0x608545[_0x3377('0x29')]);if(_0x608545['name']){delete _0x608545[_0x3377('0x2a')];}_0x45ff68[_0x3377('0x1b')](_0x555318)['send'](_0x608545);};}exports[_0x3377('0x2b')]=function(_0x5039e2,_0x55e52e){var _0x543670={},_0x4c15de={},_0x3fcdc4={'count':0x0,'rows':[]};var _0x3d6c28=_[_0x3377('0x2c')](db[_0x3377('0x2d')][_0x3377('0x2e')],function(_0x43a135){return{'name':_0x43a135['fieldName'],'type':_0x43a135[_0x3377('0x2f')][_0x3377('0x30')]};});_0x4c15de['model']=_[_0x3377('0x2c')](_0x3d6c28,_0x3377('0x2a'));_0x4c15de[_0x3377('0x31')]=_[_0x3377('0x32')](_0x5039e2[_0x3377('0x31')]);_0x4c15de[_0x3377('0x33')]=_[_0x3377('0x34')](_0x4c15de[_0x3377('0x35')],_0x4c15de['query']);_0x543670[_0x3377('0x36')]=_['intersection'](_0x4c15de[_0x3377('0x35')],qs[_0x3377('0x37')](_0x5039e2[_0x3377('0x31')]['fields']));_0x543670[_0x3377('0x36')]=_0x543670[_0x3377('0x36')][_0x3377('0x38')]?_0x543670[_0x3377('0x36')]:_0x4c15de[_0x3377('0x35')];if(!_0x5039e2[_0x3377('0x31')][_0x3377('0x39')](_0x3377('0x3a'))){_0x543670[_0x3377('0x20')]=qs[_0x3377('0x20')](_0x5039e2[_0x3377('0x31')][_0x3377('0x20')]);_0x543670['offset']=qs['offset'](_0x5039e2[_0x3377('0x31')][_0x3377('0x1e')]);}_0x543670[_0x3377('0x3b')]=qs[_0x3377('0x3c')](_0x5039e2[_0x3377('0x31')][_0x3377('0x3c')]);_0x543670[_0x3377('0x3d')]=qs[_0x3377('0x33')](_[_0x3377('0x3e')](_0x5039e2[_0x3377('0x31')],_0x4c15de[_0x3377('0x33')]),_0x3d6c28);if(_0x5039e2['query'][_0x3377('0x3f')]){_0x543670[_0x3377('0x3d')]=_[_0x3377('0x40')](_0x543670[_0x3377('0x3d')],{'$or':_[_0x3377('0x2c')](_0x3d6c28,function(_0x2aa94a){if(_0x2aa94a[_0x3377('0x2f')]!==_0x3377('0x41')){var _0x4229af={};_0x4229af[_0x2aa94a[_0x3377('0x2a')]]={'$like':'%'+_0x5039e2[_0x3377('0x31')][_0x3377('0x3f')]+'%'};return _0x4229af;}})});}_0x543670=_['merge']({},_0x543670,_0x5039e2[_0x3377('0x42')]);var _0x39c762={'where':_0x543670['where']};return db[_0x3377('0x2d')][_0x3377('0x21')](_0x39c762)['then'](function(_0x438401){_0x3fcdc4[_0x3377('0x21')]=_0x438401;if(_0x5039e2[_0x3377('0x31')]['includeAll']){_0x543670['include']=[{'all':!![]}];}return db['Trigger'][_0x3377('0x43')](_0x543670);})[_0x3377('0x26')](function(_0x1951de){_0x3fcdc4[_0x3377('0x44')]=_0x1951de;return _0x3fcdc4;})[_0x3377('0x26')](respondWithFilteredResult(_0x55e52e,_0x543670))[_0x3377('0x45')](handleError(_0x55e52e,null));};exports['show']=function(_0x2df2e2,_0x45254e){var _0x1ee863={'raw':![],'where':{'id':_0x2df2e2[_0x3377('0x46')]['id']}},_0x21b77a={};_0x21b77a[_0x3377('0x35')]=_[_0x3377('0x32')](db[_0x3377('0x2d')][_0x3377('0x2e')]);_0x21b77a[_0x3377('0x31')]=_[_0x3377('0x32')](_0x2df2e2[_0x3377('0x31')]);_0x21b77a['filters']=_[_0x3377('0x34')](_0x21b77a['model'],_0x21b77a[_0x3377('0x31')]);_0x1ee863[_0x3377('0x36')]=_[_0x3377('0x34')](_0x21b77a[_0x3377('0x35')],qs[_0x3377('0x37')](_0x2df2e2[_0x3377('0x31')][_0x3377('0x37')]));_0x1ee863[_0x3377('0x36')]=_0x1ee863[_0x3377('0x36')]['length']?_0x1ee863[_0x3377('0x36')]:_0x21b77a[_0x3377('0x35')];if(_0x2df2e2[_0x3377('0x31')][_0x3377('0x47')]){_0x1ee863['include']=[{'all':!![]}];}_0x1ee863=_[_0x3377('0x40')]({},_0x1ee863,_0x2df2e2[_0x3377('0x42')]);return db['Trigger'][_0x3377('0x48')](_0x1ee863)[_0x3377('0x26')](handleEntityNotFound(_0x45254e,null))['then'](respondWithResult(_0x45254e,null))[_0x3377('0x45')](handleError(_0x45254e,null));};exports[_0x3377('0x49')]=function(_0x3b4f0a,_0x28dc45){return db[_0x3377('0x2d')][_0x3377('0x49')](_0x3b4f0a[_0x3377('0x4a')],{})[_0x3377('0x26')](function(_0x5964d3){var _0x460d46=_0x3b4f0a['user']['get']({'plain':!![]});if(!_0x460d46)throw new Error(_0x3377('0x4b'));if(_0x460d46[_0x3377('0x4c')]===_0x3377('0x4d')){var _0x43ccc4=_0x5964d3[_0x3377('0x4e')]({'plain':!![]});var _0x10b639=_0x3377('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x10b639,'userProfileId':_0x460d46[_0x3377('0x50')]},'raw':!![]})[_0x3377('0x26')](function(_0x164b0e){if(_0x164b0e&&_0x164b0e[_0x3377('0x51')]===0x0){return db[_0x3377('0x28')][_0x3377('0x49')]({'name':_0x43ccc4[_0x3377('0x2a')],'resourceId':_0x43ccc4['id'],'type':_0x164b0e[_0x3377('0x2a')],'sectionId':_0x164b0e['id']},{})[_0x3377('0x26')](function(){return _0x5964d3;});}else{return _0x5964d3;}})[_0x3377('0x45')](function(_0x339ef6){logger[_0x3377('0x52')](_0x3377('0x53'),_0x339ef6);throw _0x339ef6;});}return _0x5964d3;})[_0x3377('0x26')](respondWithResult(_0x28dc45,0xc9))[_0x3377('0x45')](handleError(_0x28dc45,null));};exports[_0x3377('0x25')]=function(_0x4d35dc,_0x2d0ddd){if(_0x4d35dc[_0x3377('0x4a')]['id']){delete _0x4d35dc['body']['id'];}return db[_0x3377('0x2d')][_0x3377('0x48')]({'where':{'id':_0x4d35dc[_0x3377('0x46')]['id']}})[_0x3377('0x26')](handleEntityNotFound(_0x2d0ddd,null))['then'](saveUpdates(_0x4d35dc[_0x3377('0x4a')],null))['then'](respondWithResult(_0x2d0ddd,null))['catch'](handleError(_0x2d0ddd,null));};exports[_0x3377('0x27')]=function(_0x9b8f36,_0x4bd025){return db[_0x3377('0x2d')][_0x3377('0x48')]({'where':{'id':_0x9b8f36[_0x3377('0x46')]['id']}})[_0x3377('0x26')](handleEntityNotFound(_0x4bd025,null))['then'](removeEntity(_0x4bd025,null))[_0x3377('0x45')](handleError(_0x4bd025,null));};exports[_0x3377('0x54')]=function(_0x420484,_0x2a13bd,_0x52b0f0){if(_0x420484[_0x3377('0x4a')]['id']){delete _0x420484['body']['id'];}return db['Trigger'][_0x3377('0x48')]({'where':{'id':_0x420484[_0x3377('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a13bd,null))[_0x3377('0x26')](function(_0x103faf){if(_0x103faf){_0x420484[_0x3377('0x4a')][_0x3377('0x55')]=_0x103faf['id'];return db[_0x3377('0x56')][_0x3377('0x49')](_0x420484['body']);}})[_0x3377('0x26')](respondWithResult(_0x2a13bd,null))[_0x3377('0x45')](handleError(_0x2a13bd,null));};exports[_0x3377('0x57')]=function(_0x39d2bf,_0x169453,_0x3d67d4){if(_0x39d2bf['body']['id']){delete _0x39d2bf[_0x3377('0x4a')]['id'];}return db[_0x3377('0x2d')]['find']({'where':{'id':_0x39d2bf[_0x3377('0x46')]['id']}})['then'](handleEntityNotFound(_0x169453,null))[_0x3377('0x26')](function(_0xf8500){if(_0xf8500){_0x39d2bf[_0x3377('0x4a')][_0x3377('0x58')]=_0xf8500['id'];return db[_0x3377('0x56')][_0x3377('0x49')](_0x39d2bf[_0x3377('0x4a')]);}})['then'](respondWithResult(_0x169453,null))[_0x3377('0x45')](handleError(_0x169453,null));};exports[_0x3377('0x59')]=function(_0x319f47,_0x454dff,_0x2448c1){var _0xd64bf3={};var _0x5e9920={};var _0x40a67d;var _0x348b03;return db[_0x3377('0x2d')][_0x3377('0x5a')]({'where':{'id':_0x319f47[_0x3377('0x46')]['id']}})[_0x3377('0x26')](handleEntityNotFound(_0x454dff,null))[_0x3377('0x26')](function(_0x307c67){if(_0x307c67){_0x40a67d=_0x307c67;_0x5e9920[_0x3377('0x35')]=_[_0x3377('0x32')](db['Condition'][_0x3377('0x2e')]);_0x5e9920['query']=_[_0x3377('0x32')](_0x319f47[_0x3377('0x31')]);_0x5e9920[_0x3377('0x33')]=_[_0x3377('0x34')](_0x5e9920[_0x3377('0x35')],_0x5e9920[_0x3377('0x31')]);_0xd64bf3[_0x3377('0x36')]=_[_0x3377('0x34')](_0x5e9920[_0x3377('0x35')],qs[_0x3377('0x37')](_0x319f47[_0x3377('0x31')]['fields']));_0xd64bf3[_0x3377('0x36')]=_0xd64bf3[_0x3377('0x36')][_0x3377('0x38')]?_0xd64bf3[_0x3377('0x36')]:_0x5e9920[_0x3377('0x35')];_0xd64bf3[_0x3377('0x3b')]=qs[_0x3377('0x3c')](_0x319f47[_0x3377('0x31')][_0x3377('0x3c')]);_0xd64bf3['where']=qs['filters'](_[_0x3377('0x3e')](_0x319f47[_0x3377('0x31')],_0x5e9920[_0x3377('0x33')]));if(_0x319f47['query'][_0x3377('0x3f')]){_0xd64bf3[_0x3377('0x3d')]=_[_0x3377('0x40')](_0xd64bf3[_0x3377('0x3d')],{'$or':_[_0x3377('0x2c')](_0xd64bf3[_0x3377('0x36')],function(_0x272422){var _0x2248ba={};_0x2248ba[_0x272422]={'$like':'%'+_0x319f47[_0x3377('0x31')][_0x3377('0x3f')]+'%'};return _0x2248ba;})});}_0xd64bf3=_[_0x3377('0x40')]({},_0xd64bf3,_0x319f47[_0x3377('0x42')]);return _0x40a67d[_0x3377('0x59')](_0xd64bf3);}})[_0x3377('0x26')](function(_0x2a84d6){if(_0x2a84d6){_0x348b03=_0x2a84d6[_0x3377('0x38')];if(!_0x319f47[_0x3377('0x31')][_0x3377('0x39')]('nolimit')){_0xd64bf3['limit']=qs[_0x3377('0x20')](_0x319f47[_0x3377('0x31')][_0x3377('0x20')]);_0xd64bf3['offset']=qs[_0x3377('0x1e')](_0x319f47[_0x3377('0x31')][_0x3377('0x1e')]);}return _0x40a67d[_0x3377('0x59')](_0xd64bf3);}})[_0x3377('0x26')](function(_0x499ad8){if(_0x499ad8){return _0x499ad8?{'count':_0x348b03,'rows':_0x499ad8}:null;}})[_0x3377('0x26')](respondWithResult(_0x454dff,null))[_0x3377('0x45')](handleError(_0x454dff,null));};exports[_0x3377('0x5b')]=function(_0x3ddd22,_0xe0023f,_0x57ed20){var _0x127bed={};var _0x371293={};var _0x819433;var _0x487f0a;return db[_0x3377('0x2d')][_0x3377('0x5a')]({'where':{'id':_0x3ddd22[_0x3377('0x46')]['id']}})[_0x3377('0x26')](handleEntityNotFound(_0xe0023f,null))[_0x3377('0x26')](function(_0x22a49b){if(_0x22a49b){_0x819433=_0x22a49b;_0x371293[_0x3377('0x35')]=_[_0x3377('0x32')](db[_0x3377('0x56')]['rawAttributes']);_0x371293['query']=_[_0x3377('0x32')](_0x3ddd22['query']);_0x371293[_0x3377('0x33')]=_['intersection'](_0x371293[_0x3377('0x35')],_0x371293[_0x3377('0x31')]);_0x127bed[_0x3377('0x36')]=_[_0x3377('0x34')](_0x371293['model'],qs[_0x3377('0x37')](_0x3ddd22[_0x3377('0x31')][_0x3377('0x37')]));_0x127bed[_0x3377('0x36')]=_0x127bed['attributes'][_0x3377('0x38')]?_0x127bed[_0x3377('0x36')]:_0x371293['model'];_0x127bed[_0x3377('0x3b')]=qs[_0x3377('0x3c')](_0x3ddd22[_0x3377('0x31')][_0x3377('0x3c')]);_0x127bed['where']=qs['filters'](_['pick'](_0x3ddd22['query'],_0x371293[_0x3377('0x33')]));if(_0x3ddd22[_0x3377('0x31')]['filter']){_0x127bed[_0x3377('0x3d')]=_['merge'](_0x127bed[_0x3377('0x3d')],{'$or':_[_0x3377('0x2c')](_0x127bed[_0x3377('0x36')],function(_0x873903){var _0x1a2fc4={};_0x1a2fc4[_0x873903]={'$like':'%'+_0x3ddd22[_0x3377('0x31')][_0x3377('0x3f')]+'%'};return _0x1a2fc4;})});}_0x127bed=_[_0x3377('0x40')]({},_0x127bed,_0x3ddd22['options']);return _0x819433['getAnyConditions'](_0x127bed);}})[_0x3377('0x26')](function(_0x1c4aa7){if(_0x1c4aa7){_0x487f0a=_0x1c4aa7[_0x3377('0x38')];if(!_0x3ddd22[_0x3377('0x31')][_0x3377('0x39')]('nolimit')){_0x127bed[_0x3377('0x20')]=qs['limit'](_0x3ddd22[_0x3377('0x31')][_0x3377('0x20')]);_0x127bed[_0x3377('0x1e')]=qs[_0x3377('0x1e')](_0x3ddd22[_0x3377('0x31')][_0x3377('0x1e')]);}return _0x819433['getAnyConditions'](_0x127bed);}})['then'](function(_0x4f431d){if(_0x4f431d){return _0x4f431d?{'count':_0x487f0a,'rows':_0x4f431d}:null;}})['then'](respondWithResult(_0xe0023f,null))[_0x3377('0x45')](handleError(_0xe0023f,null));};exports['addAction']=function(_0x3f8ea9,_0x18b477,_0x305b02){if(_0x3f8ea9['body']['id']){delete _0x3f8ea9['body']['id'];}return db[_0x3377('0x2d')][_0x3377('0x48')]({'where':{'id':_0x3f8ea9[_0x3377('0x46')]['id']}})[_0x3377('0x26')](handleEntityNotFound(_0x18b477,null))[_0x3377('0x26')](function(_0x268540){if(_0x268540){_0x3f8ea9['body'][_0x3377('0x5c')]=_0x268540['id'];return db['Action'][_0x3377('0x49')](_0x3f8ea9[_0x3377('0x4a')]);}})[_0x3377('0x26')](respondWithResult(_0x18b477,null))['catch'](handleError(_0x18b477,null));};exports[_0x3377('0x5d')]=function(_0x10b2cf,_0x267cd6,_0x2d9d33){var _0x5ba13c={};var _0x19fb43={};var _0x1c48bf;var _0x87c8a4;return db['Trigger'][_0x3377('0x5a')]({'where':{'id':_0x10b2cf[_0x3377('0x46')]['id']}})[_0x3377('0x26')](handleEntityNotFound(_0x267cd6,null))[_0x3377('0x26')](function(_0x1ea4fa){if(_0x1ea4fa){_0x1c48bf=_0x1ea4fa;_0x19fb43[_0x3377('0x35')]=_['keys'](db[_0x3377('0x5e')]['rawAttributes']);_0x19fb43[_0x3377('0x31')]=_[_0x3377('0x32')](_0x10b2cf[_0x3377('0x31')]);_0x19fb43[_0x3377('0x33')]=_[_0x3377('0x34')](_0x19fb43[_0x3377('0x35')],_0x19fb43['query']);_0x5ba13c['attributes']=_[_0x3377('0x34')](_0x19fb43[_0x3377('0x35')],qs[_0x3377('0x37')](_0x10b2cf[_0x3377('0x31')][_0x3377('0x37')]));_0x5ba13c[_0x3377('0x36')]=_0x5ba13c[_0x3377('0x36')]['length']?_0x5ba13c['attributes']:_0x19fb43['model'];_0x5ba13c[_0x3377('0x3b')]=qs[_0x3377('0x3c')](_0x10b2cf[_0x3377('0x31')][_0x3377('0x3c')]);_0x5ba13c[_0x3377('0x3d')]=qs[_0x3377('0x33')](_[_0x3377('0x3e')](_0x10b2cf[_0x3377('0x31')],_0x19fb43['filters']));if(_0x10b2cf[_0x3377('0x31')][_0x3377('0x3f')]){_0x5ba13c[_0x3377('0x3d')]=_[_0x3377('0x40')](_0x5ba13c['where'],{'$or':_[_0x3377('0x2c')](_0x5ba13c[_0x3377('0x36')],function(_0x459b60){var _0x54c899={};_0x54c899[_0x459b60]={'$like':'%'+_0x10b2cf[_0x3377('0x31')][_0x3377('0x3f')]+'%'};return _0x54c899;})});}_0x5ba13c=_[_0x3377('0x40')]({},_0x5ba13c,_0x10b2cf[_0x3377('0x42')]);return _0x1c48bf[_0x3377('0x5d')](_0x5ba13c);}})[_0x3377('0x26')](function(_0x2287d4){if(_0x2287d4){_0x87c8a4=_0x2287d4[_0x3377('0x38')];if(!_0x10b2cf[_0x3377('0x31')][_0x3377('0x39')](_0x3377('0x3a'))){_0x5ba13c[_0x3377('0x20')]=qs[_0x3377('0x20')](_0x10b2cf['query'][_0x3377('0x20')]);_0x5ba13c[_0x3377('0x1e')]=qs[_0x3377('0x1e')](_0x10b2cf[_0x3377('0x31')]['offset']);}return _0x1c48bf['getActions'](_0x5ba13c);}})['then'](function(_0x3eb8e2){if(_0x3eb8e2){return _0x3eb8e2?{'count':_0x87c8a4,'rows':_0x3eb8e2}:null;}})[_0x3377('0x26')](respondWithResult(_0x267cd6,null))[_0x3377('0x45')](handleError(_0x267cd6,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index fad89a9..dc03737 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 _0x40b5=['bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment'];(function(_0x549219,_0x27cfe4){var _0x374e2b=function(_0x30ba9b){while(--_0x30ba9b){_0x549219['push'](_0x549219['shift']());}};_0x374e2b(++_0x27cfe4);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var util=require(_0x540b('0x1'));var logger=require(_0x540b('0x2'))(_0x540b('0x3'));var moment=require(_0x540b('0x4'));var BPromise=require(_0x540b('0x5'));var rp=require(_0x540b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x540b('0x7'));var config=require(_0x540b('0x8'));var attributes=require(_0x540b('0x9'));module[_0x540b('0xa')]=function(_0x5b75dc,_0x4e0a29){return _0x5b75dc[_0x540b('0xb')](_0x540b('0xc'),attributes,{'tableName':_0x540b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Trigger','tools_triggers','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6aa7,0x178));var _0x76aa=function(_0x879b5b,_0x50915f){_0x879b5b=_0x879b5b-0x0;var _0x42843b=_0x6aa7[_0x879b5b];return _0x42843b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 54e1046..1a2ed00 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 _0x80a4=['catch','find','ShowTrigger','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','Trigger,\x20%s,\x20%s','debug','error','info','result','message','GetTrigger','Trigger','options','where','attributes','limit','include','model','map'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x80a4,0xdd));var _0x480a=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x80a4[_0x4bfade];return _0x272465;};'use strict';var _=require(_0x480a('0x0'));var util=require(_0x480a('0x1'));var moment=require('moment');var BPromise=require(_0x480a('0x2'));var rs=require(_0x480a('0x3'));var fs=require('fs');var Redis=require(_0x480a('0x4'));var db=require(_0x480a('0x5'))['db'];var utils=require(_0x480a('0x6'));var logger=require(_0x480a('0x7'))(_0x480a('0x8'));var config=require(_0x480a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x480a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d48b,_0x1f59d2,_0x471e9e){return new BPromise(function(_0x351d1f,_0x3efcce){return client['request'](_0x54d48b,_0x471e9e)[_0x480a('0xb')](function(_0x384f45){logger['info'](_0x480a('0xc'),_0x1f59d2,'request\x20sent');logger[_0x480a('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x1f59d2,'request\x20sent',JSON['stringify'](_0x384f45));if(_0x384f45[_0x480a('0xe')]){if(_0x384f45[_0x480a('0xe')]['code']===0x1f4){logger[_0x480a('0xe')]('Trigger,\x20%s,\x20%s',_0x1f59d2,_0x384f45[_0x480a('0xe')]['message']);return _0x3efcce(_0x384f45['error']['message']);}logger[_0x480a('0xe')](_0x480a('0xc'),_0x1f59d2,_0x384f45[_0x480a('0xe')]['message']);return _0x351d1f(_0x384f45['error']['message']);}else{logger[_0x480a('0xf')](_0x480a('0xc'),_0x1f59d2,'request\x20sent');_0x351d1f(_0x384f45[_0x480a('0x10')][_0x480a('0x11')]);}})['catch'](function(_0x2de2b0){logger[_0x480a('0xe')](_0x480a('0xc'),_0x1f59d2,_0x2de2b0);_0x3efcce(_0x2de2b0);});});}exports[_0x480a('0x12')]=function(_0x239c69){var _0x43ccdd=this;return new Promise(function(_0x57f058,_0x10cf42){return db[_0x480a('0x13')]['findAll']({'raw':_0x239c69['options']?_0x239c69[_0x480a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x239c69[_0x480a('0x14')]?_0x239c69[_0x480a('0x14')][_0x480a('0x15')]||null:null,'attributes':_0x239c69[_0x480a('0x14')]?_0x239c69[_0x480a('0x14')][_0x480a('0x16')]||null:null,'limit':_0x239c69[_0x480a('0x14')]?_0x239c69[_0x480a('0x14')][_0x480a('0x17')]||null:null,'include':_0x239c69[_0x480a('0x14')]?_0x239c69['options'][_0x480a('0x18')]?_['map'](_0x239c69[_0x480a('0x14')]['include'],function(_0x117d44){return{'model':db[_0x117d44[_0x480a('0x19')]],'as':_0x117d44['as'],'attributes':_0x117d44[_0x480a('0x16')],'include':_0x117d44['include']?_['map'](_0x117d44[_0x480a('0x18')],function(_0x159b5e){return{'model':db[_0x159b5e[_0x480a('0x19')]],'as':_0x159b5e['as'],'attributes':_0x159b5e['attributes'],'include':_0x159b5e[_0x480a('0x18')]?_[_0x480a('0x1a')](_0x159b5e[_0x480a('0x18')],function(_0x24b541){return{'model':db[_0x24b541[_0x480a('0x19')]],'as':_0x24b541['as'],'attributes':_0x24b541[_0x480a('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ba148){logger['info'](_0x480a('0x12'),_0x239c69);logger[_0x480a('0xd')](_0x480a('0x12'),_0x239c69,JSON['stringify'](_0x5ba148));_0x57f058(_0x5ba148);})[_0x480a('0x1b')](function(_0x466fdb){logger[_0x480a('0xe')](_0x480a('0x12'),_0x466fdb[_0x480a('0x11')],_0x239c69);_0x10cf42(_0x43ccdd[_0x480a('0xe')](0x1f4,_0x466fdb['message']));});});};exports['ShowTrigger']=function(_0x371738){var _0x4a851b=this;return new Promise(function(_0x3f53d6,_0x4dbfe2){return db[_0x480a('0x13')][_0x480a('0x1c')]({'raw':_0x371738['options']?_0x371738[_0x480a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x371738[_0x480a('0x14')]?_0x371738[_0x480a('0x14')]['where']||null:null,'attributes':_0x371738['options']?_0x371738['options'][_0x480a('0x16')]||null:null,'include':_0x371738['options']?_0x371738[_0x480a('0x14')][_0x480a('0x18')]?_[_0x480a('0x1a')](_0x371738['options'][_0x480a('0x18')],function(_0x505a8d){return{'model':db[_0x505a8d[_0x480a('0x19')]],'as':_0x505a8d['as'],'attributes':_0x505a8d[_0x480a('0x16')],'include':_0x505a8d[_0x480a('0x18')]?_[_0x480a('0x1a')](_0x505a8d[_0x480a('0x18')],function(_0x5c78a7){return{'model':db[_0x5c78a7[_0x480a('0x19')]],'as':_0x5c78a7['as'],'attributes':_0x5c78a7[_0x480a('0x16')],'include':_0x5c78a7[_0x480a('0x18')]?_[_0x480a('0x1a')](_0x5c78a7[_0x480a('0x18')],function(_0x27f268){return{'model':db[_0x27f268[_0x480a('0x19')]],'as':_0x27f268['as'],'attributes':_0x27f268[_0x480a('0x16')]};}):[]};}):[]};}):[]:[]})[_0x480a('0xb')](function(_0x1c1356){logger[_0x480a('0xf')](_0x480a('0x1d'),_0x371738);logger[_0x480a('0xd')](_0x480a('0x1d'),_0x371738,JSON[_0x480a('0x1e')](_0x1c1356));_0x3f53d6(_0x1c1356);})[_0x480a('0x1b')](function(_0x394f69){logger[_0x480a('0xe')](_0x480a('0x1d'),_0x394f69[_0x480a('0x11')],_0x371738);_0x4dbfe2(_0x4a851b['error'](0x1f4,_0x394f69[_0x480a('0x11')]));});});}; \ No newline at end of file +var _0x804d=['debug','stringify','error','code','message','catch','Trigger','findAll','options','raw','where','attributes','limit','model','map','include','GetTrigger','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0xbec8c8,_0x2e5064){var _0x16c5e3=function(_0x25385f){while(--_0x25385f){_0xbec8c8['push'](_0xbec8c8['shift']());}};_0x16c5e3(++_0x2e5064);}(_0x804d,0x116));var _0xd804=function(_0x8eb9d,_0x320ee6){_0x8eb9d=_0x8eb9d-0x0;var _0x28c28=_0x804d[_0x8eb9d];return _0x28c28;};'use strict';var _=require(_0xd804('0x0'));var util=require(_0xd804('0x1'));var moment=require(_0xd804('0x2'));var BPromise=require(_0xd804('0x3'));var rs=require(_0xd804('0x4'));var fs=require('fs');var Redis=require(_0xd804('0x5'));var db=require(_0xd804('0x6'))['db'];var utils=require(_0xd804('0x7'));var logger=require('../../config/logger')(_0xd804('0x8'));var config=require(_0xd804('0x9'));var jayson=require(_0xd804('0xa'));var client=jayson[_0xd804('0xb')][_0xd804('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf52871,_0x465695,_0x391e2b){return new BPromise(function(_0x2c3ae6,_0x2ff6a4){return client[_0xd804('0xd')](_0xf52871,_0x391e2b)[_0xd804('0xe')](function(_0x4d12bd){logger[_0xd804('0xf')](_0xd804('0x10'),_0x465695,_0xd804('0x11'));logger[_0xd804('0x12')]('Trigger,\x20%s,\x20%s,\x20%s',_0x465695,'request\x20sent',JSON[_0xd804('0x13')](_0x4d12bd));if(_0x4d12bd[_0xd804('0x14')]){if(_0x4d12bd['error'][_0xd804('0x15')]===0x1f4){logger[_0xd804('0x14')]('Trigger,\x20%s,\x20%s',_0x465695,_0x4d12bd[_0xd804('0x14')][_0xd804('0x16')]);return _0x2ff6a4(_0x4d12bd[_0xd804('0x14')]['message']);}logger['error'](_0xd804('0x10'),_0x465695,_0x4d12bd[_0xd804('0x14')][_0xd804('0x16')]);return _0x2c3ae6(_0x4d12bd[_0xd804('0x14')][_0xd804('0x16')]);}else{logger['info'](_0xd804('0x10'),_0x465695,_0xd804('0x11'));_0x2c3ae6(_0x4d12bd['result'][_0xd804('0x16')]);}})[_0xd804('0x17')](function(_0x147b3e){logger['error'](_0xd804('0x10'),_0x465695,_0x147b3e);_0x2ff6a4(_0x147b3e);});});}exports['GetTrigger']=function(_0x421ddb){var _0x2a5170=this;return new Promise(function(_0x13fa46,_0x5264c1){return db[_0xd804('0x18')][_0xd804('0x19')]({'raw':_0x421ddb[_0xd804('0x1a')]?_0x421ddb[_0xd804('0x1a')][_0xd804('0x1b')]===undefined?!![]:![]:!![],'where':_0x421ddb['options']?_0x421ddb['options'][_0xd804('0x1c')]||null:null,'attributes':_0x421ddb['options']?_0x421ddb[_0xd804('0x1a')][_0xd804('0x1d')]||null:null,'limit':_0x421ddb[_0xd804('0x1a')]?_0x421ddb['options'][_0xd804('0x1e')]||null:null,'include':_0x421ddb['options']?_0x421ddb[_0xd804('0x1a')]['include']?_['map'](_0x421ddb['options']['include'],function(_0x2cde57){return{'model':db[_0x2cde57[_0xd804('0x1f')]],'as':_0x2cde57['as'],'attributes':_0x2cde57[_0xd804('0x1d')],'include':_0x2cde57['include']?_[_0xd804('0x20')](_0x2cde57[_0xd804('0x21')],function(_0x2a2502){return{'model':db[_0x2a2502[_0xd804('0x1f')]],'as':_0x2a2502['as'],'attributes':_0x2a2502['attributes'],'include':_0x2a2502[_0xd804('0x21')]?_[_0xd804('0x20')](_0x2a2502['include'],function(_0x38a6f6){return{'model':db[_0x38a6f6[_0xd804('0x1f')]],'as':_0x38a6f6['as'],'attributes':_0x38a6f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b040a){logger[_0xd804('0xf')](_0xd804('0x22'),_0x421ddb);logger[_0xd804('0x12')]('GetTrigger',_0x421ddb,JSON[_0xd804('0x13')](_0x4b040a));_0x13fa46(_0x4b040a);})[_0xd804('0x17')](function(_0x1858f0){logger[_0xd804('0x14')](_0xd804('0x22'),_0x1858f0[_0xd804('0x16')],_0x421ddb);_0x5264c1(_0x2a5170[_0xd804('0x14')](0x1f4,_0x1858f0[_0xd804('0x16')]));});});};exports['ShowTrigger']=function(_0x173830){var _0x251e5e=this;return new Promise(function(_0x36a5ac,_0x1744fd){return db[_0xd804('0x18')][_0xd804('0x23')]({'raw':_0x173830[_0xd804('0x1a')]?_0x173830[_0xd804('0x1a')][_0xd804('0x1b')]===undefined?!![]:![]:!![],'where':_0x173830[_0xd804('0x1a')]?_0x173830['options']['where']||null:null,'attributes':_0x173830[_0xd804('0x1a')]?_0x173830[_0xd804('0x1a')]['attributes']||null:null,'include':_0x173830['options']?_0x173830[_0xd804('0x1a')]['include']?_['map'](_0x173830[_0xd804('0x1a')][_0xd804('0x21')],function(_0x19eb4e){return{'model':db[_0x19eb4e[_0xd804('0x1f')]],'as':_0x19eb4e['as'],'attributes':_0x19eb4e[_0xd804('0x1d')],'include':_0x19eb4e[_0xd804('0x21')]?_[_0xd804('0x20')](_0x19eb4e[_0xd804('0x21')],function(_0x5821e9){return{'model':db[_0x5821e9[_0xd804('0x1f')]],'as':_0x5821e9['as'],'attributes':_0x5821e9['attributes'],'include':_0x5821e9[_0xd804('0x21')]?_[_0xd804('0x20')](_0x5821e9[_0xd804('0x21')],function(_0x1c667f){return{'model':db[_0x1c667f[_0xd804('0x1f')]],'as':_0x1c667f['as'],'attributes':_0x1c667f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dc7fc){logger[_0xd804('0xf')]('ShowTrigger',_0x173830);logger[_0xd804('0x12')](_0xd804('0x24'),_0x173830,JSON[_0xd804('0x13')](_0x4dc7fc));_0x36a5ac(_0x4dc7fc);})[_0xd804('0x17')](function(_0x369880){logger['error']('ShowTrigger',_0x369880[_0xd804('0x16')],_0x173830);_0x1744fd(_0x251e5e[_0xd804('0x14')](0x1f4,_0x369880[_0xd804('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3039dc8..f654f51 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 _0x119b=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','clone','create','put','update','destroy','exports'];(function(_0x1b7516,_0x2fbe81){var _0x14983b=function(_0x435b5f){while(--_0x435b5f){_0x1b7516['push'](_0x1b7516['shift']());}};_0x14983b(++_0x2fbe81);}(_0x119b,0x1cc));var _0xb119=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x119b[_0x462999];return _0x4b1366;};'use strict';var multer=require('multer');var util=require(_0xb119('0x0'));var path=require(_0xb119('0x1'));var timeout=require(_0xb119('0x2'));var express=require(_0xb119('0x3'));var router=express['Router']();var fs_extra=require(_0xb119('0x4'));var auth=require(_0xb119('0x5'));var interaction=require(_0xb119('0x6'));var config=require(_0xb119('0x7'));var controller=require('./trunk.controller');router[_0xb119('0x8')]('/',auth['isAuthenticated'](),controller[_0xb119('0x9')]);router[_0xb119('0x8')](_0xb119('0xa'),auth[_0xb119('0xb')](),controller[_0xb119('0xc')]);router[_0xb119('0xd')]('/:id/clone',auth[_0xb119('0xb')](),controller[_0xb119('0xe')]);router[_0xb119('0xd')]('/',auth[_0xb119('0xb')](),controller[_0xb119('0xf')]);router[_0xb119('0x10')](_0xb119('0xa'),auth[_0xb119('0xb')](),controller[_0xb119('0x11')]);router['delete']('/:id',auth[_0xb119('0xb')](),controller[_0xb119('0x12')]);module[_0xb119('0x13')]=router; \ No newline at end of file +var _0x17a0=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','update'];(function(_0x1381a9,_0x1034cd){var _0x20e400=function(_0x44df1e){while(--_0x44df1e){_0x1381a9['push'](_0x1381a9['shift']());}};_0x20e400(++_0x1034cd);}(_0x17a0,0xe4));var _0x017a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x17a0[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x017a('0x0'));var util=require(_0x017a('0x1'));var path=require(_0x017a('0x2'));var timeout=require(_0x017a('0x3'));var express=require(_0x017a('0x4'));var router=express[_0x017a('0x5')]();var fs_extra=require(_0x017a('0x6'));var auth=require(_0x017a('0x7'));var interaction=require(_0x017a('0x8'));var config=require(_0x017a('0x9'));var controller=require(_0x017a('0xa'));router[_0x017a('0xb')]('/',auth['isAuthenticated'](),controller[_0x017a('0xc')]);router[_0x017a('0xb')](_0x017a('0xd'),auth[_0x017a('0xe')](),controller[_0x017a('0xf')]);router[_0x017a('0x10')](_0x017a('0x11'),auth[_0x017a('0xe')](),controller[_0x017a('0x12')]);router[_0x017a('0x10')]('/',auth[_0x017a('0xe')](),controller[_0x017a('0x13')]);router[_0x017a('0x14')](_0x017a('0xd'),auth[_0x017a('0xe')](),controller[_0x017a('0x15')]);router[_0x017a('0x16')](_0x017a('0xd'),auth['isAuthenticated'](),controller[_0x017a('0x17')]);module[_0x017a('0x18')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9276e63..1a79b54 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 _0xc8b2=['transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','force_rport,comedia','setDataValue','join','getDataValue','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','dynamic','update','update,nonat','sequelize','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x2cb221,_0x253100){var _0x1f2bc7=function(_0x517788){while(--_0x517788){_0x2cb221['push'](_0x2cb221['shift']());}};_0x1f2bc7(++_0x253100);}(_0xc8b2,0x172));var _0x2c8b=function(_0x19e227,_0x42fca0){_0x19e227=_0x19e227-0x0;var _0x5d0a29=_0xc8b2[_0x19e227];return _0x5d0a29;};'use strict';var Sequelize=require(_0x2c8b('0x0'));module[_0x2c8b('0x1')]={'name':{'type':Sequelize[_0x2c8b('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x4'),_0x2c8b('0x5'),_0x2c8b('0x6')),'allowNull':![],'defaultValue':_0x2c8b('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2c8b('0x7')},'callingpres':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x8'),_0x2c8b('0x9'),_0x2c8b('0xa'),_0x2c8b('0xb'),'PROHIB_NOT_SCREENED',_0x2c8b('0xc'),_0x2c8b('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x2c8b('0x2')]},'permit':{'type':Sequelize[_0x2c8b('0x2')]},'secret':{'type':Sequelize[_0x2c8b('0x2')]},'md5secret':{'type':Sequelize[_0x2c8b('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2c8b('0x2')],'defaultValue':'udp','set':function(_0x2be22d){this['setDataValue']('transport',_0x2be22d?_0x2be22d['join'](','):null);},'get':function(){return this['getDataValue'](_0x2c8b('0xe'))?this['getDataValue'](_0x2c8b('0xe'))[_0x2c8b('0xf')](','):null;},'comment':_0x2c8b('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0x2c8b('0x11'),_0x2c8b('0x12'),_0x2c8b('0x13'),_0x2c8b('0x14'),_0x2c8b('0x15')),'defaultValue':_0x2c8b('0x11')},'directmedia':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no','nonat','update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2c8b('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2c8b('0x2')]},'directmediadeny':{'type':Sequelize[_0x2c8b('0x2')]},'nat':{'type':Sequelize[_0x2c8b('0x2')],'defaultValue':_0x2c8b('0x17'),'set':function(_0x33ae8f){this[_0x2c8b('0x18')]('nat',_0x33ae8f?_0x33ae8f[_0x2c8b('0x19')](','):null);},'get':function(){return this[_0x2c8b('0x1a')]('nat')?this[_0x2c8b('0x1a')](_0x2c8b('0x1b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2c8b('0x2')]},'pickupgroup':{'type':Sequelize[_0x2c8b('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2c8b('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2c8b('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2c8b('0x2')],'allowNull':![],'defaultValue':_0x2c8b('0x1c'),'set':function(_0x105a38){this['setDataValue'](_0x2c8b('0x1d'),_0x105a38?_0x105a38[_0x2c8b('0x19')](';'):_0x2c8b('0x1c'));},'get':function(){return this[_0x2c8b('0x1a')]('allow')?this[_0x2c8b('0x1a')]('allow')['split'](';'):null;},'comment':_0x2c8b('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x2c8b('0x16'),'no')},'insecure':{'type':Sequelize[_0x2c8b('0x2')],'defaultValue':_0x2c8b('0x1f'),'set':function(_0x173333){this[_0x2c8b('0x18')](_0x2c8b('0x20'),_0x173333?_0x173333[_0x2c8b('0x19')](','):null);},'get':function(){return this[_0x2c8b('0x1a')](_0x2c8b('0x20'))?this[_0x2c8b('0x1a')](_0x2c8b('0x20'))[_0x2c8b('0xf')](','):null;},'comment':_0x2c8b('0x21')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no',_0x2c8b('0x22'))},'promiscredir':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'setvar':{'type':Sequelize[_0x2c8b('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2c8b('0x2')]},'callcounter':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no'),'defaultValue':_0x2c8b('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2c8b('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2c8b('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x2c8b('0x2')]},'template':{'type':Sequelize[_0x2c8b('0x2')]},'videosupport':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2c8b('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x2c8b('0x2')]},'session_timers':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x24'),_0x2c8b('0x25'),_0x2c8b('0x26'))},'session_expires':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x2c8b('0x27')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x2c8b('0x2')]},'fromdomain':{'type':Sequelize[_0x2c8b('0x2')]},'fromuser':{'type':Sequelize[_0x2c8b('0x2')]},'port':{'type':Sequelize[_0x2c8b('0x23')](0x5)},'qualify':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no'),'defaultValue':_0x2c8b('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2c8b('0x2')]},'defaultuser':{'type':Sequelize[_0x2c8b('0x2')]},'rtptimeout':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no',_0x2c8b('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2c8b('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'timerb':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x2c8b('0x2')]},'contactdeny':{'type':Sequelize[_0x2c8b('0x2')]},'contactacl':{'type':Sequelize[_0x2c8b('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2c8b('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2c8b('0x2')]},'maxforwards':{'type':Sequelize[_0x2c8b('0x23')](0xb)},'encryption':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2c8b('0x16'),'no')},'force_avp':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no')},'icesupport':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x2c8b('0x3')](_0x2c8b('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x2c8b('0x29'),_0x2c8b('0x2a'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x2c8b('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x2c8b('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2c8b('0x2b'),_0x2c8b('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2c8b('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2c8b('0x2')]},'recordofffeature':{'type':Sequelize[_0x2c8b('0x2')]},'call_limit':{'type':Sequelize[_0x2c8b('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x2c8b('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x2c8b('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x2c8b('0x2')]},'mohinterpret':{'type':Sequelize[_0x2c8b('0x2')]},'mohsuggest':{'type':Sequelize[_0x2c8b('0x2')]},'parkinglot':{'type':Sequelize[_0x2c8b('0x2')]},'description':{'type':Sequelize[_0x2c8b('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2c8b('0x2d')},'canreinvite':{'type':Sequelize[_0x2c8b('0x3')]('yes','no','nonat',_0x2c8b('0x2e'),_0x2c8b('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2c8b('0x2')]},'otherFields':{'type':Sequelize[_0x2c8b('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2c8b('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2416=['nonat','update','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes'];(function(_0x1a9abf,_0x482dea){var _0x37bd1e=function(_0x1a3ad3){while(--_0x1a3ad3){_0x1a9abf['push'](_0x1a9abf['shift']());}};_0x37bd1e(++_0x482dea);}(_0x2416,0x113));var _0x6241=function(_0x2876a9,_0xe1c84c){_0x2876a9=_0x2876a9-0x0;var _0x10529c=_0x2416[_0x2876a9];return _0x10529c;};'use strict';var Sequelize=require(_0x6241('0x0'));module[_0x6241('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6241('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x4'),_0x6241('0x5'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x6241('0x3')]('ALLOWED_NOT_SCREENED',_0x6241('0x6'),_0x6241('0x7'),_0x6241('0x8'),_0x6241('0x9'),_0x6241('0xa'),'PROHIB_FAILED_SCREEN',_0x6241('0xb'))},'deny':{'type':Sequelize[_0x6241('0xc')]},'permit':{'type':Sequelize[_0x6241('0xc')]},'secret':{'type':Sequelize[_0x6241('0xc')]},'md5secret':{'type':Sequelize[_0x6241('0xc')]},'remotesecret':{'type':Sequelize[_0x6241('0xc')]},'transport':{'type':Sequelize[_0x6241('0xc')],'defaultValue':_0x6241('0xd'),'set':function(_0x42a920){this[_0x6241('0xe')](_0x6241('0xf'),_0x42a920?_0x42a920[_0x6241('0x10')](','):null);},'get':function(){return this[_0x6241('0x11')](_0x6241('0xf'))?this[_0x6241('0x11')](_0x6241('0xf'))['split'](','):null;},'comment':_0x6241('0x12')},'dtmfmode':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x13'),_0x6241('0x14'),_0x6241('0x15'),_0x6241('0x16'),_0x6241('0x17')),'defaultValue':_0x6241('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x6241('0x18'),'no',_0x6241('0x19'),_0x6241('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6241('0xc')]},'directmediadeny':{'type':Sequelize[_0x6241('0xc')]},'nat':{'type':Sequelize[_0x6241('0xc')],'defaultValue':_0x6241('0x1b'),'set':function(_0x1c30af){this[_0x6241('0xe')](_0x6241('0x1c'),_0x1c30af?_0x1c30af[_0x6241('0x10')](','):null);},'get':function(){return this[_0x6241('0x11')]('nat')?this['getDataValue'](_0x6241('0x1c'))[_0x6241('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x6241('0xc')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x6241('0xc')]},'namedpickupgroup':{'type':Sequelize[_0x6241('0xc')]},'language':{'type':Sequelize[_0x6241('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6241('0xc')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6241('0xc')],'defaultValue':_0x6241('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6241('0x1f'),'set':function(_0x57a695){this['setDataValue'](_0x6241('0x20'),_0x57a695?_0x57a695['join'](';'):_0x6241('0x1f'));},'get':function(){return this[_0x6241('0x11')](_0x6241('0x20'))?this['getDataValue'](_0x6241('0x20'))['split'](';'):null;},'comment':_0x6241('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x6241('0x18'),'no')},'insecure':{'type':Sequelize[_0x6241('0xc')],'defaultValue':'port,invite','set':function(_0x89ae28){this['setDataValue'](_0x6241('0x22'),_0x89ae28?_0x89ae28[_0x6241('0x10')](','):null);},'get':function(){return this[_0x6241('0x11')](_0x6241('0x22'))?this[_0x6241('0x11')]('insecure')[_0x6241('0x1d')](','):null;},'comment':_0x6241('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x6241('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x6241('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'accountcode':{'type':Sequelize[_0x6241('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x6241('0x25')},'amaflags':{'type':Sequelize[_0x6241('0xc')]},'callcounter':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no'),'defaultValue':_0x6241('0x18')},'busylevel':{'type':Sequelize[_0x6241('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x6241('0xc')]},'videosupport':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no',_0x6241('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6241('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6241('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x6241('0x3')]('accept',_0x6241('0x27'),_0x6241('0x28'))},'session_expires':{'type':Sequelize[_0x6241('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x6241('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x29'),_0x6241('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x6241('0xc')]},'fromdomain':{'type':Sequelize[_0x6241('0xc')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x6241('0x3')]('yes','no'),'defaultValue':_0x6241('0x18')},'keepalive':{'type':Sequelize[_0x6241('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x6241('0xc')]},'defaultuser':{'type':Sequelize[_0x6241('0xc')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6241('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6241('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x6241('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6241('0xc')]},'callbackextension':{'type':Sequelize[_0x6241('0xc')]},'timert1':{'type':Sequelize[_0x6241('0x24')](0xb)},'timerb':{'type':Sequelize[_0x6241('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x6241('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x6241('0xc')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x6241('0xc')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6241('0x24')](0xb)},'encryption':{'type':Sequelize[_0x6241('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'force_avp':{'type':Sequelize[_0x6241('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6241('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x6241('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x6241('0xc')]},'dtlscipher':{'type':Sequelize[_0x6241('0xc')]},'dtlscafile':{'type':Sequelize[_0x6241('0xc')]},'dtlscapath':{'type':Sequelize[_0x6241('0xc')]},'dtlssetup':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x2d'),_0x6241('0x2e'),_0x6241('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6241('0xc')]},'usereqphone':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6241('0xc')]},'recordofffeature':{'type':Sequelize[_0x6241('0xc')]},'call_limit':{'type':Sequelize[_0x6241('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x6241('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x6241('0x3')](_0x6241('0x18'),'no')},'vmexten':{'type':Sequelize[_0x6241('0xc')]},'mohinterpret':{'type':Sequelize[_0x6241('0xc')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x6241('0xc')]},'description':{'type':Sequelize[_0x6241('0xc')]},'host':{'type':Sequelize[_0x6241('0xc')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0x6241('0x1a'),_0x6241('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6241('0xc')]},'otherFields':{'type':Sequelize[_0x6241('0xc')]},'active':{'type':Sequelize[_0x6241('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6241('0xc')],'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 41ccfdf..de12501 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 _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x4ba826,_0x4a9850){var _0x4d8662=function(_0x506bdd){while(--_0x506bdd){_0x4ba826['push'](_0x4ba826['shift']());}};_0x4d8662(++_0x4a9850);}(_0xbec5,0xe5));var _0x5bec=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xbec5[_0x20aadb];return _0x520018;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file +var _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0xd1ce83,_0x4199ec){var _0x51aabb=function(_0xa05538){while(--_0xa05538){_0xd1ce83['push'](_0xd1ce83['shift']());}};_0x51aabb(++_0x4199ec);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 55169e4..ebea235 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 _0xd443=['rimraf','../../config/environment','define','Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x16720d,_0x476ef1){var _0x1787c2=function(_0x3aff5d){while(--_0x3aff5d){_0x16720d['push'](_0x16720d['shift']());}};_0x1787c2(++_0x476ef1);}(_0xd443,0x149));var _0x3d44=function(_0x365e50,_0x516832){_0x365e50=_0x365e50-0x0;var _0x11f323=_0xd443[_0x365e50];return _0x11f323;};'use strict';var _=require('lodash');var util=require(_0x3d44('0x0'));var logger=require(_0x3d44('0x1'))(_0x3d44('0x2'));var moment=require(_0x3d44('0x3'));var BPromise=require(_0x3d44('0x4'));var rp=require(_0x3d44('0x5'));var fs=require('fs');var path=require(_0x3d44('0x6'));var rimraf=require(_0x3d44('0x7'));var config=require(_0x3d44('0x8'));var attributes=require('./trunk.attributes');module['exports']=function(_0x3adbb9,_0x48e873){return _0x3adbb9[_0x3d44('0x9')](_0x3d44('0xa'),attributes,{'tableName':_0x3d44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x185e=['exports','define','Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x529167,_0x426891){var _0x1adee1=function(_0x2017bb){while(--_0x2017bb){_0x529167['push'](_0x529167['shift']());}};_0x1adee1(++_0x426891);}(_0x185e,0x1a8));var _0xe185=function(_0x30977b,_0x22be64){_0x30977b=_0x30977b-0x0;var _0x339a92=_0x185e[_0x30977b];return _0x339a92;};'use strict';var _=require(_0xe185('0x0'));var util=require(_0xe185('0x1'));var logger=require('../../config/logger')(_0xe185('0x2'));var moment=require(_0xe185('0x3'));var BPromise=require(_0xe185('0x4'));var rp=require(_0xe185('0x5'));var fs=require('fs');var path=require(_0xe185('0x6'));var rimraf=require(_0xe185('0x7'));var config=require(_0xe185('0x8'));var attributes=require(_0xe185('0x9'));module[_0xe185('0xa')]=function(_0x4950d9,_0x2148da){return _0x4950d9[_0xe185('0xb')](_0xe185('0xc'),attributes,{'tableName':_0xe185('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 4bc2aa2..054d4f6 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 _0x757a=['Trunk','findAll','options','where','attributes','include','model','map','then','stringify','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrunk'];(function(_0x52f1a7,_0x4da82f){var _0x227c86=function(_0x1e8686){while(--_0x1e8686){_0x52f1a7['push'](_0x52f1a7['shift']());}};_0x227c86(++_0x4da82f);}(_0x757a,0x110));var _0xa757=function(_0x4fbc22,_0x3005c3){_0x4fbc22=_0x4fbc22-0x0;var _0x5edd91=_0x757a[_0x4fbc22];return _0x5edd91;};'use strict';var _=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var rs=require(_0xa757('0x4'));var fs=require('fs');var Redis=require(_0xa757('0x5'));var db=require(_0xa757('0x6'))['db'];var utils=require(_0xa757('0x7'));var logger=require(_0xa757('0x8'))('rpc');var config=require(_0xa757('0x9'));var jayson=require(_0xa757('0xa'));var client=jayson[_0xa757('0xb')][_0xa757('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x278afc,_0x6eb8fb,_0x4b367d){return new BPromise(function(_0x44546e,_0x119992){return client[_0xa757('0xd')](_0x278afc,_0x4b367d)['then'](function(_0xce87a1){logger[_0xa757('0xe')](_0xa757('0xf'),_0x6eb8fb,_0xa757('0x10'));logger[_0xa757('0x11')](_0xa757('0x12'),_0x6eb8fb,'request\x20sent',JSON['stringify'](_0xce87a1));if(_0xce87a1[_0xa757('0x13')]){if(_0xce87a1['error']['code']===0x1f4){logger[_0xa757('0x13')](_0xa757('0xf'),_0x6eb8fb,_0xce87a1[_0xa757('0x13')]['message']);return _0x119992(_0xce87a1['error'][_0xa757('0x14')]);}logger[_0xa757('0x13')](_0xa757('0xf'),_0x6eb8fb,_0xce87a1[_0xa757('0x13')][_0xa757('0x14')]);return _0x44546e(_0xce87a1[_0xa757('0x13')][_0xa757('0x14')]);}else{logger['info'](_0xa757('0xf'),_0x6eb8fb,'request\x20sent');_0x44546e(_0xce87a1[_0xa757('0x15')]['message']);}})[_0xa757('0x16')](function(_0x3bff06){logger['error']('Trunk,\x20%s,\x20%s',_0x6eb8fb,_0x3bff06);_0x119992(_0x3bff06);});});}exports[_0xa757('0x17')]=function(_0x4ddea6){var _0x32e82d=this;return new Promise(function(_0x549263,_0x5de9b5){return db[_0xa757('0x18')][_0xa757('0x19')]({'raw':_0x4ddea6[_0xa757('0x1a')]?_0x4ddea6[_0xa757('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4ddea6[_0xa757('0x1a')]?_0x4ddea6['options'][_0xa757('0x1b')]||null:null,'attributes':_0x4ddea6[_0xa757('0x1a')]?_0x4ddea6[_0xa757('0x1a')][_0xa757('0x1c')]||null:null,'limit':_0x4ddea6[_0xa757('0x1a')]?_0x4ddea6[_0xa757('0x1a')]['limit']||null:null,'include':_0x4ddea6[_0xa757('0x1a')]?_0x4ddea6[_0xa757('0x1a')][_0xa757('0x1d')]?_['map'](_0x4ddea6['options'][_0xa757('0x1d')],function(_0x3eaf20){return{'model':db[_0x3eaf20[_0xa757('0x1e')]],'as':_0x3eaf20['as'],'attributes':_0x3eaf20[_0xa757('0x1c')],'include':_0x3eaf20['include']?_[_0xa757('0x1f')](_0x3eaf20[_0xa757('0x1d')],function(_0x4ce1ec){return{'model':db[_0x4ce1ec['model']],'as':_0x4ce1ec['as'],'attributes':_0x4ce1ec[_0xa757('0x1c')],'include':_0x4ce1ec[_0xa757('0x1d')]?_['map'](_0x4ce1ec[_0xa757('0x1d')],function(_0xf4848e){return{'model':db[_0xf4848e[_0xa757('0x1e')]],'as':_0xf4848e['as'],'attributes':_0xf4848e[_0xa757('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa757('0x20')](function(_0x282705){logger[_0xa757('0xe')]('GetTrunk',_0x4ddea6);logger[_0xa757('0x11')]('GetTrunk',_0x4ddea6,JSON[_0xa757('0x21')](_0x282705));_0x549263(_0x282705);})[_0xa757('0x16')](function(_0x10bb59){logger[_0xa757('0x13')](_0xa757('0x17'),_0x10bb59[_0xa757('0x14')],_0x4ddea6);_0x5de9b5(_0x32e82d[_0xa757('0x13')](0x1f4,_0x10bb59[_0xa757('0x14')]));});});};exports[_0xa757('0x22')]=function(_0x37c527){var _0x50a366=this;return new Promise(function(_0x197757,_0x1eee7c){return db['Trunk'][_0xa757('0x23')]({'raw':_0x37c527[_0xa757('0x1a')]?_0x37c527[_0xa757('0x1a')][_0xa757('0x24')]===undefined?!![]:![]:!![],'where':_0x37c527['options']?_0x37c527[_0xa757('0x1a')][_0xa757('0x1b')]||null:null,'attributes':_0x37c527[_0xa757('0x1a')]?_0x37c527[_0xa757('0x1a')][_0xa757('0x1c')]||null:null,'include':_0x37c527['options']?_0x37c527['options']['include']?_[_0xa757('0x1f')](_0x37c527[_0xa757('0x1a')][_0xa757('0x1d')],function(_0x35a4fa){return{'model':db[_0x35a4fa[_0xa757('0x1e')]],'as':_0x35a4fa['as'],'attributes':_0x35a4fa[_0xa757('0x1c')],'include':_0x35a4fa[_0xa757('0x1d')]?_[_0xa757('0x1f')](_0x35a4fa[_0xa757('0x1d')],function(_0x3d7128){return{'model':db[_0x3d7128[_0xa757('0x1e')]],'as':_0x3d7128['as'],'attributes':_0x3d7128[_0xa757('0x1c')],'include':_0x3d7128[_0xa757('0x1d')]?_[_0xa757('0x1f')](_0x3d7128[_0xa757('0x1d')],function(_0x364645){return{'model':db[_0x364645[_0xa757('0x1e')]],'as':_0x364645['as'],'attributes':_0x364645[_0xa757('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x569940){logger[_0xa757('0xe')](_0xa757('0x22'),_0x37c527);logger['debug'](_0xa757('0x22'),_0x37c527,JSON['stringify'](_0x569940));_0x197757(_0x569940);})[_0xa757('0x16')](function(_0x2912b4){logger[_0xa757('0x13')]('ShowTrunk',_0x2912b4[_0xa757('0x14')],_0x37c527);_0x1eee7c(_0x50a366[_0xa757('0x13')](0x1f4,_0x2912b4[_0xa757('0x14')]));});});}; \ No newline at end of file +var _0x8e67=['where','attributes','limit','map','include','model','then','catch','ShowTrunk','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTrunk','Trunk','options','raw'];(function(_0x21c85e,_0x276d6c){var _0x592a7d=function(_0x33bb44){while(--_0x33bb44){_0x21c85e['push'](_0x21c85e['shift']());}};_0x592a7d(++_0x276d6c);}(_0x8e67,0xff));var _0x78e6=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x8e67[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0x78e6('0x0'));var util=require(_0x78e6('0x1'));var moment=require(_0x78e6('0x2'));var BPromise=require(_0x78e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78e6('0x4'));var db=require(_0x78e6('0x5'))['db'];var utils=require(_0x78e6('0x6'));var logger=require('../../config/logger')(_0x78e6('0x7'));var config=require(_0x78e6('0x8'));var jayson=require(_0x78e6('0x9'));var client=jayson['client'][_0x78e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47d388,_0x39e649,_0x1b3b22){return new BPromise(function(_0x5a51e7,_0x541f9b){return client[_0x78e6('0xb')](_0x47d388,_0x1b3b22)['then'](function(_0x14a837){logger[_0x78e6('0xc')](_0x78e6('0xd'),_0x39e649,_0x78e6('0xe'));logger[_0x78e6('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x39e649,_0x78e6('0xe'),JSON[_0x78e6('0x10')](_0x14a837));if(_0x14a837[_0x78e6('0x11')]){if(_0x14a837[_0x78e6('0x11')][_0x78e6('0x12')]===0x1f4){logger['error'](_0x78e6('0xd'),_0x39e649,_0x14a837['error'][_0x78e6('0x13')]);return _0x541f9b(_0x14a837[_0x78e6('0x11')][_0x78e6('0x13')]);}logger[_0x78e6('0x11')](_0x78e6('0xd'),_0x39e649,_0x14a837['error'][_0x78e6('0x13')]);return _0x5a51e7(_0x14a837[_0x78e6('0x11')][_0x78e6('0x13')]);}else{logger[_0x78e6('0xc')](_0x78e6('0xd'),_0x39e649,'request\x20sent');_0x5a51e7(_0x14a837[_0x78e6('0x14')][_0x78e6('0x13')]);}})['catch'](function(_0x2d2722){logger[_0x78e6('0x11')](_0x78e6('0xd'),_0x39e649,_0x2d2722);_0x541f9b(_0x2d2722);});});}exports[_0x78e6('0x15')]=function(_0x4a4cd9){var _0x5b7295=this;return new Promise(function(_0x461cb8,_0x5e0617){return db[_0x78e6('0x16')]['findAll']({'raw':_0x4a4cd9[_0x78e6('0x17')]?_0x4a4cd9['options'][_0x78e6('0x18')]===undefined?!![]:![]:!![],'where':_0x4a4cd9[_0x78e6('0x17')]?_0x4a4cd9[_0x78e6('0x17')][_0x78e6('0x19')]||null:null,'attributes':_0x4a4cd9[_0x78e6('0x17')]?_0x4a4cd9['options'][_0x78e6('0x1a')]||null:null,'limit':_0x4a4cd9[_0x78e6('0x17')]?_0x4a4cd9['options'][_0x78e6('0x1b')]||null:null,'include':_0x4a4cd9['options']?_0x4a4cd9[_0x78e6('0x17')]['include']?_[_0x78e6('0x1c')](_0x4a4cd9['options'][_0x78e6('0x1d')],function(_0x2dceb4){return{'model':db[_0x2dceb4[_0x78e6('0x1e')]],'as':_0x2dceb4['as'],'attributes':_0x2dceb4['attributes'],'include':_0x2dceb4[_0x78e6('0x1d')]?_[_0x78e6('0x1c')](_0x2dceb4['include'],function(_0x334e13){return{'model':db[_0x334e13[_0x78e6('0x1e')]],'as':_0x334e13['as'],'attributes':_0x334e13[_0x78e6('0x1a')],'include':_0x334e13[_0x78e6('0x1d')]?_[_0x78e6('0x1c')](_0x334e13[_0x78e6('0x1d')],function(_0x1b94e0){return{'model':db[_0x1b94e0[_0x78e6('0x1e')]],'as':_0x1b94e0['as'],'attributes':_0x1b94e0[_0x78e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x78e6('0x1f')](function(_0x348d9c){logger[_0x78e6('0xc')](_0x78e6('0x15'),_0x4a4cd9);logger[_0x78e6('0xf')]('GetTrunk',_0x4a4cd9,JSON['stringify'](_0x348d9c));_0x461cb8(_0x348d9c);})[_0x78e6('0x20')](function(_0x5a732e){logger[_0x78e6('0x11')](_0x78e6('0x15'),_0x5a732e[_0x78e6('0x13')],_0x4a4cd9);_0x5e0617(_0x5b7295['error'](0x1f4,_0x5a732e[_0x78e6('0x13')]));});});};exports[_0x78e6('0x21')]=function(_0x335319){var _0x450f5a=this;return new Promise(function(_0x2a0bc6,_0x31e7bb){return db[_0x78e6('0x16')][_0x78e6('0x22')]({'raw':_0x335319['options']?_0x335319[_0x78e6('0x17')][_0x78e6('0x18')]===undefined?!![]:![]:!![],'where':_0x335319['options']?_0x335319[_0x78e6('0x17')][_0x78e6('0x19')]||null:null,'attributes':_0x335319[_0x78e6('0x17')]?_0x335319[_0x78e6('0x17')][_0x78e6('0x1a')]||null:null,'include':_0x335319[_0x78e6('0x17')]?_0x335319['options'][_0x78e6('0x1d')]?_['map'](_0x335319[_0x78e6('0x17')][_0x78e6('0x1d')],function(_0x5ee408){return{'model':db[_0x5ee408[_0x78e6('0x1e')]],'as':_0x5ee408['as'],'attributes':_0x5ee408[_0x78e6('0x1a')],'include':_0x5ee408[_0x78e6('0x1d')]?_[_0x78e6('0x1c')](_0x5ee408['include'],function(_0x40773b){return{'model':db[_0x40773b[_0x78e6('0x1e')]],'as':_0x40773b['as'],'attributes':_0x40773b[_0x78e6('0x1a')],'include':_0x40773b['include']?_[_0x78e6('0x1c')](_0x40773b[_0x78e6('0x1d')],function(_0x25d326){return{'model':db[_0x25d326['model']],'as':_0x25d326['as'],'attributes':_0x25d326[_0x78e6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f2ec4){logger[_0x78e6('0xc')](_0x78e6('0x21'),_0x335319);logger[_0x78e6('0xf')](_0x78e6('0x21'),_0x335319,JSON[_0x78e6('0x10')](_0x4f2ec4));_0x2a0bc6(_0x4f2ec4);})[_0x78e6('0x20')](function(_0x465a85){logger[_0x78e6('0x11')]('ShowTrunk',_0x465a85['message'],_0x335319);_0x31e7bb(_0x450f5a['error'](0x1f4,_0x465a85[_0x78e6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 9d32cb3..470db04 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 _0xafd9=['put','/:id','isAuthenticated','update','express','Router'];(function(_0x4534e3,_0x56de6e){var _0x50c3a3=function(_0xb4117f){while(--_0xb4117f){_0x4534e3['push'](_0x4534e3['shift']());}};_0x50c3a3(++_0x56de6e);}(_0xafd9,0x94));var _0x9afd=function(_0x14b858,_0x1444fe){_0x14b858=_0x14b858-0x0;var _0x16db3e=_0xafd9[_0x14b858];return _0x16db3e;};'use strict';var express=require(_0x9afd('0x0'));var router=express[_0x9afd('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x9afd('0x2')](_0x9afd('0x3'),auth[_0x9afd('0x4')](),controller[_0x9afd('0x5')]);module['exports']=router; \ No newline at end of file +var _0x96cd=['../../components/auth/service','put','/:id','isAuthenticated','update','Router'];(function(_0x1a0ae3,_0x266405){var _0x193c4d=function(_0x1fa65f){while(--_0x1fa65f){_0x1a0ae3['push'](_0x1a0ae3['shift']());}};_0x193c4d(++_0x266405);}(_0x96cd,0x6b));var _0xd96c=function(_0x3c8f16,_0xa863d9){_0x3c8f16=_0x3c8f16-0x0;var _0x5456a0=_0x96cd[_0x3c8f16];return _0x5456a0;};'use strict';var express=require('express');var router=express[_0xd96c('0x0')]();var auth=require(_0xd96c('0x1'));var controller=require('./user-setting.controller');router[_0xd96c('0x2')](_0xd96c('0x3'),auth[_0xd96c('0x4')](),controller[_0xd96c('0x5')]);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 2a11016..c27f2a9 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 _0x2048=['info','debug','exports','ENUM','error','BOOLEAN','TEXT','INTEGER','UserId','warning'];(function(_0x461386,_0x1440d6){var _0x497097=function(_0x11c86e){while(--_0x11c86e){_0x461386['push'](_0x461386['shift']());}};_0x497097(++_0x1440d6);}(_0x2048,0x149));var _0x8204=function(_0x4fc5df,_0x3acaab){_0x4fc5df=_0x4fc5df-0x0;var _0x4a18f5=_0x2048[_0x4fc5df];return _0x4a18f5;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x8204('0x0'),_0x8204('0x1'),_0x8204('0x2')];module[_0x8204('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8204('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8204('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8204('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8204('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8204('0x8')],'unique':_0x8204('0x9')}}; \ No newline at end of file +var _0x6235=['info','exports','ENUM','error','BOOLEAN','TEXT','DATE','UserId','sequelize','warning'];(function(_0x44d8d0,_0x5350d3){var _0x391dda=function(_0x54efb1){while(--_0x54efb1){_0x44d8d0['push'](_0x44d8d0['shift']());}};_0x391dda(++_0x5350d3);}(_0x6235,0x6c));var _0x5623=function(_0x24f5fb,_0x34a03f){_0x24f5fb=_0x24f5fb-0x0;var _0x2a7f76=_0x6235[_0x24f5fb];return _0x2a7f76;};'use strict';var Sequelize=require(_0x5623('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x5623('0x1'),_0x5623('0x2'),'debug'];module[_0x5623('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5623('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5623('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5623('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5623('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5623('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x5623('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 0ed3661..fdde716 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 _0xcea2=['register','redis','status','json','update','then','sendStatus','stack','name','send','user','params','UserSetting','find','body','catch','lodash','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket'];(function(_0x26e985,_0xe644ff){var _0x2f293d=function(_0x1fe88a){while(--_0x1fe88a){_0x26e985['push'](_0x26e985['shift']());}};_0x2f293d(++_0xe644ff);}(_0xcea2,0x15a));var _0x2cea=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcea2[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x2cea('0x0'));var Redis=require('ioredis');var logger=require(_0x2cea('0x1'))('api');var config=require(_0x2cea('0x2'));var db=require(_0x2cea('0x3'))['db'];var socket=require(_0x2cea('0x4'))(new Redis(config['redis']));require(_0x2cea('0x5'))[_0x2cea('0x6')](socket);config[_0x2cea('0x7')]=_['defaults'](config[_0x2cea('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x2d69ff,_0xc04963){_0xc04963=_0xc04963||0xc8;return function(_0x805a1b){if(_0x805a1b){return _0x2d69ff[_0x2cea('0x8')](_0xc04963)[_0x2cea('0x9')](_0x805a1b);}};}function saveUpdates(_0x1519f6){return function(_0x5e9060){if(_0x5e9060){return _0x5e9060[_0x2cea('0xa')](_0x1519f6)[_0x2cea('0xb')](function(_0x205a4e){return _0x205a4e;});}return null;};}function handleEntityNotFound(_0x2b437a){return function(_0x306cf7){if(!_0x306cf7){_0x2b437a[_0x2cea('0xc')](0x194);}return _0x306cf7;};}function handleError(_0x4298a4,_0x1c9142){_0x1c9142=_0x1c9142||0x1f4;return function(_0x58a102){logger['error'](_0x58a102[_0x2cea('0xd')]);if(_0x58a102[_0x2cea('0xe')]){delete _0x58a102['name'];}_0x4298a4['status'](_0x1c9142)[_0x2cea('0xf')](_0x58a102);};}exports['update']=function(_0xa4ce3d,_0xc5d08e){if(_0xa4ce3d[_0x2cea('0x10')]['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0xa4ce3d[_0x2cea('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x2cea('0x12')][_0x2cea('0x13')]({'where':{'id':_0xa4ce3d[_0x2cea('0x11')]['id']}})[_0x2cea('0xb')](handleEntityNotFound(_0xc5d08e,null))[_0x2cea('0xb')](saveUpdates(_0xa4ce3d[_0x2cea('0x14')],null))[_0x2cea('0xb')](respondWithResult(_0xc5d08e,null))[_0x2cea('0x15')](handleError(_0xc5d08e,null));}; \ No newline at end of file +var _0x668b=['./user-setting.socket','register','redis','localhost','status','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash','ioredis','api','../../config/environment','socket.io-emitter'];(function(_0x4063c8,_0x58327d){var _0x5d2cc5=function(_0x4a2ad9){while(--_0x4a2ad9){_0x4063c8['push'](_0x4063c8['shift']());}};_0x5d2cc5(++_0x58327d);}(_0x668b,0x140));var _0xb668=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x668b[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0xb668('0x0'));var Redis=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var config=require(_0xb668('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xb668('0x4'))(new Redis(config['redis']));require(_0xb668('0x5'))[_0xb668('0x6')](socket);config[_0xb668('0x7')]=_['defaults'](config[_0xb668('0x7')],{'host':_0xb668('0x8'),'port':0x18eb});function respondWithResult(_0x3be92e,_0x2778e9){_0x2778e9=_0x2778e9||0xc8;return function(_0x20b749){if(_0x20b749){return _0x3be92e[_0xb668('0x9')](_0x2778e9)['json'](_0x20b749);}};}function saveUpdates(_0x11bb5e){return function(_0xb850f0){if(_0xb850f0){return _0xb850f0[_0xb668('0xa')](_0x11bb5e)[_0xb668('0xb')](function(_0x39b79c){return _0x39b79c;});}return null;};}function handleEntityNotFound(_0x3606a7){return function(_0x45bc39){if(!_0x45bc39){_0x3606a7[_0xb668('0xc')](0x194);}return _0x45bc39;};}function handleError(_0x567ea9,_0x3b15a6){_0x3b15a6=_0x3b15a6||0x1f4;return function(_0x27dbf7){logger[_0xb668('0xd')](_0x27dbf7[_0xb668('0xe')]);if(_0x27dbf7[_0xb668('0xf')]){delete _0x27dbf7[_0xb668('0xf')];}_0x567ea9[_0xb668('0x9')](_0x3b15a6)[_0xb668('0x10')](_0x27dbf7);};}exports[_0xb668('0xa')]=function(_0x25c5c5,_0x1af935){if(_0x25c5c5[_0xb668('0x11')][_0xb668('0x12')]!==_0xb668('0x13'))throw new Error(_0xb668('0x14'));if(isNaN(Number(_0x25c5c5[_0xb668('0x15')]['id'])))throw new Error(_0xb668('0x16'));return db[_0xb668('0x17')][_0xb668('0x18')]({'where':{'id':_0x25c5c5[_0xb668('0x15')]['id']}})[_0xb668('0xb')](handleEntityNotFound(_0x1af935,null))[_0xb668('0xb')](saveUpdates(_0x25c5c5['body'],null))[_0xb668('0xb')](respondWithResult(_0x1af935,null))['catch'](handleError(_0x1af935,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 1aa9c3c..c31589a 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 _0xef94=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserSetting','setMaxListeners','save'];(function(_0x313cb7,_0x41067c){var _0x36540f=function(_0x2153fc){while(--_0x2153fc){_0x313cb7['push'](_0x313cb7['shift']());}};_0x36540f(++_0x41067c);}(_0xef94,0x164));var _0x4ef9=function(_0x1d120f,_0x110650){_0x1d120f=_0x1d120f-0x0;var _0x5abe48=_0xef94[_0x1d120f];return _0x5abe48;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x4ef9('0x0'))['db'][_0x4ef9('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4ef9('0x2')](0x0);var events={'afterCreate':_0x4ef9('0x3'),'afterUpdate':'update','afterDestroy':_0x4ef9('0x4')};function emitEvent(_0x31775a){return function(_0x402395,_0x157293,_0xbb9db9){UserSettingEvents[_0x4ef9('0x5')](_0x31775a+':'+_0x402395['id'],_0x402395);UserSettingEvents[_0x4ef9('0x5')](_0x31775a,_0x402395);_0xbb9db9(null);};}for(var e in events){if(events[_0x4ef9('0x6')](e)){var event=events[e];UserSetting[_0x4ef9('0x7')](e,emitEvent(event));}}module[_0x4ef9('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x68fb=['hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x39068b,_0x3e8030){var _0x580a60=function(_0x20dc2a){while(--_0x20dc2a){_0x39068b['push'](_0x39068b['shift']());}};_0x580a60(++_0x3e8030);}(_0x68fb,0x9d));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb68f('0x0'));var UserSetting=require(_0xb68f('0x1'))['db'][_0xb68f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb68f('0x3')](0x0);var events={'afterCreate':_0xb68f('0x4'),'afterUpdate':_0xb68f('0x5'),'afterDestroy':_0xb68f('0x6')};function emitEvent(_0x1955e1){return function(_0x4fbc6d,_0x4ed0f8,_0x353a96){UserSettingEvents[_0xb68f('0x7')](_0x1955e1+':'+_0x4fbc6d['id'],_0x4fbc6d);UserSettingEvents['emit'](_0x1955e1,_0x4fbc6d);_0x353a96(null);};}for(var e in events){if(events[_0xb68f('0x8')](e)){var event=events[e];UserSetting[_0xb68f('0x9')](e,emitEvent(event));}}module[_0xb68f('0xa')]=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 c0fdaa3..2ad68d9 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 _0x7033=['./user-setting.attributes','exports','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x179038,_0x5cdc63){var _0x437bbb=function(_0x27b834){while(--_0x27b834){_0x179038['push'](_0x179038['shift']());}};_0x437bbb(++_0x5cdc63);}(_0x7033,0x19e));var _0x3703=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7033[_0x167cc1];return _0x10bc4b;};'use strict';var attributes=require(_0x3703('0x0'));module[_0x3703('0x1')]=function(_0x43eee5){return _0x43eee5[_0x3703('0x2')]('UserSetting',attributes,{'tableName':_0x3703('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7df1c7){if(!_0x7df1c7[_0x3703('0x4')])_0x7df1c7[_0x3703('0x5')]=null;else if(_0x7df1c7[_0x3703('0x5')]===null)_0x7df1c7[_0x3703('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x3609=['exports','define','UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3609,0x101));var _0x9360=function(_0x25e254,_0x451f61){_0x25e254=_0x25e254-0x0;var _0x4d469c=_0x3609[_0x25e254];return _0x4d469c;};'use strict';var attributes=require(_0x9360('0x0'));module[_0x9360('0x1')]=function(_0x224249){return _0x224249[_0x9360('0x2')](_0x9360('0x3'),attributes,{'tableName':_0x9360('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x133b7c){if(!_0x133b7c['clientSideLoggingEnabled'])_0x133b7c[_0x9360('0x5')]=null;else if(_0x133b7c[_0x9360('0x5')]===null)_0x133b7c[_0x9360('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 6df537c..c2119d2 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 _0x3fe4=['UserId','register','length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update','user-setting:update:user-'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x3fe4,0x130));var _0x43fe=function(_0x5f0ff6,_0x43ff47){_0x5f0ff6=_0x5f0ff6-0x0;var _0x596f82=_0x3fe4[_0x5f0ff6];return _0x596f82;};'use strict';var UserSettingEvents=require(_0x43fe('0x0'));var events=[_0x43fe('0x1'),_0x43fe('0x2'),'update'];function createListener(_0x5aa1df,_0x54e0da){return function(_0x275046){_0x54e0da[_0x43fe('0x3')](_0x5aa1df,_0x275046);if(_0x5aa1df===_0x43fe('0x4')){_0x54e0da[_0x43fe('0x3')](_0x43fe('0x5')+_0x275046[_0x43fe('0x6')],_0x275046);}};}exports[_0x43fe('0x7')]=function(_0x3c7ea3){for(var _0x375651=0x0,_0x4b7bad=events[_0x43fe('0x8')];_0x375651<_0x4b7bad;_0x375651++){var _0x3f6e53=events[_0x375651];var _0x38e651=createListener(_0x43fe('0x9')+_0x3f6e53,_0x3c7ea3);UserSettingEvents['on'](_0x3f6e53,_0x38e651);}}; \ No newline at end of file +var _0x06c7=['register','length','user-setting:','./user-setting.events','remove','user-setting:update','UserId'];(function(_0x196520,_0x45464a){var _0x14736e=function(_0x174969){while(--_0x174969){_0x196520['push'](_0x196520['shift']());}};_0x14736e(++_0x45464a);}(_0x06c7,0xd5));var _0x706c=function(_0x294e5e,_0x2f8cbc){_0x294e5e=_0x294e5e-0x0;var _0xf8c6be=_0x06c7[_0x294e5e];return _0xf8c6be;};'use strict';var UserSettingEvents=require(_0x706c('0x0'));var events=['save',_0x706c('0x1'),'update'];function createListener(_0x1334fd,_0x3b9dff){return function(_0x1a46cd){_0x3b9dff['emit'](_0x1334fd,_0x1a46cd);if(_0x1334fd===_0x706c('0x2')){_0x3b9dff['emit']('user-setting:update:user-'+_0x1a46cd[_0x706c('0x3')],_0x1a46cd);}};}exports[_0x706c('0x4')]=function(_0x12baa1){for(var _0x5ccd7f=0x0,_0x517c3a=events[_0x706c('0x5')];_0x5ccd7f<_0x517c3a;_0x5ccd7f++){var _0x55f650=events[_0x5ccd7f];var _0x415ac8=createListener(_0x706c('0x6')+_0x55f650,_0x12baa1);UserSettingEvents['on'](_0x55f650,_0x415ac8);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index cb19e53..f798bdf 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 _0x449f=['destroy','removeChatInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','post','addContacts','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams'];(function(_0x2bfdf6,_0x169771){var _0x3e61d7=function(_0x3d9f4b){while(--_0x3d9f4b){_0x2bfdf6['push'](_0x2bfdf6['shift']());}};_0x3e61d7(++_0x169771);}(_0x449f,0xf6));var _0xf449=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x449f[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0xf449('0x0'));var util=require('util');var path=require(_0xf449('0x1'));var timeout=require('connect-timeout');var express=require(_0xf449('0x2'));var router=express[_0xf449('0x3')]();var fs_extra=require(_0xf449('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf449('0x5'));var config=require(_0xf449('0x6'));var controller=require('./user.controller');router[_0xf449('0x7')]('/',auth[_0xf449('0x8')](),controller[_0xf449('0x9')]);router[_0xf449('0x7')](_0xf449('0xa'),auth[_0xf449('0x8')](),controller[_0xf449('0xb')]);router['get'](_0xf449('0xc'),auth[_0xf449('0x8')](),controller[_0xf449('0xd')]);router[_0xf449('0x7')](_0xf449('0xe'),auth[_0xf449('0x8')](),controller[_0xf449('0xf')]);router[_0xf449('0x7')](_0xf449('0x10'),auth[_0xf449('0x8')](),controller[_0xf449('0x11')]);router['get'](_0xf449('0x12'),controller['getAvatar']);router[_0xf449('0x7')]('/:id/open_tabs',auth[_0xf449('0x8')](),controller[_0xf449('0x13')]);router['get'](_0xf449('0x14'),auth[_0xf449('0x8')](),controller[_0xf449('0x15')]);router['get'](_0xf449('0x16'),auth[_0xf449('0x8')](),controller[_0xf449('0x17')]);router[_0xf449('0x7')](_0xf449('0x18'),auth[_0xf449('0x8')](),controller['getVoiceQueuesRt']);router['get'](_0xf449('0x19'),auth[_0xf449('0x8')](),controller[_0xf449('0x1a')]);router[_0xf449('0x7')](_0xf449('0x1b'),auth[_0xf449('0x8')](),controller[_0xf449('0x1c')]);router[_0xf449('0x7')](_0xf449('0x1d'),auth['isAuthenticated'](),controller[_0xf449('0x1e')]);router[_0xf449('0x7')](_0xf449('0x1f'),auth[_0xf449('0x8')](),controller[_0xf449('0x20')]);router['get'](_0xf449('0x21'),auth[_0xf449('0x8')](),controller[_0xf449('0x22')]);router[_0xf449('0x7')](_0xf449('0x23'),auth[_0xf449('0x8')](),controller[_0xf449('0x24')]);router[_0xf449('0x7')](_0xf449('0x25'),auth[_0xf449('0x8')](),controller[_0xf449('0x26')]);router[_0xf449('0x7')](_0xf449('0x27'),auth[_0xf449('0x8')](),controller['getFaxInteractions']);router[_0xf449('0x7')](_0xf449('0x28'),auth[_0xf449('0x8')](),controller['getWhatsappInteractions']);router[_0xf449('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf449('0x29')]);router[_0xf449('0x7')](_0xf449('0x2a'),auth[_0xf449('0x8')](),controller['getLists']);router[_0xf449('0x7')](_0xf449('0x2b'),auth[_0xf449('0x8')](),controller[_0xf449('0x2c')]);router[_0xf449('0x7')](_0xf449('0x2d'),auth[_0xf449('0x8')](),controller[_0xf449('0x2e')]);router[_0xf449('0x7')](_0xf449('0x2f'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xf449('0x7')](_0xf449('0x30'),auth[_0xf449('0x8')](),controller[_0xf449('0x31')]);router['get'](_0xf449('0x32'),auth[_0xf449('0x8')](),controller[_0xf449('0x33')]);router[_0xf449('0x7')](_0xf449('0x34'),auth[_0xf449('0x8')](),controller[_0xf449('0x35')]);router[_0xf449('0x7')](_0xf449('0x36'),auth[_0xf449('0x8')](),controller[_0xf449('0x37')]);router['get'](_0xf449('0x38'),auth[_0xf449('0x8')](),controller[_0xf449('0x39')]);router[_0xf449('0x7')]('/:id/square_projects',auth[_0xf449('0x8')](),controller['getSquareProjects']);router[_0xf449('0x7')](_0xf449('0x3a'),auth[_0xf449('0x8')](),controller['getScheduledCalls']);router[_0xf449('0x7')](_0xf449('0x3b'),auth[_0xf449('0x8')](),controller['getApiKey']);router[_0xf449('0x3c')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xf449('0x3d')]);router[_0xf449('0x3c')]('/',auth['isAuthenticated'](),controller[_0xf449('0x3e')]);router[_0xf449('0x3c')](_0xf449('0x3f'),auth[_0xf449('0x8')](),controller['bulkCreate']);router[_0xf449('0x3c')]('/:id/queues',auth['isAuthenticated'](),controller[_0xf449('0x40')]);var upload=multer({'storage':multer[_0xf449('0x41')]({'destination':function(_0x1a58a3,_0x497a66,_0x1cbd4e){_0x1cbd4e(null,path[_0xf449('0x42')](config[_0xf449('0x43')],_0xf449('0x44')));},'filename':function(_0x1bfa47,_0x3cb36a,_0x529fd6){_0x529fd6(null,util[_0xf449('0x45')](_0xf449('0x46'),Date[_0xf449('0x47')](),_0x3cb36a['originalname']));}})});router[_0xf449('0x3c')](_0xf449('0x12'),upload[_0xf449('0x48')]('file'),controller['addAvatar']);router['post'](_0xf449('0x49'),auth[_0xf449('0x8')](),controller[_0xf449('0x4a')]);router[_0xf449('0x3c')](_0xf449('0x4b'),auth[_0xf449('0x8')](),controller[_0xf449('0x4c')]);router[_0xf449('0x3c')]('/:id/pause',auth[_0xf449('0x8')](),controller[_0xf449('0x4d')]);router[_0xf449('0x3c')](_0xf449('0x4e'),auth['isAuthenticated'](),controller['unpause']);router[_0xf449('0x3c')](_0xf449('0x4f'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xf449('0x50'),auth[_0xf449('0x8')](),controller[_0xf449('0x51')]);router[_0xf449('0x3c')](_0xf449('0x52'),auth[_0xf449('0x8')](),controller['addMailInteractions']);router['post'](_0xf449('0x53'),auth[_0xf449('0x8')](),controller[_0xf449('0x54')]);router['post'](_0xf449('0x55'),auth[_0xf449('0x8')](),controller[_0xf449('0x56')]);router[_0xf449('0x3c')](_0xf449('0x57'),auth[_0xf449('0x8')](),controller[_0xf449('0x58')]);router['post'](_0xf449('0x59'),auth[_0xf449('0x8')](),controller[_0xf449('0x5a')]);router[_0xf449('0x3c')](_0xf449('0x2f'),auth[_0xf449('0x8')](),controller['addFaxAccounts']);router[_0xf449('0x3c')](_0xf449('0x30'),auth[_0xf449('0x8')](),controller[_0xf449('0x5b')]);router['post']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xf449('0x5c')]);router[_0xf449('0x3c')]('/:id/sms_accounts',auth[_0xf449('0x8')](),controller[_0xf449('0x5d')]);router[_0xf449('0x3c')]('/:id/chat_websites',auth[_0xf449('0x8')](),controller[_0xf449('0x5e')]);router[_0xf449('0x3c')](_0xf449('0x38'),auth['isAuthenticated'](),controller[_0xf449('0x5f')]);router[_0xf449('0x3c')](_0xf449('0x60'),auth[_0xf449('0x8')](),controller[_0xf449('0x61')]);router['post'](_0xf449('0x3b'),auth[_0xf449('0x8')](),controller[_0xf449('0x62')]);router['put'](_0xf449('0x10'),auth[_0xf449('0x8')](),controller[_0xf449('0x63')]);router['put'](_0xf449('0x64'),auth[_0xf449('0x8')](),controller[_0xf449('0x65')]);router[_0xf449('0x66')](_0xf449('0x16'),auth[_0xf449('0x8')](),controller[_0xf449('0x67')]);router[_0xf449('0x66')]('/:id/teams',auth[_0xf449('0x8')](),controller[_0xf449('0x68')]);router[_0xf449('0x66')](_0xf449('0x10'),auth[_0xf449('0x8')](),controller[_0xf449('0x69')]);router[_0xf449('0x66')]('/:id/chat_interactions',auth[_0xf449('0x8')](),controller[_0xf449('0x6a')]);router[_0xf449('0x66')](_0xf449('0x52'),auth[_0xf449('0x8')](),controller['removeMailInteractions']);router['delete'](_0xf449('0x53'),auth[_0xf449('0x8')](),controller['removeFaxInteractions']);router[_0xf449('0x66')](_0xf449('0x55'),auth['isAuthenticated'](),controller[_0xf449('0x6b')]);router['delete'](_0xf449('0x57'),auth['isAuthenticated'](),controller[_0xf449('0x6c')]);router[_0xf449('0x66')](_0xf449('0x59'),auth[_0xf449('0x8')](),controller[_0xf449('0x6d')]);router['delete']('/:id/fax_accounts',auth[_0xf449('0x8')](),controller[_0xf449('0x6e')]);router[_0xf449('0x66')](_0xf449('0x30'),auth[_0xf449('0x8')](),controller[_0xf449('0x6f')]);router[_0xf449('0x66')](_0xf449('0x32'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0xf449('0x34'),auth[_0xf449('0x8')](),controller[_0xf449('0x70')]);router[_0xf449('0x66')](_0xf449('0x36'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xf449('0x66')](_0xf449('0x38'),auth[_0xf449('0x8')](),controller[_0xf449('0x71')]);router[_0xf449('0x66')](_0xf449('0x60'),auth[_0xf449('0x8')](),controller[_0xf449('0x72')]);router[_0xf449('0x66')]('/:id/api_key',auth[_0xf449('0x8')](),controller[_0xf449('0x73')]);module[_0xf449('0x74')]=router; \ No newline at end of file +var _0xe1fd=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','diskStorage','join','root','format','%s-%s','now','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','/:id/api_key','removeApiKey','exports','multer'];(function(_0x51beab,_0x321e83){var _0x157696=function(_0x2d6935){while(--_0x2d6935){_0x51beab['push'](_0x51beab['shift']());}};_0x157696(++_0x321e83);}(_0xe1fd,0x161));var _0xde1f=function(_0x15c031,_0xe01b15){_0x15c031=_0x15c031-0x0;var _0x39c520=_0xe1fd[_0x15c031];return _0x39c520;};'use strict';var multer=require(_0xde1f('0x0'));var util=require(_0xde1f('0x1'));var path=require(_0xde1f('0x2'));var timeout=require(_0xde1f('0x3'));var express=require('express');var router=express[_0xde1f('0x4')]();var fs_extra=require(_0xde1f('0x5'));var auth=require(_0xde1f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde1f('0x7'));router[_0xde1f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xde1f('0x8')](_0xde1f('0x9'),auth[_0xde1f('0xa')](),controller[_0xde1f('0xb')]);router[_0xde1f('0x8')](_0xde1f('0xc'),auth[_0xde1f('0xa')](),controller[_0xde1f('0xd')]);router['get'](_0xde1f('0xe'),auth['isAuthenticated'](),controller['getPresence']);router[_0xde1f('0x8')](_0xde1f('0xf'),auth['isAuthenticated'](),controller[_0xde1f('0x10')]);router['get'](_0xde1f('0x11'),controller[_0xde1f('0x12')]);router['get'](_0xde1f('0x13'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x14')]);router[_0xde1f('0x8')](_0xde1f('0x15'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x16')]);router[_0xde1f('0x8')](_0xde1f('0x17'),auth['isAuthenticated'](),controller['getQueues']);router[_0xde1f('0x8')]('/:id/queues_rt',auth[_0xde1f('0xa')](),controller[_0xde1f('0x18')]);router['get'](_0xde1f('0x19'),auth['isAuthenticated'](),controller[_0xde1f('0x1a')]);router[_0xde1f('0x8')](_0xde1f('0x1b'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x1c')]);router['get'](_0xde1f('0x1d'),auth['isAuthenticated'](),controller[_0xde1f('0x1e')]);router['get'](_0xde1f('0x1f'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x20')]);router['get'](_0xde1f('0x21'),auth[_0xde1f('0xa')](),controller['getOpenchannelInteractions']);router[_0xde1f('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xde1f('0x22')]);router[_0xde1f('0x8')](_0xde1f('0x23'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x24')]);router['get'](_0xde1f('0x25'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x26')]);router[_0xde1f('0x8')]('/:id/whatsapp/interactions',auth[_0xde1f('0xa')](),controller[_0xde1f('0x27')]);router[_0xde1f('0x8')]('/:id/teams',auth[_0xde1f('0xa')](),controller['getTeams']);router[_0xde1f('0x8')](_0xde1f('0x28'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x29')]);router[_0xde1f('0x8')]('/:id/agents',auth['isAuthenticated'](),controller[_0xde1f('0x2a')]);router['get'](_0xde1f('0x2b'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x2c')]);router[_0xde1f('0x8')](_0xde1f('0x2d'),auth['isAuthenticated'](),controller[_0xde1f('0x2e')]);router[_0xde1f('0x8')](_0xde1f('0x2f'),auth[_0xde1f('0xa')](),controller['getMailAccounts']);router[_0xde1f('0x8')](_0xde1f('0x30'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x31')]);router[_0xde1f('0x8')](_0xde1f('0x32'),auth['isAuthenticated'](),controller[_0xde1f('0x33')]);router[_0xde1f('0x8')](_0xde1f('0x34'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x35')]);router[_0xde1f('0x8')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xde1f('0x36')]);router['get'](_0xde1f('0x37'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x38')]);router['get'](_0xde1f('0x39'),auth['isAuthenticated'](),controller[_0xde1f('0x3a')]);router[_0xde1f('0x8')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xde1f('0x3b')]);router[_0xde1f('0x3c')](_0xde1f('0x15'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x3d')]);router[_0xde1f('0x3c')]('/',auth[_0xde1f('0xa')](),controller[_0xde1f('0x3e')]);router['post'](_0xde1f('0x3f'),auth[_0xde1f('0xa')](),controller['bulkCreate']);router[_0xde1f('0x3c')](_0xde1f('0x17'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xde1f('0x40')]({'destination':function(_0x5e163b,_0x53c41b,_0x57cc73){_0x57cc73(null,path[_0xde1f('0x41')](config[_0xde1f('0x42')],'server/files/images/'));},'filename':function(_0x2c9923,_0x3cff36,_0x467365){_0x467365(null,util[_0xde1f('0x43')](_0xde1f('0x44'),Date[_0xde1f('0x45')](),_0x3cff36['originalname']));}})});router[_0xde1f('0x3c')]('/:id/avatar',upload['single'](_0xde1f('0x46')),controller[_0xde1f('0x47')]);router[_0xde1f('0x3c')](_0xde1f('0x48'),auth['isAuthenticated'](),controller[_0xde1f('0x49')]);router[_0xde1f('0x3c')](_0xde1f('0x4a'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x4b')]);router[_0xde1f('0x3c')](_0xde1f('0x4c'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x4d')]);router[_0xde1f('0x3c')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xde1f('0x4e')]);router[_0xde1f('0x3c')](_0xde1f('0x4f'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x50')]);router[_0xde1f('0x3c')](_0xde1f('0x51'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x52')]);router[_0xde1f('0x3c')](_0xde1f('0x53'),auth['isAuthenticated'](),controller[_0xde1f('0x54')]);router[_0xde1f('0x3c')]('/:id/fax_interactions',auth[_0xde1f('0xa')](),controller['addFaxInteractions']);router[_0xde1f('0x3c')]('/:id/sms_interactions',auth[_0xde1f('0xa')](),controller[_0xde1f('0x55')]);router[_0xde1f('0x3c')]('/:id/openchannel_interactions',auth[_0xde1f('0xa')](),controller[_0xde1f('0x56')]);router[_0xde1f('0x3c')]('/:id/whatsapp_interactions',auth[_0xde1f('0xa')](),controller['addWhatsappInteractions']);router[_0xde1f('0x3c')](_0xde1f('0x2d'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x57')]);router[_0xde1f('0x3c')](_0xde1f('0x2f'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x58')]);router['post']('/:id/openchannel_accounts',auth[_0xde1f('0xa')](),controller[_0xde1f('0x59')]);router['post'](_0xde1f('0x32'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xde1f('0x3c')](_0xde1f('0x34'),auth['isAuthenticated'](),controller[_0xde1f('0x5a')]);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xde1f('0x5b')]);router['post']('/:id/square_projects',auth[_0xde1f('0xa')](),controller[_0xde1f('0x5c')]);router[_0xde1f('0x3c')]('/:id/api_key',auth[_0xde1f('0xa')](),controller[_0xde1f('0x5d')]);router[_0xde1f('0x5e')](_0xde1f('0xf'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x5f')]);router[_0xde1f('0x5e')](_0xde1f('0x60'),auth['isAuthenticated'](),controller[_0xde1f('0x61')]);router[_0xde1f('0x62')]('/:id/queues',auth[_0xde1f('0xa')](),controller[_0xde1f('0x63')]);router[_0xde1f('0x62')](_0xde1f('0x4f'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x64')]);router[_0xde1f('0x62')]('/:id',auth['isAuthenticated'](),controller[_0xde1f('0x65')]);router['delete'](_0xde1f('0x51'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x66')]);router[_0xde1f('0x62')](_0xde1f('0x53'),auth['isAuthenticated'](),controller[_0xde1f('0x67')]);router['delete'](_0xde1f('0x68'),auth['isAuthenticated'](),controller[_0xde1f('0x69')]);router[_0xde1f('0x62')](_0xde1f('0x6a'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x6b')]);router[_0xde1f('0x62')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xde1f('0x6c')]);router[_0xde1f('0x62')](_0xde1f('0x2d'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x6d')]);router[_0xde1f('0x62')](_0xde1f('0x2f'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x6e')]);router[_0xde1f('0x62')](_0xde1f('0x30'),auth[_0xde1f('0xa')](),controller['removeOpenchannelAccounts']);router[_0xde1f('0x62')](_0xde1f('0x32'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x6f')]);router[_0xde1f('0x62')](_0xde1f('0x34'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x70')]);router[_0xde1f('0x62')](_0xde1f('0x71'),auth['isAuthenticated'](),controller[_0xde1f('0x72')]);router[_0xde1f('0x62')](_0xde1f('0x37'),auth[_0xde1f('0xa')](),controller['removeSquareProjects']);router['delete'](_0xde1f('0x73'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x74')]);module[_0xde1f('0x75')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b6eb3d0..67999a3 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'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(_0x57e95a,_0x351f54){var _0x501616=function(_0x5dd098){while(--_0x5dd098){_0x57e95a['push'](_0x57e95a['shift']());}};_0x501616(++_0x351f54);}(_0x70e0,0x17b));var _0x070e=function(_0x9e6ad9,_0x254084){_0x9e6ad9=_0x9e6ad9-0x0;var _0x234ff2=_0x70e0[_0x9e6ad9];return _0x234ff2;};'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 5c4064a..57a96d0 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 _0xe7ff=['col','asc','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','offline','ringing','voiceStatus','busy','charAt','toUpperCase','slice','QueryTypes','select','ui.','InteractionId','field','ui.createdAt','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','squel','jayson/promise','ioredis','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','http','request\x20sent','debug','stringify','error','code','User,\x20%s,\x20%s','message','info','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','userNotification:recalc:','destroy','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','UserProfileResource','sendStatus','name','send','rawAttributes','fieldName','key','password','getOptions','where','includeAll','include','userSetting','UserSetting','attributes','push','User','findAll','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','model','keys','salt','query','filters','intersection','fields','length','merge','options','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','fullname','email','permissions','101','102','103','113','110','104','105','106','108','109','100','111','115','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','create','isEmpty','autoAssociation','compact','changePassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','QueueId','emit','toLowerCase','Queue:save','voice','VoiceQueue','get','online','format','SIP/%s','UserVoiceQueueRt','upsert','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','findOne','CmContact','sort','pick','hasOwnProperty','CmList','Tag','color','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','order','ChatGroup','getGroups','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','type','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','getTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','addTeams','Team','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','Voice','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','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','$or','$lt','$lte','$ne','$eq','$not','$between','$in','$notLike','$iLike','$notILike','$like','$contains','$contained','$any','firstName','Contact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','getPresence','teams','queues','inbound','getAgents','flatten','lower'];(function(_0x572e43,_0x32f0d){var _0xef2142=function(_0x146254){while(--_0x146254){_0x572e43['push'](_0x572e43['shift']());}};_0xef2142(++_0x32f0d);}(_0xe7ff,0x1b4));var _0xfe7f=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0xe7ff[_0x1abeb2];return _0x48da20;};'use strict';var moment=require(_0xfe7f('0x0'));var BPromise=require(_0xfe7f('0x1'));var util=require(_0xfe7f('0x2'));var path=require(_0xfe7f('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfe7f('0x4'));var jayson=require(_0xfe7f('0x5'));var Redis=require(_0xfe7f('0x6'));var authService=require('../../components/auth/service');var qs=require(_0xfe7f('0x7'));var logger=require('../../config/logger')(_0xfe7f('0x8'));var utils=require('../../config/utils');var config=require(_0xfe7f('0x9'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xfe7f('0xa'))[_0xfe7f('0xb')];var APINotFoundError=require(_0xfe7f('0xa'))[_0xfe7f('0xc')];var APIHandleError=require('../../errors/api')[_0xfe7f('0xd')];var db=require(_0xfe7f('0xe'))['db'];var socket=require(_0xfe7f('0xf'))(new Redis(config[_0xfe7f('0x10')]));require('./user.socket')[_0xfe7f('0x11')](socket);config['redis']=_[_0xfe7f('0x12')](config[_0xfe7f('0x10')],{'host':_0xfe7f('0x13'),'port':0x18eb});var client=jayson[_0xfe7f('0x14')][_0xfe7f('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x2b7a3c,_0x29e138,_0x2729dc,_0x5c1d45){return new BPromise(function(_0x399cdc,_0x270fa8){var _0x83f43e=_0x5c1d45||client;return _0x83f43e['request'](_0x2b7a3c,_0x2729dc)['then'](function(_0x38b37f){logger['info']('User,\x20%s,\x20%s',_0x29e138,_0xfe7f('0x16'));logger[_0xfe7f('0x17')]('User,\x20%s,\x20%s,\x20%s',_0x29e138,_0xfe7f('0x16'),JSON[_0xfe7f('0x18')](_0x38b37f));if(_0x38b37f[_0xfe7f('0x19')]){if(_0x38b37f[_0xfe7f('0x19')][_0xfe7f('0x1a')]===0x1f4){logger[_0xfe7f('0x19')](_0xfe7f('0x1b'),_0x29e138,_0x38b37f[_0xfe7f('0x19')][_0xfe7f('0x1c')]);return _0x270fa8(_0x38b37f[_0xfe7f('0x19')]['message']);}logger[_0xfe7f('0x19')](_0xfe7f('0x1b'),_0x29e138,_0x38b37f[_0xfe7f('0x19')][_0xfe7f('0x1c')]);return _0x399cdc(_0x38b37f[_0xfe7f('0x19')]['message']);}else{logger[_0xfe7f('0x1d')](_0xfe7f('0x1b'),_0x29e138,'request\x20sent');_0x399cdc(_0x38b37f[_0xfe7f('0x1e')]['message']);}})[_0xfe7f('0x1f')](function(_0x3ce31a){logger[_0xfe7f('0x19')](_0xfe7f('0x1b'),_0x29e138,_0x3ce31a);_0x270fa8(_0x3ce31a);});});}function respondWithStatusCode(_0x2842ec,_0x5c1aa7){_0x5c1aa7=_0x5c1aa7||0xcc;return function(_0x55d29f){if(_0x55d29f){return _0x2842ec['sendStatus'](_0x5c1aa7);}return _0x2842ec[_0xfe7f('0x20')](_0x5c1aa7)[_0xfe7f('0x21')]();};}function respondWithResult(_0x3f5e41,_0x5eb29d){_0x5eb29d=_0x5eb29d||0xc8;return function(_0x1b7cb3){if(_0x1b7cb3){return _0x3f5e41[_0xfe7f('0x20')](_0x5eb29d)['json'](_0x1b7cb3);}};}function respondWithFilteredResult(_0x35966c,_0x2ad1a9){return function(_0x5172fa){if(_0x5172fa){var _0x417f6b=typeof _0x2ad1a9[_0xfe7f('0x22')]===_0xfe7f('0x23')&&typeof _0x2ad1a9[_0xfe7f('0x24')]===_0xfe7f('0x23');var _0x4fb8b8=_0x5172fa[_0xfe7f('0x25')];var _0x3aada0=_0x417f6b?0x0:_0x2ad1a9[_0xfe7f('0x22')];var _0x4eac82=_0x417f6b?_0x5172fa[_0xfe7f('0x25')]:_0x2ad1a9[_0xfe7f('0x22')]+_0x2ad1a9[_0xfe7f('0x24')];var _0x5a667b;if(_0x4eac82>=_0x4fb8b8){_0x4eac82=_0x4fb8b8;_0x5a667b=0xc8;}else{_0x5a667b=0xce;}_0x35966c['status'](_0x5a667b);return _0x35966c[_0xfe7f('0x26')](_0xfe7f('0x27'),_0x3aada0+'-'+_0x4eac82+'/'+_0x4fb8b8)[_0xfe7f('0x28')](_0x5172fa);}return null;};}function saveUpdates(_0x5dece5){return function(_0x55ddc8){if(_0x55ddc8){return _0x55ddc8[_0xfe7f('0x29')](_0x5dece5)[_0xfe7f('0x2a')](function(_0x37428f){socket['emit'](_0xfe7f('0x2b')+_0x37428f['id'],{});return _0x37428f;});}return null;};}function removeEntity(_0x5aa44c){return function(_0x103db3){if(_0x103db3){return _0x103db3[_0xfe7f('0x2c')]()['then'](function(){var _0x1b3d91=_0x103db3['get']({'plain':!![]});if(_0x1b3d91['role']==='admin')return;var _0x5ad1ef=[{'name':_0xfe7f('0x2d'),'value':_0xfe7f('0x2e'),'ignore':!![]},{'name':_0xfe7f('0x2f'),'value':_0xfe7f('0x30'),'ignore':![]},{'name':_0xfe7f('0x31'),'value':_0xfe7f('0x32'),'ignore':![]}];var _0xf49176=_(_0x5ad1ef)[_0xfe7f('0x33')](_0xfe7f('0x34'))[_0xfe7f('0x35')]('value')[_0xfe7f('0x36')]();if(_[_0xfe7f('0x37')](_0xf49176,_0x1b3d91[_0xfe7f('0x38')])){return;}var _0x1aab32=_[_0xfe7f('0x39')](_0x5ad1ef,[_0xfe7f('0x36'),_0x1b3d91['role']])['name'];return db[_0xfe7f('0x3a')][_0xfe7f('0x2c')]({'where':{'type':_0x1aab32,'resourceId':_0x1b3d91['id']}})[_0xfe7f('0x2a')](function(){return _0x103db3;});})[_0xfe7f('0x2a')](function(){_0x5aa44c[_0xfe7f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28446e){return function(_0x24f8ec){if(!_0x24f8ec){_0x28446e[_0xfe7f('0x3b')](0x194);}return _0x24f8ec;};}function handleError(_0x2f0266,_0x5a9ebd){_0x5a9ebd=_0x5a9ebd||0x1f4;return function(_0x2ef2b6){logger[_0xfe7f('0x19')](_0x2ef2b6['stack']);if(_0x2ef2b6[_0xfe7f('0x3c')]){delete _0x2ef2b6[_0xfe7f('0x3c')];}_0x2f0266[_0xfe7f('0x20')](_0x5a9ebd)[_0xfe7f('0x3d')](_0x2ef2b6);};}exports['index']=function(_0x5ece0a,_0x3d1e42){var _0x25b6ca={},_0x58db79={'count':0x0,'rows':[]};var _0x31127c=_(db['User'][_0xfe7f('0x3e')])[_0xfe7f('0x35')](function(_0x593eaf){return{'name':_0x593eaf[_0xfe7f('0x3f')],'type':_0x593eaf['type'][_0xfe7f('0x40')]};})[_0xfe7f('0x33')](function(_0x5770cd){return!_['includes']([_0xfe7f('0x41'),'salt'],_0x5770cd[_0xfe7f('0x3c')]);})[_0xfe7f('0x36')]();_0x25b6ca=qs[_0xfe7f('0x42')](_0x31127c,_0x5ece0a);var _0x56cb36={'where':_0x25b6ca[_0xfe7f('0x43')]};return db['User'][_0xfe7f('0x25')](_0x56cb36)[_0xfe7f('0x2a')](function(_0x136596){_0x58db79[_0xfe7f('0x25')]=_0x136596;if(_0x5ece0a['query'][_0xfe7f('0x44')]){_0x25b6ca[_0xfe7f('0x45')]=[{'all':!![]}];}if(_0x5ece0a['query'][_0xfe7f('0x46')]==='true'){_0x25b6ca[_0xfe7f('0x45')]=[{'model':db[_0xfe7f('0x47')],'as':_0xfe7f('0x46')}];}if(!_[_0xfe7f('0x37')](_0x25b6ca[_0xfe7f('0x48')],'id')){_0x25b6ca[_0xfe7f('0x48')][_0xfe7f('0x49')]('id');}return db[_0xfe7f('0x4a')][_0xfe7f('0x4b')](_0x25b6ca);})[_0xfe7f('0x2a')](function(_0x2ee979){_0x58db79[_0xfe7f('0x4c')]=_0x2ee979;if(_0x5ece0a['query'][_0xfe7f('0x4d')]===_0xfe7f('0x4e')){var _0x49d01d=[];for(var _0x36a88c=0x0;_0x36a88c<_0x58db79[_0xfe7f('0x4c')]['length'];_0x36a88c++){_0x49d01d['push'](get_open_tabs(_0xfe7f('0x4f'),_0x58db79[_0xfe7f('0x4c')][_0x36a88c][_0xfe7f('0x50')]));_0x49d01d[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x51'),_0x58db79[_0xfe7f('0x4c')][_0x36a88c]['dataValues']));_0x49d01d[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x52'),_0x58db79[_0xfe7f('0x4c')][_0x36a88c][_0xfe7f('0x50')]));_0x49d01d[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x53'),_0x58db79[_0xfe7f('0x4c')][_0x36a88c][_0xfe7f('0x50')]));_0x49d01d[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x54'),_0x58db79[_0xfe7f('0x4c')][_0x36a88c][_0xfe7f('0x50')]));_0x49d01d[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x55'),_0x58db79[_0xfe7f('0x4c')][_0x36a88c][_0xfe7f('0x50')]));}return BPromise[_0xfe7f('0x56')](_0x49d01d)[_0xfe7f('0x2a')](function(){return _0x58db79;});}else{return _0x58db79;}})[_0xfe7f('0x2a')](respondWithFilteredResult(_0x3d1e42,_0x25b6ca))[_0xfe7f('0x1f')](handleError(_0x3d1e42,null));};exports[_0xfe7f('0x57')]=function(_0x50a27f,_0x2302b5){var _0x52d65b={'raw':![],'where':{'id':_0x50a27f[_0xfe7f('0x58')]['id']}},_0x30e8f5={};_0x30e8f5[_0xfe7f('0x59')]=_['differenceBy'](_[_0xfe7f('0x5a')](db['User']['rawAttributes']),[_0xfe7f('0x41'),_0xfe7f('0x5b')]);_0x30e8f5[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x50a27f[_0xfe7f('0x5c')]);_0x30e8f5[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x30e8f5[_0xfe7f('0x59')],_0x30e8f5['query']);_0x52d65b['attributes']=_[_0xfe7f('0x5e')](_0x30e8f5[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x50a27f['query']['fields']));_0x52d65b[_0xfe7f('0x48')]=_0x52d65b[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x52d65b['attributes']:_0x30e8f5[_0xfe7f('0x59')];if(_0x50a27f[_0xfe7f('0x5c')][_0xfe7f('0x44')]){_0x52d65b[_0xfe7f('0x45')]=[{'all':!![]}];}if(_0x50a27f[_0xfe7f('0x5c')][_0xfe7f('0x46')]===_0xfe7f('0x4e')){_0x52d65b[_0xfe7f('0x45')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x52d65b=_[_0xfe7f('0x61')]({},_0x52d65b,_0x50a27f[_0xfe7f('0x62')]);if(!_[_0xfe7f('0x37')](_0x52d65b[_0xfe7f('0x48')],'id')){_0x52d65b[_0xfe7f('0x48')][_0xfe7f('0x49')]('id');}return db['User'][_0xfe7f('0x39')](_0x52d65b)[_0xfe7f('0x2a')](handleEntityNotFound(_0x2302b5,null))['then'](function(_0x250b0d){var _0x483b7e=[];values=_0x250b0d;if(_0x50a27f[_0xfe7f('0x5c')][_0xfe7f('0x4d')]===_0xfe7f('0x4e')){_0x483b7e['push'](get_open_tabs(_0xfe7f('0x4f'),_0x250b0d[_0xfe7f('0x50')]));_0x483b7e[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x51'),_0x250b0d[_0xfe7f('0x50')]));_0x483b7e['push'](get_open_tabs('openchannel',_0x250b0d[_0xfe7f('0x50')]));_0x483b7e['push'](get_open_tabs('whatsapp',_0x250b0d[_0xfe7f('0x50')]));_0x483b7e['push'](get_open_tabs(_0xfe7f('0x52'),_0x250b0d[_0xfe7f('0x50')]));_0x483b7e[_0xfe7f('0x49')](get_open_tabs('mail',_0x250b0d[_0xfe7f('0x50')]));return BPromise[_0xfe7f('0x56')](_0x483b7e);}else{return values;}})[_0xfe7f('0x2a')](function(){return values;})[_0xfe7f('0x2a')](respondWithResult(_0x2302b5,null))[_0xfe7f('0x1f')](handleError(_0x2302b5,null));};exports[_0xfe7f('0x29')]=function(_0x39194f,_0x518378){if(_0x39194f['body']['id']){delete _0x39194f[_0xfe7f('0x63')]['id'];}delete _0x39194f[_0xfe7f('0x63')]['role'];return db['User']['find']({'where':{'id':_0x39194f[_0xfe7f('0x58')]['id']}})['then'](handleEntityNotFound(_0x518378,null))['then'](saveUpdates(_0x39194f[_0xfe7f('0x63')],null))['then'](respondWithResult(_0x518378,null))[_0xfe7f('0x1f')](handleError(_0x518378,null));};exports[_0xfe7f('0x64')]=function(_0x4337bb,_0x793e28){return db[_0xfe7f('0x4a')][_0xfe7f('0x64')]()[_0xfe7f('0x2a')](respondWithResult(_0x793e28,null))[_0xfe7f('0x1f')](handleError(_0x793e28,null));};exports[_0xfe7f('0x65')]=function(_0x143fdf,_0x45b05e){return db[_0xfe7f('0x4a')]['find']({'where':{'id':_0x143fdf['params']['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x45b05e,null))[_0xfe7f('0x2a')](function(_0x53848e){if(_0x53848e){return _0x53848e[_0xfe7f('0x65')](_0x143fdf[_0xfe7f('0x63')]['ids'],_[_0xfe7f('0x66')](_0x143fdf[_0xfe7f('0x63')],[_0xfe7f('0x67'),'id'])||{});}})[_0xfe7f('0x2a')](respondWithResult(_0x45b05e,null))[_0xfe7f('0x1f')](handleError(_0x45b05e,null));};function validateUser(_0x207f4c){return new BPromise(function(_0x3421fc,_0x1bc148){if(_0x207f4c[_0xfe7f('0x68')])return _0x3421fc(_0x207f4c);return db[_0xfe7f('0x69')][_0xfe7f('0x6a')](0x1)[_0xfe7f('0x2a')](function(_0x1016d3){if(_0x1016d3[_0xfe7f('0x6b')])authService[_0xfe7f('0x6c')](_0x207f4c['password']);db['User']['max'](_0xfe7f('0x68'))['then'](function(_0x338adc){if(_[_0xfe7f('0x6d')](_0x338adc)){_0x207f4c['internal']=_0x1016d3[_0xfe7f('0x6e')]||0x1;return;}if(_['isNil'](_0x1016d3[_0xfe7f('0x6e')])||_0x1016d3[_0xfe7f('0x6e')]===_0x338adc){_0x207f4c['internal']=_0x338adc+0x1;return;}if(_0x1016d3['min_internal']>_0x338adc){_0x207f4c[_0xfe7f('0x68')]=_0x1016d3[_0xfe7f('0x6e')];return;}return db[_0xfe7f('0x6f')][_0xfe7f('0x5c')](_0xfe7f('0x70'),{'type':db[_0xfe7f('0x6f')]['QueryTypes'][_0xfe7f('0x71')]})[_0xfe7f('0x2a')](function(_0x27c016){if(_0x27c016&&_0x27c016[_0xfe7f('0x60')]){for(var _0x32fb92=0x0,_0x5b4b31=_0x27c016[_0xfe7f('0x60')];_0x32fb92<_0x5b4b31&&_[_0xfe7f('0x6d')](_0x207f4c[_0xfe7f('0x68')]);_0x32fb92++){if(_0x1016d3[_0xfe7f('0x6e')]<=_0x27c016[_0x32fb92][_0xfe7f('0x72')]){_0x207f4c[_0xfe7f('0x68')]=_0x27c016[_0x32fb92][_0xfe7f('0x72')];}else if(_0x1016d3['min_internal']>_0x27c016[_0x32fb92][_0xfe7f('0x72')]&&_0x1016d3[_0xfe7f('0x6e')]<=_0x27c016[_0x32fb92]['to']){_0x207f4c[_0xfe7f('0x68')]=_0x1016d3[_0xfe7f('0x6e')];}}}if(_['isNil'](_0x207f4c['internal'])){_0x207f4c[_0xfe7f('0x68')]=_0x338adc+0x1;}return _0x3421fc(_0x207f4c);});});})[_0xfe7f('0x1f')](function(_0x1fddf2){_0x1bc148(_0x1fddf2);});});}function updateUser(_0x1d899c){return new BPromise(function(_0x2d20e4,_0x339315){try{if(_0x1d899c[_0xfe7f('0x73')]){_0x1d899c[_0xfe7f('0x74')]=_0x1d899c[_0xfe7f('0x68')];_0x1d899c['VoiceMail']={'mailbox':_0x1d899c['internal'],'password':_0x1d899c[_0xfe7f('0x41')],'fullname':_0x1d899c[_0xfe7f('0x75')],'email':_0x1d899c[_0xfe7f('0x76')]};}if(_0x1d899c[_0xfe7f('0x38')]===_0xfe7f('0x30')){if(!_0x1d899c[_0xfe7f('0x77')])_0x1d899c[_0xfe7f('0x77')]=[_0xfe7f('0x78'),_0xfe7f('0x79'),_0xfe7f('0x7a'),_0xfe7f('0x7b'),_0xfe7f('0x7c'),_0xfe7f('0x7d'),_0xfe7f('0x7e'),_0xfe7f('0x7f'),'107',_0xfe7f('0x80'),_0xfe7f('0x81'),_0xfe7f('0x82'),_0xfe7f('0x83'),'114',_0xfe7f('0x84')];}_0x2d20e4(_0x1d899c);}catch(_0x9eba28){_0x339315(_0x9eba28);}});}exports['create']=function(_0x6237a1,_0x5423ac){if(_0x6237a1[_0xfe7f('0x2e')]['role']===_0xfe7f('0x30'))throw new Error(_0xfe7f('0x85'));if(_0x6237a1['body'][_0xfe7f('0x38')]===_0xfe7f('0x2e')&&_0x6237a1[_0xfe7f('0x2e')][_0xfe7f('0x38')]!==_0xfe7f('0x86')){throw new Error(_0xfe7f('0x87'));}if(_0x6237a1['body']['role']===_0xfe7f('0x86')&&_0x6237a1[_0xfe7f('0x2e')][_0xfe7f('0x38')]!==_0xfe7f('0x86')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xfe7f('0x88')]([_0x6237a1[_0xfe7f('0x63')]])['then'](function(){return validateUser(_0x6237a1['body']);})[_0xfe7f('0x2a')](function(_0xbcb506){return updateUser(_0xbcb506)[_0xfe7f('0x2a')](function(_0x5ec303){if(_0x5ec303[_0xfe7f('0x38')]===_0xfe7f('0x86')){_0x5ec303['settingsEnabled']=_0x6237a1['user'][_0xfe7f('0x89')];delete _0x5ec303[_0xfe7f('0x8a')];}return _0x5ec303;});})[_0xfe7f('0x2a')](function(_0x49ba50){return db[_0xfe7f('0x4a')]['create'](_0x49ba50,{'include':[{'model':db[_0xfe7f('0x8b')],'as':'VoiceMail'}]});})[_0xfe7f('0x2a')](function(_0x5dcb54){if(_0x6237a1[_0xfe7f('0x63')][_0xfe7f('0x38')]===_0xfe7f('0x2e'))return _0x5dcb54;if(_0x6237a1[_0xfe7f('0x2e')]['role']!=='user')return _0x5dcb54;return db[_0xfe7f('0x8c')][_0xfe7f('0x39')]({'where':{'name':_0x5dcb54[_0xfe7f('0x38')]==='agent'?'Agents':_0xfe7f('0x31'),'userProfileId':_0x6237a1[_0xfe7f('0x2e')]['userProfileId']},'raw':!![]})[_0xfe7f('0x2a')](function(_0x4bdfda){if(!_0x4bdfda||_0x4bdfda['autoAssociation']!=0x0)return _0x5dcb54;return db[_0xfe7f('0x3a')]['create']({'name':_0x5dcb54[_0xfe7f('0x3c')],'resourceId':_0x5dcb54['id'],'type':_0x4bdfda[_0xfe7f('0x3c')],'sectionId':_0x4bdfda['id']},{})[_0xfe7f('0x2a')](function(){return _0x5dcb54;});})['catch'](function(_0x56fd32){logger[_0xfe7f('0x19')](_0xfe7f('0x8d'),_0x56fd32);throw _0x56fd32;});})[_0xfe7f('0x2a')](respondWithResult(_0x5423ac,0xc9))['catch'](handleError(_0x5423ac,null));};exports[_0xfe7f('0x8e')]=function(_0x1b7a7d,_0x179242){var _0x296b8d=_0x1b7a7d['body'];var _0x7d7ef5=[];if(_0x1b7a7d['user'][_0xfe7f('0x38')]==='agent')throw new Error(_0xfe7f('0x85'));if(_['some'](_0x296b8d,[_0xfe7f('0x38'),_0xfe7f('0x2e')])&&_0x1b7a7d[_0xfe7f('0x2e')][_0xfe7f('0x38')]!=='admin'){throw new Error(_0xfe7f('0x87'));}if(_[_0xfe7f('0x8f')](_0x296b8d,[_0xfe7f('0x38'),'admin'])&&_0x1b7a7d[_0xfe7f('0x2e')]['role']!=='admin'){throw new Error(_0xfe7f('0x90'));}return licenseUtil[_0xfe7f('0x88')](_0x296b8d)[_0xfe7f('0x2a')](function(){return validateUser(_0x296b8d[0x0]);})['then'](function(){for(var _0x4bf6c4=0x1;_0x4bf6c4<_0x296b8d[_0xfe7f('0x60')];_0x4bf6c4++){var _0x2b9f4a=_0x296b8d[_0x4bf6c4-0x1][_0xfe7f('0x68')];if(!_0x296b8d[_0x4bf6c4]['internal'])_0x296b8d[_0x4bf6c4][_0xfe7f('0x68')]=_0x2b9f4a+0x1;_0x7d7ef5[_0xfe7f('0x49')](validateUser(_0x296b8d[_0x4bf6c4]));}return BPromise[_0xfe7f('0x56')](_0x7d7ef5);})[_0xfe7f('0x2a')](function(){_0x7d7ef5=[];for(var _0xa7dced=0x0;_0xa7dced<_0x296b8d['length'];_0xa7dced++){_0x7d7ef5[_0xfe7f('0x49')](updateUser(_0x296b8d[_0xa7dced]));}return BPromise[_0xfe7f('0x56')](_0x7d7ef5);})['then'](function(){return BPromise[_0xfe7f('0x91')](_0x296b8d,function(_0x2d8403){return db[_0xfe7f('0x4a')][_0xfe7f('0x92')](_0x2d8403,{'include':[{'model':db[_0xfe7f('0x8b')],'as':_0xfe7f('0x8b')}]})[_0xfe7f('0x2a')](function(_0x528aaa){_0x2d8403['id']=_0x528aaa['id'];return _0x2d8403;});});})[_0xfe7f('0x2a')](function(_0x31e163){if(_0x1b7a7d['body']['role']===_0xfe7f('0x2e'))return _0x31e163;if(_0x1b7a7d[_0xfe7f('0x2e')]['role']!==_0xfe7f('0x2e'))return _0x31e163;var _0x371a86=_[_0xfe7f('0x8f')](_0x31e163,function(_0xeb4c10){return _0xeb4c10[_0xfe7f('0x38')]===_0xfe7f('0x30')||_0xeb4c10['role']===_0xfe7f('0x32');});if(!_0x371a86)return _0x31e163;return db[_0xfe7f('0x8c')][_0xfe7f('0x4b')]({'where':{'name':{'$or':[_0xfe7f('0x2f'),_0xfe7f('0x31')]},'userProfileId':_0x1b7a7d['user']['userProfileId']},'raw':!![]})[_0xfe7f('0x2a')](function(_0x123dc6){if(_[_0xfe7f('0x93')](_0x123dc6)||!_[_0xfe7f('0x8f')](_0x123dc6,[_0xfe7f('0x94'),0x0]))return _0x31e163;_0x7d7ef5=[];var _0x5a1fdd=_(_0x123dc6)[_0xfe7f('0x35')](function(_0x33d475){if(_0x33d475[_0xfe7f('0x94')]===0x1)return;return _0x33d475['name']===_0xfe7f('0x2f')?_0xfe7f('0x30'):_0xfe7f('0x32');})[_0xfe7f('0x95')]()[_0xfe7f('0x36')]();for(var _0xaa34e7=0x0;_0xaa34e7<_0x31e163['length'];_0xaa34e7++){if(!_['includes'](_0x5a1fdd,_0x31e163[_0xaa34e7]['role']))return;var _0x6e37f5=_0x31e163[_0xaa34e7][_0xfe7f('0x38')]===_0xfe7f('0x30')?_0xfe7f('0x2f'):'Telephones';_0x7d7ef5[_0xfe7f('0x49')](db['UserProfileResource'][_0xfe7f('0x92')]({'name':_0x31e163[_0xaa34e7][_0xfe7f('0x3c')],'resourceId':_0x31e163[_0xaa34e7]['id'],'type':_0x6e37f5,'sectionId':_[_0xfe7f('0x39')](_0x123dc6,[_0xfe7f('0x3c'),_0x6e37f5])['id']},{}));}return BPromise[_0xfe7f('0x56')](_0x7d7ef5);});})[_0xfe7f('0x2a')](respondWithResult(_0x179242,0xc9))[_0xfe7f('0x1f')](handleError(_0x179242,null));};exports[_0xfe7f('0x96')]=function(_0x519b7b,_0x127017){if(_0x519b7b[_0xfe7f('0x63')]['id']){delete _0x519b7b[_0xfe7f('0x63')]['id'];}return db['User'][_0xfe7f('0x39')]({'where':{'id':_0x519b7b[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](function(_0x3d15d6){if(!_0x3d15d6)return null;if(_0x3d15d6['id']===_0x519b7b[_0xfe7f('0x2e')]['id']){if(!_0x519b7b['body']['oldPassword']||!_0x519b7b[_0xfe7f('0x63')][_0xfe7f('0x97')]){throw new db['Sequelize']['ValidationError'](_0xfe7f('0x98'));}if(!_0x3d15d6[_0xfe7f('0x99')](_0x519b7b['body'][_0xfe7f('0x9a')])){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0x9d'));}if(_0x519b7b[_0xfe7f('0x63')][_0xfe7f('0x9a')]===_0x519b7b['body'][_0xfe7f('0x97')]){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0x9e'));}}else if(_0x519b7b['user'][_0xfe7f('0x38')]===_0xfe7f('0x86')){if(!_0x519b7b[_0xfe7f('0x63')][_0xfe7f('0x97')]){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0x9f'));}}else if(_0x519b7b[_0xfe7f('0x2e')][_0xfe7f('0x38')]==='user'){if(!_0x519b7b[_0xfe7f('0x63')][_0xfe7f('0x97')]){throw new db['Sequelize'][(_0xfe7f('0x9c'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3d15d6['role']!==_0xfe7f('0x30')){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0x85'));}}else{throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0x85'));}return _0x3d15d6;})[_0xfe7f('0x2a')](handleEntityNotFound(_0x127017,null))[_0xfe7f('0x2a')](function(_0x1b189b){return db['Setting']['findOne']({'attributes':['id','securePassword',_0xfe7f('0xa0'),_0xfe7f('0xa1')]})[_0xfe7f('0x2a')](function(_0x824d26){if(_0x824d26['securePassword'])authService[_0xfe7f('0x6c')](_0x519b7b[_0xfe7f('0x63')]['newPassword']);if(!_0x824d26[_0xfe7f('0xa0')]||!_0x1b189b[_0xfe7f('0xa2')])return _0x1b189b;authService['validatePasswordHistory'](_0x519b7b[_0xfe7f('0x63')][_0xfe7f('0x97')],_0x1b189b[_0xfe7f('0xa2')],_0x824d26['passwordHistoryLimit']);return _0x1b189b;})[_0xfe7f('0x2a')](saveUpdates({'password':_0x519b7b[_0xfe7f('0x63')][_0xfe7f('0x97')],'passwordResetAt':_0x519b7b[_0xfe7f('0x2e')]['id']==_0x519b7b[_0xfe7f('0x58')]['id']?moment():null,'previousPasswords':authService[_0xfe7f('0xa3')](_0x519b7b[_0xfe7f('0x63')]['newPassword'],_0x1b189b['previousPasswords'])},null));})[_0xfe7f('0x2a')](respondWithResult(_0x127017,null))[_0xfe7f('0x1f')](handleError(_0x127017,null));};exports[_0xfe7f('0xa4')]=function(_0x5c60e1,_0x5b4146){var _0x42c094=_0x5c60e1['body'][_0xfe7f('0xa5')];return db[_0xfe7f('0x4a')][_0xfe7f('0x39')]({'where':{'id':_0x5c60e1['params']['id']},'attributes':['id',_0xfe7f('0x3c'),'role','online','loginInPause',_0xfe7f('0xa6'),_0xfe7f('0xa7')]})['then'](handleEntityNotFound(_0x5b4146,null))['then'](function(_0x44e531){if(_0x44e531){if(!utils[_0xfe7f('0xa8')](_0x42c094)){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0xa9'));}return _0x44e531[_0xfe7f('0xaa')+_[_0xfe7f('0xab')](_0x42c094['toLowerCase']())+_0xfe7f('0xac')](_0x5c60e1['body']['ids'],{'penalty':_0x5c60e1[_0xfe7f('0x63')][_0xfe7f('0xad')]||0x0})[_0xfe7f('0xae')](function(_0x52b403){for(var _0x271c49=0x0;_0x271c49<_0x5c60e1[_0xfe7f('0x63')][_0xfe7f('0x67')][_0xfe7f('0x60')];_0x271c49+=0x1){var _0x215ca6={'UserId':Number(_0x5c60e1['params']['id'])};_0x215ca6[_[_0xfe7f('0xab')](_0x42c094['toLowerCase']())+_0xfe7f('0xaf')]=Number(_0x5c60e1['body'][_0xfe7f('0x67')][_0x271c49]);socket[_0xfe7f('0xb0')](_0xfe7f('0x2e')+_[_0xfe7f('0xab')](_0x42c094[_0xfe7f('0xb1')]())+_0xfe7f('0xb2'),_0x215ca6);}return _0x52b403;})[_0xfe7f('0x2a')](function(){if(_0x42c094===_0xfe7f('0xb3')){return db[_0xfe7f('0xb4')][_0xfe7f('0x4b')]({'where':{'id':_0x5c60e1[_0xfe7f('0x63')][_0xfe7f('0x67')]||[]},'raw':!![],'attributes':['id',_0xfe7f('0x3c')]});}})[_0xfe7f('0x2a')](function(_0x2227b9){var _0x455272=_0x44e531[_0xfe7f('0xb5')]({'plain':!![]});var _0x356c49=[];if(_0x42c094===_0xfe7f('0xb3')&&_0x455272[_0xfe7f('0x38')]===_0xfe7f('0x30')&&_0x455272[_0xfe7f('0xb6')]){for(var _0x3ea997=0x0;_0x3ea997<_0x2227b9[_0xfe7f('0x60')];_0x3ea997+=0x1){_0x356c49[_0xfe7f('0x49')]({'membername':_0x455272[_0xfe7f('0x3c')],'UserId':_0x455272['id'],'queue_name':_0x2227b9[_0x3ea997][_0xfe7f('0x3c')],'VoiceQueueId':_0x2227b9[_0x3ea997]['id'],'interface':_[_0xfe7f('0x6d')](_0x455272[_0xfe7f('0xa7')])?util[_0xfe7f('0xb7')](_0xfe7f('0xb8'),_0x455272[_0xfe7f('0x3c')]):_0x455272[_0xfe7f('0xa7')],'paused':_0x455272['voicePause']||![],'penalty':_0x5c60e1[_0xfe7f('0x63')][_0xfe7f('0xad')]||0x0});}return BPromise[_0xfe7f('0x91')](_0x356c49,function(_0x52933c){return db[_0xfe7f('0xb9')][_0xfe7f('0xba')](_0x52933c);});}return _0x44e531;});}})[_0xfe7f('0x2a')](respondWithStatusCode(_0x5b4146,null))[_0xfe7f('0x1f')](handleError(_0x5b4146,null));};exports['removeQueues']=function(_0x20d6d2,_0x320285){var _0x5b1ff2,_0x21746d;return db['User'][_0xfe7f('0x39')]({'where':{'id':_0x20d6d2[_0xfe7f('0x58')]['id']},'attributes':['id',_0xfe7f('0x3c'),_0xfe7f('0x38')]})[_0xfe7f('0x2a')](handleEntityNotFound(_0x320285,null))[_0xfe7f('0x2a')](function(_0x3f3d1e){if(_0x3f3d1e){_0x5b1ff2=_0x3f3d1e;if(!_0x20d6d2[_0xfe7f('0x5c')][_0xfe7f('0xa5')]||!utils[_0xfe7f('0xa8')](_0x20d6d2['query'][_0xfe7f('0xa5')])){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))]('Unknown\x20channel');}return _0x3f3d1e[_0xfe7f('0xbb')+_['capitalize'](_0x20d6d2['query'][_0xfe7f('0xa5')]['toLowerCase']())+'Queues'](_0x20d6d2[_0xfe7f('0x5c')][_0xfe7f('0x67')]);}})[_0xfe7f('0x2a')](function(_0x16b04a){if(_[_0xfe7f('0xbc')](_0x20d6d2[_0xfe7f('0x5c')][_0xfe7f('0x67')])){for(var _0x100c77=0x0;_0x100c77<_0x20d6d2[_0xfe7f('0x5c')]['ids'][_0xfe7f('0x60')];_0x100c77+=0x1){_0x21746d={'UserId':Number(_0x20d6d2[_0xfe7f('0x58')]['id'])};_0x21746d[_[_0xfe7f('0xab')](_0x20d6d2[_0xfe7f('0x5c')][_0xfe7f('0xa5')][_0xfe7f('0xb1')]())+_0xfe7f('0xaf')]=Number(_0x20d6d2[_0xfe7f('0x5c')][_0xfe7f('0x67')][_0x100c77]);socket[_0xfe7f('0xb0')]('user'+_[_0xfe7f('0xab')](_0x20d6d2['query'][_0xfe7f('0xa5')][_0xfe7f('0xb1')]())+_0xfe7f('0xbd'),_0x21746d);}}else{_0x21746d={'UserId':Number(_0x20d6d2[_0xfe7f('0x58')]['id'])};_0x21746d[_['capitalize'](_0x20d6d2[_0xfe7f('0x5c')]['channel']['toLowerCase']())+_0xfe7f('0xaf')]=Number(_0x20d6d2[_0xfe7f('0x5c')][_0xfe7f('0x67')]);socket[_0xfe7f('0xb0')](_0xfe7f('0x2e')+_[_0xfe7f('0xab')](_0x20d6d2[_0xfe7f('0x5c')]['channel'][_0xfe7f('0xb1')]())+_0xfe7f('0xbd'),_0x21746d);}return _0x16b04a;})[_0xfe7f('0x2a')](function(){if(_0x20d6d2[_0xfe7f('0x5c')][_0xfe7f('0xa5')]===_0xfe7f('0xb3')){return db['UserVoiceQueueRt'][_0xfe7f('0x2c')]({'where':{'UserId':_0x20d6d2['params']['id'],'VoiceQueueId':_0x20d6d2[_0xfe7f('0x5c')]['ids']},'individualHooks':!![]})[_0xfe7f('0x2a')](function(){return _0x5b1ff2;});}return _0x5b1ff2;})['then'](respondWithStatusCode(_0x320285,null))[_0xfe7f('0x1f')](handleError(_0x320285,null));};exports[_0xfe7f('0xbe')]=function(_0x37ffa4,_0x57e03b){_0x37ffa4['body'][_0xfe7f('0xbf')]=_0x37ffa4[_0xfe7f('0xc0')][_0xfe7f('0xc1')];return db['User'][_0xfe7f('0x39')]({'where':{'id':_0x37ffa4[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x57e03b,null))[_0xfe7f('0x2a')](saveUpdates(_0x37ffa4[_0xfe7f('0x63')],null))[_0xfe7f('0x2a')](respondWithResult(_0x57e03b,null))[_0xfe7f('0x1f')](handleError(_0x57e03b,null));};exports[_0xfe7f('0xc2')]=function(_0x2cb0d9,_0xe7d73c){var _0x2dc487=path[_0xfe7f('0xc3')](config[_0xfe7f('0xc4')],_0xfe7f('0xc5'));return db[_0xfe7f('0x4a')][_0xfe7f('0x39')]({'where':{'id':_0x2cb0d9[_0xfe7f('0x58')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xfe7f('0x2a')](handleEntityNotFound(_0xe7d73c,null))['then'](function(_0x3fdc37){if(_0x3fdc37){if(_[_0xfe7f('0x6d')](_0x3fdc37['userpic'])){return _0xe7d73c[_0xfe7f('0xc6')](_0x2dc487);}else{if(!fs[_0xfe7f('0xc7')](path['join'](config[_0xfe7f('0xc4')],_0xfe7f('0xc8'),_0x3fdc37[_0xfe7f('0xbf')]))){return _0xe7d73c[_0xfe7f('0xc6')](_0x2dc487);}return _0xe7d73c['download'](path['join'](config[_0xfe7f('0xc4')],_0xfe7f('0xc8'),_0x3fdc37[_0xfe7f('0xbf')]));}}})[_0xfe7f('0x1f')](handleError(_0xe7d73c,null));};exports[_0xfe7f('0xc9')]=function(_0x34cefe,_0xa56435){return db['User'][_0xfe7f('0x39')]({'where':{'id':_0x34cefe[_0xfe7f('0x58')]['id']},'attributes':['id']})[_0xfe7f('0x2a')](handleEntityNotFound(_0xa56435,null))[_0xfe7f('0x2a')](function(_0x59d767){var _0x219c58=[];values=_0x59d767[_0xfe7f('0x50')];_0x219c58[_0xfe7f('0x49')](get_open_tabs('chat',_0x59d767[_0xfe7f('0x50')]));_0x219c58['push'](get_open_tabs(_0xfe7f('0x51'),_0x59d767['dataValues']));_0x219c58[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x54'),_0x59d767[_0xfe7f('0x50')]));_0x219c58['push'](get_open_tabs(_0xfe7f('0x55'),_0x59d767[_0xfe7f('0x50')]));_0x219c58['push'](get_open_tabs(_0xfe7f('0x52'),_0x59d767[_0xfe7f('0x50')]));_0x219c58[_0xfe7f('0x49')](get_open_tabs(_0xfe7f('0x53'),_0x59d767[_0xfe7f('0x50')]));return BPromise[_0xfe7f('0x56')](_0x219c58);})['then'](function(_0x4b865d){if(_0x4b865d){var _0x1b9f3a=_['map'](values[_0xfe7f('0xca')],function(_0x308ccc){return{'channel':_0xfe7f('0xcb'),'id':_0x308ccc['id'],'createdAt':_0x308ccc['createdAt']};});var _0x34ce1c=_[_0xfe7f('0x35')](values[_0xfe7f('0xcc')],function(_0x5a89c2){return{'channel':'FAX','id':_0x5a89c2['id'],'createdAt':_0x5a89c2[_0xfe7f('0xcd')]};});var _0x93ab5e=_[_0xfe7f('0x35')](values[_0xfe7f('0xce')],function(_0x2e896a){return{'channel':_0xfe7f('0xcf'),'id':_0x2e896a['id'],'createdAt':_0x2e896a[_0xfe7f('0xcd')]};});var _0x296daf=_[_0xfe7f('0x35')](values[_0xfe7f('0xd0')],function(_0x3d5f23){return{'channel':_0xfe7f('0xd1'),'id':_0x3d5f23['id'],'createdAt':_0x3d5f23[_0xfe7f('0xcd')]};});var _0x576dd8=_[_0xfe7f('0x35')](values[_0xfe7f('0xd2')],function(_0x24e0bb){return{'channel':_0xfe7f('0xd3'),'id':_0x24e0bb['id'],'createdAt':_0x24e0bb[_0xfe7f('0xcd')]};});var _0x472ca3=_[_0xfe7f('0x35')](values[_0xfe7f('0xd4')],function(_0x567eb2){return{'channel':'WHATSAPP','id':_0x567eb2['id'],'createdAt':_0x567eb2['createdAt']};});var _0x35bfb6=_[_0xfe7f('0xd5')](_0x1b9f3a,_0x34ce1c,_0x93ab5e,_0x296daf,_0x576dd8,_0x472ca3);var _0x3b7491={'count':_0x35bfb6['length'],'rows':_0x35bfb6};return _0x3b7491;}else return null;})[_0xfe7f('0x2a')](respondWithResult(_0xa56435,null))[_0xfe7f('0x1f')](handleError(_0xa56435,null));};exports[_0xfe7f('0xd6')]=function(_0x212633,_0x368a4a){var _0x757fdb={};var _0x186bc2={};var _0x36167e;var _0x588b6b;return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x212633[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x368a4a,null))[_0xfe7f('0x2a')](function(_0x1add97){if(_0x1add97){_0x36167e=_0x1add97;_0x186bc2['model']=_[_0xfe7f('0x5a')](db[_0xfe7f('0xd8')]['rawAttributes']);_0x186bc2[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x212633['query']);_0x186bc2[_0xfe7f('0x5d')]=_['intersection'](_0x186bc2['model'],_0x186bc2[_0xfe7f('0x5c')]);_0x757fdb[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x186bc2[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x212633[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x757fdb[_0xfe7f('0x48')]=_0x757fdb['attributes'][_0xfe7f('0x60')]?_0x757fdb['attributes']:_0x186bc2['model'];_0x757fdb['order']=qs[_0xfe7f('0xd9')](_0x212633[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x757fdb[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x212633[_0xfe7f('0x5c')],_0x186bc2[_0xfe7f('0x5d')]));if(_0x212633[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x757fdb['where']=_['merge'](_0x757fdb['where'],{'$or':_[_0xfe7f('0x35')](_0x757fdb['attributes'],function(_0x161518){var _0x9503cc={};_0x9503cc[_0x161518]={'$like':'%'+_0x212633[_0xfe7f('0x5c')]['filter']+'%'};return _0x9503cc;})});}_0x757fdb=_[_0xfe7f('0x61')]({},_0x757fdb,_0x212633[_0xfe7f('0x62')]);return _0x36167e[_0xfe7f('0xd6')](_0x757fdb);}})[_0xfe7f('0x2a')](function(_0x883d93){if(_0x883d93){_0x588b6b=_0x883d93[_0xfe7f('0x60')];if(_0x212633[_0xfe7f('0x5c')][_0xfe7f('0xdb')]('includeAll')){_0x757fdb[_0xfe7f('0x45')]=[{'model':db[_0xfe7f('0xdc')],'as':'List','required':![]},{'model':db[_0xfe7f('0xdd')],'as':'Tags','attributes':['id','name',_0xfe7f('0xde')],'where':_0x212633[_0xfe7f('0x5c')][_0xfe7f('0xdf')]?{'id':_0x212633['query'][_0xfe7f('0xdf')]}:undefined,'required':_0x212633[_0xfe7f('0x5c')][_0xfe7f('0xdf')]?!![]:![]}];}if(!_0x212633[_0xfe7f('0x5c')][_0xfe7f('0xdb')](_0xfe7f('0xe0'))){_0x757fdb['limit']=qs[_0xfe7f('0x24')](_0x212633[_0xfe7f('0x5c')][_0xfe7f('0x24')]);_0x757fdb[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x212633[_0xfe7f('0x5c')][_0xfe7f('0x22')]);}return _0x36167e['getContacts'](_0x757fdb);}})[_0xfe7f('0x2a')](function(_0x50888c){if(_0x50888c){return _0x50888c?{'count':_0x588b6b,'rows':_0x50888c}:null;}})['then'](respondWithResult(_0x368a4a,null))[_0xfe7f('0x1f')](handleError(_0x368a4a,null));};exports[_0xfe7f('0xe1')]=function(_0x559aa3,_0x58379d){var _0x2323bc;var _0x147483={};var _0x2d4d4b;return db['User'][_0xfe7f('0xd7')]({'where':{'id':_0x559aa3['params']['id']},'attributes':['id','name',_0xfe7f('0x38')]})[_0xfe7f('0x2a')](handleEntityNotFound(_0x58379d,null))[_0xfe7f('0x2a')](function(_0x4fd670){if(!utils['isValidChannel'](_0x559aa3[_0xfe7f('0x5c')][_0xfe7f('0xa5')])){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0xa9'));}_0x2323bc=_0x4fd670;var _0x20b4db={};_0x20b4db[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db[_[_0xfe7f('0xab')](_0x559aa3[_0xfe7f('0x5c')][_0xfe7f('0xa5')])+_0xfe7f('0xe2')][_0xfe7f('0x3e')]);_0x20b4db[_0xfe7f('0x5c')]=_['keys'](_0x559aa3[_0xfe7f('0x5c')]);_0x20b4db[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x20b4db[_0xfe7f('0x59')],_0x20b4db[_0xfe7f('0x5c')]);_0x147483['attributes']=_[_0xfe7f('0x5e')](_0x20b4db[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x559aa3[_0xfe7f('0x5c')]['fields']));_0x147483[_0xfe7f('0x48')]=_0x147483['attributes'][_0xfe7f('0x60')]?_0x147483[_0xfe7f('0x48')]:_0x20b4db[_0xfe7f('0x59')];_0x147483['order']=qs[_0xfe7f('0xd9')](_0x559aa3[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x147483[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x559aa3[_0xfe7f('0x5c')],_0x20b4db[_0xfe7f('0x5d')]));if(_0x559aa3[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x147483['where']=_['merge'](_0x147483['where'],{'$or':_[_0xfe7f('0x35')](_0x147483[_0xfe7f('0x48')],function(_0x1cf3d1){var _0x2be698={};_0x2be698[_0x1cf3d1]={'$like':'%'+_0x559aa3['query'][_0xfe7f('0x33')]+'%'};return _0x2be698;})});}_0x147483=_[_0xfe7f('0x61')]({},_0x147483,_0x559aa3['options']);switch(_0x2323bc[_0xfe7f('0x38')]){case _0xfe7f('0x86'):return db[_[_0xfe7f('0xab')](_0x559aa3[_0xfe7f('0x5c')][_0xfe7f('0xa5')])+_0xfe7f('0xe2')][_0xfe7f('0x4b')](_0x147483);case _0xfe7f('0x2e'):case _0xfe7f('0x30'):return _0x2323bc[_0xfe7f('0xb5')+_[_0xfe7f('0xab')](_0x559aa3[_0xfe7f('0x5c')][_0xfe7f('0xa5')])+_0xfe7f('0xac')](_0x147483);default:throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))]('Unknown\x20role');}})[_0xfe7f('0x2a')](function(_0x9323be){_0x2d4d4b=_0x9323be[_0xfe7f('0x60')];if(!_0x559aa3[_0xfe7f('0x5c')]['hasOwnProperty'](_0xfe7f('0xe0'))){_0x147483['limit']=qs[_0xfe7f('0x24')](_0x559aa3[_0xfe7f('0x5c')]['limit']);_0x147483['offset']=qs[_0xfe7f('0x22')](_0x559aa3[_0xfe7f('0x5c')]['offset']);}switch(_0x2323bc[_0xfe7f('0x38')]){case _0xfe7f('0x86'):return db[_[_0xfe7f('0xab')](_0x559aa3['query'][_0xfe7f('0xa5')])+_0xfe7f('0xe2')][_0xfe7f('0x4b')](_0x147483);case _0xfe7f('0x2e'):case _0xfe7f('0x30'):return _0x2323bc[_0xfe7f('0xb5')+_[_0xfe7f('0xab')](_0x559aa3[_0xfe7f('0x5c')][_0xfe7f('0xa5')])+_0xfe7f('0xac')](_0x147483);}})[_0xfe7f('0x2a')](function(_0x823a34){return{'count':_0x2d4d4b,'rows':_0x823a34};})[_0xfe7f('0x2a')](respondWithResult(_0x58379d,null))[_0xfe7f('0x1f')](handleError(_0x58379d,null));};exports[_0xfe7f('0xe3')]=function(_0x18e24f,_0x34589e){var _0x104c32={};var _0x28ec02={};var _0x236741;var _0xdb1ae1;return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x18e24f[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x34589e,null))[_0xfe7f('0x2a')](function(_0x4c261b){if(_0x4c261b){_0x236741=_0x4c261b;_0x28ec02[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db['UserVoiceQueueRt']['rawAttributes']);_0x28ec02[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x18e24f[_0xfe7f('0x5c')]);_0x28ec02[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x28ec02['model'],_0x28ec02[_0xfe7f('0x5c')]);_0x104c32[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x28ec02[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x18e24f[_0xfe7f('0x5c')]['fields']));_0x104c32['attributes']=_0x104c32['attributes'][_0xfe7f('0x60')]?_0x104c32[_0xfe7f('0x48')]:_0x28ec02[_0xfe7f('0x59')];_0x104c32[_0xfe7f('0xe4')]=qs['sort'](_0x18e24f['query'][_0xfe7f('0xd9')]);_0x104c32['where']=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x18e24f['query'],_0x28ec02[_0xfe7f('0x5d')]));if(_0x18e24f['query'][_0xfe7f('0x33')]){_0x104c32[_0xfe7f('0x43')]=_['merge'](_0x104c32[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x104c32[_0xfe7f('0x48')],function(_0x310aba){var _0x1fa496={};_0x1fa496[_0x310aba]={'$like':'%'+_0x18e24f[_0xfe7f('0x5c')]['filter']+'%'};return _0x1fa496;})});}_0x104c32=_[_0xfe7f('0x61')]({},_0x104c32,_0x18e24f[_0xfe7f('0x62')]);return _0x236741[_0xfe7f('0xe3')](_0x104c32);}})[_0xfe7f('0x2a')](function(_0x4f9abd){if(_0x4f9abd){_0xdb1ae1=_0x4f9abd['length'];if(!_0x18e24f['query']['hasOwnProperty'](_0xfe7f('0xe0'))){_0x104c32[_0xfe7f('0x24')]=qs[_0xfe7f('0x24')](_0x18e24f[_0xfe7f('0x5c')][_0xfe7f('0x24')]);_0x104c32['offset']=qs[_0xfe7f('0x22')](_0x18e24f['query'][_0xfe7f('0x22')]);}return _0x236741[_0xfe7f('0xe3')](_0x104c32);}})[_0xfe7f('0x2a')](function(_0x4a2ee3){if(_0x4a2ee3){return _0x4a2ee3?{'count':_0xdb1ae1,'rows':_0x4a2ee3}:null;}})['then'](respondWithResult(_0x34589e,null))[_0xfe7f('0x1f')](handleError(_0x34589e,null));};exports['getGroups']=function(_0x400f30,_0x27a2b2){var _0x4d2a03={};var _0x459cb2={};var _0x443398;var _0x1f2035;return db['User']['findOne']({'where':{'id':_0x400f30[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x27a2b2,null))[_0xfe7f('0x2a')](function(_0x5d0bef){if(_0x5d0bef){_0x443398=_0x5d0bef;_0x459cb2[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db[_0xfe7f('0xe5')][_0xfe7f('0x3e')]);_0x459cb2[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x400f30[_0xfe7f('0x5c')]);_0x459cb2[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x459cb2[_0xfe7f('0x59')],_0x459cb2[_0xfe7f('0x5c')]);_0x4d2a03[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x459cb2[_0xfe7f('0x59')],qs['fields'](_0x400f30[_0xfe7f('0x5c')]['fields']));_0x4d2a03[_0xfe7f('0x48')]=_0x4d2a03[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x4d2a03[_0xfe7f('0x48')]:_0x459cb2[_0xfe7f('0x59')];_0x4d2a03[_0xfe7f('0xe4')]=qs[_0xfe7f('0xd9')](_0x400f30[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x4d2a03[_0xfe7f('0x43')]=qs['filters'](_[_0xfe7f('0xda')](_0x400f30[_0xfe7f('0x5c')],_0x459cb2[_0xfe7f('0x5d')]));if(_0x400f30[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x4d2a03['where']=_[_0xfe7f('0x61')](_0x4d2a03[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x4d2a03[_0xfe7f('0x48')],function(_0xe3bcdd){var _0x300aa6={};_0x300aa6[_0xe3bcdd]={'$like':'%'+_0x400f30['query'][_0xfe7f('0x33')]+'%'};return _0x300aa6;})});}_0x4d2a03=_[_0xfe7f('0x61')]({},_0x4d2a03,_0x400f30[_0xfe7f('0x62')]);return _0x443398[_0xfe7f('0xe6')](_0x4d2a03);}})[_0xfe7f('0x2a')](function(_0x1af462){if(_0x1af462){_0x1f2035=_0x1af462['length'];if(!_0x400f30[_0xfe7f('0x5c')][_0xfe7f('0xdb')]('nolimit')){_0x4d2a03[_0xfe7f('0x24')]=qs[_0xfe7f('0x24')](_0x400f30['query'][_0xfe7f('0x24')]);_0x4d2a03[_0xfe7f('0x22')]=qs['offset'](_0x400f30[_0xfe7f('0x5c')]['offset']);}return _0x443398[_0xfe7f('0xe6')](_0x4d2a03);}})[_0xfe7f('0x2a')](function(_0x420880){if(_0x420880){return _0x420880?{'count':_0x1f2035,'rows':_0x420880}:null;}})[_0xfe7f('0x2a')](respondWithResult(_0x27a2b2,null))['catch'](handleError(_0x27a2b2,null));};exports['getRecordings']=function(_0x1bb5b7,_0x5054df){var _0x11db35={'raw':!![],'where':{}};var _0x270c9b={};var _0x34621f={'count':0x0,'rows':[]};return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x1bb5b7['params']['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x5054df,null))[_0xfe7f('0x2a')](function(_0xc2367e){if(_0xc2367e){_0x270c9b[_0xfe7f('0x59')]=_['keys'](db['VoiceRecording'][_0xfe7f('0x3e')]);_0x270c9b[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x1bb5b7['query']);_0x270c9b[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x270c9b[_0xfe7f('0x59')],_0x270c9b['query']);_0x11db35[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x270c9b[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x1bb5b7[_0xfe7f('0x5c')]['fields']));_0x11db35[_0xfe7f('0x48')]=_0x11db35['attributes']['length']?_0x11db35[_0xfe7f('0x48')]:_0x270c9b['model'];if(!_0x1bb5b7[_0xfe7f('0x5c')][_0xfe7f('0xdb')](_0xfe7f('0xe0'))){_0x11db35['limit']=qs['limit'](_0x1bb5b7[_0xfe7f('0x5c')][_0xfe7f('0x24')]);_0x11db35[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x1bb5b7[_0xfe7f('0x5c')][_0xfe7f('0x22')]);}_0x11db35['order']=qs['sort'](_0x1bb5b7['query'][_0xfe7f('0xd9')]);_0x11db35[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x1bb5b7[_0xfe7f('0x5c')],_0x270c9b[_0xfe7f('0x5d')]));_0x11db35[_0xfe7f('0x43')][_0xfe7f('0xe7')]=_0xc2367e['id'];if(_0x1bb5b7[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x11db35[_0xfe7f('0x43')]=_['merge'](_0x11db35[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x11db35[_0xfe7f('0x48')],function(_0x58dc9e){var _0x24d9ad={};_0x24d9ad[_0x58dc9e]={'$like':'%'+_0x1bb5b7[_0xfe7f('0x5c')][_0xfe7f('0x33')]+'%'};return _0x24d9ad;})});}_0x11db35=_[_0xfe7f('0x61')]({},_0x11db35,_0x1bb5b7[_0xfe7f('0x62')]);return db[_0xfe7f('0xe8')]['count']({'where':_0x11db35[_0xfe7f('0x43')]})[_0xfe7f('0x2a')](function(_0x283c50){_0x34621f[_0xfe7f('0x25')]=_0x283c50;if(_0x1bb5b7[_0xfe7f('0x5c')][_0xfe7f('0x44')]){_0x11db35['include']=[{'all':!![]}];}return db[_0xfe7f('0xe8')][_0xfe7f('0x4b')](_0x11db35);})[_0xfe7f('0x2a')](function(_0x15baa7){_0x34621f[_0xfe7f('0x4c')]=_0x15baa7;return _0x34621f;});}})[_0xfe7f('0x2a')](respondWithFilteredResult(_0x5054df,_0x11db35))['catch'](handleError(_0x5054df,null));};exports[_0xfe7f('0xe9')]=function(_0x441656,_0xef9842){var _0x5ea67d={'raw':!![],'where':{}};var _0x2a4a88={};var _0x562d42={'count':0x0,'rows':[]};return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x441656[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0xef9842,null))[_0xfe7f('0x2a')](function(_0x6517be){if(_0x6517be){_0x2a4a88[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db[_0xfe7f('0xea')]['rawAttributes']);_0x2a4a88[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x441656[_0xfe7f('0x5c')]);_0x2a4a88[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x2a4a88[_0xfe7f('0x59')],_0x2a4a88[_0xfe7f('0x5c')]);_0x5ea67d[_0xfe7f('0x48')]=_['intersection'](_0x2a4a88[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x441656[_0xfe7f('0x5c')]['fields']));_0x5ea67d[_0xfe7f('0x48')]=_0x5ea67d[_0xfe7f('0x48')]['length']?_0x5ea67d[_0xfe7f('0x48')]:_0x2a4a88[_0xfe7f('0x59')];if(!_0x441656[_0xfe7f('0x5c')]['hasOwnProperty'](_0xfe7f('0xe0'))){_0x5ea67d['limit']=qs[_0xfe7f('0x24')](_0x441656[_0xfe7f('0x5c')][_0xfe7f('0x24')]);_0x5ea67d[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x441656[_0xfe7f('0x5c')]['offset']);}_0x5ea67d[_0xfe7f('0xe4')]=qs[_0xfe7f('0xd9')](_0x441656[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x5ea67d['where']=qs[_0xfe7f('0x5d')](_['pick'](_0x441656['query'],_0x2a4a88['filters']));_0x5ea67d[_0xfe7f('0x43')]['UserId']=_0x6517be['id'];if(_0x441656[_0xfe7f('0x5c')]['filter']){_0x5ea67d[_0xfe7f('0x43')]=_[_0xfe7f('0x61')](_0x5ea67d[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x5ea67d['attributes'],function(_0x5002ed){var _0x59094c={};_0x59094c[_0x5002ed]={'$like':'%'+_0x441656[_0xfe7f('0x5c')][_0xfe7f('0x33')]+'%'};return _0x59094c;})});}_0x5ea67d=_[_0xfe7f('0x61')]({},_0x5ea67d,_0x441656[_0xfe7f('0x62')]);return db[_0xfe7f('0xea')]['count']({'where':_0x5ea67d[_0xfe7f('0x43')]})[_0xfe7f('0x2a')](function(_0x3fb0a3){_0x562d42[_0xfe7f('0x25')]=_0x3fb0a3;if(_0x441656['query'][_0xfe7f('0x44')]){_0x5ea67d[_0xfe7f('0x45')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfe7f('0x4b')](_0x5ea67d);})[_0xfe7f('0x2a')](function(_0x5dbc6e){_0x562d42[_0xfe7f('0x4c')]=_0x5dbc6e;return _0x562d42;});}})[_0xfe7f('0x2a')](respondWithFilteredResult(_0xef9842,_0x5ea67d))[_0xfe7f('0x1f')](handleError(_0xef9842,null));};exports['getChatInteractions']=function(_0x32132a,_0x2979ad){var _0x5e937a={};var _0xc4a7b8={};var _0x43fa14;var _0x508554;return db[_0xfe7f('0x4a')]['findOne']({'where':{'id':_0x32132a[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x2979ad,null))[_0xfe7f('0x2a')](function(_0x55fad1){if(_0x55fad1){_0x43fa14=_0x55fad1;_0xc4a7b8[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db[_0xfe7f('0xeb')]['rawAttributes']);_0xc4a7b8['query']=_[_0xfe7f('0x5a')](_0x32132a['query']);_0xc4a7b8['filters']=_[_0xfe7f('0x5e')](_0xc4a7b8[_0xfe7f('0x59')],_0xc4a7b8[_0xfe7f('0x5c')]);_0x5e937a[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0xc4a7b8[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x32132a[_0xfe7f('0x5c')]['fields']));_0x5e937a[_0xfe7f('0x48')]=_0x5e937a[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x5e937a[_0xfe7f('0x48')]:_0xc4a7b8[_0xfe7f('0x59')];_0x5e937a[_0xfe7f('0xe4')]=qs[_0xfe7f('0xd9')](_0x32132a[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x5e937a[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x32132a[_0xfe7f('0x5c')],_0xc4a7b8[_0xfe7f('0x5d')]));if(_0x32132a[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x5e937a['where']=_[_0xfe7f('0x61')](_0x5e937a[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x5e937a['attributes'],function(_0x301be0){var _0x3a031a={};_0x3a031a[_0x301be0]={'$like':'%'+_0x32132a['query'][_0xfe7f('0x33')]+'%'};return _0x3a031a;})});}_0x5e937a=_[_0xfe7f('0x61')]({},_0x5e937a,_0x32132a['options']);return _0x43fa14[_0xfe7f('0xec')](_0x5e937a);}})[_0xfe7f('0x2a')](function(_0x51f2ec){if(_0x51f2ec){_0x508554=_0x51f2ec['length'];if(!_0x32132a['query']['hasOwnProperty'](_0xfe7f('0xe0'))){_0x5e937a['limit']=qs['limit'](_0x32132a[_0xfe7f('0x5c')][_0xfe7f('0x24')]);_0x5e937a[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x32132a[_0xfe7f('0x5c')][_0xfe7f('0x22')]);}return _0x43fa14[_0xfe7f('0xec')](_0x5e937a);}})[_0xfe7f('0x2a')](function(_0x2c84bc){if(_0x2c84bc){return _0x2c84bc?{'count':_0x508554,'rows':_0x2c84bc}:null;}})[_0xfe7f('0x2a')](respondWithResult(_0x2979ad,null))[_0xfe7f('0x1f')](handleError(_0x2979ad,null));};exports[_0xfe7f('0xed')]=function(_0x30e1fd,_0x21b1b4){var _0x400c36={};var _0x4e1014={};var _0x424534;var _0x2e3eab;return db[_0xfe7f('0x4a')]['findOne']({'where':{'id':_0x30e1fd[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x21b1b4,null))['then'](function(_0x298f88){if(_0x298f88){_0x424534=_0x298f88;_0x4e1014['model']=_[_0xfe7f('0x5a')](db[_0xfe7f('0xee')]['rawAttributes']);_0x4e1014['query']=_['keys'](_0x30e1fd['query']);_0x4e1014[_0xfe7f('0x5d')]=_['intersection'](_0x4e1014[_0xfe7f('0x59')],_0x4e1014['query']);_0x400c36['attributes']=_[_0xfe7f('0x5e')](_0x4e1014[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x30e1fd[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x400c36[_0xfe7f('0x48')]=_0x400c36[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x400c36[_0xfe7f('0x48')]:_0x4e1014['model'];_0x400c36[_0xfe7f('0xe4')]=qs[_0xfe7f('0xd9')](_0x30e1fd[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x400c36[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_['pick'](_0x30e1fd[_0xfe7f('0x5c')],_0x4e1014[_0xfe7f('0x5d')]));if(_0x30e1fd[_0xfe7f('0x5c')]['filter']){_0x400c36[_0xfe7f('0x43')]=_[_0xfe7f('0x61')](_0x400c36[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x400c36[_0xfe7f('0x48')],function(_0x42ba42){var _0x4ac584={};_0x4ac584[_0x42ba42]={'$like':'%'+_0x30e1fd['query']['filter']+'%'};return _0x4ac584;})});}_0x400c36=_[_0xfe7f('0x61')]({},_0x400c36,_0x30e1fd[_0xfe7f('0x62')]);return _0x424534[_0xfe7f('0xed')](_0x400c36);}})['then'](function(_0x56c4e4){if(_0x56c4e4){_0x2e3eab=_0x56c4e4[_0xfe7f('0x60')];if(!_0x30e1fd[_0xfe7f('0x5c')][_0xfe7f('0xdb')](_0xfe7f('0xe0'))){_0x400c36['limit']=qs[_0xfe7f('0x24')](_0x30e1fd['query']['limit']);_0x400c36[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x30e1fd[_0xfe7f('0x5c')][_0xfe7f('0x22')]);}return _0x424534[_0xfe7f('0xed')](_0x400c36);}})[_0xfe7f('0x2a')](function(_0x31257a){if(_0x31257a){return _0x31257a?{'count':_0x2e3eab,'rows':_0x31257a}:null;}})[_0xfe7f('0x2a')](respondWithResult(_0x21b1b4,null))[_0xfe7f('0x1f')](handleError(_0x21b1b4,null));};exports[_0xfe7f('0xef')]=function(_0x5d638f,_0x4871d0){var _0x59648f={'raw':!![],'where':{}};var _0x4a71ac={};var _0xd0138a={'count':0x0,'rows':[]};return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x5d638f['params']['id']}})['then'](handleEntityNotFound(_0x4871d0,null))['then'](function(_0x2e29d0){if(_0x2e29d0){_0x4a71ac[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db[_0xfe7f('0xf0')][_0xfe7f('0x3e')]);_0x4a71ac['query']=_['keys'](_0x5d638f[_0xfe7f('0x5c')]);_0x4a71ac[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x4a71ac[_0xfe7f('0x59')],_0x4a71ac[_0xfe7f('0x5c')]);_0x59648f['attributes']=_[_0xfe7f('0x5e')](_0x4a71ac[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x5d638f[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x59648f[_0xfe7f('0x48')]=_0x59648f[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x59648f[_0xfe7f('0x48')]:_0x4a71ac[_0xfe7f('0x59')];if(!_0x5d638f['query'][_0xfe7f('0xdb')]('nolimit')){_0x59648f['limit']=qs[_0xfe7f('0x24')](_0x5d638f['query'][_0xfe7f('0x24')]);_0x59648f[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x5d638f[_0xfe7f('0x5c')][_0xfe7f('0x22')]);}_0x59648f['order']=qs['sort'](_0x5d638f[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x59648f[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x5d638f['query'],_0x4a71ac[_0xfe7f('0x5d')]));_0x59648f[_0xfe7f('0x43')][_0xfe7f('0xe7')]=_0x2e29d0['id'];if(_0x5d638f[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x59648f['where']=_[_0xfe7f('0x61')](_0x59648f[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x59648f[_0xfe7f('0x48')],function(_0x5dba8c){var _0x519394={};_0x519394[_0x5dba8c]={'$like':'%'+_0x5d638f[_0xfe7f('0x5c')]['filter']+'%'};return _0x519394;})});}_0x59648f=_['merge']({},_0x59648f,_0x5d638f[_0xfe7f('0x62')]);return db[_0xfe7f('0xf0')][_0xfe7f('0x25')]({'where':_0x59648f[_0xfe7f('0x43')]})[_0xfe7f('0x2a')](function(_0x54e149){_0xd0138a['count']=_0x54e149;if(_0x5d638f['query'][_0xfe7f('0x44')]){_0x59648f[_0xfe7f('0x45')]=[{'all':!![]}];}return db[_0xfe7f('0xf0')][_0xfe7f('0x4b')](_0x59648f);})['then'](function(_0x1917c6){_0xd0138a[_0xfe7f('0x4c')]=_0x1917c6;return _0xd0138a;});}})[_0xfe7f('0x2a')](respondWithFilteredResult(_0x4871d0,_0x59648f))[_0xfe7f('0x1f')](handleError(_0x4871d0,null));};exports[_0xfe7f('0xf1')]=function(_0x1594e7,_0x4e76e4){var _0x5437d8={};var _0x2e7ea0={};var _0x1c802e;var _0x6319e9;return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x1594e7[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x4e76e4,null))[_0xfe7f('0x2a')](function(_0x4700a7){if(_0x4700a7){_0x1c802e=_0x4700a7;_0x2e7ea0[_0xfe7f('0x59')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x2e7ea0[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x1594e7[_0xfe7f('0x5c')]);_0x2e7ea0[_0xfe7f('0x5d')]=_['intersection'](_0x2e7ea0[_0xfe7f('0x59')],_0x2e7ea0[_0xfe7f('0x5c')]);_0x5437d8[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x2e7ea0[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x1594e7[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x5437d8['attributes']=_0x5437d8['attributes'][_0xfe7f('0x60')]?_0x5437d8[_0xfe7f('0x48')]:_0x2e7ea0[_0xfe7f('0x59')];_0x5437d8[_0xfe7f('0xe4')]=qs['sort'](_0x1594e7[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x5437d8[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_['pick'](_0x1594e7[_0xfe7f('0x5c')],_0x2e7ea0['filters']));if(_0x1594e7['query'][_0xfe7f('0x33')]){_0x5437d8[_0xfe7f('0x43')]=_[_0xfe7f('0x61')](_0x5437d8[_0xfe7f('0x43')],{'$or':_['map'](_0x5437d8['attributes'],function(_0x5a5d28){var _0x23395c={};_0x23395c[_0x5a5d28]={'$like':'%'+_0x1594e7[_0xfe7f('0x5c')][_0xfe7f('0x33')]+'%'};return _0x23395c;})});}_0x5437d8=_[_0xfe7f('0x61')]({},_0x5437d8,_0x1594e7[_0xfe7f('0x62')]);return _0x1c802e['getSmsInteractions'](_0x5437d8);}})[_0xfe7f('0x2a')](function(_0x61b53c){if(_0x61b53c){_0x6319e9=_0x61b53c[_0xfe7f('0x60')];if(!_0x1594e7[_0xfe7f('0x5c')]['hasOwnProperty'](_0xfe7f('0xe0'))){_0x5437d8[_0xfe7f('0x24')]=qs['limit'](_0x1594e7['query'][_0xfe7f('0x24')]);_0x5437d8[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x1594e7[_0xfe7f('0x5c')][_0xfe7f('0x22')]);}return _0x1c802e[_0xfe7f('0xf1')](_0x5437d8);}})[_0xfe7f('0x2a')](function(_0x4775e5){if(_0x4775e5){return _0x4775e5?{'count':_0x6319e9,'rows':_0x4775e5}:null;}})['then'](respondWithResult(_0x4e76e4,null))[_0xfe7f('0x1f')](handleError(_0x4e76e4,null));};exports['getFaxInteractions']=function(_0x35157a,_0x5ac68d){var _0x494827={};var _0x71a467={};var _0x22ea5d;var _0x406ff0;return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x35157a['params']['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x5ac68d,null))[_0xfe7f('0x2a')](function(_0x278778){if(_0x278778){_0x22ea5d=_0x278778;_0x71a467[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db[_0xfe7f('0xf2')][_0xfe7f('0x3e')]);_0x71a467[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x35157a[_0xfe7f('0x5c')]);_0x71a467['filters']=_[_0xfe7f('0x5e')](_0x71a467[_0xfe7f('0x59')],_0x71a467['query']);_0x494827[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x71a467[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x35157a[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x494827[_0xfe7f('0x48')]=_0x494827[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x494827['attributes']:_0x71a467[_0xfe7f('0x59')];_0x494827['order']=qs[_0xfe7f('0xd9')](_0x35157a[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x494827[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x35157a[_0xfe7f('0x5c')],_0x71a467[_0xfe7f('0x5d')]));if(_0x35157a[_0xfe7f('0x5c')]['filter']){_0x494827[_0xfe7f('0x43')]=_['merge'](_0x494827[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x494827[_0xfe7f('0x48')],function(_0x25e8f3){var _0x18d8dc={};_0x18d8dc[_0x25e8f3]={'$like':'%'+_0x35157a[_0xfe7f('0x5c')]['filter']+'%'};return _0x18d8dc;})});}_0x494827=_['merge']({},_0x494827,_0x35157a[_0xfe7f('0x62')]);return _0x22ea5d[_0xfe7f('0xf3')](_0x494827);}})[_0xfe7f('0x2a')](function(_0x587713){if(_0x587713){_0x406ff0=_0x587713['length'];if(!_0x35157a[_0xfe7f('0x5c')][_0xfe7f('0xdb')](_0xfe7f('0xe0'))){_0x494827[_0xfe7f('0x24')]=qs[_0xfe7f('0x24')](_0x35157a['query'][_0xfe7f('0x24')]);_0x494827['offset']=qs[_0xfe7f('0x22')](_0x35157a[_0xfe7f('0x5c')][_0xfe7f('0x22')]);}return _0x22ea5d[_0xfe7f('0xf3')](_0x494827);}})[_0xfe7f('0x2a')](function(_0x5823be){if(_0x5823be){return _0x5823be?{'count':_0x406ff0,'rows':_0x5823be}:null;}})[_0xfe7f('0x2a')](respondWithResult(_0x5ac68d,null))['catch'](handleError(_0x5ac68d,null));};exports[_0xfe7f('0xf4')]=function(_0xdb51ff,_0x5a6b27){var _0x488c61={};var _0x26ec60={};var _0x578864;var _0x1b141d;return db['User']['findOne']({'where':{'id':_0xdb51ff[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x5a6b27,null))[_0xfe7f('0x2a')](function(_0x394980){if(_0x394980){_0x578864=_0x394980;_0x26ec60['model']=_['keys'](db[_0xfe7f('0xf5')][_0xfe7f('0x3e')]);_0x26ec60['query']=_[_0xfe7f('0x5a')](_0xdb51ff[_0xfe7f('0x5c')]);_0x26ec60[_0xfe7f('0x5d')]=_[_0xfe7f('0x5e')](_0x26ec60[_0xfe7f('0x59')],_0x26ec60[_0xfe7f('0x5c')]);_0x488c61[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x26ec60[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0xdb51ff[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x488c61[_0xfe7f('0x48')]=_0x488c61[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x488c61[_0xfe7f('0x48')]:_0x26ec60[_0xfe7f('0x59')];_0x488c61[_0xfe7f('0xe4')]=qs[_0xfe7f('0xd9')](_0xdb51ff[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x488c61[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0xdb51ff['query'],_0x26ec60['filters']));if(_0xdb51ff[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x488c61['where']=_[_0xfe7f('0x61')](_0x488c61['where'],{'$or':_[_0xfe7f('0x35')](_0x488c61[_0xfe7f('0x48')],function(_0x3c7f9b){var _0x52da16={};_0x52da16[_0x3c7f9b]={'$like':'%'+_0xdb51ff['query'][_0xfe7f('0x33')]+'%'};return _0x52da16;})});}_0x488c61=_[_0xfe7f('0x61')]({},_0x488c61,_0xdb51ff[_0xfe7f('0x62')]);return _0x578864[_0xfe7f('0xf4')](_0x488c61);}})[_0xfe7f('0x2a')](function(_0x48bf45){if(_0x48bf45){_0x1b141d=_0x48bf45[_0xfe7f('0x60')];if(!_0xdb51ff[_0xfe7f('0x5c')]['hasOwnProperty'](_0xfe7f('0xe0'))){_0x488c61[_0xfe7f('0x24')]=qs[_0xfe7f('0x24')](_0xdb51ff[_0xfe7f('0x5c')][_0xfe7f('0x24')]);_0x488c61['offset']=qs['offset'](_0xdb51ff['query']['offset']);}return _0x578864[_0xfe7f('0xf4')](_0x488c61);}})['then'](function(_0x235b05){if(_0x235b05){return _0x235b05?{'count':_0x1b141d,'rows':_0x235b05}:null;}})['then'](respondWithResult(_0x5a6b27,null))[_0xfe7f('0x1f')](handleError(_0x5a6b27,null));};exports[_0xfe7f('0xf6')]=function(_0x52fa85,_0x233b41,_0x4e4f11){var _0x427f61;var _0x3b7f03;var _0x99b372;var _0x420fc6=!_['isNil'](_0x52fa85[_0xfe7f('0x58')]['id'])?_0x52fa85[_0xfe7f('0x58')]['id']:!_[_0xfe7f('0x6d')](_0x52fa85['user']['id'])?_0x52fa85[_0xfe7f('0x2e')]['id']:null;return db[_0xfe7f('0x4a')][_0xfe7f('0x39')]({'where':{'id':_0x420fc6,'role':{'$or':[_0xfe7f('0x86'),_0xfe7f('0x2e'),_0xfe7f('0x30')]}},'attributes':['id',_0xfe7f('0x3c'),_0xfe7f('0xf7'),_0xfe7f('0xf8'),_0xfe7f('0x38'),'internal',_0xfe7f('0xf9')]})[_0xfe7f('0x2a')](function(_0x85445d){if(_0x85445d){if(_0x85445d[_0xfe7f('0x38')]==='agent'){_0x427f61=_0x85445d;if(_0x52fa85['body'][_0xfe7f('0xa7')]){_0x99b372=util[_0xfe7f('0xb7')](_0xfe7f('0xfa'),_0x427f61[_0x52fa85[_0xfe7f('0x63')][_0xfe7f('0xa7')]]);}else if(_0x52fa85[_0xfe7f('0x63')][_0xfe7f('0xfb')]){_0x99b372=util['format'](_0xfe7f('0xb8'),_0x52fa85['body']['intrf']);}else{_0x99b372=util['format'](_0xfe7f('0xb8'),_0x427f61[_0xfe7f('0x3c')]);}socket['to'](util['format'](_0xfe7f('0xfc'),_0x427f61[_0xfe7f('0x3c')]))[_0xfe7f('0xb0')]('user:forcelogout',{'user':{'id':_0x427f61['id'],'name':_0x427f61['name']},'ip':_0x52fa85[_0xfe7f('0xfd')][_0xfe7f('0xfe')]||_0x52fa85[_0xfe7f('0xff')][_0xfe7f('0x100')]||_0x52fa85[_0xfe7f('0x101')][_0xfe7f('0x100')]||_0x52fa85['connection'][_0xfe7f('0x101')][_0xfe7f('0x100')]});return db[_0xfe7f('0xb9')][_0xfe7f('0x2c')]({'where':{'membername':_0x427f61[_0xfe7f('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0x102'));}})[_0xfe7f('0x2a')](function(){if(_0x427f61){return _0x427f61[_0xfe7f('0x103')]({'raw':!![]});}})[_0xfe7f('0x2a')](function(_0xc3450e){if(_0x427f61){var _0x486c89=[];if(_0xc3450e){_0x3b7f03=_0xc3450e;if(_0x3b7f03[_0xfe7f('0x60')]){for(var _0x33ea42=0x0;_0x33ea42<_0x3b7f03[_0xfe7f('0x60')];_0x33ea42++){_0x486c89['push']({'membername':_0x427f61[_0xfe7f('0x3c')],'UserId':_0x427f61['id'],'queue_name':_0x3b7f03[_0x33ea42][_0xfe7f('0x3c')],'VoiceQueueId':_0x3b7f03[_0x33ea42]['id'],'interface':_0x99b372,'paused':_0x427f61[_0xfe7f('0xf9')]||![],'penalty':_0x3b7f03[_0x33ea42][_0xfe7f('0x104')]||0x0});}return BPromise[_0xfe7f('0x91')](_0x486c89,function(_0xebbea1){return db['UserVoiceQueueRt'][_0xfe7f('0xba')](_0xebbea1);});}}}})[_0xfe7f('0x2a')](function(){if(_0x427f61){return db[_0xfe7f('0x105')][_0xfe7f('0x4b')]({'where':{'membername':_0x427f61[_0xfe7f('0x3c')],'exitAt':null}});}})[_0xfe7f('0x2a')](function(_0x3baaef){if(_0x427f61){var _0x27df02=[];_0x3baaef['forEach'](function(_0x446efe){_0x27df02[_0xfe7f('0x49')](_0x446efe[_0xfe7f('0x29')]({'exitAt':moment()['format'](_0xfe7f('0x106'))}));});return BPromise[_0xfe7f('0x56')](_0x27df02);}})[_0xfe7f('0x2a')](function(){if(_0x427f61){var _0x163d49=[];var _0x10824e=[];var _0x5a1924=utils[_0xfe7f('0x107')]();var _0x21a023={'membername':_0x427f61[_0xfe7f('0x3c')],'interface':_0x99b372,'enterAt':moment()['format'](_0xfe7f('0x106')),'role':_0x427f61['role'],'internal':_0x427f61[_0xfe7f('0x68')]};_0x5a1924[_0xfe7f('0x108')](function(_0x260e9f){_0x163d49[_0xfe7f('0x49')](_[_0xfe7f('0x61')]({'channel':_0x260e9f,'type':'LOGIN','data1':_0x52fa85[_0xfe7f('0x63')]['device'],'data2':_0x99b372},_0x21a023));if(_0x427f61[_0xfe7f('0xf9')]){_0x10824e['push'](_[_0xfe7f('0x61')]({'channel':_0x260e9f,'type':_0xfe7f('0x109'),'data1':'LOGININPAUSE'},_0x21a023));}});return db[_0xfe7f('0x105')]['bulkCreate'](_0x163d49[_0xfe7f('0xd5')](_0x10824e),{'individualHooks':!![]});}})[_0xfe7f('0x2a')](function(){if(_0x427f61){return _0x427f61[_0xfe7f('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0xfe7f('0x106')),'voicePause':_0x427f61[_0xfe7f('0xf9')]||![],'mailPause':_0x427f61[_0xfe7f('0xf9')]||![],'chatPause':_0x427f61[_0xfe7f('0xf9')]||![],'faxPause':_0x427f61[_0xfe7f('0xf9')]||![],'smsPause':_0x427f61[_0xfe7f('0xf9')]||![],'openchannelPause':_0x427f61[_0xfe7f('0xf9')]||![],'whatsappPause':_0x427f61[_0xfe7f('0xf9')]||![],'pauseType':_0x427f61[_0xfe7f('0xf9')]?_0xfe7f('0x10a'):null,'interface':_0x99b372,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x29cbed){if(_0x52fa85[_0xfe7f('0x10b')]){return _0x4e4f11();}else{return BPromise[_0xfe7f('0x10c')](_0x29cbed)['then'](respondWithResult(_0x233b41,null));}})[_0xfe7f('0x1f')](handleError(_0x233b41,null));};exports[_0xfe7f('0x10d')]=function(_0x432ec3,_0xc71810){var _0x311c10;return db[_0xfe7f('0x4a')][_0xfe7f('0x39')]({'where':{'id':_0x432ec3['params']['id'],'role':_0xfe7f('0x30')},'attributes':['id','name',_0xfe7f('0x38')]})[_0xfe7f('0x2a')](handleEntityNotFound(_0xc71810,null))['then'](function(_0x3d1fda){if(_0x3d1fda){_0x311c10=_0x3d1fda;return db[_0xfe7f('0xb9')]['destroy']({'where':{'membername':_0x311c10[_0xfe7f('0x3c')]},'individualHooks':!![]});}})[_0xfe7f('0x2a')](function(){return db[_0xfe7f('0x105')][_0xfe7f('0x4b')]({'where':{'membername':_0x311c10[_0xfe7f('0x3c')],'exitAt':null}});})[_0xfe7f('0x2a')](function(_0x297f39){var _0x1258d5=[];_0x297f39[_0xfe7f('0x108')](function(_0x54dbc8){_0x1258d5[_0xfe7f('0x49')](_0x54dbc8[_0xfe7f('0x29')]({'exitAt':moment()[_0xfe7f('0xb7')](_0xfe7f('0x106'))}));});return BPromise[_0xfe7f('0x56')](_0x1258d5);})[_0xfe7f('0x2a')](function(){return _0x311c10[_0xfe7f('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfe7f('0x2a')](respondWithResult(_0xc71810,null))[_0xfe7f('0x1f')](handleError(_0xc71810,null));};exports[_0xfe7f('0x10e')]=function(_0x3a7431,_0x36316a){var _0x3b5009;return db[_0xfe7f('0xb9')][_0xfe7f('0x29')]({'paused':0x1},{'where':{'UserId':_0x3a7431[_0xfe7f('0x58')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xfe7f('0x4a')][_0xfe7f('0x39')]({'where':{'id':_0x3a7431[_0xfe7f('0x58')]['id'],'role':_0xfe7f('0x30')},'attributes':['id','name',_0xfe7f('0x38'),_0xfe7f('0x68'),'interface']});})[_0xfe7f('0x2a')](handleEntityNotFound(_0x36316a,null))[_0xfe7f('0x2a')](function(_0x466728){if(_0x466728){_0x3b5009=_0x466728;return respondWithRpcPromise(_0xfe7f('0x10f'),_0xfe7f('0x10e'),{'id':_0x3b5009['id'],'name':_0x3b5009[_0xfe7f('0x3c')],'pause':!![]});}})[_0xfe7f('0x2a')](function(){if(_0x3b5009){return db['MemberReport'][_0xfe7f('0x4b')]({'where':{'membername':_0x3b5009[_0xfe7f('0x3c')],'type':_0xfe7f('0x109'),'exitAt':null}});}})['then'](function(_0x11ade8){if(_0x11ade8[_0xfe7f('0x60')]){var _0x30c6a0=moment()[_0xfe7f('0xb7')](_0xfe7f('0x106'));for(var _0x18a205=0x0,_0x3156af=_0x11ade8[_0xfe7f('0x60')];_0x18a205<_0x3156af;_0x18a205++){_0x11ade8[_0x18a205]['updateAttributes']({'exitAt':_0x30c6a0});}}})['then'](function(){var _0x196f00=[];var _0x24e826=utils[_0xfe7f('0x107')]();_0x24e826[_0xfe7f('0x108')](function(_0x7e4ad7){_0x196f00[_0xfe7f('0x49')]({'channel':_0x7e4ad7,'membername':_0x3b5009[_0xfe7f('0x3c')],'interface':_[_0xfe7f('0x6d')](_0x3b5009[_0xfe7f('0xa7')])?util[_0xfe7f('0xb7')](_0xfe7f('0xb8'),_0x3b5009[_0xfe7f('0x3c')]):_0x3b5009[_0xfe7f('0xa7')],'type':'PAUSE','enterAt':moment()[_0xfe7f('0xb7')](_0xfe7f('0x106')),'data1':_0x3a7431[_0xfe7f('0x63')][_0xfe7f('0x110')]||'DEFAULT\x20PAUSE','role':_0x3b5009[_0xfe7f('0x38')],'internal':_0x3b5009[_0xfe7f('0x68')]});});return db[_0xfe7f('0x105')][_0xfe7f('0x8e')](_0x196f00,{'individualHooks':!![]});})[_0xfe7f('0x2a')](function(){return _0x3b5009[_0xfe7f('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3a7431[_0xfe7f('0x63')][_0xfe7f('0x110')]||_0xfe7f('0x111'),'lastPauseAt':moment()[_0xfe7f('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x36316a,null))[_0xfe7f('0x1f')](handleError(_0x36316a,null));};exports['unpause']=function(_0x10b555,_0x2ff3b8){var _0x263e54;return db['User'][_0xfe7f('0x39')]({'where':{'id':_0x10b555[_0xfe7f('0x58')]['id']},'attributes':['id',_0xfe7f('0x3c'),_0xfe7f('0x38'),_0xfe7f('0xa6'),_0xfe7f('0x112'),_0xfe7f('0x113'),_0xfe7f('0x114'),_0xfe7f('0x115'),_0xfe7f('0x116'),_0xfe7f('0x117'),_0xfe7f('0x118'),_0xfe7f('0x119')]})[_0xfe7f('0x2a')](handleEntityNotFound(_0x2ff3b8,null))[_0xfe7f('0x2a')](function(_0x27ad14){if(_0x27ad14){_0x263e54=_0x27ad14;if(_0x10b555[_0xfe7f('0x63')][_0xfe7f('0xa5')]&&!utils[_0xfe7f('0xa8')](_0x10b555['body'][_0xfe7f('0xa5')])){throw new db[(_0xfe7f('0x9b'))][(_0xfe7f('0x9c'))](_0xfe7f('0xa9'));}switch(_0x10b555['body'][_0xfe7f('0xa5')]){case'voice':return respondWithRpcPromise(_0xfe7f('0x10f'),_0xfe7f('0x11a'),{'id':_0x263e54['id'],'name':_0x263e54[_0xfe7f('0x3c')],'pause':![]})[_0xfe7f('0x2a')](function(){return db[_0xfe7f('0xb9')][_0xfe7f('0x29')]({'paused':0x0},{'where':{'UserId':_0x263e54['id']},'individualHooks':!![]});})[_0xfe7f('0x2a')](function(){return db[_0xfe7f('0x105')]['find']({'where':{'channel':_0x10b555[_0xfe7f('0x63')][_0xfe7f('0xa5')],'membername':_0x263e54[_0xfe7f('0x3c')],'type':_0xfe7f('0x109'),'exitAt':null}});})[_0xfe7f('0x2a')](function(_0x5e8fa7){if(_0x5e8fa7){return _0x5e8fa7['update']({'exitAt':moment()[_0xfe7f('0xb7')](_0xfe7f('0x106')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xfe7f('0x2a')](function(){return _0x263e54[_0xfe7f('0x29')]({'voicePause':![]});});case _0xfe7f('0x53'):case'chat':case _0xfe7f('0x52'):case _0xfe7f('0x51'):case'whatsapp':case _0xfe7f('0x54'):return db['MemberReport'][_0xfe7f('0x39')]({'where':{'channel':_0x10b555[_0xfe7f('0x63')]['channel'],'membername':_0x263e54[_0xfe7f('0x3c')],'type':_0xfe7f('0x109'),'exitAt':null}})[_0xfe7f('0x2a')](function(_0x5cf112){if(_0x5cf112){return _0x5cf112[_0xfe7f('0x29')]({'exitAt':moment()[_0xfe7f('0xb7')](_0xfe7f('0x106')),'data2':_0xfe7f('0x11b')},{'individualHooks':!![]});}return null;})[_0xfe7f('0x2a')](function(){var _0x5aba95={};_[_0xfe7f('0x26')](_0x5aba95,util['format']('%s%s',_0x10b555[_0xfe7f('0x63')][_0xfe7f('0xa5')],'Pause'),![]);return _0x263e54[_0xfe7f('0x29')](_0x5aba95);});default:return respondWithRpcPromise(_0xfe7f('0x10f'),_0xfe7f('0x11a'),{'id':_0x263e54['id'],'name':_0x263e54[_0xfe7f('0x3c')],'pause':![]})[_0xfe7f('0x2a')](function(){return db[_0xfe7f('0xb9')][_0xfe7f('0x29')]({'paused':0x0},{'where':{'UserId':_0x263e54['id']}});})[_0xfe7f('0x2a')](function(){return db[_0xfe7f('0x105')][_0xfe7f('0x4b')]({'where':{'membername':_0x263e54[_0xfe7f('0x3c')],'type':'PAUSE','exitAt':null}});})[_0xfe7f('0x2a')](function(_0x1ce121){var _0x240f4a=[];_0x1ce121['forEach'](function(_0x4cfae3){_0x240f4a[_0xfe7f('0x49')](_0x4cfae3[_0xfe7f('0x29')]({'exitAt':moment()[_0xfe7f('0xb7')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xfe7f('0x11b')}));});return BPromise['all'](_0x240f4a);})[_0xfe7f('0x2a')](function(){return _0x263e54[_0xfe7f('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xfe7f('0x2a')](respondWithResult(_0x2ff3b8,null))[_0xfe7f('0x1f')](handleError(_0x2ff3b8,null));};exports[_0xfe7f('0x11c')]=function(_0x447451,_0x2ed969){var _0xa7d3d9={};var _0x396b3a={};var _0x22a9d1;var _0x26516b;return db[_0xfe7f('0x4a')]['findOne']({'where':{'id':_0x447451['params']['id']}})['then'](handleEntityNotFound(_0x2ed969,null))[_0xfe7f('0x2a')](function(_0x5b0228){if(_0x5b0228){_0x22a9d1=_0x5b0228;_0x396b3a['model']=_[_0xfe7f('0x5a')](db['Team'][_0xfe7f('0x3e')]);_0x396b3a['query']=_[_0xfe7f('0x5a')](_0x447451['query']);_0x396b3a[_0xfe7f('0x5d')]=_['intersection'](_0x396b3a[_0xfe7f('0x59')],_0x396b3a[_0xfe7f('0x5c')]);_0xa7d3d9[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x396b3a[_0xfe7f('0x59')],qs[_0xfe7f('0x5f')](_0x447451[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0xa7d3d9[_0xfe7f('0x48')]=_0xa7d3d9[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0xa7d3d9[_0xfe7f('0x48')]:_0x396b3a[_0xfe7f('0x59')];_0xa7d3d9[_0xfe7f('0xe4')]=qs[_0xfe7f('0xd9')](_0x447451[_0xfe7f('0x5c')]['sort']);_0xa7d3d9[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x447451[_0xfe7f('0x5c')],_0x396b3a[_0xfe7f('0x5d')]));if(_0x447451[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0xa7d3d9['where']=_[_0xfe7f('0x61')](_0xa7d3d9['where'],{'$or':_[_0xfe7f('0x35')](_0xa7d3d9[_0xfe7f('0x48')],function(_0x37525f){var _0x4da034={};_0x4da034[_0x37525f]={'$like':'%'+_0x447451[_0xfe7f('0x5c')][_0xfe7f('0x33')]+'%'};return _0x4da034;})});}_0xa7d3d9=_['merge']({},_0xa7d3d9,_0x447451['options']);return _0x22a9d1[_0xfe7f('0x11c')](_0xa7d3d9);}})[_0xfe7f('0x2a')](function(_0x39e407){if(_0x39e407){_0x26516b=_0x39e407['length'];if(!_0x447451[_0xfe7f('0x5c')][_0xfe7f('0xdb')](_0xfe7f('0xe0'))){_0xa7d3d9[_0xfe7f('0x24')]=qs[_0xfe7f('0x24')](_0x447451[_0xfe7f('0x5c')]['limit']);_0xa7d3d9[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x447451[_0xfe7f('0x5c')]['offset']);}return _0x22a9d1[_0xfe7f('0x11c')](_0xa7d3d9);}})[_0xfe7f('0x2a')](function(_0x544cb8){if(_0x544cb8){return _0x544cb8?{'count':_0x26516b,'rows':_0x544cb8}:null;}})[_0xfe7f('0x2a')](respondWithResult(_0x2ed969,null))['catch'](handleError(_0x2ed969,null));};exports['addTeams']=function(_0x548124,_0x589361){var _0x540586=_0x548124[_0xfe7f('0x58')]['id'];var _0x26819b=_0x548124[_0xfe7f('0x63')]?_0x548124[_0xfe7f('0x63')][_0xfe7f('0x67')]:null;var _0x3a46fa=[];return Promise[_0xfe7f('0x10c')]()[_0xfe7f('0x2a')](function(){if(!_0x26819b)throw new APIBadRequestError(_0xfe7f('0x11d'));})[_0xfe7f('0x2a')](function(){return db['User'][_0xfe7f('0xd7')]({'where':{'id':_0x540586}});})['then'](function(_0x165270){if(!_0x165270)throw new APINotFoundError(util[_0xfe7f('0xb7')](_0xfe7f('0x11e'),_0x548124[_0xfe7f('0x58')]['id']));return db[_0xfe7f('0x6f')][_0xfe7f('0x11f')](function(_0x3c6731){return _0x165270[_0xfe7f('0x120')](_0x26819b,{'transaction':_0x3c6731})[_0xfe7f('0x2a')](function(){return db[_0xfe7f('0x121')]['findAll']({'where':{'id':{'$in':_0x26819b}}});})[_0xfe7f('0x2a')](function(_0x27d8e4){var _0xdad992=_[_0xfe7f('0x35')](_0x27d8e4,function(_0x51f94a){return _0x51f94a[_0xfe7f('0x122')]();});return Promise[_0xfe7f('0x56')](_0xdad992);})['then'](function(_0x358238){_0x3a46fa=_[_0xfe7f('0x123')](_0x358238);var _0x5a90a9=_[_0xfe7f('0x35')](_0x3a46fa,function(_0x2c4a2f){return _0x2c4a2f[_0xfe7f('0x124')](_0x165270['id'],{'transaction':_0x3c6731});});return Promise[_0xfe7f('0x56')](_0x5a90a9);})[_0xfe7f('0x2a')](function(){if(!_0x165270[_0xfe7f('0xb6')])return;var _0x321c5c=_[_0xfe7f('0x33')](_0x3a46fa,function(_0x541edf){return _0x541edf[_0xfe7f('0x125')]('channel')==='Voice';});var _0x2d0233=_['map'](_0x321c5c,function(_0x3d488e){return db[_0xfe7f('0xb9')][_0xfe7f('0xba')]({'membername':_0x165270['name'],'UserId':_0x165270['id'],'queue_name':_0x3d488e['name'],'VoiceQueueId':_0x3d488e['id'],'interface':_['isNil'](_0x165270['interface'])?util[_0xfe7f('0xb7')](_0xfe7f('0xb8'),_0x165270[_0xfe7f('0x3c')]):_0x165270['interface'],'paused':_0x165270['voicePause']||![],'penalty':_0x165270[_0xfe7f('0xad')]},{'transaction':_0x3c6731});});return Promise[_0xfe7f('0x56')](_0x2d0233);})['then'](function(){return db[_0xfe7f('0x126')][_0xfe7f('0x4b')]({'where':{'teamId':{'$in':_0x26819b}}});})['then'](function(_0x436f3f){var _0x2e7ca7=_[_0xfe7f('0x35')](_0x436f3f,function(_0x3d121b){return db[_0xfe7f('0x127')][_0xfe7f('0x92')]({'UserId':_0x165270['id'],'VoicePrefixId':_0x3d121b[_0xfe7f('0x128')]},{'transaction':_0x3c6731});});return Promise[_0xfe7f('0x56')](_0x2e7ca7);});});})[_0xfe7f('0x2a')](function(){for(var _0xa7b8a9=0x0;_0xa7b8a9<_0x3a46fa[_0xfe7f('0x60')];_0xa7b8a9++){var _0x2d9bad=_0x3a46fa[_0xa7b8a9]['getDataValue'](_0xfe7f('0xa5'));var _0x11ea0a=_0x2d9bad+_0xfe7f('0xaf');socket['emit']('user'+_0x2d9bad+_0xfe7f('0xb2'),{'UserId':_0x540586,['queueField']:_0x3a46fa[_0xa7b8a9]['id']});}})['then'](respondWithStatusCode(_0x589361,null))[_0xfe7f('0x1f')](APIHandleError(_0x589361));};exports[_0xfe7f('0x129')]=function(_0xbb98bb,_0x210c2f){var _0x12f1a8=_0xbb98bb['params']['id'];var _0x55cae0=null;if(_0xbb98bb[_0xfe7f('0x5c')][_0xfe7f('0x67')]){_0x55cae0=_[_0xfe7f('0xbc')](_0xbb98bb[_0xfe7f('0x5c')][_0xfe7f('0x67')])?_0xbb98bb[_0xfe7f('0x5c')][_0xfe7f('0x67')]:[_0xbb98bb['query'][_0xfe7f('0x67')]];}var _0x4646d4=[];return Promise[_0xfe7f('0x10c')]()[_0xfe7f('0x2a')](function(){if(!_0x55cae0)throw new APIBadRequestError(_0xfe7f('0x12a'));})['then'](function(){return db['User'][_0xfe7f('0xd7')]({'where':{'id':_0x12f1a8}});})[_0xfe7f('0x2a')](function(_0x47e778){if(!_0x47e778)throw new APINotFoundError(util[_0xfe7f('0xb7')](_0xfe7f('0x11e'),_0xbb98bb[_0xfe7f('0x58')]['id']));return db[_0xfe7f('0x6f')][_0xfe7f('0x11f')](function(_0xc1ce27){return _0x47e778[_0xfe7f('0x129')](_0x55cae0,{'transaction':_0xc1ce27})[_0xfe7f('0x2a')](function(){return db[_0xfe7f('0x121')][_0xfe7f('0x4b')]({'where':{'id':{'$in':_0x55cae0}}});})[_0xfe7f('0x2a')](function(_0x2fb72c){var _0x15aac9=_[_0xfe7f('0x35')](_0x2fb72c,function(_0x459940){return _0x459940[_0xfe7f('0x122')]();});return Promise[_0xfe7f('0x56')](_0x15aac9);})[_0xfe7f('0x2a')](function(_0x533b00){_0x4646d4=_[_0xfe7f('0x123')](_0x533b00);var _0x5eacae=_['map'](_0x4646d4,function(_0x1e2598){return _0x1e2598[_0xfe7f('0x12b')](_0x47e778['id'],{'transaction':_0xc1ce27});});return Promise[_0xfe7f('0x56')](_0x5eacae);})['then'](function(){if(!_0x47e778[_0xfe7f('0xb6')])return;var _0x1f41bd=_[_0xfe7f('0x33')](_0x4646d4,function(_0x1af2f3){return _0x1af2f3[_0xfe7f('0x125')](_0xfe7f('0xa5'))===_0xfe7f('0x12c');});var _0x271d90=_['map'](_0x1f41bd,function(_0x3c9dcf){return db[_0xfe7f('0xb9')]['destroy']({'where':{'VoiceQueueId':_0x3c9dcf['id'],'UserId':_0x47e778['id']},'transaction':_0xc1ce27});});return Promise[_0xfe7f('0x56')](_0x271d90);})[_0xfe7f('0x2a')](function(){return db['TeamVoicePrefix'][_0xfe7f('0x4b')]({'where':{'teamId':{'$in':_0x55cae0}}});})[_0xfe7f('0x2a')](function(_0x8e91b){var _0x472adb=_[_0xfe7f('0x35')](_0x8e91b,function(_0x94c9c2){return db['UserVoicePrefix'][_0xfe7f('0x2c')]({'where':{'UserId':_0x47e778['id'],'VoicePrefixId':_0x94c9c2[_0xfe7f('0x128')]}},{'transaction':_0xc1ce27});});return Promise[_0xfe7f('0x56')](_0x472adb);});});})['then'](function(){for(var _0x543d84=0x0;_0x543d84<_0x4646d4['length'];_0x543d84++){var _0x513419=_0x4646d4[_0x543d84]['getDataValue']('channel');var _0x31dc73=_0x513419+_0xfe7f('0xaf');socket[_0xfe7f('0xb0')](_0xfe7f('0x2e')+_0x513419+_0xfe7f('0xbd'),{'UserId':_0x12f1a8,['queueField']:_0x4646d4[_0x543d84]['id']});}})['then'](respondWithStatusCode(_0x210c2f,null))[_0xfe7f('0x1f')](APIHandleError(_0x210c2f));};exports[_0xfe7f('0x12d')]=function(_0x5d3531,_0x38cd79){var _0x1d31b7={};var _0x1e6559={};var _0x12245f;var _0xa13e1f;return db[_0xfe7f('0x4a')]['findOne']({'where':{'id':_0x5d3531[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x38cd79,null))[_0xfe7f('0x2a')](function(_0x3ceba1){if(_0x3ceba1){_0x12245f=_0x3ceba1;_0x1e6559[_0xfe7f('0x59')]=_[_0xfe7f('0x5a')](db['CmList'][_0xfe7f('0x3e')]);_0x1e6559['query']=_[_0xfe7f('0x5a')](_0x5d3531[_0xfe7f('0x5c')]);_0x1e6559['filters']=_['intersection'](_0x1e6559[_0xfe7f('0x59')],_0x1e6559[_0xfe7f('0x5c')]);_0x1d31b7[_0xfe7f('0x48')]=_[_0xfe7f('0x5e')](_0x1e6559[_0xfe7f('0x59')],qs['fields'](_0x5d3531[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x1d31b7['attributes']=_0x1d31b7[_0xfe7f('0x48')]['length']?_0x1d31b7[_0xfe7f('0x48')]:_0x1e6559['model'];_0x1d31b7[_0xfe7f('0xe4')]=qs['sort'](_0x5d3531[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x1d31b7[_0xfe7f('0x43')]=qs['filters'](_[_0xfe7f('0xda')](_0x5d3531[_0xfe7f('0x5c')],_0x1e6559[_0xfe7f('0x5d')]));if(_0x5d3531[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x1d31b7['where']=_[_0xfe7f('0x61')](_0x1d31b7[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x1d31b7[_0xfe7f('0x48')],function(_0x95fd17){var _0x56ddae={};_0x56ddae[_0x95fd17]={'$like':'%'+_0x5d3531[_0xfe7f('0x5c')][_0xfe7f('0x33')]+'%'};return _0x56ddae;})});}_0x1d31b7=_[_0xfe7f('0x61')]({},_0x1d31b7,_0x5d3531[_0xfe7f('0x62')]);return _0x12245f[_0xfe7f('0x12d')](_0x1d31b7);}})[_0xfe7f('0x2a')](function(_0x90cb6c){if(_0x90cb6c){_0xa13e1f=_0x90cb6c[_0xfe7f('0x60')];if(!_0x5d3531[_0xfe7f('0x5c')]['hasOwnProperty'](_0xfe7f('0xe0'))){_0x1d31b7[_0xfe7f('0x24')]=qs['limit'](_0x5d3531[_0xfe7f('0x5c')][_0xfe7f('0x24')]);_0x1d31b7[_0xfe7f('0x22')]=qs[_0xfe7f('0x22')](_0x5d3531[_0xfe7f('0x5c')]['offset']);}return _0x12245f[_0xfe7f('0x12d')](_0x1d31b7);}})[_0xfe7f('0x2a')](function(_0x311795){if(_0x311795){return _0x311795?{'count':_0xa13e1f,'rows':_0x311795}:null;}})[_0xfe7f('0x2a')](respondWithResult(_0x38cd79,null))[_0xfe7f('0x1f')](handleError(_0x38cd79,null));};exports['getAgents']=function(_0x563504,_0x33cd4c){var _0x483d6c={};var _0x5cca4e={};var _0x41d82d;return db[_0xfe7f('0x4a')][_0xfe7f('0xd7')]({'where':{'id':_0x563504[_0xfe7f('0x58')]['id']}})[_0xfe7f('0x2a')](handleEntityNotFound(_0x33cd4c,null))['then'](function(_0xadbe7b){if(_0xadbe7b){_0x41d82d=_0xadbe7b;_0x5cca4e['model']=_[_0xfe7f('0x5a')](db['User'][_0xfe7f('0x3e')]);_0x5cca4e[_0xfe7f('0x5c')]=_[_0xfe7f('0x5a')](_0x563504[_0xfe7f('0x5c')]);_0x5cca4e[_0xfe7f('0x5d')]=_['intersection'](_0x5cca4e[_0xfe7f('0x59')],_0x5cca4e[_0xfe7f('0x5c')]);_0x483d6c['attributes']=_['intersection'](_0x5cca4e['model'],qs['fields'](_0x563504[_0xfe7f('0x5c')][_0xfe7f('0x5f')]));_0x483d6c[_0xfe7f('0x48')]=_0x483d6c[_0xfe7f('0x48')][_0xfe7f('0x60')]?_0x483d6c[_0xfe7f('0x48')]:_0x5cca4e[_0xfe7f('0x59')];_0x483d6c['order']=qs['sort'](_0x563504[_0xfe7f('0x5c')][_0xfe7f('0xd9')]);_0x483d6c[_0xfe7f('0x43')]=qs[_0xfe7f('0x5d')](_[_0xfe7f('0xda')](_0x563504['query'],_0x5cca4e[_0xfe7f('0x5d')]));if(_0x563504[_0xfe7f('0x5c')][_0xfe7f('0x33')]){_0x483d6c['where']=_[_0xfe7f('0x61')](_0x483d6c[_0xfe7f('0x43')],{'$or':_[_0xfe7f('0x35')](_0x483d6c[_0xfe7f('0x48')],function(_0x29c882){var _0x50a9e9={};_0x50a9e9[_0x29c882]={'$like':'%'+_0x563504[_0xfe7f('0x5c')][_0xfe7f('0x33')]+'%'};return _0x50a9e9;})});}_0x483d6c['model']=db[_0xfe7f('0x4a')];_0x483d6c['as']=_0xfe7f('0x2f');_0x483d6c=_[_0xfe7f('0x61')]({},_0x483d6c,_0x563504[_0xfe7f('0x62')]);return _0x41d82d[_0xfe7f('0x103')]({'include':[_0x483d6c]});}})[_0xfe7f('0x2a')](function(_0x3d8b9c){if(_0x3d8b9c){var _0x5da898={},_0x592623=[];for(var _0x35af17=0x0;_0x35af17<_0x3d8b9c[_0xfe7f('0x60')];_0x35af17+=0x1){for(var _0x44c441=0x0,_0x626a01;_0x44c441<_0x3d8b9c[_0x35af17]['Agents'][_0xfe7f('0x60')];_0x44c441+=0x1){_0x626a01=_0x3d8b9c[_0x35af17][_0xfe7f('0x2f')][_0x44c441][_0xfe7f('0xb5')]({'plain':!![]});_0x5da898[_0x626a01['id']]=_0x626a01;}}_0x5da898=_[_0xfe7f('0x12e')](_0x5da898);for(var _0x19df58=qs[_0xfe7f('0x22')](_0x563504[_0xfe7f('0x5c')][_0xfe7f('0x22')]);_0x19df58<_0x5da898[_0xfe7f('0x60')]&&_0x592623[_0xfe7f('0x60')]=_0x4d8a9f){_0x1a5978=_0x4d8a9f;_0x40d7bc=0xc8;}else{_0x40d7bc=0xce;}_0x1512aa[_0x424e('0x23')](_0x40d7bc);return _0x1512aa['set']('Content-Range',_0x4f932a+'-'+_0x1a5978+'/'+_0x4d8a9f)['json'](_0x2b70fa);}return null;};}function saveUpdates(_0x3a6435){return function(_0x40b29d){if(_0x40b29d){return _0x40b29d[_0x424e('0x28')](_0x3a6435)[_0x424e('0x18')](function(_0x1a714f){socket[_0x424e('0x29')](_0x424e('0x2a')+_0x1a714f['id'],{});return _0x1a714f;});}return null;};}function removeEntity(_0x13d3b1){return function(_0x487f6e){if(_0x487f6e){return _0x487f6e[_0x424e('0x2b')]()[_0x424e('0x18')](function(){var _0x30d90b=_0x487f6e['get']({'plain':!![]});if(_0x30d90b['role']===_0x424e('0x2c'))return;var _0x31c72b=[{'name':_0x424e('0x2d'),'value':_0x424e('0x2e'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':_0x424e('0x2f'),'ignore':![]}];var _0x4a0d7a=_(_0x31c72b)['filter']('ignore')[_0x424e('0x30')](_0x424e('0x31'))[_0x424e('0x31')]();if(_['includes'](_0x4a0d7a,_0x30d90b['role'])){return;}var _0x32456e=_[_0x424e('0x32')](_0x31c72b,[_0x424e('0x31'),_0x30d90b['role']])[_0x424e('0x33')];return db[_0x424e('0x34')]['destroy']({'where':{'type':_0x32456e,'resourceId':_0x30d90b['id']}})[_0x424e('0x18')](function(){return _0x487f6e;});})[_0x424e('0x18')](function(){_0x13d3b1[_0x424e('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504637){return function(_0x4a2b60){if(!_0x4a2b60){_0x504637[_0x424e('0x22')](0x194);}return _0x4a2b60;};}function handleError(_0x20803d,_0x569ee4){_0x569ee4=_0x569ee4||0x1f4;return function(_0x3e386c){logger['error'](_0x3e386c[_0x424e('0x35')]);if(_0x3e386c[_0x424e('0x33')]){delete _0x3e386c[_0x424e('0x33')];}_0x20803d[_0x424e('0x23')](_0x569ee4)[_0x424e('0x36')](_0x3e386c);};}exports[_0x424e('0x37')]=function(_0x1d1976,_0x2ffaca){var _0x1dca8a={},_0x4e17d0={'count':0x0,'rows':[]};var _0x201c83=_(db['User'][_0x424e('0x38')])['map'](function(_0x4fc0ed){return{'name':_0x4fc0ed[_0x424e('0x39')],'type':_0x4fc0ed[_0x424e('0x3a')][_0x424e('0x3b')]};})[_0x424e('0x3c')](function(_0x58a663){return!_[_0x424e('0x3d')](['password',_0x424e('0x3e')],_0x58a663[_0x424e('0x33')]);})[_0x424e('0x31')]();_0x1dca8a=qs[_0x424e('0x3f')](_0x201c83,_0x1d1976);var _0x25b173={'where':_0x1dca8a[_0x424e('0x40')]};return db['User'][_0x424e('0x41')](_0x25b173)[_0x424e('0x18')](function(_0x1c7d32){_0x4e17d0[_0x424e('0x41')]=_0x1c7d32;if(_0x1d1976['query'][_0x424e('0x42')]){_0x1dca8a[_0x424e('0x43')]=[{'all':!![]}];}if(_0x1d1976[_0x424e('0x44')][_0x424e('0x45')]===_0x424e('0x46')){_0x1dca8a['include']=[{'model':db[_0x424e('0x47')],'as':_0x424e('0x45')}];}if(!_['includes'](_0x1dca8a[_0x424e('0x48')],'id')){_0x1dca8a[_0x424e('0x48')][_0x424e('0x49')]('id');}return db[_0x424e('0x4a')][_0x424e('0x4b')](_0x1dca8a);})[_0x424e('0x18')](function(_0x12524e){_0x4e17d0['rows']=_0x12524e;if(_0x1d1976['query'][_0x424e('0x4c')]===_0x424e('0x46')){var _0x1c65f0=[];for(var _0x22a0f6=0x0;_0x22a0f6<_0x4e17d0['rows']['length'];_0x22a0f6++){_0x1c65f0[_0x424e('0x49')](get_open_tabs(_0x424e('0x4d'),_0x4e17d0[_0x424e('0x4e')][_0x22a0f6]['dataValues']));_0x1c65f0['push'](get_open_tabs('sms',_0x4e17d0[_0x424e('0x4e')][_0x22a0f6][_0x424e('0x4f')]));_0x1c65f0['push'](get_open_tabs('fax',_0x4e17d0[_0x424e('0x4e')][_0x22a0f6][_0x424e('0x4f')]));_0x1c65f0[_0x424e('0x49')](get_open_tabs(_0x424e('0x50'),_0x4e17d0['rows'][_0x22a0f6]['dataValues']));_0x1c65f0[_0x424e('0x49')](get_open_tabs(_0x424e('0x51'),_0x4e17d0[_0x424e('0x4e')][_0x22a0f6][_0x424e('0x4f')]));_0x1c65f0[_0x424e('0x49')](get_open_tabs('whatsapp',_0x4e17d0['rows'][_0x22a0f6][_0x424e('0x4f')]));}return BPromise['all'](_0x1c65f0)['then'](function(){return _0x4e17d0;});}else{return _0x4e17d0;}})['then'](respondWithFilteredResult(_0x2ffaca,_0x1dca8a))[_0x424e('0x52')](handleError(_0x2ffaca,null));};exports[_0x424e('0x53')]=function(_0x27f021,_0x494cc7){var _0x50cb6f={'raw':![],'where':{'id':_0x27f021[_0x424e('0x54')]['id']}},_0x204229={};_0x204229['model']=_['differenceBy'](_[_0x424e('0x55')](db['User'][_0x424e('0x38')]),[_0x424e('0x56'),_0x424e('0x3e')]);_0x204229[_0x424e('0x44')]=_['keys'](_0x27f021[_0x424e('0x44')]);_0x204229[_0x424e('0x57')]=_[_0x424e('0x58')](_0x204229[_0x424e('0x59')],_0x204229['query']);_0x50cb6f[_0x424e('0x48')]=_['intersection'](_0x204229['model'],qs[_0x424e('0x5a')](_0x27f021['query']['fields']));_0x50cb6f['attributes']=_0x50cb6f[_0x424e('0x48')][_0x424e('0x5b')]?_0x50cb6f['attributes']:_0x204229['model'];if(_0x27f021['query'][_0x424e('0x42')]){_0x50cb6f[_0x424e('0x43')]=[{'all':!![]}];}if(_0x27f021[_0x424e('0x44')]['userSetting']===_0x424e('0x46')){_0x50cb6f[_0x424e('0x43')]=[{'model':db['UserSetting'],'as':_0x424e('0x45')}];}_0x50cb6f=_[_0x424e('0x5c')]({},_0x50cb6f,_0x27f021[_0x424e('0x5d')]);if(!_['includes'](_0x50cb6f[_0x424e('0x48')],'id')){_0x50cb6f[_0x424e('0x48')][_0x424e('0x49')]('id');}return db['User'][_0x424e('0x32')](_0x50cb6f)[_0x424e('0x18')](handleEntityNotFound(_0x494cc7,null))[_0x424e('0x18')](function(_0x5244b7){var _0x5a4fd5=[];values=_0x5244b7;if(_0x27f021['query'][_0x424e('0x4c')]===_0x424e('0x46')){_0x5a4fd5[_0x424e('0x49')](get_open_tabs('chat',_0x5244b7[_0x424e('0x4f')]));_0x5a4fd5[_0x424e('0x49')](get_open_tabs(_0x424e('0x5e'),_0x5244b7[_0x424e('0x4f')]));_0x5a4fd5[_0x424e('0x49')](get_open_tabs(_0x424e('0x51'),_0x5244b7[_0x424e('0x4f')]));_0x5a4fd5[_0x424e('0x49')](get_open_tabs(_0x424e('0x5f'),_0x5244b7[_0x424e('0x4f')]));_0x5a4fd5[_0x424e('0x49')](get_open_tabs('fax',_0x5244b7[_0x424e('0x4f')]));_0x5a4fd5['push'](get_open_tabs(_0x424e('0x50'),_0x5244b7[_0x424e('0x4f')]));return BPromise[_0x424e('0x60')](_0x5a4fd5);}else{return values;}})['then'](function(){return values;})[_0x424e('0x18')](respondWithResult(_0x494cc7,null))[_0x424e('0x52')](handleError(_0x494cc7,null));};exports[_0x424e('0x28')]=function(_0x786a57,_0xd86e7e){if(_0x786a57[_0x424e('0x61')]['id']){delete _0x786a57[_0x424e('0x61')]['id'];}delete _0x786a57[_0x424e('0x61')][_0x424e('0x62')];return db[_0x424e('0x4a')]['find']({'where':{'id':_0x786a57[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0xd86e7e,null))[_0x424e('0x18')](saveUpdates(_0x786a57[_0x424e('0x61')],null))[_0x424e('0x18')](respondWithResult(_0xd86e7e,null))['catch'](handleError(_0xd86e7e,null));};exports[_0x424e('0x63')]=function(_0x5e8ea3,_0x189205){return db['User'][_0x424e('0x63')]()[_0x424e('0x18')](respondWithResult(_0x189205,null))['catch'](handleError(_0x189205,null));};exports[_0x424e('0x64')]=function(_0x5a92d2,_0x9d9fdf){return db['User']['find']({'where':{'id':_0x5a92d2[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x9d9fdf,null))[_0x424e('0x18')](function(_0x9085b3){if(_0x9085b3){return _0x9085b3[_0x424e('0x64')](_0x5a92d2[_0x424e('0x61')][_0x424e('0x65')],_['omit'](_0x5a92d2[_0x424e('0x61')],[_0x424e('0x65'),'id'])||{});}})[_0x424e('0x18')](respondWithResult(_0x9d9fdf,null))['catch'](handleError(_0x9d9fdf,null));};function validateUser(_0x4868b8){return new BPromise(function(_0x4e90c1,_0x3d8ec7){if(_0x4868b8[_0x424e('0x66')])return _0x4e90c1(_0x4868b8);return db[_0x424e('0x67')][_0x424e('0x68')](0x1)['then'](function(_0x11e12d){if(_0x11e12d[_0x424e('0x69')])authService['validatePasswordPattern'](_0x4868b8[_0x424e('0x56')]);db[_0x424e('0x4a')][_0x424e('0x6a')]('internal')[_0x424e('0x18')](function(_0x3cc97b){if(_[_0x424e('0x6b')](_0x3cc97b)){_0x4868b8['internal']=_0x11e12d[_0x424e('0x6c')]||0x1;return;}if(_[_0x424e('0x6b')](_0x11e12d['min_internal'])||_0x11e12d[_0x424e('0x6c')]===_0x3cc97b){_0x4868b8[_0x424e('0x66')]=_0x3cc97b+0x1;return;}if(_0x11e12d[_0x424e('0x6c')]>_0x3cc97b){_0x4868b8['internal']=_0x11e12d[_0x424e('0x6c')];return;}return db[_0x424e('0x6d')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x424e('0x6d')][_0x424e('0x6e')][_0x424e('0x6f')]})[_0x424e('0x18')](function(_0x56b295){if(_0x56b295&&_0x56b295[_0x424e('0x5b')]){for(var _0x3176fb=0x0,_0x1996ca=_0x56b295[_0x424e('0x5b')];_0x3176fb<_0x1996ca&&_[_0x424e('0x6b')](_0x4868b8[_0x424e('0x66')]);_0x3176fb++){if(_0x11e12d[_0x424e('0x6c')]<=_0x56b295[_0x3176fb][_0x424e('0x70')]){_0x4868b8[_0x424e('0x66')]=_0x56b295[_0x3176fb][_0x424e('0x70')];}else if(_0x11e12d[_0x424e('0x6c')]>_0x56b295[_0x3176fb][_0x424e('0x70')]&&_0x11e12d[_0x424e('0x6c')]<=_0x56b295[_0x3176fb]['to']){_0x4868b8[_0x424e('0x66')]=_0x11e12d['min_internal'];}}}if(_[_0x424e('0x6b')](_0x4868b8['internal'])){_0x4868b8[_0x424e('0x66')]=_0x3cc97b+0x1;}return _0x4e90c1(_0x4868b8);});});})[_0x424e('0x52')](function(_0x2bea1e){_0x3d8ec7(_0x2bea1e);});});}function updateUser(_0x2a233a){return new BPromise(function(_0x2da5f1,_0x4ba621){try{if(_0x2a233a[_0x424e('0x71')]){_0x2a233a[_0x424e('0x72')]=_0x2a233a['internal'];_0x2a233a[_0x424e('0x73')]={'mailbox':_0x2a233a['internal'],'password':_0x2a233a[_0x424e('0x56')],'fullname':_0x2a233a[_0x424e('0x74')],'email':_0x2a233a[_0x424e('0x75')]};}if(_0x2a233a[_0x424e('0x62')]===_0x424e('0x76')){if(!_0x2a233a[_0x424e('0x77')])_0x2a233a[_0x424e('0x77')]=[_0x424e('0x78'),_0x424e('0x79'),'103',_0x424e('0x7a'),'110',_0x424e('0x7b'),_0x424e('0x7c'),_0x424e('0x7d'),_0x424e('0x7e'),_0x424e('0x7f'),_0x424e('0x80'),_0x424e('0x81'),_0x424e('0x82'),_0x424e('0x83'),_0x424e('0x84')];}_0x2da5f1(_0x2a233a);}catch(_0x59806e){_0x4ba621(_0x59806e);}});}exports[_0x424e('0x85')]=function(_0x4855fe,_0x33b9b3){if(_0x4855fe[_0x424e('0x2e')][_0x424e('0x62')]==='agent')throw new Error(_0x424e('0x86'));if(_0x4855fe[_0x424e('0x61')][_0x424e('0x62')]===_0x424e('0x2e')&&_0x4855fe['user']['role']!==_0x424e('0x2c')){throw new Error(_0x424e('0x87'));}if(_0x4855fe[_0x424e('0x61')]['role']==='admin'&&_0x4855fe['user'][_0x424e('0x62')]!==_0x424e('0x2c')){throw new Error(_0x424e('0x88'));}return licenseUtil[_0x424e('0x89')]([_0x4855fe['body']])['then'](function(){return validateUser(_0x4855fe[_0x424e('0x61')]);})[_0x424e('0x18')](function(_0xd23b2){return updateUser(_0xd23b2)[_0x424e('0x18')](function(_0x4d3118){if(_0x4d3118[_0x424e('0x62')]===_0x424e('0x2c')){_0x4d3118['settingsEnabled']=_0x4855fe[_0x424e('0x2e')][_0x424e('0x8a')];delete _0x4d3118[_0x424e('0x8b')];}return _0x4d3118;});})[_0x424e('0x18')](function(_0x3da02f){return db[_0x424e('0x4a')][_0x424e('0x85')](_0x3da02f,{'include':[{'model':db[_0x424e('0x73')],'as':_0x424e('0x73')}]});})[_0x424e('0x18')](function(_0x3d3e8c){if(_0x4855fe[_0x424e('0x61')][_0x424e('0x62')]===_0x424e('0x2e'))return _0x3d3e8c;if(_0x4855fe[_0x424e('0x2e')]['role']!==_0x424e('0x2e'))return _0x3d3e8c;return db[_0x424e('0x8c')][_0x424e('0x32')]({'where':{'name':_0x3d3e8c[_0x424e('0x62')]===_0x424e('0x76')?'Agents':_0x424e('0x8d'),'userProfileId':_0x4855fe[_0x424e('0x2e')]['userProfileId']},'raw':!![]})[_0x424e('0x18')](function(_0xa49829){if(!_0xa49829||_0xa49829[_0x424e('0x8e')]!=0x0)return _0x3d3e8c;return db[_0x424e('0x34')][_0x424e('0x85')]({'name':_0x3d3e8c[_0x424e('0x33')],'resourceId':_0x3d3e8c['id'],'type':_0xa49829[_0x424e('0x33')],'sectionId':_0xa49829['id']},{})['then'](function(){return _0x3d3e8c;});})[_0x424e('0x52')](function(_0xb4fa01){logger[_0x424e('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb4fa01);throw _0xb4fa01;});})[_0x424e('0x18')](respondWithResult(_0x33b9b3,0xc9))[_0x424e('0x52')](handleError(_0x33b9b3,null));};exports['bulkCreate']=function(_0x130091,_0x17a84e){var _0xdc136a=_0x130091[_0x424e('0x61')];var _0x1059ba=[];if(_0x130091[_0x424e('0x2e')][_0x424e('0x62')]===_0x424e('0x76'))throw new Error(_0x424e('0x86'));if(_[_0x424e('0x8f')](_0xdc136a,[_0x424e('0x62'),_0x424e('0x2e')])&&_0x130091[_0x424e('0x2e')][_0x424e('0x62')]!==_0x424e('0x2c')){throw new Error(_0x424e('0x87'));}if(_[_0x424e('0x8f')](_0xdc136a,[_0x424e('0x62'),_0x424e('0x2c')])&&_0x130091['user'][_0x424e('0x62')]!==_0x424e('0x2c')){throw new Error(_0x424e('0x90'));}return licenseUtil[_0x424e('0x89')](_0xdc136a)[_0x424e('0x18')](function(){return validateUser(_0xdc136a[0x0]);})[_0x424e('0x18')](function(){for(var _0x92e1d9=0x1;_0x92e1d9<_0xdc136a[_0x424e('0x5b')];_0x92e1d9++){var _0x351fb6=_0xdc136a[_0x92e1d9-0x1][_0x424e('0x66')];if(!_0xdc136a[_0x92e1d9]['internal'])_0xdc136a[_0x92e1d9]['internal']=_0x351fb6+0x1;_0x1059ba['push'](validateUser(_0xdc136a[_0x92e1d9]));}return BPromise[_0x424e('0x60')](_0x1059ba);})['then'](function(){_0x1059ba=[];for(var _0x1a6125=0x0;_0x1a6125<_0xdc136a[_0x424e('0x5b')];_0x1a6125++){_0x1059ba[_0x424e('0x49')](updateUser(_0xdc136a[_0x1a6125]));}return BPromise[_0x424e('0x60')](_0x1059ba);})['then'](function(){return BPromise[_0x424e('0x91')](_0xdc136a,function(_0xea4a23){return db[_0x424e('0x4a')][_0x424e('0x85')](_0xea4a23,{'include':[{'model':db[_0x424e('0x73')],'as':_0x424e('0x73')}]})['then'](function(_0x568133){_0xea4a23['id']=_0x568133['id'];return _0xea4a23;});});})['then'](function(_0x199776){if(_0x130091[_0x424e('0x61')][_0x424e('0x62')]===_0x424e('0x2e'))return _0x199776;if(_0x130091[_0x424e('0x2e')]['role']!=='user')return _0x199776;var _0x496751=_[_0x424e('0x8f')](_0x199776,function(_0x25a8e8){return _0x25a8e8[_0x424e('0x62')]===_0x424e('0x76')||_0x25a8e8[_0x424e('0x62')]===_0x424e('0x2f');});if(!_0x496751)return _0x199776;return db[_0x424e('0x8c')][_0x424e('0x4b')]({'where':{'name':{'$or':[_0x424e('0x92'),_0x424e('0x8d')]},'userProfileId':_0x130091[_0x424e('0x2e')][_0x424e('0x8b')]},'raw':!![]})[_0x424e('0x18')](function(_0x4b13b3){if(_[_0x424e('0x93')](_0x4b13b3)||!_['some'](_0x4b13b3,[_0x424e('0x8e'),0x0]))return _0x199776;_0x1059ba=[];var _0x540332=_(_0x4b13b3)[_0x424e('0x30')](function(_0x15e040){if(_0x15e040[_0x424e('0x8e')]===0x1)return;return _0x15e040[_0x424e('0x33')]===_0x424e('0x92')?_0x424e('0x76'):_0x424e('0x2f');})[_0x424e('0x94')]()[_0x424e('0x31')]();for(var _0x2082a5=0x0;_0x2082a5<_0x199776[_0x424e('0x5b')];_0x2082a5++){if(!_['includes'](_0x540332,_0x199776[_0x2082a5][_0x424e('0x62')]))return;var _0x3cbaa7=_0x199776[_0x2082a5][_0x424e('0x62')]==='agent'?_0x424e('0x92'):'Telephones';_0x1059ba[_0x424e('0x49')](db['UserProfileResource'][_0x424e('0x85')]({'name':_0x199776[_0x2082a5][_0x424e('0x33')],'resourceId':_0x199776[_0x2082a5]['id'],'type':_0x3cbaa7,'sectionId':_[_0x424e('0x32')](_0x4b13b3,['name',_0x3cbaa7])['id']},{}));}return BPromise[_0x424e('0x60')](_0x1059ba);});})[_0x424e('0x18')](respondWithResult(_0x17a84e,0xc9))[_0x424e('0x52')](handleError(_0x17a84e,null));};exports[_0x424e('0x95')]=function(_0x5f1e52,_0x4053f0){if(_0x5f1e52[_0x424e('0x61')]['id']){delete _0x5f1e52[_0x424e('0x61')]['id'];}return db[_0x424e('0x4a')][_0x424e('0x32')]({'where':{'id':_0x5f1e52[_0x424e('0x54')]['id']}})[_0x424e('0x18')](function(_0x2bcaff){if(!_0x2bcaff)return null;if(_0x2bcaff['id']===_0x5f1e52['user']['id']){if(!_0x5f1e52['body']['oldPassword']||!_0x5f1e52['body'][_0x424e('0x96')]){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0x99'));}if(!_0x2bcaff[_0x424e('0x9a')](_0x5f1e52[_0x424e('0x61')][_0x424e('0x9b')])){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0x9c'));}if(_0x5f1e52[_0x424e('0x61')]['oldPassword']===_0x5f1e52[_0x424e('0x61')]['newPassword']){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0x9d'));}}else if(_0x5f1e52[_0x424e('0x2e')]['role']===_0x424e('0x2c')){if(!_0x5f1e52['body'][_0x424e('0x96')]){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0x9e'));}}else if(_0x5f1e52[_0x424e('0x2e')][_0x424e('0x62')]===_0x424e('0x2e')){if(!_0x5f1e52[_0x424e('0x61')]['newPassword']){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0x9e'));}if(_0x2bcaff[_0x424e('0x62')]!=='agent'){throw new db['Sequelize'][(_0x424e('0x98'))](_0x424e('0x86'));}}else{throw new db['Sequelize']['ValidationError'](_0x424e('0x86'));}return _0x2bcaff;})[_0x424e('0x18')](handleEntityNotFound(_0x4053f0,null))['then'](function(_0x582089){return db[_0x424e('0x67')][_0x424e('0x9f')]({'attributes':['id',_0x424e('0x69'),_0x424e('0xa0'),_0x424e('0xa1')]})[_0x424e('0x18')](function(_0x30161d){if(_0x30161d[_0x424e('0x69')])authService[_0x424e('0xa2')](_0x5f1e52['body']['newPassword']);if(!_0x30161d['enforcePasswordHistory']||!_0x582089[_0x424e('0xa3')])return _0x582089;authService[_0x424e('0xa4')](_0x5f1e52[_0x424e('0x61')]['newPassword'],_0x582089['previousPasswords'],_0x30161d['passwordHistoryLimit']);return _0x582089;})[_0x424e('0x18')](saveUpdates({'password':_0x5f1e52[_0x424e('0x61')][_0x424e('0x96')],'passwordResetAt':_0x5f1e52['user']['id']==_0x5f1e52['params']['id']?moment():null,'previousPasswords':authService[_0x424e('0xa5')](_0x5f1e52['body']['newPassword'],_0x582089[_0x424e('0xa3')])},null));})['then'](respondWithResult(_0x4053f0,null))[_0x424e('0x52')](handleError(_0x4053f0,null));};exports[_0x424e('0xa6')]=function(_0x145cca,_0x47d729){var _0x76f34a=_0x145cca[_0x424e('0x61')][_0x424e('0xa7')];return db[_0x424e('0x4a')][_0x424e('0x32')]({'where':{'id':_0x145cca[_0x424e('0x54')]['id']},'attributes':['id',_0x424e('0x33'),'role','online',_0x424e('0xa8'),_0x424e('0xa9'),'interface']})['then'](handleEntityNotFound(_0x47d729,null))['then'](function(_0x464de1){if(_0x464de1){if(!utils[_0x424e('0xaa')](_0x76f34a)){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0xab'));}return _0x464de1[_0x424e('0xac')+_[_0x424e('0xad')](_0x76f34a[_0x424e('0xae')]())+_0x424e('0xaf')](_0x145cca['body'][_0x424e('0x65')],{'penalty':_0x145cca[_0x424e('0x61')]['penalty']||0x0})[_0x424e('0xb0')](function(_0x5bd337){for(var _0x49843f=0x0;_0x49843f<_0x145cca[_0x424e('0x61')]['ids'][_0x424e('0x5b')];_0x49843f+=0x1){var _0x49ec96={'UserId':Number(_0x145cca[_0x424e('0x54')]['id'])};_0x49ec96[_[_0x424e('0xad')](_0x76f34a[_0x424e('0xae')]())+_0x424e('0xb1')]=Number(_0x145cca[_0x424e('0x61')]['ids'][_0x49843f]);socket[_0x424e('0x29')]('user'+_[_0x424e('0xad')](_0x76f34a[_0x424e('0xae')]())+_0x424e('0xb2'),_0x49ec96);}return _0x5bd337;})['then'](function(){if(_0x76f34a===_0x424e('0xb3')){return db[_0x424e('0xb4')][_0x424e('0x4b')]({'where':{'id':_0x145cca[_0x424e('0x61')]['ids']||[]},'raw':!![],'attributes':['id',_0x424e('0x33')]});}})[_0x424e('0x18')](function(_0x5d197a){var _0x2dde1e=_0x464de1[_0x424e('0xb5')]({'plain':!![]});var _0x15159e=[];if(_0x76f34a===_0x424e('0xb3')&&_0x2dde1e['role']===_0x424e('0x76')&&_0x2dde1e[_0x424e('0xb6')]){for(var _0x24cefa=0x0;_0x24cefa<_0x5d197a[_0x424e('0x5b')];_0x24cefa+=0x1){_0x15159e[_0x424e('0x49')]({'membername':_0x2dde1e['name'],'UserId':_0x2dde1e['id'],'queue_name':_0x5d197a[_0x24cefa]['name'],'VoiceQueueId':_0x5d197a[_0x24cefa]['id'],'interface':_['isNil'](_0x2dde1e[_0x424e('0xb7')])?util['format'](_0x424e('0xb8'),_0x2dde1e[_0x424e('0x33')]):_0x2dde1e[_0x424e('0xb7')],'paused':_0x2dde1e[_0x424e('0xa9')]||![],'penalty':_0x145cca[_0x424e('0x61')][_0x424e('0xb9')]||0x0});}return BPromise[_0x424e('0x91')](_0x15159e,function(_0x2213b3){return db['UserVoiceQueueRt']['upsert'](_0x2213b3);});}return _0x464de1;});}})[_0x424e('0x18')](respondWithStatusCode(_0x47d729,null))[_0x424e('0x52')](handleError(_0x47d729,null));};exports[_0x424e('0xba')]=function(_0x28ada7,_0x4c05ba){var _0x370b6a,_0xaf42f3;return db[_0x424e('0x4a')][_0x424e('0x32')]({'where':{'id':_0x28ada7['params']['id']},'attributes':['id',_0x424e('0x33'),_0x424e('0x62')]})[_0x424e('0x18')](handleEntityNotFound(_0x4c05ba,null))['then'](function(_0xe037e5){if(_0xe037e5){_0x370b6a=_0xe037e5;if(!_0x28ada7['query'][_0x424e('0xa7')]||!utils[_0x424e('0xaa')](_0x28ada7[_0x424e('0x44')][_0x424e('0xa7')])){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0xab'));}return _0xe037e5[_0x424e('0xbb')+_[_0x424e('0xad')](_0x28ada7['query'][_0x424e('0xa7')][_0x424e('0xae')]())+_0x424e('0xaf')](_0x28ada7['query'][_0x424e('0x65')]);}})[_0x424e('0x18')](function(_0x93a7ca){if(_['isArray'](_0x28ada7['query'][_0x424e('0x65')])){for(var _0x4fd121=0x0;_0x4fd121<_0x28ada7[_0x424e('0x44')][_0x424e('0x65')]['length'];_0x4fd121+=0x1){_0xaf42f3={'UserId':Number(_0x28ada7[_0x424e('0x54')]['id'])};_0xaf42f3[_[_0x424e('0xad')](_0x28ada7['query']['channel']['toLowerCase']())+'QueueId']=Number(_0x28ada7[_0x424e('0x44')][_0x424e('0x65')][_0x4fd121]);socket[_0x424e('0x29')](_0x424e('0x2e')+_[_0x424e('0xad')](_0x28ada7[_0x424e('0x44')][_0x424e('0xa7')][_0x424e('0xae')]())+_0x424e('0xbc'),_0xaf42f3);}}else{_0xaf42f3={'UserId':Number(_0x28ada7['params']['id'])};_0xaf42f3[_[_0x424e('0xad')](_0x28ada7[_0x424e('0x44')][_0x424e('0xa7')][_0x424e('0xae')]())+'QueueId']=Number(_0x28ada7[_0x424e('0x44')][_0x424e('0x65')]);socket[_0x424e('0x29')]('user'+_[_0x424e('0xad')](_0x28ada7[_0x424e('0x44')][_0x424e('0xa7')][_0x424e('0xae')]())+_0x424e('0xbc'),_0xaf42f3);}return _0x93a7ca;})[_0x424e('0x18')](function(){if(_0x28ada7[_0x424e('0x44')]['channel']==='voice'){return db['UserVoiceQueueRt'][_0x424e('0x2b')]({'where':{'UserId':_0x28ada7[_0x424e('0x54')]['id'],'VoiceQueueId':_0x28ada7['query'][_0x424e('0x65')]},'individualHooks':!![]})['then'](function(){return _0x370b6a;});}return _0x370b6a;})[_0x424e('0x18')](respondWithStatusCode(_0x4c05ba,null))[_0x424e('0x52')](handleError(_0x4c05ba,null));};exports[_0x424e('0xbd')]=function(_0x50b0e9,_0x16821a){_0x50b0e9[_0x424e('0x61')][_0x424e('0xbe')]=_0x50b0e9['file'][_0x424e('0xbf')];return db[_0x424e('0x4a')][_0x424e('0x32')]({'where':{'id':_0x50b0e9[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x16821a,null))[_0x424e('0x18')](saveUpdates(_0x50b0e9[_0x424e('0x61')],null))['then'](respondWithResult(_0x16821a,null))[_0x424e('0x52')](handleError(_0x16821a,null));};exports[_0x424e('0xc0')]=function(_0x5f3129,_0x10af0a){var _0x2abd20=path[_0x424e('0xc1')](config[_0x424e('0xc2')],_0x424e('0xc3'));return db[_0x424e('0x4a')][_0x424e('0x32')]({'where':{'id':_0x5f3129[_0x424e('0x54')]['id']},'attributes':['id',_0x424e('0xbe')],'raw':!![]})[_0x424e('0x18')](handleEntityNotFound(_0x10af0a,null))[_0x424e('0x18')](function(_0x1e7b96){if(_0x1e7b96){if(_[_0x424e('0x6b')](_0x1e7b96['userpic'])){return _0x10af0a[_0x424e('0xc4')](_0x2abd20);}else{if(!fs[_0x424e('0xc5')](path[_0x424e('0xc1')](config[_0x424e('0xc2')],'server/files/images/',_0x1e7b96['userpic']))){return _0x10af0a[_0x424e('0xc4')](_0x2abd20);}return _0x10af0a['download'](path[_0x424e('0xc1')](config[_0x424e('0xc2')],_0x424e('0xc6'),_0x1e7b96['userpic']));}}})[_0x424e('0x52')](handleError(_0x10af0a,null));};exports[_0x424e('0xc7')]=function(_0x46c406,_0x4896c4){return db[_0x424e('0x4a')][_0x424e('0x32')]({'where':{'id':_0x46c406[_0x424e('0x54')]['id']},'attributes':['id']})[_0x424e('0x18')](handleEntityNotFound(_0x4896c4,null))[_0x424e('0x18')](function(_0x4249b1){var _0x32d261=[];values=_0x4249b1['dataValues'];_0x32d261[_0x424e('0x49')](get_open_tabs(_0x424e('0x4d'),_0x4249b1['dataValues']));_0x32d261[_0x424e('0x49')](get_open_tabs(_0x424e('0x5e'),_0x4249b1[_0x424e('0x4f')]));_0x32d261[_0x424e('0x49')](get_open_tabs('openchannel',_0x4249b1[_0x424e('0x4f')]));_0x32d261[_0x424e('0x49')](get_open_tabs(_0x424e('0x5f'),_0x4249b1['dataValues']));_0x32d261[_0x424e('0x49')](get_open_tabs('fax',_0x4249b1[_0x424e('0x4f')]));_0x32d261[_0x424e('0x49')](get_open_tabs(_0x424e('0x50'),_0x4249b1['dataValues']));return BPromise[_0x424e('0x60')](_0x32d261);})[_0x424e('0x18')](function(_0x59c5a6){if(_0x59c5a6){var _0x2db591=_[_0x424e('0x30')](values['ChatOpenTabs'],function(_0x4b96f5){return{'channel':_0x424e('0xc8'),'id':_0x4b96f5['id'],'createdAt':_0x4b96f5[_0x424e('0xc9')]};});var _0x4a7627=_[_0x424e('0x30')](values[_0x424e('0xca')],function(_0x349cda){return{'channel':_0x424e('0xcb'),'id':_0x349cda['id'],'createdAt':_0x349cda[_0x424e('0xc9')]};});var _0xf38a77=_[_0x424e('0x30')](values[_0x424e('0xcc')],function(_0x499c6c){return{'channel':_0x424e('0xcd'),'id':_0x499c6c['id'],'createdAt':_0x499c6c[_0x424e('0xc9')]};});var _0x1863a6=_[_0x424e('0x30')](values[_0x424e('0xce')],function(_0x3c6c71){return{'channel':'MAIL','id':_0x3c6c71['id'],'createdAt':_0x3c6c71[_0x424e('0xc9')]};});var _0x34e580=_[_0x424e('0x30')](values[_0x424e('0xcf')],function(_0x3a2575){return{'channel':_0x424e('0xd0'),'id':_0x3a2575['id'],'createdAt':_0x3a2575[_0x424e('0xc9')]};});var _0x3351b4=_[_0x424e('0x30')](values[_0x424e('0xd1')],function(_0x4e368d){return{'channel':_0x424e('0xd2'),'id':_0x4e368d['id'],'createdAt':_0x4e368d[_0x424e('0xc9')]};});var _0x9dac84=_[_0x424e('0xd3')](_0x2db591,_0x4a7627,_0xf38a77,_0x1863a6,_0x34e580,_0x3351b4);var _0x4f11eb={'count':_0x9dac84['length'],'rows':_0x9dac84};return _0x4f11eb;}else return null;})['then'](respondWithResult(_0x4896c4,null))[_0x424e('0x52')](handleError(_0x4896c4,null));};exports[_0x424e('0xd4')]=function(_0x215aa2,_0x291d2f){var _0x14d086={};var _0x3f0453={};var _0x38f198;var _0x40d7fa;return db['User'][_0x424e('0x9f')]({'where':{'id':_0x215aa2[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x291d2f,null))['then'](function(_0x3714b0){if(_0x3714b0){_0x38f198=_0x3714b0;_0x3f0453[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xd5')][_0x424e('0x38')]);_0x3f0453[_0x424e('0x44')]=_[_0x424e('0x55')](_0x215aa2[_0x424e('0x44')]);_0x3f0453[_0x424e('0x57')]=_[_0x424e('0x58')](_0x3f0453[_0x424e('0x59')],_0x3f0453[_0x424e('0x44')]);_0x14d086[_0x424e('0x48')]=_[_0x424e('0x58')](_0x3f0453[_0x424e('0x59')],qs['fields'](_0x215aa2[_0x424e('0x44')][_0x424e('0x5a')]));_0x14d086[_0x424e('0x48')]=_0x14d086[_0x424e('0x48')]['length']?_0x14d086[_0x424e('0x48')]:_0x3f0453[_0x424e('0x59')];_0x14d086[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x215aa2[_0x424e('0x44')]['sort']);_0x14d086[_0x424e('0x40')]=qs['filters'](_[_0x424e('0xd8')](_0x215aa2['query'],_0x3f0453[_0x424e('0x57')]));if(_0x215aa2[_0x424e('0x44')][_0x424e('0x3c')]){_0x14d086[_0x424e('0x40')]=_['merge'](_0x14d086['where'],{'$or':_['map'](_0x14d086['attributes'],function(_0x5c64cb){var _0x11c73b={};_0x11c73b[_0x5c64cb]={'$like':'%'+_0x215aa2[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x11c73b;})});}_0x14d086=_['merge']({},_0x14d086,_0x215aa2[_0x424e('0x5d')]);return _0x38f198[_0x424e('0xd4')](_0x14d086);}})[_0x424e('0x18')](function(_0x35da96){if(_0x35da96){_0x40d7fa=_0x35da96[_0x424e('0x5b')];if(_0x215aa2[_0x424e('0x44')][_0x424e('0xd9')](_0x424e('0x42'))){_0x14d086[_0x424e('0x43')]=[{'model':db[_0x424e('0xda')],'as':_0x424e('0xdb'),'required':![]},{'model':db[_0x424e('0xdc')],'as':_0x424e('0xdd'),'attributes':['id','name',_0x424e('0xde')],'where':_0x215aa2[_0x424e('0x44')][_0x424e('0xdf')]?{'id':_0x215aa2[_0x424e('0x44')][_0x424e('0xdf')]}:undefined,'required':_0x215aa2[_0x424e('0x44')][_0x424e('0xdf')]?!![]:![]}];}if(!_0x215aa2[_0x424e('0x44')]['hasOwnProperty'](_0x424e('0xe0'))){_0x14d086[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x215aa2[_0x424e('0x44')][_0x424e('0x27')]);_0x14d086[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x215aa2[_0x424e('0x44')][_0x424e('0x25')]);}return _0x38f198[_0x424e('0xd4')](_0x14d086);}})[_0x424e('0x18')](function(_0x241c9c){if(_0x241c9c){return _0x241c9c?{'count':_0x40d7fa,'rows':_0x241c9c}:null;}})['then'](respondWithResult(_0x291d2f,null))['catch'](handleError(_0x291d2f,null));};exports[_0x424e('0xe1')]=function(_0x177c2e,_0x1b6b87){var _0x2182af;var _0x22052a={};var _0x4e9534;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x177c2e[_0x424e('0x54')]['id']},'attributes':['id',_0x424e('0x33'),_0x424e('0x62')]})[_0x424e('0x18')](handleEntityNotFound(_0x1b6b87,null))[_0x424e('0x18')](function(_0x3de024){if(!utils[_0x424e('0xaa')](_0x177c2e[_0x424e('0x44')][_0x424e('0xa7')])){throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0xab'));}_0x2182af=_0x3de024;var _0x5d35de={};_0x5d35de[_0x424e('0x59')]=_['keys'](db[_[_0x424e('0xad')](_0x177c2e[_0x424e('0x44')][_0x424e('0xa7')])+_0x424e('0xe2')][_0x424e('0x38')]);_0x5d35de[_0x424e('0x44')]=_[_0x424e('0x55')](_0x177c2e['query']);_0x5d35de[_0x424e('0x57')]=_['intersection'](_0x5d35de[_0x424e('0x59')],_0x5d35de[_0x424e('0x44')]);_0x22052a[_0x424e('0x48')]=_[_0x424e('0x58')](_0x5d35de[_0x424e('0x59')],qs[_0x424e('0x5a')](_0x177c2e[_0x424e('0x44')][_0x424e('0x5a')]));_0x22052a[_0x424e('0x48')]=_0x22052a['attributes'][_0x424e('0x5b')]?_0x22052a['attributes']:_0x5d35de[_0x424e('0x59')];_0x22052a[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x177c2e[_0x424e('0x44')][_0x424e('0xd7')]);_0x22052a[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0x177c2e[_0x424e('0x44')],_0x5d35de[_0x424e('0x57')]));if(_0x177c2e[_0x424e('0x44')][_0x424e('0x3c')]){_0x22052a[_0x424e('0x40')]=_[_0x424e('0x5c')](_0x22052a[_0x424e('0x40')],{'$or':_['map'](_0x22052a[_0x424e('0x48')],function(_0x2c6313){var _0x3214cc={};_0x3214cc[_0x2c6313]={'$like':'%'+_0x177c2e[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x3214cc;})});}_0x22052a=_['merge']({},_0x22052a,_0x177c2e[_0x424e('0x5d')]);switch(_0x2182af[_0x424e('0x62')]){case'admin':return db[_[_0x424e('0xad')](_0x177c2e[_0x424e('0x44')][_0x424e('0xa7')])+_0x424e('0xe2')][_0x424e('0x4b')](_0x22052a);case'user':case _0x424e('0x76'):return _0x2182af[_0x424e('0xb5')+_['capitalize'](_0x177c2e[_0x424e('0x44')]['channel'])+_0x424e('0xaf')](_0x22052a);default:throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0xe3'));}})[_0x424e('0x18')](function(_0x5f4cc1){_0x4e9534=_0x5f4cc1['length'];if(!_0x177c2e[_0x424e('0x44')][_0x424e('0xd9')]('nolimit')){_0x22052a[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x177c2e[_0x424e('0x44')][_0x424e('0x27')]);_0x22052a[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x177c2e[_0x424e('0x44')][_0x424e('0x25')]);}switch(_0x2182af[_0x424e('0x62')]){case _0x424e('0x2c'):return db[_[_0x424e('0xad')](_0x177c2e[_0x424e('0x44')]['channel'])+_0x424e('0xe2')][_0x424e('0x4b')](_0x22052a);case _0x424e('0x2e'):case _0x424e('0x76'):return _0x2182af[_0x424e('0xb5')+_[_0x424e('0xad')](_0x177c2e[_0x424e('0x44')][_0x424e('0xa7')])+_0x424e('0xaf')](_0x22052a);}})[_0x424e('0x18')](function(_0x1f409e){return{'count':_0x4e9534,'rows':_0x1f409e};})[_0x424e('0x18')](respondWithResult(_0x1b6b87,null))[_0x424e('0x52')](handleError(_0x1b6b87,null));};exports['getVoiceQueuesRt']=function(_0x1b00e7,_0x25c1a5){var _0x177224={};var _0x4acb84={};var _0x4c4dcd;var _0x4e52c0;return db[_0x424e('0x4a')]['findOne']({'where':{'id':_0x1b00e7[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x25c1a5,null))[_0x424e('0x18')](function(_0x22feaa){if(_0x22feaa){_0x4c4dcd=_0x22feaa;_0x4acb84[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xe4')][_0x424e('0x38')]);_0x4acb84[_0x424e('0x44')]=_[_0x424e('0x55')](_0x1b00e7[_0x424e('0x44')]);_0x4acb84[_0x424e('0x57')]=_[_0x424e('0x58')](_0x4acb84[_0x424e('0x59')],_0x4acb84[_0x424e('0x44')]);_0x177224[_0x424e('0x48')]=_[_0x424e('0x58')](_0x4acb84['model'],qs[_0x424e('0x5a')](_0x1b00e7['query'][_0x424e('0x5a')]));_0x177224[_0x424e('0x48')]=_0x177224['attributes'][_0x424e('0x5b')]?_0x177224[_0x424e('0x48')]:_0x4acb84[_0x424e('0x59')];_0x177224[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x1b00e7[_0x424e('0x44')][_0x424e('0xd7')]);_0x177224[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0x1b00e7[_0x424e('0x44')],_0x4acb84['filters']));if(_0x1b00e7[_0x424e('0x44')][_0x424e('0x3c')]){_0x177224[_0x424e('0x40')]=_[_0x424e('0x5c')](_0x177224['where'],{'$or':_[_0x424e('0x30')](_0x177224[_0x424e('0x48')],function(_0x6f1273){var _0x18a12e={};_0x18a12e[_0x6f1273]={'$like':'%'+_0x1b00e7['query'][_0x424e('0x3c')]+'%'};return _0x18a12e;})});}_0x177224=_[_0x424e('0x5c')]({},_0x177224,_0x1b00e7[_0x424e('0x5d')]);return _0x4c4dcd[_0x424e('0xe5')](_0x177224);}})[_0x424e('0x18')](function(_0x1a8b73){if(_0x1a8b73){_0x4e52c0=_0x1a8b73['length'];if(!_0x1b00e7[_0x424e('0x44')][_0x424e('0xd9')](_0x424e('0xe0'))){_0x177224['limit']=qs[_0x424e('0x27')](_0x1b00e7[_0x424e('0x44')][_0x424e('0x27')]);_0x177224[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x1b00e7['query'][_0x424e('0x25')]);}return _0x4c4dcd[_0x424e('0xe5')](_0x177224);}})[_0x424e('0x18')](function(_0x138e12){if(_0x138e12){return _0x138e12?{'count':_0x4e52c0,'rows':_0x138e12}:null;}})[_0x424e('0x18')](respondWithResult(_0x25c1a5,null))[_0x424e('0x52')](handleError(_0x25c1a5,null));};exports[_0x424e('0xe6')]=function(_0x40aba4,_0xf45da5){var _0x35ce2b={};var _0x16b20f={};var _0x3c2f0e;var _0x2dd7fc;return db['User'][_0x424e('0x9f')]({'where':{'id':_0x40aba4[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0xf45da5,null))[_0x424e('0x18')](function(_0x256333){if(_0x256333){_0x3c2f0e=_0x256333;_0x16b20f[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xe7')]['rawAttributes']);_0x16b20f[_0x424e('0x44')]=_['keys'](_0x40aba4[_0x424e('0x44')]);_0x16b20f[_0x424e('0x57')]=_[_0x424e('0x58')](_0x16b20f[_0x424e('0x59')],_0x16b20f['query']);_0x35ce2b[_0x424e('0x48')]=_[_0x424e('0x58')](_0x16b20f[_0x424e('0x59')],qs['fields'](_0x40aba4[_0x424e('0x44')][_0x424e('0x5a')]));_0x35ce2b[_0x424e('0x48')]=_0x35ce2b[_0x424e('0x48')][_0x424e('0x5b')]?_0x35ce2b[_0x424e('0x48')]:_0x16b20f[_0x424e('0x59')];_0x35ce2b[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x40aba4[_0x424e('0x44')]['sort']);_0x35ce2b[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0x40aba4[_0x424e('0x44')],_0x16b20f['filters']));if(_0x40aba4[_0x424e('0x44')][_0x424e('0x3c')]){_0x35ce2b[_0x424e('0x40')]=_[_0x424e('0x5c')](_0x35ce2b[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x35ce2b[_0x424e('0x48')],function(_0x5d4811){var _0x473fde={};_0x473fde[_0x5d4811]={'$like':'%'+_0x40aba4[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x473fde;})});}_0x35ce2b=_[_0x424e('0x5c')]({},_0x35ce2b,_0x40aba4[_0x424e('0x5d')]);return _0x3c2f0e[_0x424e('0xe6')](_0x35ce2b);}})[_0x424e('0x18')](function(_0x310564){if(_0x310564){_0x2dd7fc=_0x310564[_0x424e('0x5b')];if(!_0x40aba4[_0x424e('0x44')][_0x424e('0xd9')](_0x424e('0xe0'))){_0x35ce2b['limit']=qs['limit'](_0x40aba4['query'][_0x424e('0x27')]);_0x35ce2b[_0x424e('0x25')]=qs['offset'](_0x40aba4[_0x424e('0x44')][_0x424e('0x25')]);}return _0x3c2f0e[_0x424e('0xe6')](_0x35ce2b);}})[_0x424e('0x18')](function(_0x213d84){if(_0x213d84){return _0x213d84?{'count':_0x2dd7fc,'rows':_0x213d84}:null;}})['then'](respondWithResult(_0xf45da5,null))['catch'](handleError(_0xf45da5,null));};exports[_0x424e('0xe8')]=function(_0x1acf89,_0x17e725){var _0x847c30={'raw':!![],'where':{}};var _0x410db1={};var _0x525f18={'count':0x0,'rows':[]};return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x1acf89[_0x424e('0x54')]['id']}})['then'](handleEntityNotFound(_0x17e725,null))['then'](function(_0xdfbb){if(_0xdfbb){_0x410db1[_0x424e('0x59')]=_['keys'](db['VoiceRecording'][_0x424e('0x38')]);_0x410db1[_0x424e('0x44')]=_[_0x424e('0x55')](_0x1acf89[_0x424e('0x44')]);_0x410db1[_0x424e('0x57')]=_[_0x424e('0x58')](_0x410db1[_0x424e('0x59')],_0x410db1[_0x424e('0x44')]);_0x847c30[_0x424e('0x48')]=_[_0x424e('0x58')](_0x410db1['model'],qs[_0x424e('0x5a')](_0x1acf89[_0x424e('0x44')][_0x424e('0x5a')]));_0x847c30['attributes']=_0x847c30[_0x424e('0x48')]['length']?_0x847c30[_0x424e('0x48')]:_0x410db1[_0x424e('0x59')];if(!_0x1acf89[_0x424e('0x44')][_0x424e('0xd9')]('nolimit')){_0x847c30[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x1acf89[_0x424e('0x44')]['limit']);_0x847c30['offset']=qs[_0x424e('0x25')](_0x1acf89[_0x424e('0x44')][_0x424e('0x25')]);}_0x847c30[_0x424e('0xd6')]=qs['sort'](_0x1acf89[_0x424e('0x44')][_0x424e('0xd7')]);_0x847c30[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0x1acf89[_0x424e('0x44')],_0x410db1[_0x424e('0x57')]));_0x847c30[_0x424e('0x40')][_0x424e('0xe9')]=_0xdfbb['id'];if(_0x1acf89[_0x424e('0x44')][_0x424e('0x3c')]){_0x847c30[_0x424e('0x40')]=_[_0x424e('0x5c')](_0x847c30[_0x424e('0x40')],{'$or':_['map'](_0x847c30['attributes'],function(_0x1b0c37){var _0x57ad28={};_0x57ad28[_0x1b0c37]={'$like':'%'+_0x1acf89[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x57ad28;})});}_0x847c30=_['merge']({},_0x847c30,_0x1acf89['options']);return db[_0x424e('0xea')][_0x424e('0x41')]({'where':_0x847c30[_0x424e('0x40')]})[_0x424e('0x18')](function(_0x530286){_0x525f18[_0x424e('0x41')]=_0x530286;if(_0x1acf89[_0x424e('0x44')][_0x424e('0x42')]){_0x847c30[_0x424e('0x43')]=[{'all':!![]}];}return db[_0x424e('0xea')]['findAll'](_0x847c30);})[_0x424e('0x18')](function(_0x2c7930){_0x525f18[_0x424e('0x4e')]=_0x2c7930;return _0x525f18;});}})[_0x424e('0x18')](respondWithFilteredResult(_0x17e725,_0x847c30))[_0x424e('0x52')](handleError(_0x17e725,null));};exports[_0x424e('0xeb')]=function(_0x1a919a,_0xfa61fd){var _0x4b14fe={'raw':!![],'where':{}};var _0x51451f={};var _0x33e4b9={'count':0x0,'rows':[]};return db['User'][_0x424e('0x9f')]({'where':{'id':_0x1a919a['params']['id']}})[_0x424e('0x18')](handleEntityNotFound(_0xfa61fd,null))[_0x424e('0x18')](function(_0x1b3565){if(_0x1b3565){_0x51451f[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xec')][_0x424e('0x38')]);_0x51451f[_0x424e('0x44')]=_['keys'](_0x1a919a['query']);_0x51451f[_0x424e('0x57')]=_['intersection'](_0x51451f[_0x424e('0x59')],_0x51451f[_0x424e('0x44')]);_0x4b14fe[_0x424e('0x48')]=_[_0x424e('0x58')](_0x51451f[_0x424e('0x59')],qs['fields'](_0x1a919a[_0x424e('0x44')][_0x424e('0x5a')]));_0x4b14fe[_0x424e('0x48')]=_0x4b14fe['attributes'][_0x424e('0x5b')]?_0x4b14fe[_0x424e('0x48')]:_0x51451f[_0x424e('0x59')];if(!_0x1a919a[_0x424e('0x44')]['hasOwnProperty'](_0x424e('0xe0'))){_0x4b14fe[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x1a919a[_0x424e('0x44')][_0x424e('0x27')]);_0x4b14fe[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x1a919a[_0x424e('0x44')]['offset']);}_0x4b14fe['order']=qs[_0x424e('0xd7')](_0x1a919a[_0x424e('0x44')][_0x424e('0xd7')]);_0x4b14fe[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0x1a919a['query'],_0x51451f[_0x424e('0x57')]));_0x4b14fe[_0x424e('0x40')][_0x424e('0xe9')]=_0x1b3565['id'];if(_0x1a919a['query'][_0x424e('0x3c')]){_0x4b14fe[_0x424e('0x40')]=_['merge'](_0x4b14fe[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x4b14fe['attributes'],function(_0x4941dd){var _0x3c1f78={};_0x3c1f78[_0x4941dd]={'$like':'%'+_0x1a919a[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x3c1f78;})});}_0x4b14fe=_[_0x424e('0x5c')]({},_0x4b14fe,_0x1a919a[_0x424e('0x5d')]);return db['ScreenRecording'][_0x424e('0x41')]({'where':_0x4b14fe[_0x424e('0x40')]})[_0x424e('0x18')](function(_0x58867d){_0x33e4b9[_0x424e('0x41')]=_0x58867d;if(_0x1a919a[_0x424e('0x44')][_0x424e('0x42')]){_0x4b14fe['include']=[{'all':!![]}];}return db[_0x424e('0xec')]['findAll'](_0x4b14fe);})[_0x424e('0x18')](function(_0x4d0535){_0x33e4b9[_0x424e('0x4e')]=_0x4d0535;return _0x33e4b9;});}})[_0x424e('0x18')](respondWithFilteredResult(_0xfa61fd,_0x4b14fe))['catch'](handleError(_0xfa61fd,null));};exports[_0x424e('0xed')]=function(_0x47f8d9,_0x1dddc4){var _0x4e7881={};var _0x14afc4={};var _0xc62e59;var _0x5de2f4;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x47f8d9[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x1dddc4,null))['then'](function(_0x566d3c){if(_0x566d3c){_0xc62e59=_0x566d3c;_0x14afc4[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xee')][_0x424e('0x38')]);_0x14afc4[_0x424e('0x44')]=_[_0x424e('0x55')](_0x47f8d9['query']);_0x14afc4[_0x424e('0x57')]=_[_0x424e('0x58')](_0x14afc4['model'],_0x14afc4[_0x424e('0x44')]);_0x4e7881[_0x424e('0x48')]=_[_0x424e('0x58')](_0x14afc4[_0x424e('0x59')],qs[_0x424e('0x5a')](_0x47f8d9[_0x424e('0x44')][_0x424e('0x5a')]));_0x4e7881['attributes']=_0x4e7881[_0x424e('0x48')]['length']?_0x4e7881[_0x424e('0x48')]:_0x14afc4[_0x424e('0x59')];_0x4e7881['order']=qs[_0x424e('0xd7')](_0x47f8d9['query']['sort']);_0x4e7881[_0x424e('0x40')]=qs['filters'](_[_0x424e('0xd8')](_0x47f8d9[_0x424e('0x44')],_0x14afc4[_0x424e('0x57')]));if(_0x47f8d9[_0x424e('0x44')][_0x424e('0x3c')]){_0x4e7881[_0x424e('0x40')]=_[_0x424e('0x5c')](_0x4e7881[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x4e7881[_0x424e('0x48')],function(_0x270e84){var _0x29557e={};_0x29557e[_0x270e84]={'$like':'%'+_0x47f8d9[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x29557e;})});}_0x4e7881=_['merge']({},_0x4e7881,_0x47f8d9['options']);return _0xc62e59[_0x424e('0xed')](_0x4e7881);}})[_0x424e('0x18')](function(_0x4ecbd2){if(_0x4ecbd2){_0x5de2f4=_0x4ecbd2[_0x424e('0x5b')];if(!_0x47f8d9[_0x424e('0x44')][_0x424e('0xd9')](_0x424e('0xe0'))){_0x4e7881[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x47f8d9[_0x424e('0x44')]['limit']);_0x4e7881[_0x424e('0x25')]=qs['offset'](_0x47f8d9[_0x424e('0x44')]['offset']);}return _0xc62e59[_0x424e('0xed')](_0x4e7881);}})[_0x424e('0x18')](function(_0x260d40){if(_0x260d40){return _0x260d40?{'count':_0x5de2f4,'rows':_0x260d40}:null;}})[_0x424e('0x18')](respondWithResult(_0x1dddc4,null))[_0x424e('0x52')](handleError(_0x1dddc4,null));};exports['getOpenchannelInteractions']=function(_0x4ebb22,_0x33e5cc){var _0xe07be2={};var _0x3aee20={};var _0x4265fa;var _0x16d2ea;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x4ebb22[_0x424e('0x54')]['id']}})['then'](handleEntityNotFound(_0x33e5cc,null))[_0x424e('0x18')](function(_0x4d7bf4){if(_0x4d7bf4){_0x4265fa=_0x4d7bf4;_0x3aee20['model']=_[_0x424e('0x55')](db[_0x424e('0xef')]['rawAttributes']);_0x3aee20[_0x424e('0x44')]=_[_0x424e('0x55')](_0x4ebb22[_0x424e('0x44')]);_0x3aee20['filters']=_['intersection'](_0x3aee20[_0x424e('0x59')],_0x3aee20[_0x424e('0x44')]);_0xe07be2[_0x424e('0x48')]=_[_0x424e('0x58')](_0x3aee20['model'],qs[_0x424e('0x5a')](_0x4ebb22[_0x424e('0x44')][_0x424e('0x5a')]));_0xe07be2['attributes']=_0xe07be2[_0x424e('0x48')][_0x424e('0x5b')]?_0xe07be2[_0x424e('0x48')]:_0x3aee20[_0x424e('0x59')];_0xe07be2[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x4ebb22[_0x424e('0x44')][_0x424e('0xd7')]);_0xe07be2[_0x424e('0x40')]=qs[_0x424e('0x57')](_['pick'](_0x4ebb22[_0x424e('0x44')],_0x3aee20['filters']));if(_0x4ebb22['query'][_0x424e('0x3c')]){_0xe07be2[_0x424e('0x40')]=_['merge'](_0xe07be2[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0xe07be2[_0x424e('0x48')],function(_0x29faec){var _0x49236e={};_0x49236e[_0x29faec]={'$like':'%'+_0x4ebb22[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x49236e;})});}_0xe07be2=_[_0x424e('0x5c')]({},_0xe07be2,_0x4ebb22['options']);return _0x4265fa[_0x424e('0xf0')](_0xe07be2);}})[_0x424e('0x18')](function(_0x5d7474){if(_0x5d7474){_0x16d2ea=_0x5d7474['length'];if(!_0x4ebb22[_0x424e('0x44')][_0x424e('0xd9')](_0x424e('0xe0'))){_0xe07be2[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x4ebb22['query'][_0x424e('0x27')]);_0xe07be2[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x4ebb22[_0x424e('0x44')][_0x424e('0x25')]);}return _0x4265fa[_0x424e('0xf0')](_0xe07be2);}})['then'](function(_0x5db3e0){if(_0x5db3e0){return _0x5db3e0?{'count':_0x16d2ea,'rows':_0x5db3e0}:null;}})['then'](respondWithResult(_0x33e5cc,null))[_0x424e('0x52')](handleError(_0x33e5cc,null));};exports[_0x424e('0xf1')]=function(_0x255eaa,_0x18b2cf){var _0x56ecfb={'raw':!![],'where':{}};var _0x9fc94e={};var _0x6b388f={'count':0x0,'rows':[]};return db[_0x424e('0x4a')]['findOne']({'where':{'id':_0x255eaa['params']['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x18b2cf,null))[_0x424e('0x18')](function(_0x454397){if(_0x454397){_0x9fc94e[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xf2')][_0x424e('0x38')]);_0x9fc94e['query']=_[_0x424e('0x55')](_0x255eaa[_0x424e('0x44')]);_0x9fc94e[_0x424e('0x57')]=_['intersection'](_0x9fc94e['model'],_0x9fc94e[_0x424e('0x44')]);_0x56ecfb['attributes']=_['intersection'](_0x9fc94e[_0x424e('0x59')],qs[_0x424e('0x5a')](_0x255eaa[_0x424e('0x44')][_0x424e('0x5a')]));_0x56ecfb[_0x424e('0x48')]=_0x56ecfb[_0x424e('0x48')][_0x424e('0x5b')]?_0x56ecfb[_0x424e('0x48')]:_0x9fc94e['model'];if(!_0x255eaa['query'][_0x424e('0xd9')]('nolimit')){_0x56ecfb[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x255eaa[_0x424e('0x44')][_0x424e('0x27')]);_0x56ecfb[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x255eaa[_0x424e('0x44')][_0x424e('0x25')]);}_0x56ecfb[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x255eaa[_0x424e('0x44')][_0x424e('0xd7')]);_0x56ecfb[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0x255eaa[_0x424e('0x44')],_0x9fc94e[_0x424e('0x57')]));_0x56ecfb[_0x424e('0x40')][_0x424e('0xe9')]=_0x454397['id'];if(_0x255eaa['query']['filter']){_0x56ecfb[_0x424e('0x40')]=_['merge'](_0x56ecfb[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x56ecfb[_0x424e('0x48')],function(_0x1885fb){var _0xec6120={};_0xec6120[_0x1885fb]={'$like':'%'+_0x255eaa['query'][_0x424e('0x3c')]+'%'};return _0xec6120;})});}_0x56ecfb=_[_0x424e('0x5c')]({},_0x56ecfb,_0x255eaa[_0x424e('0x5d')]);return db[_0x424e('0xf2')]['count']({'where':_0x56ecfb[_0x424e('0x40')]})[_0x424e('0x18')](function(_0x51310f){_0x6b388f[_0x424e('0x41')]=_0x51310f;if(_0x255eaa[_0x424e('0x44')]['includeAll']){_0x56ecfb['include']=[{'all':!![]}];}return db[_0x424e('0xf2')][_0x424e('0x4b')](_0x56ecfb);})['then'](function(_0x2aa94a){_0x6b388f[_0x424e('0x4e')]=_0x2aa94a;return _0x6b388f;});}})['then'](respondWithFilteredResult(_0x18b2cf,_0x56ecfb))[_0x424e('0x52')](handleError(_0x18b2cf,null));};exports[_0x424e('0xf3')]=function(_0x5ab926,_0x1f77e0){var _0x569660={};var _0x764112={};var _0x117906;var _0x4239c4;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x5ab926['params']['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x1f77e0,null))[_0x424e('0x18')](function(_0xb610c7){if(_0xb610c7){_0x117906=_0xb610c7;_0x764112[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xf4')]['rawAttributes']);_0x764112[_0x424e('0x44')]=_['keys'](_0x5ab926[_0x424e('0x44')]);_0x764112[_0x424e('0x57')]=_['intersection'](_0x764112[_0x424e('0x59')],_0x764112['query']);_0x569660[_0x424e('0x48')]=_[_0x424e('0x58')](_0x764112[_0x424e('0x59')],qs[_0x424e('0x5a')](_0x5ab926['query'][_0x424e('0x5a')]));_0x569660[_0x424e('0x48')]=_0x569660[_0x424e('0x48')]['length']?_0x569660['attributes']:_0x764112[_0x424e('0x59')];_0x569660['order']=qs['sort'](_0x5ab926[_0x424e('0x44')][_0x424e('0xd7')]);_0x569660[_0x424e('0x40')]=qs['filters'](_[_0x424e('0xd8')](_0x5ab926['query'],_0x764112[_0x424e('0x57')]));if(_0x5ab926[_0x424e('0x44')][_0x424e('0x3c')]){_0x569660[_0x424e('0x40')]=_['merge'](_0x569660[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x569660[_0x424e('0x48')],function(_0x3d1a0d){var _0x212e32={};_0x212e32[_0x3d1a0d]={'$like':'%'+_0x5ab926[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x212e32;})});}_0x569660=_[_0x424e('0x5c')]({},_0x569660,_0x5ab926['options']);return _0x117906[_0x424e('0xf3')](_0x569660);}})[_0x424e('0x18')](function(_0x2bd30f){if(_0x2bd30f){_0x4239c4=_0x2bd30f['length'];if(!_0x5ab926[_0x424e('0x44')][_0x424e('0xd9')](_0x424e('0xe0'))){_0x569660[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x5ab926['query'][_0x424e('0x27')]);_0x569660['offset']=qs[_0x424e('0x25')](_0x5ab926['query'][_0x424e('0x25')]);}return _0x117906[_0x424e('0xf3')](_0x569660);}})[_0x424e('0x18')](function(_0x36c527){if(_0x36c527){return _0x36c527?{'count':_0x4239c4,'rows':_0x36c527}:null;}})[_0x424e('0x18')](respondWithResult(_0x1f77e0,null))[_0x424e('0x52')](handleError(_0x1f77e0,null));};exports[_0x424e('0xf5')]=function(_0x31f2b4,_0x189d91){var _0x479d3d={};var _0x2e1141={};var _0x27bcb3;var _0x520aca;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x31f2b4[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x189d91,null))[_0x424e('0x18')](function(_0x297595){if(_0x297595){_0x27bcb3=_0x297595;_0x2e1141[_0x424e('0x59')]=_[_0x424e('0x55')](db['FaxInteraction'][_0x424e('0x38')]);_0x2e1141[_0x424e('0x44')]=_[_0x424e('0x55')](_0x31f2b4[_0x424e('0x44')]);_0x2e1141[_0x424e('0x57')]=_[_0x424e('0x58')](_0x2e1141[_0x424e('0x59')],_0x2e1141['query']);_0x479d3d[_0x424e('0x48')]=_[_0x424e('0x58')](_0x2e1141['model'],qs[_0x424e('0x5a')](_0x31f2b4['query'][_0x424e('0x5a')]));_0x479d3d[_0x424e('0x48')]=_0x479d3d['attributes'][_0x424e('0x5b')]?_0x479d3d[_0x424e('0x48')]:_0x2e1141[_0x424e('0x59')];_0x479d3d[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x31f2b4[_0x424e('0x44')][_0x424e('0xd7')]);_0x479d3d[_0x424e('0x40')]=qs[_0x424e('0x57')](_['pick'](_0x31f2b4[_0x424e('0x44')],_0x2e1141[_0x424e('0x57')]));if(_0x31f2b4[_0x424e('0x44')][_0x424e('0x3c')]){_0x479d3d[_0x424e('0x40')]=_[_0x424e('0x5c')](_0x479d3d[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x479d3d['attributes'],function(_0x49e248){var _0x18a08c={};_0x18a08c[_0x49e248]={'$like':'%'+_0x31f2b4[_0x424e('0x44')]['filter']+'%'};return _0x18a08c;})});}_0x479d3d=_[_0x424e('0x5c')]({},_0x479d3d,_0x31f2b4[_0x424e('0x5d')]);return _0x27bcb3[_0x424e('0xf5')](_0x479d3d);}})[_0x424e('0x18')](function(_0x314940){if(_0x314940){_0x520aca=_0x314940[_0x424e('0x5b')];if(!_0x31f2b4['query'][_0x424e('0xd9')](_0x424e('0xe0'))){_0x479d3d[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x31f2b4[_0x424e('0x44')][_0x424e('0x27')]);_0x479d3d[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x31f2b4['query'][_0x424e('0x25')]);}return _0x27bcb3[_0x424e('0xf5')](_0x479d3d);}})[_0x424e('0x18')](function(_0x37c3e7){if(_0x37c3e7){return _0x37c3e7?{'count':_0x520aca,'rows':_0x37c3e7}:null;}})['then'](respondWithResult(_0x189d91,null))['catch'](handleError(_0x189d91,null));};exports[_0x424e('0xf6')]=function(_0x551a9e,_0x3bc216){var _0x49ee86={};var _0x3a17e9={};var _0xbc3fc;var _0x8bcce0;return db['User'][_0x424e('0x9f')]({'where':{'id':_0x551a9e[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x3bc216,null))[_0x424e('0x18')](function(_0x2f416a){if(_0x2f416a){_0xbc3fc=_0x2f416a;_0x3a17e9['model']=_['keys'](db['WhatsappInteraction'][_0x424e('0x38')]);_0x3a17e9[_0x424e('0x44')]=_['keys'](_0x551a9e['query']);_0x3a17e9['filters']=_[_0x424e('0x58')](_0x3a17e9[_0x424e('0x59')],_0x3a17e9[_0x424e('0x44')]);_0x49ee86['attributes']=_[_0x424e('0x58')](_0x3a17e9[_0x424e('0x59')],qs[_0x424e('0x5a')](_0x551a9e[_0x424e('0x44')][_0x424e('0x5a')]));_0x49ee86[_0x424e('0x48')]=_0x49ee86[_0x424e('0x48')][_0x424e('0x5b')]?_0x49ee86['attributes']:_0x3a17e9['model'];_0x49ee86[_0x424e('0xd6')]=qs['sort'](_0x551a9e[_0x424e('0x44')][_0x424e('0xd7')]);_0x49ee86['where']=qs[_0x424e('0x57')](_['pick'](_0x551a9e[_0x424e('0x44')],_0x3a17e9['filters']));if(_0x551a9e[_0x424e('0x44')][_0x424e('0x3c')]){_0x49ee86['where']=_[_0x424e('0x5c')](_0x49ee86[_0x424e('0x40')],{'$or':_['map'](_0x49ee86[_0x424e('0x48')],function(_0x1d3556){var _0x13d09e={};_0x13d09e[_0x1d3556]={'$like':'%'+_0x551a9e['query'][_0x424e('0x3c')]+'%'};return _0x13d09e;})});}_0x49ee86=_[_0x424e('0x5c')]({},_0x49ee86,_0x551a9e[_0x424e('0x5d')]);return _0xbc3fc[_0x424e('0xf6')](_0x49ee86);}})[_0x424e('0x18')](function(_0x3a9a60){if(_0x3a9a60){_0x8bcce0=_0x3a9a60[_0x424e('0x5b')];if(!_0x551a9e[_0x424e('0x44')][_0x424e('0xd9')]('nolimit')){_0x49ee86[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x551a9e[_0x424e('0x44')][_0x424e('0x27')]);_0x49ee86['offset']=qs[_0x424e('0x25')](_0x551a9e[_0x424e('0x44')]['offset']);}return _0xbc3fc[_0x424e('0xf6')](_0x49ee86);}})[_0x424e('0x18')](function(_0x9345e7){if(_0x9345e7){return _0x9345e7?{'count':_0x8bcce0,'rows':_0x9345e7}:null;}})[_0x424e('0x18')](respondWithResult(_0x3bc216,null))[_0x424e('0x52')](handleError(_0x3bc216,null));};exports['login']=function(_0x2860c2,_0x6e83da,_0x2ed7d6){var _0x3a2d0a;var _0x9cce48;var _0x493bef;var _0x2426a8=!_[_0x424e('0x6b')](_0x2860c2['params']['id'])?_0x2860c2[_0x424e('0x54')]['id']:!_[_0x424e('0x6b')](_0x2860c2[_0x424e('0x2e')]['id'])?_0x2860c2[_0x424e('0x2e')]['id']:null;return db[_0x424e('0x4a')]['find']({'where':{'id':_0x2426a8,'role':{'$or':[_0x424e('0x2c'),_0x424e('0x2e'),_0x424e('0x76')]}},'attributes':['id',_0x424e('0x33'),'phone',_0x424e('0xf7'),_0x424e('0x62'),_0x424e('0x66'),'loginInPause']})['then'](function(_0x164848){if(_0x164848){if(_0x164848[_0x424e('0x62')]===_0x424e('0x76')){_0x3a2d0a=_0x164848;if(_0x2860c2[_0x424e('0x61')][_0x424e('0xb7')]){_0x493bef=util[_0x424e('0xf8')](_0x424e('0xf9'),_0x3a2d0a[_0x2860c2[_0x424e('0x61')][_0x424e('0xb7')]]);}else if(_0x2860c2[_0x424e('0x61')][_0x424e('0xfa')]){_0x493bef=util['format'](_0x424e('0xb8'),_0x2860c2[_0x424e('0x61')][_0x424e('0xfa')]);}else{_0x493bef=util[_0x424e('0xf8')]('SIP/%s',_0x3a2d0a[_0x424e('0x33')]);}socket['to'](util[_0x424e('0xf8')]('user:%s',_0x3a2d0a['name']))[_0x424e('0x29')]('user:forcelogout',{'user':{'id':_0x3a2d0a['id'],'name':_0x3a2d0a['name']},'ip':_0x2860c2[_0x424e('0xfb')][_0x424e('0xfc')]||_0x2860c2[_0x424e('0xfd')][_0x424e('0xfe')]||_0x2860c2[_0x424e('0xff')]['remoteAddress']||_0x2860c2[_0x424e('0xfd')][_0x424e('0xff')][_0x424e('0xfe')]});return db[_0x424e('0xe4')][_0x424e('0x2b')]({'where':{'membername':_0x3a2d0a['name']},'individualHooks':!![]});}}else{throw new db[(_0x424e('0x97'))][(_0x424e('0x98'))](_0x424e('0x100'));}})['then'](function(){if(_0x3a2d0a){return _0x3a2d0a[_0x424e('0x101')]({'raw':!![]});}})[_0x424e('0x18')](function(_0x38db7e){if(_0x3a2d0a){var _0x39dfa0=[];if(_0x38db7e){_0x9cce48=_0x38db7e;if(_0x9cce48[_0x424e('0x5b')]){for(var _0x11dcf6=0x0;_0x11dcf6<_0x9cce48['length'];_0x11dcf6++){_0x39dfa0[_0x424e('0x49')]({'membername':_0x3a2d0a[_0x424e('0x33')],'UserId':_0x3a2d0a['id'],'queue_name':_0x9cce48[_0x11dcf6]['name'],'VoiceQueueId':_0x9cce48[_0x11dcf6]['id'],'interface':_0x493bef,'paused':_0x3a2d0a[_0x424e('0xa8')]||![],'penalty':_0x9cce48[_0x11dcf6][_0x424e('0x102')]||0x0});}return BPromise[_0x424e('0x91')](_0x39dfa0,function(_0x2c83f3){return db[_0x424e('0xe4')]['upsert'](_0x2c83f3);});}}}})[_0x424e('0x18')](function(){if(_0x3a2d0a){return db[_0x424e('0x103')][_0x424e('0x4b')]({'where':{'membername':_0x3a2d0a[_0x424e('0x33')],'exitAt':null}});}})['then'](function(_0x105141){if(_0x3a2d0a){var _0x2a43d9=[];_0x105141[_0x424e('0x104')](function(_0x4848d6){_0x2a43d9[_0x424e('0x49')](_0x4848d6[_0x424e('0x28')]({'exitAt':moment()[_0x424e('0xf8')](_0x424e('0x105'))}));});return BPromise['all'](_0x2a43d9);}})['then'](function(){if(_0x3a2d0a){var _0x2d761a=[];var _0x4686ee=[];var _0x183173=utils[_0x424e('0x106')]();var _0x1a2d23={'membername':_0x3a2d0a[_0x424e('0x33')],'interface':_0x493bef,'enterAt':moment()[_0x424e('0xf8')](_0x424e('0x105')),'role':_0x3a2d0a['role'],'internal':_0x3a2d0a[_0x424e('0x66')]};_0x183173[_0x424e('0x104')](function(_0x6beb38){_0x2d761a[_0x424e('0x49')](_['merge']({'channel':_0x6beb38,'type':'LOGIN','data1':_0x2860c2['body']['device'],'data2':_0x493bef},_0x1a2d23));if(_0x3a2d0a[_0x424e('0xa8')]){_0x4686ee[_0x424e('0x49')](_['merge']({'channel':_0x6beb38,'type':'PAUSE','data1':_0x424e('0x107')},_0x1a2d23));}});return db['MemberReport'][_0x424e('0x108')](_0x2d761a[_0x424e('0xd3')](_0x4686ee),{'individualHooks':!![]});}})[_0x424e('0x18')](function(){if(_0x3a2d0a){return _0x3a2d0a[_0x424e('0x28')]({'online':!![],'lastLoginAt':moment()['format'](_0x424e('0x105')),'voicePause':_0x3a2d0a[_0x424e('0xa8')]||![],'mailPause':_0x3a2d0a['loginInPause']||![],'chatPause':_0x3a2d0a[_0x424e('0xa8')]||![],'faxPause':_0x3a2d0a[_0x424e('0xa8')]||![],'smsPause':_0x3a2d0a[_0x424e('0xa8')]||![],'openchannelPause':_0x3a2d0a[_0x424e('0xa8')]||![],'whatsappPause':_0x3a2d0a['loginInPause']||![],'pauseType':_0x3a2d0a[_0x424e('0xa8')]?'LOGININPAUSE':null,'interface':_0x493bef,'lastPauseAt':moment()[_0x424e('0xf8')](_0x424e('0x105'))});}})[_0x424e('0x18')](function(_0x389bce){if(_0x2860c2[_0x424e('0x109')]){return _0x2ed7d6();}else{return BPromise[_0x424e('0x10a')](_0x389bce)['then'](respondWithResult(_0x6e83da,null));}})[_0x424e('0x52')](handleError(_0x6e83da,null));};exports[_0x424e('0x10b')]=function(_0x44ee43,_0xe56aea){var _0x2a7615;return db[_0x424e('0x4a')]['find']({'where':{'id':_0x44ee43[_0x424e('0x54')]['id'],'role':_0x424e('0x76')},'attributes':['id',_0x424e('0x33'),_0x424e('0x62')]})[_0x424e('0x18')](handleEntityNotFound(_0xe56aea,null))[_0x424e('0x18')](function(_0x143525){if(_0x143525){_0x2a7615=_0x143525;return db[_0x424e('0xe4')][_0x424e('0x2b')]({'where':{'membername':_0x2a7615[_0x424e('0x33')]},'individualHooks':!![]});}})[_0x424e('0x18')](function(){return db[_0x424e('0x103')][_0x424e('0x4b')]({'where':{'membername':_0x2a7615['name'],'exitAt':null}});})['then'](function(_0x2fc8db){var _0x30ac35=[];_0x2fc8db[_0x424e('0x104')](function(_0x4bf193){_0x30ac35[_0x424e('0x49')](_0x4bf193[_0x424e('0x28')]({'exitAt':moment()['format'](_0x424e('0x105'))}));});return BPromise[_0x424e('0x60')](_0x30ac35);})[_0x424e('0x18')](function(){return _0x2a7615[_0x424e('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x424e('0x18')](respondWithResult(_0xe56aea,null))[_0x424e('0x52')](handleError(_0xe56aea,null));};exports[_0x424e('0x10c')]=function(_0xb486a,_0x32b867){var _0x4e3b33;return db[_0x424e('0xe4')]['update']({'paused':0x1},{'where':{'UserId':_0xb486a[_0x424e('0x54')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x424e('0x4a')]['find']({'where':{'id':_0xb486a[_0x424e('0x54')]['id'],'role':'agent'},'attributes':['id',_0x424e('0x33'),_0x424e('0x62'),_0x424e('0x66'),_0x424e('0xb7')]});})[_0x424e('0x18')](handleEntityNotFound(_0x32b867,null))[_0x424e('0x18')](function(_0x25a220){if(_0x25a220){_0x4e3b33=_0x25a220;return respondWithRpcPromise(_0x424e('0x10d'),_0x424e('0x10c'),{'id':_0x4e3b33['id'],'name':_0x4e3b33[_0x424e('0x33')],'pause':!![]});}})[_0x424e('0x18')](function(){if(_0x4e3b33){return db['MemberReport'][_0x424e('0x4b')]({'where':{'membername':_0x4e3b33['name'],'type':_0x424e('0x10e'),'exitAt':null}});}})['then'](function(_0x8af512){if(_0x8af512[_0x424e('0x5b')]){var _0x338652=moment()[_0x424e('0xf8')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x53f17b=0x0,_0x2715d7=_0x8af512[_0x424e('0x5b')];_0x53f17b<_0x2715d7;_0x53f17b++){_0x8af512[_0x53f17b][_0x424e('0x10f')]({'exitAt':_0x338652});}}})[_0x424e('0x18')](function(){var _0xa66e78=[];var _0x4c4907=utils[_0x424e('0x106')]();_0x4c4907[_0x424e('0x104')](function(_0x54d8a8){_0xa66e78['push']({'channel':_0x54d8a8,'membername':_0x4e3b33['name'],'interface':_[_0x424e('0x6b')](_0x4e3b33['interface'])?util[_0x424e('0xf8')](_0x424e('0xb8'),_0x4e3b33['name']):_0x4e3b33[_0x424e('0xb7')],'type':_0x424e('0x10e'),'enterAt':moment()[_0x424e('0xf8')](_0x424e('0x105')),'data1':_0xb486a[_0x424e('0x61')][_0x424e('0x3a')]||_0x424e('0x110'),'role':_0x4e3b33['role'],'internal':_0x4e3b33[_0x424e('0x66')]});});return db[_0x424e('0x103')][_0x424e('0x108')](_0xa66e78,{'individualHooks':!![]});})[_0x424e('0x18')](function(){return _0x4e3b33[_0x424e('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xb486a[_0x424e('0x61')][_0x424e('0x3a')]||_0x424e('0x110'),'lastPauseAt':moment()[_0x424e('0xf8')](_0x424e('0x105'))});})[_0x424e('0x18')](respondWithResult(_0x32b867,null))[_0x424e('0x52')](handleError(_0x32b867,null));};exports[_0x424e('0x111')]=function(_0x310110,_0x227fae){var _0x3c71bc;return db[_0x424e('0x4a')]['find']({'where':{'id':_0x310110[_0x424e('0x54')]['id']},'attributes':['id','name',_0x424e('0x62'),_0x424e('0xa9'),_0x424e('0x112'),'chatPause',_0x424e('0x113'),_0x424e('0x114'),'smsPause',_0x424e('0x115'),_0x424e('0x116'),_0x424e('0x117')]})[_0x424e('0x18')](handleEntityNotFound(_0x227fae,null))[_0x424e('0x18')](function(_0x4fa190){if(_0x4fa190){_0x3c71bc=_0x4fa190;if(_0x310110[_0x424e('0x61')][_0x424e('0xa7')]&&!utils[_0x424e('0xaa')](_0x310110['body'][_0x424e('0xa7')])){throw new db['Sequelize'][(_0x424e('0x98'))](_0x424e('0xab'));}switch(_0x310110[_0x424e('0x61')][_0x424e('0xa7')]){case _0x424e('0xb3'):return respondWithRpcPromise(_0x424e('0x10d'),_0x424e('0x111'),{'id':_0x3c71bc['id'],'name':_0x3c71bc[_0x424e('0x33')],'pause':![]})['then'](function(){return db[_0x424e('0xe4')]['update']({'paused':0x0},{'where':{'UserId':_0x3c71bc['id']},'individualHooks':!![]});})[_0x424e('0x18')](function(){return db[_0x424e('0x103')][_0x424e('0x32')]({'where':{'channel':_0x310110[_0x424e('0x61')]['channel'],'membername':_0x3c71bc['name'],'type':_0x424e('0x10e'),'exitAt':null}});})[_0x424e('0x18')](function(_0x1f67fa){if(_0x1f67fa){return _0x1f67fa[_0x424e('0x28')]({'exitAt':moment()['format'](_0x424e('0x105')),'data2':_0x424e('0x118')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3c71bc[_0x424e('0x28')]({'voicePause':![]});});case _0x424e('0x50'):case'chat':case _0x424e('0x119'):case _0x424e('0x5e'):case'whatsapp':case'openchannel':return db[_0x424e('0x103')][_0x424e('0x32')]({'where':{'channel':_0x310110[_0x424e('0x61')]['channel'],'membername':_0x3c71bc['name'],'type':_0x424e('0x10e'),'exitAt':null}})['then'](function(_0xc483ad){if(_0xc483ad){return _0xc483ad[_0x424e('0x28')]({'exitAt':moment()[_0x424e('0xf8')](_0x424e('0x105')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x424e('0x18')](function(){var _0x48f1ed={};_[_0x424e('0x11a')](_0x48f1ed,util['format'](_0x424e('0x11b'),_0x310110['body'][_0x424e('0xa7')],_0x424e('0x11c')),![]);return _0x3c71bc[_0x424e('0x28')](_0x48f1ed);});default:return respondWithRpcPromise(_0x424e('0x10d'),_0x424e('0x111'),{'id':_0x3c71bc['id'],'name':_0x3c71bc['name'],'pause':![]})[_0x424e('0x18')](function(){return db['UserVoiceQueueRt'][_0x424e('0x28')]({'paused':0x0},{'where':{'UserId':_0x3c71bc['id']}});})['then'](function(){return db[_0x424e('0x103')][_0x424e('0x4b')]({'where':{'membername':_0x3c71bc[_0x424e('0x33')],'type':_0x424e('0x10e'),'exitAt':null}});})['then'](function(_0x59c0c8){var _0x22fb0b=[];_0x59c0c8[_0x424e('0x104')](function(_0x11d35b){_0x22fb0b[_0x424e('0x49')](_0x11d35b[_0x424e('0x28')]({'exitAt':moment()[_0x424e('0xf8')](_0x424e('0x105')),'data2':_0x424e('0x118')}));});return BPromise[_0x424e('0x60')](_0x22fb0b);})['then'](function(){return _0x3c71bc[_0x424e('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x424e('0x18')](respondWithResult(_0x227fae,null))[_0x424e('0x52')](handleError(_0x227fae,null));};exports[_0x424e('0x11d')]=function(_0x5ad0b0,_0xc52291){var _0x51f9ab={};var _0x29e091={};var _0x3c2d4e;var _0x47524c;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x5ad0b0[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0xc52291,null))['then'](function(_0x46c947){if(_0x46c947){_0x3c2d4e=_0x46c947;_0x29e091[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0x11e')][_0x424e('0x38')]);_0x29e091[_0x424e('0x44')]=_[_0x424e('0x55')](_0x5ad0b0[_0x424e('0x44')]);_0x29e091['filters']=_[_0x424e('0x58')](_0x29e091[_0x424e('0x59')],_0x29e091[_0x424e('0x44')]);_0x51f9ab[_0x424e('0x48')]=_[_0x424e('0x58')](_0x29e091[_0x424e('0x59')],qs[_0x424e('0x5a')](_0x5ad0b0[_0x424e('0x44')]['fields']));_0x51f9ab['attributes']=_0x51f9ab['attributes']['length']?_0x51f9ab[_0x424e('0x48')]:_0x29e091['model'];_0x51f9ab[_0x424e('0xd6')]=qs[_0x424e('0xd7')](_0x5ad0b0[_0x424e('0x44')]['sort']);_0x51f9ab['where']=qs[_0x424e('0x57')](_['pick'](_0x5ad0b0[_0x424e('0x44')],_0x29e091[_0x424e('0x57')]));if(_0x5ad0b0[_0x424e('0x44')]['filter']){_0x51f9ab['where']=_[_0x424e('0x5c')](_0x51f9ab[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x51f9ab[_0x424e('0x48')],function(_0x5cf0de){var _0x5d3119={};_0x5d3119[_0x5cf0de]={'$like':'%'+_0x5ad0b0[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x5d3119;})});}_0x51f9ab=_[_0x424e('0x5c')]({},_0x51f9ab,_0x5ad0b0[_0x424e('0x5d')]);return _0x3c2d4e[_0x424e('0x11d')](_0x51f9ab);}})[_0x424e('0x18')](function(_0x24fde4){if(_0x24fde4){_0x47524c=_0x24fde4['length'];if(!_0x5ad0b0[_0x424e('0x44')]['hasOwnProperty'](_0x424e('0xe0'))){_0x51f9ab[_0x424e('0x27')]=qs[_0x424e('0x27')](_0x5ad0b0['query'][_0x424e('0x27')]);_0x51f9ab[_0x424e('0x25')]=qs[_0x424e('0x25')](_0x5ad0b0[_0x424e('0x44')][_0x424e('0x25')]);}return _0x3c2d4e[_0x424e('0x11d')](_0x51f9ab);}})['then'](function(_0x5aa0f8){if(_0x5aa0f8){return _0x5aa0f8?{'count':_0x47524c,'rows':_0x5aa0f8}:null;}})[_0x424e('0x18')](respondWithResult(_0xc52291,null))[_0x424e('0x52')](handleError(_0xc52291,null));};exports[_0x424e('0x11f')]=function(_0x217de7,_0x2e2a94){var _0x3450f2=_0x217de7[_0x424e('0x54')]['id'];var _0x3e9ea0=_0x217de7[_0x424e('0x61')]?_0x217de7[_0x424e('0x61')][_0x424e('0x65')]:null;var _0x21e41c=[];return Promise['resolve']()['then'](function(){if(!_0x3e9ea0)throw new APIBadRequestError(_0x424e('0x120'));})[_0x424e('0x18')](function(){return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x3450f2}});})[_0x424e('0x18')](function(_0x396bb1){if(!_0x396bb1)throw new APINotFoundError(util[_0x424e('0xf8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x217de7[_0x424e('0x54')]['id']));return db[_0x424e('0x6d')][_0x424e('0x121')](function(_0x405ba9){return _0x396bb1[_0x424e('0x11f')](_0x3e9ea0,{'transaction':_0x405ba9})[_0x424e('0x18')](function(){return db[_0x424e('0x11e')]['findAll']({'where':{'id':{'$in':_0x3e9ea0}}});})[_0x424e('0x18')](function(_0x24d83){var _0x484de9=_['map'](_0x24d83,function(_0x627168){return _0x627168[_0x424e('0x122')]();});return Promise['all'](_0x484de9);})[_0x424e('0x18')](function(_0xa8e679){_0x21e41c=_[_0x424e('0x123')](_0xa8e679);var _0x438cf7=_[_0x424e('0x30')](_0x21e41c,function(_0x507faf){return _0x507faf[_0x424e('0x124')](_0x396bb1['id'],{'transaction':_0x405ba9});});return Promise[_0x424e('0x60')](_0x438cf7);})[_0x424e('0x18')](function(){if(!_0x396bb1[_0x424e('0xb6')])return;var _0x365853=_['filter'](_0x21e41c,function(_0x20a743){return _0x20a743[_0x424e('0x125')]('channel')==='Voice';});var _0x20a2e5=_[_0x424e('0x30')](_0x365853,function(_0xf1aad7){return db[_0x424e('0xe4')]['upsert']({'membername':_0x396bb1[_0x424e('0x33')],'UserId':_0x396bb1['id'],'queue_name':_0xf1aad7[_0x424e('0x33')],'VoiceQueueId':_0xf1aad7['id'],'interface':_[_0x424e('0x6b')](_0x396bb1[_0x424e('0xb7')])?util[_0x424e('0xf8')](_0x424e('0xb8'),_0x396bb1[_0x424e('0x33')]):_0x396bb1['interface'],'paused':_0x396bb1[_0x424e('0xa9')]||![],'penalty':_0x396bb1[_0x424e('0xb9')]},{'transaction':_0x405ba9});});return Promise[_0x424e('0x60')](_0x20a2e5);})[_0x424e('0x18')](function(){return db[_0x424e('0x126')][_0x424e('0x4b')]({'where':{'teamId':{'$in':_0x3e9ea0}}});})[_0x424e('0x18')](function(_0x34fe52){var _0x5327c2=_[_0x424e('0x30')](_0x34fe52,function(_0xc266c3){return db['UserVoicePrefix'][_0x424e('0x85')]({'UserId':_0x396bb1['id'],'VoicePrefixId':_0xc266c3['VoicePrefixId']},{'transaction':_0x405ba9});});return Promise['all'](_0x5327c2);});});})[_0x424e('0x18')](function(){for(var _0x49e81e=0x0;_0x49e81e<_0x21e41c[_0x424e('0x5b')];_0x49e81e++){var _0x107a7e=_0x21e41c[_0x49e81e][_0x424e('0x125')](_0x424e('0xa7'));var _0x256934=_0x107a7e+_0x424e('0xb1');socket[_0x424e('0x29')](_0x424e('0x2e')+_0x107a7e+_0x424e('0xb2'),{'UserId':_0x3450f2,['queueField']:_0x21e41c[_0x49e81e]['id']});}})[_0x424e('0x18')](respondWithStatusCode(_0x2e2a94,null))[_0x424e('0x52')](APIHandleError(_0x2e2a94));};exports['removeTeams']=function(_0x3fb248,_0x474253){var _0x37bd9e=_0x3fb248[_0x424e('0x54')]['id'];var _0x1e2697=null;if(_0x3fb248['query']['ids']){_0x1e2697=_[_0x424e('0x127')](_0x3fb248[_0x424e('0x44')][_0x424e('0x65')])?_0x3fb248['query'][_0x424e('0x65')]:[_0x3fb248[_0x424e('0x44')][_0x424e('0x65')]];}var _0x997651=[];return Promise['resolve']()[_0x424e('0x18')](function(){if(!_0x1e2697)throw new APIBadRequestError(_0x424e('0x128'));})[_0x424e('0x18')](function(){return db[_0x424e('0x4a')]['findOne']({'where':{'id':_0x37bd9e}});})[_0x424e('0x18')](function(_0x5f1f5a){if(!_0x5f1f5a)throw new APINotFoundError(util[_0x424e('0xf8')](_0x424e('0x129'),_0x3fb248[_0x424e('0x54')]['id']));return db[_0x424e('0x6d')][_0x424e('0x121')](function(_0x35a654){return _0x5f1f5a['removeTeams'](_0x1e2697,{'transaction':_0x35a654})[_0x424e('0x18')](function(){return db['Team'][_0x424e('0x4b')]({'where':{'id':{'$in':_0x1e2697}}});})[_0x424e('0x18')](function(_0x5a8e4b){var _0x5935a3=_[_0x424e('0x30')](_0x5a8e4b,function(_0x4be50e){return _0x4be50e['getAssociatedQueues']();});return Promise[_0x424e('0x60')](_0x5935a3);})[_0x424e('0x18')](function(_0x45960a){_0x997651=_[_0x424e('0x123')](_0x45960a);var _0xd00915=_[_0x424e('0x30')](_0x997651,function(_0x3024c0){return _0x3024c0[_0x424e('0x12a')](_0x5f1f5a['id'],{'transaction':_0x35a654});});return Promise[_0x424e('0x60')](_0xd00915);})[_0x424e('0x18')](function(){if(!_0x5f1f5a[_0x424e('0xb6')])return;var _0x205b47=_['filter'](_0x997651,function(_0x11e30f){return _0x11e30f[_0x424e('0x125')](_0x424e('0xa7'))===_0x424e('0x12b');});var _0xc2d539=_[_0x424e('0x30')](_0x205b47,function(_0x555a7d){return db[_0x424e('0xe4')][_0x424e('0x2b')]({'where':{'VoiceQueueId':_0x555a7d['id'],'UserId':_0x5f1f5a['id']},'transaction':_0x35a654});});return Promise[_0x424e('0x60')](_0xc2d539);})['then'](function(){return db[_0x424e('0x126')][_0x424e('0x4b')]({'where':{'teamId':{'$in':_0x1e2697}}});})[_0x424e('0x18')](function(_0x3c619c){var _0x2a419e=_['map'](_0x3c619c,function(_0x3229f0){return db[_0x424e('0x12c')][_0x424e('0x2b')]({'where':{'UserId':_0x5f1f5a['id'],'VoicePrefixId':_0x3229f0[_0x424e('0x12d')]}},{'transaction':_0x35a654});});return Promise[_0x424e('0x60')](_0x2a419e);});});})[_0x424e('0x18')](function(){for(var _0x3f96df=0x0;_0x3f96df<_0x997651[_0x424e('0x5b')];_0x3f96df++){var _0x49efda=_0x997651[_0x3f96df][_0x424e('0x125')](_0x424e('0xa7'));var _0x25dd2f=_0x49efda+_0x424e('0xb1');socket['emit']('user'+_0x49efda+_0x424e('0xbc'),{'UserId':_0x37bd9e,['queueField']:_0x997651[_0x3f96df]['id']});}})['then'](respondWithStatusCode(_0x474253,null))[_0x424e('0x52')](APIHandleError(_0x474253));};exports[_0x424e('0x12e')]=function(_0x5586f1,_0x257e5c){var _0x49a8cd={};var _0x8d8bb8={};var _0x1903f0;var _0x34e88a;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0x5586f1[_0x424e('0x54')]['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x257e5c,null))['then'](function(_0x4c070a){if(_0x4c070a){_0x1903f0=_0x4c070a;_0x8d8bb8[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0xda')][_0x424e('0x38')]);_0x8d8bb8['query']=_['keys'](_0x5586f1[_0x424e('0x44')]);_0x8d8bb8[_0x424e('0x57')]=_[_0x424e('0x58')](_0x8d8bb8['model'],_0x8d8bb8['query']);_0x49a8cd[_0x424e('0x48')]=_['intersection'](_0x8d8bb8[_0x424e('0x59')],qs[_0x424e('0x5a')](_0x5586f1['query']['fields']));_0x49a8cd[_0x424e('0x48')]=_0x49a8cd['attributes'][_0x424e('0x5b')]?_0x49a8cd[_0x424e('0x48')]:_0x8d8bb8['model'];_0x49a8cd['order']=qs[_0x424e('0xd7')](_0x5586f1[_0x424e('0x44')]['sort']);_0x49a8cd[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0x5586f1[_0x424e('0x44')],_0x8d8bb8['filters']));if(_0x5586f1[_0x424e('0x44')][_0x424e('0x3c')]){_0x49a8cd['where']=_[_0x424e('0x5c')](_0x49a8cd[_0x424e('0x40')],{'$or':_[_0x424e('0x30')](_0x49a8cd['attributes'],function(_0x2e5356){var _0x5c6016={};_0x5c6016[_0x2e5356]={'$like':'%'+_0x5586f1[_0x424e('0x44')]['filter']+'%'};return _0x5c6016;})});}_0x49a8cd=_[_0x424e('0x5c')]({},_0x49a8cd,_0x5586f1[_0x424e('0x5d')]);return _0x1903f0[_0x424e('0x12e')](_0x49a8cd);}})[_0x424e('0x18')](function(_0x7dce34){if(_0x7dce34){_0x34e88a=_0x7dce34['length'];if(!_0x5586f1[_0x424e('0x44')][_0x424e('0xd9')](_0x424e('0xe0'))){_0x49a8cd[_0x424e('0x27')]=qs['limit'](_0x5586f1[_0x424e('0x44')][_0x424e('0x27')]);_0x49a8cd[_0x424e('0x25')]=qs['offset'](_0x5586f1[_0x424e('0x44')][_0x424e('0x25')]);}return _0x1903f0['getLists'](_0x49a8cd);}})[_0x424e('0x18')](function(_0x4e9005){if(_0x4e9005){return _0x4e9005?{'count':_0x34e88a,'rows':_0x4e9005}:null;}})[_0x424e('0x18')](respondWithResult(_0x257e5c,null))[_0x424e('0x52')](handleError(_0x257e5c,null));};exports[_0x424e('0x12f')]=function(_0xd5a557,_0x27381b){var _0x23f18d={};var _0x4fe0bf={};var _0xd2a14d;return db[_0x424e('0x4a')][_0x424e('0x9f')]({'where':{'id':_0xd5a557['params']['id']}})[_0x424e('0x18')](handleEntityNotFound(_0x27381b,null))['then'](function(_0x4fadbd){if(_0x4fadbd){_0xd2a14d=_0x4fadbd;_0x4fe0bf[_0x424e('0x59')]=_[_0x424e('0x55')](db[_0x424e('0x4a')][_0x424e('0x38')]);_0x4fe0bf[_0x424e('0x44')]=_[_0x424e('0x55')](_0xd5a557['query']);_0x4fe0bf['filters']=_[_0x424e('0x58')](_0x4fe0bf['model'],_0x4fe0bf[_0x424e('0x44')]);_0x23f18d['attributes']=_[_0x424e('0x58')](_0x4fe0bf[_0x424e('0x59')],qs[_0x424e('0x5a')](_0xd5a557[_0x424e('0x44')][_0x424e('0x5a')]));_0x23f18d[_0x424e('0x48')]=_0x23f18d[_0x424e('0x48')]['length']?_0x23f18d[_0x424e('0x48')]:_0x4fe0bf[_0x424e('0x59')];_0x23f18d[_0x424e('0xd6')]=qs['sort'](_0xd5a557[_0x424e('0x44')]['sort']);_0x23f18d[_0x424e('0x40')]=qs[_0x424e('0x57')](_[_0x424e('0xd8')](_0xd5a557[_0x424e('0x44')],_0x4fe0bf[_0x424e('0x57')]));if(_0xd5a557['query'][_0x424e('0x3c')]){_0x23f18d['where']=_[_0x424e('0x5c')](_0x23f18d['where'],{'$or':_[_0x424e('0x30')](_0x23f18d['attributes'],function(_0x36452f){var _0x36748b={};_0x36748b[_0x36452f]={'$like':'%'+_0xd5a557[_0x424e('0x44')][_0x424e('0x3c')]+'%'};return _0x36748b;})});}_0x23f18d[_0x424e('0x59')]=db[_0x424e('0x4a')];_0x23f18d['as']='Agents';_0x23f18d=_[_0x424e('0x5c')]({},_0x23f18d,_0xd5a557[_0x424e('0x5d')]);return _0xd2a14d[_0x424e('0x101')]({'include':[_0x23f18d]});}})[_0x424e('0x18')](function(_0x54809d){if(_0x54809d){var _0xd46e8e={},_0x5bbcf4=[];for(var _0xa6be71=0x0;_0xa6be71<_0x54809d['length'];_0xa6be71+=0x1){for(var _0x33fcec=0x0,_0x3296ca;_0x33fcec<_0x54809d[_0xa6be71][_0x424e('0x92')]['length'];_0x33fcec+=0x1){_0x3296ca=_0x54809d[_0xa6be71][_0x424e('0x92')][_0x33fcec][_0x424e('0xb5')]({'plain':!![]});_0xd46e8e[_0x3296ca['id']]=_0x3296ca;}}_0xd46e8e=_[_0x424e('0x130')](_0xd46e8e);for(var _0x20d2b7=qs[_0x424e('0x25')](_0xd5a557[_0x424e('0x44')][_0x424e('0x25')]);_0x20d2b7<_0xd46e8e[_0x424e('0x5b')]&&_0x5bbcf4[_0x424e('0x5b')]=_0x19771c['agents']){throw new Error(_0x0ee4('0x52'));}})[_0x0ee4('0x10')](function(){if(_0x4a1351){return db[_0x0ee4('0x2d')][_0x0ee4('0x48')]({'where':{'membername':_0x4a1351[_0x0ee4('0x29')]},'individualHooks':!![]});}})[_0x0ee4('0x10')](function(){if(_0x4a1351){return _0x4a1351['getVoiceQueues']({'raw':!![]});}})[_0x0ee4('0x10')](function(_0x1c770c){if(_0x4a1351){if(_0x1c770c){var _0x5732bc=[];_0x3e8d80=_0x1c770c;if(_0x3e8d80['length']){for(var _0x534544=0x0;_0x534544<_0x3e8d80['length'];_0x534544++){_0x5732bc[_0x0ee4('0x49')](db['UserVoiceQueueRt'][_0x0ee4('0x53')]({'membername':_0x4a1351[_0x0ee4('0x29')],'UserId':_0x4a1351['id'],'queue_name':_0x3e8d80[_0x534544][_0x0ee4('0x29')],'VoiceQueueId':_0x3e8d80[_0x534544]['id'],'interface':_0x3eb513,'paused':_0x4a1351[_0x0ee4('0x54')]||![],'penalty':_0x3e8d80[_0x534544][_0x0ee4('0x55')]||0x0}));}return BPromise[_0x0ee4('0x56')](_0x5732bc);}}}})['then'](function(){if(_0x4a1351){return db['MemberReport'][_0x0ee4('0x1c')]({'where':{'membername':_0x4a1351[_0x0ee4('0x29')],'exitAt':null}});}})[_0x0ee4('0x10')](function(_0x5477ee){if(_0x4a1351){if(_0x5477ee&&_0x5477ee[_0x0ee4('0x30')]){var _0x37c2e7=[];_0x5477ee[_0x0ee4('0x46')](function(_0x554431){_0x37c2e7[_0x0ee4('0x49')](_0x554431[_0x0ee4('0x36')]({'exitAt':moment()['format'](_0x0ee4('0x32'))}));});return BPromise[_0x0ee4('0x56')](_0x37c2e7);}}})['then'](function(_0x3c59b3){if(_0x4a1351){var _0x3b1bf2=[];var _0x8a3a05=[];var _0xa37e1a=utils[_0x0ee4('0x57')]();var _0x276d00={'membername':_0x4a1351['name'],'interface':_0x3eb513,'enterAt':moment()[_0x0ee4('0x31')](_0x0ee4('0x32')),'role':_0x4a1351[_0x0ee4('0x2a')],'internal':_0x4a1351[_0x0ee4('0x2b')]};_0xa37e1a[_0x0ee4('0x46')](function(_0x1a952a){_0x3b1bf2[_0x0ee4('0x49')](_['merge']({'channel':_0x1a952a,'type':_0x0ee4('0x58'),'data1':_0x0ee4('0x59'),'data2':_0x3eb513},_0x276d00));if(_0x4a1351[_0x0ee4('0x54')]){_0x8a3a05['push'](_[_0x0ee4('0x5a')]({'channel':_0x1a952a,'type':_0x0ee4('0x2f'),'data1':'LOGININPAUSE'},_0x276d00));}});return db[_0x0ee4('0x2e')][_0x0ee4('0x5b')](_0x3b1bf2[_0x0ee4('0x5c')](_0x8a3a05),{'individualHooks':!![]});}})[_0x0ee4('0x10')](function(){if(_0x4a1351){return _0x4a1351['update']({'online':!![],'lastLoginAt':moment()[_0x0ee4('0x31')](_0x0ee4('0x32')),'voicePause':_0x4a1351[_0x0ee4('0x54')]||![],'mailPause':_0x4a1351[_0x0ee4('0x54')]||![],'chatPause':_0x4a1351[_0x0ee4('0x54')]||![],'faxPause':_0x4a1351[_0x0ee4('0x54')]||![],'smsPause':_0x4a1351[_0x0ee4('0x54')]||![],'openchannelPause':_0x4a1351['loginInPause']||![],'pauseType':_0x4a1351[_0x0ee4('0x54')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x0ee4('0x32')),'interface':_0x3eb513});}})[_0x0ee4('0x10')](function(_0x24b99a){_0x57abf5(_0x24b99a);})[_0x0ee4('0x1a')](function(_0x23463c){_0x4de14d(_0x39c295[_0x0ee4('0x17')](0x1f4,_0x23463c['message']));});});}; \ No newline at end of file +var _0xc574=['PauseUser','find','role','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','SIP/%s','type','internal','uniqueid','body','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','%s%s','Pause','all','mobile','phone','loginInPause','agent','agents','destroy','upsert','UserVoiceQueue.penalty','LOGIN','merge','LOGININPAUSE','bulkCreate','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','localhost','socket.io-emitter','./user.socket','request','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetUser','User','findAll','options','where','attributes','limit','include','map','model','then','info','ShowUser'];(function(_0x14a31a,_0x455c58){var _0x2536a8=function(_0x2a53b3){while(--_0x2a53b3){_0x14a31a['push'](_0x14a31a['shift']());}};_0x2536a8(++_0x455c58);}(_0xc574,0xe0));var _0x4c57=function(_0x3f4a12,_0x49c183){_0x3f4a12=_0x3f4a12-0x0;var _0x5368e3=_0xc574[_0x3f4a12];return _0x5368e3;};'use strict';var _=require('lodash');var util=require(_0x4c57('0x0'));var moment=require(_0x4c57('0x1'));var BPromise=require(_0x4c57('0x2'));var rs=require(_0x4c57('0x3'));var fs=require('fs');var Redis=require(_0x4c57('0x4'));var db=require(_0x4c57('0x5'))['db'];var utils=require(_0x4c57('0x6'));var logger=require(_0x4c57('0x7'))(_0x4c57('0x8'));var config=require('../../config/environment');var jayson=require(_0x4c57('0x9'));var client=jayson[_0x4c57('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x4c57('0xb'),'port':0x18eb});var socket=require(_0x4c57('0xc'))(new Redis(config['redis']));require(_0x4c57('0xd'))['register'](socket);function respondWithRpcPromise(_0x540f29,_0x568354,_0xcb3636){return new BPromise(function(_0x548126,_0x81cdb1){return client[_0x4c57('0xe')](_0x540f29,_0xcb3636)['then'](function(_0x369f72){logger['info'](_0x4c57('0xf'),_0x568354,_0x4c57('0x10'));logger[_0x4c57('0x11')](_0x4c57('0x12'),_0x568354,'request\x20sent',JSON[_0x4c57('0x13')](_0x369f72));if(_0x369f72[_0x4c57('0x14')]){if(_0x369f72['error'][_0x4c57('0x15')]===0x1f4){logger[_0x4c57('0x14')]('User,\x20%s,\x20%s',_0x568354,_0x369f72[_0x4c57('0x14')]['message']);return _0x81cdb1(_0x369f72['error'][_0x4c57('0x16')]);}logger[_0x4c57('0x14')](_0x4c57('0xf'),_0x568354,_0x369f72['error'][_0x4c57('0x16')]);return _0x548126(_0x369f72[_0x4c57('0x14')][_0x4c57('0x16')]);}else{logger['info']('User,\x20%s,\x20%s',_0x568354,_0x4c57('0x10'));_0x548126(_0x369f72['result']['message']);}})[_0x4c57('0x17')](function(_0x5f49d0){logger[_0x4c57('0x14')](_0x4c57('0xf'),_0x568354,_0x5f49d0);_0x81cdb1(_0x5f49d0);});});}exports[_0x4c57('0x18')]=function(_0x3be1b5){var _0x13291a=this;return new Promise(function(_0x49a4e6,_0xc2ae69){return db[_0x4c57('0x19')][_0x4c57('0x1a')]({'raw':_0x3be1b5['options']?_0x3be1b5[_0x4c57('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3be1b5[_0x4c57('0x1b')]?_0x3be1b5[_0x4c57('0x1b')][_0x4c57('0x1c')]||null:null,'attributes':_0x3be1b5[_0x4c57('0x1b')]?_0x3be1b5[_0x4c57('0x1b')][_0x4c57('0x1d')]||null:null,'limit':_0x3be1b5[_0x4c57('0x1b')]?_0x3be1b5[_0x4c57('0x1b')][_0x4c57('0x1e')]||null:null,'include':_0x3be1b5['options']?_0x3be1b5[_0x4c57('0x1b')][_0x4c57('0x1f')]?_[_0x4c57('0x20')](_0x3be1b5[_0x4c57('0x1b')][_0x4c57('0x1f')],function(_0x3f8212){return{'model':db[_0x3f8212[_0x4c57('0x21')]],'as':_0x3f8212['as'],'attributes':_0x3f8212[_0x4c57('0x1d')],'include':_0x3f8212[_0x4c57('0x1f')]?_[_0x4c57('0x20')](_0x3f8212[_0x4c57('0x1f')],function(_0xeae5a3){return{'model':db[_0xeae5a3[_0x4c57('0x21')]],'as':_0xeae5a3['as'],'attributes':_0xeae5a3[_0x4c57('0x1d')],'include':_0xeae5a3['include']?_[_0x4c57('0x20')](_0xeae5a3[_0x4c57('0x1f')],function(_0x543b27){return{'model':db[_0x543b27['model']],'as':_0x543b27['as'],'attributes':_0x543b27[_0x4c57('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c57('0x22')](function(_0x29ccae){logger[_0x4c57('0x23')]('GetUser',_0x3be1b5);logger[_0x4c57('0x11')](_0x4c57('0x18'),_0x3be1b5,JSON[_0x4c57('0x13')](_0x29ccae));_0x49a4e6(_0x29ccae);})['catch'](function(_0x55bd16){logger[_0x4c57('0x14')](_0x4c57('0x18'),_0x55bd16[_0x4c57('0x16')],_0x3be1b5);_0xc2ae69(_0x13291a[_0x4c57('0x14')](0x1f4,_0x55bd16[_0x4c57('0x16')]));});});};exports[_0x4c57('0x24')]=function(_0x4e224e){var _0x52a615=this;return new Promise(function(_0x52fb45,_0x234b5b){return db[_0x4c57('0x19')]['find']({'raw':_0x4e224e[_0x4c57('0x1b')]?_0x4e224e[_0x4c57('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4e224e[_0x4c57('0x1b')]?_0x4e224e[_0x4c57('0x1b')][_0x4c57('0x1c')]||null:null,'attributes':_0x4e224e[_0x4c57('0x1b')]?_0x4e224e['options'][_0x4c57('0x1d')]||null:null,'include':_0x4e224e[_0x4c57('0x1b')]?_0x4e224e[_0x4c57('0x1b')][_0x4c57('0x1f')]?_['map'](_0x4e224e[_0x4c57('0x1b')]['include'],function(_0x530e6e){return{'model':db[_0x530e6e[_0x4c57('0x21')]],'as':_0x530e6e['as'],'attributes':_0x530e6e[_0x4c57('0x1d')],'include':_0x530e6e[_0x4c57('0x1f')]?_['map'](_0x530e6e['include'],function(_0x5b8d82){return{'model':db[_0x5b8d82[_0x4c57('0x21')]],'as':_0x5b8d82['as'],'attributes':_0x5b8d82[_0x4c57('0x1d')],'include':_0x5b8d82[_0x4c57('0x1f')]?_[_0x4c57('0x20')](_0x5b8d82[_0x4c57('0x1f')],function(_0x1c1cbc){return{'model':db[_0x1c1cbc[_0x4c57('0x21')]],'as':_0x1c1cbc['as'],'attributes':_0x1c1cbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c57('0x22')](function(_0x5ceedc){logger[_0x4c57('0x23')](_0x4c57('0x24'),_0x4e224e);logger[_0x4c57('0x11')](_0x4c57('0x24'),_0x4e224e,JSON[_0x4c57('0x13')](_0x5ceedc));_0x52fb45(_0x5ceedc);})[_0x4c57('0x17')](function(_0x147aeb){logger[_0x4c57('0x14')](_0x4c57('0x24'),_0x147aeb[_0x4c57('0x16')],_0x4e224e);_0x234b5b(_0x52a615[_0x4c57('0x14')](0x1f4,_0x147aeb[_0x4c57('0x16')]));});});};exports[_0x4c57('0x25')]=function(_0x274501){var _0x36263c=this;return new Promise(function(_0x6b0dd4,_0x1e54cb){var _0x32e497;return db['User'][_0x4c57('0x26')]({'where':_0x274501[_0x4c57('0x1b')][_0x4c57('0x1c')]||{},'attributes':['id','name',_0x4c57('0x27'),'internal','interface']})['then'](function(_0x5af408){if(_0x5af408){_0x32e497=_0x5af408;return db[_0x4c57('0x28')][_0x4c57('0x29')]({'paused':0x1},{'where':{'UserId':_0x32e497['id']},'individualHooks':!![]});}})['then'](function(){if(_0x32e497){return db[_0x4c57('0x2a')][_0x4c57('0x1a')]({'where':{'membername':_0x32e497[_0x4c57('0x2b')],'type':_0x4c57('0x2c'),'exitAt':null}});}})[_0x4c57('0x22')](function(_0x353721){if(_0x32e497){if(_0x353721&&_0x353721[_0x4c57('0x2d')]){var _0x17b6a4=moment()[_0x4c57('0x2e')](_0x4c57('0x2f'));for(var _0x7f8a2f=0x0,_0x440460=_0x353721['length'];_0x7f8a2f<_0x440460;_0x7f8a2f++){_0x353721[_0x7f8a2f][_0x4c57('0x30')]({'exitAt':_0x17b6a4});}}}})[_0x4c57('0x22')](function(){if(_0x32e497){var _0x6a04cc=[];var _0x1687d7=utils[_0x4c57('0x31')]();_0x1687d7[_0x4c57('0x32')](function(_0x70ba7d){_0x6a04cc[_0x4c57('0x33')]({'channel':_0x70ba7d,'membername':_0x32e497[_0x4c57('0x2b')],'interface':_[_0x4c57('0x34')](_0x32e497[_0x4c57('0x35')])?util[_0x4c57('0x2e')](_0x4c57('0x36'),_0x32e497[_0x4c57('0x2b')]):_0x32e497['interface'],'type':_0x4c57('0x2c'),'enterAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f')),'data1':_0x274501['body'][_0x4c57('0x37')]||'DEFAULT\x20PAUSE','role':_0x32e497[_0x4c57('0x27')],'internal':_0x32e497[_0x4c57('0x38')],'uniqueid':_0x274501['body'][_0x4c57('0x39')]||null});});return db['MemberReport']['bulkCreate'](_0x6a04cc,{'individualHooks':!![]});}})[_0x4c57('0x22')](function(){if(_0x32e497){return _0x32e497['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x274501[_0x4c57('0x3a')][_0x4c57('0x37')]||_0x4c57('0x3b'),'lastPauseAt':moment()['format'](_0x4c57('0x2f'))});}})[_0x4c57('0x22')](function(_0x55216e){_0x6b0dd4(_0x55216e);})[_0x4c57('0x17')](function(_0x45a032){_0x1e54cb(_0x36263c[_0x4c57('0x14')](0x1f4,_0x45a032[_0x4c57('0x16')]));});});};exports[_0x4c57('0x3c')]=function(_0x375f43){var _0x2dacf8=this;return new Promise(function(_0x17f04c,_0x2d71d7){var _0x398613;return db[_0x4c57('0x19')][_0x4c57('0x3d')]({'where':_0x375f43['options'][_0x4c57('0x1c')]||{},'attributes':['id',_0x4c57('0x2b')]})['then'](function(_0x40fa98){if(_0x40fa98){_0x398613=_0x40fa98;if(_0x375f43[_0x4c57('0x3a')][_0x4c57('0x3e')]&&!utils['isValidChannel'](_0x375f43[_0x4c57('0x3a')]['channel'])){throw new Error(_0x4c57('0x3f'));}switch(_0x375f43[_0x4c57('0x3a')]['channel']){case _0x4c57('0x40'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x398613['id']}})[_0x4c57('0x22')](function(){return db['MemberReport'][_0x4c57('0x26')]({'where':{'channel':_0x375f43[_0x4c57('0x3a')][_0x4c57('0x3e')],'membername':_0x398613['name'],'type':'PAUSE','exitAt':null}});})['then'](function(_0xfb1e07){if(_0xfb1e07){return _0xfb1e07['update']({'exitAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f')),'data2':_0x4c57('0x41')},{'individualHooks':!![]});}return null;})[_0x4c57('0x22')](function(){return _0x398613['update']({'voicePause':![]});});case _0x4c57('0x42'):case _0x4c57('0x43'):case _0x4c57('0x44'):case _0x4c57('0x45'):case _0x4c57('0x46'):case _0x4c57('0x47'):return db['MemberReport'][_0x4c57('0x26')]({'where':{'channel':_0x375f43[_0x4c57('0x3a')]['channel'],'membername':_0x398613[_0x4c57('0x2b')],'type':'PAUSE','exitAt':null}})[_0x4c57('0x22')](function(_0x562c2c){return _0x562c2c[_0x4c57('0x29')]({'exitAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f')),'data2':_0x4c57('0x41')},{'individualHooks':!![]});})['then'](function(){var _0x417d58={};_['set'](_0x417d58,util[_0x4c57('0x2e')](_0x4c57('0x48'),_0x375f43[_0x4c57('0x3a')][_0x4c57('0x3e')],_0x4c57('0x49')),![]);return _0x398613[_0x4c57('0x29')](_0x417d58);});default:return db['UserVoiceQueueRt'][_0x4c57('0x29')]({'paused':0x0},{'where':{'UserId':_0x398613['id']}})[_0x4c57('0x22')](function(){return db[_0x4c57('0x2a')][_0x4c57('0x1a')]({'where':{'membername':_0x398613[_0x4c57('0x2b')],'type':'PAUSE','exitAt':null}});})[_0x4c57('0x22')](function(_0x5579f0){var _0x3d2e80=[];_0x5579f0[_0x4c57('0x32')](function(_0x3e49c1){_0x3d2e80['push'](_0x3e49c1[_0x4c57('0x29')]({'exitAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f')),'data2':_0x4c57('0x41')}));});return BPromise[_0x4c57('0x4a')](_0x3d2e80);})[_0x4c57('0x22')](function(){return _0x398613[_0x4c57('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x4c57('0x22')](function(_0x169c8f){_0x17f04c(_0x169c8f);})[_0x4c57('0x17')](function(_0x4bc85c){_0x2d71d7(_0x2dacf8['error'](0x1f4,_0x4bc85c[_0x4c57('0x16')]));});});};exports['LogoutUser']=function(_0x871436){var _0x2d4b26=this;return new Promise(function(_0x495406,_0xcd82d8){var _0x33a677;return db[_0x4c57('0x19')][_0x4c57('0x3d')]({'where':_0x871436['options'][_0x4c57('0x1c')]||{},'attributes':['id',_0x4c57('0x2b')]})[_0x4c57('0x22')](function(_0x1c4e83){if(_0x1c4e83){_0x33a677=_0x1c4e83;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x33a677[_0x4c57('0x2b')]},'individualHooks':!![]});}})[_0x4c57('0x22')](function(){if(_0x33a677){return db[_0x4c57('0x2a')][_0x4c57('0x1a')]({'where':{'membername':_0x33a677[_0x4c57('0x2b')],'exitAt':null}});}})[_0x4c57('0x22')](function(_0x179b1b){if(_0x33a677){if(_0x179b1b&&_0x179b1b[_0x4c57('0x2d')]){var _0x150f06=[];_0x179b1b[_0x4c57('0x32')](function(_0x2bf2ec){_0x150f06[_0x4c57('0x33')](_0x2bf2ec[_0x4c57('0x29')]({'exitAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f'))}));});return BPromise[_0x4c57('0x4a')](_0x150f06);}}})[_0x4c57('0x22')](function(){if(_0x33a677){return _0x33a677[_0x4c57('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x388fd1){_0x495406(_0x388fd1);})[_0x4c57('0x17')](function(_0x151cbe){_0xcd82d8(_0x2d4b26[_0x4c57('0x14')](0x1f4,_0x151cbe['message']));});});};exports['LoginUser']=function(_0x5165e9){var _0x5824a=this;return new Promise(function(_0x141d86,_0x378625){var _0x2755ae;var _0xb218c0;var _0x2f9c53;var _0x3071c6;return db['User'][_0x4c57('0x3d')]({'where':_0x5165e9[_0x4c57('0x1b')][_0x4c57('0x1c')]||{},'attributes':['id','name',_0x4c57('0x27'),_0x4c57('0x4b'),_0x4c57('0x4c'),_0x4c57('0x38'),_0x4c57('0x4d'),_0x4c57('0x35')]})[_0x4c57('0x22')](function(_0x10f1eb){if(_0x10f1eb){_0x2755ae=_0x10f1eb;_0x3071c6=_0x5165e9['body'][_0x4c57('0x35')]?_0x5165e9[_0x4c57('0x3a')][_0x4c57('0x35')]:util['format'](_0x4c57('0x36'),_0x2755ae[_0x4c57('0x2b')]);return db['User']['count']({'where':{'role':_0x4c57('0x4e'),'online':!![],'id':{'$ne':_0x2755ae['id']}}});}})[_0x4c57('0x22')](function(_0x4f502d){if(_0x4f502d){_0x2f9c53=_0x4f502d;return require('../../config/license/util')['getLicense']();}})[_0x4c57('0x22')](function(_0x4e13ac){if(_0x4e13ac&&_0x4e13ac[_0x4c57('0x4f')]&&_0x2f9c53>=_0x4e13ac[_0x4c57('0x4f')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x2755ae){return db[_0x4c57('0x28')][_0x4c57('0x50')]({'where':{'membername':_0x2755ae[_0x4c57('0x2b')]},'individualHooks':!![]});}})[_0x4c57('0x22')](function(){if(_0x2755ae){return _0x2755ae['getVoiceQueues']({'raw':!![]});}})[_0x4c57('0x22')](function(_0x98793){if(_0x2755ae){if(_0x98793){var _0x11c980=[];_0xb218c0=_0x98793;if(_0xb218c0[_0x4c57('0x2d')]){for(var _0x18a727=0x0;_0x18a727<_0xb218c0[_0x4c57('0x2d')];_0x18a727++){_0x11c980[_0x4c57('0x33')](db[_0x4c57('0x28')][_0x4c57('0x51')]({'membername':_0x2755ae['name'],'UserId':_0x2755ae['id'],'queue_name':_0xb218c0[_0x18a727]['name'],'VoiceQueueId':_0xb218c0[_0x18a727]['id'],'interface':_0x3071c6,'paused':_0x2755ae[_0x4c57('0x4d')]||![],'penalty':_0xb218c0[_0x18a727][_0x4c57('0x52')]||0x0}));}return BPromise[_0x4c57('0x4a')](_0x11c980);}}}})['then'](function(){if(_0x2755ae){return db['MemberReport'][_0x4c57('0x1a')]({'where':{'membername':_0x2755ae[_0x4c57('0x2b')],'exitAt':null}});}})[_0x4c57('0x22')](function(_0x503f7b){if(_0x2755ae){if(_0x503f7b&&_0x503f7b[_0x4c57('0x2d')]){var _0x18bab4=[];_0x503f7b[_0x4c57('0x32')](function(_0xaa36c){_0x18bab4[_0x4c57('0x33')](_0xaa36c['update']({'exitAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f'))}));});return BPromise[_0x4c57('0x4a')](_0x18bab4);}}})['then'](function(_0x442022){if(_0x2755ae){var _0x273691=[];var _0x4d1789=[];var _0x3e7bb8=utils[_0x4c57('0x31')]();var _0x4aa769={'membername':_0x2755ae[_0x4c57('0x2b')],'interface':_0x3071c6,'enterAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f')),'role':_0x2755ae[_0x4c57('0x27')],'internal':_0x2755ae[_0x4c57('0x38')]};_0x3e7bb8[_0x4c57('0x32')](function(_0x6a7c4c){_0x273691[_0x4c57('0x33')](_['merge']({'channel':_0x6a7c4c,'type':_0x4c57('0x53'),'data1':'callysquare','data2':_0x3071c6},_0x4aa769));if(_0x2755ae[_0x4c57('0x4d')]){_0x4d1789[_0x4c57('0x33')](_[_0x4c57('0x54')]({'channel':_0x6a7c4c,'type':_0x4c57('0x2c'),'data1':_0x4c57('0x55')},_0x4aa769));}});return db[_0x4c57('0x2a')][_0x4c57('0x56')](_0x273691['concat'](_0x4d1789),{'individualHooks':!![]});}})[_0x4c57('0x22')](function(){if(_0x2755ae){return _0x2755ae['update']({'online':!![],'lastLoginAt':moment()[_0x4c57('0x2e')](_0x4c57('0x2f')),'voicePause':_0x2755ae[_0x4c57('0x4d')]||![],'mailPause':_0x2755ae[_0x4c57('0x4d')]||![],'chatPause':_0x2755ae['loginInPause']||![],'faxPause':_0x2755ae['loginInPause']||![],'smsPause':_0x2755ae['loginInPause']||![],'openchannelPause':_0x2755ae[_0x4c57('0x4d')]||![],'pauseType':_0x2755ae[_0x4c57('0x4d')]?_0x4c57('0x55'):null,'lastPauseAt':moment()[_0x4c57('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3071c6});}})['then'](function(_0x21ae90){_0x141d86(_0x21ae90);})[_0x4c57('0x17')](function(_0x540ecd){_0x378625(_0x5824a[_0x4c57('0x14')](0x1f4,_0x540ecd[_0x4c57('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index cc01eae..4a53772 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 _0x2c27=['length','user:','./user.events','save','remove','emit','removeListener','register'];(function(_0x47de1c,_0x53f860){var _0x5a1bbf=function(_0x9fdddd){while(--_0x9fdddd){_0x47de1c['push'](_0x47de1c['shift']());}};_0x5a1bbf(++_0x53f860);}(_0x2c27,0xfa));var _0x72c2=function(_0x1ce084,_0x55e1b0){_0x1ce084=_0x1ce084-0x0;var _0x46efe1=_0x2c27[_0x1ce084];return _0x46efe1;};'use strict';var UserEvents=require(_0x72c2('0x0'));var events=[_0x72c2('0x1'),_0x72c2('0x2'),'update'];function createListener(_0x35dc84,_0x7f0363){return function(_0x2eadb6){_0x7f0363[_0x72c2('0x3')](_0x35dc84,_0x2eadb6);};}function removeListener(_0x58949d,_0x68bdfa){return function(){UserEvents[_0x72c2('0x4')](_0x58949d,_0x68bdfa);};}exports[_0x72c2('0x5')]=function(_0x536d63){for(var _0x1cfbf6=0x0,_0x316024=events[_0x72c2('0x6')];_0x1cfbf6<_0x316024;_0x1cfbf6++){var _0x28aead=events[_0x1cfbf6];var _0x146859=createListener(_0x72c2('0x7')+_0x28aead,_0x536d63);UserEvents['on'](_0x28aead,_0x146859);}}; \ No newline at end of file +var _0x334d=['save','remove','update','emit','register','length'];(function(_0x1f8ec9,_0x3d9851){var _0x580bc9=function(_0x360c8e){while(--_0x360c8e){_0x1f8ec9['push'](_0x1f8ec9['shift']());}};_0x580bc9(++_0x3d9851);}(_0x334d,0x162));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require('./user.events');var events=[_0xd334('0x0'),_0xd334('0x1'),_0xd334('0x2')];function createListener(_0x421aca,_0x3a7e0e){return function(_0x3a75fa){_0x3a7e0e[_0xd334('0x3')](_0x421aca,_0x3a75fa);};}function removeListener(_0x29c9d5,_0x50e6d5){return function(){UserEvents['removeListener'](_0x29c9d5,_0x50e6d5);};}exports[_0xd334('0x4')]=function(_0x15a4f3){for(var _0x13a926=0x0,_0x566219=events[_0xd334('0x5')];_0x13a926<_0x566219;_0x13a926++){var _0xcb3171=events[_0x13a926];var _0x54fecb=createListener('user:'+_0xcb3171,_0x15a4f3);UserEvents['on'](_0xcb3171,_0x54fecb);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ecd467e..527c6d7 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x514614,_0x54c16d){var _0x334409=function(_0x3c8b2c){while(--_0x3c8b2c){_0x514614['push'](_0x514614['shift']());}};_0x334409(++_0x54c16d);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x44cb68,_0x3ca3f2){var _0x4a42c2=function(_0x45c49d){while(--_0x45c49d){_0x44cb68['push'](_0x44cb68['shift']());}};_0x4a42c2(++_0x3ca3f2);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 0b08e7e..af8cfba 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 _0x5912=['INTEGER','exports'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5912,0x18b));var _0x2591=function(_0x4c3b47,_0x2b85d5){_0x4c3b47=_0x4c3b47-0x0;var _0x49fff4=_0x5912[_0x4c3b47];return _0x49fff4;};'use strict';var Sequelize=require('sequelize');module[_0x2591('0x0')]={'penalty':{'type':Sequelize[_0x2591('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9933=['exports','sequelize'];(function(_0x78c09c,_0x2db789){var _0x55b2ea=function(_0x25d7a5){while(--_0x25d7a5){_0x78c09c['push'](_0x78c09c['shift']());}};_0x55b2ea(++_0x2db789);}(_0x9933,0xe5));var _0x3993=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9933[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x3993('0x0'));module[_0x3993('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 31266a2..70cdf24 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 _0xb7a1=['path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','api','moment','bluebird','request-promise'];(function(_0x3f4e38,_0x5dbfe9){var _0x1048b7=function(_0x3cad05){while(--_0x3cad05){_0x3f4e38['push'](_0x3f4e38['shift']());}};_0x1048b7(++_0x5dbfe9);}(_0xb7a1,0x1cf));var _0x1b7a=function(_0x14acc3,_0x31d49c){_0x14acc3=_0x14acc3-0x0;var _0x1608e8=_0xb7a1[_0x14acc3];return _0x1608e8;};'use strict';var _=require(_0x1b7a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1b7a('0x1'));var moment=require(_0x1b7a('0x2'));var BPromise=require(_0x1b7a('0x3'));var rp=require(_0x1b7a('0x4'));var fs=require('fs');var path=require(_0x1b7a('0x5'));var rimraf=require(_0x1b7a('0x6'));var config=require(_0x1b7a('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x1b7a('0x8')]=function(_0x561e80,_0x2f3a6a){return _0x561e80[_0x1b7a('0x9')](_0x1b7a('0xa'),attributes,{'tableName':_0x1b7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc63f=['lodash','util','api','moment','request-promise','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x5f46ef,_0x4fe3d2){var _0x17e8f1=function(_0x4c7ea6){while(--_0x4c7ea6){_0x5f46ef['push'](_0x5f46ef['shift']());}};_0x17e8f1(++_0x4fe3d2);}(_0xc63f,0xab));var _0xfc63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc63f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc63('0x0'));var util=require(_0xfc63('0x1'));var logger=require('../../config/logger')(_0xfc63('0x2'));var moment=require(_0xfc63('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc63('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc63('0x5'));module[_0xfc63('0x6')]=function(_0x21752a,_0x275b28){return _0x21752a[_0xfc63('0x7')](_0xfc63('0x8'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index cc311bc..97a2dc3 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 _0xe0ff=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x4ad0e6,_0x4bbe4a){var _0x1aaae1=function(_0x575b66){while(--_0x575b66){_0x4ad0e6['push'](_0x4ad0e6['shift']());}};_0x1aaae1(++_0x4bbe4a);}(_0xe0ff,0xa0));var _0xfe0f=function(_0x2dd630,_0x5bd862){_0x2dd630=_0x2dd630-0x0;var _0x23dd4f=_0xe0ff[_0x2dd630];return _0x23dd4f;};'use strict';var _=require(_0xfe0f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe0f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe0f('0x2'));var logger=require(_0xfe0f('0x3'))(_0xfe0f('0x4'));var config=require(_0xfe0f('0x5'));var jayson=require(_0xfe0f('0x6'));var client=jayson[_0xfe0f('0x7')][_0xfe0f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45952f,_0x4dd7c9,_0x3a564c){return new BPromise(function(_0xb16259,_0x5e853d){return client['request'](_0x45952f,_0x3a564c)[_0xfe0f('0x9')](function(_0x398406){logger['info'](_0xfe0f('0xa'),_0x4dd7c9,_0xfe0f('0xb'));logger[_0xfe0f('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x4dd7c9,_0xfe0f('0xb'),JSON['stringify'](_0x398406));if(_0x398406['error']){if(_0x398406[_0xfe0f('0xd')]['code']===0x1f4){logger[_0xfe0f('0xd')](_0xfe0f('0xa'),_0x4dd7c9,_0x398406[_0xfe0f('0xd')][_0xfe0f('0xe')]);return _0x5e853d(_0x398406[_0xfe0f('0xd')][_0xfe0f('0xe')]);}logger[_0xfe0f('0xd')](_0xfe0f('0xa'),_0x4dd7c9,_0x398406['error'][_0xfe0f('0xe')]);return _0xb16259(_0x398406[_0xfe0f('0xd')][_0xfe0f('0xe')]);}else{logger[_0xfe0f('0xf')](_0xfe0f('0xa'),_0x4dd7c9,_0xfe0f('0xb'));_0xb16259(_0x398406[_0xfe0f('0x10')][_0xfe0f('0xe')]);}})['catch'](function(_0x5057f8){logger[_0xfe0f('0xd')](_0xfe0f('0xa'),_0x4dd7c9,_0x5057f8);_0x5e853d(_0x5057f8);});});} \ No newline at end of file +var _0xd29b=['then','info','request\x20sent','debug','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2d30aa,_0x2e138b){var _0x121d7b=function(_0x30f887){while(--_0x30f887){_0x2d30aa['push'](_0x2d30aa['shift']());}};_0x121d7b(++_0x2e138b);}(_0xd29b,0xb1));var _0xbd29=function(_0x2272c1,_0x256869){_0x2272c1=_0x2272c1-0x0;var _0x40daa5=_0xd29b[_0x2272c1];return _0x40daa5;};'use strict';var _=require(_0xbd29('0x0'));var util=require(_0xbd29('0x1'));var moment=require(_0xbd29('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd29('0x3'));var db=require(_0xbd29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd29('0x5'))(_0xbd29('0x6'));var config=require(_0xbd29('0x7'));var jayson=require(_0xbd29('0x8'));var client=jayson[_0xbd29('0x9')][_0xbd29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a8c78,_0x31dcc9,_0x2f37f9){return new BPromise(function(_0x138293,_0x23a135){return client[_0xbd29('0xb')](_0x3a8c78,_0x2f37f9)[_0xbd29('0xc')](function(_0x16dc25){logger[_0xbd29('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x31dcc9,_0xbd29('0xe'));logger[_0xbd29('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x31dcc9,_0xbd29('0xe'),JSON[_0xbd29('0x10')](_0x16dc25));if(_0x16dc25[_0xbd29('0x11')]){if(_0x16dc25['error'][_0xbd29('0x12')]===0x1f4){logger[_0xbd29('0x11')](_0xbd29('0x13'),_0x31dcc9,_0x16dc25[_0xbd29('0x11')][_0xbd29('0x14')]);return _0x23a135(_0x16dc25['error']['message']);}logger[_0xbd29('0x11')](_0xbd29('0x13'),_0x31dcc9,_0x16dc25[_0xbd29('0x11')][_0xbd29('0x14')]);return _0x138293(_0x16dc25['error'][_0xbd29('0x14')]);}else{logger[_0xbd29('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x31dcc9,_0xbd29('0xe'));_0x138293(_0x16dc25['result'][_0xbd29('0x14')]);}})['catch'](function(_0x22624c){logger[_0xbd29('0x11')](_0xbd29('0x13'),_0x31dcc9,_0x22624c);_0x23a135(_0x22624c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 87383f1..8f31c04 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x877627,_0x28d784){var _0x590b67=function(_0x2bf37){while(--_0x2bf37){_0x877627['push'](_0x877627['shift']());}};_0x590b67(++_0x28d784);}(_0x70e0,0x17b));var _0x070e=function(_0x47789d,_0x1a2a8b){_0x47789d=_0x47789d-0x0;var _0x379fb5=_0x70e0[_0x47789d];return _0x379fb5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4d729f,_0x52bf8b){var _0x5ce12a=function(_0x3ae6a6){while(--_0x3ae6a6){_0x4d729f['push'](_0x4d729f['shift']());}};_0x5ce12a(++_0x52bf8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2f93755..0d625bc 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 _0xf80d=['STRING','sequelize','INTEGER'];(function(_0x2e1ac8,_0x4bb931){var _0x342e6a=function(_0x3cc9ac){while(--_0x3cc9ac){_0x2e1ac8['push'](_0x2e1ac8['shift']());}};_0x342e6a(++_0x4bb931);}(_0xf80d,0xe5));var _0xdf80=function(_0x108831,_0x5e4f70){_0x108831=_0x108831-0x0;var _0x4da77a=_0xf80d[_0x108831];return _0x4da77a;};'use strict';var Sequelize=require(_0xdf80('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdf80('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xdf80('0x2')]}}; \ No newline at end of file +var _0xa599=['STRING','sequelize','exports','INTEGER'];(function(_0x130d34,_0xb829c2){var _0x3bf5d2=function(_0x279065){while(--_0x279065){_0x130d34['push'](_0x130d34['shift']());}};_0x3bf5d2(++_0xb829c2);}(_0xa599,0x125));var _0x9a59=function(_0x117d59,_0x5aa145){_0x117d59=_0x117d59-0x0;var _0x5aaae8=_0xa599[_0x117d59];return _0x5aaae8;};'use strict';var Sequelize=require(_0x9a59('0x0'));module[_0x9a59('0x1')]={'penalty':{'type':Sequelize[_0x9a59('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9a59('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9a59('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index cc8d830..02eb28e 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 _0xf661=['exports','UserFaxQueue','user_has_fax_queues','moment','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x31c42e,_0x22ca44){var _0x97eab5=function(_0x1c91f4){while(--_0x1c91f4){_0x31c42e['push'](_0x31c42e['shift']());}};_0x97eab5(++_0x22ca44);}(_0xf661,0x133));var _0x1f66=function(_0x2bda56,_0x10c8ea){_0x2bda56=_0x2bda56-0x0;var _0x3c67ab=_0xf661[_0x2bda56];return _0x3c67ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1f66('0x0'));var BPromise=require('bluebird');var rp=require(_0x1f66('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f66('0x2'));var config=require(_0x1f66('0x3'));var attributes=require(_0x1f66('0x4'));module[_0x1f66('0x5')]=function(_0x1fc1f0,_0x53421d){return _0x1fc1f0['define'](_0x1f66('0x6'),attributes,{'tableName':_0x1f66('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4c4=['user_has_fax_queues','lodash','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue'];(function(_0x53d6a1,_0x3a2939){var _0xb6662a=function(_0x422784){while(--_0x422784){_0x53d6a1['push'](_0x53d6a1['shift']());}};_0xb6662a(++_0x3a2939);}(_0xf4c4,0x106));var _0x4f4c=function(_0x256684,_0x529c1e){_0x256684=_0x256684-0x0;var _0x37a0c9=_0xf4c4[_0x256684];return _0x37a0c9;};'use strict';var _=require(_0x4f4c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4f4c('0x1'));var rp=require(_0x4f4c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f4c('0x3'));var config=require(_0x4f4c('0x4'));var attributes=require(_0x4f4c('0x5'));module['exports']=function(_0x37043d,_0x2321f6){return _0x37043d[_0x4f4c('0x6')](_0x4f4c('0x7'),attributes,{'tableName':_0x4f4c('0x8'),'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 63756c5..e677364 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 _0x4397=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1e1ca7,_0x27e6c1){var _0x52b594=function(_0x5fa34f){while(--_0x5fa34f){_0x1e1ca7['push'](_0x1e1ca7['shift']());}};_0x52b594(++_0x27e6c1);}(_0x4397,0x1eb));var _0x7439=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0x4397[_0x4b4277];return _0x1ff405;};'use strict';var _=require(_0x7439('0x0'));var util=require(_0x7439('0x1'));var moment=require(_0x7439('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7439('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7439('0x4'));var logger=require(_0x7439('0x5'))('rpc');var config=require(_0x7439('0x6'));var jayson=require(_0x7439('0x7'));var client=jayson[_0x7439('0x8')][_0x7439('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x287f16,_0x110996,_0x339542){return new BPromise(function(_0x3f07d1,_0x146574){return client[_0x7439('0xa')](_0x287f16,_0x339542)[_0x7439('0xb')](function(_0x324518){logger[_0x7439('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x110996,_0x7439('0xd'));logger[_0x7439('0xe')](_0x7439('0xf'),_0x110996,_0x7439('0xd'),JSON['stringify'](_0x324518));if(_0x324518[_0x7439('0x10')]){if(_0x324518[_0x7439('0x10')][_0x7439('0x11')]===0x1f4){logger['error'](_0x7439('0x12'),_0x110996,_0x324518['error'][_0x7439('0x13')]);return _0x146574(_0x324518[_0x7439('0x10')]['message']);}logger[_0x7439('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x110996,_0x324518['error'][_0x7439('0x13')]);return _0x3f07d1(_0x324518[_0x7439('0x10')][_0x7439('0x13')]);}else{logger[_0x7439('0xc')](_0x7439('0x12'),_0x110996,_0x7439('0xd'));_0x3f07d1(_0x324518['result'][_0x7439('0x13')]);}})[_0x7439('0x14')](function(_0x1630a9){logger[_0x7439('0x10')](_0x7439('0x12'),_0x110996,_0x1630a9);_0x146574(_0x1630a9);});});} \ No newline at end of file +var _0x60a2=['message','info','catch','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x501b84,_0x2e173f){var _0x34f5b5=function(_0x499a09){while(--_0x499a09){_0x501b84['push'](_0x501b84['shift']());}};_0x34f5b5(++_0x2e173f);}(_0x60a2,0xab));var _0x260a=function(_0x4c586f,_0x800364){_0x4c586f=_0x4c586f-0x0;var _0x2698d1=_0x60a2[_0x4c586f];return _0x2698d1;};'use strict';var _=require(_0x260a('0x0'));var util=require(_0x260a('0x1'));var moment=require(_0x260a('0x2'));var BPromise=require('bluebird');var rs=require(_0x260a('0x3'));var fs=require('fs');var Redis=require(_0x260a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x260a('0x5'));var config=require(_0x260a('0x6'));var jayson=require(_0x260a('0x7'));var client=jayson[_0x260a('0x8')][_0x260a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10c4a2,_0x5afa35,_0x3cdde2){return new BPromise(function(_0xaaaa33,_0x3a9a5c){return client[_0x260a('0xa')](_0x10c4a2,_0x3cdde2)[_0x260a('0xb')](function(_0x1302b5){logger['info'](_0x260a('0xc'),_0x5afa35,_0x260a('0xd'));logger[_0x260a('0xe')](_0x260a('0xf'),_0x5afa35,'request\x20sent',JSON['stringify'](_0x1302b5));if(_0x1302b5[_0x260a('0x10')]){if(_0x1302b5['error'][_0x260a('0x11')]===0x1f4){logger['error'](_0x260a('0xc'),_0x5afa35,_0x1302b5[_0x260a('0x10')][_0x260a('0x12')]);return _0x3a9a5c(_0x1302b5[_0x260a('0x10')][_0x260a('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x5afa35,_0x1302b5['error'][_0x260a('0x12')]);return _0xaaaa33(_0x1302b5[_0x260a('0x10')][_0x260a('0x12')]);}else{logger[_0x260a('0x13')](_0x260a('0xc'),_0x5afa35,_0x260a('0xd'));_0xaaaa33(_0x1302b5['result']['message']);}})[_0x260a('0x14')](function(_0x1dbf72){logger[_0x260a('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x5afa35,_0x1dbf72);_0x3a9a5c(_0x1dbf72);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7bb3d47..5abba31 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(_0x2846dc,_0x39dc50){var _0x306003=function(_0x4cbee5){while(--_0x4cbee5){_0x2846dc['push'](_0x2846dc['shift']());}};_0x306003(++_0x39dc50);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xcb91[_0x492af5];return _0x59f529;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c40dd6b..9c08a12 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 _0xb1ae=['INTEGER','sequelize','exports'];(function(_0x8fb97c,_0x2ce4b0){var _0x122e95=function(_0x18d1c4){while(--_0x18d1c4){_0x8fb97c['push'](_0x8fb97c['shift']());}};_0x122e95(++_0x2ce4b0);}(_0xb1ae,0x193));var _0xeb1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ae[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xeb1a('0x0'));module[_0xeb1a('0x1')]={'penalty':{'type':Sequelize[_0xeb1a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc932=['exports','INTEGER','sequelize'];(function(_0x2724e5,_0x229d74){var _0x4b6621=function(_0x787046){while(--_0x787046){_0x2724e5['push'](_0x2724e5['shift']());}};_0x4b6621(++_0x229d74);}(_0xc932,0x9b));var _0x2c93=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0xc932[_0x438912];return _0x18112f;};'use strict';var Sequelize=require(_0x2c93('0x0'));module[_0x2c93('0x1')]={'penalty':{'type':Sequelize[_0x2c93('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8787e17..fc490ec 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 _0x759a=['rimraf','UserMailQueue','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3c3528,_0x2bbe98){var _0x3a0e95=function(_0x2fcd43){while(--_0x2fcd43){_0x3c3528['push'](_0x3c3528['shift']());}};_0x3a0e95(++_0x2bbe98);}(_0x759a,0x192));var _0xa759=function(_0x3aec4a,_0x5c56d7){_0x3aec4a=_0x3aec4a-0x0;var _0x5e0dee=_0x759a[_0x3aec4a];return _0x5e0dee;};'use strict';var _=require(_0xa759('0x0'));var util=require('util');var logger=require(_0xa759('0x1'))(_0xa759('0x2'));var moment=require(_0xa759('0x3'));var BPromise=require('bluebird');var rp=require(_0xa759('0x4'));var fs=require('fs');var path=require(_0xa759('0x5'));var rimraf=require(_0xa759('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3063b8,_0x43f5ff){return _0x3063b8['define'](_0xa759('0x7'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb4=['define','UserMailQueue','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0xb46ac4,_0xe20454){var _0x516516=function(_0x57fb15){while(--_0x57fb15){_0xb46ac4['push'](_0xb46ac4['shift']());}};_0x516516(++_0xe20454);}(_0xebb4,0x1e2));var _0x4ebb=function(_0x439c46,_0x9d81e0){_0x439c46=_0x439c46-0x0;var _0x29ea3d=_0xebb4[_0x439c46];return _0x29ea3d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ebb('0x0'))(_0x4ebb('0x1'));var moment=require('moment');var BPromise=require(_0x4ebb('0x2'));var rp=require(_0x4ebb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ebb('0x4'));var config=require(_0x4ebb('0x5'));var attributes=require(_0x4ebb('0x6'));module[_0x4ebb('0x7')]=function(_0x3c5d02,_0x4d8f72){return _0x3c5d02[_0x4ebb('0x8')](_0x4ebb('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 9c3900d..4237b40 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x42295b,_0xa05a47){var _0x442864=function(_0x4667aa){while(--_0x4667aa){_0x42295b['push'](_0x42295b['shift']());}};_0x442864(++_0xa05a47);}(_0x3e74,0x175));var _0x43e7=function(_0x1a0a58,_0x10a6a2){_0x1a0a58=_0x1a0a58-0x0;var _0x5e051b=_0x3e74[_0x1a0a58];return _0x5e051b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x51a8ae,_0x38af85){var _0xaf935a=function(_0xcaa199){while(--_0xcaa199){_0x51a8ae['push'](_0x51a8ae['shift']());}};_0xaf935a(++_0x38af85);}(_0xe14b,0x93));var _0xbe14=function(_0x4cd948,_0x24a7f3){_0x4cd948=_0x4cd948-0x0;var _0x46b87b=_0xe14b[_0x4cd948];return _0x46b87b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f9dd2b1..53e58c4 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 _0x0677=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0x0677,0x10e));var _0x7067=function(_0x5ca82d,_0x7d11a0){_0x5ca82d=_0x5ca82d-0x0;var _0x397661=_0x0677[_0x5ca82d];return _0x397661;};'use strict';var multer=require(_0x7067('0x0'));var util=require(_0x7067('0x1'));var path=require('path');var timeout=require(_0x7067('0x2'));var express=require(_0x7067('0x3'));var router=express[_0x7067('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7067('0x5'));var interaction=require(_0x7067('0x6'));var config=require(_0x7067('0x7'));var controller=require(_0x7067('0x8'));router[_0x7067('0x9')]('/',auth[_0x7067('0xa')](),controller[_0x7067('0xb')]);module[_0x7067('0xc')]=router; \ No newline at end of file +var _0x801b=['./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5235ba,_0x1fb51d){var _0x1f7aa9=function(_0x4853ab){while(--_0x4853ab){_0x5235ba['push'](_0x5235ba['shift']());}};_0x1f7aa9(++_0x1fb51d);}(_0x801b,0x124));var _0xb801=function(_0x37222f,_0x25a5ab){_0x37222f=_0x37222f-0x0;var _0x5c5a6d=_0x801b[_0x37222f];return _0x5c5a6d;};'use strict';var multer=require(_0xb801('0x0'));var util=require(_0xb801('0x1'));var path=require(_0xb801('0x2'));var timeout=require(_0xb801('0x3'));var express=require('express');var router=express[_0xb801('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb801('0x5'));var interaction=require(_0xb801('0x6'));var config=require(_0xb801('0x7'));var controller=require(_0xb801('0x8'));router[_0xb801('0x9')]('/',auth[_0xb801('0xa')](),controller[_0xb801('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0420369..d1bf13c 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 _0xada7=['exports','TEXT','STRING','BOOLEAN'];(function(_0x458e31,_0x521f92){var _0x58b5ff=function(_0x41d819){while(--_0x41d819){_0x458e31['push'](_0x458e31['shift']());}};_0x58b5ff(++_0x521f92);}(_0xada7,0x17c));var _0x7ada=function(_0x4ad5f4,_0x68013e){_0x4ad5f4=_0x4ad5f4-0x0;var _0x4946b9=_0xada7[_0x4ad5f4];return _0x4946b9;};'use strict';var Sequelize=require('sequelize');module[_0x7ada('0x0')]={'body':{'type':Sequelize[_0x7ada('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x7ada('0x1')]},'recipientsDescription':{'type':Sequelize[_0x7ada('0x2')]},'beep':{'type':Sequelize[_0x7ada('0x3')]}}; \ No newline at end of file +var _0x1849=['STRING','BOOLEAN','exports','TEXT'];(function(_0x1e691f,_0x215f5f){var _0x5b37cb=function(_0x1ffe30){while(--_0x1ffe30){_0x1e691f['push'](_0x1e691f['shift']());}};_0x5b37cb(++_0x215f5f);}(_0x1849,0x1ba));var _0x9184=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1849[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0x9184('0x0')]={'body':{'type':Sequelize[_0x9184('0x1')]},'senderName':{'type':Sequelize[_0x9184('0x2')]},'recipientsId':{'type':Sequelize[_0x9184('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x9184('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 529249d..4d558ae 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 _0x9ed2=['defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','sendUserNotification','body','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','create','emit','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','User','union','ids','queue','Queue','push','all','flatten','getAgents','map','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x9ed2,0x171));var _0x29ed=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9ed2[_0x4fde08];return _0x12e725;};'use strict';var emlformat=require(_0x29ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x29ed('0x2'));var BPromise=require(_0x29ed('0x3'));var Mustache=require('mustache');var util=require(_0x29ed('0x4'));var path=require(_0x29ed('0x5'));var sox=require('sox');var csv=require(_0x29ed('0x6'));var ejs=require(_0x29ed('0x7'));var fs=require('fs');var fs_extra=require(_0x29ed('0x8'));var _=require(_0x29ed('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29ed('0xa'));var toCsv=require(_0x29ed('0x6'));var querystring=require(_0x29ed('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x29ed('0xc'));var qs=require(_0x29ed('0xd'));var as=require(_0x29ed('0xe'));var hardwareService=require(_0x29ed('0xf'));var logger=require(_0x29ed('0x10'))(_0x29ed('0x11'));var utils=require('../../config/utils');var config=require(_0x29ed('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x29ed('0x13')](config['redis'],{'host':_0x29ed('0x14'),'port':0x18eb});var socket=require(_0x29ed('0x15'))(new Redis(config[_0x29ed('0x16')]));require(_0x29ed('0x17'))[_0x29ed('0x18')](socket);function respondWithStatusCode(_0x4caf4f,_0x373855){_0x373855=_0x373855||0xcc;return function(_0xc295d3){if(_0xc295d3){return _0x4caf4f[_0x29ed('0x19')](_0x373855);}return _0x4caf4f['status'](_0x373855)[_0x29ed('0x1a')]();};}function respondWithResult(_0x36a736,_0x11e11c){_0x11e11c=_0x11e11c||0xc8;return function(_0x598cca){if(_0x598cca){return _0x36a736['status'](_0x11e11c)['json'](_0x598cca);}};}function respondWithFilteredResult(_0x5b8016,_0x4323f1){return function(_0x712980){if(_0x712980){var _0xbb47c5=typeof _0x4323f1[_0x29ed('0x1b')]==='undefined'&&typeof _0x4323f1[_0x29ed('0x1c')]===_0x29ed('0x1d');var _0x54d398=_0x712980['count'];var _0x2d1d5a=_0xbb47c5?0x0:_0x4323f1[_0x29ed('0x1b')];var _0x57ee17=_0xbb47c5?_0x712980[_0x29ed('0x1e')]:_0x4323f1[_0x29ed('0x1b')]+_0x4323f1['limit'];var _0x2ac959;if(_0x57ee17>=_0x54d398){_0x57ee17=_0x54d398;_0x2ac959=0xc8;}else{_0x2ac959=0xce;}_0x5b8016[_0x29ed('0x1f')](_0x2ac959);return _0x5b8016[_0x29ed('0x20')](_0x29ed('0x21'),_0x2d1d5a+'-'+_0x57ee17+'/'+_0x54d398)[_0x29ed('0x22')](_0x712980);}return null;};}function patchUpdates(_0x5923fd){return function(_0x100e99){try{jsonpatch[_0x29ed('0x23')](_0x100e99,_0x5923fd,!![]);}catch(_0x3a518a){return BPromise[_0x29ed('0x24')](_0x3a518a);}return _0x100e99[_0x29ed('0x25')]();};}function saveUpdates(_0xf8e625,_0x4285c0){return function(_0x440ff2){if(_0x440ff2){return _0x440ff2[_0x29ed('0x26')](_0xf8e625)[_0x29ed('0x27')](function(_0x35254a){return _0x35254a;});}return null;};}function removeEntity(_0x16a7d6,_0x2b26dc){return function(_0x283ca9){if(_0x283ca9){return _0x283ca9[_0x29ed('0x28')]()[_0x29ed('0x27')](function(){_0x16a7d6[_0x29ed('0x1f')](0xcc)[_0x29ed('0x1a')]();});}};}function handleEntityNotFound(_0x2be4f4,_0x187c7e){return function(_0x44375a){if(!_0x44375a){_0x2be4f4[_0x29ed('0x19')](0x194);}return _0x44375a;};}function handleError(_0x10dbc1,_0x4c83a5){_0x4c83a5=_0x4c83a5||0x1f4;return function(_0xea2625){logger[_0x29ed('0x29')](_0xea2625['stack']);if(_0xea2625[_0x29ed('0x2a')]){delete _0xea2625['name'];}_0x10dbc1[_0x29ed('0x1f')](_0x4c83a5)['send'](_0xea2625);};}exports[_0x29ed('0x2b')]=function(_0x15c678,_0x46e9b6,_0x1f9f09){if(!_0x15c678[_0x29ed('0x2c')]['hasOwnProperty']('text')&&!_0x15c678[_0x29ed('0x2c')]['hasOwnProperty'](_0x29ed('0x2d'))){throw new db[(_0x29ed('0x2e'))]['ValidationError'](_0x29ed('0x2f'));}else{if(_0x15c678['body'][_0x29ed('0x30')](_0x29ed('0x2d'))&&!_0x15c678[_0x29ed('0x2c')][_0x29ed('0x30')](_0x29ed('0x31'))){throw new db[(_0x29ed('0x2e'))][(_0x29ed('0x32'))](_0x29ed('0x33'));}if(!_0x15c678[_0x29ed('0x2c')][_0x29ed('0x30')](_0x29ed('0x34'))){throw new db['Sequelize'][(_0x29ed('0x32'))](_0x29ed('0x35'));}else{try{var _0x4240bb=JSON['parse'](_0x15c678['body'][_0x29ed('0x34')]);}catch(_0x245032){logger[_0x29ed('0x29')](_0x245032);throw new db[(_0x29ed('0x2e'))][(_0x29ed('0x32'))](_0x29ed('0x36'));}var _0x2b1878=[_0x29ed('0x37'),_0x29ed('0x38'),'mailqueue',_0x29ed('0x39'),_0x29ed('0x3a'),_0x29ed('0x3b'),_0x29ed('0x3c'),_0x29ed('0x3d'),_0x29ed('0x3e')];if(_[_0x29ed('0x3f')](_0x4240bb,function(_0xe3f029){return!_[_0x29ed('0x40')](_0x2b1878,_0xe3f029[_0x29ed('0x41')][_0x29ed('0x42')]());})){throw new db[(_0x29ed('0x2e'))][(_0x29ed('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x46a6a7={};_0x46a6a7[_0x29ed('0x43')]=_0x15c678['body']['hasOwnProperty'](_0x29ed('0x43'))?_0x15c678[_0x29ed('0x2c')]['senderName']:_0x15c678[_0x29ed('0x3e')][_0x29ed('0x44')];_0x46a6a7[_0x29ed('0x45')]=_[_0x29ed('0x46')](_0x15c678[_0x29ed('0x2c')]['recipientsDescription'])?null:_0x15c678[_0x29ed('0x2c')]['recipientsDescription'];_0x46a6a7[_0x29ed('0x47')]=_0x15c678[_0x29ed('0x2c')][_0x29ed('0x47')]||![];_0x46a6a7['SenderId']=_0x15c678['user']['id'];return getContent(_0x15c678[_0x29ed('0x2c')])[_0x29ed('0x27')](function(_0x2c795d){_0x46a6a7[_0x29ed('0x2c')]=_0x2c795d;return getRecipients(_0x4240bb);})[_0x29ed('0x27')](function(_0x46000e){_0x46a6a7[_0x29ed('0x48')]=_[_0x29ed('0x49')](_0x46000e)[_0x29ed('0x4a')](',');return db[_0x29ed('0x4b')][_0x29ed('0x4c')](function(_0x45132b){return db['UserNotification'][_0x29ed('0x4d')](_0x46a6a7,{'raw':!![],'transaction':_0x45132b})['then'](function(_0x3bee2e){var _0x2f6ba4={'sender':_0x46a6a7[_0x29ed('0x43')],'description':_0x46a6a7[_0x29ed('0x45')],'content':_0x46a6a7['body'],'beep':_0x46a6a7[_0x29ed('0x47')]};_0x46000e['forEach'](function(_0x33e3fa){_0x2f6ba4['recipient']=_0x33e3fa;socket[_0x29ed('0x4e')]('userNotification:send',_0x2f6ba4);});return _0x3bee2e;});});})[_0x29ed('0x27')](respondWithResult(_0x46e9b6,0xc9))[_0x29ed('0x4f')](handleError(_0x46e9b6,null));};function getContent(_0x13362d){return new BPromise(function(_0x880534,_0x384afa){if(_0x13362d['text']){_0x880534(_0x13362d[_0x29ed('0x50')]);return;}return db[_0x29ed('0x51')][_0x29ed('0x52')]({'attributes':[_0x29ed('0x53')],'where':{'id':_0x13362d[_0x29ed('0x2d')]},'raw':!![]})[_0x29ed('0x27')](function(_0x17a468){if(!_0x17a468)throw new db[(_0x29ed('0x2e'))][(_0x29ed('0x32'))](_0x29ed('0x54'));var _0x56f6a5=Mustache['render'](_0x17a468[_0x29ed('0x53')],_0x13362d[_0x29ed('0x31')]);_0x880534(_0x56f6a5);})[_0x29ed('0x4f')](function(_0x5ed855){_0x384afa(_0x5ed855);});});}function getRecipients(_0xb295aa){return new BPromise(function(_0x2e8464,_0x54aa45){var _0x58f20b=[];var _0x496362=[];_0xb295aa[_0x29ed('0x55')](function(_0x43b7d1){var _0x2c505e=_[_0x29ed('0x56')](_0x43b7d1['model'][_0x29ed('0x42')]());if(_0x2c505e===_0x29ed('0x57')){_0x58f20b=_[_0x29ed('0x58')](_0x58f20b,_0x43b7d1[_0x29ed('0x59')]);}else{if(_['includes'](_0x2c505e,_0x29ed('0x5a')))_0x2c505e=_0x2c505e['replace'](_0x29ed('0x5a'),_0x29ed('0x5b'));_0x43b7d1[_0x29ed('0x59')][_0x29ed('0x55')](function(_0xb1f5fd){_0x496362[_0x29ed('0x5c')](getAgents(_0x2c505e,_0xb1f5fd));});}});return BPromise[_0x29ed('0x5d')](_0x496362)[_0x29ed('0x27')](function(_0x519ba3){_0x58f20b=_['union'](_0x58f20b,_[_0x29ed('0x5e')](_0x519ba3));_0x2e8464(_0x58f20b);})[_0x29ed('0x4f')](function(_0x5df0b3){_0x54aa45(_0x5df0b3);});});}function getAgents(_0xc7ec99,_0x353c7c){return new BPromise(function(_0x5659d8,_0x1fcfa2){return db[_0xc7ec99]['findOne']({'where':{'id':_0x353c7c}})[_0x29ed('0x27')](function(_0x5220d4){return _0x5220d4[_0x29ed('0x5f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x548ad2){var _0x225c02=_[_0x29ed('0x60')](_0x548ad2,'id');_0x5659d8(_0x225c02);});})[_0x29ed('0x4f')](function(_0x67b4ef){_0x1fcfa2(_0x67b4ef);});});} \ No newline at end of file +var _0x1b6b=['Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','catch','startCase','User','union','ids','includes','replace','Queue','push','all','getAgents','map','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','text'];(function(_0x9a803a,_0x9a79fc){var _0x1bd637=function(_0x27a1b9){while(--_0x27a1b9){_0x9a803a['push'](_0x9a803a['shift']());}};_0x1bd637(++_0x9a79fc);}(_0x1b6b,0x7b));var _0xb1b6=function(_0x2317f5,_0x40dbbc){_0x2317f5=_0x2317f5-0x0;var _0x3d1632=_0x1b6b[_0x2317f5];return _0x3d1632;};'use strict';var emlformat=require(_0xb1b6('0x0'));var rimraf=require(_0xb1b6('0x1'));var zipdir=require(_0xb1b6('0x2'));var jsonpatch=require(_0xb1b6('0x3'));var rp=require(_0xb1b6('0x4'));var moment=require(_0xb1b6('0x5'));var BPromise=require(_0xb1b6('0x6'));var Mustache=require(_0xb1b6('0x7'));var util=require(_0xb1b6('0x8'));var path=require(_0xb1b6('0x9'));var sox=require(_0xb1b6('0xa'));var csv=require(_0xb1b6('0xb'));var ejs=require(_0xb1b6('0xc'));var fs=require('fs');var fs_extra=require(_0xb1b6('0xd'));var _=require(_0xb1b6('0xe'));var squel=require(_0xb1b6('0xf'));var crypto=require(_0xb1b6('0x10'));var jsforce=require(_0xb1b6('0x11'));var deskjs=require(_0xb1b6('0x12'));var toCsv=require(_0xb1b6('0xb'));var querystring=require(_0xb1b6('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1b6('0x14'));var qs=require(_0xb1b6('0x15'));var as=require(_0xb1b6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1b6('0x17'))(_0xb1b6('0x18'));var utils=require(_0xb1b6('0x19'));var config=require(_0xb1b6('0x1a'));var licenseUtil=require(_0xb1b6('0x1b'));var db=require(_0xb1b6('0x1c'))['db'];config[_0xb1b6('0x1d')]=_['defaults'](config[_0xb1b6('0x1d')],{'host':_0xb1b6('0x1e'),'port':0x18eb});var socket=require(_0xb1b6('0x1f'))(new Redis(config[_0xb1b6('0x1d')]));require('./userNotification.socket')[_0xb1b6('0x20')](socket);function respondWithStatusCode(_0x10ae7d,_0x34b2ae){_0x34b2ae=_0x34b2ae||0xcc;return function(_0xb006b7){if(_0xb006b7){return _0x10ae7d[_0xb1b6('0x21')](_0x34b2ae);}return _0x10ae7d[_0xb1b6('0x22')](_0x34b2ae)[_0xb1b6('0x23')]();};}function respondWithResult(_0xb388af,_0x5668a5){_0x5668a5=_0x5668a5||0xc8;return function(_0x23a672){if(_0x23a672){return _0xb388af[_0xb1b6('0x22')](_0x5668a5)[_0xb1b6('0x24')](_0x23a672);}};}function respondWithFilteredResult(_0xdb3b36,_0x2f7bbb){return function(_0x4fd01c){if(_0x4fd01c){var _0x48f96f=typeof _0x2f7bbb[_0xb1b6('0x25')]===_0xb1b6('0x26')&&typeof _0x2f7bbb['limit']===_0xb1b6('0x26');var _0x3c265a=_0x4fd01c[_0xb1b6('0x27')];var _0x5e2a2d=_0x48f96f?0x0:_0x2f7bbb[_0xb1b6('0x25')];var _0xece084=_0x48f96f?_0x4fd01c['count']:_0x2f7bbb['offset']+_0x2f7bbb[_0xb1b6('0x28')];var _0x21d6cc;if(_0xece084>=_0x3c265a){_0xece084=_0x3c265a;_0x21d6cc=0xc8;}else{_0x21d6cc=0xce;}_0xdb3b36['status'](_0x21d6cc);return _0xdb3b36[_0xb1b6('0x29')](_0xb1b6('0x2a'),_0x5e2a2d+'-'+_0xece084+'/'+_0x3c265a)[_0xb1b6('0x24')](_0x4fd01c);}return null;};}function patchUpdates(_0x4fc892){return function(_0x1f053e){try{jsonpatch['apply'](_0x1f053e,_0x4fc892,!![]);}catch(_0x5bbc1e){return BPromise[_0xb1b6('0x2b')](_0x5bbc1e);}return _0x1f053e[_0xb1b6('0x2c')]();};}function saveUpdates(_0x3caf61,_0x13001c){return function(_0x291b37){if(_0x291b37){return _0x291b37[_0xb1b6('0x2d')](_0x3caf61)['then'](function(_0x2c620c){return _0x2c620c;});}return null;};}function removeEntity(_0x4232cb,_0x483e9e){return function(_0x5b15d5){if(_0x5b15d5){return _0x5b15d5[_0xb1b6('0x2e')]()[_0xb1b6('0x2f')](function(){_0x4232cb[_0xb1b6('0x22')](0xcc)[_0xb1b6('0x23')]();});}};}function handleEntityNotFound(_0x9d90f5,_0x4301d8){return function(_0x5b0bbb){if(!_0x5b0bbb){_0x9d90f5['sendStatus'](0x194);}return _0x5b0bbb;};}function handleError(_0x2980e2,_0x48eefc){_0x48eefc=_0x48eefc||0x1f4;return function(_0x478e7a){logger['error'](_0x478e7a[_0xb1b6('0x30')]);if(_0x478e7a[_0xb1b6('0x31')]){delete _0x478e7a[_0xb1b6('0x31')];}_0x2980e2[_0xb1b6('0x22')](_0x48eefc)[_0xb1b6('0x32')](_0x478e7a);};}exports[_0xb1b6('0x33')]=function(_0x4785dc,_0x1ac79b,_0xbf38f1){if(!_0x4785dc[_0xb1b6('0x34')][_0xb1b6('0x35')]('text')&&!_0x4785dc[_0xb1b6('0x34')][_0xb1b6('0x35')](_0xb1b6('0x36'))){throw new db[(_0xb1b6('0x37'))]['ValidationError'](_0xb1b6('0x38'));}else{if(_0x4785dc[_0xb1b6('0x34')][_0xb1b6('0x35')](_0xb1b6('0x36'))&&!_0x4785dc[_0xb1b6('0x34')]['hasOwnProperty'](_0xb1b6('0x39'))){throw new db[(_0xb1b6('0x37'))][(_0xb1b6('0x3a'))](_0xb1b6('0x3b'));}if(!_0x4785dc[_0xb1b6('0x34')][_0xb1b6('0x35')](_0xb1b6('0x3c'))){throw new db[(_0xb1b6('0x37'))][(_0xb1b6('0x3a'))](_0xb1b6('0x3d'));}else{try{var _0x460ea5=JSON[_0xb1b6('0x3e')](_0x4785dc[_0xb1b6('0x34')][_0xb1b6('0x3c')]);}catch(_0x424c10){logger[_0xb1b6('0x3f')](_0x424c10);throw new db[(_0xb1b6('0x37'))][(_0xb1b6('0x3a'))](_0xb1b6('0x40'));}var _0x8b870f=['chatqueue',_0xb1b6('0x41'),_0xb1b6('0x42'),_0xb1b6('0x43'),_0xb1b6('0x44'),_0xb1b6('0x45'),'whatsappqueue',_0xb1b6('0x46'),'user'];if(_[_0xb1b6('0x47')](_0x460ea5,function(_0x4b3e4a){return!_['includes'](_0x8b870f,_0x4b3e4a[_0xb1b6('0x48')][_0xb1b6('0x49')]());})){throw new db['Sequelize'][(_0xb1b6('0x3a'))](_0xb1b6('0x4a'));}}}var _0x502d1d={};_0x502d1d[_0xb1b6('0x4b')]=_0x4785dc[_0xb1b6('0x34')]['hasOwnProperty'](_0xb1b6('0x4b'))?_0x4785dc[_0xb1b6('0x34')]['senderName']:_0x4785dc[_0xb1b6('0x4c')]['fullname'];_0x502d1d[_0xb1b6('0x4d')]=_[_0xb1b6('0x4e')](_0x4785dc[_0xb1b6('0x34')][_0xb1b6('0x4d')])?null:_0x4785dc[_0xb1b6('0x34')][_0xb1b6('0x4d')];_0x502d1d[_0xb1b6('0x4f')]=_0x4785dc['body'][_0xb1b6('0x4f')]||![];_0x502d1d[_0xb1b6('0x50')]=_0x4785dc['user']['id'];return getContent(_0x4785dc[_0xb1b6('0x34')])[_0xb1b6('0x2f')](function(_0x159e11){_0x502d1d[_0xb1b6('0x34')]=_0x159e11;return getRecipients(_0x460ea5);})[_0xb1b6('0x2f')](function(_0x751d68){_0x502d1d['recipientsId']=_[_0xb1b6('0x51')](_0x751d68)[_0xb1b6('0x52')](',');return db['sequelize'][_0xb1b6('0x53')](function(_0x1446dd){return db[_0xb1b6('0x54')][_0xb1b6('0x55')](_0x502d1d,{'raw':!![],'transaction':_0x1446dd})['then'](function(_0x8fcb29){var _0x3df2e3={'sender':_0x502d1d[_0xb1b6('0x4b')],'description':_0x502d1d[_0xb1b6('0x4d')],'content':_0x502d1d['body'],'beep':_0x502d1d[_0xb1b6('0x4f')]};_0x751d68[_0xb1b6('0x56')](function(_0x423ab7){_0x3df2e3[_0xb1b6('0x57')]=_0x423ab7;socket[_0xb1b6('0x58')](_0xb1b6('0x59'),_0x3df2e3);});return _0x8fcb29;});});})[_0xb1b6('0x2f')](respondWithResult(_0x1ac79b,0xc9))['catch'](handleError(_0x1ac79b,null));};function getContent(_0x34b9a5){return new BPromise(function(_0x4fd9f7,_0x2e923f){if(_0x34b9a5[_0xb1b6('0x5a')]){_0x4fd9f7(_0x34b9a5[_0xb1b6('0x5a')]);return;}return db[_0xb1b6('0x5b')][_0xb1b6('0x5c')]({'attributes':['html'],'where':{'id':_0x34b9a5[_0xb1b6('0x36')]},'raw':!![]})[_0xb1b6('0x2f')](function(_0x240dc5){if(!_0x240dc5)throw new db['Sequelize'][(_0xb1b6('0x3a'))](_0xb1b6('0x5d'));var _0x340fb5=Mustache['render'](_0x240dc5[_0xb1b6('0x5e')],_0x34b9a5[_0xb1b6('0x39')]);_0x4fd9f7(_0x340fb5);})[_0xb1b6('0x5f')](function(_0x14ebba){_0x2e923f(_0x14ebba);});});}function getRecipients(_0x1c7acd){return new BPromise(function(_0x51a200,_0x1311af){var _0x41171b=[];var _0x2d184c=[];_0x1c7acd['forEach'](function(_0x1d8e81){var _0x857c7b=_[_0xb1b6('0x60')](_0x1d8e81[_0xb1b6('0x48')][_0xb1b6('0x49')]());if(_0x857c7b===_0xb1b6('0x61')){_0x41171b=_[_0xb1b6('0x62')](_0x41171b,_0x1d8e81[_0xb1b6('0x63')]);}else{if(_[_0xb1b6('0x64')](_0x857c7b,'queue'))_0x857c7b=_0x857c7b[_0xb1b6('0x65')]('queue',_0xb1b6('0x66'));_0x1d8e81[_0xb1b6('0x63')]['forEach'](function(_0x1acec5){_0x2d184c[_0xb1b6('0x67')](getAgents(_0x857c7b,_0x1acec5));});}});return BPromise[_0xb1b6('0x68')](_0x2d184c)[_0xb1b6('0x2f')](function(_0x3c963e){_0x41171b=_[_0xb1b6('0x62')](_0x41171b,_['flatten'](_0x3c963e));_0x51a200(_0x41171b);})[_0xb1b6('0x5f')](function(_0xb94125){_0x1311af(_0xb94125);});});}function getAgents(_0x2aa90c,_0x1437c2){return new BPromise(function(_0x1bab64,_0x57a48b){return db[_0x2aa90c][_0xb1b6('0x5c')]({'where':{'id':_0x1437c2}})['then'](function(_0x1e2e92){return _0x1e2e92[_0xb1b6('0x69')]({'attributes':['id'],'raw':!![]})[_0xb1b6('0x2f')](function(_0x319541){var _0x3dea28=_[_0xb1b6('0x6a')](_0x319541,'id');_0x1bab64(_0x3dea28);});})[_0xb1b6('0x5f')](function(_0x5a09bf){_0x57a48b(_0x5a09bf);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index d1073fa..843d31c 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 _0x554e=['UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x5c8889,_0x18719d){var _0x5cd35e=function(_0x44fae4){while(--_0x44fae4){_0x5c8889['push'](_0x5c8889['shift']());}};_0x5cd35e(++_0x18719d);}(_0x554e,0x1e7));var _0xe554=function(_0x276de9,_0x2c2f75){_0x276de9=_0x276de9-0x0;var _0xbac321=_0x554e[_0x276de9];return _0xbac321;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xe554('0x0'))['db'][_0xe554('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xe554('0x2')](0x0);var events={'afterCreate':_0xe554('0x3'),'afterUpdate':_0xe554('0x4'),'afterDestroy':_0xe554('0x5')};function emitEvent(_0x238cbc){return function(_0xf385dd,_0x58da53,_0x3b2289){UserNotificationEvents[_0xe554('0x6')](_0x238cbc+':'+_0xf385dd['id'],_0xf385dd);UserNotificationEvents['emit'](_0x238cbc,_0xf385dd);_0x3b2289(null);};}for(var e in events){if(events[_0xe554('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x94bc=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification'];(function(_0xbc28a1,_0x98e284){var _0x52c9d6=function(_0x3361e4){while(--_0x3361e4){_0xbc28a1['push'](_0xbc28a1['shift']());}};_0x52c9d6(++_0x98e284);}(_0x94bc,0x115));var _0xc94b=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x94bc[_0x2442b9];return _0x31b571;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xc94b('0x0'))['db'][_0xc94b('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc94b('0x2')](0x0);var events={'afterCreate':_0xc94b('0x3'),'afterUpdate':_0xc94b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x87df09){return function(_0x31e9d7,_0x258d94,_0x3156a7){UserNotificationEvents[_0xc94b('0x5')](_0x87df09+':'+_0x31e9d7['id'],_0x31e9d7);UserNotificationEvents['emit'](_0x87df09,_0x31e9d7);_0x3156a7(null);};}for(var e in events){if(events[_0xc94b('0x6')](e)){var event=events[e];UserNotification[_0xc94b('0x7')](e,emitEvent(event));}}module[_0xc94b('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 5a6efce..d0381c3 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 _0x3006=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','path','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x5ca99b,_0x20f4c3){var _0x58b8d1=function(_0x48518d){while(--_0x48518d){_0x5ca99b['push'](_0x5ca99b['shift']());}};_0x58b8d1(++_0x20f4c3);}(_0x3006,0x100));var _0x6300=function(_0x1630d1,_0xf54b82){_0x1630d1=_0x1630d1-0x0;var _0x183c01=_0x3006[_0x1630d1];return _0x183c01;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6300('0x0'))('api');var moment=require(_0x6300('0x1'));var BPromise=require('bluebird');var rp=require(_0x6300('0x2'));var fs=require('fs');var path=require(_0x6300('0x3'));var rimraf=require('rimraf');var config=require(_0x6300('0x4'));var attributes=require(_0x6300('0x5'));module[_0x6300('0x6')]=function(_0x156cb8,_0xe2212f){return _0x156cb8[_0x6300('0x7')](_0x6300('0x8'),attributes,{'tableName':_0x6300('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6300('0xa'),'collate':_0x6300('0xb')});}; \ No newline at end of file +var _0xccc3=['bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xccc3,0x128));var _0x3ccc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xccc3[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3ccc('0x0'));var util=require(_0x3ccc('0x1'));var logger=require(_0x3ccc('0x2'))(_0x3ccc('0x3'));var moment=require('moment');var BPromise=require(_0x3ccc('0x4'));var rp=require(_0x3ccc('0x5'));var fs=require('fs');var path=require(_0x3ccc('0x6'));var rimraf=require(_0x3ccc('0x7'));var config=require(_0x3ccc('0x8'));var attributes=require(_0x3ccc('0x9'));module[_0x3ccc('0xa')]=function(_0x3751a9,_0x287dc4){return _0x3751a9[_0x3ccc('0xb')](_0x3ccc('0xc'),attributes,{'tableName':_0x3ccc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3ccc('0xe'),'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 6fd9690..a4852a9 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 _0x3563=['debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x545731,_0x1b9f4e){var _0x2e3b57=function(_0x21c10d){while(--_0x21c10d){_0x545731['push'](_0x545731['shift']());}};_0x2e3b57(++_0x1b9f4e);}(_0x3563,0x149));var _0x3356=function(_0x34d4b,_0x21a5e7){_0x34d4b=_0x34d4b-0x0;var _0x183424=_0x3563[_0x34d4b];return _0x183424;};'use strict';var _=require('lodash');var util=require(_0x3356('0x0'));var moment=require(_0x3356('0x1'));var BPromise=require(_0x3356('0x2'));var rs=require(_0x3356('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3356('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3356('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3356('0x6'));var client=jayson[_0x3356('0x7')]['http']({'port':0x232a});config[_0x3356('0x8')]=_[_0x3356('0x9')](config[_0x3356('0x8')],{'host':_0x3356('0xa'),'port':0x18eb});var socket=require(_0x3356('0xb'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x1933ad,_0xac6fa4,_0x4702c7){return new BPromise(function(_0x34e675,_0x3abec0){return client[_0x3356('0xc')](_0x1933ad,_0x4702c7)[_0x3356('0xd')](function(_0x5dffbf){logger['info'](_0x3356('0xe'),_0xac6fa4,_0x3356('0xf'));logger[_0x3356('0x10')](_0x3356('0x11'),_0xac6fa4,_0x3356('0xf'),JSON[_0x3356('0x12')](_0x5dffbf));if(_0x5dffbf[_0x3356('0x13')]){if(_0x5dffbf['error'][_0x3356('0x14')]===0x1f4){logger['error'](_0x3356('0xe'),_0xac6fa4,_0x5dffbf[_0x3356('0x13')][_0x3356('0x15')]);return _0x3abec0(_0x5dffbf[_0x3356('0x13')][_0x3356('0x15')]);}logger[_0x3356('0x13')](_0x3356('0xe'),_0xac6fa4,_0x5dffbf['error'][_0x3356('0x15')]);return _0x34e675(_0x5dffbf[_0x3356('0x13')]['message']);}else{logger[_0x3356('0x16')](_0x3356('0xe'),_0xac6fa4,_0x3356('0xf'));_0x34e675(_0x5dffbf['result'][_0x3356('0x15')]);}})['catch'](function(_0x31ad7a){logger[_0x3356('0x13')](_0x3356('0xe'),_0xac6fa4,_0x31ad7a);_0x3abec0(_0x31ad7a);});});} \ No newline at end of file +var _0x78f0=['code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5c9f56,_0x42c9ad){var _0x2a726b=function(_0x4a13cd){while(--_0x4a13cd){_0x5c9f56['push'](_0x5c9f56['shift']());}};_0x2a726b(++_0x42c9ad);}(_0x78f0,0xbb));var _0x078f=function(_0xadff39,_0x47725f){_0xadff39=_0xadff39-0x0;var _0x4213fa=_0x78f0[_0xadff39];return _0x4213fa;};'use strict';var _=require(_0x078f('0x0'));var util=require(_0x078f('0x1'));var moment=require('moment');var BPromise=require(_0x078f('0x2'));var rs=require(_0x078f('0x3'));var fs=require('fs');var Redis=require(_0x078f('0x4'));var db=require(_0x078f('0x5'))['db'];var utils=require(_0x078f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x078f('0x7'));var jayson=require(_0x078f('0x8'));var client=jayson[_0x078f('0x9')][_0x078f('0xa')]({'port':0x232a});config['redis']=_[_0x078f('0xb')](config[_0x078f('0xc')],{'host':_0x078f('0xd'),'port':0x18eb});var socket=require(_0x078f('0xe'))(new Redis(config['redis']));require('./userNotification.socket')[_0x078f('0xf')](socket);function respondWithRpcPromise(_0x38ba87,_0x158149,_0x18176f){return new BPromise(function(_0x1daa26,_0x3f5afb){return client['request'](_0x38ba87,_0x18176f)[_0x078f('0x10')](function(_0x2d85ac){logger[_0x078f('0x11')]('UserNotification,\x20%s,\x20%s',_0x158149,'request\x20sent');logger['debug'](_0x078f('0x12'),_0x158149,_0x078f('0x13'),JSON['stringify'](_0x2d85ac));if(_0x2d85ac[_0x078f('0x14')]){if(_0x2d85ac['error'][_0x078f('0x15')]===0x1f4){logger[_0x078f('0x14')](_0x078f('0x16'),_0x158149,_0x2d85ac[_0x078f('0x14')][_0x078f('0x17')]);return _0x3f5afb(_0x2d85ac[_0x078f('0x14')][_0x078f('0x17')]);}logger['error'](_0x078f('0x16'),_0x158149,_0x2d85ac['error'][_0x078f('0x17')]);return _0x1daa26(_0x2d85ac[_0x078f('0x14')][_0x078f('0x17')]);}else{logger[_0x078f('0x11')](_0x078f('0x16'),_0x158149,_0x078f('0x13'));_0x1daa26(_0x2d85ac[_0x078f('0x18')][_0x078f('0x17')]);}})[_0x078f('0x19')](function(_0x10a44e){logger[_0x078f('0x14')](_0x078f('0x16'),_0x158149,_0x10a44e);_0x3f5afb(_0x10a44e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3c138bd..2a15b8d 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 _0xcfe0=['removeListener','register','userNotification:','./userNotification.events','update'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xcfe0,0xe9));var _0x0cfe=function(_0x170f2e,_0x2aeb29){_0x170f2e=_0x170f2e-0x0;var _0x37c82e=_0xcfe0[_0x170f2e];return _0x37c82e;};'use strict';var UserNotificationEvents=require(_0x0cfe('0x0'));var events=['save','remove',_0x0cfe('0x1')];function createListener(_0x1a1032,_0x1673c8){return function(_0x41836b){_0x1673c8['emit'](_0x1a1032,_0x41836b);};}function removeListener(_0x274ae8,_0x5ec630){return function(){UserNotificationEvents[_0x0cfe('0x2')](_0x274ae8,_0x5ec630);};}exports[_0x0cfe('0x3')]=function(_0x28b71b){for(var _0x578777=0x0,_0x4d7605=events['length'];_0x578777<_0x4d7605;_0x578777++){var _0x60405a=events[_0x578777];var _0x3cc430=createListener(_0x0cfe('0x4')+_0x60405a,_0x28b71b);UserNotificationEvents['on'](_0x60405a,_0x3cc430);}}; \ No newline at end of file +var _0xb09f=['register','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x5ccc7e,_0x2c1359){var _0xc4acae=function(_0x2e8f13){while(--_0x2e8f13){_0x5ccc7e['push'](_0x5ccc7e['shift']());}};_0xc4acae(++_0x2c1359);}(_0xb09f,0xa2));var _0xfb09=function(_0x342065,_0x1891ee){_0x342065=_0x342065-0x0;var _0x43a2f3=_0xb09f[_0x342065];return _0x43a2f3;};'use strict';var UserNotificationEvents=require(_0xfb09('0x0'));var events=[_0xfb09('0x1'),_0xfb09('0x2'),_0xfb09('0x3')];function createListener(_0x1f936b,_0x336299){return function(_0x393103){_0x336299[_0xfb09('0x4')](_0x1f936b,_0x393103);};}function removeListener(_0x575182,_0x318b7e){return function(){UserNotificationEvents[_0xfb09('0x5')](_0x575182,_0x318b7e);};}exports[_0xfb09('0x6')]=function(_0x1291b8){for(var _0x303154=0x0,_0x21cb04=events['length'];_0x303154<_0x21cb04;_0x303154++){var _0x1a6c2e=events[_0x303154];var _0x5ef4ec=createListener(_0xfb09('0x7')+_0x1a6c2e,_0x1291b8);UserNotificationEvents['on'](_0x1a6c2e,_0x5ef4ec);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 70c7ccc..5ec5f7e 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3cb517,_0x10a7f6){var _0x3f17d9=function(_0x3ae779){while(--_0x3ae779){_0x3cb517['push'](_0x3cb517['shift']());}};_0x3f17d9(++_0x10a7f6);}(_0xedd9,0xfc));var _0x9edd=function(_0x477aab,_0x4d08fd){_0x477aab=_0x477aab-0x0;var _0x2cd294=_0xedd9[_0x477aab];return _0x2cd294;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x178e71,_0x5c6c7d){var _0x3eec6c=function(_0x406d3f){while(--_0x406d3f){_0x178e71['push'](_0x178e71['shift']());}};_0x3eec6c(++_0x5c6c7d);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d6be0ad..52fdcbc 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 _0xf568=['INTEGER','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf568,0x67));var _0x8f56=function(_0x421079,_0x28ba0){_0x421079=_0x421079-0x0;var _0x46e558=_0xf568[_0x421079];return _0x46e558;};'use strict';var Sequelize=require(_0x8f56('0x0'));module[_0x8f56('0x1')]={'penalty':{'type':Sequelize[_0x8f56('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0bde=['sequelize','INTEGER'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe0bd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe0bd('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 652f59d..13d3b09 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 _0x595f=['request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x574395,_0x8aa7df){var _0xa2e7fa=function(_0x5b2df9){while(--_0x5b2df9){_0x574395['push'](_0x574395['shift']());}};_0xa2e7fa(++_0x8aa7df);}(_0x595f,0xca));var _0xf595=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x595f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf595('0x0'));var util=require(_0xf595('0x1'));var logger=require(_0xf595('0x2'))(_0xf595('0x3'));var moment=require(_0xf595('0x4'));var BPromise=require(_0xf595('0x5'));var rp=require(_0xf595('0x6'));var fs=require('fs');var path=require(_0xf595('0x7'));var rimraf=require(_0xf595('0x8'));var config=require('../../config/environment');var attributes=require(_0xf595('0x9'));module['exports']=function(_0x10d587,_0x240ebf){return _0x10d587[_0xf595('0xa')](_0xf595('0xb'),attributes,{'tableName':_0xf595('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05ef=['api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x2e49cc,_0x1f72a7){var _0xa0c6c1=function(_0x38b018){while(--_0x38b018){_0x2e49cc['push'](_0x2e49cc['shift']());}};_0xa0c6c1(++_0x1f72a7);}(_0x05ef,0x72));var _0xf05e=function(_0x52cbe2,_0x5afefb){_0x52cbe2=_0x52cbe2-0x0;var _0x277141=_0x05ef[_0x52cbe2];return _0x277141;};'use strict';var _=require(_0xf05e('0x0'));var util=require(_0xf05e('0x1'));var logger=require(_0xf05e('0x2'))(_0xf05e('0x3'));var moment=require(_0xf05e('0x4'));var BPromise=require(_0xf05e('0x5'));var rp=require(_0xf05e('0x6'));var fs=require('fs');var path=require(_0xf05e('0x7'));var rimraf=require('rimraf');var config=require(_0xf05e('0x8'));var attributes=require(_0xf05e('0x9'));module[_0xf05e('0xa')]=function(_0x21083e,_0x5f1ce8){return _0x21083e[_0xf05e('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xf05e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index bc241d2..6b49842 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 _0xeb36=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ae701,_0x4898e3){var _0x414b2c=function(_0x1729f8){while(--_0x1729f8){_0x4ae701['push'](_0x4ae701['shift']());}};_0x414b2c(++_0x4898e3);}(_0xeb36,0x1a1));var _0x6eb3=function(_0x4f0bd5,_0x5d75b8){_0x4f0bd5=_0x4f0bd5-0x0;var _0x27d71c=_0xeb36[_0x4f0bd5];return _0x27d71c;};'use strict';var _=require(_0x6eb3('0x0'));var util=require(_0x6eb3('0x1'));var moment=require(_0x6eb3('0x2'));var BPromise=require(_0x6eb3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6eb3('0x4'))['db'];var utils=require(_0x6eb3('0x5'));var logger=require('../../config/logger')(_0x6eb3('0x6'));var config=require(_0x6eb3('0x7'));var jayson=require(_0x6eb3('0x8'));var client=jayson[_0x6eb3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ddd32,_0x57baf2,_0x28e466){return new BPromise(function(_0x83f496,_0x4bf28b){return client[_0x6eb3('0xa')](_0x3ddd32,_0x28e466)[_0x6eb3('0xb')](function(_0x55cffc){logger[_0x6eb3('0xc')](_0x6eb3('0xd'),_0x57baf2,_0x6eb3('0xe'));logger[_0x6eb3('0xf')](_0x6eb3('0x10'),_0x57baf2,'request\x20sent',JSON[_0x6eb3('0x11')](_0x55cffc));if(_0x55cffc[_0x6eb3('0x12')]){if(_0x55cffc[_0x6eb3('0x12')][_0x6eb3('0x13')]===0x1f4){logger[_0x6eb3('0x12')](_0x6eb3('0xd'),_0x57baf2,_0x55cffc[_0x6eb3('0x12')]['message']);return _0x4bf28b(_0x55cffc[_0x6eb3('0x12')][_0x6eb3('0x14')]);}logger['error'](_0x6eb3('0xd'),_0x57baf2,_0x55cffc['error'][_0x6eb3('0x14')]);return _0x83f496(_0x55cffc[_0x6eb3('0x12')]['message']);}else{logger[_0x6eb3('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x57baf2,_0x6eb3('0xe'));_0x83f496(_0x55cffc[_0x6eb3('0x15')][_0x6eb3('0x14')]);}})[_0x6eb3('0x16')](function(_0x5a2ca9){logger[_0x6eb3('0x12')](_0x6eb3('0xd'),_0x57baf2,_0x5a2ca9);_0x4bf28b(_0x5a2ca9);});});} \ No newline at end of file +var _0xdf44=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdf44,0xfc));var _0x4df4=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xdf44[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x4df4('0x0'));var util=require(_0x4df4('0x1'));var moment=require(_0x4df4('0x2'));var BPromise=require(_0x4df4('0x3'));var rs=require(_0x4df4('0x4'));var fs=require('fs');var Redis=require(_0x4df4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4df4('0x6'));var logger=require(_0x4df4('0x7'))(_0x4df4('0x8'));var config=require('../../config/environment');var jayson=require(_0x4df4('0x9'));var client=jayson[_0x4df4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x665844,_0x1d6aa1,_0xc9b099){return new BPromise(function(_0x206e71,_0x5ad2b0){return client[_0x4df4('0xb')](_0x665844,_0xc9b099)['then'](function(_0x37d9ad){logger['info'](_0x4df4('0xc'),_0x1d6aa1,'request\x20sent');logger['debug'](_0x4df4('0xd'),_0x1d6aa1,_0x4df4('0xe'),JSON[_0x4df4('0xf')](_0x37d9ad));if(_0x37d9ad[_0x4df4('0x10')]){if(_0x37d9ad[_0x4df4('0x10')]['code']===0x1f4){logger[_0x4df4('0x10')](_0x4df4('0xc'),_0x1d6aa1,_0x37d9ad[_0x4df4('0x10')][_0x4df4('0x11')]);return _0x5ad2b0(_0x37d9ad[_0x4df4('0x10')][_0x4df4('0x11')]);}logger[_0x4df4('0x10')](_0x4df4('0xc'),_0x1d6aa1,_0x37d9ad['error'][_0x4df4('0x11')]);return _0x206e71(_0x37d9ad['error'][_0x4df4('0x11')]);}else{logger[_0x4df4('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1d6aa1,_0x4df4('0xe'));_0x206e71(_0x37d9ad[_0x4df4('0x13')][_0x4df4('0x11')]);}})[_0x4df4('0x14')](function(_0xa8863e){logger[_0x4df4('0x10')](_0x4df4('0xc'),_0x1d6aa1,_0xa8863e);_0x5ad2b0(_0xa8863e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ba5cda1..44f3791 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 _0x1599=['path','connect-timeout','express','fs-extra','../../components/auth/service','index','/describe','describe','isAuthenticated','get','getSections','/:id/resources','getResources','post','clone','/:id/sections','addSections','addResources','put','/:id','delete','destroy','removeSections','exports','multer','util'];(function(_0x1982a3,_0x4cc982){var _0xfefb7f=function(_0x49b2c0){while(--_0x49b2c0){_0x1982a3['push'](_0x1982a3['shift']());}};_0xfefb7f(++_0x4cc982);}(_0x1599,0x184));var _0x9159=function(_0x175e06,_0x245172){_0x175e06=_0x175e06-0x0;var _0x2d0230=_0x1599[_0x175e06];return _0x2d0230;};'use strict';var multer=require(_0x9159('0x0'));var util=require(_0x9159('0x1'));var path=require(_0x9159('0x2'));var timeout=require(_0x9159('0x3'));var express=require(_0x9159('0x4'));var router=express['Router']();var fs_extra=require(_0x9159('0x5'));var auth=require(_0x9159('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9159('0x7')]);router['get'](_0x9159('0x8'),auth['isAuthenticated'](),controller[_0x9159('0x9')]);router['get']('/:id',auth[_0x9159('0xa')](),controller['show']);router[_0x9159('0xb')]('/:id/sections',auth[_0x9159('0xa')](),controller[_0x9159('0xc')]);router[_0x9159('0xb')](_0x9159('0xd'),auth[_0x9159('0xa')](),controller[_0x9159('0xe')]);router[_0x9159('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0x9159('0xa')](),controller[_0x9159('0x10')]);router[_0x9159('0xf')](_0x9159('0x11'),auth['isAuthenticated'](),controller[_0x9159('0x12')]);router[_0x9159('0xf')]('/:id/resources',auth[_0x9159('0xa')](),controller[_0x9159('0x13')]);router[_0x9159('0x14')](_0x9159('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x9159('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x9159('0x17')]);router['delete'](_0x9159('0x11'),auth['isAuthenticated'](),controller[_0x9159('0x18')]);router['delete'](_0x9159('0xd'),auth[_0x9159('0xa')](),controller['removeResources']);module[_0x9159('0x19')]=router; \ No newline at end of file +var _0x196e=['describe','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','put','/:id','destroy','delete','removeResources','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x196e,0x1b4));var _0xe196=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x196e[_0x494d1f];return _0x457b6e;};'use strict';var multer=require(_0xe196('0x0'));var util=require(_0xe196('0x1'));var path=require(_0xe196('0x2'));var timeout=require('connect-timeout');var express=require(_0xe196('0x3'));var router=express[_0xe196('0x4')]();var fs_extra=require(_0xe196('0x5'));var auth=require(_0xe196('0x6'));var interaction=require(_0xe196('0x7'));var config=require(_0xe196('0x8'));var controller=require(_0xe196('0x9'));router[_0xe196('0xa')]('/',auth['isAuthenticated'](),controller[_0xe196('0xb')]);router[_0xe196('0xa')](_0xe196('0xc'),auth[_0xe196('0xd')](),controller[_0xe196('0xe')]);router[_0xe196('0xa')]('/:id',auth[_0xe196('0xd')](),controller[_0xe196('0xf')]);router[_0xe196('0xa')](_0xe196('0x10'),auth[_0xe196('0xd')](),controller[_0xe196('0x11')]);router[_0xe196('0xa')]('/:id/resources',auth[_0xe196('0xd')](),controller[_0xe196('0x12')]);router[_0xe196('0x13')]('/',auth[_0xe196('0xd')](),controller[_0xe196('0x14')]);router[_0xe196('0x13')](_0xe196('0x15'),auth[_0xe196('0xd')](),controller[_0xe196('0x16')]);router[_0xe196('0x13')](_0xe196('0x10'),auth[_0xe196('0xd')](),controller[_0xe196('0x17')]);router['post'](_0xe196('0x18'),auth[_0xe196('0xd')](),controller['addResources']);router[_0xe196('0x19')](_0xe196('0x1a'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe196('0x1a'),auth[_0xe196('0xd')](),controller[_0xe196('0x1b')]);router[_0xe196('0x1c')](_0xe196('0x10'),auth[_0xe196('0xd')](),controller['removeSections']);router[_0xe196('0x1c')]('/:id/resources',auth[_0xe196('0xd')](),controller[_0xe196('0x1d')]);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 b521eda..22762c1 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 _0xdac7=['getDataValue','crudPermissions','split','BOOLEAN','exports','name','STRING','setDataValue','join'];(function(_0x1e126b,_0x1fb4c8){var _0x4fd673=function(_0x11c077){while(--_0x11c077){_0x1e126b['push'](_0x1e126b['shift']());}};_0x4fd673(++_0x1fb4c8);}(_0xdac7,0x1b4));var _0x7dac=function(_0x4ef98b,_0x57bc8e){_0x4ef98b=_0x4ef98b-0x0;var _0x223b9f=_0xdac7[_0x4ef98b];return _0x223b9f;};'use strict';var Sequelize=require('sequelize');module[_0x7dac('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7dac('0x1')},'crudPermissions':{'type':Sequelize[_0x7dac('0x2')],'set':function(_0x7a8169){this[_0x7dac('0x3')]('crudPermissions',_0x7a8169?_0x7a8169[_0x7dac('0x4')](''):[]);},'get':function(){return this[_0x7dac('0x5')](_0x7dac('0x6'))?this['getDataValue'](_0x7dac('0x6'))[_0x7dac('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7dac('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7dac('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7dac('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7dac('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7dac('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7dac('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb500=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join'];(function(_0x55af12,_0xa6841){var _0x55a4e6=function(_0x42fba2){while(--_0x42fba2){_0x55af12['push'](_0x55af12['shift']());}};_0x55a4e6(++_0xa6841);}(_0xb500,0x12f));var _0x0b50=function(_0x397d60,_0x3dea76){_0x397d60=_0x397d60-0x0;var _0x4a0523=_0xb500[_0x397d60];return _0x4a0523;};'use strict';var Sequelize=require(_0x0b50('0x0'));module[_0x0b50('0x1')]={'name':{'type':Sequelize[_0x0b50('0x2')],'allowNull':![],'unique':_0x0b50('0x3')},'crudPermissions':{'type':Sequelize[_0x0b50('0x2')],'set':function(_0x232f5e){this[_0x0b50('0x4')](_0x0b50('0x5'),_0x232f5e?_0x232f5e[_0x0b50('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x0b50('0x5'))?this[_0x0b50('0x7')](_0x0b50('0x5'))[_0x0b50('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0b50('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0b50('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0b50('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0b50('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x0b50('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0b50('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0b50('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d4010c4..45cde01 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 _0x4f7a=['sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','update','destroy','describe','addSections','Resources','push','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userProfile.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','error','name','send','map','UserProfile','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','omit','updatedAt','crudPermissions','createdAt'];(function(_0x39e1c8,_0x6b9648){var _0x8ca64d=function(_0x197988){while(--_0x197988){_0x39e1c8['push'](_0x39e1c8['shift']());}};_0x8ca64d(++_0x6b9648);}(_0x4f7a,0x105));var _0xa4f7=function(_0x4cd96e,_0x220bba){_0x4cd96e=_0x4cd96e-0x0;var _0x37c2da=_0x4f7a[_0x4cd96e];return _0x37c2da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa4f7('0x0'));var jsonpatch=require(_0xa4f7('0x1'));var rp=require(_0xa4f7('0x2'));var moment=require('moment');var BPromise=require(_0xa4f7('0x3'));var Mustache=require('mustache');var util=require(_0xa4f7('0x4'));var path=require(_0xa4f7('0x5'));var sox=require(_0xa4f7('0x6'));var csv=require('to-csv');var ejs=require(_0xa4f7('0x7'));var fs=require('fs');var fs_extra=require(_0xa4f7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4f7('0x9'));var jsforce=require(_0xa4f7('0xa'));var deskjs=require(_0xa4f7('0xb'));var toCsv=require(_0xa4f7('0xc'));var querystring=require(_0xa4f7('0xd'));var Papa=require('papaparse');var Redis=require(_0xa4f7('0xe'));var authService=require(_0xa4f7('0xf'));var qs=require(_0xa4f7('0x10'));var as=require(_0xa4f7('0x11'));var hardwareService=require(_0xa4f7('0x12'));var logger=require(_0xa4f7('0x13'))(_0xa4f7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa4f7('0x15'));var db=require(_0xa4f7('0x16'))['db'];config['redis']=_[_0xa4f7('0x17')](config[_0xa4f7('0x18')],{'host':_0xa4f7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4f7('0x18')]));require(_0xa4f7('0x1a'))[_0xa4f7('0x1b')](socket);function respondWithStatusCode(_0x593304,_0xd626dc){_0xd626dc=_0xd626dc||0xcc;return function(_0x1ddb6b){if(_0x1ddb6b){return _0x593304[_0xa4f7('0x1c')](_0xd626dc);}return _0x593304[_0xa4f7('0x1d')](_0xd626dc)['end']();};}function respondWithResult(_0x3e9fc7,_0x1e13ab){_0x1e13ab=_0x1e13ab||0xc8;return function(_0x4bf839){if(_0x4bf839){return _0x3e9fc7['status'](_0x1e13ab)[_0xa4f7('0x1e')](_0x4bf839);}};}function respondWithFilteredResult(_0x4b4111,_0x403d1e){return function(_0x44e119){if(_0x44e119){var _0x5345a6=typeof _0x403d1e[_0xa4f7('0x1f')]==='undefined'&&typeof _0x403d1e[_0xa4f7('0x20')]===_0xa4f7('0x21');var _0x10b16a=_0x44e119[_0xa4f7('0x22')];var _0x181911=_0x5345a6?0x0:_0x403d1e[_0xa4f7('0x1f')];var _0x48ec43=_0x5345a6?_0x44e119[_0xa4f7('0x22')]:_0x403d1e[_0xa4f7('0x1f')]+_0x403d1e[_0xa4f7('0x20')];var _0x33ef47;if(_0x48ec43>=_0x10b16a){_0x48ec43=_0x10b16a;_0x33ef47=0xc8;}else{_0x33ef47=0xce;}_0x4b4111['status'](_0x33ef47);return _0x4b4111[_0xa4f7('0x23')](_0xa4f7('0x24'),_0x181911+'-'+_0x48ec43+'/'+_0x10b16a)[_0xa4f7('0x1e')](_0x44e119);}return null;};}function patchUpdates(_0x1a027c){return function(_0x232ad9){try{jsonpatch[_0xa4f7('0x25')](_0x232ad9,_0x1a027c,!![]);}catch(_0x2a59b4){return BPromise[_0xa4f7('0x26')](_0x2a59b4);}return _0x232ad9[_0xa4f7('0x27')]();};}function saveUpdates(_0x1201ee,_0x3ab7a5){return function(_0x119709){if(_0x119709){return _0x119709['update'](_0x1201ee)[_0xa4f7('0x28')](function(_0x18b3c7){return _0x18b3c7;});}return null;};}function removeEntity(_0x19a20d,_0x2b56fe){return function(_0x389fe8){if(_0x389fe8){return _0x389fe8['destroy']()['then'](function(){_0x19a20d['status'](0xcc)[_0xa4f7('0x29')]();});}};}function handleEntityNotFound(_0x4e6c36,_0x4859d){return function(_0x23ffe5){if(!_0x23ffe5){_0x4e6c36[_0xa4f7('0x1c')](0x194);}return _0x23ffe5;};}function handleError(_0x488152,_0x1c4614){_0x1c4614=_0x1c4614||0x1f4;return function(_0x5366dc){logger[_0xa4f7('0x2a')](_0x5366dc['stack']);if(_0x5366dc[_0xa4f7('0x2b')]){delete _0x5366dc[_0xa4f7('0x2b')];}_0x488152[_0xa4f7('0x1d')](_0x1c4614)[_0xa4f7('0x2c')](_0x5366dc);};}exports['index']=function(_0x25bb95,_0x16c8b0){var _0x35c557={},_0x3e4d19={},_0xf852a2={'count':0x0,'rows':[]};var _0x5dd861=_[_0xa4f7('0x2d')](db[_0xa4f7('0x2e')]['rawAttributes'],function(_0x1d85f8){return{'name':_0x1d85f8[_0xa4f7('0x2f')],'type':_0x1d85f8[_0xa4f7('0x30')]['key']};});_0x3e4d19[_0xa4f7('0x31')]=_[_0xa4f7('0x2d')](_0x5dd861,'name');_0x3e4d19['query']=_[_0xa4f7('0x32')](_0x25bb95[_0xa4f7('0x33')]);_0x3e4d19[_0xa4f7('0x34')]=_['intersection'](_0x3e4d19[_0xa4f7('0x31')],_0x3e4d19[_0xa4f7('0x33')]);_0x35c557[_0xa4f7('0x35')]=_[_0xa4f7('0x36')](_0x3e4d19[_0xa4f7('0x31')],qs[_0xa4f7('0x37')](_0x25bb95[_0xa4f7('0x33')][_0xa4f7('0x37')]));_0x35c557[_0xa4f7('0x35')]=_0x35c557['attributes'][_0xa4f7('0x38')]?_0x35c557[_0xa4f7('0x35')]:_0x3e4d19[_0xa4f7('0x31')];if(!_0x25bb95[_0xa4f7('0x33')][_0xa4f7('0x39')](_0xa4f7('0x3a'))){_0x35c557[_0xa4f7('0x20')]=qs[_0xa4f7('0x20')](_0x25bb95['query'][_0xa4f7('0x20')]);_0x35c557[_0xa4f7('0x1f')]=qs['offset'](_0x25bb95['query'][_0xa4f7('0x1f')]);}_0x35c557[_0xa4f7('0x3b')]=qs[_0xa4f7('0x3c')](_0x25bb95['query'][_0xa4f7('0x3c')]);_0x35c557[_0xa4f7('0x3d')]=qs[_0xa4f7('0x34')](_[_0xa4f7('0x3e')](_0x25bb95['query'],_0x3e4d19[_0xa4f7('0x34')]),_0x5dd861);if(_0x25bb95[_0xa4f7('0x33')][_0xa4f7('0x3f')]){_0x35c557[_0xa4f7('0x3d')]=_[_0xa4f7('0x40')](_0x35c557[_0xa4f7('0x3d')],{'$or':_[_0xa4f7('0x2d')](_0x5dd861,function(_0x1dc644){if(_0x1dc644[_0xa4f7('0x30')]!==_0xa4f7('0x41')){var _0x4e75f0={};_0x4e75f0[_0x1dc644['name']]={'$like':'%'+_0x25bb95['query'][_0xa4f7('0x3f')]+'%'};return _0x4e75f0;}})});}_0x35c557=_['merge']({},_0x35c557,_0x25bb95[_0xa4f7('0x42')]);var _0x31f398={'where':_0x35c557[_0xa4f7('0x3d')]};return db[_0xa4f7('0x2e')][_0xa4f7('0x22')](_0x31f398)['then'](function(_0x1698f2){_0xf852a2[_0xa4f7('0x22')]=_0x1698f2;if(_0x25bb95[_0xa4f7('0x33')][_0xa4f7('0x43')]){_0x35c557[_0xa4f7('0x44')]=[{'all':!![]}];}return db[_0xa4f7('0x2e')][_0xa4f7('0x45')](_0x35c557);})[_0xa4f7('0x28')](function(_0x34192f){_0xf852a2[_0xa4f7('0x46')]=_0x34192f;return _0xf852a2;})['then'](respondWithFilteredResult(_0x16c8b0,_0x35c557))[_0xa4f7('0x47')](handleError(_0x16c8b0,null));};exports['show']=function(_0x536066,_0x30aa9a){var _0x33e941={'raw':![],'where':{'id':_0x536066[_0xa4f7('0x48')]['id']}},_0x172760={};_0x172760[_0xa4f7('0x31')]=_['keys'](db[_0xa4f7('0x2e')][_0xa4f7('0x49')]);_0x172760[_0xa4f7('0x33')]=_[_0xa4f7('0x32')](_0x536066[_0xa4f7('0x33')]);_0x172760['filters']=_[_0xa4f7('0x36')](_0x172760[_0xa4f7('0x31')],_0x172760['query']);_0x33e941[_0xa4f7('0x35')]=_[_0xa4f7('0x36')](_0x172760[_0xa4f7('0x31')],qs['fields'](_0x536066['query'][_0xa4f7('0x37')]));_0x33e941[_0xa4f7('0x35')]=_0x33e941[_0xa4f7('0x35')]['length']?_0x33e941[_0xa4f7('0x35')]:_0x172760[_0xa4f7('0x31')];if(_0x536066[_0xa4f7('0x33')][_0xa4f7('0x43')]){_0x33e941[_0xa4f7('0x44')]=[{'all':!![]}];}_0x33e941=_['merge']({},_0x33e941,_0x536066[_0xa4f7('0x42')]);return db[_0xa4f7('0x2e')][_0xa4f7('0x4a')](_0x33e941)['then'](handleEntityNotFound(_0x30aa9a,null))['then'](respondWithResult(_0x30aa9a,null))[_0xa4f7('0x47')](handleError(_0x30aa9a,null));};exports[_0xa4f7('0x4b')]=function(_0x44e8a1,_0x1a4afb){return db[_0xa4f7('0x2e')][_0xa4f7('0x4b')](_0x44e8a1[_0xa4f7('0x4c')],{})[_0xa4f7('0x28')](respondWithResult(_0x1a4afb,0xc9))[_0xa4f7('0x47')](handleError(_0x1a4afb,null));};exports['clone']=function(_0x5c0e43,_0x507fc9){var _0x21b018={'where':{'id':_0x5c0e43[_0xa4f7('0x48')]['id']}},_0x3ad250={};_0x3ad250[_0xa4f7('0x31')]=_[_0xa4f7('0x32')](db[_0xa4f7('0x2e')][_0xa4f7('0x49')]);_0x21b018[_0xa4f7('0x35')]=_[_0xa4f7('0x36')](_0x3ad250['model'],qs['fields'](_0x5c0e43[_0xa4f7('0x33')]['fields']));_0x21b018['attributes']=_0x21b018[_0xa4f7('0x35')]['length']?_0x21b018[_0xa4f7('0x35')]:_0x3ad250[_0xa4f7('0x31')];if(_0x5c0e43[_0xa4f7('0x33')][_0xa4f7('0x43')]){_0x21b018[_0xa4f7('0x44')]=[{'all':!![]}];}_0x21b018=_[_0xa4f7('0x40')]({},_0x21b018,_0x5c0e43[_0xa4f7('0x42')]);return db[_0xa4f7('0x2e')][_0xa4f7('0x4a')](_0x21b018)[_0xa4f7('0x28')](handleEntityNotFound(_0x507fc9,null))[_0xa4f7('0x28')](function(_0x22ee53){if(_0x22ee53){var _0x50774f=_0x22ee53['get']({'plain':!![]});_0x50774f=qs[_0xa4f7('0x4d')](_0x50774f,['id','createdAt',_0xa4f7('0x4e'),_0xa4f7('0x4f')]);_0x5c0e43[_0xa4f7('0x4c')]=_[_0xa4f7('0x4d')](_0x5c0e43[_0xa4f7('0x4c')],['id',_0xa4f7('0x50'),_0xa4f7('0x4e')]);return db[_0xa4f7('0x51')][_0xa4f7('0x52')](function(_0x20fbbc){return db[_0xa4f7('0x2e')][_0xa4f7('0x4b')](_[_0xa4f7('0x40')](_0x50774f,_0x5c0e43[_0xa4f7('0x4c')]),{'include':_0x5c0e43[_0xa4f7('0x33')][_0xa4f7('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x20fbbc})[_0xa4f7('0x28')](function(_0x1ba60e){var _0x4a834d=_0x1ba60e[_0xa4f7('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xa4f7('0x45')]({'where':{'userProfileId':_0x5c0e43[_0xa4f7('0x48')]['id']},'raw':!![]})[_0xa4f7('0x28')](function(_0x289a9b){if(_0x289a9b){return BPromise[_0xa4f7('0x54')](_0x289a9b,function(_0x3f6df9){return new BPromise(function(_0x6bf4b7,_0x46e993){if(_0x3f6df9[_0xa4f7('0x55')]===null||_0x3f6df9[_0xa4f7('0x55')]===0x1)_0x6bf4b7(null);return db[_0xa4f7('0x56')]['findAll']({'where':{'sectionId':_0x3f6df9['id']},'raw':!![]})[_0xa4f7('0x28')](function(_0x2de037){var _0x58c118=_[_0xa4f7('0x2d')](_0x2de037,function(_0x3a02ad){return qs[_0xa4f7('0x4d')](_0x3a02ad,['id',_0xa4f7('0x50'),'updatedAt',_0xa4f7('0x57')]);});_0x6bf4b7(_0x58c118);})[_0xa4f7('0x47')](function(_0x36f86f){_0x46e993(_0x36f86f);});})[_0xa4f7('0x28')](function(_0x4c129a){var _0x53a1e2=qs[_0xa4f7('0x4d')](_0x3f6df9,['id','createdAt','updatedAt']);_0x53a1e2[_0xa4f7('0x58')]=_0x4a834d['id'];if(_0x4c129a)_0x53a1e2['Resources']=_0x4c129a;return _0x53a1e2;})[_0xa4f7('0x28')](function(_0x5d5531){return db[_0xa4f7('0x59')][_0xa4f7('0x4b')](_0x5d5531,{'include':[{'model':db[_0xa4f7('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x20fbbc});});})[_0xa4f7('0x28')](function(){return _0x4a834d;});}});});});}})[_0xa4f7('0x28')](respondWithResult(_0x507fc9,0xc9))[_0xa4f7('0x47')](handleError(_0x507fc9,null));};exports[_0xa4f7('0x5a')]=function(_0x39c34f,_0x367909){if(_0x39c34f[_0xa4f7('0x4c')]['id']){delete _0x39c34f['body']['id'];}return db[_0xa4f7('0x2e')][_0xa4f7('0x4a')]({'where':{'id':_0x39c34f[_0xa4f7('0x48')]['id']}})[_0xa4f7('0x28')](handleEntityNotFound(_0x367909,null))[_0xa4f7('0x28')](saveUpdates(_0x39c34f[_0xa4f7('0x4c')],null))[_0xa4f7('0x28')](respondWithResult(_0x367909,null))['catch'](handleError(_0x367909,null));};exports[_0xa4f7('0x5b')]=function(_0xdcb9c1,_0x3af88f){return db[_0xa4f7('0x2e')][_0xa4f7('0x4a')]({'where':{'id':_0xdcb9c1[_0xa4f7('0x48')]['id']}})['then'](handleEntityNotFound(_0x3af88f,null))[_0xa4f7('0x28')](removeEntity(_0x3af88f,null))[_0xa4f7('0x47')](handleError(_0x3af88f,null));};exports[_0xa4f7('0x5c')]=function(_0x43ced1,_0xfc3773){return db[_0xa4f7('0x2e')][_0xa4f7('0x5c')]()[_0xa4f7('0x28')](respondWithResult(_0xfc3773,null))[_0xa4f7('0x47')](handleError(_0xfc3773,null));};exports[_0xa4f7('0x5d')]=function(_0xb53398,_0x1f23f5){var _0x9fa737=_0xb53398['body'];return db['UserProfile'][_0xa4f7('0x4a')]({'where':{'id':_0xb53398[_0xa4f7('0x48')]['id']}})[_0xa4f7('0x28')](handleEntityNotFound(_0x1f23f5,null))['then'](function(_0x25dc10){if(_0x25dc10){return db[_0xa4f7('0x51')][_0xa4f7('0x52')](function(_0x54ade1){return db['UserProfileSection'][_0xa4f7('0x5b')]({'where':{'userProfileId':_0xb53398[_0xa4f7('0x48')]['id'],'sectionId':_[_0xa4f7('0x2d')](_0x9fa737,function(_0x328bbe){return _0x328bbe[_0xa4f7('0x57')];})},'transaction':_0x54ade1})[_0xa4f7('0x28')](function(){var _0x1a42fd=_[_0xa4f7('0x2d')](_0x9fa737,function(_0x4885c0){_0x4885c0[_0xa4f7('0x58')]=_0xb53398[_0xa4f7('0x48')]['id'];return _0x4885c0;});var _0x1f2b03=[];return BPromise['each'](_0x1a42fd,function(_0x2e4df9){return db['UserProfileSection']['create'](_0x2e4df9,{'include':[{'model':db[_0xa4f7('0x56')],'as':_0xa4f7('0x5e')}],'raw':!![],'transaction':_0x54ade1})['then'](function(_0x5d2886){_0x1f2b03[_0xa4f7('0x5f')](_0x5d2886[_0xa4f7('0x53')]({'plain':!![]}));});})[_0xa4f7('0x28')](function(){return _0x1f2b03;});});});}})[_0xa4f7('0x28')](function(_0x37771a){return _0x37771a;})[_0xa4f7('0x28')](respondWithResult(_0x1f23f5,null))[_0xa4f7('0x47')](handleError(_0x1f23f5,null));};exports['removeSections']=function(_0x24a58b,_0x2f1bdb){var _0x598760;return db[_0xa4f7('0x2e')][_0xa4f7('0x4a')]({'where':{'id':_0x24a58b['params']['id']},'attributes':['id',_0xa4f7('0x2b')]})[_0xa4f7('0x28')](handleEntityNotFound(_0x2f1bdb,null))[_0xa4f7('0x28')](function(_0x1ffef5){if(_0x1ffef5){_0x598760=_0x1ffef5;return db[_0xa4f7('0x59')][_0xa4f7('0x5b')]({'where':{'userProfileId':_0x24a58b['params']['id'],'sectionId':_0x24a58b[_0xa4f7('0x33')]['ids']}});}})['then'](function(){return _0x598760;})[_0xa4f7('0x28')](respondWithStatusCode(_0x2f1bdb,null))['catch'](handleError(_0x2f1bdb,null));};exports[_0xa4f7('0x60')]=function(_0x1f4419,_0x16e48c){var _0x1f2a9d=[];var _0xbc95d=[];return db[_0xa4f7('0x59')][_0xa4f7('0x45')]({'where':{'userProfileId':_0x1f4419[_0xa4f7('0x48')]['id']},'raw':!![]})['then'](function(_0xa453a0){_0x1f2a9d=_[_0xa4f7('0x3f')](_0xa453a0,function(_0x20e59e){return _0x20e59e[_0xa4f7('0x61')]===0x1||_['includes']([0x3eb,0x709],_0x20e59e[_0xa4f7('0x57')]);});if(!_[_0xa4f7('0x62')](_0x1f2a9d)){return _[_0xa4f7('0x2d')](_0x1f2a9d,function(_0x2d4fe3){return _0x2d4fe3[_0xa4f7('0x57')];});}else{return;}})['then'](function(_0x494243){if(_0x494243)_0xbc95d=_0x494243;if(_[_0xa4f7('0x63')](_0xbc95d,0x64)){var _0x571617=_[_0xa4f7('0x4a')](_0x1f2a9d,{'sectionId':0x64});return hasDefaultDashboard(_0x571617)['then'](function(_0x4c04f0){return _[_0xa4f7('0x2d')](_0x1f2a9d,function(_0x28f44e){if(_0x28f44e[_0xa4f7('0x57')]===0x64){_0x28f44e[_0xa4f7('0x64')]=_0x4c04f0;}return _0x28f44e;});});}else{return;}})[_0xa4f7('0x28')](function(_0x605613){if(_0x605613)_0x1f2a9d=_0x605613;if(_['includes'](_0xbc95d,0x3eb)){var _0x16e902=_[_0xa4f7('0x4a')](_0x1f2a9d,{'sectionId':0x3eb});return getCustomDashboards(_0x16e902)[_0xa4f7('0x28')](function(_0x484b41){return _['map'](_0x1f2a9d,function(_0x7fca05){if(_0x16e902['enabled']){if(_0x7fca05[_0xa4f7('0x57')]===0x3eb){_0x7fca05[_0xa4f7('0x64')]=_0x484b41;}}else{if(_0x7fca05['sectionId']===0x64){_0x7fca05[_0xa4f7('0x64')]=_0x484b41;}}return _0x7fca05;});});}else{return;}})[_0xa4f7('0x28')](function(_0x43790f){if(_0x43790f)_0x1f2a9d=_0x43790f;if(_[_0xa4f7('0x63')](_0xbc95d,0x709)){var _0x260942=_['find'](_0x1f2a9d,{'sectionId':0x709});return getPlugins(_0x260942)[_0xa4f7('0x28')](function(_0x3189bc){if(_0x260942[_0xa4f7('0x61')]){return _[_0xa4f7('0x2d')](_0x1f2a9d,function(_0x35c5b5){if(_0x35c5b5[_0xa4f7('0x57')]===0x709){_0x35c5b5['subsections']=_0x3189bc;}return _0x35c5b5;});}else{var _0x1b9345={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3189bc};var _0x3c7195=_[_0xa4f7('0x2d')](_0x1f2a9d);_0x3c7195[_0xa4f7('0x5f')](_0x1b9345);return _0x3c7195;}});}else{return;}})['then'](function(_0x14e574){if(_0x14e574)_0x1f2a9d=_0x14e574;return _['filter'](_0x1f2a9d,[_0xa4f7('0x61'),0x1]);})[_0xa4f7('0x28')](respondWithResult(_0x16e48c,null))['catch'](handleError(_0x16e48c,null));};function hasDefaultDashboard(_0x29144a){var _0x818a3f=[0x65];return new BPromise(function(_0x50507e,_0x22626f){try{if(_0x29144a[_0xa4f7('0x55')]){_0x50507e(_0x818a3f);}else{return db['UserProfileResource'][_0xa4f7('0x65')]({'where':{'sectionId':_0x29144a['id']},'raw':!![]})['then'](function(_0x257c68){_0x257c68?_0x50507e(_0x818a3f):_0x50507e();});}}catch(_0x505169){_0x22626f(_0x505169);}});}function getCustomDashboards(_0x1f7543){var _0x32ce21=[];return new BPromise(function(_0x222166,_0x112dd8){try{if(_0x1f7543['autoAssociation']){return db[_0xa4f7('0x66')][_0xa4f7('0x45')]({'raw':!![]})[_0xa4f7('0x28')](function(_0x1f4a6d){_0x1f4a6d[_0xa4f7('0x67')](function(_0x386265){_0x32ce21[_0xa4f7('0x5f')](_0x386265['id']+0x1869f);});_0x222166(_0x32ce21);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1f7543['id']},'raw':!![]})[_0xa4f7('0x28')](function(_0x43c8f1){_0x43c8f1[_0xa4f7('0x67')](function(_0x39232e){_0x32ce21['push'](_0x39232e[_0xa4f7('0x68')]+0x1869f);});_0x222166(_0x32ce21);});}}catch(_0x3444a2){_0x112dd8(_0x3444a2);}});}function getPlugins(_0x5be969){var _0x23f85e=[];return new BPromise(function(_0x53b3b5,_0x3e449e){try{if(_0x5be969[_0xa4f7('0x55')]){return db[_0xa4f7('0x69')][_0xa4f7('0x45')]({'raw':!![]})[_0xa4f7('0x28')](function(_0x2d1287){_0x2d1287[_0xa4f7('0x67')](function(_0x11cdb2){_0x23f85e['push'](_0x11cdb2['id']+0x15b38);});_0x53b3b5(_0x23f85e);});}else{return db[_0xa4f7('0x56')][_0xa4f7('0x45')]({'where':{'sectionId':_0x5be969['id']},'raw':!![]})[_0xa4f7('0x28')](function(_0x4e5d61){_0x4e5d61[_0xa4f7('0x67')](function(_0x79e6b5){_0x23f85e[_0xa4f7('0x5f')](_0x79e6b5['resourceId']+0x15b38);});_0x53b3b5(_0x23f85e);});}}catch(_0x51eb10){_0x3e449e(_0x51eb10);}});}exports[_0xa4f7('0x6a')]=function(_0x2a8e29,_0x4815f9){return db[_0xa4f7('0x2e')][_0xa4f7('0x4a')]({'where':{'id':_0x2a8e29[_0xa4f7('0x48')]['id']}})[_0xa4f7('0x28')](handleEntityNotFound(_0x4815f9,null))['then'](function(_0x38a87b){if(_0x38a87b){return db[_0xa4f7('0x51')][_0xa4f7('0x52')](function(_0x578f41){return db[_0xa4f7('0x59')]['findAll']({'where':{'userProfileId':_0x2a8e29[_0xa4f7('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xa4f7('0x28')](function(_0x18d2e6){if(_0x18d2e6){return db[_0xa4f7('0x59')][_0xa4f7('0x5b')]({'where':{'userProfileId':_0x2a8e29[_0xa4f7('0x48')]['id'],'id':_['map'](_0x18d2e6,function(_0x3affb3){return _0x3affb3['id'];})},'transaction':_0x578f41});}})[_0xa4f7('0x28')](function(_0xa255ab){var _0x25d8fd=_[_0xa4f7('0x2d')](_0x2a8e29[_0xa4f7('0x4c')],function(_0x46c6e6){_0x46c6e6['userProfileId']=_0x2a8e29[_0xa4f7('0x48')]['id'];return _0x46c6e6;});return db[_0xa4f7('0x59')][_0xa4f7('0x6b')](_0x25d8fd,{'raw':!![],'transaction':_0x578f41});})['then'](function(_0x5f160c){var _0x531b64=_[_0xa4f7('0x3f')](_['map'](_0x5f160c,function(_0xf76158){return _0xf76158[_0xa4f7('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x531b64){return db[_0xa4f7('0x59')]['findAll']({'where':{'userProfileId':_0x2a8e29[_0xa4f7('0x48')]['id'],'sectionId':_[_0xa4f7('0x2d')](_0x531b64,function(_0x137860){return _0x137860[_0xa4f7('0x57')];})},'attributes':['id',_0xa4f7('0x57')],'raw':!![]})[_0xa4f7('0x28')](function(_0x462ad1){var _0x81153f=_[_0xa4f7('0x2d')](_0x2a8e29[_0xa4f7('0x4c')],function(_0x593fb4){_0x593fb4[_0xa4f7('0x58')]=_0x2a8e29[_0xa4f7('0x48')]['id'];return _0x593fb4;});return db[_0xa4f7('0x56')][_0xa4f7('0x6b')](_0x81153f,{'raw':!![],'transaction':_0x578f41});});}})['catch'](handleError(_0x4815f9,null));});}})[_0xa4f7('0x28')](function(_0x2bcd50){var _0x6f7087=_[_0xa4f7('0x2d')](_0x2bcd50,function(_0x270a85){return _0x270a85['get']({'plain':!![]});});})[_0xa4f7('0x28')](respondWithResult(_0x4815f9,null))[_0xa4f7('0x47')](handleError(_0x4815f9,null));};exports['removeResources']=function(_0x369259,_0x2666e8,_0x55585f){return db[_0xa4f7('0x2e')]['find']({'where':{'id':_0x369259[_0xa4f7('0x48')]['id']}})[_0xa4f7('0x28')](handleEntityNotFound(_0x2666e8,null))[_0xa4f7('0x28')](function(_0x247081){if(_0x247081){return _0x247081[_0xa4f7('0x6c')](_0x369259['query'][_0xa4f7('0x6d')]);}})[_0xa4f7('0x28')](respondWithStatusCode(_0x2666e8,null))[_0xa4f7('0x47')](handleError(_0x2666e8,null));};exports[_0xa4f7('0x6e')]=function(_0x519170,_0xc1642){var _0xcdda5b={};if(!_0x519170[_0xa4f7('0x33')][_0xa4f7('0x6f')])throw new Error(_0xa4f7('0x70'));if(!_0x519170[_0xa4f7('0x33')][_0xa4f7('0x39')](_0xa4f7('0x3a'))){_0xcdda5b[_0xa4f7('0x20')]=qs[_0xa4f7('0x20')](_0x519170[_0xa4f7('0x33')][_0xa4f7('0x20')]);_0xcdda5b[_0xa4f7('0x1f')]=qs[_0xa4f7('0x1f')](_0x519170[_0xa4f7('0x33')]['offset']);}return db['UserProfile'][_0xa4f7('0x4a')]({'where':{'id':_0x519170[_0xa4f7('0x48')]['id']}})[_0xa4f7('0x28')](function(_0x24316a){if(!_0x24316a)throw new Error(_0xa4f7('0x71')+_0x519170[_0xa4f7('0x48')]['id']);return db[_0xa4f7('0x2e')][_0xa4f7('0x6e')](_0x519170);})[_0xa4f7('0x28')](respondWithFilteredResult(_0xc1642,_0xcdda5b))['catch'](handleError(_0xc1642,null));}; \ No newline at end of file +var _0xd117=['create','body','clone','params','find','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','findAll','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','limit','offset','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','UserProfile','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','then','rows','catch','show','keys','rawAttributes','length'];(function(_0x184d31,_0x4ad790){var _0x2cdbfc=function(_0x83073d){while(--_0x83073d){_0x184d31['push'](_0x184d31['shift']());}};_0x2cdbfc(++_0x4ad790);}(_0xd117,0x182));var _0x7d11=function(_0x20e764,_0x19811d){_0x20e764=_0x20e764-0x0;var _0x4ebc22=_0xd117[_0x20e764];return _0x4ebc22;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];config[_0x7d11('0x18')]=_[_0x7d11('0x19')](config['redis'],{'host':_0x7d11('0x1a'),'port':0x18eb});var socket=require(_0x7d11('0x1b'))(new Redis(config['redis']));require(_0x7d11('0x1c'))[_0x7d11('0x1d')](socket);function respondWithStatusCode(_0x20a2df,_0x2978da){_0x2978da=_0x2978da||0xcc;return function(_0x417e2d){if(_0x417e2d){return _0x20a2df[_0x7d11('0x1e')](_0x2978da);}return _0x20a2df[_0x7d11('0x1f')](_0x2978da)[_0x7d11('0x20')]();};}function respondWithResult(_0x4aa795,_0x1db0df){_0x1db0df=_0x1db0df||0xc8;return function(_0x12c2ff){if(_0x12c2ff){return _0x4aa795[_0x7d11('0x1f')](_0x1db0df)[_0x7d11('0x21')](_0x12c2ff);}};}function respondWithFilteredResult(_0x45f916,_0x528fdc){return function(_0x456cb9){if(_0x456cb9){var _0x49a34b=typeof _0x528fdc['offset']==='undefined'&&typeof _0x528fdc[_0x7d11('0x22')]==='undefined';var _0x1f9990=_0x456cb9['count'];var _0xbe0a79=_0x49a34b?0x0:_0x528fdc[_0x7d11('0x23')];var _0x328f8e=_0x49a34b?_0x456cb9[_0x7d11('0x24')]:_0x528fdc[_0x7d11('0x23')]+_0x528fdc[_0x7d11('0x22')];var _0x4297f8;if(_0x328f8e>=_0x1f9990){_0x328f8e=_0x1f9990;_0x4297f8=0xc8;}else{_0x4297f8=0xce;}_0x45f916[_0x7d11('0x1f')](_0x4297f8);return _0x45f916['set'](_0x7d11('0x25'),_0xbe0a79+'-'+_0x328f8e+'/'+_0x1f9990)['json'](_0x456cb9);}return null;};}function patchUpdates(_0x58455b){return function(_0x5c3898){try{jsonpatch[_0x7d11('0x26')](_0x5c3898,_0x58455b,!![]);}catch(_0x3545dc){return BPromise[_0x7d11('0x27')](_0x3545dc);}return _0x5c3898[_0x7d11('0x28')]();};}function saveUpdates(_0x355d14,_0xd938df){return function(_0x282e5c){if(_0x282e5c){return _0x282e5c[_0x7d11('0x29')](_0x355d14)['then'](function(_0x36c2b4){return _0x36c2b4;});}return null;};}function removeEntity(_0x577ca9,_0x4bfa76){return function(_0x5126cf){if(_0x5126cf){return _0x5126cf[_0x7d11('0x2a')]()['then'](function(){_0x577ca9[_0x7d11('0x1f')](0xcc)[_0x7d11('0x20')]();});}};}function handleEntityNotFound(_0x328ab7,_0x47c794){return function(_0x46f76a){if(!_0x46f76a){_0x328ab7[_0x7d11('0x1e')](0x194);}return _0x46f76a;};}function handleError(_0x427200,_0x5d38dd){_0x5d38dd=_0x5d38dd||0x1f4;return function(_0x601650){logger[_0x7d11('0x2b')](_0x601650[_0x7d11('0x2c')]);if(_0x601650[_0x7d11('0x2d')]){delete _0x601650['name'];}_0x427200[_0x7d11('0x1f')](_0x5d38dd)['send'](_0x601650);};}exports[_0x7d11('0x2e')]=function(_0x509164,_0x31866d){var _0xba4e80={},_0x1e32f6={},_0x4831ed={'count':0x0,'rows':[]};var _0x5e721f=_[_0x7d11('0x2f')](db[_0x7d11('0x30')]['rawAttributes'],function(_0x388b84){return{'name':_0x388b84[_0x7d11('0x31')],'type':_0x388b84[_0x7d11('0x32')]['key']};});_0x1e32f6[_0x7d11('0x33')]=_['map'](_0x5e721f,'name');_0x1e32f6[_0x7d11('0x34')]=_['keys'](_0x509164[_0x7d11('0x34')]);_0x1e32f6[_0x7d11('0x35')]=_[_0x7d11('0x36')](_0x1e32f6[_0x7d11('0x33')],_0x1e32f6['query']);_0xba4e80[_0x7d11('0x37')]=_[_0x7d11('0x36')](_0x1e32f6['model'],qs['fields'](_0x509164[_0x7d11('0x34')][_0x7d11('0x38')]));_0xba4e80['attributes']=_0xba4e80[_0x7d11('0x37')]['length']?_0xba4e80['attributes']:_0x1e32f6[_0x7d11('0x33')];if(!_0x509164['query']['hasOwnProperty'](_0x7d11('0x39'))){_0xba4e80[_0x7d11('0x22')]=qs[_0x7d11('0x22')](_0x509164[_0x7d11('0x34')][_0x7d11('0x22')]);_0xba4e80[_0x7d11('0x23')]=qs[_0x7d11('0x23')](_0x509164[_0x7d11('0x34')][_0x7d11('0x23')]);}_0xba4e80[_0x7d11('0x3a')]=qs[_0x7d11('0x3b')](_0x509164[_0x7d11('0x34')]['sort']);_0xba4e80[_0x7d11('0x3c')]=qs['filters'](_[_0x7d11('0x3d')](_0x509164[_0x7d11('0x34')],_0x1e32f6[_0x7d11('0x35')]),_0x5e721f);if(_0x509164[_0x7d11('0x34')]['filter']){_0xba4e80[_0x7d11('0x3c')]=_[_0x7d11('0x3e')](_0xba4e80[_0x7d11('0x3c')],{'$or':_[_0x7d11('0x2f')](_0x5e721f,function(_0x597071){if(_0x597071[_0x7d11('0x32')]!=='VIRTUAL'){var _0x2e05e8={};_0x2e05e8[_0x597071['name']]={'$like':'%'+_0x509164[_0x7d11('0x34')][_0x7d11('0x3f')]+'%'};return _0x2e05e8;}})});}_0xba4e80=_[_0x7d11('0x3e')]({},_0xba4e80,_0x509164[_0x7d11('0x40')]);var _0x52c28b={'where':_0xba4e80['where']};return db[_0x7d11('0x30')][_0x7d11('0x24')](_0x52c28b)['then'](function(_0x1caef9){_0x4831ed[_0x7d11('0x24')]=_0x1caef9;if(_0x509164[_0x7d11('0x34')][_0x7d11('0x41')]){_0xba4e80[_0x7d11('0x42')]=[{'all':!![]}];}return db[_0x7d11('0x30')]['findAll'](_0xba4e80);})[_0x7d11('0x43')](function(_0x5cf6a6){_0x4831ed[_0x7d11('0x44')]=_0x5cf6a6;return _0x4831ed;})[_0x7d11('0x43')](respondWithFilteredResult(_0x31866d,_0xba4e80))[_0x7d11('0x45')](handleError(_0x31866d,null));};exports[_0x7d11('0x46')]=function(_0x2a0c2f,_0x29da73){var _0x4d81ea={'raw':![],'where':{'id':_0x2a0c2f['params']['id']}},_0x5935ff={};_0x5935ff[_0x7d11('0x33')]=_[_0x7d11('0x47')](db[_0x7d11('0x30')][_0x7d11('0x48')]);_0x5935ff[_0x7d11('0x34')]=_['keys'](_0x2a0c2f[_0x7d11('0x34')]);_0x5935ff[_0x7d11('0x35')]=_['intersection'](_0x5935ff[_0x7d11('0x33')],_0x5935ff[_0x7d11('0x34')]);_0x4d81ea[_0x7d11('0x37')]=_['intersection'](_0x5935ff[_0x7d11('0x33')],qs[_0x7d11('0x38')](_0x2a0c2f[_0x7d11('0x34')]['fields']));_0x4d81ea[_0x7d11('0x37')]=_0x4d81ea['attributes'][_0x7d11('0x49')]?_0x4d81ea[_0x7d11('0x37')]:_0x5935ff[_0x7d11('0x33')];if(_0x2a0c2f[_0x7d11('0x34')][_0x7d11('0x41')]){_0x4d81ea[_0x7d11('0x42')]=[{'all':!![]}];}_0x4d81ea=_[_0x7d11('0x3e')]({},_0x4d81ea,_0x2a0c2f[_0x7d11('0x40')]);return db[_0x7d11('0x30')]['find'](_0x4d81ea)['then'](handleEntityNotFound(_0x29da73,null))['then'](respondWithResult(_0x29da73,null))[_0x7d11('0x45')](handleError(_0x29da73,null));};exports[_0x7d11('0x4a')]=function(_0x20297a,_0x18ae0e){return db[_0x7d11('0x30')][_0x7d11('0x4a')](_0x20297a[_0x7d11('0x4b')],{})[_0x7d11('0x43')](respondWithResult(_0x18ae0e,0xc9))[_0x7d11('0x45')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x4c')]=function(_0x46450e,_0x23b340){var _0x47e46d={'where':{'id':_0x46450e[_0x7d11('0x4d')]['id']}},_0x2f5b03={};_0x2f5b03[_0x7d11('0x33')]=_['keys'](db['UserProfile'][_0x7d11('0x48')]);_0x47e46d[_0x7d11('0x37')]=_[_0x7d11('0x36')](_0x2f5b03['model'],qs['fields'](_0x46450e[_0x7d11('0x34')][_0x7d11('0x38')]));_0x47e46d['attributes']=_0x47e46d[_0x7d11('0x37')][_0x7d11('0x49')]?_0x47e46d[_0x7d11('0x37')]:_0x2f5b03[_0x7d11('0x33')];if(_0x46450e['query'][_0x7d11('0x41')]){_0x47e46d[_0x7d11('0x42')]=[{'all':!![]}];}_0x47e46d=_[_0x7d11('0x3e')]({},_0x47e46d,_0x46450e['options']);return db['UserProfile'][_0x7d11('0x4e')](_0x47e46d)[_0x7d11('0x43')](handleEntityNotFound(_0x23b340,null))[_0x7d11('0x43')](function(_0x1129db){if(_0x1129db){var _0x2d873f=_0x1129db['get']({'plain':!![]});_0x2d873f=qs[_0x7d11('0x4f')](_0x2d873f,['id',_0x7d11('0x50'),_0x7d11('0x51'),_0x7d11('0x52')]);_0x46450e['body']=_['omit'](_0x46450e[_0x7d11('0x4b')],['id',_0x7d11('0x50'),_0x7d11('0x51')]);return db[_0x7d11('0x53')][_0x7d11('0x54')](function(_0x959600){return db[_0x7d11('0x30')][_0x7d11('0x4a')](_[_0x7d11('0x3e')](_0x2d873f,_0x46450e[_0x7d11('0x4b')]),{'include':_0x46450e['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x959600})['then'](function(_0x2b5534){var _0xbb3072=_0x2b5534[_0x7d11('0x55')]({'plain':!![]});return db['UserProfileSection'][_0x7d11('0x56')]({'where':{'userProfileId':_0x46450e[_0x7d11('0x4d')]['id']},'raw':!![]})[_0x7d11('0x43')](function(_0x32937c){if(_0x32937c){return BPromise[_0x7d11('0x57')](_0x32937c,function(_0x178a3a){return new BPromise(function(_0x505573,_0xef9bbc){if(_0x178a3a[_0x7d11('0x58')]===null||_0x178a3a[_0x7d11('0x58')]===0x1)_0x505573(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x178a3a['id']},'raw':!![]})['then'](function(_0x5a88f4){var _0x3ce636=_['map'](_0x5a88f4,function(_0x4e7295){return qs['omit'](_0x4e7295,['id',_0x7d11('0x50'),_0x7d11('0x51'),_0x7d11('0x59')]);});_0x505573(_0x3ce636);})[_0x7d11('0x45')](function(_0xf0999c){_0xef9bbc(_0xf0999c);});})[_0x7d11('0x43')](function(_0x597c56){var _0xfa439a=qs['omit'](_0x178a3a,['id',_0x7d11('0x50'),'updatedAt']);_0xfa439a[_0x7d11('0x5a')]=_0xbb3072['id'];if(_0x597c56)_0xfa439a[_0x7d11('0x5b')]=_0x597c56;return _0xfa439a;})['then'](function(_0x3448bd){return db[_0x7d11('0x5c')][_0x7d11('0x4a')](_0x3448bd,{'include':[{'model':db[_0x7d11('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x959600});});})['then'](function(){return _0xbb3072;});}});});});}})[_0x7d11('0x43')](respondWithResult(_0x23b340,0xc9))[_0x7d11('0x45')](handleError(_0x23b340,null));};exports[_0x7d11('0x29')]=function(_0x4027f8,_0x458362){if(_0x4027f8['body']['id']){delete _0x4027f8[_0x7d11('0x4b')]['id'];}return db['UserProfile'][_0x7d11('0x4e')]({'where':{'id':_0x4027f8[_0x7d11('0x4d')]['id']}})[_0x7d11('0x43')](handleEntityNotFound(_0x458362,null))[_0x7d11('0x43')](saveUpdates(_0x4027f8['body'],null))[_0x7d11('0x43')](respondWithResult(_0x458362,null))['catch'](handleError(_0x458362,null));};exports[_0x7d11('0x2a')]=function(_0x366f5e,_0x19015f){return db[_0x7d11('0x30')][_0x7d11('0x4e')]({'where':{'id':_0x366f5e[_0x7d11('0x4d')]['id']}})[_0x7d11('0x43')](handleEntityNotFound(_0x19015f,null))[_0x7d11('0x43')](removeEntity(_0x19015f,null))[_0x7d11('0x45')](handleError(_0x19015f,null));};exports[_0x7d11('0x5e')]=function(_0x45cf67,_0x850e26){return db[_0x7d11('0x30')][_0x7d11('0x5e')]()['then'](respondWithResult(_0x850e26,null))[_0x7d11('0x45')](handleError(_0x850e26,null));};exports['addSections']=function(_0x371869,_0x4c113b){var _0x3da948=_0x371869[_0x7d11('0x4b')];return db[_0x7d11('0x30')][_0x7d11('0x4e')]({'where':{'id':_0x371869['params']['id']}})['then'](handleEntityNotFound(_0x4c113b,null))[_0x7d11('0x43')](function(_0x15938b){if(_0x15938b){return db[_0x7d11('0x53')]['transaction'](function(_0x2e552c){return db[_0x7d11('0x5c')][_0x7d11('0x2a')]({'where':{'userProfileId':_0x371869[_0x7d11('0x4d')]['id'],'sectionId':_[_0x7d11('0x2f')](_0x3da948,function(_0x241895){return _0x241895['sectionId'];})},'transaction':_0x2e552c})[_0x7d11('0x43')](function(){var _0x565951=_[_0x7d11('0x2f')](_0x3da948,function(_0x4c88c6){_0x4c88c6['userProfileId']=_0x371869[_0x7d11('0x4d')]['id'];return _0x4c88c6;});var _0x235658=[];return BPromise[_0x7d11('0x57')](_0x565951,function(_0x14ee15){return db[_0x7d11('0x5c')][_0x7d11('0x4a')](_0x14ee15,{'include':[{'model':db[_0x7d11('0x5d')],'as':_0x7d11('0x5b')}],'raw':!![],'transaction':_0x2e552c})[_0x7d11('0x43')](function(_0x1b8993){_0x235658[_0x7d11('0x5f')](_0x1b8993['get']({'plain':!![]}));});})[_0x7d11('0x43')](function(){return _0x235658;});});});}})['then'](function(_0x1af320){return _0x1af320;})[_0x7d11('0x43')](respondWithResult(_0x4c113b,null))[_0x7d11('0x45')](handleError(_0x4c113b,null));};exports[_0x7d11('0x60')]=function(_0x3af18d,_0x3a7f06){var _0x1f852a;return db['UserProfile']['find']({'where':{'id':_0x3af18d[_0x7d11('0x4d')]['id']},'attributes':['id',_0x7d11('0x2d')]})[_0x7d11('0x43')](handleEntityNotFound(_0x3a7f06,null))[_0x7d11('0x43')](function(_0x7edc36){if(_0x7edc36){_0x1f852a=_0x7edc36;return db['UserProfileSection'][_0x7d11('0x2a')]({'where':{'userProfileId':_0x3af18d['params']['id'],'sectionId':_0x3af18d[_0x7d11('0x34')][_0x7d11('0x61')]}});}})[_0x7d11('0x43')](function(){return _0x1f852a;})[_0x7d11('0x43')](respondWithStatusCode(_0x3a7f06,null))[_0x7d11('0x45')](handleError(_0x3a7f06,null));};exports[_0x7d11('0x62')]=function(_0x93cf5c,_0x342ebe){var _0x509d54=[];var _0x5c3482=[];return db[_0x7d11('0x5c')][_0x7d11('0x56')]({'where':{'userProfileId':_0x93cf5c[_0x7d11('0x4d')]['id']},'raw':!![]})['then'](function(_0x5be5b9){_0x509d54=_[_0x7d11('0x3f')](_0x5be5b9,function(_0x5d0f47){return _0x5d0f47[_0x7d11('0x63')]===0x1||_[_0x7d11('0x64')]([0x3eb,0x709],_0x5d0f47[_0x7d11('0x59')]);});if(!_[_0x7d11('0x65')](_0x509d54)){return _['map'](_0x509d54,function(_0x3805c7){return _0x3805c7[_0x7d11('0x59')];});}else{return;}})[_0x7d11('0x43')](function(_0x3ee9b4){if(_0x3ee9b4)_0x5c3482=_0x3ee9b4;if(_[_0x7d11('0x64')](_0x5c3482,0x64)){var _0xb9099d=_[_0x7d11('0x4e')](_0x509d54,{'sectionId':0x64});return hasDefaultDashboard(_0xb9099d)[_0x7d11('0x43')](function(_0x481e2f){return _[_0x7d11('0x2f')](_0x509d54,function(_0x390168){if(_0x390168[_0x7d11('0x59')]===0x64){_0x390168[_0x7d11('0x66')]=_0x481e2f;}return _0x390168;});});}else{return;}})[_0x7d11('0x43')](function(_0x5bccd5){if(_0x5bccd5)_0x509d54=_0x5bccd5;if(_[_0x7d11('0x64')](_0x5c3482,0x3eb)){var _0x1fa4e6=_[_0x7d11('0x4e')](_0x509d54,{'sectionId':0x3eb});return getCustomDashboards(_0x1fa4e6)[_0x7d11('0x43')](function(_0x177748){return _['map'](_0x509d54,function(_0x56ce8c){if(_0x1fa4e6['enabled']){if(_0x56ce8c[_0x7d11('0x59')]===0x3eb){_0x56ce8c['subsections']=_0x177748;}}else{if(_0x56ce8c[_0x7d11('0x59')]===0x64){_0x56ce8c['subsections']=_0x177748;}}return _0x56ce8c;});});}else{return;}})['then'](function(_0x3fad95){if(_0x3fad95)_0x509d54=_0x3fad95;if(_[_0x7d11('0x64')](_0x5c3482,0x709)){var _0x29a42e=_[_0x7d11('0x4e')](_0x509d54,{'sectionId':0x709});return getPlugins(_0x29a42e)[_0x7d11('0x43')](function(_0x32a17a){if(_0x29a42e[_0x7d11('0x63')]){return _[_0x7d11('0x2f')](_0x509d54,function(_0xd0d599){if(_0xd0d599[_0x7d11('0x59')]===0x709){_0xd0d599['subsections']=_0x32a17a;}return _0xd0d599;});}else{var _0xfdfcb7={'sectionId':0x76c,'enabled':0x1,'subsections':_0x32a17a};var _0x19fb37=_['map'](_0x509d54);_0x19fb37[_0x7d11('0x5f')](_0xfdfcb7);return _0x19fb37;}});}else{return;}})[_0x7d11('0x43')](function(_0x19e4a9){if(_0x19e4a9)_0x509d54=_0x19e4a9;return _[_0x7d11('0x3f')](_0x509d54,['enabled',0x1]);})['then'](respondWithResult(_0x342ebe,null))[_0x7d11('0x45')](handleError(_0x342ebe,null));};function hasDefaultDashboard(_0x55b723){var _0xb576ec=[0x65];return new BPromise(function(_0x471bf4,_0xa4317f){try{if(_0x55b723[_0x7d11('0x58')]){_0x471bf4(_0xb576ec);}else{return db[_0x7d11('0x5d')][_0x7d11('0x67')]({'where':{'sectionId':_0x55b723['id']},'raw':!![]})[_0x7d11('0x43')](function(_0x596228){_0x596228?_0x471bf4(_0xb576ec):_0x471bf4();});}}catch(_0x3381e0){_0xa4317f(_0x3381e0);}});}function getCustomDashboards(_0x3212fa){var _0x22121e=[];return new BPromise(function(_0x402efb,_0x5bb85d){try{if(_0x3212fa[_0x7d11('0x58')]){return db[_0x7d11('0x68')]['findAll']({'raw':!![]})[_0x7d11('0x43')](function(_0x41c318){_0x41c318[_0x7d11('0x69')](function(_0x512086){_0x22121e[_0x7d11('0x5f')](_0x512086['id']+0x1869f);});_0x402efb(_0x22121e);});}else{return db[_0x7d11('0x5d')]['findAll']({'where':{'sectionId':_0x3212fa['id']},'raw':!![]})[_0x7d11('0x43')](function(_0x43082b){_0x43082b['forEach'](function(_0x3ee2ee){_0x22121e['push'](_0x3ee2ee['resourceId']+0x1869f);});_0x402efb(_0x22121e);});}}catch(_0x4ba3f6){_0x5bb85d(_0x4ba3f6);}});}function getPlugins(_0x4e5452){var _0x526e65=[];return new BPromise(function(_0x454789,_0x265c48){try{if(_0x4e5452[_0x7d11('0x58')]){return db[_0x7d11('0x6a')][_0x7d11('0x56')]({'raw':!![]})[_0x7d11('0x43')](function(_0x1a2df6){_0x1a2df6[_0x7d11('0x69')](function(_0x2e9b8b){_0x526e65['push'](_0x2e9b8b['id']+0x15b38);});_0x454789(_0x526e65);});}else{return db['UserProfileResource'][_0x7d11('0x56')]({'where':{'sectionId':_0x4e5452['id']},'raw':!![]})[_0x7d11('0x43')](function(_0x57a6a1){_0x57a6a1['forEach'](function(_0xe88ace){_0x526e65[_0x7d11('0x5f')](_0xe88ace[_0x7d11('0x6b')]+0x15b38);});_0x454789(_0x526e65);});}}catch(_0x391d7){_0x265c48(_0x391d7);}});}exports['addResources']=function(_0x542596,_0x4890ab){return db[_0x7d11('0x30')][_0x7d11('0x4e')]({'where':{'id':_0x542596[_0x7d11('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4890ab,null))[_0x7d11('0x43')](function(_0x238cfd){if(_0x238cfd){return db['sequelize'][_0x7d11('0x54')](function(_0x1cb457){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x542596[_0x7d11('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x7d11('0x43')](function(_0x5e0905){if(_0x5e0905){return db['UserProfileSection'][_0x7d11('0x2a')]({'where':{'userProfileId':_0x542596[_0x7d11('0x4d')]['id'],'id':_[_0x7d11('0x2f')](_0x5e0905,function(_0x2aa13b){return _0x2aa13b['id'];})},'transaction':_0x1cb457});}})['then'](function(_0x411f81){var _0x2cfa77=_[_0x7d11('0x2f')](_0x542596[_0x7d11('0x4b')],function(_0x491d94){_0x491d94[_0x7d11('0x5a')]=_0x542596[_0x7d11('0x4d')]['id'];return _0x491d94;});return db[_0x7d11('0x5c')]['bulkCreate'](_0x2cfa77,{'raw':!![],'transaction':_0x1cb457});})[_0x7d11('0x43')](function(_0x548866){var _0x3b3a6b=_['filter'](_[_0x7d11('0x2f')](_0x548866,function(_0x4409a9){return _0x4409a9[_0x7d11('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x3b3a6b){return db[_0x7d11('0x5c')][_0x7d11('0x56')]({'where':{'userProfileId':_0x542596[_0x7d11('0x4d')]['id'],'sectionId':_['map'](_0x3b3a6b,function(_0x4d3861){return _0x4d3861[_0x7d11('0x59')];})},'attributes':['id',_0x7d11('0x59')],'raw':!![]})[_0x7d11('0x43')](function(_0x3c7760){var _0x57f89d=_[_0x7d11('0x2f')](_0x542596[_0x7d11('0x4b')],function(_0x30e9fa){_0x30e9fa[_0x7d11('0x5a')]=_0x542596['params']['id'];return _0x30e9fa;});return db[_0x7d11('0x5d')][_0x7d11('0x6c')](_0x57f89d,{'raw':!![],'transaction':_0x1cb457});});}})[_0x7d11('0x45')](handleError(_0x4890ab,null));});}})[_0x7d11('0x43')](function(_0x2e97e){var _0x21e965=_['map'](_0x2e97e,function(_0x6701af){return _0x6701af['get']({'plain':!![]});});})[_0x7d11('0x43')](respondWithResult(_0x4890ab,null))['catch'](handleError(_0x4890ab,null));};exports[_0x7d11('0x6d')]=function(_0x1c5c41,_0x42755e,_0x45f67f){return db[_0x7d11('0x30')][_0x7d11('0x4e')]({'where':{'id':_0x1c5c41[_0x7d11('0x4d')]['id']}})[_0x7d11('0x43')](handleEntityNotFound(_0x42755e,null))[_0x7d11('0x43')](function(_0x19f280){if(_0x19f280){return _0x19f280['removeResources'](_0x1c5c41[_0x7d11('0x34')]['ids']);}})[_0x7d11('0x43')](respondWithStatusCode(_0x42755e,null))[_0x7d11('0x45')](handleError(_0x42755e,null));};exports[_0x7d11('0x6e')]=function(_0x4367a5,_0x19c0dd){var _0x596685={};if(!_0x4367a5['query'][_0x7d11('0x6f')])throw new Error(_0x7d11('0x70'));if(!_0x4367a5['query'][_0x7d11('0x71')](_0x7d11('0x39'))){_0x596685[_0x7d11('0x22')]=qs[_0x7d11('0x22')](_0x4367a5[_0x7d11('0x34')]['limit']);_0x596685['offset']=qs['offset'](_0x4367a5['query'][_0x7d11('0x23')]);}return db[_0x7d11('0x30')]['find']({'where':{'id':_0x4367a5[_0x7d11('0x4d')]['id']}})[_0x7d11('0x43')](function(_0x1152b3){if(!_0x1152b3)throw new Error(_0x7d11('0x72')+_0x4367a5[_0x7d11('0x4d')]['id']);return db[_0x7d11('0x30')][_0x7d11('0x6e')](_0x4367a5);})[_0x7d11('0x43')](respondWithFilteredResult(_0x19c0dd,_0x596685))['catch'](handleError(_0x19c0dd,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a535a2c..9834f72 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 _0x5496=['setMaxListeners','save','remove','hasOwnProperty','hook','events','../../mysqldb','UserProfile'];(function(_0x82fb07,_0x412388){var _0x2aaeff=function(_0x134a8c){while(--_0x134a8c){_0x82fb07['push'](_0x82fb07['shift']());}};_0x2aaeff(++_0x412388);}(_0x5496,0x175));var _0x6549=function(_0x42f364,_0x28846c){_0x42f364=_0x42f364-0x0;var _0x5689e0=_0x5496[_0x42f364];return _0x5689e0;};'use strict';var EventEmitter=require(_0x6549('0x0'));var UserProfile=require(_0x6549('0x1'))['db'][_0x6549('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6549('0x3')](0x0);var events={'afterCreate':_0x6549('0x4'),'afterUpdate':'update','afterDestroy':_0x6549('0x5')};function emitEvent(_0x4de1db){return function(_0x2d2155,_0x8112c5,_0x3750cc){UserProfileEvents['emit'](_0x4de1db+':'+_0x2d2155['id'],_0x2d2155);UserProfileEvents['emit'](_0x4de1db,_0x2d2155);_0x3750cc(null);};}for(var e in events){if(events[_0x6549('0x6')](e)){var event=events[e];UserProfile[_0x6549('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x4279=['update','remove','emit','hook','exports','../../mysqldb','UserProfile','save'];(function(_0x2f965f,_0x100aca){var _0x73f2b9=function(_0x25705d){while(--_0x25705d){_0x2f965f['push'](_0x2f965f['shift']());}};_0x73f2b9(++_0x100aca);}(_0x4279,0x8d));var _0x9427=function(_0x1bc9ff,_0x23451e){_0x1bc9ff=_0x1bc9ff-0x0;var _0x23e006=_0x4279[_0x1bc9ff];return _0x23e006;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x9427('0x0'))['db'][_0x9427('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9427('0x2'),'afterUpdate':_0x9427('0x3'),'afterDestroy':_0x9427('0x4')};function emitEvent(_0x32d94e){return function(_0x54cdfb,_0x426911,_0x57f12b){UserProfileEvents[_0x9427('0x5')](_0x32d94e+':'+_0x54cdfb['id'],_0x54cdfb);UserProfileEvents[_0x9427('0x5')](_0x32d94e,_0x54cdfb);_0x57f12b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x9427('0x6')](e,emitEvent(event));}}module[_0x9427('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1c92d10..ea6b726 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 _0x5f2f=['whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','VoiceQueue','VoiceQueues','users','telephones','Users','role','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','UserProfile','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','union','length','ignore','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','custom','count','rows','ids','CmContact','Tags','tag','ThroughTags','true','sms','dataValues','fax','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','associatedResources','map','field','then','name','catch','resolve','UserProfileResource','type','resourceId','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','Agents','membername','agent','Telephones','User','telephone','queue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount'];(function(_0x27f4f8,_0xbb1dbe){var _0x50944d=function(_0x12d604){while(--_0x12d604){_0x27f4f8['push'](_0x27f4f8['shift']());}};_0x50944d(++_0xbb1dbe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5509ec,_0x484611){_0x5509ec=_0x5509ec-0x0;var _0x59de76=_0x5f2f[_0x5509ec];return _0x59de76;};'use strict';var _=require(_0xf5f2('0x0'));var attributes=require(_0xf5f2('0x1'));var qs=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));module[_0xf5f2('0x4')]=function(_0x174bc7){var _0x3c72ee=_0x174bc7[_0xf5f2('0x5')];function _0x501fbd(_0x4854b6,_0x1665c7){return new Promise(function(_0x192215,_0xad7f65){if(!_0x1665c7)return _0x192215(null);var _0x3eebf6=_0x1665c7[_0xf5f2('0x6')]?{[_0x1665c7[_0xf5f2('0x6')]['field']]:_0x1665c7[_0xf5f2('0x6')][_0xf5f2('0x7')]}:undefined;return _0x3c72ee[_0x4854b6][_0xf5f2('0x8')]({'where':_0x3eebf6,'raw':!![]})['then'](function(_0x375da4){_0x1665c7[_0xf5f2('0x9')]=_[_0xf5f2('0xa')](_0x375da4,'id');_0x192215(_0x1665c7);})['catch'](function(_0x977a59){_0xad7f65(_0x977a59);});});}function _0x4ebbbe(_0x53fb33,_0xa7e1a6){return new Promise(function(_0x151aba,_0x4b78cd){var _0x336f6b=_0x53fb33[_0xf5f2('0x6')]?{[_0x53fb33[_0xf5f2('0x6')][_0xf5f2('0xb')]]:_0x53fb33[_0xf5f2('0x6')][_0xf5f2('0x7')]}:undefined;return _0x3c72ee[_0x53fb33['model']][_0xf5f2('0x8')]({'where':_0x336f6b,'raw':!![]})[_0xf5f2('0xc')](function(_0x269909){_0xa7e1a6[_0xf5f2('0x9')]=_[_0xf5f2('0xa')](_0x269909,function(_0x4d97fc){return _0x4d97fc[_0xf5f2('0xd')];});_0x151aba(_0xa7e1a6);})[_0xf5f2('0xe')](function(_0x17d656){_0x4b78cd(_0x17d656);});});}function _0x1b6dd2(_0x23e23a,_0x3a9dbb,_0xdb61b3){if(!_0x3a9dbb)return Promise[_0xf5f2('0xf')](null);return new Promise(function(_0x11f702,_0x228ace){return _0x3c72ee[_0xf5f2('0x10')][_0xf5f2('0x8')]({'where':{'sectionId':_0x3a9dbb['id']},'raw':!![]})[_0xf5f2('0xc')](function(_0x3ee69){if(_0x23e23a[_0xf5f2('0xb')]&&_0x23e23a[_0xf5f2('0xb')]!=='id'){_0x3a9dbb[_0xf5f2('0x9')]=_['map'](_0x3ee69,function(_0x34706d){return _0x34706d[_0x23e23a[_0xf5f2('0xb')]];});}else{if(_0xdb61b3==='AnalyticExtractedReport'){_0x3a9dbb['associatedResources']=_[_0xf5f2('0xa')](_0x3ee69,function(_0x388e6c){return{'id':_0x388e6c['resourceId'],'type':_0x388e6c[_0xf5f2('0x11')]};});}else{_0x3a9dbb[_0xf5f2('0x9')]=_[_0xf5f2('0xa')](_0x3ee69,function(_0x39c024){return _0x39c024[_0xf5f2('0x12')];});}}_0x11f702(_0x3a9dbb);})['catch'](function(_0x21cd91){_0x228ace(_0x21cd91);});});}function _0x4669a6(_0x4e8bda,_0x2833fe){var _0x287ad5={'parentSections':[]};switch(_0x4e8bda['toLowerCase']()){case'squareprojects':_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x14');break;case _0xf5f2('0x15'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x16');break;case _0xf5f2('0x17'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x18');_0x287ad5[_0xf5f2('0x19')]=[{'name':'SquareProjects','field':_0xf5f2('0xd'),'foreignKey':_0xf5f2('0x1a')}];break;case _0xf5f2('0x1b'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x1c');break;case _0xf5f2('0x1d'):_0x287ad5['childModel']='CmContact';_0x287ad5[_0xf5f2('0x19')]=[{'name':_0xf5f2('0x1e'),'field':'id','foreignKey':_0xf5f2('0x1f')}];break;case'lists':_0x287ad5['childModel']=_0xf5f2('0x20');break;case _0xf5f2('0x21'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x22');break;case _0xf5f2('0x23'):_0x287ad5['childModel']='CmCustomField';break;case _0xf5f2('0x24'):_0x287ad5['childModel']=_0xf5f2('0x25');break;case'chatwebsites':_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x26');break;case _0xf5f2('0x27'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x28');break;case _0xf5f2('0x29'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x2a');break;case'inboundroutes':case _0xf5f2('0x2b'):case _0xf5f2('0x2c'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x2d');break;case _0xf5f2('0x2e'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x2f');break;case'voicemails':_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x30');break;case'voicerecordings':_0x287ad5[_0xf5f2('0x13')]='VoiceRecording';_0x287ad5[_0xf5f2('0x19')]=[{'name':_0xf5f2('0x31'),'field':_0xf5f2('0xd'),'foreignKey':_0xf5f2('0x32'),'model':'User','filter':{'field':'role','value':[_0xf5f2('0x33')]}},{'name':_0xf5f2('0x34'),'field':_0xf5f2('0xd'),'foreignKey':'membername','model':_0xf5f2('0x35'),'filter':{'field':'role','value':[_0xf5f2('0x36')]}},{'name':'VoiceQueues','field':_0xf5f2('0xd'),'foreignKey':_0xf5f2('0x37'),'model':'VoiceQueue','filter':{'field':_0xf5f2('0x11'),'value':[_0xf5f2('0x38')]}},{'name':_0xf5f2('0x39'),'field':_0xf5f2('0xd'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xf5f2('0x11'),'value':[_0xf5f2('0x3a')]}}];break;case _0xf5f2('0x3b'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x3c');break;case _0xf5f2('0x3d'):_0x287ad5[_0xf5f2('0x13')]='VoiceChanSpy';break;case _0xf5f2('0x3e'):_0x287ad5[_0xf5f2('0x13')]='VoicePrefix';break;case _0xf5f2('0x3f'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x40');break;case _0xf5f2('0x41'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x42');break;case _0xf5f2('0x43'):_0x287ad5[_0xf5f2('0x13')]='MailAccount';break;case _0xf5f2('0x44'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x45');break;case'openchannelqueues':_0x287ad5['childModel']='OpenchannelQueue';break;case _0xf5f2('0x46'):_0x287ad5[_0xf5f2('0x13')]='OpenchannelAccount';break;case _0xf5f2('0x47'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x48');break;case _0xf5f2('0x49'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x4a');break;case _0xf5f2('0x4b'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x4c');break;case _0xf5f2('0x4d'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x4e');break;case _0xf5f2('0x4f'):_0x287ad5[_0xf5f2('0x13')]='Team';break;case _0xf5f2('0x50'):case'queuecampaigns':_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x51');if(_0x2833fe){_0x287ad5[_0xf5f2('0x19')]=[{'name':_0xf5f2('0x52')},{'name':_0xf5f2('0x39')}];}break;case _0xf5f2('0x53'):case'agents':case _0xf5f2('0x54'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x35');if(_0x2833fe){_0x287ad5[_0xf5f2('0x19')]=[{'name':_0xf5f2('0x55'),'filter':{'field':_0xf5f2('0x56'),'value':[_0xf5f2('0x57'),_0xf5f2('0x58')]},'ignore':!![]},{'name':'Agents'},{'name':_0xf5f2('0x34')}];}break;case _0xf5f2('0x59'):_0x287ad5[_0xf5f2('0x13')]='ZendeskAccount';break;case _0xf5f2('0x5a'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x5b');break;case'freshdeskaccounts':_0x287ad5['childModel']=_0xf5f2('0x5c');break;case _0xf5f2('0x5d'):_0x287ad5['childModel']=_0xf5f2('0x5e');break;case'deskaccounts':_0x287ad5[_0xf5f2('0x13')]='DeskAccount';break;case _0xf5f2('0x5f'):_0x287ad5['childModel']=_0xf5f2('0x60');break;case _0xf5f2('0x61'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x35');break;case'cannedanswers':_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x62');break;case'dispositions':_0x287ad5['childModel']=_0xf5f2('0x63');break;case _0xf5f2('0x64'):_0x287ad5['childModel']=_0xf5f2('0x65');break;case _0xf5f2('0x66'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x67');break;case'pauses':_0x287ad5['childModel']=_0xf5f2('0x68');break;case _0xf5f2('0x69'):_0x287ad5['childModel']=_0xf5f2('0x6a');break;case _0xf5f2('0x6b'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x6c');break;case _0xf5f2('0x6d'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x6e');break;case'templates':_0x287ad5['childModel']=_0xf5f2('0x6f');break;case _0xf5f2('0x70'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x71');break;case _0xf5f2('0x72'):_0x287ad5['childModel']=_0xf5f2('0x73');break;case _0xf5f2('0x74'):_0x287ad5[_0xf5f2('0x13')]='Variable';break;case _0xf5f2('0x75'):_0x287ad5['childModel']=_0xf5f2('0x76');break;case _0xf5f2('0x77'):_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x78');_0x287ad5['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xf5f2('0x79')}];break;case'metrics':_0x287ad5[_0xf5f2('0x13')]=_0xf5f2('0x7a');break;}return _0x287ad5;}function _0x572ec1(_0x3f0579,_0xa4c0be){var _0x2a8f6d=_0x3f0579['charAt'](0x0)[_0xf5f2('0x7b')]()+_0x3f0579[_0xf5f2('0x7c')](0x1);var _0x42cc27={'type':_0x3c72ee[_0xf5f2('0x7d')]['QueryTypes'][_0xf5f2('0x7e')],'raw':!![]};return new Promise(function(_0x506fe5,_0x2cbe1e){var _0x2a773d=squel[_0xf5f2('0x7f')]()[_0xf5f2('0xb')](_0xf5f2('0x80')+_0x2a8f6d+'InteractionId','id')[_0xf5f2('0xb')](_0xf5f2('0x81'))[_0xf5f2('0x82')](_0xf5f2('0x83')+_0x3f0579+_0xf5f2('0x84'),'ui')['where'](_0xf5f2('0x85'),_0xa4c0be['id']);return _0x3c72ee['sequelize']['query'](_0x2a773d[_0xf5f2('0x86')](),_0x42cc27)['then'](function(_0x10f2b8){_0xa4c0be[_0x2a8f6d+_0xf5f2('0x87')]=_0x10f2b8;_0x506fe5(_0x10f2b8);})[_0xf5f2('0xe')](function(_0x123b93){_0x2cbe1e(_0x123b93);});});}return _0x174bc7['define'](_0xf5f2('0x88'),attributes,{'tableName':_0xf5f2('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1ec682){var _0x18c41f={'raw':_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0x8b')],'where':{}};var _0x158768={};var _0x4a7be9={'count':0x0,'rows':[]};var _0x1f55af=_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0x8c')];var _0x45c7c1=_0x1ec682['query'][_0xf5f2('0x8d')]||![];var _0x4cce08=_0x4669a6(_0x1f55af,_0x45c7c1);if(!_0x4cce08[_0xf5f2('0x13')])throw new Error(_0xf5f2('0x8e')+_0x1f55af+'\x27');var _0x5588cf=[{'name':_0x1f55af}];if(!_[_0xf5f2('0x8f')](_0x4cce08[_0xf5f2('0x19')]))_0x5588cf=_0x4cce08[_0xf5f2('0x19')];var _0x138c55=[];for(var _0x146462=0x0;_0x146462<_0x5588cf['length'];_0x146462++){_0x138c55[_0xf5f2('0x90')](_0x3c72ee[_0xf5f2('0x91')][_0xf5f2('0x92')]({'where':{'userProfileId':_0x1ec682[_0xf5f2('0x93')]['id'],'name':_0x5588cf[_0x146462][_0xf5f2('0xd')]},'raw':!![]}));}return Promise[_0xf5f2('0x94')](_0x138c55)['then'](function(_0x321d4d){var _0x3f475e=_['filter'](_0x321d4d,function(_0x3f677e){return _0x3f677e?_0x3f677e:undefined;});var _0x36503c=_[_0xf5f2('0x6')](_0x5588cf,['ignore',!![]]);var _0x551cc9=_['isEmpty'](_0x3f475e)&&_[_0xf5f2('0x8f')](_0x36503c)?null:_[_0xf5f2('0x95')](_0x36503c,_0x3f475e);if(!_0x551cc9)return null;var _0x35f6a2=[];for(var _0x450691=0x0;_0x450691<_0x551cc9[_0xf5f2('0x96')];_0x450691++){var _0x4d878e=_[_0xf5f2('0x92')](_0x5588cf,function(_0x3a98b4){return _0x551cc9[_0x450691]?_0x3a98b4[_0xf5f2('0xd')]===_0x551cc9[_0x450691][_0xf5f2('0xd')]:null;});if(_0x4d878e){if(_0x551cc9[_0x450691][_0xf5f2('0x97')]){_0x35f6a2[_0xf5f2('0x90')](_0x501fbd(_0x4cce08[_0xf5f2('0x13')],_0x551cc9[_0x450691]));}else{if(!_0x551cc9[_0x450691][_0xf5f2('0x98')]){_0x35f6a2[_0xf5f2('0x90')](_0x1b6dd2(_0x4d878e,_0x551cc9[_0x450691],_0x4cce08[_0xf5f2('0x13')]));}else{if(_0x4d878e[_0xf5f2('0x99')]){_0x35f6a2['push'](_0x4ebbbe(_0x4d878e,_0x551cc9[_0x450691]));}}}}}return Promise['all'](_0x35f6a2);})['then'](function(_0x40f362){var _0xafba8e=_0x40f362;var _0x3d3181=null;if(_0xafba8e){_0x3d3181=_0xafba8e[_0xf5f2('0x96')]===0x1?_0xafba8e[0x0]:null;}if(!_0x3d3181&&!_0xafba8e)return _0x4a7be9;var _0x1bb752=_0x3c72ee[_0x4cce08['childModel']][_0xf5f2('0x9a')];_0x158768[_0xf5f2('0x99')]=_[_0xf5f2('0x9b')](_0x1bb752);_0x158768[_0xf5f2('0x8a')]=_[_0xf5f2('0x9b')](_0x1ec682['query']);_0x158768[_0xf5f2('0x9c')]=_[_0xf5f2('0x9d')](_0x158768['model'],_0x158768[_0xf5f2('0x8a')]);_0x18c41f[_0xf5f2('0x9e')]=_[_0xf5f2('0x9d')](_0x158768[_0xf5f2('0x99')],qs['fields'](_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0x9f')]));_0x18c41f[_0xf5f2('0x9e')]=_0x18c41f[_0xf5f2('0x9e')][_0xf5f2('0x96')]?_0x18c41f['attributes']:_0x158768['model'];if(!_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0xa0')](_0xf5f2('0xa1'))){_0x18c41f[_0xf5f2('0xa2')]=qs['limit'](_0x1ec682['query'][_0xf5f2('0xa2')]);_0x18c41f['offset']=qs['offset'](_0x1ec682['query']['offset']);}_0x18c41f[_0xf5f2('0xa3')]=qs[_0xf5f2('0xa4')](_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0xa4')]);_0x18c41f[_0xf5f2('0xa5')]=qs[_0xf5f2('0x9c')](_[_0xf5f2('0xa6')](_0x1ec682[_0xf5f2('0x8a')],_0x158768[_0xf5f2('0x9c')]));if(_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0x6')]){_0x18c41f[_0xf5f2('0xa5')]=_[_0xf5f2('0xa7')](_0x18c41f[_0xf5f2('0xa5')],{'$or':_[_0xf5f2('0xa')](_0x1bb752,function(_0x21da15){if(_0x21da15[_0xf5f2('0x11')][_0xf5f2('0xa8')]!=='VIRTUAL'){var _0xe7ac8={};_0xe7ac8[_0x21da15[_0xf5f2('0xb')]]={'$like':'%'+_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0x6')]+'%'};return _0xe7ac8;}})});}var _0x18c353=[];var _0x308220=null;var _0x16491c={};if(_0x3d3181){_0x308220=_[_0xf5f2('0x92')](_0x5588cf,['name',_0x3d3181[_0xf5f2('0xd')]]);if(_0x308220['field']){_0x16491c={};if(_0x4cce08['childModel']==='AnalyticExtractedReport'){_0x16491c[_0x308220['foreignKey']]=_['map'](_0x3d3181['associatedResources'],'id');}else{_0x16491c[_0x308220[_0xf5f2('0xa9')]]=_0x3d3181[_0xf5f2('0x9')];}_0x18c353[_0xf5f2('0x90')](_0x16491c);}else{_0x18c41f[_0xf5f2('0xa5')]['id']=_0x3d3181[_0xf5f2('0x9')];}}else{for(var _0x3cf857=0x0;_0x3cf857<_0xafba8e['length'];_0x3cf857++){_0x308220=_['find'](_0x5588cf,[_0xf5f2('0xd'),_0xafba8e[_0x3cf857]['name']]);if(_0x308220[_0xf5f2('0xb')]){_0x16491c={};_0x16491c[_0x308220[_0xf5f2('0xa9')]]=_0xafba8e[_0x3cf857]['associatedResources'];_0x18c353['push'](_0x16491c);}else{if(!_0x18c41f[_0xf5f2('0xa5')]['id'])_0x18c41f[_0xf5f2('0xa5')]['id']=[];_0xafba8e[_0x3cf857]['associatedResources'][_0xf5f2('0xaa')](function(_0x388b32){_0x18c41f['where']['id'][_0xf5f2('0x90')](_0x388b32);});}}}if(!_[_0xf5f2('0x8f')](_0x18c353)){_0x18c41f[_0xf5f2('0xa5')]=_['merge'](_0x18c41f[_0xf5f2('0xa5')],{'$and':{'$or':_0x18c353}});}_0x18c41f=_[_0xf5f2('0xa7')]({},_0x18c41f,_0x1ec682[_0xf5f2('0xab')]);if(_0x3d3181&&!_0x3d3181[_0xf5f2('0x98')]&&_0x4cce08[_0xf5f2('0x13')]===_0xf5f2('0x78')){if(_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0xac')]){_0x18c41f[_0xf5f2('0xad')]=[{'all':!![]}];}return _0x3c72ee[_0x4cce08[_0xf5f2('0x13')]][_0xf5f2('0x8')](_0x18c41f)[_0xf5f2('0xc')](function(_0x6f9240){var _0x407dd8=[];_0x6f9240[_0xf5f2('0xaa')](function(_0x28b9cd){var _0x1902c6;switch(_0x28b9cd[_0xf5f2('0xae')]){case _0xf5f2('0xaf'):_0x1902c6=_[_0xf5f2('0x92')](_0x3d3181[_0xf5f2('0x9')],function(_0x533aff){return _0x533aff['id']===_0x28b9cd[_0xf5f2('0x79')]&&_0x533aff[_0xf5f2('0x11')]==='DefaultReports';});break;case _0xf5f2('0xb0'):_0x1902c6=_[_0xf5f2('0x92')](_0x3d3181['associatedResources'],function(_0xb56304){return _0xb56304['id']===_0x28b9cd[_0xf5f2('0x79')]&&_0xb56304[_0xf5f2('0x11')]==='CustomReports';});break;}if(_0x1902c6)_0x407dd8['push'](_0x28b9cd);});_0x4a7be9[_0xf5f2('0xb1')]=_0x407dd8[_0xf5f2('0x96')];_0x4a7be9[_0xf5f2('0xb2')]=_0x407dd8;return _0x4a7be9;});}else{if(!_['isEmpty'](_0x1ec682['query'][_0xf5f2('0xb3')])){_0x18c41f[_0xf5f2('0xa5')]['id']=_0x18c41f[_0xf5f2('0xa5')]['id']?_['intersection'](_0x18c41f['where']['id'],_0x1ec682['query']['ids']):_0x1ec682['query'][_0xf5f2('0xb3')];}return _0x3c72ee[_0x4cce08['childModel']][_0xf5f2('0xb1')]({'where':_0x18c41f[_0xf5f2('0xa5')]})[_0xf5f2('0xc')](function(_0x43a167){_0x4a7be9[_0xf5f2('0xb1')]=_0x43a167;if(_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0xac')]){if(_0x4cce08[_0xf5f2('0x13')]===_0xf5f2('0xb4')){_0x18c41f[_0xf5f2('0xad')]=[{'model':_0x3c72ee[_0xf5f2('0x6e')],'as':_0xf5f2('0xb5'),'attributes':['id',_0xf5f2('0xd'),'color'],'required':_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0xb6')]?!![]:![]},{'model':_0x3c72ee['Tag'],'as':_0xf5f2('0xb7'),'attributes':['id',_0xf5f2('0xd'),'color'],'through':_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0xb6')]?{'attributes':[],'where':{'TagId':_0x1ec682[_0xf5f2('0x8a')]['tag']||undefined}}:{},'required':_0x1ec682[_0xf5f2('0x8a')][_0xf5f2('0xb6')]?!![]:![]}];}else{_0x18c41f['include']=[{'all':!![]}];}}return _0x3c72ee[_0x4cce08[_0xf5f2('0x13')]][_0xf5f2('0x8')](_0x18c41f);})[_0xf5f2('0xc')](function(_0x517aa8){_0x4a7be9[_0xf5f2('0xb2')]=_0x517aa8;if(_0x1f55af==='Agents'&&_0x1ec682[_0xf5f2('0x8a')]['openTabs']===_0xf5f2('0xb8')){var _0x3cbc58=[];for(var _0x120e2b=0x0;_0x120e2b<_0x4a7be9[_0xf5f2('0xb2')]['length'];_0x120e2b++){_0x3cbc58[_0xf5f2('0x90')](_0x572ec1('chat',_0x4a7be9['rows'][_0x120e2b]['dataValues']));_0x3cbc58[_0xf5f2('0x90')](_0x572ec1(_0xf5f2('0xb9'),_0x4a7be9['rows'][_0x120e2b][_0xf5f2('0xba')]));_0x3cbc58[_0xf5f2('0x90')](_0x572ec1(_0xf5f2('0xbb'),_0x4a7be9[_0xf5f2('0xb2')][_0x120e2b][_0xf5f2('0xba')]));_0x3cbc58[_0xf5f2('0x90')](_0x572ec1('mail',_0x4a7be9[_0xf5f2('0xb2')][_0x120e2b][_0xf5f2('0xba')]));_0x3cbc58['push'](_0x572ec1(_0xf5f2('0xbc'),_0x4a7be9[_0xf5f2('0xb2')][_0x120e2b]['dataValues']));_0x3cbc58[_0xf5f2('0x90')](_0x572ec1(_0xf5f2('0xbd'),_0x4a7be9[_0xf5f2('0xb2')][_0x120e2b][_0xf5f2('0xba')]));}return Promise[_0xf5f2('0x94')](_0x3cbc58)[_0xf5f2('0xc')](function(){return _0x4a7be9;});}return _0x4a7be9;});}});}}});}; \ No newline at end of file +var _0x781d=['JscriptyProject','contacts','parentSections','ListId','CmList','CmCompany','globalcustomfields','ChatQueue','chatwebsites','faxqueues','faxaccounts','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','Pause','scheduler','Schedule','Sound','tags','templates','Template','Trigger','Trunk','variables','Variable','plugins','extractedreports','reportId','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','mergeResources','Invalid\x20section\x20\x27','length','push','params','all','ignore','isEmpty','find','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','custom','CustomReports','count','ids','CmContact','Tag','Tags','color','tag','rows','true','chat','dataValues','sms','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','then','associatedResources','map','model','findAll','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projects'];(function(_0x3148ff,_0xa038c4){var _0xac222e=function(_0x13e1a3){while(--_0x13e1a3){_0x3148ff['push'](_0x3148ff['shift']());}};_0xac222e(++_0xa038c4);}(_0x781d,0x14a));var _0xd781=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x781d[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd781('0x0'));var attributes=require(_0xd781('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0xd781('0x2')]=function(_0x44a72d){var _0x3cd308=_0x44a72d[_0xd781('0x3')];function _0xfd915d(_0x42258e,_0x446534){return new Promise(function(_0x1d4f4e,_0x830b){if(!_0x446534)return _0x1d4f4e(null);var _0x2f98ee=_0x446534['filter']?{[_0x446534[_0xd781('0x4')][_0xd781('0x5')]]:_0x446534[_0xd781('0x4')][_0xd781('0x6')]}:undefined;return _0x3cd308[_0x42258e]['findAll']({'where':_0x2f98ee,'raw':!![]})[_0xd781('0x7')](function(_0x5c18c8){_0x446534[_0xd781('0x8')]=_[_0xd781('0x9')](_0x5c18c8,'id');_0x1d4f4e(_0x446534);})['catch'](function(_0x346756){_0x830b(_0x346756);});});}function _0x29c2a7(_0x4bf265,_0x4c2aab){return new Promise(function(_0x40a900,_0x28b74c){var _0x36f086=_0x4bf265[_0xd781('0x4')]?{[_0x4bf265[_0xd781('0x4')][_0xd781('0x5')]]:_0x4bf265[_0xd781('0x4')][_0xd781('0x6')]}:undefined;return _0x3cd308[_0x4bf265[_0xd781('0xa')]][_0xd781('0xb')]({'where':_0x36f086,'raw':!![]})[_0xd781('0x7')](function(_0x587953){_0x4c2aab[_0xd781('0x8')]=_[_0xd781('0x9')](_0x587953,function(_0x498674){return _0x498674[_0xd781('0xc')];});_0x40a900(_0x4c2aab);})['catch'](function(_0x294e5a){_0x28b74c(_0x294e5a);});});}function _0x22d787(_0x9f25f7,_0x1409dd,_0x42a9c1){if(!_0x1409dd)return Promise[_0xd781('0xd')](null);return new Promise(function(_0x501b0d,_0x5770b0){return _0x3cd308[_0xd781('0xe')][_0xd781('0xb')]({'where':{'sectionId':_0x1409dd['id']},'raw':!![]})[_0xd781('0x7')](function(_0x2f1273){if(_0x9f25f7[_0xd781('0x5')]&&_0x9f25f7[_0xd781('0x5')]!=='id'){_0x1409dd[_0xd781('0x8')]=_[_0xd781('0x9')](_0x2f1273,function(_0x5a5ff5){return _0x5a5ff5[_0x9f25f7[_0xd781('0x5')]];});}else{if(_0x42a9c1===_0xd781('0xf')){_0x1409dd[_0xd781('0x8')]=_[_0xd781('0x9')](_0x2f1273,function(_0x36d320){return{'id':_0x36d320[_0xd781('0x10')],'type':_0x36d320[_0xd781('0x11')]};});}else{_0x1409dd['associatedResources']=_[_0xd781('0x9')](_0x2f1273,function(_0x4e2c56){return _0x4e2c56['resourceId'];});}}_0x501b0d(_0x1409dd);})[_0xd781('0x12')](function(_0x568001){_0x5770b0(_0x568001);});});}function _0x175ba6(_0x101480,_0x395087){var _0x31bf57={'parentSections':[]};switch(_0x101480[_0xd781('0x13')]()){case _0xd781('0x14'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x16');break;case _0xd781('0x17'):_0x31bf57['childModel']='SquareOdbc';break;case _0xd781('0x18'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x19');_0x31bf57['parentSections']=[{'name':_0xd781('0x1a'),'field':'name','foreignKey':'projectName'}];break;case _0xd781('0x1b'):_0x31bf57['childModel']=_0xd781('0x1c');break;case _0xd781('0x1d'):_0x31bf57['childModel']='CmContact';_0x31bf57[_0xd781('0x1e')]=[{'name':'Lists','field':'id','foreignKey':_0xd781('0x1f')}];break;case'lists':_0x31bf57[_0xd781('0x15')]=_0xd781('0x20');break;case'companies':_0x31bf57['childModel']=_0xd781('0x21');break;case _0xd781('0x22'):_0x31bf57[_0xd781('0x15')]='CmCustomField';break;case'chatqueues':_0x31bf57[_0xd781('0x15')]=_0xd781('0x23');break;case _0xd781('0x24'):_0x31bf57['childModel']='ChatWebsite';break;case _0xd781('0x25'):_0x31bf57[_0xd781('0x15')]='FaxQueue';break;case _0xd781('0x26'):_0x31bf57[_0xd781('0x15')]='FaxAccount';break;case _0xd781('0x27'):case _0xd781('0x28'):case _0xd781('0x29'):_0x31bf57[_0xd781('0x15')]='VoiceExtension';break;case _0xd781('0x2a'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x2b');break;case _0xd781('0x2c'):_0x31bf57['childModel']=_0xd781('0x2d');break;case _0xd781('0x2e'):_0x31bf57['childModel']=_0xd781('0x2f');_0x31bf57['parentSections']=[{'name':_0xd781('0x30'),'field':_0xd781('0xc'),'foreignKey':'membername','model':_0xd781('0x31'),'filter':{'field':_0xd781('0x32'),'value':['agent']}},{'name':_0xd781('0x33'),'field':'name','foreignKey':_0xd781('0x34'),'model':_0xd781('0x31'),'filter':{'field':'role','value':[_0xd781('0x35')]}},{'name':_0xd781('0x36'),'field':'name','foreignKey':_0xd781('0x37'),'model':_0xd781('0x38'),'filter':{'field':_0xd781('0x11'),'value':['inbound']}},{'name':_0xd781('0x39'),'field':_0xd781('0xc'),'foreignKey':_0xd781('0x37'),'model':_0xd781('0x38'),'filter':{'field':_0xd781('0x11'),'value':[_0xd781('0x3a')]}}];break;case _0xd781('0x3b'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x3c');break;case'chanspies':_0x31bf57[_0xd781('0x15')]='VoiceChanSpy';break;case _0xd781('0x3d'):_0x31bf57[_0xd781('0x15')]='VoicePrefix';break;case _0xd781('0x3e'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x3f');break;case _0xd781('0x40'):_0x31bf57['childModel']=_0xd781('0x41');break;case'mailaccounts':_0x31bf57[_0xd781('0x15')]=_0xd781('0x42');break;case'mailsubstatuses':_0x31bf57['childModel']=_0xd781('0x43');break;case _0xd781('0x44'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x45');break;case'openchannelaccounts':_0x31bf57[_0xd781('0x15')]=_0xd781('0x46');break;case'smsqueues':_0x31bf57['childModel']=_0xd781('0x47');break;case _0xd781('0x48'):_0x31bf57[_0xd781('0x15')]='SmsAccount';break;case'whatsappqueues':_0x31bf57[_0xd781('0x15')]=_0xd781('0x49');break;case _0xd781('0x4a'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x4b');break;case _0xd781('0x4c'):_0x31bf57['childModel']='Team';break;case _0xd781('0x4d'):case _0xd781('0x4e'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x38');if(_0x395087){_0x31bf57[_0xd781('0x1e')]=[{'name':'VoiceQueues'},{'name':_0xd781('0x39')}];}break;case _0xd781('0x4f'):case _0xd781('0x50'):case'telephones':_0x31bf57[_0xd781('0x15')]=_0xd781('0x31');if(_0x395087){_0x31bf57[_0xd781('0x1e')]=[{'name':'Users','filter':{'field':_0xd781('0x32'),'value':[_0xd781('0x51'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xd781('0x33')}];}break;case _0xd781('0x52'):_0x31bf57[_0xd781('0x15')]='ZendeskAccount';break;case _0xd781('0x53'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x54');break;case _0xd781('0x55'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x56');break;case _0xd781('0x57'):_0x31bf57['childModel']=_0xd781('0x58');break;case _0xd781('0x59'):_0x31bf57[_0xd781('0x15')]='DeskAccount';break;case _0xd781('0x5a'):_0x31bf57[_0xd781('0x15')]='ZohoAccount';break;case _0xd781('0x5b'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x31');break;case _0xd781('0x5c'):_0x31bf57[_0xd781('0x15')]='CannedAnswer';break;case _0xd781('0x5d'):_0x31bf57['childModel']=_0xd781('0x5e');break;case'customdashboards':_0x31bf57[_0xd781('0x15')]=_0xd781('0x5f');break;case'intervals':_0x31bf57[_0xd781('0x15')]='Interval';break;case'pauses':_0x31bf57['childModel']=_0xd781('0x60');break;case _0xd781('0x61'):_0x31bf57['childModel']=_0xd781('0x62');break;case'sounds':_0x31bf57[_0xd781('0x15')]=_0xd781('0x63');break;case _0xd781('0x64'):_0x31bf57[_0xd781('0x15')]='Tag';break;case _0xd781('0x65'):_0x31bf57['childModel']=_0xd781('0x66');break;case'triggers':_0x31bf57[_0xd781('0x15')]=_0xd781('0x67');break;case'trunks':_0x31bf57[_0xd781('0x15')]=_0xd781('0x68');break;case _0xd781('0x69'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x6a');break;case _0xd781('0x6b'):_0x31bf57['childModel']='Plugin';break;case _0xd781('0x6c'):_0x31bf57[_0xd781('0x15')]=_0xd781('0xf');_0x31bf57[_0xd781('0x1e')]=[{'name':'Reports','field':'id','foreignKey':_0xd781('0x6d')}];break;case'metrics':_0x31bf57[_0xd781('0x15')]=_0xd781('0x6e');break;}return _0x31bf57;}function _0x5e527c(_0x2385fb,_0x4c8c50){var _0x53dae6=_0x2385fb[_0xd781('0x6f')](0x0)['toUpperCase']()+_0x2385fb[_0xd781('0x70')](0x1);var _0x1c9caa={'type':_0x3cd308[_0xd781('0x71')][_0xd781('0x72')][_0xd781('0x73')],'raw':!![]};return new Promise(function(_0x49b84f,_0x34bdba){var _0x1c0023=squel['select']()[_0xd781('0x5')](_0xd781('0x74')+_0x53dae6+_0xd781('0x75'),'id')[_0xd781('0x5')](_0xd781('0x76'))[_0xd781('0x77')](_0xd781('0x78')+_0x2385fb+_0xd781('0x79'),'ui')[_0xd781('0x7a')](_0xd781('0x7b'),_0x4c8c50['id']);return _0x3cd308[_0xd781('0x7c')][_0xd781('0x7d')](_0x1c0023[_0xd781('0x7e')](),_0x1c9caa)[_0xd781('0x7')](function(_0x42adc4){_0x4c8c50[_0x53dae6+_0xd781('0x7f')]=_0x42adc4;_0x49b84f(_0x42adc4);})[_0xd781('0x12')](function(_0x5e0774){_0x34bdba(_0x5e0774);});});}return _0x44a72d[_0xd781('0x80')](_0xd781('0x81'),attributes,{'tableName':_0xd781('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xfc428d){var _0x2d0273={'raw':_0xfc428d['query']['raw'],'where':{}};var _0x645c0c={};var _0x562653={'count':0x0,'rows':[]};var _0x5846a2=_0xfc428d['query']['section'];var _0x4150ce=_0xfc428d['query'][_0xd781('0x83')]||![];var _0x3c1742=_0x175ba6(_0x5846a2,_0x4150ce);if(!_0x3c1742[_0xd781('0x15')])throw new Error(_0xd781('0x84')+_0x5846a2+'\x27');var _0x168b6c=[{'name':_0x5846a2}];if(!_['isEmpty'](_0x3c1742[_0xd781('0x1e')]))_0x168b6c=_0x3c1742[_0xd781('0x1e')];var _0x11457b=[];for(var _0x214de8=0x0;_0x214de8<_0x168b6c[_0xd781('0x85')];_0x214de8++){_0x11457b[_0xd781('0x86')](_0x3cd308['UserProfileSection']['find']({'where':{'userProfileId':_0xfc428d[_0xd781('0x87')]['id'],'name':_0x168b6c[_0x214de8]['name']},'raw':!![]}));}return Promise[_0xd781('0x88')](_0x11457b)[_0xd781('0x7')](function(_0x3fa455){var _0x2fe890=_['filter'](_0x3fa455,function(_0x1afc37){return _0x1afc37?_0x1afc37:undefined;});var _0x283264=_[_0xd781('0x4')](_0x168b6c,[_0xd781('0x89'),!![]]);var _0x13cf90=_['isEmpty'](_0x2fe890)&&_[_0xd781('0x8a')](_0x283264)?null:_['union'](_0x283264,_0x2fe890);if(!_0x13cf90)return null;var _0x3603ec=[];for(var _0x327109=0x0;_0x327109<_0x13cf90['length'];_0x327109++){var _0x4d5c37=_[_0xd781('0x8b')](_0x168b6c,function(_0xbf6d54){return _0x13cf90[_0x327109]?_0xbf6d54[_0xd781('0xc')]===_0x13cf90[_0x327109][_0xd781('0xc')]:null;});if(_0x4d5c37){if(_0x13cf90[_0x327109][_0xd781('0x89')]){_0x3603ec[_0xd781('0x86')](_0xfd915d(_0x3c1742[_0xd781('0x15')],_0x13cf90[_0x327109]));}else{if(!_0x13cf90[_0x327109][_0xd781('0x8c')]){_0x3603ec[_0xd781('0x86')](_0x22d787(_0x4d5c37,_0x13cf90[_0x327109],_0x3c1742['childModel']));}else{if(_0x4d5c37[_0xd781('0xa')]){_0x3603ec[_0xd781('0x86')](_0x29c2a7(_0x4d5c37,_0x13cf90[_0x327109]));}}}}}return Promise['all'](_0x3603ec);})[_0xd781('0x7')](function(_0x5bba63){var _0x2948a6=_0x5bba63;var _0x2c4a8b=null;if(_0x2948a6){_0x2c4a8b=_0x2948a6['length']===0x1?_0x2948a6[0x0]:null;}if(!_0x2c4a8b&&!_0x2948a6)return _0x562653;var _0x57184f=_0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0x8d')];_0x645c0c[_0xd781('0xa')]=_[_0xd781('0x8e')](_0x57184f);_0x645c0c[_0xd781('0x7d')]=_[_0xd781('0x8e')](_0xfc428d['query']);_0x645c0c[_0xd781('0x8f')]=_[_0xd781('0x90')](_0x645c0c[_0xd781('0xa')],_0x645c0c[_0xd781('0x7d')]);_0x2d0273[_0xd781('0x91')]=_[_0xd781('0x90')](_0x645c0c[_0xd781('0xa')],qs[_0xd781('0x92')](_0xfc428d[_0xd781('0x7d')][_0xd781('0x92')]));_0x2d0273[_0xd781('0x91')]=_0x2d0273['attributes'][_0xd781('0x85')]?_0x2d0273['attributes']:_0x645c0c[_0xd781('0xa')];if(!_0xfc428d[_0xd781('0x7d')][_0xd781('0x93')](_0xd781('0x94'))){_0x2d0273[_0xd781('0x95')]=qs[_0xd781('0x95')](_0xfc428d[_0xd781('0x7d')][_0xd781('0x95')]);_0x2d0273[_0xd781('0x96')]=qs[_0xd781('0x96')](_0xfc428d['query'][_0xd781('0x96')]);}_0x2d0273[_0xd781('0x97')]=qs['sort'](_0xfc428d[_0xd781('0x7d')][_0xd781('0x98')]);_0x2d0273[_0xd781('0x7a')]=qs['filters'](_['pick'](_0xfc428d[_0xd781('0x7d')],_0x645c0c['filters']));if(_0xfc428d[_0xd781('0x7d')][_0xd781('0x4')]){_0x2d0273[_0xd781('0x7a')]=_[_0xd781('0x99')](_0x2d0273[_0xd781('0x7a')],{'$or':_['map'](_0x57184f,function(_0x73f18d){if(_0x73f18d[_0xd781('0x11')][_0xd781('0x9a')]!==_0xd781('0x9b')){var _0x401c25={};_0x401c25[_0x73f18d[_0xd781('0x5')]]={'$like':'%'+_0xfc428d[_0xd781('0x7d')][_0xd781('0x4')]+'%'};return _0x401c25;}})});}var _0x3665f0=[];var _0x3a1045=null;var _0x47d6a3={};if(_0x2c4a8b){_0x3a1045=_['find'](_0x168b6c,[_0xd781('0xc'),_0x2c4a8b[_0xd781('0xc')]]);if(_0x3a1045['field']){_0x47d6a3={};if(_0x3c1742[_0xd781('0x15')]===_0xd781('0xf')){_0x47d6a3[_0x3a1045[_0xd781('0x9c')]]=_['map'](_0x2c4a8b[_0xd781('0x8')],'id');}else{_0x47d6a3[_0x3a1045[_0xd781('0x9c')]]=_0x2c4a8b['associatedResources'];}_0x3665f0[_0xd781('0x86')](_0x47d6a3);}else{_0x2d0273['where']['id']=_0x2c4a8b[_0xd781('0x8')];}}else{for(var _0x23dba5=0x0;_0x23dba5<_0x2948a6[_0xd781('0x85')];_0x23dba5++){_0x3a1045=_[_0xd781('0x8b')](_0x168b6c,[_0xd781('0xc'),_0x2948a6[_0x23dba5]['name']]);if(_0x3a1045[_0xd781('0x5')]){_0x47d6a3={};_0x47d6a3[_0x3a1045[_0xd781('0x9c')]]=_0x2948a6[_0x23dba5][_0xd781('0x8')];_0x3665f0[_0xd781('0x86')](_0x47d6a3);}else{if(!_0x2d0273[_0xd781('0x7a')]['id'])_0x2d0273[_0xd781('0x7a')]['id']=[];_0x2948a6[_0x23dba5]['associatedResources'][_0xd781('0x9d')](function(_0x40b2f3){_0x2d0273['where']['id'][_0xd781('0x86')](_0x40b2f3);});}}}if(!_[_0xd781('0x8a')](_0x3665f0)){_0x2d0273['where']=_[_0xd781('0x99')](_0x2d0273[_0xd781('0x7a')],{'$and':{'$or':_0x3665f0}});}_0x2d0273=_[_0xd781('0x99')]({},_0x2d0273,_0xfc428d[_0xd781('0x9e')]);if(_0x2c4a8b&&!_0x2c4a8b[_0xd781('0x8c')]&&_0x3c1742['childModel']==='AnalyticExtractedReport'){if(_0xfc428d['query'][_0xd781('0x9f')]){_0x2d0273[_0xd781('0xa0')]=[{'all':!![]}];}return _0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0xb')](_0x2d0273)[_0xd781('0x7')](function(_0x45013d){var _0x2c96c5=[];_0x45013d[_0xd781('0x9d')](function(_0x2eef85){var _0x4b8fc7;switch(_0x2eef85[_0xd781('0xa1')]){case _0xd781('0xa2'):_0x4b8fc7=_[_0xd781('0x8b')](_0x2c4a8b[_0xd781('0x8')],function(_0x434d63){return _0x434d63['id']===_0x2eef85['reportId']&&_0x434d63['type']==='DefaultReports';});break;case _0xd781('0xa3'):_0x4b8fc7=_['find'](_0x2c4a8b[_0xd781('0x8')],function(_0x554500){return _0x554500['id']===_0x2eef85['reportId']&&_0x554500['type']===_0xd781('0xa4');});break;}if(_0x4b8fc7)_0x2c96c5[_0xd781('0x86')](_0x2eef85);});_0x562653[_0xd781('0xa5')]=_0x2c96c5[_0xd781('0x85')];_0x562653['rows']=_0x2c96c5;return _0x562653;});}else{if(!_[_0xd781('0x8a')](_0xfc428d[_0xd781('0x7d')][_0xd781('0xa6')])){_0x2d0273[_0xd781('0x7a')]['id']=_0x2d0273[_0xd781('0x7a')]['id']?_['intersection'](_0x2d0273[_0xd781('0x7a')]['id'],_0xfc428d[_0xd781('0x7d')]['ids']):_0xfc428d[_0xd781('0x7d')][_0xd781('0xa6')];}return _0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0xa5')]({'where':_0x2d0273[_0xd781('0x7a')]})[_0xd781('0x7')](function(_0x289ecb){_0x562653[_0xd781('0xa5')]=_0x289ecb;if(_0xfc428d['query']['includeAll']){if(_0x3c1742[_0xd781('0x15')]===_0xd781('0xa7')){_0x2d0273['include']=[{'model':_0x3cd308[_0xd781('0xa8')],'as':_0xd781('0xa9'),'attributes':['id','name',_0xd781('0xaa')],'required':_0xfc428d[_0xd781('0x7d')]['tag']?!![]:![]},{'model':_0x3cd308[_0xd781('0xa8')],'as':'ThroughTags','attributes':['id',_0xd781('0xc'),_0xd781('0xaa')],'through':_0xfc428d[_0xd781('0x7d')]['tag']?{'attributes':[],'where':{'TagId':_0xfc428d['query'][_0xd781('0xab')]||undefined}}:{},'required':_0xfc428d[_0xd781('0x7d')]['tag']?!![]:![]}];}else{_0x2d0273[_0xd781('0xa0')]=[{'all':!![]}];}}return _0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0xb')](_0x2d0273);})[_0xd781('0x7')](function(_0xb777fd){_0x562653[_0xd781('0xac')]=_0xb777fd;if(_0x5846a2===_0xd781('0x30')&&_0xfc428d[_0xd781('0x7d')]['openTabs']===_0xd781('0xad')){var _0x1b8a4e=[];for(var _0x3fd641=0x0;_0x3fd641<_0x562653[_0xd781('0xac')][_0xd781('0x85')];_0x3fd641++){_0x1b8a4e['push'](_0x5e527c(_0xd781('0xae'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));_0x1b8a4e[_0xd781('0x86')](_0x5e527c(_0xd781('0xb0'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));_0x1b8a4e['push'](_0x5e527c('fax',_0x562653['rows'][_0x3fd641]['dataValues']));_0x1b8a4e[_0xd781('0x86')](_0x5e527c('mail',_0x562653[_0xd781('0xac')][_0x3fd641]['dataValues']));_0x1b8a4e['push'](_0x5e527c(_0xd781('0xb1'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));_0x1b8a4e[_0xd781('0x86')](_0x5e527c(_0xd781('0xb2'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));}return Promise[_0xd781('0x88')](_0x1b8a4e)[_0xd781('0x7')](function(){return _0x562653;});}return _0x562653;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f6fd931..67066e0 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 _0x7958=['./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','UserProfile,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require('moment');var BPromise=require(_0x8795('0x2'));var rs=require(_0x8795('0x3'));var fs=require('fs');var Redis=require(_0x8795('0x4'));var db=require(_0x8795('0x5'))['db'];var utils=require(_0x8795('0x6'));var logger=require(_0x8795('0x7'))(_0x8795('0x8'));var config=require(_0x8795('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8795('0xa')][_0x8795('0xb')]({'port':0x232a});config[_0x8795('0xc')]=_['defaults'](config[_0x8795('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8795('0xd'))(new Redis(config[_0x8795('0xc')]));require(_0x8795('0xe'))[_0x8795('0xf')](socket);function respondWithRpcPromise(_0x1bcd9c,_0x2191fb,_0x191cb0){return new BPromise(function(_0x441669,_0x416a3a){return client[_0x8795('0x10')](_0x1bcd9c,_0x191cb0)[_0x8795('0x11')](function(_0x2118ff){logger[_0x8795('0x12')]('UserProfile,\x20%s,\x20%s',_0x2191fb,_0x8795('0x13'));logger[_0x8795('0x14')](_0x8795('0x15'),_0x2191fb,_0x8795('0x13'),JSON[_0x8795('0x16')](_0x2118ff));if(_0x2118ff[_0x8795('0x17')]){if(_0x2118ff[_0x8795('0x17')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x2191fb,_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);return _0x416a3a(_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);}logger[_0x8795('0x17')](_0x8795('0x19'),_0x2191fb,_0x2118ff[_0x8795('0x17')]['message']);return _0x441669(_0x2118ff[_0x8795('0x17')]['message']);}else{logger[_0x8795('0x12')](_0x8795('0x19'),_0x2191fb,_0x8795('0x13'));_0x441669(_0x2118ff[_0x8795('0x1a')][_0x8795('0x18')]);}})[_0x8795('0x1b')](function(_0x353290){logger['error'](_0x8795('0x19'),_0x2191fb,_0x353290);_0x416a3a(_0x353290);});});} \ No newline at end of file +var _0xb458=['error','code','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f08f4,_0x58ae08){var _0x5888f1=function(_0x1e3653){while(--_0x1e3653){_0x5f08f4['push'](_0x5f08f4['shift']());}};_0x5888f1(++_0x58ae08);}(_0xb458,0x94));var _0x8b45=function(_0x3220bb,_0x342a03){_0x3220bb=_0x3220bb-0x0;var _0x23415c=_0xb458[_0x3220bb];return _0x23415c;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b45('0x4'));var logger=require(_0x8b45('0x5'))(_0x8b45('0x6'));var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b45('0x8')][_0x8b45('0x9')]({'port':0x232a});config[_0x8b45('0xa')]=_[_0x8b45('0xb')](config[_0x8b45('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0xa')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2a9c49,_0x16ad9a,_0x244adc){return new BPromise(function(_0xf4b398,_0xca52fb){return client['request'](_0x2a9c49,_0x244adc)[_0x8b45('0xe')](function(_0x30999d){logger[_0x8b45('0xf')](_0x8b45('0x10'),_0x16ad9a,_0x8b45('0x11'));logger[_0x8b45('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x16ad9a,_0x8b45('0x11'),JSON[_0x8b45('0x13')](_0x30999d));if(_0x30999d[_0x8b45('0x14')]){if(_0x30999d[_0x8b45('0x14')][_0x8b45('0x15')]===0x1f4){logger['error'](_0x8b45('0x10'),_0x16ad9a,_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);return _0xca52fb(_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);}logger[_0x8b45('0x14')](_0x8b45('0x10'),_0x16ad9a,_0x30999d['error']['message']);return _0xf4b398(_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);}else{logger[_0x8b45('0xf')]('UserProfile,\x20%s,\x20%s',_0x16ad9a,'request\x20sent');_0xf4b398(_0x30999d['result'][_0x8b45('0x16')]);}})[_0x8b45('0x17')](function(_0x40bfd7){logger['error'](_0x8b45('0x10'),_0x16ad9a,_0x40bfd7);_0xca52fb(_0x40bfd7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index bd55a1b..9df54cc 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 _0x4a1f=['save','update','removeListener','register','userProfile:'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x4a1f,0x181));var _0xf4a1=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x4a1f[_0x5c1cdc];return _0x2e8317;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xf4a1('0x0'),'remove',_0xf4a1('0x1')];function createListener(_0x1e4fd2,_0x2eb7e7){return function(_0xede673){_0x2eb7e7['emit'](_0x1e4fd2,_0xede673);};}function removeListener(_0x59070e,_0x8e73f5){return function(){UserProfileEvents[_0xf4a1('0x2')](_0x59070e,_0x8e73f5);};}exports[_0xf4a1('0x3')]=function(_0x1ef11f){for(var _0x598af6=0x0,_0x35a66a=events['length'];_0x598af6<_0x35a66a;_0x598af6++){var _0x2076cc=events[_0x598af6];var _0x1f8ca9=createListener(_0xf4a1('0x4')+_0x2076cc,_0x1ef11f);UserProfileEvents['on'](_0x2076cc,_0x1f8ca9);}}; \ No newline at end of file +var _0x146c=['removeListener','register','./userProfile.events','save','remove','update'];(function(_0x1e6740,_0xbd77){var _0x233d8a=function(_0x51d5b5){while(--_0x51d5b5){_0x1e6740['push'](_0x1e6740['shift']());}};_0x233d8a(++_0xbd77);}(_0x146c,0xe6));var _0xc146=function(_0x1e61fa,_0x2f0e68){_0x1e61fa=_0x1e61fa-0x0;var _0x223d1a=_0x146c[_0x1e61fa];return _0x223d1a;};'use strict';var UserProfileEvents=require(_0xc146('0x0'));var events=[_0xc146('0x1'),_0xc146('0x2'),_0xc146('0x3')];function createListener(_0x44d775,_0x4f2f10){return function(_0x32f6a1){_0x4f2f10['emit'](_0x44d775,_0x32f6a1);};}function removeListener(_0x1dc479,_0x225374){return function(){UserProfileEvents[_0xc146('0x4')](_0x1dc479,_0x225374);};}exports[_0xc146('0x5')]=function(_0x2fb8f8){for(var _0x381fe9=0x0,_0x53bf6d=events['length'];_0x381fe9<_0x53bf6d;_0x381fe9++){var _0x865a9=events[_0x381fe9];var _0x285417=createListener('userProfile:'+_0x865a9,_0x2fb8f8);UserProfileEvents['on'](_0x865a9,_0x285417);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 504e506..f547cb1 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 _0x831e=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','describe','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x11f749,_0x42a7cf){var _0x10eb41=function(_0xbaaa6){while(--_0xbaaa6){_0x11f749['push'](_0x11f749['shift']());}};_0x10eb41(++_0x42a7cf);}(_0x831e,0xc8));var _0xe831=function(_0x3beb4d,_0x418582){_0x3beb4d=_0x3beb4d-0x0;var _0x5a765e=_0x831e[_0x3beb4d];return _0x5a765e;};'use strict';var multer=require(_0xe831('0x0'));var util=require(_0xe831('0x1'));var path=require(_0xe831('0x2'));var timeout=require(_0xe831('0x3'));var express=require(_0xe831('0x4'));var router=express[_0xe831('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe831('0x6'));var interaction=require(_0xe831('0x7'));var config=require(_0xe831('0x8'));var controller=require(_0xe831('0x9'));router[_0xe831('0xa')]('/',auth['isAuthenticated'](),controller[_0xe831('0xb')]);router['get'](_0xe831('0xc'),auth['isAuthenticated'](),controller[_0xe831('0xd')]);router[_0xe831('0xa')]('/:id',auth[_0xe831('0xe')](),controller[_0xe831('0xf')]);router['post']('/',auth[_0xe831('0xe')](),controller[_0xe831('0x10')]);router[_0xe831('0x11')](_0xe831('0x12'),auth['isAuthenticated'](),controller[_0xe831('0x13')]);router[_0xe831('0x14')](_0xe831('0x12'),auth['isAuthenticated'](),controller[_0xe831('0x15')]);module[_0xe831('0x16')]=router; \ No newline at end of file +var _0x7b69=['index','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','get'];(function(_0x2c3f37,_0x5a46b6){var _0x12a453=function(_0x506351){while(--_0x506351){_0x2c3f37['push'](_0x2c3f37['shift']());}};_0x12a453(++_0x5a46b6);}(_0x7b69,0xf9));var _0x97b6=function(_0x395c03,_0x3823c5){_0x395c03=_0x395c03-0x0;var _0x576be4=_0x7b69[_0x395c03];return _0x576be4;};'use strict';var multer=require(_0x97b6('0x0'));var util=require(_0x97b6('0x1'));var path=require(_0x97b6('0x2'));var timeout=require('connect-timeout');var express=require(_0x97b6('0x3'));var router=express[_0x97b6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x97b6('0x5')]('/',auth['isAuthenticated'](),controller[_0x97b6('0x6')]);router[_0x97b6('0x5')]('/describe',auth[_0x97b6('0x7')](),controller[_0x97b6('0x8')]);router[_0x97b6('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x97b6('0x9')]);router[_0x97b6('0xa')]('/',auth[_0x97b6('0x7')](),controller[_0x97b6('0xb')]);router[_0x97b6('0xc')](_0x97b6('0xd'),auth[_0x97b6('0x7')](),controller[_0x97b6('0xe')]);router[_0x97b6('0xf')](_0x97b6('0xd'),auth[_0x97b6('0x7')](),controller[_0x97b6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9b4727b..6e85e07 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 _0x9073=['exports','INTEGER','STRING'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x9073,0x1e3));var _0x3907=function(_0xccc0d4,_0x2f6bf7){_0xccc0d4=_0xccc0d4-0x0;var _0x27a653=_0x9073[_0xccc0d4];return _0x27a653;};'use strict';var Sequelize=require('sequelize');module[_0x3907('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3907('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3907('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x07f7=['sequelize','STRING','INTEGER'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x07f7,0x1dd));var _0x707f=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x07f7[_0x1ca29f];return _0x576c3b;};'use strict';var Sequelize=require(_0x707f('0x0'));module['exports']={'name':{'type':Sequelize[_0x707f('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x707f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x707f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9fa5c26..3c07d67 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 _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0xe6d3e6,_0x50e71b){var _0x41f03d=function(_0x834d07){while(--_0x834d07){_0xe6d3e6['push'](_0xe6d3e6['shift']());}};_0x41f03d(++_0x50e71b);}(_0xd943,0x15d));var _0x3d94=function(_0x439c07,_0x1d6e69){_0x439c07=_0x439c07-0x0;var _0xa39a11=_0xd943[_0x439c07];return _0xa39a11;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file +var _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x50f944,_0x4a9153){var _0x95cdbe=function(_0x327033){while(--_0x327033){_0x50f944['push'](_0x50f944['shift']());}};_0x95cdbe(++_0x4a9153);}(_0x4975,0x86));var _0x5497=function(_0x5d000e,_0x291b08){_0x5d000e=_0x5d000e-0x0;var _0x29120b=_0x4975[_0x5d000e];return _0x29120b;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['UserProfileResource'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b4c768b..5c9f3d1 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 _0x17fd=['api','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger'];(function(_0x1d0800,_0x36901e){var _0xcbe8e9=function(_0x4affe3){while(--_0x4affe3){_0x1d0800['push'](_0x1d0800['shift']());}};_0xcbe8e9(++_0x36901e);}(_0x17fd,0xfa));var _0xd17f=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0x17fd[_0x1e93fa];return _0xd4e1e6;};'use strict';var _=require('lodash');var util=require(_0xd17f('0x0'));var logger=require(_0xd17f('0x1'))(_0xd17f('0x2'));var moment=require('moment');var BPromise=require(_0xd17f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd17f('0x4'));var rimraf=require('rimraf');var config=require(_0xd17f('0x5'));var attributes=require(_0xd17f('0x6'));module[_0xd17f('0x7')]=function(_0x505ea2,_0x4ae873){return _0x505ea2[_0xd17f('0x8')](_0xd17f('0x9'),attributes,{'tableName':_0xd17f('0xa'),'paranoid':![],'indexes':[{'name':_0xd17f('0xb'),'fields':[_0xd17f('0xc'),_0xd17f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaba6=['exports','compositeIndex','resourceId','util','../../config/logger','request-promise','path','rimraf','./userProfileResource.attributes'];(function(_0x2a3137,_0x54123e){var _0x378bbe=function(_0x3b19c2){while(--_0x3b19c2){_0x2a3137['push'](_0x2a3137['shift']());}};_0x378bbe(++_0x54123e);}(_0xaba6,0xb7));var _0x6aba=function(_0x21c622,_0x124272){_0x21c622=_0x21c622-0x0;var _0x4fed92=_0xaba6[_0x21c622];return _0x4fed92;};'use strict';var _=require('lodash');var util=require(_0x6aba('0x0'));var logger=require(_0x6aba('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6aba('0x2'));var fs=require('fs');var path=require(_0x6aba('0x3'));var rimraf=require(_0x6aba('0x4'));var config=require('../../config/environment');var attributes=require(_0x6aba('0x5'));module[_0x6aba('0x6')]=function(_0x42d60f,_0x217265){return _0x42d60f['define']('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x6aba('0x7'),'fields':[_0x6aba('0x8'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c8cf035..b7eff70 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 _0x0dd4=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','stringify','error','message','UserProfileResource,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x0dd4,0x71));var _0x40dd=function(_0xd69edd,_0x119eac){_0xd69edd=_0xd69edd-0x0;var _0x241d5b=_0x0dd4[_0xd69edd];return _0x241d5b;};'use strict';var _=require(_0x40dd('0x0'));var util=require(_0x40dd('0x1'));var moment=require(_0x40dd('0x2'));var BPromise=require(_0x40dd('0x3'));var rs=require(_0x40dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40dd('0x5'))['db'];var utils=require(_0x40dd('0x6'));var logger=require('../../config/logger')(_0x40dd('0x7'));var config=require(_0x40dd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x40dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d53f5,_0x7a53f,_0x40e906){return new BPromise(function(_0x450c6b,_0xb75f1c){return client[_0x40dd('0xa')](_0x2d53f5,_0x40e906)[_0x40dd('0xb')](function(_0xec707){logger[_0x40dd('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x7a53f,_0x40dd('0xd'));logger[_0x40dd('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x7a53f,'request\x20sent',JSON[_0x40dd('0xf')](_0xec707));if(_0xec707[_0x40dd('0x10')]){if(_0xec707[_0x40dd('0x10')]['code']===0x1f4){logger[_0x40dd('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x7a53f,_0xec707[_0x40dd('0x10')][_0x40dd('0x11')]);return _0xb75f1c(_0xec707['error'][_0x40dd('0x11')]);}logger[_0x40dd('0x10')](_0x40dd('0x12'),_0x7a53f,_0xec707['error'][_0x40dd('0x11')]);return _0x450c6b(_0xec707[_0x40dd('0x10')]['message']);}else{logger['info'](_0x40dd('0x12'),_0x7a53f,_0x40dd('0xd'));_0x450c6b(_0xec707['result'][_0x40dd('0x11')]);}})[_0x40dd('0x13')](function(_0x2273fd){logger['error'](_0x40dd('0x12'),_0x7a53f,_0x2273fd);_0xb75f1c(_0x2273fd);});});} \ No newline at end of file +var _0xd255=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd255,0xeb));var _0x5d25=function(_0x4d7eb2,_0x3cc5d5){_0x4d7eb2=_0x4d7eb2-0x0;var _0x310a5b=_0xd255[_0x4d7eb2];return _0x310a5b;};'use strict';var _=require(_0x5d25('0x0'));var util=require('util');var moment=require(_0x5d25('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d25('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5d25('0x3'));var logger=require(_0x5d25('0x4'))(_0x5d25('0x5'));var config=require('../../config/environment');var jayson=require(_0x5d25('0x6'));var client=jayson[_0x5d25('0x7')][_0x5d25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ffd58,_0x12f55c,_0x41dbb1){return new BPromise(function(_0x4d108e,_0x2e68ec){return client[_0x5d25('0x9')](_0x1ffd58,_0x41dbb1)['then'](function(_0x5c2142){logger['info'](_0x5d25('0xa'),_0x12f55c,_0x5d25('0xb'));logger[_0x5d25('0xc')](_0x5d25('0xd'),_0x12f55c,_0x5d25('0xb'),JSON['stringify'](_0x5c2142));if(_0x5c2142[_0x5d25('0xe')]){if(_0x5c2142['error'][_0x5d25('0xf')]===0x1f4){logger[_0x5d25('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x12f55c,_0x5c2142[_0x5d25('0xe')][_0x5d25('0x10')]);return _0x2e68ec(_0x5c2142['error'][_0x5d25('0x10')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x12f55c,_0x5c2142[_0x5d25('0xe')]['message']);return _0x4d108e(_0x5c2142[_0x5d25('0xe')][_0x5d25('0x10')]);}else{logger[_0x5d25('0x11')](_0x5d25('0xa'),_0x12f55c,_0x5d25('0xb'));_0x4d108e(_0x5c2142['result'][_0x5d25('0x10')]);}})[_0x5d25('0x12')](function(_0x3aab33){logger[_0x5d25('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x12f55c,_0x3aab33);_0x2e68ec(_0x3aab33);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index accfdd9..5bb9fc6 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 _0x2ff2=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ff2,0x108));var _0x22ff=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0x2ff2[_0xcb19e1];return _0x121872;};'use strict';var multer=require(_0x22ff('0x0'));var util=require(_0x22ff('0x1'));var path=require(_0x22ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x22ff('0x3'));var router=express[_0x22ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x22ff('0x5'));var interaction=require(_0x22ff('0x6'));var config=require(_0x22ff('0x7'));var controller=require('./userProfileSection.controller');router[_0x22ff('0x8')]('/',auth[_0x22ff('0x9')](),controller[_0x22ff('0xa')]);router[_0x22ff('0x8')](_0x22ff('0xb'),auth[_0x22ff('0x9')](),controller[_0x22ff('0xc')]);router['get'](_0x22ff('0xd'),auth[_0x22ff('0x9')](),controller[_0x22ff('0xe')]);router[_0x22ff('0xf')]('/',auth[_0x22ff('0x9')](),controller[_0x22ff('0x10')]);router[_0x22ff('0x11')](_0x22ff('0xd'),auth[_0x22ff('0x9')](),controller[_0x22ff('0x12')]);router[_0x22ff('0x13')]('/:id',auth[_0x22ff('0x9')](),controller[_0x22ff('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf9a2=['multer','util','path','connect-timeout','fs-extra','get','isAuthenticated','/describe','/:id','show','post','create','update','delete','exports'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0xf9a2,0x186));var _0x2f9a=function(_0x266829,_0x450e4d){_0x266829=_0x266829-0x0;var _0xccf38a=_0xf9a2[_0x266829];return _0xccf38a;};'use strict';var multer=require(_0x2f9a('0x0'));var util=require(_0x2f9a('0x1'));var path=require(_0x2f9a('0x2'));var timeout=require(_0x2f9a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f9a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x2f9a('0x5')]('/',auth[_0x2f9a('0x6')](),controller['index']);router[_0x2f9a('0x5')](_0x2f9a('0x7'),auth[_0x2f9a('0x6')](),controller['describe']);router['get'](_0x2f9a('0x8'),auth[_0x2f9a('0x6')](),controller[_0x2f9a('0x9')]);router[_0x2f9a('0xa')]('/',auth[_0x2f9a('0x6')](),controller[_0x2f9a('0xb')]);router['put'](_0x2f9a('0x8'),auth[_0x2f9a('0x6')](),controller[_0x2f9a('0xc')]);router[_0x2f9a('0xd')](_0x2f9a('0x8'),auth[_0x2f9a('0x6')](),controller['destroy']);module[_0x2f9a('0xe')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5c55b0e..e02ebec 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 _0xae60=['setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x4c77d3,_0x1c9e50){var _0x5b5f5b=function(_0x298ff2){while(--_0x298ff2){_0x4c77d3['push'](_0x4c77d3['shift']());}};_0x5b5f5b(++_0x1c9e50);}(_0xae60,0x1c7));var _0x0ae6=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xae60[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'name':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0ae6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0ae6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0ae6('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4c014f){this[_0x0ae6('0x5')]('crudPermissions',_0x4c014f?_0x4c014f[_0x0ae6('0x6')](''):[]);},'get':function(){return this[_0x0ae6('0x7')](_0x0ae6('0x8'))?this[_0x0ae6('0x7')](_0x0ae6('0x8'))[_0x0ae6('0x9')](''):[];}}}; \ No newline at end of file +var _0x4483=['BOOLEAN','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x36cf5d,_0x3aa354){var _0x5b08cf=function(_0x126400){while(--_0x126400){_0x36cf5d['push'](_0x36cf5d['shift']());}};_0x5b08cf(++_0x3aa354);}(_0x4483,0x1a3));var _0x3448=function(_0x2d998a,_0x413452){_0x2d998a=_0x2d998a-0x0;var _0xf68da2=_0x4483[_0x2d998a];return _0xf68da2;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'name':{'type':Sequelize[_0x3448('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3448('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3448('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3448('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3448('0x2')],'set':function(_0xef1a93){this['setDataValue'](_0x3448('0x5'),_0xef1a93?_0xef1a93[_0x3448('0x6')](''):[]);},'get':function(){return this[_0x3448('0x7')](_0x3448('0x5'))?this[_0x3448('0x7')](_0x3448('0x5'))[_0x3448('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5bea0ee..230a98f 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 _0x9779=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x9779,0x141));var _0x9977=function(_0x47e4b4,_0x574149){_0x47e4b4=_0x47e4b4-0x0;var _0x4f1d04=_0x9779[_0x47e4b4];return _0x4f1d04;};'use strict';var emlformat=require(_0x9977('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9977('0x1'));var jsonpatch=require(_0x9977('0x2'));var rp=require(_0x9977('0x3'));var moment=require(_0x9977('0x4'));var BPromise=require(_0x9977('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9977('0x6'));var sox=require('sox');var csv=require(_0x9977('0x7'));var ejs=require(_0x9977('0x8'));var fs=require('fs');var fs_extra=require(_0x9977('0x9'));var _=require('lodash');var squel=require(_0x9977('0xa'));var crypto=require(_0x9977('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9977('0x7'));var querystring=require(_0x9977('0xc'));var Papa=require(_0x9977('0xd'));var Redis=require(_0x9977('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9977('0xf'));var as=require(_0x9977('0x10'));var hardwareService=require(_0x9977('0x11'));var logger=require(_0x9977('0x12'))(_0x9977('0x13'));var utils=require(_0x9977('0x14'));var config=require(_0x9977('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c502,_0x53caca){_0x53caca=_0x53caca||0xcc;return function(_0x1d71fa){if(_0x1d71fa){return _0x30c502['sendStatus'](_0x53caca);}return _0x30c502[_0x9977('0x16')](_0x53caca)[_0x9977('0x17')]();};}function respondWithResult(_0x1e892d,_0xaff3f9){_0xaff3f9=_0xaff3f9||0xc8;return function(_0x4de95e){if(_0x4de95e){return _0x1e892d[_0x9977('0x16')](_0xaff3f9)[_0x9977('0x18')](_0x4de95e);}};}function respondWithFilteredResult(_0x4de0e5,_0x2835ff){return function(_0x586d75){if(_0x586d75){var _0x1eb115=typeof _0x2835ff[_0x9977('0x19')]===_0x9977('0x1a')&&typeof _0x2835ff[_0x9977('0x1b')]===_0x9977('0x1a');var _0x4c25ae=_0x586d75[_0x9977('0x1c')];var _0x427904=_0x1eb115?0x0:_0x2835ff['offset'];var _0x339ad9=_0x1eb115?_0x586d75[_0x9977('0x1c')]:_0x2835ff['offset']+_0x2835ff[_0x9977('0x1b')];var _0x429618;if(_0x339ad9>=_0x4c25ae){_0x339ad9=_0x4c25ae;_0x429618=0xc8;}else{_0x429618=0xce;}_0x4de0e5[_0x9977('0x16')](_0x429618);return _0x4de0e5[_0x9977('0x1d')](_0x9977('0x1e'),_0x427904+'-'+_0x339ad9+'/'+_0x4c25ae)[_0x9977('0x18')](_0x586d75);}return null;};}function patchUpdates(_0x115c88){return function(_0xc47cef){try{jsonpatch[_0x9977('0x1f')](_0xc47cef,_0x115c88,!![]);}catch(_0x11c25b){return BPromise[_0x9977('0x20')](_0x11c25b);}return _0xc47cef['save']();};}function saveUpdates(_0x3a8108,_0xe8187c){return function(_0x5eff03){if(_0x5eff03){return _0x5eff03[_0x9977('0x21')](_0x3a8108)['then'](function(_0x33c995){return _0x33c995;});}return null;};}function removeEntity(_0x491e48,_0x17be24){return function(_0x55244b){if(_0x55244b){return _0x55244b['destroy']()[_0x9977('0x22')](function(){_0x491e48['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x598c58,_0x58e837){return function(_0xdc6eab){if(!_0xdc6eab){_0x598c58[_0x9977('0x23')](0x194);}return _0xdc6eab;};}function handleError(_0x209835,_0x4160aa){_0x4160aa=_0x4160aa||0x1f4;return function(_0x2adf1e){logger[_0x9977('0x24')](_0x2adf1e[_0x9977('0x25')]);if(_0x2adf1e[_0x9977('0x26')]){delete _0x2adf1e['name'];}_0x209835[_0x9977('0x16')](_0x4160aa)[_0x9977('0x27')](_0x2adf1e);};}exports[_0x9977('0x28')]=function(_0xf8b025,_0x440322){var _0xf55662={},_0x568de9={},_0x24da99={'count':0x0,'rows':[]};var _0x72c253=_['map'](db[_0x9977('0x29')][_0x9977('0x2a')],function(_0x1812e4){return{'name':_0x1812e4[_0x9977('0x2b')],'type':_0x1812e4[_0x9977('0x2c')][_0x9977('0x2d')]};});_0x568de9[_0x9977('0x2e')]=_['map'](_0x72c253,_0x9977('0x26'));_0x568de9['query']=_[_0x9977('0x2f')](_0xf8b025[_0x9977('0x30')]);_0x568de9[_0x9977('0x31')]=_[_0x9977('0x32')](_0x568de9[_0x9977('0x2e')],_0x568de9[_0x9977('0x30')]);_0xf55662[_0x9977('0x33')]=_[_0x9977('0x32')](_0x568de9[_0x9977('0x2e')],qs['fields'](_0xf8b025['query'][_0x9977('0x34')]));_0xf55662['attributes']=_0xf55662['attributes'][_0x9977('0x35')]?_0xf55662[_0x9977('0x33')]:_0x568de9[_0x9977('0x2e')];if(!_0xf8b025[_0x9977('0x30')][_0x9977('0x36')](_0x9977('0x37'))){_0xf55662[_0x9977('0x1b')]=qs[_0x9977('0x1b')](_0xf8b025['query'][_0x9977('0x1b')]);_0xf55662[_0x9977('0x19')]=qs[_0x9977('0x19')](_0xf8b025[_0x9977('0x30')][_0x9977('0x19')]);}_0xf55662['order']=qs[_0x9977('0x38')](_0xf8b025['query'][_0x9977('0x38')]);_0xf55662[_0x9977('0x39')]=qs[_0x9977('0x31')](_['pick'](_0xf8b025[_0x9977('0x30')],_0x568de9['filters']),_0x72c253);if(_0xf8b025[_0x9977('0x30')][_0x9977('0x3a')]){_0xf55662['where']=_[_0x9977('0x3b')](_0xf55662['where'],{'$or':_[_0x9977('0x3c')](_0x72c253,function(_0x2d3dd2){if(_0x2d3dd2['type']!==_0x9977('0x3d')){var _0x1306d6={};_0x1306d6[_0x2d3dd2[_0x9977('0x26')]]={'$like':'%'+_0xf8b025[_0x9977('0x30')][_0x9977('0x3a')]+'%'};return _0x1306d6;}})});}_0xf55662=_[_0x9977('0x3b')]({},_0xf55662,_0xf8b025[_0x9977('0x3e')]);var _0x1a6574={'where':_0xf55662[_0x9977('0x39')]};return db[_0x9977('0x29')][_0x9977('0x1c')](_0x1a6574)[_0x9977('0x22')](function(_0x427554){_0x24da99[_0x9977('0x1c')]=_0x427554;if(_0xf8b025[_0x9977('0x30')][_0x9977('0x3f')]){_0xf55662[_0x9977('0x40')]=[{'all':!![]}];}return db[_0x9977('0x29')][_0x9977('0x41')](_0xf55662);})[_0x9977('0x22')](function(_0x3f21e){_0x24da99[_0x9977('0x42')]=_0x3f21e;return _0x24da99;})['then'](respondWithFilteredResult(_0x440322,_0xf55662))[_0x9977('0x43')](handleError(_0x440322,null));};exports['show']=function(_0x2e64c9,_0x2de073){var _0x1b5a1e={'raw':![],'where':{'id':_0x2e64c9[_0x9977('0x44')]['id']}},_0x48b760={};_0x48b760[_0x9977('0x2e')]=_[_0x9977('0x2f')](db[_0x9977('0x29')][_0x9977('0x2a')]);_0x48b760[_0x9977('0x30')]=_['keys'](_0x2e64c9[_0x9977('0x30')]);_0x48b760[_0x9977('0x31')]=_[_0x9977('0x32')](_0x48b760[_0x9977('0x2e')],_0x48b760[_0x9977('0x30')]);_0x1b5a1e[_0x9977('0x33')]=_['intersection'](_0x48b760['model'],qs[_0x9977('0x34')](_0x2e64c9['query']['fields']));_0x1b5a1e['attributes']=_0x1b5a1e[_0x9977('0x33')][_0x9977('0x35')]?_0x1b5a1e[_0x9977('0x33')]:_0x48b760[_0x9977('0x2e')];if(_0x2e64c9[_0x9977('0x30')][_0x9977('0x3f')]){_0x1b5a1e['include']=[{'all':!![]}];}_0x1b5a1e=_[_0x9977('0x3b')]({},_0x1b5a1e,_0x2e64c9['options']);return db['UserProfileSection'][_0x9977('0x45')](_0x1b5a1e)[_0x9977('0x22')](handleEntityNotFound(_0x2de073,null))[_0x9977('0x22')](respondWithResult(_0x2de073,null))['catch'](handleError(_0x2de073,null));};exports[_0x9977('0x46')]=function(_0x21b3eb,_0x1fd389){return db[_0x9977('0x29')][_0x9977('0x46')](_0x21b3eb[_0x9977('0x47')],{})[_0x9977('0x22')](respondWithResult(_0x1fd389,0xc9))['catch'](handleError(_0x1fd389,null));};exports[_0x9977('0x21')]=function(_0x2c6af9,_0x155c86){if(_0x2c6af9[_0x9977('0x47')]['id']){delete _0x2c6af9[_0x9977('0x47')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x2c6af9[_0x9977('0x44')]['id']}})[_0x9977('0x22')](handleEntityNotFound(_0x155c86,null))[_0x9977('0x22')](saveUpdates(_0x2c6af9['body'],null))[_0x9977('0x22')](respondWithResult(_0x155c86,null))[_0x9977('0x43')](handleError(_0x155c86,null));};exports[_0x9977('0x48')]=function(_0xc8b598,_0x447e87){return db['UserProfileSection']['find']({'where':{'id':_0xc8b598[_0x9977('0x44')]['id']}})[_0x9977('0x22')](handleEntityNotFound(_0x447e87,null))['then'](removeEntity(_0x447e87,null))[_0x9977('0x43')](handleError(_0x447e87,null));};exports[_0x9977('0x49')]=function(_0x5358f5,_0xb140e8){return db['UserProfileSection'][_0x9977('0x49')]()[_0x9977('0x22')](respondWithResult(_0xb140e8,null))[_0x9977('0x43')](handleError(_0xb140e8,null));}; \ No newline at end of file +var _0x29c4=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','update','then','destroy','error','name','send','index','map','UserProfileSection','fieldName','type','key'];(function(_0x19f1a5,_0x52815f){var _0x161f27=function(_0x3f3c1b){while(--_0x3f3c1b){_0x19f1a5['push'](_0x19f1a5['shift']());}};_0x161f27(++_0x52815f);}(_0x29c4,0xfc));var _0x429c=function(_0x301571,_0x258e03){_0x301571=_0x301571-0x0;var _0x2a3ec7=_0x29c4[_0x301571];return _0x2a3ec7;};'use strict';var emlformat=require(_0x429c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x429c('0x1'));var jsonpatch=require(_0x429c('0x2'));var rp=require(_0x429c('0x3'));var moment=require('moment');var BPromise=require(_0x429c('0x4'));var Mustache=require(_0x429c('0x5'));var util=require(_0x429c('0x6'));var path=require(_0x429c('0x7'));var sox=require(_0x429c('0x8'));var csv=require(_0x429c('0x9'));var ejs=require(_0x429c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x429c('0xb'));var squel=require('squel');var crypto=require(_0x429c('0xc'));var jsforce=require(_0x429c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x429c('0xe'));var Papa=require('papaparse');var Redis=require(_0x429c('0xf'));var authService=require(_0x429c('0x10'));var qs=require(_0x429c('0x11'));var as=require(_0x429c('0x12'));var hardwareService=require(_0x429c('0x13'));var logger=require(_0x429c('0x14'))(_0x429c('0x15'));var utils=require('../../config/utils');var config=require(_0x429c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x429c('0x17'))['db'];function respondWithStatusCode(_0x3cea55,_0x3731dc){_0x3731dc=_0x3731dc||0xcc;return function(_0x2be914){if(_0x2be914){return _0x3cea55[_0x429c('0x18')](_0x3731dc);}return _0x3cea55[_0x429c('0x19')](_0x3731dc)[_0x429c('0x1a')]();};}function respondWithResult(_0xc37f68,_0x1f479a){_0x1f479a=_0x1f479a||0xc8;return function(_0x5d2085){if(_0x5d2085){return _0xc37f68[_0x429c('0x19')](_0x1f479a)['json'](_0x5d2085);}};}function respondWithFilteredResult(_0xe145af,_0x15167c){return function(_0x291e21){if(_0x291e21){var _0x268b54=typeof _0x15167c[_0x429c('0x1b')]===_0x429c('0x1c')&&typeof _0x15167c[_0x429c('0x1d')]==='undefined';var _0x4987ba=_0x291e21['count'];var _0xb65df8=_0x268b54?0x0:_0x15167c[_0x429c('0x1b')];var _0x4a1b95=_0x268b54?_0x291e21['count']:_0x15167c['offset']+_0x15167c[_0x429c('0x1d')];var _0x576542;if(_0x4a1b95>=_0x4987ba){_0x4a1b95=_0x4987ba;_0x576542=0xc8;}else{_0x576542=0xce;}_0xe145af['status'](_0x576542);return _0xe145af[_0x429c('0x1e')]('Content-Range',_0xb65df8+'-'+_0x4a1b95+'/'+_0x4987ba)[_0x429c('0x1f')](_0x291e21);}return null;};}function patchUpdates(_0x3c9776){return function(_0x210868){try{jsonpatch['apply'](_0x210868,_0x3c9776,!![]);}catch(_0x272dc5){return BPromise['reject'](_0x272dc5);}return _0x210868['save']();};}function saveUpdates(_0xd99af8,_0x459794){return function(_0x3a637b){if(_0x3a637b){return _0x3a637b[_0x429c('0x20')](_0xd99af8)[_0x429c('0x21')](function(_0x3f0fa8){return _0x3f0fa8;});}return null;};}function removeEntity(_0x15d596,_0x160b7a){return function(_0x326087){if(_0x326087){return _0x326087[_0x429c('0x22')]()['then'](function(){_0x15d596['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47acc1,_0x2990f7){return function(_0x49ba36){if(!_0x49ba36){_0x47acc1[_0x429c('0x18')](0x194);}return _0x49ba36;};}function handleError(_0x4f33cf,_0x24d975){_0x24d975=_0x24d975||0x1f4;return function(_0x56eadb){logger[_0x429c('0x23')](_0x56eadb['stack']);if(_0x56eadb['name']){delete _0x56eadb[_0x429c('0x24')];}_0x4f33cf[_0x429c('0x19')](_0x24d975)[_0x429c('0x25')](_0x56eadb);};}exports[_0x429c('0x26')]=function(_0x12021e,_0x385210){var _0xc02ca4={},_0x5112ed={},_0x343a03={'count':0x0,'rows':[]};var _0x69c52e=_[_0x429c('0x27')](db[_0x429c('0x28')]['rawAttributes'],function(_0x1a8b9f){return{'name':_0x1a8b9f[_0x429c('0x29')],'type':_0x1a8b9f[_0x429c('0x2a')][_0x429c('0x2b')]};});_0x5112ed[_0x429c('0x2c')]=_['map'](_0x69c52e,_0x429c('0x24'));_0x5112ed[_0x429c('0x2d')]=_[_0x429c('0x2e')](_0x12021e['query']);_0x5112ed[_0x429c('0x2f')]=_[_0x429c('0x30')](_0x5112ed[_0x429c('0x2c')],_0x5112ed[_0x429c('0x2d')]);_0xc02ca4[_0x429c('0x31')]=_['intersection'](_0x5112ed[_0x429c('0x2c')],qs[_0x429c('0x32')](_0x12021e[_0x429c('0x2d')][_0x429c('0x32')]));_0xc02ca4[_0x429c('0x31')]=_0xc02ca4[_0x429c('0x31')][_0x429c('0x33')]?_0xc02ca4[_0x429c('0x31')]:_0x5112ed[_0x429c('0x2c')];if(!_0x12021e['query']['hasOwnProperty'](_0x429c('0x34'))){_0xc02ca4[_0x429c('0x1d')]=qs[_0x429c('0x1d')](_0x12021e[_0x429c('0x2d')]['limit']);_0xc02ca4[_0x429c('0x1b')]=qs[_0x429c('0x1b')](_0x12021e[_0x429c('0x2d')][_0x429c('0x1b')]);}_0xc02ca4[_0x429c('0x35')]=qs['sort'](_0x12021e[_0x429c('0x2d')][_0x429c('0x36')]);_0xc02ca4['where']=qs['filters'](_[_0x429c('0x37')](_0x12021e['query'],_0x5112ed[_0x429c('0x2f')]),_0x69c52e);if(_0x12021e[_0x429c('0x2d')]['filter']){_0xc02ca4[_0x429c('0x38')]=_['merge'](_0xc02ca4[_0x429c('0x38')],{'$or':_[_0x429c('0x27')](_0x69c52e,function(_0x7db745){if(_0x7db745[_0x429c('0x2a')]!==_0x429c('0x39')){var _0x3fdc9a={};_0x3fdc9a[_0x7db745[_0x429c('0x24')]]={'$like':'%'+_0x12021e[_0x429c('0x2d')][_0x429c('0x3a')]+'%'};return _0x3fdc9a;}})});}_0xc02ca4=_[_0x429c('0x3b')]({},_0xc02ca4,_0x12021e['options']);var _0x101e73={'where':_0xc02ca4[_0x429c('0x38')]};return db[_0x429c('0x28')][_0x429c('0x3c')](_0x101e73)[_0x429c('0x21')](function(_0x4e0dbd){_0x343a03[_0x429c('0x3c')]=_0x4e0dbd;if(_0x12021e[_0x429c('0x2d')][_0x429c('0x3d')]){_0xc02ca4['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x429c('0x3e')](_0xc02ca4);})[_0x429c('0x21')](function(_0x29946e){_0x343a03[_0x429c('0x3f')]=_0x29946e;return _0x343a03;})[_0x429c('0x21')](respondWithFilteredResult(_0x385210,_0xc02ca4))[_0x429c('0x40')](handleError(_0x385210,null));};exports[_0x429c('0x41')]=function(_0x5f49f5,_0x21806c){var _0x7bdffe={'raw':![],'where':{'id':_0x5f49f5[_0x429c('0x42')]['id']}},_0x4f11fd={};_0x4f11fd[_0x429c('0x2c')]=_['keys'](db['UserProfileSection'][_0x429c('0x43')]);_0x4f11fd[_0x429c('0x2d')]=_[_0x429c('0x2e')](_0x5f49f5['query']);_0x4f11fd[_0x429c('0x2f')]=_[_0x429c('0x30')](_0x4f11fd[_0x429c('0x2c')],_0x4f11fd[_0x429c('0x2d')]);_0x7bdffe[_0x429c('0x31')]=_[_0x429c('0x30')](_0x4f11fd[_0x429c('0x2c')],qs[_0x429c('0x32')](_0x5f49f5['query'][_0x429c('0x32')]));_0x7bdffe[_0x429c('0x31')]=_0x7bdffe[_0x429c('0x31')][_0x429c('0x33')]?_0x7bdffe[_0x429c('0x31')]:_0x4f11fd[_0x429c('0x2c')];if(_0x5f49f5[_0x429c('0x2d')][_0x429c('0x3d')]){_0x7bdffe[_0x429c('0x44')]=[{'all':!![]}];}_0x7bdffe=_['merge']({},_0x7bdffe,_0x5f49f5[_0x429c('0x45')]);return db[_0x429c('0x28')][_0x429c('0x46')](_0x7bdffe)[_0x429c('0x21')](handleEntityNotFound(_0x21806c,null))['then'](respondWithResult(_0x21806c,null))[_0x429c('0x40')](handleError(_0x21806c,null));};exports[_0x429c('0x47')]=function(_0x53d195,_0x36083f){return db['UserProfileSection'][_0x429c('0x47')](_0x53d195[_0x429c('0x48')],{})['then'](respondWithResult(_0x36083f,0xc9))[_0x429c('0x40')](handleError(_0x36083f,null));};exports['update']=function(_0x5b132b,_0x437dff){if(_0x5b132b[_0x429c('0x48')]['id']){delete _0x5b132b[_0x429c('0x48')]['id'];}return db['UserProfileSection'][_0x429c('0x46')]({'where':{'id':_0x5b132b[_0x429c('0x42')]['id']}})[_0x429c('0x21')](handleEntityNotFound(_0x437dff,null))[_0x429c('0x21')](saveUpdates(_0x5b132b[_0x429c('0x48')],null))['then'](respondWithResult(_0x437dff,null))[_0x429c('0x40')](handleError(_0x437dff,null));};exports[_0x429c('0x22')]=function(_0x25cd6e,_0x5314e8){return db['UserProfileSection']['find']({'where':{'id':_0x25cd6e[_0x429c('0x42')]['id']}})[_0x429c('0x21')](handleEntityNotFound(_0x5314e8,null))['then'](removeEntity(_0x5314e8,null))[_0x429c('0x40')](handleError(_0x5314e8,null));};exports[_0x429c('0x49')]=function(_0x421a5f,_0x4faf85){return db[_0x429c('0x28')][_0x429c('0x49')]()[_0x429c('0x21')](respondWithResult(_0x4faf85,null))[_0x429c('0x40')](handleError(_0x4faf85,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 87561c3..a6c0cf6 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 _0x0924=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','userProfileId','util'];(function(_0x29260a,_0x173b25){var _0x34980a=function(_0x15e590){while(--_0x15e590){_0x29260a['push'](_0x29260a['shift']());}};_0x34980a(++_0x173b25);}(_0x0924,0x77));var _0x4092=function(_0x533ef3,_0x42fc7c){_0x533ef3=_0x533ef3-0x0;var _0x25ceac=_0x0924[_0x533ef3];return _0x25ceac;};'use strict';var _=require('lodash');var util=require(_0x4092('0x0'));var logger=require(_0x4092('0x1'))(_0x4092('0x2'));var moment=require(_0x4092('0x3'));var BPromise=require(_0x4092('0x4'));var rp=require(_0x4092('0x5'));var fs=require('fs');var path=require(_0x4092('0x6'));var rimraf=require('rimraf');var config=require(_0x4092('0x7'));var attributes=require(_0x4092('0x8'));module['exports']=function(_0x41d314,_0x56afaa){return _0x41d314[_0x4092('0x9')](_0x4092('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x4092('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a84=['sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections'];(function(_0x56c25d,_0x42b29d){var _0xc2b4c7=function(_0x2f309c){while(--_0x2f309c){_0x56c25d['push'](_0x56c25d['shift']());}};_0xc2b4c7(++_0x42b29d);}(_0x2a84,0x101));var _0x42a8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2a84[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var logger=require(_0x42a8('0x2'))(_0x42a8('0x3'));var moment=require(_0x42a8('0x4'));var BPromise=require(_0x42a8('0x5'));var rp=require(_0x42a8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42a8('0x7'));var config=require(_0x42a8('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x42a8('0x9')]=function(_0x4f5ffc,_0x40d676){return _0x4f5ffc[_0x42a8('0xa')](_0x42a8('0xb'),attributes,{'tableName':_0x42a8('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x42a8('0xd'),_0x42a8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 44218e4..a3ce34a 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 _0xfa5d=['ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','randomstring'];(function(_0xf7a9cf,_0x2cfa33){var _0x7fdc45=function(_0x44b354){while(--_0x44b354){_0xf7a9cf['push'](_0xf7a9cf['shift']());}};_0x7fdc45(++_0x2cfa33);}(_0xfa5d,0x19e));var _0xdfa5=function(_0x5bf909,_0x2ae6a4){_0x5bf909=_0x5bf909-0x0;var _0x3ca7ab=_0xfa5d[_0x5bf909];return _0x3ca7ab;};'use strict';var _=require(_0xdfa5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdfa5('0x1'));var fs=require('fs');var Redis=require(_0xdfa5('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdfa5('0x3'))('rpc');var config=require(_0xdfa5('0x4'));var jayson=require(_0xdfa5('0x5'));var client=jayson['client'][_0xdfa5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4adbed,_0x11f237,_0x16c8de){return new BPromise(function(_0x527510,_0x376ea9){return client['request'](_0x4adbed,_0x16c8de)[_0xdfa5('0x7')](function(_0x64995c){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x11f237,_0xdfa5('0x8'));logger[_0xdfa5('0x9')](_0xdfa5('0xa'),_0x11f237,_0xdfa5('0x8'),JSON[_0xdfa5('0xb')](_0x64995c));if(_0x64995c[_0xdfa5('0xc')]){if(_0x64995c[_0xdfa5('0xc')]['code']===0x1f4){logger['error'](_0xdfa5('0xd'),_0x11f237,_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);return _0x376ea9(_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);}logger[_0xdfa5('0xc')](_0xdfa5('0xd'),_0x11f237,_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);return _0x527510(_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);}else{logger['info'](_0xdfa5('0xd'),_0x11f237,_0xdfa5('0x8'));_0x527510(_0x64995c['result'][_0xdfa5('0xe')]);}})[_0xdfa5('0xf')](function(_0x5b0dab){logger[_0xdfa5('0xc')](_0xdfa5('0xd'),_0x11f237,_0x5b0dab);_0x376ea9(_0x5b0dab);});});} \ No newline at end of file +var _0xa381=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x1efb79,_0x53fd14){var _0xcde3f1=function(_0x14675f){while(--_0x14675f){_0x1efb79['push'](_0x1efb79['shift']());}};_0xcde3f1(++_0x53fd14);}(_0xa381,0x79));var _0x1a38=function(_0x3af74d,_0x1e7e2d){_0x3af74d=_0x3af74d-0x0;var _0x3811a7=_0xa381[_0x3af74d];return _0x3811a7;};'use strict';var _=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a38('0x2'));var fs=require('fs');var Redis=require(_0x1a38('0x3'));var db=require(_0x1a38('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a38('0x5'))(_0x1a38('0x6'));var config=require(_0x1a38('0x7'));var jayson=require(_0x1a38('0x8'));var client=jayson['client'][_0x1a38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x569e9f,_0x5c8ab1,_0x3d12f8){return new BPromise(function(_0x4df1db,_0x46e61d){return client[_0x1a38('0xa')](_0x569e9f,_0x3d12f8)[_0x1a38('0xb')](function(_0x4676ff){logger['info'](_0x1a38('0xc'),_0x5c8ab1,_0x1a38('0xd'));logger[_0x1a38('0xe')](_0x1a38('0xf'),_0x5c8ab1,_0x1a38('0xd'),JSON[_0x1a38('0x10')](_0x4676ff));if(_0x4676ff[_0x1a38('0x11')]){if(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x12')]===0x1f4){logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);return _0x46e61d(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);}logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);return _0x4df1db(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);}else{logger[_0x1a38('0x14')](_0x1a38('0xc'),_0x5c8ab1,'request\x20sent');_0x4df1db(_0x4676ff['result'][_0x1a38('0x13')]);}})['catch'](function(_0x424d27){logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x424d27);_0x46e61d(_0x424d27);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index dff0462..bc0eebf 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x11008e,_0x3c9be6){var _0x4ae70d=function(_0x1f9c52){while(--_0x1f9c52){_0x11008e['push'](_0x11008e['shift']());}};_0x4ae70d(++_0x3c9be6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xc47bde,_0xb0e3d9){var _0x394d02=function(_0x5848a1){while(--_0x5848a1){_0xc47bde['push'](_0xc47bde['shift']());}};_0x394d02(++_0xb0e3d9);}(_0xedd9,0xfc));var _0x9edd=function(_0x392683,_0x48dbb6){_0x392683=_0x392683-0x0;var _0xd6c627=_0xedd9[_0x392683];return _0xd6c627;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index c069431..520c3a3 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 _0xd043=['exports','INTEGER','sequelize'];(function(_0x23bedd,_0x2496b4){var _0x48affc=function(_0x4c7a42){while(--_0x4c7a42){_0x23bedd['push'](_0x23bedd['shift']());}};_0x48affc(++_0x2496b4);}(_0xd043,0x143));var _0x3d04=function(_0x4a6934,_0x1237f4){_0x4a6934=_0x4a6934-0x0;var _0x532acf=_0xd043[_0x4a6934];return _0x532acf;};'use strict';var Sequelize=require(_0x3d04('0x0'));module[_0x3d04('0x1')]={'penalty':{'type':Sequelize[_0x3d04('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1e6=['sequelize'];(function(_0x2e8a60,_0x3d8b4f){var _0x477486=function(_0x3dc264){while(--_0x3dc264){_0x2e8a60['push'](_0x2e8a60['shift']());}};_0x477486(++_0x3d8b4f);}(_0xc1e6,0x12a));var _0x6c1e=function(_0x1f9188,_0xc3f6a){_0x1f9188=_0x1f9188-0x0;var _0x2ba9cc=_0xc1e6[_0x1f9188];return _0x2ba9cc;};'use strict';var Sequelize=require(_0x6c1e('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index f289709..f60e1e9 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 _0x1751=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x52300d,_0x7ebb6c){var _0x5ea999=function(_0x3fa9bd){while(--_0x3fa9bd){_0x52300d['push'](_0x52300d['shift']());}};_0x5ea999(++_0x7ebb6c);}(_0x1751,0x76));var _0x1175=function(_0x35123a,_0x3b0e8b){_0x35123a=_0x35123a-0x0;var _0x48a493=_0x1751[_0x35123a];return _0x48a493;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var logger=require(_0x1175('0x2'))(_0x1175('0x3'));var moment=require('moment');var BPromise=require(_0x1175('0x4'));var rp=require(_0x1175('0x5'));var fs=require('fs');var path=require(_0x1175('0x6'));var rimraf=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var attributes=require(_0x1175('0x9'));module[_0x1175('0xa')]=function(_0x171756,_0x3f99ca){return _0x171756[_0x1175('0xb')](_0x1175('0xc'),attributes,{'tableName':_0x1175('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1115=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','UserSmsQueue','user_has_sms_queues','util','../../config/logger'];(function(_0x5a2e96,_0x1c3628){var _0x2c372b=function(_0x22d79f){while(--_0x22d79f){_0x5a2e96['push'](_0x5a2e96['shift']());}};_0x2c372b(++_0x1c3628);}(_0x1115,0x1b6));var _0x5111=function(_0x4bc0ac,_0x41e4ea){_0x4bc0ac=_0x4bc0ac-0x0;var _0x3ca9c9=_0x1115[_0x4bc0ac];return _0x3ca9c9;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var logger=require(_0x5111('0x1'))(_0x5111('0x2'));var moment=require(_0x5111('0x3'));var BPromise=require(_0x5111('0x4'));var rp=require(_0x5111('0x5'));var fs=require('fs');var path=require(_0x5111('0x6'));var rimraf=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x467c3a,_0x115ba7){return _0x467c3a['define'](_0x5111('0x9'),attributes,{'tableName':_0x5111('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 53019bc..6536288 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 _0x938e=['then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x938e,0x16f));var _0xe938=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x938e[_0x39106e];return _0x892aec;};'use strict';var _=require(_0xe938('0x0'));var util=require(_0xe938('0x1'));var moment=require(_0xe938('0x2'));var BPromise=require(_0xe938('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe938('0x4'));var logger=require(_0xe938('0x5'))('rpc');var config=require(_0xe938('0x6'));var jayson=require(_0xe938('0x7'));var client=jayson[_0xe938('0x8')][_0xe938('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c1cf0,_0x2f5188,_0x8987dc){return new BPromise(function(_0x51545b,_0x769977){return client[_0xe938('0xa')](_0x5c1cf0,_0x8987dc)[_0xe938('0xb')](function(_0x58b0a6){logger[_0xe938('0xc')](_0xe938('0xd'),_0x2f5188,'request\x20sent');logger[_0xe938('0xe')](_0xe938('0xf'),_0x2f5188,'request\x20sent',JSON[_0xe938('0x10')](_0x58b0a6));if(_0x58b0a6[_0xe938('0x11')]){if(_0x58b0a6[_0xe938('0x11')][_0xe938('0x12')]===0x1f4){logger[_0xe938('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x2f5188,_0x58b0a6['error'][_0xe938('0x13')]);return _0x769977(_0x58b0a6['error'][_0xe938('0x13')]);}logger[_0xe938('0x11')](_0xe938('0xd'),_0x2f5188,_0x58b0a6['error']['message']);return _0x51545b(_0x58b0a6[_0xe938('0x11')][_0xe938('0x13')]);}else{logger[_0xe938('0xc')](_0xe938('0xd'),_0x2f5188,_0xe938('0x14'));_0x51545b(_0x58b0a6['result'][_0xe938('0x13')]);}})['catch'](function(_0x2d8f43){logger[_0xe938('0x11')](_0xe938('0xd'),_0x2f5188,_0x2d8f43);_0x769977(_0x2d8f43);});});} \ No newline at end of file +var _0x8792=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8792,0x119));var _0x2879=function(_0x110225,_0xe16c32){_0x110225=_0x110225-0x0;var _0x1053b5=_0x8792[_0x110225];return _0x1053b5;};'use strict';var _=require(_0x2879('0x0'));var util=require(_0x2879('0x1'));var moment=require(_0x2879('0x2'));var BPromise=require(_0x2879('0x3'));var rs=require(_0x2879('0x4'));var fs=require('fs');var Redis=require(_0x2879('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2879('0x6'));var logger=require(_0x2879('0x7'))(_0x2879('0x8'));var config=require(_0x2879('0x9'));var jayson=require(_0x2879('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47b500,_0x2f54ea,_0x5365cd){return new BPromise(function(_0x2e2018,_0x589027){return client['request'](_0x47b500,_0x5365cd)[_0x2879('0xb')](function(_0x457e2e){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2f54ea,_0x2879('0xc'));logger['debug'](_0x2879('0xd'),_0x2f54ea,_0x2879('0xc'),JSON[_0x2879('0xe')](_0x457e2e));if(_0x457e2e[_0x2879('0xf')]){if(_0x457e2e[_0x2879('0xf')][_0x2879('0x10')]===0x1f4){logger[_0x2879('0xf')](_0x2879('0x11'),_0x2f54ea,_0x457e2e[_0x2879('0xf')][_0x2879('0x12')]);return _0x589027(_0x457e2e['error'][_0x2879('0x12')]);}logger[_0x2879('0xf')](_0x2879('0x11'),_0x2f54ea,_0x457e2e[_0x2879('0xf')][_0x2879('0x12')]);return _0x2e2018(_0x457e2e[_0x2879('0xf')][_0x2879('0x12')]);}else{logger[_0x2879('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2f54ea,'request\x20sent');_0x2e2018(_0x457e2e[_0x2879('0x14')][_0x2879('0x12')]);}})[_0x2879('0x15')](function(_0x56295f){logger[_0x2879('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x2f54ea,_0x56295f);_0x589027(_0x56295f);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3444bed..d0ee473 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb055=['INTEGER','sequelize'];(function(_0x359ea9,_0x405aeb){var _0x36ae73=function(_0x10d96e){while(--_0x10d96e){_0x359ea9['push'](_0x359ea9['shift']());}};_0x36ae73(++_0x405aeb);}(_0xb055,0x131));var _0x5b05=function(_0x2f9c52,_0x11eeb9){_0x2f9c52=_0x2f9c52-0x0;var _0x34cb51=_0xb055[_0x2f9c52];return _0x34cb51;};'use strict';var Sequelize=require(_0x5b05('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x5b05('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x5b05('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 48cf14f..f8298f2 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(_0x20bd97,_0x365fe4){var _0x335ec0=function(_0x49a6da){while(--_0x49a6da){_0x20bd97['push'](_0x20bd97['shift']());}};_0x335ec0(++_0x365fe4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x214228,_0x2eb4ce){var _0x2c6201=function(_0x4ef517){while(--_0x4ef517){_0x214228['push'](_0x214228['shift']());}};_0x2c6201(++_0x2eb4ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 668daa6..29f6af8 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x18eb1a,_0x446792){var _0x279ad8=function(_0x29a25a){while(--_0x29a25a){_0x18eb1a['push'](_0x18eb1a['shift']());}};_0x279ad8(++_0x446792);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4cdb576..d46067d 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 _0x8702=['INTEGER','sequelize'];(function(_0x4d0a88,_0x43b323){var _0x15e7cc=function(_0x578671){while(--_0x578671){_0x4d0a88['push'](_0x4d0a88['shift']());}};_0x15e7cc(++_0x43b323);}(_0x8702,0xad));var _0x2870=function(_0x2b9c31,_0x3579cb){_0x2b9c31=_0x2b9c31-0x0;var _0x30d0a4=_0x8702[_0x2b9c31];return _0x30d0a4;};'use strict';var Sequelize=require(_0x2870('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2870('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa4d3=['exports','INTEGER','sequelize'];(function(_0x463b9b,_0x1d3a9f){var _0x2c55df=function(_0x518344){while(--_0x518344){_0x463b9b['push'](_0x463b9b['shift']());}};_0x2c55df(++_0x1d3a9f);}(_0xa4d3,0x1d3));var _0x3a4d=function(_0x252cd7,_0x350060){_0x252cd7=_0x252cd7-0x0;var _0x2400ef=_0xa4d3[_0x252cd7];return _0x2400ef;};'use strict';var Sequelize=require(_0x3a4d('0x0'));module[_0x3a4d('0x1')]={'penalty':{'type':Sequelize[_0x3a4d('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 67355dc..cbcbf3a 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 _0x1ae3=['path','./userVoiceQueue.attributes','define','lodash','util','api','bluebird','request-promise'];(function(_0x377cce,_0x3b4f48){var _0x256bc9=function(_0x45d5ce){while(--_0x45d5ce){_0x377cce['push'](_0x377cce['shift']());}};_0x256bc9(++_0x3b4f48);}(_0x1ae3,0x12b));var _0x31ae=function(_0x54ade2,_0x4210cf){_0x54ade2=_0x54ade2-0x0;var _0x3fc785=_0x1ae3[_0x54ade2];return _0x3fc785;};'use strict';var _=require(_0x31ae('0x0'));var util=require(_0x31ae('0x1'));var logger=require('../../config/logger')(_0x31ae('0x2'));var moment=require('moment');var BPromise=require(_0x31ae('0x3'));var rp=require(_0x31ae('0x4'));var fs=require('fs');var path=require(_0x31ae('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x31ae('0x6'));module['exports']=function(_0x38fa6c,_0x27b845){return _0x38fa6c[_0x31ae('0x7')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1543=['lodash','util','api','bluebird','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x326045,_0x4bc2cb){var _0x37b3df=function(_0x3833e9){while(--_0x3833e9){_0x326045['push'](_0x326045['shift']());}};_0x37b3df(++_0x4bc2cb);}(_0x1543,0x1ce));var _0x3154=function(_0x98b02c,_0x3cfa17){_0x98b02c=_0x98b02c-0x0;var _0x481d61=_0x1543[_0x98b02c];return _0x481d61;};'use strict';var _=require(_0x3154('0x0'));var util=require(_0x3154('0x1'));var logger=require('../../config/logger')(_0x3154('0x2'));var moment=require('moment');var BPromise=require(_0x3154('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3154('0x4'));var rimraf=require(_0x3154('0x5'));var config=require('../../config/environment');var attributes=require(_0x3154('0x6'));module[_0x3154('0x7')]=function(_0xbc4677,_0x51cfb2){return _0xbc4677[_0x3154('0x8')](_0x3154('0x9'),attributes,{'tableName':_0x3154('0xa'),'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 65bef1e..13bad17 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 _0x45c5=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','ioredis'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0x45c5,0x66));var _0x545c=function(_0x501c53,_0x50eb18){_0x501c53=_0x501c53-0x0;var _0x418759=_0x45c5[_0x501c53];return _0x418759;};'use strict';var _=require(_0x545c('0x0'));var util=require(_0x545c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x545c('0x2'));var db=require(_0x545c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x545c('0x4'))(_0x545c('0x5'));var config=require('../../config/environment');var jayson=require(_0x545c('0x6'));var client=jayson[_0x545c('0x7')][_0x545c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51a2ad,_0x911261,_0x3892b2){return new BPromise(function(_0x3a518e,_0x507024){return client[_0x545c('0x9')](_0x51a2ad,_0x3892b2)[_0x545c('0xa')](function(_0x2ad738){logger[_0x545c('0xb')](_0x545c('0xc'),_0x911261,_0x545c('0xd'));logger[_0x545c('0xe')](_0x545c('0xf'),_0x911261,_0x545c('0xd'),JSON['stringify'](_0x2ad738));if(_0x2ad738['error']){if(_0x2ad738['error'][_0x545c('0x10')]===0x1f4){logger[_0x545c('0x11')](_0x545c('0xc'),_0x911261,_0x2ad738[_0x545c('0x11')]['message']);return _0x507024(_0x2ad738[_0x545c('0x11')][_0x545c('0x12')]);}logger[_0x545c('0x11')](_0x545c('0xc'),_0x911261,_0x2ad738[_0x545c('0x11')]['message']);return _0x3a518e(_0x2ad738[_0x545c('0x11')][_0x545c('0x12')]);}else{logger[_0x545c('0xb')](_0x545c('0xc'),_0x911261,'request\x20sent');_0x3a518e(_0x2ad738[_0x545c('0x13')]['message']);}})[_0x545c('0x14')](function(_0x14818d){logger[_0x545c('0x11')](_0x545c('0xc'),_0x911261,_0x14818d);_0x507024(_0x14818d);});});} \ No newline at end of file +var _0x865e=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x1b8d78,_0x8606df){var _0x44a515=function(_0x9c3ee0){while(--_0x9c3ee0){_0x1b8d78['push'](_0x1b8d78['shift']());}};_0x44a515(++_0x8606df);}(_0x865e,0xbb));var _0xe865=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x865e[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xe865('0x0'));var util=require(_0xe865('0x1'));var moment=require(_0xe865('0x2'));var BPromise=require('bluebird');var rs=require(_0xe865('0x3'));var fs=require('fs');var Redis=require(_0xe865('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe865('0x5'));var logger=require(_0xe865('0x6'))('rpc');var config=require(_0xe865('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe865('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x435fe9,_0x16238e,_0x4ebaf1){return new BPromise(function(_0x41a0e9,_0x10cb2d){return client[_0xe865('0x9')](_0x435fe9,_0x4ebaf1)[_0xe865('0xa')](function(_0x15cb02){logger[_0xe865('0xb')](_0xe865('0xc'),_0x16238e,'request\x20sent');logger[_0xe865('0xd')](_0xe865('0xe'),_0x16238e,_0xe865('0xf'),JSON[_0xe865('0x10')](_0x15cb02));if(_0x15cb02['error']){if(_0x15cb02[_0xe865('0x11')]['code']===0x1f4){logger[_0xe865('0x11')](_0xe865('0xc'),_0x16238e,_0x15cb02[_0xe865('0x11')]['message']);return _0x10cb2d(_0x15cb02[_0xe865('0x11')][_0xe865('0x12')]);}logger[_0xe865('0x11')](_0xe865('0xc'),_0x16238e,_0x15cb02[_0xe865('0x11')][_0xe865('0x12')]);return _0x41a0e9(_0x15cb02[_0xe865('0x11')][_0xe865('0x12')]);}else{logger['info'](_0xe865('0xc'),_0x16238e,_0xe865('0xf'));_0x41a0e9(_0x15cb02[_0xe865('0x13')]['message']);}})[_0xe865('0x14')](function(_0x3432eb){logger['error'](_0xe865('0xc'),_0x16238e,_0x3432eb);_0x10cb2d(_0x3432eb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3136386..68b17d2 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x19fb31,_0x49895f){var _0x3b55e0=function(_0x1f29e1){while(--_0x1f29e1){_0x19fb31['push'](_0x19fb31['shift']());}};_0x3b55e0(++_0x49895f);}(_0xe706,0xa3));var _0x6e70=function(_0x1ad53c,_0x13ebf8){_0x1ad53c=_0x1ad53c-0x0;var _0x33afe4=_0xe706[_0x1ad53c];return _0x33afe4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x171a7c,_0x2aaf5b){var _0x2699cd=function(_0x40e170){while(--_0x40e170){_0x171a7c['push'](_0x171a7c['shift']());}};_0x2699cd(++_0x2aaf5b);}(_0xe706,0xa3));var _0x6e70=function(_0x510de5,_0x1ac5d6){_0x510de5=_0x510de5-0x0;var _0x48df9e=_0xe706[_0x510de5];return _0x48df9e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ee7acab..3a6fb3d 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 _0x2f15=['queue_interface','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2f15,0x6f));var _0x52f1=function(_0x50bbc3,_0x5e6775){_0x50bbc3=_0x50bbc3-0x0;var _0x40451e=_0x2f15[_0x50bbc3];return _0x40451e;};'use strict';var Sequelize=require('sequelize');module[_0x52f1('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x52f1('0x1')},'membername':{'type':Sequelize[_0x52f1('0x2')],'allowNull':![],'comment':_0x52f1('0x1')},'UserId':{'type':Sequelize[_0x52f1('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x52f1('0x4'),'comment':_0x52f1('0x1')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x52f1('0x2')],'allowNull':![],'unique':_0x52f1('0x4'),'comment':_0x52f1('0x1')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x52f1('0x1')}}; \ No newline at end of file +var _0x9474=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x9474,0x13b));var _0x4947=function(_0x1222fa,_0x39a7b9){_0x1222fa=_0x1222fa-0x0;var _0x1dcd74=_0x9474[_0x1222fa];return _0x1dcd74;};'use strict';var Sequelize=require(_0x4947('0x0'));module[_0x4947('0x1')]={'uniqueid':{'type':Sequelize[_0x4947('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x4947('0x3')},'UserId':{'type':Sequelize[_0x4947('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4947('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x4947('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4947('0x4')],'allowNull':![],'unique':_0x4947('0x5'),'comment':_0x4947('0x3')},'penalty':{'type':Sequelize[_0x4947('0x2')](0xb),'defaultValue':0x0,'comment':_0x4947('0x3')},'paused':{'type':Sequelize[_0x4947('0x2')](0xb),'defaultValue':0x0,'comment':_0x4947('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4f553f8..54c6e38 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 _0xa287=['UserVoiceQueueRt','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1afa69,_0x1bcba5){var _0x295843=function(_0x131a6a){while(--_0x131a6a){_0x1afa69['push'](_0x1afa69['shift']());}};_0x295843(++_0x1bcba5);}(_0xa287,0xe8));var _0x7a28=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xa287[_0x4207f4];return _0x29a621;};'use strict';var EventEmitter=require(_0x7a28('0x0'));var UserVoiceQueueRt=require(_0x7a28('0x1'))['db'][_0x7a28('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a28('0x3'),'afterUpdate':'update','afterDestroy':_0x7a28('0x4')};function emitEvent(_0x4044ba){return function(_0x4901cd,_0x3755d3,_0x156a31){UserVoiceQueueRtEvents[_0x7a28('0x5')](_0x4044ba+':'+_0x4901cd['id'],_0x4901cd);UserVoiceQueueRtEvents[_0x7a28('0x5')](_0x4044ba,_0x4901cd);_0x156a31(null);};}for(var e in events){if(events[_0x7a28('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7a28('0x7')](e,emitEvent(event));}}module[_0x7a28('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4b99=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','hook','exports'];(function(_0x22c435,_0x1bae51){var _0x417d1a=function(_0x59c00c){while(--_0x59c00c){_0x22c435['push'](_0x22c435['shift']());}};_0x417d1a(++_0x1bae51);}(_0x4b99,0x1d5));var _0x94b9=function(_0x6e7727,_0x1b6aca){_0x6e7727=_0x6e7727-0x0;var _0x349603=_0x4b99[_0x6e7727];return _0x349603;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x94b9('0x0'))['db'][_0x94b9('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x94b9('0x2')](0x0);var events={'afterCreate':_0x94b9('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5406c3){return function(_0x565826,_0x57fc13,_0x45c928){UserVoiceQueueRtEvents[_0x94b9('0x4')](_0x5406c3+':'+_0x565826['id'],_0x565826);UserVoiceQueueRtEvents[_0x94b9('0x4')](_0x5406c3,_0x565826);_0x45c928(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x94b9('0x5')](e,emitEvent(event));}}module[_0x94b9('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3b8fb73..4d7c816 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 _0x6405=['../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x12c715,_0x59bf13){var _0x4c0c5d=function(_0x35a9fb){while(--_0x35a9fb){_0x12c715['push'](_0x12c715['shift']());}};_0x4c0c5d(++_0x59bf13);}(_0x6405,0x159));var _0x5640=function(_0xd0716a,_0x1f7fad){_0xd0716a=_0xd0716a-0x0;var _0x4e6ec1=_0x6405[_0xd0716a];return _0x4e6ec1;};'use strict';var _=require(_0x5640('0x0'));var util=require(_0x5640('0x1'));var logger=require(_0x5640('0x2'))('api');var moment=require(_0x5640('0x3'));var BPromise=require(_0x5640('0x4'));var rp=require(_0x5640('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5640('0x6'));var config=require(_0x5640('0x7'));var attributes=require(_0x5640('0x8'));module[_0x5640('0x9')]=function(_0x3575c6,_0x18d5ae){return _0x3575c6['define'](_0x5640('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a15=['rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','request-promise','path'];(function(_0x19e897,_0x33ae50){var _0x26caf0=function(_0x330d72){while(--_0x330d72){_0x19e897['push'](_0x19e897['shift']());}};_0x26caf0(++_0x33ae50);}(_0x1a15,0x15a));var _0x51a1=function(_0x10b85e,_0x4a8154){_0x10b85e=_0x10b85e-0x0;var _0x2ec11b=_0x1a15[_0x10b85e];return _0x2ec11b;};'use strict';var _=require('lodash');var util=require(_0x51a1('0x0'));var logger=require(_0x51a1('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x51a1('0x2'));var fs=require('fs');var path=require(_0x51a1('0x3'));var rimraf=require(_0x51a1('0x4'));var config=require('../../config/environment');var attributes=require(_0x51a1('0x5'));module[_0x51a1('0x6')]=function(_0x5c3be4,_0xe0a364){return _0x5c3be4[_0x51a1('0x7')](_0x51a1('0x8'),attributes,{'tableName':_0x51a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index e7388fc..54368eb 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 _0xaa93=['message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x448932,_0x1101ba){var _0x38c097=function(_0x3538e1){while(--_0x3538e1){_0x448932['push'](_0x448932['shift']());}};_0x38c097(++_0x1101ba);}(_0xaa93,0x123));var _0x3aa9=function(_0x1c1ae5,_0x2eaccf){_0x1c1ae5=_0x1c1ae5-0x0;var _0x15bf42=_0xaa93[_0x1c1ae5];return _0x15bf42;};'use strict';var _=require(_0x3aa9('0x0'));var util=require(_0x3aa9('0x1'));var moment=require(_0x3aa9('0x2'));var BPromise=require('bluebird');var rs=require(_0x3aa9('0x3'));var fs=require('fs');var Redis=require(_0x3aa9('0x4'));var db=require(_0x3aa9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3aa9('0x6'));var config=require(_0x3aa9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3aa9('0x8')][_0x3aa9('0x9')]({'port':0x232a});config[_0x3aa9('0xa')]=_['defaults'](config[_0x3aa9('0xa')],{'host':_0x3aa9('0xb'),'port':0x18eb});var socket=require(_0x3aa9('0xc'))(new Redis(config[_0x3aa9('0xa')]));require(_0x3aa9('0xd'))[_0x3aa9('0xe')](socket);function respondWithRpcPromise(_0x15d6a5,_0x322cc4,_0x5025b7){return new BPromise(function(_0x556445,_0x343823){return client[_0x3aa9('0xf')](_0x15d6a5,_0x5025b7)[_0x3aa9('0x10')](function(_0x9dee7e){logger[_0x3aa9('0x11')](_0x3aa9('0x12'),_0x322cc4,_0x3aa9('0x13'));logger[_0x3aa9('0x14')](_0x3aa9('0x15'),_0x322cc4,_0x3aa9('0x13'),JSON['stringify'](_0x9dee7e));if(_0x9dee7e[_0x3aa9('0x16')]){if(_0x9dee7e[_0x3aa9('0x16')][_0x3aa9('0x17')]===0x1f4){logger[_0x3aa9('0x16')](_0x3aa9('0x12'),_0x322cc4,_0x9dee7e[_0x3aa9('0x16')][_0x3aa9('0x18')]);return _0x343823(_0x9dee7e[_0x3aa9('0x16')]['message']);}logger['error'](_0x3aa9('0x12'),_0x322cc4,_0x9dee7e[_0x3aa9('0x16')][_0x3aa9('0x18')]);return _0x556445(_0x9dee7e[_0x3aa9('0x16')][_0x3aa9('0x18')]);}else{logger[_0x3aa9('0x11')](_0x3aa9('0x12'),_0x322cc4,_0x3aa9('0x13'));_0x556445(_0x9dee7e['result'][_0x3aa9('0x18')]);}})[_0x3aa9('0x19')](function(_0x2d0fa9){logger[_0x3aa9('0x16')](_0x3aa9('0x12'),_0x322cc4,_0x2d0fa9);_0x343823(_0x2d0fa9);});});}exports[_0x3aa9('0x1a')]=function(_0x1f44fb){var _0x33664a=this;return new Promise(function(_0x5f363b,_0x2a9ad8){return db[_0x3aa9('0x1b')][_0x3aa9('0x1c')]({'raw':_0x1f44fb[_0x3aa9('0x1d')]?_0x1f44fb[_0x3aa9('0x1d')][_0x3aa9('0x1e')]===undefined?!![]:![]:!![],'where':_0x1f44fb[_0x3aa9('0x1d')]?_0x1f44fb[_0x3aa9('0x1d')]['where']||null:null,'attributes':[[db[_0x3aa9('0x1f')]['fn'](_0x3aa9('0x20'),db['sequelize']['fn']('IF',db[_0x3aa9('0x1f')][_0x3aa9('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x3aa9('0x10')](function(_0x287fc2){logger['info']('GetVoiceQueueRtPauses',_0x1f44fb);logger[_0x3aa9('0x14')](_0x3aa9('0x1a'),_0x1f44fb,JSON[_0x3aa9('0x22')](_0x287fc2));_0x5f363b(_0x287fc2);})[_0x3aa9('0x19')](function(_0xa123a1){logger[_0x3aa9('0x16')](_0x3aa9('0x1a'),_0xa123a1['message'],_0x1f44fb);_0x2a9ad8(_0x33664a[_0x3aa9('0x16')](0x1f4,_0xa123a1[_0x3aa9('0x18')]));});});}; \ No newline at end of file +var _0xbc2f=['request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','socket.io-emitter','./userVoiceQueueRt.socket','register'];(function(_0x28ed45,_0x3942d5){var _0x42386c=function(_0xcab045){while(--_0xcab045){_0x28ed45['push'](_0x28ed45['shift']());}};_0x42386c(++_0x3942d5);}(_0xbc2f,0x1b9));var _0xfbc2=function(_0x433252,_0x36db15){_0x433252=_0x433252-0x0;var _0x401f34=_0xbc2f[_0x433252];return _0x401f34;};'use strict';var _=require('lodash');var util=require(_0xfbc2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbc2('0x1'));var db=require(_0xfbc2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbc2('0x3'))('rpc');var config=require(_0xfbc2('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xfbc2('0x5')]=_['defaults'](config[_0xfbc2('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xfbc2('0x6'))(new Redis(config[_0xfbc2('0x5')]));require(_0xfbc2('0x7'))[_0xfbc2('0x8')](socket);function respondWithRpcPromise(_0x20e5e4,_0x323688,_0x4018c1){return new BPromise(function(_0x588b18,_0x1b7f05){return client[_0xfbc2('0x9')](_0x20e5e4,_0x4018c1)[_0xfbc2('0xa')](function(_0x36c64f){logger[_0xfbc2('0xb')](_0xfbc2('0xc'),_0x323688,'request\x20sent');logger[_0xfbc2('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x323688,_0xfbc2('0xe'),JSON[_0xfbc2('0xf')](_0x36c64f));if(_0x36c64f[_0xfbc2('0x10')]){if(_0x36c64f[_0xfbc2('0x10')]['code']===0x1f4){logger[_0xfbc2('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x323688,_0x36c64f[_0xfbc2('0x10')][_0xfbc2('0x11')]);return _0x1b7f05(_0x36c64f[_0xfbc2('0x10')]['message']);}logger['error'](_0xfbc2('0xc'),_0x323688,_0x36c64f[_0xfbc2('0x10')][_0xfbc2('0x11')]);return _0x588b18(_0x36c64f[_0xfbc2('0x10')][_0xfbc2('0x11')]);}else{logger[_0xfbc2('0xb')](_0xfbc2('0xc'),_0x323688,_0xfbc2('0xe'));_0x588b18(_0x36c64f[_0xfbc2('0x12')][_0xfbc2('0x11')]);}})[_0xfbc2('0x13')](function(_0x172984){logger[_0xfbc2('0x10')](_0xfbc2('0xc'),_0x323688,_0x172984);_0x1b7f05(_0x172984);});});}exports[_0xfbc2('0x14')]=function(_0x3162e6){var _0x5c03b1=this;return new Promise(function(_0x5432f7,_0x38a68f){return db[_0xfbc2('0x15')]['findAll']({'raw':_0x3162e6[_0xfbc2('0x16')]?_0x3162e6[_0xfbc2('0x16')][_0xfbc2('0x17')]===undefined?!![]:![]:!![],'where':_0x3162e6[_0xfbc2('0x16')]?_0x3162e6[_0xfbc2('0x16')][_0xfbc2('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0xfbc2('0x19'),db[_0xfbc2('0x1a')]['fn']('IF',db['sequelize'][_0xfbc2('0x1b')](_0xfbc2('0x1c')))),_0xfbc2('0x1d')]]})['then'](function(_0x591239){logger[_0xfbc2('0xb')](_0xfbc2('0x14'),_0x3162e6);logger[_0xfbc2('0xd')]('GetVoiceQueueRtPauses',_0x3162e6,JSON['stringify'](_0x591239));_0x5432f7(_0x591239);})['catch'](function(_0x657af2){logger['error'](_0xfbc2('0x14'),_0x657af2['message'],_0x3162e6);_0x38a68f(_0x5c03b1[_0xfbc2('0x10')](0x1f4,_0x657af2['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 763f1c6..bd45bca 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 _0x51f2=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x16d42a,_0x3cd37b){var _0xfaab60=function(_0x531df3){while(--_0x531df3){_0x16d42a['push'](_0x16d42a['shift']());}};_0xfaab60(++_0x3cd37b);}(_0x51f2,0xeb));var _0x251f=function(_0x18d78a,_0x41a7b7){_0x18d78a=_0x18d78a-0x0;var _0x41d368=_0x51f2[_0x18d78a];return _0x41d368;};'use strict';var UserVoiceQueueRtEvents=require(_0x251f('0x0'));var events=[_0x251f('0x1'),_0x251f('0x2'),_0x251f('0x3')];function createListener(_0x2afc7f,_0x243816){return function(_0x1d0c48){_0x243816[_0x251f('0x4')](_0x2afc7f,_0x1d0c48);};}function removeListener(_0x1dd1c9,_0x4bc4be){return function(){UserVoiceQueueRtEvents[_0x251f('0x5')](_0x1dd1c9,_0x4bc4be);};}exports[_0x251f('0x6')]=function(_0x145630){for(var _0xd9d8e1=0x0,_0x18c6ab=events['length'];_0xd9d8e1<_0x18c6ab;_0xd9d8e1++){var _0x1f01da=events[_0xd9d8e1];var _0x37469e=createListener(_0x251f('0x7')+_0x1f01da,_0x145630);UserVoiceQueueRtEvents['on'](_0x1f01da,_0x37469e);}}; \ No newline at end of file +var _0xd47f=['register','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0x3b01f9,_0x132fef){var _0xbce14=function(_0x4e7ce8){while(--_0x4e7ce8){_0x3b01f9['push'](_0x3b01f9['shift']());}};_0xbce14(++_0x132fef);}(_0xd47f,0x1bd));var _0xfd47=function(_0x61780e,_0x44b778){_0x61780e=_0x61780e-0x0;var _0x460363=_0xd47f[_0x61780e];return _0x460363;};'use strict';var UserVoiceQueueRtEvents=require(_0xfd47('0x0'));var events=['save',_0xfd47('0x1'),_0xfd47('0x2')];function createListener(_0x3d37ba,_0x376edc){return function(_0x121a7d){_0x376edc[_0xfd47('0x3')](_0x3d37ba,_0x121a7d);};}function removeListener(_0x35aca2,_0x1701c3){return function(){UserVoiceQueueRtEvents[_0xfd47('0x4')](_0x35aca2,_0x1701c3);};}exports[_0xfd47('0x5')]=function(_0x29f81d){for(var _0x2103a0=0x0,_0x55fd0b=events['length'];_0x2103a0<_0x55fd0b;_0x2103a0++){var _0x2a69b5=events[_0x2103a0];var _0x5859f6=createListener('userVoiceQueueRt:'+_0x2a69b5,_0x29f81d);UserVoiceQueueRtEvents['on'](_0x2a69b5,_0x5859f6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3dcea66..b5240e6 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(_0x2925b8,_0xb38d3a){var _0x261613=function(_0x5e48bc){while(--_0x5e48bc){_0x2925b8['push'](_0x2925b8['shift']());}};_0x261613(++_0xb38d3a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a19e8,_0x3896aa){var _0xb8bf64=function(_0x10c2d4){while(--_0x10c2d4){_0x5a19e8['push'](_0x5a19e8['shift']());}};_0xb8bf64(++_0x3896aa);}(_0xe706,0xa3));var _0x6e70=function(_0x342db7,_0x2f2fac){_0x342db7=_0x342db7-0x0;var _0x2742e1=_0xe706[_0x342db7];return _0x2742e1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5801da2..ab3e355 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 _0x48a5=['sequelize','exports','INTEGER'];(function(_0x1b9118,_0x57c3ff){var _0xaa3f91=function(_0x2453d8){while(--_0x2453d8){_0x1b9118['push'](_0x1b9118['shift']());}};_0xaa3f91(++_0x57c3ff);}(_0x48a5,0x7b));var _0x548a=function(_0x36e800,_0x30718e){_0x36e800=_0x36e800-0x0;var _0x110bae=_0x48a5[_0x36e800];return _0x110bae;};'use strict';var Sequelize=require(_0x548a('0x0'));module[_0x548a('0x1')]={'penalty':{'type':Sequelize[_0x548a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5bac=['INTEGER'];(function(_0x3065f6,_0x3a9718){var _0x1231da=function(_0x4b2009){while(--_0x4b2009){_0x3065f6['push'](_0x3065f6['shift']());}};_0x1231da(++_0x3a9718);}(_0x5bac,0x19f));var _0xc5ba=function(_0x4f2366,_0x145a41){_0x4f2366=_0x4f2366-0x0;var _0x1ed4a7=_0x5bac[_0x4f2366];return _0x1ed4a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc5ba('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 56cce18..9320169 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 _0x0abe=['bluebird','request-promise','path','../../config/environment','exports','define','UserWhatsappQueue','lodash','../../config/logger'];(function(_0x48b63d,_0x3bfc25){var _0x51bea9=function(_0x494f40){while(--_0x494f40){_0x48b63d['push'](_0x48b63d['shift']());}};_0x51bea9(++_0x3bfc25);}(_0x0abe,0x178));var _0xe0ab=function(_0x103cd9,_0x27900a){_0x103cd9=_0x103cd9-0x0;var _0xee68a2=_0x0abe[_0x103cd9];return _0xee68a2;};'use strict';var _=require(_0xe0ab('0x0'));var util=require('util');var logger=require(_0xe0ab('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe0ab('0x2'));var rp=require(_0xe0ab('0x3'));var fs=require('fs');var path=require(_0xe0ab('0x4'));var rimraf=require('rimraf');var config=require(_0xe0ab('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xe0ab('0x6')]=function(_0x4fdaa3,_0x8ebbc6){return _0x4fdaa3[_0xe0ab('0x7')](_0xe0ab('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa72e=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x1a23b2,_0x32ab2b){var _0x3f9e34=function(_0x261f61){while(--_0x261f61){_0x1a23b2['push'](_0x1a23b2['shift']());}};_0x3f9e34(++_0x32ab2b);}(_0xa72e,0x1e3));var _0xea72=function(_0x41a288,_0x185616){_0x41a288=_0x41a288-0x0;var _0x4ce99c=_0xa72e[_0x41a288];return _0x4ce99c;};'use strict';var _=require(_0xea72('0x0'));var util=require(_0xea72('0x1'));var logger=require('../../config/logger')(_0xea72('0x2'));var moment=require(_0xea72('0x3'));var BPromise=require('bluebird');var rp=require(_0xea72('0x4'));var fs=require('fs');var path=require(_0xea72('0x5'));var rimraf=require(_0xea72('0x6'));var config=require(_0xea72('0x7'));var attributes=require(_0xea72('0x8'));module[_0xea72('0x9')]=function(_0x197bc2,_0x17bd24){return _0x197bc2[_0xea72('0xa')](_0xea72('0xb'),attributes,{'tableName':_0xea72('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 b5922af..aeb4e36 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 _0xacfb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','code','error','UserWhatsappQueue,\x20%s,\x20%s','message','catch','moment','bluebird','../../mysqldb'];(function(_0x2f9478,_0x12d38b){var _0x2953d5=function(_0x154c9c){while(--_0x154c9c){_0x2f9478['push'](_0x2f9478['shift']());}};_0x2953d5(++_0x12d38b);}(_0xacfb,0x165));var _0xbacf=function(_0x4fc4f9,_0x4c1d70){_0x4fc4f9=_0x4fc4f9-0x0;var _0xf7239a=_0xacfb[_0x4fc4f9];return _0xf7239a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbacf('0x0'));var BPromise=require(_0xbacf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbacf('0x2'))['db'];var utils=require(_0xbacf('0x3'));var logger=require(_0xbacf('0x4'))(_0xbacf('0x5'));var config=require(_0xbacf('0x6'));var jayson=require(_0xbacf('0x7'));var client=jayson[_0xbacf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440e27,_0x20b8ff,_0x1ed594){return new BPromise(function(_0x4961ee,_0x346ad3){return client[_0xbacf('0x9')](_0x440e27,_0x1ed594)[_0xbacf('0xa')](function(_0x51d061){logger[_0xbacf('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20b8ff,_0xbacf('0xc'));logger[_0xbacf('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x20b8ff,_0xbacf('0xc'),JSON[_0xbacf('0xe')](_0x51d061));if(_0x51d061['error']){if(_0x51d061['error'][_0xbacf('0xf')]===0x1f4){logger[_0xbacf('0x10')](_0xbacf('0x11'),_0x20b8ff,_0x51d061[_0xbacf('0x10')][_0xbacf('0x12')]);return _0x346ad3(_0x51d061['error'][_0xbacf('0x12')]);}logger[_0xbacf('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20b8ff,_0x51d061[_0xbacf('0x10')]['message']);return _0x4961ee(_0x51d061[_0xbacf('0x10')][_0xbacf('0x12')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x20b8ff,_0xbacf('0xc'));_0x4961ee(_0x51d061['result']['message']);}})[_0xbacf('0x13')](function(_0x5eb647){logger[_0xbacf('0x10')](_0xbacf('0x11'),_0x20b8ff,_0x5eb647);_0x346ad3(_0x5eb647);});});} \ No newline at end of file +var _0x2022=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x893a6a,_0x35c30b){var _0x2b8834=function(_0x54a9e5){while(--_0x54a9e5){_0x893a6a['push'](_0x893a6a['shift']());}};_0x2b8834(++_0x35c30b);}(_0x2022,0xf8));var _0x2202=function(_0x557cb5,_0x1a4090){_0x557cb5=_0x557cb5-0x0;var _0x563505=_0x2022[_0x557cb5];return _0x563505;};'use strict';var _=require(_0x2202('0x0'));var util=require('util');var moment=require(_0x2202('0x1'));var BPromise=require('bluebird');var rs=require(_0x2202('0x2'));var fs=require('fs');var Redis=require(_0x2202('0x3'));var db=require(_0x2202('0x4'))['db'];var utils=require(_0x2202('0x5'));var logger=require(_0x2202('0x6'))(_0x2202('0x7'));var config=require(_0x2202('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2202('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29b4a5,_0x581c17,_0x280a6b){return new BPromise(function(_0x35103c,_0x439e5e){return client[_0x2202('0xa')](_0x29b4a5,_0x280a6b)[_0x2202('0xb')](function(_0x32486c){logger[_0x2202('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x581c17,_0x2202('0xd'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x581c17,_0x2202('0xd'),JSON[_0x2202('0xe')](_0x32486c));if(_0x32486c[_0x2202('0xf')]){if(_0x32486c[_0x2202('0xf')][_0x2202('0x10')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x581c17,_0x32486c[_0x2202('0xf')][_0x2202('0x11')]);return _0x439e5e(_0x32486c[_0x2202('0xf')][_0x2202('0x11')]);}logger[_0x2202('0xf')](_0x2202('0x12'),_0x581c17,_0x32486c[_0x2202('0xf')]['message']);return _0x35103c(_0x32486c[_0x2202('0xf')]['message']);}else{logger['info'](_0x2202('0x12'),_0x581c17,_0x2202('0xd'));_0x35103c(_0x32486c[_0x2202('0x13')][_0x2202('0x11')]);}})[_0x2202('0x14')](function(_0x58f48f){logger[_0x2202('0xf')](_0x2202('0x12'),_0x581c17,_0x58f48f);_0x439e5e(_0x58f48f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 89d72b9..aaf92f5 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 _0xb377=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','show','post','isAuthenticated','create','put','/:id'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xb377,0x1b6));var _0x7b37=function(_0x52416a,_0x2324db){_0x52416a=_0x52416a-0x0;var _0x3cccc7=_0xb377[_0x52416a];return _0x3cccc7;};'use strict';var multer=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var path=require(_0x7b37('0x2'));var timeout=require(_0x7b37('0x3'));var express=require(_0x7b37('0x4'));var router=express[_0x7b37('0x5')]();var fs_extra=require(_0x7b37('0x6'));var auth=require(_0x7b37('0x7'));var interaction=require(_0x7b37('0x8'));var config=require(_0x7b37('0x9'));var controller=require(_0x7b37('0xa'));router[_0x7b37('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b37('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7b37('0xc')]);router[_0x7b37('0xd')]('/',auth[_0x7b37('0xe')](),controller[_0x7b37('0xf')]);router[_0x7b37('0x10')](_0x7b37('0x11'),auth[_0x7b37('0xe')](),controller[_0x7b37('0x12')]);router['delete'](_0x7b37('0x11'),auth[_0x7b37('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x28a2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var path=require(_0x228a('0x2'));var timeout=require(_0x228a('0x3'));var express=require(_0x228a('0x4'));var router=express[_0x228a('0x5')]();var fs_extra=require(_0x228a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x228a('0x7'));var config=require('../../config/environment');var controller=require(_0x228a('0x8'));router[_0x228a('0x9')]('/',auth[_0x228a('0xa')](),controller[_0x228a('0xb')]);router[_0x228a('0x9')]('/:id',auth[_0x228a('0xa')](),controller[_0x228a('0xc')]);router[_0x228a('0xd')]('/',auth[_0x228a('0xa')](),controller['create']);router[_0x228a('0xe')](_0x228a('0xf'),auth[_0x228a('0xa')](),controller[_0x228a('0x10')]);router[_0x228a('0x11')](_0x228a('0xf'),auth[_0x228a('0xa')](),controller[_0x228a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 70e6dc0..7d291c1 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 _0xa5df=['sequelize','exports','STRING','name'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa5df,0x190));var _0xfa5d=function(_0x49d0d6,_0x151eae){_0x49d0d6=_0x49d0d6-0x0;var _0x177d55=_0xa5df[_0x49d0d6];return _0x177d55;};'use strict';var Sequelize=require(_0xfa5d('0x0'));module[_0xfa5d('0x1')]={'name':{'type':Sequelize[_0xfa5d('0x2')],'unique':_0xfa5d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfa5d('0x2')]}}; \ No newline at end of file +var _0x37ba=['STRING','sequelize'];(function(_0x59602f,_0x23efea){var _0x9ed08f=function(_0x64d573){while(--_0x64d573){_0x59602f['push'](_0x59602f['shift']());}};_0x9ed08f(++_0x23efea);}(_0x37ba,0x113));var _0xa37b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x37ba[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0xa37b('0x0'));module['exports']={'name':{'type':Sequelize[_0xa37b('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa37b('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d1fc858..5fd039c 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 _0xc4e9=['find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','body','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','sendStatus','error','name','send','index','map','Variable','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','findAll','catch','params','include'];(function(_0xbc69eb,_0x199c3a){var _0x5b186e=function(_0x15f78d){while(--_0x15f78d){_0xbc69eb['push'](_0xbc69eb['shift']());}};_0x5b186e(++_0x199c3a);}(_0xc4e9,0x179));var _0x9c4e=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0xc4e9[_0x6978c0];return _0x361377;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c4e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c4e('0x1'));var moment=require(_0x9c4e('0x2'));var BPromise=require(_0x9c4e('0x3'));var Mustache=require(_0x9c4e('0x4'));var util=require(_0x9c4e('0x5'));var path=require('path');var sox=require(_0x9c4e('0x6'));var csv=require(_0x9c4e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c4e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c4e('0x9'));var jsforce=require(_0x9c4e('0xa'));var deskjs=require(_0x9c4e('0xb'));var toCsv=require(_0x9c4e('0x7'));var querystring=require(_0x9c4e('0xc'));var Papa=require(_0x9c4e('0xd'));var Redis=require(_0x9c4e('0xe'));var authService=require(_0x9c4e('0xf'));var qs=require(_0x9c4e('0x10'));var as=require(_0x9c4e('0x11'));var hardwareService=require(_0x9c4e('0x12'));var logger=require(_0x9c4e('0x13'))(_0x9c4e('0x14'));var utils=require(_0x9c4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9c4e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132b68,_0x49e684){_0x49e684=_0x49e684||0xcc;return function(_0x19aede){if(_0x19aede){return _0x132b68['sendStatus'](_0x49e684);}return _0x132b68[_0x9c4e('0x17')](_0x49e684)[_0x9c4e('0x18')]();};}function respondWithResult(_0x4bd84c,_0x5ec291){_0x5ec291=_0x5ec291||0xc8;return function(_0x2dde1b){if(_0x2dde1b){return _0x4bd84c[_0x9c4e('0x17')](_0x5ec291)[_0x9c4e('0x19')](_0x2dde1b);}};}function respondWithFilteredResult(_0x5edeb2,_0x22c182){return function(_0x4ce910){if(_0x4ce910){var _0x38dee0=typeof _0x22c182[_0x9c4e('0x1a')]===_0x9c4e('0x1b')&&typeof _0x22c182[_0x9c4e('0x1c')]===_0x9c4e('0x1b');var _0x3cac93=_0x4ce910[_0x9c4e('0x1d')];var _0x3849a3=_0x38dee0?0x0:_0x22c182[_0x9c4e('0x1a')];var _0x6e9f38=_0x38dee0?_0x4ce910['count']:_0x22c182[_0x9c4e('0x1a')]+_0x22c182[_0x9c4e('0x1c')];var _0xcd5201;if(_0x6e9f38>=_0x3cac93){_0x6e9f38=_0x3cac93;_0xcd5201=0xc8;}else{_0xcd5201=0xce;}_0x5edeb2[_0x9c4e('0x17')](_0xcd5201);return _0x5edeb2['set'](_0x9c4e('0x1e'),_0x3849a3+'-'+_0x6e9f38+'/'+_0x3cac93)[_0x9c4e('0x19')](_0x4ce910);}return null;};}function patchUpdates(_0x2aaac0){return function(_0x54e23c){try{jsonpatch[_0x9c4e('0x1f')](_0x54e23c,_0x2aaac0,!![]);}catch(_0x4811c8){return BPromise[_0x9c4e('0x20')](_0x4811c8);}return _0x54e23c['save']();};}function saveUpdates(_0x1986c,_0x48975a){return function(_0x2047d8){if(_0x2047d8){return _0x2047d8[_0x9c4e('0x21')](_0x1986c)[_0x9c4e('0x22')](function(_0x9b7064){return _0x9b7064;});}return null;};}function removeEntity(_0x52a9ea,_0x13ae82){return function(_0x11f950){if(_0x11f950){return _0x11f950[_0x9c4e('0x23')]()[_0x9c4e('0x22')](function(){var _0x594017=_0x11f950[_0x9c4e('0x24')]({'plain':!![]});var _0x180fd9='Variables';return db['UserProfileResource']['destroy']({'where':{'type':_0x180fd9,'resourceId':_0x594017['id']}})[_0x9c4e('0x22')](function(){return _0x11f950;});})[_0x9c4e('0x22')](function(){_0x52a9ea['status'](0xcc)[_0x9c4e('0x18')]();});}};}function handleEntityNotFound(_0x4e9e66,_0x2db8c7){return function(_0x3ab15c){if(!_0x3ab15c){_0x4e9e66[_0x9c4e('0x25')](0x194);}return _0x3ab15c;};}function handleError(_0x5743ff,_0x272d42){_0x272d42=_0x272d42||0x1f4;return function(_0x56249f){logger[_0x9c4e('0x26')](_0x56249f['stack']);if(_0x56249f[_0x9c4e('0x27')]){delete _0x56249f[_0x9c4e('0x27')];}_0x5743ff['status'](_0x272d42)[_0x9c4e('0x28')](_0x56249f);};}exports[_0x9c4e('0x29')]=function(_0x124372,_0x55c7ff){var _0x5ccd86={},_0x1e90f6={},_0x2abfe5={'count':0x0,'rows':[]};var _0x489537=_[_0x9c4e('0x2a')](db[_0x9c4e('0x2b')][_0x9c4e('0x2c')],function(_0x1d37f5){return{'name':_0x1d37f5['fieldName'],'type':_0x1d37f5['type'][_0x9c4e('0x2d')]};});_0x1e90f6[_0x9c4e('0x2e')]=_[_0x9c4e('0x2a')](_0x489537,_0x9c4e('0x27'));_0x1e90f6[_0x9c4e('0x2f')]=_[_0x9c4e('0x30')](_0x124372[_0x9c4e('0x2f')]);_0x1e90f6['filters']=_[_0x9c4e('0x31')](_0x1e90f6['model'],_0x1e90f6[_0x9c4e('0x2f')]);_0x5ccd86[_0x9c4e('0x32')]=_['intersection'](_0x1e90f6['model'],qs[_0x9c4e('0x33')](_0x124372[_0x9c4e('0x2f')]['fields']));_0x5ccd86[_0x9c4e('0x32')]=_0x5ccd86[_0x9c4e('0x32')][_0x9c4e('0x34')]?_0x5ccd86[_0x9c4e('0x32')]:_0x1e90f6[_0x9c4e('0x2e')];if(!_0x124372[_0x9c4e('0x2f')]['hasOwnProperty'](_0x9c4e('0x35'))){_0x5ccd86['limit']=qs[_0x9c4e('0x1c')](_0x124372[_0x9c4e('0x2f')][_0x9c4e('0x1c')]);_0x5ccd86['offset']=qs['offset'](_0x124372[_0x9c4e('0x2f')][_0x9c4e('0x1a')]);}_0x5ccd86['order']=qs['sort'](_0x124372[_0x9c4e('0x2f')][_0x9c4e('0x36')]);_0x5ccd86[_0x9c4e('0x37')]=qs[_0x9c4e('0x38')](_[_0x9c4e('0x39')](_0x124372['query'],_0x1e90f6[_0x9c4e('0x38')]),_0x489537);if(_0x124372['query'][_0x9c4e('0x3a')]){_0x5ccd86[_0x9c4e('0x37')]=_[_0x9c4e('0x3b')](_0x5ccd86[_0x9c4e('0x37')],{'$or':_[_0x9c4e('0x2a')](_0x489537,function(_0x51162e){if(_0x51162e[_0x9c4e('0x3c')]!=='VIRTUAL'){var _0x39c8a8={};_0x39c8a8[_0x51162e[_0x9c4e('0x27')]]={'$like':'%'+_0x124372['query'][_0x9c4e('0x3a')]+'%'};return _0x39c8a8;}})});}_0x5ccd86=_[_0x9c4e('0x3b')]({},_0x5ccd86,_0x124372[_0x9c4e('0x3d')]);var _0xa3e58a={'where':_0x5ccd86[_0x9c4e('0x37')]};return db[_0x9c4e('0x2b')]['count'](_0xa3e58a)[_0x9c4e('0x22')](function(_0x28fdb8){_0x2abfe5['count']=_0x28fdb8;if(_0x124372[_0x9c4e('0x2f')][_0x9c4e('0x3e')]){_0x5ccd86['include']=[{'all':!![]}];}return db['Variable'][_0x9c4e('0x3f')](_0x5ccd86);})[_0x9c4e('0x22')](function(_0x244d64){_0x2abfe5['rows']=_0x244d64;return _0x2abfe5;})[_0x9c4e('0x22')](respondWithFilteredResult(_0x55c7ff,_0x5ccd86))[_0x9c4e('0x40')](handleError(_0x55c7ff,null));};exports['show']=function(_0x2f39df,_0x2bec34){var _0x42556e={'raw':!![],'where':{'id':_0x2f39df[_0x9c4e('0x41')]['id']}},_0x9a5f8f={};_0x9a5f8f[_0x9c4e('0x2e')]=_['keys'](db['Variable'][_0x9c4e('0x2c')]);_0x9a5f8f[_0x9c4e('0x2f')]=_[_0x9c4e('0x30')](_0x2f39df[_0x9c4e('0x2f')]);_0x9a5f8f[_0x9c4e('0x38')]=_['intersection'](_0x9a5f8f[_0x9c4e('0x2e')],_0x9a5f8f[_0x9c4e('0x2f')]);_0x42556e['attributes']=_[_0x9c4e('0x31')](_0x9a5f8f['model'],qs[_0x9c4e('0x33')](_0x2f39df[_0x9c4e('0x2f')][_0x9c4e('0x33')]));_0x42556e['attributes']=_0x42556e[_0x9c4e('0x32')][_0x9c4e('0x34')]?_0x42556e['attributes']:_0x9a5f8f[_0x9c4e('0x2e')];if(_0x2f39df['query'][_0x9c4e('0x3e')]){_0x42556e[_0x9c4e('0x42')]=[{'all':!![]}];}_0x42556e=_['merge']({},_0x42556e,_0x2f39df[_0x9c4e('0x3d')]);return db[_0x9c4e('0x2b')][_0x9c4e('0x43')](_0x42556e)[_0x9c4e('0x22')](handleEntityNotFound(_0x2bec34,null))[_0x9c4e('0x22')](respondWithResult(_0x2bec34,null))[_0x9c4e('0x40')](handleError(_0x2bec34,null));};exports[_0x9c4e('0x44')]=function(_0x5d47e0,_0x35aa96){return db[_0x9c4e('0x2b')][_0x9c4e('0x44')](_0x5d47e0['body'],{})[_0x9c4e('0x22')](function(_0xfc2dea){var _0x524371=_0x5d47e0['user'][_0x9c4e('0x24')]({'plain':!![]});if(!_0x524371)throw new Error(_0x9c4e('0x45'));if(_0x524371[_0x9c4e('0x46')]===_0x9c4e('0x47')){var _0x4ea58e=_0xfc2dea[_0x9c4e('0x24')]({'plain':!![]});var _0x1f901c=_0x9c4e('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x1f901c,'userProfileId':_0x524371['userProfileId']},'raw':!![]})['then'](function(_0x3b6619){if(_0x3b6619&&_0x3b6619['autoAssociation']===0x0){return db['UserProfileResource'][_0x9c4e('0x44')]({'name':_0x4ea58e[_0x9c4e('0x27')],'resourceId':_0x4ea58e['id'],'type':_0x3b6619[_0x9c4e('0x27')],'sectionId':_0x3b6619['id']},{})[_0x9c4e('0x22')](function(){return _0xfc2dea;});}else{return _0xfc2dea;}})[_0x9c4e('0x40')](function(_0xfc61fc){logger[_0x9c4e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfc61fc);throw _0xfc61fc;});}return _0xfc2dea;})[_0x9c4e('0x22')](respondWithResult(_0x35aa96,0xc9))[_0x9c4e('0x40')](handleError(_0x35aa96,null));};exports[_0x9c4e('0x21')]=function(_0x4f3ce2,_0xba6341){if(_0x4f3ce2['body']['id']){delete _0x4f3ce2['body']['id'];}return db[_0x9c4e('0x2b')][_0x9c4e('0x43')]({'where':{'id':_0x4f3ce2[_0x9c4e('0x41')]['id']}})['then'](handleEntityNotFound(_0xba6341,null))[_0x9c4e('0x22')](saveUpdates(_0x4f3ce2[_0x9c4e('0x49')],null))['then'](respondWithResult(_0xba6341,null))['catch'](handleError(_0xba6341,null));};exports[_0x9c4e('0x23')]=function(_0x126776,_0x327088){return db[_0x9c4e('0x2b')][_0x9c4e('0x43')]({'where':{'id':_0x126776['params']['id']}})[_0x9c4e('0x22')](handleEntityNotFound(_0x327088,null))[_0x9c4e('0x22')](removeEntity(_0x327088,null))['catch'](handleError(_0x327088,null));}; \ No newline at end of file +var _0xabec=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x28019c,_0x67743){var _0x48ca39=function(_0x4c161e){while(--_0x4c161e){_0x28019c['push'](_0x28019c['shift']());}};_0x48ca39(++_0x67743);}(_0xabec,0x187));var _0xcabe=function(_0x1a58d1,_0xa90685){_0x1a58d1=_0x1a58d1-0x0;var _0x101adc=_0xabec[_0x1a58d1];return _0x101adc;};'use strict';var emlformat=require(_0xcabe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcabe('0x1'));var rp=require(_0xcabe('0x2'));var moment=require(_0xcabe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcabe('0x4'));var util=require(_0xcabe('0x5'));var path=require(_0xcabe('0x6'));var sox=require('sox');var csv=require(_0xcabe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcabe('0x8'));var squel=require(_0xcabe('0x9'));var crypto=require(_0xcabe('0xa'));var jsforce=require(_0xcabe('0xb'));var deskjs=require(_0xcabe('0xc'));var toCsv=require(_0xcabe('0x7'));var querystring=require(_0xcabe('0xd'));var Papa=require(_0xcabe('0xe'));var Redis=require(_0xcabe('0xf'));var authService=require(_0xcabe('0x10'));var qs=require(_0xcabe('0x11'));var as=require(_0xcabe('0x12'));var hardwareService=require(_0xcabe('0x13'));var logger=require(_0xcabe('0x14'))(_0xcabe('0x15'));var utils=require(_0xcabe('0x16'));var config=require(_0xcabe('0x17'));var licenseUtil=require(_0xcabe('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf6e9f1,_0x2994c8){_0x2994c8=_0x2994c8||0xcc;return function(_0x1a70fc){if(_0x1a70fc){return _0xf6e9f1[_0xcabe('0x19')](_0x2994c8);}return _0xf6e9f1['status'](_0x2994c8)[_0xcabe('0x1a')]();};}function respondWithResult(_0x44e70f,_0x193308){_0x193308=_0x193308||0xc8;return function(_0x32a3dd){if(_0x32a3dd){return _0x44e70f[_0xcabe('0x1b')](_0x193308)['json'](_0x32a3dd);}};}function respondWithFilteredResult(_0x3a30ec,_0x51eda5){return function(_0x52fa97){if(_0x52fa97){var _0x191610=typeof _0x51eda5[_0xcabe('0x1c')]===_0xcabe('0x1d')&&typeof _0x51eda5['limit']===_0xcabe('0x1d');var _0x380078=_0x52fa97[_0xcabe('0x1e')];var _0x2eaaee=_0x191610?0x0:_0x51eda5['offset'];var _0x1fff2d=_0x191610?_0x52fa97[_0xcabe('0x1e')]:_0x51eda5[_0xcabe('0x1c')]+_0x51eda5[_0xcabe('0x1f')];var _0xda29d7;if(_0x1fff2d>=_0x380078){_0x1fff2d=_0x380078;_0xda29d7=0xc8;}else{_0xda29d7=0xce;}_0x3a30ec['status'](_0xda29d7);return _0x3a30ec[_0xcabe('0x20')](_0xcabe('0x21'),_0x2eaaee+'-'+_0x1fff2d+'/'+_0x380078)[_0xcabe('0x22')](_0x52fa97);}return null;};}function patchUpdates(_0x272bbe){return function(_0x582d26){try{jsonpatch['apply'](_0x582d26,_0x272bbe,!![]);}catch(_0x2353be){return BPromise['reject'](_0x2353be);}return _0x582d26[_0xcabe('0x23')]();};}function saveUpdates(_0x74a80,_0x1c6578){return function(_0x3e23e3){if(_0x3e23e3){return _0x3e23e3[_0xcabe('0x24')](_0x74a80)[_0xcabe('0x25')](function(_0x102fd3){return _0x102fd3;});}return null;};}function removeEntity(_0x3f6d18,_0x93d340){return function(_0x117de0){if(_0x117de0){return _0x117de0[_0xcabe('0x26')]()['then'](function(){var _0xa8ede1=_0x117de0[_0xcabe('0x27')]({'plain':!![]});var _0x3d3e9c='Variables';return db[_0xcabe('0x28')][_0xcabe('0x26')]({'where':{'type':_0x3d3e9c,'resourceId':_0xa8ede1['id']}})['then'](function(){return _0x117de0;});})[_0xcabe('0x25')](function(){_0x3f6d18['status'](0xcc)[_0xcabe('0x1a')]();});}};}function handleEntityNotFound(_0x544c36,_0x2339a0){return function(_0x3ed135){if(!_0x3ed135){_0x544c36[_0xcabe('0x19')](0x194);}return _0x3ed135;};}function handleError(_0x226f1a,_0xf8693b){_0xf8693b=_0xf8693b||0x1f4;return function(_0x117140){logger[_0xcabe('0x29')](_0x117140[_0xcabe('0x2a')]);if(_0x117140[_0xcabe('0x2b')]){delete _0x117140[_0xcabe('0x2b')];}_0x226f1a[_0xcabe('0x1b')](_0xf8693b)[_0xcabe('0x2c')](_0x117140);};}exports[_0xcabe('0x2d')]=function(_0x1b7e68,_0x36622c){var _0x19d80c={},_0x1ce866={},_0x2673d6={'count':0x0,'rows':[]};var _0xbfbbfd=_[_0xcabe('0x2e')](db[_0xcabe('0x2f')][_0xcabe('0x30')],function(_0x362e84){return{'name':_0x362e84[_0xcabe('0x31')],'type':_0x362e84[_0xcabe('0x32')]['key']};});_0x1ce866[_0xcabe('0x33')]=_[_0xcabe('0x2e')](_0xbfbbfd,_0xcabe('0x2b'));_0x1ce866['query']=_[_0xcabe('0x34')](_0x1b7e68['query']);_0x1ce866[_0xcabe('0x35')]=_['intersection'](_0x1ce866[_0xcabe('0x33')],_0x1ce866[_0xcabe('0x36')]);_0x19d80c[_0xcabe('0x37')]=_[_0xcabe('0x38')](_0x1ce866[_0xcabe('0x33')],qs[_0xcabe('0x39')](_0x1b7e68['query']['fields']));_0x19d80c[_0xcabe('0x37')]=_0x19d80c[_0xcabe('0x37')][_0xcabe('0x3a')]?_0x19d80c[_0xcabe('0x37')]:_0x1ce866[_0xcabe('0x33')];if(!_0x1b7e68[_0xcabe('0x36')]['hasOwnProperty'](_0xcabe('0x3b'))){_0x19d80c[_0xcabe('0x1f')]=qs[_0xcabe('0x1f')](_0x1b7e68[_0xcabe('0x36')]['limit']);_0x19d80c['offset']=qs['offset'](_0x1b7e68[_0xcabe('0x36')][_0xcabe('0x1c')]);}_0x19d80c['order']=qs[_0xcabe('0x3c')](_0x1b7e68[_0xcabe('0x36')]['sort']);_0x19d80c[_0xcabe('0x3d')]=qs[_0xcabe('0x35')](_[_0xcabe('0x3e')](_0x1b7e68[_0xcabe('0x36')],_0x1ce866[_0xcabe('0x35')]),_0xbfbbfd);if(_0x1b7e68[_0xcabe('0x36')][_0xcabe('0x3f')]){_0x19d80c[_0xcabe('0x3d')]=_[_0xcabe('0x40')](_0x19d80c[_0xcabe('0x3d')],{'$or':_[_0xcabe('0x2e')](_0xbfbbfd,function(_0x55e1aa){if(_0x55e1aa[_0xcabe('0x32')]!==_0xcabe('0x41')){var _0xa97508={};_0xa97508[_0x55e1aa[_0xcabe('0x2b')]]={'$like':'%'+_0x1b7e68[_0xcabe('0x36')]['filter']+'%'};return _0xa97508;}})});}_0x19d80c=_[_0xcabe('0x40')]({},_0x19d80c,_0x1b7e68[_0xcabe('0x42')]);var _0x349c44={'where':_0x19d80c[_0xcabe('0x3d')]};return db[_0xcabe('0x2f')]['count'](_0x349c44)[_0xcabe('0x25')](function(_0x3295a1){_0x2673d6[_0xcabe('0x1e')]=_0x3295a1;if(_0x1b7e68['query'][_0xcabe('0x43')]){_0x19d80c[_0xcabe('0x44')]=[{'all':!![]}];}return db[_0xcabe('0x2f')][_0xcabe('0x45')](_0x19d80c);})[_0xcabe('0x25')](function(_0x351d5a){_0x2673d6['rows']=_0x351d5a;return _0x2673d6;})[_0xcabe('0x25')](respondWithFilteredResult(_0x36622c,_0x19d80c))['catch'](handleError(_0x36622c,null));};exports['show']=function(_0x1ac04a,_0x3c4fa3){var _0x31d973={'raw':!![],'where':{'id':_0x1ac04a[_0xcabe('0x46')]['id']}},_0x22299e={};_0x22299e[_0xcabe('0x33')]=_[_0xcabe('0x34')](db[_0xcabe('0x2f')][_0xcabe('0x30')]);_0x22299e[_0xcabe('0x36')]=_[_0xcabe('0x34')](_0x1ac04a[_0xcabe('0x36')]);_0x22299e['filters']=_['intersection'](_0x22299e[_0xcabe('0x33')],_0x22299e[_0xcabe('0x36')]);_0x31d973[_0xcabe('0x37')]=_[_0xcabe('0x38')](_0x22299e[_0xcabe('0x33')],qs[_0xcabe('0x39')](_0x1ac04a[_0xcabe('0x36')][_0xcabe('0x39')]));_0x31d973[_0xcabe('0x37')]=_0x31d973[_0xcabe('0x37')][_0xcabe('0x3a')]?_0x31d973[_0xcabe('0x37')]:_0x22299e[_0xcabe('0x33')];if(_0x1ac04a[_0xcabe('0x36')][_0xcabe('0x43')]){_0x31d973[_0xcabe('0x44')]=[{'all':!![]}];}_0x31d973=_[_0xcabe('0x40')]({},_0x31d973,_0x1ac04a[_0xcabe('0x42')]);return db['Variable'][_0xcabe('0x47')](_0x31d973)[_0xcabe('0x25')](handleEntityNotFound(_0x3c4fa3,null))[_0xcabe('0x25')](respondWithResult(_0x3c4fa3,null))['catch'](handleError(_0x3c4fa3,null));};exports[_0xcabe('0x48')]=function(_0x57537b,_0x38ad1d){return db[_0xcabe('0x2f')][_0xcabe('0x48')](_0x57537b[_0xcabe('0x49')],{})[_0xcabe('0x25')](function(_0x52426b){var _0x31bd93=_0x57537b[_0xcabe('0x4a')][_0xcabe('0x27')]({'plain':!![]});if(!_0x31bd93)throw new Error(_0xcabe('0x4b'));if(_0x31bd93['role']===_0xcabe('0x4a')){var _0x54824e=_0x52426b[_0xcabe('0x27')]({'plain':!![]});var _0x397452=_0xcabe('0x4c');return db[_0xcabe('0x4d')][_0xcabe('0x47')]({'where':{'name':_0x397452,'userProfileId':_0x31bd93[_0xcabe('0x4e')]},'raw':!![]})[_0xcabe('0x25')](function(_0x57c2e){if(_0x57c2e&&_0x57c2e['autoAssociation']===0x0){return db[_0xcabe('0x28')]['create']({'name':_0x54824e['name'],'resourceId':_0x54824e['id'],'type':_0x57c2e['name'],'sectionId':_0x57c2e['id']},{})[_0xcabe('0x25')](function(){return _0x52426b;});}else{return _0x52426b;}})[_0xcabe('0x4f')](function(_0x2a9bfa){logger[_0xcabe('0x29')](_0xcabe('0x50'),_0x2a9bfa);throw _0x2a9bfa;});}return _0x52426b;})[_0xcabe('0x25')](respondWithResult(_0x38ad1d,0xc9))[_0xcabe('0x4f')](handleError(_0x38ad1d,null));};exports[_0xcabe('0x24')]=function(_0x2b8ad8,_0x1b22e9){if(_0x2b8ad8['body']['id']){delete _0x2b8ad8[_0xcabe('0x49')]['id'];}return db[_0xcabe('0x2f')][_0xcabe('0x47')]({'where':{'id':_0x2b8ad8[_0xcabe('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b22e9,null))[_0xcabe('0x25')](saveUpdates(_0x2b8ad8['body'],null))[_0xcabe('0x25')](respondWithResult(_0x1b22e9,null))[_0xcabe('0x4f')](handleError(_0x1b22e9,null));};exports['destroy']=function(_0x7741bd,_0x48d1b7){return db['Variable'][_0xcabe('0x47')]({'where':{'id':_0x7741bd[_0xcabe('0x46')]['id']}})[_0xcabe('0x25')](handleEntityNotFound(_0x48d1b7,null))[_0xcabe('0x25')](removeEntity(_0x48d1b7,null))[_0xcabe('0x4f')](handleError(_0x48d1b7,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a71e9a5..f85457e 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 _0x5dfc=['request-promise','./variable.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x7ee0c7,_0x407325){var _0xb0b5d9=function(_0x5d6634){while(--_0x5d6634){_0x7ee0c7['push'](_0x7ee0c7['shift']());}};_0xb0b5d9(++_0x407325);}(_0x5dfc,0x13e));var _0xc5df=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0x5dfc[_0x35181c];return _0xe14bf9;};'use strict';var _=require(_0xc5df('0x0'));var util=require(_0xc5df('0x1'));var logger=require(_0xc5df('0x2'))(_0xc5df('0x3'));var moment=require(_0xc5df('0x4'));var BPromise=require(_0xc5df('0x5'));var rp=require(_0xc5df('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc5df('0x7'));module['exports']=function(_0x384025,_0x288e11){return _0x384025[_0xc5df('0x8')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xede0=['path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x224848,_0xc4e773){var _0x45b4b9=function(_0x2e0b46){while(--_0x2e0b46){_0x224848['push'](_0x224848['shift']());}};_0x45b4b9(++_0xc4e773);}(_0xede0,0xe7));var _0x0ede=function(_0x34ba29,_0x1958b2){_0x34ba29=_0x34ba29-0x0;var _0x592a30=_0xede0[_0x34ba29];return _0x592a30;};'use strict';var _=require(_0x0ede('0x0'));var util=require(_0x0ede('0x1'));var logger=require(_0x0ede('0x2'))(_0x0ede('0x3'));var moment=require(_0x0ede('0x4'));var BPromise=require(_0x0ede('0x5'));var rp=require(_0x0ede('0x6'));var fs=require('fs');var path=require(_0x0ede('0x7'));var rimraf=require('rimraf');var config=require(_0x0ede('0x8'));var attributes=require(_0x0ede('0x9'));module[_0x0ede('0xa')]=function(_0x5e82cb,_0x3d81c8){return _0x5e82cb[_0x0ede('0xb')](_0x0ede('0xc'),attributes,{'tableName':_0x0ede('0xd'),'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 5fdb4b3..e3930c7 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dfed5,_0x2d800a){var _0x1266f0=function(_0x18228c){while(--_0x18228c){_0x3dfed5['push'](_0x3dfed5['shift']());}};_0x1266f0(++_0x2d800a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x845ebd,_0x1cd71a){_0x845ebd=_0x845ebd-0x0;var _0x1d65c2=_0x8ef6[_0x845ebd];return _0x1d65c2;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +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(_0x1a7c82,_0x1c1879){var _0x353215=function(_0x4486a0){while(--_0x4486a0){_0x1a7c82['push'](_0x1a7c82['shift']());}};_0x353215(++_0x1c1879);}(_0x814b,0x1a2));var _0xb814=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x814b[_0x5d31f3];return _0x1cc88c;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 8ad3808..6bdf2cf 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 _0x8eaa=['fetch','/reset','/pull','pull','/migrations','exports','express','./version.controller','get','index','/fetch','isAuthenticated','canUpdate'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x8eaa,0x117));var _0xa8ea=function(_0x431389,_0x4c371f){_0x431389=_0x431389-0x0;var _0x322d81=_0x8eaa[_0x431389];return _0x322d81;};'use strict';var express=require(_0xa8ea('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xa8ea('0x1'));router[_0xa8ea('0x2')]('/',controller[_0xa8ea('0x3')]);router[_0xa8ea('0x2')](_0xa8ea('0x4'),auth[_0xa8ea('0x5')](),auth[_0xa8ea('0x6')](),controller[_0xa8ea('0x7')]);router['get'](_0xa8ea('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router['get'](_0xa8ea('0x9'),auth[_0xa8ea('0x5')](),auth[_0xa8ea('0x6')](),controller[_0xa8ea('0xa')]);router[_0xa8ea('0x2')]('/restart',auth[_0xa8ea('0x5')](),controller['restart']);router[_0xa8ea('0x2')](_0xa8ea('0xb'),controller['migrations']);module[_0xa8ea('0xc')]=router; \ No newline at end of file +var _0xc972=['/reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x1d8117,_0x5c2ed4){var _0x3d46dd=function(_0x1e88d1){while(--_0x1e88d1){_0x1d8117['push'](_0x1d8117['shift']());}};_0x3d46dd(++_0x5c2ed4);}(_0xc972,0x129));var _0x2c97=function(_0x3e03d2,_0x24a0bd){_0x3e03d2=_0x3e03d2-0x0;var _0x4e4852=_0xc972[_0x3e03d2];return _0x4e4852;};'use strict';var express=require(_0x2c97('0x0'));var router=express['Router']();var auth=require(_0x2c97('0x1'));var controller=require(_0x2c97('0x2'));router['get']('/',controller[_0x2c97('0x3')]);router[_0x2c97('0x4')](_0x2c97('0x5'),auth[_0x2c97('0x6')](),auth[_0x2c97('0x7')](),controller[_0x2c97('0x8')]);router[_0x2c97('0x4')](_0x2c97('0x9'),auth[_0x2c97('0x6')](),auth[_0x2c97('0x7')](),controller['reset']);router[_0x2c97('0x4')](_0x2c97('0xa'),auth['isAuthenticated'](),auth[_0x2c97('0x7')](),controller[_0x2c97('0xb')]);router['get'](_0x2c97('0xc'),auth[_0x2c97('0x6')](),controller[_0x2c97('0xd')]);router[_0x2c97('0x4')](_0x2c97('0xe'),controller[_0x2c97('0xf')]);module[_0x2c97('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 909e52f..52098e1 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 _0x77bd=['query','latest','fetch','version','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','root','replace','.js','push','sort','sequelize','getQueryInterface','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','exec','../../config/pm2','../../config/logger','simple-git','index','exports'];(function(_0x523a27,_0x3d941c){var _0x39e570=function(_0x5a5ff9){while(--_0x5a5ff9){_0x523a27['push'](_0x523a27['shift']());}};_0x39e570(++_0x3d941c);}(_0x77bd,0x85));var _0xd77b=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0x77bd[_0x47bc58];return _0x4a0860;};'use strict';var Umzug=require(_0xd77b('0x0'));var path=require(_0xd77b('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xd77b('0x2'))(module,'version');var compareVersions=require(_0xd77b('0x3'));var exec=require(_0xd77b('0x4'))[_0xd77b('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xd77b('0x6'));var logger=require(_0xd77b('0x7'))('update');var git=require(_0xd77b('0x8'))(config['root']);exports[_0xd77b('0x9')]=function(_0x11abdb,_0x2ce5ca){var _0x2ed42f={'current':module[_0xd77b('0xa')]['version'],'phonebar':0x2};if(_0x11abdb[_0xd77b('0xb')]&&_0x11abdb[_0xd77b('0xb')][_0xd77b('0xc')]){return git[_0xd77b('0xd')]()['tags'](function(_0x5b6de6,_0x5e302c){_0x2ed42f[_0xd77b('0xc')]=(_0x5b6de6?module[_0xd77b('0xa')][_0xd77b('0xe')]:_0x5e302c[_0xd77b('0xc')])||'2.0.0';return _0x2ce5ca[_0xd77b('0xf')](0xc8)[_0xd77b('0x10')](_0x2ed42f);});}else{return _0x2ce5ca[_0xd77b('0xf')](0xc8)[_0xd77b('0x10')](_0x2ed42f);}};exports[_0xd77b('0xd')]=function(_0x285858,_0x1d534b){return git['fetch']([_0xd77b('0x11'),'master'],function(_0xd1487c){if(_0xd1487c){logger[_0xd77b('0x12')](_0xd1487c);return _0x1d534b[_0xd77b('0xf')](0x1f4)[_0xd77b('0x10')](_0xd1487c);}logger[_0xd77b('0x13')](_0xd77b('0x14'));return _0x1d534b['status'](0xc8)[_0xd77b('0x10')]({'output':_0xd77b('0x15')});});};exports[_0xd77b('0x16')]=function(_0x715120,_0xc21466){return git[_0xd77b('0x16')]([_0xd77b('0x17'),_0xd77b('0x18')],function(_0x2f5d63){if(_0x2f5d63){logger['error'](_0x2f5d63);return _0xc21466['status'](0x1f4)[_0xd77b('0x10')](_0x2f5d63);}logger[_0xd77b('0x13')](_0xd77b('0x19'));return _0xc21466[_0xd77b('0xf')](0xc8)[_0xd77b('0x10')]({'output':'git\x20reset\x20--hard'});});};exports[_0xd77b('0x1a')]=function(_0x216f72,_0x2677a0){exec('npm\x20install\x20--production',function(_0x4f26b2,_0x58986b,_0x315b43){logger[_0xd77b('0x13')](_0x58986b);logger[_0xd77b('0x13')](_0x315b43);if(_0x4f26b2){logger[_0xd77b('0x12')](_0x4f26b2);return _0x2677a0[_0xd77b('0xf')](0x1f4)[_0xd77b('0x10')](_0x4f26b2);}return _0x2677a0[_0xd77b('0xf')](0xc8)[_0xd77b('0x10')]({'output':_0x58986b});});};exports[_0xd77b('0x1b')]=function(_0x1331ab,_0x86ca57){return pm2[_0xd77b('0x1b')]('motion2')['then'](function(_0x50429c){logger['info'](_0xd77b('0x1c'),_0x50429c);return _0x86ca57[_0xd77b('0xf')](0xc8)['json']({'output':_0xd77b('0x1d')});})['catch'](function(_0x2a9467){logger[_0xd77b('0x12')](_0x2a9467);return _0x86ca57[_0xd77b('0xf')](0x1f4)[_0xd77b('0x10')](_0x2a9467);});};exports[_0xd77b('0x1e')]=function(_0x341e92,_0x380c77){var _0x4ad227=fs[_0xd77b('0x1f')](path[_0xd77b('0x20')](config[_0xd77b('0x21')],'server',_0xd77b('0x1e')));var _0x1c11ac=[];for(var _0x1fed69=0x0;_0x1fed69<_0x4ad227['length'];_0x1fed69++){var _0x3c0bc1=_0x4ad227[_0x1fed69][_0xd77b('0x22')](_0xd77b('0x23'),'');if(compareVersions(module['exports']['version'],_0x3c0bc1)===-0x1){_0x1c11ac[_0xd77b('0x24')](_0x3c0bc1);}}if(_0x1c11ac['length']){var _0x4a6b2d=_0x1c11ac[_0xd77b('0x25')](compareVersions);var _0x34498b=new Umzug({'storage':_0xd77b('0x26'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xd77b('0xe')},'migrations':{'params':[db[_0xd77b('0x26')][_0xd77b('0x27')](),db[_0xd77b('0x26')]['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[_0xd77b('0x20')](config['root'],'server',_0xd77b('0x1e')),'pattern':/\.js$/}});_0x34498b['up']({'migrations':_[_0xd77b('0x28')](_0x4a6b2d,function(_0x227fd4){return _0x227fd4+'.js';})})[_0xd77b('0x29')](function(){return _0x380c77[_0xd77b('0xf')](0xc8)[_0xd77b('0x10')]({'output':_0xd77b('0x2a')+module['exports'][_0xd77b('0xe')]+_0xd77b('0x2b')+_[_0xd77b('0x2c')](_0x4a6b2d),'migrations':_['join'](_0x4a6b2d)});})[_0xd77b('0x2d')](function(_0x1cc2ca){if(_0x1cc2ca instanceof db[_0xd77b('0x26')][_0xd77b('0x2e')]){return _0x380c77[_0xd77b('0xf')](0xc8)[_0xd77b('0x10')]({'output':_0xd77b('0x2f')});}else{return _0x380c77['status'](0x1f4)[_0xd77b('0x10')](_0x1cc2ca);}});}else{return _0x380c77[_0xd77b('0xf')](0xc8)['json']({'output':_0xd77b('0x2f')});}}; \ No newline at end of file +var _0xff9f=['fetch','status','json','origin','master','info','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','root','server','length','replace','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','simple-git','exports','query','latest'];(function(_0x4f35f0,_0xc2ad53){var _0xcf7d07=function(_0x10b0b5){while(--_0x10b0b5){_0x4f35f0['push'](_0x4f35f0['shift']());}};_0xcf7d07(++_0xc2ad53);}(_0xff9f,0x17c));var _0xfff9=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xff9f[_0x95942];return _0x6d7f81;};'use strict';var Umzug=require(_0xfff9('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xfff9('0x1'))(module,_0xfff9('0x2'));var compareVersions=require(_0xfff9('0x3'));var exec=require(_0xfff9('0x4'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xfff9('0x5'));var pm2=require(_0xfff9('0x6'));var logger=require(_0xfff9('0x7'))('update');var git=require(_0xfff9('0x8'))(config['root']);exports['index']=function(_0x5dfc5e,_0x39ab85){var _0x28a308={'current':module[_0xfff9('0x9')]['version'],'phonebar':0x2};if(_0x5dfc5e['query']&&_0x5dfc5e[_0xfff9('0xa')][_0xfff9('0xb')]){return git[_0xfff9('0xc')]()['tags'](function(_0x508fdb,_0x25f13a){_0x28a308[_0xfff9('0xb')]=(_0x508fdb?module[_0xfff9('0x9')][_0xfff9('0x2')]:_0x25f13a[_0xfff9('0xb')])||'2.0.0';return _0x39ab85[_0xfff9('0xd')](0xc8)['json'](_0x28a308);});}else{return _0x39ab85[_0xfff9('0xd')](0xc8)[_0xfff9('0xe')](_0x28a308);}};exports[_0xfff9('0xc')]=function(_0x361814,_0xd23246){return git[_0xfff9('0xc')]([_0xfff9('0xf'),_0xfff9('0x10')],function(_0x44ce0f){if(_0x44ce0f){logger['error'](_0x44ce0f);return _0xd23246[_0xfff9('0xd')](0x1f4)[_0xfff9('0xe')](_0x44ce0f);}logger[_0xfff9('0x11')]('git\x20fetch');return _0xd23246[_0xfff9('0xd')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xfff9('0x12')]=function(_0xde1d6e,_0x14225a){return git[_0xfff9('0x12')]([_0xfff9('0x13'),_0xfff9('0x14')],function(_0xd603f8){if(_0xd603f8){logger[_0xfff9('0x15')](_0xd603f8);return _0x14225a['status'](0x1f4)[_0xfff9('0xe')](_0xd603f8);}logger[_0xfff9('0x11')](_0xfff9('0x16'));return _0x14225a[_0xfff9('0xd')](0xc8)[_0xfff9('0xe')]({'output':_0xfff9('0x17')});});};exports[_0xfff9('0x18')]=function(_0x4d7795,_0x9b001a){exec(_0xfff9('0x19'),function(_0x210969,_0x23fa75,_0x38c950){logger[_0xfff9('0x11')](_0x23fa75);logger[_0xfff9('0x11')](_0x38c950);if(_0x210969){logger[_0xfff9('0x15')](_0x210969);return _0x9b001a[_0xfff9('0xd')](0x1f4)['json'](_0x210969);}return _0x9b001a['status'](0xc8)[_0xfff9('0xe')]({'output':_0x23fa75});});};exports[_0xfff9('0x1a')]=function(_0x2e8659,_0x145819){return pm2[_0xfff9('0x1a')](_0xfff9('0x1b'))[_0xfff9('0x1c')](function(_0x1a1cc9){logger[_0xfff9('0x11')](_0xfff9('0x1d'),_0x1a1cc9);return _0x145819[_0xfff9('0xd')](0xc8)['json']({'output':_0xfff9('0x1e')});})['catch'](function(_0x428a33){logger[_0xfff9('0x15')](_0x428a33);return _0x145819['status'](0x1f4)['json'](_0x428a33);});};exports[_0xfff9('0x1f')]=function(_0x5298a4,_0x55976d){var _0xa953e6=fs['readdirSync'](path['join'](config[_0xfff9('0x20')],_0xfff9('0x21'),_0xfff9('0x1f')));var _0x1ccd9a=[];for(var _0x57fc0a=0x0;_0x57fc0a<_0xa953e6[_0xfff9('0x22')];_0x57fc0a++){var _0x5ed8a9=_0xa953e6[_0x57fc0a][_0xfff9('0x23')]('.js','');if(compareVersions(module[_0xfff9('0x9')][_0xfff9('0x2')],_0x5ed8a9)===-0x1){_0x1ccd9a[_0xfff9('0x24')](_0x5ed8a9);}}if(_0x1ccd9a[_0xfff9('0x22')]){var _0x4e4f78=_0x1ccd9a[_0xfff9('0x25')](compareVersions);var _0x2a6281=new Umzug({'storage':_0xfff9('0x26'),'storageOptions':{'model':db[_0xfff9('0x27')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xfff9('0x26')][_0xfff9('0x28')],function(){throw new Error(_0xfff9('0x29'));}],'path':path[_0xfff9('0x2a')](config[_0xfff9('0x20')],_0xfff9('0x21'),_0xfff9('0x1f')),'pattern':/\.js$/}});_0x2a6281['up']({'migrations':_[_0xfff9('0x2b')](_0x4e4f78,function(_0x3a6f0d){return _0x3a6f0d+_0xfff9('0x2c');})})[_0xfff9('0x1c')](function(){return _0x55976d['status'](0xc8)[_0xfff9('0xe')]({'output':_0xfff9('0x2d')+module[_0xfff9('0x9')][_0xfff9('0x2')]+_0xfff9('0x2e')+_[_0xfff9('0x2f')](_0x4e4f78),'migrations':_['join'](_0x4e4f78)});})['catch'](function(_0x5e2876){if(_0x5e2876 instanceof db['sequelize']['UniqueConstraintError']){return _0x55976d[_0xfff9('0xd')](0xc8)[_0xfff9('0xe')]({'output':_0xfff9('0x30')});}else{return _0x55976d['status'](0x1f4)['json'](_0x5e2876);}});}else{return _0x55976d[_0xfff9('0xd')](0xc8)[_0xfff9('0xe')]({'output':_0xfff9('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 84c2a97..a0e3fb5 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 _0xae99=['get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x45ee80,_0x556689){var _0x350e98=function(_0x96e156){while(--_0x96e156){_0x45ee80['push'](_0x45ee80['shift']());}};_0x350e98(++_0x556689);}(_0xae99,0x8a));var _0x9ae9=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xae99[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x9ae9('0x0'));var util=require(_0x9ae9('0x1'));var path=require(_0x9ae9('0x2'));var timeout=require(_0x9ae9('0x3'));var express=require(_0x9ae9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ae9('0x5'));var interaction=require(_0x9ae9('0x6'));var config=require(_0x9ae9('0x7'));var controller=require(_0x9ae9('0x8'));router[_0x9ae9('0x9')]('/',auth['isAuthenticated'](),controller[_0x9ae9('0xa')]);router['get'](_0x9ae9('0xb'),auth['isAuthenticated'](),controller[_0x9ae9('0xc')]);router[_0x9ae9('0x9')](_0x9ae9('0xd'),auth[_0x9ae9('0xe')](),controller[_0x9ae9('0xf')]);router[_0x9ae9('0x10')]('/',auth[_0x9ae9('0xe')](),controller[_0x9ae9('0x11')]);router[_0x9ae9('0x12')](_0x9ae9('0xd'),auth[_0x9ae9('0xe')](),controller['update']);router[_0x9ae9('0x13')](_0x9ae9('0xd'),auth[_0x9ae9('0xe')](),controller[_0x9ae9('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc098=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xc098,0x12a));var _0x8c09=function(_0xabc2ad,_0x32fd6f){_0xabc2ad=_0xabc2ad-0x0;var _0x246a7f=_0xc098[_0xabc2ad];return _0x246a7f;};'use strict';var multer=require(_0x8c09('0x0'));var util=require(_0x8c09('0x1'));var path=require(_0x8c09('0x2'));var timeout=require(_0x8c09('0x3'));var express=require(_0x8c09('0x4'));var router=express[_0x8c09('0x5')]();var fs_extra=require(_0x8c09('0x6'));var auth=require(_0x8c09('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c09('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8c09('0x9')](_0x8c09('0xa'),auth[_0x8c09('0xb')](),controller[_0x8c09('0xc')]);router[_0x8c09('0x9')](_0x8c09('0xd'),auth[_0x8c09('0xb')](),controller[_0x8c09('0xe')]);router[_0x8c09('0xf')]('/',auth[_0x8c09('0xb')](),controller[_0x8c09('0x10')]);router['put']('/:id',auth[_0x8c09('0xb')](),controller['update']);router[_0x8c09('0x11')](_0x8c09('0xd'),auth['isAuthenticated'](),controller[_0x8c09('0x12')]);module[_0x8c09('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 6598856..da4184e 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 _0x8a5c=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x19258b,_0x22e850){var _0x5be66a=function(_0x24e321){while(--_0x24e321){_0x19258b['push'](_0x19258b['shift']());}};_0x5be66a(++_0x22e850);}(_0x8a5c,0x136));var _0xc8a5=function(_0x515311,_0x11824b){_0x515311=_0x515311-0x0;var _0x718b13=_0x8a5c[_0x515311];return _0x718b13;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'type':{'type':Sequelize[_0xc8a5('0x2')]},'uniqueid':{'type':Sequelize[_0xc8a5('0x2')]},'calleridnum':{'type':Sequelize[_0xc8a5('0x2')]},'calleridname':{'type':Sequelize[_0xc8a5('0x2')]},'queue':{'type':Sequelize[_0xc8a5('0x2')]},'interface':{'type':Sequelize[_0xc8a5('0x2')]},'membername':{'type':Sequelize[_0xc8a5('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc8a5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc8a5('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xc8a5('0x3')]},'holdtime':{'type':Sequelize[_0xc8a5('0x4')]},'agentcomplete':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc8a5('0x4')]},'agentacw':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc8a5('0x4')]},'reason':{'type':Sequelize[_0xc8a5('0x2')]},'lastevent':{'type':Sequelize[_0xc8a5('0x2')]},'channel':{'type':Sequelize[_0xc8a5('0x2')]},'channelstate':{'type':Sequelize[_0xc8a5('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc8a5('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc8a5('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc8a5('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc8a5('0x2')]},'priority':{'type':Sequelize[_0xc8a5('0x2')]},'destchannel':{'type':Sequelize[_0xc8a5('0x2')]},'destchannelstate':{'type':Sequelize[_0xc8a5('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc8a5('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc8a5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc8a5('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc8a5('0x2')]},'destaccountcode':{'type':Sequelize[_0xc8a5('0x2')]},'destcontext':{'type':Sequelize[_0xc8a5('0x2')]},'destexten':{'type':Sequelize[_0xc8a5('0x2')]},'destpriority':{'type':Sequelize[_0xc8a5('0x2')]},'destuniqueid':{'type':Sequelize[_0xc8a5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc8a5('0x2')]},'transfer':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc8a5('0x6')},'transferexten':{'type':Sequelize[_0xc8a5('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a5c=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x8a5c,0x136));var _0xc8a5=function(_0x3555db,_0x5d78eb){_0x3555db=_0x3555db-0x0;var _0x362c0f=_0x8a5c[_0x3555db];return _0x362c0f;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'type':{'type':Sequelize[_0xc8a5('0x2')]},'uniqueid':{'type':Sequelize[_0xc8a5('0x2')]},'calleridnum':{'type':Sequelize[_0xc8a5('0x2')]},'calleridname':{'type':Sequelize[_0xc8a5('0x2')]},'queue':{'type':Sequelize[_0xc8a5('0x2')]},'interface':{'type':Sequelize[_0xc8a5('0x2')]},'membername':{'type':Sequelize[_0xc8a5('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc8a5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc8a5('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xc8a5('0x3')]},'holdtime':{'type':Sequelize[_0xc8a5('0x4')]},'agentcomplete':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc8a5('0x4')]},'agentacw':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc8a5('0x4')]},'reason':{'type':Sequelize[_0xc8a5('0x2')]},'lastevent':{'type':Sequelize[_0xc8a5('0x2')]},'channel':{'type':Sequelize[_0xc8a5('0x2')]},'channelstate':{'type':Sequelize[_0xc8a5('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc8a5('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc8a5('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc8a5('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc8a5('0x2')]},'priority':{'type':Sequelize[_0xc8a5('0x2')]},'destchannel':{'type':Sequelize[_0xc8a5('0x2')]},'destchannelstate':{'type':Sequelize[_0xc8a5('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc8a5('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc8a5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc8a5('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc8a5('0x2')]},'destaccountcode':{'type':Sequelize[_0xc8a5('0x2')]},'destcontext':{'type':Sequelize[_0xc8a5('0x2')]},'destexten':{'type':Sequelize[_0xc8a5('0x2')]},'destpriority':{'type':Sequelize[_0xc8a5('0x2')]},'destuniqueid':{'type':Sequelize[_0xc8a5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc8a5('0x2')]},'transfer':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc8a5('0x6')},'transferexten':{'type':Sequelize[_0xc8a5('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 8df371f..82644d4 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(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 004d095..04cce5e 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 _0xda19=['request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','util','../../config/logger','moment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xda19,0xd5));var _0x9da1=function(_0xd08166,_0x3b0592){_0xd08166=_0xd08166-0x0;var _0x5a9912=_0xda19[_0xd08166];return _0x5a9912;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9da1('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa63f=['request-promise','path','rimraf','../../config/environment','define','VoiceAgentReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa63f,0x1b6));var _0xfa63=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xa63f[_0x54defc];return _0x1955d3;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var logger=require(_0xfa63('0x2'))(_0xfa63('0x3'));var moment=require(_0xfa63('0x4'));var BPromise=require(_0xfa63('0x5'));var rp=require(_0xfa63('0x6'));var fs=require('fs');var path=require(_0xfa63('0x7'));var rimraf=require(_0xfa63('0x8'));var config=require(_0xfa63('0x9'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x20d4f6,_0x41efce){return _0x20d4f6[_0xfa63('0xa')](_0xfa63('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 8477b98..b6fab42 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 _0x9cd8=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9cd8,0x100));var _0x89cd=function(_0x2f713a,_0x15e743){_0x2f713a=_0x2f713a-0x0;var _0x10189d=_0x9cd8[_0x2f713a];return _0x10189d;};'use strict';var _=require(_0x89cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x89cd('0x1'));var rs=require(_0x89cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89cd('0x3'))['db'];var utils=require(_0x89cd('0x4'));var logger=require(_0x89cd('0x5'))('rpc');var config=require(_0x89cd('0x6'));var jayson=require(_0x89cd('0x7'));var client=jayson['client'][_0x89cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25e44e,_0x424502,_0x269140){return new BPromise(function(_0x37ff91,_0x3e3a5c){return client['request'](_0x25e44e,_0x269140)[_0x89cd('0x9')](function(_0x2858cc){logger[_0x89cd('0xa')](_0x89cd('0xb'),_0x424502,_0x89cd('0xc'));logger[_0x89cd('0xd')](_0x89cd('0xe'),_0x424502,'request\x20sent',JSON[_0x89cd('0xf')](_0x2858cc));if(_0x2858cc[_0x89cd('0x10')]){if(_0x2858cc['error']['code']===0x1f4){logger[_0x89cd('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x424502,_0x2858cc['error']['message']);return _0x3e3a5c(_0x2858cc[_0x89cd('0x10')]['message']);}logger[_0x89cd('0x10')](_0x89cd('0xb'),_0x424502,_0x2858cc[_0x89cd('0x10')]['message']);return _0x37ff91(_0x2858cc['error'][_0x89cd('0x11')]);}else{logger[_0x89cd('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x424502,'request\x20sent');_0x37ff91(_0x2858cc['result'][_0x89cd('0x11')]);}})[_0x89cd('0x12')](function(_0xef3673){logger[_0x89cd('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x424502,_0xef3673);_0x3e3a5c(_0xef3673);});});}exports[_0x89cd('0x13')]=function(_0x1b267f){var _0x2808fb=this;return new Promise(function(_0xbbaa55,_0x3c5c70){return db[_0x89cd('0x14')][_0x89cd('0x15')](_0x1b267f['body'],{'raw':_0x1b267f[_0x89cd('0x16')]?_0x1b267f['options'][_0x89cd('0x17')]===undefined?!![]:![]:!![]})[_0x89cd('0x9')](function(_0x255eae){logger[_0x89cd('0xa')](_0x89cd('0x13'),_0x1b267f);logger['debug'](_0x89cd('0x13'),_0x1b267f,JSON['stringify'](_0x255eae));_0xbbaa55(_0x255eae);})[_0x89cd('0x12')](function(_0x5bf9f0){logger[_0x89cd('0x10')]('CreateVoiceAgentReport',_0x5bf9f0[_0x89cd('0x11')],_0x1b267f);_0x3c5c70(_0x2808fb[_0x89cd('0x10')](0x1f4,_0x5bf9f0['message']));});});};exports[_0x89cd('0x18')]=function(_0x5f1e5d){var _0x411b11=this;return new Promise(function(_0x2c6a20,_0x52ead1){return db[_0x89cd('0x14')][_0x89cd('0x19')](_0x5f1e5d[_0x89cd('0x1a')],{'raw':_0x5f1e5d[_0x89cd('0x16')]?_0x5f1e5d[_0x89cd('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f1e5d[_0x89cd('0x16')]?_0x5f1e5d[_0x89cd('0x16')][_0x89cd('0x1b')]||null:null,'attributes':_0x5f1e5d[_0x89cd('0x16')]?_0x5f1e5d[_0x89cd('0x16')][_0x89cd('0x1c')]||null:null,'limit':_0x5f1e5d[_0x89cd('0x16')]?_0x5f1e5d[_0x89cd('0x16')][_0x89cd('0x1d')]||null:null})['then'](function(_0x563699){logger[_0x89cd('0xa')](_0x89cd('0x18'),_0x5f1e5d);logger[_0x89cd('0xd')]('UpdateVoiceAgentReport',_0x5f1e5d,JSON[_0x89cd('0xf')](_0x563699));_0x2c6a20(_0x563699);})[_0x89cd('0x12')](function(_0x35e106){logger[_0x89cd('0x10')](_0x89cd('0x18'),_0x35e106['message'],_0x5f1e5d);_0x52ead1(_0x411b11[_0x89cd('0x10')](0x1f4,_0x35e106[_0x89cd('0x11')]));});});}; \ No newline at end of file +var _0x00ff=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','raw','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00ff,0x199));var _0xf00f=function(_0x1c2404,_0x120c50){_0x1c2404=_0x1c2404-0x0;var _0x389702=_0x00ff[_0x1c2404];return _0x389702;};'use strict';var _=require(_0xf00f('0x0'));var util=require(_0xf00f('0x1'));var moment=require(_0xf00f('0x2'));var BPromise=require('bluebird');var rs=require(_0xf00f('0x3'));var fs=require('fs');var Redis=require(_0xf00f('0x4'));var db=require(_0xf00f('0x5'))['db'];var utils=require(_0xf00f('0x6'));var logger=require('../../config/logger')(_0xf00f('0x7'));var config=require(_0xf00f('0x8'));var jayson=require(_0xf00f('0x9'));var client=jayson[_0xf00f('0xa')][_0xf00f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c9816,_0x493e77,_0x5a73e2){return new BPromise(function(_0x4d6dc0,_0x384bc1){return client[_0xf00f('0xc')](_0x5c9816,_0x5a73e2)[_0xf00f('0xd')](function(_0x262cb5){logger[_0xf00f('0xe')](_0xf00f('0xf'),_0x493e77,_0xf00f('0x10'));logger[_0xf00f('0x11')](_0xf00f('0x12'),_0x493e77,_0xf00f('0x10'),JSON[_0xf00f('0x13')](_0x262cb5));if(_0x262cb5[_0xf00f('0x14')]){if(_0x262cb5['error'][_0xf00f('0x15')]===0x1f4){logger[_0xf00f('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x493e77,_0x262cb5[_0xf00f('0x14')][_0xf00f('0x16')]);return _0x384bc1(_0x262cb5['error'][_0xf00f('0x16')]);}logger[_0xf00f('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x493e77,_0x262cb5[_0xf00f('0x14')][_0xf00f('0x16')]);return _0x4d6dc0(_0x262cb5[_0xf00f('0x14')][_0xf00f('0x16')]);}else{logger[_0xf00f('0xe')](_0xf00f('0xf'),_0x493e77,_0xf00f('0x10'));_0x4d6dc0(_0x262cb5[_0xf00f('0x17')][_0xf00f('0x16')]);}})['catch'](function(_0x2cecb5){logger[_0xf00f('0x14')](_0xf00f('0xf'),_0x493e77,_0x2cecb5);_0x384bc1(_0x2cecb5);});});}exports[_0xf00f('0x18')]=function(_0x91ef61){var _0x26ab52=this;return new Promise(function(_0x371b00,_0x2a694e){return db[_0xf00f('0x19')][_0xf00f('0x1a')](_0x91ef61[_0xf00f('0x1b')],{'raw':_0x91ef61[_0xf00f('0x1c')]?_0x91ef61[_0xf00f('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf00f('0xd')](function(_0x287668){logger[_0xf00f('0xe')](_0xf00f('0x18'),_0x91ef61);logger[_0xf00f('0x11')](_0xf00f('0x18'),_0x91ef61,JSON[_0xf00f('0x13')](_0x287668));_0x371b00(_0x287668);})['catch'](function(_0x5bff38){logger[_0xf00f('0x14')](_0xf00f('0x18'),_0x5bff38['message'],_0x91ef61);_0x2a694e(_0x26ab52[_0xf00f('0x14')](0x1f4,_0x5bff38['message']));});});};exports[_0xf00f('0x1d')]=function(_0x239926){var _0x522271=this;return new Promise(function(_0x156196,_0x2054d4){return db[_0xf00f('0x19')][_0xf00f('0x1e')](_0x239926[_0xf00f('0x1b')],{'raw':_0x239926[_0xf00f('0x1c')]?_0x239926[_0xf00f('0x1c')][_0xf00f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x239926['options']?_0x239926[_0xf00f('0x1c')]['where']||null:null,'attributes':_0x239926[_0xf00f('0x1c')]?_0x239926[_0xf00f('0x1c')][_0xf00f('0x20')]||null:null,'limit':_0x239926[_0xf00f('0x1c')]?_0x239926['options']['limit']||null:null})[_0xf00f('0xd')](function(_0x3b3263){logger[_0xf00f('0xe')](_0xf00f('0x1d'),_0x239926);logger[_0xf00f('0x11')](_0xf00f('0x1d'),_0x239926,JSON[_0xf00f('0x13')](_0x3b3263));_0x156196(_0x3b3263);})[_0xf00f('0x21')](function(_0xe7cfa5){logger[_0xf00f('0x14')](_0xf00f('0x1d'),_0xe7cfa5[_0xf00f('0x16')],_0x239926);_0x2054d4(_0x522271[_0xf00f('0x14')](0x1f4,_0xe7cfa5[_0xf00f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1c5c07e..10bc914 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 _0x5c12=['./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x5c12,0x188));var _0x25c1=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x5c12[_0x5a636f];return _0x6a8cfb;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x25c1('0xc')]);router[_0x25c1('0xb')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);router['post']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller['update']);router[_0x25c1('0x11')](_0x25c1('0xd'),auth['isAuthenticated'](),controller[_0x25c1('0x12')]);module[_0x25c1('0x13')]=router; \ No newline at end of file +var _0xb138=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x17b2f0,_0x1f6e62){var _0x42372a=function(_0x3bb080){while(--_0x3bb080){_0x17b2f0['push'](_0x17b2f0['shift']());}};_0x42372a(++_0x1f6e62);}(_0xb138,0x1dd));var _0x8b13=function(_0xb928f2,_0x8792e7){_0xb928f2=_0xb928f2-0x0;var _0x43d31d=_0xb138[_0xb928f2];return _0x43d31d;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['update']);router[_0x8b13('0x11')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x12')]);module[_0x8b13('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 548a5ff..9129025 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 _0xa923=['dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','outbound','outbound-fax'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa923,0xcb));var _0x3a92=function(_0x5cf491,_0x41af38){_0x5cf491=_0x5cf491-0x0;var _0x12352b=_0xa923[_0x5cf491];return _0x12352b;};'use strict';var Sequelize=require(_0x3a92('0x0'));module[_0x3a92('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3a92('0x2')](_0x3a92('0x3'),'internal',_0x3a92('0x4'),'inbound-fax',_0x3a92('0x5'),_0x3a92('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3a92('0x7')]},'source':{'type':Sequelize[_0x3a92('0x7')]},'destination':{'type':Sequelize[_0x3a92('0x7')]},'destinationcontext':{'type':Sequelize[_0x3a92('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3a92('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x3a92('0x7')]},'lastdata':{'type':Sequelize[_0x3a92('0x8')]},'starttime':{'type':Sequelize[_0x3a92('0x9')]},'systemanswertime':{'type':Sequelize[_0x3a92('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3a92('0x9')]},'duration':{'type':Sequelize[_0x3a92('0xa')]},'billableseconds':{'type':Sequelize[_0x3a92('0xa')]},'mohtime':{'type':Sequelize[_0x3a92('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3a92('0x7')]},'amaflags':{'type':Sequelize[_0x3a92('0x7')]},'userfield':{'type':Sequelize[_0x3a92('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x3a92('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3a92('0x7')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x3a92('0x7')]}}; \ No newline at end of file +var _0xee3a=['sequelize','exports','STRING','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xee3a,0x13f));var _0xaee3=function(_0x53bb34,_0x425922){_0x53bb34=_0x53bb34-0x0;var _0x1102fe=_0xee3a[_0x53bb34];return _0x1102fe;};'use strict';var Sequelize=require(_0xaee3('0x0'));module[_0xaee3('0x1')]={'uniqueid':{'type':Sequelize[_0xaee3('0x2')]},'type':{'type':Sequelize['ENUM'](_0xaee3('0x3'),_0xaee3('0x4'),'outbound',_0xaee3('0x5'),_0xaee3('0x6'),_0xaee3('0x7'))},'tag':{'type':Sequelize[_0xaee3('0x2')]},'accountcode':{'type':Sequelize[_0xaee3('0x2')]},'source':{'type':Sequelize[_0xaee3('0x2')]},'destination':{'type':Sequelize[_0xaee3('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaee3('0x2')]},'channel':{'type':Sequelize[_0xaee3('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xaee3('0x8')]},'starttime':{'type':Sequelize[_0xaee3('0x9')]},'systemanswertime':{'type':Sequelize[_0xaee3('0x9')]},'answertime':{'type':Sequelize[_0xaee3('0x9')]},'endtime':{'type':Sequelize[_0xaee3('0x9')]},'duration':{'type':Sequelize[_0xaee3('0xa')]},'billableseconds':{'type':Sequelize[_0xaee3('0xa')]},'mohtime':{'type':Sequelize[_0xaee3('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xaee3('0x2')]},'userDisposition':{'type':Sequelize[_0xaee3('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xaee3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xaee3('0x2')]},'note':{'type':Sequelize[_0xaee3('0x2')]},'prefix':{'type':Sequelize[_0xaee3('0x2')]},'routeid':{'type':Sequelize[_0xaee3('0xa')]},'sipcallid':{'type':Sequelize[_0xaee3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c46f73b..8a87214 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x45b23a,_0x162186){var _0x491c0a=function(_0x107c54){while(--_0x107c54){_0x45b23a['push'](_0x45b23a['shift']());}};_0x491c0a(++_0x162186);}(_0xdb28,0x106));var _0x8db2=function(_0x1e118c,_0x5c46c4){_0x1e118c=_0x1e118c-0x0;var _0x49781c=_0xdb28[_0x1e118c];return _0x49781c;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x2ed182,_0x3df471){_0x2ed182=_0x2ed182-0x0;var _0x3647c7=_0x2032[_0x2ed182];return _0x3647c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 5ccb5b0..854db2a 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 _0xb790=['bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment'];(function(_0x18b0c5,_0x43ec3f){var _0x1a32a6=function(_0x469de5){while(--_0x469de5){_0x18b0c5['push'](_0x18b0c5['shift']());}};_0x1a32a6(++_0x43ec3f);}(_0xb790,0x1ae));var _0x0b79=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0xb790[_0x4f8f3b];return _0x4c250c;};'use strict';var _=require('lodash');var util=require(_0x0b79('0x0'));var logger=require(_0x0b79('0x1'))(_0x0b79('0x2'));var moment=require(_0x0b79('0x3'));var BPromise=require(_0x0b79('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b79('0x5'));var rimraf=require(_0x0b79('0x6'));var config=require(_0x0b79('0x7'));var attributes=require(_0x0b79('0x8'));module[_0x0b79('0x9')]=function(_0x3d104a,_0x43510f){return _0x3d104a[_0x0b79('0xa')](_0x0b79('0xb'),attributes,{'tableName':_0x0b79('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0b79('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc6c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xbc6c,0x16a));var _0xcbc6=function(_0x308f78,_0x85906f){_0x308f78=_0x308f78-0x0;var _0x438ae3=_0xbc6c[_0x308f78];return _0x438ae3;};'use strict';var _=require(_0xcbc6('0x0'));var util=require('util');var logger=require(_0xcbc6('0x1'))(_0xcbc6('0x2'));var moment=require(_0xcbc6('0x3'));var BPromise=require(_0xcbc6('0x4'));var rp=require(_0xcbc6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbc6('0x6'));var config=require(_0xcbc6('0x7'));var attributes=require(_0xcbc6('0x8'));module[_0xcbc6('0x9')]=function(_0x57ca73,_0x483c0f){return _0x57ca73[_0xcbc6('0xa')](_0xcbc6('0xb'),attributes,{'tableName':_0xcbc6('0xc'),'paranoid':![],'indexes':[{'fields':[_0xcbc6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 0d72919..cdd24f0 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 _0xdccd=['debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','attributes','limit','include','model','map','CreateVoiceCallReport','body','update','where','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5a25d1,_0x2e9548){var _0x23ca8f=function(_0x18a228){while(--_0x18a228){_0x5a25d1['push'](_0x5a25d1['shift']());}};_0x23ca8f(++_0x2e9548);}(_0xdccd,0x64));var _0xddcc=function(_0x34af04,_0x5ae424){_0x34af04=_0x34af04-0x0;var _0x1e5188=_0xdccd[_0x34af04];return _0x1e5188;};'use strict';var _=require(_0xddcc('0x0'));var util=require('util');var moment=require(_0xddcc('0x1'));var BPromise=require(_0xddcc('0x2'));var rs=require(_0xddcc('0x3'));var fs=require('fs');var Redis=require(_0xddcc('0x4'));var db=require(_0xddcc('0x5'))['db'];var utils=require(_0xddcc('0x6'));var logger=require(_0xddcc('0x7'))(_0xddcc('0x8'));var config=require('../../config/environment');var jayson=require(_0xddcc('0x9'));var client=jayson[_0xddcc('0xa')][_0xddcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e4b2d,_0x374af3,_0x56bf2f){return new BPromise(function(_0x4f176b,_0x5a1017){return client[_0xddcc('0xc')](_0x2e4b2d,_0x56bf2f)[_0xddcc('0xd')](function(_0x42403b){logger[_0xddcc('0xe')](_0xddcc('0xf'),_0x374af3,_0xddcc('0x10'));logger[_0xddcc('0x11')](_0xddcc('0x12'),_0x374af3,_0xddcc('0x10'),JSON[_0xddcc('0x13')](_0x42403b));if(_0x42403b[_0xddcc('0x14')]){if(_0x42403b[_0xddcc('0x14')][_0xddcc('0x15')]===0x1f4){logger[_0xddcc('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x374af3,_0x42403b[_0xddcc('0x14')][_0xddcc('0x16')]);return _0x5a1017(_0x42403b[_0xddcc('0x14')][_0xddcc('0x16')]);}logger['error'](_0xddcc('0xf'),_0x374af3,_0x42403b['error'][_0xddcc('0x16')]);return _0x4f176b(_0x42403b[_0xddcc('0x14')]['message']);}else{logger[_0xddcc('0xe')](_0xddcc('0xf'),_0x374af3,_0xddcc('0x10'));_0x4f176b(_0x42403b[_0xddcc('0x17')][_0xddcc('0x16')]);}})[_0xddcc('0x18')](function(_0x12fb82){logger[_0xddcc('0x14')](_0xddcc('0xf'),_0x374af3,_0x12fb82);_0x5a1017(_0x12fb82);});});}exports[_0xddcc('0x19')]=function(_0x4817e3){var _0x23f2c1=this;return new Promise(function(_0x207697,_0x2bd565){return db[_0xddcc('0x1a')]['findAll']({'raw':_0x4817e3[_0xddcc('0x1b')]?_0x4817e3[_0xddcc('0x1b')][_0xddcc('0x1c')]===undefined?!![]:![]:!![],'where':_0x4817e3[_0xddcc('0x1b')]?_0x4817e3[_0xddcc('0x1b')]['where']||null:null,'attributes':_0x4817e3['options']?_0x4817e3['options'][_0xddcc('0x1d')]||null:null,'limit':_0x4817e3[_0xddcc('0x1b')]?_0x4817e3['options'][_0xddcc('0x1e')]||null:null,'include':_0x4817e3[_0xddcc('0x1b')]?_0x4817e3[_0xddcc('0x1b')][_0xddcc('0x1f')]?_['map'](_0x4817e3['options'][_0xddcc('0x1f')],function(_0x212e86){return{'model':db[_0x212e86[_0xddcc('0x20')]],'as':_0x212e86['as'],'attributes':_0x212e86[_0xddcc('0x1d')],'include':_0x212e86['include']?_[_0xddcc('0x21')](_0x212e86[_0xddcc('0x1f')],function(_0xa4f7cd){return{'model':db[_0xa4f7cd[_0xddcc('0x20')]],'as':_0xa4f7cd['as'],'attributes':_0xa4f7cd[_0xddcc('0x1d')],'include':_0xa4f7cd[_0xddcc('0x1f')]?_[_0xddcc('0x21')](_0xa4f7cd[_0xddcc('0x1f')],function(_0x452a36){return{'model':db[_0x452a36[_0xddcc('0x20')]],'as':_0x452a36['as'],'attributes':_0x452a36[_0xddcc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xddcc('0xd')](function(_0x5f426a){logger[_0xddcc('0xe')](_0xddcc('0x19'),_0x4817e3);logger[_0xddcc('0x11')](_0xddcc('0x19'),_0x4817e3,JSON['stringify'](_0x5f426a));_0x207697(_0x5f426a);})[_0xddcc('0x18')](function(_0x258f61){logger[_0xddcc('0x14')](_0xddcc('0x19'),_0x258f61[_0xddcc('0x16')],_0x4817e3);_0x2bd565(_0x23f2c1[_0xddcc('0x14')](0x1f4,_0x258f61['message']));});});};exports[_0xddcc('0x22')]=function(_0x4f7ae5){var _0x3c1a0a=this;return new Promise(function(_0x2b853f,_0x48e067){return db['VoiceCallReport']['create'](_0x4f7ae5[_0xddcc('0x23')],{'raw':_0x4f7ae5['options']?_0x4f7ae5['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x103554){logger[_0xddcc('0xe')](_0xddcc('0x22'),_0x4f7ae5);logger[_0xddcc('0x11')](_0xddcc('0x22'),_0x4f7ae5,JSON[_0xddcc('0x13')](_0x103554));_0x2b853f(_0x103554);})[_0xddcc('0x18')](function(_0x19b034){logger[_0xddcc('0x14')]('CreateVoiceCallReport',_0x19b034[_0xddcc('0x16')],_0x4f7ae5);_0x48e067(_0x3c1a0a['error'](0x1f4,_0x19b034[_0xddcc('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x1f1fd4){var _0x12a170=this;return new Promise(function(_0x617ffa,_0x16e088){return db[_0xddcc('0x1a')][_0xddcc('0x24')](_0x1f1fd4['body'],{'raw':_0x1f1fd4[_0xddcc('0x1b')]?_0x1f1fd4[_0xddcc('0x1b')][_0xddcc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f1fd4[_0xddcc('0x1b')]?_0x1f1fd4[_0xddcc('0x1b')][_0xddcc('0x25')]||null:null,'attributes':_0x1f1fd4[_0xddcc('0x1b')]?_0x1f1fd4[_0xddcc('0x1b')][_0xddcc('0x1d')]||null:null,'limit':_0x1f1fd4[_0xddcc('0x1b')]?_0x1f1fd4['options'][_0xddcc('0x1e')]||null:null})[_0xddcc('0xd')](function(_0x4fe96e){logger[_0xddcc('0xe')](_0xddcc('0x26'),_0x1f1fd4);logger[_0xddcc('0x11')](_0xddcc('0x26'),_0x1f1fd4,JSON['stringify'](_0x4fe96e));_0x617ffa(_0x4fe96e);})[_0xddcc('0x18')](function(_0xfd2115){logger[_0xddcc('0x14')](_0xddcc('0x26'),_0xfd2115[_0xddcc('0x16')],_0x1f1fd4);_0x16e088(_0x12a170['error'](0x1f4,_0xfd2115['message']));});});}; \ No newline at end of file +var _0x1fbd=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','debug','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','update','lodash'];(function(_0x28b1d7,_0x128265){var _0x1c9446=function(_0xd568ce){while(--_0xd568ce){_0x28b1d7['push'](_0x28b1d7['shift']());}};_0x1c9446(++_0x128265);}(_0x1fbd,0x102));var _0xd1fb=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x1fbd[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xd1fb('0x0'));var util=require(_0xd1fb('0x1'));var moment=require(_0xd1fb('0x2'));var BPromise=require(_0xd1fb('0x3'));var rs=require(_0xd1fb('0x4'));var fs=require('fs');var Redis=require(_0xd1fb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd1fb('0x6'))(_0xd1fb('0x7'));var config=require(_0xd1fb('0x8'));var jayson=require(_0xd1fb('0x9'));var client=jayson[_0xd1fb('0xa')][_0xd1fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eb87f,_0x111442,_0x28e7a5){return new BPromise(function(_0x41bbd0,_0x12d06a){return client[_0xd1fb('0xc')](_0x3eb87f,_0x28e7a5)[_0xd1fb('0xd')](function(_0x5876ac){logger[_0xd1fb('0xe')](_0xd1fb('0xf'),_0x111442,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x111442,'request\x20sent',JSON[_0xd1fb('0x10')](_0x5876ac));if(_0x5876ac[_0xd1fb('0x11')]){if(_0x5876ac['error']['code']===0x1f4){logger[_0xd1fb('0x11')](_0xd1fb('0xf'),_0x111442,_0x5876ac[_0xd1fb('0x11')][_0xd1fb('0x12')]);return _0x12d06a(_0x5876ac[_0xd1fb('0x11')]['message']);}logger['error'](_0xd1fb('0xf'),_0x111442,_0x5876ac['error']['message']);return _0x41bbd0(_0x5876ac[_0xd1fb('0x11')]['message']);}else{logger[_0xd1fb('0xe')](_0xd1fb('0xf'),_0x111442,_0xd1fb('0x13'));_0x41bbd0(_0x5876ac[_0xd1fb('0x14')][_0xd1fb('0x12')]);}})[_0xd1fb('0x15')](function(_0x3d7585){logger[_0xd1fb('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x111442,_0x3d7585);_0x12d06a(_0x3d7585);});});}exports[_0xd1fb('0x16')]=function(_0x4db9db){var _0xf41afa=this;return new Promise(function(_0x2bf005,_0x41f29a){return db[_0xd1fb('0x17')][_0xd1fb('0x18')]({'raw':_0x4db9db[_0xd1fb('0x19')]?_0x4db9db[_0xd1fb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4db9db[_0xd1fb('0x19')]?_0x4db9db[_0xd1fb('0x19')][_0xd1fb('0x1a')]||null:null,'attributes':_0x4db9db['options']?_0x4db9db[_0xd1fb('0x19')][_0xd1fb('0x1b')]||null:null,'limit':_0x4db9db[_0xd1fb('0x19')]?_0x4db9db[_0xd1fb('0x19')][_0xd1fb('0x1c')]||null:null,'include':_0x4db9db[_0xd1fb('0x19')]?_0x4db9db['options'][_0xd1fb('0x1d')]?_[_0xd1fb('0x1e')](_0x4db9db[_0xd1fb('0x19')][_0xd1fb('0x1d')],function(_0x52d2eb){return{'model':db[_0x52d2eb['model']],'as':_0x52d2eb['as'],'attributes':_0x52d2eb[_0xd1fb('0x1b')],'include':_0x52d2eb[_0xd1fb('0x1d')]?_[_0xd1fb('0x1e')](_0x52d2eb[_0xd1fb('0x1d')],function(_0x48f4b0){return{'model':db[_0x48f4b0['model']],'as':_0x48f4b0['as'],'attributes':_0x48f4b0[_0xd1fb('0x1b')],'include':_0x48f4b0[_0xd1fb('0x1d')]?_[_0xd1fb('0x1e')](_0x48f4b0[_0xd1fb('0x1d')],function(_0x25686b){return{'model':db[_0x25686b['model']],'as':_0x25686b['as'],'attributes':_0x25686b[_0xd1fb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd1fb('0xd')](function(_0x3d9762){logger[_0xd1fb('0xe')](_0xd1fb('0x16'),_0x4db9db);logger[_0xd1fb('0x1f')](_0xd1fb('0x16'),_0x4db9db,JSON[_0xd1fb('0x10')](_0x3d9762));_0x2bf005(_0x3d9762);})[_0xd1fb('0x15')](function(_0x13f2ae){logger[_0xd1fb('0x11')](_0xd1fb('0x16'),_0x13f2ae[_0xd1fb('0x12')],_0x4db9db);_0x41f29a(_0xf41afa[_0xd1fb('0x11')](0x1f4,_0x13f2ae[_0xd1fb('0x12')]));});});};exports[_0xd1fb('0x20')]=function(_0x155d2f){var _0x3bf32f=this;return new Promise(function(_0x1b1dd0,_0x150ca1){return db['VoiceCallReport']['create'](_0x155d2f[_0xd1fb('0x21')],{'raw':_0x155d2f[_0xd1fb('0x19')]?_0x155d2f[_0xd1fb('0x19')][_0xd1fb('0x22')]===undefined?!![]:![]:!![]})[_0xd1fb('0xd')](function(_0x50ac08){logger['info'](_0xd1fb('0x20'),_0x155d2f);logger[_0xd1fb('0x1f')]('CreateVoiceCallReport',_0x155d2f,JSON['stringify'](_0x50ac08));_0x1b1dd0(_0x50ac08);})[_0xd1fb('0x15')](function(_0x12020e){logger[_0xd1fb('0x11')](_0xd1fb('0x20'),_0x12020e[_0xd1fb('0x12')],_0x155d2f);_0x150ca1(_0x3bf32f['error'](0x1f4,_0x12020e[_0xd1fb('0x12')]));});});};exports[_0xd1fb('0x23')]=function(_0x4862fa){var _0x536463=this;return new Promise(function(_0x376a2c,_0x39b017){return db[_0xd1fb('0x17')][_0xd1fb('0x24')](_0x4862fa[_0xd1fb('0x21')],{'raw':_0x4862fa[_0xd1fb('0x19')]?_0x4862fa['options'][_0xd1fb('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4862fa[_0xd1fb('0x19')]?_0x4862fa[_0xd1fb('0x19')][_0xd1fb('0x1a')]||null:null,'attributes':_0x4862fa[_0xd1fb('0x19')]?_0x4862fa[_0xd1fb('0x19')][_0xd1fb('0x1b')]||null:null,'limit':_0x4862fa['options']?_0x4862fa[_0xd1fb('0x19')][_0xd1fb('0x1c')]||null:null})[_0xd1fb('0xd')](function(_0x4e9d21){logger[_0xd1fb('0xe')](_0xd1fb('0x23'),_0x4862fa);logger['debug'](_0xd1fb('0x23'),_0x4862fa,JSON[_0xd1fb('0x10')](_0x4e9d21));_0x376a2c(_0x4e9d21);})['catch'](function(_0x5b03d8){logger[_0xd1fb('0x11')](_0xd1fb('0x23'),_0x5b03d8[_0xd1fb('0x12')],_0x4862fa);_0x39b017(_0x536463[_0xd1fb('0x11')](0x1f4,_0x5b03d8[_0xd1fb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 47b76a9..0096ed1 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 _0xb113=['../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','exports','path','connect-timeout','express','fs-extra'];(function(_0xee520b,_0x280270){var _0x1952fc=function(_0x187a35){while(--_0x187a35){_0xee520b['push'](_0xee520b['shift']());}};_0x1952fc(++_0x280270);}(_0xb113,0x10c));var _0x3b11=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0xb113[_0x1d9163];return _0xb42197;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3b11('0x0'));var timeout=require(_0x3b11('0x1'));var express=require(_0x3b11('0x2'));var router=express['Router']();var fs_extra=require(_0x3b11('0x3'));var auth=require(_0x3b11('0x4'));var interaction=require(_0x3b11('0x5'));var config=require('../../config/environment');var controller=require(_0x3b11('0x6'));router[_0x3b11('0x7')]('/',auth[_0x3b11('0x8')](),controller[_0x3b11('0x9')]);router[_0x3b11('0x7')]('/:id',auth[_0x3b11('0x8')](),controller['show']);router[_0x3b11('0xa')]('/',auth[_0x3b11('0x8')](),controller[_0x3b11('0xb')]);router[_0x3b11('0xc')](_0x3b11('0xd'),auth[_0x3b11('0x8')](),controller[_0x3b11('0xe')]);router[_0x3b11('0xf')](_0x3b11('0xd'),auth[_0x3b11('0x8')](),controller['destroy']);module[_0x3b11('0x10')]=router; \ No newline at end of file +var _0x6644=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','update','delete','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6644,0x12b));var _0x4664=function(_0x48f562,_0xf06a14){_0x48f562=_0x48f562-0x0;var _0x41506a=_0x6644[_0x48f562];return _0x41506a;};'use strict';var multer=require('multer');var util=require(_0x4664('0x0'));var path=require(_0x4664('0x1'));var timeout=require(_0x4664('0x2'));var express=require('express');var router=express[_0x4664('0x3')]();var fs_extra=require(_0x4664('0x4'));var auth=require(_0x4664('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4664('0x6'));var controller=require(_0x4664('0x7'));router['get']('/',auth[_0x4664('0x8')](),controller[_0x4664('0x9')]);router[_0x4664('0xa')](_0x4664('0xb'),auth['isAuthenticated'](),controller[_0x4664('0xc')]);router['post']('/',auth[_0x4664('0x8')](),controller['create']);router['put'](_0x4664('0xb'),auth[_0x4664('0x8')](),controller[_0x4664('0xd')]);router[_0x4664('0xe')](_0x4664('0xb'),auth[_0x4664('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index d9d0177..9735294 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 _0x5442=['STRING','name','options','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x4e3ed4,_0x3934f9){var _0x52b63a=function(_0x314e8c){while(--_0x314e8c){_0x4e3ed4['push'](_0x4e3ed4['shift']());}};_0x52b63a(++_0x3934f9);}(_0x5442,0x16e));var _0x2544=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x5442[_0x31991b];return _0x307304;};'use strict';var Sequelize=require(_0x2544('0x0'));module[_0x2544('0x1')]={'name':{'type':Sequelize[_0x2544('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x2544('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2544('0x2')],'set':function(_0x54bdf5){this['setDataValue'](_0x2544('0x4'),_0x54bdf5?_0x54bdf5[_0x2544('0x5')](''):[]);},'get':function(){return this[_0x2544('0x6')](_0x2544('0x4'))?this['getDataValue'](_0x2544('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x2544('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x2544('0x2')]},'record':{'type':Sequelize[_0x2544('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2544('0x2')]},'description':{'type':Sequelize[_0x2544('0x2')]}}; \ No newline at end of file +var _0x1302=['exports','STRING','name','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x5581d1,_0x4a4aa6){var _0x5bfcdc=function(_0x359aad){while(--_0x359aad){_0x5581d1['push'](_0x5581d1['shift']());}};_0x5bfcdc(++_0x4a4aa6);}(_0x1302,0x1e7));var _0x2130=function(_0x10e474,_0x463ad5){_0x10e474=_0x10e474-0x0;var _0x4f281c=_0x1302[_0x10e474];return _0x4f281c;};'use strict';var Sequelize=require(_0x2130('0x0'));module[_0x2130('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x2130('0x2')],'unique':_0x2130('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2130('0x2')],'set':function(_0x3b37c6){this['setDataValue'](_0x2130('0x4'),_0x3b37c6?_0x3b37c6[_0x2130('0x5')](''):[]);},'get':function(){return this[_0x2130('0x6')](_0x2130('0x4'))?this['getDataValue'](_0x2130('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2130('0x2')]},'record':{'type':Sequelize[_0x2130('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2130('0x2')]},'description':{'type':Sequelize[_0x2130('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5247dbf..63b1a73 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 _0xa2ab=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','VoiceChanSpy','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2ab,0xa7));var _0xba2a=function(_0xa388eb,_0x3660c2){_0xa388eb=_0xa388eb-0x0;var _0x481ab0=_0xa2ab[_0xa388eb];return _0x481ab0;};'use strict';var emlformat=require(_0xba2a('0x0'));var rimraf=require(_0xba2a('0x1'));var zipdir=require(_0xba2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba2a('0x3'));var moment=require(_0xba2a('0x4'));var BPromise=require(_0xba2a('0x5'));var Mustache=require(_0xba2a('0x6'));var util=require(_0xba2a('0x7'));var path=require(_0xba2a('0x8'));var sox=require(_0xba2a('0x9'));var csv=require('to-csv');var ejs=require(_0xba2a('0xa'));var fs=require('fs');var fs_extra=require(_0xba2a('0xb'));var _=require(_0xba2a('0xc'));var squel=require('squel');var crypto=require(_0xba2a('0xd'));var jsforce=require(_0xba2a('0xe'));var deskjs=require(_0xba2a('0xf'));var toCsv=require(_0xba2a('0x10'));var querystring=require('querystring');var Papa=require(_0xba2a('0x11'));var Redis=require(_0xba2a('0x12'));var authService=require(_0xba2a('0x13'));var qs=require(_0xba2a('0x14'));var as=require(_0xba2a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba2a('0x16'))(_0xba2a('0x17'));var utils=require(_0xba2a('0x18'));var config=require(_0xba2a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xba2a('0x1a'))['db'];function respondWithStatusCode(_0x10bf76,_0x94b897){_0x94b897=_0x94b897||0xcc;return function(_0x2c850e){if(_0x2c850e){return _0x10bf76[_0xba2a('0x1b')](_0x94b897);}return _0x10bf76['status'](_0x94b897)[_0xba2a('0x1c')]();};}function respondWithResult(_0x44759c,_0xe2bbdb){_0xe2bbdb=_0xe2bbdb||0xc8;return function(_0x127c42){if(_0x127c42){return _0x44759c['status'](_0xe2bbdb)[_0xba2a('0x1d')](_0x127c42);}};}function respondWithFilteredResult(_0x1b3272,_0x261f90){return function(_0x4147a6){if(_0x4147a6){var _0x4b9f63=typeof _0x261f90[_0xba2a('0x1e')]===_0xba2a('0x1f')&&typeof _0x261f90['limit']===_0xba2a('0x1f');var _0x49c57e=_0x4147a6['count'];var _0x559c6e=_0x4b9f63?0x0:_0x261f90[_0xba2a('0x1e')];var _0xa56be8=_0x4b9f63?_0x4147a6[_0xba2a('0x20')]:_0x261f90[_0xba2a('0x1e')]+_0x261f90['limit'];var _0x437e4c;if(_0xa56be8>=_0x49c57e){_0xa56be8=_0x49c57e;_0x437e4c=0xc8;}else{_0x437e4c=0xce;}_0x1b3272[_0xba2a('0x21')](_0x437e4c);return _0x1b3272['set'](_0xba2a('0x22'),_0x559c6e+'-'+_0xa56be8+'/'+_0x49c57e)['json'](_0x4147a6);}return null;};}function patchUpdates(_0x3b3924){return function(_0x2ad68){try{jsonpatch[_0xba2a('0x23')](_0x2ad68,_0x3b3924,!![]);}catch(_0x1d4ba9){return BPromise[_0xba2a('0x24')](_0x1d4ba9);}return _0x2ad68[_0xba2a('0x25')]();};}function saveUpdates(_0x55565d,_0x2e0712){return function(_0x2cc3db){if(_0x2cc3db){return _0x2cc3db[_0xba2a('0x26')](_0x55565d)[_0xba2a('0x27')](function(_0x3bc8e1){return _0x3bc8e1;});}return null;};}function removeEntity(_0x56fa5e,_0xdfbf5c){return function(_0x4458cb){if(_0x4458cb){return _0x4458cb[_0xba2a('0x28')]()[_0xba2a('0x27')](function(){var _0x46af1f=_0x4458cb[_0xba2a('0x29')]({'plain':!![]});var _0x24ee7d=_0xba2a('0x2a');return db['UserProfileResource'][_0xba2a('0x28')]({'where':{'type':_0x24ee7d,'resourceId':_0x46af1f['id']}})[_0xba2a('0x27')](function(){return _0x4458cb;});})[_0xba2a('0x27')](function(){_0x56fa5e[_0xba2a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e627b,_0x2c6b37){return function(_0x2af93a){if(!_0x2af93a){_0x2e627b['sendStatus'](0x194);}return _0x2af93a;};}function handleError(_0x4fca78,_0x1adcf3){_0x1adcf3=_0x1adcf3||0x1f4;return function(_0x2f292b){logger[_0xba2a('0x2b')](_0x2f292b[_0xba2a('0x2c')]);if(_0x2f292b[_0xba2a('0x2d')]){delete _0x2f292b[_0xba2a('0x2d')];}_0x4fca78[_0xba2a('0x21')](_0x1adcf3)[_0xba2a('0x2e')](_0x2f292b);};}exports[_0xba2a('0x2f')]=function(_0x7ab93c,_0x53f32d){var _0x1bf866={},_0x77ac7c={},_0x88509d={'count':0x0,'rows':[]};var _0x46d9a6=_['map'](db[_0xba2a('0x30')][_0xba2a('0x31')],function(_0x3ec14f){return{'name':_0x3ec14f['fieldName'],'type':_0x3ec14f[_0xba2a('0x32')][_0xba2a('0x33')]};});_0x77ac7c[_0xba2a('0x34')]=_[_0xba2a('0x35')](_0x46d9a6,_0xba2a('0x2d'));_0x77ac7c[_0xba2a('0x36')]=_[_0xba2a('0x37')](_0x7ab93c[_0xba2a('0x36')]);_0x77ac7c['filters']=_[_0xba2a('0x38')](_0x77ac7c[_0xba2a('0x34')],_0x77ac7c[_0xba2a('0x36')]);_0x1bf866[_0xba2a('0x39')]=_[_0xba2a('0x38')](_0x77ac7c['model'],qs[_0xba2a('0x3a')](_0x7ab93c[_0xba2a('0x36')][_0xba2a('0x3a')]));_0x1bf866[_0xba2a('0x39')]=_0x1bf866['attributes'][_0xba2a('0x3b')]?_0x1bf866[_0xba2a('0x39')]:_0x77ac7c[_0xba2a('0x34')];if(!_0x7ab93c['query'][_0xba2a('0x3c')](_0xba2a('0x3d'))){_0x1bf866[_0xba2a('0x3e')]=qs['limit'](_0x7ab93c[_0xba2a('0x36')][_0xba2a('0x3e')]);_0x1bf866[_0xba2a('0x1e')]=qs[_0xba2a('0x1e')](_0x7ab93c[_0xba2a('0x36')][_0xba2a('0x1e')]);}_0x1bf866[_0xba2a('0x3f')]=qs['sort'](_0x7ab93c[_0xba2a('0x36')]['sort']);_0x1bf866[_0xba2a('0x40')]=qs[_0xba2a('0x41')](_['pick'](_0x7ab93c['query'],_0x77ac7c['filters']),_0x46d9a6);if(_0x7ab93c['query'][_0xba2a('0x42')]){_0x1bf866['where']=_[_0xba2a('0x43')](_0x1bf866[_0xba2a('0x40')],{'$or':_['map'](_0x46d9a6,function(_0x3f0fb7){if(_0x3f0fb7[_0xba2a('0x32')]!==_0xba2a('0x44')){var _0x53fcc1={};_0x53fcc1[_0x3f0fb7[_0xba2a('0x2d')]]={'$like':'%'+_0x7ab93c['query'][_0xba2a('0x42')]+'%'};return _0x53fcc1;}})});}_0x1bf866=_[_0xba2a('0x43')]({},_0x1bf866,_0x7ab93c[_0xba2a('0x45')]);var _0x5092c1={'where':_0x1bf866[_0xba2a('0x40')]};return db[_0xba2a('0x30')][_0xba2a('0x20')](_0x5092c1)['then'](function(_0xc184a6){_0x88509d[_0xba2a('0x20')]=_0xc184a6;if(_0x7ab93c['query'][_0xba2a('0x46')]){_0x1bf866[_0xba2a('0x47')]=[{'all':!![]}];}return db[_0xba2a('0x30')][_0xba2a('0x48')](_0x1bf866);})[_0xba2a('0x27')](function(_0x3905d7){_0x88509d[_0xba2a('0x49')]=_0x3905d7;return _0x88509d;})[_0xba2a('0x27')](respondWithFilteredResult(_0x53f32d,_0x1bf866))[_0xba2a('0x4a')](handleError(_0x53f32d,null));};exports['show']=function(_0x329b46,_0x2f1f82){var _0x4d8e32={'raw':![],'where':{'id':_0x329b46[_0xba2a('0x4b')]['id']}},_0x23b790={};_0x23b790[_0xba2a('0x34')]=_[_0xba2a('0x37')](db['VoiceChanSpy']['rawAttributes']);_0x23b790['query']=_['keys'](_0x329b46[_0xba2a('0x36')]);_0x23b790[_0xba2a('0x41')]=_['intersection'](_0x23b790['model'],_0x23b790['query']);_0x4d8e32[_0xba2a('0x39')]=_[_0xba2a('0x38')](_0x23b790['model'],qs['fields'](_0x329b46[_0xba2a('0x36')][_0xba2a('0x3a')]));_0x4d8e32['attributes']=_0x4d8e32[_0xba2a('0x39')][_0xba2a('0x3b')]?_0x4d8e32[_0xba2a('0x39')]:_0x23b790['model'];if(_0x329b46[_0xba2a('0x36')]['includeAll']){_0x4d8e32[_0xba2a('0x47')]=[{'all':!![]}];}_0x4d8e32=_['merge']({},_0x4d8e32,_0x329b46[_0xba2a('0x45')]);return db[_0xba2a('0x30')][_0xba2a('0x4c')](_0x4d8e32)[_0xba2a('0x27')](handleEntityNotFound(_0x2f1f82,null))[_0xba2a('0x27')](respondWithResult(_0x2f1f82,null))[_0xba2a('0x4a')](handleError(_0x2f1f82,null));};exports['create']=function(_0x46d4f8,_0x5e7dbc){return db[_0xba2a('0x30')]['create'](_0x46d4f8[_0xba2a('0x4d')],{})[_0xba2a('0x27')](function(_0x325b4d){var _0x5743d3=_0x46d4f8[_0xba2a('0x4e')]['get']({'plain':!![]});if(!_0x5743d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5743d3[_0xba2a('0x4f')]==='user'){var _0x4f16c2=_0x325b4d[_0xba2a('0x29')]({'plain':!![]});var _0x4260a3='ChanSpies';return db[_0xba2a('0x50')][_0xba2a('0x4c')]({'where':{'name':_0x4260a3,'userProfileId':_0x5743d3[_0xba2a('0x51')]},'raw':!![]})['then'](function(_0x54ce2f){if(_0x54ce2f&&_0x54ce2f[_0xba2a('0x52')]===0x0){return db[_0xba2a('0x53')][_0xba2a('0x54')]({'name':_0x4f16c2[_0xba2a('0x2d')],'resourceId':_0x4f16c2['id'],'type':_0x54ce2f[_0xba2a('0x2d')],'sectionId':_0x54ce2f['id']},{})[_0xba2a('0x27')](function(){return _0x325b4d;});}else{return _0x325b4d;}})[_0xba2a('0x4a')](function(_0x8c9dca){logger[_0xba2a('0x2b')](_0xba2a('0x55'),_0x8c9dca);throw _0x8c9dca;});}return _0x325b4d;})['then'](respondWithResult(_0x5e7dbc,0xc9))[_0xba2a('0x4a')](handleError(_0x5e7dbc,null));};exports['update']=function(_0x3101fd,_0x2f6f70){if(_0x3101fd['body']['id']){delete _0x3101fd[_0xba2a('0x4d')]['id'];}return db[_0xba2a('0x30')][_0xba2a('0x4c')]({'where':{'id':_0x3101fd[_0xba2a('0x4b')]['id']}})[_0xba2a('0x27')](handleEntityNotFound(_0x2f6f70,null))[_0xba2a('0x27')](saveUpdates(_0x3101fd['body'],null))[_0xba2a('0x27')](respondWithResult(_0x2f6f70,null))['catch'](handleError(_0x2f6f70,null));};exports[_0xba2a('0x28')]=function(_0x356b6e,_0x1db317){return db['VoiceChanSpy'][_0xba2a('0x4c')]({'where':{'id':_0x356b6e[_0xba2a('0x4b')]['id']}})[_0xba2a('0x27')](handleEntityNotFound(_0x1db317,null))['then'](removeEntity(_0x1db317,null))['catch'](handleError(_0x1db317,null));}; \ No newline at end of file +var _0x851e=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','get','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x851e,0x1e8));var _0xe851=function(_0xb9fe33,_0x47a545){_0xb9fe33=_0xb9fe33-0x0;var _0x15f7c2=_0x851e[_0xb9fe33];return _0x15f7c2;};'use strict';var emlformat=require(_0xe851('0x0'));var rimraf=require(_0xe851('0x1'));var zipdir=require(_0xe851('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe851('0x3'));var BPromise=require(_0xe851('0x4'));var Mustache=require(_0xe851('0x5'));var util=require(_0xe851('0x6'));var path=require(_0xe851('0x7'));var sox=require('sox');var csv=require(_0xe851('0x8'));var ejs=require(_0xe851('0x9'));var fs=require('fs');var fs_extra=require(_0xe851('0xa'));var _=require(_0xe851('0xb'));var squel=require(_0xe851('0xc'));var crypto=require('crypto');var jsforce=require(_0xe851('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe851('0xe'));var Papa=require(_0xe851('0xf'));var Redis=require(_0xe851('0x10'));var authService=require(_0xe851('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe851('0x12'));var hardwareService=require(_0xe851('0x13'));var logger=require(_0xe851('0x14'))('api');var utils=require(_0xe851('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe851('0x16'));var db=require(_0xe851('0x17'))['db'];function respondWithStatusCode(_0x5bb014,_0x2b76af){_0x2b76af=_0x2b76af||0xcc;return function(_0x4fff7e){if(_0x4fff7e){return _0x5bb014[_0xe851('0x18')](_0x2b76af);}return _0x5bb014['status'](_0x2b76af)[_0xe851('0x19')]();};}function respondWithResult(_0x32b54e,_0x5960f2){_0x5960f2=_0x5960f2||0xc8;return function(_0x391632){if(_0x391632){return _0x32b54e[_0xe851('0x1a')](_0x5960f2)[_0xe851('0x1b')](_0x391632);}};}function respondWithFilteredResult(_0x4e5195,_0x4d902d){return function(_0x11ba80){if(_0x11ba80){var _0x2f073c=typeof _0x4d902d[_0xe851('0x1c')]===_0xe851('0x1d')&&typeof _0x4d902d[_0xe851('0x1e')]===_0xe851('0x1d');var _0x53c7e0=_0x11ba80[_0xe851('0x1f')];var _0x48a1b3=_0x2f073c?0x0:_0x4d902d[_0xe851('0x1c')];var _0x55dd83=_0x2f073c?_0x11ba80[_0xe851('0x1f')]:_0x4d902d['offset']+_0x4d902d[_0xe851('0x1e')];var _0x2d8015;if(_0x55dd83>=_0x53c7e0){_0x55dd83=_0x53c7e0;_0x2d8015=0xc8;}else{_0x2d8015=0xce;}_0x4e5195[_0xe851('0x1a')](_0x2d8015);return _0x4e5195[_0xe851('0x20')](_0xe851('0x21'),_0x48a1b3+'-'+_0x55dd83+'/'+_0x53c7e0)[_0xe851('0x1b')](_0x11ba80);}return null;};}function patchUpdates(_0x37ab53){return function(_0x409796){try{jsonpatch['apply'](_0x409796,_0x37ab53,!![]);}catch(_0x238a5c){return BPromise['reject'](_0x238a5c);}return _0x409796[_0xe851('0x22')]();};}function saveUpdates(_0x545b9d,_0x3eb7f9){return function(_0x453392){if(_0x453392){return _0x453392['update'](_0x545b9d)['then'](function(_0x1d5aa2){return _0x1d5aa2;});}return null;};}function removeEntity(_0x44ccb3,_0x3bb018){return function(_0x181b19){if(_0x181b19){return _0x181b19[_0xe851('0x23')]()[_0xe851('0x24')](function(){var _0x4ce93a=_0x181b19[_0xe851('0x25')]({'plain':!![]});var _0x2d508='ChanSpies';return db['UserProfileResource'][_0xe851('0x23')]({'where':{'type':_0x2d508,'resourceId':_0x4ce93a['id']}})['then'](function(){return _0x181b19;});})[_0xe851('0x24')](function(){_0x44ccb3[_0xe851('0x1a')](0xcc)[_0xe851('0x19')]();});}};}function handleEntityNotFound(_0x2ff847,_0x1ad48e){return function(_0x1d4c78){if(!_0x1d4c78){_0x2ff847[_0xe851('0x18')](0x194);}return _0x1d4c78;};}function handleError(_0x4c67ee,_0x45771c){_0x45771c=_0x45771c||0x1f4;return function(_0x25f50a){logger['error'](_0x25f50a['stack']);if(_0x25f50a['name']){delete _0x25f50a[_0xe851('0x26')];}_0x4c67ee[_0xe851('0x1a')](_0x45771c)[_0xe851('0x27')](_0x25f50a);};}exports[_0xe851('0x28')]=function(_0x4ef1e2,_0x4d9d17){var _0x29f8d5={},_0x3d4ee3={},_0x160b7f={'count':0x0,'rows':[]};var _0x7d1569=_[_0xe851('0x29')](db[_0xe851('0x2a')][_0xe851('0x2b')],function(_0x592aa1){return{'name':_0x592aa1['fieldName'],'type':_0x592aa1[_0xe851('0x2c')][_0xe851('0x2d')]};});_0x3d4ee3[_0xe851('0x2e')]=_[_0xe851('0x29')](_0x7d1569,_0xe851('0x26'));_0x3d4ee3[_0xe851('0x2f')]=_[_0xe851('0x30')](_0x4ef1e2[_0xe851('0x2f')]);_0x3d4ee3[_0xe851('0x31')]=_[_0xe851('0x32')](_0x3d4ee3['model'],_0x3d4ee3[_0xe851('0x2f')]);_0x29f8d5[_0xe851('0x33')]=_[_0xe851('0x32')](_0x3d4ee3['model'],qs[_0xe851('0x34')](_0x4ef1e2[_0xe851('0x2f')]['fields']));_0x29f8d5[_0xe851('0x33')]=_0x29f8d5[_0xe851('0x33')][_0xe851('0x35')]?_0x29f8d5['attributes']:_0x3d4ee3[_0xe851('0x2e')];if(!_0x4ef1e2[_0xe851('0x2f')][_0xe851('0x36')](_0xe851('0x37'))){_0x29f8d5['limit']=qs[_0xe851('0x1e')](_0x4ef1e2[_0xe851('0x2f')][_0xe851('0x1e')]);_0x29f8d5['offset']=qs[_0xe851('0x1c')](_0x4ef1e2['query'][_0xe851('0x1c')]);}_0x29f8d5[_0xe851('0x38')]=qs[_0xe851('0x39')](_0x4ef1e2[_0xe851('0x2f')][_0xe851('0x39')]);_0x29f8d5[_0xe851('0x3a')]=qs[_0xe851('0x31')](_[_0xe851('0x3b')](_0x4ef1e2[_0xe851('0x2f')],_0x3d4ee3[_0xe851('0x31')]),_0x7d1569);if(_0x4ef1e2['query'][_0xe851('0x3c')]){_0x29f8d5['where']=_[_0xe851('0x3d')](_0x29f8d5[_0xe851('0x3a')],{'$or':_[_0xe851('0x29')](_0x7d1569,function(_0x189a1b){if(_0x189a1b['type']!==_0xe851('0x3e')){var _0x45d9f7={};_0x45d9f7[_0x189a1b[_0xe851('0x26')]]={'$like':'%'+_0x4ef1e2[_0xe851('0x2f')][_0xe851('0x3c')]+'%'};return _0x45d9f7;}})});}_0x29f8d5=_[_0xe851('0x3d')]({},_0x29f8d5,_0x4ef1e2[_0xe851('0x3f')]);var _0x577eec={'where':_0x29f8d5[_0xe851('0x3a')]};return db[_0xe851('0x2a')][_0xe851('0x1f')](_0x577eec)[_0xe851('0x24')](function(_0x4890b9){_0x160b7f['count']=_0x4890b9;if(_0x4ef1e2[_0xe851('0x2f')][_0xe851('0x40')]){_0x29f8d5[_0xe851('0x41')]=[{'all':!![]}];}return db[_0xe851('0x2a')][_0xe851('0x42')](_0x29f8d5);})[_0xe851('0x24')](function(_0x355f76){_0x160b7f[_0xe851('0x43')]=_0x355f76;return _0x160b7f;})['then'](respondWithFilteredResult(_0x4d9d17,_0x29f8d5))['catch'](handleError(_0x4d9d17,null));};exports[_0xe851('0x44')]=function(_0x2d0768,_0x3df1e9){var _0x1fdda8={'raw':![],'where':{'id':_0x2d0768[_0xe851('0x45')]['id']}},_0x487346={};_0x487346[_0xe851('0x2e')]=_[_0xe851('0x30')](db['VoiceChanSpy'][_0xe851('0x2b')]);_0x487346[_0xe851('0x2f')]=_[_0xe851('0x30')](_0x2d0768[_0xe851('0x2f')]);_0x487346[_0xe851('0x31')]=_[_0xe851('0x32')](_0x487346[_0xe851('0x2e')],_0x487346['query']);_0x1fdda8['attributes']=_['intersection'](_0x487346['model'],qs[_0xe851('0x34')](_0x2d0768[_0xe851('0x2f')][_0xe851('0x34')]));_0x1fdda8[_0xe851('0x33')]=_0x1fdda8[_0xe851('0x33')][_0xe851('0x35')]?_0x1fdda8[_0xe851('0x33')]:_0x487346['model'];if(_0x2d0768[_0xe851('0x2f')][_0xe851('0x40')]){_0x1fdda8[_0xe851('0x41')]=[{'all':!![]}];}_0x1fdda8=_['merge']({},_0x1fdda8,_0x2d0768[_0xe851('0x3f')]);return db[_0xe851('0x2a')][_0xe851('0x46')](_0x1fdda8)[_0xe851('0x24')](handleEntityNotFound(_0x3df1e9,null))[_0xe851('0x24')](respondWithResult(_0x3df1e9,null))[_0xe851('0x47')](handleError(_0x3df1e9,null));};exports[_0xe851('0x48')]=function(_0x4662da,_0x1fb5ed){return db[_0xe851('0x2a')][_0xe851('0x48')](_0x4662da[_0xe851('0x49')],{})['then'](function(_0x328646){var _0x54782d=_0x4662da[_0xe851('0x4a')][_0xe851('0x25')]({'plain':!![]});if(!_0x54782d)throw new Error(_0xe851('0x4b'));if(_0x54782d[_0xe851('0x4c')]===_0xe851('0x4a')){var _0x5458f6=_0x328646[_0xe851('0x25')]({'plain':!![]});var _0x3c7f7c='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0x3c7f7c,'userProfileId':_0x54782d[_0xe851('0x4d')]},'raw':!![]})[_0xe851('0x24')](function(_0x42e954){if(_0x42e954&&_0x42e954[_0xe851('0x4e')]===0x0){return db[_0xe851('0x4f')][_0xe851('0x48')]({'name':_0x5458f6[_0xe851('0x26')],'resourceId':_0x5458f6['id'],'type':_0x42e954[_0xe851('0x26')],'sectionId':_0x42e954['id']},{})[_0xe851('0x24')](function(){return _0x328646;});}else{return _0x328646;}})[_0xe851('0x47')](function(_0xc32db4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc32db4);throw _0xc32db4;});}return _0x328646;})[_0xe851('0x24')](respondWithResult(_0x1fb5ed,0xc9))[_0xe851('0x47')](handleError(_0x1fb5ed,null));};exports['update']=function(_0x341ae9,_0x52eccd){if(_0x341ae9[_0xe851('0x49')]['id']){delete _0x341ae9[_0xe851('0x49')]['id'];}return db[_0xe851('0x2a')][_0xe851('0x46')]({'where':{'id':_0x341ae9[_0xe851('0x45')]['id']}})[_0xe851('0x24')](handleEntityNotFound(_0x52eccd,null))[_0xe851('0x24')](saveUpdates(_0x341ae9[_0xe851('0x49')],null))[_0xe851('0x24')](respondWithResult(_0x52eccd,null))[_0xe851('0x47')](handleError(_0x52eccd,null));};exports[_0xe851('0x23')]=function(_0x1ff342,_0x482b6d){return db[_0xe851('0x2a')][_0xe851('0x46')]({'where':{'id':_0x1ff342['params']['id']}})[_0xe851('0x24')](handleEntityNotFound(_0x482b6d,null))[_0xe851('0x24')](removeEntity(_0x482b6d,null))[_0xe851('0x47')](handleError(_0x482b6d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5171776..b0247aa 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 _0x1c53=['exports','models','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','User','findAll','catch'];(function(_0x6b888e,_0x420fed){var _0x17d0f6=function(_0x42675a){while(--_0x42675a){_0x6b888e['push'](_0x6b888e['shift']());}};_0x17d0f6(++_0x420fed);}(_0x1c53,0x131));var _0x31c5=function(_0x585fbe,_0x369c77){_0x585fbe=_0x585fbe-0x0;var _0x5c3f3b=_0x1c53[_0x585fbe];return _0x5c3f3b;};'use strict';var _=require(_0x31c5('0x0'));var util=require('util');var BPromise=require(_0x31c5('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5a92e8,_0x2f27ba,_0x4d5888){var _0x3032a4=0x1;var _0x2d83c6=[];var _0x10003a={'context':_0x2f27ba[_0x31c5('0x2')]||_0x31c5('0x3'),'exten':util[_0x31c5('0x4')](_0x31c5('0x5'),_0x5a92e8[_0x31c5('0x6')],_0x4d5888),'type':_0x31c5('0x7'),'isApp':![],'ChanSpyId':_0x5a92e8['id'],'UserId':_0x2f27ba['id']};_0x2d83c6[_0x31c5('0x8')](_[_0x31c5('0x9')]({'app':_0x31c5('0xa'),'appdata':util[_0x31c5('0x4')](_0x31c5('0xb'),'chanspy'),'priority':_0x3032a4++},_0x10003a));if(_0x5a92e8[_0x31c5('0xc')]){_0x2d83c6[_0x31c5('0x8')](_[_0x31c5('0x9')]({'app':_0x31c5('0xd'),'appdata':util[_0x31c5('0x4')](_0x31c5('0xe'),_0x5a92e8[_0x31c5('0xf')]),'priority':_0x3032a4++},_0x10003a));}if(_0x5a92e8[_0x31c5('0x10')]){_0x2d83c6[_0x31c5('0x8')](_['merge']({'app':_0x31c5('0x11'),'appdata':_0x5a92e8['password'],'priority':_0x3032a4++},_0x10003a));}_0x2d83c6[_0x31c5('0x8')](_['merge']({'app':_0x31c5('0x12'),'appdata':util['format'](_0x31c5('0x13'),_0x2f27ba[_0x31c5('0x14')],_0x5a92e8[_0x31c5('0x15')]?_0x5a92e8['options']['join'](''):''),'priority':_0x3032a4++},_0x10003a));if(_0x5a92e8[_0x31c5('0xc')]){_0x2d83c6[_0x31c5('0x8')](_[_0x31c5('0x9')]({'app':_0x31c5('0x16'),'priority':_0x3032a4++},_0x10003a));}return _0x2d83c6;};var getChanSpyApplications=function(_0x1cf52b,_0xbce3b2){var _0x488f9c=[];for(var _0x128ccf=0x0,_0x53e8fa=0x1;_0x128ccf<_0xbce3b2['length'];_0x128ccf++,_0x53e8fa=0x1){_0x488f9c=_0x488f9c[_0x31c5('0x17')](getUserApplications(_0x1cf52b,_0xbce3b2[_0x128ccf],_0xbce3b2[_0x128ccf][_0x31c5('0x18')]));if(_0xbce3b2[_0x128ccf][_0x31c5('0x18')]!=_0xbce3b2[_0x128ccf][_0x31c5('0x14')]){_0x488f9c=_0x488f9c[_0x31c5('0x17')](getUserApplications(_0x1cf52b,_0xbce3b2[_0x128ccf],_0xbce3b2[_0x128ccf][_0x31c5('0x14')]));}}return _0x488f9c;};var getChanSpyPromise=function(_0x3abe71,_0x12fb6f){return new BPromise(function(_0x317805,_0x1ed73b){return _0x3abe71[_0x31c5('0x19')][_0x31c5('0x1a')]({'attributes':['id','name',_0x31c5('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x1f5b1c){if(_0x1f5b1c){return _0x317805(getChanSpyApplications(_0x12fb6f,_0x1f5b1c));}return _0x317805([]);})[_0x31c5('0x1b')](function(_0xaa61c0){_0x1ed73b(_0xaa61c0);});});};module[_0x31c5('0x1c')]=function(_0x38fc37,_0x9cc77b){var _0x10be3b=_0x38fc37[_0x31c5('0x1d')];return _0x38fc37['define'](_0x31c5('0x1e'),attributes,{'tableName':_0x31c5('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x125d8d,_0x200fbf,_0x4b3c79){return getChanSpyPromise(_0x10be3b,_0x125d8d)[_0x31c5('0x20')](function(_0x1994a5){if(_0x1994a5&&_0x1994a5[_0x31c5('0x21')]){return _0x10be3b[_0x31c5('0x22')][_0x31c5('0x23')](_0x1994a5);}})[_0x31c5('0x20')](function(){_0x4b3c79();})[_0x31c5('0x1b')](function(_0x68e8dd){_0x4b3c79(_0x68e8dd);});},'afterUpdate':function(_0x4b0510,_0x1b46c2,_0x36a51a){return _0x10be3b[_0x31c5('0x22')]['destroy']({'where':{'ChanSpyId':_0x4b0510['id']}})['then'](function(){return getChanSpyPromise(_0x10be3b,_0x4b0510);})['then'](function(_0x193ec2){if(_0x193ec2&&_0x193ec2['length']){return _0x10be3b['VoiceExtension'][_0x31c5('0x23')](_0x193ec2);}})[_0x31c5('0x20')](function(){_0x36a51a();})[_0x31c5('0x1b')](function(_0x499b07){_0x36a51a(_0x499b07);});},'afterDestroy':function(_0x35dc1e,_0x22ff21,_0xe3e893){return _0x10be3b[_0x31c5('0x22')][_0x31c5('0x24')]({'where':{'ChanSpyId':_0x35dc1e['id']}})['then'](function(){_0xe3e893();})[_0x31c5('0x1b')](function(_0x4be1bc){_0xe3e893(_0x4be1bc);});}}});}; \ No newline at end of file +var _0x968b=['auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','agent','catch','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x4e846a,_0x4fbabd){var _0xdeb4aa=function(_0x29303c){while(--_0x29303c){_0x4e846a['push'](_0x4e846a['shift']());}};_0xdeb4aa(++_0x4fbabd);}(_0x968b,0x109));var _0xb968=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0x968b[_0x2ffc46];return _0x1eda8f;};'use strict';var _=require(_0xb968('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xb968('0x1'));var getUserApplications=function(_0x2d377c,_0x442758,_0x17cc55){var _0x47d92f=0x1;var _0x542e40=[];var _0x4153aa={'context':_0x442758[_0xb968('0x2')]||_0xb968('0x3'),'exten':util[_0xb968('0x4')]('%s%s',_0x2d377c[_0xb968('0x5')],_0x17cc55),'type':_0xb968('0x6'),'isApp':![],'ChanSpyId':_0x2d377c['id'],'UserId':_0x442758['id']};_0x542e40[_0xb968('0x7')](_[_0xb968('0x8')]({'app':_0xb968('0x9'),'appdata':util[_0xb968('0x4')](_0xb968('0xa'),_0xb968('0xb')),'priority':_0x47d92f++},_0x4153aa));if(_0x2d377c[_0xb968('0xc')]){_0x542e40[_0xb968('0x7')](_[_0xb968('0x8')]({'app':'MixMonitor','appdata':util[_0xb968('0x4')](_0xb968('0xd'),_0x2d377c[_0xb968('0xe')]),'priority':_0x47d92f++},_0x4153aa));}if(_0x2d377c[_0xb968('0xf')]){_0x542e40[_0xb968('0x7')](_[_0xb968('0x8')]({'app':_0xb968('0x10'),'appdata':_0x2d377c['password'],'priority':_0x47d92f++},_0x4153aa));}_0x542e40[_0xb968('0x7')](_[_0xb968('0x8')]({'app':_0xb968('0x11'),'appdata':util[_0xb968('0x4')](_0xb968('0x12'),_0x442758[_0xb968('0x13')],_0x2d377c[_0xb968('0x14')]?_0x2d377c[_0xb968('0x14')][_0xb968('0x15')](''):''),'priority':_0x47d92f++},_0x4153aa));if(_0x2d377c[_0xb968('0xc')]){_0x542e40['push'](_[_0xb968('0x8')]({'app':_0xb968('0x16'),'priority':_0x47d92f++},_0x4153aa));}return _0x542e40;};var getChanSpyApplications=function(_0x33afaa,_0x57223d){var _0x91b917=[];for(var _0x2c2dc3=0x0,_0x3a6620=0x1;_0x2c2dc3<_0x57223d[_0xb968('0x17')];_0x2c2dc3++,_0x3a6620=0x1){_0x91b917=_0x91b917[_0xb968('0x18')](getUserApplications(_0x33afaa,_0x57223d[_0x2c2dc3],_0x57223d[_0x2c2dc3]['internal']));if(_0x57223d[_0x2c2dc3][_0xb968('0x19')]!=_0x57223d[_0x2c2dc3][_0xb968('0x13')]){_0x91b917=_0x91b917[_0xb968('0x18')](getUserApplications(_0x33afaa,_0x57223d[_0x2c2dc3],_0x57223d[_0x2c2dc3][_0xb968('0x13')]));}}return _0x91b917;};var getChanSpyPromise=function(_0x45621f,_0x38d366){return new BPromise(function(_0x2074ef,_0x4a8d1a){return _0x45621f[_0xb968('0x1a')]['findAll']({'attributes':['id',_0xb968('0x13'),_0xb968('0x19')],'where':{'role':_0xb968('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x31273f){if(_0x31273f){return _0x2074ef(getChanSpyApplications(_0x38d366,_0x31273f));}return _0x2074ef([]);})[_0xb968('0x1c')](function(_0x53ea69){_0x4a8d1a(_0x53ea69);});});};module['exports']=function(_0x4094b0,_0x5427ab){var _0x597d19=_0x4094b0['models'];return _0x4094b0['define'](_0xb968('0x1d'),attributes,{'tableName':_0xb968('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2db03f,_0x2af846,_0x534bd5){return getChanSpyPromise(_0x597d19,_0x2db03f)[_0xb968('0x1f')](function(_0x3b7eae){if(_0x3b7eae&&_0x3b7eae[_0xb968('0x17')]){return _0x597d19[_0xb968('0x20')][_0xb968('0x21')](_0x3b7eae);}})[_0xb968('0x1f')](function(){_0x534bd5();})[_0xb968('0x1c')](function(_0x4965ba){_0x534bd5(_0x4965ba);});},'afterUpdate':function(_0x10f2d3,_0x265ca2,_0x2d90a2){return _0x597d19[_0xb968('0x20')][_0xb968('0x22')]({'where':{'ChanSpyId':_0x10f2d3['id']}})[_0xb968('0x1f')](function(){return getChanSpyPromise(_0x597d19,_0x10f2d3);})['then'](function(_0x4e799e){if(_0x4e799e&&_0x4e799e[_0xb968('0x17')]){return _0x597d19['VoiceExtension'][_0xb968('0x21')](_0x4e799e);}})[_0xb968('0x1f')](function(){_0x2d90a2();})[_0xb968('0x1c')](function(_0x3acfe6){_0x2d90a2(_0x3acfe6);});},'afterDestroy':function(_0x169b43,_0x2eda78,_0x2f5b10){return _0x597d19[_0xb968('0x20')][_0xb968('0x22')]({'where':{'ChanSpyId':_0x169b43['id']}})[_0xb968('0x1f')](function(){_0x2f5b10();})[_0xb968('0x1c')](function(_0x16dc72){_0x2f5b10(_0x16dc72);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6fad042..6dfc69c 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 _0x684c=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x25d277,_0x5401fd){var _0xaa7f41=function(_0x1505f4){while(--_0x1505f4){_0x25d277['push'](_0x25d277['shift']());}};_0xaa7f41(++_0x5401fd);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var moment=require('moment');var BPromise=require(_0xc684('0x2'));var rs=require(_0xc684('0x3'));var fs=require('fs');var Redis=require(_0xc684('0x4'));var db=require(_0xc684('0x5'))['db'];var utils=require(_0xc684('0x6'));var logger=require('../../config/logger')(_0xc684('0x7'));var config=require(_0xc684('0x8'));var jayson=require(_0xc684('0x9'));var client=jayson[_0xc684('0xa')][_0xc684('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57a63c,_0x23bd1c,_0x1a96ea){return new BPromise(function(_0x146733,_0xccb771){return client[_0xc684('0xc')](_0x57a63c,_0x1a96ea)[_0xc684('0xd')](function(_0x3b3bc0){logger[_0xc684('0xe')](_0xc684('0xf'),_0x23bd1c,_0xc684('0x10'));logger[_0xc684('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'),JSON[_0xc684('0x12')](_0x3b3bc0));if(_0x3b3bc0[_0xc684('0x13')]){if(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x14')]===0x1f4){logger[_0xc684('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0xccb771(_0x3b3bc0['error']['message']);}logger[_0xc684('0x13')](_0xc684('0xf'),_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0x146733(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'));_0x146733(_0x3b3bc0['result']['message']);}})['catch'](function(_0x47a8eb){logger['error'](_0xc684('0xf'),_0x23bd1c,_0x47a8eb);_0xccb771(_0x47a8eb);});});} \ No newline at end of file +var _0x22fb=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c19ef,_0x430d0e){var _0x2390f7=function(_0x19e35d){while(--_0x19e35d){_0x4c19ef['push'](_0x4c19ef['shift']());}};_0x2390f7(++_0x430d0e);}(_0x22fb,0x192));var _0xb22f=function(_0x1ace7c,_0x3ade97){_0x1ace7c=_0x1ace7c-0x0;var _0x18e71f=_0x22fb[_0x1ace7c];return _0x18e71f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d07157c..dee2349 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 _0xc740=['get','/:id','show','post','create','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0xc740,0x94));var _0x0c74=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xc740[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require('multer');var util=require(_0x0c74('0x0'));var path=require(_0x0c74('0x1'));var timeout=require(_0x0c74('0x2'));var express=require(_0x0c74('0x3'));var router=express[_0x0c74('0x4')]();var fs_extra=require(_0x0c74('0x5'));var auth=require(_0x0c74('0x6'));var interaction=require(_0x0c74('0x7'));var config=require(_0x0c74('0x8'));var controller=require(_0x0c74('0x9'));router['get']('/',auth[_0x0c74('0xa')](),controller[_0x0c74('0xb')]);router[_0x0c74('0xc')](_0x0c74('0xd'),auth['isAuthenticated'](),controller[_0x0c74('0xe')]);router[_0x0c74('0xf')]('/',auth[_0x0c74('0xa')](),controller[_0x0c74('0x10')]);router[_0x0c74('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0c74('0x12')]('/:id',auth[_0x0c74('0xa')](),controller['destroy']);module[_0x0c74('0x13')]=router; \ No newline at end of file +var _0x3b2d=['index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x3a11ce,_0x3b203e){var _0x159267=function(_0xb121b0){while(--_0xb121b0){_0x3a11ce['push'](_0x3a11ce['shift']());}};_0x159267(++_0x3b203e);}(_0x3b2d,0x112));var _0xd3b2=function(_0x2d5b32,_0x29ce95){_0x2d5b32=_0x2d5b32-0x0;var _0x5e98f5=_0x3b2d[_0x2d5b32];return _0x5e98f5;};'use strict';var multer=require('multer');var util=require(_0xd3b2('0x0'));var path=require(_0xd3b2('0x1'));var timeout=require(_0xd3b2('0x2'));var express=require(_0xd3b2('0x3'));var router=express[_0xd3b2('0x4')]();var fs_extra=require(_0xd3b2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd3b2('0x6'));var config=require(_0xd3b2('0x7'));var controller=require(_0xd3b2('0x8'));router[_0xd3b2('0x9')]('/',auth[_0xd3b2('0xa')](),controller[_0xd3b2('0xb')]);router[_0xd3b2('0x9')](_0xd3b2('0xc'),auth[_0xd3b2('0xa')](),controller[_0xd3b2('0xd')]);router[_0xd3b2('0xe')]('/',auth['isAuthenticated'](),controller[_0xd3b2('0xf')]);router['put'](_0xd3b2('0xc'),auth[_0xd3b2('0xa')](),controller[_0xd3b2('0x10')]);router[_0xd3b2('0x11')]('/:id',auth[_0xd3b2('0xa')](),controller[_0xd3b2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 502b543..d8f405f 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 _0xda60=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x3c67ea,_0x2a059a){var _0x1a07ee=function(_0x221d16){while(--_0x221d16){_0x3c67ea['push'](_0x3c67ea['shift']());}};_0x1a07ee(++_0x2a059a);}(_0xda60,0x80));var _0x0da6=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0xda60[_0x542d80];return _0x1f4492;};'use strict';var Sequelize=require(_0x0da6('0x0'));module[_0x0da6('0x1')]={'name':{'type':Sequelize[_0x0da6('0x2')],'unique':_0x0da6('0x3')},'description':{'type':Sequelize[_0x0da6('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0da6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xca04=['name','BOOLEAN','sequelize','STRING'];(function(_0x1ba864,_0x3210c9){var _0x277205=function(_0x292176){while(--_0x292176){_0x1ba864['push'](_0x1ba864['shift']());}};_0x277205(++_0x3210c9);}(_0xca04,0x192));var _0x4ca0=function(_0x2db73f,_0x2dbea7){_0x2db73f=_0x2db73f-0x0;var _0x35f59f=_0xca04[_0x2db73f];return _0x35f59f;};'use strict';var Sequelize=require(_0x4ca0('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ca0('0x1')],'unique':_0x4ca0('0x2')},'description':{'type':Sequelize[_0x4ca0('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4ca0('0x3')],'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 2850233..833ea05 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 _0x8c11=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','model','query','intersection','attributes','length','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','fields','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','render','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x4b1263,_0x696904){var _0x3a54b4=function(_0x290719){while(--_0x290719){_0x4b1263['push'](_0x4b1263['shift']());}};_0x3a54b4(++_0x696904);}(_0x8c11,0x12a));var _0x18c1=function(_0x3a6544,_0x3eee1f){_0x3a6544=_0x3a6544-0x0;var _0x17f9c2=_0x8c11[_0x3a6544];return _0x17f9c2;};'use strict';var emlformat=require(_0x18c1('0x0'));var rimraf=require(_0x18c1('0x1'));var zipdir=require(_0x18c1('0x2'));var jsonpatch=require(_0x18c1('0x3'));var rp=require(_0x18c1('0x4'));var moment=require('moment');var BPromise=require(_0x18c1('0x5'));var Mustache=require(_0x18c1('0x6'));var util=require(_0x18c1('0x7'));var path=require(_0x18c1('0x8'));var sox=require(_0x18c1('0x9'));var csv=require(_0x18c1('0xa'));var ejs=require(_0x18c1('0xb'));var fs=require('fs');var fs_extra=require(_0x18c1('0xc'));var _=require('lodash');var squel=require(_0x18c1('0xd'));var crypto=require(_0x18c1('0xe'));var jsforce=require(_0x18c1('0xf'));var deskjs=require(_0x18c1('0x10'));var toCsv=require(_0x18c1('0xa'));var querystring=require(_0x18c1('0x11'));var Papa=require(_0x18c1('0x12'));var Redis=require(_0x18c1('0x13'));var authService=require(_0x18c1('0x14'));var qs=require(_0x18c1('0x15'));var as=require(_0x18c1('0x16'));var hardwareService=require(_0x18c1('0x17'));var logger=require(_0x18c1('0x18'))(_0x18c1('0x19'));var utils=require(_0x18c1('0x1a'));var config=require(_0x18c1('0x1b'));var licenseUtil=require(_0x18c1('0x1c'));var db=require('../../mysqldb')['db'];var jayson=require(_0x18c1('0x1d'));var client=jayson[_0x18c1('0x1e')][_0x18c1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5de433,_0x452875,_0x4d1cde,_0x5a6e93){return new BPromise(function(_0x494044,_0x1da714){var _0x50286d=_0x5a6e93||client;return _0x50286d[_0x18c1('0x20')](_0x5de433,_0x4d1cde)['then'](function(_0x129017){logger[_0x18c1('0x21')](_0x18c1('0x22'),_0x452875,_0x18c1('0x23'));logger[_0x18c1('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x452875,_0x18c1('0x23'),JSON[_0x18c1('0x25')](_0x129017));if(_0x129017[_0x18c1('0x26')]){if(_0x129017[_0x18c1('0x26')][_0x18c1('0x27')]===0x1f4){logger[_0x18c1('0x26')](_0x18c1('0x22'),_0x452875,_0x129017[_0x18c1('0x26')][_0x18c1('0x28')]);return _0x1da714(_0x129017[_0x18c1('0x26')]['message']);}logger[_0x18c1('0x26')]('VoiceContext,\x20%s,\x20%s',_0x452875,_0x129017['error']['message']);return _0x494044(_0x129017[_0x18c1('0x26')][_0x18c1('0x28')]);}else{logger[_0x18c1('0x21')](_0x18c1('0x22'),_0x452875,_0x18c1('0x23'));_0x494044(_0x129017[_0x18c1('0x29')][_0x18c1('0x28')]);}})['catch'](function(_0x315e68){logger['error'](_0x18c1('0x22'),_0x452875,_0x315e68);_0x1da714(_0x315e68);});});}function respondWithStatusCode(_0xeb4dc6,_0x25eefa){_0x25eefa=_0x25eefa||0xcc;return function(_0x4adc35){if(_0x4adc35){return _0xeb4dc6[_0x18c1('0x2a')](_0x25eefa);}return _0xeb4dc6[_0x18c1('0x2b')](_0x25eefa)[_0x18c1('0x2c')]();};}function respondWithResult(_0x29ce51,_0x355022){_0x355022=_0x355022||0xc8;return function(_0x56d44e){if(_0x56d44e){return _0x29ce51[_0x18c1('0x2b')](_0x355022)[_0x18c1('0x2d')](_0x56d44e);}};}function respondWithFilteredResult(_0x5aa694,_0x5a5101){return function(_0x569d1e){if(_0x569d1e){var _0x31d520=typeof _0x5a5101[_0x18c1('0x2e')]===_0x18c1('0x2f')&&typeof _0x5a5101[_0x18c1('0x30')]==='undefined';var _0x321460=_0x569d1e[_0x18c1('0x31')];var _0x260348=_0x31d520?0x0:_0x5a5101[_0x18c1('0x2e')];var _0x5ad7cf=_0x31d520?_0x569d1e['count']:_0x5a5101['offset']+_0x5a5101[_0x18c1('0x30')];var _0x1aa979;if(_0x5ad7cf>=_0x321460){_0x5ad7cf=_0x321460;_0x1aa979=0xc8;}else{_0x1aa979=0xce;}_0x5aa694[_0x18c1('0x2b')](_0x1aa979);return _0x5aa694[_0x18c1('0x32')](_0x18c1('0x33'),_0x260348+'-'+_0x5ad7cf+'/'+_0x321460)[_0x18c1('0x2d')](_0x569d1e);}return null;};}function patchUpdates(_0x3df82e){return function(_0x5ce570){try{jsonpatch['apply'](_0x5ce570,_0x3df82e,!![]);}catch(_0x2ba259){return BPromise[_0x18c1('0x34')](_0x2ba259);}return _0x5ce570[_0x18c1('0x35')]();};}function saveUpdates(_0x47c02c,_0x1aa7fd){return function(_0x598c89){if(_0x598c89){return _0x598c89[_0x18c1('0x36')](_0x47c02c)[_0x18c1('0x37')](function(_0x366268){return _0x366268;});}return null;};}function removeEntity(_0x21f426,_0x1f7070){return function(_0x1f8387){if(_0x1f8387){return _0x1f8387[_0x18c1('0x38')]()[_0x18c1('0x37')](function(){var _0x4cab8a=_0x1f8387[_0x18c1('0x39')]({'plain':!![]});var _0x5095a0=_0x18c1('0x3a');return db[_0x18c1('0x3b')][_0x18c1('0x38')]({'where':{'type':_0x5095a0,'resourceId':_0x4cab8a['id']}})[_0x18c1('0x37')](function(){return _0x1f8387;});})[_0x18c1('0x37')](function(){_0x21f426[_0x18c1('0x2b')](0xcc)[_0x18c1('0x2c')]();});}};}function handleEntityNotFound(_0x207aa2,_0x3a007c){return function(_0x12eba3){if(!_0x12eba3){_0x207aa2['sendStatus'](0x194);}return _0x12eba3;};}function handleError(_0x2bfc70,_0x2e3a47){_0x2e3a47=_0x2e3a47||0x1f4;return function(_0x1f048e){logger['error'](_0x1f048e[_0x18c1('0x3c')]);if(_0x1f048e[_0x18c1('0x3d')]){delete _0x1f048e[_0x18c1('0x3d')];}_0x2bfc70[_0x18c1('0x2b')](_0x2e3a47)[_0x18c1('0x3e')](_0x1f048e);};}exports['index']=function(_0x48e959,_0x950ef){var _0x5c3d75={},_0x2b40af={},_0x41ffae={'count':0x0,'rows':[]};var _0x39590c=_[_0x18c1('0x3f')](db[_0x18c1('0x40')][_0x18c1('0x41')],function(_0x5d83eb){return{'name':_0x5d83eb[_0x18c1('0x42')],'type':_0x5d83eb['type']['key']};});_0x2b40af[_0x18c1('0x43')]=_[_0x18c1('0x3f')](_0x39590c,_0x18c1('0x3d'));_0x2b40af[_0x18c1('0x44')]=_['keys'](_0x48e959['query']);_0x2b40af['filters']=_[_0x18c1('0x45')](_0x2b40af[_0x18c1('0x43')],_0x2b40af[_0x18c1('0x44')]);_0x5c3d75[_0x18c1('0x46')]=_[_0x18c1('0x45')](_0x2b40af[_0x18c1('0x43')],qs['fields'](_0x48e959['query']['fields']));_0x5c3d75[_0x18c1('0x46')]=_0x5c3d75[_0x18c1('0x46')][_0x18c1('0x47')]?_0x5c3d75[_0x18c1('0x46')]:_0x2b40af[_0x18c1('0x43')];if(!_0x48e959[_0x18c1('0x44')][_0x18c1('0x48')]('nolimit')){_0x5c3d75[_0x18c1('0x30')]=qs[_0x18c1('0x30')](_0x48e959[_0x18c1('0x44')][_0x18c1('0x30')]);_0x5c3d75['offset']=qs[_0x18c1('0x2e')](_0x48e959[_0x18c1('0x44')][_0x18c1('0x2e')]);}_0x5c3d75['order']=qs['sort'](_0x48e959['query'][_0x18c1('0x49')]);_0x5c3d75['where']=qs[_0x18c1('0x4a')](_['pick'](_0x48e959['query'],_0x2b40af['filters']),_0x39590c);if(_0x48e959[_0x18c1('0x44')][_0x18c1('0x4b')]){_0x5c3d75[_0x18c1('0x4c')]=_[_0x18c1('0x4d')](_0x5c3d75[_0x18c1('0x4c')],{'$or':_[_0x18c1('0x3f')](_0x39590c,function(_0x20209e){if(_0x20209e['type']!==_0x18c1('0x4e')){var _0x1263f0={};_0x1263f0[_0x20209e[_0x18c1('0x3d')]]={'$like':'%'+_0x48e959[_0x18c1('0x44')]['filter']+'%'};return _0x1263f0;}})});}_0x5c3d75=_['merge']({},_0x5c3d75,_0x48e959[_0x18c1('0x4f')]);var _0x3b9edf={'where':_0x5c3d75[_0x18c1('0x4c')]};return db[_0x18c1('0x40')]['count'](_0x3b9edf)[_0x18c1('0x37')](function(_0x2c447b){_0x41ffae[_0x18c1('0x31')]=_0x2c447b;if(_0x48e959['query'][_0x18c1('0x50')]){_0x5c3d75[_0x18c1('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x18c1('0x52')](_0x5c3d75);})[_0x18c1('0x37')](function(_0x1ce304){_0x41ffae['rows']=_0x1ce304;return _0x41ffae;})['then'](respondWithFilteredResult(_0x950ef,_0x5c3d75))[_0x18c1('0x53')](handleError(_0x950ef,null));};exports[_0x18c1('0x54')]=function(_0x50664c,_0x4872ae){var _0x2f853b={'raw':![],'where':{'id':_0x50664c[_0x18c1('0x55')]['id']}},_0x2b05b6={};_0x2b05b6[_0x18c1('0x43')]=_[_0x18c1('0x56')](db[_0x18c1('0x40')][_0x18c1('0x41')]);_0x2b05b6[_0x18c1('0x44')]=_[_0x18c1('0x56')](_0x50664c[_0x18c1('0x44')]);_0x2b05b6[_0x18c1('0x4a')]=_[_0x18c1('0x45')](_0x2b05b6[_0x18c1('0x43')],_0x2b05b6[_0x18c1('0x44')]);_0x2f853b[_0x18c1('0x46')]=_['intersection'](_0x2b05b6['model'],qs[_0x18c1('0x57')](_0x50664c[_0x18c1('0x44')][_0x18c1('0x57')]));_0x2f853b[_0x18c1('0x46')]=_0x2f853b[_0x18c1('0x46')][_0x18c1('0x47')]?_0x2f853b[_0x18c1('0x46')]:_0x2b05b6['model'];if(_0x50664c[_0x18c1('0x44')][_0x18c1('0x50')]){_0x2f853b['include']=[{'all':!![]}];}_0x2f853b=_[_0x18c1('0x4d')]({},_0x2f853b,_0x50664c['options']);return db['VoiceContext'][_0x18c1('0x58')](_0x2f853b)['then'](handleEntityNotFound(_0x4872ae,null))[_0x18c1('0x37')](respondWithResult(_0x4872ae,null))[_0x18c1('0x53')](handleError(_0x4872ae,null));};exports[_0x18c1('0x59')]=function(_0x1e4108,_0x36a923,_0x2f4c0f){var _0x2c2da5;return db[_0x18c1('0x40')][_0x18c1('0x59')](_0x1e4108[_0x18c1('0x5a')],{'raw':!![]})[_0x18c1('0x37')](function(_0x317ae3){_0x2c2da5=_0x317ae3;return db['VoiceContext'][_0x18c1('0x52')]({'raw':!![]});})['then'](function(_0x1e680f){var _0x16a1b5=fs[_0x18c1('0x5b')](path[_0x18c1('0x5c')](config[_0x18c1('0x5d')],_0x18c1('0x5e')),_0x18c1('0x5f'));var _0x194f60=ejs['render'](_0x16a1b5,{'contexts':_0x1e680f||[]});fs[_0x18c1('0x60')](_0x18c1('0x61'),_0x194f60);})['then'](function(){return respondWithRpcPromise(_0x18c1('0x62'),_0x18c1('0x59'),{'module':_0x18c1('0x63')});})[_0x18c1('0x37')](function(){var _0xaf1d0a=_0x1e4108[_0x18c1('0x64')][_0x18c1('0x39')]({'plain':!![]});if(!_0xaf1d0a)throw new Error(_0x18c1('0x65'));if(_0xaf1d0a['role']===_0x18c1('0x64')){var _0x48d097=_0x2c2da5[_0x18c1('0x39')]({'plain':!![]});return db[_0x18c1('0x66')]['find']({'where':{'name':_0x18c1('0x3a'),'userProfileId':_0xaf1d0a['userProfileId']},'raw':!![]})[_0x18c1('0x37')](function(_0x5f31cb){if(_0x5f31cb&&_0x5f31cb[_0x18c1('0x67')]===0x0){return db[_0x18c1('0x3b')][_0x18c1('0x59')]({'name':_0x48d097[_0x18c1('0x3d')],'resourceId':_0x48d097['id'],'type':_0x5f31cb['name'],'sectionId':_0x5f31cb['id']},{})[_0x18c1('0x37')](function(){return _0x2c2da5;});}else{return _0x2c2da5;}})[_0x18c1('0x53')](function(_0xd59c8b){logger[_0x18c1('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd59c8b);throw _0xd59c8b;});}return _0x2c2da5;})[_0x18c1('0x37')](respondWithResult(_0x36a923,0xc9))[_0x18c1('0x53')](handleError(_0x36a923,null));};exports[_0x18c1('0x36')]=function(_0x4902d4,_0x2f4ae6,_0x3f2686){var _0x2dd74e;return db[_0x18c1('0x40')][_0x18c1('0x58')]({'where':{'id':_0x4902d4[_0x18c1('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f4ae6,null))[_0x18c1('0x37')](saveUpdates(_0x4902d4[_0x18c1('0x5a')],null))[_0x18c1('0x37')](function(_0x1c7e17){if(_0x1c7e17){_0x2dd74e=_0x1c7e17;return db[_0x18c1('0x40')][_0x18c1('0x52')]({'raw':!![]});}})[_0x18c1('0x37')](function(_0x479edd){var _0x57e740=fs[_0x18c1('0x5b')](path[_0x18c1('0x5c')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x109d83=ejs[_0x18c1('0x68')](_0x57e740,{'contexts':_0x479edd||[]});fs['writeFileSync'](_0x18c1('0x61'),_0x109d83);})[_0x18c1('0x37')](function(){return respondWithRpcPromise(_0x18c1('0x62'),'update',{'module':_0x18c1('0x63')});})['then'](function(){return _0x2dd74e;})[_0x18c1('0x37')](respondWithResult(_0x2f4ae6,null))['catch'](handleError(_0x2f4ae6,null));};exports[_0x18c1('0x38')]=function(_0x559872,_0xe90516,_0x547628){var _0x11854a;return db['VoiceContext']['find']({'where':{'id':_0x559872[_0x18c1('0x55')]['id']}})['then'](handleEntityNotFound(_0xe90516,null))[_0x18c1('0x37')](removeEntity(_0xe90516,null))['then'](function(){return db['VoiceContext'][_0x18c1('0x52')]({'raw':!![]});})[_0x18c1('0x37')](function(_0x35c529){var _0x218ee3=fs[_0x18c1('0x5b')](path[_0x18c1('0x5c')](config[_0x18c1('0x5d')],_0x18c1('0x5e')),_0x18c1('0x5f'));var _0x590b90=ejs[_0x18c1('0x68')](_0x218ee3,{'contexts':_0x35c529});fs[_0x18c1('0x60')](_0x18c1('0x61'),_0x590b90);return respondWithRpcPromise('Reload',_0x18c1('0x38'),{'module':'chan_sip.so'});})[_0x18c1('0x53')](handleError(_0xe90516,null));}; \ No newline at end of file +var _0x3f44=['body','readFileSync','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','params','eml-format','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','keys','include','find','create','join','root','server/files/templates/context.ejs','render','writeFileSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x1789bc,_0x1acf84){var _0x35efd1=function(_0x2329b2){while(--_0x2329b2){_0x1789bc['push'](_0x1789bc['shift']());}};_0x35efd1(++_0x1acf84);}(_0x3f44,0x17b));var _0x43f4=function(_0x192fc5,_0x1181e2){_0x192fc5=_0x192fc5-0x0;var _0x38ef44=_0x3f44[_0x192fc5];return _0x38ef44;};'use strict';var emlformat=require(_0x43f4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43f4('0x1'));var rp=require('request-promise');var moment=require(_0x43f4('0x2'));var BPromise=require(_0x43f4('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x43f4('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x43f4('0x5'));var fs=require('fs');var fs_extra=require(_0x43f4('0x6'));var _=require(_0x43f4('0x7'));var squel=require(_0x43f4('0x8'));var crypto=require(_0x43f4('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x43f4('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43f4('0xb'));var qs=require(_0x43f4('0xc'));var as=require(_0x43f4('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43f4('0xe'));var licenseUtil=require(_0x43f4('0xf'));var db=require(_0x43f4('0x10'))['db'];var jayson=require(_0x43f4('0x11'));var client=jayson[_0x43f4('0x12')][_0x43f4('0x13')]({'port':0x232a});function respondWithRpcPromise(_0xdfb3c4,_0x9e1236,_0x32701c,_0x1a5b32){return new BPromise(function(_0x4ecb08,_0x43524f){var _0x49e5b4=_0x1a5b32||client;return _0x49e5b4['request'](_0xdfb3c4,_0x32701c)[_0x43f4('0x14')](function(_0x4ae813){logger[_0x43f4('0x15')]('VoiceContext,\x20%s,\x20%s',_0x9e1236,_0x43f4('0x16'));logger[_0x43f4('0x17')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x9e1236,'request\x20sent',JSON[_0x43f4('0x18')](_0x4ae813));if(_0x4ae813[_0x43f4('0x19')]){if(_0x4ae813[_0x43f4('0x19')][_0x43f4('0x1a')]===0x1f4){logger['error'](_0x43f4('0x1b'),_0x9e1236,_0x4ae813[_0x43f4('0x19')][_0x43f4('0x1c')]);return _0x43524f(_0x4ae813['error']['message']);}logger[_0x43f4('0x19')]('VoiceContext,\x20%s,\x20%s',_0x9e1236,_0x4ae813['error'][_0x43f4('0x1c')]);return _0x4ecb08(_0x4ae813['error']['message']);}else{logger['info'](_0x43f4('0x1b'),_0x9e1236,'request\x20sent');_0x4ecb08(_0x4ae813['result'][_0x43f4('0x1c')]);}})[_0x43f4('0x1d')](function(_0x45ad05){logger[_0x43f4('0x19')](_0x43f4('0x1b'),_0x9e1236,_0x45ad05);_0x43524f(_0x45ad05);});});}function respondWithStatusCode(_0x6f7898,_0x435567){_0x435567=_0x435567||0xcc;return function(_0x573dcd){if(_0x573dcd){return _0x6f7898[_0x43f4('0x1e')](_0x435567);}return _0x6f7898[_0x43f4('0x1f')](_0x435567)[_0x43f4('0x20')]();};}function respondWithResult(_0x133f27,_0xf76e){_0xf76e=_0xf76e||0xc8;return function(_0x6a823f){if(_0x6a823f){return _0x133f27[_0x43f4('0x1f')](_0xf76e)[_0x43f4('0x21')](_0x6a823f);}};}function respondWithFilteredResult(_0x4f019c,_0x4389fe){return function(_0x53f111){if(_0x53f111){var _0x30b50f=typeof _0x4389fe[_0x43f4('0x22')]===_0x43f4('0x23')&&typeof _0x4389fe[_0x43f4('0x24')]===_0x43f4('0x23');var _0x5f22b9=_0x53f111[_0x43f4('0x25')];var _0x517c61=_0x30b50f?0x0:_0x4389fe[_0x43f4('0x22')];var _0x23e50b=_0x30b50f?_0x53f111['count']:_0x4389fe[_0x43f4('0x22')]+_0x4389fe[_0x43f4('0x24')];var _0x52688f;if(_0x23e50b>=_0x5f22b9){_0x23e50b=_0x5f22b9;_0x52688f=0xc8;}else{_0x52688f=0xce;}_0x4f019c[_0x43f4('0x1f')](_0x52688f);return _0x4f019c[_0x43f4('0x26')]('Content-Range',_0x517c61+'-'+_0x23e50b+'/'+_0x5f22b9)[_0x43f4('0x21')](_0x53f111);}return null;};}function patchUpdates(_0xb9e85d){return function(_0x11388e){try{jsonpatch['apply'](_0x11388e,_0xb9e85d,!![]);}catch(_0x473362){return BPromise[_0x43f4('0x27')](_0x473362);}return _0x11388e['save']();};}function saveUpdates(_0x4138cc,_0xd4a8aa){return function(_0x5a1406){if(_0x5a1406){return _0x5a1406['update'](_0x4138cc)[_0x43f4('0x14')](function(_0x2fbe0b){return _0x2fbe0b;});}return null;};}function removeEntity(_0x3c39e8,_0x21f2c7){return function(_0xdfbf57){if(_0xdfbf57){return _0xdfbf57[_0x43f4('0x28')]()[_0x43f4('0x14')](function(){var _0x384486=_0xdfbf57[_0x43f4('0x29')]({'plain':!![]});var _0x828700=_0x43f4('0x2a');return db[_0x43f4('0x2b')]['destroy']({'where':{'type':_0x828700,'resourceId':_0x384486['id']}})[_0x43f4('0x14')](function(){return _0xdfbf57;});})[_0x43f4('0x14')](function(){_0x3c39e8[_0x43f4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49bcaf,_0x536411){return function(_0x4774c3){if(!_0x4774c3){_0x49bcaf['sendStatus'](0x194);}return _0x4774c3;};}function handleError(_0xcb01c1,_0x547ea6){_0x547ea6=_0x547ea6||0x1f4;return function(_0x5d9f8e){logger['error'](_0x5d9f8e[_0x43f4('0x2c')]);if(_0x5d9f8e[_0x43f4('0x2d')]){delete _0x5d9f8e[_0x43f4('0x2d')];}_0xcb01c1[_0x43f4('0x1f')](_0x547ea6)[_0x43f4('0x2e')](_0x5d9f8e);};}exports[_0x43f4('0x2f')]=function(_0x60fb07,_0xee60c3){var _0x55c83f={},_0x664407={},_0x40a29c={'count':0x0,'rows':[]};var _0x269194=_['map'](db[_0x43f4('0x30')]['rawAttributes'],function(_0x2cd93d){return{'name':_0x2cd93d[_0x43f4('0x31')],'type':_0x2cd93d['type'][_0x43f4('0x32')]};});_0x664407[_0x43f4('0x33')]=_['map'](_0x269194,_0x43f4('0x2d'));_0x664407['query']=_['keys'](_0x60fb07[_0x43f4('0x34')]);_0x664407[_0x43f4('0x35')]=_['intersection'](_0x664407[_0x43f4('0x33')],_0x664407[_0x43f4('0x34')]);_0x55c83f[_0x43f4('0x36')]=_[_0x43f4('0x37')](_0x664407[_0x43f4('0x33')],qs[_0x43f4('0x38')](_0x60fb07[_0x43f4('0x34')][_0x43f4('0x38')]));_0x55c83f[_0x43f4('0x36')]=_0x55c83f[_0x43f4('0x36')][_0x43f4('0x39')]?_0x55c83f[_0x43f4('0x36')]:_0x664407[_0x43f4('0x33')];if(!_0x60fb07['query']['hasOwnProperty'](_0x43f4('0x3a'))){_0x55c83f[_0x43f4('0x24')]=qs['limit'](_0x60fb07[_0x43f4('0x34')]['limit']);_0x55c83f['offset']=qs[_0x43f4('0x22')](_0x60fb07[_0x43f4('0x34')][_0x43f4('0x22')]);}_0x55c83f[_0x43f4('0x3b')]=qs['sort'](_0x60fb07['query']['sort']);_0x55c83f[_0x43f4('0x3c')]=qs['filters'](_['pick'](_0x60fb07[_0x43f4('0x34')],_0x664407['filters']),_0x269194);if(_0x60fb07['query']['filter']){_0x55c83f[_0x43f4('0x3c')]=_[_0x43f4('0x3d')](_0x55c83f['where'],{'$or':_['map'](_0x269194,function(_0x261df3){if(_0x261df3['type']!==_0x43f4('0x3e')){var _0x31a9e0={};_0x31a9e0[_0x261df3[_0x43f4('0x2d')]]={'$like':'%'+_0x60fb07[_0x43f4('0x34')]['filter']+'%'};return _0x31a9e0;}})});}_0x55c83f=_[_0x43f4('0x3d')]({},_0x55c83f,_0x60fb07[_0x43f4('0x3f')]);var _0xf3fea8={'where':_0x55c83f['where']};return db[_0x43f4('0x30')][_0x43f4('0x25')](_0xf3fea8)['then'](function(_0x1547bf){_0x40a29c[_0x43f4('0x25')]=_0x1547bf;if(_0x60fb07[_0x43f4('0x34')][_0x43f4('0x40')]){_0x55c83f['include']=[{'all':!![]}];}return db[_0x43f4('0x30')][_0x43f4('0x41')](_0x55c83f);})[_0x43f4('0x14')](function(_0x399684){_0x40a29c[_0x43f4('0x42')]=_0x399684;return _0x40a29c;})[_0x43f4('0x14')](respondWithFilteredResult(_0xee60c3,_0x55c83f))['catch'](handleError(_0xee60c3,null));};exports[_0x43f4('0x43')]=function(_0x331b23,_0x5abe59){var _0x2201d6={'raw':![],'where':{'id':_0x331b23['params']['id']}},_0x3691ec={};_0x3691ec[_0x43f4('0x33')]=_['keys'](db[_0x43f4('0x30')][_0x43f4('0x44')]);_0x3691ec[_0x43f4('0x34')]=_[_0x43f4('0x45')](_0x331b23[_0x43f4('0x34')]);_0x3691ec['filters']=_['intersection'](_0x3691ec[_0x43f4('0x33')],_0x3691ec[_0x43f4('0x34')]);_0x2201d6[_0x43f4('0x36')]=_[_0x43f4('0x37')](_0x3691ec[_0x43f4('0x33')],qs[_0x43f4('0x38')](_0x331b23['query'][_0x43f4('0x38')]));_0x2201d6[_0x43f4('0x36')]=_0x2201d6[_0x43f4('0x36')]['length']?_0x2201d6[_0x43f4('0x36')]:_0x3691ec[_0x43f4('0x33')];if(_0x331b23['query']['includeAll']){_0x2201d6[_0x43f4('0x46')]=[{'all':!![]}];}_0x2201d6=_[_0x43f4('0x3d')]({},_0x2201d6,_0x331b23[_0x43f4('0x3f')]);return db[_0x43f4('0x30')][_0x43f4('0x47')](_0x2201d6)['then'](handleEntityNotFound(_0x5abe59,null))[_0x43f4('0x14')](respondWithResult(_0x5abe59,null))['catch'](handleError(_0x5abe59,null));};exports[_0x43f4('0x48')]=function(_0xfb3a87,_0x579e61,_0x13526c){var _0x457f08;return db['VoiceContext'][_0x43f4('0x48')](_0xfb3a87['body'],{'raw':!![]})[_0x43f4('0x14')](function(_0x3ce56c){_0x457f08=_0x3ce56c;return db[_0x43f4('0x30')][_0x43f4('0x41')]({'raw':!![]});})['then'](function(_0x39df03){var _0x4abb02=fs['readFileSync'](path[_0x43f4('0x49')](config[_0x43f4('0x4a')],_0x43f4('0x4b')),'utf8');var _0x10be21=ejs[_0x43f4('0x4c')](_0x4abb02,{'contexts':_0x39df03||[]});fs[_0x43f4('0x4d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x10be21);})[_0x43f4('0x14')](function(){return respondWithRpcPromise('Reload',_0x43f4('0x48'),{'module':'chan_sip.so'});})['then'](function(){var _0x2f9e27=_0xfb3a87[_0x43f4('0x4e')][_0x43f4('0x29')]({'plain':!![]});if(!_0x2f9e27)throw new Error(_0x43f4('0x4f'));if(_0x2f9e27[_0x43f4('0x50')]===_0x43f4('0x4e')){var _0x26d9bf=_0x457f08['get']({'plain':!![]});return db[_0x43f4('0x51')][_0x43f4('0x47')]({'where':{'name':_0x43f4('0x2a'),'userProfileId':_0x2f9e27[_0x43f4('0x52')]},'raw':!![]})[_0x43f4('0x14')](function(_0x4a3840){if(_0x4a3840&&_0x4a3840[_0x43f4('0x53')]===0x0){return db[_0x43f4('0x2b')]['create']({'name':_0x26d9bf[_0x43f4('0x2d')],'resourceId':_0x26d9bf['id'],'type':_0x4a3840[_0x43f4('0x2d')],'sectionId':_0x4a3840['id']},{})[_0x43f4('0x14')](function(){return _0x457f08;});}else{return _0x457f08;}})[_0x43f4('0x1d')](function(_0x5eb96f){logger['error'](_0x43f4('0x54'),_0x5eb96f);throw _0x5eb96f;});}return _0x457f08;})[_0x43f4('0x14')](respondWithResult(_0x579e61,0xc9))[_0x43f4('0x1d')](handleError(_0x579e61,null));};exports[_0x43f4('0x55')]=function(_0x443ae0,_0x3f9379,_0x22dcb3){var _0x39025f;return db['VoiceContext']['find']({'where':{'id':_0x443ae0['params']['id']}})[_0x43f4('0x14')](handleEntityNotFound(_0x3f9379,null))[_0x43f4('0x14')](saveUpdates(_0x443ae0[_0x43f4('0x56')],null))[_0x43f4('0x14')](function(_0x3e08b5){if(_0x3e08b5){_0x39025f=_0x3e08b5;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x43f4('0x14')](function(_0x3ec495){var _0x391da3=fs[_0x43f4('0x57')](path[_0x43f4('0x49')](config[_0x43f4('0x4a')],_0x43f4('0x4b')),_0x43f4('0x58'));var _0x4670e4=ejs[_0x43f4('0x4c')](_0x391da3,{'contexts':_0x3ec495||[]});fs[_0x43f4('0x4d')](_0x43f4('0x59'),_0x4670e4);})[_0x43f4('0x14')](function(){return respondWithRpcPromise(_0x43f4('0x5a'),'update',{'module':_0x43f4('0x5b')});})[_0x43f4('0x14')](function(){return _0x39025f;})[_0x43f4('0x14')](respondWithResult(_0x3f9379,null))['catch'](handleError(_0x3f9379,null));};exports[_0x43f4('0x28')]=function(_0xba67e5,_0xe57f44,_0x5f4fcd){var _0x2b8048;return db[_0x43f4('0x30')][_0x43f4('0x47')]({'where':{'id':_0xba67e5[_0x43f4('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe57f44,null))[_0x43f4('0x14')](removeEntity(_0xe57f44,null))[_0x43f4('0x14')](function(){return db['VoiceContext'][_0x43f4('0x41')]({'raw':!![]});})[_0x43f4('0x14')](function(_0x19a0b0){var _0x2ed730=fs[_0x43f4('0x57')](path['join'](config[_0x43f4('0x4a')],_0x43f4('0x4b')),_0x43f4('0x58'));var _0x22f30c=ejs[_0x43f4('0x4c')](_0x2ed730,{'contexts':_0x19a0b0});fs[_0x43f4('0x4d')](_0x43f4('0x59'),_0x22f30c);return respondWithRpcPromise(_0x43f4('0x5a'),_0x43f4('0x28'),{'module':_0x43f4('0x5b')});})['catch'](handleError(_0xe57f44,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d061c05..83c9910 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 _0x5496=['VoiceContext','../../config/logger','api','moment','request-promise','path','rimraf','./voiceContext.attributes','exports','define'];(function(_0x5a3b33,_0x254355){var _0x4e85e7=function(_0x14eb86){while(--_0x14eb86){_0x5a3b33['push'](_0x5a3b33['shift']());}};_0x4e85e7(++_0x254355);}(_0x5496,0x105));var _0x6549=function(_0x154dcd,_0x376f14){_0x154dcd=_0x154dcd-0x0;var _0x1261f0=_0x5496[_0x154dcd];return _0x1261f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6549('0x0'))(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require('bluebird');var rp=require(_0x6549('0x3'));var fs=require('fs');var path=require(_0x6549('0x4'));var rimraf=require(_0x6549('0x5'));var config=require('../../config/environment');var attributes=require(_0x6549('0x6'));module[_0x6549('0x7')]=function(_0x4f8110,_0x4f3d45){return _0x4f8110[_0x6549('0x8')](_0x6549('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0060=['lodash','util','api','moment','request-promise','path','rimraf','./voiceContext.attributes','exports','define','voice_contexts'];(function(_0x2e2586,_0x4ca6be){var _0x47c85d=function(_0x111352){while(--_0x111352){_0x2e2586['push'](_0x2e2586['shift']());}};_0x47c85d(++_0x4ca6be);}(_0x0060,0x11e));var _0x0006=function(_0x54ab1f,_0x1585d6){_0x54ab1f=_0x54ab1f-0x0;var _0x24c869=_0x0060[_0x54ab1f];return _0x24c869;};'use strict';var _=require(_0x0006('0x0'));var util=require(_0x0006('0x1'));var logger=require('../../config/logger')(_0x0006('0x2'));var moment=require(_0x0006('0x3'));var BPromise=require('bluebird');var rp=require(_0x0006('0x4'));var fs=require('fs');var path=require(_0x0006('0x5'));var rimraf=require(_0x0006('0x6'));var config=require('../../config/environment');var attributes=require(_0x0006('0x7'));module[_0x0006('0x8')]=function(_0x17fc09,_0x47baea){return _0x17fc09[_0x0006('0x9')]('VoiceContext',attributes,{'tableName':_0x0006('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 6165fe7..203b38f 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 _0xbc87=['stringify','error','code','message','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x1ba0fb,_0x3fb3ba){var _0x3df64b=function(_0x5b2248){while(--_0x5b2248){_0x1ba0fb['push'](_0x1ba0fb['shift']());}};_0x3df64b(++_0x3fb3ba);}(_0xbc87,0x144));var _0x7bc8=function(_0x5e4965,_0x47f778){_0x5e4965=_0x5e4965-0x0;var _0x549ce1=_0xbc87[_0x5e4965];return _0x549ce1;};'use strict';var _=require(_0x7bc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7bc8('0x1'));var rs=require(_0x7bc8('0x2'));var fs=require('fs');var Redis=require(_0x7bc8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bc8('0x4'))(_0x7bc8('0x5'));var config=require(_0x7bc8('0x6'));var jayson=require(_0x7bc8('0x7'));var client=jayson[_0x7bc8('0x8')][_0x7bc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410b95,_0x2e1d63,_0x1fcc43){return new BPromise(function(_0x466ed5,_0xb87048){return client[_0x7bc8('0xa')](_0x410b95,_0x1fcc43)[_0x7bc8('0xb')](function(_0x368899){logger[_0x7bc8('0xc')](_0x7bc8('0xd'),_0x2e1d63,_0x7bc8('0xe'));logger['debug'](_0x7bc8('0xf'),_0x2e1d63,'request\x20sent',JSON[_0x7bc8('0x10')](_0x368899));if(_0x368899[_0x7bc8('0x11')]){if(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x12')]===0x1f4){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x368899['error'][_0x7bc8('0x13')]);return _0xb87048(_0x368899[_0x7bc8('0x11')]['message']);}logger[_0x7bc8('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2e1d63,_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);return _0x466ed5(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);}else{logger[_0x7bc8('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2e1d63,_0x7bc8('0xe'));_0x466ed5(_0x368899['result'][_0x7bc8('0x13')]);}})['catch'](function(_0x455f9a){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x455f9a);_0xb87048(_0x455f9a);});});} \ No newline at end of file +var _0x0d74=['error','code','message','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x36df2d,_0x1e0740){var _0x251769=function(_0x411025){while(--_0x411025){_0x36df2d['push'](_0x36df2d['shift']());}};_0x251769(++_0x1e0740);}(_0x0d74,0x146));var _0x40d7=function(_0x1e5220,_0x577465){_0x1e5220=_0x1e5220-0x0;var _0x1d56e3=_0x0d74[_0x1e5220];return _0x1d56e3;};'use strict';var _=require(_0x40d7('0x0'));var util=require(_0x40d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x40d7('0x2'));var fs=require('fs');var Redis=require(_0x40d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40d7('0x4'))(_0x40d7('0x5'));var config=require(_0x40d7('0x6'));var jayson=require(_0x40d7('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x504d2a,_0x416c83,_0x5b9b25){return new BPromise(function(_0x4644a3,_0xa80f32){return client['request'](_0x504d2a,_0x5b9b25)[_0x40d7('0x8')](function(_0x13328b){logger[_0x40d7('0x9')](_0x40d7('0xa'),_0x416c83,_0x40d7('0xb'));logger[_0x40d7('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x416c83,_0x40d7('0xb'),JSON[_0x40d7('0xd')](_0x13328b));if(_0x13328b[_0x40d7('0xe')]){if(_0x13328b[_0x40d7('0xe')][_0x40d7('0xf')]===0x1f4){logger['error'](_0x40d7('0xa'),_0x416c83,_0x13328b[_0x40d7('0xe')][_0x40d7('0x10')]);return _0xa80f32(_0x13328b[_0x40d7('0xe')]['message']);}logger[_0x40d7('0xe')](_0x40d7('0xa'),_0x416c83,_0x13328b[_0x40d7('0xe')][_0x40d7('0x10')]);return _0x4644a3(_0x13328b[_0x40d7('0xe')][_0x40d7('0x10')]);}else{logger[_0x40d7('0x9')](_0x40d7('0xa'),_0x416c83,_0x40d7('0xb'));_0x4644a3(_0x13328b['result']['message']);}})['catch'](function(_0x3810f9){logger[_0x40d7('0xe')]('VoiceContext,\x20%s,\x20%s',_0x416c83,_0x3810f9);_0xa80f32(_0x3810f9);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8023b63..cbd9575 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 _0x4b0c=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50a83a,_0x1cab16){var _0x4c87f=function(_0x320e3a){while(--_0x320e3a){_0x50a83a['push'](_0x50a83a['shift']());}};_0x4c87f(++_0x1cab16);}(_0x4b0c,0x138));var _0xc4b0=function(_0x507683,_0x11fe81){_0x507683=_0x507683-0x0;var _0x591954=_0x4b0c[_0x507683];return _0x591954;};'use strict';var multer=require(_0xc4b0('0x0'));var util=require('util');var path=require(_0xc4b0('0x1'));var timeout=require(_0xc4b0('0x2'));var express=require('express');var router=express[_0xc4b0('0x3')]();var fs_extra=require(_0xc4b0('0x4'));var auth=require(_0xc4b0('0x5'));var interaction=require(_0xc4b0('0x6'));var config=require(_0xc4b0('0x7'));var controller=require(_0xc4b0('0x8'));router[_0xc4b0('0x9')]('/',auth[_0xc4b0('0xa')](),controller['index']);router[_0xc4b0('0x9')](_0xc4b0('0xb'),auth[_0xc4b0('0xa')](),controller[_0xc4b0('0xc')]);router['get'](_0xc4b0('0xd'),auth[_0xc4b0('0xa')](),controller[_0xc4b0('0xe')]);router[_0xc4b0('0xf')]('/',auth[_0xc4b0('0xa')](),controller[_0xc4b0('0x10')]);router[_0xc4b0('0x11')](_0xc4b0('0xd'),auth[_0xc4b0('0xa')](),controller[_0xc4b0('0x12')]);router[_0xc4b0('0x13')]('/:id',auth[_0xc4b0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7b9a=['./voiceDialReport.controller','get','isAuthenticated','index','describe','show','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x71faa0,_0x501f4c){var _0xc49174=function(_0x134e44){while(--_0x134e44){_0x71faa0['push'](_0x71faa0['shift']());}};_0xc49174(++_0x501f4c);}(_0x7b9a,0xfe));var _0xa7b9=function(_0x3e49cc,_0x8d13f8){_0x3e49cc=_0x3e49cc-0x0;var _0x6e7cee=_0x7b9a[_0x3e49cc];return _0x6e7cee;};'use strict';var multer=require(_0xa7b9('0x0'));var util=require(_0xa7b9('0x1'));var path=require(_0xa7b9('0x2'));var timeout=require(_0xa7b9('0x3'));var express=require(_0xa7b9('0x4'));var router=express[_0xa7b9('0x5')]();var fs_extra=require(_0xa7b9('0x6'));var auth=require(_0xa7b9('0x7'));var interaction=require(_0xa7b9('0x8'));var config=require(_0xa7b9('0x9'));var controller=require(_0xa7b9('0xa'));router[_0xa7b9('0xb')]('/',auth[_0xa7b9('0xc')](),controller[_0xa7b9('0xd')]);router['get']('/describe',auth[_0xa7b9('0xc')](),controller[_0xa7b9('0xe')]);router[_0xa7b9('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa7b9('0xf')]);router['post']('/',auth[_0xa7b9('0xc')](),controller[_0xa7b9('0x10')]);router[_0xa7b9('0x11')](_0xa7b9('0x12'),auth[_0xa7b9('0xc')](),controller['update']);router[_0xa7b9('0x13')]('/:id',auth[_0xa7b9('0xc')](),controller[_0xa7b9('0x14')]);module[_0xa7b9('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5e0d6e2..1efaa0d 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0xfbfc8a,_0x246828){var _0x53b041=function(_0x28f82a){while(--_0x28f82a){_0xfbfc8a['push'](_0xfbfc8a['shift']());}};_0x53b041(++_0x246828);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x44d6b8,_0xe7e065){var _0x18cbfa=function(_0x1704bc){while(--_0x1704bc){_0x44d6b8['push'](_0x44d6b8['shift']());}};_0x18cbfa(++_0xe7e065);}(_0x81bd,0x7c));var _0xd81b=function(_0xa0be1c,_0x152d5d){_0xa0be1c=_0xa0be1c-0x0;var _0x546eec=_0x81bd[_0xa0be1c];return _0x546eec;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5ba8dc8..09b34de 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 _0xff82=['mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','findAll','rows','catch','show','params','find','create','update','body','describe','eml-format','rimraf','bluebird'];(function(_0x38b255,_0x3fd343){var _0x26f9bb=function(_0x3ba901){while(--_0x3ba901){_0x38b255['push'](_0x38b255['shift']());}};_0x26f9bb(++_0x3fd343);}(_0xff82,0x1b3));var _0x2ff8=function(_0x9a49fe,_0x4da13a){_0x9a49fe=_0x9a49fe-0x0;var _0x465d3a=_0xff82[_0x9a49fe];return _0x465d3a;};'use strict';var emlformat=require(_0x2ff8('0x0'));var rimraf=require(_0x2ff8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ff8('0x2'));var Mustache=require(_0x2ff8('0x3'));var util=require(_0x2ff8('0x4'));var path=require(_0x2ff8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2ff8('0x6'));var fs=require('fs');var fs_extra=require(_0x2ff8('0x7'));var _=require(_0x2ff8('0x8'));var squel=require(_0x2ff8('0x9'));var crypto=require(_0x2ff8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ff8('0xb'));var querystring=require(_0x2ff8('0xc'));var Papa=require(_0x2ff8('0xd'));var Redis=require(_0x2ff8('0xe'));var authService=require(_0x2ff8('0xf'));var qs=require(_0x2ff8('0x10'));var as=require(_0x2ff8('0x11'));var hardwareService=require(_0x2ff8('0x12'));var logger=require(_0x2ff8('0x13'))('api');var utils=require(_0x2ff8('0x14'));var config=require(_0x2ff8('0x15'));var licenseUtil=require(_0x2ff8('0x16'));var db=require(_0x2ff8('0x17'))['db'];function respondWithStatusCode(_0x58fbfb,_0x58a0b9){_0x58a0b9=_0x58a0b9||0xcc;return function(_0x54afca){if(_0x54afca){return _0x58fbfb[_0x2ff8('0x18')](_0x58a0b9);}return _0x58fbfb[_0x2ff8('0x19')](_0x58a0b9)['end']();};}function respondWithResult(_0x123dd6,_0x4525fa){_0x4525fa=_0x4525fa||0xc8;return function(_0x4fa47b){if(_0x4fa47b){return _0x123dd6[_0x2ff8('0x19')](_0x4525fa)['json'](_0x4fa47b);}};}function respondWithFilteredResult(_0x52f4d7,_0x24fba5){return function(_0x2f56f0){if(_0x2f56f0){var _0x9f27f5=typeof _0x24fba5[_0x2ff8('0x1a')]===_0x2ff8('0x1b')&&typeof _0x24fba5[_0x2ff8('0x1c')]===_0x2ff8('0x1b');var _0x121dad=_0x2f56f0[_0x2ff8('0x1d')];var _0x4171ed=_0x9f27f5?0x0:_0x24fba5[_0x2ff8('0x1a')];var _0x1e9805=_0x9f27f5?_0x2f56f0[_0x2ff8('0x1d')]:_0x24fba5[_0x2ff8('0x1a')]+_0x24fba5[_0x2ff8('0x1c')];var _0x536e81;if(_0x1e9805>=_0x121dad){_0x1e9805=_0x121dad;_0x536e81=0xc8;}else{_0x536e81=0xce;}_0x52f4d7[_0x2ff8('0x19')](_0x536e81);return _0x52f4d7['set'](_0x2ff8('0x1e'),_0x4171ed+'-'+_0x1e9805+'/'+_0x121dad)['json'](_0x2f56f0);}return null;};}function patchUpdates(_0x16c37c){return function(_0x100c85){try{jsonpatch[_0x2ff8('0x1f')](_0x100c85,_0x16c37c,!![]);}catch(_0x44e2d0){return BPromise[_0x2ff8('0x20')](_0x44e2d0);}return _0x100c85[_0x2ff8('0x21')]();};}function saveUpdates(_0x525f45,_0x5d522f){return function(_0x295d51){if(_0x295d51){return _0x295d51['update'](_0x525f45)[_0x2ff8('0x22')](function(_0x19144d){return _0x19144d;});}return null;};}function removeEntity(_0x5a23d7,_0xfa4214){return function(_0x5dd402){if(_0x5dd402){return _0x5dd402[_0x2ff8('0x23')]()[_0x2ff8('0x22')](function(){_0x5a23d7[_0x2ff8('0x19')](0xcc)[_0x2ff8('0x24')]();});}};}function handleEntityNotFound(_0x3befb1,_0x1be541){return function(_0x5b2ce1){if(!_0x5b2ce1){_0x3befb1[_0x2ff8('0x18')](0x194);}return _0x5b2ce1;};}function handleError(_0x1051b4,_0xc19664){_0xc19664=_0xc19664||0x1f4;return function(_0x37f9db){logger[_0x2ff8('0x25')](_0x37f9db[_0x2ff8('0x26')]);if(_0x37f9db[_0x2ff8('0x27')]){delete _0x37f9db[_0x2ff8('0x27')];}_0x1051b4['status'](_0xc19664)['send'](_0x37f9db);};}exports['index']=function(_0x5bba77,_0x202214){var _0x236efa={},_0x57bc1b={},_0x400dfa={'count':0x0,'rows':[]};var _0x2786af=_['map'](db['VoiceDialReport'][_0x2ff8('0x28')],function(_0x2c35a1){return{'name':_0x2c35a1['fieldName'],'type':_0x2c35a1[_0x2ff8('0x29')][_0x2ff8('0x2a')]};});_0x57bc1b['model']=_[_0x2ff8('0x2b')](_0x2786af,_0x2ff8('0x27'));_0x57bc1b['query']=_[_0x2ff8('0x2c')](_0x5bba77[_0x2ff8('0x2d')]);_0x57bc1b[_0x2ff8('0x2e')]=_[_0x2ff8('0x2f')](_0x57bc1b[_0x2ff8('0x30')],_0x57bc1b[_0x2ff8('0x2d')]);_0x236efa[_0x2ff8('0x31')]=_[_0x2ff8('0x2f')](_0x57bc1b['model'],qs[_0x2ff8('0x32')](_0x5bba77[_0x2ff8('0x2d')][_0x2ff8('0x32')]));_0x236efa['attributes']=_0x236efa[_0x2ff8('0x31')][_0x2ff8('0x33')]?_0x236efa[_0x2ff8('0x31')]:_0x57bc1b[_0x2ff8('0x30')];if(!_0x5bba77[_0x2ff8('0x2d')][_0x2ff8('0x34')]('nolimit')){_0x236efa[_0x2ff8('0x1c')]=qs[_0x2ff8('0x1c')](_0x5bba77['query'][_0x2ff8('0x1c')]);_0x236efa[_0x2ff8('0x1a')]=qs[_0x2ff8('0x1a')](_0x5bba77[_0x2ff8('0x2d')][_0x2ff8('0x1a')]);}_0x236efa[_0x2ff8('0x35')]=qs['sort'](_0x5bba77[_0x2ff8('0x2d')][_0x2ff8('0x36')]);_0x236efa[_0x2ff8('0x37')]=qs[_0x2ff8('0x2e')](_[_0x2ff8('0x38')](_0x5bba77[_0x2ff8('0x2d')],_0x57bc1b[_0x2ff8('0x2e')]),_0x2786af);if(_0x5bba77[_0x2ff8('0x2d')][_0x2ff8('0x39')]){_0x236efa[_0x2ff8('0x37')]=_[_0x2ff8('0x3a')](_0x236efa['where'],{'$or':_[_0x2ff8('0x2b')](_0x2786af,function(_0x54a046){if(_0x54a046[_0x2ff8('0x29')]!==_0x2ff8('0x3b')){var _0x40245f={};_0x40245f[_0x54a046[_0x2ff8('0x27')]]={'$like':'%'+_0x5bba77['query'][_0x2ff8('0x39')]+'%'};return _0x40245f;}})});}_0x236efa=_[_0x2ff8('0x3a')]({},_0x236efa,_0x5bba77[_0x2ff8('0x3c')]);var _0x138d39={'where':_0x236efa[_0x2ff8('0x37')]};return db[_0x2ff8('0x3d')]['count'](_0x138d39)['then'](function(_0xa7d186){_0x400dfa['count']=_0xa7d186;if(_0x5bba77[_0x2ff8('0x2d')][_0x2ff8('0x3e')]){_0x236efa['include']=[{'all':!![]}];}return db[_0x2ff8('0x3d')][_0x2ff8('0x3f')](_0x236efa);})['then'](function(_0x342c7d){_0x400dfa[_0x2ff8('0x40')]=_0x342c7d;return _0x400dfa;})[_0x2ff8('0x22')](respondWithFilteredResult(_0x202214,_0x236efa))[_0x2ff8('0x41')](handleError(_0x202214,null));};exports[_0x2ff8('0x42')]=function(_0x4c65aa,_0x2061e0){var _0xfe483f={'raw':!![],'where':{'id':_0x4c65aa[_0x2ff8('0x43')]['id']}},_0x916c97={};_0x916c97[_0x2ff8('0x30')]=_[_0x2ff8('0x2c')](db['VoiceDialReport'][_0x2ff8('0x28')]);_0x916c97[_0x2ff8('0x2d')]=_['keys'](_0x4c65aa['query']);_0x916c97[_0x2ff8('0x2e')]=_['intersection'](_0x916c97[_0x2ff8('0x30')],_0x916c97[_0x2ff8('0x2d')]);_0xfe483f[_0x2ff8('0x31')]=_['intersection'](_0x916c97[_0x2ff8('0x30')],qs[_0x2ff8('0x32')](_0x4c65aa[_0x2ff8('0x2d')][_0x2ff8('0x32')]));_0xfe483f[_0x2ff8('0x31')]=_0xfe483f[_0x2ff8('0x31')][_0x2ff8('0x33')]?_0xfe483f[_0x2ff8('0x31')]:_0x916c97[_0x2ff8('0x30')];if(_0x4c65aa[_0x2ff8('0x2d')]['includeAll']){_0xfe483f['include']=[{'all':!![]}];}_0xfe483f=_[_0x2ff8('0x3a')]({},_0xfe483f,_0x4c65aa[_0x2ff8('0x3c')]);return db[_0x2ff8('0x3d')][_0x2ff8('0x44')](_0xfe483f)[_0x2ff8('0x22')](handleEntityNotFound(_0x2061e0,null))[_0x2ff8('0x22')](respondWithResult(_0x2061e0,null))[_0x2ff8('0x41')](handleError(_0x2061e0,null));};exports['create']=function(_0x4f0a5f,_0xd4f657){return db[_0x2ff8('0x3d')][_0x2ff8('0x45')](_0x4f0a5f['body'],{})[_0x2ff8('0x22')](respondWithResult(_0xd4f657,0xc9))['catch'](handleError(_0xd4f657,null));};exports[_0x2ff8('0x46')]=function(_0x1ef4ba,_0x459e66){if(_0x1ef4ba['body']['id']){delete _0x1ef4ba[_0x2ff8('0x47')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x1ef4ba[_0x2ff8('0x43')]['id']}})[_0x2ff8('0x22')](handleEntityNotFound(_0x459e66,null))[_0x2ff8('0x22')](saveUpdates(_0x1ef4ba['body'],null))[_0x2ff8('0x22')](respondWithResult(_0x459e66,null))[_0x2ff8('0x41')](handleError(_0x459e66,null));};exports['destroy']=function(_0x39d9de,_0x392809){return db[_0x2ff8('0x3d')][_0x2ff8('0x44')]({'where':{'id':_0x39d9de[_0x2ff8('0x43')]['id']}})[_0x2ff8('0x22')](handleEntityNotFound(_0x392809,null))['then'](removeEntity(_0x392809,null))['catch'](handleError(_0x392809,null));};exports['describe']=function(_0x363f87,_0x10f49c){return db['VoiceDialReport'][_0x2ff8('0x48')]()[_0x2ff8('0x22')](respondWithResult(_0x10f49c,null))[_0x2ff8('0x41')](handleError(_0x10f49c,null));}; \ No newline at end of file +var _0x5980=['name','index','map','VoiceDialReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','then','error'];(function(_0xe68115,_0x32c230){var _0x4091a3=function(_0x35513d){while(--_0x35513d){_0xe68115['push'](_0xe68115['shift']());}};_0x4091a3(++_0x32c230);}(_0x5980,0xf4));var _0x0598=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x5980[_0x484cac];return _0x1d6e77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0598('0x0'));var zipdir=require(_0x0598('0x1'));var jsonpatch=require(_0x0598('0x2'));var rp=require(_0x0598('0x3'));var moment=require(_0x0598('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0598('0x5'));var sox=require(_0x0598('0x6'));var csv=require(_0x0598('0x7'));var ejs=require(_0x0598('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0598('0x9'));var squel=require(_0x0598('0xa'));var crypto=require('crypto');var jsforce=require(_0x0598('0xb'));var deskjs=require(_0x0598('0xc'));var toCsv=require(_0x0598('0x7'));var querystring=require('querystring');var Papa=require(_0x0598('0xd'));var Redis=require(_0x0598('0xe'));var authService=require(_0x0598('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0598('0x10'))(_0x0598('0x11'));var utils=require(_0x0598('0x12'));var config=require(_0x0598('0x13'));var licenseUtil=require(_0x0598('0x14'));var db=require(_0x0598('0x15'))['db'];function respondWithStatusCode(_0x27527e,_0x106632){_0x106632=_0x106632||0xcc;return function(_0x6d9309){if(_0x6d9309){return _0x27527e[_0x0598('0x16')](_0x106632);}return _0x27527e['status'](_0x106632)['end']();};}function respondWithResult(_0x10b67f,_0x1a5cd0){_0x1a5cd0=_0x1a5cd0||0xc8;return function(_0x528d94){if(_0x528d94){return _0x10b67f[_0x0598('0x17')](_0x1a5cd0)[_0x0598('0x18')](_0x528d94);}};}function respondWithFilteredResult(_0x1f6e01,_0x215adf){return function(_0x377280){if(_0x377280){var _0x392f9a=typeof _0x215adf['offset']==='undefined'&&typeof _0x215adf[_0x0598('0x19')]===_0x0598('0x1a');var _0x34d814=_0x377280['count'];var _0x5bf480=_0x392f9a?0x0:_0x215adf['offset'];var _0x380791=_0x392f9a?_0x377280[_0x0598('0x1b')]:_0x215adf[_0x0598('0x1c')]+_0x215adf[_0x0598('0x19')];var _0x2af42e;if(_0x380791>=_0x34d814){_0x380791=_0x34d814;_0x2af42e=0xc8;}else{_0x2af42e=0xce;}_0x1f6e01['status'](_0x2af42e);return _0x1f6e01['set'](_0x0598('0x1d'),_0x5bf480+'-'+_0x380791+'/'+_0x34d814)[_0x0598('0x18')](_0x377280);}return null;};}function patchUpdates(_0x22de9f){return function(_0x5732a4){try{jsonpatch[_0x0598('0x1e')](_0x5732a4,_0x22de9f,!![]);}catch(_0x47c824){return BPromise[_0x0598('0x1f')](_0x47c824);}return _0x5732a4[_0x0598('0x20')]();};}function saveUpdates(_0x44f8c9,_0x52a908){return function(_0x23b1a0){if(_0x23b1a0){return _0x23b1a0['update'](_0x44f8c9)['then'](function(_0x1440c5){return _0x1440c5;});}return null;};}function removeEntity(_0x42f5ca,_0x11cb3b){return function(_0x2bc57f){if(_0x2bc57f){return _0x2bc57f[_0x0598('0x21')]()[_0x0598('0x22')](function(){_0x42f5ca[_0x0598('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e70a,_0x5a5e2f){return function(_0x32d7d0){if(!_0x32d7d0){_0x28e70a['sendStatus'](0x194);}return _0x32d7d0;};}function handleError(_0x2457a4,_0x2b9dee){_0x2b9dee=_0x2b9dee||0x1f4;return function(_0x5294f3){logger[_0x0598('0x23')](_0x5294f3['stack']);if(_0x5294f3[_0x0598('0x24')]){delete _0x5294f3[_0x0598('0x24')];}_0x2457a4[_0x0598('0x17')](_0x2b9dee)['send'](_0x5294f3);};}exports[_0x0598('0x25')]=function(_0x21185d,_0x195912){var _0x42de4f={},_0x6c93d4={},_0x24ad3d={'count':0x0,'rows':[]};var _0x6b5cc9=_[_0x0598('0x26')](db[_0x0598('0x27')]['rawAttributes'],function(_0x151ffe){return{'name':_0x151ffe[_0x0598('0x28')],'type':_0x151ffe[_0x0598('0x29')]['key']};});_0x6c93d4[_0x0598('0x2a')]=_[_0x0598('0x26')](_0x6b5cc9,_0x0598('0x24'));_0x6c93d4[_0x0598('0x2b')]=_[_0x0598('0x2c')](_0x21185d[_0x0598('0x2b')]);_0x6c93d4[_0x0598('0x2d')]=_[_0x0598('0x2e')](_0x6c93d4['model'],_0x6c93d4['query']);_0x42de4f['attributes']=_[_0x0598('0x2e')](_0x6c93d4[_0x0598('0x2a')],qs[_0x0598('0x2f')](_0x21185d[_0x0598('0x2b')]['fields']));_0x42de4f[_0x0598('0x30')]=_0x42de4f[_0x0598('0x30')][_0x0598('0x31')]?_0x42de4f[_0x0598('0x30')]:_0x6c93d4[_0x0598('0x2a')];if(!_0x21185d[_0x0598('0x2b')][_0x0598('0x32')](_0x0598('0x33'))){_0x42de4f['limit']=qs[_0x0598('0x19')](_0x21185d[_0x0598('0x2b')]['limit']);_0x42de4f[_0x0598('0x1c')]=qs[_0x0598('0x1c')](_0x21185d[_0x0598('0x2b')][_0x0598('0x1c')]);}_0x42de4f['order']=qs['sort'](_0x21185d[_0x0598('0x2b')][_0x0598('0x34')]);_0x42de4f['where']=qs[_0x0598('0x2d')](_[_0x0598('0x35')](_0x21185d[_0x0598('0x2b')],_0x6c93d4[_0x0598('0x2d')]),_0x6b5cc9);if(_0x21185d['query'][_0x0598('0x36')]){_0x42de4f['where']=_['merge'](_0x42de4f[_0x0598('0x37')],{'$or':_[_0x0598('0x26')](_0x6b5cc9,function(_0x3d5e75){if(_0x3d5e75[_0x0598('0x29')]!==_0x0598('0x38')){var _0xe8444c={};_0xe8444c[_0x3d5e75[_0x0598('0x24')]]={'$like':'%'+_0x21185d[_0x0598('0x2b')]['filter']+'%'};return _0xe8444c;}})});}_0x42de4f=_['merge']({},_0x42de4f,_0x21185d[_0x0598('0x39')]);var _0x54b355={'where':_0x42de4f[_0x0598('0x37')]};return db[_0x0598('0x27')]['count'](_0x54b355)[_0x0598('0x22')](function(_0x43411a){_0x24ad3d[_0x0598('0x1b')]=_0x43411a;if(_0x21185d[_0x0598('0x2b')][_0x0598('0x3a')]){_0x42de4f[_0x0598('0x3b')]=[{'all':!![]}];}return db[_0x0598('0x27')][_0x0598('0x3c')](_0x42de4f);})[_0x0598('0x22')](function(_0x253bd8){_0x24ad3d['rows']=_0x253bd8;return _0x24ad3d;})[_0x0598('0x22')](respondWithFilteredResult(_0x195912,_0x42de4f))[_0x0598('0x3d')](handleError(_0x195912,null));};exports[_0x0598('0x3e')]=function(_0x5cc3b9,_0x215eb6){var _0x2b443b={'raw':!![],'where':{'id':_0x5cc3b9[_0x0598('0x3f')]['id']}},_0x185ded={};_0x185ded[_0x0598('0x2a')]=_['keys'](db[_0x0598('0x27')][_0x0598('0x40')]);_0x185ded['query']=_[_0x0598('0x2c')](_0x5cc3b9['query']);_0x185ded[_0x0598('0x2d')]=_['intersection'](_0x185ded[_0x0598('0x2a')],_0x185ded[_0x0598('0x2b')]);_0x2b443b[_0x0598('0x30')]=_[_0x0598('0x2e')](_0x185ded[_0x0598('0x2a')],qs[_0x0598('0x2f')](_0x5cc3b9[_0x0598('0x2b')]['fields']));_0x2b443b['attributes']=_0x2b443b[_0x0598('0x30')][_0x0598('0x31')]?_0x2b443b[_0x0598('0x30')]:_0x185ded[_0x0598('0x2a')];if(_0x5cc3b9[_0x0598('0x2b')]['includeAll']){_0x2b443b['include']=[{'all':!![]}];}_0x2b443b=_[_0x0598('0x41')]({},_0x2b443b,_0x5cc3b9['options']);return db[_0x0598('0x27')][_0x0598('0x42')](_0x2b443b)[_0x0598('0x22')](handleEntityNotFound(_0x215eb6,null))['then'](respondWithResult(_0x215eb6,null))[_0x0598('0x3d')](handleError(_0x215eb6,null));};exports[_0x0598('0x43')]=function(_0x11eb50,_0x27df69){return db[_0x0598('0x27')][_0x0598('0x43')](_0x11eb50[_0x0598('0x44')],{})['then'](respondWithResult(_0x27df69,0xc9))[_0x0598('0x3d')](handleError(_0x27df69,null));};exports[_0x0598('0x45')]=function(_0xc9d010,_0x4a9861){if(_0xc9d010['body']['id']){delete _0xc9d010[_0x0598('0x44')]['id'];}return db[_0x0598('0x27')][_0x0598('0x42')]({'where':{'id':_0xc9d010[_0x0598('0x3f')]['id']}})[_0x0598('0x22')](handleEntityNotFound(_0x4a9861,null))[_0x0598('0x22')](saveUpdates(_0xc9d010['body'],null))[_0x0598('0x22')](respondWithResult(_0x4a9861,null))[_0x0598('0x3d')](handleError(_0x4a9861,null));};exports[_0x0598('0x21')]=function(_0x3dac72,_0x2de0f7){return db['VoiceDialReport'][_0x0598('0x42')]({'where':{'id':_0x3dac72['params']['id']}})[_0x0598('0x22')](handleEntityNotFound(_0x2de0f7,null))['then'](removeEntity(_0x2de0f7,null))['catch'](handleError(_0x2de0f7,null));};exports['describe']=function(_0x2724ac,_0x2d9793){return db[_0x0598('0x27')]['describe']()[_0x0598('0x22')](respondWithResult(_0x2d9793,null))[_0x0598('0x3d')](handleError(_0x2d9793,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e4bcad7..89bd2af 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 _0x95d9=['api','moment','request-promise','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger'];(function(_0x2f6566,_0x20bcff){var _0x443364=function(_0x56221b){while(--_0x56221b){_0x2f6566['push'](_0x2f6566['shift']());}};_0x443364(++_0x20bcff);}(_0x95d9,0x8d));var _0x995d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x95d9[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var logger=require(_0x995d('0x2'))(_0x995d('0x3'));var moment=require(_0x995d('0x4'));var BPromise=require('bluebird');var rp=require(_0x995d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x995d('0x6'));var attributes=require(_0x995d('0x7'));module[_0x995d('0x8')]=function(_0x24d3d3,_0x930047){return _0x24d3d3[_0x995d('0x9')](_0x995d('0xa'),attributes,{'tableName':_0x995d('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x50b9=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a60a6,_0x41fcd7){var _0x42c2f3=function(_0x57de4b){while(--_0x57de4b){_0x5a60a6['push'](_0x5a60a6['shift']());}};_0x42c2f3(++_0x41fcd7);}(_0x50b9,0x171));var _0x950b=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x50b9[_0xeff2c3];return _0x2cade6;};'use strict';var _=require(_0x950b('0x0'));var util=require('util');var logger=require(_0x950b('0x1'))('api');var moment=require(_0x950b('0x2'));var BPromise=require(_0x950b('0x3'));var rp=require(_0x950b('0x4'));var fs=require('fs');var path=require(_0x950b('0x5'));var rimraf=require(_0x950b('0x6'));var config=require(_0x950b('0x7'));var attributes=require(_0x950b('0x8'));module[_0x950b('0x9')]=function(_0xc9024,_0x56ce3f){return _0xc9024[_0x950b('0xa')](_0x950b('0xb'),attributes,{'tableName':_0x950b('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 874d049..338a4b1 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 _0xc78f=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','body','where','attributes'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0xc78f,0xa5));var _0xfc78=function(_0x407a51,_0x3c40f7){_0x407a51=_0x407a51-0x0;var _0x2e6a29=_0xc78f[_0x407a51];return _0x2e6a29;};'use strict';var _=require(_0xfc78('0x0'));var util=require(_0xfc78('0x1'));var moment=require('moment');var BPromise=require(_0xfc78('0x2'));var rs=require(_0xfc78('0x3'));var fs=require('fs');var Redis=require(_0xfc78('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc78('0x5'));var logger=require('../../config/logger')(_0xfc78('0x6'));var config=require(_0xfc78('0x7'));var jayson=require(_0xfc78('0x8'));var client=jayson[_0xfc78('0x9')][_0xfc78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x501027,_0x495585,_0x3c5ef0){return new BPromise(function(_0x2dbb4e,_0x15a2d6){return client['request'](_0x501027,_0x3c5ef0)[_0xfc78('0xb')](function(_0x57c2df){logger[_0xfc78('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x495585,_0xfc78('0xd'));logger[_0xfc78('0xe')](_0xfc78('0xf'),_0x495585,_0xfc78('0xd'),JSON[_0xfc78('0x10')](_0x57c2df));if(_0x57c2df['error']){if(_0x57c2df[_0xfc78('0x11')][_0xfc78('0x12')]===0x1f4){logger[_0xfc78('0x11')](_0xfc78('0x13'),_0x495585,_0x57c2df[_0xfc78('0x11')][_0xfc78('0x14')]);return _0x15a2d6(_0x57c2df[_0xfc78('0x11')][_0xfc78('0x14')]);}logger[_0xfc78('0x11')](_0xfc78('0x13'),_0x495585,_0x57c2df[_0xfc78('0x11')][_0xfc78('0x14')]);return _0x2dbb4e(_0x57c2df[_0xfc78('0x11')][_0xfc78('0x14')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x495585,'request\x20sent');_0x2dbb4e(_0x57c2df[_0xfc78('0x15')][_0xfc78('0x14')]);}})[_0xfc78('0x16')](function(_0x136cd0){logger[_0xfc78('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x495585,_0x136cd0);_0x15a2d6(_0x136cd0);});});}exports[_0xfc78('0x17')]=function(_0x4bdebe){var _0x1ae095=this;return new Promise(function(_0x118887,_0x4f1649){return db['VoiceDialReport'][_0xfc78('0x18')](_0x4bdebe['body'],{'raw':_0x4bdebe[_0xfc78('0x19')]?_0x4bdebe['options'][_0xfc78('0x1a')]===undefined?!![]:![]:!![]})[_0xfc78('0xb')](function(_0x5c95d9){logger['info'](_0xfc78('0x17'),_0x4bdebe);logger['debug'](_0xfc78('0x17'),_0x4bdebe,JSON['stringify'](_0x5c95d9));_0x118887(_0x5c95d9);})[_0xfc78('0x16')](function(_0x32ea41){logger[_0xfc78('0x11')]('CreateVoiceDialReport',_0x32ea41['message'],_0x4bdebe);_0x4f1649(_0x1ae095[_0xfc78('0x11')](0x1f4,_0x32ea41[_0xfc78('0x14')]));});});};exports[_0xfc78('0x1b')]=function(_0x4c7f0c){var _0x12fe92=this;return new Promise(function(_0xeea615,_0xe02d33){return db[_0xfc78('0x1c')][_0xfc78('0x1d')](_0x4c7f0c[_0xfc78('0x1e')],{'raw':_0x4c7f0c['options']?_0x4c7f0c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7f0c[_0xfc78('0x19')]?_0x4c7f0c['options'][_0xfc78('0x1f')]||null:null,'attributes':_0x4c7f0c[_0xfc78('0x19')]?_0x4c7f0c[_0xfc78('0x19')][_0xfc78('0x20')]||null:null,'limit':_0x4c7f0c[_0xfc78('0x19')]?_0x4c7f0c[_0xfc78('0x19')]['limit']||null:null})[_0xfc78('0xb')](function(_0x3d5b06){logger[_0xfc78('0xc')]('UpdateVoiceDialReport',_0x4c7f0c);logger[_0xfc78('0xe')](_0xfc78('0x1b'),_0x4c7f0c,JSON[_0xfc78('0x10')](_0x3d5b06));_0xeea615(_0x3d5b06);})[_0xfc78('0x16')](function(_0x1dcf50){logger[_0xfc78('0x11')](_0xfc78('0x1b'),_0x1dcf50[_0xfc78('0x14')],_0x4c7f0c);_0xe02d33(_0x12fe92[_0xfc78('0x11')](0x1f4,_0x1dcf50[_0xfc78('0x14')]));});});}; \ No newline at end of file +var _0xc310=['code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','debug','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0xc310,0xef));var _0x0c31=function(_0x325f43,_0x3ced5a){_0x325f43=_0x325f43-0x0;var _0x5b811f=_0xc310[_0x325f43];return _0x5b811f;};'use strict';var _=require(_0x0c31('0x0'));var util=require(_0x0c31('0x1'));var moment=require(_0x0c31('0x2'));var BPromise=require(_0x0c31('0x3'));var rs=require(_0x0c31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c31('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c31('0x6'))(_0x0c31('0x7'));var config=require(_0x0c31('0x8'));var jayson=require(_0x0c31('0x9'));var client=jayson[_0x0c31('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9026,_0x472cab,_0x35e2ee){return new BPromise(function(_0x8db28,_0x504ad6){return client[_0x0c31('0xb')](_0x3b9026,_0x35e2ee)['then'](function(_0x2b62ce){logger[_0x0c31('0xc')](_0x0c31('0xd'),_0x472cab,'request\x20sent');logger['debug'](_0x0c31('0xe'),_0x472cab,'request\x20sent',JSON[_0x0c31('0xf')](_0x2b62ce));if(_0x2b62ce[_0x0c31('0x10')]){if(_0x2b62ce[_0x0c31('0x10')][_0x0c31('0x11')]===0x1f4){logger[_0x0c31('0x10')](_0x0c31('0xd'),_0x472cab,_0x2b62ce[_0x0c31('0x10')]['message']);return _0x504ad6(_0x2b62ce[_0x0c31('0x10')][_0x0c31('0x12')]);}logger[_0x0c31('0x10')](_0x0c31('0xd'),_0x472cab,_0x2b62ce[_0x0c31('0x10')][_0x0c31('0x12')]);return _0x8db28(_0x2b62ce['error']['message']);}else{logger[_0x0c31('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x472cab,'request\x20sent');_0x8db28(_0x2b62ce[_0x0c31('0x13')][_0x0c31('0x12')]);}})[_0x0c31('0x14')](function(_0x378607){logger[_0x0c31('0x10')](_0x0c31('0xd'),_0x472cab,_0x378607);_0x504ad6(_0x378607);});});}exports[_0x0c31('0x15')]=function(_0x493446){var _0x3f03da=this;return new Promise(function(_0x14288f,_0x49ebf2){return db[_0x0c31('0x16')][_0x0c31('0x17')](_0x493446[_0x0c31('0x18')],{'raw':_0x493446['options']?_0x493446[_0x0c31('0x19')][_0x0c31('0x1a')]===undefined?!![]:![]:!![]})[_0x0c31('0x1b')](function(_0x3e2163){logger[_0x0c31('0xc')](_0x0c31('0x15'),_0x493446);logger[_0x0c31('0x1c')](_0x0c31('0x15'),_0x493446,JSON[_0x0c31('0xf')](_0x3e2163));_0x14288f(_0x3e2163);})['catch'](function(_0x1cc169){logger['error']('CreateVoiceDialReport',_0x1cc169[_0x0c31('0x12')],_0x493446);_0x49ebf2(_0x3f03da[_0x0c31('0x10')](0x1f4,_0x1cc169[_0x0c31('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x51cc05){var _0x34f484=this;return new Promise(function(_0x5ce573,_0xaa3338){return db['VoiceDialReport']['update'](_0x51cc05[_0x0c31('0x18')],{'raw':_0x51cc05[_0x0c31('0x19')]?_0x51cc05['options'][_0x0c31('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51cc05[_0x0c31('0x19')]?_0x51cc05[_0x0c31('0x19')]['where']||null:null,'attributes':_0x51cc05[_0x0c31('0x19')]?_0x51cc05[_0x0c31('0x19')][_0x0c31('0x1d')]||null:null,'limit':_0x51cc05[_0x0c31('0x19')]?_0x51cc05[_0x0c31('0x19')][_0x0c31('0x1e')]||null:null})[_0x0c31('0x1b')](function(_0x522293){logger[_0x0c31('0xc')](_0x0c31('0x1f'),_0x51cc05);logger['debug'](_0x0c31('0x1f'),_0x51cc05,JSON[_0x0c31('0xf')](_0x522293));_0x5ce573(_0x522293);})[_0x0c31('0x14')](function(_0x1de0ad){logger['error'](_0x0c31('0x1f'),_0x1de0ad['message'],_0x51cc05);_0xaa3338(_0x34f484[_0x0c31('0x10')](0x1f4,_0x1de0ad[_0x0c31('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 688e216..3705209 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 _0x7a5b=['/:id/applications','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','index','isAuthenticated','post'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x7a5b,0x170));var _0xb7a5=function(_0x363dbc,_0x3a4dcb){_0x363dbc=_0x363dbc-0x0;var _0x53c1c0=_0x7a5b[_0x363dbc];return _0x53c1c0;};'use strict';var multer=require(_0xb7a5('0x0'));var util=require(_0xb7a5('0x1'));var path=require('path');var timeout=require(_0xb7a5('0x2'));var express=require(_0xb7a5('0x3'));var router=express['Router']();var fs_extra=require(_0xb7a5('0x4'));var auth=require(_0xb7a5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb7a5('0x6'));var controller=require(_0xb7a5('0x7'));router[_0xb7a5('0x8')]('/',auth['isAuthenticated'](),controller[_0xb7a5('0x9')]);router['get']('/:id',auth[_0xb7a5('0xa')](),controller['show']);router[_0xb7a5('0xb')]('/',auth[_0xb7a5('0xa')](),controller['create']);router['post'](_0xb7a5('0xc'),auth[_0xb7a5('0xa')](),controller['addApplications']);router[_0xb7a5('0xd')](_0xb7a5('0xe'),auth[_0xb7a5('0xa')](),controller[_0xb7a5('0xf')]);router[_0xb7a5('0x10')](_0xb7a5('0xe'),auth[_0xb7a5('0xa')](),controller[_0xb7a5('0x11')]);module[_0xb7a5('0x12')]=router; \ No newline at end of file +var _0xfe1f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','create','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x373e51,_0x456a6a){var _0x3fcc68=function(_0x334d5a){while(--_0x334d5a){_0x373e51['push'](_0x373e51['shift']());}};_0x3fcc68(++_0x456a6a);}(_0xfe1f,0x7f));var _0xffe1=function(_0x5e34a4,_0x2e63ed){_0x5e34a4=_0x5e34a4-0x0;var _0x8d41d7=_0xfe1f[_0x5e34a4];return _0x8d41d7;};'use strict';var multer=require(_0xffe1('0x0'));var util=require(_0xffe1('0x1'));var path=require(_0xffe1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffe1('0x3')]();var fs_extra=require(_0xffe1('0x4'));var auth=require(_0xffe1('0x5'));var interaction=require(_0xffe1('0x6'));var config=require(_0xffe1('0x7'));var controller=require(_0xffe1('0x8'));router[_0xffe1('0x9')]('/',auth[_0xffe1('0xa')](),controller[_0xffe1('0xb')]);router[_0xffe1('0x9')](_0xffe1('0xc'),auth[_0xffe1('0xa')](),controller['show']);router['post']('/',auth[_0xffe1('0xa')](),controller[_0xffe1('0xd')]);router[_0xffe1('0xe')](_0xffe1('0xf'),auth[_0xffe1('0xa')](),controller[_0xffe1('0x10')]);router[_0xffe1('0x11')](_0xffe1('0xc'),auth['isAuthenticated'](),controller[_0xffe1('0x12')]);router[_0xffe1('0x13')](_0xffe1('0xc'),auth[_0xffe1('0xa')](),controller[_0xffe1('0x14')]);module[_0xffe1('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 0b138b5..4d00972 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 _0x35c0=['compositeIndex','NoOp','outbound','internal','inbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING'];(function(_0x1e8925,_0x38c94c){var _0x55d8e1=function(_0x32d1d0){while(--_0x32d1d0){_0x1e8925['push'](_0x1e8925['shift']());}};_0x55d8e1(++_0x38c94c);}(_0x35c0,0xcf));var _0x035c=function(_0x102376,_0x16c6a2){_0x102376=_0x102376-0x0;var _0x29bc9c=_0x35c0[_0x102376];return _0x29bc9c;};'use strict';var Sequelize=require(_0x035c('0x0'));module[_0x035c('0x1')]={'context':{'type':Sequelize[_0x035c('0x2')],'allowNull':![],'unique':_0x035c('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x035c('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x035c('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x035c('0x2')],'allowNull':![],'defaultValue':_0x035c('0x4')},'appdata':{'type':Sequelize[_0x035c('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x035c('0x5'),_0x035c('0x6'),_0x035c('0x7'),'outbound-fax','system',_0x035c('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x035c('0x2')],'allowNull':![],'defaultValue':_0x035c('0x9')},'IntervalId':{'type':Sequelize[_0x035c('0xa')]},'isApp':{'type':Sequelize[_0x035c('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x035c('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x035c('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x035c('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x035c('0xa')]},'recordingFormat':{'type':Sequelize[_0x035c('0x2')],'defaultValue':_0x035c('0xc')},'answer':{'type':Sequelize[_0x035c('0xb')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2d7924){return this[_0x035c('0xd')](_0x035c('0xe'));}},'alias':{'type':Sequelize[_0x035c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x04be=['INTEGER','BOOLEAN','wav','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','*,*,*,*'];(function(_0x25b15d,_0x3ffa5c){var _0x3f2dcc=function(_0x3ba26a){while(--_0x3ba26a){_0x25b15d['push'](_0x25b15d['shift']());}};_0x3f2dcc(++_0x3ffa5c);}(_0x04be,0x66));var _0xe04b=function(_0x55e95d,_0x73f423){_0x55e95d=_0x55e95d-0x0;var _0x5895cf=_0x04be[_0x55e95d];return _0x5895cf;};'use strict';var Sequelize=require(_0xe04b('0x0'));module[_0xe04b('0x1')]={'context':{'type':Sequelize[_0xe04b('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe04b('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xe04b('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xe04b('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe04b('0x2')],'allowNull':![],'defaultValue':_0xe04b('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe04b('0x5')](_0xe04b('0x6'),_0xe04b('0x7'),_0xe04b('0x8'),'inbound-fax','outbound-fax','system','any'),'allowNull':![]},'description':{'type':Sequelize[_0xe04b('0x2')]},'interval':{'type':Sequelize[_0xe04b('0x2')],'allowNull':![],'defaultValue':_0xe04b('0x9')},'IntervalId':{'type':Sequelize[_0xe04b('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe04b('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xe04b('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe04b('0xa')]},'recordingFormat':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':_0xe04b('0xc')},'answer':{'type':Sequelize[_0xe04b('0xb')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1eb380){return this[_0xe04b('0xd')]('exten');}},'alias':{'type':Sequelize[_0xe04b('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0407a54..8850e6b 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 _0x29f5=['addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','value','includes','find','type','name','UserProfileResource','sendStatus','send','index','map','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','body','startsWith','exten','create','user','role','OutboundRoutes','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','alias','context'];(function(_0x504d47,_0x5e604b){var _0x55cba4=function(_0xb7e707){while(--_0xb7e707){_0x504d47['push'](_0x504d47['shift']());}};_0x55cba4(++_0x5e604b);}(_0x29f5,0x1e4));var _0x529f=function(_0x5a4d35,_0x8170b9){_0x5a4d35=_0x5a4d35-0x0;var _0x2aac0f=_0x29f5[_0x5a4d35];return _0x2aac0f;};'use strict';var _=require('lodash');var Redis=require(_0x529f('0x0'));var qs=require(_0x529f('0x1'));var logger=require(_0x529f('0x2'))(_0x529f('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x529f('0x4')]=_[_0x529f('0x5')](config[_0x529f('0x4')],{'host':_0x529f('0x6'),'port':0x18eb});var socket=require(_0x529f('0x7'))(new Redis(config[_0x529f('0x4')]));require(_0x529f('0x8'))[_0x529f('0x9')](socket);function respondWithStatusCode(_0x5e5550,_0x4f3f28){_0x4f3f28=_0x4f3f28||0xcc;return function(_0x542d88){if(_0x542d88){return _0x5e5550['sendStatus'](_0x4f3f28);}return _0x5e5550[_0x529f('0xa')](_0x4f3f28)[_0x529f('0xb')]();};}function respondWithResult(_0x591b5c,_0x2ed557){_0x2ed557=_0x2ed557||0xc8;return function(_0x1416d0){if(_0x1416d0){return _0x591b5c['status'](_0x2ed557)['json'](_0x1416d0);}};}function respondWithFilteredResult(_0x15d99e,_0x54bf5f){return function(_0x433af2){if(_0x433af2){var _0x1c035e=typeof _0x54bf5f[_0x529f('0xc')]==='undefined'&&typeof _0x54bf5f[_0x529f('0xd')]===_0x529f('0xe');var _0x126c75=_0x433af2[_0x529f('0xf')];var _0x44bc0c=_0x1c035e?0x0:_0x54bf5f['offset'];var _0x41c7de=_0x1c035e?_0x433af2[_0x529f('0xf')]:_0x54bf5f[_0x529f('0xc')]+_0x54bf5f[_0x529f('0xd')];var _0x3eea59;if(_0x41c7de>=_0x126c75){_0x41c7de=_0x126c75;_0x3eea59=0xc8;}else{_0x3eea59=0xce;}_0x15d99e[_0x529f('0xa')](_0x3eea59);return _0x15d99e[_0x529f('0x10')](_0x529f('0x11'),_0x44bc0c+'-'+_0x41c7de+'/'+_0x126c75)[_0x529f('0x12')](_0x433af2);}return null;};}function removeEntity(_0x47d31f){return function(_0x4532da){if(_0x4532da){return _0x4532da[_0x529f('0x13')]()[_0x529f('0x14')](function(){var _0x48af83=_0x4532da[_0x529f('0x15')]({'plain':!![]});var _0x586803=[{'name':_0x529f('0x16'),'value':_0x529f('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0x529f('0x18'),'ignore':![]},{'name':_0x529f('0x19'),'value':_0x529f('0x1a'),'ignore':![]}];var _0x574922=_(_0x586803)[_0x529f('0x1b')](_0x529f('0x1c'))['map']('value')[_0x529f('0x1d')]();if(_[_0x529f('0x1e')](_0x574922,_0x48af83['type'])){return;}var _0x579420=_[_0x529f('0x1f')](_0x586803,[_0x529f('0x1d'),_0x48af83[_0x529f('0x20')]])[_0x529f('0x21')];return db[_0x529f('0x22')]['destroy']({'where':{'type':_0x579420,'resourceId':_0x48af83['id']}})['then'](function(){return _0x4532da;});})[_0x529f('0x14')](function(){_0x47d31f[_0x529f('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccec0){return function(_0x3b2349){if(!_0x3b2349){_0x2ccec0[_0x529f('0x23')](0x194);}return _0x3b2349;};}function handleError(_0x2814b7,_0x3dc361){_0x3dc361=_0x3dc361||0x1f4;return function(_0x2e755c){logger['error'](_0x2e755c['stack']);if(_0x2e755c[_0x529f('0x21')]){delete _0x2e755c[_0x529f('0x21')];}_0x2814b7[_0x529f('0xa')](_0x3dc361)[_0x529f('0x24')](_0x2e755c);};}exports[_0x529f('0x25')]=function(_0x415511,_0xad809a){var _0x4ae02a={},_0x3337b3={},_0x1f2617={'count':0x0,'rows':[]};var _0x12569a=_[_0x529f('0x26')](db[_0x529f('0x27')]['rawAttributes'],function(_0x2c6d07){return{'name':_0x2c6d07[_0x529f('0x28')],'type':_0x2c6d07[_0x529f('0x20')][_0x529f('0x29')]};});_0x3337b3[_0x529f('0x2a')]=_['map'](_0x12569a,_0x529f('0x21'));_0x3337b3[_0x529f('0x2b')]=_[_0x529f('0x2c')](_0x415511[_0x529f('0x2b')]);_0x3337b3[_0x529f('0x2d')]=_[_0x529f('0x2e')](_0x3337b3[_0x529f('0x2a')],_0x3337b3[_0x529f('0x2b')]);_0x4ae02a[_0x529f('0x2f')]=_[_0x529f('0x2e')](_0x3337b3[_0x529f('0x2a')],qs[_0x529f('0x30')](_0x415511[_0x529f('0x2b')]['fields']));_0x4ae02a[_0x529f('0x2f')]=_0x4ae02a[_0x529f('0x2f')][_0x529f('0x31')]?_0x4ae02a['attributes']:_0x3337b3[_0x529f('0x2a')];if(!_0x415511[_0x529f('0x2b')][_0x529f('0x32')]('nolimit')){_0x4ae02a[_0x529f('0xd')]=qs[_0x529f('0xd')](_0x415511['query'][_0x529f('0xd')]);_0x4ae02a[_0x529f('0xc')]=qs[_0x529f('0xc')](_0x415511[_0x529f('0x2b')][_0x529f('0xc')]);}_0x4ae02a[_0x529f('0x33')]=qs[_0x529f('0x34')](_0x415511[_0x529f('0x2b')][_0x529f('0x34')]);_0x4ae02a[_0x529f('0x35')]=qs[_0x529f('0x2d')](_['pick'](_0x415511[_0x529f('0x2b')],_0x3337b3[_0x529f('0x2d')]),_0x12569a);if(_0x415511[_0x529f('0x2b')]['filter']){_0x4ae02a[_0x529f('0x35')]=_[_0x529f('0x36')](_0x4ae02a[_0x529f('0x35')],{'$or':_[_0x529f('0x26')](_0x12569a,function(_0x526baf){if(_0x526baf[_0x529f('0x20')]!==_0x529f('0x37')){var _0x5a8d4f={};_0x5a8d4f[_0x526baf[_0x529f('0x21')]]={'$like':'%'+_0x415511[_0x529f('0x2b')][_0x529f('0x1b')]+'%'};return _0x5a8d4f;}})});}_0x4ae02a=_['merge']({},_0x4ae02a,_0x415511[_0x529f('0x38')]);var _0xc21b7f={'where':_0x4ae02a[_0x529f('0x35')]};return db[_0x529f('0x27')][_0x529f('0xf')](_0xc21b7f)['then'](function(_0x51e383){_0x1f2617[_0x529f('0xf')]=_0x51e383;if(_0x415511[_0x529f('0x2b')][_0x529f('0x39')]){_0x4ae02a['include']=[{'all':!![]}];}return db[_0x529f('0x27')]['findAll'](_0x4ae02a);})[_0x529f('0x14')](function(_0x50ad5e){_0x1f2617[_0x529f('0x3a')]=_0x50ad5e;return _0x1f2617;})['then'](respondWithFilteredResult(_0xad809a,_0x4ae02a))[_0x529f('0x3b')](handleError(_0xad809a,null));};exports[_0x529f('0x3c')]=function(_0x4356ec,_0x29ae7a){var _0x1d7f6e={'raw':![],'where':{'id':_0x4356ec[_0x529f('0x3d')]['id']}},_0x425fe5={};_0x425fe5[_0x529f('0x2a')]=_[_0x529f('0x2c')](db[_0x529f('0x27')]['rawAttributes']);_0x425fe5['query']=_['keys'](_0x4356ec[_0x529f('0x2b')]);_0x425fe5[_0x529f('0x2d')]=_[_0x529f('0x2e')](_0x425fe5['model'],_0x425fe5['query']);_0x1d7f6e[_0x529f('0x2f')]=_[_0x529f('0x2e')](_0x425fe5[_0x529f('0x2a')],qs[_0x529f('0x30')](_0x4356ec[_0x529f('0x2b')][_0x529f('0x30')]));_0x1d7f6e[_0x529f('0x2f')]=_0x1d7f6e['attributes'][_0x529f('0x31')]?_0x1d7f6e[_0x529f('0x2f')]:_0x425fe5[_0x529f('0x2a')];if(_0x4356ec[_0x529f('0x2b')][_0x529f('0x39')]){_0x1d7f6e[_0x529f('0x3e')]=[{'all':!![]}];}_0x1d7f6e=_[_0x529f('0x36')]({},_0x1d7f6e,_0x4356ec[_0x529f('0x38')]);return db[_0x529f('0x27')][_0x529f('0x1f')](_0x1d7f6e)['then'](handleEntityNotFound(_0x29ae7a,null))[_0x529f('0x14')](respondWithResult(_0x29ae7a,null))[_0x529f('0x3b')](handleError(_0x29ae7a,null));};exports[_0x529f('0x13')]=function(_0x2e1d86,_0x3b7aa7){return db['VoiceExtension'][_0x529f('0x1f')]({'where':{'id':_0x2e1d86[_0x529f('0x3d')]['id']}})[_0x529f('0x14')](handleEntityNotFound(_0x3b7aa7,null))[_0x529f('0x14')](removeEntity(_0x3b7aa7,null))[_0x529f('0x3b')](handleError(_0x3b7aa7,null));};exports['create']=function(_0x5ee488,_0x3f4570){if(_0x5ee488[_0x529f('0x3f')][_0x529f('0x20')]===_0x529f('0x18')&&!_[_0x529f('0x40')](_0x5ee488[_0x529f('0x3f')]['exten'],'_')){_0x5ee488['body'][_0x529f('0x41')]='_'['concat'](_0x5ee488[_0x529f('0x3f')][_0x529f('0x41')]);}return db['VoiceExtension'][_0x529f('0x42')](_0x5ee488[_0x529f('0x3f')],{'raw':![]})[_0x529f('0x14')](function(_0x37d353){var _0x108edc=_0x5ee488[_0x529f('0x43')]['get']({'plain':!![]});if(!_0x108edc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x108edc[_0x529f('0x44')]===_0x529f('0x43')){var _0x1e122e=_0x37d353[_0x529f('0x15')]({'plain':!![]});var _0x22aa83=[{'name':_0x529f('0x16'),'value':'inbound'},{'name':_0x529f('0x45'),'value':_0x529f('0x18')},{'name':_0x529f('0x19'),'value':_0x529f('0x1a')}];var _0x1bc866=_[_0x529f('0x1f')](_0x22aa83,[_0x529f('0x1d'),_0x1e122e[_0x529f('0x20')]])[_0x529f('0x21')];return db[_0x529f('0x46')][_0x529f('0x1f')]({'where':{'name':_0x1bc866,'userProfileId':_0x108edc['userProfileId']},'raw':!![]})[_0x529f('0x14')](function(_0x32f0f9){if(_0x32f0f9&&_0x32f0f9[_0x529f('0x47')]===0x0){return db['UserProfileResource'][_0x529f('0x42')]({'name':_0x1e122e['name'],'resourceId':_0x1e122e['id'],'type':_0x32f0f9['name'],'sectionId':_0x32f0f9['id']},{})[_0x529f('0x14')](function(){return _0x37d353;});}else{return _0x37d353;}})['catch'](function(_0xb64eff){logger[_0x529f('0x48')](_0x529f('0x49'),_0xb64eff);throw _0xb64eff;});}return _0x37d353;})[_0x529f('0x14')](respondWithResult(_0x3f4570,0xc9))[_0x529f('0x3b')](handleError(_0x3f4570,null));};exports[_0x529f('0x4a')]=function(_0x972bf6,_0xabfa47){if(_0x972bf6[_0x529f('0x3f')]['id']){delete _0x972bf6[_0x529f('0x3f')]['id'];}return db[_0x529f('0x27')][_0x529f('0x1f')]({'where':{'id':_0x972bf6[_0x529f('0x3d')]['id']}})['then'](handleEntityNotFound(_0xabfa47,null))['then'](function(_0x5947b7){if(_0x5947b7){return db[_0x529f('0x27')][_0x529f('0x4a')](_['pick'](_0x972bf6[_0x529f('0x3f')],['exten','context','description',_0x529f('0x4b'),_0x529f('0x4c'),_0x529f('0x4d'),_0x529f('0x4e')]),{'where':{'context':_0x5947b7[_0x529f('0x4f')],'exten':_0x5947b7[_0x529f('0x41')]},'individualHooks':!![]})[_0x529f('0x14')](function(_0x15b86c){return _0x15b86c;});}return null;})['then'](respondWithStatusCode(_0xabfa47,null))['catch'](handleError(_0xabfa47,null));};exports[_0x529f('0x50')]=function(_0x5f511a,_0x6bef9f){var _0x491f8c=_0x5f511a[_0x529f('0x3d')]['id'];var _0xb08ba6=_0x5f511a[_0x529f('0x3f')];var _0x107d38=0xc8;var _0x1264ec=null;return db[_0x529f('0x51')][_0x529f('0x52')]({'isolationLevel':db[_0x529f('0x51')][_0x529f('0x53')][_0x529f('0x54')][_0x529f('0x55')]},function(_0x5d6d25){return db[_0x529f('0x27')][_0x529f('0x56')]({'where':{'id':_0x491f8c},'transaction':_0x5d6d25})[_0x529f('0x14')](function(_0x4271b9){if(_0x4271b9){return db['VoiceExtension'][_0x529f('0x13')]({'where':{'VoiceExtensionId':_0x491f8c},'transaction':_0x5d6d25})[_0x529f('0x14')](function(){var _0x9cf7f0=_['map'](_0xb08ba6,function(_0x2913e1){_0x2913e1[_0x529f('0x57')]=_0x491f8c;_0x2913e1['isApp']=!![];return _0x2913e1;});return _0x4271b9[_0x529f('0x58')](_0x9cf7f0);})[_0x529f('0x14')](function(_0x3d13c0){return db[_0x529f('0x27')][_0x529f('0x59')](_0x3d13c0,{'transaction':_0x5d6d25});});}else{_0x107d38=0x194;_0x1264ec=[];}});})[_0x529f('0x14')](function(){if(_0x107d38!==0x194){return db['VoiceExtension'][_0x529f('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x491f8c},'order':_0x529f('0x5b')})[_0x529f('0x14')](function(_0x5e4789){_0x1264ec=_0x5e4789;});}})[_0x529f('0x3b')](function(_0x536650){_0x107d38=0x1f4;logger['error'](_0x536650[_0x529f('0x5c')]);if(_0x536650[_0x529f('0x21')]){delete _0x536650[_0x529f('0x21')];}_0x1264ec=_0x536650;})[_0x529f('0x5d')](function(){if(_0x1264ec===null){_0x6bef9f['sendStatus'](_0x107d38);}else{if(_0x107d38===0x1f4){_0x6bef9f[_0x529f('0xa')](_0x107d38)[_0x529f('0x24')](_0x1264ec);}else{_0x6bef9f[_0x529f('0xa')](_0x107d38)[_0x529f('0x12')](_0x1264ec);}}});}; \ No newline at end of file +var _0x8871=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','includeAll','catch','show','params','include','options','find','create','body','startsWith','exten','concat','user','role','internal','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','send','lodash','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','VoiceExtension','rawAttributes','fieldName','query'];(function(_0x27f3e4,_0x12bdc1){var _0x33f1de=function(_0x3c55a8){while(--_0x3c55a8){_0x27f3e4['push'](_0x27f3e4['shift']());}};_0x33f1de(++_0x12bdc1);}(_0x8871,0x1ed));var _0x1887=function(_0x226494,_0xc4b645){_0x226494=_0x226494-0x0;var _0x27b950=_0x8871[_0x226494];return _0x27b950;};'use strict';var _=require(_0x1887('0x0'));var Redis=require('ioredis');var qs=require(_0x1887('0x1'));var logger=require('../../config/logger')(_0x1887('0x2'));var config=require('../../config/environment');var db=require(_0x1887('0x3'))['db'];config[_0x1887('0x4')]=_[_0x1887('0x5')](config[_0x1887('0x4')],{'host':_0x1887('0x6'),'port':0x18eb});var socket=require(_0x1887('0x7'))(new Redis(config['redis']));require(_0x1887('0x8'))[_0x1887('0x9')](socket);function respondWithStatusCode(_0x3e1541,_0x51c472){_0x51c472=_0x51c472||0xcc;return function(_0x465b95){if(_0x465b95){return _0x3e1541[_0x1887('0xa')](_0x51c472);}return _0x3e1541['status'](_0x51c472)[_0x1887('0xb')]();};}function respondWithResult(_0x120079,_0x86b07b){_0x86b07b=_0x86b07b||0xc8;return function(_0xab6811){if(_0xab6811){return _0x120079[_0x1887('0xc')](_0x86b07b)[_0x1887('0xd')](_0xab6811);}};}function respondWithFilteredResult(_0x28261d,_0x1c82a2){return function(_0x12e254){if(_0x12e254){var _0x2ba13d=typeof _0x1c82a2[_0x1887('0xe')]===_0x1887('0xf')&&typeof _0x1c82a2['limit']===_0x1887('0xf');var _0x3e9c13=_0x12e254[_0x1887('0x10')];var _0x12d410=_0x2ba13d?0x0:_0x1c82a2[_0x1887('0xe')];var _0x1c9f7e=_0x2ba13d?_0x12e254[_0x1887('0x10')]:_0x1c82a2['offset']+_0x1c82a2[_0x1887('0x11')];var _0x1498e7;if(_0x1c9f7e>=_0x3e9c13){_0x1c9f7e=_0x3e9c13;_0x1498e7=0xc8;}else{_0x1498e7=0xce;}_0x28261d[_0x1887('0xc')](_0x1498e7);return _0x28261d[_0x1887('0x12')](_0x1887('0x13'),_0x12d410+'-'+_0x1c9f7e+'/'+_0x3e9c13)['json'](_0x12e254);}return null;};}function removeEntity(_0x3d989d){return function(_0x18f3fa){if(_0x18f3fa){return _0x18f3fa[_0x1887('0x14')]()[_0x1887('0x15')](function(){var _0x46cc55=_0x18f3fa[_0x1887('0x16')]({'plain':!![]});var _0x3351ed=[{'name':_0x1887('0x17'),'value':_0x1887('0x18'),'ignore':![]},{'name':_0x1887('0x19'),'value':'outbound','ignore':![]},{'name':_0x1887('0x1a'),'value':'internal','ignore':![]}];var _0xcffb42=_(_0x3351ed)[_0x1887('0x1b')](_0x1887('0x1c'))[_0x1887('0x1d')](_0x1887('0x1e'))[_0x1887('0x1e')]();if(_[_0x1887('0x1f')](_0xcffb42,_0x46cc55[_0x1887('0x20')])){return;}var _0x458064=_['find'](_0x3351ed,[_0x1887('0x1e'),_0x46cc55[_0x1887('0x20')]])['name'];return db[_0x1887('0x21')][_0x1887('0x14')]({'where':{'type':_0x458064,'resourceId':_0x46cc55['id']}})['then'](function(){return _0x18f3fa;});})[_0x1887('0x15')](function(){_0x3d989d[_0x1887('0xc')](0xcc)[_0x1887('0xb')]();});}};}function handleEntityNotFound(_0x2a860f){return function(_0x23343a){if(!_0x23343a){_0x2a860f['sendStatus'](0x194);}return _0x23343a;};}function handleError(_0x20e2c1,_0x2f2902){_0x2f2902=_0x2f2902||0x1f4;return function(_0x4ccbf9){logger[_0x1887('0x22')](_0x4ccbf9[_0x1887('0x23')]);if(_0x4ccbf9[_0x1887('0x24')]){delete _0x4ccbf9[_0x1887('0x24')];}_0x20e2c1['status'](_0x2f2902)['send'](_0x4ccbf9);};}exports['index']=function(_0x4b23fd,_0x47deb0){var _0x12f52e={},_0x13a316={},_0x22042c={'count':0x0,'rows':[]};var _0x7bc970=_[_0x1887('0x1d')](db[_0x1887('0x25')][_0x1887('0x26')],function(_0x2e0871){return{'name':_0x2e0871[_0x1887('0x27')],'type':_0x2e0871['type']['key']};});_0x13a316['model']=_[_0x1887('0x1d')](_0x7bc970,_0x1887('0x24'));_0x13a316[_0x1887('0x28')]=_[_0x1887('0x29')](_0x4b23fd[_0x1887('0x28')]);_0x13a316[_0x1887('0x2a')]=_[_0x1887('0x2b')](_0x13a316[_0x1887('0x2c')],_0x13a316['query']);_0x12f52e['attributes']=_['intersection'](_0x13a316['model'],qs[_0x1887('0x2d')](_0x4b23fd[_0x1887('0x28')][_0x1887('0x2d')]));_0x12f52e[_0x1887('0x2e')]=_0x12f52e[_0x1887('0x2e')][_0x1887('0x2f')]?_0x12f52e[_0x1887('0x2e')]:_0x13a316[_0x1887('0x2c')];if(!_0x4b23fd[_0x1887('0x28')][_0x1887('0x30')]('nolimit')){_0x12f52e[_0x1887('0x11')]=qs[_0x1887('0x11')](_0x4b23fd['query'][_0x1887('0x11')]);_0x12f52e[_0x1887('0xe')]=qs[_0x1887('0xe')](_0x4b23fd[_0x1887('0x28')][_0x1887('0xe')]);}_0x12f52e['order']=qs[_0x1887('0x31')](_0x4b23fd[_0x1887('0x28')][_0x1887('0x31')]);_0x12f52e[_0x1887('0x32')]=qs['filters'](_[_0x1887('0x33')](_0x4b23fd['query'],_0x13a316[_0x1887('0x2a')]),_0x7bc970);if(_0x4b23fd[_0x1887('0x28')][_0x1887('0x1b')]){_0x12f52e['where']=_[_0x1887('0x34')](_0x12f52e[_0x1887('0x32')],{'$or':_[_0x1887('0x1d')](_0x7bc970,function(_0x4364c3){if(_0x4364c3[_0x1887('0x20')]!==_0x1887('0x35')){var _0x1e863a={};_0x1e863a[_0x4364c3['name']]={'$like':'%'+_0x4b23fd[_0x1887('0x28')]['filter']+'%'};return _0x1e863a;}})});}_0x12f52e=_[_0x1887('0x34')]({},_0x12f52e,_0x4b23fd['options']);var _0x4b8b12={'where':_0x12f52e[_0x1887('0x32')]};return db[_0x1887('0x25')][_0x1887('0x10')](_0x4b8b12)[_0x1887('0x15')](function(_0x33c3f2){_0x22042c['count']=_0x33c3f2;if(_0x4b23fd[_0x1887('0x28')][_0x1887('0x36')]){_0x12f52e['include']=[{'all':!![]}];}return db[_0x1887('0x25')]['findAll'](_0x12f52e);})[_0x1887('0x15')](function(_0x247167){_0x22042c['rows']=_0x247167;return _0x22042c;})[_0x1887('0x15')](respondWithFilteredResult(_0x47deb0,_0x12f52e))[_0x1887('0x37')](handleError(_0x47deb0,null));};exports[_0x1887('0x38')]=function(_0xa33489,_0x3a6062){var _0x5eb3f5={'raw':![],'where':{'id':_0xa33489[_0x1887('0x39')]['id']}},_0x3da43e={};_0x3da43e['model']=_['keys'](db['VoiceExtension'][_0x1887('0x26')]);_0x3da43e[_0x1887('0x28')]=_['keys'](_0xa33489[_0x1887('0x28')]);_0x3da43e['filters']=_[_0x1887('0x2b')](_0x3da43e['model'],_0x3da43e['query']);_0x5eb3f5[_0x1887('0x2e')]=_[_0x1887('0x2b')](_0x3da43e[_0x1887('0x2c')],qs[_0x1887('0x2d')](_0xa33489[_0x1887('0x28')]['fields']));_0x5eb3f5[_0x1887('0x2e')]=_0x5eb3f5[_0x1887('0x2e')][_0x1887('0x2f')]?_0x5eb3f5[_0x1887('0x2e')]:_0x3da43e[_0x1887('0x2c')];if(_0xa33489[_0x1887('0x28')][_0x1887('0x36')]){_0x5eb3f5[_0x1887('0x3a')]=[{'all':!![]}];}_0x5eb3f5=_[_0x1887('0x34')]({},_0x5eb3f5,_0xa33489[_0x1887('0x3b')]);return db[_0x1887('0x25')][_0x1887('0x3c')](_0x5eb3f5)[_0x1887('0x15')](handleEntityNotFound(_0x3a6062,null))[_0x1887('0x15')](respondWithResult(_0x3a6062,null))[_0x1887('0x37')](handleError(_0x3a6062,null));};exports[_0x1887('0x14')]=function(_0x361124,_0x4e0581){return db[_0x1887('0x25')][_0x1887('0x3c')]({'where':{'id':_0x361124['params']['id']}})[_0x1887('0x15')](handleEntityNotFound(_0x4e0581,null))[_0x1887('0x15')](removeEntity(_0x4e0581,null))[_0x1887('0x37')](handleError(_0x4e0581,null));};exports[_0x1887('0x3d')]=function(_0x5a0b4c,_0x131665){if(_0x5a0b4c[_0x1887('0x3e')][_0x1887('0x20')]==='outbound'&&!_[_0x1887('0x3f')](_0x5a0b4c[_0x1887('0x3e')][_0x1887('0x40')],'_')){_0x5a0b4c[_0x1887('0x3e')]['exten']='_'[_0x1887('0x41')](_0x5a0b4c[_0x1887('0x3e')][_0x1887('0x40')]);}return db['VoiceExtension'][_0x1887('0x3d')](_0x5a0b4c[_0x1887('0x3e')],{'raw':![]})[_0x1887('0x15')](function(_0x5d146c){var _0x145fa1=_0x5a0b4c[_0x1887('0x42')][_0x1887('0x16')]({'plain':!![]});if(!_0x145fa1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145fa1[_0x1887('0x43')]==='user'){var _0x111555=_0x5d146c[_0x1887('0x16')]({'plain':!![]});var _0x3da504=[{'name':_0x1887('0x17'),'value':_0x1887('0x18')},{'name':_0x1887('0x19'),'value':'outbound'},{'name':_0x1887('0x1a'),'value':_0x1887('0x44')}];var _0x310abb=_['find'](_0x3da504,[_0x1887('0x1e'),_0x111555[_0x1887('0x20')]])[_0x1887('0x24')];return db[_0x1887('0x45')][_0x1887('0x3c')]({'where':{'name':_0x310abb,'userProfileId':_0x145fa1['userProfileId']},'raw':!![]})[_0x1887('0x15')](function(_0x1efc03){if(_0x1efc03&&_0x1efc03['autoAssociation']===0x0){return db[_0x1887('0x21')][_0x1887('0x3d')]({'name':_0x111555[_0x1887('0x24')],'resourceId':_0x111555['id'],'type':_0x1efc03[_0x1887('0x24')],'sectionId':_0x1efc03['id']},{})[_0x1887('0x15')](function(){return _0x5d146c;});}else{return _0x5d146c;}})[_0x1887('0x37')](function(_0x29db0a){logger[_0x1887('0x22')](_0x1887('0x46'),_0x29db0a);throw _0x29db0a;});}return _0x5d146c;})['then'](respondWithResult(_0x131665,0xc9))[_0x1887('0x37')](handleError(_0x131665,null));};exports[_0x1887('0x47')]=function(_0x25d0eb,_0x3b9bd6){if(_0x25d0eb[_0x1887('0x3e')]['id']){delete _0x25d0eb[_0x1887('0x3e')]['id'];}return db[_0x1887('0x25')][_0x1887('0x3c')]({'where':{'id':_0x25d0eb[_0x1887('0x39')]['id']}})['then'](handleEntityNotFound(_0x3b9bd6,null))[_0x1887('0x15')](function(_0x3f49b4){if(_0x3f49b4){return db[_0x1887('0x25')][_0x1887('0x47')](_[_0x1887('0x33')](_0x25d0eb['body'],[_0x1887('0x40'),_0x1887('0x48'),_0x1887('0x49'),'recordingFormat','cutdigits',_0x1887('0x4a'),_0x1887('0x4b')]),{'where':{'context':_0x3f49b4[_0x1887('0x48')],'exten':_0x3f49b4['exten']},'individualHooks':!![]})[_0x1887('0x15')](function(_0x1c97f7){return _0x1c97f7;});}return null;})[_0x1887('0x15')](respondWithStatusCode(_0x3b9bd6,null))[_0x1887('0x37')](handleError(_0x3b9bd6,null));};exports[_0x1887('0x4c')]=function(_0x4f6b6e,_0x46e469){var _0x3d3f16=_0x4f6b6e[_0x1887('0x39')]['id'];var _0x4bf2c0=_0x4f6b6e[_0x1887('0x3e')];var _0x43cc52=0xc8;var _0x45234d=null;return db[_0x1887('0x4d')][_0x1887('0x4e')]({'isolationLevel':db[_0x1887('0x4d')][_0x1887('0x4f')][_0x1887('0x50')][_0x1887('0x51')]},function(_0x3959d6){return db[_0x1887('0x25')][_0x1887('0x52')]({'where':{'id':_0x3d3f16},'transaction':_0x3959d6})[_0x1887('0x15')](function(_0x131c3b){if(_0x131c3b){return db['VoiceExtension'][_0x1887('0x14')]({'where':{'VoiceExtensionId':_0x3d3f16},'transaction':_0x3959d6})[_0x1887('0x15')](function(){var _0x5bba64=_[_0x1887('0x1d')](_0x4bf2c0,function(_0x35283d){_0x35283d[_0x1887('0x53')]=_0x3d3f16;_0x35283d[_0x1887('0x54')]=!![];return _0x35283d;});return _0x131c3b[_0x1887('0x55')](_0x5bba64);})['then'](function(_0x17a6d6){return db[_0x1887('0x25')][_0x1887('0x56')](_0x17a6d6,{'transaction':_0x3959d6});});}else{_0x43cc52=0x194;_0x45234d=[];}});})[_0x1887('0x15')](function(){if(_0x43cc52!==0x194){return db[_0x1887('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x3d3f16},'order':_0x1887('0x57')})[_0x1887('0x15')](function(_0x3f6a27){_0x45234d=_0x3f6a27;});}})['catch'](function(_0x4afbd4){_0x43cc52=0x1f4;logger[_0x1887('0x22')](_0x4afbd4[_0x1887('0x23')]);if(_0x4afbd4['name']){delete _0x4afbd4['name'];}_0x45234d=_0x4afbd4;})['finally'](function(){if(_0x45234d===null){_0x46e469[_0x1887('0xa')](_0x43cc52);}else{if(_0x43cc52===0x1f4){_0x46e469[_0x1887('0xc')](_0x43cc52)[_0x1887('0x58')](_0x45234d);}else{_0x46e469[_0x1887('0xc')](_0x43cc52)[_0x1887('0xd')](_0x45234d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9f0e154..967b0db 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 _0x2c7a=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x2c7a,0x1ca));var _0xa2c7=function(_0x103ecb,_0xede77){_0x103ecb=_0x103ecb-0x0;var _0x55db1c=_0x2c7a[_0x103ecb];return _0x55db1c;};'use strict';var EventEmitter=require(_0xa2c7('0x0'));var VoiceExtension=require(_0xa2c7('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa2c7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa2c7('0x3'),'afterDestroy':_0xa2c7('0x4')};function emitEvent(_0x15cc22){return function(_0x3c7d92,_0x480ba2,_0x498a1e){VoiceExtensionEvents[_0xa2c7('0x5')](_0x15cc22+':'+_0x3c7d92['id'],_0x3c7d92);VoiceExtensionEvents[_0xa2c7('0x5')](_0x15cc22,_0x3c7d92);_0x498a1e(null);};}for(var e in events){if(events[_0xa2c7('0x6')](e)){var event=events[e];VoiceExtension[_0xa2c7('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xf23a=['hasOwnProperty','hook','exports','VoiceExtension','update','remove','emit'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xf23a,0x65));var _0xaf23=function(_0x2cb582,_0x1b01dc){_0x2cb582=_0x2cb582-0x0;var _0x40b1dd=_0xf23a[_0x2cb582];return _0x40b1dd;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xaf23('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf23('0x1'),'afterDestroy':_0xaf23('0x2')};function emitEvent(_0x321dc4){return function(_0x269e61,_0x3c9b89,_0x425745){VoiceExtensionEvents[_0xaf23('0x3')](_0x321dc4+':'+_0x269e61['id'],_0x269e61);VoiceExtensionEvents[_0xaf23('0x3')](_0x321dc4,_0x269e61);_0x425745(null);};}for(var e in events){if(events[_0xaf23('0x4')](e)){var event=events[e];VoiceExtension[_0xaf23('0x5')](e,emitEvent(event));}}module[_0xaf23('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 03e5e27..df7b3f3 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 _0x2297=['replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','playback','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','outboundDial','appdata','priority','concat','last','catch','get','Hangup','lodash','./voiceExtension.attributes','type','Set','CDR(type)=','context','exten','alias','NoOp','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','name','prefix','phone','param','trunk','join','options','indexOf','U(xcally-mixmonitor-context)'];(function(_0x594bb6,_0x42b8d5){var _0x11704e=function(_0x3df997){while(--_0x3df997){_0x594bb6['push'](_0x594bb6['shift']());}};_0x11704e(++_0x42b8d5);}(_0x2297,0x100));var _0x7229=function(_0x1a7bb6,_0x392cf0){_0x1a7bb6=_0x1a7bb6-0x0;var _0x1e6dde=_0x2297[_0x1a7bb6];return _0x1e6dde;};'use strict';var _=require(_0x7229('0x0'));var attributes=require(_0x7229('0x1'));module['exports']=function(_0x236599){var _0x2a9636=_0x236599['models'];function _0x13b011(_0xeea970){var _0x18c8b5=0x2;var _0xfd6912=[{'type':_0xeea970[_0x7229('0x2')],'app':_0x7229('0x3'),'appdata':_0x7229('0x4')+_0xeea970[_0x7229('0x2')],'context':_0xeea970[_0x7229('0x5')],'exten':_0xeea970[_0x7229('0x6')],'priority':_0x18c8b5++,'VoiceExtensionId':_0xeea970['id']},{'type':_0xeea970[_0x7229('0x2')],'app':_0xeea970[_0x7229('0x7')]?_0x7229('0x3'):_0x7229('0x8'),'appdata':_0xeea970[_0x7229('0x7')]?'CDR(routeAlias)='+_0xeea970[_0x7229('0x7')]:'No\x20alias\x20set','context':_0xeea970[_0x7229('0x5')],'exten':_0xeea970[_0x7229('0x6')],'priority':_0x18c8b5++,'VoiceExtensionId':_0xeea970['id']}];if(_0xeea970['type']===_0x7229('0x9')){_0xfd6912[_0x7229('0xa')]({'type':_0x7229('0x9'),'app':_0x7229('0x3'),'appdata':'CDR(routeid)='+_0xeea970['id'],'context':_0xeea970['context'],'exten':_0xeea970[_0x7229('0x6')],'priority':_0x18c8b5++,'VoiceExtensionId':_0xeea970['id']});}_0xfd6912[_0x7229('0xa')]({'type':_0xeea970[_0x7229('0x2')],'app':_0x7229('0x3'),'appdata':_0x7229('0xb'),'context':_0xeea970[_0x7229('0x5')],'exten':_0xeea970['exten'],'priority':_0x18c8b5++,'VoiceExtensionId':_0xeea970['id']},{'type':_0xeea970[_0x7229('0x2')],'app':_0x7229('0x3'),'appdata':_0x7229('0xc'),'context':_0xeea970['context'],'exten':_0xeea970[_0x7229('0x6')],'priority':_0x18c8b5++,'VoiceExtensionId':_0xeea970['id']},{'type':_0xeea970[_0x7229('0x2')],'app':_0x7229('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0xeea970[_0x7229('0x5')],'exten':_0xeea970[_0x7229('0x6')],'priority':_0x18c8b5++,'VoiceExtensionId':_0xeea970['id']});return _0xfd6912;}function _0x561d6e(_0x3590b2){var _0x503a2b=0x2;var _0x4c61f6=[{'type':_0x7229('0xd'),'app':_0x7229('0x3'),'appdata':_0x7229('0xe'),'context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':'outbound','app':_0x3590b2[_0x7229('0x7')]?_0x7229('0x3'):_0x7229('0x8'),'appdata':_0x3590b2[_0x7229('0x7')]?'CDR(routeAlias)='+_0x3590b2[_0x7229('0x7')]:'No\x20alias\x20set','context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':'Set','appdata':_0x7229('0xf')+(_0x3590b2[_0x7229('0x10')]?_0x7229('0x11')+_0x3590b2[_0x7229('0x10')]+'}':_0x7229('0x12')),'context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':_0x7229('0x3'),'appdata':'CDR(routeid)='+_0x3590b2['id'],'context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':_0x7229('0x13'),'appdata':_0x7229('0x14')+(_0x503a2b+0x2)+_0x7229('0x15')+(_0x503a2b+0x1)+')','context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2['exten'],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':'Set','appdata':_0x3590b2['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x3590b2[_0x7229('0x10')]+'}':'CDR(prefix)=noprefix','context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':'outbound','app':'Set','appdata':_0x7229('0xb'),'context':_0x3590b2['context'],'exten':_0x3590b2['exten'],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':_0x7229('0x3'),'appdata':_0x7229('0xc'),'context':_0x3590b2['context'],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':_0x7229('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':'Set','appdata':_0x7229('0x16')+_0x3590b2['id'],'context':_0x3590b2['context'],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']}];if(_0x3590b2['hasOwnProperty']('recordingFormat')&&_0x3590b2[_0x7229('0x17')]!==_0x7229('0x18')){_0x4c61f6[_0x7229('0xa')]({'type':_0x7229('0xd'),'app':_0x7229('0x3'),'appdata':_0x7229('0x19'),'context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2['exten'],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']},{'type':_0x7229('0xd'),'app':_0x7229('0x3'),'appdata':_0x7229('0x1a')+_0x3590b2[_0x7229('0x17')]||_0x7229('0x1b'),'context':_0x3590b2[_0x7229('0x5')],'exten':_0x3590b2[_0x7229('0x6')],'priority':_0x503a2b++,'VoiceExtensionId':_0x3590b2['id']});}return _0x4c61f6;}function _0x1617a3(_0x3bc89b,_0x565f6c){var _0x1e675a=[{'name':'trunk','param':0x0},{'name':_0x7229('0x1c'),'param':0x1},{'name':'options','param':0x2},{'name':_0x7229('0x1d'),'param':0x3}];var _0x248563={};var _0x1b4f61=_0x565f6c[_0x7229('0x1e')](',');var _0x495e61=[];for(var _0x3feab2=0x0;_0x3feab2<_0x1e675a['length'];_0x3feab2++){switch(_0x1e675a[_0x3feab2][_0x7229('0x1f')]){case'trunk':_0x248563['trunk']=_0x1b4f61[_0x1e675a[_0x3feab2]['param']][_0x7229('0x1e')]('/')[0x1];_0x248563['phone']=_0x1b4f61[_0x1e675a[_0x3feab2]['param']][_0x7229('0x1e')]('/')[0x2];_0x248563[_0x7229('0x20')]=_0x248563[_0x7229('0x21')]?_0x248563[_0x7229('0x21')][_0x7229('0x1e')]('$')[0x0]:undefined;_0x248563[_0x7229('0x21')]=_0x3bc89b[_0x7229('0x10')]?(_0x248563[_0x7229('0x20')]||'')+_0x7229('0x11')+_0x3bc89b[_0x7229('0x10')]+'}':(_0x248563[_0x7229('0x20')]||'')+'${EXTEN}';_0x495e61[_0x1e675a[_0x3feab2][_0x7229('0x22')]]=['SIP',_0x248563[_0x7229('0x23')],_0x248563[_0x7229('0x21')]][_0x7229('0x24')]('/');break;case _0x7229('0x25'):_0x248563[_0x7229('0x25')]=_0x1b4f61[_0x1e675a[_0x3feab2][_0x7229('0x22')]];if(_0x3bc89b['recordingFormat']!=='none'){if(_0x248563[_0x7229('0x25')][_0x7229('0x26')](_0x7229('0x27'))<0x0){_0x248563['options']+=_0x7229('0x27');}}else{_0x248563[_0x7229('0x25')]=_0x248563[_0x7229('0x25')][_0x7229('0x28')](_0x7229('0x27'),'');}_0x495e61[_0x1e675a[_0x3feab2]['param']]=_0x248563[_0x7229('0x25')];break;default:_0x495e61[_0x1e675a[_0x3feab2][_0x7229('0x22')]]=_0x1b4f61[_0x1e675a[_0x3feab2][_0x7229('0x22')]];}}return _0x495e61[_0x7229('0x24')](',');}function _0x32fa17(_0x2ed927,_0x5654c5,_0x32923a){return new Promise(function(_0x15587c,_0x180831){var _0x21f29f=[];if(_[_0x7229('0x29')](_0x5654c5))return _0x15587c(_0x21f29f);_0x2a9636[_0x7229('0x2a')][_0x7229('0x2b')]({'attributes':['id',_0x7229('0x2c'),'IntervalId'],'raw':!![]})[_0x7229('0x2d')](function(_0x387b73){for(var _0x281896=0x0,_0x4eb717=0x0;_0x281896<_0x5654c5['length'];_0x281896++,_0x4eb717=0x0){var _0xddfe0e=_0x5654c5[_0x281896];var _0x45930e=[];var _0x31a015=[];delete _0xddfe0e['id'];if(_0xddfe0e['interval']!==_0x7229('0x2e')){_0xddfe0e[_0x7229('0x2f')]=[_0xddfe0e[_0x7229('0x2c')]];}else{_0xddfe0e[_0x7229('0x2f')]=_0xddfe0e[_0x7229('0x30')]?_['map'](_[_0x7229('0x31')](_0x387b73,{'IntervalId':_0xddfe0e['IntervalId']}),_0x7229('0x2c')):[];}_0xddfe0e[_0x7229('0x5')]=_0x2ed927[_0x7229('0x5')];_0xddfe0e[_0x7229('0x6')]=_0x2ed927[_0x7229('0x6')];if(_0xddfe0e[_0x7229('0x2')])_0xddfe0e['type']=_0xddfe0e[_0x7229('0x2')]['toLowerCase']();if(_0x2ed927[_0x7229('0x2')]===_0x7229('0xd')){if(_0xddfe0e[_0x7229('0x32')](_0x7229('0x33'))&&_0xddfe0e['tag']&&_0xddfe0e[_0x7229('0x33')]!=='--'){_0x45930e[_0x7229('0xa')]({'type':_0xddfe0e[_0x7229('0x2')][_0x7229('0x34')](),'app':_0x7229('0x3'),'appdata':_0x7229('0x35')+_0xddfe0e[_0x7229('0x33')],'context':_0x2ed927[_0x7229('0x5')],'exten':_0x2ed927[_0x7229('0x6')],'priority':_0xddfe0e[_0x7229('0x2f')][_0x7229('0x36')]+_0x32923a+_0x4eb717++,'VoiceExtensionId':_0x2ed927['id']});}_0x45930e[_0x7229('0xa')]({'type':_0xddfe0e[_0x7229('0x2')]['toLowerCase'](),'app':_0x7229('0x13'),'appdata':_0x7229('0x37')+(_0xddfe0e[_0x7229('0x38')]?_0x7229('0x39')+_0xddfe0e['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x2ed927[_0x7229('0x5')],'exten':_0x2ed927[_0x7229('0x6')],'priority':_0xddfe0e[_0x7229('0x2f')]['length']+_0x32923a+_0x4eb717++,'VoiceExtensionId':_0x2ed927['id']});}else{if(_0xddfe0e[_0x7229('0x32')]('answer')){if(['queue',_0x7229('0x3a')]['includes'](_0xddfe0e['app']['toLowerCase']())&&_0xddfe0e[_0x7229('0x3b')]!=='custom'){if(_0xddfe0e[_0x7229('0x3c')]){_0x45930e[_0x7229('0xa')]({'type':_0xddfe0e[_0x7229('0x2')]['toLowerCase'](),'app':_0x7229('0x13'),'appdata':_0x7229('0x3d'),'context':_0x2ed927['context'],'exten':_0x2ed927[_0x7229('0x6')],'priority':_0xddfe0e[_0x7229('0x2f')][_0x7229('0x36')]+_0x32923a+_0x4eb717++,'VoiceExtensionId':_0x2ed927['id']});_0x45930e[_0x7229('0xa')]({'type':_0xddfe0e['type'][_0x7229('0x34')](),'app':_0x7229('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2ed927[_0x7229('0x5')],'exten':_0x2ed927[_0x7229('0x6')],'priority':_0xddfe0e['intervals'][_0x7229('0x36')]+_0x32923a+_0x4eb717++,'VoiceExtensionId':_0x2ed927['id']});}else{_0x45930e[_0x7229('0xa')]({'type':_0xddfe0e[_0x7229('0x2')][_0x7229('0x34')](),'app':'ExecIf','appdata':_0x7229('0x3e'),'context':_0x2ed927[_0x7229('0x5')],'exten':_0x2ed927[_0x7229('0x6')],'priority':_0xddfe0e['intervals']['length']+_0x32923a+_0x4eb717++,'VoiceExtensionId':_0x2ed927['id']});_0x45930e[_0x7229('0xa')]({'type':_0xddfe0e['type']['toLowerCase'](),'app':'Set','appdata':_0x7229('0x3f'),'context':_0x2ed927['context'],'exten':_0x2ed927[_0x7229('0x6')],'priority':_0xddfe0e[_0x7229('0x2f')][_0x7229('0x36')]+_0x32923a+_0x4eb717++,'VoiceExtensionId':_0x2ed927['id']});}}}}for(var _0x509493=0x0;_0x509493<_0xddfe0e[_0x7229('0x2f')]['length'];_0x509493++){var _0x2b0756=_0x32923a+_0xddfe0e[_0x7229('0x2f')][_0x7229('0x36')];var _0x22728e=_0x509493===_0xddfe0e[_0x7229('0x2f')][_0x7229('0x36')]-0x1?_0x32923a+_0x45930e[_0x7229('0x36')]+_0x31a015[_0x7229('0x36')]+0x2:_0x32923a+_0x509493+0x1;_0x45930e[_0x7229('0x40')](_0x509493,0x0,{'type':_0x2ed927[_0x7229('0x2')],'app':_0x7229('0x41'),'appdata':_0xddfe0e[_0x7229('0x2f')][_0x509493]+'?'+_0x2ed927[_0x7229('0x5')]+',${EXTEN},'+_0x2b0756+':'+_0x2ed927[_0x7229('0x5')]+',${EXTEN},'+_0x22728e,'exten':_0x2ed927[_0x7229('0x6')],'context':_0x2ed927['context'],'priority':_0x32923a+_0x509493,'VoiceExtensionId':_0x2ed927['id']});}if(_0xddfe0e[_0x7229('0x3b')]===_0x7229('0x42'))_0xddfe0e[_0x7229('0x43')]=_0x1617a3(_0x2ed927,_0xddfe0e[_0x7229('0x43')]);_0xddfe0e[_0x7229('0x44')]=_0x45930e['length']?_['last'](_0x45930e)[_0x7229('0x44')]+0x1:_0x32923a;_0x21f29f=_[_0x7229('0x45')](_0x21f29f,_0x45930e,[_0xddfe0e],_0x31a015);_0x32923a=_[_0x7229('0x46')](_0x21f29f)[_0x7229('0x44')]+0x1;}return _0x15587c(_0x21f29f);})[_0x7229('0x47')](function(_0x178e0d){_0x180831(_0x178e0d);});});}return _0x236599['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1d0c1b){var _0x245ea4=this[_0x7229('0x48')]({'plain':!![]});var _0xc1b75f=_0x245ea4[_0x7229('0x2')]==='outbound'?_0x561d6e(_0x245ea4):_0x13b011(_0x245ea4);return _0x32fa17(_0x245ea4,_0x1d0c1b,_[_0x7229('0x46')](_0xc1b75f)['priority']+0x1)[_0x7229('0x2d')](function(_0x8e69f2){var _0xac2726=_['concat'](_0xc1b75f,_0x8e69f2);_0xac2726[_0x7229('0xa')]({'type':_0x245ea4[_0x7229('0x2')],'app':_0x7229('0x49'),'exten':_0x245ea4[_0x7229('0x6')],'context':_0x245ea4[_0x7229('0x5')],'priority':_['last'](_0xac2726)[_0x7229('0x44')]+0x1,'VoiceExtensionId':_0x245ea4['id']});return _0xac2726;});}}});}; \ No newline at end of file +var _0x89b8=['indexOf','U(xcally-mixmonitor-context)','replace','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','hasOwnProperty','tag','callerID','Set(CALLERID(all)=','answer','queue','playback','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','push','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','url','length','trunk','param','split','phone','prefix','${EXTEN:','${EXTEN}','join','options'];(function(_0x4439e6,_0x1fc2a4){var _0x1145cd=function(_0x3cbb92){while(--_0x3cbb92){_0x4439e6['push'](_0x4439e6['shift']());}};_0x1145cd(++_0x1fc2a4);}(_0x89b8,0x19f));var _0x889b=function(_0x4ec986,_0x3b43af){_0x4ec986=_0x4ec986-0x0;var _0x348aad=_0x89b8[_0x4ec986];return _0x348aad;};'use strict';var _=require(_0x889b('0x0'));var attributes=require(_0x889b('0x1'));module[_0x889b('0x2')]=function(_0x93a75a){var _0x15a14a=_0x93a75a[_0x889b('0x3')];function _0x52a1f8(_0x383d3c){var _0x1d4725=0x2;var _0x3db972=[{'type':_0x383d3c['type'],'app':_0x889b('0x4'),'appdata':_0x889b('0x5')+_0x383d3c[_0x889b('0x6')],'context':_0x383d3c['context'],'exten':_0x383d3c[_0x889b('0x7')],'priority':_0x1d4725++,'VoiceExtensionId':_0x383d3c['id']},{'type':_0x383d3c[_0x889b('0x6')],'app':_0x383d3c[_0x889b('0x8')]?_0x889b('0x4'):_0x889b('0x9'),'appdata':_0x383d3c[_0x889b('0x8')]?_0x889b('0xa')+_0x383d3c[_0x889b('0x8')]:_0x889b('0xb'),'context':_0x383d3c[_0x889b('0xc')],'exten':_0x383d3c[_0x889b('0x7')],'priority':_0x1d4725++,'VoiceExtensionId':_0x383d3c['id']}];if(_0x383d3c[_0x889b('0x6')]==='inbound'){_0x3db972['push']({'type':_0x889b('0xd'),'app':_0x889b('0x4'),'appdata':'CDR(routeid)='+_0x383d3c['id'],'context':_0x383d3c[_0x889b('0xc')],'exten':_0x383d3c[_0x889b('0x7')],'priority':_0x1d4725++,'VoiceExtensionId':_0x383d3c['id']});}_0x3db972['push']({'type':_0x383d3c[_0x889b('0x6')],'app':'Set','appdata':_0x889b('0xe'),'context':_0x383d3c[_0x889b('0xc')],'exten':_0x383d3c['exten'],'priority':_0x1d4725++,'VoiceExtensionId':_0x383d3c['id']},{'type':_0x383d3c[_0x889b('0x6')],'app':_0x889b('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x383d3c['context'],'exten':_0x383d3c['exten'],'priority':_0x1d4725++,'VoiceExtensionId':_0x383d3c['id']},{'type':_0x383d3c[_0x889b('0x6')],'app':_0x889b('0x4'),'appdata':_0x889b('0xf'),'context':_0x383d3c[_0x889b('0xc')],'exten':_0x383d3c[_0x889b('0x7')],'priority':_0x1d4725++,'VoiceExtensionId':_0x383d3c['id']});return _0x3db972;}function _0x339556(_0x4d786d){var _0x199425=0x2;var _0x58d725=[{'type':_0x889b('0x10'),'app':_0x889b('0x4'),'appdata':_0x889b('0x11'),'context':_0x4d786d[_0x889b('0xc')],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':'outbound','app':_0x4d786d[_0x889b('0x8')]?_0x889b('0x4'):_0x889b('0x9'),'appdata':_0x4d786d[_0x889b('0x8')]?_0x889b('0xa')+_0x4d786d[_0x889b('0x8')]:_0x889b('0xb'),'context':_0x4d786d[_0x889b('0xc')],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':_0x889b('0x10'),'app':_0x889b('0x4'),'appdata':'CDR(destination)='+(_0x4d786d['cutdigits']?'${EXTEN:'+_0x4d786d[_0x889b('0x12')]+'}':'${EXTEN}'),'context':_0x4d786d['context'],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':_0x889b('0x10'),'app':'Set','appdata':_0x889b('0x13')+_0x4d786d['id'],'context':_0x4d786d['context'],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':_0x889b('0x10'),'app':_0x889b('0x14'),'appdata':_0x889b('0x15')+(_0x199425+0x2)+'):Goto('+(_0x199425+0x1)+')','context':_0x4d786d['context'],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':'outbound','app':_0x889b('0x4'),'appdata':_0x4d786d['cutdigits']?_0x889b('0x16')+_0x4d786d['cutdigits']+'}':_0x889b('0x17'),'context':_0x4d786d[_0x889b('0xc')],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':_0x889b('0x10'),'app':_0x889b('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4d786d['context'],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':_0x889b('0x10'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4d786d[_0x889b('0xc')],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':_0x889b('0x10'),'app':_0x889b('0x4'),'appdata':_0x889b('0xf'),'context':_0x4d786d[_0x889b('0xc')],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':_0x889b('0x10'),'app':'Set','appdata':'outboundrouteid='+_0x4d786d['id'],'context':_0x4d786d['context'],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']}];if(_0x4d786d['hasOwnProperty'](_0x889b('0x18'))&&_0x4d786d['recordingFormat']!==_0x889b('0x19')){_0x58d725[_0x889b('0x1a')]({'type':_0x889b('0x10'),'app':_0x889b('0x4'),'appdata':_0x889b('0x1b'),'context':_0x4d786d['context'],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']},{'type':'outbound','app':_0x889b('0x4'),'appdata':_0x889b('0x1c')+_0x4d786d[_0x889b('0x18')]||'wav','context':_0x4d786d[_0x889b('0xc')],'exten':_0x4d786d[_0x889b('0x7')],'priority':_0x199425++,'VoiceExtensionId':_0x4d786d['id']});}return _0x58d725;}function _0x3cf51b(_0x3bde7b,_0x55c4ed){var _0x4ad101=[{'name':'trunk','param':0x0},{'name':_0x889b('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':_0x889b('0x1e'),'param':0x3}];var _0x42c920={};var _0xdd58e1=_0x55c4ed['split'](',');var _0x13e2bc=[];for(var _0x27cade=0x0;_0x27cade<_0x4ad101[_0x889b('0x1f')];_0x27cade++){switch(_0x4ad101[_0x27cade]['name']){case _0x889b('0x20'):_0x42c920[_0x889b('0x20')]=_0xdd58e1[_0x4ad101[_0x27cade][_0x889b('0x21')]][_0x889b('0x22')]('/')[0x1];_0x42c920[_0x889b('0x23')]=_0xdd58e1[_0x4ad101[_0x27cade][_0x889b('0x21')]][_0x889b('0x22')]('/')[0x2];_0x42c920[_0x889b('0x24')]=_0x42c920[_0x889b('0x23')]?_0x42c920[_0x889b('0x23')][_0x889b('0x22')]('$')[0x0]:undefined;_0x42c920[_0x889b('0x23')]=_0x3bde7b['cutdigits']?(_0x42c920['prefix']||'')+_0x889b('0x25')+_0x3bde7b[_0x889b('0x12')]+'}':(_0x42c920['prefix']||'')+_0x889b('0x26');_0x13e2bc[_0x4ad101[_0x27cade][_0x889b('0x21')]]=['SIP',_0x42c920['trunk'],_0x42c920[_0x889b('0x23')]][_0x889b('0x27')]('/');break;case'options':_0x42c920[_0x889b('0x28')]=_0xdd58e1[_0x4ad101[_0x27cade][_0x889b('0x21')]];if(_0x3bde7b[_0x889b('0x18')]!=='none'){if(_0x42c920[_0x889b('0x28')][_0x889b('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x42c920[_0x889b('0x28')]+=_0x889b('0x2a');}}else{_0x42c920[_0x889b('0x28')]=_0x42c920['options'][_0x889b('0x2b')](_0x889b('0x2a'),'');}_0x13e2bc[_0x4ad101[_0x27cade][_0x889b('0x21')]]=_0x42c920[_0x889b('0x28')];break;default:_0x13e2bc[_0x4ad101[_0x27cade][_0x889b('0x21')]]=_0xdd58e1[_0x4ad101[_0x27cade][_0x889b('0x21')]];}}return _0x13e2bc[_0x889b('0x27')](',');}function _0x47eaff(_0x10c3a3,_0x352115,_0x38e4be){return new Promise(function(_0x1f2bb9,_0x7e6b4c){var _0xd35d07=[];if(_['isEmpty'](_0x352115))return _0x1f2bb9(_0xd35d07);_0x15a14a['Interval'][_0x889b('0x2c')]({'attributes':['id',_0x889b('0x2d'),_0x889b('0x2e')],'raw':!![]})[_0x889b('0x2f')](function(_0x24b05a){for(var _0x38bff1=0x0,_0x390469=0x0;_0x38bff1<_0x352115[_0x889b('0x1f')];_0x38bff1++,_0x390469=0x0){var _0xc4a32d=_0x352115[_0x38bff1];var _0x3b934b=[];var _0x53acc5=[];delete _0xc4a32d['id'];if(_0xc4a32d[_0x889b('0x2d')]!=='*,*,*,*'){_0xc4a32d[_0x889b('0x30')]=[_0xc4a32d[_0x889b('0x2d')]];}else{_0xc4a32d['intervals']=_0xc4a32d[_0x889b('0x2e')]?_[_0x889b('0x31')](_[_0x889b('0x32')](_0x24b05a,{'IntervalId':_0xc4a32d[_0x889b('0x2e')]}),_0x889b('0x2d')):[];}_0xc4a32d['context']=_0x10c3a3[_0x889b('0xc')];_0xc4a32d[_0x889b('0x7')]=_0x10c3a3[_0x889b('0x7')];if(_0xc4a32d['type'])_0xc4a32d[_0x889b('0x6')]=_0xc4a32d[_0x889b('0x6')][_0x889b('0x33')]();if(_0x10c3a3[_0x889b('0x6')]===_0x889b('0x10')){if(_0xc4a32d[_0x889b('0x34')](_0x889b('0x35'))&&_0xc4a32d[_0x889b('0x35')]&&_0xc4a32d['tag']!=='--'){_0x3b934b[_0x889b('0x1a')]({'type':_0xc4a32d[_0x889b('0x6')][_0x889b('0x33')](),'app':_0x889b('0x4'),'appdata':'CDR(tag)='+_0xc4a32d[_0x889b('0x35')],'context':_0x10c3a3[_0x889b('0xc')],'exten':_0x10c3a3['exten'],'priority':_0xc4a32d['intervals'][_0x889b('0x1f')]+_0x38e4be+_0x390469++,'VoiceExtensionId':_0x10c3a3['id']});}_0x3b934b[_0x889b('0x1a')]({'type':_0xc4a32d['type'][_0x889b('0x33')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xc4a32d[_0x889b('0x36')]?_0x889b('0x37')+_0xc4a32d[_0x889b('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x10c3a3[_0x889b('0xc')],'exten':_0x10c3a3[_0x889b('0x7')],'priority':_0xc4a32d['intervals'][_0x889b('0x1f')]+_0x38e4be+_0x390469++,'VoiceExtensionId':_0x10c3a3['id']});}else{if(_0xc4a32d['hasOwnProperty'](_0x889b('0x38'))){if([_0x889b('0x39'),_0x889b('0x3a')]['includes'](_0xc4a32d['app'][_0x889b('0x33')]())&&_0xc4a32d[_0x889b('0x3b')]!==_0x889b('0x3c')){if(_0xc4a32d[_0x889b('0x38')]){_0x3b934b[_0x889b('0x1a')]({'type':_0xc4a32d[_0x889b('0x6')][_0x889b('0x33')](),'app':'ExecIf','appdata':_0x889b('0x3d'),'context':_0x10c3a3['context'],'exten':_0x10c3a3[_0x889b('0x7')],'priority':_0xc4a32d['intervals'][_0x889b('0x1f')]+_0x38e4be+_0x390469++,'VoiceExtensionId':_0x10c3a3['id']});_0x3b934b[_0x889b('0x1a')]({'type':_0xc4a32d['type'][_0x889b('0x33')](),'app':_0x889b('0x4'),'appdata':_0x889b('0x3e'),'context':_0x10c3a3[_0x889b('0xc')],'exten':_0x10c3a3[_0x889b('0x7')],'priority':_0xc4a32d['intervals'][_0x889b('0x1f')]+_0x38e4be+_0x390469++,'VoiceExtensionId':_0x10c3a3['id']});}else{_0x3b934b['push']({'type':_0xc4a32d[_0x889b('0x6')][_0x889b('0x33')](),'app':_0x889b('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x10c3a3[_0x889b('0xc')],'exten':_0x10c3a3[_0x889b('0x7')],'priority':_0xc4a32d[_0x889b('0x30')][_0x889b('0x1f')]+_0x38e4be+_0x390469++,'VoiceExtensionId':_0x10c3a3['id']});_0x3b934b[_0x889b('0x1a')]({'type':_0xc4a32d[_0x889b('0x6')][_0x889b('0x33')](),'app':_0x889b('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x10c3a3[_0x889b('0xc')],'exten':_0x10c3a3[_0x889b('0x7')],'priority':_0xc4a32d[_0x889b('0x30')][_0x889b('0x1f')]+_0x38e4be+_0x390469++,'VoiceExtensionId':_0x10c3a3['id']});}}}}for(var _0x1de202=0x0;_0x1de202<_0xc4a32d[_0x889b('0x30')][_0x889b('0x1f')];_0x1de202++){var _0x411f8a=_0x38e4be+_0xc4a32d['intervals'][_0x889b('0x1f')];var _0x3d5b01=_0x1de202===_0xc4a32d[_0x889b('0x30')]['length']-0x1?_0x38e4be+_0x3b934b[_0x889b('0x1f')]+_0x53acc5[_0x889b('0x1f')]+0x2:_0x38e4be+_0x1de202+0x1;_0x3b934b[_0x889b('0x3f')](_0x1de202,0x0,{'type':_0x10c3a3[_0x889b('0x6')],'app':_0x889b('0x40'),'appdata':_0xc4a32d[_0x889b('0x30')][_0x1de202]+'?'+_0x10c3a3[_0x889b('0xc')]+',${EXTEN},'+_0x411f8a+':'+_0x10c3a3[_0x889b('0xc')]+_0x889b('0x41')+_0x3d5b01,'exten':_0x10c3a3[_0x889b('0x7')],'context':_0x10c3a3['context'],'priority':_0x38e4be+_0x1de202,'VoiceExtensionId':_0x10c3a3['id']});}if(_0xc4a32d[_0x889b('0x3b')]===_0x889b('0x42'))_0xc4a32d[_0x889b('0x43')]=_0x3cf51b(_0x10c3a3,_0xc4a32d[_0x889b('0x43')]);_0xc4a32d[_0x889b('0x44')]=_0x3b934b[_0x889b('0x1f')]?_[_0x889b('0x45')](_0x3b934b)[_0x889b('0x44')]+0x1:_0x38e4be;_0xd35d07=_[_0x889b('0x46')](_0xd35d07,_0x3b934b,[_0xc4a32d],_0x53acc5);_0x38e4be=_[_0x889b('0x45')](_0xd35d07)[_0x889b('0x44')]+0x1;}return _0x1f2bb9(_0xd35d07);})[_0x889b('0x47')](function(_0x2abd2f){_0x7e6b4c(_0x2abd2f);});});}return _0x93a75a[_0x889b('0x48')](_0x889b('0x49'),attributes,{'tableName':_0x889b('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x51ac22){var _0x112172=this['get']({'plain':!![]});var _0x60272f=_0x112172[_0x889b('0x6')]===_0x889b('0x10')?_0x339556(_0x112172):_0x52a1f8(_0x112172);return _0x47eaff(_0x112172,_0x51ac22,_[_0x889b('0x45')](_0x60272f)['priority']+0x1)[_0x889b('0x2f')](function(_0x1c220c){var _0x10184f=_[_0x889b('0x46')](_0x60272f,_0x1c220c);_0x10184f[_0x889b('0x1a')]({'type':_0x112172['type'],'app':_0x889b('0x4b'),'exten':_0x112172[_0x889b('0x7')],'context':_0x112172[_0x889b('0xc')],'priority':_['last'](_0x10184f)[_0x889b('0x44')]+0x1,'VoiceExtensionId':_0x112172['id']});return _0x10184f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index cf86fd8..faebe16 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 _0x576b=['error','code','VoiceExtension,\x20%s,\x20%s','message','info','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x50263d,_0x3f11e5){var _0x542228=function(_0x3edfc5){while(--_0x3edfc5){_0x50263d['push'](_0x50263d['shift']());}};_0x542228(++_0x3f11e5);}(_0x576b,0x1d9));var _0xb576=function(_0x168818,_0x7a1371){_0x168818=_0x168818-0x0;var _0x2679c4=_0x576b[_0x168818];return _0x2679c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb576('0x0'));var rs=require(_0xb576('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb576('0x2'))['db'];var utils=require(_0xb576('0x3'));var logger=require('../../config/logger')(_0xb576('0x4'));var config=require(_0xb576('0x5'));var jayson=require(_0xb576('0x6'));var client=jayson[_0xb576('0x7')][_0xb576('0x8')]({'port':0x232a});config[_0xb576('0x9')]=_[_0xb576('0xa')](config[_0xb576('0x9')],{'host':_0xb576('0xb'),'port':0x18eb});var socket=require(_0xb576('0xc'))(new Redis(config[_0xb576('0x9')]));require(_0xb576('0xd'))[_0xb576('0xe')](socket);function respondWithRpcPromise(_0x384fcc,_0x395bd2,_0x4b209b){return new BPromise(function(_0x3e21fe,_0x4a3fbb){return client[_0xb576('0xf')](_0x384fcc,_0x4b209b)[_0xb576('0x10')](function(_0x3073d7){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x395bd2,_0xb576('0x11'));logger[_0xb576('0x12')](_0xb576('0x13'),_0x395bd2,_0xb576('0x11'),JSON[_0xb576('0x14')](_0x3073d7));if(_0x3073d7[_0xb576('0x15')]){if(_0x3073d7[_0xb576('0x15')][_0xb576('0x16')]===0x1f4){logger[_0xb576('0x15')](_0xb576('0x17'),_0x395bd2,_0x3073d7['error']['message']);return _0x4a3fbb(_0x3073d7['error'][_0xb576('0x18')]);}logger[_0xb576('0x15')](_0xb576('0x17'),_0x395bd2,_0x3073d7[_0xb576('0x15')][_0xb576('0x18')]);return _0x3e21fe(_0x3073d7[_0xb576('0x15')]['message']);}else{logger[_0xb576('0x19')](_0xb576('0x17'),_0x395bd2,'request\x20sent');_0x3e21fe(_0x3073d7['result'][_0xb576('0x18')]);}})[_0xb576('0x1a')](function(_0x3e6be7){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x395bd2,_0x3e6be7);_0x4a3fbb(_0x3e6be7);});});}exports['GetVoiceExtension']=function(_0x432e41){var _0x5a2ae9=this;return new Promise(function(_0x587480,_0x2243b1){return db[_0xb576('0x1b')][_0xb576('0x1c')]({'raw':_0x432e41[_0xb576('0x1d')]?_0x432e41['options'][_0xb576('0x1e')]===undefined?!![]:![]:!![],'where':_0x432e41[_0xb576('0x1d')]?_0x432e41[_0xb576('0x1d')][_0xb576('0x1f')]||null:null,'attributes':_0x432e41[_0xb576('0x1d')]?_0x432e41[_0xb576('0x1d')][_0xb576('0x20')]||null:null,'limit':_0x432e41[_0xb576('0x1d')]?_0x432e41[_0xb576('0x1d')][_0xb576('0x21')]||null:null,'include':_0x432e41[_0xb576('0x1d')]?_0x432e41[_0xb576('0x1d')][_0xb576('0x22')]?_[_0xb576('0x23')](_0x432e41['options'][_0xb576('0x22')],function(_0xa0be5e){return{'model':db[_0xa0be5e[_0xb576('0x24')]],'as':_0xa0be5e['as'],'attributes':_0xa0be5e[_0xb576('0x20')],'include':_0xa0be5e[_0xb576('0x22')]?_[_0xb576('0x23')](_0xa0be5e[_0xb576('0x22')],function(_0x535bb9){return{'model':db[_0x535bb9[_0xb576('0x24')]],'as':_0x535bb9['as'],'attributes':_0x535bb9[_0xb576('0x20')],'include':_0x535bb9[_0xb576('0x22')]?_[_0xb576('0x23')](_0x535bb9[_0xb576('0x22')],function(_0x592dfc){return{'model':db[_0x592dfc[_0xb576('0x24')]],'as':_0x592dfc['as'],'attributes':_0x592dfc['attributes']};}):[]};}):[]};}):[]:[]})[_0xb576('0x10')](function(_0x19f443){logger[_0xb576('0x19')](_0xb576('0x25'),_0x432e41);logger[_0xb576('0x12')]('GetVoiceExtension',_0x432e41,JSON[_0xb576('0x14')](_0x19f443));_0x587480(_0x19f443);})[_0xb576('0x1a')](function(_0x2f4e6c){logger[_0xb576('0x15')]('GetVoiceExtension',_0x2f4e6c[_0xb576('0x18')],_0x432e41);_0x2243b1(_0x5a2ae9[_0xb576('0x15')](0x1f4,_0x2f4e6c[_0xb576('0x18')]));});});}; \ No newline at end of file +var _0x56a6=['where','attributes','limit','include','map','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','result','GetVoiceExtension','findAll','options'];(function(_0xa8d7ef,_0x4b8b3d){var _0x239d5e=function(_0x15150d){while(--_0x15150d){_0xa8d7ef['push'](_0xa8d7ef['shift']());}};_0x239d5e(++_0x4b8b3d);}(_0x56a6,0x17b));var _0x656a=function(_0x387548,_0x106e45){_0x387548=_0x387548-0x0;var _0x317d13=_0x56a6[_0x387548];return _0x317d13;};'use strict';var _=require(_0x656a('0x0'));var util=require(_0x656a('0x1'));var moment=require(_0x656a('0x2'));var BPromise=require(_0x656a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x656a('0x4'))['db'];var utils=require(_0x656a('0x5'));var logger=require(_0x656a('0x6'))('rpc');var config=require(_0x656a('0x7'));var jayson=require(_0x656a('0x8'));var client=jayson[_0x656a('0x9')]['http']({'port':0x232a});config[_0x656a('0xa')]=_[_0x656a('0xb')](config[_0x656a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x656a('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x656a('0xd')](socket);function respondWithRpcPromise(_0x11c10f,_0x380aa8,_0x218d19){return new BPromise(function(_0x4d9f32,_0x2bc0ae){return client[_0x656a('0xe')](_0x11c10f,_0x218d19)[_0x656a('0xf')](function(_0x111aaa){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x380aa8,'request\x20sent');logger[_0x656a('0x10')](_0x656a('0x11'),_0x380aa8,_0x656a('0x12'),JSON[_0x656a('0x13')](_0x111aaa));if(_0x111aaa[_0x656a('0x14')]){if(_0x111aaa['error'][_0x656a('0x15')]===0x1f4){logger[_0x656a('0x14')](_0x656a('0x16'),_0x380aa8,_0x111aaa[_0x656a('0x14')][_0x656a('0x17')]);return _0x2bc0ae(_0x111aaa[_0x656a('0x14')][_0x656a('0x17')]);}logger[_0x656a('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x380aa8,_0x111aaa[_0x656a('0x14')][_0x656a('0x17')]);return _0x4d9f32(_0x111aaa[_0x656a('0x14')][_0x656a('0x17')]);}else{logger[_0x656a('0x18')](_0x656a('0x16'),_0x380aa8,_0x656a('0x12'));_0x4d9f32(_0x111aaa[_0x656a('0x19')][_0x656a('0x17')]);}})['catch'](function(_0x38be9f){logger[_0x656a('0x14')](_0x656a('0x16'),_0x380aa8,_0x38be9f);_0x2bc0ae(_0x38be9f);});});}exports[_0x656a('0x1a')]=function(_0x2ecc76){var _0x17377a=this;return new Promise(function(_0x3e1307,_0x1cecf4){return db['VoiceExtension'][_0x656a('0x1b')]({'raw':_0x2ecc76['options']?_0x2ecc76['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ecc76['options']?_0x2ecc76[_0x656a('0x1c')][_0x656a('0x1d')]||null:null,'attributes':_0x2ecc76['options']?_0x2ecc76[_0x656a('0x1c')][_0x656a('0x1e')]||null:null,'limit':_0x2ecc76[_0x656a('0x1c')]?_0x2ecc76['options'][_0x656a('0x1f')]||null:null,'include':_0x2ecc76[_0x656a('0x1c')]?_0x2ecc76[_0x656a('0x1c')][_0x656a('0x20')]?_[_0x656a('0x21')](_0x2ecc76[_0x656a('0x1c')][_0x656a('0x20')],function(_0x15271f){return{'model':db[_0x15271f['model']],'as':_0x15271f['as'],'attributes':_0x15271f[_0x656a('0x1e')],'include':_0x15271f['include']?_[_0x656a('0x21')](_0x15271f['include'],function(_0x2008fe){return{'model':db[_0x2008fe['model']],'as':_0x2008fe['as'],'attributes':_0x2008fe[_0x656a('0x1e')],'include':_0x2008fe['include']?_[_0x656a('0x21')](_0x2008fe['include'],function(_0x55abd2){return{'model':db[_0x55abd2['model']],'as':_0x55abd2['as'],'attributes':_0x55abd2[_0x656a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb19ba7){logger['info'](_0x656a('0x1a'),_0x2ecc76);logger[_0x656a('0x10')](_0x656a('0x1a'),_0x2ecc76,JSON[_0x656a('0x13')](_0xb19ba7));_0x3e1307(_0xb19ba7);})['catch'](function(_0x4f81bb){logger[_0x656a('0x14')](_0x656a('0x1a'),_0x4f81bb['message'],_0x2ecc76);_0x1cecf4(_0x17377a[_0x656a('0x14')](0x1f4,_0x4f81bb[_0x656a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d9e8c76..edbb28b 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x52a45c,_0x331b52){var _0x4ac4be=function(_0x3167dc){while(--_0x3167dc){_0x52a45c['push'](_0x52a45c['shift']());}};_0x4ac4be(++_0x331b52);}(_0xe14b,0x93));var _0xbe14=function(_0x1fe823,_0x48028a){_0x1fe823=_0x1fe823-0x0;var _0x19a4ba=_0xe14b[_0x1fe823];return _0x19a4ba;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x44ccf0,_0x446087){var _0x101f26=function(_0x4dee46){while(--_0x4dee46){_0x44ccf0['push'](_0x44ccf0['shift']());}};_0x101f26(++_0x446087);}(_0x5fc3,0xa8));var _0x35fc=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x5fc3[_0x496738];return _0xee1381;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 111e3cf..f7f98b1 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 _0x0adf=['put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','post','create'];(function(_0xbbcb36,_0x586383){var _0x4278ff=function(_0x35c9da){while(--_0x35c9da){_0xbbcb36['push'](_0xbbcb36['shift']());}};_0x4278ff(++_0x586383);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x3ffb52,_0x30e015){_0x3ffb52=_0x3ffb52-0x0;var _0x25cda2=_0x0adf[_0x3ffb52];return _0x25cda2;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xb')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['getMessages']);router[_0xf0ad('0xf')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x12')]);router['delete']('/:id',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x13')]);module[_0xf0ad('0x14')]=router; \ No newline at end of file +var _0xb145=['show','/:id/messages','getMessages','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x333aea,_0x25d3c4){var _0x12e0ac=function(_0x1af82c){while(--_0x1af82c){_0x333aea['push'](_0x333aea['shift']());}};_0x12e0ac(++_0x25d3c4);}(_0xb145,0xa3));var _0x5b14=function(_0x4e1e4b,_0xc33062){_0x4e1e4b=_0x4e1e4b-0x0;var _0x314b76=_0xb145[_0x4e1e4b];return _0x314b76;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/',auth['isAuthenticated'](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x13')]);router['delete'](_0x5b14('0xc'),auth['isAuthenticated'](),controller[_0x5b14('0x14')]);module[_0x5b14('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0d1164a..a481e99 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 _0x904c=['fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','getDataValue'];(function(_0x390d3a,_0x5eaf16){var _0x294503=function(_0x25afa6){while(--_0x25afa6){_0x390d3a['push'](_0x390d3a['shift']());}};_0x294503(++_0x5eaf16);}(_0x904c,0xe3));var _0xc904=function(_0x3849e6,_0x1fc234){_0x3849e6=_0x3849e6-0x0;var _0x202141=_0x904c[_0x3849e6];return _0x202141;};'use strict';var Sequelize=require('sequelize');module[_0xc904('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc904('0x1')],'defaultValue':_0xc904('0x2'),'unique':_0xc904('0x3')},'mailbox':{'type':Sequelize[_0xc904('0x1')],'defaultValue':'','allowNull':![],'unique':_0xc904('0x3')},'password':{'type':Sequelize[_0xc904('0x1')]},'fullname':{'type':Sequelize[_0xc904('0x1')]},'email':{'type':Sequelize[_0xc904('0x1')],'validate':{'isEmail':!![]},'set':function(_0x8a5d27){this['setDataValue'](_0xc904('0x4'),typeof _0x8a5d27===_0xc904('0x5')&&_0x8a5d27[_0xc904('0x6')]()?_0x8a5d27[_0xc904('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xc904('0x1')],'defaultValue':_0xc904('0x7')},'attach':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':_0xc904('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc904('0x1')]},'callback':{'type':Sequelize[_0xc904('0x1')]},'review':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc904('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc904('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xc904('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc904('0x8')](_0xc904('0x9'),'no'),'defaultValue':_0xc904('0x9'),'allowNull':![]},'stamp':{'type':_0xc904('0xa')},'emailsubject':{'type':Sequelize[_0xc904('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc904('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc904('0xc')](_0xc904('0xd'))+_0xc904('0xe')+this['getDataValue'](_0xc904('0xf'));}}}; \ No newline at end of file +var _0xcf18=['VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','yes','ENUM','TINYINT(4)'];(function(_0xbf4fd8,_0x276b23){var _0x512333=function(_0x18b69f){while(--_0x18b69f){_0xbf4fd8['push'](_0xbf4fd8['shift']());}};_0x512333(++_0x276b23);}(_0xcf18,0x1a3));var _0x8cf1=function(_0x1beafa,_0x3343a7){_0x1beafa=_0x1beafa-0x0;var _0xfc70e4=_0xcf18[_0x1beafa];return _0xfc70e4;};'use strict';var Sequelize=require(_0x8cf1('0x0'));module[_0x8cf1('0x1')]={'customer_id':{'type':Sequelize[_0x8cf1('0x2')]},'context':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':_0x8cf1('0x3'),'unique':_0x8cf1('0x4')},'mailbox':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8cf1('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x175a8e){this['setDataValue']('email',typeof _0x175a8e===_0x8cf1('0x5')&&_0x175a8e[_0x8cf1('0x6')]()?_0x175a8e[_0x8cf1('0x6')]():null);}},'pager':{'type':Sequelize[_0x8cf1('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x8cf1('0x7'),'no'),'defaultValue':_0x8cf1('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x8cf1('0x7'),'no'),'defaultValue':_0x8cf1('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8cf1('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x8cf1('0x8')](_0x8cf1('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8cf1('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8cf1('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8cf1('0x8')](_0x8cf1('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8cf1('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8cf1('0x8')](_0x8cf1('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8cf1('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x8cf1('0x7'),'no'),'defaultValue':_0x8cf1('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8cf1('0x8')](_0x8cf1('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8cf1('0x8')](_0x8cf1('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8cf1('0x8')]('yes','no'),'defaultValue':_0x8cf1('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x8cf1('0x2')]},'emailbody':{'type':Sequelize[_0x8cf1('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8cf1('0xa')],'get':function(){return this[_0x8cf1('0xb')]('fullname')+'\x20-\x20'+this[_0x8cf1('0xb')](_0x8cf1('0xc'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index bbd4ff8..a4edf9b 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 _0x5423=['offset','undefined','count','limit','set','Content-Range','reject','destroy','get','Voicemails','UserProfileResource','then','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','query','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','params','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x20bdc4,_0x4ceadd){var _0x3c5164=function(_0x5c7c03){while(--_0x5c7c03){_0x20bdc4['push'](_0x20bdc4['shift']());}};_0x3c5164(++_0x4ceadd);}(_0x5423,0xe3));var _0x3542=function(_0x447695,_0x270b08){_0x447695=_0x447695-0x0;var _0x2b660a=_0x5423[_0x447695];return _0x2b660a;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];function respondWithStatusCode(_0x1cf710,_0x43e977){_0x43e977=_0x43e977||0xcc;return function(_0x4ee86){if(_0x4ee86){return _0x1cf710[_0x3542('0x18')](_0x43e977);}return _0x1cf710[_0x3542('0x19')](_0x43e977)[_0x3542('0x1a')]();};}function respondWithResult(_0x15863d,_0x4bac5b){_0x4bac5b=_0x4bac5b||0xc8;return function(_0x14fe57){if(_0x14fe57){return _0x15863d['status'](_0x4bac5b)[_0x3542('0x1b')](_0x14fe57);}};}function respondWithFilteredResult(_0x13fe0b,_0xc33d42){return function(_0x546fbd){if(_0x546fbd){var _0x270312=typeof _0xc33d42[_0x3542('0x1c')]===_0x3542('0x1d')&&typeof _0xc33d42['limit']===_0x3542('0x1d');var _0x23b0de=_0x546fbd[_0x3542('0x1e')];var _0x3d5199=_0x270312?0x0:_0xc33d42['offset'];var _0x32df3f=_0x270312?_0x546fbd['count']:_0xc33d42[_0x3542('0x1c')]+_0xc33d42[_0x3542('0x1f')];var _0x4d93bc;if(_0x32df3f>=_0x23b0de){_0x32df3f=_0x23b0de;_0x4d93bc=0xc8;}else{_0x4d93bc=0xce;}_0x13fe0b[_0x3542('0x19')](_0x4d93bc);return _0x13fe0b[_0x3542('0x20')](_0x3542('0x21'),_0x3d5199+'-'+_0x32df3f+'/'+_0x23b0de)[_0x3542('0x1b')](_0x546fbd);}return null;};}function patchUpdates(_0x212950){return function(_0x4a7695){try{jsonpatch['apply'](_0x4a7695,_0x212950,!![]);}catch(_0x4c58f1){return BPromise[_0x3542('0x22')](_0x4c58f1);}return _0x4a7695['save']();};}function saveUpdates(_0x1d5488,_0x551645){return function(_0x1d5f1e){if(_0x1d5f1e){return _0x1d5f1e['update'](_0x1d5488)['then'](function(_0x3eacd0){return _0x3eacd0;});}return null;};}function removeEntity(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(_0x5d05b2){return _0x5d05b2[_0x3542('0x23')]()['then'](function(){var _0x160caa=_0x5d05b2[_0x3542('0x24')]({'plain':!![]});var _0x1e0723=_0x3542('0x25');return db[_0x3542('0x26')][_0x3542('0x23')]({'where':{'type':_0x1e0723,'resourceId':_0x160caa['id']}})[_0x3542('0x27')](function(){return _0x5d05b2;});})[_0x3542('0x27')](function(){_0xe3f983[_0x3542('0x19')](0xcc)[_0x3542('0x1a')]();});}};}function handleEntityNotFound(_0xfdfe62,_0x4462c4){return function(_0x220021){if(!_0x220021){_0xfdfe62[_0x3542('0x18')](0x194);}return _0x220021;};}function handleError(_0x1cab35,_0x39050a){_0x39050a=_0x39050a||0x1f4;return function(_0x303412){logger[_0x3542('0x28')](_0x303412[_0x3542('0x29')]);if(_0x303412['name']){delete _0x303412[_0x3542('0x2a')];}_0x1cab35[_0x3542('0x19')](_0x39050a)[_0x3542('0x2b')](_0x303412);};}exports['index']=function(_0x402c97,_0xc6f23b){var _0x2e883a={},_0x30b5e8={},_0x5c882f={'count':0x0,'rows':[]};var _0x5a274b=_[_0x3542('0x2c')](db[_0x3542('0x2d')][_0x3542('0x2e')],function(_0x44e8f7){return{'name':_0x44e8f7[_0x3542('0x2f')],'type':_0x44e8f7[_0x3542('0x30')][_0x3542('0x31')]};});_0x30b5e8['model']=_['map'](_0x5a274b,_0x3542('0x2a'));_0x30b5e8['query']=_['keys'](_0x402c97[_0x3542('0x32')]);_0x30b5e8['filters']=_['intersection'](_0x30b5e8[_0x3542('0x33')],_0x30b5e8[_0x3542('0x32')]);_0x2e883a[_0x3542('0x34')]=_['intersection'](_0x30b5e8[_0x3542('0x33')],qs['fields'](_0x402c97[_0x3542('0x32')][_0x3542('0x35')]));_0x2e883a['attributes']=_0x2e883a[_0x3542('0x34')]['length']?_0x2e883a[_0x3542('0x34')]:_0x30b5e8[_0x3542('0x33')];if(!_0x402c97[_0x3542('0x32')]['hasOwnProperty'](_0x3542('0x36'))){_0x2e883a['limit']=qs[_0x3542('0x1f')](_0x402c97[_0x3542('0x32')][_0x3542('0x1f')]);_0x2e883a[_0x3542('0x1c')]=qs[_0x3542('0x1c')](_0x402c97[_0x3542('0x32')][_0x3542('0x1c')]);}_0x2e883a[_0x3542('0x37')]=qs[_0x3542('0x38')](_0x402c97[_0x3542('0x32')][_0x3542('0x38')]);_0x2e883a[_0x3542('0x39')]=qs[_0x3542('0x3a')](_['pick'](_0x402c97[_0x3542('0x32')],_0x30b5e8['filters']),_0x5a274b);if(_0x402c97['query'][_0x3542('0x3b')]){_0x2e883a[_0x3542('0x39')]=_[_0x3542('0x3c')](_0x2e883a[_0x3542('0x39')],{'$or':_[_0x3542('0x2c')](_0x5a274b,function(_0x21aec3){if(_0x21aec3[_0x3542('0x30')]!==_0x3542('0x3d')){var _0x53eac6={};_0x53eac6[_0x21aec3[_0x3542('0x2a')]]={'$like':'%'+_0x402c97['query'][_0x3542('0x3b')]+'%'};return _0x53eac6;}})});}_0x2e883a=_[_0x3542('0x3c')]({},_0x2e883a,_0x402c97['options']);var _0x371aba={'where':_0x2e883a[_0x3542('0x39')]};return db['VoiceMail'][_0x3542('0x1e')](_0x371aba)[_0x3542('0x27')](function(_0x5e1b29){_0x5c882f[_0x3542('0x1e')]=_0x5e1b29;if(_0x402c97[_0x3542('0x32')][_0x3542('0x3e')]){_0x2e883a[_0x3542('0x3f')]=[{'all':!![]}];}return db[_0x3542('0x2d')][_0x3542('0x40')](_0x2e883a);})[_0x3542('0x27')](function(_0x4bf45a){_0x5c882f['rows']=_0x4bf45a;return _0x5c882f;})[_0x3542('0x27')](respondWithFilteredResult(_0xc6f23b,_0x2e883a))[_0x3542('0x41')](handleError(_0xc6f23b,null));};exports[_0x3542('0x42')]=function(_0xdeebd3,_0x170749){var _0x53a024={'raw':!![],'where':{'id':_0xdeebd3['params']['id']}},_0x3e6a49={};_0x3e6a49[_0x3542('0x33')]=_[_0x3542('0x43')](db[_0x3542('0x2d')]['rawAttributes']);_0x3e6a49[_0x3542('0x32')]=_[_0x3542('0x43')](_0xdeebd3['query']);_0x3e6a49[_0x3542('0x3a')]=_[_0x3542('0x44')](_0x3e6a49[_0x3542('0x33')],_0x3e6a49[_0x3542('0x32')]);_0x53a024[_0x3542('0x34')]=_[_0x3542('0x44')](_0x3e6a49[_0x3542('0x33')],qs[_0x3542('0x35')](_0xdeebd3['query']['fields']));_0x53a024['attributes']=_0x53a024[_0x3542('0x34')][_0x3542('0x45')]?_0x53a024[_0x3542('0x34')]:_0x3e6a49[_0x3542('0x33')];if(_0xdeebd3[_0x3542('0x32')][_0x3542('0x3e')]){_0x53a024[_0x3542('0x3f')]=[{'all':!![]}];}_0x53a024=_['merge']({},_0x53a024,_0xdeebd3[_0x3542('0x46')]);return db[_0x3542('0x2d')][_0x3542('0x47')](_0x53a024)[_0x3542('0x27')](handleEntityNotFound(_0x170749,null))['then'](respondWithResult(_0x170749,null))[_0x3542('0x41')](handleError(_0x170749,null));};exports[_0x3542('0x48')]=function(_0x55b43a,_0x528f8c){return db[_0x3542('0x2d')][_0x3542('0x48')](_0x55b43a[_0x3542('0x49')],{})[_0x3542('0x27')](function(_0x244f3a){var _0x1a2ecf=_0x55b43a[_0x3542('0x4a')]['get']({'plain':!![]});if(!_0x1a2ecf)throw new Error(_0x3542('0x4b'));if(_0x1a2ecf[_0x3542('0x4c')]===_0x3542('0x4a')){var _0x392c6e=_0x244f3a[_0x3542('0x24')]({'plain':!![]});var _0x28be34=_0x3542('0x25');return db[_0x3542('0x4d')][_0x3542('0x47')]({'where':{'name':_0x28be34,'userProfileId':_0x1a2ecf['userProfileId']},'raw':!![]})['then'](function(_0x15af28){if(_0x15af28&&_0x15af28['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x392c6e[_0x3542('0x2a')],'resourceId':_0x392c6e['id'],'type':_0x15af28[_0x3542('0x2a')],'sectionId':_0x15af28['id']},{})[_0x3542('0x27')](function(){return _0x244f3a;});}else{return _0x244f3a;}})['catch'](function(_0x2db495){logger[_0x3542('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2db495);throw _0x2db495;});}return _0x244f3a;})[_0x3542('0x27')](respondWithResult(_0x528f8c,0xc9))[_0x3542('0x41')](handleError(_0x528f8c,null));};exports[_0x3542('0x4e')]=function(_0x196c59,_0x179249){if(_0x196c59['body']['id']){delete _0x196c59[_0x3542('0x49')]['id'];}return db[_0x3542('0x2d')][_0x3542('0x47')]({'where':{'id':_0x196c59[_0x3542('0x4f')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x179249,null))['then'](saveUpdates(_0x196c59['body'],null))[_0x3542('0x27')](respondWithResult(_0x179249,null))[_0x3542('0x41')](handleError(_0x179249,null));};exports[_0x3542('0x23')]=function(_0x5de994,_0x1dfac3){return db[_0x3542('0x2d')][_0x3542('0x47')]({'where':{'id':_0x5de994[_0x3542('0x4f')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x1dfac3,null))['then'](removeEntity(_0x1dfac3,null))['catch'](handleError(_0x1dfac3,null));};exports[_0x3542('0x50')]=function(_0x4cd6fd,_0x1fd8c8,_0x3610b7){return db['VoiceMail'][_0x3542('0x51')]({'where':{'id':_0x4cd6fd[_0x3542('0x4f')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x1fd8c8,null))[_0x3542('0x27')](function(_0x60b9c0){var _0x52a75b;var _0x4cb73f={},_0x271dd0={};_0x271dd0['model']=_[_0x3542('0x43')](db[_0x3542('0x52')][_0x3542('0x2e')]);_0x271dd0['query']=_[_0x3542('0x43')](_0x4cd6fd[_0x3542('0x32')]);_0x271dd0[_0x3542('0x3a')]=_[_0x3542('0x44')](_0x271dd0[_0x3542('0x33')],_0x271dd0[_0x3542('0x32')]);_0x4cb73f['attributes']=_[_0x3542('0x44')](_0x271dd0[_0x3542('0x33')],qs[_0x3542('0x35')](_0x4cd6fd[_0x3542('0x32')][_0x3542('0x35')]));_0x4cb73f[_0x3542('0x34')]=_0x4cb73f['attributes'][_0x3542('0x45')]?_0x4cb73f[_0x3542('0x34')]:_0x271dd0[_0x3542('0x33')];if(!_0x4cd6fd[_0x3542('0x32')]['hasOwnProperty'](_0x3542('0x36'))){_0x4cb73f[_0x3542('0x1f')]=qs['limit'](_0x4cd6fd['query'][_0x3542('0x1f')]);_0x4cb73f['offset']=qs[_0x3542('0x1c')](_0x4cd6fd['query']['offset']);}_0x4cb73f[_0x3542('0x37')]=qs[_0x3542('0x38')](_0x4cd6fd[_0x3542('0x32')][_0x3542('0x38')]);_0x4cb73f[_0x3542('0x39')]=qs[_0x3542('0x3a')](_[_0x3542('0x53')](_0x4cd6fd['query'],_0x271dd0[_0x3542('0x3a')]));if(_0x4cd6fd[_0x3542('0x32')][_0x3542('0x3b')]){_0x4cb73f[_0x3542('0x39')]=_[_0x3542('0x3c')](_0x4cb73f['where'],{'$or':_[_0x3542('0x2c')](_0x4cb73f[_0x3542('0x34')],function(_0x2c5546){var _0x361c42={};_0x361c42[_0x2c5546]={'$like':'%'+_0x4cd6fd[_0x3542('0x32')][_0x3542('0x3b')]+'%'};return _0x361c42;})});}_0x4cb73f[_0x3542('0x39')]=_['merge'](_0x4cb73f[_0x3542('0x39')],{'mailboxuser':_0x60b9c0['mailbox']});_0x4cb73f=_[_0x3542('0x3c')]({},_0x4cb73f,_0x4cd6fd[_0x3542('0x46')]);return db[_0x3542('0x52')][_0x3542('0x54')](_0x4cb73f)['then'](respondWithFilteredResult(_0x1fd8c8,_0x4cb73f));})['catch'](handleError(_0x1fd8c8,null));}; \ No newline at end of file +var _0x3266=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','get','error','stack','name','send','index','VoiceMail','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','find'];(function(_0x4603ee,_0x15f07b){var _0x1692ff=function(_0x424ad3){while(--_0x424ad3){_0x4603ee['push'](_0x4603ee['shift']());}};_0x1692ff(++_0x15f07b);}(_0x3266,0x6a));var _0x6326=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x3266[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){var _0x72d020=_0x2d0d00[_0x6326('0x27')]({'plain':!![]});var _0x575701='Voicemails';return db['UserProfileResource'][_0x6326('0x26')]({'where':{'type':_0x575701,'resourceId':_0x72d020['id']}})['then'](function(){return _0x2d0d00;});})[_0x6326('0x25')](function(){_0x429bb0[_0x6326('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e33d,_0x21ec69){return function(_0xb68fec){if(!_0xb68fec){_0x15e33d[_0x6326('0x1c')](0x194);}return _0xb68fec;};}function handleError(_0x2d2180,_0x45d037){_0x45d037=_0x45d037||0x1f4;return function(_0x40e036){logger[_0x6326('0x28')](_0x40e036[_0x6326('0x29')]);if(_0x40e036[_0x6326('0x2a')]){delete _0x40e036[_0x6326('0x2a')];}_0x2d2180[_0x6326('0x1d')](_0x45d037)[_0x6326('0x2b')](_0x40e036);};}exports[_0x6326('0x2c')]=function(_0x2e0445,_0x20c5ab){var _0x520e57={},_0x2bf5ef={},_0x47303c={'count':0x0,'rows':[]};var _0x1f8982=_['map'](db[_0x6326('0x2d')]['rawAttributes'],function(_0x4e703a){return{'name':_0x4e703a[_0x6326('0x2e')],'type':_0x4e703a[_0x6326('0x2f')][_0x6326('0x30')]};});_0x2bf5ef[_0x6326('0x31')]=_[_0x6326('0x32')](_0x1f8982,_0x6326('0x2a'));_0x2bf5ef[_0x6326('0x33')]=_[_0x6326('0x34')](_0x2e0445[_0x6326('0x33')]);_0x2bf5ef[_0x6326('0x35')]=_[_0x6326('0x36')](_0x2bf5ef[_0x6326('0x31')],_0x2bf5ef['query']);_0x520e57[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2bf5ef['model'],qs[_0x6326('0x38')](_0x2e0445[_0x6326('0x33')][_0x6326('0x38')]));_0x520e57['attributes']=_0x520e57[_0x6326('0x37')]['length']?_0x520e57['attributes']:_0x2bf5ef[_0x6326('0x31')];if(!_0x2e0445[_0x6326('0x33')][_0x6326('0x39')]('nolimit')){_0x520e57[_0x6326('0x3a')]=qs['limit'](_0x2e0445[_0x6326('0x33')]['limit']);_0x520e57[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x2e0445[_0x6326('0x33')][_0x6326('0x1f')]);}_0x520e57[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x2e0445['query'][_0x6326('0x3c')]);_0x520e57[_0x6326('0x3d')]=qs['filters'](_[_0x6326('0x3e')](_0x2e0445['query'],_0x2bf5ef['filters']),_0x1f8982);if(_0x2e0445[_0x6326('0x33')][_0x6326('0x3f')]){_0x520e57[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x520e57[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x1f8982,function(_0x5de1c3){if(_0x5de1c3['type']!==_0x6326('0x41')){var _0x5b68af={};_0x5b68af[_0x5de1c3[_0x6326('0x2a')]]={'$like':'%'+_0x2e0445['query'][_0x6326('0x3f')]+'%'};return _0x5b68af;}})});}_0x520e57=_[_0x6326('0x40')]({},_0x520e57,_0x2e0445[_0x6326('0x42')]);var _0x1da798={'where':_0x520e57[_0x6326('0x3d')]};return db[_0x6326('0x2d')][_0x6326('0x20')](_0x1da798)[_0x6326('0x25')](function(_0x3b089b){_0x47303c[_0x6326('0x20')]=_0x3b089b;if(_0x2e0445[_0x6326('0x33')]['includeAll']){_0x520e57[_0x6326('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x6326('0x44')](_0x520e57);})[_0x6326('0x25')](function(_0x16fc33){_0x47303c[_0x6326('0x45')]=_0x16fc33;return _0x47303c;})['then'](respondWithFilteredResult(_0x20c5ab,_0x520e57))[_0x6326('0x46')](handleError(_0x20c5ab,null));};exports[_0x6326('0x47')]=function(_0x562d5f,_0x12703d){var _0xe6a992={'raw':!![],'where':{'id':_0x562d5f[_0x6326('0x48')]['id']}},_0x7a5057={};_0x7a5057['model']=_[_0x6326('0x34')](db[_0x6326('0x2d')][_0x6326('0x49')]);_0x7a5057[_0x6326('0x33')]=_[_0x6326('0x34')](_0x562d5f[_0x6326('0x33')]);_0x7a5057[_0x6326('0x35')]=_['intersection'](_0x7a5057[_0x6326('0x31')],_0x7a5057[_0x6326('0x33')]);_0xe6a992[_0x6326('0x37')]=_[_0x6326('0x36')](_0x7a5057['model'],qs[_0x6326('0x38')](_0x562d5f['query'][_0x6326('0x38')]));_0xe6a992[_0x6326('0x37')]=_0xe6a992[_0x6326('0x37')][_0x6326('0x4a')]?_0xe6a992[_0x6326('0x37')]:_0x7a5057['model'];if(_0x562d5f[_0x6326('0x33')]['includeAll']){_0xe6a992['include']=[{'all':!![]}];}_0xe6a992=_[_0x6326('0x40')]({},_0xe6a992,_0x562d5f[_0x6326('0x42')]);return db['VoiceMail'][_0x6326('0x4b')](_0xe6a992)[_0x6326('0x25')](handleEntityNotFound(_0x12703d,null))[_0x6326('0x25')](respondWithResult(_0x12703d,null))[_0x6326('0x46')](handleError(_0x12703d,null));};exports[_0x6326('0x4c')]=function(_0x4f8dc0,_0x4af0ee){return db[_0x6326('0x2d')][_0x6326('0x4c')](_0x4f8dc0[_0x6326('0x4d')],{})[_0x6326('0x25')](function(_0x210a1b){var _0x318d19=_0x4f8dc0[_0x6326('0x4e')]['get']({'plain':!![]});if(!_0x318d19)throw new Error(_0x6326('0x4f'));if(_0x318d19[_0x6326('0x50')]===_0x6326('0x4e')){var _0x3e7674=_0x210a1b[_0x6326('0x27')]({'plain':!![]});var _0x4ff8e6=_0x6326('0x51');return db['UserProfileSection'][_0x6326('0x4b')]({'where':{'name':_0x4ff8e6,'userProfileId':_0x318d19[_0x6326('0x52')]},'raw':!![]})['then'](function(_0x37b045){if(_0x37b045&&_0x37b045['autoAssociation']===0x0){return db[_0x6326('0x53')][_0x6326('0x4c')]({'name':_0x3e7674[_0x6326('0x2a')],'resourceId':_0x3e7674['id'],'type':_0x37b045[_0x6326('0x2a')],'sectionId':_0x37b045['id']},{})['then'](function(){return _0x210a1b;});}else{return _0x210a1b;}})[_0x6326('0x46')](function(_0xbe6b3e){logger['error'](_0x6326('0x54'),_0xbe6b3e);throw _0xbe6b3e;});}return _0x210a1b;})[_0x6326('0x25')](respondWithResult(_0x4af0ee,0xc9))[_0x6326('0x46')](handleError(_0x4af0ee,null));};exports['update']=function(_0x2bece1,_0x2ac64b){if(_0x2bece1['body']['id']){delete _0x2bece1[_0x6326('0x4d')]['id'];}return db['VoiceMail'][_0x6326('0x4b')]({'where':{'id':_0x2bece1[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x2ac64b,null))[_0x6326('0x25')](saveUpdates(_0x2bece1[_0x6326('0x4d')],null))[_0x6326('0x25')](respondWithResult(_0x2ac64b,null))[_0x6326('0x46')](handleError(_0x2ac64b,null));};exports['destroy']=function(_0x51adce,_0x4d4de7){return db[_0x6326('0x2d')]['find']({'where':{'id':_0x51adce[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4d4de7,null))[_0x6326('0x25')](removeEntity(_0x4d4de7,null))[_0x6326('0x46')](handleError(_0x4d4de7,null));};exports[_0x6326('0x55')]=function(_0x4b5bc6,_0x23bf64,_0x2e4244){return db['VoiceMail'][_0x6326('0x56')]({'where':{'id':_0x4b5bc6[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x23bf64,null))[_0x6326('0x25')](function(_0x45e3d5){var _0x36f2f5;var _0x320d43={},_0x2f624f={};_0x2f624f[_0x6326('0x31')]=_[_0x6326('0x34')](db['VoiceMailMessage'][_0x6326('0x49')]);_0x2f624f[_0x6326('0x33')]=_[_0x6326('0x34')](_0x4b5bc6[_0x6326('0x33')]);_0x2f624f['filters']=_['intersection'](_0x2f624f[_0x6326('0x31')],_0x2f624f[_0x6326('0x33')]);_0x320d43[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2f624f[_0x6326('0x31')],qs['fields'](_0x4b5bc6['query'][_0x6326('0x38')]));_0x320d43[_0x6326('0x37')]=_0x320d43[_0x6326('0x37')][_0x6326('0x4a')]?_0x320d43['attributes']:_0x2f624f[_0x6326('0x31')];if(!_0x4b5bc6[_0x6326('0x33')][_0x6326('0x39')](_0x6326('0x57'))){_0x320d43[_0x6326('0x3a')]=qs[_0x6326('0x3a')](_0x4b5bc6['query'][_0x6326('0x3a')]);_0x320d43['offset']=qs[_0x6326('0x1f')](_0x4b5bc6[_0x6326('0x33')]['offset']);}_0x320d43[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3c')]);_0x320d43[_0x6326('0x3d')]=qs[_0x6326('0x35')](_[_0x6326('0x3e')](_0x4b5bc6[_0x6326('0x33')],_0x2f624f[_0x6326('0x35')]));if(_0x4b5bc6[_0x6326('0x33')]['filter']){_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x320d43[_0x6326('0x37')],function(_0x5599da){var _0x299795={};_0x299795[_0x5599da]={'$like':'%'+_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3f')]+'%'};return _0x299795;})});}_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43['where'],{'mailboxuser':_0x45e3d5[_0x6326('0x58')]});_0x320d43=_['merge']({},_0x320d43,_0x4b5bc6['options']);return db[_0x6326('0x59')][_0x6326('0x5a')](_0x320d43)[_0x6326('0x25')](respondWithFilteredResult(_0x23bf64,_0x320d43));})[_0x6326('0x46')](handleError(_0x23bf64,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 8fd843f..519e708 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 _0x1b90=['mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x1b90,0xe2));var _0x01b9=function(_0x130149,_0x535e7e){_0x130149=_0x130149-0x0;var _0x2afdb3=_0x1b90[_0x130149];return _0x2afdb3;};'use strict';var _=require(_0x01b9('0x0'));var util=require(_0x01b9('0x1'));var logger=require(_0x01b9('0x2'))(_0x01b9('0x3'));var moment=require(_0x01b9('0x4'));var BPromise=require(_0x01b9('0x5'));var rp=require(_0x01b9('0x6'));var fs=require('fs');var path=require(_0x01b9('0x7'));var rimraf=require(_0x01b9('0x8'));var config=require(_0x01b9('0x9'));var attributes=require('./voiceMail.attributes');module[_0x01b9('0xa')]=function(_0x2cf67f,_0x3730e5){return _0x2cf67f[_0x01b9('0xb')](_0x01b9('0xc'),attributes,{'tableName':_0x01b9('0xd'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x01b9('0xe'),_0x01b9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c6=['path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2ce9d,_0x4ff962){var _0x578428=function(_0x2e0888){while(--_0x2e0888){_0x2ce9d['push'](_0x2ce9d['shift']());}};_0x578428(++_0x4ff962);}(_0xc9c6,0x13a));var _0x6c9c=function(_0x476590,_0x1584b7){_0x476590=_0x476590-0x0;var _0x3ff441=_0xc9c6[_0x476590];return _0x3ff441;};'use strict';var _=require(_0x6c9c('0x0'));var util=require(_0x6c9c('0x1'));var logger=require(_0x6c9c('0x2'))('api');var moment=require(_0x6c9c('0x3'));var BPromise=require(_0x6c9c('0x4'));var rp=require(_0x6c9c('0x5'));var fs=require('fs');var path=require(_0x6c9c('0x6'));var rimraf=require(_0x6c9c('0x7'));var config=require('../../config/environment');var attributes=require(_0x6c9c('0x8'));module[_0x6c9c('0x9')]=function(_0x2f8b2f,_0x3b857e){return _0x2f8b2f[_0x6c9c('0xa')](_0x6c9c('0xb'),attributes,{'tableName':_0x6c9c('0xc'),'paranoid':![],'indexes':[{'name':_0x6c9c('0xd'),'fields':[_0x6c9c('0xe'),_0x6c9c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index cc5c625..1bcbb23 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 _0x951b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x951b,0x1b7));var _0xb951=function(_0x4ae567,_0x43bf2d){_0x4ae567=_0x4ae567-0x0;var _0x4d54b4=_0x951b[_0x4ae567];return _0x4d54b4;};'use strict';var _=require('lodash');var util=require(_0xb951('0x0'));var moment=require(_0xb951('0x1'));var BPromise=require(_0xb951('0x2'));var rs=require(_0xb951('0x3'));var fs=require('fs');var Redis=require(_0xb951('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb951('0x5'));var logger=require(_0xb951('0x6'))(_0xb951('0x7'));var config=require(_0xb951('0x8'));var jayson=require(_0xb951('0x9'));var client=jayson[_0xb951('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9cd35e,_0x56339c,_0x1f8cc4){return new BPromise(function(_0x270717,_0x23dc50){return client['request'](_0x9cd35e,_0x1f8cc4)[_0xb951('0xb')](function(_0x4637cb){logger[_0xb951('0xc')]('VoiceMail,\x20%s,\x20%s',_0x56339c,'request\x20sent');logger['debug'](_0xb951('0xd'),_0x56339c,_0xb951('0xe'),JSON[_0xb951('0xf')](_0x4637cb));if(_0x4637cb[_0xb951('0x10')]){if(_0x4637cb['error'][_0xb951('0x11')]===0x1f4){logger[_0xb951('0x10')](_0xb951('0x12'),_0x56339c,_0x4637cb['error'][_0xb951('0x13')]);return _0x23dc50(_0x4637cb[_0xb951('0x10')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x56339c,_0x4637cb[_0xb951('0x10')][_0xb951('0x13')]);return _0x270717(_0x4637cb[_0xb951('0x10')][_0xb951('0x13')]);}else{logger[_0xb951('0xc')](_0xb951('0x12'),_0x56339c,'request\x20sent');_0x270717(_0x4637cb[_0xb951('0x14')][_0xb951('0x13')]);}})[_0xb951('0x15')](function(_0x319af7){logger[_0xb951('0x10')](_0xb951('0x12'),_0x56339c,_0x319af7);_0x23dc50(_0x319af7);});});} \ No newline at end of file +var _0x7530=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x5d7d9f,_0x4de9c1){var _0x3d7bb8=function(_0x42193a){while(--_0x42193a){_0x5d7d9f['push'](_0x5d7d9f['shift']());}};_0x3d7bb8(++_0x4de9c1);}(_0x7530,0x1dc));var _0x0753=function(_0x1b1c4f,_0x32eb9c){_0x1b1c4f=_0x1b1c4f-0x0;var _0x3f02c1=_0x7530[_0x1b1c4f];return _0x3f02c1;};'use strict';var _=require(_0x0753('0x0'));var util=require('util');var moment=require(_0x0753('0x1'));var BPromise=require(_0x0753('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0753('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0753('0x4'));var logger=require(_0x0753('0x5'))(_0x0753('0x6'));var config=require(_0x0753('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0753('0x8')][_0x0753('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18af81,_0x3d9b4a,_0x129a5a){return new BPromise(function(_0x32691b,_0x11a1da){return client['request'](_0x18af81,_0x129a5a)['then'](function(_0x4c3152){logger[_0x0753('0xa')](_0x0753('0xb'),_0x3d9b4a,_0x0753('0xc'));logger['debug'](_0x0753('0xd'),_0x3d9b4a,_0x0753('0xc'),JSON['stringify'](_0x4c3152));if(_0x4c3152[_0x0753('0xe')]){if(_0x4c3152[_0x0753('0xe')]['code']===0x1f4){logger[_0x0753('0xe')](_0x0753('0xb'),_0x3d9b4a,_0x4c3152[_0x0753('0xe')][_0x0753('0xf')]);return _0x11a1da(_0x4c3152['error'][_0x0753('0xf')]);}logger[_0x0753('0xe')](_0x0753('0xb'),_0x3d9b4a,_0x4c3152['error'][_0x0753('0xf')]);return _0x32691b(_0x4c3152[_0x0753('0xe')][_0x0753('0xf')]);}else{logger[_0x0753('0xa')]('VoiceMail,\x20%s,\x20%s',_0x3d9b4a,_0x0753('0xc'));_0x32691b(_0x4c3152['result'][_0x0753('0xf')]);}})[_0x0753('0x10')](function(_0x1b5bf6){logger[_0x0753('0xe')](_0x0753('0xb'),_0x3d9b4a,_0x1b5bf6);_0x11a1da(_0x1b5bf6);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index dac074c..31b2ecf 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 _0xe4b3=['create','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','download','post'];(function(_0x5efc92,_0x39c025){var _0x239547=function(_0x42c7d5){while(--_0x42c7d5){_0x5efc92['push'](_0x5efc92['shift']());}};_0x239547(++_0x39c025);}(_0xe4b3,0x191));var _0x3e4b=function(_0xb42660,_0x26771f){_0xb42660=_0xb42660-0x0;var _0x1543b1=_0xe4b3[_0xb42660];return _0x1543b1;};'use strict';var multer=require('multer');var util=require(_0x3e4b('0x0'));var path=require(_0x3e4b('0x1'));var timeout=require(_0x3e4b('0x2'));var express=require('express');var router=express[_0x3e4b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3e4b('0x4'));var interaction=require(_0x3e4b('0x5'));var config=require(_0x3e4b('0x6'));var controller=require(_0x3e4b('0x7'));router[_0x3e4b('0x8')]('/',auth[_0x3e4b('0x9')](),controller[_0x3e4b('0xa')]);router[_0x3e4b('0x8')]('/:id',auth[_0x3e4b('0x9')](),controller['show']);router[_0x3e4b('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x3e4b('0xb')]);router[_0x3e4b('0xc')]('/',auth['isAuthenticated'](),controller[_0x3e4b('0xd')]);router['put'](_0x3e4b('0xe'),auth[_0x3e4b('0x9')](),controller[_0x3e4b('0xf')]);router['delete'](_0x3e4b('0xe'),auth[_0x3e4b('0x9')](),controller[_0x3e4b('0x10')]);module[_0x3e4b('0x11')]=router; \ No newline at end of file +var _0x1b98=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','exports'];(function(_0x25e350,_0x43988b){var _0x4391b8=function(_0x4beaa0){while(--_0x4beaa0){_0x25e350['push'](_0x25e350['shift']());}};_0x4391b8(++_0x43988b);}(_0x1b98,0x104));var _0x81b9=function(_0x5da7e6,_0x530b9d){_0x5da7e6=_0x5da7e6-0x0;var _0x37e766=_0x1b98[_0x5da7e6];return _0x37e766;};'use strict';var multer=require(_0x81b9('0x0'));var util=require(_0x81b9('0x1'));var path=require(_0x81b9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x81b9('0x3'));var auth=require(_0x81b9('0x4'));var interaction=require(_0x81b9('0x5'));var config=require(_0x81b9('0x6'));var controller=require(_0x81b9('0x7'));router[_0x81b9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x81b9('0x9'),auth[_0x81b9('0xa')](),controller[_0x81b9('0xb')]);router[_0x81b9('0x8')](_0x81b9('0xc'),auth[_0x81b9('0xa')](),controller[_0x81b9('0xd')]);router[_0x81b9('0xe')]('/',auth[_0x81b9('0xa')](),controller[_0x81b9('0xf')]);router[_0x81b9('0x10')]('/:id',auth[_0x81b9('0xa')](),controller[_0x81b9('0x11')]);router[_0x81b9('0x12')]('/:id',auth[_0x81b9('0xa')](),controller['destroy']);module[_0x81b9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 087908b..9a3ecdf 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 _0xc4bb=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x4e9807,_0x4db838){var _0x4810b8=function(_0x3fa7a3){while(--_0x3fa7a3){_0x4e9807['push'](_0x4e9807['shift']());}};_0x4810b8(++_0x4db838);}(_0xc4bb,0x86));var _0xbc4b=function(_0x340f41,_0x240d30){_0x340f41=_0x340f41-0x0;var _0x5f063f=_0xc4bb[_0x340f41];return _0x5f063f;};'use strict';var Sequelize=require(_0xbc4b('0x0'));module[_0xbc4b('0x1')]={'name':{'type':Sequelize[_0xbc4b('0x2')],'get':function(_0x5dd431){return this[_0xbc4b('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xbc4b('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xbc4b('0x6')](_0xbc4b('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xbc4b('0x5')],'defaultValue':''},'stamp':{'type':_0xbc4b('0x8'),'defaultValue':Sequelize[_0xbc4b('0x9')](_0xbc4b('0xa'))}}; \ No newline at end of file +var _0x415c=['exports','VIRTUAL','getDataValue','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x27685e,_0x845417){var _0x224a6f=function(_0x24bd2b){while(--_0x24bd2b){_0x27685e['push'](_0x27685e['shift']());}};_0x224a6f(++_0x845417);}(_0x415c,0xb8));var _0xc415=function(_0x5d829d,_0x14680a){_0x5d829d=_0x5d829d-0x0;var _0x25a70f=_0x415c[_0x5d829d];return _0x25a70f;};'use strict';var Sequelize=require('sequelize');module[_0xc415('0x0')]={'name':{'type':Sequelize[_0xc415('0x1')],'get':function(_0x61c03c){return this[_0xc415('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xc415('0x4')](_0xc415('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc415('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xc415('0x6')](_0xc415('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index fa8b1b8..822d1dc 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 _0x1e9e=['attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition'];(function(_0x54af86,_0x44732e){var _0x1659c4=function(_0x490ed8){while(--_0x490ed8){_0x54af86['push'](_0x54af86['shift']());}};_0x1659c4(++_0x44732e);}(_0x1e9e,0xa0));var _0xe1e9=function(_0x3ba66f,_0x1b5ee3){_0x3ba66f=_0x3ba66f-0x0;var _0x108b1c=_0x1e9e[_0x3ba66f];return _0x108b1c;};'use strict';var emlformat=require(_0xe1e9('0x0'));var rimraf=require(_0xe1e9('0x1'));var zipdir=require(_0xe1e9('0x2'));var jsonpatch=require(_0xe1e9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe1e9('0x4'));var Mustache=require(_0xe1e9('0x5'));var util=require(_0xe1e9('0x6'));var path=require('path');var sox=require(_0xe1e9('0x7'));var csv=require(_0xe1e9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1e9('0x9'));var _=require(_0xe1e9('0xa'));var squel=require(_0xe1e9('0xb'));var crypto=require(_0xe1e9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe1e9('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe1e9('0xe'));var authService=require(_0xe1e9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe1e9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1e9('0x11'))('api');var utils=require(_0xe1e9('0x12'));var config=require(_0xe1e9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe1e9('0x14'))['db'];function respondWithStatusCode(_0x46c9b6,_0x2a03ba){_0x2a03ba=_0x2a03ba||0xcc;return function(_0x3451a4){if(_0x3451a4){return _0x46c9b6[_0xe1e9('0x15')](_0x2a03ba);}return _0x46c9b6[_0xe1e9('0x16')](_0x2a03ba)[_0xe1e9('0x17')]();};}function respondWithResult(_0x5f59e7,_0x641b67){_0x641b67=_0x641b67||0xc8;return function(_0x383d34){if(_0x383d34){return _0x5f59e7[_0xe1e9('0x16')](_0x641b67)['json'](_0x383d34);}};}function respondWithFilteredResult(_0x388db0,_0x367a66){return function(_0x4c2aa5){if(_0x4c2aa5){var _0x1d8aef=typeof _0x367a66[_0xe1e9('0x18')]===_0xe1e9('0x19')&&typeof _0x367a66['limit']===_0xe1e9('0x19');var _0x50fdb5=_0x4c2aa5['count'];var _0xf7965=_0x1d8aef?0x0:_0x367a66[_0xe1e9('0x18')];var _0xc5f385=_0x1d8aef?_0x4c2aa5[_0xe1e9('0x1a')]:_0x367a66['offset']+_0x367a66[_0xe1e9('0x1b')];var _0x2c8393;if(_0xc5f385>=_0x50fdb5){_0xc5f385=_0x50fdb5;_0x2c8393=0xc8;}else{_0x2c8393=0xce;}_0x388db0['status'](_0x2c8393);return _0x388db0[_0xe1e9('0x1c')](_0xe1e9('0x1d'),_0xf7965+'-'+_0xc5f385+'/'+_0x50fdb5)[_0xe1e9('0x1e')](_0x4c2aa5);}return null;};}function patchUpdates(_0x4f4389){return function(_0x1403c1){try{jsonpatch[_0xe1e9('0x1f')](_0x1403c1,_0x4f4389,!![]);}catch(_0x332644){return BPromise['reject'](_0x332644);}return _0x1403c1[_0xe1e9('0x20')]();};}function saveUpdates(_0x5006b7,_0xff6b9){return function(_0x4bb8d3){if(_0x4bb8d3){return _0x4bb8d3['update'](_0x5006b7)[_0xe1e9('0x21')](function(_0x1745ea){return _0x1745ea;});}return null;};}function removeEntity(_0x42fcdb,_0x3e3d72){return function(_0x24d347){if(_0x24d347){return _0x24d347[_0xe1e9('0x22')]()[_0xe1e9('0x21')](function(){_0x42fcdb['status'](0xcc)[_0xe1e9('0x17')]();});}};}function handleEntityNotFound(_0x244d69,_0x4b8bc9){return function(_0x6d5c4f){if(!_0x6d5c4f){_0x244d69['sendStatus'](0x194);}return _0x6d5c4f;};}function handleError(_0x438476,_0x3a0d5b){_0x3a0d5b=_0x3a0d5b||0x1f4;return function(_0x4f589f){logger[_0xe1e9('0x23')](_0x4f589f[_0xe1e9('0x24')]);if(_0x4f589f[_0xe1e9('0x25')]){delete _0x4f589f[_0xe1e9('0x25')];}_0x438476['status'](_0x3a0d5b)[_0xe1e9('0x26')](_0x4f589f);};}exports[_0xe1e9('0x27')]=function(_0x103b66,_0x5eda21){var _0x1b06e1={},_0x531cdb={},_0x34611e={'count':0x0,'rows':[]};var _0x39d52e=_[_0xe1e9('0x28')](db[_0xe1e9('0x29')][_0xe1e9('0x2a')],function(_0x16a64c){return{'name':_0x16a64c[_0xe1e9('0x2b')],'type':_0x16a64c['type'][_0xe1e9('0x2c')]};});_0x531cdb[_0xe1e9('0x2d')]=_[_0xe1e9('0x2e')](_[_0xe1e9('0x28')](_0x39d52e,_0xe1e9('0x25')),[_0xe1e9('0x25')]);_0x531cdb[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x103b66['query']);_0x531cdb[_0xe1e9('0x31')]=_['intersection'](_0x531cdb[_0xe1e9('0x2d')],_0x531cdb['query']);_0x1b06e1[_0xe1e9('0x32')]=_[_0xe1e9('0x33')](_0x531cdb[_0xe1e9('0x2d')],qs[_0xe1e9('0x34')](_0x103b66[_0xe1e9('0x2f')]['fields']));_0x1b06e1[_0xe1e9('0x32')]=_0x1b06e1[_0xe1e9('0x32')][_0xe1e9('0x35')]?_0x1b06e1['attributes']:_0x531cdb[_0xe1e9('0x2d')];if(!_0x103b66[_0xe1e9('0x2f')]['hasOwnProperty'](_0xe1e9('0x36'))){_0x1b06e1[_0xe1e9('0x1b')]=qs['limit'](_0x103b66[_0xe1e9('0x2f')][_0xe1e9('0x1b')]);_0x1b06e1['offset']=qs[_0xe1e9('0x18')](_0x103b66[_0xe1e9('0x2f')][_0xe1e9('0x18')]);}_0x1b06e1[_0xe1e9('0x37')]=qs[_0xe1e9('0x38')](_0x103b66[_0xe1e9('0x2f')][_0xe1e9('0x38')]);_0x1b06e1[_0xe1e9('0x39')]=qs['filters'](_[_0xe1e9('0x3a')](_0x103b66[_0xe1e9('0x2f')],_0x531cdb[_0xe1e9('0x31')]),_0x39d52e);if(_0x103b66['query'][_0xe1e9('0x3b')]){_0x1b06e1['where']=_[_0xe1e9('0x3c')](_0x1b06e1[_0xe1e9('0x39')],{'$or':_['map'](_0x39d52e,function(_0x18b296){if(_0x18b296['type']!==_0xe1e9('0x3d')){var _0x39b935={};_0x39b935[_0x18b296[_0xe1e9('0x25')]]={'$like':'%'+_0x103b66['query']['filter']+'%'};return _0x39b935;}})});}_0x1b06e1=_[_0xe1e9('0x3c')]({},_0x1b06e1,_0x103b66[_0xe1e9('0x3e')]);var _0x2b7a48={'where':_0x1b06e1[_0xe1e9('0x39')]};return db[_0xe1e9('0x29')][_0xe1e9('0x1a')](_0x2b7a48)[_0xe1e9('0x21')](function(_0x534d2d){_0x34611e['count']=_0x534d2d;if(_0x103b66[_0xe1e9('0x2f')][_0xe1e9('0x3f')]){_0x1b06e1['include']=[{'all':!![]}];}return db[_0xe1e9('0x29')][_0xe1e9('0x40')](_0x1b06e1);})[_0xe1e9('0x21')](function(_0x4d64e5){_0x34611e[_0xe1e9('0x41')]=_0x4d64e5;return _0x34611e;})['then'](respondWithFilteredResult(_0x5eda21,_0x1b06e1))[_0xe1e9('0x42')](handleError(_0x5eda21,null));};exports[_0xe1e9('0x43')]=function(_0x3c5080,_0x3616f3){var _0x38acc5={'raw':!![],'where':{'id':_0x3c5080[_0xe1e9('0x44')]['id']}},_0x850dd9={};_0x850dd9[_0xe1e9('0x2d')]=_[_0xe1e9('0x30')](db[_0xe1e9('0x29')][_0xe1e9('0x2a')]);_0x850dd9[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x3c5080['query']);_0x850dd9['filters']=_[_0xe1e9('0x33')](_0x850dd9[_0xe1e9('0x2d')],_0x850dd9[_0xe1e9('0x2f')]);_0x38acc5[_0xe1e9('0x32')]=_[_0xe1e9('0x33')](_0x850dd9['model'],qs['fields'](_0x3c5080[_0xe1e9('0x2f')][_0xe1e9('0x34')]));_0x38acc5[_0xe1e9('0x32')]=_0x38acc5[_0xe1e9('0x32')][_0xe1e9('0x35')]?_0x38acc5[_0xe1e9('0x32')]:_0x850dd9[_0xe1e9('0x2d')];if(_0x3c5080[_0xe1e9('0x2f')][_0xe1e9('0x3f')]){_0x38acc5['include']=[{'all':!![]}];}_0x38acc5=_[_0xe1e9('0x3c')]({},_0x38acc5,_0x3c5080[_0xe1e9('0x3e')]);return db[_0xe1e9('0x29')][_0xe1e9('0x45')](_0x38acc5)[_0xe1e9('0x21')](handleEntityNotFound(_0x3616f3,null))[_0xe1e9('0x21')](respondWithResult(_0x3616f3,null))[_0xe1e9('0x42')](handleError(_0x3616f3,null));};exports[_0xe1e9('0x46')]=function(_0x2eb813,_0x244c30){return db[_0xe1e9('0x29')][_0xe1e9('0x46')](_0x2eb813[_0xe1e9('0x47')],{})[_0xe1e9('0x21')](respondWithResult(_0x244c30,0xc9))[_0xe1e9('0x42')](handleError(_0x244c30,null));};exports['update']=function(_0x261340,_0x2f3f5f){if(_0x261340[_0xe1e9('0x47')]['id']){delete _0x261340['body']['id'];}return db[_0xe1e9('0x29')][_0xe1e9('0x45')]({'where':{'id':_0x261340['params']['id']}})[_0xe1e9('0x21')](handleEntityNotFound(_0x2f3f5f,null))['then'](saveUpdates(_0x261340[_0xe1e9('0x47')],null))[_0xe1e9('0x21')](respondWithResult(_0x2f3f5f,null))[_0xe1e9('0x42')](handleError(_0x2f3f5f,null));};exports[_0xe1e9('0x22')]=function(_0x4f95fd,_0xd956d0){return db[_0xe1e9('0x29')][_0xe1e9('0x45')]({'where':{'id':_0x4f95fd[_0xe1e9('0x44')]['id']}})[_0xe1e9('0x21')](handleEntityNotFound(_0xd956d0,null))[_0xe1e9('0x21')](removeEntity(_0xd956d0,null))[_0xe1e9('0x42')](handleError(_0xd956d0,null));};exports['download']=function(_0x3907f1,_0x56b1d1,_0x5bcedd){return db[_0xe1e9('0x29')][_0xe1e9('0x45')]({'where':{'id':_0x3907f1[_0xe1e9('0x44')]['id']},'attributes':['id',_0xe1e9('0x48'),'msg_id']})['then'](handleEntityNotFound(_0x56b1d1,null))['then'](function(_0x21eef9){if(_0x21eef9){if(!_0x21eef9[_0xe1e9('0x48')]){throw new db['Sequelize'][(_0xe1e9('0x49'))](_0xe1e9('0x4a'));}var _0x4c0e77={'Content-Type':_0xe1e9('0x4b'),'Content-Disposition':'attachment'};if(_0x21eef9['msg_id']){_0x4c0e77[_0xe1e9('0x4c')]=_0xe1e9('0x4d')+_0x21eef9['msg_id']+_0xe1e9('0x4e');}_0x56b1d1[_0xe1e9('0x1c')](_0x4c0e77);return _0x56b1d1['send'](new Buffer(_0x21eef9[_0xe1e9('0x48')]));}})['catch'](handleError(_0x56b1d1,null));}; \ No newline at end of file +var _0xfebf=['ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','map','VoiceMailMessage','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','catch','create','body','find','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0xee821,_0x4f7790){var _0x2a202f=function(_0x12ca9b){while(--_0x12ca9b){_0xee821['push'](_0xee821['shift']());}};_0x2a202f(++_0x4f7790);}(_0xfebf,0x1d6));var _0xffeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xffeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffeb('0x1'));var jsonpatch=require(_0xffeb('0x2'));var rp=require(_0xffeb('0x3'));var moment=require(_0xffeb('0x4'));var BPromise=require(_0xffeb('0x5'));var Mustache=require(_0xffeb('0x6'));var util=require(_0xffeb('0x7'));var path=require(_0xffeb('0x8'));var sox=require('sox');var csv=require(_0xffeb('0x9'));var ejs=require(_0xffeb('0xa'));var fs=require('fs');var fs_extra=require(_0xffeb('0xb'));var _=require(_0xffeb('0xc'));var squel=require(_0xffeb('0xd'));var crypto=require('crypto');var jsforce=require(_0xffeb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffeb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xffeb('0xf'));var authService=require(_0xffeb('0x10'));var qs=require(_0xffeb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffeb('0x12'));var utils=require(_0xffeb('0x13'));var config=require(_0xffeb('0x14'));var licenseUtil=require(_0xffeb('0x15'));var db=require(_0xffeb('0x16'))['db'];function respondWithStatusCode(_0x119454,_0x4a8bfc){_0x4a8bfc=_0x4a8bfc||0xcc;return function(_0x22c20e){if(_0x22c20e){return _0x119454[_0xffeb('0x17')](_0x4a8bfc);}return _0x119454[_0xffeb('0x18')](_0x4a8bfc)[_0xffeb('0x19')]();};}function respondWithResult(_0x3fbff9,_0x136852){_0x136852=_0x136852||0xc8;return function(_0x64021a){if(_0x64021a){return _0x3fbff9[_0xffeb('0x18')](_0x136852)[_0xffeb('0x1a')](_0x64021a);}};}function respondWithFilteredResult(_0x5cab0f,_0x10f4b6){return function(_0x18aecf){if(_0x18aecf){var _0x5524c0=typeof _0x10f4b6[_0xffeb('0x1b')]==='undefined'&&typeof _0x10f4b6['limit']===_0xffeb('0x1c');var _0x1c878f=_0x18aecf[_0xffeb('0x1d')];var _0x141f28=_0x5524c0?0x0:_0x10f4b6[_0xffeb('0x1b')];var _0x245765=_0x5524c0?_0x18aecf[_0xffeb('0x1d')]:_0x10f4b6['offset']+_0x10f4b6[_0xffeb('0x1e')];var _0x547279;if(_0x245765>=_0x1c878f){_0x245765=_0x1c878f;_0x547279=0xc8;}else{_0x547279=0xce;}_0x5cab0f[_0xffeb('0x18')](_0x547279);return _0x5cab0f[_0xffeb('0x1f')]('Content-Range',_0x141f28+'-'+_0x245765+'/'+_0x1c878f)[_0xffeb('0x1a')](_0x18aecf);}return null;};}function patchUpdates(_0x1a557e){return function(_0x7ef9b1){try{jsonpatch['apply'](_0x7ef9b1,_0x1a557e,!![]);}catch(_0x37c02b){return BPromise[_0xffeb('0x20')](_0x37c02b);}return _0x7ef9b1[_0xffeb('0x21')]();};}function saveUpdates(_0x43d70b,_0x510be7){return function(_0x5eb3d2){if(_0x5eb3d2){return _0x5eb3d2[_0xffeb('0x22')](_0x43d70b)[_0xffeb('0x23')](function(_0x1b05f3){return _0x1b05f3;});}return null;};}function removeEntity(_0x3ac5a8,_0x4906c2){return function(_0x45d1d6){if(_0x45d1d6){return _0x45d1d6[_0xffeb('0x24')]()['then'](function(){_0x3ac5a8[_0xffeb('0x18')](0xcc)[_0xffeb('0x19')]();});}};}function handleEntityNotFound(_0x2c23eb,_0x3c80d8){return function(_0x1f28d3){if(!_0x1f28d3){_0x2c23eb[_0xffeb('0x17')](0x194);}return _0x1f28d3;};}function handleError(_0x45cad2,_0xfb43fa){_0xfb43fa=_0xfb43fa||0x1f4;return function(_0x397858){logger[_0xffeb('0x25')](_0x397858[_0xffeb('0x26')]);if(_0x397858[_0xffeb('0x27')]){delete _0x397858[_0xffeb('0x27')];}_0x45cad2[_0xffeb('0x18')](_0xfb43fa)['send'](_0x397858);};}exports['index']=function(_0x3e4a54,_0x255829){var _0xd47405={},_0xc06ef5={},_0x3a576e={'count':0x0,'rows':[]};var _0x55e537=_[_0xffeb('0x28')](db[_0xffeb('0x29')]['rawAttributes'],function(_0x314312){return{'name':_0x314312[_0xffeb('0x2a')],'type':_0x314312['type'][_0xffeb('0x2b')]};});_0xc06ef5[_0xffeb('0x2c')]=_[_0xffeb('0x2d')](_[_0xffeb('0x28')](_0x55e537,_0xffeb('0x27')),[_0xffeb('0x27')]);_0xc06ef5[_0xffeb('0x2e')]=_['keys'](_0x3e4a54[_0xffeb('0x2e')]);_0xc06ef5[_0xffeb('0x2f')]=_[_0xffeb('0x30')](_0xc06ef5[_0xffeb('0x2c')],_0xc06ef5['query']);_0xd47405[_0xffeb('0x31')]=_[_0xffeb('0x30')](_0xc06ef5[_0xffeb('0x2c')],qs[_0xffeb('0x32')](_0x3e4a54[_0xffeb('0x2e')][_0xffeb('0x32')]));_0xd47405[_0xffeb('0x31')]=_0xd47405[_0xffeb('0x31')][_0xffeb('0x33')]?_0xd47405[_0xffeb('0x31')]:_0xc06ef5[_0xffeb('0x2c')];if(!_0x3e4a54[_0xffeb('0x2e')]['hasOwnProperty']('nolimit')){_0xd47405[_0xffeb('0x1e')]=qs['limit'](_0x3e4a54['query']['limit']);_0xd47405['offset']=qs[_0xffeb('0x1b')](_0x3e4a54['query']['offset']);}_0xd47405[_0xffeb('0x34')]=qs[_0xffeb('0x35')](_0x3e4a54[_0xffeb('0x2e')]['sort']);_0xd47405[_0xffeb('0x36')]=qs[_0xffeb('0x2f')](_[_0xffeb('0x37')](_0x3e4a54[_0xffeb('0x2e')],_0xc06ef5[_0xffeb('0x2f')]),_0x55e537);if(_0x3e4a54[_0xffeb('0x2e')][_0xffeb('0x38')]){_0xd47405[_0xffeb('0x36')]=_['merge'](_0xd47405[_0xffeb('0x36')],{'$or':_[_0xffeb('0x28')](_0x55e537,function(_0x28d8d2){if(_0x28d8d2[_0xffeb('0x39')]!==_0xffeb('0x3a')){var _0x528af0={};_0x528af0[_0x28d8d2['name']]={'$like':'%'+_0x3e4a54[_0xffeb('0x2e')][_0xffeb('0x38')]+'%'};return _0x528af0;}})});}_0xd47405=_[_0xffeb('0x3b')]({},_0xd47405,_0x3e4a54['options']);var _0x41d9fa={'where':_0xd47405[_0xffeb('0x36')]};return db['VoiceMailMessage'][_0xffeb('0x1d')](_0x41d9fa)['then'](function(_0xb40433){_0x3a576e[_0xffeb('0x1d')]=_0xb40433;if(_0x3e4a54[_0xffeb('0x2e')][_0xffeb('0x3c')]){_0xd47405[_0xffeb('0x3d')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xffeb('0x3e')](_0xd47405);})[_0xffeb('0x23')](function(_0x1455e8){_0x3a576e[_0xffeb('0x3f')]=_0x1455e8;return _0x3a576e;})['then'](respondWithFilteredResult(_0x255829,_0xd47405))['catch'](handleError(_0x255829,null));};exports[_0xffeb('0x40')]=function(_0x20364b,_0x2312b4){var _0x2e4c16={'raw':!![],'where':{'id':_0x20364b[_0xffeb('0x41')]['id']}},_0x5165d2={};_0x5165d2[_0xffeb('0x2c')]=_[_0xffeb('0x42')](db[_0xffeb('0x29')][_0xffeb('0x43')]);_0x5165d2['query']=_[_0xffeb('0x42')](_0x20364b[_0xffeb('0x2e')]);_0x5165d2['filters']=_[_0xffeb('0x30')](_0x5165d2['model'],_0x5165d2[_0xffeb('0x2e')]);_0x2e4c16[_0xffeb('0x31')]=_['intersection'](_0x5165d2['model'],qs[_0xffeb('0x32')](_0x20364b[_0xffeb('0x2e')][_0xffeb('0x32')]));_0x2e4c16[_0xffeb('0x31')]=_0x2e4c16['attributes'][_0xffeb('0x33')]?_0x2e4c16[_0xffeb('0x31')]:_0x5165d2['model'];if(_0x20364b[_0xffeb('0x2e')][_0xffeb('0x3c')]){_0x2e4c16[_0xffeb('0x3d')]=[{'all':!![]}];}_0x2e4c16=_['merge']({},_0x2e4c16,_0x20364b[_0xffeb('0x44')]);return db[_0xffeb('0x29')]['find'](_0x2e4c16)[_0xffeb('0x23')](handleEntityNotFound(_0x2312b4,null))['then'](respondWithResult(_0x2312b4,null))[_0xffeb('0x45')](handleError(_0x2312b4,null));};exports[_0xffeb('0x46')]=function(_0x52c543,_0x4120ca){return db[_0xffeb('0x29')][_0xffeb('0x46')](_0x52c543[_0xffeb('0x47')],{})['then'](respondWithResult(_0x4120ca,0xc9))['catch'](handleError(_0x4120ca,null));};exports[_0xffeb('0x22')]=function(_0x215453,_0x4e6921){if(_0x215453[_0xffeb('0x47')]['id']){delete _0x215453[_0xffeb('0x47')]['id'];}return db[_0xffeb('0x29')][_0xffeb('0x48')]({'where':{'id':_0x215453[_0xffeb('0x41')]['id']}})[_0xffeb('0x23')](handleEntityNotFound(_0x4e6921,null))[_0xffeb('0x23')](saveUpdates(_0x215453[_0xffeb('0x47')],null))[_0xffeb('0x23')](respondWithResult(_0x4e6921,null))['catch'](handleError(_0x4e6921,null));};exports[_0xffeb('0x24')]=function(_0x183b17,_0x24805a){return db['VoiceMailMessage']['find']({'where':{'id':_0x183b17['params']['id']}})[_0xffeb('0x23')](handleEntityNotFound(_0x24805a,null))['then'](removeEntity(_0x24805a,null))[_0xffeb('0x45')](handleError(_0x24805a,null));};exports['download']=function(_0x26214d,_0x3f47a0,_0x21aa45){return db['VoiceMailMessage'][_0xffeb('0x48')]({'where':{'id':_0x26214d[_0xffeb('0x41')]['id']},'attributes':['id',_0xffeb('0x49'),_0xffeb('0x4a')]})[_0xffeb('0x23')](handleEntityNotFound(_0x3f47a0,null))[_0xffeb('0x23')](function(_0x400599){if(_0x400599){if(!_0x400599[_0xffeb('0x49')]){throw new db[(_0xffeb('0x4b'))]['ValidationError'](_0xffeb('0x4c'));}var _0x902374={'Content-Type':'audio/wav','Content-Disposition':_0xffeb('0x4d')};if(_0x400599[_0xffeb('0x4a')]){_0x902374[_0xffeb('0x4e')]=_0xffeb('0x4f')+_0x400599[_0xffeb('0x4a')]+'.wav\x22';}_0x3f47a0[_0xffeb('0x1f')](_0x902374);return _0x3f47a0['send'](new Buffer(_0x400599[_0xffeb('0x49')]));}})[_0xffeb('0x45')](handleError(_0x3f47a0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 81b36dc..b14a4cb 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 _0xca72=['path','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3c013a,_0x3ee6ab){var _0x373dca=function(_0x1ccff5){while(--_0x1ccff5){_0x3c013a['push'](_0x3c013a['shift']());}};_0x373dca(++_0x3ee6ab);}(_0xca72,0x14b));var _0x2ca7=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xca72[_0x233cb1];return _0x29ee7e;};'use strict';var _=require(_0x2ca7('0x0'));var util=require('util');var logger=require(_0x2ca7('0x1'))(_0x2ca7('0x2'));var moment=require(_0x2ca7('0x3'));var BPromise=require(_0x2ca7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ca7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2ca7('0x6'));module[_0x2ca7('0x7')]=function(_0x393aee,_0x1d7699){return _0x393aee[_0x2ca7('0x8')](_0x2ca7('0x9'),attributes,{'tableName':_0x2ca7('0xa'),'paranoid':![],'indexes':[{'name':_0x2ca7('0xb'),'fields':[_0x2ca7('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0598=['exports','define','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x1522f9,_0x5998d8){var _0x555a82=function(_0x2656a6){while(--_0x2656a6){_0x1522f9['push'](_0x1522f9['shift']());}};_0x555a82(++_0x5998d8);}(_0x0598,0x100));var _0x8059=function(_0x2c9997,_0x460a20){_0x2c9997=_0x2c9997-0x0;var _0x1fffe8=_0x0598[_0x2c9997];return _0x1fffe8;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require(_0x8059('0x3'));var BPromise=require(_0x8059('0x4'));var rp=require(_0x8059('0x5'));var fs=require('fs');var path=require(_0x8059('0x6'));var rimraf=require(_0x8059('0x7'));var config=require(_0x8059('0x8'));var attributes=require(_0x8059('0x9'));module[_0x8059('0xa')]=function(_0xf8102e,_0x547179){return _0xf8102e[_0x8059('0xb')]('VoiceMailMessage',attributes,{'tableName':_0x8059('0xc'),'paranoid':![],'indexes':[{'name':_0x8059('0xd'),'fields':[_0x8059('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a22ea0f..3b29c50 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 _0x9c62=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis'];(function(_0x3d5371,_0x24ebd7){var _0x4631e3=function(_0x2a2e41){while(--_0x2a2e41){_0x3d5371['push'](_0x3d5371['shift']());}};_0x4631e3(++_0x24ebd7);}(_0x9c62,0x7a));var _0x29c6=function(_0x345540,_0x47ef1a){_0x345540=_0x345540-0x0;var _0x33e740=_0x9c62[_0x345540];return _0x33e740;};'use strict';var _=require(_0x29c6('0x0'));var util=require('util');var moment=require(_0x29c6('0x1'));var BPromise=require('bluebird');var rs=require(_0x29c6('0x2'));var fs=require('fs');var Redis=require(_0x29c6('0x3'));var db=require(_0x29c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x29c6('0x5'))('rpc');var config=require(_0x29c6('0x6'));var jayson=require(_0x29c6('0x7'));var client=jayson[_0x29c6('0x8')][_0x29c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a693a,_0x31433c,_0x324b2b){return new BPromise(function(_0x382033,_0x164401){return client['request'](_0x4a693a,_0x324b2b)[_0x29c6('0xa')](function(_0x51156b){logger[_0x29c6('0xb')](_0x29c6('0xc'),_0x31433c,_0x29c6('0xd'));logger[_0x29c6('0xe')](_0x29c6('0xf'),_0x31433c,_0x29c6('0xd'),JSON[_0x29c6('0x10')](_0x51156b));if(_0x51156b[_0x29c6('0x11')]){if(_0x51156b[_0x29c6('0x11')][_0x29c6('0x12')]===0x1f4){logger[_0x29c6('0x11')](_0x29c6('0xc'),_0x31433c,_0x51156b[_0x29c6('0x11')]['message']);return _0x164401(_0x51156b['error']['message']);}logger[_0x29c6('0x11')](_0x29c6('0xc'),_0x31433c,_0x51156b[_0x29c6('0x11')][_0x29c6('0x13')]);return _0x382033(_0x51156b[_0x29c6('0x11')][_0x29c6('0x13')]);}else{logger['info'](_0x29c6('0xc'),_0x31433c,_0x29c6('0xd'));_0x382033(_0x51156b[_0x29c6('0x14')][_0x29c6('0x13')]);}})['catch'](function(_0x1d519a){logger[_0x29c6('0x11')](_0x29c6('0xc'),_0x31433c,_0x1d519a);_0x164401(_0x1d519a);});});} \ No newline at end of file +var _0x864a=['request','then','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x4654cc,_0x563e47){var _0x556f29=function(_0x3fea3e){while(--_0x3fea3e){_0x4654cc['push'](_0x4654cc['shift']());}};_0x556f29(++_0x563e47);}(_0x864a,0x124));var _0xa864=function(_0x2704bc,_0x1df190){_0x2704bc=_0x2704bc-0x0;var _0x181bc4=_0x864a[_0x2704bc];return _0x181bc4;};'use strict';var _=require(_0xa864('0x0'));var util=require('util');var moment=require(_0xa864('0x1'));var BPromise=require(_0xa864('0x2'));var rs=require(_0xa864('0x3'));var fs=require('fs');var Redis=require(_0xa864('0x4'));var db=require(_0xa864('0x5'))['db'];var utils=require(_0xa864('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa864('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a70bd,_0x3c6bc0,_0x1f164b){return new BPromise(function(_0x496c1a,_0x542771){return client[_0xa864('0x8')](_0x2a70bd,_0x1f164b)[_0xa864('0x9')](function(_0x37994d){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x3c6bc0,'request\x20sent');logger[_0xa864('0xa')](_0xa864('0xb'),_0x3c6bc0,_0xa864('0xc'),JSON[_0xa864('0xd')](_0x37994d));if(_0x37994d[_0xa864('0xe')]){if(_0x37994d[_0xa864('0xe')][_0xa864('0xf')]===0x1f4){logger[_0xa864('0xe')](_0xa864('0x10'),_0x3c6bc0,_0x37994d[_0xa864('0xe')][_0xa864('0x11')]);return _0x542771(_0x37994d[_0xa864('0xe')][_0xa864('0x11')]);}logger[_0xa864('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x3c6bc0,_0x37994d[_0xa864('0xe')][_0xa864('0x11')]);return _0x496c1a(_0x37994d['error'][_0xa864('0x11')]);}else{logger[_0xa864('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x3c6bc0,_0xa864('0xc'));_0x496c1a(_0x37994d[_0xa864('0x13')]['message']);}})['catch'](function(_0x5f384f){logger['error'](_0xa864('0x10'),_0x3c6bc0,_0x5f384f);_0x542771(_0x5f384f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 283b682..7e1a001 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 _0x98b2=['destroy','/:id/sounds/:id2','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','update','delete'];(function(_0x5b0680,_0x2c43fb){var _0x1fe35d=function(_0x1a91ea){while(--_0x1a91ea){_0x5b0680['push'](_0x5b0680['shift']());}};_0x1fe35d(++_0x2c43fb);}(_0x98b2,0xaa));var _0x298b=function(_0x27b911,_0x1753bc){_0x27b911=_0x27b911-0x0;var _0x91682c=_0x98b2[_0x27b911];return _0x91682c;};'use strict';var multer=require(_0x298b('0x0'));var util=require('util');var path=require(_0x298b('0x1'));var timeout=require(_0x298b('0x2'));var express=require('express');var router=express[_0x298b('0x3')]();var fs_extra=require(_0x298b('0x4'));var auth=require(_0x298b('0x5'));var interaction=require(_0x298b('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x298b('0x7')]('/',auth[_0x298b('0x8')](),controller[_0x298b('0x9')]);router[_0x298b('0x7')](_0x298b('0xa'),auth[_0x298b('0x8')](),controller[_0x298b('0xb')]);router[_0x298b('0x7')](_0x298b('0xc'),auth[_0x298b('0x8')](),controller['getSounds']);router[_0x298b('0xd')]('/',auth[_0x298b('0x8')](),controller[_0x298b('0xe')]);router['post'](_0x298b('0xc'),auth[_0x298b('0x8')](),controller[_0x298b('0xf')]);router[_0x298b('0x10')]('/:id',auth[_0x298b('0x8')](),controller[_0x298b('0x11')]);router[_0x298b('0x12')](_0x298b('0xa'),auth[_0x298b('0x8')](),controller[_0x298b('0x13')]);router['delete'](_0x298b('0x14'),auth['isAuthenticated'](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0xcf20=['post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create'];(function(_0x120da2,_0x28289a){var _0x3fe7ce=function(_0x207c85){while(--_0x207c85){_0x120da2['push'](_0x120da2['shift']());}};_0x3fe7ce(++_0x28289a);}(_0xcf20,0xf3));var _0x0cf2=function(_0x1fc0f1,_0x316585){_0x1fc0f1=_0x1fc0f1-0x0;var _0x64ed09=_0xcf20[_0x1fc0f1];return _0x64ed09;};'use strict';var multer=require(_0x0cf2('0x0'));var util=require(_0x0cf2('0x1'));var path=require(_0x0cf2('0x2'));var timeout=require(_0x0cf2('0x3'));var express=require('express');var router=express[_0x0cf2('0x4')]();var fs_extra=require(_0x0cf2('0x5'));var auth=require(_0x0cf2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cf2('0x7'));var controller=require(_0x0cf2('0x8'));router[_0x0cf2('0x9')]('/',auth[_0x0cf2('0xa')](),controller[_0x0cf2('0xb')]);router[_0x0cf2('0x9')](_0x0cf2('0xc'),auth[_0x0cf2('0xa')](),controller[_0x0cf2('0xd')]);router[_0x0cf2('0x9')](_0x0cf2('0xe'),auth[_0x0cf2('0xa')](),controller[_0x0cf2('0xf')]);router['post']('/',auth[_0x0cf2('0xa')](),controller[_0x0cf2('0x10')]);router[_0x0cf2('0x11')]('/:id/sounds',auth[_0x0cf2('0xa')](),controller[_0x0cf2('0x12')]);router[_0x0cf2('0x13')](_0x0cf2('0xc'),auth[_0x0cf2('0xa')](),controller[_0x0cf2('0x14')]);router[_0x0cf2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x0cf2('0x16')]);router['delete'](_0x0cf2('0x17'),auth[_0x0cf2('0xa')](),controller[_0x0cf2('0x18')]);module[_0x0cf2('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 112f3e1..2eaf3d6 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 _0x9437=['sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x5a2cdc,_0x4d64d1){var _0x2565b5=function(_0x4f58ec){while(--_0x4f58ec){_0x5a2cdc['push'](_0x5a2cdc['shift']());}};_0x2565b5(++_0x4d64d1);}(_0x9437,0x1c8));var _0x7943=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0x9437[_0x2fa457];return _0x4f250a;};'use strict';var Sequelize=require(_0x7943('0x0'));module[_0x7943('0x1')]={'name':{'type':Sequelize[_0x7943('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x7943('0x3')](_0x7943('0x4'),_0x7943('0x5'),_0x7943('0x6'),_0x7943('0x7'),'quietmp3',_0x7943('0x8')),'allowNull':!![],'defaultValue':_0x7943('0x5')},'directory':{'type':Sequelize[_0x7943('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x7943('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7943('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7943('0x2')],'allowNull':!![],'defaultValue':_0x7943('0x9')},'format':{'type':Sequelize[_0x7943('0x2')],'allowNull':!![]},'stamp':{'type':_0x7943('0xa')},'defaultEntry':{'type':Sequelize[_0x7943('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c2f=['STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x397ec9,_0x384f51){var _0x381635=function(_0x28f7ee){while(--_0x28f7ee){_0x397ec9['push'](_0x397ec9['shift']());}};_0x381635(++_0x384f51);}(_0x5c2f,0xc5));var _0xf5c2=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0x5c2f[_0xaf025d];return _0x1c77cb;};'use strict';var Sequelize=require(_0xf5c2('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5c2('0x1')],'allowNull':![],'unique':_0xf5c2('0x2')},'mode':{'type':Sequelize[_0xf5c2('0x3')](_0xf5c2('0x4'),_0xf5c2('0x5'),_0xf5c2('0x6'),_0xf5c2('0x7'),_0xf5c2('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0xf5c2('0x5')},'directory':{'type':Sequelize[_0xf5c2('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xf5c2('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf5c2('0x1')],'allowNull':!![]},'stamp':{'type':_0xf5c2('0x9')},'defaultEntry':{'type':Sequelize[_0xf5c2('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 8004383..1d1e707 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 _0x8331=['UserProfileSection','MusicOnHolds','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','server/files/moh','symlinkSync','Sequelize','message','removeSound','findOne','id2','%s.%s','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','name','map','VoiceMusicOnHold','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','create','sequelize','transaction','files','directory','join','root','mode','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x4a2f34,_0x26e0c2){var _0x3a8272=function(_0x14f930){while(--_0x14f930){_0x4a2f34['push'](_0x4a2f34['shift']());}};_0x3a8272(++_0x26e0c2);}(_0x8331,0x1e5));var _0x1833=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x8331[_0x5235a6];return _0x1cf37e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1833('0x0'));var zipdir=require(_0x1833('0x1'));var jsonpatch=require(_0x1833('0x2'));var rp=require(_0x1833('0x3'));var moment=require(_0x1833('0x4'));var BPromise=require(_0x1833('0x5'));var Mustache=require(_0x1833('0x6'));var util=require(_0x1833('0x7'));var path=require(_0x1833('0x8'));var sox=require(_0x1833('0x9'));var csv=require(_0x1833('0xa'));var ejs=require(_0x1833('0xb'));var fs=require('fs');var fs_extra=require(_0x1833('0xc'));var _=require(_0x1833('0xd'));var squel=require(_0x1833('0xe'));var crypto=require(_0x1833('0xf'));var jsforce=require(_0x1833('0x10'));var deskjs=require(_0x1833('0x11'));var toCsv=require(_0x1833('0xa'));var querystring=require(_0x1833('0x12'));var Papa=require(_0x1833('0x13'));var Redis=require('ioredis');var authService=require(_0x1833('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1833('0x15'));var logger=require(_0x1833('0x16'))(_0x1833('0x17'));var utils=require('../../config/utils');var config=require(_0x1833('0x18'));var licenseUtil=require(_0x1833('0x19'));var db=require(_0x1833('0x1a'))['db'];function respondWithStatusCode(_0x434c0a,_0x1aae3f){_0x1aae3f=_0x1aae3f||0xcc;return function(_0x2241e8){if(_0x2241e8){return _0x434c0a[_0x1833('0x1b')](_0x1aae3f);}return _0x434c0a['status'](_0x1aae3f)[_0x1833('0x1c')]();};}function respondWithResult(_0x25a40c,_0x590d69){_0x590d69=_0x590d69||0xc8;return function(_0x35eb6b){if(_0x35eb6b){return _0x25a40c[_0x1833('0x1d')](_0x590d69)['json'](_0x35eb6b);}};}function respondWithFilteredResult(_0x2e4f99,_0x2e98a6){return function(_0x1da341){if(_0x1da341){var _0x147526=typeof _0x2e98a6['offset']===_0x1833('0x1e')&&typeof _0x2e98a6[_0x1833('0x1f')]===_0x1833('0x1e');var _0x51dc75=_0x1da341[_0x1833('0x20')];var _0x4bd298=_0x147526?0x0:_0x2e98a6[_0x1833('0x21')];var _0x51eda5=_0x147526?_0x1da341['count']:_0x2e98a6[_0x1833('0x21')]+_0x2e98a6[_0x1833('0x1f')];var _0x2a4b61;if(_0x51eda5>=_0x51dc75){_0x51eda5=_0x51dc75;_0x2a4b61=0xc8;}else{_0x2a4b61=0xce;}_0x2e4f99['status'](_0x2a4b61);return _0x2e4f99[_0x1833('0x22')](_0x1833('0x23'),_0x4bd298+'-'+_0x51eda5+'/'+_0x51dc75)[_0x1833('0x24')](_0x1da341);}return null;};}function patchUpdates(_0x1c3054){return function(_0x16c59e){try{jsonpatch['apply'](_0x16c59e,_0x1c3054,!![]);}catch(_0x1d5b35){return BPromise[_0x1833('0x25')](_0x1d5b35);}return _0x16c59e['save']();};}function saveUpdates(_0x42ed73,_0x590e59){return function(_0x5eb432){if(_0x5eb432){return _0x5eb432[_0x1833('0x26')](_0x42ed73)[_0x1833('0x27')](function(_0x3f26ec){return _0x3f26ec;});}return null;};}function removeEntity(_0x3d9808,_0x5b0ffa){return function(_0x408eb6){if(_0x408eb6){return _0x408eb6[_0x1833('0x28')]()['then'](function(){var _0x22dc67=_0x408eb6['get']({'plain':!![]});var _0x55a9ed='MusicOnHolds';return db['UserProfileResource'][_0x1833('0x28')]({'where':{'type':_0x55a9ed,'resourceId':_0x22dc67['id']}})[_0x1833('0x27')](function(){return _0x408eb6;});})['then'](function(){_0x3d9808[_0x1833('0x1d')](0xcc)[_0x1833('0x1c')]();});}};}function handleEntityNotFound(_0x3c21d6,_0x116259){return function(_0x1cb4d9){if(!_0x1cb4d9){_0x3c21d6['sendStatus'](0x194);}return _0x1cb4d9;};}function handleError(_0x1ac901,_0x2e46d2){_0x2e46d2=_0x2e46d2||0x1f4;return function(_0x4e26d8){logger['error'](_0x4e26d8['stack']);if(_0x4e26d8[_0x1833('0x29')]){delete _0x4e26d8[_0x1833('0x29')];}_0x1ac901[_0x1833('0x1d')](_0x2e46d2)['send'](_0x4e26d8);};}exports['index']=function(_0x51d731,_0x2a188e){var _0x5bde5f={},_0x25af30={},_0x214f0d={'count':0x0,'rows':[]};var _0x391be6=_[_0x1833('0x2a')](db[_0x1833('0x2b')]['rawAttributes'],function(_0x49b878){return{'name':_0x49b878['fieldName'],'type':_0x49b878[_0x1833('0x2c')]['key']};});_0x25af30[_0x1833('0x2d')]=_[_0x1833('0x2a')](_0x391be6,_0x1833('0x29'));_0x25af30[_0x1833('0x2e')]=_[_0x1833('0x2f')](_0x51d731[_0x1833('0x2e')]);_0x25af30[_0x1833('0x30')]=_[_0x1833('0x31')](_0x25af30[_0x1833('0x2d')],_0x25af30[_0x1833('0x2e')]);_0x5bde5f[_0x1833('0x32')]=_[_0x1833('0x31')](_0x25af30[_0x1833('0x2d')],qs[_0x1833('0x33')](_0x51d731[_0x1833('0x2e')][_0x1833('0x33')]));_0x5bde5f['attributes']=_0x5bde5f[_0x1833('0x32')][_0x1833('0x34')]?_0x5bde5f[_0x1833('0x32')]:_0x25af30[_0x1833('0x2d')];if(!_0x51d731[_0x1833('0x2e')][_0x1833('0x35')](_0x1833('0x36'))){_0x5bde5f[_0x1833('0x1f')]=qs[_0x1833('0x1f')](_0x51d731[_0x1833('0x2e')]['limit']);_0x5bde5f[_0x1833('0x21')]=qs[_0x1833('0x21')](_0x51d731[_0x1833('0x2e')]['offset']);}_0x5bde5f[_0x1833('0x37')]=qs[_0x1833('0x38')](_0x51d731['query'][_0x1833('0x38')]);delete _0x51d731[_0x1833('0x2e')]['sort'];_0x5bde5f[_0x1833('0x39')]=qs[_0x1833('0x30')](_[_0x1833('0x3a')](_0x51d731[_0x1833('0x2e')],_0x25af30[_0x1833('0x30')]),_0x391be6);if(_0x51d731[_0x1833('0x2e')]['filter']){_0x5bde5f['where']=_[_0x1833('0x3b')](_0x5bde5f[_0x1833('0x39')],{'$or':_[_0x1833('0x2a')](_0x391be6,function(_0x12a29d){if(_0x12a29d[_0x1833('0x2c')]!==_0x1833('0x3c')){var _0x19057d={};_0x19057d[_0x12a29d[_0x1833('0x29')]]={'$like':'%'+_0x51d731[_0x1833('0x2e')][_0x1833('0x3d')]+'%'};return _0x19057d;}})});}_0x5bde5f=_['merge']({},_0x5bde5f,_0x51d731[_0x1833('0x3e')]);var _0x4db336={'where':_0x5bde5f[_0x1833('0x39')]};return db[_0x1833('0x2b')][_0x1833('0x20')](_0x4db336)['then'](function(_0x39e2de){_0x214f0d[_0x1833('0x20')]=_0x39e2de;if(_0x51d731[_0x1833('0x2e')]['includeAll']){_0x5bde5f['include']=[{'all':!![]}];}return db[_0x1833('0x2b')][_0x1833('0x3f')](_0x5bde5f);})[_0x1833('0x27')](function(_0x384986){_0x214f0d[_0x1833('0x40')]=_0x384986;return _0x214f0d;})[_0x1833('0x27')](respondWithFilteredResult(_0x2a188e,_0x5bde5f))[_0x1833('0x41')](handleError(_0x2a188e,null));};exports[_0x1833('0x42')]=function(_0x12be1f,_0x5a86e1){var _0xa43e52={'raw':![],'where':{'id':_0x12be1f[_0x1833('0x43')]['id']}},_0x34f55d={};_0x34f55d['model']=_[_0x1833('0x2f')](db[_0x1833('0x2b')][_0x1833('0x44')]);_0x34f55d[_0x1833('0x2e')]=_['keys'](_0x12be1f[_0x1833('0x2e')]);_0x34f55d[_0x1833('0x30')]=_['intersection'](_0x34f55d['model'],_0x34f55d['query']);_0xa43e52[_0x1833('0x32')]=_[_0x1833('0x31')](_0x34f55d[_0x1833('0x2d')],qs[_0x1833('0x33')](_0x12be1f[_0x1833('0x2e')][_0x1833('0x33')]));_0xa43e52[_0x1833('0x32')]=_0xa43e52[_0x1833('0x32')]['length']?_0xa43e52['attributes']:_0x34f55d[_0x1833('0x2d')];if(_0x12be1f[_0x1833('0x2e')][_0x1833('0x45')]){_0xa43e52['include']=[{'all':!![]}];}_0xa43e52=_['merge']({},_0xa43e52,_0x12be1f[_0x1833('0x3e')]);return db[_0x1833('0x2b')][_0x1833('0x46')](_0xa43e52)[_0x1833('0x27')](handleEntityNotFound(_0x5a86e1,null))[_0x1833('0x27')](respondWithResult(_0x5a86e1,null))[_0x1833('0x41')](handleError(_0x5a86e1,null));};exports[_0x1833('0x26')]=function(_0x58ee8b,_0x1260fc){if(_0x58ee8b[_0x1833('0x47')]['id']){delete _0x58ee8b[_0x1833('0x47')]['id'];}return db[_0x1833('0x2b')][_0x1833('0x46')]({'where':{'id':_0x58ee8b[_0x1833('0x43')]['id']}})[_0x1833('0x27')](handleEntityNotFound(_0x1260fc,null))[_0x1833('0x27')](saveUpdates(_0x58ee8b[_0x1833('0x47')],null))['then'](respondWithResult(_0x1260fc,null))[_0x1833('0x41')](handleError(_0x1260fc,null));};exports[_0x1833('0x48')]=function(_0x1d1cde,_0xc2755c,_0x14d7c3){return db[_0x1833('0x49')][_0x1833('0x4a')](function(_0x1c09c3){if(_0x1d1cde['body']['mode']===_0x1833('0x4b')){_0x1d1cde[_0x1833('0x47')][_0x1833('0x4c')]=path[_0x1833('0x4d')](config[_0x1833('0x4e')],'server/files/moh',_0x1d1cde[_0x1833('0x47')]['name']);}return db[_0x1833('0x2b')][_0x1833('0x48')](_0x1d1cde['body'],{'transaction':_0x1c09c3})['then'](function(_0x2785b4){if(_0x1d1cde[_0x1833('0x47')][_0x1833('0x4f')]===_0x1833('0x4b')){fs[_0x1833('0x50')](_0x2785b4[_0x1833('0x4c')],parseInt('0777',0x8));}var _0x18fee8=_0x1d1cde[_0x1833('0x51')][_0x1833('0x52')]({'plain':!![]});if(!_0x18fee8)throw new Error(_0x1833('0x53'));if(_0x18fee8[_0x1833('0x54')]===_0x1833('0x51')){var _0x35ebcf=_0x2785b4[_0x1833('0x52')]({'plain':!![]});return db[_0x1833('0x55')]['find']({'where':{'name':_0x1833('0x56'),'userProfileId':_0x18fee8['userProfileId']},'raw':!![]})[_0x1833('0x27')](function(_0x7413a9){if(_0x7413a9&&_0x7413a9[_0x1833('0x57')]===0x0){return db[_0x1833('0x58')][_0x1833('0x48')]({'name':_0x35ebcf['name'],'resourceId':_0x35ebcf['id'],'type':_0x7413a9[_0x1833('0x29')],'sectionId':_0x7413a9['id']},{})['then'](function(){return _0x2785b4;});}else{return _0x2785b4;}})[_0x1833('0x41')](function(_0x3a6d1f){logger[_0x1833('0x59')](_0x1833('0x5a'),_0x3a6d1f);});}return _0x2785b4;});})['then'](respondWithResult(_0xc2755c,0xc9))[_0x1833('0x41')](handleError(_0xc2755c,null));};exports[_0x1833('0x28')]=function(_0x31e044,_0x4b65f5,_0x488e94){var _0x49fa8d;return db['VoiceMusicOnHold'][_0x1833('0x46')]({'where':{'id':_0x31e044['params']['id']}})['then'](function(_0x5971fa){if(_0x5971fa){return db['sequelize'][_0x1833('0x4a')](function(_0x581335){return _0x5971fa[_0x1833('0x28')]({'transaction':_0x581335,'raw':!![]})[_0x1833('0x27')](function(_0x331cc6){if(_0x331cc6[_0x1833('0x4c')]){fs[_0x1833('0x5b')](_0x331cc6[_0x1833('0x4c')])[_0x1833('0x5c')](function(_0x3e431c){fs[_0x1833('0x5d')](path[_0x1833('0x4d')](_0x331cc6[_0x1833('0x4c')],_0x3e431c));});fs[_0x1833('0x5e')](_0x331cc6['directory']);}return _0x331cc6;});})[_0x1833('0x41')](function(_0x15defc){throw new db['Sequelize'][(_0x1833('0x5f'))](_0x15defc['message']);});}})[_0x1833('0x27')](handleEntityNotFound(_0x4b65f5,null))[_0x1833('0x27')](removeEntity(_0x4b65f5,null))[_0x1833('0x41')](handleError(_0x4b65f5,null));};exports[_0x1833('0x60')]=function(_0x5e4267,_0x5d1184,_0x30d6ca){return db['sequelize'][_0x1833('0x4a')](function(_0x507e0d){var _0x251e39;return db[_0x1833('0x2b')][_0x1833('0x46')]({'where':{'id':_0x5e4267['params']['id']}})['then'](function(_0x4b6e0c){if(_0x4b6e0c){_0x251e39=_0x4b6e0c;return _0x4b6e0c['addSound'](_0x5e4267['body']['id'],{'transaction':_0x507e0d});}})[_0x1833('0x27')](function(_0x164699){if(_0x164699){return db[_0x1833('0x61')]['findOne']({'where':{'id':_0x5e4267[_0x1833('0x47')]['id']},'attributes':['id',_0x1833('0x29'),_0x1833('0x62'),_0x1833('0x63'),_0x1833('0x64')],'raw':!![]});}})[_0x1833('0x27')](function(_0x5bea01){if(_0x5bea01){var _0x4b5fe6=path[_0x1833('0x4d')](config['root'],_0x1833('0x65'),util[_0x1833('0x66')]('%s.%s',path[_0x1833('0x67')](_0x5bea01[_0x1833('0x62')],path[_0x1833('0x68')](_0x5bea01['save_name'])),_0x5bea01[_0x1833('0x63')]));var _0x194c08=path['join'](config[_0x1833('0x4e')],_0x1833('0x69'),_0x251e39[_0x1833('0x29')],util[_0x1833('0x66')]('%s.%s',_0x5bea01['name'],_0x5bea01[_0x1833('0x63')]));fs[_0x1833('0x6a')](_0x4b5fe6,_0x194c08);return _0x5bea01;}})[_0x1833('0x41')](function(_0x771134){throw new db[(_0x1833('0x6b'))][(_0x1833('0x5f'))](_0x771134[_0x1833('0x6c')]);});})[_0x1833('0x27')](handleEntityNotFound(_0x5d1184,null))[_0x1833('0x27')](respondWithResult(_0x5d1184,0xc9))[_0x1833('0x41')](handleError(_0x5d1184,null));};exports[_0x1833('0x6d')]=function(_0x353b5e,_0x41b84b,_0x27d306){return db[_0x1833('0x49')]['transaction'](function(_0x12c20a){var _0x553bdc;return db[_0x1833('0x2b')][_0x1833('0x6e')]({'where':{'id':_0x353b5e[_0x1833('0x43')]['id']}})[_0x1833('0x27')](handleEntityNotFound(_0x41b84b,null))['then'](function(_0x3e9299){if(_0x3e9299){_0x553bdc=_0x3e9299;return _0x3e9299[_0x1833('0x6d')](_0x353b5e[_0x1833('0x43')][_0x1833('0x6f')]);}})[_0x1833('0x27')](function(_0xc4cd30){if(_0xc4cd30){return db[_0x1833('0x61')]['findOne']({'where':{'id':_0x353b5e[_0x1833('0x43')][_0x1833('0x6f')]},'attributes':['id',_0x1833('0x29'),_0x1833('0x62'),_0x1833('0x63'),_0x1833('0x64')],'raw':!![]});}})[_0x1833('0x27')](function(_0x165597){if(_0x165597){fs['unlinkSync'](path['join'](_0x553bdc[_0x1833('0x4c')],util[_0x1833('0x66')](_0x1833('0x70'),_0x165597['name'],_0x165597[_0x1833('0x63')])));return _0x165597;}})[_0x1833('0x41')](function(_0x157638){throw new db[(_0x1833('0x6b'))]['ValidationError'](_0x157638['message']);});})[_0x1833('0x27')](handleEntityNotFound(_0x41b84b,null))[_0x1833('0x27')](respondWithStatusCode(_0x41b84b,0xcc))[_0x1833('0x41')](handleError(_0x41b84b,null));};exports['getSounds']=function(_0xd3c22e,_0x1377a2,_0x364698){var _0x1c6082={};var _0x3f0112={};var _0x966ab5;var _0x5573db;return db[_0x1833('0x2b')]['findOne']({'where':{'id':_0xd3c22e[_0x1833('0x43')]['id']}})[_0x1833('0x27')](handleEntityNotFound(_0x1377a2,null))['then'](function(_0xb99c05){if(_0xb99c05){_0x966ab5=_0xb99c05;_0x3f0112[_0x1833('0x2d')]=_['keys'](db[_0x1833('0x61')][_0x1833('0x44')]);_0x3f0112[_0x1833('0x2e')]=_[_0x1833('0x2f')](_0xd3c22e[_0x1833('0x2e')]);_0x3f0112[_0x1833('0x30')]=_[_0x1833('0x31')](_0x3f0112[_0x1833('0x2d')],_0x3f0112['query']);_0x1c6082['attributes']=_[_0x1833('0x31')](_0x3f0112[_0x1833('0x2d')],qs['fields'](_0xd3c22e[_0x1833('0x2e')][_0x1833('0x33')]));_0x1c6082[_0x1833('0x32')]=_0x1c6082[_0x1833('0x32')][_0x1833('0x34')]?_0x1c6082[_0x1833('0x32')]:_0x3f0112[_0x1833('0x2d')];_0x1c6082[_0x1833('0x37')]=qs[_0x1833('0x38')](_0xd3c22e[_0x1833('0x2e')][_0x1833('0x38')]);_0x1c6082[_0x1833('0x39')]=qs[_0x1833('0x30')](_[_0x1833('0x3a')](_0xd3c22e[_0x1833('0x2e')],_0x3f0112[_0x1833('0x30')]));if(_0xd3c22e[_0x1833('0x2e')]['filter']){_0x1c6082['where']=_[_0x1833('0x3b')](_0x1c6082[_0x1833('0x39')],{'$or':_[_0x1833('0x2a')](_0x1c6082['attributes'],function(_0x1f1371){var _0x44a930={};_0x44a930[_0x1f1371]={'$like':'%'+_0xd3c22e[_0x1833('0x2e')][_0x1833('0x3d')]+'%'};return _0x44a930;})});}_0x1c6082=_[_0x1833('0x3b')]({},_0x1c6082,_0xd3c22e[_0x1833('0x3e')]);return _0x966ab5['getSounds'](_0x1c6082);}})['then'](function(_0xea4ffe){if(_0xea4ffe){_0x5573db=_0xea4ffe[_0x1833('0x34')];if(!_0xd3c22e['query'][_0x1833('0x35')](_0x1833('0x36'))){_0x1c6082[_0x1833('0x1f')]=qs[_0x1833('0x1f')](_0xd3c22e[_0x1833('0x2e')]['limit']);_0x1c6082[_0x1833('0x21')]=qs[_0x1833('0x21')](_0xd3c22e[_0x1833('0x2e')][_0x1833('0x21')]);}return _0x966ab5[_0x1833('0x71')](_0x1c6082);}})[_0x1833('0x27')](function(_0x43624a){if(_0x43624a){return _0x43624a?{'count':_0x5573db,'rows':_0x43624a}:null;}})[_0x1833('0x27')](respondWithResult(_0x1377a2,null))[_0x1833('0x41')](handleError(_0x1377a2,null));}; \ No newline at end of file +var _0xc545=['join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','message','addSound','findOne','converted_format','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','ValidationError','removeSound','id2','Sound','createdAt','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','destroy','then','get','MusicOnHolds','end','error','stack','name','send','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','body','create','sequelize','transaction','mode','files','directory'];(function(_0x208128,_0x9e2557){var _0x213a02=function(_0x29fc57){while(--_0x29fc57){_0x208128['push'](_0x208128['shift']());}};_0x213a02(++_0x9e2557);}(_0xc545,0x172));var _0x5c54=function(_0x562b36,_0x479d28){_0x562b36=_0x562b36-0x0;var _0x8118fd=_0xc545[_0x562b36];return _0x8118fd;};'use strict';var emlformat=require(_0x5c54('0x0'));var rimraf=require(_0x5c54('0x1'));var zipdir=require(_0x5c54('0x2'));var jsonpatch=require(_0x5c54('0x3'));var rp=require(_0x5c54('0x4'));var moment=require(_0x5c54('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c54('0x6'));var util=require(_0x5c54('0x7'));var path=require('path');var sox=require(_0x5c54('0x8'));var csv=require(_0x5c54('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c54('0xa'));var _=require('lodash');var squel=require(_0x5c54('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c54('0xc'));var toCsv=require(_0x5c54('0x9'));var querystring=require(_0x5c54('0xd'));var Papa=require(_0x5c54('0xe'));var Redis=require(_0x5c54('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5c54('0x10'));var as=require(_0x5c54('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c54('0x12'));var utils=require('../../config/utils');var config=require(_0x5c54('0x13'));var licenseUtil=require(_0x5c54('0x14'));var db=require(_0x5c54('0x15'))['db'];function respondWithStatusCode(_0x5096b3,_0x3d3260){_0x3d3260=_0x3d3260||0xcc;return function(_0x3f31a2){if(_0x3f31a2){return _0x5096b3[_0x5c54('0x16')](_0x3d3260);}return _0x5096b3['status'](_0x3d3260)['end']();};}function respondWithResult(_0x56ae1c,_0x20cba4){_0x20cba4=_0x20cba4||0xc8;return function(_0x3c0eb6){if(_0x3c0eb6){return _0x56ae1c[_0x5c54('0x17')](_0x20cba4)[_0x5c54('0x18')](_0x3c0eb6);}};}function respondWithFilteredResult(_0x3035d8,_0x2b543b){return function(_0x1b65e6){if(_0x1b65e6){var _0xdfa96a=typeof _0x2b543b[_0x5c54('0x19')]===_0x5c54('0x1a')&&typeof _0x2b543b['limit']===_0x5c54('0x1a');var _0x173c48=_0x1b65e6[_0x5c54('0x1b')];var _0x4acc88=_0xdfa96a?0x0:_0x2b543b[_0x5c54('0x19')];var _0x4aff3a=_0xdfa96a?_0x1b65e6[_0x5c54('0x1b')]:_0x2b543b[_0x5c54('0x19')]+_0x2b543b['limit'];var _0x1d9e82;if(_0x4aff3a>=_0x173c48){_0x4aff3a=_0x173c48;_0x1d9e82=0xc8;}else{_0x1d9e82=0xce;}_0x3035d8[_0x5c54('0x17')](_0x1d9e82);return _0x3035d8[_0x5c54('0x1c')]('Content-Range',_0x4acc88+'-'+_0x4aff3a+'/'+_0x173c48)['json'](_0x1b65e6);}return null;};}function patchUpdates(_0x70031){return function(_0x5f0696){try{jsonpatch[_0x5c54('0x1d')](_0x5f0696,_0x70031,!![]);}catch(_0x116cce){return BPromise[_0x5c54('0x1e')](_0x116cce);}return _0x5f0696[_0x5c54('0x1f')]();};}function saveUpdates(_0x5d55f6,_0xd64d2a){return function(_0x2ddb87){if(_0x2ddb87){return _0x2ddb87['update'](_0x5d55f6)['then'](function(_0x1398ef){return _0x1398ef;});}return null;};}function removeEntity(_0x520ef2,_0x338f43){return function(_0x4ba38c){if(_0x4ba38c){return _0x4ba38c[_0x5c54('0x20')]()[_0x5c54('0x21')](function(){var _0x413eba=_0x4ba38c[_0x5c54('0x22')]({'plain':!![]});var _0x56603a=_0x5c54('0x23');return db['UserProfileResource'][_0x5c54('0x20')]({'where':{'type':_0x56603a,'resourceId':_0x413eba['id']}})[_0x5c54('0x21')](function(){return _0x4ba38c;});})[_0x5c54('0x21')](function(){_0x520ef2[_0x5c54('0x17')](0xcc)[_0x5c54('0x24')]();});}};}function handleEntityNotFound(_0x2cdfc5,_0x4dc82e){return function(_0x59a66c){if(!_0x59a66c){_0x2cdfc5[_0x5c54('0x16')](0x194);}return _0x59a66c;};}function handleError(_0x4e8b94,_0xdeffce){_0xdeffce=_0xdeffce||0x1f4;return function(_0x2f8ea9){logger[_0x5c54('0x25')](_0x2f8ea9[_0x5c54('0x26')]);if(_0x2f8ea9['name']){delete _0x2f8ea9[_0x5c54('0x27')];}_0x4e8b94[_0x5c54('0x17')](_0xdeffce)[_0x5c54('0x28')](_0x2f8ea9);};}exports[_0x5c54('0x29')]=function(_0x9c3dcd,_0x147749){var _0x2ae2e4={},_0x265a68={},_0x40c212={'count':0x0,'rows':[]};var _0xc9afa9=_[_0x5c54('0x2a')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x546a4f){return{'name':_0x546a4f[_0x5c54('0x2b')],'type':_0x546a4f[_0x5c54('0x2c')][_0x5c54('0x2d')]};});_0x265a68['model']=_[_0x5c54('0x2a')](_0xc9afa9,_0x5c54('0x27'));_0x265a68[_0x5c54('0x2e')]=_[_0x5c54('0x2f')](_0x9c3dcd['query']);_0x265a68['filters']=_[_0x5c54('0x30')](_0x265a68[_0x5c54('0x31')],_0x265a68[_0x5c54('0x2e')]);_0x2ae2e4[_0x5c54('0x32')]=_['intersection'](_0x265a68[_0x5c54('0x31')],qs[_0x5c54('0x33')](_0x9c3dcd[_0x5c54('0x2e')]['fields']));_0x2ae2e4[_0x5c54('0x32')]=_0x2ae2e4[_0x5c54('0x32')][_0x5c54('0x34')]?_0x2ae2e4[_0x5c54('0x32')]:_0x265a68[_0x5c54('0x31')];if(!_0x9c3dcd[_0x5c54('0x2e')][_0x5c54('0x35')](_0x5c54('0x36'))){_0x2ae2e4[_0x5c54('0x37')]=qs[_0x5c54('0x37')](_0x9c3dcd[_0x5c54('0x2e')][_0x5c54('0x37')]);_0x2ae2e4[_0x5c54('0x19')]=qs['offset'](_0x9c3dcd[_0x5c54('0x2e')][_0x5c54('0x19')]);}_0x2ae2e4[_0x5c54('0x38')]=qs['sort'](_0x9c3dcd[_0x5c54('0x2e')]['sort']);delete _0x9c3dcd[_0x5c54('0x2e')][_0x5c54('0x39')];_0x2ae2e4[_0x5c54('0x3a')]=qs[_0x5c54('0x3b')](_[_0x5c54('0x3c')](_0x9c3dcd[_0x5c54('0x2e')],_0x265a68[_0x5c54('0x3b')]),_0xc9afa9);if(_0x9c3dcd['query'][_0x5c54('0x3d')]){_0x2ae2e4[_0x5c54('0x3a')]=_[_0x5c54('0x3e')](_0x2ae2e4[_0x5c54('0x3a')],{'$or':_[_0x5c54('0x2a')](_0xc9afa9,function(_0x31d364){if(_0x31d364[_0x5c54('0x2c')]!==_0x5c54('0x3f')){var _0x4daebf={};_0x4daebf[_0x31d364[_0x5c54('0x27')]]={'$like':'%'+_0x9c3dcd[_0x5c54('0x2e')][_0x5c54('0x3d')]+'%'};return _0x4daebf;}})});}_0x2ae2e4=_[_0x5c54('0x3e')]({},_0x2ae2e4,_0x9c3dcd['options']);var _0x149bde={'where':_0x2ae2e4[_0x5c54('0x3a')]};return db[_0x5c54('0x40')]['count'](_0x149bde)['then'](function(_0x436fc9){_0x40c212['count']=_0x436fc9;if(_0x9c3dcd[_0x5c54('0x2e')][_0x5c54('0x41')]){_0x2ae2e4['include']=[{'all':!![]}];}return db[_0x5c54('0x40')][_0x5c54('0x42')](_0x2ae2e4);})[_0x5c54('0x21')](function(_0x86f01){_0x40c212[_0x5c54('0x43')]=_0x86f01;return _0x40c212;})[_0x5c54('0x21')](respondWithFilteredResult(_0x147749,_0x2ae2e4))[_0x5c54('0x44')](handleError(_0x147749,null));};exports[_0x5c54('0x45')]=function(_0x4b1cad,_0x43b440){var _0x41169c={'raw':![],'where':{'id':_0x4b1cad[_0x5c54('0x46')]['id']}},_0x30f81a={};_0x30f81a[_0x5c54('0x31')]=_[_0x5c54('0x2f')](db[_0x5c54('0x40')][_0x5c54('0x47')]);_0x30f81a[_0x5c54('0x2e')]=_[_0x5c54('0x2f')](_0x4b1cad[_0x5c54('0x2e')]);_0x30f81a[_0x5c54('0x3b')]=_[_0x5c54('0x30')](_0x30f81a[_0x5c54('0x31')],_0x30f81a[_0x5c54('0x2e')]);_0x41169c[_0x5c54('0x32')]=_['intersection'](_0x30f81a[_0x5c54('0x31')],qs[_0x5c54('0x33')](_0x4b1cad[_0x5c54('0x2e')][_0x5c54('0x33')]));_0x41169c[_0x5c54('0x32')]=_0x41169c[_0x5c54('0x32')][_0x5c54('0x34')]?_0x41169c['attributes']:_0x30f81a[_0x5c54('0x31')];if(_0x4b1cad[_0x5c54('0x2e')][_0x5c54('0x41')]){_0x41169c[_0x5c54('0x48')]=[{'all':!![]}];}_0x41169c=_[_0x5c54('0x3e')]({},_0x41169c,_0x4b1cad[_0x5c54('0x49')]);return db[_0x5c54('0x40')][_0x5c54('0x4a')](_0x41169c)[_0x5c54('0x21')](handleEntityNotFound(_0x43b440,null))[_0x5c54('0x21')](respondWithResult(_0x43b440,null))[_0x5c54('0x44')](handleError(_0x43b440,null));};exports['update']=function(_0x1b7308,_0x38db28){if(_0x1b7308[_0x5c54('0x4b')]['id']){delete _0x1b7308[_0x5c54('0x4b')]['id'];}return db[_0x5c54('0x40')][_0x5c54('0x4a')]({'where':{'id':_0x1b7308[_0x5c54('0x46')]['id']}})['then'](handleEntityNotFound(_0x38db28,null))[_0x5c54('0x21')](saveUpdates(_0x1b7308[_0x5c54('0x4b')],null))[_0x5c54('0x21')](respondWithResult(_0x38db28,null))[_0x5c54('0x44')](handleError(_0x38db28,null));};exports[_0x5c54('0x4c')]=function(_0x7c4933,_0x21d459,_0x39026a){return db[_0x5c54('0x4d')][_0x5c54('0x4e')](function(_0x4d7f50){if(_0x7c4933[_0x5c54('0x4b')][_0x5c54('0x4f')]===_0x5c54('0x50')){_0x7c4933[_0x5c54('0x4b')][_0x5c54('0x51')]=path[_0x5c54('0x52')](config[_0x5c54('0x53')],_0x5c54('0x54'),_0x7c4933[_0x5c54('0x4b')][_0x5c54('0x27')]);}return db[_0x5c54('0x40')][_0x5c54('0x4c')](_0x7c4933['body'],{'transaction':_0x4d7f50})[_0x5c54('0x21')](function(_0x47c480){if(_0x7c4933[_0x5c54('0x4b')][_0x5c54('0x4f')]===_0x5c54('0x50')){fs['mkdirSync'](_0x47c480[_0x5c54('0x51')],parseInt(_0x5c54('0x55'),0x8));}var _0x9429d5=_0x7c4933[_0x5c54('0x56')]['get']({'plain':!![]});if(!_0x9429d5)throw new Error(_0x5c54('0x57'));if(_0x9429d5[_0x5c54('0x58')]===_0x5c54('0x56')){var _0x4ba79d=_0x47c480[_0x5c54('0x22')]({'plain':!![]});return db['UserProfileSection'][_0x5c54('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x9429d5['userProfileId']},'raw':!![]})[_0x5c54('0x21')](function(_0x3493a5){if(_0x3493a5&&_0x3493a5[_0x5c54('0x59')]===0x0){return db[_0x5c54('0x5a')]['create']({'name':_0x4ba79d[_0x5c54('0x27')],'resourceId':_0x4ba79d['id'],'type':_0x3493a5[_0x5c54('0x27')],'sectionId':_0x3493a5['id']},{})[_0x5c54('0x21')](function(){return _0x47c480;});}else{return _0x47c480;}})[_0x5c54('0x44')](function(_0x87d01){logger['error'](_0x5c54('0x5b'),_0x87d01);});}return _0x47c480;});})['then'](respondWithResult(_0x21d459,0xc9))[_0x5c54('0x44')](handleError(_0x21d459,null));};exports['destroy']=function(_0x1b05d0,_0x5084eb,_0x4cf87b){var _0x470efd;return db[_0x5c54('0x40')][_0x5c54('0x4a')]({'where':{'id':_0x1b05d0[_0x5c54('0x46')]['id']}})[_0x5c54('0x21')](function(_0x5d16a8){if(_0x5d16a8){return db[_0x5c54('0x4d')][_0x5c54('0x4e')](function(_0x2f4b39){return _0x5d16a8[_0x5c54('0x20')]({'transaction':_0x2f4b39,'raw':!![]})[_0x5c54('0x21')](function(_0x2af9cd){if(_0x2af9cd[_0x5c54('0x51')]){fs[_0x5c54('0x5c')](_0x2af9cd[_0x5c54('0x51')])[_0x5c54('0x5d')](function(_0x403512){fs[_0x5c54('0x5e')](path['join'](_0x2af9cd[_0x5c54('0x51')],_0x403512));});fs['rmdirSync'](_0x2af9cd[_0x5c54('0x51')]);}return _0x2af9cd;});})[_0x5c54('0x44')](function(_0x49daf6){throw new db[(_0x5c54('0x5f'))]['ValidationError'](_0x49daf6[_0x5c54('0x60')]);});}})[_0x5c54('0x21')](handleEntityNotFound(_0x5084eb,null))[_0x5c54('0x21')](removeEntity(_0x5084eb,null))[_0x5c54('0x44')](handleError(_0x5084eb,null));};exports[_0x5c54('0x61')]=function(_0x32abaa,_0x19904a,_0x33f11a){return db[_0x5c54('0x4d')]['transaction'](function(_0x380809){var _0xa5f14a;return db[_0x5c54('0x40')][_0x5c54('0x4a')]({'where':{'id':_0x32abaa['params']['id']}})[_0x5c54('0x21')](function(_0x58cf3f){if(_0x58cf3f){_0xa5f14a=_0x58cf3f;return _0x58cf3f[_0x5c54('0x61')](_0x32abaa[_0x5c54('0x4b')]['id'],{'transaction':_0x380809});}})['then'](function(_0x35efc7){if(_0x35efc7){return db['Sound'][_0x5c54('0x62')]({'where':{'id':_0x32abaa[_0x5c54('0x4b')]['id']},'attributes':['id',_0x5c54('0x27'),'save_name',_0x5c54('0x63'),'createdAt'],'raw':!![]});}})[_0x5c54('0x21')](function(_0x151469){if(_0x151469){var _0x251f74=path[_0x5c54('0x52')](config[_0x5c54('0x53')],_0x5c54('0x64'),util[_0x5c54('0x65')](_0x5c54('0x66'),path[_0x5c54('0x67')](_0x151469[_0x5c54('0x68')],path[_0x5c54('0x69')](_0x151469['save_name'])),_0x151469[_0x5c54('0x63')]));var _0x6423ee=path[_0x5c54('0x52')](config[_0x5c54('0x53')],'server/files/moh',_0xa5f14a[_0x5c54('0x27')],util['format'](_0x5c54('0x66'),_0x151469[_0x5c54('0x27')],_0x151469[_0x5c54('0x63')]));fs[_0x5c54('0x6a')](_0x251f74,_0x6423ee);return _0x151469;}})['catch'](function(_0x1ebf69){throw new db[(_0x5c54('0x5f'))][(_0x5c54('0x6b'))](_0x1ebf69[_0x5c54('0x60')]);});})[_0x5c54('0x21')](handleEntityNotFound(_0x19904a,null))['then'](respondWithResult(_0x19904a,0xc9))[_0x5c54('0x44')](handleError(_0x19904a,null));};exports[_0x5c54('0x6c')]=function(_0x544d62,_0xc5679b,_0x144b72){return db[_0x5c54('0x4d')][_0x5c54('0x4e')](function(_0x142a07){var _0x546d4b;return db['VoiceMusicOnHold'][_0x5c54('0x62')]({'where':{'id':_0x544d62[_0x5c54('0x46')]['id']}})[_0x5c54('0x21')](handleEntityNotFound(_0xc5679b,null))[_0x5c54('0x21')](function(_0x2f4854){if(_0x2f4854){_0x546d4b=_0x2f4854;return _0x2f4854[_0x5c54('0x6c')](_0x544d62['params'][_0x5c54('0x6d')]);}})['then'](function(_0x149430){if(_0x149430){return db[_0x5c54('0x6e')][_0x5c54('0x62')]({'where':{'id':_0x544d62[_0x5c54('0x46')][_0x5c54('0x6d')]},'attributes':['id',_0x5c54('0x27'),_0x5c54('0x68'),_0x5c54('0x63'),_0x5c54('0x6f')],'raw':!![]});}})[_0x5c54('0x21')](function(_0x14ab5f){if(_0x14ab5f){fs['unlinkSync'](path['join'](_0x546d4b[_0x5c54('0x51')],util[_0x5c54('0x65')](_0x5c54('0x66'),_0x14ab5f[_0x5c54('0x27')],_0x14ab5f[_0x5c54('0x63')])));return _0x14ab5f;}})[_0x5c54('0x44')](function(_0x557a1e){throw new db[(_0x5c54('0x5f'))]['ValidationError'](_0x557a1e[_0x5c54('0x60')]);});})[_0x5c54('0x21')](handleEntityNotFound(_0xc5679b,null))[_0x5c54('0x21')](respondWithStatusCode(_0xc5679b,0xcc))[_0x5c54('0x44')](handleError(_0xc5679b,null));};exports[_0x5c54('0x70')]=function(_0x469d09,_0x53d333,_0x505eff){var _0x460b1f={};var _0x1fc7ea={};var _0x497acc;var _0x373492;return db[_0x5c54('0x40')]['findOne']({'where':{'id':_0x469d09[_0x5c54('0x46')]['id']}})[_0x5c54('0x21')](handleEntityNotFound(_0x53d333,null))[_0x5c54('0x21')](function(_0x4f3eb1){if(_0x4f3eb1){_0x497acc=_0x4f3eb1;_0x1fc7ea[_0x5c54('0x31')]=_[_0x5c54('0x2f')](db[_0x5c54('0x6e')][_0x5c54('0x47')]);_0x1fc7ea[_0x5c54('0x2e')]=_[_0x5c54('0x2f')](_0x469d09[_0x5c54('0x2e')]);_0x1fc7ea[_0x5c54('0x3b')]=_['intersection'](_0x1fc7ea[_0x5c54('0x31')],_0x1fc7ea['query']);_0x460b1f[_0x5c54('0x32')]=_[_0x5c54('0x30')](_0x1fc7ea['model'],qs['fields'](_0x469d09['query'][_0x5c54('0x33')]));_0x460b1f[_0x5c54('0x32')]=_0x460b1f[_0x5c54('0x32')]['length']?_0x460b1f[_0x5c54('0x32')]:_0x1fc7ea[_0x5c54('0x31')];_0x460b1f['order']=qs[_0x5c54('0x39')](_0x469d09[_0x5c54('0x2e')][_0x5c54('0x39')]);_0x460b1f[_0x5c54('0x3a')]=qs[_0x5c54('0x3b')](_['pick'](_0x469d09[_0x5c54('0x2e')],_0x1fc7ea[_0x5c54('0x3b')]));if(_0x469d09[_0x5c54('0x2e')][_0x5c54('0x3d')]){_0x460b1f[_0x5c54('0x3a')]=_['merge'](_0x460b1f[_0x5c54('0x3a')],{'$or':_[_0x5c54('0x2a')](_0x460b1f[_0x5c54('0x32')],function(_0x413919){var _0x51b943={};_0x51b943[_0x413919]={'$like':'%'+_0x469d09[_0x5c54('0x2e')][_0x5c54('0x3d')]+'%'};return _0x51b943;})});}_0x460b1f=_['merge']({},_0x460b1f,_0x469d09[_0x5c54('0x49')]);return _0x497acc[_0x5c54('0x70')](_0x460b1f);}})[_0x5c54('0x21')](function(_0x5adea5){if(_0x5adea5){_0x373492=_0x5adea5[_0x5c54('0x34')];if(!_0x469d09[_0x5c54('0x2e')][_0x5c54('0x35')](_0x5c54('0x36'))){_0x460b1f[_0x5c54('0x37')]=qs[_0x5c54('0x37')](_0x469d09[_0x5c54('0x2e')][_0x5c54('0x37')]);_0x460b1f[_0x5c54('0x19')]=qs['offset'](_0x469d09[_0x5c54('0x2e')][_0x5c54('0x19')]);}return _0x497acc[_0x5c54('0x70')](_0x460b1f);}})['then'](function(_0x2d1821){if(_0x2d1821){return _0x2d1821?{'count':_0x373492,'rows':_0x2d1821}:null;}})[_0x5c54('0x21')](respondWithResult(_0x53d333,null))[_0x5c54('0x44')](handleError(_0x53d333,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 08fa331..30bdc9a 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 _0x6868=['./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x28e5f7,_0x18ce28){var _0x1ba4de=function(_0x3775dd){while(--_0x3775dd){_0x28e5f7['push'](_0x28e5f7['shift']());}};_0x1ba4de(++_0x18ce28);}(_0x6868,0xb8));var _0x8686=function(_0x1b2b4d,_0x1635bf){_0x1b2b4d=_0x1b2b4d-0x0;var _0x69b9=_0x6868[_0x1b2b4d];return _0x69b9;};'use strict';var _=require(_0x8686('0x0'));var util=require(_0x8686('0x1'));var logger=require(_0x8686('0x2'))(_0x8686('0x3'));var moment=require('moment');var BPromise=require(_0x8686('0x4'));var rp=require(_0x8686('0x5'));var fs=require('fs');var path=require(_0x8686('0x6'));var rimraf=require('rimraf');var config=require(_0x8686('0x7'));var attributes=require(_0x8686('0x8'));module[_0x8686('0x9')]=function(_0x17eaf2,_0x2d548d){return _0x17eaf2[_0x8686('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x8686('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1df3=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1df3,0x18e));var _0x31df=function(_0x5155cb,_0x2ba5f7){_0x5155cb=_0x5155cb-0x0;var _0x4ef4fa=_0x1df3[_0x5155cb];return _0x4ef4fa;};'use strict';var _=require(_0x31df('0x0'));var util=require(_0x31df('0x1'));var logger=require(_0x31df('0x2'))(_0x31df('0x3'));var moment=require('moment');var BPromise=require(_0x31df('0x4'));var rp=require(_0x31df('0x5'));var fs=require('fs');var path=require(_0x31df('0x6'));var rimraf=require(_0x31df('0x7'));var config=require(_0x31df('0x8'));var attributes=require(_0x31df('0x9'));module[_0x31df('0xa')]=function(_0x23f288,_0x761919){return _0x23f288[_0x31df('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0x31df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 48d2a87..5c60954 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x34fef1,_0x479b0b){var _0x10968d=function(_0x3a82ea){while(--_0x3a82ea){_0x34fef1['push'](_0x34fef1['shift']());}};_0x10968d(++_0x479b0b);}(_0x70e0,0x17b));var _0x070e=function(_0x2ca9fd,_0x116995){_0x2ca9fd=_0x2ca9fd-0x0;var _0x5710e=_0x70e0[_0x2ca9fd];return _0x5710e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _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(_0x37d023,_0x13347c){var _0x402a98=function(_0x4d50d6){while(--_0x4d50d6){_0x37d023['push'](_0x37d023['shift']());}};_0x402a98(++_0x13347c);}(_0xe706,0xa3));var _0x6e70=function(_0x15a93a,_0x4822e4){_0x15a93a=_0x15a93a-0x0;var _0x592780=_0xe706[_0x15a93a];return _0x592780;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a26b3c3..32b4831 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 _0x425d=['update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams'];(function(_0x2d47e3,_0x58a960){var _0x18d1e2=function(_0x14b71e){while(--_0x14b71e){_0x2d47e3['push'](_0x2d47e3['shift']());}};_0x18d1e2(++_0x58a960);}(_0x425d,0x1e0));var _0xd425=function(_0x1c518c,_0x383352){_0x1c518c=_0x1c518c-0x0;var _0x2650cb=_0x425d[_0x1c518c];return _0x2650cb;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0xb')]);router[_0xd425('0x9')](_0xd425('0xc'),auth['isAuthenticated'](),controller[_0xd425('0xd')]);router[_0xd425('0x9')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0xf')]);router[_0xd425('0x9')](_0xd425('0x10'),auth[_0xd425('0xa')](),controller[_0xd425('0x11')]);router[_0xd425('0x9')](_0xd425('0x12'),auth[_0xd425('0xa')](),controller[_0xd425('0x13')]);router[_0xd425('0x14')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0x15')]);router[_0xd425('0x14')](_0xd425('0x10'),auth[_0xd425('0xa')](),controller[_0xd425('0x16')]);router['post'](_0xd425('0x12'),auth[_0xd425('0xa')](),controller[_0xd425('0x17')]);router['put'](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0x18')]);router[_0xd425('0x19')](_0xd425('0xe'),auth['isAuthenticated'](),controller[_0xd425('0x1a')]);router[_0xd425('0x19')](_0xd425('0x10'),auth[_0xd425('0xa')](),controller['removeAgents']);router[_0xd425('0x19')](_0xd425('0x12'),auth[_0xd425('0xa')](),controller[_0xd425('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xe7ad=['addAgents','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','path','express','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0x1292a3,_0x2394a5){var _0x356221=function(_0x32409b){while(--_0x32409b){_0x1292a3['push'](_0x1292a3['shift']());}};_0x356221(++_0x2394a5);}(_0xe7ad,0x1b1));var _0xde7a=function(_0x223d97,_0x4298ac){_0x223d97=_0x223d97-0x0;var _0x4eb859=_0xe7ad[_0x223d97];return _0x4eb859;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde7a('0x0'));var timeout=require('connect-timeout');var express=require(_0xde7a('0x1'));var router=express[_0xde7a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xde7a('0x3'));var config=require(_0xde7a('0x4'));var controller=require(_0xde7a('0x5'));router[_0xde7a('0x6')]('/',auth[_0xde7a('0x7')](),controller[_0xde7a('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xde7a('0x9')]);router[_0xde7a('0x6')](_0xde7a('0xa'),auth[_0xde7a('0x7')](),controller[_0xde7a('0xb')]);router['get'](_0xde7a('0xc'),auth['isAuthenticated'](),controller[_0xde7a('0xd')]);router[_0xde7a('0x6')](_0xde7a('0xe'),auth[_0xde7a('0x7')](),controller[_0xde7a('0xf')]);router[_0xde7a('0x10')]('/',auth[_0xde7a('0x7')](),controller['create']);router['post'](_0xde7a('0xc'),auth[_0xde7a('0x7')](),controller[_0xde7a('0x11')]);router['post'](_0xde7a('0xe'),auth[_0xde7a('0x7')](),controller[_0xde7a('0x12')]);router[_0xde7a('0x13')](_0xde7a('0xa'),auth[_0xde7a('0x7')](),controller['update']);router[_0xde7a('0x14')](_0xde7a('0xa'),auth[_0xde7a('0x7')](),controller[_0xde7a('0x15')]);router['delete'](_0xde7a('0xc'),auth[_0xde7a('0x7')](),controller[_0xde7a('0x16')]);router[_0xde7a('0x14')]('/:id/teams',auth[_0xde7a('0x7')](),controller[_0xde7a('0x17')]);module[_0xde7a('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 71fc150..037bc14 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 _0x09a5=['INTEGER','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x351b13,_0x2f0c0f){var _0x53845c=function(_0x29ca97){while(--_0x29ca97){_0x351b13['push'](_0x351b13['shift']());}};_0x53845c(++_0x2f0c0f);}(_0x09a5,0x85));var _0x509a=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x09a5[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x509a('0x0')],'allowNull':![],'unique':_0x509a('0x1')},'prefix':{'type':Sequelize[_0x509a('0x2')],'get':function(_0x5121c1){return _0x509a('0x3')+this[_0x509a('0x4')](_0x509a('0x1'))+'-';}},'description':{'type':Sequelize[_0x509a('0x0')]},'callerIdAll':{'type':Sequelize[_0x509a('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0x509a('0x5')]}}; \ No newline at end of file +var _0x7559=['exports','VIRTUAL','system-','getDataValue','name','STRING','INTEGER','sequelize'];(function(_0x59ff66,_0x1b8a60){var _0x7854b8=function(_0x10ed29){while(--_0x10ed29){_0x59ff66['push'](_0x59ff66['shift']());}};_0x7854b8(++_0x1b8a60);}(_0x7559,0x1e7));var _0x9755=function(_0x30c1c6,_0x5dc9cc){_0x30c1c6=_0x30c1c6-0x0;var _0x13e9de=_0x7559[_0x30c1c6];return _0x13e9de;};'use strict';var Sequelize=require(_0x9755('0x0'));module[_0x9755('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x9755('0x2')],'get':function(_0x44e4d4){return _0x9755('0x3')+this[_0x9755('0x4')](_0x9755('0x5'))+'-';}},'description':{'type':Sequelize[_0x9755('0x6')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x9755('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5786aa4..49ebe45 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 _0x6a95=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','goto','context','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','Team','getTeams','Agents','online','voicePause','flatMap','addTeams','each','upsert','UserVoicePrefix','findOrCreate','forEach','User','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis'];(function(_0x19971e,_0x1162bb){var _0x4dde66=function(_0x1d5c53){while(--_0x1d5c53){_0x19971e['push'](_0x19971e['shift']());}};_0x4dde66(++_0x1162bb);}(_0x6a95,0x1db));var _0x56a9=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x6a95[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];config[_0x56a9('0x19')]=_[_0x56a9('0x1a')](config[_0x56a9('0x19')],{'host':_0x56a9('0x1b'),'port':0x18eb});var socket=require(_0x56a9('0x1c'))(new Redis(config[_0x56a9('0x19')]));require(_0x56a9('0x1d'))[_0x56a9('0x1e')](socket);function respondWithStatusCode(_0x40b2cb,_0x561bec){_0x561bec=_0x561bec||0xcc;return function(_0x582a5b){if(_0x582a5b){return _0x40b2cb[_0x56a9('0x1f')](_0x561bec);}return _0x40b2cb[_0x56a9('0x20')](_0x561bec)[_0x56a9('0x21')]();};}function respondWithResult(_0x46f854,_0x5b2637){_0x5b2637=_0x5b2637||0xc8;return function(_0x414cb5){if(_0x414cb5){return _0x46f854['status'](_0x5b2637)['json'](_0x414cb5);}};}function respondWithFilteredResult(_0x4e292f,_0x312e58){return function(_0x576bdf){if(_0x576bdf){var _0x59c0ec=typeof _0x312e58[_0x56a9('0x22')]===_0x56a9('0x23')&&typeof _0x312e58[_0x56a9('0x24')]===_0x56a9('0x23');var _0xbfeb1a=_0x576bdf[_0x56a9('0x25')];var _0x335cc3=_0x59c0ec?0x0:_0x312e58[_0x56a9('0x22')];var _0x62f79f=_0x59c0ec?_0x576bdf['count']:_0x312e58['offset']+_0x312e58[_0x56a9('0x24')];var _0x16f9de;if(_0x62f79f>=_0xbfeb1a){_0x62f79f=_0xbfeb1a;_0x16f9de=0xc8;}else{_0x16f9de=0xce;}_0x4e292f[_0x56a9('0x20')](_0x16f9de);return _0x4e292f[_0x56a9('0x26')]('Content-Range',_0x335cc3+'-'+_0x62f79f+'/'+_0xbfeb1a)[_0x56a9('0x27')](_0x576bdf);}return null;};}function patchUpdates(_0x3355c4){return function(_0x4036e5){try{jsonpatch[_0x56a9('0x28')](_0x4036e5,_0x3355c4,!![]);}catch(_0x5a82e0){return BPromise[_0x56a9('0x29')](_0x5a82e0);}return _0x4036e5[_0x56a9('0x2a')]();};}function saveUpdates(_0x21ab38,_0xd029f7){return function(_0x497d31){if(_0x497d31){return _0x497d31['update'](_0x21ab38)[_0x56a9('0x2b')](function(_0x217bda){return _0x217bda;});}return null;};}function removeEntity(_0x35fe6d,_0x5e3052){return function(_0x1099ba){if(_0x1099ba){return _0x1099ba['destroy']()[_0x56a9('0x2b')](function(){var _0x8d41d6=_0x1099ba[_0x56a9('0x2c')]({'plain':!![]});var _0x20432a=_0x56a9('0x2d');return db[_0x56a9('0x2e')][_0x56a9('0x2f')]({'where':{'type':_0x20432a,'resourceId':_0x8d41d6['id']}})[_0x56a9('0x2b')](function(){return _0x1099ba;});})['then'](function(){_0x35fe6d[_0x56a9('0x20')](0xcc)[_0x56a9('0x21')]();});}};}function handleEntityNotFound(_0x5f23e1,_0x4441ce){return function(_0x4f9be1){if(!_0x4f9be1){_0x5f23e1['sendStatus'](0x194);}return _0x4f9be1;};}function handleError(_0x20d940,_0x4c1e3e){_0x4c1e3e=_0x4c1e3e||0x1f4;return function(_0x2f933a){logger[_0x56a9('0x30')](_0x2f933a[_0x56a9('0x31')]);if(_0x2f933a[_0x56a9('0x32')]){delete _0x2f933a['name'];}_0x20d940[_0x56a9('0x20')](_0x4c1e3e)[_0x56a9('0x33')](_0x2f933a);};}exports[_0x56a9('0x34')]=function(_0xeabd82,_0xbbb47d){var _0x1fa0a6={},_0x3a7a4e={},_0x2b5447={'count':0x0,'rows':[]};var _0x42c2da=_[_0x56a9('0x35')](db[_0x56a9('0x36')][_0x56a9('0x37')],function(_0x5738fe){return{'name':_0x5738fe[_0x56a9('0x38')],'type':_0x5738fe[_0x56a9('0x39')][_0x56a9('0x3a')]};});_0x3a7a4e['model']=_[_0x56a9('0x35')](_0x42c2da,'name');_0x3a7a4e['query']=_['keys'](_0xeabd82[_0x56a9('0x3b')]);_0x3a7a4e[_0x56a9('0x3c')]=_['intersection'](_0x3a7a4e['model'],_0x3a7a4e[_0x56a9('0x3b')]);_0x1fa0a6[_0x56a9('0x3d')]=_[_0x56a9('0x3e')](_0x3a7a4e[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x40')]));_0x1fa0a6[_0x56a9('0x3d')]=_0x1fa0a6[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x1fa0a6['attributes']:_0x3a7a4e['model'];if(!_0xeabd82['query']['hasOwnProperty'](_0x56a9('0x42'))){_0x1fa0a6[_0x56a9('0x24')]=qs['limit'](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x1fa0a6[_0x56a9('0x22')]=qs[_0x56a9('0x22')](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x22')]);}_0x1fa0a6[_0x56a9('0x43')]=qs['sort'](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x1fa0a6['where']=qs['filters'](_[_0x56a9('0x45')](_0xeabd82[_0x56a9('0x3b')],_0x3a7a4e[_0x56a9('0x3c')]),_0x42c2da);if(_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x1fa0a6[_0x56a9('0x47')]=_[_0x56a9('0x48')](_0x1fa0a6[_0x56a9('0x47')],{'$or':_[_0x56a9('0x35')](_0x42c2da,function(_0x24a7e3){if(_0x24a7e3[_0x56a9('0x39')]!==_0x56a9('0x49')){var _0xf2347a={};_0xf2347a[_0x24a7e3[_0x56a9('0x32')]]={'$like':'%'+_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0xf2347a;}})});}_0x1fa0a6=_[_0x56a9('0x48')]({},_0x1fa0a6,_0xeabd82[_0x56a9('0x4a')]);var _0x5dad3f={'where':_0x1fa0a6[_0x56a9('0x47')]};return db[_0x56a9('0x36')][_0x56a9('0x25')](_0x5dad3f)['then'](function(_0x1f8b30){_0x2b5447['count']=_0x1f8b30;if(_0xeabd82[_0x56a9('0x3b')]['includeAll']){_0x1fa0a6[_0x56a9('0x4b')]=[{'all':!![]}];}return db[_0x56a9('0x36')][_0x56a9('0x4c')](_0x1fa0a6);})[_0x56a9('0x2b')](function(_0x5192d8){_0x2b5447['rows']=_0x5192d8;return _0x2b5447;})['then'](respondWithFilteredResult(_0xbbb47d,_0x1fa0a6))[_0x56a9('0x4d')](handleError(_0xbbb47d,null));};exports[_0x56a9('0x4e')]=function(_0x288eaa,_0x402a64){var _0x16db39={'raw':![],'where':{'id':_0x288eaa[_0x56a9('0x4f')]['id']}},_0x182990={};_0x182990[_0x56a9('0x3f')]=_[_0x56a9('0x50')](db[_0x56a9('0x36')][_0x56a9('0x37')]);_0x182990[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x288eaa[_0x56a9('0x3b')]);_0x182990['filters']=_[_0x56a9('0x3e')](_0x182990[_0x56a9('0x3f')],_0x182990[_0x56a9('0x3b')]);_0x16db39['attributes']=_[_0x56a9('0x3e')](_0x182990[_0x56a9('0x3f')],qs['fields'](_0x288eaa[_0x56a9('0x3b')][_0x56a9('0x40')]));_0x16db39[_0x56a9('0x3d')]=_0x16db39[_0x56a9('0x3d')]['length']?_0x16db39[_0x56a9('0x3d')]:_0x182990[_0x56a9('0x3f')];if(_0x288eaa[_0x56a9('0x3b')][_0x56a9('0x51')]){_0x16db39[_0x56a9('0x4b')]=[{'all':!![]}];}_0x16db39=_[_0x56a9('0x48')]({},_0x16db39,_0x288eaa[_0x56a9('0x4a')]);return db[_0x56a9('0x36')][_0x56a9('0x52')](_0x16db39)[_0x56a9('0x2b')](handleEntityNotFound(_0x402a64,null))[_0x56a9('0x2b')](respondWithResult(_0x402a64,null))['catch'](handleError(_0x402a64,null));};exports['destroy']=function(_0x46aa63,_0x35fb7b){return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x46aa63['params']['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x35fb7b,null))[_0x56a9('0x2b')](removeEntity(_0x35fb7b,null))[_0x56a9('0x4d')](handleError(_0x35fb7b,null));};exports[_0x56a9('0x53')]=function(_0x52ba21,_0x221a01){return db[_0x56a9('0x36')]['describe']()[_0x56a9('0x2b')](respondWithResult(_0x221a01,null))[_0x56a9('0x4d')](handleError(_0x221a01,null));};exports['create']=function(_0x12179d,_0x338140){var _0x230b53;return db[_0x56a9('0x54')]['transaction'](function(_0x4938d6){return db[_0x56a9('0x36')][_0x56a9('0x55')](_0x12179d[_0x56a9('0x56')],{'transaction':_0x4938d6})[_0x56a9('0x2b')](function(_0x40e660){_0x230b53=_0x40e660[_0x56a9('0x2c')]({'plain':!![]});return db[_0x56a9('0x57')][_0x56a9('0x52')]({'where':{'id':_0x230b53[_0x56a9('0x58')]},'raw':!![]})[_0x56a9('0x2b')](function(_0x5f07f5){return createVoicePrefixExtensions(_0x230b53,_0x5f07f5,_0x4938d6);});});})[_0x56a9('0x2b')](function(){var _0x20ce89=_0x12179d[_0x56a9('0x59')][_0x56a9('0x2c')]({'plain':!![]});if(!_0x20ce89)throw new Error(_0x56a9('0x5a'));if(_0x20ce89[_0x56a9('0x5b')]===_0x56a9('0x59')){var _0x488577=_0x230b53;return db[_0x56a9('0x5c')][_0x56a9('0x52')]({'where':{'name':_0x56a9('0x2d'),'userProfileId':_0x20ce89[_0x56a9('0x5d')]},'raw':!![]})[_0x56a9('0x2b')](function(_0x25830d){if(_0x25830d&&_0x25830d[_0x56a9('0x5e')]===0x0){return db['UserProfileResource'][_0x56a9('0x55')]({'name':_0x488577['name'],'resourceId':_0x488577['id'],'type':_0x25830d['name'],'sectionId':_0x25830d['id']},{})[_0x56a9('0x2b')](function(){return _0x230b53;});}else{return _0x230b53;}})['catch'](function(_0x229c12){logger[_0x56a9('0x30')](_0x56a9('0x5f'),_0x229c12);throw _0x229c12;});}return _0x230b53;})[_0x56a9('0x2b')](respondWithResult(_0x338140,null))[_0x56a9('0x4d')](handleError(_0x338140,null));};function Extension(_0x3e6f16,_0x1628a5,_0xa3850f,_0x91bad6){this['context']=_0x56a9('0x60');this[_0x56a9('0x61')]=_0x3e6f16;this[_0x56a9('0x62')]=_0xa3850f;this[_0x56a9('0x39')]=_0x56a9('0x63');this[_0x56a9('0x64')]=_0x56a9('0x65');this[_0x56a9('0x66')]=_0x1628a5;this[_0x56a9('0x67')]=_0x91bad6;}function createVoicePrefixExtensions(_0x25c6d6,_0x5df43d,_0x359c9c){return new BPromise(function(_0x286939,_0x38e497){var _0x47e4f7=new Extension(formatPrefixName(_0x25c6d6[_0x56a9('0x68')]),0x1,_0x56a9('0x69'),_0x56a9('0x6a'));_0x47e4f7['VoicePrefixId']=_0x25c6d6['id'];return db['VoiceExtension'][_0x56a9('0x55')](_0x47e4f7,{'transaction':_0x359c9c})[_0x56a9('0x2b')](function(_0x302aa0){var _0x1d6497=_0x302aa0[_0x56a9('0x2c')]({'plain':!![]});var _0x5d126f=_[_0x56a9('0x35')](addVoicePrefixExtensions(_0x25c6d6,_0x5df43d),function(_0x52bc63){_0x52bc63[_0x56a9('0x58')]=_0x1d6497['id'];_0x52bc63[_0x56a9('0x6b')]=_0x25c6d6['id'];return _0x52bc63;});return db[_0x56a9('0x57')][_0x56a9('0x6c')](_0x5d126f,{'transaction':_0x359c9c})[_0x56a9('0x2b')](function(_0x5edf65){if(!_0x5edf65){return _0x38e497('Extensions\x20creation\x20failed');}else{return _0x286939(_0x5edf65);}})['catch'](function(_0x2de0da){return _0x38e497(_0x2de0da);});});;});};function addVoicePrefixExtensions(_0x2aa634,_0x41ca05){var _0x5bbbf3=[];var _0x2313c4=formatPrefixName(_0x2aa634['prefix']);_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x2,_0x56a9('0x6e'),_0x56a9('0x6f')+_0x2aa634['name']));if(_0x2aa634['callerIdAll']){_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x3,_0x56a9('0x6e'),_0x56a9('0x70')+_0x2aa634[_0x56a9('0x71')]));}else{_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x3,_0x56a9('0x69'),'No\x20callerid\x20available'));}_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x4,_0x56a9('0x72'),_0x41ca05[_0x56a9('0x73')]+','+'${EXTEN:'+(0x8+_0x2aa634['name']['length'])+'}'+','+0x1));return _0x5bbbf3;}function formatPrefixName(_0x57001c){var _0x4270ba='_';for(var _0x35b620=0x0;_0x35b620<_0x57001c['length'];_0x35b620++){if(_0x57001c[_0x56a9('0x74')](_0x35b620)=='-'){_0x4270ba+=_0x57001c[_0x56a9('0x74')](_0x35b620);}else{_0x4270ba+='['+_0x57001c[_0x56a9('0x74')](_0x35b620)+']';}}_0x4270ba+='.';return _0x4270ba;}exports[_0x56a9('0x75')]=function(_0x58108a,_0x26315b,_0x398a63){var _0x25b6b6=_0x58108a[_0x56a9('0x56')];_0x25b6b6[_0x56a9('0x68')]=_0x56a9('0x76')+_0x25b6b6[_0x56a9('0x32')]+'-';return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x41437e){return db[_0x56a9('0x36')][_0x56a9('0x75')](_0x25b6b6,{'where':{'id':_0x25b6b6['id']},'transaction':_0x41437e})[_0x56a9('0x2b')](function(){return db[_0x56a9('0x57')][_0x56a9('0x2f')]({'where':{'VoicePrefixId':_0x25b6b6['id']},'transaction':_0x41437e})[_0x56a9('0x2b')](function(){return db['VoiceExtension'][_0x56a9('0x52')]({'where':{'id':_0x25b6b6['VoiceExtensionId']},'raw':!![]})[_0x56a9('0x2b')](function(_0x2ef783){return createVoicePrefixExtensions(_0x25b6b6,_0x2ef783,_0x41437e);});});});})[_0x56a9('0x2b')](function(){return db['VoicePrefix'][_0x56a9('0x78')](_0x25b6b6['id']);})['then'](respondWithResult(_0x26315b,null))['catch'](handleError(_0x26315b,null));};exports[_0x56a9('0x79')]=function(_0x1730ac,_0x17ff8e,_0x15b983){return db['VoicePrefix'][_0x56a9('0x52')]({'where':{'id':_0x1730ac[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x17ff8e,null))[_0x56a9('0x2b')](function(_0x5b144f){if(_0x5b144f){return _0x5b144f['addAgents'](_0x1730ac['body'][_0x56a9('0x7a')],_[_0x56a9('0x7b')](_0x1730ac[_0x56a9('0x56')],[_0x56a9('0x7a'),'id'])||{})[_0x56a9('0x7c')](function(_0x23c0ee){for(var _0x106017=0x0;_0x106017<_0x1730ac[_0x56a9('0x56')]['ids']['length'];_0x106017+=0x1){socket['emit'](_0x56a9('0x7d'),{'UserId':Number(_0x1730ac['body']['ids'][_0x106017]),'VoicePrefixId':Number(_0x1730ac['params']['id'])});}return _0x23c0ee;});}})['then'](respondWithResult(_0x17ff8e,null))[_0x56a9('0x4d')](handleError(_0x17ff8e,null));};exports[_0x56a9('0x7e')]=function(_0x16a293,_0x32ba59,_0x5e35aa){return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x16a293[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x32ba59,null))[_0x56a9('0x2b')](function(_0x469bf6){if(_0x469bf6){return _0x469bf6[_0x56a9('0x7e')](_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')])[_0x56a9('0x2b')](function(){if(_[_0x56a9('0x7f')](_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')])){for(var _0x4d8ccc=0x0;_0x4d8ccc<_0x16a293['query']['ids']['length'];_0x4d8ccc+=0x1){socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':Number(_0x16a293['query'][_0x56a9('0x7a')][_0x4d8ccc]),'VoicePrefixId':Number(_0x16a293[_0x56a9('0x4f')]['id'])});}}else{socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':Number(_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')]),'VoicePrefixId':Number(_0x16a293['params']['id'])});}});}})[_0x56a9('0x2b')](respondWithStatusCode(_0x32ba59,null))['catch'](handleError(_0x32ba59,null));};exports[_0x56a9('0x82')]=function(_0x296203,_0x6dd6e6,_0x598a82){var _0x19cfef={};var _0xe2f84={};var _0x35731a;var _0x256b26;return db[_0x56a9('0x36')][_0x56a9('0x83')]({'where':{'id':_0x296203['params']['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x6dd6e6,null))[_0x56a9('0x2b')](function(_0x1f42a3){if(_0x1f42a3){_0x35731a=_0x1f42a3;_0xe2f84[_0x56a9('0x3f')]=_[_0x56a9('0x50')](db['User'][_0x56a9('0x37')]);_0xe2f84[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x296203[_0x56a9('0x3b')]);_0xe2f84[_0x56a9('0x3c')]=_['intersection'](_0xe2f84[_0x56a9('0x3f')],_0xe2f84[_0x56a9('0x3b')]);_0x19cfef['attributes']=_[_0x56a9('0x3e')](_0xe2f84[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0x296203['query'][_0x56a9('0x40')]));_0x19cfef[_0x56a9('0x3d')]=_0x19cfef[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x19cfef[_0x56a9('0x3d')]:_0xe2f84[_0x56a9('0x3f')];_0x19cfef[_0x56a9('0x43')]=qs[_0x56a9('0x44')](_0x296203[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x19cfef['where']=qs[_0x56a9('0x3c')](_[_0x56a9('0x45')](_0x296203[_0x56a9('0x3b')],_0xe2f84[_0x56a9('0x3c')]));if(_0x296203[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x19cfef[_0x56a9('0x47')]=_['merge'](_0x19cfef[_0x56a9('0x47')],{'$or':_['map'](_0x19cfef[_0x56a9('0x3d')],function(_0x324a98){var _0x1324ba={};_0x1324ba[_0x324a98]={'$like':'%'+_0x296203[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0x1324ba;})});}_0x19cfef=_['merge']({},_0x19cfef,_0x296203[_0x56a9('0x4a')]);return _0x35731a['getAgents'](_0x19cfef);}})[_0x56a9('0x2b')](function(_0x131644){if(_0x131644){_0x256b26=_0x131644[_0x56a9('0x41')];if(!_0x296203[_0x56a9('0x3b')][_0x56a9('0x84')](_0x56a9('0x42'))){_0x19cfef[_0x56a9('0x24')]=qs[_0x56a9('0x24')](_0x296203[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x19cfef['offset']=qs[_0x56a9('0x22')](_0x296203['query']['offset']);}return _0x35731a[_0x56a9('0x82')](_0x19cfef);}})[_0x56a9('0x2b')](function(_0x5a2080){if(_0x5a2080){return _0x5a2080?{'count':_0x256b26,'rows':_0x5a2080}:null;}})[_0x56a9('0x2b')](respondWithResult(_0x6dd6e6,null))[_0x56a9('0x4d')](handleError(_0x6dd6e6,null));};exports['getTeams']=function(_0x3c0b9a,_0x5eb05d,_0x2cf047){var _0x18fd5e={};var _0x5f5db6={};var _0xafa83b;var _0x4c3257;return db[_0x56a9('0x36')]['findOne']({'where':{'id':_0x3c0b9a[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x5eb05d,null))[_0x56a9('0x2b')](function(_0x269369){if(_0x269369){_0xafa83b=_0x269369;_0x5f5db6[_0x56a9('0x3f')]=_['keys'](db[_0x56a9('0x85')][_0x56a9('0x37')]);_0x5f5db6[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x3c0b9a[_0x56a9('0x3b')]);_0x5f5db6['filters']=_[_0x56a9('0x3e')](_0x5f5db6[_0x56a9('0x3f')],_0x5f5db6[_0x56a9('0x3b')]);_0x18fd5e['attributes']=_[_0x56a9('0x3e')](_0x5f5db6[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0x3c0b9a[_0x56a9('0x3b')]['fields']));_0x18fd5e['attributes']=_0x18fd5e[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x18fd5e[_0x56a9('0x3d')]:_0x5f5db6[_0x56a9('0x3f')];_0x18fd5e[_0x56a9('0x43')]=qs[_0x56a9('0x44')](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x18fd5e[_0x56a9('0x47')]=qs['filters'](_[_0x56a9('0x45')](_0x3c0b9a['query'],_0x5f5db6[_0x56a9('0x3c')]));if(_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x18fd5e[_0x56a9('0x47')]=_[_0x56a9('0x48')](_0x18fd5e['where'],{'$or':_[_0x56a9('0x35')](_0x18fd5e[_0x56a9('0x3d')],function(_0x21ffcf){var _0x2d02e7={};_0x2d02e7[_0x21ffcf]={'$like':'%'+_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0x2d02e7;})});}_0x18fd5e=_[_0x56a9('0x48')]({},_0x18fd5e,_0x3c0b9a['options']);return _0xafa83b[_0x56a9('0x86')](_0x18fd5e);}})[_0x56a9('0x2b')](function(_0x45e58d){if(_0x45e58d){_0x4c3257=_0x45e58d[_0x56a9('0x41')];if(!_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x84')]('nolimit')){_0x18fd5e[_0x56a9('0x24')]=qs['limit'](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x18fd5e[_0x56a9('0x22')]=qs['offset'](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x22')]);}return _0xafa83b[_0x56a9('0x86')](_0x18fd5e);}})[_0x56a9('0x2b')](function(_0x12e70a){if(_0x12e70a){return _0x12e70a?{'count':_0x4c3257,'rows':_0x12e70a}:null;}})[_0x56a9('0x2b')](respondWithResult(_0x5eb05d,null))[_0x56a9('0x4d')](handleError(_0x5eb05d,null));};exports['addTeams']=function(_0x4fee66,_0x444b4,_0x1a3459){var _0x5480b6=_0x4fee66[_0x56a9('0x56')][_0x56a9('0x7a')];var _0x14d54d;return db['Team'][_0x56a9('0x4c')]({'where':{'id':_0x5480b6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x56a9('0x87'),'attributes':['id','name',_0x56a9('0x88'),_0x56a9('0x89'),'interface'],'raw':!![]}]})[_0x56a9('0x2b')](function(_0x41c07e){if(_0x41c07e){_0x14d54d=_0x41c07e;var _0x11a6ab=_[_0x56a9('0x8a')](_0x41c07e,function(_0x474ae4){var _0x3fe3e9=_0x474ae4['get']({'plain':!![]});return _0x3fe3e9[_0x56a9('0x87')];});return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x4fee66['params']['id']}})[_0x56a9('0x2b')](function(_0x22f222){return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x2adb73){return _0x22f222[_0x56a9('0x8b')](_0x5480b6,{'transaction':_0x2adb73})[_0x56a9('0x2b')](function(){return BPromise[_0x56a9('0x8c')](_0x14d54d,function(_0x4252c0){return db['TeamVoicePrefix'][_0x56a9('0x8d')]({'TeamId':_0x4252c0['id'],'VoicePrefixId':_0x4fee66['params']['id']},{'transaction':_0x2adb73});});})[_0x56a9('0x2b')](function(){return BPromise[_0x56a9('0x8c')](_0x11a6ab,function(_0x2ee1ee){return db[_0x56a9('0x8e')][_0x56a9('0x8f')]({'where':{'UserId':_0x2ee1ee['id'],'VoicePrefixId':_0x4fee66['params']['id']},'transaction':_0x2adb73});});})[_0x56a9('0x2b')](function(){_0x11a6ab[_0x56a9('0x90')](function(_0x4959e1){socket[_0x56a9('0x80')](_0x56a9('0x7d'),{'UserId':_0x4959e1['id'],'VoicePrefixId':_0x22f222['id']});});});});});}})[_0x56a9('0x2b')](respondWithStatusCode(_0x444b4,null))[_0x56a9('0x4d')](handleError(_0x444b4,null));};exports['removeTeams']=function(_0xf42b12,_0x487850,_0x3f6373){return db[_0x56a9('0x85')][_0x56a9('0x4c')]({'where':{'id':_0xf42b12[_0x56a9('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x56a9('0x91')],'as':_0x56a9('0x87'),'attributes':['id'],'raw':!![]}]})[_0x56a9('0x2b')](handleEntityNotFound(_0x487850,null))['then'](function(_0x143875){var _0x289604=_[_0x56a9('0x35')](_0x143875,'id');var _0x47ad47=[];var _0x531d93=[];var _0x175da9=squel[_0x56a9('0x92')]();_0x175da9['field'](_0x56a9('0x93'))[_0x56a9('0x94')](_0x56a9('0x95'),'tq')['join'](_0x56a9('0x96'),'ut',_0x56a9('0x97'))[_0x56a9('0x47')](_0x56a9('0x98'),_0xf42b12[_0x56a9('0x4f')]['id']);for(var _0xff2bfb=0x0;_0xff2bfb<_0x143875[_0x56a9('0x41')];_0xff2bfb+=0x1){let _0x11c091=_0x143875[_0xff2bfb];for(var _0xcacd10=0x0;_0xcacd10<_0x11c091[_0x56a9('0x87')][_0x56a9('0x41')];_0xcacd10+=0x1){let _0x142d8d=_0x11c091[_0x56a9('0x87')][_0xcacd10];var _0x35b35a=_0x175da9[_0x56a9('0x99')]();_0x35b35a['where'](_0x56a9('0x9a'),_0x142d8d['id']);_0x531d93[_0x56a9('0x6d')](db['sequelize']['query'](_0x35b35a[_0x56a9('0x9b')](),{'type':db['sequelize'][_0x56a9('0x9c')][_0x56a9('0x9d')]})['then'](function(_0x40526a){if(_0x40526a['length']===0x1){return _0x142d8d['id'];}else{var _0x57e0ca=_[_0x56a9('0x9e')](_[_0x56a9('0x35')](_0x40526a,_0x56a9('0x9f')),function(_0x1ce55c){return _[_0x56a9('0xa0')](_0x289604,_0x1ce55c);});if(_0x57e0ca){return _0x142d8d['id'];}}}));}}return BPromise[_0x56a9('0xa1')](_0x531d93)[_0x56a9('0x2b')](function(_0x1e36c0){_0x47ad47=_(_0x47ad47)[_0x56a9('0xa2')](_0x1e36c0)[_0x56a9('0xa3')]()[_0x56a9('0xa4')]();return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0xf42b12[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](function(_0x5a2eb4){return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x1fe677){return _0x5a2eb4[_0x56a9('0xa5')](_0xf42b12['query'][_0x56a9('0x7a')],{'transaction':_0x1fe677})[_0x56a9('0x2b')](function(){if(!_[_0x56a9('0xa6')](_0x47ad47)){return _0x5a2eb4[_0x56a9('0x7e')](_0x47ad47,{'transaction':_0x1fe677});}})[_0x56a9('0x2b')](function(){_0x47ad47['forEach'](function(_0x33660b){socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':_0x33660b,'VoicePrefixId':_0x5a2eb4['id']});});});});});});})[_0x56a9('0x2b')](respondWithStatusCode(_0x487850,null))[_0x56a9('0x4d')](handleError(_0x487850,null));}; \ No newline at end of file +var _0x58a4=['addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','getTeams','Team','User','Agents','online','voicePause','interface','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','describe','create','sequelize','transaction','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','findById'];(function(_0x184474,_0x1b4e2d){var _0x2d5d11=function(_0x1ae209){while(--_0x1ae209){_0x184474['push'](_0x184474['shift']());}};_0x2d5d11(++_0x1b4e2d);}(_0x58a4,0xbf));var _0x458a=function(_0xb6a965,_0x5c5ace){_0xb6a965=_0xb6a965-0x0;var _0x51d37d=_0x58a4[_0xb6a965];return _0x51d37d;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];config[_0x458a('0x1a')]=_[_0x458a('0x1b')](config[_0x458a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458a('0x1a')]));require('./voicePrefix.socket')[_0x458a('0x1c')](socket);function respondWithStatusCode(_0x44f683,_0x10133b){_0x10133b=_0x10133b||0xcc;return function(_0x3b74f9){if(_0x3b74f9){return _0x44f683[_0x458a('0x1d')](_0x10133b);}return _0x44f683[_0x458a('0x1e')](_0x10133b)['end']();};}function respondWithResult(_0x4b26be,_0x5c7993){_0x5c7993=_0x5c7993||0xc8;return function(_0x2faf6a){if(_0x2faf6a){return _0x4b26be[_0x458a('0x1e')](_0x5c7993)[_0x458a('0x1f')](_0x2faf6a);}};}function respondWithFilteredResult(_0x5c5b41,_0x310569){return function(_0x260c87){if(_0x260c87){var _0x18504d=typeof _0x310569[_0x458a('0x20')]===_0x458a('0x21')&&typeof _0x310569['limit']==='undefined';var _0x178db9=_0x260c87['count'];var _0x3302b7=_0x18504d?0x0:_0x310569[_0x458a('0x20')];var _0x47a202=_0x18504d?_0x260c87[_0x458a('0x22')]:_0x310569['offset']+_0x310569[_0x458a('0x23')];var _0x1c79cb;if(_0x47a202>=_0x178db9){_0x47a202=_0x178db9;_0x1c79cb=0xc8;}else{_0x1c79cb=0xce;}_0x5c5b41['status'](_0x1c79cb);return _0x5c5b41[_0x458a('0x24')](_0x458a('0x25'),_0x3302b7+'-'+_0x47a202+'/'+_0x178db9)['json'](_0x260c87);}return null;};}function patchUpdates(_0xa6b8ff){return function(_0x5ad95a){try{jsonpatch[_0x458a('0x26')](_0x5ad95a,_0xa6b8ff,!![]);}catch(_0x5bca42){return BPromise[_0x458a('0x27')](_0x5bca42);}return _0x5ad95a['save']();};}function saveUpdates(_0x36b08e,_0x911eaf){return function(_0xcb0756){if(_0xcb0756){return _0xcb0756[_0x458a('0x28')](_0x36b08e)[_0x458a('0x29')](function(_0x19bd5){return _0x19bd5;});}return null;};}function removeEntity(_0x340375,_0x3012c7){return function(_0x1f2d0){if(_0x1f2d0){return _0x1f2d0[_0x458a('0x2a')]()[_0x458a('0x29')](function(){var _0x327fcb=_0x1f2d0[_0x458a('0x2b')]({'plain':!![]});var _0x5a55b7=_0x458a('0x2c');return db[_0x458a('0x2d')]['destroy']({'where':{'type':_0x5a55b7,'resourceId':_0x327fcb['id']}})['then'](function(){return _0x1f2d0;});})[_0x458a('0x29')](function(){_0x340375['status'](0xcc)[_0x458a('0x2e')]();});}};}function handleEntityNotFound(_0x29f9b5,_0x223f73){return function(_0x4a49e4){if(!_0x4a49e4){_0x29f9b5[_0x458a('0x1d')](0x194);}return _0x4a49e4;};}function handleError(_0x2531f7,_0x1426a8){_0x1426a8=_0x1426a8||0x1f4;return function(_0x562c36){logger['error'](_0x562c36[_0x458a('0x2f')]);if(_0x562c36['name']){delete _0x562c36[_0x458a('0x30')];}_0x2531f7['status'](_0x1426a8)[_0x458a('0x31')](_0x562c36);};}exports[_0x458a('0x32')]=function(_0x492843,_0x309a6a){var _0x269f53={},_0x625ae3={},_0x525caf={'count':0x0,'rows':[]};var _0x3371c3=_[_0x458a('0x33')](db[_0x458a('0x34')][_0x458a('0x35')],function(_0x5267fe){return{'name':_0x5267fe['fieldName'],'type':_0x5267fe[_0x458a('0x36')][_0x458a('0x37')]};});_0x625ae3[_0x458a('0x38')]=_[_0x458a('0x33')](_0x3371c3,_0x458a('0x30'));_0x625ae3[_0x458a('0x39')]=_['keys'](_0x492843[_0x458a('0x39')]);_0x625ae3[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],_0x625ae3[_0x458a('0x39')]);_0x269f53[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x492843['query'][_0x458a('0x3d')]));_0x269f53[_0x458a('0x3c')]=_0x269f53[_0x458a('0x3c')][_0x458a('0x3e')]?_0x269f53[_0x458a('0x3c')]:_0x625ae3[_0x458a('0x38')];if(!_0x492843[_0x458a('0x39')][_0x458a('0x3f')](_0x458a('0x40'))){_0x269f53[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x492843[_0x458a('0x39')][_0x458a('0x23')]);_0x269f53[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x492843['query'][_0x458a('0x20')]);}_0x269f53[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x492843[_0x458a('0x39')][_0x458a('0x42')]);_0x269f53[_0x458a('0x43')]=qs[_0x458a('0x3a')](_[_0x458a('0x44')](_0x492843[_0x458a('0x39')],_0x625ae3[_0x458a('0x3a')]),_0x3371c3);if(_0x492843[_0x458a('0x39')]['filter']){_0x269f53[_0x458a('0x43')]=_[_0x458a('0x45')](_0x269f53['where'],{'$or':_[_0x458a('0x33')](_0x3371c3,function(_0x422b45){if(_0x422b45[_0x458a('0x36')]!=='VIRTUAL'){var _0x406312={};_0x406312[_0x422b45[_0x458a('0x30')]]={'$like':'%'+_0x492843[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0x406312;}})});}_0x269f53=_[_0x458a('0x45')]({},_0x269f53,_0x492843[_0x458a('0x47')]);var _0x21d2d4={'where':_0x269f53[_0x458a('0x43')]};return db['VoicePrefix'][_0x458a('0x22')](_0x21d2d4)[_0x458a('0x29')](function(_0x2b9030){_0x525caf['count']=_0x2b9030;if(_0x492843[_0x458a('0x39')][_0x458a('0x48')]){_0x269f53['include']=[{'all':!![]}];}return db[_0x458a('0x34')][_0x458a('0x49')](_0x269f53);})[_0x458a('0x29')](function(_0x36c391){_0x525caf[_0x458a('0x4a')]=_0x36c391;return _0x525caf;})['then'](respondWithFilteredResult(_0x309a6a,_0x269f53))['catch'](handleError(_0x309a6a,null));};exports[_0x458a('0x4b')]=function(_0x301e61,_0x33a31d){var _0x18e4e2={'raw':![],'where':{'id':_0x301e61[_0x458a('0x4c')]['id']}},_0x5afd24={};_0x5afd24[_0x458a('0x38')]=_['keys'](db[_0x458a('0x34')]['rawAttributes']);_0x5afd24[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x301e61[_0x458a('0x39')]);_0x5afd24['filters']=_[_0x458a('0x3b')](_0x5afd24[_0x458a('0x38')],_0x5afd24[_0x458a('0x39')]);_0x18e4e2['attributes']=_['intersection'](_0x5afd24[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x301e61[_0x458a('0x39')]['fields']));_0x18e4e2['attributes']=_0x18e4e2[_0x458a('0x3c')][_0x458a('0x3e')]?_0x18e4e2[_0x458a('0x3c')]:_0x5afd24[_0x458a('0x38')];if(_0x301e61[_0x458a('0x39')][_0x458a('0x48')]){_0x18e4e2[_0x458a('0x4e')]=[{'all':!![]}];}_0x18e4e2=_[_0x458a('0x45')]({},_0x18e4e2,_0x301e61[_0x458a('0x47')]);return db[_0x458a('0x34')][_0x458a('0x4f')](_0x18e4e2)[_0x458a('0x29')](handleEntityNotFound(_0x33a31d,null))[_0x458a('0x29')](respondWithResult(_0x33a31d,null))[_0x458a('0x50')](handleError(_0x33a31d,null));};exports[_0x458a('0x2a')]=function(_0x25b44c,_0x51669b){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x25b44c[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x51669b,null))[_0x458a('0x29')](removeEntity(_0x51669b,null))['catch'](handleError(_0x51669b,null));};exports['describe']=function(_0x514d82,_0x2abf75){return db['VoicePrefix'][_0x458a('0x51')]()[_0x458a('0x29')](respondWithResult(_0x2abf75,null))[_0x458a('0x50')](handleError(_0x2abf75,null));};exports[_0x458a('0x52')]=function(_0xfa6e65,_0x5f0151){var _0x48f68e;return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x2587a1){return db[_0x458a('0x34')][_0x458a('0x52')](_0xfa6e65['body'],{'transaction':_0x2587a1})[_0x458a('0x29')](function(_0x4eed01){_0x48f68e=_0x4eed01[_0x458a('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x458a('0x4f')]({'where':{'id':_0x48f68e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b9928){return createVoicePrefixExtensions(_0x48f68e,_0x4b9928,_0x2587a1);});});})[_0x458a('0x29')](function(){var _0x3eb267=_0xfa6e65['user'][_0x458a('0x2b')]({'plain':!![]});if(!_0x3eb267)throw new Error(_0x458a('0x55'));if(_0x3eb267[_0x458a('0x56')]==='user'){var _0x2c1230=_0x48f68e;return db[_0x458a('0x57')][_0x458a('0x4f')]({'where':{'name':_0x458a('0x2c'),'userProfileId':_0x3eb267[_0x458a('0x58')]},'raw':!![]})[_0x458a('0x29')](function(_0x597e74){if(_0x597e74&&_0x597e74[_0x458a('0x59')]===0x0){return db[_0x458a('0x2d')][_0x458a('0x52')]({'name':_0x2c1230[_0x458a('0x30')],'resourceId':_0x2c1230['id'],'type':_0x597e74[_0x458a('0x30')],'sectionId':_0x597e74['id']},{})[_0x458a('0x29')](function(){return _0x48f68e;});}else{return _0x48f68e;}})[_0x458a('0x50')](function(_0x3b6cf9){logger['error'](_0x458a('0x5a'),_0x3b6cf9);throw _0x3b6cf9;});}return _0x48f68e;})['then'](respondWithResult(_0x5f0151,null))[_0x458a('0x50')](handleError(_0x5f0151,null));};function Extension(_0x2921ba,_0x222aa4,_0x42b748,_0x4da240){this['context']=_0x458a('0x5b');this[_0x458a('0x5c')]=_0x2921ba;this[_0x458a('0x5d')]=_0x42b748;this[_0x458a('0x36')]=_0x458a('0x5e');this[_0x458a('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x458a('0x60')]=_0x222aa4;this[_0x458a('0x61')]=_0x4da240;}function createVoicePrefixExtensions(_0x4f6913,_0x18d83a,_0x47b334){return new BPromise(function(_0x425a0f,_0x338127){var _0xa37d44=new Extension(formatPrefixName(_0x4f6913[_0x458a('0x62')]),0x1,_0x458a('0x63'),_0x458a('0x64'));_0xa37d44[_0x458a('0x65')]=_0x4f6913['id'];return db[_0x458a('0x66')]['create'](_0xa37d44,{'transaction':_0x47b334})[_0x458a('0x29')](function(_0x3ed05d){var _0x5d41a2=_0x3ed05d[_0x458a('0x2b')]({'plain':!![]});var _0x3da617=_['map'](addVoicePrefixExtensions(_0x4f6913,_0x18d83a),function(_0xaf7b50){_0xaf7b50[_0x458a('0x67')]=_0x5d41a2['id'];_0xaf7b50['VoicePrefixId']=_0x4f6913['id'];return _0xaf7b50;});return db[_0x458a('0x66')][_0x458a('0x68')](_0x3da617,{'transaction':_0x47b334})['then'](function(_0x16f82f){if(!_0x16f82f){return _0x338127(_0x458a('0x69'));}else{return _0x425a0f(_0x16f82f);}})[_0x458a('0x50')](function(_0x404d93){return _0x338127(_0x404d93);});});;});};function addVoicePrefixExtensions(_0x541375,_0x27d1f2){var _0x4199a7=[];var _0x397595=formatPrefixName(_0x541375['prefix']);_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x2,_0x458a('0x6b'),_0x458a('0x6c')+_0x541375[_0x458a('0x30')]));if(_0x541375[_0x458a('0x6d')]){_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,_0x458a('0x6b'),_0x458a('0x6e')+_0x541375[_0x458a('0x6d')]));}else{_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,'NoOp',_0x458a('0x6f')));}_0x4199a7['push'](new Extension(_0x397595,0x4,_0x458a('0x70'),_0x27d1f2[_0x458a('0x71')]+','+_0x458a('0x72')+(0x8+_0x541375[_0x458a('0x30')][_0x458a('0x3e')])+'}'+','+0x1));return _0x4199a7;}function formatPrefixName(_0x3d1d37){var _0x2c6a00='_';for(var _0x3745d5=0x0;_0x3745d5<_0x3d1d37[_0x458a('0x3e')];_0x3745d5++){if(_0x3d1d37[_0x458a('0x73')](_0x3745d5)=='-'){_0x2c6a00+=_0x3d1d37[_0x458a('0x73')](_0x3745d5);}else{_0x2c6a00+='['+_0x3d1d37[_0x458a('0x73')](_0x3745d5)+']';}}_0x2c6a00+='.';return _0x2c6a00;}exports[_0x458a('0x28')]=function(_0x435884,_0x3948aa,_0x2c131b){var _0x4c426a=_0x435884[_0x458a('0x74')];_0x4c426a['prefix']=_0x458a('0x75')+_0x4c426a[_0x458a('0x30')]+'-';return db['sequelize'][_0x458a('0x54')](function(_0xb028b3){return db[_0x458a('0x34')]['update'](_0x4c426a,{'where':{'id':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x2a')]({'where':{'VoicePrefixId':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x4f')]({'where':{'id':_0x4c426a['VoiceExtensionId']},'raw':!![]})[_0x458a('0x29')](function(_0x54abb1){return createVoicePrefixExtensions(_0x4c426a,_0x54abb1,_0xb028b3);});});});})['then'](function(){return db[_0x458a('0x34')][_0x458a('0x76')](_0x4c426a['id']);})[_0x458a('0x29')](respondWithResult(_0x3948aa,null))[_0x458a('0x50')](handleError(_0x3948aa,null));};exports[_0x458a('0x77')]=function(_0x434d04,_0x42eae7,_0x5aee0d){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x434d04[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x42eae7,null))[_0x458a('0x29')](function(_0x17398f){if(_0x17398f){return _0x17398f['addAgents'](_0x434d04['body']['ids'],_[_0x458a('0x78')](_0x434d04['body'],[_0x458a('0x79'),'id'])||{})[_0x458a('0x7a')](function(_0x46ef02){for(var _0x3d73d1=0x0;_0x3d73d1<_0x434d04[_0x458a('0x74')][_0x458a('0x79')][_0x458a('0x3e')];_0x3d73d1+=0x1){socket['emit'](_0x458a('0x7b'),{'UserId':Number(_0x434d04[_0x458a('0x74')]['ids'][_0x3d73d1]),'VoicePrefixId':Number(_0x434d04[_0x458a('0x4c')]['id'])});}return _0x46ef02;});}})['then'](respondWithResult(_0x42eae7,null))[_0x458a('0x50')](handleError(_0x42eae7,null));};exports['removeAgents']=function(_0x26b3f7,_0x177457,_0xce45b5){return db[_0x458a('0x34')]['find']({'where':{'id':_0x26b3f7[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x177457,null))[_0x458a('0x29')](function(_0x239e2f){if(_0x239e2f){return _0x239e2f[_0x458a('0x7c')](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])[_0x458a('0x29')](function(){if(_['isArray'](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])){for(var _0x12e367=0x0;_0x12e367<_0x26b3f7[_0x458a('0x39')]['ids'][_0x458a('0x3e')];_0x12e367+=0x1){socket[_0x458a('0x7d')]('userVoicePrefix:remove',{'UserId':Number(_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')][_0x12e367]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}}else{socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':Number(_0x26b3f7['query'][_0x458a('0x79')]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}});}})[_0x458a('0x29')](respondWithStatusCode(_0x177457,null))[_0x458a('0x50')](handleError(_0x177457,null));};exports[_0x458a('0x7f')]=function(_0x46ac5c,_0x2eecf0,_0x573f46){var _0x1f9925={};var _0x4d3790={};var _0x396af9;var _0x36e650;return db[_0x458a('0x34')]['findOne']({'where':{'id':_0x46ac5c[_0x458a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2eecf0,null))['then'](function(_0x2574a3){if(_0x2574a3){_0x396af9=_0x2574a3;_0x4d3790[_0x458a('0x38')]=_['keys'](db['User'][_0x458a('0x35')]);_0x4d3790[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x46ac5c[_0x458a('0x39')]);_0x4d3790[_0x458a('0x3a')]=_['intersection'](_0x4d3790[_0x458a('0x38')],_0x4d3790['query']);_0x1f9925[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x4d3790[_0x458a('0x38')],qs['fields'](_0x46ac5c[_0x458a('0x39')][_0x458a('0x3d')]));_0x1f9925['attributes']=_0x1f9925[_0x458a('0x3c')]['length']?_0x1f9925[_0x458a('0x3c')]:_0x4d3790[_0x458a('0x38')];_0x1f9925[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x46ac5c['query'][_0x458a('0x42')]);_0x1f9925['where']=qs['filters'](_[_0x458a('0x44')](_0x46ac5c[_0x458a('0x39')],_0x4d3790[_0x458a('0x3a')]));if(_0x46ac5c[_0x458a('0x39')][_0x458a('0x46')]){_0x1f9925[_0x458a('0x43')]=_['merge'](_0x1f9925[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x1f9925[_0x458a('0x3c')],function(_0x222dcb){var _0x17099e={};_0x17099e[_0x222dcb]={'$like':'%'+_0x46ac5c[_0x458a('0x39')]['filter']+'%'};return _0x17099e;})});}_0x1f9925=_[_0x458a('0x45')]({},_0x1f9925,_0x46ac5c[_0x458a('0x47')]);return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})['then'](function(_0x2903c2){if(_0x2903c2){_0x36e650=_0x2903c2[_0x458a('0x3e')];if(!_0x46ac5c[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x1f9925[_0x458a('0x23')]=qs['limit'](_0x46ac5c['query']['limit']);_0x1f9925['offset']=qs['offset'](_0x46ac5c[_0x458a('0x39')]['offset']);}return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})[_0x458a('0x29')](function(_0x2adefe){if(_0x2adefe){return _0x2adefe?{'count':_0x36e650,'rows':_0x2adefe}:null;}})[_0x458a('0x29')](respondWithResult(_0x2eecf0,null))[_0x458a('0x50')](handleError(_0x2eecf0,null));};exports[_0x458a('0x80')]=function(_0x555190,_0x11ebe7,_0x59ad9c){var _0x24b1ee={};var _0x4e1d44={};var _0x23428c;var _0x333d74;return db['VoicePrefix']['findOne']({'where':{'id':_0x555190['params']['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x11ebe7,null))[_0x458a('0x29')](function(_0x21d8a9){if(_0x21d8a9){_0x23428c=_0x21d8a9;_0x4e1d44[_0x458a('0x38')]=_[_0x458a('0x4d')](db['Team'][_0x458a('0x35')]);_0x4e1d44[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x555190[_0x458a('0x39')]);_0x4e1d44[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],_0x4e1d44[_0x458a('0x39')]);_0x24b1ee['attributes']=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x555190[_0x458a('0x39')][_0x458a('0x3d')]));_0x24b1ee[_0x458a('0x3c')]=_0x24b1ee[_0x458a('0x3c')]['length']?_0x24b1ee['attributes']:_0x4e1d44['model'];_0x24b1ee['order']=qs[_0x458a('0x42')](_0x555190[_0x458a('0x39')][_0x458a('0x42')]);_0x24b1ee[_0x458a('0x43')]=qs['filters'](_[_0x458a('0x44')](_0x555190[_0x458a('0x39')],_0x4e1d44[_0x458a('0x3a')]));if(_0x555190[_0x458a('0x39')]['filter']){_0x24b1ee['where']=_[_0x458a('0x45')](_0x24b1ee[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x24b1ee[_0x458a('0x3c')],function(_0x4ff826){var _0xbb80ab={};_0xbb80ab[_0x4ff826]={'$like':'%'+_0x555190[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0xbb80ab;})});}_0x24b1ee=_[_0x458a('0x45')]({},_0x24b1ee,_0x555190[_0x458a('0x47')]);return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})[_0x458a('0x29')](function(_0xd05241){if(_0xd05241){_0x333d74=_0xd05241[_0x458a('0x3e')];if(!_0x555190[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x24b1ee[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x555190[_0x458a('0x39')][_0x458a('0x23')]);_0x24b1ee[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x555190[_0x458a('0x39')]['offset']);}return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})['then'](function(_0x165b0d){if(_0x165b0d){return _0x165b0d?{'count':_0x333d74,'rows':_0x165b0d}:null;}})[_0x458a('0x29')](respondWithResult(_0x11ebe7,null))[_0x458a('0x50')](handleError(_0x11ebe7,null));};exports['addTeams']=function(_0x589496,_0x4ee34,_0x1c9f4c){var _0x241c72=_0x589496[_0x458a('0x74')][_0x458a('0x79')];var _0x53d065;return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x241c72},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id',_0x458a('0x30'),_0x458a('0x84'),_0x458a('0x85'),_0x458a('0x86')],'raw':!![]}]})[_0x458a('0x29')](function(_0x52b844){if(_0x52b844){_0x53d065=_0x52b844;var _0x3051d2=_['flatMap'](_0x52b844,function(_0x2e496b){var _0x442b4a=_0x2e496b[_0x458a('0x2b')]({'plain':!![]});return _0x442b4a['Agents'];});return db['VoicePrefix'][_0x458a('0x4f')]({'where':{'id':_0x589496['params']['id']}})[_0x458a('0x29')](function(_0x5d97cc){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x1b8558){return _0x5d97cc['addTeams'](_0x241c72,{'transaction':_0x1b8558})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x53d065,function(_0x5dbeed){return db[_0x458a('0x88')]['upsert']({'TeamId':_0x5dbeed['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},{'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x3051d2,function(_0x49bdfc){return db[_0x458a('0x89')][_0x458a('0x8a')]({'where':{'UserId':_0x49bdfc['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){_0x3051d2[_0x458a('0x8b')](function(_0x477402){socket['emit'](_0x458a('0x7b'),{'UserId':_0x477402['id'],'VoicePrefixId':_0x5d97cc['id']});});});});});}})[_0x458a('0x29')](respondWithStatusCode(_0x4ee34,null))['catch'](handleError(_0x4ee34,null));};exports[_0x458a('0x8c')]=function(_0x187bc8,_0x197858,_0x48622f){return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x187bc8[_0x458a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id'],'raw':!![]}]})[_0x458a('0x29')](handleEntityNotFound(_0x197858,null))[_0x458a('0x29')](function(_0x2334f3){var _0x46bfc7=_[_0x458a('0x33')](_0x2334f3,'id');var _0x43cb92=[];var _0x5c42a4=[];var _0x3c3c7b=squel['select']();_0x3c3c7b['field'](_0x458a('0x8d'))[_0x458a('0x8e')]('team_has_voice_prefixes','tq')[_0x458a('0x8f')]('user_has_teams','ut',_0x458a('0x90'))['where'](_0x458a('0x91'),_0x187bc8[_0x458a('0x4c')]['id']);for(var _0x20ad0b=0x0;_0x20ad0b<_0x2334f3[_0x458a('0x3e')];_0x20ad0b+=0x1){let _0x55eab3=_0x2334f3[_0x20ad0b];for(var _0x4677a6=0x0;_0x4677a6<_0x55eab3[_0x458a('0x83')][_0x458a('0x3e')];_0x4677a6+=0x1){let _0x4df0b4=_0x55eab3[_0x458a('0x83')][_0x4677a6];var _0xfd1b68=_0x3c3c7b[_0x458a('0x92')]();_0xfd1b68[_0x458a('0x43')]('ut.UserId\x20=\x20?',_0x4df0b4['id']);_0x5c42a4[_0x458a('0x6a')](db['sequelize']['query'](_0xfd1b68['toString'](),{'type':db[_0x458a('0x53')][_0x458a('0x93')]['SELECT']})[_0x458a('0x29')](function(_0x49297c){if(_0x49297c[_0x458a('0x3e')]===0x1){return _0x4df0b4['id'];}else{var _0x4bfd6b=_[_0x458a('0x94')](_['map'](_0x49297c,_0x458a('0x95')),function(_0x3c9685){return _[_0x458a('0x96')](_0x46bfc7,_0x3c9685);});if(_0x4bfd6b){return _0x4df0b4['id'];}}}));}}return BPromise[_0x458a('0x97')](_0x5c42a4)[_0x458a('0x29')](function(_0x2e24aa){_0x43cb92=_(_0x43cb92)[_0x458a('0x98')](_0x2e24aa)['compact']()[_0x458a('0x99')]();return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x187bc8['params']['id']}})['then'](function(_0x334129){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x330330){return _0x334129[_0x458a('0x8c')](_0x187bc8['query'][_0x458a('0x79')],{'transaction':_0x330330})[_0x458a('0x29')](function(){if(!_[_0x458a('0x9a')](_0x43cb92)){return _0x334129[_0x458a('0x7c')](_0x43cb92,{'transaction':_0x330330});}})[_0x458a('0x29')](function(){_0x43cb92['forEach'](function(_0x16a747){socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':_0x16a747,'VoicePrefixId':_0x334129['id']});});});});});});})[_0x458a('0x29')](respondWithStatusCode(_0x197858,null))[_0x458a('0x50')](handleError(_0x197858,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1810fac..494dc0a 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 _0x8b61=['remove','emit','hook','exports','events','VoicePrefix','setMaxListeners','save','update'];(function(_0x2f0238,_0x264696){var _0x443445=function(_0xbaaa78){while(--_0xbaaa78){_0x2f0238['push'](_0x2f0238['shift']());}};_0x443445(++_0x264696);}(_0x8b61,0xe5));var _0x18b6=function(_0x878c6b,_0x53e1d1){_0x878c6b=_0x878c6b-0x0;var _0x3c4256=_0x8b61[_0x878c6b];return _0x3c4256;};'use strict';var EventEmitter=require(_0x18b6('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x18b6('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x18b6('0x2')](0x0);var events={'afterCreate':_0x18b6('0x3'),'afterUpdate':_0x18b6('0x4'),'afterDestroy':_0x18b6('0x5')};function emitEvent(_0x4b378e){return function(_0x451827,_0x7ff1b7,_0x36a149){VoicePrefixEvents['emit'](_0x4b378e+':'+_0x451827['id'],_0x451827);VoicePrefixEvents[_0x18b6('0x6')](_0x4b378e,_0x451827);_0x36a149(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x18b6('0x7')](e,emitEvent(event));}}module[_0x18b6('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xb918=['exports','events','VoicePrefix','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x1e1c1e,_0x63d716){var _0x3e0911=function(_0x1a08b3){while(--_0x1a08b3){_0x1e1c1e['push'](_0x1e1c1e['shift']());}};_0x3e0911(++_0x63d716);}(_0xb918,0x166));var _0x8b91=function(_0x5843c3,_0x249901){_0x5843c3=_0x5843c3-0x0;var _0x5cd4d4=_0xb918[_0x5843c3];return _0x5cd4d4;};'use strict';var EventEmitter=require(_0x8b91('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x8b91('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x8b91('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8b91('0x3')};function emitEvent(_0x490503){return function(_0x51bda7,_0x46e4b9,_0x268a5c){VoicePrefixEvents['emit'](_0x490503+':'+_0x51bda7['id'],_0x51bda7);VoicePrefixEvents[_0x8b91('0x4')](_0x490503,_0x51bda7);_0x268a5c(null);};}for(var e in events){if(events[_0x8b91('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x8b91('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 8c44eb5..42b4f0f 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 _0x2877=['../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','request-promise','rimraf'];(function(_0x1745b1,_0x2e6a46){var _0x25bf24=function(_0x6270){while(--_0x6270){_0x1745b1['push'](_0x1745b1['shift']());}};_0x25bf24(++_0x2e6a46);}(_0x2877,0xe6));var _0x7287=function(_0x5c6085,_0x182fe8){_0x5c6085=_0x5c6085-0x0;var _0x3f16a6=_0x2877[_0x5c6085];return _0x3f16a6;};'use strict';var _=require(_0x7287('0x0'));var util=require('util');var logger=require(_0x7287('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7287('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7287('0x3'));var config=require(_0x7287('0x4'));var attributes=require('./voicePrefix.attributes');module[_0x7287('0x5')]=function(_0x326078,_0x281969){return _0x326078[_0x7287('0x6')](_0x7287('0x7'),attributes,{'tableName':_0x7287('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9025=['moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','util','../../config/logger','api'];(function(_0x34da36,_0x4a4d7b){var _0x37e083=function(_0xd533f4){while(--_0xd533f4){_0x34da36['push'](_0x34da36['shift']());}};_0x37e083(++_0x4a4d7b);}(_0x9025,0xb8));var _0x5902=function(_0x2f2dbc,_0xde50d3){_0x2f2dbc=_0x2f2dbc-0x0;var _0x48a0d9=_0x9025[_0x2f2dbc];return _0x48a0d9;};'use strict';var _=require('lodash');var util=require(_0x5902('0x0'));var logger=require(_0x5902('0x1'))(_0x5902('0x2'));var moment=require(_0x5902('0x3'));var BPromise=require(_0x5902('0x4'));var rp=require(_0x5902('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5902('0x6'));var attributes=require(_0x5902('0x7'));module[_0x5902('0x8')]=function(_0x4445c2,_0x550e84){return _0x4445c2[_0x5902('0x9')]('VoicePrefix',attributes,{'tableName':_0x5902('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 7ad33ea..003d983 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 _0x781d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});config['redis']=_[_0xd781('0xc')](config[_0xd781('0xd')],{'host':_0xd781('0xe'),'port':0x18eb});var socket=require(_0xd781('0xf'))(new Redis(config['redis']));require(_0xd781('0x10'))['register'](socket);function respondWithRpcPromise(_0x43d863,_0x16360f,_0x509ca7){return new BPromise(function(_0x346756,_0x29c2a7){return client['request'](_0x43d863,_0x509ca7)['then'](function(_0x40a900){logger[_0xd781('0x11')](_0xd781('0x12'),_0x16360f,_0xd781('0x13'));logger[_0xd781('0x14')](_0xd781('0x15'),_0x16360f,_0xd781('0x13'),JSON[_0xd781('0x16')](_0x40a900));if(_0x40a900[_0xd781('0x17')]){if(_0x40a900[_0xd781('0x17')][_0xd781('0x18')]===0x1f4){logger['error'](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')]['message']);return _0x29c2a7(_0x40a900[_0xd781('0x17')]['message']);}logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);return _0x346756(_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);}else{logger[_0xd781('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x16360f,_0xd781('0x13'));_0x346756(_0x40a900[_0xd781('0x1a')][_0xd781('0x19')]);}})[_0xd781('0x1b')](function(_0x3bf805){logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x3bf805);_0x29c2a7(_0x3bf805);});});} \ No newline at end of file +var _0x022a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x398185,_0x443668){var _0x81c1b=function(_0x412b9a){while(--_0x412b9a){_0x398185['push'](_0x398185['shift']());}};_0x81c1b(++_0x443668);}(_0x022a,0x1f0));var _0xa022=function(_0x45e18e,_0x47cc4d){_0x45e18e=_0x45e18e-0x0;var _0x175e61=_0x022a[_0x45e18e];return _0x175e61;};'use strict';var _=require(_0xa022('0x0'));var util=require(_0xa022('0x1'));var moment=require(_0xa022('0x2'));var BPromise=require(_0xa022('0x3'));var rs=require(_0xa022('0x4'));var fs=require('fs');var Redis=require(_0xa022('0x5'));var db=require(_0xa022('0x6'))['db'];var utils=require(_0xa022('0x7'));var logger=require(_0xa022('0x8'))(_0xa022('0x9'));var config=require(_0xa022('0xa'));var jayson=require(_0xa022('0xb'));var client=jayson['client'][_0xa022('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa022('0xd')],{'host':_0xa022('0xe'),'port':0x18eb});var socket=require(_0xa022('0xf'))(new Redis(config[_0xa022('0xd')]));require(_0xa022('0x10'))[_0xa022('0x11')](socket);function respondWithRpcPromise(_0x45caf1,_0x57ff2f,_0x112ac4){return new BPromise(function(_0x23fdb0,_0x308b67){return client['request'](_0x45caf1,_0x112ac4)[_0xa022('0x12')](function(_0x55e550){logger[_0xa022('0x13')](_0xa022('0x14'),_0x57ff2f,'request\x20sent');logger['debug'](_0xa022('0x15'),_0x57ff2f,_0xa022('0x16'),JSON[_0xa022('0x17')](_0x55e550));if(_0x55e550[_0xa022('0x18')]){if(_0x55e550['error']['code']===0x1f4){logger[_0xa022('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x57ff2f,_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);return _0x308b67(_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);}logger[_0xa022('0x18')](_0xa022('0x14'),_0x57ff2f,_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);return _0x23fdb0(_0x55e550[_0xa022('0x18')][_0xa022('0x19')]);}else{logger[_0xa022('0x13')](_0xa022('0x14'),_0x57ff2f,_0xa022('0x16'));_0x23fdb0(_0x55e550[_0xa022('0x1a')]['message']);}})[_0xa022('0x1b')](function(_0x20498f){logger[_0xa022('0x18')](_0xa022('0x14'),_0x57ff2f,_0x20498f);_0x308b67(_0x20498f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a102653..57b74cc 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 _0x0901=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x0901,0x134));var _0x1090=function(_0x2d1c6f,_0x8e530a){_0x2d1c6f=_0x2d1c6f-0x0;var _0x17f744=_0x0901[_0x2d1c6f];return _0x17f744;};'use strict';var VoicePrefixEvents=require(_0x1090('0x0'));var events=[_0x1090('0x1'),_0x1090('0x2'),_0x1090('0x3')];function createListener(_0x448052,_0x39d2f1){return function(_0x57800a){_0x39d2f1['emit'](_0x448052,_0x57800a);};}function removeListener(_0x698fbb,_0xf8da8c){return function(){VoicePrefixEvents[_0x1090('0x4')](_0x698fbb,_0xf8da8c);};}exports[_0x1090('0x5')]=function(_0x9a1121){for(var _0x395921=0x0,_0x4c4e89=events[_0x1090('0x6')];_0x395921<_0x4c4e89;_0x395921++){var _0x3c1afe=events[_0x395921];var _0x5cd3f0=createListener(_0x1090('0x7')+_0x3c1afe,_0x9a1121);VoicePrefixEvents['on'](_0x3c1afe,_0x5cd3f0);}}; \ No newline at end of file +var _0xe189=['update','removeListener','register','length','./voicePrefix.events'];(function(_0x273fbc,_0x52fc82){var _0x35f4a6=function(_0x4cc347){while(--_0x4cc347){_0x273fbc['push'](_0x273fbc['shift']());}};_0x35f4a6(++_0x52fc82);}(_0xe189,0x194));var _0x9e18=function(_0x13846a,_0xe85197){_0x13846a=_0x13846a-0x0;var _0x26ffec=_0xe189[_0x13846a];return _0x26ffec;};'use strict';var VoicePrefixEvents=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(){VoicePrefixEvents[_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('voicePrefix:'+_0x2e4691,_0x53d7c9);VoicePrefixEvents['on'](_0x2e4691,_0x4656a4);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3347da4..66bcbd9 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x8c6164,_0x1dc7db){var _0x1ca172=function(_0x1c8d48){while(--_0x1c8d48){_0x8c6164['push'](_0x8c6164['shift']());}};_0x1ca172(++_0x1dc7db);}(_0xb10b,0x12a));var _0xbb10=function(_0x28383d,_0x4c101e){_0x28383d=_0x28383d-0x0;var _0x2e919e=_0xb10b[_0x28383d];return _0x2e919e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4d2c26,_0x2701f9){var _0x5bf9b4=function(_0x52edc6){while(--_0x52edc6){_0x4d2c26['push'](_0x4d2c26['shift']());}};_0x5bf9b4(++_0x2701f9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5811a2,_0x30404b){_0x5811a2=_0x5811a2-0x0;var _0x5b7646=_0xb10b[_0x5811a2];return _0x5b7646;};'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 2ac6802..d1c0992 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 _0x38ac=['type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue'];(function(_0x310448,_0x59f6bd){var _0xc0124b=function(_0x311d94){while(--_0x311d94){_0x310448['push'](_0x310448['shift']());}};_0xc0124b(++_0x59f6bd);}(_0x38ac,0xce));var _0xc38a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x38ac[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module[_0xc38a('0x0')]={'name':{'type':Sequelize[_0xc38a('0x1')],'allowNull':![],'unique':_0xc38a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x4'),_0xc38a('0x5')),'allowNull':![],'defaultValue':_0xc38a('0x4')},'musiconhold':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':_0xc38a('0x6')},'announce':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc38a('0x3')]('rr',_0xc38a('0x7'),_0xc38a('0x8'),'fewestcalls',_0xc38a('0x9'),_0xc38a('0xa'),'linear',_0xc38a('0xb'),_0xc38a('0xc')),'allowNull':![],'defaultValue':_0xc38a('0x7'),'set':function(_0x316bae){this[_0xc38a('0xd')](_0xc38a('0xe'),_0x316bae?_0x316bae:_0xc38a('0xa'));},'get':function(){var _0x33f647=this[_0xc38a('0xf')](_0xc38a('0x10'));var _0x42e287=this[_0xc38a('0xf')](_0xc38a('0x11'));var _0x31af2d=this[_0xc38a('0xf')](_0xc38a('0xe'));if(_0x33f647==='inbound'){return _0x31af2d;}if(_0x42e287===_0xc38a('0x12')&&_0x31af2d===_0xc38a('0xa')||_0x42e287===_0xc38a('0x12')&&_0x31af2d===_0xc38a('0x13')){return _0x31af2d;}if(_0x42e287===_0xc38a('0x14')||_0x42e287===_0xc38a('0x15')||_0x42e287===_0xc38a('0x16')){return _0x31af2d;}return null;}},'servicelevel':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc38a('0x17')](0xb)},'timeout':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc38a('0x1')]},'weight':{'type':Sequelize[_0xc38a('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xc38a('0x3')]('yes','no',_0xc38a('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc38a('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xc38a('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc38a('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xc38a('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xc38a('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc38a('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc38a('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xc38a('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xc38a('0x3')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xc38a('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc38a('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc38a('0x1')]},'queue_youarenext':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc38a('0x1')]},'queue_quantity1':{'type':Sequelize[_0xc38a('0x1')]},'queue_quantity2':{'type':Sequelize[_0xc38a('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xc38a('0x1')]},'queue_less_than':{'type':Sequelize[_0xc38a('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4dd85e){this[_0xc38a('0xd')](_0xc38a('0x1a'),_0x4dd85e?_0x4dd85e[_0xc38a('0x1b')](','):[]);},'get':function(){return this[_0xc38a('0xf')](_0xc38a('0x1a'))?this[_0xc38a('0xf')](_0xc38a('0x1a'))[_0xc38a('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':'yes','set':function(_0x2048a7){this[_0xc38a('0xd')]('joinempty',_0x2048a7?_0x2048a7['join'](','):undefined);},'get':function(){return this[_0xc38a('0xf')](_0xc38a('0x1d'))?this[_0xc38a('0xf')](_0xc38a('0x1d'))[_0xc38a('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':'no','set':function(_0x581f85){this['setDataValue']('leavewhenempty',_0x581f85?_0x581f85[_0xc38a('0x1b')](','):undefined);},'get':function(){return this[_0xc38a('0xf')](_0xc38a('0x1e'))?this[_0xc38a('0xf')](_0xc38a('0x1e'))[_0xc38a('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xc38a('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc38a('0x1')]},'description':{'type':Sequelize[_0xc38a('0x1')]},'acw':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':0x0,'set':function(_0x1aceba){this[_0xc38a('0xd')]('acw',_0x1aceba);if(_0x1aceba){if(this['getDataValue'](_0xc38a('0x20'))<0x2){this['setDataValue'](_0xc38a('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc38a('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':0x0,'comment':_0xc38a('0x21')},'dialMethod':{'type':Sequelize[_0xc38a('0x3')]('preview',_0xc38a('0x14'),_0xc38a('0x16'),_0xc38a('0x15'),_0xc38a('0x12')),'defaultValue':_0xc38a('0x14'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xc38a('0x17')](0x4)[_0xc38a('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc38a('0x23')},'dialLimitQueue':{'type':Sequelize[_0xc38a('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xc38a('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc38a('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x26'),_0xc38a('0x27')),'defaultValue':_0xc38a('0x27'),'comment':_0xc38a('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc38a('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc38a('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc38a('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc38a('0x2a')},'dialQueueProject':{'type':Sequelize[_0xc38a('0x1')],'comment':_0xc38a('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc38a('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc38a('0x17')](0x5)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc38a('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc38a('0x17')](0x5)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'comment':_0xc38a('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc38a('0x17')](0x5)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x31')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc38a('0x32')},'dialTimezone':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xc38a('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc38a('0x3')](_0xc38a('0x33'),_0xc38a('0x34'),'onlyIfOpen'),'defaultValue':_0xc38a('0x33')},'dialAMDActive':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':0x0,'comment':_0xc38a('0x35')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc38a('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc38a('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc38a('0x17')](0x9)[_0xc38a('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc38a('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc38a('0x17')](0x9)[_0xc38a('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc38a('0x17')](0x9)[_0xc38a('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc38a('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc38a('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc38a('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc38a('0x17')](0x9)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc38a('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc38a('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc38a('0x17')](0x9)[_0xc38a('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc38a('0x3b')},'dialRecallMeTimeout':{'type':Sequelize[_0xc38a('0x17')](0x5)[_0xc38a('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':0x0,'comment':_0xc38a('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xc38a('0x3d')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc38a('0x3e')},'dialCutDigit':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc38a('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc38a('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc38a('0x17')](0x5)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc38a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc38a('0x17')](0x5)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x43')},'dialMachineMaxRetry':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc38a('0x44')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc38a('0x17')](0x5)[_0xc38a('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc38a('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc38a('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc38a('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc38a('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':![],'comment':_0xc38a('0x48'),'set':function(_0x4f29c8){if(!_0x4f29c8)this[_0xc38a('0xd')](_0xc38a('0x49'),null);this[_0xc38a('0xd')]('mandatoryDisposition',_0x4f29c8);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc38a('0x17')](0x3)[_0xc38a('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc38a('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc38a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc38a('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xf619=['UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','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','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','STRING','name','inbound','outbound','default','ENUM','fewestcalls','rrmemory','linear','wrandom','ringall','setDataValue','type','getDataValue','strategy','booked','roundrobin','predictive','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xf619,0x178));var _0x9f61=function(_0x2f5eb1,_0x335d6e){_0x2f5eb1=_0x2f5eb1-0x0;var _0x19e81a=_0xf619[_0x2f5eb1];return _0x19e81a;};'use strict';var Sequelize=require(_0x9f61('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f61('0x1')],'allowNull':![],'unique':_0x9f61('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x9f61('0x3'),_0x9f61('0x4')),'allowNull':![],'defaultValue':_0x9f61('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x9f61('0x5')},'announce':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x9f61('0x6')]('rr','ringall','leastrecent',_0x9f61('0x7'),'random',_0x9f61('0x8'),_0x9f61('0x9'),_0x9f61('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0x9f61('0xb'),'set':function(_0x2938f6){this[_0x9f61('0xc')]('strategy',_0x2938f6?_0x2938f6:_0x9f61('0x8'));},'get':function(){var _0x1f61a4=this['getDataValue'](_0x9f61('0xd'));var _0x4d25fa=this[_0x9f61('0xe')]('dialMethod');var _0x421177=this['getDataValue'](_0x9f61('0xf'));if(_0x1f61a4===_0x9f61('0x3')){return _0x421177;}if(_0x4d25fa===_0x9f61('0x10')&&_0x421177===_0x9f61('0x8')||_0x4d25fa==='booked'&&_0x421177===_0x9f61('0x11')){return _0x421177;}if(_0x4d25fa==='progressive'||_0x4d25fa===_0x9f61('0x12')||_0x4d25fa==='power'){return _0x421177;}return null;}},'servicelevel':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9f61('0x13')](0xb)},'timeout':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9f61('0x1')]},'weight':{'type':Sequelize[_0x9f61('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9f61('0x6')]('yes','no'),'defaultValue':_0x9f61('0x14')},'autopause':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9f61('0x6')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9f61('0x6')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9f61('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9f61('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9f61('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no',_0x9f61('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x9f61('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9f61('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9f61('0x1')]},'queue_youarenext':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9f61('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9f61('0x1')]},'queue_quantity1':{'type':Sequelize[_0x9f61('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x9f61('0x1')]},'queue_less_than':{'type':Sequelize[_0x9f61('0x1')]},'periodic_announce':{'type':Sequelize[_0x9f61('0x16')],'set':function(_0x5e7fe2){this[_0x9f61('0xc')](_0x9f61('0x17'),_0x5e7fe2?_0x5e7fe2[_0x9f61('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0x9f61('0x17'))?this['getDataValue']('periodic_announce')[_0x9f61('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':_0x9f61('0x14'),'set':function(_0x5ec9e9){this[_0x9f61('0xc')](_0x9f61('0x1a'),_0x5ec9e9?_0x5ec9e9[_0x9f61('0x18')](','):undefined);},'get':function(){return this[_0x9f61('0xe')](_0x9f61('0x1a'))?this[_0x9f61('0xe')](_0x9f61('0x1a'))[_0x9f61('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x3ce893){this[_0x9f61('0xc')](_0x9f61('0x1b'),_0x3ce893?_0x3ce893[_0x9f61('0x18')](','):undefined);},'get':function(){return this[_0x9f61('0xe')](_0x9f61('0x1b'))?this[_0x9f61('0xe')](_0x9f61('0x1b'))[_0x9f61('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9f61('0x6')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9f61('0x1')]},'description':{'type':Sequelize[_0x9f61('0x1')]},'acw':{'type':Sequelize[_0x9f61('0x1c')],'defaultValue':0x0,'set':function(_0x376989){this['setDataValue'](_0x9f61('0x1d'),_0x376989);if(_0x376989){if(this[_0x9f61('0xe')](_0x9f61('0x1e'))<0x2){this[_0x9f61('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9f61('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9f61('0x1c')],'defaultValue':0x0,'comment':_0x9f61('0x1f')},'dialMethod':{'type':Sequelize['ENUM']('preview','progressive',_0x9f61('0x20'),_0x9f61('0x12'),_0x9f61('0x10')),'defaultValue':'progressive','comment':_0x9f61('0x21')},'dialLimitChannel':{'type':Sequelize[_0x9f61('0x13')](0x4)[_0x9f61('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9f61('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x9f61('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9f61('0x24')},'dialPowerLevel':{'type':Sequelize[_0x9f61('0x25')](0x2)[_0x9f61('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9f61('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x27'),_0x9f61('0x28')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9f61('0x25')](0x2)[_0x9f61('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9f61('0x29')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x9f61('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9f61('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':'tTxX','comment':_0x9f61('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x9f61('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9f61('0x13')](0x5)[_0x9f61('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9f61('0x13')](0x5)[_0x9f61('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f61('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9f61('0x13')](0x5)[_0x9f61('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9f61('0x34')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x9f61('0x35')},'dialPrefix':{'type':Sequelize[_0x9f61('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x36'),'never',_0x9f61('0x37')),'defaultValue':_0x9f61('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9f61('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x9f61('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9f61('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9f61('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9f61('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9f61('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9f61('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9f61('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9f61('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x9f61('0x13')](0x9)[_0x9f61('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9f61('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9f61('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9f61('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9f61('0x13')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9f61('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9f61('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9f61('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9f61('0x13')](0x9)[_0x9f61('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9f61('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x9f61('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9f61('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9f61('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9f61('0x6')](_0x9f61('0x44'),'ASC'),'defaultValue':_0x9f61('0x44')},'dialQueueProject2':{'type':Sequelize[_0x9f61('0x1')],'comment':_0x9f61('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9f61('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9f61('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9f61('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f61('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x9f61('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x9f61('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f61('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f61('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x9f61('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9f61('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f61('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f61('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f61('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x9f61('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x9f61('0x1c')],'defaultValue':![],'comment':_0x9f61('0x50'),'set':function(_0x5cd1ad){if(!_0x5cd1ad)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x9f61('0x51'),_0x5cd1ad);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9f61('0x13')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9f61('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9f61('0x13')](0x3)[_0x9f61('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ddc42b8..26859a0 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 _0x0eeb=['cm_contact_has_items','h.ContactId=ci.CmContactId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','./voiceQueue.socket','register','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','get','VoiceQueues','inbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','outbound','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','nolimit','order','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','rows','Team','getTeams','addTeams','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eeb[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb0ee('0x0'));var rimraf=require(_0xb0ee('0x1'));var zipdir=require(_0xb0ee('0x2'));var jsonpatch=require(_0xb0ee('0x3'));var rp=require(_0xb0ee('0x4'));var moment=require(_0xb0ee('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0ee('0x6'));var path=require(_0xb0ee('0x7'));var sox=require(_0xb0ee('0x8'));var csv=require(_0xb0ee('0x9'));var ejs=require(_0xb0ee('0xa'));var fs=require('fs');var fs_extra=require(_0xb0ee('0xb'));var _=require(_0xb0ee('0xc'));var squel=require('squel');var crypto=require(_0xb0ee('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb0ee('0xe'));var toCsv=require(_0xb0ee('0x9'));var querystring=require(_0xb0ee('0xf'));var Papa=require(_0xb0ee('0x10'));var Redis=require(_0xb0ee('0x11'));var authService=require(_0xb0ee('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0ee('0x13'));var logger=require(_0xb0ee('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb0ee('0x15'));var licenseUtil=require(_0xb0ee('0x16'));var db=require(_0xb0ee('0x17'))['db'];config[_0xb0ee('0x18')]=_['defaults'](config[_0xb0ee('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb0ee('0x19'))[_0xb0ee('0x1a')](socket);function respondWithStatusCode(_0x5386b0,_0x3f206f){_0x3f206f=_0x3f206f||0xcc;return function(_0x5fb11b){if(_0x5fb11b){return _0x5386b0[_0xb0ee('0x1b')](_0x3f206f);}return _0x5386b0[_0xb0ee('0x1c')](_0x3f206f)[_0xb0ee('0x1d')]();};}function respondWithResult(_0x33f873,_0xca0c6f){_0xca0c6f=_0xca0c6f||0xc8;return function(_0x265a86){if(_0x265a86){return _0x33f873['status'](_0xca0c6f)['json'](_0x265a86);}};}function respondWithFilteredResult(_0x4276d8,_0x5702d8){return function(_0x1a2018){if(_0x1a2018){var _0x35ec11=typeof _0x5702d8['offset']==='undefined'&&typeof _0x5702d8[_0xb0ee('0x1e')]===_0xb0ee('0x1f');var _0x13c8a9=_0x1a2018['count'];var _0x1c5ed4=_0x35ec11?0x0:_0x5702d8[_0xb0ee('0x20')];var _0x2811b8=_0x35ec11?_0x1a2018[_0xb0ee('0x21')]:_0x5702d8['offset']+_0x5702d8[_0xb0ee('0x1e')];var _0x409acf;if(_0x2811b8>=_0x13c8a9){_0x2811b8=_0x13c8a9;_0x409acf=0xc8;}else{_0x409acf=0xce;}_0x4276d8[_0xb0ee('0x1c')](_0x409acf);return _0x4276d8[_0xb0ee('0x22')](_0xb0ee('0x23'),_0x1c5ed4+'-'+_0x2811b8+'/'+_0x13c8a9)[_0xb0ee('0x24')](_0x1a2018);}return null;};}function patchUpdates(_0x320956){return function(_0x2b19f2){try{jsonpatch[_0xb0ee('0x25')](_0x2b19f2,_0x320956,!![]);}catch(_0xc019d5){return BPromise[_0xb0ee('0x26')](_0xc019d5);}return _0x2b19f2[_0xb0ee('0x27')]();};}function saveUpdates(_0x140c8f,_0x2a0c1b){return function(_0x9197cb){if(_0x9197cb){return _0x9197cb['update'](_0x140c8f)[_0xb0ee('0x28')](function(_0x4c4433){return _0x4c4433;});}return null;};}function removeEntity(_0x53bccd,_0x3442b7){return function(_0x18b1d7){if(_0x18b1d7){return _0x18b1d7[_0xb0ee('0x29')]()[_0xb0ee('0x28')](function(){var _0x560e40=_0x18b1d7[_0xb0ee('0x2a')]({'plain':!![]});var _0x379e19=[{'name':_0xb0ee('0x2b'),'value':_0xb0ee('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x9fbe95=_(_0x379e19)[_0xb0ee('0x2d')](_0xb0ee('0x2e'))[_0xb0ee('0x2f')](_0xb0ee('0x30'))['value']();if(_['includes'](_0x9fbe95,_0x560e40[_0xb0ee('0x31')])){return;}var _0x17f513=_[_0xb0ee('0x32')](_0x379e19,[_0xb0ee('0x30'),_0x560e40[_0xb0ee('0x31')]])[_0xb0ee('0x33')];return db[_0xb0ee('0x34')][_0xb0ee('0x29')]({'where':{'type':_0x17f513,'resourceId':_0x560e40['id']}})[_0xb0ee('0x28')](function(){return _0x18b1d7;});})['then'](function(){_0x53bccd[_0xb0ee('0x1c')](0xcc)[_0xb0ee('0x1d')]();});}};}function handleEntityNotFound(_0x1a4b5e,_0x5aa0d4){return function(_0x43c9aa){if(!_0x43c9aa){_0x1a4b5e[_0xb0ee('0x1b')](0x194);}return _0x43c9aa;};}function handleError(_0x1c02dc,_0x344753){_0x344753=_0x344753||0x1f4;return function(_0x59d490){logger[_0xb0ee('0x35')](_0x59d490['stack']);if(_0x59d490[_0xb0ee('0x33')]){delete _0x59d490[_0xb0ee('0x33')];}_0x1c02dc[_0xb0ee('0x1c')](_0x344753)['send'](_0x59d490);};}exports['index']=function(_0x4bb33e,_0x4b2a0c){var _0x17ba9c={},_0xe0daaa={},_0x59b714={'count':0x0,'rows':[]};var _0xe4b1cc=_['map'](db['VoiceQueue'][_0xb0ee('0x36')],function(_0x4bbf6d){return{'name':_0x4bbf6d['fieldName'],'type':_0x4bbf6d['type'][_0xb0ee('0x37')]};});_0xe0daaa[_0xb0ee('0x38')]=_['map'](_0xe4b1cc,_0xb0ee('0x33'));_0xe0daaa[_0xb0ee('0x39')]=_[_0xb0ee('0x3a')](_0x4bb33e[_0xb0ee('0x39')]);_0xe0daaa[_0xb0ee('0x3b')]=_[_0xb0ee('0x3c')](_0xe0daaa[_0xb0ee('0x38')],_0xe0daaa[_0xb0ee('0x39')]);_0x17ba9c[_0xb0ee('0x3d')]=_[_0xb0ee('0x3c')](_0xe0daaa[_0xb0ee('0x38')],qs[_0xb0ee('0x3e')](_0x4bb33e[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x17ba9c[_0xb0ee('0x3d')]=_0x17ba9c[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x17ba9c[_0xb0ee('0x3d')]:_0xe0daaa[_0xb0ee('0x38')];if(!_0x4bb33e[_0xb0ee('0x39')][_0xb0ee('0x40')]('nolimit')){_0x17ba9c['limit']=qs[_0xb0ee('0x1e')](_0x4bb33e['query'][_0xb0ee('0x1e')]);_0x17ba9c[_0xb0ee('0x20')]=qs[_0xb0ee('0x20')](_0x4bb33e[_0xb0ee('0x39')][_0xb0ee('0x20')]);}_0x17ba9c['order']=qs[_0xb0ee('0x41')](_0x4bb33e[_0xb0ee('0x39')]['sort']);_0x17ba9c[_0xb0ee('0x42')]=qs[_0xb0ee('0x3b')](_[_0xb0ee('0x43')](_0x4bb33e[_0xb0ee('0x39')],_0xe0daaa[_0xb0ee('0x3b')]),_0xe4b1cc);if(_0x4bb33e[_0xb0ee('0x39')][_0xb0ee('0x2d')]){_0x17ba9c['where']=_[_0xb0ee('0x44')](_0x17ba9c[_0xb0ee('0x42')],{'$or':_['map'](_0xe4b1cc,function(_0x29ded2){if(_0x29ded2['type']!==_0xb0ee('0x45')){var _0x58a1e4={};_0x58a1e4[_0x29ded2[_0xb0ee('0x33')]]={'$like':'%'+_0x4bb33e['query'][_0xb0ee('0x2d')]+'%'};return _0x58a1e4;}})});}_0x17ba9c=_[_0xb0ee('0x44')]({},_0x17ba9c,_0x4bb33e[_0xb0ee('0x46')]);var _0x1bcce1={'where':_0x17ba9c[_0xb0ee('0x42')]};return db[_0xb0ee('0x47')][_0xb0ee('0x21')](_0x1bcce1)[_0xb0ee('0x28')](function(_0x14ba38){_0x59b714[_0xb0ee('0x21')]=_0x14ba38;if(_0x4bb33e[_0xb0ee('0x39')][_0xb0ee('0x48')]){_0x17ba9c[_0xb0ee('0x49')]=[{'all':!![]}];}return db[_0xb0ee('0x47')][_0xb0ee('0x4a')](_0x17ba9c);})[_0xb0ee('0x28')](function(_0x531285){_0x59b714['rows']=_0x531285;return _0x59b714;})[_0xb0ee('0x28')](respondWithFilteredResult(_0x4b2a0c,_0x17ba9c))[_0xb0ee('0x4b')](handleError(_0x4b2a0c,null));};exports['show']=function(_0x3ef149,_0x524e15){var _0x36ff08={'raw':![],'where':{'id':_0x3ef149[_0xb0ee('0x4c')]['id']}},_0x10b262={};_0x10b262[_0xb0ee('0x38')]=_[_0xb0ee('0x3a')](db[_0xb0ee('0x47')][_0xb0ee('0x36')]);_0x10b262[_0xb0ee('0x39')]=_[_0xb0ee('0x3a')](_0x3ef149[_0xb0ee('0x39')]);_0x10b262[_0xb0ee('0x3b')]=_['intersection'](_0x10b262['model'],_0x10b262['query']);_0x36ff08[_0xb0ee('0x3d')]=_[_0xb0ee('0x3c')](_0x10b262['model'],qs[_0xb0ee('0x3e')](_0x3ef149[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x36ff08[_0xb0ee('0x3d')]=_0x36ff08[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x36ff08['attributes']:_0x10b262[_0xb0ee('0x38')];if(_0x3ef149[_0xb0ee('0x39')]['includeAll']){_0x36ff08[_0xb0ee('0x49')]=[{'all':!![]}];}_0x36ff08=_['merge']({},_0x36ff08,_0x3ef149[_0xb0ee('0x46')]);return db[_0xb0ee('0x47')][_0xb0ee('0x32')](_0x36ff08)['then'](handleEntityNotFound(_0x524e15,null))['then'](respondWithResult(_0x524e15,null))[_0xb0ee('0x4b')](handleError(_0x524e15,null));};exports['create']=function(_0xa3ecf,_0xfd2f60){return db[_0xb0ee('0x47')][_0xb0ee('0x4d')](_0xa3ecf[_0xb0ee('0x4e')],{})[_0xb0ee('0x28')](function(_0x587313){var _0x1df083=_0xa3ecf[_0xb0ee('0x4f')]['get']({'plain':!![]});if(!_0x1df083)throw new Error(_0xb0ee('0x50'));if(_0x1df083[_0xb0ee('0x51')]===_0xb0ee('0x4f')){var _0x3e71da=_0x587313[_0xb0ee('0x2a')]({'plain':!![]});var _0x40579a=[{'name':_0xb0ee('0x2b'),'value':'inbound'},{'name':_0xb0ee('0x52'),'value':_0xb0ee('0x53')}];var _0x1cd393=_['find'](_0x40579a,[_0xb0ee('0x30'),_0x3e71da[_0xb0ee('0x31')]])[_0xb0ee('0x33')];return db[_0xb0ee('0x54')]['find']({'where':{'name':_0x1cd393,'userProfileId':_0x1df083[_0xb0ee('0x55')]},'raw':!![]})[_0xb0ee('0x28')](function(_0x3dec98){if(_0x3dec98&&_0x3dec98['autoAssociation']===0x0){return db[_0xb0ee('0x34')][_0xb0ee('0x4d')]({'name':_0x3e71da[_0xb0ee('0x33')],'resourceId':_0x3e71da['id'],'type':_0x3dec98[_0xb0ee('0x33')],'sectionId':_0x3dec98['id']},{})[_0xb0ee('0x28')](function(){return _0x587313;});}else{return _0x587313;}})[_0xb0ee('0x4b')](function(_0x372b3b){logger[_0xb0ee('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x372b3b);throw _0x372b3b;});}return _0x587313;})['then'](respondWithResult(_0xfd2f60,0xc9))[_0xb0ee('0x4b')](handleError(_0xfd2f60,null));};exports[_0xb0ee('0x56')]=function(_0x1ba436,_0x2f7068){var _0x35d6f4={'where':{'id':_0x1ba436[_0xb0ee('0x4c')]['id']}},_0x540461={};_0x540461['model']=_[_0xb0ee('0x3a')](db['VoiceQueue']['rawAttributes']);_0x35d6f4[_0xb0ee('0x3d')]=_[_0xb0ee('0x3c')](_0x540461[_0xb0ee('0x38')],qs[_0xb0ee('0x3e')](_0x1ba436[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x35d6f4[_0xb0ee('0x3d')]=_0x35d6f4[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x35d6f4[_0xb0ee('0x3d')]:_0x540461[_0xb0ee('0x38')];if(_0x1ba436['query']['includeAll']){_0x35d6f4['include']=[{'all':!![]}];}_0x35d6f4=_[_0xb0ee('0x44')]({},_0x35d6f4,_0x1ba436['options']);return db[_0xb0ee('0x47')]['find'](_0x35d6f4)['then'](handleEntityNotFound(_0x2f7068,null))[_0xb0ee('0x28')](function(_0x1b42aa){if(_0x1b42aa){var _0x4d36cc=_0x1b42aa[_0xb0ee('0x2a')]({'plain':!![]});_0x4d36cc=qs[_0xb0ee('0x57')](_0x4d36cc,['id',_0xb0ee('0x58'),'updatedAt']);_0x1ba436[_0xb0ee('0x4e')]=_[_0xb0ee('0x57')](_0x1ba436[_0xb0ee('0x4e')],['id',_0xb0ee('0x58'),_0xb0ee('0x59')]);return db[_0xb0ee('0x47')][_0xb0ee('0x4d')](_['merge'](_0x4d36cc,_0x1ba436['body']),{'include':_0x1ba436[_0xb0ee('0x39')][_0xb0ee('0x48')]?[{'all':!![]}]:undefined})[_0xb0ee('0x28')](function(_0x387072){var _0x1eeb4c=_0x1ba436[_0xb0ee('0x4f')]['get']({'plain':!![]});if(!_0x1eeb4c)throw new Error(_0xb0ee('0x50'));if(_0x1eeb4c['role']===_0xb0ee('0x4f')){var _0x2bdb86=_0x387072[_0xb0ee('0x2a')]({'plain':!![]});var _0x4ab49b=[{'name':'VoiceQueues','value':_0xb0ee('0x2c')},{'name':_0xb0ee('0x52'),'value':_0xb0ee('0x53')}];var _0x8382c8=_[_0xb0ee('0x32')](_0x4ab49b,[_0xb0ee('0x30'),_0x2bdb86[_0xb0ee('0x31')]])[_0xb0ee('0x33')];return db[_0xb0ee('0x54')][_0xb0ee('0x32')]({'where':{'name':_0x8382c8,'userProfileId':_0x1eeb4c[_0xb0ee('0x55')]},'raw':!![]})['then'](function(_0x286607){if(_0x286607&&_0x286607['autoAssociation']===0x0){return db[_0xb0ee('0x34')][_0xb0ee('0x4d')]({'name':_0x2bdb86[_0xb0ee('0x33')],'resourceId':_0x2bdb86['id'],'type':_0x286607[_0xb0ee('0x33')],'sectionId':_0x286607['id']},{})[_0xb0ee('0x28')](function(){return _0x387072;});}else{return _0x387072;}})[_0xb0ee('0x4b')](function(_0x472ac2){logger['error'](_0xb0ee('0x5a'),_0x472ac2);throw _0x472ac2;});}return _0x387072;});}})[_0xb0ee('0x28')](respondWithResult(_0x2f7068,0xc9))[_0xb0ee('0x4b')](handleError(_0x2f7068,null));};exports['update']=function(_0xa085e4,_0x1cbaf9){if(_0xa085e4[_0xb0ee('0x4e')]['id']){delete _0xa085e4[_0xb0ee('0x4e')]['id'];}return db['VoiceQueue'][_0xb0ee('0x32')]({'where':{'id':_0xa085e4[_0xb0ee('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cbaf9,null))[_0xb0ee('0x28')](saveUpdates(_0xa085e4['body'],null))[_0xb0ee('0x28')](respondWithResult(_0x1cbaf9,null))[_0xb0ee('0x4b')](handleError(_0x1cbaf9,null));};exports[_0xb0ee('0x29')]=function(_0x24aebf,_0x13ca99){return db[_0xb0ee('0x47')][_0xb0ee('0x32')]({'where':{'id':_0x24aebf[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x13ca99,null))[_0xb0ee('0x28')](removeEntity(_0x13ca99,null))[_0xb0ee('0x4b')](handleError(_0x13ca99,null));};exports['getHoppers']=function(_0x1c5c3a,_0x5f1480,_0x1494f3){var _0x4d6fc7={'raw':![],'where':{}};var _0x451d75={};var _0x3b52b0={'count':0x0,'rows':[]};return db[_0xb0ee('0x47')][_0xb0ee('0x5b')]({'where':{'id':_0x1c5c3a['params']['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x5f1480,null))['then'](function(_0x5c4549){if(_0x5c4549){_0x451d75[_0xb0ee('0x38')]=_['keys'](db[_0xb0ee('0x5c')][_0xb0ee('0x36')]);_0x451d75[_0xb0ee('0x39')]=_['keys'](_0x1c5c3a[_0xb0ee('0x39')]);_0x451d75[_0xb0ee('0x3b')]=_[_0xb0ee('0x3c')](_0x451d75[_0xb0ee('0x38')],_0x451d75[_0xb0ee('0x39')]);_0x4d6fc7[_0xb0ee('0x3d')]=_[_0xb0ee('0x3c')](_0x451d75[_0xb0ee('0x38')],qs[_0xb0ee('0x3e')](_0x1c5c3a[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x4d6fc7[_0xb0ee('0x3d')]=_0x4d6fc7['attributes']['length']?_0x4d6fc7[_0xb0ee('0x3d')]:_0x451d75[_0xb0ee('0x38')];if(!_0x1c5c3a[_0xb0ee('0x39')][_0xb0ee('0x40')](_0xb0ee('0x5d'))){_0x4d6fc7['limit']=qs[_0xb0ee('0x1e')](_0x1c5c3a[_0xb0ee('0x39')][_0xb0ee('0x1e')]);_0x4d6fc7[_0xb0ee('0x20')]=qs[_0xb0ee('0x20')](_0x1c5c3a[_0xb0ee('0x39')][_0xb0ee('0x20')]);}_0x4d6fc7[_0xb0ee('0x5e')]=qs['sort'](_0x1c5c3a[_0xb0ee('0x39')][_0xb0ee('0x41')]);_0x4d6fc7['where']=qs[_0xb0ee('0x3b')](_[_0xb0ee('0x43')](_0x1c5c3a['query'],_0x451d75[_0xb0ee('0x3b')]));_0x4d6fc7[_0xb0ee('0x42')]['VoiceQueueId']=_0x5c4549['id'];if(_0x1c5c3a[_0xb0ee('0x39')][_0xb0ee('0x2d')]){_0x4d6fc7[_0xb0ee('0x42')]=_['merge'](_0x4d6fc7['where'],{'$or':_[_0xb0ee('0x2f')](_0x4d6fc7[_0xb0ee('0x3d')],function(_0x10d23d){var _0x4cc458={};_0x4cc458[_0x10d23d]={'$like':'%'+_0x1c5c3a[_0xb0ee('0x39')][_0xb0ee('0x2d')]+'%'};return _0x4cc458;})});}_0x4d6fc7=_['merge']({},_0x4d6fc7,_0x1c5c3a['options']);return db['CmHopper']['count']({'where':_0x4d6fc7[_0xb0ee('0x42')]})[_0xb0ee('0x28')](function(_0x2f7681){_0x3b52b0['count']=_0x2f7681;if(_0x1c5c3a[_0xb0ee('0x39')]['includeAll']){_0x4d6fc7['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4d6fc7);})[_0xb0ee('0x28')](function(_0x345eb7){_0x3b52b0['rows']=_0x345eb7;return _0x3b52b0;});}})['then'](respondWithFilteredResult(_0x5f1480,_0x4d6fc7))[_0xb0ee('0x4b')](handleError(_0x5f1480,null));};exports[_0xb0ee('0x5f')]=function(_0x4efd14,_0x4b0e71,_0x195707){var _0x4608f4={'raw':!![],'where':{}};var _0x5169bc={};var _0x52b044={'count':0x0,'rows':[]};return db[_0xb0ee('0x47')]['findOne']({'where':{'id':_0x4efd14['params']['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x4b0e71,null))[_0xb0ee('0x28')](function(_0x471e4a){if(_0x471e4a){_0x5169bc[_0xb0ee('0x38')]=_[_0xb0ee('0x3a')](db[_0xb0ee('0x60')]['rawAttributes']);_0x5169bc[_0xb0ee('0x39')]=_[_0xb0ee('0x3a')](_0x4efd14[_0xb0ee('0x39')]);_0x5169bc['filters']=_[_0xb0ee('0x3c')](_0x5169bc['model'],_0x5169bc[_0xb0ee('0x39')]);_0x4608f4['attributes']=_['intersection'](_0x5169bc[_0xb0ee('0x38')],qs[_0xb0ee('0x3e')](_0x4efd14['query'][_0xb0ee('0x3e')]));_0x4608f4[_0xb0ee('0x3d')]=_0x4608f4[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x4608f4[_0xb0ee('0x3d')]:_0x5169bc[_0xb0ee('0x38')];if(!_0x4efd14[_0xb0ee('0x39')][_0xb0ee('0x40')](_0xb0ee('0x5d'))){_0x4608f4[_0xb0ee('0x1e')]=qs[_0xb0ee('0x1e')](_0x4efd14[_0xb0ee('0x39')][_0xb0ee('0x1e')]);_0x4608f4[_0xb0ee('0x20')]=qs['offset'](_0x4efd14[_0xb0ee('0x39')][_0xb0ee('0x20')]);}_0x4608f4['order']=qs[_0xb0ee('0x41')](_0x4efd14['query'][_0xb0ee('0x41')]);_0x4608f4['where']=qs[_0xb0ee('0x3b')](_['pick'](_0x4efd14[_0xb0ee('0x39')],_0x5169bc[_0xb0ee('0x3b')]));_0x4608f4[_0xb0ee('0x42')][_0xb0ee('0x61')]=_0x471e4a['id'];if(_0x4efd14[_0xb0ee('0x39')][_0xb0ee('0x2d')]){_0x4608f4['where']=_[_0xb0ee('0x44')](_0x4608f4[_0xb0ee('0x42')],{'$or':_[_0xb0ee('0x2f')](_0x4608f4[_0xb0ee('0x3d')],function(_0x48d347){var _0x351c45={};_0x351c45[_0x48d347]={'$like':'%'+_0x4efd14['query'][_0xb0ee('0x2d')]+'%'};return _0x351c45;})});}_0x4608f4=_[_0xb0ee('0x44')]({},_0x4608f4,_0x4efd14['options']);return db[_0xb0ee('0x60')][_0xb0ee('0x21')]({'where':_0x4608f4['where']})[_0xb0ee('0x28')](function(_0x5c2d8e){_0x52b044[_0xb0ee('0x21')]=_0x5c2d8e;if(_0x4efd14[_0xb0ee('0x39')]['includeAll']){_0x4608f4['include']=[{'all':!![]}];}return db[_0xb0ee('0x60')][_0xb0ee('0x4a')](_0x4608f4);})[_0xb0ee('0x28')](function(_0x188773){_0x52b044['rows']=_0x188773;return _0x52b044;});}})[_0xb0ee('0x28')](respondWithFilteredResult(_0x4b0e71,_0x4608f4))[_0xb0ee('0x4b')](handleError(_0x4b0e71,null));};exports[_0xb0ee('0x62')]=function(_0x2ca345,_0x1ad658,_0x4d5a45){var _0x57872f={'raw':!![],'where':{}};var _0x10f6fa={};var _0x51c4ed={'count':0x0,'rows':[]};return db[_0xb0ee('0x47')][_0xb0ee('0x5b')]({'where':{'id':_0x2ca345[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x1ad658,null))['then'](function(_0x1938cb){if(_0x1938cb){_0x10f6fa[_0xb0ee('0x38')]=_[_0xb0ee('0x3a')](db['CmHopperFinal'][_0xb0ee('0x36')]);_0x10f6fa[_0xb0ee('0x39')]=_[_0xb0ee('0x3a')](_0x2ca345[_0xb0ee('0x39')]);_0x10f6fa[_0xb0ee('0x3b')]=_[_0xb0ee('0x3c')](_0x10f6fa['model'],_0x10f6fa[_0xb0ee('0x39')]);_0x57872f[_0xb0ee('0x3d')]=_[_0xb0ee('0x3c')](_0x10f6fa[_0xb0ee('0x38')],qs[_0xb0ee('0x3e')](_0x2ca345[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x57872f[_0xb0ee('0x3d')]=_0x57872f['attributes']['length']?_0x57872f[_0xb0ee('0x3d')]:_0x10f6fa[_0xb0ee('0x38')];if(!_0x2ca345[_0xb0ee('0x39')]['hasOwnProperty'](_0xb0ee('0x5d'))){_0x57872f[_0xb0ee('0x1e')]=qs[_0xb0ee('0x1e')](_0x2ca345[_0xb0ee('0x39')]['limit']);_0x57872f['offset']=qs['offset'](_0x2ca345[_0xb0ee('0x39')][_0xb0ee('0x20')]);}_0x57872f['order']=qs[_0xb0ee('0x41')](_0x2ca345[_0xb0ee('0x39')][_0xb0ee('0x41')]);_0x57872f[_0xb0ee('0x42')]=qs[_0xb0ee('0x3b')](_['pick'](_0x2ca345[_0xb0ee('0x39')],_0x10f6fa['filters']));_0x57872f[_0xb0ee('0x42')][_0xb0ee('0x61')]=_0x1938cb['id'];if(_0x2ca345['query'][_0xb0ee('0x2d')]){_0x57872f[_0xb0ee('0x42')]=_[_0xb0ee('0x44')](_0x57872f[_0xb0ee('0x42')],{'$or':_[_0xb0ee('0x2f')](_0x57872f['attributes'],function(_0x177c7f){var _0x337570={};_0x337570[_0x177c7f]={'$like':'%'+_0x2ca345['query'][_0xb0ee('0x2d')]+'%'};return _0x337570;})});}_0x57872f=_[_0xb0ee('0x44')]({},_0x57872f,_0x2ca345[_0xb0ee('0x46')]);return db[_0xb0ee('0x63')][_0xb0ee('0x21')]({'where':_0x57872f['where']})['then'](function(_0x540134){_0x51c4ed[_0xb0ee('0x21')]=_0x540134;if(_0x2ca345[_0xb0ee('0x39')][_0xb0ee('0x48')]){_0x57872f[_0xb0ee('0x49')]=[{'all':!![]}];}return db[_0xb0ee('0x63')]['findAll'](_0x57872f);})['then'](function(_0xd85328){_0x51c4ed['rows']=_0xd85328;return _0x51c4ed;});}})[_0xb0ee('0x28')](respondWithFilteredResult(_0x1ad658,_0x57872f))[_0xb0ee('0x4b')](handleError(_0x1ad658,null));};exports[_0xb0ee('0x64')]=function(_0x42673b,_0x4fb3af,_0x38b15e){var _0x23ba46={'raw':!![],'where':{}};var _0x29859a={};var _0x1fac6e={'count':0x0,'rows':[]};return db[_0xb0ee('0x47')][_0xb0ee('0x5b')]({'where':{'id':_0x42673b[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x4fb3af,null))['then'](function(_0x291669){if(_0x291669){_0x29859a[_0xb0ee('0x38')]=_[_0xb0ee('0x3a')](db[_0xb0ee('0x65')][_0xb0ee('0x36')]);_0x29859a['query']=_['keys'](_0x42673b[_0xb0ee('0x39')]);_0x29859a['filters']=_[_0xb0ee('0x3c')](_0x29859a[_0xb0ee('0x38')],_0x29859a[_0xb0ee('0x39')]);_0x23ba46[_0xb0ee('0x3d')]=_['intersection'](_0x29859a[_0xb0ee('0x38')],qs[_0xb0ee('0x3e')](_0x42673b[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x23ba46['attributes']=_0x23ba46[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x23ba46[_0xb0ee('0x3d')]:_0x29859a[_0xb0ee('0x38')];if(!_0x42673b[_0xb0ee('0x39')][_0xb0ee('0x40')](_0xb0ee('0x5d'))){_0x23ba46['limit']=qs[_0xb0ee('0x1e')](_0x42673b[_0xb0ee('0x39')][_0xb0ee('0x1e')]);_0x23ba46['offset']=qs[_0xb0ee('0x20')](_0x42673b['query'][_0xb0ee('0x20')]);}_0x23ba46[_0xb0ee('0x5e')]=qs['sort'](_0x42673b['query'][_0xb0ee('0x41')]);_0x23ba46[_0xb0ee('0x42')]=qs[_0xb0ee('0x3b')](_['pick'](_0x42673b[_0xb0ee('0x39')],_0x29859a['filters']));_0x23ba46[_0xb0ee('0x42')][_0xb0ee('0x61')]=_0x291669['id'];if(_0x42673b[_0xb0ee('0x39')]['filter']){_0x23ba46['where']=_['merge'](_0x23ba46[_0xb0ee('0x42')],{'$or':_[_0xb0ee('0x2f')](_0x23ba46['attributes'],function(_0x47179f){var _0x1f84b4={};_0x1f84b4[_0x47179f]={'$like':'%'+_0x42673b[_0xb0ee('0x39')][_0xb0ee('0x2d')]+'%'};return _0x1f84b4;})});}_0x23ba46=_[_0xb0ee('0x44')]({},_0x23ba46,_0x42673b[_0xb0ee('0x46')]);return db[_0xb0ee('0x65')]['count']({'where':_0x23ba46[_0xb0ee('0x42')]})[_0xb0ee('0x28')](function(_0x442797){_0x1fac6e[_0xb0ee('0x21')]=_0x442797;if(_0x42673b[_0xb0ee('0x39')][_0xb0ee('0x48')]){_0x23ba46[_0xb0ee('0x49')]=[{'all':!![]}];}return db[_0xb0ee('0x65')][_0xb0ee('0x4a')](_0x23ba46);})['then'](function(_0x5d769a){_0x1fac6e[_0xb0ee('0x66')]=_0x5d769a;return _0x1fac6e;});}})[_0xb0ee('0x28')](respondWithFilteredResult(_0x4fb3af,_0x23ba46))[_0xb0ee('0x4b')](handleError(_0x4fb3af,null));};exports['getTeams']=function(_0x139169,_0xeb207b,_0x10fc40){var _0x58fc98={};var _0x13a646={};var _0x3134b6;var _0x1ad0bf;return db[_0xb0ee('0x47')][_0xb0ee('0x5b')]({'where':{'id':_0x139169[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0xeb207b,null))[_0xb0ee('0x28')](function(_0x3a0989){if(_0x3a0989){_0x3134b6=_0x3a0989;_0x13a646[_0xb0ee('0x38')]=_[_0xb0ee('0x3a')](db[_0xb0ee('0x67')][_0xb0ee('0x36')]);_0x13a646[_0xb0ee('0x39')]=_[_0xb0ee('0x3a')](_0x139169[_0xb0ee('0x39')]);_0x13a646[_0xb0ee('0x3b')]=_['intersection'](_0x13a646[_0xb0ee('0x38')],_0x13a646[_0xb0ee('0x39')]);_0x58fc98['attributes']=_['intersection'](_0x13a646[_0xb0ee('0x38')],qs['fields'](_0x139169[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x58fc98['attributes']=_0x58fc98[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x58fc98[_0xb0ee('0x3d')]:_0x13a646[_0xb0ee('0x38')];_0x58fc98['order']=qs[_0xb0ee('0x41')](_0x139169['query'][_0xb0ee('0x41')]);_0x58fc98[_0xb0ee('0x42')]=qs[_0xb0ee('0x3b')](_[_0xb0ee('0x43')](_0x139169['query'],_0x13a646[_0xb0ee('0x3b')]));if(_0x139169[_0xb0ee('0x39')][_0xb0ee('0x2d')]){_0x58fc98['where']=_[_0xb0ee('0x44')](_0x58fc98['where'],{'$or':_[_0xb0ee('0x2f')](_0x58fc98[_0xb0ee('0x3d')],function(_0x24104e){var _0x2d2622={};_0x2d2622[_0x24104e]={'$like':'%'+_0x139169['query'][_0xb0ee('0x2d')]+'%'};return _0x2d2622;})});}_0x58fc98=_[_0xb0ee('0x44')]({},_0x58fc98,_0x139169[_0xb0ee('0x46')]);return _0x3134b6[_0xb0ee('0x68')](_0x58fc98);}})['then'](function(_0x242ca3){if(_0x242ca3){_0x1ad0bf=_0x242ca3[_0xb0ee('0x3f')];if(!_0x139169[_0xb0ee('0x39')][_0xb0ee('0x40')]('nolimit')){_0x58fc98[_0xb0ee('0x1e')]=qs[_0xb0ee('0x1e')](_0x139169[_0xb0ee('0x39')][_0xb0ee('0x1e')]);_0x58fc98[_0xb0ee('0x20')]=qs[_0xb0ee('0x20')](_0x139169[_0xb0ee('0x39')][_0xb0ee('0x20')]);}return _0x3134b6[_0xb0ee('0x68')](_0x58fc98);}})['then'](function(_0x132941){if(_0x132941){return _0x132941?{'count':_0x1ad0bf,'rows':_0x132941}:null;}})[_0xb0ee('0x28')](respondWithResult(_0xeb207b,null))['catch'](handleError(_0xeb207b,null));};exports[_0xb0ee('0x69')]=function(_0x2df434,_0x28c6a8,_0x47a7b1){var _0x4d4d5e=_0x2df434[_0xb0ee('0x4e')][_0xb0ee('0x6a')];var _0x5d508a=_['map'](_0x4d4d5e,'id');return db[_0xb0ee('0x67')][_0xb0ee('0x4a')]({'where':{'id':_0x5d508a},'attributes':['id'],'include':[{'model':db[_0xb0ee('0x6b')],'as':_0xb0ee('0x6c'),'attributes':['id',_0xb0ee('0x33'),_0xb0ee('0x6d'),_0xb0ee('0x6e'),'interface'],'raw':!![]}]})[_0xb0ee('0x28')](function(_0x4a3ea3){if(_0x4a3ea3){var _0x5c455f=_[_0xb0ee('0x6f')](_0x4a3ea3,function(_0x287add){var _0x3eabd6=_0x287add[_0xb0ee('0x2a')]({'plain':!![]});_0x3eabd6[_0xb0ee('0x6c')][_0xb0ee('0x70')](function(_0x117a70){_0x117a70[_0xb0ee('0x71')]=_[_0xb0ee('0x32')](_0x4d4d5e,{'id':_0x3eabd6['id']})[_0xb0ee('0x71')];});return _0x3eabd6[_0xb0ee('0x6c')];});return db[_0xb0ee('0x47')][_0xb0ee('0x32')]({'where':{'id':_0x2df434[_0xb0ee('0x4c')]['id']}})['then'](function(_0x59bd04){return db[_0xb0ee('0x72')][_0xb0ee('0x73')](function(_0x2ebc59){return _0x59bd04[_0xb0ee('0x69')](_0x5d508a,{'transaction':_0x2ebc59})[_0xb0ee('0x28')](function(){return BPromise[_0xb0ee('0x74')](_0x4d4d5e,function(_0x178492){return db[_0xb0ee('0x75')][_0xb0ee('0x76')]({'TeamId':_0x178492['id'],'VoiceQueueId':_0x2df434[_0xb0ee('0x4c')]['id'],'penalty':_0x178492[_0xb0ee('0x71')]},{'transaction':_0x2ebc59});});})['then'](function(){return BPromise[_0xb0ee('0x74')](_0x5c455f,function(_0x22ea39){return db[_0xb0ee('0x77')][_0xb0ee('0x78')]({'where':{'UserId':_0x22ea39['id'],'VoiceQueueId':_0x2df434[_0xb0ee('0x4c')]['id']},'defaults':{'penalty':_0x22ea39[_0xb0ee('0x71')]},'transaction':_0x2ebc59});});})[_0xb0ee('0x28')](function(){return BPromise[_0xb0ee('0x74')](_[_0xb0ee('0x2d')](_0x5c455f,{'online':!![]}),function(_0x1c4a52){return db[_0xb0ee('0x79')][_0xb0ee('0x76')]({'membername':_0x1c4a52[_0xb0ee('0x33')],'UserId':_0x1c4a52['id'],'queue_name':_0x59bd04[_0xb0ee('0x33')],'VoiceQueueId':_0x59bd04['id'],'interface':_[_0xb0ee('0x7a')](_0x1c4a52[_0xb0ee('0x7b')])?util[_0xb0ee('0x7c')](_0xb0ee('0x7d'),_0x1c4a52[_0xb0ee('0x33')]):_0x1c4a52['interface'],'paused':_0x1c4a52[_0xb0ee('0x6e')]||![],'penalty':_0x1c4a52[_0xb0ee('0x71')]},{'transaction':_0x2ebc59});});})[_0xb0ee('0x28')](function(){_0x5c455f[_0xb0ee('0x70')](function(_0x25f2f3){socket['emit'](_0xb0ee('0x7e'),{'UserId':_0x25f2f3['id'],'VoiceQueueId':_0x59bd04['id']});});});});});}})[_0xb0ee('0x28')](respondWithStatusCode(_0x28c6a8,null))[_0xb0ee('0x4b')](handleError(_0x28c6a8,null));};exports[_0xb0ee('0x7f')]=function(_0x2d2ae2,_0x1ff4be,_0x511e97){return db[_0xb0ee('0x67')][_0xb0ee('0x4a')]({'where':{'id':_0x2d2ae2[_0xb0ee('0x39')][_0xb0ee('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb0ee('0x28')](handleEntityNotFound(_0x1ff4be,null))['then'](function(_0x449f1b){var _0xd26d0e=_[_0xb0ee('0x2f')](_0x449f1b,'id');var _0x4ba19a=[];var _0x481226=[];var _0x1d8c5a=squel[_0xb0ee('0x81')]();_0x1d8c5a[_0xb0ee('0x82')](_0xb0ee('0x83'))[_0xb0ee('0x84')]('team_has_voice_queues','tq')[_0xb0ee('0x85')](_0xb0ee('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xb0ee('0x87'),_0x2d2ae2['params']['id']);for(var _0x8497df=0x0;_0x8497df<_0x449f1b['length'];_0x8497df+=0x1){let _0x4c355f=_0x449f1b[_0x8497df];for(var _0x229e79=0x0;_0x229e79<_0x4c355f['Agents']['length'];_0x229e79+=0x1){let _0x4f542e=_0x4c355f['Agents'][_0x229e79];var _0x1cc93e=_0x1d8c5a['clone']();_0x1cc93e[_0xb0ee('0x42')](_0xb0ee('0x88'),_0x4f542e['id']);_0x481226[_0xb0ee('0x89')](db['sequelize'][_0xb0ee('0x39')](_0x1cc93e[_0xb0ee('0x8a')](),{'type':db[_0xb0ee('0x72')][_0xb0ee('0x8b')][_0xb0ee('0x8c')]})[_0xb0ee('0x28')](function(_0x33eef9){if(_0x33eef9['length']===0x1){return _0x4f542e['id'];}else{var _0x36469a=_['every'](_['map'](_0x33eef9,_0xb0ee('0x8d')),function(_0x4cac33){return _[_0xb0ee('0x8e')](_0xd26d0e,_0x4cac33);});if(_0x36469a){return _0x4f542e['id'];}}}));}}return BPromise[_0xb0ee('0x8f')](_0x481226)[_0xb0ee('0x28')](function(_0x4b6834){_0x4ba19a=_(_0x4ba19a)[_0xb0ee('0x90')](_0x4b6834)[_0xb0ee('0x91')]()[_0xb0ee('0x30')]();return db[_0xb0ee('0x47')][_0xb0ee('0x32')]({'where':{'id':_0x2d2ae2[_0xb0ee('0x4c')]['id']}})['then'](function(_0x6b11ef){return db[_0xb0ee('0x72')][_0xb0ee('0x73')](function(_0x2536b6){return _0x6b11ef[_0xb0ee('0x7f')](_0x2d2ae2['query'][_0xb0ee('0x80')],{'transaction':_0x2536b6})[_0xb0ee('0x28')](function(){if(!_[_0xb0ee('0x92')](_0x4ba19a)){return _0x6b11ef[_0xb0ee('0x93')](_0x4ba19a,{'transaction':_0x2536b6})[_0xb0ee('0x28')](function(){return db[_0xb0ee('0x79')][_0xb0ee('0x29')]({'where':{'VoiceQueueId':_0x2d2ae2['params']['id'],'UserId':_0x4ba19a},'transaction':_0x2536b6});});}})[_0xb0ee('0x28')](function(){_0x4ba19a[_0xb0ee('0x70')](function(_0x554992){socket[_0xb0ee('0x94')](_0xb0ee('0x95'),{'UserId':_0x554992,'VoiceQueueId':_0x6b11ef['id']});});});});});});})['then'](respondWithStatusCode(_0x1ff4be,null))['catch'](handleError(_0x1ff4be,null));};exports['addAgents']=function(_0x5791b1,_0x518c0c,_0x3c0e8f){var _0x4c4811,_0x334245;return db['VoiceQueue'][_0xb0ee('0x32')]({'where':{'id':_0x5791b1[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x518c0c,null))[_0xb0ee('0x28')](function(_0x1cf7e8){if(_0x1cf7e8){_0x334245=_0x1cf7e8;return _0x1cf7e8[_0xb0ee('0x96')](_0x5791b1[_0xb0ee('0x4e')][_0xb0ee('0x80')],_[_0xb0ee('0x57')](_0x5791b1['body'],[_0xb0ee('0x80'),'id'])||{})[_0xb0ee('0x97')](function(_0x2e4baf){for(var _0x398948=0x0;_0x398948<_0x5791b1[_0xb0ee('0x4e')]['ids'][_0xb0ee('0x3f')];_0x398948+=0x1){socket[_0xb0ee('0x94')](_0xb0ee('0x7e'),{'UserId':Number(_0x5791b1['body'][_0xb0ee('0x80')][_0x398948]),'VoiceQueueId':Number(_0x5791b1[_0xb0ee('0x4c')]['id'])});}return _0x2e4baf;});}})[_0xb0ee('0x28')](function(_0x4adfad){_0x4c4811=_0x4adfad||[];if(_0x334245){return db[_0xb0ee('0x6b')][_0xb0ee('0x4a')]({'where':{'id':_0x5791b1['body'][_0xb0ee('0x80')]},'attributes':['id',_0xb0ee('0x33'),_0xb0ee('0x6d'),'voicePause',_0xb0ee('0x7b')],'raw':!![]});}})['then'](function(_0xa9ed9b){if(!_[_0xb0ee('0x92')](_0xa9ed9b)){var _0x3b386e=[];for(var _0x51d34c=0x0;_0x51d34c<_0xa9ed9b[_0xb0ee('0x3f')];_0x51d34c++){if(_0xa9ed9b[_0x51d34c][_0xb0ee('0x6d')]){_0x3b386e[_0xb0ee('0x89')](db[_0xb0ee('0x79')][_0xb0ee('0x76')]({'membername':_0xa9ed9b[_0x51d34c][_0xb0ee('0x33')],'UserId':_0xa9ed9b[_0x51d34c]['id'],'queue_name':_0x334245[_0xb0ee('0x33')],'VoiceQueueId':_0x334245['id'],'interface':_[_0xb0ee('0x7a')](_0xa9ed9b[_0x51d34c]['interface'])?util[_0xb0ee('0x7c')]('SIP/%s',_0xa9ed9b[_0x51d34c][_0xb0ee('0x33')]):_0xa9ed9b[_0x51d34c][_0xb0ee('0x7b')],'paused':_0xa9ed9b[_0x51d34c][_0xb0ee('0x6e')]||![],'penalty':_0x5791b1[_0xb0ee('0x4e')][_0xb0ee('0x71')]||0x0}));}}return BPromise[_0xb0ee('0x8f')](_0x3b386e);}})['then'](function(){return _0x4c4811;})[_0xb0ee('0x28')](respondWithResult(_0x518c0c,null))[_0xb0ee('0x4b')](handleError(_0x518c0c,null));};exports[_0xb0ee('0x93')]=function(_0x2fb6a9,_0x2dcf18,_0x890906){return db[_0xb0ee('0x47')][_0xb0ee('0x32')]({'where':{'id':_0x2fb6a9[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x2dcf18,null))[_0xb0ee('0x28')](function(_0x28f1cc){if(_0x28f1cc){return _0x28f1cc[_0xb0ee('0x93')](_0x2fb6a9[_0xb0ee('0x39')][_0xb0ee('0x80')])[_0xb0ee('0x28')](function(){if(_[_0xb0ee('0x98')](_0x2fb6a9[_0xb0ee('0x39')][_0xb0ee('0x80')])){for(var _0x4369f7=0x0;_0x4369f7<_0x2fb6a9[_0xb0ee('0x39')][_0xb0ee('0x80')][_0xb0ee('0x3f')];_0x4369f7+=0x1){socket[_0xb0ee('0x94')](_0xb0ee('0x95'),{'UserId':Number(_0x2fb6a9[_0xb0ee('0x39')][_0xb0ee('0x80')][_0x4369f7]),'VoiceQueueId':Number(_0x2fb6a9[_0xb0ee('0x4c')]['id'])});}}else{socket[_0xb0ee('0x94')](_0xb0ee('0x95'),{'UserId':Number(_0x2fb6a9[_0xb0ee('0x39')][_0xb0ee('0x80')]),'VoiceQueueId':Number(_0x2fb6a9['params']['id'])});}});}})[_0xb0ee('0x28')](function(_0x3f16ed){return db[_0xb0ee('0x79')]['destroy']({'where':{'VoiceQueueId':_0x2fb6a9['params']['id'],'UserId':_0x2fb6a9['query'][_0xb0ee('0x80')]}})[_0xb0ee('0x28')](function(){return _0x3f16ed;});})[_0xb0ee('0x28')](respondWithStatusCode(_0x2dcf18,null))[_0xb0ee('0x4b')](handleError(_0x2dcf18,null));};exports[_0xb0ee('0x99')]=function(_0x518b7f,_0x1b39c4,_0x2b3368){var _0x473b18={};var _0x1a4591={};var _0x5dc35d;var _0x5e373b;return db[_0xb0ee('0x47')][_0xb0ee('0x5b')]({'where':{'id':_0x518b7f[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x1b39c4,null))['then'](function(_0x189d36){if(_0x189d36){_0x5dc35d=_0x189d36;_0x1a4591[_0xb0ee('0x38')]=_['keys'](db['User'][_0xb0ee('0x36')]);_0x1a4591['query']=_[_0xb0ee('0x3a')](_0x518b7f[_0xb0ee('0x39')]);_0x1a4591[_0xb0ee('0x3b')]=_[_0xb0ee('0x3c')](_0x1a4591[_0xb0ee('0x38')],_0x1a4591[_0xb0ee('0x39')]);_0x473b18['attributes']=_[_0xb0ee('0x3c')](_0x1a4591[_0xb0ee('0x38')],qs[_0xb0ee('0x3e')](_0x518b7f[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x473b18[_0xb0ee('0x3d')]=_0x473b18['attributes'][_0xb0ee('0x3f')]?_0x473b18[_0xb0ee('0x3d')]:_0x1a4591['model'];_0x473b18[_0xb0ee('0x5e')]=qs[_0xb0ee('0x41')](_0x518b7f[_0xb0ee('0x39')][_0xb0ee('0x41')]);_0x473b18[_0xb0ee('0x42')]=qs[_0xb0ee('0x3b')](_[_0xb0ee('0x43')](_0x518b7f[_0xb0ee('0x39')],_0x1a4591[_0xb0ee('0x3b')]));if(_0x518b7f[_0xb0ee('0x39')]['filter']){_0x473b18['where']=_[_0xb0ee('0x44')](_0x473b18[_0xb0ee('0x42')],{'$or':_[_0xb0ee('0x2f')](_0x473b18['attributes'],function(_0x1d818c){var _0x4c575e={};_0x4c575e[_0x1d818c]={'$like':'%'+_0x518b7f[_0xb0ee('0x39')]['filter']+'%'};return _0x4c575e;})});}_0x473b18=_['merge']({},_0x473b18,_0x518b7f[_0xb0ee('0x46')]);return _0x5dc35d[_0xb0ee('0x99')](_0x473b18);}})[_0xb0ee('0x28')](function(_0x473871){if(_0x473871){_0x5e373b=_0x473871['length'];if(!_0x518b7f[_0xb0ee('0x39')]['hasOwnProperty'](_0xb0ee('0x5d'))){_0x473b18[_0xb0ee('0x1e')]=qs[_0xb0ee('0x1e')](_0x518b7f[_0xb0ee('0x39')]['limit']);_0x473b18[_0xb0ee('0x20')]=qs[_0xb0ee('0x20')](_0x518b7f[_0xb0ee('0x39')][_0xb0ee('0x20')]);}return _0x5dc35d['getAgents'](_0x473b18);}})[_0xb0ee('0x28')](function(_0xaaad0f){if(_0xaaad0f){return _0xaaad0f?{'count':_0x5e373b,'rows':_0xaaad0f}:null;}})[_0xb0ee('0x28')](respondWithResult(_0x1b39c4,null))[_0xb0ee('0x4b')](handleError(_0x1b39c4,null));};exports[_0xb0ee('0x9a')]=function(_0x8f8e22,_0x387a38,_0x297d85){var _0x15b7fe={};var _0x526b1b={};var _0x3cbce9;var _0x2fe071;return db['VoiceQueue']['findOne']({'where':{'id':_0x8f8e22[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x387a38,null))[_0xb0ee('0x28')](function(_0x39c226){if(_0x39c226){_0x3cbce9=_0x39c226;_0x526b1b[_0xb0ee('0x38')]=_['keys'](db[_0xb0ee('0x79')][_0xb0ee('0x36')]);_0x526b1b[_0xb0ee('0x39')]=_['keys'](_0x8f8e22[_0xb0ee('0x39')]);_0x526b1b[_0xb0ee('0x3b')]=_[_0xb0ee('0x3c')](_0x526b1b[_0xb0ee('0x38')],_0x526b1b[_0xb0ee('0x39')]);_0x15b7fe[_0xb0ee('0x3d')]=_[_0xb0ee('0x3c')](_0x526b1b[_0xb0ee('0x38')],qs['fields'](_0x8f8e22['query'][_0xb0ee('0x3e')]));_0x15b7fe[_0xb0ee('0x3d')]=_0x15b7fe[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x15b7fe[_0xb0ee('0x3d')]:_0x526b1b[_0xb0ee('0x38')];_0x15b7fe[_0xb0ee('0x5e')]=qs[_0xb0ee('0x41')](_0x8f8e22['query'][_0xb0ee('0x41')]);_0x15b7fe['where']=qs['filters'](_[_0xb0ee('0x43')](_0x8f8e22[_0xb0ee('0x39')],_0x526b1b[_0xb0ee('0x3b')]));if(_0x8f8e22[_0xb0ee('0x39')]['filter']){_0x15b7fe[_0xb0ee('0x42')]=_[_0xb0ee('0x44')](_0x15b7fe[_0xb0ee('0x42')],{'$or':_['map'](_0x15b7fe[_0xb0ee('0x3d')],function(_0x3be09b){var _0x3a6623={};_0x3a6623[_0x3be09b]={'$like':'%'+_0x8f8e22[_0xb0ee('0x39')]['filter']+'%'};return _0x3a6623;})});}_0x15b7fe=_[_0xb0ee('0x44')]({},_0x15b7fe,_0x8f8e22['options']);return _0x3cbce9[_0xb0ee('0x9a')](_0x15b7fe);}})['then'](function(_0x245927){if(_0x245927){_0x2fe071=_0x245927[_0xb0ee('0x3f')];if(!_0x8f8e22[_0xb0ee('0x39')]['hasOwnProperty']('nolimit')){_0x15b7fe[_0xb0ee('0x1e')]=qs[_0xb0ee('0x1e')](_0x8f8e22[_0xb0ee('0x39')][_0xb0ee('0x1e')]);_0x15b7fe[_0xb0ee('0x20')]=qs['offset'](_0x8f8e22[_0xb0ee('0x39')][_0xb0ee('0x20')]);}return _0x3cbce9[_0xb0ee('0x9a')](_0x15b7fe);}})[_0xb0ee('0x28')](function(_0x4172d2){return _0x4172d2?{'count':_0x2fe071,'rows':_0x4172d2}:null;})['then'](respondWithResult(_0x387a38,null))[_0xb0ee('0x4b')](handleError(_0x387a38,null));};exports[_0xb0ee('0x9b')]=function(_0x5bf207,_0x123f0f,_0x1593a6){var _0xd049a9={};var _0x4a3491={};var _0x3dee9a;var _0x6768bf;return db['VoiceQueue'][_0xb0ee('0x5b')]({'where':{'id':_0x5bf207[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x123f0f,null))[_0xb0ee('0x28')](function(_0x25e5e7){if(_0x25e5e7){_0x3dee9a=_0x25e5e7;_0x4a3491[_0xb0ee('0x38')]=_[_0xb0ee('0x3a')](db[_0xb0ee('0x9c')]['rawAttributes']);_0x4a3491[_0xb0ee('0x39')]=_['keys'](_0x5bf207[_0xb0ee('0x39')]);_0x4a3491[_0xb0ee('0x3b')]=_[_0xb0ee('0x3c')](_0x4a3491[_0xb0ee('0x38')],_0x4a3491[_0xb0ee('0x39')]);_0xd049a9['attributes']=_[_0xb0ee('0x3c')](_0x4a3491['model'],qs[_0xb0ee('0x3e')](_0x5bf207['query'][_0xb0ee('0x3e')]));_0xd049a9[_0xb0ee('0x3d')]=_0xd049a9[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0xd049a9[_0xb0ee('0x3d')]:_0x4a3491['model'];_0xd049a9[_0xb0ee('0x5e')]=qs[_0xb0ee('0x41')](_0x5bf207['query'][_0xb0ee('0x41')]);_0xd049a9['where']=qs[_0xb0ee('0x3b')](_[_0xb0ee('0x43')](_0x5bf207[_0xb0ee('0x39')],_0x4a3491[_0xb0ee('0x3b')]));if(_0x5bf207[_0xb0ee('0x39')]['filter']){_0xd049a9[_0xb0ee('0x42')]=_[_0xb0ee('0x44')](_0xd049a9[_0xb0ee('0x42')],{'$or':_[_0xb0ee('0x2f')](_0xd049a9[_0xb0ee('0x3d')],function(_0x3e3d21){var _0x486527={};_0x486527[_0x3e3d21]={'$like':'%'+_0x5bf207[_0xb0ee('0x39')][_0xb0ee('0x2d')]+'%'};return _0x486527;})});}_0xd049a9=_['merge']({},_0xd049a9,_0x5bf207[_0xb0ee('0x46')]);return _0x3dee9a['getLists'](_0xd049a9);}})[_0xb0ee('0x28')](function(_0x277a37){if(_0x277a37){_0x6768bf=_0x277a37[_0xb0ee('0x3f')];if(!_0x5bf207['query'][_0xb0ee('0x40')](_0xb0ee('0x5d'))){_0xd049a9[_0xb0ee('0x1e')]=qs[_0xb0ee('0x1e')](_0x5bf207[_0xb0ee('0x39')][_0xb0ee('0x1e')]);_0xd049a9[_0xb0ee('0x20')]=qs[_0xb0ee('0x20')](_0x5bf207['query'][_0xb0ee('0x20')]);}return _0x3dee9a[_0xb0ee('0x9b')](_0xd049a9);}})['then'](function(_0x497e5a){if(_0x497e5a){return _0x497e5a?{'count':_0x6768bf,'rows':_0x497e5a}:null;}})[_0xb0ee('0x28')](respondWithResult(_0x123f0f,null))['catch'](handleError(_0x123f0f,null));};exports[_0xb0ee('0x9d')]=function(_0x5b6c8f,_0x3d699d,_0x2d9cb0){var _0x271d41=moment()[_0xb0ee('0x7c')](_0xb0ee('0x9e'));var _0x3ff6b7,_0x27f003;return db[_0xb0ee('0x47')][_0xb0ee('0x32')]({'where':{'id':_0x5b6c8f[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x3d699d,null))[_0xb0ee('0x28')](function(_0x22ac2f){if(_0x22ac2f){_0x27f003=_0x22ac2f;return _0x22ac2f['addLists'](_0x5b6c8f[_0xb0ee('0x4e')]['ids'],_['omit'](_0x5b6c8f[_0xb0ee('0x4e')],['ids','id'])||{});}return null;})[_0xb0ee('0x97')](function(_0x2d8c98){var _0x9c0ee2;_0x3ff6b7=_0x2d8c98||[];var _0x41fbb2=[];if(_0x2d8c98){for(var _0x1eadfd=0x0;_0x1eadfd<_0x2d8c98[_0xb0ee('0x3f')];_0x1eadfd+=0x1){var _0x591493=_0x2d8c98[_0x1eadfd][_0xb0ee('0x2a')]({'plain':!![]});_0x27f003[_0xb0ee('0x9f')]=_0x5b6c8f[_0xb0ee('0x4e')][_0xb0ee('0x9f')]?_0x5b6c8f[_0xb0ee('0x4e')][_0xb0ee('0x9f')]:_0x27f003['dialCheckDuplicateType'];switch(_0x27f003[_0xb0ee('0x9f')]){case'always':_0x9c0ee2=squel[_0xb0ee('0xa0')]()[_0xb0ee('0xa1')]('cm_hopper')[_0xb0ee('0xa2')]([_0xb0ee('0xa3'),_0xb0ee('0xa4'),_0xb0ee('0xa5'),_0xb0ee('0xa6'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xb0ee('0x81')]()[_0xb0ee('0x82')](_0xb0ee('0xa3'),_0xb0ee('0xa3'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27',_0xb0ee('0xa4'))[_0xb0ee('0x82')]('id',_0xb0ee('0xa5'))[_0xb0ee('0x82')](_0x591493[_0xb0ee('0xa7')][_0xb0ee('0x8a')](),'ListId')[_0xb0ee('0x82')](_0x5b6c8f['params']['id'][_0xb0ee('0x8a')](),_0xb0ee('0x61'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27',_0xb0ee('0x58'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27','updatedAt')[_0xb0ee('0x84')]('cm_contacts')[_0xb0ee('0x42')](_0xb0ee('0xa8'))[_0xb0ee('0x42')](_0xb0ee('0xa9'),_0x591493[_0xb0ee('0xa7')][_0xb0ee('0x8a')]())['where'](_0xb0ee('0xaa'))[_0xb0ee('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb0ee('0x81')]()[_0xb0ee('0x82')](_0xb0ee('0xab'))[_0xb0ee('0x84')]('cm_hopper_final')[_0xb0ee('0x42')](_0xb0ee('0x87'),_0x5b6c8f[_0xb0ee('0x4c')]['id'][_0xb0ee('0x8a')]()))[_0xb0ee('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb0ee('0x81')]()[_0xb0ee('0x82')]('COALESCE(phone,\x27\x27)')[_0xb0ee('0x84')](_0xb0ee('0xac'))[_0xb0ee('0x42')]('VoiceQueueId\x20=\x20?',_0x5b6c8f[_0xb0ee('0x4c')]['id'][_0xb0ee('0x8a')]())))[_0xb0ee('0x8a')]();break;case _0xb0ee('0xad'):_0x9c0ee2=squel[_0xb0ee('0xa0')]()[_0xb0ee('0xa1')](_0xb0ee('0xac'))[_0xb0ee('0xa2')](['phone',_0xb0ee('0xa4'),'ContactId',_0xb0ee('0xa6'),_0xb0ee('0x61'),_0xb0ee('0x58'),_0xb0ee('0x59')],squel[_0xb0ee('0x81')]()['field'](_0xb0ee('0xa3'),_0xb0ee('0xa3'))['field']('\x27'+_0x271d41+'\x27',_0xb0ee('0xa4'))[_0xb0ee('0x82')]('id','ContactId')[_0xb0ee('0x82')](_0x591493[_0xb0ee('0xa7')][_0xb0ee('0x8a')](),'ListId')[_0xb0ee('0x82')](_0x5b6c8f[_0xb0ee('0x4c')]['id'][_0xb0ee('0x8a')](),_0xb0ee('0x61'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27','createdAt')[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27',_0xb0ee('0x59'))[_0xb0ee('0x84')](_0xb0ee('0xae'))['where']('deletedAt\x20IS\x20NULL')[_0xb0ee('0x42')](_0xb0ee('0xa9'),_0x591493[_0xb0ee('0xa7')][_0xb0ee('0x8a')]())[_0xb0ee('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xb0ee('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb0ee('0x81')]()['field'](_0xb0ee('0xaf'))['from']('cm_hopper')[_0xb0ee('0x42')](_0xb0ee('0x87'),_0x5b6c8f[_0xb0ee('0x4c')]['id'][_0xb0ee('0x8a')]())))[_0xb0ee('0x8a')]();break;default:_0x9c0ee2=squel[_0xb0ee('0xa0')]()['into']('cm_hopper')[_0xb0ee('0xa2')]([_0xb0ee('0xa3'),_0xb0ee('0xa4'),_0xb0ee('0xa5'),_0xb0ee('0xa6'),_0xb0ee('0x61'),'createdAt',_0xb0ee('0x59')],squel['select']()[_0xb0ee('0x82')]('phone','phone')[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27','scheduledAt')[_0xb0ee('0x82')]('id','ContactId')[_0xb0ee('0x82')](_0x591493[_0xb0ee('0xa7')][_0xb0ee('0x8a')](),_0xb0ee('0xa6'))[_0xb0ee('0x82')](_0x5b6c8f[_0xb0ee('0x4c')]['id'][_0xb0ee('0x8a')](),_0xb0ee('0x61'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27',_0xb0ee('0x58'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27','updatedAt')[_0xb0ee('0x84')](_0xb0ee('0xae'))[_0xb0ee('0x42')](_0xb0ee('0xa8'))[_0xb0ee('0x42')]('ListId\x20=\x20?',_0x591493[_0xb0ee('0xa7')][_0xb0ee('0x8a')]())[_0xb0ee('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xb0ee('0x8a')]();}_0x41fbb2[_0xb0ee('0x89')](db[_0xb0ee('0x72')][_0xb0ee('0x39')](_0x9c0ee2));}return BPromise['all'](_0x41fbb2);}})[_0xb0ee('0x28')](function(){var _0x4dd911=[];var _0x377a1b=squel[_0xb0ee('0xa0')]()['into'](_0xb0ee('0xb0'))[_0xb0ee('0xa2')]([_0xb0ee('0xb1'),_0xb0ee('0xa3'),_0xb0ee('0xb2'),'createdAt',_0xb0ee('0x59')],squel[_0xb0ee('0x81')]()[_0xb0ee('0x82')](_0xb0ee('0xb3'))[_0xb0ee('0x82')]('ci.item')[_0xb0ee('0x82')](_0xb0ee('0xb4'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27',_0xb0ee('0x58'))[_0xb0ee('0x82')]('\x27'+_0x271d41+'\x27',_0xb0ee('0x59'))['from'](_0xb0ee('0xb5'),'ci')['join'](_0xb0ee('0xac'),'h',_0xb0ee('0xb6'))[_0xb0ee('0x42')]('h.scheduledat=?',_0x271d41)['where']('ci.ItemClass=?','PHONE'))[_0xb0ee('0x8a')]();_0x4dd911[_0xb0ee('0x89')](db[_0xb0ee('0x72')][_0xb0ee('0x39')](_0x377a1b));return BPromise[_0xb0ee('0x8f')](_0x4dd911);})[_0xb0ee('0x28')](function(){return _0x3ff6b7;})[_0xb0ee('0x28')](respondWithResult(_0x3d699d,null))[_0xb0ee('0x4b')](handleError(_0x3d699d,null));};exports[_0xb0ee('0xb7')]=function(_0x55c8d8,_0x40758c,_0x98526){return db[_0xb0ee('0x47')][_0xb0ee('0x32')]({'where':{'id':_0x55c8d8[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x40758c,null))['then'](function(_0x5cce05){if(_0x5cce05){return _0x5cce05[_0xb0ee('0xb7')](_0x55c8d8[_0xb0ee('0x39')]['ids']);}})[_0xb0ee('0x28')](function(_0x1a9d72){if(_0x1a9d72){return db['CmHopper'][_0xb0ee('0x29')]({'where':{'ListId':_0x55c8d8['query'][_0xb0ee('0x80')],'VoiceQueueId':_0x55c8d8[_0xb0ee('0x4c')]['id']}})['then'](function(){return _0x1a9d72;});}})['then'](respondWithStatusCode(_0x40758c,null))[_0xb0ee('0x4b')](handleError(_0x40758c,null));};exports['getBlackLists']=function(_0x36201a,_0x6f4c2f,_0x4bd0eb){var _0x5acfa0={};var _0x260a32={};var _0x49fd0b;var _0x4d9b2a;return db[_0xb0ee('0x47')]['findOne']({'where':{'id':_0x36201a[_0xb0ee('0x4c')]['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x6f4c2f,null))['then'](function(_0x48bc89){if(_0x48bc89){_0x49fd0b=_0x48bc89;_0x260a32[_0xb0ee('0x38')]=_[_0xb0ee('0x3a')](db[_0xb0ee('0x9c')][_0xb0ee('0x36')]);_0x260a32['query']=_['keys'](_0x36201a[_0xb0ee('0x39')]);_0x260a32[_0xb0ee('0x3b')]=_['intersection'](_0x260a32[_0xb0ee('0x38')],_0x260a32[_0xb0ee('0x39')]);_0x5acfa0[_0xb0ee('0x3d')]=_['intersection'](_0x260a32['model'],qs['fields'](_0x36201a[_0xb0ee('0x39')][_0xb0ee('0x3e')]));_0x5acfa0[_0xb0ee('0x3d')]=_0x5acfa0[_0xb0ee('0x3d')][_0xb0ee('0x3f')]?_0x5acfa0[_0xb0ee('0x3d')]:_0x260a32[_0xb0ee('0x38')];_0x5acfa0[_0xb0ee('0x5e')]=qs[_0xb0ee('0x41')](_0x36201a[_0xb0ee('0x39')][_0xb0ee('0x41')]);_0x5acfa0[_0xb0ee('0x42')]=qs[_0xb0ee('0x3b')](_[_0xb0ee('0x43')](_0x36201a[_0xb0ee('0x39')],_0x260a32[_0xb0ee('0x3b')]));if(_0x36201a['query'][_0xb0ee('0x2d')]){_0x5acfa0[_0xb0ee('0x42')]=_[_0xb0ee('0x44')](_0x5acfa0[_0xb0ee('0x42')],{'$or':_[_0xb0ee('0x2f')](_0x5acfa0[_0xb0ee('0x3d')],function(_0x93498a){var _0x44215b={};_0x44215b[_0x93498a]={'$like':'%'+_0x36201a[_0xb0ee('0x39')]['filter']+'%'};return _0x44215b;})});}_0x5acfa0=_[_0xb0ee('0x44')]({},_0x5acfa0,_0x36201a['options']);return _0x49fd0b[_0xb0ee('0xb8')](_0x5acfa0);}})[_0xb0ee('0x28')](function(_0x4f3c31){if(_0x4f3c31){_0x4d9b2a=_0x4f3c31[_0xb0ee('0x3f')];if(!_0x36201a[_0xb0ee('0x39')][_0xb0ee('0x40')](_0xb0ee('0x5d'))){_0x5acfa0[_0xb0ee('0x1e')]=qs['limit'](_0x36201a['query']['limit']);_0x5acfa0[_0xb0ee('0x20')]=qs[_0xb0ee('0x20')](_0x36201a[_0xb0ee('0x39')][_0xb0ee('0x20')]);}return _0x49fd0b[_0xb0ee('0xb8')](_0x5acfa0);}})['then'](function(_0x419170){if(_0x419170){return _0x419170?{'count':_0x4d9b2a,'rows':_0x419170}:null;}})[_0xb0ee('0x28')](respondWithResult(_0x6f4c2f,null))[_0xb0ee('0x4b')](handleError(_0x6f4c2f,null));};exports[_0xb0ee('0xb9')]=function(_0x8c277a,_0x44e934,_0x402fe1){var _0xe096c1,_0xc7593b;return db[_0xb0ee('0x47')]['find']({'where':{'id':_0x8c277a['params']['id']}})[_0xb0ee('0x28')](handleEntityNotFound(_0x44e934,null))[_0xb0ee('0x28')](function(_0xcd7c01){if(_0xcd7c01){_0xc7593b=_0xcd7c01;return _0xcd7c01[_0xb0ee('0xb9')](_0x8c277a['body'][_0xb0ee('0x80')],_['omit'](_0x8c277a[_0xb0ee('0x4e')],[_0xb0ee('0x80'),'id'])||{});}return null;})['spread'](function(_0xad09fc){var _0x35fc5e;_0xe096c1=_0xad09fc||[];var _0x76d5d1=[];if(_0xad09fc){for(var _0x42af23=0x0;_0x42af23<_0xad09fc['length'];_0x42af23+=0x1){var _0x781047=_0xad09fc[_0x42af23][_0xb0ee('0x2a')]({'plain':!![]});_0x35fc5e=squel[_0xb0ee('0xa0')]()[_0xb0ee('0xa1')](_0xb0ee('0xba'))[_0xb0ee('0xa2')]([_0xb0ee('0xa3'),_0xb0ee('0xa5'),_0xb0ee('0xa6'),_0xb0ee('0x61'),'createdAt',_0xb0ee('0x59')],squel['select']()[_0xb0ee('0x82')](_0xb0ee('0xa3'),_0xb0ee('0xa3'))[_0xb0ee('0x82')]('id',_0xb0ee('0xa5'))[_0xb0ee('0x82')](_0x781047[_0xb0ee('0xa7')][_0xb0ee('0x8a')](),_0xb0ee('0xa6'))[_0xb0ee('0x82')](_0x8c277a[_0xb0ee('0x4c')]['id']['toString'](),_0xb0ee('0x61'))[_0xb0ee('0x82')](_0xb0ee('0xbb'),_0xb0ee('0x58'))['field'](_0xb0ee('0xbb'),_0xb0ee('0x59'))[_0xb0ee('0x84')]('cm_contacts')['where'](_0xb0ee('0xa8'))[_0xb0ee('0x42')]('ListId\x20=\x20?',_0x781047[_0xb0ee('0xa7')][_0xb0ee('0x8a')]())[_0xb0ee('0x42')](_0xb0ee('0xaa')))[_0xb0ee('0x8a')]();_0x76d5d1[_0xb0ee('0x89')](db[_0xb0ee('0x72')][_0xb0ee('0x39')](_0x35fc5e));}return BPromise[_0xb0ee('0x8f')](_0x76d5d1);}})[_0xb0ee('0x28')](function(){return _0xe096c1;})[_0xb0ee('0x28')](respondWithResult(_0x44e934,null))[_0xb0ee('0x4b')](handleError(_0x44e934,null));};exports[_0xb0ee('0xbc')]=function(_0x5d523f,_0x11bcdc,_0x591bc8){return db['VoiceQueue'][_0xb0ee('0x32')]({'where':{'id':_0x5d523f['params']['id']}})['then'](handleEntityNotFound(_0x11bcdc,null))[_0xb0ee('0x28')](function(_0x25bf94){if(_0x25bf94){return _0x25bf94[_0xb0ee('0xbc')](_0x5d523f[_0xb0ee('0x39')][_0xb0ee('0x80')]);}})[_0xb0ee('0x28')](function(_0x4393b0){if(_0x4393b0){return db['CmHopperBlack'][_0xb0ee('0x29')]({'where':{'ListId':_0x5d523f[_0xb0ee('0x39')][_0xb0ee('0x80')],'VoiceQueueId':_0x5d523f['params']['id']}})[_0xb0ee('0x28')](function(){return _0x4393b0;});}})[_0xb0ee('0x28')](respondWithStatusCode(_0x11bcdc,null))[_0xb0ee('0x4b')](handleError(_0x11bcdc,null));}; \ No newline at end of file +var _0x1574=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','removeTeams','select','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','union','compact','isEmpty','userVoiceQueue:remove','addAgents','ids','userVoiceQueue:save','all','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','push','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','error','name','send','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1574,0x148));var _0x4157=function(_0x27dbc4,_0x2cd647){_0x27dbc4=_0x27dbc4-0x0;var _0x44bcd7=_0x1574[_0x27dbc4];return _0x44bcd7;};'use strict';var emlformat=require(_0x4157('0x0'));var rimraf=require(_0x4157('0x1'));var zipdir=require(_0x4157('0x2'));var jsonpatch=require(_0x4157('0x3'));var rp=require('request-promise');var moment=require(_0x4157('0x4'));var BPromise=require(_0x4157('0x5'));var Mustache=require(_0x4157('0x6'));var util=require(_0x4157('0x7'));var path=require(_0x4157('0x8'));var sox=require(_0x4157('0x9'));var csv=require(_0x4157('0xa'));var ejs=require(_0x4157('0xb'));var fs=require('fs');var fs_extra=require(_0x4157('0xc'));var _=require(_0x4157('0xd'));var squel=require(_0x4157('0xe'));var crypto=require(_0x4157('0xf'));var jsforce=require(_0x4157('0x10'));var deskjs=require(_0x4157('0x11'));var toCsv=require(_0x4157('0xa'));var querystring=require('querystring');var Papa=require(_0x4157('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4157('0x13'));var hardwareService=require(_0x4157('0x14'));var logger=require(_0x4157('0x15'))('api');var utils=require(_0x4157('0x16'));var config=require(_0x4157('0x17'));var licenseUtil=require(_0x4157('0x18'));var db=require(_0x4157('0x19'))['db'];config[_0x4157('0x1a')]=_[_0x4157('0x1b')](config[_0x4157('0x1a')],{'host':_0x4157('0x1c'),'port':0x18eb});var socket=require(_0x4157('0x1d'))(new Redis(config[_0x4157('0x1a')]));require(_0x4157('0x1e'))[_0x4157('0x1f')](socket);function respondWithStatusCode(_0x57b24a,_0xb0405c){_0xb0405c=_0xb0405c||0xcc;return function(_0x58a27f){if(_0x58a27f){return _0x57b24a[_0x4157('0x20')](_0xb0405c);}return _0x57b24a[_0x4157('0x21')](_0xb0405c)[_0x4157('0x22')]();};}function respondWithResult(_0x30598b,_0x41351e){_0x41351e=_0x41351e||0xc8;return function(_0xbfe210){if(_0xbfe210){return _0x30598b[_0x4157('0x21')](_0x41351e)[_0x4157('0x23')](_0xbfe210);}};}function respondWithFilteredResult(_0xaf867b,_0x100d71){return function(_0x2ddedc){if(_0x2ddedc){var _0x141b50=typeof _0x100d71['offset']===_0x4157('0x24')&&typeof _0x100d71['limit']===_0x4157('0x24');var _0x1a8444=_0x2ddedc['count'];var _0x3df8f4=_0x141b50?0x0:_0x100d71[_0x4157('0x25')];var _0x4cf4d0=_0x141b50?_0x2ddedc[_0x4157('0x26')]:_0x100d71[_0x4157('0x25')]+_0x100d71[_0x4157('0x27')];var _0x24156f;if(_0x4cf4d0>=_0x1a8444){_0x4cf4d0=_0x1a8444;_0x24156f=0xc8;}else{_0x24156f=0xce;}_0xaf867b[_0x4157('0x21')](_0x24156f);return _0xaf867b[_0x4157('0x28')]('Content-Range',_0x3df8f4+'-'+_0x4cf4d0+'/'+_0x1a8444)['json'](_0x2ddedc);}return null;};}function patchUpdates(_0x13b319){return function(_0x4717ac){try{jsonpatch[_0x4157('0x29')](_0x4717ac,_0x13b319,!![]);}catch(_0xcc64c7){return BPromise['reject'](_0xcc64c7);}return _0x4717ac[_0x4157('0x2a')]();};}function saveUpdates(_0x5ea157,_0x1b37cd){return function(_0x2ee00a){if(_0x2ee00a){return _0x2ee00a[_0x4157('0x2b')](_0x5ea157)[_0x4157('0x2c')](function(_0x289423){return _0x289423;});}return null;};}function removeEntity(_0x3940a0,_0xd548a8){return function(_0x3cef69){if(_0x3cef69){return _0x3cef69[_0x4157('0x2d')]()[_0x4157('0x2c')](function(){var _0x101e8f=_0x3cef69[_0x4157('0x2e')]({'plain':!![]});var _0x2fe867=[{'name':_0x4157('0x2f'),'value':_0x4157('0x30'),'ignore':![]},{'name':'QueueCampaigns','value':_0x4157('0x31'),'ignore':![]}];var _0x56ceb8=_(_0x2fe867)[_0x4157('0x32')](_0x4157('0x33'))[_0x4157('0x34')](_0x4157('0x35'))[_0x4157('0x35')]();if(_[_0x4157('0x36')](_0x56ceb8,_0x101e8f[_0x4157('0x37')])){return;}var _0xe97e9c=_[_0x4157('0x38')](_0x2fe867,[_0x4157('0x35'),_0x101e8f[_0x4157('0x37')]])['name'];return db[_0x4157('0x39')]['destroy']({'where':{'type':_0xe97e9c,'resourceId':_0x101e8f['id']}})['then'](function(){return _0x3cef69;});})['then'](function(){_0x3940a0[_0x4157('0x21')](0xcc)[_0x4157('0x22')]();});}};}function handleEntityNotFound(_0x49a70f,_0x4f5a8c){return function(_0x3534ca){if(!_0x3534ca){_0x49a70f['sendStatus'](0x194);}return _0x3534ca;};}function handleError(_0x23195b,_0x40c6a7){_0x40c6a7=_0x40c6a7||0x1f4;return function(_0x134122){logger[_0x4157('0x3a')](_0x134122['stack']);if(_0x134122['name']){delete _0x134122[_0x4157('0x3b')];}_0x23195b[_0x4157('0x21')](_0x40c6a7)[_0x4157('0x3c')](_0x134122);};}exports['index']=function(_0x3c03fe,_0xe0d7e5){var _0x2aeb04={},_0x3984a5={},_0x5d473a={'count':0x0,'rows':[]};var _0x4f22de=_[_0x4157('0x34')](db[_0x4157('0x3d')][_0x4157('0x3e')],function(_0x12eb77){return{'name':_0x12eb77[_0x4157('0x3f')],'type':_0x12eb77[_0x4157('0x37')][_0x4157('0x40')]};});_0x3984a5[_0x4157('0x41')]=_[_0x4157('0x34')](_0x4f22de,_0x4157('0x3b'));_0x3984a5['query']=_[_0x4157('0x42')](_0x3c03fe[_0x4157('0x43')]);_0x3984a5[_0x4157('0x44')]=_[_0x4157('0x45')](_0x3984a5[_0x4157('0x41')],_0x3984a5[_0x4157('0x43')]);_0x2aeb04[_0x4157('0x46')]=_[_0x4157('0x45')](_0x3984a5[_0x4157('0x41')],qs['fields'](_0x3c03fe['query'][_0x4157('0x47')]));_0x2aeb04[_0x4157('0x46')]=_0x2aeb04[_0x4157('0x46')][_0x4157('0x48')]?_0x2aeb04[_0x4157('0x46')]:_0x3984a5[_0x4157('0x41')];if(!_0x3c03fe['query'][_0x4157('0x49')](_0x4157('0x4a'))){_0x2aeb04['limit']=qs[_0x4157('0x27')](_0x3c03fe[_0x4157('0x43')][_0x4157('0x27')]);_0x2aeb04[_0x4157('0x25')]=qs['offset'](_0x3c03fe[_0x4157('0x43')][_0x4157('0x25')]);}_0x2aeb04[_0x4157('0x4b')]=qs['sort'](_0x3c03fe[_0x4157('0x43')][_0x4157('0x4c')]);_0x2aeb04[_0x4157('0x4d')]=qs['filters'](_[_0x4157('0x4e')](_0x3c03fe['query'],_0x3984a5[_0x4157('0x44')]),_0x4f22de);if(_0x3c03fe[_0x4157('0x43')][_0x4157('0x32')]){_0x2aeb04[_0x4157('0x4d')]=_[_0x4157('0x4f')](_0x2aeb04[_0x4157('0x4d')],{'$or':_['map'](_0x4f22de,function(_0x8a97b9){if(_0x8a97b9[_0x4157('0x37')]!==_0x4157('0x50')){var _0xb47765={};_0xb47765[_0x8a97b9['name']]={'$like':'%'+_0x3c03fe[_0x4157('0x43')]['filter']+'%'};return _0xb47765;}})});}_0x2aeb04=_['merge']({},_0x2aeb04,_0x3c03fe['options']);var _0x45ea1a={'where':_0x2aeb04[_0x4157('0x4d')]};return db[_0x4157('0x3d')]['count'](_0x45ea1a)[_0x4157('0x2c')](function(_0x5a4637){_0x5d473a[_0x4157('0x26')]=_0x5a4637;if(_0x3c03fe[_0x4157('0x43')][_0x4157('0x51')]){_0x2aeb04['include']=[{'all':!![]}];}return db[_0x4157('0x3d')][_0x4157('0x52')](_0x2aeb04);})[_0x4157('0x2c')](function(_0x4c15ca){_0x5d473a[_0x4157('0x53')]=_0x4c15ca;return _0x5d473a;})[_0x4157('0x2c')](respondWithFilteredResult(_0xe0d7e5,_0x2aeb04))[_0x4157('0x54')](handleError(_0xe0d7e5,null));};exports[_0x4157('0x55')]=function(_0x309906,_0x48020f){var _0x566e43={'raw':![],'where':{'id':_0x309906[_0x4157('0x56')]['id']}},_0x582fe9={};_0x582fe9[_0x4157('0x41')]=_[_0x4157('0x42')](db['VoiceQueue'][_0x4157('0x3e')]);_0x582fe9[_0x4157('0x43')]=_[_0x4157('0x42')](_0x309906[_0x4157('0x43')]);_0x582fe9[_0x4157('0x44')]=_[_0x4157('0x45')](_0x582fe9['model'],_0x582fe9[_0x4157('0x43')]);_0x566e43[_0x4157('0x46')]=_[_0x4157('0x45')](_0x582fe9['model'],qs['fields'](_0x309906['query'][_0x4157('0x47')]));_0x566e43[_0x4157('0x46')]=_0x566e43[_0x4157('0x46')][_0x4157('0x48')]?_0x566e43[_0x4157('0x46')]:_0x582fe9[_0x4157('0x41')];if(_0x309906[_0x4157('0x43')][_0x4157('0x51')]){_0x566e43[_0x4157('0x57')]=[{'all':!![]}];}_0x566e43=_['merge']({},_0x566e43,_0x309906[_0x4157('0x58')]);return db[_0x4157('0x3d')]['find'](_0x566e43)['then'](handleEntityNotFound(_0x48020f,null))[_0x4157('0x2c')](respondWithResult(_0x48020f,null))['catch'](handleError(_0x48020f,null));};exports[_0x4157('0x59')]=function(_0x5754c3,_0x139424){return db['VoiceQueue'][_0x4157('0x59')](_0x5754c3[_0x4157('0x5a')],{})[_0x4157('0x2c')](function(_0x7df078){var _0x3116aa=_0x5754c3[_0x4157('0x5b')]['get']({'plain':!![]});if(!_0x3116aa)throw new Error(_0x4157('0x5c'));if(_0x3116aa['role']===_0x4157('0x5b')){var _0x57ba25=_0x7df078['get']({'plain':!![]});var _0x2f62fe=[{'name':_0x4157('0x2f'),'value':_0x4157('0x30')},{'name':_0x4157('0x5d'),'value':'outbound'}];var _0x1712fb=_[_0x4157('0x38')](_0x2f62fe,[_0x4157('0x35'),_0x57ba25[_0x4157('0x37')]])[_0x4157('0x3b')];return db[_0x4157('0x5e')][_0x4157('0x38')]({'where':{'name':_0x1712fb,'userProfileId':_0x3116aa['userProfileId']},'raw':!![]})['then'](function(_0x5b07fd){if(_0x5b07fd&&_0x5b07fd[_0x4157('0x5f')]===0x0){return db[_0x4157('0x39')][_0x4157('0x59')]({'name':_0x57ba25[_0x4157('0x3b')],'resourceId':_0x57ba25['id'],'type':_0x5b07fd['name'],'sectionId':_0x5b07fd['id']},{})[_0x4157('0x2c')](function(){return _0x7df078;});}else{return _0x7df078;}})['catch'](function(_0x31cec7){logger[_0x4157('0x3a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31cec7);throw _0x31cec7;});}return _0x7df078;})[_0x4157('0x2c')](respondWithResult(_0x139424,0xc9))[_0x4157('0x54')](handleError(_0x139424,null));};exports[_0x4157('0x60')]=function(_0x9fac28,_0x1c842e){var _0x3f4494={'where':{'id':_0x9fac28[_0x4157('0x56')]['id']}},_0x4610f9={};_0x4610f9[_0x4157('0x41')]=_[_0x4157('0x42')](db[_0x4157('0x3d')][_0x4157('0x3e')]);_0x3f4494['attributes']=_[_0x4157('0x45')](_0x4610f9[_0x4157('0x41')],qs[_0x4157('0x47')](_0x9fac28['query']['fields']));_0x3f4494[_0x4157('0x46')]=_0x3f4494['attributes']['length']?_0x3f4494['attributes']:_0x4610f9[_0x4157('0x41')];if(_0x9fac28['query'][_0x4157('0x51')]){_0x3f4494['include']=[{'all':!![]}];}_0x3f4494=_['merge']({},_0x3f4494,_0x9fac28[_0x4157('0x58')]);return db[_0x4157('0x3d')][_0x4157('0x38')](_0x3f4494)['then'](handleEntityNotFound(_0x1c842e,null))['then'](function(_0x4e52e7){if(_0x4e52e7){var _0x940bee=_0x4e52e7[_0x4157('0x2e')]({'plain':!![]});_0x940bee=qs[_0x4157('0x61')](_0x940bee,['id','createdAt','updatedAt']);_0x9fac28['body']=_[_0x4157('0x61')](_0x9fac28[_0x4157('0x5a')],['id',_0x4157('0x62'),_0x4157('0x63')]);return db[_0x4157('0x3d')][_0x4157('0x59')](_[_0x4157('0x4f')](_0x940bee,_0x9fac28[_0x4157('0x5a')]),{'include':_0x9fac28['query'][_0x4157('0x51')]?[{'all':!![]}]:undefined})[_0x4157('0x2c')](function(_0x59b59b){var _0xc67b9a=_0x9fac28[_0x4157('0x5b')][_0x4157('0x2e')]({'plain':!![]});if(!_0xc67b9a)throw new Error(_0x4157('0x5c'));if(_0xc67b9a[_0x4157('0x64')]===_0x4157('0x5b')){var _0xe41de8=_0x59b59b['get']({'plain':!![]});var _0x5db480=[{'name':_0x4157('0x2f'),'value':_0x4157('0x30')},{'name':'QueueCampaigns','value':'outbound'}];var _0x16dcea=_[_0x4157('0x38')](_0x5db480,[_0x4157('0x35'),_0xe41de8['type']])[_0x4157('0x3b')];return db[_0x4157('0x5e')][_0x4157('0x38')]({'where':{'name':_0x16dcea,'userProfileId':_0xc67b9a['userProfileId']},'raw':!![]})[_0x4157('0x2c')](function(_0x36a3e1){if(_0x36a3e1&&_0x36a3e1['autoAssociation']===0x0){return db['UserProfileResource'][_0x4157('0x59')]({'name':_0xe41de8[_0x4157('0x3b')],'resourceId':_0xe41de8['id'],'type':_0x36a3e1[_0x4157('0x3b')],'sectionId':_0x36a3e1['id']},{})[_0x4157('0x2c')](function(){return _0x59b59b;});}else{return _0x59b59b;}})['catch'](function(_0x210ab1){logger[_0x4157('0x3a')](_0x4157('0x65'),_0x210ab1);throw _0x210ab1;});}return _0x59b59b;});}})[_0x4157('0x2c')](respondWithResult(_0x1c842e,0xc9))[_0x4157('0x54')](handleError(_0x1c842e,null));};exports['update']=function(_0x5a771d,_0x16165c){if(_0x5a771d[_0x4157('0x5a')]['id']){delete _0x5a771d[_0x4157('0x5a')]['id'];}return db['VoiceQueue'][_0x4157('0x38')]({'where':{'id':_0x5a771d[_0x4157('0x56')]['id']}})['then'](handleEntityNotFound(_0x16165c,null))[_0x4157('0x2c')](saveUpdates(_0x5a771d[_0x4157('0x5a')],null))[_0x4157('0x2c')](respondWithResult(_0x16165c,null))[_0x4157('0x54')](handleError(_0x16165c,null));};exports[_0x4157('0x2d')]=function(_0x316398,_0x3e2e40){return db['VoiceQueue'][_0x4157('0x38')]({'where':{'id':_0x316398[_0x4157('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e2e40,null))[_0x4157('0x2c')](removeEntity(_0x3e2e40,null))[_0x4157('0x54')](handleError(_0x3e2e40,null));};exports[_0x4157('0x66')]=function(_0x3f8989,_0x28937a,_0x1a12c0){var _0x46d288={'raw':![],'where':{}};var _0x1dd57a={};var _0x4a800f={'count':0x0,'rows':[]};return db[_0x4157('0x3d')][_0x4157('0x67')]({'where':{'id':_0x3f8989['params']['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x28937a,null))[_0x4157('0x2c')](function(_0x19a25f){if(_0x19a25f){_0x1dd57a[_0x4157('0x41')]=_[_0x4157('0x42')](db['CmHopper'][_0x4157('0x3e')]);_0x1dd57a[_0x4157('0x43')]=_[_0x4157('0x42')](_0x3f8989[_0x4157('0x43')]);_0x1dd57a[_0x4157('0x44')]=_[_0x4157('0x45')](_0x1dd57a['model'],_0x1dd57a['query']);_0x46d288[_0x4157('0x46')]=_[_0x4157('0x45')](_0x1dd57a[_0x4157('0x41')],qs[_0x4157('0x47')](_0x3f8989[_0x4157('0x43')][_0x4157('0x47')]));_0x46d288['attributes']=_0x46d288[_0x4157('0x46')][_0x4157('0x48')]?_0x46d288[_0x4157('0x46')]:_0x1dd57a[_0x4157('0x41')];if(!_0x3f8989['query'][_0x4157('0x49')]('nolimit')){_0x46d288[_0x4157('0x27')]=qs[_0x4157('0x27')](_0x3f8989[_0x4157('0x43')][_0x4157('0x27')]);_0x46d288[_0x4157('0x25')]=qs[_0x4157('0x25')](_0x3f8989[_0x4157('0x43')][_0x4157('0x25')]);}_0x46d288[_0x4157('0x4b')]=qs[_0x4157('0x4c')](_0x3f8989['query'][_0x4157('0x4c')]);_0x46d288[_0x4157('0x4d')]=qs[_0x4157('0x44')](_['pick'](_0x3f8989['query'],_0x1dd57a[_0x4157('0x44')]));_0x46d288['where'][_0x4157('0x68')]=_0x19a25f['id'];if(_0x3f8989['query'][_0x4157('0x32')]){_0x46d288[_0x4157('0x4d')]=_[_0x4157('0x4f')](_0x46d288[_0x4157('0x4d')],{'$or':_['map'](_0x46d288['attributes'],function(_0x55f127){var _0xa1305b={};_0xa1305b[_0x55f127]={'$like':'%'+_0x3f8989['query'][_0x4157('0x32')]+'%'};return _0xa1305b;})});}_0x46d288=_[_0x4157('0x4f')]({},_0x46d288,_0x3f8989[_0x4157('0x58')]);return db[_0x4157('0x69')][_0x4157('0x26')]({'where':_0x46d288['where']})[_0x4157('0x2c')](function(_0x359f1f){_0x4a800f[_0x4157('0x26')]=_0x359f1f;if(_0x3f8989[_0x4157('0x43')][_0x4157('0x51')]){_0x46d288[_0x4157('0x57')]=[{'all':!![]}];}return db['CmHopper'][_0x4157('0x52')](_0x46d288);})[_0x4157('0x2c')](function(_0x395c1a){_0x4a800f[_0x4157('0x53')]=_0x395c1a;return _0x4a800f;});}})['then'](respondWithFilteredResult(_0x28937a,_0x46d288))[_0x4157('0x54')](handleError(_0x28937a,null));};exports[_0x4157('0x6a')]=function(_0x5a7a75,_0x3c576e,_0x2a9a4d){var _0x426965={'raw':!![],'where':{}};var _0x114b3c={};var _0x438311={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4157('0x67')]({'where':{'id':_0x5a7a75[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x3c576e,null))[_0x4157('0x2c')](function(_0x52226e){if(_0x52226e){_0x114b3c[_0x4157('0x41')]=_[_0x4157('0x42')](db[_0x4157('0x6b')][_0x4157('0x3e')]);_0x114b3c['query']=_[_0x4157('0x42')](_0x5a7a75[_0x4157('0x43')]);_0x114b3c[_0x4157('0x44')]=_[_0x4157('0x45')](_0x114b3c[_0x4157('0x41')],_0x114b3c['query']);_0x426965[_0x4157('0x46')]=_[_0x4157('0x45')](_0x114b3c[_0x4157('0x41')],qs['fields'](_0x5a7a75[_0x4157('0x43')]['fields']));_0x426965[_0x4157('0x46')]=_0x426965['attributes'][_0x4157('0x48')]?_0x426965[_0x4157('0x46')]:_0x114b3c[_0x4157('0x41')];if(!_0x5a7a75[_0x4157('0x43')][_0x4157('0x49')](_0x4157('0x4a'))){_0x426965['limit']=qs[_0x4157('0x27')](_0x5a7a75['query'][_0x4157('0x27')]);_0x426965[_0x4157('0x25')]=qs[_0x4157('0x25')](_0x5a7a75['query'][_0x4157('0x25')]);}_0x426965['order']=qs[_0x4157('0x4c')](_0x5a7a75[_0x4157('0x43')]['sort']);_0x426965[_0x4157('0x4d')]=qs['filters'](_['pick'](_0x5a7a75[_0x4157('0x43')],_0x114b3c[_0x4157('0x44')]));_0x426965[_0x4157('0x4d')]['VoiceQueueId']=_0x52226e['id'];if(_0x5a7a75[_0x4157('0x43')][_0x4157('0x32')]){_0x426965[_0x4157('0x4d')]=_[_0x4157('0x4f')](_0x426965['where'],{'$or':_[_0x4157('0x34')](_0x426965[_0x4157('0x46')],function(_0x39ee24){var _0x498615={};_0x498615[_0x39ee24]={'$like':'%'+_0x5a7a75[_0x4157('0x43')][_0x4157('0x32')]+'%'};return _0x498615;})});}_0x426965=_[_0x4157('0x4f')]({},_0x426965,_0x5a7a75[_0x4157('0x58')]);return db[_0x4157('0x6b')]['count']({'where':_0x426965['where']})[_0x4157('0x2c')](function(_0x1467df){_0x438311[_0x4157('0x26')]=_0x1467df;if(_0x5a7a75['query'][_0x4157('0x51')]){_0x426965['include']=[{'all':!![]}];}return db[_0x4157('0x6b')][_0x4157('0x52')](_0x426965);})[_0x4157('0x2c')](function(_0x106f49){_0x438311[_0x4157('0x53')]=_0x106f49;return _0x438311;});}})['then'](respondWithFilteredResult(_0x3c576e,_0x426965))[_0x4157('0x54')](handleError(_0x3c576e,null));};exports[_0x4157('0x6c')]=function(_0x276465,_0x4ac923,_0x56bfa5){var _0x2ec4d7={'raw':!![],'where':{}};var _0x3ed443={};var _0x8a84d3={'count':0x0,'rows':[]};return db[_0x4157('0x3d')][_0x4157('0x67')]({'where':{'id':_0x276465['params']['id']}})['then'](handleEntityNotFound(_0x4ac923,null))[_0x4157('0x2c')](function(_0x4bb222){if(_0x4bb222){_0x3ed443[_0x4157('0x41')]=_['keys'](db[_0x4157('0x6d')][_0x4157('0x3e')]);_0x3ed443['query']=_[_0x4157('0x42')](_0x276465[_0x4157('0x43')]);_0x3ed443[_0x4157('0x44')]=_['intersection'](_0x3ed443[_0x4157('0x41')],_0x3ed443['query']);_0x2ec4d7[_0x4157('0x46')]=_[_0x4157('0x45')](_0x3ed443[_0x4157('0x41')],qs[_0x4157('0x47')](_0x276465[_0x4157('0x43')][_0x4157('0x47')]));_0x2ec4d7[_0x4157('0x46')]=_0x2ec4d7['attributes'][_0x4157('0x48')]?_0x2ec4d7[_0x4157('0x46')]:_0x3ed443['model'];if(!_0x276465[_0x4157('0x43')][_0x4157('0x49')](_0x4157('0x4a'))){_0x2ec4d7[_0x4157('0x27')]=qs[_0x4157('0x27')](_0x276465['query']['limit']);_0x2ec4d7[_0x4157('0x25')]=qs['offset'](_0x276465[_0x4157('0x43')]['offset']);}_0x2ec4d7[_0x4157('0x4b')]=qs[_0x4157('0x4c')](_0x276465[_0x4157('0x43')]['sort']);_0x2ec4d7[_0x4157('0x4d')]=qs['filters'](_[_0x4157('0x4e')](_0x276465[_0x4157('0x43')],_0x3ed443[_0x4157('0x44')]));_0x2ec4d7[_0x4157('0x4d')][_0x4157('0x68')]=_0x4bb222['id'];if(_0x276465[_0x4157('0x43')]['filter']){_0x2ec4d7[_0x4157('0x4d')]=_[_0x4157('0x4f')](_0x2ec4d7[_0x4157('0x4d')],{'$or':_[_0x4157('0x34')](_0x2ec4d7[_0x4157('0x46')],function(_0x919007){var _0x502761={};_0x502761[_0x919007]={'$like':'%'+_0x276465['query'][_0x4157('0x32')]+'%'};return _0x502761;})});}_0x2ec4d7=_[_0x4157('0x4f')]({},_0x2ec4d7,_0x276465['options']);return db['CmHopperFinal']['count']({'where':_0x2ec4d7[_0x4157('0x4d')]})[_0x4157('0x2c')](function(_0x159afe){_0x8a84d3[_0x4157('0x26')]=_0x159afe;if(_0x276465[_0x4157('0x43')][_0x4157('0x51')]){_0x2ec4d7[_0x4157('0x57')]=[{'all':!![]}];}return db[_0x4157('0x6d')][_0x4157('0x52')](_0x2ec4d7);})[_0x4157('0x2c')](function(_0x1e746d){_0x8a84d3[_0x4157('0x53')]=_0x1e746d;return _0x8a84d3;});}})[_0x4157('0x2c')](respondWithFilteredResult(_0x4ac923,_0x2ec4d7))[_0x4157('0x54')](handleError(_0x4ac923,null));};exports[_0x4157('0x6e')]=function(_0x3ac07f,_0x3b56f2,_0x25f661){var _0x10f19d={'raw':!![],'where':{}};var _0x200198={};var _0x1fc49f={'count':0x0,'rows':[]};return db[_0x4157('0x3d')]['findOne']({'where':{'id':_0x3ac07f[_0x4157('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b56f2,null))[_0x4157('0x2c')](function(_0x47c743){if(_0x47c743){_0x200198[_0x4157('0x41')]=_[_0x4157('0x42')](db[_0x4157('0x6f')][_0x4157('0x3e')]);_0x200198[_0x4157('0x43')]=_[_0x4157('0x42')](_0x3ac07f['query']);_0x200198[_0x4157('0x44')]=_[_0x4157('0x45')](_0x200198[_0x4157('0x41')],_0x200198['query']);_0x10f19d[_0x4157('0x46')]=_[_0x4157('0x45')](_0x200198[_0x4157('0x41')],qs[_0x4157('0x47')](_0x3ac07f[_0x4157('0x43')][_0x4157('0x47')]));_0x10f19d[_0x4157('0x46')]=_0x10f19d['attributes'][_0x4157('0x48')]?_0x10f19d[_0x4157('0x46')]:_0x200198[_0x4157('0x41')];if(!_0x3ac07f['query'][_0x4157('0x49')](_0x4157('0x4a'))){_0x10f19d[_0x4157('0x27')]=qs[_0x4157('0x27')](_0x3ac07f[_0x4157('0x43')][_0x4157('0x27')]);_0x10f19d[_0x4157('0x25')]=qs[_0x4157('0x25')](_0x3ac07f['query']['offset']);}_0x10f19d[_0x4157('0x4b')]=qs[_0x4157('0x4c')](_0x3ac07f[_0x4157('0x43')][_0x4157('0x4c')]);_0x10f19d[_0x4157('0x4d')]=qs[_0x4157('0x44')](_['pick'](_0x3ac07f[_0x4157('0x43')],_0x200198[_0x4157('0x44')]));_0x10f19d[_0x4157('0x4d')][_0x4157('0x68')]=_0x47c743['id'];if(_0x3ac07f['query'][_0x4157('0x32')]){_0x10f19d[_0x4157('0x4d')]=_[_0x4157('0x4f')](_0x10f19d['where'],{'$or':_[_0x4157('0x34')](_0x10f19d[_0x4157('0x46')],function(_0x32aae2){var _0x2a69f3={};_0x2a69f3[_0x32aae2]={'$like':'%'+_0x3ac07f[_0x4157('0x43')][_0x4157('0x32')]+'%'};return _0x2a69f3;})});}_0x10f19d=_[_0x4157('0x4f')]({},_0x10f19d,_0x3ac07f[_0x4157('0x58')]);return db[_0x4157('0x6f')][_0x4157('0x26')]({'where':_0x10f19d[_0x4157('0x4d')]})[_0x4157('0x2c')](function(_0x420f09){_0x1fc49f[_0x4157('0x26')]=_0x420f09;if(_0x3ac07f['query'][_0x4157('0x51')]){_0x10f19d[_0x4157('0x57')]=[{'all':!![]}];}return db[_0x4157('0x6f')][_0x4157('0x52')](_0x10f19d);})['then'](function(_0x43bdf2){_0x1fc49f[_0x4157('0x53')]=_0x43bdf2;return _0x1fc49f;});}})['then'](respondWithFilteredResult(_0x3b56f2,_0x10f19d))['catch'](handleError(_0x3b56f2,null));};exports[_0x4157('0x70')]=function(_0x1b316d,_0x1d6648,_0x497b6a){var _0x2c1f3e={};var _0x41fd15={};var _0x57eb64;var _0x1a17eb;return db['VoiceQueue'][_0x4157('0x67')]({'where':{'id':_0x1b316d['params']['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x1d6648,null))[_0x4157('0x2c')](function(_0x30ed00){if(_0x30ed00){_0x57eb64=_0x30ed00;_0x41fd15[_0x4157('0x41')]=_['keys'](db[_0x4157('0x71')][_0x4157('0x3e')]);_0x41fd15[_0x4157('0x43')]=_[_0x4157('0x42')](_0x1b316d['query']);_0x41fd15[_0x4157('0x44')]=_[_0x4157('0x45')](_0x41fd15[_0x4157('0x41')],_0x41fd15['query']);_0x2c1f3e['attributes']=_[_0x4157('0x45')](_0x41fd15[_0x4157('0x41')],qs[_0x4157('0x47')](_0x1b316d[_0x4157('0x43')]['fields']));_0x2c1f3e['attributes']=_0x2c1f3e[_0x4157('0x46')][_0x4157('0x48')]?_0x2c1f3e[_0x4157('0x46')]:_0x41fd15[_0x4157('0x41')];_0x2c1f3e['order']=qs[_0x4157('0x4c')](_0x1b316d['query'][_0x4157('0x4c')]);_0x2c1f3e[_0x4157('0x4d')]=qs[_0x4157('0x44')](_['pick'](_0x1b316d[_0x4157('0x43')],_0x41fd15[_0x4157('0x44')]));if(_0x1b316d[_0x4157('0x43')][_0x4157('0x32')]){_0x2c1f3e[_0x4157('0x4d')]=_[_0x4157('0x4f')](_0x2c1f3e[_0x4157('0x4d')],{'$or':_['map'](_0x2c1f3e['attributes'],function(_0x4e3647){var _0x2ba1b0={};_0x2ba1b0[_0x4e3647]={'$like':'%'+_0x1b316d[_0x4157('0x43')][_0x4157('0x32')]+'%'};return _0x2ba1b0;})});}_0x2c1f3e=_[_0x4157('0x4f')]({},_0x2c1f3e,_0x1b316d[_0x4157('0x58')]);return _0x57eb64[_0x4157('0x70')](_0x2c1f3e);}})[_0x4157('0x2c')](function(_0x23fe22){if(_0x23fe22){_0x1a17eb=_0x23fe22['length'];if(!_0x1b316d[_0x4157('0x43')][_0x4157('0x49')](_0x4157('0x4a'))){_0x2c1f3e[_0x4157('0x27')]=qs['limit'](_0x1b316d[_0x4157('0x43')][_0x4157('0x27')]);_0x2c1f3e[_0x4157('0x25')]=qs['offset'](_0x1b316d[_0x4157('0x43')]['offset']);}return _0x57eb64[_0x4157('0x70')](_0x2c1f3e);}})[_0x4157('0x2c')](function(_0x19871c){if(_0x19871c){return _0x19871c?{'count':_0x1a17eb,'rows':_0x19871c}:null;}})[_0x4157('0x2c')](respondWithResult(_0x1d6648,null))[_0x4157('0x54')](handleError(_0x1d6648,null));};exports[_0x4157('0x72')]=function(_0x13f19e,_0x269f17,_0x2d2726){var _0x415ec8=_0x13f19e[_0x4157('0x5a')][_0x4157('0x73')];var _0x1d8326=_['map'](_0x415ec8,'id');return db[_0x4157('0x71')][_0x4157('0x52')]({'where':{'id':_0x1d8326},'attributes':['id'],'include':[{'model':db[_0x4157('0x74')],'as':_0x4157('0x75'),'attributes':['id',_0x4157('0x3b'),_0x4157('0x76'),_0x4157('0x77'),'interface'],'raw':!![]}]})[_0x4157('0x2c')](function(_0x4479de){if(_0x4479de){var _0x451769=_[_0x4157('0x78')](_0x4479de,function(_0x549e45){var _0x974cfd=_0x549e45[_0x4157('0x2e')]({'plain':!![]});_0x974cfd['Agents'][_0x4157('0x79')](function(_0x3cf1f9){_0x3cf1f9[_0x4157('0x7a')]=_[_0x4157('0x38')](_0x415ec8,{'id':_0x974cfd['id']})[_0x4157('0x7a')];});return _0x974cfd[_0x4157('0x75')];});return db['VoiceQueue'][_0x4157('0x38')]({'where':{'id':_0x13f19e['params']['id']}})['then'](function(_0x4d6b2c){return db[_0x4157('0x7b')][_0x4157('0x7c')](function(_0x5247d6){return _0x4d6b2c[_0x4157('0x72')](_0x1d8326,{'transaction':_0x5247d6})['then'](function(){return BPromise[_0x4157('0x7d')](_0x415ec8,function(_0x28ea11){return db[_0x4157('0x7e')][_0x4157('0x7f')]({'TeamId':_0x28ea11['id'],'VoiceQueueId':_0x13f19e[_0x4157('0x56')]['id'],'penalty':_0x28ea11[_0x4157('0x7a')]},{'transaction':_0x5247d6});});})[_0x4157('0x2c')](function(){return BPromise[_0x4157('0x7d')](_0x451769,function(_0x3a7ead){return db['UserVoiceQueue'][_0x4157('0x80')]({'where':{'UserId':_0x3a7ead['id'],'VoiceQueueId':_0x13f19e['params']['id']},'defaults':{'penalty':_0x3a7ead[_0x4157('0x7a')]},'transaction':_0x5247d6});});})[_0x4157('0x2c')](function(){return BPromise['each'](_[_0x4157('0x32')](_0x451769,{'online':!![]}),function(_0x4fb99b){return db[_0x4157('0x81')][_0x4157('0x7f')]({'membername':_0x4fb99b['name'],'UserId':_0x4fb99b['id'],'queue_name':_0x4d6b2c[_0x4157('0x3b')],'VoiceQueueId':_0x4d6b2c['id'],'interface':_[_0x4157('0x82')](_0x4fb99b[_0x4157('0x83')])?util[_0x4157('0x84')](_0x4157('0x85'),_0x4fb99b[_0x4157('0x3b')]):_0x4fb99b[_0x4157('0x83')],'paused':_0x4fb99b[_0x4157('0x77')]||![],'penalty':_0x4fb99b[_0x4157('0x7a')]},{'transaction':_0x5247d6});});})['then'](function(){_0x451769[_0x4157('0x79')](function(_0x31d01b){socket[_0x4157('0x86')]('userVoiceQueue:save',{'UserId':_0x31d01b['id'],'VoiceQueueId':_0x4d6b2c['id']});});});});});}})[_0x4157('0x2c')](respondWithStatusCode(_0x269f17,null))['catch'](handleError(_0x269f17,null));};exports[_0x4157('0x87')]=function(_0x2afbe2,_0x2c91af,_0x109b27){return db[_0x4157('0x71')][_0x4157('0x52')]({'where':{'id':_0x2afbe2[_0x4157('0x43')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4157('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2c91af,null))[_0x4157('0x2c')](function(_0x33254f){var _0x39e8b5=_[_0x4157('0x34')](_0x33254f,'id');var _0xb7068d=[];var _0x1e8d59=[];var _0x542a57=squel[_0x4157('0x88')]();_0x542a57['field']('tq.TeamId')['from'](_0x4157('0x89'),'tq')[_0x4157('0x8a')](_0x4157('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4157('0x4d')]('VoiceQueueId\x20=\x20?',_0x2afbe2['params']['id']);for(var _0x43a4b5=0x0;_0x43a4b5<_0x33254f[_0x4157('0x48')];_0x43a4b5+=0x1){let _0x5383a2=_0x33254f[_0x43a4b5];for(var _0x54a670=0x0;_0x54a670<_0x5383a2[_0x4157('0x75')][_0x4157('0x48')];_0x54a670+=0x1){let _0x2cde41=_0x5383a2[_0x4157('0x75')][_0x54a670];var _0x3fe0d7=_0x542a57[_0x4157('0x60')]();_0x3fe0d7[_0x4157('0x4d')](_0x4157('0x8c'),_0x2cde41['id']);_0x1e8d59['push'](db[_0x4157('0x7b')]['query'](_0x3fe0d7['toString'](),{'type':db[_0x4157('0x7b')][_0x4157('0x8d')][_0x4157('0x8e')]})[_0x4157('0x2c')](function(_0x4f79d5){if(_0x4f79d5['length']===0x1){return _0x2cde41['id'];}else{var _0x4ea919=_[_0x4157('0x8f')](_[_0x4157('0x34')](_0x4f79d5,'TeamId'),function(_0x146e7d){return _[_0x4157('0x36')](_0x39e8b5,_0x146e7d);});if(_0x4ea919){return _0x2cde41['id'];}}}));}}return BPromise['all'](_0x1e8d59)[_0x4157('0x2c')](function(_0x317630){_0xb7068d=_(_0xb7068d)[_0x4157('0x90')](_0x317630)[_0x4157('0x91')]()[_0x4157('0x35')]();return db[_0x4157('0x3d')][_0x4157('0x38')]({'where':{'id':_0x2afbe2['params']['id']}})['then'](function(_0x546ba9){return db[_0x4157('0x7b')]['transaction'](function(_0x5e61f8){return _0x546ba9[_0x4157('0x87')](_0x2afbe2[_0x4157('0x43')]['ids'],{'transaction':_0x5e61f8})[_0x4157('0x2c')](function(){if(!_[_0x4157('0x92')](_0xb7068d)){return _0x546ba9['removeAgents'](_0xb7068d,{'transaction':_0x5e61f8})[_0x4157('0x2c')](function(){return db[_0x4157('0x81')][_0x4157('0x2d')]({'where':{'VoiceQueueId':_0x2afbe2['params']['id'],'UserId':_0xb7068d},'transaction':_0x5e61f8});});}})[_0x4157('0x2c')](function(){_0xb7068d[_0x4157('0x79')](function(_0x1e4a49){socket[_0x4157('0x86')](_0x4157('0x93'),{'UserId':_0x1e4a49,'VoiceQueueId':_0x546ba9['id']});});});});});});})[_0x4157('0x2c')](respondWithStatusCode(_0x2c91af,null))[_0x4157('0x54')](handleError(_0x2c91af,null));};exports['addAgents']=function(_0xe331a7,_0x53f3bf,_0x50ecd1){var _0x35ba64,_0x48489f;return db[_0x4157('0x3d')][_0x4157('0x38')]({'where':{'id':_0xe331a7[_0x4157('0x56')]['id']}})['then'](handleEntityNotFound(_0x53f3bf,null))[_0x4157('0x2c')](function(_0x3a2533){if(_0x3a2533){_0x48489f=_0x3a2533;return _0x3a2533[_0x4157('0x94')](_0xe331a7[_0x4157('0x5a')]['ids'],_['omit'](_0xe331a7[_0x4157('0x5a')],[_0x4157('0x95'),'id'])||{})['spread'](function(_0x4f4bc3){for(var _0x1fbce8=0x0;_0x1fbce8<_0xe331a7[_0x4157('0x5a')][_0x4157('0x95')]['length'];_0x1fbce8+=0x1){socket[_0x4157('0x86')](_0x4157('0x96'),{'UserId':Number(_0xe331a7['body'][_0x4157('0x95')][_0x1fbce8]),'VoiceQueueId':Number(_0xe331a7['params']['id'])});}return _0x4f4bc3;});}})[_0x4157('0x2c')](function(_0x1e477a){_0x35ba64=_0x1e477a||[];if(_0x48489f){return db[_0x4157('0x74')][_0x4157('0x52')]({'where':{'id':_0xe331a7['body']['ids']},'attributes':['id',_0x4157('0x3b'),_0x4157('0x76'),_0x4157('0x77'),_0x4157('0x83')],'raw':!![]});}})[_0x4157('0x2c')](function(_0x3d3b48){if(!_['isEmpty'](_0x3d3b48)){var _0x2fe807=[];for(var _0x57b743=0x0;_0x57b743<_0x3d3b48[_0x4157('0x48')];_0x57b743++){if(_0x3d3b48[_0x57b743][_0x4157('0x76')]){_0x2fe807['push'](db[_0x4157('0x81')]['upsert']({'membername':_0x3d3b48[_0x57b743][_0x4157('0x3b')],'UserId':_0x3d3b48[_0x57b743]['id'],'queue_name':_0x48489f['name'],'VoiceQueueId':_0x48489f['id'],'interface':_[_0x4157('0x82')](_0x3d3b48[_0x57b743][_0x4157('0x83')])?util[_0x4157('0x84')](_0x4157('0x85'),_0x3d3b48[_0x57b743]['name']):_0x3d3b48[_0x57b743]['interface'],'paused':_0x3d3b48[_0x57b743][_0x4157('0x77')]||![],'penalty':_0xe331a7[_0x4157('0x5a')][_0x4157('0x7a')]||0x0}));}}return BPromise[_0x4157('0x97')](_0x2fe807);}})[_0x4157('0x2c')](function(){return _0x35ba64;})[_0x4157('0x2c')](respondWithResult(_0x53f3bf,null))[_0x4157('0x54')](handleError(_0x53f3bf,null));};exports['removeAgents']=function(_0x3aacfa,_0x227bc0,_0x3cdf59){return db[_0x4157('0x3d')][_0x4157('0x38')]({'where':{'id':_0x3aacfa[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x227bc0,null))[_0x4157('0x2c')](function(_0x2f22e2){if(_0x2f22e2){return _0x2f22e2[_0x4157('0x98')](_0x3aacfa[_0x4157('0x43')][_0x4157('0x95')])['then'](function(){if(_[_0x4157('0x99')](_0x3aacfa[_0x4157('0x43')]['ids'])){for(var _0x48ad7c=0x0;_0x48ad7c<_0x3aacfa[_0x4157('0x43')]['ids']['length'];_0x48ad7c+=0x1){socket[_0x4157('0x86')](_0x4157('0x93'),{'UserId':Number(_0x3aacfa[_0x4157('0x43')]['ids'][_0x48ad7c]),'VoiceQueueId':Number(_0x3aacfa[_0x4157('0x56')]['id'])});}}else{socket[_0x4157('0x86')](_0x4157('0x93'),{'UserId':Number(_0x3aacfa['query']['ids']),'VoiceQueueId':Number(_0x3aacfa[_0x4157('0x56')]['id'])});}});}})[_0x4157('0x2c')](function(_0x224d44){return db[_0x4157('0x81')]['destroy']({'where':{'VoiceQueueId':_0x3aacfa[_0x4157('0x56')]['id'],'UserId':_0x3aacfa[_0x4157('0x43')][_0x4157('0x95')]}})[_0x4157('0x2c')](function(){return _0x224d44;});})['then'](respondWithStatusCode(_0x227bc0,null))[_0x4157('0x54')](handleError(_0x227bc0,null));};exports[_0x4157('0x9a')]=function(_0x5391b9,_0x421c81,_0x366c80){var _0x80c882={};var _0x490394={};var _0x553c2d;var _0x1398e8;return db[_0x4157('0x3d')]['findOne']({'where':{'id':_0x5391b9[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x421c81,null))[_0x4157('0x2c')](function(_0x29c08d){if(_0x29c08d){_0x553c2d=_0x29c08d;_0x490394[_0x4157('0x41')]=_['keys'](db[_0x4157('0x74')][_0x4157('0x3e')]);_0x490394['query']=_[_0x4157('0x42')](_0x5391b9[_0x4157('0x43')]);_0x490394['filters']=_['intersection'](_0x490394['model'],_0x490394[_0x4157('0x43')]);_0x80c882[_0x4157('0x46')]=_[_0x4157('0x45')](_0x490394['model'],qs['fields'](_0x5391b9[_0x4157('0x43')]['fields']));_0x80c882['attributes']=_0x80c882[_0x4157('0x46')][_0x4157('0x48')]?_0x80c882['attributes']:_0x490394[_0x4157('0x41')];_0x80c882[_0x4157('0x4b')]=qs[_0x4157('0x4c')](_0x5391b9[_0x4157('0x43')][_0x4157('0x4c')]);_0x80c882['where']=qs[_0x4157('0x44')](_[_0x4157('0x4e')](_0x5391b9[_0x4157('0x43')],_0x490394[_0x4157('0x44')]));if(_0x5391b9['query'][_0x4157('0x32')]){_0x80c882['where']=_[_0x4157('0x4f')](_0x80c882[_0x4157('0x4d')],{'$or':_['map'](_0x80c882[_0x4157('0x46')],function(_0x5a6f4a){var _0x14b868={};_0x14b868[_0x5a6f4a]={'$like':'%'+_0x5391b9['query'][_0x4157('0x32')]+'%'};return _0x14b868;})});}_0x80c882=_['merge']({},_0x80c882,_0x5391b9[_0x4157('0x58')]);return _0x553c2d[_0x4157('0x9a')](_0x80c882);}})[_0x4157('0x2c')](function(_0x29626d){if(_0x29626d){_0x1398e8=_0x29626d['length'];if(!_0x5391b9[_0x4157('0x43')][_0x4157('0x49')](_0x4157('0x4a'))){_0x80c882['limit']=qs[_0x4157('0x27')](_0x5391b9[_0x4157('0x43')][_0x4157('0x27')]);_0x80c882['offset']=qs['offset'](_0x5391b9['query'][_0x4157('0x25')]);}return _0x553c2d[_0x4157('0x9a')](_0x80c882);}})[_0x4157('0x2c')](function(_0x4a79c2){if(_0x4a79c2){return _0x4a79c2?{'count':_0x1398e8,'rows':_0x4a79c2}:null;}})[_0x4157('0x2c')](respondWithResult(_0x421c81,null))[_0x4157('0x54')](handleError(_0x421c81,null));};exports['getMembers']=function(_0xf8a532,_0x4ede61,_0x433395){var _0x1bf81d={};var _0x5abb1f={};var _0x40bc1d;var _0x1c761a;return db[_0x4157('0x3d')][_0x4157('0x67')]({'where':{'id':_0xf8a532[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x4ede61,null))[_0x4157('0x2c')](function(_0x3c6642){if(_0x3c6642){_0x40bc1d=_0x3c6642;_0x5abb1f[_0x4157('0x41')]=_['keys'](db[_0x4157('0x81')][_0x4157('0x3e')]);_0x5abb1f[_0x4157('0x43')]=_[_0x4157('0x42')](_0xf8a532[_0x4157('0x43')]);_0x5abb1f[_0x4157('0x44')]=_['intersection'](_0x5abb1f[_0x4157('0x41')],_0x5abb1f[_0x4157('0x43')]);_0x1bf81d[_0x4157('0x46')]=_['intersection'](_0x5abb1f[_0x4157('0x41')],qs['fields'](_0xf8a532[_0x4157('0x43')][_0x4157('0x47')]));_0x1bf81d[_0x4157('0x46')]=_0x1bf81d[_0x4157('0x46')][_0x4157('0x48')]?_0x1bf81d['attributes']:_0x5abb1f[_0x4157('0x41')];_0x1bf81d[_0x4157('0x4b')]=qs[_0x4157('0x4c')](_0xf8a532[_0x4157('0x43')][_0x4157('0x4c')]);_0x1bf81d[_0x4157('0x4d')]=qs[_0x4157('0x44')](_[_0x4157('0x4e')](_0xf8a532[_0x4157('0x43')],_0x5abb1f[_0x4157('0x44')]));if(_0xf8a532[_0x4157('0x43')][_0x4157('0x32')]){_0x1bf81d[_0x4157('0x4d')]=_[_0x4157('0x4f')](_0x1bf81d[_0x4157('0x4d')],{'$or':_[_0x4157('0x34')](_0x1bf81d[_0x4157('0x46')],function(_0x153ade){var _0x10da86={};_0x10da86[_0x153ade]={'$like':'%'+_0xf8a532[_0x4157('0x43')]['filter']+'%'};return _0x10da86;})});}_0x1bf81d=_[_0x4157('0x4f')]({},_0x1bf81d,_0xf8a532['options']);return _0x40bc1d['getMembers'](_0x1bf81d);}})[_0x4157('0x2c')](function(_0x32fa63){if(_0x32fa63){_0x1c761a=_0x32fa63['length'];if(!_0xf8a532[_0x4157('0x43')][_0x4157('0x49')](_0x4157('0x4a'))){_0x1bf81d['limit']=qs[_0x4157('0x27')](_0xf8a532[_0x4157('0x43')][_0x4157('0x27')]);_0x1bf81d[_0x4157('0x25')]=qs['offset'](_0xf8a532[_0x4157('0x43')][_0x4157('0x25')]);}return _0x40bc1d[_0x4157('0x9b')](_0x1bf81d);}})[_0x4157('0x2c')](function(_0x43a8bc){return _0x43a8bc?{'count':_0x1c761a,'rows':_0x43a8bc}:null;})['then'](respondWithResult(_0x4ede61,null))['catch'](handleError(_0x4ede61,null));};exports[_0x4157('0x9c')]=function(_0x303a6c,_0x2f46c6,_0x1c4ff6){var _0x1bd128={};var _0x48949a={};var _0x1e954d;var _0xdfaf80;return db['VoiceQueue'][_0x4157('0x67')]({'where':{'id':_0x303a6c[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x2f46c6,null))['then'](function(_0x8310e2){if(_0x8310e2){_0x1e954d=_0x8310e2;_0x48949a[_0x4157('0x41')]=_['keys'](db[_0x4157('0x9d')][_0x4157('0x3e')]);_0x48949a[_0x4157('0x43')]=_[_0x4157('0x42')](_0x303a6c[_0x4157('0x43')]);_0x48949a[_0x4157('0x44')]=_[_0x4157('0x45')](_0x48949a[_0x4157('0x41')],_0x48949a['query']);_0x1bd128['attributes']=_[_0x4157('0x45')](_0x48949a['model'],qs[_0x4157('0x47')](_0x303a6c[_0x4157('0x43')][_0x4157('0x47')]));_0x1bd128['attributes']=_0x1bd128['attributes'][_0x4157('0x48')]?_0x1bd128[_0x4157('0x46')]:_0x48949a[_0x4157('0x41')];_0x1bd128['order']=qs[_0x4157('0x4c')](_0x303a6c[_0x4157('0x43')][_0x4157('0x4c')]);_0x1bd128[_0x4157('0x4d')]=qs['filters'](_['pick'](_0x303a6c[_0x4157('0x43')],_0x48949a['filters']));if(_0x303a6c[_0x4157('0x43')][_0x4157('0x32')]){_0x1bd128['where']=_[_0x4157('0x4f')](_0x1bd128[_0x4157('0x4d')],{'$or':_[_0x4157('0x34')](_0x1bd128[_0x4157('0x46')],function(_0x37e2b5){var _0x2569eb={};_0x2569eb[_0x37e2b5]={'$like':'%'+_0x303a6c[_0x4157('0x43')][_0x4157('0x32')]+'%'};return _0x2569eb;})});}_0x1bd128=_['merge']({},_0x1bd128,_0x303a6c[_0x4157('0x58')]);return _0x1e954d[_0x4157('0x9c')](_0x1bd128);}})[_0x4157('0x2c')](function(_0x5f7472){if(_0x5f7472){_0xdfaf80=_0x5f7472[_0x4157('0x48')];if(!_0x303a6c[_0x4157('0x43')][_0x4157('0x49')]('nolimit')){_0x1bd128[_0x4157('0x27')]=qs[_0x4157('0x27')](_0x303a6c[_0x4157('0x43')]['limit']);_0x1bd128[_0x4157('0x25')]=qs[_0x4157('0x25')](_0x303a6c['query'][_0x4157('0x25')]);}return _0x1e954d[_0x4157('0x9c')](_0x1bd128);}})[_0x4157('0x2c')](function(_0x4601fb){if(_0x4601fb){return _0x4601fb?{'count':_0xdfaf80,'rows':_0x4601fb}:null;}})[_0x4157('0x2c')](respondWithResult(_0x2f46c6,null))[_0x4157('0x54')](handleError(_0x2f46c6,null));};exports[_0x4157('0x9e')]=function(_0x4aa32a,_0x22d085,_0x1ae76a){var _0x7e64a=moment()['format'](_0x4157('0x9f'));var _0x831b75,_0xa06624;return db[_0x4157('0x3d')]['find']({'where':{'id':_0x4aa32a['params']['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x22d085,null))['then'](function(_0x36d9cd){if(_0x36d9cd){_0xa06624=_0x36d9cd;return _0x36d9cd[_0x4157('0x9e')](_0x4aa32a[_0x4157('0x5a')][_0x4157('0x95')],_[_0x4157('0x61')](_0x4aa32a[_0x4157('0x5a')],[_0x4157('0x95'),'id'])||{});}return null;})[_0x4157('0xa0')](function(_0x5676c3){var _0x3c479e;_0x831b75=_0x5676c3||[];var _0x341f4e=[];if(_0x5676c3){for(var _0x45ae06=0x0;_0x45ae06<_0x5676c3[_0x4157('0x48')];_0x45ae06+=0x1){var _0x20c335=_0x5676c3[_0x45ae06][_0x4157('0x2e')]({'plain':!![]});_0xa06624[_0x4157('0xa1')]=_0x4aa32a[_0x4157('0x5a')][_0x4157('0xa1')]?_0x4aa32a['body'][_0x4157('0xa1')]:_0xa06624['dialCheckDuplicateType'];switch(_0xa06624[_0x4157('0xa1')]){case'always':_0x3c479e=squel[_0x4157('0xa2')]()[_0x4157('0xa3')](_0x4157('0xa4'))[_0x4157('0xa5')]([_0x4157('0xa6'),_0x4157('0xa7'),_0x4157('0xa8'),'ListId',_0x4157('0x68'),_0x4157('0x62'),_0x4157('0x63')],squel['select']()['field'](_0x4157('0xa6'),_0x4157('0xa6'))['field']('\x27'+_0x7e64a+'\x27',_0x4157('0xa7'))[_0x4157('0xa9')]('id','ContactId')[_0x4157('0xa9')](_0x20c335[_0x4157('0xaa')][_0x4157('0xab')](),_0x4157('0xac'))['field'](_0x4aa32a[_0x4157('0x56')]['id']['toString'](),_0x4157('0x68'))[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27','createdAt')[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27','updatedAt')[_0x4157('0xad')](_0x4157('0xae'))[_0x4157('0x4d')](_0x4157('0xaf'))[_0x4157('0x4d')](_0x4157('0xb0'),_0x20c335[_0x4157('0xaa')]['toString']())[_0x4157('0x4d')](_0x4157('0xb1'))[_0x4157('0x4d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4157('0x88')]()[_0x4157('0xa9')](_0x4157('0xb2'))[_0x4157('0xad')](_0x4157('0xb3'))[_0x4157('0x4d')](_0x4157('0xb4'),_0x4aa32a[_0x4157('0x56')]['id'][_0x4157('0xab')]()))[_0x4157('0x4d')](_0x4157('0xb5'),squel[_0x4157('0x88')]()[_0x4157('0xa9')](_0x4157('0xb6'))[_0x4157('0xad')](_0x4157('0xa4'))[_0x4157('0x4d')](_0x4157('0xb4'),_0x4aa32a[_0x4157('0x56')]['id'][_0x4157('0xab')]())))['toString']();break;case _0x4157('0xb7'):_0x3c479e=squel['insert']()[_0x4157('0xa3')](_0x4157('0xa4'))[_0x4157('0xa5')]([_0x4157('0xa6'),_0x4157('0xa7'),_0x4157('0xa8'),'ListId',_0x4157('0x68'),_0x4157('0x62'),_0x4157('0x63')],squel[_0x4157('0x88')]()[_0x4157('0xa9')](_0x4157('0xa6'),'phone')[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27',_0x4157('0xa7'))[_0x4157('0xa9')]('id',_0x4157('0xa8'))['field'](_0x20c335['CmListId'][_0x4157('0xab')](),_0x4157('0xac'))[_0x4157('0xa9')](_0x4aa32a['params']['id'][_0x4157('0xab')](),_0x4157('0x68'))[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27','createdAt')[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27',_0x4157('0x63'))[_0x4157('0xad')](_0x4157('0xae'))[_0x4157('0x4d')](_0x4157('0xaf'))[_0x4157('0x4d')](_0x4157('0xb0'),_0x20c335[_0x4157('0xaa')]['toString']())[_0x4157('0x4d')](_0x4157('0xb1'))[_0x4157('0x4d')](_0x4157('0xb5'),squel[_0x4157('0x88')]()[_0x4157('0xa9')](_0x4157('0xb6'))[_0x4157('0xad')](_0x4157('0xa4'))['where']('VoiceQueueId\x20=\x20?',_0x4aa32a[_0x4157('0x56')]['id'][_0x4157('0xab')]())))[_0x4157('0xab')]();break;default:_0x3c479e=squel[_0x4157('0xa2')]()[_0x4157('0xa3')]('cm_hopper')[_0x4157('0xa5')]([_0x4157('0xa6'),_0x4157('0xa7'),_0x4157('0xa8'),_0x4157('0xac'),'VoiceQueueId','createdAt',_0x4157('0x63')],squel[_0x4157('0x88')]()[_0x4157('0xa9')](_0x4157('0xa6'),_0x4157('0xa6'))[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27',_0x4157('0xa7'))[_0x4157('0xa9')]('id','ContactId')[_0x4157('0xa9')](_0x20c335[_0x4157('0xaa')][_0x4157('0xab')](),_0x4157('0xac'))[_0x4157('0xa9')](_0x4aa32a[_0x4157('0x56')]['id']['toString'](),_0x4157('0x68'))[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27',_0x4157('0x62'))[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27','updatedAt')['from'](_0x4157('0xae'))[_0x4157('0x4d')]('deletedAt\x20IS\x20NULL')[_0x4157('0x4d')](_0x4157('0xb0'),_0x20c335[_0x4157('0xaa')]['toString']())[_0x4157('0x4d')](_0x4157('0xb1')))['toString']();}_0x341f4e[_0x4157('0xb8')](db['sequelize'][_0x4157('0x43')](_0x3c479e));}return BPromise[_0x4157('0x97')](_0x341f4e);}})[_0x4157('0x2c')](function(){var _0x257ad3=[];var _0x23a155=squel[_0x4157('0xa2')]()[_0x4157('0xa3')](_0x4157('0xb9'))['fromQuery']([_0x4157('0xba'),_0x4157('0xa6'),_0x4157('0xbb'),'createdAt',_0x4157('0x63')],squel[_0x4157('0x88')]()['field'](_0x4157('0xbc'))[_0x4157('0xa9')](_0x4157('0xbd'))['field']('ci.OrderBy+1')[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27',_0x4157('0x62'))[_0x4157('0xa9')]('\x27'+_0x7e64a+'\x27',_0x4157('0x63'))[_0x4157('0xad')]('cm_contact_has_items','ci')[_0x4157('0x8a')](_0x4157('0xa4'),'h',_0x4157('0xbe'))['where'](_0x4157('0xbf'),_0x7e64a)[_0x4157('0x4d')](_0x4157('0xc0'),'PHONE'))[_0x4157('0xab')]();_0x257ad3[_0x4157('0xb8')](db[_0x4157('0x7b')]['query'](_0x23a155));return BPromise[_0x4157('0x97')](_0x257ad3);})['then'](function(){return _0x831b75;})['then'](respondWithResult(_0x22d085,null))[_0x4157('0x54')](handleError(_0x22d085,null));};exports[_0x4157('0xc1')]=function(_0x299662,_0x28edcd,_0x199aae){return db['VoiceQueue'][_0x4157('0x38')]({'where':{'id':_0x299662['params']['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x28edcd,null))[_0x4157('0x2c')](function(_0xadadb6){if(_0xadadb6){return _0xadadb6['removeLists'](_0x299662[_0x4157('0x43')][_0x4157('0x95')]);}})[_0x4157('0x2c')](function(_0x11ab33){if(_0x11ab33){return db['CmHopper'][_0x4157('0x2d')]({'where':{'ListId':_0x299662[_0x4157('0x43')][_0x4157('0x95')],'VoiceQueueId':_0x299662[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](function(){return _0x11ab33;});}})[_0x4157('0x2c')](respondWithStatusCode(_0x28edcd,null))[_0x4157('0x54')](handleError(_0x28edcd,null));};exports[_0x4157('0xc2')]=function(_0x416a74,_0xb0f5e2,_0x2d268c){var _0x43b041={};var _0x1360eb={};var _0x55f589;var _0x27cd37;return db[_0x4157('0x3d')]['findOne']({'where':{'id':_0x416a74[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0xb0f5e2,null))[_0x4157('0x2c')](function(_0x3c31fc){if(_0x3c31fc){_0x55f589=_0x3c31fc;_0x1360eb[_0x4157('0x41')]=_['keys'](db['CmList']['rawAttributes']);_0x1360eb[_0x4157('0x43')]=_[_0x4157('0x42')](_0x416a74[_0x4157('0x43')]);_0x1360eb[_0x4157('0x44')]=_[_0x4157('0x45')](_0x1360eb[_0x4157('0x41')],_0x1360eb[_0x4157('0x43')]);_0x43b041[_0x4157('0x46')]=_[_0x4157('0x45')](_0x1360eb[_0x4157('0x41')],qs[_0x4157('0x47')](_0x416a74[_0x4157('0x43')]['fields']));_0x43b041[_0x4157('0x46')]=_0x43b041[_0x4157('0x46')]['length']?_0x43b041['attributes']:_0x1360eb[_0x4157('0x41')];_0x43b041[_0x4157('0x4b')]=qs['sort'](_0x416a74[_0x4157('0x43')][_0x4157('0x4c')]);_0x43b041[_0x4157('0x4d')]=qs['filters'](_['pick'](_0x416a74[_0x4157('0x43')],_0x1360eb['filters']));if(_0x416a74[_0x4157('0x43')][_0x4157('0x32')]){_0x43b041['where']=_[_0x4157('0x4f')](_0x43b041[_0x4157('0x4d')],{'$or':_[_0x4157('0x34')](_0x43b041['attributes'],function(_0x3cadb5){var _0x4f7f65={};_0x4f7f65[_0x3cadb5]={'$like':'%'+_0x416a74[_0x4157('0x43')][_0x4157('0x32')]+'%'};return _0x4f7f65;})});}_0x43b041=_[_0x4157('0x4f')]({},_0x43b041,_0x416a74['options']);return _0x55f589['getBlackLists'](_0x43b041);}})['then'](function(_0x593a85){if(_0x593a85){_0x27cd37=_0x593a85[_0x4157('0x48')];if(!_0x416a74[_0x4157('0x43')][_0x4157('0x49')](_0x4157('0x4a'))){_0x43b041[_0x4157('0x27')]=qs['limit'](_0x416a74[_0x4157('0x43')]['limit']);_0x43b041[_0x4157('0x25')]=qs[_0x4157('0x25')](_0x416a74[_0x4157('0x43')][_0x4157('0x25')]);}return _0x55f589[_0x4157('0xc2')](_0x43b041);}})['then'](function(_0x375883){if(_0x375883){return _0x375883?{'count':_0x27cd37,'rows':_0x375883}:null;}})[_0x4157('0x2c')](respondWithResult(_0xb0f5e2,null))['catch'](handleError(_0xb0f5e2,null));};exports[_0x4157('0xc3')]=function(_0x567e17,_0x3c20cd,_0x617851){var _0x10f991,_0x137eed;return db['VoiceQueue'][_0x4157('0x38')]({'where':{'id':_0x567e17[_0x4157('0x56')]['id']}})['then'](handleEntityNotFound(_0x3c20cd,null))['then'](function(_0x1958d0){if(_0x1958d0){_0x137eed=_0x1958d0;return _0x1958d0[_0x4157('0xc3')](_0x567e17[_0x4157('0x5a')][_0x4157('0x95')],_[_0x4157('0x61')](_0x567e17[_0x4157('0x5a')],[_0x4157('0x95'),'id'])||{});}return null;})[_0x4157('0xa0')](function(_0x2edc4e){var _0x167968;_0x10f991=_0x2edc4e||[];var _0x3fbaa8=[];if(_0x2edc4e){for(var _0x454f53=0x0;_0x454f53<_0x2edc4e[_0x4157('0x48')];_0x454f53+=0x1){var _0x2b4a72=_0x2edc4e[_0x454f53][_0x4157('0x2e')]({'plain':!![]});_0x167968=squel[_0x4157('0xa2')]()['into'](_0x4157('0xc4'))[_0x4157('0xa5')](['phone',_0x4157('0xa8'),_0x4157('0xac'),_0x4157('0x68'),_0x4157('0x62'),_0x4157('0x63')],squel[_0x4157('0x88')]()[_0x4157('0xa9')](_0x4157('0xa6'),_0x4157('0xa6'))[_0x4157('0xa9')]('id','ContactId')[_0x4157('0xa9')](_0x2b4a72[_0x4157('0xaa')][_0x4157('0xab')](),_0x4157('0xac'))[_0x4157('0xa9')](_0x567e17[_0x4157('0x56')]['id']['toString'](),_0x4157('0x68'))[_0x4157('0xa9')](_0x4157('0xc5'),_0x4157('0x62'))['field']('NOW()',_0x4157('0x63'))['from'](_0x4157('0xae'))['where'](_0x4157('0xaf'))[_0x4157('0x4d')](_0x4157('0xb0'),_0x2b4a72[_0x4157('0xaa')][_0x4157('0xab')]())[_0x4157('0x4d')](_0x4157('0xb1')))['toString']();_0x3fbaa8[_0x4157('0xb8')](db[_0x4157('0x7b')]['query'](_0x167968));}return BPromise[_0x4157('0x97')](_0x3fbaa8);}})[_0x4157('0x2c')](function(){return _0x10f991;})['then'](respondWithResult(_0x3c20cd,null))[_0x4157('0x54')](handleError(_0x3c20cd,null));};exports[_0x4157('0xc6')]=function(_0x2c1bc3,_0x328aa4,_0x3baab1){return db[_0x4157('0x3d')][_0x4157('0x38')]({'where':{'id':_0x2c1bc3['params']['id']}})[_0x4157('0x2c')](handleEntityNotFound(_0x328aa4,null))[_0x4157('0x2c')](function(_0x442e9b){if(_0x442e9b){return _0x442e9b[_0x4157('0xc6')](_0x2c1bc3[_0x4157('0x43')]['ids']);}})[_0x4157('0x2c')](function(_0x5f2cac){if(_0x5f2cac){return db['CmHopperBlack'][_0x4157('0x2d')]({'where':{'ListId':_0x2c1bc3[_0x4157('0x43')][_0x4157('0x95')],'VoiceQueueId':_0x2c1bc3[_0x4157('0x56')]['id']}})[_0x4157('0x2c')](function(){return _0x5f2cac;});}})['then'](respondWithStatusCode(_0x328aa4,null))[_0x4157('0x54')](handleError(_0x328aa4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 17fd230..67c9ebc 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 _0x52c8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','VoiceQueue'];(function(_0x372968,_0x36b90e){var _0x1f5a48=function(_0x4e9e21){while(--_0x4e9e21){_0x372968['push'](_0x372968['shift']());}};_0x1f5a48(++_0x36b90e);}(_0x52c8,0x9f));var _0x852c=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0x52c8[_0x46111d];return _0xe82586;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x852c('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x852c('0x1')](0x0);var events={'afterCreate':_0x852c('0x2'),'afterUpdate':_0x852c('0x3'),'afterDestroy':_0x852c('0x4')};function emitEvent(_0x39ea81){return function(_0x45ed96,_0x5f4356,_0x549cf4){VoiceQueueEvents['emit'](_0x39ea81+':'+_0x45ed96['id'],_0x45ed96);VoiceQueueEvents[_0x852c('0x5')](_0x39ea81,_0x45ed96);_0x549cf4(null);};}for(var e in events){if(events[_0x852c('0x6')](e)){var event=events[e];VoiceQueue[_0x852c('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x087a=['save','remove','emit','hasOwnProperty','exports','events','VoiceQueue'];(function(_0x5dfd07,_0x11f42e){var _0x10cd46=function(_0x16b929){while(--_0x16b929){_0x5dfd07['push'](_0x5dfd07['shift']());}};_0x10cd46(++_0x11f42e);}(_0x087a,0x1ef));var _0xa087=function(_0x2211e3,_0x2657c9){_0x2211e3=_0x2211e3-0x0;var _0x2af676=_0x087a[_0x2211e3];return _0x2af676;};'use strict';var EventEmitter=require(_0xa087('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xa087('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa087('0x2'),'afterUpdate':'update','afterDestroy':_0xa087('0x3')};function emitEvent(_0x26dc83){return function(_0x58d8c6,_0x59ac20,_0x234de2){VoiceQueueEvents[_0xa087('0x4')](_0x26dc83+':'+_0x58d8c6['id'],_0x58d8c6);VoiceQueueEvents[_0xa087('0x4')](_0x26dc83,_0x58d8c6);_0x234de2(null);};}for(var e in events){if(events[_0xa087('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa087('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 9bf0cc8..b524a5a 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x27a84f,_0x16ad54){var _0xf6c75a=function(_0x30ca38){while(--_0x30ca38){_0x27a84f['push'](_0x27a84f['shift']());}};_0xf6c75a(++_0x16ad54);}(_0x34e8,0x12c));var _0x834e=function(_0x4e7d03,_0x1cabec){_0x4e7d03=_0x4e7d03-0x0;var _0x2ca59f=_0x34e8[_0x4e7d03];return _0x2ca59f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xb21393,_0x23278f){var _0x5770ef=function(_0x38e2c2){while(--_0x38e2c2){_0xb21393['push'](_0xb21393['shift']());}};_0x5770ef(++_0x23278f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 808ea50..260352b 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 _0x995c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','model','map','debug','ShowVoiceQueue','find','lodash','moment','bluebird'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x995c,0x183));var _0xc995=function(_0x291cff,_0x9077a8){_0x291cff=_0x291cff-0x0;var _0xfdb50b=_0x995c[_0x291cff];return _0xfdb50b;};'use strict';var _=require(_0xc995('0x0'));var util=require('util');var moment=require(_0xc995('0x1'));var BPromise=require(_0xc995('0x2'));var rs=require(_0xc995('0x3'));var fs=require('fs');var Redis=require(_0xc995('0x4'));var db=require(_0xc995('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc995('0x6'))(_0xc995('0x7'));var config=require(_0xc995('0x8'));var jayson=require(_0xc995('0x9'));var client=jayson['client'][_0xc995('0xa')]({'port':0x232a});config[_0xc995('0xb')]=_[_0xc995('0xc')](config[_0xc995('0xb')],{'host':_0xc995('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc995('0xb')]));require(_0xc995('0xe'))[_0xc995('0xf')](socket);function respondWithRpcPromise(_0x539b40,_0x535511,_0x14e53f){return new BPromise(function(_0x5031d9,_0x2e68b7){return client['request'](_0x539b40,_0x14e53f)[_0xc995('0x10')](function(_0xc82fd0){logger[_0xc995('0x11')](_0xc995('0x12'),_0x535511,'request\x20sent');logger['debug'](_0xc995('0x13'),_0x535511,_0xc995('0x14'),JSON[_0xc995('0x15')](_0xc82fd0));if(_0xc82fd0[_0xc995('0x16')]){if(_0xc82fd0[_0xc995('0x16')][_0xc995('0x17')]===0x1f4){logger[_0xc995('0x16')](_0xc995('0x12'),_0x535511,_0xc82fd0[_0xc995('0x16')]['message']);return _0x2e68b7(_0xc82fd0[_0xc995('0x16')][_0xc995('0x18')]);}logger['error'](_0xc995('0x12'),_0x535511,_0xc82fd0[_0xc995('0x16')][_0xc995('0x18')]);return _0x5031d9(_0xc82fd0[_0xc995('0x16')][_0xc995('0x18')]);}else{logger[_0xc995('0x11')](_0xc995('0x12'),_0x535511,_0xc995('0x14'));_0x5031d9(_0xc82fd0['result']['message']);}})[_0xc995('0x19')](function(_0x1b4b43){logger[_0xc995('0x16')](_0xc995('0x12'),_0x535511,_0x1b4b43);_0x2e68b7(_0x1b4b43);});});}exports[_0xc995('0x1a')]=function(_0x131fa4){var _0x1a3967=this;return new Promise(function(_0x3e3466,_0x3e9454){return db[_0xc995('0x1b')]['findAll']({'raw':_0x131fa4[_0xc995('0x1c')]?_0x131fa4[_0xc995('0x1c')][_0xc995('0x1d')]===undefined?!![]:![]:!![],'where':_0x131fa4[_0xc995('0x1c')]?_0x131fa4[_0xc995('0x1c')][_0xc995('0x1e')]||null:null,'attributes':_0x131fa4[_0xc995('0x1c')]?_0x131fa4['options'][_0xc995('0x1f')]||null:null,'limit':_0x131fa4[_0xc995('0x1c')]?_0x131fa4[_0xc995('0x1c')][_0xc995('0x20')]||null:null,'include':_0x131fa4[_0xc995('0x1c')]?_0x131fa4[_0xc995('0x1c')][_0xc995('0x21')]?_['map'](_0x131fa4[_0xc995('0x1c')][_0xc995('0x21')],function(_0x13ace5){return{'model':db[_0x13ace5[_0xc995('0x22')]],'as':_0x13ace5['as'],'attributes':_0x13ace5[_0xc995('0x1f')],'include':_0x13ace5[_0xc995('0x21')]?_[_0xc995('0x23')](_0x13ace5[_0xc995('0x21')],function(_0x3b9f4f){return{'model':db[_0x3b9f4f[_0xc995('0x22')]],'as':_0x3b9f4f['as'],'attributes':_0x3b9f4f['attributes'],'include':_0x3b9f4f[_0xc995('0x21')]?_[_0xc995('0x23')](_0x3b9f4f[_0xc995('0x21')],function(_0x177cff){return{'model':db[_0x177cff[_0xc995('0x22')]],'as':_0x177cff['as'],'attributes':_0x177cff[_0xc995('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc995('0x10')](function(_0x4bbd6a){logger[_0xc995('0x11')](_0xc995('0x1a'),_0x131fa4);logger[_0xc995('0x24')](_0xc995('0x1a'),_0x131fa4,JSON[_0xc995('0x15')](_0x4bbd6a));_0x3e3466(_0x4bbd6a);})['catch'](function(_0x2a3f2e){logger[_0xc995('0x16')](_0xc995('0x1a'),_0x2a3f2e[_0xc995('0x18')],_0x131fa4);_0x3e9454(_0x1a3967[_0xc995('0x16')](0x1f4,_0x2a3f2e[_0xc995('0x18')]));});});};exports[_0xc995('0x25')]=function(_0x576c17){var _0x90fbc9=this;return new Promise(function(_0x3bbcba,_0x4d9482){return db[_0xc995('0x1b')][_0xc995('0x26')]({'raw':_0x576c17['options']?_0x576c17[_0xc995('0x1c')][_0xc995('0x1d')]===undefined?!![]:![]:!![],'where':_0x576c17['options']?_0x576c17[_0xc995('0x1c')][_0xc995('0x1e')]||null:null,'attributes':_0x576c17[_0xc995('0x1c')]?_0x576c17[_0xc995('0x1c')][_0xc995('0x1f')]||null:null,'include':_0x576c17[_0xc995('0x1c')]?_0x576c17[_0xc995('0x1c')]['include']?_['map'](_0x576c17[_0xc995('0x1c')][_0xc995('0x21')],function(_0xa6b2dc){return{'model':db[_0xa6b2dc[_0xc995('0x22')]],'as':_0xa6b2dc['as'],'attributes':_0xa6b2dc[_0xc995('0x1f')],'include':_0xa6b2dc['include']?_[_0xc995('0x23')](_0xa6b2dc[_0xc995('0x21')],function(_0x350022){return{'model':db[_0x350022[_0xc995('0x22')]],'as':_0x350022['as'],'attributes':_0x350022[_0xc995('0x1f')],'include':_0x350022['include']?_[_0xc995('0x23')](_0x350022[_0xc995('0x21')],function(_0x22d12f){return{'model':db[_0x22d12f[_0xc995('0x22')]],'as':_0x22d12f['as'],'attributes':_0x22d12f[_0xc995('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc995('0x10')](function(_0x29c160){logger[_0xc995('0x11')](_0xc995('0x25'),_0x576c17);logger['debug'](_0xc995('0x25'),_0x576c17,JSON[_0xc995('0x15')](_0x29c160));_0x3bbcba(_0x29c160);})['catch'](function(_0x27a2ad){logger['error'](_0xc995('0x25'),_0x27a2ad['message'],_0x576c17);_0x4d9482(_0x90fbc9['error'](0x1f4,_0x27a2ad['message']));});});}; \ No newline at end of file +var _0x545f=['message','info','catch','GetVoiceQueue','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d8b8e,_0x1fdfb2){var _0xb080cc=function(_0x57e6ae){while(--_0x57e6ae){_0x4d8b8e['push'](_0x4d8b8e['shift']());}};_0xb080cc(++_0x1fdfb2);}(_0x545f,0x1a9));var _0xf545=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x545f[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0xf545('0x0'));var util=require(_0xf545('0x1'));var moment=require('moment');var BPromise=require(_0xf545('0x2'));var rs=require(_0xf545('0x3'));var fs=require('fs');var Redis=require(_0xf545('0x4'));var db=require(_0xf545('0x5'))['db'];var utils=require(_0xf545('0x6'));var logger=require(_0xf545('0x7'))(_0xf545('0x8'));var config=require(_0xf545('0x9'));var jayson=require(_0xf545('0xa'));var client=jayson[_0xf545('0xb')][_0xf545('0xc')]({'port':0x232a});config[_0xf545('0xd')]=_[_0xf545('0xe')](config[_0xf545('0xd')],{'host':_0xf545('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf545('0xd')]));require(_0xf545('0x10'))[_0xf545('0x11')](socket);function respondWithRpcPromise(_0x83309f,_0x5d208e,_0x48bb7d){return new BPromise(function(_0x146dff,_0x3dddd2){return client['request'](_0x83309f,_0x48bb7d)[_0xf545('0x12')](function(_0x5e9433){logger['info'](_0xf545('0x13'),_0x5d208e,_0xf545('0x14'));logger[_0xf545('0x15')](_0xf545('0x16'),_0x5d208e,_0xf545('0x14'),JSON[_0xf545('0x17')](_0x5e9433));if(_0x5e9433[_0xf545('0x18')]){if(_0x5e9433[_0xf545('0x18')][_0xf545('0x19')]===0x1f4){logger[_0xf545('0x18')](_0xf545('0x13'),_0x5d208e,_0x5e9433['error']['message']);return _0x3dddd2(_0x5e9433[_0xf545('0x18')][_0xf545('0x1a')]);}logger[_0xf545('0x18')](_0xf545('0x13'),_0x5d208e,_0x5e9433[_0xf545('0x18')]['message']);return _0x146dff(_0x5e9433[_0xf545('0x18')][_0xf545('0x1a')]);}else{logger[_0xf545('0x1b')](_0xf545('0x13'),_0x5d208e,_0xf545('0x14'));_0x146dff(_0x5e9433['result'][_0xf545('0x1a')]);}})[_0xf545('0x1c')](function(_0xdcc22b){logger[_0xf545('0x18')](_0xf545('0x13'),_0x5d208e,_0xdcc22b);_0x3dddd2(_0xdcc22b);});});}exports[_0xf545('0x1d')]=function(_0x1253b4){var _0x38c972=this;return new Promise(function(_0x21179f,_0x43e60d){return db['VoiceQueue']['findAll']({'raw':_0x1253b4[_0xf545('0x1e')]?_0x1253b4[_0xf545('0x1e')][_0xf545('0x1f')]===undefined?!![]:![]:!![],'where':_0x1253b4['options']?_0x1253b4[_0xf545('0x1e')][_0xf545('0x20')]||null:null,'attributes':_0x1253b4[_0xf545('0x1e')]?_0x1253b4['options'][_0xf545('0x21')]||null:null,'limit':_0x1253b4[_0xf545('0x1e')]?_0x1253b4[_0xf545('0x1e')][_0xf545('0x22')]||null:null,'include':_0x1253b4[_0xf545('0x1e')]?_0x1253b4[_0xf545('0x1e')][_0xf545('0x23')]?_[_0xf545('0x24')](_0x1253b4[_0xf545('0x1e')][_0xf545('0x23')],function(_0x369930){return{'model':db[_0x369930['model']],'as':_0x369930['as'],'attributes':_0x369930[_0xf545('0x21')],'include':_0x369930[_0xf545('0x23')]?_[_0xf545('0x24')](_0x369930[_0xf545('0x23')],function(_0x2b001e){return{'model':db[_0x2b001e['model']],'as':_0x2b001e['as'],'attributes':_0x2b001e['attributes'],'include':_0x2b001e[_0xf545('0x23')]?_['map'](_0x2b001e[_0xf545('0x23')],function(_0x295df8){return{'model':db[_0x295df8[_0xf545('0x25')]],'as':_0x295df8['as'],'attributes':_0x295df8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27ba0b){logger[_0xf545('0x1b')]('GetVoiceQueue',_0x1253b4);logger[_0xf545('0x15')](_0xf545('0x1d'),_0x1253b4,JSON[_0xf545('0x17')](_0x27ba0b));_0x21179f(_0x27ba0b);})[_0xf545('0x1c')](function(_0x10003d){logger[_0xf545('0x18')]('GetVoiceQueue',_0x10003d['message'],_0x1253b4);_0x43e60d(_0x38c972['error'](0x1f4,_0x10003d['message']));});});};exports[_0xf545('0x26')]=function(_0x102526){var _0xa84ca1=this;return new Promise(function(_0x5d97b9,_0x153e99){return db[_0xf545('0x27')][_0xf545('0x28')]({'raw':_0x102526[_0xf545('0x1e')]?_0x102526['options'][_0xf545('0x1f')]===undefined?!![]:![]:!![],'where':_0x102526['options']?_0x102526['options']['where']||null:null,'attributes':_0x102526['options']?_0x102526[_0xf545('0x1e')]['attributes']||null:null,'include':_0x102526['options']?_0x102526[_0xf545('0x1e')][_0xf545('0x23')]?_[_0xf545('0x24')](_0x102526[_0xf545('0x1e')][_0xf545('0x23')],function(_0xa9b23b){return{'model':db[_0xa9b23b[_0xf545('0x25')]],'as':_0xa9b23b['as'],'attributes':_0xa9b23b[_0xf545('0x21')],'include':_0xa9b23b['include']?_[_0xf545('0x24')](_0xa9b23b['include'],function(_0x31c6e5){return{'model':db[_0x31c6e5[_0xf545('0x25')]],'as':_0x31c6e5['as'],'attributes':_0x31c6e5[_0xf545('0x21')],'include':_0x31c6e5[_0xf545('0x23')]?_[_0xf545('0x24')](_0x31c6e5[_0xf545('0x23')],function(_0x33870c){return{'model':db[_0x33870c[_0xf545('0x25')]],'as':_0x33870c['as'],'attributes':_0x33870c[_0xf545('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf545('0x12')](function(_0x231fd8){logger['info'](_0xf545('0x26'),_0x102526);logger[_0xf545('0x15')](_0xf545('0x26'),_0x102526,JSON[_0xf545('0x17')](_0x231fd8));_0x5d97b9(_0x231fd8);})['catch'](function(_0x21436e){logger[_0xf545('0x18')]('ShowVoiceQueue',_0x21436e[_0xf545('0x1a')],_0x102526);_0x153e99(_0xa84ca1[_0xf545('0x18')](0x1f4,_0x21436e[_0xf545('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index e78b506..62163e0 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 _0xf1ca=['save','remove','emit','removeListener','register','voiceQueue:','./voiceQueue.events'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xf1ca,0xa0));var _0xaf1c=function(_0xb52903,_0x25e4be){_0xb52903=_0xb52903-0x0;var _0x4017ef=_0xf1ca[_0xb52903];return _0x4017ef;};'use strict';var VoiceQueueEvents=require(_0xaf1c('0x0'));var events=[_0xaf1c('0x1'),_0xaf1c('0x2'),'update'];function createListener(_0x3ae1fd,_0x245758){return function(_0x32bfc3){_0x245758[_0xaf1c('0x3')](_0x3ae1fd,_0x32bfc3);};}function removeListener(_0x1f182c,_0x54ff8e){return function(){VoiceQueueEvents[_0xaf1c('0x4')](_0x1f182c,_0x54ff8e);};}exports[_0xaf1c('0x5')]=function(_0x342ee7){for(var _0x190c47=0x0,_0x3dd73e=events['length'];_0x190c47<_0x3dd73e;_0x190c47++){var _0x47daf3=events[_0x190c47];var _0x48b5c3=createListener(_0xaf1c('0x6')+_0x47daf3,_0x342ee7);VoiceQueueEvents['on'](_0x47daf3,_0x48b5c3);}}; \ No newline at end of file +var _0x06ee=['update','emit','removeListener','length','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x06ee,0x14e));var _0xe06e=function(_0x56effa,_0x441bf9){_0x56effa=_0x56effa-0x0;var _0x41e334=_0x06ee[_0x56effa];return _0x41e334;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xe06e('0x0'),'remove',_0xe06e('0x1')];function createListener(_0x29fd2b,_0xe269d2){return function(_0x4d2a55){_0xe269d2[_0xe06e('0x2')](_0x29fd2b,_0x4d2a55);};}function removeListener(_0x175656,_0x46e463){return function(){VoiceQueueEvents[_0xe06e('0x3')](_0x175656,_0x46e463);};}exports['register']=function(_0x339b5a){for(var _0xb02448=0x0,_0x50a6d9=events[_0xe06e('0x4')];_0xb02448<_0x50a6d9;_0xb02448++){var _0x5d2ea9=events[_0xb02448];var _0x410351=createListener('voiceQueue:'+_0x5d2ea9,_0x339b5a);VoiceQueueEvents['on'](_0x5d2ea9,_0x410351);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 2c2cdec..ade6781 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 _0xce15=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','isAuthenticated','describe','/index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x386dae,_0x34ef90){var _0x1159aa=function(_0x264060){while(--_0x264060){_0x386dae['push'](_0x386dae['shift']());}};_0x1159aa(++_0x34ef90);}(_0xce15,0x7d));var _0x5ce1=function(_0x45fa67,_0x54f9c8){_0x45fa67=_0x45fa67-0x0;var _0x2eddaf=_0xce15[_0x45fa67];return _0x2eddaf;};'use strict';var multer=require(_0x5ce1('0x0'));var util=require(_0x5ce1('0x1'));var path=require('path');var timeout=require(_0x5ce1('0x2'));var express=require(_0x5ce1('0x3'));var router=express[_0x5ce1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5ce1('0x5'));var config=require(_0x5ce1('0x6'));var controller=require(_0x5ce1('0x7'));router[_0x5ce1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ce1('0x8')](_0x5ce1('0x9'),auth[_0x5ce1('0xa')](),controller[_0x5ce1('0xb')]);router['get'](_0x5ce1('0xc'),auth[_0x5ce1('0xa')](),controller['getVoiceQueuesReport']);router['get'](_0x5ce1('0xd'),auth['isAuthenticated'](),controller[_0x5ce1('0xe')]);router[_0x5ce1('0xf')]('/',auth[_0x5ce1('0xa')](),controller[_0x5ce1('0x10')]);router[_0x5ce1('0x11')](_0x5ce1('0xd'),auth[_0x5ce1('0xa')](),controller['update']);router[_0x5ce1('0x12')](_0x5ce1('0xd'),auth[_0x5ce1('0xa')](),controller[_0x5ce1('0x13')]);module[_0x5ce1('0x14')]=router; \ No newline at end of file +var _0x94e9=['/index','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get'];(function(_0x49dcfb,_0x3e462c){var _0x23a56b=function(_0x38a97c){while(--_0x38a97c){_0x49dcfb['push'](_0x49dcfb['shift']());}};_0x23a56b(++_0x3e462c);}(_0x94e9,0xd0));var _0x994e=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x94e9[_0x285c85];return _0x2f81cd;};'use strict';var multer=require(_0x994e('0x0'));var util=require(_0x994e('0x1'));var path=require(_0x994e('0x2'));var timeout=require(_0x994e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x994e('0x4'));var auth=require(_0x994e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x994e('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x994e('0x7')](),controller[_0x994e('0x8')]);router['get'](_0x994e('0x9'),auth[_0x994e('0x7')](),controller[_0x994e('0xa')]);router[_0x994e('0xb')](_0x994e('0xc'),auth[_0x994e('0x7')](),controller['getVoiceQueuesReport']);router[_0x994e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x994e('0xd')]);router[_0x994e('0xe')]('/',auth[_0x994e('0x7')](),controller[_0x994e('0xf')]);router[_0x994e('0x10')](_0x994e('0x11'),auth['isAuthenticated'](),controller[_0x994e('0x12')]);router[_0x994e('0x13')]('/:id',auth[_0x994e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 13a1daa..7d65b4e 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 _0xf974=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x156f23,_0x48a789){var _0x1e7cd8=function(_0x446949){while(--_0x446949){_0x156f23['push'](_0x156f23['shift']());}};_0x1e7cd8(++_0x48a789);}(_0xf974,0x81));var _0x4f97=function(_0x1e3e16,_0x13a080){_0x1e3e16=_0x1e3e16-0x0;var _0x28454f=_0xf974[_0x1e3e16];return _0x28454f;};'use strict';var Sequelize=require(_0x4f97('0x0'));var moment=require(_0x4f97('0x1'));module[_0x4f97('0x2')]={'type':{'type':Sequelize[_0x4f97('0x3')]},'uniqueid':{'type':Sequelize[_0x4f97('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f97('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x4f97('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4f97('0x4')],'set':function(_0x21439d){var _0x4d42d3=moment(_0x21439d);var _0x4791b5=moment(this[_0x4f97('0x5')]('queuecallerjoinAt'))[_0x4f97('0x6')](_0x4f97('0x7'));var _0x2f5386=_0x4d42d3['diff'](_0x4791b5,_0x4f97('0x8'));this[_0x4f97('0x9')](_0x4f97('0xa'),_0x21439d);this[_0x4f97('0x9')](_0x4f97('0xb'),_0x2f5386||null);}},'position':{'type':Sequelize[_0x4f97('0xc')]},'count':{'type':Sequelize[_0x4f97('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x4f97('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4f97('0x4')]},'queuecallerexit':{'type':Sequelize[_0x4f97('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4f97('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4f97('0x3')],'comment':_0x4f97('0xe')},'originalposition':{'type':Sequelize[_0x4f97('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4f97('0x3')]},'accountcode':{'type':Sequelize[_0x4f97('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4f97('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x4f97('0xc')]},'mohtime':{'type':Sequelize[_0x4f97('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4f97('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4f97('0x3')]},'transfer':{'type':Sequelize[_0x4f97('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4f97('0x3')],'comment':_0x4f97('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4f97('0x3')]},'disposition':{'type':Sequelize[_0x4f97('0x3')]},'secondDisposition':{'type':Sequelize[_0x4f97('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4f97('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x4f97('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x812b=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x6fa8f9,_0x5d48d2){var _0x39b579=function(_0x1dd7c8){while(--_0x1dd7c8){_0x6fa8f9['push'](_0x6fa8f9['shift']());}};_0x39b579(++_0x5d48d2);}(_0x812b,0x12c));var _0xb812=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x812b[_0x1f1a97];return _0x29fc6a;};'use strict';var Sequelize=require(_0xb812('0x0'));var moment=require(_0xb812('0x1'));module['exports']={'type':{'type':Sequelize[_0xb812('0x2')]},'uniqueid':{'type':Sequelize[_0xb812('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb812('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xb812('0x3')],'set':function(_0x28f26b){var _0x588dba=moment(_0x28f26b);var _0x3e813d=moment(this['getDataValue']('queuecallerjoinAt'))[_0xb812('0x4')]('YYYY-MM-DD\x20HH:mm:ss');var _0xe0337d=_0x588dba[_0xb812('0x5')](_0x3e813d,_0xb812('0x6'));this[_0xb812('0x7')](_0xb812('0x8'),_0x28f26b);this[_0xb812('0x7')](_0xb812('0x9'),_0xe0337d||null);}},'position':{'type':Sequelize[_0xb812('0xa')]},'count':{'type':Sequelize[_0xb812('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xb812('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb812('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb812('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xb812('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xb812('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb812('0x2')]},'accountcode':{'type':Sequelize[_0xb812('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xb812('0xa')]},'mohtime':{'type':Sequelize[_0xb812('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb812('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb812('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb812('0x2')],'comment':_0xb812('0xc')},'transferexten':{'type':Sequelize[_0xb812('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb812('0x2')]},'disposition':{'type':Sequelize[_0xb812('0x2')]},'secondDisposition':{'type':Sequelize[_0xb812('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb812('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xb812('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index f228c51..5390e11 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 _0xc65d=['fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','VoiceQueueReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','getVoiceQueuesReport','pick','filter','eml-format'];(function(_0x15d9b2,_0x42f026){var _0x24390a=function(_0x52cfcd){while(--_0x52cfcd){_0x15d9b2['push'](_0x15d9b2['shift']());}};_0x24390a(++_0x42f026);}(_0xc65d,0x1cd));var _0xdc65=function(_0x419bc3,_0x249fb){_0x419bc3=_0x419bc3-0x0;var _0x3f6c12=_0xc65d[_0x419bc3];return _0x3f6c12;};'use strict';var emlformat=require(_0xdc65('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdc65('0x1'));var rp=require(_0xdc65('0x2'));var moment=require(_0xdc65('0x3'));var BPromise=require(_0xdc65('0x4'));var Mustache=require(_0xdc65('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc65('0x6'));var ejs=require(_0xdc65('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc65('0x8'));var squel=require(_0xdc65('0x9'));var crypto=require(_0xdc65('0xa'));var jsforce=require(_0xdc65('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdc65('0x6'));var querystring=require('querystring');var Papa=require(_0xdc65('0xc'));var Redis=require('ioredis');var authService=require(_0xdc65('0xd'));var qs=require(_0xdc65('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc65('0xf'))(_0xdc65('0x10'));var utils=require(_0xdc65('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xdc65('0x12'));var db=require(_0xdc65('0x13'))['db'];config[_0xdc65('0x14')]=_['defaults'](config[_0xdc65('0x14')],{'host':_0xdc65('0x15'),'port':0x18eb});var socket=require(_0xdc65('0x16'))(new Redis(config[_0xdc65('0x14')]));require(_0xdc65('0x17'))[_0xdc65('0x18')](socket);function respondWithStatusCode(_0x41c2c5,_0x5529b9){_0x5529b9=_0x5529b9||0xcc;return function(_0x405d11){if(_0x405d11){return _0x41c2c5[_0xdc65('0x19')](_0x5529b9);}return _0x41c2c5[_0xdc65('0x1a')](_0x5529b9)[_0xdc65('0x1b')]();};}function respondWithResult(_0x590666,_0x5738e4){_0x5738e4=_0x5738e4||0xc8;return function(_0x8a9dc6){if(_0x8a9dc6){return _0x590666[_0xdc65('0x1a')](_0x5738e4)[_0xdc65('0x1c')](_0x8a9dc6);}};}function respondWithFilteredResult(_0x3fbdc0,_0x3a1fbb){return function(_0x3ed6be){if(_0x3ed6be){var _0x5d9634=typeof _0x3a1fbb[_0xdc65('0x1d')]===_0xdc65('0x1e')&&typeof _0x3a1fbb[_0xdc65('0x1f')]===_0xdc65('0x1e');var _0x4ee14e=_0x3ed6be['count'];var _0x12f5cf=_0x5d9634?0x0:_0x3a1fbb[_0xdc65('0x1d')];var _0x3d685e=_0x5d9634?_0x3ed6be[_0xdc65('0x20')]:_0x3a1fbb[_0xdc65('0x1d')]+_0x3a1fbb[_0xdc65('0x1f')];var _0x3c7da8;if(_0x3d685e>=_0x4ee14e){_0x3d685e=_0x4ee14e;_0x3c7da8=0xc8;}else{_0x3c7da8=0xce;}_0x3fbdc0[_0xdc65('0x1a')](_0x3c7da8);return _0x3fbdc0[_0xdc65('0x21')]('Content-Range',_0x12f5cf+'-'+_0x3d685e+'/'+_0x4ee14e)['json'](_0x3ed6be);}return null;};}function patchUpdates(_0xb1ff10){return function(_0x2547bc){try{jsonpatch[_0xdc65('0x22')](_0x2547bc,_0xb1ff10,!![]);}catch(_0x5e3ce4){return BPromise[_0xdc65('0x23')](_0x5e3ce4);}return _0x2547bc[_0xdc65('0x24')]();};}function saveUpdates(_0xad4daa,_0x4f84c9){return function(_0x546236){if(_0x546236){return _0x546236[_0xdc65('0x25')](_0xad4daa)[_0xdc65('0x26')](function(_0x57acd4){return _0x57acd4;});}return null;};}function removeEntity(_0x1f157d,_0x5a9264){return function(_0xe8a1d4){if(_0xe8a1d4){return _0xe8a1d4[_0xdc65('0x27')]()[_0xdc65('0x26')](function(){_0x1f157d[_0xdc65('0x1a')](0xcc)[_0xdc65('0x1b')]();});}};}function handleEntityNotFound(_0xf1f4a5,_0x44b167){return function(_0x4256b2){if(!_0x4256b2){_0xf1f4a5[_0xdc65('0x19')](0x194);}return _0x4256b2;};}function handleError(_0x37a6ca,_0x55e55a){_0x55e55a=_0x55e55a||0x1f4;return function(_0x2b6163){logger['error'](_0x2b6163[_0xdc65('0x28')]);if(_0x2b6163[_0xdc65('0x29')]){delete _0x2b6163[_0xdc65('0x29')];}_0x37a6ca[_0xdc65('0x1a')](_0x55e55a)[_0xdc65('0x2a')](_0x2b6163);};}exports['index']=function(_0x13aecc,_0x4d943e){var _0x59eac6={},_0x1b282c={},_0x441040={'count':0x0,'rows':[]};var _0x3951ad=_[_0xdc65('0x2b')](db[_0xdc65('0x2c')][_0xdc65('0x2d')],function(_0x27961f){return{'name':_0x27961f['fieldName'],'type':_0x27961f[_0xdc65('0x2e')][_0xdc65('0x2f')]};});_0x1b282c['model']=_[_0xdc65('0x2b')](_0x3951ad,_0xdc65('0x29'));_0x1b282c[_0xdc65('0x30')]=_[_0xdc65('0x31')](_0x13aecc['query']);_0x1b282c[_0xdc65('0x32')]=_[_0xdc65('0x33')](_0x1b282c['model'],_0x1b282c[_0xdc65('0x30')]);_0x59eac6[_0xdc65('0x34')]=_[_0xdc65('0x33')](_0x1b282c['model'],qs['fields'](_0x13aecc[_0xdc65('0x30')][_0xdc65('0x35')]));_0x59eac6['attributes']=_0x59eac6[_0xdc65('0x34')][_0xdc65('0x36')]?_0x59eac6[_0xdc65('0x34')]:_0x1b282c[_0xdc65('0x37')];if(!_0x13aecc['query'][_0xdc65('0x38')](_0xdc65('0x39'))){_0x59eac6['limit']=qs[_0xdc65('0x1f')](_0x13aecc[_0xdc65('0x30')][_0xdc65('0x1f')]);_0x59eac6['offset']=qs[_0xdc65('0x1d')](_0x13aecc[_0xdc65('0x30')][_0xdc65('0x1d')]);}_0x59eac6[_0xdc65('0x3a')]=qs[_0xdc65('0x3b')](_0x13aecc[_0xdc65('0x30')]['sort']);_0x59eac6[_0xdc65('0x3c')]=qs[_0xdc65('0x32')](_['pick'](_0x13aecc['query'],_0x1b282c[_0xdc65('0x32')]),_0x3951ad);if(_0x13aecc[_0xdc65('0x30')]['filter']){_0x59eac6[_0xdc65('0x3c')]=_[_0xdc65('0x3d')](_0x59eac6[_0xdc65('0x3c')],{'$or':_['map'](_0x3951ad,function(_0x281fb9){if(_0x281fb9[_0xdc65('0x2e')]!=='VIRTUAL'){var _0x39628f={};_0x39628f[_0x281fb9[_0xdc65('0x29')]]={'$like':'%'+_0x13aecc['query']['filter']+'%'};return _0x39628f;}})});}_0x59eac6=_[_0xdc65('0x3d')]({},_0x59eac6,_0x13aecc['options']);var _0x4ae400={'where':_0x59eac6[_0xdc65('0x3c')]};return db[_0xdc65('0x2c')][_0xdc65('0x20')](_0x4ae400)[_0xdc65('0x26')](function(_0x4d27ab){_0x441040['count']=_0x4d27ab;if(_0x13aecc['query'][_0xdc65('0x3e')]){_0x59eac6[_0xdc65('0x3f')]=[{'all':!![]}];}return db[_0xdc65('0x2c')][_0xdc65('0x40')](_0x59eac6);})['then'](function(_0x178dd6){_0x441040[_0xdc65('0x41')]=_0x178dd6;return _0x441040;})['then'](respondWithFilteredResult(_0x4d943e,_0x59eac6))[_0xdc65('0x42')](handleError(_0x4d943e,null));};exports[_0xdc65('0x43')]=function(_0x2b2d1c,_0x9a1aae){var _0x215033={'raw':![],'where':{'id':_0x2b2d1c[_0xdc65('0x44')]['id']}},_0x5c32be={};_0x5c32be[_0xdc65('0x37')]=_[_0xdc65('0x31')](db[_0xdc65('0x2c')][_0xdc65('0x2d')]);_0x5c32be[_0xdc65('0x30')]=_['keys'](_0x2b2d1c[_0xdc65('0x30')]);_0x5c32be[_0xdc65('0x32')]=_['intersection'](_0x5c32be[_0xdc65('0x37')],_0x5c32be['query']);_0x215033[_0xdc65('0x34')]=_[_0xdc65('0x33')](_0x5c32be[_0xdc65('0x37')],qs[_0xdc65('0x35')](_0x2b2d1c['query'][_0xdc65('0x35')]));_0x215033[_0xdc65('0x34')]=_0x215033['attributes'][_0xdc65('0x36')]?_0x215033[_0xdc65('0x34')]:_0x5c32be['model'];if(_0x2b2d1c['query'][_0xdc65('0x3e')]){_0x215033['include']=[{'all':!![]}];}_0x215033=_[_0xdc65('0x3d')]({},_0x215033,_0x2b2d1c[_0xdc65('0x45')]);return db[_0xdc65('0x2c')]['find'](_0x215033)[_0xdc65('0x26')](handleEntityNotFound(_0x9a1aae,null))[_0xdc65('0x26')](respondWithResult(_0x9a1aae,null))[_0xdc65('0x42')](handleError(_0x9a1aae,null));};exports[_0xdc65('0x46')]=function(_0x44368e,_0x3eb0a7){return db[_0xdc65('0x2c')]['create'](_0x44368e[_0xdc65('0x47')],{})[_0xdc65('0x26')](respondWithResult(_0x3eb0a7,0xc9))['catch'](handleError(_0x3eb0a7,null));};exports[_0xdc65('0x25')]=function(_0x4bf7d0,_0x5af035){if(_0x4bf7d0[_0xdc65('0x47')]['id']){delete _0x4bf7d0[_0xdc65('0x47')]['id'];}return db['VoiceQueueReport'][_0xdc65('0x48')]({'where':{'id':_0x4bf7d0[_0xdc65('0x44')]['id']}})[_0xdc65('0x26')](handleEntityNotFound(_0x5af035,null))[_0xdc65('0x26')](saveUpdates(_0x4bf7d0['body'],null))['then'](respondWithResult(_0x5af035,null))['catch'](handleError(_0x5af035,null));};exports[_0xdc65('0x27')]=function(_0x18c031,_0x5a6c8d){return db[_0xdc65('0x2c')]['find']({'where':{'id':_0x18c031[_0xdc65('0x44')]['id']}})[_0xdc65('0x26')](handleEntityNotFound(_0x5a6c8d,null))[_0xdc65('0x26')](removeEntity(_0x5a6c8d,null))[_0xdc65('0x42')](handleError(_0x5a6c8d,null));};exports[_0xdc65('0x49')]=function(_0x41d95c,_0x518749){return db[_0xdc65('0x2c')][_0xdc65('0x49')]()[_0xdc65('0x26')](respondWithResult(_0x518749,null))[_0xdc65('0x42')](handleError(_0x518749,null));};exports[_0xdc65('0x4a')]=function(_0x4a756d,_0x3806d5){var _0x3db07a={},_0x982cda={},_0x28a9f1={'count':0x0,'rows':[]};_0x982cda['model']=_[_0xdc65('0x31')](db[_0xdc65('0x2c')][_0xdc65('0x2d')]);_0x982cda[_0xdc65('0x30')]=_['keys'](_0x4a756d[_0xdc65('0x30')]);_0x982cda['filters']=_['intersection'](_0x982cda[_0xdc65('0x37')],_0x982cda[_0xdc65('0x30')]);_0x3db07a[_0xdc65('0x34')]=_[_0xdc65('0x33')](_0x982cda[_0xdc65('0x37')],qs['fields'](_0x4a756d['query'][_0xdc65('0x35')]));_0x3db07a[_0xdc65('0x34')]=_0x3db07a[_0xdc65('0x34')][_0xdc65('0x36')]?_0x3db07a[_0xdc65('0x34')]:_0x982cda[_0xdc65('0x37')];if(!_0x4a756d[_0xdc65('0x30')][_0xdc65('0x38')]('nolimit')){_0x3db07a[_0xdc65('0x1f')]=qs[_0xdc65('0x1f')](_0x4a756d[_0xdc65('0x30')]['limit']);_0x3db07a['offset']=qs[_0xdc65('0x1d')](_0x4a756d[_0xdc65('0x30')]['offset']);}_0x3db07a[_0xdc65('0x3a')]=qs['sort'](_0x4a756d[_0xdc65('0x30')][_0xdc65('0x3b')]);_0x3db07a[_0xdc65('0x3c')]=qs[_0xdc65('0x32')](_[_0xdc65('0x4b')](_0x4a756d['query'],_0x982cda[_0xdc65('0x32')]));if(_0x4a756d['query'][_0xdc65('0x4c')]){_0x3db07a[_0xdc65('0x3c')]=_[_0xdc65('0x3d')](_0x3db07a[_0xdc65('0x3c')],{'$or':_['map'](_0x3db07a[_0xdc65('0x34')],function(_0x17128a){var _0xbc4c24={};_0xbc4c24[_0x17128a]={'$like':'%'+_0x4a756d[_0xdc65('0x30')][_0xdc65('0x4c')]+'%'};return _0xbc4c24;})});}_0x3db07a=_['merge']({},_0x3db07a,_0x4a756d[_0xdc65('0x45')]);var _0x444e31={'where':_0x3db07a['where']};return db['VoiceQueueReport']['count'](_0x444e31)[_0xdc65('0x26')](function(_0x4c6936){_0x28a9f1[_0xdc65('0x20')]=_0x4c6936;if(_0x4a756d['query']['includeAll']){_0x3db07a[_0xdc65('0x3f')]=[{'all':!![]}];}return db[_0xdc65('0x2c')][_0xdc65('0x40')](_0x3db07a);})[_0xdc65('0x26')](function(_0xa3476a){_0x28a9f1[_0xdc65('0x41')]=_0xa3476a;return _0x28a9f1;})[_0xdc65('0x26')](respondWithFilteredResult(_0x3806d5,_0x3db07a,_0xdc65('0x4a')))['catch'](handleError(_0x3806d5,null,_0xdc65('0x4a')));}; \ No newline at end of file +var _0x1e1c=['send','map','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','nolimit','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x1e1c,0x1cc));var _0xc1e1=function(_0x30e548,_0x4a8ea8){_0x30e548=_0x30e548-0x0;var _0x263b8c=_0x1e1c[_0x30e548];return _0x263b8c;};'use strict';var emlformat=require(_0xc1e1('0x0'));var rimraf=require(_0xc1e1('0x1'));var zipdir=require(_0xc1e1('0x2'));var jsonpatch=require(_0xc1e1('0x3'));var rp=require(_0xc1e1('0x4'));var moment=require(_0xc1e1('0x5'));var BPromise=require(_0xc1e1('0x6'));var Mustache=require(_0xc1e1('0x7'));var util=require(_0xc1e1('0x8'));var path=require(_0xc1e1('0x9'));var sox=require(_0xc1e1('0xa'));var csv=require('to-csv');var ejs=require(_0xc1e1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1e1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc1e1('0xd'));var deskjs=require(_0xc1e1('0xe'));var toCsv=require(_0xc1e1('0xf'));var querystring=require(_0xc1e1('0x10'));var Papa=require('papaparse');var Redis=require(_0xc1e1('0x11'));var authService=require(_0xc1e1('0x12'));var qs=require(_0xc1e1('0x13'));var as=require(_0xc1e1('0x14'));var hardwareService=require(_0xc1e1('0x15'));var logger=require(_0xc1e1('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc1e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1e1('0x18'))['db'];config[_0xc1e1('0x19')]=_[_0xc1e1('0x1a')](config[_0xc1e1('0x19')],{'host':_0xc1e1('0x1b'),'port':0x18eb});var socket=require(_0xc1e1('0x1c'))(new Redis(config['redis']));require(_0xc1e1('0x1d'))[_0xc1e1('0x1e')](socket);function respondWithStatusCode(_0x3c35c6,_0x3ed276){_0x3ed276=_0x3ed276||0xcc;return function(_0x31e9bc){if(_0x31e9bc){return _0x3c35c6[_0xc1e1('0x1f')](_0x3ed276);}return _0x3c35c6[_0xc1e1('0x20')](_0x3ed276)[_0xc1e1('0x21')]();};}function respondWithResult(_0x5f2334,_0x330b39){_0x330b39=_0x330b39||0xc8;return function(_0x2652d8){if(_0x2652d8){return _0x5f2334[_0xc1e1('0x20')](_0x330b39)[_0xc1e1('0x22')](_0x2652d8);}};}function respondWithFilteredResult(_0x37255e,_0xfcf85e){return function(_0x301d8b){if(_0x301d8b){var _0x47c2e6=typeof _0xfcf85e['offset']===_0xc1e1('0x23')&&typeof _0xfcf85e[_0xc1e1('0x24')]===_0xc1e1('0x23');var _0x2f3cb4=_0x301d8b[_0xc1e1('0x25')];var _0x2e13fc=_0x47c2e6?0x0:_0xfcf85e[_0xc1e1('0x26')];var _0x5d528e=_0x47c2e6?_0x301d8b[_0xc1e1('0x25')]:_0xfcf85e['offset']+_0xfcf85e[_0xc1e1('0x24')];var _0x15bea5;if(_0x5d528e>=_0x2f3cb4){_0x5d528e=_0x2f3cb4;_0x15bea5=0xc8;}else{_0x15bea5=0xce;}_0x37255e[_0xc1e1('0x20')](_0x15bea5);return _0x37255e[_0xc1e1('0x27')](_0xc1e1('0x28'),_0x2e13fc+'-'+_0x5d528e+'/'+_0x2f3cb4)[_0xc1e1('0x22')](_0x301d8b);}return null;};}function patchUpdates(_0x1e9f51){return function(_0x6f9d0c){try{jsonpatch[_0xc1e1('0x29')](_0x6f9d0c,_0x1e9f51,!![]);}catch(_0x159a02){return BPromise[_0xc1e1('0x2a')](_0x159a02);}return _0x6f9d0c[_0xc1e1('0x2b')]();};}function saveUpdates(_0x1bdb7c,_0x1cca22){return function(_0x304ef3){if(_0x304ef3){return _0x304ef3[_0xc1e1('0x2c')](_0x1bdb7c)[_0xc1e1('0x2d')](function(_0x23bfcb){return _0x23bfcb;});}return null;};}function removeEntity(_0x2a70e6,_0x49880b){return function(_0x48ccc4){if(_0x48ccc4){return _0x48ccc4[_0xc1e1('0x2e')]()[_0xc1e1('0x2d')](function(){_0x2a70e6[_0xc1e1('0x20')](0xcc)[_0xc1e1('0x21')]();});}};}function handleEntityNotFound(_0x3d2bed,_0x69d98e){return function(_0x2b7a08){if(!_0x2b7a08){_0x3d2bed[_0xc1e1('0x1f')](0x194);}return _0x2b7a08;};}function handleError(_0x2b62b3,_0x273677){_0x273677=_0x273677||0x1f4;return function(_0x507855){logger[_0xc1e1('0x2f')](_0x507855[_0xc1e1('0x30')]);if(_0x507855['name']){delete _0x507855[_0xc1e1('0x31')];}_0x2b62b3[_0xc1e1('0x20')](_0x273677)[_0xc1e1('0x32')](_0x507855);};}exports['index']=function(_0x12693a,_0xf6fb3b){var _0x4499f2={},_0x103053={},_0x36c5d6={'count':0x0,'rows':[]};var _0xf65fec=_[_0xc1e1('0x33')](db[_0xc1e1('0x34')]['rawAttributes'],function(_0xe456c8){return{'name':_0xe456c8[_0xc1e1('0x35')],'type':_0xe456c8[_0xc1e1('0x36')][_0xc1e1('0x37')]};});_0x103053[_0xc1e1('0x38')]=_['map'](_0xf65fec,_0xc1e1('0x31'));_0x103053[_0xc1e1('0x39')]=_[_0xc1e1('0x3a')](_0x12693a[_0xc1e1('0x39')]);_0x103053[_0xc1e1('0x3b')]=_[_0xc1e1('0x3c')](_0x103053[_0xc1e1('0x38')],_0x103053[_0xc1e1('0x39')]);_0x4499f2[_0xc1e1('0x3d')]=_[_0xc1e1('0x3c')](_0x103053[_0xc1e1('0x38')],qs[_0xc1e1('0x3e')](_0x12693a[_0xc1e1('0x39')][_0xc1e1('0x3e')]));_0x4499f2[_0xc1e1('0x3d')]=_0x4499f2[_0xc1e1('0x3d')][_0xc1e1('0x3f')]?_0x4499f2[_0xc1e1('0x3d')]:_0x103053['model'];if(!_0x12693a[_0xc1e1('0x39')][_0xc1e1('0x40')]('nolimit')){_0x4499f2[_0xc1e1('0x24')]=qs['limit'](_0x12693a[_0xc1e1('0x39')]['limit']);_0x4499f2['offset']=qs['offset'](_0x12693a[_0xc1e1('0x39')]['offset']);}_0x4499f2['order']=qs[_0xc1e1('0x41')](_0x12693a['query']['sort']);_0x4499f2[_0xc1e1('0x42')]=qs[_0xc1e1('0x3b')](_[_0xc1e1('0x43')](_0x12693a[_0xc1e1('0x39')],_0x103053['filters']),_0xf65fec);if(_0x12693a['query'][_0xc1e1('0x44')]){_0x4499f2[_0xc1e1('0x42')]=_['merge'](_0x4499f2['where'],{'$or':_['map'](_0xf65fec,function(_0x5bd28f){if(_0x5bd28f['type']!==_0xc1e1('0x45')){var _0x15cce1={};_0x15cce1[_0x5bd28f[_0xc1e1('0x31')]]={'$like':'%'+_0x12693a[_0xc1e1('0x39')][_0xc1e1('0x44')]+'%'};return _0x15cce1;}})});}_0x4499f2=_[_0xc1e1('0x46')]({},_0x4499f2,_0x12693a['options']);var _0x2fdff7={'where':_0x4499f2['where']};return db[_0xc1e1('0x34')]['count'](_0x2fdff7)[_0xc1e1('0x2d')](function(_0x3eb4e5){_0x36c5d6[_0xc1e1('0x25')]=_0x3eb4e5;if(_0x12693a['query'][_0xc1e1('0x47')]){_0x4499f2[_0xc1e1('0x48')]=[{'all':!![]}];}return db[_0xc1e1('0x34')][_0xc1e1('0x49')](_0x4499f2);})[_0xc1e1('0x2d')](function(_0x3ea7b1){_0x36c5d6[_0xc1e1('0x4a')]=_0x3ea7b1;return _0x36c5d6;})['then'](respondWithFilteredResult(_0xf6fb3b,_0x4499f2))[_0xc1e1('0x4b')](handleError(_0xf6fb3b,null));};exports[_0xc1e1('0x4c')]=function(_0x3ce02b,_0x11729a){var _0x32203d={'raw':![],'where':{'id':_0x3ce02b['params']['id']}},_0x2ed83c={};_0x2ed83c[_0xc1e1('0x38')]=_[_0xc1e1('0x3a')](db[_0xc1e1('0x34')][_0xc1e1('0x4d')]);_0x2ed83c['query']=_[_0xc1e1('0x3a')](_0x3ce02b[_0xc1e1('0x39')]);_0x2ed83c['filters']=_['intersection'](_0x2ed83c[_0xc1e1('0x38')],_0x2ed83c[_0xc1e1('0x39')]);_0x32203d[_0xc1e1('0x3d')]=_[_0xc1e1('0x3c')](_0x2ed83c[_0xc1e1('0x38')],qs['fields'](_0x3ce02b[_0xc1e1('0x39')][_0xc1e1('0x3e')]));_0x32203d[_0xc1e1('0x3d')]=_0x32203d[_0xc1e1('0x3d')][_0xc1e1('0x3f')]?_0x32203d[_0xc1e1('0x3d')]:_0x2ed83c[_0xc1e1('0x38')];if(_0x3ce02b[_0xc1e1('0x39')][_0xc1e1('0x47')]){_0x32203d[_0xc1e1('0x48')]=[{'all':!![]}];}_0x32203d=_[_0xc1e1('0x46')]({},_0x32203d,_0x3ce02b['options']);return db[_0xc1e1('0x34')][_0xc1e1('0x4e')](_0x32203d)['then'](handleEntityNotFound(_0x11729a,null))[_0xc1e1('0x2d')](respondWithResult(_0x11729a,null))['catch'](handleError(_0x11729a,null));};exports[_0xc1e1('0x4f')]=function(_0x875136,_0x6f8402){return db[_0xc1e1('0x34')][_0xc1e1('0x4f')](_0x875136[_0xc1e1('0x50')],{})[_0xc1e1('0x2d')](respondWithResult(_0x6f8402,0xc9))[_0xc1e1('0x4b')](handleError(_0x6f8402,null));};exports[_0xc1e1('0x2c')]=function(_0x5efe26,_0x5c34b6){if(_0x5efe26[_0xc1e1('0x50')]['id']){delete _0x5efe26[_0xc1e1('0x50')]['id'];}return db[_0xc1e1('0x34')][_0xc1e1('0x4e')]({'where':{'id':_0x5efe26[_0xc1e1('0x51')]['id']}})[_0xc1e1('0x2d')](handleEntityNotFound(_0x5c34b6,null))[_0xc1e1('0x2d')](saveUpdates(_0x5efe26[_0xc1e1('0x50')],null))['then'](respondWithResult(_0x5c34b6,null))[_0xc1e1('0x4b')](handleError(_0x5c34b6,null));};exports[_0xc1e1('0x2e')]=function(_0x412b6e,_0x43afa3){return db[_0xc1e1('0x34')][_0xc1e1('0x4e')]({'where':{'id':_0x412b6e[_0xc1e1('0x51')]['id']}})[_0xc1e1('0x2d')](handleEntityNotFound(_0x43afa3,null))['then'](removeEntity(_0x43afa3,null))[_0xc1e1('0x4b')](handleError(_0x43afa3,null));};exports[_0xc1e1('0x52')]=function(_0x24f4ff,_0x1eaecf){return db[_0xc1e1('0x34')][_0xc1e1('0x52')]()[_0xc1e1('0x2d')](respondWithResult(_0x1eaecf,null))[_0xc1e1('0x4b')](handleError(_0x1eaecf,null));};exports['getVoiceQueuesReport']=function(_0x4b7777,_0x346cd3){var _0x35fcae={},_0x367f92={},_0x27fada={'count':0x0,'rows':[]};_0x367f92[_0xc1e1('0x38')]=_[_0xc1e1('0x3a')](db['VoiceQueueReport'][_0xc1e1('0x4d')]);_0x367f92[_0xc1e1('0x39')]=_['keys'](_0x4b7777[_0xc1e1('0x39')]);_0x367f92[_0xc1e1('0x3b')]=_[_0xc1e1('0x3c')](_0x367f92[_0xc1e1('0x38')],_0x367f92['query']);_0x35fcae[_0xc1e1('0x3d')]=_[_0xc1e1('0x3c')](_0x367f92[_0xc1e1('0x38')],qs[_0xc1e1('0x3e')](_0x4b7777[_0xc1e1('0x39')][_0xc1e1('0x3e')]));_0x35fcae[_0xc1e1('0x3d')]=_0x35fcae['attributes'][_0xc1e1('0x3f')]?_0x35fcae[_0xc1e1('0x3d')]:_0x367f92['model'];if(!_0x4b7777['query']['hasOwnProperty'](_0xc1e1('0x53'))){_0x35fcae['limit']=qs['limit'](_0x4b7777[_0xc1e1('0x39')][_0xc1e1('0x24')]);_0x35fcae['offset']=qs[_0xc1e1('0x26')](_0x4b7777['query'][_0xc1e1('0x26')]);}_0x35fcae[_0xc1e1('0x54')]=qs[_0xc1e1('0x41')](_0x4b7777[_0xc1e1('0x39')]['sort']);_0x35fcae[_0xc1e1('0x42')]=qs[_0xc1e1('0x3b')](_[_0xc1e1('0x43')](_0x4b7777['query'],_0x367f92[_0xc1e1('0x3b')]));if(_0x4b7777[_0xc1e1('0x39')][_0xc1e1('0x44')]){_0x35fcae['where']=_[_0xc1e1('0x46')](_0x35fcae[_0xc1e1('0x42')],{'$or':_[_0xc1e1('0x33')](_0x35fcae[_0xc1e1('0x3d')],function(_0x17114d){var _0x319fa6={};_0x319fa6[_0x17114d]={'$like':'%'+_0x4b7777[_0xc1e1('0x39')][_0xc1e1('0x44')]+'%'};return _0x319fa6;})});}_0x35fcae=_['merge']({},_0x35fcae,_0x4b7777['options']);var _0x522095={'where':_0x35fcae[_0xc1e1('0x42')]};return db[_0xc1e1('0x34')][_0xc1e1('0x25')](_0x522095)[_0xc1e1('0x2d')](function(_0x13e2fd){_0x27fada[_0xc1e1('0x25')]=_0x13e2fd;if(_0x4b7777[_0xc1e1('0x39')]['includeAll']){_0x35fcae[_0xc1e1('0x48')]=[{'all':!![]}];}return db[_0xc1e1('0x34')]['findAll'](_0x35fcae);})[_0xc1e1('0x2d')](function(_0x315538){_0x27fada[_0xc1e1('0x4a')]=_0x315538;return _0x27fada;})['then'](respondWithFilteredResult(_0x346cd3,_0x35fcae,'getVoiceQueuesReport'))['catch'](handleError(_0x346cd3,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 32bb3bb..34b496c 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 _0xb3e5=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x120bd7,_0x1e8840){var _0xf26684=function(_0x127907){while(--_0x127907){_0x120bd7['push'](_0x120bd7['shift']());}};_0xf26684(++_0x1e8840);}(_0xb3e5,0x170));var _0x5b3e=function(_0xc648d5,_0x1c1f40){_0xc648d5=_0xc648d5-0x0;var _0x4185b1=_0xb3e5[_0xc648d5];return _0x4185b1;};'use strict';var EventEmitter=require(_0x5b3e('0x0'));var VoiceQueueReport=require(_0x5b3e('0x1'))['db'][_0x5b3e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5b3e('0x3')](0x0);var events={'afterCreate':_0x5b3e('0x4'),'afterUpdate':_0x5b3e('0x5'),'afterDestroy':_0x5b3e('0x6')};function emitEvent(_0xba62c6){return function(_0x262741,_0x2fea01,_0x250c6d){VoiceQueueReportEvents[_0x5b3e('0x7')](_0xba62c6+':'+_0x262741['id'],_0x262741);VoiceQueueReportEvents[_0x5b3e('0x7')](_0xba62c6,_0x262741);_0x250c6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x5b3e('0x8')](e,emitEvent(event));}}module[_0x5b3e('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x701a=['hook','exports','events','update','emit','hasOwnProperty'];(function(_0x5346a9,_0x7c3e5b){var _0x2a88dd=function(_0x4f4902){while(--_0x4f4902){_0x5346a9['push'](_0x5346a9['shift']());}};_0x2a88dd(++_0x7c3e5b);}(_0x701a,0x8c));var _0xa701=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x701a[_0x10df18];return _0x1f9a1d;};'use strict';var EventEmitter=require(_0xa701('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa701('0x1'),'afterDestroy':'remove'};function emitEvent(_0x1860e2){return function(_0x270596,_0x5957ff,_0x306931){VoiceQueueReportEvents[_0xa701('0x2')](_0x1860e2+':'+_0x270596['id'],_0x270596);VoiceQueueReportEvents[_0xa701('0x2')](_0x1860e2,_0x270596);_0x306931(null);};}for(var e in events){if(events[_0xa701('0x3')](e)){var event=events[e];VoiceQueueReport[_0xa701('0x4')](e,emitEvent(event));}}module[_0xa701('0x5')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b8383dc..cca6070 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 _0xc627=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x11119c,_0x199c80){var _0x308a25=function(_0x5bac7b){while(--_0x5bac7b){_0x11119c['push'](_0x11119c['shift']());}};_0x308a25(++_0x199c80);}(_0xc627,0x1cd));var _0x7c62=function(_0x388579,_0x1dee6c){_0x388579=_0x388579-0x0;var _0x548c37=_0xc627[_0x388579];return _0x548c37;};'use strict';var _=require('lodash');var util=require(_0x7c62('0x0'));var logger=require(_0x7c62('0x1'))(_0x7c62('0x2'));var moment=require(_0x7c62('0x3'));var BPromise=require(_0x7c62('0x4'));var rp=require(_0x7c62('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var attributes=require(_0x7c62('0x8'));module[_0x7c62('0x9')]=function(_0x17f8fc,_0x447012){return _0x17f8fc[_0x7c62('0xa')](_0x7c62('0xb'),attributes,{'tableName':_0x7c62('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x29c4=['./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0xf17a7,_0xc5ef28){var _0x35af3d=function(_0x4d7eef){while(--_0x4d7eef){_0xf17a7['push'](_0xf17a7['shift']());}};_0x35af3d(++_0xc5ef28);}(_0x29c4,0xc9));var _0x429c=function(_0x25515a,_0x37c265){_0x25515a=_0x25515a-0x0;var _0x3daa5e=_0x29c4[_0x25515a];return _0x3daa5e;};'use strict';var _=require(_0x429c('0x0'));var util=require(_0x429c('0x1'));var logger=require(_0x429c('0x2'))('api');var moment=require(_0x429c('0x3'));var BPromise=require('bluebird');var rp=require(_0x429c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429c('0x5'));var config=require(_0x429c('0x6'));var attributes=require(_0x429c('0x7'));module[_0x429c('0x8')]=function(_0x1a8c1d,_0x3309fe){return _0x1a8c1d['define'](_0x429c('0x9'),attributes,{'tableName':_0x429c('0xa'),'paranoid':![],'indexes':[{'fields':[_0x429c('0xb')]},{'fields':[_0x429c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ea1135f..8e70eb7 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 _0x67b9=['update','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceQueueReport','VoiceQueueReport','body','then','UpdateVoiceQueueReport'];(function(_0x100f05,_0x2de0fa){var _0x2bcde1=function(_0x1e564d){while(--_0x1e564d){_0x100f05['push'](_0x100f05['shift']());}};_0x2bcde1(++_0x2de0fa);}(_0x67b9,0x157));var _0x967b=function(_0x21ce97,_0x10dbe9){_0x21ce97=_0x21ce97-0x0;var _0x10ad5e=_0x67b9[_0x21ce97];return _0x10ad5e;};'use strict';var _=require(_0x967b('0x0'));var util=require(_0x967b('0x1'));var moment=require('moment');var BPromise=require(_0x967b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x967b('0x3'))['db'];var utils=require(_0x967b('0x4'));var logger=require(_0x967b('0x5'))(_0x967b('0x6'));var config=require(_0x967b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x967b('0x8')]['http']({'port':0x232a});config[_0x967b('0x9')]=_[_0x967b('0xa')](config[_0x967b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x967b('0x9')]));require(_0x967b('0xb'))[_0x967b('0xc')](socket);function respondWithRpcPromise(_0x23d840,_0x1d7cb4,_0xb4e27c){return new BPromise(function(_0x543fa7,_0x1bf72d){return client['request'](_0x23d840,_0xb4e27c)['then'](function(_0x487740){logger[_0x967b('0xd')](_0x967b('0xe'),_0x1d7cb4,_0x967b('0xf'));logger[_0x967b('0x10')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1d7cb4,_0x967b('0xf'),JSON[_0x967b('0x11')](_0x487740));if(_0x487740[_0x967b('0x12')]){if(_0x487740[_0x967b('0x12')][_0x967b('0x13')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1d7cb4,_0x487740[_0x967b('0x12')][_0x967b('0x14')]);return _0x1bf72d(_0x487740[_0x967b('0x12')][_0x967b('0x14')]);}logger[_0x967b('0x12')](_0x967b('0xe'),_0x1d7cb4,_0x487740[_0x967b('0x12')][_0x967b('0x14')]);return _0x543fa7(_0x487740[_0x967b('0x12')][_0x967b('0x14')]);}else{logger[_0x967b('0xd')](_0x967b('0xe'),_0x1d7cb4,_0x967b('0xf'));_0x543fa7(_0x487740['result'][_0x967b('0x14')]);}})[_0x967b('0x15')](function(_0x552742){logger[_0x967b('0x12')](_0x967b('0xe'),_0x1d7cb4,_0x552742);_0x1bf72d(_0x552742);});});}exports[_0x967b('0x16')]=function(_0x3e9c83){var _0x47792c=this;return new Promise(function(_0x44b8b4,_0x29b4b6){return db['VoiceQueueReport'][_0x967b('0x17')]({'raw':_0x3e9c83[_0x967b('0x18')]?_0x3e9c83['options'][_0x967b('0x19')]===undefined?!![]:![]:!![],'where':_0x3e9c83['options']?_0x3e9c83[_0x967b('0x18')][_0x967b('0x1a')]||null:null,'attributes':_0x3e9c83[_0x967b('0x18')]?_0x3e9c83['options'][_0x967b('0x1b')]||null:null,'limit':_0x3e9c83['options']?_0x3e9c83['options'][_0x967b('0x1c')]||null:null,'include':_0x3e9c83['options']?_0x3e9c83[_0x967b('0x18')][_0x967b('0x1d')]?_['map'](_0x3e9c83[_0x967b('0x18')][_0x967b('0x1d')],function(_0x37ab2a){return{'model':db[_0x37ab2a[_0x967b('0x1e')]],'as':_0x37ab2a['as'],'attributes':_0x37ab2a[_0x967b('0x1b')],'include':_0x37ab2a[_0x967b('0x1d')]?_['map'](_0x37ab2a[_0x967b('0x1d')],function(_0x2d720a){return{'model':db[_0x2d720a[_0x967b('0x1e')]],'as':_0x2d720a['as'],'attributes':_0x2d720a['attributes'],'include':_0x2d720a[_0x967b('0x1d')]?_[_0x967b('0x1f')](_0x2d720a[_0x967b('0x1d')],function(_0x12f5a6){return{'model':db[_0x12f5a6[_0x967b('0x1e')]],'as':_0x12f5a6['as'],'attributes':_0x12f5a6[_0x967b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102320){logger['info'](_0x967b('0x16'),_0x3e9c83);logger[_0x967b('0x10')](_0x967b('0x16'),_0x3e9c83,JSON[_0x967b('0x11')](_0x102320));_0x44b8b4(_0x102320);})[_0x967b('0x15')](function(_0x2a6b37){logger['error']('GetVoiceQueueReport',_0x2a6b37['message'],_0x3e9c83);_0x29b4b6(_0x47792c[_0x967b('0x12')](0x1f4,_0x2a6b37[_0x967b('0x14')]));});});};exports[_0x967b('0x20')]=function(_0x2a3d3c){var _0x217ad8=this;return new Promise(function(_0x4e4996,_0x369247){return db[_0x967b('0x21')]['create'](_0x2a3d3c[_0x967b('0x22')],{'raw':_0x2a3d3c['options']?_0x2a3d3c[_0x967b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x967b('0x23')](function(_0x35817a){logger[_0x967b('0xd')]('CreateVoiceQueueReport',_0x2a3d3c);logger['debug']('CreateVoiceQueueReport',_0x2a3d3c,JSON['stringify'](_0x35817a));_0x4e4996(_0x35817a);})[_0x967b('0x15')](function(_0x2345fd){logger[_0x967b('0x12')](_0x967b('0x20'),_0x2345fd[_0x967b('0x14')],_0x2a3d3c);_0x369247(_0x217ad8[_0x967b('0x12')](0x1f4,_0x2345fd[_0x967b('0x14')]));});});};exports[_0x967b('0x24')]=function(_0x423611){var _0x54fa6d=this;return new Promise(function(_0x409533,_0x35e099){return db[_0x967b('0x21')][_0x967b('0x25')](_0x423611[_0x967b('0x22')],{'raw':_0x423611[_0x967b('0x18')]?_0x423611[_0x967b('0x18')][_0x967b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x423611[_0x967b('0x18')]?_0x423611['options'][_0x967b('0x1a')]||null:null,'attributes':_0x423611[_0x967b('0x18')]?_0x423611['options'][_0x967b('0x1b')]||null:null,'limit':_0x423611[_0x967b('0x18')]?_0x423611['options'][_0x967b('0x1c')]||null:null})['then'](function(_0x5db460){logger[_0x967b('0xd')](_0x967b('0x24'),_0x423611);logger['debug']('UpdateVoiceQueueReport',_0x423611,JSON['stringify'](_0x5db460));_0x409533(_0x5db460);})[_0x967b('0x15')](function(_0x5787fd){logger['error'](_0x967b('0x24'),_0x5787fd[_0x967b('0x14')],_0x423611);_0x35e099(_0x54fa6d['error'](0x1f4,_0x5787fd['message']));});});}; \ No newline at end of file +var _0x25fe=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueueReport.socket','register','request','then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x25fe,0xa7));var _0xe25f=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0x25fe[_0x3f465d];return _0x121ad1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe25f('0x0'));var rs=require(_0xe25f('0x1'));var fs=require('fs');var Redis=require(_0xe25f('0x2'));var db=require(_0xe25f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe25f('0x4'))(_0xe25f('0x5'));var config=require(_0xe25f('0x6'));var jayson=require(_0xe25f('0x7'));var client=jayson[_0xe25f('0x8')][_0xe25f('0x9')]({'port':0x232a});config[_0xe25f('0xa')]=_[_0xe25f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe25f('0xc'))[_0xe25f('0xd')](socket);function respondWithRpcPromise(_0x50a766,_0x4f551d,_0xa17725){return new BPromise(function(_0x10519e,_0x30b699){return client[_0xe25f('0xe')](_0x50a766,_0xa17725)[_0xe25f('0xf')](function(_0x189f9a){logger[_0xe25f('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x4f551d,'request\x20sent');logger[_0xe25f('0x11')](_0xe25f('0x12'),_0x4f551d,_0xe25f('0x13'),JSON[_0xe25f('0x14')](_0x189f9a));if(_0x189f9a[_0xe25f('0x15')]){if(_0x189f9a[_0xe25f('0x15')][_0xe25f('0x16')]===0x1f4){logger[_0xe25f('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4f551d,_0x189f9a[_0xe25f('0x15')]['message']);return _0x30b699(_0x189f9a[_0xe25f('0x15')][_0xe25f('0x17')]);}logger['error'](_0xe25f('0x18'),_0x4f551d,_0x189f9a[_0xe25f('0x15')][_0xe25f('0x17')]);return _0x10519e(_0x189f9a[_0xe25f('0x15')][_0xe25f('0x17')]);}else{logger[_0xe25f('0x10')](_0xe25f('0x18'),_0x4f551d,_0xe25f('0x13'));_0x10519e(_0x189f9a[_0xe25f('0x19')][_0xe25f('0x17')]);}})[_0xe25f('0x1a')](function(_0xa50d4){logger[_0xe25f('0x15')](_0xe25f('0x18'),_0x4f551d,_0xa50d4);_0x30b699(_0xa50d4);});});}exports[_0xe25f('0x1b')]=function(_0x27670a){var _0x50bdea=this;return new Promise(function(_0x124b64,_0x554b83){return db[_0xe25f('0x1c')][_0xe25f('0x1d')]({'raw':_0x27670a['options']?_0x27670a[_0xe25f('0x1e')][_0xe25f('0x1f')]===undefined?!![]:![]:!![],'where':_0x27670a[_0xe25f('0x1e')]?_0x27670a[_0xe25f('0x1e')][_0xe25f('0x20')]||null:null,'attributes':_0x27670a[_0xe25f('0x1e')]?_0x27670a[_0xe25f('0x1e')][_0xe25f('0x21')]||null:null,'limit':_0x27670a[_0xe25f('0x1e')]?_0x27670a[_0xe25f('0x1e')][_0xe25f('0x22')]||null:null,'include':_0x27670a[_0xe25f('0x1e')]?_0x27670a['options']['include']?_[_0xe25f('0x23')](_0x27670a[_0xe25f('0x1e')][_0xe25f('0x24')],function(_0x5cd56e){return{'model':db[_0x5cd56e[_0xe25f('0x25')]],'as':_0x5cd56e['as'],'attributes':_0x5cd56e[_0xe25f('0x21')],'include':_0x5cd56e[_0xe25f('0x24')]?_['map'](_0x5cd56e['include'],function(_0x55d74d){return{'model':db[_0x55d74d['model']],'as':_0x55d74d['as'],'attributes':_0x55d74d['attributes'],'include':_0x55d74d['include']?_[_0xe25f('0x23')](_0x55d74d[_0xe25f('0x24')],function(_0x11e030){return{'model':db[_0x11e030[_0xe25f('0x25')]],'as':_0x11e030['as'],'attributes':_0x11e030['attributes']};}):[]};}):[]};}):[]:[]})[_0xe25f('0xf')](function(_0x18060c){logger[_0xe25f('0x10')](_0xe25f('0x1b'),_0x27670a);logger[_0xe25f('0x11')](_0xe25f('0x1b'),_0x27670a,JSON[_0xe25f('0x14')](_0x18060c));_0x124b64(_0x18060c);})[_0xe25f('0x1a')](function(_0x5046fe){logger[_0xe25f('0x15')]('GetVoiceQueueReport',_0x5046fe[_0xe25f('0x17')],_0x27670a);_0x554b83(_0x50bdea[_0xe25f('0x15')](0x1f4,_0x5046fe[_0xe25f('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x818678){var _0x5f2c58=this;return new Promise(function(_0x40c1ef,_0x41959d){return db[_0xe25f('0x1c')][_0xe25f('0x26')](_0x818678[_0xe25f('0x27')],{'raw':_0x818678[_0xe25f('0x1e')]?_0x818678['options'][_0xe25f('0x1f')]===undefined?!![]:![]:!![]})[_0xe25f('0xf')](function(_0x17c45e){logger[_0xe25f('0x10')](_0xe25f('0x28'),_0x818678);logger[_0xe25f('0x11')](_0xe25f('0x28'),_0x818678,JSON['stringify'](_0x17c45e));_0x40c1ef(_0x17c45e);})[_0xe25f('0x1a')](function(_0x55c16e){logger[_0xe25f('0x15')]('CreateVoiceQueueReport',_0x55c16e[_0xe25f('0x17')],_0x818678);_0x41959d(_0x5f2c58['error'](0x1f4,_0x55c16e['message']));});});};exports[_0xe25f('0x29')]=function(_0x21c03d){var _0x40c3b8=this;return new Promise(function(_0x551bd6,_0x19e418){return db[_0xe25f('0x1c')][_0xe25f('0x2a')](_0x21c03d[_0xe25f('0x27')],{'raw':_0x21c03d[_0xe25f('0x1e')]?_0x21c03d[_0xe25f('0x1e')][_0xe25f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21c03d[_0xe25f('0x1e')]?_0x21c03d[_0xe25f('0x1e')][_0xe25f('0x20')]||null:null,'attributes':_0x21c03d[_0xe25f('0x1e')]?_0x21c03d['options']['attributes']||null:null,'limit':_0x21c03d[_0xe25f('0x1e')]?_0x21c03d[_0xe25f('0x1e')][_0xe25f('0x22')]||null:null})[_0xe25f('0xf')](function(_0x508346){logger[_0xe25f('0x10')](_0xe25f('0x29'),_0x21c03d);logger[_0xe25f('0x11')](_0xe25f('0x29'),_0x21c03d,JSON['stringify'](_0x508346));_0x551bd6(_0x508346);})['catch'](function(_0x2162d1){logger['error'](_0xe25f('0x29'),_0x2162d1[_0xe25f('0x17')],_0x21c03d);_0x19e418(_0x40c3b8[_0xe25f('0x15')](0x1f4,_0x2162d1['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3fd5324..f634437 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 _0x7bae=['remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x460ddb,_0x23b655){var _0x5a4fa0=function(_0x74989){while(--_0x74989){_0x460ddb['push'](_0x460ddb['shift']());}};_0x5a4fa0(++_0x23b655);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7bae[_0x3b380d];return _0x54502b;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xe7ba('0x0'),_0xe7ba('0x1')];function createListener(_0x503803,_0x3963c7){return function(_0x4f2e91){_0x3963c7[_0xe7ba('0x2')](_0x503803,_0x4f2e91);};}function removeListener(_0x10908b,_0x166acb){return function(){VoiceQueueReportEvents[_0xe7ba('0x3')](_0x10908b,_0x166acb);};}exports[_0xe7ba('0x4')]=function(_0xfd3a22){for(var _0x2d31df=0x0,_0x3c5e59=events[_0xe7ba('0x5')];_0x2d31df<_0x3c5e59;_0x2d31df++){var _0x34fb18=events[_0x2d31df];var _0x160565=createListener(_0xe7ba('0x6')+_0x34fb18,_0xfd3a22);VoiceQueueReportEvents['on'](_0x34fb18,_0x160565);}}; \ No newline at end of file +var _0x6e12=['emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x396c2a,_0x2491c2){var _0xdb19de=function(_0x5ea15e){while(--_0x5ea15e){_0x396c2a['push'](_0x396c2a['shift']());}};_0xdb19de(++_0x2491c2);}(_0x6e12,0x154));var _0x26e1=function(_0x14b748,_0x598b8b){_0x14b748=_0x14b748-0x0;var _0x3c351c=_0x6e12[_0x14b748];return _0x3c351c;};'use strict';var VoiceQueueReportEvents=require(_0x26e1('0x0'));var events=[_0x26e1('0x1'),_0x26e1('0x2'),_0x26e1('0x3')];function createListener(_0x5f2f9c,_0x5dfba5){return function(_0x374765){_0x5dfba5[_0x26e1('0x4')](_0x5f2f9c,_0x374765);};}function removeListener(_0x47f8ce,_0x4f55d8){return function(){VoiceQueueReportEvents[_0x26e1('0x5')](_0x47f8ce,_0x4f55d8);};}exports[_0x26e1('0x6')]=function(_0x18467c){for(var _0x2073c9=0x0,_0xb8941a=events['length'];_0x2073c9<_0xb8941a;_0x2073c9++){var _0x3d543a=events[_0x2073c9];var _0x3e594f=createListener(_0x26e1('0x7')+_0x3d543a,_0x18467c);VoiceQueueReportEvents['on'](_0x3d543a,_0x3e594f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d8eb237..e2e261c 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 _0xc47e=['show','post','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x391830,_0x5d39fd){var _0x13aa32=function(_0x2cd604){while(--_0x2cd604){_0x391830['push'](_0x391830['shift']());}};_0x13aa32(++_0x5d39fd);}(_0xc47e,0x17b));var _0xec47=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0xc47e[_0x59ee41];return _0x3ecd3e;};'use strict';var multer=require(_0xec47('0x0'));var util=require('util');var path=require(_0xec47('0x1'));var timeout=require(_0xec47('0x2'));var express=require(_0xec47('0x3'));var router=express[_0xec47('0x4')]();var fs_extra=require(_0xec47('0x5'));var auth=require(_0xec47('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xec47('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0xec47('0x8')]('/',auth[_0xec47('0x9')](),controller[_0xec47('0xa')]);router['get'](_0xec47('0xb'),auth[_0xec47('0x9')](),controller[_0xec47('0xc')]);router[_0xec47('0xd')]('/',auth[_0xec47('0x9')](),controller['create']);router[_0xec47('0xe')](_0xec47('0xb'),auth[_0xec47('0x9')](),controller[_0xec47('0xf')]);router['delete'](_0xec47('0xb'),auth[_0xec47('0x9')](),controller['destroy']);module[_0xec47('0x10')]=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','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3f78ea,_0x33712a){var _0x5a512a=function(_0x1b2ebe){while(--_0x1b2ebe){_0x3f78ea['push'](_0x3f78ea['shift']());}};_0x5a512a(++_0x33712a);}(_0xedd9,0xfc));var _0x9edd=function(_0x20f57c,_0x566872){_0x20f57c=_0x20f57c-0x0;var _0x4b857b=_0xedd9[_0x20f57c];return _0x4b857b;};'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/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6de22d1..c2d15e5 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 _0x0140=['STRING','sequelize','moment','exports'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x0140,0x1d5));var _0x0014=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x0140[_0x305b20];return _0x26d64a;};'use strict';var Sequelize=require(_0x0014('0x0'));var moment=require(_0x0014('0x1'));module[_0x0014('0x2')]={'time':{'type':Sequelize[_0x0014('0x3')]},'callid':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0014('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xcf98=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x470291,_0x1ce9b4){var _0x398a4e=function(_0x1962f8){while(--_0x1962f8){_0x470291['push'](_0x470291['shift']());}};_0x398a4e(++_0x1ce9b4);}(_0xcf98,0x8d));var _0x8cf9=function(_0xdc8cba,_0x1d32b3){_0xdc8cba=_0xdc8cba-0x0;var _0x5d0147=_0xcf98[_0xdc8cba];return _0x5d0147;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8cf9('0x0'));module[_0x8cf9('0x1')]={'time':{'type':Sequelize[_0x8cf9('0x2')]},'callid':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8cf9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x8cf9('0x3')],'allowNull':![],'defaultValue':moment()[_0x8cf9('0x4')](_0x8cf9('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 3a6afd9..e2e5f00 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 _0xcd78=['where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort'];(function(_0x159d65,_0x31c36d){var _0x268eac=function(_0x3965ec){while(--_0x3965ec){_0x159d65['push'](_0x159d65['shift']());}};_0x268eac(++_0x31c36d);}(_0xcd78,0x1b4));var _0x8cd7=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0xcd78[_0x5b1c50];return _0x2d379b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cd7('0x0'));var zipdir=require(_0x8cd7('0x1'));var jsonpatch=require(_0x8cd7('0x2'));var rp=require('request-promise');var moment=require(_0x8cd7('0x3'));var BPromise=require(_0x8cd7('0x4'));var Mustache=require('mustache');var util=require(_0x8cd7('0x5'));var path=require(_0x8cd7('0x6'));var sox=require(_0x8cd7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cd7('0x8'));var _=require('lodash');var squel=require(_0x8cd7('0x9'));var crypto=require(_0x8cd7('0xa'));var jsforce=require(_0x8cd7('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8cd7('0xc'));var Papa=require(_0x8cd7('0xd'));var Redis=require(_0x8cd7('0xe'));var authService=require(_0x8cd7('0xf'));var qs=require(_0x8cd7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cd7('0x11'))(_0x8cd7('0x12'));var utils=require('../../config/utils');var config=require(_0x8cd7('0x13'));var licenseUtil=require(_0x8cd7('0x14'));var db=require(_0x8cd7('0x15'))['db'];function respondWithStatusCode(_0x1486d8,_0x3cdc00){_0x3cdc00=_0x3cdc00||0xcc;return function(_0x18c367){if(_0x18c367){return _0x1486d8[_0x8cd7('0x16')](_0x3cdc00);}return _0x1486d8['status'](_0x3cdc00)[_0x8cd7('0x17')]();};}function respondWithResult(_0x2c917a,_0x397831){_0x397831=_0x397831||0xc8;return function(_0x454d5f){if(_0x454d5f){return _0x2c917a[_0x8cd7('0x18')](_0x397831)['json'](_0x454d5f);}};}function respondWithFilteredResult(_0x23bfe4,_0x2757ba){return function(_0x5eaf93){if(_0x5eaf93){var _0x2337af=typeof _0x2757ba[_0x8cd7('0x19')]===_0x8cd7('0x1a')&&typeof _0x2757ba[_0x8cd7('0x1b')]==='undefined';var _0x249f15=_0x5eaf93[_0x8cd7('0x1c')];var _0x1e17da=_0x2337af?0x0:_0x2757ba[_0x8cd7('0x19')];var _0x147d56=_0x2337af?_0x5eaf93[_0x8cd7('0x1c')]:_0x2757ba['offset']+_0x2757ba[_0x8cd7('0x1b')];var _0x9825fa;if(_0x147d56>=_0x249f15){_0x147d56=_0x249f15;_0x9825fa=0xc8;}else{_0x9825fa=0xce;}_0x23bfe4['status'](_0x9825fa);return _0x23bfe4[_0x8cd7('0x1d')](_0x8cd7('0x1e'),_0x1e17da+'-'+_0x147d56+'/'+_0x249f15)[_0x8cd7('0x1f')](_0x5eaf93);}return null;};}function patchUpdates(_0x4daa97){return function(_0x5915f6){try{jsonpatch['apply'](_0x5915f6,_0x4daa97,!![]);}catch(_0x2b66a5){return BPromise['reject'](_0x2b66a5);}return _0x5915f6['save']();};}function saveUpdates(_0xeabb10,_0x595546){return function(_0x34ec9b){if(_0x34ec9b){return _0x34ec9b[_0x8cd7('0x20')](_0xeabb10)[_0x8cd7('0x21')](function(_0xcd9b95){return _0xcd9b95;});}return null;};}function removeEntity(_0x49891e,_0x1befaa){return function(_0x308956){if(_0x308956){return _0x308956[_0x8cd7('0x22')]()[_0x8cd7('0x21')](function(){_0x49891e['status'](0xcc)[_0x8cd7('0x17')]();});}};}function handleEntityNotFound(_0x583460,_0x166402){return function(_0xfa6412){if(!_0xfa6412){_0x583460[_0x8cd7('0x16')](0x194);}return _0xfa6412;};}function handleError(_0x590519,_0x12d232){_0x12d232=_0x12d232||0x1f4;return function(_0xb76721){logger[_0x8cd7('0x23')](_0xb76721[_0x8cd7('0x24')]);if(_0xb76721[_0x8cd7('0x25')]){delete _0xb76721[_0x8cd7('0x25')];}_0x590519[_0x8cd7('0x18')](_0x12d232)[_0x8cd7('0x26')](_0xb76721);};}exports[_0x8cd7('0x27')]=function(_0x1f1e65,_0x29edfe){var _0x20b353={},_0x1f34ca={},_0x35036d={'count':0x0,'rows':[]};var _0x476216=_[_0x8cd7('0x28')](db[_0x8cd7('0x29')][_0x8cd7('0x2a')],function(_0x3237e7){return{'name':_0x3237e7['fieldName'],'type':_0x3237e7['type'][_0x8cd7('0x2b')]};});_0x1f34ca['model']=_[_0x8cd7('0x28')](_0x476216,_0x8cd7('0x25'));_0x1f34ca[_0x8cd7('0x2c')]=_[_0x8cd7('0x2d')](_0x1f1e65['query']);_0x1f34ca['filters']=_[_0x8cd7('0x2e')](_0x1f34ca['model'],_0x1f34ca[_0x8cd7('0x2c')]);_0x20b353[_0x8cd7('0x2f')]=_['intersection'](_0x1f34ca['model'],qs[_0x8cd7('0x30')](_0x1f1e65[_0x8cd7('0x2c')][_0x8cd7('0x30')]));_0x20b353['attributes']=_0x20b353[_0x8cd7('0x2f')][_0x8cd7('0x31')]?_0x20b353[_0x8cd7('0x2f')]:_0x1f34ca[_0x8cd7('0x32')];if(!_0x1f1e65['query'][_0x8cd7('0x33')]('nolimit')){_0x20b353['limit']=qs[_0x8cd7('0x1b')](_0x1f1e65[_0x8cd7('0x2c')][_0x8cd7('0x1b')]);_0x20b353[_0x8cd7('0x19')]=qs['offset'](_0x1f1e65[_0x8cd7('0x2c')][_0x8cd7('0x19')]);}_0x20b353[_0x8cd7('0x34')]=qs[_0x8cd7('0x35')](_0x1f1e65['query']['sort']);_0x20b353[_0x8cd7('0x36')]=qs['filters'](_['pick'](_0x1f1e65[_0x8cd7('0x2c')],_0x1f34ca[_0x8cd7('0x37')]),_0x476216);if(_0x1f1e65[_0x8cd7('0x2c')]['filter']){_0x20b353['where']=_[_0x8cd7('0x38')](_0x20b353[_0x8cd7('0x36')],{'$or':_['map'](_0x476216,function(_0x22f2e4){if(_0x22f2e4[_0x8cd7('0x39')]!==_0x8cd7('0x3a')){var _0x3660e1={};_0x3660e1[_0x22f2e4[_0x8cd7('0x25')]]={'$like':'%'+_0x1f1e65[_0x8cd7('0x2c')][_0x8cd7('0x3b')]+'%'};return _0x3660e1;}})});}_0x20b353=_[_0x8cd7('0x38')]({},_0x20b353,_0x1f1e65[_0x8cd7('0x3c')]);var _0x4f1ad2={'where':_0x20b353[_0x8cd7('0x36')]};return db[_0x8cd7('0x29')][_0x8cd7('0x1c')](_0x4f1ad2)['then'](function(_0x4827ac){_0x35036d[_0x8cd7('0x1c')]=_0x4827ac;if(_0x1f1e65[_0x8cd7('0x2c')][_0x8cd7('0x3d')]){_0x20b353[_0x8cd7('0x3e')]=[{'all':!![]}];}return db[_0x8cd7('0x29')][_0x8cd7('0x3f')](_0x20b353);})['then'](function(_0x27c3e5){_0x35036d[_0x8cd7('0x40')]=_0x27c3e5;return _0x35036d;})['then'](respondWithFilteredResult(_0x29edfe,_0x20b353))[_0x8cd7('0x41')](handleError(_0x29edfe,null));};exports[_0x8cd7('0x42')]=function(_0xdfa5b4,_0x13a893){var _0x272754={'raw':!![],'where':{'id':_0xdfa5b4[_0x8cd7('0x43')]['id']}},_0x18941d={};_0x18941d[_0x8cd7('0x32')]=_[_0x8cd7('0x2d')](db[_0x8cd7('0x29')]['rawAttributes']);_0x18941d['query']=_['keys'](_0xdfa5b4['query']);_0x18941d['filters']=_[_0x8cd7('0x2e')](_0x18941d[_0x8cd7('0x32')],_0x18941d[_0x8cd7('0x2c')]);_0x272754[_0x8cd7('0x2f')]=_['intersection'](_0x18941d['model'],qs['fields'](_0xdfa5b4[_0x8cd7('0x2c')][_0x8cd7('0x30')]));_0x272754['attributes']=_0x272754[_0x8cd7('0x2f')][_0x8cd7('0x31')]?_0x272754[_0x8cd7('0x2f')]:_0x18941d[_0x8cd7('0x32')];if(_0xdfa5b4['query'][_0x8cd7('0x3d')]){_0x272754[_0x8cd7('0x3e')]=[{'all':!![]}];}_0x272754=_[_0x8cd7('0x38')]({},_0x272754,_0xdfa5b4[_0x8cd7('0x3c')]);return db[_0x8cd7('0x29')][_0x8cd7('0x44')](_0x272754)['then'](handleEntityNotFound(_0x13a893,null))[_0x8cd7('0x21')](respondWithResult(_0x13a893,null))[_0x8cd7('0x41')](handleError(_0x13a893,null));};exports['create']=function(_0x13fa6b,_0x274ffc){return db[_0x8cd7('0x29')]['create'](_0x13fa6b[_0x8cd7('0x45')],{})['then'](respondWithResult(_0x274ffc,0xc9))['catch'](handleError(_0x274ffc,null));};exports[_0x8cd7('0x20')]=function(_0x2fe14c,_0x2db77c){if(_0x2fe14c[_0x8cd7('0x45')]['id']){delete _0x2fe14c['body']['id'];}return db[_0x8cd7('0x29')]['find']({'where':{'id':_0x2fe14c['params']['id']}})['then'](handleEntityNotFound(_0x2db77c,null))[_0x8cd7('0x21')](saveUpdates(_0x2fe14c[_0x8cd7('0x45')],null))[_0x8cd7('0x21')](respondWithResult(_0x2db77c,null))[_0x8cd7('0x41')](handleError(_0x2db77c,null));};exports[_0x8cd7('0x22')]=function(_0x5c8f4a,_0x39acf1){return db[_0x8cd7('0x29')][_0x8cd7('0x44')]({'where':{'id':_0x5c8f4a[_0x8cd7('0x43')]['id']}})[_0x8cd7('0x21')](handleEntityNotFound(_0x39acf1,null))[_0x8cd7('0x21')](removeEntity(_0x39acf1,null))[_0x8cd7('0x41')](handleError(_0x39acf1,null));}; \ No newline at end of file +var _0x6f70=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','params','include','catch','create','VoiceQueuesLog','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1e23b8,_0x4690f9){var _0x11f0f3=function(_0x4f2718){while(--_0x4f2718){_0x1e23b8['push'](_0x1e23b8['shift']());}};_0x11f0f3(++_0x4690f9);}(_0x6f70,0x118));var _0x06f7=function(_0x3a7bd6,_0x9b848a){_0x3a7bd6=_0x3a7bd6-0x0;var _0x57df96=_0x6f70[_0x3a7bd6];return _0x57df96;};'use strict';var emlformat=require(_0x06f7('0x0'));var rimraf=require(_0x06f7('0x1'));var zipdir=require(_0x06f7('0x2'));var jsonpatch=require(_0x06f7('0x3'));var rp=require('request-promise');var moment=require(_0x06f7('0x4'));var BPromise=require(_0x06f7('0x5'));var Mustache=require(_0x06f7('0x6'));var util=require(_0x06f7('0x7'));var path=require(_0x06f7('0x8'));var sox=require(_0x06f7('0x9'));var csv=require('to-csv');var ejs=require(_0x06f7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06f7('0xb'));var squel=require(_0x06f7('0xc'));var crypto=require('crypto');var jsforce=require(_0x06f7('0xd'));var deskjs=require(_0x06f7('0xe'));var toCsv=require(_0x06f7('0xf'));var querystring=require('querystring');var Papa=require(_0x06f7('0x10'));var Redis=require(_0x06f7('0x11'));var authService=require(_0x06f7('0x12'));var qs=require(_0x06f7('0x13'));var as=require(_0x06f7('0x14'));var hardwareService=require(_0x06f7('0x15'));var logger=require(_0x06f7('0x16'))(_0x06f7('0x17'));var utils=require('../../config/utils');var config=require(_0x06f7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x06f7('0x19'))['db'];function respondWithStatusCode(_0x2036ca,_0x3344e4){_0x3344e4=_0x3344e4||0xcc;return function(_0x3e88cb){if(_0x3e88cb){return _0x2036ca[_0x06f7('0x1a')](_0x3344e4);}return _0x2036ca['status'](_0x3344e4)[_0x06f7('0x1b')]();};}function respondWithResult(_0x403752,_0x1002a5){_0x1002a5=_0x1002a5||0xc8;return function(_0x1b5291){if(_0x1b5291){return _0x403752[_0x06f7('0x1c')](_0x1002a5)[_0x06f7('0x1d')](_0x1b5291);}};}function respondWithFilteredResult(_0x40da2b,_0x35a91e){return function(_0x4d7504){if(_0x4d7504){var _0xf381c8=typeof _0x35a91e[_0x06f7('0x1e')]===_0x06f7('0x1f')&&typeof _0x35a91e[_0x06f7('0x20')]===_0x06f7('0x1f');var _0x594e20=_0x4d7504[_0x06f7('0x21')];var _0x34f92f=_0xf381c8?0x0:_0x35a91e[_0x06f7('0x1e')];var _0x4b8be3=_0xf381c8?_0x4d7504['count']:_0x35a91e[_0x06f7('0x1e')]+_0x35a91e[_0x06f7('0x20')];var _0x296e77;if(_0x4b8be3>=_0x594e20){_0x4b8be3=_0x594e20;_0x296e77=0xc8;}else{_0x296e77=0xce;}_0x40da2b[_0x06f7('0x1c')](_0x296e77);return _0x40da2b[_0x06f7('0x22')]('Content-Range',_0x34f92f+'-'+_0x4b8be3+'/'+_0x594e20)[_0x06f7('0x1d')](_0x4d7504);}return null;};}function patchUpdates(_0x6fca08){return function(_0x412caf){try{jsonpatch[_0x06f7('0x23')](_0x412caf,_0x6fca08,!![]);}catch(_0x172e81){return BPromise[_0x06f7('0x24')](_0x172e81);}return _0x412caf[_0x06f7('0x25')]();};}function saveUpdates(_0x28db03,_0x4324fd){return function(_0x599934){if(_0x599934){return _0x599934[_0x06f7('0x26')](_0x28db03)[_0x06f7('0x27')](function(_0x2de701){return _0x2de701;});}return null;};}function removeEntity(_0x4bd846,_0x5526b8){return function(_0x3625e3){if(_0x3625e3){return _0x3625e3[_0x06f7('0x28')]()['then'](function(){_0x4bd846['status'](0xcc)[_0x06f7('0x1b')]();});}};}function handleEntityNotFound(_0x1ddb25,_0x126adf){return function(_0x26d20b){if(!_0x26d20b){_0x1ddb25[_0x06f7('0x1a')](0x194);}return _0x26d20b;};}function handleError(_0x1eda1b,_0x5d7dfd){_0x5d7dfd=_0x5d7dfd||0x1f4;return function(_0x99e45b){logger[_0x06f7('0x29')](_0x99e45b[_0x06f7('0x2a')]);if(_0x99e45b[_0x06f7('0x2b')]){delete _0x99e45b[_0x06f7('0x2b')];}_0x1eda1b['status'](_0x5d7dfd)[_0x06f7('0x2c')](_0x99e45b);};}exports[_0x06f7('0x2d')]=function(_0x55b458,_0x470b3b){var _0x1c92a9={},_0x4fbc61={},_0x1bb55a={'count':0x0,'rows':[]};var _0x16ecf5=_[_0x06f7('0x2e')](db['VoiceQueuesLog'][_0x06f7('0x2f')],function(_0x1254ca){return{'name':_0x1254ca[_0x06f7('0x30')],'type':_0x1254ca[_0x06f7('0x31')]['key']};});_0x4fbc61[_0x06f7('0x32')]=_[_0x06f7('0x2e')](_0x16ecf5,'name');_0x4fbc61[_0x06f7('0x33')]=_[_0x06f7('0x34')](_0x55b458[_0x06f7('0x33')]);_0x4fbc61[_0x06f7('0x35')]=_[_0x06f7('0x36')](_0x4fbc61[_0x06f7('0x32')],_0x4fbc61[_0x06f7('0x33')]);_0x1c92a9[_0x06f7('0x37')]=_[_0x06f7('0x36')](_0x4fbc61[_0x06f7('0x32')],qs[_0x06f7('0x38')](_0x55b458[_0x06f7('0x33')][_0x06f7('0x38')]));_0x1c92a9['attributes']=_0x1c92a9[_0x06f7('0x37')][_0x06f7('0x39')]?_0x1c92a9[_0x06f7('0x37')]:_0x4fbc61[_0x06f7('0x32')];if(!_0x55b458[_0x06f7('0x33')][_0x06f7('0x3a')](_0x06f7('0x3b'))){_0x1c92a9['limit']=qs['limit'](_0x55b458[_0x06f7('0x33')][_0x06f7('0x20')]);_0x1c92a9[_0x06f7('0x1e')]=qs['offset'](_0x55b458[_0x06f7('0x33')]['offset']);}_0x1c92a9[_0x06f7('0x3c')]=qs['sort'](_0x55b458[_0x06f7('0x33')][_0x06f7('0x3d')]);_0x1c92a9['where']=qs['filters'](_['pick'](_0x55b458[_0x06f7('0x33')],_0x4fbc61['filters']),_0x16ecf5);if(_0x55b458['query'][_0x06f7('0x3e')]){_0x1c92a9['where']=_[_0x06f7('0x3f')](_0x1c92a9['where'],{'$or':_[_0x06f7('0x2e')](_0x16ecf5,function(_0x535b70){if(_0x535b70['type']!==_0x06f7('0x40')){var _0x409d5b={};_0x409d5b[_0x535b70['name']]={'$like':'%'+_0x55b458[_0x06f7('0x33')]['filter']+'%'};return _0x409d5b;}})});}_0x1c92a9=_[_0x06f7('0x3f')]({},_0x1c92a9,_0x55b458[_0x06f7('0x41')]);var _0x44d8aa={'where':_0x1c92a9[_0x06f7('0x42')]};return db['VoiceQueuesLog'][_0x06f7('0x21')](_0x44d8aa)['then'](function(_0x24fda6){_0x1bb55a[_0x06f7('0x21')]=_0x24fda6;if(_0x55b458['query'][_0x06f7('0x43')]){_0x1c92a9['include']=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x1c92a9);})[_0x06f7('0x27')](function(_0x45eafc){_0x1bb55a['rows']=_0x45eafc;return _0x1bb55a;})[_0x06f7('0x27')](respondWithFilteredResult(_0x470b3b,_0x1c92a9))['catch'](handleError(_0x470b3b,null));};exports['show']=function(_0x35394f,_0x180414){var _0x4de3aa={'raw':!![],'where':{'id':_0x35394f[_0x06f7('0x44')]['id']}},_0x25ac04={};_0x25ac04[_0x06f7('0x32')]=_[_0x06f7('0x34')](db['VoiceQueuesLog'][_0x06f7('0x2f')]);_0x25ac04[_0x06f7('0x33')]=_['keys'](_0x35394f['query']);_0x25ac04[_0x06f7('0x35')]=_[_0x06f7('0x36')](_0x25ac04['model'],_0x25ac04[_0x06f7('0x33')]);_0x4de3aa[_0x06f7('0x37')]=_[_0x06f7('0x36')](_0x25ac04[_0x06f7('0x32')],qs[_0x06f7('0x38')](_0x35394f[_0x06f7('0x33')][_0x06f7('0x38')]));_0x4de3aa['attributes']=_0x4de3aa['attributes'][_0x06f7('0x39')]?_0x4de3aa['attributes']:_0x25ac04['model'];if(_0x35394f[_0x06f7('0x33')][_0x06f7('0x43')]){_0x4de3aa[_0x06f7('0x45')]=[{'all':!![]}];}_0x4de3aa=_['merge']({},_0x4de3aa,_0x35394f[_0x06f7('0x41')]);return db['VoiceQueuesLog']['find'](_0x4de3aa)['then'](handleEntityNotFound(_0x180414,null))[_0x06f7('0x27')](respondWithResult(_0x180414,null))[_0x06f7('0x46')](handleError(_0x180414,null));};exports[_0x06f7('0x47')]=function(_0x59d194,_0x501804){return db[_0x06f7('0x48')]['create'](_0x59d194[_0x06f7('0x49')],{})[_0x06f7('0x27')](respondWithResult(_0x501804,0xc9))['catch'](handleError(_0x501804,null));};exports[_0x06f7('0x26')]=function(_0x3b472f,_0x3f4f85){if(_0x3b472f[_0x06f7('0x49')]['id']){delete _0x3b472f['body']['id'];}return db[_0x06f7('0x48')]['find']({'where':{'id':_0x3b472f[_0x06f7('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f4f85,null))[_0x06f7('0x27')](saveUpdates(_0x3b472f[_0x06f7('0x49')],null))[_0x06f7('0x27')](respondWithResult(_0x3f4f85,null))[_0x06f7('0x46')](handleError(_0x3f4f85,null));};exports['destroy']=function(_0x598833,_0x2fc80d){return db[_0x06f7('0x48')][_0x06f7('0x4a')]({'where':{'id':_0x598833[_0x06f7('0x44')]['id']}})[_0x06f7('0x27')](handleEntityNotFound(_0x2fc80d,null))[_0x06f7('0x27')](removeEntity(_0x2fc80d,null))[_0x06f7('0x46')](handleError(_0x2fc80d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9a61331..2f6d063 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 _0x8275=['bluebird','request-promise','path','../../config/environment','exports','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x295e52,_0x5d8ec1){var _0x3cddff=function(_0x191cd5){while(--_0x191cd5){_0x295e52['push'](_0x295e52['shift']());}};_0x3cddff(++_0x5d8ec1);}(_0x8275,0x87));var _0x5827=function(_0x59f981,_0x497e5f){_0x59f981=_0x59f981-0x0;var _0x3f458c=_0x8275[_0x59f981];return _0x3f458c;};'use strict';var _=require(_0x5827('0x0'));var util=require(_0x5827('0x1'));var logger=require(_0x5827('0x2'))(_0x5827('0x3'));var moment=require(_0x5827('0x4'));var BPromise=require(_0x5827('0x5'));var rp=require(_0x5827('0x6'));var fs=require('fs');var path=require(_0x5827('0x7'));var rimraf=require('rimraf');var config=require(_0x5827('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x5827('0x9')]=function(_0x43777f,_0x8182ab){return _0x43777f['define'](_0x5827('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5827('0xb'),'fields':[_0x5827('0xc'),_0x5827('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4554=['request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','event_dtm','event','dtm','lodash','../../config/logger','bluebird'];(function(_0x5c0dd9,_0x543e97){var _0x51b27e=function(_0x188c6d){while(--_0x188c6d){_0x5c0dd9['push'](_0x5c0dd9['shift']());}};_0x51b27e(++_0x543e97);}(_0x4554,0x1e1));var _0x4455=function(_0xc64c3f,_0x58cbf0){_0xc64c3f=_0xc64c3f-0x0;var _0x591f1b=_0x4554[_0xc64c3f];return _0x591f1b;};'use strict';var _=require(_0x4455('0x0'));var util=require('util');var logger=require(_0x4455('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4455('0x2'));var rp=require(_0x4455('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4455('0x4'));var config=require(_0x4455('0x5'));var attributes=require(_0x4455('0x6'));module['exports']=function(_0xfe7beb,_0x4e9cae){return _0xfe7beb[_0x4455('0x7')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x4455('0x8'),'fields':[_0x4455('0x9'),_0x4455('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9a58a66..c7d76ba 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 _0xd0b5=['request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x62490d,_0x4d5df5){_0x62490d=_0x62490d-0x0;var _0x5b5e17=_0xd0b5[_0x62490d];return _0x5b5e17;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5d0b('0x0'));var BPromise=require(_0x5d0b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d0b('0x2'));var db=require(_0x5d0b('0x3'))['db'];var utils=require(_0x5d0b('0x4'));var logger=require(_0x5d0b('0x5'))(_0x5d0b('0x6'));var config=require(_0x5d0b('0x7'));var jayson=require(_0x5d0b('0x8'));var client=jayson[_0x5d0b('0x9')][_0x5d0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db3b1,_0x2582f3,_0x1407d6){return new BPromise(function(_0x226be8,_0x59be08){return client[_0x5d0b('0xb')](_0x1db3b1,_0x1407d6)['then'](function(_0x5550fa){logger[_0x5d0b('0xc')](_0x5d0b('0xd'),_0x2582f3,'request\x20sent');logger[_0x5d0b('0xe')](_0x5d0b('0xf'),_0x2582f3,'request\x20sent',JSON[_0x5d0b('0x10')](_0x5550fa));if(_0x5550fa[_0x5d0b('0x11')]){if(_0x5550fa[_0x5d0b('0x11')][_0x5d0b('0x12')]===0x1f4){logger[_0x5d0b('0x11')](_0x5d0b('0xd'),_0x2582f3,_0x5550fa['error'][_0x5d0b('0x13')]);return _0x59be08(_0x5550fa[_0x5d0b('0x11')][_0x5d0b('0x13')]);}logger[_0x5d0b('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2582f3,_0x5550fa[_0x5d0b('0x11')][_0x5d0b('0x13')]);return _0x226be8(_0x5550fa['error'][_0x5d0b('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x2582f3,_0x5d0b('0x14'));_0x226be8(_0x5550fa[_0x5d0b('0x15')][_0x5d0b('0x13')]);}})[_0x5d0b('0x16')](function(_0x4892a4){logger[_0x5d0b('0x11')](_0x5d0b('0xd'),_0x2582f3,_0x4892a4);_0x59be08(_0x4892a4);});});} \ No newline at end of file +var _0x04cc=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x04cc,0x1bf));var _0xc04c=function(_0x52dc13,_0x5813c2){_0x52dc13=_0x52dc13-0x0;var _0x1143e7=_0x04cc[_0x52dc13];return _0x1143e7;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var moment=require(_0xc04c('0x2'));var BPromise=require(_0xc04c('0x3'));var rs=require(_0xc04c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc04c('0x5'))['db'];var utils=require(_0xc04c('0x6'));var logger=require(_0xc04c('0x7'))(_0xc04c('0x8'));var config=require(_0xc04c('0x9'));var jayson=require(_0xc04c('0xa'));var client=jayson[_0xc04c('0xb')][_0xc04c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14c0d7,_0x57c97e,_0x4dc02d){return new BPromise(function(_0x5d714e,_0x1b98e9){return client[_0xc04c('0xd')](_0x14c0d7,_0x4dc02d)[_0xc04c('0xe')](function(_0x18154d){logger[_0xc04c('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x57c97e,_0xc04c('0x10'));logger[_0xc04c('0x11')](_0xc04c('0x12'),_0x57c97e,'request\x20sent',JSON['stringify'](_0x18154d));if(_0x18154d[_0xc04c('0x13')]){if(_0x18154d[_0xc04c('0x13')]['code']===0x1f4){logger[_0xc04c('0x13')](_0xc04c('0x14'),_0x57c97e,_0x18154d[_0xc04c('0x13')][_0xc04c('0x15')]);return _0x1b98e9(_0x18154d['error'][_0xc04c('0x15')]);}logger[_0xc04c('0x13')](_0xc04c('0x14'),_0x57c97e,_0x18154d[_0xc04c('0x13')][_0xc04c('0x15')]);return _0x5d714e(_0x18154d[_0xc04c('0x13')][_0xc04c('0x15')]);}else{logger[_0xc04c('0xf')](_0xc04c('0x14'),_0x57c97e,_0xc04c('0x10'));_0x5d714e(_0x18154d[_0xc04c('0x16')]['message']);}})[_0xc04c('0x17')](function(_0x4f3564){logger['error'](_0xc04c('0x14'),_0x57c97e,_0x4f3564);_0x1b98e9(_0x4f3564);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e7d64d5..acc6a78 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 _0xe707=['put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','download','/:id/downloads','downloads','downloadTranscribe','create','post','/:id/transcribe','runTranscribe'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xe707,0x1e2));var _0x7e70=function(_0x14a95d,_0x56e575){_0x14a95d=_0x14a95d-0x0;var _0x21746c=_0xe707[_0x14a95d];return _0x21746c;};'use strict';var multer=require(_0x7e70('0x0'));var util=require(_0x7e70('0x1'));var path=require(_0x7e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e70('0x3'));var router=express[_0x7e70('0x4')]();var fs_extra=require(_0x7e70('0x5'));var auth=require(_0x7e70('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7e70('0x7'));var controller=require('./voiceRecording.controller');router[_0x7e70('0x8')]('/',auth['isAuthenticated'](),controller[_0x7e70('0x9')]);router[_0x7e70('0x8')](_0x7e70('0xa'),auth[_0x7e70('0xb')](),controller[_0x7e70('0xc')]);router[_0x7e70('0x8')]('/:id',auth[_0x7e70('0xb')](),controller[_0x7e70('0xd')]);router[_0x7e70('0x8')]('/:id/download',auth[_0x7e70('0xb')](),controller[_0x7e70('0xe')]);router[_0x7e70('0x8')](_0x7e70('0xf'),controller[_0x7e70('0x10')]);router[_0x7e70('0x8')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x7e70('0x11')]);router['post']('/',auth[_0x7e70('0xb')](),controller[_0x7e70('0x12')]);router[_0x7e70('0x13')](_0x7e70('0x14'),auth[_0x7e70('0xb')](),controller[_0x7e70('0x15')]);router[_0x7e70('0x16')](_0x7e70('0x17'),auth[_0x7e70('0xb')](),controller[_0x7e70('0x18')]);router[_0x7e70('0x19')](_0x7e70('0x17'),auth[_0x7e70('0xb')](),controller[_0x7e70('0x1a')]);module[_0x7e70('0x1b')]=router; \ No newline at end of file +var _0xbd35=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xbd35,0x148));var _0x5bd3=function(_0x4c6035,_0x293b14){_0x4c6035=_0x4c6035-0x0;var _0x4dc2b7=_0xbd35[_0x4c6035];return _0x4dc2b7;};'use strict';var multer=require(_0x5bd3('0x0'));var util=require(_0x5bd3('0x1'));var path=require(_0x5bd3('0x2'));var timeout=require(_0x5bd3('0x3'));var express=require(_0x5bd3('0x4'));var router=express[_0x5bd3('0x5')]();var fs_extra=require(_0x5bd3('0x6'));var auth=require(_0x5bd3('0x7'));var interaction=require(_0x5bd3('0x8'));var config=require(_0x5bd3('0x9'));var controller=require('./voiceRecording.controller');router[_0x5bd3('0xa')]('/',auth['isAuthenticated'](),controller[_0x5bd3('0xb')]);router[_0x5bd3('0xa')](_0x5bd3('0xc'),auth['isAuthenticated'](),controller[_0x5bd3('0xd')]);router[_0x5bd3('0xa')](_0x5bd3('0xe'),auth[_0x5bd3('0xf')](),controller[_0x5bd3('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router['get'](_0x5bd3('0x11'),controller['downloads']);router[_0x5bd3('0xa')](_0x5bd3('0x12'),auth['isAuthenticated'](),controller[_0x5bd3('0x13')]);router[_0x5bd3('0x14')]('/',auth[_0x5bd3('0xf')](),controller[_0x5bd3('0x15')]);router['post'](_0x5bd3('0x12'),auth['isAuthenticated'](),controller[_0x5bd3('0x16')]);router[_0x5bd3('0x17')](_0x5bd3('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5bd3('0xe'),auth[_0x5bd3('0xf')](),controller[_0x5bd3('0x18')]);module[_0x5bd3('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b7cdcab..89a0af9 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(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 2854cd5..8274cd4 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 _0x5310=['Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','format','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceRecording','includeAll','rows','catch','show','params','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','message','downloads','sequelize','col','$and','push','decryptFile','filename','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket'];(function(_0x5a07b2,_0xf92a84){var _0x3a1ee1=function(_0x2d7f37){while(--_0x2d7f37){_0x5a07b2['push'](_0x5a07b2['shift']());}};_0x3a1ee1(++_0xf92a84);}(_0x5310,0xb6));var _0x0531=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x5310[_0x5c6994];return _0x1d5c84;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0531('0x0'));var jsonpatch=require(_0x0531('0x1'));var rp=require(_0x0531('0x2'));var moment=require('moment');var BPromise=require(_0x0531('0x3'));var Mustache=require(_0x0531('0x4'));var util=require(_0x0531('0x5'));var path=require(_0x0531('0x6'));var sox=require(_0x0531('0x7'));var csv=require(_0x0531('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0531('0x9'));var crypto=require(_0x0531('0xa'));var jsforce=require(_0x0531('0xb'));var deskjs=require(_0x0531('0xc'));var toCsv=require(_0x0531('0x8'));var querystring=require(_0x0531('0xd'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x0531('0xe'));var Redis=require('ioredis');var authService=require(_0x0531('0xf'));var qs=require(_0x0531('0x10'));var as=require(_0x0531('0x11'));var hardwareService=require(_0x0531('0x12'));var logger=require('../../config/logger')(_0x0531('0x13'));var utils=require('../../config/utils');var config=require(_0x0531('0x14'));var licenseUtil=require(_0x0531('0x15'));var db=require(_0x0531('0x16'))['db'];function respondWithStatusCode(_0x4b4680,_0x42932b){_0x42932b=_0x42932b||0xcc;return function(_0x5746c0){if(_0x5746c0){return _0x4b4680[_0x0531('0x17')](_0x42932b);}return _0x4b4680['status'](_0x42932b)[_0x0531('0x18')]();};}function respondWithResult(_0x3f5b80,_0x3ad02e){_0x3ad02e=_0x3ad02e||0xc8;return function(_0x3602f5){if(_0x3602f5){return _0x3f5b80[_0x0531('0x19')](_0x3ad02e)[_0x0531('0x1a')](_0x3602f5);}};}function respondWithFilteredResult(_0x255cb2,_0x1f65ca){return function(_0x23f5b0){if(_0x23f5b0){var _0x32c6df=typeof _0x1f65ca[_0x0531('0x1b')]==='undefined'&&typeof _0x1f65ca[_0x0531('0x1c')]==='undefined';var _0x2b7666=_0x23f5b0['count'];var _0x5f19be=_0x32c6df?0x0:_0x1f65ca[_0x0531('0x1b')];var _0x1a2d59=_0x32c6df?_0x23f5b0[_0x0531('0x1d')]:_0x1f65ca[_0x0531('0x1b')]+_0x1f65ca[_0x0531('0x1c')];var _0x2af5f2;if(_0x1a2d59>=_0x2b7666){_0x1a2d59=_0x2b7666;_0x2af5f2=0xc8;}else{_0x2af5f2=0xce;}_0x255cb2['status'](_0x2af5f2);return _0x255cb2[_0x0531('0x1e')](_0x0531('0x1f'),_0x5f19be+'-'+_0x1a2d59+'/'+_0x2b7666)[_0x0531('0x1a')](_0x23f5b0);}return null;};}function patchUpdates(_0xaeb77c){return function(_0x1ac15e){try{jsonpatch[_0x0531('0x20')](_0x1ac15e,_0xaeb77c,!![]);}catch(_0x37d04c){return BPromise['reject'](_0x37d04c);}return _0x1ac15e['save']();};}function saveUpdates(_0x17702e,_0x19e779){return function(_0x327b95){if(_0x327b95){return _0x327b95[_0x0531('0x21')](_0x17702e)[_0x0531('0x22')](function(_0x2de9ab){return _0x2de9ab;});}return null;};}function removeEntity(_0x433fa0,_0x4fc42b){return function(_0x578e47){if(_0x578e47){return _0x578e47[_0x0531('0x23')]()[_0x0531('0x22')](function(){_0x433fa0[_0x0531('0x19')](0xcc)[_0x0531('0x18')]();});}};}function handleEntityNotFound(_0x28f7d1,_0x40beb9){return function(_0x409410){if(!_0x409410){_0x28f7d1[_0x0531('0x17')](0x194);}return _0x409410;};}function handleError(_0x1fa71e,_0x3099d5){_0x3099d5=_0x3099d5||0x1f4;return function(_0x2ab099){logger[_0x0531('0x24')](_0x2ab099[_0x0531('0x25')]);if(_0x2ab099[_0x0531('0x26')]){delete _0x2ab099[_0x0531('0x26')];}_0x1fa71e[_0x0531('0x19')](_0x3099d5)[_0x0531('0x27')](_0x2ab099);};}exports['index']=function(_0x1ef3f9,_0x5dcdf1){var _0x16d31a={},_0x38d77a={},_0x967ba={'count':0x0,'rows':[]};var _0x6f5b96=_[_0x0531('0x28')](db['VoiceRecording'][_0x0531('0x29')],function(_0x5f58b3){return{'name':_0x5f58b3[_0x0531('0x2a')],'type':_0x5f58b3[_0x0531('0x2b')][_0x0531('0x2c')]};});_0x38d77a['model']=_['differenceBy'](_[_0x0531('0x28')](_0x6f5b96,_0x0531('0x26')),[_0x0531('0x2d')]);_0x38d77a['query']=_[_0x0531('0x2e')](_0x1ef3f9[_0x0531('0x2f')]);_0x38d77a['filters']=_[_0x0531('0x30')](_0x38d77a[_0x0531('0x31')],_0x38d77a[_0x0531('0x2f')]);_0x16d31a['attributes']=_[_0x0531('0x30')](_0x38d77a['model'],qs['fields'](_0x1ef3f9[_0x0531('0x2f')][_0x0531('0x32')]));_0x16d31a['attributes']=_0x16d31a[_0x0531('0x33')][_0x0531('0x34')]?_0x16d31a[_0x0531('0x33')]:_0x38d77a[_0x0531('0x31')];if(!_0x1ef3f9[_0x0531('0x2f')][_0x0531('0x35')](_0x0531('0x36'))){_0x16d31a['limit']=qs[_0x0531('0x1c')](_0x1ef3f9[_0x0531('0x2f')][_0x0531('0x1c')]);_0x16d31a[_0x0531('0x1b')]=qs[_0x0531('0x1b')](_0x1ef3f9[_0x0531('0x2f')]['offset']);}_0x16d31a['order']=qs[_0x0531('0x37')](_0x1ef3f9[_0x0531('0x2f')][_0x0531('0x37')]);_0x16d31a[_0x0531('0x38')]=qs[_0x0531('0x39')](_[_0x0531('0x3a')](_0x1ef3f9[_0x0531('0x2f')],_0x38d77a[_0x0531('0x39')]),_0x6f5b96);if(_0x1ef3f9['query'][_0x0531('0x3b')]){_0x16d31a['where']=_['merge'](_0x16d31a[_0x0531('0x38')],{'$or':_[_0x0531('0x28')](_0x6f5b96,function(_0x4879fd){if(_0x4879fd[_0x0531('0x2b')]!==_0x0531('0x3c')){var _0x51829e={};_0x51829e[_0x4879fd[_0x0531('0x26')]]={'$like':'%'+_0x1ef3f9[_0x0531('0x2f')]['filter']+'%'};return _0x51829e;}})});}_0x16d31a=_[_0x0531('0x3d')]({},_0x16d31a,_0x1ef3f9[_0x0531('0x3e')]);var _0x5d3da2={'where':_0x16d31a[_0x0531('0x38')]};return db[_0x0531('0x3f')][_0x0531('0x1d')](_0x5d3da2)[_0x0531('0x22')](function(_0x29bc69){_0x967ba[_0x0531('0x1d')]=_0x29bc69;if(_0x1ef3f9[_0x0531('0x2f')][_0x0531('0x40')]){_0x16d31a['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x16d31a);})[_0x0531('0x22')](function(_0x528b5d){_0x967ba[_0x0531('0x41')]=_0x528b5d;return _0x967ba;})['then'](respondWithFilteredResult(_0x5dcdf1,_0x16d31a))[_0x0531('0x42')](handleError(_0x5dcdf1,null));};exports[_0x0531('0x43')]=function(_0x1f75a1,_0x5e3176){var _0x4c4abe={'raw':![],'where':{'id':_0x1f75a1[_0x0531('0x44')]['id']}},_0x11c452={};_0x11c452[_0x0531('0x31')]=_[_0x0531('0x2e')](db[_0x0531('0x3f')][_0x0531('0x29')]);_0x11c452[_0x0531('0x2f')]=_[_0x0531('0x2e')](_0x1f75a1['query']);_0x11c452[_0x0531('0x39')]=_[_0x0531('0x30')](_0x11c452[_0x0531('0x31')],_0x11c452[_0x0531('0x2f')]);_0x4c4abe[_0x0531('0x33')]=_[_0x0531('0x30')](_0x11c452[_0x0531('0x31')],qs[_0x0531('0x32')](_0x1f75a1[_0x0531('0x2f')][_0x0531('0x32')]));_0x4c4abe[_0x0531('0x33')]=_0x4c4abe[_0x0531('0x33')][_0x0531('0x34')]?_0x4c4abe[_0x0531('0x33')]:_0x11c452[_0x0531('0x31')];if(_0x1f75a1[_0x0531('0x2f')][_0x0531('0x40')]){_0x4c4abe[_0x0531('0x45')]=[{'all':!![]}];}_0x4c4abe=_[_0x0531('0x3d')]({},_0x4c4abe,_0x1f75a1['options']);return db[_0x0531('0x3f')][_0x0531('0x46')](_0x4c4abe)[_0x0531('0x22')](handleEntityNotFound(_0x5e3176,null))[_0x0531('0x22')](respondWithResult(_0x5e3176,null))[_0x0531('0x42')](handleError(_0x5e3176,null));};exports[_0x0531('0x47')]=function(_0x78f6f7,_0x3ff278){return db[_0x0531('0x3f')][_0x0531('0x47')](_0x78f6f7[_0x0531('0x48')],{})[_0x0531('0x22')](respondWithResult(_0x3ff278,0xc9))[_0x0531('0x42')](handleError(_0x3ff278,null));};exports['update']=function(_0x51208b,_0x3bf3ab){if(_0x51208b[_0x0531('0x48')]['id']){delete _0x51208b['body']['id'];}return db[_0x0531('0x3f')][_0x0531('0x46')]({'where':{'id':_0x51208b[_0x0531('0x44')]['id']}})[_0x0531('0x22')](handleEntityNotFound(_0x3bf3ab,null))[_0x0531('0x22')](saveUpdates(_0x51208b['body'],null))[_0x0531('0x22')](respondWithResult(_0x3bf3ab,null))['catch'](handleError(_0x3bf3ab,null));};exports['describe']=function(_0x5d0ed5,_0x341a0c){return db[_0x0531('0x3f')][_0x0531('0x49')]()[_0x0531('0x22')](respondWithResult(_0x341a0c,null))[_0x0531('0x42')](handleError(_0x341a0c,null));};exports[_0x0531('0x4a')]=function(_0x381209,_0x67497b,_0x14749a){var _0x478780=require(_0x0531('0x4b'));var _0x266373=![];var _0x1dadc4={};if(_0x381209['query'][_0x0531('0x2b')]&&_0x381209[_0x0531('0x2f')][_0x0531('0x2b')]===_0x0531('0x4c')){_0x1dadc4[_0x0531('0x4c')]=_0x381209['params']['id'];}else{_0x1dadc4['id']=_0x381209[_0x0531('0x44')]['id'];}return db[_0x0531('0x3f')]['find']({'where':_0x1dadc4,'attributes':['id','value'],'raw':!![]})[_0x0531('0x22')](handleEntityNotFound(_0x67497b,null))[_0x0531('0x22')](function(_0x3ee6ab){if(_0x3ee6ab){var _0x4c153d=_0x3ee6ab[_0x0531('0x4d')];var _0x4772c7=util[_0x0531('0x2d')](_0x0531('0x4e'),_0x4c153d);if(fs[_0x0531('0x4f')](_0x4772c7)){_0x266373=!![];return _0x478780['decryptFile'](_0x4772c7,_0x4c153d,config[_0x0531('0x50')][_0x0531('0x51')])[_0x0531('0x22')](function(){return _0x3ee6ab;});}return _0x3ee6ab;}})[_0x0531('0x22')](function(_0x2c7d6e){if(_0x2c7d6e){var _0x261437=_0x2c7d6e[_0x0531('0x4d')];if(!fs[_0x0531('0x4f')](_0x261437)){throw new db[(_0x0531('0x52'))][(_0x0531('0x53'))](_0x0531('0x54'));}if(_0x2c7d6e['filename']){return _0x67497b[_0x0531('0x4a')](_0x261437,_0x2c7d6e['filename']+path[_0x0531('0x55')](_0x261437),function(){if(_0x266373){fs[_0x0531('0x56')](_0x261437);}});}else{return _0x67497b['download'](_0x261437,function(_0x49c0f6){if(_0x266373){fs[_0x0531('0x56')](_0x261437);}});}}})['catch'](function(_0xbaa886){if(_0xbaa886[_0x0531('0x57')]===_0x0531('0x54')){_0x67497b[_0x0531('0x19')](0x194)[_0x0531('0x27')]('Not\x20found');}else{return handleError(_0x67497b,null);}});};exports[_0x0531('0x58')]=function(_0x132666,_0x56cf1d,_0x4ee98f){var _0x5ee9ce=require(_0x0531('0x4b'));var _0x4228d0=![];var _0x42d7af={'$and':[db[_0x0531('0x59')][_0x0531('0x38')](db[_0x0531('0x59')]['fn']('MD5',db['sequelize'][_0x0531('0x5a')](_0x0531('0x4c'))),_0x132666[_0x0531('0x2f')]['token'])]};if(_0x132666[_0x0531('0x2f')][_0x0531('0x2b')]&&_0x132666[_0x0531('0x2f')][_0x0531('0x2b')]==='uniqueid'){_0x42d7af[_0x0531('0x5b')][_0x0531('0x5c')]({'uniqueid':_0x132666[_0x0531('0x44')]['id']});}else{_0x42d7af[_0x0531('0x5b')][_0x0531('0x5c')]({'id':_0x132666['params']['id']});}return db[_0x0531('0x3f')]['find']({'where':_0x42d7af,'attributes':['id',_0x0531('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x56cf1d,null))[_0x0531('0x22')](function(_0x196cd1){if(_0x196cd1){var _0xa58704=util[_0x0531('0x2d')](_0x0531('0x4e'),_0x196cd1[_0x0531('0x4d')]);if(fs['existsSync'](_0xa58704)){_0x4228d0=!![];return _0x5ee9ce[_0x0531('0x5d')](_0xa58704,_0x196cd1[_0x0531('0x4d')],config[_0x0531('0x50')][_0x0531('0x51')])[_0x0531('0x22')](function(){return _0x196cd1;});}return _0x196cd1;}})[_0x0531('0x22')](function(_0xaa55c2){if(_0xaa55c2){if(!fs[_0x0531('0x4f')](_0xaa55c2[_0x0531('0x4d')])){throw new db['Sequelize'][(_0x0531('0x53'))]('VoiceRecording\x20not\x20found');}if(_0xaa55c2[_0x0531('0x5e')]){return _0x56cf1d[_0x0531('0x4a')](_0xaa55c2[_0x0531('0x4d')],_0xaa55c2[_0x0531('0x5e')]+path[_0x0531('0x55')](_0xaa55c2['value']),function(){if(_0x4228d0){fs[_0x0531('0x56')](_0xaa55c2[_0x0531('0x4d')]);}});}else{return _0x56cf1d[_0x0531('0x4a')](_0xaa55c2[_0x0531('0x4d')],function(_0x73825e){if(_0x4228d0){fs[_0x0531('0x56')](_0xaa55c2['value']);}});}}})[_0x0531('0x42')](handleError(_0x56cf1d,null));};exports[_0x0531('0x23')]=function(_0x2fb951,_0x89eb8c){return db[_0x0531('0x3f')][_0x0531('0x46')]({'where':{'id':_0x2fb951[_0x0531('0x44')]['id']}})['then'](function(_0x2ad1fa){if(_['isNil'](_0x2ad1fa)){throw new ReferenceError(_0x0531('0x5f'));}return _0x2ad1fa;})[_0x0531('0x22')](function(_0x4aecf3){var _0x39a245=_0x4aecf3[_0x0531('0x4d')];logger[_0x0531('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x39a245);if(!_['isNil'](_0x4aecf3['value'])&&fs['existsSync'](_0x39a245)){logger['info'](_0x0531('0x61')+_0x39a245+_0x0531('0x62'));fs[_0x0531('0x63')](_0x39a245);}_0x39a245=_0x39a245+_0x0531('0x64');if(!_['isNil'](_0x4aecf3['value'])&&fs[_0x0531('0x4f')](_0x39a245)){logger[_0x0531('0x60')](_0x0531('0x61')+_0x39a245+_0x0531('0x62'));fs[_0x0531('0x63')](_0x39a245);}return _0x4aecf3;})['then'](function(_0xd2233c){if(!_0xd2233c)throw new InternalError();return _0xd2233c[_0x0531('0x23')]();})[_0x0531('0x22')](function(){_0x89eb8c[_0x0531('0x19')](0xcc)['end']();})[_0x0531('0x42')](handleError(_0x89eb8c,null));};function getBucketslist(_0x3d1d64,_0xe9da5e,_0xa87986){return new Promise(function(_0x475b49,_0x383b43){var _0x2af915=new AWS['S3']({'accessKeyId':_0xe9da5e,'secretAccessKey':_0x3d1d64,'region':_0xa87986});_0x2af915['listBuckets']({},function(_0xa2bdb8,_0x906981){if(_0xa2bdb8){return _0x383b43(_0xa2bdb8);}else{return _0x475b49(_0x906981);}});});}function createBucket(_0x40232c,_0xcb75e,_0xeaa814,_0x3644e1){return new Promise(function(_0x39c0dc,_0x108f16){var _0x105c70=new AWS['S3']({'accessKeyId':_0xcb75e,'secretAccessKey':_0x40232c,'region':_0xeaa814});_0x105c70['createBucket']({'Bucket':_0x3644e1},function(_0xb5e7c2,_0x2d47a9){if(_0xb5e7c2){return _0x108f16(_0xb5e7c2);}else{return _0x39c0dc(_0x2d47a9);}});});}function uploadFile(_0x27b25b,_0x4ce899,_0x5ebb78,_0x45b41a,_0x2945a9,_0x18fefc){return new Promise(function(_0xbc88c4,_0x495508){var _0xce244=new AWS['S3']({'accessKeyId':_0x4ce899,'secretAccessKey':_0x27b25b,'region':_0x5ebb78});_0xce244['upload']({'Bucket':_0x45b41a,'Key':_0x2945a9,'Body':_0x18fefc},function(_0x506582,_0xc7222f){if(_0x506582){return _0x495508(_0x506582);}else{return _0xbc88c4(_0xc7222f);}});});}function startTranscribe(_0x347ece,_0x55273e,_0x5dcb2b,_0x307cdd,_0x35e0fd,_0xb62096){return new Promise(function(_0x24b7a6,_0x16897a){var _0x17bb10=new AWS['TranscribeService']({'accessKeyId':_0x55273e,'secretAccessKey':_0x347ece,'region':_0x5dcb2b});_0x17bb10[_0x0531('0x65')]({'TranscriptionJobName':_0x307cdd,'LanguageCode':_0x35e0fd,'Media':{'MediaFileUri':_0xb62096}},function(_0x4b7f61,_0x11f2bd){if(_0x4b7f61){return _0x16897a(_0x4b7f61);}else{return _0x24b7a6(_0x11f2bd);}});});}function transcribe(_0x2495f9,_0x2ac8fb,_0x21f4b7,_0xba2257,_0x42f67a,_0x329fc1,_0x5bbab0){return new Promise(function(_0x235427,_0x39d8d3){var _0x2c738c={};logger['info'](util[_0x0531('0x2d')](_0x0531('0x66'),_0x2495f9,_0x42f67a));return uploadFile(_0x2ac8fb,_0x21f4b7,_0xba2257,_0x42f67a,path[_0x0531('0x67')](_0x329fc1),fs['readFileSync'](_0x329fc1))[_0x0531('0x22')](function(_0x1f0aa3){logger[_0x0531('0x60')](util[_0x0531('0x2d')](_0x0531('0x68'),_0x2495f9,_0x42f67a,_0x1f0aa3['Location']));_0x2c738c[_0x0531('0x69')]=_0x1f0aa3[_0x0531('0x6a')];_0x2c738c[_0x0531('0x6b')]=_0x1f0aa3['Location'];logger[_0x0531('0x60')](util['format'](_0x0531('0x6c'),_0x2495f9));return startTranscribe(_0x2ac8fb,_0x21f4b7,_0xba2257,uuidv4(),_0x5bbab0,_0x1f0aa3[_0x0531('0x6d')]);})[_0x0531('0x22')](function(_0x4a68d3){logger['info'](util[_0x0531('0x2d')](_0x0531('0x6e'),_0x2495f9,_0x4a68d3[_0x0531('0x6f')][_0x0531('0x70')]));_0x2c738c['transcribeName']=_0x4a68d3[_0x0531('0x6f')][_0x0531('0x70')];_0x2c738c['transcribeStatus']=_0x4a68d3['TranscriptionJob'][_0x0531('0x71')];return _0x235427(_0x2c738c);})[_0x0531('0x42')](function(_0x4648ec){return _0x39d8d3(_0x4648ec);});});}exports[_0x0531('0x72')]=function(_0x550872,_0xd3abbb,_0x3a76cd){var _0x107a44;var _0x45a73c;var _0x37ef9a;var _0x483326=require('../../components/encryptor');return db['VoiceRecording'][_0x0531('0x73')]({'where':{'id':_0x550872[_0x0531('0x44')]['id']}})[_0x0531('0x22')](function(_0x2d18c3){if(_0x2d18c3){var _0x5ccf2a=util['format'](_0x0531('0x4e'),_0x2d18c3[_0x0531('0x4d')]);if(fs['existsSync'](_0x5ccf2a)){cypher=!![];return _0x483326[_0x0531('0x5d')](_0x5ccf2a,_0x2d18c3['value'],config['secrets']['recording'])[_0x0531('0x22')](function(){return _0x2d18c3;});}return _0x2d18c3;}})[_0x0531('0x22')](function(_0x5398a9){if(!_0x5398a9){throw new db[(_0x0531('0x52'))][(_0x0531('0x53'))](_0x0531('0x74'));}_0x45a73c=_0x5398a9;return db[_0x0531('0x75')][_0x0531('0x73')]({'where':{'id':0x1}});})[_0x0531('0x22')](handleEntityNotFound(_0xd3abbb,null))[_0x0531('0x22')](function(_0x564d5c){if(_0x564d5c){_0x107a44=_0x564d5c;if(!_0x107a44[_0x0531('0x76')]||!_0x107a44[_0x0531('0x77')]||!_0x107a44[_0x0531('0x78')]||!_0x107a44[_0x0531('0x79')]||!_0x107a44['bucket']){throw new db[(_0x0531('0x52'))][(_0x0531('0x53'))](_0x0531('0x7a'));}if(_0x550872[_0x0531('0x48')][_0x0531('0x7b')]&&(!_0x107a44['sentiment']||!_0x107a44['sentimentAccountId']||!_0x107a44[_0x0531('0x7c')]||!_0x107a44[_0x0531('0x79')]||!_0x107a44['bucket'])){throw new db[(_0x0531('0x52'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x0531('0x7d')]['findOne']({'where':{'id':_0x107a44[_0x0531('0x77')]}});}})[_0x0531('0x22')](function(_0x2691b2){if(!_0x2691b2){throw new db[(_0x0531('0x52'))][(_0x0531('0x53'))](_0x0531('0x7e'));}if(!_0x2691b2[_0x0531('0x7f')]||!_0x2691b2['data2']){throw new db[(_0x0531('0x52'))][(_0x0531('0x53'))](_0x0531('0x80'));}_0x37ef9a=_0x2691b2;return getBucketslist(_0x37ef9a[_0x0531('0x7f')],_0x37ef9a[_0x0531('0x81')],_0x107a44['transcribeRegion']);})[_0x0531('0x22')](function(_0x2fc8f5){if(_0x2fc8f5&&_0x2fc8f5[_0x0531('0x82')]){var _0x3e6f11=_[_0x0531('0x46')](_0x2fc8f5[_0x0531('0x82')],function(_0x570849){return _0x570849[_0x0531('0x83')]===_0x107a44[_0x0531('0x69')];});if(!_0x3e6f11){logger[_0x0531('0x60')](util[_0x0531('0x2d')](_0x0531('0x84'),_0x550872[_0x0531('0x44')]['id'],_0x107a44[_0x0531('0x69')]));return createBucket(_0x37ef9a[_0x0531('0x7f')],_0x37ef9a[_0x0531('0x81')],_0x107a44[_0x0531('0x78')],_0x107a44['bucket']);}logger[_0x0531('0x60')](util[_0x0531('0x2d')](_0x0531('0x85'),_0x550872[_0x0531('0x44')]['id'],_0x107a44[_0x0531('0x69')]));return;}})[_0x0531('0x22')](function(_0x2c354a){if(_0x45a73c[_0x0531('0x86')]===_0x0531('0x87')){return transcribe(_0x550872[_0x0531('0x44')]['id'],_0x37ef9a[_0x0531('0x7f')],_0x37ef9a[_0x0531('0x81')],_0x107a44[_0x0531('0x78')],_0x107a44[_0x0531('0x69')],_0x45a73c[_0x0531('0x4d')],_0x107a44[_0x0531('0x79')]);}else{logger[_0x0531('0x60')](util[_0x0531('0x2d')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x550872[_0x0531('0x44')]['id']));return{'transcribeStatus':_0x0531('0x88')};}})[_0x0531('0x22')](function(_0x480769){if(_0x480769){_0x480769['tempSentiment']=_0x550872[_0x0531('0x48')][_0x0531('0x7b')];return _0x45a73c[_0x0531('0x89')](_0x480769);}})[_0x0531('0x22')](respondWithResult(_0xd3abbb,null))[_0x0531('0x42')](handleError(_0xd3abbb,null));};function writeFile(_0xaa9cf8,_0x5d4e7c){return new Promise(function(_0x2be2a5,_0x87af3e){fs[_0x0531('0x8a')](_0x5d4e7c,_0xaa9cf8,function(_0x19645f,_0xe74790){if(_0x19645f){return _0x87af3e(_0x19645f);}else{return _0x2be2a5(_0xe74790);}});});}exports[_0x0531('0x8b')]=function(_0x137ac6,_0x1a49e4,_0x174974){return db[_0x0531('0x3f')][_0x0531('0x73')]({'where':{'id':_0x137ac6[_0x0531('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a49e4))[_0x0531('0x22')](function(_0x53a137){if(_0x53a137&&_0x53a137[_0x0531('0x8c')]){var _0x20c06e=_0x53a137[_0x0531('0x8c')];var _0x3a2008=config['root']+_0x0531('0x8d')+_0x53a137['id']+_0x0531('0x8e');if(fs[_0x0531('0x4f')](_0x3a2008)){return _0x3a2008;}return writeFile(_0x20c06e,_0x3a2008)[_0x0531('0x22')](function(){return _0x3a2008;});}else{throw new db['Sequelize'][(_0x0531('0x53'))](_0x0531('0x8f'));}})[_0x0531('0x22')](function(_0x5a7a8b){return _0x1a49e4[_0x0531('0x4a')](_0x5a7a8b);})[_0x0531('0x42')](handleError(_0x1a49e4));}; \ No newline at end of file +var _0xe797=['runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','aws-sdk','../../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','Content-Range','apply','update','then','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','download','value','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','uniqueid','$and','push','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','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'];(function(_0x1d3892,_0x47d5fe){var _0x574ff2=function(_0x5cc441){while(--_0x5cc441){_0x1d3892['push'](_0x1d3892['shift']());}};_0x574ff2(++_0x47d5fe);}(_0xe797,0x1ec));var _0x7e79=function(_0x4932ee,_0x47fc0c){_0x4932ee=_0x4932ee-0x0;var _0x2d5c97=_0xe797[_0x4932ee];return _0x2d5c97;};'use strict';var emlformat=require(_0x7e79('0x0'));var rimraf=require(_0x7e79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e79('0x2'));var rp=require(_0x7e79('0x3'));var moment=require('moment');var BPromise=require(_0x7e79('0x4'));var Mustache=require('mustache');var util=require(_0x7e79('0x5'));var path=require(_0x7e79('0x6'));var sox=require('sox');var csv=require(_0x7e79('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e79('0x8'));var _=require('lodash');var squel=require(_0x7e79('0x9'));var crypto=require(_0x7e79('0xa'));var jsforce=require(_0x7e79('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7e79('0x7'));var querystring=require(_0x7e79('0xc'));var Papa=require(_0x7e79('0xd'));var AWS=require(_0x7e79('0xe'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x7e79('0xf'));var qs=require(_0x7e79('0x10'));var as=require(_0x7e79('0x11'));var hardwareService=require(_0x7e79('0x12'));var logger=require(_0x7e79('0x13'))(_0x7e79('0x14'));var utils=require(_0x7e79('0x15'));var config=require(_0x7e79('0x16'));var licenseUtil=require(_0x7e79('0x17'));var db=require(_0x7e79('0x18'))['db'];function respondWithStatusCode(_0x10156d,_0x44e6b2){_0x44e6b2=_0x44e6b2||0xcc;return function(_0xdb60d3){if(_0xdb60d3){return _0x10156d[_0x7e79('0x19')](_0x44e6b2);}return _0x10156d[_0x7e79('0x1a')](_0x44e6b2)[_0x7e79('0x1b')]();};}function respondWithResult(_0x33abc3,_0x5cebd0){_0x5cebd0=_0x5cebd0||0xc8;return function(_0x1e4bee){if(_0x1e4bee){return _0x33abc3[_0x7e79('0x1a')](_0x5cebd0)[_0x7e79('0x1c')](_0x1e4bee);}};}function respondWithFilteredResult(_0x2a86ce,_0x563916){return function(_0x56b768){if(_0x56b768){var _0x13c9ea=typeof _0x563916[_0x7e79('0x1d')]===_0x7e79('0x1e')&&typeof _0x563916[_0x7e79('0x1f')]===_0x7e79('0x1e');var _0x4e8e0d=_0x56b768[_0x7e79('0x20')];var _0x30c09c=_0x13c9ea?0x0:_0x563916['offset'];var _0x360791=_0x13c9ea?_0x56b768[_0x7e79('0x20')]:_0x563916[_0x7e79('0x1d')]+_0x563916[_0x7e79('0x1f')];var _0x1f6b4c;if(_0x360791>=_0x4e8e0d){_0x360791=_0x4e8e0d;_0x1f6b4c=0xc8;}else{_0x1f6b4c=0xce;}_0x2a86ce['status'](_0x1f6b4c);return _0x2a86ce['set'](_0x7e79('0x21'),_0x30c09c+'-'+_0x360791+'/'+_0x4e8e0d)[_0x7e79('0x1c')](_0x56b768);}return null;};}function patchUpdates(_0x10a0da){return function(_0x32d2f1){try{jsonpatch[_0x7e79('0x22')](_0x32d2f1,_0x10a0da,!![]);}catch(_0x5ed3a6){return BPromise['reject'](_0x5ed3a6);}return _0x32d2f1['save']();};}function saveUpdates(_0x212ee7,_0xb8c6f){return function(_0x28051f){if(_0x28051f){return _0x28051f[_0x7e79('0x23')](_0x212ee7)[_0x7e79('0x24')](function(_0x3eefb4){return _0x3eefb4;});}return null;};}function removeEntity(_0x577e51,_0x10d6ce){return function(_0x4d6dfc){if(_0x4d6dfc){return _0x4d6dfc['destroy']()['then'](function(){_0x577e51[_0x7e79('0x1a')](0xcc)[_0x7e79('0x1b')]();});}};}function handleEntityNotFound(_0x110686,_0x259913){return function(_0xe0f31){if(!_0xe0f31){_0x110686[_0x7e79('0x19')](0x194);}return _0xe0f31;};}function handleError(_0x87e463,_0x261109){_0x261109=_0x261109||0x1f4;return function(_0xa40d62){logger[_0x7e79('0x25')](_0xa40d62['stack']);if(_0xa40d62[_0x7e79('0x26')]){delete _0xa40d62[_0x7e79('0x26')];}_0x87e463[_0x7e79('0x1a')](_0x261109)[_0x7e79('0x27')](_0xa40d62);};}exports[_0x7e79('0x28')]=function(_0x23956c,_0x32f70a){var _0x360ddd={},_0x4cecee={},_0x5e940e={'count':0x0,'rows':[]};var _0x58f91e=_[_0x7e79('0x29')](db[_0x7e79('0x2a')][_0x7e79('0x2b')],function(_0x366701){return{'name':_0x366701[_0x7e79('0x2c')],'type':_0x366701[_0x7e79('0x2d')][_0x7e79('0x2e')]};});_0x4cecee[_0x7e79('0x2f')]=_[_0x7e79('0x30')](_['map'](_0x58f91e,_0x7e79('0x26')),['format']);_0x4cecee[_0x7e79('0x31')]=_[_0x7e79('0x32')](_0x23956c[_0x7e79('0x31')]);_0x4cecee['filters']=_[_0x7e79('0x33')](_0x4cecee[_0x7e79('0x2f')],_0x4cecee[_0x7e79('0x31')]);_0x360ddd[_0x7e79('0x34')]=_['intersection'](_0x4cecee[_0x7e79('0x2f')],qs[_0x7e79('0x35')](_0x23956c[_0x7e79('0x31')][_0x7e79('0x35')]));_0x360ddd[_0x7e79('0x34')]=_0x360ddd[_0x7e79('0x34')]['length']?_0x360ddd[_0x7e79('0x34')]:_0x4cecee[_0x7e79('0x2f')];if(!_0x23956c[_0x7e79('0x31')][_0x7e79('0x36')]('nolimit')){_0x360ddd['limit']=qs[_0x7e79('0x1f')](_0x23956c[_0x7e79('0x31')][_0x7e79('0x1f')]);_0x360ddd[_0x7e79('0x1d')]=qs['offset'](_0x23956c[_0x7e79('0x31')][_0x7e79('0x1d')]);}_0x360ddd[_0x7e79('0x37')]=qs[_0x7e79('0x38')](_0x23956c[_0x7e79('0x31')][_0x7e79('0x38')]);_0x360ddd[_0x7e79('0x39')]=qs[_0x7e79('0x3a')](_[_0x7e79('0x3b')](_0x23956c['query'],_0x4cecee[_0x7e79('0x3a')]),_0x58f91e);if(_0x23956c[_0x7e79('0x31')][_0x7e79('0x3c')]){_0x360ddd[_0x7e79('0x39')]=_[_0x7e79('0x3d')](_0x360ddd[_0x7e79('0x39')],{'$or':_[_0x7e79('0x29')](_0x58f91e,function(_0x957fc1){if(_0x957fc1[_0x7e79('0x2d')]!==_0x7e79('0x3e')){var _0x2d302a={};_0x2d302a[_0x957fc1[_0x7e79('0x26')]]={'$like':'%'+_0x23956c[_0x7e79('0x31')][_0x7e79('0x3c')]+'%'};return _0x2d302a;}})});}_0x360ddd=_[_0x7e79('0x3d')]({},_0x360ddd,_0x23956c[_0x7e79('0x3f')]);var _0x5a1610={'where':_0x360ddd[_0x7e79('0x39')]};return db[_0x7e79('0x2a')][_0x7e79('0x20')](_0x5a1610)[_0x7e79('0x24')](function(_0x2b15d0){_0x5e940e[_0x7e79('0x20')]=_0x2b15d0;if(_0x23956c[_0x7e79('0x31')][_0x7e79('0x40')]){_0x360ddd[_0x7e79('0x41')]=[{'all':!![]}];}return db[_0x7e79('0x2a')][_0x7e79('0x42')](_0x360ddd);})[_0x7e79('0x24')](function(_0x2a54a5){_0x5e940e[_0x7e79('0x43')]=_0x2a54a5;return _0x5e940e;})['then'](respondWithFilteredResult(_0x32f70a,_0x360ddd))[_0x7e79('0x44')](handleError(_0x32f70a,null));};exports['show']=function(_0x442a3b,_0x5ee2b8){var _0x1f1570={'raw':![],'where':{'id':_0x442a3b[_0x7e79('0x45')]['id']}},_0x585e57={};_0x585e57[_0x7e79('0x2f')]=_[_0x7e79('0x32')](db[_0x7e79('0x2a')][_0x7e79('0x2b')]);_0x585e57[_0x7e79('0x31')]=_[_0x7e79('0x32')](_0x442a3b[_0x7e79('0x31')]);_0x585e57[_0x7e79('0x3a')]=_[_0x7e79('0x33')](_0x585e57[_0x7e79('0x2f')],_0x585e57[_0x7e79('0x31')]);_0x1f1570[_0x7e79('0x34')]=_['intersection'](_0x585e57[_0x7e79('0x2f')],qs['fields'](_0x442a3b['query'][_0x7e79('0x35')]));_0x1f1570[_0x7e79('0x34')]=_0x1f1570[_0x7e79('0x34')][_0x7e79('0x46')]?_0x1f1570[_0x7e79('0x34')]:_0x585e57[_0x7e79('0x2f')];if(_0x442a3b[_0x7e79('0x31')][_0x7e79('0x40')]){_0x1f1570[_0x7e79('0x41')]=[{'all':!![]}];}_0x1f1570=_[_0x7e79('0x3d')]({},_0x1f1570,_0x442a3b[_0x7e79('0x3f')]);return db[_0x7e79('0x2a')][_0x7e79('0x47')](_0x1f1570)[_0x7e79('0x24')](handleEntityNotFound(_0x5ee2b8,null))[_0x7e79('0x24')](respondWithResult(_0x5ee2b8,null))[_0x7e79('0x44')](handleError(_0x5ee2b8,null));};exports[_0x7e79('0x48')]=function(_0x3b0827,_0x2e4bad){return db[_0x7e79('0x2a')][_0x7e79('0x48')](_0x3b0827['body'],{})[_0x7e79('0x24')](respondWithResult(_0x2e4bad,0xc9))[_0x7e79('0x44')](handleError(_0x2e4bad,null));};exports[_0x7e79('0x23')]=function(_0x56d6f2,_0x2f910f){if(_0x56d6f2[_0x7e79('0x49')]['id']){delete _0x56d6f2[_0x7e79('0x49')]['id'];}return db['VoiceRecording'][_0x7e79('0x47')]({'where':{'id':_0x56d6f2[_0x7e79('0x45')]['id']}})[_0x7e79('0x24')](handleEntityNotFound(_0x2f910f,null))[_0x7e79('0x24')](saveUpdates(_0x56d6f2[_0x7e79('0x49')],null))[_0x7e79('0x24')](respondWithResult(_0x2f910f,null))[_0x7e79('0x44')](handleError(_0x2f910f,null));};exports[_0x7e79('0x4a')]=function(_0x21b3f1,_0x21f825){return db[_0x7e79('0x2a')]['describe']()['then'](respondWithResult(_0x21f825,null))[_0x7e79('0x44')](handleError(_0x21f825,null));};exports[_0x7e79('0x4b')]=function(_0xe98b69,_0x375558,_0x32e226){var _0x4f61aa=require('../../components/encryptor');var _0x3df807=![];var _0x3827c8={};if(_0xe98b69[_0x7e79('0x31')][_0x7e79('0x2d')]&&_0xe98b69[_0x7e79('0x31')][_0x7e79('0x2d')]==='uniqueid'){_0x3827c8['uniqueid']=_0xe98b69[_0x7e79('0x45')]['id'];}else{_0x3827c8['id']=_0xe98b69['params']['id'];}return db[_0x7e79('0x2a')][_0x7e79('0x47')]({'where':_0x3827c8,'attributes':['id',_0x7e79('0x4c')],'raw':!![]})[_0x7e79('0x24')](handleEntityNotFound(_0x375558,null))[_0x7e79('0x24')](function(_0x34acc0){if(_0x34acc0){var _0xaa7b48=_0x34acc0[_0x7e79('0x4c')];var _0x47761b=util[_0x7e79('0x4d')](_0x7e79('0x4e'),_0xaa7b48);if(fs[_0x7e79('0x4f')](_0x47761b)){_0x3df807=!![];return _0x4f61aa['decryptFile'](_0x47761b,_0xaa7b48,config[_0x7e79('0x50')][_0x7e79('0x51')])[_0x7e79('0x24')](function(){return _0x34acc0;});}return _0x34acc0;}})[_0x7e79('0x24')](function(_0x18fd43){if(_0x18fd43){var _0x1d7411=_0x18fd43[_0x7e79('0x4c')];if(!fs[_0x7e79('0x4f')](_0x1d7411)){throw new db[(_0x7e79('0x52'))][(_0x7e79('0x53'))](_0x7e79('0x54'));}if(_0x18fd43['filename']){return _0x375558[_0x7e79('0x4b')](_0x1d7411,_0x18fd43[_0x7e79('0x55')]+path[_0x7e79('0x56')](_0x1d7411),function(){if(_0x3df807){fs[_0x7e79('0x57')](_0x1d7411);}});}else{return _0x375558['download'](_0x1d7411,function(_0x42c284){if(_0x3df807){fs[_0x7e79('0x57')](_0x1d7411);}});}}})[_0x7e79('0x44')](function(_0x18f528){if(_0x18f528[_0x7e79('0x58')]===_0x7e79('0x54')){_0x375558['status'](0x194)[_0x7e79('0x27')](_0x7e79('0x59'));}else{return handleError(_0x375558,null);}});};exports[_0x7e79('0x5a')]=function(_0x4d3bcd,_0x2a7b39,_0x5c4f3a){var _0x1c47e6=require('../../components/encryptor');var _0x19a434=![];var _0x463b5d={'$and':[db['sequelize'][_0x7e79('0x39')](db[_0x7e79('0x5b')]['fn'](_0x7e79('0x5c'),db[_0x7e79('0x5b')][_0x7e79('0x5d')]('uniqueid')),_0x4d3bcd['query'][_0x7e79('0x5e')])]};if(_0x4d3bcd['query'][_0x7e79('0x2d')]&&_0x4d3bcd[_0x7e79('0x31')]['type']===_0x7e79('0x5f')){_0x463b5d[_0x7e79('0x60')]['push']({'uniqueid':_0x4d3bcd[_0x7e79('0x45')]['id']});}else{_0x463b5d['$and'][_0x7e79('0x61')]({'id':_0x4d3bcd['params']['id']});}return db['VoiceRecording'][_0x7e79('0x47')]({'where':_0x463b5d,'attributes':['id',_0x7e79('0x4c')],'raw':!![]})[_0x7e79('0x24')](handleEntityNotFound(_0x2a7b39,null))[_0x7e79('0x24')](function(_0xbbf3f2){if(_0xbbf3f2){var _0x16bc4b=util[_0x7e79('0x4d')](_0x7e79('0x4e'),_0xbbf3f2[_0x7e79('0x4c')]);if(fs[_0x7e79('0x4f')](_0x16bc4b)){_0x19a434=!![];return _0x1c47e6['decryptFile'](_0x16bc4b,_0xbbf3f2['value'],config[_0x7e79('0x50')][_0x7e79('0x51')])['then'](function(){return _0xbbf3f2;});}return _0xbbf3f2;}})['then'](function(_0x115146){if(_0x115146){if(!fs[_0x7e79('0x4f')](_0x115146[_0x7e79('0x4c')])){throw new db[(_0x7e79('0x52'))][(_0x7e79('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x115146[_0x7e79('0x55')]){return _0x2a7b39['download'](_0x115146['value'],_0x115146['filename']+path[_0x7e79('0x56')](_0x115146['value']),function(){if(_0x19a434){fs['unlink'](_0x115146[_0x7e79('0x4c')]);}});}else{return _0x2a7b39[_0x7e79('0x4b')](_0x115146[_0x7e79('0x4c')],function(_0x42e208){if(_0x19a434){fs[_0x7e79('0x57')](_0x115146[_0x7e79('0x4c')]);}});}}})[_0x7e79('0x44')](handleError(_0x2a7b39,null));};exports['destroy']=function(_0x58398b,_0x2c4b5b){return db[_0x7e79('0x2a')]['find']({'where':{'id':_0x58398b[_0x7e79('0x45')]['id']}})[_0x7e79('0x24')](function(_0x123450){if(_[_0x7e79('0x62')](_0x123450)){throw new ReferenceError(_0x7e79('0x63'));}return _0x123450;})['then'](function(_0x4fc1ff){var _0x255282=_0x4fc1ff[_0x7e79('0x4c')];logger[_0x7e79('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x255282);if(!_['isNil'](_0x4fc1ff[_0x7e79('0x4c')])&&fs[_0x7e79('0x4f')](_0x255282)){logger[_0x7e79('0x64')]('File:\x20\x22'+_0x255282+_0x7e79('0x65'));fs[_0x7e79('0x66')](_0x255282);}_0x255282=_0x255282+_0x7e79('0x67');if(!_[_0x7e79('0x62')](_0x4fc1ff[_0x7e79('0x4c')])&&fs[_0x7e79('0x4f')](_0x255282)){logger[_0x7e79('0x64')](_0x7e79('0x68')+_0x255282+_0x7e79('0x65'));fs[_0x7e79('0x66')](_0x255282);}return _0x4fc1ff;})[_0x7e79('0x24')](function(_0x10c1f0){if(!_0x10c1f0)throw new InternalError();return _0x10c1f0[_0x7e79('0x69')]();})['then'](function(){_0x2c4b5b['status'](0xcc)[_0x7e79('0x1b')]();})[_0x7e79('0x44')](handleError(_0x2c4b5b,null));};function getBucketslist(_0x5a1d7c,_0x417a99,_0x3e8f23){return new Promise(function(_0xfc9e6c,_0x364345){var _0x4acb72=new AWS['S3']({'accessKeyId':_0x417a99,'secretAccessKey':_0x5a1d7c,'region':_0x3e8f23});_0x4acb72[_0x7e79('0x6a')]({},function(_0x298ed3,_0x3f17a8){if(_0x298ed3){return _0x364345(_0x298ed3);}else{return _0xfc9e6c(_0x3f17a8);}});});}function createBucket(_0xe9e66,_0x5de583,_0x5139e9,_0x37c9ff){return new Promise(function(_0x170f08,_0x1a39fe){var _0x12b862=new AWS['S3']({'accessKeyId':_0x5de583,'secretAccessKey':_0xe9e66,'region':_0x5139e9});_0x12b862[_0x7e79('0x6b')]({'Bucket':_0x37c9ff},function(_0xe90054,_0x2668f7){if(_0xe90054){return _0x1a39fe(_0xe90054);}else{return _0x170f08(_0x2668f7);}});});}function uploadFile(_0x3854b3,_0x14102f,_0x404638,_0x25a82a,_0x2611dc,_0x5b4ade){return new Promise(function(_0x37d80d,_0x4e2f33){var _0x3ae830=new AWS['S3']({'accessKeyId':_0x14102f,'secretAccessKey':_0x3854b3,'region':_0x404638});_0x3ae830[_0x7e79('0x6c')]({'Bucket':_0x25a82a,'Key':_0x2611dc,'Body':_0x5b4ade},function(_0x2d1780,_0x556143){if(_0x2d1780){return _0x4e2f33(_0x2d1780);}else{return _0x37d80d(_0x556143);}});});}function startTranscribe(_0x5adafd,_0x1ec94e,_0x4bcccb,_0xff6ac8,_0x453007,_0x3a7b80){return new Promise(function(_0x13cf8f,_0x4b5120){var _0x1228b6=new AWS[(_0x7e79('0x6d'))]({'accessKeyId':_0x1ec94e,'secretAccessKey':_0x5adafd,'region':_0x4bcccb});_0x1228b6[_0x7e79('0x6e')]({'TranscriptionJobName':_0xff6ac8,'LanguageCode':_0x453007,'Media':{'MediaFileUri':_0x3a7b80}},function(_0x30f3b2,_0x416b0a){if(_0x30f3b2){return _0x4b5120(_0x30f3b2);}else{return _0x13cf8f(_0x416b0a);}});});}function transcribe(_0x3e5bd1,_0xb15863,_0x12c204,_0x3843f4,_0x11a0a7,_0x5721a1,_0x56e66f){return new Promise(function(_0x46db78,_0x46738f){var _0x7abfef={};logger[_0x7e79('0x64')](util[_0x7e79('0x4d')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3e5bd1,_0x11a0a7));return uploadFile(_0xb15863,_0x12c204,_0x3843f4,_0x11a0a7,path[_0x7e79('0x6f')](_0x5721a1),fs[_0x7e79('0x70')](_0x5721a1))[_0x7e79('0x24')](function(_0x589f97){logger['info'](util['format'](_0x7e79('0x71'),_0x3e5bd1,_0x11a0a7,_0x589f97[_0x7e79('0x72')]));_0x7abfef[_0x7e79('0x73')]=_0x589f97[_0x7e79('0x74')];_0x7abfef[_0x7e79('0x75')]=_0x589f97[_0x7e79('0x72')];logger[_0x7e79('0x64')](util[_0x7e79('0x4d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3e5bd1));return startTranscribe(_0xb15863,_0x12c204,_0x3843f4,uuidv4(),_0x56e66f,_0x589f97['Location']);})[_0x7e79('0x24')](function(_0x3f6019){logger[_0x7e79('0x64')](util[_0x7e79('0x4d')](_0x7e79('0x76'),_0x3e5bd1,_0x3f6019[_0x7e79('0x77')][_0x7e79('0x78')]));_0x7abfef[_0x7e79('0x79')]=_0x3f6019['TranscriptionJob'][_0x7e79('0x78')];_0x7abfef[_0x7e79('0x7a')]=_0x3f6019[_0x7e79('0x77')][_0x7e79('0x7b')];return _0x46db78(_0x7abfef);})[_0x7e79('0x44')](function(_0x534148){return _0x46738f(_0x534148);});});}exports[_0x7e79('0x7c')]=function(_0x4a7910,_0x11e359,_0x16445a){var _0x5442d6;var _0x2477bd;var _0x151704;var _0x30ddbd=require(_0x7e79('0x7d'));return db[_0x7e79('0x2a')][_0x7e79('0x7e')]({'where':{'id':_0x4a7910[_0x7e79('0x45')]['id']}})[_0x7e79('0x24')](function(_0xdbc7b9){if(_0xdbc7b9){var _0x4eb346=util[_0x7e79('0x4d')](_0x7e79('0x4e'),_0xdbc7b9[_0x7e79('0x4c')]);if(fs['existsSync'](_0x4eb346)){cypher=!![];return _0x30ddbd['decryptFile'](_0x4eb346,_0xdbc7b9[_0x7e79('0x4c')],config[_0x7e79('0x50')][_0x7e79('0x51')])[_0x7e79('0x24')](function(){return _0xdbc7b9;});}return _0xdbc7b9;}})[_0x7e79('0x24')](function(_0x3bd867){if(!_0x3bd867){throw new db[(_0x7e79('0x52'))][(_0x7e79('0x53'))](_0x7e79('0x7f'));}_0x2477bd=_0x3bd867;return db[_0x7e79('0x80')]['findOne']({'where':{'id':0x1}});})[_0x7e79('0x24')](handleEntityNotFound(_0x11e359,null))[_0x7e79('0x24')](function(_0xcbcd5d){if(_0xcbcd5d){_0x5442d6=_0xcbcd5d;if(!_0x5442d6['transcribe']||!_0x5442d6[_0x7e79('0x81')]||!_0x5442d6[_0x7e79('0x82')]||!_0x5442d6['language']||!_0x5442d6[_0x7e79('0x73')]){throw new db[(_0x7e79('0x52'))][(_0x7e79('0x53'))](_0x7e79('0x83'));}if(_0x4a7910[_0x7e79('0x49')][_0x7e79('0x84')]&&(!_0x5442d6['sentiment']||!_0x5442d6[_0x7e79('0x85')]||!_0x5442d6[_0x7e79('0x86')]||!_0x5442d6['language']||!_0x5442d6[_0x7e79('0x73')])){throw new db[(_0x7e79('0x52'))][(_0x7e79('0x53'))](_0x7e79('0x87'));}return db['CloudProvider'][_0x7e79('0x7e')]({'where':{'id':_0x5442d6[_0x7e79('0x81')]}});}})[_0x7e79('0x24')](function(_0x205d0b){if(!_0x205d0b){throw new db[(_0x7e79('0x52'))][(_0x7e79('0x53'))](_0x7e79('0x88'));}if(!_0x205d0b['data1']||!_0x205d0b[_0x7e79('0x89')]){throw new db[(_0x7e79('0x52'))][(_0x7e79('0x53'))](_0x7e79('0x8a'));}_0x151704=_0x205d0b;return getBucketslist(_0x151704[_0x7e79('0x8b')],_0x151704['data2'],_0x5442d6[_0x7e79('0x82')]);})[_0x7e79('0x24')](function(_0x36421a){if(_0x36421a&&_0x36421a[_0x7e79('0x8c')]){var _0x1b8af5=_[_0x7e79('0x47')](_0x36421a[_0x7e79('0x8c')],function(_0x4d3b9a){return _0x4d3b9a[_0x7e79('0x8d')]===_0x5442d6[_0x7e79('0x73')];});if(!_0x1b8af5){logger[_0x7e79('0x64')](util['format'](_0x7e79('0x8e'),_0x4a7910['params']['id'],_0x5442d6['bucket']));return createBucket(_0x151704[_0x7e79('0x8b')],_0x151704[_0x7e79('0x89')],_0x5442d6[_0x7e79('0x82')],_0x5442d6[_0x7e79('0x73')]);}logger[_0x7e79('0x64')](util[_0x7e79('0x4d')](_0x7e79('0x8f'),_0x4a7910[_0x7e79('0x45')]['id'],_0x5442d6[_0x7e79('0x73')]));return;}})['then'](function(_0x4072ec){if(_0x2477bd[_0x7e79('0x7a')]==='NEW'){return transcribe(_0x4a7910[_0x7e79('0x45')]['id'],_0x151704[_0x7e79('0x8b')],_0x151704['data2'],_0x5442d6['transcribeRegion'],_0x5442d6['bucket'],_0x2477bd['value'],_0x5442d6[_0x7e79('0x90')]);}else{logger['info'](util[_0x7e79('0x4d')](_0x7e79('0x91'),_0x4a7910[_0x7e79('0x45')]['id']));return{'transcribeStatus':_0x7e79('0x92')};}})['then'](function(_0xfb318b){if(_0xfb318b){_0xfb318b[_0x7e79('0x93')]=_0x4a7910[_0x7e79('0x49')][_0x7e79('0x84')];return _0x2477bd[_0x7e79('0x94')](_0xfb318b);}})[_0x7e79('0x24')](respondWithResult(_0x11e359,null))[_0x7e79('0x44')](handleError(_0x11e359,null));};function writeFile(_0x51508e,_0x5a0260){return new Promise(function(_0x330794,_0x2fb7a9){fs['writeFile'](_0x5a0260,_0x51508e,function(_0x130814,_0x195d3d){if(_0x130814){return _0x2fb7a9(_0x130814);}else{return _0x330794(_0x195d3d);}});});}exports[_0x7e79('0x95')]=function(_0x105c6c,_0x42eaa8,_0x3635b4){return db[_0x7e79('0x2a')]['findOne']({'where':{'id':_0x105c6c[_0x7e79('0x45')]['id']}})[_0x7e79('0x24')](handleEntityNotFound(_0x42eaa8))[_0x7e79('0x24')](function(_0x4e2fe8){if(_0x4e2fe8&&_0x4e2fe8[_0x7e79('0x96')]){var _0x27f710=_0x4e2fe8['fileText'];var _0x46fe2a=config[_0x7e79('0x97')]+'/server/files/transcribes/transcribe_'+_0x4e2fe8['id']+_0x7e79('0x98');if(fs[_0x7e79('0x4f')](_0x46fe2a)){return _0x46fe2a;}return writeFile(_0x27f710,_0x46fe2a)[_0x7e79('0x24')](function(){return _0x46fe2a;});}else{throw new db[(_0x7e79('0x52'))]['ValidationError'](_0x7e79('0x99'));}})[_0x7e79('0x24')](function(_0x3e4473){return _0x42eaa8['download'](_0x3e4473);})[_0x7e79('0x44')](handleError(_0x42eaa8));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c595d55..96b8aef 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 _0x21ab=['../../config/environment','./voiceRecording.attributes','voice_recordings','uniqueid','util','api','moment','bluebird','path','rimraf'];(function(_0x200851,_0x3a84ee){var _0x4afee2=function(_0xeb7bbc){while(--_0xeb7bbc){_0x200851['push'](_0x200851['shift']());}};_0x4afee2(++_0x3a84ee);}(_0x21ab,0x16c));var _0xb21a=function(_0x4553e8,_0x480e3c){_0x4553e8=_0x4553e8-0x0;var _0x99e41=_0x21ab[_0x4553e8];return _0x99e41;};'use strict';var _=require('lodash');var util=require(_0xb21a('0x0'));var logger=require('../../config/logger')(_0xb21a('0x1'));var moment=require(_0xb21a('0x2'));var BPromise=require(_0xb21a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb21a('0x4'));var rimraf=require(_0xb21a('0x5'));var config=require(_0xb21a('0x6'));var attributes=require(_0xb21a('0x7'));module['exports']=function(_0x13eaed,_0xfb4318){return _0x13eaed['define']('VoiceRecording',attributes,{'tableName':_0xb21a('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb21a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8796=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','lodash','util','api','bluebird'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x8796,0x1a0));var _0x6879=function(_0x2cdc9f,_0x5c785d){_0x2cdc9f=_0x2cdc9f-0x0;var _0x96884e=_0x8796[_0x2cdc9f];return _0x96884e;};'use strict';var _=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var logger=require('../../config/logger')(_0x6879('0x2'));var moment=require('moment');var BPromise=require(_0x6879('0x3'));var rp=require(_0x6879('0x4'));var fs=require('fs');var path=require(_0x6879('0x5'));var rimraf=require(_0x6879('0x6'));var config=require(_0x6879('0x7'));var attributes=require(_0x6879('0x8'));module[_0x6879('0x9')]=function(_0x52fcb3,_0x332e81){return _0x52fcb3['define'](_0x6879('0xa'),attributes,{'tableName':_0x6879('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5ad0439..c2eadee 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 _0xadb5=['encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','options','raw','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','value','format','%s.cypher'];(function(_0x82e82c,_0x53e68c){var _0xad9aa7=function(_0x447b6e){while(--_0x447b6e){_0x82e82c['push'](_0x82e82c['shift']());}};_0xad9aa7(++_0x53e68c);}(_0xadb5,0xad));var _0x5adb=function(_0x5ef293,_0x1f6b33){_0x5ef293=_0x5ef293-0x0;var _0x3bf0e7=_0xadb5[_0x5ef293];return _0x3bf0e7;};'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']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['VoiceRecording'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529b65[_0x5adb('0x17')]?_0x529b65[_0x5adb('0x17')][_0x5adb('0x19')]||null:null,'attributes':_0x529b65['options']?_0x529b65[_0x5adb('0x17')]['attributes']||null:null,'limit':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x1a')]||null:null})[_0x5adb('0xb')](function(_0x1a8014){logger[_0x5adb('0xc')](_0x5adb('0x15'),_0x529b65);logger[_0x5adb('0x1b')]('UpdateVoiceRecording',_0x529b65,JSON[_0x5adb('0xf')](_0x1a8014));_0x5de028(_0x1a8014);})[_0x5adb('0x14')](function(_0x3220cd){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x3220cd['message'],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x3220cd[_0x5adb('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x1feecf){var _0x1ded9f=this;return new Promise(function(_0x1a0acd,_0x55b40a){var _0x13ad1d=require(_0x5adb('0x1c'));var _0x3a4fca;return db[_0x5adb('0x1d')][_0x5adb('0x1e')]({'attributes':['id',_0x5adb('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x49992e){_0x3a4fca=_0x49992e;return db['VoiceRecording'][_0x5adb('0x20')](_0x1feecf[_0x5adb('0x21')]);})[_0x5adb('0xb')](function(_0x512bab){if(_0x3a4fca[_0x5adb('0x1f')]&&fs['existsSync'](_0x512bab[_0x5adb('0x22')])){var _0x34b793=util[_0x5adb('0x23')](_0x5adb('0x24'),_0x512bab[_0x5adb('0x22')]);return _0x13ad1d[_0x5adb('0x25')](_0x512bab[_0x5adb('0x22')],_0x34b793,config[_0x5adb('0x26')][_0x5adb('0x27')])[_0x5adb('0xb')](function(){fs['unlink'](_0x512bab[_0x5adb('0x22')]);logger['info'](_0x5adb('0x28'));return _0x512bab;});}return _0x512bab;})[_0x5adb('0xb')](function(_0x5d1441){logger[_0x5adb('0xc')](_0x5adb('0x29'),_0x1feecf);logger[_0x5adb('0x1b')]('CreateVoiceRecording',_0x1feecf,JSON[_0x5adb('0xf')](_0x5d1441));_0x1a0acd(_0x5d1441);})[_0x5adb('0x14')](function(_0x4b5887){logger['error'](_0x5adb('0x29'),_0x4b5887['message'],_0x1feecf);_0x55b40a(_0x1ded9f[_0x5adb('0x10')](0x1f4,_0x4b5887[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x90b1=['request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','limit','then','../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','%s.cypher','encryptFile','value','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x90b1,0x1bb));var _0x190b=function(_0x193d5a,_0x3ef3be){_0x193d5a=_0x193d5a-0x0;var _0x2e5fb1=_0x90b1[_0x193d5a];return _0x2e5fb1;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});}exports[_0x190b('0x14')]=function(_0x21e458){var _0x56d07a=this;return new Promise(function(_0x16c009,_0x50a3c4){return db[_0x190b('0x15')][_0x190b('0x16')](_0x21e458[_0x190b('0x17')],{'raw':_0x21e458[_0x190b('0x18')]?_0x21e458[_0x190b('0x18')][_0x190b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21e458['options']?_0x21e458[_0x190b('0x18')][_0x190b('0x1a')]||null:null,'attributes':_0x21e458['options']?_0x21e458[_0x190b('0x18')]['attributes']||null:null,'limit':_0x21e458['options']?_0x21e458[_0x190b('0x18')][_0x190b('0x1b')]||null:null})[_0x190b('0x1c')](function(_0x4c0b6e){logger[_0x190b('0x9')](_0x190b('0x14'),_0x21e458);logger[_0x190b('0xc')](_0x190b('0x14'),_0x21e458,JSON[_0x190b('0xe')](_0x4c0b6e));_0x16c009(_0x4c0b6e);})[_0x190b('0x13')](function(_0x1bce97){logger['error']('UpdateVoiceRecording',_0x1bce97[_0x190b('0x11')],_0x21e458);_0x50a3c4(_0x56d07a[_0x190b('0xf')](0x1f4,_0x1bce97['message']));});});};exports['CreateVoiceRecording']=function(_0x3260d5){var _0x4e2a93=this;return new Promise(function(_0x328e5e,_0x3b6aaf){var _0x51f8b4=require(_0x190b('0x1d'));var _0x1deea6;return db['Setting'][_0x190b('0x1e')]({'attributes':['id',_0x190b('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x190b('0x1c')](function(_0x494f3f){_0x1deea6=_0x494f3f;return db['VoiceRecording'][_0x190b('0x20')](_0x3260d5['body']);})[_0x190b('0x1c')](function(_0x19e421){if(_0x1deea6['callRecordingEncryption']&&fs[_0x190b('0x21')](_0x19e421['value'])){var _0x40d060=util['format'](_0x190b('0x22'),_0x19e421['value']);return _0x51f8b4[_0x190b('0x23')](_0x19e421[_0x190b('0x24')],_0x40d060,config['secrets'][_0x190b('0x25')])[_0x190b('0x1c')](function(){fs[_0x190b('0x26')](_0x19e421[_0x190b('0x24')]);logger[_0x190b('0x9')](_0x190b('0x27'));return _0x19e421;});}return _0x19e421;})[_0x190b('0x1c')](function(_0x248919){logger['info']('CreateVoiceRecording',_0x3260d5);logger[_0x190b('0xc')](_0x190b('0x28'),_0x3260d5,JSON['stringify'](_0x248919));_0x328e5e(_0x248919);})[_0x190b('0x13')](function(_0x2dcd39){logger[_0x190b('0xf')](_0x190b('0x28'),_0x2dcd39[_0x190b('0x11')],_0x3260d5);_0x3b6aaf(_0x4e2a93[_0x190b('0xf')](0x1f4,_0x2dcd39[_0x190b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index f9e4b9c..60e5b99 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 _0x642e=['express','Router','fs-extra','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','destroy','exports','connect-timeout'];(function(_0x3b5ea0,_0x5f45af){var _0x5602c3=function(_0x4cdde3){while(--_0x4cdde3){_0x3b5ea0['push'](_0x3b5ea0['shift']());}};_0x5602c3(++_0x5f45af);}(_0x642e,0xed));var _0xe642=function(_0xeb076f,_0x50f437){_0xeb076f=_0xeb076f-0x0;var _0x1db77f=_0x642e[_0xeb076f];return _0x1db77f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe642('0x0'));var express=require(_0xe642('0x1'));var router=express[_0xe642('0x2')]();var fs_extra=require(_0xe642('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe642('0x4'));var controller=require(_0xe642('0x5'));router[_0xe642('0x6')]('/',auth[_0xe642('0x7')](),controller['index']);router[_0xe642('0x6')](_0xe642('0x8'),auth[_0xe642('0x7')](),controller[_0xe642('0x9')]);router[_0xe642('0x6')](_0xe642('0xa'),auth['isAuthenticated'](),controller[_0xe642('0xb')]);router[_0xe642('0xc')]('/',auth[_0xe642('0x7')](),controller[_0xe642('0xd')]);router[_0xe642('0xe')](_0xe642('0xa'),auth[_0xe642('0x7')](),controller['update']);router['delete'](_0xe642('0xa'),auth[_0xe642('0x7')](),controller[_0xe642('0xf')]);module[_0xe642('0x10')]=router; \ No newline at end of file +var _0x5ec5=['show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x5ec5,0x9e));var _0x55ec=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5ec5[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x55ec('0x0'));var util=require('util');var path=require(_0x55ec('0x1'));var timeout=require(_0x55ec('0x2'));var express=require(_0x55ec('0x3'));var router=express[_0x55ec('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x55ec('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x55ec('0x6'));router[_0x55ec('0x7')]('/',auth[_0x55ec('0x8')](),controller[_0x55ec('0x9')]);router[_0x55ec('0x7')](_0x55ec('0xa'),auth['isAuthenticated'](),controller[_0x55ec('0xb')]);router[_0x55ec('0x7')](_0x55ec('0xc'),auth[_0x55ec('0x8')](),controller[_0x55ec('0xd')]);router[_0x55ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x55ec('0xf')]);router[_0x55ec('0x10')](_0x55ec('0xc'),auth[_0x55ec('0x8')](),controller[_0x55ec('0x11')]);router[_0x55ec('0x12')](_0x55ec('0xc'),auth[_0x55ec('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1b64f60..aad9cca 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 _0xefe8=['STRING','Yes','exports','blind'];(function(_0x41d240,_0x4e2d37){var _0x5b7b5e=function(_0x477433){while(--_0x477433){_0x41d240['push'](_0x41d240['shift']());}};_0x5b7b5e(++_0x4e2d37);}(_0xefe8,0x102));var _0x8efe=function(_0x3240ff,_0x3b9c3d){_0x3240ff=_0x3240ff-0x0;var _0x514858=_0xefe8[_0x3240ff];return _0x514858;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x8efe('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8efe('0x1'),'attended')},'result':{'type':Sequelize[_0x8efe('0x2')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x8efe('0x2')]},'transferercalleridname':{'type':Sequelize[_0x8efe('0x2')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8efe('0x2')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x8efe('0x2')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x8efe('0x2')]},'transfereecalleridnum':{'type':Sequelize[_0x8efe('0x2')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x8efe('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x8efe('0x2')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x8efe('0x2')]},'transfereelinkedid':{'type':Sequelize[_0x8efe('0x2')]},'isexternal':{'type':Sequelize['ENUM'](_0x8efe('0x3'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8efe('0x2')]}}; \ No newline at end of file +var _0xef4b=['exports','ENUM','attended','STRING','sequelize','moment'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0xef4b,0xd6));var _0xbef4=function(_0x4fc702,_0x590060){_0x4fc702=_0x4fc702-0x0;var _0x1357d3=_0xef4b[_0x4fc702];return _0x1357d3;};'use strict';var Sequelize=require(_0xbef4('0x0'));var moment=require(_0xbef4('0x1'));module[_0xbef4('0x2')]={'type':{'type':Sequelize[_0xbef4('0x3')]('blind',_0xbef4('0x4'))},'result':{'type':Sequelize[_0xbef4('0x5')]},'transfererchannel':{'type':Sequelize[_0xbef4('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xbef4('0x5')]},'transferercalleridname':{'type':Sequelize[_0xbef4('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbef4('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xbef4('0x5')]},'transferercontext':{'type':Sequelize[_0xbef4('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xbef4('0x5')]},'transfereechannel':{'type':Sequelize[_0xbef4('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xbef4('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbef4('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbef4('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xbef4('0x5')]},'transfereecontext':{'type':Sequelize[_0xbef4('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xbef4('0x5')]},'isexternal':{'type':Sequelize[_0xbef4('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbef4('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c9d2828..77a150d 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 _0xbb36=['apply','reject','save','update','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','catch','show','params','keys','include','find','create','body','destroy','describe','eml-format','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0xbb36,0x10a));var _0x6bb3=function(_0x305fe0,_0xef65d0){_0x305fe0=_0x305fe0-0x0;var _0x11b8f6=_0xbb36[_0x305fe0];return _0x11b8f6;};'use strict';var emlformat=require(_0x6bb3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bb3('0x1'));var moment=require(_0x6bb3('0x2'));var BPromise=require(_0x6bb3('0x3'));var Mustache=require('mustache');var util=require(_0x6bb3('0x4'));var path=require(_0x6bb3('0x5'));var sox=require(_0x6bb3('0x6'));var csv=require('to-csv');var ejs=require(_0x6bb3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6bb3('0x8'));var squel=require(_0x6bb3('0x9'));var crypto=require(_0x6bb3('0xa'));var jsforce=require(_0x6bb3('0xb'));var deskjs=require(_0x6bb3('0xc'));var toCsv=require(_0x6bb3('0xd'));var querystring=require(_0x6bb3('0xe'));var Papa=require(_0x6bb3('0xf'));var Redis=require(_0x6bb3('0x10'));var authService=require(_0x6bb3('0x11'));var qs=require(_0x6bb3('0x12'));var as=require(_0x6bb3('0x13'));var hardwareService=require(_0x6bb3('0x14'));var logger=require(_0x6bb3('0x15'))('api');var utils=require(_0x6bb3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6bb3('0x17'));var db=require(_0x6bb3('0x18'))['db'];function respondWithStatusCode(_0x2450e3,_0x26b04a){_0x26b04a=_0x26b04a||0xcc;return function(_0x1709a5){if(_0x1709a5){return _0x2450e3[_0x6bb3('0x19')](_0x26b04a);}return _0x2450e3[_0x6bb3('0x1a')](_0x26b04a)[_0x6bb3('0x1b')]();};}function respondWithResult(_0x4c7dfe,_0x3806d4){_0x3806d4=_0x3806d4||0xc8;return function(_0x54a2cf){if(_0x54a2cf){return _0x4c7dfe['status'](_0x3806d4)[_0x6bb3('0x1c')](_0x54a2cf);}};}function respondWithFilteredResult(_0x2ad391,_0x1f6f84){return function(_0x25f61e){if(_0x25f61e){var _0x24e646=typeof _0x1f6f84[_0x6bb3('0x1d')]===_0x6bb3('0x1e')&&typeof _0x1f6f84['limit']===_0x6bb3('0x1e');var _0x2e51d8=_0x25f61e[_0x6bb3('0x1f')];var _0x4f7a69=_0x24e646?0x0:_0x1f6f84[_0x6bb3('0x1d')];var _0x363d97=_0x24e646?_0x25f61e[_0x6bb3('0x1f')]:_0x1f6f84['offset']+_0x1f6f84[_0x6bb3('0x20')];var _0xdda14b;if(_0x363d97>=_0x2e51d8){_0x363d97=_0x2e51d8;_0xdda14b=0xc8;}else{_0xdda14b=0xce;}_0x2ad391[_0x6bb3('0x1a')](_0xdda14b);return _0x2ad391['set'](_0x6bb3('0x21'),_0x4f7a69+'-'+_0x363d97+'/'+_0x2e51d8)[_0x6bb3('0x1c')](_0x25f61e);}return null;};}function patchUpdates(_0x553f87){return function(_0x4d9f78){try{jsonpatch[_0x6bb3('0x22')](_0x4d9f78,_0x553f87,!![]);}catch(_0x575415){return BPromise[_0x6bb3('0x23')](_0x575415);}return _0x4d9f78[_0x6bb3('0x24')]();};}function saveUpdates(_0x270af7,_0x21e977){return function(_0x215064){if(_0x215064){return _0x215064[_0x6bb3('0x25')](_0x270af7)['then'](function(_0x1101b0){return _0x1101b0;});}return null;};}function removeEntity(_0x1a285f,_0x4b6d83){return function(_0xce284f){if(_0xce284f){return _0xce284f['destroy']()[_0x6bb3('0x26')](function(){_0x1a285f[_0x6bb3('0x1a')](0xcc)[_0x6bb3('0x1b')]();});}};}function handleEntityNotFound(_0x1ab21e,_0x21f152){return function(_0x4fd805){if(!_0x4fd805){_0x1ab21e['sendStatus'](0x194);}return _0x4fd805;};}function handleError(_0x2a1bf4,_0x314490){_0x314490=_0x314490||0x1f4;return function(_0x4ccbb6){logger[_0x6bb3('0x27')](_0x4ccbb6[_0x6bb3('0x28')]);if(_0x4ccbb6[_0x6bb3('0x29')]){delete _0x4ccbb6[_0x6bb3('0x29')];}_0x2a1bf4[_0x6bb3('0x1a')](_0x314490)[_0x6bb3('0x2a')](_0x4ccbb6);};}exports[_0x6bb3('0x2b')]=function(_0x3764ca,_0x300d41){var _0x480a83={},_0x5cba8d={},_0x5b605e={'count':0x0,'rows':[]};var _0x98245b=_['map'](db[_0x6bb3('0x2c')][_0x6bb3('0x2d')],function(_0x3ed599){return{'name':_0x3ed599[_0x6bb3('0x2e')],'type':_0x3ed599[_0x6bb3('0x2f')][_0x6bb3('0x30')]};});_0x5cba8d[_0x6bb3('0x31')]=_['map'](_0x98245b,'name');_0x5cba8d[_0x6bb3('0x32')]=_['keys'](_0x3764ca[_0x6bb3('0x32')]);_0x5cba8d[_0x6bb3('0x33')]=_['intersection'](_0x5cba8d[_0x6bb3('0x31')],_0x5cba8d[_0x6bb3('0x32')]);_0x480a83[_0x6bb3('0x34')]=_[_0x6bb3('0x35')](_0x5cba8d[_0x6bb3('0x31')],qs[_0x6bb3('0x36')](_0x3764ca['query'][_0x6bb3('0x36')]));_0x480a83[_0x6bb3('0x34')]=_0x480a83['attributes'][_0x6bb3('0x37')]?_0x480a83[_0x6bb3('0x34')]:_0x5cba8d[_0x6bb3('0x31')];if(!_0x3764ca[_0x6bb3('0x32')][_0x6bb3('0x38')](_0x6bb3('0x39'))){_0x480a83['limit']=qs['limit'](_0x3764ca[_0x6bb3('0x32')]['limit']);_0x480a83['offset']=qs[_0x6bb3('0x1d')](_0x3764ca[_0x6bb3('0x32')][_0x6bb3('0x1d')]);}_0x480a83[_0x6bb3('0x3a')]=qs[_0x6bb3('0x3b')](_0x3764ca['query'][_0x6bb3('0x3b')]);_0x480a83[_0x6bb3('0x3c')]=qs[_0x6bb3('0x33')](_[_0x6bb3('0x3d')](_0x3764ca[_0x6bb3('0x32')],_0x5cba8d['filters']),_0x98245b);if(_0x3764ca['query']['filter']){_0x480a83['where']=_[_0x6bb3('0x3e')](_0x480a83[_0x6bb3('0x3c')],{'$or':_['map'](_0x98245b,function(_0x33accc){if(_0x33accc[_0x6bb3('0x2f')]!=='VIRTUAL'){var _0x316cbc={};_0x316cbc[_0x33accc[_0x6bb3('0x29')]]={'$like':'%'+_0x3764ca[_0x6bb3('0x32')]['filter']+'%'};return _0x316cbc;}})});}_0x480a83=_['merge']({},_0x480a83,_0x3764ca[_0x6bb3('0x3f')]);var _0x4304b7={'where':_0x480a83[_0x6bb3('0x3c')]};return db[_0x6bb3('0x2c')]['count'](_0x4304b7)[_0x6bb3('0x26')](function(_0x56ff7f){_0x5b605e[_0x6bb3('0x1f')]=_0x56ff7f;if(_0x3764ca[_0x6bb3('0x32')][_0x6bb3('0x40')]){_0x480a83['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x480a83);})[_0x6bb3('0x26')](function(_0x591a18){_0x5b605e['rows']=_0x591a18;return _0x5b605e;})[_0x6bb3('0x26')](respondWithFilteredResult(_0x300d41,_0x480a83))[_0x6bb3('0x41')](handleError(_0x300d41,null));};exports[_0x6bb3('0x42')]=function(_0x184c62,_0x28a93f){var _0x365042={'raw':!![],'where':{'id':_0x184c62[_0x6bb3('0x43')]['id']}},_0x4449e5={};_0x4449e5[_0x6bb3('0x31')]=_[_0x6bb3('0x44')](db[_0x6bb3('0x2c')][_0x6bb3('0x2d')]);_0x4449e5[_0x6bb3('0x32')]=_[_0x6bb3('0x44')](_0x184c62[_0x6bb3('0x32')]);_0x4449e5[_0x6bb3('0x33')]=_['intersection'](_0x4449e5[_0x6bb3('0x31')],_0x4449e5[_0x6bb3('0x32')]);_0x365042[_0x6bb3('0x34')]=_['intersection'](_0x4449e5[_0x6bb3('0x31')],qs[_0x6bb3('0x36')](_0x184c62['query']['fields']));_0x365042[_0x6bb3('0x34')]=_0x365042['attributes'][_0x6bb3('0x37')]?_0x365042[_0x6bb3('0x34')]:_0x4449e5[_0x6bb3('0x31')];if(_0x184c62['query'][_0x6bb3('0x40')]){_0x365042[_0x6bb3('0x45')]=[{'all':!![]}];}_0x365042=_['merge']({},_0x365042,_0x184c62['options']);return db[_0x6bb3('0x2c')][_0x6bb3('0x46')](_0x365042)['then'](handleEntityNotFound(_0x28a93f,null))[_0x6bb3('0x26')](respondWithResult(_0x28a93f,null))[_0x6bb3('0x41')](handleError(_0x28a93f,null));};exports[_0x6bb3('0x47')]=function(_0x3a18ff,_0x4ab361){return db[_0x6bb3('0x2c')]['create'](_0x3a18ff['body'],{})[_0x6bb3('0x26')](respondWithResult(_0x4ab361,0xc9))[_0x6bb3('0x41')](handleError(_0x4ab361,null));};exports[_0x6bb3('0x25')]=function(_0x3ccd59,_0x389ab5){if(_0x3ccd59[_0x6bb3('0x48')]['id']){delete _0x3ccd59[_0x6bb3('0x48')]['id'];}return db[_0x6bb3('0x2c')]['find']({'where':{'id':_0x3ccd59['params']['id']}})[_0x6bb3('0x26')](handleEntityNotFound(_0x389ab5,null))[_0x6bb3('0x26')](saveUpdates(_0x3ccd59[_0x6bb3('0x48')],null))[_0x6bb3('0x26')](respondWithResult(_0x389ab5,null))[_0x6bb3('0x41')](handleError(_0x389ab5,null));};exports[_0x6bb3('0x49')]=function(_0x4369ae,_0x29feeb){return db[_0x6bb3('0x2c')][_0x6bb3('0x46')]({'where':{'id':_0x4369ae[_0x6bb3('0x43')]['id']}})[_0x6bb3('0x26')](handleEntityNotFound(_0x29feeb,null))['then'](removeEntity(_0x29feeb,null))[_0x6bb3('0x41')](handleError(_0x29feeb,null));};exports[_0x6bb3('0x4a')]=function(_0x33c2d0,_0xf4e016){return db[_0x6bb3('0x2c')][_0x6bb3('0x4a')]()[_0x6bb3('0x26')](respondWithResult(_0xf4e016,null))[_0x6bb3('0x41')](handleError(_0xf4e016,null));}; \ No newline at end of file +var _0xc7d8=['VIRTUAL','filter','options','includeAll','include','findAll','catch','show','intersection','length','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x5a6bd2,_0x447fe7){var _0xdc89b9=function(_0x198c8b){while(--_0x198c8b){_0x5a6bd2['push'](_0x5a6bd2['shift']());}};_0xdc89b9(++_0x447fe7);}(_0xc7d8,0xa7));var _0x8c7d=function(_0x1754bc,_0x44200c){_0x1754bc=_0x1754bc-0x0;var _0x580e9c=_0xc7d8[_0x1754bc];return _0x580e9c;};'use strict';var emlformat=require(_0x8c7d('0x0'));var rimraf=require(_0x8c7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c7d('0x2'));var rp=require(_0x8c7d('0x3'));var moment=require(_0x8c7d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8c7d('0x5'));var util=require('util');var path=require(_0x8c7d('0x6'));var sox=require(_0x8c7d('0x7'));var csv=require('to-csv');var ejs=require(_0x8c7d('0x8'));var fs=require('fs');var fs_extra=require(_0x8c7d('0x9'));var _=require(_0x8c7d('0xa'));var squel=require(_0x8c7d('0xb'));var crypto=require(_0x8c7d('0xc'));var jsforce=require(_0x8c7d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8c7d('0xe'));var querystring=require(_0x8c7d('0xf'));var Papa=require(_0x8c7d('0x10'));var Redis=require('ioredis');var authService=require(_0x8c7d('0x11'));var qs=require(_0x8c7d('0x12'));var as=require(_0x8c7d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8c7d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c7d('0x15'));var licenseUtil=require(_0x8c7d('0x16'));var db=require(_0x8c7d('0x17'))['db'];function respondWithStatusCode(_0x5ef81c,_0x1342fd){_0x1342fd=_0x1342fd||0xcc;return function(_0x3d5fc9){if(_0x3d5fc9){return _0x5ef81c['sendStatus'](_0x1342fd);}return _0x5ef81c[_0x8c7d('0x18')](_0x1342fd)[_0x8c7d('0x19')]();};}function respondWithResult(_0x1670af,_0x47c45c){_0x47c45c=_0x47c45c||0xc8;return function(_0x253ca5){if(_0x253ca5){return _0x1670af[_0x8c7d('0x18')](_0x47c45c)[_0x8c7d('0x1a')](_0x253ca5);}};}function respondWithFilteredResult(_0x19726f,_0x2a3117){return function(_0x4c0090){if(_0x4c0090){var _0x482aed=typeof _0x2a3117['offset']===_0x8c7d('0x1b')&&typeof _0x2a3117[_0x8c7d('0x1c')]===_0x8c7d('0x1b');var _0x3dbdbd=_0x4c0090[_0x8c7d('0x1d')];var _0x3c419c=_0x482aed?0x0:_0x2a3117[_0x8c7d('0x1e')];var _0xb269e5=_0x482aed?_0x4c0090[_0x8c7d('0x1d')]:_0x2a3117['offset']+_0x2a3117[_0x8c7d('0x1c')];var _0x39dd9e;if(_0xb269e5>=_0x3dbdbd){_0xb269e5=_0x3dbdbd;_0x39dd9e=0xc8;}else{_0x39dd9e=0xce;}_0x19726f[_0x8c7d('0x18')](_0x39dd9e);return _0x19726f[_0x8c7d('0x1f')](_0x8c7d('0x20'),_0x3c419c+'-'+_0xb269e5+'/'+_0x3dbdbd)['json'](_0x4c0090);}return null;};}function patchUpdates(_0x1b0254){return function(_0x241542){try{jsonpatch['apply'](_0x241542,_0x1b0254,!![]);}catch(_0x407ad3){return BPromise[_0x8c7d('0x21')](_0x407ad3);}return _0x241542[_0x8c7d('0x22')]();};}function saveUpdates(_0x39644a,_0x398556){return function(_0x39adcd){if(_0x39adcd){return _0x39adcd[_0x8c7d('0x23')](_0x39644a)[_0x8c7d('0x24')](function(_0x4b1d00){return _0x4b1d00;});}return null;};}function removeEntity(_0x5021d4,_0x2a3cd3){return function(_0x1fd0fa){if(_0x1fd0fa){return _0x1fd0fa[_0x8c7d('0x25')]()[_0x8c7d('0x24')](function(){_0x5021d4[_0x8c7d('0x18')](0xcc)[_0x8c7d('0x19')]();});}};}function handleEntityNotFound(_0x1806db,_0xf66471){return function(_0x560b8b){if(!_0x560b8b){_0x1806db[_0x8c7d('0x26')](0x194);}return _0x560b8b;};}function handleError(_0x3a094b,_0xdc871e){_0xdc871e=_0xdc871e||0x1f4;return function(_0xdf9953){logger[_0x8c7d('0x27')](_0xdf9953[_0x8c7d('0x28')]);if(_0xdf9953['name']){delete _0xdf9953[_0x8c7d('0x29')];}_0x3a094b[_0x8c7d('0x18')](_0xdc871e)[_0x8c7d('0x2a')](_0xdf9953);};}exports[_0x8c7d('0x2b')]=function(_0x518845,_0x5a6617){var _0x45c156={},_0x1b7824={},_0x33c1af={'count':0x0,'rows':[]};var _0x351d06=_[_0x8c7d('0x2c')](db[_0x8c7d('0x2d')][_0x8c7d('0x2e')],function(_0x29e91c){return{'name':_0x29e91c['fieldName'],'type':_0x29e91c[_0x8c7d('0x2f')][_0x8c7d('0x30')]};});_0x1b7824[_0x8c7d('0x31')]=_[_0x8c7d('0x2c')](_0x351d06,_0x8c7d('0x29'));_0x1b7824[_0x8c7d('0x32')]=_[_0x8c7d('0x33')](_0x518845[_0x8c7d('0x32')]);_0x1b7824[_0x8c7d('0x34')]=_['intersection'](_0x1b7824[_0x8c7d('0x31')],_0x1b7824['query']);_0x45c156[_0x8c7d('0x35')]=_['intersection'](_0x1b7824[_0x8c7d('0x31')],qs['fields'](_0x518845['query'][_0x8c7d('0x36')]));_0x45c156[_0x8c7d('0x35')]=_0x45c156[_0x8c7d('0x35')]['length']?_0x45c156[_0x8c7d('0x35')]:_0x1b7824['model'];if(!_0x518845[_0x8c7d('0x32')][_0x8c7d('0x37')](_0x8c7d('0x38'))){_0x45c156[_0x8c7d('0x1c')]=qs[_0x8c7d('0x1c')](_0x518845['query']['limit']);_0x45c156[_0x8c7d('0x1e')]=qs[_0x8c7d('0x1e')](_0x518845[_0x8c7d('0x32')]['offset']);}_0x45c156['order']=qs[_0x8c7d('0x39')](_0x518845[_0x8c7d('0x32')][_0x8c7d('0x39')]);_0x45c156[_0x8c7d('0x3a')]=qs['filters'](_[_0x8c7d('0x3b')](_0x518845['query'],_0x1b7824[_0x8c7d('0x34')]),_0x351d06);if(_0x518845[_0x8c7d('0x32')]['filter']){_0x45c156[_0x8c7d('0x3a')]=_[_0x8c7d('0x3c')](_0x45c156[_0x8c7d('0x3a')],{'$or':_[_0x8c7d('0x2c')](_0x351d06,function(_0x594d40){if(_0x594d40[_0x8c7d('0x2f')]!==_0x8c7d('0x3d')){var _0x106ee4={};_0x106ee4[_0x594d40[_0x8c7d('0x29')]]={'$like':'%'+_0x518845[_0x8c7d('0x32')][_0x8c7d('0x3e')]+'%'};return _0x106ee4;}})});}_0x45c156=_['merge']({},_0x45c156,_0x518845[_0x8c7d('0x3f')]);var _0x31532f={'where':_0x45c156[_0x8c7d('0x3a')]};return db[_0x8c7d('0x2d')]['count'](_0x31532f)[_0x8c7d('0x24')](function(_0x40b2da){_0x33c1af[_0x8c7d('0x1d')]=_0x40b2da;if(_0x518845[_0x8c7d('0x32')][_0x8c7d('0x40')]){_0x45c156[_0x8c7d('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x8c7d('0x42')](_0x45c156);})[_0x8c7d('0x24')](function(_0x55c244){_0x33c1af['rows']=_0x55c244;return _0x33c1af;})[_0x8c7d('0x24')](respondWithFilteredResult(_0x5a6617,_0x45c156))[_0x8c7d('0x43')](handleError(_0x5a6617,null));};exports[_0x8c7d('0x44')]=function(_0x40b076,_0x3093b9){var _0x893c9b={'raw':!![],'where':{'id':_0x40b076['params']['id']}},_0x306706={};_0x306706[_0x8c7d('0x31')]=_[_0x8c7d('0x33')](db[_0x8c7d('0x2d')][_0x8c7d('0x2e')]);_0x306706[_0x8c7d('0x32')]=_[_0x8c7d('0x33')](_0x40b076[_0x8c7d('0x32')]);_0x306706['filters']=_[_0x8c7d('0x45')](_0x306706[_0x8c7d('0x31')],_0x306706[_0x8c7d('0x32')]);_0x893c9b[_0x8c7d('0x35')]=_['intersection'](_0x306706['model'],qs[_0x8c7d('0x36')](_0x40b076[_0x8c7d('0x32')]['fields']));_0x893c9b['attributes']=_0x893c9b['attributes'][_0x8c7d('0x46')]?_0x893c9b[_0x8c7d('0x35')]:_0x306706[_0x8c7d('0x31')];if(_0x40b076[_0x8c7d('0x32')][_0x8c7d('0x40')]){_0x893c9b[_0x8c7d('0x41')]=[{'all':!![]}];}_0x893c9b=_['merge']({},_0x893c9b,_0x40b076['options']);return db['VoiceTransferReport']['find'](_0x893c9b)['then'](handleEntityNotFound(_0x3093b9,null))[_0x8c7d('0x24')](respondWithResult(_0x3093b9,null))[_0x8c7d('0x43')](handleError(_0x3093b9,null));};exports[_0x8c7d('0x47')]=function(_0x2c8b4e,_0x48438d){return db[_0x8c7d('0x2d')][_0x8c7d('0x47')](_0x2c8b4e[_0x8c7d('0x48')],{})['then'](respondWithResult(_0x48438d,0xc9))[_0x8c7d('0x43')](handleError(_0x48438d,null));};exports['update']=function(_0x4646f2,_0x593dc8){if(_0x4646f2[_0x8c7d('0x48')]['id']){delete _0x4646f2[_0x8c7d('0x48')]['id'];}return db[_0x8c7d('0x2d')][_0x8c7d('0x49')]({'where':{'id':_0x4646f2[_0x8c7d('0x4a')]['id']}})[_0x8c7d('0x24')](handleEntityNotFound(_0x593dc8,null))[_0x8c7d('0x24')](saveUpdates(_0x4646f2[_0x8c7d('0x48')],null))[_0x8c7d('0x24')](respondWithResult(_0x593dc8,null))[_0x8c7d('0x43')](handleError(_0x593dc8,null));};exports[_0x8c7d('0x25')]=function(_0x24a461,_0x398bcb){return db['VoiceTransferReport'][_0x8c7d('0x49')]({'where':{'id':_0x24a461[_0x8c7d('0x4a')]['id']}})[_0x8c7d('0x24')](handleEntityNotFound(_0x398bcb,null))[_0x8c7d('0x24')](removeEntity(_0x398bcb,null))[_0x8c7d('0x43')](handleError(_0x398bcb,null));};exports[_0x8c7d('0x4b')]=function(_0x4947ec,_0x46e844){return db[_0x8c7d('0x2d')][_0x8c7d('0x4b')]()[_0x8c7d('0x24')](respondWithResult(_0x46e844,null))[_0x8c7d('0x43')](handleError(_0x46e844,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a7f56e6..5199171 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 _0x65a1=['path','rimraf','../../config/environment','exports','define','VoiceTransferReport','util','moment','bluebird','request-promise'];(function(_0xeb0e7f,_0x4f4776){var _0x269e65=function(_0x47e410){while(--_0x47e410){_0xeb0e7f['push'](_0xeb0e7f['shift']());}};_0x269e65(++_0x4f4776);}(_0x65a1,0x1f0));var _0x165a=function(_0x28b12e,_0x59f4f5){_0x28b12e=_0x28b12e-0x0;var _0x2c3bd1=_0x65a1[_0x28b12e];return _0x2c3bd1;};'use strict';var _=require('lodash');var util=require(_0x165a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x165a('0x1'));var BPromise=require(_0x165a('0x2'));var rp=require(_0x165a('0x3'));var fs=require('fs');var path=require(_0x165a('0x4'));var rimraf=require(_0x165a('0x5'));var config=require(_0x165a('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x165a('0x7')]=function(_0x2d895b,_0x31440c){return _0x2d895b[_0x165a('0x8')](_0x165a('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x248a=['define','report_call_transfer','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceTransferReport.attributes'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0x248a,0x160));var _0xa248=function(_0x264c81,_0x14078e){_0x264c81=_0x264c81-0x0;var _0xdc78d6=_0x248a[_0x264c81];return _0xdc78d6;};'use strict';var _=require('lodash');var util=require(_0xa248('0x0'));var logger=require(_0xa248('0x1'))(_0xa248('0x2'));var moment=require(_0xa248('0x3'));var BPromise=require(_0xa248('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa248('0x5'));var rimraf=require(_0xa248('0x6'));var config=require('../../config/environment');var attributes=require(_0xa248('0x7'));module['exports']=function(_0x50c5d1,_0x44a9ec){return _0x50c5d1[_0xa248('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xa248('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 2b447d3..a26944c 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 _0xf13e=['info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','options','CreateVoiceTransferReport','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xf13e,0xae));var _0xef13=function(_0x13a365,_0x1d4c33){_0x13a365=_0x13a365-0x0;var _0x414fb4=_0xf13e[_0x13a365];return _0x414fb4;};'use strict';var _=require(_0xef13('0x0'));var util=require(_0xef13('0x1'));var moment=require(_0xef13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef13('0x3'));var logger=require(_0xef13('0x4'))(_0xef13('0x5'));var config=require('../../config/environment');var jayson=require(_0xef13('0x6'));var client=jayson[_0xef13('0x7')][_0xef13('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c13d2,_0x91f494,_0x36d828){return new BPromise(function(_0xde4c62,_0x2e68a8){return client['request'](_0x4c13d2,_0x36d828)[_0xef13('0x9')](function(_0x5de743){logger[_0xef13('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x91f494,_0xef13('0xb'));logger[_0xef13('0xc')](_0xef13('0xd'),_0x91f494,_0xef13('0xb'),JSON[_0xef13('0xe')](_0x5de743));if(_0x5de743[_0xef13('0xf')]){if(_0x5de743[_0xef13('0xf')]['code']===0x1f4){logger[_0xef13('0xf')](_0xef13('0x10'),_0x91f494,_0x5de743['error']['message']);return _0x2e68a8(_0x5de743[_0xef13('0xf')][_0xef13('0x11')]);}logger[_0xef13('0xf')](_0xef13('0x10'),_0x91f494,_0x5de743[_0xef13('0xf')][_0xef13('0x11')]);return _0xde4c62(_0x5de743[_0xef13('0xf')][_0xef13('0x11')]);}else{logger[_0xef13('0xa')](_0xef13('0x10'),_0x91f494,_0xef13('0xb'));_0xde4c62(_0x5de743[_0xef13('0x12')][_0xef13('0x11')]);}})[_0xef13('0x13')](function(_0x550713){logger[_0xef13('0xf')](_0xef13('0x10'),_0x91f494,_0x550713);_0x2e68a8(_0x550713);});});}exports['CreateVoiceTransferReport']=function(_0x500df5){var _0x335e95=this;return new Promise(function(_0x4eed70,_0x8f55f1){return db[_0xef13('0x14')]['create'](_0x500df5['body'],{'raw':_0x500df5['options']?_0x500df5[_0xef13('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xef13('0x9')](function(_0x51e514){logger[_0xef13('0xa')](_0xef13('0x16'),_0x500df5);logger[_0xef13('0xc')]('CreateVoiceTransferReport',_0x500df5,JSON['stringify'](_0x51e514));_0x4eed70(_0x51e514);})['catch'](function(_0x298e5c){logger['error'](_0xef13('0x16'),_0x298e5c[_0xef13('0x11')],_0x500df5);_0x8f55f1(_0x335e95[_0xef13('0xf')](0x1f4,_0x298e5c[_0xef13('0x11')]));});});}; \ No newline at end of file +var _0x5ce9=['http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','debug','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f41b1,_0x5561fc){var _0x219ad5=function(_0x3cb92){while(--_0x3cb92){_0x5f41b1['push'](_0x5f41b1['shift']());}};_0x219ad5(++_0x5561fc);}(_0x5ce9,0x163));var _0x95ce=function(_0x5d57d3,_0x27999c){_0x5d57d3=_0x5d57d3-0x0;var _0x5718b7=_0x5ce9[_0x5d57d3];return _0x5718b7;};'use strict';var _=require(_0x95ce('0x0'));var util=require(_0x95ce('0x1'));var moment=require(_0x95ce('0x2'));var BPromise=require(_0x95ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95ce('0x5'));var config=require(_0x95ce('0x6'));var jayson=require(_0x95ce('0x7'));var client=jayson[_0x95ce('0x8')][_0x95ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xab8c61,_0x1214fe,_0x3b1222){return new BPromise(function(_0x275a4f,_0x105d2c){return client[_0x95ce('0xa')](_0xab8c61,_0x3b1222)[_0x95ce('0xb')](function(_0x49a4b6){logger[_0x95ce('0xc')](_0x95ce('0xd'),_0x1214fe,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1214fe,'request\x20sent',JSON[_0x95ce('0xe')](_0x49a4b6));if(_0x49a4b6['error']){if(_0x49a4b6[_0x95ce('0xf')]['code']===0x1f4){logger[_0x95ce('0xf')](_0x95ce('0xd'),_0x1214fe,_0x49a4b6[_0x95ce('0xf')][_0x95ce('0x10')]);return _0x105d2c(_0x49a4b6[_0x95ce('0xf')][_0x95ce('0x10')]);}logger[_0x95ce('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x1214fe,_0x49a4b6[_0x95ce('0xf')][_0x95ce('0x10')]);return _0x275a4f(_0x49a4b6['error'][_0x95ce('0x10')]);}else{logger[_0x95ce('0xc')](_0x95ce('0xd'),_0x1214fe,_0x95ce('0x11'));_0x275a4f(_0x49a4b6[_0x95ce('0x12')][_0x95ce('0x10')]);}})[_0x95ce('0x13')](function(_0x573590){logger[_0x95ce('0xf')](_0x95ce('0xd'),_0x1214fe,_0x573590);_0x105d2c(_0x573590);});});}exports[_0x95ce('0x14')]=function(_0x3a7405){var _0x16f781=this;return new Promise(function(_0x4b994d,_0x2eaf24){return db[_0x95ce('0x15')][_0x95ce('0x16')](_0x3a7405[_0x95ce('0x17')],{'raw':_0x3a7405[_0x95ce('0x18')]?_0x3a7405['options']['raw']===undefined?!![]:![]:!![]})[_0x95ce('0xb')](function(_0x318326){logger[_0x95ce('0xc')](_0x95ce('0x14'),_0x3a7405);logger[_0x95ce('0x19')]('CreateVoiceTransferReport',_0x3a7405,JSON[_0x95ce('0xe')](_0x318326));_0x4b994d(_0x318326);})[_0x95ce('0x13')](function(_0x421d5f){logger['error']('CreateVoiceTransferReport',_0x421d5f[_0x95ce('0x10')],_0x3a7405);_0x2eaf24(_0x16f781[_0x95ce('0xf')](0x1f4,_0x421d5f[_0x95ce('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7608954..923c405 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 _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x490d6b,_0x2c74ce){var _0x4f58cc=function(_0x18e99d){while(--_0x18e99d){_0x490d6b['push'](_0x490d6b['shift']());}};_0x4f58cc(++_0x2c74ce);}(_0xf4eb,0xec));var _0xbf4e=function(_0x21aa11,_0x212571){_0x21aa11=_0x21aa11-0x0;var _0x48e949=_0xf4eb[_0x21aa11];return _0x48e949;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x7f5123,_0x3062c5){var _0x10a02a=function(_0x48d0c9){while(--_0x48d0c9){_0x7f5123['push'](_0x7f5123['shift']());}};_0x10a02a(++_0x3062c5);}(_0xe14d,0x1ee));var _0xde14=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe14d[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index bc3962a..cc01d56 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 _0xa8a8=['webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','findOne','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','body','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','json','userId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','calls','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber'];(function(_0x2ad666,_0x521c15){var _0xd95584=function(_0x4dadf2){while(--_0x4dadf2){_0x2ad666['push'](_0x2ad666['shift']());}};_0xd95584(++_0x521c15);}(_0xa8a8,0xec));var _0x8a8a=function(_0x481ee9,_0x4399ec){_0x481ee9=_0x481ee9-0x0;var _0x583fb4=_0xa8a8[_0x481ee9];return _0x583fb4;};'use strict';var path=require(_0x8a8a('0x0'));var fs=require('fs');var _=require(_0x8a8a('0x1'));var db=require(_0x8a8a('0x2'))['db'];var config=require(_0x8a8a('0x3'));var util=require('util');var BPromise=require(_0x8a8a('0x4'));var jayson=require(_0x8a8a('0x5'));var amiClient=jayson[_0x8a8a('0x6')][_0x8a8a('0x7')]({'port':0x232a});var logger=require(_0x8a8a('0x8'))(_0x8a8a('0x9'));var Redis=require(_0x8a8a('0xa'));config[_0x8a8a('0xb')]=_[_0x8a8a('0xc')](config[_0x8a8a('0xb')],{'host':_0x8a8a('0xd'),'port':0x18eb});var io=require(_0x8a8a('0xe'))(new Redis(config[_0x8a8a('0xb')]));var Schema=require(_0x8a8a('0xf'));var originateValidation=new Schema({'userId':{'type':_0x8a8a('0x10'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x8a8a('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8a8a('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x8a8a('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8a8a('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a8a('0x10'),'required':[!![],_0x8a8a('0x13')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8a8a('0x10'),'required':[!![],_0x8a8a('0x13')]},'sessionId':{'type':_0x8a8a('0x12'),'required':[!![],_0x8a8a('0x14')]},'transferNumber':{'type':'string','required':[!![],_0x8a8a('0x15')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a8a('0x13')]},'sessionId':{'type':_0x8a8a('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a8a('0x10'),'required':[!![],_0x8a8a('0x13')]},'sessionId':{'type':_0x8a8a('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a8a('0x10'),'required':[!![],_0x8a8a('0x13')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a8a('0x13')]}});function emit(_0x568b83,_0x1f36b6,_0x3046ae){logger[_0x8a8a('0x16')](_0x568b83,_0x1f36b6,JSON[_0x8a8a('0x17')](_0x3046ae));io['to'](_0x568b83)[_0x8a8a('0x18')](_0x1f36b6,_0x3046ae);}function handleError(_0x5dd616){return function(_0x9d55f9){console[_0x8a8a('0x19')](_0x8a8a('0x1a'),_0x9d55f9,_0x9d55f9 instanceof RangeError);logger[_0x8a8a('0x1b')](_0x9d55f9[_0x8a8a('0x1c')]);if(_0x9d55f9 instanceof RangeError){if(_0x9d55f9[_0x8a8a('0x1d')]){delete _0x9d55f9['name'];}_0x5dd616['status'](0x194)['send'](_0x9d55f9);}else{if(_0x9d55f9['name']){delete _0x9d55f9['name'];}_0x5dd616[_0x8a8a('0x1e')](0x1f4)[_0x8a8a('0x1f')](_0x9d55f9);}};}function checkError(){return function(_0xe0f449){if(!_0xe0f449){throw new RangeError(_0x8a8a('0x20'));}return _0xe0f449;};}function respondWithRpcPromise(_0x22ebd4,_0x2f6af2){return new BPromise(function(_0x242bac,_0xe0321c){var _0x25d5d4=amiClient;return _0x25d5d4[_0x8a8a('0x21')](_0x22ebd4,_0x2f6af2)[_0x8a8a('0x22')](function(_0x3aa2bb){if(_0x3aa2bb[_0x8a8a('0x1b')]){if(_0x3aa2bb[_0x8a8a('0x1b')][_0x8a8a('0x23')]===0x1f4){return _0xe0321c(_0x3aa2bb['error'][_0x8a8a('0x24')]);}return _0x242bac(_0x3aa2bb[_0x8a8a('0x1b')][_0x8a8a('0x24')]);}else{_0x242bac(_0x3aa2bb[_0x8a8a('0x25')]);}})[_0x8a8a('0x26')](function(_0x251315){_0xe0321c(_0x251315);});});}function getAgent(_0x3aa46d){return db['User'][_0x8a8a('0x27')]({'where':{'id':_0x3aa46d,'role':_0x8a8a('0x28')}})[_0x8a8a('0x22')](checkError());}function getAgentCheckSession(_0x54ff7e,_0x58f42b){return new BPromise(function(_0x2dafcd,_0x129d11){var _0x5c70bd=respondWithRpcPromise('VoiceChannels');var _0x4b3bc5=getAgent(_0x54ff7e);Promise[_0x8a8a('0x29')]([_0x5c70bd,_0x4b3bc5])['then'](function(_0x10b916){var _0xdd6221=_0x10b916[0x0];var _0x49ea81=_0x10b916[0x1];var _0x36c7f8=_[_0x8a8a('0x2a')](_0xdd6221[_0x8a8a('0x2b')],function(_0x8df0cb){return _0x8df0cb[_0x8a8a('0x2c')]==_0x49ea81['id']&&_0x8df0cb[_0x8a8a('0x2d')]==_0x58f42b;});if(_0x36c7f8[_0x8a8a('0x2e')]==0x1){_0x2dafcd(_0x49ea81);}else{_0x129d11(new RangeError(_0x8a8a('0x2f')+_0x58f42b+'\x20not\x20found!'));}});});}exports['originate']=function(_0x56e79e,_0x2a00a7){logger[_0x8a8a('0x16')]('originate\x20fired:',_0x56e79e[_0x8a8a('0x30')]);var _0x304e83=originateValidation['validate'](_0x56e79e[_0x8a8a('0x30')]);if(_0x304e83[_0x8a8a('0x2e')]>0x0){return _0x2a00a7[_0x8a8a('0x1e')](0x190)['json'](_0x304e83);}var _0x5bee53=_0x56e79e[_0x8a8a('0x30')]['userId'];var _0x2a3198=_0x56e79e[_0x8a8a('0x30')][_0x8a8a('0x31')];var _0x196698=_0x56e79e[_0x8a8a('0x30')][_0x8a8a('0x32')];var _0x37ce45=_0x56e79e[_0x8a8a('0x30')][_0x8a8a('0x33')];return getAgent(_0x5bee53)[_0x8a8a('0x22')](function(_0x27de26){logger[_0x8a8a('0x16')](_0x8a8a('0x34'),_0x27de26[_0x8a8a('0x1d')]);emit(util[_0x8a8a('0x35')](_0x8a8a('0x36'),_0x27de26[_0x8a8a('0x1d')]),_0x8a8a('0x37'),{'callNumber':_0x2a3198,'callerId':_0x196698,'callbackUrl':_0x37ce45});return _0x2a00a7['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x8a8a('0x26')](handleError(_0x2a00a7));};exports[_0x8a8a('0x38')]=function(_0x376de3,_0x117a5c){logger[_0x8a8a('0x16')]('hangup\x20fired:',_0x376de3['body']);var _0x8d8481=hangupValidation['validate'](_0x376de3[_0x8a8a('0x30')]);if(_0x8d8481['length']>0x0){return _0x117a5c['status'](0x190)[_0x8a8a('0x39')](_0x8d8481);}var _0x1ac761=_0x376de3[_0x8a8a('0x30')][_0x8a8a('0x3a')];var _0x31307c=_0x376de3[_0x8a8a('0x30')][_0x8a8a('0x2d')];return getAgent(_0x1ac761)['then'](function(_0x40d509){logger[_0x8a8a('0x16')](_0x8a8a('0x34'),_0x40d509['name']);emit(util[_0x8a8a('0x35')](_0x8a8a('0x36'),_0x40d509[_0x8a8a('0x1d')]),'webbar:hangup',{'sessionId':_0x31307c});return _0x117a5c[_0x8a8a('0x1e')](0xc8)[_0x8a8a('0x39')]({'error':![],'message':_0x8a8a('0x3b')});})[_0x8a8a('0x26')](handleError(_0x117a5c));};exports[_0x8a8a('0x3c')]=function(_0x3e5b15,_0x4ffdd9){logger['info'](_0x8a8a('0x3d'),_0x3e5b15['body']);var _0x13e0d4=answerValidation[_0x8a8a('0xf')](_0x3e5b15['body']);if(_0x13e0d4['length']>0x0){return _0x4ffdd9[_0x8a8a('0x1e')](0x190)[_0x8a8a('0x39')](_0x13e0d4);}var _0x41d986=_0x3e5b15[_0x8a8a('0x30')]['userId'];var _0x103223=_0x3e5b15['body'][_0x8a8a('0x2d')];return getAgent(_0x41d986)[_0x8a8a('0x22')](function(_0x4c19ff){logger[_0x8a8a('0x16')](_0x8a8a('0x34'),_0x4c19ff[_0x8a8a('0x1d')]);emit(util['format'](_0x8a8a('0x36'),_0x4c19ff[_0x8a8a('0x1d')]),_0x8a8a('0x3e'),{'sessionId':_0x103223});return _0x4ffdd9['status'](0xc8)['json']({'error':![],'message':_0x8a8a('0x3f')});})[_0x8a8a('0x26')](handleError(_0x4ffdd9));};exports[_0x8a8a('0x40')]=function(_0x5c6c98,_0x18449b){logger[_0x8a8a('0x16')](_0x8a8a('0x41'),_0x5c6c98[_0x8a8a('0x30')]);var _0x2d4c11=holdValidation[_0x8a8a('0xf')](_0x5c6c98[_0x8a8a('0x30')]);if(_0x2d4c11[_0x8a8a('0x2e')]>0x0){return _0x18449b[_0x8a8a('0x1e')](0x190)[_0x8a8a('0x39')](_0x2d4c11);}var _0x150b42=_0x5c6c98['body'][_0x8a8a('0x3a')];var _0x3ba9d9=_0x5c6c98[_0x8a8a('0x30')][_0x8a8a('0x2d')];return getAgent(_0x150b42)[_0x8a8a('0x22')](function(_0x2e22b0){logger['info'](_0x8a8a('0x34'),_0x2e22b0[_0x8a8a('0x1d')]);emit(util[_0x8a8a('0x35')](_0x8a8a('0x36'),_0x2e22b0['name']),_0x8a8a('0x42'),{'sessionId':_0x3ba9d9});return _0x18449b[_0x8a8a('0x1e')](0xc8)[_0x8a8a('0x39')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x18449b));};exports[_0x8a8a('0x43')]=function(_0x39a8e0,_0xf4b6ee){logger[_0x8a8a('0x16')](_0x8a8a('0x44'),_0x39a8e0[_0x8a8a('0x30')]);var _0x1d1b5c=unholdValidation[_0x8a8a('0xf')](_0x39a8e0[_0x8a8a('0x30')]);if(_0x1d1b5c['length']>0x0){return _0xf4b6ee['status'](0x190)[_0x8a8a('0x39')](_0x1d1b5c);}var _0x10f689=_0x39a8e0['body']['userId'];var _0x171463=_0x39a8e0['body'][_0x8a8a('0x2d')];return getAgent(_0x10f689)['then'](function(_0x4642d5){logger[_0x8a8a('0x16')](_0x8a8a('0x34'),_0x4642d5[_0x8a8a('0x1d')]);emit(util[_0x8a8a('0x35')](_0x8a8a('0x36'),_0x4642d5[_0x8a8a('0x1d')]),_0x8a8a('0x45'),{'sessionId':_0x171463});return _0xf4b6ee[_0x8a8a('0x1e')](0xc8)[_0x8a8a('0x39')]({'error':![],'message':'unhold\x20executed!'});})[_0x8a8a('0x26')](handleError(_0xf4b6ee));};exports[_0x8a8a('0x46')]=function(_0x32a4ed,_0x1e3bf5){logger[_0x8a8a('0x16')]('calls\x20fired:',_0x1e3bf5[_0x8a8a('0x30')]);var _0x140673=callsValidation['validate'](_0x32a4ed['body']);if(_0x140673[_0x8a8a('0x2e')]>0x0){return _0x1e3bf5[_0x8a8a('0x1e')](0x190)[_0x8a8a('0x39')](_0x140673);}var _0x2ba3bf=_0x32a4ed[_0x8a8a('0x30')][_0x8a8a('0x3a')];var _0x5ed59c=respondWithRpcPromise('VoiceChannels');var _0x495371=getAgent(_0x2ba3bf);return Promise[_0x8a8a('0x29')]([_0x5ed59c,_0x495371])['then'](function(_0x3984dd){var _0xb84ee7=_0x3984dd[0x0];var _0x4e1ca8=_0x3984dd[0x1];var _0x225801=_[_0x8a8a('0x2a')](_0xb84ee7[_0x8a8a('0x2b')],function(_0x119fb5){return _0x119fb5['UserId']==_0x4e1ca8['id'];});return _0x1e3bf5[_0x8a8a('0x1e')](0xc8)['json']({'count':_0x225801[_0x8a8a('0x2e')],'rows':_0x225801});})[_0x8a8a('0x26')](handleError(_0x1e3bf5));};exports['conference']=function(_0x254e4c,_0x101543){logger[_0x8a8a('0x16')](_0x8a8a('0x47'),_0x254e4c['body']);var _0x2b9e36=conferenceValidation[_0x8a8a('0xf')](_0x254e4c[_0x8a8a('0x30')]);if(_0x2b9e36['length']>0x0){return _0x101543['status'](0x190)[_0x8a8a('0x39')](_0x2b9e36);}var _0x4a18fb=_0x254e4c['body']['userId'];return getAgent(_0x4a18fb)[_0x8a8a('0x22')](function(_0x7d79a4){logger['info'](_0x8a8a('0x34'),_0x7d79a4['name']);emit(util['format'](_0x8a8a('0x36'),_0x7d79a4[_0x8a8a('0x1d')]),'webbar:conference');return _0x101543[_0x8a8a('0x1e')](0xc8)[_0x8a8a('0x39')]({'error':![],'message':_0x8a8a('0x48')});})[_0x8a8a('0x26')](handleError(_0x101543));};exports[_0x8a8a('0x49')]=function(_0x126dba,_0x4c8272){logger[_0x8a8a('0x16')](_0x8a8a('0x4a'),_0x126dba['body']);var _0x2ce579=transferValidation[_0x8a8a('0xf')](_0x126dba[_0x8a8a('0x30')]);if(_0x2ce579[_0x8a8a('0x2e')]>0x0){return _0x4c8272[_0x8a8a('0x1e')](0x190)[_0x8a8a('0x39')](_0x2ce579);}var _0x81c1dd=_0x126dba[_0x8a8a('0x30')][_0x8a8a('0x3a')];var _0x176ad3=_0x126dba['body'][_0x8a8a('0x2d')];var _0x2f7537=_0x126dba['body'][_0x8a8a('0x4b')];return getAgent(_0x81c1dd)[_0x8a8a('0x22')](function(_0x2640e3){logger[_0x8a8a('0x16')](_0x8a8a('0x34'),_0x2640e3['name']);emit(util[_0x8a8a('0x35')](_0x8a8a('0x36'),_0x2640e3[_0x8a8a('0x1d')]),_0x8a8a('0x4c'),{'sessionId':_0x176ad3,'transferNumber':_0x2f7537});return _0x4c8272[_0x8a8a('0x1e')](0xc8)[_0x8a8a('0x39')]({'error':![],'message':_0x8a8a('0x4d')});})['catch'](handleError(_0x4c8272));}; \ No newline at end of file +var _0xec56=['client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','catch','calls','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../config/environment','util','bluebird','jayson/promise'];(function(_0xbf654e,_0x488719){var _0xa13b71=function(_0x10c9dd){while(--_0x10c9dd){_0xbf654e['push'](_0xbf654e['shift']());}};_0xa13b71(++_0x488719);}(_0xec56,0x1bd));var _0x6ec5=function(_0xeb6495,_0xe960e3){_0xeb6495=_0xeb6495-0x0;var _0x3bda5d=_0xec56[_0xeb6495];return _0x3bda5d;};'use strict';var path=require(_0x6ec5('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x6ec5('0x1'));var util=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var jayson=require(_0x6ec5('0x4'));var amiClient=jayson[_0x6ec5('0x5')][_0x6ec5('0x6')]({'port':0x232a});var logger=require(_0x6ec5('0x7'))(_0x6ec5('0x8'));var Redis=require(_0x6ec5('0x9'));config[_0x6ec5('0xa')]=_[_0x6ec5('0xb')](config[_0x6ec5('0xa')],{'host':_0x6ec5('0xc'),'port':0x18eb});var io=require(_0x6ec5('0xd'))(new Redis(config[_0x6ec5('0xa')]));var Schema=require(_0x6ec5('0xe'));var originateValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],_0x6ec5('0x10')]},'callNumber':{'type':_0x6ec5('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x6ec5('0x11')},'callbackUrl':{'type':_0x6ec5('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],_0x6ec5('0x10')]},'sessionId':{'type':_0x6ec5('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],_0x6ec5('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],_0x6ec5('0x10')]},'sessionId':{'type':_0x6ec5('0x11'),'required':[!![],_0x6ec5('0x12')]},'transferNumber':{'type':_0x6ec5('0x11'),'required':[!![],_0x6ec5('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],_0x6ec5('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6ec5('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],_0x6ec5('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x6ec5('0xf'),'required':[!![],_0x6ec5('0x10')]}});function emit(_0x4d09fe,_0x13b725,_0x3df696){logger[_0x6ec5('0x14')](_0x4d09fe,_0x13b725,JSON[_0x6ec5('0x15')](_0x3df696));io['to'](_0x4d09fe)[_0x6ec5('0x16')](_0x13b725,_0x3df696);}function handleError(_0x42b690){return function(_0x1dbee9){console[_0x6ec5('0x17')](_0x6ec5('0x18'),_0x1dbee9,_0x1dbee9 instanceof RangeError);logger[_0x6ec5('0x19')](_0x1dbee9[_0x6ec5('0x1a')]);if(_0x1dbee9 instanceof RangeError){if(_0x1dbee9[_0x6ec5('0x1b')]){delete _0x1dbee9[_0x6ec5('0x1b')];}_0x42b690[_0x6ec5('0x1c')](0x194)[_0x6ec5('0x1d')](_0x1dbee9);}else{if(_0x1dbee9[_0x6ec5('0x1b')]){delete _0x1dbee9[_0x6ec5('0x1b')];}_0x42b690['status'](0x1f4)[_0x6ec5('0x1d')](_0x1dbee9);}};}function checkError(){return function(_0x1b1d96){if(!_0x1b1d96){throw new RangeError(_0x6ec5('0x1e'));}return _0x1b1d96;};}function respondWithRpcPromise(_0x20f5a6,_0x3fc9d7){return new BPromise(function(_0x38a821,_0x18243f){var _0x48733b=amiClient;return _0x48733b[_0x6ec5('0x1f')](_0x20f5a6,_0x3fc9d7)[_0x6ec5('0x20')](function(_0x358d18){if(_0x358d18[_0x6ec5('0x19')]){if(_0x358d18['error'][_0x6ec5('0x21')]===0x1f4){return _0x18243f(_0x358d18[_0x6ec5('0x19')]['message']);}return _0x38a821(_0x358d18[_0x6ec5('0x19')][_0x6ec5('0x22')]);}else{_0x38a821(_0x358d18[_0x6ec5('0x23')]);}})['catch'](function(_0x1b779a){_0x18243f(_0x1b779a);});});}function getAgent(_0xd0e8d7){return db[_0x6ec5('0x24')][_0x6ec5('0x25')]({'where':{'id':_0xd0e8d7,'role':_0x6ec5('0x26')}})['then'](checkError());}function getAgentCheckSession(_0x171e2a,_0x267a30){return new BPromise(function(_0x4a9860,_0x2570c7){var _0x3f5ee0=respondWithRpcPromise('VoiceChannels');var _0x3d36cb=getAgent(_0x171e2a);Promise[_0x6ec5('0x27')]([_0x3f5ee0,_0x3d36cb])[_0x6ec5('0x20')](function(_0xa227ff){var _0x116659=_0xa227ff[0x0];var _0x5a30ba=_0xa227ff[0x1];var _0x2b8c99=_[_0x6ec5('0x28')](_0x116659[_0x6ec5('0x29')],function(_0x174164){return _0x174164[_0x6ec5('0x2a')]==_0x5a30ba['id']&&_0x174164[_0x6ec5('0x2b')]==_0x267a30;});if(_0x2b8c99[_0x6ec5('0x2c')]==0x1){_0x4a9860(_0x5a30ba);}else{_0x2570c7(new RangeError('sessionId\x20'+_0x267a30+_0x6ec5('0x2d')));}});});}exports['originate']=function(_0x15e1f6,_0x5c6517){logger[_0x6ec5('0x14')](_0x6ec5('0x2e'),_0x15e1f6['body']);var _0x5db924=originateValidation[_0x6ec5('0xe')](_0x15e1f6[_0x6ec5('0x2f')]);if(_0x5db924['length']>0x0){return _0x5c6517[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0x5db924);}var _0x54ab73=_0x15e1f6[_0x6ec5('0x2f')][_0x6ec5('0x31')];var _0x391c01=_0x15e1f6[_0x6ec5('0x2f')][_0x6ec5('0x32')];var _0x23a73c=_0x15e1f6[_0x6ec5('0x2f')][_0x6ec5('0x33')];var _0x4b7a08=_0x15e1f6[_0x6ec5('0x2f')]['callbackUrl'];return getAgent(_0x54ab73)[_0x6ec5('0x20')](function(_0xe1e58){logger[_0x6ec5('0x14')](_0x6ec5('0x34'),_0xe1e58[_0x6ec5('0x1b')]);emit(util[_0x6ec5('0x35')](_0x6ec5('0x36'),_0xe1e58[_0x6ec5('0x1b')]),_0x6ec5('0x37'),{'callNumber':_0x391c01,'callerId':_0x23a73c,'callbackUrl':_0x4b7a08});return _0x5c6517[_0x6ec5('0x1c')](0xc8)[_0x6ec5('0x30')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x5c6517));};exports[_0x6ec5('0x38')]=function(_0x519017,_0xf65d54){logger[_0x6ec5('0x14')](_0x6ec5('0x39'),_0x519017[_0x6ec5('0x2f')]);var _0x2b47ab=hangupValidation[_0x6ec5('0xe')](_0x519017[_0x6ec5('0x2f')]);if(_0x2b47ab['length']>0x0){return _0xf65d54[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0x2b47ab);}var _0x42b134=_0x519017[_0x6ec5('0x2f')][_0x6ec5('0x31')];var _0x32db57=_0x519017[_0x6ec5('0x2f')][_0x6ec5('0x2b')];return getAgent(_0x42b134)[_0x6ec5('0x20')](function(_0x53dcd8){logger[_0x6ec5('0x14')]('entityFound:',_0x53dcd8[_0x6ec5('0x1b')]);emit(util['format'](_0x6ec5('0x36'),_0x53dcd8[_0x6ec5('0x1b')]),'webbar:hangup',{'sessionId':_0x32db57});return _0xf65d54[_0x6ec5('0x1c')](0xc8)[_0x6ec5('0x30')]({'error':![],'message':_0x6ec5('0x3a')});})['catch'](handleError(_0xf65d54));};exports[_0x6ec5('0x3b')]=function(_0x1fc5cb,_0x4a3e6b){logger[_0x6ec5('0x14')](_0x6ec5('0x3c'),_0x1fc5cb[_0x6ec5('0x2f')]);var _0xb8324=answerValidation[_0x6ec5('0xe')](_0x1fc5cb[_0x6ec5('0x2f')]);if(_0xb8324[_0x6ec5('0x2c')]>0x0){return _0x4a3e6b[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0xb8324);}var _0x5a7b9c=_0x1fc5cb[_0x6ec5('0x2f')]['userId'];var _0x17cfed=_0x1fc5cb[_0x6ec5('0x2f')][_0x6ec5('0x2b')];return getAgent(_0x5a7b9c)[_0x6ec5('0x20')](function(_0x4be992){logger[_0x6ec5('0x14')](_0x6ec5('0x34'),_0x4be992['name']);emit(util[_0x6ec5('0x35')]('user:%s',_0x4be992[_0x6ec5('0x1b')]),_0x6ec5('0x3d'),{'sessionId':_0x17cfed});return _0x4a3e6b[_0x6ec5('0x1c')](0xc8)[_0x6ec5('0x30')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x4a3e6b));};exports[_0x6ec5('0x3e')]=function(_0x56dc23,_0x2e69ff){logger[_0x6ec5('0x14')](_0x6ec5('0x3f'),_0x56dc23[_0x6ec5('0x2f')]);var _0x2cf8c7=holdValidation['validate'](_0x56dc23['body']);if(_0x2cf8c7[_0x6ec5('0x2c')]>0x0){return _0x2e69ff[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0x2cf8c7);}var _0x45972a=_0x56dc23[_0x6ec5('0x2f')][_0x6ec5('0x31')];var _0x4013b1=_0x56dc23[_0x6ec5('0x2f')][_0x6ec5('0x2b')];return getAgent(_0x45972a)[_0x6ec5('0x20')](function(_0xd265c){logger[_0x6ec5('0x14')](_0x6ec5('0x34'),_0xd265c[_0x6ec5('0x1b')]);emit(util['format'](_0x6ec5('0x36'),_0xd265c['name']),_0x6ec5('0x40'),{'sessionId':_0x4013b1});return _0x2e69ff[_0x6ec5('0x1c')](0xc8)['json']({'error':![],'message':_0x6ec5('0x41')});})[_0x6ec5('0x42')](handleError(_0x2e69ff));};exports['unhold']=function(_0x23a64d,_0x21a910){logger['info']('unhold\x20fired:',_0x23a64d[_0x6ec5('0x2f')]);var _0x49fa43=unholdValidation['validate'](_0x23a64d[_0x6ec5('0x2f')]);if(_0x49fa43[_0x6ec5('0x2c')]>0x0){return _0x21a910[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0x49fa43);}var _0x5aecab=_0x23a64d[_0x6ec5('0x2f')][_0x6ec5('0x31')];var _0x2bad24=_0x23a64d[_0x6ec5('0x2f')][_0x6ec5('0x2b')];return getAgent(_0x5aecab)[_0x6ec5('0x20')](function(_0x15c0d7){logger[_0x6ec5('0x14')](_0x6ec5('0x34'),_0x15c0d7[_0x6ec5('0x1b')]);emit(util[_0x6ec5('0x35')](_0x6ec5('0x36'),_0x15c0d7[_0x6ec5('0x1b')]),'webbar:unhold',{'sessionId':_0x2bad24});return _0x21a910[_0x6ec5('0x1c')](0xc8)[_0x6ec5('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x6ec5('0x42')](handleError(_0x21a910));};exports[_0x6ec5('0x43')]=function(_0x377c08,_0x1e80bc){logger[_0x6ec5('0x14')]('calls\x20fired:',_0x1e80bc['body']);var _0x282cbc=callsValidation['validate'](_0x377c08[_0x6ec5('0x2f')]);if(_0x282cbc[_0x6ec5('0x2c')]>0x0){return _0x1e80bc[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0x282cbc);}var _0x301e31=_0x377c08['body'][_0x6ec5('0x31')];var _0x4838a9=respondWithRpcPromise('VoiceChannels');var _0x5cedd7=getAgent(_0x301e31);return Promise[_0x6ec5('0x27')]([_0x4838a9,_0x5cedd7])[_0x6ec5('0x20')](function(_0x47d81f){var _0x59fd7f=_0x47d81f[0x0];var _0x36d685=_0x47d81f[0x1];var _0x14d38=_[_0x6ec5('0x28')](_0x59fd7f[_0x6ec5('0x29')],function(_0x34578a){return _0x34578a['UserId']==_0x36d685['id'];});return _0x1e80bc[_0x6ec5('0x1c')](0xc8)[_0x6ec5('0x30')]({'count':_0x14d38[_0x6ec5('0x2c')],'rows':_0x14d38});})[_0x6ec5('0x42')](handleError(_0x1e80bc));};exports[_0x6ec5('0x44')]=function(_0x522966,_0x34a136){logger[_0x6ec5('0x14')](_0x6ec5('0x45'),_0x522966[_0x6ec5('0x2f')]);var _0x2a5a1=conferenceValidation[_0x6ec5('0xe')](_0x522966[_0x6ec5('0x2f')]);if(_0x2a5a1[_0x6ec5('0x2c')]>0x0){return _0x34a136[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0x2a5a1);}var _0x42623c=_0x522966[_0x6ec5('0x2f')][_0x6ec5('0x31')];return getAgent(_0x42623c)[_0x6ec5('0x20')](function(_0x3ed512){logger[_0x6ec5('0x14')](_0x6ec5('0x34'),_0x3ed512['name']);emit(util[_0x6ec5('0x35')]('user:%s',_0x3ed512[_0x6ec5('0x1b')]),'webbar:conference');return _0x34a136['status'](0xc8)[_0x6ec5('0x30')]({'error':![],'message':_0x6ec5('0x46')});})[_0x6ec5('0x42')](handleError(_0x34a136));};exports[_0x6ec5('0x47')]=function(_0x1d4424,_0x48b5a9){logger[_0x6ec5('0x14')](_0x6ec5('0x48'),_0x1d4424[_0x6ec5('0x2f')]);var _0x189dbc=transferValidation[_0x6ec5('0xe')](_0x1d4424['body']);if(_0x189dbc[_0x6ec5('0x2c')]>0x0){return _0x48b5a9[_0x6ec5('0x1c')](0x190)[_0x6ec5('0x30')](_0x189dbc);}var _0x974b90=_0x1d4424['body'][_0x6ec5('0x31')];var _0x39f48a=_0x1d4424['body']['sessionId'];var _0x12f741=_0x1d4424[_0x6ec5('0x2f')][_0x6ec5('0x49')];return getAgent(_0x974b90)[_0x6ec5('0x20')](function(_0x23e750){logger[_0x6ec5('0x14')](_0x6ec5('0x34'),_0x23e750[_0x6ec5('0x1b')]);emit(util[_0x6ec5('0x35')](_0x6ec5('0x36'),_0x23e750[_0x6ec5('0x1b')]),'webbar:transfer',{'sessionId':_0x39f48a,'transferNumber':_0x12f741});return _0x48b5a9[_0x6ec5('0x1c')](0xc8)[_0x6ec5('0x30')]({'error':![],'message':_0x6ec5('0x4a')});})[_0x6ec5('0x42')](handleError(_0x48b5a9));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b0404e9..4b0a582 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2c7=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x10e633,_0x30e941){var _0x5dc12f=function(_0x386668){while(--_0x386668){_0x10e633['push'](_0x10e633['shift']());}};_0x5dc12f(++_0x30e941);}(_0xc2c7,0x134));var _0x7c2c=function(_0x343c3d,_0x486bac){_0x343c3d=_0x343c3d-0x0;var _0x16f84c=_0xc2c7[_0x343c3d];return _0x16f84c;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x8')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c2c('0x16')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['addDisposition']);router[_0x7c2c('0x16')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['post'](_0x7c2c('0x12'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x16')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x19')]);router[_0x7c2c('0x16')](_0x7c2c('0x1a'),controller[_0x7c2c('0x1b')]);router[_0x7c2c('0x16')](_0x7c2c('0x1c'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1d')]);router['put'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7c2c('0x1e')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1f')]);router[_0x7c2c('0x1e')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['removeDispositions']);router[_0x7c2c('0x1e')]('/:id/canned_answers',auth[_0x7c2c('0x9')](),controller['removeAnswers']);router[_0x7c2c('0x1e')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xda2d=['/:id','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete'];(function(_0x1a1a50,_0x45bcf6){var _0xec6651=function(_0x29bf32){while(--_0x29bf32){_0x1a1a50['push'](_0x1a1a50['shift']());}};_0xec6651(++_0x45bcf6);}(_0xda2d,0x102));var _0xdda2=function(_0x4f9939,_0x56fa3b){_0x4f9939=_0x4f9939-0x0;var _0x5e8326=_0xda2d[_0x4f9939];return _0x5e8326;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['get'](_0xdda2('0xd'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xe')]);router[_0xdda2('0x7')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xdda2('0x7')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x12')]);router[_0xdda2('0x13')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x14')]);router['post'](_0xdda2('0xd'),auth['isAuthenticated'](),controller[_0xdda2('0x15')]);router[_0xdda2('0x13')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x16')]);router['post']('/:id/users',auth[_0xdda2('0x8')](),controller['addAgents']);router[_0xdda2('0x13')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x17')]);router[_0xdda2('0x13')](_0xdda2('0x18'),controller[_0xdda2('0x19')]);router[_0xdda2('0x13')](_0xdda2('0x1a'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x1b')]);router[_0xdda2('0x1c')]('/:id',auth[_0xdda2('0x8')](),controller['update']);router[_0xdda2('0x1d')](_0xdda2('0x1e'),auth[_0xdda2('0x8')](),controller['destroy']);router[_0xdda2('0x1d')]('/:id/dispositions',auth[_0xdda2('0x8')](),controller[_0xdda2('0x1f')]);router['delete'](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x20')]);router[_0xdda2('0x1d')](_0xdda2('0x21'),auth['isAuthenticated'](),controller[_0xdda2('0x22')]);module[_0xdda2('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 74ecec2..b7b7eaf 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 _0xc31b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','STRING','generate','ENUM','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3f5677,_0x2f9db7){var _0x3cb65b=function(_0x42f7b8){while(--_0x42f7b8){_0x3f5677['push'](_0x3f5677['shift']());}};_0x3cb65b(++_0x2f9db7);}(_0xc31b,0x16b));var _0xbc31=function(_0x4186ab,_0x4a07bf){_0x4186ab=_0x4186ab-0x0;var _0x14a07c=_0xc31b[_0x4186ab];return _0x14a07c;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xbc31('0x0')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xbc31('0x0')],'allowNull':![]},'token':{'type':Sequelize[_0xbc31('0x0')],'defaultValue':function(){return rs[_0xbc31('0x1')]();}},'phone':{'type':Sequelize[_0xbc31('0x0')]},'type':{'type':Sequelize[_0xbc31('0x2')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xbc31('0x0')]},'baseUrl':{'type':Sequelize[_0xbc31('0x0')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbc31('0x3')],'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[_0xbc31('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbc31('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbc31('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbc31('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xbc31('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xbc31('0x4')],'defaultValue':![],'comment':_0xbc31('0x7'),'set':function(_0x39437b){if(!_0x39437b){this[_0xbc31('0x8')](_0xbc31('0x9'),null);}this[_0xbc31('0x8')]('mandatoryDisposition',_0x39437b);}},'description':{'type':Sequelize[_0xbc31('0x0')]}}; \ No newline at end of file +var _0xd2fe=['setDataValue','mandatoryDispositionPauseId','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'];(function(_0x46e7ae,_0x1ecf22){var _0x24949a=function(_0x482f5f){while(--_0x482f5f){_0x46e7ae['push'](_0x46e7ae['shift']());}};_0x24949a(++_0x1ecf22);}(_0xd2fe,0x132));var _0xed2f=function(_0x4ab43d,_0x2fde93){_0x4ab43d=_0x4ab43d-0x0;var _0x1d1723=_0xd2fe[_0x4ab43d];return _0x1d1723;};'use strict';var Sequelize=require(_0xed2f('0x0'));var rs=require(_0xed2f('0x1'));module[_0xed2f('0x2')]={'name':{'type':Sequelize[_0xed2f('0x3')],'unique':_0xed2f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xed2f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xed2f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xed2f('0x3')],'defaultValue':function(){return rs[_0xed2f('0x5')]();}},'phone':{'type':Sequelize[_0xed2f('0x3')]},'type':{'type':Sequelize[_0xed2f('0x6')](_0xed2f('0x7'),_0xed2f('0x8'))},'accountSid':{'type':Sequelize[_0xed2f('0x3')]},'baseUrl':{'type':Sequelize[_0xed2f('0x3')]},'authToken':{'type':Sequelize[_0xed2f('0x3')]},'notificationTemplate':{'type':Sequelize[_0xed2f('0x9')],'defaultValue':function(){return _0xed2f('0xa');}},'notificationSound':{'type':Sequelize[_0xed2f('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xed2f('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xed2f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xed2f('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xed2f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed2f('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed2f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed2f('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xed2f('0xb')],'defaultValue':![],'comment':_0xed2f('0xd'),'set':function(_0x4cc7ca){if(!_0x4cc7ca){this[_0xed2f('0xe')](_0xed2f('0xf'),null);}this[_0xed2f('0xe')]('mandatoryDisposition',_0x4cc7ca);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 05baa7f..1df2d11 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 _0x25b1=['set','Content-Type','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','defaults','redis','localhost','./whatsappAccount.socket','jayson/promise','request','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','asc','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','MessageSid','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','messageId','AttachmentId','UserId','applications','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x25b1,0x199));var _0x125b=function(_0x486788,_0x42d444){_0x486788=_0x486788-0x0;var _0x3612f3=_0x25b1[_0x486788];return _0x3612f3;};'use strict';var emlformat=require(_0x125b('0x0'));var rimraf=require(_0x125b('0x1'));var zipdir=require(_0x125b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x125b('0x3'));var moment=require(_0x125b('0x4'));var BPromise=require(_0x125b('0x5'));var Mustache=require(_0x125b('0x6'));var util=require(_0x125b('0x7'));var path=require(_0x125b('0x8'));var sox=require(_0x125b('0x9'));var csv=require(_0x125b('0xa'));var ejs=require(_0x125b('0xb'));var fs=require('fs');var fs_extra=require(_0x125b('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x125b('0xd'));var deskjs=require(_0x125b('0xe'));var toCsv=require(_0x125b('0xa'));var querystring=require(_0x125b('0xf'));var Papa=require(_0x125b('0x10'));var Redis=require('ioredis');var authService=require(_0x125b('0x11'));var qs=require(_0x125b('0x12'));var as=require(_0x125b('0x13'));var hardwareService=require(_0x125b('0x14'));var logger=require(_0x125b('0x15'))(_0x125b('0x16'));var utils=require(_0x125b('0x17'));var config=require(_0x125b('0x18'));var licenseUtil=require(_0x125b('0x19'));var db=require(_0x125b('0x1a'))['db'];config['redis']=_[_0x125b('0x1b')](config[_0x125b('0x1c')],{'host':_0x125b('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x125b('0x1e'))['register'](socket);var jayson=require(_0x125b('0x1f'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x538524,_0x5f1690,_0x5a971e,_0x2a22dd){return new BPromise(function(_0x48b4d8,_0x1cf8ec){var _0x164ec6=_0x2a22dd||client;return _0x164ec6[_0x125b('0x20')](_0x538524,_0x5a971e)['then'](function(_0x343966){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5f1690,_0x125b('0x21'));logger['debug'](_0x125b('0x22'),_0x5f1690,_0x125b('0x21'),JSON['stringify'](_0x343966));if(_0x343966[_0x125b('0x23')]){if(_0x343966[_0x125b('0x23')][_0x125b('0x24')]===0x1f4){logger[_0x125b('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x5f1690,_0x343966[_0x125b('0x23')]['message']);return _0x1cf8ec(_0x343966[_0x125b('0x23')]['message']);}logger[_0x125b('0x23')](_0x125b('0x25'),_0x5f1690,_0x343966[_0x125b('0x23')]['message']);return _0x48b4d8(_0x343966[_0x125b('0x23')][_0x125b('0x26')]);}else{logger[_0x125b('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x5f1690,_0x125b('0x21'));_0x48b4d8(_0x343966[_0x125b('0x28')][_0x125b('0x26')]);}})[_0x125b('0x29')](function(_0x58f829){logger[_0x125b('0x23')](_0x125b('0x25'),_0x5f1690,_0x58f829);_0x1cf8ec(_0x58f829);});});}function respondWithStatusCode(_0x1960f9,_0x312a7c){_0x312a7c=_0x312a7c||0xcc;return function(_0x249c37){if(_0x249c37){return _0x1960f9[_0x125b('0x2a')](_0x312a7c);}return _0x1960f9[_0x125b('0x2b')](_0x312a7c)[_0x125b('0x2c')]();};}function respondWithResult(_0xea8daf,_0x1a7360){_0x1a7360=_0x1a7360||0xc8;return function(_0x2e6634){if(_0x2e6634){return _0xea8daf['status'](_0x1a7360)['json'](_0x2e6634);}};}function respondWithFilteredResult(_0x357caa,_0x324ae7){return function(_0x526564){if(_0x526564){var _0x20c20f=typeof _0x324ae7[_0x125b('0x2d')]==='undefined'&&typeof _0x324ae7[_0x125b('0x2e')]===_0x125b('0x2f');var _0x17a13c=_0x526564['count'];var _0x3ab7d4=_0x20c20f?0x0:_0x324ae7[_0x125b('0x2d')];var _0x79339f=_0x20c20f?_0x526564[_0x125b('0x30')]:_0x324ae7[_0x125b('0x2d')]+_0x324ae7[_0x125b('0x2e')];var _0x3f5d7d;if(_0x79339f>=_0x17a13c){_0x79339f=_0x17a13c;_0x3f5d7d=0xc8;}else{_0x3f5d7d=0xce;}_0x357caa[_0x125b('0x2b')](_0x3f5d7d);return _0x357caa['set'](_0x125b('0x31'),_0x3ab7d4+'-'+_0x79339f+'/'+_0x17a13c)[_0x125b('0x32')](_0x526564);}return null;};}function patchUpdates(_0x14750e){return function(_0x2e31a5){try{jsonpatch[_0x125b('0x33')](_0x2e31a5,_0x14750e,!![]);}catch(_0x2cbb33){return BPromise[_0x125b('0x34')](_0x2cbb33);}return _0x2e31a5['save']();};}function saveUpdates(_0xa8a83d,_0x38a950){return function(_0x5e92d0){if(_0x5e92d0){return _0x5e92d0[_0x125b('0x35')](_0xa8a83d)[_0x125b('0x36')](function(_0x3ef977){return _0x3ef977;});}return null;};}function removeEntity(_0x3edb2e,_0x201db5){return function(_0x1e7a60){if(_0x1e7a60){return _0x1e7a60[_0x125b('0x37')]()['then'](function(){var _0x4a8e6d=_0x1e7a60[_0x125b('0x38')]({'plain':!![]});var _0x533882=_0x125b('0x39');return db[_0x125b('0x3a')]['destroy']({'where':{'type':_0x533882,'resourceId':_0x4a8e6d['id']}})['then'](function(){return _0x1e7a60;});})[_0x125b('0x36')](function(){_0x3edb2e[_0x125b('0x2b')](0xcc)[_0x125b('0x2c')]();});}};}function handleEntityNotFound(_0x1e9ec5,_0x37551d){return function(_0xe80a23){if(!_0xe80a23){_0x1e9ec5[_0x125b('0x2a')](0x194);}return _0xe80a23;};}function handleError(_0x2e1b3e,_0x43f76a){_0x43f76a=_0x43f76a||0x1f4;return function(_0x5eb6bd){logger[_0x125b('0x23')](_0x5eb6bd[_0x125b('0x3b')]);if(_0x5eb6bd['name']){delete _0x5eb6bd[_0x125b('0x3c')];}_0x2e1b3e[_0x125b('0x2b')](_0x43f76a)['send'](_0x5eb6bd);};}exports[_0x125b('0x3d')]=function(_0x444f39,_0x1ca067){var _0x15846a={'include':[{'model':db['Pause'],'as':_0x125b('0x3e')}]},_0x2b4e75={},_0x22b1df={'count':0x0,'rows':[]};var _0x41a38c=_[_0x125b('0x3f')](db[_0x125b('0x40')][_0x125b('0x41')],function(_0x24aa3d){return{'name':_0x24aa3d['fieldName'],'type':_0x24aa3d[_0x125b('0x42')][_0x125b('0x43')]};});_0x2b4e75[_0x125b('0x44')]=_['map'](_0x41a38c,_0x125b('0x3c'));_0x2b4e75[_0x125b('0x45')]=_[_0x125b('0x46')](_0x444f39[_0x125b('0x45')]);_0x2b4e75['filters']=_[_0x125b('0x47')](_0x2b4e75[_0x125b('0x44')],_0x2b4e75[_0x125b('0x45')]);_0x15846a['attributes']=_[_0x125b('0x47')](_0x2b4e75[_0x125b('0x44')],qs['fields'](_0x444f39['query'][_0x125b('0x48')]));_0x15846a[_0x125b('0x49')]=_0x15846a[_0x125b('0x49')][_0x125b('0x4a')]?_0x15846a['attributes']:_0x2b4e75[_0x125b('0x44')];if(!_0x444f39['query'][_0x125b('0x4b')](_0x125b('0x4c'))){_0x15846a[_0x125b('0x2e')]=qs[_0x125b('0x2e')](_0x444f39[_0x125b('0x45')]['limit']);_0x15846a[_0x125b('0x2d')]=qs[_0x125b('0x2d')](_0x444f39[_0x125b('0x45')][_0x125b('0x2d')]);}_0x15846a[_0x125b('0x4d')]=qs['sort'](_0x444f39[_0x125b('0x45')][_0x125b('0x4e')]);_0x15846a[_0x125b('0x4f')]=qs[_0x125b('0x50')](_['pick'](_0x444f39[_0x125b('0x45')],_0x2b4e75[_0x125b('0x50')]),_0x41a38c);if(_0x444f39[_0x125b('0x45')][_0x125b('0x51')]){_0x15846a[_0x125b('0x4f')]=_[_0x125b('0x52')](_0x15846a[_0x125b('0x4f')],{'$or':_['map'](_0x41a38c,function(_0x5dc29c){if(_0x5dc29c[_0x125b('0x42')]!=='VIRTUAL'){var _0x4bcdc5={};_0x4bcdc5[_0x5dc29c[_0x125b('0x3c')]]={'$like':'%'+_0x444f39[_0x125b('0x45')][_0x125b('0x51')]+'%'};return _0x4bcdc5;}})});}_0x15846a=_[_0x125b('0x52')]({},_0x15846a,_0x444f39[_0x125b('0x53')]);var _0x42da4e={'where':_0x15846a[_0x125b('0x4f')]};return db[_0x125b('0x40')][_0x125b('0x30')](_0x42da4e)[_0x125b('0x36')](function(_0x1bfce9){_0x22b1df[_0x125b('0x30')]=_0x1bfce9;if(_0x444f39[_0x125b('0x45')][_0x125b('0x54')]){_0x15846a[_0x125b('0x55')]=[{'all':!![]}];}return db[_0x125b('0x40')][_0x125b('0x56')](_0x15846a);})[_0x125b('0x36')](function(_0x488f17){_0x22b1df[_0x125b('0x57')]=_0x488f17;return _0x22b1df;})[_0x125b('0x36')](respondWithFilteredResult(_0x1ca067,_0x15846a))[_0x125b('0x29')](handleError(_0x1ca067,null));};exports['show']=function(_0x1ed6b6,_0xd4cb9e){var _0x5caa41={'raw':![],'where':{'id':_0x1ed6b6[_0x125b('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x125b('0x3e')}]},_0x2946cb={};_0x2946cb[_0x125b('0x44')]=_[_0x125b('0x46')](db[_0x125b('0x40')][_0x125b('0x41')]);_0x2946cb[_0x125b('0x45')]=_[_0x125b('0x46')](_0x1ed6b6[_0x125b('0x45')]);_0x2946cb[_0x125b('0x50')]=_[_0x125b('0x47')](_0x2946cb['model'],_0x2946cb['query']);_0x5caa41[_0x125b('0x49')]=_['intersection'](_0x2946cb[_0x125b('0x44')],qs[_0x125b('0x48')](_0x1ed6b6[_0x125b('0x45')]['fields']));_0x5caa41[_0x125b('0x49')]=_0x5caa41[_0x125b('0x49')][_0x125b('0x4a')]?_0x5caa41['attributes']:_0x2946cb[_0x125b('0x44')];if(_0x1ed6b6['query'][_0x125b('0x54')]){_0x5caa41[_0x125b('0x55')]=[{'all':!![]}];}_0x5caa41=_[_0x125b('0x52')]({},_0x5caa41,_0x1ed6b6[_0x125b('0x53')]);return db[_0x125b('0x40')][_0x125b('0x59')](_0x5caa41)[_0x125b('0x36')](handleEntityNotFound(_0xd4cb9e,null))[_0x125b('0x36')](respondWithResult(_0xd4cb9e,null))['catch'](handleError(_0xd4cb9e,null));};exports[_0x125b('0x5a')]=function(_0x2225a0,_0x4d5c31){return db['WhatsappAccount'][_0x125b('0x5a')](_0x2225a0[_0x125b('0x5b')],{})[_0x125b('0x36')](function(_0x485bfb){var _0xe3abf6=_0x2225a0[_0x125b('0x5c')][_0x125b('0x38')]({'plain':!![]});if(!_0xe3abf6)throw new Error(_0x125b('0x5d'));if(_0xe3abf6[_0x125b('0x5e')]===_0x125b('0x5c')){var _0x1166c1=_0x485bfb[_0x125b('0x38')]({'plain':!![]});var _0xafb55a=_0x125b('0x39');return db[_0x125b('0x5f')][_0x125b('0x59')]({'where':{'name':_0xafb55a,'userProfileId':_0xe3abf6[_0x125b('0x60')]},'raw':!![]})[_0x125b('0x36')](function(_0x121ee7){if(_0x121ee7&&_0x121ee7[_0x125b('0x61')]===0x0){return db[_0x125b('0x3a')]['create']({'name':_0x1166c1['name'],'resourceId':_0x1166c1['id'],'type':_0x121ee7['name'],'sectionId':_0x121ee7['id']},{})['then'](function(){return _0x485bfb;});}else{return _0x485bfb;}})[_0x125b('0x29')](function(_0x3e2e2a){logger[_0x125b('0x23')](_0x125b('0x62'),_0x3e2e2a);throw _0x3e2e2a;});}return _0x485bfb;})['then'](respondWithResult(_0x4d5c31,0xc9))[_0x125b('0x29')](handleError(_0x4d5c31,null));};exports[_0x125b('0x35')]=function(_0x1d5ee1,_0x3667fd){if(_0x1d5ee1[_0x125b('0x5b')]['id']){delete _0x1d5ee1[_0x125b('0x5b')]['id'];}return db[_0x125b('0x40')][_0x125b('0x59')]({'where':{'id':_0x1d5ee1[_0x125b('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x125b('0x3e')}]})[_0x125b('0x36')](handleEntityNotFound(_0x3667fd,null))[_0x125b('0x36')](saveUpdates(_0x1d5ee1[_0x125b('0x5b')],null))[_0x125b('0x36')](respondWithResult(_0x3667fd,null))[_0x125b('0x29')](handleError(_0x3667fd,null));};exports['destroy']=function(_0x37b543,_0x12b2f0){return db[_0x125b('0x40')][_0x125b('0x59')]({'where':{'id':_0x37b543[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x12b2f0,null))[_0x125b('0x36')](removeEntity(_0x12b2f0,null))[_0x125b('0x29')](handleError(_0x12b2f0,null));};exports[_0x125b('0x63')]=function(_0x5ee720,_0x33b25c){return db['WhatsappAccount'][_0x125b('0x63')]()[_0x125b('0x36')](respondWithResult(_0x33b25c,null))[_0x125b('0x29')](handleError(_0x33b25c,null));};exports[_0x125b('0x64')]=function(_0x244a97,_0x15def8,_0x46183a){if(_0x244a97[_0x125b('0x5b')]['id']){delete _0x244a97[_0x125b('0x5b')]['id'];}return db[_0x125b('0x40')][_0x125b('0x59')]({'where':{'id':_0x244a97[_0x125b('0x58')]['id']}})['then'](handleEntityNotFound(_0x15def8,null))[_0x125b('0x36')](function(_0x3ec0bd){if(_0x3ec0bd){_0x244a97[_0x125b('0x5b')][_0x125b('0x65')]=_0x3ec0bd['id'];return db[_0x125b('0x66')][_0x125b('0x5a')](_0x244a97[_0x125b('0x5b')]);}})[_0x125b('0x36')](respondWithResult(_0x15def8,null))[_0x125b('0x29')](handleError(_0x15def8,null));};exports[_0x125b('0x67')]=function(_0xa62e35,_0x2d82e9,_0x45cbae){var _0x515e3f={'raw':![],'where':{}};var _0x260b5={};var _0x4f7e54={'count':0x0,'rows':[]};return db[_0x125b('0x40')][_0x125b('0x68')]({'where':{'id':_0xa62e35[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x2d82e9,null))[_0x125b('0x36')](function(_0x426446){if(_0x426446){_0x260b5[_0x125b('0x44')]=_['keys'](db[_0x125b('0x66')][_0x125b('0x41')]);_0x260b5[_0x125b('0x45')]=_[_0x125b('0x46')](_0xa62e35[_0x125b('0x45')]);_0x260b5['filters']=_['intersection'](_0x260b5['model'],_0x260b5[_0x125b('0x45')]);_0x515e3f['attributes']=_[_0x125b('0x47')](_0x260b5[_0x125b('0x44')],qs[_0x125b('0x48')](_0xa62e35[_0x125b('0x45')][_0x125b('0x48')]));_0x515e3f['attributes']=_0x515e3f[_0x125b('0x49')][_0x125b('0x4a')]?_0x515e3f['attributes']:_0x260b5[_0x125b('0x44')];if(!_0xa62e35[_0x125b('0x45')][_0x125b('0x4b')]('nolimit')){_0x515e3f['limit']=qs[_0x125b('0x2e')](_0xa62e35[_0x125b('0x45')][_0x125b('0x2e')]);_0x515e3f[_0x125b('0x2d')]=qs[_0x125b('0x2d')](_0xa62e35[_0x125b('0x45')][_0x125b('0x2d')]);}_0x515e3f['order']=qs[_0x125b('0x4e')](_0xa62e35[_0x125b('0x45')][_0x125b('0x4e')]);_0x515e3f[_0x125b('0x4f')]=qs[_0x125b('0x50')](_[_0x125b('0x69')](_0xa62e35[_0x125b('0x45')],_0x260b5[_0x125b('0x50')]));_0x515e3f[_0x125b('0x4f')][_0x125b('0x65')]=_0x426446['id'];if(_0xa62e35[_0x125b('0x45')][_0x125b('0x51')]){_0x515e3f[_0x125b('0x4f')]=_[_0x125b('0x52')](_0x515e3f['where'],{'$or':_[_0x125b('0x3f')](_0x515e3f[_0x125b('0x49')],function(_0x4c1443){var _0x51bdb0={};_0x51bdb0[_0x4c1443]={'$like':'%'+_0xa62e35[_0x125b('0x45')][_0x125b('0x51')]+'%'};return _0x51bdb0;})});}_0x515e3f=_['merge']({},_0x515e3f,_0xa62e35[_0x125b('0x53')]);return db[_0x125b('0x66')][_0x125b('0x30')]({'where':_0x515e3f['where']})['then'](function(_0x4679aa){_0x4f7e54[_0x125b('0x30')]=_0x4679aa;if(_0xa62e35[_0x125b('0x45')][_0x125b('0x54')]){_0x515e3f[_0x125b('0x55')]=[{'all':!![]}];}return db[_0x125b('0x66')][_0x125b('0x56')](_0x515e3f);})[_0x125b('0x36')](function(_0x4db820){_0x4f7e54[_0x125b('0x57')]=_0x4db820;return _0x4f7e54;});}})[_0x125b('0x36')](respondWithFilteredResult(_0x2d82e9,_0x515e3f))[_0x125b('0x29')](handleError(_0x2d82e9,null));};exports[_0x125b('0x6a')]=function(_0x1ed62e,_0x1c333b,_0x4de673){return db['WhatsappAccount']['find']({'where':{'id':_0x1ed62e[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x1c333b,null))[_0x125b('0x36')](function(_0x1de1e0){if(_0x1de1e0){return _0x1de1e0[_0x125b('0x6a')](_0x1ed62e[_0x125b('0x45')][_0x125b('0x6b')]);}})['then'](respondWithStatusCode(_0x1c333b,null))[_0x125b('0x29')](handleError(_0x1c333b,null));};exports[_0x125b('0x6c')]=function(_0x61536d,_0x450f64,_0x35d977){if(_0x61536d['body']['id']){delete _0x61536d[_0x125b('0x5b')]['id'];}return db[_0x125b('0x40')][_0x125b('0x59')]({'where':{'id':_0x61536d[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x450f64,null))['then'](function(_0x357f27){if(_0x357f27){_0x61536d[_0x125b('0x5b')][_0x125b('0x65')]=_0x357f27['id'];return db['CannedAnswer'][_0x125b('0x5a')](_0x61536d['body']);}})[_0x125b('0x36')](respondWithResult(_0x450f64,null))[_0x125b('0x29')](handleError(_0x450f64,null));};exports[_0x125b('0x6d')]=function(_0x22f87e,_0x4ccf9b,_0x4666bd){var _0x409554={'raw':![],'where':{}};var _0x37d383={};var _0x48eb4b={'count':0x0,'rows':[]};return db[_0x125b('0x40')]['findOne']({'where':{'id':_0x22f87e['params']['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x4ccf9b,null))[_0x125b('0x36')](function(_0x3a9cbc){if(_0x3a9cbc){_0x37d383[_0x125b('0x44')]=_[_0x125b('0x46')](db['CannedAnswer'][_0x125b('0x41')]);_0x37d383[_0x125b('0x45')]=_[_0x125b('0x46')](_0x22f87e[_0x125b('0x45')]);_0x37d383[_0x125b('0x50')]=_[_0x125b('0x47')](_0x37d383['model'],_0x37d383[_0x125b('0x45')]);_0x409554[_0x125b('0x49')]=_[_0x125b('0x47')](_0x37d383[_0x125b('0x44')],qs[_0x125b('0x48')](_0x22f87e[_0x125b('0x45')]['fields']));_0x409554['attributes']=_0x409554[_0x125b('0x49')][_0x125b('0x4a')]?_0x409554['attributes']:_0x37d383[_0x125b('0x44')];if(!_0x22f87e[_0x125b('0x45')][_0x125b('0x4b')](_0x125b('0x4c'))){_0x409554[_0x125b('0x2e')]=qs[_0x125b('0x2e')](_0x22f87e[_0x125b('0x45')][_0x125b('0x2e')]);_0x409554[_0x125b('0x2d')]=qs['offset'](_0x22f87e['query'][_0x125b('0x2d')]);}_0x409554['order']=qs[_0x125b('0x4e')](_0x22f87e[_0x125b('0x45')]['sort']);_0x409554[_0x125b('0x4f')]=qs[_0x125b('0x50')](_[_0x125b('0x69')](_0x22f87e[_0x125b('0x45')],_0x37d383[_0x125b('0x50')]));_0x409554[_0x125b('0x4f')]['WhatsappAccountId']=_0x3a9cbc['id'];if(_0x22f87e[_0x125b('0x45')][_0x125b('0x51')]){_0x409554[_0x125b('0x4f')]=_['merge'](_0x409554['where'],{'$or':_['map'](_0x409554[_0x125b('0x49')],function(_0x4cd421){var _0x28f667={};_0x28f667[_0x4cd421]={'$like':'%'+_0x22f87e[_0x125b('0x45')][_0x125b('0x51')]+'%'};return _0x28f667;})});}_0x409554=_[_0x125b('0x52')]({},_0x409554,_0x22f87e[_0x125b('0x53')]);return db[_0x125b('0x6e')][_0x125b('0x30')]({'where':_0x409554[_0x125b('0x4f')]})[_0x125b('0x36')](function(_0x39792d){_0x48eb4b[_0x125b('0x30')]=_0x39792d;if(_0x22f87e['query'][_0x125b('0x54')]){_0x409554['include']=[{'all':!![]}];}return db[_0x125b('0x6e')]['findAll'](_0x409554);})[_0x125b('0x36')](function(_0x433cc0){_0x48eb4b['rows']=_0x433cc0;return _0x48eb4b;});}})[_0x125b('0x36')](respondWithFilteredResult(_0x4ccf9b,_0x409554))[_0x125b('0x29')](handleError(_0x4ccf9b,null));};exports[_0x125b('0x6f')]=function(_0x170fc3,_0x491082,_0x53ebb9){return db[_0x125b('0x40')][_0x125b('0x59')]({'where':{'id':_0x170fc3[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x491082,null))[_0x125b('0x36')](function(_0x37e822){if(_0x37e822){return _0x37e822[_0x125b('0x6f')](_0x170fc3[_0x125b('0x45')][_0x125b('0x6b')]);}})[_0x125b('0x36')](respondWithStatusCode(_0x491082,null))[_0x125b('0x29')](handleError(_0x491082,null));};exports[_0x125b('0x70')]=function(_0x41067e,_0x4b4f47,_0x170df1){return db['WhatsappAccount'][_0x125b('0x59')]({'where':{'id':_0x41067e[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x4b4f47,null))[_0x125b('0x36')](function(_0x474cf9){if(_0x474cf9){return _0x474cf9['addAgents'](_0x41067e['body'][_0x125b('0x6b')],_[_0x125b('0x71')](_0x41067e[_0x125b('0x5b')],['ids','id'])||{})[_0x125b('0x72')](function(_0x4ffd11){for(var _0x1bc376=0x0;_0x1bc376<_0x41067e[_0x125b('0x5b')][_0x125b('0x6b')][_0x125b('0x4a')];_0x1bc376+=0x1){socket[_0x125b('0x73')](_0x125b('0x74'),{'UserId':Number(_0x41067e[_0x125b('0x5b')][_0x125b('0x6b')][_0x1bc376]),'WhatsappAccountId':Number(_0x41067e['params']['id'])});}return _0x4ffd11;});}})['then'](respondWithResult(_0x4b4f47,null))[_0x125b('0x29')](handleError(_0x4b4f47,null));};exports[_0x125b('0x75')]=function(_0x2f75e3,_0x4aa4e9,_0x8a78f){return db[_0x125b('0x40')]['find']({'where':{'id':_0x2f75e3[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x4aa4e9,null))[_0x125b('0x36')](function(_0x5cee0e){if(_0x5cee0e){return _0x5cee0e['removeAgents'](_0x2f75e3['query'][_0x125b('0x6b')])[_0x125b('0x36')](function(){if(_[_0x125b('0x76')](_0x2f75e3['query']['ids'])){for(var _0x2b8bdd=0x0;_0x2b8bdd<_0x2f75e3['query']['ids'][_0x125b('0x4a')];_0x2b8bdd+=0x1){socket[_0x125b('0x73')](_0x125b('0x77'),{'UserId':Number(_0x2f75e3[_0x125b('0x45')]['ids'][_0x2b8bdd]),'WhatsappAccountId':Number(_0x2f75e3[_0x125b('0x58')]['id'])});}}else{socket[_0x125b('0x73')](_0x125b('0x77'),{'UserId':Number(_0x2f75e3[_0x125b('0x45')][_0x125b('0x6b')]),'WhatsappAccountId':Number(_0x2f75e3[_0x125b('0x58')]['id'])});}});}})[_0x125b('0x36')](respondWithStatusCode(_0x4aa4e9,null))[_0x125b('0x29')](handleError(_0x4aa4e9,null));};exports[_0x125b('0x78')]=function(_0x3f3ab1,_0x2ad0f4,_0x34f6a5){var _0x5d3038={};var _0x503bb3={};var _0x443cc8;var _0xf123a8;return db[_0x125b('0x40')][_0x125b('0x68')]({'where':{'id':_0x3f3ab1[_0x125b('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ad0f4,null))['then'](function(_0x1540c3){if(_0x1540c3){_0x443cc8=_0x1540c3;_0x503bb3[_0x125b('0x44')]=_['keys'](db[_0x125b('0x79')][_0x125b('0x41')]);_0x503bb3[_0x125b('0x45')]=_[_0x125b('0x46')](_0x3f3ab1['query']);_0x503bb3['filters']=_['intersection'](_0x503bb3[_0x125b('0x44')],_0x503bb3['query']);_0x5d3038[_0x125b('0x49')]=_[_0x125b('0x47')](_0x503bb3[_0x125b('0x44')],qs[_0x125b('0x48')](_0x3f3ab1[_0x125b('0x45')][_0x125b('0x48')]));_0x5d3038[_0x125b('0x49')]=_0x5d3038[_0x125b('0x49')][_0x125b('0x4a')]?_0x5d3038[_0x125b('0x49')]:_0x503bb3[_0x125b('0x44')];_0x5d3038['order']=qs[_0x125b('0x4e')](_0x3f3ab1[_0x125b('0x45')]['sort']);_0x5d3038[_0x125b('0x4f')]=qs[_0x125b('0x50')](_[_0x125b('0x69')](_0x3f3ab1[_0x125b('0x45')],_0x503bb3['filters']));if(_0x3f3ab1[_0x125b('0x45')][_0x125b('0x51')]){_0x5d3038['where']=_['merge'](_0x5d3038[_0x125b('0x4f')],{'$or':_['map'](_0x5d3038[_0x125b('0x49')],function(_0x24abbd){var _0x7449e6={};_0x7449e6[_0x24abbd]={'$like':'%'+_0x3f3ab1[_0x125b('0x45')][_0x125b('0x51')]+'%'};return _0x7449e6;})});}_0x5d3038=_[_0x125b('0x52')]({},_0x5d3038,_0x3f3ab1[_0x125b('0x53')]);return _0x443cc8[_0x125b('0x78')](_0x5d3038);}})[_0x125b('0x36')](function(_0x2b72dc){if(_0x2b72dc){_0xf123a8=_0x2b72dc[_0x125b('0x4a')];if(!_0x3f3ab1[_0x125b('0x45')][_0x125b('0x4b')](_0x125b('0x4c'))){_0x5d3038['limit']=qs['limit'](_0x3f3ab1[_0x125b('0x45')]['limit']);_0x5d3038[_0x125b('0x2d')]=qs[_0x125b('0x2d')](_0x3f3ab1[_0x125b('0x45')]['offset']);}return _0x443cc8['getAgents'](_0x5d3038);}})['then'](function(_0x594f9f){if(_0x594f9f){return _0x594f9f?{'count':_0xf123a8,'rows':_0x594f9f}:null;}})[_0x125b('0x36')](respondWithResult(_0x2ad0f4,null))['catch'](handleError(_0x2ad0f4,null));};exports[_0x125b('0x7a')]=function(_0x124ef9,_0x39e51d){var _0x5cf3fa=_0x124ef9['params']['id'];var _0x4eb97e=_0x124ef9[_0x125b('0x5b')];var _0x5abd49=0xc8;var _0x2cb5ce=null;return db[_0x125b('0x7b')][_0x125b('0x7c')]({'isolationLevel':db[_0x125b('0x7b')][_0x125b('0x7d')][_0x125b('0x7e')][_0x125b('0x7f')]},function(_0x19ebe1){return db[_0x125b('0x40')]['findOne']({'where':{'id':_0x5cf3fa},'transaction':_0x19ebe1})[_0x125b('0x36')](function(_0x5b8ccc){if(_0x5b8ccc){return db[_0x125b('0x80')][_0x125b('0x37')]({'where':{'WhatsappAccountId':_0x5cf3fa},'transaction':_0x19ebe1})[_0x125b('0x36')](function(){var _0x4e96ab=_[_0x125b('0x3f')](_0x4eb97e,function(_0x3e3d8d){_0x3e3d8d['WhatsappAccountId']=_0x5cf3fa;return _0x3e3d8d;});return db[_0x125b('0x80')][_0x125b('0x81')](_0x4e96ab,{'transaction':_0x19ebe1});});}else{_0x5abd49=0x194;_0x2cb5ce=[];}});})[_0x125b('0x36')](function(){if(_0x5abd49!==0x194){return db[_0x125b('0x80')][_0x125b('0x82')]({'where':{'WhatsappAccountId':_0x5cf3fa},'order':_0x125b('0x83')})['then'](function(_0x2402d0){_0x2cb5ce=_0x2402d0;});}})[_0x125b('0x29')](function(_0x2da6c0){_0x5abd49=0x1f4;logger[_0x125b('0x23')](_0x2da6c0[_0x125b('0x3b')]);if(_0x2da6c0['name']){delete _0x2da6c0[_0x125b('0x3c')];}_0x2cb5ce=_0x2da6c0;})[_0x125b('0x84')](function(){if(_0x2cb5ce===null){_0x39e51d[_0x125b('0x2a')](_0x5abd49);}else{if(_0x5abd49===0x1f4){_0x39e51d['status'](_0x5abd49)[_0x125b('0x85')](_0x2cb5ce);}else{_0x39e51d[_0x125b('0x2b')](_0x5abd49)[_0x125b('0x32')](_0x2cb5ce);}}});};exports[_0x125b('0x86')]=function(_0x36d032,_0x18304b,_0x9f8e6d){var _0x3de70a={};var _0x14ebaf={};var _0x3b2b88;var _0x59c3c1;return db[_0x125b('0x40')]['findOne']({'where':{'id':_0x36d032[_0x125b('0x58')]['id']}})[_0x125b('0x36')](handleEntityNotFound(_0x18304b,null))[_0x125b('0x36')](function(_0x596949){if(_0x596949){_0x3b2b88=_0x596949;_0x14ebaf['model']=_[_0x125b('0x46')](db['WhatsappApplication'][_0x125b('0x41')]);_0x14ebaf[_0x125b('0x45')]=_[_0x125b('0x46')](_0x36d032[_0x125b('0x45')]);_0x14ebaf['filters']=_['intersection'](_0x14ebaf[_0x125b('0x44')],_0x14ebaf[_0x125b('0x45')]);_0x3de70a[_0x125b('0x49')]=_['intersection'](_0x14ebaf[_0x125b('0x44')],qs[_0x125b('0x48')](_0x36d032[_0x125b('0x45')][_0x125b('0x48')]));_0x3de70a[_0x125b('0x49')]=_0x3de70a[_0x125b('0x49')][_0x125b('0x4a')]?_0x3de70a[_0x125b('0x49')]:_0x14ebaf[_0x125b('0x44')];_0x3de70a[_0x125b('0x4d')]=qs['sort'](_0x36d032['query'][_0x125b('0x4e')]);_0x3de70a['where']=qs[_0x125b('0x50')](_[_0x125b('0x69')](_0x36d032[_0x125b('0x45')],_0x14ebaf['filters']));if(_0x36d032[_0x125b('0x45')][_0x125b('0x51')]){_0x3de70a[_0x125b('0x4f')]=_[_0x125b('0x52')](_0x3de70a[_0x125b('0x4f')],{'$or':_[_0x125b('0x3f')](_0x3de70a[_0x125b('0x49')],function(_0x13160a){var _0x2443a8={};_0x2443a8[_0x13160a]={'$like':'%'+_0x36d032[_0x125b('0x45')]['filter']+'%'};return _0x2443a8;})});}_0x3de70a=_['merge']({},_0x3de70a,_0x36d032[_0x125b('0x53')]);return _0x3b2b88[_0x125b('0x86')](_0x3de70a);}})[_0x125b('0x36')](function(_0x25d84e){if(_0x25d84e){_0x59c3c1=_0x25d84e['length'];if(!_0x36d032[_0x125b('0x45')][_0x125b('0x4b')](_0x125b('0x4c'))){_0x3de70a[_0x125b('0x2e')]=qs['limit'](_0x36d032[_0x125b('0x45')]['limit']);_0x3de70a[_0x125b('0x2d')]=qs[_0x125b('0x2d')](_0x36d032[_0x125b('0x45')]['offset']);}return _0x3b2b88[_0x125b('0x86')](_0x3de70a);}})[_0x125b('0x36')](function(_0x79e30f){if(_0x79e30f){return _0x79e30f?{'count':_0x59c3c1,'rows':_0x79e30f}:null;}})[_0x125b('0x36')](respondWithResult(_0x18304b,null))[_0x125b('0x29')](handleError(_0x18304b,null));};exports[_0x125b('0x87')]=function(_0x50e9d3,_0x789d2,_0x14ba11){var _0x5650c6={'channel':_0x125b('0x88')};var _0x3eefcd=[];var _0x2d8a05=[];var _0x295a96={};return db[_0x125b('0x40')]['find']({'where':{'id':_0x50e9d3[_0x125b('0x58')]['id']},'include':[{'model':db[_0x125b('0x80')],'as':'Applications'}]})[_0x125b('0x36')](handleEntityNotFound(_0x789d2,null))[_0x125b('0x36')](function(_0x117624){_0x5650c6[_0x125b('0x89')]=_0x117624;if(_0x5650c6[_0x125b('0x89')]&&_0x5650c6[_0x125b('0x89')][_0x125b('0x42')]===_0x125b('0x8a')&&_0x50e9d3[_0x125b('0x5b')]['statuses']){if(_0x50e9d3[_0x125b('0x5b')][_0x125b('0x8b')][_0x125b('0x4a')]===0x0)return;if(_0x50e9d3[_0x125b('0x5b')][_0x125b('0x8b')][0x0]['state']!==_0x125b('0x8c'))return;return db[_0x125b('0x8d')][_0x125b('0x35')]({'read':!![],'readAt':_0x50e9d3['body'][_0x125b('0x8b')][0x0][_0x125b('0x8e')]},{'where':{'messageId':_0x50e9d3['body'][_0x125b('0x8b')][0x0][_0x125b('0x8f')]},'individualHooks':!![]})[_0x125b('0x36')](function(_0x45fd88){return _0x789d2[_0x125b('0x2b')](0xc8)[_0x125b('0x32')](_0x45fd88);});}_0x5650c6['applications']=_['orderBy'](_0x117624['Applications'],['priority'],[_0x125b('0x90')]);if(_0x5650c6[_0x125b('0x89')][_0x125b('0x91')]){delete _0x5650c6[_0x125b('0x89')]['Applications'];}return db[_0x125b('0x92')]['describe']()[_0x125b('0x36')](function(_0x14a26d){if(!_0x14a26d){throw new db[(_0x125b('0x93'))][(_0x125b('0x94'))](_0x125b('0x95'));}_0x3eefcd=_['difference'](_[_0x125b('0x46')](_0x14a26d),[_0x125b('0x96'),_0x125b('0x97')]);_0x2d8a05=_[_0x125b('0x98')](_[_0x125b('0x46')](_0x14a26d),[_0x125b('0x96'),_0x125b('0x97'),_0x125b('0x99'),_0x125b('0x9a')]);_0x5650c6[_0x125b('0x5b')]={'mapKey':_0x125b('0x9b')};if(_0x5650c6[_0x125b('0x89')]&&_0x5650c6[_0x125b('0x89')][_0x125b('0x42')]===_0x125b('0x9c')){_0x5650c6[_0x125b('0x5b')]['from']=_0x50e9d3['body'][_0x125b('0x9d')][_0x125b('0x9e')](_0x125b('0x9f'),'');_0x5650c6[_0x125b('0x5b')][_0x125b('0x5b')]=_0x50e9d3['body'][_0x125b('0xa0')];_0x5650c6[_0x125b('0x5b')]['messageId']=_0x50e9d3[_0x125b('0x5b')][_0x125b('0xa1')];}if(_0x5650c6['account']&&_0x5650c6[_0x125b('0x89')][_0x125b('0x42')]===_0x125b('0x8a')){_0x5650c6[_0x125b('0x5b')][_0x125b('0xa2')]=_0x50e9d3[_0x125b('0x5b')][_0x125b('0xa3')][0x0]['from'];_0x5650c6[_0x125b('0x5b')][_0x125b('0x5b')]=_0x50e9d3[_0x125b('0x5b')][_0x125b('0xa3')][0x0][_0x125b('0x26')][_0x125b('0x5b')];_0x5650c6[_0x125b('0x5b')]['messageId']=_0x50e9d3['body'][_0x125b('0xa3')][0x0][_0x125b('0x8f')];}if(_0x5650c6['body']['id']){delete _0x5650c6['body']['id'];}if(_[_0x125b('0xa4')](_0x5650c6[_0x125b('0x5b')][_0x125b('0xa2')])){throw new db['Sequelize'][(_0x125b('0x94'))](_0x125b('0xa5'));}if(_[_0x125b('0xa4')](_0x5650c6[_0x125b('0x5b')][_0x125b('0x5b')])||_0x5650c6[_0x125b('0x5b')]['body']===''){throw new db[(_0x125b('0x93'))]['ValidationError'](_0x125b('0xa6'));}if(_[_0x125b('0xa4')](_0x5650c6[_0x125b('0x5b')][_0x125b('0xa7')])){throw new db[(_0x125b('0x93'))]['ValidationError'](_0x125b('0xa8')+_0x2d8a05);}if(!_[_0x125b('0xa9')](_0x2d8a05,_0x5650c6[_0x125b('0x5b')]['mapKey'])){throw new db[(_0x125b('0x93'))][(_0x125b('0x94'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d8a05);}_0x295a96[_0x5650c6['body']['mapKey']]=_0x5650c6[_0x125b('0x5b')][_0x125b('0xa2')];return db[_0x125b('0xaa')][_0x125b('0x59')]({'where':{'id':_0x5650c6[_0x125b('0x89')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x125b('0xab'),'where':_0x295a96,'limit':0x1,'order':[[_0x125b('0x97'),'DESC']]}]});})['then'](handleEntityNotFound(_0x789d2,null))[_0x125b('0x36')](function(_0x10db76){if(_0x10db76){_0x5650c6[_0x125b('0xac')]=_[_0x125b('0x71')](_0x10db76,['Contacts']);if(_0x10db76['Contacts']['length']){return _0x10db76[_0x125b('0xab')][0x0];}var _0x24e34d=_[_0x125b('0x1b')](_0x5650c6[_0x125b('0x5b')],{'firstName':_0x5650c6[_0x125b('0x5b')]['from'],'ListId':_0x10db76['id']});_0x24e34d[_0x5650c6[_0x125b('0x5b')][_0x125b('0xa7')]]=_0x5650c6['body'][_0x125b('0xa2')];return db['CmContact'][_0x125b('0x5a')](_0x24e34d,{'fields':_0x3eefcd,'raw':!![]});}})[_0x125b('0x36')](handleEntityNotFound(_0x789d2,null))[_0x125b('0x36')](function(_0x240b69){if(_0x240b69){_0x5650c6[_0x125b('0xad')]=_0x240b69;var _0x2367c6={'ContactId':_0x240b69['id'],'phone':_0x5650c6[_0x125b('0x5b')][_0x125b('0xa2')],'WhatsappAccountId':_0x50e9d3[_0x125b('0x58')]['id']};var _0x2de812={'ContactId':_0x240b69['id'],'WhatsappAccountId':_0x50e9d3['params']['id'],'closed':![]};return db[_0x125b('0xae')][_0x125b('0x59')]({'where':_0x2de812})[_0x125b('0x36')](function(_0x455dc9){if(_0x455dc9){return[_0x455dc9,![]];}return db[_0x125b('0xae')][_0x125b('0x5a')](_0x2367c6)[_0x125b('0x36')](function(_0x87aeef){return[_0x87aeef,!![]];});});}})['spread'](function(_0x2fb9de,_0x484620){_0x5650c6[_0x125b('0xaf')]=_0x2fb9de[_0x125b('0x38')]({'plain':!![]});_0x5650c6[_0x125b('0xaf')][_0x125b('0xb0')]=![];if(_0x484620){if(_0x5650c6['account'][_0x125b('0xb1')]){_0x5650c6['applications'][_0x125b('0xb2')]({'id':0x0,'priority':_0x5650c6['applications'][_0x125b('0x4a')]+0x1,'app':_0x125b('0xb3'),'appdata':_0x125b('0xb4'),'interval':'*,*,*,*'});}_0x5650c6[_0x125b('0xaf')]['created']=!![];}return db[_0x125b('0x8d')][_0x125b('0x5a')]({'phone':_0x5650c6['body'][_0x125b('0xa2')],'messageId':_0x5650c6[_0x125b('0x5b')][_0x125b('0xb5')],'body':_0x5650c6[_0x125b('0x5b')][_0x125b('0x5b')],'WhatsappAccountId':_0x50e9d3[_0x125b('0x58')]['id'],'WhatsappInteractionId':_0x2fb9de['id'],'direction':'in','ContactId':_0x2fb9de['ContactId'],'AttachmentId':_0x5650c6[_0x125b('0x5b')][_0x125b('0xb6')]});})['then'](function(_0xcd8dbd){_0x5650c6['message']=_0xcd8dbd;if(_0x5650c6[_0x125b('0xaf')][_0x125b('0xb7')]){return db[_0x125b('0x79')][_0x125b('0x59')]({'attributes':['id',_0x125b('0x3c')],'where':{'id':_0x5650c6[_0x125b('0xaf')][_0x125b('0xb7')]}})[_0x125b('0x36')](function(_0x5bd6bd){if(_0x5bd6bd){_0x5650c6[_0x125b('0xb8')]['unshift']({'id':0x0,'priority':0x0,'app':_0x125b('0xb9'),'appdata':_0x5bd6bd[_0x125b('0x3c')]+','+(_0x5650c6['account'][_0x125b('0xba')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x125b('0xbb'),_0x5650c6);});}return respondWithRpcPromise(_0x125b('0xbc'),_0x125b('0xbb'),_0x5650c6);})[_0x125b('0x36')](function(_0x41ab8d){if(_0x41ab8d){var _0x2d8b95=0xc8;var _0x5ea8d3=_0x125b('0xbd');logger[_0x125b('0x27')](_0x125b('0x22'),_0x5ea8d3,_0x2d8b95,_0x125b('0xbe'));logger[_0x125b('0xbf')](_0x125b('0xc0'),_0x5ea8d3,_0x2d8b95,_0x125b('0xbe'),JSON[_0x125b('0xc1')](_0x41ab8d));if(_0x5650c6['account'][_0x125b('0x42')]==='twilio'){return _0x789d2['status'](_0x2d8b95)[_0x125b('0xc2')](_0x125b('0xc3'),_0x125b('0xc4'))[_0x125b('0x85')]('\x0a');}else{return _0x789d2[_0x125b('0x2b')](_0x2d8b95)[_0x125b('0x32')](_0x41ab8d);}}});})[_0x125b('0x29')](handleError(_0x789d2,null));};exports[_0x125b('0x85')]=function(_0x57b046,_0x4f6c53,_0x596662){var _0xd7af4a,_0xef4e10,_0x49fb7a;if(_[_0x125b('0xa4')](_0x57b046[_0x125b('0x5b')][_0x125b('0x5b')])||_0x57b046[_0x125b('0x5b')][_0x125b('0x5b')]===''){throw new db['Sequelize'][(_0x125b('0x94'))](_0x125b('0xa6'));}if(_[_0x125b('0xa4')](_0x57b046[_0x125b('0x5b')]['to'])){throw new db['Sequelize'][(_0x125b('0x94'))](_0x125b('0xc5'));}_0xd7af4a=_0x57b046[_0x125b('0x5b')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x57b046[_0x125b('0x58')]['id']},'include':[{'model':db[_0x125b('0xaa')],'as':_0x125b('0xc6'),'include':[{'model':db['CmContact'],'as':_0x125b('0xab'),'where':{'mobile':_0xd7af4a},'limit':0x1,'order':[[_0x125b('0x97'),'DESC']]}]}]})[_0x125b('0x36')](handleEntityNotFound(_0x4f6c53,null))['then'](function(_0x97f1a7){if(_0x97f1a7&&_0x97f1a7['List']){_0xef4e10=_0x97f1a7[_0x125b('0x38')]({'plain':!![]});if(_0xef4e10[_0x125b('0xc6')]&&_0xef4e10['List'][_0x125b('0xab')][_0x125b('0x4a')]){return _0xef4e10[_0x125b('0xc6')]['Contacts'][0x0];}return db[_0x125b('0x92')][_0x125b('0x5a')](_[_0x125b('0x1b')](_0x57b046[_0x125b('0x5b')],{'firstName':_0xd7af4a,'mobile':_0xd7af4a,'phone':_0xd7af4a,'ListId':_0xef4e10[_0x125b('0x9a')]}));}})[_0x125b('0x36')](handleEntityNotFound(_0x4f6c53,null))['then'](function(_0x503b1f){if(_0x503b1f){_0x49fb7a=_0x503b1f;return db['WhatsappInteraction'][_0x125b('0x59')]({'where':{'ContactId':_0x49fb7a['id'],'closed':![],'WhatsappAccountId':_0xef4e10['id']}})['then'](function(_0x3e537f){if(_0x3e537f){return[_0x3e537f,![]];}return db[_0x125b('0xae')][_0x125b('0x5a')]({'UserId':_0x57b046[_0x125b('0x5c')]['id'],'ContactId':_0x49fb7a['id'],'WhatsappAccountId':_0xef4e10['id'],'phone':_0xd7af4a,'firstMsgDirection':'out','Messages':[_['merge'](_0x57b046[_0x125b('0x5b')],{'read':![],'body':_0x57b046[_0x125b('0x5b')][_0x125b('0x5b')],'phone':_0xd7af4a,'WhatsappAccountId':_0xef4e10['id'],'UserId':_0x57b046[_0x125b('0x5c')]['id'],'ContactId':_0x49fb7a['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x125b('0xc7')}]})[_0x125b('0x36')](function(_0x4eba10){return[_0x4eba10,!![]];});});}})[_0x125b('0x72')](function(_0x17a104,_0x55d3f0){if(_0x55d3f0){return _0x17a104;}return db[_0x125b('0x8d')][_0x125b('0x5a')](_[_0x125b('0x52')](_0x57b046[_0x125b('0x5b')],{'read':![],'body':_0x57b046[_0x125b('0x5b')][_0x125b('0x5b')],'phone':_0xd7af4a,'WhatsappAccountId':_0xef4e10['id'],'WhatsappInteractionId':_0x17a104['id'],'UserId':_0x57b046[_0x125b('0x5c')]['id'],'ContactId':_0x49fb7a['id']}))[_0x125b('0x36')](function(_0x41f232){_0x17a104['dataValues']['Messages']=[];_0x17a104[_0x125b('0xc8')][_0x125b('0xc7')][_0x125b('0xb2')](_0x41f232[_0x125b('0xc8')]);return _0x17a104;});})[_0x125b('0x36')](respondWithResult(_0x4f6c53,null))[_0x125b('0x29')](handleError(_0x4f6c53,null));}; \ No newline at end of file +var _0xd172=['ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','CmContact','user','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','statuses','read','message_id','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','Body','messageId','MessageSid','sinch','notifications','from','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','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','WhatsappMessage'];(function(_0x4511ce,_0x1a040f){var _0x4fab96=function(_0x171da6){while(--_0x171da6){_0x4511ce['push'](_0x4511ce['shift']());}};_0x4fab96(++_0x1a040f);}(_0xd172,0x19c));var _0x2d17=function(_0xa38cf2,_0x13e769){_0xa38cf2=_0xa38cf2-0x0;var _0x1c9a57=_0xd172[_0xa38cf2];return _0x1c9a57;};'use strict';var emlformat=require(_0x2d17('0x0'));var rimraf=require(_0x2d17('0x1'));var zipdir=require(_0x2d17('0x2'));var jsonpatch=require(_0x2d17('0x3'));var rp=require(_0x2d17('0x4'));var moment=require('moment');var BPromise=require(_0x2d17('0x5'));var Mustache=require(_0x2d17('0x6'));var util=require(_0x2d17('0x7'));var path=require(_0x2d17('0x8'));var sox=require(_0x2d17('0x9'));var csv=require('to-csv');var ejs=require(_0x2d17('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d17('0xb'));var squel=require(_0x2d17('0xc'));var crypto=require(_0x2d17('0xd'));var jsforce=require(_0x2d17('0xe'));var deskjs=require(_0x2d17('0xf'));var toCsv=require(_0x2d17('0x10'));var querystring=require(_0x2d17('0x11'));var Papa=require(_0x2d17('0x12'));var Redis=require(_0x2d17('0x13'));var authService=require(_0x2d17('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2d17('0x15'));var utils=require('../../config/utils');var config=require(_0x2d17('0x16'));var licenseUtil=require(_0x2d17('0x17'));var db=require(_0x2d17('0x18'))['db'];config[_0x2d17('0x19')]=_[_0x2d17('0x1a')](config[_0x2d17('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d17('0x19')]));require(_0x2d17('0x1b'))[_0x2d17('0x1c')](socket);var jayson=require(_0x2d17('0x1d'));var client=jayson[_0x2d17('0x1e')][_0x2d17('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x37ede2,_0x88a32d,_0x1bb0a8,_0x3c63d3){return new BPromise(function(_0x28f16a,_0x2f62b0){var _0x20d9ba=_0x3c63d3||client;return _0x20d9ba[_0x2d17('0x20')](_0x37ede2,_0x1bb0a8)['then'](function(_0x43ce18){logger[_0x2d17('0x21')](_0x2d17('0x22'),_0x88a32d,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x88a32d,_0x2d17('0x23'),JSON[_0x2d17('0x24')](_0x43ce18));if(_0x43ce18[_0x2d17('0x25')]){if(_0x43ce18['error'][_0x2d17('0x26')]===0x1f4){logger[_0x2d17('0x25')](_0x2d17('0x22'),_0x88a32d,_0x43ce18[_0x2d17('0x25')][_0x2d17('0x27')]);return _0x2f62b0(_0x43ce18[_0x2d17('0x25')]['message']);}logger['error'](_0x2d17('0x22'),_0x88a32d,_0x43ce18['error']['message']);return _0x28f16a(_0x43ce18[_0x2d17('0x25')]['message']);}else{logger['info'](_0x2d17('0x22'),_0x88a32d,_0x2d17('0x23'));_0x28f16a(_0x43ce18[_0x2d17('0x28')][_0x2d17('0x27')]);}})[_0x2d17('0x29')](function(_0x49b60f){logger[_0x2d17('0x25')](_0x2d17('0x22'),_0x88a32d,_0x49b60f);_0x2f62b0(_0x49b60f);});});}function respondWithStatusCode(_0x5a35ff,_0x5e9c1e){_0x5e9c1e=_0x5e9c1e||0xcc;return function(_0x52e4c7){if(_0x52e4c7){return _0x5a35ff[_0x2d17('0x2a')](_0x5e9c1e);}return _0x5a35ff[_0x2d17('0x2b')](_0x5e9c1e)[_0x2d17('0x2c')]();};}function respondWithResult(_0x4d8754,_0x49cf91){_0x49cf91=_0x49cf91||0xc8;return function(_0x160df5){if(_0x160df5){return _0x4d8754['status'](_0x49cf91)[_0x2d17('0x2d')](_0x160df5);}};}function respondWithFilteredResult(_0x55bc39,_0x535727){return function(_0x50d351){if(_0x50d351){var _0x285eb1=typeof _0x535727[_0x2d17('0x2e')]===_0x2d17('0x2f')&&typeof _0x535727['limit']===_0x2d17('0x2f');var _0x549a6f=_0x50d351['count'];var _0x11bdef=_0x285eb1?0x0:_0x535727[_0x2d17('0x2e')];var _0x27c331=_0x285eb1?_0x50d351['count']:_0x535727[_0x2d17('0x2e')]+_0x535727[_0x2d17('0x30')];var _0x2e118e;if(_0x27c331>=_0x549a6f){_0x27c331=_0x549a6f;_0x2e118e=0xc8;}else{_0x2e118e=0xce;}_0x55bc39['status'](_0x2e118e);return _0x55bc39[_0x2d17('0x31')](_0x2d17('0x32'),_0x11bdef+'-'+_0x27c331+'/'+_0x549a6f)['json'](_0x50d351);}return null;};}function patchUpdates(_0x334b82){return function(_0x26f088){try{jsonpatch[_0x2d17('0x33')](_0x26f088,_0x334b82,!![]);}catch(_0x24b3ec){return BPromise[_0x2d17('0x34')](_0x24b3ec);}return _0x26f088[_0x2d17('0x35')]();};}function saveUpdates(_0x213547,_0x450807){return function(_0x4be6ff){if(_0x4be6ff){return _0x4be6ff['update'](_0x213547)[_0x2d17('0x36')](function(_0x2116c5){return _0x2116c5;});}return null;};}function removeEntity(_0x57316a,_0xdaf80b){return function(_0x1f363f){if(_0x1f363f){return _0x1f363f[_0x2d17('0x37')]()[_0x2d17('0x36')](function(){var _0xf2022c=_0x1f363f[_0x2d17('0x38')]({'plain':!![]});var _0xafb5e8=_0x2d17('0x39');return db['UserProfileResource'][_0x2d17('0x37')]({'where':{'type':_0xafb5e8,'resourceId':_0xf2022c['id']}})[_0x2d17('0x36')](function(){return _0x1f363f;});})[_0x2d17('0x36')](function(){_0x57316a[_0x2d17('0x2b')](0xcc)[_0x2d17('0x2c')]();});}};}function handleEntityNotFound(_0x1e0e8c,_0x439760){return function(_0xf82a63){if(!_0xf82a63){_0x1e0e8c[_0x2d17('0x2a')](0x194);}return _0xf82a63;};}function handleError(_0x280975,_0x16a1d0){_0x16a1d0=_0x16a1d0||0x1f4;return function(_0xf43ea4){logger[_0x2d17('0x25')](_0xf43ea4[_0x2d17('0x3a')]);if(_0xf43ea4['name']){delete _0xf43ea4[_0x2d17('0x3b')];}_0x280975['status'](_0x16a1d0)[_0x2d17('0x3c')](_0xf43ea4);};}exports[_0x2d17('0x3d')]=function(_0x224a0d,_0x3fc9bf){var _0x42941e={'include':[{'model':db[_0x2d17('0x3e')],'as':_0x2d17('0x3f')}]},_0x3821c5={},_0x3adbd4={'count':0x0,'rows':[]};var _0x2cb252=_[_0x2d17('0x40')](db[_0x2d17('0x41')][_0x2d17('0x42')],function(_0x225956){return{'name':_0x225956[_0x2d17('0x43')],'type':_0x225956[_0x2d17('0x44')]['key']};});_0x3821c5[_0x2d17('0x45')]=_[_0x2d17('0x40')](_0x2cb252,_0x2d17('0x3b'));_0x3821c5['query']=_[_0x2d17('0x46')](_0x224a0d[_0x2d17('0x47')]);_0x3821c5[_0x2d17('0x48')]=_[_0x2d17('0x49')](_0x3821c5['model'],_0x3821c5[_0x2d17('0x47')]);_0x42941e[_0x2d17('0x4a')]=_['intersection'](_0x3821c5['model'],qs[_0x2d17('0x4b')](_0x224a0d[_0x2d17('0x47')][_0x2d17('0x4b')]));_0x42941e[_0x2d17('0x4a')]=_0x42941e[_0x2d17('0x4a')][_0x2d17('0x4c')]?_0x42941e[_0x2d17('0x4a')]:_0x3821c5[_0x2d17('0x45')];if(!_0x224a0d[_0x2d17('0x47')][_0x2d17('0x4d')](_0x2d17('0x4e'))){_0x42941e[_0x2d17('0x30')]=qs[_0x2d17('0x30')](_0x224a0d[_0x2d17('0x47')][_0x2d17('0x30')]);_0x42941e[_0x2d17('0x2e')]=qs[_0x2d17('0x2e')](_0x224a0d[_0x2d17('0x47')]['offset']);}_0x42941e[_0x2d17('0x4f')]=qs[_0x2d17('0x50')](_0x224a0d[_0x2d17('0x47')][_0x2d17('0x50')]);_0x42941e['where']=qs[_0x2d17('0x48')](_[_0x2d17('0x51')](_0x224a0d['query'],_0x3821c5[_0x2d17('0x48')]),_0x2cb252);if(_0x224a0d[_0x2d17('0x47')][_0x2d17('0x52')]){_0x42941e[_0x2d17('0x53')]=_[_0x2d17('0x54')](_0x42941e[_0x2d17('0x53')],{'$or':_[_0x2d17('0x40')](_0x2cb252,function(_0x4b8e57){if(_0x4b8e57[_0x2d17('0x44')]!==_0x2d17('0x55')){var _0x3db5f3={};_0x3db5f3[_0x4b8e57[_0x2d17('0x3b')]]={'$like':'%'+_0x224a0d[_0x2d17('0x47')][_0x2d17('0x52')]+'%'};return _0x3db5f3;}})});}_0x42941e=_[_0x2d17('0x54')]({},_0x42941e,_0x224a0d[_0x2d17('0x56')]);var _0x60ae2f={'where':_0x42941e['where']};return db[_0x2d17('0x41')][_0x2d17('0x57')](_0x60ae2f)[_0x2d17('0x36')](function(_0x54eea3){_0x3adbd4[_0x2d17('0x57')]=_0x54eea3;if(_0x224a0d[_0x2d17('0x47')][_0x2d17('0x58')]){_0x42941e[_0x2d17('0x59')]=[{'all':!![]}];}return db[_0x2d17('0x41')][_0x2d17('0x5a')](_0x42941e);})[_0x2d17('0x36')](function(_0x41d07b){_0x3adbd4[_0x2d17('0x5b')]=_0x41d07b;return _0x3adbd4;})[_0x2d17('0x36')](respondWithFilteredResult(_0x3fc9bf,_0x42941e))['catch'](handleError(_0x3fc9bf,null));};exports[_0x2d17('0x5c')]=function(_0x288b4e,_0xc9d3b9){var _0x29cd0e={'raw':![],'where':{'id':_0x288b4e[_0x2d17('0x5d')]['id']},'include':[{'model':db[_0x2d17('0x3e')],'as':_0x2d17('0x3f')}]},_0x4708c9={};_0x4708c9[_0x2d17('0x45')]=_[_0x2d17('0x46')](db[_0x2d17('0x41')]['rawAttributes']);_0x4708c9['query']=_[_0x2d17('0x46')](_0x288b4e['query']);_0x4708c9[_0x2d17('0x48')]=_[_0x2d17('0x49')](_0x4708c9[_0x2d17('0x45')],_0x4708c9[_0x2d17('0x47')]);_0x29cd0e[_0x2d17('0x4a')]=_['intersection'](_0x4708c9['model'],qs[_0x2d17('0x4b')](_0x288b4e[_0x2d17('0x47')][_0x2d17('0x4b')]));_0x29cd0e['attributes']=_0x29cd0e[_0x2d17('0x4a')][_0x2d17('0x4c')]?_0x29cd0e[_0x2d17('0x4a')]:_0x4708c9[_0x2d17('0x45')];if(_0x288b4e['query'][_0x2d17('0x58')]){_0x29cd0e[_0x2d17('0x59')]=[{'all':!![]}];}_0x29cd0e=_[_0x2d17('0x54')]({},_0x29cd0e,_0x288b4e['options']);return db[_0x2d17('0x41')][_0x2d17('0x5e')](_0x29cd0e)['then'](handleEntityNotFound(_0xc9d3b9,null))[_0x2d17('0x36')](respondWithResult(_0xc9d3b9,null))[_0x2d17('0x29')](handleError(_0xc9d3b9,null));};exports[_0x2d17('0x5f')]=function(_0xdadab4,_0x14684f){return db[_0x2d17('0x41')][_0x2d17('0x5f')](_0xdadab4[_0x2d17('0x60')],{})[_0x2d17('0x36')](function(_0x161295){var _0x18eb25=_0xdadab4['user'][_0x2d17('0x38')]({'plain':!![]});if(!_0x18eb25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18eb25[_0x2d17('0x61')]==='user'){var _0x1e949b=_0x161295['get']({'plain':!![]});var _0x3cee=_0x2d17('0x39');return db[_0x2d17('0x62')][_0x2d17('0x5e')]({'where':{'name':_0x3cee,'userProfileId':_0x18eb25[_0x2d17('0x63')]},'raw':!![]})[_0x2d17('0x36')](function(_0x304f90){if(_0x304f90&&_0x304f90['autoAssociation']===0x0){return db[_0x2d17('0x64')][_0x2d17('0x5f')]({'name':_0x1e949b[_0x2d17('0x3b')],'resourceId':_0x1e949b['id'],'type':_0x304f90[_0x2d17('0x3b')],'sectionId':_0x304f90['id']},{})['then'](function(){return _0x161295;});}else{return _0x161295;}})[_0x2d17('0x29')](function(_0x4e2932){logger['error'](_0x2d17('0x65'),_0x4e2932);throw _0x4e2932;});}return _0x161295;})[_0x2d17('0x36')](respondWithResult(_0x14684f,0xc9))[_0x2d17('0x29')](handleError(_0x14684f,null));};exports[_0x2d17('0x66')]=function(_0x588e89,_0x257c7d){if(_0x588e89[_0x2d17('0x60')]['id']){delete _0x588e89['body']['id'];}return db[_0x2d17('0x41')][_0x2d17('0x5e')]({'where':{'id':_0x588e89[_0x2d17('0x5d')]['id']},'include':[{'model':db[_0x2d17('0x3e')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x257c7d,null))[_0x2d17('0x36')](saveUpdates(_0x588e89['body'],null))[_0x2d17('0x36')](respondWithResult(_0x257c7d,null))[_0x2d17('0x29')](handleError(_0x257c7d,null));};exports[_0x2d17('0x37')]=function(_0x155d12,_0x343df9){return db[_0x2d17('0x41')][_0x2d17('0x5e')]({'where':{'id':_0x155d12['params']['id']}})[_0x2d17('0x36')](handleEntityNotFound(_0x343df9,null))[_0x2d17('0x36')](removeEntity(_0x343df9,null))[_0x2d17('0x29')](handleError(_0x343df9,null));};exports[_0x2d17('0x67')]=function(_0x49f6cf,_0x4d9f40){return db[_0x2d17('0x41')][_0x2d17('0x67')]()[_0x2d17('0x36')](respondWithResult(_0x4d9f40,null))['catch'](handleError(_0x4d9f40,null));};exports[_0x2d17('0x68')]=function(_0x34d3c1,_0x11f493,_0x362cc6){if(_0x34d3c1[_0x2d17('0x60')]['id']){delete _0x34d3c1['body']['id'];}return db[_0x2d17('0x41')][_0x2d17('0x5e')]({'where':{'id':_0x34d3c1[_0x2d17('0x5d')]['id']}})['then'](handleEntityNotFound(_0x11f493,null))[_0x2d17('0x36')](function(_0xfb7f46){if(_0xfb7f46){_0x34d3c1[_0x2d17('0x60')][_0x2d17('0x69')]=_0xfb7f46['id'];return db[_0x2d17('0x6a')][_0x2d17('0x5f')](_0x34d3c1[_0x2d17('0x60')]);}})[_0x2d17('0x36')](respondWithResult(_0x11f493,null))[_0x2d17('0x29')](handleError(_0x11f493,null));};exports['getDispositions']=function(_0x2e8d00,_0x5b2d74,_0x2118cf){var _0x4e075f={'raw':![],'where':{}};var _0xa82277={};var _0x347b84={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2e8d00['params']['id']}})['then'](handleEntityNotFound(_0x5b2d74,null))[_0x2d17('0x36')](function(_0x417932){if(_0x417932){_0xa82277['model']=_[_0x2d17('0x46')](db[_0x2d17('0x6a')][_0x2d17('0x42')]);_0xa82277[_0x2d17('0x47')]=_[_0x2d17('0x46')](_0x2e8d00[_0x2d17('0x47')]);_0xa82277[_0x2d17('0x48')]=_[_0x2d17('0x49')](_0xa82277[_0x2d17('0x45')],_0xa82277[_0x2d17('0x47')]);_0x4e075f[_0x2d17('0x4a')]=_[_0x2d17('0x49')](_0xa82277[_0x2d17('0x45')],qs['fields'](_0x2e8d00['query']['fields']));_0x4e075f[_0x2d17('0x4a')]=_0x4e075f['attributes'][_0x2d17('0x4c')]?_0x4e075f[_0x2d17('0x4a')]:_0xa82277['model'];if(!_0x2e8d00['query'][_0x2d17('0x4d')]('nolimit')){_0x4e075f[_0x2d17('0x30')]=qs['limit'](_0x2e8d00[_0x2d17('0x47')][_0x2d17('0x30')]);_0x4e075f[_0x2d17('0x2e')]=qs[_0x2d17('0x2e')](_0x2e8d00[_0x2d17('0x47')][_0x2d17('0x2e')]);}_0x4e075f[_0x2d17('0x4f')]=qs[_0x2d17('0x50')](_0x2e8d00[_0x2d17('0x47')]['sort']);_0x4e075f[_0x2d17('0x53')]=qs[_0x2d17('0x48')](_[_0x2d17('0x51')](_0x2e8d00['query'],_0xa82277[_0x2d17('0x48')]));_0x4e075f[_0x2d17('0x53')][_0x2d17('0x69')]=_0x417932['id'];if(_0x2e8d00[_0x2d17('0x47')][_0x2d17('0x52')]){_0x4e075f['where']=_[_0x2d17('0x54')](_0x4e075f[_0x2d17('0x53')],{'$or':_['map'](_0x4e075f['attributes'],function(_0x187f85){var _0x3038b0={};_0x3038b0[_0x187f85]={'$like':'%'+_0x2e8d00['query']['filter']+'%'};return _0x3038b0;})});}_0x4e075f=_['merge']({},_0x4e075f,_0x2e8d00[_0x2d17('0x56')]);return db[_0x2d17('0x6a')][_0x2d17('0x57')]({'where':_0x4e075f['where']})[_0x2d17('0x36')](function(_0x1f6643){_0x347b84[_0x2d17('0x57')]=_0x1f6643;if(_0x2e8d00['query']['includeAll']){_0x4e075f[_0x2d17('0x59')]=[{'all':!![]}];}return db[_0x2d17('0x6a')][_0x2d17('0x5a')](_0x4e075f);})[_0x2d17('0x36')](function(_0xc1e42c){_0x347b84[_0x2d17('0x5b')]=_0xc1e42c;return _0x347b84;});}})['then'](respondWithFilteredResult(_0x5b2d74,_0x4e075f))[_0x2d17('0x29')](handleError(_0x5b2d74,null));};exports['removeDispositions']=function(_0x477fad,_0x342002,_0x3844e9){return db[_0x2d17('0x41')][_0x2d17('0x5e')]({'where':{'id':_0x477fad[_0x2d17('0x5d')]['id']}})[_0x2d17('0x36')](handleEntityNotFound(_0x342002,null))[_0x2d17('0x36')](function(_0x50c5de){if(_0x50c5de){return _0x50c5de[_0x2d17('0x6b')](_0x477fad[_0x2d17('0x47')][_0x2d17('0x6c')]);}})[_0x2d17('0x36')](respondWithStatusCode(_0x342002,null))[_0x2d17('0x29')](handleError(_0x342002,null));};exports[_0x2d17('0x6d')]=function(_0x4ef511,_0x549c6e,_0x72f34e){if(_0x4ef511[_0x2d17('0x60')]['id']){delete _0x4ef511[_0x2d17('0x60')]['id'];}return db[_0x2d17('0x41')]['find']({'where':{'id':_0x4ef511[_0x2d17('0x5d')]['id']}})['then'](handleEntityNotFound(_0x549c6e,null))[_0x2d17('0x36')](function(_0x573ee8){if(_0x573ee8){_0x4ef511['body'][_0x2d17('0x69')]=_0x573ee8['id'];return db[_0x2d17('0x6e')][_0x2d17('0x5f')](_0x4ef511[_0x2d17('0x60')]);}})[_0x2d17('0x36')](respondWithResult(_0x549c6e,null))[_0x2d17('0x29')](handleError(_0x549c6e,null));};exports['getAnswers']=function(_0xf51173,_0x5ab0d7,_0x2f4ea4){var _0x494e65={'raw':![],'where':{}};var _0x46158b={};var _0x852633={'count':0x0,'rows':[]};return db[_0x2d17('0x41')][_0x2d17('0x6f')]({'where':{'id':_0xf51173[_0x2d17('0x5d')]['id']}})[_0x2d17('0x36')](handleEntityNotFound(_0x5ab0d7,null))[_0x2d17('0x36')](function(_0x1c3d80){if(_0x1c3d80){_0x46158b[_0x2d17('0x45')]=_[_0x2d17('0x46')](db['CannedAnswer'][_0x2d17('0x42')]);_0x46158b[_0x2d17('0x47')]=_[_0x2d17('0x46')](_0xf51173[_0x2d17('0x47')]);_0x46158b[_0x2d17('0x48')]=_['intersection'](_0x46158b[_0x2d17('0x45')],_0x46158b['query']);_0x494e65[_0x2d17('0x4a')]=_[_0x2d17('0x49')](_0x46158b[_0x2d17('0x45')],qs[_0x2d17('0x4b')](_0xf51173[_0x2d17('0x47')][_0x2d17('0x4b')]));_0x494e65[_0x2d17('0x4a')]=_0x494e65[_0x2d17('0x4a')][_0x2d17('0x4c')]?_0x494e65[_0x2d17('0x4a')]:_0x46158b[_0x2d17('0x45')];if(!_0xf51173['query'][_0x2d17('0x4d')](_0x2d17('0x4e'))){_0x494e65[_0x2d17('0x30')]=qs[_0x2d17('0x30')](_0xf51173[_0x2d17('0x47')][_0x2d17('0x30')]);_0x494e65[_0x2d17('0x2e')]=qs[_0x2d17('0x2e')](_0xf51173[_0x2d17('0x47')][_0x2d17('0x2e')]);}_0x494e65[_0x2d17('0x4f')]=qs['sort'](_0xf51173['query'][_0x2d17('0x50')]);_0x494e65[_0x2d17('0x53')]=qs[_0x2d17('0x48')](_[_0x2d17('0x51')](_0xf51173[_0x2d17('0x47')],_0x46158b[_0x2d17('0x48')]));_0x494e65[_0x2d17('0x53')][_0x2d17('0x69')]=_0x1c3d80['id'];if(_0xf51173['query'][_0x2d17('0x52')]){_0x494e65[_0x2d17('0x53')]=_[_0x2d17('0x54')](_0x494e65[_0x2d17('0x53')],{'$or':_[_0x2d17('0x40')](_0x494e65[_0x2d17('0x4a')],function(_0x4d67af){var _0x2a8141={};_0x2a8141[_0x4d67af]={'$like':'%'+_0xf51173[_0x2d17('0x47')][_0x2d17('0x52')]+'%'};return _0x2a8141;})});}_0x494e65=_[_0x2d17('0x54')]({},_0x494e65,_0xf51173[_0x2d17('0x56')]);return db[_0x2d17('0x6e')][_0x2d17('0x57')]({'where':_0x494e65[_0x2d17('0x53')]})[_0x2d17('0x36')](function(_0x118b9a){_0x852633['count']=_0x118b9a;if(_0xf51173['query'][_0x2d17('0x58')]){_0x494e65['include']=[{'all':!![]}];}return db[_0x2d17('0x6e')][_0x2d17('0x5a')](_0x494e65);})[_0x2d17('0x36')](function(_0x1b7288){_0x852633[_0x2d17('0x5b')]=_0x1b7288;return _0x852633;});}})[_0x2d17('0x36')](respondWithFilteredResult(_0x5ab0d7,_0x494e65))[_0x2d17('0x29')](handleError(_0x5ab0d7,null));};exports[_0x2d17('0x70')]=function(_0x1c215d,_0x3f718d,_0x365bbc){return db[_0x2d17('0x41')]['find']({'where':{'id':_0x1c215d[_0x2d17('0x5d')]['id']}})[_0x2d17('0x36')](handleEntityNotFound(_0x3f718d,null))[_0x2d17('0x36')](function(_0x2d4763){if(_0x2d4763){return _0x2d4763[_0x2d17('0x70')](_0x1c215d['query'][_0x2d17('0x6c')]);}})[_0x2d17('0x36')](respondWithStatusCode(_0x3f718d,null))[_0x2d17('0x29')](handleError(_0x3f718d,null));};exports[_0x2d17('0x71')]=function(_0x2aebb7,_0x1a7713,_0x197c02){return db[_0x2d17('0x41')]['find']({'where':{'id':_0x2aebb7['params']['id']}})[_0x2d17('0x36')](handleEntityNotFound(_0x1a7713,null))[_0x2d17('0x36')](function(_0x2beebe){if(_0x2beebe){return _0x2beebe[_0x2d17('0x71')](_0x2aebb7[_0x2d17('0x60')]['ids'],_[_0x2d17('0x72')](_0x2aebb7[_0x2d17('0x60')],[_0x2d17('0x6c'),'id'])||{})[_0x2d17('0x73')](function(_0x345dbd){for(var _0x258734=0x0;_0x258734<_0x2aebb7[_0x2d17('0x60')][_0x2d17('0x6c')][_0x2d17('0x4c')];_0x258734+=0x1){socket[_0x2d17('0x74')]('userWhatsappAccount:save',{'UserId':Number(_0x2aebb7['body']['ids'][_0x258734]),'WhatsappAccountId':Number(_0x2aebb7[_0x2d17('0x5d')]['id'])});}return _0x345dbd;});}})[_0x2d17('0x36')](respondWithResult(_0x1a7713,null))[_0x2d17('0x29')](handleError(_0x1a7713,null));};exports[_0x2d17('0x75')]=function(_0x4871c8,_0xb241c,_0x5e2cc0){return db[_0x2d17('0x41')][_0x2d17('0x5e')]({'where':{'id':_0x4871c8['params']['id']}})[_0x2d17('0x36')](handleEntityNotFound(_0xb241c,null))[_0x2d17('0x36')](function(_0x4984a5){if(_0x4984a5){return _0x4984a5[_0x2d17('0x75')](_0x4871c8['query'][_0x2d17('0x6c')])['then'](function(){if(_[_0x2d17('0x76')](_0x4871c8[_0x2d17('0x47')][_0x2d17('0x6c')])){for(var _0x24456c=0x0;_0x24456c<_0x4871c8[_0x2d17('0x47')][_0x2d17('0x6c')][_0x2d17('0x4c')];_0x24456c+=0x1){socket[_0x2d17('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x4871c8[_0x2d17('0x47')][_0x2d17('0x6c')][_0x24456c]),'WhatsappAccountId':Number(_0x4871c8['params']['id'])});}}else{socket[_0x2d17('0x74')](_0x2d17('0x77'),{'UserId':Number(_0x4871c8[_0x2d17('0x47')]['ids']),'WhatsappAccountId':Number(_0x4871c8[_0x2d17('0x5d')]['id'])});}});}})[_0x2d17('0x36')](respondWithStatusCode(_0xb241c,null))['catch'](handleError(_0xb241c,null));};exports[_0x2d17('0x78')]=function(_0x121a57,_0x2215a9,_0x54dddd){var _0xcbdc8f={};var _0x41681c={};var _0x2615f9;var _0x22e291;return db[_0x2d17('0x41')]['findOne']({'where':{'id':_0x121a57[_0x2d17('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2215a9,null))[_0x2d17('0x36')](function(_0x1323fd){if(_0x1323fd){_0x2615f9=_0x1323fd;_0x41681c[_0x2d17('0x45')]=_[_0x2d17('0x46')](db[_0x2d17('0x79')][_0x2d17('0x42')]);_0x41681c['query']=_['keys'](_0x121a57['query']);_0x41681c[_0x2d17('0x48')]=_['intersection'](_0x41681c['model'],_0x41681c[_0x2d17('0x47')]);_0xcbdc8f[_0x2d17('0x4a')]=_[_0x2d17('0x49')](_0x41681c[_0x2d17('0x45')],qs[_0x2d17('0x4b')](_0x121a57[_0x2d17('0x47')][_0x2d17('0x4b')]));_0xcbdc8f[_0x2d17('0x4a')]=_0xcbdc8f[_0x2d17('0x4a')]['length']?_0xcbdc8f[_0x2d17('0x4a')]:_0x41681c['model'];_0xcbdc8f['order']=qs[_0x2d17('0x50')](_0x121a57['query'][_0x2d17('0x50')]);_0xcbdc8f[_0x2d17('0x53')]=qs[_0x2d17('0x48')](_[_0x2d17('0x51')](_0x121a57['query'],_0x41681c[_0x2d17('0x48')]));if(_0x121a57[_0x2d17('0x47')]['filter']){_0xcbdc8f['where']=_[_0x2d17('0x54')](_0xcbdc8f[_0x2d17('0x53')],{'$or':_['map'](_0xcbdc8f['attributes'],function(_0x1f2aa5){var _0x1494c1={};_0x1494c1[_0x1f2aa5]={'$like':'%'+_0x121a57[_0x2d17('0x47')][_0x2d17('0x52')]+'%'};return _0x1494c1;})});}_0xcbdc8f=_[_0x2d17('0x54')]({},_0xcbdc8f,_0x121a57['options']);return _0x2615f9[_0x2d17('0x78')](_0xcbdc8f);}})[_0x2d17('0x36')](function(_0x1cbaea){if(_0x1cbaea){_0x22e291=_0x1cbaea['length'];if(!_0x121a57[_0x2d17('0x47')][_0x2d17('0x4d')](_0x2d17('0x4e'))){_0xcbdc8f[_0x2d17('0x30')]=qs[_0x2d17('0x30')](_0x121a57['query'][_0x2d17('0x30')]);_0xcbdc8f['offset']=qs[_0x2d17('0x2e')](_0x121a57['query'][_0x2d17('0x2e')]);}return _0x2615f9[_0x2d17('0x78')](_0xcbdc8f);}})[_0x2d17('0x36')](function(_0x337e7e){if(_0x337e7e){return _0x337e7e?{'count':_0x22e291,'rows':_0x337e7e}:null;}})[_0x2d17('0x36')](respondWithResult(_0x2215a9,null))['catch'](handleError(_0x2215a9,null));};exports['addApplications']=function(_0x233bba,_0x4360d3){var _0x5ebee3=_0x233bba[_0x2d17('0x5d')]['id'];var _0x69927=_0x233bba[_0x2d17('0x60')];var _0x5d4743=0xc8;var _0x22a6c1=null;return db[_0x2d17('0x7a')]['transaction']({'isolationLevel':db[_0x2d17('0x7a')][_0x2d17('0x7b')][_0x2d17('0x7c')][_0x2d17('0x7d')]},function(_0x42009f){return db[_0x2d17('0x41')][_0x2d17('0x6f')]({'where':{'id':_0x5ebee3},'transaction':_0x42009f})[_0x2d17('0x36')](function(_0x59469f){if(_0x59469f){return db[_0x2d17('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x5ebee3},'transaction':_0x42009f})[_0x2d17('0x36')](function(){var _0x53f2d4=_['map'](_0x69927,function(_0x265765){_0x265765['WhatsappAccountId']=_0x5ebee3;return _0x265765;});return db[_0x2d17('0x7e')][_0x2d17('0x7f')](_0x53f2d4,{'transaction':_0x42009f});});}else{_0x5d4743=0x194;_0x22a6c1=[];}});})['then'](function(){if(_0x5d4743!==0x194){return db[_0x2d17('0x7e')][_0x2d17('0x80')]({'where':{'WhatsappAccountId':_0x5ebee3},'order':_0x2d17('0x81')})[_0x2d17('0x36')](function(_0x418e80){_0x22a6c1=_0x418e80;});}})[_0x2d17('0x29')](function(_0x5361ca){_0x5d4743=0x1f4;logger[_0x2d17('0x25')](_0x5361ca['stack']);if(_0x5361ca[_0x2d17('0x3b')]){delete _0x5361ca[_0x2d17('0x3b')];}_0x22a6c1=_0x5361ca;})['finally'](function(){if(_0x22a6c1===null){_0x4360d3[_0x2d17('0x2a')](_0x5d4743);}else{if(_0x5d4743===0x1f4){_0x4360d3[_0x2d17('0x2b')](_0x5d4743)['send'](_0x22a6c1);}else{_0x4360d3[_0x2d17('0x2b')](_0x5d4743)[_0x2d17('0x2d')](_0x22a6c1);}}});};exports[_0x2d17('0x82')]=function(_0x214597,_0x52e546,_0xcabb93){var _0x57708b={};var _0x1fd8fa={};var _0x43bb60;var _0x56d395;return db[_0x2d17('0x41')][_0x2d17('0x6f')]({'where':{'id':_0x214597[_0x2d17('0x5d')]['id']}})[_0x2d17('0x36')](handleEntityNotFound(_0x52e546,null))['then'](function(_0x3716c8){if(_0x3716c8){_0x43bb60=_0x3716c8;_0x1fd8fa['model']=_[_0x2d17('0x46')](db['WhatsappApplication'][_0x2d17('0x42')]);_0x1fd8fa['query']=_[_0x2d17('0x46')](_0x214597['query']);_0x1fd8fa['filters']=_[_0x2d17('0x49')](_0x1fd8fa['model'],_0x1fd8fa[_0x2d17('0x47')]);_0x57708b[_0x2d17('0x4a')]=_[_0x2d17('0x49')](_0x1fd8fa['model'],qs['fields'](_0x214597[_0x2d17('0x47')]['fields']));_0x57708b[_0x2d17('0x4a')]=_0x57708b[_0x2d17('0x4a')][_0x2d17('0x4c')]?_0x57708b[_0x2d17('0x4a')]:_0x1fd8fa['model'];_0x57708b['order']=qs[_0x2d17('0x50')](_0x214597[_0x2d17('0x47')]['sort']);_0x57708b[_0x2d17('0x53')]=qs[_0x2d17('0x48')](_[_0x2d17('0x51')](_0x214597[_0x2d17('0x47')],_0x1fd8fa[_0x2d17('0x48')]));if(_0x214597['query'][_0x2d17('0x52')]){_0x57708b[_0x2d17('0x53')]=_[_0x2d17('0x54')](_0x57708b[_0x2d17('0x53')],{'$or':_[_0x2d17('0x40')](_0x57708b[_0x2d17('0x4a')],function(_0x344267){var _0x1c5d07={};_0x1c5d07[_0x344267]={'$like':'%'+_0x214597['query'][_0x2d17('0x52')]+'%'};return _0x1c5d07;})});}_0x57708b=_['merge']({},_0x57708b,_0x214597[_0x2d17('0x56')]);return _0x43bb60[_0x2d17('0x82')](_0x57708b);}})['then'](function(_0x15b6c5){if(_0x15b6c5){_0x56d395=_0x15b6c5[_0x2d17('0x4c')];if(!_0x214597[_0x2d17('0x47')][_0x2d17('0x4d')](_0x2d17('0x4e'))){_0x57708b[_0x2d17('0x30')]=qs[_0x2d17('0x30')](_0x214597[_0x2d17('0x47')][_0x2d17('0x30')]);_0x57708b['offset']=qs['offset'](_0x214597[_0x2d17('0x47')]['offset']);}return _0x43bb60[_0x2d17('0x82')](_0x57708b);}})[_0x2d17('0x36')](function(_0x37037d){if(_0x37037d){return _0x37037d?{'count':_0x56d395,'rows':_0x37037d}:null;}})[_0x2d17('0x36')](respondWithResult(_0x52e546,null))[_0x2d17('0x29')](handleError(_0x52e546,null));};exports[_0x2d17('0x83')]=function(_0x3b3f00,_0x355a29,_0x27cfa8){var _0x1496dc={'channel':'whatsapp'};var _0x3dbf4a=[];var _0x4c3b65=[];var _0x5d6580={};return db[_0x2d17('0x41')][_0x2d17('0x5e')]({'where':{'id':_0x3b3f00[_0x2d17('0x5d')]['id']},'include':[{'model':db[_0x2d17('0x7e')],'as':_0x2d17('0x84')}]})[_0x2d17('0x36')](handleEntityNotFound(_0x355a29,null))[_0x2d17('0x36')](function(_0x3b1c63){_0x1496dc[_0x2d17('0x85')]=_0x3b1c63;if(_0x1496dc[_0x2d17('0x85')]&&_0x1496dc[_0x2d17('0x85')][_0x2d17('0x44')]==='sinch'&&_0x3b3f00[_0x2d17('0x60')]['statuses']){if(_0x3b3f00[_0x2d17('0x60')][_0x2d17('0x86')][_0x2d17('0x4c')]===0x0)return;if(_0x3b3f00[_0x2d17('0x60')]['statuses'][0x0]['state']!==_0x2d17('0x87'))return;return db['WhatsappMessage'][_0x2d17('0x66')]({'read':!![],'readAt':_0x3b3f00[_0x2d17('0x60')][_0x2d17('0x86')][0x0]['timestamp']},{'where':{'messageId':_0x3b3f00['body'][_0x2d17('0x86')][0x0][_0x2d17('0x88')]},'individualHooks':!![]})[_0x2d17('0x36')](function(_0x525c5b){return _0x355a29[_0x2d17('0x2b')](0xc8)['json'](_0x525c5b);});}_0x1496dc[_0x2d17('0x89')]=_[_0x2d17('0x8a')](_0x3b1c63[_0x2d17('0x84')],[_0x2d17('0x81')],['asc']);if(_0x1496dc[_0x2d17('0x85')][_0x2d17('0x84')]){delete _0x1496dc[_0x2d17('0x85')][_0x2d17('0x84')];}return db['CmContact'][_0x2d17('0x67')]()['then'](function(_0x58775f){if(!_0x58775f){throw new db[(_0x2d17('0x8b'))][(_0x2d17('0x8c'))](_0x2d17('0x8d'));}_0x3dbf4a=_[_0x2d17('0x8e')](_[_0x2d17('0x46')](_0x58775f),['createdAt',_0x2d17('0x8f')]);_0x4c3b65=_[_0x2d17('0x8e')](_[_0x2d17('0x46')](_0x58775f),[_0x2d17('0x90'),_0x2d17('0x8f'),_0x2d17('0x91'),_0x2d17('0x92')]);_0x1496dc['body']={'mapKey':_0x2d17('0x93')};if(_0x1496dc[_0x2d17('0x85')]&&_0x1496dc['account'][_0x2d17('0x44')]===_0x2d17('0x94')){_0x1496dc[_0x2d17('0x60')]['from']=_0x3b3f00['body']['From']['replace']('whatsapp:','');_0x1496dc[_0x2d17('0x60')][_0x2d17('0x60')]=_0x3b3f00[_0x2d17('0x60')][_0x2d17('0x95')];_0x1496dc[_0x2d17('0x60')][_0x2d17('0x96')]=_0x3b3f00[_0x2d17('0x60')][_0x2d17('0x97')];}if(_0x1496dc[_0x2d17('0x85')]&&_0x1496dc['account']['type']===_0x2d17('0x98')){_0x1496dc[_0x2d17('0x60')]['from']=_0x3b3f00[_0x2d17('0x60')][_0x2d17('0x99')][0x0][_0x2d17('0x9a')];_0x1496dc[_0x2d17('0x60')]['body']=_0x3b3f00[_0x2d17('0x60')][_0x2d17('0x99')][0x0][_0x2d17('0x27')][_0x2d17('0x60')];_0x1496dc[_0x2d17('0x60')][_0x2d17('0x96')]=_0x3b3f00[_0x2d17('0x60')][_0x2d17('0x99')][0x0][_0x2d17('0x88')];}if(_0x1496dc[_0x2d17('0x60')]['id']){delete _0x1496dc[_0x2d17('0x60')]['id'];}if(_[_0x2d17('0x9b')](_0x1496dc[_0x2d17('0x60')][_0x2d17('0x9a')])){throw new db[(_0x2d17('0x8b'))][(_0x2d17('0x8c'))](_0x2d17('0x9c'));}if(_[_0x2d17('0x9b')](_0x1496dc[_0x2d17('0x60')][_0x2d17('0x60')])||_0x1496dc[_0x2d17('0x60')][_0x2d17('0x60')]===''){throw new db[(_0x2d17('0x8b'))][(_0x2d17('0x8c'))](_0x2d17('0x9d'));}if(_[_0x2d17('0x9b')](_0x1496dc[_0x2d17('0x60')][_0x2d17('0x9e')])){throw new db[(_0x2d17('0x8b'))][(_0x2d17('0x8c'))](_0x2d17('0x9f')+_0x4c3b65);}if(!_[_0x2d17('0xa0')](_0x4c3b65,_0x1496dc[_0x2d17('0x60')]['mapKey'])){throw new db[(_0x2d17('0x8b'))][(_0x2d17('0x8c'))](_0x2d17('0xa1')+_0x4c3b65);}_0x5d6580[_0x1496dc[_0x2d17('0x60')][_0x2d17('0x9e')]]=_0x1496dc[_0x2d17('0x60')][_0x2d17('0x9a')];return db[_0x2d17('0xa2')][_0x2d17('0x5e')]({'where':{'id':_0x1496dc['account'][_0x2d17('0x92')]},'include':[{'model':db['CmContact'],'as':_0x2d17('0xa3'),'where':_0x5d6580,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x2d17('0x36')](handleEntityNotFound(_0x355a29,null))[_0x2d17('0x36')](function(_0x55b64e){if(_0x55b64e){_0x1496dc[_0x2d17('0xa4')]=_['omit'](_0x55b64e,['Contacts']);if(_0x55b64e[_0x2d17('0xa3')][_0x2d17('0x4c')]){return _0x55b64e[_0x2d17('0xa3')][0x0];}var _0x2c0a83=_[_0x2d17('0x1a')](_0x1496dc[_0x2d17('0x60')],{'firstName':_0x1496dc[_0x2d17('0x60')][_0x2d17('0x9a')],'ListId':_0x55b64e['id']});_0x2c0a83[_0x1496dc[_0x2d17('0x60')]['mapKey']]=_0x1496dc[_0x2d17('0x60')][_0x2d17('0x9a')];return db['CmContact'][_0x2d17('0x5f')](_0x2c0a83,{'fields':_0x3dbf4a,'raw':!![]});}})[_0x2d17('0x36')](handleEntityNotFound(_0x355a29,null))[_0x2d17('0x36')](function(_0x45a000){if(_0x45a000){_0x1496dc['contact']=_0x45a000;var _0x3c08eb={'ContactId':_0x45a000['id'],'phone':_0x1496dc[_0x2d17('0x60')][_0x2d17('0x9a')],'WhatsappAccountId':_0x3b3f00[_0x2d17('0x5d')]['id']};var _0x1caa7f={'ContactId':_0x45a000['id'],'WhatsappAccountId':_0x3b3f00['params']['id'],'closed':![]};return db[_0x2d17('0xa5')][_0x2d17('0x5e')]({'where':_0x1caa7f})['then'](function(_0x25e8f1){if(_0x25e8f1){return[_0x25e8f1,![]];}return db['WhatsappInteraction']['create'](_0x3c08eb)[_0x2d17('0x36')](function(_0x4ac256){return[_0x4ac256,!![]];});});}})[_0x2d17('0x73')](function(_0x29a713,_0x31efd7){_0x1496dc[_0x2d17('0xa6')]=_0x29a713['get']({'plain':!![]});_0x1496dc[_0x2d17('0xa6')][_0x2d17('0xa7')]=![];if(_0x31efd7){if(_0x1496dc['account'][_0x2d17('0xa8')]){_0x1496dc['applications'][_0x2d17('0xa9')]({'id':0x0,'priority':_0x1496dc[_0x2d17('0x89')][_0x2d17('0x4c')]+0x1,'app':'close','appdata':_0x2d17('0xaa'),'interval':_0x2d17('0xab')});}_0x1496dc[_0x2d17('0xa6')][_0x2d17('0xa7')]=!![];}return db[_0x2d17('0xac')][_0x2d17('0x5f')]({'phone':_0x1496dc['body'][_0x2d17('0x9a')],'messageId':_0x1496dc[_0x2d17('0x60')][_0x2d17('0x96')],'body':_0x1496dc[_0x2d17('0x60')][_0x2d17('0x60')],'WhatsappAccountId':_0x3b3f00[_0x2d17('0x5d')]['id'],'WhatsappInteractionId':_0x29a713['id'],'direction':'in','ContactId':_0x29a713[_0x2d17('0xad')],'AttachmentId':_0x1496dc['body'][_0x2d17('0xae')]});})[_0x2d17('0x36')](function(_0x2da6df){_0x1496dc[_0x2d17('0x27')]=_0x2da6df;if(_0x1496dc['interaction'][_0x2d17('0xaf')]){return db[_0x2d17('0x79')][_0x2d17('0x5e')]({'attributes':['id',_0x2d17('0x3b')],'where':{'id':_0x1496dc['interaction'][_0x2d17('0xaf')]}})[_0x2d17('0x36')](function(_0x1999a7){if(_0x1999a7){_0x1496dc[_0x2d17('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2d17('0xb0'),'appdata':_0x1999a7['name']+','+(_0x1496dc[_0x2d17('0x85')][_0x2d17('0xb1')]||0xa),'interval':_0x2d17('0xab')});}return respondWithRpcPromise(_0x2d17('0xb2'),_0x2d17('0xb3'),_0x1496dc);});}return respondWithRpcPromise(_0x2d17('0xb2'),_0x2d17('0xb3'),_0x1496dc);})[_0x2d17('0x36')](function(_0x3438d2){if(_0x3438d2){var _0x5aa9ad=0xc8;var _0x246d03=_0x2d17('0xb4');logger[_0x2d17('0x21')](_0x2d17('0xb5'),_0x246d03,_0x5aa9ad,_0x2d17('0xb6'));logger[_0x2d17('0xb7')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x246d03,_0x5aa9ad,_0x2d17('0xb6'),JSON[_0x2d17('0x24')](_0x3438d2));if(_0x1496dc[_0x2d17('0x85')][_0x2d17('0x44')]===_0x2d17('0x94')){return _0x355a29[_0x2d17('0x2b')](_0x5aa9ad)['set'](_0x2d17('0xb8'),_0x2d17('0xb9'))[_0x2d17('0x3c')](_0x2d17('0xba'));}else{return _0x355a29[_0x2d17('0x2b')](_0x5aa9ad)['json'](_0x3438d2);}}});})[_0x2d17('0x29')](handleError(_0x355a29,null));};exports[_0x2d17('0x3c')]=function(_0x1c79ce,_0xdc4caf,_0x30aaf1){var _0x51192c,_0x21eab0,_0x1f44b2;if(_[_0x2d17('0x9b')](_0x1c79ce[_0x2d17('0x60')][_0x2d17('0x60')])||_0x1c79ce[_0x2d17('0x60')][_0x2d17('0x60')]===''){throw new db[(_0x2d17('0x8b'))][(_0x2d17('0x8c'))](_0x2d17('0x9d'));}if(_[_0x2d17('0x9b')](_0x1c79ce['body']['to'])){throw new db['Sequelize'][(_0x2d17('0x8c'))](_0x2d17('0xbb'));}_0x51192c=_0x1c79ce[_0x2d17('0x60')]['to'];return db[_0x2d17('0x41')][_0x2d17('0x5e')]({'where':{'id':_0x1c79ce[_0x2d17('0x5d')]['id']},'include':[{'model':db[_0x2d17('0xa2')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x51192c},'limit':0x1,'order':[[_0x2d17('0x8f'),_0x2d17('0xbc')]]}]}]})[_0x2d17('0x36')](handleEntityNotFound(_0xdc4caf,null))[_0x2d17('0x36')](function(_0x3a6748){if(_0x3a6748&&_0x3a6748[_0x2d17('0xbd')]){_0x21eab0=_0x3a6748['get']({'plain':!![]});if(_0x21eab0[_0x2d17('0xbd')]&&_0x21eab0[_0x2d17('0xbd')][_0x2d17('0xa3')]['length']){return _0x21eab0[_0x2d17('0xbd')][_0x2d17('0xa3')][0x0];}return db[_0x2d17('0xbe')]['create'](_[_0x2d17('0x1a')](_0x1c79ce[_0x2d17('0x60')],{'firstName':_0x51192c,'mobile':_0x51192c,'phone':_0x51192c,'ListId':_0x21eab0['ListId']}));}})[_0x2d17('0x36')](handleEntityNotFound(_0xdc4caf,null))[_0x2d17('0x36')](function(_0x1e69c){if(_0x1e69c){_0x1f44b2=_0x1e69c;return db[_0x2d17('0xa5')][_0x2d17('0x5e')]({'where':{'ContactId':_0x1f44b2['id'],'closed':![],'WhatsappAccountId':_0x21eab0['id']}})[_0x2d17('0x36')](function(_0x9c1681){if(_0x9c1681){return[_0x9c1681,![]];}return db[_0x2d17('0xa5')]['create']({'UserId':_0x1c79ce[_0x2d17('0xbf')]['id'],'ContactId':_0x1f44b2['id'],'WhatsappAccountId':_0x21eab0['id'],'phone':_0x51192c,'firstMsgDirection':_0x2d17('0xc0'),'Messages':[_['merge'](_0x1c79ce[_0x2d17('0x60')],{'read':![],'body':_0x1c79ce[_0x2d17('0x60')]['body'],'phone':_0x51192c,'WhatsappAccountId':_0x21eab0['id'],'UserId':_0x1c79ce[_0x2d17('0xbf')]['id'],'ContactId':_0x1f44b2['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x2d17('0x36')](function(_0x5aeb92){return[_0x5aeb92,!![]];});});}})[_0x2d17('0x73')](function(_0x12a3bd,_0x15942f){if(_0x15942f){return _0x12a3bd;}return db['WhatsappMessage'][_0x2d17('0x5f')](_['merge'](_0x1c79ce[_0x2d17('0x60')],{'read':![],'body':_0x1c79ce[_0x2d17('0x60')]['body'],'phone':_0x51192c,'WhatsappAccountId':_0x21eab0['id'],'WhatsappInteractionId':_0x12a3bd['id'],'UserId':_0x1c79ce['user']['id'],'ContactId':_0x1f44b2['id']}))[_0x2d17('0x36')](function(_0x4b81db){_0x12a3bd[_0x2d17('0xc1')][_0x2d17('0xc2')]=[];_0x12a3bd[_0x2d17('0xc1')][_0x2d17('0xc2')][_0x2d17('0xa9')](_0x4b81db['dataValues']);return _0x12a3bd;});})[_0x2d17('0x36')](respondWithResult(_0xdc4caf,null))[_0x2d17('0x29')](handleError(_0xdc4caf,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f91baa3..9e4e24b 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 _0x2f41=['emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x4978dd,_0x12923b){var _0x1e9e7c=function(_0x49fd10){while(--_0x49fd10){_0x4978dd['push'](_0x4978dd['shift']());}};_0x1e9e7c(++_0x12923b);}(_0x2f41,0x111));var _0x12f4=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x2f41[_0x340380];return _0x49ce1c;};'use strict';var EventEmitter=require(_0x12f4('0x0'));var WhatsappAccount=require(_0x12f4('0x1'))['db'][_0x12f4('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x12f4('0x3')](0x0);var events={'afterCreate':_0x12f4('0x4'),'afterUpdate':_0x12f4('0x5'),'afterDestroy':_0x12f4('0x6')};function emitEvent(_0x37a57a){return function(_0x5dd60a,_0x34e55a,_0xca5c8e){WhatsappAccountEvents[_0x12f4('0x7')](_0x37a57a+':'+_0x5dd60a['id'],_0x5dd60a);WhatsappAccountEvents['emit'](_0x37a57a,_0x5dd60a);_0xca5c8e(null);};}for(var e in events){if(events[_0x12f4('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x12f4('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xa718=['../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x1a50a6,_0x512c96){var _0x40697b=function(_0x2f7403){while(--_0x2f7403){_0x1a50a6['push'](_0x1a50a6['shift']());}};_0x40697b(++_0x512c96);}(_0xa718,0xd2));var _0x8a71=function(_0x228ab4,_0x4a9396){_0x228ab4=_0x228ab4-0x0;var _0x591589=_0xa718[_0x228ab4];return _0x591589;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8a71('0x0'))['db'][_0x8a71('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8a71('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8a71('0x3')};function emitEvent(_0x5643d6){return function(_0x108013,_0x51404b,_0x5dcadc){WhatsappAccountEvents[_0x8a71('0x4')](_0x5643d6+':'+_0x108013['id'],_0x108013);WhatsappAccountEvents[_0x8a71('0x4')](_0x5643d6,_0x108013);_0x5dcadc(null);};}for(var e in events){if(events[_0x8a71('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d4663ab..8c9e54a 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 _0x6d58=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x6d58,0xad));var _0x86d5=function(_0x9e2b12,_0x3186f0){_0x9e2b12=_0x9e2b12-0x0;var _0x5c2140=_0x6d58[_0x9e2b12];return _0x5c2140;};'use strict';var _=require(_0x86d5('0x0'));var util=require(_0x86d5('0x1'));var logger=require(_0x86d5('0x2'))(_0x86d5('0x3'));var moment=require(_0x86d5('0x4'));var BPromise=require('bluebird');var rp=require(_0x86d5('0x5'));var fs=require('fs');var path=require(_0x86d5('0x6'));var rimraf=require(_0x86d5('0x7'));var config=require(_0x86d5('0x8'));var attributes=require(_0x86d5('0x9'));module[_0x86d5('0xa')]=function(_0x5dbb47,_0x2dbbf2){return _0x5dbb47[_0x86d5('0xb')](_0x86d5('0xc'),attributes,{'tableName':_0x86d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb89=['rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','moment','bluebird','request-promise','path'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xeb89,0x19e));var _0x9eb8=function(_0x3b0209,_0x29d212){_0x3b0209=_0x3b0209-0x0;var _0x581f6e=_0xeb89[_0x3b0209];return _0x581f6e;};'use strict';var _=require(_0x9eb8('0x0'));var util=require(_0x9eb8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9eb8('0x2'));var BPromise=require(_0x9eb8('0x3'));var rp=require(_0x9eb8('0x4'));var fs=require('fs');var path=require(_0x9eb8('0x5'));var rimraf=require(_0x9eb8('0x6'));var config=require(_0x9eb8('0x7'));var attributes=require(_0x9eb8('0x8'));module['exports']=function(_0x3631cb,_0x5a00e8){return _0x3631cb[_0x9eb8('0x9')](_0x9eb8('0xa'),attributes,{'tableName':_0x9eb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index df77404..3dca58c 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 _0xdf4d=['socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowWhatsappAccount','find','options','raw','where','include','map','model','attributes','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdf4d,0xcb));var _0xddf4=function(_0x11dafc,_0x3d3050){_0x11dafc=_0x11dafc-0x0;var _0x480142=_0xdf4d[_0x11dafc];return _0x480142;};'use strict';var _=require('lodash');var util=require(_0xddf4('0x0'));var moment=require(_0xddf4('0x1'));var BPromise=require('bluebird');var rs=require(_0xddf4('0x2'));var fs=require('fs');var Redis=require(_0xddf4('0x3'));var db=require(_0xddf4('0x4'))['db'];var utils=require(_0xddf4('0x5'));var logger=require(_0xddf4('0x6'))(_0xddf4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddf4('0x8')][_0xddf4('0x9')]({'port':0x232a});config[_0xddf4('0xa')]=_[_0xddf4('0xb')](config[_0xddf4('0xa')],{'host':_0xddf4('0xc'),'port':0x18eb});var socket=require(_0xddf4('0xd'))(new Redis(config[_0xddf4('0xa')]));require(_0xddf4('0xe'))[_0xddf4('0xf')](socket);function respondWithRpcPromise(_0x338210,_0x52f69f,_0x27e945){return new BPromise(function(_0x4a698e,_0x44c33d){return client[_0xddf4('0x10')](_0x338210,_0x27e945)[_0xddf4('0x11')](function(_0x3ba06c){logger['info'](_0xddf4('0x12'),_0x52f69f,_0xddf4('0x13'));logger[_0xddf4('0x14')](_0xddf4('0x15'),_0x52f69f,'request\x20sent',JSON['stringify'](_0x3ba06c));if(_0x3ba06c[_0xddf4('0x16')]){if(_0x3ba06c['error'][_0xddf4('0x17')]===0x1f4){logger[_0xddf4('0x16')](_0xddf4('0x12'),_0x52f69f,_0x3ba06c[_0xddf4('0x16')][_0xddf4('0x18')]);return _0x44c33d(_0x3ba06c['error'][_0xddf4('0x18')]);}logger['error'](_0xddf4('0x12'),_0x52f69f,_0x3ba06c[_0xddf4('0x16')][_0xddf4('0x18')]);return _0x4a698e(_0x3ba06c[_0xddf4('0x16')][_0xddf4('0x18')]);}else{logger[_0xddf4('0x19')](_0xddf4('0x12'),_0x52f69f,'request\x20sent');_0x4a698e(_0x3ba06c['result'][_0xddf4('0x18')]);}})[_0xddf4('0x1a')](function(_0x545747){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x52f69f,_0x545747);_0x44c33d(_0x545747);});});}exports[_0xddf4('0x1b')]=function(_0x412dab){var _0x459a71=this;return new Promise(function(_0x254c7a,_0x39e4c4){return db['WhatsappAccount'][_0xddf4('0x1c')]({'raw':_0x412dab['options']?_0x412dab[_0xddf4('0x1d')][_0xddf4('0x1e')]===undefined?!![]:![]:!![],'where':_0x412dab[_0xddf4('0x1d')]?_0x412dab['options'][_0xddf4('0x1f')]||null:null,'attributes':_0x412dab[_0xddf4('0x1d')]?_0x412dab[_0xddf4('0x1d')]['attributes']||null:null,'include':_0x412dab[_0xddf4('0x1d')]?_0x412dab[_0xddf4('0x1d')][_0xddf4('0x20')]?_[_0xddf4('0x21')](_0x412dab[_0xddf4('0x1d')][_0xddf4('0x20')],function(_0x33894c){return{'model':db[_0x33894c[_0xddf4('0x22')]],'as':_0x33894c['as'],'attributes':_0x33894c[_0xddf4('0x23')],'include':_0x33894c[_0xddf4('0x20')]?_[_0xddf4('0x21')](_0x33894c['include'],function(_0x2ab29c){return{'model':db[_0x2ab29c['model']],'as':_0x2ab29c['as'],'attributes':_0x2ab29c[_0xddf4('0x23')],'include':_0x2ab29c[_0xddf4('0x20')]?_[_0xddf4('0x21')](_0x2ab29c[_0xddf4('0x20')],function(_0x236b00){return{'model':db[_0x236b00[_0xddf4('0x22')]],'as':_0x236b00['as'],'attributes':_0x236b00[_0xddf4('0x23')]};}):[]};}):[]};}):[]:[]})[_0xddf4('0x11')](function(_0x2808fe){logger[_0xddf4('0x19')](_0xddf4('0x1b'),_0x412dab);logger['debug']('ShowWhatsappAccount',_0x412dab,JSON['stringify'](_0x2808fe));_0x254c7a(_0x2808fe);})[_0xddf4('0x1a')](function(_0x4c2ad9){logger[_0xddf4('0x16')](_0xddf4('0x1b'),_0x4c2ad9[_0xddf4('0x18')],_0x412dab);_0x39e4c4(_0x459a71[_0xddf4('0x16')](0x1f4,_0x4c2ad9['message']));});});}; \ No newline at end of file +var _0xcaf1=['request\x20sent','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','info'];(function(_0x424407,_0x45b729){var _0x4902b2=function(_0x4a1a27){while(--_0x4a1a27){_0x424407['push'](_0x424407['shift']());}};_0x4902b2(++_0x45b729);}(_0xcaf1,0x82));var _0x1caf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1caf('0x0'));var moment=require(_0x1caf('0x1'));var BPromise=require(_0x1caf('0x2'));var rs=require(_0x1caf('0x3'));var fs=require('fs');var Redis=require(_0x1caf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1caf('0x5'))(_0x1caf('0x6'));var config=require(_0x1caf('0x7'));var jayson=require(_0x1caf('0x8'));var client=jayson[_0x1caf('0x9')][_0x1caf('0xa')]({'port':0x232a});config[_0x1caf('0xb')]=_[_0x1caf('0xc')](config[_0x1caf('0xb')],{'host':_0x1caf('0xd'),'port':0x18eb});var socket=require(_0x1caf('0xe'))(new Redis(config['redis']));require(_0x1caf('0xf'))[_0x1caf('0x10')](socket);function respondWithRpcPromise(_0x39c002,_0x4f4b6d,_0x147036){return new BPromise(function(_0x389d37,_0x128982){return client['request'](_0x39c002,_0x147036)['then'](function(_0x568640){logger[_0x1caf('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x4f4b6d,_0x1caf('0x12'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4f4b6d,_0x1caf('0x12'),JSON['stringify'](_0x568640));if(_0x568640[_0x1caf('0x13')]){if(_0x568640['error']['code']===0x1f4){logger[_0x1caf('0x13')](_0x1caf('0x14'),_0x4f4b6d,_0x568640[_0x1caf('0x13')][_0x1caf('0x15')]);return _0x128982(_0x568640[_0x1caf('0x13')][_0x1caf('0x15')]);}logger[_0x1caf('0x13')](_0x1caf('0x14'),_0x4f4b6d,_0x568640['error']['message']);return _0x389d37(_0x568640[_0x1caf('0x13')][_0x1caf('0x15')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4f4b6d,'request\x20sent');_0x389d37(_0x568640[_0x1caf('0x16')][_0x1caf('0x15')]);}})[_0x1caf('0x17')](function(_0x3b5fce){logger[_0x1caf('0x13')](_0x1caf('0x14'),_0x4f4b6d,_0x3b5fce);_0x128982(_0x3b5fce);});});}exports[_0x1caf('0x18')]=function(_0x10b927){var _0x4fb729=this;return new Promise(function(_0x217c7a,_0x13cf9b){return db[_0x1caf('0x19')][_0x1caf('0x1a')]({'raw':_0x10b927['options']?_0x10b927[_0x1caf('0x1b')][_0x1caf('0x1c')]===undefined?!![]:![]:!![],'where':_0x10b927[_0x1caf('0x1b')]?_0x10b927['options'][_0x1caf('0x1d')]||null:null,'attributes':_0x10b927[_0x1caf('0x1b')]?_0x10b927['options'][_0x1caf('0x1e')]||null:null,'include':_0x10b927[_0x1caf('0x1b')]?_0x10b927[_0x1caf('0x1b')][_0x1caf('0x1f')]?_[_0x1caf('0x20')](_0x10b927[_0x1caf('0x1b')]['include'],function(_0x49fe0c){return{'model':db[_0x49fe0c['model']],'as':_0x49fe0c['as'],'attributes':_0x49fe0c[_0x1caf('0x1e')],'include':_0x49fe0c[_0x1caf('0x1f')]?_[_0x1caf('0x20')](_0x49fe0c[_0x1caf('0x1f')],function(_0x4213d5){return{'model':db[_0x4213d5['model']],'as':_0x4213d5['as'],'attributes':_0x4213d5[_0x1caf('0x1e')],'include':_0x4213d5[_0x1caf('0x1f')]?_['map'](_0x4213d5[_0x1caf('0x1f')],function(_0x2792c7){return{'model':db[_0x2792c7[_0x1caf('0x21')]],'as':_0x2792c7['as'],'attributes':_0x2792c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1caf('0x22')](function(_0x1e5155){logger[_0x1caf('0x11')]('ShowWhatsappAccount',_0x10b927);logger[_0x1caf('0x23')]('ShowWhatsappAccount',_0x10b927,JSON[_0x1caf('0x24')](_0x1e5155));_0x217c7a(_0x1e5155);})[_0x1caf('0x17')](function(_0x266828){logger[_0x1caf('0x13')](_0x1caf('0x18'),_0x266828['message'],_0x10b927);_0x13cf9b(_0x4fb729[_0x1caf('0x13')](0x1f4,_0x266828[_0x1caf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 88ba4e2..9b795ad 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 _0xd20a=['remove','emit','removeListener','register','length','save'];(function(_0x371f28,_0x315fc9){var _0x3b690f=function(_0x4a657a){while(--_0x4a657a){_0x371f28['push'](_0x371f28['shift']());}};_0x3b690f(++_0x315fc9);}(_0xd20a,0x1b5));var _0xad20=function(_0x3b8607,_0x5a180e){_0x3b8607=_0x3b8607-0x0;var _0x4fd2e1=_0xd20a[_0x3b8607];return _0x4fd2e1;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xad20('0x0'),_0xad20('0x1'),'update'];function createListener(_0x24b1ce,_0x1f82ad){return function(_0x495a27){_0x1f82ad[_0xad20('0x2')](_0x24b1ce,_0x495a27);};}function removeListener(_0x391aea,_0x4d8994){return function(){WhatsappAccountEvents[_0xad20('0x3')](_0x391aea,_0x4d8994);};}exports[_0xad20('0x4')]=function(_0x57d317){for(var _0x4f72ee=0x0,_0x477292=events[_0xad20('0x5')];_0x4f72ee<_0x477292;_0x4f72ee++){var _0xd3f63e=events[_0x4f72ee];var _0x3234a3=createListener('whatsappAccount:'+_0xd3f63e,_0x57d317);WhatsappAccountEvents['on'](_0xd3f63e,_0x3234a3);}}; \ No newline at end of file +var _0xe414=['save','remove','emit'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0xe414,0x10b));var _0x4e41=function(_0x44f11a,_0x55aa19){_0x44f11a=_0x44f11a-0x0;var _0x41010e=_0xe414[_0x44f11a];return _0x41010e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x4e41('0x0'),_0x4e41('0x1'),'update'];function createListener(_0x264ead,_0x3fcc24){return function(_0x946ed5){_0x3fcc24[_0x4e41('0x2')](_0x264ead,_0x946ed5);};}function removeListener(_0x36d470,_0x43ada6){return function(){WhatsappAccountEvents['removeListener'](_0x36d470,_0x43ada6);};}exports['register']=function(_0x4240f8){for(var _0x4f9ce1=0x0,_0x5dc722=events['length'];_0x4f9ce1<_0x5dc722;_0x4f9ce1++){var _0x39900e=events[_0x4f9ce1];var _0x9e97b2=createListener('whatsappAccount:'+_0x39900e,_0x4240f8);WhatsappAccountEvents['on'](_0x39900e,_0x9e97b2);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 48f29d8..c0b90a7 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 _0x81d2=['get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x42ac42,_0x1281c5){var _0x414d3b=function(_0x1e6bec){while(--_0x1e6bec){_0x42ac42['push'](_0x42ac42['shift']());}};_0x414d3b(++_0x1281c5);}(_0x81d2,0x161));var _0x281d=function(_0x1783e4,_0xc62166){_0x1783e4=_0x1783e4-0x0;var _0x37583d=_0x81d2[_0x1783e4];return _0x37583d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x281d('0x0'));var timeout=require(_0x281d('0x1'));var express=require(_0x281d('0x2'));var router=express[_0x281d('0x3')]();var fs_extra=require(_0x281d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x281d('0x5'));var config=require(_0x281d('0x6'));var controller=require(_0x281d('0x7'));router[_0x281d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x281d('0x8')]('/:id',auth[_0x281d('0x9')](),controller[_0x281d('0xa')]);router[_0x281d('0xb')]('/',auth[_0x281d('0x9')](),controller[_0x281d('0xc')]);router[_0x281d('0xd')](_0x281d('0xe'),auth[_0x281d('0x9')](),controller[_0x281d('0xf')]);router[_0x281d('0x10')](_0x281d('0xe'),auth[_0x281d('0x9')](),controller[_0x281d('0x11')]);module[_0x281d('0x12')]=router; \ No newline at end of file +var _0x83f2=['delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83f2,0xce));var _0x283f=function(_0x1db13a,_0x2086db){_0x1db13a=_0x1db13a-0x0;var _0x200ced=_0x83f2[_0x1db13a];return _0x200ced;};'use strict';var multer=require('multer');var util=require(_0x283f('0x0'));var path=require('path');var timeout=require(_0x283f('0x1'));var express=require(_0x283f('0x2'));var router=express[_0x283f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x283f('0x4'));var interaction=require(_0x283f('0x5'));var config=require('../../config/environment');var controller=require(_0x283f('0x6'));router['get']('/',auth[_0x283f('0x7')](),controller[_0x283f('0x8')]);router[_0x283f('0x9')](_0x283f('0xa'),auth[_0x283f('0x7')](),controller[_0x283f('0xb')]);router[_0x283f('0xc')]('/',auth[_0x283f('0x7')](),controller['create']);router[_0x283f('0xd')](_0x283f('0xa'),auth[_0x283f('0x7')](),controller[_0x283f('0xe')]);router[_0x283f('0xf')](_0x283f('0xa'),auth[_0x283f('0x7')](),controller[_0x283f('0x10')]);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 f279108..15ae655 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 _0x0924=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x234c1c,_0x5579c3){var _0x324258=function(_0x16d2a7){while(--_0x16d2a7){_0x234c1c['push'](_0x234c1c['shift']());}};_0x324258(++_0x5579c3);}(_0x0924,0x77));var _0x4092=function(_0x45d9bb,_0x2c0350){_0x45d9bb=_0x45d9bb-0x0;var _0x1a36e9=_0x0924[_0x45d9bb];return _0x1a36e9;};'use strict';var Sequelize=require('sequelize');module[_0x4092('0x0')]={'priority':{'type':Sequelize[_0x4092('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4092('0x2')],'allowNull':![],'defaultValue':_0x4092('0x3')},'appdata':{'type':Sequelize[_0x4092('0x4')]()},'description':{'type':Sequelize[_0x4092('0x2')]},'interval':{'type':Sequelize[_0x4092('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x26e8=['*,*,*,*','exports','STRING','noop'];(function(_0x4a7109,_0x291d0e){var _0x5436ca=function(_0x358ed5){while(--_0x358ed5){_0x4a7109['push'](_0x4a7109['shift']());}};_0x5436ca(++_0x291d0e);}(_0x26e8,0x179));var _0x826e=function(_0x18ad19,_0x5c35a1){_0x18ad19=_0x18ad19-0x0;var _0x34d0cd=_0x26e8[_0x18ad19];return _0x34d0cd;};'use strict';var Sequelize=require('sequelize');module[_0x826e('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x826e('0x1')],'allowNull':![],'defaultValue':_0x826e('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x826e('0x1')]},'interval':{'type':Sequelize[_0x826e('0x1')],'defaultValue':_0x826e('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 98ef9e0..646f0c4 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 _0xd4ad=['util','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','map','WhatsappApplication','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x33bf46,_0x3ae4b1){_0x33bf46=_0x33bf46-0x0;var _0x2f0358=_0xd4ad[_0x33bf46];return _0x2f0358;};'use strict';var emlformat=require(_0xdd4a('0x0'));var rimraf=require(_0xdd4a('0x1'));var zipdir=require(_0xdd4a('0x2'));var jsonpatch=require(_0xdd4a('0x3'));var rp=require(_0xdd4a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd4a('0x5'));var util=require(_0xdd4a('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd4a('0x7'));var _=require('lodash');var squel=require(_0xdd4a('0x8'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0x9'));var deskjs=require(_0xdd4a('0xa'));var toCsv=require(_0xdd4a('0xb'));var querystring=require(_0xdd4a('0xc'));var Papa=require(_0xdd4a('0xd'));var Redis=require(_0xdd4a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdd4a('0xf'));var as=require(_0xdd4a('0x10'));var hardwareService=require(_0xdd4a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdd4a('0x12'));var config=require(_0xdd4a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x14'))['db'];function respondWithStatusCode(_0x51c6f4,_0x140867){_0x140867=_0x140867||0xcc;return function(_0x219616){if(_0x219616){return _0x51c6f4[_0xdd4a('0x15')](_0x140867);}return _0x51c6f4[_0xdd4a('0x16')](_0x140867)[_0xdd4a('0x17')]();};}function respondWithResult(_0x3d3656,_0x25e88a){_0x25e88a=_0x25e88a||0xc8;return function(_0x5483cd){if(_0x5483cd){return _0x3d3656[_0xdd4a('0x16')](_0x25e88a)[_0xdd4a('0x18')](_0x5483cd);}};}function respondWithFilteredResult(_0x1614b3,_0x1859f4){return function(_0x229a65){if(_0x229a65){var _0xe59be3=typeof _0x1859f4[_0xdd4a('0x19')]===_0xdd4a('0x1a')&&typeof _0x1859f4[_0xdd4a('0x1b')]===_0xdd4a('0x1a');var _0x3f8c5e=_0x229a65[_0xdd4a('0x1c')];var _0x95c5ec=_0xe59be3?0x0:_0x1859f4[_0xdd4a('0x19')];var _0x20fb04=_0xe59be3?_0x229a65[_0xdd4a('0x1c')]:_0x1859f4[_0xdd4a('0x19')]+_0x1859f4['limit'];var _0x31a80a;if(_0x20fb04>=_0x3f8c5e){_0x20fb04=_0x3f8c5e;_0x31a80a=0xc8;}else{_0x31a80a=0xce;}_0x1614b3['status'](_0x31a80a);return _0x1614b3['set'](_0xdd4a('0x1d'),_0x95c5ec+'-'+_0x20fb04+'/'+_0x3f8c5e)['json'](_0x229a65);}return null;};}function patchUpdates(_0x384539){return function(_0x534e91){try{jsonpatch['apply'](_0x534e91,_0x384539,!![]);}catch(_0xfc51f){return BPromise[_0xdd4a('0x1e')](_0xfc51f);}return _0x534e91[_0xdd4a('0x1f')]();};}function saveUpdates(_0x21b4fc,_0x55b94f){return function(_0x4e67a5){if(_0x4e67a5){return _0x4e67a5[_0xdd4a('0x20')](_0x21b4fc)[_0xdd4a('0x21')](function(_0x547721){return _0x547721;});}return null;};}function removeEntity(_0x51112d,_0x3d2b3a){return function(_0x4e9f19){if(_0x4e9f19){return _0x4e9f19[_0xdd4a('0x22')]()[_0xdd4a('0x21')](function(){_0x51112d[_0xdd4a('0x16')](0xcc)[_0xdd4a('0x17')]();});}};}function handleEntityNotFound(_0x3527d1,_0xe7aef5){return function(_0x2173a9){if(!_0x2173a9){_0x3527d1[_0xdd4a('0x15')](0x194);}return _0x2173a9;};}function handleError(_0x49a49f,_0x37c585){_0x37c585=_0x37c585||0x1f4;return function(_0x313454){logger[_0xdd4a('0x23')](_0x313454[_0xdd4a('0x24')]);if(_0x313454['name']){delete _0x313454[_0xdd4a('0x25')];}_0x49a49f['status'](_0x37c585)['send'](_0x313454);};}exports['index']=function(_0x1e62d1,_0x233119){var _0x154d3c={},_0x3a5033={},_0xaf03e2={'count':0x0,'rows':[]};var _0x10cb68=_[_0xdd4a('0x26')](db[_0xdd4a('0x27')]['rawAttributes'],function(_0x3d4b1f){return{'name':_0x3d4b1f[_0xdd4a('0x28')],'type':_0x3d4b1f[_0xdd4a('0x29')][_0xdd4a('0x2a')]};});_0x3a5033['model']=_[_0xdd4a('0x26')](_0x10cb68,_0xdd4a('0x25'));_0x3a5033[_0xdd4a('0x2b')]=_[_0xdd4a('0x2c')](_0x1e62d1[_0xdd4a('0x2b')]);_0x3a5033['filters']=_[_0xdd4a('0x2d')](_0x3a5033[_0xdd4a('0x2e')],_0x3a5033[_0xdd4a('0x2b')]);_0x154d3c[_0xdd4a('0x2f')]=_['intersection'](_0x3a5033['model'],qs['fields'](_0x1e62d1[_0xdd4a('0x2b')][_0xdd4a('0x30')]));_0x154d3c['attributes']=_0x154d3c['attributes'][_0xdd4a('0x31')]?_0x154d3c[_0xdd4a('0x2f')]:_0x3a5033[_0xdd4a('0x2e')];if(!_0x1e62d1['query']['hasOwnProperty'](_0xdd4a('0x32'))){_0x154d3c['limit']=qs[_0xdd4a('0x1b')](_0x1e62d1[_0xdd4a('0x2b')]['limit']);_0x154d3c[_0xdd4a('0x19')]=qs['offset'](_0x1e62d1['query']['offset']);}_0x154d3c[_0xdd4a('0x33')]=qs[_0xdd4a('0x34')](_0x1e62d1[_0xdd4a('0x2b')][_0xdd4a('0x34')]);_0x154d3c[_0xdd4a('0x35')]=qs[_0xdd4a('0x36')](_[_0xdd4a('0x37')](_0x1e62d1[_0xdd4a('0x2b')],_0x3a5033['filters']),_0x10cb68);if(_0x1e62d1[_0xdd4a('0x2b')]['filter']){_0x154d3c['where']=_[_0xdd4a('0x38')](_0x154d3c[_0xdd4a('0x35')],{'$or':_[_0xdd4a('0x26')](_0x10cb68,function(_0x1a4634){if(_0x1a4634['type']!==_0xdd4a('0x39')){var _0xb99a1c={};_0xb99a1c[_0x1a4634['name']]={'$like':'%'+_0x1e62d1[_0xdd4a('0x2b')][_0xdd4a('0x3a')]+'%'};return _0xb99a1c;}})});}_0x154d3c=_['merge']({},_0x154d3c,_0x1e62d1[_0xdd4a('0x3b')]);var _0x569440={'where':_0x154d3c[_0xdd4a('0x35')]};return db['WhatsappApplication']['count'](_0x569440)[_0xdd4a('0x21')](function(_0x35c737){_0xaf03e2[_0xdd4a('0x1c')]=_0x35c737;if(_0x1e62d1[_0xdd4a('0x2b')][_0xdd4a('0x3c')]){_0x154d3c[_0xdd4a('0x3d')]=[{'all':!![]}];}return db[_0xdd4a('0x27')][_0xdd4a('0x3e')](_0x154d3c);})[_0xdd4a('0x21')](function(_0x1db17f){_0xaf03e2[_0xdd4a('0x3f')]=_0x1db17f;return _0xaf03e2;})[_0xdd4a('0x21')](respondWithFilteredResult(_0x233119,_0x154d3c))[_0xdd4a('0x40')](handleError(_0x233119,null));};exports[_0xdd4a('0x41')]=function(_0x40b75b,_0x3d040a){var _0x513451={'raw':!![],'where':{'id':_0x40b75b['params']['id']}},_0x59441c={};_0x59441c['model']=_[_0xdd4a('0x2c')](db[_0xdd4a('0x27')][_0xdd4a('0x42')]);_0x59441c['query']=_[_0xdd4a('0x2c')](_0x40b75b[_0xdd4a('0x2b')]);_0x59441c['filters']=_['intersection'](_0x59441c[_0xdd4a('0x2e')],_0x59441c['query']);_0x513451['attributes']=_[_0xdd4a('0x2d')](_0x59441c['model'],qs[_0xdd4a('0x30')](_0x40b75b['query'][_0xdd4a('0x30')]));_0x513451['attributes']=_0x513451[_0xdd4a('0x2f')][_0xdd4a('0x31')]?_0x513451[_0xdd4a('0x2f')]:_0x59441c['model'];if(_0x40b75b[_0xdd4a('0x2b')][_0xdd4a('0x3c')]){_0x513451['include']=[{'all':!![]}];}_0x513451=_[_0xdd4a('0x38')]({},_0x513451,_0x40b75b['options']);return db[_0xdd4a('0x27')][_0xdd4a('0x43')](_0x513451)['then'](handleEntityNotFound(_0x3d040a,null))[_0xdd4a('0x21')](respondWithResult(_0x3d040a,null))[_0xdd4a('0x40')](handleError(_0x3d040a,null));};exports[_0xdd4a('0x44')]=function(_0x238398,_0x29dfd2){return db[_0xdd4a('0x27')]['create'](_0x238398['body'],{})[_0xdd4a('0x21')](respondWithResult(_0x29dfd2,0xc9))[_0xdd4a('0x40')](handleError(_0x29dfd2,null));};exports[_0xdd4a('0x20')]=function(_0x3deac1,_0x4efe80){if(_0x3deac1['body']['id']){delete _0x3deac1[_0xdd4a('0x45')]['id'];}return db[_0xdd4a('0x27')][_0xdd4a('0x43')]({'where':{'id':_0x3deac1['params']['id']}})[_0xdd4a('0x21')](handleEntityNotFound(_0x4efe80,null))[_0xdd4a('0x21')](saveUpdates(_0x3deac1[_0xdd4a('0x45')],null))[_0xdd4a('0x21')](respondWithResult(_0x4efe80,null))[_0xdd4a('0x40')](handleError(_0x4efe80,null));};exports[_0xdd4a('0x22')]=function(_0x178507,_0x547e83){return db['WhatsappApplication'][_0xdd4a('0x43')]({'where':{'id':_0x178507['params']['id']}})[_0xdd4a('0x21')](handleEntityNotFound(_0x547e83,null))[_0xdd4a('0x21')](removeEntity(_0x547e83,null))[_0xdd4a('0x40')](handleError(_0x547e83,null));}; \ No newline at end of file +var _0x1e24=['limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','undefined'];(function(_0x37e1ac,_0x48860e){var _0x513e22=function(_0xe5d6b1){while(--_0xe5d6b1){_0x37e1ac['push'](_0x37e1ac['shift']());}};_0x513e22(++_0x48860e);}(_0x1e24,0x82));var _0x41e2=function(_0x4f918e,_0xcd500e){_0x4f918e=_0x4f918e-0x0;var _0x15ee0c=_0x1e24[_0x4f918e];return _0x15ee0c;};'use strict';var emlformat=require(_0x41e2('0x0'));var rimraf=require(_0x41e2('0x1'));var zipdir=require(_0x41e2('0x2'));var jsonpatch=require(_0x41e2('0x3'));var rp=require('request-promise');var moment=require(_0x41e2('0x4'));var BPromise=require(_0x41e2('0x5'));var Mustache=require(_0x41e2('0x6'));var util=require(_0x41e2('0x7'));var path=require('path');var sox=require(_0x41e2('0x8'));var csv=require(_0x41e2('0x9'));var ejs=require(_0x41e2('0xa'));var fs=require('fs');var fs_extra=require(_0x41e2('0xb'));var _=require(_0x41e2('0xc'));var squel=require(_0x41e2('0xd'));var crypto=require(_0x41e2('0xe'));var jsforce=require(_0x41e2('0xf'));var deskjs=require(_0x41e2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x41e2('0x11'));var Papa=require(_0x41e2('0x12'));var Redis=require(_0x41e2('0x13'));var authService=require(_0x41e2('0x14'));var qs=require(_0x41e2('0x15'));var as=require(_0x41e2('0x16'));var hardwareService=require(_0x41e2('0x17'));var logger=require(_0x41e2('0x18'))(_0x41e2('0x19'));var utils=require('../../config/utils');var config=require(_0x41e2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x41e2('0x1b'))['db'];function respondWithStatusCode(_0x33160d,_0x1b3cbb){_0x1b3cbb=_0x1b3cbb||0xcc;return function(_0x5d012d){if(_0x5d012d){return _0x33160d[_0x41e2('0x1c')](_0x1b3cbb);}return _0x33160d['status'](_0x1b3cbb)[_0x41e2('0x1d')]();};}function respondWithResult(_0x5ca07e,_0x3128d8){_0x3128d8=_0x3128d8||0xc8;return function(_0x247244){if(_0x247244){return _0x5ca07e[_0x41e2('0x1e')](_0x3128d8)['json'](_0x247244);}};}function respondWithFilteredResult(_0x9aab16,_0x3db4d8){return function(_0x12ecdc){if(_0x12ecdc){var _0x348630=typeof _0x3db4d8['offset']===_0x41e2('0x1f')&&typeof _0x3db4d8[_0x41e2('0x20')]===_0x41e2('0x1f');var _0x3d3c83=_0x12ecdc['count'];var _0x3dd4b7=_0x348630?0x0:_0x3db4d8[_0x41e2('0x21')];var _0x4505a6=_0x348630?_0x12ecdc[_0x41e2('0x22')]:_0x3db4d8['offset']+_0x3db4d8[_0x41e2('0x20')];var _0x3fc700;if(_0x4505a6>=_0x3d3c83){_0x4505a6=_0x3d3c83;_0x3fc700=0xc8;}else{_0x3fc700=0xce;}_0x9aab16[_0x41e2('0x1e')](_0x3fc700);return _0x9aab16[_0x41e2('0x23')](_0x41e2('0x24'),_0x3dd4b7+'-'+_0x4505a6+'/'+_0x3d3c83)[_0x41e2('0x25')](_0x12ecdc);}return null;};}function patchUpdates(_0x3dc6be){return function(_0x31b749){try{jsonpatch[_0x41e2('0x26')](_0x31b749,_0x3dc6be,!![]);}catch(_0xe2f705){return BPromise[_0x41e2('0x27')](_0xe2f705);}return _0x31b749[_0x41e2('0x28')]();};}function saveUpdates(_0x1d9d92,_0x267a25){return function(_0x1501d3){if(_0x1501d3){return _0x1501d3[_0x41e2('0x29')](_0x1d9d92)[_0x41e2('0x2a')](function(_0x568e00){return _0x568e00;});}return null;};}function removeEntity(_0x892655,_0x5146a4){return function(_0xced78f){if(_0xced78f){return _0xced78f[_0x41e2('0x2b')]()[_0x41e2('0x2a')](function(){_0x892655[_0x41e2('0x1e')](0xcc)[_0x41e2('0x1d')]();});}};}function handleEntityNotFound(_0x2cae5d,_0x20a838){return function(_0xb4aaad){if(!_0xb4aaad){_0x2cae5d['sendStatus'](0x194);}return _0xb4aaad;};}function handleError(_0x4a10ad,_0x3225cc){_0x3225cc=_0x3225cc||0x1f4;return function(_0x49ec8e){logger['error'](_0x49ec8e[_0x41e2('0x2c')]);if(_0x49ec8e['name']){delete _0x49ec8e['name'];}_0x4a10ad[_0x41e2('0x1e')](_0x3225cc)[_0x41e2('0x2d')](_0x49ec8e);};}exports[_0x41e2('0x2e')]=function(_0x20df8a,_0x314d8e){var _0x2433a1={},_0x4f99ef={},_0x273710={'count':0x0,'rows':[]};var _0x55f2cf=_[_0x41e2('0x2f')](db[_0x41e2('0x30')][_0x41e2('0x31')],function(_0x442062){return{'name':_0x442062[_0x41e2('0x32')],'type':_0x442062[_0x41e2('0x33')][_0x41e2('0x34')]};});_0x4f99ef[_0x41e2('0x35')]=_[_0x41e2('0x2f')](_0x55f2cf,_0x41e2('0x36'));_0x4f99ef[_0x41e2('0x37')]=_[_0x41e2('0x38')](_0x20df8a['query']);_0x4f99ef['filters']=_[_0x41e2('0x39')](_0x4f99ef[_0x41e2('0x35')],_0x4f99ef[_0x41e2('0x37')]);_0x2433a1[_0x41e2('0x3a')]=_[_0x41e2('0x39')](_0x4f99ef[_0x41e2('0x35')],qs[_0x41e2('0x3b')](_0x20df8a[_0x41e2('0x37')]['fields']));_0x2433a1[_0x41e2('0x3a')]=_0x2433a1[_0x41e2('0x3a')]['length']?_0x2433a1[_0x41e2('0x3a')]:_0x4f99ef[_0x41e2('0x35')];if(!_0x20df8a['query'][_0x41e2('0x3c')](_0x41e2('0x3d'))){_0x2433a1[_0x41e2('0x20')]=qs[_0x41e2('0x20')](_0x20df8a[_0x41e2('0x37')][_0x41e2('0x20')]);_0x2433a1[_0x41e2('0x21')]=qs[_0x41e2('0x21')](_0x20df8a[_0x41e2('0x37')]['offset']);}_0x2433a1[_0x41e2('0x3e')]=qs[_0x41e2('0x3f')](_0x20df8a[_0x41e2('0x37')][_0x41e2('0x3f')]);_0x2433a1[_0x41e2('0x40')]=qs[_0x41e2('0x41')](_['pick'](_0x20df8a['query'],_0x4f99ef[_0x41e2('0x41')]),_0x55f2cf);if(_0x20df8a[_0x41e2('0x37')][_0x41e2('0x42')]){_0x2433a1[_0x41e2('0x40')]=_[_0x41e2('0x43')](_0x2433a1[_0x41e2('0x40')],{'$or':_['map'](_0x55f2cf,function(_0x2da25b){if(_0x2da25b['type']!==_0x41e2('0x44')){var _0x10ac7d={};_0x10ac7d[_0x2da25b[_0x41e2('0x36')]]={'$like':'%'+_0x20df8a[_0x41e2('0x37')][_0x41e2('0x42')]+'%'};return _0x10ac7d;}})});}_0x2433a1=_['merge']({},_0x2433a1,_0x20df8a[_0x41e2('0x45')]);var _0x2077b3={'where':_0x2433a1['where']};return db[_0x41e2('0x30')][_0x41e2('0x22')](_0x2077b3)[_0x41e2('0x2a')](function(_0x19030b){_0x273710[_0x41e2('0x22')]=_0x19030b;if(_0x20df8a['query'][_0x41e2('0x46')]){_0x2433a1[_0x41e2('0x47')]=[{'all':!![]}];}return db[_0x41e2('0x30')][_0x41e2('0x48')](_0x2433a1);})[_0x41e2('0x2a')](function(_0x279f08){_0x273710[_0x41e2('0x49')]=_0x279f08;return _0x273710;})[_0x41e2('0x2a')](respondWithFilteredResult(_0x314d8e,_0x2433a1))[_0x41e2('0x4a')](handleError(_0x314d8e,null));};exports[_0x41e2('0x4b')]=function(_0x5d0933,_0x18267a){var _0x37f096={'raw':!![],'where':{'id':_0x5d0933[_0x41e2('0x4c')]['id']}},_0x1f353e={};_0x1f353e[_0x41e2('0x35')]=_[_0x41e2('0x38')](db[_0x41e2('0x30')][_0x41e2('0x31')]);_0x1f353e['query']=_['keys'](_0x5d0933[_0x41e2('0x37')]);_0x1f353e[_0x41e2('0x41')]=_[_0x41e2('0x39')](_0x1f353e[_0x41e2('0x35')],_0x1f353e[_0x41e2('0x37')]);_0x37f096[_0x41e2('0x3a')]=_[_0x41e2('0x39')](_0x1f353e['model'],qs[_0x41e2('0x3b')](_0x5d0933['query']['fields']));_0x37f096[_0x41e2('0x3a')]=_0x37f096[_0x41e2('0x3a')][_0x41e2('0x4d')]?_0x37f096['attributes']:_0x1f353e[_0x41e2('0x35')];if(_0x5d0933[_0x41e2('0x37')][_0x41e2('0x46')]){_0x37f096['include']=[{'all':!![]}];}_0x37f096=_[_0x41e2('0x43')]({},_0x37f096,_0x5d0933[_0x41e2('0x45')]);return db[_0x41e2('0x30')][_0x41e2('0x4e')](_0x37f096)[_0x41e2('0x2a')](handleEntityNotFound(_0x18267a,null))[_0x41e2('0x2a')](respondWithResult(_0x18267a,null))[_0x41e2('0x4a')](handleError(_0x18267a,null));};exports[_0x41e2('0x4f')]=function(_0x2b8bd0,_0x40284f){return db[_0x41e2('0x30')][_0x41e2('0x4f')](_0x2b8bd0[_0x41e2('0x50')],{})[_0x41e2('0x2a')](respondWithResult(_0x40284f,0xc9))[_0x41e2('0x4a')](handleError(_0x40284f,null));};exports[_0x41e2('0x29')]=function(_0x381bb8,_0x5d13ed){if(_0x381bb8[_0x41e2('0x50')]['id']){delete _0x381bb8['body']['id'];}return db['WhatsappApplication'][_0x41e2('0x4e')]({'where':{'id':_0x381bb8[_0x41e2('0x4c')]['id']}})[_0x41e2('0x2a')](handleEntityNotFound(_0x5d13ed,null))['then'](saveUpdates(_0x381bb8[_0x41e2('0x50')],null))['then'](respondWithResult(_0x5d13ed,null))[_0x41e2('0x4a')](handleError(_0x5d13ed,null));};exports[_0x41e2('0x2b')]=function(_0x433a82,_0x53c1ca){return db[_0x41e2('0x30')][_0x41e2('0x4e')]({'where':{'id':_0x433a82[_0x41e2('0x4c')]['id']}})[_0x41e2('0x2a')](handleEntityNotFound(_0x53c1ca,null))[_0x41e2('0x2a')](removeEntity(_0x53c1ca,null))[_0x41e2('0x4a')](handleError(_0x53c1ca,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 705a7e4..f55210b 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 _0x8664=['whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x3e2335,_0x2cc705){var _0x2196f4=function(_0x12e163){while(--_0x12e163){_0x3e2335['push'](_0x3e2335['shift']());}};_0x2196f4(++_0x2cc705);}(_0x8664,0x11a));var _0x4866=function(_0x106777,_0x50cf24){_0x106777=_0x106777-0x0;var _0x1168c3=_0x8664[_0x106777];return _0x1168c3;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var logger=require(_0x4866('0x2'))(_0x4866('0x3'));var moment=require(_0x4866('0x4'));var BPromise=require(_0x4866('0x5'));var rp=require(_0x4866('0x6'));var fs=require('fs');var path=require(_0x4866('0x7'));var rimraf=require(_0x4866('0x8'));var config=require('../../config/environment');var attributes=require(_0x4866('0x9'));module['exports']=function(_0x66b444,_0x3eb6f9){return _0x66b444[_0x4866('0xa')](_0x4866('0xb'),attributes,{'tableName':_0x4866('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4866('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x83d3=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappApplication'];(function(_0x1322be,_0xbf40cc){var _0x500810=function(_0x138a37){while(--_0x138a37){_0x1322be['push'](_0x1322be['shift']());}};_0x500810(++_0xbf40cc);}(_0x83d3,0x17c));var _0x383d=function(_0x4da196,_0x357dc9){_0x4da196=_0x4da196-0x0;var _0x375df3=_0x83d3[_0x4da196];return _0x375df3;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x383d('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ff1aae2..9a23f55 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 _0xdace=['request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xdace,0xc5));var _0xedac=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xdace[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x57201c,_0x2fb766){var _0x147795=function(_0x104196){while(--_0x104196){_0x57201c['push'](_0x57201c['shift']());}};_0x147795(++_0x2fb766);}(_0x24ca,0x1bc));var _0xa24c=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x24ca[_0x30d87a];return _0x48f64b;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2db7a43..2d912af 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 _0xcca7=['put','update','delete','whatsappinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0xae1494,_0x2a9067){var _0x3dcbd4=function(_0x3cbc90){while(--_0x3cbc90){_0xae1494['push'](_0xae1494['shift']());}};_0x3dcbd4(++_0x2a9067);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1c0341,_0x378766){_0x1c0341=_0x1c0341-0x0;var _0x2f34b5=_0xcca7[_0x1c0341];return _0x2f34b5;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var controller=require(_0x7cca('0x7'));router[_0x7cca('0x8')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xa')]);router['get']('/describe',auth[_0x7cca('0x9')](),controller[_0x7cca('0xb')]);router[_0x7cca('0x8')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller[_0x7cca('0xd')]);router[_0x7cca('0x8')](_0x7cca('0xe'),auth[_0x7cca('0x9')](),controller[_0x7cca('0xf')]);router['get'](_0x7cca('0x10'),auth[_0x7cca('0x9')](),controller[_0x7cca('0x11')]);router[_0x7cca('0x12')]('/',auth[_0x7cca('0x9')](),controller['create']);router[_0x7cca('0x12')](_0x7cca('0xe'),auth[_0x7cca('0x9')](),controller['addMessage']);router['post'](_0x7cca('0x13'),auth[_0x7cca('0x9')](),interaction[_0x7cca('0x14')](_0x7cca('0x15'),_0x7cca('0x16')),controller[_0x7cca('0x17')]);router[_0x7cca('0x18')]('/:id',auth[_0x7cca('0x9')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0x7cca('0x19')]);router[_0x7cca('0x1a')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),interaction[_0x7cca('0x14')]('whatsapp',_0x7cca('0x1b')),controller['destroy']);router['delete']('/:id/tags',auth[_0x7cca('0x9')](),controller[_0x7cca('0x1c')]);module[_0x7cca('0x1d')]=router; \ No newline at end of file +var _0x41fe=['addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages','download','post','create','/:id/messages'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x41fe,0xd1));var _0xe41f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x41fe[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var path=require(_0xe41f('0x2'));var timeout=require(_0xe41f('0x3'));var express=require(_0xe41f('0x4'));var router=express[_0xe41f('0x5')]();var fs_extra=require(_0xe41f('0x6'));var auth=require(_0xe41f('0x7'));var interaction=require(_0xe41f('0x8'));var config=require(_0xe41f('0x9'));var controller=require(_0xe41f('0xa'));router[_0xe41f('0xb')]('/',auth[_0xe41f('0xc')](),controller[_0xe41f('0xd')]);router[_0xe41f('0xb')](_0xe41f('0xe'),auth[_0xe41f('0xc')](),controller['describe']);router[_0xe41f('0xb')](_0xe41f('0xf'),auth['isAuthenticated'](),controller[_0xe41f('0x10')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xe41f('0x11')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xe41f('0x12')]);router[_0xe41f('0x13')]('/',auth[_0xe41f('0xc')](),controller[_0xe41f('0x14')]);router[_0xe41f('0x13')](_0xe41f('0x15'),auth[_0xe41f('0xc')](),controller[_0xe41f('0x16')]);router[_0xe41f('0x13')](_0xe41f('0x17'),auth['isAuthenticated'](),interaction[_0xe41f('0x18')](_0xe41f('0x19'),'whatsappinteraction:addtags'),controller[_0xe41f('0x1a')]);router[_0xe41f('0x1b')](_0xe41f('0xf'),auth[_0xe41f('0xc')](),interaction[_0xe41f('0x18')](_0xe41f('0x19'),_0xe41f('0x1c')),controller['update']);router['delete'](_0xe41f('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xe41f('0x19'),_0xe41f('0x1d')),controller[_0xe41f('0x1e')]);router[_0xe41f('0x1f')](_0xe41f('0x17'),auth['isAuthenticated'](),controller[_0xe41f('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4eeb04c..69209b2 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 _0x394e=['STRING','ENUM','out','sequelize','moment','BOOLEAN','DATE'];(function(_0x191745,_0x3e8db8){var _0x2aa568=function(_0x180aed){while(--_0x180aed){_0x191745['push'](_0x191745['shift']());}};_0x2aa568(++_0x3e8db8);}(_0x394e,0x88));var _0xe394=function(_0x3f4f4c,_0x152171){_0x3f4f4c=_0x3f4f4c-0x0;var _0x3d48b3=_0x394e[_0x3f4f4c];return _0x3d48b3;};'use strict';var Sequelize=require(_0xe394('0x0'));var moment=require(_0xe394('0x1'));module['exports']={'closed':{'type':Sequelize[_0xe394('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe394('0x3')]},'disposition':{'type':Sequelize[_0xe394('0x4')]},'secondDisposition':{'type':Sequelize[_0xe394('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe394('0x4')]},'phone':{'type':Sequelize[_0xe394('0x4')]},'read1stAt':{'type':Sequelize[_0xe394('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe394('0x5')]('in',_0xe394('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe394('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe394('0x5')]('in',_0xe394('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe394('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb7b6=['STRING','ENUM','out','sequelize','moment','DATE'];(function(_0x238722,_0x2f2cce){var _0x2c1e3c=function(_0xee233e){while(--_0xee233e){_0x238722['push'](_0x238722['shift']());}};_0x2c1e3c(++_0x2f2cce);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x3713db,_0x42ac14){_0x3713db=_0x3713db-0x0;var _0x1b91c4=_0xb7b6[_0x3713db];return _0x1b91c4;};'use strict';var Sequelize=require(_0x6b7b('0x0'));var moment=require(_0x6b7b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6b7b('0x2')]},'disposition':{'type':Sequelize[_0x6b7b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6b7b('0x3')]},'note':{'type':Sequelize[_0x6b7b('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6b7b('0x4')]('in',_0x6b7b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6b7b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6b7b('0x4')]('in',_0x6b7b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 2043f63..3ca1714 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 _0x6f83=['\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','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','WhatsappInteractionId','rows','catch','show','params','includeAll','create','describe','addMessage','WhatsappMessage','ids','omit','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','Users','map','fullname','Tags','TagIds','split','push','talking','answered','unmanaged','total','waiting','closed','UserId','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','u.fullname','ui.WhatsappInteractionId','left_join','whatsapp_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6f83,0x72));var _0x36f8=function(_0xc8e501,_0x36831e){_0xc8e501=_0xc8e501-0x0;var _0x48df20=_0x6f83[_0xc8e501];return _0x48df20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36f8('0x0'));var zipdir=require(_0x36f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36f8('0x2'));var moment=require(_0x36f8('0x3'));var BPromise=require(_0x36f8('0x4'));var Mustache=require(_0x36f8('0x5'));var util=require(_0x36f8('0x6'));var path=require(_0x36f8('0x7'));var sox=require(_0x36f8('0x8'));var csv=require(_0x36f8('0x9'));var ejs=require(_0x36f8('0xa'));var fs=require('fs');var fs_extra=require(_0x36f8('0xb'));var _=require(_0x36f8('0xc'));var squel=require(_0x36f8('0xd'));var crypto=require(_0x36f8('0xe'));var jsforce=require(_0x36f8('0xf'));var deskjs=require(_0x36f8('0x10'));var toCsv=require(_0x36f8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36f8('0x11'));var qs=require(_0x36f8('0x12'));var as=require(_0x36f8('0x13'));var pdf=require(_0x36f8('0x14'));var hardwareService=require(_0x36f8('0x15'));var logger=require(_0x36f8('0x16'))(_0x36f8('0x17'));var utils=require(_0x36f8('0x18'));var config=require(_0x36f8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x36f8('0x1a'))['db'];config[_0x36f8('0x1b')]=_[_0x36f8('0x1c')](config[_0x36f8('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x36f8('0x1d'))(new Redis(config[_0x36f8('0x1b')]));require(_0x36f8('0x1e'))['register'](socket);function respondWithStatusCode(_0x400a31,_0x238746){_0x238746=_0x238746||0xcc;return function(_0x1ba051){if(_0x1ba051){return _0x400a31['sendStatus'](_0x238746);}return _0x400a31[_0x36f8('0x1f')](_0x238746)[_0x36f8('0x20')]();};}function respondWithResult(_0x36596e,_0x3525ab){_0x3525ab=_0x3525ab||0xc8;return function(_0x5ec545){if(_0x5ec545){return _0x36596e['status'](_0x3525ab)[_0x36f8('0x21')](_0x5ec545);}};}function respondWithFilteredResult(_0x5da246,_0x517cba){return function(_0x3db780){if(_0x3db780){var _0x3d6a3c=typeof _0x517cba['offset']===_0x36f8('0x22')&&typeof _0x517cba[_0x36f8('0x23')]===_0x36f8('0x22');var _0x337cbb=_0x3db780[_0x36f8('0x24')];var _0x1086ce=_0x3d6a3c?0x0:_0x517cba[_0x36f8('0x25')];var _0x16b9e8=_0x3d6a3c?_0x3db780[_0x36f8('0x24')]:_0x517cba[_0x36f8('0x25')]+_0x517cba[_0x36f8('0x23')];var _0xbed531;if(_0x16b9e8>=_0x337cbb){_0x16b9e8=_0x337cbb;_0xbed531=0xc8;}else{_0xbed531=0xce;}_0x5da246['status'](_0xbed531);return _0x5da246[_0x36f8('0x26')](_0x36f8('0x27'),_0x1086ce+'-'+_0x16b9e8+'/'+_0x337cbb)[_0x36f8('0x21')](_0x3db780);}return null;};}function patchUpdates(_0x5a9349){return function(_0x3917f1){try{jsonpatch['apply'](_0x3917f1,_0x5a9349,!![]);}catch(_0x362eae){return BPromise[_0x36f8('0x28')](_0x362eae);}return _0x3917f1['save']();};}function saveUpdates(_0x1bfa42,_0x53fde1){return function(_0x444a1a){if(_0x444a1a){return _0x444a1a[_0x36f8('0x29')](_0x1bfa42)[_0x36f8('0x2a')](function(_0x2eeb82){return _0x2eeb82;});}return null;};}function removeEntity(_0x6740e1,_0xc3381b){return function(_0x59291b){if(_0x59291b){return _0x59291b[_0x36f8('0x2b')]()[_0x36f8('0x2a')](function(){_0x6740e1[_0x36f8('0x1f')](0xcc)[_0x36f8('0x20')]();});}};}function handleEntityNotFound(_0x38b1f1,_0x1a4fed){return function(_0xdd5ac5){if(!_0xdd5ac5){_0x38b1f1[_0x36f8('0x2c')](0x194);}return _0xdd5ac5;};}function handleError(_0x2468a0,_0x51a2a1){_0x51a2a1=_0x51a2a1||0x1f4;return function(_0x449882){logger[_0x36f8('0x2d')](_0x449882[_0x36f8('0x2e')]);if(_0x449882[_0x36f8('0x2f')]){delete _0x449882[_0x36f8('0x2f')];}_0x2468a0[_0x36f8('0x1f')](_0x51a2a1)['send'](_0x449882);};}function getInteractionUsers(_0x6d469d,_0x302745){return new BPromise(function(_0x151803,_0x208d06){try{if(_0x302745[_0x6d469d['id']]){_0x6d469d[_0x36f8('0x30')]=_[_0x36f8('0x31')](_0x302745[_0x6d469d['id']],function(_0x406c19){return{'id':_0x406c19['id'],'fullname':_0x406c19[_0x36f8('0x32')]};});}}catch(_0x3762c8){_0x208d06(_0x3762c8);}_0x151803(_0x6d469d);});}function getInteractionTags(_0xd5a3e9,_0x1d27a6){return new BPromise(function(_0x5ba5fa,_0x5cff58){try{if(_0xd5a3e9['TagIds']){_0xd5a3e9[_0x36f8('0x33')]=[];_0xd5a3e9[_0x36f8('0x34')][_0x36f8('0x35')](',')['forEach'](function(_0x2ba2d1){_0xd5a3e9[_0x36f8('0x33')][_0x36f8('0x36')](_0x1d27a6[_0x2ba2d1]);});}delete _0xd5a3e9[_0x36f8('0x34')];}catch(_0x169c38){_0x5cff58(_0x169c38);}_0x5ba5fa(_0xd5a3e9);});}function updateWhatsappInteraction(_0x120ef0,_0x823b3d,_0x7caeb5){return new BPromise(function(_0xa8a16a,_0x4089bf){return getInteractionUsers(_0x120ef0,_0x7caeb5)['then'](function(_0x95d533){return getInteractionTags(_0x95d533,_0x823b3d);})[_0x36f8('0x2a')](function(_0xfd047c){return getStateInteraction(_0xfd047c);})[_0x36f8('0x2a')](function(_0x369dc9){_0xa8a16a(_0x369dc9);})['catch'](function(_0x194b74){_0x4089bf(_0x194b74);});});}function getStateInteraction(_0x9801ab){return new BPromise(function(_0xc7933b){_0x9801ab['waiting']=0x0;_0x9801ab[_0x36f8('0x37')]=0x0;_0x9801ab[_0x36f8('0x38')]=0x0;_0x9801ab[_0x36f8('0x39')]=0x0;_0x9801ab[_0x36f8('0x3a')]=0x0;if(!_0x9801ab['closed']&&!_0x9801ab['UserId']){_0x9801ab[_0x36f8('0x3b')]+=0x1;}if(!_0x9801ab[_0x36f8('0x3c')]&&_0x9801ab[_0x36f8('0x3d')]){_0x9801ab[_0x36f8('0x37')]+=0x1;if(_0x9801ab[_0x36f8('0x3b')]){_0x9801ab[_0x36f8('0x3b')]-=0x1;}}if(_0x9801ab[_0x36f8('0x3c')]&&_0x9801ab['UserId']){_0x9801ab[_0x36f8('0x38')]+=0x1;if(_0x9801ab['talking']){_0x9801ab[_0x36f8('0x37')]-=0x1;}}if(_0x9801ab[_0x36f8('0x3c')]&&!_0x9801ab[_0x36f8('0x3d')]){_0x9801ab['unmanaged']+=0x1;if(_0x9801ab['waiting']){_0x9801ab[_0x36f8('0x3b')]-=0x1;}}_0x9801ab[_0x36f8('0x3a')]+=0x1;_0xc7933b(_0x9801ab);});}exports[_0x36f8('0x3e')]=function(_0x351ada,_0x3e9bf){var _0x356b7b={},_0x437218={},_0xb75354={'count':0x0,'rows':[]};var _0xa0e559=_[_0x36f8('0x31')](db['WhatsappInteraction'][_0x36f8('0x3f')],function(_0x144a88){return{'name':_0x144a88[_0x36f8('0x40')],'type':_0x144a88[_0x36f8('0x41')][_0x36f8('0x42')]};});_0x437218['model']=_[_0x36f8('0x31')](_0xa0e559,_0x36f8('0x2f'));_0x437218[_0x36f8('0x43')]=_['keys'](_0x351ada[_0x36f8('0x43')]);_0x437218[_0x36f8('0x44')]=_[_0x36f8('0x45')](_0x437218[_0x36f8('0x46')],_0x437218[_0x36f8('0x43')]);_0x356b7b['attributes']=_[_0x36f8('0x45')](_0x437218[_0x36f8('0x46')],qs[_0x36f8('0x47')](_0x351ada[_0x36f8('0x43')][_0x36f8('0x47')]));_0x356b7b[_0x36f8('0x48')]=_0x356b7b[_0x36f8('0x48')][_0x36f8('0x49')]?_0x356b7b['attributes']:_0x437218[_0x36f8('0x46')];if(!_0x351ada['query'][_0x36f8('0x4a')](_0x36f8('0x4b'))){_0x356b7b['limit']=qs[_0x36f8('0x23')](_0x351ada[_0x36f8('0x43')]['limit']);_0x356b7b['offset']=qs[_0x36f8('0x25')](_0x351ada[_0x36f8('0x43')][_0x36f8('0x25')]);}_0x356b7b[_0x36f8('0x4c')]=qs[_0x36f8('0x4d')](_0x351ada['query']['sort']);_0x356b7b[_0x36f8('0x4e')]=qs[_0x36f8('0x44')](_[_0x36f8('0x4f')](_0x351ada[_0x36f8('0x43')],_0x437218[_0x36f8('0x44')]),_0xa0e559);var _0x5085ac=[];var _0x4b324d=squel[_0x36f8('0x50')]()[_0x36f8('0x51')]('id')[_0x36f8('0x51')](_0x36f8('0x2f'))[_0x36f8('0x51')]('color')[_0x36f8('0x52')]('tools_tags');var _0x39752a=squel[_0x36f8('0x50')]()[_0x36f8('0x51')]('u.id')[_0x36f8('0x51')](_0x36f8('0x53'))[_0x36f8('0x51')](_0x36f8('0x54'))[_0x36f8('0x52')]('user_has_whatsapp_interactions','ui')[_0x36f8('0x55')]('users','u','u.id\x20=\x20ui.UserId');var _0x4e9459=squel[_0x36f8('0x50')]()[_0x36f8('0x52')](_0x36f8('0x56'),'i')[_0x36f8('0x55')](_0x36f8('0x57'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x36f8('0x58'),'o',_0x36f8('0x59'))[_0x36f8('0x55')](_0x36f8('0x5a'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0x36f8('0x5b'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x36f8('0x55')](_0x36f8('0x5c'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x36f8('0x55')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x34a2f5=squel['expr']();var _0x4606c4=[];var _0x4a1b30=squel[_0x36f8('0x5d')]();var _0x286b57;if(_0x351ada[_0x36f8('0x43')]['search']){_0x286b57=as[_0x36f8('0x5e')](_0x351ada[_0x36f8('0x43')][_0x36f8('0x5f')]);var _0x5eeb0e=_0x286b57[_0x36f8('0x60')];for(var _0x4a3136=0x0;_0x4a3136<_0x286b57[_0x36f8('0x61')][_0x36f8('0x49')];_0x4a3136++){var _0x16126c=_0x286b57[_0x36f8('0x61')][_0x4a3136];var _0x216aff='i';var _0x30ef97=_[_0x36f8('0x62')](_0xa0e559,[_0x36f8('0x2f'),_0x16126c[_0x36f8('0x51')]]);if(!_0x30ef97){switch(_0x16126c[_0x36f8('0x51')]){case _0x36f8('0x63'):if(_0x16126c[_0x36f8('0x64')]==0x1){_0x4e9459[_0x36f8('0x65')]('`'+_0x16126c[_0x36f8('0x51')]+_0x36f8('0x66'));}else{_0x4e9459[_0x36f8('0x65')]('`'+_0x16126c['field']+_0x36f8('0x67'));}break;case'Contact':if(_0x16126c[_0x36f8('0x68')]===_0x36f8('0x69')){if(_0x16126c[_0x36f8('0x64')][_0x36f8('0x35')]('\x20')[_0x36f8('0x49')]>0x1){_0x34a2f5[_0x5eeb0e](_0x36f8('0x6a'),qs[_0x36f8('0x6b')](_0x16126c[_0x36f8('0x64')]),null);}else{var _0x3f6f3b='%'+_0x16126c[_0x36f8('0x64')]+'%';_0x34a2f5[_0x5eeb0e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f6f3b,_0x3f6f3b,_0x3f6f3b);}}else{_0x30ef97=_[_0x36f8('0x62')](_0xa0e559,[_0x36f8('0x2f'),_0x36f8('0x6c')]);_0x16126c[_0x36f8('0x51')]=_0x36f8('0x6c');_0x2076f3=as[_0x36f8('0x6d')](_0x216aff,_0x30ef97[_0x36f8('0x41')],_0x16126c);_0x34a2f5[_0x5eeb0e](_0x2076f3[_0x36f8('0x6e')],_0x2076f3['value'][_0x36f8('0x6f')],_0x2076f3[_0x36f8('0x64')]['end']);}break;case _0x36f8('0x70'):var _0x1c8713=_0x16126c[_0x36f8('0x64')][_0x36f8('0x35')](',')[_0x36f8('0x31')](function(_0xe1c424){return Number(_0xe1c424);});_0x1c8713[_0x36f8('0x71')](function(_0x275c7c){_0x4a1b30['or'](_0x36f8('0x72'),'%,'+_0x275c7c+',%');});_0x4606c4=_['union'](_0x4606c4,_0x1c8713);break;case _0x36f8('0x73'):if(_0x16126c['operator']===_0x36f8('0x69')){_0x34a2f5[_0x5eeb0e](_0x36f8('0x74'),'%'+_0x16126c[_0x36f8('0x64')]+'%',null);}else{_0x30ef97=_[_0x36f8('0x62')](_0xa0e559,[_0x36f8('0x2f'),'UserId']);_0x16126c['field']='UserId';_0x2076f3=as[_0x36f8('0x6d')](_0x216aff,_0x30ef97['type'],_0x16126c);_0x34a2f5[_0x5eeb0e](_0x2076f3[_0x36f8('0x6e')],_0x2076f3[_0x36f8('0x64')]['start'],_0x2076f3[_0x36f8('0x64')][_0x36f8('0x20')]);}break;case _0x36f8('0x75'):_0x2076f3=as['buildExpression']('me',null,_0x16126c);_0x34a2f5[_0x5eeb0e](_0x2076f3[_0x36f8('0x6e')],_0x2076f3[_0x36f8('0x64')][_0x36f8('0x6f')],_0x2076f3[_0x36f8('0x64')][_0x36f8('0x20')]);break;}}else{var _0x2076f3=as['buildExpression'](_0x216aff,_0x30ef97[_0x36f8('0x41')],_0x16126c);_0x34a2f5[_0x5eeb0e](_0x2076f3[_0x36f8('0x6e')],_0x2076f3[_0x36f8('0x64')][_0x36f8('0x6f')],_0x2076f3[_0x36f8('0x64')]['end']);}}}else{var _0x1ef414=_(_0x351ada[_0x36f8('0x43')])[_0x36f8('0x76')]()['map'](function(_0x439196){return _['some'](_0xa0e559,[_0x36f8('0x2f'),_0x439196])?_0x439196:undefined;})['compact']()[_0x36f8('0x64')]();if(!_[_0x36f8('0x77')](_0x1ef414)){_0x1ef414['forEach'](function(_0x145877){if(_0x145877===_0x36f8('0x78')){_0x4e9459['where'](_0x36f8('0x79'),[]['concat'](_0x351ada[_0x36f8('0x43')][_0x145877]));}else if(_0x145877==='createdAt'){var _0x265efa=JSON['parse'](_0x351ada['query'][_0x145877])['$gte'];var _0x519d48=JSON[_0x36f8('0x7a')](_0x351ada[_0x36f8('0x43')][_0x145877])[_0x36f8('0x7b')];_0x4e9459['where'](_0x36f8('0x7c'),_0x265efa,_0x519d48);}else{if(_0x351ada[_0x36f8('0x43')][_0x145877]===_0x36f8('0x7d')){_0x4e9459[_0x36f8('0x4e')]('i.'+_0x145877+_0x36f8('0x7e'));}else{_0x4e9459[_0x36f8('0x4e')]('i.'+_0x145877+_0x36f8('0x7f'),_0x351ada[_0x36f8('0x43')][_0x145877]);}}});}if(_0x351ada[_0x36f8('0x43')]['read']){if(_0x351ada[_0x36f8('0x43')][_0x36f8('0x80')]==0x1){_0x4e9459[_0x36f8('0x65')](_0x36f8('0x81'));}else{_0x4e9459['having']('`unreadMessages`\x20>\x200');}}if(_0x351ada['query'][_0x36f8('0x82')]){_0x4606c4=_[_0x36f8('0x83')](_0x351ada['query'][_0x36f8('0x82')])?_0x351ada[_0x36f8('0x43')][_0x36f8('0x82')]:new Array(_0x351ada['query'][_0x36f8('0x82')]);_0x4606c4[_0x36f8('0x71')](function(_0x5cccfa){_0x4a1b30['or'](_0x36f8('0x72'),'%,'+_0x5cccfa+',%');});}if(_0x351ada[_0x36f8('0x43')][_0x36f8('0x84')]){var _0x1bc032=_0x351ada[_0x36f8('0x43')][_0x36f8('0x84')][_0x36f8('0x85')]('\x5c','\x5c\x5c')[_0x36f8('0x85')](/'/g,'\x27\x27');if(qs[_0x36f8('0x86')](_0x1bc032)){_0x34a2f5['or'](_0x36f8('0x87'),_0x1bc032+'%')['or'](_0x36f8('0x88'),_0x1bc032+'%');}else{_0x34a2f5['or'](_0x36f8('0x89'),qs['getFullTextValue'](_0x1bc032))['or'](_0x36f8('0x8a'),_0x1bc032+'%');}}}_0x4e9459[_0x36f8('0x4e')](_0x34a2f5);_0x4e9459[_0x36f8('0x8b')](_0x36f8('0x8c'));var _0x50ab92={'type':db[_0x36f8('0x8d')]['QueryTypes'][_0x36f8('0x8e')],'raw':!![]};var _0x238188=_0x4e9459[_0x36f8('0x8f')]();_0x238188[_0x36f8('0x51')](_0x36f8('0x8c'));_0x238188[_0x36f8('0x51')](_0x36f8('0x90'),'unreadMessages');if(_0x356b7b['order']){_0x356b7b[_0x36f8('0x4c')][_0x36f8('0x71')](function(_0x5acdba){var _0x454a3c=_0x5acdba[0x0]===_0x36f8('0x91')?_0x5acdba[0x0]:'i.'+_0x5acdba[0x0];_0x4e9459[_0x36f8('0x4c')](_0x454a3c,_0x5acdba[0x1]===_0x36f8('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x4606c4)){_0x4e9459[_0x36f8('0x65')](_0x4a1b30);_0x238188['where'](_0x36f8('0x93'),_0x4606c4);}BPromise[_0x36f8('0x94')]()[_0x36f8('0x2a')](function(){if(!_0x286b57){if(_0x351ada[_0x36f8('0x43')][_0x36f8('0x78')])return;_0x238188[_0x36f8('0x4e')](_0x36f8('0x95'));_0x4e9459['where'](_0x36f8('0x95'));return;}if(_0x351ada[_0x36f8('0x96')][_0x36f8('0x97')]!==_0x36f8('0x98'))return;return _0x351ada[_0x36f8('0x96')][_0x36f8('0x99')]({'attributes':['id'],'raw':!![]})[_0x36f8('0x2a')](function(_0x5c3c5c){if(_['isEmpty'](_0x5c3c5c)){_0x238188[_0x36f8('0x4e')](_0x36f8('0x9a'));_0x4e9459[_0x36f8('0x4e')](_0x36f8('0x9a'));}else{_0x238188['where'](_0x36f8('0x79'),_[_0x36f8('0x31')](_0x5c3c5c,'id'));_0x4e9459[_0x36f8('0x4e')](_0x36f8('0x79'),_[_0x36f8('0x31')](_0x5c3c5c,'id'));}});})['then'](function(){if(_0x351ada[_0x36f8('0x96')][_0x36f8('0x97')]===_0x36f8('0x98')&&!_0x286b57&&!_0x351ada[_0x36f8('0x43')][_0x36f8('0x78')])return[];return db[_0x36f8('0x9b')]['query'](_0x238188['toString'](),_0x50ab92);})[_0x36f8('0x2a')](function(_0x5211af){_0xb75354[_0x36f8('0x24')]=_0x5211af[_0x36f8('0x49')];if(_0xb75354[_0x36f8('0x24')]===0x0)return[];return db['sequelize']['query'](_0x4b324d[_0x36f8('0x9c')](),_0x50ab92)[_0x36f8('0x2a')](function(_0x593f36){_0x5085ac=_[_0x36f8('0x9d')](_0x593f36,'id');_0x50ab92=_[_0x36f8('0x9e')](_0x50ab92,{'model':db[_0x36f8('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x351ada[_0x36f8('0x43')]['fields']){_0x356b7b[_0x36f8('0x48')][_0x36f8('0x71')](function(_0x107e94){_0x4e9459[_0x36f8('0x51')]('i.'+_0x107e94);});}else{_0x4e9459['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x36f8('0x63'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xa0'),_0x36f8('0xa1'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xa2'),'Account.mandatoryDisposition');_0x4e9459['field'](_0x36f8('0xa3'),_0x36f8('0x91'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xa4'));_0x4e9459['field'](_0x36f8('0xa5'),'Contact.firstName');_0x4e9459['field'](_0x36f8('0xa6'),_0x36f8('0xa7'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xa8'),'Contact.email');_0x4e9459[_0x36f8('0x51')](_0x36f8('0xa9'),_0x36f8('0xaa'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xab'),_0x36f8('0xac'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xad'),_0x36f8('0xae'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xaf'),_0x36f8('0xb0'));_0x4e9459[_0x36f8('0x51')](_0x36f8('0xb1'),_0x36f8('0xb2'));_0x4e9459[_0x36f8('0x51')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x36f8('0x34'));}if(_0x356b7b[_0x36f8('0x23')])_0x4e9459[_0x36f8('0x23')](_0x356b7b[_0x36f8('0x23')]);if(_0x356b7b['offset'])_0x4e9459['offset'](_0x356b7b[_0x36f8('0x25')]);return db[_0x36f8('0x9b')][_0x36f8('0x43')](_0x4e9459['toString'](),_0x50ab92);})[_0x36f8('0x2a')](function(_0x41bdb3){if(_0x41bdb3[_0x36f8('0x49')]>0x0)_0x39752a['where']('ui.WhatsappInteractionId\x20IN\x20?',_[_0x36f8('0x31')](_0x41bdb3,'id'));return db[_0x36f8('0x9b')][_0x36f8('0x43')](_0x39752a[_0x36f8('0x9c')](),_0x50ab92)[_0x36f8('0x2a')](function(_0x5d654d){var _0x1d6803=_['groupBy'](_0x5d654d,_0x36f8('0xb3'));var _0x2b289a=[];_0x41bdb3['forEach'](function(_0x211ad2){_0x2b289a[_0x36f8('0x36')](updateWhatsappInteraction(_0x211ad2,_0x5085ac,_0x1d6803));});return BPromise['all'](_0x2b289a);});});})[_0x36f8('0x2a')](function(_0x4f0164){_0xb75354[_0x36f8('0xb4')]=_0x4f0164;return _0xb75354;})[_0x36f8('0x2a')](respondWithFilteredResult(_0x3e9bf,_0x356b7b))[_0x36f8('0xb5')](handleError(_0x3e9bf,null));};exports[_0x36f8('0xb6')]=function(_0x3154f9,_0x5bccf1){var _0x3a67f9={'raw':![],'where':{'id':_0x3154f9[_0x36f8('0xb7')]['id']}},_0x4b5b5e={};_0x4b5b5e[_0x36f8('0x46')]=_[_0x36f8('0x76')](db['WhatsappInteraction'][_0x36f8('0x3f')]);_0x4b5b5e[_0x36f8('0x43')]=_['keys'](_0x3154f9[_0x36f8('0x43')]);_0x4b5b5e[_0x36f8('0x44')]=_[_0x36f8('0x45')](_0x4b5b5e['model'],_0x4b5b5e['query']);_0x3a67f9['attributes']=_[_0x36f8('0x45')](_0x4b5b5e[_0x36f8('0x46')],qs[_0x36f8('0x47')](_0x3154f9[_0x36f8('0x43')][_0x36f8('0x47')]));_0x3a67f9[_0x36f8('0x48')]=_0x3a67f9[_0x36f8('0x48')][_0x36f8('0x49')]?_0x3a67f9[_0x36f8('0x48')]:_0x4b5b5e['model'];if(_0x3154f9[_0x36f8('0x43')][_0x36f8('0xb8')]){_0x3a67f9['include']=[{'all':!![]}];}_0x3a67f9=_[_0x36f8('0x9e')]({},_0x3a67f9,_0x3154f9['options']);return db[_0x36f8('0x9f')]['find'](_0x3a67f9)[_0x36f8('0x2a')](handleEntityNotFound(_0x5bccf1,null))[_0x36f8('0x2a')](respondWithResult(_0x5bccf1,null))[_0x36f8('0xb5')](handleError(_0x5bccf1,null));};exports[_0x36f8('0xb9')]=function(_0x1db350,_0x33a34b){return db[_0x36f8('0x9f')]['create'](_0x1db350[_0x36f8('0x75')],{})[_0x36f8('0x2a')](respondWithResult(_0x33a34b,0xc9))[_0x36f8('0xb5')](handleError(_0x33a34b,null));};exports['update']=function(_0x16427f,_0x3e8530){if(_0x16427f['body']['id']){delete _0x16427f[_0x36f8('0x75')]['id'];}return db[_0x36f8('0x9f')][_0x36f8('0x62')]({'where':{'id':_0x16427f[_0x36f8('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3e8530,null))[_0x36f8('0x2a')](saveUpdates(_0x16427f[_0x36f8('0x75')],null))[_0x36f8('0x2a')](respondWithResult(_0x3e8530,null))['catch'](handleError(_0x3e8530,null));};exports['destroy']=function(_0x4fc8ae,_0x33fe6c){return db[_0x36f8('0x9f')][_0x36f8('0x62')]({'where':{'id':_0x4fc8ae['params']['id']}})[_0x36f8('0x2a')](handleEntityNotFound(_0x33fe6c,null))['then'](removeEntity(_0x33fe6c,null))[_0x36f8('0xb5')](handleError(_0x33fe6c,null));};exports[_0x36f8('0xba')]=function(_0x2ca2bd,_0x314804){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x314804,null))[_0x36f8('0xb5')](handleError(_0x314804,null));};exports[_0x36f8('0xbb')]=function(_0x37ad4e,_0x16225d,_0x388f5a){return db[_0x36f8('0xbc')][_0x36f8('0x62')]({'where':{'id':_0x37ad4e[_0x36f8('0xb7')]['id']}})['then'](handleEntityNotFound(_0x16225d,null))[_0x36f8('0x2a')](function(_0x1a68cf){if(_0x1a68cf){return _0x1a68cf['addMessage'](_0x37ad4e['body'][_0x36f8('0xbd')],_[_0x36f8('0xbe')](_0x37ad4e[_0x36f8('0x75')],[_0x36f8('0xbd'),'id'])||{});}})[_0x36f8('0x2a')](respondWithResult(_0x16225d,null))['catch'](handleError(_0x16225d,null));};exports['getMessages']=function(_0x4984b8,_0x18ac10,_0x553682){var _0x26cda7={'raw':![],'where':{}};var _0xdab4e7={};var _0x32b4dd={'count':0x0,'rows':[]};return db[_0x36f8('0x9f')][_0x36f8('0xbf')]({'where':{'id':_0x4984b8['params']['id']}})[_0x36f8('0x2a')](handleEntityNotFound(_0x18ac10,null))[_0x36f8('0x2a')](function(_0x3555ba){if(_0x3555ba){_0xdab4e7[_0x36f8('0x46')]=_[_0x36f8('0x76')](db[_0x36f8('0xbc')]['rawAttributes']);_0xdab4e7[_0x36f8('0x43')]=_['keys'](_0x4984b8[_0x36f8('0x43')]);_0xdab4e7[_0x36f8('0x44')]=_[_0x36f8('0x45')](_0xdab4e7[_0x36f8('0x46')],_0xdab4e7[_0x36f8('0x43')]);_0x26cda7[_0x36f8('0x48')]=_[_0x36f8('0x45')](_0xdab4e7[_0x36f8('0x46')],qs[_0x36f8('0x47')](_0x4984b8['query'][_0x36f8('0x47')]));_0x26cda7[_0x36f8('0x48')]=_0x26cda7[_0x36f8('0x48')]['length']?_0x26cda7[_0x36f8('0x48')]:_0xdab4e7['model'];if(!_0x4984b8[_0x36f8('0x43')][_0x36f8('0x4a')](_0x36f8('0x4b'))){_0x26cda7['limit']=qs[_0x36f8('0x23')](_0x4984b8[_0x36f8('0x43')][_0x36f8('0x23')]);_0x26cda7[_0x36f8('0x25')]=qs[_0x36f8('0x25')](_0x4984b8['query']['offset']);}_0x26cda7[_0x36f8('0x4c')]=qs[_0x36f8('0x4d')](_0x4984b8[_0x36f8('0x43')][_0x36f8('0x4d')]);_0x26cda7['where']=qs[_0x36f8('0x44')](_[_0x36f8('0x4f')](_0x4984b8[_0x36f8('0x43')],_0xdab4e7[_0x36f8('0x44')]));_0x26cda7[_0x36f8('0x4e')][_0x36f8('0xb3')]=_0x3555ba['id'];if(_0x4984b8[_0x36f8('0x43')][_0x36f8('0x84')]){_0x26cda7[_0x36f8('0x4e')]=_['merge'](_0x26cda7[_0x36f8('0x4e')],{'$or':_[_0x36f8('0x31')](_0x26cda7[_0x36f8('0x48')],function(_0x184d6a){var _0x4ad7a5={};_0x4ad7a5[_0x184d6a]={'$like':'%'+_0x4984b8[_0x36f8('0x43')][_0x36f8('0x84')]+'%'};return _0x4ad7a5;})});}if(_0x4984b8[_0x36f8('0x43')]['$gte']){var _0x721488=_0x4984b8[_0x36f8('0x43')][_0x36f8('0xc0')][_0x36f8('0x35')](',');var _0x4a15a3={};_0x4a15a3[_0x721488[0x0]]={'$gte':moment(_0x721488[0x1])[_0x36f8('0xc1')](_0x36f8('0xc2'))};_0x26cda7['where']=_[_0x36f8('0x9e')](_0x26cda7[_0x36f8('0x4e')],_0x4a15a3);}_0x26cda7=_[_0x36f8('0x9e')]({},_0x26cda7,_0x4984b8[_0x36f8('0xc3')]);return db[_0x36f8('0xbc')][_0x36f8('0x24')]({'where':_0x26cda7[_0x36f8('0x4e')]})[_0x36f8('0x2a')](function(_0x12a7ca){_0x32b4dd['count']=_0x12a7ca;if(_0x4984b8['query'][_0x36f8('0xb8')]){_0x26cda7['include']=[{'all':!![]}];}return db[_0x36f8('0xbc')][_0x36f8('0xc4')](_0x26cda7);})[_0x36f8('0x2a')](function(_0x180740){_0x32b4dd['rows']=_0x180740;return _0x32b4dd;});}})[_0x36f8('0x2a')](respondWithFilteredResult(_0x18ac10,_0x26cda7))[_0x36f8('0xb5')](handleError(_0x18ac10,null));};exports[_0x36f8('0xc5')]=function(_0x31a0e1,_0x1b62df,_0x3a3194){return db[_0x36f8('0x9f')]['find']({'where':{'id':_0x31a0e1[_0x36f8('0xb7')]['id']}})[_0x36f8('0x2a')](handleEntityNotFound(_0x1b62df,null))[_0x36f8('0x2a')](function(_0x50a85b){if(_0x50a85b){return _0x50a85b[_0x36f8('0xc6')](_0x31a0e1['body']['ids'],_[_0x36f8('0xbe')](_0x31a0e1[_0x36f8('0x75')],[_0x36f8('0xbd'),'id'])||{})['spread'](function(){return db['Tag'][_0x36f8('0xc4')]({'attributes':['id',_0x36f8('0x2f'),'color'],'where':{'id':_0x31a0e1[_0x36f8('0x75')][_0x36f8('0xbd')]}});})[_0x36f8('0x2a')](function(_0x45b553){socket['emit'](_0x36f8('0xc7'),{'id':Number(_0x31a0e1['params']['id']),'tags':_0x45b553||[]});return{'id':Number(_0x31a0e1[_0x36f8('0xb7')]['id']),'tags':_0x45b553||[]};});}})[_0x36f8('0x2a')](respondWithResult(_0x1b62df,null))['catch'](handleError(_0x1b62df,null));};exports[_0x36f8('0xc8')]=function(_0x228983,_0x17f51b,_0x3d9a13){return db[_0x36f8('0x9f')][_0x36f8('0x62')]({'where':{'id':_0x228983[_0x36f8('0xb7')]['id']}})['then'](handleEntityNotFound(_0x17f51b,null))[_0x36f8('0x2a')](function(_0x13a2a7){if(_0x13a2a7){return _0x13a2a7[_0x36f8('0xc8')](_0x228983[_0x36f8('0x43')][_0x36f8('0xbd')]);}})[_0x36f8('0x2a')](respondWithStatusCode(_0x17f51b,null))['catch'](handleError(_0x17f51b,null));};exports[_0x36f8('0xc9')]=function(_0x2105ea,_0x19eaa4){var _0x212303=moment()[_0x36f8('0xca')]()['toString']();var _0x703b5d=path[_0x36f8('0xcb')](config[_0x36f8('0xcc')],'server','files','tmp');var _0x58f663=path[_0x36f8('0xcb')](config[_0x36f8('0xcc')],_0x36f8('0xcd'),_0x36f8('0xce'),'attachments');var _0x3ab87a=path[_0x36f8('0xcb')](_0x703b5d,_0x212303);var _0x2788d2=util[_0x36f8('0xc1')](_0x36f8('0xcf'),_0x2105ea[_0x36f8('0xb7')]['id'],_0x212303);var _0x1d1bc1=path[_0x36f8('0xcb')](_0x703b5d,_0x2788d2);var _0x3b1677=[];_0x3b1677[_0x36f8('0x36')]({'model':db[_0x36f8('0x73')],'as':_0x36f8('0x73'),'attributes':['id',_0x36f8('0x32')],'raw':!![]});_0x3b1677[_0x36f8('0x36')]({'model':db['CmContact'],'as':_0x36f8('0xd0'),'attributes':['id',_0x36f8('0xd1'),_0x36f8('0xd2')],'raw':!![]});if(_0x2105ea[_0x36f8('0x43')]['attachments']){_0x3b1677[_0x36f8('0x36')]({'model':db[_0x36f8('0xd3')],'as':_0x36f8('0xd3'),'raw':!![]});}var _0x4f6487=[{'model':db[_0x36f8('0xbc')],'as':_0x36f8('0xd4'),'attributes':['id',_0x36f8('0x75'),_0x36f8('0xd5'),_0x36f8('0xd6'),_0x36f8('0xd7'),_0x36f8('0x80')],'include':_0x3b1677}];_0x4f6487[_0x36f8('0x36')]({'model':db[_0x36f8('0xd8')],'as':_0x36f8('0xd9'),'attributes':['id','name']});_0x4f6487[_0x36f8('0x36')]({'model':db[_0x36f8('0x73')],'as':_0x36f8('0xda'),'attributes':['id',_0x36f8('0x32')]});return db[_0x36f8('0x9f')][_0x36f8('0x62')]({'where':{'id':_0x2105ea[_0x36f8('0xb7')]['id']},'include':_0x4f6487})[_0x36f8('0x2a')](handleEntityNotFound(_0x19eaa4,null))[_0x36f8('0x2a')](function(_0x2d56e1){if(_0x2d56e1){var _0x368bca=_0x2d56e1[_0x36f8('0xdb')]({'plain':!![]});fs[_0x36f8('0xdc')](_0x3ab87a);var _0x4f2c0f={'channel':'Whatsapp','account':_0x368bca[_0x36f8('0xd9')]['name'],'agent':_0x368bca['Owner']?_0x368bca['Owner'][_0x36f8('0x32')]:_0x36f8('0xdd'),'createdAt':moment(_0x368bca[_0x36f8('0xd5')])[_0x36f8('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x36f8('0x9c')](),'closedAt':_0x368bca['closed']?moment(_0x368bca[_0x36f8('0xde')])[_0x36f8('0xc1')](_0x36f8('0xc2'))[_0x36f8('0x9c')]():'','disposition':_0x368bca[_0x36f8('0xdf')],'messages':_(_0x368bca['Messages'])['filter']({'secret':![]})[_0x36f8('0x31')](function(_0x1fb547){if(_0x1fb547['Attachment']){var _0x3abb36=path['join'](_0x58f663,_0x1fb547[_0x36f8('0xd3')][_0x36f8('0xe0')]);if(fs[_0x36f8('0xe1')](_0x3abb36)){fs[_0x36f8('0xe2')](_0x3abb36)['pipe'](fs[_0x36f8('0xe3')](path[_0x36f8('0xcb')](_0x3ab87a,_0x1fb547[_0x36f8('0xd3')][_0x36f8('0xe0')])));}}return{'date':moment(_0x1fb547[_0x36f8('0xd5')])[_0x36f8('0xc1')](_0x36f8('0xc2'))[_0x36f8('0x9c')](),'sender':_0x1fb547[_0x36f8('0xd6')]===_0x36f8('0xe4')?_0x1fb547[_0x36f8('0x73')]?_0x1fb547[_0x36f8('0x73')][_0x36f8('0x32')]:_0x36f8('0xe5'):_0x1fb547[_0x36f8('0xd0')][_0x36f8('0xd1')]+(_0x1fb547[_0x36f8('0xd0')][_0x36f8('0xd2')]?'\x20'+_0x1fb547[_0x36f8('0xd0')][_0x36f8('0xd2')]:''),'body':_0x1fb547['Attachment']?_0x1fb547[_0x36f8('0xd3')]['basename']:_0x1fb547[_0x36f8('0x75')],'direction':_0x1fb547[_0x36f8('0xd6')]===_0x36f8('0xe4')?'A':'C','secret':_0x1fb547[_0x36f8('0xd7')],'read':_0x1fb547[_0x36f8('0x80')],'attachment':_0x1fb547['Attachment']};})[_0x36f8('0x64')]()};return ejs[_0x36f8('0xe6')](path[_0x36f8('0xcb')](config[_0x36f8('0xcc')],_0x36f8('0xcd'),_0x36f8('0xe7'),_0x36f8('0xe8')),{'interaction':_0x4f2c0f})[_0x36f8('0x2a')](function(_0x5803d0){var _0x3a4c2b=path['join'](_0x3ab87a,_0x36f8('0xe9')+_0x368bca['id']+'-'+_0x212303+_0x36f8('0xea'));var _0x195098={'path':_0x3a4c2b,'channel':_0x36f8('0xeb'),'interactionId':_0x368bca['id']};return pdf[_0x36f8('0xec')](_0x5803d0,_0x195098);})[_0x36f8('0x2a')](function(){return new BPromise(function(_0x3e33c5,_0x2da0bc){zipdir(_0x3ab87a,{'saveTo':_0x1d1bc1},function(_0xe1e71,_0x3d5437){if(_0xe1e71)return _0x2da0bc(_0xe1e71);return _0x3e33c5(_0x3d5437);});})[_0x36f8('0x2a')](function(){return new BPromise(function(_0xe0d96,_0x3ea722){rimraf(_0x3ab87a,function(_0x199b63){if(_0x199b63)_0x3ea722(_0x199b63);return _0xe0d96();});});})['then'](function(){return _0x19eaa4[_0x36f8('0xc9')](_0x1d1bc1,_0x2788d2,function(_0x44f0a4){if(_0x44f0a4){console[_0x36f8('0xed')](_0x36f8('0xee'),_0x44f0a4);}else{fs[_0x36f8('0xef')](_0x1d1bc1);}});});});}else{return _0x19eaa4[_0x36f8('0x2c')](0xc8);}})[_0x36f8('0xb5')](handleError(_0x19eaa4,null));}; \ No newline at end of file +var _0x8ed7=['c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','isEmpty','WhatsappAccountId','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','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','contactName','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','params','keys','rawAttributes','include','merge','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','includeAll','setTags','spread','findAll','emit','whatsappInteractionTags:save','unix','join','server','root','files','attachments','format','transcript-%d-%s.zip','lastName','Attachment','createdAt','Account','Owner','get','mkdirSync','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','firstName','Contact','downloadInteraction.ejs','Whatsapp','createPdfFromHTML','download','log','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','save','update','then','error','stack','name','send','fullname','Tags','split','forEach','push','TagIds','catch','waiting','talking','answered','unmanaged','total','closed','UserId','map','WhatsappInteraction','fieldName','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','select','field','color','from','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts'];(function(_0x220c97,_0x3f95c2){var _0x529f88=function(_0x13f0b7){while(--_0x13f0b7){_0x220c97['push'](_0x220c97['shift']());}};_0x529f88(++_0x3f95c2);}(_0x8ed7,0x8b));var _0x78ed=function(_0x83d270,_0x1ab89d){_0x83d270=_0x83d270-0x0;var _0x35dd28=_0x8ed7[_0x83d270];return _0x35dd28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78ed('0x0'));var zipdir=require(_0x78ed('0x1'));var jsonpatch=require(_0x78ed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x78ed('0x3'));var Mustache=require(_0x78ed('0x4'));var util=require(_0x78ed('0x5'));var path=require(_0x78ed('0x6'));var sox=require(_0x78ed('0x7'));var csv=require(_0x78ed('0x8'));var ejs=require(_0x78ed('0x9'));var fs=require('fs');var fs_extra=require(_0x78ed('0xa'));var _=require(_0x78ed('0xb'));var squel=require('squel');var crypto=require(_0x78ed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x78ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x78ed('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78ed('0xf'));var qs=require(_0x78ed('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x78ed('0x11'));var hardwareService=require(_0x78ed('0x12'));var logger=require('../../config/logger')(_0x78ed('0x13'));var utils=require('../../config/utils');var config=require(_0x78ed('0x14'));var licenseUtil=require(_0x78ed('0x15'));var db=require(_0x78ed('0x16'))['db'];config[_0x78ed('0x17')]=_[_0x78ed('0x18')](config[_0x78ed('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x78ed('0x19'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x58ba86,_0x5316ca){_0x5316ca=_0x5316ca||0xcc;return function(_0x2e88ad){if(_0x2e88ad){return _0x58ba86[_0x78ed('0x1a')](_0x5316ca);}return _0x58ba86[_0x78ed('0x1b')](_0x5316ca)[_0x78ed('0x1c')]();};}function respondWithResult(_0x250d59,_0x454a65){_0x454a65=_0x454a65||0xc8;return function(_0x336ae1){if(_0x336ae1){return _0x250d59[_0x78ed('0x1b')](_0x454a65)[_0x78ed('0x1d')](_0x336ae1);}};}function respondWithFilteredResult(_0xc20c52,_0x2dd98c){return function(_0x4b9797){if(_0x4b9797){var _0x2f442b=typeof _0x2dd98c[_0x78ed('0x1e')]==='undefined'&&typeof _0x2dd98c['limit']===_0x78ed('0x1f');var _0x2ab0fc=_0x4b9797[_0x78ed('0x20')];var _0x3bb4a9=_0x2f442b?0x0:_0x2dd98c[_0x78ed('0x1e')];var _0x3bd736=_0x2f442b?_0x4b9797[_0x78ed('0x20')]:_0x2dd98c[_0x78ed('0x1e')]+_0x2dd98c[_0x78ed('0x21')];var _0x33a4d4;if(_0x3bd736>=_0x2ab0fc){_0x3bd736=_0x2ab0fc;_0x33a4d4=0xc8;}else{_0x33a4d4=0xce;}_0xc20c52[_0x78ed('0x1b')](_0x33a4d4);return _0xc20c52['set']('Content-Range',_0x3bb4a9+'-'+_0x3bd736+'/'+_0x2ab0fc)[_0x78ed('0x1d')](_0x4b9797);}return null;};}function patchUpdates(_0x553f71){return function(_0xee570c){try{jsonpatch['apply'](_0xee570c,_0x553f71,!![]);}catch(_0x4675d3){return BPromise['reject'](_0x4675d3);}return _0xee570c[_0x78ed('0x22')]();};}function saveUpdates(_0x40463f,_0x203546){return function(_0x59e78c){if(_0x59e78c){return _0x59e78c[_0x78ed('0x23')](_0x40463f)['then'](function(_0x137c7c){return _0x137c7c;});}return null;};}function removeEntity(_0x2a4573,_0x34fb0e){return function(_0x59349a){if(_0x59349a){return _0x59349a['destroy']()[_0x78ed('0x24')](function(){_0x2a4573['status'](0xcc)[_0x78ed('0x1c')]();});}};}function handleEntityNotFound(_0x55c5ed,_0x12d5e1){return function(_0x1433e1){if(!_0x1433e1){_0x55c5ed[_0x78ed('0x1a')](0x194);}return _0x1433e1;};}function handleError(_0x4f91df,_0xafc1cf){_0xafc1cf=_0xafc1cf||0x1f4;return function(_0x624bb1){logger[_0x78ed('0x25')](_0x624bb1[_0x78ed('0x26')]);if(_0x624bb1[_0x78ed('0x27')]){delete _0x624bb1['name'];}_0x4f91df[_0x78ed('0x1b')](_0xafc1cf)[_0x78ed('0x28')](_0x624bb1);};}function getInteractionUsers(_0x2a66ce,_0x1afab4){return new BPromise(function(_0x4af685,_0x4a8a5e){try{if(_0x1afab4[_0x2a66ce['id']]){_0x2a66ce['Users']=_['map'](_0x1afab4[_0x2a66ce['id']],function(_0x20bb76){return{'id':_0x20bb76['id'],'fullname':_0x20bb76[_0x78ed('0x29')]};});}}catch(_0x17883d){_0x4a8a5e(_0x17883d);}_0x4af685(_0x2a66ce);});}function getInteractionTags(_0x3d4c5d,_0x33989b){return new BPromise(function(_0x33f7f2,_0x7c7c2b){try{if(_0x3d4c5d['TagIds']){_0x3d4c5d[_0x78ed('0x2a')]=[];_0x3d4c5d['TagIds'][_0x78ed('0x2b')](',')[_0x78ed('0x2c')](function(_0x5d5942){_0x3d4c5d[_0x78ed('0x2a')][_0x78ed('0x2d')](_0x33989b[_0x5d5942]);});}delete _0x3d4c5d[_0x78ed('0x2e')];}catch(_0x13966a){_0x7c7c2b(_0x13966a);}_0x33f7f2(_0x3d4c5d);});}function updateWhatsappInteraction(_0x2f66e6,_0x19bd3b,_0x135a8f){return new BPromise(function(_0x45831d,_0x4da527){return getInteractionUsers(_0x2f66e6,_0x135a8f)[_0x78ed('0x24')](function(_0x4dc127){return getInteractionTags(_0x4dc127,_0x19bd3b);})[_0x78ed('0x24')](function(_0x35a18c){return getStateInteraction(_0x35a18c);})[_0x78ed('0x24')](function(_0x963ece){_0x45831d(_0x963ece);})[_0x78ed('0x2f')](function(_0x1aec84){_0x4da527(_0x1aec84);});});}function getStateInteraction(_0x2031eb){return new BPromise(function(_0x47f969){_0x2031eb[_0x78ed('0x30')]=0x0;_0x2031eb[_0x78ed('0x31')]=0x0;_0x2031eb[_0x78ed('0x32')]=0x0;_0x2031eb[_0x78ed('0x33')]=0x0;_0x2031eb[_0x78ed('0x34')]=0x0;if(!_0x2031eb[_0x78ed('0x35')]&&!_0x2031eb[_0x78ed('0x36')]){_0x2031eb[_0x78ed('0x30')]+=0x1;}if(!_0x2031eb[_0x78ed('0x35')]&&_0x2031eb[_0x78ed('0x36')]){_0x2031eb[_0x78ed('0x31')]+=0x1;if(_0x2031eb['waiting']){_0x2031eb['waiting']-=0x1;}}if(_0x2031eb[_0x78ed('0x35')]&&_0x2031eb['UserId']){_0x2031eb[_0x78ed('0x32')]+=0x1;if(_0x2031eb[_0x78ed('0x31')]){_0x2031eb['talking']-=0x1;}}if(_0x2031eb[_0x78ed('0x35')]&&!_0x2031eb[_0x78ed('0x36')]){_0x2031eb[_0x78ed('0x33')]+=0x1;if(_0x2031eb[_0x78ed('0x30')]){_0x2031eb[_0x78ed('0x30')]-=0x1;}}_0x2031eb[_0x78ed('0x34')]+=0x1;_0x47f969(_0x2031eb);});}exports['index']=function(_0x5c64e4,_0x3a6cc8){var _0x234592={},_0x2323de={},_0x560d17={'count':0x0,'rows':[]};var _0x4f0db5=_[_0x78ed('0x37')](db[_0x78ed('0x38')]['rawAttributes'],function(_0x1c402b){return{'name':_0x1c402b[_0x78ed('0x39')],'type':_0x1c402b['type']['key']};});_0x2323de[_0x78ed('0x3a')]=_[_0x78ed('0x37')](_0x4f0db5,_0x78ed('0x27'));_0x2323de[_0x78ed('0x3b')]=_['keys'](_0x5c64e4['query']);_0x2323de[_0x78ed('0x3c')]=_[_0x78ed('0x3d')](_0x2323de['model'],_0x2323de[_0x78ed('0x3b')]);_0x234592['attributes']=_[_0x78ed('0x3d')](_0x2323de[_0x78ed('0x3a')],qs[_0x78ed('0x3e')](_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x3e')]));_0x234592['attributes']=_0x234592[_0x78ed('0x3f')][_0x78ed('0x40')]?_0x234592[_0x78ed('0x3f')]:_0x2323de[_0x78ed('0x3a')];if(!_0x5c64e4[_0x78ed('0x3b')]['hasOwnProperty']('nolimit')){_0x234592[_0x78ed('0x21')]=qs[_0x78ed('0x21')](_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x21')]);_0x234592['offset']=qs[_0x78ed('0x1e')](_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x1e')]);}_0x234592[_0x78ed('0x41')]=qs[_0x78ed('0x42')](_0x5c64e4[_0x78ed('0x3b')]['sort']);_0x234592[_0x78ed('0x43')]=qs['filters'](_[_0x78ed('0x44')](_0x5c64e4['query'],_0x2323de[_0x78ed('0x3c')]),_0x4f0db5);var _0x2a164e=[];var _0x1020d9=squel[_0x78ed('0x45')]()[_0x78ed('0x46')]('id')['field']('name')[_0x78ed('0x46')](_0x78ed('0x47'))[_0x78ed('0x48')]('tools_tags');var _0x1868a3=squel[_0x78ed('0x45')]()[_0x78ed('0x46')]('u.id')['field'](_0x78ed('0x49'))['field'](_0x78ed('0x4a'))[_0x78ed('0x48')]('user_has_whatsapp_interactions','ui')['left_join'](_0x78ed('0x4b'),'u',_0x78ed('0x4c'));var _0x4ac75c=squel[_0x78ed('0x45')]()[_0x78ed('0x48')](_0x78ed('0x4d'),'i')[_0x78ed('0x4e')](_0x78ed('0x4f'),'c',_0x78ed('0x50'))[_0x78ed('0x4e')](_0x78ed('0x4b'),'o',_0x78ed('0x51'))[_0x78ed('0x4e')](_0x78ed('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x78ed('0x4e')](_0x78ed('0x53'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x78ed('0x4e')](_0x78ed('0x54'),'it',_0x78ed('0x55'))[_0x78ed('0x4e')](_0x78ed('0x56'),'t','t.id\x20=\x20it.TagId');var _0xf0a187=squel['expr']();var _0x3c6e23=[];var _0x118873=squel[_0x78ed('0x57')]();var _0x3eae51;if(_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x58')]){_0x3eae51=as['parseSearch'](_0x5c64e4['query'][_0x78ed('0x58')]);var _0x5f369d=_0x3eae51[_0x78ed('0x59')];for(var _0x35f946=0x0;_0x35f946<_0x3eae51[_0x78ed('0x5a')][_0x78ed('0x40')];_0x35f946++){var _0x5658b5=_0x3eae51[_0x78ed('0x5a')][_0x35f946];var _0x8ce62a='i';var _0x18e7ed=_[_0x78ed('0x5b')](_0x4f0db5,[_0x78ed('0x27'),_0x5658b5[_0x78ed('0x46')]]);if(!_0x18e7ed){switch(_0x5658b5['field']){case _0x78ed('0x5c'):if(_0x5658b5[_0x78ed('0x5d')]==0x1){_0x4ac75c['having']('`'+_0x5658b5[_0x78ed('0x46')]+_0x78ed('0x5e'));}else{_0x4ac75c[_0x78ed('0x5f')]('`'+_0x5658b5['field']+_0x78ed('0x60'));}break;case'Contact':if(_0x5658b5[_0x78ed('0x61')]==='$substring'){if(_0x5658b5['value'][_0x78ed('0x2b')]('\x20')[_0x78ed('0x40')]>0x1){_0xf0a187[_0x5f369d](_0x78ed('0x62'),qs[_0x78ed('0x63')](_0x5658b5[_0x78ed('0x5d')]),null);}else{var _0x2ccc3e='%'+_0x5658b5[_0x78ed('0x5d')]+'%';_0xf0a187[_0x5f369d](_0x78ed('0x64'),_0x2ccc3e,_0x2ccc3e,_0x2ccc3e);}}else{_0x18e7ed=_[_0x78ed('0x5b')](_0x4f0db5,[_0x78ed('0x27'),_0x78ed('0x65')]);_0x5658b5[_0x78ed('0x46')]='ContactId';_0x2bbce8=as[_0x78ed('0x66')](_0x8ce62a,_0x18e7ed[_0x78ed('0x67')],_0x5658b5);_0xf0a187[_0x5f369d](_0x2bbce8[_0x78ed('0x68')],_0x2bbce8['value']['start'],_0x2bbce8[_0x78ed('0x5d')][_0x78ed('0x1c')]);}break;case _0x78ed('0x69'):var _0x1781af=_0x5658b5[_0x78ed('0x5d')]['split'](',')[_0x78ed('0x37')](function(_0x289f07){return Number(_0x289f07);});_0x1781af[_0x78ed('0x2c')](function(_0x514d6e){_0x118873['or'](_0x78ed('0x6a'),'%,'+_0x514d6e+',%');});_0x3c6e23=_[_0x78ed('0x6b')](_0x3c6e23,_0x1781af);break;case _0x78ed('0x6c'):if(_0x5658b5[_0x78ed('0x61')]===_0x78ed('0x6d')){_0xf0a187[_0x5f369d](_0x78ed('0x6e'),'%'+_0x5658b5[_0x78ed('0x5d')]+'%',null);}else{_0x18e7ed=_[_0x78ed('0x5b')](_0x4f0db5,[_0x78ed('0x27'),'UserId']);_0x5658b5[_0x78ed('0x46')]=_0x78ed('0x36');_0x2bbce8=as[_0x78ed('0x66')](_0x8ce62a,_0x18e7ed[_0x78ed('0x67')],_0x5658b5);_0xf0a187[_0x5f369d](_0x2bbce8[_0x78ed('0x68')],_0x2bbce8[_0x78ed('0x5d')][_0x78ed('0x6f')],_0x2bbce8['value'][_0x78ed('0x1c')]);}break;case _0x78ed('0x70'):_0x2bbce8=as[_0x78ed('0x66')]('me',null,_0x5658b5);_0xf0a187[_0x5f369d](_0x2bbce8['text'],_0x2bbce8[_0x78ed('0x5d')][_0x78ed('0x6f')],_0x2bbce8[_0x78ed('0x5d')][_0x78ed('0x1c')]);break;}}else{var _0x2bbce8=as[_0x78ed('0x66')](_0x8ce62a,_0x18e7ed[_0x78ed('0x67')],_0x5658b5);_0xf0a187[_0x5f369d](_0x2bbce8['text'],_0x2bbce8['value'][_0x78ed('0x6f')],_0x2bbce8[_0x78ed('0x5d')][_0x78ed('0x1c')]);}}}else{var _0x4cf65d=_(_0x5c64e4[_0x78ed('0x3b')])['keys']()['map'](function(_0x3df1fd){return _[_0x78ed('0x71')](_0x4f0db5,['name',_0x3df1fd])?_0x3df1fd:undefined;})[_0x78ed('0x72')]()['value']();if(!_[_0x78ed('0x73')](_0x4cf65d)){_0x4cf65d['forEach'](function(_0x416110){if(_0x416110===_0x78ed('0x74')){_0x4ac75c[_0x78ed('0x43')]('i.WhatsappAccountId\x20IN\x20?',[][_0x78ed('0x75')](_0x5c64e4[_0x78ed('0x3b')][_0x416110]));}else if(_0x416110==='createdAt'){var _0x2f407f=JSON[_0x78ed('0x76')](_0x5c64e4[_0x78ed('0x3b')][_0x416110])[_0x78ed('0x77')];var _0xceab63=JSON[_0x78ed('0x76')](_0x5c64e4[_0x78ed('0x3b')][_0x416110])['$lte'];_0x4ac75c[_0x78ed('0x43')](_0x78ed('0x78'),_0x2f407f,_0xceab63);}else{if(_0x5c64e4[_0x78ed('0x3b')][_0x416110]==='null'){_0x4ac75c[_0x78ed('0x43')]('i.'+_0x416110+_0x78ed('0x79'));}else{_0x4ac75c[_0x78ed('0x43')]('i.'+_0x416110+'\x20=\x20?',_0x5c64e4[_0x78ed('0x3b')][_0x416110]);}}});}if(_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x7a')]){if(_0x5c64e4['query'][_0x78ed('0x7a')]==0x1){_0x4ac75c[_0x78ed('0x5f')]('`unreadMessages`\x20=\x200');}else{_0x4ac75c[_0x78ed('0x5f')](_0x78ed('0x7b'));}}if(_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x7c')]){_0x3c6e23=_['isArray'](_0x5c64e4['query'][_0x78ed('0x7c')])?_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x7c')]:new Array(_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x7c')]);_0x3c6e23[_0x78ed('0x2c')](function(_0x42c1f8){_0x118873['or'](_0x78ed('0x6a'),'%,'+_0x42c1f8+',%');});}if(_0x5c64e4[_0x78ed('0x3b')]['filter']){var _0x5ef909=_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x7d')][_0x78ed('0x7e')]('\x5c','\x5c\x5c')[_0x78ed('0x7e')](/'/g,'\x27\x27');if(qs[_0x78ed('0x7f')](_0x5ef909)){_0xf0a187['or'](_0x78ed('0x80'),_0x5ef909+'%')['or'](_0x78ed('0x81'),_0x5ef909+'%');}else{_0xf0a187['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x78ed('0x63')](_0x5ef909))['or'](_0x78ed('0x82'),_0x5ef909+'%');}}}_0x4ac75c[_0x78ed('0x43')](_0xf0a187);_0x4ac75c[_0x78ed('0x83')](_0x78ed('0x84'));var _0x4917fc={'type':db['Sequelize'][_0x78ed('0x85')][_0x78ed('0x86')],'raw':!![]};var _0x413d2c=_0x4ac75c[_0x78ed('0x87')]();_0x413d2c[_0x78ed('0x46')](_0x78ed('0x84'));_0x413d2c[_0x78ed('0x46')](_0x78ed('0x88'),_0x78ed('0x5c'));if(_0x234592[_0x78ed('0x41')]){_0x234592['order'][_0x78ed('0x2c')](function(_0x385c6a){var _0xb57096=_0x385c6a[0x0]==='contactName'?_0x385c6a[0x0]:'i.'+_0x385c6a[0x0];_0x4ac75c[_0x78ed('0x41')](_0xb57096,_0x385c6a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x78ed('0x73')](_0x3c6e23)){_0x4ac75c[_0x78ed('0x5f')](_0x118873);_0x413d2c[_0x78ed('0x43')](_0x78ed('0x89'),_0x3c6e23);}BPromise['resolve']()[_0x78ed('0x24')](function(){if(!_0x3eae51){if(_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x74')])return;_0x413d2c['where'](_0x78ed('0x8a'));_0x4ac75c[_0x78ed('0x43')](_0x78ed('0x8a'));return;}if(_0x5c64e4[_0x78ed('0x8b')][_0x78ed('0x8c')]!=='agent')return;return _0x5c64e4['user'][_0x78ed('0x8d')]({'attributes':['id'],'raw':!![]})[_0x78ed('0x24')](function(_0x3bfb46){if(_[_0x78ed('0x73')](_0x3bfb46)){_0x413d2c[_0x78ed('0x43')](_0x78ed('0x8e'));_0x4ac75c[_0x78ed('0x43')](_0x78ed('0x8e'));}else{_0x413d2c[_0x78ed('0x43')](_0x78ed('0x8f'),_[_0x78ed('0x37')](_0x3bfb46,'id'));_0x4ac75c[_0x78ed('0x43')](_0x78ed('0x8f'),_['map'](_0x3bfb46,'id'));}});})['then'](function(){if(_0x5c64e4[_0x78ed('0x8b')][_0x78ed('0x8c')]==='agent'&&!_0x3eae51&&!_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x74')])return[];return db[_0x78ed('0x90')][_0x78ed('0x3b')](_0x413d2c['toString'](),_0x4917fc);})[_0x78ed('0x24')](function(_0x294974){_0x560d17[_0x78ed('0x20')]=_0x294974['length'];if(_0x560d17['count']===0x0)return[];return db[_0x78ed('0x90')][_0x78ed('0x3b')](_0x1020d9[_0x78ed('0x91')](),_0x4917fc)['then'](function(_0x1415c8){_0x2a164e=_[_0x78ed('0x92')](_0x1415c8,'id');_0x4917fc=_['merge'](_0x4917fc,{'model':db[_0x78ed('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c64e4[_0x78ed('0x3b')][_0x78ed('0x3e')]){_0x234592[_0x78ed('0x3f')][_0x78ed('0x2c')](function(_0x5c3a12){_0x4ac75c['field']('i.'+_0x5c3a12);});}else{_0x4ac75c[_0x78ed('0x46')](_0x78ed('0x88'),_0x78ed('0x5c'));_0x4ac75c[_0x78ed('0x46')]('a.key','Account.key');_0x4ac75c['field'](_0x78ed('0x93'),'Account.mandatoryDisposition');_0x4ac75c[_0x78ed('0x46')](_0x78ed('0x94'),_0x78ed('0x95'));_0x4ac75c['field'](_0x78ed('0x96'));_0x4ac75c[_0x78ed('0x46')]('c.firstName',_0x78ed('0x97'));_0x4ac75c[_0x78ed('0x46')](_0x78ed('0x98'),'Contact.lastName');_0x4ac75c['field'](_0x78ed('0x99'),_0x78ed('0x9a'));_0x4ac75c[_0x78ed('0x46')](_0x78ed('0x9b'),'Contact.phone');_0x4ac75c[_0x78ed('0x46')]('c.mobile','Contact.mobile');_0x4ac75c[_0x78ed('0x46')](_0x78ed('0x9c'),_0x78ed('0x9d'));_0x4ac75c[_0x78ed('0x46')]('o.fullname',_0x78ed('0x9e'));_0x4ac75c[_0x78ed('0x46')]('o.internal','Owner.internal');_0x4ac75c['field'](_0x78ed('0x9f'),'TagIds');}if(_0x234592[_0x78ed('0x21')])_0x4ac75c[_0x78ed('0x21')](_0x234592[_0x78ed('0x21')]);if(_0x234592[_0x78ed('0x1e')])_0x4ac75c['offset'](_0x234592[_0x78ed('0x1e')]);return db['sequelize'][_0x78ed('0x3b')](_0x4ac75c[_0x78ed('0x91')](),_0x4917fc);})[_0x78ed('0x24')](function(_0x6f2981){if(_0x6f2981[_0x78ed('0x40')]>0x0)_0x1868a3['where'](_0x78ed('0xa0'),_[_0x78ed('0x37')](_0x6f2981,'id'));return db[_0x78ed('0x90')]['query'](_0x1868a3['toString'](),_0x4917fc)['then'](function(_0xd16815){var _0x1432b7=_[_0x78ed('0xa1')](_0xd16815,_0x78ed('0xa2'));var _0x72e44b=[];_0x6f2981[_0x78ed('0x2c')](function(_0x50943a){_0x72e44b[_0x78ed('0x2d')](updateWhatsappInteraction(_0x50943a,_0x2a164e,_0x1432b7));});return BPromise['all'](_0x72e44b);});});})[_0x78ed('0x24')](function(_0x3ad759){_0x560d17[_0x78ed('0xa3')]=_0x3ad759;return _0x560d17;})[_0x78ed('0x24')](respondWithFilteredResult(_0x3a6cc8,_0x234592))[_0x78ed('0x2f')](handleError(_0x3a6cc8,null));};exports[_0x78ed('0xa4')]=function(_0x19005d,_0x32277c){var _0x2e33a2={'raw':![],'where':{'id':_0x19005d[_0x78ed('0xa5')]['id']}},_0x1679b4={};_0x1679b4[_0x78ed('0x3a')]=_[_0x78ed('0xa6')](db[_0x78ed('0x38')][_0x78ed('0xa7')]);_0x1679b4['query']=_['keys'](_0x19005d[_0x78ed('0x3b')]);_0x1679b4[_0x78ed('0x3c')]=_['intersection'](_0x1679b4[_0x78ed('0x3a')],_0x1679b4[_0x78ed('0x3b')]);_0x2e33a2[_0x78ed('0x3f')]=_[_0x78ed('0x3d')](_0x1679b4['model'],qs[_0x78ed('0x3e')](_0x19005d['query'][_0x78ed('0x3e')]));_0x2e33a2[_0x78ed('0x3f')]=_0x2e33a2[_0x78ed('0x3f')][_0x78ed('0x40')]?_0x2e33a2['attributes']:_0x1679b4['model'];if(_0x19005d[_0x78ed('0x3b')]['includeAll']){_0x2e33a2[_0x78ed('0xa8')]=[{'all':!![]}];}_0x2e33a2=_[_0x78ed('0xa9')]({},_0x2e33a2,_0x19005d[_0x78ed('0xaa')]);return db[_0x78ed('0x38')][_0x78ed('0x5b')](_0x2e33a2)['then'](handleEntityNotFound(_0x32277c,null))[_0x78ed('0x24')](respondWithResult(_0x32277c,null))[_0x78ed('0x2f')](handleError(_0x32277c,null));};exports[_0x78ed('0xab')]=function(_0x55a5a0,_0x3ae65a){return db[_0x78ed('0x38')]['create'](_0x55a5a0[_0x78ed('0x70')],{})[_0x78ed('0x24')](respondWithResult(_0x3ae65a,0xc9))['catch'](handleError(_0x3ae65a,null));};exports[_0x78ed('0x23')]=function(_0x915392,_0x53c20c){if(_0x915392[_0x78ed('0x70')]['id']){delete _0x915392['body']['id'];}return db[_0x78ed('0x38')][_0x78ed('0x5b')]({'where':{'id':_0x915392['params']['id']}})[_0x78ed('0x24')](handleEntityNotFound(_0x53c20c,null))[_0x78ed('0x24')](saveUpdates(_0x915392[_0x78ed('0x70')],null))[_0x78ed('0x24')](respondWithResult(_0x53c20c,null))[_0x78ed('0x2f')](handleError(_0x53c20c,null));};exports['destroy']=function(_0x37a9a6,_0x5b7168){return db[_0x78ed('0x38')][_0x78ed('0x5b')]({'where':{'id':_0x37a9a6['params']['id']}})[_0x78ed('0x24')](handleEntityNotFound(_0x5b7168,null))[_0x78ed('0x24')](removeEntity(_0x5b7168,null))[_0x78ed('0x2f')](handleError(_0x5b7168,null));};exports[_0x78ed('0xac')]=function(_0x3c823a,_0x9b5b04){return db[_0x78ed('0x38')][_0x78ed('0xac')]()[_0x78ed('0x24')](respondWithResult(_0x9b5b04,null))[_0x78ed('0x2f')](handleError(_0x9b5b04,null));};exports[_0x78ed('0xad')]=function(_0x1ef74d,_0x45c1ee,_0x5023d9){return db[_0x78ed('0xae')][_0x78ed('0x5b')]({'where':{'id':_0x1ef74d[_0x78ed('0xa5')]['id']}})[_0x78ed('0x24')](handleEntityNotFound(_0x45c1ee,null))[_0x78ed('0x24')](function(_0x55a7ea){if(_0x55a7ea){return _0x55a7ea['addMessage'](_0x1ef74d[_0x78ed('0x70')][_0x78ed('0xaf')],_[_0x78ed('0xb0')](_0x1ef74d[_0x78ed('0x70')],[_0x78ed('0xaf'),'id'])||{});}})[_0x78ed('0x24')](respondWithResult(_0x45c1ee,null))[_0x78ed('0x2f')](handleError(_0x45c1ee,null));};exports[_0x78ed('0xb1')]=function(_0x476f97,_0x319933,_0x3ad1b9){var _0x3ec91a={'raw':![],'where':{}};var _0x2c34ca={};var _0x321703={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x78ed('0xb2')]({'where':{'id':_0x476f97[_0x78ed('0xa5')]['id']}})[_0x78ed('0x24')](handleEntityNotFound(_0x319933,null))['then'](function(_0x4c0333){if(_0x4c0333){_0x2c34ca[_0x78ed('0x3a')]=_[_0x78ed('0xa6')](db['WhatsappMessage'][_0x78ed('0xa7')]);_0x2c34ca['query']=_['keys'](_0x476f97[_0x78ed('0x3b')]);_0x2c34ca[_0x78ed('0x3c')]=_[_0x78ed('0x3d')](_0x2c34ca['model'],_0x2c34ca[_0x78ed('0x3b')]);_0x3ec91a[_0x78ed('0x3f')]=_[_0x78ed('0x3d')](_0x2c34ca[_0x78ed('0x3a')],qs[_0x78ed('0x3e')](_0x476f97[_0x78ed('0x3b')][_0x78ed('0x3e')]));_0x3ec91a[_0x78ed('0x3f')]=_0x3ec91a[_0x78ed('0x3f')]['length']?_0x3ec91a['attributes']:_0x2c34ca[_0x78ed('0x3a')];if(!_0x476f97['query'][_0x78ed('0xb3')]('nolimit')){_0x3ec91a[_0x78ed('0x21')]=qs[_0x78ed('0x21')](_0x476f97[_0x78ed('0x3b')][_0x78ed('0x21')]);_0x3ec91a[_0x78ed('0x1e')]=qs[_0x78ed('0x1e')](_0x476f97[_0x78ed('0x3b')]['offset']);}_0x3ec91a[_0x78ed('0x41')]=qs[_0x78ed('0x42')](_0x476f97[_0x78ed('0x3b')]['sort']);_0x3ec91a[_0x78ed('0x43')]=qs[_0x78ed('0x3c')](_['pick'](_0x476f97[_0x78ed('0x3b')],_0x2c34ca['filters']));_0x3ec91a[_0x78ed('0x43')]['WhatsappInteractionId']=_0x4c0333['id'];if(_0x476f97[_0x78ed('0x3b')][_0x78ed('0x7d')]){_0x3ec91a['where']=_[_0x78ed('0xa9')](_0x3ec91a['where'],{'$or':_[_0x78ed('0x37')](_0x3ec91a[_0x78ed('0x3f')],function(_0x3e9e55){var _0x57b391={};_0x57b391[_0x3e9e55]={'$like':'%'+_0x476f97[_0x78ed('0x3b')]['filter']+'%'};return _0x57b391;})});}if(_0x476f97[_0x78ed('0x3b')]['$gte']){var _0x24e818=_0x476f97['query'][_0x78ed('0x77')][_0x78ed('0x2b')](',');var _0x7facb0={};_0x7facb0[_0x24e818[0x0]]={'$gte':moment(_0x24e818[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3ec91a[_0x78ed('0x43')]=_[_0x78ed('0xa9')](_0x3ec91a[_0x78ed('0x43')],_0x7facb0);}_0x3ec91a=_['merge']({},_0x3ec91a,_0x476f97[_0x78ed('0xaa')]);return db[_0x78ed('0xae')][_0x78ed('0x20')]({'where':_0x3ec91a['where']})[_0x78ed('0x24')](function(_0x21d755){_0x321703['count']=_0x21d755;if(_0x476f97['query'][_0x78ed('0xb4')]){_0x3ec91a[_0x78ed('0xa8')]=[{'all':!![]}];}return db[_0x78ed('0xae')]['findAll'](_0x3ec91a);})[_0x78ed('0x24')](function(_0x6dd1ff){_0x321703[_0x78ed('0xa3')]=_0x6dd1ff;return _0x321703;});}})['then'](respondWithFilteredResult(_0x319933,_0x3ec91a))['catch'](handleError(_0x319933,null));};exports['addTags']=function(_0x48de74,_0x5018b2,_0x273688){return db[_0x78ed('0x38')][_0x78ed('0x5b')]({'where':{'id':_0x48de74[_0x78ed('0xa5')]['id']}})[_0x78ed('0x24')](handleEntityNotFound(_0x5018b2,null))['then'](function(_0x3efd9c){if(_0x3efd9c){return _0x3efd9c[_0x78ed('0xb5')](_0x48de74[_0x78ed('0x70')]['ids'],_[_0x78ed('0xb0')](_0x48de74['body'],[_0x78ed('0xaf'),'id'])||{})[_0x78ed('0xb6')](function(){return db[_0x78ed('0x69')][_0x78ed('0xb7')]({'attributes':['id',_0x78ed('0x27'),'color'],'where':{'id':_0x48de74[_0x78ed('0x70')][_0x78ed('0xaf')]}});})[_0x78ed('0x24')](function(_0x23f4cc){socket[_0x78ed('0xb8')](_0x78ed('0xb9'),{'id':Number(_0x48de74[_0x78ed('0xa5')]['id']),'tags':_0x23f4cc||[]});return{'id':Number(_0x48de74[_0x78ed('0xa5')]['id']),'tags':_0x23f4cc||[]};});}})['then'](respondWithResult(_0x5018b2,null))[_0x78ed('0x2f')](handleError(_0x5018b2,null));};exports['removeTags']=function(_0x3dd88d,_0x488e4b,_0x5673a2){return db['WhatsappInteraction'][_0x78ed('0x5b')]({'where':{'id':_0x3dd88d['params']['id']}})['then'](handleEntityNotFound(_0x488e4b,null))[_0x78ed('0x24')](function(_0x4fdd69){if(_0x4fdd69){return _0x4fdd69['removeTags'](_0x3dd88d[_0x78ed('0x3b')]['ids']);}})[_0x78ed('0x24')](respondWithStatusCode(_0x488e4b,null))[_0x78ed('0x2f')](handleError(_0x488e4b,null));};exports['download']=function(_0x21cc8a,_0x169e46){var _0x1e4e11=moment()[_0x78ed('0xba')]()[_0x78ed('0x91')]();var _0xc86423=path[_0x78ed('0xbb')](config['root'],_0x78ed('0xbc'),'files','tmp');var _0x17f09c=path[_0x78ed('0xbb')](config[_0x78ed('0xbd')],_0x78ed('0xbc'),_0x78ed('0xbe'),_0x78ed('0xbf'));var _0x5563d1=path[_0x78ed('0xbb')](_0xc86423,_0x1e4e11);var _0x15fd5e=util[_0x78ed('0xc0')](_0x78ed('0xc1'),_0x21cc8a[_0x78ed('0xa5')]['id'],_0x1e4e11);var _0x293d33=path['join'](_0xc86423,_0x15fd5e);var _0x39d6e0=[];_0x39d6e0[_0x78ed('0x2d')]({'model':db[_0x78ed('0x6c')],'as':_0x78ed('0x6c'),'attributes':['id',_0x78ed('0x29')],'raw':!![]});_0x39d6e0[_0x78ed('0x2d')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x78ed('0xc2')],'raw':!![]});if(_0x21cc8a[_0x78ed('0x3b')][_0x78ed('0xbf')]){_0x39d6e0[_0x78ed('0x2d')]({'model':db[_0x78ed('0xc3')],'as':_0x78ed('0xc3'),'raw':!![]});}var _0x489faf=[{'model':db[_0x78ed('0xae')],'as':'Messages','attributes':['id',_0x78ed('0x70'),_0x78ed('0xc4'),'direction','secret',_0x78ed('0x7a')],'include':_0x39d6e0}];_0x489faf[_0x78ed('0x2d')]({'model':db['WhatsappAccount'],'as':_0x78ed('0xc5'),'attributes':['id',_0x78ed('0x27')]});_0x489faf['push']({'model':db[_0x78ed('0x6c')],'as':_0x78ed('0xc6'),'attributes':['id',_0x78ed('0x29')]});return db['WhatsappInteraction'][_0x78ed('0x5b')]({'where':{'id':_0x21cc8a[_0x78ed('0xa5')]['id']},'include':_0x489faf})['then'](handleEntityNotFound(_0x169e46,null))[_0x78ed('0x24')](function(_0x14e867){if(_0x14e867){var _0x3c2069=_0x14e867[_0x78ed('0xc7')]({'plain':!![]});fs[_0x78ed('0xc8')](_0x5563d1);var _0x10b4ee={'channel':'Whatsapp','account':_0x3c2069[_0x78ed('0xc5')][_0x78ed('0x27')],'agent':_0x3c2069[_0x78ed('0xc6')]?_0x3c2069[_0x78ed('0xc6')][_0x78ed('0x29')]:'N.A.','createdAt':moment(_0x3c2069['createdAt'])[_0x78ed('0xc0')](_0x78ed('0xc9'))[_0x78ed('0x91')](),'closedAt':_0x3c2069['closed']?moment(_0x3c2069[_0x78ed('0xca')])[_0x78ed('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3c2069[_0x78ed('0xcb')],'messages':_(_0x3c2069['Messages'])[_0x78ed('0x7d')]({'secret':![]})[_0x78ed('0x37')](function(_0x68131f){if(_0x68131f[_0x78ed('0xc3')]){var _0x5a7844=path['join'](_0x17f09c,_0x68131f[_0x78ed('0xc3')][_0x78ed('0xcc')]);if(fs[_0x78ed('0xcd')](_0x5a7844)){fs[_0x78ed('0xce')](_0x5a7844)[_0x78ed('0xcf')](fs[_0x78ed('0xd0')](path['join'](_0x5563d1,_0x68131f[_0x78ed('0xc3')][_0x78ed('0xcc')])));}}return{'date':moment(_0x68131f[_0x78ed('0xc4')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x68131f[_0x78ed('0xd1')]===_0x78ed('0xd2')?_0x68131f[_0x78ed('0x6c')]?_0x68131f[_0x78ed('0x6c')]['fullname']:'System':_0x68131f['Contact'][_0x78ed('0xd3')]+(_0x68131f[_0x78ed('0xd4')][_0x78ed('0xc2')]?'\x20'+_0x68131f[_0x78ed('0xd4')][_0x78ed('0xc2')]:''),'body':_0x68131f['Attachment']?_0x68131f[_0x78ed('0xc3')][_0x78ed('0xcc')]:_0x68131f['body'],'direction':_0x68131f[_0x78ed('0xd1')]===_0x78ed('0xd2')?'A':'C','secret':_0x68131f['secret'],'read':_0x68131f[_0x78ed('0x7a')],'attachment':_0x68131f['Attachment']};})[_0x78ed('0x5d')]()};return ejs['renderFile'](path[_0x78ed('0xbb')](config[_0x78ed('0xbd')],_0x78ed('0xbc'),'views',_0x78ed('0xd5')),{'interaction':_0x10b4ee})[_0x78ed('0x24')](function(_0x3b26c1){var _0x175877=path['join'](_0x5563d1,'transcript-'+_0x3c2069['id']+'-'+_0x1e4e11+'.pdf');var _0x3207ab={'path':_0x175877,'channel':_0x78ed('0xd6'),'interactionId':_0x3c2069['id']};return pdf[_0x78ed('0xd7')](_0x3b26c1,_0x3207ab);})[_0x78ed('0x24')](function(){return new BPromise(function(_0x3f6624,_0x363444){zipdir(_0x5563d1,{'saveTo':_0x293d33},function(_0x1bd4b1,_0x323ae7){if(_0x1bd4b1)return _0x363444(_0x1bd4b1);return _0x3f6624(_0x323ae7);});})['then'](function(){return new BPromise(function(_0x246540,_0x5572b4){rimraf(_0x5563d1,function(_0x59b2e5){if(_0x59b2e5)_0x5572b4(_0x59b2e5);return _0x246540();});});})[_0x78ed('0x24')](function(){return _0x169e46[_0x78ed('0xd8')](_0x293d33,_0x15fd5e,function(_0x3081fc){if(_0x3081fc){console[_0x78ed('0xd9')]('err',_0x3081fc);}else{fs[_0x78ed('0xda')](_0x293d33);}});});});}else{return _0x169e46[_0x78ed('0x1a')](0xc8);}})['catch'](handleError(_0x169e46,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5f2e1ee..c6f93cc 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 _0x205d=['map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','then','setDataValue','Users'];(function(_0x29a132,_0x49c0cc){var _0x1443cf=function(_0x25914b){while(--_0x25914b){_0x29a132['push'](_0x29a132['shift']());}};_0x1443cf(++_0x49c0cc);}(_0x205d,0xf6));var _0xd205=function(_0x19c6a6,_0x36701d){_0x19c6a6=_0x19c6a6-0x0;var _0x29014=_0x205d[_0x19c6a6];return _0x29014;};'use strict';var EventEmitter=require(_0xd205('0x0'));var WhatsappInteraction=require(_0xd205('0x1'))['db'][_0xd205('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd205('0x3')](0x0);var events={'afterCreate':_0xd205('0x4'),'afterUpdate':_0xd205('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd8bd69){return function(_0x377a00,_0x1a0ca8,_0x45a533){_0x377a00['getUsers']({'attributes':['id'],'raw':!![]})[_0xd205('0x6')](function(_0x2b6078){_0x377a00[_0xd205('0x7')](_0xd205('0x8'),_0x2b6078[_0xd205('0x9')](function(_0xa72151){return{'id':_0xa72151['id']};}));return WhatsappMessage[_0xd205('0xa')]({'where':{'WhatsappInteractionId':_0x377a00['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd205('0x6')](function(_0x2a3567){_0x377a00['setDataValue'](_0xd205('0xb'),_0x2a3567[_0xd205('0xc')]);WhatsappInteractionEvents[_0xd205('0xd')](_0xd8bd69+':'+_0x377a00['id'],_0x377a00);WhatsappInteractionEvents[_0xd205('0xd')](_0xd8bd69,_0x377a00);_0x45a533(null);})['catch'](_0x45a533(null));};}for(var e in events){if(events[_0xd205('0xe')](e)){var event=events[e];WhatsappInteraction[_0xd205('0xf')](e,emitEvent(event));}}module[_0xd205('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x422f=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x31fef1,_0x2ea2d9){var _0x5631c5=function(_0x568114){while(--_0x568114){_0x31fef1['push'](_0x31fef1['shift']());}};_0x5631c5(++_0x2ea2d9);}(_0x422f,0x1c7));var _0xf422=function(_0x8b4de1,_0x49ad8d){_0x8b4de1=_0x8b4de1-0x0;var _0x2b57be=_0x422f[_0x8b4de1];return _0x2b57be;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xf422('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xf422('0x0'))['db'][_0xf422('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf422('0x2'),'afterUpdate':_0xf422('0x3'),'afterDestroy':_0xf422('0x4')};function emitEvent(_0x444ad5){return function(_0x16047c,_0x434f27,_0x3e3e5d){_0x16047c[_0xf422('0x5')]({'attributes':['id'],'raw':!![]})[_0xf422('0x6')](function(_0x583283){_0x16047c[_0xf422('0x7')](_0xf422('0x8'),_0x583283[_0xf422('0x9')](function(_0x23a1bf){return{'id':_0x23a1bf['id']};}));return WhatsappMessage[_0xf422('0xa')]({'where':{'WhatsappInteractionId':_0x16047c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x419ec4){_0x16047c['setDataValue']('unreadMessages',_0x419ec4[_0xf422('0xb')]);WhatsappInteractionEvents[_0xf422('0xc')](_0x444ad5+':'+_0x16047c['id'],_0x16047c);WhatsappInteractionEvents[_0xf422('0xc')](_0x444ad5,_0x16047c);_0x3e3e5d(null);})[_0xf422('0xd')](_0x3e3e5d(null));};}for(var e in events){if(events[_0xf422('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf422('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 58b4be2..d2a6008 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 _0x8469=['define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x207983,_0x1b7740){var _0x425f15=function(_0x25decc){while(--_0x25decc){_0x207983['push'](_0x207983['shift']());}};_0x425f15(++_0x1b7740);}(_0x8469,0xd9));var _0x9846=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x8469[_0x4629ed];return _0x52ca04;};'use strict';var _=require('lodash');var util=require(_0x9846('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9846('0x1'));var BPromise=require(_0x9846('0x2'));var rp=require(_0x9846('0x3'));var fs=require('fs');var path=require(_0x9846('0x4'));var rimraf=require(_0x9846('0x5'));var config=require(_0x9846('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x9846('0x7')]=function(_0x38e089,_0x5c4557){return _0x38e089[_0x9846('0x8')](_0x9846('0x9'),attributes,{'tableName':_0x9846('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43df5f,_0x464283,_0x291372){if(_0x43df5f['changed'](_0x9846('0xb'))){_0x43df5f[_0x9846('0xc')]=moment()[_0x9846('0xd')](_0x9846('0xe'));}_0x291372(null,_0x43df5f);}}});}; \ No newline at end of file +var _0x4dee=['bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x5064fd,_0x72b1d7){var _0x19b122=function(_0x30b26a){while(--_0x30b26a){_0x5064fd['push'](_0x5064fd['shift']());}};_0x19b122(++_0x72b1d7);}(_0x4dee,0x172));var _0xe4de=function(_0xd80047,_0x57a826){_0xd80047=_0xd80047-0x0;var _0x1b29ca=_0x4dee[_0xd80047];return _0x1b29ca;};'use strict';var _=require(_0xe4de('0x0'));var util=require(_0xe4de('0x1'));var logger=require(_0xe4de('0x2'))(_0xe4de('0x3'));var moment=require(_0xe4de('0x4'));var BPromise=require(_0xe4de('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4de('0x6'));var rimraf=require(_0xe4de('0x7'));var config=require(_0xe4de('0x8'));var attributes=require(_0xe4de('0x9'));module['exports']=function(_0x2b3bc7,_0x7bc566){return _0x2b3bc7[_0xe4de('0xa')](_0xe4de('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x118616,_0x5d8833,_0x568579){if(_0x118616['changed']('closed')){_0x118616[_0xe4de('0xc')]=moment()[_0xe4de('0xd')](_0xe4de('0xe'));}_0x568579(null,_0x118616);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 94cdb78..3d51415 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 _0xa683=['socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','localhost'];(function(_0x5f2128,_0xc4bb1a){var _0x29af2c=function(_0x376bb1){while(--_0x376bb1){_0x5f2128['push'](_0x5f2128['shift']());}};_0x29af2c(++_0xc4bb1a);}(_0xa683,0x1c2));var _0x3a68=function(_0xaf0852,_0x28cc93){_0xaf0852=_0xaf0852-0x0;var _0x554817=_0xa683[_0xaf0852];return _0x554817;};'use strict';var _=require(_0x3a68('0x0'));var util=require(_0x3a68('0x1'));var moment=require(_0x3a68('0x2'));var BPromise=require(_0x3a68('0x3'));var rs=require(_0x3a68('0x4'));var fs=require('fs');var Redis=require(_0x3a68('0x5'));var db=require(_0x3a68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a68('0x7'))('rpc');var config=require(_0x3a68('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a68('0x9')]({'port':0x232a});config[_0x3a68('0xa')]=_['defaults'](config[_0x3a68('0xa')],{'host':_0x3a68('0xb'),'port':0x18eb});var socket=require(_0x3a68('0xc'))(new Redis(config[_0x3a68('0xa')]));require(_0x3a68('0xd'))[_0x3a68('0xe')](socket);function respondWithRpcPromise(_0x3e9d91,_0x268fef,_0x34f7c9){return new BPromise(function(_0x3bdd2b,_0x3fe60d){return client[_0x3a68('0xf')](_0x3e9d91,_0x34f7c9)[_0x3a68('0x10')](function(_0x4a6c53){logger[_0x3a68('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x268fef,_0x3a68('0x12'));logger[_0x3a68('0x13')](_0x3a68('0x14'),_0x268fef,_0x3a68('0x12'),JSON[_0x3a68('0x15')](_0x4a6c53));if(_0x4a6c53[_0x3a68('0x16')]){if(_0x4a6c53[_0x3a68('0x16')][_0x3a68('0x17')]===0x1f4){logger[_0x3a68('0x16')](_0x3a68('0x18'),_0x268fef,_0x4a6c53[_0x3a68('0x16')][_0x3a68('0x19')]);return _0x3fe60d(_0x4a6c53[_0x3a68('0x16')]['message']);}logger[_0x3a68('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x268fef,_0x4a6c53[_0x3a68('0x16')][_0x3a68('0x19')]);return _0x3bdd2b(_0x4a6c53[_0x3a68('0x16')][_0x3a68('0x19')]);}else{logger[_0x3a68('0x11')](_0x3a68('0x18'),_0x268fef,_0x3a68('0x12'));_0x3bdd2b(_0x4a6c53[_0x3a68('0x1a')][_0x3a68('0x19')]);}})[_0x3a68('0x1b')](function(_0x186e3e){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x268fef,_0x186e3e);_0x3fe60d(_0x186e3e);});});}exports[_0x3a68('0x1c')]=function(_0x30e605){var _0x4b44fc=this;return new Promise(function(_0x42a446,_0xaad126){return db[_0x3a68('0x1d')][_0x3a68('0x1e')](_0x30e605[_0x3a68('0x1f')],{'raw':_0x30e605[_0x3a68('0x20')]?_0x30e605['options'][_0x3a68('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e605['options']?_0x30e605[_0x3a68('0x20')][_0x3a68('0x22')]||null:null,'attributes':_0x30e605['options']?_0x30e605[_0x3a68('0x20')][_0x3a68('0x23')]||null:null,'limit':_0x30e605['options']?_0x30e605['options']['limit']||null:null})[_0x3a68('0x10')](function(_0x200c87){logger[_0x3a68('0x11')]('UpdateWhatsappInteraction',_0x30e605);logger[_0x3a68('0x13')](_0x3a68('0x1c'),_0x30e605,JSON[_0x3a68('0x15')](_0x200c87));_0x42a446(_0x200c87);})['catch'](function(_0x24ad49){logger[_0x3a68('0x16')]('UpdateWhatsappInteraction',_0x24ad49[_0x3a68('0x19')],_0x30e605);_0xaad126(_0x4b44fc[_0x3a68('0x16')](0x1f4,_0x24ad49['message']));});});};exports[_0x3a68('0x24')]=function(_0x1757c1){return new Promise(function(_0xbb6664,_0x395ee3){return db['WhatsappInteraction'][_0x3a68('0x25')]({'where':_0x1757c1[_0x3a68('0x20')]?_0x1757c1['options']['where']||null:null})[_0x3a68('0x10')](function(_0x5d205d){if(_0x5d205d){return _0x5d205d[_0x3a68('0x26')](_0x1757c1['body'][_0x3a68('0x27')],_['omit'](_0x1757c1[_0x3a68('0x1f')],['ids','id'])||{});}})[_0x3a68('0x28')](function(_0x938426){logger['info'](_0x3a68('0x29'),_0x1757c1);logger[_0x3a68('0x13')]('AddTags',_0x1757c1,JSON[_0x3a68('0x15')](_0x938426));_0xbb6664(_0x938426);})[_0x3a68('0x1b')](function(_0x119426){logger['error'](_0x3a68('0x29'),_0x119426[_0x3a68('0x19')],_0x1757c1);_0x395ee3(_this[_0x3a68('0x16')](0x1f4,_0x119426[_0x3a68('0x19')]));});});}; \ No newline at end of file +var _0x89b0=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x51bc59,_0x4641e0){var _0x364817=function(_0x45ab7e){while(--_0x45ab7e){_0x51bc59['push'](_0x51bc59['shift']());}};_0x364817(++_0x4641e0);}(_0x89b0,0x1a5));var _0x089b=function(_0xedb516,_0xce5357){_0xedb516=_0xedb516-0x0;var _0x324482=_0x89b0[_0xedb516];return _0x324482;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x089b('0x0'));var BPromise=require(_0x089b('0x1'));var rs=require(_0x089b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x089b('0x3'))('rpc');var config=require(_0x089b('0x4'));var jayson=require(_0x089b('0x5'));var client=jayson[_0x089b('0x6')][_0x089b('0x7')]({'port':0x232a});config[_0x089b('0x8')]=_[_0x089b('0x9')](config[_0x089b('0x8')],{'host':_0x089b('0xa'),'port':0x18eb});var socket=require(_0x089b('0xb'))(new Redis(config[_0x089b('0x8')]));require('./whatsappInteraction.socket')[_0x089b('0xc')](socket);function respondWithRpcPromise(_0x244260,_0x4ba92c,_0x4fc98d){return new BPromise(function(_0x14075e,_0x4e95d4){return client[_0x089b('0xd')](_0x244260,_0x4fc98d)[_0x089b('0xe')](function(_0x3d18fc){logger[_0x089b('0xf')](_0x089b('0x10'),_0x4ba92c,_0x089b('0x11'));logger['debug'](_0x089b('0x12'),_0x4ba92c,_0x089b('0x11'),JSON[_0x089b('0x13')](_0x3d18fc));if(_0x3d18fc[_0x089b('0x14')]){if(_0x3d18fc[_0x089b('0x14')][_0x089b('0x15')]===0x1f4){logger[_0x089b('0x14')](_0x089b('0x10'),_0x4ba92c,_0x3d18fc[_0x089b('0x14')]['message']);return _0x4e95d4(_0x3d18fc[_0x089b('0x14')][_0x089b('0x16')]);}logger[_0x089b('0x14')](_0x089b('0x10'),_0x4ba92c,_0x3d18fc[_0x089b('0x14')][_0x089b('0x16')]);return _0x14075e(_0x3d18fc[_0x089b('0x14')][_0x089b('0x16')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4ba92c,_0x089b('0x11'));_0x14075e(_0x3d18fc['result'][_0x089b('0x16')]);}})[_0x089b('0x17')](function(_0x3d535c){logger[_0x089b('0x14')](_0x089b('0x10'),_0x4ba92c,_0x3d535c);_0x4e95d4(_0x3d535c);});});}exports[_0x089b('0x18')]=function(_0xf75b48){var _0x28746a=this;return new Promise(function(_0x539f2e,_0xb7b086){return db[_0x089b('0x19')]['update'](_0xf75b48[_0x089b('0x1a')],{'raw':_0xf75b48['options']?_0xf75b48[_0x089b('0x1b')][_0x089b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf75b48[_0x089b('0x1b')]?_0xf75b48[_0x089b('0x1b')][_0x089b('0x1d')]||null:null,'attributes':_0xf75b48['options']?_0xf75b48[_0x089b('0x1b')][_0x089b('0x1e')]||null:null,'limit':_0xf75b48['options']?_0xf75b48['options'][_0x089b('0x1f')]||null:null})['then'](function(_0x3d8392){logger[_0x089b('0xf')]('UpdateWhatsappInteraction',_0xf75b48);logger[_0x089b('0x20')]('UpdateWhatsappInteraction',_0xf75b48,JSON['stringify'](_0x3d8392));_0x539f2e(_0x3d8392);})[_0x089b('0x17')](function(_0x454d5c){logger[_0x089b('0x14')](_0x089b('0x18'),_0x454d5c[_0x089b('0x16')],_0xf75b48);_0xb7b086(_0x28746a[_0x089b('0x14')](0x1f4,_0x454d5c[_0x089b('0x16')]));});});};exports[_0x089b('0x21')]=function(_0x5a94ab){return new Promise(function(_0x5c3869,_0x49a7f5){return db[_0x089b('0x19')]['find']({'where':_0x5a94ab[_0x089b('0x1b')]?_0x5a94ab[_0x089b('0x1b')][_0x089b('0x1d')]||null:null})[_0x089b('0xe')](function(_0x5a5438){if(_0x5a5438){return _0x5a5438[_0x089b('0x22')](_0x5a94ab['body'][_0x089b('0x23')],_[_0x089b('0x24')](_0x5a94ab[_0x089b('0x1a')],['ids','id'])||{});}})[_0x089b('0x25')](function(_0x7bab2b){logger[_0x089b('0xf')](_0x089b('0x26'),_0x5a94ab);logger[_0x089b('0x20')](_0x089b('0x26'),_0x5a94ab,JSON['stringify'](_0x7bab2b));_0x5c3869(_0x7bab2b);})[_0x089b('0x17')](function(_0x3dc47d){logger[_0x089b('0x14')]('AddTags',_0x3dc47d[_0x089b('0x16')],_0x5a94ab);_0x49a7f5(_this['error'](0x1f4,_0x3dc47d[_0x089b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6885283..423e353 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 _0xcaf3=['removeListener','register','length','whatsappInteraction:','remove','update','emit'];(function(_0x510ee9,_0x894344){var _0x5bf64f=function(_0x19b423){while(--_0x19b423){_0x510ee9['push'](_0x510ee9['shift']());}};_0x5bf64f(++_0x894344);}(_0xcaf3,0xc1));var _0x3caf=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0xcaf3[_0x2afb44];return _0x15ccc2;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x3caf('0x0'),_0x3caf('0x1')];function createListener(_0x4011df,_0x1fa20f){return function(_0x1c0ca6){_0x1fa20f[_0x3caf('0x2')](_0x4011df,_0x1c0ca6);};}function removeListener(_0x264072,_0x4d3607){return function(){WhatsappInteractionEvents[_0x3caf('0x3')](_0x264072,_0x4d3607);};}exports[_0x3caf('0x4')]=function(_0x5e1b7e){for(var _0x4f7309=0x0,_0x190041=events[_0x3caf('0x5')];_0x4f7309<_0x190041;_0x4f7309++){var _0x37bdb0=events[_0x4f7309];var _0x311a5d=createListener(_0x3caf('0x6')+_0x37bdb0,_0x5e1b7e);WhatsappInteractionEvents['on'](_0x37bdb0,_0x311a5d);}}; \ No newline at end of file +var _0x3ba2=['./whatsappInteraction.events','save','remove','emit','removeListener','whatsappInteraction:'];(function(_0x174b87,_0x536e83){var _0x9d0dc=function(_0x432482){while(--_0x432482){_0x174b87['push'](_0x174b87['shift']());}};_0x9d0dc(++_0x536e83);}(_0x3ba2,0x1a4));var _0x23ba=function(_0x3bf7bd,_0x277151){_0x3bf7bd=_0x3bf7bd-0x0;var _0x1a8c43=_0x3ba2[_0x3bf7bd];return _0x1a8c43;};'use strict';var WhatsappInteractionEvents=require(_0x23ba('0x0'));var events=[_0x23ba('0x1'),_0x23ba('0x2'),'update'];function createListener(_0x53051f,_0x5eba4c){return function(_0x24291f){_0x5eba4c[_0x23ba('0x3')](_0x53051f,_0x24291f);};}function removeListener(_0x48d4ce,_0x4339fe){return function(){WhatsappInteractionEvents[_0x23ba('0x4')](_0x48d4ce,_0x4339fe);};}exports['register']=function(_0x8aafad){for(var _0x215f50=0x0,_0x3b9bba=events['length'];_0x215f50<_0x3b9bba;_0x215f50++){var _0x2ea013=events[_0x215f50];var _0x55f97c=createListener(_0x23ba('0x5')+_0x2ea013,_0x8aafad);WhatsappInteractionEvents['on'](_0x2ea013,_0x55f97c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5bceb58..ff6f0cd 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 _0xefed=['/:id/reject','reject','delete','exports','util','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','put','accept'];(function(_0x332695,_0x197633){var _0x13590a=function(_0x1ab3fc){while(--_0x1ab3fc){_0x332695['push'](_0x332695['shift']());}};_0x13590a(++_0x197633);}(_0xefed,0x88));var _0xdefe=function(_0x561049,_0x330926){_0x561049=_0x561049-0x0;var _0x52f109=_0xefed[_0x561049];return _0x52f109;};'use strict';var multer=require('multer');var util=require(_0xdefe('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdefe('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdefe('0x2'));var config=require(_0xdefe('0x3'));var controller=require('./whatsappMessage.controller');router[_0xdefe('0x4')]('/',auth[_0xdefe('0x5')](),controller[_0xdefe('0x6')]);router[_0xdefe('0x4')]('/describe',auth[_0xdefe('0x5')](),controller[_0xdefe('0x7')]);router[_0xdefe('0x4')](_0xdefe('0x8'),auth[_0xdefe('0x5')](),controller[_0xdefe('0x9')]);router[_0xdefe('0xa')]('/',auth[_0xdefe('0x5')](),interaction[_0xdefe('0xb')]('whatsapp',_0xdefe('0xc')),controller[_0xdefe('0xd')]);router['post'](_0xdefe('0xe'),controller[_0xdefe('0xf')]);router[_0xdefe('0x10')](_0xdefe('0x8'),auth[_0xdefe('0x5')](),controller['update']);router[_0xdefe('0x10')]('/:id/accept',auth[_0xdefe('0x5')](),controller[_0xdefe('0x11')]);router[_0xdefe('0x10')](_0xdefe('0x12'),auth[_0xdefe('0x5')](),controller[_0xdefe('0x13')]);router[_0xdefe('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdefe('0x15')]=router; \ No newline at end of file +var _0x93fe=['show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x178bb8,_0x5d8ed2){var _0x36a39d=function(_0x476860){while(--_0x476860){_0x178bb8['push'](_0x178bb8['shift']());}};_0x36a39d(++_0x5d8ed2);}(_0x93fe,0xfe));var _0xe93f=function(_0x4e8dd3,_0x4fb26a){_0x4e8dd3=_0x4e8dd3-0x0;var _0x3680ba=_0x93fe[_0x4e8dd3];return _0x3680ba;};'use strict';var multer=require(_0xe93f('0x0'));var util=require(_0xe93f('0x1'));var path=require(_0xe93f('0x2'));var timeout=require(_0xe93f('0x3'));var express=require(_0xe93f('0x4'));var router=express[_0xe93f('0x5')]();var fs_extra=require(_0xe93f('0x6'));var auth=require(_0xe93f('0x7'));var interaction=require(_0xe93f('0x8'));var config=require('../../config/environment');var controller=require(_0xe93f('0x9'));router[_0xe93f('0xa')]('/',auth[_0xe93f('0xb')](),controller[_0xe93f('0xc')]);router['get'](_0xe93f('0xd'),auth[_0xe93f('0xb')](),controller[_0xe93f('0xe')]);router['get'](_0xe93f('0xf'),auth['isAuthenticated'](),controller[_0xe93f('0x10')]);router[_0xe93f('0x11')]('/',auth[_0xe93f('0xb')](),interaction[_0xe93f('0x12')](_0xe93f('0x13'),_0xe93f('0x14')),controller[_0xe93f('0x15')]);router['post'](_0xe93f('0x16'),controller['status']);router[_0xe93f('0x17')](_0xe93f('0xf'),auth[_0xe93f('0xb')](),controller[_0xe93f('0x18')]);router[_0xe93f('0x17')](_0xe93f('0x19'),auth['isAuthenticated'](),controller[_0xe93f('0x1a')]);router[_0xe93f('0x17')]('/:id/reject',auth['isAuthenticated'](),controller[_0xe93f('0x1b')]);router[_0xe93f('0x1c')](_0xe93f('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xe93f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 003e544..bb2bdd6 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 _0xff7b=['TEXT','sequelize','exports','medium','BOOLEAN','out','STRING'];(function(_0x10ec0f,_0x5ece09){var _0x1587ee=function(_0x54ac17){while(--_0x54ac17){_0x10ec0f['push'](_0x10ec0f['shift']());}};_0x1587ee(++_0x5ece09);}(_0xff7b,0xe8));var _0xbff7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xff7b[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xbff7('0x0'));module[_0xbff7('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbff7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbff7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbff7('0x4')),'defaultValue':_0xbff7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbff7('0x5')]},'providerResponse':{'type':Sequelize[_0xbff7('0x6')]}}; \ No newline at end of file +var _0x45b3=['TEXT','medium','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x1a794d,_0xbd9a41){var _0x1b3887=function(_0x2133f5){while(--_0x2133f5){_0x1a794d['push'](_0x1a794d['shift']());}};_0x1b3887(++_0xbd9a41);}(_0x45b3,0x179));var _0x345b=function(_0x54b982,_0x18e213){_0x54b982=_0x54b982-0x0;var _0x400b0e=_0x45b3[_0x54b982];return _0x400b0e;};'use strict';var Sequelize=require('sequelize');module[_0x345b('0x0')]={'body':{'type':Sequelize[_0x345b('0x1')](_0x345b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x345b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x345b('0x4')]('in',_0x345b('0x5')),'defaultValue':_0x345b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x345b('0x6')](0xbe)},'phone':{'type':Sequelize[_0x345b('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x345b('0x6')]},'providerResponse':{'type':Sequelize[_0x345b('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 68acade..1c3fc92 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 _0x3c1f=['register','jayson/promise','client','http','then','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappMessage','findAll','rows','show','params','length','find','create','body','describe','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','fullname','email','internal','interface','channel','motionChannel','event','EventManager','whatsapp-interactions','reject','RejectMessage','QueryTypes','SELECT','contact','SIP/%s','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x91ec40,_0xa1ec3b){var _0x428c7a=function(_0x196f25){while(--_0x196f25){_0x91ec40['push'](_0x91ec40['shift']());}};_0x428c7a(++_0xa1ec3b);}(_0x3c1f,0x18a));var _0xf3c1=function(_0x43d96e,_0x1d9697){_0x43d96e=_0x43d96e-0x0;var _0x46a894=_0x3c1f[_0x43d96e];return _0x46a894;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3c1('0x0'));var zipdir=require(_0xf3c1('0x1'));var jsonpatch=require(_0xf3c1('0x2'));var rp=require(_0xf3c1('0x3'));var moment=require(_0xf3c1('0x4'));var BPromise=require(_0xf3c1('0x5'));var Mustache=require(_0xf3c1('0x6'));var util=require(_0xf3c1('0x7'));var path=require(_0xf3c1('0x8'));var sox=require(_0xf3c1('0x9'));var csv=require(_0xf3c1('0xa'));var ejs=require(_0xf3c1('0xb'));var fs=require('fs');var fs_extra=require(_0xf3c1('0xc'));var _=require(_0xf3c1('0xd'));var squel=require(_0xf3c1('0xe'));var crypto=require(_0xf3c1('0xf'));var jsforce=require(_0xf3c1('0x10'));var deskjs=require(_0xf3c1('0x11'));var toCsv=require(_0xf3c1('0xa'));var querystring=require('querystring');var Papa=require(_0xf3c1('0x12'));var Redis=require(_0xf3c1('0x13'));var authService=require(_0xf3c1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf3c1('0x15'));var hardwareService=require(_0xf3c1('0x16'));var logger=require(_0xf3c1('0x17'))(_0xf3c1('0x18'));var utils=require('../../config/utils');var config=require(_0xf3c1('0x19'));var licenseUtil=require(_0xf3c1('0x1a'));var db=require(_0xf3c1('0x1b'))['db'];config[_0xf3c1('0x1c')]=_[_0xf3c1('0x1d')](config['redis'],{'host':_0xf3c1('0x1e'),'port':0x18eb});var socket=require(_0xf3c1('0x1f'))(new Redis(config[_0xf3c1('0x1c')]));require('./whatsappMessage.socket')[_0xf3c1('0x20')](socket);var jayson=require(_0xf3c1('0x21'));var client=jayson[_0xf3c1('0x22')][_0xf3c1('0x23')]({'port':0x232c});var client9002=jayson[_0xf3c1('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f446a,_0x4f9108,_0x4b373b,_0x22c5f7){return new BPromise(function(_0x45fc54,_0xba2c20){var _0x3aac47=_0x22c5f7||client;return _0x3aac47['request'](_0x4f446a,_0x4b373b)[_0xf3c1('0x24')](function(_0x3efc77){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4f9108,_0xf3c1('0x25'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4f9108,_0xf3c1('0x25'),JSON[_0xf3c1('0x26')](_0x3efc77));if(_0x3efc77[_0xf3c1('0x27')]){if(_0x3efc77[_0xf3c1('0x27')][_0xf3c1('0x28')]===0x1f4){logger[_0xf3c1('0x27')](_0xf3c1('0x29'),_0x4f9108,_0x3efc77[_0xf3c1('0x27')][_0xf3c1('0x2a')]);return _0xba2c20(_0x3efc77['error']['message']);}logger[_0xf3c1('0x27')](_0xf3c1('0x29'),_0x4f9108,_0x3efc77['error']['message']);return _0x45fc54(_0x3efc77[_0xf3c1('0x27')][_0xf3c1('0x2a')]);}else{logger[_0xf3c1('0x2b')](_0xf3c1('0x29'),_0x4f9108,_0xf3c1('0x25'));_0x45fc54(_0x3efc77[_0xf3c1('0x2c')][_0xf3c1('0x2a')]);}})[_0xf3c1('0x2d')](function(_0x97039){logger[_0xf3c1('0x27')](_0xf3c1('0x29'),_0x4f9108,_0x97039);_0xba2c20(_0x97039);});});}function respondWithStatusCode(_0xbc9d7f,_0x3ca609){_0x3ca609=_0x3ca609||0xcc;return function(_0x558444){if(_0x558444){return _0xbc9d7f[_0xf3c1('0x2e')](_0x3ca609);}return _0xbc9d7f[_0xf3c1('0x2f')](_0x3ca609)['end']();};}function respondWithResult(_0x1281ff,_0x5821ac){_0x5821ac=_0x5821ac||0xc8;return function(_0x1d0bed){if(_0x1d0bed){return _0x1281ff[_0xf3c1('0x2f')](_0x5821ac)[_0xf3c1('0x30')](_0x1d0bed);}};}function respondWithFilteredResult(_0x4f2135,_0x30aaab){return function(_0x4b1339){if(_0x4b1339){var _0x1dd955=typeof _0x30aaab[_0xf3c1('0x31')]===_0xf3c1('0x32')&&typeof _0x30aaab[_0xf3c1('0x33')]===_0xf3c1('0x32');var _0x5eca16=_0x4b1339[_0xf3c1('0x34')];var _0x40054e=_0x1dd955?0x0:_0x30aaab[_0xf3c1('0x31')];var _0x531443=_0x1dd955?_0x4b1339[_0xf3c1('0x34')]:_0x30aaab[_0xf3c1('0x31')]+_0x30aaab[_0xf3c1('0x33')];var _0x20e0da;if(_0x531443>=_0x5eca16){_0x531443=_0x5eca16;_0x20e0da=0xc8;}else{_0x20e0da=0xce;}_0x4f2135['status'](_0x20e0da);return _0x4f2135[_0xf3c1('0x35')](_0xf3c1('0x36'),_0x40054e+'-'+_0x531443+'/'+_0x5eca16)[_0xf3c1('0x30')](_0x4b1339);}return null;};}function patchUpdates(_0x759369){return function(_0x62c7c3){try{jsonpatch[_0xf3c1('0x37')](_0x62c7c3,_0x759369,!![]);}catch(_0x465978){return BPromise['reject'](_0x465978);}return _0x62c7c3[_0xf3c1('0x38')]();};}function saveUpdates(_0xc7d751,_0x27b4ae){return function(_0x5ac254){if(_0x5ac254){return _0x5ac254[_0xf3c1('0x39')](_0xc7d751)[_0xf3c1('0x24')](function(_0x507de0){return _0x507de0;});}return null;};}function removeEntity(_0x3ce0f7,_0x6b0260){return function(_0x3d3453){if(_0x3d3453){return _0x3d3453[_0xf3c1('0x3a')]()[_0xf3c1('0x24')](function(){_0x3ce0f7[_0xf3c1('0x2f')](0xcc)[_0xf3c1('0x3b')]();});}};}function handleEntityNotFound(_0x23c64c,_0x1a49fd){return function(_0x4eba61){if(!_0x4eba61){_0x23c64c['sendStatus'](0x194);}return _0x4eba61;};}function handleError(_0x19bc26,_0x2477b1){_0x2477b1=_0x2477b1||0x1f4;return function(_0x12507c){logger['error'](_0x12507c[_0xf3c1('0x3c')]);if(_0x12507c[_0xf3c1('0x3d')]){delete _0x12507c[_0xf3c1('0x3d')];}_0x19bc26['status'](_0x2477b1)['send'](_0x12507c);};}exports[_0xf3c1('0x3e')]=function(_0x36fcc6,_0x3b3a0a){var _0x567683={},_0x4e2d7e={},_0x3861fd={'count':0x0,'rows':[]};var _0x3f38f1=_[_0xf3c1('0x3f')](db['WhatsappMessage'][_0xf3c1('0x40')],function(_0x2ad13c){return{'name':_0x2ad13c[_0xf3c1('0x41')],'type':_0x2ad13c[_0xf3c1('0x42')][_0xf3c1('0x43')]};});_0x4e2d7e['model']=_[_0xf3c1('0x3f')](_0x3f38f1,'name');_0x4e2d7e['query']=_[_0xf3c1('0x44')](_0x36fcc6[_0xf3c1('0x45')]);_0x4e2d7e[_0xf3c1('0x46')]=_[_0xf3c1('0x47')](_0x4e2d7e[_0xf3c1('0x48')],_0x4e2d7e[_0xf3c1('0x45')]);_0x567683[_0xf3c1('0x49')]=_[_0xf3c1('0x47')](_0x4e2d7e[_0xf3c1('0x48')],qs[_0xf3c1('0x4a')](_0x36fcc6['query']['fields']));_0x567683[_0xf3c1('0x49')]=_0x567683[_0xf3c1('0x49')]['length']?_0x567683[_0xf3c1('0x49')]:_0x4e2d7e[_0xf3c1('0x48')];if(!_0x36fcc6[_0xf3c1('0x45')]['hasOwnProperty'](_0xf3c1('0x4b'))){_0x567683[_0xf3c1('0x33')]=qs[_0xf3c1('0x33')](_0x36fcc6[_0xf3c1('0x45')]['limit']);_0x567683[_0xf3c1('0x31')]=qs['offset'](_0x36fcc6[_0xf3c1('0x45')]['offset']);}_0x567683[_0xf3c1('0x4c')]=qs[_0xf3c1('0x4d')](_0x36fcc6[_0xf3c1('0x45')]['sort']);_0x567683[_0xf3c1('0x4e')]=qs['filters'](_[_0xf3c1('0x4f')](_0x36fcc6[_0xf3c1('0x45')],_0x4e2d7e['filters']),_0x3f38f1);if(_0x36fcc6[_0xf3c1('0x45')][_0xf3c1('0x50')]){_0x567683['where']=_[_0xf3c1('0x51')](_0x567683['where'],{'$or':_['map'](_0x3f38f1,function(_0x1495ad){if(_0x1495ad[_0xf3c1('0x42')]!==_0xf3c1('0x52')){var _0x3ae5c6={};_0x3ae5c6[_0x1495ad[_0xf3c1('0x3d')]]={'$like':'%'+_0x36fcc6[_0xf3c1('0x45')]['filter']+'%'};return _0x3ae5c6;}})});}_0x567683=_[_0xf3c1('0x51')]({},_0x567683,_0x36fcc6[_0xf3c1('0x53')]);var _0x4c444d={'where':_0x567683[_0xf3c1('0x4e')]};return db['WhatsappMessage']['count'](_0x4c444d)[_0xf3c1('0x24')](function(_0x18cc55){_0x3861fd[_0xf3c1('0x34')]=_0x18cc55;if(_0x36fcc6[_0xf3c1('0x45')][_0xf3c1('0x54')]){_0x567683[_0xf3c1('0x55')]=[{'all':!![]}];}return db[_0xf3c1('0x56')][_0xf3c1('0x57')](_0x567683);})[_0xf3c1('0x24')](function(_0x2c9c97){_0x3861fd[_0xf3c1('0x58')]=_0x2c9c97;return _0x3861fd;})[_0xf3c1('0x24')](respondWithFilteredResult(_0x3b3a0a,_0x567683))[_0xf3c1('0x2d')](handleError(_0x3b3a0a,null));};exports[_0xf3c1('0x59')]=function(_0x18dfd6,_0x5f410d){var _0x345b55={'raw':!![],'where':{'id':_0x18dfd6[_0xf3c1('0x5a')]['id']}},_0x3b35e6={};_0x3b35e6[_0xf3c1('0x48')]=_[_0xf3c1('0x44')](db[_0xf3c1('0x56')][_0xf3c1('0x40')]);_0x3b35e6['query']=_[_0xf3c1('0x44')](_0x18dfd6[_0xf3c1('0x45')]);_0x3b35e6[_0xf3c1('0x46')]=_['intersection'](_0x3b35e6[_0xf3c1('0x48')],_0x3b35e6[_0xf3c1('0x45')]);_0x345b55[_0xf3c1('0x49')]=_[_0xf3c1('0x47')](_0x3b35e6[_0xf3c1('0x48')],qs[_0xf3c1('0x4a')](_0x18dfd6[_0xf3c1('0x45')][_0xf3c1('0x4a')]));_0x345b55['attributes']=_0x345b55[_0xf3c1('0x49')][_0xf3c1('0x5b')]?_0x345b55['attributes']:_0x3b35e6[_0xf3c1('0x48')];if(_0x18dfd6['query'][_0xf3c1('0x54')]){_0x345b55[_0xf3c1('0x55')]=[{'all':!![]}];}_0x345b55=_[_0xf3c1('0x51')]({},_0x345b55,_0x18dfd6[_0xf3c1('0x53')]);return db['WhatsappMessage'][_0xf3c1('0x5c')](_0x345b55)[_0xf3c1('0x24')](handleEntityNotFound(_0x5f410d,null))[_0xf3c1('0x24')](respondWithResult(_0x5f410d,null))['catch'](handleError(_0x5f410d,null));};exports[_0xf3c1('0x5d')]=function(_0x2355ef,_0x24f87e){return db[_0xf3c1('0x56')][_0xf3c1('0x5d')](_0x2355ef[_0xf3c1('0x5e')],{})['then'](respondWithResult(_0x24f87e,0xc9))['catch'](handleError(_0x24f87e,null));};exports[_0xf3c1('0x39')]=function(_0x3339f6,_0x479ab9){if(_0x3339f6[_0xf3c1('0x5e')]['id']){delete _0x3339f6['body']['id'];}return db[_0xf3c1('0x56')][_0xf3c1('0x5c')]({'where':{'id':_0x3339f6['params']['id']}})[_0xf3c1('0x24')](handleEntityNotFound(_0x479ab9,null))['then'](saveUpdates(_0x3339f6[_0xf3c1('0x5e')],null))[_0xf3c1('0x24')](respondWithResult(_0x479ab9,null))[_0xf3c1('0x2d')](handleError(_0x479ab9,null));};exports[_0xf3c1('0x3a')]=function(_0xcbadc1,_0x39d34f){return db[_0xf3c1('0x56')][_0xf3c1('0x5c')]({'where':{'id':_0xcbadc1[_0xf3c1('0x5a')]['id']}})[_0xf3c1('0x24')](handleEntityNotFound(_0x39d34f,null))[_0xf3c1('0x24')](removeEntity(_0x39d34f,null))[_0xf3c1('0x2d')](handleError(_0x39d34f,null));};exports[_0xf3c1('0x5f')]=function(_0x596af1,_0x211cee){return db['WhatsappMessage'][_0xf3c1('0x5f')]()[_0xf3c1('0x24')](respondWithResult(_0x211cee,null))['catch'](handleError(_0x211cee,null));};var interaction_log=require(_0xf3c1('0x17'))('whatsapp-interactions');exports[_0xf3c1('0x60')]=function(_0x3ceeab,_0x383fd0,_0x24ec1d){var _0x34506c={'agent':{},'channel':_0xf3c1('0x61')};if(_0x3ceeab[_0xf3c1('0x5e')]['id']){delete _0x3ceeab[_0xf3c1('0x5e')]['id'];}_0x3ceeab[_0xf3c1('0x5e')]['read']=!![];_0x3ceeab[_0xf3c1('0x5e')][_0xf3c1('0x62')]=moment()[_0xf3c1('0x63')](_0xf3c1('0x64'));_0x3ceeab[_0xf3c1('0x5e')][_0xf3c1('0x65')]=_0x3ceeab['body'][_0xf3c1('0x65')]||_0x3ceeab[_0xf3c1('0x66')]['id'];_0x34506c[_0xf3c1('0x67')]['id']=_0x3ceeab[_0xf3c1('0x5e')][_0xf3c1('0x65')];return db[_0xf3c1('0x56')][_0xf3c1('0x5c')]({'where':{'id':_0x3ceeab['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x383fd0,null))[_0xf3c1('0x24')](saveUpdates(_0x3ceeab[_0xf3c1('0x5e')],null))['then'](function(_0x21daef){if(_0x21daef){_0x34506c[_0xf3c1('0x2a')]=_0x21daef['get']({'plain':!![]});return db[_0xf3c1('0x68')]['find']({'where':{'id':_0x21daef[_0xf3c1('0x69')]}});}return null;})[_0xf3c1('0x24')](handleEntityNotFound(_0x383fd0,null))[_0xf3c1('0x24')](function(_0x2dc348){if(_0x2dc348){return _0x2dc348[_0xf3c1('0x39')]({'UserId':_0x3ceeab[_0xf3c1('0x5e')][_0xf3c1('0x65')],'read1stAt':_[_0xf3c1('0x6a')](_0x2dc348[_0xf3c1('0x6b')])?moment()[_0xf3c1('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x427406){if(_0x427406){_0x34506c[_0xf3c1('0x6c')]=_0x427406[_0xf3c1('0x6d')]({'plain':!![]});interaction_log[_0xf3c1('0x2b')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ceeab[_0xf3c1('0x66')]['id'],_0x3ceeab['user'][_0xf3c1('0x3d')],_0x3ceeab[_0xf3c1('0x66')][_0xf3c1('0x6e')],_0x34506c[_0xf3c1('0x6c')]['id'],_0x3ceeab[_0xf3c1('0x5e')]?JSON[_0xf3c1('0x26')](_0x3ceeab[_0xf3c1('0x5e')]):'null');return respondWithRpcPromise(_0xf3c1('0x6f'),_0xf3c1('0x70'),_0x34506c);}return null;})[_0xf3c1('0x24')](function(_0x5730ed){var _0x3f60bb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5730ed[_0xf3c1('0x2a')][_0xf3c1('0x71')];return db[_0xf3c1('0x72')][_0xf3c1('0x45')](_0x3f60bb,{'type':db[_0xf3c1('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0xf3c1('0x24')](function(_0x56b2a6){return _0x56b2a6;});})[_0xf3c1('0x24')](function(_0x18cf31){if(_0x18cf31){_0x34506c[_0xf3c1('0x2a')]['contact']=_0x18cf31[0x0];if(!_0x3ceeab[_0xf3c1('0x5e')][_0xf3c1('0x65')])return;return db['User'][_0xf3c1('0x5c')]({'where':{'id':_0x3ceeab[_0xf3c1('0x5e')][_0xf3c1('0x65')],'role':_0xf3c1('0x67')},'attributes':['id','name',_0xf3c1('0x74'),_0xf3c1('0x75'),_0xf3c1('0x76')],'raw':!![]});}return null;})['then'](function(_0x5acce9){if(!_0x5acce9)return null;_0x34506c[_0xf3c1('0x2a')]['agent']=_0x5acce9;return _0x34506c;})[_0xf3c1('0x24')](function(_0x2fcf66){if(_0x2fcf66){if(_0x3ceeab[_0xf3c1('0x5e')]['manual']){_0x34506c[_0xf3c1('0x2a')][_0xf3c1('0x77')]=util[_0xf3c1('0x63')]('SIP/%s',_0x3ceeab[_0xf3c1('0x66')]['name']);_0x34506c[_0xf3c1('0x2a')]['channel']=_0x34506c[_0xf3c1('0x78')];_0x34506c[_0xf3c1('0x2a')][_0xf3c1('0x79')]=_0x34506c[_0xf3c1('0x78')];_0x34506c[_0xf3c1('0x2a')][_0xf3c1('0x7a')]=_0xf3c1('0x60');return respondWithRpcPromise(_0xf3c1('0x7b'),_0xf3c1('0x7b'),{'event':'acceptmessage','message':_0x34506c[_0xf3c1('0x2a')]},client9002)[_0xf3c1('0x24')](function(){return _0x34506c;});}return _0x34506c;}return null;})['then'](respondWithResult(_0x383fd0,null))[_0xf3c1('0x2d')](handleError(_0x383fd0,null));};var interaction_log=require(_0xf3c1('0x17'))(_0xf3c1('0x7c'));exports[_0xf3c1('0x7d')]=function(_0x1af992,_0x4be4b2,_0x34768f){var _0x5ab726={'agent':{},'channel':_0xf3c1('0x61')};if(_0x1af992[_0xf3c1('0x5e')]['id']){delete _0x1af992[_0xf3c1('0x5e')]['id'];}_0x1af992[_0xf3c1('0x5e')][_0xf3c1('0x65')]=_0x1af992[_0xf3c1('0x5e')][_0xf3c1('0x65')]||_0x1af992[_0xf3c1('0x66')]['id'];_0x5ab726[_0xf3c1('0x67')]['id']=_0x1af992[_0xf3c1('0x5e')][_0xf3c1('0x65')];return db[_0xf3c1('0x56')][_0xf3c1('0x5c')]({'where':{'id':_0x1af992[_0xf3c1('0x5a')]['id'],'UserId':null}})[_0xf3c1('0x24')](handleEntityNotFound(_0x4be4b2,null))['then'](function(_0x11e383){if(_0x11e383){_0x5ab726[_0xf3c1('0x2a')]=_0x11e383[_0xf3c1('0x6d')]({'plain':!![]});return db['WhatsappInteraction'][_0xf3c1('0x5c')]({'where':{'id':_0x11e383[_0xf3c1('0x69')]}});}return null;})[_0xf3c1('0x24')](handleEntityNotFound(_0x4be4b2,null))[_0xf3c1('0x24')](function(_0x132d2d){if(_0x132d2d){_0x5ab726[_0xf3c1('0x6c')]=_0x132d2d[_0xf3c1('0x6d')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1af992[_0xf3c1('0x66')]['id'],_0x1af992['user']['name'],_0x1af992[_0xf3c1('0x66')]['role'],_0x5ab726[_0xf3c1('0x6c')]['id'],_0x1af992[_0xf3c1('0x5e')]?JSON[_0xf3c1('0x26')](_0x1af992[_0xf3c1('0x5e')]):'null');return respondWithRpcPromise(_0xf3c1('0x7e'),'rejectMessage',_0x5ab726);}return null;})['then'](function(_0x5a2723){var _0x2a0336='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a2723[_0xf3c1('0x2a')][_0xf3c1('0x71')];return db[_0xf3c1('0x72')][_0xf3c1('0x45')](_0x2a0336,{'type':db[_0xf3c1('0x73')][_0xf3c1('0x7f')][_0xf3c1('0x80')],'raw':!![]})[_0xf3c1('0x24')](function(_0x2d5cda){return _0x2d5cda;});})[_0xf3c1('0x24')](function(_0x489ffd){if(_0x489ffd){_0x5ab726[_0xf3c1('0x2a')][_0xf3c1('0x81')]=_0x489ffd[0x0];if(!_0x1af992['body'][_0xf3c1('0x65')])return;return db['User'][_0xf3c1('0x5c')]({'where':{'id':_0x1af992[_0xf3c1('0x5e')][_0xf3c1('0x65')],'role':_0xf3c1('0x67')},'attributes':['id',_0xf3c1('0x3d'),_0xf3c1('0x74'),_0xf3c1('0x75'),_0xf3c1('0x76')],'raw':!![]});}return null;})[_0xf3c1('0x24')](function(_0x54aacc){if(!_0x54aacc)return null;_0x5ab726[_0xf3c1('0x2a')][_0xf3c1('0x67')]=_0x54aacc;return _0x5ab726;})['then'](function(_0x12f1b2){if(_0x12f1b2){_0x12f1b2[_0xf3c1('0x2a')]['interface']=util[_0xf3c1('0x63')](_0xf3c1('0x82'),_0x1af992[_0xf3c1('0x66')][_0xf3c1('0x3d')]);_0x12f1b2[_0xf3c1('0x2a')]['channel']=_0x5ab726[_0xf3c1('0x78')];_0x12f1b2[_0xf3c1('0x2a')][_0xf3c1('0x79')]=_0x5ab726[_0xf3c1('0x78')];_0x12f1b2[_0xf3c1('0x2a')][_0xf3c1('0x7a')]='reject';respondWithRpcPromise(_0xf3c1('0x7b'),_0xf3c1('0x7b'),{'event':_0xf3c1('0x83'),'message':_0x12f1b2[_0xf3c1('0x2a')]},client9002);return _0x5ab726;}return null;})['then'](respondWithResult(_0x4be4b2,null))[_0xf3c1('0x2d')](handleError(_0x4be4b2,null));};exports[_0xf3c1('0x2f')]=function(_0x5b478d,_0x4c0177,_0x569438){if(_0x5b478d[_0xf3c1('0x5e')]['id']){delete _0x5b478d['body']['id'];}var _0x2ff7c3;return db[_0xf3c1('0x56')][_0xf3c1('0x5c')]({'where':{'id':_0x5b478d[_0xf3c1('0x5a')]['id']}})[_0xf3c1('0x24')](handleEntityNotFound(_0x4c0177,null))[_0xf3c1('0x24')](function(_0x360803){if(_0x360803){_0x2ff7c3=_0x360803;return db['WhatsappAccount'][_0xf3c1('0x5c')]({'where':{'id':_0x360803[_0xf3c1('0x84')]}});}})['then'](handleEntityNotFound(_0x4c0177,null))[_0xf3c1('0x24')](function(_0x5a5744){if(_0x5a5744){logger[_0xf3c1('0x85')](_0xf3c1('0x86'),_0xf3c1('0x2f'),_0xf3c1('0x87'),_0x5a5744[_0xf3c1('0x42')],util[_0xf3c1('0x88')](_0x5b478d['body'],{'showHidden':![],'depth':null}));switch(_0x5a5744[_0xf3c1('0x42')]){case _0xf3c1('0x89'):if(_0x5b478d['body'][_0xf3c1('0x8a')]&&_0x5b478d[_0xf3c1('0x5e')][_0xf3c1('0x8a')]===_0x2ff7c3['messageId']&&_0x5b478d[_0xf3c1('0x5e')][_0xf3c1('0x8b')]&&_0x5b478d['body'][_0xf3c1('0x8b')]===_0xf3c1('0x8c')){return _0x2ff7c3['update']({'read':!![]});}else{logger['error'](_0xf3c1('0x8d'),_0xf3c1('0x2f'),_0xf3c1('0x89'),util[_0xf3c1('0x88')](_0x5b478d['body'],{'showHidden':![],'depth':null}));}break;}return _0x2ff7c3;}})[_0xf3c1('0x24')](respondWithResult(_0x4c0177,null))[_0xf3c1('0x2d')](handleError(_0x4c0177,null));}; \ No newline at end of file +var _0x22e1=['interface','SIP/%s','channel','motionChannel','event','accept','EventManager','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','User','email','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','params','find','create','body','update','destroy','describe','../../config/logger','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','fullname','internal','manual'];(function(_0x54867a,_0x1caba1){var _0x4d06d4=function(_0x3419eb){while(--_0x3419eb){_0x54867a['push'](_0x54867a['shift']());}};_0x4d06d4(++_0x1caba1);}(_0x22e1,0x129));var _0x122e=function(_0x294e72,_0xb5080d){_0x294e72=_0x294e72-0x0;var _0xcbc6f5=_0x22e1[_0x294e72];return _0xcbc6f5;};'use strict';var emlformat=require(_0x122e('0x0'));var rimraf=require(_0x122e('0x1'));var zipdir=require(_0x122e('0x2'));var jsonpatch=require(_0x122e('0x3'));var rp=require(_0x122e('0x4'));var moment=require(_0x122e('0x5'));var BPromise=require(_0x122e('0x6'));var Mustache=require(_0x122e('0x7'));var util=require(_0x122e('0x8'));var path=require(_0x122e('0x9'));var sox=require('sox');var csv=require(_0x122e('0xa'));var ejs=require(_0x122e('0xb'));var fs=require('fs');var fs_extra=require(_0x122e('0xc'));var _=require(_0x122e('0xd'));var squel=require(_0x122e('0xe'));var crypto=require('crypto');var jsforce=require(_0x122e('0xf'));var deskjs=require(_0x122e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x122e('0x11'));var Papa=require(_0x122e('0x12'));var Redis=require(_0x122e('0x13'));var authService=require(_0x122e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x122e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x122e('0x16'));var utils=require(_0x122e('0x17'));var config=require(_0x122e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x122e('0x19'))['db'];config[_0x122e('0x1a')]=_[_0x122e('0x1b')](config[_0x122e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x122e('0x1a')]));require('./whatsappMessage.socket')[_0x122e('0x1c')](socket);var jayson=require(_0x122e('0x1d'));var client=jayson[_0x122e('0x1e')][_0x122e('0x1f')]({'port':0x232c});var client9002=jayson[_0x122e('0x1e')][_0x122e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x554ef3,_0x185007,_0x5c0047,_0x4eec7e){return new BPromise(function(_0x45248d,_0x169384){var _0x3626e5=_0x4eec7e||client;return _0x3626e5[_0x122e('0x20')](_0x554ef3,_0x5c0047)[_0x122e('0x21')](function(_0x58ca7e){logger[_0x122e('0x22')](_0x122e('0x23'),_0x185007,_0x122e('0x24'));logger[_0x122e('0x25')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x185007,_0x122e('0x24'),JSON[_0x122e('0x26')](_0x58ca7e));if(_0x58ca7e[_0x122e('0x27')]){if(_0x58ca7e[_0x122e('0x27')][_0x122e('0x28')]===0x1f4){logger[_0x122e('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x185007,_0x58ca7e[_0x122e('0x27')][_0x122e('0x29')]);return _0x169384(_0x58ca7e[_0x122e('0x27')][_0x122e('0x29')]);}logger['error'](_0x122e('0x23'),_0x185007,_0x58ca7e['error'][_0x122e('0x29')]);return _0x45248d(_0x58ca7e[_0x122e('0x27')][_0x122e('0x29')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x185007,_0x122e('0x24'));_0x45248d(_0x58ca7e[_0x122e('0x2a')][_0x122e('0x29')]);}})[_0x122e('0x2b')](function(_0x119cf3){logger['error'](_0x122e('0x23'),_0x185007,_0x119cf3);_0x169384(_0x119cf3);});});}function respondWithStatusCode(_0x4b0963,_0x44ede4){_0x44ede4=_0x44ede4||0xcc;return function(_0x694cb8){if(_0x694cb8){return _0x4b0963[_0x122e('0x2c')](_0x44ede4);}return _0x4b0963[_0x122e('0x2d')](_0x44ede4)[_0x122e('0x2e')]();};}function respondWithResult(_0x38fa1f,_0x3b3a40){_0x3b3a40=_0x3b3a40||0xc8;return function(_0x4f73b5){if(_0x4f73b5){return _0x38fa1f[_0x122e('0x2d')](_0x3b3a40)[_0x122e('0x2f')](_0x4f73b5);}};}function respondWithFilteredResult(_0x3fc40c,_0x402b8a){return function(_0x27c56c){if(_0x27c56c){var _0x404530=typeof _0x402b8a['offset']===_0x122e('0x30')&&typeof _0x402b8a[_0x122e('0x31')]===_0x122e('0x30');var _0xd26f17=_0x27c56c[_0x122e('0x32')];var _0x1b094d=_0x404530?0x0:_0x402b8a[_0x122e('0x33')];var _0x542481=_0x404530?_0x27c56c[_0x122e('0x32')]:_0x402b8a['offset']+_0x402b8a[_0x122e('0x31')];var _0x40a805;if(_0x542481>=_0xd26f17){_0x542481=_0xd26f17;_0x40a805=0xc8;}else{_0x40a805=0xce;}_0x3fc40c[_0x122e('0x2d')](_0x40a805);return _0x3fc40c[_0x122e('0x34')](_0x122e('0x35'),_0x1b094d+'-'+_0x542481+'/'+_0xd26f17)[_0x122e('0x2f')](_0x27c56c);}return null;};}function patchUpdates(_0x3e98da){return function(_0x4eddd6){try{jsonpatch[_0x122e('0x36')](_0x4eddd6,_0x3e98da,!![]);}catch(_0x33c9ef){return BPromise['reject'](_0x33c9ef);}return _0x4eddd6['save']();};}function saveUpdates(_0x8e0d64,_0x113e25){return function(_0x4fb6be){if(_0x4fb6be){return _0x4fb6be['update'](_0x8e0d64)[_0x122e('0x21')](function(_0x3cd9f6){return _0x3cd9f6;});}return null;};}function removeEntity(_0x52d9e4,_0x4901d0){return function(_0x39cbea){if(_0x39cbea){return _0x39cbea['destroy']()['then'](function(){_0x52d9e4[_0x122e('0x2d')](0xcc)[_0x122e('0x2e')]();});}};}function handleEntityNotFound(_0x5a5421,_0x311865){return function(_0xcab530){if(!_0xcab530){_0x5a5421[_0x122e('0x2c')](0x194);}return _0xcab530;};}function handleError(_0x42239a,_0xda314e){_0xda314e=_0xda314e||0x1f4;return function(_0x2a7a4b){logger[_0x122e('0x27')](_0x2a7a4b[_0x122e('0x37')]);if(_0x2a7a4b['name']){delete _0x2a7a4b[_0x122e('0x38')];}_0x42239a[_0x122e('0x2d')](_0xda314e)['send'](_0x2a7a4b);};}exports[_0x122e('0x39')]=function(_0x14bc19,_0x1dfbc7){var _0x2a064d={},_0x457625={},_0x43dbb5={'count':0x0,'rows':[]};var _0x2a777e=_[_0x122e('0x3a')](db[_0x122e('0x3b')][_0x122e('0x3c')],function(_0x2badab){return{'name':_0x2badab[_0x122e('0x3d')],'type':_0x2badab[_0x122e('0x3e')][_0x122e('0x3f')]};});_0x457625[_0x122e('0x40')]=_[_0x122e('0x3a')](_0x2a777e,'name');_0x457625[_0x122e('0x41')]=_[_0x122e('0x42')](_0x14bc19[_0x122e('0x41')]);_0x457625[_0x122e('0x43')]=_[_0x122e('0x44')](_0x457625[_0x122e('0x40')],_0x457625[_0x122e('0x41')]);_0x2a064d[_0x122e('0x45')]=_[_0x122e('0x44')](_0x457625['model'],qs[_0x122e('0x46')](_0x14bc19[_0x122e('0x41')]['fields']));_0x2a064d['attributes']=_0x2a064d[_0x122e('0x45')][_0x122e('0x47')]?_0x2a064d[_0x122e('0x45')]:_0x457625[_0x122e('0x40')];if(!_0x14bc19[_0x122e('0x41')][_0x122e('0x48')]('nolimit')){_0x2a064d[_0x122e('0x31')]=qs[_0x122e('0x31')](_0x14bc19[_0x122e('0x41')][_0x122e('0x31')]);_0x2a064d[_0x122e('0x33')]=qs[_0x122e('0x33')](_0x14bc19[_0x122e('0x41')][_0x122e('0x33')]);}_0x2a064d[_0x122e('0x49')]=qs[_0x122e('0x4a')](_0x14bc19['query'][_0x122e('0x4a')]);_0x2a064d[_0x122e('0x4b')]=qs[_0x122e('0x43')](_[_0x122e('0x4c')](_0x14bc19['query'],_0x457625[_0x122e('0x43')]),_0x2a777e);if(_0x14bc19[_0x122e('0x41')][_0x122e('0x4d')]){_0x2a064d[_0x122e('0x4b')]=_[_0x122e('0x4e')](_0x2a064d[_0x122e('0x4b')],{'$or':_['map'](_0x2a777e,function(_0x47df44){if(_0x47df44[_0x122e('0x3e')]!=='VIRTUAL'){var _0x4f9300={};_0x4f9300[_0x47df44['name']]={'$like':'%'+_0x14bc19[_0x122e('0x41')][_0x122e('0x4d')]+'%'};return _0x4f9300;}})});}_0x2a064d=_[_0x122e('0x4e')]({},_0x2a064d,_0x14bc19[_0x122e('0x4f')]);var _0x256333={'where':_0x2a064d['where']};return db[_0x122e('0x3b')][_0x122e('0x32')](_0x256333)[_0x122e('0x21')](function(_0x3c6ae5){_0x43dbb5[_0x122e('0x32')]=_0x3c6ae5;if(_0x14bc19[_0x122e('0x41')][_0x122e('0x50')]){_0x2a064d[_0x122e('0x51')]=[{'all':!![]}];}return db[_0x122e('0x3b')]['findAll'](_0x2a064d);})[_0x122e('0x21')](function(_0x23478d){_0x43dbb5[_0x122e('0x52')]=_0x23478d;return _0x43dbb5;})['then'](respondWithFilteredResult(_0x1dfbc7,_0x2a064d))[_0x122e('0x2b')](handleError(_0x1dfbc7,null));};exports['show']=function(_0x148b87,_0x5b155b){var _0x2cdb63={'raw':!![],'where':{'id':_0x148b87[_0x122e('0x53')]['id']}},_0xed9b9d={};_0xed9b9d[_0x122e('0x40')]=_[_0x122e('0x42')](db[_0x122e('0x3b')]['rawAttributes']);_0xed9b9d[_0x122e('0x41')]=_[_0x122e('0x42')](_0x148b87[_0x122e('0x41')]);_0xed9b9d['filters']=_[_0x122e('0x44')](_0xed9b9d['model'],_0xed9b9d[_0x122e('0x41')]);_0x2cdb63['attributes']=_[_0x122e('0x44')](_0xed9b9d[_0x122e('0x40')],qs[_0x122e('0x46')](_0x148b87[_0x122e('0x41')][_0x122e('0x46')]));_0x2cdb63[_0x122e('0x45')]=_0x2cdb63['attributes']['length']?_0x2cdb63[_0x122e('0x45')]:_0xed9b9d[_0x122e('0x40')];if(_0x148b87[_0x122e('0x41')][_0x122e('0x50')]){_0x2cdb63[_0x122e('0x51')]=[{'all':!![]}];}_0x2cdb63=_[_0x122e('0x4e')]({},_0x2cdb63,_0x148b87[_0x122e('0x4f')]);return db[_0x122e('0x3b')][_0x122e('0x54')](_0x2cdb63)[_0x122e('0x21')](handleEntityNotFound(_0x5b155b,null))['then'](respondWithResult(_0x5b155b,null))[_0x122e('0x2b')](handleError(_0x5b155b,null));};exports[_0x122e('0x55')]=function(_0x4cc0d7,_0x1b6a7a){return db[_0x122e('0x3b')][_0x122e('0x55')](_0x4cc0d7[_0x122e('0x56')],{})[_0x122e('0x21')](respondWithResult(_0x1b6a7a,0xc9))[_0x122e('0x2b')](handleError(_0x1b6a7a,null));};exports[_0x122e('0x57')]=function(_0x14322b,_0x5189fb){if(_0x14322b['body']['id']){delete _0x14322b[_0x122e('0x56')]['id'];}return db[_0x122e('0x3b')][_0x122e('0x54')]({'where':{'id':_0x14322b[_0x122e('0x53')]['id']}})['then'](handleEntityNotFound(_0x5189fb,null))[_0x122e('0x21')](saveUpdates(_0x14322b['body'],null))[_0x122e('0x21')](respondWithResult(_0x5189fb,null))[_0x122e('0x2b')](handleError(_0x5189fb,null));};exports[_0x122e('0x58')]=function(_0x1aeaa6,_0x216690){return db[_0x122e('0x3b')][_0x122e('0x54')]({'where':{'id':_0x1aeaa6[_0x122e('0x53')]['id']}})['then'](handleEntityNotFound(_0x216690,null))[_0x122e('0x21')](removeEntity(_0x216690,null))[_0x122e('0x2b')](handleError(_0x216690,null));};exports[_0x122e('0x59')]=function(_0x344775,_0x6e0ecd){return db[_0x122e('0x3b')][_0x122e('0x59')]()['then'](respondWithResult(_0x6e0ecd,null))[_0x122e('0x2b')](handleError(_0x6e0ecd,null));};var interaction_log=require(_0x122e('0x5a'))('whatsapp-interactions');exports['accept']=function(_0x5659f8,_0x14b05b,_0x4a4c52){var _0x2b4ef9={'agent':{},'channel':_0x122e('0x5b')};if(_0x5659f8[_0x122e('0x56')]['id']){delete _0x5659f8[_0x122e('0x56')]['id'];}_0x5659f8[_0x122e('0x56')][_0x122e('0x5c')]=!![];_0x5659f8[_0x122e('0x56')][_0x122e('0x5d')]=moment()[_0x122e('0x5e')](_0x122e('0x5f'));_0x5659f8[_0x122e('0x56')]['UserId']=_0x5659f8[_0x122e('0x56')][_0x122e('0x60')]||_0x5659f8[_0x122e('0x61')]['id'];_0x2b4ef9[_0x122e('0x62')]['id']=_0x5659f8[_0x122e('0x56')][_0x122e('0x60')];return db[_0x122e('0x3b')][_0x122e('0x54')]({'where':{'id':_0x5659f8[_0x122e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14b05b,null))['then'](saveUpdates(_0x5659f8[_0x122e('0x56')],null))['then'](function(_0x59d85c){if(_0x59d85c){_0x2b4ef9[_0x122e('0x29')]=_0x59d85c['get']({'plain':!![]});return db[_0x122e('0x63')][_0x122e('0x54')]({'where':{'id':_0x59d85c[_0x122e('0x64')]}});}return null;})[_0x122e('0x21')](handleEntityNotFound(_0x14b05b,null))[_0x122e('0x21')](function(_0x2fc1cf){if(_0x2fc1cf){return _0x2fc1cf[_0x122e('0x57')]({'UserId':_0x5659f8['body'][_0x122e('0x60')],'read1stAt':_[_0x122e('0x65')](_0x2fc1cf['read1stAt'])?moment()['format'](_0x122e('0x5f')):undefined});}return null;})[_0x122e('0x21')](function(_0x571c92){if(_0x571c92){_0x2b4ef9[_0x122e('0x66')]=_0x571c92[_0x122e('0x67')]({'plain':!![]});interaction_log['info'](_0x122e('0x68'),_0x5659f8[_0x122e('0x61')]['id'],_0x5659f8['user'][_0x122e('0x38')],_0x5659f8[_0x122e('0x61')][_0x122e('0x69')],_0x2b4ef9[_0x122e('0x66')]['id'],_0x5659f8[_0x122e('0x56')]?JSON[_0x122e('0x26')](_0x5659f8['body']):_0x122e('0x6a'));return respondWithRpcPromise(_0x122e('0x6b'),_0x122e('0x6c'),_0x2b4ef9);}return null;})[_0x122e('0x21')](function(_0x196224){var _0x325d81=_0x122e('0x6d')+_0x196224[_0x122e('0x29')][_0x122e('0x6e')];return db['sequelize'][_0x122e('0x41')](_0x325d81,{'type':db['Sequelize'][_0x122e('0x6f')][_0x122e('0x70')],'raw':!![]})['then'](function(_0x2d0952){return _0x2d0952;});})[_0x122e('0x21')](function(_0x4bfbbc){if(_0x4bfbbc){_0x2b4ef9['message'][_0x122e('0x71')]=_0x4bfbbc[0x0];if(!_0x5659f8[_0x122e('0x56')]['UserId'])return;return db['User'][_0x122e('0x54')]({'where':{'id':_0x5659f8[_0x122e('0x56')]['UserId'],'role':_0x122e('0x62')},'attributes':['id','name',_0x122e('0x72'),'email',_0x122e('0x73')],'raw':!![]});}return null;})[_0x122e('0x21')](function(_0x578ab7){if(!_0x578ab7)return null;_0x2b4ef9[_0x122e('0x29')][_0x122e('0x62')]=_0x578ab7;return _0x2b4ef9;})[_0x122e('0x21')](function(_0x1901c5){if(_0x1901c5){if(_0x5659f8[_0x122e('0x56')][_0x122e('0x74')]){_0x2b4ef9['message'][_0x122e('0x75')]=util['format'](_0x122e('0x76'),_0x5659f8[_0x122e('0x61')]['name']);_0x2b4ef9[_0x122e('0x29')][_0x122e('0x77')]=_0x2b4ef9[_0x122e('0x77')];_0x2b4ef9[_0x122e('0x29')][_0x122e('0x78')]=_0x2b4ef9[_0x122e('0x77')];_0x2b4ef9[_0x122e('0x29')][_0x122e('0x79')]=_0x122e('0x7a');return respondWithRpcPromise(_0x122e('0x7b'),_0x122e('0x7b'),{'event':'acceptmessage','message':_0x2b4ef9[_0x122e('0x29')]},client9002)[_0x122e('0x21')](function(){return _0x2b4ef9;});}return _0x2b4ef9;}return null;})[_0x122e('0x21')](respondWithResult(_0x14b05b,null))[_0x122e('0x2b')](handleError(_0x14b05b,null));};var interaction_log=require(_0x122e('0x5a'))('whatsapp-interactions');exports[_0x122e('0x7c')]=function(_0x25071b,_0x5791c9,_0x22d25e){var _0x50e721={'agent':{},'channel':_0x122e('0x5b')};if(_0x25071b[_0x122e('0x56')]['id']){delete _0x25071b['body']['id'];}_0x25071b['body']['UserId']=_0x25071b[_0x122e('0x56')][_0x122e('0x60')]||_0x25071b['user']['id'];_0x50e721['agent']['id']=_0x25071b[_0x122e('0x56')][_0x122e('0x60')];return db[_0x122e('0x3b')][_0x122e('0x54')]({'where':{'id':_0x25071b[_0x122e('0x53')]['id'],'UserId':null}})[_0x122e('0x21')](handleEntityNotFound(_0x5791c9,null))[_0x122e('0x21')](function(_0xe80c85){if(_0xe80c85){_0x50e721[_0x122e('0x29')]=_0xe80c85[_0x122e('0x67')]({'plain':!![]});return db[_0x122e('0x63')][_0x122e('0x54')]({'where':{'id':_0xe80c85[_0x122e('0x64')]}});}return null;})[_0x122e('0x21')](handleEntityNotFound(_0x5791c9,null))[_0x122e('0x21')](function(_0x138ce9){if(_0x138ce9){_0x50e721[_0x122e('0x66')]=_0x138ce9[_0x122e('0x67')]({'plain':!![]});interaction_log['info'](_0x122e('0x7d'),_0x25071b[_0x122e('0x61')]['id'],_0x25071b[_0x122e('0x61')][_0x122e('0x38')],_0x25071b['user'][_0x122e('0x69')],_0x50e721[_0x122e('0x66')]['id'],_0x25071b['body']?JSON['stringify'](_0x25071b[_0x122e('0x56')]):'null');return respondWithRpcPromise(_0x122e('0x7e'),'rejectMessage',_0x50e721);}return null;})[_0x122e('0x21')](function(_0x38f18f){var _0xdfc5b2=_0x122e('0x6d')+_0x38f18f[_0x122e('0x29')][_0x122e('0x6e')];return db['sequelize'][_0x122e('0x41')](_0xdfc5b2,{'type':db[_0x122e('0x7f')][_0x122e('0x6f')][_0x122e('0x70')],'raw':!![]})[_0x122e('0x21')](function(_0x404eba){return _0x404eba;});})['then'](function(_0x47e09e){if(_0x47e09e){_0x50e721[_0x122e('0x29')][_0x122e('0x71')]=_0x47e09e[0x0];if(!_0x25071b[_0x122e('0x56')][_0x122e('0x60')])return;return db[_0x122e('0x80')][_0x122e('0x54')]({'where':{'id':_0x25071b[_0x122e('0x56')][_0x122e('0x60')],'role':_0x122e('0x62')},'attributes':['id',_0x122e('0x38'),'fullname',_0x122e('0x81'),_0x122e('0x73')],'raw':!![]});}return null;})[_0x122e('0x21')](function(_0x1f99de){if(!_0x1f99de)return null;_0x50e721['message'][_0x122e('0x62')]=_0x1f99de;return _0x50e721;})[_0x122e('0x21')](function(_0x3bc86f){if(_0x3bc86f){_0x3bc86f[_0x122e('0x29')]['interface']=util[_0x122e('0x5e')](_0x122e('0x76'),_0x25071b[_0x122e('0x61')][_0x122e('0x38')]);_0x3bc86f[_0x122e('0x29')]['channel']=_0x50e721[_0x122e('0x77')];_0x3bc86f[_0x122e('0x29')]['motionChannel']=_0x50e721[_0x122e('0x77')];_0x3bc86f['message']['event']=_0x122e('0x7c');respondWithRpcPromise(_0x122e('0x7b'),_0x122e('0x7b'),{'event':_0x122e('0x82'),'message':_0x3bc86f[_0x122e('0x29')]},client9002);return _0x50e721;}return null;})[_0x122e('0x21')](respondWithResult(_0x5791c9,null))[_0x122e('0x2b')](handleError(_0x5791c9,null));};exports['status']=function(_0x3ea918,_0x3d6d95,_0x44b444){if(_0x3ea918[_0x122e('0x56')]['id']){delete _0x3ea918[_0x122e('0x56')]['id'];}var _0x237614;return db[_0x122e('0x3b')]['find']({'where':{'id':_0x3ea918[_0x122e('0x53')]['id']}})[_0x122e('0x21')](handleEntityNotFound(_0x3d6d95,null))[_0x122e('0x21')](function(_0xc217ce){if(_0xc217ce){_0x237614=_0xc217ce;return db[_0x122e('0x83')][_0x122e('0x54')]({'where':{'id':_0xc217ce[_0x122e('0x84')]}});}})[_0x122e('0x21')](handleEntityNotFound(_0x3d6d95,null))['then'](function(_0x2a6645){if(_0x2a6645){logger[_0x122e('0x25')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x122e('0x2d'),_0x122e('0x85'),_0x2a6645[_0x122e('0x3e')],util[_0x122e('0x86')](_0x3ea918[_0x122e('0x56')],{'showHidden':![],'depth':null}));switch(_0x2a6645[_0x122e('0x3e')]){case'twilio':if(_0x3ea918[_0x122e('0x56')][_0x122e('0x87')]&&_0x3ea918['body'][_0x122e('0x87')]===_0x237614[_0x122e('0x88')]&&_0x3ea918['body']['MessageStatus']&&_0x3ea918[_0x122e('0x56')]['MessageStatus']===_0x122e('0x5c')){return _0x237614[_0x122e('0x57')]({'read':!![]});}else{logger[_0x122e('0x27')](_0x122e('0x89'),'status','twilio',util[_0x122e('0x86')](_0x3ea918[_0x122e('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x237614;}})[_0x122e('0x21')](respondWithResult(_0x3d6d95,null))[_0x122e('0x2b')](handleError(_0x3d6d95,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index eb53eb9..6e45df9 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 _0xe9e8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x4df0c5,_0x10cac5){_0x4df0c5=_0x4df0c5-0x0;var _0x507d06=_0xe9e8[_0x4df0c5];return _0x507d06;};'use strict';var EventEmitter=require(_0x8e9e('0x0'));var WhatsappMessage=require(_0x8e9e('0x1'))['db'][_0x8e9e('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8e9e('0x3')](0x0);var events={'afterCreate':_0x8e9e('0x4'),'afterUpdate':_0x8e9e('0x5'),'afterDestroy':_0x8e9e('0x6')};function emitEvent(_0x48233f){return function(_0x103d8b,_0x2a1d41,_0x1c09c6){WhatsappMessageEvents['emit'](_0x48233f+':'+_0x103d8b['id'],_0x103d8b);WhatsappMessageEvents[_0x8e9e('0x7')](_0x48233f,_0x103d8b);_0x1c09c6(null);};}for(var e in events){if(events[_0x8e9e('0x8')](e)){var event=events[e];WhatsappMessage[_0x8e9e('0x9')](e,emitEvent(event));}}module[_0x8e9e('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa571=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa571,0x107));var _0x1a57=function(_0x327dec,_0x4687f4){_0x327dec=_0x327dec-0x0;var _0x1052a8=_0xa571[_0x327dec];return _0x1052a8;};'use strict';var EventEmitter=require(_0x1a57('0x0'));var WhatsappMessage=require(_0x1a57('0x1'))['db'][_0x1a57('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1a57('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a57('0x4'),'afterDestroy':_0x1a57('0x5')};function emitEvent(_0x4d5f7a){return function(_0x5ec815,_0x1f2c44,_0x5067fa){WhatsappMessageEvents[_0x1a57('0x6')](_0x4d5f7a+':'+_0x5ec815['id'],_0x5ec815);WhatsappMessageEvents[_0x1a57('0x6')](_0x4d5f7a,_0x5ec815);_0x5067fa(null);};}for(var e in events){if(events[_0x1a57('0x7')](e)){var event=events[e];WhatsappMessage[_0x1a57('0x8')](e,emitEvent(event));}}module[_0x1a57('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d596aa7..1fd807a 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 _0x83e0=['find','type','twilio','accountSid','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','baseUrl','/whatsapp/v1/','/messages/','phone','text','POST','Bearer\x20','application/json','message_id','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x83e0,0x1b0));var _0x083e=function(_0x521f8c,_0x592436){_0x521f8c=_0x521f8c-0x0;var _0x49e924=_0x83e0[_0x521f8c];return _0x49e924;};'use strict';var _=require(_0x083e('0x0'));var util=require('util');var logger=require(_0x083e('0x1'))(_0x083e('0x2'));var moment=require(_0x083e('0x3'));var BPromise=require(_0x083e('0x4'));var rp=require(_0x083e('0x5'));var fetch=require(_0x083e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x083e('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x083e('0x8')]=function(_0x480813,_0x3bab9d){return _0x480813[_0x083e('0x9')](_0x083e('0xa'),attributes,{'tableName':_0x083e('0xb'),'paranoid':![],'indexes':[{'name':_0x083e('0xc'),'fields':[_0x083e('0xc')]},{'name':_0x083e('0xd'),'fields':[_0x083e('0xe')],'type':_0x083e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x216d1d,_0x1ab9cf,_0x169a55){var _0x49dd6d=_0x480813[_0x083e('0x10')];var _0x3a2b1b=_0x216d1d[_0x083e('0x11')]({'plain':!![]});if(_0x3a2b1b[_0x083e('0x12')][_0x083e('0x13')]()==='in'||_0x3a2b1b[_0x083e('0x12')]['toLowerCase']()===_0x083e('0x14')&&!_0x3a2b1b[_0x083e('0x15')]&&!_[_0x083e('0x16')](_0x3a2b1b[_0x083e('0x17')])){_0x49dd6d[_0x083e('0x18')]['findOne']({'where':{'id':_0x3a2b1b[_0x083e('0x19')]}})[_0x083e('0x1a')](function(_0x3946d3){if(_0x3946d3){_0x3946d3[_0x083e('0x1b')]({'lastMsgAt':_0x3a2b1b[_0x083e('0x1c')],'lastMsgDirection':_0x3a2b1b[_0x083e('0x12')][_0x083e('0x13')]()});}})[_0x083e('0x1d')](function(_0x9f2338){console[_0x083e('0x1e')](_0x9f2338);});}if(_0x3a2b1b['direction']===_0x083e('0x14')&&!_0x3a2b1b[_0x083e('0x15')]){var _0x26797b;_0x49dd6d[_0x083e('0x1f')][_0x083e('0x20')]({'where':{'id':_0x3a2b1b['WhatsappAccountId']},'raw':!![]})[_0x083e('0x1a')](function(_0x2ab367){_0x26797b=_0x2ab367;if(_0x26797b&&_0x26797b[_0x083e('0x21')]){switch(_0x26797b[_0x083e('0x21')]){case _0x083e('0x22'):var _0x1c589c=require('twilio');if(_0x26797b[_0x083e('0x23')]&&_0x26797b['authToken']&&_0x26797b['phone']){var _0x4c433e=new _0x1c589c(_0x26797b['accountSid'],_0x26797b[_0x083e('0x24')]);_0x4c433e[_0x083e('0x25')][_0x083e('0x26')]({'body':_0x3a2b1b[_0x083e('0xe')],'to':_0x083e('0x27')+_0x3a2b1b['phone'],'from':_0x083e('0x27')+_0x26797b['phone'],'statusCallback':_0x26797b[_0x083e('0x28')]+_0x083e('0x29')+_0x3a2b1b['id']+_0x083e('0x2a')+_0x26797b[_0x083e('0x2b')]})[_0x083e('0x1a')](function(_0x1c6833){if(_0x1c6833[_0x083e('0x2c')]){return _0x216d1d['update']({'messageId':_0x1c6833[_0x083e('0x2c')]});}})[_0x083e('0x1d')](function(_0x37bd23){logger[_0x083e('0x1e')](_0x083e('0x2d'),'afterCreate','twilio',util[_0x083e('0x2e')](_0x37bd23,{'showHidden':![],'depth':null}));});}else{logger[_0x083e('0x1e')](_0x083e('0x2d'),_0x083e('0x2f'),_0x083e('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x44f0f7=_0x26797b['accountSid'];var _0x47b0ff=_0x26797b[_0x083e('0x24')];var _0x45f42b=_0x26797b[_0x083e('0x30')]+_0x083e('0x31')+_0x44f0f7+_0x083e('0x32');var _0x3936c2={'to':[_0x3a2b1b[_0x083e('0x33')]],'message':{'type':_0x083e('0x34'),'text':_0x3a2b1b[_0x083e('0xe')]}};var _0x13535b={'method':_0x083e('0x35'),'uri':_0x45f42b,'headers':{'Authorization':_0x083e('0x36')+_0x47b0ff,'Content-Type':_0x083e('0x37')},'body':_0x3936c2,'json':!![]};rp(_0x13535b)[_0x083e('0x1a')](function(_0x4e8d43){if(_0x4e8d43['statuses'][0x0][_0x083e('0x38')]){return _0x216d1d[_0x083e('0x1b')]({'messageId':_0x4e8d43['statuses'][0x0][_0x083e('0x38')]});}})[_0x083e('0x1d')](function(_0x296d52){logger['err']('WhatsappMessage,\x20%s',_0x296d52);});break;}}})['finally'](function(){_0x169a55();});}else{_0x169a55();}}},'charset':_0x083e('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x222a=['moment','bluebird','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','models','get','direction','out','secret','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x2762fc,_0x4d21a6){var _0x1ae50b=function(_0x389293){while(--_0x389293){_0x2762fc['push'](_0x2762fc['shift']());}};_0x1ae50b(++_0x4d21a6);}(_0x222a,0x1ec));var _0xa222=function(_0x576bd5,_0x2d7f17){_0x576bd5=_0x576bd5-0x0;var _0x474ecc=_0x222a[_0x576bd5];return _0x474ecc;};'use strict';var _=require(_0xa222('0x0'));var util=require('util');var logger=require(_0xa222('0x1'))(_0xa222('0x2'));var moment=require(_0xa222('0x3'));var BPromise=require(_0xa222('0x4'));var rp=require('request-promise');var fetch=require(_0xa222('0x5'));var fs=require('fs');var path=require(_0xa222('0x6'));var rimraf=require(_0xa222('0x7'));var config=require('../../config/environment');var attributes=require(_0xa222('0x8'));module[_0xa222('0x9')]=function(_0x3ecbf9,_0x48ef6e){return _0x3ecbf9['define'](_0xa222('0xa'),attributes,{'tableName':_0xa222('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xa222('0xc'),'fields':[_0xa222('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x399f51,_0x58645f,_0x5efab4){var _0xa2424a=_0x3ecbf9[_0xa222('0xe')];var _0x3af061=_0x399f51[_0xa222('0xf')]({'plain':!![]});if(_0x3af061[_0xa222('0x10')]['toLowerCase']()==='in'||_0x3af061[_0xa222('0x10')]['toLowerCase']()===_0xa222('0x11')&&!_0x3af061[_0xa222('0x12')]&&!_['isNil'](_0x3af061['UserId'])){_0xa2424a[_0xa222('0x13')][_0xa222('0x14')]({'where':{'id':_0x3af061[_0xa222('0x15')]}})[_0xa222('0x16')](function(_0x4643e9){if(_0x4643e9){_0x4643e9[_0xa222('0x17')]({'lastMsgAt':_0x3af061[_0xa222('0x18')],'lastMsgDirection':_0x3af061[_0xa222('0x10')]['toLowerCase']()});}})[_0xa222('0x19')](function(_0x47b791){console[_0xa222('0x1a')](_0x47b791);});}if(_0x3af061[_0xa222('0x10')]===_0xa222('0x11')&&!_0x3af061['secret']){var _0x5834fb;_0xa2424a[_0xa222('0x1b')]['find']({'where':{'id':_0x3af061[_0xa222('0x1c')]},'raw':!![]})[_0xa222('0x16')](function(_0x4b3811){_0x5834fb=_0x4b3811;if(_0x5834fb&&_0x5834fb[_0xa222('0x1d')]){switch(_0x5834fb[_0xa222('0x1d')]){case _0xa222('0x1e'):var _0x1e147f=require(_0xa222('0x1e'));if(_0x5834fb[_0xa222('0x1f')]&&_0x5834fb[_0xa222('0x20')]&&_0x5834fb[_0xa222('0x21')]){var _0xbf2c6e=new _0x1e147f(_0x5834fb['accountSid'],_0x5834fb['authToken']);_0xbf2c6e[_0xa222('0x22')]['create']({'body':_0x3af061[_0xa222('0xd')],'to':_0xa222('0x23')+_0x3af061[_0xa222('0x21')],'from':'whatsapp:'+_0x5834fb[_0xa222('0x21')],'statusCallback':_0x5834fb[_0xa222('0x24')]+_0xa222('0x25')+_0x3af061['id']+_0xa222('0x26')+_0x5834fb[_0xa222('0x27')]})[_0xa222('0x16')](function(_0x1618be){if(_0x1618be[_0xa222('0x28')]){return _0x399f51[_0xa222('0x17')]({'messageId':_0x1618be[_0xa222('0x28')]});}})[_0xa222('0x19')](function(_0x372079){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xa222('0x29'),'twilio',util['inspect'](_0x372079,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa222('0x2a'),_0xa222('0x29'),_0xa222('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xa222('0x2b'):var _0x3fab94=_0x5834fb[_0xa222('0x1f')];var _0x3a7e93=_0x5834fb['authToken'];var _0x5cea7e=_0x5834fb['baseUrl']+_0xa222('0x2c')+_0x3fab94+_0xa222('0x2d');var _0x45f470={'to':[_0x3af061['phone']],'message':{'type':_0xa222('0x2e'),'text':_0x3af061[_0xa222('0xd')]}};var _0xa4926b={'method':_0xa222('0x2f'),'uri':_0x5cea7e,'headers':{'Authorization':_0xa222('0x30')+_0x3a7e93,'Content-Type':_0xa222('0x31')},'body':_0x45f470,'json':!![]};rp(_0xa4926b)['then'](function(_0x46ecc4){if(_0x46ecc4['statuses'][0x0][_0xa222('0x32')]){return _0x399f51[_0xa222('0x17')]({'messageId':_0x46ecc4[_0xa222('0x33')][0x0][_0xa222('0x32')]});}})['catch'](function(_0x55caa0){logger[_0xa222('0x34')]('WhatsappMessage,\x20%s',_0x55caa0);});break;}}})['finally'](function(){_0x5efab4();});}else{_0x5efab4();}}},'charset':_0xa222('0x35'),'collate':_0xa222('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index d74ad7e..ef7ee6b 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 _0x9221=['CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./whatsappMessage.socket','register','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result'];(function(_0xd68dcd,_0x54e40b){var _0x33fd27=function(_0x5c01bd){while(--_0x5c01bd){_0xd68dcd['push'](_0xd68dcd['shift']());}};_0x33fd27(++_0x54e40b);}(_0x9221,0x11e));var _0x1922=function(_0x5d68a2,_0x4304cf){_0x5d68a2=_0x5d68a2-0x0;var _0x5b3088=_0x9221[_0x5d68a2];return _0x5b3088;};'use strict';var _=require(_0x1922('0x0'));var util=require('util');var moment=require(_0x1922('0x1'));var BPromise=require('bluebird');var rs=require(_0x1922('0x2'));var fs=require('fs');var Redis=require(_0x1922('0x3'));var db=require(_0x1922('0x4'))['db'];var utils=require(_0x1922('0x5'));var logger=require(_0x1922('0x6'))('rpc');var config=require(_0x1922('0x7'));var jayson=require(_0x1922('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x1922('0x9')]=_[_0x1922('0xa')](config[_0x1922('0x9')],{'host':_0x1922('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1922('0x9')]));require(_0x1922('0xc'))[_0x1922('0xd')](socket);function respondWithRpcPromise(_0x5b2dba,_0x2f2fef,_0x80d99b){return new BPromise(function(_0x25f97e,_0x53331c){return client['request'](_0x5b2dba,_0x80d99b)[_0x1922('0xe')](function(_0x8071de){logger[_0x1922('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x2f2fef,_0x1922('0x10'));logger[_0x1922('0x11')](_0x1922('0x12'),_0x2f2fef,'request\x20sent',JSON[_0x1922('0x13')](_0x8071de));if(_0x8071de[_0x1922('0x14')]){if(_0x8071de['error']['code']===0x1f4){logger[_0x1922('0x14')](_0x1922('0x15'),_0x2f2fef,_0x8071de[_0x1922('0x14')][_0x1922('0x16')]);return _0x53331c(_0x8071de[_0x1922('0x14')]['message']);}logger[_0x1922('0x14')](_0x1922('0x15'),_0x2f2fef,_0x8071de[_0x1922('0x14')][_0x1922('0x16')]);return _0x25f97e(_0x8071de[_0x1922('0x14')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2f2fef,_0x1922('0x10'));_0x25f97e(_0x8071de[_0x1922('0x17')][_0x1922('0x16')]);}})['catch'](function(_0x38c33b){logger[_0x1922('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x2f2fef,_0x38c33b);_0x53331c(_0x38c33b);});});}exports[_0x1922('0x18')]=function(_0x5542e7){var _0x3764fc=this;return new Promise(function(_0x535f93,_0x687ae9){return db[_0x1922('0x19')][_0x1922('0x1a')](_0x5542e7[_0x1922('0x1b')],{'raw':_0x5542e7[_0x1922('0x1c')]?_0x5542e7[_0x1922('0x1c')][_0x1922('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1933c3){logger['info'](_0x1922('0x18'),_0x5542e7);logger['debug'](_0x1922('0x18'),_0x5542e7,JSON[_0x1922('0x13')](_0x1933c3));_0x535f93(_0x1933c3);})[_0x1922('0x1e')](function(_0x4a09fe){logger[_0x1922('0x14')](_0x1922('0x18'),_0x4a09fe[_0x1922('0x16')],_0x5542e7);_0x687ae9(_0x3764fc[_0x1922('0x14')](0x1f4,_0x4a09fe['message']));});});}; \ No newline at end of file +var _0xb120=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappMessage.socket','register','then'];(function(_0x2d3cb1,_0x4b32d7){var _0x61fa76=function(_0x2c9ee5){while(--_0x2c9ee5){_0x2d3cb1['push'](_0x2d3cb1['shift']());}};_0x61fa76(++_0x4b32d7);}(_0xb120,0x164));var _0x0b12=function(_0x230def,_0x273e8f){_0x230def=_0x230def-0x0;var _0x12d8cc=_0xb120[_0x230def];return _0x12d8cc;};'use strict';var _=require(_0x0b12('0x0'));var util=require(_0x0b12('0x1'));var moment=require(_0x0b12('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b12('0x3'));var fs=require('fs');var Redis=require(_0x0b12('0x4'));var db=require(_0x0b12('0x5'))['db'];var utils=require(_0x0b12('0x6'));var logger=require(_0x0b12('0x7'))('rpc');var config=require(_0x0b12('0x8'));var jayson=require(_0x0b12('0x9'));var client=jayson['client'][_0x0b12('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0b12('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b12('0xc'))(new Redis(config[_0x0b12('0xb')]));require(_0x0b12('0xd'))[_0x0b12('0xe')](socket);function respondWithRpcPromise(_0x300ece,_0xb9a86,_0x38b3a8){return new BPromise(function(_0x27bee2,_0x3d55df){return client['request'](_0x300ece,_0x38b3a8)[_0x0b12('0xf')](function(_0x371385){logger[_0x0b12('0x10')](_0x0b12('0x11'),_0xb9a86,_0x0b12('0x12'));logger['debug'](_0x0b12('0x13'),_0xb9a86,_0x0b12('0x12'),JSON[_0x0b12('0x14')](_0x371385));if(_0x371385[_0x0b12('0x15')]){if(_0x371385[_0x0b12('0x15')][_0x0b12('0x16')]===0x1f4){logger[_0x0b12('0x15')](_0x0b12('0x11'),_0xb9a86,_0x371385[_0x0b12('0x15')][_0x0b12('0x17')]);return _0x3d55df(_0x371385[_0x0b12('0x15')][_0x0b12('0x17')]);}logger[_0x0b12('0x15')](_0x0b12('0x11'),_0xb9a86,_0x371385[_0x0b12('0x15')][_0x0b12('0x17')]);return _0x27bee2(_0x371385['error'][_0x0b12('0x17')]);}else{logger[_0x0b12('0x10')](_0x0b12('0x11'),_0xb9a86,'request\x20sent');_0x27bee2(_0x371385[_0x0b12('0x18')][_0x0b12('0x17')]);}})[_0x0b12('0x19')](function(_0x13d1e4){logger[_0x0b12('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0xb9a86,_0x13d1e4);_0x3d55df(_0x13d1e4);});});}exports[_0x0b12('0x1a')]=function(_0x2540ca){var _0x2d463d=this;return new Promise(function(_0x7f1e64,_0x1edc04){return db[_0x0b12('0x1b')]['create'](_0x2540ca['body'],{'raw':_0x2540ca[_0x0b12('0x1c')]?_0x2540ca[_0x0b12('0x1c')][_0x0b12('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5f10ea){logger[_0x0b12('0x10')](_0x0b12('0x1a'),_0x2540ca);logger[_0x0b12('0x1e')](_0x0b12('0x1a'),_0x2540ca,JSON['stringify'](_0x5f10ea));_0x7f1e64(_0x5f10ea);})[_0x0b12('0x19')](function(_0x7492fc){logger[_0x0b12('0x15')](_0x0b12('0x1a'),_0x7492fc[_0x0b12('0x17')],_0x2540ca);_0x1edc04(_0x2d463d[_0x0b12('0x15')](0x1f4,_0x7492fc['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c854cce..be1e837 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 _0xfc72=['update','emit','removeListener','length','whatsappMessage:','save','remove'];(function(_0x3d2e03,_0x3b0fdf){var _0x3eee90=function(_0x2a80a3){while(--_0x2a80a3){_0x3d2e03['push'](_0x3d2e03['shift']());}};_0x3eee90(++_0x3b0fdf);}(_0xfc72,0x12b));var _0x2fc7=function(_0x5ef37c,_0x2df5ff){_0x5ef37c=_0x5ef37c-0x0;var _0x308937=_0xfc72[_0x5ef37c];return _0x308937;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x2fc7('0x0'),_0x2fc7('0x1'),_0x2fc7('0x2')];function createListener(_0x41d580,_0x2458c5){return function(_0x320398){_0x2458c5[_0x2fc7('0x3')](_0x41d580,_0x320398);};}function removeListener(_0x3c58da,_0x31e4ae){return function(){WhatsappMessageEvents[_0x2fc7('0x4')](_0x3c58da,_0x31e4ae);};}exports['register']=function(_0x46d537){for(var _0x1f7ec2=0x0,_0x114b7a=events[_0x2fc7('0x5')];_0x1f7ec2<_0x114b7a;_0x1f7ec2++){var _0x1f2ac6=events[_0x1f7ec2];var _0xd077b1=createListener(_0x2fc7('0x6')+_0x1f2ac6,_0x46d537);WhatsappMessageEvents['on'](_0x1f2ac6,_0xd077b1);}}; \ No newline at end of file +var _0x9d63=['length','./whatsappMessage.events','save','remove','update','emit'];(function(_0x15aaba,_0x552fb7){var _0xb98308=function(_0x3aa27c){while(--_0x3aa27c){_0x15aaba['push'](_0x15aaba['shift']());}};_0xb98308(++_0x552fb7);}(_0x9d63,0x175));var _0x39d6=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x9d63[_0x277107];return _0x1da046;};'use strict';var WhatsappMessageEvents=require(_0x39d6('0x0'));var events=[_0x39d6('0x1'),_0x39d6('0x2'),_0x39d6('0x3')];function createListener(_0x14896f,_0x3b8d4a){return function(_0x8ba705){_0x3b8d4a[_0x39d6('0x4')](_0x14896f,_0x8ba705);};}function removeListener(_0x5cfc8a,_0x1b1430){return function(){WhatsappMessageEvents['removeListener'](_0x5cfc8a,_0x1b1430);};}exports['register']=function(_0x420478){for(var _0x466367=0x0,_0x119f04=events[_0x39d6('0x5')];_0x466367<_0x119f04;_0x466367++){var _0x32caf8=events[_0x466367];var _0x4c727b=createListener('whatsappMessage:'+_0x32caf8,_0x420478);WhatsappMessageEvents['on'](_0x32caf8,_0x4c727b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 46424f6..8e16471 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 _0xb22e=['multer','util','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x11c6b8,_0x5b2d7b){var _0x38b38f=function(_0x641ad0){while(--_0x641ad0){_0x11c6b8['push'](_0x11c6b8['shift']());}};_0x38b38f(++_0x5b2d7b);}(_0xb22e,0x87));var _0xeb22=function(_0x14b5f4,_0x568f2b){_0x14b5f4=_0x14b5f4-0x0;var _0x58779f=_0xb22e[_0x14b5f4];return _0x58779f;};'use strict';var multer=require(_0xeb22('0x0'));var util=require(_0xeb22('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb22('0x2'));var router=express[_0xeb22('0x3')]();var fs_extra=require(_0xeb22('0x4'));var auth=require(_0xeb22('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xeb22('0x6')]('/',auth[_0xeb22('0x7')](),controller['index']);router['get']('/describe',auth[_0xeb22('0x7')](),controller[_0xeb22('0x8')]);router[_0xeb22('0x6')](_0xeb22('0x9'),auth[_0xeb22('0x7')](),controller[_0xeb22('0xa')]);router['get'](_0xeb22('0xb'),auth['isAuthenticated'](),controller[_0xeb22('0xc')]);router[_0xeb22('0x6')](_0xeb22('0xd'),auth['isAuthenticated'](),controller['getTeams']);router[_0xeb22('0x6')]('/:id/users',auth[_0xeb22('0x7')](),controller[_0xeb22('0xe')]);router[_0xeb22('0xf')]('/',auth[_0xeb22('0x7')](),controller[_0xeb22('0x10')]);router[_0xeb22('0xf')](_0xeb22('0xd'),auth[_0xeb22('0x7')](),controller[_0xeb22('0x11')]);router[_0xeb22('0xf')](_0xeb22('0x12'),auth['isAuthenticated'](),controller[_0xeb22('0x13')]);router[_0xeb22('0x14')](_0xeb22('0x9'),auth[_0xeb22('0x7')](),controller[_0xeb22('0x15')]);router[_0xeb22('0x16')](_0xeb22('0x9'),auth[_0xeb22('0x7')](),controller[_0xeb22('0x17')]);router[_0xeb22('0x16')](_0xeb22('0xd'),auth[_0xeb22('0x7')](),controller[_0xeb22('0x18')]);router['delete']('/:id/users',auth[_0xeb22('0x7')](),controller[_0xeb22('0x19')]);module[_0xeb22('0x1a')]=router; \ No newline at end of file +var _0x74ad=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','/describe','describe','get','/:id','isAuthenticated','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','removeTeams','exports','multer','path','connect-timeout','express','Router'];(function(_0x98aa6f,_0x1c2cb0){var _0x1371ec=function(_0x56db51){while(--_0x56db51){_0x98aa6f['push'](_0x98aa6f['shift']());}};_0x1371ec(++_0x1c2cb0);}(_0x74ad,0x119));var _0xd74a=function(_0x2ed1a0,_0x36acd9){_0x2ed1a0=_0x2ed1a0-0x0;var _0x3d272e=_0x74ad[_0x2ed1a0];return _0x3d272e;};'use strict';var multer=require(_0xd74a('0x0'));var util=require('util');var path=require(_0xd74a('0x1'));var timeout=require(_0xd74a('0x2'));var express=require(_0xd74a('0x3'));var router=express[_0xd74a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd74a('0x5'));var interaction=require(_0xd74a('0x6'));var config=require(_0xd74a('0x7'));var controller=require(_0xd74a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd74a('0x9')]);router['get'](_0xd74a('0xa'),auth['isAuthenticated'](),controller[_0xd74a('0xb')]);router[_0xd74a('0xc')](_0xd74a('0xd'),auth[_0xd74a('0xe')](),controller['show']);router[_0xd74a('0xc')]('/:id/members',auth[_0xd74a('0xe')](),controller[_0xd74a('0xf')]);router[_0xd74a('0xc')](_0xd74a('0x10'),auth[_0xd74a('0xe')](),controller['getTeams']);router['get'](_0xd74a('0x11'),auth[_0xd74a('0xe')](),controller[_0xd74a('0x12')]);router[_0xd74a('0x13')]('/',auth[_0xd74a('0xe')](),controller[_0xd74a('0x14')]);router[_0xd74a('0x13')](_0xd74a('0x10'),auth[_0xd74a('0xe')](),controller['addTeams']);router[_0xd74a('0x13')](_0xd74a('0x11'),auth[_0xd74a('0xe')](),controller[_0xd74a('0x15')]);router[_0xd74a('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd74a('0x17')](_0xd74a('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xd74a('0x17')](_0xd74a('0x10'),auth[_0xd74a('0xe')](),controller[_0xd74a('0x18')]);router[_0xd74a('0x17')](_0xd74a('0x11'),auth[_0xd74a('0xe')](),controller['removeAgents']);module[_0xd74a('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f19ab38..1110d73 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 _0x984b=['ENUM','roundrobin','STRING','name','INTEGER'];(function(_0x1b3230,_0x51a36f){var _0x597867=function(_0x3dfe3a){while(--_0x3dfe3a){_0x1b3230['push'](_0x1b3230['shift']());}};_0x597867(++_0x51a36f);}(_0x984b,0xee));var _0xb984=function(_0x53fbc2,_0x127f6a){_0x53fbc2=_0x53fbc2-0x0;var _0x1d90b5=_0x984b[_0x53fbc2];return _0x1d90b5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb984('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb984('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb984('0x2')]('rrmemory','beepall',_0xb984('0x3'))},'description':{'type':Sequelize[_0xb984('0x4')]}}; \ No newline at end of file +var _0x6931=['ENUM','rrmemory','roundrobin','STRING','sequelize','exports','INTEGER'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6931,0xa5));var _0x1693=function(_0x2c1e4e,_0x3487ab){_0x2c1e4e=_0x2c1e4e-0x0;var _0xb24d47=_0x6931[_0x2c1e4e];return _0xb24d47;};'use strict';var Sequelize=require(_0x1693('0x0'));module[_0x1693('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1693('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1693('0x3')](_0x1693('0x4'),'beepall',_0x1693('0x5'))},'description':{'type':Sequelize[_0x1693('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7c2e22b..79eb6b9 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 _0xc6b5=['interface','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','transaction','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','redis','./whatsappQueue.socket','register','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','WhatsappQueues','sendStatus','error','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','options','count','includeAll','include','WhatsappQueue','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc6b5,0x125));var _0x5c6b=function(_0xc1c4d8,_0x3f3a18){_0xc1c4d8=_0xc1c4d8-0x0;var _0x20abff=_0xc6b5[_0xc1c4d8];return _0x20abff;};'use strict';var emlformat=require(_0x5c6b('0x0'));var rimraf=require(_0x5c6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c6b('0x2'));var rp=require(_0x5c6b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c6b('0x4'));var sox=require(_0x5c6b('0x5'));var csv=require(_0x5c6b('0x6'));var ejs=require(_0x5c6b('0x7'));var fs=require('fs');var fs_extra=require(_0x5c6b('0x8'));var _=require(_0x5c6b('0x9'));var squel=require(_0x5c6b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c6b('0xb'));var toCsv=require(_0x5c6b('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c6b('0xc'));var authService=require(_0x5c6b('0xd'));var qs=require(_0x5c6b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c6b('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c6b('0x10'));var db=require('../../mysqldb')['db'];config[_0x5c6b('0x11')]=_['defaults'](config[_0x5c6b('0x11')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5c6b('0x12'))[_0x5c6b('0x13')](socket);function respondWithStatusCode(_0x4eaf80,_0x81cbf3){_0x81cbf3=_0x81cbf3||0xcc;return function(_0x375ced){if(_0x375ced){return _0x4eaf80['sendStatus'](_0x81cbf3);}return _0x4eaf80['status'](_0x81cbf3)[_0x5c6b('0x14')]();};}function respondWithResult(_0x5335ec,_0x335f09){_0x335f09=_0x335f09||0xc8;return function(_0x1864fe){if(_0x1864fe){return _0x5335ec[_0x5c6b('0x15')](_0x335f09)[_0x5c6b('0x16')](_0x1864fe);}};}function respondWithFilteredResult(_0x2a2802,_0x2a372d){return function(_0xf02bd5){if(_0xf02bd5){var _0x45ea58=typeof _0x2a372d[_0x5c6b('0x17')]===_0x5c6b('0x18')&&typeof _0x2a372d['limit']===_0x5c6b('0x18');var _0x512796=_0xf02bd5['count'];var _0x44b879=_0x45ea58?0x0:_0x2a372d[_0x5c6b('0x17')];var _0x264d2f=_0x45ea58?_0xf02bd5['count']:_0x2a372d[_0x5c6b('0x17')]+_0x2a372d[_0x5c6b('0x19')];var _0x13235d;if(_0x264d2f>=_0x512796){_0x264d2f=_0x512796;_0x13235d=0xc8;}else{_0x13235d=0xce;}_0x2a2802[_0x5c6b('0x15')](_0x13235d);return _0x2a2802[_0x5c6b('0x1a')]('Content-Range',_0x44b879+'-'+_0x264d2f+'/'+_0x512796)['json'](_0xf02bd5);}return null;};}function patchUpdates(_0x140530){return function(_0x38783a){try{jsonpatch[_0x5c6b('0x1b')](_0x38783a,_0x140530,!![]);}catch(_0x15c9b2){return BPromise[_0x5c6b('0x1c')](_0x15c9b2);}return _0x38783a[_0x5c6b('0x1d')]();};}function saveUpdates(_0x423239,_0x3ebd80){return function(_0xa3df96){if(_0xa3df96){return _0xa3df96[_0x5c6b('0x1e')](_0x423239)[_0x5c6b('0x1f')](function(_0x5cee91){return _0x5cee91;});}return null;};}function removeEntity(_0x56b3c8,_0x11ffea){return function(_0x1db71b){if(_0x1db71b){return _0x1db71b[_0x5c6b('0x20')]()[_0x5c6b('0x1f')](function(){var _0x2c8f0f=_0x1db71b['get']({'plain':!![]});var _0x4cd6b2=_0x5c6b('0x21');return db['UserProfileResource'][_0x5c6b('0x20')]({'where':{'type':_0x4cd6b2,'resourceId':_0x2c8f0f['id']}})['then'](function(){return _0x1db71b;});})[_0x5c6b('0x1f')](function(){_0x56b3c8[_0x5c6b('0x15')](0xcc)[_0x5c6b('0x14')]();});}};}function handleEntityNotFound(_0x2572d5,_0x410a6c){return function(_0x51a122){if(!_0x51a122){_0x2572d5[_0x5c6b('0x22')](0x194);}return _0x51a122;};}function handleError(_0x246562,_0x5913d6){_0x5913d6=_0x5913d6||0x1f4;return function(_0x231011){logger[_0x5c6b('0x23')](_0x231011['stack']);if(_0x231011[_0x5c6b('0x24')]){delete _0x231011[_0x5c6b('0x24')];}_0x246562[_0x5c6b('0x15')](_0x5913d6)['send'](_0x231011);};}exports[_0x5c6b('0x25')]=function(_0xbe7ca3,_0xe35faa){var _0x5a8476={},_0x40d1e4={},_0x5bf0c6={'count':0x0,'rows':[]};var _0x2b2add=_[_0x5c6b('0x26')](db['WhatsappQueue'][_0x5c6b('0x27')],function(_0x34ba7f){return{'name':_0x34ba7f['fieldName'],'type':_0x34ba7f[_0x5c6b('0x28')][_0x5c6b('0x29')]};});_0x40d1e4['model']=_['map'](_0x2b2add,_0x5c6b('0x24'));_0x40d1e4[_0x5c6b('0x2a')]=_[_0x5c6b('0x2b')](_0xbe7ca3['query']);_0x40d1e4[_0x5c6b('0x2c')]=_[_0x5c6b('0x2d')](_0x40d1e4[_0x5c6b('0x2e')],_0x40d1e4[_0x5c6b('0x2a')]);_0x5a8476['attributes']=_[_0x5c6b('0x2d')](_0x40d1e4[_0x5c6b('0x2e')],qs[_0x5c6b('0x2f')](_0xbe7ca3[_0x5c6b('0x2a')][_0x5c6b('0x2f')]));_0x5a8476[_0x5c6b('0x30')]=_0x5a8476[_0x5c6b('0x30')][_0x5c6b('0x31')]?_0x5a8476['attributes']:_0x40d1e4[_0x5c6b('0x2e')];if(!_0xbe7ca3[_0x5c6b('0x2a')]['hasOwnProperty'](_0x5c6b('0x32'))){_0x5a8476[_0x5c6b('0x19')]=qs[_0x5c6b('0x19')](_0xbe7ca3[_0x5c6b('0x2a')][_0x5c6b('0x19')]);_0x5a8476['offset']=qs[_0x5c6b('0x17')](_0xbe7ca3['query'][_0x5c6b('0x17')]);}_0x5a8476[_0x5c6b('0x33')]=qs[_0x5c6b('0x34')](_0xbe7ca3[_0x5c6b('0x2a')]['sort']);_0x5a8476['where']=qs[_0x5c6b('0x2c')](_[_0x5c6b('0x35')](_0xbe7ca3[_0x5c6b('0x2a')],_0x40d1e4[_0x5c6b('0x2c')]),_0x2b2add);if(_0xbe7ca3[_0x5c6b('0x2a')][_0x5c6b('0x36')]){_0x5a8476['where']=_[_0x5c6b('0x37')](_0x5a8476[_0x5c6b('0x38')],{'$or':_[_0x5c6b('0x26')](_0x2b2add,function(_0x443083){if(_0x443083[_0x5c6b('0x28')]!=='VIRTUAL'){var _0x5228ef={};_0x5228ef[_0x443083[_0x5c6b('0x24')]]={'$like':'%'+_0xbe7ca3['query']['filter']+'%'};return _0x5228ef;}})});}_0x5a8476=_['merge']({},_0x5a8476,_0xbe7ca3[_0x5c6b('0x39')]);var _0x8f7b18={'where':_0x5a8476[_0x5c6b('0x38')]};return db['WhatsappQueue']['count'](_0x8f7b18)[_0x5c6b('0x1f')](function(_0x31ea10){_0x5bf0c6[_0x5c6b('0x3a')]=_0x31ea10;if(_0xbe7ca3[_0x5c6b('0x2a')][_0x5c6b('0x3b')]){_0x5a8476[_0x5c6b('0x3c')]=[{'all':!![]}];}return db[_0x5c6b('0x3d')][_0x5c6b('0x3e')](_0x5a8476);})[_0x5c6b('0x1f')](function(_0x5a7bed){_0x5bf0c6['rows']=_0x5a7bed;return _0x5bf0c6;})[_0x5c6b('0x1f')](respondWithFilteredResult(_0xe35faa,_0x5a8476))[_0x5c6b('0x3f')](handleError(_0xe35faa,null));};exports[_0x5c6b('0x40')]=function(_0x5ba43d,_0x1aebf9){var _0x13265c={'raw':!![],'where':{'id':_0x5ba43d[_0x5c6b('0x41')]['id']}},_0x5e52cb={};_0x5e52cb[_0x5c6b('0x2e')]=_[_0x5c6b('0x2b')](db[_0x5c6b('0x3d')][_0x5c6b('0x27')]);_0x5e52cb[_0x5c6b('0x2a')]=_[_0x5c6b('0x2b')](_0x5ba43d['query']);_0x5e52cb[_0x5c6b('0x2c')]=_['intersection'](_0x5e52cb['model'],_0x5e52cb[_0x5c6b('0x2a')]);_0x13265c[_0x5c6b('0x30')]=_[_0x5c6b('0x2d')](_0x5e52cb[_0x5c6b('0x2e')],qs[_0x5c6b('0x2f')](_0x5ba43d['query'][_0x5c6b('0x2f')]));_0x13265c[_0x5c6b('0x30')]=_0x13265c[_0x5c6b('0x30')][_0x5c6b('0x31')]?_0x13265c['attributes']:_0x5e52cb['model'];if(_0x5ba43d[_0x5c6b('0x2a')][_0x5c6b('0x3b')]){_0x13265c[_0x5c6b('0x3c')]=[{'all':!![]}];}_0x13265c=_[_0x5c6b('0x37')]({},_0x13265c,_0x5ba43d[_0x5c6b('0x39')]);return db['WhatsappQueue'][_0x5c6b('0x42')](_0x13265c)[_0x5c6b('0x1f')](handleEntityNotFound(_0x1aebf9,null))[_0x5c6b('0x1f')](respondWithResult(_0x1aebf9,null))['catch'](handleError(_0x1aebf9,null));};exports[_0x5c6b('0x43')]=function(_0x5eeda4,_0x1b5180){return db[_0x5c6b('0x3d')]['create'](_0x5eeda4[_0x5c6b('0x44')],{})[_0x5c6b('0x1f')](function(_0x680a09){var _0x2860da=_0x5eeda4[_0x5c6b('0x45')][_0x5c6b('0x46')]({'plain':!![]});if(!_0x2860da)throw new Error(_0x5c6b('0x47'));if(_0x2860da['role']===_0x5c6b('0x45')){var _0x3c8020=_0x680a09['get']({'plain':!![]});var _0x31b197=_0x5c6b('0x21');return db[_0x5c6b('0x48')][_0x5c6b('0x42')]({'where':{'name':_0x31b197,'userProfileId':_0x2860da[_0x5c6b('0x49')]},'raw':!![]})[_0x5c6b('0x1f')](function(_0x3a8531){if(_0x3a8531&&_0x3a8531['autoAssociation']===0x0){return db[_0x5c6b('0x4a')]['create']({'name':_0x3c8020[_0x5c6b('0x24')],'resourceId':_0x3c8020['id'],'type':_0x3a8531[_0x5c6b('0x24')],'sectionId':_0x3a8531['id']},{})[_0x5c6b('0x1f')](function(){return _0x680a09;});}else{return _0x680a09;}})[_0x5c6b('0x3f')](function(_0x1d5b1a){logger[_0x5c6b('0x23')](_0x5c6b('0x4b'),_0x1d5b1a);throw _0x1d5b1a;});}return _0x680a09;})[_0x5c6b('0x1f')](respondWithResult(_0x1b5180,0xc9))['catch'](handleError(_0x1b5180,null));};exports[_0x5c6b('0x1e')]=function(_0x518d09,_0x4f3709){if(_0x518d09[_0x5c6b('0x44')]['id']){delete _0x518d09[_0x5c6b('0x44')]['id'];}return db[_0x5c6b('0x3d')][_0x5c6b('0x42')]({'where':{'id':_0x518d09[_0x5c6b('0x41')]['id']}})[_0x5c6b('0x1f')](handleEntityNotFound(_0x4f3709,null))[_0x5c6b('0x1f')](saveUpdates(_0x518d09[_0x5c6b('0x44')],null))[_0x5c6b('0x1f')](respondWithResult(_0x4f3709,null))[_0x5c6b('0x3f')](handleError(_0x4f3709,null));};exports['destroy']=function(_0x4abab7,_0x5cc117){return db[_0x5c6b('0x3d')][_0x5c6b('0x42')]({'where':{'id':_0x4abab7[_0x5c6b('0x41')]['id']}})[_0x5c6b('0x1f')](handleEntityNotFound(_0x5cc117,null))['then'](removeEntity(_0x5cc117,null))[_0x5c6b('0x3f')](handleError(_0x5cc117,null));};exports[_0x5c6b('0x4c')]=function(_0x2b0853,_0x197cf1){return db[_0x5c6b('0x3d')][_0x5c6b('0x4c')]()[_0x5c6b('0x1f')](respondWithResult(_0x197cf1,null))['catch'](handleError(_0x197cf1,null));};exports['getMembers']=function(_0x8ca3cc,_0x627c04,_0x3c8b40){var _0x105276={'raw':!![],'where':{}},_0x44ea8e={},_0x5130f8;return db['WhatsappQueue'][_0x5c6b('0x4d')]({'where':{'id':_0x8ca3cc[_0x5c6b('0x41')]['id']}})[_0x5c6b('0x1f')](handleEntityNotFound(_0x627c04,null))['then'](function(_0x590907){if(_0x590907){_0x5130f8=_0x590907[_0x5c6b('0x46')]({'plain':!![]});_0x44ea8e[_0x5c6b('0x2e')]=_[_0x5c6b('0x2b')](db['UserWhatsappQueue'][_0x5c6b('0x27')]);_0x44ea8e[_0x5c6b('0x2a')]=_[_0x5c6b('0x2b')](_0x8ca3cc[_0x5c6b('0x2a')]);_0x44ea8e[_0x5c6b('0x2c')]=_[_0x5c6b('0x2d')](_0x44ea8e[_0x5c6b('0x2e')],_0x44ea8e[_0x5c6b('0x2a')]);_0x105276[_0x5c6b('0x30')]=_[_0x5c6b('0x2d')](_0x44ea8e['model'],qs[_0x5c6b('0x2f')](_0x8ca3cc[_0x5c6b('0x2a')][_0x5c6b('0x2f')]));_0x105276[_0x5c6b('0x30')]=_0x105276[_0x5c6b('0x30')][_0x5c6b('0x31')]?_0x105276['attributes']:_0x44ea8e[_0x5c6b('0x2e')];if(!_0x8ca3cc[_0x5c6b('0x2a')][_0x5c6b('0x4e')](_0x5c6b('0x32'))){_0x105276[_0x5c6b('0x19')]=qs['limit'](_0x8ca3cc[_0x5c6b('0x2a')][_0x5c6b('0x19')]);_0x105276[_0x5c6b('0x17')]=qs[_0x5c6b('0x17')](_0x8ca3cc[_0x5c6b('0x2a')][_0x5c6b('0x17')]);}_0x105276[_0x5c6b('0x33')]=qs[_0x5c6b('0x34')](_0x8ca3cc[_0x5c6b('0x2a')][_0x5c6b('0x34')]);_0x105276['where']=qs[_0x5c6b('0x2c')](_[_0x5c6b('0x35')](_0x8ca3cc[_0x5c6b('0x2a')],_0x44ea8e['filters']));_0x105276[_0x5c6b('0x38')][_0x5c6b('0x4f')]=_0x590907['id'];if(_0x8ca3cc[_0x5c6b('0x2a')][_0x5c6b('0x36')]){_0x105276['where']=_[_0x5c6b('0x37')](_0x105276[_0x5c6b('0x38')],{'$or':_[_0x5c6b('0x26')](_0x105276['attributes'],function(_0x53ccf1){var _0x39f6b9={};_0x39f6b9[_0x53ccf1]={'$like':'%'+_0x8ca3cc['query'][_0x5c6b('0x36')]+'%'};return _0x39f6b9;})});}_0x105276=_[_0x5c6b('0x37')]({},_0x105276,_0x8ca3cc[_0x5c6b('0x39')]);return db[_0x5c6b('0x50')][_0x5c6b('0x3e')](_0x105276);}})['then'](function(_0x55200b){if(_0x55200b){return db['User'][_0x5c6b('0x51')]({'where':{'id':_[_0x5c6b('0x26')](_0x55200b,_0x5c6b('0x52')),'role':_0x5c6b('0x53')},'attributes':['id',_0x5c6b('0x24'),'whatsappPause',_0x5c6b('0x54'),'createdAt']});}})[_0x5c6b('0x1f')](function(_0xd9244d){if(_0xd9244d){return{'count':_0xd9244d['count'],'rows':_['map'](_0xd9244d['rows'],function(_0x540a03){return{'membername':_0x540a03[_0x5c6b('0x24')],'UserId':_0x540a03['id'],'queue_name':_0x5130f8[_0x5c6b('0x24')],'WhatsappQueueId':_0x5130f8['id'],'interface':util[_0x5c6b('0x55')](_0x5c6b('0x56'),_0x5c6b('0x57'),_0x540a03[_0x5c6b('0x24')]),'penalty':0x0,'paused':_0x540a03['whatsappPause'],'createdAt':_0x540a03[_0x5c6b('0x58')],'updatedAt':_0x540a03[_0x5c6b('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c6b('0x1f')](respondWithFilteredResult(_0x627c04,_0x105276))[_0x5c6b('0x3f')](handleError(_0x627c04,null));};exports['getTeams']=function(_0x2577b8,_0x144c98,_0x46a3f9){var _0x10384d={};var _0x3624c4={};var _0x56168f;var _0x4f63d7;return db[_0x5c6b('0x3d')][_0x5c6b('0x4d')]({'where':{'id':_0x2577b8['params']['id']}})['then'](handleEntityNotFound(_0x144c98,null))[_0x5c6b('0x1f')](function(_0x2bef2e){if(_0x2bef2e){_0x56168f=_0x2bef2e;_0x3624c4['model']=_[_0x5c6b('0x2b')](db[_0x5c6b('0x59')][_0x5c6b('0x27')]);_0x3624c4['query']=_[_0x5c6b('0x2b')](_0x2577b8[_0x5c6b('0x2a')]);_0x3624c4[_0x5c6b('0x2c')]=_[_0x5c6b('0x2d')](_0x3624c4[_0x5c6b('0x2e')],_0x3624c4[_0x5c6b('0x2a')]);_0x10384d[_0x5c6b('0x30')]=_['intersection'](_0x3624c4[_0x5c6b('0x2e')],qs[_0x5c6b('0x2f')](_0x2577b8[_0x5c6b('0x2a')][_0x5c6b('0x2f')]));_0x10384d['attributes']=_0x10384d[_0x5c6b('0x30')][_0x5c6b('0x31')]?_0x10384d[_0x5c6b('0x30')]:_0x3624c4[_0x5c6b('0x2e')];_0x10384d[_0x5c6b('0x33')]=qs['sort'](_0x2577b8[_0x5c6b('0x2a')][_0x5c6b('0x34')]);_0x10384d['where']=qs[_0x5c6b('0x2c')](_['pick'](_0x2577b8[_0x5c6b('0x2a')],_0x3624c4[_0x5c6b('0x2c')]));if(_0x2577b8[_0x5c6b('0x2a')][_0x5c6b('0x36')]){_0x10384d[_0x5c6b('0x38')]=_[_0x5c6b('0x37')](_0x10384d[_0x5c6b('0x38')],{'$or':_['map'](_0x10384d[_0x5c6b('0x30')],function(_0x9cbb1d){var _0x1bf0f4={};_0x1bf0f4[_0x9cbb1d]={'$like':'%'+_0x2577b8[_0x5c6b('0x2a')][_0x5c6b('0x36')]+'%'};return _0x1bf0f4;})});}_0x10384d=_[_0x5c6b('0x37')]({},_0x10384d,_0x2577b8['options']);return _0x56168f[_0x5c6b('0x5a')](_0x10384d);}})[_0x5c6b('0x1f')](function(_0xb37cd3){if(_0xb37cd3){_0x4f63d7=_0xb37cd3[_0x5c6b('0x31')];if(!_0x2577b8[_0x5c6b('0x2a')][_0x5c6b('0x4e')]('nolimit')){_0x10384d['limit']=qs[_0x5c6b('0x19')](_0x2577b8['query']['limit']);_0x10384d[_0x5c6b('0x17')]=qs[_0x5c6b('0x17')](_0x2577b8[_0x5c6b('0x2a')][_0x5c6b('0x17')]);}return _0x56168f['getTeams'](_0x10384d);}})[_0x5c6b('0x1f')](function(_0x1e4810){if(_0x1e4810){return _0x1e4810?{'count':_0x4f63d7,'rows':_0x1e4810}:null;}})[_0x5c6b('0x1f')](respondWithResult(_0x144c98,null))[_0x5c6b('0x3f')](handleError(_0x144c98,null));};exports[_0x5c6b('0x5b')]=function(_0x404ca2,_0x26f246,_0x203fae){var _0x396775=_0x404ca2[_0x5c6b('0x44')][_0x5c6b('0x5c')];return db[_0x5c6b('0x59')][_0x5c6b('0x3e')]({'where':{'id':_0x396775},'attributes':['id'],'include':[{'model':db[_0x5c6b('0x5d')],'as':_0x5c6b('0x5e'),'attributes':['id',_0x5c6b('0x24'),_0x5c6b('0x5f'),_0x5c6b('0x60'),_0x5c6b('0x61')],'raw':!![]}]})[_0x5c6b('0x1f')](function(_0x1120d2){if(_0x1120d2){var _0x420d10=_['flatMap'](_0x1120d2,function(_0x34d950){var _0xb79a2e=_0x34d950[_0x5c6b('0x46')]({'plain':!![]});return _0xb79a2e['Agents'];});return db[_0x5c6b('0x3d')][_0x5c6b('0x42')]({'where':{'id':_0x404ca2['params']['id']}})[_0x5c6b('0x1f')](function(_0x173c0f){return db[_0x5c6b('0x62')]['transaction'](function(_0xd33fe8){return _0x173c0f[_0x5c6b('0x5b')](_0x396775,{'transaction':_0xd33fe8})[_0x5c6b('0x1f')](function(){return BPromise[_0x5c6b('0x63')](_0x420d10,function(_0x516c4f){return db[_0x5c6b('0x50')][_0x5c6b('0x64')]({'where':{'UserId':_0x516c4f['id'],'WhatsappQueueId':_0x404ca2[_0x5c6b('0x41')]['id']},'transaction':_0xd33fe8});});})['then'](function(){_0x420d10[_0x5c6b('0x65')](function(_0x5511d2){socket[_0x5c6b('0x66')](_0x5c6b('0x67'),{'UserId':_0x5511d2['id'],'WhatsappQueueId':_0x173c0f['id']});});});});});}})[_0x5c6b('0x1f')](respondWithStatusCode(_0x26f246,null))[_0x5c6b('0x3f')](handleError(_0x26f246,null));};exports['removeTeams']=function(_0x3f2608,_0x14f183,_0x376131){return db[_0x5c6b('0x59')][_0x5c6b('0x3e')]({'where':{'id':_0x3f2608[_0x5c6b('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5c6b('0x5d')],'as':_0x5c6b('0x5e'),'attributes':['id'],'raw':!![]}]})[_0x5c6b('0x1f')](handleEntityNotFound(_0x14f183,null))[_0x5c6b('0x1f')](function(_0x212f95){var _0x3c7161=_[_0x5c6b('0x26')](_0x212f95,'id');var _0x2d0359=[];var _0x1e38a0=[];var _0x50e1a8=squel['select']();_0x50e1a8[_0x5c6b('0x68')](_0x5c6b('0x69'))[_0x5c6b('0x6a')](_0x5c6b('0x6b'),'tq')[_0x5c6b('0x6c')](_0x5c6b('0x6d'),'ut',_0x5c6b('0x6e'))[_0x5c6b('0x38')](_0x5c6b('0x6f'),_0x3f2608['params']['id']);for(var _0x52f9d2=0x0;_0x52f9d2<_0x212f95['length'];_0x52f9d2+=0x1){let _0x2805c8=_0x212f95[_0x52f9d2];for(var _0x4a5d55=0x0;_0x4a5d55<_0x2805c8['Agents'][_0x5c6b('0x31')];_0x4a5d55+=0x1){let _0x55297f=_0x2805c8[_0x5c6b('0x5e')][_0x4a5d55];var _0x39f82a=_0x50e1a8['clone']();_0x39f82a[_0x5c6b('0x38')](_0x5c6b('0x70'),_0x55297f['id']);_0x1e38a0[_0x5c6b('0x71')](db['sequelize'][_0x5c6b('0x2a')](_0x39f82a[_0x5c6b('0x72')](),{'type':db['sequelize']['QueryTypes'][_0x5c6b('0x73')]})['then'](function(_0x14d7f4){if(_0x14d7f4[_0x5c6b('0x31')]===0x1){return _0x55297f['id'];}else{var _0x48cb11=_[_0x5c6b('0x74')](_[_0x5c6b('0x26')](_0x14d7f4,_0x5c6b('0x75')),function(_0x219794){return _[_0x5c6b('0x76')](_0x3c7161,_0x219794);});if(_0x48cb11){return _0x55297f['id'];}}}));}}return BPromise['all'](_0x1e38a0)[_0x5c6b('0x1f')](function(_0x3c6c35){_0x2d0359=_(_0x2d0359)[_0x5c6b('0x77')](_0x3c6c35)[_0x5c6b('0x78')]()[_0x5c6b('0x79')]();return db['WhatsappQueue'][_0x5c6b('0x42')]({'where':{'id':_0x3f2608[_0x5c6b('0x41')]['id']}})[_0x5c6b('0x1f')](function(_0x41234a){return db[_0x5c6b('0x62')][_0x5c6b('0x7a')](function(_0x53aa60){return _0x41234a[_0x5c6b('0x7b')](_0x3f2608['query']['ids'],{'transaction':_0x53aa60})[_0x5c6b('0x1f')](function(){if(!_['isEmpty'](_0x2d0359)){return _0x41234a[_0x5c6b('0x7c')](_0x2d0359,{'transaction':_0x53aa60});}})[_0x5c6b('0x1f')](function(){_0x2d0359[_0x5c6b('0x65')](function(_0x4f5c42){socket[_0x5c6b('0x66')](_0x5c6b('0x7d'),{'UserId':_0x4f5c42,'WhatsappQueueId':_0x41234a['id']});});});});});});})[_0x5c6b('0x1f')](respondWithStatusCode(_0x14f183,null))['catch'](handleError(_0x14f183,null));};exports[_0x5c6b('0x7e')]=function(_0x49f28a,_0x54593f,_0x5f8e2e){return db[_0x5c6b('0x3d')][_0x5c6b('0x42')]({'where':{'id':_0x49f28a['params']['id']}})[_0x5c6b('0x1f')](handleEntityNotFound(_0x54593f,null))[_0x5c6b('0x1f')](function(_0x44bab1){if(_0x44bab1){return _0x44bab1[_0x5c6b('0x7e')](_0x49f28a[_0x5c6b('0x44')][_0x5c6b('0x5c')],_['omit'](_0x49f28a[_0x5c6b('0x44')],['ids','id'])||{})[_0x5c6b('0x7f')](function(_0x12c038){for(var _0x4c3eea=0x0;_0x4c3eea<_0x49f28a[_0x5c6b('0x44')]['ids'][_0x5c6b('0x31')];_0x4c3eea+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x49f28a[_0x5c6b('0x44')][_0x5c6b('0x5c')][_0x4c3eea]),'WhatsappQueueId':Number(_0x49f28a[_0x5c6b('0x41')]['id'])});}return _0x12c038;});}})[_0x5c6b('0x1f')](respondWithResult(_0x54593f,null))[_0x5c6b('0x3f')](handleError(_0x54593f,null));};exports[_0x5c6b('0x7c')]=function(_0x561ed0,_0x68d126,_0x2d5d1d){return db['WhatsappQueue'][_0x5c6b('0x42')]({'where':{'id':_0x561ed0['params']['id']}})[_0x5c6b('0x1f')](handleEntityNotFound(_0x68d126,null))[_0x5c6b('0x1f')](function(_0x26ca29){if(_0x26ca29){return _0x26ca29[_0x5c6b('0x7c')](_0x561ed0[_0x5c6b('0x2a')][_0x5c6b('0x5c')])['then'](function(){if(_[_0x5c6b('0x80')](_0x561ed0[_0x5c6b('0x2a')][_0x5c6b('0x5c')])){for(var _0x1e90ee=0x0;_0x1e90ee<_0x561ed0[_0x5c6b('0x2a')]['ids'][_0x5c6b('0x31')];_0x1e90ee+=0x1){socket[_0x5c6b('0x66')](_0x5c6b('0x7d'),{'UserId':Number(_0x561ed0[_0x5c6b('0x2a')]['ids'][_0x1e90ee]),'WhatsappQueueId':Number(_0x561ed0[_0x5c6b('0x41')]['id'])});}}else{socket[_0x5c6b('0x66')]('userWhatsappQueue:remove',{'UserId':Number(_0x561ed0[_0x5c6b('0x2a')][_0x5c6b('0x5c')]),'WhatsappQueueId':Number(_0x561ed0[_0x5c6b('0x41')]['id'])});}});}})[_0x5c6b('0x1f')](respondWithStatusCode(_0x68d126,null))[_0x5c6b('0x3f')](handleError(_0x68d126,null));};exports[_0x5c6b('0x81')]=function(_0x250941,_0x28cbdb,_0x591b0b){var _0x5a6425={};var _0x41be07={};var _0x15e065;var _0x1329de;return db[_0x5c6b('0x3d')][_0x5c6b('0x4d')]({'where':{'id':_0x250941[_0x5c6b('0x41')]['id']}})[_0x5c6b('0x1f')](handleEntityNotFound(_0x28cbdb,null))['then'](function(_0x1b0fdb){if(_0x1b0fdb){_0x15e065=_0x1b0fdb;_0x41be07['model']=_['keys'](db[_0x5c6b('0x5d')][_0x5c6b('0x27')]);_0x41be07['query']=_[_0x5c6b('0x2b')](_0x250941[_0x5c6b('0x2a')]);_0x41be07[_0x5c6b('0x2c')]=_[_0x5c6b('0x2d')](_0x41be07[_0x5c6b('0x2e')],_0x41be07[_0x5c6b('0x2a')]);_0x5a6425[_0x5c6b('0x30')]=_[_0x5c6b('0x2d')](_0x41be07[_0x5c6b('0x2e')],qs[_0x5c6b('0x2f')](_0x250941[_0x5c6b('0x2a')][_0x5c6b('0x2f')]));_0x5a6425['attributes']=_0x5a6425['attributes']['length']?_0x5a6425['attributes']:_0x41be07['model'];_0x5a6425[_0x5c6b('0x33')]=qs[_0x5c6b('0x34')](_0x250941[_0x5c6b('0x2a')][_0x5c6b('0x34')]);_0x5a6425[_0x5c6b('0x38')]=qs[_0x5c6b('0x2c')](_[_0x5c6b('0x35')](_0x250941['query'],_0x41be07[_0x5c6b('0x2c')]));if(_0x250941[_0x5c6b('0x2a')][_0x5c6b('0x36')]){_0x5a6425[_0x5c6b('0x38')]=_['merge'](_0x5a6425[_0x5c6b('0x38')],{'$or':_[_0x5c6b('0x26')](_0x5a6425[_0x5c6b('0x30')],function(_0x633a00){var _0x584580={};_0x584580[_0x633a00]={'$like':'%'+_0x250941[_0x5c6b('0x2a')][_0x5c6b('0x36')]+'%'};return _0x584580;})});}_0x5a6425=_['merge']({},_0x5a6425,_0x250941['options']);return _0x15e065[_0x5c6b('0x81')](_0x5a6425);}})[_0x5c6b('0x1f')](function(_0x840846){if(_0x840846){_0x1329de=_0x840846[_0x5c6b('0x31')];if(!_0x250941['query']['hasOwnProperty'](_0x5c6b('0x32'))){_0x5a6425[_0x5c6b('0x19')]=qs[_0x5c6b('0x19')](_0x250941['query'][_0x5c6b('0x19')]);_0x5a6425[_0x5c6b('0x17')]=qs[_0x5c6b('0x17')](_0x250941[_0x5c6b('0x2a')][_0x5c6b('0x17')]);}return _0x15e065[_0x5c6b('0x81')](_0x5a6425);}})[_0x5c6b('0x1f')](function(_0x21812c){if(_0x21812c){return _0x21812c?{'count':_0x1329de,'rows':_0x21812c}:null;}})[_0x5c6b('0x1f')](respondWithResult(_0x28cbdb,null))['catch'](handleError(_0x28cbdb,null));}; \ No newline at end of file +var _0x298d=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','offset','undefined','count','status','Content-Range','json','apply','save','update','then','destroy','WhatsappQueues','UserProfileResource','error','send','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','where','merge','options','WhatsappQueue','findAll','rows','catch','includeAll','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','create','params','describe','getMembers','hasOwnProperty','UserWhatsappQueue','findAndCountAll','agent','whatsappPause','createdAt','format','%s/%s','updatedAt','getTeams','findOne','Team','order','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','select','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','value','removeAgents','emit','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x3d14f4,_0x3bf7bb){var _0x1df5d8=function(_0x41cd3f){while(--_0x41cd3f){_0x3d14f4['push'](_0x3d14f4['shift']());}};_0x1df5d8(++_0x3bf7bb);}(_0x298d,0x103));var _0xd298=function(_0x214521,_0x1686b9){_0x214521=_0x214521-0x0;var _0x243e77=_0x298d[_0x214521];return _0x243e77;};'use strict';var emlformat=require(_0xd298('0x0'));var rimraf=require(_0xd298('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd298('0x2'));var moment=require(_0xd298('0x3'));var BPromise=require(_0xd298('0x4'));var Mustache=require(_0xd298('0x5'));var util=require('util');var path=require(_0xd298('0x6'));var sox=require(_0xd298('0x7'));var csv=require(_0xd298('0x8'));var ejs=require(_0xd298('0x9'));var fs=require('fs');var fs_extra=require(_0xd298('0xa'));var _=require(_0xd298('0xb'));var squel=require(_0xd298('0xc'));var crypto=require(_0xd298('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd298('0x8'));var querystring=require(_0xd298('0xe'));var Papa=require(_0xd298('0xf'));var Redis=require('ioredis');var authService=require(_0xd298('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd298('0x11'));var logger=require(_0xd298('0x12'))(_0xd298('0x13'));var utils=require(_0xd298('0x14'));var config=require(_0xd298('0x15'));var licenseUtil=require(_0xd298('0x16'));var db=require(_0xd298('0x17'))['db'];config[_0xd298('0x18')]=_['defaults'](config[_0xd298('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd298('0x19'))(new Redis(config[_0xd298('0x18')]));require(_0xd298('0x1a'))[_0xd298('0x1b')](socket);function respondWithStatusCode(_0xa52e5e,_0xf8b39a){_0xf8b39a=_0xf8b39a||0xcc;return function(_0x2a6603){if(_0x2a6603){return _0xa52e5e[_0xd298('0x1c')](_0xf8b39a);}return _0xa52e5e['status'](_0xf8b39a)[_0xd298('0x1d')]();};}function respondWithResult(_0x53f9de,_0x5d42f2){_0x5d42f2=_0x5d42f2||0xc8;return function(_0x30711d){if(_0x30711d){return _0x53f9de['status'](_0x5d42f2)['json'](_0x30711d);}};}function respondWithFilteredResult(_0x189d27,_0x58f82b){return function(_0x420a0e){if(_0x420a0e){var _0x25b9b9=typeof _0x58f82b[_0xd298('0x1e')]===_0xd298('0x1f')&&typeof _0x58f82b['limit']===_0xd298('0x1f');var _0x118dac=_0x420a0e[_0xd298('0x20')];var _0x272f57=_0x25b9b9?0x0:_0x58f82b[_0xd298('0x1e')];var _0x167914=_0x25b9b9?_0x420a0e[_0xd298('0x20')]:_0x58f82b[_0xd298('0x1e')]+_0x58f82b['limit'];var _0x162ead;if(_0x167914>=_0x118dac){_0x167914=_0x118dac;_0x162ead=0xc8;}else{_0x162ead=0xce;}_0x189d27[_0xd298('0x21')](_0x162ead);return _0x189d27['set'](_0xd298('0x22'),_0x272f57+'-'+_0x167914+'/'+_0x118dac)[_0xd298('0x23')](_0x420a0e);}return null;};}function patchUpdates(_0x597195){return function(_0x113948){try{jsonpatch[_0xd298('0x24')](_0x113948,_0x597195,!![]);}catch(_0x21d4f7){return BPromise['reject'](_0x21d4f7);}return _0x113948[_0xd298('0x25')]();};}function saveUpdates(_0x257077,_0x125435){return function(_0x399dc9){if(_0x399dc9){return _0x399dc9[_0xd298('0x26')](_0x257077)[_0xd298('0x27')](function(_0x5522e6){return _0x5522e6;});}return null;};}function removeEntity(_0x35edae,_0x415215){return function(_0x58c623){if(_0x58c623){return _0x58c623[_0xd298('0x28')]()['then'](function(){var _0x48179f=_0x58c623['get']({'plain':!![]});var _0x3c0fae=_0xd298('0x29');return db[_0xd298('0x2a')][_0xd298('0x28')]({'where':{'type':_0x3c0fae,'resourceId':_0x48179f['id']}})[_0xd298('0x27')](function(){return _0x58c623;});})['then'](function(){_0x35edae['status'](0xcc)[_0xd298('0x1d')]();});}};}function handleEntityNotFound(_0x4ff79e,_0x3d4172){return function(_0x1491b9){if(!_0x1491b9){_0x4ff79e[_0xd298('0x1c')](0x194);}return _0x1491b9;};}function handleError(_0x10b0de,_0x84c5af){_0x84c5af=_0x84c5af||0x1f4;return function(_0x1e9580){logger[_0xd298('0x2b')](_0x1e9580['stack']);if(_0x1e9580['name']){delete _0x1e9580['name'];}_0x10b0de['status'](_0x84c5af)[_0xd298('0x2c')](_0x1e9580);};}exports['index']=function(_0x58a237,_0x553829){var _0x9e6e46={},_0x7987c6={},_0x5beada={'count':0x0,'rows':[]};var _0x2fbedf=_['map'](db['WhatsappQueue'][_0xd298('0x2d')],function(_0x4fab40){return{'name':_0x4fab40['fieldName'],'type':_0x4fab40[_0xd298('0x2e')][_0xd298('0x2f')]};});_0x7987c6[_0xd298('0x30')]=_[_0xd298('0x31')](_0x2fbedf,_0xd298('0x32'));_0x7987c6[_0xd298('0x33')]=_[_0xd298('0x34')](_0x58a237['query']);_0x7987c6[_0xd298('0x35')]=_[_0xd298('0x36')](_0x7987c6[_0xd298('0x30')],_0x7987c6[_0xd298('0x33')]);_0x9e6e46[_0xd298('0x37')]=_['intersection'](_0x7987c6['model'],qs[_0xd298('0x38')](_0x58a237['query'][_0xd298('0x38')]));_0x9e6e46[_0xd298('0x37')]=_0x9e6e46[_0xd298('0x37')][_0xd298('0x39')]?_0x9e6e46[_0xd298('0x37')]:_0x7987c6['model'];if(!_0x58a237['query']['hasOwnProperty'](_0xd298('0x3a'))){_0x9e6e46[_0xd298('0x3b')]=qs[_0xd298('0x3b')](_0x58a237[_0xd298('0x33')][_0xd298('0x3b')]);_0x9e6e46[_0xd298('0x1e')]=qs[_0xd298('0x1e')](_0x58a237[_0xd298('0x33')][_0xd298('0x1e')]);}_0x9e6e46['order']=qs['sort'](_0x58a237[_0xd298('0x33')][_0xd298('0x3c')]);_0x9e6e46['where']=qs['filters'](_[_0xd298('0x3d')](_0x58a237[_0xd298('0x33')],_0x7987c6[_0xd298('0x35')]),_0x2fbedf);if(_0x58a237[_0xd298('0x33')][_0xd298('0x3e')]){_0x9e6e46['where']=_['merge'](_0x9e6e46[_0xd298('0x3f')],{'$or':_[_0xd298('0x31')](_0x2fbedf,function(_0x3eaaa5){if(_0x3eaaa5['type']!=='VIRTUAL'){var _0x2f7285={};_0x2f7285[_0x3eaaa5[_0xd298('0x32')]]={'$like':'%'+_0x58a237[_0xd298('0x33')]['filter']+'%'};return _0x2f7285;}})});}_0x9e6e46=_[_0xd298('0x40')]({},_0x9e6e46,_0x58a237[_0xd298('0x41')]);var _0xcb49ac={'where':_0x9e6e46[_0xd298('0x3f')]};return db['WhatsappQueue']['count'](_0xcb49ac)[_0xd298('0x27')](function(_0x2490e7){_0x5beada[_0xd298('0x20')]=_0x2490e7;if(_0x58a237[_0xd298('0x33')]['includeAll']){_0x9e6e46['include']=[{'all':!![]}];}return db[_0xd298('0x42')][_0xd298('0x43')](_0x9e6e46);})[_0xd298('0x27')](function(_0x1724c0){_0x5beada[_0xd298('0x44')]=_0x1724c0;return _0x5beada;})[_0xd298('0x27')](respondWithFilteredResult(_0x553829,_0x9e6e46))[_0xd298('0x45')](handleError(_0x553829,null));};exports['show']=function(_0x2fe8bf,_0x5c0b9e){var _0x3385c4={'raw':!![],'where':{'id':_0x2fe8bf['params']['id']}},_0x25df3e={};_0x25df3e[_0xd298('0x30')]=_[_0xd298('0x34')](db['WhatsappQueue'][_0xd298('0x2d')]);_0x25df3e['query']=_[_0xd298('0x34')](_0x2fe8bf['query']);_0x25df3e[_0xd298('0x35')]=_['intersection'](_0x25df3e['model'],_0x25df3e[_0xd298('0x33')]);_0x3385c4[_0xd298('0x37')]=_[_0xd298('0x36')](_0x25df3e[_0xd298('0x30')],qs[_0xd298('0x38')](_0x2fe8bf[_0xd298('0x33')][_0xd298('0x38')]));_0x3385c4[_0xd298('0x37')]=_0x3385c4['attributes'][_0xd298('0x39')]?_0x3385c4[_0xd298('0x37')]:_0x25df3e[_0xd298('0x30')];if(_0x2fe8bf[_0xd298('0x33')][_0xd298('0x46')]){_0x3385c4[_0xd298('0x47')]=[{'all':!![]}];}_0x3385c4=_[_0xd298('0x40')]({},_0x3385c4,_0x2fe8bf['options']);return db['WhatsappQueue'][_0xd298('0x48')](_0x3385c4)['then'](handleEntityNotFound(_0x5c0b9e,null))[_0xd298('0x27')](respondWithResult(_0x5c0b9e,null))[_0xd298('0x45')](handleError(_0x5c0b9e,null));};exports['create']=function(_0x54f074,_0x5a03c0){return db[_0xd298('0x42')]['create'](_0x54f074[_0xd298('0x49')],{})[_0xd298('0x27')](function(_0x28d647){var _0xfcedba=_0x54f074['user']['get']({'plain':!![]});if(!_0xfcedba)throw new Error(_0xd298('0x4a'));if(_0xfcedba[_0xd298('0x4b')]==='user'){var _0x4be832=_0x28d647[_0xd298('0x4c')]({'plain':!![]});var _0x73aac=_0xd298('0x29');return db[_0xd298('0x4d')][_0xd298('0x48')]({'where':{'name':_0x73aac,'userProfileId':_0xfcedba['userProfileId']},'raw':!![]})[_0xd298('0x27')](function(_0x278709){if(_0x278709&&_0x278709[_0xd298('0x4e')]===0x0){return db[_0xd298('0x2a')][_0xd298('0x4f')]({'name':_0x4be832[_0xd298('0x32')],'resourceId':_0x4be832['id'],'type':_0x278709[_0xd298('0x32')],'sectionId':_0x278709['id']},{})['then'](function(){return _0x28d647;});}else{return _0x28d647;}})['catch'](function(_0x794fc8){logger[_0xd298('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x794fc8);throw _0x794fc8;});}return _0x28d647;})['then'](respondWithResult(_0x5a03c0,0xc9))[_0xd298('0x45')](handleError(_0x5a03c0,null));};exports[_0xd298('0x26')]=function(_0x1ca6bf,_0x480816){if(_0x1ca6bf[_0xd298('0x49')]['id']){delete _0x1ca6bf[_0xd298('0x49')]['id'];}return db[_0xd298('0x42')][_0xd298('0x48')]({'where':{'id':_0x1ca6bf[_0xd298('0x50')]['id']}})[_0xd298('0x27')](handleEntityNotFound(_0x480816,null))[_0xd298('0x27')](saveUpdates(_0x1ca6bf[_0xd298('0x49')],null))[_0xd298('0x27')](respondWithResult(_0x480816,null))[_0xd298('0x45')](handleError(_0x480816,null));};exports['destroy']=function(_0x18d2d7,_0x3d08e1){return db[_0xd298('0x42')]['find']({'where':{'id':_0x18d2d7[_0xd298('0x50')]['id']}})[_0xd298('0x27')](handleEntityNotFound(_0x3d08e1,null))[_0xd298('0x27')](removeEntity(_0x3d08e1,null))['catch'](handleError(_0x3d08e1,null));};exports[_0xd298('0x51')]=function(_0x3d799e,_0x37bc78){return db[_0xd298('0x42')]['describe']()[_0xd298('0x27')](respondWithResult(_0x37bc78,null))[_0xd298('0x45')](handleError(_0x37bc78,null));};exports[_0xd298('0x52')]=function(_0x357129,_0x3cc3a2,_0x44c9db){var _0x2216f5={'raw':!![],'where':{}},_0x4232b5={},_0x48a06e;return db[_0xd298('0x42')]['findOne']({'where':{'id':_0x357129[_0xd298('0x50')]['id']}})[_0xd298('0x27')](handleEntityNotFound(_0x3cc3a2,null))['then'](function(_0x28017d){if(_0x28017d){_0x48a06e=_0x28017d[_0xd298('0x4c')]({'plain':!![]});_0x4232b5[_0xd298('0x30')]=_[_0xd298('0x34')](db['UserWhatsappQueue'][_0xd298('0x2d')]);_0x4232b5['query']=_['keys'](_0x357129[_0xd298('0x33')]);_0x4232b5[_0xd298('0x35')]=_[_0xd298('0x36')](_0x4232b5[_0xd298('0x30')],_0x4232b5[_0xd298('0x33')]);_0x2216f5[_0xd298('0x37')]=_[_0xd298('0x36')](_0x4232b5['model'],qs[_0xd298('0x38')](_0x357129[_0xd298('0x33')][_0xd298('0x38')]));_0x2216f5[_0xd298('0x37')]=_0x2216f5[_0xd298('0x37')][_0xd298('0x39')]?_0x2216f5[_0xd298('0x37')]:_0x4232b5[_0xd298('0x30')];if(!_0x357129[_0xd298('0x33')][_0xd298('0x53')](_0xd298('0x3a'))){_0x2216f5[_0xd298('0x3b')]=qs['limit'](_0x357129[_0xd298('0x33')]['limit']);_0x2216f5['offset']=qs[_0xd298('0x1e')](_0x357129[_0xd298('0x33')][_0xd298('0x1e')]);}_0x2216f5['order']=qs[_0xd298('0x3c')](_0x357129[_0xd298('0x33')][_0xd298('0x3c')]);_0x2216f5[_0xd298('0x3f')]=qs[_0xd298('0x35')](_['pick'](_0x357129[_0xd298('0x33')],_0x4232b5[_0xd298('0x35')]));_0x2216f5[_0xd298('0x3f')]['WhatsappQueueId']=_0x28017d['id'];if(_0x357129['query']['filter']){_0x2216f5['where']=_[_0xd298('0x40')](_0x2216f5[_0xd298('0x3f')],{'$or':_[_0xd298('0x31')](_0x2216f5['attributes'],function(_0x47b6f2){var _0x22dae1={};_0x22dae1[_0x47b6f2]={'$like':'%'+_0x357129['query']['filter']+'%'};return _0x22dae1;})});}_0x2216f5=_[_0xd298('0x40')]({},_0x2216f5,_0x357129[_0xd298('0x41')]);return db[_0xd298('0x54')][_0xd298('0x43')](_0x2216f5);}})[_0xd298('0x27')](function(_0xa86137){if(_0xa86137){return db['User'][_0xd298('0x55')]({'where':{'id':_[_0xd298('0x31')](_0xa86137,'UserId'),'role':_0xd298('0x56')},'attributes':['id',_0xd298('0x32'),_0xd298('0x57'),'updatedAt',_0xd298('0x58')]});}})[_0xd298('0x27')](function(_0x40a1c5){if(_0x40a1c5){return{'count':_0x40a1c5[_0xd298('0x20')],'rows':_[_0xd298('0x31')](_0x40a1c5[_0xd298('0x44')],function(_0x3e3edb){return{'membername':_0x3e3edb[_0xd298('0x32')],'UserId':_0x3e3edb['id'],'queue_name':_0x48a06e[_0xd298('0x32')],'WhatsappQueueId':_0x48a06e['id'],'interface':util[_0xd298('0x59')](_0xd298('0x5a'),'SIP',_0x3e3edb[_0xd298('0x32')]),'penalty':0x0,'paused':_0x3e3edb[_0xd298('0x57')],'createdAt':_0x3e3edb[_0xd298('0x58')],'updatedAt':_0x3e3edb[_0xd298('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd298('0x27')](respondWithFilteredResult(_0x3cc3a2,_0x2216f5))[_0xd298('0x45')](handleError(_0x3cc3a2,null));};exports[_0xd298('0x5c')]=function(_0xb3d252,_0x394176,_0x291d2a){var _0x55a7b4={};var _0x5c8422={};var _0x4b7cb6;var _0x58e993;return db[_0xd298('0x42')][_0xd298('0x5d')]({'where':{'id':_0xb3d252['params']['id']}})['then'](handleEntityNotFound(_0x394176,null))['then'](function(_0xea4663){if(_0xea4663){_0x4b7cb6=_0xea4663;_0x5c8422['model']=_[_0xd298('0x34')](db[_0xd298('0x5e')][_0xd298('0x2d')]);_0x5c8422[_0xd298('0x33')]=_['keys'](_0xb3d252[_0xd298('0x33')]);_0x5c8422[_0xd298('0x35')]=_[_0xd298('0x36')](_0x5c8422[_0xd298('0x30')],_0x5c8422['query']);_0x55a7b4[_0xd298('0x37')]=_['intersection'](_0x5c8422[_0xd298('0x30')],qs[_0xd298('0x38')](_0xb3d252[_0xd298('0x33')][_0xd298('0x38')]));_0x55a7b4[_0xd298('0x37')]=_0x55a7b4[_0xd298('0x37')]['length']?_0x55a7b4[_0xd298('0x37')]:_0x5c8422['model'];_0x55a7b4[_0xd298('0x5f')]=qs[_0xd298('0x3c')](_0xb3d252[_0xd298('0x33')][_0xd298('0x3c')]);_0x55a7b4[_0xd298('0x3f')]=qs[_0xd298('0x35')](_['pick'](_0xb3d252[_0xd298('0x33')],_0x5c8422[_0xd298('0x35')]));if(_0xb3d252[_0xd298('0x33')][_0xd298('0x3e')]){_0x55a7b4[_0xd298('0x3f')]=_[_0xd298('0x40')](_0x55a7b4['where'],{'$or':_[_0xd298('0x31')](_0x55a7b4[_0xd298('0x37')],function(_0x5b2a32){var _0x4de27c={};_0x4de27c[_0x5b2a32]={'$like':'%'+_0xb3d252[_0xd298('0x33')]['filter']+'%'};return _0x4de27c;})});}_0x55a7b4=_[_0xd298('0x40')]({},_0x55a7b4,_0xb3d252[_0xd298('0x41')]);return _0x4b7cb6[_0xd298('0x5c')](_0x55a7b4);}})[_0xd298('0x27')](function(_0x359c11){if(_0x359c11){_0x58e993=_0x359c11['length'];if(!_0xb3d252[_0xd298('0x33')][_0xd298('0x53')](_0xd298('0x3a'))){_0x55a7b4[_0xd298('0x3b')]=qs[_0xd298('0x3b')](_0xb3d252[_0xd298('0x33')][_0xd298('0x3b')]);_0x55a7b4['offset']=qs['offset'](_0xb3d252[_0xd298('0x33')][_0xd298('0x1e')]);}return _0x4b7cb6[_0xd298('0x5c')](_0x55a7b4);}})[_0xd298('0x27')](function(_0xfb9129){if(_0xfb9129){return _0xfb9129?{'count':_0x58e993,'rows':_0xfb9129}:null;}})[_0xd298('0x27')](respondWithResult(_0x394176,null))[_0xd298('0x45')](handleError(_0x394176,null));};exports[_0xd298('0x60')]=function(_0x34ac5d,_0x5640c1,_0x29c752){var _0x5886ce=_0x34ac5d[_0xd298('0x49')][_0xd298('0x61')];return db[_0xd298('0x5e')]['findAll']({'where':{'id':_0x5886ce},'attributes':['id'],'include':[{'model':db[_0xd298('0x62')],'as':'Agents','attributes':['id',_0xd298('0x32'),_0xd298('0x63'),_0xd298('0x64'),_0xd298('0x65')],'raw':!![]}]})[_0xd298('0x27')](function(_0x4828df){if(_0x4828df){var _0x487d04=_[_0xd298('0x66')](_0x4828df,function(_0x2d684c){var _0x31bcc8=_0x2d684c[_0xd298('0x4c')]({'plain':!![]});return _0x31bcc8[_0xd298('0x67')];});return db[_0xd298('0x42')][_0xd298('0x48')]({'where':{'id':_0x34ac5d[_0xd298('0x50')]['id']}})[_0xd298('0x27')](function(_0x4752ae){return db[_0xd298('0x68')][_0xd298('0x69')](function(_0x40d99c){return _0x4752ae[_0xd298('0x60')](_0x5886ce,{'transaction':_0x40d99c})['then'](function(){return BPromise[_0xd298('0x6a')](_0x487d04,function(_0x471c2a){return db[_0xd298('0x54')][_0xd298('0x6b')]({'where':{'UserId':_0x471c2a['id'],'WhatsappQueueId':_0x34ac5d[_0xd298('0x50')]['id']},'transaction':_0x40d99c});});})['then'](function(){_0x487d04['forEach'](function(_0x4fda01){socket['emit'](_0xd298('0x6c'),{'UserId':_0x4fda01['id'],'WhatsappQueueId':_0x4752ae['id']});});});});});}})[_0xd298('0x27')](respondWithStatusCode(_0x5640c1,null))['catch'](handleError(_0x5640c1,null));};exports['removeTeams']=function(_0x5ecf46,_0x224a4c,_0x395ad5){return db[_0xd298('0x5e')][_0xd298('0x43')]({'where':{'id':_0x5ecf46[_0xd298('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd298('0x62')],'as':_0xd298('0x67'),'attributes':['id'],'raw':!![]}]})[_0xd298('0x27')](handleEntityNotFound(_0x224a4c,null))[_0xd298('0x27')](function(_0x4c381b){var _0x21800c=_[_0xd298('0x31')](_0x4c381b,'id');var _0x4a15d7=[];var _0x5e3303=[];var _0x50bb1b=squel[_0xd298('0x6d')]();_0x50bb1b['field']('tq.TeamId')[_0xd298('0x6e')](_0xd298('0x6f'),'tq')[_0xd298('0x70')](_0xd298('0x71'),'ut',_0xd298('0x72'))[_0xd298('0x3f')](_0xd298('0x73'),_0x5ecf46['params']['id']);for(var _0x59b41c=0x0;_0x59b41c<_0x4c381b['length'];_0x59b41c+=0x1){let _0x75cbaf=_0x4c381b[_0x59b41c];for(var _0x51d031=0x0;_0x51d031<_0x75cbaf[_0xd298('0x67')]['length'];_0x51d031+=0x1){let _0x11f7b5=_0x75cbaf[_0xd298('0x67')][_0x51d031];var _0x247c64=_0x50bb1b[_0xd298('0x74')]();_0x247c64['where']('ut.UserId\x20=\x20?',_0x11f7b5['id']);_0x5e3303[_0xd298('0x75')](db[_0xd298('0x68')]['query'](_0x247c64[_0xd298('0x76')](),{'type':db['sequelize'][_0xd298('0x77')][_0xd298('0x78')]})[_0xd298('0x27')](function(_0xcb60c){if(_0xcb60c[_0xd298('0x39')]===0x1){return _0x11f7b5['id'];}else{var _0x4c3a92=_['every'](_[_0xd298('0x31')](_0xcb60c,_0xd298('0x79')),function(_0x36bd34){return _[_0xd298('0x7a')](_0x21800c,_0x36bd34);});if(_0x4c3a92){return _0x11f7b5['id'];}}}));}}return BPromise[_0xd298('0x7b')](_0x5e3303)['then'](function(_0x582b9e){_0x4a15d7=_(_0x4a15d7)['union'](_0x582b9e)['compact']()[_0xd298('0x7c')]();return db[_0xd298('0x42')][_0xd298('0x48')]({'where':{'id':_0x5ecf46[_0xd298('0x50')]['id']}})[_0xd298('0x27')](function(_0x272414){return db[_0xd298('0x68')]['transaction'](function(_0x289923){return _0x272414['removeTeams'](_0x5ecf46['query'][_0xd298('0x61')],{'transaction':_0x289923})[_0xd298('0x27')](function(){if(!_['isEmpty'](_0x4a15d7)){return _0x272414[_0xd298('0x7d')](_0x4a15d7,{'transaction':_0x289923});}})[_0xd298('0x27')](function(){_0x4a15d7['forEach'](function(_0x3e0fe2){socket[_0xd298('0x7e')]('userWhatsappQueue:remove',{'UserId':_0x3e0fe2,'WhatsappQueueId':_0x272414['id']});});});});});});})['then'](respondWithStatusCode(_0x224a4c,null))[_0xd298('0x45')](handleError(_0x224a4c,null));};exports[_0xd298('0x7f')]=function(_0x4af2b4,_0x5ae835,_0x399a22){return db[_0xd298('0x42')][_0xd298('0x48')]({'where':{'id':_0x4af2b4['params']['id']}})[_0xd298('0x27')](handleEntityNotFound(_0x5ae835,null))['then'](function(_0x2b6475){if(_0x2b6475){return _0x2b6475['addAgents'](_0x4af2b4['body']['ids'],_['omit'](_0x4af2b4[_0xd298('0x49')],[_0xd298('0x61'),'id'])||{})[_0xd298('0x80')](function(_0x95978d){for(var _0x4fd645=0x0;_0x4fd645<_0x4af2b4[_0xd298('0x49')][_0xd298('0x61')][_0xd298('0x39')];_0x4fd645+=0x1){socket[_0xd298('0x7e')](_0xd298('0x6c'),{'UserId':Number(_0x4af2b4[_0xd298('0x49')]['ids'][_0x4fd645]),'WhatsappQueueId':Number(_0x4af2b4[_0xd298('0x50')]['id'])});}return _0x95978d;});}})[_0xd298('0x27')](respondWithResult(_0x5ae835,null))[_0xd298('0x45')](handleError(_0x5ae835,null));};exports[_0xd298('0x7d')]=function(_0xf358d3,_0x504bd1,_0x3c57f4){return db[_0xd298('0x42')]['find']({'where':{'id':_0xf358d3['params']['id']}})[_0xd298('0x27')](handleEntityNotFound(_0x504bd1,null))[_0xd298('0x27')](function(_0x58422a){if(_0x58422a){return _0x58422a[_0xd298('0x7d')](_0xf358d3[_0xd298('0x33')][_0xd298('0x61')])[_0xd298('0x27')](function(){if(_[_0xd298('0x81')](_0xf358d3[_0xd298('0x33')]['ids'])){for(var _0x44fb7b=0x0;_0x44fb7b<_0xf358d3[_0xd298('0x33')][_0xd298('0x61')][_0xd298('0x39')];_0x44fb7b+=0x1){socket[_0xd298('0x7e')](_0xd298('0x82'),{'UserId':Number(_0xf358d3[_0xd298('0x33')][_0xd298('0x61')][_0x44fb7b]),'WhatsappQueueId':Number(_0xf358d3[_0xd298('0x50')]['id'])});}}else{socket[_0xd298('0x7e')](_0xd298('0x82'),{'UserId':Number(_0xf358d3['query'][_0xd298('0x61')]),'WhatsappQueueId':Number(_0xf358d3[_0xd298('0x50')]['id'])});}});}})[_0xd298('0x27')](respondWithStatusCode(_0x504bd1,null))['catch'](handleError(_0x504bd1,null));};exports['getAgents']=function(_0x39dea6,_0x36e043,_0x5c73b2){var _0x333b42={};var _0x185eb1={};var _0x24e105;var _0x223614;return db[_0xd298('0x42')][_0xd298('0x5d')]({'where':{'id':_0x39dea6[_0xd298('0x50')]['id']}})['then'](handleEntityNotFound(_0x36e043,null))['then'](function(_0x381b53){if(_0x381b53){_0x24e105=_0x381b53;_0x185eb1[_0xd298('0x30')]=_[_0xd298('0x34')](db[_0xd298('0x62')][_0xd298('0x2d')]);_0x185eb1[_0xd298('0x33')]=_[_0xd298('0x34')](_0x39dea6[_0xd298('0x33')]);_0x185eb1[_0xd298('0x35')]=_[_0xd298('0x36')](_0x185eb1[_0xd298('0x30')],_0x185eb1['query']);_0x333b42[_0xd298('0x37')]=_[_0xd298('0x36')](_0x185eb1['model'],qs[_0xd298('0x38')](_0x39dea6['query'][_0xd298('0x38')]));_0x333b42[_0xd298('0x37')]=_0x333b42[_0xd298('0x37')][_0xd298('0x39')]?_0x333b42[_0xd298('0x37')]:_0x185eb1[_0xd298('0x30')];_0x333b42['order']=qs[_0xd298('0x3c')](_0x39dea6[_0xd298('0x33')][_0xd298('0x3c')]);_0x333b42[_0xd298('0x3f')]=qs[_0xd298('0x35')](_[_0xd298('0x3d')](_0x39dea6['query'],_0x185eb1[_0xd298('0x35')]));if(_0x39dea6[_0xd298('0x33')][_0xd298('0x3e')]){_0x333b42['where']=_[_0xd298('0x40')](_0x333b42['where'],{'$or':_[_0xd298('0x31')](_0x333b42[_0xd298('0x37')],function(_0xd5cf9a){var _0x5d1d15={};_0x5d1d15[_0xd5cf9a]={'$like':'%'+_0x39dea6['query'][_0xd298('0x3e')]+'%'};return _0x5d1d15;})});}_0x333b42=_[_0xd298('0x40')]({},_0x333b42,_0x39dea6['options']);return _0x24e105[_0xd298('0x83')](_0x333b42);}})['then'](function(_0x363374){if(_0x363374){_0x223614=_0x363374[_0xd298('0x39')];if(!_0x39dea6[_0xd298('0x33')]['hasOwnProperty']('nolimit')){_0x333b42[_0xd298('0x3b')]=qs[_0xd298('0x3b')](_0x39dea6[_0xd298('0x33')][_0xd298('0x3b')]);_0x333b42[_0xd298('0x1e')]=qs[_0xd298('0x1e')](_0x39dea6[_0xd298('0x33')][_0xd298('0x1e')]);}return _0x24e105[_0xd298('0x83')](_0x333b42);}})['then'](function(_0x468660){if(_0x468660){return _0x468660?{'count':_0x223614,'rows':_0x468660}:null;}})[_0xd298('0x27')](respondWithResult(_0x36e043,null))[_0xd298('0x45')](handleError(_0x36e043,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 069809b..d1d912c 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 _0x629d=['setMaxListeners','save','remove','emit','hook','events','../../mysqldb','WhatsappQueue'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x629d,0x15d));var _0xd629=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x629d[_0x589f71];return _0x5763bd;};'use strict';var EventEmitter=require(_0xd629('0x0'));var WhatsappQueue=require(_0xd629('0x1'))['db'][_0xd629('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd629('0x3')](0x0);var events={'afterCreate':_0xd629('0x4'),'afterUpdate':'update','afterDestroy':_0xd629('0x5')};function emitEvent(_0x33e5d6){return function(_0x1fc158,_0x1db0ff,_0xc1df24){WhatsappQueueEvents[_0xd629('0x6')](_0x33e5d6+':'+_0x1fc158['id'],_0x1fc158);WhatsappQueueEvents[_0xd629('0x6')](_0x33e5d6,_0x1fc158);_0xc1df24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd629('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xa60d=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit','exports'];(function(_0xaf6ad4,_0x617b93){var _0x1762e2=function(_0x5a5e92){while(--_0x5a5e92){_0xaf6ad4['push'](_0xaf6ad4['shift']());}};_0x1762e2(++_0x617b93);}(_0xa60d,0x1b8));var _0xda60=function(_0x2f36b2,_0x8b9cf9){_0x2f36b2=_0x2f36b2-0x0;var _0x10439e=_0xa60d[_0x2f36b2];return _0x10439e;};'use strict';var EventEmitter=require(_0xda60('0x0'));var WhatsappQueue=require(_0xda60('0x1'))['db'][_0xda60('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xda60('0x3')](0x0);var events={'afterCreate':_0xda60('0x4'),'afterUpdate':'update','afterDestroy':_0xda60('0x5')};function emitEvent(_0x3020f9){return function(_0x5c0db5,_0x6f734c,_0x552c64){WhatsappQueueEvents[_0xda60('0x6')](_0x3020f9+':'+_0x5c0db5['id'],_0x5c0db5);WhatsappQueueEvents[_0xda60('0x6')](_0x3020f9,_0x5c0db5);_0x552c64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xda60('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index b0e8379..607b7f1 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 _0x3193=['whatsapp_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x44b49e,_0x2e28d9){var _0x259db0=function(_0x304f8a){while(--_0x304f8a){_0x44b49e['push'](_0x44b49e['shift']());}};_0x259db0(++_0x2e28d9);}(_0x3193,0x16d));var _0x3319=function(_0x37fbe8,_0x47ae4b){_0x37fbe8=_0x37fbe8-0x0;var _0x5ba271=_0x3193[_0x37fbe8];return _0x5ba271;};'use strict';var _=require(_0x3319('0x0'));var util=require(_0x3319('0x1'));var logger=require(_0x3319('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3319('0x3'));var rp=require(_0x3319('0x4'));var fs=require('fs');var path=require(_0x3319('0x5'));var rimraf=require(_0x3319('0x6'));var config=require(_0x3319('0x7'));var attributes=require(_0x3319('0x8'));module[_0x3319('0x9')]=function(_0x3d48c2,_0x36e743){return _0x3d48c2[_0x3319('0xa')](_0x3319('0xb'),attributes,{'tableName':_0x3319('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c18=['define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','path','rimraf','./whatsappQueue.attributes','exports'];(function(_0x2edb1b,_0x5b8f80){var _0x3fe620=function(_0x4c32d4){while(--_0x4c32d4){_0x2edb1b['push'](_0x2edb1b['shift']());}};_0x3fe620(++_0x5b8f80);}(_0x8c18,0x1f2));var _0x88c1=function(_0x2e066a,_0x34d5af){_0x2e066a=_0x2e066a-0x0;var _0x3d256a=_0x8c18[_0x2e066a];return _0x3d256a;};'use strict';var _=require('lodash');var util=require(_0x88c1('0x0'));var logger=require(_0x88c1('0x1'))(_0x88c1('0x2'));var moment=require(_0x88c1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x88c1('0x4'));var rimraf=require(_0x88c1('0x5'));var config=require('../../config/environment');var attributes=require(_0x88c1('0x6'));module[_0x88c1('0x7')]=function(_0xdcb305,_0x3e8c57){return _0xdcb305[_0x88c1('0x8')](_0x88c1('0x9'),attributes,{'tableName':_0x88c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index e514d69..4a33eac 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 _0x482a=['model','then','catch','find','raw','ShowWhatsappQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','defaults','socket.io-emitter','redis','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map'];(function(_0x12277a,_0x53eef4){var _0x4f3635=function(_0x49de91){while(--_0x49de91){_0x12277a['push'](_0x12277a['shift']());}};_0x4f3635(++_0x53eef4);}(_0x482a,0x1be));var _0xa482=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x482a[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xa482('0x0'));var util=require(_0xa482('0x1'));var moment=require('moment');var BPromise=require(_0xa482('0x2'));var rs=require(_0xa482('0x3'));var fs=require('fs');var Redis=require(_0xa482('0x4'));var db=require(_0xa482('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa482('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa482('0x7')][_0xa482('0x8')]({'port':0x232a});config['redis']=_[_0xa482('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa482('0xa'))(new Redis(config[_0xa482('0xb')]));require(_0xa482('0xc'))[_0xa482('0xd')](socket);function respondWithRpcPromise(_0x342401,_0x1b6b27,_0x16a623){return new BPromise(function(_0x56ac9c,_0x4af596){return client[_0xa482('0xe')](_0x342401,_0x16a623)['then'](function(_0xad993c){logger[_0xa482('0xf')](_0xa482('0x10'),_0x1b6b27,_0xa482('0x11'));logger[_0xa482('0x12')](_0xa482('0x13'),_0x1b6b27,_0xa482('0x11'),JSON[_0xa482('0x14')](_0xad993c));if(_0xad993c[_0xa482('0x15')]){if(_0xad993c[_0xa482('0x15')][_0xa482('0x16')]===0x1f4){logger[_0xa482('0x15')](_0xa482('0x10'),_0x1b6b27,_0xad993c[_0xa482('0x15')]['message']);return _0x4af596(_0xad993c[_0xa482('0x15')][_0xa482('0x17')]);}logger[_0xa482('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x1b6b27,_0xad993c[_0xa482('0x15')][_0xa482('0x17')]);return _0x56ac9c(_0xad993c[_0xa482('0x15')][_0xa482('0x17')]);}else{logger[_0xa482('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x1b6b27,_0xa482('0x11'));_0x56ac9c(_0xad993c[_0xa482('0x18')][_0xa482('0x17')]);}})['catch'](function(_0x5e1288){logger[_0xa482('0x15')](_0xa482('0x10'),_0x1b6b27,_0x5e1288);_0x4af596(_0x5e1288);});});}exports[_0xa482('0x19')]=function(_0x335b2b){var _0x4a5c0a=this;return new Promise(function(_0x4450b6,_0x57f89a){return db[_0xa482('0x1a')][_0xa482('0x1b')]({'raw':_0x335b2b[_0xa482('0x1c')]?_0x335b2b['options']['raw']===undefined?!![]:![]:!![],'where':_0x335b2b[_0xa482('0x1c')]?_0x335b2b['options'][_0xa482('0x1d')]||null:null,'attributes':_0x335b2b[_0xa482('0x1c')]?_0x335b2b[_0xa482('0x1c')][_0xa482('0x1e')]||null:null,'limit':_0x335b2b[_0xa482('0x1c')]?_0x335b2b[_0xa482('0x1c')][_0xa482('0x1f')]||null:null,'include':_0x335b2b[_0xa482('0x1c')]?_0x335b2b[_0xa482('0x1c')][_0xa482('0x20')]?_[_0xa482('0x21')](_0x335b2b[_0xa482('0x1c')][_0xa482('0x20')],function(_0xd4b37){return{'model':db[_0xd4b37[_0xa482('0x22')]],'as':_0xd4b37['as'],'attributes':_0xd4b37[_0xa482('0x1e')],'include':_0xd4b37[_0xa482('0x20')]?_[_0xa482('0x21')](_0xd4b37[_0xa482('0x20')],function(_0x935922){return{'model':db[_0x935922['model']],'as':_0x935922['as'],'attributes':_0x935922[_0xa482('0x1e')],'include':_0x935922[_0xa482('0x20')]?_[_0xa482('0x21')](_0x935922[_0xa482('0x20')],function(_0x4a3c22){return{'model':db[_0x4a3c22[_0xa482('0x22')]],'as':_0x4a3c22['as'],'attributes':_0x4a3c22[_0xa482('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa482('0x23')](function(_0x2de860){logger[_0xa482('0xf')](_0xa482('0x19'),_0x335b2b);logger[_0xa482('0x12')](_0xa482('0x19'),_0x335b2b,JSON['stringify'](_0x2de860));_0x4450b6(_0x2de860);})[_0xa482('0x24')](function(_0x3589d2){logger[_0xa482('0x15')]('GetWhatsappQueue',_0x3589d2[_0xa482('0x17')],_0x335b2b);_0x57f89a(_0x4a5c0a[_0xa482('0x15')](0x1f4,_0x3589d2['message']));});});};exports['ShowWhatsappQueue']=function(_0x128622){var _0x2ab19b=this;return new Promise(function(_0x21b9ff,_0x3289ba){return db[_0xa482('0x1a')][_0xa482('0x25')]({'raw':_0x128622[_0xa482('0x1c')]?_0x128622['options'][_0xa482('0x26')]===undefined?!![]:![]:!![],'where':_0x128622['options']?_0x128622[_0xa482('0x1c')][_0xa482('0x1d')]||null:null,'attributes':_0x128622[_0xa482('0x1c')]?_0x128622[_0xa482('0x1c')][_0xa482('0x1e')]||null:null,'include':_0x128622['options']?_0x128622['options'][_0xa482('0x20')]?_[_0xa482('0x21')](_0x128622[_0xa482('0x1c')][_0xa482('0x20')],function(_0x588a82){return{'model':db[_0x588a82[_0xa482('0x22')]],'as':_0x588a82['as'],'attributes':_0x588a82[_0xa482('0x1e')],'include':_0x588a82[_0xa482('0x20')]?_[_0xa482('0x21')](_0x588a82[_0xa482('0x20')],function(_0x55ccff){return{'model':db[_0x55ccff[_0xa482('0x22')]],'as':_0x55ccff['as'],'attributes':_0x55ccff[_0xa482('0x1e')],'include':_0x55ccff[_0xa482('0x20')]?_[_0xa482('0x21')](_0x55ccff['include'],function(_0xd5fc0c){return{'model':db[_0xd5fc0c['model']],'as':_0xd5fc0c['as'],'attributes':_0xd5fc0c[_0xa482('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2356de){logger['info']('ShowWhatsappQueue',_0x128622);logger[_0xa482('0x12')](_0xa482('0x27'),_0x128622,JSON['stringify'](_0x2356de));_0x21b9ff(_0x2356de);})['catch'](function(_0x1df0ce){logger[_0xa482('0x15')](_0xa482('0x27'),_0x1df0ce[_0xa482('0x17')],_0x128622);_0x3289ba(_0x2ab19b['error'](0x1f4,_0x1df0ce[_0xa482('0x17')]));});});}; \ No newline at end of file +var _0x4e15=['message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','./whatsappQueue.socket','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s'];(function(_0x737d3d,_0x4fd7c0){var _0x4f1ee6=function(_0x24bd75){while(--_0x24bd75){_0x737d3d['push'](_0x737d3d['shift']());}};_0x4f1ee6(++_0x4fd7c0);}(_0x4e15,0xa2));var _0x54e1=function(_0x271655,_0x7ae7e3){_0x271655=_0x271655-0x0;var _0x4522b2=_0x4e15[_0x271655];return _0x4522b2;};'use strict';var _=require(_0x54e1('0x0'));var util=require(_0x54e1('0x1'));var moment=require(_0x54e1('0x2'));var BPromise=require(_0x54e1('0x3'));var rs=require(_0x54e1('0x4'));var fs=require('fs');var Redis=require(_0x54e1('0x5'));var db=require(_0x54e1('0x6'))['db'];var utils=require(_0x54e1('0x7'));var logger=require('../../config/logger')(_0x54e1('0x8'));var config=require(_0x54e1('0x9'));var jayson=require(_0x54e1('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x54e1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x54e1('0xc'))['register'](socket);function respondWithRpcPromise(_0x1f7d89,_0x6e6fbf,_0x4a2e82){return new BPromise(function(_0x560760,_0xdb3ea5){return client[_0x54e1('0xd')](_0x1f7d89,_0x4a2e82)[_0x54e1('0xe')](function(_0xdf54bd){logger[_0x54e1('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x6e6fbf,_0x54e1('0x10'));logger[_0x54e1('0x11')](_0x54e1('0x12'),_0x6e6fbf,'request\x20sent',JSON[_0x54e1('0x13')](_0xdf54bd));if(_0xdf54bd[_0x54e1('0x14')]){if(_0xdf54bd[_0x54e1('0x14')][_0x54e1('0x15')]===0x1f4){logger[_0x54e1('0x14')](_0x54e1('0x16'),_0x6e6fbf,_0xdf54bd[_0x54e1('0x14')][_0x54e1('0x17')]);return _0xdb3ea5(_0xdf54bd[_0x54e1('0x14')][_0x54e1('0x17')]);}logger[_0x54e1('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x6e6fbf,_0xdf54bd[_0x54e1('0x14')][_0x54e1('0x17')]);return _0x560760(_0xdf54bd[_0x54e1('0x14')][_0x54e1('0x17')]);}else{logger['info'](_0x54e1('0x16'),_0x6e6fbf,_0x54e1('0x10'));_0x560760(_0xdf54bd['result'][_0x54e1('0x17')]);}})[_0x54e1('0x18')](function(_0x285470){logger['error'](_0x54e1('0x16'),_0x6e6fbf,_0x285470);_0xdb3ea5(_0x285470);});});}exports[_0x54e1('0x19')]=function(_0x342ae0){var _0x37f37c=this;return new Promise(function(_0x519322,_0x4b2306){return db[_0x54e1('0x1a')][_0x54e1('0x1b')]({'raw':_0x342ae0[_0x54e1('0x1c')]?_0x342ae0[_0x54e1('0x1c')][_0x54e1('0x1d')]===undefined?!![]:![]:!![],'where':_0x342ae0[_0x54e1('0x1c')]?_0x342ae0[_0x54e1('0x1c')][_0x54e1('0x1e')]||null:null,'attributes':_0x342ae0[_0x54e1('0x1c')]?_0x342ae0[_0x54e1('0x1c')][_0x54e1('0x1f')]||null:null,'limit':_0x342ae0[_0x54e1('0x1c')]?_0x342ae0[_0x54e1('0x1c')][_0x54e1('0x20')]||null:null,'include':_0x342ae0[_0x54e1('0x1c')]?_0x342ae0[_0x54e1('0x1c')]['include']?_[_0x54e1('0x21')](_0x342ae0[_0x54e1('0x1c')][_0x54e1('0x22')],function(_0x5d0b67){return{'model':db[_0x5d0b67[_0x54e1('0x23')]],'as':_0x5d0b67['as'],'attributes':_0x5d0b67[_0x54e1('0x1f')],'include':_0x5d0b67[_0x54e1('0x22')]?_[_0x54e1('0x21')](_0x5d0b67[_0x54e1('0x22')],function(_0x2e471c){return{'model':db[_0x2e471c[_0x54e1('0x23')]],'as':_0x2e471c['as'],'attributes':_0x2e471c[_0x54e1('0x1f')],'include':_0x2e471c[_0x54e1('0x22')]?_[_0x54e1('0x21')](_0x2e471c[_0x54e1('0x22')],function(_0x3e3a5c){return{'model':db[_0x3e3a5c[_0x54e1('0x23')]],'as':_0x3e3a5c['as'],'attributes':_0x3e3a5c[_0x54e1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25f85b){logger[_0x54e1('0xf')](_0x54e1('0x19'),_0x342ae0);logger[_0x54e1('0x11')]('GetWhatsappQueue',_0x342ae0,JSON[_0x54e1('0x13')](_0x25f85b));_0x519322(_0x25f85b);})[_0x54e1('0x18')](function(_0xf5545){logger[_0x54e1('0x14')]('GetWhatsappQueue',_0xf5545['message'],_0x342ae0);_0x4b2306(_0x37f37c[_0x54e1('0x14')](0x1f4,_0xf5545[_0x54e1('0x17')]));});});};exports[_0x54e1('0x24')]=function(_0x1b739f){var _0x2dea5c=this;return new Promise(function(_0x5ad752,_0x3bbc5f){return db['WhatsappQueue']['find']({'raw':_0x1b739f[_0x54e1('0x1c')]?_0x1b739f[_0x54e1('0x1c')][_0x54e1('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b739f[_0x54e1('0x1c')]?_0x1b739f['options'][_0x54e1('0x1e')]||null:null,'attributes':_0x1b739f[_0x54e1('0x1c')]?_0x1b739f[_0x54e1('0x1c')][_0x54e1('0x1f')]||null:null,'include':_0x1b739f[_0x54e1('0x1c')]?_0x1b739f[_0x54e1('0x1c')][_0x54e1('0x22')]?_['map'](_0x1b739f[_0x54e1('0x1c')]['include'],function(_0x39ddb2){return{'model':db[_0x39ddb2[_0x54e1('0x23')]],'as':_0x39ddb2['as'],'attributes':_0x39ddb2['attributes'],'include':_0x39ddb2[_0x54e1('0x22')]?_['map'](_0x39ddb2['include'],function(_0x222593){return{'model':db[_0x222593['model']],'as':_0x222593['as'],'attributes':_0x222593[_0x54e1('0x1f')],'include':_0x222593[_0x54e1('0x22')]?_[_0x54e1('0x21')](_0x222593[_0x54e1('0x22')],function(_0x2566e3){return{'model':db[_0x2566e3[_0x54e1('0x23')]],'as':_0x2566e3['as'],'attributes':_0x2566e3[_0x54e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x54e1('0xe')](function(_0x2bcac1){logger['info'](_0x54e1('0x24'),_0x1b739f);logger[_0x54e1('0x11')](_0x54e1('0x24'),_0x1b739f,JSON[_0x54e1('0x13')](_0x2bcac1));_0x5ad752(_0x2bcac1);})['catch'](function(_0xe00730){logger['error'](_0x54e1('0x24'),_0xe00730[_0x54e1('0x17')],_0x1b739f);_0x3bbc5f(_0x2dea5c[_0x54e1('0x14')](0x1f4,_0xe00730['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6b96755..f98f2bf 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 _0x042c=['emit','removeListener','register','whatsappQueue:','save','update'];(function(_0x236de9,_0x472262){var _0x531c58=function(_0x2ee6e2){while(--_0x2ee6e2){_0x236de9['push'](_0x236de9['shift']());}};_0x531c58(++_0x472262);}(_0x042c,0x17e));var _0xc042=function(_0x82d776,_0x5e6da8){_0x82d776=_0x82d776-0x0;var _0x5a7d02=_0x042c[_0x82d776];return _0x5a7d02;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xc042('0x0'),'remove',_0xc042('0x1')];function createListener(_0xf7e5aa,_0x3f7ab9){return function(_0x2d737f){_0x3f7ab9[_0xc042('0x2')](_0xf7e5aa,_0x2d737f);};}function removeListener(_0x233beb,_0x37a6aa){return function(){WhatsappQueueEvents[_0xc042('0x3')](_0x233beb,_0x37a6aa);};}exports[_0xc042('0x4')]=function(_0x2992cb){for(var _0x2a81bf=0x0,_0x503d2a=events['length'];_0x2a81bf<_0x503d2a;_0x2a81bf++){var _0x2c8a70=events[_0x2a81bf];var _0x3cf69f=createListener(_0xc042('0x5')+_0x2c8a70,_0x2992cb);WhatsappQueueEvents['on'](_0x2c8a70,_0x3cf69f);}}; \ No newline at end of file +var _0xb0c1=['./whatsappQueue.events','emit','register','length','whatsappQueue:'];(function(_0x3751cb,_0x5bddef){var _0x1d1f83=function(_0x35de0a){while(--_0x35de0a){_0x3751cb['push'](_0x3751cb['shift']());}};_0x1d1f83(++_0x5bddef);}(_0xb0c1,0x1cc));var _0x1b0c=function(_0x793e1f,_0x1a6b01){_0x793e1f=_0x793e1f-0x0;var _0x4fd522=_0xb0c1[_0x793e1f];return _0x4fd522;};'use strict';var WhatsappQueueEvents=require(_0x1b0c('0x0'));var events=['save','remove','update'];function createListener(_0x2cf23c,_0x5c8bab){return function(_0x3dc62b){_0x5c8bab[_0x1b0c('0x1')](_0x2cf23c,_0x3dc62b);};}function removeListener(_0x2d6d61,_0x385289){return function(){WhatsappQueueEvents['removeListener'](_0x2d6d61,_0x385289);};}exports[_0x1b0c('0x2')]=function(_0x333c32){for(var _0x5be38b=0x0,_0x2d83ba=events[_0x1b0c('0x3')];_0x5be38b<_0x2d83ba;_0x5be38b++){var _0x1a3999=events[_0x5be38b];var _0x3cdbdb=createListener(_0x1b0c('0x4')+_0x1a3999,_0x333c32);WhatsappQueueEvents['on'](_0x1a3999,_0x3cdbdb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f878f2a..83796f8 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 _0x74ba=['/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','index'];(function(_0x47c8d8,_0x27d887){var _0x22184a=function(_0x13c91c){while(--_0x13c91c){_0x47c8d8['push'](_0x47c8d8['shift']());}};_0x22184a(++_0x27d887);}(_0x74ba,0x174));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xa74b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa74b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa74b('0x2'));var auth=require(_0xa74b('0x3'));var interaction=require(_0xa74b('0x4'));var config=require('../../config/environment');var controller=require(_0xa74b('0x5'));router[_0xa74b('0x6')]('/',auth['isAuthenticated'](),controller[_0xa74b('0x7')]);router[_0xa74b('0x6')](_0xa74b('0x8'),auth[_0xa74b('0x9')](),controller[_0xa74b('0xa')]);router[_0xa74b('0x6')](_0xa74b('0xb'),auth[_0xa74b('0x9')](),controller[_0xa74b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa74b('0xd')]);router[_0xa74b('0xe')](_0xa74b('0xb'),auth[_0xa74b('0x9')](),controller[_0xa74b('0xf')]);router[_0xa74b('0x10')](_0xa74b('0xb'),auth['isAuthenticated'](),controller[_0xa74b('0x11')]);module[_0xa74b('0x12')]=router; \ No newline at end of file +var _0xebf3=['delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create'];(function(_0x22f5ea,_0x3a6a30){var _0xe5955=function(_0x139704){while(--_0x139704){_0x22f5ea['push'](_0x22f5ea['shift']());}};_0xe5955(++_0x3a6a30);}(_0xebf3,0x1e1));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3ebf('0x0'));var util=require('util');var path=require(_0x3ebf('0x1'));var timeout=require(_0x3ebf('0x2'));var express=require(_0x3ebf('0x3'));var router=express['Router']();var fs_extra=require(_0x3ebf('0x4'));var auth=require(_0x3ebf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ebf('0x6'));router[_0x3ebf('0x7')]('/',auth[_0x3ebf('0x8')](),controller[_0x3ebf('0x9')]);router[_0x3ebf('0x7')](_0x3ebf('0xa'),auth[_0x3ebf('0x8')](),controller[_0x3ebf('0xb')]);router[_0x3ebf('0x7')](_0x3ebf('0xc'),auth[_0x3ebf('0x8')](),controller['show']);router['post']('/',auth[_0x3ebf('0x8')](),controller[_0x3ebf('0xd')]);router['put'](_0x3ebf('0xc'),auth[_0x3ebf('0x8')](),controller['update']);router[_0x3ebf('0xe')](_0x3ebf('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e4168c7..9f6199f 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0xb451c8,_0x1c5a6e){var _0xd6693=function(_0x3d1053){while(--_0x3d1053){_0xb451c8['push'](_0xb451c8['shift']());}};_0xd6693(++_0x1c5a6e);}(_0x7a54,0x106));var _0x47a5=function(_0x16c626,_0x3be70b){_0x16c626=_0x16c626-0x0;var _0x12d761=_0x7a54[_0x16c626];return _0x12d761;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4dec44,_0xca070){var _0x86d0ba=function(_0x1e2ead){while(--_0x1e2ead){_0x4dec44['push'](_0x4dec44['shift']());}};_0x86d0ba(++_0xca070);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a9adf77..3a2cd8f 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 _0x878f=['intersection','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','WhatsappQueueReport','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes'];(function(_0x393801,_0x3d6873){var _0x15db3b=function(_0x52fa52){while(--_0x52fa52){_0x393801['push'](_0x393801['shift']());}};_0x15db3b(++_0x3d6873);}(_0x878f,0x173));var _0xf878=function(_0x204f73,_0x42352f){_0x204f73=_0x204f73-0x0;var _0x2e6357=_0x878f[_0x204f73];return _0x2e6357;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x339c9c,_0x596fb5){_0x596fb5=_0x596fb5||0xcc;return function(_0x1ce004){if(_0x1ce004){return _0x339c9c[_0xf878('0x15')](_0x596fb5);}return _0x339c9c[_0xf878('0x16')](_0x596fb5)['end']();};}function respondWithResult(_0xe2c2de,_0x3902f7){_0x3902f7=_0x3902f7||0xc8;return function(_0x119e9e){if(_0x119e9e){return _0xe2c2de['status'](_0x3902f7)['json'](_0x119e9e);}};}function respondWithFilteredResult(_0x4c0948,_0x35ff2d){return function(_0x31d888){if(_0x31d888){var _0x6dbeca=typeof _0x35ff2d[_0xf878('0x17')]===_0xf878('0x18')&&typeof _0x35ff2d[_0xf878('0x19')]===_0xf878('0x18');var _0x3c5dee=_0x31d888[_0xf878('0x1a')];var _0x3b2e1b=_0x6dbeca?0x0:_0x35ff2d['offset'];var _0x2b2b54=_0x6dbeca?_0x31d888[_0xf878('0x1a')]:_0x35ff2d[_0xf878('0x17')]+_0x35ff2d[_0xf878('0x19')];var _0x3714f6;if(_0x2b2b54>=_0x3c5dee){_0x2b2b54=_0x3c5dee;_0x3714f6=0xc8;}else{_0x3714f6=0xce;}_0x4c0948[_0xf878('0x16')](_0x3714f6);return _0x4c0948[_0xf878('0x1b')]('Content-Range',_0x3b2e1b+'-'+_0x2b2b54+'/'+_0x3c5dee)[_0xf878('0x1c')](_0x31d888);}return null;};}function patchUpdates(_0x140866){return function(_0x250f85){try{jsonpatch['apply'](_0x250f85,_0x140866,!![]);}catch(_0x432e5d){return BPromise[_0xf878('0x1d')](_0x432e5d);}return _0x250f85[_0xf878('0x1e')]();};}function saveUpdates(_0x392822,_0x22d884){return function(_0x442450){if(_0x442450){return _0x442450[_0xf878('0x1f')](_0x392822)[_0xf878('0x20')](function(_0x212436){return _0x212436;});}return null;};}function removeEntity(_0x1a6506,_0x45e61f){return function(_0x566995){if(_0x566995){return _0x566995[_0xf878('0x21')]()['then'](function(){_0x1a6506[_0xf878('0x16')](0xcc)[_0xf878('0x22')]();});}};}function handleEntityNotFound(_0x35b3b4,_0x280036){return function(_0x20449e){if(!_0x20449e){_0x35b3b4['sendStatus'](0x194);}return _0x20449e;};}function handleError(_0x58c713,_0x59ba7b){_0x59ba7b=_0x59ba7b||0x1f4;return function(_0x242926){logger[_0xf878('0x23')](_0x242926[_0xf878('0x24')]);if(_0x242926['name']){delete _0x242926[_0xf878('0x25')];}_0x58c713[_0xf878('0x16')](_0x59ba7b)[_0xf878('0x26')](_0x242926);};}exports[_0xf878('0x27')]=function(_0x41dd55,_0x5aff46){var _0x502322={},_0x9a127d={},_0x5d9c97={'count':0x0,'rows':[]};var _0x4a0286=_[_0xf878('0x28')](db['WhatsappQueueReport'][_0xf878('0x29')],function(_0x51afaf){return{'name':_0x51afaf[_0xf878('0x2a')],'type':_0x51afaf['type'][_0xf878('0x2b')]};});_0x9a127d['model']=_[_0xf878('0x28')](_0x4a0286,_0xf878('0x25'));_0x9a127d[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x41dd55[_0xf878('0x2c')]);_0x9a127d[_0xf878('0x2e')]=_['intersection'](_0x9a127d[_0xf878('0x2f')],_0x9a127d[_0xf878('0x2c')]);_0x502322[_0xf878('0x30')]=_[_0xf878('0x31')](_0x9a127d[_0xf878('0x2f')],qs['fields'](_0x41dd55[_0xf878('0x2c')][_0xf878('0x32')]));_0x502322['attributes']=_0x502322[_0xf878('0x30')][_0xf878('0x33')]?_0x502322[_0xf878('0x30')]:_0x9a127d[_0xf878('0x2f')];if(!_0x41dd55[_0xf878('0x2c')]['hasOwnProperty'](_0xf878('0x34'))){_0x502322[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x41dd55[_0xf878('0x2c')]['limit']);_0x502322[_0xf878('0x17')]=qs['offset'](_0x41dd55['query'][_0xf878('0x17')]);}_0x502322[_0xf878('0x35')]=qs[_0xf878('0x36')](_0x41dd55[_0xf878('0x2c')][_0xf878('0x36')]);_0x502322['where']=qs[_0xf878('0x2e')](_['pick'](_0x41dd55[_0xf878('0x2c')],_0x9a127d[_0xf878('0x2e')]),_0x4a0286);if(_0x41dd55['query'][_0xf878('0x37')]){_0x502322[_0xf878('0x38')]=_['merge'](_0x502322[_0xf878('0x38')],{'$or':_[_0xf878('0x28')](_0x4a0286,function(_0x5b4098){if(_0x5b4098[_0xf878('0x39')]!==_0xf878('0x3a')){var _0x34731d={};_0x34731d[_0x5b4098[_0xf878('0x25')]]={'$like':'%'+_0x41dd55[_0xf878('0x2c')][_0xf878('0x37')]+'%'};return _0x34731d;}})});}_0x502322=_[_0xf878('0x3b')]({},_0x502322,_0x41dd55['options']);var _0x1179fb={'where':_0x502322[_0xf878('0x38')]};return db['WhatsappQueueReport'][_0xf878('0x1a')](_0x1179fb)['then'](function(_0x489964){_0x5d9c97[_0xf878('0x1a')]=_0x489964;if(_0x41dd55[_0xf878('0x2c')][_0xf878('0x3c')]){_0x502322[_0xf878('0x3d')]=[{'all':!![]}];}return db[_0xf878('0x3e')]['findAll'](_0x502322);})[_0xf878('0x20')](function(_0x4c4ae4){_0x5d9c97[_0xf878('0x3f')]=_0x4c4ae4;return _0x5d9c97;})[_0xf878('0x20')](respondWithFilteredResult(_0x5aff46,_0x502322))['catch'](handleError(_0x5aff46,null));};exports['show']=function(_0x180594,_0x2a66c1){var _0x13fcd3={'raw':!![],'where':{'id':_0x180594[_0xf878('0x40')]['id']}},_0x2f6ee5={};_0x2f6ee5[_0xf878('0x2f')]=_[_0xf878('0x2d')](db[_0xf878('0x3e')][_0xf878('0x29')]);_0x2f6ee5['query']=_[_0xf878('0x2d')](_0x180594[_0xf878('0x2c')]);_0x2f6ee5[_0xf878('0x2e')]=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],_0x2f6ee5[_0xf878('0x2c')]);_0x13fcd3['attributes']=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],qs[_0xf878('0x32')](_0x180594[_0xf878('0x2c')][_0xf878('0x32')]));_0x13fcd3['attributes']=_0x13fcd3[_0xf878('0x30')][_0xf878('0x33')]?_0x13fcd3[_0xf878('0x30')]:_0x2f6ee5[_0xf878('0x2f')];if(_0x180594['query'][_0xf878('0x3c')]){_0x13fcd3[_0xf878('0x3d')]=[{'all':!![]}];}_0x13fcd3=_[_0xf878('0x3b')]({},_0x13fcd3,_0x180594['options']);return db['WhatsappQueueReport'][_0xf878('0x41')](_0x13fcd3)['then'](handleEntityNotFound(_0x2a66c1,null))['then'](respondWithResult(_0x2a66c1,null))['catch'](handleError(_0x2a66c1,null));};exports[_0xf878('0x42')]=function(_0x49e719,_0x156fdb){return db[_0xf878('0x3e')][_0xf878('0x42')](_0x49e719[_0xf878('0x43')],{})[_0xf878('0x20')](respondWithResult(_0x156fdb,0xc9))[_0xf878('0x44')](handleError(_0x156fdb,null));};exports[_0xf878('0x1f')]=function(_0x526c89,_0xb0bf4c){if(_0x526c89[_0xf878('0x43')]['id']){delete _0x526c89[_0xf878('0x43')]['id'];}return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x526c89['params']['id']}})['then'](handleEntityNotFound(_0xb0bf4c,null))[_0xf878('0x20')](saveUpdates(_0x526c89[_0xf878('0x43')],null))['then'](respondWithResult(_0xb0bf4c,null))[_0xf878('0x44')](handleError(_0xb0bf4c,null));};exports['destroy']=function(_0x1ce6b9,_0x31adde){return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x1ce6b9['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x31adde,null))[_0xf878('0x20')](removeEntity(_0x31adde,null))[_0xf878('0x44')](handleError(_0x31adde,null));};exports['describe']=function(_0xce30a5,_0x30df05){return db[_0xf878('0x3e')][_0xf878('0x45')]()['then'](respondWithResult(_0x30df05,null))[_0xf878('0x44')](handleError(_0x30df05,null));}; \ No newline at end of file +var _0xb78e=['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','offset','undefined','count','json','apply','reject','save','destroy','error','stack','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x96bf0d,_0x5eacc7){var _0x40c52c=function(_0x34bd35){while(--_0x34bd35){_0x96bf0d['push'](_0x96bf0d['shift']());}};_0x40c52c(++_0x5eacc7);}(_0xb78e,0x1c9));var _0xeb78=function(_0x10d0f6,_0x5ad8aa){_0x10d0f6=_0x10d0f6-0x0;var _0x1a039a=_0xb78e[_0x10d0f6];return _0x1a039a;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){_0x3c8e66[_0xeb78('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a00b,_0x5fc575){return function(_0x315f98){if(!_0x315f98){_0x9a00b[_0xeb78('0x1d')](0x194);}return _0x315f98;};}function handleError(_0x4bcdcf,_0x108052){_0x108052=_0x108052||0x1f4;return function(_0x515158){logger[_0xeb78('0x28')](_0x515158[_0xeb78('0x29')]);if(_0x515158[_0xeb78('0x2a')]){delete _0x515158['name'];}_0x4bcdcf[_0xeb78('0x1e')](_0x108052)[_0xeb78('0x2b')](_0x515158);};}exports[_0xeb78('0x2c')]=function(_0x381b2f,_0x3d4a97){var _0x3516b8={},_0x1131a9={},_0x22c25f={'count':0x0,'rows':[]};var _0x29d6cf=_[_0xeb78('0x2d')](db[_0xeb78('0x2e')]['rawAttributes'],function(_0x555d89){return{'name':_0x555d89['fieldName'],'type':_0x555d89[_0xeb78('0x2f')][_0xeb78('0x30')]};});_0x1131a9[_0xeb78('0x31')]=_['map'](_0x29d6cf,_0xeb78('0x2a'));_0x1131a9[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x381b2f[_0xeb78('0x32')]);_0x1131a9[_0xeb78('0x34')]=_[_0xeb78('0x35')](_0x1131a9[_0xeb78('0x31')],_0x1131a9[_0xeb78('0x32')]);_0x3516b8[_0xeb78('0x36')]=_['intersection'](_0x1131a9[_0xeb78('0x31')],qs['fields'](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x37')]));_0x3516b8[_0xeb78('0x36')]=_0x3516b8[_0xeb78('0x36')][_0xeb78('0x38')]?_0x3516b8[_0xeb78('0x36')]:_0x1131a9['model'];if(!_0x381b2f['query'][_0xeb78('0x39')](_0xeb78('0x3a'))){_0x3516b8[_0xeb78('0x3b')]=qs[_0xeb78('0x3b')](_0x381b2f[_0xeb78('0x32')]['limit']);_0x3516b8[_0xeb78('0x20')]=qs[_0xeb78('0x20')](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x20')]);}_0x3516b8[_0xeb78('0x3c')]=qs[_0xeb78('0x3d')](_0x381b2f['query']['sort']);_0x3516b8['where']=qs['filters'](_[_0xeb78('0x3e')](_0x381b2f[_0xeb78('0x32')],_0x1131a9[_0xeb78('0x34')]),_0x29d6cf);if(_0x381b2f['query'][_0xeb78('0x3f')]){_0x3516b8[_0xeb78('0x40')]=_['merge'](_0x3516b8['where'],{'$or':_['map'](_0x29d6cf,function(_0xbea3b8){if(_0xbea3b8[_0xeb78('0x2f')]!==_0xeb78('0x41')){var _0x4ea5e2={};_0x4ea5e2[_0xbea3b8[_0xeb78('0x2a')]]={'$like':'%'+_0x381b2f[_0xeb78('0x32')][_0xeb78('0x3f')]+'%'};return _0x4ea5e2;}})});}_0x3516b8=_['merge']({},_0x3516b8,_0x381b2f[_0xeb78('0x42')]);var _0x119848={'where':_0x3516b8[_0xeb78('0x40')]};return db[_0xeb78('0x2e')]['count'](_0x119848)['then'](function(_0x45eaa1){_0x22c25f[_0xeb78('0x22')]=_0x45eaa1;if(_0x381b2f[_0xeb78('0x32')][_0xeb78('0x43')]){_0x3516b8[_0xeb78('0x44')]=[{'all':!![]}];}return db[_0xeb78('0x2e')][_0xeb78('0x45')](_0x3516b8);})[_0xeb78('0x46')](function(_0x47567d){_0x22c25f['rows']=_0x47567d;return _0x22c25f;})[_0xeb78('0x46')](respondWithFilteredResult(_0x3d4a97,_0x3516b8))[_0xeb78('0x47')](handleError(_0x3d4a97,null));};exports[_0xeb78('0x48')]=function(_0x4dfb67,_0x382d6d){var _0x47d80b={'raw':!![],'where':{'id':_0x4dfb67[_0xeb78('0x49')]['id']}},_0x21f81b={};_0x21f81b[_0xeb78('0x31')]=_['keys'](db[_0xeb78('0x2e')][_0xeb78('0x4a')]);_0x21f81b[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x4dfb67[_0xeb78('0x32')]);_0x21f81b['filters']=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],_0x21f81b['query']);_0x47d80b[_0xeb78('0x36')]=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],qs['fields'](_0x4dfb67[_0xeb78('0x32')][_0xeb78('0x37')]));_0x47d80b[_0xeb78('0x36')]=_0x47d80b[_0xeb78('0x36')][_0xeb78('0x38')]?_0x47d80b[_0xeb78('0x36')]:_0x21f81b['model'];if(_0x4dfb67['query'][_0xeb78('0x43')]){_0x47d80b[_0xeb78('0x44')]=[{'all':!![]}];}_0x47d80b=_['merge']({},_0x47d80b,_0x4dfb67[_0xeb78('0x42')]);return db[_0xeb78('0x2e')][_0xeb78('0x4b')](_0x47d80b)[_0xeb78('0x46')](handleEntityNotFound(_0x382d6d,null))[_0xeb78('0x46')](respondWithResult(_0x382d6d,null))[_0xeb78('0x47')](handleError(_0x382d6d,null));};exports[_0xeb78('0x4c')]=function(_0x8b7c79,_0x9d5b17){return db[_0xeb78('0x2e')][_0xeb78('0x4c')](_0x8b7c79[_0xeb78('0x4d')],{})[_0xeb78('0x46')](respondWithResult(_0x9d5b17,0xc9))[_0xeb78('0x47')](handleError(_0x9d5b17,null));};exports[_0xeb78('0x4e')]=function(_0x58e361,_0x2c4616){if(_0x58e361[_0xeb78('0x4d')]['id']){delete _0x58e361[_0xeb78('0x4d')]['id'];}return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x58e361[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x2c4616,null))[_0xeb78('0x46')](saveUpdates(_0x58e361[_0xeb78('0x4d')],null))[_0xeb78('0x46')](respondWithResult(_0x2c4616,null))['catch'](handleError(_0x2c4616,null));};exports['destroy']=function(_0x553f6d,_0x438c20){return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x553f6d[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x438c20,null))[_0xeb78('0x46')](removeEntity(_0x438c20,null))['catch'](handleError(_0x438c20,null));};exports['describe']=function(_0x39a4d1,_0x48e2){return db[_0xeb78('0x2e')]['describe']()[_0xeb78('0x46')](respondWithResult(_0x48e2,null))[_0xeb78('0x47')](handleError(_0x48e2,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index b91831a..0137351 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 _0x7d1a=['WhatsappQueueReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','./whatsappQueueReport.attributes','exports','define'];(function(_0x7eee7,_0x3779a1){var _0x469f62=function(_0x553717){while(--_0x553717){_0x7eee7['push'](_0x7eee7['shift']());}};_0x469f62(++_0x3779a1);}(_0x7d1a,0x162));var _0xa7d1=function(_0x3dd6c1,_0xa0e73a){_0x3dd6c1=_0x3dd6c1-0x0;var _0x2d9de2=_0x7d1a[_0x3dd6c1];return _0x2d9de2;};'use strict';var _=require(_0xa7d1('0x0'));var util=require('util');var logger=require(_0xa7d1('0x1'))('api');var moment=require(_0xa7d1('0x2'));var BPromise=require(_0xa7d1('0x3'));var rp=require(_0xa7d1('0x4'));var fs=require('fs');var path=require(_0xa7d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa7d1('0x6'));module[_0xa7d1('0x7')]=function(_0x11aa70,_0x291656){return _0x11aa70[_0xa7d1('0x8')](_0xa7d1('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa7d1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3dfb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash'];(function(_0xd5d5d7,_0x549563){var _0x88ee6d=function(_0x4a64e9){while(--_0x4a64e9){_0xd5d5d7['push'](_0xd5d5d7['shift']());}};_0x88ee6d(++_0x549563);}(_0x3dfb,0x11d));var _0xb3df=function(_0x53e743,_0x5bbb09){_0x53e743=_0x53e743-0x0;var _0x5f1416=_0x3dfb[_0x53e743];return _0x5f1416;};'use strict';var _=require(_0xb3df('0x0'));var util=require('util');var logger=require(_0xb3df('0x1'))(_0xb3df('0x2'));var moment=require('moment');var BPromise=require(_0xb3df('0x3'));var rp=require(_0xb3df('0x4'));var fs=require('fs');var path=require(_0xb3df('0x5'));var rimraf=require(_0xb3df('0x6'));var config=require(_0xb3df('0x7'));var attributes=require(_0xb3df('0x8'));module[_0xb3df('0x9')]=function(_0x376fd6,_0x32c5f){return _0x376fd6[_0xb3df('0xa')](_0xb3df('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xb3df('0xc'),'fields':[_0xb3df('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 886538d..a0f1e6f 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 _0xeab2=['body','options','raw','debug','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x4c7915,_0x254a38){var _0x4f3e0d=function(_0x35dd85){while(--_0x35dd85){_0x4c7915['push'](_0x4c7915['shift']());}};_0x4f3e0d(++_0x254a38);}(_0xeab2,0x18e));var _0x2eab=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xeab2[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x2eab('0x0'));var util=require(_0x2eab('0x1'));var moment=require(_0x2eab('0x2'));var BPromise=require('bluebird');var rs=require(_0x2eab('0x3'));var fs=require('fs');var Redis=require(_0x2eab('0x4'));var db=require(_0x2eab('0x5'))['db'];var utils=require(_0x2eab('0x6'));var logger=require(_0x2eab('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2eab('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59f9de,_0x358771,_0x157c7c){return new BPromise(function(_0x40adb7,_0x5efa73){return client[_0x2eab('0x9')](_0x59f9de,_0x157c7c)[_0x2eab('0xa')](function(_0xd78b7c){logger[_0x2eab('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x358771,'request\x20sent');logger['debug'](_0x2eab('0xc'),_0x358771,_0x2eab('0xd'),JSON[_0x2eab('0xe')](_0xd78b7c));if(_0xd78b7c[_0x2eab('0xf')]){if(_0xd78b7c[_0x2eab('0xf')]['code']===0x1f4){logger['error'](_0x2eab('0x10'),_0x358771,_0xd78b7c['error'][_0x2eab('0x11')]);return _0x5efa73(_0xd78b7c[_0x2eab('0xf')]['message']);}logger['error'](_0x2eab('0x10'),_0x358771,_0xd78b7c['error'][_0x2eab('0x11')]);return _0x40adb7(_0xd78b7c['error']['message']);}else{logger[_0x2eab('0xb')](_0x2eab('0x10'),_0x358771,'request\x20sent');_0x40adb7(_0xd78b7c['result'][_0x2eab('0x11')]);}})[_0x2eab('0x12')](function(_0x3c850d){logger[_0x2eab('0xf')](_0x2eab('0x10'),_0x358771,_0x3c850d);_0x5efa73(_0x3c850d);});});}exports[_0x2eab('0x13')]=function(_0x277b06){var _0x491c13=this;return new Promise(function(_0x50f3f1,_0x4209a4){return db[_0x2eab('0x14')][_0x2eab('0x15')](_0x277b06[_0x2eab('0x16')],{'raw':_0x277b06[_0x2eab('0x17')]?_0x277b06[_0x2eab('0x17')][_0x2eab('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x412643){logger['info'](_0x2eab('0x13'),_0x277b06);logger[_0x2eab('0x19')](_0x2eab('0x13'),_0x277b06,JSON[_0x2eab('0xe')](_0x412643));_0x50f3f1(_0x412643);})['catch'](function(_0x538096){logger['error'](_0x2eab('0x13'),_0x538096[_0x2eab('0x11')],_0x277b06);_0x4209a4(_0x491c13[_0x2eab('0xf')](0x1f4,_0x538096[_0x2eab('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x16c953){var _0x2b1f30=this;return new Promise(function(_0x422ba5,_0xb5667a){return db[_0x2eab('0x14')]['update'](_0x16c953['body'],{'raw':_0x16c953['options']?_0x16c953[_0x2eab('0x17')][_0x2eab('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16c953[_0x2eab('0x17')]?_0x16c953[_0x2eab('0x17')][_0x2eab('0x1a')]||null:null,'attributes':_0x16c953[_0x2eab('0x17')]?_0x16c953[_0x2eab('0x17')][_0x2eab('0x1b')]||null:null,'limit':_0x16c953[_0x2eab('0x17')]?_0x16c953['options'][_0x2eab('0x1c')]||null:null})[_0x2eab('0xa')](function(_0x3e7b85){logger[_0x2eab('0xb')](_0x2eab('0x1d'),_0x16c953);logger[_0x2eab('0x19')](_0x2eab('0x1d'),_0x16c953,JSON[_0x2eab('0xe')](_0x3e7b85));_0x422ba5(_0x3e7b85);})[_0x2eab('0x12')](function(_0x13f218){logger[_0x2eab('0xf')]('UpdateWhatsappQueueReport',_0x13f218[_0x2eab('0x11')],_0x16c953);_0xb5667a(_0x2b1f30[_0x2eab('0xf')](0x1f4,_0x13f218[_0x2eab('0x11')]));});});}; \ No newline at end of file +var _0x233e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','where','attributes','limit','util','moment','randomstring'];(function(_0x474dae,_0x7d5ae8){var _0xaf0bb6=function(_0x5e397e){while(--_0x5e397e){_0x474dae['push'](_0x474dae['shift']());}};_0xaf0bb6(++_0x7d5ae8);}(_0x233e,0x1dd));var _0xe233=function(_0xcfe77f,_0x3f454c){_0xcfe77f=_0xcfe77f-0x0;var _0x101579=_0x233e[_0xcfe77f];return _0x101579;};'use strict';var _=require('lodash');var util=require(_0xe233('0x0'));var moment=require(_0xe233('0x1'));var BPromise=require('bluebird');var rs=require(_0xe233('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe233('0x3'));var logger=require(_0xe233('0x4'))(_0xe233('0x5'));var config=require(_0xe233('0x6'));var jayson=require(_0xe233('0x7'));var client=jayson[_0xe233('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x74df9a,_0x29434a,_0x3725b1){return new BPromise(function(_0x2da6ad,_0x56d032){return client[_0xe233('0x9')](_0x74df9a,_0x3725b1)[_0xe233('0xa')](function(_0x5f2e3b){logger['info'](_0xe233('0xb'),_0x29434a,_0xe233('0xc'));logger[_0xe233('0xd')](_0xe233('0xe'),_0x29434a,_0xe233('0xc'),JSON['stringify'](_0x5f2e3b));if(_0x5f2e3b[_0xe233('0xf')]){if(_0x5f2e3b[_0xe233('0xf')][_0xe233('0x10')]===0x1f4){logger[_0xe233('0xf')](_0xe233('0xb'),_0x29434a,_0x5f2e3b[_0xe233('0xf')][_0xe233('0x11')]);return _0x56d032(_0x5f2e3b[_0xe233('0xf')][_0xe233('0x11')]);}logger[_0xe233('0xf')](_0xe233('0xb'),_0x29434a,_0x5f2e3b[_0xe233('0xf')][_0xe233('0x11')]);return _0x2da6ad(_0x5f2e3b[_0xe233('0xf')][_0xe233('0x11')]);}else{logger[_0xe233('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29434a,'request\x20sent');_0x2da6ad(_0x5f2e3b['result'][_0xe233('0x11')]);}})[_0xe233('0x13')](function(_0x3d916d){logger[_0xe233('0xf')](_0xe233('0xb'),_0x29434a,_0x3d916d);_0x56d032(_0x3d916d);});});}exports[_0xe233('0x14')]=function(_0xaf3e6a){var _0x4d477d=this;return new Promise(function(_0x380735,_0x56901c){return db[_0xe233('0x15')]['create'](_0xaf3e6a[_0xe233('0x16')],{'raw':_0xaf3e6a['options']?_0xaf3e6a[_0xe233('0x17')][_0xe233('0x18')]===undefined?!![]:![]:!![]})[_0xe233('0xa')](function(_0x4fca92){logger['info'](_0xe233('0x14'),_0xaf3e6a);logger[_0xe233('0xd')]('CreateWhatsappQueueReport',_0xaf3e6a,JSON[_0xe233('0x19')](_0x4fca92));_0x380735(_0x4fca92);})['catch'](function(_0x3ac326){logger[_0xe233('0xf')]('CreateWhatsappQueueReport',_0x3ac326[_0xe233('0x11')],_0xaf3e6a);_0x56901c(_0x4d477d[_0xe233('0xf')](0x1f4,_0x3ac326[_0xe233('0x11')]));});});};exports[_0xe233('0x1a')]=function(_0x260b4b){var _0x1e56f8=this;return new Promise(function(_0xdcfec0,_0x2ae17d){return db['WhatsappQueueReport']['update'](_0x260b4b['body'],{'raw':_0x260b4b[_0xe233('0x17')]?_0x260b4b[_0xe233('0x17')][_0xe233('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260b4b[_0xe233('0x17')]?_0x260b4b[_0xe233('0x17')][_0xe233('0x1b')]||null:null,'attributes':_0x260b4b['options']?_0x260b4b[_0xe233('0x17')][_0xe233('0x1c')]||null:null,'limit':_0x260b4b[_0xe233('0x17')]?_0x260b4b['options'][_0xe233('0x1d')]||null:null})[_0xe233('0xa')](function(_0x4389ec){logger[_0xe233('0x12')](_0xe233('0x1a'),_0x260b4b);logger[_0xe233('0xd')](_0xe233('0x1a'),_0x260b4b,JSON['stringify'](_0x4389ec));_0xdcfec0(_0x4389ec);})[_0xe233('0x13')](function(_0x4bcdb3){logger[_0xe233('0xf')](_0xe233('0x1a'),_0x4bcdb3[_0xe233('0x11')],_0x260b4b);_0x2ae17d(_0x1e56f8[_0xe233('0xf')](0x1f4,_0x4bcdb3[_0xe233('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 34be3c8..26061cd 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 _0x5bce=['index','/describe','describe','post','create','put','/:id','update','destroy','multer','util','express','Router','fs-extra','get','isAuthenticated'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x5bce,0xd9));var _0xe5bc=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0x5bce[_0x1d930e];return _0x5bbd66;};'use strict';var multer=require(_0xe5bc('0x0'));var util=require(_0xe5bc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5bc('0x2'));var router=express[_0xe5bc('0x3')]();var fs_extra=require(_0xe5bc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xe5bc('0x5')]('/',auth[_0xe5bc('0x6')](),controller[_0xe5bc('0x7')]);router['get'](_0xe5bc('0x8'),auth[_0xe5bc('0x6')](),controller[_0xe5bc('0x9')]);router[_0xe5bc('0x5')]('/:id',auth[_0xe5bc('0x6')](),controller['show']);router[_0xe5bc('0xa')]('/',auth[_0xe5bc('0x6')](),controller[_0xe5bc('0xb')]);router[_0xe5bc('0xc')](_0xe5bc('0xd'),auth[_0xe5bc('0x6')](),controller[_0xe5bc('0xe')]);router['delete'](_0xe5bc('0xd'),auth[_0xe5bc('0x6')](),controller[_0xe5bc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2d84=['../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','describe','post','create','put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x2d84,0x83));var _0x42d8=function(_0x2b2e66,_0x2028b9){_0x2b2e66=_0x2b2e66-0x0;var _0x3842a3=_0x2d84[_0x2b2e66];return _0x3842a3;};'use strict';var multer=require('multer');var util=require(_0x42d8('0x0'));var path=require(_0x42d8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x42d8('0x2')]();var fs_extra=require(_0x42d8('0x3'));var auth=require(_0x42d8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x42d8('0x5'));var controller=require(_0x42d8('0x6'));router['get']('/',auth[_0x42d8('0x7')](),controller['index']);router[_0x42d8('0x8')]('/describe',auth[_0x42d8('0x7')](),controller[_0x42d8('0x9')]);router[_0x42d8('0x8')]('/:id',auth[_0x42d8('0x7')](),controller['show']);router[_0x42d8('0xa')]('/',auth['isAuthenticated'](),controller[_0x42d8('0xb')]);router[_0x42d8('0xc')]('/:id',auth[_0x42d8('0x7')](),controller[_0x42d8('0xd')]);router[_0x42d8('0xe')]('/:id',auth[_0x42d8('0x7')](),controller[_0x42d8('0xf')]);module[_0x42d8('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fe319c9..98f09b3 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 _0xe890=['queue','DATE','STRING','ENUM','account','agent'];(function(_0x3c5ad6,_0x47b7bf){var _0x3154f2=function(_0x3a24de){while(--_0x3a24de){_0x3c5ad6['push'](_0x3c5ad6['shift']());}};_0x3154f2(++_0x47b7bf);}(_0xe890,0x1a6));var _0x0e89=function(_0x10b5da,_0x5a8dfe){_0x10b5da=_0x10b5da-0x0;var _0x2de7d2=_0xe890[_0x10b5da];return _0x2de7d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0e89('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x0e89('0x1')](_0x0e89('0x2'),_0x0e89('0x3'),_0x0e89('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0e89('0x5')]}}; \ No newline at end of file +var _0x3aa2=['sequelize','exports','ENUM','queue','DATE'];(function(_0x433abe,_0x161373){var _0x3ba398=function(_0x397917){while(--_0x397917){_0x433abe['push'](_0x433abe['shift']());}};_0x3ba398(++_0x161373);}(_0x3aa2,0x13b));var _0x23aa=function(_0x20c809,_0x26b566){_0x20c809=_0x20c809-0x0;var _0x1064a1=_0x3aa2[_0x20c809];return _0x1064a1;};'use strict';var Sequelize=require(_0x23aa('0x0'));module[_0x23aa('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x23aa('0x2')]('account','agent',_0x23aa('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x23aa('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3e0311f..35b1d7b 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 _0xc009=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','WhatsappTransferReport','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','keys','options','find','create','body','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x11f982,_0x3325d5){var _0x14a48d=function(_0x3bf05b){while(--_0x3bf05b){_0x11f982['push'](_0x11f982['shift']());}};_0x14a48d(++_0x3325d5);}(_0xc009,0xc9));var _0x9c00=function(_0x220a8e,_0x587041){_0x220a8e=_0x220a8e-0x0;var _0xcccbf2=_0xc009[_0x220a8e];return _0xcccbf2;};'use strict';var emlformat=require(_0x9c00('0x0'));var rimraf=require(_0x9c00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c00('0x2'));var rp=require(_0x9c00('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c00('0x4'));var util=require('util');var path=require(_0x9c00('0x5'));var sox=require(_0x9c00('0x6'));var csv=require(_0x9c00('0x7'));var ejs=require(_0x9c00('0x8'));var fs=require('fs');var fs_extra=require(_0x9c00('0x9'));var _=require('lodash');var squel=require(_0x9c00('0xa'));var crypto=require('crypto');var jsforce=require(_0x9c00('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9c00('0x7'));var querystring=require(_0x9c00('0xc'));var Papa=require(_0x9c00('0xd'));var Redis=require(_0x9c00('0xe'));var authService=require(_0x9c00('0xf'));var qs=require(_0x9c00('0x10'));var as=require(_0x9c00('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c00('0x12'))(_0x9c00('0x13'));var utils=require(_0x9c00('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9c00('0x15'));var db=require(_0x9c00('0x16'))['db'];function respondWithStatusCode(_0x7bec7d,_0x2aca16){_0x2aca16=_0x2aca16||0xcc;return function(_0x54e4fe){if(_0x54e4fe){return _0x7bec7d[_0x9c00('0x17')](_0x2aca16);}return _0x7bec7d[_0x9c00('0x18')](_0x2aca16)[_0x9c00('0x19')]();};}function respondWithResult(_0x2fc8bd,_0x4a8e59){_0x4a8e59=_0x4a8e59||0xc8;return function(_0x39a398){if(_0x39a398){return _0x2fc8bd['status'](_0x4a8e59)[_0x9c00('0x1a')](_0x39a398);}};}function respondWithFilteredResult(_0x1a34cf,_0xd5ce8f){return function(_0x20dccc){if(_0x20dccc){var _0x462a5a=typeof _0xd5ce8f[_0x9c00('0x1b')]===_0x9c00('0x1c')&&typeof _0xd5ce8f[_0x9c00('0x1d')]===_0x9c00('0x1c');var _0x46ee01=_0x20dccc[_0x9c00('0x1e')];var _0x1b2085=_0x462a5a?0x0:_0xd5ce8f['offset'];var _0x1a3217=_0x462a5a?_0x20dccc['count']:_0xd5ce8f[_0x9c00('0x1b')]+_0xd5ce8f['limit'];var _0x20d0d9;if(_0x1a3217>=_0x46ee01){_0x1a3217=_0x46ee01;_0x20d0d9=0xc8;}else{_0x20d0d9=0xce;}_0x1a34cf[_0x9c00('0x18')](_0x20d0d9);return _0x1a34cf[_0x9c00('0x1f')]('Content-Range',_0x1b2085+'-'+_0x1a3217+'/'+_0x46ee01)['json'](_0x20dccc);}return null;};}function patchUpdates(_0x48ab9c){return function(_0x47cfb1){try{jsonpatch['apply'](_0x47cfb1,_0x48ab9c,!![]);}catch(_0x572cc1){return BPromise[_0x9c00('0x20')](_0x572cc1);}return _0x47cfb1[_0x9c00('0x21')]();};}function saveUpdates(_0x3f0b26,_0x539cfb){return function(_0x3ce9e6){if(_0x3ce9e6){return _0x3ce9e6[_0x9c00('0x22')](_0x3f0b26)[_0x9c00('0x23')](function(_0x3c8f26){return _0x3c8f26;});}return null;};}function removeEntity(_0x84d5e0,_0x282337){return function(_0x4cc5dc){if(_0x4cc5dc){return _0x4cc5dc['destroy']()[_0x9c00('0x23')](function(){_0x84d5e0[_0x9c00('0x18')](0xcc)[_0x9c00('0x19')]();});}};}function handleEntityNotFound(_0x20eb7e,_0x1652f6){return function(_0x47f5fc){if(!_0x47f5fc){_0x20eb7e['sendStatus'](0x194);}return _0x47f5fc;};}function handleError(_0x561b48,_0x27e0ad){_0x27e0ad=_0x27e0ad||0x1f4;return function(_0x580156){logger[_0x9c00('0x24')](_0x580156['stack']);if(_0x580156[_0x9c00('0x25')]){delete _0x580156[_0x9c00('0x25')];}_0x561b48[_0x9c00('0x18')](_0x27e0ad)[_0x9c00('0x26')](_0x580156);};}exports[_0x9c00('0x27')]=function(_0x57cc81,_0x305ba0){var _0x5b371f={},_0x46c049={},_0xf7fd66={'count':0x0,'rows':[]};var _0x2572ab=_[_0x9c00('0x28')](db[_0x9c00('0x29')][_0x9c00('0x2a')],function(_0x2631d5){return{'name':_0x2631d5['fieldName'],'type':_0x2631d5['type'][_0x9c00('0x2b')]};});_0x46c049[_0x9c00('0x2c')]=_['map'](_0x2572ab,_0x9c00('0x25'));_0x46c049[_0x9c00('0x2d')]=_['keys'](_0x57cc81[_0x9c00('0x2d')]);_0x46c049['filters']=_[_0x9c00('0x2e')](_0x46c049[_0x9c00('0x2c')],_0x46c049[_0x9c00('0x2d')]);_0x5b371f[_0x9c00('0x2f')]=_[_0x9c00('0x2e')](_0x46c049[_0x9c00('0x2c')],qs[_0x9c00('0x30')](_0x57cc81[_0x9c00('0x2d')][_0x9c00('0x30')]));_0x5b371f[_0x9c00('0x2f')]=_0x5b371f['attributes'][_0x9c00('0x31')]?_0x5b371f[_0x9c00('0x2f')]:_0x46c049[_0x9c00('0x2c')];if(!_0x57cc81[_0x9c00('0x2d')][_0x9c00('0x32')](_0x9c00('0x33'))){_0x5b371f[_0x9c00('0x1d')]=qs[_0x9c00('0x1d')](_0x57cc81[_0x9c00('0x2d')][_0x9c00('0x1d')]);_0x5b371f['offset']=qs[_0x9c00('0x1b')](_0x57cc81[_0x9c00('0x2d')][_0x9c00('0x1b')]);}_0x5b371f[_0x9c00('0x34')]=qs[_0x9c00('0x35')](_0x57cc81[_0x9c00('0x2d')][_0x9c00('0x35')]);_0x5b371f[_0x9c00('0x36')]=qs[_0x9c00('0x37')](_[_0x9c00('0x38')](_0x57cc81[_0x9c00('0x2d')],_0x46c049[_0x9c00('0x37')]),_0x2572ab);if(_0x57cc81[_0x9c00('0x2d')]['filter']){_0x5b371f[_0x9c00('0x36')]=_['merge'](_0x5b371f[_0x9c00('0x36')],{'$or':_[_0x9c00('0x28')](_0x2572ab,function(_0x2efd82){if(_0x2efd82[_0x9c00('0x39')]!==_0x9c00('0x3a')){var _0x387db9={};_0x387db9[_0x2efd82[_0x9c00('0x25')]]={'$like':'%'+_0x57cc81[_0x9c00('0x2d')][_0x9c00('0x3b')]+'%'};return _0x387db9;}})});}_0x5b371f=_[_0x9c00('0x3c')]({},_0x5b371f,_0x57cc81['options']);var _0xe23cf8={'where':_0x5b371f[_0x9c00('0x36')]};return db[_0x9c00('0x29')][_0x9c00('0x1e')](_0xe23cf8)[_0x9c00('0x23')](function(_0x4be855){_0xf7fd66['count']=_0x4be855;if(_0x57cc81[_0x9c00('0x2d')][_0x9c00('0x3d')]){_0x5b371f[_0x9c00('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x9c00('0x3f')](_0x5b371f);})[_0x9c00('0x23')](function(_0x12813d){_0xf7fd66['rows']=_0x12813d;return _0xf7fd66;})[_0x9c00('0x23')](respondWithFilteredResult(_0x305ba0,_0x5b371f))[_0x9c00('0x40')](handleError(_0x305ba0,null));};exports[_0x9c00('0x41')]=function(_0x5d0985,_0x1544da){var _0x11eac9={'raw':!![],'where':{'id':_0x5d0985['params']['id']}},_0x10f640={};_0x10f640['model']=_[_0x9c00('0x42')](db[_0x9c00('0x29')]['rawAttributes']);_0x10f640[_0x9c00('0x2d')]=_[_0x9c00('0x42')](_0x5d0985['query']);_0x10f640['filters']=_[_0x9c00('0x2e')](_0x10f640['model'],_0x10f640[_0x9c00('0x2d')]);_0x11eac9[_0x9c00('0x2f')]=_['intersection'](_0x10f640[_0x9c00('0x2c')],qs[_0x9c00('0x30')](_0x5d0985[_0x9c00('0x2d')][_0x9c00('0x30')]));_0x11eac9[_0x9c00('0x2f')]=_0x11eac9['attributes'][_0x9c00('0x31')]?_0x11eac9[_0x9c00('0x2f')]:_0x10f640[_0x9c00('0x2c')];if(_0x5d0985[_0x9c00('0x2d')][_0x9c00('0x3d')]){_0x11eac9[_0x9c00('0x3e')]=[{'all':!![]}];}_0x11eac9=_['merge']({},_0x11eac9,_0x5d0985[_0x9c00('0x43')]);return db[_0x9c00('0x29')][_0x9c00('0x44')](_0x11eac9)['then'](handleEntityNotFound(_0x1544da,null))[_0x9c00('0x23')](respondWithResult(_0x1544da,null))[_0x9c00('0x40')](handleError(_0x1544da,null));};exports[_0x9c00('0x45')]=function(_0x3ea934,_0x47071b){return db[_0x9c00('0x29')][_0x9c00('0x45')](_0x3ea934['body'],{})[_0x9c00('0x23')](respondWithResult(_0x47071b,0xc9))[_0x9c00('0x40')](handleError(_0x47071b,null));};exports['update']=function(_0x583ee8,_0x2b5aa8){if(_0x583ee8['body']['id']){delete _0x583ee8[_0x9c00('0x46')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x583ee8['params']['id']}})[_0x9c00('0x23')](handleEntityNotFound(_0x2b5aa8,null))[_0x9c00('0x23')](saveUpdates(_0x583ee8['body'],null))['then'](respondWithResult(_0x2b5aa8,null))['catch'](handleError(_0x2b5aa8,null));};exports[_0x9c00('0x47')]=function(_0x4ecf2c,_0x5e3c22){return db[_0x9c00('0x29')][_0x9c00('0x44')]({'where':{'id':_0x4ecf2c[_0x9c00('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e3c22,null))[_0x9c00('0x23')](removeEntity(_0x5e3c22,null))[_0x9c00('0x40')](handleError(_0x5e3c22,null));};exports[_0x9c00('0x49')]=function(_0x4068aa,_0x512154){return db[_0x9c00('0x29')][_0x9c00('0x49')]()[_0x9c00('0x23')](respondWithResult(_0x512154,null))[_0x9c00('0x40')](handleError(_0x512154,null));}; \ No newline at end of file +var _0x5692=['crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','options','includeAll','include','findAll','rows','catch','show','WhatsappTransferReport','merge','find','create','body','destroy','params','describe','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x214126,_0x25704f){var _0x12a7cc=function(_0x39fb40){while(--_0x39fb40){_0x214126['push'](_0x214126['shift']());}};_0x12a7cc(++_0x25704f);}(_0x5692,0x1b8));var _0x2569=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5692[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2569('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2569('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2569('0x2'));var Mustache=require('mustache');var util=require(_0x2569('0x3'));var path=require(_0x2569('0x4'));var sox=require(_0x2569('0x5'));var csv=require(_0x2569('0x6'));var ejs=require(_0x2569('0x7'));var fs=require('fs');var fs_extra=require(_0x2569('0x8'));var _=require(_0x2569('0x9'));var squel=require('squel');var crypto=require(_0x2569('0xa'));var jsforce=require(_0x2569('0xb'));var deskjs=require(_0x2569('0xc'));var toCsv=require(_0x2569('0x6'));var querystring=require(_0x2569('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2569('0xe'));var as=require(_0x2569('0xf'));var hardwareService=require(_0x2569('0x10'));var logger=require(_0x2569('0x11'))(_0x2569('0x12'));var utils=require(_0x2569('0x13'));var config=require(_0x2569('0x14'));var licenseUtil=require(_0x2569('0x15'));var db=require(_0x2569('0x16'))['db'];function respondWithStatusCode(_0x47f43d,_0x3a3922){_0x3a3922=_0x3a3922||0xcc;return function(_0x5289c9){if(_0x5289c9){return _0x47f43d['sendStatus'](_0x3a3922);}return _0x47f43d[_0x2569('0x17')](_0x3a3922)[_0x2569('0x18')]();};}function respondWithResult(_0x527edb,_0x1997db){_0x1997db=_0x1997db||0xc8;return function(_0x4eaaa3){if(_0x4eaaa3){return _0x527edb[_0x2569('0x17')](_0x1997db)['json'](_0x4eaaa3);}};}function respondWithFilteredResult(_0x3bd91c,_0xad122c){return function(_0x14efbf){if(_0x14efbf){var _0x3f846b=typeof _0xad122c[_0x2569('0x19')]==='undefined'&&typeof _0xad122c[_0x2569('0x1a')]===_0x2569('0x1b');var _0x4da2c0=_0x14efbf[_0x2569('0x1c')];var _0x333316=_0x3f846b?0x0:_0xad122c[_0x2569('0x19')];var _0x1dda98=_0x3f846b?_0x14efbf[_0x2569('0x1c')]:_0xad122c[_0x2569('0x19')]+_0xad122c['limit'];var _0x48d964;if(_0x1dda98>=_0x4da2c0){_0x1dda98=_0x4da2c0;_0x48d964=0xc8;}else{_0x48d964=0xce;}_0x3bd91c[_0x2569('0x17')](_0x48d964);return _0x3bd91c[_0x2569('0x1d')](_0x2569('0x1e'),_0x333316+'-'+_0x1dda98+'/'+_0x4da2c0)[_0x2569('0x1f')](_0x14efbf);}return null;};}function patchUpdates(_0x5e3f3a){return function(_0x26594a){try{jsonpatch[_0x2569('0x20')](_0x26594a,_0x5e3f3a,!![]);}catch(_0x5172b6){return BPromise[_0x2569('0x21')](_0x5172b6);}return _0x26594a['save']();};}function saveUpdates(_0x3c7a39,_0x204c01){return function(_0x5a22e8){if(_0x5a22e8){return _0x5a22e8[_0x2569('0x22')](_0x3c7a39)['then'](function(_0x285be0){return _0x285be0;});}return null;};}function removeEntity(_0x512fbb,_0x4d1a3c){return function(_0x173c39){if(_0x173c39){return _0x173c39['destroy']()[_0x2569('0x23')](function(){_0x512fbb['status'](0xcc)[_0x2569('0x18')]();});}};}function handleEntityNotFound(_0x492e24,_0x3dd3dc){return function(_0x3d5c59){if(!_0x3d5c59){_0x492e24[_0x2569('0x24')](0x194);}return _0x3d5c59;};}function handleError(_0x70c4e8,_0x2849d8){_0x2849d8=_0x2849d8||0x1f4;return function(_0x360b4c){logger[_0x2569('0x25')](_0x360b4c[_0x2569('0x26')]);if(_0x360b4c[_0x2569('0x27')]){delete _0x360b4c[_0x2569('0x27')];}_0x70c4e8[_0x2569('0x17')](_0x2849d8)[_0x2569('0x28')](_0x360b4c);};}exports[_0x2569('0x29')]=function(_0x5ce3f7,_0x43410c){var _0x3689ed={},_0x2e4ffe={},_0x5b8a45={'count':0x0,'rows':[]};var _0x2b7f78=_[_0x2569('0x2a')](db['WhatsappTransferReport'][_0x2569('0x2b')],function(_0x49bf01){return{'name':_0x49bf01[_0x2569('0x2c')],'type':_0x49bf01[_0x2569('0x2d')][_0x2569('0x2e')]};});_0x2e4ffe['model']=_[_0x2569('0x2a')](_0x2b7f78,_0x2569('0x27'));_0x2e4ffe[_0x2569('0x2f')]=_[_0x2569('0x30')](_0x5ce3f7[_0x2569('0x2f')]);_0x2e4ffe['filters']=_[_0x2569('0x31')](_0x2e4ffe[_0x2569('0x32')],_0x2e4ffe[_0x2569('0x2f')]);_0x3689ed['attributes']=_['intersection'](_0x2e4ffe[_0x2569('0x32')],qs[_0x2569('0x33')](_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x33')]));_0x3689ed[_0x2569('0x34')]=_0x3689ed[_0x2569('0x34')][_0x2569('0x35')]?_0x3689ed[_0x2569('0x34')]:_0x2e4ffe['model'];if(!_0x5ce3f7[_0x2569('0x2f')]['hasOwnProperty'](_0x2569('0x36'))){_0x3689ed['limit']=qs[_0x2569('0x1a')](_0x5ce3f7[_0x2569('0x2f')]['limit']);_0x3689ed[_0x2569('0x19')]=qs['offset'](_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x19')]);}_0x3689ed[_0x2569('0x37')]=qs[_0x2569('0x38')](_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x38')]);_0x3689ed['where']=qs['filters'](_['pick'](_0x5ce3f7[_0x2569('0x2f')],_0x2e4ffe[_0x2569('0x39')]),_0x2b7f78);if(_0x5ce3f7['query'][_0x2569('0x3a')]){_0x3689ed[_0x2569('0x3b')]=_['merge'](_0x3689ed[_0x2569('0x3b')],{'$or':_[_0x2569('0x2a')](_0x2b7f78,function(_0x4fe776){if(_0x4fe776[_0x2569('0x2d')]!=='VIRTUAL'){var _0xf841fb={};_0xf841fb[_0x4fe776[_0x2569('0x27')]]={'$like':'%'+_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x3a')]+'%'};return _0xf841fb;}})});}_0x3689ed=_['merge']({},_0x3689ed,_0x5ce3f7[_0x2569('0x3c')]);var _0x489492={'where':_0x3689ed[_0x2569('0x3b')]};return db['WhatsappTransferReport']['count'](_0x489492)[_0x2569('0x23')](function(_0x3b25dc){_0x5b8a45[_0x2569('0x1c')]=_0x3b25dc;if(_0x5ce3f7['query'][_0x2569('0x3d')]){_0x3689ed[_0x2569('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x2569('0x3f')](_0x3689ed);})[_0x2569('0x23')](function(_0x1e7c5e){_0x5b8a45[_0x2569('0x40')]=_0x1e7c5e;return _0x5b8a45;})[_0x2569('0x23')](respondWithFilteredResult(_0x43410c,_0x3689ed))[_0x2569('0x41')](handleError(_0x43410c,null));};exports[_0x2569('0x42')]=function(_0x352f6f,_0x3819ce){var _0x14f788={'raw':!![],'where':{'id':_0x352f6f['params']['id']}},_0x7232cc={};_0x7232cc[_0x2569('0x32')]=_[_0x2569('0x30')](db[_0x2569('0x43')]['rawAttributes']);_0x7232cc[_0x2569('0x2f')]=_[_0x2569('0x30')](_0x352f6f[_0x2569('0x2f')]);_0x7232cc[_0x2569('0x39')]=_[_0x2569('0x31')](_0x7232cc[_0x2569('0x32')],_0x7232cc[_0x2569('0x2f')]);_0x14f788[_0x2569('0x34')]=_['intersection'](_0x7232cc[_0x2569('0x32')],qs[_0x2569('0x33')](_0x352f6f[_0x2569('0x2f')]['fields']));_0x14f788[_0x2569('0x34')]=_0x14f788['attributes'][_0x2569('0x35')]?_0x14f788['attributes']:_0x7232cc[_0x2569('0x32')];if(_0x352f6f[_0x2569('0x2f')][_0x2569('0x3d')]){_0x14f788['include']=[{'all':!![]}];}_0x14f788=_[_0x2569('0x44')]({},_0x14f788,_0x352f6f[_0x2569('0x3c')]);return db[_0x2569('0x43')][_0x2569('0x45')](_0x14f788)[_0x2569('0x23')](handleEntityNotFound(_0x3819ce,null))['then'](respondWithResult(_0x3819ce,null))[_0x2569('0x41')](handleError(_0x3819ce,null));};exports[_0x2569('0x46')]=function(_0x112258,_0x1cdbd1){return db['WhatsappTransferReport']['create'](_0x112258[_0x2569('0x47')],{})[_0x2569('0x23')](respondWithResult(_0x1cdbd1,0xc9))['catch'](handleError(_0x1cdbd1,null));};exports['update']=function(_0x224125,_0x22850b){if(_0x224125[_0x2569('0x47')]['id']){delete _0x224125[_0x2569('0x47')]['id'];}return db['WhatsappTransferReport'][_0x2569('0x45')]({'where':{'id':_0x224125['params']['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x22850b,null))['then'](saveUpdates(_0x224125[_0x2569('0x47')],null))[_0x2569('0x23')](respondWithResult(_0x22850b,null))['catch'](handleError(_0x22850b,null));};exports[_0x2569('0x48')]=function(_0xfcddc6,_0x5c9e47){return db['WhatsappTransferReport']['find']({'where':{'id':_0xfcddc6[_0x2569('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c9e47,null))['then'](removeEntity(_0x5c9e47,null))['catch'](handleError(_0x5c9e47,null));};exports[_0x2569('0x4a')]=function(_0x2452b5,_0x366c6b){return db[_0x2569('0x43')]['describe']()[_0x2569('0x23')](respondWithResult(_0x366c6b,null))[_0x2569('0x41')](handleError(_0x366c6b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 26e623a..99e8b50 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 _0x858e=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0x858e,0x1df));var _0xe858=function(_0x3bbc10,_0x57c99a){_0x3bbc10=_0x3bbc10-0x0;var _0x2a0139=_0x858e[_0x3bbc10];return _0x2a0139;};'use strict';var _=require(_0xe858('0x0'));var util=require(_0xe858('0x1'));var logger=require(_0xe858('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe858('0x3'));var rp=require(_0xe858('0x4'));var fs=require('fs');var path=require(_0xe858('0x5'));var rimraf=require(_0xe858('0x6'));var config=require(_0xe858('0x7'));var attributes=require(_0xe858('0x8'));module[_0xe858('0x9')]=function(_0x5edf59,_0x301dc9){return _0x5edf59['define'](_0xe858('0xa'),attributes,{'tableName':_0xe858('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe858('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cca=['define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports'];(function(_0x41e588,_0xd2ddb4){var _0x318f24=function(_0x2f6ee9){while(--_0x2f6ee9){_0x41e588['push'](_0x41e588['shift']());}};_0x318f24(++_0xd2ddb4);}(_0x5cca,0x1b0));var _0xa5cc=function(_0x3434d7,_0x4d4eb0){_0x3434d7=_0x3434d7-0x0;var _0x51eebd=_0x5cca[_0x3434d7];return _0x51eebd;};'use strict';var _=require(_0xa5cc('0x0'));var util=require(_0xa5cc('0x1'));var logger=require(_0xa5cc('0x2'))(_0xa5cc('0x3'));var moment=require(_0xa5cc('0x4'));var BPromise=require(_0xa5cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa5cc('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0xa5cc('0x7')]=function(_0x39399e,_0x57b184){return _0x39399e[_0xa5cc('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0xa5cc('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa5cc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index fc60236..c364463 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 _0x6e2a=['error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x6e2a,0xad));var _0xa6e2=function(_0x583fc6,_0x355254){_0x583fc6=_0x583fc6-0x0;var _0x580750=_0x6e2a[_0x583fc6];return _0x580750;};'use strict';var _=require(_0xa6e2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa6e2('0x1'));var rs=require(_0xa6e2('0x2'));var fs=require('fs');var Redis=require(_0xa6e2('0x3'));var db=require(_0xa6e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6e2('0x5'))('rpc');var config=require(_0xa6e2('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa6e2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xabe00a,_0x135917,_0x50d4b7){return new BPromise(function(_0x357250,_0x1c8f11){return client[_0xa6e2('0x8')](_0xabe00a,_0x50d4b7)[_0xa6e2('0x9')](function(_0x5bc41d){logger[_0xa6e2('0xa')](_0xa6e2('0xb'),_0x135917,'request\x20sent');logger[_0xa6e2('0xc')](_0xa6e2('0xd'),_0x135917,_0xa6e2('0xe'),JSON[_0xa6e2('0xf')](_0x5bc41d));if(_0x5bc41d[_0xa6e2('0x10')]){if(_0x5bc41d['error'][_0xa6e2('0x11')]===0x1f4){logger[_0xa6e2('0x10')](_0xa6e2('0xb'),_0x135917,_0x5bc41d[_0xa6e2('0x10')][_0xa6e2('0x12')]);return _0x1c8f11(_0x5bc41d[_0xa6e2('0x10')][_0xa6e2('0x12')]);}logger['error'](_0xa6e2('0xb'),_0x135917,_0x5bc41d[_0xa6e2('0x10')][_0xa6e2('0x12')]);return _0x357250(_0x5bc41d[_0xa6e2('0x10')][_0xa6e2('0x12')]);}else{logger[_0xa6e2('0xa')](_0xa6e2('0xb'),_0x135917,'request\x20sent');_0x357250(_0x5bc41d[_0xa6e2('0x13')]['message']);}})[_0xa6e2('0x14')](function(_0x383d09){logger[_0xa6e2('0x10')](_0xa6e2('0xb'),_0x135917,_0x383d09);_0x1c8f11(_0x383d09);});});} \ No newline at end of file +var _0x3f3d=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x52e83e,_0xb6538a){var _0x5cac64=function(_0x30d059){while(--_0x30d059){_0x52e83e['push'](_0x52e83e['shift']());}};_0x5cac64(++_0xb6538a);}(_0x3f3d,0x169));var _0xd3f3=function(_0x50018f,_0x1430fc){_0x50018f=_0x50018f-0x0;var _0x278cdf=_0x3f3d[_0x50018f];return _0x278cdf;};'use strict';var _=require(_0xd3f3('0x0'));var util=require(_0xd3f3('0x1'));var moment=require(_0xd3f3('0x2'));var BPromise=require(_0xd3f3('0x3'));var rs=require(_0xd3f3('0x4'));var fs=require('fs');var Redis=require(_0xd3f3('0x5'));var db=require(_0xd3f3('0x6'))['db'];var utils=require(_0xd3f3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd3f3('0x8'));var jayson=require(_0xd3f3('0x9'));var client=jayson[_0xd3f3('0xa')][_0xd3f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5102ab,_0x483da0,_0x4d7913){return new BPromise(function(_0x595433,_0x3940bf){return client[_0xd3f3('0xc')](_0x5102ab,_0x4d7913)[_0xd3f3('0xd')](function(_0x2b25f3){logger[_0xd3f3('0xe')](_0xd3f3('0xf'),_0x483da0,_0xd3f3('0x10'));logger[_0xd3f3('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x483da0,_0xd3f3('0x10'),JSON[_0xd3f3('0x12')](_0x2b25f3));if(_0x2b25f3['error']){if(_0x2b25f3[_0xd3f3('0x13')][_0xd3f3('0x14')]===0x1f4){logger[_0xd3f3('0x13')](_0xd3f3('0xf'),_0x483da0,_0x2b25f3[_0xd3f3('0x13')][_0xd3f3('0x15')]);return _0x3940bf(_0x2b25f3[_0xd3f3('0x13')][_0xd3f3('0x15')]);}logger[_0xd3f3('0x13')](_0xd3f3('0xf'),_0x483da0,_0x2b25f3['error'][_0xd3f3('0x15')]);return _0x595433(_0x2b25f3['error'][_0xd3f3('0x15')]);}else{logger[_0xd3f3('0xe')](_0xd3f3('0xf'),_0x483da0,'request\x20sent');_0x595433(_0x2b25f3['result'][_0xd3f3('0x15')]);}})[_0xd3f3('0x16')](function(_0x11a0f2){logger[_0xd3f3('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x483da0,_0x11a0f2);_0x3940bf(_0x11a0f2);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ebd7eb5..80ca5ab 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe647=['./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','name','Offline\x20apps:','status','online','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0x50f5fa,_0x2eefb4){var _0x9adfe8=function(_0x59510){while(--_0x59510){_0x50f5fa['push'](_0x50f5fa['shift']());}};_0x9adfe8(++_0x2eefb4);}(_0xe647,0x16d));var _0x7e64=function(_0x3e3220,_0x344aaf){_0x3e3220=_0x3e3220-0x0;var _0x5cbb7a=_0xe647[_0x3e3220];return _0x5cbb7a;};'use strict';var _=require(_0x7e64('0x0'));var db=require(_0x7e64('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x7e64('0x2'));var rpc=require(_0x7e64('0x3'));var config=require(_0x7e64('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0x7e64('0x5'));var pm2Config=require(_0x7e64('0x6'));var schedule=require(_0x7e64('0x7'));var chat=require(_0x7e64('0x8'));var whatsapp=require(_0x7e64('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x7e64('0xa'));function main(){return db[_0x7e64('0xb')][_0x7e64('0xc')]()[_0x7e64('0xd')](function(){if(config[_0x7e64('0xe')]){return seedDb[_0x7e64('0xf')]();}})[_0x7e64('0xd')](function(){return checkLicense[_0x7e64('0xf')]();})[_0x7e64('0xd')](function(){return rpc[_0x7e64('0x10')]();})['then'](function(_0x56d2d4){logger['info'](_0x56d2d4);return chat[_0x7e64('0x11')]();})[_0x7e64('0xd')](function(){return whatsapp[_0x7e64('0x11')]();})['then'](function(){return schedule[_0x7e64('0x11')]();})[_0x7e64('0xd')](function(){return transcribe['start']();})['then'](function(){return provider[_0x7e64('0x11')]();})[_0x7e64('0xd')](function(_0x2b223c){logger[_0x7e64('0x12')](_0x2b223c);return pm2['start'](pm2Config);})[_0x7e64('0xd')](function(_0x26d64b){var _0x2e0e7f=_0x26d64b[_0x7e64('0x13')](function(_0x35df8c){return typeof _0x35df8c[_0x7e64('0x14')]===_0x7e64('0x15')&&_0x35df8c['exitCode']>=0x0;});if(_0x2e0e7f[_0x7e64('0x16')]>0x0){throw new Error(_0x2e0e7f['length']+_0x7e64('0x17')+_[_0x7e64('0x18')](_0x2e0e7f,function(_0x3bf9a4){return'\x22'+_0x3bf9a4['pm2_env']['name']+'\x22';}));}logger[_0x7e64('0x12')](_0x7e64('0x19'),_[_0x7e64('0x18')](_[_0x7e64('0x13')](_0x26d64b,{'status':'online'}),_0x7e64('0x1a'))['join']());logger[_0x7e64('0x12')](_0x7e64('0x1b'),_[_0x7e64('0x18')](_[_0x7e64('0x13')](_0x26d64b,function(_0x1444cb){return _0x1444cb[_0x7e64('0x1c')]!==_0x7e64('0x1d');}),'name')['join']()||_0x7e64('0x1e'));console[_0x7e64('0x1f')](_0x7e64('0x20'));})['catch'](function(_0x27b9ab){console[_0x7e64('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x27b9ab);logger['error'](_0x7e64('0x21'),_0x27b9ab);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x22ed=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','None','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','info','start'];(function(_0x2e42e3,_0x513a0){var _0x19db0e=function(_0x349121){while(--_0x349121){_0x2e42e3['push'](_0x2e42e3['shift']());}};_0x19db0e(++_0x513a0);}(_0x22ed,0x1a9));var _0xd22e=function(_0x288536,_0x369b51){_0x288536=_0x288536-0x0;var _0x525e94=_0x22ed[_0x288536];return _0x525e94;};'use strict';var _=require(_0xd22e('0x0'));var db=require(_0xd22e('0x1'))['db'];var seedDb=require(_0xd22e('0x2'));var checkLicense=require(_0xd22e('0x3'));var rpc=require(_0xd22e('0x4'));var config=require(_0xd22e('0x5'));var logger=require(_0xd22e('0x6'))(_0xd22e('0x7'));var pm2=require(_0xd22e('0x8'));var pm2Config=require(_0xd22e('0x9'));var schedule=require(_0xd22e('0xa'));var chat=require(_0xd22e('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd22e('0xc'));var provider=require(_0xd22e('0xd'));function main(){return db['sequelize'][_0xd22e('0xe')]()[_0xd22e('0xf')](function(){if(config['seedDB']){return seedDb[_0xd22e('0x10')]();}})['then'](function(){return checkLicense['default']();})[_0xd22e('0xf')](function(){return rpc['listen']();})['then'](function(_0x54c27d){logger[_0xd22e('0x11')](_0x54c27d);return chat[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(){return whatsapp[_0xd22e('0x12')]();})['then'](function(){return schedule[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(){return transcribe[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(){return provider[_0xd22e('0x12')]();})[_0xd22e('0xf')](function(_0x5d36cb){logger[_0xd22e('0x11')](_0x5d36cb);return pm2[_0xd22e('0x12')](pm2Config);})[_0xd22e('0xf')](function(_0x5b6d95){var _0x3b06e2=_0x5b6d95['filter'](function(_0x3525b5){return typeof _0x3525b5[_0xd22e('0x13')]===_0xd22e('0x14')&&_0x3525b5[_0xd22e('0x13')]>=0x0;});if(_0x3b06e2[_0xd22e('0x15')]>0x0){throw new Error(_0x3b06e2[_0xd22e('0x15')]+_0xd22e('0x16')+_[_0xd22e('0x17')](_0x3b06e2,function(_0x57f44f){return'\x22'+_0x57f44f[_0xd22e('0x18')][_0xd22e('0x19')]+'\x22';}));}logger[_0xd22e('0x11')](_0xd22e('0x1a'),_[_0xd22e('0x17')](_[_0xd22e('0x1b')](_0x5b6d95,{'status':'online'}),_0xd22e('0x19'))['join']());logger[_0xd22e('0x11')]('Offline\x20apps:',_['map'](_[_0xd22e('0x1b')](_0x5b6d95,function(_0x47b008){return _0x47b008['status']!==_0xd22e('0x1c');}),_0xd22e('0x19'))[_0xd22e('0x1d')]()||_0xd22e('0x1e'));console['log'](_0xd22e('0x1f'));})[_0xd22e('0x20')](function(_0x28f5b7){console['log'](_0xd22e('0x21'),_0x28f5b7);logger[_0xd22e('0x22')](_0xd22e('0x23'),_0x28f5b7);process[_0xd22e('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 7523946..6ef583f 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 _0x6aa7=['smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','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.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6aa7,0x178));var _0x76aa=function(_0x41e3fe,_0x2f92a4){_0x41e3fe=_0x41e3fe-0x0;var _0x1c42eb=_0x6aa7[_0x41e3fe];return _0x1c42eb;};'use strict';var db=require(_0x76aa('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x76aa('0x1'));var licenseUtil=require(_0x76aa('0x2'));var encryptor=require(_0x76aa('0x3'));var _=require(_0x76aa('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x76aa('0x5'));var compose=require(_0x76aa('0x6'));var basicAuth=require(_0x76aa('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x76aa('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x76aa('0x9')][_0x76aa('0xa')]});var userAttributes=['id',_0x76aa('0xb'),'fullname',_0x76aa('0xc'),_0x76aa('0xd'),_0x76aa('0xe'),'userpic',_0x76aa('0xf'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13'),_0x76aa('0x14'),_0x76aa('0x15'),_0x76aa('0x16'),_0x76aa('0x17'),_0x76aa('0x18'),'lastLoginAt',_0x76aa('0x19'),'crudPermissions',_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d'),_0x76aa('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x76aa('0x1f'),'phoneBarEnableSettings',_0x76aa('0x20'),_0x76aa('0x21'),'phoneBarRemoteControl',_0x76aa('0x22'),'hotdesk',_0x76aa('0x23'),'userProfileId',_0x76aa('0x24'),_0x76aa('0x25'),_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2f'),_0x76aa('0x30'),_0x76aa('0x31'),_0x76aa('0x32'),'faxAutoanswerDelay',_0x76aa('0x33'),_0x76aa('0x34')];exports[_0x76aa('0x35')]=function(){return this['isAuthenticated'](!![])[_0x76aa('0x36')](function(_0x189cb6,_0x31252f,_0x2bd2c6){if(_0x189cb6[_0x76aa('0x37')]){_0x2bd2c6();}else{return db[_0x76aa('0x38')][_0x76aa('0x39')]({'where':{'id':_0x189cb6[_0x76aa('0x3a')]['id']},'attributes':['id',_0x76aa('0x3b'),_0x76aa('0x3c')],'raw':!![]})[_0x76aa('0x3d')](function(_0x26b75e){if(_0x26b75e&&_0x26b75e[_0x76aa('0x3b')]){return _0x31252f['status'](_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?0x195:0x193)[_0x76aa('0x3f')]({'message':_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?_0x76aa('0x40'):_0x76aa('0x41')});}else{_0x2bd2c6();}})[_0x76aa('0x42')](function(_0xd12a99){_0x2bd2c6(_0xd12a99);});}});};exports[_0x76aa('0x43')]=function isAuthenticated(_0x545b06){return compose()[_0x76aa('0x36')](function(_0x5a8030,_0x994550,_0x365ff8){var _0x2dec94;if(_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')]){if(_[_0x76aa('0x46')](_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')],_0x76aa('0x47'))){var _0x3ea05a=basicAuth(_0x5a8030);db['User'][_0x76aa('0x48')]({'where':{'name':_0x3ea05a[_0x76aa('0xc')]}})[_0x76aa('0x3d')](function(_0x928ccf){if(!_0x928ccf||!_0x928ccf[_0x76aa('0x49')](_0x3ea05a[_0x76aa('0x4a')])){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x4c')});}_0x5a8030[_0x76aa('0x37')]={'id':_0x928ccf['id']};_0x365ff8();})['catch'](function(_0x2ee338){_0x365ff8(_0x2ee338);});}else if(_['startsWith'](_0x5a8030[_0x76aa('0x44')]['authorization'],_0x76aa('0x4d'))){validateJwt(_0x5a8030,_0x994550,_0x365ff8);}else{if(_0x545b06){_0x365ff8();}else{return _0x994550['status'](0x193)['json']({'message':_0x76aa('0x4e')});}}}else if(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')]){try{var _0x37dfab={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')],_0x37dfab)[_0x76aa('0x3d')](function(_0x23e2fd){return db[_0x76aa('0x51')]['find']({'where':{'id':_0x23e2fd[_0x76aa('0x52')]}})['then'](function(_0x5086f5){_0x2dec94=_0x5086f5;return db[_0x76aa('0x53')][_0x76aa('0x39')]({'where':{'id':0x1},'attributes':[_0x76aa('0x54'),_0x76aa('0x55')],'raw':!![]});})['then'](function(_0x401c07){if(!_0x2dec94||!_[_0x76aa('0x56')](_0x2dec94[_0x76aa('0x57')],_0x23e2fd['nonce'])){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x58')});}if(_0x2dec94[_0x76aa('0x59')]){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}if(_0x2dec94[_0x76aa('0x5b')]){if(_0x401c07[_0x76aa('0x55')]>0x0){if(moment(_0x2dec94['blockedAt'])[_0x76aa('0x5c')](_0x401c07[_0x76aa('0x55')],_0x76aa('0x5d'))>moment()){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}}else{return _0x994550['status'](0x191)['json']({'message':_0x76aa('0x5a')});}}_0x5a8030[_0x76aa('0x37')]={'id':_0x2dec94['id']};_0x365ff8();});})[_0x76aa('0x42')](function(){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x5a')});});}catch(_0x403084){_0x365ff8(_0x403084);}}else if(_0x545b06){_0x365ff8();}else{return _0x994550[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x4e')});}})['use'](function(_0x13dafe,_0x556f59,_0xbb3136){if(_0x13dafe['user']){db['User']['find']({'where':{'id':_0x13dafe[_0x76aa('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5cf314){if(!_0x5cf314){return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5e')});}_0x13dafe[_0x76aa('0x37')]=_0x5cf314;_0xbb3136();})[_0x76aa('0x42')](function(_0x27a52e){_0xbb3136(_0x27a52e);});}else if(_0x545b06){_0xbb3136();}else{return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5f')});}});};exports[_0x76aa('0x60')]=function canUpdate(){return compose()[_0x76aa('0x36')](function(_0x3800a4,_0x47a308,_0x2f695c){return licenseUtil[_0x76aa('0x61')]()['then'](function(_0x2d3441){if(_0x2d3441['update']){_0x2f695c();}else{return _0x47a308[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})[_0x76aa('0x42')](function(_0x2d0bc4){_0x2f695c(_0x2d0bc4);});});};exports[_0x76aa('0x63')]=function isWebrtcLicence(){return compose()[_0x76aa('0x36')](function(_0x165858,_0xb8d052,_0x3946bd){return licenseUtil['getLicense']()[_0x76aa('0x3d')](function(_0x4b8f12){if(_0x4b8f12[_0x76aa('0x64')]){_0x3946bd();}else{return _0xb8d052[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})['catch'](function(_0x5a3d9c){_0x3946bd(_0x5a3d9c);});});};exports[_0x76aa('0x65')]=function(_0x54b673,_0x8660a4,_0x302a0c){_0x54b673[_0x76aa('0x65')]=!![];return _0x302a0c();};exports[_0x76aa('0x66')]=function signToken(_0x30c577){return signJwt(_0x30c577);};exports[_0x76aa('0x67')]=function(_0x5b567b,_0x564546){if(!_0x5b567b[_0x76aa('0x37')]){return _0x564546[_0x76aa('0x4b')](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x68')});}var _0x18c679={'payload':{'id':_0x5b567b[_0x76aa('0x37')]['id'],'role':_0x5b567b['user'][_0x76aa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18c679)[_0x76aa('0x3d')](function(_0x26db69){_0x564546['cookie'](_0x76aa('0x69'),_0x26db69);_0x564546['redirect'](_0x76aa('0x6a'));})['catch'](function(_0x339b0d){return _0x564546[_0x76aa('0x4b')](0x1f4)[_0x76aa('0x6b')](_0x339b0d);});};exports[_0x76aa('0x6c')]=function(_0x37a4d9){if(_[_0x76aa('0x6d')](_0x37a4d9[_0x76aa('0x57')])||_['isNil'](_0x37a4d9[_0x76aa('0x6e')])){return null;}else{return createJwt(_0x37a4d9);}};exports['generateApiKey']=function(_0x3ee32){_0x3ee32[_0x76aa('0x57')]=generateNonce();_0x3ee32[_0x76aa('0x6e')]=generateIssuedAt();return createJwt(_0x3ee32);};exports[_0x76aa('0x6f')]=function(_0x3fa7ec,_0x28f8aa){var _0x336024=_0x3fa7ec['query'][_0x76aa('0x50')];if(_0x336024){var _0x281f73={'nonce':_0x28f8aa[_0x76aa('0x57')],'iat':_0x28f8aa[_0x76aa('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x76aa('0x70')]()};return verifyJwt(_0x336024,_0x281f73)[_0x76aa('0x3d')](function(){return generateApiKey(_0x28f8aa);});}else{throw{'message':_0x76aa('0x71')};}};exports[_0x76aa('0x72')]=function(_0x2027f8){var _0xf7732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf7732['test'](_0x2027f8))throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x76aa('0x75'));return;};exports[_0x76aa('0x76')]=function(_0x3967f3,_0x2fdc4f,_0x37babe){var _0x51893b=encryptor['decryptString'](_0x2fdc4f)[_0x76aa('0x77')](',');for(var _0x3b0d8a=0x0;_0x3b0d8a<_0x37babe;_0x3b0d8a++){if(!_0x51893b[_0x3b0d8a])break;if(_0x3967f3['toLowerCase']()===_0x51893b[_0x3b0d8a][_0x76aa('0x78')]()){var _0x1e6f3c=util['format'](_0x76aa('0x79'),_0x37babe);if(_0x37babe===0x1){_0x1e6f3c=_0x76aa('0x7a');}throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x1e6f3c);}}return;};exports[_0x76aa('0x7b')]=function(_0x1f5010,_0x3376ec){var _0x30573a=_0x3376ec?encryptor[_0x76aa('0x7c')](_0x3376ec)['split'](','):[];if(_0x30573a[_0x76aa('0x7d')]===0x5){_0x30573a['splice'](-0x1,0x1);}_0x30573a[_0x76aa('0x7e')](_0x1f5010);return encryptor[_0x76aa('0x7f')](_0x30573a[_0x76aa('0x80')](','));};function signJwt(_0x16cc85){var _0x343cf1=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x82')],{'context':jwt});var _0x431d1c=_0x16cc85[_0x76aa('0x83')]||config['secrets'][_0x76aa('0xa')];return new BPromise(function(_0x3d4025,_0x5c542b){_0x343cf1(_0x16cc85[_0x76aa('0x84')],_0x431d1c,_0x16cc85[_0x76aa('0x85')])[_0x76aa('0x3d')](function(_0x3d6d10){_0x3d4025(_0x3d6d10);})[_0x76aa('0x42')](function(_0x5546b6){_0x5c542b(_0x5546b6);});});}function verifyJwt(_0x364d05,_0x4d3ad0,_0x35bd2b){var _0x35881c=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x86')],{'context':jwt});var _0x3a82fe=_0x35bd2b||config[_0x76aa('0x9')][_0x76aa('0xa')];return new BPromise(function(_0x4a37f1,_0x9ea0af){_0x35881c(_0x364d05,_0x3a82fe,_0x4d3ad0)[_0x76aa('0x3d')](function(_0x543c1d){_0x4a37f1(_0x543c1d);})['catch'](function(_0x40429c){_0x9ea0af(_0x40429c);});});}function generateNonce(){return crypto[_0x76aa('0x87')](0x10)['toString'](_0x76aa('0x88'));}function generateIssuedAt(){return Math[_0x76aa('0x89')](Date[_0x76aa('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x446073){var _0x47f733={'payload':{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')]},'options':{'algorithm':_0x76aa('0x8b'),'subject':_0x446073['id'][_0x76aa('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x47f733)[_0x76aa('0x3d')](function(_0x4dfeb3){return{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')],'token':_0x4dfeb3};});} \ No newline at end of file +var _0xa41a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','then','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','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.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','verify','secrets','session','randomBytes','now','toString','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','allowmessenger'];(function(_0x4c931a,_0x525603){var _0x37d734=function(_0x431b96){while(--_0x431b96){_0x4c931a['push'](_0x4c931a['shift']());}};_0x37d734(++_0x525603);}(_0xa41a,0x6b));var _0xaa41=function(_0x5c432e,_0x2d0ca2){_0x5c432e=_0x5c432e-0x0;var _0x572f50=_0xa41a[_0x5c432e];return _0x572f50;};'use strict';var db=require(_0xaa41('0x0'))['db'];var config=require(_0xaa41('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaa41('0x2'));var encryptor=require(_0xaa41('0x3'));var _=require(_0xaa41('0x4'));var jwt=require(_0xaa41('0x5'));var expressJwt=require(_0xaa41('0x6'));var compose=require(_0xaa41('0x7'));var basicAuth=require(_0xaa41('0x8'));var crypto=require(_0xaa41('0x9'));var BPromise=require('bluebird');var util=require(_0xaa41('0xa'));var moment=require(_0xaa41('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xaa41('0xc'),_0xaa41('0xd'),'name',_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x10'),_0xaa41('0x11'),_0xaa41('0x12'),_0xaa41('0x13'),_0xaa41('0x14'),_0xaa41('0x15'),_0xaa41('0x16'),'smsPause',_0xaa41('0x17'),_0xaa41('0x18'),'showWebBar','lastLoginAt',_0xaa41('0x19'),'crudPermissions',_0xaa41('0x1a'),_0xaa41('0x1b'),_0xaa41('0x1c'),_0xaa41('0x1d'),_0xaa41('0x1e'),'phoneBarDnd',_0xaa41('0x1f'),_0xaa41('0x20'),_0xaa41('0x21'),_0xaa41('0x22'),_0xaa41('0x23'),_0xaa41('0x24'),_0xaa41('0x25'),'hotdesk',_0xaa41('0x26'),_0xaa41('0x27'),_0xaa41('0x28'),_0xaa41('0x29'),_0xaa41('0x2a'),_0xaa41('0x2b'),_0xaa41('0x2c'),_0xaa41('0x2d'),_0xaa41('0x2e'),'selectRecallMeCampaign','chatAutoanswer',_0xaa41('0x2f'),_0xaa41('0x30'),_0xaa41('0x31'),'smsAutoanswer',_0xaa41('0x32'),_0xaa41('0x33'),'openchannelAutoanswerDelay','faxAutoanswer',_0xaa41('0x34'),'whatsappAutoanswer',_0xaa41('0x35')];exports[_0xaa41('0x36')]=function(){return this[_0xaa41('0x37')](!![])[_0xaa41('0x38')](function(_0x1d623c,_0x4eb01f,_0x43c430){if(_0x1d623c[_0xaa41('0x39')]){_0x43c430();}else{return db[_0xaa41('0x3a')][_0xaa41('0x3b')]({'where':{'id':_0x1d623c[_0xaa41('0x3c')]['id']},'attributes':['id',_0xaa41('0x3d'),'disposition'],'raw':!![]})['then'](function(_0x16aec5){if(_0x16aec5&&_0x16aec5['closed']){return _0x4eb01f['status'](_0x16aec5[_0xaa41('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x16aec5[_0xaa41('0x3e')]===_0xaa41('0x3f')?_0xaa41('0x40'):_0xaa41('0x41')});}else{_0x43c430();}})[_0xaa41('0x42')](function(_0xa7269f){_0x43c430(_0xa7269f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x30a174){return compose()[_0xaa41('0x38')](function(_0x63c18c,_0x9a16e3,_0x1d8c2b){var _0x4466a3;if(_0x63c18c[_0xaa41('0x43')][_0xaa41('0x44')]){if(_['startsWith'](_0x63c18c[_0xaa41('0x43')]['authorization'],'Basic')){var _0x714537=basicAuth(_0x63c18c);db[_0xaa41('0x45')]['find']({'where':{'name':_0x714537[_0xaa41('0x46')]}})[_0xaa41('0x47')](function(_0x4e3b44){if(!_0x4e3b44||!_0x4e3b44['authenticate'](_0x714537['pass'])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x4a')});}_0x63c18c[_0xaa41('0x39')]={'id':_0x4e3b44['id']};_0x1d8c2b();})['catch'](function(_0x289c4a){_0x1d8c2b(_0x289c4a);});}else if(_[_0xaa41('0x4b')](_0x63c18c[_0xaa41('0x43')]['authorization'],_0xaa41('0x4c'))){validateJwt(_0x63c18c,_0x9a16e3,_0x1d8c2b);}else{if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x63c18c[_0xaa41('0x4d')][_0xaa41('0x4e')]){try{var _0x57fe1d={'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};verifyJwt(_0x63c18c[_0xaa41('0x4d')]['apikey'],_0x57fe1d)[_0xaa41('0x47')](function(_0x48335f){return db[_0xaa41('0x45')][_0xaa41('0x50')]({'where':{'id':_0x48335f[_0xaa41('0x51')]}})['then'](function(_0x526377){_0x4466a3=_0x526377;return db['Setting'][_0xaa41('0x3b')]({'where':{'id':0x1},'attributes':[_0xaa41('0x52'),_0xaa41('0x53')],'raw':!![]});})[_0xaa41('0x47')](function(_0x4fbb92){if(!_0x4466a3||!_['isEqual'](_0x4466a3[_0xaa41('0x54')],_0x48335f[_0xaa41('0x55')])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x56')});}if(_0x4466a3[_0xaa41('0x57')]){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}if(_0x4466a3[_0xaa41('0x59')]){if(_0x4fbb92[_0xaa41('0x53')]>0x0){if(moment(_0x4466a3[_0xaa41('0x5a')])['add'](_0x4fbb92['blockDuration'],_0xaa41('0x5b'))>moment()){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}}else{return _0x9a16e3['status'](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});}}_0x63c18c[_0xaa41('0x39')]={'id':_0x4466a3['id']};_0x1d8c2b();});})[_0xaa41('0x42')](function(){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});});}catch(_0x21f204){_0x1d8c2b(_0x21f204);}}else if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5c')});}})[_0xaa41('0x38')](function(_0x398c35,_0xc84fb8,_0x1e2eb2){if(_0x398c35['user']){db['User'][_0xaa41('0x50')]({'where':{'id':_0x398c35['user']['id']},'attributes':userAttributes})[_0xaa41('0x47')](function(_0x215896){if(!_0x215896){return _0xc84fb8[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x5d')});}_0x398c35[_0xaa41('0x39')]=_0x215896;_0x1e2eb2();})[_0xaa41('0x42')](function(_0x5ee74c){_0x1e2eb2(_0x5ee74c);});}else if(_0x30a174){_0x1e2eb2();}else{return _0xc84fb8[_0xaa41('0x48')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaa41('0x5e')]=function canUpdate(){return compose()['use'](function(_0x57240d,_0x5274c9,_0x3bad48){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x198716){if(_0x198716['update']){_0x3bad48();}else{return _0x5274c9['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})[_0xaa41('0x42')](function(_0x2af8ba){_0x3bad48(_0x2af8ba);});});};exports[_0xaa41('0x60')]=function isWebrtcLicence(){return compose()[_0xaa41('0x38')](function(_0x258096,_0x37bf5d,_0x2fa6ec){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x22d512){if(_0x22d512[_0xaa41('0x61')]){_0x2fa6ec();}else{return _0x37bf5d[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})['catch'](function(_0x406824){_0x2fa6ec(_0x406824);});});};exports[_0xaa41('0x62')]=function(_0x1f50c,_0x2288f8,_0x57d1f6){_0x1f50c[_0xaa41('0x62')]=!![];return _0x57d1f6();};exports['signToken']=function signToken(_0x49fedd){return signJwt(_0x49fedd);};exports[_0xaa41('0x63')]=function(_0xe0eec0,_0x3e16ef){if(!_0xe0eec0['user']){return _0x3e16ef[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x64')});}var _0x48fa37={'payload':{'id':_0xe0eec0[_0xaa41('0x39')]['id'],'role':_0xe0eec0[_0xaa41('0x39')][_0xaa41('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x48fa37)[_0xaa41('0x47')](function(_0x37fbe2){_0x3e16ef[_0xaa41('0x65')](_0xaa41('0x66'),_0x37fbe2);_0x3e16ef[_0xaa41('0x67')]('/dashboards/general');})[_0xaa41('0x42')](function(_0x5bef5f){return _0x3e16ef['status'](0x1f4)[_0xaa41('0x68')](_0x5bef5f);});};exports[_0xaa41('0x69')]=function(_0x3fef3e){if(_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x54')])||_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x6b')])){return null;}else{return createJwt(_0x3fef3e);}};exports[_0xaa41('0x6c')]=function(_0x519e39){_0x519e39[_0xaa41('0x54')]=generateNonce();_0x519e39[_0xaa41('0x6b')]=generateIssuedAt();return createJwt(_0x519e39);};exports[_0xaa41('0x6d')]=function(_0x4f9e92,_0x2e0f53){var _0x35f664=_0x4f9e92['query'][_0xaa41('0x4e')];if(_0x35f664){var _0xd36d1a={'nonce':_0x2e0f53[_0xaa41('0x54')],'iat':_0x2e0f53['apiKeyIat'],'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};return verifyJwt(_0x35f664,_0xd36d1a)['then'](function(){return generateApiKey(_0x2e0f53);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaa41('0x6e')]=function(_0x3cd14f){var _0x3a29d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3a29d2['test'](_0x3cd14f))throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0xaa41('0x71'));return;};exports[_0xaa41('0x72')]=function(_0x2abb78,_0x5ccdc5,_0x2ae70c){var _0x57cb70=encryptor['decryptString'](_0x5ccdc5)[_0xaa41('0x73')](',');for(var _0x52ae7f=0x0;_0x52ae7f<_0x2ae70c;_0x52ae7f++){if(!_0x57cb70[_0x52ae7f])break;if(_0x2abb78[_0xaa41('0x74')]()===_0x57cb70[_0x52ae7f][_0xaa41('0x74')]()){var _0x169ddf=util['format'](_0xaa41('0x75'),_0x2ae70c);if(_0x2ae70c===0x1){_0x169ddf=_0xaa41('0x76');}throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0x169ddf);}}return;};exports[_0xaa41('0x77')]=function(_0x332a3c,_0xc56018){var _0x337059=_0xc56018?encryptor[_0xaa41('0x78')](_0xc56018)['split'](','):[];if(_0x337059[_0xaa41('0x79')]===0x5){_0x337059[_0xaa41('0x7a')](-0x1,0x1);}_0x337059[_0xaa41('0x7b')](_0x332a3c);return encryptor['encryptString'](_0x337059[_0xaa41('0x7c')](','));};function signJwt(_0x2caf5c){var _0x157898=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x7e')],{'context':jwt});var _0xfbe748=_0x2caf5c[_0xaa41('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x5cb34d,_0x540325){_0x157898(_0x2caf5c['payload'],_0xfbe748,_0x2caf5c['options'])[_0xaa41('0x47')](function(_0x50b598){_0x5cb34d(_0x50b598);})['catch'](function(_0x24c6f3){_0x540325(_0x24c6f3);});});}function verifyJwt(_0x40a524,_0x1a877b,_0x312eee){var _0x5cabc4=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x80')],{'context':jwt});var _0x1ddb6c=_0x312eee||config[_0xaa41('0x81')][_0xaa41('0x82')];return new BPromise(function(_0x41ca40,_0x46ebcd){_0x5cabc4(_0x40a524,_0x1ddb6c,_0x1a877b)[_0xaa41('0x47')](function(_0x1795d1){_0x41ca40(_0x1795d1);})['catch'](function(_0x185600){_0x46ebcd(_0x185600);});});}function generateNonce(){return crypto[_0xaa41('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xaa41('0x84')]()/0x3e8)['toString']();}function createJwt(_0x1eac4a){var _0x5c8028={'payload':{'iat':_0x1eac4a[_0xaa41('0x6b')],'nonce':_0x1eac4a[_0xaa41('0x54')]},'options':{'algorithm':'HS512','subject':_0x1eac4a['id'][_0xaa41('0x85')](),'issuer':hardwareConf[_0xaa41('0x4f')](),'audience':hardwareConf[_0xaa41('0x4f')]()}};return signJwt(_0x5c8028)[_0xaa41('0x47')](function(_0x5a2683){return{'iat':_0x1eac4a['apiKeyIat'],'nonce':_0x1eac4a[_0xaa41('0x54')],'token':_0x5a2683};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index bf6bbc1..6cda7e1 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 _0x1623=['unlink','secret','utf8','base64','decryptString','crypto','../../config/logger','app','secrets','aes-256-ctr','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','write','end','final','binary','decryptFile','createDecipher','close'];(function(_0x160786,_0x4ff135){var _0x4b12d9=function(_0x96af1c){while(--_0x96af1c){_0x160786['push'](_0x160786['shift']());}};_0x4b12d9(++_0x4ff135);}(_0x1623,0x1a9));var _0x3162=function(_0xbe415e,_0x2af5f6){_0xbe415e=_0xbe415e-0x0;var _0xf920c2=_0x1623[_0xbe415e];return _0xf920c2;};'use strict';var crypto=require(_0x3162('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x3162('0x1'))(_0x3162('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3162('0x3')]['session'],'algorithm':_0x3162('0x4')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x3162('0x5')][_0x3162('0x6')]){var isSupported=isAlgorithmSupported(config[_0x3162('0x5')][_0x3162('0x6')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x3162('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x3162('0x5')][_0x3162('0x6')],_0x3162('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x11b22a){return AES_SUPPORTED_RX[_0x3162('0x8')](_0x11b22a);}function getSupportedCiphers(){return crypto[_0x3162('0x9')]()[_0x3162('0xa')](isASupportedCipher);}function isAlgorithmSupported(_0x248401){return getSupportedCiphers()[_0x3162('0xb')](_0x248401)>-0x1;}function combineOptions(_0x954b89){var _0x2523e0={};for(var _0x40b927 in fileOptions){if(fileOptions[_0x3162('0xc')](_0x40b927)){_0x2523e0[_0x40b927]=fileOptions[_0x40b927];}}if(_0x954b89){for(var _0x57e063 in _0x954b89){if(_0x954b89['hasOwnProperty'](_0x57e063)){_0x2523e0[_0x57e063]=_0x954b89[_0x57e063];}}}return _0x2523e0;}exports[_0x3162('0xd')]=function(_0x43dca9,_0x4901dc,_0x28a645,_0x5a145c){return new BPromise(function(_0x4517d5,_0x684c2f){_0x5a145c=combineOptions(_0x5a145c);var _0x2c1bcc=new Buffer(_0x28a645);var _0x11fd0d=fs[_0x3162('0xe')](_0x43dca9);var _0x2ec85e=fs[_0x3162('0xf')](_0x4901dc);var _0x2896a6=crypto['createCipher'](_0x5a145c[_0x3162('0x6')],_0x2c1bcc);_0x11fd0d['on'](_0x3162('0x10'),function(_0x315a05){var _0x4e1779=new Buffer(_0x2896a6[_0x3162('0x11')](_0x315a05),'binary');_0x2ec85e[_0x3162('0x12')](_0x4e1779);});_0x11fd0d['on'](_0x3162('0x13'),function(){try{var _0x22a301=new Buffer(_0x2896a6[_0x3162('0x14')]('binary'),_0x3162('0x15'));_0x2ec85e[_0x3162('0x12')](_0x22a301);_0x2ec85e[_0x3162('0x13')]();_0x2ec85e['on']('close',function(){return _0x4517d5(_0x4901dc);});}catch(_0x488983){fs['unlink'](_0x4901dc);return _0x684c2f(_0x488983);}});});};exports[_0x3162('0x16')]=function(_0x2a8967,_0xa1824,_0x432dde,_0x1c9a3){return new BPromise(function(_0x58fcc2,_0xc47aba){_0x1c9a3=combineOptions(_0x1c9a3);var _0x14a357=new Buffer(_0x432dde);var _0x466f3e=fs['createReadStream'](_0x2a8967);var _0x29e663=fs[_0x3162('0xf')](_0xa1824);var _0x465ecc=crypto[_0x3162('0x17')](_0x1c9a3['algorithm'],_0x14a357);_0x466f3e['on']('data',function(_0x567f34){var _0x328858=new Buffer(_0x465ecc[_0x3162('0x11')](_0x567f34),_0x3162('0x15'));_0x29e663['write'](_0x328858);});_0x466f3e['on']('end',function(){try{var _0x5e6d3b=new Buffer(_0x465ecc[_0x3162('0x14')](_0x3162('0x15')),'binary');_0x29e663['write'](_0x5e6d3b);_0x29e663[_0x3162('0x13')]();_0x29e663['on'](_0x3162('0x18'),function(){return _0x58fcc2(_0xa1824);});}catch(_0x3d9721){fs[_0x3162('0x19')](_0xa1824);return _0xc47aba(_0x3d9721);}});});};exports['encryptString']=function(_0x5808b6,_0x57d225,_0x252bbf){var _0x2d0062=_0x252bbf||stringOptions[_0x3162('0x6')];var _0x5c72b4=_0x57d225||stringOptions[_0x3162('0x1a')];var _0x63807=crypto['createCipher'](_0x2d0062,_0x5c72b4);var _0x367edd=_0x63807[_0x3162('0x11')](_0x5808b6,_0x3162('0x1b'),_0x3162('0x1c'));_0x367edd+=_0x63807['final'](_0x3162('0x1c'));return _0x367edd;};exports[_0x3162('0x1d')]=function(_0x1219bb,_0x7ee907,_0x2e700d){var _0x38396a=_0x2e700d||stringOptions[_0x3162('0x6')];var _0x18280c=_0x7ee907||stringOptions[_0x3162('0x1a')];var _0x5ef429=crypto[_0x3162('0x17')](_0x38396a,_0x18280c);var _0x271e65=_0x5ef429[_0x3162('0x11')](_0x1219bb,_0x3162('0x1c'),_0x3162('0x1b'));_0x271e65+=_0x5ef429['final'](_0x3162('0x1b'));return _0x271e65;}; \ No newline at end of file +var _0x737c=['unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','write','end','final','binary','close'];(function(_0x20dceb,_0x52a817){var _0x453e81=function(_0x54fa78){while(--_0x54fa78){_0x20dceb['push'](_0x20dceb['shift']());}};_0x453e81(++_0x52a817);}(_0x737c,0x143));var _0xc737=function(_0x5edef8,_0x7af9a9){_0x5edef8=_0x5edef8-0x0;var _0x5438f6=_0x737c[_0x5edef8];return _0x5438f6;};'use strict';var crypto=require(_0xc737('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xc737('0x1'));var config=require(_0xc737('0x2'));var logger=require(_0xc737('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc737('0x4')][_0xc737('0x5')],'algorithm':_0xc737('0x6')};const fileOptions={'algorithm':_0xc737('0x7')};if(config[_0xc737('0x8')]&&config['encrypt'][_0xc737('0x9')]){var isSupported=isAlgorithmSupported(config[_0xc737('0x8')][_0xc737('0x9')]);if(isSupported){fileOptions[_0xc737('0x9')]=config[_0xc737('0x8')][_0xc737('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc737('0xa')](',\x20');logger[_0xc737('0xb')](config[_0xc737('0x8')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x781d68){return AES_SUPPORTED_RX['test'](_0x781d68);}function getSupportedCiphers(){return crypto[_0xc737('0xc')]()[_0xc737('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x26d6f9){return getSupportedCiphers()[_0xc737('0xe')](_0x26d6f9)>-0x1;}function combineOptions(_0x4ee430){var _0x2e9f6d={};for(var _0x21c2e7 in fileOptions){if(fileOptions['hasOwnProperty'](_0x21c2e7)){_0x2e9f6d[_0x21c2e7]=fileOptions[_0x21c2e7];}}if(_0x4ee430){for(var _0x158bfc in _0x4ee430){if(_0x4ee430[_0xc737('0xf')](_0x158bfc)){_0x2e9f6d[_0x158bfc]=_0x4ee430[_0x158bfc];}}}return _0x2e9f6d;}exports[_0xc737('0x10')]=function(_0x4ef476,_0x20118d,_0x37a32e,_0x5cfb01){return new BPromise(function(_0x1053ad,_0x472d75){_0x5cfb01=combineOptions(_0x5cfb01);var _0x5183d3=new Buffer(_0x37a32e);var _0x4770ca=fs[_0xc737('0x11')](_0x4ef476);var _0x15a449=fs[_0xc737('0x12')](_0x20118d);var _0x5a40df=crypto[_0xc737('0x13')](_0x5cfb01[_0xc737('0x9')],_0x5183d3);_0x4770ca['on'](_0xc737('0x14'),function(_0x5c1deb){var _0x4ddb2f=new Buffer(_0x5a40df[_0xc737('0x15')](_0x5c1deb),'binary');_0x15a449[_0xc737('0x16')](_0x4ddb2f);});_0x4770ca['on'](_0xc737('0x17'),function(){try{var _0x1984b6=new Buffer(_0x5a40df[_0xc737('0x18')](_0xc737('0x19')),_0xc737('0x19'));_0x15a449[_0xc737('0x16')](_0x1984b6);_0x15a449[_0xc737('0x17')]();_0x15a449['on'](_0xc737('0x1a'),function(){return _0x1053ad(_0x20118d);});}catch(_0x4826ce){fs[_0xc737('0x1b')](_0x20118d);return _0x472d75(_0x4826ce);}});});};exports[_0xc737('0x1c')]=function(_0x119c91,_0x5ad580,_0x31cde5,_0x235bd9){return new BPromise(function(_0x5792ef,_0x1c29c7){_0x235bd9=combineOptions(_0x235bd9);var _0x4ebbbb=new Buffer(_0x31cde5);var _0x5555bb=fs[_0xc737('0x11')](_0x119c91);var _0xc75b40=fs[_0xc737('0x12')](_0x5ad580);var _0x4fa259=crypto[_0xc737('0x1d')](_0x235bd9[_0xc737('0x9')],_0x4ebbbb);_0x5555bb['on'](_0xc737('0x14'),function(_0x579da7){var _0x3adfc7=new Buffer(_0x4fa259['update'](_0x579da7),'binary');_0xc75b40[_0xc737('0x16')](_0x3adfc7);});_0x5555bb['on'](_0xc737('0x17'),function(){try{var _0x5519d5=new Buffer(_0x4fa259[_0xc737('0x18')]('binary'),_0xc737('0x19'));_0xc75b40[_0xc737('0x16')](_0x5519d5);_0xc75b40[_0xc737('0x17')]();_0xc75b40['on'](_0xc737('0x1a'),function(){return _0x5792ef(_0x5ad580);});}catch(_0x2ca12f){fs[_0xc737('0x1b')](_0x5ad580);return _0x1c29c7(_0x2ca12f);}});});};exports[_0xc737('0x1e')]=function(_0x50f658,_0x2a7b63,_0x124e91){var _0x1556e2=_0x124e91||stringOptions[_0xc737('0x9')];var _0x4b396b=_0x2a7b63||stringOptions[_0xc737('0x1f')];var _0x7d2ea1=crypto[_0xc737('0x13')](_0x1556e2,_0x4b396b);var _0x2c8dc0=_0x7d2ea1[_0xc737('0x15')](_0x50f658,_0xc737('0x20'),_0xc737('0x21'));_0x2c8dc0+=_0x7d2ea1[_0xc737('0x18')](_0xc737('0x21'));return _0x2c8dc0;};exports[_0xc737('0x22')]=function(_0x5401a6,_0x2161b6,_0x2e8245){var _0x4f5e88=_0x2e8245||stringOptions[_0xc737('0x9')];var _0x24a868=_0x2161b6||stringOptions[_0xc737('0x1f')];var _0x69ed49=crypto[_0xc737('0x1d')](_0x4f5e88,_0x24a868);var _0x2425a1=_0x69ed49[_0xc737('0x15')](_0x5401a6,_0xc737('0x21'),_0xc737('0x20'));_0x2425a1+=_0x69ed49[_0xc737('0x18')]('utf8');return _0x2425a1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index fb739ce..33cd62f 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 _0x263a=['Empty','split','length','isInteger','forEach','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','mkdirSync','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num'];(function(_0x3c8832,_0x16e93e){var _0xacf303=function(_0x1c7f46){while(--_0x1c7f46){_0x3c8832['push'](_0x3c8832['shift']());}};_0xacf303(++_0x16e93e);}(_0x263a,0x1d3));var _0xa263=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x263a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xa263('0x0'));var path=require(_0xa263('0x1'));var _=require(_0xa263('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa263('0x3'));var zipdir=require(_0xa263('0x4'));var rimraf=require(_0xa263('0x5'));var db=require(_0xa263('0x6'))['db'];var dbH=require(_0xa263('0x6'))[_0xa263('0x7')];var logger=require('../../config/logger')(_0xa263('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa263('0x9')][0x2]);var QUERY=process[_0xa263('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d7e01,_0x53a8e7){var _0x4a9da2={'status':_0x2d7e01};var _0x3a0c32={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53a8e7){_0x4a9da2['savename']=_0x53a8e7;}return db['AnalyticExtractedReport']['update'](_0x4a9da2,_0x3a0c32);}function main(){var _0x52776d=0x1388;var _0xb9cbb4;logger[_0xa263('0xa')](util['format'](_0xa263('0xb'),EXTRACTED_REPORT_ID,_0xa263('0xc')));return db[_0xa263('0xd')][_0xa263('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa263('0xf')]})[_0xa263('0x10')](function(_0x52f1d3){if(_0x52f1d3){_0xb9cbb4=_0x52f1d3;_0x52776d=_0xb9cbb4['splitSizeCsv']||0x1388;}})[_0xa263('0x10')](function(){return dbH[_0xa263('0x11')][_0xa263('0x12')](util[_0xa263('0x13')](_0xa263('0x14'),QUERY),{'type':dbH[_0xa263('0x11')][_0xa263('0x15')]['SELECT']});})['then'](function(_0x421796){if(!_0x421796[0x0][_0xa263('0x16')]){return analyticExtractedReport(_0xa263('0x17'));}var _0x2391ad=[];var _0x126b8c=0x0;if(_0xb9cbb4[_0xa263('0x18')]){if(_0x421796&&_0x421796[_0xa263('0x19')]){var _0x296a1d=_['range'](_0x421796[0x0][_0xa263('0x16')]/_0x52776d);var _0x579440=Number[_0xa263('0x1a')](_0x421796[0x0]['num']/_0x52776d)?_0x421796[0x0]['num']%_0x52776d:0x0;_0x296a1d[_0xa263('0x1b')](function(_0x5673ce){if(_0x5673ce>0x0){_0x126b8c+=_0x52776d;}_0x2391ad[_0xa263('0x1c')](dbH['sequelize'][_0xa263('0x12')](util[_0xa263('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x52776d,_0x126b8c),{'type':dbH[_0xa263('0x11')][_0xa263('0x15')][_0xa263('0x1d')]}));});if(_0x579440>0x0){_0x126b8c+=_0x52776d;_0x2391ad['push'](dbH[_0xa263('0x11')][_0xa263('0x12')](util['format'](_0xa263('0x1e'),QUERY,_0x579440,_0x126b8c),{'type':dbH['sequelize'][_0xa263('0x15')]['SELECT']}));}}}else{_0x2391ad[_0xa263('0x1c')](dbH[_0xa263('0x11')]['query'](QUERY,{'type':dbH['sequelize'][_0xa263('0x15')][_0xa263('0x1d')]}));}var _0x57f6f4=path[_0xa263('0x1f')](PATH);var _0x2a8995=path['basename'](PATH,_0xa263('0x20'));var _0x5719b8=_0xb9cbb4['split']&&_0x2391ad[_0xa263('0x19')]>0x1;var _0x5ac2b8=[];if(!fs[_0xa263('0x21')](path[_0xa263('0x22')](_0x57f6f4,_0x2a8995))&&_0x5719b8){fs[_0xa263('0x23')](path[_0xa263('0x22')](_0x57f6f4,_0x2a8995));}return BPromise['each'](_0x2391ad,function(_0x2eff36){_0x5ac2b8['push'](_0x2eff36);})[_0xa263('0x10')](function(){for(var _0x28033b=0x0;_0x28033b<_0x5ac2b8[_0xa263('0x19')];_0x28033b+=0x1){var _0x202fa1;var _0x565648=_0x5ac2b8[_0x28033b];if(_0x5719b8){_0x202fa1=path[_0xa263('0x22')](_0x57f6f4,_0x2a8995,util[_0xa263('0x13')](_0xa263('0x24'),_0x2a8995,_0x28033b,'csv'));}else{_0x202fa1=path['join'](_0x57f6f4,util[_0xa263('0x13')](_0xa263('0x25'),_0x2a8995,'csv'));}fs[_0xa263('0x26')](_0x202fa1,csv(_0x565648));}})[_0xa263('0x10')](function(){if(_0x5719b8){return new Promise(function(_0x3b89ef){zipdir(path['join'](_0x57f6f4,_0x2a8995),{'saveTo':path[_0xa263('0x22')](_0x57f6f4,util[_0xa263('0x13')]('%s.%s',_0x2a8995,_0xa263('0x27')))},function(_0x5c1bb1,_0x16208a){rimraf(path['join'](_0x57f6f4,_0x2a8995),function(){});_0x3b89ef(_0xa263('0x28'));});});}})[_0xa263('0x10')](function(){logger[_0xa263('0xa')](util[_0xa263('0x13')](_0xa263('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xa263('0x2a'),_0x5719b8?util[_0xa263('0x13')](_0xa263('0x25'),_0x2a8995,_0x5719b8?_0xa263('0x27'):'csv'):null);});})[_0xa263('0x2b')](function(_0x56bf28){logger['info'](util['format'](_0xa263('0x2c'),EXTRACTED_REPORT_ID,_0xa263('0xc')),util[_0xa263('0x2d')](_0x56bf28,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa263('0x2e'));})[_0xa263('0x2f')](function(){process[_0xa263('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xfe1b=['util','path','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfe1b,0x96));var _0xbfe1=function(_0x48761b,_0x40504f){_0x48761b=_0x48761b-0x0;var _0x4defee=_0xfe1b[_0x48761b];return _0x4defee;};'use strict';var util=require(_0xbfe1('0x0'));var path=require(_0xbfe1('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xbfe1('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xbfe1('0x3'));var db=require(_0xbfe1('0x4'))['db'];var dbH=require(_0xbfe1('0x4'))[_0xbfe1('0x5')];var logger=require(_0xbfe1('0x6'))(_0xbfe1('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xbfe1('0x8')][0x2]);var QUERY=process[_0xbfe1('0x8')][0x3];var PATH=process[_0xbfe1('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x236408,_0x53bd00){var _0xedc4ee={'status':_0x236408};var _0x3bf35c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53bd00){_0xedc4ee[_0xbfe1('0x9')]=_0x53bd00;}return db['AnalyticExtractedReport'][_0xbfe1('0xa')](_0xedc4ee,_0x3bf35c);}function main(){var _0x469206=0x1388;var _0x12773f;logger[_0xbfe1('0xb')](util['format'](_0xbfe1('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xbfe1('0xd')][_0xbfe1('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xbfe1('0xf')]})[_0xbfe1('0x10')](function(_0x30270a){if(_0x30270a){_0x12773f=_0x30270a;_0x469206=_0x12773f[_0xbfe1('0xf')]||0x1388;}})[_0xbfe1('0x10')](function(){return dbH[_0xbfe1('0x11')][_0xbfe1('0x12')](util[_0xbfe1('0x13')](_0xbfe1('0x14'),QUERY),{'type':dbH[_0xbfe1('0x11')]['QueryTypes'][_0xbfe1('0x15')]});})[_0xbfe1('0x10')](function(_0x219ae2){if(!_0x219ae2[0x0][_0xbfe1('0x16')]){return analyticExtractedReport(_0xbfe1('0x17'));}var _0x23812a=[];var _0x5bff0c=0x0;if(_0x12773f[_0xbfe1('0x18')]){if(_0x219ae2&&_0x219ae2[_0xbfe1('0x19')]){var _0x3fb59a=_[_0xbfe1('0x1a')](_0x219ae2[0x0]['num']/_0x469206);var _0x241283=Number[_0xbfe1('0x1b')](_0x219ae2[0x0]['num']/_0x469206)?_0x219ae2[0x0][_0xbfe1('0x16')]%_0x469206:0x0;_0x3fb59a[_0xbfe1('0x1c')](function(_0x3cf684){if(_0x3cf684>0x0){_0x5bff0c+=_0x469206;}_0x23812a[_0xbfe1('0x1d')](dbH['sequelize']['query'](util['format'](_0xbfe1('0x1e'),QUERY,_0x469206,_0x5bff0c),{'type':dbH[_0xbfe1('0x11')][_0xbfe1('0x1f')]['SELECT']}));});if(_0x241283>0x0){_0x5bff0c+=_0x469206;_0x23812a['push'](dbH['sequelize']['query'](util[_0xbfe1('0x13')](_0xbfe1('0x1e'),QUERY,_0x241283,_0x5bff0c),{'type':dbH[_0xbfe1('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x23812a[_0xbfe1('0x1d')](dbH[_0xbfe1('0x11')]['query'](QUERY,{'type':dbH[_0xbfe1('0x11')][_0xbfe1('0x1f')][_0xbfe1('0x15')]}));}var _0x441463=path['dirname'](PATH);var _0x16d5c2=path[_0xbfe1('0x20')](PATH,'.csv');var _0x3ba394=_0x12773f['split']&&_0x23812a[_0xbfe1('0x19')]>0x1;var _0x5e7627=[];if(!fs['existsSync'](path[_0xbfe1('0x21')](_0x441463,_0x16d5c2))&&_0x3ba394){fs[_0xbfe1('0x22')](path['join'](_0x441463,_0x16d5c2));}return BPromise['each'](_0x23812a,function(_0x5714d2){_0x5e7627[_0xbfe1('0x1d')](_0x5714d2);})[_0xbfe1('0x10')](function(){for(var _0x4508ca=0x0;_0x4508ca<_0x5e7627[_0xbfe1('0x19')];_0x4508ca+=0x1){var _0x1f32f0;var _0x19a983=_0x5e7627[_0x4508ca];if(_0x3ba394){_0x1f32f0=path[_0xbfe1('0x21')](_0x441463,_0x16d5c2,util[_0xbfe1('0x13')](_0xbfe1('0x23'),_0x16d5c2,_0x4508ca,_0xbfe1('0x24')));}else{_0x1f32f0=path[_0xbfe1('0x21')](_0x441463,util[_0xbfe1('0x13')](_0xbfe1('0x25'),_0x16d5c2,'csv'));}fs[_0xbfe1('0x26')](_0x1f32f0,csv(_0x19a983));}})['then'](function(){if(_0x3ba394){return new Promise(function(_0x238aff){zipdir(path[_0xbfe1('0x21')](_0x441463,_0x16d5c2),{'saveTo':path[_0xbfe1('0x21')](_0x441463,util['format']('%s.%s',_0x16d5c2,_0xbfe1('0x27')))},function(_0x44ce5e,_0xa9222b){rimraf(path['join'](_0x441463,_0x16d5c2),function(){});_0x238aff(_0xbfe1('0x28'));});});}})[_0xbfe1('0x10')](function(){logger['info'](util[_0xbfe1('0x13')](_0xbfe1('0x29'),EXTRACTED_REPORT_ID,_0xbfe1('0x2a')));return analyticExtractedReport(_0xbfe1('0x2b'),_0x3ba394?util['format'](_0xbfe1('0x25'),_0x16d5c2,_0x3ba394?_0xbfe1('0x27'):_0xbfe1('0x24')):null);});})[_0xbfe1('0x2c')](function(_0x5a9e1d){logger[_0xbfe1('0xb')](util[_0xbfe1('0x13')](_0xbfe1('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0xbfe1('0x2e')](_0x5a9e1d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbfe1('0x2f'));})[_0xbfe1('0x30')](function(){process[_0xbfe1('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 2986c7b..f4e02f8 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 _0xf312=['existsSync','join','createPdfKitDocument','%s%d.%s','pdf','all','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','catch','info','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','argv','savename','update','pick','map','length','auto','body','concat','chunk','keys','forEach','startDate','format','endDate','push','pageBreak','before','margin','landscape','toString','\x20/\x20','Arial','black','right','Empty','find','split','then','splitSizePdf','range','num','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','QueryTypes','basename','.pdf'];(function(_0x1fa9b4,_0x3284d5){var _0xc3b796=function(_0x29f37d){while(--_0x29f37d){_0x1fa9b4['push'](_0x1fa9b4['shift']());}};_0xc3b796(++_0x3284d5);}(_0xf312,0x172));var _0x2f31=function(_0x45c1f0,_0x362416){_0x45c1f0=_0x45c1f0-0x0;var _0x8468fe=_0xf312[_0x45c1f0];return _0x8468fe;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x2f31('0x0'));var moment=require('moment');var htmlToPdfmake=require(_0x2f31('0x1'));var PdfPrinter=require(_0x2f31('0x2'));var zipdir=require(_0x2f31('0x3'));var rimraf=require(_0x2f31('0x4'));var JSDOM=require(_0x2f31('0x5'))['JSDOM'];var window=new JSDOM('')[_0x2f31('0x6')];var BPromise=require('bluebird');var db=require(_0x2f31('0x7'))['db'];var dbH=require(_0x2f31('0x7'))[_0x2f31('0x8')];var logger=require(_0x2f31('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2f31('0xa')][0x2]);var QUERY=process[_0x2f31('0xa')][0x3];var PATH=process[_0x2f31('0xa')][0x4];var NAME=process[_0x2f31('0xa')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2603ab,_0x420568){var _0x18027a={'status':_0x2603ab};var _0x15806a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x420568){_0x18027a[_0x2f31('0xb')]=_0x420568;}return db['AnalyticExtractedReport'][_0x2f31('0xc')](_0x18027a,_0x15806a);}function getHeaders(_0x4d3635){return _['map'](_0x4d3635,function(_0x4d9e0f){return{'text':_0x4d9e0f,'style':'tableHeader'};});}function getRows(_0x1c74fd,_0x50e27e){return _['map'](_0x50e27e,function(_0x19de1b){return _(_0x19de1b)[_0x2f31('0xd')](_0x1c74fd)[_0x2f31('0xe')](function(_0x5c7c77){return _0x5c7c77?_['toString'](_0x5c7c77):'';})['value']();});}function createTable(_0x3c7044,_0x536272){var _0x414066={'widths':_['fill'](Array(_0x3c7044[_0x2f31('0xf')]),0x91),'heights':function(_0x5642e9){return _0x5642e9===0x0?_0x2f31('0x10'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x596360=getHeaders(_0x3c7044);_0x414066[_0x2f31('0x11')]['push'](_0x596360);var _0x1fd51a=getRows(_0x3c7044,_0x536272);_0x414066[_0x2f31('0x11')]=_0x414066[_0x2f31('0x11')][_0x2f31('0x12')](_0x1fd51a);return _0x414066;}function createTables(_0x3b2374){var _0x10ef00=[];var _0x19a65d=_[_0x2f31('0x13')](Object[_0x2f31('0x14')](_0x3b2374[0x0]),0x5);_0x19a65d[_0x2f31('0x15')](function(_0x490360){_0x10ef00['push'](createTable(_0x490360,_0x3b2374));});return _0x10ef00;}function getPDFDocDefinition(_0x3eb249){var _0x2b4b79=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x2f31('0x16')])[_0x2f31('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0x2f31('0x18')])[_0x2f31('0x17')](FORMAT));var _0x1c15b6=[];for(var _0x2bdb18=0x0;_0x2bdb18<_0x3eb249[_0x2f31('0xf')];_0x2bdb18++){var _0x18e488=[];if(_0x2bdb18===0x0){_0x18e488[_0x2f31('0x19')]({'text':_0x2b4b79,'style':'header'});}var _0x2517b2={'table':_0x3eb249[_0x2bdb18]};if(_0x2bdb18>0x0){_0x2517b2[_0x2f31('0x1a')]=_0x2f31('0x1b');_0x2517b2[_0x2f31('0x1c')]=[0x0,0x46,0x0,0x0];}_0x18e488[_0x2f31('0x19')](_0x2517b2);_0x1c15b6['push'](_0x18e488);}return{'pageSize':'A4','pageOrientation':_0x2f31('0x1d'),'content':_0x1c15b6,'footer':function(_0x1725c6,_0x26e258){return{'text':_0x1725c6[_0x2f31('0x1e')]()+_0x2f31('0x1f')+_0x26e258,'style':'footer'};},'defaultStyle':{'font':_0x2f31('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2f31('0x21')},'footer':{'alignment':_0x2f31('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x26b3d9){var _0x5e73a7=0x1388;var _0x48b9d6;if(!_0x26b3d9[0x0]['num']){return analyticExtractedReport(_0x2f31('0x23'));}return db['Setting'][_0x2f31('0x24')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2f31('0x25'),'splitSizePdf']})[_0x2f31('0x26')](function(_0x445c75){if(_0x445c75){_0x48b9d6=_0x445c75;_0x5e73a7=_0x48b9d6[_0x2f31('0x27')]||0x3e8;}})[_0x2f31('0x26')](function(){var _0x4ba6f6=[];var _0x29d2b8=0x0;if(_0x48b9d6['split']){if(_0x26b3d9&&_0x26b3d9[_0x2f31('0xf')]){var _0x2968ff=_[_0x2f31('0x28')](_0x26b3d9[0x0][_0x2f31('0x29')]/_0x5e73a7);var _0xe2f3a9=Number[_0x2f31('0x2a')](_0x26b3d9[0x0]['num']/_0x5e73a7)?_0x26b3d9[0x0][_0x2f31('0x29')]%_0x5e73a7:0x0;_0x2968ff[_0x2f31('0x15')](function(_0x270c6e){if(_0x270c6e>0x0){_0x29d2b8+=_0x5e73a7;}_0x4ba6f6[_0x2f31('0x19')](dbH['sequelize'][_0x2f31('0x2b')](util['format'](_0x2f31('0x2c'),QUERY,_0x5e73a7,_0x29d2b8),{'type':dbH[_0x2f31('0x2d')]['QueryTypes'][_0x2f31('0x2e')]}));});if(_0xe2f3a9>0x0){_0x29d2b8+=_0x5e73a7;_0x4ba6f6[_0x2f31('0x19')](dbH[_0x2f31('0x2d')][_0x2f31('0x2b')](util[_0x2f31('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xe2f3a9,_0x29d2b8),{'type':dbH[_0x2f31('0x2d')][_0x2f31('0x2f')][_0x2f31('0x2e')]}));}}}else{_0x4ba6f6['push'](dbH[_0x2f31('0x2d')][_0x2f31('0x2b')](QUERY,{'type':dbH[_0x2f31('0x2d')][_0x2f31('0x2f')][_0x2f31('0x2e')]}));}var _0x4fb63d=path['dirname'](PATH);var _0x28d0fa=path[_0x2f31('0x30')](PATH,_0x2f31('0x31'));var _0x85ea7d=_0x48b9d6['split']&&_0x4ba6f6[_0x2f31('0xf')]>0x1;var _0x42d1d4=[];if(!fs[_0x2f31('0x32')](path[_0x2f31('0x33')](_0x4fb63d,_0x28d0fa))&&_0x85ea7d){fs['mkdirSync'](path[_0x2f31('0x33')](_0x4fb63d,_0x28d0fa));}return BPromise['each'](_0x4ba6f6,function(_0x37d6e0){_0x42d1d4[_0x2f31('0x19')](_0x37d6e0);})['then'](function(){var _0x3462f9=[];for(var _0x41bb0f=0x0;_0x41bb0f<_0x42d1d4[_0x2f31('0xf')];_0x41bb0f+=0x1){var _0x27516f=_0x42d1d4[_0x41bb0f];var _0x5e9da8=createTables(_['flatten'](_0x27516f));var _0x576ddd;var _0x20f901=getPDFDocDefinition(_0x5e9da8);var _0x14d863=getPDFPrinter();var _0x4ffc96=_0x14d863[_0x2f31('0x34')](_0x20f901);if(_0x85ea7d){_0x576ddd=path[_0x2f31('0x33')](_0x4fb63d,_0x28d0fa,util[_0x2f31('0x17')](_0x2f31('0x35'),_0x28d0fa,_0x41bb0f,'pdf'));}else{_0x576ddd=path[_0x2f31('0x33')](_0x4fb63d,util[_0x2f31('0x17')]('%s.%s',_0x28d0fa,_0x2f31('0x36')));}_0x3462f9['push'](writePDFDocument(_0x4ffc96,_0x576ddd));}return Promise[_0x2f31('0x37')](_0x3462f9);})[_0x2f31('0x26')](function(){if(_0x85ea7d){return new Promise(function(_0x247359){zipdir(path[_0x2f31('0x33')](_0x4fb63d,_0x28d0fa),{'saveTo':path[_0x2f31('0x33')](_0x4fb63d,util[_0x2f31('0x17')]('%s.%s',_0x28d0fa,_0x2f31('0x38')))},function(){rimraf(path[_0x2f31('0x33')](_0x4fb63d,_0x28d0fa),function(){});_0x247359('zip\x20finished');});});}})[_0x2f31('0x26')](function(){if(!_0x85ea7d)return;rimraf(path[_0x2f31('0x33')](_0x4fb63d,_0x28d0fa),function(){});})[_0x2f31('0x26')](function(){logger['info'](util[_0x2f31('0x17')](_0x2f31('0x39'),EXTRACTED_REPORT_ID,_0x2f31('0x3a')));return analyticExtractedReport('Completed',_0x85ea7d?util[_0x2f31('0x17')]('%s.%s',_0x28d0fa,_0x85ea7d?'zip':_0x2f31('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x2f31('0x17')](_0x2f31('0x3b'),EXTRACTED_REPORT_ID,_0x2f31('0x3a')));return db[_0x2f31('0x3c')][_0x2f31('0x3d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2f31('0x26')](function(_0x57f148){EXTRACTED_REPORT=_0x57f148;return dbH[_0x2f31('0x2d')][_0x2f31('0x2b')](util[_0x2f31('0x17')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2f31('0x2d')][_0x2f31('0x2f')][_0x2f31('0x2e')]});})[_0x2f31('0x26')](extractReport)[_0x2f31('0x3e')](function(_0x27b7fa){logger[_0x2f31('0x3f')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2f31('0x3a')),util[_0x2f31('0x40')](_0x27b7fa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2f31('0x41'));})[_0x2f31('0x42')](function(){process[_0x2f31('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x463302=new PdfPrinter({'Arial':{'normal':__dirname+_0x2f31('0x44'),'bold':__dirname+_0x2f31('0x45'),'italics':__dirname+_0x2f31('0x46'),'bolditalics':__dirname+_0x2f31('0x47')}});return _0x463302;}function getPDFDocDefinitionFromHTML(_0x4355be,_0x1695b9){var _0x154d91=util['format'](_0x2f31('0x48'),_0x1695b9[_0x2f31('0x49')],_0x1695b9[_0x2f31('0x4a')]);var _0x499d76=moment()[_0x2f31('0x17')]('YYYY-MM-DD')[_0x2f31('0x1e')]();var _0x2931b9=htmlToPdfmake(_0x4355be,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2931b9],'defaultStyle':{'font':_0x2f31('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x2f31('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2f31('0x4b')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x37cf2b,_0x255f07){return[{'text':util[_0x2f31('0x17')](_0x2f31('0x4c'),_0x154d91,_0x37cf2b,_0x255f07,_0x499d76),'style':_0x2f31('0x4d')}];}};}function writePDFDocument(_0x2e64ad,_0x4fd80b){return new Promise(function(_0xf18362,_0x3e0a9f){var _0x148e4f=_0x2e64ad[_0x2f31('0x4e')](fs[_0x2f31('0x4f')](_0x4fd80b));_0x148e4f['on'](_0x2f31('0x50'),function(){_0xf18362('finish');});_0x148e4f['on'](_0x2f31('0x51'),function(_0x528ec5){_0x3e0a9f(_0x528ec5);});_0x2e64ad[_0x2f31('0x52')]();});}exports[_0x2f31('0x53')]=function(_0x209d1b,_0x4485c3){var _0x21f22b=getPDFPrinter();var _0xabe7e2=getPDFDocDefinitionFromHTML(_0x209d1b,_0x4485c3);var _0x137108=_0x21f22b[_0x2f31('0x34')](_0xabe7e2);return writePDFDocument(_0x137108,_0x4485c3[_0x2f31('0x0')])[_0x2f31('0x3e')](function(_0x2a12ee){throw _0x2a12ee;});}; \ No newline at end of file +var _0xc37d=['../../config/logger','argv','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','find','splitSizePdf','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','then','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','finish','end','lodash','path','moment','html-to-pdfmake','rimraf','jsdom','window','bluebird','../../mysqldb'];(function(_0x9a99f2,_0x59bc09){var _0xf11418=function(_0x3f39d5){while(--_0x3f39d5){_0x9a99f2['push'](_0x9a99f2['shift']());}};_0xf11418(++_0x59bc09);}(_0xc37d,0xa7));var _0xdc37=function(_0x2a9deb,_0x57bc62){_0x2a9deb=_0x2a9deb-0x0;var _0x2785a7=_0xc37d[_0x2a9deb];return _0x2785a7;};'use strict';var _=require(_0xdc37('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xdc37('0x1'));var moment=require(_0xdc37('0x2'));var htmlToPdfmake=require(_0xdc37('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xdc37('0x4'));var JSDOM=require(_0xdc37('0x5'))['JSDOM'];var window=new JSDOM('')[_0xdc37('0x6')];var BPromise=require(_0xdc37('0x7'));var db=require(_0xdc37('0x8'))['db'];var dbH=require(_0xdc37('0x8'))['dbH'];var logger=require(_0xdc37('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdc37('0xa')][0x2]);var QUERY=process[_0xdc37('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xdc37('0xa')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x327108,_0x5158c3){var _0x21cc87={'status':_0x327108};var _0x10b71b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5158c3){_0x21cc87[_0xdc37('0xb')]=_0x5158c3;}return db[_0xdc37('0xc')][_0xdc37('0xd')](_0x21cc87,_0x10b71b);}function getHeaders(_0x5afed3){return _[_0xdc37('0xe')](_0x5afed3,function(_0x1517bf){return{'text':_0x1517bf,'style':'tableHeader'};});}function getRows(_0x4b7eeb,_0x49456d){return _[_0xdc37('0xe')](_0x49456d,function(_0x35432c){return _(_0x35432c)[_0xdc37('0xf')](_0x4b7eeb)[_0xdc37('0xe')](function(_0xc623e5){return _0xc623e5?_[_0xdc37('0x10')](_0xc623e5):'';})[_0xdc37('0x11')]();});}function createTable(_0x5cb3b7,_0x31ca49){var _0x53a3bb={'widths':_[_0xdc37('0x12')](Array(_0x5cb3b7[_0xdc37('0x13')]),0x91),'heights':function(_0x59678a){return _0x59678a===0x0?_0xdc37('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x35cc31=getHeaders(_0x5cb3b7);_0x53a3bb[_0xdc37('0x15')][_0xdc37('0x16')](_0x35cc31);var _0x2df513=getRows(_0x5cb3b7,_0x31ca49);_0x53a3bb[_0xdc37('0x15')]=_0x53a3bb[_0xdc37('0x15')][_0xdc37('0x17')](_0x2df513);return _0x53a3bb;}function createTables(_0x50ea4c){var _0x48bc70=[];var _0x138322=_[_0xdc37('0x18')](Object[_0xdc37('0x19')](_0x50ea4c[0x0]),0x5);_0x138322[_0xdc37('0x1a')](function(_0x5a41bd){_0x48bc70[_0xdc37('0x16')](createTable(_0x5a41bd,_0x50ea4c));});return _0x48bc70;}function getPDFDocDefinition(_0x51e594){var _0xc1f40c=util['format'](_0xdc37('0x1b'),NAME,EXTRACTED_REPORT[_0xdc37('0x1c')],moment(EXTRACTED_REPORT[_0xdc37('0x1d')])[_0xdc37('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xdc37('0x1f')])[_0xdc37('0x1e')](FORMAT));var _0x2a65a4=[];for(var _0xcaddce=0x0;_0xcaddce<_0x51e594[_0xdc37('0x13')];_0xcaddce++){var _0x46a103=[];if(_0xcaddce===0x0){_0x46a103[_0xdc37('0x16')]({'text':_0xc1f40c,'style':_0xdc37('0x20')});}var _0x4faaaf={'table':_0x51e594[_0xcaddce]};if(_0xcaddce>0x0){_0x4faaaf[_0xdc37('0x21')]=_0xdc37('0x22');_0x4faaaf[_0xdc37('0x23')]=[0x0,0x46,0x0,0x0];}_0x46a103[_0xdc37('0x16')](_0x4faaaf);_0x2a65a4['push'](_0x46a103);}return{'pageSize':'A4','pageOrientation':_0xdc37('0x24'),'content':_0x2a65a4,'footer':function(_0x1dbfb7,_0x332ba0){return{'text':_0x1dbfb7[_0xdc37('0x10')]()+_0xdc37('0x25')+_0x332ba0,'style':_0xdc37('0x26')};},'defaultStyle':{'font':_0xdc37('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xdc37('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4c2b0d){var _0x282b95=0x1388;var _0x518b55;if(!_0x4c2b0d[0x0][_0xdc37('0x29')]){return analyticExtractedReport(_0xdc37('0x2a'));}return db['Setting'][_0xdc37('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x57d6e9){if(_0x57d6e9){_0x518b55=_0x57d6e9;_0x282b95=_0x518b55[_0xdc37('0x2c')]||0x3e8;}})['then'](function(){var _0x5255f2=[];var _0x526bc3=0x0;if(_0x518b55[_0xdc37('0x2d')]){if(_0x4c2b0d&&_0x4c2b0d[_0xdc37('0x13')]){var _0x4ffcb3=_[_0xdc37('0x2e')](_0x4c2b0d[0x0]['num']/_0x282b95);var _0x31dfa5=Number[_0xdc37('0x2f')](_0x4c2b0d[0x0][_0xdc37('0x29')]/_0x282b95)?_0x4c2b0d[0x0][_0xdc37('0x29')]%_0x282b95:0x0;_0x4ffcb3[_0xdc37('0x1a')](function(_0x501a5b){if(_0x501a5b>0x0){_0x526bc3+=_0x282b95;}_0x5255f2[_0xdc37('0x16')](dbH[_0xdc37('0x30')][_0xdc37('0x31')](util['format'](_0xdc37('0x32'),QUERY,_0x282b95,_0x526bc3),{'type':dbH[_0xdc37('0x30')][_0xdc37('0x33')][_0xdc37('0x34')]}));});if(_0x31dfa5>0x0){_0x526bc3+=_0x282b95;_0x5255f2[_0xdc37('0x16')](dbH['sequelize'][_0xdc37('0x31')](util[_0xdc37('0x1e')](_0xdc37('0x32'),QUERY,_0x31dfa5,_0x526bc3),{'type':dbH[_0xdc37('0x30')][_0xdc37('0x33')][_0xdc37('0x34')]}));}}}else{_0x5255f2[_0xdc37('0x16')](dbH[_0xdc37('0x30')][_0xdc37('0x31')](QUERY,{'type':dbH[_0xdc37('0x30')][_0xdc37('0x33')][_0xdc37('0x34')]}));}var _0x11ec43=path[_0xdc37('0x35')](PATH);var _0x332b05=path[_0xdc37('0x36')](PATH,_0xdc37('0x37'));var _0x5a4e1b=_0x518b55['split']&&_0x5255f2[_0xdc37('0x13')]>0x1;var _0xb63260=[];if(!fs[_0xdc37('0x38')](path['join'](_0x11ec43,_0x332b05))&&_0x5a4e1b){fs['mkdirSync'](path[_0xdc37('0x39')](_0x11ec43,_0x332b05));}return BPromise[_0xdc37('0x3a')](_0x5255f2,function(_0x591b33){_0xb63260['push'](_0x591b33);})[_0xdc37('0x3b')](function(){var _0x2fbd5d=[];for(var _0x7a5f57=0x0;_0x7a5f57<_0xb63260[_0xdc37('0x13')];_0x7a5f57+=0x1){var _0x290ac5=_0xb63260[_0x7a5f57];var _0x350aa6=createTables(_[_0xdc37('0x3c')](_0x290ac5));var _0xb4ed8c;var _0x1ddfe6=getPDFDocDefinition(_0x350aa6);var _0x2181e4=getPDFPrinter();var _0x389625=_0x2181e4[_0xdc37('0x3d')](_0x1ddfe6);if(_0x5a4e1b){_0xb4ed8c=path[_0xdc37('0x39')](_0x11ec43,_0x332b05,util['format'](_0xdc37('0x3e'),_0x332b05,_0x7a5f57,_0xdc37('0x3f')));}else{_0xb4ed8c=path[_0xdc37('0x39')](_0x11ec43,util[_0xdc37('0x1e')](_0xdc37('0x40'),_0x332b05,'pdf'));}_0x2fbd5d[_0xdc37('0x16')](writePDFDocument(_0x389625,_0xb4ed8c));}return Promise[_0xdc37('0x41')](_0x2fbd5d);})[_0xdc37('0x3b')](function(){if(_0x5a4e1b){return new Promise(function(_0x2a9b51){zipdir(path[_0xdc37('0x39')](_0x11ec43,_0x332b05),{'saveTo':path[_0xdc37('0x39')](_0x11ec43,util['format'](_0xdc37('0x40'),_0x332b05,'zip'))},function(){rimraf(path['join'](_0x11ec43,_0x332b05),function(){});_0x2a9b51('zip\x20finished');});});}})['then'](function(){if(!_0x5a4e1b)return;rimraf(path['join'](_0x11ec43,_0x332b05),function(){});})[_0xdc37('0x3b')](function(){logger[_0xdc37('0x42')](util['format'](_0xdc37('0x43'),EXTRACTED_REPORT_ID,_0xdc37('0x44')));return analyticExtractedReport(_0xdc37('0x45'),_0x5a4e1b?util[_0xdc37('0x1e')]('%s.%s',_0x332b05,_0x5a4e1b?_0xdc37('0x46'):_0xdc37('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xdc37('0x42')](util[_0xdc37('0x1e')](_0xdc37('0x47'),EXTRACTED_REPORT_ID,_0xdc37('0x44')));return db[_0xdc37('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xdc37('0x3b')](function(_0x570fba){EXTRACTED_REPORT=_0x570fba;return dbH[_0xdc37('0x30')][_0xdc37('0x31')](util[_0xdc37('0x1e')](_0xdc37('0x48'),QUERY),{'type':dbH['sequelize'][_0xdc37('0x33')][_0xdc37('0x34')]});})[_0xdc37('0x3b')](extractReport)['catch'](function(_0x2bea39){logger[_0xdc37('0x42')](util[_0xdc37('0x1e')](_0xdc37('0x49'),EXTRACTED_REPORT_ID,_0xdc37('0x44')),util[_0xdc37('0x4a')](_0x2bea39,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdc37('0x4b'));})[_0xdc37('0x4c')](function(){process[_0xdc37('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1f9677=new PdfPrinter({'Arial':{'normal':__dirname+_0xdc37('0x4e'),'bold':__dirname+_0xdc37('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xdc37('0x50')}});return _0x1f9677;}function getPDFDocDefinitionFromHTML(_0x2c8dd2,_0x1f863d){var _0x543439=util['format'](_0xdc37('0x51'),_0x1f863d['channel'],_0x1f863d[_0xdc37('0x52')]);var _0x4870e6=moment()['format'](_0xdc37('0x53'))['toString']();var _0xab35cd=htmlToPdfmake(_0x2c8dd2,{'window':window,'tableAutoSize':!![]});return{'content':[_0xab35cd],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xdc37('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xdc37('0x55'),'style':_0xdc37('0x20')}];},'footer':function(_0x5605f7,_0x211730){return[{'text':util[_0xdc37('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x543439,_0x5605f7,_0x211730,_0x4870e6),'style':_0xdc37('0x26')}];}};}function writePDFDocument(_0x5664d0,_0x5977f3){return new Promise(function(_0x2fa3ad,_0x4488c9){var _0xa18fbb=_0x5664d0['pipe'](fs['createWriteStream'](_0x5977f3));_0xa18fbb['on'](_0xdc37('0x56'),function(){_0x2fa3ad(_0xdc37('0x56'));});_0xa18fbb['on']('error',function(_0x2c5f67){_0x4488c9(_0x2c5f67);});_0x5664d0[_0xdc37('0x57')]();});}exports['createPdfFromHTML']=function(_0xb5c27a,_0x4c2b13){var _0x1fcfd1=getPDFPrinter();var _0x36b5a8=getPDFDocDefinitionFromHTML(_0xb5c27a,_0x4c2b13);var _0x59678f=_0x1fcfd1[_0xdc37('0x3d')](_0x36b5a8);return writePDFDocument(_0x59678f,_0x4c2b13[_0xdc37('0x1')])['catch'](function(_0x338c4a){throw _0x338c4a;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index a172833..0b5e517 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 _0x7455=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','range'];(function(_0x50fb7d,_0x5ba785){var _0x2b772e=function(_0x33d8f8){while(--_0x33d8f8){_0x50fb7d['push'](_0x50fb7d['shift']());}};_0x2b772e(++_0x5ba785);}(_0x7455,0x17d));var _0x5745=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7455[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var path=require(_0x5745('0x0'));var _=require(_0x5745('0x1'));var fs=require('fs');var json2xls=require(_0x5745('0x2'));var BPromise=require(_0x5745('0x3'));var zipdir=require(_0x5745('0x4'));var rimraf=require(_0x5745('0x5'));var db=require(_0x5745('0x6'))['db'];var dbH=require(_0x5745('0x6'))['dbH'];var logger=require(_0x5745('0x7'))(_0x5745('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5745('0x9')][0x2]);var QUERY=process[_0x5745('0x9')][0x3];var PATH=process[_0x5745('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52e9f0,_0x3935f0){var _0x59d8a5={'status':_0x52e9f0};var _0x558c27={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3935f0){_0x59d8a5[_0x5745('0xa')]=_0x3935f0;}return db[_0x5745('0xb')][_0x5745('0xc')](_0x59d8a5,_0x558c27);}function main(){var _0x143b54=0x1388;var _0x5bbdb2;logger[_0x5745('0xd')](util[_0x5745('0xe')](_0x5745('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5745('0x10'),_0x5745('0x11')]})['then'](function(_0x3cfb58){if(_0x3cfb58){_0x5bbdb2=_0x3cfb58;_0x143b54=_0x5bbdb2[_0x5745('0x11')]||0x1388;}})[_0x5745('0x12')](function(){return dbH['sequelize'][_0x5745('0x13')](util[_0x5745('0xe')](_0x5745('0x14'),QUERY),{'type':dbH[_0x5745('0x15')][_0x5745('0x16')][_0x5745('0x17')]});})[_0x5745('0x12')](function(_0x5403be){if(!_0x5403be[0x0][_0x5745('0x18')]){return analyticExtractedReport(_0x5745('0x19'));}var _0x30a6da=[];var _0x4430d0=0x0;if(_0x5bbdb2['split']){if(_0x5403be&&_0x5403be['length']){var _0x569d8b=_[_0x5745('0x1a')](_0x5403be[0x0]['num']/_0x143b54);var _0x2dac32=Number['isInteger'](_0x5403be[0x0][_0x5745('0x18')]/_0x143b54)?_0x5403be[0x0][_0x5745('0x18')]%_0x143b54:0x0;_0x569d8b[_0x5745('0x1b')](function(_0x3cf622){if(_0x3cf622>0x0){_0x4430d0+=_0x143b54;}_0x30a6da[_0x5745('0x1c')](dbH[_0x5745('0x15')]['query'](util[_0x5745('0xe')](_0x5745('0x1d'),QUERY,_0x143b54,_0x4430d0),{'type':dbH['sequelize'][_0x5745('0x16')][_0x5745('0x17')]}));});if(_0x2dac32>0x0){_0x4430d0+=_0x143b54;_0x30a6da['push'](dbH[_0x5745('0x15')][_0x5745('0x13')](util['format'](_0x5745('0x1d'),QUERY,_0x2dac32,_0x4430d0),{'type':dbH['sequelize'][_0x5745('0x16')]['SELECT']}));}}}else{_0x30a6da[_0x5745('0x1c')](dbH[_0x5745('0x15')][_0x5745('0x13')](QUERY,{'type':dbH[_0x5745('0x15')][_0x5745('0x16')][_0x5745('0x17')]}));}var _0x3c527f=path[_0x5745('0x1e')](PATH);var _0x4c4ea5=path[_0x5745('0x1f')](PATH,_0x5745('0x20'));var _0x972e56=_0x5bbdb2[_0x5745('0x10')]&&_0x30a6da[_0x5745('0x21')]>0x1;var _0x497380=[];if(!fs['existsSync'](path[_0x5745('0x22')](_0x3c527f,_0x4c4ea5))&&_0x972e56){fs['mkdirSync'](path[_0x5745('0x22')](_0x3c527f,_0x4c4ea5));}return BPromise[_0x5745('0x23')](_0x30a6da,function(_0x4f54f7){_0x497380[_0x5745('0x1c')](_0x4f54f7);})[_0x5745('0x12')](function(){for(var _0x6e45fb=0x0;_0x6e45fb<_0x497380[_0x5745('0x21')];_0x6e45fb+=0x1){var _0x321b66;var _0x181d73=_0x497380[_0x6e45fb];if(_0x972e56){_0x321b66=path['join'](_0x3c527f,_0x4c4ea5,util['format'](_0x5745('0x24'),_0x4c4ea5,_0x6e45fb,_0x5745('0x25')));}else{_0x321b66=path[_0x5745('0x22')](_0x3c527f,util[_0x5745('0xe')](_0x5745('0x26'),_0x4c4ea5,'xlsx'));}fs[_0x5745('0x27')](_0x321b66,json2xls(_0x181d73),_0x5745('0x28'));}})[_0x5745('0x12')](function(){if(_0x972e56){return new Promise(function(_0x33e6b7){zipdir(path[_0x5745('0x22')](_0x3c527f,_0x4c4ea5),{'saveTo':path[_0x5745('0x22')](_0x3c527f,util['format']('%s.%s',_0x4c4ea5,_0x5745('0x29')))},function(_0x2cd38b,_0x5182dd){rimraf(path['join'](_0x3c527f,_0x4c4ea5),function(){});_0x33e6b7(_0x5745('0x2a'));});});}})[_0x5745('0x12')](function(){logger['info'](util[_0x5745('0xe')](_0x5745('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x5745('0x2c'),_0x972e56?util['format'](_0x5745('0x26'),_0x4c4ea5,_0x972e56?_0x5745('0x29'):_0x5745('0x25')):null);});})[_0x5745('0x2d')](function(_0x3c5ca6){logger[_0x5745('0xd')](util[_0x5745('0xe')](_0x5745('0x2e'),EXTRACTED_REPORT_ID,_0x5745('0x2f')),util[_0x5745('0x30')](_0x3c5ca6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5745('0x31'));})['finally'](function(){process[_0x5745('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x59c5=['splitSizeXlsx','then','sequelize','query','QueryTypes','Empty','length','range','isInteger','num','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx','existsSync','join','mkdirSync','each','%s.%s','xlsx','writeFileSync','binary','zip','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','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','XLSX','Setting','split'];(function(_0x3b6a8c,_0x2ac191){var _0x5c73e6=function(_0x3bead7){while(--_0x3bead7){_0x3b6a8c['push'](_0x3b6a8c['shift']());}};_0x5c73e6(++_0x2ac191);}(_0x59c5,0x132));var _0x559c=function(_0x3f7584,_0x4cae5e){_0x3f7584=_0x3f7584-0x0;var _0x481039=_0x59c5[_0x3f7584];return _0x481039;};'use strict';var util=require(_0x559c('0x0'));var path=require(_0x559c('0x1'));var _=require(_0x559c('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x559c('0x3'));var zipdir=require(_0x559c('0x4'));var rimraf=require(_0x559c('0x5'));var db=require(_0x559c('0x6'))['db'];var dbH=require(_0x559c('0x6'))['dbH'];var logger=require(_0x559c('0x7'))(_0x559c('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x559c('0x9')][0x2]);var QUERY=process[_0x559c('0x9')][0x3];var PATH=process[_0x559c('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x203ce3,_0x3f0636){var _0x35f300={'status':_0x203ce3};var _0x26ba1f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f0636){_0x35f300[_0x559c('0xa')]=_0x3f0636;}return db['AnalyticExtractedReport'][_0x559c('0xb')](_0x35f300,_0x26ba1f);}function main(){var _0x4bd462=0x1388;var _0x6bae6d;logger[_0x559c('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x559c('0xd')));return db[_0x559c('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x559c('0xf'),_0x559c('0x10')]})['then'](function(_0x417e54){if(_0x417e54){_0x6bae6d=_0x417e54;_0x4bd462=_0x6bae6d[_0x559c('0x10')]||0x1388;}})[_0x559c('0x11')](function(){return dbH[_0x559c('0x12')][_0x559c('0x13')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x559c('0x12')][_0x559c('0x14')]['SELECT']});})[_0x559c('0x11')](function(_0x8562a8){if(!_0x8562a8[0x0]['num']){return analyticExtractedReport(_0x559c('0x15'));}var _0x1bfd4c=[];var _0x1f20c4=0x0;if(_0x6bae6d[_0x559c('0xf')]){if(_0x8562a8&&_0x8562a8[_0x559c('0x16')]){var _0x52cd9b=_[_0x559c('0x17')](_0x8562a8[0x0]['num']/_0x4bd462);var _0x102a13=Number[_0x559c('0x18')](_0x8562a8[0x0][_0x559c('0x19')]/_0x4bd462)?_0x8562a8[0x0]['num']%_0x4bd462:0x0;_0x52cd9b['forEach'](function(_0x16efda){if(_0x16efda>0x0){_0x1f20c4+=_0x4bd462;}_0x1bfd4c[_0x559c('0x1a')](dbH['sequelize'][_0x559c('0x13')](util[_0x559c('0x1b')](_0x559c('0x1c'),QUERY,_0x4bd462,_0x1f20c4),{'type':dbH['sequelize'][_0x559c('0x14')][_0x559c('0x1d')]}));});if(_0x102a13>0x0){_0x1f20c4+=_0x4bd462;_0x1bfd4c[_0x559c('0x1a')](dbH[_0x559c('0x12')][_0x559c('0x13')](util['format'](_0x559c('0x1c'),QUERY,_0x102a13,_0x1f20c4),{'type':dbH['sequelize'][_0x559c('0x14')][_0x559c('0x1d')]}));}}}else{_0x1bfd4c[_0x559c('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x559c('0x12')]['QueryTypes']['SELECT']}));}var _0x51e8b9=path['dirname'](PATH);var _0x32a5b1=path[_0x559c('0x1e')](PATH,_0x559c('0x1f'));var _0x14ae0f=_0x6bae6d[_0x559c('0xf')]&&_0x1bfd4c['length']>0x1;var _0x5baa3f=[];if(!fs[_0x559c('0x20')](path[_0x559c('0x21')](_0x51e8b9,_0x32a5b1))&&_0x14ae0f){fs[_0x559c('0x22')](path[_0x559c('0x21')](_0x51e8b9,_0x32a5b1));}return BPromise[_0x559c('0x23')](_0x1bfd4c,function(_0x74b1ea){_0x5baa3f[_0x559c('0x1a')](_0x74b1ea);})[_0x559c('0x11')](function(){for(var _0xff096=0x0;_0xff096<_0x5baa3f['length'];_0xff096+=0x1){var _0x4a12c4;var _0x515f00=_0x5baa3f[_0xff096];if(_0x14ae0f){_0x4a12c4=path[_0x559c('0x21')](_0x51e8b9,_0x32a5b1,util['format']('%s%d.%s',_0x32a5b1,_0xff096,'xlsx'));}else{_0x4a12c4=path[_0x559c('0x21')](_0x51e8b9,util[_0x559c('0x1b')](_0x559c('0x24'),_0x32a5b1,_0x559c('0x25')));}fs[_0x559c('0x26')](_0x4a12c4,json2xls(_0x515f00),_0x559c('0x27'));}})[_0x559c('0x11')](function(){if(_0x14ae0f){return new Promise(function(_0xa9c300){zipdir(path[_0x559c('0x21')](_0x51e8b9,_0x32a5b1),{'saveTo':path[_0x559c('0x21')](_0x51e8b9,util['format']('%s.%s',_0x32a5b1,_0x559c('0x28')))},function(_0x201340,_0x6b7573){rimraf(path[_0x559c('0x21')](_0x51e8b9,_0x32a5b1),function(){});_0xa9c300('zip\x20finished');});});}})[_0x559c('0x11')](function(){logger[_0x559c('0xc')](util[_0x559c('0x1b')](_0x559c('0x29'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x559c('0x2a'),_0x14ae0f?util['format']('%s.%s',_0x32a5b1,_0x14ae0f?'zip':_0x559c('0x25')):null);});})[_0x559c('0x2b')](function(_0xefcfcd){logger[_0x559c('0xc')](util[_0x559c('0x1b')](_0x559c('0x2c'),EXTRACTED_REPORT_ID,_0x559c('0xd')),util[_0x559c('0x2d')](_0xefcfcd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 06823db..aa3f7a1 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 _0x76a1=['extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','type','Set','format','context','VoiceExtensionId','inbound','push','outbound'];(function(_0x4449c3,_0x2330aa){var _0x22128b=function(_0x547890){while(--_0x547890){_0x4449c3['push'](_0x4449c3['shift']());}};_0x22128b(++_0x2330aa);}(_0x76a1,0xaf));var _0x176a=function(_0x322ae7,_0x2d575e){_0x322ae7=_0x322ae7-0x0;var _0x185480=_0x76a1[_0x322ae7];return _0x185480;};'use strict';var _=require(_0x176a('0x0'));var util=require(_0x176a('0x1'));function rewrite(_0x5280c8,_0x836829){var _0x249a58=this;return _0x5280c8[_0x176a('0x2')]['Interval'][_0x176a('0x3')]({'raw':!![]})[_0x176a('0x4')](function(_0x314a0f){_0x249a58[_0x176a('0x5')]=_0x314a0f;return _0x5280c8[_0x176a('0x2')]['VoiceExtension'][_0x176a('0x3')]({'where':{'IntervalId':_0x836829[_0x176a('0x6')]},'raw':!![]});})[_0x176a('0x4')](function(_0x379f57){return _0x5280c8['models'][_0x176a('0x7')][_0x176a('0x3')]({'where':{'exten':{'$in':_[_0x176a('0x8')](_[_0x176a('0x9')](_0x379f57,_0x176a('0xa')))}},'order':[{'raw':_0x176a('0xb')}],'raw':!![]});})[_0x176a('0x4')](function(_0x56dde0){var _0x7c742a=_[_0x176a('0xc')](_0x56dde0,{'priority':'1'});var _0x59d7c2=_['filter'](_0x56dde0,{'isApp':0x1});var _0x3929f1=_['groupBy'](_0x59d7c2,_0x176a('0xa'));var _0x2b7a6c=[_0x176a('0xd'),_0x176a('0xe')];var _0x4eca0e=[];var _0xdc8270=[];for(var _0x419f27 in _0x3929f1){if(_0x3929f1[_0x176a('0xf')](_0x419f27)){_0x249a58[_0x176a('0x10')]=0x2;_0x249a58[_0x176a('0x11')]=[];_0x249a58['extension']=_['find'](_0x7c742a,{'exten':_0x3929f1[_0x419f27][0x0]['exten']});_0x249a58[_0x176a('0x11')]['push']({'type':_0x3929f1[_0x419f27][0x0][_0x176a('0x12')],'app':_0x176a('0x13'),'appdata':util[_0x176a('0x14')]('CDR(type)=%s',_0x3929f1[_0x419f27][0x0][_0x176a('0x12')]),'context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});if(_0x3929f1[_0x419f27][0x0][_0x176a('0x12')]===_0x176a('0x17')){_0x249a58['extensions'][_0x176a('0x18')]({'type':_0x3929f1[_0x419f27][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x3929f1[_0x419f27][0x0][_0x176a('0x16')],'context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});}else if(_0x3929f1[_0x419f27][0x0][_0x176a('0x12')]===_0x176a('0x19')){if(_0x249a58[_0x176a('0x1a')]){_0x249a58['extensions'][_0x176a('0x18')]({'type':_0x3929f1[_0x419f27][0x0][_0x176a('0x12')],'app':_0x176a('0x13'),'appdata':_0x176a('0x1b')+(_0x249a58[_0x176a('0x1a')][_0x176a('0x1c')]?_0x176a('0x1d')+_0x249a58[_0x176a('0x1a')]['cutdigits']+'}':_0x176a('0x1e')),'context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0]['exten'],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0]['VoiceExtensionId']});}_0x249a58['extensions']['push']({'type':_0x3929f1[_0x419f27][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x3929f1[_0x419f27][0x0][_0x176a('0x16')],'context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0]['exten'],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0]['VoiceExtensionId']});var _0x4b3f76=_0x249a58[_0x176a('0x10')]++;_0x249a58[_0x176a('0x11')][_0x176a('0x18')]({'type':_0x3929f1[_0x419f27][0x0][_0x176a('0x12')],'app':_0x176a('0x1f'),'appdata':_0x176a('0x20')+(_0x4b3f76+0x2)+_0x176a('0x21')+(_0x4b3f76+0x1)+')','context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0]['exten'],'priority':_0x4b3f76,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});if(_0x249a58[_0x176a('0x1a')]){_0x249a58[_0x176a('0x11')][_0x176a('0x18')]({'type':_0x3929f1[_0x419f27][0x0][_0x176a('0x12')],'app':_0x176a('0x13'),'appdata':_0x249a58[_0x176a('0x1a')][_0x176a('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x249a58[_0x176a('0x1a')][_0x176a('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});}_0x249a58[_0x176a('0x11')]['push']({'type':_0x3929f1[_0x419f27][0x0]['type'],'app':_0x176a('0x13'),'appdata':_0x176a('0x22')+_0x3929f1[_0x419f27][0x0][_0x176a('0x16')],'context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58['priority']++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});if(_0x249a58[_0x176a('0x1a')]&&_0x249a58[_0x176a('0x1a')][_0x176a('0xf')]('recordingFormat')&&_0x249a58[_0x176a('0x1a')][_0x176a('0x23')]!==_0x176a('0x24')){_0x249a58[_0x176a('0x11')]['push']({'type':_0x3929f1[_0x419f27][0x0]['type'],'app':_0x176a('0x13'),'appdata':_0x176a('0x25'),'context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58['priority']++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});_0x249a58['extensions'][_0x176a('0x18')]({'type':_0x3929f1[_0x419f27][0x0]['type'],'app':'Set','appdata':_0x176a('0x26')+_0x249a58[_0x176a('0x1a')][_0x176a('0x23')]||'wav','context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});}}_0x249a58[_0x176a('0x11')]['push']({'type':_0x3929f1[_0x419f27][0x0]['type'],'app':_0x176a('0x13'),'appdata':_0x176a('0x27'),'context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0]['VoiceExtensionId']});_0x249a58[_0x176a('0x11')][_0x176a('0x18')]({'type':_0x3929f1[_0x419f27][0x0][_0x176a('0x12')],'app':'Set','appdata':_0x176a('0x28'),'context':_0x3929f1[_0x419f27][0x0]['context'],'exten':_0x3929f1[_0x419f27][0x0][_0x176a('0xa')],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0]['VoiceExtensionId']});_0x249a58[_0x176a('0x11')]['push']({'type':_0x3929f1[_0x419f27][0x0][_0x176a('0x12')],'app':_0x176a('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3929f1[_0x419f27][0x0][_0x176a('0x15')],'exten':_0x3929f1[_0x419f27][0x0]['exten'],'priority':_0x249a58[_0x176a('0x10')]++,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});for(var _0x1a07d8=0x0,_0x2901c7=0x0;_0x1a07d8<_0x3929f1[_0x419f27][_0x176a('0x29')];_0x1a07d8+=0x1,_0x2901c7=0x0){var _0x198b92=_0x3929f1[_0x419f27][_0x1a07d8];if(_0x198b92['type']){_0x198b92[_0x176a('0x12')]=_0x198b92['type'][_0x176a('0x2a')]();}var _0xe51cc=[];var _0xf658bf=[];delete _0x198b92['id'];delete _0x198b92[_0x176a('0x2b')];delete _0x198b92[_0x176a('0x2c')];var _0x2bc4b8=_0x198b92[_0x176a('0x2d')]!==_0x176a('0x2e')?[_0x198b92[_0x176a('0x2d')]]:_0x198b92[_0x176a('0x6')]?_[_0x176a('0x9')](_[_0x176a('0xc')](_0x249a58[_0x176a('0x5')],{'IntervalId':_0x198b92[_0x176a('0x6')]}),_0x176a('0x2d')):[];if(_0x198b92[_0x176a('0xf')](_0x176a('0x2f'))){if(_0x198b92[_0x176a('0x2f')]&&_0x198b92[_0x176a('0x2f')]!=='--'){_0xe51cc[_0x176a('0x18')]({'type':_0x198b92[_0x176a('0x12')],'app':_0x176a('0x13'),'appdata':_0x176a('0x30')+_0x198b92[_0x176a('0x2f')],'context':_0x198b92[_0x176a('0x15')],'exten':_0x198b92[_0x176a('0xa')],'priority':_0x2bc4b8['length']+_0x249a58[_0x176a('0x10')]+_0x2901c7++,'VoiceExtensionId':_0x198b92[_0x176a('0x16')]});}}if(_0x198b92['type']===_0x176a('0x19')&&_0x198b92[_0x176a('0xf')](_0x176a('0x31'))){if(_0x198b92[_0x176a('0x31')]){_0xe51cc['push']({'type':_0x198b92['type'],'app':_0x176a('0x1f'),'appdata':_0x176a('0x32')+_0x198b92[_0x176a('0x31')]+')','context':_0x198b92[_0x176a('0x15')],'exten':_0x198b92[_0x176a('0xa')],'priority':_0x2bc4b8[_0x176a('0x29')]+_0x249a58[_0x176a('0x10')]+_0x2901c7++,'VoiceExtensionId':_0x198b92[_0x176a('0x16')]});}else{_0xe51cc['push']({'type':_0x198b92[_0x176a('0x12')],'app':_0x176a('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x198b92[_0x176a('0x15')],'exten':_0x198b92[_0x176a('0xa')],'priority':_0x2bc4b8[_0x176a('0x29')]+_0x249a58[_0x176a('0x10')]+_0x2901c7++,'VoiceExtensionId':_0x198b92[_0x176a('0x16')]});}}if(_0x198b92[_0x176a('0xf')]('answer')){if(_0x2b7a6c[_0x176a('0x33')](_0x198b92['app'][_0x176a('0x2a')]())>=0x0&&_0x198b92[_0x176a('0x34')]!=='custom'){if(_0x198b92['answer']){_0xe51cc['push']({'type':_0x198b92['type'],'app':_0x176a('0x1f'),'appdata':_0x176a('0x35'),'context':_0x198b92['context'],'exten':_0x198b92[_0x176a('0xa')],'priority':_0x2bc4b8[_0x176a('0x29')]+_0x249a58['priority']+_0x2901c7++,'VoiceExtensionId':_0x198b92[_0x176a('0x16')]});_0xe51cc[_0x176a('0x18')]({'type':_0x198b92[_0x176a('0x12')],'app':'Set','appdata':_0x176a('0x36'),'context':_0x198b92[_0x176a('0x15')],'exten':_0x198b92[_0x176a('0xa')],'priority':_0x2bc4b8[_0x176a('0x29')]+_0x249a58[_0x176a('0x10')]+_0x2901c7++,'VoiceExtensionId':_0x198b92['VoiceExtensionId']});}else{_0xe51cc[_0x176a('0x18')]({'type':_0x198b92['type'],'app':_0x176a('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x198b92['context'],'exten':_0x198b92[_0x176a('0xa')],'priority':_0x2bc4b8[_0x176a('0x29')]+_0x249a58[_0x176a('0x10')]+_0x2901c7++,'VoiceExtensionId':_0x198b92[_0x176a('0x16')]});_0xe51cc[_0x176a('0x18')]({'type':_0x198b92[_0x176a('0x12')],'app':_0x176a('0x13'),'appdata':_0x176a('0x37'),'context':_0x198b92[_0x176a('0x15')],'exten':_0x198b92[_0x176a('0xa')],'priority':_0x2bc4b8[_0x176a('0x29')]+_0x249a58[_0x176a('0x10')]+_0x2901c7++,'VoiceExtensionId':_0x198b92['VoiceExtensionId']});}}}for(var _0x48b4cd=0x0;_0x48b4cd<_0x2bc4b8[_0x176a('0x29')];_0x48b4cd+=0x1){var _0x454d22=_0x249a58[_0x176a('0x10')]+_0x2bc4b8[_0x176a('0x29')];var _0x3a8c4e=_0x48b4cd===_0x2bc4b8[_0x176a('0x29')]-0x1?_0x249a58[_0x176a('0x10')]+_0xe51cc[_0x176a('0x29')]+_0xf658bf['length']+0x2:_0x249a58['priority']+_0x48b4cd+0x1;_0xe51cc[_0x176a('0x38')](_0x48b4cd,0x0,{'type':_0x198b92[_0x176a('0x12')],'app':_0x176a('0x39'),'appdata':_0x2bc4b8[_0x48b4cd]+'?'+_0x198b92[_0x176a('0x15')]+',${EXTEN},'+_0x454d22+':'+_0x198b92['context']+',${EXTEN},'+_0x3a8c4e,'exten':_0x198b92['exten'],'context':_0x198b92[_0x176a('0x15')],'priority':_0x249a58[_0x176a('0x10')]+_0x48b4cd,'VoiceExtensionId':_0x3929f1[_0x419f27][0x0]['VoiceExtensionId']});}_0x198b92[_0x176a('0x10')]=_0xe51cc['length']?_['last'](_0xe51cc)[_0x176a('0x10')]+0x1:_0x249a58[_0x176a('0x10')];_0x249a58['priority']=(_0xf658bf[_0x176a('0x29')]?_[_0x176a('0x3a')](_0xf658bf)['priority']:_0x198b92[_0x176a('0x10')])+0x1;_0x249a58[_0x176a('0x11')]=_[_0x176a('0x3b')](_0x249a58[_0x176a('0x11')],_0xe51cc,[_0x198b92],_0xf658bf);}_0x249a58[_0x176a('0x11')][_0x176a('0x18')]({'type':_0x3929f1[_0x419f27][0x0]['type'],'app':_0x176a('0x3c'),'exten':_0x3929f1[_0x419f27][0x0]['exten'],'context':_0x3929f1[_0x419f27][0x0]['context'],'priority':_0x249a58[_0x176a('0x10')],'VoiceExtensionId':_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]});_0x4eca0e[_0x176a('0x18')](_0x3929f1[_0x419f27][0x0][_0x176a('0x16')]);_0xdc8270=_['concat'](_0xdc8270,_0x249a58[_0x176a('0x11')]);}}return _0x5280c8[_0x176a('0x3d')](function(_0x430dbe){return _0x5280c8['models'][_0x176a('0x7')][_0x176a('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x4eca0e}},'transaction':_0x430dbe})[_0x176a('0x4')](function(_0x130c44){return _0x5280c8[_0x176a('0x2')][_0x176a('0x7')][_0x176a('0x3f')](_[_0x176a('0x40')](_0xdc8270,'priority'),{'transaction':_0x430dbe});});});})['catch'](function(_0x28f8c2){console[_0x176a('0x41')](_0x28f8c2);});}exports[_0x176a('0x42')]=rewrite; \ No newline at end of file +var _0x6fd7=['XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','toLowerCase','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','filter','groupBy','exten','playback','hasOwnProperty','priority','extensions','extension','find','push','type','CDR(type)=%s','VoiceExtensionId','Set','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0'];(function(_0x284622,_0x1e419f){var _0x4d48d6=function(_0x1809d0){while(--_0x1809d0){_0x284622['push'](_0x284622['shift']());}};_0x4d48d6(++_0x1e419f);}(_0x6fd7,0x1d0));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76fd('0x0'));var util=require('util');function rewrite(_0xeb624d,_0x36a166){var _0x567717=this;return _0xeb624d[_0x76fd('0x1')]['Interval'][_0x76fd('0x2')]({'raw':!![]})[_0x76fd('0x3')](function(_0x26c37d){_0x567717[_0x76fd('0x4')]=_0x26c37d;return _0xeb624d[_0x76fd('0x1')][_0x76fd('0x5')][_0x76fd('0x2')]({'where':{'IntervalId':_0x36a166[_0x76fd('0x6')]},'raw':!![]});})[_0x76fd('0x3')](function(_0x536ce4){return _0xeb624d[_0x76fd('0x1')]['VoiceExtension'][_0x76fd('0x2')]({'where':{'exten':{'$in':_[_0x76fd('0x7')](_[_0x76fd('0x8')](_0x536ce4,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x448a8c){var _0x209304=_[_0x76fd('0x9')](_0x448a8c,{'priority':'1'});var _0x51aab0=_[_0x76fd('0x9')](_0x448a8c,{'isApp':0x1});var _0x3d4ad8=_[_0x76fd('0xa')](_0x51aab0,_0x76fd('0xb'));var _0xc5ee38=['queue',_0x76fd('0xc')];var _0x267a94=[];var _0x339e98=[];for(var _0x2f68d1 in _0x3d4ad8){if(_0x3d4ad8[_0x76fd('0xd')](_0x2f68d1)){_0x567717[_0x76fd('0xe')]=0x2;_0x567717[_0x76fd('0xf')]=[];_0x567717[_0x76fd('0x10')]=_[_0x76fd('0x11')](_0x209304,{'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')]});_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':'Set','appdata':util['format'](_0x76fd('0x14'),_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')]),'context':_0x3d4ad8[_0x2f68d1][0x0]['context'],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});if(_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')]==='inbound'){_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':_0x76fd('0x16'),'appdata':_0x76fd('0x17')+_0x3d4ad8[_0x2f68d1][0x0]['VoiceExtensionId'],'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});}else if(_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')]===_0x76fd('0x19')){if(_0x567717['extension']){_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0]['type'],'app':'Set','appdata':_0x76fd('0x1a')+(_0x567717['extension'][_0x76fd('0x1b')]?_0x76fd('0x1c')+_0x567717[_0x76fd('0x10')][_0x76fd('0x1b')]+'}':'${EXTEN}'),'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0]['VoiceExtensionId']});}_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':_0x76fd('0x16'),'appdata':'CDR(routeid)='+_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')],'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});var _0x33bc58=_0x567717[_0x76fd('0xe')]++;_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0]['type'],'app':_0x76fd('0x1d'),'appdata':_0x76fd('0x1e')+(_0x33bc58+0x2)+_0x76fd('0x1f')+(_0x33bc58+0x1)+')','context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x33bc58,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0]['VoiceExtensionId']});if(_0x567717[_0x76fd('0x10')]){_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0]['type'],'app':_0x76fd('0x16'),'appdata':_0x567717[_0x76fd('0x10')][_0x76fd('0x1b')]?_0x76fd('0x20')+_0x567717[_0x76fd('0x10')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3d4ad8[_0x2f68d1][0x0]['context'],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});}_0x567717[_0x76fd('0xf')]['push']({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':'Set','appdata':_0x76fd('0x21')+_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')],'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});if(_0x567717['extension']&&_0x567717[_0x76fd('0x10')]['hasOwnProperty']('recordingFormat')&&_0x567717[_0x76fd('0x10')][_0x76fd('0x22')]!==_0x76fd('0x23')){_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':'Set','appdata':_0x76fd('0x24'),'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0]['exten'],'priority':_0x567717['priority']++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':'Set','appdata':_0x76fd('0x25')+_0x567717['extension'][_0x76fd('0x22')]||_0x76fd('0x26'),'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});}}_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':_0x76fd('0x16'),'appdata':_0x76fd('0x27'),'context':_0x3d4ad8[_0x2f68d1][0x0]['context'],'exten':_0x3d4ad8[_0x2f68d1][0x0]['exten'],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0]['VoiceExtensionId']});_0x567717['extensions'][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':_0x76fd('0x16'),'appdata':_0x76fd('0x28'),'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0]['exten'],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});_0x567717[_0x76fd('0xf')][_0x76fd('0x12')]({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':_0x76fd('0x16'),'appdata':_0x76fd('0x29'),'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'exten':_0x3d4ad8[_0x2f68d1][0x0]['exten'],'priority':_0x567717[_0x76fd('0xe')]++,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});for(var _0xa375e1=0x0,_0x4cc2b0=0x0;_0xa375e1<_0x3d4ad8[_0x2f68d1][_0x76fd('0x2a')];_0xa375e1+=0x1,_0x4cc2b0=0x0){var _0x297128=_0x3d4ad8[_0x2f68d1][_0xa375e1];if(_0x297128[_0x76fd('0x13')]){_0x297128[_0x76fd('0x13')]=_0x297128[_0x76fd('0x13')]['toLowerCase']();}var _0x163e55=[];var _0x145b4a=[];delete _0x297128['id'];delete _0x297128[_0x76fd('0x2b')];delete _0x297128['updatedAt'];var _0x316387=_0x297128['interval']!==_0x76fd('0x2c')?[_0x297128[_0x76fd('0x2d')]]:_0x297128[_0x76fd('0x6')]?_[_0x76fd('0x8')](_[_0x76fd('0x9')](_0x567717[_0x76fd('0x4')],{'IntervalId':_0x297128[_0x76fd('0x6')]}),_0x76fd('0x2d')):[];if(_0x297128['hasOwnProperty']('tag')){if(_0x297128[_0x76fd('0x2e')]&&_0x297128[_0x76fd('0x2e')]!=='--'){_0x163e55[_0x76fd('0x12')]({'type':_0x297128[_0x76fd('0x13')],'app':_0x76fd('0x16'),'appdata':_0x76fd('0x2f')+_0x297128[_0x76fd('0x2e')],'context':_0x297128['context'],'exten':_0x297128['exten'],'priority':_0x316387[_0x76fd('0x2a')]+_0x567717[_0x76fd('0xe')]+_0x4cc2b0++,'VoiceExtensionId':_0x297128[_0x76fd('0x15')]});}}if(_0x297128[_0x76fd('0x13')]===_0x76fd('0x19')&&_0x297128[_0x76fd('0xd')](_0x76fd('0x30'))){if(_0x297128['callerID']){_0x163e55[_0x76fd('0x12')]({'type':_0x297128['type'],'app':_0x76fd('0x1d'),'appdata':_0x76fd('0x31')+_0x297128[_0x76fd('0x30')]+')','context':_0x297128['context'],'exten':_0x297128[_0x76fd('0xb')],'priority':_0x316387[_0x76fd('0x2a')]+_0x567717['priority']+_0x4cc2b0++,'VoiceExtensionId':_0x297128[_0x76fd('0x15')]});}else{_0x163e55['push']({'type':_0x297128[_0x76fd('0x13')],'app':_0x76fd('0x1d'),'appdata':_0x76fd('0x32'),'context':_0x297128[_0x76fd('0x18')],'exten':_0x297128[_0x76fd('0xb')],'priority':_0x316387[_0x76fd('0x2a')]+_0x567717[_0x76fd('0xe')]+_0x4cc2b0++,'VoiceExtensionId':_0x297128['VoiceExtensionId']});}}if(_0x297128['hasOwnProperty']('answer')){if(_0xc5ee38[_0x76fd('0x33')](_0x297128[_0x76fd('0x34')][_0x76fd('0x35')]())>=0x0&&_0x297128[_0x76fd('0x36')]!==_0x76fd('0x37')){if(_0x297128[_0x76fd('0x38')]){_0x163e55['push']({'type':_0x297128[_0x76fd('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x297128[_0x76fd('0x18')],'exten':_0x297128[_0x76fd('0xb')],'priority':_0x316387[_0x76fd('0x2a')]+_0x567717[_0x76fd('0xe')]+_0x4cc2b0++,'VoiceExtensionId':_0x297128['VoiceExtensionId']});_0x163e55[_0x76fd('0x12')]({'type':_0x297128[_0x76fd('0x13')],'app':'Set','appdata':_0x76fd('0x39'),'context':_0x297128['context'],'exten':_0x297128[_0x76fd('0xb')],'priority':_0x316387[_0x76fd('0x2a')]+_0x567717[_0x76fd('0xe')]+_0x4cc2b0++,'VoiceExtensionId':_0x297128[_0x76fd('0x15')]});}else{_0x163e55['push']({'type':_0x297128['type'],'app':'ExecIf','appdata':_0x76fd('0x3a'),'context':_0x297128[_0x76fd('0x18')],'exten':_0x297128[_0x76fd('0xb')],'priority':_0x316387['length']+_0x567717['priority']+_0x4cc2b0++,'VoiceExtensionId':_0x297128[_0x76fd('0x15')]});_0x163e55[_0x76fd('0x12')]({'type':_0x297128[_0x76fd('0x13')],'app':_0x76fd('0x16'),'appdata':_0x76fd('0x3b'),'context':_0x297128[_0x76fd('0x18')],'exten':_0x297128[_0x76fd('0xb')],'priority':_0x316387[_0x76fd('0x2a')]+_0x567717[_0x76fd('0xe')]+_0x4cc2b0++,'VoiceExtensionId':_0x297128[_0x76fd('0x15')]});}}}for(var _0x40dc2b=0x0;_0x40dc2b<_0x316387[_0x76fd('0x2a')];_0x40dc2b+=0x1){var _0x3a4bdc=_0x567717[_0x76fd('0xe')]+_0x316387['length'];var _0x5294fe=_0x40dc2b===_0x316387[_0x76fd('0x2a')]-0x1?_0x567717['priority']+_0x163e55[_0x76fd('0x2a')]+_0x145b4a[_0x76fd('0x2a')]+0x2:_0x567717[_0x76fd('0xe')]+_0x40dc2b+0x1;_0x163e55[_0x76fd('0x3c')](_0x40dc2b,0x0,{'type':_0x297128[_0x76fd('0x13')],'app':_0x76fd('0x3d'),'appdata':_0x316387[_0x40dc2b]+'?'+_0x297128[_0x76fd('0x18')]+_0x76fd('0x3e')+_0x3a4bdc+':'+_0x297128[_0x76fd('0x18')]+_0x76fd('0x3e')+_0x5294fe,'exten':_0x297128[_0x76fd('0xb')],'context':_0x297128[_0x76fd('0x18')],'priority':_0x567717[_0x76fd('0xe')]+_0x40dc2b,'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});}_0x297128[_0x76fd('0xe')]=_0x163e55['length']?_[_0x76fd('0x3f')](_0x163e55)[_0x76fd('0xe')]+0x1:_0x567717[_0x76fd('0xe')];_0x567717[_0x76fd('0xe')]=(_0x145b4a[_0x76fd('0x2a')]?_[_0x76fd('0x3f')](_0x145b4a)['priority']:_0x297128[_0x76fd('0xe')])+0x1;_0x567717[_0x76fd('0xf')]=_[_0x76fd('0x40')](_0x567717[_0x76fd('0xf')],_0x163e55,[_0x297128],_0x145b4a);}_0x567717[_0x76fd('0xf')]['push']({'type':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x13')],'app':_0x76fd('0x41'),'exten':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0xb')],'context':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x18')],'priority':_0x567717[_0x76fd('0xe')],'VoiceExtensionId':_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]});_0x267a94[_0x76fd('0x12')](_0x3d4ad8[_0x2f68d1][0x0][_0x76fd('0x15')]);_0x339e98=_[_0x76fd('0x40')](_0x339e98,_0x567717[_0x76fd('0xf')]);}}return _0xeb624d[_0x76fd('0x42')](function(_0x348950){return _0xeb624d[_0x76fd('0x1')][_0x76fd('0x5')][_0x76fd('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x267a94}},'transaction':_0x348950})[_0x76fd('0x3')](function(_0x42ad96){return _0xeb624d[_0x76fd('0x1')][_0x76fd('0x5')][_0x76fd('0x44')](_['sortBy'](_0x339e98,'priority'),{'transaction':_0x348950});});});})[_0x76fd('0x45')](function(_0x2d409d){console[_0x76fd('0x46')](_0x2d409d);});}exports[_0x76fd('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1449443..9f079d0 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 _0x5126=['ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','cm_hopper','cm_contacts','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','CmList','Lists','then','dialCheckDuplicateType','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','outbound','get','Campaign','CampaignId','BlackLists','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','split','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','duplicate','CmContact','keys','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','fromQuery','ContactId','createdAt','updatedAt','select','field','scheduledAt','toString','NOW()','from','where','deletedAt\x20IS\x20NULL'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0x5126,0x177));var _0x6512=function(_0xff69d1,_0x33b6f7){_0xff69d1=_0xff69d1-0x0;var _0x3e547c=_0x5126[_0xff69d1];return _0x3e547c;};'use strict';var BPromise=require(_0x6512('0x0'));var util=require(_0x6512('0x1'));var _=require(_0x6512('0x2'));var fs=require('fs');var squel=require(_0x6512('0x3'));var Papa=require(_0x6512('0x4'));var Redis=require(_0x6512('0x5'));var db=require(_0x6512('0x6'))['db'];var config=require(_0x6512('0x7'));var logger=require(_0x6512('0x8'))(_0x6512('0x9'));config[_0x6512('0xa')]=_[_0x6512('0xb')](config[_0x6512('0xa')],{'host':_0x6512('0xc'),'port':0x18eb});var socket=require(_0x6512('0xd'))(new Redis(config['redis']));require(_0x6512('0xe'))[_0x6512('0xf')](socket);try{if(!process[_0x6512('0x10')][0x2]||process['argv'][0x2]===_0x6512('0x11')||process[_0x6512('0x10')][0x2]===_0x6512('0x12')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x6512('0x10')][0x3]||process[_0x6512('0x10')][0x3]===_0x6512('0x11')||process[_0x6512('0x10')][0x3]===_0x6512('0x12')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process[_0x6512('0x10')][0x4]===_0x6512('0x12')){throw new Error(_0x6512('0x13'));}var FIELDS=_[_0x6512('0x14')](process[_0x6512('0x10')][0x3]['split'](','),process[_0x6512('0x10')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x6512('0x11')||process[_0x6512('0x10')][0x5]===_0x6512('0x12')){throw new Error(_0x6512('0x15'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x6512('0x10')][0x6]&&process[_0x6512('0x10')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x6512('0x12')?process[_0x6512('0x10')][0x6]:null;var DUPLICATES=process[_0x6512('0x10')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x6512('0x10')][0x7]!=='null'?process[_0x6512('0x10')][0x7]:null;if(!process[_0x6512('0x10')][0x8]||process[_0x6512('0x10')][0x8]===_0x6512('0x11')||process[_0x6512('0x10')][0x8]===_0x6512('0x12')){throw new Error(_0x6512('0x16'));}var SOCKET_TIMESTAMP=process[_0x6512('0x10')][0x8];}catch(_0x520979){logger[_0x6512('0x17')](_0x520979);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(_0x429223,_0x391146,_0xe9165,_0x163ea5){var _0x37b140={'message':_0x391146};_0x37b140[_0x429223]=!![];if(_0xe9165){_0x37b140['contact']=_0xe9165;}if(_0x163ea5){_0x37b140[_0x6512('0x18')]=_0x163ea5;}return _0x37b140;}function isEmail(_0x5e8444){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))*$/[_0x6512('0x19')](_0x5e8444);}function checkRow(_0x19fd71,_0x6a0452,_0x19db5e){return new BPromise(function(_0x48c6ed,_0x5307dd){if(_[_0x6512('0x1a')](_0x19fd71)){return _0x5307dd(handleCheckRowError(_0x6512('0x17'),_0x6512('0x1b'),null,_0x19db5e));}if(_0x19fd71['errors']&&_0x19fd71[_0x6512('0x1c')]['length']){var _0x54eed0=_['map'](_0x19fd71[_0x6512('0x1c')],_0x6512('0x1d'))['join'](';');return _0x5307dd(handleCheckRowError('error',_0x54eed0,null,_0x19db5e));}var _0x4e095c={};for(var _0x4a7dbd in FIELDS){if(FIELDS[_0x6512('0x1e')](_0x4a7dbd)&&FIELDS[_0x4a7dbd]){_0x4e095c[_0x4a7dbd]=_0x19fd71['data'][0x0][FIELDS[_0x4a7dbd]]||_0x19fd71[_0x6512('0x1f')][0x0]['\ufeff'+FIELDS[_0x4a7dbd]];}}if(!_0x4e095c[_0x6512('0x20')]){return _0x5307dd(handleCheckRowError(_0x6512('0x17'),_0x6512('0x21'),null,_0x19db5e));}if(!_0x4e095c[_0x6512('0x22')]){return _0x5307dd(handleCheckRowError(_0x6512('0x17'),'phone\x20not\x20specified!',null,_0x19db5e));}if(_0x4e095c[_0x6512('0x23')]){var _0x4a7c3d=moment(_0x4e095c[_0x6512('0x23')],_0x6512('0x24'));if(!_0x4a7c3d[_0x6512('0x25')]()){return _0x5307dd(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x19db5e));}}if(_0x4e095c['email']){if(!isEmail(_0x4e095c[_0x6512('0x26')])){return _0x5307dd(handleCheckRowError(_0x6512('0x17'),_0x6512('0x27'),null,_0x19db5e));}}_0x4e095c[_0x6512('0x28')]=LISTID;_0x4e095c[_0x6512('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6512('0x2a')]&&_0x6a0452){var _0x381d4f={};for(var _0x118a18=0x0,_0x2b9097=DUPLICATES[_0x6512('0x2a')];_0x118a18<_0x2b9097;_0x118a18+=0x1){_0x381d4f[DUPLICATES[_0x118a18]]=_0x4e095c[DUPLICATES[_0x118a18]];}var _0x112873=_['find'](_0x6a0452,_0x381d4f);if(_0x112873){return _0x5307dd(handleCheckRowError(_0x6512('0x2b'),'Duplicate\x20Contact',_0x112873,_0x19db5e));}}return db[_0x6512('0x2c')]['create'](_0x4e095c,{'raw':!![],'hooks':![],'fields':_[_0x6512('0x2d')](_0x4e095c)})['then'](function(_0x2d4956){if(DUPLICATES&&DUPLICATES[_0x6512('0x2a')]&&_0x6a0452){_0x6a0452['push'](_[_0x6512('0x2e')](_0x4e095c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2d4956['id'];return _0x48c6ed();})[_0x6512('0x2f')](function(_0x4ffbd4){return _0x5307dd(handleCheckRowError(_0x6512('0x17'),_0x6512('0x30')+(_0x4ffbd4['message']||JSON[_0x6512('0x31')](_0x4ffbd4)),null,_0x19db5e));});});}function checkHopper(){function _0x1fda09(){return function(_0x4a8dab){logger['error']('cmContact',_0x6512('0x32'),util[_0x6512('0x33')](_0x4a8dab,{'showHidden':![],'depth':null}));};}var _0x2eee23=function(_0xfc7d34,_0xdfff0d){var _0x43b5af=squel['insert']()[_0x6512('0x34')]('cm_hopper')[_0x6512('0x35')]([_0x6512('0x22'),'scheduledAt',_0x6512('0x36'),'ListId',_0xdfff0d,_0x6512('0x37'),_0x6512('0x38')],squel[_0x6512('0x39')]()['field'](_0x6512('0x22'),_0x6512('0x22'))[_0x6512('0x3a')]('NOW()',_0x6512('0x3b'))[_0x6512('0x3a')]('id',_0x6512('0x36'))['field'](LISTID[_0x6512('0x3c')](),'ListId')[_0x6512('0x3a')](_0xfc7d34['id'][_0x6512('0x3c')](),_0xdfff0d)[_0x6512('0x3a')]('NOW()',_0x6512('0x37'))['field'](_0x6512('0x3d'),_0x6512('0x38'))[_0x6512('0x3e')]('cm_contacts')[_0x6512('0x3f')](_0x6512('0x40'))['where'](_0x6512('0x41'),LISTID[_0x6512('0x3c')]())[_0x6512('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x6512('0x3f')](_0x6512('0x42'),squel[_0x6512('0x39')]()[_0x6512('0x3a')]('phone')['from']('cm_hopper')[_0x6512('0x3f')](_0xdfff0d+_0x6512('0x43'),_0xfc7d34['id'][_0x6512('0x3c')]())))[_0x6512('0x3c')]();return _0x43b5af;};var _0x248bfc=function(_0x1cad51,_0x43973b){var _0x51c938=squel[_0x6512('0x44')]()[_0x6512('0x34')](_0x6512('0x45'))[_0x6512('0x35')](['phone',_0x6512('0x3b'),_0x6512('0x36'),'ListId',_0x43973b,_0x6512('0x37'),_0x6512('0x38')],squel[_0x6512('0x39')]()['field'](_0x6512('0x22'),'phone')[_0x6512('0x3a')](_0x6512('0x3d'),_0x6512('0x3b'))[_0x6512('0x3a')]('id',_0x6512('0x36'))['field'](LISTID[_0x6512('0x3c')](),'ListId')[_0x6512('0x3a')](_0x1cad51['id'][_0x6512('0x3c')](),_0x43973b)[_0x6512('0x3a')](_0x6512('0x3d'),_0x6512('0x37'))[_0x6512('0x3a')](_0x6512('0x3d'),_0x6512('0x38'))[_0x6512('0x3e')](_0x6512('0x46'))[_0x6512('0x3f')](_0x6512('0x40'))['where'](_0x6512('0x41'),LISTID[_0x6512('0x3c')]())[_0x6512('0x3f')]('id\x20IN\x20?',squel[_0x6512('0x47')](hopperContacts))[_0x6512('0x3f')](_0x6512('0x48'))['where'](_0x6512('0x42'),squel[_0x6512('0x39')]()[_0x6512('0x3a')]('calleridnum')[_0x6512('0x3e')](_0x6512('0x49'))[_0x6512('0x3f')](_0x43973b+_0x6512('0x43'),_0x1cad51['id'][_0x6512('0x3c')]()))[_0x6512('0x3f')](_0x6512('0x42'),squel[_0x6512('0x39')]()[_0x6512('0x3a')]('phone')['from'](_0x6512('0x45'))[_0x6512('0x3f')](_0x43973b+'\x20=\x20?',_0x1cad51['id'][_0x6512('0x3c')]())))['toString']();return _0x51c938;};function _0x2366af(_0x1e5ee2,_0x3b6f8e){var _0x2b7703=squel[_0x6512('0x44')]()[_0x6512('0x34')](_0x6512('0x45'))[_0x6512('0x35')]([_0x6512('0x22'),_0x6512('0x3b'),_0x6512('0x36'),'ListId',_0x3b6f8e,_0x6512('0x37'),'updatedAt'],squel[_0x6512('0x39')]()[_0x6512('0x3a')](_0x6512('0x22'),_0x6512('0x22'))[_0x6512('0x3a')](_0x6512('0x3d'),_0x6512('0x3b'))[_0x6512('0x3a')]('id',_0x6512('0x36'))[_0x6512('0x3a')](LISTID['toString'](),_0x6512('0x28'))[_0x6512('0x3a')](_0x1e5ee2['id']['toString'](),_0x3b6f8e)[_0x6512('0x3a')](_0x6512('0x3d'),_0x6512('0x37'))[_0x6512('0x3a')](_0x6512('0x3d'),_0x6512('0x38'))[_0x6512('0x3e')]('cm_contacts')[_0x6512('0x3f')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x6512('0x3c')]())[_0x6512('0x3f')](_0x6512('0x4a'),squel[_0x6512('0x47')](hopperContacts))[_0x6512('0x3f')](_0x6512('0x48')))[_0x6512('0x3c')]();return _0x2b7703;}function _0x524b3d(_0x410a48,_0x32a4ba){var _0x4a061e=squel[_0x6512('0x44')]()['into'](_0x6512('0x4b'))[_0x6512('0x35')]([_0x6512('0x22'),_0x6512('0x36'),_0x6512('0x28'),_0x32a4ba,_0x6512('0x37'),_0x6512('0x38')],squel[_0x6512('0x39')]()[_0x6512('0x3a')](_0x6512('0x22'),'phone')[_0x6512('0x3a')]('id',_0x6512('0x36'))[_0x6512('0x3a')](LISTID[_0x6512('0x3c')](),'ListId')[_0x6512('0x3a')](_0x410a48['id'][_0x6512('0x3c')](),_0x32a4ba)[_0x6512('0x3a')](_0x6512('0x3d'),_0x6512('0x37'))[_0x6512('0x3a')]('NOW()',_0x6512('0x38'))['from'](_0x6512('0x46'))[_0x6512('0x3f')](_0x6512('0x40'))[_0x6512('0x3f')](_0x6512('0x41'),LISTID['toString']())[_0x6512('0x3f')](_0x6512('0x4a'),squel['str'](hopperContacts))['where'](_0x6512('0x48')))[_0x6512('0x3c')]();return _0x4a061e;}return db[_0x6512('0x4c')][_0x6512('0x4d')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6512('0x4e')],'as':_0x6512('0x4f'),'where':{'id':LISTID}}]})[_0x6512('0x50')](function(_0x4de87e){var _0x34f82f=[];if(_0x4de87e){var _0x40eebc;for(var _0x4d5e32=0x0,_0x16b330;_0x4d5e32<_0x4de87e[_0x6512('0x2a')];_0x4d5e32+=0x1){_0x16b330=_0x4de87e[_0x4d5e32]['get']({'plain':!![]});switch(_0x16b330[_0x6512('0x51')]){case _0x6512('0x52'):_0x34f82f[_0x6512('0x53')](db[_0x6512('0x54')][_0x6512('0x55')](_0x248bfc(_0x16b330,_0x6512('0x56')))['then'](function(){})[_0x6512('0x2f')](_0x1fda09()));break;case _0x6512('0x57'):_0x34f82f['push'](db[_0x6512('0x54')][_0x6512('0x55')](_0x2eee23(_0x16b330,_0x6512('0x56')))['then'](function(){})[_0x6512('0x2f')](_0x1fda09()));break;default:_0x34f82f[_0x6512('0x53')](db[_0x6512('0x54')]['query'](_0x2366af(_0x16b330,_0x6512('0x56')))[_0x6512('0x50')](function(){})[_0x6512('0x2f')](_0x1fda09()));}}}return _0x34f82f;})[_0x6512('0x58')]()[_0x6512('0x50')](function(){return db[_0x6512('0x4c')][_0x6512('0x4d')]({'where':{'type':_0x6512('0x59')},'attributes':['id'],'include':[{'model':db[_0x6512('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x30104a){var _0x357c61=[];if(_0x30104a){var _0x2c7f10;for(var _0x2c3e5f=0x0,_0x576d59;_0x2c3e5f<_0x30104a[_0x6512('0x2a')];_0x2c3e5f+=0x1){_0x576d59=_0x30104a[_0x2c3e5f][_0x6512('0x5a')]({'plain':!![]});_0x357c61[_0x6512('0x53')](db['sequelize']['query'](_0x524b3d(_0x576d59,_0x6512('0x56')))[_0x6512('0x50')](function(){})['catch'](_0x1fda09()));}}return _0x357c61;})[_0x6512('0x58')]();})[_0x6512('0x50')](function(){return db[_0x6512('0x5b')][_0x6512('0x4d')]({'attributes':['id',_0x6512('0x51')],'include':[{'model':db[_0x6512('0x4e')],'as':_0x6512('0x4f'),'where':{'id':LISTID}}]})[_0x6512('0x50')](function(_0x383b45){var _0x558632=[];if(_0x383b45){for(var _0x562ad7=0x0,_0x5f1cdb;_0x562ad7<_0x383b45[_0x6512('0x2a')];_0x562ad7+=0x1){_0x5f1cdb=_0x383b45[_0x562ad7]['get']({'plain':!![]});switch(_0x5f1cdb[_0x6512('0x51')]){case _0x6512('0x52'):_0x558632[_0x6512('0x53')](db[_0x6512('0x54')][_0x6512('0x55')](_0x248bfc(_0x5f1cdb,'CampaignId'))[_0x6512('0x50')](function(){})[_0x6512('0x2f')](_0x1fda09()));break;case _0x6512('0x57'):_0x558632['push'](db[_0x6512('0x54')][_0x6512('0x55')](_0x2eee23(_0x5f1cdb,_0x6512('0x5c')))[_0x6512('0x50')](function(){})[_0x6512('0x2f')](_0x1fda09()));break;default:_0x558632['push'](db[_0x6512('0x54')][_0x6512('0x55')](_0x2366af(_0x5f1cdb,'CampaignId'))[_0x6512('0x50')](function(){})[_0x6512('0x2f')](_0x1fda09()));}}}return _0x558632;})[_0x6512('0x58')]();})['then'](function(){return db[_0x6512('0x5b')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x6512('0x5d'),'where':{'id':LISTID}}]})[_0x6512('0x50')](function(_0x40230b){var _0x4c35c2=[];if(_0x40230b){for(var _0x242685=0x0,_0x39472e;_0x242685<_0x40230b[_0x6512('0x2a')];_0x242685+=0x1){_0x39472e=_0x40230b[_0x242685][_0x6512('0x5a')]({'plain':!![]});_0x4c35c2[_0x6512('0x53')](db[_0x6512('0x54')]['query'](_0x524b3d(_0x39472e,_0x6512('0x5c')))[_0x6512('0x50')](function(){})[_0x6512('0x2f')](_0x1fda09()));}}return _0x4c35c2;})['all']();})[_0x6512('0x2f')](function(_0x217668){logger[_0x6512('0x17')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x217668[_0x6512('0x1d')]);});}var processPromises=function(_0x2831ea){return BPromise[_0x6512('0x58')](promises)['then'](function(_0x281c97){})[_0x6512('0x2f')](function(_0xb09ed8){logger[_0x6512('0x17')](_0x6512('0x5e'),JSON['stringify'](_0xb09ed8));})[_0x6512('0x5f')](function(){socket[_0x6512('0x60')](_0x6512('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2831ea){return _0x2831ea['resume']();}});};var endCsv=function(){return BPromise[_0x6512('0x62')]()[_0x6512('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0x6512('0x50')](function(){socket[_0x6512('0x60')](_0x6512('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6512('0x63')](FILEPATH);}catch(_0x2420b1){logger['error'](_0x6512('0x64'),JSON[_0x6512('0x31')](_0x2420b1));}finally{process[_0x6512('0x65')](0x0);}});};process['on'](_0x6512('0x66'),function(){logger['info'](_0x6512('0x67'));endCsv();});function main(){return BPromise[_0x6512('0x62')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6512('0x68')](',');return db[_0x6512('0x2c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6512('0x50')](function(_0x21946b){var _0x2cfa6d=fs[_0x6512('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2cfa6d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ff495,_0x3b9431){total+=0x1;var _0x3c1c92=total;promises[_0x6512('0x53')](checkRow(_0x2ff495,_0x21946b,_0x3c1c92)[_0x6512('0x50')](function(){success+=0x1;})[_0x6512('0x2f')](function(_0x305ed4){if(_0x305ed4[_0x6512('0x17')]){errors+=0x1;delete _0x305ed4[_0x6512('0x17')];}else if(_0x305ed4['duplicate']){duplicates+=0x1;delete _0x305ed4[_0x6512('0x2b')];}rows[_0x6512('0x53')](_0x305ed4);}));if(total%0xc8===0x0){_0x3b9431[_0x6512('0x6a')]();return processPromises(_0x3b9431);}},'complete':function(){return processPromises()['then'](function(){logger[_0x6512('0x6b')](_0x6512('0x6c'));endCsv();});},'error':function(_0x14a96d,_0x12580e){logger[_0x6512('0x6b')](_0x6512('0x6d'),JSON[_0x6512('0x31')](_0x14a96d));endCsv();}});})[_0x6512('0x2f')](function(_0x55ac1c){logger[_0x6512('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x6512('0x31')](_0x55ac1c));});}main(); \ No newline at end of file +var _0xea08=['then','onlyIfOpen','sequelize','VoiceQueueId','all','BlackLists','get','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','test','isNil','error','errors','message','join','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','select','field','ContactId','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','toString','updatedAt','from','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','dialCheckDuplicateType','always','query'];(function(_0x4f3d00,_0x188abc){var _0x484889=function(_0x13eb9c){while(--_0x13eb9c){_0x4f3d00['push'](_0x4f3d00['shift']());}};_0x484889(++_0x188abc);}(_0xea08,0x8a));var _0x8ea0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xea08[_0x40a045];return _0x1a687c;};'use strict';var BPromise=require(_0x8ea0('0x0'));var util=require(_0x8ea0('0x1'));var _=require(_0x8ea0('0x2'));var fs=require('fs');var squel=require(_0x8ea0('0x3'));var Papa=require('papaparse');var Redis=require(_0x8ea0('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x8ea0('0x5'));var logger=require(_0x8ea0('0x6'))(_0x8ea0('0x7'));config[_0x8ea0('0x8')]=_[_0x8ea0('0x9')](config[_0x8ea0('0x8')],{'host':_0x8ea0('0xa'),'port':0x18eb});var socket=require(_0x8ea0('0xb'))(new Redis(config['redis']));require(_0x8ea0('0xc'))[_0x8ea0('0xd')](socket);try{if(!process['argv'][0x2]||process[_0x8ea0('0xe')][0x2]===_0x8ea0('0xf')||process[_0x8ea0('0xe')][0x2]===_0x8ea0('0x10')){throw new Error(_0x8ea0('0x11'));}var FILEPATH=process[_0x8ea0('0xe')][0x2];if(!process[_0x8ea0('0xe')][0x3]||process[_0x8ea0('0xe')][0x3]===_0x8ea0('0xf')||process['argv'][0x3]===_0x8ea0('0x10')||!process[_0x8ea0('0xe')][0x4]||process[_0x8ea0('0xe')][0x4]==='undefined'||process['argv'][0x4]===_0x8ea0('0x10')){throw new Error(_0x8ea0('0x12'));}var FIELDS=_[_0x8ea0('0x13')](process[_0x8ea0('0xe')][0x3]['split'](','),process[_0x8ea0('0xe')][0x4][_0x8ea0('0x14')](','));if(!process[_0x8ea0('0xe')][0x5]||process[_0x8ea0('0xe')][0x5]==='undefined'||process[_0x8ea0('0xe')][0x5]==='null'){throw new Error(_0x8ea0('0x15'));}var LISTID=process[_0x8ea0('0xe')][0x5];var COMPANYID=process[_0x8ea0('0xe')][0x6]&&process[_0x8ea0('0xe')][0x6]!==_0x8ea0('0xf')&&process[_0x8ea0('0xe')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x8ea0('0xe')][0x7]&&process[_0x8ea0('0xe')][0x7]!=='undefined'&&process[_0x8ea0('0xe')][0x7]!==_0x8ea0('0x10')?process[_0x8ea0('0xe')][0x7]:null;if(!process[_0x8ea0('0xe')][0x8]||process['argv'][0x8]===_0x8ea0('0xf')||process['argv'][0x8]===_0x8ea0('0x10')){throw new Error(_0x8ea0('0x16'));}var SOCKET_TIMESTAMP=process[_0x8ea0('0xe')][0x8];}catch(_0x80e4d9){logger['error'](_0x80e4d9);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(_0x1584a1,_0x509372,_0x4196da,_0x201ed0){var _0x427933={'message':_0x509372};_0x427933[_0x1584a1]=!![];if(_0x4196da){_0x427933[_0x8ea0('0x17')]=_0x4196da;}if(_0x201ed0){_0x427933['index']=_0x201ed0;}return _0x427933;}function isEmail(_0x503fbe){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))*$/[_0x8ea0('0x18')](_0x503fbe);}function checkRow(_0x217b41,_0x3da36b,_0x5b2cb5){return new BPromise(function(_0x321a29,_0x5df0ca){if(_[_0x8ea0('0x19')](_0x217b41)){return _0x5df0ca(handleCheckRowError(_0x8ea0('0x1a'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x5b2cb5));}if(_0x217b41[_0x8ea0('0x1b')]&&_0x217b41['errors']['length']){var _0x4f9a53=_['map'](_0x217b41['errors'],_0x8ea0('0x1c'))[_0x8ea0('0x1d')](';');return _0x5df0ca(handleCheckRowError(_0x8ea0('0x1a'),_0x4f9a53,null,_0x5b2cb5));}var _0x40fba0={};for(var _0x22c969 in FIELDS){if(FIELDS[_0x8ea0('0x1e')](_0x22c969)&&FIELDS[_0x22c969]){_0x40fba0[_0x22c969]=_0x217b41['data'][0x0][FIELDS[_0x22c969]]||_0x217b41['data'][0x0]['\ufeff'+FIELDS[_0x22c969]];}}if(!_0x40fba0[_0x8ea0('0x1f')]){return _0x5df0ca(handleCheckRowError(_0x8ea0('0x1a'),_0x8ea0('0x20'),null,_0x5b2cb5));}if(!_0x40fba0[_0x8ea0('0x21')]){return _0x5df0ca(handleCheckRowError('error',_0x8ea0('0x22'),null,_0x5b2cb5));}if(_0x40fba0['birthDate']){var _0x5746e3=moment(_0x40fba0[_0x8ea0('0x23')],'YYYY-MM-DD');if(!_0x5746e3[_0x8ea0('0x24')]()){return _0x5df0ca(handleCheckRowError(_0x8ea0('0x1a'),_0x8ea0('0x25'),null,_0x5b2cb5));}}if(_0x40fba0['email']){if(!isEmail(_0x40fba0[_0x8ea0('0x26')])){return _0x5df0ca(handleCheckRowError(_0x8ea0('0x1a'),_0x8ea0('0x27'),null,_0x5b2cb5));}}_0x40fba0[_0x8ea0('0x28')]=LISTID;_0x40fba0['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8ea0('0x29')]&&_0x3da36b){var _0x23cf8d={};for(var _0x39882f=0x0,_0xbcceef=DUPLICATES[_0x8ea0('0x29')];_0x39882f<_0xbcceef;_0x39882f+=0x1){_0x23cf8d[DUPLICATES[_0x39882f]]=_0x40fba0[DUPLICATES[_0x39882f]];}var _0x3fab71=_[_0x8ea0('0x2a')](_0x3da36b,_0x23cf8d);if(_0x3fab71){return _0x5df0ca(handleCheckRowError(_0x8ea0('0x2b'),_0x8ea0('0x2c'),_0x3fab71,_0x5b2cb5));}}return db[_0x8ea0('0x2d')][_0x8ea0('0x2e')](_0x40fba0,{'raw':!![],'hooks':![],'fields':_[_0x8ea0('0x2f')](_0x40fba0)})['then'](function(_0x18013c){if(DUPLICATES&&DUPLICATES[_0x8ea0('0x29')]&&_0x3da36b){_0x3da36b[_0x8ea0('0x30')](_[_0x8ea0('0x31')](_0x40fba0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18013c['id'];return _0x321a29();})[_0x8ea0('0x32')](function(_0x2eb2f0){return _0x5df0ca(handleCheckRowError(_0x8ea0('0x1a'),_0x8ea0('0x33')+(_0x2eb2f0[_0x8ea0('0x1c')]||JSON[_0x8ea0('0x34')](_0x2eb2f0)),null,_0x5b2cb5));});});}function checkHopper(){function _0xf1884a(){return function(_0x1a05f2){logger[_0x8ea0('0x1a')](_0x8ea0('0x35'),_0x8ea0('0x36'),util[_0x8ea0('0x37')](_0x1a05f2,{'showHidden':![],'depth':null}));};}var _0x2294e2=function(_0x3e086b,_0x1a0416){var _0x209809=squel[_0x8ea0('0x38')]()[_0x8ea0('0x39')](_0x8ea0('0x3a'))[_0x8ea0('0x3b')]([_0x8ea0('0x21'),_0x8ea0('0x3c'),'ContactId','ListId',_0x1a0416,_0x8ea0('0x3d'),'updatedAt'],squel[_0x8ea0('0x3e')]()['field']('phone','phone')['field']('NOW()',_0x8ea0('0x3c'))[_0x8ea0('0x3f')]('id',_0x8ea0('0x40'))[_0x8ea0('0x3f')](LISTID['toString'](),_0x8ea0('0x28'))[_0x8ea0('0x3f')](_0x3e086b['id']['toString'](),_0x1a0416)[_0x8ea0('0x3f')]('NOW()',_0x8ea0('0x3d'))['field'](_0x8ea0('0x41'),'updatedAt')['from'](_0x8ea0('0x42'))[_0x8ea0('0x43')](_0x8ea0('0x44'))[_0x8ea0('0x43')](_0x8ea0('0x45'),LISTID['toString']())[_0x8ea0('0x43')](_0x8ea0('0x46'))[_0x8ea0('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8ea0('0x3e')]()[_0x8ea0('0x3f')](_0x8ea0('0x21'))['from']('cm_hopper')[_0x8ea0('0x43')](_0x1a0416+_0x8ea0('0x47'),_0x3e086b['id'][_0x8ea0('0x48')]())))[_0x8ea0('0x48')]();return _0x209809;};var _0x4303e0=function(_0x3dadfd,_0x15b94e){var _0x5d0508=squel[_0x8ea0('0x38')]()[_0x8ea0('0x39')]('cm_hopper')[_0x8ea0('0x3b')]([_0x8ea0('0x21'),_0x8ea0('0x3c'),_0x8ea0('0x40'),'ListId',_0x15b94e,'createdAt',_0x8ea0('0x49')],squel[_0x8ea0('0x3e')]()[_0x8ea0('0x3f')](_0x8ea0('0x21'),_0x8ea0('0x21'))[_0x8ea0('0x3f')](_0x8ea0('0x41'),_0x8ea0('0x3c'))[_0x8ea0('0x3f')]('id',_0x8ea0('0x40'))[_0x8ea0('0x3f')](LISTID[_0x8ea0('0x48')](),_0x8ea0('0x28'))['field'](_0x3dadfd['id']['toString'](),_0x15b94e)[_0x8ea0('0x3f')]('NOW()',_0x8ea0('0x3d'))[_0x8ea0('0x3f')](_0x8ea0('0x41'),_0x8ea0('0x49'))[_0x8ea0('0x4a')](_0x8ea0('0x42'))[_0x8ea0('0x43')](_0x8ea0('0x44'))[_0x8ea0('0x43')](_0x8ea0('0x45'),LISTID[_0x8ea0('0x48')]())[_0x8ea0('0x43')](_0x8ea0('0x4b'),squel[_0x8ea0('0x4c')](hopperContacts))[_0x8ea0('0x43')](_0x8ea0('0x46'))[_0x8ea0('0x43')](_0x8ea0('0x4d'),squel[_0x8ea0('0x3e')]()['field'](_0x8ea0('0x4e'))[_0x8ea0('0x4a')](_0x8ea0('0x4f'))[_0x8ea0('0x43')](_0x15b94e+_0x8ea0('0x47'),_0x3dadfd['id']['toString']()))[_0x8ea0('0x43')](_0x8ea0('0x4d'),squel[_0x8ea0('0x3e')]()[_0x8ea0('0x3f')]('phone')[_0x8ea0('0x4a')]('cm_hopper')[_0x8ea0('0x43')](_0x15b94e+_0x8ea0('0x47'),_0x3dadfd['id'][_0x8ea0('0x48')]())))['toString']();return _0x5d0508;};function _0x463de1(_0x49d451,_0x521ab8){var _0x3c602f=squel[_0x8ea0('0x38')]()[_0x8ea0('0x39')]('cm_hopper')[_0x8ea0('0x3b')]([_0x8ea0('0x21'),_0x8ea0('0x3c'),_0x8ea0('0x40'),_0x8ea0('0x28'),_0x521ab8,'createdAt',_0x8ea0('0x49')],squel['select']()['field']('phone',_0x8ea0('0x21'))['field'](_0x8ea0('0x41'),_0x8ea0('0x3c'))[_0x8ea0('0x3f')]('id',_0x8ea0('0x40'))[_0x8ea0('0x3f')](LISTID['toString'](),_0x8ea0('0x28'))[_0x8ea0('0x3f')](_0x49d451['id'][_0x8ea0('0x48')](),_0x521ab8)[_0x8ea0('0x3f')](_0x8ea0('0x41'),_0x8ea0('0x3d'))[_0x8ea0('0x3f')](_0x8ea0('0x41'),_0x8ea0('0x49'))[_0x8ea0('0x4a')]('cm_contacts')['where'](_0x8ea0('0x44'))['where'](_0x8ea0('0x45'),LISTID[_0x8ea0('0x48')]())[_0x8ea0('0x43')](_0x8ea0('0x4b'),squel['str'](hopperContacts))[_0x8ea0('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x8ea0('0x48')]();return _0x3c602f;}function _0x259209(_0x396eea,_0x32b336){var _0xf2db8d=squel['insert']()[_0x8ea0('0x39')](_0x8ea0('0x50'))[_0x8ea0('0x3b')]([_0x8ea0('0x21'),'ContactId','ListId',_0x32b336,_0x8ea0('0x3d'),'updatedAt'],squel[_0x8ea0('0x3e')]()[_0x8ea0('0x3f')](_0x8ea0('0x21'),'phone')[_0x8ea0('0x3f')]('id',_0x8ea0('0x40'))[_0x8ea0('0x3f')](LISTID[_0x8ea0('0x48')](),_0x8ea0('0x28'))[_0x8ea0('0x3f')](_0x396eea['id'][_0x8ea0('0x48')](),_0x32b336)[_0x8ea0('0x3f')](_0x8ea0('0x41'),_0x8ea0('0x3d'))[_0x8ea0('0x3f')](_0x8ea0('0x41'),_0x8ea0('0x49'))['from'](_0x8ea0('0x42'))[_0x8ea0('0x43')](_0x8ea0('0x44'))[_0x8ea0('0x43')]('ListId\x20=\x20?',LISTID[_0x8ea0('0x48')]())[_0x8ea0('0x43')]('id\x20IN\x20?',squel[_0x8ea0('0x4c')](hopperContacts))[_0x8ea0('0x43')](_0x8ea0('0x46')))[_0x8ea0('0x48')]();return _0xf2db8d;}return db[_0x8ea0('0x51')][_0x8ea0('0x52')]({'where':{'type':_0x8ea0('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8ea0('0x54')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x384109){var _0x2316a1=[];if(_0x384109){var _0x5bb172;for(var _0xdc1058=0x0,_0x1cfc1b;_0xdc1058<_0x384109['length'];_0xdc1058+=0x1){_0x1cfc1b=_0x384109[_0xdc1058]['get']({'plain':!![]});switch(_0x1cfc1b[_0x8ea0('0x55')]){case _0x8ea0('0x56'):_0x2316a1['push'](db['sequelize'][_0x8ea0('0x57')](_0x4303e0(_0x1cfc1b,'VoiceQueueId'))[_0x8ea0('0x58')](function(){})[_0x8ea0('0x32')](_0xf1884a()));break;case _0x8ea0('0x59'):_0x2316a1[_0x8ea0('0x30')](db[_0x8ea0('0x5a')][_0x8ea0('0x57')](_0x2294e2(_0x1cfc1b,_0x8ea0('0x5b')))['then'](function(){})['catch'](_0xf1884a()));break;default:_0x2316a1[_0x8ea0('0x30')](db['sequelize'][_0x8ea0('0x57')](_0x463de1(_0x1cfc1b,_0x8ea0('0x5b')))[_0x8ea0('0x58')](function(){})[_0x8ea0('0x32')](_0xf1884a()));}}}return _0x2316a1;})[_0x8ea0('0x5c')]()[_0x8ea0('0x58')](function(){return db[_0x8ea0('0x51')][_0x8ea0('0x52')]({'where':{'type':_0x8ea0('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8ea0('0x5d'),'where':{'id':LISTID}}]})[_0x8ea0('0x58')](function(_0x5bf779){var _0x3ab162=[];if(_0x5bf779){var _0x5cb140;for(var _0x2d56a3=0x0,_0x3bd9c4;_0x2d56a3<_0x5bf779['length'];_0x2d56a3+=0x1){_0x3bd9c4=_0x5bf779[_0x2d56a3][_0x8ea0('0x5e')]({'plain':!![]});_0x3ab162[_0x8ea0('0x30')](db[_0x8ea0('0x5a')][_0x8ea0('0x57')](_0x259209(_0x3bd9c4,_0x8ea0('0x5b')))[_0x8ea0('0x58')](function(){})[_0x8ea0('0x32')](_0xf1884a()));}}return _0x3ab162;})[_0x8ea0('0x5c')]();})[_0x8ea0('0x58')](function(){return db[_0x8ea0('0x5f')][_0x8ea0('0x52')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8ea0('0x54')],'as':_0x8ea0('0x60'),'where':{'id':LISTID}}]})['then'](function(_0x2ff982){var _0x5d1b8a=[];if(_0x2ff982){for(var _0x167459=0x0,_0x4596f9;_0x167459<_0x2ff982['length'];_0x167459+=0x1){_0x4596f9=_0x2ff982[_0x167459][_0x8ea0('0x5e')]({'plain':!![]});switch(_0x4596f9[_0x8ea0('0x55')]){case'always':_0x5d1b8a[_0x8ea0('0x30')](db[_0x8ea0('0x5a')][_0x8ea0('0x57')](_0x4303e0(_0x4596f9,'CampaignId'))[_0x8ea0('0x58')](function(){})['catch'](_0xf1884a()));break;case'onlyIfOpen':_0x5d1b8a[_0x8ea0('0x30')](db[_0x8ea0('0x5a')][_0x8ea0('0x57')](_0x2294e2(_0x4596f9,_0x8ea0('0x61')))[_0x8ea0('0x58')](function(){})[_0x8ea0('0x32')](_0xf1884a()));break;default:_0x5d1b8a['push'](db[_0x8ea0('0x5a')]['query'](_0x463de1(_0x4596f9,_0x8ea0('0x61')))[_0x8ea0('0x58')](function(){})[_0x8ea0('0x32')](_0xf1884a()));}}}return _0x5d1b8a;})[_0x8ea0('0x5c')]();})[_0x8ea0('0x58')](function(){return db[_0x8ea0('0x5f')][_0x8ea0('0x52')]({'attributes':['id'],'include':[{'model':db[_0x8ea0('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5f2f36){var _0x56e4f5=[];if(_0x5f2f36){for(var _0x56c1d1=0x0,_0x2e3fce;_0x56c1d1<_0x5f2f36[_0x8ea0('0x29')];_0x56c1d1+=0x1){_0x2e3fce=_0x5f2f36[_0x56c1d1]['get']({'plain':!![]});_0x56e4f5[_0x8ea0('0x30')](db['sequelize'][_0x8ea0('0x57')](_0x259209(_0x2e3fce,'CampaignId'))['then'](function(){})[_0x8ea0('0x32')](_0xf1884a()));}}return _0x56e4f5;})[_0x8ea0('0x5c')]();})[_0x8ea0('0x32')](function(_0x2f5d79){logger['error'](_0x8ea0('0x62'),'generalCheckHopper',_0x2f5d79[_0x8ea0('0x1c')]);});}var processPromises=function(_0xb0a56b){return BPromise[_0x8ea0('0x5c')](promises)[_0x8ea0('0x58')](function(_0x17a9b8){})[_0x8ea0('0x32')](function(_0x42ab92){logger['error'](_0x8ea0('0x63'),JSON[_0x8ea0('0x34')](_0x42ab92));})['finally'](function(){socket[_0x8ea0('0x64')](_0x8ea0('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xb0a56b){return _0xb0a56b['resume']();}});};var endCsv=function(){return BPromise[_0x8ea0('0x66')]()[_0x8ea0('0x58')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x8ea0('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8ea0('0x67')](FILEPATH);}catch(_0x1e46d6){logger[_0x8ea0('0x1a')](_0x8ea0('0x68'),JSON[_0x8ea0('0x34')](_0x1e46d6));}finally{process['exit'](0x0);}});};process['on'](_0x8ea0('0x69'),function(){logger[_0x8ea0('0x6a')](_0x8ea0('0x6b'));endCsv();});function main(){return BPromise['resolve']()[_0x8ea0('0x58')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8ea0('0x14')](',');return db[_0x8ea0('0x2d')][_0x8ea0('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8ea0('0x58')](function(_0x241d92){var _0x4a7917=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8ea0('0x6c')](_0x4a7917,{'header':!![],'skipEmptyLines':!![],'step':function(_0x110765,_0x232bcc){total+=0x1;var _0x44c214=total;promises[_0x8ea0('0x30')](checkRow(_0x110765,_0x241d92,_0x44c214)['then'](function(){success+=0x1;})['catch'](function(_0x23c3be){if(_0x23c3be[_0x8ea0('0x1a')]){errors+=0x1;delete _0x23c3be[_0x8ea0('0x1a')];}else if(_0x23c3be[_0x8ea0('0x2b')]){duplicates+=0x1;delete _0x23c3be['duplicate'];}rows['push'](_0x23c3be);}));if(total%0xc8===0x0){_0x232bcc[_0x8ea0('0x6d')]();return processPromises(_0x232bcc);}},'complete':function(){return processPromises()[_0x8ea0('0x58')](function(){logger[_0x8ea0('0x6a')](_0x8ea0('0x6e'));endCsv();});},'error':function(_0x5d0da8,_0x2b8dfb){logger[_0x8ea0('0x6a')](_0x8ea0('0x6f'),JSON['stringify'](_0x5d0da8));endCsv();}});})[_0x8ea0('0x32')](function(_0x48a512){logger[_0x8ea0('0x1a')](_0x8ea0('0x70'),JSON[_0x8ea0('0x34')](_0x48a512));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0bdc947..5eb9881 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 _0xd4eb=['concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','code','info','sequelize','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','query','spread','error','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','clone','root','.csv','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','errors','find','trim','replace','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','filter','findOne','CmContactHasItem','update','create','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.updatedAt','insert','ListId','updatedAt','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.createdAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','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?'];(function(_0xb32591,_0x24de4a){var _0x142c25=function(_0x3c3a44){while(--_0x3c3a44){_0xb32591['push'](_0xb32591['shift']());}};_0x142c25(++_0x24de4a);}(_0xd4eb,0x68));var _0xbd4e=function(_0x1d192a,_0x427376){_0x1d192a=_0x1d192a-0x0;var _0x598a8b=_0xd4eb[_0x1d192a];return _0x598a8b;};'use strict';var fs=require('fs');var path=require(_0xbd4e('0x0'));var _=require(_0xbd4e('0x1'));var Papa=require(_0xbd4e('0x2'));var util=require('util');var BPromise=require(_0xbd4e('0x3'));var moment=require(_0xbd4e('0x4'));var squel=require(_0xbd4e('0x5'));var Redis=require(_0xbd4e('0x6'));var db=require(_0xbd4e('0x7'))['db'];var config=require(_0xbd4e('0x8'));var shared=require(_0xbd4e('0x9'));var logger=require(_0xbd4e('0xa'))(_0xbd4e('0xb'));config['redis']=_[_0xbd4e('0xc')](config[_0xbd4e('0xd')],{'host':_0xbd4e('0xe'),'port':0x18eb});var socket=require(_0xbd4e('0xf'))(new Redis(config[_0xbd4e('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xbd4e('0x10')](_0xbd4e('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xbd4e('0x10')](_0xbd4e('0x11'));function isEmail(_0x4bfc19){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))*$/[_0xbd4e('0x12')](_0x4bfc19);}function selectNotIn(_0x2c348a,_0x1a2e55,_0x4853ad,_0x1f2b2a,_0x537a18){return squel[_0xbd4e('0x13')]()[_0xbd4e('0x14')](_0xbd4e('0x15'))['from'](_0x1f2b2a)[_0xbd4e('0x16')](_0x1a2e55,null,_0x1a2e55+_0xbd4e('0x17')+_0x1f2b2a+'.'+_0x4853ad)[_0xbd4e('0x18')](_0x1f2b2a+'.'+_0x4853ad+'\x20=\x20'+_0x2c348a+'.'+_0x4853ad)[_0xbd4e('0x18')](_0x1a2e55+_0xbd4e('0x19')+_0x537a18[_0xbd4e('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x18ee00,_0x5b8144){promisesAdditionalPhones=[];return db['CmContact'][_0xbd4e('0x1a')]({'raw':!![],'attributes':['id',_0xbd4e('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xbd4e('0x1c')](function(_0x484502){if(_0x484502!==null){var _0x148637=[];for(var _0x440c40=0x0;_0x440c40<_0x484502[_0xbd4e('0x1d')];_0x440c40++){var _0x51d7d8=_0x484502[_0x440c40];_0x148637[_0xbd4e('0x1e')](insertAdditionalPhones(_0x51d7d8));}}Promise[_0xbd4e('0x1f')](_0x148637)['then'](function(){_0x18ee00({'val':0x1});});});});}function insertAdditionalPhones(_0x1995d4){return new Promise(function(_0x3cfc3b,_0x4471ed){var _0x534279=_0x1995d4[_0xbd4e('0x1b')];var _0x678381=_0x534279[_0xbd4e('0x20')](';');var _0x3168b0=[];orderBy=0x0;for(var _0x431001=0x0;_0x431001<_0x678381[_0xbd4e('0x1d')];_0x431001++){_0x3168b0['push'](splitAdditionalPhone(_0x1995d4['id'],_0x678381[_0x431001]));}Promise[_0xbd4e('0x1f')](_0x3168b0)[_0xbd4e('0x1c')](function(){_0x3cfc3b({'val':_0x678381[_0xbd4e('0x1d')]});});});}function splitAdditionalPhone(_0xa51554,_0x1cb26a){return new Promise(function(_0x39b1dc,_0x347d38){var _0x20fe09=_0x1cb26a[_0xbd4e('0x20')](':');var _0x43b0f6=_0x20fe09[0x0];var _0x2aa26c=_0x20fe09[0x1];if(!_['isNil'](_0x2aa26c)){var _0x533c2f=_0x2aa26c['split']('|');var _0xbd01ee=[];for(var _0x1a0347=0x0;_0x1a0347<_0x533c2f[_0xbd4e('0x1d')];_0x1a0347++){if(_0x533c2f[_0x1a0347]!==''){var _0xc0082b=_[_0xbd4e('0x21')](promisesAdditionalPhones,{'contactId':_0xa51554,'phone':_0x533c2f[_0x1a0347]});if(_0xc0082b[_0xbd4e('0x1d')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xa51554,'contactTypeId':_0x43b0f6,'phone':_0x533c2f[_0x1a0347],'orderBy':orderBy});}}}_0x39b1dc({'ok':0x1});}else _0x39b1dc({'res':0x0});});}function createAdditionalPhone(_0x191f27,_0x156814,_0x8fc22a,_0x142bd9){var _0x334dae='';var _0x5b9450='';var _0x556f5a=_0x8fc22a[_0xbd4e('0x20')]('§');_0x334dae=_0x556f5a[0x0];if(_0x556f5a[_0xbd4e('0x1d')]==0x2)_0x5b9450=_0x556f5a[0x1];return new Promise(function(_0x3651dd,_0x5a4fcb){return db['CmContactHasItem'][_0xbd4e('0x22')]({'where':{'CmContactId':_0x191f27,'item':_0x334dae}})['then'](function(_0x3eca9b){if(_0x3eca9b){return db[_0xbd4e('0x23')][_0xbd4e('0x24')]({'ItemTypeId':_0x156814,'description':_0x5b9450,'OrderBy':_0x142bd9},{'where':{'CmContactId':_0x191f27,'item':_0x334dae}})['then'](function(_0x31b9aa){_0x3651dd({'res':'updated'});});}else{return db[_0xbd4e('0x23')][_0xbd4e('0x25')]({'CmContactId':_0x191f27,'item':_0x334dae,'description':_0x5b9450,'ItemTypeId':_0x156814,'OrderBy':_0x142bd9,'ItemClass':'PHONE'})['then'](function(_0x775a00){_0x3651dd({'res':_0xbd4e('0x26')});});}});});}function insertCmHopper(_0xf0be3f,_0x41ff1b,_0x460466,_0x5d7efe,_0x5e5a69){var _0x595396=['cm_contacts.phone',_0xbd4e('0x27'),_0xbd4e('0x28'),_0xbd4e('0x29'),_0x41ff1b+'.'+_0x5d7efe,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xbd4e('0x2a'),_0xbd4e('0x2b'),'\x22'+_0x5e5a69+'\x22'];return squel['insert']()[_0xbd4e('0x2c')](_0xbd4e('0x2d'))[_0xbd4e('0x2e')](['phone',_0xbd4e('0x2f'),_0xbd4e('0x30'),'ListId',_0x5d7efe,_0xbd4e('0x31'),'updatedAt',_0xbd4e('0x32'),_0xbd4e('0x33'),_0xbd4e('0x34')],squel[_0xbd4e('0x13')]()[_0xbd4e('0x35')](_0x595396)[_0xbd4e('0x36')](_0x41ff1b)[_0xbd4e('0x16')](_0xbd4e('0x37'),null,_0xbd4e('0x38')+_0x41ff1b+_0xbd4e('0x39'))[_0xbd4e('0x16')](_0x460466,null,_0x460466+'.id\x20=\x20'+_0x41ff1b+'.'+_0x5d7efe)[_0xbd4e('0x18')](_0x41ff1b+_0xbd4e('0x3a'),_0xf0be3f)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbd4e('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x41ff1b,_0x460466,_0x5d7efe,_0xbd4e('0x2d'),[_0xbd4e('0x3b'),_0xbd4e('0x3c')]))[_0xbd4e('0x18')](_0xbd4e('0x3d'),selectNotIn(_0x41ff1b,_0x460466,_0x5d7efe,_0xbd4e('0x2d'),[_0xbd4e('0x3b')])))[_0xbd4e('0x3e')]();}function insertCmHopperBlack(_0x1d3659,_0x2ebd4c,_0x6eb519,_0x53cafd){var _0x509bf3=[_0xbd4e('0x3f'),_0xbd4e('0x28'),'cm_contacts.ListId',_0x2ebd4c+'.'+_0x53cafd,'cm_contacts.createdAt',_0xbd4e('0x40')];return squel[_0xbd4e('0x41')]()[_0xbd4e('0x2c')]('cm_hopper_black')[_0xbd4e('0x2e')](['phone',_0xbd4e('0x30'),_0xbd4e('0x42'),_0x53cafd,_0xbd4e('0x31'),_0xbd4e('0x43')],squel[_0xbd4e('0x13')]()[_0xbd4e('0x35')](_0x509bf3)[_0xbd4e('0x36')](_0x2ebd4c)[_0xbd4e('0x16')]('cm_contacts',null,_0xbd4e('0x38')+_0x2ebd4c+_0xbd4e('0x39'))[_0xbd4e('0x16')](_0x6eb519,null,_0x6eb519+_0xbd4e('0x17')+_0x2ebd4c+'.'+_0x53cafd)[_0xbd4e('0x18')](_0x2ebd4c+'.CmListId\x20=\x20?',_0x1d3659)[_0xbd4e('0x18')](_0xbd4e('0x44'),NOW)[_0xbd4e('0x18')](_0xbd4e('0x3d'),squel[_0xbd4e('0x13')]()[_0xbd4e('0x14')](_0xbd4e('0x15'))[_0xbd4e('0x36')](_0xbd4e('0x45'))[_0xbd4e('0x18')](_0xbd4e('0x46'),_0x1d3659)[_0xbd4e('0x18')](_0x53cafd+_0xbd4e('0x47')+_0x2ebd4c+'.'+_0x53cafd)))[_0xbd4e('0x3e')]();}function insertTzCmHopper(_0x250ec6,_0x1dc577,_0x55f53a,_0x5b3ec4,_0x10ed50,_0x23c19d){var _0x51c77a=[_0xbd4e('0x3f'),_0xbd4e('0x48')+_0x23c19d+_0xbd4e('0x49'),_0xbd4e('0x28'),_0xbd4e('0x29'),_0x1dc577+'.'+_0x5b3ec4,_0xbd4e('0x4a'),_0xbd4e('0x40'),_0xbd4e('0x2a'),_0xbd4e('0x2b'),'\x22'+_0x10ed50+'\x22'];var _0x1ab6c=squel[_0xbd4e('0x41')]()[_0xbd4e('0x2c')](_0xbd4e('0x2d'))[_0xbd4e('0x2e')]([_0xbd4e('0x15'),_0xbd4e('0x2f'),_0xbd4e('0x30'),'ListId',_0x5b3ec4,_0xbd4e('0x31'),'updatedAt',_0xbd4e('0x32'),_0xbd4e('0x33'),_0xbd4e('0x34')],squel['select']()[_0xbd4e('0x35')](_0x51c77a)[_0xbd4e('0x36')](_0x1dc577)[_0xbd4e('0x16')](_0xbd4e('0x37'),null,_0xbd4e('0x38')+_0x1dc577+'.CmListId')[_0xbd4e('0x16')](_0x55f53a,null,_0x55f53a+_0xbd4e('0x17')+_0x1dc577+'.'+_0x5b3ec4)[_0xbd4e('0x16')](_0x23c19d,null,_0x23c19d+_0xbd4e('0x17')+_0x1dc577+'.'+_0x5b3ec4)[_0xbd4e('0x18')](_0x1dc577+'.CmListId\x20=\x20?',_0x250ec6)[_0xbd4e('0x18')](_0xbd4e('0x44'),NOW)['where'](_0xbd4e('0x3d'),selectNotIn(_0x1dc577,_0x55f53a,_0x5b3ec4,_0xbd4e('0x2d'),[_0xbd4e('0x3b'),'\x22onlyIfOpen\x22']))[_0xbd4e('0x18')](_0xbd4e('0x3d'),selectNotIn(_0x1dc577,_0x55f53a,_0x5b3ec4,_0xbd4e('0x2d'),['\x22always\x22'])))[_0xbd4e('0x3e')]();return _0x1ab6c;}function insertTzCmHopperBlack(_0xb25707,_0x440e10,_0x482f6d,_0x1db119){var _0x4976ec=[_0xbd4e('0x3f'),'cm_contacts.id',_0xbd4e('0x29'),_0x440e10+'.'+_0x1db119,_0xbd4e('0x4a'),_0xbd4e('0x40')];return squel[_0xbd4e('0x41')]()[_0xbd4e('0x2c')]('cm_hopper_black')[_0xbd4e('0x2e')]([_0xbd4e('0x15'),_0xbd4e('0x30'),_0xbd4e('0x42'),_0x1db119,_0xbd4e('0x31'),'updatedAt'],squel[_0xbd4e('0x13')]()[_0xbd4e('0x35')](_0x4976ec)['from'](_0x440e10)[_0xbd4e('0x16')](_0xbd4e('0x37'),null,_0xbd4e('0x38')+_0x440e10+_0xbd4e('0x39'))[_0xbd4e('0x16')](_0x482f6d,null,_0x482f6d+_0xbd4e('0x17')+_0x440e10+'.'+_0x1db119)[_0xbd4e('0x18')](_0x440e10+'.CmListId\x20=\x20?',_0xb25707)[_0xbd4e('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbd4e('0x18')](_0xbd4e('0x3d'),squel[_0xbd4e('0x13')]()[_0xbd4e('0x14')](_0xbd4e('0x15'))[_0xbd4e('0x36')](_0xbd4e('0x45'))['where'](_0xbd4e('0x46'),_0xb25707)['where'](_0x1db119+'\x20=\x20'+_0x440e10+'.'+_0x1db119)))['toString']();}function insertCmHopperAdditionalPhones(_0x46a594){var _0x31b6f1=[_0xbd4e('0x4b'),_0xbd4e('0x4c'),_0xbd4e('0x4d'),_0xbd4e('0x4e'),_0xbd4e('0x4f')];return squel['insert']()[_0xbd4e('0x2c')](_0xbd4e('0x50'))[_0xbd4e('0x2e')]([_0xbd4e('0x51'),_0xbd4e('0x15'),_0xbd4e('0x52'),'createdAt','updatedAt'],squel[_0xbd4e('0x13')]()[_0xbd4e('0x35')](_0x31b6f1)['from']('cm_hopper')[_0xbd4e('0x16')](_0xbd4e('0x37'),null,_0xbd4e('0x53'))['join'](_0xbd4e('0x54'),null,_0xbd4e('0x55'))[_0xbd4e('0x18')](_0xbd4e('0x56'),_0x46a594)[_0xbd4e('0x18')](_0xbd4e('0x44'),NOW))[_0xbd4e('0x3e')]();}function insertCmContact(_0x3e7ef9,_0x1ad71d,_0x33fa76,_0x1cc55f){var _0x4c8546=_[_0xbd4e('0x57')](_[_0xbd4e('0x58')](_0x1cc55f),[_0xbd4e('0x42'),_0xbd4e('0x59'),'createdAt',_0xbd4e('0x43')]);return squel[_0xbd4e('0x41')]()[_0xbd4e('0x2c')]('cm_contacts')[_0xbd4e('0x2e')](_0x4c8546,squel[_0xbd4e('0x13')]()[_0xbd4e('0x35')](_0x4c8546)[_0xbd4e('0x36')](_0x1ad71d)[_0xbd4e('0x18')]('('+_0x33fa76['join'](',')+_0xbd4e('0x5a'),squel['select']()['fields'](_0x33fa76)[_0xbd4e('0x36')]('cm_contacts')['where'](_0xbd4e('0x46'),_0x3e7ef9)['where']('deletedAt\x20IS\x20NULL'))[_0xbd4e('0x18')](_0xbd4e('0x5b'),squel[_0xbd4e('0x13')]()[_0xbd4e('0x14')](_0xbd4e('0x5c'),_0xbd4e('0x5d'))[_0xbd4e('0x36')](_0x1ad71d)[_0xbd4e('0x5e')](_0x33fa76[_0xbd4e('0x16')](','))))[_0xbd4e('0x3e')]();}function handleStop(){logger['info'](_0xbd4e('0x5f'));stopped=!![];}function handleUncaughtException(_0x2358d2){logger['error'](_0x2358d2[_0xbd4e('0x60')]);process[_0xbd4e('0x61')](0x1);}function handleError(_0x1d212e,_0xca0647){stats['errors'][_0xbd4e('0x1e')]({'name':_0xca0647[_0xbd4e('0x62')],'message':_0xca0647[_0xbd4e('0x60')],'row':_0x1d212e});}function handleQuery(_0x5f1540){logger[_0xbd4e('0x63')](_0x5f1540);return db[_0xbd4e('0x64')]['query'](_0x5f1540)['spread'](function(_0x21b56c){results['push'](_0x21b56c);})[_0xbd4e('0x65')](function(_0x3820cb){logger['error'](_0x3820cb[_0xbd4e('0x60')]);});}function updateTzCampaigns(_0x307bfe){return new Promise(function(_0x445c5e,_0x6ee779){var _0x1a7e05=squel[_0xbd4e('0x13')]()[_0xbd4e('0x35')]([_0xbd4e('0x66'),_0xbd4e('0x67')])[_0xbd4e('0x36')](_0xbd4e('0x68'))[_0xbd4e('0x16')](_0xbd4e('0x69'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xbd4e('0x18')](_0xbd4e('0x6a')+_0x307bfe);db[_0xbd4e('0x64')][_0xbd4e('0x6b')](_0x1a7e05[_0xbd4e('0x3e')]())[_0xbd4e('0x6c')](function(_0x4104cd){var _0x3a75bb=[];for(var _0x2ecf9e=0x0;_0x2ecf9e<_0x4104cd[_0xbd4e('0x1d')];_0x2ecf9e++){_0x3a75bb[_0xbd4e('0x1e')](getTimezoneData(_0x4104cd[_0x2ecf9e],tmp_campaigns));}BPromise[_0xbd4e('0x1f')](_0x3a75bb)[_0xbd4e('0x1c')](function(){_0x445c5e({'val':0x1});});})[_0xbd4e('0x65')](function(_0x3daf2f){logger[_0xbd4e('0x6d')](_0x3daf2f[_0xbd4e('0x60')]);_0x445c5e({'val':0x0});});});}function updateTzVoiceQueues(_0x29b26a){return new Promise(function(_0x7ee902,_0x50f057){var _0x4def18=squel[_0xbd4e('0x13')]()[_0xbd4e('0x35')](['voice_queues.id',_0xbd4e('0x6e')])[_0xbd4e('0x36')]('voice_queues')['join'](_0xbd4e('0x6f'),null,_0xbd4e('0x70'))[_0xbd4e('0x18')](_0xbd4e('0x71')+_0x29b26a);db[_0xbd4e('0x64')][_0xbd4e('0x6b')](_0x4def18[_0xbd4e('0x3e')]())[_0xbd4e('0x6c')](function(_0x2ba076){var _0x396e51=[];for(var _0x2939e7=0x0;_0x2939e7<_0x2ba076[_0xbd4e('0x1d')];_0x2939e7++){_0x396e51[_0xbd4e('0x1e')](getTimezoneData(_0x2ba076[_0x2939e7],tmp_voice_queues));}BPromise['all'](_0x396e51)[_0xbd4e('0x1c')](function(){_0x7ee902({'val':0x1});});})[_0xbd4e('0x65')](function(_0xf860a3){logger[_0xbd4e('0x6d')](_0xf860a3[_0xbd4e('0x60')]);_0x7ee902({'val':0x0});});});}function getTimezoneData(_0x39a230,_0x4791df){return new Promise(function(_0x53e2ac,_0x503373){var _0xab53af=shared[_0xbd4e('0x72')];var _0x54a8c4=_0xab53af[_0x39a230[_0xbd4e('0x73')]];if(_[_0xbd4e('0x74')](_0x54a8c4)){_0x53e2ac({'ret':0x1});}else{var _0x3515a5=_0x54a8c4[_0xbd4e('0x75')];var _0x1f389c=squel['insert']()[_0xbd4e('0x2c')](_0x4791df)[_0xbd4e('0x76')]('id',_0x39a230['id'])[_0xbd4e('0x76')](_0xbd4e('0x77'),_0x3515a5)[_0xbd4e('0x76')](_0xbd4e('0x73'),_0x39a230[_0xbd4e('0x73')])[_0xbd4e('0x3e')]();return db[_0xbd4e('0x64')]['query'](_0x1f389c)[_0xbd4e('0x6c')](function(_0x52ffcd){_0x53e2ac({'ret':0x1});})['catch'](function(_0x12ea06){logger[_0xbd4e('0x6d')](_0x12ea06[_0xbd4e('0x60')]);_0x503373({'ret':0x1});});}});}function handleTZQuery(_0x3061f0){logger[_0xbd4e('0x63')](_0x3061f0);return db[_0xbd4e('0x64')][_0xbd4e('0x6b')](_0x3061f0)[_0xbd4e('0x6c')](function(_0x4a6c92){})[_0xbd4e('0x65')](function(_0x486300){logger[_0xbd4e('0x6d')](_0x486300[_0xbd4e('0x60')]);});}function main(_0x263c80,_0x4b1133,_0x2fb000,_0x364821){logger['info'](_0xbd4e('0x78'),_0x263c80,JSON[_0xbd4e('0x79')](_0x4b1133));process[_0xbd4e('0x7a')](_0xbd4e('0x7b'));var _0x3c1532=_0x4b1133['binding'];var _0x1449e0=_[_0xbd4e('0x7c')](_0x3c1532);var _0x148d7e=_0x4b1133['socket_timestamp'];var _0x218aac=path[_0xbd4e('0x16')](config[_0xbd4e('0x7d')],'server/files/tmp',_0x148d7e+_0xbd4e('0x7e'));hasTZ=_[_0xbd4e('0x58')](_0x3c1532)['includes'](_0xbd4e('0x73'));var _0x1afa3b=_[_0xbd4e('0x58')](_0x3c1532)[_0xbd4e('0x16')]();logger[_0xbd4e('0x63')](_0xbd4e('0x7f'),_0x1afa3b);db[_0xbd4e('0x80')]['findAll']({'raw':!![],'attributes':['id',_0xbd4e('0x81')]})[_0xbd4e('0x1c')](function(_0x30f178){for(var _0x4d48e0=0x0;_0x4d48e0<_0x30f178[_0xbd4e('0x1d')];_0x4d48e0++){if(_0x30f178[_0x4d48e0]['name']in _0x3c1532){contactItemTypes[_0xbd4e('0x1e')](_0x30f178[_0x4d48e0]);delete _0x1449e0[_0x30f178[_0x4d48e0][_0xbd4e('0x81')]];hasAdditionalPhones=!![];}for(var _0x36b4d5 in _0x3c1532){if(_0x30f178[_0x4d48e0][_0xbd4e('0x81')]+_0xbd4e('0x82')===_0x36b4d5){phoneDescriptions['push']({'itemTypeId':_0x30f178[_0x4d48e0]['id'],'description':_0x36b4d5});delete _0x1449e0[_0x36b4d5];}}}if(hasAdditionalPhones)_0x1449e0[_0xbd4e('0x1b')]='';var _0x449646=_[_0xbd4e('0x58')](_0x1449e0)[_0xbd4e('0x16')]();logger[_0xbd4e('0x63')](_0xbd4e('0x7f'),_0x449646);fs[_0xbd4e('0x83')](_0x218aac,_0x449646+'\x0a');Papa[_0xbd4e('0x84')](fs[_0xbd4e('0x85')](_0x263c80),{'header':!![],'skipEmptyLines':!![],'step':function(_0x15fecc,_0x1554e3){try{for(var _0x11e74a=0x0,_0x6263cd=[];_0x11e74a<_0x15fecc[_0xbd4e('0x86')][_0xbd4e('0x1d')];_0x11e74a++){stats['rows']+=0x1;if(_0x15fecc[_0xbd4e('0x87')][_0x11e74a]){handleError(_0x15fecc['data'][_0x11e74a],_0x15fecc[_0xbd4e('0x87')][_0x11e74a]);}else{var _0x3e98bc=[];var _0x122df3=[];var _0x18cf92={};for(var _0x258f59 in _0x3c1532){let _0x5b8ffe=contactItemTypes[_0xbd4e('0x88')](_0x2fb8de=>_0x2fb8de['name']===_0x258f59);let _0x100322=contactItemTypes[_0xbd4e('0x88')](_0x1558bf=>_0x1558bf[_0xbd4e('0x81')]+'_description'===_0x258f59);if(_[_0xbd4e('0x74')](_0x5b8ffe)&&_['isNil'](_0x100322)){if(_0x3c1532['hasOwnProperty'](_0x258f59)){if(_0x15fecc['data'][_0x11e74a][_0x3c1532[_0x258f59]]){var _0x3bd70c=_[_0xbd4e('0x89')](_0x15fecc[_0xbd4e('0x86')][_0x11e74a][_0x3c1532[_0x258f59]][_0xbd4e('0x8a')](/"/g,'\x27'));switch(_0x258f59){case'scheduledat':var _0x325b38=moment(_0x3bd70c,_0xbd4e('0x11'),!![]);if(_0x325b38['isValid']()){_0x6263cd[_0xbd4e('0x1e')]('\x22'+_0x3bd70c+'\x22');}else{_0x3e98bc[_0xbd4e('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xbd4e('0x32'):var _0x1fe689=parseInt(_0x3bd70c);_0x3bd70c=_['isNaN'](_0x1fe689)||_0x1fe689<0x0||_0x1fe689>0x4?_0x364821?0x3:0x2:_0x1fe689;_0x6263cd[_0xbd4e('0x1e')]('\x22'+_0x3bd70c+'\x22');break;case'UserId':var _0x29f0b8=parseInt(_0x3bd70c);if(_['isNumber'](_0x29f0b8)&&_['includes'](_0x2fb000,_0x29f0b8)){_0x6263cd[_0xbd4e('0x1e')]('\x22'+_0x29f0b8+'\x22');}else{_0x3e98bc[_0xbd4e('0x1e')](_0xbd4e('0x8b'));}break;case'email':if(isEmail(_0x3bd70c)){_0x6263cd[_0xbd4e('0x1e')]('\x22'+_0x3bd70c+'\x22');}else{_0x3e98bc['push'](_0xbd4e('0x8c'));}break;case _0xbd4e('0x8d'):var _0x553b7a=moment(_0x3bd70c,_0xbd4e('0x8e'),!![]);if(_0x553b7a[_0xbd4e('0x8f')]()){_0x6263cd['push']('\x22'+_0x3bd70c+'\x22');}else{_0x3e98bc[_0xbd4e('0x1e')](_0xbd4e('0x90'));}break;case'dialTimezone':var _0x2cdf5b=shared[_0xbd4e('0x72')];var _0x5667d4=_0x2cdf5b[_0x3bd70c];if(!_[_0xbd4e('0x74')](_0x5667d4)){var _0x19ab46=_0x5667d4['utcOffset'];_0x6263cd[_0xbd4e('0x1e')]('\x22'+_0x3bd70c+'\x22');_0x6263cd[_0xbd4e('0x1e')]('\x22'+_0x19ab46+'\x22');}break;default:_0x6263cd[_0xbd4e('0x1e')]('\x22'+_0x3bd70c+'\x22');}}else{switch(_0x258f59){case _0xbd4e('0x91'):case'phone':_0x3e98bc[_0xbd4e('0x1e')](_0x258f59+'\x20not\x20specified');break;default:_0x6263cd['push']('\x22\x22');}}}}else{var _0x531b1a='';if(!_[_0xbd4e('0x74')](_0x5b8ffe)){if(!_0x18cf92[_0xbd4e('0x92')](_0x5b8ffe['id'])){if(!_[_0xbd4e('0x74')](_0x15fecc[_0xbd4e('0x86')][_0x11e74a][_0x3c1532[_0x258f59]])){var _0x3bd70c=_[_0xbd4e('0x89')](_0x15fecc[_0xbd4e('0x86')][_0x11e74a][_0x3c1532[_0x258f59]]['replace'](/"/g,'\x27'));var _0x1743c2=phoneDescriptions[_0xbd4e('0x88')](_0x3c1fe2=>_0x3c1fe2['itemTypeId']===_0x5b8ffe['id']);if(!_[_0xbd4e('0x74')](_0x1743c2)){var _0x401ae0=_['trim'](_0x15fecc[_0xbd4e('0x86')][_0x11e74a][_0x3c1532[_0x1743c2[_0xbd4e('0x93')]]][_0xbd4e('0x8a')](/"/g,'\x27'));if(!_['isNil'](_0x401ae0))_0x3bd70c=_0x3bd70c+'§'+_0x401ae0;}if(_0x531b1a=='')_0x531b1a=_0x3bd70c;else _0x531b1a+='|'+_0x3bd70c;}_0x122df3[_0xbd4e('0x1e')](_0x5b8ffe['id']+':'+_0x531b1a);_0x18cf92[_0x5b8ffe['id']]=0x1;}}}}if(hasAdditionalPhones){_0x6263cd['push']('\x22'+_0x122df3[_0xbd4e('0x16')](';')+'\x22');}if(_0x3e98bc['length']){handleError(_0x15fecc[_0xbd4e('0x86')][_0x11e74a],{'code':_0xbd4e('0x94'),'message':_0x3e98bc[_0xbd4e('0x16')]()});}else{fs[_0xbd4e('0x95')](_0x218aac,_0x6263cd['join']()+'\x0a');}_0x6263cd=[];}if(!(stats[_0xbd4e('0x96')]%0xc8)){socket[_0xbd4e('0x97')](_0xbd4e('0x98')+_0x148d7e,stats);stats[_0xbd4e('0x87')]=[];}}if(stopped){logger['info'](_0xbd4e('0x99'));_0x1554e3[_0xbd4e('0x9a')]();}}catch(_0x3a5ddf){handleError(_0x15fecc[_0xbd4e('0x86')][_0x11e74a],{'code':'SystemError','message':_0x3a5ddf['message']});logger[_0xbd4e('0x6d')](_0xbd4e('0x9b'),_0x3a5ddf[_0xbd4e('0x60')]);}},'complete':function(){try{var _0xa009d3=[];var _0x46d2d6=[];var _0x2d4f89=_0xbd4e('0x37');if(_0x4b1133[_0xbd4e('0x9c')]&&_0x4b1133[_0xbd4e('0x9c')][_0xbd4e('0x1d')]){_0x2d4f89=_0xbd4e('0x9d')+_0x148d7e;_0xa009d3[_0xbd4e('0x1e')](_0xbd4e('0x9e')+_0x2d4f89+_0xbd4e('0x9f'));}tmp_campaigns='campaigns_'+_0x148d7e;tmp_voice_queues='voice_queues_'+_0x148d7e;_0x46d2d6['push'](_0xbd4e('0x9e')+tmp_campaigns+_0xbd4e('0xa0'));_0x46d2d6[_0xbd4e('0x1e')](_0xbd4e('0x9e')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x46d2d6,handleTZQuery)[_0xbd4e('0x1c')](function(_0x4647b7){updateTzCampaigns(_0x4b1133[_0xbd4e('0x42')])[_0xbd4e('0x1c')](function(_0x457074){updateTzVoiceQueues(_0x4b1133[_0xbd4e('0x42')])[_0xbd4e('0x1c')](function(_0x1fd50c){if(hasTZ)_0x449646=_0x449646['replace'](_0xbd4e('0x73'),_0xbd4e('0xa1'));var _0x2d0afe=util[_0xbd4e('0x10')](_0xbd4e('0xa2'),_0x218aac,_0x2d4f89,_0x449646,_0x4b1133[_0xbd4e('0x42')],_0x4b1133[_0xbd4e('0x59')]||null,NOW,NOW);if(_[_0xbd4e('0x74')](_0x3c1532['scheduledat'])){_0x2d0afe+=_0xbd4e('0xa3');}_0xa009d3[_0xbd4e('0x1e')](_0x2d0afe);if(_0x4b1133[_0xbd4e('0x9c')]&&_0x4b1133['duplicates']['length']){_0xa009d3[_0xbd4e('0x1e')](insertCmContact(_0x4b1133['ListId'],_0x2d4f89,_0x4b1133[_0xbd4e('0x9c')],_0x3c1532));_0xa009d3[_0xbd4e('0x1e')](_0xbd4e('0xa4')+_0x2d4f89+';');}BPromise[_0xbd4e('0xa5')](_0xa009d3,handleQuery)['then'](function(_0x4e852a){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0xa009d3=[];for(var _0x524c8b=0x0;_0x524c8b\x20\x20','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','from','join','where','CmContact','findAll','length','push','then','AdditionalPhones','split','all','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','.id\x20=\x20','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','exit','errors','message','sequelize','query','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','catch','timezones','dialTimezone','isNil','utcOffset','offset','set','main','stringify','send','clone','socket_timestamp','root','server/files/tmp','.csv','header','ContactItemType','name','createReadStream'];(function(_0x2da413,_0x5a5a51){var _0x58f54e=function(_0x5bc0ed){while(--_0x5bc0ed){_0x2da413['push'](_0x2da413['shift']());}};_0x58f54e(++_0x5a5a51);}(_0xe61c,0xee));var _0xce61=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xe61c[_0x10291b];return _0x1d5fbe;};'use strict';var fs=require('fs');var path=require(_0xce61('0x0'));var _=require('lodash');var Papa=require(_0xce61('0x1'));var util=require(_0xce61('0x2'));var BPromise=require(_0xce61('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xce61('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xce61('0x5'));var shared=require(_0xce61('0x6'));var logger=require(_0xce61('0x7'))(_0xce61('0x8'));config[_0xce61('0x9')]=_[_0xce61('0xa')](config[_0xce61('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xce61('0xb'))(new Redis(config[_0xce61('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xce61('0xc')](_0xce61('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xce61('0xc')](_0xce61('0xd'));function isEmail(_0x194398){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'](_0x194398);}function selectNotIn(_0x64a2fd,_0x3f764d,_0x54f43f,_0x42d50c,_0x30f2cb){return squel['select']()[_0xce61('0xe')]('phone')[_0xce61('0xf')](_0x42d50c)[_0xce61('0x10')](_0x3f764d,null,_0x3f764d+'.id\x20=\x20'+_0x42d50c+'.'+_0x54f43f)[_0xce61('0x11')](_0x42d50c+'.'+_0x54f43f+'\x20=\x20'+_0x64a2fd+'.'+_0x54f43f)[_0xce61('0x11')](_0x3f764d+'.dialCheckDuplicateType\x20IN\x20('+_0x30f2cb[_0xce61('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x17b690,_0x1d7012){promisesAdditionalPhones=[];return db[_0xce61('0x12')][_0xce61('0x13')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x330cae){if(_0x330cae!==null){var _0x5a1398=[];for(var _0x590cb3=0x0;_0x590cb3<_0x330cae[_0xce61('0x14')];_0x590cb3++){var _0x15151b=_0x330cae[_0x590cb3];_0x5a1398[_0xce61('0x15')](insertAdditionalPhones(_0x15151b));}}Promise['all'](_0x5a1398)[_0xce61('0x16')](function(){_0x17b690({'val':0x1});});});});}function insertAdditionalPhones(_0x4baf32){return new Promise(function(_0x3df071,_0xafb99e){var _0x4216c4=_0x4baf32[_0xce61('0x17')];var _0x3e30fa=_0x4216c4[_0xce61('0x18')](';');var _0xea8db2=[];orderBy=0x0;for(var _0x28b8e1=0x0;_0x28b8e1<_0x3e30fa['length'];_0x28b8e1++){_0xea8db2['push'](splitAdditionalPhone(_0x4baf32['id'],_0x3e30fa[_0x28b8e1]));}Promise[_0xce61('0x19')](_0xea8db2)['then'](function(){_0x3df071({'val':_0x3e30fa[_0xce61('0x14')]});});});}function splitAdditionalPhone(_0x16b70e,_0x41bf1d){return new Promise(function(_0x115466,_0x44cfbd){var _0x3e1957=_0x41bf1d[_0xce61('0x18')](':');var _0x5c0f72=_0x3e1957[0x0];var _0x479691=_0x3e1957[0x1];if(!_['isNil'](_0x479691)){var _0x28c7a7=_0x479691[_0xce61('0x18')]('|');var _0x202c09=[];for(var _0x15b6e7=0x0;_0x15b6e7<_0x28c7a7[_0xce61('0x14')];_0x15b6e7++){if(_0x28c7a7[_0x15b6e7]!==''){var _0x2241b2=_[_0xce61('0x1a')](promisesAdditionalPhones,{'contactId':_0x16b70e,'phone':_0x28c7a7[_0x15b6e7]});if(_0x2241b2[_0xce61('0x14')]==0x0){orderBy++;promisesAdditionalPhones[_0xce61('0x15')]({'contactId':_0x16b70e,'contactTypeId':_0x5c0f72,'phone':_0x28c7a7[_0x15b6e7],'orderBy':orderBy});}}}_0x115466({'ok':0x1});}else _0x115466({'res':0x0});});}function createAdditionalPhone(_0x2758e4,_0x54b4e5,_0x2a1185,_0x48b544){var _0x2f8d79='';var _0x2de420='';var _0x894785=_0x2a1185[_0xce61('0x18')]('§');_0x2f8d79=_0x894785[0x0];if(_0x894785[_0xce61('0x14')]==0x2)_0x2de420=_0x894785[0x1];return new Promise(function(_0x49d201,_0x31629b){return db[_0xce61('0x1b')]['findOne']({'where':{'CmContactId':_0x2758e4,'item':_0x2f8d79}})['then'](function(_0x5cb588){if(_0x5cb588){return db[_0xce61('0x1b')][_0xce61('0x1c')]({'ItemTypeId':_0x54b4e5,'description':_0x2de420,'OrderBy':_0x48b544},{'where':{'CmContactId':_0x2758e4,'item':_0x2f8d79}})[_0xce61('0x16')](function(_0x3a71b4){_0x49d201({'res':_0xce61('0x1d')});});}else{return db['CmContactHasItem'][_0xce61('0x1e')]({'CmContactId':_0x2758e4,'item':_0x2f8d79,'description':_0x2de420,'ItemTypeId':_0x54b4e5,'OrderBy':_0x48b544,'ItemClass':_0xce61('0x1f')})['then'](function(_0x187467){_0x49d201({'res':_0xce61('0x20')});});}});});}function insertCmHopper(_0x555e9b,_0xcface1,_0x3567cd,_0x53fa92,_0x3c9163){var _0x4a921f=[_0xce61('0x21'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0xcface1+'.'+_0x53fa92,_0xce61('0x22'),_0xce61('0x23'),_0xce61('0x24'),_0xce61('0x25'),'\x22'+_0x3c9163+'\x22'];return squel[_0xce61('0x26')]()[_0xce61('0x27')](_0xce61('0x28'))[_0xce61('0x29')]([_0xce61('0x2a'),_0xce61('0x2b'),_0xce61('0x2c'),_0xce61('0x2d'),_0x53fa92,_0xce61('0x2e'),_0xce61('0x2f'),_0xce61('0x30'),_0xce61('0x31'),_0xce61('0x32')],squel[_0xce61('0x33')]()[_0xce61('0x34')](_0x4a921f)[_0xce61('0xf')](_0xcface1)['join'](_0xce61('0x35'),null,_0xce61('0x36')+_0xcface1+_0xce61('0x37'))['join'](_0x3567cd,null,_0x3567cd+'.id\x20=\x20'+_0xcface1+'.'+_0x53fa92)['where'](_0xcface1+_0xce61('0x38'),_0x555e9b)[_0xce61('0x11')](_0xce61('0x39'),NOW)[_0xce61('0x11')](_0xce61('0x3a'),selectNotIn(_0xcface1,_0x3567cd,_0x53fa92,_0xce61('0x28'),[_0xce61('0x3b'),_0xce61('0x3c')]))[_0xce61('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcface1,_0x3567cd,_0x53fa92,'cm_hopper',[_0xce61('0x3b')])))[_0xce61('0x3d')]();}function insertCmHopperBlack(_0x106874,_0x41ce45,_0x12b66f,_0x58091d){var _0x1ab744=[_0xce61('0x21'),_0xce61('0x3e'),_0xce61('0x3f'),_0x41ce45+'.'+_0x58091d,_0xce61('0x22'),_0xce61('0x23')];return squel['insert']()[_0xce61('0x27')](_0xce61('0x40'))['fromQuery'](['phone',_0xce61('0x2c'),_0xce61('0x2d'),_0x58091d,_0xce61('0x2e'),_0xce61('0x2f')],squel[_0xce61('0x33')]()['fields'](_0x1ab744)[_0xce61('0xf')](_0x41ce45)['join'](_0xce61('0x35'),null,_0xce61('0x36')+_0x41ce45+_0xce61('0x37'))[_0xce61('0x10')](_0x12b66f,null,_0x12b66f+'.id\x20=\x20'+_0x41ce45+'.'+_0x58091d)['where'](_0x41ce45+'.CmListId\x20=\x20?',_0x106874)[_0xce61('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xce61('0x11')](_0xce61('0x3a'),squel['select']()[_0xce61('0xe')](_0xce61('0x2a'))['from'](_0xce61('0x40'))[_0xce61('0x11')](_0xce61('0x41'),_0x106874)[_0xce61('0x11')](_0x58091d+'\x20=\x20'+_0x41ce45+'.'+_0x58091d)))[_0xce61('0x3d')]();}function insertTzCmHopper(_0x12da8b,_0x1cdf83,_0x58254c,_0x30c0a9,_0x4b3f06,_0x252e7b){var _0x33bd75=[_0xce61('0x21'),_0xce61('0x42')+_0x252e7b+_0xce61('0x43'),'cm_contacts.id',_0xce61('0x3f'),_0x1cdf83+'.'+_0x30c0a9,_0xce61('0x22'),_0xce61('0x23'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4b3f06+'\x22'];var _0x4f6c62=squel[_0xce61('0x26')]()[_0xce61('0x27')]('cm_hopper')[_0xce61('0x29')]([_0xce61('0x2a'),_0xce61('0x2b'),_0xce61('0x2c'),_0xce61('0x2d'),_0x30c0a9,_0xce61('0x2e'),_0xce61('0x2f'),_0xce61('0x30'),_0xce61('0x31'),_0xce61('0x32')],squel['select']()['fields'](_0x33bd75)['from'](_0x1cdf83)[_0xce61('0x10')](_0xce61('0x35'),null,_0xce61('0x36')+_0x1cdf83+_0xce61('0x37'))[_0xce61('0x10')](_0x58254c,null,_0x58254c+_0xce61('0x44')+_0x1cdf83+'.'+_0x30c0a9)[_0xce61('0x10')](_0x252e7b,null,_0x252e7b+'.id\x20=\x20'+_0x1cdf83+'.'+_0x30c0a9)[_0xce61('0x11')](_0x1cdf83+_0xce61('0x38'),_0x12da8b)[_0xce61('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cdf83,_0x58254c,_0x30c0a9,_0xce61('0x28'),[_0xce61('0x3b'),'\x22onlyIfOpen\x22']))['where'](_0xce61('0x3a'),selectNotIn(_0x1cdf83,_0x58254c,_0x30c0a9,_0xce61('0x28'),[_0xce61('0x3b')])))['toString']();return _0x4f6c62;}function insertTzCmHopperBlack(_0x236f4e,_0x5de1bd,_0x250824,_0x2e2283){var _0x1af521=['cm_contacts.phone',_0xce61('0x3e'),_0xce61('0x3f'),_0x5de1bd+'.'+_0x2e2283,_0xce61('0x22'),_0xce61('0x23')];return squel[_0xce61('0x26')]()[_0xce61('0x27')](_0xce61('0x40'))[_0xce61('0x29')]([_0xce61('0x2a'),_0xce61('0x2c'),'ListId',_0x2e2283,_0xce61('0x2e'),_0xce61('0x2f')],squel[_0xce61('0x33')]()[_0xce61('0x34')](_0x1af521)[_0xce61('0xf')](_0x5de1bd)[_0xce61('0x10')](_0xce61('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x5de1bd+_0xce61('0x37'))['join'](_0x250824,null,_0x250824+_0xce61('0x44')+_0x5de1bd+'.'+_0x2e2283)['where'](_0x5de1bd+_0xce61('0x38'),_0x236f4e)[_0xce61('0x11')](_0xce61('0x39'),NOW)[_0xce61('0x11')](_0xce61('0x3a'),squel['select']()[_0xce61('0xe')]('phone')[_0xce61('0xf')](_0xce61('0x40'))[_0xce61('0x11')](_0xce61('0x41'),_0x236f4e)['where'](_0x2e2283+_0xce61('0x45')+_0x5de1bd+'.'+_0x2e2283)))[_0xce61('0x3d')]();}function insertCmHopperAdditionalPhones(_0x109e87){var _0x12392b=[_0xce61('0x46'),_0xce61('0x47'),_0xce61('0x48'),_0xce61('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0xce61('0x26')]()[_0xce61('0x27')](_0xce61('0x4a'))[_0xce61('0x29')](['CmHopperId',_0xce61('0x2a'),'OrderBy',_0xce61('0x2e'),_0xce61('0x2f')],squel[_0xce61('0x33')]()[_0xce61('0x34')](_0x12392b)[_0xce61('0xf')](_0xce61('0x28'))[_0xce61('0x10')](_0xce61('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xce61('0x10')](_0xce61('0x4b'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xce61('0x11')](_0xce61('0x4c'),_0x109e87)[_0xce61('0x11')](_0xce61('0x39'),NOW))[_0xce61('0x3d')]();}function insertCmContact(_0x332f39,_0x1103d8,_0x14446e,_0x2e71fe){var _0xef9f4=_[_0xce61('0x4d')](_[_0xce61('0x4e')](_0x2e71fe),['ListId',_0xce61('0x4f'),_0xce61('0x2e'),_0xce61('0x2f')]);return squel[_0xce61('0x26')]()[_0xce61('0x27')](_0xce61('0x35'))[_0xce61('0x29')](_0xef9f4,squel[_0xce61('0x33')]()['fields'](_0xef9f4)[_0xce61('0xf')](_0x1103d8)[_0xce61('0x11')]('('+_0x14446e[_0xce61('0x10')](',')+_0xce61('0x50'),squel[_0xce61('0x33')]()[_0xce61('0x34')](_0x14446e)['from'](_0xce61('0x35'))[_0xce61('0x11')](_0xce61('0x41'),_0x332f39)['where']('deletedAt\x20IS\x20NULL'))[_0xce61('0x11')](_0xce61('0x51'),squel[_0xce61('0x33')]()[_0xce61('0xe')](_0xce61('0x52'),_0xce61('0x53'))['from'](_0x1103d8)[_0xce61('0x54')](_0x14446e[_0xce61('0x10')](','))))[_0xce61('0x3d')]();}function handleStop(){logger[_0xce61('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xa81f62){logger[_0xce61('0x56')](_0xa81f62['message']);process[_0xce61('0x57')](0x1);}function handleError(_0x4c6bda,_0x55df08){stats[_0xce61('0x58')][_0xce61('0x15')]({'name':_0x55df08['code'],'message':_0x55df08[_0xce61('0x59')],'row':_0x4c6bda});}function handleQuery(_0x342c74){logger['info'](_0x342c74);return db[_0xce61('0x5a')][_0xce61('0x5b')](_0x342c74)['spread'](function(_0x4b936d){results['push'](_0x4b936d);})['catch'](function(_0x45a0ee){logger[_0xce61('0x56')](_0x45a0ee[_0xce61('0x59')]);});}function updateTzCampaigns(_0x27714e){return new Promise(function(_0x4f0f3c,_0x4b0550){var _0x205031=squel[_0xce61('0x33')]()['fields']([_0xce61('0x5c'),_0xce61('0x5d')])[_0xce61('0xf')](_0xce61('0x5e'))[_0xce61('0x10')](_0xce61('0x5f'),null,_0xce61('0x60'))[_0xce61('0x11')](_0xce61('0x61')+_0x27714e);db['sequelize'][_0xce61('0x5b')](_0x205031[_0xce61('0x3d')]())[_0xce61('0x62')](function(_0x226419){var _0x23b846=[];for(var _0x1f631d=0x0;_0x1f631d<_0x226419[_0xce61('0x14')];_0x1f631d++){_0x23b846[_0xce61('0x15')](getTimezoneData(_0x226419[_0x1f631d],tmp_campaigns));}BPromise[_0xce61('0x19')](_0x23b846)[_0xce61('0x16')](function(){_0x4f0f3c({'val':0x1});});})['catch'](function(_0x1af64d){logger[_0xce61('0x56')](_0x1af64d['message']);_0x4f0f3c({'val':0x0});});});}function updateTzVoiceQueues(_0x303c86){return new Promise(function(_0x42d2ad,_0x1ef8e9){var _0x121956=squel[_0xce61('0x33')]()['fields']([_0xce61('0x63'),_0xce61('0x64')])[_0xce61('0xf')]('voice_queues')[_0xce61('0x10')](_0xce61('0x65'),null,_0xce61('0x66'))[_0xce61('0x11')]('voice_queues_has_cm_lists.CmListId='+_0x303c86);db[_0xce61('0x5a')][_0xce61('0x5b')](_0x121956[_0xce61('0x3d')]())[_0xce61('0x62')](function(_0x345701){var _0x1808df=[];for(var _0x3c3279=0x0;_0x3c3279<_0x345701[_0xce61('0x14')];_0x3c3279++){_0x1808df['push'](getTimezoneData(_0x345701[_0x3c3279],tmp_voice_queues));}BPromise[_0xce61('0x19')](_0x1808df)[_0xce61('0x16')](function(){_0x42d2ad({'val':0x1});});})[_0xce61('0x67')](function(_0x5d66e6){logger[_0xce61('0x56')](_0x5d66e6[_0xce61('0x59')]);_0x42d2ad({'val':0x0});});});}function getTimezoneData(_0x3f1d58,_0x2b5aa4){return new Promise(function(_0x56ad8d,_0x33fa98){var _0x580881=shared[_0xce61('0x68')];var _0x373096=_0x580881[_0x3f1d58[_0xce61('0x69')]];if(_[_0xce61('0x6a')](_0x373096)){_0x56ad8d({'ret':0x1});}else{var _0x31220c=_0x373096[_0xce61('0x6b')];var _0x54f726=squel[_0xce61('0x26')]()[_0xce61('0x27')](_0x2b5aa4)['set']('id',_0x3f1d58['id'])['set'](_0xce61('0x6c'),_0x31220c)[_0xce61('0x6d')](_0xce61('0x69'),_0x3f1d58[_0xce61('0x69')])[_0xce61('0x3d')]();return db['sequelize'][_0xce61('0x5b')](_0x54f726)['spread'](function(_0x5b215a){_0x56ad8d({'ret':0x1});})['catch'](function(_0x56892c){logger['error'](_0x56892c['message']);_0x33fa98({'ret':0x1});});}});}function handleTZQuery(_0x45bbd9){logger[_0xce61('0x55')](_0x45bbd9);return db['sequelize'][_0xce61('0x5b')](_0x45bbd9)[_0xce61('0x62')](function(_0x3ce801){})[_0xce61('0x67')](function(_0x188bbf){logger[_0xce61('0x56')](_0x188bbf[_0xce61('0x59')]);});}function main(_0x5cd4b9,_0x319366,_0x4e4a52,_0x29526f){logger[_0xce61('0x55')](_0xce61('0x6e'),_0x5cd4b9,JSON[_0xce61('0x6f')](_0x319366));process[_0xce61('0x70')]('start');var _0x2700c6=_0x319366['binding'];var _0x39a942=_[_0xce61('0x71')](_0x2700c6);var _0x50d4f2=_0x319366[_0xce61('0x72')];var _0x43956b=path[_0xce61('0x10')](config[_0xce61('0x73')],_0xce61('0x74'),_0x50d4f2+_0xce61('0x75'));hasTZ=_[_0xce61('0x4e')](_0x2700c6)['includes'](_0xce61('0x69'));var _0x31c9e5=_['keys'](_0x2700c6)[_0xce61('0x10')]();logger['info'](_0xce61('0x76'),_0x31c9e5);db[_0xce61('0x77')][_0xce61('0x13')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x44139c){for(var _0x503ff7=0x0;_0x503ff7<_0x44139c[_0xce61('0x14')];_0x503ff7++){if(_0x44139c[_0x503ff7][_0xce61('0x78')]in _0x2700c6){contactItemTypes[_0xce61('0x15')](_0x44139c[_0x503ff7]);delete _0x39a942[_0x44139c[_0x503ff7]['name']];hasAdditionalPhones=!![];}for(var _0x301de1 in _0x2700c6){if(_0x44139c[_0x503ff7]['name']+'_description'===_0x301de1){phoneDescriptions[_0xce61('0x15')]({'itemTypeId':_0x44139c[_0x503ff7]['id'],'description':_0x301de1});delete _0x39a942[_0x301de1];}}}if(hasAdditionalPhones)_0x39a942[_0xce61('0x17')]='';var _0x56f463=_[_0xce61('0x4e')](_0x39a942)[_0xce61('0x10')]();logger[_0xce61('0x55')](_0xce61('0x76'),_0x56f463);fs['writeFileSync'](_0x43956b,_0x56f463+'\x0a');Papa['parse'](fs[_0xce61('0x79')](_0x5cd4b9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c35d8,_0x108a20){try{for(var _0x164512=0x0,_0x57991d=[];_0x164512<_0x1c35d8[_0xce61('0x7a')][_0xce61('0x14')];_0x164512++){stats['rows']+=0x1;if(_0x1c35d8['errors'][_0x164512]){handleError(_0x1c35d8[_0xce61('0x7a')][_0x164512],_0x1c35d8[_0xce61('0x58')][_0x164512]);}else{var _0x26b8f1=[];var _0x52b2ad=[];var _0x3de23c={};for(var _0x4e5281 in _0x2700c6){let _0x13647c=contactItemTypes['find'](_0x4a3b6c=>_0x4a3b6c['name']===_0x4e5281);let _0x1098ac=contactItemTypes[_0xce61('0x7b')](_0x6b1f12=>_0x6b1f12[_0xce61('0x78')]+_0xce61('0x7c')===_0x4e5281);if(_[_0xce61('0x6a')](_0x13647c)&&_['isNil'](_0x1098ac)){if(_0x2700c6['hasOwnProperty'](_0x4e5281)){if(_0x1c35d8[_0xce61('0x7a')][_0x164512][_0x2700c6[_0x4e5281]]){var _0x17a833=_[_0xce61('0x7d')](_0x1c35d8[_0xce61('0x7a')][_0x164512][_0x2700c6[_0x4e5281]]['replace'](/"/g,'\x27'));switch(_0x4e5281){case _0xce61('0x2b'):var _0x1a4b4f=moment(_0x17a833,_0xce61('0xd'),!![]);if(_0x1a4b4f[_0xce61('0x7e')]()){_0x57991d[_0xce61('0x15')]('\x22'+_0x17a833+'\x22');}else{_0x26b8f1['push'](_0xce61('0x7f'));}break;case'priority':var _0x1b6831=parseInt(_0x17a833);_0x17a833=_[_0xce61('0x80')](_0x1b6831)||_0x1b6831<0x0||_0x1b6831>0x4?_0x29526f?0x3:0x2:_0x1b6831;_0x57991d[_0xce61('0x15')]('\x22'+_0x17a833+'\x22');break;case'UserId':var _0x451b22=parseInt(_0x17a833);if(_['isNumber'](_0x451b22)&&_[_0xce61('0x81')](_0x4e4a52,_0x451b22)){_0x57991d[_0xce61('0x15')]('\x22'+_0x451b22+'\x22');}else{_0x26b8f1[_0xce61('0x15')](_0xce61('0x82'));}break;case _0xce61('0x83'):if(isEmail(_0x17a833)){_0x57991d[_0xce61('0x15')]('\x22'+_0x17a833+'\x22');}else{_0x26b8f1[_0xce61('0x15')](_0xce61('0x84'));}break;case _0xce61('0x85'):var _0x20a28f=moment(_0x17a833,_0xce61('0x86'),!![]);if(_0x20a28f[_0xce61('0x7e')]()){_0x57991d[_0xce61('0x15')]('\x22'+_0x17a833+'\x22');}else{_0x26b8f1[_0xce61('0x15')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x2fb231=shared[_0xce61('0x68')];var _0x5522dd=_0x2fb231[_0x17a833];if(!_[_0xce61('0x6a')](_0x5522dd)){var _0x24245e=_0x5522dd[_0xce61('0x6b')];_0x57991d['push']('\x22'+_0x17a833+'\x22');_0x57991d[_0xce61('0x15')]('\x22'+_0x24245e+'\x22');}break;default:_0x57991d[_0xce61('0x15')]('\x22'+_0x17a833+'\x22');}}else{switch(_0x4e5281){case _0xce61('0x87'):case _0xce61('0x2a'):_0x26b8f1['push'](_0x4e5281+'\x20not\x20specified');break;default:_0x57991d[_0xce61('0x15')]('\x22\x22');}}}}else{var _0x1f6555='';if(!_[_0xce61('0x6a')](_0x13647c)){if(!_0x3de23c[_0xce61('0x88')](_0x13647c['id'])){if(!_['isNil'](_0x1c35d8['data'][_0x164512][_0x2700c6[_0x4e5281]])){var _0x17a833=_[_0xce61('0x7d')](_0x1c35d8[_0xce61('0x7a')][_0x164512][_0x2700c6[_0x4e5281]][_0xce61('0x89')](/"/g,'\x27'));var _0x2a31c8=phoneDescriptions[_0xce61('0x7b')](_0x138f5b=>_0x138f5b[_0xce61('0x8a')]===_0x13647c['id']);if(!_['isNil'](_0x2a31c8)){var _0x244396=_['trim'](_0x1c35d8[_0xce61('0x7a')][_0x164512][_0x2700c6[_0x2a31c8[_0xce61('0x8b')]]][_0xce61('0x89')](/"/g,'\x27'));if(!_[_0xce61('0x6a')](_0x244396))_0x17a833=_0x17a833+'§'+_0x244396;}if(_0x1f6555=='')_0x1f6555=_0x17a833;else _0x1f6555+='|'+_0x17a833;}_0x52b2ad[_0xce61('0x15')](_0x13647c['id']+':'+_0x1f6555);_0x3de23c[_0x13647c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x57991d[_0xce61('0x15')]('\x22'+_0x52b2ad[_0xce61('0x10')](';')+'\x22');}if(_0x26b8f1[_0xce61('0x14')]){handleError(_0x1c35d8[_0xce61('0x7a')][_0x164512],{'code':_0xce61('0x8c'),'message':_0x26b8f1[_0xce61('0x10')]()});}else{fs['appendFileSync'](_0x43956b,_0x57991d[_0xce61('0x10')]()+'\x0a');}_0x57991d=[];}if(!(stats[_0xce61('0x8d')]%0xc8)){socket['emit'](_0xce61('0x8e')+_0x50d4f2,stats);stats['errors']=[];}}if(stopped){logger[_0xce61('0x55')](_0xce61('0x8f'));_0x108a20[_0xce61('0x90')]();}}catch(_0x4b158a){handleError(_0x1c35d8[_0xce61('0x7a')][_0x164512],{'code':_0xce61('0x91'),'message':_0x4b158a[_0xce61('0x59')]});logger['error'](_0xce61('0x92'),_0x4b158a[_0xce61('0x59')]);}},'complete':function(){try{var _0xe9a59c=[];var _0x4dcf5d=[];var _0x32fb43=_0xce61('0x35');if(_0x319366[_0xce61('0x93')]&&_0x319366[_0xce61('0x93')][_0xce61('0x14')]){_0x32fb43='cm_contacts_'+_0x50d4f2;_0xe9a59c[_0xce61('0x15')](_0xce61('0x94')+_0x32fb43+_0xce61('0x95'));}tmp_campaigns=_0xce61('0x96')+_0x50d4f2;tmp_voice_queues=_0xce61('0x97')+_0x50d4f2;_0x4dcf5d[_0xce61('0x15')](_0xce61('0x94')+tmp_campaigns+_0xce61('0x98'));_0x4dcf5d[_0xce61('0x15')](_0xce61('0x94')+tmp_voice_queues+_0xce61('0x98'));BPromise[_0xce61('0x99')](_0x4dcf5d,handleTZQuery)[_0xce61('0x16')](function(_0x5d64c1){updateTzCampaigns(_0x319366[_0xce61('0x2d')])[_0xce61('0x16')](function(_0x2f443b){updateTzVoiceQueues(_0x319366['ListId'])[_0xce61('0x16')](function(_0x2e5e9a){if(hasTZ)_0x56f463=_0x56f463[_0xce61('0x89')](_0xce61('0x69'),'dialTimezone,utcOffset');var _0x582193=util[_0xce61('0xc')](_0xce61('0x9a'),_0x43956b,_0x32fb43,_0x56f463,_0x319366[_0xce61('0x2d')],_0x319366[_0xce61('0x4f')]||null,NOW,NOW);if(_[_0xce61('0x6a')](_0x2700c6[_0xce61('0x2b')])){_0x582193+=_0xce61('0x9b');}_0xe9a59c['push'](_0x582193);if(_0x319366[_0xce61('0x93')]&&_0x319366[_0xce61('0x93')]['length']){_0xe9a59c[_0xce61('0x15')](insertCmContact(_0x319366['ListId'],_0x32fb43,_0x319366[_0xce61('0x93')],_0x2700c6));_0xe9a59c[_0xce61('0x15')](_0xce61('0x9c')+_0x32fb43+';');}BPromise[_0xce61('0x99')](_0xe9a59c,handleQuery)['then'](function(_0x4bcf4b){BPromise['all']([handleAdditionalPhones()])[_0xce61('0x16')](function(){_0xe9a59c=[];for(var _0x4cbc8d=0x0;_0x4cbc8d\x20\x20','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','../../../config/environment'];(function(_0x5e0e81,_0x31614a){var _0x12cd9c=function(_0x51ec94){while(--_0x51ec94){_0x5e0e81['push'](_0x5e0e81['shift']());}};_0x12cd9c(++_0x31614a);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xd8d7[_0x16629d];return _0x56ccee;};'use strict';var fs=require('fs');var path=require(_0x7d8d('0x0'));var _=require(_0x7d8d('0x1'));var Papa=require(_0x7d8d('0x2'));var util=require(_0x7d8d('0x3'));var BPromise=require(_0x7d8d('0x4'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x7d8d('0x5'));var logger=require('../../../config/logger')(_0x7d8d('0x6'));config[_0x7d8d('0x7')]=_[_0x7d8d('0x8')](config[_0x7d8d('0x7')],{'host':_0x7d8d('0x9'),'port':0x18eb});var socket=require(_0x7d8d('0xa'))(new Redis(config[_0x7d8d('0x7')]));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'](_0x7d8d('0xb'));var tempTableName=_0x7d8d('0xc')+moment()[_0x7d8d('0xd')](_0x7d8d('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x407423){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))*$/[_0x7d8d('0xf')](_0x407423);}function selectNotIn(_0x2a0f33,_0x5aa889,_0x584e0c,_0x2fb7f3,_0xe1ca5f){return squel[_0x7d8d('0x10')]()[_0x7d8d('0x11')]('phone')[_0x7d8d('0x12')](_0x2fb7f3)[_0x7d8d('0x13')](_0x5aa889,null,_0x5aa889+_0x7d8d('0x14')+_0x2fb7f3+'.'+_0x584e0c)[_0x7d8d('0x15')](_0x2fb7f3+'.'+_0x584e0c+_0x7d8d('0x16')+_0x2a0f33+'.'+_0x584e0c)[_0x7d8d('0x15')](_0x5aa889+'.dialCheckDuplicateType\x20IN\x20('+_0xe1ca5f[_0x7d8d('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x97b603,_0x2065c4){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7d8d('0x17')][_0x7d8d('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x7d8d('0x19')](function(_0x5dfb62){if(_0x5dfb62!==null){var _0x4093d4=[];for(var _0x5da663=0x0;_0x5da663<_0x5dfb62[_0x7d8d('0x1a')];_0x5da663++){var _0x3deafd=_0x5dfb62[_0x5da663];if(!_[_0x7d8d('0x1b')](_0x3deafd[_0x7d8d('0x1c')])){if(!_[_0x7d8d('0x1b')](_0x3deafd[_0x7d8d('0x1d')]))_0x4093d4[_0x7d8d('0x1e')](insertAdditionalPhones(_0x3deafd));promisesContact[_0x7d8d('0x1e')]({'contact':_0x3deafd});}}}Promise['all'](_0x4093d4)[_0x7d8d('0x1f')](function(){_0x97b603({'val':0x1});});})[_0x7d8d('0x20')](function(_0x34fca1){logger[_0x7d8d('0x21')](_0x34fca1[_0x7d8d('0x22')]);});});}function insertAdditionalPhones(_0x3db362){return new Promise(function(_0x3b32d3,_0x2b819b){var _0x1cea46=_0x3db362[_0x7d8d('0x1d')];if(_[_0x7d8d('0x1b')](_0x1cea46))_0x2b819b({'val':0x0});else{var _0x153b7c=_0x1cea46[_0x7d8d('0x23')](';');var _0x166104=[];orderBy=0x0;for(var _0x505825=0x0;_0x505825<_0x153b7c['length'];_0x505825++){_0x166104['push'](splitAdditionalPhone(_0x3db362['id'],_0x153b7c[_0x505825]));}Promise[_0x7d8d('0x24')](_0x166104)[_0x7d8d('0x1f')](function(){_0x3b32d3({'val':_0x153b7c[_0x7d8d('0x1a')]});});}});}function splitAdditionalPhone(_0x1fe5e5,_0x43e4d0){return new Promise(function(_0x4e06bd,_0x4fdcb7){var _0x291001=_0x43e4d0[_0x7d8d('0x23')](':');var _0x3d4646=_0x291001[0x0];var _0x3a8cf4=_0x291001[0x1];if(_0x3a8cf4!==''){var _0x11f257=_0x3a8cf4[_0x7d8d('0x23')]('|');var _0x5d8b9e=[];for(var _0x414da4=0x0;_0x414da4<_0x11f257[_0x7d8d('0x1a')];_0x414da4++){if(_0x11f257[_0x414da4]!==''){var _0x23afc4=_[_0x7d8d('0x25')](promisesAdditionalPhones,{'contactId':_0x1fe5e5,'phone':_0x11f257[_0x414da4]});if(_0x23afc4[_0x7d8d('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1fe5e5,'contactTypeId':_0x3d4646,'phone':_0x11f257[_0x414da4],'orderBy':orderBy});}}}_0x4e06bd({'ok':0x1});}else _0x4e06bd({'res':0x0});});}function createAdditionalPhone(_0x5aa8c3,_0x372c00,_0x198f21,_0x26ca36){var _0x49377e='';var _0x18605b='';var _0xadbf05=_0x198f21[_0x7d8d('0x23')]('§');_0x49377e=_0xadbf05[0x0];if(_0xadbf05['length']==0x2)_0x18605b=_0xadbf05[0x1];return new Promise(function(_0xe8c90e,_0x180db1){return db['CmContactHasItem'][_0x7d8d('0x26')]({'where':{'CmContactId':_0x5aa8c3,'item':_0x49377e}})[_0x7d8d('0x1f')](function(_0x3c1fb2){if(_0x3c1fb2){return db[_0x7d8d('0x27')][_0x7d8d('0x28')]({'ItemTypeId':_0x372c00,'description':_0x18605b,'OrderBy':_0x26ca36},{'where':{'CmContactId':_0x5aa8c3,'item':_0x49377e}})['then'](function(_0x47960c){_0xe8c90e({'res':_0x7d8d('0x29')});});}else{return db[_0x7d8d('0x27')]['create']({'CmContactId':_0x5aa8c3,'item':_0x49377e,'ItemTypeId':_0x372c00,'description':_0x18605b,'OrderBy':_0x26ca36,'ItemClass':_0x7d8d('0x2a')})['then'](function(_0x2c8e30){_0xe8c90e({'res':_0x7d8d('0x2b')});});}});});}function updateContact(_0x4df9ef){return new Promise(function(_0x1288ed,_0x1ce6f6){var _0x91b9fa=_0x4df9ef['id'];delete _0x4df9ef['id'];return db[_0x7d8d('0x2c')]['update'](_0x4df9ef,{'where':{'id':_0x91b9fa}})[_0x7d8d('0x1f')](function(_0x55262f){updatedRows+=0x1;return db[_0x7d8d('0x2d')][_0x7d8d('0x28')]({'phone':_0x4df9ef[_0x7d8d('0x1c')]},{'where':{'ContactId':_0x91b9fa}})[_0x7d8d('0x1f')](function(_0x4d8b7c){_0x1288ed({'ret':'OK'});});});});}function insertCmHopper(_0x35e469,_0x4267e2,_0x95ab0c,_0x474f04,_0x7bcba7){var _0x9b6ce4=[_0x7d8d('0x2e'),_0x7d8d('0x2f'),'cm_contacts.id',_0x7d8d('0x30'),_0x4267e2+'.'+_0x474f04,_0x7d8d('0x31'),_0x7d8d('0x32'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x7bcba7+'\x22'];return squel['insert']()[_0x7d8d('0x33')](_0x7d8d('0x34'))[_0x7d8d('0x35')]([_0x7d8d('0x1c'),_0x7d8d('0x36'),'ContactId',_0x7d8d('0x37'),_0x474f04,_0x7d8d('0x38'),'updatedAt',_0x7d8d('0x39'),_0x7d8d('0x3a'),_0x7d8d('0x3b')],squel[_0x7d8d('0x10')]()[_0x7d8d('0x3c')](_0x9b6ce4)[_0x7d8d('0x12')](_0x4267e2)[_0x7d8d('0x13')](_0x7d8d('0x3d'),null,_0x7d8d('0x3e')+_0x4267e2+_0x7d8d('0x3f'))['join'](_0x95ab0c,null,_0x95ab0c+'.id\x20=\x20'+_0x4267e2+'.'+_0x474f04)[_0x7d8d('0x15')](_0x4267e2+'.CmListId\x20=\x20?',_0x35e469)[_0x7d8d('0x15')](_0x7d8d('0x40'),NOW)['where'](_0x7d8d('0x41'),selectNotIn(_0x4267e2,_0x95ab0c,_0x474f04,'cm_hopper',[_0x7d8d('0x42'),'\x22onlyIfOpen\x22']))[_0x7d8d('0x15')](_0x7d8d('0x41'),selectNotIn(_0x4267e2,_0x95ab0c,_0x474f04,_0x7d8d('0x34'),[_0x7d8d('0x42')])))[_0x7d8d('0x43')]();}function insertCmHopperBlack(_0x6dbc57,_0x82f2c9,_0x23828b,_0x214de3){var _0x2c27b3=[_0x7d8d('0x2e'),_0x7d8d('0x44'),_0x7d8d('0x30'),_0x82f2c9+'.'+_0x214de3,_0x7d8d('0x31'),_0x7d8d('0x32')];return squel[_0x7d8d('0x45')]()[_0x7d8d('0x33')](_0x7d8d('0x46'))[_0x7d8d('0x35')]([_0x7d8d('0x1c'),_0x7d8d('0x47'),_0x7d8d('0x37'),_0x214de3,_0x7d8d('0x38'),'updatedAt'],squel[_0x7d8d('0x10')]()[_0x7d8d('0x3c')](_0x2c27b3)[_0x7d8d('0x12')](_0x82f2c9)[_0x7d8d('0x13')]('cm_contacts',null,_0x7d8d('0x3e')+_0x82f2c9+_0x7d8d('0x3f'))['join'](_0x23828b,null,_0x23828b+_0x7d8d('0x14')+_0x82f2c9+'.'+_0x214de3)[_0x7d8d('0x15')](_0x82f2c9+_0x7d8d('0x48'),_0x6dbc57)[_0x7d8d('0x15')](_0x7d8d('0x40'),NOW)['where'](_0x7d8d('0x41'),squel[_0x7d8d('0x10')]()[_0x7d8d('0x11')](_0x7d8d('0x1c'))[_0x7d8d('0x12')]('cm_hopper_black')[_0x7d8d('0x15')]('ListId\x20=\x20?',_0x6dbc57)[_0x7d8d('0x15')](_0x214de3+_0x7d8d('0x49'),_0x82f2c9+'.'+_0x214de3)))[_0x7d8d('0x43')]();}function insertCmHopperAdditionalPhones(_0x1c562a){var _0x19ba28=[_0x7d8d('0x4a'),_0x7d8d('0x4b'),_0x7d8d('0x4c'),_0x7d8d('0x4d'),_0x7d8d('0x4e')];return squel[_0x7d8d('0x45')]()[_0x7d8d('0x33')]('cm_hopper_additional_phones')[_0x7d8d('0x35')](['CmHopperId',_0x7d8d('0x1c'),_0x7d8d('0x4f'),_0x7d8d('0x38'),_0x7d8d('0x50')],squel['select']()[_0x7d8d('0x3c')](_0x19ba28)['from'](_0x7d8d('0x34'))[_0x7d8d('0x13')](_0x7d8d('0x3d'),null,_0x7d8d('0x51'))[_0x7d8d('0x13')](_0x7d8d('0x52'),null,_0x7d8d('0x53'))[_0x7d8d('0x15')](_0x7d8d('0x54'),_0x1c562a)['where'](_0x7d8d('0x40'),NOW))[_0x7d8d('0x43')]();}function insertCmContact(_0x31df6a,_0x1f0e3c,_0x5eda2e,_0x34e9e4){var _0x26d76a=_[_0x7d8d('0x55')](_[_0x7d8d('0x56')](_0x34e9e4),[_0x7d8d('0x37'),_0x7d8d('0x57'),_0x7d8d('0x38'),_0x7d8d('0x50')]);return squel[_0x7d8d('0x45')]()[_0x7d8d('0x33')](_0x7d8d('0x3d'))[_0x7d8d('0x35')](_0x26d76a,squel['select']()[_0x7d8d('0x3c')](_0x26d76a)[_0x7d8d('0x12')](_0x1f0e3c)[_0x7d8d('0x15')]('('+_0x5eda2e[_0x7d8d('0x13')](',')+_0x7d8d('0x58'),squel['select']()[_0x7d8d('0x3c')](_0x5eda2e)[_0x7d8d('0x12')](_0x7d8d('0x3d'))[_0x7d8d('0x15')](_0x7d8d('0x59'),_0x31df6a))[_0x7d8d('0x15')](_0x7d8d('0x5a'),squel['select']()[_0x7d8d('0x11')]('MIN(id)',_0x7d8d('0x5b'))[_0x7d8d('0x12')](_0x1f0e3c)['group'](_0x5eda2e[_0x7d8d('0x13')](','))))[_0x7d8d('0x43')]();}function handleStop(){logger[_0x7d8d('0x5c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4b6a7c){logger[_0x7d8d('0x21')](_0x4b6a7c[_0x7d8d('0x22')]);process[_0x7d8d('0x5d')](0x1);}function handleError(_0x3124ef,_0x160e2e){stats[_0x7d8d('0x5e')][_0x7d8d('0x1e')]({'name':_0x160e2e[_0x7d8d('0x5f')],'message':_0x160e2e[_0x7d8d('0x22')],'row':_0x3124ef});}function handleQuery(_0x5b56ec){logger[_0x7d8d('0x5c')](_0x5b56ec);return db[_0x7d8d('0x17')]['query'](_0x5b56ec)[_0x7d8d('0x19')](function(_0x252fb7){results['push'](_0x252fb7);})[_0x7d8d('0x20')](function(_0x20c87b){logger['error'](_0x20c87b[_0x7d8d('0x22')]);});}function main(_0x294fc9,_0x579a92,_0x5cd31d,_0xc598d0){logger[_0x7d8d('0x5c')]('main',_0x294fc9,JSON[_0x7d8d('0x60')](_0x579a92));process[_0x7d8d('0x61')](_0x7d8d('0x62'));var _0x3f8a43=_0x579a92[_0x7d8d('0x63')];var _0x50a254=_[_0x7d8d('0x64')](_0x3f8a43);var _0x3f166e=_0x579a92[_0x7d8d('0x65')];var _0x12af89=path['join'](config[_0x7d8d('0x66')],_0x7d8d('0x67'),_0x3f166e+_0x7d8d('0x68'));logger[_0x7d8d('0x5c')]('body',_0x579a92);db[_0x7d8d('0x69')][_0x7d8d('0x6a')]({'raw':!![],'attributes':['id','name']})[_0x7d8d('0x1f')](function(_0x26fff5){for(var _0x38cb42=0x0;_0x38cb42<_0x26fff5[_0x7d8d('0x1a')];_0x38cb42++){if(_0x26fff5[_0x38cb42]['name']in _0x3f8a43){contactItemTypes[_0x7d8d('0x1e')](_0x26fff5[_0x38cb42]);delete _0x50a254[_0x26fff5[_0x38cb42][_0x7d8d('0x6b')]];hasAdditionalPhones=!![];}for(var _0x178d98 in _0x3f8a43){if(_0x26fff5[_0x38cb42][_0x7d8d('0x6b')]+_0x7d8d('0x6c')===_0x178d98){phoneDescriptions[_0x7d8d('0x1e')]({'itemTypeId':_0x26fff5[_0x38cb42]['id'],'description':_0x178d98});delete _0x50a254[_0x178d98];}}}if(hasAdditionalPhones)_0x50a254[_0x7d8d('0x1d')]='';var _0x24402a=_[_0x7d8d('0x56')](_0x50a254)[_0x7d8d('0x13')]();logger[_0x7d8d('0x5c')](_0x7d8d('0x6d'),_0x24402a);fs[_0x7d8d('0x6e')](_0x12af89,_0x24402a+'\x0a');Papa[_0x7d8d('0x6f')](fs['createReadStream'](_0x294fc9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c4975,_0x3f5e87){try{for(var _0x40d351=0x0,_0x34a0cb=[];_0x40d351<_0x3c4975[_0x7d8d('0x70')][_0x7d8d('0x1a')];_0x40d351++){stats[_0x7d8d('0x71')]+=0x1;if(_0x3c4975[_0x7d8d('0x5e')][_0x40d351]){handleError(_0x3c4975[_0x7d8d('0x70')][_0x40d351],_0x3c4975['errors'][_0x40d351]);}else{var _0x41b994=[];var _0x4c9adc=[];var _0x1fa6ad={};for(var _0x5a3e3b in _0x3f8a43){let _0x297621=contactItemTypes[_0x7d8d('0x72')](_0x373b8c=>_0x373b8c['name']===_0x5a3e3b);let _0x3a82ef=contactItemTypes[_0x7d8d('0x72')](_0x5080ba=>_0x5080ba['name']+'_description'===_0x5a3e3b);if(_[_0x7d8d('0x1b')](_0x297621)&&_[_0x7d8d('0x1b')](_0x3a82ef)){if(_0x3f8a43[_0x7d8d('0x73')](_0x5a3e3b)){if(_0x3c4975[_0x7d8d('0x70')][_0x40d351][_0x3f8a43[_0x5a3e3b]]){var _0x219825=_[_0x7d8d('0x74')](_0x3c4975[_0x7d8d('0x70')][_0x40d351][_0x3f8a43[_0x5a3e3b]]['replace'](/"/g,'\x27'));switch(_0x5a3e3b){case'scheduledat':var _0x4f570e=moment(_0x219825,_0x7d8d('0xb'),!![]);if(_0x4f570e[_0x7d8d('0x75')]()){_0x34a0cb[_0x7d8d('0x1e')]('\x22'+_0x219825+'\x22');}else{_0x41b994[_0x7d8d('0x1e')](_0x7d8d('0x76'));}break;case _0x7d8d('0x39'):var _0x2fb415=parseInt(_0x219825);_0x219825=_['isNaN'](_0x2fb415)||_0x2fb415<0x0||_0x2fb415>0x4?_0xc598d0?0x3:0x2:_0x2fb415;_0x34a0cb[_0x7d8d('0x1e')]('\x22'+_0x219825+'\x22');break;case _0x7d8d('0x3a'):var _0x24c7e0=parseInt(_0x219825);if(_[_0x7d8d('0x77')](_0x24c7e0)&&_[_0x7d8d('0x78')](_0x5cd31d,_0x24c7e0)){_0x34a0cb['push']('\x22'+_0x24c7e0+'\x22');}else{_0x41b994[_0x7d8d('0x1e')](_0x7d8d('0x79'));}break;case _0x7d8d('0x7a'):if(isEmail(_0x219825)){_0x34a0cb[_0x7d8d('0x1e')]('\x22'+_0x219825+'\x22');}else{_0x41b994[_0x7d8d('0x1e')](_0x7d8d('0x7b'));}break;case _0x7d8d('0x7c'):var _0x39b2c0=moment(_0x219825,_0x7d8d('0x7d'),!![]);if(_0x39b2c0[_0x7d8d('0x75')]()){_0x34a0cb['push']('\x22'+_0x219825+'\x22');}else{_0x41b994[_0x7d8d('0x1e')](_0x7d8d('0x7e'));}break;default:_0x34a0cb[_0x7d8d('0x1e')]('\x22'+_0x219825+'\x22');}}else{switch(_0x5a3e3b){case'firstName':case _0x7d8d('0x1c'):_0x41b994[_0x7d8d('0x1e')](_0x5a3e3b+_0x7d8d('0x7f'));break;default:_0x34a0cb['push']('\x22\x22');}}}}else{var _0x5287c9='';if(!_[_0x7d8d('0x1b')](_0x297621)){if(!_0x1fa6ad[_0x7d8d('0x73')](_0x297621['id'])){for(var _0x4c81a5=0x0;_0x4c81a5<_0x3f8a43[_0x5a3e3b]['length'];_0x4c81a5++){var _0x219825=_[_0x7d8d('0x74')](_0x3c4975[_0x7d8d('0x70')][_0x40d351][_0x3f8a43[_0x5a3e3b][_0x4c81a5]][_0x7d8d('0x80')](/"/g,'\x27'));var _0x5054c4=phoneDescriptions[_0x7d8d('0x72')](_0x55eaef=>_0x55eaef[_0x7d8d('0x81')]===_0x297621['id']);if(!_['isNil'](_0x5054c4)){var _0x437bb3=_['trim'](_0x3c4975[_0x7d8d('0x70')][_0x40d351][_0x3f8a43[_0x5054c4[_0x7d8d('0x82')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x7d8d('0x1b')](_0x437bb3))_0x219825=_0x219825+'§'+_0x437bb3;}if(_0x5287c9=='')_0x5287c9=_0x219825;else _0x5287c9+='|'+_0x219825;}_0x4c9adc['push'](_0x297621['id']+':'+_0x5287c9);_0x1fa6ad[_0x297621['id']]=0x1;}}}}if(hasAdditionalPhones){_0x34a0cb[_0x7d8d('0x1e')]('\x22'+_0x4c9adc[_0x7d8d('0x13')](';')+'\x22');}if(_0x41b994[_0x7d8d('0x1a')]){handleError(_0x3c4975['data'][_0x40d351],{'code':_0x7d8d('0x83'),'message':_0x41b994['join']()});}else{fs[_0x7d8d('0x84')](_0x12af89,_0x34a0cb[_0x7d8d('0x13')]()+'\x0a');}_0x34a0cb=[];}if(!(stats[_0x7d8d('0x71')]%0xc8)){socket['emit'](_0x7d8d('0x85')+_0x3f166e,stats);stats[_0x7d8d('0x5e')]=[];}}if(stopped){logger[_0x7d8d('0x5c')]('Abort\x20parser');_0x3f5e87[_0x7d8d('0x86')]();}}catch(_0x3563b5){handleError(_0x3c4975[_0x7d8d('0x70')][_0x40d351],{'code':_0x7d8d('0x87'),'message':_0x3563b5[_0x7d8d('0x22')]});logger[_0x7d8d('0x21')](_0x7d8d('0x88'),_0x3563b5[_0x7d8d('0x22')]);}},'complete':function(){try{var _0x77384a=[];var _0x3a1697=tempTableName;_0x77384a['push'](_0x7d8d('0x89')+_0x3a1697+'\x20LIKE\x20cm_contacts;');logger[_0x7d8d('0x5c')](_0x7d8d('0x8a'),contactItemTypes[_0x7d8d('0x1a')]);var _0x11bac9=util[_0x7d8d('0xd')](_0x7d8d('0x8b'),_0x12af89,_0x3a1697,_0x24402a,_0x579a92[_0x7d8d('0x37')],_0x579a92[_0x7d8d('0x57')]||null,NOW,NOW);if(_['isNil'](_0x3f8a43[_0x7d8d('0x36')])){_0x11bac9+=',\x20scheduledAt\x20=\x20NOW()';}_0x77384a[_0x7d8d('0x1e')](_0x11bac9);BPromise['each'](_0x77384a,handleQuery)[_0x7d8d('0x1f')](function(_0x5cb33b){BPromise[_0x7d8d('0x24')]([handleAdditionalPhones()])[_0x7d8d('0x1f')](function(){_0x77384a=[];for(var _0x1a64e=0x0;_0x1a64e_0x5f2df5[_0x34ad('0x6c')]===_0x972c0b);let _0x120d34=contactItemTypes['find'](_0x41b9b4=>_0x41b9b4['name']+'_description'===_0x972c0b);if(_['isNil'](_0x2b135f)&&_['isNil'](_0x120d34)){if(_0x3e5283[_0x34ad('0x72')](_0x972c0b)){if(_0x5c49fd[_0x34ad('0x71')][_0x22e07f][_0x3e5283[_0x972c0b]]){var _0x3d8d15=_['trim'](_0x5c49fd[_0x34ad('0x71')][_0x22e07f][_0x3e5283[_0x972c0b]][_0x34ad('0x73')](/"/g,'\x27'));switch(_0x972c0b){case _0x34ad('0x74'):var _0x503c6b=moment(_0x3d8d15,_0x34ad('0xf'),!![]);if(_0x503c6b['isValid']()){_0x198019[_0x34ad('0x22')]('\x22'+_0x3d8d15+'\x22');}else{_0x480065[_0x34ad('0x22')](_0x34ad('0x75'));}break;case'priority':var _0x13ebfd=parseInt(_0x3d8d15);_0x3d8d15=_[_0x34ad('0x76')](_0x13ebfd)||_0x13ebfd<0x0||_0x13ebfd>0x4?_0x2daf87?0x3:0x2:_0x13ebfd;_0x198019['push']('\x22'+_0x3d8d15+'\x22');break;case'UserId':var _0xe7f218=parseInt(_0x3d8d15);if(_[_0x34ad('0x77')](_0xe7f218)&&_['includes'](_0x518971,_0xe7f218)){_0x198019[_0x34ad('0x22')]('\x22'+_0xe7f218+'\x22');}else{_0x480065[_0x34ad('0x22')](_0x34ad('0x78'));}break;case _0x34ad('0x79'):if(isEmail(_0x3d8d15)){_0x198019[_0x34ad('0x22')]('\x22'+_0x3d8d15+'\x22');}else{_0x480065[_0x34ad('0x22')](_0x34ad('0x7a'));}break;case'dateOfBirth':var _0x4e8b31=moment(_0x3d8d15,_0x34ad('0x7b'),!![]);if(_0x4e8b31[_0x34ad('0x7c')]()){_0x198019[_0x34ad('0x22')]('\x22'+_0x3d8d15+'\x22');}else{_0x480065[_0x34ad('0x22')](_0x34ad('0x7d'));}break;default:_0x198019['push']('\x22'+_0x3d8d15+'\x22');}}else{switch(_0x972c0b){case _0x34ad('0x7e'):case'phone':_0x480065[_0x34ad('0x22')](_0x972c0b+_0x34ad('0x7f'));break;default:_0x198019[_0x34ad('0x22')]('\x22\x22');}}}}else{var _0x25841b='';if(!_[_0x34ad('0x20')](_0x2b135f)){if(!_0x2c9cc8[_0x34ad('0x72')](_0x2b135f['id'])){for(var _0x26bd92=0x0;_0x26bd92<_0x3e5283[_0x972c0b][_0x34ad('0x28')];_0x26bd92++){var _0x3d8d15=_[_0x34ad('0x80')](_0x5c49fd[_0x34ad('0x71')][_0x22e07f][_0x3e5283[_0x972c0b][_0x26bd92]][_0x34ad('0x73')](/"/g,'\x27'));var _0x237e6b=phoneDescriptions[_0x34ad('0x81')](_0x2eaa9b=>_0x2eaa9b['itemTypeId']===_0x2b135f['id']);if(!_[_0x34ad('0x20')](_0x237e6b)){var _0x57a860=_['trim'](_0x5c49fd[_0x34ad('0x71')][_0x22e07f][_0x3e5283[_0x237e6b[_0x34ad('0x82')]][0x0]][_0x34ad('0x73')](/"/g,'\x27'));if(!_[_0x34ad('0x20')](_0x57a860))_0x3d8d15=_0x3d8d15+'§'+_0x57a860;}if(_0x25841b=='')_0x25841b=_0x3d8d15;else _0x25841b+='|'+_0x3d8d15;}_0x4e7009[_0x34ad('0x22')](_0x2b135f['id']+':'+_0x25841b);_0x2c9cc8[_0x2b135f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x198019[_0x34ad('0x22')]('\x22'+_0x4e7009[_0x34ad('0x18')](';')+'\x22');}if(_0x480065[_0x34ad('0x28')]){handleError(_0x5c49fd[_0x34ad('0x71')][_0x22e07f],{'code':_0x34ad('0x83'),'message':_0x480065[_0x34ad('0x18')]()});}else{fs[_0x34ad('0x84')](_0x277d12,_0x198019['join']()+'\x0a');}_0x198019=[];}if(!(stats[_0x34ad('0x85')]%0xc8)){socket['emit']('contact:import:'+_0x1a4c89,stats);stats[_0x34ad('0x70')]=[];}}if(stopped){logger[_0x34ad('0x61')](_0x34ad('0x86'));_0x34f91d[_0x34ad('0x87')]();}}catch(_0x1f0cc5){handleError(_0x5c49fd[_0x34ad('0x71')][_0x22e07f],{'code':_0x34ad('0x88'),'message':_0x1f0cc5['message']});logger[_0x34ad('0x25')]('step',_0x1f0cc5['message']);}},'complete':function(){try{var _0x4498f3=[];var _0x554c90=tempTableName;_0x4498f3['push'](_0x34ad('0x89')+_0x554c90+_0x34ad('0x8a'));logger[_0x34ad('0x61')](_0x34ad('0x8b'),contactItemTypes[_0x34ad('0x28')]);var _0x55c7f3=util[_0x34ad('0x11')](_0x34ad('0x8c'),_0x277d12,_0x554c90,_0x187cf6,_0x121d36[_0x34ad('0x40')],_0x121d36[_0x34ad('0x5c')]||null,NOW,NOW);if(_[_0x34ad('0x20')](_0x3e5283[_0x34ad('0x74')])){_0x55c7f3+=',\x20scheduledAt\x20=\x20NOW()';}_0x4498f3[_0x34ad('0x22')](_0x55c7f3);BPromise['each'](_0x4498f3,handleQuery)[_0x34ad('0x23')](function(_0x35b4f6){BPromise['all']([handleAdditionalPhones()])[_0x34ad('0x23')](function(){_0x4498f3=[];for(var _0x1ea612=0x0;_0x1ea612\x20\x20');}var _0x175dbc=path[_0x34ad('0x18')](config[_0x34ad('0x68')],_0x34ad('0x69'),process[_0x34ad('0x97')][0x2]);if(!fs[_0x34ad('0x98')](_0x175dbc)){throw new Error(_0x34ad('0x99'));}var _0x30634={};try{_0x30634=JSON[_0x34ad('0x6f')](process['argv'][0x3]);if(!_0x30634[_0x34ad('0x65')]){throw new Error(_0x34ad('0x9a'));}var _0x4788b6=0x0;if(_0x30634[_0x34ad('0x65')][_0x34ad('0x44')]){_0x4788b6=0x1;}if(!_0x30634[_0x34ad('0x40')]){throw new Error(_0x34ad('0x9b'));}}catch(_0x51a1ed){throw new Error(_0x34ad('0x9c'));}var _0x3ee950=[];try{_0x3ee950=_[_0x34ad('0x9d')](JSON[_0x34ad('0x6f')](process[_0x34ad('0x97')][0x4]),'id');}catch(_0x441b3c){logger['info'](_0x34ad('0x9e'));}main(_0x175dbc,_0x30634,_0x3ee950,_0x4788b6);}validate();process['on']('SIGINT',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 cd71cff..5452af7 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 _0x3e8f=['keyValue','calleridnum','Caller\x20Name','destexten','Queue','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','membername','starttime','answertime','Complete\x20Time','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','inbound'];(function(_0x53106d,_0x127ea1){var _0x1c4ac0=function(_0x520486){while(--_0x520486){_0x53106d['push'](_0x53106d['shift']());}};_0x1c4ac0(++_0x127ea1);}(_0x3e8f,0x11a));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0xf3e8('0x0')]=function(_0x145082,_0x869ce){var _0x3b1fdf=[{'type':_0xf3e8('0x1'),'content':_0xf3e8('0x2'),'variableName':null}];switch(_0x145082[_0xf3e8('0x3')]()){case _0xf3e8('0x4'):switch(_0x869ce[_0xf3e8('0x3')]()){case'inbound':_0x3b1fdf[_0xf3e8('0x5')]({'type':_0xf3e8('0x6'),'content':'','variableName':_0xf3e8('0x7')});_0x3b1fdf[_0xf3e8('0x5')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0xf3e8('0x8'):_0x3b1fdf['push']({'type':_0xf3e8('0x1'),'content':_0xf3e8('0x9'),'variableName':null});_0x3b1fdf[_0xf3e8('0x5')]({'type':'variable','content':'','variableName':_0xf3e8('0xa')});break;}}return _0x3b1fdf;};exports['getDescriptions']=function(_0x3a8d29,_0x4dea8d){var _0x33bdf0=[];switch(_0x3a8d29[_0xf3e8('0x3')]()){case'voice':switch(_0x4dea8d['toLowerCase']()){case _0xf3e8('0xb'):_0x33bdf0=[{'type':_0xf3e8('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf3e8('0xc'),'content':'','key':'Caller\x20Number','keyType':_0xf3e8('0x6'),'variableName':_0xf3e8('0xd')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0xe'),'keyType':'variable','variableName':'calleridname'},{'type':_0xf3e8('0xc'),'content':'','key':'Call\x20To','keyType':_0xf3e8('0x6'),'variableName':_0xf3e8('0xf')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x10'),'keyType':_0xf3e8('0x6'),'variableName':_0xf3e8('0x7')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x11'),'keyType':'variable','variableName':_0xf3e8('0x12')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x13'),'keyType':_0xf3e8('0x6'),'variableName':'agentcalledAt'},{'type':_0xf3e8('0x1'),'content':_0xf3e8('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x15'),'keyType':_0xf3e8('0x6'),'variableName':'destcalleridname'},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x16'),'keyType':_0xf3e8('0x6'),'variableName':_0xf3e8('0xa')},{'type':'string','content':_0xf3e8('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x18'),'keyType':_0xf3e8('0x6'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xf3e8('0x19'),'keyType':_0xf3e8('0x6'),'variableName':_0xf3e8('0x1a')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x1b'),'keyType':_0xf3e8('0x6'),'variableName':_0xf3e8('0x1c')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x1d'),'keyType':_0xf3e8('0x6'),'variableName':_0xf3e8('0x1e')},{'type':'keyValue','content':'','key':_0xf3e8('0x1f'),'keyType':'variable','variableName':_0xf3e8('0x20')}];break;case'outbound':_0x33bdf0=[{'type':_0xf3e8('0x1'),'content':_0xf3e8('0x21'),'variableName':null},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x22'),'keyType':_0xf3e8('0x6'),'keyContent':'','variableName':_0xf3e8('0xa')},{'type':_0xf3e8('0xc'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0xf3e8('0x23')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x11'),'keyType':_0xf3e8('0x6'),'keyContent':'','variableName':_0xf3e8('0x12')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x13'),'keyType':_0xf3e8('0x6'),'keyContent':'','variableName':_0xf3e8('0x24')},{'type':_0xf3e8('0x1'),'content':_0xf3e8('0x17')},{'type':_0xf3e8('0xc'),'content':'','key':'Answer\x20Time','keyType':_0xf3e8('0x6'),'keyContent':'','variableName':_0xf3e8('0x25')},{'type':_0xf3e8('0xc'),'content':'','key':_0xf3e8('0x26'),'keyType':_0xf3e8('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xf3e8('0xc'),'content':'','key':'Duration','keyType':_0xf3e8('0x6'),'keyContent':'','variableName':_0xf3e8('0x27')},{'type':'keyValue','content':'','key':_0xf3e8('0x28'),'keyType':_0xf3e8('0x6'),'keyContent':'','variableName':_0xf3e8('0x29')}];break;}}return _0x33bdf0;}; \ No newline at end of file +var _0x8b4f=['voice','variable','queue','push','calleridnum','outbound','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','uniqueid','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase'];(function(_0x9739a4,_0x59582d){var _0x5a4b48=function(_0x471699){while(--_0x471699){_0x9739a4['push'](_0x9739a4['shift']());}};_0x5a4b48(++_0x59582d);}(_0x8b4f,0x104));var _0xf8b4=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x8b4f[_0x340380];return _0x49ce1c;};'use strict';exports[_0xf8b4('0x0')]=function(_0x3f3fe7,_0x4fc20b){var _0x178328=[{'type':_0xf8b4('0x1'),'content':_0xf8b4('0x2'),'variableName':null}];switch(_0x3f3fe7[_0xf8b4('0x3')]()){case _0xf8b4('0x4'):switch(_0x4fc20b[_0xf8b4('0x3')]()){case'inbound':_0x178328['push']({'type':_0xf8b4('0x5'),'content':'','variableName':_0xf8b4('0x6')});_0x178328[_0xf8b4('0x7')]({'type':_0xf8b4('0x5'),'content':'','variableName':_0xf8b4('0x8')});break;case _0xf8b4('0x9'):_0x178328[_0xf8b4('0x7')]({'type':_0xf8b4('0x1'),'content':'Outbound\x20Call','variableName':null});_0x178328[_0xf8b4('0x7')]({'type':_0xf8b4('0x5'),'content':'','variableName':_0xf8b4('0xa')});break;}}return _0x178328;};exports[_0xf8b4('0xb')]=function(_0x33842e,_0x1ef725){var _0x24cac5=[];switch(_0x33842e['toLowerCase']()){case _0xf8b4('0x4'):switch(_0x1ef725[_0xf8b4('0x3')]()){case _0xf8b4('0xc'):_0x24cac5=[{'type':_0xf8b4('0x1'),'content':_0xf8b4('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0xf'),'keyType':_0xf8b4('0x5'),'variableName':_0xf8b4('0x8')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x10'),'keyType':'variable','variableName':'calleridname'},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x11'),'keyType':_0xf8b4('0x5'),'variableName':_0xf8b4('0x12')},{'type':_0xf8b4('0xe'),'content':'','key':'Queue','keyType':_0xf8b4('0x5'),'variableName':_0xf8b4('0x6')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':_0xf8b4('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0xf8b4('0x5'),'variableName':_0xf8b4('0x14')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x15'),'keyType':'variable','variableName':_0xf8b4('0x16')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x17'),'keyType':_0xf8b4('0x5'),'variableName':'destcalleridnum'},{'type':_0xf8b4('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x18'),'keyType':'variable','variableName':_0xf8b4('0x14')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x19'),'keyType':_0xf8b4('0x5'),'variableName':_0xf8b4('0x1a')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x1b'),'keyType':'variable','variableName':_0xf8b4('0x1c')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x1d'),'keyType':_0xf8b4('0x5'),'variableName':_0xf8b4('0x1e')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x1f'),'keyType':_0xf8b4('0x5'),'variableName':_0xf8b4('0x20')}];break;case _0xf8b4('0x9'):_0x24cac5=[{'type':_0xf8b4('0x1'),'content':_0xf8b4('0xd'),'variableName':null},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x21'),'keyType':_0xf8b4('0x5'),'keyContent':'','variableName':_0xf8b4('0xa')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x22'),'keyType':_0xf8b4('0x5'),'keyContent':'','variableName':_0xf8b4('0x23')},{'type':'keyValue','content':'','key':_0xf8b4('0x24'),'keyType':_0xf8b4('0x5'),'keyContent':'','variableName':_0xf8b4('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xf8b4('0x25')},{'type':_0xf8b4('0x1'),'content':_0xf8b4('0x26')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x27'),'keyType':_0xf8b4('0x5'),'keyContent':'','variableName':_0xf8b4('0x28')},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x29'),'keyType':_0xf8b4('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0xf8b4('0xe'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0xf8b4('0xe'),'content':'','key':_0xf8b4('0x2a'),'keyType':'variable','keyContent':'','variableName':_0xf8b4('0x2b')}];break;}}return _0x24cac5;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 6c61f7a..6723e47 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 _0xa920=['catch','error','user','query','clone','body','html','fax','lodash','../../config/logger','mail-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','toUpperCase','name','role','null','then','update'];(function(_0x54f5a8,_0x18b8f9){var _0x18dff1=function(_0x8e4b92){while(--_0x8e4b92){_0x54f5a8['push'](_0x54f5a8['shift']());}};_0x18dff1(++_0x18b8f9);}(_0xa920,0x110));var _0x0a92=function(_0x3226ef,_0x43a491){_0x3226ef=_0x3226ef-0x0;var _0x494c4c=_0xa920[_0x3226ef];return _0x494c4c;};'use strict';var _=require(_0x0a92('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x0a92('0x1'))('openchannel-interactions'),'mail':require(_0x0a92('0x1'))(_0x0a92('0x2')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x0a92('0x3')),'chat':require(_0x0a92('0x1'))('chat-interactions'),'whatsapp':require(_0x0a92('0x1'))(_0x0a92('0x4'))};function getInteractionId(_0xd32f3b,_0x47b5de,_0x1e3043){if(_0xd32f3b&&_0xd32f3b[_[_0x0a92('0x5')](_0x1e3043)+_0x0a92('0x6')]){return _0xd32f3b[_['upperFirst'](_0x1e3043)+_0x0a92('0x6')];}else if(_0xd32f3b&&_0xd32f3b['id']){return _0xd32f3b['id'];}else if(_0x47b5de&&_0x47b5de['id']){return _0x47b5de['id'];}else{return'unknown';}}function log(_0x1ea229,_0x1e1144,_0x14018c,_0x40c6df,_0x41524c,_0x3a83a4){loggers[_0x41524c[_0x0a92('0x7')]()][_0x1ea229]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a83a4[_0x0a92('0x8')](),_0x1e1144?_0x1e1144['id']:null,_0x1e1144?_0x1e1144[_0x0a92('0x9')]:null,_0x1e1144?_0x1e1144[_0x0a92('0xa')]:null,getInteractionId(_0x14018c,_0x40c6df,_0x41524c),_0x14018c?JSON['stringify'](_0x14018c):_0x0a92('0xb'));}function updateUser(_0x1c19fe,_0x5c5bb7,_0x530639,_0x19cf28,_0x27b7b5){db[_[_0x0a92('0x5')](_0x19cf28)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x5c5bb7,_0x530639,_0x19cf28)}})[_0x0a92('0xc')](function(_0x3bb600){if(_0x3bb600){return _0x3bb600[_0x0a92('0xd')]({'UserId':_0x1c19fe?_0x1c19fe['id']:null});}})[_0x0a92('0xc')](function(_0x1b9ad0){if(_0x1b9ad0){log('info',_0x1c19fe,_0x5c5bb7,_0x530639,_0x19cf28,_0x27b7b5);}})[_0x0a92('0xe')](function(){log(_0x0a92('0xf'),_0x1c19fe,_0x5c5bb7,_0x530639,_0x19cf28,_0x27b7b5);});}exports['tracked']=function(_0x3f2c1d,_0x406fbb){return function(_0x27e92d,_0x4517c4,_0x19447f){var _0x21a90e=_0x27e92d[_0x0a92('0x10')];var _0x5cff1b={};var _0x29711b=_0x27e92d[_0x0a92('0x11')];if(_0x5cff1b){_0x5cff1b=_[_0x0a92('0x12')](_0x27e92d[_0x0a92('0x13')]);_0x5cff1b=_['omit'](_0x5cff1b,[_0x0a92('0x13'),_0x0a92('0x14'),'phone',_0x0a92('0x15'),'mobile']);}updateUser(_0x21a90e,_0x5cff1b,_0x29711b,_0x3f2c1d,_0x406fbb);_0x19447f(null);};}; \ No newline at end of file +var _0x1258=['mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','Interaction','then','update','info','catch','user','query','clone','omit','body','html','phone','fax'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x1258,0x1a1));var _0x8125=function(_0xe26b66,_0x395cfe){_0xe26b66=_0xe26b66-0x0;var _0x19b00b=_0x1258[_0xe26b66];return _0x19b00b;};'use strict';var _=require(_0x8125('0x0'));var db=require(_0x8125('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x8125('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x8125('0x3'))(_0x8125('0x4')),'sms':require(_0x8125('0x3'))(_0x8125('0x5')),'chat':require(_0x8125('0x3'))(_0x8125('0x6')),'whatsapp':require(_0x8125('0x3'))(_0x8125('0x7'))};function getInteractionId(_0x2729e5,_0x1287ab,_0x483ffa){if(_0x2729e5&&_0x2729e5[_[_0x8125('0x8')](_0x483ffa)+'InteractionId']){return _0x2729e5[_[_0x8125('0x8')](_0x483ffa)+'InteractionId'];}else if(_0x2729e5&&_0x2729e5['id']){return _0x2729e5['id'];}else if(_0x1287ab&&_0x1287ab['id']){return _0x1287ab['id'];}else{return'unknown';}}function log(_0x4cd99a,_0x30bd89,_0x4697f5,_0xabda0e,_0x47c343,_0x3719e0){loggers[_0x47c343['toLowerCase']()][_0x4cd99a](_0x8125('0x9'),_0x3719e0['toUpperCase'](),_0x30bd89?_0x30bd89['id']:null,_0x30bd89?_0x30bd89['name']:null,_0x30bd89?_0x30bd89[_0x8125('0xa')]:null,getInteractionId(_0x4697f5,_0xabda0e,_0x47c343),_0x4697f5?JSON['stringify'](_0x4697f5):_0x8125('0xb'));}function updateUser(_0x4c9971,_0x97f41a,_0xb2c211,_0x31e096,_0x5fc91b){db[_['upperFirst'](_0x31e096)+_0x8125('0xc')]['findOne']({'where':{'id':getInteractionId(_0x97f41a,_0xb2c211,_0x31e096)}})[_0x8125('0xd')](function(_0x4ef201){if(_0x4ef201){return _0x4ef201[_0x8125('0xe')]({'UserId':_0x4c9971?_0x4c9971['id']:null});}})[_0x8125('0xd')](function(_0x3f47c5){if(_0x3f47c5){log(_0x8125('0xf'),_0x4c9971,_0x97f41a,_0xb2c211,_0x31e096,_0x5fc91b);}})[_0x8125('0x10')](function(){log('error',_0x4c9971,_0x97f41a,_0xb2c211,_0x31e096,_0x5fc91b);});}exports['tracked']=function(_0x44ba35,_0x53ba19){return function(_0x369192,_0xe125ff,_0x445fe2){var _0x587a3d=_0x369192[_0x8125('0x11')];var _0x3a49c1={};var _0x4f59dc=_0x369192[_0x8125('0x12')];if(_0x3a49c1){_0x3a49c1=_[_0x8125('0x13')](_0x369192['body']);_0x3a49c1=_[_0x8125('0x14')](_0x3a49c1,[_0x8125('0x15'),_0x8125('0x16'),_0x8125('0x17'),_0x8125('0x18'),_0x8125('0x19')]);}updateUser(_0x587a3d,_0x3a49c1,_0x4f59dc,_0x44ba35,_0x53ba19);_0x445fe2(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 52d7975..31aa5a3 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 _0x14dc=['admin','isUserLimit','util','../../mysqldb','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User'];(function(_0x5a8f89,_0x5c5369){var _0x24dfe6=function(_0x14d924){while(--_0x14d924){_0x5a8f89['push'](_0x5a8f89['shift']());}};_0x24dfe6(++_0x5c5369);}(_0x14dc,0x15b));var _0xc14d=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x14dc[_0x45d55e];return _0x29812a;};'use strict';var crypto=require('crypto');var util=require(_0xc14d('0x0'));var compose=require('composable-middleware');var db=require(_0xc14d('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3ab35c,_0x312b00){if(_0x3ab35c&&_0x312b00){if(_0x312b00['data1']&&_0x312b00['license']){var _0x36fb2f=_0x312b00[_0xc14d('0x2')];var _0x3174a5=_0x312b00['license'];var _0x17d2f3=_0x36fb2f[_0xc14d('0x3')]('-')[0x4];var _0x2cdb28=_0x36fb2f[_0xc14d('0x3')]('-')[0x0];var _0x4b5cf9=crypto[_0xc14d('0x4')](_0xc14d('0x5'),util['format'](_0xc14d('0x6'),_0x17d2f3,_0x36fb2f,_0x2cdb28));var _0x50668a=_0x4b5cf9['update'](_0x3174a5,_0xc14d('0x7'),_0xc14d('0x8'));_0x50668a+=_0x4b5cf9[_0xc14d('0x9')](_0xc14d('0x8'));var _0x106054=JSON[_0xc14d('0xa')](_0x50668a);return _0x106054[_0xc14d('0xb')](_0x3ab35c)?_0x106054[_0x3ab35c]:null;}}return null;}function isLimit(_0x9a7d23,_0x174bd4,_0xa1748a,_0x391300){var _0x37e19f=_0x174bd4;return compose()[_0xc14d('0xc')](function(_0x318186,_0x1d3d59,_0x3a5cc6){return db['License'][_0xc14d('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xc14d('0xe')](function(_0x1e7e6e){var _0x511442=getValueFromLicense(_0x9a7d23,_0x1e7e6e);return _0x511442?_0x511442:_0x37e19f;})[_0xc14d('0xe')](function(_0x2ad8ab){_0x37e19f=_0x2ad8ab;return _0xa1748a[_0xc14d('0xf')](_0x391300);})[_0xc14d('0xe')](function(_0x1e66b6){if(_0x1e66b6>=_0x37e19f){return _0x1d3d59[_0xc14d('0x10')](0x193)['json']({'message':util[_0xc14d('0x11')](_0xc14d('0x12'),_0x9a7d23)});}_0x3a5cc6();})['catch'](function(_0x231274){_0x3a5cc6(_0x231274);});});}function isUserLimit(){return isLimit(_0xc14d('0x13'),0x1,db[_0xc14d('0x14')],{'where':{'$or':[{'role':_0xc14d('0x15')},{'role':'user'}]}});}exports[_0xc14d('0x16')]=isUserLimit; \ No newline at end of file +var _0x1827=['%s:%s:%s','update','base64','final','utf8','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','data1','license','split','aes-256-ctr','format'];(function(_0x36da00,_0x5b533b){var _0x4b72c5=function(_0x46e26b){while(--_0x46e26b){_0x36da00['push'](_0x36da00['shift']());}};_0x4b72c5(++_0x5b533b);}(_0x1827,0x75));var _0x7182=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x1827[_0x2e4aa2];return _0x5e6092;};'use strict';var crypto=require(_0x7182('0x0'));var util=require('util');var compose=require(_0x7182('0x1'));var db=require(_0x7182('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2569e1,_0x2fb42d){if(_0x2569e1&&_0x2fb42d){if(_0x2fb42d[_0x7182('0x3')]&&_0x2fb42d[_0x7182('0x4')]){var _0x19915e=_0x2fb42d[_0x7182('0x3')];var _0xc3ebac=_0x2fb42d[_0x7182('0x4')];var _0x1eb792=_0x19915e['split']('-')[0x4];var _0xe78498=_0x19915e[_0x7182('0x5')]('-')[0x0];var _0x90aee9=crypto['createDecipher'](_0x7182('0x6'),util[_0x7182('0x7')](_0x7182('0x8'),_0x1eb792,_0x19915e,_0xe78498));var _0x5b04c9=_0x90aee9[_0x7182('0x9')](_0xc3ebac,_0x7182('0xa'),'utf8');_0x5b04c9+=_0x90aee9[_0x7182('0xb')](_0x7182('0xc'));var _0x368748=JSON['parse'](_0x5b04c9);return _0x368748['hasOwnProperty'](_0x2569e1)?_0x368748[_0x2569e1]:null;}}return null;}function isLimit(_0xf6b663,_0x5c22d8,_0x1f2061,_0x994ac8){var _0x51965a=_0x5c22d8;return compose()['use'](function(_0x308033,_0x4d40d2,_0x2ecf08){return db[_0x7182('0xd')][_0x7182('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x7182('0xf')](function(_0x214e6b){var _0x2e0bf5=getValueFromLicense(_0xf6b663,_0x214e6b);return _0x2e0bf5?_0x2e0bf5:_0x51965a;})[_0x7182('0xf')](function(_0x3a3760){_0x51965a=_0x3a3760;return _0x1f2061[_0x7182('0x10')](_0x994ac8);})[_0x7182('0xf')](function(_0x40274d){if(_0x40274d>=_0x51965a){return _0x4d40d2[_0x7182('0x11')](0x193)[_0x7182('0x12')]({'message':util[_0x7182('0x7')](_0x7182('0x13'),_0xf6b663)});}_0x2ecf08();})['catch'](function(_0x2efb9a){_0x2ecf08(_0x2efb9a);});});}function isUserLimit(){return isLimit(_0x7182('0x14'),0x1,db[_0x7182('0x15')],{'where':{'$or':[{'role':_0x7182('0x16')},{'role':_0x7182('0x17')}]}});}exports[_0x7182('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ddc327d..652fdbb 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 _0x46ce=['\x20AS\x20','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','=\x20?','$ne','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','$gt','$gte','>=\x20?','$between','$substring','start','pop','utcOffset','format','seconds','lodash','moment','parseSearch','[$or]','and','replace','slice','forEach','split','shift','indexOf','conditions','push','buildExpression','DATE','operator','$eq','value','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field'];(function(_0x2a65f3,_0x2ab326){var _0x16e328=function(_0x1094bc){while(--_0x1094bc){_0x2a65f3['push'](_0x2a65f3['shift']());}};_0x16e328(++_0x2ab326);}(_0x46ce,0x1d0));var _0xe46c=function(_0x2702bd,_0x1b2175){_0x2702bd=_0x2702bd-0x0;var _0x1d689e=_0x46ce[_0x2702bd];return _0x1d689e;};'use strict';var _=require(_0xe46c('0x0'));var moment=require(_0xe46c('0x1'));exports[_0xe46c('0x2')]=function(_0x49b636){var _0x281f50={'conditions':[]};_0x281f50['sqlOperator']=_['startsWith'](_0x49b636,_0xe46c('0x3'))?'or':_0xe46c('0x4');var _0x2b9dff=_0x49b636['replace']('[$and]','')[_0xe46c('0x5')]('[$or]','')['split']('||');for(var _0x8cddf5=0x0;_0x8cddf5<_0x2b9dff['length'];_0x8cddf5++){var _0x198620=_0x2b9dff[_0x8cddf5]['split'](':=');var _0x33ecf9=_0x198620[0x0];var _0x24b6dc=_0x198620[_0xe46c('0x6')](0x1);_0x24b6dc[_0xe46c('0x7')](function(_0x2ab994){var _0x3d67b0=_0x2ab994[_0xe46c('0x8')]('[')[_0xe46c('0x9')]();var _0x194808=_0x2ab994['match'](/\[(.*?)\]/g);_0x194808['forEach'](function(_0x5b8e8d){var _0x1fd42c=_0x5b8e8d[_0xe46c('0x8')]('[')['filter'](function(_0x450a96){return _0x450a96[_0xe46c('0xa')](']')>-0x1;})['map'](function(_0x4ad699){return _0x4ad699['split'](']')[0x0];})[0x0];_0x281f50[_0xe46c('0xb')][_0xe46c('0xc')]({'field':_0x33ecf9,'operator':_0x3d67b0,'value':_0x1fd42c});});});}return _0x281f50;};exports[_0xe46c('0xd')]=function(_0x1392d3,_0x39c303,_0x42446b){var _0x4e0385={};if(_0x39c303===_0xe46c('0xe')){if(_0x42446b[_0xe46c('0xf')]===_0xe46c('0x10')){_0x42446b[_0xe46c('0xf')]='$between';_0x42446b[_0xe46c('0x11')]+=','+_0x42446b[_0xe46c('0x11')];}else if(_['includes'](['$gt',_0xe46c('0x12')],_0x42446b[_0xe46c('0xf')])){_0x42446b[_0xe46c('0x11')]=moment(_0x42446b[_0xe46c('0x11')])[_0xe46c('0x13')](0x1,_0xe46c('0x14'))['format'](_0xe46c('0x15'));}}if(_0x42446b[_0xe46c('0x16')]){_0x39c303=_0x42446b['castTo'];_0x4e0385[_0xe46c('0x17')]=_0xe46c('0x18')+_0x1392d3+'.'+_0x42446b[_0xe46c('0x19')]+_0xe46c('0x1a')+_0x42446b[_0xe46c('0x16')]+')\x20'+parseOperator(_0x42446b[_0xe46c('0xf')]);}else{_0x4e0385[_0xe46c('0x17')]=_0x1392d3+'.'+_0x42446b[_0xe46c('0x19')]+'\x20'+parseOperator(_0x42446b[_0xe46c('0xf')]);}if(_[_0xe46c('0x1b')](['$ne',_0xe46c('0x1c')],_0x42446b[_0xe46c('0xf')]))_0x4e0385['text']='('+_0x4e0385[_0xe46c('0x17')]+_0xe46c('0x1d')+_0x1392d3+'.'+_0x42446b[_0xe46c('0x19')]+_0xe46c('0x1e');_0x4e0385[_0xe46c('0x11')]=parseValue(_0x39c303,_0x42446b[_0xe46c('0xf')],_0x42446b[_0xe46c('0x11')]);return _0x4e0385;};function parseOperator(_0x5e9004){var _0x58c011;switch(_0x5e9004){case _0xe46c('0x1f'):_0x58c011='IN\x20?';break;case _0xe46c('0x1c'):_0x58c011='NOT\x20IN\x20?';break;case'$eq':_0x58c011=_0xe46c('0x20');break;case _0xe46c('0x21'):_0x58c011=_0xe46c('0x22');break;case'$substring':case _0xe46c('0x23'):case _0xe46c('0x24'):_0x58c011='LIKE\x20?';break;case _0xe46c('0x25'):_0x58c011=_0xe46c('0x26');break;case _0xe46c('0x27'):_0x58c011='>\x20?';break;case _0xe46c('0x12'):_0x58c011='<=\x20?';break;case _0xe46c('0x28'):_0x58c011=_0xe46c('0x29');break;case _0xe46c('0x2a'):_0x58c011='BETWEEN\x20?\x20AND\x20?';break;}return _0x58c011;}function parseValue(_0x17f313,_0x5963fb,_0x2cc0c4){var _0x70b2e={'start':undefined,'end':undefined};switch(_0x5963fb){case _0xe46c('0x1f'):case _0xe46c('0x1c'):_0x70b2e['start']=_0x2cc0c4[_0xe46c('0x8')](',');break;case _0xe46c('0x2b'):_0x70b2e['start']='%'+_0x2cc0c4+'%';break;case _0xe46c('0x23'):_0x70b2e[_0xe46c('0x2c')]=_0x2cc0c4+'%';break;case _0xe46c('0x24'):_0x70b2e[_0xe46c('0x2c')]='%'+_0x2cc0c4;break;case'$between':var _0x190a53=_0x2cc0c4[_0xe46c('0x8')](',');var _0x2cc0c4=_0x190a53[_0xe46c('0x9')]();var _0x4fcc6d=_0x190a53[_0xe46c('0x2d')]();if(_0x17f313===_0xe46c('0xe')){_0x2cc0c4=moment(_0x2cc0c4)[_0xe46c('0x2e')](0x0,!![])[_0xe46c('0x2f')]();_0x4fcc6d=moment(_0x4fcc6d)[_0xe46c('0x2e')](0x0,!![])[_0xe46c('0x13')](0x17,'hours')['add'](0x3b,'minutes')[_0xe46c('0x13')](0x3b,_0xe46c('0x30'))['format']();}_0x70b2e={'start':_0x2cc0c4,'end':_0x4fcc6d};break;default:_0x70b2e[_0xe46c('0x2c')]=_0x2cc0c4;break;}return _0x70b2e;} \ No newline at end of file +var _0x3708=['[$or]','split','length','slice','forEach','shift','match','filter','indexOf','map','buildExpression','DATE','operator','$eq','$between','value','$lte','add','days','YYYY-MM-DD','castTo','field','\x20AS\x20','text','includes','$ne','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','>=\x20?','start','$endsWith','pop','utcOffset','format','hours','minutes','lodash','moment','parseSearch','sqlOperator','replace'];(function(_0x9df1df,_0x5bcbf0){var _0x146ada=function(_0x5146c3){while(--_0x5146c3){_0x9df1df['push'](_0x9df1df['shift']());}};_0x146ada(++_0x5bcbf0);}(_0x3708,0x104));var _0x8370=function(_0x1de242,_0x2577dc){_0x1de242=_0x1de242-0x0;var _0x128086=_0x3708[_0x1de242];return _0x128086;};'use strict';var _=require(_0x8370('0x0'));var moment=require(_0x8370('0x1'));exports[_0x8370('0x2')]=function(_0x183dd7){var _0x526d80={'conditions':[]};_0x526d80[_0x8370('0x3')]=_['startsWith'](_0x183dd7,'[$or]')?'or':'and';var _0x39c3ab=_0x183dd7[_0x8370('0x4')]('[$and]','')[_0x8370('0x4')](_0x8370('0x5'),'')[_0x8370('0x6')]('||');for(var _0x41e172=0x0;_0x41e172<_0x39c3ab[_0x8370('0x7')];_0x41e172++){var _0x46f643=_0x39c3ab[_0x41e172]['split'](':=');var _0x436ef1=_0x46f643[0x0];var _0xade4d5=_0x46f643[_0x8370('0x8')](0x1);_0xade4d5[_0x8370('0x9')](function(_0x4960d7){var _0x1c6a9a=_0x4960d7[_0x8370('0x6')]('[')[_0x8370('0xa')]();var _0xd155fb=_0x4960d7[_0x8370('0xb')](/\[(.*?)\]/g);_0xd155fb['forEach'](function(_0x3b9b70){var _0x306b6c=_0x3b9b70[_0x8370('0x6')]('[')[_0x8370('0xc')](function(_0x42bdb4){return _0x42bdb4[_0x8370('0xd')](']')>-0x1;})[_0x8370('0xe')](function(_0x2342c7){return _0x2342c7['split'](']')[0x0];})[0x0];_0x526d80['conditions']['push']({'field':_0x436ef1,'operator':_0x1c6a9a,'value':_0x306b6c});});});}return _0x526d80;};exports[_0x8370('0xf')]=function(_0x59adcf,_0x51d456,_0x39f38f){var _0x1bd600={};if(_0x51d456===_0x8370('0x10')){if(_0x39f38f[_0x8370('0x11')]===_0x8370('0x12')){_0x39f38f[_0x8370('0x11')]=_0x8370('0x13');_0x39f38f[_0x8370('0x14')]+=','+_0x39f38f[_0x8370('0x14')];}else if(_['includes'](['$gt',_0x8370('0x15')],_0x39f38f[_0x8370('0x11')])){_0x39f38f[_0x8370('0x14')]=moment(_0x39f38f['value'])[_0x8370('0x16')](0x1,_0x8370('0x17'))['format'](_0x8370('0x18'));}}if(_0x39f38f[_0x8370('0x19')]){_0x51d456=_0x39f38f['castTo'];_0x1bd600['text']='CAST('+_0x59adcf+'.'+_0x39f38f[_0x8370('0x1a')]+_0x8370('0x1b')+_0x39f38f['castTo']+')\x20'+parseOperator(_0x39f38f[_0x8370('0x11')]);}else{_0x1bd600[_0x8370('0x1c')]=_0x59adcf+'.'+_0x39f38f['field']+'\x20'+parseOperator(_0x39f38f[_0x8370('0x11')]);}if(_[_0x8370('0x1d')]([_0x8370('0x1e'),'$notIn'],_0x39f38f[_0x8370('0x11')]))_0x1bd600['text']='('+_0x1bd600[_0x8370('0x1c')]+'\x20OR\x20'+_0x59adcf+'.'+_0x39f38f[_0x8370('0x1a')]+_0x8370('0x1f');_0x1bd600[_0x8370('0x14')]=parseValue(_0x51d456,_0x39f38f[_0x8370('0x11')],_0x39f38f[_0x8370('0x14')]);return _0x1bd600;};function parseOperator(_0x44375a){var _0x43cc05;switch(_0x44375a){case _0x8370('0x20'):_0x43cc05=_0x8370('0x21');break;case _0x8370('0x22'):_0x43cc05=_0x8370('0x23');break;case _0x8370('0x12'):_0x43cc05='=\x20?';break;case _0x8370('0x1e'):_0x43cc05=_0x8370('0x24');break;case _0x8370('0x25'):case _0x8370('0x26'):case'$endsWith':_0x43cc05=_0x8370('0x27');break;case _0x8370('0x28'):_0x43cc05=_0x8370('0x29');break;case _0x8370('0x2a'):_0x43cc05=_0x8370('0x2b');break;case _0x8370('0x15'):_0x43cc05=_0x8370('0x2c');break;case'$gte':_0x43cc05=_0x8370('0x2d');break;case _0x8370('0x13'):_0x43cc05='BETWEEN\x20?\x20AND\x20?';break;}return _0x43cc05;}function parseValue(_0x41493f,_0x3161c9,_0x5a9bde){var _0x553ad6={'start':undefined,'end':undefined};switch(_0x3161c9){case'$in':case _0x8370('0x22'):_0x553ad6[_0x8370('0x2e')]=_0x5a9bde[_0x8370('0x6')](',');break;case _0x8370('0x25'):_0x553ad6[_0x8370('0x2e')]='%'+_0x5a9bde+'%';break;case _0x8370('0x26'):_0x553ad6[_0x8370('0x2e')]=_0x5a9bde+'%';break;case _0x8370('0x2f'):_0x553ad6[_0x8370('0x2e')]='%'+_0x5a9bde;break;case'$between':var _0x25ee04=_0x5a9bde[_0x8370('0x6')](',');var _0x5a9bde=_0x25ee04['shift']();var _0x473968=_0x25ee04[_0x8370('0x30')]();if(_0x41493f===_0x8370('0x10')){_0x5a9bde=moment(_0x5a9bde)[_0x8370('0x31')](0x0,!![])[_0x8370('0x32')]();_0x473968=moment(_0x473968)['utcOffset'](0x0,!![])[_0x8370('0x16')](0x17,_0x8370('0x33'))[_0x8370('0x16')](0x3b,_0x8370('0x34'))['add'](0x3b,'seconds')[_0x8370('0x32')]();}_0x553ad6={'start':_0x5a9bde,'end':_0x473968};break;default:_0x553ad6[_0x8370('0x2e')]=_0x5a9bde;break;}return _0x553ad6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d53d81b..a4b67fe 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 _0xdb94=['forOwn','type','DATE','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','query','$id','model','intersection','attributes','fields','nolimit','limit','order','pick','filter','object','columns','value','where','lower','merge','options','sequelize','moment','parse','keys','split','filters','isEmpty'];(function(_0x416cea,_0x7d4ee0){var _0x43fdd4=function(_0xa19c32){while(--_0xa19c32){_0x416cea['push'](_0x416cea['shift']());}};_0x43fdd4(++_0x7d4ee0);}(_0xdb94,0xe5));var _0x4db9=function(_0x15f236,_0x522375){_0x15f236=_0x15f236-0x0;var _0x47fa62=_0xdb94[_0x15f236];return _0x47fa62;};'use strict';var _=require('lodash');var sequelize=require(_0x4db9('0x0'));var moment=require(_0x4db9('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5edca0){var _0x26e16b=['ne'];try{var _0x3b24a6=JSON[_0x4db9('0x2')](_0x5edca0);var _0x2e85f4=Object[_0x4db9('0x3')](_0x3b24a6)[0x0];return _0x26e16b['includes'](_0x2e85f4);}catch(_0x39eccb){return![];}}function getOperatorValue(_0x541226){var _0x1d21a8=JSON[_0x4db9('0x2')](_0x541226);var _0x1dddb9=Object[_0x4db9('0x3')](_0x1d21a8)[0x0];var _0x42a857=_0x1d21a8[_0x1dddb9];return{['$'+_0x1dddb9]:_0x42a857};}exports['fields']=function(_0x45d5a3){var _0x4376c8=null;if(_0x45d5a3){_0x4376c8=_0x45d5a3[_0x4db9('0x4')](',');}return _0x4376c8;};exports[_0x4db9('0x5')]=function(_0x402132,_0x575064){var _0x268eb5={};if(!_[_0x4db9('0x6')](_0x402132)){_[_0x4db9('0x7')](_0x402132,function(_0xe6de11,_0x34147f){try{if(_0x575064){var _0x3d1b96=_['find'](_0x575064,{'name':_0x34147f})||{};if(hasSequelizeOperator(_0xe6de11)){_0x268eb5[_0x34147f]=getOperatorValue(_0xe6de11);}else if(_0x3d1b96[_0x4db9('0x8')]===_0x4db9('0x9')&&_['isPlainObject'](_0xe6de11)){var _0x549c92=JSON[_0x4db9('0x2')](_0xe6de11);var _0x3ac147={'$gte':moment(moment(_0x549c92[_0x4db9('0xa')])['format'](_0x4db9('0xb')))[_0x4db9('0xc')]()[_0x4db9('0xd')](),'$lte':moment(moment(_0x549c92[_0x4db9('0xe')])[_0x4db9('0xd')]('YYYY-MM-DD'))[_0x4db9('0xc')]()[_0x4db9('0xf')](0x1,'s')['format']()};_0x268eb5[_0x34147f]=_0x3ac147;}else if(_0x3d1b96[_0x4db9('0x10')]===_0x4db9('0x11')){_0x268eb5[_0x34147f]=_0xe6de11;}else{_0x268eb5[_0x34147f]=_[_0x4db9('0x12')](_0xe6de11)?_0xe6de11:JSON['parse'](_0xe6de11);}}else{_0x268eb5[_0x34147f]=_[_0x4db9('0x12')](_0xe6de11)?_0xe6de11:JSON[_0x4db9('0x2')](_0xe6de11);}}catch(_0x4c5f4f){_0x268eb5[_0x34147f]=_0xe6de11['split'](',');}});}return _0x268eb5;};exports['limit']=function(_0x605552){_0x605552=parseInt(_0x605552,0xa);if(!_0x605552||_0x605552<0x0){_0x605552=LIMIT_VALUE;}return _0x605552;};exports[_0x4db9('0x13')]=function(_0x48ff99){_0x48ff99=parseInt(_0x48ff99,0xa);if(!_0x48ff99||_0x48ff99<0x0){_0x48ff99=0x0;}return _0x48ff99;};exports[_0x4db9('0x14')]=function(_0x1f6b24){var _0x353718,_0x192c5d=null;if(_0x1f6b24){_0x353718=_0x1f6b24[_0x4db9('0x4')](',');_0x192c5d=_[_0x4db9('0x15')](_0x353718,function(_0x34a6ed){if(_0x34a6ed[_0x4db9('0x16')]('-')===0x0){return[_0x34a6ed===_0x4db9('0x17')?sequelize[_0x4db9('0x18')](sequelize[_0x4db9('0x19')](_0x4db9('0x17')),'unsigned'):_0x34a6ed[_0x4db9('0x1a')](0x1),_0x4db9('0x1b')];}else{return[_0x34a6ed==='priority'?sequelize[_0x4db9('0x18')](sequelize[_0x4db9('0x19')](_0x4db9('0x17')),_0x4db9('0x1c')):_0x34a6ed,'ASC'];}});}return _0x192c5d;};exports[_0x4db9('0x1d')]=function(_0x506cc9,_0x1cf805){if(_[_0x4db9('0x6')](_0x506cc9)){return _0x506cc9;}if(_[_0x4db9('0x12')](_0x506cc9)){for(var _0x47e89c=0x0;_0x47e89c<_0x506cc9[_0x4db9('0x1e')];_0x47e89c+=0x1){_0x506cc9[_0x47e89c]=this[_0x4db9('0x1d')](_0x506cc9[_0x47e89c],_0x1cf805);}return _0x506cc9;}if(!_[_0x4db9('0x1f')](_0x506cc9)){return _0x506cc9;}if(_['isString'](_0x1cf805)){_0x1cf805=[_0x1cf805];}if(!_['isArray'](_0x1cf805)){return _0x506cc9;}for(var _0x1b2647=0x0;_0x1b2647<_0x1cf805['length'];_0x1b2647+=0x1){_[_0x4db9('0x20')](_0x506cc9,_0x1cf805[_0x1b2647]);}for(var _0x2653be in _0x506cc9){if(_0x506cc9[_0x4db9('0x21')](_0x2653be)){_0x506cc9[_0x2653be]=this[_0x4db9('0x1d')](_0x506cc9[_0x2653be],_0x1cf805);}}return _0x506cc9;};exports[_0x4db9('0x22')]=function(_0x3c3fcf){return _0x3c3fcf[_0x4db9('0x23')](RegExp(_0x4db9('0x24')))?!![]:![];};exports['isEmail']=function(_0x35f757){return _0x35f757['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x4db9('0x25')]=function(_0x33eb9e){var _0x1e7840=[];_0x33eb9e[_0x4db9('0x4')](/[ ,]+/)[_0x4db9('0x26')](function(_0x4b6130){_0x4b6130=_0x4b6130[_0x4db9('0x27')](/([^:]")"+/g,'$1');_0x4b6130='+'+_0x4b6130+'*';var _0x7ef35=/[ `!@#$%^&*()_\-?~]/;if(_0x4b6130[_0x4db9('0x23')](_0x7ef35))_0x4b6130='\x22'+_0x4b6130+'\x22';_0x1e7840[_0x4db9('0x28')](_0x4b6130);});return _0x1e7840['join']('\x20');};exports['getOptions']=function(_0x15841b,_0x39e528,_0x5c28db){var _0x5e93aa={},_0x3783f2={};if(_0x39e528['query']['$id']){_0x39e528[_0x4db9('0x29')]['id']=_0x39e528[_0x4db9('0x29')]['$id'];delete _0x39e528[_0x4db9('0x29')][_0x4db9('0x2a')];}_0x5e93aa[_0x4db9('0x2b')]=_[_0x4db9('0x15')](_0x15841b,'name');_0x5e93aa[_0x4db9('0x29')]=_['keys'](_0x39e528['query']);_0x5e93aa['filters']=_[_0x4db9('0x2c')](_0x5e93aa[_0x4db9('0x2b')],_0x5e93aa['query']);_0x3783f2[_0x4db9('0x2d')]=_[_0x4db9('0x2c')](_0x5e93aa['model'],this['fields'](_0x39e528['query'][_0x4db9('0x2e')]));_0x3783f2['attributes']=_0x3783f2[_0x4db9('0x2d')]['length']?_0x3783f2[_0x4db9('0x2d')]:_0x5e93aa[_0x4db9('0x2b')];if(!_0x39e528[_0x4db9('0x29')][_0x4db9('0x21')](_0x4db9('0x2f'))){_0x3783f2['limit']=this[_0x4db9('0x30')](_0x39e528['query'][_0x4db9('0x30')]);_0x3783f2[_0x4db9('0x13')]=this[_0x4db9('0x13')](_0x39e528[_0x4db9('0x29')][_0x4db9('0x13')]);}_0x3783f2[_0x4db9('0x31')]=this['sort'](_0x39e528[_0x4db9('0x29')][_0x4db9('0x14')]);_0x3783f2['where']=this['filters'](_[_0x4db9('0x32')](_0x39e528[_0x4db9('0x29')],_0x5e93aa[_0x4db9('0x5')]),_0x15841b);if(_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')]){var _0x36a648=_0x15841b;var _0x1a9fe7=_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')];if(typeof _0x1a9fe7===_0x4db9('0x34')){_0x36a648=_[_0x4db9('0x33')](_0x15841b,function(_0x3254d1){return _['includes'](_0x1a9fe7[_0x4db9('0x35')],_0x3254d1[_0x4db9('0x10')]);});_0x1a9fe7=_0x1a9fe7[_0x4db9('0x36')];}_0x3783f2[_0x4db9('0x37')]=_['merge'](_0x3783f2['where'],{'$or':_[_0x4db9('0x15')](_0x36a648,function(_0x2b18a2){if(_0x2b18a2[_0x4db9('0x8')]!=='VIRTUAL'){if(_0x5c28db){return sequelize[_0x4db9('0x37')](sequelize['fn']('lower',sequelize[_0x4db9('0x19')](_0x2b18a2[_0x4db9('0x10')])),{'$like':sequelize['fn'](_0x4db9('0x38'),'%'+_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')]+'%')});}else{var _0x4eeff3={};_0x4eeff3[_0x2b18a2[_0x4db9('0x10')]]={'$like':'%'+_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')]+'%'};return _0x4eeff3;}}})});}_0x3783f2=_[_0x4db9('0x39')]({},_0x3783f2,_0x39e528[_0x4db9('0x3a')]);return _0x3783f2;}; \ No newline at end of file +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(_0x5a053d,_0x330f07){var _0x2f4c42=function(_0x1756ef){while(--_0x1756ef){_0x5a053d['push'](_0x5a053d['shift']());}};_0x2f4c42(++_0x330f07);}(_0xb66c,0x175));var _0xcb66=function(_0x24f11d,_0x288aec){_0x24f11d=_0x24f11d-0x0;var _0x2bba88=_0xb66c[_0x24f11d];return _0x2bba88;};'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 diff --git a/server/config/express.js b/server/config/express.js index 5e38ae9..d19df62 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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(_0x414ffa,_0x1ea7a5){var _0x55a8fb=function(_0x5a310e){while(--_0x5a310e){_0x414ffa['push'](_0x414ffa['shift']());}};_0x55a8fb(++_0x1ea7a5);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 +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(_0xf61d62,_0x5e1ce1){var _0x1b8b00=function(_0x21dbba){while(--_0x21dbba){_0xf61d62['push'](_0xf61d62['shift']());}};_0x1b8b00(++_0x5e1ce1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 67100fb..43c9cc0 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 _0x5a35=['hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','concat','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','model','join','createHash','md5','update','digest'];(function(_0x1795a7,_0x5e0ff6){var _0x23032b=function(_0x264f3b){while(--_0x264f3b){_0x1795a7['push'](_0x1795a7['shift']());}};_0x23032b(++_0x5e0ff6);}(_0x5a35,0x14c));var _0x55a3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5a35[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x55a3('0x0'));var os=require('os');var crypto=require(_0x55a3('0x1'));var machine=require(_0x55a3('0x2'));var exec=require(_0x55a3('0x3'))[_0x55a3('0x4')];var config=require('../environment');function getInterfaces(){var _0x29788e=[];var _0x53122c=os[_0x55a3('0x5')]();var _0x9c5749=_['orderBy'](_[_0x55a3('0x6')](_0x53122c));for(var _0x42bec8=0x0;_0x42bec8<_0x9c5749[_0x55a3('0x7')];_0x42bec8++){var _0x4aff6b=_0x53122c[_0x9c5749[_0x42bec8]]['filter'](function(_0x389c4f){return _0x389c4f['family']==='IPv4'&&_0x389c4f['internal']===![];});_0x29788e=_0x29788e[_0x55a3('0x8')](_0x4aff6b);}return _0x29788e;}function getFirstInterface(){var _0x22c698=_['head'](getInterfaces());return{'macAddress':_0x22c698&&_0x22c698[_0x55a3('0x9')]?_0x22c698[_0x55a3('0x9')]:_0x55a3('0xa'),'ipAddress':_0x22c698&&_0x22c698['address']?_0x22c698[_0x55a3('0xb')]:'127.0.0.1'};}exports[_0x55a3('0xc')]=getFirstInterface;function getCPUhash(){var _0x4677a5=_[_0x55a3('0xd')](os['cpus']()['map'](function(_0x303931){return _0x303931[_0x55a3('0xe')];}))[_0x55a3('0xf')](':');return crypto[_0x55a3('0x10')](_0x55a3('0x11'))[_0x55a3('0x12')](_0x4677a5)[_0x55a3('0x13')](_0x55a3('0x14'));}exports[_0x55a3('0x15')]=function(){var _0x53c087=os[_0x55a3('0x16')]();var _0x49571c=/[0-9a-f-]{36}/;if(config[_0x55a3('0x17')]&&_0x49571c[_0x55a3('0x18')](config[_0x55a3('0x17')])){return config[_0x55a3('0x17')];}else if(_0x53c087===_0x55a3('0x19')){return exec(_0x55a3('0x1a'),{'encoding':_0x55a3('0x1b')})['replace']('\x0d\x0a','');}else{var _0x5e3152=getFirstInterface();var _0x1ed32a=getCPUhash();var _0x2d0462=_0x1ed32a+'|'+os[_0x55a3('0x1c')]()+'|'+_0x5e3152[_0x55a3('0x1d')]+'|'+_0x5e3152[_0x55a3('0x1e')];var _0x112b1c=crypto[_0x55a3('0x10')](_0x55a3('0x11'))[_0x55a3('0x12')](_0x2d0462)[_0x55a3('0x13')](_0x55a3('0x14'));return _0x112b1c[_0x55a3('0x1f')](0x0,0x8)+'-'+_0x112b1c['substring'](0x8,0xc)+'-'+_0x112b1c[_0x55a3('0x1f')](0xc,0x10)+'-'+_0x112b1c['substring'](0x10,0x14)+'-'+_0x112b1c[_0x55a3('0x1f')](0x14);}}; \ No newline at end of file +var _0xc089=['digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','update'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xc089,0x151));var _0x9c08=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc089[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x9c08('0x0'));var os=require('os');var crypto=require(_0x9c08('0x1'));var machine=require(_0x9c08('0x2'));var exec=require(_0x9c08('0x3'))[_0x9c08('0x4')];var config=require(_0x9c08('0x5'));function getInterfaces(){var _0x2fbf0a=[];var _0x599614=os[_0x9c08('0x6')]();var _0x4aedf2=_['orderBy'](_[_0x9c08('0x7')](_0x599614));for(var _0xa3ff24=0x0;_0xa3ff24<_0x4aedf2[_0x9c08('0x8')];_0xa3ff24++){var _0x44bfa0=_0x599614[_0x4aedf2[_0xa3ff24]][_0x9c08('0x9')](function(_0x3c1a3e){return _0x3c1a3e['family']==='IPv4'&&_0x3c1a3e[_0x9c08('0xa')]===![];});_0x2fbf0a=_0x2fbf0a['concat'](_0x44bfa0);}return _0x2fbf0a;}function getFirstInterface(){var _0x94faba=_[_0x9c08('0xb')](getInterfaces());return{'macAddress':_0x94faba&&_0x94faba['mac']?_0x94faba[_0x9c08('0xc')]:_0x9c08('0xd'),'ipAddress':_0x94faba&&_0x94faba[_0x9c08('0xe')]?_0x94faba[_0x9c08('0xe')]:_0x9c08('0xf')};}exports[_0x9c08('0x10')]=getFirstInterface;function getCPUhash(){var _0x2bb361=_[_0x9c08('0x11')](os['cpus']()[_0x9c08('0x12')](function(_0x43f87e){return _0x43f87e[_0x9c08('0x13')];}))[_0x9c08('0x14')](':');return crypto[_0x9c08('0x15')]('md5')[_0x9c08('0x16')](_0x2bb361)[_0x9c08('0x17')](_0x9c08('0x18'));}exports[_0x9c08('0x19')]=function(){var _0x84a7fe=os[_0x9c08('0x1a')]();var _0x2d2a06=/[0-9a-f-]{36}/;if(config[_0x9c08('0x1b')]&&_0x2d2a06[_0x9c08('0x1c')](config[_0x9c08('0x1b')])){return config['licenseToken'];}else if(_0x84a7fe==='win32'){return exec(_0x9c08('0x1d'),{'encoding':'utf8'})[_0x9c08('0x1e')]('\x0d\x0a','');}else{var _0x5622e7=getFirstInterface();var _0x189b50=getCPUhash();var _0x2a1c12=_0x189b50+'|'+os[_0x9c08('0x1f')]()+'|'+_0x5622e7[_0x9c08('0x20')]+'|'+_0x5622e7[_0x9c08('0x21')];var _0xe007ab=crypto[_0x9c08('0x15')](_0x9c08('0x22'))['update'](_0x2a1c12)[_0x9c08('0x17')](_0x9c08('0x18'));return _0xe007ab[_0x9c08('0x23')](0x0,0x8)+'-'+_0xe007ab[_0x9c08('0x23')](0x8,0xc)+'-'+_0xe007ab[_0x9c08('0x23')](0xc,0x10)+'-'+_0xe007ab[_0x9c08('0x23')](0x10,0x14)+'-'+_0xe007ab[_0x9c08('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b33446b..99f9347 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 _0x02e6=['DEMO\x20START\x20AT\x20%s','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString'];(function(_0x59a859,_0x3a75bb){var _0x2a2eb6=function(_0x1537de){while(--_0x1537de){_0x59a859['push'](_0x59a859['shift']());}};_0x2a2eb6(++_0x3a75bb);}(_0x02e6,0xbc));var _0x602e=function(_0x29c0e0,_0xe0639a){_0x29c0e0=_0x29c0e0-0x0;var _0x32758e=_0x02e6[_0x29c0e0];return _0x32758e;};'use strict';var util=require(_0x602e('0x0'));var moment=require(_0x602e('0x1'));var rp=require('request-promise');var BPromise=require(_0x602e('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x602e('0x3'));var hardware=require('./hardware');var logger=require(_0x602e('0x4'))(_0x602e('0x5'));var HOST=_0x602e('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc5ad4f){return new BPromise(function(_0x1815dd,_0x2e2ca0){var _0x57dc21=util[_0x602e('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0xc5ad4f,module[_0x602e('0x8')][_0x602e('0x9')]);if(oldToken){_0x57dc21=util[_0x602e('0x7')](_0x602e('0xa'),HOST,_0xc5ad4f,module[_0x602e('0x8')]['version'],oldToken);}var _0x2a3913={'uri':_0x57dc21,'method':_0x602e('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x2a3913)[_0x602e('0xc')](function(_0x6fc1cd){_0x1815dd(_0x6fc1cd);})[_0x602e('0xd')](function(_0x26ca14){_0x2e2ca0(_0x26ca14);});});}function manageLicense(_0x42abc7,_0xe8e5ce){var _0xdb2e3b=_0xe8e5ce[_0x602e('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0xdb2e3b[_0x602e('0xf')]!==_0x42abc7&&!_0xdb2e3b[_0x602e('0x10')]){oldToken=_0xdb2e3b[_0x602e('0xf')];}httpRequest(_0x42abc7)['then'](function(_0xc23054){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xc23054[_0x602e('0x11')]){isOldTokenSent=![];if(!_0xdb2e3b['license']&&_0xdb2e3b[_0x602e('0x5')]!=_0xc23054['license']||_0xdb2e3b[_0x602e('0x5')]&&_0xdb2e3b[_0x602e('0x10')]){logger[_0x602e('0x12')](_0x602e('0x13'));}if(_0xdb2e3b['license']&&!_0xdb2e3b[_0x602e('0x10')]&&_0xdb2e3b['license']!=_0xc23054[_0x602e('0x5')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xdb2e3b[_0x602e('0x5')]&&!_0xdb2e3b[_0x602e('0x10')]&&_0xdb2e3b[_0x602e('0x5')]==_0xc23054['license']){return _0xe8e5ce;}return _0xe8e5ce['update']({'data1':_0x42abc7,'data2':null,'license':_0xc23054[_0x602e('0x5')]});}else{if(_0xc23054[_0x602e('0x5')]||_0xdb2e3b[_0x602e('0x5')]){if(!_0xdb2e3b[_0x602e('0x10')]){if(_0xdb2e3b[_0x602e('0xf')]==_0x42abc7){GRAY_PERIOD_REASON='Disabled';logger[_0x602e('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x602e('0x14');logger['info'](_0x602e('0x15'),_0xdb2e3b[_0x602e('0xf')],_0x42abc7);}logger[_0x602e('0x12')](_0x602e('0x16'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x602e('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0xe8e5ce[_0x602e('0x17')]({'data2':encryptor[_0x602e('0x18')](moment()[_0x602e('0x7')](_0x602e('0x19')))});}else{if(moment()[_0x602e('0x1a')](encryptor[_0x602e('0x1b')](_0xdb2e3b[_0x602e('0x10')]),'days')>DAYS){logger['info'](_0x602e('0x1c'),moment()[_0x602e('0x7')](_0x602e('0x19')));isOldTokenSent=![];return _0xe8e5ce[_0x602e('0x17')]({'data1':_0x42abc7,'data2':null,'license':null});}}}else{if(_0xdb2e3b[_0x602e('0xf')]!=_0x42abc7){logger[_0x602e('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xdb2e3b[_0x602e('0xf')],_0x42abc7);return _0xe8e5ce[_0x602e('0x17')]({'data1':_0x42abc7,'data2':null,'license':null});}}}return _0xe8e5ce;})[_0x602e('0xc')](function(_0x2f352f){_0xe8e5ce=_0x2f352f;})[_0x602e('0xd')](function(_0x362778){logger[_0x602e('0x1d')](_0x362778[_0x602e('0x1e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x602e('0x1f')](),_0xe8e5ce);},TIME);});}function defaultLicense(){var _0x2b8347=hardware[_0x602e('0x1f')]();if(_0x2b8347){return db['License'][_0x602e('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0x2b8347}})[_0x602e('0x21')](function(_0x1d1562,_0x20c8c9){logger['info'](_0x602e('0x22'),_0x2b8347);manageLicense(_0x2b8347,_0x1d1562);})[_0x602e('0xd')](function(_0x490f97){logger['error'](_0x490f97[_0x602e('0x1e')]);});}}exports[_0x602e('0x23')]=defaultLicense; \ No newline at end of file +var _0x4157=['%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','then','error','message','finally','getUuid','License','findOrCreate','spread','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format'];(function(_0x1358fb,_0x43717f){var _0x10f66e=function(_0x2ce915){while(--_0x2ce915){_0x1358fb['push'](_0x1358fb['shift']());}};_0x10f66e(++_0x43717f);}(_0x4157,0x1ce));var _0x7415=function(_0x59d5d6,_0x413918){_0x59d5d6=_0x59d5d6-0x0;var _0x4b0ae0=_0x4157[_0x59d5d6];return _0x4b0ae0;};'use strict';var util=require('util');var moment=require(_0x7415('0x0'));var rp=require('request-promise');var BPromise=require(_0x7415('0x1'));var pkginfo=require(_0x7415('0x2'))(module,_0x7415('0x3'));var db=require(_0x7415('0x4'))['db'];var encryptor=require(_0x7415('0x5'));var hardware=require(_0x7415('0x6'));var logger=require(_0x7415('0x7'))(_0x7415('0x8'));var HOST=_0x7415('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x262a75){return new BPromise(function(_0x53b92f,_0x665be0){var _0x469e91=util[_0x7415('0xa')](_0x7415('0xb'),HOST,_0x262a75,module['exports'][_0x7415('0x3')]);if(oldToken){_0x469e91=util['format'](_0x7415('0xc'),HOST,_0x262a75,module[_0x7415('0xd')][_0x7415('0x3')],oldToken);}var _0x47cb29={'uri':_0x469e91,'method':_0x7415('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x47cb29)['then'](function(_0xb69a6c){_0x53b92f(_0xb69a6c);})[_0x7415('0xf')](function(_0x54b12b){_0x665be0(_0x54b12b);});});}function manageLicense(_0x5efa5b,_0x1660e0){var _0x1009b6=_0x1660e0[_0x7415('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x1009b6[_0x7415('0x11')]!==_0x5efa5b&&!_0x1009b6[_0x7415('0x12')]){oldToken=_0x1009b6[_0x7415('0x11')];}httpRequest(_0x5efa5b)['then'](function(_0xaeaad4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xaeaad4[_0x7415('0x13')]){isOldTokenSent=![];if(!_0x1009b6[_0x7415('0x8')]&&_0x1009b6[_0x7415('0x8')]!=_0xaeaad4[_0x7415('0x8')]||_0x1009b6[_0x7415('0x8')]&&_0x1009b6[_0x7415('0x12')]){logger[_0x7415('0x14')](_0x7415('0x15'));}if(_0x1009b6[_0x7415('0x8')]&&!_0x1009b6[_0x7415('0x12')]&&_0x1009b6['license']!=_0xaeaad4[_0x7415('0x8')]){logger['info'](_0x7415('0x16'));}if(_0x1009b6['license']&&!_0x1009b6[_0x7415('0x12')]&&_0x1009b6[_0x7415('0x8')]==_0xaeaad4[_0x7415('0x8')]){return _0x1660e0;}return _0x1660e0[_0x7415('0x17')]({'data1':_0x5efa5b,'data2':null,'license':_0xaeaad4[_0x7415('0x8')]});}else{if(_0xaeaad4[_0x7415('0x8')]||_0x1009b6[_0x7415('0x8')]){if(!_0x1009b6[_0x7415('0x12')]){if(_0x1009b6[_0x7415('0x11')]==_0x5efa5b){GRAY_PERIOD_REASON=_0x7415('0x18');logger['info'](_0x7415('0x19'));}else{GRAY_PERIOD_REASON=_0x7415('0x1a');logger['info'](_0x7415('0x1b'),_0x1009b6[_0x7415('0x11')],_0x5efa5b);}logger[_0x7415('0x14')](_0x7415('0x1c'),GRAY_PERIOD_REASON[_0x7415('0x1d')](),moment()[_0x7415('0xa')](_0x7415('0x1e')));return _0x1660e0[_0x7415('0x17')]({'data2':encryptor['encryptString'](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x7415('0x1f')](encryptor[_0x7415('0x20')](_0x1009b6[_0x7415('0x12')]),_0x7415('0x21'))>DAYS){logger['info'](_0x7415('0x22'),moment()['format'](_0x7415('0x1e')));isOldTokenSent=![];return _0x1660e0[_0x7415('0x17')]({'data1':_0x5efa5b,'data2':null,'license':null});}}}else{if(_0x1009b6[_0x7415('0x11')]!=_0x5efa5b){logger['info'](_0x7415('0x1b'),_0x1009b6[_0x7415('0x11')],_0x5efa5b);return _0x1660e0[_0x7415('0x17')]({'data1':_0x5efa5b,'data2':null,'license':null});}}}return _0x1660e0;})[_0x7415('0x23')](function(_0x55eac6){_0x1660e0=_0x55eac6;})[_0x7415('0xf')](function(_0x2576b0){logger[_0x7415('0x24')](_0x2576b0[_0x7415('0x25')]);})[_0x7415('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0x7415('0x27')](),_0x1660e0);},TIME);});}function defaultLicense(){var _0x3fef8d=hardware['getUuid']();if(_0x3fef8d){return db[_0x7415('0x28')][_0x7415('0x29')]({'where':{'id':0x1},'defaults':{'data1':_0x3fef8d}})[_0x7415('0x2a')](function(_0x1118cb,_0x501c8d){logger[_0x7415('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3fef8d);manageLicense(_0x3fef8d,_0x1118cb);})['catch'](function(_0x1b5432){logger[_0x7415('0x24')](_0x1b5432['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ff82c36..1c6fd75 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 _0xe488=['Breaking\x20license','License','find','defaults','then','uuid','data1','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','telephone','users','forEach','admin','user','count','catch','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid'];(function(_0xd7f994,_0xcf10b8){var _0xd4de0c=function(_0x232114){while(--_0x232114){_0xd7f994['push'](_0xd7f994['shift']());}};_0xd4de0c(++_0xcf10b8);}(_0xe488,0x1b0));var _0x8e48=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xe488[_0x5eb22e];return _0x27fed5;};'use strict';var util=require(_0x8e48('0x0'));var _=require(_0x8e48('0x1'));var moment=require(_0x8e48('0x2'));var BPromise=require('bluebird');var hardware=require(_0x8e48('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x8e48('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8e48('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x8e48('0x6'),'machineUuid':hardware[_0x8e48('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':_0x8e48('0x8'),'machineUuid':hardware[_0x8e48('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x283086){return new BPromise(function(_0x2be054,_0x1f2b34){return db[_0x8e48('0x9')][_0x8e48('0xa')](_[_0x8e48('0xb')](_0x283086,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5c801f){return checkLicense(_0x5c801f,null);})[_0x8e48('0xc')](function(_0x418252){_0x2be054(_0x418252);return;})['catch'](function(_0x4e538e){_0x1f2b34(_0x4e538e);});});}function checkLicense(_0x3c702a,_0x5c75f3){if(!_0x3c702a){demoLicense[_0x8e48('0xd')]=_0x3c702a[_0x8e48('0xe')];return demoLicense;}try{var _0x58cb3d=_0x5c75f3||_0x3c702a['license'];if(_['isEmpty'](_0x58cb3d)){throw new Error(_0x8e48('0xf'));}var _0x14b423=_0x3c702a[_0x8e48('0xe')];var _0xb2e349=_0x3c702a['data2'];var _0x100e3f=_0x14b423[_0x8e48('0x10')]('-')[0x4];var _0x4c3ed0=_0x14b423[_0x8e48('0x10')]('-')[0x0];var _0x695c2d=encryptor[_0x8e48('0x11')](_0x58cb3d,util[_0x8e48('0x12')](_0x8e48('0x13'),_0x100e3f,_0x14b423,_0x4c3ed0));var _0x99f8e2=JSON[_0x8e48('0x14')](_0x695c2d);_0x99f8e2[_0x8e48('0x15')]=![];_0x99f8e2[_0x8e48('0xd')]=_0x14b423;_0x99f8e2[_0x8e48('0x16')]=hardware[_0x8e48('0x7')]();if(_0xb2e349){var _0x5e4dd0=encryptor[_0x8e48('0x11')](_0xb2e349);_0x99f8e2[_0x8e48('0x17')]=_0x5e4dd0;_0x99f8e2['deadline']=moment(_0x5e4dd0)['add'](0x7,_0x8e48('0x18'))[_0x8e48('0x12')]();_0x99f8e2[_0x8e48('0x19')]=_0x99f8e2[_0x8e48('0xd')]!=_0x99f8e2[_0x8e48('0x16')]?_0x8e48('0x1a'):_0x8e48('0x1b');}return _0x99f8e2;}catch(_0x48042e){breakingLicense[_0x8e48('0xd')]=_0x3c702a[_0x8e48('0xe')];breakingLicense[_0x8e48('0x1c')]=_0x48042e['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4e4e31,_0x49e5bc){getLicense()[_0x8e48('0xc')](function(_0x5a93b0){return db[_0x8e48('0x1d')][_0x8e48('0x1e')]({'attributes':[_0x8e48('0x1f'),[db[_0x8e48('0x20')]['fn'](_0x8e48('0x21'),db[_0x8e48('0x20')]['col'](_0x8e48('0x1f'))),'count']],'group':_0x8e48('0x1f'),'where':{'role':{'$or':['admin','user',_0x8e48('0x22')]}},'raw':!![]})[_0x8e48('0xc')](function(_0x30e87b){var _0x5662db={'user':_0x5a93b0[_0x8e48('0x23')]||0x0,'telephone':_0x5a93b0['telephones']||0x0};_0x30e87b[_0x8e48('0x24')](function(_0x549a46){var _0x3ae653=_0x549a46[_0x8e48('0x1f')]===_0x8e48('0x25')?_0x8e48('0x26'):_0x549a46[_0x8e48('0x1f')];_0x5662db[_0x3ae653]-=_0x549a46[_0x8e48('0x27')];if(_0x5662db[_0x3ae653]<0x0)_0x5662db[_0x3ae653]=0x0;});_0x4e4e31(_0x5662db);return;});})[_0x8e48('0x28')](function(_0x34c077){_0x49e5bc(_0x34c077);});});}function checkUserLimits(_0x422a75){return new BPromise(function(_0x55cd33,_0xd84dde){getLimits()[_0x8e48('0xc')](function(_0x44dc63){var _0x159339=_['pick'](_[_0x8e48('0x29')](_0x422a75,_0x8e48('0x1f')),[_0x8e48('0x25'),_0x8e48('0x26'),_0x8e48('0x22')]);var _0x13de8b=(_0x159339[_0x8e48('0x25')]||0x0)+(_0x159339['user']||0x0);var _0x44e147=_0x159339[_0x8e48('0x22')]||0x0;if(_0x13de8b>_0x44dc63[_0x8e48('0x26')])return _0xd84dde(_0x8e48('0x2a'));if(_0x44e147>_0x44dc63['telephone'])return _0xd84dde('License\x20limit\x20reached\x20for\x20telephones');return _0x55cd33();})[_0x8e48('0x28')](function(_0x56931d){_0xd84dde(_0x56931d);});});}module[_0x8e48('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5093=['License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','deadline','add','days','grayReason','disabled','message','findAll','sequelize','col','count','admin','users','telephones','user','role','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','find','then','catch','uuid','data1','license'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x5093,0x118));var _0x3509=function(_0x5f7d79,_0x546143){_0x5f7d79=_0x5f7d79-0x0;var _0x577319=_0x5093[_0x5f7d79];return _0x577319;};'use strict';var util=require(_0x3509('0x0'));var _=require(_0x3509('0x1'));var moment=require(_0x3509('0x2'));var BPromise=require(_0x3509('0x3'));var hardware=require(_0x3509('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x3509('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3509('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x3509('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[_0x3509('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4ed696){return new BPromise(function(_0x8bc917,_0x21745c){return db['License'][_0x3509('0x8')](_['defaults'](_0x4ed696,{'raw':!![],'where':{'id':0x1}}))[_0x3509('0x9')](function(_0x3e85ca){return checkLicense(_0x3e85ca,null);})[_0x3509('0x9')](function(_0x45b33d){_0x8bc917(_0x45b33d);return;})[_0x3509('0xa')](function(_0x1e8f65){_0x21745c(_0x1e8f65);});});}function checkLicense(_0x36353c,_0x343649){if(!_0x36353c){demoLicense[_0x3509('0xb')]=_0x36353c[_0x3509('0xc')];return demoLicense;}try{var _0x542029=_0x343649||_0x36353c[_0x3509('0xd')];if(_['isEmpty'](_0x542029)){throw new Error(_0x3509('0xe'));}var _0x42e36d=_0x36353c[_0x3509('0xc')];var _0x57099f=_0x36353c[_0x3509('0xf')];var _0x1d3203=_0x42e36d['split']('-')[0x4];var _0xddd47d=_0x42e36d[_0x3509('0x10')]('-')[0x0];var _0x1bdca8=encryptor[_0x3509('0x11')](_0x542029,util[_0x3509('0x12')](_0x3509('0x13'),_0x1d3203,_0x42e36d,_0xddd47d));var _0x502b32=JSON[_0x3509('0x14')](_0x1bdca8);_0x502b32['demo']=![];_0x502b32[_0x3509('0xb')]=_0x42e36d;_0x502b32[_0x3509('0x15')]=hardware[_0x3509('0x7')]();if(_0x57099f){var _0x2e9752=encryptor[_0x3509('0x11')](_0x57099f);_0x502b32[_0x3509('0x16')]=_0x2e9752;_0x502b32[_0x3509('0x17')]=moment(_0x2e9752)[_0x3509('0x18')](0x7,_0x3509('0x19'))[_0x3509('0x12')]();_0x502b32[_0x3509('0x1a')]=_0x502b32[_0x3509('0xb')]!=_0x502b32[_0x3509('0x15')]?'changed':_0x3509('0x1b');}return _0x502b32;}catch(_0x35c16f){breakingLicense[_0x3509('0xb')]=_0x36353c[_0x3509('0xc')];breakingLicense[_0x3509('0x1c')]=_0x35c16f[_0x3509('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x440af6,_0x3d9a72){getLicense()[_0x3509('0x9')](function(_0x5bef51){return db['User'][_0x3509('0x1d')]({'attributes':['role',[db[_0x3509('0x1e')]['fn']('COUNT',db[_0x3509('0x1e')][_0x3509('0x1f')]('role')),_0x3509('0x20')]],'group':'role','where':{'role':{'$or':[_0x3509('0x21'),'user','telephone']}},'raw':!![]})[_0x3509('0x9')](function(_0x1bd2af){var _0x89b20d={'user':_0x5bef51[_0x3509('0x22')]||0x0,'telephone':_0x5bef51[_0x3509('0x23')]||0x0};_0x1bd2af['forEach'](function(_0x342a54){var _0x12b339=_0x342a54['role']===_0x3509('0x21')?_0x3509('0x24'):_0x342a54[_0x3509('0x25')];_0x89b20d[_0x12b339]-=_0x342a54[_0x3509('0x20')];if(_0x89b20d[_0x12b339]<0x0)_0x89b20d[_0x12b339]=0x0;});_0x440af6(_0x89b20d);return;});})['catch'](function(_0x1cc00f){_0x3d9a72(_0x1cc00f);});});}function checkUserLimits(_0x9d8a41){return new BPromise(function(_0x5c77af,_0x2b8620){getLimits()[_0x3509('0x9')](function(_0x3b9096){var _0x296979=_['pick'](_[_0x3509('0x26')](_0x9d8a41,_0x3509('0x25')),['admin',_0x3509('0x24'),_0x3509('0x27')]);var _0x283990=(_0x296979[_0x3509('0x21')]||0x0)+(_0x296979[_0x3509('0x24')]||0x0);var _0x3804ff=_0x296979[_0x3509('0x27')]||0x0;if(_0x283990>_0x3b9096['user'])return _0x2b8620(_0x3509('0x28'));if(_0x3804ff>_0x3b9096['telephone'])return _0x2b8620(_0x3509('0x29'));return _0x5c77af();})[_0x3509('0xa')](function(_0x31b420){_0x2b8620(_0x31b420);});});}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 1ca23b4..f593c62 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 _0x8f4c=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x54795e,_0x2a4741){var _0x43f806=function(_0x5219d8){while(--_0x5219d8){_0x54795e['push'](_0x54795e['shift']());}};_0x43f806(++_0x2a4741);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3c4553,_0x4e8bc5){_0x3c4553=_0x3c4553-0x0;var _0xa5d979=_0x8f4c[_0x3c4553];return _0xa5d979;};'use strict';module[_0xc8f4('0x0')]={'DOMAIN':_0xc8f4('0x1'),'SESSION_SECRET':_0xc8f4('0x2'),'GOOGLE_ID':_0xc8f4('0x3'),'GOOGLE_SECRET':_0xc8f4('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x958a=['exports','http://localhost:9000','app-id','secret'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0x958a,0x128));var _0xa958=function(_0x55eff4,_0x467006){_0x55eff4=_0x55eff4-0x0;var _0x284c44=_0x958a[_0x55eff4];return _0x284c44;};'use strict';module[_0xa958('0x0')]={'DOMAIN':_0xa958('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa958('0x2'),'GOOGLE_SECRET':_0xa958('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 5536f41..f943385 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33c4=['fileLogger','../utils/loggers'];(function(_0x516ea3,_0x5ec888){var _0xcd04a6=function(_0x3aec36){while(--_0x3aec36){_0x516ea3['push'](_0x516ea3['shift']());}};_0xcd04a6(++_0x5ec888);}(_0x33c4,0x14b));var _0x433c=function(_0x4690f1,_0x10f22f){_0x4690f1=_0x4690f1-0x0;var _0x5c2b55=_0x33c4[_0x4690f1];return _0x5c2b55;};'use strict';var fileLogger=require(_0x433c('0x0'))[_0x433c('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xbff6=['../utils/loggers','fileLogger','exports'];(function(_0x273000,_0xa9c8df){var _0x81defc=function(_0x4bad71){while(--_0x4bad71){_0x273000['push'](_0x273000['shift']());}};_0x81defc(++_0xa9c8df);}(_0xbff6,0x75));var _0x6bff=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0xbff6[_0xaa6a4];return _0xdc31a4;};'use strict';var fileLogger=require(_0x6bff('0x0'))[_0x6bff('0x1')];module[_0x6bff('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 86976f2..ea0561a 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 _0x1538=['../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','ami','agi','../../services/agi/index.js'];(function(_0x2df0b8,_0x1fc067){var _0x2f4961=function(_0x5a6ce6){while(--_0x5a6ce6){_0x2df0b8['push'](_0x2df0b8['shift']());}};_0x2f4961(++_0x1fc067);}(_0x1538,0x1e9));var _0x8153=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x1538[_0x4599b6];return _0x2e014c;};'use strict';var path=require(_0x8153('0x0'));var os=require('os');var config={'apps':[{'name':_0x8153('0x1'),'script':path[_0x8153('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x8153('0x3'),'script':path[_0x8153('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x8153('0x4'),'script':path[_0x8153('0x2')](__dirname,_0x8153('0x5'))},{'name':'email','script':path['join'](__dirname,_0x8153('0x6'))},{'name':'routing','script':path[_0x8153('0x2')](__dirname,_0x8153('0x7'))},{'name':_0x8153('0x8'),'script':path[_0x8153('0x2')](__dirname,_0x8153('0x9'))}]};module[_0x8153('0xa')]=config; \ No newline at end of file +var _0x326d=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','join','../../services/express/index.js','ami'];(function(_0x1763ac,_0x37336b){var _0x10b230=function(_0x30329b){while(--_0x30329b){_0x1763ac['push'](_0x1763ac['shift']());}};_0x10b230(++_0x37336b);}(_0x326d,0x7f));var _0xd326=function(_0x22e8d7,_0x382769){_0x22e8d7=_0x22e8d7-0x0;var _0x73f951=_0x326d[_0x22e8d7];return _0x73f951;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0xd326('0x0')](__dirname,_0xd326('0x1'))},{'name':_0xd326('0x2'),'script':path[_0xd326('0x0')](__dirname,_0xd326('0x3'))},{'name':_0xd326('0x4'),'script':path[_0xd326('0x0')](__dirname,_0xd326('0x5'))},{'name':_0xd326('0x6'),'script':path[_0xd326('0x0')](__dirname,_0xd326('0x7'))},{'name':_0xd326('0x8'),'script':path[_0xd326('0x0')](__dirname,_0xd326('0x9'))},{'name':_0xd326('0xa'),'script':path[_0xd326('0x0')](__dirname,_0xd326('0xb'))}]};module[_0xd326('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 1d88ffe..1399798 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 _0xc737=['pm2','bluebird','./config','connected','start','then','disconnect','stop','restart','describe','delete','dump','saved'];(function(_0x38a3d6,_0x52e305){var _0x3768d7=function(_0x1af8a9){while(--_0x1af8a9){_0x38a3d6['push'](_0x38a3d6['shift']());}};_0x3768d7(++_0x52e305);}(_0xc737,0xdd));var _0x7c73=function(_0x4b2471,_0xedb897){_0x4b2471=_0x4b2471-0x0;var _0x7a8c13=_0xc737[_0x4b2471];return _0x7a8c13;};'use strict';var pm2=require(_0x7c73('0x0'));var BPromise=require(_0x7c73('0x1'));var config=require(_0x7c73('0x2'));function connect(){return new BPromise(function(_0x349647,_0xa9c9fb){return pm2['connect'](function(_0x34b9ab){if(_0x34b9ab){return _0xa9c9fb(_0x34b9ab);}return _0x349647(_0x7c73('0x3'));});});};exports[_0x7c73('0x4')]=function(_0x2f8c75){return connect()[_0x7c73('0x5')](function(){return new BPromise(function(_0x92639c,_0xa11475){return pm2['start'](_0x2f8c75,function(_0x409a0a,_0xa3e456){if(_0x409a0a){return _0xa11475(_0x409a0a);}pm2[_0x7c73('0x6')]();return _0x92639c(_0xa3e456);});});});};exports['stop']=function(_0x4450ea){return connect()['then'](function(){return new BPromise(function(_0x41c030,_0x41df0f){return pm2[_0x7c73('0x7')](_0x4450ea,function(_0x43942a,_0x2684e){if(_0x43942a){return _0x41df0f(_0x43942a);}pm2['disconnect']();return _0x41c030(_0x2684e);});});});};exports['restart']=function(_0x47288f){return connect()[_0x7c73('0x5')](function(){return new BPromise(function(_0x37152d,_0x56d1bd){return pm2[_0x7c73('0x8')](_0x47288f,function(_0x46d00e,_0x1ebdfd){if(_0x46d00e){return _0x56d1bd(_0x46d00e);}pm2[_0x7c73('0x6')]();return _0x37152d(_0x1ebdfd);});});});};exports['list']=function(){return connect()[_0x7c73('0x5')](function(){return new BPromise(function(_0x7e3ee2,_0x25c643){return pm2['list'](function(_0x4e1e89,_0x3bb1cb){if(_0x4e1e89){return _0x25c643(_0x4e1e89);}pm2[_0x7c73('0x6')]();return _0x7e3ee2(_0x3bb1cb);});});});};exports[_0x7c73('0x9')]=function(_0x4c3e89){return connect()[_0x7c73('0x5')](function(){return new BPromise(function(_0x5e2553,_0x33170c){return pm2[_0x7c73('0x9')](_0x4c3e89,function(_0x1a9f1d,_0x4382e0){if(_0x1a9f1d){return _0x33170c(_0x1a9f1d);}pm2['disconnect']();return _0x5e2553(_0x4382e0);});});});};exports[_0x7c73('0xa')]=function(_0x20b3d0){return connect()[_0x7c73('0x5')](function(){return new BPromise(function(_0x1a808b,_0x3f1b1a){return pm2['delete'](_0x20b3d0,function(_0x3570bf,_0x2b3230){if(_0x3570bf){return _0x3f1b1a(_0x3570bf);}pm2[_0x7c73('0x6')]();return _0x1a808b(_0x2b3230);});});});};exports[_0x7c73('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x175764,_0x53467a){return pm2[_0x7c73('0xb')](function(_0x53e00a){if(_0x53e00a){return _0x53467a(_0x53e00a);}return _0x175764(_0x7c73('0xc'));});});});}; \ No newline at end of file +var _0x5783=['stop','restart','list','describe','delete','dump','saved','pm2','./config','connected','then','start','disconnect'];(function(_0x329ba0,_0x2e889b){var _0x526123=function(_0x42656e){while(--_0x42656e){_0x329ba0['push'](_0x329ba0['shift']());}};_0x526123(++_0x2e889b);}(_0x5783,0x1c1));var _0x3578=function(_0x5b3652,_0x3f21f6){_0x5b3652=_0x5b3652-0x0;var _0xc2adf1=_0x5783[_0x5b3652];return _0xc2adf1;};'use strict';var pm2=require(_0x3578('0x0'));var BPromise=require('bluebird');var config=require(_0x3578('0x1'));function connect(){return new BPromise(function(_0x2ad629,_0x41118d){return pm2['connect'](function(_0x3f2577){if(_0x3f2577){return _0x41118d(_0x3f2577);}return _0x2ad629(_0x3578('0x2'));});});};exports['start']=function(_0xa0178){return connect()[_0x3578('0x3')](function(){return new BPromise(function(_0x1e1108,_0x56a91a){return pm2[_0x3578('0x4')](_0xa0178,function(_0x51c5a6,_0x221951){if(_0x51c5a6){return _0x56a91a(_0x51c5a6);}pm2[_0x3578('0x5')]();return _0x1e1108(_0x221951);});});});};exports['stop']=function(_0x2a5e5b){return connect()[_0x3578('0x3')](function(){return new BPromise(function(_0x1019f4,_0x3f192a){return pm2[_0x3578('0x6')](_0x2a5e5b,function(_0x140ab2,_0x24e337){if(_0x140ab2){return _0x3f192a(_0x140ab2);}pm2['disconnect']();return _0x1019f4(_0x24e337);});});});};exports[_0x3578('0x7')]=function(_0x11aa82){return connect()[_0x3578('0x3')](function(){return new BPromise(function(_0x11c823,_0x3213ef){return pm2['restart'](_0x11aa82,function(_0x3335e9,_0x2a743b){if(_0x3335e9){return _0x3213ef(_0x3335e9);}pm2['disconnect']();return _0x11c823(_0x2a743b);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x21556c,_0x5e01e9){return pm2[_0x3578('0x8')](function(_0x5441c4,_0x2d099d){if(_0x5441c4){return _0x5e01e9(_0x5441c4);}pm2[_0x3578('0x5')]();return _0x21556c(_0x2d099d);});});});};exports[_0x3578('0x9')]=function(_0x1374ff){return connect()[_0x3578('0x3')](function(){return new BPromise(function(_0xd196a0,_0x364a27){return pm2[_0x3578('0x9')](_0x1374ff,function(_0x4dd014,_0x51c559){if(_0x4dd014){return _0x364a27(_0x4dd014);}pm2['disconnect']();return _0xd196a0(_0x51c559);});});});};exports[_0x3578('0xa')]=function(_0x5ea8fc){return connect()[_0x3578('0x3')](function(){return new BPromise(function(_0x191cd6,_0x5ad304){return pm2[_0x3578('0xa')](_0x5ea8fc,function(_0x7ea042,_0x5f47b8){if(_0x7ea042){return _0x5ad304(_0x7ea042);}pm2['disconnect']();return _0x191cd6(_0x5f47b8);});});});};exports[_0x3578('0xb')]=function(){return connect()[_0x3578('0x3')](function(){return new BPromise(function(_0x1fd629,_0x22d8cf){return pm2[_0x3578('0xb')](function(_0x37ca56){if(_0x37ca56){return _0x22d8cf(_0x37ca56);}return _0x1fd629(_0x3578('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c4ab0b0..3cc311c 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 _0x110b=['../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb'];(function(_0x17490b,_0x1b57d4){var _0x2b2eb7=function(_0x22f5ae){while(--_0x22f5ae){_0x17490b['push'](_0x17490b['shift']());}};_0x2b2eb7(++_0x1b57d4);}(_0x110b,0x1bb));var _0xb110=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x110b[_0x3f0b30];return _0x2748a5;};'use strict';var _=require(_0xb110('0x0'));var moment=require('moment');var Redis=require(_0xb110('0x1'));var util=require(_0xb110('0x2'));var config=require(_0xb110('0x3'));var db=require(_0xb110('0x4'))['db'];var logger=require(_0xb110('0x5'))(_0xb110('0x6'));config['redis']=_['defaults'](config[_0xb110('0x7')],{'host':_0xb110('0x8'),'port':0x18eb});var io=require(_0xb110('0x9'))(new Redis(config[_0xb110('0x7')]));function closeInteractions(){var _0xa7c168=0x0;var _0x38b2ad=[];return db[_0xb110('0xa')][_0xb110('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xb110('0xc')](function(_0x43a633){_0xa7c168=_0x43a633[_0xb110('0xd')];if(_0xa7c168){return db[_0xb110('0xe')]['findAll']({'raw':!![],'attributes':['id',_0xb110('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb110('0x10')](_0x43a633[_0xb110('0xd')],'minutes')}}});}else{return[];}})[_0xb110('0xc')](function(_0x45837d){if(_0x45837d&&_0x45837d[_0xb110('0x11')]){_0x38b2ad=_['map'](_0x45837d||[],'id');logger[_0xb110('0x12')](_0xb110('0x13'),_0x38b2ad[_0xb110('0x14')]());return db['ChatInteraction'][_0xb110('0x15')]({'closeReason':_0xb110('0x16'),'disposition':_0xb110('0x17'),'closed':!![],'closedAt':moment()[_0xb110('0x18')](_0xb110('0x19'))},{'where':{'id':_0x38b2ad}});}})['then'](function(){if(_0x38b2ad&&_0x38b2ad[_0xb110('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x38b2ad[_0xb110('0x14')]());for(var _0x20e29e=0x0;_0x20e29e<_0x38b2ad['length'];_0x20e29e++){io[_0xb110('0x1a')](_0xb110('0x1b'),{'id':_0x38b2ad[_0x20e29e],'closed':!![]});}}})['catch'](function(_0x4438fb){logger[_0xb110('0x1c')](_0xb110('0x1d'),_0x4438fb?util[_0xb110('0x1e')](_0x4438fb,{'showHidden':![],'depth':null}):'');});}exports[_0xb110('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x320a=['[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','length','map','info'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x320a,0x1bd));var _0xa320=function(_0x5473f0,_0xbee4d7){_0x5473f0=_0x5473f0-0x0;var _0x7f9157=_0x320a[_0x5473f0];return _0x7f9157;};'use strict';var _=require(_0xa320('0x0'));var moment=require('moment');var Redis=require(_0xa320('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0xa320('0x2'))['db'];var logger=require(_0xa320('0x3'))(_0xa320('0x4'));config[_0xa320('0x5')]=_[_0xa320('0x6')](config[_0xa320('0x5')],{'host':_0xa320('0x7'),'port':0x18eb});var io=require(_0xa320('0x8'))(new Redis(config[_0xa320('0x5')]));function closeInteractions(){var _0x38fd18=0x0;var _0x5bdfd8=[];return db[_0xa320('0x9')][_0xa320('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xa320('0xb')](function(_0x4016c6){_0x38fd18=_0x4016c6[_0xa320('0xc')];if(_0x38fd18){return db[_0xa320('0xd')][_0xa320('0xe')]({'raw':!![],'attributes':['id',_0xa320('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4016c6[_0xa320('0xc')],_0xa320('0x10'))}}});}else{return[];}})['then'](function(_0x147abc){if(_0x147abc&&_0x147abc[_0xa320('0x11')]){_0x5bdfd8=_[_0xa320('0x12')](_0x147abc||[],'id');logger[_0xa320('0x13')](_0xa320('0x14'),_0x5bdfd8[_0xa320('0x15')]());return db[_0xa320('0xd')][_0xa320('0x16')]({'closeReason':_0xa320('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xa320('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5bdfd8}});}})['then'](function(){if(_0x5bdfd8&&_0x5bdfd8['length']){logger['info'](_0xa320('0x19'),_0x5bdfd8[_0xa320('0x15')]());for(var _0x1ef260=0x0;_0x1ef260<_0x5bdfd8['length'];_0x1ef260++){io['emit'](_0xa320('0x1a'),{'id':_0x5bdfd8[_0x1ef260],'closed':!![]});}}})[_0xa320('0x1b')](function(_0x3be495){logger[_0xa320('0x1c')](_0xa320('0x1d'),_0x3be495?util[_0xa320('0x1e')](_0x3be495,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 1d6aea4..65ea8b8 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 _0xc298=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0xc298,0x1d6));var _0x8c29=function(_0x194a15,_0xa6312a){_0x194a15=_0x194a15-0x0;var _0x1fecfe=_0xc298[_0x194a15];return _0x1fecfe;};'use strict';function start(){var _0x42066e=require(_0x8c29('0x0'));return _0x42066e[_0x8c29('0x1')]();}module[_0x8c29('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xda96=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xda96,0x1b2));var _0x6da9=function(_0x4029dd,_0x3e7435){_0x4029dd=_0x4029dd-0x0;var _0x43144c=_0xda96[_0x4029dd];return _0x43144c;};'use strict';function start(){var _0x500ca7=require(_0x6da9('0x0'));return _0x500ca7['startAllRefreshIntervals']();}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 f702601..d17c63e 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 _0xa5ef=['subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','difference','intersection','length','stop','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','add','add\x20cron','exists','deleteJob','stop\x20cron','startAt','endAt','update','update\x20cron','run','start','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','getSmtpOptions','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','%s.%s','basename','savename','zip','existsSync','status','Sent','attachments','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil'];(function(_0xc6d32b,_0x608367){var _0x5d773a=function(_0x2285cc){while(--_0x2285cc){_0xc6d32b['push'](_0xc6d32b['shift']());}};_0x5d773a(++_0x608367);}(_0xa5ef,0x1dc));var _0xfa5e=function(_0x19d813,_0x366b4a){_0x19d813=_0x19d813-0x0;var _0x47fd7b=_0xa5ef[_0x19d813];return _0x47fd7b;};'use strict';var fs=require('fs');var util=require(_0xfa5e('0x0'));var path=require('path');var _=require(_0xfa5e('0x1'));var moment=require(_0xfa5e('0x2'));var CronJobManager=require(_0xfa5e('0x3'));var jayson=require(_0xfa5e('0x4'));var BPromise=require(_0xfa5e('0x5'));var logger=require(_0xfa5e('0x6'))('schedule');var db=require(_0xfa5e('0x7'))['db'];var analyticCustomReportController=require(_0xfa5e('0x8'));var analyticDefaultReportController=require(_0xfa5e('0x9'));var client=jayson[_0xfa5e('0xa')][_0xfa5e('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1669bb,_0x359273){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x1669bb[_0xfa5e('0xc')]);var _0x3e6739=!![];var _0x57cb23=_0x1669bb[_0xfa5e('0xd')][_0xfa5e('0xe')]();var _0x2efd69={'account':_0x57cb23,'message':{'from':util[_0xfa5e('0xf')]('\x22%s\x22\x20<%s>',_0x1669bb['MailAccount'][_0xfa5e('0x10')],_0x1669bb[_0xfa5e('0xd')][_0xfa5e('0xc')]||_0x1669bb[_0xfa5e('0xd')]['Smtp']['user']),'to':_0x1669bb[_0xfa5e('0xc')],'cc':_0x1669bb['cc'],'bcc':_0x1669bb[_0xfa5e('0x11')],'subject':util[_0xfa5e('0xf')](_0xfa5e('0x12'),_0x359273[_0xfa5e('0x10')],_0x1669bb['subtractNumber'],_0x1669bb[_0xfa5e('0x13')])}};var _0x9300b7=path[_0xfa5e('0x14')](__dirname,_0xfa5e('0x15'));var _0x120f62=_0x359273['savename'];var _0xdcfa81=util[_0xfa5e('0xf')](_0xfa5e('0x16'),path[_0xfa5e('0x17')](_0x359273[_0xfa5e('0x18')],path['extname'](_0x359273[_0xfa5e('0x18')])),_0xfa5e('0x19'));var _0x2a0324=path['join'](_0x9300b7,_0x120f62);var _0x22ee34=path[_0xfa5e('0x14')](_0x9300b7,_0xdcfa81);if(fs[_0xfa5e('0x1a')](_0x2a0324)){_0x359273[_0xfa5e('0x1b')]=_0xfa5e('0x1c');_0x2efd69['message'][_0xfa5e('0x1d')]=[{'filename':_0x120f62,'path':_0x2a0324}];_0x2efd69[_0xfa5e('0x1e')]['text']=util[_0xfa5e('0xf')](_0xfa5e('0x1f'),JSON[_0xfa5e('0x20')](_0x359273,null,0x2));}else if(fs[_0xfa5e('0x1a')](_0x22ee34)){_0x359273[_0xfa5e('0x1b')]='Sent';_0x2efd69['message'][_0xfa5e('0x1d')]=[{'filename':_0xdcfa81,'path':_0x22ee34}];}else{_0x2efd69['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1669bb[_0xfa5e('0x21')]){_0x3e6739=![];logger[_0xfa5e('0x22')](_0xfa5e('0x23'));}}if(_0x3e6739){return client[_0xfa5e('0x24')](_0xfa5e('0x25'),_0x2efd69)[_0xfa5e('0x26')](function(_0x5dd391){if(_0x5dd391[_0xfa5e('0x27')]){return logger[_0xfa5e('0x27')](_0xfa5e('0x28'),JSON[_0xfa5e('0x20')](_0x5dd391));}return logger[_0xfa5e('0x22')](_0xfa5e('0x29'));})[_0xfa5e('0x2a')](function(_0x4be8c3){return logger['error'](_0xfa5e('0x28'),JSON['stringify'](_0x4be8c3));});}};}function handleError(){return function(_0x475f74){return logger[_0xfa5e('0x27')](JSON[_0xfa5e('0x20')](_0x475f74));};}function handleResult(_0x41e498){return function(_0x404551){logger['info'](_0xfa5e('0x2b'),JSON[_0xfa5e('0x20')](_0x404551));if(_0x41e498[_0xfa5e('0xd')]&&_0x41e498[_0xfa5e('0xd')][_0xfa5e('0x2c')]&&!_['isNil'](_0x41e498[_0xfa5e('0xc')])){setTimeout(handleSendEmail(_0x41e498,_0x404551),0x3c*0x3e8);}};}function handleJob(_0x419ebd){return function(){try{if(_[_0xfa5e('0x2d')](_0x419ebd[_0xfa5e('0x2e')])){return logger[_0xfa5e('0x22')](_0xfa5e('0x2f'));}if(_[_0xfa5e('0x2d')](_0x419ebd['subtractUnit'])){return logger[_0xfa5e('0x22')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3f89a0={'startDate':moment()[_0xfa5e('0x30')](_0x419ebd[_0xfa5e('0x2e')],_0x419ebd[_0xfa5e('0x13')])[_0xfa5e('0xf')](_0xfa5e('0x31')),'endDate':moment()[_0xfa5e('0xf')](_0xfa5e('0x31')),'type':'scheduled','output':_0x419ebd[_0xfa5e('0x32')],'name':_0x419ebd[_0xfa5e('0x10')]};if(!_['isNil'](_0x419ebd['DefaultReportId'])){logger[_0xfa5e('0x22')](_0xfa5e('0x33'),_0x419ebd[_0xfa5e('0x34')]);return analyticDefaultReportController['runReport']({'id':_0x419ebd[_0xfa5e('0x34')]},_0x3f89a0)[_0xfa5e('0x26')](handleResult(_0x419ebd))[_0xfa5e('0x2a')](handleError());}if(!_[_0xfa5e('0x2d')](_0x419ebd['CustomReportId'])){logger[_0xfa5e('0x22')](_0xfa5e('0x35'),_0x419ebd[_0xfa5e('0x36')]);return analyticCustomReportController[_0xfa5e('0x37')]({'id':_0x419ebd[_0xfa5e('0x36')]},_0x3f89a0)['then'](handleResult(_0x419ebd))[_0xfa5e('0x2a')](handleError());}}catch(_0x153f6f){logger[_0xfa5e('0x27')](JSON['stringify'](_0x153f6f));}return logger[_0xfa5e('0x22')](_0xfa5e('0x38'));};}function getJobs(_0x16a6f8){var _0x4232ad={};if(_0x16a6f8){_0x4232ad['id']=_0x16a6f8;}return db[_0xfa5e('0x39')][_0xfa5e('0x3a')]({'where':_0x4232ad,'include':[{'model':db[_0xfa5e('0xd')],'attributes':['id','name',_0xfa5e('0xc')],'include':[{'model':db[_0xfa5e('0x3b')],'as':_0xfa5e('0x2c'),'include':[{'model':db['CloudProvider'],'as':_0xfa5e('0x3c')}]}]}]})[_0xfa5e('0x26')](function(_0xc34a22){var _0x49ab3e=_[_0xfa5e('0x3d')](manager[_0xfa5e('0x3e')]);var _0x225ac2=_['map'](_0xc34a22,function(_0x30f489){return _0x30f489['id'][_0xfa5e('0x3f')]();});var _0x4ac97a=_['keyBy'](_0xc34a22,function(_0xeb074){return _0xeb074['id']['toString']();});var _0x213fd0=_0x16a6f8?_0x225ac2:_[_0xfa5e('0x40')](_0x225ac2,_0x49ab3e);var _0xaa90f2=_[_0xfa5e('0x41')](_0x225ac2,_0x49ab3e);var _0x18825a=_[_0xfa5e('0x40')](_0x49ab3e,_0x225ac2);var _0x21b472;var _0x180ad8;for(_0x21b472=0x0;_0x21b472<_0x18825a[_0xfa5e('0x42')]&&!_0x16a6f8;_0x21b472+=0x1){_0x180ad8=_0x18825a[_0x21b472]['toString']();if(manager['exists'](_0x180ad8)){manager[_0xfa5e('0x43')](_0x180ad8);manager['deleteJob'](_0x180ad8);logger[_0xfa5e('0x22')]('delete\x20cron',_0x180ad8);}}logger[_0xfa5e('0x22')](_0xfa5e('0x44'),JSON['stringify'](_0x213fd0));for(_0x21b472=0x0;_0x21b472<_0x213fd0[_0xfa5e('0x42')];_0x21b472+=0x1){_0x180ad8=_0x213fd0[_0x21b472]['toString']();logger[_0xfa5e('0x22')](_0xfa5e('0x45'),_0x180ad8);if(_0x16a6f8){logger[_0xfa5e('0x22')](_0xfa5e('0x46'),_0x16a6f8);logger[_0xfa5e('0x22')](JSON[_0xfa5e('0x20')](_0x4ac97a[_0x180ad8]));BPromise[_0xfa5e('0x47')]()[_0xfa5e('0x26')](handleJob(_0x4ac97a[_0x180ad8]));logger[_0xfa5e('0x22')](_0xfa5e('0x48'),_0x4ac97a[_0x180ad8][_0xfa5e('0x10')],_0x4ac97a[_0x180ad8][_0xfa5e('0x49')]);}else if(_0x4ac97a[_0x180ad8][_0xfa5e('0x49')]&&_0x4ac97a[_0x180ad8][_0xfa5e('0x4a')]&&moment()[_0xfa5e('0x4b')](_0x4ac97a[_0x180ad8]['startAt'],_0x4ac97a[_0x180ad8]['endAt'])){manager[_0xfa5e('0x4c')](_0x180ad8,_0x4ac97a[_0x180ad8][_0xfa5e('0x49')],handleJob(_0x4ac97a[_0x180ad8]));manager['start'](_0x180ad8);logger[_0xfa5e('0x22')](_0xfa5e('0x4d'),_0x4ac97a[_0x180ad8][_0xfa5e('0x10')],_0x4ac97a[_0x180ad8][_0xfa5e('0x49')]);}else if(manager[_0xfa5e('0x4e')](_0x180ad8)){manager[_0xfa5e('0x43')](_0x180ad8);manager[_0xfa5e('0x4f')](_0x180ad8);logger[_0xfa5e('0x22')](_0xfa5e('0x50'),_0x4ac97a[_0x180ad8][_0xfa5e('0x10')],_0x4ac97a[_0x180ad8][_0xfa5e('0x49')]);}}for(_0x21b472=0x0,_0x180ad8;_0x21b472<_0xaa90f2['length']&&!_0x16a6f8;_0x21b472+=0x1){_0x180ad8=_0xaa90f2[_0x21b472][_0xfa5e('0x3f')]();if(manager[_0xfa5e('0x4e')](_0x180ad8)){if(_0x4ac97a[_0x180ad8][_0xfa5e('0x49')]&&_0x4ac97a[_0x180ad8][_0xfa5e('0x4a')]&&moment()[_0xfa5e('0x4b')](_0x4ac97a[_0x180ad8][_0xfa5e('0x51')],_0x4ac97a[_0x180ad8][_0xfa5e('0x52')])){manager[_0xfa5e('0x53')](_0x180ad8,_0x4ac97a[_0x180ad8][_0xfa5e('0x49')],handleJob(_0x4ac97a[_0x180ad8]));logger[_0xfa5e('0x22')](_0xfa5e('0x54'),_0x4ac97a[_0x180ad8]['name'],_0x4ac97a[_0x180ad8][_0xfa5e('0x49')]);}else{manager['stop'](_0x180ad8);manager['deleteJob'](_0x180ad8);logger['info'](_0xfa5e('0x50'),_0x4ac97a[_0x180ad8]['name'],_0x4ac97a[_0x180ad8][_0xfa5e('0x49')]);}}}})[_0xfa5e('0x2a')](function(_0xf05156){logger['error'](JSON[_0xfa5e('0x20')](_0xf05156));});}exports[_0xfa5e('0x55')]=function(_0x576851){return getJobs(_0x576851);};exports[_0xfa5e('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7333=['Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','existsSync','status','message','attachments','text','Sent','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','findAll','MailServerOut','CloudProvider','keys','jobs','toString','difference','intersection','length','exists','stop','deleteJob','toRun','index','resolve','cron','active','endAt','add','start','add\x20cron','stop\x20cron','isBetween','startAt','update','update\x20cron','run','util','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','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','bcc'];(function(_0x1b140b,_0x58573e){var _0x4b42ea=function(_0x34f34b){while(--_0x34f34b){_0x1b140b['push'](_0x1b140b['shift']());}};_0x4b42ea(++_0x58573e);}(_0x7333,0x1e7));var _0x3733=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7333[_0x502c7d];return _0x30b7ed;};'use strict';var fs=require('fs');var util=require(_0x3733('0x0'));var path=require(_0x3733('0x1'));var _=require('lodash');var moment=require(_0x3733('0x2'));var CronJobManager=require(_0x3733('0x3'));var jayson=require(_0x3733('0x4'));var BPromise=require(_0x3733('0x5'));var logger=require(_0x3733('0x6'))(_0x3733('0x7'));var db=require(_0x3733('0x8'))['db'];var analyticCustomReportController=require(_0x3733('0x9'));var analyticDefaultReportController=require(_0x3733('0xa'));var client=jayson[_0x3733('0xb')][_0x3733('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x550079,_0x52d940){return function(){logger[_0x3733('0xd')](_0x3733('0xe'),_0x550079[_0x3733('0xf')]);var _0x378a88=!![];var _0x2b46d1=_0x550079[_0x3733('0x10')][_0x3733('0x11')]();var _0x5802da={'account':_0x2b46d1,'message':{'from':util[_0x3733('0x12')](_0x3733('0x13'),_0x550079[_0x3733('0x10')]['name'],_0x550079[_0x3733('0x10')][_0x3733('0xf')]||_0x550079[_0x3733('0x10')][_0x3733('0x14')][_0x3733('0x15')]),'to':_0x550079[_0x3733('0xf')],'cc':_0x550079['cc'],'bcc':_0x550079[_0x3733('0x16')],'subject':util[_0x3733('0x12')](_0x3733('0x17'),_0x52d940[_0x3733('0x18')],_0x550079[_0x3733('0x19')],_0x550079['subtractUnit'])}};var _0x16590b=path[_0x3733('0x1a')](__dirname,_0x3733('0x1b'));var _0x15035d=_0x52d940['savename'];var _0x5986d3=util['format'](_0x3733('0x1c'),path[_0x3733('0x1d')](_0x52d940[_0x3733('0x1e')],path[_0x3733('0x1f')](_0x52d940[_0x3733('0x1e')])),'zip');var _0x26ae2c=path[_0x3733('0x1a')](_0x16590b,_0x15035d);var _0x26b6d1=path[_0x3733('0x1a')](_0x16590b,_0x5986d3);if(fs[_0x3733('0x20')](_0x26ae2c)){_0x52d940[_0x3733('0x21')]='Sent';_0x5802da[_0x3733('0x22')][_0x3733('0x23')]=[{'filename':_0x15035d,'path':_0x26ae2c}];_0x5802da[_0x3733('0x22')][_0x3733('0x24')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x52d940,null,0x2));}else if(fs[_0x3733('0x20')](_0x26b6d1)){_0x52d940[_0x3733('0x21')]=_0x3733('0x25');_0x5802da[_0x3733('0x22')][_0x3733('0x23')]=[{'filename':_0x5986d3,'path':_0x26b6d1}];}else{_0x5802da['message'][_0x3733('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x550079[_0x3733('0x26')]){_0x378a88=![];logger[_0x3733('0xd')](_0x3733('0x27'));}}if(_0x378a88){return client['request'](_0x3733('0x28'),_0x5802da)[_0x3733('0x29')](function(_0x3c2ccd){if(_0x3c2ccd[_0x3733('0x2a')]){return logger[_0x3733('0x2a')](_0x3733('0x2b'),JSON[_0x3733('0x2c')](_0x3c2ccd));}return logger['info'](_0x3733('0x2d'));})[_0x3733('0x2e')](function(_0x2586ac){return logger[_0x3733('0x2a')](_0x3733('0x2b'),JSON[_0x3733('0x2c')](_0x2586ac));});}};}function handleError(){return function(_0x36424c){return logger[_0x3733('0x2a')](JSON[_0x3733('0x2c')](_0x36424c));};}function handleResult(_0x210a0f){return function(_0x49fb81){logger[_0x3733('0xd')]('data',JSON[_0x3733('0x2c')](_0x49fb81));if(_0x210a0f[_0x3733('0x10')]&&_0x210a0f[_0x3733('0x10')][_0x3733('0x14')]&&!_[_0x3733('0x2f')](_0x210a0f[_0x3733('0xf')])){setTimeout(handleSendEmail(_0x210a0f,_0x49fb81),0x3c*0x3e8);}};}function handleJob(_0x577ad5){return function(){try{if(_[_0x3733('0x2f')](_0x577ad5[_0x3733('0x19')])){return logger[_0x3733('0xd')](_0x3733('0x30'));}if(_[_0x3733('0x2f')](_0x577ad5[_0x3733('0x31')])){return logger['info'](_0x3733('0x32'));}var _0x26c985={'startDate':moment()[_0x3733('0x33')](_0x577ad5[_0x3733('0x19')],_0x577ad5[_0x3733('0x31')])[_0x3733('0x12')](_0x3733('0x34')),'endDate':moment()['format'](_0x3733('0x34')),'type':_0x3733('0x35'),'output':_0x577ad5[_0x3733('0x36')],'name':_0x577ad5[_0x3733('0x18')]};if(!_[_0x3733('0x2f')](_0x577ad5[_0x3733('0x37')])){logger[_0x3733('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x577ad5[_0x3733('0x37')]);return analyticDefaultReportController[_0x3733('0x38')]({'id':_0x577ad5[_0x3733('0x37')]},_0x26c985)[_0x3733('0x29')](handleResult(_0x577ad5))[_0x3733('0x2e')](handleError());}if(!_[_0x3733('0x2f')](_0x577ad5['CustomReportId'])){logger[_0x3733('0xd')]('exec\x20custom\x20report\x20id:%s',_0x577ad5[_0x3733('0x39')]);return analyticCustomReportController[_0x3733('0x38')]({'id':_0x577ad5[_0x3733('0x39')]},_0x26c985)['then'](handleResult(_0x577ad5))['catch'](handleError());}}catch(_0x55bea5){logger['error'](JSON[_0x3733('0x2c')](_0x55bea5));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x1f7d55){var _0x83fec8={};if(_0x1f7d55){_0x83fec8['id']=_0x1f7d55;}return db['Schedule'][_0x3733('0x3a')]({'where':_0x83fec8,'include':[{'model':db[_0x3733('0x10')],'attributes':['id',_0x3733('0x18'),_0x3733('0xf')],'include':[{'model':db[_0x3733('0x3b')],'as':'Smtp','include':[{'model':db[_0x3733('0x3c')],'as':_0x3733('0x3c')}]}]}]})[_0x3733('0x29')](function(_0x15c9bc){var _0x2f8a39=_[_0x3733('0x3d')](manager[_0x3733('0x3e')]);var _0x411d45=_['map'](_0x15c9bc,function(_0xc71cad){return _0xc71cad['id'][_0x3733('0x3f')]();});var _0x168d04=_['keyBy'](_0x15c9bc,function(_0x84ed26){return _0x84ed26['id']['toString']();});var _0x299dc1=_0x1f7d55?_0x411d45:_[_0x3733('0x40')](_0x411d45,_0x2f8a39);var _0x103605=_[_0x3733('0x41')](_0x411d45,_0x2f8a39);var _0x454535=_[_0x3733('0x40')](_0x2f8a39,_0x411d45);var _0x1cf7ea;var _0x483578;for(_0x1cf7ea=0x0;_0x1cf7ea<_0x454535[_0x3733('0x42')]&&!_0x1f7d55;_0x1cf7ea+=0x1){_0x483578=_0x454535[_0x1cf7ea]['toString']();if(manager[_0x3733('0x43')](_0x483578)){manager[_0x3733('0x44')](_0x483578);manager[_0x3733('0x45')](_0x483578);logger['info']('delete\x20cron',_0x483578);}}logger[_0x3733('0xd')](_0x3733('0x46'),JSON[_0x3733('0x2c')](_0x299dc1));for(_0x1cf7ea=0x0;_0x1cf7ea<_0x299dc1[_0x3733('0x42')];_0x1cf7ea+=0x1){_0x483578=_0x299dc1[_0x1cf7ea][_0x3733('0x3f')]();logger[_0x3733('0xd')](_0x3733('0x47'),_0x483578);if(_0x1f7d55){logger['info']('my\x20id',_0x1f7d55);logger['info'](JSON['stringify'](_0x168d04[_0x483578]));BPromise[_0x3733('0x48')]()[_0x3733('0x29')](handleJob(_0x168d04[_0x483578]));logger['info']('run\x20job',_0x168d04[_0x483578][_0x3733('0x18')],_0x168d04[_0x483578]['cron']);}else if(_0x168d04[_0x483578][_0x3733('0x49')]&&_0x168d04[_0x483578][_0x3733('0x4a')]&&moment()['isBetween'](_0x168d04[_0x483578]['startAt'],_0x168d04[_0x483578][_0x3733('0x4b')])){manager[_0x3733('0x4c')](_0x483578,_0x168d04[_0x483578][_0x3733('0x49')],handleJob(_0x168d04[_0x483578]));manager[_0x3733('0x4d')](_0x483578);logger[_0x3733('0xd')](_0x3733('0x4e'),_0x168d04[_0x483578]['name'],_0x168d04[_0x483578][_0x3733('0x49')]);}else if(manager[_0x3733('0x43')](_0x483578)){manager[_0x3733('0x44')](_0x483578);manager[_0x3733('0x45')](_0x483578);logger[_0x3733('0xd')](_0x3733('0x4f'),_0x168d04[_0x483578][_0x3733('0x18')],_0x168d04[_0x483578][_0x3733('0x49')]);}}for(_0x1cf7ea=0x0,_0x483578;_0x1cf7ea<_0x103605[_0x3733('0x42')]&&!_0x1f7d55;_0x1cf7ea+=0x1){_0x483578=_0x103605[_0x1cf7ea][_0x3733('0x3f')]();if(manager[_0x3733('0x43')](_0x483578)){if(_0x168d04[_0x483578][_0x3733('0x49')]&&_0x168d04[_0x483578]['active']&&moment()[_0x3733('0x50')](_0x168d04[_0x483578][_0x3733('0x51')],_0x168d04[_0x483578][_0x3733('0x4b')])){manager[_0x3733('0x52')](_0x483578,_0x168d04[_0x483578][_0x3733('0x49')],handleJob(_0x168d04[_0x483578]));logger['info'](_0x3733('0x53'),_0x168d04[_0x483578][_0x3733('0x18')],_0x168d04[_0x483578]['cron']);}else{manager[_0x3733('0x44')](_0x483578);manager[_0x3733('0x45')](_0x483578);logger[_0x3733('0xd')](_0x3733('0x4f'),_0x168d04[_0x483578][_0x3733('0x18')],_0x168d04[_0x483578][_0x3733('0x49')]);}}}})[_0x3733('0x2e')](function(_0x511951){logger['error'](JSON[_0x3733('0x2c')](_0x511951));});}exports[_0x3733('0x54')]=function(_0xca0cf8){return getJobs(_0xca0cf8);};exports[_0x3733('0x4d')]=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 28d467d..e21ed45 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 _0x1752=['update','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribe','transcribeAccountId','Cloud\x20Provider\x20not\x20available','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Cloud\x20Provider\x20not\x20configured','language','SentimentScore','Negative','Mixed','Neutral','FAILED'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x1752,0xa5));var _0x2175=function(_0x2c3e10,_0x3424cf){_0x2c3e10=_0x2c3e10-0x0;var _0x45a59d=_0x1752[_0x2c3e10];return _0x45a59d;};var _=require('lodash');var AWS=require(_0x2175('0x0'));var rp=require(_0x2175('0x1'));var util=require(_0x2175('0x2'));var BPromise=require(_0x2175('0x3'));var db=require(_0x2175('0x4'))['db'];var logger=require(_0x2175('0x5'))('transcribe');function getTranscriptionJob(_0x1ee277,_0x22c167,_0x12b8d9,_0xe55453){return new Promise(function(_0x222868,_0x27ff0b){var _0x19ca87=new AWS[(_0x2175('0x6'))]({'accessKeyId':_0x22c167,'secretAccessKey':_0x1ee277,'region':_0x12b8d9});_0x19ca87[_0x2175('0x7')]({'TranscriptionJobName':_0xe55453},function(_0x672ff1,_0x516ccc){if(_0x672ff1){return _0x27ff0b(_0x672ff1);}else{return _0x222868(_0x516ccc);}});});}function sentiment(_0x4e818f,_0xa39599,_0x407a71,_0x455803,_0x77e3fa){return new Promise(function(_0x4be8c8,_0x5ad5ad){var _0x5717b0=new AWS[(_0x2175('0x8'))]({'accessKeyId':_0xa39599,'secretAccessKey':_0x4e818f,'region':_0x407a71});_0x5717b0['detectSentiment']({'Text':_0x455803,'LanguageCode':_0x77e3fa['substring'](0x0,0x2)},function(_0x510de5,_0x4fa5eb){if(_0x510de5){return _0x5ad5ad(_0x510de5);}else{return _0x4be8c8(_0x4fa5eb);}});});}function checkTranscribeJob(_0x453acd,_0x5bc446,_0x43be3c){var _0x393c02;return new BPromise(function(_0x49522e,_0x20477e){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0xb'),_0x453acd['id'],_0x453acd[_0x2175('0xc')]));return getTranscriptionJob(_0x43be3c[_0x2175('0xd')],_0x43be3c[_0x2175('0xe')],_0x5bc446[_0x2175('0xf')],_0x453acd['transcribeName'])['then'](function(_0x371b42){logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x453acd['id'],_0x453acd['transcribeName'],_0x371b42['TranscriptionJob'][_0x2175('0x10')]));if(!_0x453acd[_0x2175('0x11')]){switch(_0x371b42['TranscriptionJob']['TranscriptionJobStatus']){case _0x2175('0x12'):var _0x3d6467={'transcribeStatus':_0x371b42[_0x2175('0x13')]['TranscriptionJobStatus'],'fileUri':_0x371b42[_0x2175('0x13')]['Transcript'][_0x2175('0x14')]};logger['info'](util[_0x2175('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x453acd['id']));return rp({'uri':_0x371b42['TranscriptionJob']['Transcript'][_0x2175('0x14')],'json':!![]})['then'](function(_0x28c4b8){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x15'),_0x453acd['id']));if(_0x28c4b8&&_0x28c4b8[_0x2175('0x16')]&&_0x28c4b8[_0x2175('0x16')]['transcripts']&&_0x28c4b8[_0x2175('0x16')][_0x2175('0x17')][_0x2175('0x18')]){_0x3d6467[_0x2175('0x11')]='';for(var _0x495887=0x0;_0x495887<_0x28c4b8['results'][_0x2175('0x17')][_0x2175('0x18')];_0x495887++){_0x3d6467[_0x2175('0x11')]+=_0x28c4b8['results'][_0x2175('0x17')][_0x495887]['transcript']+'';}}return _0x453acd['update'](_0x3d6467);})[_0x2175('0x19')](function(){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x1a'),_0x453acd['id']));if(!_0x453acd[_0x2175('0x1b')]){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))](_0x2175('0x1e'));}if(!_0x5bc446[_0x2175('0x1f')]||!_0x5bc446[_0x2175('0x20')]||!_0x5bc446[_0x2175('0x21')]||!_0x5bc446['language']||!_0x5bc446[_0x2175('0x22')]){throw new db[(_0x2175('0x1c'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3d6467[_0x2175('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x5bc446[_0x2175('0x20')]===_0x43be3c['id']){return _0x43be3c;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2175('0x19')](function(_0x2811b6){if(!_0x2811b6){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2811b6[_0x2175('0xd')]||!_0x2811b6[_0x2175('0xe')]){throw new db['Sequelize'][(_0x2175('0x1d'))](_0x2175('0x23'));}_0x393c02=_0x2811b6;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x453acd['id']));return sentiment(_0x393c02['data1'],_0x393c02[_0x2175('0xe')],_0x5bc446[_0x2175('0x21')],_0x3d6467[_0x2175('0x11')],_0x5bc446[_0x2175('0x24')]);})[_0x2175('0x19')](function(_0x25cce5){logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x453acd['id']));return _0x453acd['update']({'sentiment':_0x25cce5['Sentiment'],'sPositive':_0x25cce5['SentimentScore']['Positive'],'sNegative':_0x25cce5[_0x2175('0x25')][_0x2175('0x26')],'sMixed':_0x25cce5['SentimentScore'][_0x2175('0x27')],'sNeutral':_0x25cce5[_0x2175('0x25')][_0x2175('0x28')]});})[_0x2175('0x19')](function(){logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x453acd['id']));_0x49522e();});case _0x2175('0x29'):return _0x453acd[_0x2175('0x2a')]({'transcribeStatus':_0x2175('0x29'),'failureReason':_0x371b42[_0x2175('0x13')][_0x2175('0x2b')]})[_0x2175('0x19')](function(){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x1a'),_0x453acd['id']));_0x49522e();});default:logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x453acd['id']));break;}}else{return BPromise[_0x2175('0x2c')]()[_0x2175('0x19')](function(){if(!_0x453acd[_0x2175('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x2175('0x1e'));}if(!_0x5bc446['sentiment']||!_0x5bc446[_0x2175('0x20')]||!_0x5bc446[_0x2175('0x21')]||!_0x5bc446[_0x2175('0x24')]||!_0x5bc446['bucket']){throw new db['Sequelize'][(_0x2175('0x1d'))](_0x2175('0x2d'));}if(!_0x453acd['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5bc446[_0x2175('0x20')]===_0x43be3c['id']){return _0x43be3c;}else{return db[_0x2175('0x2e')][_0x2175('0x2f')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2175('0x19')](function(_0x4343f9){if(!_0x4343f9){throw new db[(_0x2175('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4343f9[_0x2175('0xd')]||!_0x4343f9['data2']){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x393c02=_0x4343f9;logger['info'](util['format'](_0x2175('0x30'),_0x453acd['id']));return sentiment(_0x393c02['data1'],_0x393c02['data2'],_0x5bc446[_0x2175('0x21')],_0x453acd['fileText'],_0x5bc446[_0x2175('0x24')]);})[_0x2175('0x19')](function(_0x246e16){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x31'),_0x453acd['id']));return _0x453acd['update']({'sentiment':_0x246e16[_0x2175('0x32')],'sPositive':_0x246e16[_0x2175('0x25')][_0x2175('0x33')],'sNegative':_0x246e16[_0x2175('0x25')][_0x2175('0x26')],'sMixed':_0x246e16[_0x2175('0x25')]['Mixed'],'sNeutral':_0x246e16[_0x2175('0x25')][_0x2175('0x28')],'transcribeStatus':_0x2175('0x12')});})['then'](function(){logger[_0x2175('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x453acd['id']));_0x49522e();});}})[_0x2175('0x34')](function(_0x2792c0){if(_0x2792c0){if(!_0x2792c0[_0x2175('0x35')]||_0x2792c0['name']!==_0x2175('0x36')){logger[_0x2175('0x37')](util[_0x2175('0xa')](_0x2175('0x38'),_0x453acd['id']),util[_0x2175('0x39')](_0x2792c0,{'showHidden':![],'depth':null}));}}_0x49522e();});});}function checkTranscribe(){var _0x5c1a8d;var _0x58ef93;var _0xdb0a97;return db[_0x2175('0x3a')][_0x2175('0x3b')]({'where':{'transcribeStatus':_0x2175('0x3c')}})[_0x2175('0x19')](function(_0x47b8ae){if(!_0x47b8ae||!_0x47b8ae[_0x2175('0x18')]){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x5c1a8d=_0x47b8ae;return db['Setting'][_0x2175('0x2f')]({'where':{'id':0x1}});})['then'](function(_0x5af419){if(!_0x5af419){throw new db['Sequelize']['ValidationError'](_0x2175('0x3d'));}_0x58ef93=_0x5af419;if(!_0x58ef93[_0x2175('0x3e')]||!_0x58ef93['transcribeAccountId']||!_0x58ef93['transcribeRegion']||!_0x58ef93['language']||!_0x58ef93['bucket']){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x2175('0x2f')]({'where':{'id':_0x58ef93[_0x2175('0x3f')]}});})[_0x2175('0x19')](function(_0xce807c){if(!_0xce807c){throw new db[(_0x2175('0x1c'))]['ValidationError'](_0x2175('0x40'));}if(!_0xce807c['data1']||!_0xce807c[_0x2175('0xe')]){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))](_0x2175('0x23'));}_0xdb0a97=_0xce807c;var _0x1fc25a=[];_0x5c1a8d[_0x2175('0x41')](function(_0x197a88){_0x1fc25a[_0x2175('0x42')](checkTranscribeJob(_0x197a88,_0x58ef93,_0xdb0a97));});return BPromise[_0x2175('0x43')](_0x1fc25a);})[_0x2175('0x34')](function(_0x1f967d){if(_0x1f967d){if(!_0x1f967d[_0x2175('0x35')]||_0x1f967d[_0x2175('0x35')]!==_0x2175('0x36')){logger[_0x2175('0x37')](util['inspect'](_0x1f967d,{'showHidden':![],'depth':null}));}}});}exports[_0x2175('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x325b=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','findOne','data1','Positive','COMPLETED','catch','name','SequelizeValidationError','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format'];(function(_0x372f66,_0x37968d){var _0x4944f5=function(_0x48881e){while(--_0x48881e){_0x372f66['push'](_0x372f66['shift']());}};_0x4944f5(++_0x37968d);}(_0x325b,0x8b));var _0xb325=function(_0x2be5c8,_0x42f4a7){_0x2be5c8=_0x2be5c8-0x0;var _0x47c7d2=_0x325b[_0x2be5c8];return _0x47c7d2;};var _=require(_0xb325('0x0'));var AWS=require(_0xb325('0x1'));var rp=require(_0xb325('0x2'));var util=require('util');var BPromise=require(_0xb325('0x3'));var db=require(_0xb325('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x3a6c20,_0xca6c44,_0x33f59a,_0x4947d6){return new Promise(function(_0x4a1ea8,_0x33dcfc){var _0x5a241f=new AWS[(_0xb325('0x5'))]({'accessKeyId':_0xca6c44,'secretAccessKey':_0x3a6c20,'region':_0x33f59a});_0x5a241f[_0xb325('0x6')]({'TranscriptionJobName':_0x4947d6},function(_0xda4fa3,_0x170d60){if(_0xda4fa3){return _0x33dcfc(_0xda4fa3);}else{return _0x4a1ea8(_0x170d60);}});});}function sentiment(_0x8d97d5,_0x28910a,_0xb008cb,_0x237201,_0x468dd8){return new Promise(function(_0x255cee,_0x1d8ef4){var _0x1b5240=new AWS[(_0xb325('0x7'))]({'accessKeyId':_0x28910a,'secretAccessKey':_0x8d97d5,'region':_0xb008cb});_0x1b5240[_0xb325('0x8')]({'Text':_0x237201,'LanguageCode':_0x468dd8['substring'](0x0,0x2)},function(_0x1a89b5,_0xff2cc3){if(_0x1a89b5){return _0x1d8ef4(_0x1a89b5);}else{return _0x255cee(_0xff2cc3);}});});}function checkTranscribeJob(_0x3d0e2d,_0x1ee42f,_0x4ac26f){var _0x306758;return new BPromise(function(_0x291b26,_0x516175){logger[_0xb325('0x9')](util[_0xb325('0xa')](_0xb325('0xb'),_0x3d0e2d['id'],_0x3d0e2d[_0xb325('0xc')]));return getTranscriptionJob(_0x4ac26f['data1'],_0x4ac26f[_0xb325('0xd')],_0x1ee42f[_0xb325('0xe')],_0x3d0e2d[_0xb325('0xc')])[_0xb325('0xf')](function(_0x2d7398){logger[_0xb325('0x9')](util[_0xb325('0xa')](_0xb325('0x10'),_0x3d0e2d['id'],_0x3d0e2d['transcribeName'],_0x2d7398[_0xb325('0x11')]['TranscriptionJobStatus']));if(!_0x3d0e2d[_0xb325('0x12')]){switch(_0x2d7398[_0xb325('0x11')][_0xb325('0x13')]){case'COMPLETED':var _0x1a527c={'transcribeStatus':_0x2d7398[_0xb325('0x11')][_0xb325('0x13')],'fileUri':_0x2d7398[_0xb325('0x11')][_0xb325('0x14')][_0xb325('0x15')]};logger[_0xb325('0x9')](util[_0xb325('0xa')](_0xb325('0x16'),_0x3d0e2d['id']));return rp({'uri':_0x2d7398[_0xb325('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0xb325('0xf')](function(_0x40e111){logger[_0xb325('0x9')](util[_0xb325('0xa')](_0xb325('0x17'),_0x3d0e2d['id']));if(_0x40e111&&_0x40e111[_0xb325('0x18')]&&_0x40e111[_0xb325('0x18')]['transcripts']&&_0x40e111[_0xb325('0x18')][_0xb325('0x19')][_0xb325('0x1a')]){_0x1a527c[_0xb325('0x12')]='';for(var _0x188369=0x0;_0x188369<_0x40e111[_0xb325('0x18')]['transcripts'][_0xb325('0x1a')];_0x188369++){_0x1a527c[_0xb325('0x12')]+=_0x40e111[_0xb325('0x18')]['transcripts'][_0x188369][_0xb325('0x1b')]+'';}}return _0x3d0e2d[_0xb325('0x1c')](_0x1a527c);})[_0xb325('0xf')](function(){logger[_0xb325('0x9')](util[_0xb325('0xa')](_0xb325('0x1d'),_0x3d0e2d['id']));if(!_0x3d0e2d[_0xb325('0x1e')]){throw new db['Sequelize'][(_0xb325('0x1f'))](_0xb325('0x20'));}if(!_0x1ee42f[_0xb325('0x21')]||!_0x1ee42f['sentimentAccountId']||!_0x1ee42f[_0xb325('0x22')]||!_0x1ee42f[_0xb325('0x23')]||!_0x1ee42f[_0xb325('0x24')]){throw new db[(_0xb325('0x25'))][(_0xb325('0x1f'))](_0xb325('0x26'));}if(!_0x1a527c['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x1ee42f[_0xb325('0x27')]===_0x4ac26f['id']){return _0x4ac26f;}else{return db[_0xb325('0x28')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xb325('0xf')](function(_0xf1881f){if(!_0xf1881f){throw new db[(_0xb325('0x25'))]['ValidationError'](_0xb325('0x29'));}if(!_0xf1881f['data1']||!_0xf1881f['data2']){throw new db[(_0xb325('0x25'))][(_0xb325('0x1f'))](_0xb325('0x2a'));}_0x306758=_0xf1881f;logger[_0xb325('0x9')](util[_0xb325('0xa')](_0xb325('0x2b'),_0x3d0e2d['id']));return sentiment(_0x306758['data1'],_0x306758[_0xb325('0xd')],_0x1ee42f['sentimentRegion'],_0x1a527c[_0xb325('0x12')],_0x1ee42f['language']);})[_0xb325('0xf')](function(_0x9a2561){logger[_0xb325('0x9')](util['format'](_0xb325('0x2c'),_0x3d0e2d['id']));return _0x3d0e2d['update']({'sentiment':_0x9a2561[_0xb325('0x2d')],'sPositive':_0x9a2561[_0xb325('0x2e')]['Positive'],'sNegative':_0x9a2561[_0xb325('0x2e')][_0xb325('0x2f')],'sMixed':_0x9a2561['SentimentScore'][_0xb325('0x30')],'sNeutral':_0x9a2561[_0xb325('0x2e')][_0xb325('0x31')]});})[_0xb325('0xf')](function(){logger[_0xb325('0x9')](util[_0xb325('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3d0e2d['id']));_0x291b26();});case _0xb325('0x32'):return _0x3d0e2d['update']({'transcribeStatus':_0xb325('0x32'),'failureReason':_0x2d7398['TranscriptionJob'][_0xb325('0x33')]})[_0xb325('0xf')](function(){logger['info'](util[_0xb325('0xa')](_0xb325('0x1d'),_0x3d0e2d['id']));_0x291b26();});default:logger[_0xb325('0x9')](util['format'](_0xb325('0x34'),_0x3d0e2d['id']));break;}}else{return BPromise[_0xb325('0x35')]()['then'](function(){if(!_0x3d0e2d[_0xb325('0x1e')]){throw new db[(_0xb325('0x25'))]['ValidationError'](_0xb325('0x20'));}if(!_0x1ee42f['sentiment']||!_0x1ee42f['sentimentAccountId']||!_0x1ee42f[_0xb325('0x22')]||!_0x1ee42f[_0xb325('0x23')]||!_0x1ee42f['bucket']){throw new db[(_0xb325('0x25'))]['ValidationError'](_0xb325('0x26'));}if(!_0x3d0e2d[_0xb325('0x12')]){throw new Error(_0xb325('0x36'));}if(_0x1ee42f['sentimentAccountId']===_0x4ac26f['id']){return _0x4ac26f;}else{return db['CloudProvider'][_0xb325('0x37')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x57fe41){if(!_0x57fe41){throw new db[(_0xb325('0x25'))][(_0xb325('0x1f'))](_0xb325('0x29'));}if(!_0x57fe41[_0xb325('0x38')]||!_0x57fe41[_0xb325('0xd')]){throw new db['Sequelize'][(_0xb325('0x1f'))](_0xb325('0x2a'));}_0x306758=_0x57fe41;logger['info'](util['format'](_0xb325('0x2b'),_0x3d0e2d['id']));return sentiment(_0x306758['data1'],_0x306758[_0xb325('0xd')],_0x1ee42f[_0xb325('0x22')],_0x3d0e2d['fileText'],_0x1ee42f[_0xb325('0x23')]);})[_0xb325('0xf')](function(_0x1b612a){logger[_0xb325('0x9')](util['format'](_0xb325('0x2c'),_0x3d0e2d['id']));return _0x3d0e2d[_0xb325('0x1c')]({'sentiment':_0x1b612a[_0xb325('0x2d')],'sPositive':_0x1b612a[_0xb325('0x2e')][_0xb325('0x39')],'sNegative':_0x1b612a[_0xb325('0x2e')]['Negative'],'sMixed':_0x1b612a[_0xb325('0x2e')][_0xb325('0x30')],'sNeutral':_0x1b612a[_0xb325('0x2e')]['Neutral'],'transcribeStatus':_0xb325('0x3a')});})[_0xb325('0xf')](function(){logger[_0xb325('0x9')](util[_0xb325('0xa')](_0xb325('0x1d'),_0x3d0e2d['id']));_0x291b26();});}})[_0xb325('0x3b')](function(_0x5e26ac){if(_0x5e26ac){if(!_0x5e26ac['name']||_0x5e26ac[_0xb325('0x3c')]!==_0xb325('0x3d')){logger['error'](util[_0xb325('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3d0e2d['id']),util[_0xb325('0x3e')](_0x5e26ac,{'showHidden':![],'depth':null}));}}_0x291b26();});});}function checkTranscribe(){var _0x48bcd7;var _0x5a8c1f;var _0x41e4c9;return db['VoiceRecording'][_0xb325('0x3f')]({'where':{'transcribeStatus':_0xb325('0x40')}})['then'](function(_0x2573d1){if(!_0x2573d1||!_0x2573d1['length']){throw new db['Sequelize']['ValidationError'](_0xb325('0x41'));}_0x48bcd7=_0x2573d1;return db[_0xb325('0x42')][_0xb325('0x37')]({'where':{'id':0x1}});})['then'](function(_0x5a221a){if(!_0x5a221a){throw new db[(_0xb325('0x25'))][(_0xb325('0x1f'))]('Settings\x20not\x20available');}_0x5a8c1f=_0x5a221a;if(!_0x5a8c1f[_0xb325('0x43')]||!_0x5a8c1f[_0xb325('0x44')]||!_0x5a8c1f[_0xb325('0xe')]||!_0x5a8c1f['language']||!_0x5a8c1f[_0xb325('0x24')]){throw new db['Sequelize'][(_0xb325('0x1f'))](_0xb325('0x45'));}return db['CloudProvider'][_0xb325('0x37')]({'where':{'id':_0x5a8c1f[_0xb325('0x44')]}});})[_0xb325('0xf')](function(_0x315fc7){if(!_0x315fc7){throw new db[(_0xb325('0x25'))][(_0xb325('0x1f'))](_0xb325('0x29'));}if(!_0x315fc7[_0xb325('0x38')]||!_0x315fc7[_0xb325('0xd')]){throw new db[(_0xb325('0x25'))][(_0xb325('0x1f'))](_0xb325('0x2a'));}_0x41e4c9=_0x315fc7;var _0x3b682c=[];_0x48bcd7[_0xb325('0x46')](function(_0x37f062){_0x3b682c[_0xb325('0x47')](checkTranscribeJob(_0x37f062,_0x5a8c1f,_0x41e4c9));});return BPromise[_0xb325('0x48')](_0x3b682c);})['catch'](function(_0xe27702){if(_0xe27702){if(!_0xe27702[_0xb325('0x3c')]||_0xe27702['name']!==_0xb325('0x3d')){logger[_0xb325('0x49')](util[_0xb325('0x3e')](_0xe27702,{'showHidden':![],'depth':null}));}}});}exports[_0xb325('0x4a')]=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 ffa56c5..3bba8f5 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 _0x0984=['socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','format','YYYY-MM-DD\x20HH:mm:ss','then','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','inspect','lodash','moment','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost'];(function(_0x145af7,_0x4953bb){var _0x1dfcfb=function(_0x4d2cab){while(--_0x4d2cab){_0x145af7['push'](_0x145af7['shift']());}};_0x1dfcfb(++_0x4953bb);}(_0x0984,0x9f));var _0x4098=function(_0x857149,_0x33a620){_0x857149=_0x857149-0x0;var _0x4a34e0=_0x0984[_0x857149];return _0x4a34e0;};'use strict';var _=require(_0x4098('0x0'));var moment=require(_0x4098('0x1'));var Redis=require('ioredis');var util=require(_0x4098('0x2'));var config=require(_0x4098('0x3'));var db=require(_0x4098('0x4'))['db'];var logger=require(_0x4098('0x5'))('schedule');config['redis']=_[_0x4098('0x6')](config[_0x4098('0x7')],{'host':_0x4098('0x8'),'port':0x18eb});var io=require(_0x4098('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x43e1a2=[];return db[_0x4098('0xa')][_0x4098('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4098('0xc')](0x18,_0x4098('0xd'))}}})['then'](function(_0x18fb97){if(_0x18fb97&&_0x18fb97['length']){_0x43e1a2=_[_0x4098('0xe')](_0x18fb97||[],'id');logger['info'](_0x4098('0xf'),_0x43e1a2[_0x4098('0x10')]());return db[_0x4098('0xa')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x4098('0x11')](_0x4098('0x12'))},{'where':{'id':_0x43e1a2}});}})[_0x4098('0x13')](function(){if(_0x43e1a2&&_0x43e1a2[_0x4098('0x14')]){logger[_0x4098('0x15')](_0x4098('0x16'),_0x43e1a2['join']());for(var _0x47f445=0x0;_0x47f445<_0x43e1a2[_0x4098('0x14')];_0x47f445++){io['emit']('whatsappInteraction:update',{'id':_0x43e1a2[_0x47f445],'closed':!![]});}}})['catch'](function(_0x593c07){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x593c07?util[_0x4098('0x17')](_0x593c07,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x733f=['[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','emit'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x733f,0x120));var _0xf733=function(_0x3e7540,_0x2ca590){_0x3e7540=_0x3e7540-0x0;var _0x353d6a=_0x733f[_0x3e7540];return _0x353d6a;};'use strict';var _=require(_0xf733('0x0'));var moment=require('moment');var Redis=require(_0xf733('0x1'));var util=require(_0xf733('0x2'));var config=require(_0xf733('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xf733('0x4'))(_0xf733('0x5'));config[_0xf733('0x6')]=_[_0xf733('0x7')](config[_0xf733('0x6')],{'host':_0xf733('0x8'),'port':0x18eb});var io=require(_0xf733('0x9'))(new Redis(config[_0xf733('0x6')]));function closeInteractions(){var _0x2390fc=[];return db['WhatsappInteraction'][_0xf733('0xa')]({'raw':!![],'attributes':['id',_0xf733('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf733('0xc'))}}})[_0xf733('0xd')](function(_0x269e83){if(_0x269e83&&_0x269e83[_0xf733('0xe')]){_0x2390fc=_['map'](_0x269e83||[],'id');logger[_0xf733('0xf')](_0xf733('0x10'),_0x2390fc[_0xf733('0x11')]());return db[_0xf733('0x12')][_0xf733('0x13')]({'closeReason':_0xf733('0x14'),'disposition':_0xf733('0x15'),'closed':!![],'closedAt':moment()['format'](_0xf733('0x16'))},{'where':{'id':_0x2390fc}});}})[_0xf733('0xd')](function(){if(_0x2390fc&&_0x2390fc[_0xf733('0xe')]){logger[_0xf733('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2390fc[_0xf733('0x11')]());for(var _0x8be849=0x0;_0x8be849<_0x2390fc['length'];_0x8be849++){io[_0xf733('0x17')]('whatsappInteraction:update',{'id':_0x2390fc[_0x8be849],'closed':!![]});}}})['catch'](function(_0x17610f){logger['error'](_0xf733('0x18'),_0x17610f?util['inspect'](_0x17610f,{'showHidden':![],'depth':null}):'');});}exports[_0xf733('0x19')]=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 c31b6e8..daaecea 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1763=['contacts1','CmHopper','hopper1','hopper2','catch','util','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating'];(function(_0x56425f,_0x1d0a9f){var _0x3e827a=function(_0x5ad00b){while(--_0x5ad00b){_0x56425f['push'](_0x56425f['shift']());}};_0x3e827a(++_0x1d0a9f);}(_0x1763,0x1c7));var _0x3176=function(_0xcfa0ea,_0x5b9d56){_0xcfa0ea=_0xcfa0ea-0x0;var _0x429ee3=_0x1763[_0xcfa0ea];return _0x429ee3;};'use strict';var util=require(_0x3176('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3176('0x1')]({'id':i,'firstName':_0x3176('0x2')+i,'lastName':_0x3176('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3176('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x3176('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3176('0x5')](),'updatedAt':Date[_0x3176('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3176('0x1')]({'id':i,'firstName':_0x3176('0x2')+i,'lastName':_0x3176('0x3')+i,'phone':0xf879fb460+i,'email':_0x3176('0x6')+i+_0x3176('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3176('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['now']()});}db[_0x3176('0x7')][_0x3176('0x8')]({'where':{}})[_0x3176('0x9')](function(){return db[_0x3176('0x7')][_0x3176('0xa')](contacts);})['then'](function(){console[_0x3176('0xb')](_0x3176('0xc'),_0x3176('0xd'));return db[_0x3176('0xe')][_0x3176('0x8')]({'where':{}});})['then'](function(){return db[_0x3176('0xe')][_0x3176('0xa')](hopper);})[_0x3176('0x9')](function(){console[_0x3176('0xb')](_0x3176('0xc'),_0x3176('0xf'));return db[_0x3176('0x7')][_0x3176('0xa')](contacts2);})[_0x3176('0x9')](function(){console[_0x3176('0xb')](_0x3176('0xc'),'contacts2');return db['CmHopper'][_0x3176('0xa')](hopper2);})['then'](function(){console[_0x3176('0xb')](_0x3176('0xc'),_0x3176('0x10'));})[_0x3176('0x11')](function(_0x2fa746){console[_0x3176('0xb')](_0x2fa746);}); \ No newline at end of file +var _0xe69c=['Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','bulkCreate','then','finished\x20populating','contacts1','CmHopper','log','contacts2','hopper2','util','../mysqldb','push'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe69c,0x1e3));var _0xce69=function(_0x321d7d,_0x50446f){_0x321d7d=_0x321d7d-0x0;var _0xbe483e=_0xe69c[_0x321d7d];return _0xbe483e;};'use strict';var util=require(_0xce69('0x0'));var db=require(_0xce69('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xce69('0x2')]({'id':i,'firstName':_0xce69('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xce69('0x4')+i+_0xce69('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xce69('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce69('0x6')](),'updatedAt':Date[_0xce69('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xce69('0x2')]({'id':i,'firstName':_0xce69('0x3')+i,'lastName':_0xce69('0x7')+i,'phone':0xf879fb460+i,'email':_0xce69('0x4')+i+_0xce69('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xce69('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce69('0x6')](),'updatedAt':Date[_0xce69('0x6')]()});}db[_0xce69('0x8')][_0xce69('0x9')]({'where':{}})['then'](function(){return db[_0xce69('0x8')][_0xce69('0xa')](contacts);})[_0xce69('0xb')](function(){console['log'](_0xce69('0xc'),_0xce69('0xd'));return db['CmHopper'][_0xce69('0x9')]({'where':{}});})[_0xce69('0xb')](function(){return db[_0xce69('0xe')][_0xce69('0xa')](hopper);})[_0xce69('0xb')](function(){console['log'](_0xce69('0xc'),'hopper1');return db[_0xce69('0x8')][_0xce69('0xa')](contacts2);})[_0xce69('0xb')](function(){console[_0xce69('0xf')](_0xce69('0xc'),_0xce69('0x10'));return db[_0xce69('0xe')]['bulkCreate'](hopper2);})['then'](function(){console[_0xce69('0xf')](_0xce69('0xc'),_0xce69('0x11'));})['catch'](function(_0x153b84){console[_0xce69('0xf')](_0x153b84);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9393192..47ae787 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x402a=['\x22%s\x22\x20<%s>','User','then','log','catch','util','../mysqldb','push','%s%s','agent','%s%s@xcally.com','friend','udp','wss','all','ulaw','format','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x4c39fa,_0x239d3a){var _0x45e818=function(_0x1a9138){while(--_0x1a9138){_0x4c39fa['push'](_0x4c39fa['shift']());}};_0x45e818(++_0x239d3a);}(_0x402a,0x101));var _0xa402=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x402a[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0xa402('0x0'));var db=require(_0xa402('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa402('0x2')]({'name':util['format'](_0xa402('0x3'),_0xa402('0x4'),i),'fullname':util['format']('%s%s','agent',i),'email':util['format'](_0xa402('0x5'),_0xa402('0x4'),i),'role':_0xa402('0x4'),'password':'password','internal':0xfa0+i,'type':_0xa402('0x6'),'transport':[_0xa402('0x7'),'ws',_0xa402('0x8')],'disallow':[_0xa402('0x9')],'allow':[_0xa402('0xa')],'defaultuser':util[_0xa402('0xb')](_0xa402('0x3'),_0xa402('0x4'),i),'encryption':_0xa402('0xc'),'avpf':_0xa402('0xc'),'force_avp':_0xa402('0xc'),'icesupport':'yes','dtlsenable':_0xa402('0xc'),'dtlsverify':'no','dtlscertfile':_0xa402('0xd'),'dtlsprivatekey':_0xa402('0xe'),'dtlssetup':_0xa402('0xf'),'callerid':util[_0xa402('0xb')](_0xa402('0x10'),util['format'](_0xa402('0x3'),_0xa402('0x4'),i),0xfa0+i)});}db[_0xa402('0x11')]['bulkCreate'](users)[_0xa402('0x12')](function(){console[_0xa402('0x13')]('add\x20user');})[_0xa402('0x14')](function(_0x40f31){console[_0xa402('0x13')](_0x40f31);}); \ No newline at end of file +var _0xdc78=['ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdc78,0x15e));var _0x8dc7=function(_0x13844e,_0x14d041){_0x13844e=_0x13844e-0x0;var _0x5183b0=_0xdc78[_0x13844e];return _0x5183b0;};'use strict';var util=require('util');var db=require(_0x8dc7('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8dc7('0x1')]({'name':util['format'](_0x8dc7('0x2'),_0x8dc7('0x3'),i),'fullname':util[_0x8dc7('0x4')](_0x8dc7('0x2'),_0x8dc7('0x3'),i),'email':util[_0x8dc7('0x4')](_0x8dc7('0x5'),_0x8dc7('0x3'),i),'role':_0x8dc7('0x3'),'password':_0x8dc7('0x6'),'internal':0xfa0+i,'type':_0x8dc7('0x7'),'transport':[_0x8dc7('0x8'),'ws',_0x8dc7('0x9')],'disallow':['all'],'allow':[_0x8dc7('0xa')],'defaultuser':util[_0x8dc7('0x4')](_0x8dc7('0x2'),_0x8dc7('0x3'),i),'encryption':_0x8dc7('0xb'),'avpf':_0x8dc7('0xb'),'force_avp':_0x8dc7('0xb'),'icesupport':_0x8dc7('0xb'),'dtlsenable':_0x8dc7('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x8dc7('0xc'),'dtlssetup':_0x8dc7('0xd'),'callerid':util[_0x8dc7('0x4')](_0x8dc7('0xe'),util[_0x8dc7('0x4')](_0x8dc7('0x2'),_0x8dc7('0x3'),i),0xfa0+i)});}db['User'][_0x8dc7('0xf')](users)[_0x8dc7('0x10')](function(){console[_0x8dc7('0x11')](_0x8dc7('0x12'));})[_0x8dc7('0x13')](function(_0x16c0ac){console[_0x8dc7('0x11')](_0x16c0ac);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7cd9e4e..cb1e7e5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02fe=['voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueue','MailQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','map','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','address','request','remoteAddress','connectedAt','disconnect','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','then','where','type','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x02fe,0x1b8));var _0xe02f=function(_0x4669b5,_0x54a68a){_0x4669b5=_0x4669b5-0x0;var _0x35772c=_0x02fe[_0x4669b5];return _0x35772c;};'use strict';var _=require('lodash');var util=require(_0xe02f('0x0'));var BPromise=require(_0xe02f('0x1'));var db=require(_0xe02f('0x2'))['db'];var config=require(_0xe02f('0x3'));var queryQueues={'attributes':['id',_0xe02f('0x4')],'include':[{'as':_0xe02f('0x5'),'model':db[_0xe02f('0x6')],'attributes':['id',_0xe02f('0x4'),_0xe02f('0x7')],'raw':!![],'where':{'role':_0xe02f('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe02f('0x4')],'where':{'role':_0xe02f('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe02f('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xe02f('0x4')],'where':{'role':_0xe02f('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe02f('0x4'),'type'],'where':{'type':_0xe02f('0xa')}};function getAssociatedResources(_0x4f5a16,_0x3bc5f9,_0xe28b82){return db[_0xe02f('0xb')][_0xe02f('0xc')]({'where':{'name':_0x4f5a16,'userProfileId':_0x3bc5f9},'raw':!![]})['then'](function(_0x3e3379){if(_0x3e3379){if(_0x3e3379[_0xe02f('0xd')]){switch(_0x4f5a16){case _0xe02f('0xe'):case _0xe02f('0xf'):case _0xe02f('0x10'):case _0xe02f('0x11'):case'MailQueues':case _0xe02f('0x12'):case _0xe02f('0x13'):return db[_0xe28b82][_0xe02f('0x14')](queryQueues);case _0xe02f('0x15'):return db[_0xe28b82][_0xe02f('0x14')](queryTelephones);case'Trunks':return db[_0xe28b82]['findAll'](queryTrunks);case _0xe02f('0x16'):return db[_0xe28b82][_0xe02f('0x14')](queryCampaigns);}}else{return db[_0xe02f('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x3e3379['id']},'raw':!![]})[_0xe02f('0x18')](function(_0x3cdec3){if(_0x3cdec3){var _0x5ece1c={'where':{'id':_['map'](_0x3cdec3,'resourceId')},'raw':!![]};switch(_0xe28b82){case _0xe02f('0x6'):_0x5ece1c[_0xe02f('0x19')][_0xe02f('0x7')]=_0xe02f('0x9');break;case'Campaign':_0x5ece1c[_0xe02f('0x19')][_0xe02f('0x1a')]=_0xe02f('0xa');break;}return db[_0xe28b82][_0xe02f('0x14')](_0x5ece1c);}else{return[];}});}}else{return[];}})['then'](function(_0x5770d1){return _0x5770d1;});}function joinOrLeaveQueues(_0x3e64ca,_0x488d1e,_0x1703aa,_0x16cc32){_0x3e64ca[_0x488d1e](util[_0xe02f('0x1b')](_0xe02f('0x1c'),_0x1703aa,_0x16cc32[_0xe02f('0x4')]));if(_0x16cc32[_0xe02f('0x5')]){for(var _0x4067e2=0x0;_0x4067e2<_0x16cc32['Agents']['length'];_0x4067e2+=0x1){_0x3e64ca[_0x488d1e](util[_0xe02f('0x1b')](_0xe02f('0x1d'),_0x16cc32[_0xe02f('0x5')][_0x4067e2][_0xe02f('0x4')]));}}}function joinOrLeave(_0x5eb0b9,_0x371412,_0x272608){var _0x53dfaa;if(_0x5eb0b9[_0xe02f('0x1e')][_0xe02f('0x1f')]['id']){db[_0xe02f('0x6')][_0xe02f('0x20')]({'attributes':['id',_0xe02f('0x4'),'role',_0xe02f('0x21')],'where':{'id':_0x5eb0b9['handshake'][_0xe02f('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe02f('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xe02f('0x23')],'as':_0xe02f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xe02f('0x25')],'as':_0xe02f('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe02f('0x27')],'as':_0xe02f('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xe02f('0x29')],'as':_0xe02f('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xe02f('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xe02f('0x18')](function(_0x39451d){if(_0x39451d){_0x53dfaa=_0x39451d;_0x5eb0b9[_0x371412](util[_0xe02f('0x1b')](_0xe02f('0x1d'),_0x39451d[_0xe02f('0x4')]));var _0x17ff3e=[];switch(_0x39451d[_0xe02f('0x7')]){case _0xe02f('0x2c'):_0x5eb0b9[_0x371412](_0xe02f('0x2d'));_0x5eb0b9[_0x371412](_0xe02f('0x2e'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xe02f('0x2f')];}_0x17ff3e[_0xe02f('0x30')](db[_0xe02f('0x31')][_0xe02f('0x14')](queryQueues));_0x17ff3e['push'](db[_0xe02f('0x32')][_0xe02f('0x14')](queryQueues));_0x17ff3e['push'](db['FaxQueue'][_0xe02f('0x14')](queryQueues));_0x17ff3e[_0xe02f('0x30')](db[_0xe02f('0x33')]['findAll'](queryQueues));_0x17ff3e[_0xe02f('0x30')](db[_0xe02f('0x34')][_0xe02f('0x14')](queryQueues));_0x17ff3e['push'](db[_0xe02f('0x35')][_0xe02f('0x14')](queryQueues));_0x17ff3e['push'](db[_0xe02f('0x36')][_0xe02f('0x14')](queryQueues));_0x17ff3e['push'](db[_0xe02f('0x6')]['findAll'](queryTelephones));_0x17ff3e['push'](db[_0xe02f('0x37')]['findAll'](queryTrunks));_0x17ff3e[_0xe02f('0x30')](db['Campaign'][_0xe02f('0x14')](queryCampaigns));_0x17ff3e[_0xe02f('0x30')](db['User']['findAll'](queryAgents));break;case _0xe02f('0x38'):_0x5eb0b9[_0x371412](_0xe02f('0x2d'));_0x5eb0b9[_0x371412](_0xe02f('0x2e'));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0xe'),_0x39451d[_0xe02f('0x21')],_0xe02f('0x31')));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0xf'),_0x39451d[_0xe02f('0x21')],'ChatQueue'));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0x10'),_0x39451d[_0xe02f('0x21')],_0xe02f('0x39')));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0x11'),_0x39451d['userProfileId'],_0xe02f('0x33')));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0x3a'),_0x39451d[_0xe02f('0x21')],_0xe02f('0x34')));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0x12'),_0x39451d[_0xe02f('0x21')],_0xe02f('0x35')));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0x13'),_0x39451d['userProfileId'],'WhatsappQueue'));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0x15'),_0x39451d['userProfileId'],_0xe02f('0x6')));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources(_0xe02f('0x3b'),_0x39451d[_0xe02f('0x21')],_0xe02f('0x37')));_0x17ff3e[_0xe02f('0x30')](getAssociatedResources('IvrCampaigns',_0x39451d['userProfileId'],'Campaign'));_0x17ff3e[_0xe02f('0x30')](db['User'][_0xe02f('0x14')](queryAgents));break;case _0xe02f('0x8'):_0x5eb0b9[_0x371412](_0xe02f('0x2d'));_0x5eb0b9[_0x371412]('voice:outbound');_0x17ff3e[_0xe02f('0x30')](_0x39451d[_0xe02f('0x3c')]({'attributes':['id','name']}));_0x17ff3e[_0xe02f('0x30')](_0x39451d[_0xe02f('0x3d')]({'attributes':['id',_0xe02f('0x4')]}));_0x17ff3e['push'](_0x39451d[_0xe02f('0x3e')]({'attributes':['id',_0xe02f('0x4')]}));_0x17ff3e['push'](_0x39451d[_0xe02f('0x3f')]({'attributes':['id',_0xe02f('0x4')]}));_0x17ff3e[_0xe02f('0x30')](_0x39451d[_0xe02f('0x40')]({'attributes':['id',_0xe02f('0x4')]}));_0x17ff3e[_0xe02f('0x30')](_0x39451d[_0xe02f('0x41')]({'attributes':['id',_0xe02f('0x4')]}));_0x17ff3e[_0xe02f('0x30')](_0x39451d['getWhatsappQueues']({'attributes':['id',_0xe02f('0x4')]}));break;}return BPromise['all'](_0x17ff3e);}})[_0xe02f('0x18')](function(_0x5b17c8){if(_0x5b17c8&&_0x5b17c8[_0xe02f('0x42')]){for(var _0x1b614e=0x0;_0x1b614e<_0x5b17c8[_0xe02f('0x42')];_0x1b614e+=0x1){for(var _0x1afe17=0x0;_0x1afe17<_0x5b17c8[_0x1b614e][_0xe02f('0x42')];_0x1afe17+=0x1){switch(_0x1b614e){case 0x0:joinOrLeaveQueues(_0x5eb0b9,_0x371412,_0xe02f('0x43'),_0x5b17c8[_0x1b614e][_0x1afe17]);break;case 0x1:joinOrLeaveQueues(_0x5eb0b9,_0x371412,_0xe02f('0x44'),_0x5b17c8[_0x1b614e][_0x1afe17]);break;case 0x2:joinOrLeaveQueues(_0x5eb0b9,_0x371412,_0xe02f('0x45'),_0x5b17c8[_0x1b614e][_0x1afe17]);break;case 0x3:joinOrLeaveQueues(_0x5eb0b9,_0x371412,_0xe02f('0x46'),_0x5b17c8[_0x1b614e][_0x1afe17]);break;case 0x4:joinOrLeaveQueues(_0x5eb0b9,_0x371412,'mail',_0x5b17c8[_0x1b614e][_0x1afe17]);break;case 0x5:joinOrLeaveQueues(_0x5eb0b9,_0x371412,_0xe02f('0x47'),_0x5b17c8[_0x1b614e][_0x1afe17]);break;case 0x6:joinOrLeaveQueues(_0x5eb0b9,_0x371412,_0xe02f('0x48'),_0x5b17c8[_0x1b614e][_0x1afe17]);break;case 0x7:if(_0x53dfaa['role']!==_0xe02f('0x8'))_0x5eb0b9[_0x371412](util[_0xe02f('0x1b')](_0xe02f('0x49'),_0x5b17c8[_0x1b614e][_0x1afe17][_0xe02f('0x4')]));break;case 0x8:if(_0x53dfaa[_0xe02f('0x7')]!==_0xe02f('0x8'))_0x5eb0b9[_0x371412](util['format'](_0xe02f('0x4a'),_0x5b17c8[_0x1b614e][_0x1afe17]['name']));break;case 0x9:if(_0x53dfaa[_0xe02f('0x7')]!==_0xe02f('0x8'))_0x5eb0b9[_0x371412](util['format']('campaign:%s:%s',_0x5b17c8[_0x1b614e][_0x1afe17][_0xe02f('0x1a')],_0x5b17c8[_0x1b614e][_0x1afe17]['name']));break;case 0xa:_0x5eb0b9[_0x371412](util['format'](_0xe02f('0x1d'),_0x5b17c8[_0x1b614e][_0x1afe17][_0xe02f('0x4')]));break;}}}}})[_0xe02f('0x18')](function(){if(_0x371412===_0xe02f('0x4b')){var _0x3fc627=_[_0xe02f('0x4c')](_0x53dfaa['ChatInteractions'],'id');return _0x53dfaa['removeChatInteractions'](_0x3fc627)[_0xe02f('0x18')](function(){for(var _0x327911=0x0;_0x327911<_0x3fc627[_0xe02f('0x42')];_0x327911+=0x1){_0x272608[_0xe02f('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3fc627[_0x327911]),'UserId':Number(_0x53dfaa['id'])});}});}})[_0xe02f('0x18')](function(){if(_0x371412===_0xe02f('0x4b')){var _0x3f8e92=_[_0xe02f('0x4c')](_0x53dfaa[_0xe02f('0x24')],'id');return _0x53dfaa[_0xe02f('0x4e')](_0x3f8e92)[_0xe02f('0x18')](function(){for(var _0x2c9faf=0x0;_0x2c9faf<_0x3f8e92[_0xe02f('0x42')];_0x2c9faf+=0x1){_0x272608[_0xe02f('0x4d')](_0xe02f('0x4f'),{'MailInteractionId':Number(_0x3f8e92[_0x2c9faf]),'UserId':Number(_0x53dfaa['id'])});}});}})[_0xe02f('0x18')](function(){if(_0x371412===_0xe02f('0x4b')){var _0x31b951=_['map'](_0x53dfaa['FaxInteractions'],'id');return _0x53dfaa[_0xe02f('0x50')](_0x31b951)['then'](function(){for(var _0x2a1da3=0x0;_0x2a1da3<_0x31b951['length'];_0x2a1da3+=0x1){_0x272608[_0xe02f('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x31b951[_0x2a1da3]),'UserId':Number(_0x53dfaa['id'])});}});}})[_0xe02f('0x18')](function(){if(_0x371412===_0xe02f('0x4b')){var _0x8ed22b=_[_0xe02f('0x4c')](_0x53dfaa['SmsInteractions'],'id');return _0x53dfaa[_0xe02f('0x51')](_0x8ed22b)['then'](function(){for(var _0x36f5cf=0x0;_0x36f5cf<_0x8ed22b['length'];_0x36f5cf+=0x1){_0x272608[_0xe02f('0x4d')](_0xe02f('0x52'),{'SmsInteractionId':Number(_0x8ed22b[_0x36f5cf]),'UserId':Number(_0x53dfaa['id'])});}});}})[_0xe02f('0x18')](function(){if(_0x371412===_0xe02f('0x4b')){var _0x4dda57=_[_0xe02f('0x4c')](_0x53dfaa['OpenchannelInteractions'],'id');return _0x53dfaa[_0xe02f('0x53')](_0x4dda57)[_0xe02f('0x18')](function(){for(var _0x5c1b04=0x0;_0x5c1b04<_0x4dda57['length'];_0x5c1b04+=0x1){_0x272608[_0xe02f('0x4d')](_0xe02f('0x54'),{'OpenchannelInteractionId':Number(_0x4dda57[_0x5c1b04]),'UserId':Number(_0x53dfaa['id'])});}});}})[_0xe02f('0x18')](function(){if(_0x371412===_0xe02f('0x4b')){var _0xe65411=_[_0xe02f('0x4c')](_0x53dfaa['WhatsappInteractions'],'id');return _0x53dfaa[_0xe02f('0x55')](_0xe65411)[_0xe02f('0x18')](function(){for(var _0x38017e=0x0;_0x38017e<_0xe65411[_0xe02f('0x42')];_0x38017e+=0x1){_0x272608[_0xe02f('0x4d')](_0xe02f('0x56'),{'WhatsappInteractionId':Number(_0xe65411[_0x38017e]),'UserId':Number(_0x53dfaa['id'])});}});}})['catch'](function(_0x3ce900){_0x5eb0b9[_0xe02f('0x57')](_0x3ce900);});}}function onDisconnect(_0x51e886,_0x341285){joinOrLeave(_0x51e886,_0xe02f('0x4b'),_0x341285);}function onConnect(_0x2eacba){joinOrLeave(_0x2eacba,_0xe02f('0x58'));}exports[_0xe02f('0x59')]=function(_0x200047){_0x200047['on'](_0xe02f('0x5a'),function(_0x57419a){_0x57419a['setMaxListeners'](0x0);_0x57419a[_0xe02f('0x5b')]=_0x57419a[_0xe02f('0x5c')][_0xe02f('0x5a')][_0xe02f('0x5d')]+':'+_0x57419a[_0xe02f('0x5c')][_0xe02f('0x5a')]['remotePort'];_0x57419a[_0xe02f('0x5e')]=new Date();_0x57419a[_0xe02f('0x57')]=function(_0x207c40){console[_0xe02f('0x57')]('SocketIO\x20'+_0x57419a['nsp'][_0xe02f('0x4')]+'['+_0x57419a[_0xe02f('0x5b')]+']',_0x207c40);};_0x57419a['on'](_0xe02f('0x5f'),function(){onDisconnect(_0x57419a,_0x200047);_0x57419a['log']('DISCONNECTED');});onConnect(_0x57419a);_0x57419a['log'](_0xe02f('0x60'));});}; \ No newline at end of file +var _0x228b=['user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','connection','address','request','remotePort','SocketIO\x20','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','name','User','role','agent','ivr','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','type','format','%s:queue:%s','Agents','length','user:%s','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','MailQueue','WhatsappQueue','Trunk','VoiceQueue','FaxQueue','SmsQueue','OpenchannelQueues','OpenchannelQueue','Trunks','getVoiceQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit'];(function(_0x4ba3b8,_0x1c9a7a){var _0x4e481b=function(_0x30ae6e){while(--_0x30ae6e){_0x4ba3b8['push'](_0x4ba3b8['shift']());}};_0x4e481b(++_0x1c9a7a);}(_0x228b,0x1f3));var _0xb228=function(_0x1c9520,_0x2d7ffd){_0x1c9520=_0x1c9520-0x0;var _0x2379b4=_0x228b[_0x1c9520];return _0x2379b4;};'use strict';var _=require('lodash');var util=require(_0xb228('0x0'));var BPromise=require('bluebird');var db=require(_0xb228('0x1'))['db'];var config=require(_0xb228('0x2'));var queryQueues={'attributes':['id',_0xb228('0x3')],'include':[{'as':'Agents','model':db[_0xb228('0x4')],'attributes':['id',_0xb228('0x3'),_0xb228('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xb228('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb228('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb228('0x3'),'type'],'where':{'type':_0xb228('0x7')}};function getAssociatedResources(_0x41b80e,_0x4a758e,_0x18b85f){return db['UserProfileSection'][_0xb228('0x8')]({'where':{'name':_0x41b80e,'userProfileId':_0x4a758e},'raw':!![]})[_0xb228('0x9')](function(_0x3c4289){if(_0x3c4289){if(_0x3c4289['autoAssociation']){switch(_0x41b80e){case _0xb228('0xa'):case _0xb228('0xb'):case _0xb228('0xc'):case _0xb228('0xd'):case _0xb228('0xe'):case'OpenchannelQueues':case _0xb228('0xf'):return db[_0x18b85f][_0xb228('0x10')](queryQueues);case _0xb228('0x11'):return db[_0x18b85f]['findAll'](queryTelephones);case'Trunks':return db[_0x18b85f][_0xb228('0x10')](queryTrunks);case _0xb228('0x12'):return db[_0x18b85f][_0xb228('0x10')](queryCampaigns);}}else{return db[_0xb228('0x13')][_0xb228('0x10')]({'attributes':[_0xb228('0x14')],'where':{'sectionId':_0x3c4289['id']},'raw':!![]})[_0xb228('0x9')](function(_0x229262){if(_0x229262){var _0x15e105={'where':{'id':_[_0xb228('0x15')](_0x229262,'resourceId')},'raw':!![]};switch(_0x18b85f){case _0xb228('0x4'):_0x15e105[_0xb228('0x16')][_0xb228('0x5')]=_0xb228('0x17');break;case _0xb228('0x18'):_0x15e105[_0xb228('0x16')][_0xb228('0x19')]='ivr';break;}return db[_0x18b85f]['findAll'](_0x15e105);}else{return[];}});}}else{return[];}})['then'](function(_0x272b3b){return _0x272b3b;});}function joinOrLeaveQueues(_0x42738b,_0xb22d27,_0x304a82,_0x24837a){_0x42738b[_0xb22d27](util[_0xb228('0x1a')](_0xb228('0x1b'),_0x304a82,_0x24837a[_0xb228('0x3')]));if(_0x24837a[_0xb228('0x1c')]){for(var _0x59c882=0x0;_0x59c882<_0x24837a[_0xb228('0x1c')][_0xb228('0x1d')];_0x59c882+=0x1){_0x42738b[_0xb22d27](util['format'](_0xb228('0x1e'),_0x24837a[_0xb228('0x1c')][_0x59c882][_0xb228('0x3')]));}}}function joinOrLeave(_0x25262b,_0x327df3,_0x4d572d){var _0x53ad51;if(_0x25262b['handshake']['query']['id']){db[_0xb228('0x4')][_0xb228('0x1f')]({'attributes':['id',_0xb228('0x3'),_0xb228('0x5'),_0xb228('0x20')],'where':{'id':_0x25262b[_0xb228('0x21')][_0xb228('0x22')]['id']},'include':[{'model':db[_0xb228('0x23')],'as':_0xb228('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb228('0x25')],'as':_0xb228('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb228('0x27')],'as':_0xb228('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb228('0x29')],'as':_0xb228('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xb228('0x2b')],'as':_0xb228('0x2c'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb228('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xb228('0x9')](function(_0x598e6a){if(_0x598e6a){_0x53ad51=_0x598e6a;_0x25262b[_0x327df3](util[_0xb228('0x1a')](_0xb228('0x1e'),_0x598e6a['name']));var _0x4a22f9=[];switch(_0x598e6a[_0xb228('0x5')]){case'admin':_0x25262b[_0x327df3](_0xb228('0x2e'));_0x25262b[_0x327df3](_0xb228('0x2f'));if(queryQueues[_0xb228('0x30')]('include')){delete queryQueues[_0xb228('0x31')];}_0x4a22f9['push'](db['VoiceQueue'][_0xb228('0x10')](queryQueues));_0x4a22f9[_0xb228('0x32')](db[_0xb228('0x33')][_0xb228('0x10')](queryQueues));_0x4a22f9[_0xb228('0x32')](db['FaxQueue']['findAll'](queryQueues));_0x4a22f9['push'](db['SmsQueue']['findAll'](queryQueues));_0x4a22f9[_0xb228('0x32')](db[_0xb228('0x34')][_0xb228('0x10')](queryQueues));_0x4a22f9['push'](db['OpenchannelQueue'][_0xb228('0x10')](queryQueues));_0x4a22f9[_0xb228('0x32')](db[_0xb228('0x35')][_0xb228('0x10')](queryQueues));_0x4a22f9[_0xb228('0x32')](db[_0xb228('0x4')]['findAll'](queryTelephones));_0x4a22f9[_0xb228('0x32')](db[_0xb228('0x36')][_0xb228('0x10')](queryTrunks));_0x4a22f9['push'](db['Campaign'][_0xb228('0x10')](queryCampaigns));_0x4a22f9[_0xb228('0x32')](db['User']['findAll'](queryAgents));break;case'user':_0x25262b[_0x327df3](_0xb228('0x2e'));_0x25262b[_0x327df3](_0xb228('0x2f'));_0x4a22f9['push'](getAssociatedResources('VoiceQueues',_0x598e6a[_0xb228('0x20')],_0xb228('0x37')));_0x4a22f9[_0xb228('0x32')](getAssociatedResources(_0xb228('0xb'),_0x598e6a['userProfileId'],_0xb228('0x33')));_0x4a22f9[_0xb228('0x32')](getAssociatedResources('FaxQueues',_0x598e6a['userProfileId'],_0xb228('0x38')));_0x4a22f9[_0xb228('0x32')](getAssociatedResources(_0xb228('0xd'),_0x598e6a[_0xb228('0x20')],_0xb228('0x39')));_0x4a22f9[_0xb228('0x32')](getAssociatedResources(_0xb228('0xe'),_0x598e6a[_0xb228('0x20')],'MailQueue'));_0x4a22f9[_0xb228('0x32')](getAssociatedResources(_0xb228('0x3a'),_0x598e6a[_0xb228('0x20')],_0xb228('0x3b')));_0x4a22f9[_0xb228('0x32')](getAssociatedResources(_0xb228('0xf'),_0x598e6a[_0xb228('0x20')],_0xb228('0x35')));_0x4a22f9['push'](getAssociatedResources(_0xb228('0x11'),_0x598e6a['userProfileId'],_0xb228('0x4')));_0x4a22f9[_0xb228('0x32')](getAssociatedResources(_0xb228('0x3c'),_0x598e6a[_0xb228('0x20')],_0xb228('0x36')));_0x4a22f9[_0xb228('0x32')](getAssociatedResources(_0xb228('0x12'),_0x598e6a[_0xb228('0x20')],_0xb228('0x18')));_0x4a22f9[_0xb228('0x32')](db[_0xb228('0x4')][_0xb228('0x10')](queryAgents));break;case _0xb228('0x6'):_0x25262b[_0x327df3](_0xb228('0x2e'));_0x25262b[_0x327df3](_0xb228('0x2f'));_0x4a22f9[_0xb228('0x32')](_0x598e6a[_0xb228('0x3d')]({'attributes':['id','name']}));_0x4a22f9['push'](_0x598e6a['getChatQueues']({'attributes':['id',_0xb228('0x3')]}));_0x4a22f9[_0xb228('0x32')](_0x598e6a['getFaxQueues']({'attributes':['id',_0xb228('0x3')]}));_0x4a22f9[_0xb228('0x32')](_0x598e6a['getSmsQueues']({'attributes':['id',_0xb228('0x3')]}));_0x4a22f9[_0xb228('0x32')](_0x598e6a[_0xb228('0x3e')]({'attributes':['id',_0xb228('0x3')]}));_0x4a22f9[_0xb228('0x32')](_0x598e6a[_0xb228('0x3f')]({'attributes':['id',_0xb228('0x3')]}));_0x4a22f9[_0xb228('0x32')](_0x598e6a[_0xb228('0x40')]({'attributes':['id',_0xb228('0x3')]}));break;}return BPromise[_0xb228('0x41')](_0x4a22f9);}})['then'](function(_0x4c90ee){if(_0x4c90ee&&_0x4c90ee['length']){for(var _0x24d1b6=0x0;_0x24d1b6<_0x4c90ee['length'];_0x24d1b6+=0x1){for(var _0x3511c5=0x0;_0x3511c5<_0x4c90ee[_0x24d1b6]['length'];_0x3511c5+=0x1){switch(_0x24d1b6){case 0x0:joinOrLeaveQueues(_0x25262b,_0x327df3,_0xb228('0x42'),_0x4c90ee[_0x24d1b6][_0x3511c5]);break;case 0x1:joinOrLeaveQueues(_0x25262b,_0x327df3,_0xb228('0x43'),_0x4c90ee[_0x24d1b6][_0x3511c5]);break;case 0x2:joinOrLeaveQueues(_0x25262b,_0x327df3,_0xb228('0x44'),_0x4c90ee[_0x24d1b6][_0x3511c5]);break;case 0x3:joinOrLeaveQueues(_0x25262b,_0x327df3,_0xb228('0x45'),_0x4c90ee[_0x24d1b6][_0x3511c5]);break;case 0x4:joinOrLeaveQueues(_0x25262b,_0x327df3,_0xb228('0x46'),_0x4c90ee[_0x24d1b6][_0x3511c5]);break;case 0x5:joinOrLeaveQueues(_0x25262b,_0x327df3,'openchannel',_0x4c90ee[_0x24d1b6][_0x3511c5]);break;case 0x6:joinOrLeaveQueues(_0x25262b,_0x327df3,'whatsapp',_0x4c90ee[_0x24d1b6][_0x3511c5]);break;case 0x7:if(_0x53ad51[_0xb228('0x5')]!==_0xb228('0x6'))_0x25262b[_0x327df3](util[_0xb228('0x1a')](_0xb228('0x47'),_0x4c90ee[_0x24d1b6][_0x3511c5][_0xb228('0x3')]));break;case 0x8:if(_0x53ad51['role']!==_0xb228('0x6'))_0x25262b[_0x327df3](util[_0xb228('0x1a')](_0xb228('0x48'),_0x4c90ee[_0x24d1b6][_0x3511c5][_0xb228('0x3')]));break;case 0x9:if(_0x53ad51[_0xb228('0x5')]!=='agent')_0x25262b[_0x327df3](util[_0xb228('0x1a')](_0xb228('0x49'),_0x4c90ee[_0x24d1b6][_0x3511c5][_0xb228('0x19')],_0x4c90ee[_0x24d1b6][_0x3511c5]['name']));break;case 0xa:_0x25262b[_0x327df3](util[_0xb228('0x1a')]('user:%s',_0x4c90ee[_0x24d1b6][_0x3511c5][_0xb228('0x3')]));break;}}}}})[_0xb228('0x9')](function(){if(_0x327df3===_0xb228('0x4a')){var _0x534883=_[_0xb228('0x15')](_0x53ad51['ChatInteractions'],'id');return _0x53ad51[_0xb228('0x4b')](_0x534883)[_0xb228('0x9')](function(){for(var _0x55aec7=0x0;_0x55aec7<_0x534883[_0xb228('0x1d')];_0x55aec7+=0x1){_0x4d572d[_0xb228('0x4c')](_0xb228('0x4d'),{'ChatInteractionId':Number(_0x534883[_0x55aec7]),'UserId':Number(_0x53ad51['id'])});}});}})[_0xb228('0x9')](function(){if(_0x327df3===_0xb228('0x4a')){var _0x42bbc2=_[_0xb228('0x15')](_0x53ad51[_0xb228('0x26')],'id');return _0x53ad51[_0xb228('0x4e')](_0x42bbc2)[_0xb228('0x9')](function(){for(var _0x595a6b=0x0;_0x595a6b<_0x42bbc2['length'];_0x595a6b+=0x1){_0x4d572d['emit'](_0xb228('0x4f'),{'MailInteractionId':Number(_0x42bbc2[_0x595a6b]),'UserId':Number(_0x53ad51['id'])});}});}})['then'](function(){if(_0x327df3===_0xb228('0x4a')){var _0x5c8faa=_['map'](_0x53ad51[_0xb228('0x28')],'id');return _0x53ad51[_0xb228('0x50')](_0x5c8faa)['then'](function(){for(var _0x2c2066=0x0;_0x2c2066<_0x5c8faa[_0xb228('0x1d')];_0x2c2066+=0x1){_0x4d572d[_0xb228('0x4c')](_0xb228('0x51'),{'FaxInteractionId':Number(_0x5c8faa[_0x2c2066]),'UserId':Number(_0x53ad51['id'])});}});}})[_0xb228('0x9')](function(){if(_0x327df3===_0xb228('0x4a')){var _0x2e28c0=_[_0xb228('0x15')](_0x53ad51[_0xb228('0x2a')],'id');return _0x53ad51[_0xb228('0x52')](_0x2e28c0)[_0xb228('0x9')](function(){for(var _0xf230ce=0x0;_0xf230ce<_0x2e28c0[_0xb228('0x1d')];_0xf230ce+=0x1){_0x4d572d[_0xb228('0x4c')](_0xb228('0x53'),{'SmsInteractionId':Number(_0x2e28c0[_0xf230ce]),'UserId':Number(_0x53ad51['id'])});}});}})['then'](function(){if(_0x327df3===_0xb228('0x4a')){var _0x4b1328=_[_0xb228('0x15')](_0x53ad51[_0xb228('0x2c')],'id');return _0x53ad51['removeOpenchannelInteractions'](_0x4b1328)[_0xb228('0x9')](function(){for(var _0x5bc337=0x0;_0x5bc337<_0x4b1328[_0xb228('0x1d')];_0x5bc337+=0x1){_0x4d572d[_0xb228('0x4c')](_0xb228('0x54'),{'OpenchannelInteractionId':Number(_0x4b1328[_0x5bc337]),'UserId':Number(_0x53ad51['id'])});}});}})[_0xb228('0x9')](function(){if(_0x327df3===_0xb228('0x4a')){var _0x3a21d9=_[_0xb228('0x15')](_0x53ad51[_0xb228('0x2d')],'id');return _0x53ad51['removeWhatsappInteractions'](_0x3a21d9)[_0xb228('0x9')](function(){for(var _0x40552e=0x0;_0x40552e<_0x3a21d9[_0xb228('0x1d')];_0x40552e+=0x1){_0x4d572d['emit'](_0xb228('0x55'),{'WhatsappInteractionId':Number(_0x3a21d9[_0x40552e]),'UserId':Number(_0x53ad51['id'])});}});}})['catch'](function(_0x4fd9b4){_0x25262b[_0xb228('0x56')](_0x4fd9b4);});}}function onDisconnect(_0x247040,_0x1e82d4){joinOrLeave(_0x247040,_0xb228('0x4a'),_0x1e82d4);}function onConnect(_0xf7de37){joinOrLeave(_0xf7de37,_0xb228('0x57'));}exports[_0xb228('0x58')]=function(_0x905d66){_0x905d66['on'](_0xb228('0x59'),function(_0x2d14c7){_0x2d14c7['setMaxListeners'](0x0);_0x2d14c7[_0xb228('0x5a')]=_0x2d14c7[_0xb228('0x5b')][_0xb228('0x59')]['remoteAddress']+':'+_0x2d14c7[_0xb228('0x5b')][_0xb228('0x59')][_0xb228('0x5c')];_0x2d14c7['connectedAt']=new Date();_0x2d14c7[_0xb228('0x56')]=function(_0x27a6be){console[_0xb228('0x56')](_0xb228('0x5d')+_0x2d14c7['nsp']['name']+'['+_0x2d14c7[_0xb228('0x5a')]+']',_0x27a6be);};_0x2d14c7['on']('disconnect',function(){onDisconnect(_0x2d14c7,_0x905d66);_0x2d14c7[_0xb228('0x56')](_0xb228('0x5e'));});onConnect(_0x2d14c7);_0x2d14c7[_0xb228('0x56')](_0xb228('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index e6beb20..ddc88a2 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 _0x51a4=['substatus','query','AfterUpdate','User','find','fullname','internal','default','model','hook','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','ChatMessage','newmessage','ChatOfflineMessage','Sms','newinteraction','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','UserId','format','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','opened','SELECT','interface','SIP/%s','changed','closed'];(function(_0x375e83,_0x59dc91){var _0x22fd48=function(_0x54e6c8){while(--_0x54e6c8){_0x375e83['push'](_0x375e83['shift']());}};_0x22fd48(++_0x59dc91);}(_0x51a4,0x1bc));var _0x451a=function(_0x58bf6a,_0x327cff){_0x58bf6a=_0x58bf6a-0x0;var _0x5a95e1=_0x51a4[_0x58bf6a];return _0x5a95e1;};'use strict';var util=require('util');var db=require(_0x451a('0x0'))['db'];var jayson=require(_0x451a('0x1'));var logger=require(_0x451a('0x2'))(_0x451a('0x3'));var client=jayson[_0x451a('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x451a('0x5'),'model':_0x451a('0x6'),'event':_0x451a('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x451a('0x5'),'model':_0x451a('0x6'),'event':_0x451a('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x451a('0x9'),'event':_0x451a('0x7'),'condition':_0x451a('0xa'),'callback':afterCreateMessage},{'channel':_0x451a('0x5'),'model':_0x451a('0xb'),'event':_0x451a('0x7'),'condition':_0x451a('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x451a('0xc'),'model':'SmsInteraction','event':_0x451a('0x7'),'condition':_0x451a('0xd'),'callback':afterCreate},{'channel':_0x451a('0xc'),'model':_0x451a('0xe'),'event':'afterUpdate','condition':_0x451a('0xf'),'callback':afterUpdate},{'channel':_0x451a('0xc'),'model':_0x451a('0x10'),'event':_0x451a('0x7'),'condition':_0x451a('0xa'),'callback':afterCreateMessage},{'channel':_0x451a('0x11'),'model':_0x451a('0x12'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x451a('0x12'),'event':_0x451a('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x451a('0x11'),'model':_0x451a('0x13'),'event':_0x451a('0x7'),'condition':_0x451a('0xa'),'callback':afterCreateMessage},{'channel':_0x451a('0x14'),'model':'FaxInteraction','event':_0x451a('0x7'),'condition':_0x451a('0xd'),'callback':afterCreate},{'channel':_0x451a('0x14'),'model':'FaxInteraction','event':_0x451a('0x8'),'condition':_0x451a('0xf'),'callback':afterUpdate},{'channel':_0x451a('0x14'),'model':_0x451a('0x15'),'event':_0x451a('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x451a('0x16'),'event':_0x451a('0x7'),'condition':_0x451a('0xd'),'callback':afterCreate},{'channel':_0x451a('0x17'),'model':_0x451a('0x16'),'event':_0x451a('0x8'),'condition':_0x451a('0xf'),'callback':afterUpdate},{'channel':_0x451a('0x17'),'model':_0x451a('0x18'),'event':_0x451a('0x7'),'condition':_0x451a('0xa'),'callback':afterCreateMessage},{'channel':_0x451a('0x19'),'model':_0x451a('0x1a'),'event':_0x451a('0x7'),'condition':_0x451a('0xd'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x451a('0x8'),'condition':_0x451a('0xf'),'callback':afterUpdate},{'channel':_0x451a('0x19'),'model':'OpenchannelMessage','event':_0x451a('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x541d4a){return client[_0x451a('0x1b')](_0x451a('0x1c'),_0x541d4a)['then'](function(_0x2504fe){logger[_0x451a('0x1d')](_0x451a('0x1e'),_0x451a('0x1c'),_0x2504fe);if(_0x2504fe['error']){if(_0x2504fe[_0x451a('0x1f')][_0x451a('0x20')]===0x1f4){logger[_0x451a('0x1f')](_0x451a('0x1e'),_0x451a('0x1c'),_0x2504fe[_0x451a('0x1f')]);}}})[_0x451a('0x21')](function(_0x28c109){logger['error'](_0x451a('0x1e'),_0x451a('0x1c'),_0x28c109);});}function afterCreateMessage(_0x2ca2c4){return function(_0x1e26e3){_0x1e26e3=_0x1e26e3[_0x451a('0x22')]({'plain':!![]});_0x1e26e3[_0x451a('0x23')]=_0x2ca2c4;_0x1e26e3[_0x451a('0x24')]=_0x2ca2c4;_0x1e26e3[_0x451a('0x25')]=_0x1e26e3['direction'];Promise[_0x451a('0x26')]()[_0x451a('0x27')](function(){if(typeof _0x1e26e3[_0x451a('0x28')]===_0x451a('0x29'))return null;var _0x30239=_0x451a('0x2a')+_0x1e26e3[_0x451a('0x28')];return db[_0x451a('0x2b')]['query'](_0x30239,{'type':db[_0x451a('0x2c')][_0x451a('0x2d')]['SELECT'],'raw':!![]});})[_0x451a('0x27')](function(_0x85750a){if(_0x85750a){_0x1e26e3[_0x451a('0x2e')]=_0x85750a[0x0];}if(typeof _0x1e26e3['UserId']===_0x451a('0x29'))return;return getAgent(_0x1e26e3[_0x451a('0x2f')]);})[_0x451a('0x27')](function(_0x43bd6d){if(_0x43bd6d){_0x1e26e3['interface']=util[_0x451a('0x30')]('SIP/%s',_0x43bd6d[_0x451a('0x31')]);_0x1e26e3[_0x451a('0x32')]=_0x43bd6d;_0x1e26e3[_0x451a('0x23')]=_0x2ca2c4;return request({'event':_0x451a('0x33'),'message':_0x1e26e3});}else{return request({'event':_0x451a('0x34'),'message':_0x1e26e3});}})['catch'](function(_0x4bca3e){logger[_0x451a('0x1f')](_0x451a('0x1e'),_0x451a('0x35'),_0x4bca3e);});};}function afterCreateOfflineMessage(_0x1ac3bf){return function(_0x1a622d){_0x1a622d=_0x1a622d[_0x451a('0x22')]({'plain':!![]});_0x1a622d[_0x451a('0x23')]=_0x1ac3bf;_0x1a622d['motionChannel']=_0x1ac3bf;_0x1a622d[_0x451a('0x25')]='offlineMessage';return request({'event':_0x1a622d[_0x451a('0x25')],'message':_0x1a622d});};}function afterCreate(_0x4a3316,_0x48ecb7){return function(_0x4aa332){_0x4aa332=_0x4aa332[_0x451a('0x22')]({'plain':!![]});_0x4aa332[_0x451a('0x23')]=_0x4a3316;_0x4aa332[_0x451a('0x24')]=_0x4a3316;_0x4aa332[_0x451a('0x25')]=_0x451a('0x36');Promise[_0x451a('0x26')]()[_0x451a('0x27')](function(){var _0x42d920=_0x451a('0x2a')+_0x4aa332[_0x451a('0x28')];return db[_0x451a('0x2b')]['query'](_0x42d920,{'type':db[_0x451a('0x2c')][_0x451a('0x2d')][_0x451a('0x37')],'raw':!![]});})['then'](function(_0x3a427f){if(_0x3a427f){_0x4aa332[_0x451a('0x2e')]=_0x3a427f[0x0];}if(typeof _0x4aa332['UserId']===_0x451a('0x29'))return;return getAgent(_0x4aa332['UserId']);})['then'](function(_0x348273){if(_0x348273){_0x4aa332[_0x451a('0x38')]=util[_0x451a('0x30')](_0x451a('0x39'),_0x348273[_0x451a('0x31')]);_0x4aa332[_0x451a('0x32')]=_0x348273;}return request({'event':_0x48ecb7,'message':_0x4aa332});})[_0x451a('0x21')](function(_0x5c794d){logger[_0x451a('0x1f')](_0x451a('0x1e'),'AfterCreate',_0x5c794d);});};}function afterUpdate(_0x152867){return function(_0x5e58a7){var _0x40f901=_0x5e58a7[_0x451a('0x3a')](_0x451a('0x3b'))&&_0x5e58a7[_0x451a('0x3b')];var _0x355a8e=_0x5e58a7[_0x451a('0x3a')](_0x451a('0x3c'));if(_0x40f901||_0x355a8e){var _0x437193=_0x40f901?'closedinteraction':_0x451a('0x3c');var _0x58bfcd=_0x5e58a7['get']({'plain':!![]});_0x58bfcd[_0x451a('0x23')]=_0x152867;_0x58bfcd[_0x451a('0x24')]=_0x152867;_0x58bfcd[_0x451a('0x25')]=_0x40f901?'closed':_0x451a('0x3c');var _0x89af73=_0x451a('0x2a')+_0x58bfcd[_0x451a('0x28')];return db[_0x451a('0x2b')][_0x451a('0x3d')](_0x89af73,{'type':db['Sequelize']['QueryTypes'][_0x451a('0x37')],'raw':!![]})[_0x451a('0x27')](function(_0x343e93){if(_0x343e93){_0x58bfcd[_0x451a('0x2e')]=_0x343e93[0x0];}if(typeof _0x58bfcd['UserId']==='undefined')return;return getAgent(_0x58bfcd[_0x451a('0x2f')]);})[_0x451a('0x27')](function(_0x57d356){if(_0x57d356){_0x58bfcd[_0x451a('0x38')]=util[_0x451a('0x30')]('SIP/%s',_0x57d356['name']);_0x58bfcd[_0x451a('0x32')]=_0x57d356;}return request({'event':_0x437193,'message':_0x58bfcd});})[_0x451a('0x21')](function(_0x393297){logger[_0x451a('0x1f')](_0x451a('0x1e'),_0x451a('0x3e'),_0x393297);});}};}function getAgent(_0x3bfa66){return db[_0x451a('0x3f')][_0x451a('0x40')]({'where':{'id':_0x3bfa66},'attributes':['id',_0x451a('0x31'),_0x451a('0x41'),'email',_0x451a('0x42')],'raw':!![]})[_0x451a('0x27')](function(_0x5c8e96){return _0x5c8e96;});}exports[_0x451a('0x43')]=function(){for(var _0x25c70a=0x0;_0x25c70a=_0x28d510[_0x3d98('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1461c7(_0x897a02);})['catch'](function(_0x23456e){_0x1e77e0(_0x23456e);});});}; \ No newline at end of file +var _0x1983=['agents','catch','lodash','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp','openchannel','getChannels','includes','clearBlockUser','isUndefined','updateAttributes','role','agent','User','count','then','getLicense'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1983,0x1a4));var _0x3198=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x1983[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x3198('0x0'));var BPromise=require('bluebird');var db=require(_0x3198('0x1'))['db'];var util=require(_0x3198('0x2'));var channels=[_0x3198('0x3'),'mail',_0x3198('0x4'),_0x3198('0x5'),_0x3198('0x6'),_0x3198('0x7'),_0x3198('0x8')];exports[_0x3198('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0xb901cb){_0xb901cb=_0xb901cb['toLowerCase']();return _[_0x3198('0xa')](channels,_0xb901cb);};exports[_0x3198('0xb')]=function(_0x530f6f,_0x373881,_0x4dc19e,_0x420a80){var _0x54effa={'loginAttempts':_0x373881,'blocked':_0x4dc19e};if(!_[_0x3198('0xc')](_0x420a80)){_0x54effa['blockedAt']=_0x420a80;}return _0x530f6f[_0x3198('0xd')](_0x54effa);};exports['getLicense']=function(_0x436005){return new BPromise(function(_0x42fb7b,_0x17b481){var _0x3cedba=0x0;if(_0x436005[_0x3198('0xe')]!==_0x3198('0xf')){_0x42fb7b(_0x436005);}db[_0x3198('0x10')][_0x3198('0x11')]({'where':{'role':_0x3198('0xf'),'online':!![],'id':{'$ne':_0x436005['id']}}})[_0x3198('0x12')](function(_0x519da1){_0x3cedba=_0x519da1;return util[_0x3198('0x13')]();})[_0x3198('0x12')](function(_0x254681){if(_0x254681&&_0x254681[_0x3198('0x14')]&&_0x3cedba>=_0x254681[_0x3198('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x42fb7b(_0x436005);})[_0x3198('0x15')](function(_0x35ef67){_0x17b481(_0x35ef67);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 4431b50..f0efd25 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3721ca,_0x19b50f){_0x3721ca=_0x3721ca-0x0;var _0x2b9056=_0xf4eb[_0x3721ca];return _0x2b9056;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xa571=['name','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','inherits','Bad\x20Request'];(function(_0x27ebff,_0x29bc8a){var _0x300ea0=function(_0x1f400f){while(--_0x1f400f){_0x27ebff['push'](_0x27ebff['shift']());}};_0x300ea0(++_0x29bc8a);}(_0xa571,0x107));var _0x1a57=function(_0x47689e,_0x2d78b2){_0x47689e=_0x47689e-0x0;var _0x146791=_0xa571[_0x47689e];return _0x146791;};'use strict';var util=require(_0x1a57('0x0'));var logger=require(_0x1a57('0x1'))(_0x1a57('0x2'));var APIError=function(_0x1067d9,_0x48485e){this[_0x1a57('0x3')]=_0x1067d9||_0x1a57('0x4');this['name']=_0x48485e||'Error';util[_0x1a57('0x5')](APIError,Error);};var APIBadRequestError=function(_0x5067fa){this[_0x1a57('0x3')]=_0x5067fa||_0x1a57('0x6');this[_0x1a57('0x7')]=_0x1a57('0x6');util[_0x1a57('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x924873){this['message']=_0x924873||_0x1a57('0x8');this[_0x1a57('0x7')]=_0x1a57('0x9');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x3c8182){switch(_0x3c8182){case _0x1a57('0x6'):return 0x190;case _0x1a57('0xa'),_0x1a57('0xb'):return 0x193;case _0x1a57('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x2980b2){return function(_0x62cc63){logger[_0x1a57('0xc')](_0x62cc63['stack']);var _0x562fa4=getStatusCode(_0x62cc63[_0x1a57('0x7')]);if(_0x62cc63[_0x1a57('0x7')])delete _0x62cc63[_0x1a57('0x7')];return _0x2980b2['status'](_0x562fa4)[_0x1a57('0xd')](_0x62cc63);};}module[_0x1a57('0xe')]={'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 a3a1132..0698341 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93ed=['json','send','exports','404','status','render'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x93ed,0xfe));var _0xd93e=function(_0x36153d,_0x4fed67){_0x36153d=_0x36153d-0x0;var _0xfdacff=_0x93ed[_0x36153d];return _0xfdacff;};'use strict';module[_0xd93e('0x0')][0x194]=function pageNotFound(_0x102a8a,_0x44b26f){var _0x19f430=_0xd93e('0x1');var _0x535d66=0x194;var _0xe11d03={'status':_0x535d66};_0x44b26f['status'](_0xe11d03[_0xd93e('0x2')]);_0x44b26f[_0xd93e('0x3')](_0x19f430,{},function(_0x5a4150,_0x462444){if(_0x5a4150){return _0x44b26f[_0xd93e('0x2')](_0xe11d03[_0xd93e('0x2')])[_0xd93e('0x4')](_0xe11d03);}_0x44b26f[_0xd93e('0x5')](_0x462444);});}; \ No newline at end of file +var _0x8b82=['send','exports','404','status','render','json'];(function(_0x2d862e,_0x5f276){var _0x20344d=function(_0x244926){while(--_0x244926){_0x2d862e['push'](_0x2d862e['shift']());}};_0x20344d(++_0x5f276);}(_0x8b82,0x1e1));var _0x28b8=function(_0x8cd4ab,_0x5c1820){_0x8cd4ab=_0x8cd4ab-0x0;var _0x310bca=_0x8b82[_0x8cd4ab];return _0x310bca;};'use strict';module[_0x28b8('0x0')][0x194]=function pageNotFound(_0x3742b7,_0x52c077){var _0xf4a9cf=_0x28b8('0x1');var _0x2ab6f3=0x194;var _0x91b2a6={'status':_0x2ab6f3};_0x52c077[_0x28b8('0x2')](_0x91b2a6[_0x28b8('0x2')]);_0x52c077[_0x28b8('0x3')](_0xf4a9cf,{},function(_0x4490c7,_0x521a9a){if(_0x4490c7){return _0x52c077[_0x28b8('0x2')](_0x91b2a6[_0x28b8('0x2')])[_0x28b8('0x4')](_0x91b2a6);}_0x52c077[_0x28b8('0x5')](_0x521a9a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e6432bc..7824c52 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc772=['HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','UserProfile','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','MailInteraction','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','IntervalId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','restrict','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','FaxAccountId','Exntensions','FaxMessage','mandatoryDispositionPause','FaxApplication','Owner','Users','FaxInteractionId','Attachment','AttachmentId','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatApplication','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','ChatGroupId','Members','CompanyId','Phones','CmContactId','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Queue','Campaign','CampaignId','OwnerId','Automation','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','AnalyticCustomReport','CustomReportId','VoiceMusicOnHold','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Action','TriggerId','Fields','DefaultReportId','MetricId','SalesforceAccount','Configurations','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','SugarcrmAccount','SugarcrmField','Field','VariableId','DeskAccount','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','Dynamics365Account','Dynamics365Configuration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','user_has_teams','TeamVoiceQueue','WhatsappQueue','VoicePrefix','TrunkId','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','Imap','exports','../config/environment','lodash','jstz','determine','sequelize','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','xC@LL1234','database','username','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','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','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../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','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../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','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','UserId','cascade','Recordings','UserVoiceQueueRt','VoiceQueuesRt','hasMany','Extensions'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xc772,0xf9));var _0x2c77=function(_0x43af61,_0x5ac534){_0x43af61=_0x43af61-0x0;var _0x1911a9=_0xc772[_0x43af61];return _0x1911a9;};'use strict';var config=require(_0x2c77('0x0'));var Sequelize=require('sequelize');var _=require(_0x2c77('0x1'));var jstz=require(_0x2c77('0x2'));var timezone=jstz[_0x2c77('0x3')]();config[_0x2c77('0x4')]=_['defaultsDeep'](config[_0x2c77('0x4')],{'database':_0x2c77('0x5'),'username':_0x2c77('0x6'),'password':'xC@LL1234','options':{'host':_0x2c77('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x2c77('0x8')},'logging':![],'timezone':timezone[_0x2c77('0x9')](),'define':{'charset':_0x2c77('0xa'),'collate':_0x2c77('0xb')}}});config[_0x2c77('0xc')]=_[_0x2c77('0xd')](config[_0x2c77('0xc')],{'database':_0x2c77('0x5'),'username':'xcall','password':_0x2c77('0xe'),'options':{'host':_0x2c77('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x2c77('0x8')},'logging':![],'timezone':timezone[_0x2c77('0x9')](),'define':{'charset':'utf8','collate':_0x2c77('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2c77('0x4')][_0x2c77('0xf')],config[_0x2c77('0x4')][_0x2c77('0x10')],config[_0x2c77('0x4')][_0x2c77('0x11')],config[_0x2c77('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x2c77('0xf')],config[_0x2c77('0xc')]['username'],config[_0x2c77('0xc')][_0x2c77('0x11')],config[_0x2c77('0xc')]['options'])};db['User']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x13'));db[_0x2c77('0x14')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x15'));db[_0x2c77('0x16')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x17'));db[_0x2c77('0x18')]=db['sequelize'][_0x2c77('0x12')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x19'));db[_0x2c77('0x1a')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x1b'));db[_0x2c77('0x1c')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/voiceRecording/voiceRecording.model');db[_0x2c77('0x1d')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x1e'));db[_0x2c77('0x1f')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x20'));db[_0x2c77('0x21')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x22'));db[_0x2c77('0x23')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x24'));db[_0x2c77('0x25')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x26'));db[_0x2c77('0x27')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x28'));db[_0x2c77('0x29')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x2c77('0x2a')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x2b'));db['Trunk']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/trunk/trunk.model');db[_0x2c77('0x2c')]=db['sequelize']['import'](_0x2c77('0x2d'));db['UserVoiceQueueRt']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x2c77('0x2e')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x2f'));db[_0x2c77('0x30')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x31'));db[_0x2c77('0x32')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x33'));db['UserFaxQueue']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x34'));db['UserSmsQueue']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x2c77('0x35')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x36'));db[_0x2c77('0x37')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x38'));db[_0x2c77('0x39')]=db['sequelize'][_0x2c77('0x12')]('../api/mailServerIn/mailServerIn.model');db[_0x2c77('0x3a')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x3b'));db[_0x2c77('0x3c')]=db['sequelize']['import'](_0x2c77('0x3d'));db['MailQueue']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x3e'));db['MailSubstatus']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x3f'));db['MailInteraction']=db[_0x2c77('0x4')]['import'](_0x2c77('0x40'));db[_0x2c77('0x41')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x42'));db[_0x2c77('0x43')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x44'));db[_0x2c77('0x45')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x46'));db[_0x2c77('0x47')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x48'));db[_0x2c77('0x49')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x4a'));db['FaxAccount']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x4b'));db['FaxInteraction']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x4c'));db['FaxMessage']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x4d'));db[_0x2c77('0x4e')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/faxQueue/faxQueue.model');db[_0x2c77('0x4f')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0x2c77('0x50')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x51'));db[_0x2c77('0x52')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x53'));db[_0x2c77('0x54')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x55'));db[_0x2c77('0x56')]=db[_0x2c77('0x4')]['import']('../api/smsMessage/smsMessage.model');db[_0x2c77('0x57')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x58'));db[_0x2c77('0x59')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x5a'));db['OpenchannelApplication']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x5b'));db[_0x2c77('0x5c')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x5d'));db[_0x2c77('0x5e')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x5f'));db[_0x2c77('0x60')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x2c77('0x61')]=db['sequelize']['import']('../api/chatWebsite/chatWebsite.model');db[_0x2c77('0x62')]=db['sequelize'][_0x2c77('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/chatApplication/chatApplication.model');db[_0x2c77('0x63')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x64'));db[_0x2c77('0x65')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/chatMessage/chatMessage.model');db[_0x2c77('0x66')]=db[_0x2c77('0x4')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x2c77('0x67')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x68'));db['ChatGroup']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x69'));db['ChatProactiveAction']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x6a'));db[_0x2c77('0x6b')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x6c'));db[_0x2c77('0x6d')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x6e'));db[_0x2c77('0x6f')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x70'));db[_0x2c77('0x71')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x2c77('0x72')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x73'));db[_0x2c77('0x74')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x75'));db[_0x2c77('0x76')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x77'));db[_0x2c77('0x78')]=db[_0x2c77('0x4')]['import']('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x79'));db['Automation']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x7a'));db[_0x2c77('0x7b')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x7c'));db[_0x2c77('0x7d')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x7e'));db[_0x2c77('0x7f')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x80'));db[_0x2c77('0x81')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/interval/interval.model');db['Pause']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x82'));db['Cdr']=db[_0x2c77('0x4')]['import']('../api/cdr/cdr.model');db[_0x2c77('0x83')]=db['sequelize']['import'](_0x2c77('0x84'));db['Schedule']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x85'));db['Sound']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x86'));db[_0x2c77('0x87')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x88'));db[_0x2c77('0x89')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x8a'));db[_0x2c77('0x8b')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x8c'));db[_0x2c77('0x8d')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x8e'));db[_0x2c77('0x8f')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x90'));db[_0x2c77('0x91')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x92'));db[_0x2c77('0x93')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x94'));db[_0x2c77('0x95')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x96'));db[_0x2c77('0x97')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x98'));db['AnalyticCustomReport']=db['sequelize']['import'](_0x2c77('0x99'));db[_0x2c77('0x9a')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x2c77('0x9b')]=db[_0x2c77('0x4')]['import'](_0x2c77('0x9c'));db[_0x2c77('0x9d')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x9e'));db[_0x2c77('0x9f')]=db[_0x2c77('0x4')]['import'](_0x2c77('0xa0'));db['AnalyticTreeReport']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xa1'));db['SalesforceAccount']=db[_0x2c77('0x4')]['import'](_0x2c77('0xa2'));db[_0x2c77('0xa3')]=db[_0x2c77('0x4')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xa4'));db[_0x2c77('0xa5')]=db[_0x2c77('0x4')]['import'](_0x2c77('0xa6'));db['SugarcrmField']=db[_0x2c77('0x4')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xa7'));db[_0x2c77('0xa8')]=db[_0x2c77('0x4')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x2c77('0xa9')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xaa'));db[_0x2c77('0xab')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/intZohoAccount/intZohoAccount.model');db[_0x2c77('0xac')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xad'));db[_0x2c77('0xae')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xaf'));db[_0x2c77('0xb0')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xb1'));db[_0x2c77('0xb2')]=db[_0x2c77('0x4')]['import'](_0x2c77('0xb3'));db['ZendeskField']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xb4'));db[_0x2c77('0xb5')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xb6'));db[_0x2c77('0xb7')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xb8'));db['VtigerAccount']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xb9'));db['VtigerConfiguration']=db[_0x2c77('0x4')]['import'](_0x2c77('0xba'));db[_0x2c77('0xbb')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xbc'));db[_0x2c77('0xbd')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xbe'));db[_0x2c77('0xbf')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xc0'));db[_0x2c77('0xc1')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xc2'));db['Dynamics365Account']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x2c77('0x4')]['import'](_0x2c77('0xc3'));db[_0x2c77('0xc4')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xc5'));db[_0x2c77('0xc6')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xc7'));db[_0x2c77('0xc8')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xc9'));db[_0x2c77('0xca')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xcb'));db[_0x2c77('0x95')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x96'));db[_0x2c77('0xcc')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xcd'));db['ChatQueueReport']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xce'));db[_0x2c77('0xcf')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xd0'));db[_0x2c77('0xd1')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x2c77('0xd2')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xd3'));db[_0x2c77('0xd4')]=db[_0x2c77('0x4')]['import'](_0x2c77('0xd5'));db[_0x2c77('0xd6')]=db[_0x2c77('0x4')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x2c77('0xd7')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xd8'));db[_0x2c77('0xd9')]=db[_0x2c77('0x4')]['import'](_0x2c77('0xda'));db[_0x2c77('0xdb')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xdc'));db['Setting']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/setting/setting.model');db[_0x2c77('0xdd')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xde'));db[_0x2c77('0xdf')]=db[_0x2c77('0x4')]['import']('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xe0'));db[_0x2c77('0xe1')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/squareMessage/squareMessage.model');db[_0x2c77('0xe2')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xe3'));db[_0x2c77('0xe4')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xe5'));db['Campaign']=db[_0x2c77('0x4')]['import'](_0x2c77('0xe6'));db['Migration']=db['sequelize']['import'](_0x2c77('0xe7'));db['Attachment']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xe8'));db[_0x2c77('0xe9')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xea'));db[_0x2c77('0xeb')]=db[_0x2c77('0x4')]['import'](_0x2c77('0xec'));db[_0x2c77('0xed')]=db['sequelize']['import'](_0x2c77('0xee'));db[_0x2c77('0xef')]=db['sequelize'][_0x2c77('0x12')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xf0'));db[_0x2c77('0xf1')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xf2'));db[_0x2c77('0xf3')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0xf4'));db['UserProfile']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xf5'));db[_0x2c77('0xf6')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xf7'));db[_0x2c77('0xf8')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xf9'));db[_0x2c77('0xfa')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/userNotification/userNotification.model');db[_0x2c77('0xfb')]=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0xfc'));db[_0x2c77('0xfd')]=db['sequelize']['import'](_0x2c77('0xfe'));db[_0x2c77('0xff')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x100'));db['WhatsappQueueReport']=db[_0x2c77('0x4')][_0x2c77('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x101'));db['WhatsappQueue']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x102'));db[_0x2c77('0x103')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x104'));db['TeamVoiceQueue']=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x105'));db[_0x2c77('0x106')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x107'));db[_0x2c77('0x108')]=db[_0x2c77('0x4')][_0x2c77('0x12')](_0x2c77('0x109'));db[_0x2c77('0x10a')]=db['sequelize'][_0x2c77('0x12')](_0x2c77('0x10b'));db[_0x2c77('0x10c')][_0x2c77('0x10d')](db['VoiceMail'],{'as':_0x2c77('0x1f'),'onDelete':'cascade','foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')]['hasOne'](db[_0x2c77('0x10a')],{'as':'userSetting','onDelete':_0x2c77('0x10f'),'foreignKey':'UserId'});db[_0x2c77('0x10c')]['hasMany'](db['VoiceRecording'],{'as':_0x2c77('0x110'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')]['hasMany'](db[_0x2c77('0x111')],{'as':_0x2c77('0x112'),'foreignKey':'UserId'});db[_0x2c77('0x10c')][_0x2c77('0x113')](db['VoiceExtension'],{'as':_0x2c77('0x114'),'onDelete':_0x2c77('0x10f'),'hooks':!![]});db['User'][_0x2c77('0x113')](db[_0x2c77('0x72')],{'as':_0x2c77('0x115'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')][_0x2c77('0x113')](db[_0x2c77('0x74')],{'as':_0x2c77('0x116'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')]['hasMany'](db[_0x2c77('0x76')],{'as':_0x2c77('0x76'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')][_0x2c77('0x113')](db['OpenchannelInteraction'],{'as':_0x2c77('0x117'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')][_0x2c77('0x113')](db[_0x2c77('0x63')],{'as':_0x2c77('0x118'),'foreignKey':'UserId'});db[_0x2c77('0x10c')][_0x2c77('0x113')](db['SmsInteraction'],{'as':_0x2c77('0x119'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')][_0x2c77('0x113')](db[_0x2c77('0x11a')],{'as':_0x2c77('0x11b'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')][_0x2c77('0x113')](db['MailInteraction'],{'as':_0x2c77('0x11c'),'foreignKey':'UserId'});db[_0x2c77('0x10c')][_0x2c77('0x113')](db[_0x2c77('0xfd')],{'as':'WhatsappInteractions','foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x10c')][_0x2c77('0x113')](db['UserNotification'],{'as':_0x2c77('0x11d'),'foreignKey':_0x2c77('0x11e')});db[_0x2c77('0x10c')][_0x2c77('0x11f')](db[_0x2c77('0x120')],{'as':_0x2c77('0x120'),'foreignKey':'userProfileId'});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x122')],{'as':'Groups','through':_0x2c77('0x123')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x124'),'through':_0x2c77('0x125')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0xf3')],{'as':_0x2c77('0x126'),'through':_0x2c77('0x127')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db['Team'],{'through':'user_has_teams'});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x128')],{'as':_0x2c77('0x11c'),'through':_0x2c77('0x129')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db['ChatInteraction'],{'as':_0x2c77('0x118'),'through':'user_has_chat_interactions'});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x11a')],{'as':_0x2c77('0x11b'),'through':_0x2c77('0x12a')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x54')],{'as':_0x2c77('0x119'),'through':_0x2c77('0x12b')});db[_0x2c77('0x10c')]['belongsToMany'](db[_0x2c77('0x5c')],{'as':_0x2c77('0x117'),'through':_0x2c77('0x12c')});db['User'][_0x2c77('0x121')](db[_0x2c77('0xfd')],{'as':_0x2c77('0x12d'),'through':_0x2c77('0x12e')});db[_0x2c77('0x10c')]['belongsToMany'](db['VoiceQueue'],{'as':_0x2c77('0x12f'),'through':_0x2c77('0x2e'),'required':![]});db['User'][_0x2c77('0x121')](db['VoicePrefix'],{'as':_0x2c77('0x130'),'through':_0x2c77('0x108'),'required':![]});db[_0x2c77('0x10c')]['belongsToMany'](db[_0x2c77('0x131')],{'as':'MailQueues','through':_0x2c77('0x32'),'required':![]});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x67')],{'as':_0x2c77('0x132'),'through':_0x2c77('0x30'),'required':![],'hooks':!![]});db['User'][_0x2c77('0x121')](db[_0x2c77('0x4e')],{'as':_0x2c77('0x133'),'through':'UserFaxQueue','required':![]});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x57')],{'as':_0x2c77('0x134'),'through':_0x2c77('0x135'),'required':![]});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x60')],{'as':_0x2c77('0x136'),'through':_0x2c77('0x35'),'required':![]});db[_0x2c77('0x10c')][_0x2c77('0x121')](db['WhatsappQueue'],{'as':_0x2c77('0x137'),'through':'UserWhatsappQueue','required':![]});db['User']['belongsToMany'](db[_0x2c77('0xf3')],{'through':_0x2c77('0x127')});db[_0x2c77('0x10c')]['belongsToMany'](db[_0x2c77('0x61')],{'as':_0x2c77('0x138'),'through':_0x2c77('0x139')});db['User'][_0x2c77('0x121')](db[_0x2c77('0x13a')],{'as':_0x2c77('0x13b'),'through':_0x2c77('0x13c')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x3c')],{'as':_0x2c77('0x13d'),'through':_0x2c77('0x13e')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db['OpenchannelAccount'],{'as':_0x2c77('0x13f'),'through':'user_has_openchannel_accounts'});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0x50')],{'as':_0x2c77('0x140'),'through':_0x2c77('0x141')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db[_0x2c77('0xfb')],{'as':_0x2c77('0x142'),'through':_0x2c77('0x143')});db[_0x2c77('0x10c')][_0x2c77('0x121')](db['SquareProject'],{'as':_0x2c77('0x144'),'through':_0x2c77('0x145')});db[_0x2c77('0x14')][_0x2c77('0x113')](db[_0x2c77('0x18')],{'as':_0x2c77('0x146'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x147')});db[_0x2c77('0x16')][_0x2c77('0x113')](db['VoiceExtension'],{'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x18')][_0x2c77('0x113')](db['VoiceExtension'],{'as':_0x2c77('0x148'),'onDelete':_0x2c77('0x10f')});db['VoiceMusicOnHold'][_0x2c77('0x121')](db[_0x2c77('0x149')],{'as':_0x2c77('0x14a'),'through':_0x2c77('0x14b')});db[_0x2c77('0x1a')][_0x2c77('0x113')](db[_0x2c77('0x111')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x2c77('0x1a')][_0x2c77('0x113')](db[_0x2c77('0x6f')],{'as':_0x2c77('0x14c'),'foreignKey':_0x2c77('0x14d')});db[_0x2c77('0x1a')][_0x2c77('0x113')](db[_0x2c77('0x72')],{'as':_0x2c77('0x115'),'foreignKey':_0x2c77('0x14d')});db[_0x2c77('0x1a')][_0x2c77('0x113')](db[_0x2c77('0x74')],{'as':_0x2c77('0x14e'),'foreignKey':_0x2c77('0x14d')});db['VoiceQueue'][_0x2c77('0x113')](db[_0x2c77('0x76')],{'as':_0x2c77('0x76'),'foreignKey':_0x2c77('0x14d')});db[_0x2c77('0x1a')]['hasMany'](db[_0x2c77('0x71')],{'as':_0x2c77('0x14f'),'foreignKey':_0x2c77('0x14d')});db[_0x2c77('0x1a')][_0x2c77('0x113')](db[_0x2c77('0xd4')],{'as':_0x2c77('0x150'),'foreignKey':_0x2c77('0x14d')});db[_0x2c77('0x1a')]['belongsTo'](db[_0x2c77('0x151')],{'as':_0x2c77('0x151'),'foreignKey':'TrunkId'});db[_0x2c77('0x1a')][_0x2c77('0x11f')](db['Trunk'],{'as':_0x2c77('0x152'),'foreignKey':'TrunkBackupId'});db[_0x2c77('0x1a')][_0x2c77('0x11f')](db['Interval'],{'as':_0x2c77('0x81'),'foreignKey':_0x2c77('0x153')});db[_0x2c77('0x1a')][_0x2c77('0x11f')](db[_0x2c77('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0x2c77('0x155')});db[_0x2c77('0x1a')]['belongsToMany'](db[_0x2c77('0xf3')],{'as':_0x2c77('0x126'),'through':_0x2c77('0x156')});db['VoiceQueue'][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':'Agents','through':_0x2c77('0x2e')});db['VoiceQueue'][_0x2c77('0x121')](db['Team'],{'as':_0x2c77('0x157'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0x2c77('0x121')](db['CmList'],{'as':_0x2c77('0x158'),'through':_0x2c77('0x159')});db['VoiceRecording'][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x10c'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x1d')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x10c'),'foreignKey':'UserId'});db[_0x2c77('0x1f')][_0x2c77('0x113')](db['VoiceMailMessage'],{'as':_0x2c77('0x15a'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x15b'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x2c77('0x11f')](db['VoiceMail'],{'foreignKey':_0x2c77('0x15b'),'targetKey':_0x2c77('0x15c')});db[_0x2c77('0x23')][_0x2c77('0x113')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x2c77('0x15d'),'constraints':![]});db[_0x2c77('0x23')]['hasMany'](db['VoiceAgentReport'],{'as':_0x2c77('0x15e'),'foreignKey':_0x2c77('0x15d'),'constraints':![]});db[_0x2c77('0x23')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x10c'),'foreignKey':'UserId'});db[_0x2c77('0x23')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x39')][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{'as':_0x2c77('0x3c'),'foreignKey':'MailAccountId'});db[_0x2c77('0x39')]['belongsTo'](db[_0x2c77('0x103')],{'as':_0x2c77('0x103'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x2c77('0x3a')][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{'as':_0x2c77('0x3c'),'foreignKey':_0x2c77('0x161')});db[_0x2c77('0x3a')][_0x2c77('0x11f')](db[_0x2c77('0x103')],{'as':_0x2c77('0x103'),'foreignKey':'CloudProviderId','onDelete':_0x2c77('0x162')});db['MailAccount']['hasOne'](db[_0x2c77('0x39')],{'as':'Imap','onDelete':_0x2c77('0x10f')});db[_0x2c77('0x3c')][_0x2c77('0x10d')](db[_0x2c77('0x3a')],{'as':_0x2c77('0x163'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x3c')][_0x2c77('0x113')](db[_0x2c77('0x7d')],{'as':_0x2c77('0x164'),'foreignKey':_0x2c77('0x161'),'onDelete':_0x2c77('0x10f')});db['MailAccount'][_0x2c77('0x113')](db[_0x2c77('0x7b')],{'as':_0x2c77('0x165'),'foreignKey':'MailAccountId'});db[_0x2c77('0x3c')][_0x2c77('0x113')](db[_0x2c77('0x41')],{'as':_0x2c77('0x15a'),'foreignKey':_0x2c77('0x161')});db[_0x2c77('0x3c')][_0x2c77('0x113')](db[_0x2c77('0x128')],{'as':_0x2c77('0x166')});db[_0x2c77('0x3c')][_0x2c77('0x113')](db['MailApplication'],{'as':_0x2c77('0x148')});db[_0x2c77('0x3c')][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0x3c')][_0x2c77('0x11f')](db[_0x2c77('0x8f')],{'as':_0x2c77('0x8f'),'foreignKey':_0x2c77('0x169')});db[_0x2c77('0x3c')][_0x2c77('0x11f')](db[_0x2c77('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0x2c77('0x155')});db[_0x2c77('0x3c')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x32')});db[_0x2c77('0x131')][_0x2c77('0x121')](db['Team'],{'through':_0x2c77('0x16b'),'as':_0x2c77('0x157')});db[_0x2c77('0x128')]['hasMany'](db[_0x2c77('0x41')],{'as':_0x2c77('0x15a'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x16c')});db[_0x2c77('0x128')][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x161')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x2c77('0x15f'),'foreignKey':'ContactId'});db[_0x2c77('0x128')]['belongsTo'](db[_0x2c77('0x10c')],{'as':'Owner','foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x128')][_0x2c77('0x121')](db[_0x2c77('0x87')],{'through':_0x2c77('0x16e'),'as':_0x2c77('0x16f')});db[_0x2c77('0x128')][_0x2c77('0x121')](db['Tag'],{'through':_0x2c77('0x16e'),'as':_0x2c77('0x170')});db['MailInteraction']['belongsToMany'](db[_0x2c77('0x10c')],{'as':'Users','through':_0x2c77('0x129'),'foreignKey':_0x2c77('0x16c')});db['MailMessage']['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':_0x2c77('0x10f')});db[_0x2c77('0x41')][_0x2c77('0x11f')](db['User'],{'as':_0x2c77('0x10c')});db[_0x2c77('0x41')]['belongsTo'](db[_0x2c77('0x6d')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x15f')});db['MailMessage'][_0x2c77('0x11f')](db['MailInteraction'],{'as':_0x2c77('0x171'),'foreignKey':_0x2c77('0x16c')});db[_0x2c77('0x41')][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{'as':_0x2c77('0x16d'),'foreignKey':'MailAccountId'});db[_0x2c77('0x41')][_0x2c77('0x11f')](db['ChatWebsite'],{'as':_0x2c77('0x61'),'foreignKey':_0x2c77('0x172')});db[_0x2c77('0x41')][_0x2c77('0x11f')](db['ChatOfflineMessage'],{'as':_0x2c77('0x66'),'foreignKey':_0x2c77('0x173')});db[_0x2c77('0x43')][_0x2c77('0x11f')](db['User'],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x43')][_0x2c77('0x11f')](db[_0x2c77('0x131')],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x43')]['belongsTo'](db['MailAccount'],{'onDelete':_0x2c77('0x162')});db['MailApplication'][_0x2c77('0x11f')](db[_0x2c77('0x81')],{'onDelete':_0x2c77('0x162'),'foreignKey':_0x2c77('0x153')});db['MailApplication'][_0x2c77('0x11f')](db[_0x2c77('0x87')],{'onDelete':_0x2c77('0x162'),'foreignKey':_0x2c77('0x174')});db[_0x2c77('0x45')][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{});db['MailQueueReport']['belongsTo'](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0x45')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':'Contact','foreignKey':_0x2c77('0x160')});db[_0x2c77('0x45')][_0x2c77('0x11f')](db[_0x2c77('0x128')],{});db[_0x2c77('0x45')][_0x2c77('0x11f')](db[_0x2c77('0x41')],{});db[_0x2c77('0x45')]['belongsTo'](db[_0x2c77('0x10c')],{});db[_0x2c77('0x45')]['belongsTo'](db[_0x2c77('0x131')],{});db['Dashboard'][_0x2c77('0x113')](db[_0x2c77('0x49')],{'as':'Items','onDelete':_0x2c77('0x10f')});db['FaxAccount'][_0x2c77('0x113')](db[_0x2c77('0x7d')],{'as':_0x2c77('0x164'),'foreignKey':_0x2c77('0x175'),'onDelete':_0x2c77('0x10f')});db['FaxAccount'][_0x2c77('0x113')](db[_0x2c77('0x7b')],{'as':'Answers','foreignKey':_0x2c77('0x175')});db[_0x2c77('0x13a')][_0x2c77('0x113')](db[_0x2c77('0x11a')],{'as':_0x2c77('0x166')});db[_0x2c77('0x13a')][_0x2c77('0x113')](db['FaxApplication'],{'as':_0x2c77('0x148')});db[_0x2c77('0x13a')]['hasMany'](db[_0x2c77('0x18')],{'as':_0x2c77('0x176'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x13a')][_0x2c77('0x113')](db[_0x2c77('0x177')],{'as':_0x2c77('0x15a')});db['FaxAccount']['belongsTo'](db[_0x2c77('0x151')],{'as':'Trunk'});db[_0x2c77('0x13a')][_0x2c77('0x11f')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x2c77('0x13a')][_0x2c77('0x11f')](db[_0x2c77('0x154')],{'as':_0x2c77('0x178'),'foreignKey':_0x2c77('0x155')});db['FaxAccount']['belongsToMany'](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x13c')});db['FaxApplication']['belongsTo'](db[_0x2c77('0x10c')],{'onDelete':'restrict'});db[_0x2c77('0x179')][_0x2c77('0x11f')](db[_0x2c77('0x4e')],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x179')][_0x2c77('0x11f')](db['FaxAccount'],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x179')][_0x2c77('0x11f')](db[_0x2c77('0x87')],{'onDelete':_0x2c77('0x162'),'foreignKey':_0x2c77('0x174')});db[_0x2c77('0x11a')][_0x2c77('0x113')](db[_0x2c77('0x177')],{'as':_0x2c77('0x15a'),'onDelete':_0x2c77('0x10f'),'foreignKey':'FaxInteractionId'});db[_0x2c77('0x11a')]['belongsTo'](db[_0x2c77('0x13a')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x175')});db['FaxInteraction'][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x2c77('0x11f')](db['User'],{'as':_0x2c77('0x17a'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x11a')][_0x2c77('0x121')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x2c77('0x16f')});db['FaxInteraction']['belongsToMany'](db[_0x2c77('0x87')],{'through':'fax_interaction_has_tags','as':_0x2c77('0x170')});db[_0x2c77('0x11a')][_0x2c77('0x121')](db['User'],{'as':_0x2c77('0x17b'),'through':_0x2c77('0x12a'),'foreignKey':_0x2c77('0x17c')});db[_0x2c77('0x177')][_0x2c77('0x11f')](db['User'],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x10c')});db[_0x2c77('0x177')][_0x2c77('0x11f')](db[_0x2c77('0x11a')],{'as':_0x2c77('0x171'),'foreignKey':'FaxInteractionId'});db[_0x2c77('0x177')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x15f')});db[_0x2c77('0x177')][_0x2c77('0x11f')](db[_0x2c77('0x17d')],{'as':_0x2c77('0x17d'),'foreignKey':_0x2c77('0x17e')});db[_0x2c77('0x177')][_0x2c77('0x11f')](db[_0x2c77('0x13a')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x175')});db[_0x2c77('0x4e')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':'UserFaxQueue'});db['FaxQueue'][_0x2c77('0x121')](db[_0x2c77('0xe2')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x2c77('0x4f')][_0x2c77('0x11f')](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db[_0x2c77('0xf3')],{'as':'List','foreignKey':'ListId'});db[_0x2c77('0x4f')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x4f')][_0x2c77('0x11f')](db[_0x2c77('0x11a')],{});db[_0x2c77('0x4f')]['belongsTo'](db[_0x2c77('0x177')],{});db[_0x2c77('0x4f')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{});db[_0x2c77('0x4f')][_0x2c77('0x11f')](db[_0x2c77('0x4e')],{});db[_0x2c77('0x50')][_0x2c77('0x113')](db[_0x2c77('0x7d')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0x2c77('0x10f')});db[_0x2c77('0x50')][_0x2c77('0x113')](db[_0x2c77('0x7b')],{'as':_0x2c77('0x165'),'foreignKey':_0x2c77('0x17f')});db[_0x2c77('0x50')][_0x2c77('0x113')](db[_0x2c77('0x56')],{'as':_0x2c77('0x15a'),'foreignKey':_0x2c77('0x17f')});db[_0x2c77('0x50')][_0x2c77('0x113')](db[_0x2c77('0x54')],{'as':_0x2c77('0x166')});db[_0x2c77('0x50')][_0x2c77('0x113')](db[_0x2c77('0x52')],{'as':_0x2c77('0x148')});db[_0x2c77('0x50')][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0x50')][_0x2c77('0x11f')](db[_0x2c77('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0x2c77('0x155')});db[_0x2c77('0x50')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x141')});db[_0x2c77('0x52')][_0x2c77('0x11f')](db['User'],{'onDelete':_0x2c77('0x162')});db['SmsApplication']['belongsTo'](db[_0x2c77('0x57')],{'onDelete':_0x2c77('0x162')});db['SmsApplication'][_0x2c77('0x11f')](db[_0x2c77('0x50')],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x52')][_0x2c77('0x11f')](db[_0x2c77('0x81')],{'onDelete':_0x2c77('0x162'),'foreignKey':_0x2c77('0x153')});db[_0x2c77('0x52')][_0x2c77('0x11f')](db[_0x2c77('0x87')],{'onDelete':_0x2c77('0x162'),'foreignKey':'TagId'});db[_0x2c77('0x54')][_0x2c77('0x113')](db[_0x2c77('0x56')],{'as':_0x2c77('0x15a'),'onDelete':_0x2c77('0x10f'),'foreignKey':'SmsInteractionId'});db[_0x2c77('0x54')][_0x2c77('0x11f')](db[_0x2c77('0x50')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x17f')});db[_0x2c77('0x54')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':'ContactId'});db[_0x2c77('0x54')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x17a'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x54')][_0x2c77('0x121')](db[_0x2c77('0x87')],{'through':_0x2c77('0x180'),'as':_0x2c77('0x16f')});db[_0x2c77('0x54')][_0x2c77('0x121')](db[_0x2c77('0x87')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x2c77('0x54')]['belongsToMany'](db[_0x2c77('0x10c')],{'as':_0x2c77('0x17b'),'through':_0x2c77('0x12b'),'foreignKey':_0x2c77('0x181')});db['SmsMessage'][_0x2c77('0x11f')](db['User'],{'as':'User'});db[_0x2c77('0x56')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x15f')});db[_0x2c77('0x56')]['belongsTo'](db[_0x2c77('0x54')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x171'),'foreignKey':_0x2c77('0x181')});db[_0x2c77('0x56')]['belongsTo'](db[_0x2c77('0x50')],{'as':_0x2c77('0x16d'),'foreignKey':'SmsAccountId'});db[_0x2c77('0x57')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x135'),'foreignKey':_0x2c77('0x182')});db['SmsQueue'][_0x2c77('0x121')](db[_0x2c77('0xe2')],{'through':_0x2c77('0x183'),'as':'Teams'});db[_0x2c77('0x59')][_0x2c77('0x113')](db['Disposition'],{'as':_0x2c77('0x164'),'foreignKey':_0x2c77('0x184'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x59')][_0x2c77('0x113')](db[_0x2c77('0x7b')],{'as':_0x2c77('0x165'),'foreignKey':_0x2c77('0x184')});db[_0x2c77('0x59')][_0x2c77('0x113')](db[_0x2c77('0x5c')],{'as':_0x2c77('0x166'),'foreignKey':_0x2c77('0x184')});db[_0x2c77('0x59')]['hasMany'](db[_0x2c77('0x5e')],{'as':_0x2c77('0x15a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2c77('0x113')](db[_0x2c77('0x185')],{'as':'Applications','foreignKey':_0x2c77('0x184')});db['OpenchannelAccount'][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':'ListId'});db[_0x2c77('0x59')][_0x2c77('0x11f')](db[_0x2c77('0x154')],{'as':_0x2c77('0x178'),'foreignKey':_0x2c77('0x155')});db[_0x2c77('0x59')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x186')});db[_0x2c77('0x185')]['belongsTo'](db[_0x2c77('0x10c')],{'onDelete':_0x2c77('0x162')});db['OpenchannelApplication'][_0x2c77('0x11f')](db[_0x2c77('0x60')],{'onDelete':_0x2c77('0x162'),'foreignKey':_0x2c77('0x187')});db['OpenchannelApplication'][_0x2c77('0x11f')](db[_0x2c77('0x59')],{'onDelete':_0x2c77('0x162'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x2c77('0x11f')](db[_0x2c77('0x81')],{'onDelete':_0x2c77('0x162'),'foreignKey':_0x2c77('0x153')});db[_0x2c77('0x185')][_0x2c77('0x11f')](db[_0x2c77('0x87')],{'onDelete':_0x2c77('0x162'),'foreignKey':_0x2c77('0x174')});db[_0x2c77('0x5c')][_0x2c77('0x113')](db[_0x2c77('0x5e')],{'as':'Messages','onDelete':_0x2c77('0x10f'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x2c77('0x11f')](db[_0x2c77('0x59')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x184')});db[_0x2c77('0x5c')]['belongsTo'](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x5c')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x17a'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x5c')][_0x2c77('0x121')](db['Tag'],{'through':_0x2c77('0x188'),'as':_0x2c77('0x16f')});db[_0x2c77('0x5c')]['belongsToMany'](db[_0x2c77('0x87')],{'through':_0x2c77('0x188'),'as':_0x2c77('0x170')});db[_0x2c77('0x5c')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x17b'),'through':_0x2c77('0x12c'),'foreignKey':_0x2c77('0x189')});db[_0x2c77('0x5e')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x10c')});db[_0x2c77('0x5e')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'onDelete':'cascade','as':_0x2c77('0x15f')});db[_0x2c77('0x5e')]['belongsTo'](db[_0x2c77('0x5c')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x171'),'foreignKey':_0x2c77('0x189')});db[_0x2c77('0x5e')][_0x2c77('0x11f')](db[_0x2c77('0x17d')],{'as':_0x2c77('0x17d'),'foreignKey':_0x2c77('0x17e')});db['OpenchannelMessage'][_0x2c77('0x11f')](db[_0x2c77('0x59')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x184')});db[_0x2c77('0x60')]['belongsToMany'](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x35'),'foreignKey':_0x2c77('0x187')});db['OpenchannelQueue'][_0x2c77('0x121')](db[_0x2c77('0xe2')],{'through':_0x2c77('0x18a'),'as':'Teams'});db[_0x2c77('0x61')][_0x2c77('0x113')](db[_0x2c77('0x7d')],{'as':_0x2c77('0x164'),'foreignKey':_0x2c77('0x172'),'onDelete':'cascade'});db[_0x2c77('0x61')]['hasMany'](db[_0x2c77('0x7b')],{'as':_0x2c77('0x165'),'foreignKey':_0x2c77('0x172')});db[_0x2c77('0x61')][_0x2c77('0x113')](db[_0x2c77('0x18b')],{'as':_0x2c77('0x18c')});db[_0x2c77('0x61')][_0x2c77('0x113')](db[_0x2c77('0x63')],{'as':_0x2c77('0x166')});db[_0x2c77('0x61')][_0x2c77('0x113')](db[_0x2c77('0x18d')],{'as':'Applications'});db[_0x2c77('0x61')][_0x2c77('0x113')](db['ChatMessage'],{'as':_0x2c77('0x15a')});db[_0x2c77('0x61')][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':'ListId'});db[_0x2c77('0x61')][_0x2c77('0x11f')](db['Interval'],{'as':_0x2c77('0x81'),'foreignKey':_0x2c77('0x153')});db[_0x2c77('0x61')][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{'as':_0x2c77('0x3c'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0x2c77('0x11f')](db['Pause'],{'as':_0x2c77('0x178'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2c77('0x61')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport']['belongsTo'](db[_0x2c77('0x59')],{});db['OpenchannelQueueReport'][_0x2c77('0x11f')](db['CmList'],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0x62')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':'Contact','foreignKey':_0x2c77('0x160')});db[_0x2c77('0x62')][_0x2c77('0x11f')](db[_0x2c77('0x5c')],{});db[_0x2c77('0x62')][_0x2c77('0x11f')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x2c77('0x10c')],{});db[_0x2c77('0x62')][_0x2c77('0x11f')](db[_0x2c77('0x60')],{});db['ChatApplication'][_0x2c77('0x11f')](db['User'],{'as':'Agent','foreignKey':_0x2c77('0x10e'),'onDelete':_0x2c77('0x162')});db[_0x2c77('0x18d')][_0x2c77('0x11f')](db[_0x2c77('0x67')],{'as':'Queue','foreignKey':_0x2c77('0x18e'),'onDelete':'restrict'});db[_0x2c77('0x18d')]['belongsTo'](db[_0x2c77('0x61')],{'as':_0x2c77('0x18f'),'foreignKey':_0x2c77('0x172'),'onDelete':_0x2c77('0x162')});db[_0x2c77('0x18d')]['belongsTo'](db[_0x2c77('0x87')],{'onDelete':_0x2c77('0x162'),'foreignKey':'TagId'});db[_0x2c77('0x63')][_0x2c77('0x113')](db[_0x2c77('0x65')],{'as':'Messages','onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x190')});db[_0x2c77('0x63')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2c77('0x172')});db['ChatInteraction'][_0x2c77('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0x2c77('0x160')});db[_0x2c77('0x63')][_0x2c77('0x11f')](db['User'],{'as':_0x2c77('0x17a'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x63')][_0x2c77('0x121')](db[_0x2c77('0x87')],{'through':_0x2c77('0x191'),'as':_0x2c77('0x16f')});db[_0x2c77('0x63')]['belongsToMany'](db[_0x2c77('0x87')],{'through':_0x2c77('0x191'),'as':_0x2c77('0x170')});db[_0x2c77('0x63')][_0x2c77('0x121')](db['User'],{'as':'Users','through':_0x2c77('0x192'),'foreignKey':_0x2c77('0x190')});db[_0x2c77('0x65')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x10c')});db[_0x2c77('0x65')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x65')][_0x2c77('0x11f')](db[_0x2c77('0x63')],{'onDelete':'cascade','as':_0x2c77('0x171'),'foreignKey':'ChatInteractionId'});db[_0x2c77('0x65')]['belongsTo'](db[_0x2c77('0x17d')],{'as':_0x2c77('0x17d'),'foreignKey':_0x2c77('0x17e')});db[_0x2c77('0x65')][_0x2c77('0x11f')](db[_0x2c77('0x61')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x172')});db[_0x2c77('0x66')][_0x2c77('0x113')](db[_0x2c77('0x17d')],{'as':_0x2c77('0x193'),'foreignKey':_0x2c77('0x173'),'onDelete':'cascade','hooks':!![]});db[_0x2c77('0x66')]['belongsTo'](db[_0x2c77('0x6d')],{'onDelete':_0x2c77('0x10f'),'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x66')][_0x2c77('0x11f')](db[_0x2c77('0x61')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x172')});db[_0x2c77('0x67')][_0x2c77('0x121')](db['User'],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x30'),'hooks':!![]});db[_0x2c77('0x67')][_0x2c77('0x121')](db[_0x2c77('0xe2')],{'through':_0x2c77('0x194'),'as':_0x2c77('0x157')});db['ChatGroup'][_0x2c77('0x113')](db[_0x2c77('0xcf')],{'as':'Messages','foreignKey':_0x2c77('0x195'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x122')]['belongsToMany'](db[_0x2c77('0x10c')],{'as':_0x2c77('0x196'),'through':_0x2c77('0x123')});db[_0x2c77('0x18b')][_0x2c77('0x11f')](db[_0x2c77('0x61')],{'as':_0x2c77('0x18f'),'foreignKey':'ChatWebsiteId'});db[_0x2c77('0x6b')][_0x2c77('0x113')](db['CmContact'],{'as':_0x2c77('0x124'),'foreignKey':_0x2c77('0x197')});db[_0x2c77('0x6d')][_0x2c77('0x113')](db[_0x2c77('0x8b')],{'as':_0x2c77('0x198'),'foreignKey':_0x2c77('0x199')});db['CmContact'][_0x2c77('0x113')](db['CmHopper'],{'as':_0x2c77('0x14c'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x6d')][_0x2c77('0x113')](db['CmHopperFinal'],{'as':_0x2c77('0x115'),'foreignKey':'ContactId'});db[_0x2c77('0x6d')][_0x2c77('0x113')](db[_0x2c77('0x74')],{'as':_0x2c77('0x14e'),'foreignKey':_0x2c77('0x160')});db['CmContact'][_0x2c77('0x113')](db[_0x2c77('0x76')],{'as':_0x2c77('0x76'),'foreignKey':_0x2c77('0x160')});db['CmContact'][_0x2c77('0x113')](db[_0x2c77('0xd4')],{'as':_0x2c77('0x150'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x6d')]['hasMany'](db[_0x2c77('0x5c')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x2c77('0x6d')][_0x2c77('0x113')](db[_0x2c77('0x63')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x2c77('0x6d')]['hasMany'](db[_0x2c77('0x54')],{'as':_0x2c77('0x119'),'foreignKey':'ContactId','onDelete':_0x2c77('0x162')});db[_0x2c77('0x6d')][_0x2c77('0x113')](db[_0x2c77('0x11a')],{'as':_0x2c77('0x11b'),'foreignKey':_0x2c77('0x160'),'onDelete':_0x2c77('0x162')});db[_0x2c77('0x6d')]['hasMany'](db['MailInteraction'],{'as':_0x2c77('0x11c'),'foreignKey':'ContactId','onDelete':_0x2c77('0x162')});db['CmContact'][_0x2c77('0x11f')](db[_0x2c77('0x6b')],{'as':'Company','foreignKey':_0x2c77('0x197')});db[_0x2c77('0x6d')][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x2c77('0x6d')]['belongsToMany'](db[_0x2c77('0x10c')],{'as':'Users','through':_0x2c77('0x125')});db[_0x2c77('0x6d')]['belongsToMany'](db[_0x2c77('0x87')],{'as':_0x2c77('0x16f'),'through':_0x2c77('0x19a')});db[_0x2c77('0x6d')][_0x2c77('0x121')](db['Tag'],{'through':_0x2c77('0x19a'),'as':_0x2c77('0x170')});db['CmHopper']['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x2c77('0x19b'),'foreignKey':_0x2c77('0x19c')});db['CmHopper'][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':'ContactId','onDelete':_0x2c77('0x10f')});db[_0x2c77('0x6f')][_0x2c77('0x11f')](db['CmList'],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x6f')]['belongsTo'](db[_0x2c77('0x10c')],{'as':_0x2c77('0x19d'),'foreignKey':_0x2c77('0x10e')});db[_0x2c77('0x6f')][_0x2c77('0x11f')](db['VoiceQueue'],{'as':_0x2c77('0x19e'),'foreignKey':_0x2c77('0x14d'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x6f')]['belongsTo'](db[_0x2c77('0x19f')],{'as':_0x2c77('0x19f'),'foreignKey':_0x2c77('0x1a0'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x6f')][_0x2c77('0x11f')](db['User'],{'as':_0x2c77('0x17a'),'foreignKey':_0x2c77('0x1a1')});db[_0x2c77('0x71')][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':'ContactId','onDelete':_0x2c77('0x10f')});db[_0x2c77('0x71')][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':'List','foreignKey':_0x2c77('0x168'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x71')][_0x2c77('0x11f')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x2c77('0x14d'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x71')]['belongsTo'](db[_0x2c77('0x19f')],{'as':_0x2c77('0x19f'),'foreignKey':_0x2c77('0x1a0'),'onDelete':'cascade'});db[_0x2c77('0x1a2')]['hasMany'](db[_0x2c77('0x7f')],{'as':{'plural':'All','singular':_0x2c77('0x1a3')},'foreignKey':_0x2c77('0x1a4'),'onDelete':_0x2c77('0x10f'),'hooks':!![]});db[_0x2c77('0x1a2')][_0x2c77('0x113')](db[_0x2c77('0x7f')],{'as':{'plural':_0x2c77('0x1a5'),'singular':'OneAny'},'foreignKey':_0x2c77('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0x2c77('0x1a2')][_0x2c77('0x113')](db['Action'],{'as':_0x2c77('0x1a7'),'foreignKey':_0x2c77('0x1a8'),'onDelete':_0x2c77('0x10f'),'hooks':!![]});db[_0x2c77('0x7d')][_0x2c77('0x113')](db[_0x2c77('0x7d')],{'as':_0x2c77('0x164'),'foreignKey':_0x2c77('0x1a9'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0x81')]['hasMany'](db[_0x2c77('0x81')],{'as':_0x2c77('0x1aa'),'foreignKey':_0x2c77('0x153'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x2c77('0x113')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x2c77('0x153'),'onDelete':_0x2c77('0x162')});db[_0x2c77('0x81')][_0x2c77('0x113')](db[_0x2c77('0x43')],{'as':_0x2c77('0x1ab'),'foreignKey':'IntervalId'});db['Interval'][_0x2c77('0x113')](db[_0x2c77('0x18d')],{'as':_0x2c77('0x1ac'),'foreignKey':'IntervalId'});db['Interval'][_0x2c77('0x113')](db[_0x2c77('0x179')],{'as':_0x2c77('0x1ad'),'foreignKey':'IntervalId'});db[_0x2c77('0x81')]['hasMany'](db['SmsApplication'],{'as':_0x2c77('0x1ae'),'foreignKey':_0x2c77('0x153')});db['Schedule'][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{});db[_0x2c77('0x1af')][_0x2c77('0x11f')](db[_0x2c77('0x9a')],{'foreignKey':'DefaultReportId'});db[_0x2c77('0x1af')][_0x2c77('0x11f')](db[_0x2c77('0x1b0')],{'foreignKey':_0x2c77('0x1b1')});db[_0x2c77('0x149')][_0x2c77('0x121')](db[_0x2c77('0x1b2')],{'as':_0x2c77('0x1b3'),'through':_0x2c77('0x14b'),'onDelete':_0x2c77('0x162')});db[_0x2c77('0x87')][_0x2c77('0x121')](db[_0x2c77('0x6d')],{'through':'cm_contact_has_tags'});db[_0x2c77('0x87')][_0x2c77('0x121')](db[_0x2c77('0x63')],{'through':'chat_interaction_has_tags'});db[_0x2c77('0x87')][_0x2c77('0x121')](db[_0x2c77('0x128')],{'through':_0x2c77('0x16e')});db[_0x2c77('0x87')][_0x2c77('0x121')](db[_0x2c77('0x54')],{'through':_0x2c77('0x180')});db[_0x2c77('0x87')]['belongsToMany'](db[_0x2c77('0x11a')],{'through':_0x2c77('0x1b4')});db[_0x2c77('0x87')][_0x2c77('0x121')](db[_0x2c77('0x5c')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x2c77('0x121')](db[_0x2c77('0xfd')],{'through':_0x2c77('0x1b5')});db[_0x2c77('0x8b')][_0x2c77('0x11f')](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x2c77('0x1b6')});db[_0x2c77('0x8d')][_0x2c77('0x11f')](db[_0x2c77('0x6f')],{'as':_0x2c77('0x1b7'),'foreignKey':_0x2c77('0x19c')});db['CmContactHasItem']['belongsTo'](db['CmContact'],{'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x199')});db['Trigger']['hasMany'](db[_0x2c77('0x7f')],{'as':{'plural':_0x2c77('0x1b8'),'singular':_0x2c77('0x1b9')},'foreignKey':_0x2c77('0x1ba'),'onDelete':'cascade','hooks':!![]});db[_0x2c77('0x91')]['hasMany'](db[_0x2c77('0x7f')],{'as':{'plural':'AnyConditions','singular':_0x2c77('0x1bb')},'foreignKey':_0x2c77('0x1bc'),'onDelete':_0x2c77('0x10f'),'hooks':!![]});db['Trigger'][_0x2c77('0x113')](db[_0x2c77('0x1bd')],{'as':_0x2c77('0x1a7'),'foreignKey':_0x2c77('0x1be'),'onDelete':_0x2c77('0x10f'),'hooks':!![]});db[_0x2c77('0x1b0')][_0x2c77('0x113')](db['AnalyticFieldReport'],{'as':_0x2c77('0x1bf'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1b1'),'hooks':!![]});db[_0x2c77('0x9a')][_0x2c77('0x113')](db[_0x2c77('0x9f')],{'as':'Fields','onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c0')});db[_0x2c77('0x9d')][_0x2c77('0x113')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c1')});db[_0x2c77('0x9f')]['belongsTo'](db[_0x2c77('0x9d')],{'foreignKey':_0x2c77('0x1c1')});db[_0x2c77('0x1c2')][_0x2c77('0x113')](db['SalesforceConfiguration'],{'as':_0x2c77('0x1c3'),'onDelete':_0x2c77('0x10f'),'foreignKey':'AccountId'});db[_0x2c77('0xa3')]['hasMany'](db[_0x2c77('0x1c4')],{'as':_0x2c77('0x1c5'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0xa3')][_0x2c77('0x113')](db[_0x2c77('0x1c4')],{'as':_0x2c77('0x1c7'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xa3')]['hasMany'](db[_0x2c77('0x1c4')],{'as':_0x2c77('0x1bf'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xa3')][_0x2c77('0x11f')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x2c77('0x1ca')});db['SalesforceField'][_0x2c77('0x113')](db['SalesforceField'],{'as':_0x2c77('0x1cb'),'foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0x1c4')]['hasMany'](db[_0x2c77('0x1c4')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0x1c4')]['hasMany'](db[_0x2c77('0x1c4')],{'as':'Field','foreignKey':_0x2c77('0x1c9')});db['SalesforceField'][_0x2c77('0x11f')](db[_0x2c77('0x93')],{'as':'Variable','foreignKey':'VariableId'});db[_0x2c77('0x1cd')]['hasMany'](db[_0x2c77('0xa5')],{'as':'Configurations','onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0xa5')]['hasMany'](db[_0x2c77('0x1ce')],{'as':'Subjects','onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0xa5')][_0x2c77('0x113')](db[_0x2c77('0x1ce')],{'as':_0x2c77('0x1c7'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xa5')][_0x2c77('0x113')](db['SugarcrmField'],{'as':_0x2c77('0x1bf'),'onDelete':'cascade','foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xa5')][_0x2c77('0x11f')](db[_0x2c77('0x1cd')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0x1ce')][_0x2c77('0x113')](db[_0x2c77('0x1ce')],{'as':_0x2c77('0x1cb'),'foreignKey':'SubjectId'});db[_0x2c77('0x1ce')]['hasMany'](db['SugarcrmField'],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0x1ce')][_0x2c77('0x113')](db[_0x2c77('0x1ce')],{'as':_0x2c77('0x1cf'),'foreignKey':'FieldId'});db[_0x2c77('0x1ce')][_0x2c77('0x11f')](db['Variable'],{'as':_0x2c77('0x93'),'foreignKey':_0x2c77('0x1d0')});db[_0x2c77('0x1d1')][_0x2c77('0x113')](db[_0x2c77('0xa8')],{'as':_0x2c77('0x1c3'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1ca')});db['DeskConfiguration']['hasMany'](db[_0x2c77('0xa9')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2c77('0x1c6')});db['DeskConfiguration'][_0x2c77('0x113')](db[_0x2c77('0xa9')],{'as':_0x2c77('0x1c7'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xa8')][_0x2c77('0x113')](db[_0x2c77('0xa9')],{'as':_0x2c77('0x1bf'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x2c77('0xa8')]['belongsTo'](db[_0x2c77('0x1d1')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x1ca')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x2c77('0x1d2')});db[_0x2c77('0xa9')]['hasMany'](db[_0x2c77('0xa9')],{'as':_0x2c77('0x1cb'),'foreignKey':'SubjectId'});db[_0x2c77('0xa9')]['hasMany'](db[_0x2c77('0xa9')],{'as':_0x2c77('0x1cc'),'foreignKey':'DescriptionId'});db[_0x2c77('0xa9')]['hasMany'](db['DeskField'],{'as':'Field','foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xa9')][_0x2c77('0x11f')](db[_0x2c77('0x93')],{'as':_0x2c77('0x93'),'foreignKey':'VariableId'});db[_0x2c77('0xab')][_0x2c77('0x113')](db[_0x2c77('0xac')],{'as':_0x2c77('0x1c3'),'onDelete':'cascade','foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0xac')][_0x2c77('0x113')](db[_0x2c77('0xae')],{'as':_0x2c77('0x1c5'),'onDelete':_0x2c77('0x10f'),'foreignKey':'SubjectId'});db[_0x2c77('0xac')][_0x2c77('0x113')](db[_0x2c77('0xae')],{'as':_0x2c77('0x1c7'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c8')});db['ZohoConfiguration']['hasMany'](db[_0x2c77('0xae')],{'as':_0x2c77('0x1bf'),'onDelete':'cascade','foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xac')]['belongsTo'](db[_0x2c77('0xab')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x1ca')});db['ZohoField'][_0x2c77('0x113')](db[_0x2c77('0xae')],{'as':_0x2c77('0x1cb'),'foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0xae')][_0x2c77('0x113')](db[_0x2c77('0xae')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db['ZohoField']['hasMany'](db[_0x2c77('0xae')],{'as':_0x2c77('0x1cf'),'foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xae')][_0x2c77('0x11f')](db['Variable'],{'as':_0x2c77('0x93'),'foreignKey':_0x2c77('0x1d0')});db[_0x2c77('0xb0')][_0x2c77('0x113')](db[_0x2c77('0xb2')],{'as':_0x2c77('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2c77('0xb2')][_0x2c77('0x113')](db[_0x2c77('0x1d3')],{'as':_0x2c77('0x1c5'),'foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0xb2')][_0x2c77('0x113')](db[_0x2c77('0x1d3')],{'as':_0x2c77('0x1c7'),'foreignKey':_0x2c77('0x1c8')});db['ZendeskConfiguration'][_0x2c77('0x113')](db[_0x2c77('0x1d3')],{'as':_0x2c77('0x1bf'),'foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xb2')][_0x2c77('0x11f')](db[_0x2c77('0xb0')],{'as':_0x2c77('0x16d'),'foreignKey':'AccountId'});db[_0x2c77('0xb2')][_0x2c77('0x121')](db[_0x2c77('0x87')],{'through':_0x2c77('0x1d4')});db[_0x2c77('0x1d3')][_0x2c77('0x113')](db[_0x2c77('0x1d3')],{'as':_0x2c77('0x1cb'),'foreignKey':_0x2c77('0x1c6')});db['ZendeskField'][_0x2c77('0x113')](db[_0x2c77('0x1d3')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0x1d3')]['hasMany'](db[_0x2c77('0x1d3')],{'as':_0x2c77('0x1cf'),'foreignKey':_0x2c77('0x1c9')});db['ZendeskField'][_0x2c77('0x11f')](db[_0x2c77('0x93')],{'as':_0x2c77('0x93'),'foreignKey':'VariableId'});db[_0x2c77('0xb5')][_0x2c77('0x113')](db[_0x2c77('0xb7')],{'as':_0x2c77('0x1c3'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1ca')});db['FreshdeskConfiguration'][_0x2c77('0x113')](db[_0x2c77('0x1d5')],{'as':_0x2c77('0x1c5'),'onDelete':_0x2c77('0x10f'),'foreignKey':'SubjectId'});db[_0x2c77('0xb7')][_0x2c77('0x113')](db['FreshdeskField'],{'as':_0x2c77('0x1c7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x2c77('0xb7')]['hasMany'](db[_0x2c77('0x1d5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xb7')]['belongsTo'](db[_0x2c77('0xb5')],{'as':_0x2c77('0x16d'),'foreignKey':'AccountId'});db[_0x2c77('0xb7')]['belongsToMany'](db['Tag'],{'through':_0x2c77('0x1d6')});db[_0x2c77('0x1d5')][_0x2c77('0x113')](db[_0x2c77('0x1d5')],{'as':'Subject','foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0x1d5')][_0x2c77('0x113')](db[_0x2c77('0x1d5')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0x1d5')][_0x2c77('0x113')](db[_0x2c77('0x1d5')],{'as':_0x2c77('0x1cf'),'foreignKey':'FieldId'});db[_0x2c77('0x1d5')][_0x2c77('0x11f')](db['Variable'],{'as':_0x2c77('0x93'),'foreignKey':_0x2c77('0x1d0')});db[_0x2c77('0x1d7')]['hasMany'](db[_0x2c77('0x1d8')],{'as':_0x2c77('0x1c3'),'onDelete':'cascade','foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0x1d8')][_0x2c77('0x113')](db[_0x2c77('0xbb')],{'as':_0x2c77('0x1c5'),'foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0x1d8')][_0x2c77('0x113')](db[_0x2c77('0xbb')],{'as':_0x2c77('0x1c7'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0x1d8')][_0x2c77('0x113')](db[_0x2c77('0xbb')],{'as':'Fields','foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0x1d8')][_0x2c77('0x11f')](db['VtigerAccount'],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x1ca')});db['VtigerField'][_0x2c77('0x113')](db[_0x2c77('0xbb')],{'as':_0x2c77('0x1cb'),'foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0xbb')][_0x2c77('0x113')](db[_0x2c77('0xbb')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xbb')][_0x2c77('0x113')](db['VtigerField'],{'as':_0x2c77('0x1cf'),'foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xbb')]['belongsTo'](db['Variable'],{'as':_0x2c77('0x93'),'foreignKey':_0x2c77('0x1d0')});db[_0x2c77('0xbd')][_0x2c77('0x113')](db[_0x2c77('0xbf')],{'as':_0x2c77('0x1c3'),'onDelete':'cascade','foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0xbf')][_0x2c77('0x113')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x2c77('0x1c6')});db['ServicenowConfiguration'][_0x2c77('0x113')](db['ServicenowField'],{'as':_0x2c77('0x1c7'),'foreignKey':'DescriptionId'});db[_0x2c77('0xbf')][_0x2c77('0x113')](db['ServicenowField'],{'as':_0x2c77('0x1bf'),'foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xbf')][_0x2c77('0x11f')](db[_0x2c77('0xbd')],{'as':'Account','foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0xc1')][_0x2c77('0x113')](db[_0x2c77('0xc1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2c77('0xc1')][_0x2c77('0x113')](db[_0x2c77('0xc1')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xc1')][_0x2c77('0x113')](db[_0x2c77('0xc1')],{'as':'Field','foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xc1')][_0x2c77('0x11f')](db[_0x2c77('0x93')],{'as':_0x2c77('0x93'),'foreignKey':_0x2c77('0x1d0')});db[_0x2c77('0x1d9')]['hasMany'](db[_0x2c77('0x1da')],{'as':_0x2c77('0x1c3'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0x1d9')]['belongsTo'](db[_0x2c77('0x103')],{'as':_0x2c77('0x103'),'foreignKey':'CloudProviderId'});db[_0x2c77('0x1da')]['hasMany'](db[_0x2c77('0xc4')],{'as':_0x2c77('0x1c5'),'onDelete':'cascade','foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0x1da')]['hasMany'](db[_0x2c77('0xc4')],{'as':_0x2c77('0x1c7'),'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0x1da')]['hasMany'](db[_0x2c77('0xc4')],{'as':_0x2c77('0x1bf'),'onDelete':_0x2c77('0x10f'),'foreignKey':'FieldId'});db[_0x2c77('0x1da')][_0x2c77('0x11f')](db[_0x2c77('0x1d9')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0xc4')][_0x2c77('0x113')](db[_0x2c77('0xc4')],{'as':'Subject','foreignKey':_0x2c77('0x1c6')});db['Dynamics365Field'][_0x2c77('0x113')](db[_0x2c77('0xc4')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xc4')][_0x2c77('0x113')](db[_0x2c77('0xc4')],{'as':_0x2c77('0x1cf'),'foreignKey':'FieldId'});db[_0x2c77('0xc4')][_0x2c77('0x11f')](db[_0x2c77('0x93')],{'as':_0x2c77('0x93'),'foreignKey':_0x2c77('0x1d0')});db[_0x2c77('0xc6')]['hasMany'](db[_0x2c77('0xc8')],{'as':_0x2c77('0x1c3'),'onDelete':'cascade','foreignKey':_0x2c77('0x1ca')});db[_0x2c77('0xc8')]['hasMany'](db[_0x2c77('0xca')],{'as':_0x2c77('0x1c5'),'foreignKey':_0x2c77('0x1c6')});db['FreshsalesConfiguration'][_0x2c77('0x113')](db[_0x2c77('0xca')],{'as':'Descriptions','foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xc8')][_0x2c77('0x113')](db['FreshsalesField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x2c77('0xc8')]['belongsTo'](db[_0x2c77('0xc6')],{'as':_0x2c77('0x16d'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x2c77('0x113')](db[_0x2c77('0xca')],{'as':'Subject','foreignKey':_0x2c77('0x1c6')});db[_0x2c77('0xca')][_0x2c77('0x113')](db[_0x2c77('0xca')],{'as':_0x2c77('0x1cc'),'foreignKey':_0x2c77('0x1c8')});db[_0x2c77('0xca')][_0x2c77('0x113')](db['FreshsalesField'],{'as':_0x2c77('0x1cf'),'foreignKey':_0x2c77('0x1c9')});db[_0x2c77('0xca')][_0x2c77('0x11f')](db[_0x2c77('0x93')],{'as':_0x2c77('0x93'),'foreignKey':_0x2c77('0x1d0')});db['ChatQueueReport'][_0x2c77('0x11f')](db['ChatWebsite'],{});db[_0x2c77('0x1db')][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':'List','foreignKey':_0x2c77('0x168')});db[_0x2c77('0x1db')]['belongsTo'](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x160')});db['ChatQueueReport'][_0x2c77('0x11f')](db[_0x2c77('0x63')],{});db[_0x2c77('0x1db')]['belongsTo'](db[_0x2c77('0x65')],{});db[_0x2c77('0x1db')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{});db[_0x2c77('0x1db')][_0x2c77('0x11f')](db[_0x2c77('0x67')],{});db[_0x2c77('0xcf')]['belongsTo'](db[_0x2c77('0x10c')],{'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1dc')});db['ChatInternalMessage'][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'onDelete':_0x2c77('0x10f'),'foreignKey':_0x2c77('0x1dd')});db['JscriptySessionReport'][_0x2c77('0x113')](db[_0x2c77('0xd2')],{'foreignKey':_0x2c77('0x1de'),'onDelete':'cascade'});db[_0x2c77('0xd4')][_0x2c77('0x113')](db[_0x2c77('0xd1')],{'foreignKey':'SessionId','onDelete':_0x2c77('0x10f')});db[_0x2c77('0xd6')][_0x2c77('0x11f')](db['SmsAccount'],{});db[_0x2c77('0xd6')]['belongsTo'](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0xd6')][_0x2c77('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0x2c77('0x160')});db[_0x2c77('0xd6')][_0x2c77('0x11f')](db[_0x2c77('0x54')],{});db[_0x2c77('0xd6')][_0x2c77('0x11f')](db['SmsMessage'],{});db[_0x2c77('0xd6')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{});db['SmsQueueReport'][_0x2c77('0x11f')](db[_0x2c77('0x57')],{});db[_0x2c77('0xdb')][_0x2c77('0x113')](db[_0x2c77('0xd4')],{'foreignKey':'ProjectId'});db[_0x2c77('0xdb')]['hasMany'](db[_0x2c77('0xd2')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x2c77('0xd1')],{'foreignKey':_0x2c77('0x1df')});db[_0x2c77('0xdf')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':'Users','through':_0x2c77('0x145')});db[_0x2c77('0xe2')][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':'Agents','through':_0x2c77('0x1e0')});db['Team'][_0x2c77('0x121')](db['VoiceQueue'],{'through':_0x2c77('0x1e1'),'as':'VoiceQueues'});db[_0x2c77('0xe2')][_0x2c77('0x121')](db[_0x2c77('0x131')],{'through':_0x2c77('0x16b'),'as':'MailQueues'});db[_0x2c77('0xe2')][_0x2c77('0x121')](db[_0x2c77('0x67')],{'through':_0x2c77('0x194'),'as':_0x2c77('0x132')});db[_0x2c77('0xe2')]['belongsToMany'](db[_0x2c77('0x4e')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x2c77('0xe2')]['belongsToMany'](db[_0x2c77('0x57')],{'through':'team_has_sms_queues','as':_0x2c77('0x134')});db[_0x2c77('0xe2')][_0x2c77('0x121')](db[_0x2c77('0x60')],{'through':'team_has_openchannel_queues','as':_0x2c77('0x136')});db[_0x2c77('0xe2')]['belongsToMany'](db[_0x2c77('0x1e2')],{'through':'team_has_whatsapp_queues','as':_0x2c77('0x137')});db[_0x2c77('0xe2')][_0x2c77('0x121')](db[_0x2c77('0x1e3')],{'through':'TeamVoicePrefix','as':_0x2c77('0x130')});db[_0x2c77('0x19f')][_0x2c77('0x113')](db[_0x2c77('0x6f')],{'as':_0x2c77('0x14c'),'foreignKey':_0x2c77('0x1a0')});db[_0x2c77('0x19f')][_0x2c77('0x113')](db[_0x2c77('0x72')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x2c77('0x19f')][_0x2c77('0x113')](db[_0x2c77('0x74')],{'as':_0x2c77('0x14e'),'foreignKey':_0x2c77('0x1a0')});db[_0x2c77('0x19f')][_0x2c77('0x113')](db[_0x2c77('0x71')],{'as':'HopperBlacks','foreignKey':_0x2c77('0x1a0')});db[_0x2c77('0x19f')][_0x2c77('0x11f')](db['Trunk'],{'as':'Trunk','foreignKey':_0x2c77('0x1e4')});db['Campaign'][_0x2c77('0x11f')](db[_0x2c77('0x151')],{'as':_0x2c77('0x152'),'foreignKey':_0x2c77('0x1e5')});db[_0x2c77('0x19f')][_0x2c77('0x11f')](db['Interval'],{'as':'Interval','foreignKey':_0x2c77('0x153')});db['Campaign'][_0x2c77('0x11f')](db[_0x2c77('0xdf')],{'as':_0x2c77('0xdf'),'foreignKey':'SquareProjectId'});db[_0x2c77('0x19f')]['belongsToMany'](db[_0x2c77('0xf3')],{'as':_0x2c77('0x126'),'through':_0x2c77('0x1e6')});db['Campaign']['belongsToMany'](db[_0x2c77('0xf3')],{'as':_0x2c77('0x158'),'through':_0x2c77('0x1e7')});db['Attachment'][_0x2c77('0x11f')](db[_0x2c77('0x66')],{'as':_0x2c77('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x2c77('0xeb')][_0x2c77('0x11f')](db[_0x2c77('0x41')],{});db[_0x2c77('0xeb')]['belongsTo'](db[_0x2c77('0x128')],{});db[_0x2c77('0xeb')][_0x2c77('0x11f')](db[_0x2c77('0x3c')],{'foreignKey':_0x2c77('0x1e8'),'as':_0x2c77('0x1e9')});db['MailTransferReport'][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ea'),'as':_0x2c77('0x1eb')});db[_0x2c77('0xeb')]['belongsTo'](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ec'),'as':_0x2c77('0x1ed')});db['MailTransferReport'][_0x2c77('0x11f')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x2c77('0x1ee')});db[_0x2c77('0xeb')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x2c77('0x1ef'),'as':_0x2c77('0x1f0')});db[_0x2c77('0xed')][_0x2c77('0x11f')](db[_0x2c77('0x65')],{});db[_0x2c77('0xed')][_0x2c77('0x11f')](db[_0x2c77('0x63')],{});db[_0x2c77('0xed')][_0x2c77('0x11f')](db[_0x2c77('0x61')],{'foreignKey':_0x2c77('0x1f1'),'as':'FromAccount'});db[_0x2c77('0xed')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ea'),'as':'FromAgent'});db[_0x2c77('0xed')]['belongsTo'](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ec'),'as':'ToAgent'});db[_0x2c77('0xed')][_0x2c77('0x11f')](db['ChatQueue'],{'foreignKey':_0x2c77('0x1f2'),'as':'ToQueue'});db[_0x2c77('0xed')][_0x2c77('0x11f')](db['ChatWebsite'],{'foreignKey':_0x2c77('0x1f3'),'as':_0x2c77('0x1f0')});db[_0x2c77('0xef')]['belongsTo'](db[_0x2c77('0x177')],{});db[_0x2c77('0xef')][_0x2c77('0x11f')](db[_0x2c77('0x11a')],{});db['FaxTransferReport'][_0x2c77('0x11f')](db[_0x2c77('0x13a')],{'foreignKey':'FromFaxAccountId','as':_0x2c77('0x1e9')});db[_0x2c77('0xef')][_0x2c77('0x11f')](db['User'],{'foreignKey':_0x2c77('0x1ea'),'as':_0x2c77('0x1eb')});db[_0x2c77('0xef')]['belongsTo'](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ec'),'as':_0x2c77('0x1ed')});db['FaxTransferReport'][_0x2c77('0x11f')](db['FaxQueue'],{'foreignKey':_0x2c77('0x1f4'),'as':'ToQueue'});db[_0x2c77('0xef')]['belongsTo'](db[_0x2c77('0x13a')],{'foreignKey':_0x2c77('0x1f5'),'as':_0x2c77('0x1f0')});db[_0x2c77('0x1f6')][_0x2c77('0x11f')](db[_0x2c77('0x5e')],{});db[_0x2c77('0x1f6')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x2c77('0x1f6')][_0x2c77('0x11f')](db['OpenchannelAccount'],{'foreignKey':_0x2c77('0x1f7'),'as':_0x2c77('0x1e9')});db[_0x2c77('0x1f6')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ea'),'as':'FromAgent'});db[_0x2c77('0x1f6')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ec'),'as':_0x2c77('0x1ed')});db[_0x2c77('0x1f6')][_0x2c77('0x11f')](db['OpenchannelQueue'],{'foreignKey':_0x2c77('0x1f8'),'as':_0x2c77('0x1ee')});db[_0x2c77('0x1f6')][_0x2c77('0x11f')](db[_0x2c77('0x59')],{'foreignKey':_0x2c77('0x1f9'),'as':_0x2c77('0x1f0')});db[_0x2c77('0xf1')]['belongsTo'](db[_0x2c77('0x56')],{});db[_0x2c77('0xf1')][_0x2c77('0x11f')](db[_0x2c77('0x54')],{});db[_0x2c77('0xf1')]['belongsTo'](db[_0x2c77('0x50')],{'foreignKey':_0x2c77('0x1fa'),'as':_0x2c77('0x1e9')});db[_0x2c77('0xf1')]['belongsTo'](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ea'),'as':_0x2c77('0x1eb')});db[_0x2c77('0xf1')]['belongsTo'](db[_0x2c77('0x10c')],{'foreignKey':'ToUserId','as':_0x2c77('0x1ed')});db[_0x2c77('0xf1')][_0x2c77('0x11f')](db[_0x2c77('0x57')],{'foreignKey':_0x2c77('0x1fb'),'as':_0x2c77('0x1ee')});db[_0x2c77('0xf1')]['belongsTo'](db[_0x2c77('0x50')],{'foreignKey':'ToSmsAccountId','as':_0x2c77('0x1f0')});db[_0x2c77('0xf3')]['hasMany'](db[_0x2c77('0x7d')],{'as':_0x2c77('0x164'),'foreignKey':_0x2c77('0x168'),'onDelete':_0x2c77('0x10f')});db['CmList'][_0x2c77('0x113')](db[_0x2c77('0x78')],{'as':_0x2c77('0x1fc'),'foreignKey':'ListId'});db[_0x2c77('0xf3')]['hasMany'](db[_0x2c77('0x6d')],{'as':_0x2c77('0x124'),'onDelete':_0x2c77('0x10f'),'foreignKey':'ListId'});db[_0x2c77('0xf3')][_0x2c77('0x113')](db[_0x2c77('0x72')],{'as':_0x2c77('0x115'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0xf3')][_0x2c77('0x113')](db[_0x2c77('0x74')],{'as':_0x2c77('0x116'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0xf3')][_0x2c77('0x113')](db[_0x2c77('0x76')],{'as':_0x2c77('0x76'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0xf3')][_0x2c77('0x121')](db[_0x2c77('0x1a')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x2c77('0xf3')][_0x2c77('0x121')](db['User'],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x127')});db[_0x2c77('0x1e3')][_0x2c77('0x113')](db[_0x2c77('0x18')],{'as':_0x2c77('0x114'),'onDelete':_0x2c77('0x10f')});db['VoicePrefix'][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x108')});db[_0x2c77('0x1e3')][_0x2c77('0x121')](db[_0x2c77('0xe2')],{'through':_0x2c77('0x106'),'as':'Teams'});db['UserProfile'][_0x2c77('0x113')](db[_0x2c77('0x10c')],{'as':'Users','foreignKey':_0x2c77('0x1fd')});db[_0x2c77('0x120')][_0x2c77('0x113')](db[_0x2c77('0xf6')],{'as':_0x2c77('0x1fe'),'foreignKey':_0x2c77('0x1fd'),'onDelete':_0x2c77('0x10f')});db[_0x2c77('0xf6')][_0x2c77('0x113')](db[_0x2c77('0xf8')],{'as':_0x2c77('0x1ff'),'foreignKey':_0x2c77('0x200'),'onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x2c77('0x10f')});db[_0x2c77('0xfb')][_0x2c77('0x113')](db[_0x2c77('0x7b')],{'as':'Answers','foreignKey':_0x2c77('0x201')});db[_0x2c77('0xfb')][_0x2c77('0x113')](db[_0x2c77('0xff')],{'as':'Messages','foreignKey':_0x2c77('0x201')});db[_0x2c77('0xfb')][_0x2c77('0x113')](db[_0x2c77('0xfd')],{'as':'Interactions'});db[_0x2c77('0xfb')][_0x2c77('0x113')](db[_0x2c77('0x202')],{'as':_0x2c77('0x148')});db[_0x2c77('0xfb')][_0x2c77('0x11f')](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168')});db[_0x2c77('0xfb')][_0x2c77('0x11f')](db[_0x2c77('0x154')],{'as':_0x2c77('0x178'),'foreignKey':_0x2c77('0x155')});db['WhatsappAccount'][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x16a'),'through':_0x2c77('0x143')});db[_0x2c77('0x202')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x202')]['belongsTo'](db[_0x2c77('0x1e2')],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x202')]['belongsTo'](db[_0x2c77('0xfb')],{'onDelete':_0x2c77('0x162')});db[_0x2c77('0x202')][_0x2c77('0x11f')](db[_0x2c77('0x81')],{'onDelete':'restrict','foreignKey':_0x2c77('0x153')});db['WhatsappApplication']['belongsTo'](db[_0x2c77('0x87')],{'onDelete':'restrict','foreignKey':_0x2c77('0x174')});db[_0x2c77('0xfd')][_0x2c77('0x113')](db['WhatsappMessage'],{'as':_0x2c77('0x15a'),'onDelete':'cascade','foreignKey':_0x2c77('0x203')});db[_0x2c77('0xfd')][_0x2c77('0x11f')](db[_0x2c77('0xfb')],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x201')});db[_0x2c77('0xfd')][_0x2c77('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction'][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x17a'),'foreignKey':_0x2c77('0x10e')});db['WhatsappInteraction'][_0x2c77('0x121')](db[_0x2c77('0x87')],{'through':_0x2c77('0x1b5'),'as':_0x2c77('0x16f')});db[_0x2c77('0xfd')]['belongsToMany'](db[_0x2c77('0x87')],{'through':_0x2c77('0x1b5'),'as':_0x2c77('0x170')});db['WhatsappInteraction'][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x17b'),'through':'user_has_whatsapp_interactions','foreignKey':_0x2c77('0x203')});db[_0x2c77('0xff')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x10c')});db[_0x2c77('0xff')]['belongsTo'](db[_0x2c77('0x6d')],{'onDelete':'cascade','as':_0x2c77('0x15f')});db['WhatsappMessage'][_0x2c77('0x11f')](db[_0x2c77('0xfd')],{'onDelete':'cascade','as':_0x2c77('0x171'),'foreignKey':_0x2c77('0x203')});db[_0x2c77('0xff')][_0x2c77('0x11f')](db['WhatsappAccount'],{'as':_0x2c77('0x16d'),'foreignKey':_0x2c77('0x201')});db[_0x2c77('0x204')]['belongsTo'](db[_0x2c77('0xfb')],{});db[_0x2c77('0x204')]['belongsTo'](db[_0x2c77('0xf3')],{'as':_0x2c77('0x167'),'foreignKey':_0x2c77('0x168')});db['WhatsappQueueReport'][_0x2c77('0x11f')](db[_0x2c77('0x6d')],{'as':_0x2c77('0x15f'),'foreignKey':_0x2c77('0x160')});db[_0x2c77('0x204')][_0x2c77('0x11f')](db[_0x2c77('0xfd')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x2c77('0x1e2')],{});db[_0x2c77('0x204')]['belongsTo'](db[_0x2c77('0xff')],{});db[_0x2c77('0x204')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{});db[_0x2c77('0x205')]['belongsTo'](db[_0x2c77('0xff')],{});db[_0x2c77('0x205')][_0x2c77('0x11f')](db[_0x2c77('0xfd')],{});db[_0x2c77('0x205')][_0x2c77('0x11f')](db[_0x2c77('0xfb')],{'foreignKey':_0x2c77('0x206'),'as':'FromAccount'});db[_0x2c77('0x205')][_0x2c77('0x11f')](db['WhatsappAccount'],{'foreignKey':_0x2c77('0x207'),'as':_0x2c77('0x1f0')});db[_0x2c77('0x205')][_0x2c77('0x11f')](db[_0x2c77('0x1e2')],{'foreignKey':_0x2c77('0x208'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x2c77('0x1ea'),'as':'FromAgent'});db[_0x2c77('0x205')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'foreignKey':_0x2c77('0x1ec'),'as':_0x2c77('0x1ed')});db['WhatsappQueue'][_0x2c77('0x121')](db[_0x2c77('0x10c')],{'as':'Agents','through':_0x2c77('0x37'),'foreignKey':_0x2c77('0x209')});db[_0x2c77('0x1e2')][_0x2c77('0x121')](db[_0x2c77('0xe2')],{'through':_0x2c77('0x20a'),'as':'Teams'});db[_0x2c77('0x10a')][_0x2c77('0x11f')](db[_0x2c77('0x10c')],{'as':_0x2c77('0x20b'),'foreignKey':_0x2c77('0x10e'),'onDelete':'cascade','hooks':!![]});db[_0x2c77('0x103')][_0x2c77('0x10d')](db[_0x2c77('0x1d9')],{'as':_0x2c77('0x1d9'),'onDelete':_0x2c77('0x162')});db[_0x2c77('0x103')][_0x2c77('0x10d')](db[_0x2c77('0x39')],{'as':_0x2c77('0x20c'),'onDelete':_0x2c77('0x162')});db[_0x2c77('0x103')][_0x2c77('0x10d')](db[_0x2c77('0x3a')],{'as':_0x2c77('0x163'),'onDelete':_0x2c77('0x162')});module[_0x2c77('0x20d')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0bb7=['../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','UserId','cascade','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotification','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','CmContact','Contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','Trunk','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','VoiceMailMessage','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','MailServerOut','Smtp','Dispositions','Answers','Messages','Interactions','List','ListId','TemplateId','Agents','user_has_mail_accounts','team_has_mail_queues','Teams','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessage','IntervalId','Tag','TagId','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccount','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CompanyId','FaxInteractions','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','Campaign','CampaignId','All','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','DefaultReportId','MetricId','SalesforceAccount','AccountId','Subjects','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmAccount','Configurations','Descriptions','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','VtigerAccount','ServicenowAccount','ServicenowConfiguration','ServicenowField','Dynamics365Field','FromId','ToId','JscriptySessionReport','SessionId','ProjectId','team_has_whatsapp_queues','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ChatTransferReport','ToChatQueueId','ToQueue','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','CannedAnswer','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','options','database','User','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueueReport/faxQueueReport.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation'];(function(_0x8cc0e0,_0x40d971){var _0x54c7d5=function(_0x3a8287){while(--_0x3a8287){_0x8cc0e0['push'](_0x8cc0e0['shift']());}};_0x54c7d5(++_0x40d971);}(_0x0bb7,0x192));var _0x70bb=function(_0x52a419,_0x450b5e){_0x52a419=_0x52a419-0x0;var _0x370bae=_0x0bb7[_0x52a419];return _0x370bae;};'use strict';var config=require(_0x70bb('0x0'));var Sequelize=require('sequelize');var _=require(_0x70bb('0x1'));var jstz=require(_0x70bb('0x2'));var timezone=jstz[_0x70bb('0x3')]();config[_0x70bb('0x4')]=_[_0x70bb('0x5')](config['sequelize'],{'database':_0x70bb('0x6'),'username':_0x70bb('0x7'),'password':_0x70bb('0x8'),'options':{'host':_0x70bb('0x9'),'port':0xcea,'dialect':_0x70bb('0xa'),'dialectOptions':{'charset':_0x70bb('0xb')},'logging':![],'timezone':timezone[_0x70bb('0xc')](),'define':{'charset':_0x70bb('0xd'),'collate':_0x70bb('0xe')}}});config[_0x70bb('0xf')]=_[_0x70bb('0x5')](config[_0x70bb('0xf')],{'database':'motion2','username':_0x70bb('0x7'),'password':_0x70bb('0x8'),'options':{'host':_0x70bb('0x9'),'port':0xcea,'dialect':_0x70bb('0xa'),'dialectOptions':{'charset':_0x70bb('0xb')},'logging':![],'timezone':timezone[_0x70bb('0xc')](),'define':{'charset':_0x70bb('0xd'),'collate':_0x70bb('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x70bb('0x4')][_0x70bb('0x10')],config['sequelize'][_0x70bb('0x11')],config['sequelize'][_0x70bb('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x70bb('0xf')][_0x70bb('0x13')],config[_0x70bb('0xf')]['username'],config['sequelizeHistory']['password'],config['sequelizeHistory'][_0x70bb('0x12')])};db[_0x70bb('0x14')]=db[_0x70bb('0x4')]['import']('../api/user/user.model');db[_0x70bb('0x15')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x70bb('0x17')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x18'));db[_0x70bb('0x19')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x1a'));db['VoiceMusicOnHold']=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x1b'));db[_0x70bb('0x1c')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x1d'));db[_0x70bb('0x1e')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x1f'));db[_0x70bb('0x20')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x21'));db['VoiceCallReport']=db[_0x70bb('0x4')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x70bb('0x22')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/voiceDialReport/voiceDialReport.model');db[_0x70bb('0x23')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x24'));db['VoiceQueueReport']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x25'));db[_0x70bb('0x26')]=db['sequelize']['import'](_0x70bb('0x27'));db['Trunk']=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x28'));db['VoiceTransferReport']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x29'));db[_0x70bb('0x2a')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x2b'));db[_0x70bb('0x2c')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x2d'));db[_0x70bb('0x2e')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x2f'));db[_0x70bb('0x30')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x31'));db['UserFaxQueue']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x32'));db[_0x70bb('0x33')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/userSmsQueue/userSmsQueue.model');db[_0x70bb('0x34')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x70bb('0x35')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x36'));db[_0x70bb('0x37')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x38'));db['MailServerOut']=db[_0x70bb('0x4')]['import'](_0x70bb('0x39'));db[_0x70bb('0x3a')]=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db[_0x70bb('0x3b')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x3c'));db['MailSubstatus']=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/mailSubstatus/mailSubstatus.model');db[_0x70bb('0x3d')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x3e'));db[_0x70bb('0x3f')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x40'));db[_0x70bb('0x41')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x42'));db[_0x70bb('0x43')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x44'));db[_0x70bb('0x45')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/dashboard/dashboard.model');db[_0x70bb('0x46')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x47'));db[_0x70bb('0x48')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x49'));db[_0x70bb('0x4a')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x4b'));db[_0x70bb('0x4c')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x4d'));db[_0x70bb('0x4e')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x4f'));db['FaxQueue']=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x50'));db['SmsAccount']=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize']['import']('../api/smsApplication/smsApplication.model');db[_0x70bb('0x51')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x52'));db[_0x70bb('0x53')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x54'));db[_0x70bb('0x55')]=db['sequelize']['import'](_0x70bb('0x56'));db[_0x70bb('0x57')]=db['sequelize']['import'](_0x70bb('0x58'));db['OpenchannelApplication']=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/openchannelApplication/openchannelApplication.model');db[_0x70bb('0x59')]=db[_0x70bb('0x4')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x70bb('0x5a')]=db['sequelize']['import'](_0x70bb('0x5b'));db[_0x70bb('0x5c')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x5d'));db[_0x70bb('0x5e')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x5f'));db[_0x70bb('0x60')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x61'));db[_0x70bb('0x62')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x63'));db[_0x70bb('0x64')]=db['sequelize'][_0x70bb('0x16')]('../api/chatInteraction/chatInteraction.model');db[_0x70bb('0x65')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x66'));db['ChatOfflineMessage']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x67'));db[_0x70bb('0x68')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x69'));db[_0x70bb('0x6a')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x6b'));db[_0x70bb('0x6c')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x6d'));db[_0x70bb('0x6e')]=db[_0x70bb('0x4')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x6f'));db[_0x70bb('0x70')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x71'));db['CmHopperBlack']=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x72'));db[_0x70bb('0x73')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x70bb('0x74')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x75'));db[_0x70bb('0x76')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x77'));db[_0x70bb('0x78')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/cmCustomField/cmCustomField.model');db[_0x70bb('0x79')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/action/action.model');db[_0x70bb('0x7a')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x7b'));db['CannedAnswer']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x7c'));db[_0x70bb('0x7d')]=db['sequelize']['import'](_0x70bb('0x7e'));db[_0x70bb('0x7f')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x80'));db[_0x70bb('0x81')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x82'));db[_0x70bb('0x83')]=db['sequelize']['import'](_0x70bb('0x84'));db[_0x70bb('0x85')]=db[_0x70bb('0x4')]['import'](_0x70bb('0x86'));db[_0x70bb('0x87')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x88'));db[_0x70bb('0x89')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x8a'));db['Sound']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x8b'));db['Tag']=db[_0x70bb('0x4')]['import'](_0x70bb('0x8c'));db[_0x70bb('0x8d')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x8e'));db[_0x70bb('0x8f')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x90'));db[_0x70bb('0x91')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x92'));db[_0x70bb('0x93')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x94'));db['Trigger']=db['sequelize'][_0x70bb('0x16')]('../api/trigger/trigger.model');db[_0x70bb('0x95')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x96'));db[_0x70bb('0x97')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x98'));db[_0x70bb('0x99')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x9a'));db[_0x70bb('0x9b')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x9c'));db[_0x70bb('0x9d')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x9e'));db[_0x70bb('0x9f')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xa0'));db[_0x70bb('0xa1')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xa2'));db[_0x70bb('0xa3')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xa4'));db['SalesforceAccount']=db['sequelize']['import'](_0x70bb('0xa5'));db[_0x70bb('0xa6')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xa7'));db[_0x70bb('0xa8')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xa9'));db['SugarcrmAccount']=db['sequelize'][_0x70bb('0x16')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x70bb('0xaa')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xab'));db[_0x70bb('0xac')]=db['sequelize']['import'](_0x70bb('0xad'));db[_0x70bb('0xae')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xaf'));db[_0x70bb('0xb0')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xb1'));db[_0x70bb('0xb2')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xb3'));db['ZohoAccount']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xb4'));db['ZohoConfiguration']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xb5'));db[_0x70bb('0xb6')]=db['sequelize']['import'](_0x70bb('0xb7'));db['ZendeskAccount']=db[_0x70bb('0x4')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x70bb('0xb8')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xb9'));db[_0x70bb('0xba')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xbb'));db[_0x70bb('0xbc')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xbd'));db[_0x70bb('0xbe')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xbf'));db[_0x70bb('0xc0')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xc1'));db['VtigerConfiguration']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xc2'));db['VtigerField']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xc3'));db['ServicenowAccount']=db['sequelize'][_0x70bb('0x16')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x70bb('0x4')]['import'](_0x70bb('0xc4'));db['ServicenowField']=db['sequelize']['import'](_0x70bb('0xc5'));db[_0x70bb('0xc6')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xc7'));db[_0x70bb('0xc8')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xc9'));db['Dynamics365Field']=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xca'));db[_0x70bb('0xcb')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xcc'));db[_0x70bb('0xcd')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xce'));db[_0x70bb('0xcf')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xd0'));db['Integration']=db['sequelize']['import'](_0x70bb('0x98'));db['Network']=db['sequelize']['import'](_0x70bb('0xd1'));db[_0x70bb('0xd2')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xd3'));db[_0x70bb('0xd4')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xd5'));db[_0x70bb('0xd6')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xd7'));db[_0x70bb('0xd8')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xd9'));db['JscriptySessionReport']=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xda'));db[_0x70bb('0xdb')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xdc'));db['SquareReport']=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xdd'));db[_0x70bb('0xde')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xdf'));db[_0x70bb('0xe0')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xe1'));db[_0x70bb('0xe2')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xe3'));db[_0x70bb('0xe4')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xe5'));db[_0x70bb('0xe6')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xe7'));db[_0x70bb('0xe8')]=db[_0x70bb('0x4')]['import'](_0x70bb('0xe9'));db[_0x70bb('0xea')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xeb'));db[_0x70bb('0xec')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/team/team.model');db['License']=db[_0x70bb('0x4')]['import'](_0x70bb('0xed'));db['Campaign']=db[_0x70bb('0x4')]['import'](_0x70bb('0xee'));db[_0x70bb('0xef')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xf0'));db[_0x70bb('0xf1')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xf2'));db[_0x70bb('0xf3')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xf4'));db[_0x70bb('0xf5')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xf6'));db[_0x70bb('0xf7')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xf8'));db[_0x70bb('0xf9')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0xfa'));db[_0x70bb('0xfb')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/smsTransferReport/smsTransferReport.model');db[_0x70bb('0xfc')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xfd'));db[_0x70bb('0xfe')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0xff'));db['UserProfile']=db[_0x70bb('0x4')]['import'](_0x70bb('0x100'));db[_0x70bb('0x101')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x102'));db['UserProfileResource']=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db[_0x70bb('0x4')]['import'](_0x70bb('0x103'));db[_0x70bb('0x104')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x105'));db['WhatsappApplication']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x106'));db[_0x70bb('0x107')]=db['sequelize'][_0x70bb('0x16')](_0x70bb('0x108'));db[_0x70bb('0x109')]=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x70bb('0x4')]['import'](_0x70bb('0x10a'));db['WhatsappTransferReport']=db[_0x70bb('0x4')]['import'](_0x70bb('0x10b'));db[_0x70bb('0x10c')]=db[_0x70bb('0x4')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x70bb('0x4')][_0x70bb('0x16')]('../api/cloudProvider/cloudProvider.model');db[_0x70bb('0x10d')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x10e'));db[_0x70bb('0x10f')]=db['sequelize'][_0x70bb('0x16')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x110'));db[_0x70bb('0x111')]=db[_0x70bb('0x4')][_0x70bb('0x16')](_0x70bb('0x112'));db[_0x70bb('0x14')][_0x70bb('0x113')](db['VoiceMail'],{'as':_0x70bb('0x114'),'onDelete':'cascade','foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')][_0x70bb('0x113')](db[_0x70bb('0x111')],{'as':'userSetting','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')][_0x70bb('0x117')](db[_0x70bb('0x1e')],{'as':_0x70bb('0x118'),'foreignKey':'UserId'});db[_0x70bb('0x14')][_0x70bb('0x117')](db[_0x70bb('0x2a')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x70bb('0x14')][_0x70bb('0x117')](db[_0x70bb('0x19')],{'as':_0x70bb('0x119'),'onDelete':_0x70bb('0x116'),'hooks':!![]});db[_0x70bb('0x14')][_0x70bb('0x117')](db['CmHopperFinal'],{'as':_0x70bb('0x11a'),'foreignKey':_0x70bb('0x115')});db['User'][_0x70bb('0x117')](db['CmHopperHistory'],{'as':_0x70bb('0x11b'),'foreignKey':_0x70bb('0x115')});db['User'][_0x70bb('0x117')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x70bb('0x14')][_0x70bb('0x117')](db[_0x70bb('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')][_0x70bb('0x117')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')][_0x70bb('0x117')](db[_0x70bb('0x51')],{'as':_0x70bb('0x11c'),'foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')][_0x70bb('0x117')](db[_0x70bb('0x4c')],{'as':'FaxInteractions','foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')][_0x70bb('0x117')](db[_0x70bb('0x3d')],{'as':_0x70bb('0x11d'),'foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')]['hasMany'](db[_0x70bb('0x107')],{'as':_0x70bb('0x11e'),'foreignKey':_0x70bb('0x115')});db[_0x70bb('0x14')]['hasMany'](db[_0x70bb('0x11f')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x70bb('0x14')][_0x70bb('0x120')](db[_0x70bb('0x121')],{'as':'UserProfile','foreignKey':_0x70bb('0x122')});db[_0x70bb('0x14')][_0x70bb('0x123')](db[_0x70bb('0x6a')],{'as':_0x70bb('0x124'),'through':'chat_group_has_users'});db[_0x70bb('0x14')][_0x70bb('0x123')](db[_0x70bb('0x125')],{'as':_0x70bb('0x126'),'through':'cm_user_has_contacts'});db[_0x70bb('0x14')][_0x70bb('0x123')](db['CmList'],{'as':'Lists','through':_0x70bb('0x127')});db[_0x70bb('0x14')][_0x70bb('0x123')](db['Team'],{'through':_0x70bb('0x128')});db[_0x70bb('0x14')][_0x70bb('0x123')](db['MailInteraction'],{'as':'MailInteractions','through':_0x70bb('0x129')});db['User'][_0x70bb('0x123')](db[_0x70bb('0x64')],{'as':_0x70bb('0x12a'),'through':_0x70bb('0x12b')});db[_0x70bb('0x14')][_0x70bb('0x123')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x70bb('0x12c')});db[_0x70bb('0x14')]['belongsToMany'](db['SmsInteraction'],{'as':_0x70bb('0x11c'),'through':_0x70bb('0x12d')});db[_0x70bb('0x14')]['belongsToMany'](db[_0x70bb('0x59')],{'as':_0x70bb('0x12e'),'through':_0x70bb('0x12f')});db['User'][_0x70bb('0x123')](db[_0x70bb('0x107')],{'as':'WhatsappInteractions','through':_0x70bb('0x130')});db['User'][_0x70bb('0x123')](db[_0x70bb('0x1c')],{'as':_0x70bb('0x131'),'through':_0x70bb('0x2c'),'required':![]});db[_0x70bb('0x14')][_0x70bb('0x123')](db[_0x70bb('0xfe')],{'as':_0x70bb('0x132'),'through':_0x70bb('0x133'),'required':![]});db[_0x70bb('0x14')][_0x70bb('0x123')](db[_0x70bb('0x3b')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0x70bb('0x14')]['belongsToMany'](db['ChatQueue'],{'as':_0x70bb('0x134'),'through':_0x70bb('0x2e'),'required':![],'hooks':!![]});db['User'][_0x70bb('0x123')](db[_0x70bb('0x135')],{'as':_0x70bb('0x136'),'through':_0x70bb('0x137'),'required':![]});db[_0x70bb('0x14')]['belongsToMany'](db[_0x70bb('0x55')],{'as':_0x70bb('0x138'),'through':_0x70bb('0x33'),'required':![]});db[_0x70bb('0x14')][_0x70bb('0x123')](db['OpenchannelQueue'],{'as':_0x70bb('0x139'),'through':_0x70bb('0x34'),'required':![]});db[_0x70bb('0x14')][_0x70bb('0x123')](db['WhatsappQueue'],{'as':_0x70bb('0x13a'),'through':'UserWhatsappQueue','required':![]});db[_0x70bb('0x14')][_0x70bb('0x123')](db['CmList'],{'through':_0x70bb('0x127')});db[_0x70bb('0x14')][_0x70bb('0x123')](db[_0x70bb('0x5e')],{'as':_0x70bb('0x13b'),'through':_0x70bb('0x13c')});db[_0x70bb('0x14')]['belongsToMany'](db[_0x70bb('0x48')],{'as':_0x70bb('0x13d'),'through':'user_has_fax_accounts'});db[_0x70bb('0x14')][_0x70bb('0x123')](db['MailAccount'],{'as':_0x70bb('0x13e'),'through':'user_has_mail_accounts'});db[_0x70bb('0x14')][_0x70bb('0x123')](db['OpenchannelAccount'],{'as':_0x70bb('0x13f'),'through':_0x70bb('0x140')});db[_0x70bb('0x14')]['belongsToMany'](db['SmsAccount'],{'as':'SmsAccounts','through':_0x70bb('0x141')});db[_0x70bb('0x14')][_0x70bb('0x123')](db['WhatsappAccount'],{'as':_0x70bb('0x142'),'through':_0x70bb('0x143')});db['User'][_0x70bb('0x123')](db[_0x70bb('0xe6')],{'as':_0x70bb('0x144'),'through':_0x70bb('0x145')});db[_0x70bb('0x15')]['hasMany'](db[_0x70bb('0x19')],{'as':_0x70bb('0x146'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x147')});db[_0x70bb('0x17')]['hasMany'](db['VoiceExtension'],{'onDelete':'cascade'});db['VoiceExtension'][_0x70bb('0x117')](db[_0x70bb('0x19')],{'as':_0x70bb('0x148'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x149')][_0x70bb('0x123')](db[_0x70bb('0x14a')],{'as':_0x70bb('0x14b'),'through':_0x70bb('0x14c')});db['VoiceQueue'][_0x70bb('0x117')](db[_0x70bb('0x2a')],{'as':'Members','foreignKey':_0x70bb('0x14d')});db[_0x70bb('0x1c')][_0x70bb('0x117')](db[_0x70bb('0x70')],{'as':_0x70bb('0x14e'),'foreignKey':_0x70bb('0x14d')});db[_0x70bb('0x1c')][_0x70bb('0x117')](db[_0x70bb('0x73')],{'as':_0x70bb('0x11a'),'foreignKey':_0x70bb('0x14d')});db[_0x70bb('0x1c')]['hasMany'](db['CmHopperHistory'],{'as':_0x70bb('0x14f'),'foreignKey':_0x70bb('0x14d')});db[_0x70bb('0x1c')][_0x70bb('0x117')](db[_0x70bb('0x76')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x70bb('0x1c')]['hasMany'](db[_0x70bb('0x150')],{'as':_0x70bb('0x151'),'foreignKey':_0x70bb('0x14d')});db[_0x70bb('0x1c')][_0x70bb('0x117')](db['JscriptySessionReport'],{'as':_0x70bb('0x152'),'foreignKey':_0x70bb('0x14d')});db['VoiceQueue'][_0x70bb('0x120')](db['Trunk'],{'as':'Trunk','foreignKey':_0x70bb('0x153')});db[_0x70bb('0x1c')][_0x70bb('0x120')](db[_0x70bb('0x154')],{'as':'TrunkBackup','foreignKey':_0x70bb('0x155')});db[_0x70bb('0x1c')][_0x70bb('0x120')](db[_0x70bb('0x81')],{'as':_0x70bb('0x81'),'foreignKey':'IntervalId'});db[_0x70bb('0x1c')]['belongsTo'](db[_0x70bb('0x83')],{'as':_0x70bb('0x156'),'foreignKey':_0x70bb('0x157')});db[_0x70bb('0x1c')][_0x70bb('0x123')](db[_0x70bb('0xfc')],{'as':_0x70bb('0x158'),'through':_0x70bb('0x159')});db[_0x70bb('0x1c')]['belongsToMany'](db[_0x70bb('0x14')],{'as':'Agents','through':_0x70bb('0x2c')});db[_0x70bb('0x1c')][_0x70bb('0x123')](db[_0x70bb('0xec')],{'as':'Teams','through':_0x70bb('0x10d')});db['VoiceQueue'][_0x70bb('0x123')](db[_0x70bb('0xfc')],{'as':_0x70bb('0x15a'),'through':_0x70bb('0x15b')});db[_0x70bb('0x1e')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x70bb('0x115')});db[_0x70bb('0x20')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x14'),'foreignKey':_0x70bb('0x115')});db[_0x70bb('0x114')][_0x70bb('0x117')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x70bb('0x15c'),'sourceKey':'mailbox'});db[_0x70bb('0x15d')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x70bb('0x15c'),'targetKey':_0x70bb('0x15e')});db[_0x70bb('0x15f')]['hasMany'](db[_0x70bb('0x160')],{'as':_0x70bb('0x161'),'foreignKey':_0x70bb('0x162'),'constraints':![]});db[_0x70bb('0x15f')][_0x70bb('0x117')](db[_0x70bb('0x23')],{'as':_0x70bb('0x163'),'foreignKey':_0x70bb('0x162'),'constraints':![]});db['VoiceCallReport'][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x14'),'foreignKey':_0x70bb('0x115')});db[_0x70bb('0x15f')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'as':'Contact','foreignKey':_0x70bb('0x164')});db[_0x70bb('0x37')][_0x70bb('0x120')](db[_0x70bb('0x3a')],{'as':_0x70bb('0x3a'),'foreignKey':_0x70bb('0x165')});db[_0x70bb('0x37')]['belongsTo'](db['CloudProvider'],{'as':_0x70bb('0x166'),'foreignKey':_0x70bb('0x167'),'onDelete':_0x70bb('0x168')});db[_0x70bb('0x169')][_0x70bb('0x120')](db[_0x70bb('0x3a')],{'as':_0x70bb('0x3a'),'foreignKey':_0x70bb('0x165')});db[_0x70bb('0x169')][_0x70bb('0x120')](db['CloudProvider'],{'as':_0x70bb('0x166'),'foreignKey':_0x70bb('0x167'),'onDelete':'restrict'});db['MailAccount'][_0x70bb('0x113')](db[_0x70bb('0x37')],{'as':'Imap','onDelete':_0x70bb('0x116')});db['MailAccount']['hasOne'](db[_0x70bb('0x169')],{'as':_0x70bb('0x16a'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x3a')]['hasMany'](db[_0x70bb('0x7d')],{'as':_0x70bb('0x16b'),'foreignKey':_0x70bb('0x165'),'onDelete':_0x70bb('0x116')});db['MailAccount'][_0x70bb('0x117')](db['CannedAnswer'],{'as':_0x70bb('0x16c'),'foreignKey':_0x70bb('0x165')});db[_0x70bb('0x3a')]['hasMany'](db[_0x70bb('0x3f')],{'as':_0x70bb('0x16d'),'foreignKey':_0x70bb('0x165')});db[_0x70bb('0x3a')][_0x70bb('0x117')](db[_0x70bb('0x3d')],{'as':_0x70bb('0x16e')});db[_0x70bb('0x3a')][_0x70bb('0x117')](db[_0x70bb('0x41')],{'as':_0x70bb('0x148')});db['MailAccount'][_0x70bb('0x120')](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x3a')][_0x70bb('0x120')](db[_0x70bb('0x93')],{'as':'Template','foreignKey':_0x70bb('0x171')});db['MailAccount'][_0x70bb('0x120')](db[_0x70bb('0x83')],{'as':_0x70bb('0x156'),'foreignKey':_0x70bb('0x157')});db[_0x70bb('0x3a')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x173')});db[_0x70bb('0x3b')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':'Agents','through':_0x70bb('0x30')});db[_0x70bb('0x3b')][_0x70bb('0x123')](db[_0x70bb('0xec')],{'through':_0x70bb('0x174'),'as':_0x70bb('0x175')});db[_0x70bb('0x3d')][_0x70bb('0x117')](db['MailMessage'],{'as':_0x70bb('0x16d'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x176')});db[_0x70bb('0x3d')][_0x70bb('0x120')](db[_0x70bb('0x3a')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x165')});db[_0x70bb('0x3d')][_0x70bb('0x120')](db['CmContact'],{'as':_0x70bb('0x178'),'foreignKey':_0x70bb('0x164')});db[_0x70bb('0x3d')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x179'),'foreignKey':'UserId'});db[_0x70bb('0x3d')][_0x70bb('0x123')](db['Tag'],{'through':_0x70bb('0x17a'),'as':_0x70bb('0x17b')});db['MailInteraction'][_0x70bb('0x123')](db['Tag'],{'through':_0x70bb('0x17a'),'as':'ThroughTags'});db[_0x70bb('0x3d')][_0x70bb('0x123')](db['User'],{'as':_0x70bb('0x17c'),'through':_0x70bb('0x129'),'foreignKey':_0x70bb('0x176')});db[_0x70bb('0x3f')][_0x70bb('0x117')](db[_0x70bb('0xf1')],{'as':'Attachments','onDelete':_0x70bb('0x116')});db[_0x70bb('0x3f')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x14')});db[_0x70bb('0x3f')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x178')});db[_0x70bb('0x3f')][_0x70bb('0x120')](db[_0x70bb('0x3d')],{'as':_0x70bb('0x17d'),'foreignKey':_0x70bb('0x176')});db[_0x70bb('0x3f')][_0x70bb('0x120')](db[_0x70bb('0x3a')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x165')});db[_0x70bb('0x3f')]['belongsTo'](db[_0x70bb('0x5e')],{'as':_0x70bb('0x5e'),'foreignKey':_0x70bb('0x17e')});db[_0x70bb('0x3f')]['belongsTo'](db[_0x70bb('0x17f')],{'as':_0x70bb('0x17f'),'foreignKey':'ChatOfflineMessageId'});db[_0x70bb('0x41')][_0x70bb('0x120')](db['User'],{'onDelete':'restrict'});db['MailApplication'][_0x70bb('0x120')](db[_0x70bb('0x3b')],{'onDelete':_0x70bb('0x168')});db['MailApplication'][_0x70bb('0x120')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0x70bb('0x120')](db[_0x70bb('0x81')],{'onDelete':'restrict','foreignKey':_0x70bb('0x180')});db['MailApplication'][_0x70bb('0x120')](db[_0x70bb('0x181')],{'onDelete':'restrict','foreignKey':_0x70bb('0x182')});db[_0x70bb('0x43')]['belongsTo'](db[_0x70bb('0x3a')],{});db['MailQueueReport']['belongsTo'](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x43')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':'ContactId'});db[_0x70bb('0x43')][_0x70bb('0x120')](db[_0x70bb('0x3d')],{});db['MailQueueReport'][_0x70bb('0x120')](db[_0x70bb('0x3f')],{});db[_0x70bb('0x43')][_0x70bb('0x120')](db[_0x70bb('0x14')],{});db[_0x70bb('0x43')][_0x70bb('0x120')](db[_0x70bb('0x3b')],{});db[_0x70bb('0x45')][_0x70bb('0x117')](db[_0x70bb('0x46')],{'as':'Items','onDelete':'cascade'});db[_0x70bb('0x48')][_0x70bb('0x117')](db[_0x70bb('0x7d')],{'as':'Dispositions','foreignKey':_0x70bb('0x183'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x48')][_0x70bb('0x117')](db['CannedAnswer'],{'as':_0x70bb('0x16c'),'foreignKey':_0x70bb('0x183')});db[_0x70bb('0x48')][_0x70bb('0x117')](db[_0x70bb('0x4c')],{'as':'Interactions'});db['FaxAccount']['hasMany'](db[_0x70bb('0x4a')],{'as':_0x70bb('0x148')});db['FaxAccount'][_0x70bb('0x117')](db['VoiceExtension'],{'as':_0x70bb('0x184'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x48')][_0x70bb('0x117')](db[_0x70bb('0x4e')],{'as':'Messages'});db[_0x70bb('0x48')]['belongsTo'](db[_0x70bb('0x154')],{'as':'Trunk'});db[_0x70bb('0x48')][_0x70bb('0x120')](db['CmList'],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x48')][_0x70bb('0x120')](db[_0x70bb('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x70bb('0x157')});db[_0x70bb('0x48')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x70bb('0x185')});db[_0x70bb('0x4a')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'onDelete':_0x70bb('0x168')});db['FaxApplication']['belongsTo'](db[_0x70bb('0x135')],{'onDelete':_0x70bb('0x168')});db[_0x70bb('0x4a')][_0x70bb('0x120')](db[_0x70bb('0x48')],{'onDelete':_0x70bb('0x168')});db['FaxApplication'][_0x70bb('0x120')](db[_0x70bb('0x181')],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x182')});db['FaxInteraction'][_0x70bb('0x117')](db[_0x70bb('0x4e')],{'as':_0x70bb('0x16d'),'onDelete':'cascade','foreignKey':_0x70bb('0x186')});db[_0x70bb('0x4c')][_0x70bb('0x120')](db['FaxAccount'],{'as':'Account','foreignKey':_0x70bb('0x183')});db['FaxInteraction'][_0x70bb('0x120')](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':_0x70bb('0x164')});db[_0x70bb('0x4c')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x179'),'foreignKey':'UserId'});db[_0x70bb('0x4c')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':'fax_interaction_has_tags','as':_0x70bb('0x17b')});db[_0x70bb('0x4c')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':_0x70bb('0x187'),'as':_0x70bb('0x188')});db[_0x70bb('0x4c')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x17c'),'through':_0x70bb('0x12c'),'foreignKey':_0x70bb('0x186')});db['FaxMessage'][_0x70bb('0x120')](db['User'],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x14')});db['FaxMessage'][_0x70bb('0x120')](db[_0x70bb('0x4c')],{'as':_0x70bb('0x17d'),'foreignKey':_0x70bb('0x186')});db[_0x70bb('0x4e')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x178')});db['FaxMessage'][_0x70bb('0x120')](db['Attachment'],{'as':'Attachment','foreignKey':_0x70bb('0x189')});db[_0x70bb('0x4e')][_0x70bb('0x120')](db[_0x70bb('0x48')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x183')});db[_0x70bb('0x135')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x137')});db[_0x70bb('0x135')][_0x70bb('0x123')](db[_0x70bb('0xec')],{'through':_0x70bb('0x18a'),'as':_0x70bb('0x175')});db[_0x70bb('0x18b')][_0x70bb('0x120')](db[_0x70bb('0x48')],{});db[_0x70bb('0x18b')]['belongsTo'](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x18b')]['belongsTo'](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':'ContactId'});db[_0x70bb('0x18b')][_0x70bb('0x120')](db[_0x70bb('0x4c')],{});db[_0x70bb('0x18b')][_0x70bb('0x120')](db['FaxMessage'],{});db[_0x70bb('0x18b')]['belongsTo'](db[_0x70bb('0x14')],{});db[_0x70bb('0x18b')][_0x70bb('0x120')](db[_0x70bb('0x135')],{});db[_0x70bb('0x18c')]['hasMany'](db[_0x70bb('0x7d')],{'as':_0x70bb('0x16b'),'foreignKey':_0x70bb('0x18d'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x18c')][_0x70bb('0x117')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x70bb('0x18d')});db[_0x70bb('0x18c')][_0x70bb('0x117')](db[_0x70bb('0x53')],{'as':_0x70bb('0x16d'),'foreignKey':_0x70bb('0x18d')});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0x70bb('0x16e')});db['SmsAccount'][_0x70bb('0x117')](db[_0x70bb('0x18e')],{'as':_0x70bb('0x148')});db[_0x70bb('0x18c')][_0x70bb('0x120')](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x18c')]['belongsTo'](db[_0x70bb('0x83')],{'as':_0x70bb('0x156'),'foreignKey':_0x70bb('0x157')});db['SmsAccount']['belongsToMany'](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x141')});db['SmsApplication'][_0x70bb('0x120')](db['User'],{'onDelete':_0x70bb('0x168')});db[_0x70bb('0x18e')][_0x70bb('0x120')](db[_0x70bb('0x55')],{'onDelete':'restrict'});db[_0x70bb('0x18e')][_0x70bb('0x120')](db[_0x70bb('0x18c')],{'onDelete':'restrict'});db[_0x70bb('0x18e')][_0x70bb('0x120')](db[_0x70bb('0x81')],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x180')});db['SmsApplication'][_0x70bb('0x120')](db[_0x70bb('0x181')],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x182')});db[_0x70bb('0x51')][_0x70bb('0x117')](db[_0x70bb('0x53')],{'as':_0x70bb('0x16d'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x18f')});db[_0x70bb('0x51')][_0x70bb('0x120')](db[_0x70bb('0x18c')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x18d')});db[_0x70bb('0x51')]['belongsTo'](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db['User'],{'as':_0x70bb('0x179'),'foreignKey':'UserId'});db['SmsInteraction']['belongsToMany'](db[_0x70bb('0x181')],{'through':_0x70bb('0x190'),'as':_0x70bb('0x17b')});db[_0x70bb('0x51')]['belongsToMany'](db[_0x70bb('0x181')],{'through':'sms_interaction_has_tags','as':_0x70bb('0x188')});db[_0x70bb('0x51')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x17c'),'through':_0x70bb('0x12d'),'foreignKey':_0x70bb('0x18f')});db[_0x70bb('0x53')][_0x70bb('0x120')](db['User'],{'as':_0x70bb('0x14')});db[_0x70bb('0x53')]['belongsTo'](db[_0x70bb('0x125')],{'onDelete':_0x70bb('0x116'),'as':'Contact'});db['SmsMessage'][_0x70bb('0x120')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x70bb('0x17d'),'foreignKey':_0x70bb('0x18f')});db[_0x70bb('0x53')][_0x70bb('0x120')](db[_0x70bb('0x18c')],{'as':_0x70bb('0x177'),'foreignKey':'SmsAccountId'});db[_0x70bb('0x55')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':'UserSmsQueue','foreignKey':_0x70bb('0x191')});db[_0x70bb('0x55')]['belongsToMany'](db[_0x70bb('0xec')],{'through':_0x70bb('0x192'),'as':'Teams'});db[_0x70bb('0x57')]['hasMany'](db[_0x70bb('0x7d')],{'as':'Dispositions','foreignKey':_0x70bb('0x193'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x57')][_0x70bb('0x117')](db['CannedAnswer'],{'as':_0x70bb('0x16c'),'foreignKey':_0x70bb('0x193')});db[_0x70bb('0x57')][_0x70bb('0x117')](db[_0x70bb('0x59')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x70bb('0x57')]['hasMany'](db[_0x70bb('0x5a')],{'as':_0x70bb('0x16d'),'foreignKey':_0x70bb('0x193')});db[_0x70bb('0x57')][_0x70bb('0x117')](db[_0x70bb('0x194')],{'as':_0x70bb('0x148'),'foreignKey':'OpenchannelAccountId'});db[_0x70bb('0x57')][_0x70bb('0x120')](db[_0x70bb('0xfc')],{'as':'List','foreignKey':'ListId'});db[_0x70bb('0x57')][_0x70bb('0x120')](db[_0x70bb('0x83')],{'as':_0x70bb('0x156'),'foreignKey':_0x70bb('0x157')});db[_0x70bb('0x57')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x140')});db[_0x70bb('0x194')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'onDelete':_0x70bb('0x168')});db[_0x70bb('0x194')][_0x70bb('0x120')](db[_0x70bb('0x5c')],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x195')});db['OpenchannelApplication'][_0x70bb('0x120')](db['OpenchannelAccount'],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x193')});db[_0x70bb('0x194')][_0x70bb('0x120')](db[_0x70bb('0x81')],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x180')});db[_0x70bb('0x194')]['belongsTo'](db[_0x70bb('0x181')],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x182')});db['OpenchannelInteraction'][_0x70bb('0x117')](db[_0x70bb('0x5a')],{'as':_0x70bb('0x16d'),'onDelete':'cascade','foreignKey':_0x70bb('0x196')});db['OpenchannelInteraction']['belongsTo'](db[_0x70bb('0x57')],{'as':'Account','foreignKey':_0x70bb('0x193')});db[_0x70bb('0x59')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x70bb('0x164')});db[_0x70bb('0x59')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x179'),'foreignKey':'UserId'});db[_0x70bb('0x59')]['belongsToMany'](db[_0x70bb('0x181')],{'through':_0x70bb('0x197'),'as':_0x70bb('0x17b')});db[_0x70bb('0x59')][_0x70bb('0x123')](db['Tag'],{'through':_0x70bb('0x197'),'as':_0x70bb('0x188')});db[_0x70bb('0x59')]['belongsToMany'](db[_0x70bb('0x14')],{'as':_0x70bb('0x17c'),'through':_0x70bb('0x12f'),'foreignKey':'OpenchannelInteractionId'});db[_0x70bb('0x5a')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x14')});db[_0x70bb('0x5a')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x178')});db[_0x70bb('0x5a')][_0x70bb('0x120')](db[_0x70bb('0x59')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x17d'),'foreignKey':_0x70bb('0x196')});db[_0x70bb('0x5a')][_0x70bb('0x120')](db['Attachment'],{'as':_0x70bb('0xf1'),'foreignKey':_0x70bb('0x189')});db[_0x70bb('0x5a')][_0x70bb('0x120')](db[_0x70bb('0x57')],{'as':'Account','foreignKey':_0x70bb('0x193')});db[_0x70bb('0x5c')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x70bb('0x34'),'foreignKey':_0x70bb('0x195')});db[_0x70bb('0x5c')][_0x70bb('0x123')](db[_0x70bb('0xec')],{'through':'team_has_openchannel_queues','as':_0x70bb('0x175')});db[_0x70bb('0x5e')]['hasMany'](db[_0x70bb('0x7d')],{'as':_0x70bb('0x16b'),'foreignKey':'ChatWebsiteId','onDelete':_0x70bb('0x116')});db['ChatWebsite'][_0x70bb('0x117')](db['CannedAnswer'],{'as':_0x70bb('0x16c'),'foreignKey':_0x70bb('0x17e')});db['ChatWebsite'][_0x70bb('0x117')](db[_0x70bb('0x6c')],{'as':_0x70bb('0x198')});db[_0x70bb('0x5e')]['hasMany'](db['ChatInteraction'],{'as':_0x70bb('0x16e')});db[_0x70bb('0x5e')][_0x70bb('0x117')](db['ChatApplication'],{'as':_0x70bb('0x148')});db[_0x70bb('0x5e')]['hasMany'](db[_0x70bb('0x65')],{'as':'Messages'});db[_0x70bb('0x5e')][_0x70bb('0x120')](db['CmList'],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x5e')]['belongsTo'](db[_0x70bb('0x81')],{'as':_0x70bb('0x81'),'foreignKey':_0x70bb('0x180')});db[_0x70bb('0x5e')][_0x70bb('0x120')](db[_0x70bb('0x3a')],{'as':_0x70bb('0x3a'),'foreignKey':_0x70bb('0x165')});db[_0x70bb('0x5e')]['belongsTo'](db['Pause'],{'as':_0x70bb('0x156'),'foreignKey':_0x70bb('0x157')});db[_0x70bb('0x5e')]['belongsToMany'](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x13c')});db[_0x70bb('0x60')]['belongsTo'](db[_0x70bb('0x57')],{});db[_0x70bb('0x60')][_0x70bb('0x120')](db['CmList'],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x60')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'as':'Contact','foreignKey':'ContactId'});db[_0x70bb('0x60')]['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x70bb('0x120')](db[_0x70bb('0x5a')],{});db[_0x70bb('0x60')]['belongsTo'](db[_0x70bb('0x14')],{});db[_0x70bb('0x60')][_0x70bb('0x120')](db['OpenchannelQueue'],{});db[_0x70bb('0x62')]['belongsTo'](db[_0x70bb('0x14')],{'as':'Agent','foreignKey':_0x70bb('0x115'),'onDelete':_0x70bb('0x168')});db[_0x70bb('0x62')]['belongsTo'](db[_0x70bb('0x68')],{'as':_0x70bb('0x199'),'foreignKey':'ChatQueueId','onDelete':_0x70bb('0x168')});db[_0x70bb('0x62')]['belongsTo'](db[_0x70bb('0x5e')],{'as':_0x70bb('0x19a'),'foreignKey':'ChatWebsiteId','onDelete':_0x70bb('0x168')});db[_0x70bb('0x62')][_0x70bb('0x120')](db[_0x70bb('0x181')],{'onDelete':_0x70bb('0x168'),'foreignKey':_0x70bb('0x182')});db[_0x70bb('0x64')]['hasMany'](db[_0x70bb('0x65')],{'as':_0x70bb('0x16d'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x19b')});db[_0x70bb('0x64')]['belongsTo'](db[_0x70bb('0x5e')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x17e')});db[_0x70bb('0x64')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':'ContactId'});db[_0x70bb('0x64')][_0x70bb('0x120')](db['User'],{'as':_0x70bb('0x179'),'foreignKey':_0x70bb('0x115')});db[_0x70bb('0x64')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':'chat_interaction_has_tags','as':_0x70bb('0x17b')});db[_0x70bb('0x64')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':_0x70bb('0x19c'),'as':'ThroughTags'});db[_0x70bb('0x64')][_0x70bb('0x123')](db['User'],{'as':_0x70bb('0x17c'),'through':_0x70bb('0x12b'),'foreignKey':_0x70bb('0x19b')});db['ChatMessage'][_0x70bb('0x120')](db[_0x70bb('0x14')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x14')});db[_0x70bb('0x65')][_0x70bb('0x120')](db['CmContact'],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x178'),'foreignKey':'ContactId'});db[_0x70bb('0x65')][_0x70bb('0x120')](db[_0x70bb('0x64')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x17d'),'foreignKey':_0x70bb('0x19b')});db[_0x70bb('0x65')][_0x70bb('0x120')](db['Attachment'],{'as':_0x70bb('0xf1'),'foreignKey':_0x70bb('0x189')});db['ChatMessage'][_0x70bb('0x120')](db['ChatWebsite'],{'as':_0x70bb('0x177'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':'Attachments','foreignKey':_0x70bb('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0x70bb('0x17f')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'onDelete':_0x70bb('0x116'),'as':'Contact','foreignKey':_0x70bb('0x164')});db[_0x70bb('0x17f')][_0x70bb('0x120')](db[_0x70bb('0x5e')],{'as':'Account','foreignKey':_0x70bb('0x17e')});db['ChatQueue'][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x2e'),'hooks':!![]});db['ChatQueue'][_0x70bb('0x123')](db[_0x70bb('0xec')],{'through':_0x70bb('0x19e'),'as':_0x70bb('0x175')});db[_0x70bb('0x6a')][_0x70bb('0x117')](db[_0x70bb('0xd4')],{'as':_0x70bb('0x16d'),'foreignKey':_0x70bb('0x19f'),'onDelete':_0x70bb('0x116')});db['ChatGroup'][_0x70bb('0x123')](db['User'],{'as':_0x70bb('0x1a0'),'through':_0x70bb('0x1a1')});db[_0x70bb('0x6c')][_0x70bb('0x120')](db[_0x70bb('0x5e')],{'as':_0x70bb('0x19a'),'foreignKey':_0x70bb('0x17e')});db['CmCompany'][_0x70bb('0x117')](db[_0x70bb('0x125')],{'as':'Contacts','foreignKey':_0x70bb('0x1a2')});db['CmContact'][_0x70bb('0x117')](db['CmContactHasItem'],{'as':'Phones','foreignKey':'CmContactId'});db['CmContact']['hasMany'](db[_0x70bb('0x70')],{'as':_0x70bb('0x14e'),'foreignKey':_0x70bb('0x164')});db['CmContact'][_0x70bb('0x117')](db[_0x70bb('0x73')],{'as':_0x70bb('0x11a'),'foreignKey':_0x70bb('0x164')});db[_0x70bb('0x125')][_0x70bb('0x117')](db[_0x70bb('0x74')],{'as':_0x70bb('0x14f'),'foreignKey':_0x70bb('0x164')});db[_0x70bb('0x125')][_0x70bb('0x117')](db[_0x70bb('0x76')],{'as':_0x70bb('0x76'),'foreignKey':'ContactId'});db[_0x70bb('0x125')][_0x70bb('0x117')](db['JscriptySessionReport'],{'as':_0x70bb('0x152'),'foreignKey':_0x70bb('0x164')});db[_0x70bb('0x125')][_0x70bb('0x117')](db[_0x70bb('0x59')],{'as':_0x70bb('0x12e'),'foreignKey':_0x70bb('0x164'),'onDelete':_0x70bb('0x168')});db['CmContact'][_0x70bb('0x117')](db[_0x70bb('0x64')],{'as':_0x70bb('0x12a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x70bb('0x125')][_0x70bb('0x117')](db[_0x70bb('0x51')],{'as':_0x70bb('0x11c'),'foreignKey':_0x70bb('0x164'),'onDelete':_0x70bb('0x168')});db[_0x70bb('0x125')][_0x70bb('0x117')](db[_0x70bb('0x4c')],{'as':_0x70bb('0x1a3'),'foreignKey':_0x70bb('0x164'),'onDelete':'restrict'});db[_0x70bb('0x125')][_0x70bb('0x117')](db[_0x70bb('0x3d')],{'as':_0x70bb('0x11d'),'foreignKey':_0x70bb('0x164'),'onDelete':'restrict'});db[_0x70bb('0x125')][_0x70bb('0x120')](db[_0x70bb('0x6e')],{'as':_0x70bb('0x1a4'),'foreignKey':_0x70bb('0x1a2')});db[_0x70bb('0x125')]['belongsTo'](db[_0x70bb('0xfc')],{'as':'List','foreignKey':_0x70bb('0x170'),'onDelete':'cascade'});db[_0x70bb('0x125')][_0x70bb('0x123')](db['User'],{'as':_0x70bb('0x17c'),'through':_0x70bb('0x1a5')});db['CmContact'][_0x70bb('0x123')](db[_0x70bb('0x181')],{'as':_0x70bb('0x17b'),'through':_0x70bb('0x1a6')});db['CmContact'][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':_0x70bb('0x1a6'),'as':_0x70bb('0x188')});db[_0x70bb('0x70')][_0x70bb('0x117')](db['CmHopperAdditionalPhone'],{'as':_0x70bb('0x1a7'),'foreignKey':_0x70bb('0x1a8')});db[_0x70bb('0x70')][_0x70bb('0x120')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x70bb('0x116')});db[_0x70bb('0x70')][_0x70bb('0x120')](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170'),'onDelete':_0x70bb('0x116')});db['CmHopper'][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':'Agent','foreignKey':_0x70bb('0x115')});db[_0x70bb('0x70')][_0x70bb('0x120')](db[_0x70bb('0x1c')],{'as':_0x70bb('0x199'),'foreignKey':_0x70bb('0x14d'),'onDelete':'cascade'});db[_0x70bb('0x70')][_0x70bb('0x120')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x70bb('0x116')});db['CmHopper'][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x179'),'foreignKey':_0x70bb('0x1a9')});db[_0x70bb('0x150')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':_0x70bb('0x164'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x70bb('0xfc')],{'as':'List','foreignKey':_0x70bb('0x170'),'onDelete':'cascade'});db['CmHopperBlack'][_0x70bb('0x120')](db['VoiceQueue'],{'as':_0x70bb('0x199'),'foreignKey':_0x70bb('0x14d'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x150')][_0x70bb('0x120')](db['Campaign'],{'as':_0x70bb('0x1aa'),'foreignKey':_0x70bb('0x1ab'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0x7a')][_0x70bb('0x117')](db['Condition'],{'as':{'plural':_0x70bb('0x1ac'),'singular':'OneAll'},'foreignKey':_0x70bb('0x1ad'),'onDelete':_0x70bb('0x116'),'hooks':!![]});db[_0x70bb('0x7a')][_0x70bb('0x117')](db[_0x70bb('0x7f')],{'as':{'plural':_0x70bb('0x1ae'),'singular':'OneAny'},'foreignKey':_0x70bb('0x1af'),'onDelete':_0x70bb('0x116'),'hooks':!![]});db[_0x70bb('0x7a')][_0x70bb('0x117')](db[_0x70bb('0x79')],{'as':_0x70bb('0x1b0'),'foreignKey':_0x70bb('0x1b1'),'onDelete':_0x70bb('0x116'),'hooks':!![]});db['Disposition']['hasMany'](db[_0x70bb('0x7d')],{'as':_0x70bb('0x16b'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x70bb('0x81')][_0x70bb('0x117')](db[_0x70bb('0x81')],{'as':_0x70bb('0x1b2'),'foreignKey':_0x70bb('0x180'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x70bb('0x81')][_0x70bb('0x117')](db[_0x70bb('0x19')],{'as':_0x70bb('0x119'),'foreignKey':_0x70bb('0x180'),'onDelete':_0x70bb('0x168')});db[_0x70bb('0x81')][_0x70bb('0x117')](db['MailApplication'],{'as':_0x70bb('0x1b3'),'foreignKey':_0x70bb('0x180')});db[_0x70bb('0x81')][_0x70bb('0x117')](db[_0x70bb('0x62')],{'as':_0x70bb('0x1b4'),'foreignKey':_0x70bb('0x180')});db[_0x70bb('0x81')][_0x70bb('0x117')](db[_0x70bb('0x4a')],{'as':_0x70bb('0x1b5'),'foreignKey':_0x70bb('0x180')});db[_0x70bb('0x81')][_0x70bb('0x117')](db[_0x70bb('0x18e')],{'as':_0x70bb('0x1b6'),'foreignKey':_0x70bb('0x180')});db[_0x70bb('0x89')][_0x70bb('0x120')](db[_0x70bb('0x3a')],{});db[_0x70bb('0x89')][_0x70bb('0x120')](db[_0x70bb('0x1b7')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x70bb('0x120')](db['AnalyticCustomReport'],{'foreignKey':_0x70bb('0x1b8')});db['Sound'][_0x70bb('0x123')](db[_0x70bb('0x149')],{'as':_0x70bb('0x1b9'),'through':'moh_has_sounds','onDelete':_0x70bb('0x168')});db[_0x70bb('0x181')][_0x70bb('0x123')](db[_0x70bb('0x125')],{'through':_0x70bb('0x1a6')});db[_0x70bb('0x181')]['belongsToMany'](db[_0x70bb('0x64')],{'through':'chat_interaction_has_tags'});db[_0x70bb('0x181')][_0x70bb('0x123')](db['MailInteraction'],{'through':_0x70bb('0x17a')});db['Tag']['belongsToMany'](db[_0x70bb('0x51')],{'through':_0x70bb('0x190')});db[_0x70bb('0x181')]['belongsToMany'](db[_0x70bb('0x4c')],{'through':_0x70bb('0x187')});db[_0x70bb('0x181')]['belongsToMany'](db[_0x70bb('0x59')],{'through':_0x70bb('0x197')});db[_0x70bb('0x181')][_0x70bb('0x123')](db[_0x70bb('0x107')],{'through':_0x70bb('0x1ba')});db['CmContactHasItem'][_0x70bb('0x120')](db[_0x70bb('0x8d')],{'as':_0x70bb('0x1bb'),'foreignKey':_0x70bb('0x1bc')});db[_0x70bb('0x91')][_0x70bb('0x120')](db['CmHopper'],{'as':_0x70bb('0x1bd'),'foreignKey':_0x70bb('0x1a8')});db[_0x70bb('0x8f')][_0x70bb('0x120')](db['CmContact'],{'as':'Contact','foreignKey':_0x70bb('0x1be')});db[_0x70bb('0x1bf')]['hasMany'](db[_0x70bb('0x7f')],{'as':{'plural':_0x70bb('0x1c0'),'singular':_0x70bb('0x1c1')},'foreignKey':_0x70bb('0x1c2'),'onDelete':_0x70bb('0x116'),'hooks':!![]});db[_0x70bb('0x1bf')][_0x70bb('0x117')](db['Condition'],{'as':{'plural':_0x70bb('0x1c3'),'singular':_0x70bb('0x1c4')},'foreignKey':_0x70bb('0x1c5'),'onDelete':_0x70bb('0x116'),'hooks':!![]});db['Trigger'][_0x70bb('0x117')](db['Action'],{'as':_0x70bb('0x1b0'),'foreignKey':'TriggerId','onDelete':_0x70bb('0x116'),'hooks':!![]});db[_0x70bb('0x9b')][_0x70bb('0x117')](db['AnalyticFieldReport'],{'as':_0x70bb('0x1c6'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1b8'),'hooks':!![]});db[_0x70bb('0x1b7')][_0x70bb('0x117')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1c7')});db[_0x70bb('0x9f')][_0x70bb('0x117')](db[_0x70bb('0xa1')],{'as':_0x70bb('0x1c6'),'onDelete':'cascade','foreignKey':_0x70bb('0x1c8')});db['AnalyticFieldReport']['belongsTo'](db[_0x70bb('0x9f')],{'foreignKey':_0x70bb('0x1c8')});db[_0x70bb('0x1c9')]['hasMany'](db[_0x70bb('0xa6')],{'as':'Configurations','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xa6')][_0x70bb('0x117')](db[_0x70bb('0xa8')],{'as':_0x70bb('0x1cb'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x70bb('0xa6')][_0x70bb('0x117')](db[_0x70bb('0xa8')],{'as':'Descriptions','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0xa6')][_0x70bb('0x117')](db[_0x70bb('0xa8')],{'as':_0x70bb('0x1c6'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0xa6')][_0x70bb('0x120')](db['SalesforceAccount'],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0x70bb('0x1ce'),'foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0xa8')][_0x70bb('0x117')](db['SalesforceField'],{'as':_0x70bb('0x1d0'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0xa8')]['hasMany'](db[_0x70bb('0xa8')],{'as':_0x70bb('0x1d1'),'foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0xa8')][_0x70bb('0x120')](db[_0x70bb('0x95')],{'as':_0x70bb('0x95'),'foreignKey':_0x70bb('0x1d2')});db[_0x70bb('0x1d3')][_0x70bb('0x117')](db[_0x70bb('0xaa')],{'as':_0x70bb('0x1d4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x70bb('0xaa')][_0x70bb('0x117')](db[_0x70bb('0xac')],{'as':_0x70bb('0x1cb'),'onDelete':_0x70bb('0x116'),'foreignKey':'SubjectId'});db[_0x70bb('0xaa')][_0x70bb('0x117')](db[_0x70bb('0xac')],{'as':_0x70bb('0x1d5'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0xaa')]['hasMany'](db[_0x70bb('0xac')],{'as':_0x70bb('0x1c6'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1cd')});db['SugarcrmConfiguration']['belongsTo'](db[_0x70bb('0x1d3')],{'as':_0x70bb('0x177'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x70bb('0x117')](db[_0x70bb('0xac')],{'as':_0x70bb('0x1ce'),'foreignKey':_0x70bb('0x1cf')});db['SugarcrmField'][_0x70bb('0x117')](db[_0x70bb('0xac')],{'as':_0x70bb('0x1d0'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db[_0x70bb('0xac')],{'as':_0x70bb('0x1d1'),'foreignKey':_0x70bb('0x1cd')});db['SugarcrmField'][_0x70bb('0x120')](db['Variable'],{'as':_0x70bb('0x95'),'foreignKey':_0x70bb('0x1d2')});db[_0x70bb('0xae')][_0x70bb('0x117')](db[_0x70bb('0xb0')],{'as':_0x70bb('0x1d4'),'onDelete':_0x70bb('0x116'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x70bb('0x117')](db[_0x70bb('0xb2')],{'as':_0x70bb('0x1cb'),'onDelete':'cascade','foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0xb0')][_0x70bb('0x117')](db[_0x70bb('0xb2')],{'as':_0x70bb('0x1d5'),'onDelete':_0x70bb('0x116'),'foreignKey':'DescriptionId'});db[_0x70bb('0xb0')][_0x70bb('0x117')](db['DeskField'],{'as':_0x70bb('0x1c6'),'onDelete':_0x70bb('0x116'),'foreignKey':'FieldId'});db[_0x70bb('0xb0')][_0x70bb('0x120')](db['DeskAccount'],{'as':'Account','foreignKey':_0x70bb('0x1ca')});db['DeskConfiguration'][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':_0x70bb('0x1d6')});db[_0x70bb('0xb2')][_0x70bb('0x117')](db[_0x70bb('0xb2')],{'as':'Subject','foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0xb2')][_0x70bb('0x117')](db[_0x70bb('0xb2')],{'as':_0x70bb('0x1d0'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0xb2')][_0x70bb('0x117')](db[_0x70bb('0xb2')],{'as':_0x70bb('0x1d1'),'foreignKey':'FieldId'});db[_0x70bb('0xb2')][_0x70bb('0x120')](db[_0x70bb('0x95')],{'as':_0x70bb('0x95'),'foreignKey':'VariableId'});db[_0x70bb('0x1d7')][_0x70bb('0x117')](db[_0x70bb('0x1d8')],{'as':_0x70bb('0x1d4'),'onDelete':_0x70bb('0x116'),'foreignKey':'AccountId'});db[_0x70bb('0x1d8')][_0x70bb('0x117')](db[_0x70bb('0xb6')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0x1d8')][_0x70bb('0x117')](db[_0x70bb('0xb6')],{'as':_0x70bb('0x1d5'),'onDelete':'cascade','foreignKey':_0x70bb('0x1cc')});db['ZohoConfiguration'][_0x70bb('0x117')](db[_0x70bb('0xb6')],{'as':_0x70bb('0x1c6'),'onDelete':'cascade','foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0x1d8')][_0x70bb('0x120')](db[_0x70bb('0x1d7')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xb6')][_0x70bb('0x117')](db[_0x70bb('0xb6')],{'as':_0x70bb('0x1ce'),'foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0xb6')][_0x70bb('0x117')](db[_0x70bb('0xb6')],{'as':_0x70bb('0x1d0'),'foreignKey':'DescriptionId'});db[_0x70bb('0xb6')][_0x70bb('0x117')](db[_0x70bb('0xb6')],{'as':_0x70bb('0x1d1'),'foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0xb6')][_0x70bb('0x120')](db[_0x70bb('0x95')],{'as':_0x70bb('0x95'),'foreignKey':_0x70bb('0x1d2')});db[_0x70bb('0x1d9')][_0x70bb('0x117')](db['ZendeskConfiguration'],{'as':_0x70bb('0x1d4'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xb8')][_0x70bb('0x117')](db[_0x70bb('0xba')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x70bb('0xb8')][_0x70bb('0x117')](db['ZendeskField'],{'as':_0x70bb('0x1d5'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0xb8')][_0x70bb('0x117')](db[_0x70bb('0xba')],{'as':_0x70bb('0x1c6'),'foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0xb8')][_0x70bb('0x120')](db[_0x70bb('0x1d9')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xb8')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':'int_zendesk_configuration_has_tags'});db[_0x70bb('0xba')][_0x70bb('0x117')](db[_0x70bb('0xba')],{'as':_0x70bb('0x1ce'),'foreignKey':_0x70bb('0x1cf')});db['ZendeskField'][_0x70bb('0x117')](db[_0x70bb('0xba')],{'as':_0x70bb('0x1d0'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0xba')][_0x70bb('0x117')](db[_0x70bb('0xba')],{'as':'Field','foreignKey':'FieldId'});db[_0x70bb('0xba')][_0x70bb('0x120')](db['Variable'],{'as':'Variable','foreignKey':_0x70bb('0x1d2')});db[_0x70bb('0xbc')]['hasMany'](db[_0x70bb('0xbe')],{'as':'Configurations','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xbe')][_0x70bb('0x117')](db[_0x70bb('0xc0')],{'as':_0x70bb('0x1cb'),'onDelete':_0x70bb('0x116'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration']['hasMany'](db[_0x70bb('0xc0')],{'as':_0x70bb('0x1d5'),'onDelete':_0x70bb('0x116'),'foreignKey':'DescriptionId'});db[_0x70bb('0xbe')][_0x70bb('0x117')](db[_0x70bb('0xc0')],{'as':'Fields','onDelete':_0x70bb('0x116'),'foreignKey':'FieldId'});db[_0x70bb('0xbe')][_0x70bb('0x120')](db[_0x70bb('0xbc')],{'as':'Account','foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xbe')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':_0x70bb('0x1da')});db['FreshdeskField'][_0x70bb('0x117')](db[_0x70bb('0xc0')],{'as':_0x70bb('0x1ce'),'foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0xc0')][_0x70bb('0x117')](db['FreshdeskField'],{'as':_0x70bb('0x1d0'),'foreignKey':'DescriptionId'});db[_0x70bb('0xc0')][_0x70bb('0x117')](db[_0x70bb('0xc0')],{'as':_0x70bb('0x1d1'),'foreignKey':'FieldId'});db[_0x70bb('0xc0')][_0x70bb('0x120')](db[_0x70bb('0x95')],{'as':_0x70bb('0x95'),'foreignKey':_0x70bb('0x1d2')});db['VtigerAccount'][_0x70bb('0x117')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0x1db')]['hasMany'](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x70bb('0x1db')][_0x70bb('0x117')](db[_0x70bb('0x1dc')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x70bb('0x1db')][_0x70bb('0x117')](db[_0x70bb('0x1dc')],{'as':'Fields','foreignKey':'FieldId'});db['VtigerConfiguration'][_0x70bb('0x120')](db[_0x70bb('0x1dd')],{'as':'Account','foreignKey':_0x70bb('0x1ca')});db['VtigerField'][_0x70bb('0x117')](db['VtigerField'],{'as':'Subject','foreignKey':_0x70bb('0x1cf')});db['VtigerField'][_0x70bb('0x117')](db[_0x70bb('0x1dc')],{'as':_0x70bb('0x1d0'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0x1dc')]['hasMany'](db[_0x70bb('0x1dc')],{'as':'Field','foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0x1dc')]['belongsTo'](db[_0x70bb('0x95')],{'as':'Variable','foreignKey':_0x70bb('0x1d2')});db[_0x70bb('0x1de')][_0x70bb('0x117')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x70bb('0x1ca')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0x1df')][_0x70bb('0x117')](db[_0x70bb('0x1e0')],{'as':_0x70bb('0x1d5'),'foreignKey':_0x70bb('0x1cc')});db[_0x70bb('0x1df')][_0x70bb('0x117')](db['ServicenowField'],{'as':_0x70bb('0x1c6'),'foreignKey':_0x70bb('0x1cd')});db['ServicenowConfiguration'][_0x70bb('0x120')](db[_0x70bb('0x1de')],{'as':_0x70bb('0x177'),'foreignKey':'AccountId'});db[_0x70bb('0x1e0')]['hasMany'](db[_0x70bb('0x1e0')],{'as':_0x70bb('0x1ce'),'foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0x1e0')]['hasMany'](db[_0x70bb('0x1e0')],{'as':_0x70bb('0x1d0'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0x70bb('0x117')](db[_0x70bb('0x1e0')],{'as':_0x70bb('0x1d1'),'foreignKey':'FieldId'});db[_0x70bb('0x1e0')][_0x70bb('0x120')](db[_0x70bb('0x95')],{'as':_0x70bb('0x95'),'foreignKey':_0x70bb('0x1d2')});db['Dynamics365Account']['hasMany'](db[_0x70bb('0xc8')],{'as':_0x70bb('0x1d4'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xc6')][_0x70bb('0x120')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x70bb('0x167')});db[_0x70bb('0xc8')][_0x70bb('0x117')](db[_0x70bb('0x1e1')],{'as':_0x70bb('0x1cb'),'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0xc8')]['hasMany'](db[_0x70bb('0x1e1')],{'as':_0x70bb('0x1d5'),'onDelete':_0x70bb('0x116'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x70bb('0x117')](db[_0x70bb('0x1e1')],{'as':'Fields','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0xc8')][_0x70bb('0x120')](db[_0x70bb('0xc6')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x1ca')});db['Dynamics365Field'][_0x70bb('0x117')](db[_0x70bb('0x1e1')],{'as':'Subject','foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0x1e1')]['hasMany'](db[_0x70bb('0x1e1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x70bb('0x1e1')][_0x70bb('0x117')](db[_0x70bb('0x1e1')],{'as':_0x70bb('0x1d1'),'foreignKey':_0x70bb('0x1cd')});db['Dynamics365Field'][_0x70bb('0x120')](db[_0x70bb('0x95')],{'as':_0x70bb('0x95'),'foreignKey':_0x70bb('0x1d2')});db[_0x70bb('0xcb')]['hasMany'](db[_0x70bb('0xcd')],{'as':'Configurations','onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1ca')});db[_0x70bb('0xcd')][_0x70bb('0x117')](db[_0x70bb('0xcf')],{'as':_0x70bb('0x1cb'),'foreignKey':_0x70bb('0x1cf')});db[_0x70bb('0xcd')][_0x70bb('0x117')](db[_0x70bb('0xcf')],{'as':_0x70bb('0x1d5'),'foreignKey':'DescriptionId'});db[_0x70bb('0xcd')]['hasMany'](db[_0x70bb('0xcf')],{'as':_0x70bb('0x1c6'),'foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0xcd')][_0x70bb('0x120')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x70bb('0x1ca')});db['FreshsalesField'][_0x70bb('0x117')](db['FreshsalesField'],{'as':_0x70bb('0x1ce'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x70bb('0x117')](db[_0x70bb('0xcf')],{'as':_0x70bb('0x1d0'),'foreignKey':'DescriptionId'});db[_0x70bb('0xcf')][_0x70bb('0x117')](db[_0x70bb('0xcf')],{'as':_0x70bb('0x1d1'),'foreignKey':_0x70bb('0x1cd')});db[_0x70bb('0xcf')][_0x70bb('0x120')](db[_0x70bb('0x95')],{'as':_0x70bb('0x95'),'foreignKey':_0x70bb('0x1d2')});db[_0x70bb('0xd2')]['belongsTo'](db[_0x70bb('0x5e')],{});db['ChatQueueReport'][_0x70bb('0x120')](db['CmList'],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0xd2')]['belongsTo'](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':'ContactId'});db[_0x70bb('0xd2')][_0x70bb('0x120')](db[_0x70bb('0x64')],{});db[_0x70bb('0xd2')][_0x70bb('0x120')](db[_0x70bb('0x65')],{});db['ChatQueueReport'][_0x70bb('0x120')](db[_0x70bb('0x14')],{});db['ChatQueueReport'][_0x70bb('0x120')](db['ChatQueue'],{});db[_0x70bb('0xd4')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1e2')});db[_0x70bb('0xd4')][_0x70bb('0x120')](db['User'],{'onDelete':_0x70bb('0x116'),'foreignKey':_0x70bb('0x1e3')});db['JscriptySessionReport'][_0x70bb('0x117')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x70bb('0x1e4')][_0x70bb('0x117')](db[_0x70bb('0xd6')],{'foreignKey':_0x70bb('0x1e5'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0xdb')][_0x70bb('0x120')](db[_0x70bb('0x18c')],{});db['SmsQueueReport']['belongsTo'](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db['SmsQueueReport'][_0x70bb('0x120')](db['CmContact'],{'as':'Contact','foreignKey':_0x70bb('0x164')});db[_0x70bb('0xdb')]['belongsTo'](db[_0x70bb('0x51')],{});db[_0x70bb('0xdb')][_0x70bb('0x120')](db['SmsMessage'],{});db['SmsQueueReport'][_0x70bb('0x120')](db[_0x70bb('0x14')],{});db[_0x70bb('0xdb')][_0x70bb('0x120')](db[_0x70bb('0x55')],{});db['JscriptyProject'][_0x70bb('0x117')](db[_0x70bb('0x1e4')],{'foreignKey':_0x70bb('0x1e6')});db[_0x70bb('0xe0')][_0x70bb('0x117')](db[_0x70bb('0xd8')],{'foreignKey':_0x70bb('0x1e6')});db[_0x70bb('0xe0')][_0x70bb('0x117')](db[_0x70bb('0xd6')],{'foreignKey':'ProjectId'});db[_0x70bb('0xe6')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x17c'),'through':'user_has_square_projects'});db[_0x70bb('0xec')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_teams'});db[_0x70bb('0xec')]['belongsToMany'](db[_0x70bb('0x1c')],{'through':'TeamVoiceQueue','as':_0x70bb('0x131')});db[_0x70bb('0xec')][_0x70bb('0x123')](db[_0x70bb('0x3b')],{'through':_0x70bb('0x174'),'as':'MailQueues'});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x70bb('0x19e'),'as':_0x70bb('0x134')});db[_0x70bb('0xec')][_0x70bb('0x123')](db['FaxQueue'],{'through':_0x70bb('0x18a'),'as':_0x70bb('0x136')});db[_0x70bb('0xec')][_0x70bb('0x123')](db[_0x70bb('0x55')],{'through':_0x70bb('0x192'),'as':_0x70bb('0x138')});db['Team']['belongsToMany'](db[_0x70bb('0x5c')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x70bb('0xec')][_0x70bb('0x123')](db['WhatsappQueue'],{'through':_0x70bb('0x1e7'),'as':'WhatsappQueues'});db[_0x70bb('0xec')][_0x70bb('0x123')](db[_0x70bb('0xfe')],{'through':_0x70bb('0x10f'),'as':_0x70bb('0x132')});db[_0x70bb('0x1aa')][_0x70bb('0x117')](db[_0x70bb('0x70')],{'as':_0x70bb('0x14e'),'foreignKey':'CampaignId'});db[_0x70bb('0x1aa')][_0x70bb('0x117')](db['CmHopperFinal'],{'as':_0x70bb('0x11a'),'foreignKey':_0x70bb('0x1ab')});db['Campaign'][_0x70bb('0x117')](db[_0x70bb('0x74')],{'as':_0x70bb('0x14f'),'foreignKey':'CampaignId'});db[_0x70bb('0x1aa')]['hasMany'](db[_0x70bb('0x150')],{'as':_0x70bb('0x151'),'foreignKey':_0x70bb('0x1ab')});db[_0x70bb('0x1aa')]['belongsTo'](db[_0x70bb('0x154')],{'as':_0x70bb('0x154'),'foreignKey':_0x70bb('0x153')});db[_0x70bb('0x1aa')][_0x70bb('0x120')](db[_0x70bb('0x154')],{'as':'TrunkBackup','foreignKey':_0x70bb('0x155')});db[_0x70bb('0x1aa')][_0x70bb('0x120')](db[_0x70bb('0x81')],{'as':_0x70bb('0x81'),'foreignKey':_0x70bb('0x180')});db[_0x70bb('0x1aa')]['belongsTo'](db[_0x70bb('0xe6')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x70bb('0x1aa')]['belongsToMany'](db[_0x70bb('0xfc')],{'as':'Lists','through':_0x70bb('0x1e8')});db[_0x70bb('0x1aa')][_0x70bb('0x123')](db['CmList'],{'as':_0x70bb('0x15a'),'through':_0x70bb('0x1e9')});db[_0x70bb('0xf1')][_0x70bb('0x120')](db[_0x70bb('0x17f')],{'as':_0x70bb('0x17f'),'foreignKey':_0x70bb('0x19d')});db[_0x70bb('0xf5')]['belongsTo'](db['MailMessage'],{});db[_0x70bb('0xf5')]['belongsTo'](db[_0x70bb('0x3d')],{});db[_0x70bb('0xf5')]['belongsTo'](db[_0x70bb('0x3a')],{'foreignKey':_0x70bb('0x1ea'),'as':_0x70bb('0x1eb')});db[_0x70bb('0xf5')]['belongsTo'](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ec'),'as':_0x70bb('0x1ed')});db[_0x70bb('0xf5')]['belongsTo'](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ee'),'as':_0x70bb('0x1ef')});db[_0x70bb('0xf5')][_0x70bb('0x120')](db[_0x70bb('0x3b')],{'foreignKey':_0x70bb('0x1f0'),'as':'ToQueue'});db[_0x70bb('0xf5')][_0x70bb('0x120')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x70bb('0x1f1')][_0x70bb('0x120')](db[_0x70bb('0x65')],{});db[_0x70bb('0x1f1')]['belongsTo'](db[_0x70bb('0x64')],{});db[_0x70bb('0x1f1')]['belongsTo'](db[_0x70bb('0x5e')],{'foreignKey':'FromChatWebsiteId','as':_0x70bb('0x1eb')});db[_0x70bb('0x1f1')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ec'),'as':_0x70bb('0x1ed')});db[_0x70bb('0x1f1')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ee'),'as':_0x70bb('0x1ef')});db[_0x70bb('0x1f1')][_0x70bb('0x120')](db[_0x70bb('0x68')],{'foreignKey':_0x70bb('0x1f2'),'as':_0x70bb('0x1f3')});db[_0x70bb('0x1f1')][_0x70bb('0x120')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x70bb('0x1f4')});db[_0x70bb('0xf7')][_0x70bb('0x120')](db[_0x70bb('0x4e')],{});db[_0x70bb('0xf7')]['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport'][_0x70bb('0x120')](db[_0x70bb('0x48')],{'foreignKey':_0x70bb('0x1f5'),'as':_0x70bb('0x1eb')});db['FaxTransferReport'][_0x70bb('0x120')](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ec'),'as':_0x70bb('0x1ed')});db[_0x70bb('0xf7')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'foreignKey':'ToUserId','as':_0x70bb('0x1ef')});db['FaxTransferReport'][_0x70bb('0x120')](db[_0x70bb('0x135')],{'foreignKey':_0x70bb('0x1f6'),'as':_0x70bb('0x1f3')});db[_0x70bb('0xf7')]['belongsTo'](db[_0x70bb('0x48')],{'foreignKey':_0x70bb('0x1f7'),'as':_0x70bb('0x1f4')});db[_0x70bb('0xf9')]['belongsTo'](db[_0x70bb('0x5a')],{});db[_0x70bb('0xf9')][_0x70bb('0x120')](db[_0x70bb('0x59')],{});db[_0x70bb('0xf9')][_0x70bb('0x120')](db[_0x70bb('0x57')],{'foreignKey':_0x70bb('0x1f8'),'as':'FromAccount'});db[_0x70bb('0xf9')]['belongsTo'](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ec'),'as':_0x70bb('0x1ed')});db[_0x70bb('0xf9')]['belongsTo'](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ee'),'as':_0x70bb('0x1ef')});db[_0x70bb('0xf9')]['belongsTo'](db[_0x70bb('0x5c')],{'foreignKey':_0x70bb('0x1f9'),'as':'ToQueue'});db[_0x70bb('0xf9')]['belongsTo'](db[_0x70bb('0x57')],{'foreignKey':'ToOpenchannelAccountId','as':_0x70bb('0x1f4')});db[_0x70bb('0xfb')][_0x70bb('0x120')](db[_0x70bb('0x53')],{});db['SmsTransferReport']['belongsTo'](db[_0x70bb('0x51')],{});db[_0x70bb('0xfb')][_0x70bb('0x120')](db[_0x70bb('0x18c')],{'foreignKey':'FromSmsAccountId','as':_0x70bb('0x1eb')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x70bb('0x1ec'),'as':_0x70bb('0x1ed')});db[_0x70bb('0xfb')]['belongsTo'](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ee'),'as':_0x70bb('0x1ef')});db[_0x70bb('0xfb')][_0x70bb('0x120')](db[_0x70bb('0x55')],{'foreignKey':_0x70bb('0x1fa'),'as':_0x70bb('0x1f3')});db['SmsTransferReport'][_0x70bb('0x120')](db[_0x70bb('0x18c')],{'foreignKey':'ToSmsAccountId','as':_0x70bb('0x1f4')});db[_0x70bb('0xfc')][_0x70bb('0x117')](db[_0x70bb('0x7d')],{'as':_0x70bb('0x16b'),'foreignKey':_0x70bb('0x170'),'onDelete':_0x70bb('0x116')});db[_0x70bb('0xfc')][_0x70bb('0x117')](db[_0x70bb('0x78')],{'as':_0x70bb('0x1fb'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0xfc')][_0x70bb('0x117')](db[_0x70bb('0x125')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x70bb('0x170')});db['CmList']['hasMany'](db[_0x70bb('0x73')],{'as':_0x70bb('0x11a'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0xfc')]['hasMany'](db['CmHopperHistory'],{'as':_0x70bb('0x11b'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0xfc')][_0x70bb('0x117')](db[_0x70bb('0x76')],{'as':_0x70bb('0x76'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0xfc')][_0x70bb('0x123')](db[_0x70bb('0x1c')],{'as':_0x70bb('0x1fc'),'through':'voice_queues_has_cm_lists'});db[_0x70bb('0xfc')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':'cm_user_has_lists'});db[_0x70bb('0xfe')][_0x70bb('0x117')](db[_0x70bb('0x19')],{'as':'Extensions','onDelete':_0x70bb('0x116')});db[_0x70bb('0xfe')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x133')});db[_0x70bb('0xfe')][_0x70bb('0x123')](db['Team'],{'through':_0x70bb('0x10f'),'as':_0x70bb('0x175')});db[_0x70bb('0x121')]['hasMany'](db[_0x70bb('0x14')],{'as':'Users','foreignKey':_0x70bb('0x122')});db[_0x70bb('0x121')][_0x70bb('0x117')](db['UserProfileSection'],{'as':_0x70bb('0x1fd'),'foreignKey':_0x70bb('0x122'),'onDelete':'cascade'});db['UserProfileSection'][_0x70bb('0x117')](db['UserProfileResource'],{'as':_0x70bb('0x1fe'),'foreignKey':_0x70bb('0x1ff'),'onDelete':'cascade'});db[_0x70bb('0x104')][_0x70bb('0x117')](db[_0x70bb('0x7d')],{'as':_0x70bb('0x16b'),'foreignKey':_0x70bb('0x200'),'onDelete':'cascade'});db[_0x70bb('0x104')][_0x70bb('0x117')](db[_0x70bb('0x201')],{'as':_0x70bb('0x16c'),'foreignKey':_0x70bb('0x200')});db[_0x70bb('0x104')][_0x70bb('0x117')](db[_0x70bb('0x109')],{'as':_0x70bb('0x16d'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x70bb('0x117')](db[_0x70bb('0x107')],{'as':_0x70bb('0x16e')});db[_0x70bb('0x104')]['hasMany'](db['WhatsappApplication'],{'as':_0x70bb('0x148')});db[_0x70bb('0x104')][_0x70bb('0x120')](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db['WhatsappAccount'][_0x70bb('0x120')](db[_0x70bb('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x70bb('0x157')});db[_0x70bb('0x104')][_0x70bb('0x123')](db['User'],{'as':_0x70bb('0x172'),'through':_0x70bb('0x143')});db[_0x70bb('0x202')][_0x70bb('0x120')](db['User'],{'onDelete':_0x70bb('0x168')});db[_0x70bb('0x202')]['belongsTo'](db[_0x70bb('0x10c')],{'onDelete':_0x70bb('0x168')});db[_0x70bb('0x202')][_0x70bb('0x120')](db[_0x70bb('0x104')],{'onDelete':_0x70bb('0x168')});db[_0x70bb('0x202')][_0x70bb('0x120')](db[_0x70bb('0x81')],{'onDelete':'restrict','foreignKey':_0x70bb('0x180')});db['WhatsappApplication'][_0x70bb('0x120')](db[_0x70bb('0x181')],{'onDelete':'restrict','foreignKey':_0x70bb('0x182')});db['WhatsappInteraction'][_0x70bb('0x117')](db[_0x70bb('0x109')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x70bb('0x203')});db[_0x70bb('0x107')][_0x70bb('0x120')](db['WhatsappAccount'],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x200')});db['WhatsappInteraction'][_0x70bb('0x120')](db[_0x70bb('0x125')],{'as':_0x70bb('0x178'),'foreignKey':_0x70bb('0x164')});db['WhatsappInteraction'][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':_0x70bb('0x179'),'foreignKey':'UserId'});db[_0x70bb('0x107')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':'whatsapp_interaction_has_tags','as':_0x70bb('0x17b')});db[_0x70bb('0x107')][_0x70bb('0x123')](db[_0x70bb('0x181')],{'through':_0x70bb('0x1ba'),'as':_0x70bb('0x188')});db[_0x70bb('0x107')][_0x70bb('0x123')](db['User'],{'as':_0x70bb('0x17c'),'through':'user_has_whatsapp_interactions','foreignKey':_0x70bb('0x203')});db['WhatsappMessage'][_0x70bb('0x120')](db[_0x70bb('0x14')],{'as':'User'});db[_0x70bb('0x109')][_0x70bb('0x120')](db[_0x70bb('0x125')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x178')});db[_0x70bb('0x109')][_0x70bb('0x120')](db[_0x70bb('0x107')],{'onDelete':_0x70bb('0x116'),'as':_0x70bb('0x17d'),'foreignKey':_0x70bb('0x203')});db[_0x70bb('0x109')][_0x70bb('0x120')](db[_0x70bb('0x104')],{'as':_0x70bb('0x177'),'foreignKey':_0x70bb('0x200')});db[_0x70bb('0x204')][_0x70bb('0x120')](db[_0x70bb('0x104')],{});db[_0x70bb('0x204')][_0x70bb('0x120')](db[_0x70bb('0xfc')],{'as':_0x70bb('0x16f'),'foreignKey':_0x70bb('0x170')});db[_0x70bb('0x204')][_0x70bb('0x120')](db['CmContact'],{'as':_0x70bb('0x178'),'foreignKey':_0x70bb('0x164')});db[_0x70bb('0x204')]['belongsTo'](db[_0x70bb('0x107')],{});db[_0x70bb('0x204')]['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x70bb('0x109')],{});db['WhatsappQueueReport'][_0x70bb('0x120')](db[_0x70bb('0x14')],{});db[_0x70bb('0x205')][_0x70bb('0x120')](db['WhatsappMessage'],{});db[_0x70bb('0x205')][_0x70bb('0x120')](db[_0x70bb('0x107')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x70bb('0x104')],{'foreignKey':_0x70bb('0x206'),'as':_0x70bb('0x1eb')});db['WhatsappTransferReport']['belongsTo'](db[_0x70bb('0x104')],{'foreignKey':_0x70bb('0x207'),'as':_0x70bb('0x1f4')});db[_0x70bb('0x205')][_0x70bb('0x120')](db[_0x70bb('0x10c')],{'foreignKey':_0x70bb('0x208'),'as':_0x70bb('0x1f3')});db[_0x70bb('0x205')][_0x70bb('0x120')](db['User'],{'foreignKey':_0x70bb('0x1ec'),'as':_0x70bb('0x1ed')});db[_0x70bb('0x205')][_0x70bb('0x120')](db[_0x70bb('0x14')],{'foreignKey':_0x70bb('0x1ee'),'as':_0x70bb('0x1ef')});db[_0x70bb('0x10c')][_0x70bb('0x123')](db[_0x70bb('0x14')],{'as':_0x70bb('0x172'),'through':_0x70bb('0x35'),'foreignKey':_0x70bb('0x209')});db['WhatsappQueue'][_0x70bb('0x123')](db['Team'],{'through':_0x70bb('0x1e7'),'as':_0x70bb('0x175')});db[_0x70bb('0x111')][_0x70bb('0x120')](db['User'],{'as':_0x70bb('0x20a'),'foreignKey':_0x70bb('0x115'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0x70bb('0x113')](db[_0x70bb('0xc6')],{'as':_0x70bb('0xc6'),'onDelete':'restrict'});db[_0x70bb('0x166')]['hasOne'](db[_0x70bb('0x37')],{'as':_0x70bb('0x20b'),'onDelete':_0x70bb('0x168')});db['CloudProvider'][_0x70bb('0x113')](db[_0x70bb('0x169')],{'as':_0x70bb('0x16a'),'onDelete':_0x70bb('0x168')});module[_0x70bb('0x20c')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index cdc1a05..2208419 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6730=['/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./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/chat/internal/messages','/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/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','./api/user','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport'];(function(_0x73ca37,_0x2e9b07){var _0x4a1206=function(_0x533c0a){while(--_0x533c0a){_0x73ca37['push'](_0x73ca37['shift']());}};_0x4a1206(++_0x2e9b07);}(_0x6730,0x92));var _0x0673=function(_0x19d465,_0x3af538){_0x19d465=_0x19d465-0x0;var _0x1ad248=_0x6730[_0x19d465];return _0x1ad248;};'use strict';var path=require(_0x0673('0x0'));var express=require(_0x0673('0x1'));var errors=require(_0x0673('0x2'));var config=require(_0x0673('0x3'));var setupLoggers=require(_0x0673('0x4'))[_0x0673('0x5')];var clientSideLogs=require(_0x0673('0x6'));exports[_0x0673('0x7')]=function(_0x29af36){return setupLoggers(_0x29af36)[_0x0673('0x8')](function(){_0x29af36['use']('/api/users',require(_0x0673('0x9')));_0x29af36[_0x0673('0xa')](_0x0673('0xb'),require('./api/voiceChanSpy'));_0x29af36[_0x0673('0xa')](_0x0673('0xc'),require(_0x0673('0xd')));_0x29af36[_0x0673('0xa')]('/api/voice/extensions',require(_0x0673('0xe')));_0x29af36[_0x0673('0xa')]('/api/voice/mohs',require(_0x0673('0xf')));_0x29af36['use'](_0x0673('0x10'),require('./api/voiceQueue'));_0x29af36[_0x0673('0xa')](_0x0673('0x11'),require(_0x0673('0x12')));_0x29af36[_0x0673('0xa')](_0x0673('0x13'),require(_0x0673('0x14')));_0x29af36['use'](_0x0673('0x15'),require(_0x0673('0x16')));_0x29af36[_0x0673('0xa')](_0x0673('0x17'),require(_0x0673('0x18')));_0x29af36[_0x0673('0xa')](_0x0673('0x19'),require(_0x0673('0x1a')));_0x29af36['use']('/api/voice/dials/reports',require(_0x0673('0x1b')));_0x29af36[_0x0673('0xa')](_0x0673('0x1c'),require(_0x0673('0x1d')));_0x29af36[_0x0673('0xa')](_0x0673('0x1e'),require('./api/voiceQueueReport'));_0x29af36[_0x0673('0xa')](_0x0673('0x1f'),require(_0x0673('0x20')));_0x29af36[_0x0673('0xa')](_0x0673('0x21'),require(_0x0673('0x22')));_0x29af36[_0x0673('0xa')](_0x0673('0x23'),require(_0x0673('0x24')));_0x29af36[_0x0673('0xa')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x29af36['use']('/api/mail/accounts',require(_0x0673('0x25')));_0x29af36[_0x0673('0xa')](_0x0673('0x26'),require('./api/mailQueue'));_0x29af36['use']('/api/mail/substatuses',require(_0x0673('0x27')));_0x29af36[_0x0673('0xa')](_0x0673('0x28'),require(_0x0673('0x29')));_0x29af36['use'](_0x0673('0x2a'),require(_0x0673('0x2b')));_0x29af36[_0x0673('0xa')](_0x0673('0x2c'),require('./api/mailApplication'));_0x29af36['use'](_0x0673('0x2d'),require('./api/mailQueueReport'));_0x29af36['use'](_0x0673('0x2e'),require(_0x0673('0x2f')));_0x29af36[_0x0673('0xa')](_0x0673('0x30'),require(_0x0673('0x31')));_0x29af36['use']('/api/fax/accounts',require(_0x0673('0x32')));_0x29af36['use'](_0x0673('0x33'),require(_0x0673('0x34')));_0x29af36['use'](_0x0673('0x35'),require(_0x0673('0x36')));_0x29af36['use'](_0x0673('0x37'),require(_0x0673('0x38')));_0x29af36[_0x0673('0xa')](_0x0673('0x39'),require(_0x0673('0x3a')));_0x29af36['use'](_0x0673('0x3b'),require('./api/faxQueueReport'));_0x29af36[_0x0673('0xa')](_0x0673('0x3c'),require('./api/smsAccount'));_0x29af36[_0x0673('0xa')](_0x0673('0x3d'),require(_0x0673('0x3e')));_0x29af36[_0x0673('0xa')]('/api/sms/interactions',require(_0x0673('0x3f')));_0x29af36[_0x0673('0xa')](_0x0673('0x40'),require('./api/smsMessage'));_0x29af36[_0x0673('0xa')](_0x0673('0x41'),require(_0x0673('0x42')));_0x29af36[_0x0673('0xa')](_0x0673('0x43'),require('./api/openchannelAccount'));_0x29af36[_0x0673('0xa')](_0x0673('0x44'),require(_0x0673('0x45')));_0x29af36[_0x0673('0xa')](_0x0673('0x46'),require('./api/openchannelInteraction'));_0x29af36[_0x0673('0xa')](_0x0673('0x47'),require(_0x0673('0x48')));_0x29af36[_0x0673('0xa')](_0x0673('0x49'),require(_0x0673('0x4a')));_0x29af36[_0x0673('0xa')](_0x0673('0x4b'),require(_0x0673('0x4c')));_0x29af36[_0x0673('0xa')](_0x0673('0x4d'),require(_0x0673('0x4e')));_0x29af36[_0x0673('0xa')](_0x0673('0x4f'),require(_0x0673('0x50')));_0x29af36['use'](_0x0673('0x51'),require('./api/chatInteraction'));_0x29af36[_0x0673('0xa')](_0x0673('0x52'),require(_0x0673('0x53')));_0x29af36[_0x0673('0xa')](_0x0673('0x54'),require(_0x0673('0x55')));_0x29af36['use'](_0x0673('0x56'),require(_0x0673('0x57')));_0x29af36[_0x0673('0xa')](_0x0673('0x58'),require('./api/chatGroup'));_0x29af36[_0x0673('0xa')]('/api/chat/proactive_actions',require(_0x0673('0x59')));_0x29af36[_0x0673('0xa')](_0x0673('0x5a'),require(_0x0673('0x5b')));_0x29af36[_0x0673('0xa')](_0x0673('0x5c'),require(_0x0673('0x5d')));_0x29af36[_0x0673('0xa')]('/api/cm/hopper',require('./api/cmHopper'));_0x29af36['use'](_0x0673('0x5e'),require(_0x0673('0x5f')));_0x29af36[_0x0673('0xa')]('/api/cm/hopper_final',require(_0x0673('0x60')));_0x29af36['use'](_0x0673('0x61'),require('./api/cmHopperHistory'));_0x29af36['use'](_0x0673('0x62'),require(_0x0673('0x63')));_0x29af36[_0x0673('0xa')](_0x0673('0x64'),require(_0x0673('0x65')));_0x29af36[_0x0673('0xa')](_0x0673('0x66'),require('./api/automation'));_0x29af36[_0x0673('0xa')](_0x0673('0x67'),require(_0x0673('0x68')));_0x29af36['use'](_0x0673('0x69'),require(_0x0673('0x6a')));_0x29af36['use'](_0x0673('0x6b'),require(_0x0673('0x6c')));_0x29af36[_0x0673('0xa')](_0x0673('0x6d'),require(_0x0673('0x6e')));_0x29af36[_0x0673('0xa')](_0x0673('0x6f'),require(_0x0673('0x70')));_0x29af36[_0x0673('0xa')](_0x0673('0x71'),require('./api/cdr'));_0x29af36[_0x0673('0xa')](_0x0673('0x72'),require(_0x0673('0x73')));_0x29af36[_0x0673('0xa')](_0x0673('0x74'),require(_0x0673('0x75')));_0x29af36[_0x0673('0xa')](_0x0673('0x76'),require(_0x0673('0x77')));_0x29af36[_0x0673('0xa')](_0x0673('0x78'),require(_0x0673('0x79')));_0x29af36[_0x0673('0xa')](_0x0673('0x7a'),require(_0x0673('0x7b')));_0x29af36[_0x0673('0xa')](_0x0673('0x7c'),require(_0x0673('0x7d')));_0x29af36[_0x0673('0xa')]('/api/cm_hopper_additional_phones',require(_0x0673('0x7e')));_0x29af36[_0x0673('0xa')]('/api/templates',require(_0x0673('0x7f')));_0x29af36[_0x0673('0xa')](_0x0673('0x80'),require(_0x0673('0x81')));_0x29af36[_0x0673('0xa')](_0x0673('0x82'),require(_0x0673('0x83')));_0x29af36[_0x0673('0xa')](_0x0673('0x84'),require('./api/integration'));_0x29af36[_0x0673('0xa')](_0x0673('0x85'),require(_0x0673('0x86')));_0x29af36['use'](_0x0673('0x87'),require(_0x0673('0x88')));_0x29af36['use'](_0x0673('0x89'),require(_0x0673('0x8a')));_0x29af36[_0x0673('0xa')]('/api/analytics/extracted_reports',require(_0x0673('0x8b')));_0x29af36['use'](_0x0673('0x8c'),require('./api/analyticMetric'));_0x29af36[_0x0673('0xa')](_0x0673('0x8d'),require(_0x0673('0x8e')));_0x29af36[_0x0673('0xa')](_0x0673('0x8f'),require(_0x0673('0x90')));_0x29af36['use'](_0x0673('0x91'),require(_0x0673('0x92')));_0x29af36[_0x0673('0xa')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x29af36['use'](_0x0673('0x93'),require(_0x0673('0x94')));_0x29af36[_0x0673('0xa')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x29af36[_0x0673('0xa')](_0x0673('0x95'),require('./api/intSugarcrmConfiguration'));_0x29af36[_0x0673('0xa')]('/api/integrations/sugarcrm/fields',require(_0x0673('0x96')));_0x29af36['use'](_0x0673('0x97'),require(_0x0673('0x98')));_0x29af36['use'](_0x0673('0x99'),require(_0x0673('0x9a')));_0x29af36[_0x0673('0xa')]('/api/integrations/desk/fields',require(_0x0673('0x9b')));_0x29af36[_0x0673('0xa')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x29af36[_0x0673('0xa')](_0x0673('0x9c'),require(_0x0673('0x9d')));_0x29af36[_0x0673('0xa')](_0x0673('0x9e'),require(_0x0673('0x9f')));_0x29af36[_0x0673('0xa')](_0x0673('0xa0'),require('./api/intZendeskAccount'));_0x29af36[_0x0673('0xa')](_0x0673('0xa1'),require('./api/intZendeskConfiguration'));_0x29af36[_0x0673('0xa')](_0x0673('0xa2'),require(_0x0673('0xa3')));_0x29af36[_0x0673('0xa')](_0x0673('0xa4'),require('./api/intFreshdeskAccount'));_0x29af36[_0x0673('0xa')](_0x0673('0xa5'),require(_0x0673('0xa6')));_0x29af36[_0x0673('0xa')](_0x0673('0xa7'),require('./api/intFreshdeskField'));_0x29af36[_0x0673('0xa')](_0x0673('0xa8'),require(_0x0673('0xa9')));_0x29af36[_0x0673('0xa')](_0x0673('0xaa'),require(_0x0673('0xab')));_0x29af36[_0x0673('0xa')](_0x0673('0xac'),require(_0x0673('0xad')));_0x29af36[_0x0673('0xa')](_0x0673('0xae'),require('./api/intServicenowAccount'));_0x29af36[_0x0673('0xa')](_0x0673('0xaf'),require(_0x0673('0xb0')));_0x29af36['use'](_0x0673('0xb1'),require(_0x0673('0xb2')));_0x29af36[_0x0673('0xa')](_0x0673('0xb3'),require(_0x0673('0xb4')));_0x29af36[_0x0673('0xa')]('/api/integrations/dynamics365/configurations',require(_0x0673('0xb5')));_0x29af36[_0x0673('0xa')]('/api/integrations/dynamics365/fields',require(_0x0673('0xb6')));_0x29af36[_0x0673('0xa')](_0x0673('0xb7'),require('./api/intFreshsalesAccount'));_0x29af36[_0x0673('0xa')]('/api/integrations/freshsales/configurations',require(_0x0673('0xb8')));_0x29af36['use'](_0x0673('0xb9'),require(_0x0673('0xba')));_0x29af36[_0x0673('0xa')](_0x0673('0xbb'),require(_0x0673('0xbc')));_0x29af36[_0x0673('0xa')](_0x0673('0xbd'),require(_0x0673('0xbe')));_0x29af36[_0x0673('0xa')](_0x0673('0xbf'),require('./api/chatInternalMessage'));_0x29af36[_0x0673('0xa')](_0x0673('0xc0'),require(_0x0673('0xc1')));_0x29af36[_0x0673('0xa')](_0x0673('0xc2'),require(_0x0673('0xc3')));_0x29af36[_0x0673('0xa')](_0x0673('0xc4'),require(_0x0673('0xc5')));_0x29af36[_0x0673('0xa')](_0x0673('0xc6'),require(_0x0673('0xc7')));_0x29af36[_0x0673('0xa')](_0x0673('0xc8'),require('./api/squareReport'));_0x29af36[_0x0673('0xa')]('/api/square/details/reports',require(_0x0673('0xc9')));_0x29af36['use'](_0x0673('0xca'),require('./api/jscriptyProject'));_0x29af36[_0x0673('0xa')](_0x0673('0xcb'),require(_0x0673('0xcc')));_0x29af36[_0x0673('0xa')](_0x0673('0xcd'),require('./api/squareOdbc'));_0x29af36[_0x0673('0xa')](_0x0673('0xce'),require(_0x0673('0xcf')));_0x29af36[_0x0673('0xa')](_0x0673('0xd0'),require(_0x0673('0xd1')));_0x29af36[_0x0673('0xa')]('/api/square/messages',require(_0x0673('0xd2')));_0x29af36['use']('/api/teams',require(_0x0673('0xd3')));_0x29af36['use'](_0x0673('0xd4'),require('./api/license'));_0x29af36[_0x0673('0xa')](_0x0673('0xd5'),require(_0x0673('0xd6')));_0x29af36['use'](_0x0673('0xd7'),require(_0x0673('0xd8')));_0x29af36[_0x0673('0xa')]('/api/attachments',require('./api/attachment'));_0x29af36[_0x0673('0xa')]('/api/plugins',require(_0x0673('0xd9')));_0x29af36['use'](_0x0673('0xda'),require(_0x0673('0xdb')));_0x29af36[_0x0673('0xa')]('/api/chat/reports/transfer',require(_0x0673('0xdc')));_0x29af36['use'](_0x0673('0xdd'),require(_0x0673('0xde')));_0x29af36[_0x0673('0xa')]('/api/openchannel/reports/transfer',require(_0x0673('0xdf')));_0x29af36[_0x0673('0xa')](_0x0673('0xe0'),require(_0x0673('0xe1')));_0x29af36['use'](_0x0673('0xe2'),require(_0x0673('0xe3')));_0x29af36[_0x0673('0xa')](_0x0673('0xe4'),require(_0x0673('0xe5')));_0x29af36['use'](_0x0673('0xe6'),require(_0x0673('0xe7')));_0x29af36[_0x0673('0xa')]('/api/userProfile/sections',require(_0x0673('0xe8')));_0x29af36[_0x0673('0xa')](_0x0673('0xe9'),require(_0x0673('0xea')));_0x29af36[_0x0673('0xa')](_0x0673('0xeb'),require('./api/userNotification'));_0x29af36[_0x0673('0xa')](_0x0673('0xec'),require(_0x0673('0xed')));_0x29af36[_0x0673('0xa')](_0x0673('0xee'),require(_0x0673('0xef')));_0x29af36[_0x0673('0xa')](_0x0673('0xf0'),require(_0x0673('0xf1')));_0x29af36[_0x0673('0xa')](_0x0673('0xf2'),require(_0x0673('0xf3')));_0x29af36[_0x0673('0xa')](_0x0673('0xf4'),require(_0x0673('0xf5')));_0x29af36[_0x0673('0xa')]('/api/whatsapp/reports/transfer',require(_0x0673('0xf6')));_0x29af36[_0x0673('0xa')](_0x0673('0xf7'),require('./api/whatsappQueue'));_0x29af36[_0x0673('0xa')](_0x0673('0xf8'),require(_0x0673('0xf9')));_0x29af36[_0x0673('0xa')](_0x0673('0xfa'),require('./api/realtime'));_0x29af36['use'](_0x0673('0xfb'),require(_0x0673('0xfc')));_0x29af36[_0x0673('0xa')]('/api/auth/local',require(_0x0673('0xfd')));_0x29af36['use'](_0x0673('0xfe'),require('./api/authGoogle'));_0x29af36[_0x0673('0xa')](_0x0673('0xff'),require(_0x0673('0x100')));_0x29af36[_0x0673('0xa')]('/api/jira',require(_0x0673('0x101')));_0x29af36['use'](_0x0673('0x102'),require(_0x0673('0x103')));_0x29af36['use'](_0x0673('0x104'),require(_0x0673('0x105')));_0x29af36[_0x0673('0xa')]('/api/system',require('./api/system'));_0x29af36[_0x0673('0xa')]('/api/pm2',require('./api/pm2'));_0x29af36[_0x0673('0xa')](_0x0673('0x106'),require(_0x0673('0x107')));_0x29af36[_0x0673('0xa')](_0x0673('0x108'),clientSideLogs);_0x29af36[_0x0673('0xa')](_0x0673('0x109'),express[_0x0673('0x10a')](path[_0x0673('0x10b')](config[_0x0673('0x10c')],_0x0673('0x109'))));_0x29af36['use'](_0x0673('0x10d'),express[_0x0673('0x10a')](path['join'](config[_0x0673('0x10c')],_0x0673('0x10d'))));_0x29af36[_0x0673('0xa')](_0x0673('0x10e'),express[_0x0673('0x10a')](path[_0x0673('0x10b')](config[_0x0673('0x10c')],_0x0673('0x10e'))));_0x29af36[_0x0673('0xa')](_0x0673('0x10f'),express[_0x0673('0x10a')](path[_0x0673('0x10b')](config[_0x0673('0x10c')],_0x0673('0x110'),_0x0673('0x111'))));_0x29af36[_0x0673('0xa')]('/plugins',express['static'](path[_0x0673('0x10b')](config[_0x0673('0x10c')],_0x0673('0x112'))));_0x29af36['route'](_0x0673('0x113'))['get'](errors[0x194]);_0x29af36[_0x0673('0x114')]('/*')[_0x0673('0x115')](function(_0xaccdf6,_0x28ca3f){_0x28ca3f[_0x0673('0x116')](path[_0x0673('0x117')](_0x29af36['get']('appPath')+_0x0673('0x118')));});return _0x29af36;});}; \ No newline at end of file +var _0x7916=['./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','./api/cannedAnswer','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/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/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./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/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','then','use','/api/users','./api/user','/api/voice/chanspy'];(function(_0x4bc4ab,_0x2c1bad){var _0x368014=function(_0x179c12){while(--_0x179c12){_0x4bc4ab['push'](_0x4bc4ab['shift']());}};_0x368014(++_0x2c1bad);}(_0x7916,0x102));var _0x6791=function(_0x32de8c,_0x2bfb6d){_0x32de8c=_0x32de8c-0x0;var _0x3f8c0d=_0x7916[_0x32de8c];return _0x3f8c0d;};'use strict';var path=require(_0x6791('0x0'));var express=require(_0x6791('0x1'));var errors=require(_0x6791('0x2'));var config=require(_0x6791('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x3b8050){return setupLoggers(_0x3b8050)[_0x6791('0x4')](function(){_0x3b8050[_0x6791('0x5')](_0x6791('0x6'),require(_0x6791('0x7')));_0x3b8050[_0x6791('0x5')](_0x6791('0x8'),require(_0x6791('0x9')));_0x3b8050[_0x6791('0x5')](_0x6791('0xa'),require('./api/voiceContext'));_0x3b8050[_0x6791('0x5')]('/api/voice/extensions',require(_0x6791('0xb')));_0x3b8050[_0x6791('0x5')]('/api/voice/mohs',require(_0x6791('0xc')));_0x3b8050['use'](_0x6791('0xd'),require(_0x6791('0xe')));_0x3b8050[_0x6791('0x5')](_0x6791('0xf'),require(_0x6791('0x10')));_0x3b8050[_0x6791('0x5')]('/api/screen/recordings',require('./api/screenRecording'));_0x3b8050[_0x6791('0x5')](_0x6791('0x11'),require(_0x6791('0x12')));_0x3b8050[_0x6791('0x5')](_0x6791('0x13'),require('./api/voiceMailMessage'));_0x3b8050[_0x6791('0x5')](_0x6791('0x14'),require(_0x6791('0x15')));_0x3b8050[_0x6791('0x5')](_0x6791('0x16'),require(_0x6791('0x17')));_0x3b8050['use'](_0x6791('0x18'),require(_0x6791('0x19')));_0x3b8050[_0x6791('0x5')]('/api/voice/queues/reports',require(_0x6791('0x1a')));_0x3b8050[_0x6791('0x5')](_0x6791('0x1b'),require(_0x6791('0x1c')));_0x3b8050[_0x6791('0x5')](_0x6791('0x1d'),require(_0x6791('0x1e')));_0x3b8050[_0x6791('0x5')](_0x6791('0x1f'),require(_0x6791('0x20')));_0x3b8050[_0x6791('0x5')](_0x6791('0x21'),require(_0x6791('0x22')));_0x3b8050['use'](_0x6791('0x23'),require(_0x6791('0x24')));_0x3b8050[_0x6791('0x5')]('/api/mail/queues',require('./api/mailQueue'));_0x3b8050['use'](_0x6791('0x25'),require(_0x6791('0x26')));_0x3b8050['use'](_0x6791('0x27'),require(_0x6791('0x28')));_0x3b8050['use'](_0x6791('0x29'),require(_0x6791('0x2a')));_0x3b8050[_0x6791('0x5')](_0x6791('0x2b'),require(_0x6791('0x2c')));_0x3b8050[_0x6791('0x5')]('/api/mail/reports/queue',require(_0x6791('0x2d')));_0x3b8050['use'](_0x6791('0x2e'),require('./api/dashboard'));_0x3b8050['use']('/api/dashboards/items',require(_0x6791('0x2f')));_0x3b8050[_0x6791('0x5')](_0x6791('0x30'),require(_0x6791('0x31')));_0x3b8050['use'](_0x6791('0x32'),require(_0x6791('0x33')));_0x3b8050[_0x6791('0x5')]('/api/fax/interactions',require(_0x6791('0x34')));_0x3b8050['use']('/api/fax/messages',require(_0x6791('0x35')));_0x3b8050[_0x6791('0x5')]('/api/fax/queues',require(_0x6791('0x36')));_0x3b8050[_0x6791('0x5')](_0x6791('0x37'),require(_0x6791('0x38')));_0x3b8050[_0x6791('0x5')](_0x6791('0x39'),require(_0x6791('0x3a')));_0x3b8050[_0x6791('0x5')](_0x6791('0x3b'),require(_0x6791('0x3c')));_0x3b8050[_0x6791('0x5')](_0x6791('0x3d'),require('./api/smsInteraction'));_0x3b8050['use'](_0x6791('0x3e'),require('./api/smsMessage'));_0x3b8050[_0x6791('0x5')](_0x6791('0x3f'),require(_0x6791('0x40')));_0x3b8050[_0x6791('0x5')]('/api/openchannel/accounts',require(_0x6791('0x41')));_0x3b8050[_0x6791('0x5')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x3b8050[_0x6791('0x5')](_0x6791('0x42'),require(_0x6791('0x43')));_0x3b8050['use'](_0x6791('0x44'),require(_0x6791('0x45')));_0x3b8050[_0x6791('0x5')](_0x6791('0x46'),require(_0x6791('0x47')));_0x3b8050[_0x6791('0x5')](_0x6791('0x48'),require(_0x6791('0x49')));_0x3b8050[_0x6791('0x5')](_0x6791('0x4a'),require(_0x6791('0x4b')));_0x3b8050[_0x6791('0x5')]('/api/chat/applications',require('./api/chatApplication'));_0x3b8050[_0x6791('0x5')](_0x6791('0x4c'),require(_0x6791('0x4d')));_0x3b8050[_0x6791('0x5')]('/api/chat/messages',require(_0x6791('0x4e')));_0x3b8050['use']('/api/chat/offline_messages',require(_0x6791('0x4f')));_0x3b8050[_0x6791('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0x3b8050[_0x6791('0x5')](_0x6791('0x50'),require(_0x6791('0x51')));_0x3b8050['use']('/api/chat/proactive_actions',require(_0x6791('0x52')));_0x3b8050[_0x6791('0x5')](_0x6791('0x53'),require(_0x6791('0x54')));_0x3b8050[_0x6791('0x5')]('/api/cm/contacts',require('./api/cmContact'));_0x3b8050[_0x6791('0x5')](_0x6791('0x55'),require(_0x6791('0x56')));_0x3b8050[_0x6791('0x5')](_0x6791('0x57'),require(_0x6791('0x58')));_0x3b8050[_0x6791('0x5')](_0x6791('0x59'),require('./api/cmHopperFinal'));_0x3b8050[_0x6791('0x5')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x3b8050['use'](_0x6791('0x5a'),require(_0x6791('0x5b')));_0x3b8050[_0x6791('0x5')](_0x6791('0x5c'),require('./api/action'));_0x3b8050[_0x6791('0x5')]('/api/automations',require(_0x6791('0x5d')));_0x3b8050[_0x6791('0x5')]('/api/canned_answers',require(_0x6791('0x5e')));_0x3b8050[_0x6791('0x5')]('/api/dispositions',require(_0x6791('0x5f')));_0x3b8050['use']('/api/conditions',require(_0x6791('0x60')));_0x3b8050[_0x6791('0x5')]('/api/intervals',require(_0x6791('0x61')));_0x3b8050[_0x6791('0x5')](_0x6791('0x62'),require(_0x6791('0x63')));_0x3b8050[_0x6791('0x5')]('/api/cdr',require(_0x6791('0x64')));_0x3b8050[_0x6791('0x5')](_0x6791('0x65'),require(_0x6791('0x66')));_0x3b8050[_0x6791('0x5')](_0x6791('0x67'),require(_0x6791('0x68')));_0x3b8050[_0x6791('0x5')](_0x6791('0x69'),require('./api/sound'));_0x3b8050[_0x6791('0x5')](_0x6791('0x6a'),require('./api/tag'));_0x3b8050[_0x6791('0x5')](_0x6791('0x6b'),require('./api/contactItemType'));_0x3b8050[_0x6791('0x5')](_0x6791('0x6c'),require(_0x6791('0x6d')));_0x3b8050[_0x6791('0x5')](_0x6791('0x6e'),require('./api/cmHopperAdditionalPhone'));_0x3b8050['use']('/api/templates',require(_0x6791('0x6f')));_0x3b8050[_0x6791('0x5')](_0x6791('0x70'),require(_0x6791('0x71')));_0x3b8050['use'](_0x6791('0x72'),require(_0x6791('0x73')));_0x3b8050[_0x6791('0x5')](_0x6791('0x74'),require(_0x6791('0x75')));_0x3b8050[_0x6791('0x5')](_0x6791('0x76'),require(_0x6791('0x77')));_0x3b8050['use'](_0x6791('0x78'),require(_0x6791('0x79')));_0x3b8050[_0x6791('0x5')](_0x6791('0x7a'),require(_0x6791('0x7b')));_0x3b8050[_0x6791('0x5')](_0x6791('0x7c'),require(_0x6791('0x7d')));_0x3b8050[_0x6791('0x5')](_0x6791('0x7e'),require(_0x6791('0x7f')));_0x3b8050[_0x6791('0x5')](_0x6791('0x80'),require(_0x6791('0x81')));_0x3b8050[_0x6791('0x5')]('/api/analytics/tree_reports',require(_0x6791('0x82')));_0x3b8050[_0x6791('0x5')]('/api/integrations/salesforce/accounts',require(_0x6791('0x83')));_0x3b8050[_0x6791('0x5')](_0x6791('0x84'),require('./api/intSalesforceConfiguration'));_0x3b8050[_0x6791('0x5')](_0x6791('0x85'),require(_0x6791('0x86')));_0x3b8050[_0x6791('0x5')](_0x6791('0x87'),require(_0x6791('0x88')));_0x3b8050['use'](_0x6791('0x89'),require(_0x6791('0x8a')));_0x3b8050['use'](_0x6791('0x8b'),require(_0x6791('0x8c')));_0x3b8050['use'](_0x6791('0x8d'),require('./api/intDeskAccount'));_0x3b8050[_0x6791('0x5')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3b8050[_0x6791('0x5')]('/api/integrations/desk/fields',require(_0x6791('0x8e')));_0x3b8050[_0x6791('0x5')](_0x6791('0x8f'),require(_0x6791('0x90')));_0x3b8050[_0x6791('0x5')]('/api/integrations/zoho/configurations',require(_0x6791('0x91')));_0x3b8050['use']('/api/integrations/zoho/fields',require(_0x6791('0x92')));_0x3b8050[_0x6791('0x5')](_0x6791('0x93'),require('./api/intZendeskAccount'));_0x3b8050[_0x6791('0x5')](_0x6791('0x94'),require(_0x6791('0x95')));_0x3b8050[_0x6791('0x5')](_0x6791('0x96'),require(_0x6791('0x97')));_0x3b8050[_0x6791('0x5')](_0x6791('0x98'),require(_0x6791('0x99')));_0x3b8050[_0x6791('0x5')](_0x6791('0x9a'),require(_0x6791('0x9b')));_0x3b8050[_0x6791('0x5')](_0x6791('0x9c'),require(_0x6791('0x9d')));_0x3b8050['use'](_0x6791('0x9e'),require('./api/intVtigerAccount'));_0x3b8050['use']('/api/integrations/vtiger/configurations',require(_0x6791('0x9f')));_0x3b8050['use'](_0x6791('0xa0'),require(_0x6791('0xa1')));_0x3b8050[_0x6791('0x5')](_0x6791('0xa2'),require(_0x6791('0xa3')));_0x3b8050['use'](_0x6791('0xa4'),require(_0x6791('0xa5')));_0x3b8050['use']('/api/integrations/servicenow/fields',require(_0x6791('0xa6')));_0x3b8050[_0x6791('0x5')]('/api/integrations/dynamics365/accounts',require(_0x6791('0xa7')));_0x3b8050[_0x6791('0x5')](_0x6791('0xa8'),require('./api/intDynamics365Configuration'));_0x3b8050[_0x6791('0x5')](_0x6791('0xa9'),require(_0x6791('0xaa')));_0x3b8050[_0x6791('0x5')](_0x6791('0xab'),require(_0x6791('0xac')));_0x3b8050[_0x6791('0x5')](_0x6791('0xad'),require(_0x6791('0xae')));_0x3b8050[_0x6791('0x5')]('/api/integrations/freshsales/fields',require(_0x6791('0xaf')));_0x3b8050['use']('/api/networks',require('./api/network'));_0x3b8050[_0x6791('0x5')]('/api/chat/reports/queue',require(_0x6791('0xb0')));_0x3b8050[_0x6791('0x5')](_0x6791('0xb1'),require('./api/chatInternalMessage'));_0x3b8050[_0x6791('0x5')]('/api/jscripty/answers/reports',require(_0x6791('0xb2')));_0x3b8050[_0x6791('0x5')]('/api/jscripty/questions/reports',require(_0x6791('0xb3')));_0x3b8050[_0x6791('0x5')]('/api/jscripty/sessions/reports',require(_0x6791('0xb4')));_0x3b8050[_0x6791('0x5')](_0x6791('0xb5'),require(_0x6791('0xb6')));_0x3b8050[_0x6791('0x5')](_0x6791('0xb7'),require(_0x6791('0xb8')));_0x3b8050['use'](_0x6791('0xb9'),require(_0x6791('0xba')));_0x3b8050[_0x6791('0x5')]('/api/jscripty/projects',require(_0x6791('0xbb')));_0x3b8050[_0x6791('0x5')](_0x6791('0xbc'),require('./api/setting'));_0x3b8050[_0x6791('0x5')](_0x6791('0xbd'),require(_0x6791('0xbe')));_0x3b8050[_0x6791('0x5')]('/api/square/projects',require(_0x6791('0xbf')));_0x3b8050[_0x6791('0x5')](_0x6791('0xc0'),require(_0x6791('0xc1')));_0x3b8050[_0x6791('0x5')](_0x6791('0xc2'),require(_0x6791('0xc3')));_0x3b8050[_0x6791('0x5')](_0x6791('0xc4'),require(_0x6791('0xc5')));_0x3b8050['use'](_0x6791('0xc6'),require(_0x6791('0xc7')));_0x3b8050[_0x6791('0x5')]('/api/campaigns',require('./api/campaign'));_0x3b8050[_0x6791('0x5')](_0x6791('0xc8'),require(_0x6791('0xc9')));_0x3b8050[_0x6791('0x5')]('/api/attachments',require(_0x6791('0xca')));_0x3b8050['use'](_0x6791('0xcb'),require(_0x6791('0xcc')));_0x3b8050['use'](_0x6791('0xcd'),require(_0x6791('0xce')));_0x3b8050[_0x6791('0x5')](_0x6791('0xcf'),require('./api/chatTransferReport'));_0x3b8050[_0x6791('0x5')](_0x6791('0xd0'),require('./api/faxTransferReport'));_0x3b8050[_0x6791('0x5')](_0x6791('0xd1'),require(_0x6791('0xd2')));_0x3b8050[_0x6791('0x5')](_0x6791('0xd3'),require(_0x6791('0xd4')));_0x3b8050[_0x6791('0x5')](_0x6791('0xd5'),require(_0x6791('0xd6')));_0x3b8050[_0x6791('0x5')]('/api/voice/prefixes',require(_0x6791('0xd7')));_0x3b8050[_0x6791('0x5')](_0x6791('0xd8'),require(_0x6791('0xd9')));_0x3b8050[_0x6791('0x5')]('/api/userProfile/sections',require(_0x6791('0xda')));_0x3b8050[_0x6791('0x5')](_0x6791('0xdb'),require(_0x6791('0xdc')));_0x3b8050[_0x6791('0x5')](_0x6791('0xdd'),require(_0x6791('0xde')));_0x3b8050[_0x6791('0x5')](_0x6791('0xdf'),require('./api/whatsappAccount'));_0x3b8050[_0x6791('0x5')]('/api/whatsapp/applications',require(_0x6791('0xe0')));_0x3b8050[_0x6791('0x5')](_0x6791('0xe1'),require(_0x6791('0xe2')));_0x3b8050[_0x6791('0x5')](_0x6791('0xe3'),require(_0x6791('0xe4')));_0x3b8050[_0x6791('0x5')](_0x6791('0xe5'),require('./api/whatsappQueueReport'));_0x3b8050[_0x6791('0x5')](_0x6791('0xe6'),require(_0x6791('0xe7')));_0x3b8050[_0x6791('0x5')](_0x6791('0xe8'),require('./api/whatsappQueue'));_0x3b8050[_0x6791('0x5')](_0x6791('0xe9'),require(_0x6791('0xea')));_0x3b8050[_0x6791('0x5')](_0x6791('0xeb'),require(_0x6791('0xec')));_0x3b8050[_0x6791('0x5')]('/api/user-settings',require(_0x6791('0xed')));_0x3b8050[_0x6791('0x5')](_0x6791('0xee'),require(_0x6791('0xef')));_0x3b8050[_0x6791('0x5')]('/api/auth/google',require(_0x6791('0xf0')));_0x3b8050[_0x6791('0x5')](_0x6791('0xf1'),require('./api/authActiveDirectory'));_0x3b8050[_0x6791('0x5')](_0x6791('0xf2'),require(_0x6791('0xf3')));_0x3b8050[_0x6791('0x5')](_0x6791('0xf4'),require(_0x6791('0xf5')));_0x3b8050[_0x6791('0x5')](_0x6791('0xf6'),require(_0x6791('0xf7')));_0x3b8050[_0x6791('0x5')]('/api/system',require('./api/system'));_0x3b8050[_0x6791('0x5')](_0x6791('0xf8'),require(_0x6791('0xf9')));_0x3b8050[_0x6791('0x5')](_0x6791('0xfa'),require(_0x6791('0xfb')));_0x3b8050[_0x6791('0x5')]('/api/logs',clientSideLogs);_0x3b8050[_0x6791('0x5')](_0x6791('0xfc'),express[_0x6791('0xfd')](path[_0x6791('0xfe')](config[_0x6791('0xff')],'/apidoc')));_0x3b8050[_0x6791('0x5')](_0x6791('0x100'),express[_0x6791('0xfd')](path[_0x6791('0xfe')](config['root'],_0x6791('0x100'))));_0x3b8050['use']('/demo',express[_0x6791('0xfd')](path[_0x6791('0xfe')](config[_0x6791('0xff')],'/demo')));_0x3b8050['use'](_0x6791('0x101'),express[_0x6791('0xfd')](path[_0x6791('0xfe')](config[_0x6791('0xff')],'snippet',_0x6791('0x102'))));_0x3b8050[_0x6791('0x5')](_0x6791('0x103'),express[_0x6791('0xfd')](path[_0x6791('0xfe')](config[_0x6791('0xff')],_0x6791('0x104'))));_0x3b8050[_0x6791('0x105')](_0x6791('0x106'))[_0x6791('0x107')](errors[0x194]);_0x3b8050[_0x6791('0x105')]('/*')[_0x6791('0x107')](function(_0x14d530,_0x36d87f){_0x36d87f[_0x6791('0x108')](path[_0x6791('0x109')](_0x3b8050['get']('appPath')+_0x6791('0x10a')));});return _0x3b8050;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 265d750..7ea481e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea1c=['server','http','rpc','port','localhost','error','log','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0xea1c,0xdb));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xcea1('0x0'));var _=require('lodash');var config=require(_0xcea1('0x1'));exports[_0xcea1('0x2')]=function(){return new Promise(function(_0x361169,_0xd3b539){var _0x398c88={};_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x4')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x5')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x6')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x7')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x8')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x9')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0xa')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0xb')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0xc')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0xd')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0xe')));_0x398c88=_['merge'](_0x398c88,require('../api/mailAccount/mailAccount.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0xf')));_0x398c88=_['merge'](_0x398c88,require('../api/mailInteraction/mailInteraction.rpc'));_0x398c88=_['merge'](_0x398c88,require('../api/mailMessage/mailMessage.rpc'));_0x398c88=_['merge'](_0x398c88,require('../api/mailApplication/mailApplication.rpc'));_0x398c88=_['merge'](_0x398c88,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x10')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x11')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x12')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x13')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x14')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x15')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x16')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x17')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x18')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x19')));_0x398c88=_['merge'](_0x398c88,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x1a')));_0x398c88=_['merge'](_0x398c88,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x1b')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x1c')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x1d')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/chatMessage/chatMessage.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x1e')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x1f')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/cmHopper/cmHopper.rpc'));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x20')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x21')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x22')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x23')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x24')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x25')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x26')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x27')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x28')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/trigger/trigger.rpc'));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x29')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x2a')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x2b')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x398c88=_['merge'](_0x398c88,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x2c')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x2d')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x2e')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x2f')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x30')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x31')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x32')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x33')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x34')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x35')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/squareProject/squareProject.rpc'));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x36')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x37')));_0x398c88=_['merge'](_0x398c88,require(_0xcea1('0x38')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x39')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x3a')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x3b')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require(_0xcea1('0x3c')));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x398c88=_[_0xcea1('0x3')](_0x398c88,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3d6469=jayson[_0xcea1('0x3d')](_0x398c88)[_0xcea1('0x3e')]();var _0x10f083=config[_0xcea1('0x3f')][_0xcea1('0x40')]||config[_0xcea1('0x40')]+0x1;var _0xafe690=config[_0xcea1('0x3f')]['ip']||_0xcea1('0x41');_0x3d6469['on'](_0xcea1('0x42'),function(_0x3016b1){return _0xd3b539(_0x3016b1);});_0x3d6469['listen'](_0x10f083,_0xafe690,function(){console[_0xcea1('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0xafe690,_0x10f083);require('../config/triggers')[_0xcea1('0x44')]();return _0x361169(_0xcea1('0x45')+_0xafe690+':'+_0x10f083);});});}; \ No newline at end of file +var _0x61bb=['RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','log','../config/triggers','default'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x61bb,0x1b1));var _0xb61b=function(_0x8afc7,_0x2224db){_0x8afc7=_0x8afc7-0x0;var _0x1edce9=_0x61bb[_0x8afc7];return _0x1edce9;};'use strict';var jayson=require(_0xb61b('0x0'));var _=require(_0xb61b('0x1'));var config=require('../config/environment');exports[_0xb61b('0x2')]=function(){return new Promise(function(_0x5916d0,_0x574bb9){var _0x480795={};_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/user/user.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x4')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x5')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x6')));_0x480795=_['merge'](_0x480795,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x7')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x8')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x9')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0xa')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0xb')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0xc')));_0x480795=_['merge'](_0x480795,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0xd')));_0x480795=_['merge'](_0x480795,require('../api/mailAccount/mailAccount.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/mailQueue/mailQueue.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0xe')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0xf')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x10')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x11')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x12')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x13')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x14')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/faxMessage/faxMessage.rpc'));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x15')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x16')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x17')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/smsInteraction/smsInteraction.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x18')));_0x480795=_['merge'](_0x480795,require('../api/smsQueue/smsQueue.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x19')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x1a')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x1b')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x1c')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/chatMessage/chatMessage.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x1d')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x1e')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x1f')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x20')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x21')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x22')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x23')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x24')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x25')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x26')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x27')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x28')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x29')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/variable/variable.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x2a')));_0x480795=_['merge'](_0x480795,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x2b')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x2c')));_0x480795=_['merge'](_0x480795,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x2d')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x2e')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x2f')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x30')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x31')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x32')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x33')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x34')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x35')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x36')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/squareProject/squareProject.rpc'));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x37')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x38')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x39')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x3a')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x3b')));_0x480795=_['merge'](_0x480795,require(_0xb61b('0x3c')));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x3d')));_0x480795=_[_0xb61b('0x3')](_0x480795,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x480795=_[_0xb61b('0x3')](_0x480795,require(_0xb61b('0x3e')));_0x480795=_['merge'](_0x480795,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x115465=jayson['server'](_0x480795)[_0xb61b('0x3f')]();var _0x50eb77=config[_0xb61b('0x40')][_0xb61b('0x41')]||config[_0xb61b('0x41')]+0x1;var _0x3708a9=config[_0xb61b('0x40')]['ip']||_0xb61b('0x42');_0x115465['on'](_0xb61b('0x43'),function(_0x28d473){return _0x574bb9(_0x28d473);});_0x115465[_0xb61b('0x2')](_0x50eb77,_0x3708a9,function(){console[_0xb61b('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3708a9,_0x50eb77);require(_0xb61b('0x45'))[_0xb61b('0x46')]();return _0x5916d0(_0xb61b('0x47')+_0x3708a9+':'+_0x50eb77);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d11a893..d827c28 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 _0x1174=['extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt'];(function(_0x18ab9b,_0x5de071){var _0x15087=function(_0x4931d9){while(--_0x4931d9){_0x18ab9b['push'](_0x18ab9b['shift']());}};_0x15087(++_0x5de071);}(_0x1174,0x146));var _0x4117=function(_0x2eecc5,_0x30defb){_0x2eecc5=_0x2eecc5-0x0;var _0x18915e=_0x1174[_0x2eecc5];return _0x18915e;};'use strict';var util=require(_0x4117('0x0'));var _=require(_0x4117('0x1'));var EventEmitter=require(_0x4117('0x2'))[_0x4117('0x3')];var AGIReply=require(_0x4117('0x4'));var AGIError=require(_0x4117('0x5'));function AGIChannel(_0x522968){var _0x3e8119=this,_0x2004f9=new AGIReply(),_0x2c4aca=![],_0x1520b1={};EventEmitter[_0x4117('0x6')](_0x3e8119);_0x522968[_0x4117('0x7')](_0x4117('0x8'));_0x522968['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2004f9[_0x4117('0x7')](_0x4117('0x8'));_0x2004f9['on'](_0x4117('0x9'),function(_0x59989a){for(var _0x35f443 in _0x59989a){_0x3e8119[_0x35f443]=_0x59989a[_0x35f443];}_0x3e8119[_0x4117('0xa')](_0x4117('0xb'));});_0x2004f9['on']('line',function(_0x239142){if(_0x239142[_0x4117('0xc')]()=='hangup'){_0x3e8119['emit'](_0x4117('0xd'));return;}if(_0x239142[_0x4117('0xe')](0x0,0xb)==_0x4117('0xf')){_0x2c4aca=!![];}if(_0x2c4aca){_0x1520b1['rx']+=_0x239142+'\x0a';if(_0x239142['search'](_0x4117('0x10'))!=-0x1){_0x2c4aca=![];}}else{_0x1520b1['rx']=_0x239142;}if(_0x2c4aca){return;}if(typeof _0x1520b1['cb']==_0x4117('0x11')){var _0x4eeea6=_0x1520b1['rx'][_0x4117('0xe')](0x0,0x3),_0x473077=null,_0x31f8f5=null;_0x4eeea6=parseInt(_0x4eeea6);if(isNaN(_0x4eeea6)){_0x1520b1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4117('0x12')});return;}if(_0x4eeea6!=0xc8){_0x1520b1['cb'](null,{'code':_0x4eeea6,'result':-0x1,'extra':'KO'});return;}_0x473077=_0x1520b1['rx'][_0x4117('0xe')](0x4)[_0x4117('0x13')]('result=','');if(_0x473077[_0x4117('0x14')]('\x20')!=-0x1){_0x473077=_0x473077[_0x4117('0x15')](0x0,_0x473077[_0x4117('0x14')]('\x20'));}if(_[_0x4117('0x16')](_0x473077,'-1')){_0x473077=parseInt(_0x473077);}_0x31f8f5=_0x1520b1['rx']['split']('\x20');if(_0x31f8f5[_0x4117('0x17')]==0x3){_0x31f8f5=_0x31f8f5[0x2][_0x4117('0xe')](0x1,_0x31f8f5[0x2]['length']-0x1);}else if(_0x31f8f5['length']>0x3){var _0x5bdbfb=/\((.+)\)/;var _0x44f136=_0x1520b1['rx']['match'](_0x5bdbfb);if(_0x44f136){_0x31f8f5=_0x44f136[0x1];}else{_0x31f8f5=null;}}else{_0x31f8f5=null;}_0x1520b1['cb'](null,{'code':_0x4eeea6,'result':_0x473077,'extra':_0x31f8f5});}});_0x522968['on']('error',function(_0x42f003){_0x3e8119[_0x4117('0xa')](_0x4117('0x18'),new AGIError(_0x4117('0x19'),_0x42f003[_0x4117('0x1a')]));});_0x522968['on'](_0x4117('0x1b'),function(){_0x3e8119['emit'](_0x4117('0x1b'),new AGIError(_0x4117('0x1c')));});_0x522968['on'](_0x4117('0x1d'),function(){_0x3e8119[_0x4117('0xa')]('timeout',new AGIError(_0x4117('0x1e')));_0x522968[_0x4117('0x1f')]();});_0x522968[_0x4117('0x20')](_0x2004f9);this[_0x4117('0x21')]=function(_0x2cf21e,_0xfbb042){var _0x2cf21e=_0x2cf21e||'',_0xfbb042=typeof _0xfbb042==_0x4117('0x11')?_0xfbb042:new Function();_0x1520b1={'tx':_0x2cf21e,'rx':'','cb':_0xfbb042};_0x522968[_0x4117('0x22')](_0x2cf21e+'\x0a');},this[_0x4117('0x1b')]=function(){_0x522968['destroy']();};}util[_0x4117('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x4117('0x24')]['sendRequest']=function(_0x49ac60){return this['command']['sync'](this,_0x49ac60);};AGIChannel[_0x4117('0x24')][_0x4117('0x25')]=function(){return this[_0x4117('0x26')](_0x4117('0x27'));};AGIChannel[_0x4117('0x24')][_0x4117('0x28')]=function(_0x2c6265,_0x7f8e0f,_0x5a5dd2){_0x2c6265=_0x2c6265===undefined?_0x4117('0x29'):_0x2c6265;_0x7f8e0f=_0x7f8e0f===undefined?'5':_0x7f8e0f;_0x5a5dd2=_0x5a5dd2===undefined?'1':_0x5a5dd2;return this['sendRequest'](util[_0x4117('0x2a')](_0x4117('0x2b'),_0x2c6265,_0x7f8e0f*0x3e8,_0x5a5dd2));};AGIChannel[_0x4117('0x24')][_0x4117('0x2c')]=function(_0x18f142){_0x18f142=_0x18f142||_0x4117('0x2d');return this['sendRequest'](util['format'](_0x4117('0x2e'),_0x18f142));};AGIChannel[_0x4117('0x24')][_0x4117('0x2f')]=function(_0x1b2c82,_0x51d063){if(_[_0x4117('0x30')](_0x51d063)){return this[_0x4117('0x26')](util['format']('EXEC\x20%s\x20%s',_0x1b2c82,_0x51d063[_0x4117('0x31')](',')));}return this[_0x4117('0x26')](util[_0x4117('0x2a')](_0x4117('0x32'),_0x1b2c82,_0x51d063));};AGIChannel['prototype']['setContext']=function(_0x26cb6e){return this[_0x4117('0x26')](util['format'](_0x4117('0x33'),_0x26cb6e));};AGIChannel[_0x4117('0x24')][_0x4117('0x34')]=function(_0x19f388){return this['sendRequest'](util[_0x4117('0x2a')](_0x4117('0x35'),_0x19f388));};AGIChannel[_0x4117('0x24')][_0x4117('0x36')]=function(_0x2cd0ca){return this[_0x4117('0x26')](util[_0x4117('0x2a')](_0x4117('0x37'),_0x2cd0ca));};AGIChannel['prototype'][_0x4117('0xd')]=function(){return this[_0x4117('0x26')]('HANGUP');};AGIChannel[_0x4117('0x24')][_0x4117('0x38')]=function(_0x1c3909,_0x313d69){var _0x103037=_['isBoolean'](_0x313d69)||_[_0x4117('0x39')](_0x313d69)?_0x313d69[_0x4117('0x3a')]():_0x313d69;return this[_0x4117('0x26')](util[_0x4117('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1c3909,_0x103037?_0x103037['toString']()[_0x4117('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4117('0x24')][_0x4117('0x3b')]=function(_0xc22f07,_0x207c59){return this[_0x4117('0x26')](util[_0x4117('0x2a')](_0x4117('0x3c'),_0xc22f07,_0x207c59));};AGIChannel[_0x4117('0x24')]['sayDigits']=function(_0x223e46,_0x228711){return this[_0x4117('0x26')](util[_0x4117('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x223e46,_0x228711));};AGIChannel[_0x4117('0x24')][_0x4117('0x3d')]=function(_0x529f4e,_0x5645cf){return this[_0x4117('0x26')](util[_0x4117('0x2a')](_0x4117('0x3e'),_0x529f4e,_0x5645cf));};AGIChannel[_0x4117('0x24')][_0x4117('0x3f')]=function(_0x24285a,_0x21fc0a,_0x37b0ee){_0x21fc0a=_0x21fc0a||this[_0x4117('0x40')];_0x37b0ee=_0x37b0ee||0x1;this[_0x4117('0x41')](_0x24285a);this[_0x4117('0x34')](_0x21fc0a);this[_0x4117('0x36')](_0x37b0ee);return this[_0x4117('0x2c')](util['format'](_0x4117('0x42'),_0x24285a,_0x21fc0a,_0x37b0ee));};AGIChannel[_0x4117('0x24')][_0x4117('0x43')]=function(_0x54a2bd){return this[_0x4117('0x26')](util[_0x4117('0x2a')](_0x4117('0x44'),_0x54a2bd));};AGIChannel[_0x4117('0x24')][_0x4117('0x45')]=function(_0x3059f7,_0xfae33e,_0x47b067,_0x5961af,_0x230d09,_0x1416dd){_0xfae33e=_0xfae33e||_0x4117('0x46');_0x47b067=_0x47b067||'';_0x5961af=_0x5961af===undefined?-0x1:_0x5961af==='-1'?-0x1:_0x5961af*0x3e8;_0x230d09=_0x230d09===undefined?'':'s='+_0x230d09;_0x1416dd=_0x1416dd?'BEEP':'';return this[_0x4117('0x26')](util[_0x4117('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3059f7,_0xfae33e,_0x47b067,_0x5961af,_0x1416dd,_0x230d09));};AGIChannel[_0x4117('0x24')]['streamFile']=function(_0x9b6cb6,_0x4ca348){_0x4ca348=_0x4ca348||'';return this[_0x4117('0x26')](util[_0x4117('0x2a')](_0x4117('0x47'),_0x9b6cb6,_0x4ca348));};AGIChannel[_0x4117('0x24')][_0x4117('0x48')]=function(_0x598144){return this['exec']('AGI',_0x598144);};AGIChannel[_0x4117('0x24')][_0x4117('0x49')]=function(_0x7c77d8){return this[_0x4117('0x2f')](_0x4117('0x4a'),_0x7c77d8);};AGIChannel['prototype']['error']=function(_0x34edee,_0x2e3a48){this[_0x4117('0x2c')](util[_0x4117('0x2a')](_0x4117('0x4b'),_0x34edee['id'],_0x34edee[_0x4117('0x4c')],_0x2e3a48));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4117('0x4d')]=AGIChannel; \ No newline at end of file +var _0x2c40=['prototype','sendRequest','command','sync','answer','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','replace','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','ready','toLowerCase','hangup','emit','520-Invalid','520\x20End\x20of\x20proper','substring','no\x20code','result=','indexOf','substr','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','pipe','function','write'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x2c40,0xfd));var _0x02c4=function(_0x437246,_0xf75492){_0x437246=_0x437246-0x0;var _0x297bef=_0x2c40[_0x437246];return _0x297bef;};'use strict';var util=require('util');var _=require(_0x02c4('0x0'));var EventEmitter=require(_0x02c4('0x1'))[_0x02c4('0x2')];var AGIReply=require(_0x02c4('0x3'));var AGIError=require(_0x02c4('0x4'));function AGIChannel(_0x411b3d){var _0xdd32f8=this,_0x3fa7fc=new AGIReply(),_0x4aa61a=![],_0x4f2cea={};EventEmitter[_0x02c4('0x5')](_0xdd32f8);_0x411b3d[_0x02c4('0x6')]('utf8');_0x411b3d[_0x02c4('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3fa7fc[_0x02c4('0x6')](_0x02c4('0x8'));_0x3fa7fc['on'](_0x02c4('0x9'),function(_0x484d47){for(var _0x30d5fa in _0x484d47){_0xdd32f8[_0x30d5fa]=_0x484d47[_0x30d5fa];}_0xdd32f8['emit'](_0x02c4('0xa'));});_0x3fa7fc['on']('line',function(_0x2a483b){if(_0x2a483b[_0x02c4('0xb')]()==_0x02c4('0xc')){_0xdd32f8[_0x02c4('0xd')](_0x02c4('0xc'));return;}if(_0x2a483b['substring'](0x0,0xb)==_0x02c4('0xe')){_0x4aa61a=!![];}if(_0x4aa61a){_0x4f2cea['rx']+=_0x2a483b+'\x0a';if(_0x2a483b['search'](_0x02c4('0xf'))!=-0x1){_0x4aa61a=![];}}else{_0x4f2cea['rx']=_0x2a483b;}if(_0x4aa61a){return;}if(typeof _0x4f2cea['cb']=='function'){var _0x20e2fe=_0x4f2cea['rx'][_0x02c4('0x10')](0x0,0x3),_0x978383=null,_0x2a2470=null;_0x20e2fe=parseInt(_0x20e2fe);if(isNaN(_0x20e2fe)){_0x4f2cea['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x02c4('0x11')});return;}if(_0x20e2fe!=0xc8){_0x4f2cea['cb'](null,{'code':_0x20e2fe,'result':-0x1,'extra':'KO'});return;}_0x978383=_0x4f2cea['rx'][_0x02c4('0x10')](0x4)['replace'](_0x02c4('0x12'),'');if(_0x978383[_0x02c4('0x13')]('\x20')!=-0x1){_0x978383=_0x978383[_0x02c4('0x14')](0x0,_0x978383[_0x02c4('0x13')]('\x20'));}if(_[_0x02c4('0x15')](_0x978383,'-1')){_0x978383=parseInt(_0x978383);}_0x2a2470=_0x4f2cea['rx'][_0x02c4('0x16')]('\x20');if(_0x2a2470[_0x02c4('0x17')]==0x3){_0x2a2470=_0x2a2470[0x2][_0x02c4('0x10')](0x1,_0x2a2470[0x2][_0x02c4('0x17')]-0x1);}else if(_0x2a2470[_0x02c4('0x17')]>0x3){var _0x3259f9=/\((.+)\)/;var _0x4f189f=_0x4f2cea['rx']['match'](_0x3259f9);if(_0x4f189f){_0x2a2470=_0x4f189f[0x1];}else{_0x2a2470=null;}}else{_0x2a2470=null;}_0x4f2cea['cb'](null,{'code':_0x20e2fe,'result':_0x978383,'extra':_0x2a2470});}});_0x411b3d['on'](_0x02c4('0x18'),function(_0x23ba6f){_0xdd32f8[_0x02c4('0xd')](_0x02c4('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x23ba6f['code']));});_0x411b3d['on']('close',function(){_0xdd32f8[_0x02c4('0xd')](_0x02c4('0x19'),new AGIError(_0x02c4('0x1a')));});_0x411b3d['on'](_0x02c4('0x1b'),function(){_0xdd32f8[_0x02c4('0xd')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x411b3d['destroy']();});_0x411b3d[_0x02c4('0x1c')](_0x3fa7fc);this['command']=function(_0x1b974f,_0x5322ab){var _0x1b974f=_0x1b974f||'',_0x5322ab=typeof _0x5322ab==_0x02c4('0x1d')?_0x5322ab:new Function();_0x4f2cea={'tx':_0x1b974f,'rx':'','cb':_0x5322ab};_0x411b3d[_0x02c4('0x1e')](_0x1b974f+'\x0a');},this[_0x02c4('0x19')]=function(){_0x411b3d['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x02c4('0x1f')][_0x02c4('0x20')]=function(_0x2d9b9b){return this[_0x02c4('0x21')][_0x02c4('0x22')](this,_0x2d9b9b);};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x23')]=function(){return this[_0x02c4('0x20')]('ANSWER');};AGIChannel[_0x02c4('0x1f')]['getData']=function(_0x592ac4,_0x16723d,_0x42474b){_0x592ac4=_0x592ac4===undefined?_0x02c4('0x24'):_0x592ac4;_0x16723d=_0x16723d===undefined?'5':_0x16723d;_0x42474b=_0x42474b===undefined?'1':_0x42474b;return this[_0x02c4('0x20')](util['format'](_0x02c4('0x25'),_0x592ac4,_0x16723d*0x3e8,_0x42474b));};AGIChannel['prototype'][_0x02c4('0x26')]=function(_0x1ce411){_0x1ce411=_0x1ce411||_0x02c4('0x27');return this['sendRequest'](util[_0x02c4('0x28')](_0x02c4('0x29'),_0x1ce411));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x2a')]=function(_0x1e509e,_0x50252c){if(_[_0x02c4('0x2b')](_0x50252c)){return this[_0x02c4('0x20')](util['format']('EXEC\x20%s\x20%s',_0x1e509e,_0x50252c[_0x02c4('0x2c')](',')));}return this[_0x02c4('0x20')](util['format'](_0x02c4('0x2d'),_0x1e509e,_0x50252c));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x2e')]=function(_0x405414){return this[_0x02c4('0x20')](util[_0x02c4('0x28')](_0x02c4('0x2f'),_0x405414));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x30')]=function(_0x44e568){return this[_0x02c4('0x20')](util[_0x02c4('0x28')](_0x02c4('0x31'),_0x44e568));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x32')]=function(_0x51af92){return this[_0x02c4('0x20')](util[_0x02c4('0x28')]('SET\x20PRIORITY\x20%s',_0x51af92));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0xc')]=function(){return this[_0x02c4('0x20')](_0x02c4('0x33'));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x34')]=function(_0x1f87ae,_0x4cd031){var _0x59f34f=_['isBoolean'](_0x4cd031)||_[_0x02c4('0x35')](_0x4cd031)?_0x4cd031[_0x02c4('0x36')]():_0x4cd031;return this['sendRequest'](util[_0x02c4('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1f87ae,_0x59f34f?_0x59f34f[_0x02c4('0x36')]()[_0x02c4('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x38')]=function(_0x19af65,_0x21f8fd){return this[_0x02c4('0x20')](util[_0x02c4('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x19af65,_0x21f8fd));};AGIChannel['prototype']['sayDigits']=function(_0x34f671,_0x2ffbbc){return this[_0x02c4('0x20')](util[_0x02c4('0x28')](_0x02c4('0x39'),_0x34f671,_0x2ffbbc));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x3a')]=function(_0x274dcc,_0x3e5731){return this[_0x02c4('0x20')](util[_0x02c4('0x28')](_0x02c4('0x3b'),_0x274dcc,_0x3e5731));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x3c')]=function(_0x27c72b,_0x9c77ef,_0x9f75a5){_0x9c77ef=_0x9c77ef||this[_0x02c4('0x3d')];_0x9f75a5=_0x9f75a5||0x1;this[_0x02c4('0x2e')](_0x27c72b);this[_0x02c4('0x30')](_0x9c77ef);this[_0x02c4('0x32')](_0x9f75a5);return this[_0x02c4('0x26')](util[_0x02c4('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x27c72b,_0x9c77ef,_0x9f75a5));};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x3e')]=function(_0x1ede29){return this['sendRequest'](util['format'](_0x02c4('0x3f'),_0x1ede29));};AGIChannel[_0x02c4('0x1f')]['recordFile']=function(_0x229063,_0x1bb9fe,_0x23f6b5,_0x28a998,_0x213ab1,_0x3d8b2b){_0x1bb9fe=_0x1bb9fe||_0x02c4('0x40');_0x23f6b5=_0x23f6b5||'';_0x28a998=_0x28a998===undefined?-0x1:_0x28a998==='-1'?-0x1:_0x28a998*0x3e8;_0x213ab1=_0x213ab1===undefined?'':'s='+_0x213ab1;_0x3d8b2b=_0x3d8b2b?'BEEP':'';return this[_0x02c4('0x20')](util[_0x02c4('0x28')](_0x02c4('0x41'),_0x229063,_0x1bb9fe,_0x23f6b5,_0x28a998,_0x3d8b2b,_0x213ab1));};AGIChannel[_0x02c4('0x1f')]['streamFile']=function(_0x98af73,_0x37718a){_0x37718a=_0x37718a||'';return this[_0x02c4('0x20')](util[_0x02c4('0x28')](_0x02c4('0x42'),_0x98af73,_0x37718a));};AGIChannel[_0x02c4('0x1f')]['agi']=function(_0x2ce0ec){return this[_0x02c4('0x2a')](_0x02c4('0x43'),_0x2ce0ec);};AGIChannel[_0x02c4('0x1f')][_0x02c4('0x44')]=function(_0x188f18){return this['exec']('WAIT',_0x188f18);};AGIChannel['prototype'][_0x02c4('0x18')]=function(_0x21f436,_0x5df322){this[_0x02c4('0x26')](util['format'](_0x02c4('0x45'),_0x21f436['id'],_0x21f436[_0x02c4('0x46')],_0x5df322));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 b780606..d82c11e 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 _0x962f=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x4d6a2e,_0x4899d1){var _0x10d015=function(_0x3eba62){while(--_0x3eba62){_0x4d6a2e['push'](_0x4d6a2e['shift']());}};_0x10d015(++_0x4899d1);}(_0x962f,0x1d9));var _0xf962=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x962f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf962('0x0'));var error={'E_AGI_UNDEFINED':_0xf962('0x1'),'E_AGI_ARGUMENT_PORT':_0xf962('0x2'),'E_AGI_SERVER_ERROR':_0xf962('0x3'),'E_AGI_SERVER_CLOSE':_0xf962('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xf962('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xf962('0x6'),'E_AGI_SOCKET_ERROR':_0xf962('0x7'),'E_AGI_SOCKET_CLOSE':_0xf962('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xf962('0x9'),'E_AGI_COMMAND_EMPTY':_0xf962('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf962('0xb'),'E_AGI_IVR_ENTRY':_0xf962('0xc')};function AGIError(_0xe83c97){var _0xe83c97=_0xe83c97||null,_0x589578=_0x589578||[],_0x5a8d28=0x1,_0x1c017e='';if(!error[_0xe83c97]){_0xe83c97=_0xf962('0xd');}_0x589578[_0xf962('0xe')](error[_0xe83c97]);while(arguments[_0x5a8d28]){_0x589578['push'](arguments[_0x5a8d28]);_0x5a8d28++;}_0x1c017e=util[_0xf962('0xf')][_0xf962('0x10')](util,_0x589578);this['message']=_0x1c017e;this['name']=_0xe83c97;}module['exports']=AGIError; \ No newline at end of file +var _0x3d4a=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','push','format','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x3d4a,0x1cc));var _0xa3d4=function(_0xc8eb9b,_0x37195e){_0xc8eb9b=_0xc8eb9b-0x0;var _0x5045b4=_0x3d4a[_0xc8eb9b];return _0x5045b4;};'use strict';var util=require(_0xa3d4('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xa3d4('0x1'),'E_AGI_SERVER_ERROR':_0xa3d4('0x2'),'E_AGI_SERVER_CLOSE':_0xa3d4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa3d4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xa3d4('0x5'),'E_AGI_SOCKET_ERROR':_0xa3d4('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa3d4('0x7'),'E_AGI_COMMAND_EMPTY':_0xa3d4('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2cb3cc){var _0x2cb3cc=_0x2cb3cc||null,_0x19e271=_0x19e271||[],_0x34c2b0=0x1,_0x36e1e3='';if(!error[_0x2cb3cc]){_0x2cb3cc='E_AGI_UNDEFINED';}_0x19e271[_0xa3d4('0x9')](error[_0x2cb3cc]);while(arguments[_0x34c2b0]){_0x19e271['push'](arguments[_0x34c2b0]);_0x34c2b0++;}_0x36e1e3=util[_0xa3d4('0xa')]['apply'](util,_0x19e271);this[_0xa3d4('0xb')]=_0x36e1e3;this[_0xa3d4('0xc')]=_0x2cb3cc;}module[_0xa3d4('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0c1483a..2bc2c71 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 _0xb037=['exports','lodash','ioredis','./error','redis','defaults','localhost','agi','emit','E_AGI_SERVER_ERROR','message','projectUpdate'];(function(_0x44e556,_0x263f8e){var _0x3d7ced=function(_0x7192c9){while(--_0x7192c9){_0x44e556['push'](_0x44e556['shift']());}};_0x3d7ced(++_0x263f8e);}(_0xb037,0xcd));var _0x7b03=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xb037[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x7b03('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x7b03('0x1'));var AGIError=require(_0x7b03('0x2'));var config=require('../../config/environment');config[_0x7b03('0x3')]=_[_0x7b03('0x4')](config[_0x7b03('0x3')],{'host':_0x7b03('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x7b03('0x3')]);sub['subscribe'](_0x7b03('0x6'),function(_0xf518d1){if(_0xf518d1)return eventEmitter[_0x7b03('0x7')]('error',new AGIError(_0x7b03('0x8'),_0xf518d1));});sub['on'](_0x7b03('0x9'),function(_0x1134e6,_0x231ec5){if(_0x1134e6!=='agi')return;try{var _0x2c0a1a=JSON['parse'](_0x231ec5);eventEmitter[_0x7b03('0x7')](_0x7b03('0xa'),_0x2c0a1a);}catch(_0x2e716a){eventEmitter['emit']('error',new AGIError(_0x7b03('0x8'),_0x2e716a));}});module[_0x7b03('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x8d76=['ioredis','./error','../../config/environment','redis','subscribe','agi','error','E_AGI_SERVER_ERROR','message','parse','emit','projectUpdate','exports','lodash','events','EventEmitter'];(function(_0x2531e9,_0x576a45){var _0x50df05=function(_0x38ce09){while(--_0x38ce09){_0x2531e9['push'](_0x2531e9['shift']());}};_0x50df05(++_0x576a45);}(_0x8d76,0x1cd));var _0x68d7=function(_0x197458,_0x5adb5c){_0x197458=_0x197458-0x0;var _0x3d92a2=_0x8d76[_0x197458];return _0x3d92a2;};'use strict';var _=require(_0x68d7('0x0'));var EventEmitter=require(_0x68d7('0x1'))[_0x68d7('0x2')];var Redis=require(_0x68d7('0x3'));var AGIError=require(_0x68d7('0x4'));var config=require(_0x68d7('0x5'));config[_0x68d7('0x6')]=_['defaults'](config[_0x68d7('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x68d7('0x6')]);sub[_0x68d7('0x7')](_0x68d7('0x8'),function(_0x224254){if(_0x224254)return eventEmitter['emit'](_0x68d7('0x9'),new AGIError(_0x68d7('0xa'),_0x224254));});sub['on'](_0x68d7('0xb'),function(_0x4f6593,_0x3fda02){if(_0x4f6593!==_0x68d7('0x8'))return;try{var _0x43cf14=JSON[_0x68d7('0xc')](_0x3fda02);eventEmitter[_0x68d7('0xd')](_0x68d7('0xe'),_0x43cf14);}catch(_0x3b7bb6){eventEmitter['emit'](_0x68d7('0x9'),new AGIError(_0x68d7('0xa'),_0x3b7bb6));}});module[_0x68d7('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5acb2d4..1800afd 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 _0x9ad9=['addVertex','edges','addEdge','push','size','getVertex','info','no\x20vertex\x20found','length','condition','split','agicommand','target','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x9ad9,0xbc));var _0x99ad=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x9ad9[_0x20cb20];return _0x2fcf4b;};'use strict';var _=require(_0x99ad('0x0'));var logger=require('../../../config/logger')(_0x99ad('0x1'));var verticesWithRetry=[_0x99ad('0x2'),_0x99ad('0x3'),_0x99ad('0x4')];var Graph=function(){this[_0x99ad('0x5')]={};this['edges']={};this[_0x99ad('0x6')]=0x0;};Graph[_0x99ad('0x7')][_0x99ad('0x8')]=function(_0x25a580){this['vertices'][_0x25a580['id']]=_0x25a580;this[_0x99ad('0x9')][_0x25a580['id']]=[];};Graph[_0x99ad('0x7')][_0x99ad('0xa')]=function(_0x30e62f,_0x3d333f,_0x2558d5){this[_0x99ad('0x9')][_0x30e62f][_0x99ad('0xb')]({'target':_0x3d333f,'condition':_0x2558d5});this[_0x99ad('0x6')]+=0x1;};Graph[_0x99ad('0x7')][_0x99ad('0xc')]=function(){return _['size'](this['vertices']);};Graph[_0x99ad('0x7')]['relations']=function(){return this[_0x99ad('0x6')];};Graph[_0x99ad('0x7')][_0x99ad('0xd')]=function(_0x59e479){return this['vertices'][_0x59e479];};Graph['prototype']['traverseBFS']=function(_0x3e505d,_0x3be29e){if(!this[_0x99ad('0x5')][_0x3e505d]){return logger[_0x99ad('0xe')](_0x99ad('0xf'));}var _0x88a2f8=_0x3be29e(this[_0x99ad('0x5')][_0x3e505d]);if(!_0x88a2f8){return logger[_0x99ad('0xe')]('stop\x20traverse');}if(this[_0x99ad('0x9')][_0x3e505d]['length']===0x0){return logger[_0x99ad('0xe')]('no\x20edge/s\x20available');}for(var _0x595ca5=0x0,_0x2f2158=[],_0x3ac350=![];_0x595ca5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','indexOf','agi_','substring','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection'];(function(_0x5d2ff8,_0x4ca881){var _0x5461f2=function(_0xe3411a){while(--_0xe3411a){_0x5d2ff8['push'](_0x5d2ff8['shift']());}};_0x5461f2(++_0x4ca881);}(_0x2a9f,0xf8));var _0xf2a9=function(_0x334cb7,_0xb2b507){_0x334cb7=_0x334cb7-0x0;var _0x476215=_0x2a9f[_0x334cb7];return _0x476215;};'use strict';var _=require(_0xf2a9('0x0'));var syncho=require(_0xf2a9('0x1'));var util=require(_0xf2a9('0x2'));var config=require('../../config/environment');var logger=require(_0xf2a9('0x3'))(_0xf2a9('0x4'));var utilLicense=require(_0xf2a9('0x5'));var rpc=require(_0xf2a9('0x6'));var Project=require(_0xf2a9('0x7'));var AGIEmitter=require(_0xf2a9('0x8'))['EventEmitter'];var projects=[];config[_0xf2a9('0x4')]=_['defaults'](config[_0xf2a9('0x4')],{'ip':_0xf2a9('0x9'),'port':0x11dd});AGIEmitter['on'](_0xf2a9('0xa'),projectUpdateHandler);function connectionHandler(_0x405a8a){process[_0xf2a9('0xb')](function(){syncho(function(){try{setChannelVariables(_0x405a8a);agiHandler(_0x405a8a);}catch(_0x528f9b){logger[_0xf2a9('0xc')](_0x528f9b[_0xf2a9('0xd')]);}});});}function projectUpdateHandler(_0x53b432){try{var _0xc2b374=_['findIndex'](projects,['id',_0x53b432['id']]);if(_0xc2b374>-0x1){if(_0x53b432[_0xf2a9('0xe')]===!![]){projects[_0xf2a9('0xf')](_0xc2b374,0x1);}else{projects[_0xc2b374]=_0x53b432;}}else{projects[_0xf2a9('0x10')](_0x53b432);}}catch(_0x877d03){logger['error'](_0x877d03[_0xf2a9('0xd')]);}}function listeningHandler(){console[_0xf2a9('0x11')](_0xf2a9('0x12'),config[_0xf2a9('0x4')][_0xf2a9('0x13')]);logger[_0xf2a9('0x14')](util[_0xf2a9('0x15')](_0xf2a9('0x16'),config['agi']['ip'],config[_0xf2a9('0x4')][_0xf2a9('0x13')]));}function errorHandler(_0x3972fc){if(_0x3972fc&&_0x3972fc[_0xf2a9('0x17')]&&_0x3972fc[_0xf2a9('0x18')]){logger[_0xf2a9('0xc')](util[_0xf2a9('0x15')](_0xf2a9('0x19'),_0x3972fc[_0xf2a9('0x17')],_0x3972fc[_0xf2a9('0x18')]));}else{logger[_0xf2a9('0xc')](util[_0xf2a9('0x15')](_0xf2a9('0x1a'),_0x3972fc['stack']));}}function closeHandler(){logger['info'](util[_0xf2a9('0x15')](_0xf2a9('0x1b'),this[_0xf2a9('0x1c')],this[_0xf2a9('0x1d')],this['callerid'],this[_0xf2a9('0x1e')],this[_0xf2a9('0x1f')]));try{createSquareReport(this);}catch(_0x490455){logger[_0xf2a9('0xc')](_0x490455[_0xf2a9('0xd')]);}}function timeoutHandler(){logger['info'](util[_0xf2a9('0x15')](_0xf2a9('0x20'),this[_0xf2a9('0x1c')],this[_0xf2a9('0x1d')],this[_0xf2a9('0x21')],this['dnid'],this[_0xf2a9('0x1f')]));}function hangupHandler(){logger[_0xf2a9('0x14')](util['format'](_0xf2a9('0x22'),this[_0xf2a9('0x1c')],this[_0xf2a9('0x1d')],this[_0xf2a9('0x21')],this['dnid'],this[_0xf2a9('0x1f')]));this[_0xf2a9('0x23')]=!![];}function createSquareReport(_0x459626,_0x14f99d){rpc['createSquareReport'](_0x459626)[_0xf2a9('0x24')](function(_0x14237a){if(_0x14f99d){_0x14f99d(null,_0x14237a);}})[_0xf2a9('0x25')](function(_0x44cc25){if(_0x14f99d){_0x14f99d(null,_0x44cc25);}});}function setChannelVariables(_0x36de4b){for(var _0x5114c7 in _0x36de4b){if(_0x36de4b['hasOwnProperty'](_0x5114c7)){if(_0x5114c7[_0xf2a9('0x26')](_0xf2a9('0x27'))===0x0){_0x36de4b[_0x5114c7[_0xf2a9('0x28')](0x4)]=_0x36de4b[_0x5114c7];delete _0x36de4b[_0x5114c7];}}}}function agiHandler(_0x5d7a8b){logger[_0xf2a9('0x29')]('variables',JSON['stringify'](_0x5d7a8b,null,0x2));logger[_0xf2a9('0x14')](util[_0xf2a9('0x15')](_0xf2a9('0x2a'),_0x5d7a8b[_0xf2a9('0x1c')],_0x5d7a8b[_0xf2a9('0x1d')],_0x5d7a8b[_0xf2a9('0x21')],_0x5d7a8b[_0xf2a9('0x1e')],_0x5d7a8b['uniqueid']));_0x5d7a8b['on'](_0xf2a9('0xc'),errorHandler);_0x5d7a8b['on'](_0xf2a9('0x2b'),closeHandler);_0x5d7a8b['on']('timeout',timeoutHandler);_0x5d7a8b['evtHangup']=![];_0x5d7a8b['on'](_0xf2a9('0x2c'),hangupHandler);var _0x1a3aad=_[_0xf2a9('0x2d')](projects,[_0xf2a9('0x17'),_0x5d7a8b[_0xf2a9('0x1c')]]);if(!_0x1a3aad)return Project[_0xf2a9('0x2e')](_0x5d7a8b);if(!_0x1a3aad[_0xf2a9('0x2f')])return Project[_0xf2a9('0x30')](_0x5d7a8b);return Project[_0xf2a9('0x31')](_0x1a3aad,_0x5d7a8b);}function main(){var _0x124f66;return utilLicense[_0xf2a9('0x32')]()[_0xf2a9('0x24')](function(_0x188779){if(!_0x188779)return;if(_0x188779[_0xf2a9('0x33')]){if(_0x188779['callysquare']&&_0x188779['callysquare']>0x0){logger['info'](util['format'](_0xf2a9('0x34'),_0x188779[_0xf2a9('0x35')]));_0x124f66=_0x188779[_0xf2a9('0x35')];}else{logger[_0xf2a9('0x14')](_0xf2a9('0x36'));}}else{logger['info'](_0xf2a9('0x37'));_0x124f66=-0x1;}})['then'](function(){return Project[_0xf2a9('0x38')]();})[_0xf2a9('0x24')](function(_0x16f185){projects=_0x16f185;return;})[_0xf2a9('0x25')](function(_0x5a9d03){logger[_0xf2a9('0xc')](_0xf2a9('0x39'),_0x5a9d03[_0xf2a9('0xd')]);})[_0xf2a9('0x3a')](function(){var _0x4da13e=require(_0xf2a9('0x3b'))(config[_0xf2a9('0x4')]['port'],config[_0xf2a9('0x4')]['ip'],_0x124f66);_0x4da13e['on'](_0xf2a9('0xc'),errorHandler);_0x4da13e['on'](_0xf2a9('0x3c'),listeningHandler);_0x4da13e['on'](_0xf2a9('0x3d'),connectionHandler);_0x4da13e['on'](_0xf2a9('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0x171d=['timeout','hangup','handleNotFound','production','handleUnpublished','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','error','stack','deleted','splice','push','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x171d,0x146));var _0xd171=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0x171d[_0x1f27df];return _0x286ee2;};'use strict';var _=require(_0xd171('0x0'));var syncho=require(_0xd171('0x1'));var util=require(_0xd171('0x2'));var config=require(_0xd171('0x3'));var logger=require(_0xd171('0x4'))(_0xd171('0x5'));var utilLicense=require(_0xd171('0x6'));var rpc=require(_0xd171('0x7'));var Project=require(_0xd171('0x8'));var AGIEmitter=require(_0xd171('0x9'))[_0xd171('0xa')];var projects=[];config[_0xd171('0x5')]=_[_0xd171('0xb')](config[_0xd171('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xd171('0xc'),projectUpdateHandler);function connectionHandler(_0x2b7370){process[_0xd171('0xd')](function(){syncho(function(){try{setChannelVariables(_0x2b7370);agiHandler(_0x2b7370);}catch(_0x54ea3a){logger[_0xd171('0xe')](_0x54ea3a[_0xd171('0xf')]);}});});}function projectUpdateHandler(_0x237725){try{var _0x210a6f=_['findIndex'](projects,['id',_0x237725['id']]);if(_0x210a6f>-0x1){if(_0x237725[_0xd171('0x10')]===!![]){projects[_0xd171('0x11')](_0x210a6f,0x1);}else{projects[_0x210a6f]=_0x237725;}}else{projects[_0xd171('0x12')](_0x237725);}}catch(_0x53b8b1){logger[_0xd171('0xe')](_0x53b8b1[_0xd171('0xf')]);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xd171('0x5')][_0xd171('0x13')]);logger[_0xd171('0x14')](util[_0xd171('0x15')](_0xd171('0x16'),config[_0xd171('0x5')]['ip'],config[_0xd171('0x5')]['port']));}function errorHandler(_0x442a4a){if(_0x442a4a&&_0x442a4a['name']&&_0x442a4a['message']){logger['error'](util[_0xd171('0x15')](_0xd171('0x17'),_0x442a4a[_0xd171('0x18')],_0x442a4a[_0xd171('0x19')]));}else{logger[_0xd171('0xe')](util[_0xd171('0x15')](_0xd171('0x1a'),_0x442a4a[_0xd171('0xf')]));}}function closeHandler(){logger[_0xd171('0x14')](util[_0xd171('0x15')](_0xd171('0x1b'),this[_0xd171('0x1c')],this[_0xd171('0x1d')],this[_0xd171('0x1e')],this[_0xd171('0x1f')],this[_0xd171('0x20')]));try{createSquareReport(this);}catch(_0x2d4787){logger['error'](_0x2d4787[_0xd171('0xf')]);}}function timeoutHandler(){logger['info'](util[_0xd171('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd171('0x1c')],this[_0xd171('0x1d')],this[_0xd171('0x1e')],this[_0xd171('0x1f')],this[_0xd171('0x20')]));}function hangupHandler(){logger['info'](util[_0xd171('0x15')](_0xd171('0x21'),this['arg_1'],this[_0xd171('0x1d')],this[_0xd171('0x1e')],this['dnid'],this[_0xd171('0x20')]));this[_0xd171('0x22')]=!![];}function createSquareReport(_0x272863,_0x179215){rpc['createSquareReport'](_0x272863)[_0xd171('0x23')](function(_0x3fcf10){if(_0x179215){_0x179215(null,_0x3fcf10);}})[_0xd171('0x24')](function(_0x287922){if(_0x179215){_0x179215(null,_0x287922);}});}function setChannelVariables(_0x7cd187){for(var _0x4537f2 in _0x7cd187){if(_0x7cd187[_0xd171('0x25')](_0x4537f2)){if(_0x4537f2[_0xd171('0x26')](_0xd171('0x27'))===0x0){_0x7cd187[_0x4537f2[_0xd171('0x28')](0x4)]=_0x7cd187[_0x4537f2];delete _0x7cd187[_0x4537f2];}}}}function agiHandler(_0x1f155b){logger[_0xd171('0x29')](_0xd171('0x2a'),JSON[_0xd171('0x2b')](_0x1f155b,null,0x2));logger['info'](util['format'](_0xd171('0x2c'),_0x1f155b[_0xd171('0x1c')],_0x1f155b[_0xd171('0x1d')],_0x1f155b[_0xd171('0x1e')],_0x1f155b['dnid'],_0x1f155b['uniqueid']));_0x1f155b['on']('error',errorHandler);_0x1f155b['on'](_0xd171('0x2d'),closeHandler);_0x1f155b['on'](_0xd171('0x2e'),timeoutHandler);_0x1f155b[_0xd171('0x22')]=![];_0x1f155b['on'](_0xd171('0x2f'),hangupHandler);var _0x4b956b=_['find'](projects,['name',_0x1f155b[_0xd171('0x1c')]]);if(!_0x4b956b)return Project[_0xd171('0x30')](_0x1f155b);if(!_0x4b956b[_0xd171('0x31')])return Project[_0xd171('0x32')](_0x1f155b);return Project['initialize'](_0x4b956b,_0x1f155b);}function main(){var _0x4ad052;return utilLicense[_0xd171('0x33')]()[_0xd171('0x23')](function(_0x4eedca){if(!_0x4eedca)return;if(_0x4eedca['voice']){if(_0x4eedca[_0xd171('0x34')]&&_0x4eedca['callysquare']>0x0){logger[_0xd171('0x14')](util[_0xd171('0x15')](_0xd171('0x35'),_0x4eedca['callysquare']));_0x4ad052=_0x4eedca[_0xd171('0x34')];}else{logger[_0xd171('0x14')](_0xd171('0x36'));}}else{logger[_0xd171('0x14')](_0xd171('0x37'));_0x4ad052=-0x1;}})['then'](function(){return Project[_0xd171('0x38')]();})[_0xd171('0x23')](function(_0x6fdd6e){projects=_0x6fdd6e;return;})[_0xd171('0x24')](function(_0x3ac56b){logger[_0xd171('0xe')](_0xd171('0x39'),_0x3ac56b[_0xd171('0xf')]);})[_0xd171('0x3a')](function(){var _0x3f843a=require(_0xd171('0x3b'))(config[_0xd171('0x5')][_0xd171('0x13')],config[_0xd171('0x5')]['ip'],_0x4ad052);_0x3f843a['on'](_0xd171('0xe'),errorHandler);_0x3f843a['on'](_0xd171('0x3c'),listeningHandler);_0x3f843a['on'](_0xd171('0x3d'),connectionHandler);_0x3f843a['on'](_0xd171('0x2d'),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 dcfaaee..6c9278e 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 _0xab3e=['sendMailMessage','bluebird','client','http','request','then','error','message','catch'];(function(_0x1b4bef,_0x5bb6be){var _0xf377eb=function(_0x40bd1d){while(--_0x40bd1d){_0x1b4bef['push'](_0x1b4bef['shift']());}};_0xf377eb(++_0x5bb6be);}(_0xab3e,0xa3));var _0xeab3=function(_0x1acb07,_0x44fa67){_0x1acb07=_0x1acb07-0x0;var _0x4df84e=_0xab3e[_0x1acb07];return _0x4df84e;};'use strict';var BPromise=require(_0xeab3('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xeab3('0x1')][_0xeab3('0x2')]({'port':0x232b});function request(_0x3f5894,_0x47a0df){return new BPromise(function(_0x2b1339,_0x19da90){return client[_0xeab3('0x3')](_0x3f5894,_0x47a0df)[_0xeab3('0x4')](function(_0x484cad){if(_0x484cad[_0xeab3('0x5')]){return _0x19da90(_0x484cad[_0xeab3('0x5')][_0xeab3('0x6')]);}else{return _0x2b1339(_0x484cad['result']);}})[_0xeab3('0x7')](function(_0x34cc5b){return _0x19da90(_0x34cc5b);});});}exports[_0xeab3('0x8')]=function(_0x1571bc,_0x4c513a){return request('SendMail',{'account':_0x1571bc,'message':_0x4c513a});}; \ No newline at end of file +var _0x6c00=['SendMail','bluebird','jayson/promise','client','http','request','then','error','result','sendMailMessage'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x6c00,0x1eb));var _0x06c0=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x6c00[_0x456b57];return _0x18f49f;};'use strict';var BPromise=require(_0x06c0('0x0'));var jayson=require(_0x06c0('0x1'));var client=jayson[_0x06c0('0x2')][_0x06c0('0x3')]({'port':0x232b});function request(_0x3661da,_0x38e275){return new BPromise(function(_0x265018,_0x542064){return client[_0x06c0('0x4')](_0x3661da,_0x38e275)[_0x06c0('0x5')](function(_0x31831f){if(_0x31831f[_0x06c0('0x6')]){return _0x542064(_0x31831f[_0x06c0('0x6')]['message']);}else{return _0x265018(_0x31831f[_0x06c0('0x7')]);}})['catch'](function(_0x45a13e){return _0x542064(_0x45a13e);});});}exports[_0x06c0('0x8')]=function(_0x580c16,_0x8a0826){return request(_0x06c0('0x9'),{'account':_0x580c16,'message':_0x8a0826});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 3434f91..aa0685a 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 _0xc3f6=['target','value','toJson','mxGraphModel','inspect','start','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','info','format','uniqueid','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','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','traverseBFS','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./rpc','./mailRpc','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','addEdge','source'];(function(_0x4e80dc,_0x4255c7){var _0x2492d7=function(_0x281072){while(--_0x281072){_0x4e80dc['push'](_0x4e80dc['shift']());}};_0x2492d7(++_0x4255c7);}(_0xc3f6,0x1c2));var _0x6c3f=function(_0x55fc73,_0x28a01d){_0x55fc73=_0x55fc73-0x0;var _0x445d86=_0xc3f6[_0x55fc73];return _0x445d86;};'use strict';var _=require(_0x6c3f('0x0'));var moment=require(_0x6c3f('0x1'));var parser=require('xml2json');var util=require(_0x6c3f('0x2'));var logger=require(_0x6c3f('0x3'))(_0x6c3f('0x4'));var rpc=require(_0x6c3f('0x5'));var mailRpc=require(_0x6c3f('0x6'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x6c3f('0x7')]()[_0x6c3f('0x8')](function(_0x22d59b){logger[_0x6c3f('0x9')](_0x6c3f('0xa'),_0x22d59b[_0x6c3f('0xb')]);return[];});}function addVertex(_0x52081d,_0x503e4c,_0x1fb4ec){_0x503e4c[_0x6c3f('0xc')]=_0x1fb4ec;if(_0x503e4c[_0x6c3f('0xd')](_0x6c3f('0xe'))){_0x503e4c[_0x6c3f('0xf')]=parseInt(_0x503e4c['retry'],0xa);}_0x52081d[_0x6c3f('0x10')](_['omit'](_0x503e4c,_0x6c3f('0x11')));}function initGraph(_0x4b9687,_0x279056){var _0x512ee8=new Graph();for(var _0x2845fb in _0x4b9687){if(_0x4b9687['hasOwnProperty'](_0x2845fb)){if(_[_0x6c3f('0x12')](_0x4b9687[_0x2845fb])){for(var _0x26f525=0x0;_0x26f525<_0x4b9687[_0x2845fb][_0x6c3f('0x13')];_0x26f525+=0x1){addVertex(_0x512ee8,_0x4b9687[_0x2845fb][_0x26f525],_0x2845fb);}}else{addVertex(_0x512ee8,_0x4b9687[_0x2845fb],_0x2845fb);}}}for(var _0x134b0d=0x0;_0x134b0d<_0x279056[_0x6c3f('0x13')];_0x134b0d+=0x1){if(_0x279056[_0x134b0d]['source']&&_0x279056[_0x134b0d]['target']){_0x512ee8[_0x6c3f('0x14')](_0x279056[_0x134b0d][_0x6c3f('0x15')],_0x279056[_0x134b0d][_0x6c3f('0x16')],_0x279056[_0x134b0d][_0x6c3f('0x17')]);}}return _0x512ee8;}function getRoot(_0x559630){return parser[_0x6c3f('0x18')](_0x559630,{'object':!![]})[_0x6c3f('0x19')]['root'];}function inspect(_0x17a3a9){return util[_0x6c3f('0x1a')](_0x17a3a9,{'showHidden':![],'depth':null});}function initialize(_0x2594c1,_0xcc1eba){var _0x1c1216=getRoot(_0x2594c1['production']);if(!_0x1c1216||!_0x1c1216[_0x6c3f('0x1b')])return;var _0x1c7ee8,_0x485a39,_0x480754;logger[_0x6c3f('0x1c')](_0x6c3f('0x1d'),JSON[_0x6c3f('0x1e')](_0x1c1216,null,0x2));_0xcc1eba[_0x6c3f('0x1f')]=moment()['format'](_0x6c3f('0x20'));_0x1c7ee8=initGraph(_[_0x6c3f('0x21')](_0x1c1216,_0x6c3f('0x11')),_0x1c1216[_0x6c3f('0x11')]);_0x485a39=new Vertices(_0xcc1eba,rpc,mailRpc);logger[_0x6c3f('0x22')](util[_0x6c3f('0x23')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xcc1eba['arg_1'],_0xcc1eba['calleridname'],_0xcc1eba['callerid'],_0xcc1eba['dnid'],_0xcc1eba[_0x6c3f('0x24')]));_0x1c7ee8['traverseBFS'](_0x1c1216[_0x6c3f('0x1b')]['id'],function(_0x266a4e){try{_0x266a4e=_0x485a39[_0x6c3f('0x25')](_0x266a4e);logger[_0x6c3f('0x1c')]('vertex',JSON[_0x6c3f('0x1e')](_0x266a4e,null,0x2));if(_0x266a4e[_0x6c3f('0xc')]==='gotoc'){logger[_0x6c3f('0x22')](_0x6c3f('0x26'));_0xcc1eba[_0x6c3f('0x27')]=_0x266a4e[_0x6c3f('0x27')]||_0xcc1eba[_0x6c3f('0x27')];_0xcc1eba[_0x6c3f('0x28')]=_0x266a4e['extension'];_0xcc1eba[_0x6c3f('0x29')]=_0x266a4e[_0x6c3f('0x29')]?_0x266a4e[_0x6c3f('0x29')]-0x1:0x1;return null;}else if(_0x266a4e&&_0x485a39[_0x266a4e[_0x6c3f('0xc')]]){_0x480754=_0x485a39[_0x266a4e[_0x6c3f('0xc')]](_0x266a4e);logger[_0x6c3f('0x22')](_0x6c3f('0x2a'),JSON[_0x6c3f('0x1e')](_0x480754,null,0x2));if(_0x480754&&_0x480754[_0x6c3f('0x2b')]===AGI_CODE_SUCCESS&&_0x480754[_0x6c3f('0x2c')]!==AGI_RESULT_ERROR&&!_0xcc1eba[_0x6c3f('0x2d')]){logger[_0x6c3f('0x1c')]('response',inspect(_0x480754));return _[_0x6c3f('0x2e')](_0x480754[_0x6c3f('0x2c')])?null:_0x480754[_0x6c3f('0x2c')][_0x6c3f('0x2f')]();}else{logger[_0x6c3f('0x9')](_0x6c3f('0x2a'),inspect(_0x480754));return null;}}else{logger[_0x6c3f('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x4422aa){logger['error'](_0x4422aa[_0x6c3f('0xb')]);return null;}});if(_0x1c1216[_0x6c3f('0x30')]){logger[_0x6c3f('0x22')](util[_0x6c3f('0x23')](_0x6c3f('0x31'),_0xcc1eba[_0x6c3f('0x32')],_0xcc1eba[_0x6c3f('0x33')],_0xcc1eba[_0x6c3f('0x34')],_0xcc1eba[_0x6c3f('0x35')],_0xcc1eba[_0x6c3f('0x24')]));_0x1c7ee8[_0x6c3f('0x36')](_0x1c1216[_0x6c3f('0x30')]['id'],function(_0x2210fb){try{_0x2210fb=_0x485a39[_0x6c3f('0x25')](_0x2210fb);logger[_0x6c3f('0x1c')]('vertex',JSON['stringify'](_0x2210fb,null,0x2));if(_0x2210fb&&_0x485a39[_0x2210fb[_0x6c3f('0xc')]]){_0x480754=_0x485a39[_0x2210fb[_0x6c3f('0xc')]](_0x2210fb);if(_0x480754){logger[_0x6c3f('0x1c')](_0x6c3f('0x2a'),inspect(_0x480754));return _['isUndefined'](_0x480754['result'])?null:_0x480754['result']['toString']();}else{logger[_0x6c3f('0x9')](_0x6c3f('0x2a'),inspect(_0x480754));return null;}}else{logger[_0x6c3f('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0xc4e902){logger[_0x6c3f('0x9')](_0xc4e902['stack']);return null;}});}logger[_0x6c3f('0x22')](util[_0x6c3f('0x23')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xcc1eba[_0x6c3f('0x32')],_0xcc1eba[_0x6c3f('0x33')],_0xcc1eba[_0x6c3f('0x34')],_0xcc1eba[_0x6c3f('0x35')],_0xcc1eba[_0x6c3f('0x24')]));logger[_0x6c3f('0x22')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xcc1eba[_0x6c3f('0x27')],_0xcc1eba[_0x6c3f('0x28')],parseInt(_0xcc1eba[_0x6c3f('0x29')],0xa)+0x1));_0xcc1eba[_0x6c3f('0x37')](_0xcc1eba[_0x6c3f('0x27')],_0xcc1eba['extension'],parseInt(_0xcc1eba[_0x6c3f('0x29')],0xa)+0x1);_0xcc1eba['close']();}function handleNotFound(_0x1becdd){logger['error'](util[_0x6c3f('0x23')]('Project\x20%s\x20not\x20found',_0x1becdd[_0x6c3f('0x32')]));_0x1becdd['continueAt'](_0x1becdd[_0x6c3f('0x27')],_0x1becdd[_0x6c3f('0x28')],parseInt(_0x1becdd['priority'],0xa)+0x1);_0x1becdd[_0x6c3f('0x38')]();}function handleUnpublished(_0x41052f){logger[_0x6c3f('0x9')](util['format'](_0x6c3f('0x39'),_0x41052f['arg_1']));_0x41052f[_0x6c3f('0x37')](_0x41052f[_0x6c3f('0x27')],_0x41052f['extension'],parseInt(_0x41052f[_0x6c3f('0x29')],0xa)+0x1);_0x41052f['close']();}module[_0x6c3f('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x3d8a=['error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','length','source','target','addEdge','value','toJson','root','inspect','production','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','vertex','gotoc','context','extension','priority','info','response','code','result','evtHangup','debug','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','clear','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','../../config/logger','./rpc','./graph','./vertices','getSquareProjects'];(function(_0x224b9b,_0x39ae3b){var _0x27efe0=function(_0xf1a128){while(--_0xf1a128){_0x224b9b['push'](_0x224b9b['shift']());}};_0x27efe0(++_0x39ae3b);}(_0x3d8a,0x1c9));var _0xa3d8=function(_0x12d119,_0x28ecfe){_0x12d119=_0x12d119-0x0;var _0x3b0819=_0x3d8a[_0x12d119];return _0x3b0819;};'use strict';var _=require(_0xa3d8('0x0'));var moment=require(_0xa3d8('0x1'));var parser=require('xml2json');var util=require('util');var logger=require(_0xa3d8('0x2'))('agi');var rpc=require(_0xa3d8('0x3'));var mailRpc=require('./mailRpc');var Graph=require(_0xa3d8('0x4'));var Vertices=require(_0xa3d8('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xa3d8('0x6')]()['catch'](function(_0x116028){logger[_0xa3d8('0x7')](_0xa3d8('0x8'),_0x116028[_0xa3d8('0x9')]);return[];});}function addVertex(_0x487be1,_0x3c590c,_0x42bcf5){_0x3c590c[_0xa3d8('0xa')]=_0x42bcf5;if(_0x3c590c[_0xa3d8('0xb')](_0xa3d8('0xc'))){_0x3c590c[_0xa3d8('0xd')]=parseInt(_0x3c590c[_0xa3d8('0xc')],0xa);}_0x487be1['addVertex'](_['omit'](_0x3c590c,'mxCell'));}function initGraph(_0x4943be,_0x36e1f0){var _0x469701=new Graph();for(var _0x2a2e5e in _0x4943be){if(_0x4943be[_0xa3d8('0xb')](_0x2a2e5e)){if(_['isArray'](_0x4943be[_0x2a2e5e])){for(var _0x2f827c=0x0;_0x2f827c<_0x4943be[_0x2a2e5e][_0xa3d8('0xe')];_0x2f827c+=0x1){addVertex(_0x469701,_0x4943be[_0x2a2e5e][_0x2f827c],_0x2a2e5e);}}else{addVertex(_0x469701,_0x4943be[_0x2a2e5e],_0x2a2e5e);}}}for(var _0x2c45ad=0x0;_0x2c45ad<_0x36e1f0['length'];_0x2c45ad+=0x1){if(_0x36e1f0[_0x2c45ad][_0xa3d8('0xf')]&&_0x36e1f0[_0x2c45ad][_0xa3d8('0x10')]){_0x469701[_0xa3d8('0x11')](_0x36e1f0[_0x2c45ad][_0xa3d8('0xf')],_0x36e1f0[_0x2c45ad][_0xa3d8('0x10')],_0x36e1f0[_0x2c45ad][_0xa3d8('0x12')]);}}return _0x469701;}function getRoot(_0x4aa512){return parser[_0xa3d8('0x13')](_0x4aa512,{'object':!![]})['mxGraphModel'][_0xa3d8('0x14')];}function inspect(_0x2eee0e){return util[_0xa3d8('0x15')](_0x2eee0e,{'showHidden':![],'depth':null});}function initialize(_0x148de1,_0x2da432){var _0x269017=getRoot(_0x148de1[_0xa3d8('0x16')]);if(!_0x269017||!_0x269017[_0xa3d8('0x17')])return;var _0x47add3,_0x1c4cea,_0x88df05;logger['debug'](_0xa3d8('0x14'),JSON[_0xa3d8('0x18')](_0x269017,null,0x2));_0x2da432[_0xa3d8('0x19')]=moment()[_0xa3d8('0x1a')](_0xa3d8('0x1b'));_0x47add3=initGraph(_[_0xa3d8('0x1c')](_0x269017,'mxCell'),_0x269017['mxCell']);_0x1c4cea=new Vertices(_0x2da432,rpc,mailRpc);logger['info'](util[_0xa3d8('0x1a')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2da432[_0xa3d8('0x1d')],_0x2da432[_0xa3d8('0x1e')],_0x2da432[_0xa3d8('0x1f')],_0x2da432[_0xa3d8('0x20')],_0x2da432[_0xa3d8('0x21')]));_0x47add3[_0xa3d8('0x22')](_0x269017['start']['id'],function(_0xc93b62){try{_0xc93b62=_0x1c4cea['clear'](_0xc93b62);logger['debug'](_0xa3d8('0x23'),JSON[_0xa3d8('0x18')](_0xc93b62,null,0x2));if(_0xc93b62[_0xa3d8('0xa')]===_0xa3d8('0x24')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2da432[_0xa3d8('0x25')]=_0xc93b62[_0xa3d8('0x25')]||_0x2da432[_0xa3d8('0x25')];_0x2da432['extension']=_0xc93b62[_0xa3d8('0x26')];_0x2da432[_0xa3d8('0x27')]=_0xc93b62[_0xa3d8('0x27')]?_0xc93b62[_0xa3d8('0x27')]-0x1:0x1;return null;}else if(_0xc93b62&&_0x1c4cea[_0xc93b62['agicommand']]){_0x88df05=_0x1c4cea[_0xc93b62['agicommand']](_0xc93b62);logger[_0xa3d8('0x28')](_0xa3d8('0x29'),JSON[_0xa3d8('0x18')](_0x88df05,null,0x2));if(_0x88df05&&_0x88df05[_0xa3d8('0x2a')]===AGI_CODE_SUCCESS&&_0x88df05[_0xa3d8('0x2b')]!==AGI_RESULT_ERROR&&!_0x2da432[_0xa3d8('0x2c')]){logger[_0xa3d8('0x2d')]('response',inspect(_0x88df05));return _[_0xa3d8('0x2e')](_0x88df05[_0xa3d8('0x2b')])?null:_0x88df05['result'][_0xa3d8('0x2f')]();}else{logger[_0xa3d8('0x7')]('response',inspect(_0x88df05));return null;}}else{logger['error'](_0xa3d8('0x30'));return null;}}catch(_0x1be989){logger['error'](_0x1be989[_0xa3d8('0x9')]);return null;}});if(_0x269017[_0xa3d8('0x31')]){logger['info'](util['format'](_0xa3d8('0x32'),_0x2da432[_0xa3d8('0x1d')],_0x2da432[_0xa3d8('0x1e')],_0x2da432['callerid'],_0x2da432[_0xa3d8('0x20')],_0x2da432[_0xa3d8('0x21')]));_0x47add3['traverseBFS'](_0x269017[_0xa3d8('0x31')]['id'],function(_0x390ff2){try{_0x390ff2=_0x1c4cea[_0xa3d8('0x33')](_0x390ff2);logger[_0xa3d8('0x2d')](_0xa3d8('0x23'),JSON[_0xa3d8('0x18')](_0x390ff2,null,0x2));if(_0x390ff2&&_0x1c4cea[_0x390ff2[_0xa3d8('0xa')]]){_0x88df05=_0x1c4cea[_0x390ff2[_0xa3d8('0xa')]](_0x390ff2);if(_0x88df05){logger['debug'](_0xa3d8('0x29'),inspect(_0x88df05));return _[_0xa3d8('0x2e')](_0x88df05[_0xa3d8('0x2b')])?null:_0x88df05[_0xa3d8('0x2b')][_0xa3d8('0x2f')]();}else{logger[_0xa3d8('0x7')](_0xa3d8('0x29'),inspect(_0x88df05));return null;}}else{logger[_0xa3d8('0x7')](_0xa3d8('0x30'));return null;}}catch(_0x57d5cc){logger['error'](_0x57d5cc[_0xa3d8('0x9')]);return null;}});}logger[_0xa3d8('0x28')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2da432['arg_1'],_0x2da432[_0xa3d8('0x1e')],_0x2da432[_0xa3d8('0x1f')],_0x2da432[_0xa3d8('0x20')],_0x2da432[_0xa3d8('0x21')]));logger[_0xa3d8('0x28')](util[_0xa3d8('0x1a')](_0xa3d8('0x34'),_0x2da432[_0xa3d8('0x25')],_0x2da432[_0xa3d8('0x26')],parseInt(_0x2da432[_0xa3d8('0x27')],0xa)+0x1));_0x2da432['continueAt'](_0x2da432[_0xa3d8('0x25')],_0x2da432['extension'],parseInt(_0x2da432[_0xa3d8('0x27')],0xa)+0x1);_0x2da432[_0xa3d8('0x35')]();}function handleNotFound(_0x27c056){logger[_0xa3d8('0x7')](util[_0xa3d8('0x1a')](_0xa3d8('0x36'),_0x27c056[_0xa3d8('0x1d')]));_0x27c056[_0xa3d8('0x37')](_0x27c056['context'],_0x27c056[_0xa3d8('0x26')],parseInt(_0x27c056[_0xa3d8('0x27')],0xa)+0x1);_0x27c056['close']();}function handleUnpublished(_0x1509db){logger['error'](util['format'](_0xa3d8('0x38'),_0x1509db[_0xa3d8('0x1d')]));_0x1509db['continueAt'](_0x1509db['context'],_0x1509db[_0xa3d8('0x26')],parseInt(_0x1509db[_0xa3d8('0x27')],0xa)+0x1);_0x1509db['close']();}module[_0xa3d8('0x39')]={'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 d26494f..86c19ae 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 _0x25e1=['_inBody','inherits','prototype','_transform','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','util','Transform','call','_localBuffer'];(function(_0x302f95,_0xd6788a){var _0x4404b1=function(_0x11f8ac){while(--_0x11f8ac){_0x302f95['push'](_0x302f95['shift']());}};_0x4404b1(++_0xd6788a);}(_0x25e1,0x1d0));var _0x125e=function(_0x5922cb,_0x47497e){_0x5922cb=_0x5922cb-0x0;var _0x535ef3=_0x25e1[_0x5922cb];return _0x535ef3;};'use strict';var util=require(_0x125e('0x0'));var Transform=require('stream')[_0x125e('0x1')];function AGIReply(_0x38b8a0){Transform[_0x125e('0x2')](this,_0x38b8a0);this[_0x125e('0x3')]='';this[_0x125e('0x4')]=![];}util[_0x125e('0x5')](AGIReply,Transform);AGIReply[_0x125e('0x6')][_0x125e('0x7')]=function(_0x2d6b35,_0x3079b1,_0x2b16c4){var _0x158400='\x0a',_0x29b9a2=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3e0f92=-0x1,_0x4b50bf=-0x1,_0x1fe9d3='',_0x1a78a2=0x0,_0x1978da='',_0x35f150='';this[_0x125e('0x3')]+=_0x2d6b35['toString']();_0x1978da=this[_0x125e('0x3')];if(!this[_0x125e('0x4')]){_0x1a78a2=0x0;while(_0x29b9a2[_0x1a78a2]){while((_0x4b50bf=_0x1978da[_0x125e('0x8')](_0x29b9a2[_0x1a78a2]))!=-0x1){_0x1fe9d3=_0x29b9a2[_0x1a78a2];_0x35f150=_0x1978da[_0x125e('0x9')](0x0,_0x4b50bf);_0x1978da=_0x1978da[_0x125e('0x9')](_0x4b50bf+_0x1fe9d3[_0x125e('0xa')]);var _0x4ee1d2=_0x35f150[_0x125e('0xb')](_0x158400),_0x2fd925=0x0,_0x43aeae={},_0x43154b='',_0x289d8c='',_0x431a45=-0x1;while(_0x4ee1d2[_0x2fd925]){_0x431a45=_0x4ee1d2[_0x2fd925][_0x125e('0x8')](':');if(_0x431a45!=-0x1){_0x43154b=_0x4ee1d2[_0x2fd925][_0x125e('0xc')](0x0,_0x431a45)[_0x125e('0xd')]();_0x289d8c=_0x4ee1d2[_0x2fd925]['slice'](_0x431a45+0x1)[_0x125e('0xd')]();if(_0x43154b[_0x125e('0xa')]>0x0){_0x43aeae[_0x43154b]=_0x289d8c;}}else{}_0x2fd925++;}this[_0x125e('0xe')](_0x125e('0xf'),_0x43aeae);this[_0x125e('0x4')]=!![];}_0x1a78a2++;}this['_localBuffer']=_0x1978da;}else{while((_0x3e0f92=_0x1978da[_0x125e('0x8')](_0x158400))!=-0x1){_0x35f150=_0x1978da[_0x125e('0x9')](0x0,_0x3e0f92);this[_0x125e('0xe')](_0x125e('0x10'),_0x35f150);_0x1978da=_0x1978da[_0x125e('0x9')](_0x3e0f92+_0x158400[_0x125e('0xa')]);}this['_localBuffer']=_0x1978da;}_0x2b16c4();};module[_0x125e('0x11')]=AGIReply; \ No newline at end of file +var _0xd517=['indexOf','substring','split','trim','slice','headers','emit','line','exports','util','stream','Transform','call','_inBody','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString'];(function(_0x26edeb,_0x3d0b02){var _0x4993e2=function(_0x11d7e2){while(--_0x11d7e2){_0x26edeb['push'](_0x26edeb['shift']());}};_0x4993e2(++_0x3d0b02);}(_0xd517,0x1dd));var _0x7d51=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xd517[_0x499210];return _0x2e153d;};'use strict';var util=require(_0x7d51('0x0'));var Transform=require(_0x7d51('0x1'))[_0x7d51('0x2')];function AGIReply(_0x1e678a){Transform[_0x7d51('0x3')](this,_0x1e678a);this['_localBuffer']='';this[_0x7d51('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x7d51('0x5')]=function(_0x1920a7,_0x1c3af9,_0x426238){var _0x7b56b7='\x0a',_0x6f4a46=['\x0a\x0a',_0x7d51('0x6')],_0x2c50de=-0x1,_0x23bcf1=-0x1,_0x474aca='',_0x55d39b=0x0,_0x4b70d9='',_0x383524='';this[_0x7d51('0x7')]+=_0x1920a7[_0x7d51('0x8')]();_0x4b70d9=this['_localBuffer'];if(!this['_inBody']){_0x55d39b=0x0;while(_0x6f4a46[_0x55d39b]){while((_0x23bcf1=_0x4b70d9[_0x7d51('0x9')](_0x6f4a46[_0x55d39b]))!=-0x1){_0x474aca=_0x6f4a46[_0x55d39b];_0x383524=_0x4b70d9[_0x7d51('0xa')](0x0,_0x23bcf1);_0x4b70d9=_0x4b70d9[_0x7d51('0xa')](_0x23bcf1+_0x474aca['length']);var _0x440e6a=_0x383524[_0x7d51('0xb')](_0x7b56b7),_0x417976=0x0,_0x5635b3={},_0x862d23='',_0x4d2446='',_0x5df8db=-0x1;while(_0x440e6a[_0x417976]){_0x5df8db=_0x440e6a[_0x417976]['indexOf'](':');if(_0x5df8db!=-0x1){_0x862d23=_0x440e6a[_0x417976]['slice'](0x0,_0x5df8db)[_0x7d51('0xc')]();_0x4d2446=_0x440e6a[_0x417976][_0x7d51('0xd')](_0x5df8db+0x1)[_0x7d51('0xc')]();if(_0x862d23['length']>0x0){_0x5635b3[_0x862d23]=_0x4d2446;}}else{}_0x417976++;}this['emit'](_0x7d51('0xe'),_0x5635b3);this[_0x7d51('0x4')]=!![];}_0x55d39b++;}this[_0x7d51('0x7')]=_0x4b70d9;}else{while((_0x2c50de=_0x4b70d9[_0x7d51('0x9')](_0x7b56b7))!=-0x1){_0x383524=_0x4b70d9['substring'](0x0,_0x2c50de);this[_0x7d51('0xf')](_0x7d51('0x10'),_0x383524);_0x4b70d9=_0x4b70d9['substring'](_0x2c50de+_0x7b56b7['length']);}this[_0x7d51('0x7')]=_0x4b70d9;}_0x426238();};module[_0x7d51('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c49163a..e206408 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 _0x7a72=['createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','moment','jayson/promise','http','then','error','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','getContactByPhone','GetContactByPhone','phone','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format'];(function(_0x1a0aa8,_0x293c5b){var _0x20a13b=function(_0x39704b){while(--_0x39704b){_0x1a0aa8['push'](_0x1a0aa8['shift']());}};_0x20a13b(++_0x293c5b);}(_0x7a72,0x1be));var _0x27a7=function(_0x1719ec,_0x343878){_0x1719ec=_0x1719ec-0x0;var _0x4914f2=_0x7a72[_0x1719ec];return _0x4914f2;};'use strict';var _=require('lodash');var moment=require(_0x27a7('0x0'));var jayson=require(_0x27a7('0x1'));var client=jayson['client'][_0x27a7('0x2')]({'port':0x2329});function request(_0x4b4ed5,_0x15d71f){return new Promise(function(_0x4e68c6,_0x30a1a8){return client['request'](_0x4b4ed5,_0x15d71f)[_0x27a7('0x3')](function(_0x5e56ac){if(_0x5e56ac[_0x27a7('0x4')]){return _0x30a1a8(_0x5e56ac[_0x27a7('0x4')]['message']);}else{return _0x4e68c6(_0x5e56ac['result']);}})[_0x27a7('0x5')](function(_0x54e6ee){return _0x30a1a8(_0x54e6ee);});});}exports[_0x27a7('0x6')]=function(){return request(_0x27a7('0x7'),{'options':{'raw':![],'attributes':['id',_0x27a7('0x8'),_0x27a7('0x9')]}});};exports['getSquareProject']=function(_0x1ce909){return request(_0x27a7('0xa'),{'options':{'raw':![],'where':{'name':_0x1ce909},'attributes':[_0x27a7('0x9')]}});};exports['getMailAccountById']=function(_0x299206){return request(_0x27a7('0xb'),{'options':{'raw':![],'where':{'id':_0x299206},'include':[{'model':'MailServerOut','as':_0x27a7('0xc'),'include':[{'model':_0x27a7('0xd'),'as':'CloudProvider'}]}],'attributes':['id',_0x27a7('0x8'),_0x27a7('0xe')],'smtp':!![]}});};exports[_0x27a7('0xf')]=function(_0x169016){return request(_0x27a7('0xa'),{'options':{'where':{'id':_0x169016},'attributes':[_0x27a7('0x8')]}});};exports['getVoiceQueueById']=function(_0x4d3bfb){return request(_0x27a7('0x10'),{'options':{'where':{'id':_0x4d3bfb},'attributes':['name']}});};exports[_0x27a7('0x11')]=function(_0x560929){return request(_0x27a7('0x12'),{'options':{'where':{'id':_0x560929},'attributes':[_0x27a7('0x8')]}});};exports[_0x27a7('0x13')]=function(_0xb1663d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xb1663d},'attributes':['dsn']}});};exports[_0x27a7('0x14')]=function(_0x432080){return request('ShowUser',{'options':{'where':{'id':_0x432080},'attributes':[_0x27a7('0x8')]}});};exports[_0x27a7('0x15')]=function(_0xaf0c9e){return request(_0x27a7('0x16'),{'options':{'where':{'phone':_0xaf0c9e[_0x27a7('0x17')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x113e8a){return request('ShowTrunk',{'options':{'where':{'id':_0x113e8a},'attributes':[_0x27a7('0x8')]}});};exports[_0x27a7('0x18')]=function(_0x4de342){return request(_0x27a7('0x19'),{'options':{'where':{'id':_0x4de342},'attributes':['save_name']}});};exports[_0x27a7('0x1a')]=function(_0x5d5031){return request(_0x27a7('0x1b'),{'options':{'raw':![],'where':{'id':_0x5d5031},'include':[{'model':_0x27a7('0x1c'),'as':_0x27a7('0x1d')}]}});};exports[_0x27a7('0x1e')]=function(_0x47b93c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x47b93c},'attributes':['id',_0x27a7('0x8')]}});};exports[_0x27a7('0x1f')]=function(_0x32cb91){return request('CreateSmsMessage',{'body':_0x32cb91});};exports[_0x27a7('0x20')]=function(_0x351ef4){return request(_0x27a7('0x21'),{'body':_0x351ef4});};exports[_0x27a7('0x22')]=function(_0x1788df){return request(_0x27a7('0x23'),{'body':_[_0x27a7('0x24')](_0x1788df,{'project_name':_0x1788df[_0x27a7('0x25')],'prev_project_name':_0x1788df[_0x27a7('0x26')]||'','is_subproject':_0x1788df[_0x27a7('0x26')]?!![]:![],'leaveAt':moment()[_0x27a7('0x27')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x27a7('0x28')]=function(_0x439066){return request(_0x27a7('0x29'),{'body':_0x439066});};exports[_0x27a7('0x2a')]=function(_0x4c935c){return request(_0x27a7('0x2b'),{'body':_0x4c935c});};exports[_0x27a7('0x2c')]=function(_0x36e669){return request(_0x27a7('0x2d'),{'options':{'raw':![],'where':{'phone':_0x36e669[_0x27a7('0x17')],'ListId':_0x36e669[_0x27a7('0x2e')]}}})['then'](function(_0x81e614){if(_0x81e614){return _0x81e614;}return request(_0x27a7('0x2f'),{'body':_0x36e669});});};exports['getPauseById']=function(_0x16756d){return request('ShowPause',{'options':{'where':{'id':_0x16756d},'attributes':[_0x27a7('0x8')]}});};exports[_0x27a7('0x30')]=function(_0x5423f4,_0x5d5e80){return request(_0x27a7('0x31'),{'body':{'interface':_0x5d5e80},'options':{'where':_0x5423f4}});};exports[_0x27a7('0x32')]=function(_0x1fe26a,_0x511cf1,_0x33774e){return request(_0x27a7('0x33'),{'body':{'type':_0x511cf1,'uniqueid':_0x33774e},'options':{'where':_0x1fe26a}});};exports['agentUnpause']=function(_0x7eb84f){return request(_0x27a7('0x34'),{'body':{},'options':{'where':_0x7eb84f}});};exports['agentLogout']=function(_0x53bdce){return request(_0x27a7('0x35'),{'body':{},'options':{'where':_0x53bdce}});}; \ No newline at end of file +var _0x032e=['getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','lodash','jayson/promise','client','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue'];(function(_0x23d7c5,_0x2a7547){var _0x350950=function(_0x26f5b6){while(--_0x26f5b6){_0x23d7c5['push'](_0x23d7c5['shift']());}};_0x350950(++_0x2a7547);}(_0x032e,0x124));var _0xe032=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x032e[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xe032('0x0'));var moment=require('moment');var jayson=require(_0xe032('0x1'));var client=jayson[_0xe032('0x2')]['http']({'port':0x2329});function request(_0x4afba2,_0x45ab5b){return new Promise(function(_0x2ce001,_0x2f44f6){return client[_0xe032('0x3')](_0x4afba2,_0x45ab5b)[_0xe032('0x4')](function(_0x420020){if(_0x420020[_0xe032('0x5')]){return _0x2f44f6(_0x420020[_0xe032('0x5')][_0xe032('0x6')]);}else{return _0x2ce001(_0x420020[_0xe032('0x7')]);}})[_0xe032('0x8')](function(_0xd84027){return _0x2f44f6(_0xd84027);});});}exports[_0xe032('0x9')]=function(){return request(_0xe032('0xa'),{'options':{'raw':![],'attributes':['id',_0xe032('0xb'),_0xe032('0xc')]}});};exports[_0xe032('0xd')]=function(_0x167bd9){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x167bd9},'attributes':[_0xe032('0xc')]}});};exports[_0xe032('0xe')]=function(_0x13c126){return request(_0xe032('0xf'),{'options':{'raw':![],'where':{'id':_0x13c126},'include':[{'model':_0xe032('0x10'),'as':_0xe032('0x11'),'include':[{'model':_0xe032('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0xe032('0xb'),_0xe032('0x13')],'smtp':!![]}});};exports[_0xe032('0x14')]=function(_0x1a53ab){return request('ShowSquareProject',{'options':{'where':{'id':_0x1a53ab},'attributes':[_0xe032('0xb')]}});};exports[_0xe032('0x15')]=function(_0x176547){return request(_0xe032('0x16'),{'options':{'where':{'id':_0x176547},'attributes':[_0xe032('0xb')]}});};exports[_0xe032('0x17')]=function(_0x2bf528){return request('ShowVariable',{'options':{'where':{'id':_0x2bf528},'attributes':[_0xe032('0xb')]}});};exports[_0xe032('0x18')]=function(_0x36fb7c){return request(_0xe032('0x19'),{'options':{'where':{'id':_0x36fb7c},'attributes':[_0xe032('0x1a')]}});};exports[_0xe032('0x1b')]=function(_0x4cdab3){return request(_0xe032('0x1c'),{'options':{'where':{'id':_0x4cdab3},'attributes':[_0xe032('0xb')]}});};exports[_0xe032('0x1d')]=function(_0x41d2a5){return request(_0xe032('0x1e'),{'options':{'where':{'phone':_0x41d2a5['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x484e6c){return request(_0xe032('0x1f'),{'options':{'where':{'id':_0x484e6c},'attributes':['name']}});};exports[_0xe032('0x20')]=function(_0x4608e4){return request(_0xe032('0x21'),{'options':{'where':{'id':_0x4608e4},'attributes':[_0xe032('0x22')]}});};exports[_0xe032('0x23')]=function(_0x256f71){return request(_0xe032('0x24'),{'options':{'raw':![],'where':{'id':_0x256f71},'include':[{'model':'Interval','as':_0xe032('0x25')}]}});};exports[_0xe032('0x26')]=function(_0x232e8f){return request(_0xe032('0x27'),{'options':{'where':{'id':_0x232e8f},'attributes':['id',_0xe032('0xb')]}});};exports[_0xe032('0x28')]=function(_0x22831a){return request(_0xe032('0x29'),{'body':_0x22831a});};exports['createSquareDetailsReport']=function(_0x4f1aa3){return request('CreateSquareDetailsReport',{'body':_0x4f1aa3});};exports[_0xe032('0x2a')]=function(_0x2568ce){return request(_0xe032('0x2b'),{'body':_[_0xe032('0x2c')](_0x2568ce,{'project_name':_0x2568ce[_0xe032('0x2d')],'prev_project_name':_0x2568ce[_0xe032('0x2e')]||'','is_subproject':_0x2568ce[_0xe032('0x2e')]?!![]:![],'leaveAt':moment()[_0xe032('0x2f')](_0xe032('0x30'))})});};exports[_0xe032('0x31')]=function(_0x5bb36a){return request(_0xe032('0x32'),{'body':_0x5bb36a});};exports[_0xe032('0x33')]=function(_0x3106aa){return request(_0xe032('0x34'),{'body':_0x3106aa});};exports['createCmContact']=function(_0x5573e4){return request(_0xe032('0x35'),{'options':{'raw':![],'where':{'phone':_0x5573e4[_0xe032('0x36')],'ListId':_0x5573e4[_0xe032('0x37')]}}})[_0xe032('0x4')](function(_0x4e8b72){if(_0x4e8b72){return _0x4e8b72;}return request('CreateCmContact',{'body':_0x5573e4});});};exports['getPauseById']=function(_0x42ec95){return request(_0xe032('0x38'),{'options':{'where':{'id':_0x42ec95},'attributes':[_0xe032('0xb')]}});};exports[_0xe032('0x39')]=function(_0x50db2d,_0x3b93e3){return request(_0xe032('0x3a'),{'body':{'interface':_0x3b93e3},'options':{'where':_0x50db2d}});};exports[_0xe032('0x3b')]=function(_0x4348f8,_0x25810a,_0x4a0198){return request(_0xe032('0x3c'),{'body':{'type':_0x25810a,'uniqueid':_0x4a0198},'options':{'where':_0x4348f8}});};exports[_0xe032('0x3d')]=function(_0x319a2f){return request(_0xe032('0x3e'),{'body':{},'options':{'where':_0x319a2f}});};exports['agentLogout']=function(_0x44b78b){return request('LogoutUser',{'body':{},'options':{'where':_0x44b78b}});}; \ 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 de57134..0a8756b 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 _0x1059=['./polly','./lex'];(function(_0x54a6a3,_0x2f21d2){var _0x5f49fe=function(_0x269232){while(--_0x269232){_0x54a6a3['push'](_0x54a6a3['shift']());}};_0x5f49fe(++_0x2f21d2);}(_0x1059,0x176));var _0x9105=function(_0xcb787d,_0x52ec01){_0xcb787d=_0xcb787d-0x0;var _0xc85ad4=_0x1059[_0xcb787d];return _0xc85ad4;};var polly=require(_0x9105('0x0'));var lex=require(_0x9105('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb89c=['./polly','./lex','exports'];(function(_0x3de393,_0x174832){var _0x11e432=function(_0x4bdfbc){while(--_0x4bdfbc){_0x3de393['push'](_0x3de393['shift']());}};_0x11e432(++_0x174832);}(_0xb89c,0x198));var _0xcb89=function(_0x2b15c0,_0x5d85d6){_0x2b15c0=_0x2b15c0-0x0;var _0x1b855a=_0xb89c[_0x2b15c0];return _0x1b855a;};var polly=require(_0xcb89('0x0'));var lex=require(_0xcb89('0x1'));module[_0xcb89('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index b8741f8..9e53a16 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','./lib/api'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x70e0,0x17b));var _0x070e=function(_0x3603a4,_0x561b8c){_0x3603a4=_0x3603a4-0x0;var _0x49172a=_0x70e0[_0x3603a4];return _0x49172a;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0xb7e7=['./lib/api'];(function(_0x4f9267,_0x4b51d9){var _0x7e61eb=function(_0x552ba0){while(--_0x552ba0){_0x4f9267['push'](_0x4f9267['shift']());}};_0x7e61eb(++_0x4b51d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var lex=require(_0x7b7e('0x0'));module['exports']=function(_0x40e269,_0x518dc6,_0x1b7cc7,_0x54a37f,_0x3f5804,_0x556d68){return lex(_0x40e269,_0x518dc6,_0x1b7cc7,_0x54a37f,_0x3f5804,_0x556d68);}; \ 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 5db4ce4..6f760cc 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(_0x9c2211,_0x5e1884){var _0x2f1908=function(_0x4dae24){while(--_0x4dae24){_0x9c2211['push'](_0x9c2211['shift']());}};_0x2f1908(++_0x5e1884);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x2db0a9,_0x1f0fc3){var _0xd7d6d9=function(_0x2dce2f){while(--_0x2dce2f){_0x2db0a9['push'](_0x2db0a9['shift']());}};_0xd7d6d9(++_0x1f0fc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index f4dbb87..c7254b8 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 _0x81f3=['./lib/api','exports'];(function(_0x2cf8c1,_0x5494c0){var _0x5bcdf1=function(_0xf7dab7){while(--_0xf7dab7){_0x2cf8c1['push'](_0x2cf8c1['shift']());}};_0x5bcdf1(++_0x5494c0);}(_0x81f3,0x118));var _0x381f=function(_0x188aa0,_0x1b5ae1){_0x188aa0=_0x188aa0-0x0;var _0x1e905e=_0x81f3[_0x188aa0];return _0x1e905e;};'use strict';var polly=require(_0x381f('0x0'));module[_0x381f('0x1')]=function(_0x5e1f27,_0x5ed801,_0x445ee8,_0x1c54b1,_0x350cf9,_0x3f7457,_0xc78847){return polly(_0x5e1f27,_0x5ed801,_0x445ee8,_0x1c54b1,_0x350cf9,_0x3f7457,_0xc78847);}; \ No newline at end of file +var _0x4bd0=['exports'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x4bd0,0x9b));var _0x04bd=function(_0x2cf683,_0x3213de){_0x2cf683=_0x2cf683-0x0;var _0x5cddff=_0x4bd0[_0x2cf683];return _0x5cddff;};'use strict';var polly=require('./lib/api');module[_0x04bd('0x0')]=function(_0x2c10bd,_0x27ab29,_0x372569,_0x501700,_0x5ee282,_0x2848a2,_0x573c08){return polly(_0x2c10bd,_0x27ab29,_0x372569,_0x501700,_0x5ee282,_0x2848a2,_0x573c08);}; \ 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 d83c4c8..77eb6fd 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 _0x9fe2=['Polly','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','exports'];(function(_0x3f8b50,_0xb46c65){var _0x535844=function(_0x593697){while(--_0x593697){_0x3f8b50['push'](_0x3f8b50['shift']());}};_0x535844(++_0xb46c65);}(_0x9fe2,0x157));var _0x29fe=function(_0x154781,_0x4669d2){_0x154781=_0x154781-0x0;var _0x5d2626=_0x9fe2[_0x154781];return _0x5d2626;};'use strict';var fs=require('fs');var path=require(_0x29fe('0x0'));var BPromise=require(_0x29fe('0x1'));var rs=require(_0x29fe('0x2'));var AWS=require(_0x29fe('0x3'));function pollyResult(_0x48b934,_0x53f2b9,_0x56ae10){return new BPromise(function(_0x54d028,_0x4cac4e){_0x48b934[_0x29fe('0x4')](_0x53f2b9,function(_0x54b63e,_0x29eebe){if(_0x54b63e){_0x4cac4e(_0x54b63e);}else if(_0x29eebe){if(_0x29eebe[_0x29fe('0x5')]instanceof Buffer){fs[_0x29fe('0x6')](_0x56ae10,_0x29eebe[_0x29fe('0x5')],function(_0x216bd3){if(_0x216bd3){_0x4cac4e(_0x216bd3);}else{_0x54d028();}});}else{_0x4cac4e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4cac4e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x29fe('0x7')]=function(_0x4f4509,_0x5871b,_0x387736,_0x27bc5f,_0x3fc419,_0x58a0db,_0x1a5fca){var _0xf13196=new AWS[(_0x29fe('0x8'))]({'accessKeyId':_0x4f4509,'secretAccessKey':_0x5871b,'region':_0x387736});var _0x36640d={'Text':_0x3fc419,'TextType':_0x58a0db||'text','OutputFormat':'mp3','VoiceId':_0x27bc5f};return pollyResult(_0xf13196,_0x36640d,_0x1a5fca);}; \ No newline at end of file +var _0x66fb=['aws-sdk','synthesizeSpeech','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','randomstring'];(function(_0x4ea226,_0x35f1e0){var _0x563d21=function(_0x17eb85){while(--_0x17eb85){_0x4ea226['push'](_0x4ea226['shift']());}};_0x563d21(++_0x35f1e0);}(_0x66fb,0x1d6));var _0xb66f=function(_0x48c0f5,_0x3f8be2){_0x48c0f5=_0x48c0f5-0x0;var _0x5a0d43=_0x66fb[_0x48c0f5];return _0x5a0d43;};'use strict';var fs=require('fs');var path=require(_0xb66f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb66f('0x1'));var AWS=require(_0xb66f('0x2'));function pollyResult(_0x13aed6,_0x43e02d,_0x430be6){return new BPromise(function(_0x58ebb7,_0x466eb3){_0x13aed6[_0xb66f('0x3')](_0x43e02d,function(_0x2030cf,_0x5ebf70){if(_0x2030cf){_0x466eb3(_0x2030cf);}else if(_0x5ebf70){if(_0x5ebf70['AudioStream']instanceof Buffer){fs['writeFile'](_0x430be6,_0x5ebf70['AudioStream'],function(_0x26b757){if(_0x26b757){_0x466eb3(_0x26b757);}else{_0x58ebb7();}});}else{_0x466eb3(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x466eb3(new Error(_0xb66f('0x4')));}});});}module[_0xb66f('0x5')]=function(_0x407def,_0x123549,_0x203fa7,_0x38fe78,_0x20f2db,_0x31a6ba,_0x147ebc){var _0x256cec=new AWS[(_0xb66f('0x6'))]({'accessKeyId':_0x407def,'secretAccessKey':_0x123549,'region':_0x203fa7});var _0x4c979d={'Text':_0x20f2db,'TextType':_0x31a6ba||_0xb66f('0x7'),'OutputFormat':'mp3','VoiceId':_0x38fe78};return pollyResult(_0x256cec,_0x4c979d,_0x147ebc);}; \ 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 973a686..4945b4c 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 _0x8e47=['exports','./lib/api'];(function(_0xf47edd,_0xc94d56){var _0x2527d7=function(_0x21aba9){while(--_0x21aba9){_0xf47edd['push'](_0xf47edd['shift']());}};_0x2527d7(++_0xc94d56);}(_0x8e47,0x19d));var _0x78e4=function(_0x57f541,_0x226228){_0x57f541=_0x57f541-0x0;var _0x153f9f=_0x8e47[_0x57f541];return _0x153f9f;};'use strict';var asr=require(_0x78e4('0x0'));module[_0x78e4('0x1')]=function(_0x5ebb2f,_0x280fcd,_0x535331,_0x46d995){return asr(_0x5ebb2f,_0x280fcd,_0x535331);}; \ No newline at end of file +var _0x47d2=['exports','./lib/api'];(function(_0x529c67,_0x598053){var _0x3d848a=function(_0x19f849){while(--_0x19f849){_0x529c67['push'](_0x529c67['shift']());}};_0x3d848a(++_0x598053);}(_0x47d2,0xd9));var _0x247d=function(_0x804022,_0x1c1df1){_0x804022=_0x804022-0x0;var _0xf804a8=_0x47d2[_0x804022];return _0xf804a8;};'use strict';var asr=require(_0x247d('0x0'));module[_0x247d('0x1')]=function(_0x420dc7,_0x5e2e8d,_0x1a678b,_0x5bbe59){return asr(_0x420dc7,_0x5e2e8d,_0x1a678b);}; \ 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 7e0557f..14fba40 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 _0x9990=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x9990,0xf6));var _0x0999=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x9990[_0x4f1da5];return _0xe972a8;};'use strict';var url=require('url');var BPromise=require(_0x0999('0x0'));var fs=require('fs');var host=_0x0999('0x1');module[_0x0999('0x2')]=function(_0x46a009,_0x33d7a5,_0x43f491){return new BPromise(function(_0x1fd95b,_0x2754ce){var _0x4e13c1;if(typeof _0x46a009!==_0x0999('0x3')||_0x46a009[_0x0999('0x4')]===0x0){return _0x2754ce(_0x0999('0x5'));}if(typeof _0x33d7a5!=='string'||_0x33d7a5[_0x0999('0x4')]===0x0){return _0x2754ce(_0x0999('0x6'));}if(typeof _0x43f491!==_0x0999('0x7')&&(typeof _0x43f491!==_0x0999('0x3')||_0x43f491[_0x0999('0x4')]===0x0)){return _0x2754ce(_0x0999('0x8'));}try{_0x4e13c1=fs[_0x0999('0x9')](_0x46a009)['toString'](_0x0999('0xa'));}catch(_0x3073d3){return _0x2754ce(_0x3073d3);}return _0x1fd95b({'method':_0x0999('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x33d7a5,'body':{'config':{'encoding':_0x0999('0xc'),'sampleRateHertz':_0x0999('0xd'),'languageCode':_0x43f491},'audio':{'content':_0x4e13c1}},'json':!![]});});}; \ No newline at end of file +var _0x8128=['8000','url','exports','length','filepath\x20should\x20be\x20a\x20string','string','undefined','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x581e01,_0x241cbd){var _0x558b54=function(_0x22a370){while(--_0x22a370){_0x581e01['push'](_0x581e01['shift']());}};_0x558b54(++_0x241cbd);}(_0x8128,0x1b1));var _0x8812=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x8128[_0x1969a7];return _0x3d665f;};'use strict';var url=require(_0x8812('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x8812('0x1')]=function(_0x1e472a,_0x4efc58,_0x5dbf05){return new BPromise(function(_0x1c189a,_0x2aeddc){var _0x21b1d5;if(typeof _0x1e472a!=='string'||_0x1e472a[_0x8812('0x2')]===0x0){return _0x2aeddc(_0x8812('0x3'));}if(typeof _0x4efc58!==_0x8812('0x4')||_0x4efc58[_0x8812('0x2')]===0x0){return _0x2aeddc('key\x20should\x20be\x20a\x20string');}if(typeof _0x5dbf05!==_0x8812('0x5')&&(typeof _0x5dbf05!==_0x8812('0x4')||_0x5dbf05['length']===0x0)){return _0x2aeddc('lang\x20should\x20be\x20a\x20string');}try{_0x21b1d5=fs['readFileSync'](_0x1e472a)[_0x8812('0x6')](_0x8812('0x7'));}catch(_0x40c677){return _0x2aeddc(_0x40c677);}return _0x1c189a({'method':_0x8812('0x8'),'uri':host+_0x8812('0x9')+_0x4efc58,'body':{'config':{'encoding':_0x8812('0xa'),'sampleRateHertz':_0x8812('0xb'),'languageCode':_0x5dbf05},'audio':{'content':_0x21b1d5}},'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 0c40b12..dba6b64 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 _0xedc2=['./asr'];(function(_0x5b3fc2,_0x22d88d){var _0x34c90e=function(_0x465386){while(--_0x465386){_0x5b3fc2['push'](_0x5b3fc2['shift']());}};_0x34c90e(++_0x22d88d);}(_0xedc2,0x1e8));var _0x2edc=function(_0x13950c,_0xd6ae5d){_0x13950c=_0x13950c-0x0;var _0x26acdc=_0xedc2[_0x13950c];return _0x26acdc;};var asr=require(_0x2edc('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xa43d=['exports','./asr'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0xa43d,0x153));var _0xda43=function(_0x310043,_0x435e95){_0x310043=_0x310043-0x0;var _0x43283d=_0xa43d[_0x310043];return _0x43283d;};var asr=require(_0xda43('0x0'));module[_0xda43('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 d29f672..3bbd2ad 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 _0xbced=['resolve','tmp','generate','writeFileSync','unlink','chmodSync','base64','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','from','audioContent','writeFile','777','.wav','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','stringify','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','createWriteStream','finish','finish\x20download\x20file','close','download\x20error','pipe','end','data','error\x20convert','info','start'];(function(_0xb233c0,_0x2e5a18){var _0x1f92d8=function(_0x599163){while(--_0x599163){_0xb233c0['push'](_0xb233c0['shift']());}};_0x1f92d8(++_0x2e5a18);}(_0xbced,0x66));var _0xdbce=function(_0x54ae98,_0xd4550e){_0x54ae98=_0x54ae98-0x0;var _0x58fbdf=_0xbced[_0x54ae98];return _0x58fbdf;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xdbce('0x0'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xdbce('0x1'));var path=require(_0xdbce('0x2'));var querystring=require(_0xdbce('0x3'));var rp=require(_0xdbce('0x4'));var rs=require(_0xdbce('0x5'));var sox=require(_0xdbce('0x6'));var tts=require(_0xdbce('0x7'));var urlParse=require(_0xdbce('0x8'))[_0xdbce('0x9')];var util=require('util');var aws=require(_0xdbce('0xa'));var google=require(_0xdbce('0xb'));var sestek=require('./sestek');var tilde=require(_0xdbce('0xc'));var logger=require(_0xdbce('0xd'))(_0xdbce('0xe'));var ISPEECH_API=_0xdbce('0xf');function downloadFile(_0x5de8e8,_0x3b4ab3){return new BPromise(function(_0x4876db,_0x46ebe4){var _0x107af7=urlParse(_0x5de8e8);var _0x38b874=_0x107af7[_0xdbce('0x10')]===_0xdbce('0x11')?https:http;var _0x335748={'host':_0x107af7['host'],'path':_0x107af7[_0xdbce('0x2')],'headers':{'user-agent':_0xdbce('0x12')}};_0x38b874[_0xdbce('0x13')](_0x335748,function(_0x422e34){if(_0x422e34['statusCode']!==0xc8){logger[_0xdbce('0x14')](_0xdbce('0x15')+_0x5de8e8+_0xdbce('0x16')+_0x422e34['statusCode']+'\x20('+_0x422e34[_0xdbce('0x17')]+')');_0x46ebe4(new Error(_0xdbce('0x15')+_0x5de8e8+_0xdbce('0x16')+_0x422e34[_0xdbce('0x18')]+'\x20('+_0x422e34[_0xdbce('0x17')]+')'));return;}var _0x2eef38=fs[_0xdbce('0x19')](_0x3b4ab3);_0x2eef38['on'](_0xdbce('0x1a'),function(){logger['info'](_0xdbce('0x1b'));_0x2eef38[_0xdbce('0x1c')](_0x4876db);});_0x2eef38['on'](_0xdbce('0x14'),function(_0x203757){fs['unlink'](_0x3b4ab3);logger[_0xdbce('0x14')](_0xdbce('0x1d'),_0x203757);_0x46ebe4(_0x203757);});_0x422e34[_0xdbce('0x1e')](_0x2eef38);})['on']('error',function(_0x324ef2){logger[_0xdbce('0x14')](_0x324ef2);_0x46ebe4(_0x324ef2);})[_0xdbce('0x1f')]();});}function uploadFile(_0x3bd16c){return new BPromise(function(_0x2b55a1,_0x2f8e88){var _0xad6d02=urlParse(_0x3bd16c);var _0x40e959=_0xad6d02[_0xdbce('0x10')]===_0xdbce('0x11')?https:http;var _0x29fe43={'host':_0xad6d02['host'],'path':_0xad6d02[_0xdbce('0x2')],'headers':{'user-agent':'WHAT_EVER'}};_0x40e959[_0xdbce('0x13')](_0x29fe43,function(_0x566fa7){if(_0x566fa7[_0xdbce('0x18')]!==0xc8){_0x2f8e88(new Error(_0xdbce('0x15')+_0x3bd16c+_0xdbce('0x16')+_0x566fa7[_0xdbce('0x18')]+'\x20('+_0x566fa7[_0xdbce('0x17')]+')'));return;}var _0x2c7eea='';_0x566fa7['on'](_0xdbce('0x20'),function(_0x12b43d){_0x2c7eea+=_0x12b43d;});_0x566fa7['on'](_0xdbce('0x1f'),function(){_0x2b55a1(_0x2c7eea);});})['on'](_0xdbce('0x14'),function(_0x16ee65){_0x2f8e88(_0x16ee65);})[_0xdbce('0x1f')]();});}function convertFile(_0x24f120,_0x34b884){return new BPromise(function(_0x5dc7b1,_0x20336f){var _0x38c510=sox['transcode'](_0x24f120,_0x34b884,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x38c510['on'](_0xdbce('0x14'),function(_0xc367bd){logger[_0xdbce('0x14')](_0xdbce('0x21'),_0xc367bd);_0x20336f(_0xc367bd);});_0x38c510['on'](_0xdbce('0x1f'),function(){logger[_0xdbce('0x22')]('finish\x20to\x20convert');_0x5dc7b1();});_0x38c510[_0xdbce('0x23')]();});}function base64Decode(_0x12c203,_0x5d8a53){var _0x3d6169=path[_0xdbce('0x24')](__dirname,_0xdbce('0x25'),rs[_0xdbce('0x26')](0x4)+'.wav');fs[_0xdbce('0x27')](_0x3d6169,_0x12c203,'base64');return convertFile(_0x3d6169,_0x5d8a53)['then'](function(){try{fs[_0xdbce('0x28')](_0x3d6169);fs[_0xdbce('0x29')](_0x5d8a53,'777');}catch(_0x173b33){logger[_0xdbce('0x14')](_0x173b33);}return _0x5d8a53['split']('.')[0x0];});}function base64Encode(_0x1f56a7){var _0x28a48e=fs['readFileSync'](_0x1f56a7);return new Buffer(_0x28a48e)['toString'](_0xdbce('0x2a'));}exports[_0xdbce('0x2b')]=function(_0x53ef59,_0x55f90f,_0x1bb972,_0x190fc0,_0x231044,_0x4f8809){var _0x3f003f,_0x431036;var _0x46245d='https://texttospeech.googleapis.com/v1/';var _0x5d18f6=_0xdbce('0x2c')+_0x53ef59;var _0xd75b23={};if(_0x55f90f===_0xdbce('0x2d')){_0xd75b23[_0xdbce('0x2e')]={'ssml':_0x1bb972};}else{_0xd75b23[_0xdbce('0x2e')]={'text':_0x1bb972};};_0xd75b23[_0xdbce('0x2f')]={'languageCode':_0x190fc0,'ssmlGender':_0x231044};_0xd75b23[_0xdbce('0x30')]={'audioEncoding':_0xdbce('0x31'),'sampleRateHertz':0x1f40};var _0x1be093={'url':_0x46245d+_0xdbce('0x32')+_0x5d18f6,'method':_0xdbce('0x33'),'json':!![],'body':_0xd75b23};return rp(_0x1be093)[_0xdbce('0x34')](function(_0x2f429f){return new BPromise(function(_0x3ea4b7,_0x66e7fa){_0x3f003f=path['resolve'](__dirname,_0xdbce('0x25'),rs['generate'](0x4)+'.mp3');var _0x2b1eb9=Buffer[_0xdbce('0x35')](_0x2f429f[_0xdbce('0x36')],_0xdbce('0x2a'));return fs[_0xdbce('0x37')](_0x3f003f,_0x2b1eb9,function(_0x5bda45){_0x66e7fa(_0x5bda45);},function(_0x233b82){fs[_0xdbce('0x29')](_0x3f003f,_0xdbce('0x38'));_0x3ea4b7(_0x233b82);});});})[_0xdbce('0x34')](function(_0xfc0090){_0x431036=path[_0xdbce('0x24')](__dirname,_0xdbce('0x25'),rs[_0xdbce('0x26')](0x4)+_0xdbce('0x39'));return convertFile(_0x3f003f,_0x431036);})['then'](function(){try{fs[_0xdbce('0x28')](_0x3f003f);fs['chmodSync'](_0x431036,_0xdbce('0x38'));}catch(_0x403930){logger[_0xdbce('0x14')](_0x403930);}logger[_0xdbce('0x22')](_0xdbce('0x3a'),_0x431036[_0xdbce('0x3b')]('.')[0x0]);return _0x431036['split']('.')[0x0];});};exports['googleTTS']=function(_0x1eb0a0,_0x54373f){var _0xff33fb=_0xdbce('0x3c');var _0x5582c7,_0x1dcc72;var _0x362bd3;var _0xfd2b96={'encoding':'utf8','method':_0xdbce('0x33'),'timeout':0x2710,'url':_0xff33fb,'headers':{'Content-Type':_0xdbce('0x3d')},'body':_0xdbce('0x3e')+encodeURIComponent(JSON['stringify']([[[_0xdbce('0x3f'),JSON['stringify']([_0x1eb0a0,_0x54373f||'en',![],'null']),null,'generic']]]))};return rp(_0xfd2b96)['then'](function(_0x520422){try{_0x362bd3=eval(_0x520422[_0xdbce('0x40')](0x5))[0x0][0x2];}catch(_0x1e9ebd){throw new Error(_0xdbce('0x41')+_0x520422[_0xdbce('0x20')]);}if(!_0x362bd3){if(_0x1eb0a0[_0xdbce('0x42')]>0xc8){throw new Error(_0xdbce('0x43'));}else{throw new Error(_0xdbce('0x44')+_0x54373f+'\x22\x20might\x20not\x20exist');}}try{_0x362bd3=eval(_0x362bd3)[0x0];}catch(_0x185a3a){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x4e9c3e=_0x362bd3;_0x5582c7=path['resolve'](__dirname,'tmp',rs[_0xdbce('0x26')](0x4)+'.mp3');fs[_0xdbce('0x27')](_0x5582c7,_0x362bd3,{'encoding':_0xdbce('0x2a')});_0x1dcc72=path[_0xdbce('0x24')](__dirname,'tmp',rs[_0xdbce('0x26')](0x4)+_0xdbce('0x39'));return convertFile(_0x5582c7,_0x1dcc72);})[_0xdbce('0x34')](function(){try{fs[_0xdbce('0x28')](_0x5582c7);fs[_0xdbce('0x29')](_0x1dcc72,'777');}catch(_0xb90194){logger[_0xdbce('0x14')](_0xb90194);}logger['info']('goggleTTS\x20path',_0x1dcc72[_0xdbce('0x3b')]('.')[0x0]);return _0x1dcc72[_0xdbce('0x3b')]('.')[0x0];});};exports[_0xdbce('0x45')]=function(_0x19176b,_0x30cfdf,_0x3855be){return google[_0xdbce('0x46')](_0x19176b,_0x30cfdf,_0x3855be)[_0xdbce('0x34')](function(_0x47662f){logger[_0xdbce('0x22')](_0x47662f[_0xdbce('0x47')]);return rp(_0x47662f);})[_0xdbce('0x34')](function(_0x5455c0){var _0x324f30='';var _0x3d77ce=0x0;try{fs['unlink'](_0x19176b);}catch(_0x3645c5){logger[_0xdbce('0x14')](_0x3645c5);}if(_0x5455c0&&_0x5455c0[_0xdbce('0x48')]){_0x324f30=_0x5455c0[_0xdbce('0x48')][_0xdbce('0x49')](function(_0x16150c){return _0x16150c&&_0x16150c[_0xdbce('0x4a')][0x0]&&_0x16150c[_0xdbce('0x4a')][0x0][_0xdbce('0x4b')]?_0x16150c[_0xdbce('0x4a')][0x0][_0xdbce('0x4b')]:'';})[_0xdbce('0x4c')]('\x0a');_0x3d77ce=_0x5455c0[_0xdbce('0x48')]['map'](function(_0x4d1770){return _0x4d1770&&_0x4d1770[_0xdbce('0x4a')][0x0]&&_0x4d1770['alternatives'][0x0][_0xdbce('0x4d')]?_0x4d1770[_0xdbce('0x4a')][0x0][_0xdbce('0x4d')]:0x0;})[_0xdbce('0x4c')]('\x0a');}logger[_0xdbce('0x22')](_0xdbce('0x4e'),_0x324f30);logger[_0xdbce('0x22')](_0xdbce('0x4f'),_0x3d77ce);return{'transcript':_0x324f30,'confidence':_0x3d77ce};})[_0xdbce('0x50')](function(_0x286ceb){logger[_0xdbce('0x14')](_0xdbce('0x51'),_0x286ceb[_0xdbce('0x18')],_0x286ceb[_0xdbce('0x52')],_0x286ceb['message']);});};exports[_0xdbce('0x53')]=function(_0x1bce67,_0x25a085,_0x39b8e8,_0x209f1d){var _0x3fefd3=apiai(_0x25a085,{'language':_0x209f1d||'en'});return _0x3fefd3[_0xdbce('0x54')](_0x39b8e8,{'sessionId':md5(_0x1bce67)})[_0xdbce('0x34')](function(_0x154332){logger[_0xdbce('0x22')](JSON['stringify'](_0x154332));return{'source':_0x154332[_0xdbce('0x55')][_0xdbce('0x56')],'resolvedQuery':_0x154332[_0xdbce('0x55')][_0xdbce('0x57')],'action':_0x154332[_0xdbce('0x55')][_0xdbce('0x58')],'actionIncomplete':_0x154332[_0xdbce('0x55')][_0xdbce('0x59')],'speech':_0x154332['result']['fulfillment'][_0xdbce('0x5a')],'score':_0x154332[_0xdbce('0x55')][_0xdbce('0x5b')],'statusCode':_0x154332[_0xdbce('0x5c')][_0xdbce('0x5d')],'endConversation':_0x154332[_0xdbce('0x55')][_0xdbce('0x5e')][_0xdbce('0x5f')]||![],'isFallbackIntent':_0x154332['result'][_0xdbce('0x5e')][_0xdbce('0x60')]};});};exports[_0xdbce('0x61')]=function(_0x5a3c51,_0x356bc5,_0x359485,_0x4a8114,_0xb9a4f5,_0xcce1e2){var _0x6ccee2=_0x4a8114[_0xdbce('0x62')](/\\n/g,'\x0a');var _0x42245f={'credentials':{'private_key':_0x6ccee2,'client_email':_0x359485}};var _0xf2a07e=new dialogflow[(_0xdbce('0x63'))](_0x42245f);var _0x13be16=_0xf2a07e[_0xdbce('0x64')](_0x356bc5,md5(_0x5a3c51));var _0x4a06c8={'session':_0x13be16,'queryInput':{'text':{'text':_0xb9a4f5,'languageCode':_0xcce1e2}}};return _0xf2a07e[_0xdbce('0x65')](_0x4a06c8)[_0xdbce('0x34')](function(_0x30605d){if(_0x30605d&&_0x30605d[_0xdbce('0x42')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0xdbce('0x66')](_0x30605d));var _0xab894e=_0x30605d[0x0];if(_0xab894e){var _0x12baf7={'action':_0xab894e[_0xdbce('0x67')][_0xdbce('0x58')],'allRequiredParamsPresent':_0xab894e[_0xdbce('0x67')][_0xdbce('0x68')],'endConversation':_0xab894e[_0xdbce('0x67')][_0xdbce('0x69')]&&_0xab894e[_0xdbce('0x67')][_0xdbce('0x69')][_0xdbce('0x6a')]?_0xab894e['queryResult'][_0xdbce('0x69')][_0xdbce('0x6a')][_0xdbce('0x6b')]['boolValue']:![],'fulfillmentText':_0xab894e[_0xdbce('0x67')]['fulfillmentText'],'intentName':_0xab894e['queryResult']['intent'][_0xdbce('0x52')],'intentDisplayName':_0xab894e[_0xdbce('0x67')][_0xdbce('0x6c')][_0xdbce('0x6d')],'isFallbackIntent':_0xab894e[_0xdbce('0x67')][_0xdbce('0x6c')][_0xdbce('0x6e')],'languageCode':_0xab894e['queryResult']['languageCode'],'queryText':_0xab894e[_0xdbce('0x67')][_0xdbce('0x6f')],'responseId':_0xab894e[_0xdbce('0x70')],'score':_0xab894e['queryResult']['intentDetectionConfidence'],'speech':_0xab894e[_0xdbce('0x67')][_0xdbce('0x71')],'providerResponse':JSON[_0xdbce('0x66')](_0x30605d)};return _0x12baf7;}}});};exports[_0xdbce('0x72')]=function(_0x3f4388,_0x4c4b7e,_0x489839,_0x4d194c){return tilde[_0xdbce('0x46')](_0x3f4388,_0x4c4b7e,_0x489839,_0x4d194c)[_0xdbce('0x34')](function(_0x56bc63){try{fs[_0xdbce('0x28')](_0x3f4388);}catch(_0x2071cc){logger[_0xdbce('0x14')](_0x2071cc);}logger[_0xdbce('0x22')](_0xdbce('0x73'),_0x56bc63[_0xdbce('0x4b')]);logger[_0xdbce('0x22')](_0xdbce('0x74'),_0x56bc63[_0xdbce('0x4d')]);return _0x56bc63;});};exports[_0xdbce('0x75')]=function(_0x2da2e7,_0x5dc591,_0xfbe28,_0x5ebedb,_0x38f5dd,_0x3966c5){var _0x4047cd=path['resolve'](__dirname,'tmp',rs[_0xdbce('0x26')](0x4)+_0xdbce('0x76'));var _0x239802;return aws[_0xdbce('0x77')](_0x2da2e7,_0x5dc591,_0xfbe28,_0x5ebedb,_0x38f5dd,_0x3966c5,_0x4047cd)[_0xdbce('0x34')](function(){_0x239802=path[_0xdbce('0x24')](__dirname,_0xdbce('0x25'),rs[_0xdbce('0x26')](0x4)+'.wav');return convertFile(_0x4047cd,_0x239802);})[_0xdbce('0x34')](function(){try{fs[_0xdbce('0x28')](_0x4047cd);fs[_0xdbce('0x29')](_0x239802,'777');}catch(_0x3887c9){logger[_0xdbce('0x14')](_0x3887c9);}return _0x239802['split']('.')[0x0];});};exports[_0xdbce('0x78')]=function(_0x4b4d24,_0x41087c,_0x331b81,_0x2cb457,_0x132da4,_0x1c0d61){return aws[_0xdbce('0x79')](_0x4b4d24,_0x41087c,_0x331b81,_0x2cb457,_0x132da4,_0x1c0d61)[_0xdbce('0x34')](function(_0x2642fd){logger['info'](JSON[_0xdbce('0x66')](_0x2642fd));return _0x2642fd;});};exports[_0xdbce('0x7a')]=function(_0x5b2a9b,_0x36a814,_0x5f45e2,_0x2498fb){var _0xe969c4=util[_0xdbce('0x7b')](_0xdbce('0x7c'),ISPEECH_API,_0x5b2a9b,encodeURIComponent(_0x36a814),_0x5f45e2,_0x2498fb);var _0x405e61=path[_0xdbce('0x24')](__dirname,_0xdbce('0x25'),rs[_0xdbce('0x26')](0x4)+'.mp3');var _0xe34adb;return downloadFile(_0xe969c4,_0x405e61)[_0xdbce('0x34')](function(){_0xe34adb=path['resolve'](__dirname,_0xdbce('0x25'),rs[_0xdbce('0x26')](0x4)+_0xdbce('0x39'));return convertFile(_0x405e61,_0xe34adb);})[_0xdbce('0x34')](function(){try{fs[_0xdbce('0x28')](_0x405e61);fs['chmodSync'](_0xe34adb,_0xdbce('0x38'));}catch(_0x5ad3ee){logger[_0xdbce('0x14')](_0x5ad3ee);}return _0xe34adb[_0xdbce('0x3b')]('.')[0x0];});};exports[_0xdbce('0x7d')]=function(_0x369d7b,_0xa7901d,_0x14d8ab,_0x37a4bc){var _0x4eedbd=util['format'](_0xdbce('0x7e'),ISPEECH_API,_0xa7901d,_0x14d8ab,base64Encode(_0x369d7b),_0x37a4bc?util[_0xdbce('0x7b')](_0xdbce('0x7f'),encodeURIComponent(_0x37a4bc)):'freeform=3');return uploadFile(_0x4eedbd)[_0xdbce('0x34')](function(_0x427ffe){return querystring[_0xdbce('0x9')](_0x427ffe);});};exports[_0xdbce('0x80')]=function(_0x1d919c,_0x94266e){return sestek[_0xdbce('0x81')](_0x1d919c,_0x94266e)['then'](function(_0x2605fb){logger[_0xdbce('0x22')](JSON[_0xdbce('0x66')](_0x2605fb));var _0x44cdd6={'speech':_0x2605fb[_0xdbce('0x82')],'action':_0x2605fb[_0xdbce('0x83')]?_0x2605fb[_0xdbce('0x83')][_0xdbce('0x84')]:undefined,'actiondata':_0x2605fb[_0xdbce('0x83')]?_0x2605fb[_0xdbce('0x83')][_0xdbce('0x85')]:undefined};if(_0x2605fb[_0xdbce('0x83')]&&_0x2605fb[_0xdbce('0x83')][_0xdbce('0x86')]){return base64Decode(_0x2605fb[_0xdbce('0x83')][_0xdbce('0x86')][_0xdbce('0x87')],path[_0xdbce('0x24')](__dirname,_0xdbce('0x25'),rs[_0xdbce('0x26')](0x4)+'.wav'))[_0xdbce('0x34')](function(_0x24b973){_0x44cdd6[_0xdbce('0x88')]=_0x24b973;return _0x44cdd6;});}return _0x44cdd6;});};exports[_0xdbce('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x9de1=['metadata','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','randomstring','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','request\x20to\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','data','wav','error\x20convert','finish\x20to\x20convert','resolve','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','tmp','generate','.mp3','from','audioContent','writeFile','.wav','unlink','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code'];(function(_0x1e3313,_0x36fc14){var _0x413004=function(_0x111562){while(--_0x111562){_0x1e3313['push'](_0x1e3313['shift']());}};_0x413004(++_0x36fc14);}(_0x9de1,0x1c0));var _0x19de=function(_0x62b202,_0x1a9a72){_0x62b202=_0x62b202-0x0;var _0x504cd5=_0x9de1[_0x62b202];return _0x504cd5;};'use strict';var apiai=require(_0x19de('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x19de('0x1'));var fs=require('fs');var http=require(_0x19de('0x2'));var https=require(_0x19de('0x3'));var md5=require(_0x19de('0x4'));var path=require(_0x19de('0x5'));var querystring=require(_0x19de('0x6'));var rp=require('request-promise');var rs=require(_0x19de('0x7'));var sox=require('sox');var tts=require(_0x19de('0x8'));var urlParse=require(_0x19de('0x9'))[_0x19de('0xa')];var util=require(_0x19de('0xb'));var aws=require(_0x19de('0xc'));var google=require(_0x19de('0xd'));var sestek=require(_0x19de('0xe'));var tilde=require(_0x19de('0xf'));var logger=require(_0x19de('0x10'))(_0x19de('0x11'));var ISPEECH_API=_0x19de('0x12');function downloadFile(_0x551eb3,_0x275994){return new BPromise(function(_0x25c989,_0xe6ac16){var _0x2fb3c6=urlParse(_0x551eb3);var _0x818684=_0x2fb3c6['protocol']===_0x19de('0x13')?https:http;var _0x57995a={'host':_0x2fb3c6[_0x19de('0x14')],'path':_0x2fb3c6[_0x19de('0x5')],'headers':{'user-agent':_0x19de('0x15')}};_0x818684[_0x19de('0x16')](_0x57995a,function(_0x549579){if(_0x549579[_0x19de('0x17')]!==0xc8){logger[_0x19de('0x18')]('request\x20to\x20'+_0x551eb3+_0x19de('0x19')+_0x549579[_0x19de('0x17')]+'\x20('+_0x549579['statusMessage']+')');_0xe6ac16(new Error(_0x19de('0x1a')+_0x551eb3+_0x19de('0x19')+_0x549579[_0x19de('0x17')]+'\x20('+_0x549579[_0x19de('0x1b')]+')'));return;}var _0x5a4a22=fs[_0x19de('0x1c')](_0x275994);_0x5a4a22['on']('finish',function(){logger[_0x19de('0x1d')](_0x19de('0x1e'));_0x5a4a22[_0x19de('0x1f')](_0x25c989);});_0x5a4a22['on'](_0x19de('0x18'),function(_0x5a8d26){fs['unlink'](_0x275994);logger[_0x19de('0x18')](_0x19de('0x20'),_0x5a8d26);_0xe6ac16(_0x5a8d26);});_0x549579[_0x19de('0x21')](_0x5a4a22);})['on'](_0x19de('0x18'),function(_0x783078){logger['error'](_0x783078);_0xe6ac16(_0x783078);})[_0x19de('0x22')]();});}function uploadFile(_0x3bcf8e){return new BPromise(function(_0x3082e9,_0x6c9a96){var _0x29edf6=urlParse(_0x3bcf8e);var _0x68c6f5=_0x29edf6[_0x19de('0x23')]===_0x19de('0x13')?https:http;var _0x943797={'host':_0x29edf6[_0x19de('0x14')],'path':_0x29edf6[_0x19de('0x5')],'headers':{'user-agent':_0x19de('0x15')}};_0x68c6f5[_0x19de('0x16')](_0x943797,function(_0x55d97f){if(_0x55d97f[_0x19de('0x17')]!==0xc8){_0x6c9a96(new Error(_0x19de('0x1a')+_0x3bcf8e+_0x19de('0x19')+_0x55d97f[_0x19de('0x17')]+'\x20('+_0x55d97f[_0x19de('0x1b')]+')'));return;}var _0x98590d='';_0x55d97f['on'](_0x19de('0x24'),function(_0x5efdf3){_0x98590d+=_0x5efdf3;});_0x55d97f['on']('end',function(){_0x3082e9(_0x98590d);});})['on'](_0x19de('0x18'),function(_0x322add){_0x6c9a96(_0x322add);})['end']();});}function convertFile(_0x4d81c7,_0x212540){return new BPromise(function(_0x3b4040,_0x2e676a){var _0x27fcee=sox['transcode'](_0x4d81c7,_0x212540,{'sampleRate':0x1f40,'format':_0x19de('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27fcee['on'](_0x19de('0x18'),function(_0x14c897){logger['error'](_0x19de('0x26'),_0x14c897);_0x2e676a(_0x14c897);});_0x27fcee['on'](_0x19de('0x22'),function(){logger['info'](_0x19de('0x27'));_0x3b4040();});_0x27fcee['start']();});}function base64Decode(_0x53550c,_0x57e279){var _0x4a838d=path[_0x19de('0x28')](__dirname,'tmp',rs['generate'](0x4)+'.wav');fs[_0x19de('0x29')](_0x4a838d,_0x53550c,_0x19de('0x2a'));return convertFile(_0x4a838d,_0x57e279)[_0x19de('0x2b')](function(){try{fs['unlink'](_0x4a838d);fs[_0x19de('0x2c')](_0x57e279,_0x19de('0x2d'));}catch(_0x5c7d39){logger[_0x19de('0x18')](_0x5c7d39);}return _0x57e279['split']('.')[0x0];});}function base64Encode(_0x4e1aa6){var _0x44fb86=fs[_0x19de('0x2e')](_0x4e1aa6);return new Buffer(_0x44fb86)[_0x19de('0x2f')](_0x19de('0x2a'));}exports['googleCloudTTS']=function(_0x2d823f,_0x2dc850,_0x3c2fb3,_0x49a2ee,_0x14a965,_0x5e9ddd){var _0x49aa04,_0x4461af;var _0x5442e5=_0x19de('0x30');var _0x413c1a=_0x19de('0x31')+_0x2d823f;var _0xdafe88={};if(_0x2dc850===_0x19de('0x32')){_0xdafe88['input']={'ssml':_0x3c2fb3};}else{_0xdafe88[_0x19de('0x33')]={'text':_0x3c2fb3};};_0xdafe88[_0x19de('0x34')]={'languageCode':_0x49a2ee,'ssmlGender':_0x14a965};_0xdafe88[_0x19de('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2fae46={'url':_0x5442e5+_0x19de('0x36')+_0x413c1a,'method':_0x19de('0x37'),'json':!![],'body':_0xdafe88};return rp(_0x2fae46)[_0x19de('0x2b')](function(_0x1046c8){return new BPromise(function(_0x3521c6,_0x4bec54){_0x49aa04=path[_0x19de('0x28')](__dirname,_0x19de('0x38'),rs[_0x19de('0x39')](0x4)+_0x19de('0x3a'));var _0x172a2e=Buffer[_0x19de('0x3b')](_0x1046c8[_0x19de('0x3c')],'base64');return fs[_0x19de('0x3d')](_0x49aa04,_0x172a2e,function(_0x129ebc){_0x4bec54(_0x129ebc);},function(_0x478ee9){fs[_0x19de('0x2c')](_0x49aa04,_0x19de('0x2d'));_0x3521c6(_0x478ee9);});});})[_0x19de('0x2b')](function(_0x31c460){_0x4461af=path[_0x19de('0x28')](__dirname,_0x19de('0x38'),rs['generate'](0x4)+_0x19de('0x3e'));return convertFile(_0x49aa04,_0x4461af);})[_0x19de('0x2b')](function(){try{fs[_0x19de('0x3f')](_0x49aa04);fs[_0x19de('0x2c')](_0x4461af,'777');}catch(_0x32fdef){logger[_0x19de('0x18')](_0x32fdef);}logger['info']('googleCloudTTS\x20path',_0x4461af[_0x19de('0x40')]('.')[0x0]);return _0x4461af[_0x19de('0x40')]('.')[0x0];});};exports[_0x19de('0x41')]=function(_0x14fc50,_0x34adf5){var _0x42dd42=_0x19de('0x42');var _0x2359b9,_0x5823e7;var _0x2f1e81;var _0x4c94e0={'encoding':_0x19de('0x43'),'method':_0x19de('0x37'),'timeout':0x2710,'url':_0x42dd42,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x19de('0x44')+encodeURIComponent(JSON[_0x19de('0x45')]([[[_0x19de('0x46'),JSON[_0x19de('0x45')]([_0x14fc50,_0x34adf5||'en',![],_0x19de('0x47')]),null,_0x19de('0x48')]]]))};return rp(_0x4c94e0)[_0x19de('0x2b')](function(_0x1bc610){try{_0x2f1e81=eval(_0x1bc610[_0x19de('0x49')](0x5))[0x0][0x2];}catch(_0x1cce1e){throw new Error(_0x19de('0x4a')+_0x1bc610[_0x19de('0x24')]);}if(!_0x2f1e81){if(_0x14fc50[_0x19de('0x4b')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x19de('0x4c')+_0x34adf5+_0x19de('0x4d'));}}try{_0x2f1e81=eval(_0x2f1e81)[0x0];}catch(_0x520a48){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x19de('0x24')]);}const _0x514677=_0x2f1e81;_0x2359b9=path[_0x19de('0x28')](__dirname,_0x19de('0x38'),rs['generate'](0x4)+_0x19de('0x3a'));fs['writeFileSync'](_0x2359b9,_0x2f1e81,{'encoding':'base64'});_0x5823e7=path[_0x19de('0x28')](__dirname,_0x19de('0x38'),rs[_0x19de('0x39')](0x4)+_0x19de('0x3e'));return convertFile(_0x2359b9,_0x5823e7);})[_0x19de('0x2b')](function(){try{fs[_0x19de('0x3f')](_0x2359b9);fs[_0x19de('0x2c')](_0x5823e7,'777');}catch(_0x55da7f){logger['error'](_0x55da7f);}logger['info'](_0x19de('0x4e'),_0x5823e7[_0x19de('0x40')]('.')[0x0]);return _0x5823e7[_0x19de('0x40')]('.')[0x0];});};exports[_0x19de('0x4f')]=function(_0x471860,_0x5ab1db,_0x120a11){return google[_0x19de('0x50')](_0x471860,_0x5ab1db,_0x120a11)['then'](function(_0x4b3899){logger[_0x19de('0x1d')](_0x4b3899[_0x19de('0x51')]);return rp(_0x4b3899);})[_0x19de('0x2b')](function(_0x3b9862){var _0x475500='';var _0x49d2b2=0x0;try{fs['unlink'](_0x471860);}catch(_0x14b3c3){logger[_0x19de('0x18')](_0x14b3c3);}if(_0x3b9862&&_0x3b9862[_0x19de('0x52')]){_0x475500=_0x3b9862[_0x19de('0x52')]['map'](function(_0x5d2143){return _0x5d2143&&_0x5d2143[_0x19de('0x53')][0x0]&&_0x5d2143[_0x19de('0x53')][0x0][_0x19de('0x54')]?_0x5d2143[_0x19de('0x53')][0x0][_0x19de('0x54')]:'';})[_0x19de('0x55')]('\x0a');_0x49d2b2=_0x3b9862[_0x19de('0x52')][_0x19de('0x56')](function(_0x45a143){return _0x45a143&&_0x45a143['alternatives'][0x0]&&_0x45a143[_0x19de('0x53')][0x0][_0x19de('0x57')]?_0x45a143[_0x19de('0x53')][0x0]['confidence']:0x0;})[_0x19de('0x55')]('\x0a');}logger[_0x19de('0x1d')](_0x19de('0x58'),_0x475500);logger[_0x19de('0x1d')](_0x19de('0x59'),_0x49d2b2);return{'transcript':_0x475500,'confidence':_0x49d2b2};})[_0x19de('0x5a')](function(_0x38a1a5){logger['error'](_0x19de('0x5b'),_0x38a1a5['statusCode'],_0x38a1a5[_0x19de('0x5c')],_0x38a1a5[_0x19de('0x5d')]);});};exports[_0x19de('0x5e')]=function(_0x16fb21,_0x27ccc0,_0x2d32fc,_0x148e04){var _0x536b8f=apiai(_0x27ccc0,{'language':_0x148e04||'en'});return _0x536b8f['textRequest'](_0x2d32fc,{'sessionId':md5(_0x16fb21)})[_0x19de('0x2b')](function(_0x1515ef){logger['info'](JSON[_0x19de('0x45')](_0x1515ef));return{'source':_0x1515ef[_0x19de('0x5f')][_0x19de('0x60')],'resolvedQuery':_0x1515ef[_0x19de('0x5f')][_0x19de('0x61')],'action':_0x1515ef[_0x19de('0x5f')][_0x19de('0x62')],'actionIncomplete':_0x1515ef[_0x19de('0x5f')][_0x19de('0x63')],'speech':_0x1515ef[_0x19de('0x5f')][_0x19de('0x64')]['speech'],'score':_0x1515ef[_0x19de('0x5f')][_0x19de('0x65')],'statusCode':_0x1515ef[_0x19de('0x66')][_0x19de('0x67')],'endConversation':_0x1515ef[_0x19de('0x5f')][_0x19de('0x68')]['endConversation']||![],'isFallbackIntent':_0x1515ef[_0x19de('0x5f')][_0x19de('0x68')]['isFallbackIntent']};});};exports[_0x19de('0x69')]=function(_0x562eae,_0x3a3218,_0x3c3e02,_0x201b1c,_0x5b5a4c,_0x51ff94){var _0x188598=_0x201b1c[_0x19de('0x6a')](/\\n/g,'\x0a');var _0x442909={'credentials':{'private_key':_0x188598,'client_email':_0x3c3e02}};var _0x2fbaf7=new dialogflow['SessionsClient'](_0x442909);var _0x3f50d5=_0x2fbaf7['sessionPath'](_0x3a3218,md5(_0x562eae));var _0xb4eb07={'session':_0x3f50d5,'queryInput':{'text':{'text':_0x5b5a4c,'languageCode':_0x51ff94}}};return _0x2fbaf7[_0x19de('0x6b')](_0xb4eb07)[_0x19de('0x2b')](function(_0x459db3){if(_0x459db3&&_0x459db3[_0x19de('0x4b')]){logger['info'](_0x19de('0x6c'),JSON[_0x19de('0x45')](_0x459db3));var _0x59c2f1=_0x459db3[0x0];if(_0x59c2f1){var _0x250234={'action':_0x59c2f1['queryResult']['action'],'allRequiredParamsPresent':_0x59c2f1['queryResult'][_0x19de('0x6d')],'endConversation':_0x59c2f1[_0x19de('0x6e')][_0x19de('0x6f')]&&_0x59c2f1[_0x19de('0x6e')][_0x19de('0x6f')]['fields']?_0x59c2f1[_0x19de('0x6e')][_0x19de('0x6f')][_0x19de('0x70')]['end_conversation'][_0x19de('0x71')]:![],'fulfillmentText':_0x59c2f1[_0x19de('0x6e')][_0x19de('0x72')],'intentName':_0x59c2f1[_0x19de('0x6e')][_0x19de('0x73')][_0x19de('0x5c')],'intentDisplayName':_0x59c2f1[_0x19de('0x6e')][_0x19de('0x73')][_0x19de('0x74')],'isFallbackIntent':_0x59c2f1['queryResult'][_0x19de('0x73')][_0x19de('0x75')],'languageCode':_0x59c2f1['queryResult'][_0x19de('0x76')],'queryText':_0x59c2f1[_0x19de('0x6e')][_0x19de('0x77')],'responseId':_0x59c2f1['responseId'],'score':_0x59c2f1[_0x19de('0x6e')][_0x19de('0x78')],'speech':_0x59c2f1['queryResult'][_0x19de('0x72')],'providerResponse':JSON[_0x19de('0x45')](_0x459db3)};return _0x250234;}}});};exports['tildeASR']=function(_0xdfad54,_0x22ed16,_0x444404,_0x1d194d){return tilde[_0x19de('0x50')](_0xdfad54,_0x22ed16,_0x444404,_0x1d194d)['then'](function(_0x53ba18){try{fs[_0x19de('0x3f')](_0xdfad54);}catch(_0x3f1b9e){logger[_0x19de('0x18')](_0x3f1b9e);}logger[_0x19de('0x1d')](_0x19de('0x79'),_0x53ba18[_0x19de('0x54')]);logger[_0x19de('0x1d')](_0x19de('0x7a'),_0x53ba18[_0x19de('0x57')]);return _0x53ba18;});};exports[_0x19de('0x7b')]=function(_0x12e8cf,_0x3a8817,_0x1f9286,_0x55de2a,_0x3c6917,_0x56b800){var _0xd1d895=path['resolve'](__dirname,_0x19de('0x38'),rs[_0x19de('0x39')](0x4)+'.mp3');var _0x33857a;return aws['polly'](_0x12e8cf,_0x3a8817,_0x1f9286,_0x55de2a,_0x3c6917,_0x56b800,_0xd1d895)[_0x19de('0x2b')](function(){_0x33857a=path['resolve'](__dirname,_0x19de('0x38'),rs[_0x19de('0x39')](0x4)+_0x19de('0x3e'));return convertFile(_0xd1d895,_0x33857a);})['then'](function(){try{fs[_0x19de('0x3f')](_0xd1d895);fs[_0x19de('0x2c')](_0x33857a,'777');}catch(_0x566b5d){logger[_0x19de('0x18')](_0x566b5d);}return _0x33857a[_0x19de('0x40')]('.')[0x0];});};exports[_0x19de('0x7c')]=function(_0x4f1a0a,_0xcd9fbb,_0x28e260,_0x32aa92,_0x1a3dad,_0x198538){return aws[_0x19de('0x7d')](_0x4f1a0a,_0xcd9fbb,_0x28e260,_0x32aa92,_0x1a3dad,_0x198538)[_0x19de('0x2b')](function(_0x8e3e42){logger['info'](JSON[_0x19de('0x45')](_0x8e3e42));return _0x8e3e42;});};exports[_0x19de('0x7e')]=function(_0x4388fc,_0x2fdf87,_0x35deec,_0x538b73){var _0x540cf3=util['format'](_0x19de('0x7f'),ISPEECH_API,_0x4388fc,encodeURIComponent(_0x2fdf87),_0x35deec,_0x538b73);var _0x2bbcf2=path['resolve'](__dirname,_0x19de('0x38'),rs['generate'](0x4)+_0x19de('0x3a'));var _0x1e422b;return downloadFile(_0x540cf3,_0x2bbcf2)[_0x19de('0x2b')](function(){_0x1e422b=path[_0x19de('0x28')](__dirname,'tmp',rs[_0x19de('0x39')](0x4)+'.wav');return convertFile(_0x2bbcf2,_0x1e422b);})[_0x19de('0x2b')](function(){try{fs[_0x19de('0x3f')](_0x2bbcf2);fs['chmodSync'](_0x1e422b,_0x19de('0x2d'));}catch(_0x591cab){logger['error'](_0x591cab);}return _0x1e422b[_0x19de('0x40')]('.')[0x0];});};exports['ispeechASR']=function(_0x5d042a,_0x26d890,_0x33a77d,_0x597df4){var _0x9ceec3=util[_0x19de('0x80')](_0x19de('0x81'),ISPEECH_API,_0x26d890,_0x33a77d,base64Encode(_0x5d042a),_0x597df4?util[_0x19de('0x80')]('model=%s',encodeURIComponent(_0x597df4)):_0x19de('0x82'));return uploadFile(_0x9ceec3)['then'](function(_0x9db7ba){return querystring[_0x19de('0xa')](_0x9db7ba);});};exports[_0x19de('0x83')]=function(_0x5e0396,_0x261d9a){return sestek[_0x19de('0x84')](_0x5e0396,_0x261d9a)[_0x19de('0x2b')](function(_0x291d07){logger[_0x19de('0x1d')](JSON['stringify'](_0x291d07));var _0x47d1e6={'speech':_0x291d07[_0x19de('0x85')],'action':_0x291d07[_0x19de('0x86')]?_0x291d07['channelData']['CustomAction']:undefined,'actiondata':_0x291d07[_0x19de('0x86')]?_0x291d07[_0x19de('0x86')]['CustomActionData']:undefined};if(_0x291d07[_0x19de('0x86')]&&_0x291d07['channelData'][_0x19de('0x87')]){return base64Decode(_0x291d07[_0x19de('0x86')][_0x19de('0x87')]['Data'],path[_0x19de('0x28')](__dirname,_0x19de('0x38'),rs[_0x19de('0x39')](0x4)+_0x19de('0x3e')))['then'](function(_0xfaaf59){_0x47d1e6[_0x19de('0x88')]=_0xfaaf59;return _0x47d1e6;});}return _0x47d1e6;});};exports[_0x19de('0x89')]=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 daddca8..c2c871d 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 _0x773a=['./nda','exports'];(function(_0x2b4d19,_0x1ce43f){var _0x143616=function(_0x2775f9){while(--_0x2775f9){_0x2b4d19['push'](_0x2b4d19['shift']());}};_0x143616(++_0x1ce43f);}(_0x773a,0x122));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};var nda=require(_0xa773('0x0'));module[_0xa773('0x1')]={'nda':nda}; \ No newline at end of file +var _0x3ddb=['./nda','exports'];(function(_0x1aa981,_0x45eb1a){var _0x332fd6=function(_0x4f155c){while(--_0x4f155c){_0x1aa981['push'](_0x1aa981['shift']());}};_0x332fd6(++_0x45eb1a);}(_0x3ddb,0x1a4));var _0xb3dd=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x3ddb[_0x29b609];return _0x54c952;};var nda=require(_0xb3dd('0x0'));module[_0xb3dd('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 49d3412..a860b80 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 _0xaa88=['then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','extension','text','access_token','project','body','ProjectName','ndagenerate_audio','channelData','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','username'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa88,0x137));var _0x8aa8=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xaa88[_0x3c6dce];return _0x1450e9;};'use strict';var rp=require(_0x8aa8('0x0'));var url=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));module['exports']=function(_0x4ba9dd,_0x3a5b12){var _0x43f7e4={'method':_0x8aa8('0x4'),'uri':url[_0x8aa8('0x5')](_0x3a5b12[_0x8aa8('0x6')],'/token'),'form':{'grant_type':'password','username':_0x3a5b12[_0x8aa8('0x7')],'password':_0x3a5b12['password']},'json':!![]};return rp(_0x43f7e4)[_0x8aa8('0x8')](function(_0x1ed84d){var _0x27c08d={'method':_0x8aa8('0x4'),'uri':url['resolve'](_0x3a5b12[_0x8aa8('0x9')],_0x8aa8('0xa')),'body':{'type':_0x3a5b12[_0x8aa8('0xb')]||'message','channelId':_0x8aa8('0xc'),'conversation':{'id':_0x4ba9dd[_0x8aa8('0xd')]},'from':{'id':_0x4ba9dd[_0x8aa8('0xe')],'name':_0x4ba9dd[_0x8aa8('0xf')]},'recipient':{'id':_0x4ba9dd['dnid'],'name':_0x4ba9dd[_0x8aa8('0x10')]},'text':_0x3a5b12[_0x8aa8('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x1ed84d[_0x8aa8('0x12')]},'json':!![]};if(_0x3a5b12[_0x8aa8('0x13')]){_0x27c08d[_0x8aa8('0x14')]['channelData'][_0x8aa8('0x15')]=_0x3a5b12[_0x8aa8('0x13')];}if(_0x3a5b12[_0x8aa8('0x16')]=='1'){_0x27c08d['body'][_0x8aa8('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3a5b12[_0x8aa8('0x18')]){_0x27c08d[_0x8aa8('0x14')][_0x8aa8('0x17')][_0x8aa8('0x19')]=_0x3a5b12[_0x8aa8('0x18')];if(_0x3a5b12[_0x8aa8('0x1a')]){_0x27c08d[_0x8aa8('0x14')][_0x8aa8('0x17')][_0x8aa8('0x1b')]=_0x3a5b12['custom_action_data'];}}logger['info'](JSON[_0x8aa8('0x1c')](_0x27c08d));return rp(_0x27c08d);});}; \ No newline at end of file +var _0x8164=['CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','exports','resolve','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','text','project','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action'];(function(_0x1ad126,_0x5e6950){var _0x669be1=function(_0x1b34a3){while(--_0x1b34a3){_0x1ad126['push'](_0x1ad126['shift']());}};_0x669be1(++_0x5e6950);}(_0x8164,0x170));var _0x4816=function(_0xd6c010,_0x5355e6){_0xd6c010=_0xd6c010-0x0;var _0x15893b=_0x8164[_0xd6c010];return _0x15893b;};'use strict';var rp=require(_0x4816('0x0'));var url=require(_0x4816('0x1'));var logger=require(_0x4816('0x2'))('agi');module[_0x4816('0x3')]=function(_0x1e9b3f,_0x568058){var _0x109370={'method':'POST','uri':url[_0x4816('0x4')](_0x568058['ndauth_url'],'/token'),'form':{'grant_type':_0x4816('0x5'),'username':_0x568058['username'],'password':_0x568058['password']},'json':!![]};return rp(_0x109370)[_0x4816('0x6')](function(_0x437b8b){var _0x170e7a={'method':_0x4816('0x7'),'uri':url[_0x4816('0x4')](_0x568058[_0x4816('0x8')],_0x4816('0x9')),'body':{'type':_0x568058[_0x4816('0xa')]||_0x4816('0xb'),'channelId':'Nda','conversation':{'id':_0x1e9b3f[_0x4816('0xc')]},'from':{'id':_0x1e9b3f['callerid'],'name':_0x1e9b3f[_0x4816('0xd')]},'recipient':{'id':_0x1e9b3f[_0x4816('0xe')],'name':_0x1e9b3f['extension']},'text':_0x568058[_0x4816('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x437b8b['access_token']},'json':!![]};if(_0x568058[_0x4816('0x10')]){_0x170e7a['body']['channelData'][_0x4816('0x11')]=_0x568058['project'];}if(_0x568058[_0x4816('0x12')]=='1'){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4816('0x16')};}if(_0x568058[_0x4816('0x17')]){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x18')]=_0x568058[_0x4816('0x17')];if(_0x568058[_0x4816('0x19')]){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x1a')]=_0x568058[_0x4816('0x19')];}}logger[_0x4816('0x1b')](JSON['stringify'](_0x170e7a));return rp(_0x170e7a);});}; \ 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 56c3abf..1521e21 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f5=['./lib/api','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf4f5,0x1f4));var _0x5f4f=function(_0x3468f8,_0x3aa0dd){_0x3468f8=_0x3468f8-0x0;var _0x54d180=_0xf4f5[_0x3468f8];return _0x54d180;};'use strict';var asr=require(_0x5f4f('0x0'));module[_0x5f4f('0x1')]=function(_0x3e21bb,_0x3430e4,_0x4c0086,_0x56e5e8){return asr(_0x3e21bb,_0x3430e4,_0x4c0086,_0x56e5e8);}; \ No newline at end of file +var _0xf91f=['exports'];(function(_0x52b6d2,_0x460bc0){var _0x4617f6=function(_0x1f746b){while(--_0x1f746b){_0x52b6d2['push'](_0x52b6d2['shift']());}};_0x4617f6(++_0x460bc0);}(_0xf91f,0xe8));var _0xff91=function(_0x4d323d,_0x58a451){_0x4d323d=_0x4d323d-0x0;var _0x507ffe=_0xf91f[_0x4d323d];return _0x507ffe;};'use strict';var asr=require('./lib/api');module[_0xff91('0x0')]=function(_0x454066,_0x50316,_0x39cc56,_0x2750b9){return asr(_0x454066,_0x50316,_0x39cc56,_0x2750b9);}; \ 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 8bbd767..c37c5f0 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 _0xf03b=['likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','moment','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','unix','stringify','createReadStream','data','send','close','EOS','terminate','parse','result','final','hypotheses'];(function(_0x5e2f7b,_0x226498){var _0x3c386e=function(_0x34c8e1){while(--_0x34c8e1){_0x5e2f7b['push'](_0x5e2f7b['shift']());}};_0x3c386e(++_0x226498);}(_0xf03b,0x1a5));var _0xbf03=function(_0x531362,_0x38698f){_0x531362=_0x531362-0x0;var _0x3d8fde=_0xf03b[_0x531362];return _0x3d8fde;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbf03('0x0'));var crypto=require(_0xbf03('0x1'));var logger=require('../../../../../../config/logger')(_0xbf03('0x2'));module[_0xbf03('0x3')]=function(_0x48c809,_0x3477a7,_0x2ce4ba,_0xf53aca){return new BPromise(function(_0x10dee0,_0x4bff45){logger[_0xbf03('0x4')]('Tilde\x20URI',_0xf53aca||_0xbf03('0x5'));var _0x5dd16a=new WebSocket(_0xf53aca||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x14ea1b='';var _0x33383b='0';var _0x5108f0='1';var _0x42a368='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x30ad44(_0x2cd94d){var _0x5aa0f6=crypto[_0xbf03('0x6')](_0xbf03('0x7'));_0x5aa0f6[_0xbf03('0x8')](_0x2cd94d);return _0x5aa0f6['digest']('hex');}function _0x21b682(){try{logger[_0xbf03('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x31363c=moment()[_0xbf03('0x9')]();var _0x10cbbe=_0x30ad44(_0x31363c+_0x3477a7+_0x2ce4ba);_0x5dd16a['send'](JSON[_0xbf03('0xa')]({'appID':_0x3477a7,'timestamp':_0x31363c,'appKey':_0x10cbbe}));var _0x3a8fd2=fs[_0xbf03('0xb')](_0x48c809);_0x3a8fd2['on'](_0xbf03('0xc'),function(_0x31b249){_0x5dd16a[_0xbf03('0xd')](_0x31b249);});_0x3a8fd2['on'](_0xbf03('0xe'),function(){_0x5dd16a['send'](_0xbf03('0xf'));});}catch(_0x1bbce6){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x1bbce6));_0x5dd16a[_0xbf03('0x10')]();}}function _0x58cf30(_0x251802){try{if(_0x251802){var _0x5c9042=JSON[_0xbf03('0x11')](_0x251802);switch(_0x5c9042['status']){case 0x0:if(_0x5c9042[_0xbf03('0x12')]){if(_0x5c9042[_0xbf03('0x12')][_0xbf03('0x13')]){logger[_0xbf03('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0xbf03('0xa')](_0x5c9042['result']['hypotheses']));_0x14ea1b=_0x5c9042[_0xbf03('0x12')]['hypotheses'][0x0]['transcript'];_0x33383b=_0x5c9042[_0xbf03('0x12')][_0xbf03('0x14')][0x0][_0xbf03('0x15')];_0x5108f0='0';_0x42a368='Success.';_0x5dd16a[_0xbf03('0x10')]();}}break;case 0x1:logger[_0xbf03('0x4')](_0xbf03('0x16'));_0x5108f0='1';_0x42a368=_0xbf03('0x16');break;case 0x2:logger[_0xbf03('0x4')](_0xbf03('0x17'));_0x5108f0='2';_0x42a368=_0xbf03('0x17');break;case 0x9:logger[_0xbf03('0x4')](_0xbf03('0x18'));_0x5108f0='9';_0x42a368=_0xbf03('0x18');break;case 0xa:logger[_0xbf03('0x4')](_0xbf03('0x19'));_0x5108f0='10';_0x42a368='Authentication\x20failed.';break;case 0xb:logger[_0xbf03('0x4')](_0xbf03('0x1a'));_0x5108f0='11';_0x42a368=_0xbf03('0x1a');}}}catch(_0x537d3e){logger['error'](_0xbf03('0x1b'),JSON[_0xbf03('0xa')](_0x537d3e));_0x5dd16a[_0xbf03('0x10')]();}}function _0x285a12(){logger['info'](_0xbf03('0x1c'));_0x10dee0({'transcript':_0x14ea1b,'confidence':_0x33383b,'status':_0x5108f0,'status_message':_0x42a368});}function _0xd2d4e7(_0x4ebf88){logger[_0xbf03('0x1d')](_0xbf03('0x1e'));if(!_['isNil'](_0x4ebf88)){logger[_0xbf03('0x1d')](_[_0xbf03('0x1f')](_0x4ebf88)?JSON[_0xbf03('0xa')](_0x4ebf88):_0x4ebf88);}}_0x5dd16a['on'](_0xbf03('0x20'),_0x21b682);_0x5dd16a['on'](_0xbf03('0x21'),_0x58cf30);_0x5dd16a['on'](_0xbf03('0xe'),_0x285a12);_0x5dd16a['on']('error',_0xd2d4e7);});}; \ No newline at end of file +var _0x9b4e=['parse','status','result','stringify','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','lodash','crypto','../../../../../../config/logger','agi','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','hex','unix','send','data','error','Tilde\x20ASR\x20send\x20error','terminate'];(function(_0x2e72ce,_0x140a13){var _0x5cfcee=function(_0x3dea60){while(--_0x3dea60){_0x2e72ce['push'](_0x2e72ce['shift']());}};_0x5cfcee(++_0x140a13);}(_0x9b4e,0x19e));var _0xe9b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9b4e[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require('bluebird');var _=require(_0xe9b4('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xe9b4('0x1'));var logger=require(_0xe9b4('0x2'))(_0xe9b4('0x3'));module['exports']=function(_0x4c621a,_0x55afc9,_0x41acdc,_0xb519ce){return new BPromise(function(_0x421cef,_0x533530){logger[_0xe9b4('0x4')](_0xe9b4('0x5'),_0xb519ce||_0xe9b4('0x6'));var _0x198121=new WebSocket(_0xb519ce||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x213618='';var _0x50867c='0';var _0x105c10='1';var _0x10f6e2=_0xe9b4('0x7');function _0x9a9794(_0x4e9e79){var _0x1c4f07=crypto[_0xe9b4('0x8')](_0xe9b4('0x9'));_0x1c4f07[_0xe9b4('0xa')](_0x4e9e79);return _0x1c4f07['digest'](_0xe9b4('0xb'));}function _0x6379ec(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x37d687=moment()[_0xe9b4('0xc')]();var _0x32fb94=_0x9a9794(_0x37d687+_0x55afc9+_0x41acdc);_0x198121[_0xe9b4('0xd')](JSON['stringify']({'appID':_0x55afc9,'timestamp':_0x37d687,'appKey':_0x32fb94}));var _0x17ce1a=fs['createReadStream'](_0x4c621a);_0x17ce1a['on'](_0xe9b4('0xe'),function(_0x4ad7d1){_0x198121[_0xe9b4('0xd')](_0x4ad7d1);});_0x17ce1a['on']('close',function(){_0x198121[_0xe9b4('0xd')]('EOS');});}catch(_0x5c22a0){logger[_0xe9b4('0xf')](_0xe9b4('0x10'),JSON['stringify'](_0x5c22a0));_0x198121[_0xe9b4('0x11')]();}}function _0x5e98c5(_0x31c812){try{if(_0x31c812){var _0x6f16e1=JSON[_0xe9b4('0x12')](_0x31c812);switch(_0x6f16e1[_0xe9b4('0x13')]){case 0x0:if(_0x6f16e1[_0xe9b4('0x14')]){if(_0x6f16e1[_0xe9b4('0x14')]['final']){logger[_0xe9b4('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0xe9b4('0x15')](_0x6f16e1[_0xe9b4('0x14')][_0xe9b4('0x16')]));_0x213618=_0x6f16e1[_0xe9b4('0x14')][_0xe9b4('0x16')][0x0]['transcript'];_0x50867c=_0x6f16e1[_0xe9b4('0x14')][_0xe9b4('0x16')][0x0][_0xe9b4('0x17')];_0x105c10='0';_0x10f6e2=_0xe9b4('0x18');_0x198121[_0xe9b4('0x11')]();}}break;case 0x1:logger[_0xe9b4('0x4')](_0xe9b4('0x7'));_0x105c10='1';_0x10f6e2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xe9b4('0x4')](_0xe9b4('0x19'));_0x105c10='2';_0x10f6e2=_0xe9b4('0x19');break;case 0x9:logger[_0xe9b4('0x4')](_0xe9b4('0x1a'));_0x105c10='9';_0x10f6e2='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xe9b4('0x4')](_0xe9b4('0x1b'));_0x105c10='10';_0x10f6e2=_0xe9b4('0x1b');break;case 0xb:logger[_0xe9b4('0x4')](_0xe9b4('0x1c'));_0x105c10='11';_0x10f6e2=_0xe9b4('0x1c');}}}catch(_0x2e61fe){logger['error'](_0xe9b4('0x1d'),JSON[_0xe9b4('0x15')](_0x2e61fe));_0x198121[_0xe9b4('0x11')]();}}function _0x107523(){logger['info'](_0xe9b4('0x1e'));_0x421cef({'transcript':_0x213618,'confidence':_0x50867c,'status':_0x105c10,'status_message':_0x10f6e2});}function _0xc45cfd(_0x582c72){logger[_0xe9b4('0xf')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xe9b4('0x1f')](_0x582c72)){logger['error'](_[_0xe9b4('0x20')](_0x582c72)?JSON[_0xe9b4('0x15')](_0x582c72):_0x582c72);}}_0x198121['on'](_0xe9b4('0x21'),_0x6379ec);_0x198121['on'](_0xe9b4('0x22'),_0x5e98c5);_0x198121['on'](_0xe9b4('0x23'),_0x107523);_0x198121['on'](_0xe9b4('0xf'),_0xc45cfd);});}; \ 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 5d3a3c6..90cccf2 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 _0x8829=['./asr','exports'];(function(_0x3ba07a,_0x1666c1){var _0x41316e=function(_0x439807){while(--_0x439807){_0x3ba07a['push'](_0x3ba07a['shift']());}};_0x41316e(++_0x1666c1);}(_0x8829,0x134));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};var asr=require(_0x9882('0x0'));module[_0x9882('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe1bc=['./asr','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe1bc,0x158));var _0xce1b=function(_0x8b2577,_0x3e983e){_0x8b2577=_0x8b2577-0x0;var _0x46c4ff=_0xe1bc[_0x8b2577];return _0x46c4ff;};var asr=require(_0xce1b('0x0'));module[_0xce1b('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 4248d0f..356439e 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(_0x502ca3,_0x36be36){var _0x27f42c=function(_0x1e3045){while(--_0x1e3045){_0x502ca3['push'](_0x502ca3['shift']());}};_0x27f42c(++_0x36be36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 047e7b1..b25f5a1 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 _0xbb35=['no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','callback_','random','isNil','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','MALE','audioEncoding','MP3','method','timeout','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','key','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','en-US','tildeASR','appid','appsecret','clear','includes','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isArray','length','isEmpty','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','result','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','callback','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','client_email','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','sayNumber','number','sayphonetic','sayPhonetic','sendMail','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts'];(function(_0xcc8b75,_0x445bb3){var _0x1d070b=function(_0x1db155){while(--_0x1db155){_0xcc8b75['push'](_0xcc8b75['shift']());}};_0x1d070b(++_0x445bb3);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x5f0cbf,_0x43f5ff){_0x5f0cbf=_0x5f0cbf-0x0;var _0x1b79ce=_0xbb35[_0x5f0cbf];return _0x1b79ce;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x5bb3('0x0'));var sh=require(_0x5bb3('0x1'));var odbc=require(_0x5bb3('0x2'))();var rs=require(_0x5bb3('0x3'));var moment=require(_0x5bb3('0x4'));var Mustache=require('mustache');var rp=require(_0x5bb3('0x5'));var logger=require(_0x5bb3('0x6'))(_0x5bb3('0x7'));var config=require(_0x5bb3('0x8'));var shared=require(_0x5bb3('0x9'));var scripts=require(_0x5bb3('0xa'));var FILES_PATH=_0x5bb3('0xb');var recursiveMapAttributes=[_0x5bb3('0xc'),_0x5bb3('0xd')];var verticesWithRetry=['menu',_0x5bb3('0xe'),_0x5bb3('0xf')];var AGIVertices=function(_0x182c0f,_0x383d1b,_0x534872){this[_0x5bb3('0x10')]=_0x182c0f;this['rpc']=_0x383d1b;this[_0x5bb3('0x11')]=_0x534872;};AGIVertices['prototype'][_0x5bb3('0x12')]=function(_0x25a643,_0xf8e37d){this[_0x5bb3('0x13')][_0x5bb3('0x14')](_0x25a643)['then'](function(_0x10e5ee){_0xf8e37d(null,_0x10e5ee?_0x10e5ee[_0x5bb3('0x15')]:![]);})[_0x5bb3('0x16')](function(_0x5a1040){_0xf8e37d(_0x5a1040);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x18')]=function(_0x40e31f,_0xf09aa){this[_0x5bb3('0x13')][_0x5bb3('0x19')](_0x40e31f)[_0x5bb3('0x1a')](function(_0x171369){_0xf09aa(null,_0x171369?_0x171369['name']:![]);})['catch'](function(_0x4aec89){_0xf09aa(_0x4aec89);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1b')]=function(_0x388802,_0x1092df){this[_0x5bb3('0x13')][_0x5bb3('0x1c')](_0x388802)[_0x5bb3('0x1a')](function(_0xbbaf0){_0x1092df(null,_0xbbaf0?_0xbbaf0[_0x5bb3('0x15')]:![]);})[_0x5bb3('0x16')](function(_0x563bce){_0x1092df(_0x563bce);});};AGIVertices['prototype'][_0x5bb3('0x1d')]=function(_0x41c9a5,_0x3b87c8){this[_0x5bb3('0x13')][_0x5bb3('0x1e')](_0x41c9a5)[_0x5bb3('0x1a')](function(_0x2630b4){_0x3b87c8(null,_0x2630b4?_0x2630b4['dsn']:![]);})[_0x5bb3('0x16')](function(_0x3b1325){_0x3b87c8(_0x3b1325);});};AGIVertices[_0x5bb3('0x17')]['getUser']=function(_0x30c982,_0x4e2770){this[_0x5bb3('0x13')]['getUserById'](_0x30c982)[_0x5bb3('0x1a')](function(_0x384f57){_0x4e2770(null,_0x384f57?_0x384f57[_0x5bb3('0x15')]:![]);})[_0x5bb3('0x16')](function(_0x2f9ca3){_0x4e2770(_0x2f9ca3);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1f')]=function(_0x4977df,_0x3701d5){this[_0x5bb3('0x13')]['getTrunkById'](_0x4977df)[_0x5bb3('0x1a')](function(_0x256a5f){_0x3701d5(null,_0x256a5f?_0x256a5f[_0x5bb3('0x15')]:![]);})[_0x5bb3('0x16')](function(_0x21da73){_0x3701d5(_0x21da73);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x20')]=function(_0x242ff8,_0x49f764){var _0x5c1243=this;this[_0x5bb3('0x13')]['getSoundById'](_0x242ff8)[_0x5bb3('0x1a')](function(_0x4ce15a){_0x49f764(null,_0x4ce15a?_0x5c1243[_0x5bb3('0x21')](_0x4ce15a[_0x5bb3('0x22')]):![]);})[_0x5bb3('0x16')](function(_0x55beda){_0x49f764(_0x55beda);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x23')]=function(_0x461109,_0x2cd20c){this['rpc']['getMailAccountById'](_0x461109)[_0x5bb3('0x1a')](function(_0x4f0ca6){_0x2cd20c(null,_0x4f0ca6?_0x4f0ca6:![]);})[_0x5bb3('0x16')](function(_0x33489e){_0x2cd20c(_0x33489e);});};AGIVertices['prototype'][_0x5bb3('0x24')]=function(_0xd935a7,_0x3d7115,_0xe5981a){this[_0x5bb3('0x11')][_0x5bb3('0x24')](_0xd935a7,_0x3d7115)[_0x5bb3('0x1a')](function(){_0xe5981a(null);})['catch'](function(_0x554fc0){_0xe5981a(_0x554fc0);});};AGIVertices['prototype'][_0x5bb3('0x25')]=function(_0x2e6122,_0x361dc9){this[_0x5bb3('0x13')]['getIntervalById'](_0x2e6122)['then'](function(_0x25708d){if(_0x25708d){if(_0x25708d[_0x5bb3('0x26')]){_0x361dc9(null,[_0x25708d[_0x5bb3('0x27')]]);}else{_0x361dc9(null,_[_0x5bb3('0x28')](_0x25708d[_0x5bb3('0x29')],_0x5bb3('0x27')));}}else{_0x361dc9(null,![]);}})['catch'](function(_0x3db671){_0x361dc9(_0x3db671);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x21')]=function(_0x139977){return util[_0x5bb3('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x139977);};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x2b')]=function(_0x40f790,_0x12c9fb,_0x2a985e){odbc[_0x5bb3('0x2c')](_0x40f790,function(_0x35b769){if(_0x35b769){logger[_0x5bb3('0x2d')](_0x5bb3('0x2e'),_0x35b769);_0x2a985e(_0x35b769);}else{logger[_0x5bb3('0x2f')]('ODBC\x20connection\x20successfully');odbc[_0x5bb3('0x30')](_0x12c9fb,function(_0x3f4579,_0x26cea9){if(_0x3f4579){logger[_0x5bb3('0x2f')](_0x5bb3('0x31'),_0x12c9fb);_0x2a985e(_0x3f4579);}else{logger[_0x5bb3('0x2f')](_0x5bb3('0x32'),_0x12c9fb);odbc[_0x5bb3('0x33')](function(_0x3e569a){if(_0x3e569a){logger[_0x5bb3('0x2d')](_0x5bb3('0x34'),_0x3e569a);}_0x2a985e(null,_0x26cea9);});}});}});};AGIVertices['prototype'][_0x5bb3('0x35')]=function(_0x294f6a,_0x4f0612){this[_0x5bb3('0x13')][_0x5bb3('0x36')](_0x294f6a)[_0x5bb3('0x1a')](function(_0x390bfb){_0x4f0612(null,_0x390bfb?_0x390bfb:![]);})[_0x5bb3('0x16')](function(_0x489d66){_0x4f0612(_0x489d66);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x37')]=function(_0x2330fe,_0x597d4b){this[_0x5bb3('0x13')][_0x5bb3('0x37')](_0x2330fe)['then'](function(_0x6d6c39){_0x597d4b(null,_0x6d6c39);})['catch'](function(_0x1db2c9){_0x597d4b(_0x1db2c9);});};AGIVertices[_0x5bb3('0x17')]['createSquareDetailsReport']=function(_0x2f20c7,_0x4d43da,_0x29bc08){this[_0x5bb3('0x13')][_0x5bb3('0x38')]({'uniqueid':this[_0x5bb3('0x10')][_0x5bb3('0x39')],'node':_0x2f20c7[_0x5bb3('0x3a')],'application':_0x2f20c7['agicommand'],'data':_0x4d43da||null,'project_name':this[_0x5bb3('0x10')][_0x5bb3('0x3b')],'callerid':this[_0x5bb3('0x10')][_0x5bb3('0x3c')]})['then'](function(_0x29f54f){if(_0x29bc08){_0x29bc08(null,_0x29f54f);}})[_0x5bb3('0x16')](function(_0x3f46c8){if(_0x29bc08){_0x29bc08(_0x3f46c8);}});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x3d')]=function(_0x1ee6f7,_0x408bd4,_0x3bc8aa,_0x3ffc7b){this['rpc'][_0x5bb3('0x3d')]({'uniqueid':this[_0x5bb3('0x10')][_0x5bb3('0x39')],'callerid':this[_0x5bb3('0x10')][_0x5bb3('0x3c')],'calleridname':this[_0x5bb3('0x10')][_0x5bb3('0x3e')],'context':this[_0x5bb3('0x10')][_0x5bb3('0x3f')],'extension':this[_0x5bb3('0x10')][_0x5bb3('0x40')],'priority':this[_0x5bb3('0x10')][_0x5bb3('0x41')],'accountcode':this[_0x5bb3('0x10')][_0x5bb3('0x42')],'dnid':this[_0x5bb3('0x10')][_0x5bb3('0x43')],'projectName':this[_0x5bb3('0x10')][_0x5bb3('0x3b')],'saveName':_0x408bd4,'filename':_0x1ee6f7[_0x5bb3('0x44')]||_0x408bd4,'savePath':_0x3bc8aa})[_0x5bb3('0x1a')](function(_0x207bb6){_0x3ffc7b(null,_0x207bb6);})[_0x5bb3('0x16')](function(_0x14f8ad){_0x3ffc7b(_0x14f8ad);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x45')]=function(_0xca906f,_0x444733,_0x24756a,_0x204cba,_0x1a5746){this['rpc'][_0x5bb3('0x45')]({'uniqueid':this[_0x5bb3('0x10')]['uniqueid'],'body':_0xca906f,'direction':_0x444733,'providerName':_0x24756a,'providerResponse':_0x204cba})[_0x5bb3('0x1a')](function(_0xa2fc6e){if(_0x1a5746){_0x1a5746(null,_0xa2fc6e);}})[_0x5bb3('0x16')](function(_0x49f73a){if(_0x1a5746){_0x1a5746(_0x49f73a);}});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x46')]=function(_0x163147,_0x44e6df){this[_0x5bb3('0x13')][_0x5bb3('0x46')]({'firstName':_['isEmpty'](_0x163147[_0x5bb3('0x15')])||_['isNil'](_0x163147[_0x5bb3('0x15')])?_0x5bb3('0x47')+Math[_0x5bb3('0x48')]():_0x163147[_0x5bb3('0x15')],'lastName':_['isEmpty'](_0x163147['lastName'])||_[_0x5bb3('0x49')](_0x163147[_0x5bb3('0x4a')])?null:_0x163147['lastName'],'phone':_0x163147['phone'],'ListId':_0x163147[_0x5bb3('0x4b')],'scheduledat':_0x163147[_0x5bb3('0x4c')],'callbackUniqueid':this[_0x5bb3('0x10')][_0x5bb3('0x39')],'tags':'callback','description':_0x5bb3('0x4d')+_0x163147[_0x5bb3('0x4c')][_0x5bb3('0x4e')](),'priority':_0x163147[_0x5bb3('0x4f')]})['then'](function(_0x339c79){_0x44e6df(null,_0x339c79);})[_0x5bb3('0x16')](function(_0x30d6a6){_0x44e6df(_0x30d6a6);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x50')]=function(_0x4eb322,_0x5e0b9d){this['rpc'][_0x5bb3('0x51')](_0x4eb322)['then'](function(_0x216d74){_0x5e0b9d(null,_0x216d74?_0x216d74[_0x5bb3('0x15')]:![]);})['catch'](function(_0x31eba1){_0x5e0b9d(_0x31eba1);});};AGIVertices[_0x5bb3('0x17')]['agentPause']=function(_0x5be32c,_0x431cb9,_0x357bfe){var _0x207a02={'role':_0x5bb3('0x52')};_0x207a02[_0x5be32c]=this[_0x5bb3('0x10')][_0x5bb3('0x3c')];this['rpc'][_0x5bb3('0x53')](_0x207a02,_0x431cb9,this[_0x5bb3('0x10')][_0x5bb3('0x39')])[_0x5bb3('0x1a')](function(_0x153341){_0x357bfe(null,_[_0x5bb3('0x49')](_0x153341)?![]:!![]);})[_0x5bb3('0x16')](function(_0x23d799){logger['error'](_0x23d799);_0x357bfe(null,![]);});};AGIVertices[_0x5bb3('0x17')]['agentUnpause']=function(_0xf3a144,_0x420f80){var _0x318327={'role':_0x5bb3('0x52')};_0x318327[_0xf3a144]=this['channel'][_0x5bb3('0x3c')];this['rpc'][_0x5bb3('0x54')](_0x318327)[_0x5bb3('0x1a')](function(_0x5dc615){_0x420f80(null,_[_0x5bb3('0x49')](_0x5dc615)?![]:!![]);})[_0x5bb3('0x16')](function(_0x146043){logger[_0x5bb3('0x2d')](_0x146043);_0x420f80(null,![]);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x55')]=function(_0x23bf9f,_0x2338d7){var _0x48c3c6={'role':'agent'};_0x48c3c6[_0x23bf9f]=this[_0x5bb3('0x10')][_0x5bb3('0x3c')];this[_0x5bb3('0x13')]['agentLogout'](_0x48c3c6)[_0x5bb3('0x1a')](function(_0x30be44){_0x2338d7(null,_[_0x5bb3('0x49')](_0x30be44)?![]:!![]);})[_0x5bb3('0x16')](function(_0x37dbd5){logger['error'](_0x37dbd5);_0x2338d7(null,![]);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x56')]=function(_0x4e8ed7,_0x38fcc6){var _0x400f8b={'role':_0x5bb3('0x52')};_0x400f8b[_0x4e8ed7]=this[_0x5bb3('0x10')]['callerid'];var _0x2b320d=_0x4e8ed7!=_0x5bb3('0x57')?util[_0x5bb3('0x2a')](_0x5bb3('0x58'),_0x5bb3('0x59'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')]):undefined;this['rpc'][_0x5bb3('0x56')](_0x400f8b,_0x2b320d)[_0x5bb3('0x1a')](function(_0xf89c58){_0x38fcc6(null,_[_0x5bb3('0x49')](_0xf89c58)?![]:!![]);})[_0x5bb3('0x16')](function(_0x11e8b2){logger[_0x5bb3('0x2d')](_0x11e8b2);_0x38fcc6(null,![]);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x5a')]=function(_0x1749b3,_0x6ac10a){sh[_0x5bb3('0x5b')](_['trim'](_0x1749b3),function(_0x20ade7,_0x993b79){var _0x2c3616=_0x993b79[_0x5bb3('0x5c')](/(\r\n|\n|\r)/gm,'');_0x6ac10a(null,_0x2c3616);});};AGIVertices['prototype'][_0x5bb3('0x5d')]=function(_0x42819f,_0x424dca){scripts[_0x5bb3('0x5d')](_0x42819f[_0x5bb3('0x5e')],_0x42819f['google_cloud_tts_text_type']||_0x5bb3('0x5f'),_0x42819f[_0x5bb3('0x5f')],_0x42819f[_0x5bb3('0x60')]||'en-US',_0x42819f['ssmlGender']||_0x5bb3('0x61'),_0x42819f[_0x5bb3('0x62')]||_0x5bb3('0x63'))[_0x5bb3('0x1a')](function(_0x502a34){_0x424dca(null,_0x502a34);})[_0x5bb3('0x16')](function(_0x30a3fc){_0x424dca(_0x30a3fc);});};AGIVertices[_0x5bb3('0x17')]['googleTTS']=function(_0x45a8c3,_0x479615){scripts['googleTTS'](_0x45a8c3[_0x5bb3('0x5f')],_0x45a8c3['google_tts_language']||'en',0x1)[_0x5bb3('0x1a')](function(_0x39ce15){_0x479615(null,_0x39ce15);})['catch'](function(_0x4f66fb){_0x479615(_0x4f66fb);});};AGIVertices['prototype']['restAPI']=function(_0x4f21c2,_0x434419){var _0x295cd1={'uri':_0x4f21c2['url'],'method':_0x4f21c2[_0x5bb3('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4f21c2[_0x5bb3('0x65')])==='number'&&parseInt(_0x4f21c2[_0x5bb3('0x65')])>=0x1?parseInt(_0x4f21c2[_0x5bb3('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x5bb3('0x66'),'PUT'],_0x295cd1[_0x5bb3('0x64')][_0x5bb3('0x67')]())){try{_0x295cd1[_0x5bb3('0x68')]=_0x4f21c2[_0x5bb3('0xd')]?JSON[_0x5bb3('0x69')](_0x4f21c2[_0x5bb3('0xd')]):{};}catch(_0xa6d6ad){logger[_0x5bb3('0x2d')](_0x5bb3('0x6a'),_0xa6d6ad);}}try{_0x295cd1[_0x5bb3('0x6b')]=_0x4f21c2[_0x5bb3('0xc')]?JSON[_0x5bb3('0x69')](_0x4f21c2[_0x5bb3('0xc')]):{};}catch(_0x5dae8a){logger['error'](_0x5bb3('0x6c'),_0x5dae8a);}if(_0x4f21c2[_0x5bb3('0x6d')]){try{var _0x3829b8=require(_0x4f21c2[_0x5bb3('0x6d')])[_0x5bb3('0x6e')](this,_0x295cd1);_0x295cd1[_0x5bb3('0x6f')]=Mustache[_0x5bb3('0x70')](_0x4f21c2[_0x5bb3('0x71')],_0x3829b8,{},['$$','$$']);if(_0x295cd1[_0x5bb3('0x6b')]){_0x295cd1[_0x5bb3('0x6b')]=JSON[_0x5bb3('0x69')](Mustache[_0x5bb3('0x70')](JSON[_0x5bb3('0x72')](_0x295cd1[_0x5bb3('0x6b')]),_0x3829b8,{},['$$','$$']));}if(_0x295cd1[_0x5bb3('0x68')]){_0x295cd1['body']=JSON[_0x5bb3('0x69')](Mustache['render'](JSON[_0x5bb3('0x72')](_0x295cd1[_0x5bb3('0x68')]),_0x3829b8,{},['$$','$$']));}}catch(_0x278b67){logger[_0x5bb3('0x2d')](_0x5bb3('0x73'),_0x278b67);}}rp(_0x295cd1)['then'](function(_0x3c7f46){var _0x547c8f={'statusCode':_0x3c7f46[_0x5bb3('0x74')]||0xc8,'statusMessage':_0x3c7f46[_0x5bb3('0x75')]||'OK','headers':_0x3c7f46[_0x5bb3('0x6b')]||{},'body':_0x3c7f46[_0x5bb3('0x68')]||{}};_0x434419(null,_0x547c8f);})[_0x5bb3('0x16')](function(_0x3a23b6){var _0x4984c4={'statusCode':_0x3a23b6[_0x5bb3('0x74')]||0x1f4,'statusMessage':_0x3a23b6[_0x5bb3('0x76')]||_0x5bb3('0x77'),'headers':_0x3a23b6[_0x5bb3('0x78')][_0x5bb3('0x6b')]||{},'body':_0x3a23b6['options'][_0x5bb3('0x68')]||{}};_0x434419(null,_0x4984c4);});};AGIVertices[_0x5bb3('0x17')]['googleDialogflow']=function(_0x218d17,_0x1d5045){scripts[_0x5bb3('0x79')](this[_0x5bb3('0x10')][_0x5bb3('0x39')],_0x218d17['key'],_0x218d17[_0x5bb3('0x5f')],_0x218d17[_0x5bb3('0x7a')]||'en')[_0x5bb3('0x1a')](function(_0x872da){_0x1d5045(null,_0x872da);})['catch'](function(_0x4cecbd){_0x1d5045(_0x4cecbd);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x7b')]=function(_0x8cb7bb,_0x950492){scripts[_0x5bb3('0x7b')](this['channel'][_0x5bb3('0x39')],_0x8cb7bb[_0x5bb3('0x7c')],_0x8cb7bb['client_email'],_0x8cb7bb[_0x5bb3('0x7d')],_0x8cb7bb['text'],_0x8cb7bb['dialogflowV2_language']||'en')[_0x5bb3('0x1a')](function(_0x363174){_0x950492(null,_0x363174);})[_0x5bb3('0x16')](function(_0x3afabc){_0x950492(_0x3afabc);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x7e')]=function(_0x34c83c,_0x1ff89c){scripts[_0x5bb3('0x7e')](this[_0x5bb3('0x10')],_0x34c83c)[_0x5bb3('0x1a')](function(_0xce4bd){_0x1ff89c(null,_0xce4bd);})[_0x5bb3('0x16')](function(_0x4ef767){_0x1ff89c(_0x4ef767);});};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x7f')]=function(_0xa125b1,_0x5b714c){scripts[_0x5bb3('0x7f')](_0xa125b1[_0x5bb3('0x80')],_0xa125b1[_0x5bb3('0x5f')],_0xa125b1['ispeech_tts_language']||'en-US',_0xa125b1[_0x5bb3('0x81')])[_0x5bb3('0x1a')](function(_0xb50e40){_0x5b714c(null,_0xb50e40);})[_0x5bb3('0x16')](function(_0x198df4){_0x5b714c(_0x198df4);});};AGIVertices['prototype'][_0x5bb3('0x82')]=function(_0x25dea5,_0x5c0ea4,_0x1565c6){scripts[_0x5bb3('0x82')](_0x5c0ea4,_0x25dea5['key'],_0x25dea5['ispeech_asr_language']||'en-US',this['isConfigured'](_0x25dea5[_0x5bb3('0x83')])?_0x25dea5['model']:undefined)[_0x5bb3('0x1a')](function(_0x408751){_0x1565c6(null,_0x408751);})[_0x5bb3('0x16')](function(_0x593999){_0x1565c6(_0x593999);});};AGIVertices['prototype'][_0x5bb3('0x84')]=function(_0x1c4c4f,_0x542d34){scripts[_0x5bb3('0x84')](_0x1c4c4f[_0x5bb3('0x85')],_0x1c4c4f['aws_secret_access_key'],_0x1c4c4f[_0x5bb3('0x86')],_0x1c4c4f[_0x5bb3('0x87')]||_0x5bb3('0x88'),_0x1c4c4f[_0x5bb3('0x5f')],_0x1c4c4f[_0x5bb3('0x89')]||_0x5bb3('0x5f'))[_0x5bb3('0x1a')](function(_0x588b7e){_0x542d34(null,_0x588b7e);})[_0x5bb3('0x16')](function(_0x3b20a3){_0x542d34(_0x3b20a3);});};AGIVertices['prototype'][_0x5bb3('0x8a')]=function(_0x541ff6,_0x45607c){scripts[_0x5bb3('0x8a')](this[_0x5bb3('0x10')][_0x5bb3('0x39')],_0x541ff6['aws_access_key_id'],_0x541ff6[_0x5bb3('0x8b')],_0x541ff6[_0x5bb3('0x8c')],_0x541ff6['text'],_0x541ff6['aws_bot_name'])['then'](function(_0x4d8683){_0x45607c(null,_0x4d8683);})['catch'](function(_0x311dd4){_0x45607c(_0x311dd4);});};AGIVertices['prototype'][_0x5bb3('0x8d')]=function(_0x3d258b,_0x37da50,_0x10ce52){scripts[_0x5bb3('0x8d')](_0x37da50,_0x3d258b[_0x5bb3('0x80')],_0x3d258b[_0x5bb3('0x8e')]||_0x5bb3('0x8f'))[_0x5bb3('0x1a')](function(_0x58eb92){_0x10ce52(null,_0x58eb92);})[_0x5bb3('0x16')](function(_0x1a6ac2){_0x10ce52(_0x1a6ac2);});};AGIVertices[_0x5bb3('0x17')]['tildeASR']=function(_0x3a5b84,_0x45bd9d,_0x12f005){scripts[_0x5bb3('0x90')](_0x45bd9d,_0x3a5b84[_0x5bb3('0x91')],_0x3a5b84[_0x5bb3('0x92')],_0x3a5b84[_0x5bb3('0x6f')])[_0x5bb3('0x1a')](function(_0x48548a){_0x12f005(null,_0x48548a);})[_0x5bb3('0x16')](function(_0x156351){_0x12f005(_0x156351);});};AGIVertices['prototype'][_0x5bb3('0x93')]=function(_0x364c8e){var _0x42b0f4=_[_0x5bb3('0x94')](verticesWithRetry,_0x364c8e[_0x5bb3('0x95')])?_0x364c8e:_[_0x5bb3('0x96')](_0x364c8e);for(var _0x320afc in _0x42b0f4){if(_0x42b0f4[_0x5bb3('0x97')](_0x320afc)){if(_0x42b0f4[_0x320afc]&&_[_0x5bb3('0x98')](_0x42b0f4[_0x320afc])){if(_['includes'](recursiveMapAttributes,_0x320afc)){_0x42b0f4[_0x320afc]=this['replaceObjectAllVariables'](_0x42b0f4[_0x320afc]);}else{_0x42b0f4[_0x320afc]=this[_0x5bb3('0x99')](_0x42b0f4[_0x320afc]);}}}}return _0x42b0f4;};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x9a')]=function(_0x4429b){for(var _0x39924f in _0x4429b){if(_0x4429b[_0x5bb3('0x97')](_0x39924f)){if(_['isPlainObject'](_0x4429b[_0x39924f])){this[_0x5bb3('0x9a')](_0x4429b[_0x39924f]);}else if(_[_0x5bb3('0x9b')](_0x4429b[_0x39924f])){for(var _0x3ce8cd=0x0;_0x3ce8cd<_0x4429b[_0x39924f][_0x5bb3('0x9c')];_0x3ce8cd++){this['recursiveNodeIndex'](_0x4429b[_0x39924f][_0x3ce8cd]);}}else if(_[_0x5bb3('0x98')](_0x4429b[_0x39924f])){_0x4429b[_0x39924f]=this[_0x5bb3('0x99')](_0x4429b[_0x39924f]);}}}};AGIVertices[_0x5bb3('0x17')]['saveRestApiResult']=function(_0x18f430,_0x39f77a){for(var _0x7ebe20 in _0x18f430){if(_0x18f430[_0x5bb3('0x97')](_0x7ebe20)){if(_['isPlainObject'](_0x18f430[_0x7ebe20])){if(!_[_0x5bb3('0x9d')](_0x18f430[_0x7ebe20])){this[_0x5bb3('0x9e')](_0x18f430[_0x7ebe20],util[_0x5bb3('0x2a')](_0x5bb3('0x9f'),_0x39f77a,_0x7ebe20));}}else if(_['isArray'](_0x18f430[_0x7ebe20])){for(var _0x1a9f85=0x0;_0x1a9f85<_0x18f430[_0x7ebe20]['length'];_0x1a9f85++){this[_0x5bb3('0x9e')](_0x18f430[_0x7ebe20][_0x1a9f85],util[_0x5bb3('0x2a')]('%s.%s',_0x39f77a,_0x7ebe20+'['+_0x1a9f85+']'));}}else{if(!_[_0x5bb3('0x49')](_0x18f430[_0x7ebe20])){this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util['format']('%s.%s',_0x39f77a,_0x7ebe20),_0x18f430[_0x7ebe20]);}}}}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xa1')]=function(_0x21f45c){try{var _0xa4b12e=JSON[_0x5bb3('0x69')](_0x21f45c);this[_0x5bb3('0x9a')](_0xa4b12e);return JSON['stringify'](_0xa4b12e);}catch(_0x223685){return this[_0x5bb3('0x99')](_0x21f45c);}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x99')]=function(_0x367eda){var _0x3392ec=_0x367eda[_0x5bb3('0xa2')]('{');for(var _0x42367f=0x1;_0x42367f<_0x3392ec[_0x5bb3('0x9c')];_0x42367f+=0x1){var _0x515f42=_0x3392ec[_0x42367f][_0x5bb3('0xa2')]('}');if(_0x515f42[_0x5bb3('0x9c')]>0x1){_0x367eda=_0x367eda[_0x5bb3('0xa3')]('{'+_0x515f42[0x0]+'}',this[_0x5bb3('0x10')][_0x5bb3('0x12')](_0x515f42[0x0])['extra']||_0x515f42[0x0]);}}if(_0x3392ec[_0x5bb3('0x9c')]===0x1){return _0x367eda['toString']();}return this[_0x5bb3('0x99')](_0x367eda);};AGIVertices['prototype']['getAndSetVariable']=function(_0x4a3687,_0x5d0f50){var _0x558ad0=this[_0x5bb3('0x10')]['getVariable'](_0x4a3687);if(_0x558ad0[_0x5bb3('0xa4')]===-0x1){return _0x558ad0;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5d0f50,_0x558ad0[_0x5bb3('0xa5')]));return this['channel'][_0x5bb3('0xa0')](_0x5d0f50,_0x558ad0[_0x5bb3('0xa5')]);};AGIVertices[_0x5bb3('0x17')]['isConfigured']=function(_0x204885){return _0x204885&&_0x204885!=='0'&&_0x204885!=='-1'&&_0x204885!=='';};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xa6')]=function(_0x1cc84a){this[_0x5bb3('0x38')][_0x5bb3('0x6e')](this,_0x1cc84a,'-');_0x1cc84a['retry']=_0x1cc84a[_0x5bb3('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xa7')]=function(_0x339ee8){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xa8'),_0x339ee8[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x339ee8[_0x5bb3('0x5f')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}var _0xaf4680='\x22'+_0x339ee8[_0x5bb3('0x5f')]+'\x22';if(this[_0x5bb3('0xa9')](_0x339ee8[_0x5bb3('0x78')])){_0xaf4680+=','+_0x339ee8[_0x5bb3('0x78')];}var _0x12bde7=this[_0x5bb3('0x10')][_0x5bb3('0x5b')](_0x5bb3('0xac'),_0xaf4680);if(_0x12bde7['result']===-0x1){return _0x12bde7;}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xad'),_0xaf4680));};AGIVertices[_0x5bb3('0x17')]['mrcprecog']=function(_0x2dd8a3){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2dd8a3[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x2dd8a3[_0x5bb3('0xae')])){return this['channel'][_0x5bb3('0xaa')]('no\x20grammar\x20configured');}var _0x12e29b=_0x2dd8a3[_0x5bb3('0xae')];if(this['isConfigured'](_0x2dd8a3[_0x5bb3('0x78')])){_0x12e29b+=','+_0x2dd8a3['options'];}var _0x50d61d=this['channel'][_0x5bb3('0x5b')](_0x5bb3('0xaf'),_0x12e29b);if(_0x50d61d[_0x5bb3('0xa4')]===-0x1){return _0x50d61d;}var _0x2da111=this['getAndSetVariable'](_0x5bb3('0xb0'),_0x5bb3('0xb1'));if(_0x2da111[_0x5bb3('0xa4')]===-0x1){return _0x2da111;}var _0x24cc3d=this[_0x5bb3('0xb2')](_0x5bb3('0xb3'),_0x5bb3('0xb4'));if(_0x24cc3d[_0x5bb3('0xa4')]===-0x1){return _0x24cc3d;}var _0x4cf715=this[_0x5bb3('0xb2')](_0x5bb3('0xb5'),'MRCP_RECOG_INSTANCE');if(_0x4cf715[_0x5bb3('0xa4')]===-0x1){return _0x4cf715;}return this['channel']['noop'](util[_0x5bb3('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x12e29b));};AGIVertices['prototype'][_0x5bb3('0x7')]=function(_0xe1fa48){logger['info'](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0xe1fa48[_0x5bb3('0x3a')]));return this[_0x5bb3('0x10')][_0x5bb3('0x7')]([_0xe1fa48[_0x5bb3('0xb6')],_0xe1fa48[_0x5bb3('0xb7')]]);};AGIVertices[_0x5bb3('0x17')]['answer']=function(_0x357464){logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0xb8'),_0x357464['label']));if(this[_0x5bb3('0xa9')](_0x357464[_0x5bb3('0x65')])){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xb9'),_0x357464[_0x5bb3('0x65')]));var _0x5836de=this[_0x5bb3('0x10')][_0x5bb3('0xba')](_0x357464[_0x5bb3('0x65')]);if(_0x5836de['result']===-0x1){return _0x5836de;}}return this['channel'][_0x5bb3('0xbb')]();};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xbc')]=function(_0x44c135){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x44c135['label']));if(!this['isConfigured'](_0x44c135[_0x5bb3('0x4b')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x44c135,'no\x20list\x20selected');}_0x44c135[_0x5bb3('0x4c')]=moment();if(this['isConfigured'](_0x44c135[_0x5bb3('0xbd')])){_0x44c135[_0x5bb3('0x4c')]=moment()[_0x5bb3('0xbe')](_0x44c135[_0x5bb3('0xbd')],'minutes');}if(!this['isConfigured'](_0x44c135[_0x5bb3('0x4f')])){_0x44c135[_0x5bb3('0x4f')]=0x2;}this[_0x5bb3('0x46')][_0x5bb3('0x6e')](this,_0x44c135);return this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xbf'),_0x44c135[_0x5bb3('0xc0')],_0x44c135[_0x5bb3('0x4b')],_0x44c135['scheduledAt']));};AGIVertices['prototype'][_0x5bb3('0xc1')]=function(_0xb08ff0){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xc2'),_0xb08ff0['label']));var _0x253809=this[_0x5bb3('0x10')][_0x5bb3('0x5b')](_0xb08ff0['application'],_0xb08ff0[_0x5bb3('0x78')]);if(_0x253809[_0x5bb3('0xa4')]===-0x1){return _0x253809;}return this[_0x5bb3('0x10')]['noop'](util[_0x5bb3('0x2a')](_0x5bb3('0xc3'),_0xb08ff0['application'],_0xb08ff0[_0x5bb3('0x78')]));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xc4')]=function(_0x2a48c2){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xc5'),_0x2a48c2['label']));if(!this['isConfigured'](_0x2a48c2['text'])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}var _0x1b6cf2='\x22'+_0x2a48c2[_0x5bb3('0x5f')]+'\x22';if(this[_0x5bb3('0xa9')](_0x2a48c2['options'])){_0x1b6cf2+=','+_0x2a48c2[_0x5bb3('0x78')];}var _0x110e98=this['channel']['exec']('MRCPSynth',_0x1b6cf2);if(_0x110e98[_0x5bb3('0xa4')]===-0x1){return _0x110e98;}return this[_0x5bb3('0x10')]['noop'](util[_0x5bb3('0x2a')](_0x5bb3('0xad'),_0x1b6cf2));};AGIVertices[_0x5bb3('0x17')]['sestektts']=function(_0x1f34bf){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xc6'),_0x1f34bf['label']));if(!this['isConfigured'](_0x1f34bf[_0x5bb3('0x5f')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}var _0x3a7a03='\x22'+_0x1f34bf[_0x5bb3('0x5f')]+'\x22';if(this[_0x5bb3('0xa9')](_0x1f34bf['options'])){_0x3a7a03+=','+_0x1f34bf['options'];}var _0x2859f8=this[_0x5bb3('0x10')][_0x5bb3('0x5b')](_0x5bb3('0xac'),_0x3a7a03);if(_0x2859f8['result']===-0x1){return _0x2859f8;}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3a7a03));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xc7')]=function(_0x18029){logger['info'](util[_0x5bb3('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x18029['label']));if(!this['isConfigured'](_0x18029[_0x5bb3('0xae')])){return this[_0x5bb3('0x10')]['noop'](_0x5bb3('0xc8'));}var _0x115a27=_0x18029['grammar'];if(this['isConfigured'](_0x18029['options'])){_0x115a27+=','+_0x18029[_0x5bb3('0x78')];}var _0x2e533f=this['channel'][_0x5bb3('0x5b')](_0x5bb3('0xaf'),_0x115a27);if(_0x2e533f[_0x5bb3('0xa4')]===-0x1){return _0x2e533f;}var _0x4e95e2=this[_0x5bb3('0xb2')]('RECOG_CONFIDENCE()',_0x5bb3('0xc9'));if(_0x4e95e2['result']===-0x1){return _0x4e95e2;}var _0xaf079d=this['getAndSetVariable'](_0x5bb3('0xb3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0xaf079d[_0x5bb3('0xa4')]===-0x1){return _0xaf079d;}var _0x37e423=this['getAndSetVariable'](_0x5bb3('0xb5'),_0x5bb3('0xca'));if(_0x37e423['result']===-0x1){return _0x37e423;}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xcb'),_0x115a27));};AGIVertices[_0x5bb3('0x17')]['sestekasr']=function(_0x53ae16){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xcc'),_0x53ae16[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x53ae16[_0x5bb3('0xae')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xc8'));}var _0x5a2729=_0x53ae16['grammar'];if(this[_0x5bb3('0xa9')](_0x53ae16['options'])){_0x5a2729+=','+_0x53ae16['options'];}var _0x3149af=this[_0x5bb3('0x10')][_0x5bb3('0x5b')](_0x5bb3('0xaf'),_0x5a2729);if(_0x3149af[_0x5bb3('0xa4')]===-0x1){return _0x3149af;}var _0x97f923=this[_0x5bb3('0xb2')](_0x5bb3('0xb0'),_0x5bb3('0xcd'));if(_0x97f923['result']===-0x1){return _0x97f923;}var _0x316422=this[_0x5bb3('0xb2')](_0x5bb3('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x316422[_0x5bb3('0xa4')]===-0x1){return _0x316422;}var _0x429ea3=this[_0x5bb3('0xb2')](_0x5bb3('0xb5'),_0x5bb3('0xce'));if(_0x429ea3['result']===-0x1){return _0x429ea3;}return this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xcb'),_0x5a2729));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xcf')]=function(_0x2d25d2){logger[_0x5bb3('0x2f')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2d25d2[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x2d25d2[_0x5bb3('0xd0')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2d25d2,'no\x20database\x20selected');}var _0x4d15cb=this[_0x5bb3('0x1d')][_0x5bb3('0x6e')](this,_0x2d25d2[_0x5bb3('0xd0')]);if(!_0x4d15cb){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2d25d2,_0x5bb3('0xd1'));}if(!this[_0x5bb3('0xa9')](_0x2d25d2[_0x5bb3('0x30')])){return this[_0x5bb3('0x10')]['error'](_0x2d25d2,_0x5bb3('0xd2'));}var _0x5096d3=_0x2d25d2[_0x5bb3('0x30')][_0x5bb3('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xd3'),_0x5096d3));var _0x2f125b=this[_0x5bb3('0x2b')][_0x5bb3('0x6e')](this,_0x4d15cb,_0x5096d3);this[_0x5bb3('0x38')][_0x5bb3('0x6e')](this,_0x2d25d2,_0x5096d3);if(!this[_0x5bb3('0xa9')](_0x2d25d2['variable_id'])){return this[_0x5bb3('0x10')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5c8493=this['getVariable']['sync'](this,_0x2d25d2[_0x5bb3('0xd4')]);if(!_0x5c8493){return this['channel'][_0x5bb3('0x2d')](_0x2d25d2,_0x5bb3('0xd5'));}var _0x342245=this;_0x2f125b[_0x5bb3('0xd6')](function(_0x42724e,_0xc0950c){Object['keys'](_0x42724e)['forEach'](function(_0x99359f){_0x342245[_0x5bb3('0x10')][_0x5bb3('0xa0')](util[_0x5bb3('0x2a')](_0x5bb3('0xd7'),_0x5c8493,_0xc0950c,_0x99359f),_0x42724e[_0x99359f]);});});this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util['format']('%s_ROWS_COUNT',_0x5c8493),_0x2f125b[_0x5bb3('0x9c')]);return this['channel']['noop'](util['format'](_0x5bb3('0xd8'),_0x5c8493));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xd9')]=function(_0x9b8485){logger['debug'](util[_0x5bb3('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x9b8485[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x9b8485[_0x5bb3('0xda')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x9b8485,_0x5bb3('0xdb'));}var _0x333ecc=this[_0x5bb3('0xdc')][_0x5bb3('0x6e')](this,_0x9b8485['sip_id']);if(!_0x333ecc){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x9b8485,_0x5bb3('0xdd'));}var _0x528bb0=this['channel'][_0x5bb3('0x5b')](_0x5bb3('0xde'),[util[_0x5bb3('0x2a')](_0x5bb3('0xdf'),_0x333ecc),_0x9b8485[_0x5bb3('0x65')],_0x9b8485[_0x5bb3('0xe0')],_0x9b8485['url']]);if(_0x528bb0[_0x5bb3('0xa4')]===-0x1){return _0x528bb0;}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xe1'),'DIAL'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xe2')]=function(_0x12ab3c){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xe3'),_0x12ab3c['label']));if(!this[_0x5bb3('0xa9')](_0x12ab3c[_0x5bb3('0x80')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xe4'));}if(!this[_0x5bb3('0xa9')](_0x12ab3c[_0x5bb3('0x5f')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}this[_0x5bb3('0x10')][_0x5bb3('0xe5')]=!![];this[_0x5bb3('0x38')](_0x12ab3c);this['createSquareMessage'](_0x12ab3c['text'],'in','','');this['channel'][_0x5bb3('0xaa')](util['format'](_0x5bb3('0xe6'),_0x12ab3c[_0x5bb3('0x5f')]));var _0x30294e=this['googleDialogflow'][_0x5bb3('0x6e')](this,_0x12ab3c);if(_0x30294e){for(var _0x1e9611 in _0x30294e){if(_0x30294e[_0x5bb3('0x97')](_0x1e9611)){this['channel']['setVariable'](util[_0x5bb3('0x2a')](_0x5bb3('0xe7'),_0x1e9611['toUpperCase']()),_0x30294e[_0x1e9611]);}}this['createSquareMessage'](_0x30294e[_0x5bb3('0xe8')],'out',_0x5bb3('0xe2'),'');return this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('Dialogflow\x20Result\x20%s',_0x30294e[_0x5bb3('0xe8')]));}return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x12ab3c,_0x5bb3('0xe9'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xea')]=function(_0x2006fe){logger[_0x5bb3('0x2f')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2006fe[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x2006fe[_0x5bb3('0x7c')])){return this[_0x5bb3('0x10')]['noop']('no\x20project_id\x20configured');}if(!this[_0x5bb3('0xa9')](_0x2006fe[_0x5bb3('0xeb')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')]('no\x20client_email\x20configured');}if(!this[_0x5bb3('0xa9')](_0x2006fe[_0x5bb3('0x7d')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xec'));}if(!this[_0x5bb3('0xa9')](_0x2006fe[_0x5bb3('0xed')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')]('no\x20anguage\x20configured');}if(!this[_0x5bb3('0xa9')](_0x2006fe[_0x5bb3('0x5f')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}this[_0x5bb3('0x10')][_0x5bb3('0xe5')]=!![];this[_0x5bb3('0x38')](_0x2006fe);this[_0x5bb3('0x45')](_0x2006fe[_0x5bb3('0x5f')],'in','','');this['channel']['noop'](util[_0x5bb3('0x2a')](_0x5bb3('0xee'),_0x2006fe['text']));var _0x3e5cf5=this[_0x5bb3('0x7b')]['sync'](this,_0x2006fe);if(_0x3e5cf5){for(var _0x17854b in _0x3e5cf5){if(_0x3e5cf5['hasOwnProperty'](_0x17854b)){if(_0x17854b!=='providerResponse'){this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util['format']('DIALOGFLOW_%s',_0x17854b[_0x5bb3('0x67')]()),_0x3e5cf5[_0x17854b]);}}}this['createSquareMessage'](_0x3e5cf5[_0x5bb3('0xe8')],_0x5bb3('0xef'),_0x5bb3('0xea'),_0x3e5cf5[_0x5bb3('0xf0')]);return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('DialogflowV2\x20Result\x20%s',_0x3e5cf5['speech']));}return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2006fe,_0x5bb3('0xf1'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xf2')]=function(_0x3e0893){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0xf3'),_0x3e0893[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x3e0893[_0x5bb3('0xf4')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xf5'));}if(!this[_0x5bb3('0xa9')](_0x3e0893[_0x5bb3('0xf6')])){return this[_0x5bb3('0x10')]['noop'](_0x5bb3('0xf7'));}if(!this[_0x5bb3('0xa9')](_0x3e0893[_0x5bb3('0xf8')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xf9'));}if(!this[_0x5bb3('0xa9')](_0x3e0893[_0x5bb3('0xfa')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}this[_0x5bb3('0x10')][_0x5bb3('0xe5')]=!![];this[_0x5bb3('0x38')](_0x3e0893);this[_0x5bb3('0x45')](_0x3e0893[_0x5bb3('0x5f')],'in','','');this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xfb'),_0x3e0893[_0x5bb3('0x5f')]));var _0x177b60=this['sestekNDA'][_0x5bb3('0x6e')](this,_0x3e0893);if(_0x177b60){for(var _0x5ea2ea in _0x177b60){if(_0x177b60[_0x5bb3('0x97')](_0x5ea2ea)){this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util[_0x5bb3('0x2a')](_0x5bb3('0xfc'),_0x5ea2ea[_0x5bb3('0x67')]()),_0x177b60[_0x5ea2ea]);}}this[_0x5bb3('0x45')](_0x177b60[_0x5bb3('0xe8')],_0x5bb3('0xef'),_0x5bb3('0xf2'),'');if(_0x177b60[_0x5bb3('0xfd')]){this[_0x5bb3('0x10')]['noop'](util['format'](_0x5bb3('0xfe'),_0x177b60['audiofile']));var _0x333fd0=this[_0x5bb3('0x10')][_0x5bb3('0xff')](_0x177b60['audiofile']);try{fs[_0x5bb3('0x100')](_0x177b60[_0x5bb3('0xfd')]+_0x5bb3('0x101'));}catch(_0x4fec71){logger[_0x5bb3('0x2d')](_0x4fec71);}return _0x333fd0;}else{return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util['format'](_0x5bb3('0x102'),_0x177b60[_0x5bb3('0xe8')]));}}return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x3e0893,_0x5bb3('0x103'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x104')]=function(_0x511da6){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x511da6[_0x5bb3('0x3a')]));return this[_0x5bb3('0x10')]['noop'](_0x5bb3('0x104'));};AGIVertices['prototype']['ext_dial']=function(_0x39abfe){logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0x105'),_0x39abfe['label']));var _0x313c88='';if(_0x39abfe[_0x5bb3('0x106')]){if(!this[_0x5bb3('0xa9')](_0x39abfe['trunk_id'])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x39abfe,'no\x20trunk\x20selected');}else{var _0x5346be=parseInt(_0x39abfe[_0x5bb3('0x106')],0xa);if(isNaN(_0x5346be)){_0x313c88=_0x39abfe[_0x5bb3('0x106')];}else{_0x313c88=this[_0x5bb3('0x1f')][_0x5bb3('0x6e')](this,_0x39abfe[_0x5bb3('0x106')]);if(!_0x313c88){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x39abfe,_0x5bb3('0x107'));}}}}else if(_0x39abfe[_0x5bb3('0x108')]){_0x313c88=_0x39abfe[_0x5bb3('0x108')];}else{return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x39abfe,_0x5bb3('0x109'));}var _0x338906=this[_0x5bb3('0x10')][_0x5bb3('0x5b')](_0x5bb3('0xde'),[util['format'](_0x5bb3('0x10a'),_0x313c88,_0x39abfe['phone']),_0x39abfe['timeout'],_0x39abfe[_0x5bb3('0xe0')],_0x39abfe[_0x5bb3('0x71')]]);if(_0x338906[_0x5bb3('0xa4')]===-0x1){return _0x338906;}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util['format'](_0x5bb3('0xe1'),_0x5bb3('0xde')));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x10b')]=function(_0x18f446){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x10c'),_0x18f446[_0x5bb3('0x3a')]));return this['channel'][_0x5bb3('0xaa')](_0x5bb3('0x10b'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xe')]=function(_0x2b712a){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x2b712a['label']));if(_0x2b712a[_0x5bb3('0x10d')]===0x0){return this['maxRetry'](_0x2b712a);}_0x2b712a[_0x5bb3('0x10d')]-=0x1;if(!this[_0x5bb3('0xa9')](_0x2b712a['file_id'])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2b712a,_0x5bb3('0x10e'));}var _0x276363=this[_0x5bb3('0x20')][_0x5bb3('0x6e')](this,_0x2b712a[_0x5bb3('0x10f')]);if(!_0x276363){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2b712a,_0x5bb3('0x110'));}if(!this['isConfigured'](_0x2b712a['variable_id'])){return this[_0x5bb3('0x10')]['error'](_0x5bb3('0x111'));}var _0x42fce=this[_0x5bb3('0x10')]['getData'](_0x276363,_0x2b712a[_0x5bb3('0x112')],_0x2b712a[_0x5bb3('0x113')]);var _0x5a2654=_0x42fce['result']?_0x42fce[_0x5bb3('0xa4')]['toString']():'';logger[_0x5bb3('0x2f')]('test',JSON[_0x5bb3('0x72')](_0x42fce));if(_0x42fce[_0x5bb3('0xa4')]===-0x1){this['createSquareDetailsReport'][_0x5bb3('0x6e')](this,_0x2b712a,_0x5a2654);return _0x42fce;}else if(_0x42fce['extra']===_0x5bb3('0x65')){_0x42fce[_0x5bb3('0xa4')]=_0x5a2654[_0x5bb3('0x9c')]>=parseInt(_0x2b712a[_0x5bb3('0x114')])?'x':'i';}else{_0x42fce[_0x5bb3('0xa4')]=_0x5a2654[_0x5bb3('0x9c')]>=parseInt(_0x2b712a[_0x5bb3('0x114')])&&_0x5a2654['length']<=parseInt(_0x2b712a[_0x5bb3('0x113')])?'x':'i';}var _0x44c303=this[_0x5bb3('0x12')][_0x5bb3('0x6e')](this,_0x2b712a['variable_id']);if(!_0x44c303){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2b712a,_0x5bb3('0xd5'));}this[_0x5bb3('0x10')]['setVariable'](_0x44c303,_0x5a2654);if(this[_0x5bb3('0xa9')](_0x2b712a[_0x5bb3('0x115')])){var _0x5e579f=parseInt(_0x2b712a[_0x5bb3('0x115')],0xa);var _0x42f82b=rs['generate']({'charset':'*','length':_0x5e579f});var _0x2e3fe6=_0x5a2654[_0x5bb3('0x9c')];if(_0x2e3fe6>0x0){if(_0x2e3fe6>_0x5e579f){this[_0x5bb3('0x38')][_0x5bb3('0x6e')](this,_0x2b712a,_0x2b712a[_0x5bb3('0x116')]===_0x5bb3('0x117')?_0x42f82b+_0x5a2654['substr'](_0x5e579f):_0x5a2654[_0x5bb3('0x118')](0x0,_0x2e3fe6-_0x5e579f)+_0x42f82b);}else{this[_0x5bb3('0x38')]['sync'](this,_0x2b712a,rs[_0x5bb3('0x119')]({'charset':'*','length':_0x2e3fe6}));}}else{this[_0x5bb3('0x38')]['sync'](this,_0x2b712a,'');}}else{this[_0x5bb3('0x38')]['sync'](this,_0x2b712a,_0x5a2654);}return _0x42fce;};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0xf')]=function(_0x41ad87){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x41ad87[_0x5bb3('0x3a')]));return this[_0x5bb3('0xe')](_0x41ad87);};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x11a')]=function(_0x506570){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x506570[_0x5bb3('0x3a')]));this[_0x5bb3('0x38')][_0x5bb3('0x6e')](this,_0x506570,_0x506570[_0x5bb3('0x11b')]);return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util['format'](_0x5bb3('0x11c'),_0x506570[_0x5bb3('0x11b')]));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x11d')]=function(_0x284bed){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x11e'),_0x284bed['label']));if(!this['isConfigured'](_0x284bed[_0x5bb3('0x85')])||!this['isConfigured'](_0x284bed[_0x5bb3('0x8b')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x11f'));}if(!this[_0x5bb3('0xa9')](_0x284bed[_0x5bb3('0x5f')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}this['channel']['noop'](util[_0x5bb3('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x284bed[_0x5bb3('0x5f')]));var _0x10a4bc=this['awsPolly'][_0x5bb3('0x6e')](this,_0x284bed);if(_0x10a4bc){this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x120'),_0x10a4bc));var _0x25410c=this[_0x5bb3('0x10')][_0x5bb3('0xff')](_0x10a4bc);try{fs[_0x5bb3('0x100')](_0x10a4bc+_0x5bb3('0x101'));}catch(_0x438526){logger[_0x5bb3('0x2d')](_0x438526);}return _0x25410c;}return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x284bed,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x5bb3('0x17')]['awslex']=function(_0x1eda73){logger[_0x5bb3('0x2f')](util['format'](_0x5bb3('0x121'),_0x1eda73[_0x5bb3('0x3a')]));if(!this['isConfigured'](_0x1eda73[_0x5bb3('0x85')])||!this[_0x5bb3('0xa9')](_0x1eda73[_0x5bb3('0x8b')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x5bb3('0xa9')](_0x1eda73[_0x5bb3('0x122')])){return this['channel'][_0x5bb3('0xaa')](_0x5bb3('0x123'));}if(!this['isConfigured'](_0x1eda73['text'])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}this[_0x5bb3('0x10')][_0x5bb3('0xe5')]=!![];this[_0x5bb3('0x38')](_0x1eda73);this[_0x5bb3('0x45')](_0x1eda73['text'],'in','','');this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x124'),_0x1eda73[_0x5bb3('0x5f')]));var _0x15003a=this[_0x5bb3('0x8a')]['sync'](this,_0x1eda73);if(_0x15003a){for(var _0x51bd62 in _0x15003a){if(_0x15003a['hasOwnProperty'](_0x51bd62)&&_[_0x5bb3('0x98')](_0x15003a[_0x51bd62])){this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util['format'](_0x5bb3('0x125'),_0x51bd62[_0x5bb3('0x67')]()),_0x15003a[_0x51bd62]);}}if(_[_0x5bb3('0x49')](_0x15003a[_0x5bb3('0x76')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x126'));}else{this[_0x5bb3('0x45')](_0x15003a['message'],_0x5bb3('0xef'),_0x5bb3('0x127'),'');return this[_0x5bb3('0x10')]['noop'](util[_0x5bb3('0x2a')](_0x5bb3('0x128'),_0x15003a['message']));}}return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x1eda73,_0x5bb3('0x129'));};AGIVertices['prototype'][_0x5bb3('0x12a')]=function(_0x22cea6){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x12b'),_0x22cea6[_0x5bb3('0x3a')],_0x22cea6[_0x5bb3('0x65')]));if(!this[_0x5bb3('0xa9')](_0x22cea6[_0x5bb3('0x80')])){return this['channel'][_0x5bb3('0xaa')](_0x5bb3('0xe4'));}var _0x25d782='wav';var _0x48700c=util[_0x5bb3('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x5bb3('0x119')](0x4));var _0x43a404=util[_0x5bb3('0x2a')]('%s.%s',_0x48700c,_0x25d782);var _0x29a4cb=!![];if(_0x22cea6[_0x5bb3('0x12c')]===_0x5bb3('0x12d')){_0x29a4cb=![];}var _0x3848cd=this[_0x5bb3('0x10')][_0x5bb3('0x12e')](_0x48700c,_0x25d782,_0x22cea6[_0x5bb3('0x12f')],_0x22cea6[_0x5bb3('0x65')],undefined,_0x29a4cb);if(_0x3848cd[_0x5bb3('0xa4')]!==-0x1){this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('google\x20%s\x20file\x20created',_0x43a404));var _0xef12fd=this['googleASR'][_0x5bb3('0x6e')](this,_0x22cea6,_0x43a404);if(_0xef12fd){for(var _0x4ff8ad in _0xef12fd){if(_0xef12fd[_0x5bb3('0x97')](_0x4ff8ad)){this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util['format']('GOOGLE_ASR_%s',_0x4ff8ad[_0x5bb3('0x67')]()),_0xef12fd[_0x4ff8ad]);}}return this['channel'][_0x5bb3('0xaa')](util['format'](_0x5bb3('0x130'),JSON[_0x5bb3('0x72')](_0xef12fd)));}}return _0x3848cd;};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x131')]=function(_0x35b87e){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x132'),_0x35b87e[_0x5bb3('0x3a')]));if(!this['isConfigured'](_0x35b87e[_0x5bb3('0x91')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x35b87e[_0x5bb3('0x92')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x322f53=_0x5bb3('0x133');var _0x49a617=util['format'](_0x5bb3('0x134'),FILES_PATH,rs[_0x5bb3('0x119')](0x4));var _0x377d9c=util[_0x5bb3('0x2a')]('%s.%s',_0x49a617,_0x322f53);var _0x5cb2ac=!![];if(_0x35b87e[_0x5bb3('0x12c')]==='NOBEEP'){_0x5cb2ac=![];}var _0x37f65f=this[_0x5bb3('0x10')][_0x5bb3('0x12e')](_0x49a617,_0x322f53,_0x35b87e[_0x5bb3('0x12f')],_0x35b87e['timeout'],undefined,_0x5cb2ac);if(_0x37f65f['result']!==-0x1){this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util['format'](_0x5bb3('0x135'),_0x377d9c));var _0x1335cc=this[_0x5bb3('0x90')][_0x5bb3('0x6e')](this,_0x35b87e,_0x377d9c);if(_0x1335cc){for(var _0x21058d in _0x1335cc){if(_0x1335cc[_0x5bb3('0x97')](_0x21058d)){this[_0x5bb3('0x10')]['setVariable'](util[_0x5bb3('0x2a')](_0x5bb3('0x136'),_0x21058d[_0x5bb3('0x67')]()),_0x1335cc[_0x21058d]);}}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x137'),JSON['stringify'](_0x1335cc)));}}return _0x37f65f;};AGIVertices[_0x5bb3('0x17')]['gotoc']=function(_0x439b57){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x439b57[_0x5bb3('0x3a')]));return this[_0x5bb3('0x10')][_0x5bb3('0x138')](_0x439b57['context'],_0x439b57['extension'],_0x439b57['priority']);};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x139')]=function(_0x22f69f){logger[_0x5bb3('0x2f')](util['format'](_0x5bb3('0x13a'),_0x22f69f['label']));if(!this[_0x5bb3('0xa9')](_0x22f69f[_0x5bb3('0x13b')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x22f69f,_0x5bb3('0x13c'));}try{var _0xd89f09=eval(_0x22f69f[_0x5bb3('0x13b')])?'true':_0x5bb3('0x13d');this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util['format'](_0x5bb3('0x13e'),_0x22f69f['condition'],_0xd89f09));return{'code':0xc8,'result':_0xd89f09};}catch(_0x577538){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x13f')]=function(_0x4ca8e5){logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0x140'),_0x4ca8e5['label']));if(!this[_0x5bb3('0xa9')](_0x4ca8e5[_0x5bb3('0x141')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x4ca8e5,_0x5bb3('0x142'));}var _0x63bd=this[_0x5bb3('0x25')][_0x5bb3('0x6e')](this,_0x4ca8e5['interval_id']);if(!_0x63bd){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x4ca8e5,'no\x20intervals\x20found');}for(var _0x327113=0x0;_0x327113<_0x63bd['length'];_0x327113+=0x1){var _0x417d94=this[_0x5bb3('0x10')][_0x5bb3('0x12')](util['format'](_0x5bb3('0x143'),_0x63bd[_0x327113]));if(_0x417d94['result']===-0x1){return _0x417d94;}logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x144'),_0x63bd[_0x327113],_0x417d94['extra']));if(_0x417d94[_0x5bb3('0xa5')]==='true'){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x144'),_0x63bd[_0x327113],_0x5bb3('0x145')));this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('IFTIME\x20%s\x20%s',_0x63bd[_0x327113],_0x5bb3('0x145')));return{'code':0xc8,'result':_0x5bb3('0x145')};}else{logger[_0x5bb3('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x63bd[_0x327113],'false'));this[_0x5bb3('0x10')]['noop'](util['format'](_0x5bb3('0x144'),_0x63bd[_0x327113],_0x5bb3('0x13d')));}}return{'code':0xc8,'result':_0x5bb3('0x13d')};};AGIVertices[_0x5bb3('0x17')]['hangup']=function(_0x133094){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x146'),_0x133094[_0x5bb3('0x3a')]));return this[_0x5bb3('0x10')][_0x5bb3('0x147')]();};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x148')]=function(_0x4a0680){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x149'),_0x4a0680[_0x5bb3('0x3a')]));if(!this['isConfigured'](_0x4a0680['key'])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xe4'));}var _0x265ccd=_0x5bb3('0x133');var _0x4e9989=util[_0x5bb3('0x2a')](_0x5bb3('0x134'),FILES_PATH,rs[_0x5bb3('0x119')](0x4));var _0x356b7b=util[_0x5bb3('0x2a')]('%s.%s',_0x4e9989,_0x265ccd);var _0x462e12=!![];if(_0x4a0680[_0x5bb3('0x12c')]==='NOBEEP'){_0x462e12=![];}var _0x34a62a=this['channel'][_0x5bb3('0x12e')](_0x4e9989,_0x265ccd,_0x4a0680[_0x5bb3('0x12f')],_0x4a0680[_0x5bb3('0x65')],undefined,_0x462e12);if(_0x34a62a['result']!==-0x1){this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x14a'),_0x356b7b));var _0x1a95b2=this['ispeechASR'][_0x5bb3('0x6e')](this,_0x4a0680,_0x356b7b);if(_0x1a95b2){for(var _0x2f695d in _0x1a95b2){if(_0x1a95b2[_0x5bb3('0x97')](_0x2f695d)){this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util[_0x5bb3('0x2a')](_0x5bb3('0x14b'),_0x2f695d['toUpperCase']()),_0x1a95b2[_0x2f695d]);}}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x1a95b2)));}}return _0x34a62a;};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x14c')]=function(_0x75fdab){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x14d'),_0x75fdab[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x75fdab[_0x5bb3('0x80')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xe4'));}if(!this['isConfigured'](_0x75fdab['text'])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util['format'](_0x5bb3('0x14e'),_0x75fdab['text']));var _0xf9af14=this[_0x5bb3('0x7f')][_0x5bb3('0x6e')](this,_0x75fdab);if(_0xf9af14){this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('ispeech\x20%s\x20file\x20created',_0xf9af14));var _0x3a6971=this[_0x5bb3('0x10')]['streamFile'](_0xf9af14,_0x75fdab['intKey']);try{fs[_0x5bb3('0x100')](_0xf9af14+_0x5bb3('0x101'));}catch(_0x58991e){logger[_0x5bb3('0x2d')](_0x58991e);}return _0x3a6971;}return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x75fdab,_0x5bb3('0x14f'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x150')]=function(_0x2c2a18){logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0x151'),_0x2c2a18[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x2c2a18[_0x5bb3('0x152')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2c2a18,_0x5bb3('0x153'));}logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x2c2a18[_0x5bb3('0x152')]));var _0x164cec=this[_0x5bb3('0x56')]['sync'](this,_0x2c2a18['findBy']);if(_0x164cec){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x154'),this[_0x5bb3('0x10')]['callerid'],_0x2c2a18[_0x5bb3('0x152')]));this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x154'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x2c2a18[_0x5bb3('0x152')]));return{'code':0xc8,'result':_0x5bb3('0x155')};}else{logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0x156'),this['channel'][_0x5bb3('0x3c')],_0x2c2a18['findBy']));this[_0x5bb3('0x10')]['noop'](util[_0x5bb3('0x2a')](_0x5bb3('0x156'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x2c2a18[_0x5bb3('0x152')]));return{'code':0xc8,'result':_0x5bb3('0x157')};}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x158')]=function(_0x3e8e77){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3e8e77[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x3e8e77[_0x5bb3('0x152')])){return this['channel'][_0x5bb3('0x2d')](_0x3e8e77,_0x5bb3('0x153'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x3e8e77['findBy']));var _0x3523ce=this[_0x5bb3('0x55')][_0x5bb3('0x6e')](this,_0x3e8e77[_0x5bb3('0x152')]);if(_0x3523ce){logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0x154'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x3e8e77[_0x5bb3('0x152')]));this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x154'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x3e8e77[_0x5bb3('0x152')]));return{'code':0xc8,'result':_0x5bb3('0x155')};}else{logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x156'),this[_0x5bb3('0x10')]['callerid'],_0x3e8e77[_0x5bb3('0x152')]));this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x156'),this[_0x5bb3('0x10')]['callerid'],_0x3e8e77['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x159')]=function(_0x171443){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x15a'),_0x171443[_0x5bb3('0x3a')]));if(!this['isConfigured'](_0x171443['operation'])){return this['channel'][_0x5bb3('0x2d')](_0x171443,_0x5bb3('0x15b'));}this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x15c'),_0x171443[_0x5bb3('0x15d')]));var _0x5db4f4=eval(_0x171443[_0x5bb3('0x15d')]);if(!this[_0x5bb3('0xa9')](_0x171443[_0x5bb3('0xd4')])){return this['channel'][_0x5bb3('0xaa')](_0x5bb3('0x111'));}var _0x2d773d=this[_0x5bb3('0x12')][_0x5bb3('0x6e')](this,_0x171443['variable_id']);if(!_0x2d773d){return this[_0x5bb3('0x10')]['error'](_0x171443,'no\x20variable\x20found');}if(_[_0x5bb3('0x9b')](_0x5db4f4)){var _0x4cb477=this;_0x5db4f4[_0x5bb3('0xd6')](function(_0x1b9215,_0x3f7b4f){_0x4cb477[_0x5bb3('0x10')][_0x5bb3('0xa0')](util[_0x5bb3('0x2a')]('%s[%s]',_0x2d773d,_0x3f7b4f),_0x1b9215);});return this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('variable\x20%s[key]\x20set',_0x2d773d));}else{return this[_0x5bb3('0x10')][_0x5bb3('0xa0')](_0x2d773d,_0x5db4f4);}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x15e')]=function(_0x5d9972){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x15f'),_0x5d9972[_0x5bb3('0x3a')]));if(_0x5d9972['retry']===0x0){return this[_0x5bb3('0xa6')](_0x5d9972);}_0x5d9972[_0x5bb3('0x10d')]-=0x1;if(!this['isConfigured'](_0x5d9972[_0x5bb3('0x10f')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x5d9972,_0x5bb3('0x10e'));}var _0xf70f71=this['getSound'][_0x5bb3('0x6e')](this,_0x5d9972[_0x5bb3('0x10f')]);if(!_0xf70f71){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x5d9972,_0x5bb3('0x110'));}var _0x2b3c20=this['channel']['getData'](_0xf70f71,_0x5d9972[_0x5bb3('0x112')],_0x5d9972[_0x5bb3('0x160')]);var _0x3de97f=_0x2b3c20[_0x5bb3('0xa4')];if(_0x2b3c20[_0x5bb3('0xa4')]===-0x1){this[_0x5bb3('0x38')][_0x5bb3('0x6e')](this,_0x5d9972,'-1');return _0x2b3c20;}else if(_0x2b3c20['extra']===_0x5bb3('0x65')){_0x2b3c20['result']=_0x2b3c20['result'][_0x5bb3('0x9c')]>0x0?_0x2b3c20[_0x5bb3('0xa4')]:'t';}else if(_['isEmpty'](_0x2b3c20[_0x5bb3('0xa4')])){_0x2b3c20[_0x5bb3('0xa4')]='#';_0x3de97f='#';}if(!this[_0x5bb3('0xa9')](_0x5d9972[_0x5bb3('0xd4')])){this[_0x5bb3('0x10')]['noop'](_0x5bb3('0x111'));}else{var _0x2a46d3=this[_0x5bb3('0x12')][_0x5bb3('0x6e')](this,_0x5d9972[_0x5bb3('0xd4')]);if(!_0x2a46d3){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x5d9972,'no\x20variable\x20found');}this[_0x5bb3('0x10')]['setVariable'](_0x2a46d3,_0x3de97f);}this[_0x5bb3('0x38')]['sync'](this,_0x5d9972,_0x3de97f);return _0x2b3c20;};AGIVertices['prototype']['noop']=function(_0x2a6561){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x161'),_0x2a6561[_0x5bb3('0x3a')]));return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x2a6561[_0x5bb3('0x162')]||_0x2a6561['label']);};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x163')]=function(_0x5b9cfe){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x164'),_0x5b9cfe[_0x5bb3('0x3a')]));if(!this['isConfigured'](_0x5b9cfe[_0x5bb3('0x152')])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x5b9cfe,'no\x20find\x20by\x20configured');}logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x165'),this['channel'][_0x5bb3('0x3c')],_0x5b9cfe[_0x5bb3('0x152')]));var _0x35c29c=this[_0x5bb3('0x50')][_0x5bb3('0x6e')](this,_0x5b9cfe[_0x5bb3('0x166')]);var _0x4c0942=this['agentPause'][_0x5bb3('0x6e')](this,_0x5b9cfe[_0x5bb3('0x152')],_0x35c29c);if(_0x4c0942){logger[_0x5bb3('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5bb3('0x10')]['callerid'],_0x5b9cfe[_0x5bb3('0x152')]));this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x5b9cfe[_0x5bb3('0x152')]));return{'code':0xc8,'result':_0x5bb3('0x155')};}else{logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x156'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x5b9cfe[_0x5bb3('0x152')]));this[_0x5bb3('0x10')]['noop'](util[_0x5bb3('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x5b9cfe[_0x5bb3('0x152')]));return{'code':0xc8,'result':_0x5bb3('0x157')};}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x167')]=function(_0x348a99){logger[_0x5bb3('0x2f')](util['format'](_0x5bb3('0x168'),_0x348a99[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x348a99[_0x5bb3('0x10f')])){return this[_0x5bb3('0x10')]['error'](_0x348a99,'no\x20file\x20audio\x20selected');}var _0x3f9f9f=this[_0x5bb3('0x20')][_0x5bb3('0x6e')](this,_0x348a99[_0x5bb3('0x10f')]);if(!_0x3f9f9f){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x348a99,_0x5bb3('0x110'));}var _0x3f7f00=this['channel'][_0x5bb3('0x5b')]('PLAYBACK',[_0x3f9f9f,_0x348a99[_0x5bb3('0xe0')]]);if(_0x3f7f00['result']===-0x1){return _0x3f7f00;}return this['channel']['noop'](util[_0x5bb3('0x2a')](_0x5bb3('0xc3'),_0x5bb3('0x169'),_0x3f9f9f));};AGIVertices[_0x5bb3('0x17')]['queue']=function(_0xa44732){logger[_0x5bb3('0x2f')](util['format'](_0x5bb3('0x16a'),_0xa44732[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0xa44732[_0x5bb3('0x16b')])){return this['channel'][_0x5bb3('0x2d')](_0xa44732,_0x5bb3('0x16c'));}var _0x4404c1='';var _0x3e925a=parseInt(_0xa44732[_0x5bb3('0x16b')],0xa);if(isNaN(_0x3e925a)){_0x4404c1=_0xa44732[_0x5bb3('0x16b')];}else{_0x4404c1=this[_0x5bb3('0x18')][_0x5bb3('0x6e')](this,_0xa44732[_0x5bb3('0x16b')]);if(!_0x4404c1){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0xa44732,_0x5bb3('0x16d'));}}var _0x6be117='';if(this[_0x5bb3('0xa9')](_0xa44732[_0x5bb3('0x10f')])){var _0x3779cb=this[_0x5bb3('0x20')][_0x5bb3('0x6e')](this,_0xa44732[_0x5bb3('0x10f')]);if(_0x3779cb){_0x6be117=_0x3779cb;}}this[_0x5bb3('0x38')][_0x5bb3('0x6e')](this,_0xa44732,_0x4404c1);if(_0xa44732[_0x5bb3('0xe0')][_0x5bb3('0x16e')]('x')<0x0){_0xa44732[_0x5bb3('0xe0')]+='x';}if(_0xa44732['opts']['indexOf']('X')<0x0){_0xa44732[_0x5bb3('0xe0')]+='X';}this['channel']['setVariable'](_0x5bb3('0x16f'),_0x4404c1?_0x4404c1[_0x5bb3('0x170')]():'');var _0x581e9c=this[_0x5bb3('0x10')][_0x5bb3('0x5b')]('QUEUE',[_0x4404c1,_0xa44732['opts'],_0xa44732['url'],_0x6be117,_0xa44732[_0x5bb3('0x65')],_0xa44732[_0x5bb3('0x7')],_0xa44732[_0x5bb3('0x171')],_0xa44732['gosub'],'',_0xa44732[_0x5bb3('0x172')]]);if(_0x581e9c[_0x5bb3('0xa4')]===-0x1){return _0x581e9c;}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('Executed\x20command\x20%s\x20%s',_0x5bb3('0x173'),_0x4404c1));};AGIVertices[_0x5bb3('0x17')]['record']=function(_0x2cd72d){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x174'),_0x2cd72d['label']));var _0x40ae0d=_0x2cd72d[_0x5bb3('0x175')]||_0x5bb3('0x133');var _0x3f563e=util[_0x5bb3('0x2a')](_0x5bb3('0x176'),this['channel'][_0x5bb3('0x39')],rs[_0x5bb3('0x119')](0x5));var _0x26c2ab=util[_0x5bb3('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x3f563e,_0x40ae0d);var _0x31dbe0=util[_0x5bb3('0x2a')]('%s/recordings/%s',FILES_PATH,_0x3f563e);this[_0x5bb3('0x3d')]['sync'](this,_0x2cd72d,_0x3f563e,_0x26c2ab);this[_0x5bb3('0x10')][_0x5bb3('0xa0')](_0x5bb3('0x177'),_0x3f563e);logger['info'](_0x5bb3('0x178'),_0x31dbe0,_0x40ae0d,_0x2cd72d[_0x5bb3('0x179')],_0x2cd72d[_0x5bb3('0x65')]);return this[_0x5bb3('0x10')][_0x5bb3('0x12e')](_0x31dbe0,_0x40ae0d,_0x2cd72d[_0x5bb3('0x179')],_0x2cd72d[_0x5bb3('0x65')],undefined,!![]);};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x17a')]=function(_0x1122eb){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x17b'),_0x1122eb[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x1122eb[_0x5bb3('0x71')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')]('no\x20url\x20configured');}var _0x441a3b=this[_0x5bb3('0x17c')][_0x5bb3('0x6e')](this,_0x1122eb);logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0x17d'),util['inspect'](_0x441a3b,{'showHidden':![],'depth':null})));if(!this[_0x5bb3('0xa9')](_0x1122eb[_0x5bb3('0xd4')])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x17e'));}var _0x18ec20=this[_0x5bb3('0x12')][_0x5bb3('0x6e')](this,_0x1122eb[_0x5bb3('0xd4')]);if(!_0x18ec20){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x1122eb,_0x5bb3('0xd5'));}this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util[_0x5bb3('0x2a')]('%s_STATUS_CODE',_0x18ec20),_0x441a3b[_0x5bb3('0x74')]?_0x441a3b[_0x5bb3('0x74')]:'200');this[_0x5bb3('0x10')][_0x5bb3('0xa0')](util['format'](_0x5bb3('0x17f'),_0x18ec20),_0x441a3b[_0x5bb3('0x75')]?_0x441a3b['statusMessage']:'OK');if(_0x441a3b[_0x5bb3('0x68')]){try{this[_0x5bb3('0x9e')](_0x441a3b['body'],_0x18ec20);}catch(_0x1d52e7){logger[_0x5bb3('0x2d')](util['format'](_0x5bb3('0x180'),_0x18ec20));}}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xd8'),_0x18ec20));};AGIVertices[_0x5bb3('0x17')]['saydigits']=function(_0x2099a3){logger[_0x5bb3('0x2f')](util['format'](_0x5bb3('0x181'),_0x2099a3[_0x5bb3('0x3a')]));return this['channel'][_0x5bb3('0x182')](_0x2099a3['digits'][_0x5bb3('0x5c')](/\s+/g,''),_0x2099a3[_0x5bb3('0x179')]);};AGIVertices[_0x5bb3('0x17')]['saynumber']=function(_0x59f688){logger['info'](util[_0x5bb3('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x59f688[_0x5bb3('0x3a')]));return this[_0x5bb3('0x10')][_0x5bb3('0x183')](_0x59f688[_0x5bb3('0x184')][_0x5bb3('0x5c')](/\s+/g,''),_0x59f688[_0x5bb3('0x179')]);};AGIVertices['prototype'][_0x5bb3('0x185')]=function(_0x2bd97a){logger[_0x5bb3('0x2f')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2bd97a[_0x5bb3('0x3a')]));return this[_0x5bb3('0x10')][_0x5bb3('0x186')](_0x2bd97a[_0x5bb3('0x5f')],_0x2bd97a['escape_digits']);};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x187')]=function(_0x4d7bf9){logger['info'](util[_0x5bb3('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4d7bf9[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x4d7bf9['account_id'])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x188'));}var _0x1086a0=this[_0x5bb3('0x23')][_0x5bb3('0x6e')](this,_0x4d7bf9[_0x5bb3('0x189')]);if(!_0x1086a0||!_0x1086a0[_0x5bb3('0x18a')]){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x4d7bf9,_0x5bb3('0x18b'));}var _0x31be7a={'from':util[_0x5bb3('0x2a')](_0x5bb3('0x18c'),_0x1086a0[_0x5bb3('0x15')],_0x1086a0[_0x5bb3('0x18d')]||_0x1086a0[_0x5bb3('0x18a')]['user']),'to':_0x4d7bf9['to']||'','cc':_0x4d7bf9['cc']||'','bcc':_0x4d7bf9['bcc']||'','subject':_0x4d7bf9[_0x5bb3('0x18e')],'html':_0x4d7bf9['text'],'text':_0x4d7bf9[_0x5bb3('0x5f')]};if(this[_0x5bb3('0xa9')](_0x4d7bf9['template_id'])){}logger[_0x5bb3('0x18f')](_0x5bb3('0x190'),JSON[_0x5bb3('0x72')](_0x31be7a));this['createSquareDetailsReport'][_0x5bb3('0x6e')](this,_0x4d7bf9,_0x4d7bf9[_0x5bb3('0x189')]);this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x191'),_0x1086a0[_0x5bb3('0x15')]));this[_0x5bb3('0x24')][_0x5bb3('0x6e')](this,_0x1086a0[_0x5bb3('0x192')],_0x31be7a);return this['channel'][_0x5bb3('0xaa')](_0x5bb3('0x193'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x194')]=function(_0x261d0d){logger[_0x5bb3('0x2f')](util['format'](_0x5bb3('0x195'),_0x261d0d['label']));return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x196'));};AGIVertices[_0x5bb3('0x17')]['sendSMS']=function(_0x4afebc){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x197'),_0x4afebc[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x4afebc[_0x5bb3('0x198')])){return this['channel'][_0x5bb3('0xaa')](_0x5bb3('0x199'));}var _0x33159f=this[_0x5bb3('0x35')][_0x5bb3('0x6e')](this,_0x4afebc[_0x5bb3('0x198')]);if(!_0x33159f){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x4afebc,_0x5bb3('0x19a'));}var _0x19a42a={'body':_0x4afebc[_0x5bb3('0x19b')],'phone':_0x4afebc['to']||'','SmsAccountId':_0x33159f['id']};logger[_0x5bb3('0x18f')](_0x5bb3('0x19c'),JSON[_0x5bb3('0x72')](_0x19a42a));this[_0x5bb3('0x38')]['sync'](this,_0x4afebc,_0x4afebc[_0x5bb3('0x198')]);this[_0x5bb3('0x10')]['noop'](util[_0x5bb3('0x2a')](_0x5bb3('0x19d'),_0x33159f[_0x5bb3('0x15')]));this[_0x5bb3('0x37')][_0x5bb3('0x6e')](this,_0x19a42a);return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x19e'));};AGIVertices[_0x5bb3('0x17')]['set']=function(_0x1121db){logger['info'](util[_0x5bb3('0x2a')](_0x5bb3('0x19f'),_0x1121db[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x1121db[_0x5bb3('0xd4')])){return this[_0x5bb3('0x10')]['error'](_0x1121db,_0x5bb3('0x1a0'));}var _0x57c01b=this[_0x5bb3('0x12')]['sync'](this,_0x1121db[_0x5bb3('0xd4')]);if(!_0x57c01b){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x1121db,_0x5bb3('0xd5'));}return this['channel'][_0x5bb3('0xa0')](_0x57c01b,_0x1121db[_0x5bb3('0x1a1')]);};AGIVertices[_0x5bb3('0x17')]['start']=function(_0x50f167){logger[_0x5bb3('0x2f')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x50f167[_0x5bb3('0x3a')]));this[_0x5bb3('0x10')][_0x5bb3('0xaa')]('START\x20CALLY\x20SQUARE');if(_0x50f167['answer']===_0x5bb3('0x1a2')){this[_0x5bb3('0x10')]['noop'](_0x5bb3('0x1a3'));return this[_0x5bb3('0x10')]['answer']();}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x1a4'));};AGIVertices['prototype']['subproject']=function(_0x25c17e){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x1a5'),_0x25c17e[_0x5bb3('0x3a')]));if(!this['isConfigured'](_0x25c17e['project_id'])){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x25c17e,_0x5bb3('0x1a6'));}var _0xc92fa0=this[_0x5bb3('0x1b')]['sync'](this,_0x25c17e[_0x5bb3('0x1a7')]);if(!this[_0x5bb3('0xa9')](_0xc92fa0)){return this[_0x5bb3('0x10')]['error'](_0x25c17e,util[_0x5bb3('0x2a')](_0x5bb3('0x1a8'),_0x25c17e[_0x5bb3('0x1a7')]));}if(_0xc92fa0===this[_0x5bb3('0x10')]['arg_1']){return this['channel'][_0x5bb3('0x2d')](_0x25c17e,_0x5bb3('0x1a9'));}this[_0x5bb3('0x38')][_0x5bb3('0x6e')](this,_0x25c17e,_0xc92fa0);var _0x473281=this['channel'][_0x5bb3('0x5b')](_0x5bb3('0x1aa'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x5bb3('0x1ab')]||_0x5bb3('0x1ac'),_0xc92fa0,this[_0x5bb3('0x10')][_0x5bb3('0x3b')]));if(_0x473281[_0x5bb3('0xa4')]===-0x1){return _0x473281;}return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0xc3'),_0x5bb3('0x1aa'),_0xc92fa0));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1ad')]=function(_0x1ac18d){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x1ae'),_0x1ac18d[_0x5bb3('0x3a')]));var _0x21e5a4=this[_0x5bb3('0x5a')][_0x5bb3('0x6e')](this,_0x1ac18d['command']);this['createSquareDetailsReport'][_0x5bb3('0x6e')](this,_0x1ac18d,_0x1ac18d['command']);if(this['isConfigured'](_0x1ac18d[_0x5bb3('0xd4')])){var _0x2c1767=this[_0x5bb3('0x12')][_0x5bb3('0x6e')](this,_0x1ac18d[_0x5bb3('0xd4')]);if(_0x2c1767){this[_0x5bb3('0x10')]['setVariable'](_0x2c1767,_0x21e5a4);return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x1af'),_0x1ac18d[_0x5bb3('0xb6')],_0x2c1767));}}return this['channel'][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x1ac18d[_0x5bb3('0xb6')]));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1b0')]=function(_0x209f91){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x209f91[_0x5bb3('0x3a')]));_0x209f91[_0x5bb3('0x5f')]=_0x209f91[_0x5bb3('0x5f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x209f91['apiKey'])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0x1b1'));}if(!this[_0x5bb3('0xa9')](_0x209f91['text'])){return this[_0x5bb3('0x10')][_0x5bb3('0xaa')](_0x5bb3('0xab'));}this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x1b2'),_0x209f91[_0x5bb3('0x5f')]));var _0x3f6087=this['googleCloudTTS'][_0x5bb3('0x6e')](this,_0x209f91);if(_0x3f6087){this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x1b3'),_0x3f6087));var _0x432881=this[_0x5bb3('0x10')][_0x5bb3('0xff')](_0x3f6087);try{fs[_0x5bb3('0x100')](_0x3f6087+'.wav');}catch(_0x5e6a75){logger['error'](_0x5e6a75);}return _0x432881;}return this['channel'][_0x5bb3('0x2d')](_0x209f91,_0x5bb3('0x1b4'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1b5')]=function(_0x2b2cf2){logger['info'](util[_0x5bb3('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2b2cf2[_0x5bb3('0x3a')]));_0x2b2cf2[_0x5bb3('0x5f')]=_0x2b2cf2[_0x5bb3('0x5f')][_0x5bb3('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5bb3('0xa9')](_0x2b2cf2[_0x5bb3('0x5f')])){return this[_0x5bb3('0x10')]['noop']('no\x20text\x20configured');}this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x1b6'),_0x2b2cf2[_0x5bb3('0x5f')]));var _0x13fe75=this[_0x5bb3('0x1b7')][_0x5bb3('0x6e')](this,_0x2b2cf2);if(_0x13fe75){this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x1b8'),_0x13fe75));var _0x141f40=this[_0x5bb3('0x10')][_0x5bb3('0xff')](_0x13fe75);try{fs[_0x5bb3('0x100')](_0x13fe75+_0x5bb3('0x101'));}catch(_0x26d9fb){logger[_0x5bb3('0x2d')](_0x26d9fb);}return _0x141f40;}return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x2b2cf2,_0x5bb3('0x1b9'));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1ba')]=function(_0x3c37d5){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x1bb'),_0x3c37d5[_0x5bb3('0x3a')]));if(!this[_0x5bb3('0xa9')](_0x3c37d5[_0x5bb3('0x152')])){return this['channel'][_0x5bb3('0x2d')](_0x3c37d5,'no\x20find\x20by\x20configured');}logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x3c37d5[_0x5bb3('0x152')]));var _0xb75158=this[_0x5bb3('0x54')][_0x5bb3('0x6e')](this,_0x3c37d5[_0x5bb3('0x152')]);if(_0xb75158){logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x154'),this['channel'][_0x5bb3('0x3c')],_0x3c37d5[_0x5bb3('0x152')]));this[_0x5bb3('0x10')][_0x5bb3('0xaa')](util[_0x5bb3('0x2a')](_0x5bb3('0x154'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x3c37d5['findBy']));return{'code':0xc8,'result':_0x5bb3('0x155')};}else{logger[_0x5bb3('0x2f')](util[_0x5bb3('0x2a')](_0x5bb3('0x156'),this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x3c37d5[_0x5bb3('0x152')]));this[_0x5bb3('0x10')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5bb3('0x10')][_0x5bb3('0x3c')],_0x3c37d5['findBy']));return{'code':0xc8,'result':_0x5bb3('0x157')};}};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1bc')]=function(_0x4f6a5f){logger[_0x5bb3('0x2f')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4f6a5f['label']));var _0x8d6742=this['channel']['exec'](_0x5bb3('0x1bd'),[_0x4f6a5f[_0x5bb3('0x1be')],_0x4f6a5f[_0x5bb3('0x78')]]);if(_0x8d6742[_0x5bb3('0xa4')]===-0x1){return _0x8d6742;}return this['channel'][_0x5bb3('0xaa')](util['format'](_0x5bb3('0xc3'),_0x5bb3('0x1bd'),_0x4f6a5f[_0x5bb3('0x1be')]));};AGIVertices[_0x5bb3('0x17')][_0x5bb3('0x1bf')]=function(_0x198ca7){logger[_0x5bb3('0x2f')](util['format'](_0x5bb3('0x1c0'),_0x198ca7['label']));if(!this[_0x5bb3('0xa9')](_0x198ca7[_0x5bb3('0xd4')])){return this['channel'][_0x5bb3('0x2d')](_0x198ca7,_0x5bb3('0x1a0'));}var _0x1aefca=this[_0x5bb3('0x12')]['sync'](this,_0x198ca7[_0x5bb3('0xd4')]);if(!_0x1aefca){return this[_0x5bb3('0x10')][_0x5bb3('0x2d')](_0x198ca7,_0x5bb3('0xd5'));}var _0x395232=this[_0x5bb3('0x10')][_0x5bb3('0x12')](_0x1aefca);return{'code':0xc8,'result':_0x395232[_0x5bb3('0xa5')]?_0x395232[_0x5bb3('0xa5')]:'-'};};String['prototype'][_0x5bb3('0xa3')]=function(_0x5cb88c,_0x1eeb49){return this[_0x5bb3('0xa2')](_0x5cb88c)[_0x5bb3('0x1c1')](_0x1eeb49);};module['exports']=AGIVertices; \ No newline at end of file +var _0x9efc=['error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','awsLex','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','%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','ispeech\x20TTS\x20is\x20unreachable','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','shelljs','odbc','randomstring','request-promise','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open'];(function(_0x3a6417,_0x55762a){var _0x3b911d=function(_0x4e1964){while(--_0x4e1964){_0x3a6417['push'](_0x3a6417['shift']());}};_0x3b911d(++_0x55762a);}(_0x9efc,0x19c));var _0xc9ef=function(_0x499044,_0x1b0dd0){_0x499044=_0x499044-0x0;var _0x1d004b=_0x9efc[_0x499044];return _0x1d004b;};'use strict';var fs=require('fs');var util=require(_0xc9ef('0x0'));var _=require(_0xc9ef('0x1'));var sh=require(_0xc9ef('0x2'));var odbc=require(_0xc9ef('0x3'))();var rs=require(_0xc9ef('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xc9ef('0x5'));var logger=require('../../config/logger')(_0xc9ef('0x6'));var config=require('../../config/environment');var shared=require(_0xc9ef('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xc9ef('0x8');var recursiveMapAttributes=[_0xc9ef('0x9'),_0xc9ef('0xa')];var verticesWithRetry=[_0xc9ef('0xb'),_0xc9ef('0xc'),_0xc9ef('0xd')];var AGIVertices=function(_0x2795e4,_0xf37f26,_0x418b6b){this[_0xc9ef('0xe')]=_0x2795e4;this[_0xc9ef('0xf')]=_0xf37f26;this['mailRpc']=_0x418b6b;};AGIVertices['prototype'][_0xc9ef('0x10')]=function(_0x502913,_0xe8aa1f){this['rpc'][_0xc9ef('0x11')](_0x502913)['then'](function(_0x56c2c0){_0xe8aa1f(null,_0x56c2c0?_0x56c2c0[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x2ce47b){_0xe8aa1f(_0x2ce47b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x15')]=function(_0x233017,_0x17eed6){this[_0xc9ef('0xf')][_0xc9ef('0x16')](_0x233017)[_0xc9ef('0x17')](function(_0x624d74){_0x17eed6(null,_0x624d74?_0x624d74['name']:![]);})[_0xc9ef('0x13')](function(_0x181c2b){_0x17eed6(_0x181c2b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18')]=function(_0xaea0df,_0x54e2c3){this[_0xc9ef('0xf')][_0xc9ef('0x19')](_0xaea0df)[_0xc9ef('0x17')](function(_0x122fb8){_0x54e2c3(null,_0x122fb8?_0x122fb8[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x1a2519){_0x54e2c3(_0x1a2519);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1a')]=function(_0xcc0fd8,_0x2fc01a){this[_0xc9ef('0xf')][_0xc9ef('0x1b')](_0xcc0fd8)[_0xc9ef('0x17')](function(_0x572f83){_0x2fc01a(null,_0x572f83?_0x572f83[_0xc9ef('0x1c')]:![]);})[_0xc9ef('0x13')](function(_0x32999b){_0x2fc01a(_0x32999b);});};AGIVertices['prototype'][_0xc9ef('0x1d')]=function(_0x23a402,_0x1ffff8){this[_0xc9ef('0xf')]['getUserById'](_0x23a402)[_0xc9ef('0x17')](function(_0x27df1f){_0x1ffff8(null,_0x27df1f?_0x27df1f['name']:![]);})[_0xc9ef('0x13')](function(_0xcd720a){_0x1ffff8(_0xcd720a);});};AGIVertices['prototype'][_0xc9ef('0x1e')]=function(_0x394a40,_0x3e336a){this[_0xc9ef('0xf')]['getTrunkById'](_0x394a40)[_0xc9ef('0x17')](function(_0x3b425f){_0x3e336a(null,_0x3b425f?_0x3b425f[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x53bf57){_0x3e336a(_0x53bf57);});};AGIVertices['prototype'][_0xc9ef('0x1f')]=function(_0x40c51b,_0x6dc9ee){var _0x53e1fe=this;this[_0xc9ef('0xf')][_0xc9ef('0x20')](_0x40c51b)[_0xc9ef('0x17')](function(_0x4042fc){_0x6dc9ee(null,_0x4042fc?_0x53e1fe[_0xc9ef('0x21')](_0x4042fc['save_name']):![]);})['catch'](function(_0x458546){_0x6dc9ee(_0x458546);});};AGIVertices[_0xc9ef('0x14')]['getMailAccount']=function(_0x5987c1,_0x123005){this['rpc'][_0xc9ef('0x22')](_0x5987c1)['then'](function(_0x2bf9be){_0x123005(null,_0x2bf9be?_0x2bf9be:![]);})[_0xc9ef('0x13')](function(_0x178a50){_0x123005(_0x178a50);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x23')]=function(_0x148190,_0x5210ac,_0x2f957b){this[_0xc9ef('0x24')]['sendMailMessage'](_0x148190,_0x5210ac)[_0xc9ef('0x17')](function(){_0x2f957b(null);})[_0xc9ef('0x13')](function(_0xe040e){_0x2f957b(_0xe040e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x25')]=function(_0x56f2e0,_0x239c18){this[_0xc9ef('0xf')][_0xc9ef('0x26')](_0x56f2e0)[_0xc9ef('0x17')](function(_0x1abd64){if(_0x1abd64){if(_0x1abd64['IntervalId']){_0x239c18(null,[_0x1abd64['interval']]);}else{_0x239c18(null,_[_0xc9ef('0x27')](_0x1abd64[_0xc9ef('0x28')],_0xc9ef('0x29')));}}else{_0x239c18(null,![]);}})['catch'](function(_0x5f2393){_0x239c18(_0x5f2393);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x21')]=function(_0x49aa7f){return util['format'](_0xc9ef('0x2a'),FILES_PATH,_0x49aa7f);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x2b')]=function(_0x50ece6,_0x1b77d5,_0x434296){odbc[_0xc9ef('0x2c')](_0x50ece6,function(_0x4ef921){if(_0x4ef921){logger[_0xc9ef('0x2d')](_0xc9ef('0x2e'),_0x4ef921);_0x434296(_0x4ef921);}else{logger[_0xc9ef('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1b77d5,function(_0x44f3e5,_0x43a177){if(_0x44f3e5){logger['info'](_0xc9ef('0x30'),_0x1b77d5);_0x434296(_0x44f3e5);}else{logger['info'](_0xc9ef('0x31'),_0x1b77d5);odbc[_0xc9ef('0x32')](function(_0x3904ba){if(_0x3904ba){logger['error'](_0xc9ef('0x33'),_0x3904ba);}_0x434296(null,_0x43a177);});}});}});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x34')]=function(_0x115422,_0x35da4a){this[_0xc9ef('0xf')][_0xc9ef('0x35')](_0x115422)[_0xc9ef('0x17')](function(_0x33678d){_0x35da4a(null,_0x33678d?_0x33678d:![]);})['catch'](function(_0xe2b221){_0x35da4a(_0xe2b221);});};AGIVertices[_0xc9ef('0x14')]['createSmsMessage']=function(_0x39d2b0,_0x1fd1f0){this[_0xc9ef('0xf')][_0xc9ef('0x36')](_0x39d2b0)[_0xc9ef('0x17')](function(_0x2d0a9d){_0x1fd1f0(null,_0x2d0a9d);})[_0xc9ef('0x13')](function(_0x57bdbb){_0x1fd1f0(_0x57bdbb);});};AGIVertices[_0xc9ef('0x14')]['createSquareDetailsReport']=function(_0x42e7c0,_0x5f2b8c,_0x4ef754){this[_0xc9ef('0xf')][_0xc9ef('0x37')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'node':_0x42e7c0[_0xc9ef('0x39')],'application':_0x42e7c0[_0xc9ef('0x3a')],'data':_0x5f2b8c||null,'project_name':this[_0xc9ef('0xe')][_0xc9ef('0x3b')],'callerid':this['channel'][_0xc9ef('0x3c')]})['then'](function(_0x459ceb){if(_0x4ef754){_0x4ef754(null,_0x459ceb);}})[_0xc9ef('0x13')](function(_0x260677){if(_0x4ef754){_0x4ef754(_0x260677);}});};AGIVertices[_0xc9ef('0x14')]['createSquareRecording']=function(_0x32fb2d,_0x1d25f0,_0xb25053,_0x10e9f2){this['rpc'][_0xc9ef('0x3d')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'callerid':this['channel']['callerid'],'calleridname':this[_0xc9ef('0xe')][_0xc9ef('0x3e')],'context':this[_0xc9ef('0xe')]['context'],'extension':this[_0xc9ef('0xe')]['extension'],'priority':this[_0xc9ef('0xe')][_0xc9ef('0x3f')],'accountcode':this[_0xc9ef('0xe')][_0xc9ef('0x40')],'dnid':this[_0xc9ef('0xe')]['dnid'],'projectName':this[_0xc9ef('0xe')]['arg_1'],'saveName':_0x1d25f0,'filename':_0x32fb2d[_0xc9ef('0x41')]||_0x1d25f0,'savePath':_0xb25053})[_0xc9ef('0x17')](function(_0x3c635b){_0x10e9f2(null,_0x3c635b);})[_0xc9ef('0x13')](function(_0x2ff065){_0x10e9f2(_0x2ff065);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x42')]=function(_0x24553f,_0x216b74,_0x281cf5,_0x4028e8,_0x160633){this[_0xc9ef('0xf')][_0xc9ef('0x42')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'body':_0x24553f,'direction':_0x216b74,'providerName':_0x281cf5,'providerResponse':_0x4028e8})[_0xc9ef('0x17')](function(_0x8c3874){if(_0x160633){_0x160633(null,_0x8c3874);}})[_0xc9ef('0x13')](function(_0x2f8f19){if(_0x160633){_0x160633(_0x2f8f19);}});};AGIVertices[_0xc9ef('0x14')]['createCmContact']=function(_0x4a12c9,_0x66a935){this['rpc'][_0xc9ef('0x43')]({'firstName':_['isEmpty'](_0x4a12c9[_0xc9ef('0x12')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x12')])?_0xc9ef('0x45')+Math[_0xc9ef('0x46')]():_0x4a12c9[_0xc9ef('0x12')],'lastName':_[_0xc9ef('0x47')](_0x4a12c9[_0xc9ef('0x48')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x48')])?null:_0x4a12c9[_0xc9ef('0x48')],'phone':_0x4a12c9[_0xc9ef('0x49')],'ListId':_0x4a12c9[_0xc9ef('0x4a')],'scheduledat':_0x4a12c9[_0xc9ef('0x4b')],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':_0xc9ef('0x4c')+_0x4a12c9['scheduledAt']['toString'](),'priority':_0x4a12c9[_0xc9ef('0x4d')]})[_0xc9ef('0x17')](function(_0x4f9d27){_0x66a935(null,_0x4f9d27);})[_0xc9ef('0x13')](function(_0x38dccb){_0x66a935(_0x38dccb);});};AGIVertices['prototype'][_0xc9ef('0x4e')]=function(_0x137555,_0x31908c){this[_0xc9ef('0xf')][_0xc9ef('0x4f')](_0x137555)[_0xc9ef('0x17')](function(_0xb9265a){_0x31908c(null,_0xb9265a?_0xb9265a[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x462a19){_0x31908c(_0x462a19);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x50')]=function(_0x21e997,_0x250ad3,_0x18eda2){var _0x51a55f={'role':_0xc9ef('0x51')};_0x51a55f[_0x21e997]=this[_0xc9ef('0xe')][_0xc9ef('0x3c')];this[_0xc9ef('0xf')]['agentPause'](_0x51a55f,_0x250ad3,this[_0xc9ef('0xe')][_0xc9ef('0x38')])[_0xc9ef('0x17')](function(_0xe1baf4){_0x18eda2(null,_[_0xc9ef('0x44')](_0xe1baf4)?![]:!![]);})['catch'](function(_0x5f57cc){logger[_0xc9ef('0x2d')](_0x5f57cc);_0x18eda2(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x52')]=function(_0x54cc55,_0x1c8379){var _0x2a0c25={'role':'agent'};_0x2a0c25[_0x54cc55]=this[_0xc9ef('0xe')]['callerid'];this[_0xc9ef('0xf')]['agentUnpause'](_0x2a0c25)[_0xc9ef('0x17')](function(_0x32d0a7){_0x1c8379(null,_[_0xc9ef('0x44')](_0x32d0a7)?![]:!![]);})[_0xc9ef('0x13')](function(_0x5b678e){logger[_0xc9ef('0x2d')](_0x5b678e);_0x1c8379(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x53')]=function(_0x85757f,_0x448177){var _0x437930={'role':_0xc9ef('0x51')};_0x437930[_0x85757f]=this['channel'][_0xc9ef('0x3c')];this[_0xc9ef('0xf')][_0xc9ef('0x53')](_0x437930)[_0xc9ef('0x17')](function(_0x5e38d4){_0x448177(null,_[_0xc9ef('0x44')](_0x5e38d4)?![]:!![]);})[_0xc9ef('0x13')](function(_0x349a10){logger[_0xc9ef('0x2d')](_0x349a10);_0x448177(null,![]);});};AGIVertices['prototype'][_0xc9ef('0x54')]=function(_0x3efc9a,_0x593fd3){var _0x26990f={'role':_0xc9ef('0x51')};_0x26990f[_0x3efc9a]=this['channel'][_0xc9ef('0x3c')];var _0x5235d9=_0x3efc9a!=_0xc9ef('0x55')?util[_0xc9ef('0x56')]('%s/%s@from-sip/n','LOCAL',this[_0xc9ef('0xe')][_0xc9ef('0x3c')]):undefined;this[_0xc9ef('0xf')][_0xc9ef('0x54')](_0x26990f,_0x5235d9)['then'](function(_0x151944){_0x593fd3(null,_['isNil'](_0x151944)?![]:!![]);})[_0xc9ef('0x13')](function(_0x553717){logger[_0xc9ef('0x2d')](_0x553717);_0x593fd3(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x14d108,_0x338df8){sh['exec'](_['trim'](_0x14d108),function(_0x254e77,_0x5162cf){var _0x22847b=_0x5162cf[_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'');_0x338df8(null,_0x22847b);});};AGIVertices['prototype'][_0xc9ef('0x58')]=function(_0x52269e,_0x213a79){scripts['googleCloudTTS'](_0x52269e[_0xc9ef('0x59')],_0x52269e[_0xc9ef('0x5a')]||_0xc9ef('0x5b'),_0x52269e[_0xc9ef('0x5b')],_0x52269e[_0xc9ef('0x5c')]||'en-US',_0x52269e[_0xc9ef('0x5d')]||_0xc9ef('0x5e'),_0x52269e['audioEncoding']||_0xc9ef('0x5f'))[_0xc9ef('0x17')](function(_0x1398d9){_0x213a79(null,_0x1398d9);})[_0xc9ef('0x13')](function(_0xc1049){_0x213a79(_0xc1049);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x60')]=function(_0x11dc8b,_0x42ad4){scripts[_0xc9ef('0x60')](_0x11dc8b[_0xc9ef('0x5b')],_0x11dc8b['google_tts_language']||'en',0x1)[_0xc9ef('0x17')](function(_0x2d8855){_0x42ad4(null,_0x2d8855);})[_0xc9ef('0x13')](function(_0x4b4620){_0x42ad4(_0x4b4620);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x61')]=function(_0x363032,_0x4e5f47){var _0x2ca308={'uri':_0x363032[_0xc9ef('0x62')],'method':_0x363032[_0xc9ef('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x363032[_0xc9ef('0x64')])===_0xc9ef('0x65')&&parseInt(_0x363032[_0xc9ef('0x64')])>=0x1?parseInt(_0x363032[_0xc9ef('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xc9ef('0x66')]([_0xc9ef('0x67'),'PUT'],_0x2ca308[_0xc9ef('0x63')][_0xc9ef('0x68')]())){try{_0x2ca308['body']=_0x363032[_0xc9ef('0xa')]?JSON['parse'](_0x363032[_0xc9ef('0xa')]):{};}catch(_0x19e3c7){logger[_0xc9ef('0x2d')](_0xc9ef('0x69'),_0x19e3c7);}}try{_0x2ca308[_0xc9ef('0x6a')]=_0x363032[_0xc9ef('0x9')]?JSON[_0xc9ef('0x6b')](_0x363032['rawHeaders']):{};}catch(_0x2bfe4d){logger[_0xc9ef('0x2d')](_0xc9ef('0x6c'),_0x2bfe4d);}if(_0x363032[_0xc9ef('0x6d')]){try{var _0x4be265=require(_0x363032['computedVariables'])[_0xc9ef('0x6e')](this,_0x2ca308);_0x2ca308[_0xc9ef('0x6f')]=Mustache[_0xc9ef('0x70')](_0x363032[_0xc9ef('0x62')],_0x4be265,{},['$$','$$']);if(_0x2ca308[_0xc9ef('0x6a')]){_0x2ca308[_0xc9ef('0x6a')]=JSON['parse'](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x6a')]),_0x4be265,{},['$$','$$']));}if(_0x2ca308[_0xc9ef('0x71')]){_0x2ca308[_0xc9ef('0x71')]=JSON[_0xc9ef('0x6b')](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x71')]),_0x4be265,{},['$$','$$']));}}catch(_0x656c29){logger[_0xc9ef('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x656c29);}}rp(_0x2ca308)['then'](function(_0x525c6c){var _0x17fffd={'statusCode':_0x525c6c['statusCode']||0xc8,'statusMessage':_0x525c6c[_0xc9ef('0x72')]||'OK','headers':_0x525c6c['headers']||{},'body':_0x525c6c['body']||{}};_0x4e5f47(null,_0x17fffd);})[_0xc9ef('0x13')](function(_0xbc5168){var _0x54ca4e={'statusCode':_0xbc5168['statusCode']||0x1f4,'statusMessage':_0xbc5168['message']||_0xc9ef('0x73'),'headers':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x6a')]||{},'body':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x71')]||{}};_0x4e5f47(null,_0x54ca4e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x75')]=function(_0x282026,_0x57d44b){scripts['googleDialogflow'](this[_0xc9ef('0xe')]['uniqueid'],_0x282026['key'],_0x282026['text'],_0x282026['dialogflow_language']||'en')[_0xc9ef('0x17')](function(_0x4f034c){_0x57d44b(null,_0x4f034c);})[_0xc9ef('0x13')](function(_0xfa2a57){_0x57d44b(_0xfa2a57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x76')]=function(_0xb6329f,_0x26237b){scripts[_0xc9ef('0x76')](this[_0xc9ef('0xe')]['uniqueid'],_0xb6329f['dialogflowV2_project_id'],_0xb6329f[_0xc9ef('0x77')],_0xb6329f[_0xc9ef('0x78')],_0xb6329f['text'],_0xb6329f[_0xc9ef('0x79')]||'en')['then'](function(_0x1493e3){_0x26237b(null,_0x1493e3);})[_0xc9ef('0x13')](function(_0x5586dd){_0x26237b(_0x5586dd);});};AGIVertices[_0xc9ef('0x14')]['sestekNDA']=function(_0x4f5dbd,_0x1a47e4){scripts['sestekNDA'](this[_0xc9ef('0xe')],_0x4f5dbd)['then'](function(_0x9fb1b6){_0x1a47e4(null,_0x9fb1b6);})['catch'](function(_0x5a1fe2){_0x1a47e4(_0x5a1fe2);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7a')]=function(_0x27e2d4,_0x91704c){scripts[_0xc9ef('0x7a')](_0x27e2d4['key'],_0x27e2d4[_0xc9ef('0x5b')],_0x27e2d4[_0xc9ef('0x7b')]||_0xc9ef('0x7c'),_0x27e2d4[_0xc9ef('0x7d')])[_0xc9ef('0x17')](function(_0x28f440){_0x91704c(null,_0x28f440);})[_0xc9ef('0x13')](function(_0x25ff57){_0x91704c(_0x25ff57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7e')]=function(_0x494bfe,_0x3ed381,_0x4fe532){scripts[_0xc9ef('0x7e')](_0x3ed381,_0x494bfe[_0xc9ef('0x7f')],_0x494bfe[_0xc9ef('0x80')]||_0xc9ef('0x7c'),this[_0xc9ef('0x81')](_0x494bfe[_0xc9ef('0x82')])?_0x494bfe['model']:undefined)[_0xc9ef('0x17')](function(_0x56ffdc){_0x4fe532(null,_0x56ffdc);})['catch'](function(_0x3112f3){_0x4fe532(_0x3112f3);});};AGIVertices['prototype'][_0xc9ef('0x83')]=function(_0x57b8ef,_0x36efc5){scripts[_0xc9ef('0x83')](_0x57b8ef[_0xc9ef('0x84')],_0x57b8ef[_0xc9ef('0x85')],_0x57b8ef[_0xc9ef('0x86')],_0x57b8ef[_0xc9ef('0x87')]||'Amy',_0x57b8ef[_0xc9ef('0x5b')],_0x57b8ef[_0xc9ef('0x88')]||_0xc9ef('0x5b'))['then'](function(_0x306546){_0x36efc5(null,_0x306546);})[_0xc9ef('0x13')](function(_0xf33e35){_0x36efc5(_0xf33e35);});};AGIVertices[_0xc9ef('0x14')]['awsLex']=function(_0x40a09c,_0x58089c){scripts['awsLex'](this[_0xc9ef('0xe')][_0xc9ef('0x38')],_0x40a09c[_0xc9ef('0x84')],_0x40a09c['aws_secret_access_key'],_0x40a09c[_0xc9ef('0x89')],_0x40a09c['text'],_0x40a09c[_0xc9ef('0x8a')])['then'](function(_0x29f821){_0x58089c(null,_0x29f821);})['catch'](function(_0x3862bd){_0x58089c(_0x3862bd);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8b')]=function(_0x429d75,_0x299b3e,_0x58742f){scripts[_0xc9ef('0x8b')](_0x299b3e,_0x429d75[_0xc9ef('0x7f')],_0x429d75[_0xc9ef('0x8c')]||'en-US')[_0xc9ef('0x17')](function(_0xc3c1cd){_0x58742f(null,_0xc3c1cd);})[_0xc9ef('0x13')](function(_0x246af1){_0x58742f(_0x246af1);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8d')]=function(_0x17fc35,_0x31b5b3,_0x1a0be7){scripts['tildeASR'](_0x31b5b3,_0x17fc35[_0xc9ef('0x8e')],_0x17fc35[_0xc9ef('0x8f')],_0x17fc35[_0xc9ef('0x6f')])['then'](function(_0x2566de){_0x1a0be7(null,_0x2566de);})[_0xc9ef('0x13')](function(_0x89b157){_0x1a0be7(_0x89b157);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x90')]=function(_0x350677){var _0x53596a=_['includes'](verticesWithRetry,_0x350677['agicommand'])?_0x350677:_[_0xc9ef('0x91')](_0x350677);for(var _0x34253a in _0x53596a){if(_0x53596a[_0xc9ef('0x92')](_0x34253a)){if(_0x53596a[_0x34253a]&&_[_0xc9ef('0x93')](_0x53596a[_0x34253a])){if(_[_0xc9ef('0x66')](recursiveMapAttributes,_0x34253a)){_0x53596a[_0x34253a]=this[_0xc9ef('0x94')](_0x53596a[_0x34253a]);}else{_0x53596a[_0x34253a]=this[_0xc9ef('0x95')](_0x53596a[_0x34253a]);}}}}return _0x53596a;};AGIVertices[_0xc9ef('0x14')]['recursiveNodeIndex']=function(_0x3fc804){for(var _0x507544 in _0x3fc804){if(_0x3fc804['hasOwnProperty'](_0x507544)){if(_[_0xc9ef('0x96')](_0x3fc804[_0x507544])){this[_0xc9ef('0x97')](_0x3fc804[_0x507544]);}else if(_[_0xc9ef('0x98')](_0x3fc804[_0x507544])){for(var _0x4e5ebd=0x0;_0x4e5ebd<_0x3fc804[_0x507544][_0xc9ef('0x99')];_0x4e5ebd++){this[_0xc9ef('0x97')](_0x3fc804[_0x507544][_0x4e5ebd]);}}else if(_['isString'](_0x3fc804[_0x507544])){_0x3fc804[_0x507544]=this[_0xc9ef('0x95')](_0x3fc804[_0x507544]);}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x9a')]=function(_0x553c4a,_0x948bc9){for(var _0x5be3c4 in _0x553c4a){if(_0x553c4a[_0xc9ef('0x92')](_0x5be3c4)){if(_['isPlainObject'](_0x553c4a[_0x5be3c4])){if(!_[_0xc9ef('0x47')](_0x553c4a[_0x5be3c4])){this[_0xc9ef('0x9a')](_0x553c4a[_0x5be3c4],util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x948bc9,_0x5be3c4));}}else if(_['isArray'](_0x553c4a[_0x5be3c4])){for(var _0x25a37c=0x0;_0x25a37c<_0x553c4a[_0x5be3c4][_0xc9ef('0x99')];_0x25a37c++){this['saveRestApiResult'](_0x553c4a[_0x5be3c4][_0x25a37c],util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4+'['+_0x25a37c+']'));}}else{if(!_[_0xc9ef('0x44')](_0x553c4a[_0x5be3c4])){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4),_0x553c4a[_0x5be3c4]);}}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x94')]=function(_0x9edcf1){try{var _0x29044a=JSON[_0xc9ef('0x6b')](_0x9edcf1);this['recursiveNodeIndex'](_0x29044a);return JSON[_0xc9ef('0x9d')](_0x29044a);}catch(_0xd7b599){return this[_0xc9ef('0x95')](_0x9edcf1);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x95')]=function(_0x33a442){var _0x42ac7d=_0x33a442[_0xc9ef('0x9e')]('{');for(var _0x39df1f=0x1;_0x39df1f<_0x42ac7d[_0xc9ef('0x99')];_0x39df1f+=0x1){var _0x2727b9=_0x42ac7d[_0x39df1f][_0xc9ef('0x9e')]('}');if(_0x2727b9[_0xc9ef('0x99')]>0x1){_0x33a442=_0x33a442['replaceAll']('{'+_0x2727b9[0x0]+'}',this[_0xc9ef('0xe')][_0xc9ef('0x10')](_0x2727b9[0x0])[_0xc9ef('0x9f')]||_0x2727b9[0x0]);}}if(_0x42ac7d['length']===0x1){return _0x33a442[_0xc9ef('0xa0')]();}return this[_0xc9ef('0x95')](_0x33a442);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa1')]=function(_0x49983a,_0x1703d7){var _0x3a03d5=this[_0xc9ef('0xe')]['getVariable'](_0x49983a);if(_0x3a03d5[_0xc9ef('0xa2')]===-0x1){return _0x3a03d5;}logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa3'),_0x1703d7,_0x3a03d5['extra']));return this[_0xc9ef('0xe')]['setVariable'](_0x1703d7,_0x3a03d5['extra']);};AGIVertices[_0xc9ef('0x14')]['isConfigured']=function(_0x3d2ae1){return _0x3d2ae1&&_0x3d2ae1!=='0'&&_0x3d2ae1!=='-1'&&_0x3d2ae1!=='';};AGIVertices['prototype'][_0xc9ef('0xa4')]=function(_0x4bdd5c){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4bdd5c,'-');_0x4bdd5c[_0xc9ef('0xa5')]=_0x4bdd5c[_0xc9ef('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa6')]=function(_0x359e53){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa7'),_0x359e53[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}var _0x3947ab='\x22'+_0x359e53[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x74')])){_0x3947ab+=','+_0x359e53[_0xc9ef('0x74')];}var _0x2d4776=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3947ab);if(_0x2d4776['result']===-0x1){return _0x2d4776;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3947ab));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xab')]=function(_0x536f2e){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x536f2e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x536f2e['grammar'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x2a0bda=_0x536f2e[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x536f2e['options'])){_0x2a0bda+=','+_0x536f2e[_0xc9ef('0x74')];}var _0x565c32=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x2a0bda);if(_0x565c32[_0xc9ef('0xa2')]===-0x1){return _0x565c32;}var _0x1da388=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xaf'));if(_0x1da388[_0xc9ef('0xa2')]===-0x1){return _0x1da388;}var _0x36d1fb=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xb0'));if(_0x36d1fb[_0xc9ef('0xa2')]===-0x1){return _0x36d1fb;}var _0x55fd73=this[_0xc9ef('0xa1')]('RECOG_INSTANCE()',_0xc9ef('0xb1'));if(_0x55fd73['result']===-0x1){return _0x55fd73;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xb2'),_0x2a0bda));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x6')]=function(_0x22231a){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xb3'),_0x22231a[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x6')]([_0x22231a[_0xc9ef('0xb4')],_0x22231a['args']]);};AGIVertices[_0xc9ef('0x14')]['answer']=function(_0x189711){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb5'),_0x189711[_0xc9ef('0x39')]));if(this[_0xc9ef('0x81')](_0x189711[_0xc9ef('0x64')])){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb6'),_0x189711[_0xc9ef('0x64')]));var _0x375ba=this[_0xc9ef('0xe')]['wait'](_0x189711[_0xc9ef('0x64')]);if(_0x375ba[_0xc9ef('0xa2')]===-0x1){return _0x375ba;}}return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb8')]=function(_0x56a2d3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb9'),_0x56a2d3['label']));if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4a')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x56a2d3,'no\x20list\x20selected');}_0x56a2d3[_0xc9ef('0x4b')]=moment();if(this['isConfigured'](_0x56a2d3[_0xc9ef('0xba')])){_0x56a2d3[_0xc9ef('0x4b')]=moment()[_0xc9ef('0xbb')](_0x56a2d3[_0xc9ef('0xba')],'minutes');}if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4d')])){_0x56a2d3[_0xc9ef('0x4d')]=0x2;}this[_0xc9ef('0x43')][_0xc9ef('0x6e')](this,_0x56a2d3);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbc'),_0x56a2d3[_0xc9ef('0x49')],_0x56a2d3[_0xc9ef('0x4a')],_0x56a2d3['scheduledAt']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xbd')]=function(_0x546e34){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x546e34[_0xc9ef('0x39')]));var _0x41700b=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0x546e34[_0xc9ef('0xbe')],_0x546e34[_0xc9ef('0x74')]);if(_0x41700b['result']===-0x1){return _0x41700b;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0x546e34['application'],_0x546e34['options']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc0')]=function(_0x34b1a5){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xc1'),_0x34b1a5[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x34b1a5[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x3de43b='\x22'+_0x34b1a5[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x34b1a5['options'])){_0x3de43b+=','+_0x34b1a5[_0xc9ef('0x74')];}var _0x5589b5=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3de43b);if(_0x5589b5[_0xc9ef('0xa2')]===-0x1){return _0x5589b5;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x3de43b));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc4')]=function(_0x1c52e2){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1c52e2[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x1e5207='\x22'+_0x1c52e2['text']+'\x22';if(this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x74')])){_0x1e5207+=','+_0x1c52e2['options'];}var _0x41720f=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xaa'),_0x1e5207);if(_0x41720f[_0xc9ef('0xa2')]===-0x1){return _0x41720f;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x1e5207));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc5')]=function(_0x3056b9){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xc6'),_0x3056b9[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0xad')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x206e1f=_0x3056b9[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0x74')])){_0x206e1f+=','+_0x3056b9[_0xc9ef('0x74')];}var _0x45e067=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x206e1f);if(_0x45e067['result']===-0x1){return _0x45e067;}var _0x56f487=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xc7'));if(_0x56f487[_0xc9ef('0xa2')]===-0x1){return _0x56f487;}var _0x5cf085=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xc8'));if(_0x5cf085[_0xc9ef('0xa2')]===-0x1){return _0x5cf085;}var _0x147271=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),'LUMENVOX_ASR_INSTANCE');if(_0x147271['result']===-0x1){return _0x147271;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x206e1f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xca')]=function(_0x9fd023){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xcb'),_0x9fd023[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0xad')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x561d03=_0x9fd023[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0x74')])){_0x561d03+=','+_0x9fd023[_0xc9ef('0x74')];}var _0x1b00ff=this['channel'][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x561d03);if(_0x1b00ff[_0xc9ef('0xa2')]===-0x1){return _0x1b00ff;}var _0x5e7635=this[_0xc9ef('0xa1')](_0xc9ef('0xcc'),_0xc9ef('0xcd'));if(_0x5e7635[_0xc9ef('0xa2')]===-0x1){return _0x5e7635;}var _0xb06252=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xce'));if(_0xb06252[_0xc9ef('0xa2')]===-0x1){return _0xb06252;}var _0x59bd93=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),_0xc9ef('0xcf'));if(_0x59bd93[_0xc9ef('0xa2')]===-0x1){return _0x59bd93;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x561d03));};AGIVertices['prototype'][_0xc9ef('0xd0')]=function(_0x423d31){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xd1'),_0x423d31[_0xc9ef('0x39')]));if(!this['isConfigured'](_0x423d31[_0xc9ef('0xd2')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd3'));}var _0x733fa5=this['getSquareOdbc'][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd2')]);if(!_0x733fa5){return this[_0xc9ef('0xe')]['error'](_0x423d31,_0xc9ef('0xd4'));}if(!this[_0xc9ef('0x81')](_0x423d31['query'])){return this['channel'][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd5'));}var _0x3cd3ed=_0x423d31[_0xc9ef('0xd6')][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xd7'),_0x3cd3ed));var _0x1463c3=this['getQueryOdbc'][_0xc9ef('0x6e')](this,_0x733fa5,_0x3cd3ed);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x423d31,_0x3cd3ed);if(!this[_0xc9ef('0x81')](_0x423d31[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x343a68=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd8')]);if(!_0x343a68){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,'no\x20variable\x20found');}var _0x4ccab=this;_0x1463c3[_0xc9ef('0xda')](function(_0x213717,_0xc577e3){Object[_0xc9ef('0xdb')](_0x213717)[_0xc9ef('0xda')](function(_0x3ce224){_0x4ccab[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0xdc'),_0x343a68,_0xc577e3,_0x3ce224),_0x213717[_0x3ce224]);});});this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xdd'),_0x343a68),_0x1463c3[_0xc9ef('0x99')]);return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xde'),_0x343a68));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xdf')]=function(_0x426dcc){logger[_0xc9ef('0xe0')](util[_0xc9ef('0x56')](_0xc9ef('0xe1'),_0x426dcc['label']));if(!this[_0xc9ef('0x81')](_0x426dcc['sip_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe2'));}var _0xd36d8a=this[_0xc9ef('0x1d')][_0xc9ef('0x6e')](this,_0x426dcc['sip_id']);if(!_0xd36d8a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe3'));}var _0x3fa98e=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')]('SIP/%s',_0xd36d8a),_0x426dcc[_0xc9ef('0x64')],_0x426dcc[_0xc9ef('0xe5')],_0x426dcc[_0xc9ef('0x62')]]);if(_0x3fa98e[_0xc9ef('0xa2')]===-0x1){return _0x3fa98e;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')]['dialogflow']=function(_0x321e5c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xe7'),_0x321e5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x321e5c);this[_0xc9ef('0x42')](_0x321e5c[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Dialogflow:\x20%s',_0x321e5c[_0xc9ef('0x5b')]));var _0x5c2090=this[_0xc9ef('0x75')][_0xc9ef('0x6e')](this,_0x321e5c);if(_0x5c2090){for(var _0x594371 in _0x5c2090){if(_0x5c2090['hasOwnProperty'](_0x594371)){this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('DIALOGFLOW_%s',_0x594371[_0xc9ef('0x68')]()),_0x5c2090[_0x594371]);}}this[_0xc9ef('0x42')](_0x5c2090[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xec'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xed'),_0x5c2090['speech']));}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x321e5c,_0xc9ef('0xee'));};AGIVertices['prototype']['dialogflowV2']=function(_0x13d5fa){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x13d5fa[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0xef')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf0'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x77')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf1'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x78')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf2'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x79')])){return this['channel'][_0xc9ef('0xa8')]('no\x20anguage\x20configured');}if(!this[_0xc9ef('0x81')](_0x13d5fa['text'])){return this[_0xc9ef('0xe')]['noop']('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this['createSquareDetailsReport'](_0x13d5fa);this['createSquareMessage'](_0x13d5fa['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xf3'),_0x13d5fa['text']));var _0x37e239=this[_0xc9ef('0x76')][_0xc9ef('0x6e')](this,_0x13d5fa);if(_0x37e239){for(var _0x21ead5 in _0x37e239){if(_0x37e239[_0xc9ef('0x92')](_0x21ead5)){if(_0x21ead5!==_0xc9ef('0xf4')){this['channel']['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xf5'),_0x21ead5[_0xc9ef('0x68')]()),_0x37e239[_0x21ead5]);}}}this[_0xc9ef('0x42')](_0x37e239[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xf6'),_0x37e239[_0xc9ef('0xf4')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xf7'),_0x37e239[_0xc9ef('0xea')]));}return this['channel'][_0xc9ef('0x2d')](_0x13d5fa,_0xc9ef('0xf8'));};AGIVertices[_0xc9ef('0x14')]['sesteknda']=function(_0x4812cf){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xf9'),_0x4812cf[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfa')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xfb'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfc')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xfd'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfe')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xff'));}if(!this[_0xc9ef('0x81')](_0x4812cf['ndassistant_url'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x4812cf);this[_0xc9ef('0x42')](_0x4812cf[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x100'),_0x4812cf[_0xc9ef('0x5b')]));var _0x1ea210=this[_0xc9ef('0x101')][_0xc9ef('0x6e')](this,_0x4812cf);if(_0x1ea210){for(var _0x3c1c92 in _0x1ea210){if(_0x1ea210['hasOwnProperty'](_0x3c1c92)){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x102'),_0x3c1c92[_0xc9ef('0x68')]()),_0x1ea210[_0x3c1c92]);}}this[_0xc9ef('0x42')](_0x1ea210[_0xc9ef('0xea')],'out',_0xc9ef('0x103'),'');if(_0x1ea210['audiofile']){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x104'),_0x1ea210['audiofile']));var _0x4249f4=this['channel'][_0xc9ef('0x105')](_0x1ea210[_0xc9ef('0x106')]);try{fs[_0xc9ef('0x107')](_0x1ea210[_0xc9ef('0x106')]+_0xc9ef('0x108'));}catch(_0x486127){logger[_0xc9ef('0x2d')](_0x486127);}return _0x4249f4;}else{return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x109'),_0x1ea210[_0xc9ef('0xea')]));}}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4812cf,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x10a')]=function(_0x5a06d6){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x10b'),_0x5a06d6[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('end');};AGIVertices['prototype'][_0xc9ef('0x10c')]=function(_0x184eac){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x184eac[_0xc9ef('0x39')]));var _0x444fe0='';if(_0x184eac[_0xc9ef('0x10d')]){if(!this[_0xc9ef('0x81')](_0x184eac[_0xc9ef('0x10d')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20selected');}else{var _0x4a84f0=parseInt(_0x184eac[_0xc9ef('0x10d')],0xa);if(isNaN(_0x4a84f0)){_0x444fe0=_0x184eac['trunk_id'];}else{_0x444fe0=this[_0xc9ef('0x1e')][_0xc9ef('0x6e')](this,_0x184eac[_0xc9ef('0x10d')]);if(!_0x444fe0){return this['channel'][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20found');}}}}else if(_0x184eac[_0xc9ef('0x10e')]){_0x444fe0=_0x184eac['trunk_name'];}else{return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,_0xc9ef('0x10f'));}var _0x35c5c2=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')](_0xc9ef('0x110'),_0x444fe0,_0x184eac[_0xc9ef('0x49')]),_0x184eac[_0xc9ef('0x64')],_0x184eac[_0xc9ef('0xe5')],_0x184eac[_0xc9ef('0x62')]]);if(_0x35c5c2[_0xc9ef('0xa2')]===-0x1){return _0x35c5c2;}return this['channel'][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x111')]=function(_0x9409c0){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x112'),_0x9409c0[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('finally');};AGIVertices['prototype'][_0xc9ef('0xc')]=function(_0x264b9e){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x113'),_0x264b9e[_0xc9ef('0x39')]));if(_0x264b9e[_0xc9ef('0xa5')]===0x0){return this[_0xc9ef('0xa4')](_0x264b9e);}_0x264b9e[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x264b9e['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x114'));}var _0x3e2a87=this[_0xc9ef('0x1f')]['sync'](this,_0x264b9e[_0xc9ef('0x115')]);if(!_0x3e2a87){return this['channel'][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x116'));}if(!this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0xd8')])){return this['channel']['error'](_0xc9ef('0xd9'));}var _0x3b416f=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x3e2a87,_0x264b9e[_0xc9ef('0x118')],_0x264b9e[_0xc9ef('0x119')]);var _0x3216a9=_0x3b416f[_0xc9ef('0xa2')]?_0x3b416f[_0xc9ef('0xa2')][_0xc9ef('0xa0')]():'';logger[_0xc9ef('0x2f')](_0xc9ef('0x11a'),JSON[_0xc9ef('0x9d')](_0x3b416f));if(_0x3b416f[_0xc9ef('0xa2')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x264b9e,_0x3216a9);return _0x3b416f;}else if(_0x3b416f[_0xc9ef('0x9f')]===_0xc9ef('0x64')){_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9['length']>=parseInt(_0x264b9e[_0xc9ef('0x11b')])?'x':'i';}else{_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9[_0xc9ef('0x99')]>=parseInt(_0x264b9e['mindigit'])&&_0x3216a9[_0xc9ef('0x99')]<=parseInt(_0x264b9e['maxdigit'])?'x':'i';}var _0x126ea5=this['getVariable']['sync'](this,_0x264b9e[_0xc9ef('0xd8')]);if(!_0x126ea5){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x126ea5,_0x3216a9);if(this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0x11d')])){var _0x2aeadd=parseInt(_0x264b9e[_0xc9ef('0x11d')],0xa);var _0x3d4e76=rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x2aeadd});var _0x890848=_0x3216a9[_0xc9ef('0x99')];if(_0x890848>0x0){if(_0x890848>_0x2aeadd){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x264b9e,_0x264b9e[_0xc9ef('0x11f')]===_0xc9ef('0x120')?_0x3d4e76+_0x3216a9[_0xc9ef('0x121')](_0x2aeadd):_0x3216a9[_0xc9ef('0x121')](0x0,_0x890848-_0x2aeadd)+_0x3d4e76);}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x890848}));}}else{this['createSquareDetailsReport']['sync'](this,_0x264b9e,'');}}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,_0x3216a9);}return _0x3b416f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xd')]=function(_0x8dcb07){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x122'),_0x8dcb07[_0xc9ef('0x39')]));return this['getdigits'](_0x8dcb07);};AGIVertices[_0xc9ef('0x14')]['goal']=function(_0x3a05c0){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x123'),_0x3a05c0[_0xc9ef('0x39')]));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x3a05c0,_0x3a05c0[_0xc9ef('0x124')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x125'),_0x3a05c0['goalname']));};AGIVertices['prototype'][_0xc9ef('0x126')]=function(_0xd048e9){logger['info'](util[_0xc9ef('0x56')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xd048e9['label']));if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x84')])||!this['isConfigured'](_0xd048e9[_0xc9ef('0x85')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x128'),_0xd048e9[_0xc9ef('0x5b')]));var _0x453081=this['awsPolly']['sync'](this,_0xd048e9);if(_0x453081){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x129'),_0x453081));var _0x566248=this['channel'][_0xc9ef('0x105')](_0x453081);try{fs[_0xc9ef('0x107')](_0x453081+_0xc9ef('0x108'));}catch(_0x43c2a2){logger['error'](_0x43c2a2);}return _0x566248;}return this['channel'][_0xc9ef('0x2d')](_0xd048e9,_0xc9ef('0x12a'));};AGIVertices[_0xc9ef('0x14')]['awslex']=function(_0x202c96){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x12b'),_0x202c96[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x202c96['aws_access_key_id'])||!this[_0xc9ef('0x81')](_0x202c96['aws_secret_access_key'])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x8a')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x12c'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x202c96);this[_0xc9ef('0x42')](_0x202c96['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x202c96[_0xc9ef('0x5b')]));var _0x281bdf=this[_0xc9ef('0x12d')][_0xc9ef('0x6e')](this,_0x202c96);if(_0x281bdf){for(var _0x10f1f8 in _0x281bdf){if(_0x281bdf['hasOwnProperty'](_0x10f1f8)&&_[_0xc9ef('0x93')](_0x281bdf[_0x10f1f8])){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x12e'),_0x10f1f8[_0xc9ef('0x68')]()),_0x281bdf[_0x10f1f8]);}}if(_[_0xc9ef('0x44')](_0x281bdf[_0xc9ef('0x12f')])){return this['channel'][_0xc9ef('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xc9ef('0x42')](_0x281bdf[_0xc9ef('0x12f')],_0xc9ef('0xeb'),_0xc9ef('0x130'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x131'),_0x281bdf[_0xc9ef('0x12f')]));}}return this['channel'][_0xc9ef('0x2d')](_0x202c96,_0xc9ef('0x132'));};AGIVertices['prototype'][_0xc9ef('0x133')]=function(_0x1166bd){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x134'),_0x1166bd[_0xc9ef('0x39')],_0x1166bd[_0xc9ef('0x64')]));if(!this['isConfigured'](_0x1166bd[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20key\x20configured');}var _0x453ac3='wav';var _0x240f6e=util[_0xc9ef('0x56')]('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x418f41=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x240f6e,_0x453ac3);var _0x4caae4=!![];if(_0x1166bd[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x4caae4=![];}var _0x319b5a=this['channel'][_0xc9ef('0x137')](_0x240f6e,_0x453ac3,_0x1166bd[_0xc9ef('0x138')],_0x1166bd[_0xc9ef('0x64')],undefined,_0x4caae4);if(_0x319b5a[_0xc9ef('0xa2')]!==-0x1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x139'),_0x418f41));var _0x10f14d=this[_0xc9ef('0x8b')][_0xc9ef('0x6e')](this,_0x1166bd,_0x418f41);if(_0x10f14d){for(var _0x228ead in _0x10f14d){if(_0x10f14d[_0xc9ef('0x92')](_0x228ead)){this['channel'][_0xc9ef('0x9c')](util['format']('GOOGLE_ASR_%s',_0x228ead[_0xc9ef('0x68')]()),_0x10f14d[_0x228ead]);}}return this['channel']['noop'](util['format'](_0xc9ef('0x13a'),JSON[_0xc9ef('0x9d')](_0x10f14d)));}}return _0x319b5a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13b')]=function(_0x112996){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x13c'),_0x112996['label']));if(!this[_0xc9ef('0x81')](_0x112996['appid'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x13d'));}if(!this[_0xc9ef('0x81')](_0x112996[_0xc9ef('0x8f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20appsecret\x20configured');}var _0x5102d9='wav';var _0x129cb7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x48f5f7=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x129cb7,_0x5102d9);var _0x220ecc=!![];if(_0x112996[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x220ecc=![];}var _0x547e2a=this[_0xc9ef('0xe')]['recordFile'](_0x129cb7,_0x5102d9,_0x112996[_0xc9ef('0x138')],_0x112996['timeout'],undefined,_0x220ecc);if(_0x547e2a[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('tilde\x20%s\x20file\x20created',_0x48f5f7));var _0x433bdf=this['tildeASR'][_0xc9ef('0x6e')](this,_0x112996,_0x48f5f7);if(_0x433bdf){for(var _0x4902d7 in _0x433bdf){if(_0x433bdf[_0xc9ef('0x92')](_0x4902d7)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0x13e'),_0x4902d7[_0xc9ef('0x68')]()),_0x433bdf[_0x4902d7]);}}return this['channel']['noop'](util[_0xc9ef('0x56')]('TildeASR\x20Result\x20%s',JSON[_0xc9ef('0x9d')](_0x433bdf)));}}return _0x547e2a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13f')]=function(_0x5cbe53){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x140'),_0x5cbe53[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x141')](_0x5cbe53['context'],_0x5cbe53[_0xc9ef('0x142')],_0x5cbe53[_0xc9ef('0x3f')]);};AGIVertices[_0xc9ef('0x14')]['gotoif']=function(_0x5c5dad){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x143'),_0x5c5dad[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5c5dad[_0xc9ef('0x144')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x5c5dad,'no\x20condition\x20configured');}try{var _0x2e4760=eval(_0x5c5dad[_0xc9ef('0x144')])?_0xc9ef('0x145'):_0xc9ef('0x146');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x147'),_0x5c5dad[_0xc9ef('0x144')],_0x2e4760));return{'code':0xc8,'result':_0x2e4760};}catch(_0x1c99c1){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x148')]=function(_0x1f7304){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x149'),_0x1f7304[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1f7304[_0xc9ef('0x14a')])){return this[_0xc9ef('0xe')]['error'](_0x1f7304,'no\x20interval\x20configured');}var _0x196386=this['getIntervals']['sync'](this,_0x1f7304[_0xc9ef('0x14a')]);if(!_0x196386){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1f7304,_0xc9ef('0x14b'));}for(var _0x543c28=0x0;_0x543c28<_0x196386['length'];_0x543c28+=0x1){var _0x279bd9=this[_0xc9ef('0xe')][_0xc9ef('0x10')](util['format']('IFTIME(%s?true:false)',_0x196386[_0x543c28]));if(_0x279bd9['result']===-0x1){return _0x279bd9;}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0x279bd9[_0xc9ef('0x9f')]));if(_0x279bd9[_0xc9ef('0x9f')]===_0xc9ef('0x145')){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));return{'code':0xc8,'result':'true'};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x146')));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('IFTIME\x20%s\x20%s',_0x196386[_0x543c28],'false'));}}return{'code':0xc8,'result':_0xc9ef('0x146')};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x14d')]=function(_0xf6e8bd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x14e'),_0xf6e8bd[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x14d')]();};AGIVertices[_0xc9ef('0x14')]['ispeechasr']=function(_0x41e07f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14f'),_0x41e07f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x41e07f[_0xc9ef('0x7f')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}var _0x1adb5a=_0xc9ef('0x150');var _0x8b6352=util['format'](_0xc9ef('0x151'),FILES_PATH,rs['generate'](0x4));var _0xa6a933=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x8b6352,_0x1adb5a);var _0x12a58a=!![];if(_0x41e07f[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x12a58a=![];}var _0x32383f=this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x8b6352,_0x1adb5a,_0x41e07f[_0xc9ef('0x138')],_0x41e07f[_0xc9ef('0x64')],undefined,_0x12a58a);if(_0x32383f[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x152'),_0xa6a933));var _0x3a97c8=this[_0xc9ef('0x7e')][_0xc9ef('0x6e')](this,_0x41e07f,_0xa6a933);if(_0x3a97c8){for(var _0x4bc2a6 in _0x3a97c8){if(_0x3a97c8[_0xc9ef('0x92')](_0x4bc2a6)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x153'),_0x4bc2a6[_0xc9ef('0x68')]()),_0x3a97c8[_0x4bc2a6]);}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x154'),JSON[_0xc9ef('0x9d')](_0x3a97c8)));}}return _0x32383f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x155')]=function(_0x148f5c){logger['info'](util['format'](_0xc9ef('0x156'),_0x148f5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x148f5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x148f5c['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x157'),_0x148f5c[_0xc9ef('0x5b')]));var _0x37ef76=this['ispeechTTS'][_0xc9ef('0x6e')](this,_0x148f5c);if(_0x37ef76){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('ispeech\x20%s\x20file\x20created',_0x37ef76));var _0x36f978=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x37ef76,_0x148f5c[_0xc9ef('0x138')]);try{fs[_0xc9ef('0x107')](_0x37ef76+'.wav');}catch(_0x17654c){logger[_0xc9ef('0x2d')](_0x17654c);}return _0x36f978;}return this[_0xc9ef('0xe')]['error'](_0x148f5c,_0xc9ef('0x158'));};AGIVertices['prototype']['login']=function(_0x29814d){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x29814d[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x29814d['findBy'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x29814d,_0xc9ef('0x159'));}logger['info'](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));var _0x47977d=this['agentLogin'][_0xc9ef('0x6e')](this,_0x29814d[_0xc9ef('0x15b')]);if(_0x47977d){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel']['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['logout']=function(_0x5e5d2b){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x160'),_0x5e5d2b[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5e5d2b['findBy'])){return this[_0xc9ef('0xe')]['error'](_0x5e5d2b,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x5e5d2b[_0xc9ef('0x15b')]));var _0x7c08e6=this[_0xc9ef('0x53')][_0xc9ef('0x6e')](this,_0x5e5d2b[_0xc9ef('0x15b')]);if(_0x7c08e6){logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['math']=function(_0x447d4e){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x447d4e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x447d4e['operation'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x447d4e,_0xc9ef('0x161'));}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('math\x20%s',_0x447d4e[_0xc9ef('0x162')]));var _0x2f08ae=eval(_0x447d4e[_0xc9ef('0x162')]);if(!this[_0xc9ef('0x81')](_0x447d4e['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x1c71d0=this['getVariable']['sync'](this,_0x447d4e[_0xc9ef('0xd8')]);if(!_0x1c71d0){return this[_0xc9ef('0xe')]['error'](_0x447d4e,_0xc9ef('0x11c'));}if(_[_0xc9ef('0x98')](_0x2f08ae)){var _0x48ddc5=this;_0x2f08ae[_0xc9ef('0xda')](function(_0x565bd9,_0x11a6f9){_0x48ddc5[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s[%s]',_0x1c71d0,_0x11a6f9),_0x565bd9);});return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x163'),_0x1c71d0));}else{return this['channel'][_0xc9ef('0x9c')](_0x1c71d0,_0x2f08ae);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb')]=function(_0x41a2c1){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x164'),_0x41a2c1[_0xc9ef('0x39')]));if(_0x41a2c1['retry']===0x0){return this[_0xc9ef('0xa4')](_0x41a2c1);}_0x41a2c1[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x41a2c1['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x114'));}var _0x15c874=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x41a2c1[_0xc9ef('0x115')]);if(!_0x15c874){return this[_0xc9ef('0xe')]['error'](_0x41a2c1,_0xc9ef('0x116'));}var _0x1cbb53=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x15c874,_0x41a2c1['response'],_0x41a2c1[_0xc9ef('0x165')]);var _0x391aa6=_0x1cbb53['result'];if(_0x1cbb53[_0xc9ef('0xa2')]===-0x1){this[_0xc9ef('0x37')]['sync'](this,_0x41a2c1,'-1');return _0x1cbb53;}else if(_0x1cbb53['extra']===_0xc9ef('0x64')){_0x1cbb53['result']=_0x1cbb53[_0xc9ef('0xa2')]['length']>0x0?_0x1cbb53['result']:'t';}else if(_[_0xc9ef('0x47')](_0x1cbb53[_0xc9ef('0xa2')])){_0x1cbb53[_0xc9ef('0xa2')]='#';_0x391aa6='#';}if(!this[_0xc9ef('0x81')](_0x41a2c1[_0xc9ef('0xd8')])){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}else{var _0x3bd069=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x41a2c1['variable_id']);if(!_0x3bd069){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x3bd069,_0x391aa6);}this['createSquareDetailsReport']['sync'](this,_0x41a2c1,_0x391aa6);return _0x1cbb53;};AGIVertices['prototype']['noop']=function(_0x14f9b3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x166'),_0x14f9b3['label']));return this[_0xc9ef('0xe')]['noop'](_0x14f9b3[_0xc9ef('0x167')]||_0x14f9b3[_0xc9ef('0x39')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x168')]=function(_0x495221){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x169'),_0x495221[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x495221['findBy'])){return this['channel'][_0xc9ef('0x2d')](_0x495221,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')]['callerid'],_0x495221[_0xc9ef('0x15b')]));var _0x2d2281=this['getPause'][_0xc9ef('0x6e')](this,_0x495221[_0xc9ef('0x16a')]);var _0x3c4d22=this[_0xc9ef('0x50')][_0xc9ef('0x6e')](this,_0x495221['findBy'],_0x2d2281);if(_0x3c4d22){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x495221['findBy']));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x16b')]=function(_0x3df1fd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x16c'),_0x3df1fd['label']));if(!this['isConfigured'](_0x3df1fd['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3df1fd,_0xc9ef('0x114'));}var _0x3697ef=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x3df1fd[_0xc9ef('0x115')]);if(!_0x3697ef){return this[_0xc9ef('0xe')]['error'](_0x3df1fd,'no\x20file\x20audio\x20found');}var _0x392f10=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x16d'),[_0x3697ef,_0x3df1fd['opts']]);if(_0x392f10[_0xc9ef('0xa2')]===-0x1){return _0x392f10;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0xc9ef('0x16d'),_0x3697ef));};AGIVertices['prototype'][_0xc9ef('0x16e')]=function(_0x15e7de){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x16f'),_0x15e7de[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x170')])){return this[_0xc9ef('0xe')]['error'](_0x15e7de,'no\x20queue\x20selected');}var _0x11072f='';var _0x51f7dc=parseInt(_0x15e7de[_0xc9ef('0x170')],0xa);if(isNaN(_0x51f7dc)){_0x11072f=_0x15e7de['queue_id'];}else{_0x11072f=this['getVoiceQueue'][_0xc9ef('0x6e')](this,_0x15e7de[_0xc9ef('0x170')]);if(!_0x11072f){return this['channel']['error'](_0x15e7de,_0xc9ef('0x171'));}}var _0x2a7f9b='';if(this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x115')])){var _0xe40fc5=this['getSound'][_0xc9ef('0x6e')](this,_0x15e7de['file_id']);if(_0xe40fc5){_0x2a7f9b=_0xe40fc5;}}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x15e7de,_0x11072f);if(_0x15e7de[_0xc9ef('0xe5')]['indexOf']('x')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='x';}if(_0x15e7de['opts'][_0xc9ef('0x172')]('X')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='X';}this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x173'),_0x11072f?_0x11072f[_0xc9ef('0x174')]():'');var _0x6d9adc=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0x175'),[_0x11072f,_0x15e7de['opts'],_0x15e7de[_0xc9ef('0x62')],_0x2a7f9b,_0x15e7de[_0xc9ef('0x64')],_0x15e7de[_0xc9ef('0x6')],_0x15e7de[_0xc9ef('0x176')],_0x15e7de[_0xc9ef('0x177')],'',_0x15e7de[_0xc9ef('0x178')]]);if(_0x6d9adc['result']===-0x1){return _0x6d9adc;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x11072f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x179')]=function(_0x17d573){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x17a'),_0x17d573[_0xc9ef('0x39')]));var _0x1c7140=_0x17d573['recordingFormat']||_0xc9ef('0x150');var _0x5f3c28=util[_0xc9ef('0x56')](_0xc9ef('0x17b'),this['channel'][_0xc9ef('0x38')],rs[_0xc9ef('0x11e')](0x5));var _0x5c8771=util['format'](_0xc9ef('0x17c'),FILES_PATH,_0x5f3c28,_0x1c7140);var _0x16f7b1=util['format'](_0xc9ef('0x151'),FILES_PATH,_0x5f3c28);this[_0xc9ef('0x3d')][_0xc9ef('0x6e')](this,_0x17d573,_0x5f3c28,_0x5c8771);this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x17d'),_0x5f3c28);logger[_0xc9ef('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')]);return this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')],undefined,!![]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x17f')]=function(_0x3b4ae1){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x180'),_0x3b4ae1[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3b4ae1[_0xc9ef('0x62')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x181'));}var _0x24de27=this[_0xc9ef('0x61')][_0xc9ef('0x6e')](this,_0x3b4ae1);logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x182'),util[_0xc9ef('0x183')](_0x24de27,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b4ae1[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x184'));}var _0x18125a=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x3b4ae1['variable_id']);if(!_0x18125a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3b4ae1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x185'),_0x18125a),_0x24de27['statusCode']?_0x24de27[_0xc9ef('0x186')]:_0xc9ef('0x187'));this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s_STATUS_MESSAGE',_0x18125a),_0x24de27['statusMessage']?_0x24de27[_0xc9ef('0x72')]:'OK');if(_0x24de27['body']){try{this['saveRestApiResult'](_0x24de27[_0xc9ef('0x71')],_0x18125a);}catch(_0x128b5f){logger[_0xc9ef('0x2d')](util[_0xc9ef('0x56')](_0xc9ef('0x188'),_0x18125a));}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('variable\x20%s\x20set',_0x18125a));};AGIVertices['prototype']['saydigits']=function(_0x2c7900){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2c7900[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')]['sayDigits'](_0x2c7900[_0xc9ef('0x189')][_0xc9ef('0x57')](/\s+/g,''),_0x2c7900[_0xc9ef('0x17e')]);};AGIVertices['prototype'][_0xc9ef('0x18a')]=function(_0x21222b){logger['info'](util['format'](_0xc9ef('0x18b'),_0x21222b[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18c')](_0x21222b[_0xc9ef('0x65')][_0xc9ef('0x57')](/\s+/g,''),_0x21222b[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')]['sayphonetic']=function(_0x308d03){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x18d'),_0x308d03[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18e')](_0x308d03[_0xc9ef('0x5b')],_0x308d03[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18f')]=function(_0x3d5d0c){logger['info'](util[_0xc9ef('0x56')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3d5d0c['label']));if(!this['isConfigured'](_0x3d5d0c[_0xc9ef('0x190')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x191'));}var _0x1fe881=this[_0xc9ef('0x192')][_0xc9ef('0x6e')](this,_0x3d5d0c[_0xc9ef('0x190')]);if(!_0x1fe881||!_0x1fe881[_0xc9ef('0x193')]){return this[_0xc9ef('0xe')]['error'](_0x3d5d0c,_0xc9ef('0x194'));}var _0x5e9a88={'from':util[_0xc9ef('0x56')]('\x22%s\x22\x20<%s>',_0x1fe881[_0xc9ef('0x12')],_0x1fe881['email']||_0x1fe881[_0xc9ef('0x193')][_0xc9ef('0x195')]),'to':_0x3d5d0c['to']||'','cc':_0x3d5d0c['cc']||'','bcc':_0x3d5d0c[_0xc9ef('0x196')]||'','subject':_0x3d5d0c['subject'],'html':_0x3d5d0c[_0xc9ef('0x5b')],'text':_0x3d5d0c['text']};if(this['isConfigured'](_0x3d5d0c[_0xc9ef('0x197')])){}logger[_0xc9ef('0xe0')](_0xc9ef('0x198'),JSON[_0xc9ef('0x9d')](_0x5e9a88));this[_0xc9ef('0x37')]['sync'](this,_0x3d5d0c,_0x3d5d0c[_0xc9ef('0x190')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x199'),_0x1fe881[_0xc9ef('0x12')]));this[_0xc9ef('0x23')][_0xc9ef('0x6e')](this,_0x1fe881[_0xc9ef('0x19a')],_0x5e9a88);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19b'));};AGIVertices['prototype'][_0xc9ef('0x19c')]=function(_0x1226b9){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x19d'),_0x1226b9[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19e'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x19f')]=function(_0x9a621f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1a0'),_0x9a621f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9a621f[_0xc9ef('0x1a1')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1a2'));}var _0x34e0d1=this['getSmsAccount'][_0xc9ef('0x6e')](this,_0x9a621f[_0xc9ef('0x1a1')]);if(!_0x34e0d1){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x9a621f,_0xc9ef('0x1a3'));}var _0x1216ea={'body':_0x9a621f[_0xc9ef('0x1a4')],'phone':_0x9a621f['to']||'','SmsAccountId':_0x34e0d1['id']};logger['debug']('sendSMS\x20message',JSON[_0xc9ef('0x9d')](_0x1216ea));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x9a621f,_0x9a621f[_0xc9ef('0x1a1')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1a5'),_0x34e0d1[_0xc9ef('0x12')]));this[_0xc9ef('0x36')]['sync'](this,_0x1216ea);return this['channel']['noop'](_0xc9ef('0x1a6'));};AGIVertices['prototype'][_0xc9ef('0x1a7')]=function(_0x1abe8b){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1abe8b['label']));if(!this[_0xc9ef('0x81')](_0x1abe8b['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x1a8'));}var _0x25cabc=this['getVariable'][_0xc9ef('0x6e')](this,_0x1abe8b[_0xc9ef('0xd8')]);if(!_0x25cabc){return this['channel'][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x11c'));}return this['channel'][_0xc9ef('0x9c')](_0x25cabc,_0x1abe8b[_0xc9ef('0x1a9')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1aa')]=function(_0x1f6149){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x1ab'),_0x1f6149[_0xc9ef('0x39')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1ac'));if(_0x1f6149[_0xc9ef('0xb7')]===_0xc9ef('0x1ad')){this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1ae'));return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();}return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1af'));};AGIVertices[_0xc9ef('0x14')]['subproject']=function(_0x4f4070){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b0'),_0x4f4070[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4f4070[_0xc9ef('0x1b1')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,'no\x20subproject\x20selected');}var _0x48ce45=this[_0xc9ef('0x18')][_0xc9ef('0x6e')](this,_0x4f4070['project_id']);if(!this['isConfigured'](_0x48ce45)){return this[_0xc9ef('0xe')]['error'](_0x4f4070,util[_0xc9ef('0x56')](_0xc9ef('0x1b2'),_0x4f4070[_0xc9ef('0x1b1')]));}if(_0x48ce45===this[_0xc9ef('0xe')]['arg_1']){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,_0xc9ef('0x1b3'));}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4f4070,_0x48ce45);var _0x3dd088=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1b4'),util[_0xc9ef('0x56')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xc9ef('0x6')]['host']||_0xc9ef('0x1b5'),_0x48ce45,this[_0xc9ef('0xe')]['arg_1']));if(_0x3dd088[_0xc9ef('0xa2')]===-0x1){return _0x3dd088;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s',_0xc9ef('0x1b4'),_0x48ce45));};AGIVertices[_0xc9ef('0x14')]['system']=function(_0xe8fc97){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b6'),_0xe8fc97['label']));var _0x218904=this[_0xc9ef('0x1b7')][_0xc9ef('0x6e')](this,_0xe8fc97[_0xc9ef('0xb4')]);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0xe8fc97,_0xe8fc97[_0xc9ef('0xb4')]);if(this[_0xc9ef('0x81')](_0xe8fc97[_0xc9ef('0xd8')])){var _0x3c170c=this[_0xc9ef('0x10')]['sync'](this,_0xe8fc97[_0xc9ef('0xd8')]);if(_0x3c170c){this[_0xc9ef('0xe')]['setVariable'](_0x3c170c,_0x218904);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x1b8'),_0xe8fc97[_0xc9ef('0xb4')],_0x3c170c));}}return this['channel']['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1b9'),_0xe8fc97[_0xc9ef('0xb4')]));};AGIVertices[_0xc9ef('0x14')]['google_cloud_tts']=function(_0xca4789){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x1ba'),_0xca4789[_0xc9ef('0x39')]));_0xca4789[_0xc9ef('0x5b')]=_0xca4789[_0xc9ef('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0xca4789['apiKey'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1bb'));}if(!this['isConfigured'](_0xca4789['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1bc'),_0xca4789[_0xc9ef('0x5b')]));var _0x227998=this[_0xc9ef('0x58')][_0xc9ef('0x6e')](this,_0xca4789);if(_0x227998){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1bd'),_0x227998));var _0xaf53a2=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x227998);try{fs[_0xc9ef('0x107')](_0x227998+_0xc9ef('0x108'));}catch(_0x39167d){logger[_0xc9ef('0x2d')](_0x39167d);}return _0xaf53a2;}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0xca4789,_0xc9ef('0x1be'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1bf')]=function(_0x524a04){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x524a04[_0xc9ef('0x39')]));_0x524a04['text']=_0x524a04['text'][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0x524a04[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xa8')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x524a04['text']));var _0x1861b1=this[_0xc9ef('0x60')][_0xc9ef('0x6e')](this,_0x524a04);if(_0x1861b1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Google\x20TTS\x20%s\x20file\x20created',_0x1861b1));var _0x1f93e9=this['channel'][_0xc9ef('0x105')](_0x1861b1);try{fs[_0xc9ef('0x107')](_0x1861b1+_0xc9ef('0x108'));}catch(_0x4a72a6){logger[_0xc9ef('0x2d')](_0x4a72a6);}return _0x1f93e9;}return this['channel'][_0xc9ef('0x2d')](_0x524a04,_0xc9ef('0x1c0'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c1')]=function(_0x490e87){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1c2'),_0x490e87[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x490e87[_0xc9ef('0x15b')])){return this[_0xc9ef('0xe')]['error'](_0x490e87,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));var _0x2e2e8c=this[_0xc9ef('0x52')]['sync'](this,_0x490e87[_0xc9ef('0x15b')]);if(_0x2e2e8c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel'][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c3')]=function(_0x4534d8){logger['info'](util['format'](_0xc9ef('0x1c4'),_0x4534d8[_0xc9ef('0x39')]));var _0x1251fc=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1c5'),[_0x4534d8[_0xc9ef('0x1c6')],_0x4534d8['options']]);if(_0x1251fc[_0xc9ef('0xa2')]===-0x1){return _0x1251fc;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),'VOICEMAIL',_0x4534d8[_0xc9ef('0x1c6')]));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c7')]=function(_0x54b78f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x54b78f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x54b78f[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,'no\x20variable\x20selected');}var _0x1145fa=this[_0xc9ef('0x10')]['sync'](this,_0x54b78f['variable_id']);if(!_0x1145fa){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,_0xc9ef('0x11c'));}var _0x58b245=this['channel']['getVariable'](_0x1145fa);return{'code':0xc8,'result':_0x58b245[_0xc9ef('0x9f')]?_0x58b245['extra']:'-'};};String[_0xc9ef('0x14')]['replaceAll']=function(_0x5c1410,_0x2e42bd){return this[_0xc9ef('0x9e')](_0x5c1410)[_0xc9ef('0x1c8')](_0x2e42bd);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 15a7ce3..64082e8 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 _0xf6d6=['linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','uniqueid','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','startAcw'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xf6d6,0xb7));var _0x6f6d=function(_0x235099,_0x505d82){_0x235099=_0x235099-0x0;var _0x45d4cc=_0xf6d6[_0x235099];return _0x45d4cc;};'use strict';var util=require(_0x6f6d('0x0'));var _=require(_0x6f6d('0x1'));var moment=require(_0x6f6d('0x2'));var ami=require(_0x6f6d('0x3'));var logger=require(_0x6f6d('0x4'))(_0x6f6d('0x5'));var RpcUser=require(_0x6f6d('0x6'));var RpcVoiceAgentReport=require(_0x6f6d('0x7'));function Acw(_0x52ad06){this[_0x6f6d('0x8')]=_0x52ad06[_0x6f6d('0x8')];this['agents']=_0x52ad06[_0x6f6d('0x9')];this[_0x6f6d('0xa')]=_0x52ad06['timers'];this[_0x6f6d('0xb')]={};ami['on'](_0x6f6d('0xc'),this[_0x6f6d('0xd')][_0x6f6d('0xe')](this));ami['on']('hanguprequest',this[_0x6f6d('0xf')][_0x6f6d('0xe')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x6f6d('0x10'),this[_0x6f6d('0x11')]['bind'](this));ami['on'](_0x6f6d('0x12'),this[_0x6f6d('0x13')][_0x6f6d('0xe')](this));ami['on'](_0x6f6d('0x14'),this[_0x6f6d('0x15')][_0x6f6d('0xe')](this));ami['on'](_0x6f6d('0x16'),this[_0x6f6d('0x17')][_0x6f6d('0xe')](this));}function getDiff(_0x2415dd){var _0x1f2a8f=moment()[_0x6f6d('0x18')](0x0);var _0x9e3b8a=moment(_0x2415dd)[_0x6f6d('0x18')](0x0);return _0x1f2a8f[_0x6f6d('0x19')](_0x9e3b8a,_0x6f6d('0x1a'));}Acw[_0x6f6d('0x1b')]['startAcw']=function(_0x4c8221){try{var _0x272de9=this;var _0x47e7ff=this[_0x6f6d('0xb')][_0x4c8221][_0x6f6d('0x1c')];var _0x11e20b=this[_0x6f6d('0xb')][_0x4c8221][_0x6f6d('0x1d')];var _0x2b500e=this[_0x6f6d('0x8')][_0x11e20b];var _0x151431=![];var _0x62866e=_0x6f6d('0x1e');if(_0x2b500e[_0x6f6d('0x1f')]){if(_0x2b500e['mandatoryDispositionPause'][_0x6f6d('0x20')]){_0x151431=!![];_0x62866e=_0x2b500e[_0x6f6d('0x21')][_0x6f6d('0x20')];}}ami[_0x6f6d('0x22')]({'action':_0x6f6d('0x23'),'interface':_0x47e7ff,'paused':!![],'reason':_0x62866e})[_0x6f6d('0x24')](function(_0x1fadbb){if(_0x272de9['agents'][_0x47e7ff]){return RpcUser[_0x6f6d('0x25')](_0x272de9['agents'][_0x47e7ff]['id'])['then'](function(_0x4b2c78){if(_0x4b2c78&&!_0x4b2c78[_0x6f6d('0x26')]){logger[_0x6f6d('0x27')](_0x6f6d('0x28'),_0x4c8221,_0x47e7ff,_0x11e20b);var _0x47bac2=_0x272de9[_0x6f6d('0xb')][_0x4c8221][_0x6f6d('0x29')]&&_0x272de9[_0x6f6d('0xb')][_0x4c8221][_0x6f6d('0x2a')]?_0x272de9[_0x6f6d('0xb')][_0x4c8221]['destlinkedid']:_0x4c8221;return RpcUser[_0x6f6d('0x2b')](_0x272de9['agents'][_0x47e7ff],_0x62866e,_0x47bac2)[_0x6f6d('0x24')](function(_0x39ac19){if(!_0x151431){_0x272de9[_0x6f6d('0xa')][_0x47e7ff]={};logger[_0x6f6d('0x27')](_0x6f6d('0x2c'),_0x4c8221,_0x272de9[_0x6f6d('0x8')][_0x11e20b][_0x6f6d('0x2d')],_0x47e7ff,_0x11e20b);_0x272de9[_0x6f6d('0xa')][_0x47e7ff]['timer']=setTimeout(_0x272de9[_0x6f6d('0x2e')][_0x6f6d('0xe')](_0x272de9,_0x47e7ff),_0x272de9['voiceQueues'][_0x11e20b][_0x6f6d('0x2d')]*0x3e8);_0x272de9['timers'][_0x47e7ff][_0x6f6d('0x2f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x272de9[_0x6f6d('0xa')][_0x47e7ff][_0x6f6d('0x30')]=_0x4c8221;_0x272de9[_0x6f6d('0xa')][_0x47e7ff]['queue']=_0x11e20b;_0x272de9['timers'][_0x47e7ff]['updateAcw']=function(){var _0x4ea865=getDiff(_0x272de9[_0x6f6d('0xa')][_0x47e7ff][_0x6f6d('0x2f')]);clearTimeout(_0x272de9[_0x6f6d('0xa')][_0x47e7ff][_0x6f6d('0x31')]);_0x272de9[_0x6f6d('0xa')][_0x47e7ff][_0x6f6d('0x31')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x4ea865},_0x272de9['timers'][_0x47e7ff][_0x6f6d('0x30')],_0x47e7ff)[_0x6f6d('0x24')](function(_0x23fcdf){logger[_0x6f6d('0x27')](_0x6f6d('0x32'),_0x4c8221,_0x4ea865,_0x23fcdf);})[_0x6f6d('0x33')](function(_0x3f8dcb){logger[_0x6f6d('0x34')](_0x6f6d('0x35'),_0x4c8221,_0x3f8dcb);});delete _0x272de9[_0x6f6d('0xa')][_0x47e7ff];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4c8221,_0x47e7ff,_0x11e20b);}});}})[_0x6f6d('0x33')](function(_0x118042){logger[_0x6f6d('0x34')](_0x6f6d('0x2c'),_0x4c8221,_0x272de9[_0x6f6d('0x8')][_0x11e20b][_0x6f6d('0x2d')],_0x47e7ff,_0x11e20b);})[_0x6f6d('0x36')](function(){delete _0x272de9[_0x6f6d('0xb')][_0x4c8221];});}catch(_0x318aa3){logger[_0x6f6d('0x34')]('[ACW][START]\x20%s',_0x318aa3[_0x6f6d('0x37')]);}};Acw[_0x6f6d('0x1b')]['stopAcw']=function(_0x3dba74){try{var _0x17b3f0=this;if(_0x17b3f0[_0x6f6d('0xa')][_0x3dba74]){_0x17b3f0[_0x6f6d('0xa')][_0x3dba74][_0x6f6d('0x31')]=![];var _0x4488ca=_0x17b3f0[_0x6f6d('0xa')][_0x3dba74]['uniqueid'];var _0x438e4c=_0x17b3f0[_0x6f6d('0xa')][_0x3dba74][_0x6f6d('0x1d')];var _0x3e0deb=_0x17b3f0['voiceQueues'][_0x438e4c]['acwTimeout'];logger['info'](_0x6f6d('0x38'),_0x4488ca,_0x3dba74);RpcUser[_0x6f6d('0x39')](this[_0x6f6d('0x9')][_0x3dba74]);RpcVoiceAgentReport['update']({'acwtime':_0x3e0deb,'agentacw':!![]},_0x4488ca,_0x3dba74)[_0x6f6d('0x24')](function(_0xeb7723){logger[_0x6f6d('0x27')](_0x6f6d('0x32'),_0x4488ca,_0x3e0deb,_0xeb7723);})[_0x6f6d('0x33')](function(_0x155a8f){logger[_0x6f6d('0x34')](_0x6f6d('0x35'),_0x4488ca,_0x155a8f);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3dba74);if(_0x17b3f0[_0x6f6d('0xa')]){logger[_0x6f6d('0x27')]('[ACW][TIMERS]',JSON[_0x6f6d('0x3a')](_0x17b3f0['timers']));}}}catch(_0x7a2791){logger[_0x6f6d('0x34')](_0x6f6d('0x3b'),_0x7a2791[_0x6f6d('0x37')]);}};Acw[_0x6f6d('0x1b')][_0x6f6d('0xd')]=function(_0x46d4f4){try{if(this[_0x6f6d('0x8')][_0x46d4f4['queue']]&&(this[_0x6f6d('0x8')][_0x46d4f4[_0x6f6d('0x1d')]]['acw']||this[_0x6f6d('0x8')][_0x46d4f4[_0x6f6d('0x1d')]][_0x6f6d('0x1f')])){if(this['agents'][_0x46d4f4[_0x6f6d('0x1c')]]){this[_0x6f6d('0xb')][_0x46d4f4[_0x6f6d('0x30')]]={'queue':_0x46d4f4[_0x6f6d('0x1d')],'interface':_0x46d4f4[_0x6f6d('0x1c')],'destlinkedid':_0x46d4f4[_0x6f6d('0x2a')]};}}}catch(_0x210612){logger[_0x6f6d('0x34')](_0x6f6d('0x3c'),_0x210612['message']);}};Acw[_0x6f6d('0x1b')]['syncAgentConnectPreview']=function(_0x1c0ad9){try{if(this[_0x6f6d('0x8')][_0x1c0ad9['queue']]&&(this[_0x6f6d('0x8')][_0x1c0ad9[_0x6f6d('0x1d')]]['acw']||this[_0x6f6d('0x8')][_0x1c0ad9['queue']][_0x6f6d('0x1f')])){if(this[_0x6f6d('0x9')][_0x1c0ad9[_0x6f6d('0x1c')]]){this['channels'][_0x1c0ad9[_0x6f6d('0x30')]]={'queue':_0x1c0ad9[_0x6f6d('0x1d')],'interface':_0x1c0ad9[_0x6f6d('0x1c')]};}}}catch(_0x4f8d70){logger[_0x6f6d('0x34')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4f8d70[_0x6f6d('0x37')]);}};Acw[_0x6f6d('0x1b')][_0x6f6d('0xf')]=function(_0x1c240f){try{if(this[_0x6f6d('0xb')][_0x1c240f[_0x6f6d('0x30')]]&&_[_0x6f6d('0x3d')](this[_0x6f6d('0xb')][_0x1c240f[_0x6f6d('0x30')]]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x1c240f[_0x6f6d('0x30')]);this[_0x6f6d('0x3e')](_0x1c240f['uniqueid']);}else if(this[_0x6f6d('0xb')][_0x1c240f['linkedid']]&&_[_0x6f6d('0x3d')](this[_0x6f6d('0xb')][_0x1c240f[_0x6f6d('0x3f')]][_0x6f6d('0x29')])){logger[_0x6f6d('0x27')](_0x6f6d('0x40'),_0x1c240f[_0x6f6d('0x3f')]);this[_0x6f6d('0x3e')](_0x1c240f[_0x6f6d('0x3f')]);}}catch(_0x15aae6){logger['error'](_0x6f6d('0x41'),_0x15aae6['message']);}};Acw['prototype']['syncHangup']=function(_0x36d817){try{if(this['channels'][_0x36d817[_0x6f6d('0x30')]]&&this[_0x6f6d('0xb')][_0x36d817['uniqueid']][_0x6f6d('0x29')]){logger[_0x6f6d('0x27')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x36d817['uniqueid']);this[_0x6f6d('0x3e')](_0x36d817['uniqueid']);}else if(this[_0x6f6d('0xb')][_0x36d817[_0x6f6d('0x3f')]]&&this[_0x6f6d('0xb')][_0x36d817[_0x6f6d('0x3f')]][_0x6f6d('0x29')]){logger[_0x6f6d('0x27')](_0x6f6d('0x42'),_0x36d817['linkedid']);this['startAcw'](_0x36d817[_0x6f6d('0x3f')]);}}catch(_0x28c037){logger['error'](_0x6f6d('0x43'),_0x28c037[_0x6f6d('0x37')]);}};Acw[_0x6f6d('0x1b')][_0x6f6d('0x13')]=function(_0x5ba591){try{if(!_[_0x6f6d('0x44')](this['channels'][_0x5ba591[_0x6f6d('0x45')]])){this['startAcw'](_0x5ba591[_0x6f6d('0x45')]);if(this[_0x6f6d('0xb')][_0x5ba591[_0x6f6d('0x46')]]){this['channels'][_0x5ba591[_0x6f6d('0x46')]][_0x6f6d('0x29')]=!![];this['channels'][_0x5ba591[_0x6f6d('0x47')]]=this[_0x6f6d('0xb')][_0x5ba591['secondtransfereruniqueid']];delete this[_0x6f6d('0xb')][_0x5ba591[_0x6f6d('0x46')]];}}else if(!_[_0x6f6d('0x44')](this[_0x6f6d('0xb')][_0x5ba591[_0x6f6d('0x47')]])){this['startAcw'](_0x5ba591['transfertargetuniqueid']);if(this[_0x6f6d('0xb')][_0x5ba591[_0x6f6d('0x48')]]){this[_0x6f6d('0xb')][_0x5ba591[_0x6f6d('0x48')]][_0x6f6d('0x29')]=!![];this[_0x6f6d('0xb')][_0x5ba591[_0x6f6d('0x45')]]=this[_0x6f6d('0xb')][_0x5ba591['origtransfereruniqueid']];delete this['channels'][_0x5ba591['origtransfereruniqueid']];}}}catch(_0x5e07ea){logger[_0x6f6d('0x34')](_0x6f6d('0x49'),_0x5e07ea['message']);}};Acw[_0x6f6d('0x1b')][_0x6f6d('0x15')]=function(_0x4c0b6b){try{if(this['channels'][_0x4c0b6b[_0x6f6d('0x4a')]]){logger[_0x6f6d('0x27')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x6f6d('0x3a')](_0x4c0b6b[_0x6f6d('0x4a')]));this[_0x6f6d('0x3e')](_0x4c0b6b[_0x6f6d('0x4a')]);}else if(this[_0x6f6d('0xb')][_0x4c0b6b[_0x6f6d('0x4b')]]){logger[_0x6f6d('0x27')](_0x6f6d('0x4c'),JSON['stringify'](_0x4c0b6b[_0x6f6d('0x4b')]));this[_0x6f6d('0x3e')](_0x4c0b6b[_0x6f6d('0x4b')]);}}catch(_0x3507b9){logger[_0x6f6d('0x34')](_0x6f6d('0x4d'),_0x3507b9[_0x6f6d('0x37')]);}};Acw[_0x6f6d('0x1b')]['syncAgentRingNoAnswer']=function(_0x362b81){try{if(this[_0x6f6d('0x8')][_0x362b81[_0x6f6d('0x1d')]]&&this['voiceQueues'][_0x362b81[_0x6f6d('0x1d')]][_0x6f6d('0x4e')]==='all'){if(this['agents'][_0x362b81['interface']]){logger[_0x6f6d('0x27')](_0x6f6d('0x4f'),_0x362b81[_0x6f6d('0x30')],_0x362b81['interface'],_0x362b81[_0x6f6d('0x1d')]);return RpcUser[_0x6f6d('0x2b')](this[_0x6f6d('0x9')][_0x362b81[_0x6f6d('0x1c')]],_0x6f6d('0x50'),_0x362b81[_0x6f6d('0x30')]);}}}catch(_0x3516d8){logger[_0x6f6d('0x34')](_0x6f6d('0x51'),_0x3516d8[_0x6f6d('0x37')]);}};module['exports']=Acw; \ No newline at end of file +var _0x850f=['diff','prototype','startAcw','interface','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds'];(function(_0x4fd8ee,_0x2ae576){var _0x4468fd=function(_0x3433d5){while(--_0x3433d5){_0x4fd8ee['push'](_0x4fd8ee['shift']());}};_0x4468fd(++_0x2ae576);}(_0x850f,0xe3));var _0xf850=function(_0xe13baf,_0x5c2dc9){_0xe13baf=_0xe13baf-0x0;var _0x2ce9a2=_0x850f[_0xe13baf];return _0x2ce9a2;};'use strict';var util=require(_0xf850('0x0'));var _=require(_0xf850('0x1'));var moment=require(_0xf850('0x2'));var ami=require(_0xf850('0x3'));var logger=require(_0xf850('0x4'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xf850('0x5'));function Acw(_0x11bbe2){this[_0xf850('0x6')]=_0x11bbe2[_0xf850('0x6')];this[_0xf850('0x7')]=_0x11bbe2[_0xf850('0x7')];this[_0xf850('0x8')]=_0x11bbe2[_0xf850('0x8')];this[_0xf850('0x9')]={};ami['on'](_0xf850('0xa'),this[_0xf850('0xb')][_0xf850('0xc')](this));ami['on']('hanguprequest',this[_0xf850('0xd')][_0xf850('0xc')](this));ami['on']('hangup',this[_0xf850('0xe')][_0xf850('0xc')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xf850('0xc')](this));ami['on'](_0xf850('0xf'),this[_0xf850('0x10')][_0xf850('0xc')](this));ami['on'](_0xf850('0x11'),this[_0xf850('0x12')][_0xf850('0xc')](this));ami['on'](_0xf850('0x13'),this[_0xf850('0x14')][_0xf850('0xc')](this));}function getDiff(_0x469634){var _0x3e6ab6=moment()[_0xf850('0x15')](0x0);var _0x470657=moment(_0x469634)['milliseconds'](0x0);return _0x3e6ab6[_0xf850('0x16')](_0x470657,'seconds');}Acw[_0xf850('0x17')][_0xf850('0x18')]=function(_0x5110fe){try{var _0x362090=this;var _0x177127=this[_0xf850('0x9')][_0x5110fe][_0xf850('0x19')];var _0xfe0beb=this[_0xf850('0x9')][_0x5110fe]['queue'];var _0x1d3cea=this[_0xf850('0x6')][_0xfe0beb];var _0x1ed083=![];var _0xc6143b='ACW';if(_0x1d3cea[_0xf850('0x1a')]){if(_0x1d3cea[_0xf850('0x1b')][_0xf850('0x1c')]){_0x1ed083=!![];_0xc6143b=_0x1d3cea[_0xf850('0x1b')]['name'];}}ami[_0xf850('0x1d')]({'action':'QueuePause','interface':_0x177127,'paused':!![],'reason':_0xc6143b})[_0xf850('0x1e')](function(_0x513a65){if(_0x362090['agents'][_0x177127]){return RpcUser[_0xf850('0x1f')](_0x362090[_0xf850('0x7')][_0x177127]['id'])[_0xf850('0x1e')](function(_0x5520fa){if(_0x5520fa&&!_0x5520fa['voicePause']){logger[_0xf850('0x20')](_0xf850('0x21'),_0x5110fe,_0x177127,_0xfe0beb);var _0xf0ba5d=_0x362090[_0xf850('0x9')][_0x5110fe][_0xf850('0x22')]&&_0x362090[_0xf850('0x9')][_0x5110fe][_0xf850('0x23')]?_0x362090[_0xf850('0x9')][_0x5110fe][_0xf850('0x23')]:_0x5110fe;return RpcUser[_0xf850('0x24')](_0x362090['agents'][_0x177127],_0xc6143b,_0xf0ba5d)['then'](function(_0x39c62a){if(!_0x1ed083){_0x362090[_0xf850('0x8')][_0x177127]={};logger[_0xf850('0x20')](_0xf850('0x25'),_0x5110fe,_0x362090[_0xf850('0x6')][_0xfe0beb][_0xf850('0x26')],_0x177127,_0xfe0beb);_0x362090[_0xf850('0x8')][_0x177127]['timer']=setTimeout(_0x362090[_0xf850('0x27')][_0xf850('0xc')](_0x362090,_0x177127),_0x362090['voiceQueues'][_0xfe0beb][_0xf850('0x26')]*0x3e8);_0x362090['timers'][_0x177127][_0xf850('0x28')]=moment()[_0xf850('0x29')](_0xf850('0x2a'));_0x362090[_0xf850('0x8')][_0x177127][_0xf850('0x2b')]=_0x5110fe;_0x362090['timers'][_0x177127][_0xf850('0x2c')]=_0xfe0beb;_0x362090[_0xf850('0x8')][_0x177127][_0xf850('0x2d')]=function(){var _0x5c21b4=getDiff(_0x362090['timers'][_0x177127][_0xf850('0x28')]);clearTimeout(_0x362090[_0xf850('0x8')][_0x177127][_0xf850('0x2e')]);_0x362090[_0xf850('0x8')][_0x177127][_0xf850('0x2e')]=![];RpcVoiceAgentReport[_0xf850('0x2f')]({'acwtime':_0x5c21b4},_0x362090[_0xf850('0x8')][_0x177127]['uniqueid'],_0x177127)[_0xf850('0x1e')](function(_0x33d7c8){logger['info'](_0xf850('0x30'),_0x5110fe,_0x5c21b4,_0x33d7c8);})[_0xf850('0x31')](function(_0x120e4c){logger[_0xf850('0x32')](_0xf850('0x33'),_0x5110fe,_0x120e4c);});delete _0x362090['timers'][_0x177127];};}});}else{logger[_0xf850('0x20')](_0xf850('0x34'),_0x5110fe,_0x177127,_0xfe0beb);}});}})[_0xf850('0x31')](function(_0x8fb854){logger[_0xf850('0x32')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5110fe,_0x362090[_0xf850('0x6')][_0xfe0beb][_0xf850('0x26')],_0x177127,_0xfe0beb);})[_0xf850('0x35')](function(){delete _0x362090[_0xf850('0x9')][_0x5110fe];});}catch(_0x2cf4ea){logger[_0xf850('0x32')]('[ACW][START]\x20%s',_0x2cf4ea[_0xf850('0x36')]);}};Acw['prototype'][_0xf850('0x27')]=function(_0x5f3e45){try{var _0xe37344=this;if(_0xe37344[_0xf850('0x8')][_0x5f3e45]){_0xe37344[_0xf850('0x8')][_0x5f3e45][_0xf850('0x2e')]=![];var _0x1b1626=_0xe37344['timers'][_0x5f3e45][_0xf850('0x2b')];var _0x278607=_0xe37344['timers'][_0x5f3e45][_0xf850('0x2c')];var _0x5068dc=_0xe37344[_0xf850('0x6')][_0x278607]['acwTimeout'];logger[_0xf850('0x20')]('[%s][TIMER][STOP][AGENT:%s]',_0x1b1626,_0x5f3e45);RpcUser['saveUnpause'](this['agents'][_0x5f3e45]);RpcVoiceAgentReport[_0xf850('0x2f')]({'acwtime':_0x5068dc,'agentacw':!![]},_0x1b1626,_0x5f3e45)[_0xf850('0x1e')](function(_0x122b82){logger[_0xf850('0x20')](_0xf850('0x30'),_0x1b1626,_0x5068dc,_0x122b82);})['catch'](function(_0x58dcbf){logger[_0xf850('0x32')](_0xf850('0x33'),_0x1b1626,_0x58dcbf);});}else{logger[_0xf850('0x32')](_0xf850('0x37'),_0x5f3e45);if(_0xe37344[_0xf850('0x8')]){logger[_0xf850('0x20')]('[ACW][TIMERS]',JSON[_0xf850('0x38')](_0xe37344[_0xf850('0x8')]));}}}catch(_0x241e4a){logger['error'](_0xf850('0x39'),_0x241e4a[_0xf850('0x36')]);}};Acw[_0xf850('0x17')][_0xf850('0xb')]=function(_0x484316){try{if(this['voiceQueues'][_0x484316['queue']]&&(this[_0xf850('0x6')][_0x484316[_0xf850('0x2c')]][_0xf850('0x3a')]||this['voiceQueues'][_0x484316[_0xf850('0x2c')]]['mandatoryDisposition'])){if(this[_0xf850('0x7')][_0x484316[_0xf850('0x19')]]){this['channels'][_0x484316['uniqueid']]={'queue':_0x484316[_0xf850('0x2c')],'interface':_0x484316[_0xf850('0x19')],'destlinkedid':_0x484316[_0xf850('0x23')]};}}}catch(_0x38f9cf){logger[_0xf850('0x32')](_0xf850('0x3b'),_0x38f9cf[_0xf850('0x36')]);}};Acw[_0xf850('0x17')][_0xf850('0x14')]=function(_0x5a7770){try{if(this[_0xf850('0x6')][_0x5a7770[_0xf850('0x2c')]]&&(this[_0xf850('0x6')][_0x5a7770[_0xf850('0x2c')]][_0xf850('0x3a')]||this[_0xf850('0x6')][_0x5a7770[_0xf850('0x2c')]][_0xf850('0x1a')])){if(this['agents'][_0x5a7770[_0xf850('0x19')]]){this[_0xf850('0x9')][_0x5a7770[_0xf850('0x2b')]]={'queue':_0x5a7770[_0xf850('0x2c')],'interface':_0x5a7770[_0xf850('0x19')]};}}}catch(_0x520f36){logger[_0xf850('0x32')](_0xf850('0x3c'),_0x520f36[_0xf850('0x36')]);}};Acw[_0xf850('0x17')][_0xf850('0xd')]=function(_0x6f87ae){try{if(this[_0xf850('0x9')][_0x6f87ae[_0xf850('0x2b')]]&&_[_0xf850('0x3d')](this[_0xf850('0x9')][_0x6f87ae[_0xf850('0x2b')]]['attended'])){logger[_0xf850('0x20')]('[%s][HANGUP:UNIQUEID]',_0x6f87ae[_0xf850('0x2b')]);this['startAcw'](_0x6f87ae[_0xf850('0x2b')]);}else if(this[_0xf850('0x9')][_0x6f87ae[_0xf850('0x3e')]]&&_[_0xf850('0x3d')](this[_0xf850('0x9')][_0x6f87ae[_0xf850('0x3e')]][_0xf850('0x22')])){logger[_0xf850('0x20')](_0xf850('0x3f'),_0x6f87ae[_0xf850('0x3e')]);this[_0xf850('0x18')](_0x6f87ae[_0xf850('0x3e')]);}}catch(_0x398d68){logger['error'](_0xf850('0x40'),_0x398d68[_0xf850('0x36')]);}};Acw[_0xf850('0x17')][_0xf850('0xe')]=function(_0x4825ba){try{if(this[_0xf850('0x9')][_0x4825ba[_0xf850('0x2b')]]&&this[_0xf850('0x9')][_0x4825ba['uniqueid']][_0xf850('0x22')]){logger['info'](_0xf850('0x41'),_0x4825ba[_0xf850('0x2b')]);this['startAcw'](_0x4825ba[_0xf850('0x2b')]);}else if(this['channels'][_0x4825ba['linkedid']]&&this[_0xf850('0x9')][_0x4825ba['linkedid']][_0xf850('0x22')]){logger[_0xf850('0x20')](_0xf850('0x42'),_0x4825ba[_0xf850('0x3e')]);this[_0xf850('0x18')](_0x4825ba[_0xf850('0x3e')]);}}catch(_0x57a84c){logger['error'](_0xf850('0x43'),_0x57a84c[_0xf850('0x36')]);}};Acw[_0xf850('0x17')]['syncAttendedTransfer']=function(_0x3dad50){try{if(!_[_0xf850('0x44')](this['channels'][_0x3dad50[_0xf850('0x45')]])){this['startAcw'](_0x3dad50[_0xf850('0x45')]);if(this['channels'][_0x3dad50['secondtransfereruniqueid']]){this[_0xf850('0x9')][_0x3dad50['secondtransfereruniqueid']][_0xf850('0x22')]=!![];this['channels'][_0x3dad50[_0xf850('0x46')]]=this['channels'][_0x3dad50[_0xf850('0x47')]];delete this[_0xf850('0x9')][_0x3dad50[_0xf850('0x47')]];}}else if(!_[_0xf850('0x44')](this[_0xf850('0x9')][_0x3dad50[_0xf850('0x46')]])){this[_0xf850('0x18')](_0x3dad50[_0xf850('0x46')]);if(this[_0xf850('0x9')][_0x3dad50[_0xf850('0x48')]]){this['channels'][_0x3dad50['origtransfereruniqueid']]['attended']=!![];this[_0xf850('0x9')][_0x3dad50[_0xf850('0x45')]]=this[_0xf850('0x9')][_0x3dad50[_0xf850('0x48')]];delete this[_0xf850('0x9')][_0x3dad50[_0xf850('0x48')]];}}}catch(_0x590b0e){logger[_0xf850('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x590b0e['message']);}};Acw[_0xf850('0x17')][_0xf850('0x12')]=function(_0x2bf995){try{if(this[_0xf850('0x9')][_0x2bf995[_0xf850('0x49')]]){logger[_0xf850('0x20')](_0xf850('0x4a'),JSON[_0xf850('0x38')](_0x2bf995[_0xf850('0x49')]));this[_0xf850('0x18')](_0x2bf995[_0xf850('0x49')]);}else if(this['channels'][_0x2bf995[_0xf850('0x4b')]]){logger['info'](_0xf850('0x4c'),JSON[_0xf850('0x38')](_0x2bf995[_0xf850('0x4b')]));this['startAcw'](_0x2bf995['transfererlinkedid']);}}catch(_0xaa6f42){logger[_0xf850('0x32')](_0xf850('0x4d'),_0xaa6f42[_0xf850('0x36')]);}};Acw[_0xf850('0x17')][_0xf850('0x4e')]=function(_0x36cf7e){try{if(this['voiceQueues'][_0x36cf7e[_0xf850('0x2c')]]&&this[_0xf850('0x6')][_0x36cf7e['queue']]['autopause']==='all'){if(this[_0xf850('0x7')][_0x36cf7e[_0xf850('0x19')]]){logger[_0xf850('0x20')](_0xf850('0x4f'),_0x36cf7e[_0xf850('0x2b')],_0x36cf7e[_0xf850('0x19')],_0x36cf7e[_0xf850('0x2c')]);return RpcUser[_0xf850('0x24')](this[_0xf850('0x7')][_0x36cf7e[_0xf850('0x19')]],_0xf850('0x50'),_0x36cf7e[_0xf850('0x2b')]);}}}catch(_0x7c1a04){logger[_0xf850('0x32')](_0xf850('0x51'),_0x7c1a04['message']);}};module[_0xf850('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 6165e2e..f5df0bc 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 _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(_0xd2aa15,_0x2602cc){var _0x359dd3=function(_0x24faae){while(--_0x24faae){_0xd2aa15['push'](_0xd2aa15['shift']());}};_0x359dd3(++_0x2602cc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb7e7[_0x424a9a];return _0xa7831c;};'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 +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x54d196,_0x2b2ba0){var _0x1281cf=function(_0x27e033){while(--_0x27e033){_0x54d196['push'](_0x54d196['shift']());}};_0x1281cf(++_0x2b2ba0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x54cd98,_0x3029e6){_0x54cd98=_0x54cd98-0x0;var _0x4abd09=_0x0b0e[_0x54cd98];return _0x4abd09;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 962af05..b95cb37 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x52295f,_0x5e8935){var _0x1e0197=function(_0x2f2a88){while(--_0x2f2a88){_0x52295f['push'](_0x52295f['shift']());}};_0x1e0197(++_0x5e8935);}(_0xaa88,0x137));var _0x8aa8=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xaa88[_0x59eefb];return _0x1a49e8;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xda3f,0xec));var _0xfda3=function(_0xd8ba7d,_0x5ab6b3){_0xd8ba7d=_0xd8ba7d-0x0;var _0xbda721=_0xda3f[_0xd8ba7d];return _0xbda721;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3d679ff..83fd3c1 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 _0xef0b=['prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','queue','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef0b,0xd8));var _0xbef0=function(_0xedba40,_0x21a685){_0xedba40=_0xedba40-0x0;var _0x4a6281=_0xef0b[_0xedba40];return _0x4a6281;};'use strict';var util=require(_0xbef0('0x0'));var _=require('lodash');var moment=require(_0xbef0('0x1'));function checkNameSurname(_0x5b4c5e,_0x38b583,_0x5ac95a){var _0x20d0a9='';if(!_[_0xbef0('0x2')](_0x38b583)&&_0xbef0('0x3')===typeof _0x38b583){_0x20d0a9+=_0x38b583;}if(!_['isNil'](_0x5ac95a)&&'string'===typeof _0x5ac95a){_0x20d0a9+='\x20'+_0x5ac95a;}if(_0x20d0a9!==''){return _0x20d0a9;}return _0x5b4c5e;}function Action(_0x2c29c4,_0xe3a3fc,_0x4eab61){this[_0xbef0('0x4')]=_0x2c29c4;this[_0xbef0('0x5')]=_0x4eab61||undefined;this[_0xbef0('0x6')]=checkNameSurname(_0xe3a3fc[_0xbef0('0x7')]['phone'],_0xe3a3fc[_0xbef0('0x7')][_0xbef0('0x8')],_0xe3a3fc[_0xbef0('0x7')][_0xbef0('0x9')]);this[_0xbef0('0xa')]=_0xe3a3fc[_0xbef0('0xb')];this['queue']=_0x2c29c4[_0xbef0('0x6')];this[_0xbef0('0xc')]=_0xe3a3fc[_0xbef0('0xc')]||![];this['type']=_0x2c29c4[_0xbef0('0xd')];this[_0xbef0('0xe')]=_0x2c29c4[_0xbef0('0xe')]||0x3;this[_0xbef0('0xf')]=_0xe3a3fc[_0xbef0('0xf')];this[_0xbef0('0x10')]=_0xe3a3fc[_0xbef0('0x10')];this['countcongestionretry']=_0xe3a3fc[_0xbef0('0x11')];this['countnoanswerretry']=_0xe3a3fc[_0xbef0('0x12')];this[_0xbef0('0x13')]=_0xe3a3fc[_0xbef0('0x13')];this['countdropretry']=_0xe3a3fc[_0xbef0('0x14')];this[_0xbef0('0x15')]=_0xe3a3fc[_0xbef0('0x15')];this['countmachineretry']=_0xe3a3fc[_0xbef0('0x16')];this[_0xbef0('0x17')]=_0xe3a3fc['countagentrejectretry'];this[_0xbef0('0x18')]=_0xe3a3fc[_0xbef0('0x18')];this[_0xbef0('0x19')]=_0xe3a3fc[_0xbef0('0x19')];this['UserId']=_0xe3a3fc[_0xbef0('0x1a')];this[_0xbef0('0x1b')]=_0xe3a3fc[_0xbef0('0x1b')];this[_0xbef0('0x1c')]=_0xe3a3fc[_0xbef0('0x1c')];this[_0xbef0('0x1d')]=_0xe3a3fc['id'];this['ContactFirstName']=_0xe3a3fc[_0xbef0('0x7')][_0xbef0('0x8')]||'';this['starttime']=moment()['format'](_0xbef0('0x1e'));this[_0xbef0('0x1f')]=_0xe3a3fc[_0xbef0('0x1f')];this[_0xbef0('0x20')]=_0xe3a3fc[_0xbef0('0x20')];this[_0xbef0('0x21')]=_0xe3a3fc[_0xbef0('0x21')];this['recallme']=_0xe3a3fc['recallme'];this[_0xbef0('0x22')]='';this[_0xbef0('0x23')]='';}Action[_0xbef0('0x24')][_0xbef0('0x25')]=function(){return util[_0xbef0('0x26')](_0xbef0('0x27'),this[_0xbef0('0x6')],this[_0xbef0('0x4')][_0xbef0('0x28')]>0x0?this['number']['substring'](this['voiceQueue'][_0xbef0('0x28')]):this[_0xbef0('0xa')]);};Action[_0xbef0('0x24')]['getQueue']=function(){return this[_0xbef0('0x29')];};module['exports']=Action; \ No newline at end of file +var _0xead4=['format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xead4,0x93));var _0x4ead=function(_0x4d7d40,_0xb7b2a8){_0x4d7d40=_0x4d7d40-0x0;var _0xfac4c4=_0xead4[_0x4d7d40];return _0xfac4c4;};'use strict';var util=require(_0x4ead('0x0'));var _=require(_0x4ead('0x1'));var moment=require(_0x4ead('0x2'));function checkNameSurname(_0x3b6dc0,_0x41b8a6,_0x431cc8){var _0x4b02d2='';if(!_['isNil'](_0x41b8a6)&&'string'===typeof _0x41b8a6){_0x4b02d2+=_0x41b8a6;}if(!_[_0x4ead('0x3')](_0x431cc8)&&_0x4ead('0x4')===typeof _0x431cc8){_0x4b02d2+='\x20'+_0x431cc8;}if(_0x4b02d2!==''){return _0x4b02d2;}return _0x3b6dc0;}function Action(_0x42f318,_0x54b559,_0x430fa3){this[_0x4ead('0x5')]=_0x42f318;this[_0x4ead('0x6')]=_0x430fa3||undefined;this[_0x4ead('0x7')]=checkNameSurname(_0x54b559[_0x4ead('0x8')][_0x4ead('0x9')],_0x54b559[_0x4ead('0x8')][_0x4ead('0xa')],_0x54b559[_0x4ead('0x8')][_0x4ead('0xb')]);this[_0x4ead('0xc')]=_0x54b559[_0x4ead('0x9')];this[_0x4ead('0xd')]=_0x42f318[_0x4ead('0x7')];this[_0x4ead('0xe')]=_0x54b559[_0x4ead('0xe')]||![];this[_0x4ead('0xf')]=_0x42f318[_0x4ead('0xf')];this['dialQueueTimeout']=_0x42f318[_0x4ead('0x10')]||0x3;this['scheduledat']=_0x54b559[_0x4ead('0x11')];this[_0x4ead('0x12')]=_0x54b559['countbusyretry'];this[_0x4ead('0x13')]=_0x54b559[_0x4ead('0x13')];this[_0x4ead('0x14')]=_0x54b559[_0x4ead('0x14')];this[_0x4ead('0x15')]=_0x54b559['countnosuchnumberretry'];this[_0x4ead('0x16')]=_0x54b559[_0x4ead('0x16')];this[_0x4ead('0x17')]=_0x54b559[_0x4ead('0x17')];this[_0x4ead('0x18')]=_0x54b559[_0x4ead('0x18')];this[_0x4ead('0x19')]=_0x54b559['countagentrejectretry'];this[_0x4ead('0x1a')]=_0x54b559['ContactId'];this[_0x4ead('0x1b')]=_0x54b559[_0x4ead('0x1b')];this[_0x4ead('0x1c')]=_0x54b559[_0x4ead('0x1c')];this[_0x4ead('0x1d')]=_0x54b559[_0x4ead('0x1d')];this[_0x4ead('0x1e')]=_0x54b559[_0x4ead('0x1e')];this[_0x4ead('0x1f')]=_0x54b559['id'];this['ContactFirstName']=_0x54b559[_0x4ead('0x8')]['firstName']||'';this[_0x4ead('0x20')]=moment()[_0x4ead('0x21')](_0x4ead('0x22'));this['callback']=_0x54b559['callback'];this[_0x4ead('0x23')]=_0x54b559[_0x4ead('0x23')];this[_0x4ead('0x24')]=_0x54b559[_0x4ead('0x24')];this[_0x4ead('0x25')]=_0x54b559[_0x4ead('0x25')];this[_0x4ead('0x26')]='';this[_0x4ead('0x27')]='';}Action[_0x4ead('0x28')][_0x4ead('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x4ead('0x7')],this['voiceQueue'][_0x4ead('0x2a')]>0x0?this['number'][_0x4ead('0x2b')](this[_0x4ead('0x5')][_0x4ead('0x2a')]):this[_0x4ead('0xc')]);};Action[_0x4ead('0x28')]['getQueue']=function(){return this[_0x4ead('0xd')];};module[_0x4ead('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 112e5f5..78801ff 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 _0xbdae=['util','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','responsetime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x2a48af,_0x330f5a){var _0x3ee24d=function(_0x476129){while(--_0x476129){_0x2a48af['push'](_0x2a48af['shift']());}};_0x3ee24d(++_0x330f5a);}(_0xbdae,0x114));var _0xebda=function(_0x3f8ef5,_0x2677cf){_0x3f8ef5=_0x3f8ef5-0x0;var _0x36276e=_0xbdae[_0x3f8ef5];return _0x36276e;};'use strict';var util=require(_0xebda('0x0'));var _=require(_0xebda('0x1'));var moment=require('moment');function getSeconds(_0x55f506,_0x1eb2dc){var _0x2f5e34=moment(_0x55f506)[_0xebda('0x2')](0x0);var _0x29d852=moment(_0x1eb2dc)[_0xebda('0x2')](0x0);return _0x2f5e34[_0xebda('0x3')](_0x29d852,'seconds');}function AgentComplete(_0x93fabd,_0x579ccb){this[_0xebda('0x4')]=0x4;this[_0xebda('0x5')]=_0xebda('0x6');this[_0xebda('0x7')]=_0x93fabd[_0xebda('0x7')];this[_0xebda('0x8')]=_0x93fabd[_0xebda('0x8')];this[_0xebda('0x9')]=_0x93fabd[_0xebda('0x8')]===_0xebda('0xa')?_0xebda('0xb'):_0x93fabd[_0xebda('0x8')];this[_0xebda('0xc')]=_0x93fabd[_0xebda('0xc')];this[_0xebda('0xd')]=_0x93fabd[_0xebda('0xd')];this['countnoanswerretry']=_0x93fabd[_0xebda('0xe')];this[_0xebda('0xf')]=_0x93fabd[_0xebda('0xc')]+_0x93fabd['countcongestionretry']+_0x93fabd[_0xebda('0xe')]+_0x93fabd[_0xebda('0x10')]+_0x93fabd[_0xebda('0x11')]+_0x93fabd[_0xebda('0x12')]+_0x93fabd['countmachineretry']+_0x93fabd['countagentrejectretry'];this['countnosuchnumberretry']=_0x93fabd['countnosuchnumberretry'];this[_0xebda('0x11')]=_0x93fabd[_0xebda('0x11')];this[_0xebda('0x12')]=_0x93fabd['countabandonedretry'];this[_0xebda('0x13')]=_0x93fabd[_0xebda('0x13')];this[_0xebda('0x14')]=_0x93fabd[_0xebda('0x14')];this[_0xebda('0x15')]=_0x579ccb['uniqueid'];this[_0xebda('0x16')]=_0x93fabd[_0xebda('0x17')];this[_0xebda('0x18')]=_0x93fabd[_0xebda('0x19')];this[_0xebda('0x1a')]=_0x93fabd[_0xebda('0x1a')];this['responsetime']=_0x93fabd['responsetime'];this[_0xebda('0x1b')]=_0x93fabd[_0xebda('0x1b')];this[_0xebda('0x1c')]=moment()['format'](_0xebda('0x1d'));this['ringtime']=getSeconds(_0x93fabd[_0xebda('0x1e')],_0x93fabd[_0xebda('0x1a')]);this['holdtime']=getSeconds(_0x93fabd[_0xebda('0x1b')],_0x93fabd[_0xebda('0x1e')]);this[_0xebda('0x1f')]=getSeconds(this['endtime'],_0x93fabd[_0xebda('0x1b')]);this[_0xebda('0xb')]=_0x579ccb[_0xebda('0xb')];this[_0xebda('0x20')]=_0x579ccb[_0xebda('0x20')];this[_0xebda('0x21')]=_0x579ccb[_0xebda('0x21')];this[_0xebda('0x22')]=_0x93fabd[_0xebda('0x22')];this['callbackuniqueid']=_0x93fabd[_0xebda('0x23')];this[_0xebda('0x24')]=_0x93fabd['callbackat'];this[_0xebda('0x25')]=_0x93fabd['recallme'];this[_0xebda('0x26')]=_0x93fabd['ContactId'];this[_0xebda('0x27')]=_0x93fabd[_0xebda('0x27')];this[_0xebda('0x28')]=_0x93fabd[_0xebda('0x28')];this[_0xebda('0x29')]=_0x93fabd['VoiceQueueId'];this['CampaignId']=_0x93fabd[_0xebda('0x2a')];this[_0xebda('0x2b')]=_0x93fabd[_0xebda('0x2b')]||'';this[_0xebda('0x2c')]=_0x93fabd['originatecalleridname']||'';}module[_0xebda('0x2d')]=AgentComplete; \ No newline at end of file +var _0xe203=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype'];(function(_0x21741d,_0x2a0530){var _0x1a41c1=function(_0x581a05){while(--_0x581a05){_0x21741d['push'](_0x21741d['shift']());}};_0x1a41c1(++_0x2a0530);}(_0xe203,0x1a4));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3e20('0x0'));var _=require('lodash');var moment=require(_0x3e20('0x1'));function getSeconds(_0x4b74ab,_0x11b3b9){var _0x1f5f32=moment(_0x4b74ab)[_0x3e20('0x2')](0x0);var _0x537aaf=moment(_0x11b3b9)['milliseconds'](0x0);return _0x1f5f32[_0x3e20('0x3')](_0x537aaf,_0x3e20('0x4'));}function AgentComplete(_0xa7e5af,_0x2f0933){this[_0x3e20('0x5')]=0x4;this[_0x3e20('0x6')]='Answer';this[_0x3e20('0x7')]=_0xa7e5af['scheduledat'];this[_0x3e20('0x8')]=_0xa7e5af[_0x3e20('0x8')];this[_0x3e20('0x9')]=_0xa7e5af[_0x3e20('0x8')]===_0x3e20('0xa')?_0x3e20('0xb'):_0xa7e5af[_0x3e20('0x8')];this[_0x3e20('0xc')]=_0xa7e5af['countbusyretry'];this[_0x3e20('0xd')]=_0xa7e5af['countcongestionretry'];this[_0x3e20('0xe')]=_0xa7e5af['countnoanswerretry'];this[_0x3e20('0xf')]=_0xa7e5af[_0x3e20('0xc')]+_0xa7e5af[_0x3e20('0xd')]+_0xa7e5af[_0x3e20('0xe')]+_0xa7e5af[_0x3e20('0x10')]+_0xa7e5af[_0x3e20('0x11')]+_0xa7e5af[_0x3e20('0x12')]+_0xa7e5af[_0x3e20('0x13')]+_0xa7e5af[_0x3e20('0x14')];this[_0x3e20('0x10')]=_0xa7e5af[_0x3e20('0x10')];this['countdropretry']=_0xa7e5af[_0x3e20('0x11')];this[_0x3e20('0x12')]=_0xa7e5af[_0x3e20('0x12')];this[_0x3e20('0x13')]=_0xa7e5af[_0x3e20('0x13')];this[_0x3e20('0x14')]=_0xa7e5af[_0x3e20('0x14')];this[_0x3e20('0x15')]=_0x2f0933[_0x3e20('0x15')];this['calleridname']=_0xa7e5af[_0x3e20('0x16')];this[_0x3e20('0x17')]=_0xa7e5af['number'];this[_0x3e20('0x18')]=_0xa7e5af[_0x3e20('0x18')];this['responsetime']=_0xa7e5af[_0x3e20('0x19')];this[_0x3e20('0x1a')]=_0xa7e5af[_0x3e20('0x1a')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3e20('0x1b')]=getSeconds(_0xa7e5af['responsetime'],_0xa7e5af[_0x3e20('0x18')]);this[_0x3e20('0x1c')]=getSeconds(_0xa7e5af[_0x3e20('0x1a')],_0xa7e5af[_0x3e20('0x19')]);this[_0x3e20('0x1d')]=getSeconds(this['endtime'],_0xa7e5af['answertime']);this[_0x3e20('0xb')]=_0x2f0933[_0x3e20('0xb')];this['membername']=_0x2f0933[_0x3e20('0x1e')];this['reason']=_0x2f0933[_0x3e20('0x1f')];this[_0x3e20('0x20')]=_0xa7e5af[_0x3e20('0x20')];this[_0x3e20('0x21')]=_0xa7e5af['callbackuniqueid'];this['callbackat']=_0xa7e5af[_0x3e20('0x22')];this[_0x3e20('0x23')]=_0xa7e5af[_0x3e20('0x23')];this[_0x3e20('0x24')]=_0xa7e5af[_0x3e20('0x24')];this[_0x3e20('0x25')]=_0xa7e5af['ListId'];this[_0x3e20('0x26')]=_0xa7e5af[_0x3e20('0x26')];this['VoiceQueueId']=_0xa7e5af[_0x3e20('0x27')];this[_0x3e20('0x28')]=_0xa7e5af[_0x3e20('0x28')];this['originatecalleridnum']=_0xa7e5af['originatecalleridnum']||'';this[_0x3e20('0x29')]=_0xa7e5af[_0x3e20('0x29')]||'';}module[_0x3e20('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e58bf3c..e816d80 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 _0x8d0a=['countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x31b02f,_0x528f53){var _0x2a29ce=function(_0x52ebe6){while(--_0x52ebe6){_0x31b02f['push'](_0x31b02f['shift']());}};_0x2a29ce(++_0x528f53);}(_0x8d0a,0x65));var _0xa8d0=function(_0x5f0df6,_0x5b9df5){_0x5f0df6=_0x5f0df6-0x0;var _0x488a15=_0x8d0a[_0x5f0df6];return _0x488a15;};'use strict';var util=require(_0xa8d0('0x0'));var _=require('lodash');var moment=require(_0xa8d0('0x1'));function getSeconds(_0xeeb10b,_0x1e83ea){var _0x10995c=moment(_0xeeb10b)[_0xa8d0('0x2')](0x0);var _0x477190=moment(_0x1e83ea)[_0xa8d0('0x2')](0x0);return _0x10995c[_0xa8d0('0x3')](_0x477190,_0xa8d0('0x4'));}function Final(_0x50bb7b){this[_0xa8d0('0x5')]=_0x50bb7b[_0xa8d0('0x5')];this[_0xa8d0('0x6')]=_0x50bb7b[_0xa8d0('0x6')];this[_0xa8d0('0x7')]=_0x50bb7b['type'];this['campaigntype']=_0x50bb7b[_0xa8d0('0x7')]===_0xa8d0('0x8')?'queue':_0x50bb7b['type'];this['countbusyretry']=_0x50bb7b[_0xa8d0('0x9')];this['countcongestionretry']=_0x50bb7b[_0xa8d0('0xa')];this[_0xa8d0('0xb')]=_0x50bb7b[_0xa8d0('0xb')];this[_0xa8d0('0xc')]=_0x50bb7b[_0xa8d0('0x9')]+_0x50bb7b[_0xa8d0('0xa')]+_0x50bb7b[_0xa8d0('0xb')]+_0x50bb7b[_0xa8d0('0xd')]+_0x50bb7b[_0xa8d0('0xe')]+_0x50bb7b[_0xa8d0('0xf')]+_0x50bb7b[_0xa8d0('0x10')]+_0x50bb7b['countagentrejectretry'];this[_0xa8d0('0xd')]=_0x50bb7b['countnosuchnumberretry'];this['countdropretry']=_0x50bb7b[_0xa8d0('0xe')];this[_0xa8d0('0xf')]=_0x50bb7b['countabandonedretry'];this[_0xa8d0('0x10')]=_0x50bb7b[_0xa8d0('0x10')];this[_0xa8d0('0x11')]=_0x50bb7b[_0xa8d0('0x11')];this[_0xa8d0('0x12')]=_0x50bb7b[_0xa8d0('0x12')];this['calleridname']=_0x50bb7b[_0xa8d0('0x13')];this[_0xa8d0('0x14')]=_0x50bb7b['calleridnum'];this[_0xa8d0('0x15')]=_0x50bb7b[_0xa8d0('0x15')];this['responsetime']=_0x50bb7b[_0xa8d0('0x16')];this[_0xa8d0('0x17')]=_0x50bb7b['responsetime'];this['ringtime']=_0x50bb7b[_0xa8d0('0x18')]||0x0;this[_0xa8d0('0x19')]=_0x50bb7b['holdtime']||0x0;this[_0xa8d0('0x1a')]=_0x50bb7b[_0xa8d0('0x1a')]||0x0;this[_0xa8d0('0x1b')]=_0x50bb7b['callback'];this[_0xa8d0('0x1c')]=_0x50bb7b['callbackuniqueid'];this[_0xa8d0('0x1d')]=_0x50bb7b[_0xa8d0('0x1d')];this[_0xa8d0('0x1e')]=_0x50bb7b[_0xa8d0('0x1e')];this[_0xa8d0('0x1f')]=_0x50bb7b[_0xa8d0('0x1f')];this[_0xa8d0('0x20')]=_0x50bb7b['ListId'];this['UserId']=_0x50bb7b[_0xa8d0('0x21')];this['VoiceQueueId']=_0x50bb7b[_0xa8d0('0x22')];this[_0xa8d0('0x23')]=_0x50bb7b[_0xa8d0('0x23')];this[_0xa8d0('0x24')]=_0x50bb7b[_0xa8d0('0x24')]||'';this['originatecalleridname']=_0x50bb7b[_0xa8d0('0x25')]||'';}module[_0xa8d0('0x26')]=Final; \ No newline at end of file +var _0x3c6c=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime'];(function(_0x49d9c0,_0x5d5f8a){var _0x142e8c=function(_0x2ca2df){while(--_0x2ca2df){_0x49d9c0['push'](_0x49d9c0['shift']());}};_0x142e8c(++_0x5d5f8a);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x232bb9,_0x27a03b){_0x232bb9=_0x232bb9-0x0;var _0x4751ab=_0x3c6c[_0x232bb9];return _0x4751ab;};'use strict';var util=require(_0xc3c6('0x0'));var _=require('lodash');var moment=require(_0xc3c6('0x1'));function getSeconds(_0x2fc57d,_0x274dda){var _0x3d2b3f=moment(_0x2fc57d)[_0xc3c6('0x2')](0x0);var _0x37f15a=moment(_0x274dda)[_0xc3c6('0x2')](0x0);return _0x3d2b3f[_0xc3c6('0x3')](_0x37f15a,'seconds');}function Final(_0x3c630b){this['uniqueid']=_0x3c630b[_0xc3c6('0x4')];this['scheduledat']=_0x3c630b['scheduledat'];this['type']=_0x3c630b['type'];this['campaigntype']=_0x3c630b[_0xc3c6('0x5')]===_0xc3c6('0x6')?'queue':_0x3c630b[_0xc3c6('0x5')];this[_0xc3c6('0x7')]=_0x3c630b[_0xc3c6('0x7')];this[_0xc3c6('0x8')]=_0x3c630b['countcongestionretry'];this[_0xc3c6('0x9')]=_0x3c630b[_0xc3c6('0x9')];this[_0xc3c6('0xa')]=_0x3c630b['countbusyretry']+_0x3c630b['countcongestionretry']+_0x3c630b[_0xc3c6('0x9')]+_0x3c630b[_0xc3c6('0xb')]+_0x3c630b[_0xc3c6('0xc')]+_0x3c630b[_0xc3c6('0xd')]+_0x3c630b[_0xc3c6('0xe')]+_0x3c630b[_0xc3c6('0xf')];this[_0xc3c6('0xb')]=_0x3c630b[_0xc3c6('0xb')];this[_0xc3c6('0xc')]=_0x3c630b[_0xc3c6('0xc')];this[_0xc3c6('0xd')]=_0x3c630b[_0xc3c6('0xd')];this[_0xc3c6('0xe')]=_0x3c630b[_0xc3c6('0xe')];this[_0xc3c6('0xf')]=_0x3c630b[_0xc3c6('0xf')];this[_0xc3c6('0x10')]=_0x3c630b[_0xc3c6('0x10')];this[_0xc3c6('0x11')]=_0x3c630b[_0xc3c6('0x11')];this[_0xc3c6('0x12')]=_0x3c630b[_0xc3c6('0x12')];this[_0xc3c6('0x13')]=_0x3c630b[_0xc3c6('0x13')];this[_0xc3c6('0x14')]=_0x3c630b[_0xc3c6('0x14')];this['endtime']=_0x3c630b[_0xc3c6('0x14')];this[_0xc3c6('0x15')]=_0x3c630b[_0xc3c6('0x15')]||0x0;this[_0xc3c6('0x16')]=_0x3c630b[_0xc3c6('0x16')]||0x0;this[_0xc3c6('0x17')]=_0x3c630b[_0xc3c6('0x17')]||0x0;this[_0xc3c6('0x18')]=_0x3c630b[_0xc3c6('0x18')];this[_0xc3c6('0x19')]=_0x3c630b[_0xc3c6('0x19')];this[_0xc3c6('0x1a')]=_0x3c630b[_0xc3c6('0x1a')];this[_0xc3c6('0x1b')]=_0x3c630b[_0xc3c6('0x1b')];this[_0xc3c6('0x1c')]=_0x3c630b['ContactId'];this[_0xc3c6('0x1d')]=_0x3c630b[_0xc3c6('0x1d')];this[_0xc3c6('0x1e')]=_0x3c630b['UserId'];this[_0xc3c6('0x1f')]=_0x3c630b[_0xc3c6('0x1f')];this[_0xc3c6('0x20')]=_0x3c630b[_0xc3c6('0x20')];this[_0xc3c6('0x21')]=_0x3c630b[_0xc3c6('0x21')]||'';this[_0xc3c6('0x22')]=_0x3c630b['originatecalleridname']||'';}module[_0xc3c6('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 02486b4..c81da6f 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 _0x067b=['CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','queue','membername','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x067b,0x109));var _0xb067=function(_0x4ed563,_0x5c122b){_0x4ed563=_0x4ed563-0x0;var _0x52efc8=_0x067b[_0x4ed563];return _0x52efc8;};'use strict';var util=require(_0xb067('0x0'));var _=require(_0xb067('0x1'));var moment=require('moment');function getSeconds(_0xa2075c,_0x246b8e){var _0xc705f8=moment(_0xa2075c)['milliseconds'](0x0);var _0xa25b0d=moment(_0x246b8e)[_0xb067('0x2')](0x0);return _0xc705f8[_0xb067('0x3')](_0xa25b0d,_0xb067('0x4'));}function Hangup(_0x13a89e,_0x5b34ee){this[_0xb067('0x5')]=0x4;this[_0xb067('0x6')]=_0xb067('0x7');this[_0xb067('0x8')]=_0x13a89e[_0xb067('0x8')];this[_0xb067('0x9')]=_0x13a89e[_0xb067('0x9')];this[_0xb067('0xa')]=_0x13a89e[_0xb067('0x9')]===_0xb067('0xb')?'queue':_0x13a89e['type'];this[_0xb067('0xc')]=_0x13a89e[_0xb067('0xc')];this['countcongestionretry']=_0x13a89e[_0xb067('0xd')];this[_0xb067('0xe')]=_0x13a89e[_0xb067('0xe')];this[_0xb067('0xf')]=_0x13a89e[_0xb067('0xc')]+_0x13a89e[_0xb067('0xd')]+_0x13a89e[_0xb067('0xe')]+_0x13a89e[_0xb067('0x10')]+_0x13a89e['countdropretry']+_0x13a89e[_0xb067('0x11')]+_0x13a89e['countmachineretry']+_0x13a89e[_0xb067('0x12')];this[_0xb067('0x10')]=_0x13a89e[_0xb067('0x10')];this[_0xb067('0x13')]=_0x13a89e['countdropretry'];this['countabandonedretry']=_0x13a89e['countabandonedretry'];this[_0xb067('0x14')]=_0x13a89e[_0xb067('0x14')];this[_0xb067('0x12')]=_0x13a89e[_0xb067('0x12')];this[_0xb067('0x15')]=_0x5b34ee[_0xb067('0x15')];this['calleridname']=_0x13a89e[_0xb067('0x16')];this[_0xb067('0x17')]=_0x13a89e[_0xb067('0x18')];this[_0xb067('0x19')]=_0x13a89e[_0xb067('0x19')];this[_0xb067('0x1a')]=_0x13a89e[_0xb067('0x1a')];this['endtime']=moment()[_0xb067('0x1b')](_0xb067('0x1c'));this[_0xb067('0x1d')]=getSeconds(_0x13a89e[_0xb067('0x1a')],_0x13a89e[_0xb067('0x19')]);this[_0xb067('0x1e')]=0x0;this[_0xb067('0x1f')]=getSeconds(this[_0xb067('0x20')],_0x13a89e[_0xb067('0x1a')]);this['queue']=_0x13a89e[_0xb067('0x21')];this[_0xb067('0x22')]='IVR';this['reason']=_0x5b34ee[_0xb067('0x23')];this[_0xb067('0x24')]=_0x13a89e['callback'];this['callbackuniqueid']=_0x13a89e['callbackuniqueid'];this['callbackat']=_0x13a89e[_0xb067('0x25')];this[_0xb067('0x26')]=_0x13a89e[_0xb067('0x26')];this[_0xb067('0x27')]=_0x13a89e['ContactId'];this[_0xb067('0x28')]=_0x13a89e[_0xb067('0x28')];this[_0xb067('0x29')]=_0x13a89e[_0xb067('0x29')];this[_0xb067('0x2a')]=_0x13a89e[_0xb067('0x2a')];this['CampaignId']=_0x13a89e[_0xb067('0x2b')];}module['exports']=Hangup; \ No newline at end of file +var _0x5589=['starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','milliseconds','statedesc','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x535190,_0x5b8bfd){var _0x43a931=function(_0x22b9ea){while(--_0x22b9ea){_0x535190['push'](_0x535190['shift']());}};_0x43a931(++_0x5b8bfd);}(_0x5589,0xf1));var _0x9558=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5589[_0x3b380d];return _0x54502b;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x162530,_0xfe0602){var _0x297532=moment(_0x162530)['milliseconds'](0x0);var _0x516e79=moment(_0xfe0602)[_0x9558('0x0')](0x0);return _0x297532['diff'](_0x516e79,'seconds');}function Hangup(_0x3d330a,_0x1f46eb){this['state']=0x4;this[_0x9558('0x1')]=_0x9558('0x2');this['scheduledat']=_0x3d330a['scheduledat'];this[_0x9558('0x3')]=_0x3d330a['type'];this['campaigntype']=_0x3d330a[_0x9558('0x3')]===_0x9558('0x4')?_0x9558('0x5'):_0x3d330a['type'];this[_0x9558('0x6')]=_0x3d330a[_0x9558('0x6')];this[_0x9558('0x7')]=_0x3d330a[_0x9558('0x7')];this['countnoanswerretry']=_0x3d330a['countnoanswerretry'];this['countglobal']=_0x3d330a[_0x9558('0x6')]+_0x3d330a['countcongestionretry']+_0x3d330a['countnoanswerretry']+_0x3d330a['countnosuchnumberretry']+_0x3d330a['countdropretry']+_0x3d330a[_0x9558('0x8')]+_0x3d330a[_0x9558('0x9')]+_0x3d330a['countagentrejectretry'];this[_0x9558('0xa')]=_0x3d330a[_0x9558('0xa')];this[_0x9558('0xb')]=_0x3d330a[_0x9558('0xb')];this['countabandonedretry']=_0x3d330a[_0x9558('0x8')];this[_0x9558('0x9')]=_0x3d330a[_0x9558('0x9')];this[_0x9558('0xc')]=_0x3d330a['countagentrejectretry'];this[_0x9558('0xd')]=_0x1f46eb[_0x9558('0xd')];this[_0x9558('0xe')]=_0x3d330a[_0x9558('0xf')];this[_0x9558('0x10')]=_0x3d330a[_0x9558('0x11')];this[_0x9558('0x12')]=_0x3d330a[_0x9558('0x12')];this[_0x9558('0x13')]=_0x3d330a[_0x9558('0x13')];this[_0x9558('0x14')]=moment()[_0x9558('0x15')](_0x9558('0x16'));this[_0x9558('0x17')]=getSeconds(_0x3d330a['responsetime'],_0x3d330a[_0x9558('0x12')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0x9558('0x14')],_0x3d330a['responsetime']);this[_0x9558('0x5')]=_0x3d330a[_0x9558('0x5')];this[_0x9558('0x18')]=_0x9558('0x19');this[_0x9558('0x1a')]=_0x1f46eb[_0x9558('0x1b')];this[_0x9558('0x1c')]=_0x3d330a[_0x9558('0x1c')];this[_0x9558('0x1d')]=_0x3d330a['callbackuniqueid'];this[_0x9558('0x1e')]=_0x3d330a[_0x9558('0x1e')];this['recallme']=_0x3d330a[_0x9558('0x1f')];this[_0x9558('0x20')]=_0x3d330a[_0x9558('0x20')];this['ListId']=_0x3d330a['ListId'];this['UserId']=_0x3d330a[_0x9558('0x21')];this[_0x9558('0x22')]=_0x3d330a[_0x9558('0x22')];this[_0x9558('0x23')]=_0x3d330a[_0x9558('0x23')];}module[_0x9558('0x24')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index f6e3e8a..1bc5175 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 _0x20a1=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0xecc70e,_0x4f5614){var _0x5203fd=function(_0x35ed0f){while(--_0x35ed0f){_0xecc70e['push'](_0xecc70e['shift']());}};_0x5203fd(++_0x4f5614);}(_0x20a1,0x101));var _0x120a=function(_0x57eaa1,_0x41325b){_0x57eaa1=_0x57eaa1-0x0;var _0x3f1a4d=_0x20a1[_0x57eaa1];return _0x3f1a4d;};'use strict';var util=require(_0x120a('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5e2a8c,_0x4db2eb){var _0x1d5aa9=moment(_0x5e2a8c)[_0x120a('0x1')](0x0);var _0xf5af6f=moment(_0x4db2eb)[_0x120a('0x1')](0x0);return _0x1d5aa9['diff'](_0xf5af6f,_0x120a('0x2'));}function History(_0x465e2f){this[_0x120a('0x3')]=_0x465e2f[_0x120a('0x3')];this[_0x120a('0x4')]=_0x465e2f['scheduledat']||undefined;this['type']=_0x465e2f[_0x120a('0x5')];this[_0x120a('0x6')]=_0x465e2f[_0x120a('0x5')]===_0x120a('0x7')?_0x120a('0x8'):_0x465e2f[_0x120a('0x5')];this['countbusyretry']=_0x465e2f[_0x120a('0x9')];this[_0x120a('0xa')]=_0x465e2f[_0x120a('0xa')];this[_0x120a('0xb')]=_0x465e2f[_0x120a('0xb')];this[_0x120a('0xc')]=_0x465e2f['countbusyretry']+_0x465e2f[_0x120a('0xa')]+_0x465e2f[_0x120a('0xb')]+_0x465e2f[_0x120a('0xd')]+_0x465e2f[_0x120a('0xe')]+_0x465e2f[_0x120a('0xf')]+_0x465e2f['countmachineretry']+_0x465e2f[_0x120a('0x10')];this[_0x120a('0xd')]=_0x465e2f[_0x120a('0xd')];this[_0x120a('0xe')]=_0x465e2f[_0x120a('0xe')];this[_0x120a('0xf')]=_0x465e2f[_0x120a('0xf')];this[_0x120a('0x11')]=_0x465e2f['countmachineretry'];this[_0x120a('0x10')]=_0x465e2f[_0x120a('0x10')];this[_0x120a('0x8')]=_0x465e2f[_0x120a('0x8')];this[_0x120a('0x12')]=_0x465e2f[_0x120a('0x13')];this[_0x120a('0x14')]=_0x465e2f[_0x120a('0x15')];this[_0x120a('0x16')]=_0x465e2f['starttime'];this[_0x120a('0x17')]=_0x465e2f[_0x120a('0x17')];this[_0x120a('0x18')]=_0x465e2f[_0x120a('0x17')];this[_0x120a('0x19')]=getSeconds(_0x465e2f['responsetime'],_0x465e2f['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x465e2f[_0x120a('0x1a')];this[_0x120a('0x1b')]=_0x465e2f[_0x120a('0x1b')];this[_0x120a('0x1c')]=_0x465e2f[_0x120a('0x1c')];this[_0x120a('0x1d')]=_0x465e2f[_0x120a('0x1d')];this[_0x120a('0x1e')]=_0x465e2f[_0x120a('0x1e')];this[_0x120a('0x1f')]=_0x465e2f[_0x120a('0x1f')];this[_0x120a('0x20')]=_0x465e2f[_0x120a('0x20')];this['VoiceQueueId']=_0x465e2f[_0x120a('0x21')];this[_0x120a('0x22')]=_0x465e2f[_0x120a('0x22')];this['originatecalleridnum']=_0x465e2f[_0x120a('0x23')]||'';this[_0x120a('0x24')]=_0x465e2f[_0x120a('0x24')]||'';}module[_0x120a('0x25')]=History; \ No newline at end of file +var _0x25bf=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','number','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds'];(function(_0x1fad17,_0x23eadf){var _0x2f5156=function(_0x2072e4){while(--_0x2072e4){_0x1fad17['push'](_0x1fad17['shift']());}};_0x2f5156(++_0x23eadf);}(_0x25bf,0x12b));var _0xf25b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x25bf[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require(_0xf25b('0x0'));var moment=require(_0xf25b('0x1'));function getSeconds(_0x201595,_0x5a6eda){var _0x9e79d3=moment(_0x201595)['milliseconds'](0x0);var _0x3ea65f=moment(_0x5a6eda)[_0xf25b('0x2')](0x0);return _0x9e79d3[_0xf25b('0x3')](_0x3ea65f,_0xf25b('0x4'));}function History(_0x2618d8){this[_0xf25b('0x5')]=_0x2618d8[_0xf25b('0x5')];this['scheduledat']=_0x2618d8[_0xf25b('0x6')]||undefined;this[_0xf25b('0x7')]=_0x2618d8[_0xf25b('0x7')];this[_0xf25b('0x8')]=_0x2618d8[_0xf25b('0x7')]===_0xf25b('0x9')?_0xf25b('0xa'):_0x2618d8['type'];this[_0xf25b('0xb')]=_0x2618d8[_0xf25b('0xb')];this['countcongestionretry']=_0x2618d8[_0xf25b('0xc')];this[_0xf25b('0xd')]=_0x2618d8[_0xf25b('0xd')];this[_0xf25b('0xe')]=_0x2618d8[_0xf25b('0xb')]+_0x2618d8[_0xf25b('0xc')]+_0x2618d8[_0xf25b('0xd')]+_0x2618d8['countnosuchnumberretry']+_0x2618d8[_0xf25b('0xf')]+_0x2618d8[_0xf25b('0x10')]+_0x2618d8[_0xf25b('0x11')]+_0x2618d8[_0xf25b('0x12')];this[_0xf25b('0x13')]=_0x2618d8[_0xf25b('0x13')];this[_0xf25b('0xf')]=_0x2618d8[_0xf25b('0xf')];this['countabandonedretry']=_0x2618d8['countabandonedretry'];this[_0xf25b('0x11')]=_0x2618d8['countmachineretry'];this[_0xf25b('0x12')]=_0x2618d8[_0xf25b('0x12')];this['queue']=_0x2618d8[_0xf25b('0xa')];this[_0xf25b('0x14')]=_0x2618d8[_0xf25b('0x15')];this['calleridnum']=_0x2618d8[_0xf25b('0x16')];this['starttime']=_0x2618d8['starttime'];this[_0xf25b('0x17')]=_0x2618d8[_0xf25b('0x17')];this[_0xf25b('0x18')]=_0x2618d8[_0xf25b('0x17')];this[_0xf25b('0x19')]=getSeconds(_0x2618d8[_0xf25b('0x17')],_0x2618d8['starttime']);this[_0xf25b('0x1a')]=0x0;this[_0xf25b('0x1b')]=0x0;this['callback']=_0x2618d8[_0xf25b('0x1c')];this[_0xf25b('0x1d')]=_0x2618d8[_0xf25b('0x1d')];this[_0xf25b('0x1e')]=_0x2618d8[_0xf25b('0x1e')];this['recallme']=_0x2618d8[_0xf25b('0x1f')];this['ContactId']=_0x2618d8['ContactId'];this[_0xf25b('0x20')]=_0x2618d8[_0xf25b('0x20')];this['UserId']=_0x2618d8[_0xf25b('0x21')];this['VoiceQueueId']=_0x2618d8[_0xf25b('0x22')];this[_0xf25b('0x23')]=_0x2618d8['CampaignId'];this['originatecalleridnum']=_0x2618d8[_0xf25b('0x24')]||'';this['originatecalleridname']=_0x2618d8[_0xf25b('0x25')]||'';}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 80a3a9a..47b67e9 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 _0x630e=['active','voice:queue:%s','format','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','[uniqueid]','clearZombieChannels','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','then','countReScheduled','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','isNil','variable','amdstatus','xcally-motion-dialer','HANGUP','uniqueid','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','value','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialAMDActive','Machine','dialMachineRetryFrequency','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','countdropretry','callAdditionalPhoneAfterMin','additional','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','voiceQueue','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncNewExten','roundrobin','actionid','locked','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','timezones','content','indexOf','push','true','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','loggedIn','dialTimezone','throttle','filter','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','dialGlobalInterval','[syncCampaigns]','pow','replace','match','object','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','Error','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','[Originate][MoveBlacklist]','inBlackList','handleIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','dialOrderByScheduledAt','[actionOriginate]\x20','checkIsBlackList','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','exports','util','bluebird','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','sumBillable','sumDuration','sumHoldTime','total','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk'];(function(_0x360268,_0x2f350a){var _0x58cc08=function(_0x557e22){while(--_0x557e22){_0x360268['push'](_0x360268['shift']());}};_0x58cc08(++_0x2f350a);}(_0x630e,0x1af));var _0xe630=function(_0x390060,_0x2f8c7f){_0x390060=_0x390060-0x0;var _0x5b89da=_0x630e[_0x390060];return _0x5b89da;};'use strict';var util=require(_0xe630('0x0'));var _=require('lodash');var BPromise=require(_0xe630('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0xe630('0x2'));var Redis=require(_0xe630('0x3'));var ut=require(_0xe630('0x4'));var config=require('../../../config/environment/');var logger=require(_0xe630('0x5'))(_0xe630('0x6'));var loggerBooked=require(_0xe630('0x5'))(_0xe630('0x7'));var loggerPredictive=require(_0xe630('0x5'))('predictive');var loggerPredictiveCalls=require(_0xe630('0x5'))(_0xe630('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xe630('0x9'));var ami=require('../ami');config[_0xe630('0xa')]=_[_0xe630('0xb')](config[_0xe630('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe630('0xa')]));var cmHopper=require(_0xe630('0xc'));var cmHopperHistory=require(_0xe630('0xd'));var cmHopperFinal=require(_0xe630('0xe'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xe630('0xf'));var voiceQueueRt=require(_0xe630('0x10'));var RpcSetting=require(_0xe630('0x11'));var Action=require(_0xe630('0x12'));var History=require(_0xe630('0x13'));var Final=require(_0xe630('0x14'));var AgentComplete=require(_0xe630('0x15'));var QueueCallerAbandon=require(_0xe630('0x16'));var Hangup=require(_0xe630('0x17'));var ipAgi=process[_0xe630('0x18')][_0xe630('0x19')]||_0xe630('0x1a');var strategy={'rrmemory':_0xe630('0x1b'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe630('0x1c')][_0xe630('0x1d')]=function(_0x3e89f7){this[_0xe630('0x1e')]=this[_0xe630('0x1e')]?this[_0xe630('0x1e')][_0xe630('0x1f')](_0x3e89f7):_0x3e89f7();};function Dialer(_0x8a826b,_0x1ab409){this[_0xe630('0x20')]=new Sequence();this[_0xe630('0x21')]=_0x1ab409;this[_0xe630('0x22')]=_0x8a826b[_0xe630('0x22')];this[_0xe630('0x23')]=_0x8a826b[_0xe630('0x23')];this[_0xe630('0x24')]=_0x8a826b[_0xe630('0x24')];this[_0xe630('0x25')]=_0x8a826b[_0xe630('0x25')];this[_0xe630('0x26')]=config[_0xe630('0x26')]||0x2;this[_0xe630('0x27')]={};this[_0xe630('0x28')]={};this[_0xe630('0x29')]={};this[_0xe630('0x2a')]={};this[_0xe630('0x2b')]={};this['startPredictive']={};this[_0xe630('0x2c')]={};this[_0xe630('0x2d')]={};this[_0xe630('0x2e')]={};this['queueBookedRR']={};ami['on'](_0xe630('0x2f'),this[_0xe630('0x30')][_0xe630('0x31')](this));ami['on']('queuecallerabandon',this[_0xe630('0x32')][_0xe630('0x31')](this));ami['on'](_0xe630('0x33'),this[_0xe630('0x34')][_0xe630('0x31')](this));ami['on'](_0xe630('0x35'),this[_0xe630('0x36')]['bind'](this));ami['on'](_0xe630('0x37'),this[_0xe630('0x9')]['bind'](this));ami['on'](_0xe630('0x38'),this[_0xe630('0x39')][_0xe630('0x31')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('newexten',this['syncNewExten'][_0xe630('0x31')](this));ami['on']('varset',this['syncVarSet'][_0xe630('0x31')](this));ami['on'](_0xe630('0x3a'),this[_0xe630('0x3b')][_0xe630('0x31')](this));ami['on'](_0xe630('0x3c'),this[_0xe630('0x3d')][_0xe630('0x31')](this));this['loopCampaigns']();this[_0xe630('0x3e')]();RpcSetting[_0xe630('0x3f')]()['then'](function(_0x56ad71){previewRecallmeReminderInterval=_0x56ad71['previewRecallmeReminderInterval'];});}function isNotNull(_0x338e23){return _0x338e23!==null&&!_['isUndefined'](_0x338e23);}function checkIsLoggedIn(_0x27ab4c,_0x39a5d7){return function(){if(_0x39a5d7<=0x0){_0x27ab4c[_0xe630('0x40')]=_0xe630('0x41');throw _0x27ab4c[_0xe630('0x42')]+_0xe630('0x43');}};}function isActive(_0x539992){return _0x539992;}function checkIsActive(_0x2a0f21,_0x5a2663){return function(){if(!isActive(_0x5a2663)){_0x2a0f21['message']=_0xe630('0x44');throw _0x2a0f21[_0xe630('0x42')]+_0xe630('0x45');}};}function checkInterval(_0x3ee238){return function(){if(!isNotNull(_0x3ee238['Interval'])){_0x3ee238[_0xe630('0x40')]=_0xe630('0x46');throw _0x3ee238[_0xe630('0x42')]+_0xe630('0x47');}if(!isNotNull(_0x3ee238[_0xe630('0x48')][_0xe630('0x49')])){_0x3ee238[_0xe630('0x40')]='INTERVAL_IS_NULL';throw _0x3ee238[_0xe630('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xe630('0x4a')](_0x3ee238[_0xe630('0x48')][_0xe630('0x49')]))){_0x3ee238[_0xe630('0x40')]=_0xe630('0x46');throw _0x3ee238[_0xe630('0x42')]+_0xe630('0x47');}};}function msgResponse(_0x24d694,_0x58da07,_0x31514e){return{'action':_0x24d694,'response':_0x58da07,'message':_0x31514e,'stack':_0x31514e};}function myreject(_0x83cc35){return function(_0x4b76e1){return _0x83cc35(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x4b76e1)));};}function getSeconds(_0x80b2df,_0x44ff8a){var _0x49bd19=moment(_0x80b2df)[_0xe630('0x4b')](0x0);var _0xc43f52=moment(_0x44ff8a)[_0xe630('0x4b')](0x0);return _0x49bd19[_0xe630('0x4c')](_0xc43f52,_0xe630('0x4d'));}function emit(_0x1786c1,_0x3da96a,_0x771f4f){io['to'](_0x1786c1)[_0xe630('0x4e')](_0x3da96a,_0x771f4f);}function emitVoiceQueueSummary(_0x22a081){if(_0x22a081[_0xe630('0x4f')]===_0xe630('0x50')){var _0xdd5093={'id':_0x22a081['id'],'name':_0x22a081[_0xe630('0x42')],'strategy':_0x22a081[_0xe630('0x51')],'answered':_0x22a081[_0xe630('0x52')],'available':_0x22a081['available'],'loggedIn':_0x22a081['loggedIn'],'pTalking':_0x22a081['pTalking'],'sumBillable':_0x22a081[_0xe630('0x53')],'sumDuration':_0x22a081[_0xe630('0x54')],'sumHoldTime':_0x22a081[_0xe630('0x55')]||0x0,'talking':_0x22a081['talking'],'total':_0x22a081[_0xe630('0x56')],'type':_0x22a081[_0xe630('0x4f')],'unmanaged':_0x22a081['unmanaged'],'abandoned':_0x22a081['abandoned'],'waiting':_0x22a081[_0xe630('0x57')],'loggedInDb':_0x22a081['loggedInDb'],'dialActive':_0x22a081[_0xe630('0x58')],'dialMethod':_0x22a081[_0xe630('0x59')],'dialOriginateCallerIdName':_0x22a081[_0xe630('0x5a')],'dialOriginateCallerIdNumber':_0x22a081['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x22a081[_0xe630('0x5b')],'dialPrefix':_0x22a081[_0xe630('0x5c')],'outboundAnswerAgiCallsDay':_0x22a081[_0xe630('0x5d')],'outboundAnswerCallsDay':_0x22a081[_0xe630('0x5e')],'outboundBlacklistCallsDay':_0x22a081['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x22a081[_0xe630('0x5f')],'outboundCongestionCallsDay':_0x22a081[_0xe630('0x60')],'outboundDropCallsDayACS':_0x22a081['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x22a081[_0xe630('0x61')],'outboundDropCallsDayTimeout':_0x22a081[_0xe630('0x62')],'outboundNoAnswerCallsDay':_0x22a081[_0xe630('0x63')],'outboundNoSuchCallsDay':_0x22a081[_0xe630('0x64')],'outboundOriginateFailureCallsDay':_0x22a081['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x22a081[_0xe630('0x65')],'outboundRejectCallsDay':_0x22a081[_0xe630('0x66')],'outboundUnknownCallsDay':_0x22a081[_0xe630('0x67')],'predictiveIntervalAnsweredCalls':_0x22a081['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x22a081[_0xe630('0x68')],'predictiveIntervalAvgTalktime':_0x22a081[_0xe630('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x22a081[_0xe630('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x22a081[_0xe630('0x6b')],'predictiveIntervalErlangCalls':_0x22a081['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x22a081[_0xe630('0x6c')],'predictiveIntervalHitRate':_0x22a081['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x22a081[_0xe630('0x6d')],'predictiveIntervalPauses':_0x22a081['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x22a081[_0xe630('0x6e')],'predictiveIntervalTotalCalls':_0x22a081[_0xe630('0x6f')],'message':_0x22a081[_0xe630('0x40')],'originated':_0x22a081[_0xe630('0x70')],'erlangCalls':_0x22a081[_0xe630('0x71')],'erlangCallToSecond':_0x22a081[_0xe630('0x72')],'erlangAbandonmentRate':_0x22a081['erlangAbandonmentRate'],'erlangBusyFactor':_0x22a081[_0xe630('0x73')],'startPredictive':_0x22a081['startPredictive'],'startProgressive':_0x22a081[_0xe630('0x2c')]};if(_0x22a081[_0xe630('0x74')]){_0xdd5093[_0xe630('0x74')]={'id':_0x22a081[_0xe630('0x74')]['id'],'name':_0x22a081[_0xe630('0x74')][_0xe630('0x42')],'active':_0x22a081[_0xe630('0x74')][_0xe630('0x75')],'callerid':_0x22a081[_0xe630('0x74')]['callerid']};}if(_0x22a081[_0xe630('0x48')]){_0xdd5093['Interval']={'id':_0x22a081[_0xe630('0x48')]['id'],'name':_0x22a081[_0xe630('0x48')][_0xe630('0x42')]};}var _0x165f42=md5(JSON['stringify'](_0xdd5093));if(_0x22a081[_0xe630('0x2')]!==_0x165f42){_0x22a081['md5']=_0x165f42;emit(util['format'](_0xe630('0x76'),_0xdd5093['name']),'voice_queue:save',_0xdd5093);}}}function emitCampaignSummary(_0x12c39b){if(_0x12c39b[_0xe630('0x4f')]==='ivr'){emit(util[_0xe630('0x77')]('campaign:ivr:%s',_0x12c39b['name']),'campaign:save',_0x12c39b);}}function checkGetDataPredictive(_0x4fb7dd){if(isNotNull(_0x4fb7dd)&&!_['isEmpty'](_0x4fb7dd)){loggerPredictive[_0xe630('0x78')](_0xe630('0x79'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4fb7dd['predictiveIntervalTotalCalls']);loggerPredictive[_0xe630('0x78')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4fb7dd[_0xe630('0x7a')]);loggerPredictive[_0xe630('0x78')](_0xe630('0x7b'),_0x4fb7dd[_0xe630('0x6b')]);loggerPredictive['info'](_0xe630('0x7c'),_0x4fb7dd[_0xe630('0x6a')]);loggerPredictive[_0xe630('0x78')](_0xe630('0x7d'),_0x4fb7dd['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xe630('0x7e'),_0x4fb7dd[_0xe630('0x69')]);loggerPredictive['info'](_0xe630('0x7f'));if(_0x4fb7dd[_0xe630('0x6f')]>0x0){if(!_[_0xe630('0x80')](_0x4fb7dd[_0xe630('0x69')])&&_0x4fb7dd['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xe630('0x78')](_0xe630('0x81'));if(!_['isUndefined'](_0x4fb7dd[_0xe630('0x68')])&&_0x4fb7dd[_0xe630('0x68')]>0x0){return!![];}loggerPredictive[_0xe630('0x78')](_0xe630('0x82'));}else{loggerPredictive['info'](_0xe630('0x83'));}}else{loggerPredictive[_0xe630('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x401d8d){return function(_0x1a8e98){loggerPredictive[_0xe630('0x78')](_0xe630('0x84'));loggerPredictive[_0xe630('0x78')](_0xe630('0x85'),_0x1a8e98[_0xe630('0x71')]);loggerPredictive[_0xe630('0x78')](_0xe630('0x86'),_0x1a8e98[_0xe630('0x72')]);loggerPredictive[_0xe630('0x78')](_0xe630('0x87'),_0x1a8e98[_0xe630('0x88')]);loggerPredictive[_0xe630('0x78')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a8e98[_0xe630('0x73')]);loggerPredictive[_0xe630('0x78')](_0xe630('0x87'),_0x1a8e98[_0xe630('0x88')]);loggerPredictive['info'](_0xe630('0x7f'));_[_0xe630('0x89')](_0x401d8d,_0x1a8e98);};}function getDiff(_0x3b5edd){var _0x5a86c5=moment()[_0xe630('0x4b')](0x0);var _0xb1637c=moment(_0x3b5edd)[_0xe630('0x4b')](0x0);return _0x5a86c5['diff'](_0xb1637c,'seconds');}function ifInterval(_0x1c58e0,_0x2796e8){if(_[_0xe630('0x80')](_0x2796e8)){return![];}return getDiff(_0x2796e8)<_0x1c58e0*0x3c;}function freeVariablesPredictive(_0x54af1d){if(isNotNull(_0x54af1d)){if(!_[_0xe630('0x80')](_0x54af1d['startProgressive'])){_0x54af1d[_0xe630('0x2c')]=undefined;loggerPredictive[_0xe630('0x78')](_0x54af1d[_0xe630('0x42')],_0xe630('0x8a'));}if(!_[_0xe630('0x80')](_0x54af1d[_0xe630('0x8b')])){_0x54af1d[_0xe630('0x8b')]=undefined;loggerPredictive[_0xe630('0x78')](_0x54af1d[_0xe630('0x42')],_0xe630('0x8c'));}if(!_[_0xe630('0x80')](_0x54af1d[_0xe630('0x8d')])){clearInterval(_0x54af1d[_0xe630('0x8d')]);_0x54af1d[_0xe630('0x8d')]=undefined;loggerPredictive[_0xe630('0x78')](_0x54af1d[_0xe630('0x42')],_0xe630('0x8e'));}}}function erlangb(_0x502d4e,_0x79e093){if(_0x79e093===0x0){return 0x0;}var _0x18310c=0x1;for(var _0x40443c=0x1;_0x40443c<=_0x79e093;_0x40443c+=0x1){_0x18310c=0x1+_0x18310c*_0x40443c/_0x502d4e;}return 0x1/_0x18310c;}function isVoiceQueueOutbound(_0x4e6fb1){return _0x4e6fb1==='outbound';}function isNotPreview(_0x5de483){return _0x5de483!=='preview';}function isCampaignIvr(_0x23ae77){return _0x23ae77===_0xe630('0x8f');}function getCallerId(_0x53ada1,_0x299385,_0x382b50){if(!_[_0xe630('0x80')](_0x382b50)&&typeof _0x382b50===_0xe630('0x90')&&!_[_0xe630('0x4a')](_0x382b50)){if(!_[_0xe630('0x80')](_0x299385)&&typeof _0x299385===_0xe630('0x90')&&!_['isEmpty'](_0x299385)){return util[_0xe630('0x77')](_0xe630('0x91'),_0x299385,_0x382b50);}return util['format']('\x22%s\x22\x20<%s>',_0x382b50,_0x382b50);}if(!_[_0xe630('0x80')](_0x53ada1)&&typeof _0x53ada1==='string'&&!_[_0xe630('0x4a')](_0x53ada1)){return _0x53ada1;}return _0xe630('0x92');}function loggerCatchQueueSummary(_0x5c1d58,_0x296ecb){return function(_0x102bbb){freeVariablesPredictive(_0x296ecb);emitVoiceQueueSummary(_0x296ecb);emitCampaignSummary(_0x296ecb);loggerSyncQueueSummary[_0xe630('0x93')](_0x5c1d58,util[_0xe630('0x94')](_0x102bbb,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5ef600,_0x1d3bea){return function(_0x5c9d8d){loggerPredictive[_0xe630('0x95')](_0x1d3bea['name'],_0x5ef600);loggerPredictive[_0xe630('0x95')](_0x5c9d8d[_0xe630('0x96')]);freeVariablesPredictive(_0x1d3bea);};}function loggerCatch(_0x2a4457){return function(_0x407e4b){logger[_0xe630('0x95')](_0x2a4457,util[_0xe630('0x94')](_0x407e4b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x335bda){return _0x335bda&&!_[_0xe630('0x80')](_0x335bda)&&_0x335bda['length']>0x0;}function decremetOriginate(_0x2de90b){if(!_[_0xe630('0x80')](_0x2de90b)&&_0x2de90b!==null){if(typeof _0x2de90b[_0xe630('0x70')]!==_0xe630('0x97')){if(_0x2de90b['originated']>0x0){_0x2de90b[_0xe630('0x70')]-=0x1;}else{logger[_0xe630('0x95')](_0xe630('0x98'));}}}else{logger[_0xe630('0x95')](_0xe630('0x99'));}}function checkContactLowerLimitOriginate(_0x187c3a,_0x1377ad,_0x4962fa){if(_0x1377ad>_0x4962fa){for(var _0x18e00d=0x0;_0x18e00d<_0x1377ad-_0x4962fa;_0x18e00d+=0x1){decremetOriginate(_0x187c3a);}}}function loggerGetContactDialer(_0x14cfc4,_0x3c362a,_0x606fff){return function(_0x210652){checkContactLowerLimitOriginate(_0x3c362a,_0x606fff,0x0);logger[_0xe630('0x95')](_0x14cfc4,util[_0xe630('0x94')](_0x210652,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2957ad){return function(_0x4e5724){if(isNotNull(_0x4e5724)&&isNotNull(_0x4e5724[0x0])){if(_0x4e5724[0x0]['contactsRescheduled']>0x0){_0x2957ad['message']=_0xe630('0x9a');logger[_0xe630('0x78')](_0xe630('0x9b')+_0x2957ad['name'],_0x4e5724[0x0][_0xe630('0x9c')],_0xe630('0x9d'));}else{_0x2957ad[_0xe630('0x40')]=_0xe630('0x9e');logger[_0xe630('0x78')]('[getContactDialer2][Empty]'+_0x2957ad['name']);}}};}function notSendMessagesQueue(_0x5eb953){if(_0x5eb953[_0xe630('0x9f')]){freeVariablesPredictive(_0x5eb953);if(_0x5eb953[_0xe630('0x70')]===0x0&&_0x5eb953['talking']===0x0&&_0x5eb953['waiting']===0x0&&(_0x5eb953[_0xe630('0xa0')]||0x0)===0x0){_0x5eb953[_0xe630('0x9f')]=![];_0x5eb953[_0xe630('0xa1')]=0x0;_0x5eb953[_0xe630('0x40')]=_0xe630('0x44');loggerSyncQueueSummary[_0xe630('0x93')](_0xe630('0xa2'),_0x5eb953[_0xe630('0x42')],_0xe630('0xa3'));}else{_0x5eb953['message']=_0xe630('0xa4');loggerSyncQueueSummary[_0xe630('0x93')](_0xe630('0xa2'),_0x5eb953[_0xe630('0x42')],_0xe630('0xa5'));}emitVoiceQueueSummary(_0x5eb953);}}function notSendMessagesCampaign(_0x56eff5){if(_0x56eff5['sendMessageOneNotActive']){if(_0x56eff5[_0xe630('0x70')]===0x0){_0x56eff5[_0xe630('0x9f')]=![];_0x56eff5[_0xe630('0x40')]=_0xe630('0x44');loggerSyncQueueSummary['debug'](_0xe630('0xa6'),_0x56eff5[_0xe630('0x42')],_0xe630('0xa3'));}else{_0x56eff5[_0xe630('0x40')]=_0xe630('0xa4');loggerSyncQueueSummary[_0xe630('0x93')](_0xe630('0xa6'),_0x56eff5['name'],_0xe630('0xa5'));}emitCampaignSummary(_0x56eff5);}}function createObjHistory(_0x542910,_0x2e8edd,_0x303254,_0x4f2ad7,_0x62f002){_0x542910['message']=_0x303254;var _0x6fc3a3=new Action(_0x542910,_0x2e8edd);var _0x479923=new History(_0x6fc3a3);_0x479923[_0xe630('0xa7')]=_0x4f2ad7;_0x479923['statedesc']=_0x62f002;_0x479923['endtime']=_0x6fc3a3['starttime'];return _0x479923;}Dialer[_0xe630('0x1c')]['loopClearZombieChannels']=function(){var _0x30f090=this;setInterval(function(){_0x30f090['clearZombieChannels'](_0x30f090[_0xe630('0x2a')],_0xe630('0xa8'));_0x30f090[_0xe630('0xa9')](_0x30f090[_0xe630('0x28')],'[actions]');},0x32c8);};Dialer[_0xe630('0x1c')][_0xe630('0xa9')]=function(_0x441c0e,_0x3e5893){var _0x13b776=this;for(var _0x24b8bf in _0x441c0e){if(typeof _0x441c0e[_0x24b8bf]!=='undefined'){this[_0xe630('0x20')][_0xe630('0x1d')](function(){if(!_['isNil'](_0x441c0e[_0x24b8bf])){return ami['Action']({'action':_0xe630('0xaa'),'channel':_0x441c0e[_0x24b8bf][_0xe630('0xab')]})[_0xe630('0xac')](function(_0x52c6e1){if(_0x52c6e1[_0xe630('0x40')]===_0xe630('0xad')){setTimeout(function(){if(_0x441c0e[_0x24b8bf]&&_0x441c0e[_0x24b8bf][_0xe630('0x4f')]!==_0xe630('0x8f')){_0x13b776[_0xe630('0xae')](_0x13b776[_0xe630('0x22')][_0x441c0e[_0x24b8bf][_0xe630('0xaf')]]);logger[_0xe630('0x95')](_0xe630('0xb0'),_0x3e5893,_0x24b8bf,_0x441c0e[_0x24b8bf]['queue']);delete _0x441c0e[_0x24b8bf];}if(_0x441c0e[_0x24b8bf]&&_0x441c0e[_0x24b8bf][_0xe630('0x4f')]==='ivr'){_0x13b776[_0xe630('0xae')](_0x13b776[_0xe630('0x23')][_0x441c0e[_0x24b8bf][_0xe630('0xaf')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x3e5893,_0x24b8bf,_0x441c0e[_0x24b8bf]['queue']);delete _0x441c0e[_0x24b8bf];}},0x2328);}});}});}}};Dialer[_0xe630('0x1c')]['countReScheduled']=function(_0x29f714){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopper[_0xe630('0xb3')](_0x29f714))[_0xe630('0xac')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xe630('0x1c')]['checkIsBlackList']=function(_0x2283f9){return BPromise['resolve']()[_0xe630('0xb2')](cmHopperBlack['checkIsBlackList'](_0x2283f9))[_0xe630('0xac')](loggerCatch(_0xe630('0xb4')));};Dialer['prototype'][_0xe630('0xb5')]=function(_0x38f177,_0xfa9200,_0x100aa7){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopperAdditionalPhone[_0xe630('0xb5')](_0x38f177,_0xfa9200,_0x100aa7))['catch'](loggerCatch(_0xe630('0xb6')));};Dialer[_0xe630('0x1c')][_0xe630('0xb7')]=function(_0xfd4a61,_0xa136f2,_0x3efcc4){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0xe630('0xb7')](_0xfd4a61,_0xa136f2,_0x3efcc4))[_0xe630('0xac')](loggerCatch(_0xe630('0xb8')));};Dialer['prototype'][_0xe630('0xb9')]=function(_0x490eaf){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopperBlack[_0xe630('0xb9')](_0x490eaf))[_0xe630('0xac')](loggerCatch(_0xe630('0xba')));};Dialer[_0xe630('0x1c')][_0xe630('0xbb')]=function(_0x11697d){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopperHistory['avgHandleTime'](_0x11697d))['catch'](loggerCatch(_0xe630('0xbc')));};Dialer[_0xe630('0x1c')][_0xe630('0xbd')]=function(_0x1f3bbe){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopper[_0xe630('0xbd')](_0x1f3bbe))[_0xe630('0xac')](loggerCatch(_0xe630('0xbe')));};Dialer['prototype'][_0xe630('0xbf')]=function(_0x3b9c04,_0x368bb2,_0x15c31b){return BPromise['resolve']()[_0xe630('0xb2')](cmHopper['unlockContact'](_0x3b9c04,_0x368bb2,_0x15c31b))['catch'](loggerCatch(_0xe630('0xc0')));};Dialer['prototype'][_0xe630('0xc1')]=function(_0x14b647,_0x431daf,_0x234362,_0x2cd6ff,_0x481122){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopper[_0xe630('0xc1')](_0x14b647,_0x431daf,_0x234362,_0x2cd6ff))[_0xe630('0xac')](function(_0x1f582d){_0x481122[_0xe630('0xc2')]-=_0x234362;_0x481122['temp']=_0x481122[_0xe630('0xc2')]>0x0?_0x481122[_0xe630('0xc2')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x1f582d);});};Dialer[_0xe630('0x1c')][_0xe630('0xc3')]=function(_0xd2847e,_0x1d7989,_0x27b756,_0x26de42){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopper['getContactDialerIvr'](_0xd2847e,_0x1d7989,_0x27b756))['catch'](function(_0x5ad365){_0x26de42[_0xe630('0xc2')]-=_0x1d7989;_0x26de42['temp']=_0x26de42[_0xe630('0xc2')]>0x0?_0x26de42[_0xe630('0xc2')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x5ad365);});};Dialer[_0xe630('0x1c')]['getVoiceQueueRtPauses']=function(_0x2cbccb){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](voiceQueueRt[_0xe630('0xc4')](_0x2cbccb))[_0xe630('0xac')](loggerCatch(_0xe630('0xc5')));};Dialer['prototype'][_0xe630('0xc6')]=function(_0xf96fbf){return BPromise['resolve']()['then'](cmHopper[_0xe630('0xc6')](_0xf96fbf))['catch'](loggerCatch(_0xe630('0xc7')));};Dialer[_0xe630('0x1c')][_0xe630('0xc8')]=function(_0x4790db){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopperHistory[_0xe630('0xc8')](_0x4790db))['catch'](loggerCatch(_0xe630('0xc9')));};Dialer[_0xe630('0x1c')][_0xe630('0xae')]=function(_0x52c9e3){if(!_['isUndefined'](_0x52c9e3)&&_0x52c9e3!==null){if(typeof _0x52c9e3['originated']!==_0xe630('0x97')){if(_0x52c9e3['originated']>0x0){_0x52c9e3[_0xe630('0x70')]-=0x1;}else{logger['error'](_0xe630('0xca'));}}}else{logger[_0xe630('0x95')](_0xe630('0xcb'));}};Dialer[_0xe630('0x1c')][_0xe630('0xcc')]=function(_0x53fb17,_0x13e951){var _0x58e190=this;return function(_0x3672a0){_0x58e190[_0xe630('0xae')](_0x13e951);logger[_0xe630('0x95')](_0x53fb17,util['inspect'](_0x3672a0,{'showHidden':![],'depth':null}));};};Dialer[_0xe630('0x1c')]['emptyContact']=function(_0x403cbe,_0x4db340,_0x2be38a){var _0x4dd4a9={'state':0x19,'statedesc':_0xe630('0xcd')};this[_0xe630('0xae')](_0x4db340);this[_0xe630('0xce')](_[_0xe630('0x89')](_0x4dd4a9,_[_0xe630('0xcf')](_0x2be38a,[_0xe630('0xd0'),'ListId',_0xe630('0xd1'),_0xe630('0xd2'),_0xe630('0xd3')])),'[emptyContact][createHistory]',_0xe630('0xd4'));logger[_0xe630('0x95')](_0x403cbe);};Dialer[_0xe630('0x1c')]['isSuccess']=function(_0x325b88){return _0x325b88===_0xe630('0xd5');};Dialer[_0xe630('0x1c')][_0xe630('0xd6')]=function(_0x30300a){return!_['isUndefined'](_0x30300a)&&_0x30300a&&!_[_0xe630('0x80')](_0x30300a[_0xe630('0x42')])&&!_[_0xe630('0x80')](_0x30300a[_0xe630('0x75')])&&_0x30300a['active']&&(this[_0xe630('0x25')][util['format'](_0xe630('0xd7'),_0x30300a[_0xe630('0x42')])][_0xe630('0xaa')]===_0xe630('0xd8')||this[_0xe630('0x25')][util[_0xe630('0x77')](_0xe630('0xd7'),_0x30300a[_0xe630('0x42')])][_0xe630('0xaa')]===_0xe630('0xd9'));};Dialer['prototype']['saveInDb']=function(_0x3a8cfb,_0x310e71,_0x164b18){this[_0xe630('0xc8')](_0x3a8cfb)[_0xe630('0xac')](loggerCatch(_0x310e71));this[_0xe630('0xc6')](_0x3a8cfb)['catch'](loggerCatch(_0x164b18));};Dialer[_0xe630('0x1c')]['syncVarSet']=function(_0x139b5d){var _0x5a61e0=this[_0xe630('0x2a')][_0x139b5d['uniqueid']];var _0x5025f7;if(!_[_0xe630('0xda')](_0x139b5d)&&!_[_0xe630('0xda')](_0x139b5d['variable'])&&!_['isNil'](_0x139b5d[_0xe630('0xdb')][_0xe630('0xdc')])&&_0x139b5d['exten']===_0xe630('0xdd')&&_0x5a61e0){if(_0x5a61e0[_0xe630('0x4f')]!=='ivr'&&this['voiceQueues'][_0x5a61e0['queue']]['dialAMDActive']&&_0x139b5d['value']===_0xe630('0xde')){delete this['uniqueId'][_0x139b5d[_0xe630('0xdf')]];this['updateOriginated'](this[_0xe630('0x22')][_0x5a61e0[_0xe630('0xaf')]]);this[_0xe630('0x22')][_0x5a61e0[_0xe630('0xaf')]][_0xe630('0x5e')]+=0x1;this[_0xe630('0x22')][_0x5a61e0[_0xe630('0xaf')]][_0xe630('0x5d')]+=0x1;_0x5025f7=new Hangup(_0x5a61e0,_0x139b5d);_0x5025f7[_0xe630('0xa7')]=0x12;_0x5025f7[_0xe630('0xe0')]=_0xe630('0xe1');_0x5025f7[_0xe630('0xe2')]=_0xe630('0xe3');ami[_0xe630('0x4e')](_0xe630('0xe4'),ut[_0xe630('0xe5')](_0x5025f7,_0xe630('0xe6')));this[_0xe630('0xce')](_0x5025f7,'[syncHangupInAMD][createHistory]',_0xe630('0xe7'));}if(_0x5a61e0['type']!=='ivr'&&this[_0xe630('0x22')][_0x5a61e0['queue']]['dialAMDActive']&&_0x139b5d[_0xe630('0xe8')]==='MACHINE'){var _0x2cb3bf=this;return new BPromise(function(_0x2eefaa,_0xc7e7cb){delete _0x2cb3bf[_0xe630('0x2a')][_0x139b5d[_0xe630('0xdf')]];_0x2cb3bf[_0xe630('0xae')](_0x2cb3bf[_0xe630('0x22')][_0x5a61e0['queue']]);_0x2cb3bf[_0xe630('0x22')][_0x5a61e0[_0xe630('0xaf')]][_0xe630('0x5e')]+=0x1;_0x2cb3bf['voiceQueues'][_0x5a61e0[_0xe630('0xaf')]][_0xe630('0x5d')]+=0x1;var _0x117601=_0x2cb3bf['voiceQueues'][_0x5a61e0[_0xe630('0xaf')]];var _0x1bb504=new Hangup(_0x5a61e0,_0x139b5d);_0x1bb504[_0xe630('0xa7')]=0x13;_0x1bb504[_0xe630('0xe0')]='Machine';_0x1bb504[_0xe630('0xe2')]=_0xe630('0xe3');_0x1bb504[_0xe630('0xe9')]+=0x1;_0x1bb504[_0xe630('0xea')]+=0x1;_0x1bb504[_0xe630('0xe6')]=!![];ami[_0xe630('0x4e')](_0xe630('0xe4'),ut[_0xe630('0xe5')](_0x1bb504,_0xe630('0xe6')));_0x2cb3bf['createHistory'](_0x1bb504)[_0xe630('0xac')](loggerCatch(_0xe630('0xeb')));if(_0x1bb504[_0xe630('0xec')]+_0x1bb504[_0xe630('0xed')]+_0x1bb504[_0xe630('0xee')]+_0x1bb504[_0xe630('0xef')]+_0x1bb504['countdropretry']+_0x1bb504[_0xe630('0xf0')]+_0x1bb504[_0xe630('0xe9')]+_0x1bb504[_0xe630('0xf1')]>=_0x117601[_0xe630('0xf2')]){_0x2cb3bf[_0xe630('0xf3')](_0x1bb504,_0x2eefaa,_0xc7e7cb,_0xe630('0xf4'));}else{if(_0x1bb504['countmachineretry']>=_0x117601['dialMachineMaxRetry']){_0x2cb3bf[_0xe630('0xf5')](_0x1bb504,_0x2eefaa,_0xc7e7cb,_0xe630('0xf6'));}else{_0x2cb3bf[_0xe630('0xbd')]({'active':![],'countmachineretry':_0x1bb504[_0xe630('0xe9')],'scheduledat':moment()[_0xe630('0xf7')](_0x117601['dialMachineRetryFrequency'],_0xe630('0xf8'))['format'](_0xe630('0xf9')),'ContactId':_0x1bb504[_0xe630('0xd0')],'ListId':_0x1bb504[_0xe630('0xfa')],'VoiceQueueId':_0x1bb504['VoiceQueueId']||undefined,'CampaignId':_0x1bb504[_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0xfb')));_0x2eefaa({'reschedule':0x1});}}});}if(_0x5a61e0[_0xe630('0x4f')]===_0xe630('0x8f')&&this[_0xe630('0x23')][_0x5a61e0[_0xe630('0xaf')]]['dialAMDActive']&&_0x139b5d[_0xe630('0xe8')]==='HANGUP'){delete this[_0xe630('0x2a')][_0x139b5d[_0xe630('0xdf')]];this['updateOriginated'](this[_0xe630('0x23')][_0x5a61e0[_0xe630('0xaf')]]);_0x5025f7=new Hangup(_0x5a61e0,_0x139b5d);_0x5025f7[_0xe630('0xa7')]=0x12;_0x5025f7['statedesc']=_0xe630('0xe1');_0x5025f7[_0xe630('0xe2')]='AMD';ami['emit']('custom:amd',ut[_0xe630('0xe5')](_0x5025f7,_0xe630('0xe6')));this[_0xe630('0xce')](_0x5025f7,_0xe630('0xfc'),_0xe630('0xfd'));}if(_0x5a61e0[_0xe630('0x4f')]==='ivr'&&this[_0xe630('0x23')][_0x5a61e0[_0xe630('0xaf')]][_0xe630('0xfe')]&&_0x139b5d['value']==='MACHINE'){var _0x2cb3bf=this;return new BPromise(function(_0x167601,_0x23ee00){delete _0x2cb3bf[_0xe630('0x2a')][_0x139b5d[_0xe630('0xdf')]];_0x2cb3bf[_0xe630('0xae')](_0x2cb3bf[_0xe630('0x23')][_0x5a61e0[_0xe630('0xaf')]]);_0x2cb3bf[_0xe630('0x23')][_0x5a61e0[_0xe630('0xaf')]][_0xe630('0x5e')]+=0x1;_0x2cb3bf[_0xe630('0x23')][_0x5a61e0[_0xe630('0xaf')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3a84ae=_0x2cb3bf['campaigns'][_0x5a61e0[_0xe630('0xaf')]];var _0x3a6387=new Hangup(_0x5a61e0,_0x139b5d);_0x3a6387[_0xe630('0xa7')]=0x13;_0x3a6387[_0xe630('0xe0')]=_0xe630('0xff');_0x3a6387[_0xe630('0xe2')]=_0xe630('0xe3');_0x3a6387['countmachineretry']+=0x1;_0x3a6387['countglobal']+=0x1;_0x3a6387[_0xe630('0xe6')]=!![];ami[_0xe630('0x4e')](_0xe630('0xe4'),ut[_0xe630('0xe5')](_0x3a6387,'amd'));_0x2cb3bf[_0xe630('0xc8')](_0x3a6387)[_0xe630('0xac')](loggerCatch(_0xe630('0xeb')));if(_0x3a6387['countbusyretry']+_0x3a6387[_0xe630('0xed')]+_0x3a6387[_0xe630('0xee')]+_0x3a6387['countnosuchnumberretry']+_0x3a6387['countdropretry']+_0x3a6387[_0xe630('0xf0')]+_0x3a6387[_0xe630('0xe9')]+_0x3a6387[_0xe630('0xf1')]>=_0x3a84ae['dialGlobalMaxRetry']){_0x2cb3bf[_0xe630('0xf3')](_0x3a6387,_0x167601,_0x23ee00,_0xe630('0xf4'));}else{if(_0x3a6387[_0xe630('0xe9')]>=_0x3a84ae['dialMachineMaxRetry']){_0x2cb3bf[_0xe630('0xf5')](_0x3a6387,_0x167601,_0x23ee00,_0xe630('0xf6'));}else{_0x2cb3bf[_0xe630('0xbd')]({'active':![],'countmachineretry':_0x3a6387[_0xe630('0xe9')],'scheduledat':moment()[_0xe630('0xf7')](_0x3a84ae[_0xe630('0x100')],_0xe630('0xf8'))[_0xe630('0x77')](_0xe630('0xf9')),'ContactId':_0x3a6387[_0xe630('0xd0')],'ListId':_0x3a6387[_0xe630('0xfa')],'VoiceQueueId':_0x3a6387[_0xe630('0xd2')]||undefined,'CampaignId':_0x3a6387[_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0xfb')));_0x167601({'reschedule':0x1});}}});}}};Dialer[_0xe630('0x1c')][_0xe630('0x101')]=function(_0xfcaa11){var _0x10fe72=this[_0xe630('0x2a')][_0xfcaa11[_0xe630('0xdf')]];var _0x642bba=this;var _0x52fbf9;if(_0x10fe72&&_0x10fe72[_0xe630('0x4f')]==='ivr'){delete this['uniqueId'][_0xfcaa11['uniqueid']];this[_0xe630('0xae')](this[_0xe630('0x23')][_0x10fe72[_0xe630('0xaf')]]);this['campaigns'][_0x10fe72[_0xe630('0xaf')]]['ivrAnswerCallsDay']+=0x1;_0x52fbf9=new Hangup(_0x10fe72,_0xfcaa11);this[_0xe630('0xc8')](_0x52fbf9)[_0xe630('0xac')](loggerCatch(_0xe630('0x102')));this[_0xe630('0xc6')](_0x52fbf9)[_0xe630('0xac')](loggerCatch(_0xe630('0x103')));}if(_0x10fe72&&_0x10fe72[_0xe630('0x4f')]!=='ivr'&&isNotNull(this[_0xe630('0x22')][_0x10fe72[_0xe630('0xaf')]][_0xe630('0x104')])){delete this[_0xe630('0x2a')][_0xfcaa11[_0xe630('0xdf')]];this['updateOriginated'](this[_0xe630('0x22')][_0x10fe72[_0xe630('0xaf')]]);this['voiceQueues'][_0x10fe72[_0xe630('0xaf')]][_0xe630('0x5e')]+=0x1;this[_0xe630('0x22')][_0x10fe72['queue']][_0xe630('0x5d')]+=0x1;_0x52fbf9=new Hangup(_0x10fe72,_0xfcaa11);_0x52fbf9['state']=0x10;_0x52fbf9[_0xe630('0xe0')]='AnswerAGI';_0x52fbf9[_0xe630('0xe2')]=_0xe630('0x105');this['createHistory'](_0x52fbf9)[_0xe630('0xac')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xe630('0xc6')](_0x52fbf9)[_0xe630('0xac')](loggerCatch(_0xe630('0x103')));}if(_0x10fe72&&_0x10fe72['type']!==_0xe630('0x8f')&&!isNotNull(this['voiceQueues'][_0x10fe72[_0xe630('0xaf')]][_0xe630('0x104')])){delete this['uniqueId'][_0xfcaa11['uniqueid']];this['updateOriginated'](this[_0xe630('0x22')][_0x10fe72[_0xe630('0xaf')]]);this[_0xe630('0x22')][_0x10fe72[_0xe630('0xaf')]][_0xe630('0x67')]+=0x1;_0x52fbf9=new Hangup(_0x10fe72,_0xfcaa11);_0x52fbf9['state']=0xc;_0x52fbf9[_0xe630('0xe0')]=_0xfcaa11[_0xe630('0x106')];_0x52fbf9[_0xe630('0xe2')]=_0xe630('0x107');this[_0xe630('0xc8')](_0x52fbf9)[_0xe630('0xac')](loggerCatch(_0xe630('0x102')));this[_0xe630('0xc6')](_0x52fbf9)[_0xe630('0xac')](loggerCatch(_0xe630('0x103')));}};Dialer[_0xe630('0x1c')][_0xe630('0x36')]=function(_0x3ab1f1){var _0x35c64a=this[_0xe630('0x2a')][_0x3ab1f1[_0xe630('0xdf')]];var _0x570a5b=this;if(this[_0xe630('0x22')][_0x3ab1f1[_0xe630('0xaf')]]){if(_0x35c64a&&_0x35c64a[_0xe630('0x4f')]!==_0xe630('0x8f')){delete this['uniqueId'][_0x3ab1f1[_0xe630('0xdf')]];this[_0xe630('0x22')][_0x3ab1f1[_0xe630('0xaf')]]['outboundAnswerCallsDay']+=0x1;var _0x201d2f=new AgentComplete(_0x35c64a,_0x3ab1f1);if(_0x3ab1f1[_0xe630('0x108')]===_0xe630('0x109')){_0x201d2f[_0xe630('0x10a')]=this[_0xe630('0x22')][_0x3ab1f1['queue']][_0xe630('0x10b')]&&this[_0xe630('0x22')][_0x3ab1f1[_0xe630('0xaf')]][_0xe630('0x10c')]?moment()[_0xe630('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xe630('0xc8')](_0x201d2f)[_0xe630('0xac')](loggerCatch(_0xe630('0x10d')));this['moveContactManagedDialer'](_0x201d2f)[_0xe630('0xac')](loggerCatch(_0xe630('0x10e')));}}};Dialer[_0xe630('0x1c')][_0xe630('0x30')]=function(_0x47f436){if(this[_0xe630('0x22')][_0x47f436['queue']]){if(this['uniqueId'][_0x47f436['uniqueid']]&&this[_0xe630('0x2a')][_0x47f436[_0xe630('0xdf')]][_0xe630('0x4f')]!==_0xe630('0x8f')){this['updateOriginated'](this[_0xe630('0x22')][_0x47f436['queue']]);this[_0xe630('0x2a')][_0x47f436[_0xe630('0xdf')]][_0xe630('0x10f')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x40f057,_0x1e1ffb){this[_0xe630('0xc8')](_0x40f057)[_0xe630('0xac')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x1e1ffb==0x0){this[_0xe630('0xc6')](_0x40f057)['catch'](loggerCatch(_0xe630('0x110')));}};Dialer['prototype'][_0xe630('0x32')]=function(_0x5dff32){var _0x479113=this['uniqueId'][_0x5dff32[_0xe630('0xdf')]];var _0x7892a5=this;var _0x541955=![];var _0x409ad0;var _0x1efe57;if(this[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]]){if(_0x479113&&_0x479113[_0xe630('0x4f')]!==_0xe630('0x8f')){delete this['uniqueId'][_0x5dff32[_0xe630('0xdf')]];this['updateOriginated'](this['voiceQueues'][_0x5dff32['queue']]);_0x479113[_0xe630('0x111')]=moment()['format'](_0xe630('0xf9'));var _0x3c53ce=new QueueCallerAbandon(_0x479113,_0x5dff32);if(getSeconds(_0x479113[_0xe630('0x111')],_0x479113[_0xe630('0x112')])>=_0x479113[_0xe630('0x113')]){this[_0xe630('0x22')][_0x5dff32['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xe630('0x22')][_0x5dff32['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3c53ce[_0xe630('0xa7')]=0xa;_0x3c53ce[_0xe630('0xe0')]='Drop';_0x3c53ce[_0xe630('0x114')]=_0xe630('0x115');_0x3c53ce[_0xe630('0x10a')]=this[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x10b')]?moment()[_0xe630('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3c53ce[_0xe630('0x116')]+=0x1;_0x3c53ce[_0xe630('0xea')]+=0x1;_0x409ad0=this['voiceQueues'][_0x5dff32[_0xe630('0xaf')]]['dialDropRetryFrequency'];_0x1efe57=this[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x117')];_0x7892a5[_0xe630('0xb5')](_0x3c53ce,_0x3c53ce[_0xe630('0xa7')],_0x479113['voiceQueue'])[_0xe630('0xb2')](function(_0x28f74d){_0x541955=_0x28f74d[_0xe630('0x118')]==0x1;if(_0x3c53ce[_0xe630('0x116')]>=_0x7892a5[_0xe630('0x22')][_0x5dff32['queue']][_0xe630('0x119')]){_0x7892a5[_0xe630('0x11a')](_0x3c53ce,_0x28f74d[_0xe630('0x118')]);}else{_0x7892a5['rescheduleContact']({'active':![],'countdropretry':_0x3c53ce[_0xe630('0x116')],'scheduledat':moment()[_0xe630('0xf7')](_0x7892a5[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x11b')],_0xe630('0xf8'))['format'](_0xe630('0xf9')),'ContactId':_0x479113[_0xe630('0xd0')],'ListId':_0x479113[_0xe630('0xfa')],'VoiceQueueId':_0x479113['VoiceQueueId']||undefined,'CampaignId':_0x479113[_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x11c')));var _0x2387ca=new History(_0x3c53ce);_0x2387ca[_0xe630('0xa7')]=0xa;_0x2387ca[_0xe630('0xe0')]='Drop';_0x2387ca[_0xe630('0x11d')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));_0x2387ca[_0xe630('0x11e')]=_0x2387ca['starttime'];_0x2387ca[_0xe630('0x11f')]=_0x3c53ce[_0xe630('0x11f')];_0x2387ca[_0xe630('0x120')]=_0x3c53ce[_0xe630('0x120')];_0x7892a5[_0xe630('0xc8')](_0x2387ca)[_0xe630('0xac')](loggerCatch(_0xe630('0x121')));}})[_0xe630('0xb2')](function(_0xe8b641){if(_0x541955)_0x7892a5[_0xe630('0xb7')](_0x3c53ce,_0x409ad0,_0x1efe57)[_0xe630('0xb2')](function(_0xf10350){return 0x1;});});}else{this[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x6a')]+=0x1;this['voiceQueues'][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x61')]+=0x1;_0x3c53ce[_0xe630('0xa7')]=0xb;_0x3c53ce[_0xe630('0xe0')]=_0xe630('0x122');_0x3c53ce['dropreason']=_0xe630('0x123');_0x3c53ce[_0xe630('0xf0')]+=0x1;_0x3c53ce[_0xe630('0xea')]+=0x1;_0x409ad0=this[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]]['dialAbandonedRetryFrequency'];_0x1efe57=this[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x117')];_0x7892a5[_0xe630('0xb5')](_0x3c53ce,_0x3c53ce[_0xe630('0xa7')],_0x479113[_0xe630('0x124')])['then'](function(_0x4b7f2d){if(_0x3c53ce[_0xe630('0xf0')]>=_0x7892a5[_0xe630('0x22')][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x125')]){_0x7892a5[_0xe630('0x11a')](_0x3c53ce,_0x4b7f2d[_0xe630('0x118')]);}else{_0x7892a5[_0xe630('0xbd')]({'active':![],'countabandonedretry':_0x3c53ce[_0xe630('0xf0')],'scheduledat':moment()[_0xe630('0xf7')](_0x7892a5['voiceQueues'][_0x5dff32[_0xe630('0xaf')]][_0xe630('0x126')],_0xe630('0xf8'))[_0xe630('0x77')](_0xe630('0xf9')),'ContactId':_0x479113[_0xe630('0xd0')],'ListId':_0x479113[_0xe630('0xfa')],'VoiceQueueId':_0x479113[_0xe630('0xd2')]||undefined,'CampaignId':_0x479113[_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x127')));var _0x2c2b5b=new History(_0x3c53ce);_0x2c2b5b[_0xe630('0xa7')]=0xb;_0x2c2b5b['statedesc']=_0xe630('0x122');_0x2c2b5b[_0xe630('0x11d')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));_0x2c2b5b[_0xe630('0x11e')]=_0x2c2b5b[_0xe630('0x11d')];_0x2c2b5b[_0xe630('0x11f')]=_0x3c53ce['calleridname'];_0x2c2b5b['calleridnum']=_0x3c53ce[_0xe630('0x120')];_0x7892a5['createHistory'](_0x2c2b5b)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xe630('0xb2')](function(_0x11234b){if(_0x541955)_0x7892a5[_0xe630('0xb7')](_0x3c53ce,_0x409ad0,_0x1efe57)[_0xe630('0xb2')](function(_0x4911a2){return 0x1;});});}}}};Dialer[_0xe630('0x1c')][_0xe630('0x128')]=function(_0x4d7709){if(this[_0xe630('0x28')][_0x4d7709[_0xe630('0xdf')]]){this[_0xe630('0x28')][_0x4d7709['uniqueid']][_0xe630('0xab')]=_0x4d7709[_0xe630('0xab')];}if(this[_0xe630('0x2a')][_0x4d7709[_0xe630('0xdf')]]){this['uniqueId'][_0x4d7709[_0xe630('0xdf')]][_0xe630('0xab')]=_0x4d7709['channel'];}};Dialer[_0xe630('0x1c')]['syncQueueMember']=function(_0x5d85ae){if(strategy[this[_0xe630('0x22')][this[_0xe630('0x28')][_0x5d85ae['actionid']][_0xe630('0xaf')]][_0xe630('0x51')]]===_0xe630('0x129')){if(this[_0xe630('0x28')][_0x5d85ae[_0xe630('0x12a')]]&&_[_0xe630('0xda')](this['actions'][_0x5d85ae[_0xe630('0x12a')]][_0xe630('0x12b')])&&_0x5d85ae[_0xe630('0xaa')]==='1'&&_0x5d85ae['paused']==='0'){if(this[_0xe630('0x24')][_0x5d85ae[_0xe630('0x12c')]]){if(!this[_0xe630('0x24')][_0x5d85ae[_0xe630('0x12c')]][_0xe630('0x12b')]){this[_0xe630('0x24')][_0x5d85ae['stateinterface']][_0xe630('0x12b')]=!![];this['actions'][_0x5d85ae[_0xe630('0x12a')]][_0xe630('0x12b')]=!![];this[_0xe630('0x28')][_0x5d85ae[_0xe630('0x12a')]][_0xe630('0x12c')]=_0x5d85ae['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0xe630('0x28')][_0x5d85ae['actionid']][_0xe630('0xaf')]][_0xe630('0x51')]]||_0xe630('0x1b'))===_0xe630('0x1b')){if(this[_0xe630('0x28')][_0x5d85ae['actionid']]){if(this[_0xe630('0x24')][_0x5d85ae['stateinterface']]){this['actions'][_0x5d85ae[_0xe630('0x12a')]][_0xe630('0x12c')]=_0x5d85ae[_0xe630('0x12c')];if(_[_0xe630('0xda')](this[_0xe630('0x2e')][this[_0xe630('0x28')][_0x5d85ae[_0xe630('0x12a')]]['queue']])){this[_0xe630('0x2e')][this[_0xe630('0x28')][_0x5d85ae[_0xe630('0x12a')]][_0xe630('0xaf')]]=[];}this['queueBooked'][this[_0xe630('0x28')][_0x5d85ae['actionid']][_0xe630('0xaf')]]['push'](_[_0xe630('0x89')](_[_0xe630('0xcf')](this[_0xe630('0x28')][_0x5d85ae[_0xe630('0x12a')]],['idHopper',_0xe630('0x12c')]),{'status':_0x5d85ae[_0xe630('0xaa')],'paused':_0x5d85ae['paused']}));}}}};function unlockQueueStatus(_0x9ee881,_0x1fc643){setTimeout(function(){if(_[_0xe630('0x80')](_0x9ee881[_0xe630('0x12d')])){loggerBooked['error'](_0xe630('0x12e'),_0x1fc643);}_0x9ee881[_0xe630('0x12d')]=!![];loggerBooked[_0xe630('0x78')](_0xe630('0x12f'),_0x1fc643,JSON[_0xe630('0x130')](_[_0xe630('0xcf')](_0x9ee881,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0xe630('0x1c')][_0xe630('0x3d')]=function(_0x4515a4){var _0x1f702e=this;var _0x2a38e1=_0x1f702e['voiceQueues'][_0x1f702e['actions'][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]];if(strategy[this['voiceQueues'][this['actions'][_0x4515a4[_0xe630('0x12a')]]['queue']][_0xe630('0x51')]]===_0xe630('0x129')){if(this['actions'][_0x4515a4[_0xe630('0x12a')]]&&this['actions'][_0x4515a4[_0xe630('0x12a')]][_0xe630('0x12c')]){this[_0xe630('0x21')][_0xe630('0x131')](this[_0xe630('0x28')][_0x4515a4['actionid']][_0xe630('0x132')],this[_0xe630('0x28')][_0x4515a4['actionid']]['stateinterface'])[_0xe630('0xac')](function(_0x27dee7){logger[_0xe630('0x95')](_0xe630('0x133'),util[_0xe630('0x94')](_0x27dee7,{'showHidden':![],'depth':null}));})[_0xe630('0x1f')](function(){_0x1f702e['updateOriginated'](_0x1f702e[_0xe630('0x22')][_0x1f702e[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]]);_0x1f702e[_0xe630('0x24')][_0x1f702e[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0x12c')]][_0xe630('0x12b')]=![];delete _0x1f702e[_0xe630('0x28')][_0x4515a4['actionid']];unlockQueueStatus(_0x2a38e1);});}else{this[_0xe630('0xae')](this['voiceQueues'][this['actions'][_0x4515a4['actionid']]['queue']]);this[_0xe630('0xbd')]({'active':![],'ContactId':this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xd0')],'ListId':this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xfa')],'VoiceQueueId':this[_0xe630('0x28')][_0x4515a4['actionid']][_0xe630('0xd2')]||undefined,'CampaignId':this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xd3')]||undefined})['catch'](loggerCatch(_0xe630('0x134')));delete this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]];unlockQueueStatus(_0x2a38e1);}}else if((strategy[this['voiceQueues'][this['actions'][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]][_0xe630('0x51')]]||_0xe630('0x1b'))===_0xe630('0x1b')){var _0x25270f;if(this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]]&&!_[_0xe630('0x4a')](this[_0xe630('0x2e')][this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]])){if(this[_0xe630('0x135')][_0x1f702e[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]]){this[_0xe630('0x135')][_0x1f702e[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]]['queue']]=this[_0xe630('0x135')][this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]]?this[_0xe630('0x135')][this['actions'][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]]:this[_0xe630('0x2e')][this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]]?this[_0xe630('0x2e')][this[_0xe630('0x28')][_0x4515a4['actionid']][_0xe630('0xaf')]][_0xe630('0x136')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x4515a4[_0xe630('0x12a')]]['queue']][_0xe630('0x136')]=this[_0xe630('0x135')][this[_0xe630('0x28')][_0x4515a4[_0xe630('0x12a')]][_0xe630('0xaf')]];for(var _0x46ebcc=0x0;_0x46ebcc=0x0;})['catch'](myreject(_0x540585)));}}else{_0x5c3c75[_0xe630('0x15a')](ami['Action']({'action':_0xe630('0x154'),'command':util['format'](_0xe630('0x155'),_0x413b82,!_[_0xe630('0x80')](config[_0xe630('0x157')][_0x22fe9b])?_0x22fe9b:'')})[_0xe630('0xb2')](function(_0x5b6f85){return _0x5b6f85[_0xe630('0x158')][_0xe630('0x159')](_0xe630('0x15b'))>=0x0;})['catch'](myreject(_0x540585)));}BPromise[_0xe630('0x15c')](_0x5c3c75)[_0xe630('0xb2')](function(_0x1fabc7){var _0x471607=_['some'](_0x1fabc7);if(_0x471607){return _0x1c8734(_0x471607);}else{_0x34ff7f[_0xe630('0x40')]=_0x39c4b5?'GLOBAL_INTERVAL_IS_OVERTIME':_0xe630('0x15d');return _0x540585(msgResponse(_0xe630('0x15e'),'Failure',_0xe630('0x15f')+_0x39c4b5+'\x20'+_0x561b60+_0xe630('0x160')+util[_0xe630('0x94')](_0x413b82,{'showHidden':![],'depth':null})+_0xe630('0x161')+_0x22fe9b));}})['catch'](function(_0x47e67d){return _0x540585(msgResponse(_0xe630('0x14b'),'Failure',JSON[_0xe630('0x130')](_0x47e67d)));});});};Dialer[_0xe630('0x1c')][_0xe630('0x162')]=function(_0x38a833){var _0x4bc608=this;return function(){switch(_0x38a833['dialMethod']){case _0xe630('0x163'):freeVariablesPredictive(_0x38a833);_0x4bc608[_0xe630('0x164')](_0x38a833,0x1);break;case _0xe630('0x165'):freeVariablesPredictive(_0x38a833);_0x4bc608['handlePower'](_0x38a833,_0x38a833['dialPowerLevel']);break;case _0xe630('0x166'):_0x4bc608[_0xe630('0x166')](_0x38a833);break;case _0xe630('0x7'):freeVariablesPredictive(_0x38a833);_0x4bc608[_0xe630('0x164')](_0x38a833,0x1);break;default:freeVariablesPredictive(_0x38a833);logger[_0xe630('0x95')](_0xe630('0x167'),_0x38a833[_0xe630('0x42')],_0xe630('0x168'));}};};Dialer[_0xe630('0x1c')][_0xe630('0x169')]=function(_0xb7018b){var _0x4ebbc4=this;return function(){_0x4ebbc4['handleIvr'](_0xb7018b);};};Dialer[_0xe630('0x1c')][_0xe630('0x9')]=function(_0x230d83){var _0xe7f4de=this;if(isNotPreview(_0x230d83[_0xe630('0x59')])){if(isVoiceQueueOutbound(_0x230d83[_0xe630('0x4f')])&&isActive(_0x230d83['dialActive'])){_0x230d83['sendMessageOneNotActive']=!![];BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](checkIsLoggedIn(_0x230d83,_0x230d83[_0xe630('0x16a')]))[_0xe630('0xb2')](checkIsActive(_0x230d83,_0x230d83[_0xe630('0x58')]))[_0xe630('0xb2')](checkInterval(_0x230d83))[_0xe630('0xb2')](_0xe7f4de[_0xe630('0x145')](_0x230d83))[_0xe630('0xb2')](_0xe7f4de[_0xe630('0x149')](_0x230d83['dialGlobalInterval'],_0x230d83[_0xe630('0x16b')],_0x230d83[_0xe630('0x42')],_0x230d83))[_0xe630('0xb2')](_0xe7f4de['checkIfTimeIntervals'](_0x230d83[_0xe630('0x48')],_0x230d83[_0xe630('0x16b')],_0x230d83[_0xe630('0x42')],_0x230d83))[_0xe630('0xb2')](_0xe7f4de[_0xe630('0x162')](_0x230d83))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x230d83));}else{notSendMessagesQueue(_0x230d83);}}else{freeVariablesPredictive(_0x230d83);}};Dialer['prototype']['syncQueueSummaryComplete']=_[_0xe630('0x16c')](function(){var _0x58e474=_[_0xe630('0x16d')](this['voiceQueues'],function(_0x3f5aa6){return _0x3f5aa6['dialPreviewRecallmeReminder'];});var _0x56d1eb=_[_0xe630('0x16d')](this[_0xe630('0x24')],function(_0x2e466e){return _0x2e466e['online']&&_0x2e466e['status']==='reachable';});if(_0x58e474['length']>0x0&&_0x56d1eb[_0xe630('0x137')]>0x0){return BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](cmHopper[_0xe630('0x16e')](_[_0xe630('0x16f')](_0x58e474,'id'),previewRecallmeReminderInterval,_['map'](_0x56d1eb,'id')))[_0xe630('0xb2')](function(_0x2f96fd){for(var _0x51ee11=0x0;_0x51ee11<_0x2f96fd[_0xe630('0x137')];_0x51ee11++){var _0x53185=_0x2f96fd[_0x51ee11]['Agent'][_0xe630('0x42')];if(_0x53185)io['to'](util[_0xe630('0x77')](_0xe630('0x170'),_0x53185))['emit'](_0xe630('0x171'),{'hopper':_0x2f96fd[_0x51ee11]});}})[_0xe630('0xac')](function(_0xf7e96b){logger[_0xe630('0x95')](_0xe630('0x172'),_0xf7e96b);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe630('0x1c')][_0xe630('0x144')]=function(){var _0x1a5bab=this;var _0x3953b6;for(var _0x44da48 in this['campaigns']){if(typeof this[_0xe630('0x23')][_0x44da48]!==_0xe630('0x97')){_0x3953b6=this[_0xe630('0x23')][_0x44da48];if(isCampaignIvr(_0x3953b6[_0xe630('0x4f')])&&isActive(_0x3953b6[_0xe630('0x75')])){_0x3953b6['sendMessageOneNotActive']=!![];BPromise[_0xe630('0xb1')]()[_0xe630('0xb2')](checkIsActive(_0x3953b6,_0x3953b6[_0xe630('0x75')]))[_0xe630('0xb2')](checkInterval(_0x3953b6))[_0xe630('0xb2')](_0x1a5bab[_0xe630('0x145')](_0x3953b6))[_0xe630('0xb2')](_0x1a5bab[_0xe630('0x149')](_0x3953b6[_0xe630('0x173')],_0x3953b6[_0xe630('0x16b')],_0x3953b6[_0xe630('0x42')],_0x3953b6))[_0xe630('0xb2')](_0x1a5bab[_0xe630('0x14a')](_0x3953b6['Interval'],_0x3953b6[_0xe630('0x16b')],_0x3953b6[_0xe630('0x42')],_0x3953b6))[_0xe630('0xb2')](_0x1a5bab[_0xe630('0x169')](_0x3953b6))[_0xe630('0xac')](loggerCatchQueueSummary(_0xe630('0x174'),_0x3953b6));}else{notSendMessagesCampaign(_0x3953b6);}}}};function getCallerIdRandom(_0x1d1104,_0x52c591){var _0x520f15;var _0x553475;var _0x29e172;if(_0x52c591<=0x0){_0x52c591=0x1;}_0x520f15=new RegExp('\x5cw{0,'+_0x52c591+'}$');_0x553475=Math[_0xe630('0x175')](0xa,_0x52c591-0x1);_0x29e172=Math[_0xe630('0x175')](0xa,_0x52c591)-0x1;return util['format']('%s',_[_0xe630('0x176')](_0x1d1104,_0x520f15,_['random'](_0x553475,_0x29e172)));}function extractCalleridName(_0xf7ace1){var _0x14837f=_0xf7ace1[_0xe630('0x177')](/"(.*?)"/);return _0x14837f?_0x14837f[0x1]:_0xf7ace1;}function extractCalleridNumber(_0x54fecf){var _0x87a0df=_0x54fecf[_0xe630('0x177')](/<(.*?)>/);return _0x87a0df?_0x87a0df[0x1]:_0x54fecf;}Dialer[_0xe630('0x1c')]['actionOriginate']=function(_0x4fb281,_0x1e66e1){var _0x34576a=this;var _0x4e5fbf=uuid['v4']();this['actions'][_0x4e5fbf]=new Action(_0x4fb281,_0x1e66e1,_0x4e5fbf);return new BPromise(function(_0x1f52c8,_0x3a61c9){if(_[_0xe630('0x80')](_0x4fb281)&&typeof _0x4fb281!==_0xe630('0x178')){return _0x3a61c9(msgResponse(_0xe630('0x179'),_0xe630('0x14c'),_0xe630('0x17a')));}if(_[_0xe630('0x80')](_0x1e66e1[_0xe630('0x17b')])||_0x1e66e1[_0xe630('0x17b')]===null){return _0x3a61c9(msgResponse(_0xe630('0x179'),'Failure','contact\x20is\x20undefine'));}var _0x52709b={'XMD-CALLERID':_0x34576a[_0xe630('0x28')][_0x4e5fbf]['getCaller'](),'XMD-AGI':_0x4fb281[_0xe630('0x104')]?util[_0xe630('0x77')](_0xe630('0x17c'),ipAgi,_0x4fb281[_0xe630('0x104')]):_0xe630('0x17d'),'XMD-AGIAFTER':_0x4fb281[_0xe630('0x10b')]?util[_0xe630('0x77')](_0xe630('0x17c'),ipAgi,_0x4fb281[_0xe630('0x10b')]):'NONE','XMD-QUEUE':_0x4fb281[_0xe630('0x4f')]==='outbound'?util[_0xe630('0x77')](_0xe630('0x17e'),_0x4fb281[_0xe630('0x42')],_0x4fb281[_0xe630('0x17f')]||'',_0x4fb281[_0xe630('0x10c')]?'c':'',_0x4fb281['dialQueueTimeout']||0x3):_0xe630('0x17d'),'XMD-CONTACTID':_0x1e66e1['ContactId'],'XMD-CDRTYPE':_0xe630('0x6'),'CALLERID(all)':_0x34576a[_0xe630('0x28')][_0x4e5fbf][_0xe630('0x180')](),'XMD-AMD':_0x4fb281['dialAMDActive']?_0xe630('0x181'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4fb281[_0xe630('0xfe')]){_0x52709b[_0xe630('0x182')]=_0x4fb281[_0xe630('0x183')]||0x9c4;_0x52709b['XMD-AMDGREETING']=_0x4fb281[_0xe630('0x184')]||0x5dc;_0x52709b[_0xe630('0x185')]=_0x4fb281[_0xe630('0x186')]||0x320;_0x52709b[_0xe630('0x187')]=_0x4fb281['dialAMDTotalAnalysisTime']||0x1388;_0x52709b[_0xe630('0x188')]=_0x4fb281[_0xe630('0x189')]||0x64;_0x52709b['XMD-AMDBETWEENWORDSSILENCE']=_0x4fb281[_0xe630('0x18a')]||0x32;_0x52709b[_0xe630('0x18b')]=_0x4fb281[_0xe630('0x18c')]||0x3;_0x52709b['XMD-AMDSILENCETHRESHOLD']=_0x4fb281[_0xe630('0x18d')]||0x100;_0x52709b[_0xe630('0x18e')]=_0x4fb281[_0xe630('0x18f')]||0x1388;}if(_0x4fb281[_0xe630('0x4f')]==='outbound'){_0x52709b['XMD-VOICEQUEUEID']=_0x1e66e1['VoiceQueueId'];}else{_0x52709b[_0xe630('0x190')]=_0x1e66e1[_0xe630('0xd3')];}for(var _0x5c0719 in _0x1e66e1[_0xe630('0x191')]){if(typeof _0x1e66e1[_0xe630('0x191')][_0x5c0719]!=='undefined'){if(isNotNull(_0x1e66e1[_0xe630('0x191')][_0x5c0719])&&_0x5c0719!=='id'&&_0x5c0719!==_0xe630('0x192')&&_0x5c0719!==_0xe630('0x193')&&_0x5c0719!==_0xe630('0x194')){_0x52709b[util['format'](_0xe630('0x195'),_0xe630('0x196'),_['toUpper'](_0x5c0719))]=_0x1e66e1[_0xe630('0x191')][_0x5c0719];}}}var _0x395fb4=_0x34576a[_0xe630('0xd6')](_0x4fb281[_0xe630('0x74')])?getCallerId(_0x4fb281[_0xe630('0x74')][_0xe630('0x197')],_0x4fb281[_0xe630('0x5a')],_0x4fb281['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4fb281[_0xe630('0x198')],_0x4fb281[_0xe630('0x199')]):_0x4fb281['dialOriginateCallerIdNumber']):getCallerId(_[_0xe630('0xda')](_0x4fb281[_0xe630('0x146')])?_0x4fb281[_0xe630('0x74')][_0xe630('0x197')]:_0x4fb281[_0xe630('0x146')][_0xe630('0x197')],_0x4fb281[_0xe630('0x5a')],_0x4fb281[_0xe630('0x199')]>0x0?getCallerIdRandom(_0x4fb281[_0xe630('0x198')],_0x4fb281['dialRandomLastDigitCallerIdNumber']):_0x4fb281[_0xe630('0x198')]);if(_0x395fb4){_0x52709b[_0xe630('0x19a')]=_0x34576a[_0xe630('0x28')][_0x4e5fbf][_0xe630('0x19b')]=extractCalleridName(_0x395fb4);_0x52709b[_0xe630('0x19c')]=_0x1e66e1['phone'];}return ami[_0xe630('0x153')]({'actionid':_0x4e5fbf,'action':_0xe630('0x179'),'channel':_0x34576a[_0xe630('0xd6')](_0x4fb281['Trunk'])?util[_0xe630('0x77')](_0xe630('0x19d'),_0x4fb281[_0xe630('0x74')][_0xe630('0x42')],isNotNull(_0x4fb281['dialPrefix'])?_0x4fb281[_0xe630('0x5c')][_0xe630('0x19e')]()||'':'',_0x4fb281[_0xe630('0x19f')]>0x0?_0x1e66e1[_0xe630('0x17b')][_0xe630('0x1a0')](_0x4fb281[_0xe630('0x19f')]):_0x1e66e1[_0xe630('0x17b')]):util[_0xe630('0x77')](_0xe630('0x19d'),_[_0xe630('0xda')](_0x4fb281['TrunkBackup'])?_0x4fb281[_0xe630('0x74')][_0xe630('0x42')]:_0x4fb281[_0xe630('0x146')][_0xe630('0x42')],isNotNull(_0x4fb281[_0xe630('0x5c')])?_0x4fb281['dialPrefix'][_0xe630('0x19e')]()||'':'',_0x4fb281['dialCutDigit']>0x0?_0x1e66e1[_0xe630('0x17b')][_0xe630('0x1a0')](_0x4fb281[_0xe630('0x19f')]):_0x1e66e1['phone']),'callerid':_0x395fb4,'Exten':'xcally-motion-dialer','Context':_0xe630('0x1a1'),'Priority':'1','variable':_0x52709b,'timeout':(_0x4fb281[_0xe630('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e5fbf})['then'](function(_0x459f61){return _0x1f52c8(_0x459f61);})['catch'](function(_0x296335){_0x4fb281[_0xe630('0x1a2')]+=0x1;var _0x139293=new History(_0x34576a['actions'][_0x4e5fbf]);logger[_0xe630('0x95')](util[_0xe630('0x77')]('[originateError]:\x20%s',JSON[_0xe630('0x130')](_0x296335)));_0x139293['state']=0xe;_0x139293[_0xe630('0xe0')]=_0xe630('0x1a3');_0x139293[_0xe630('0x11d')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));_0x139293[_0xe630('0x11e')]=_0x139293[_0xe630('0x11d')];_0x34576a[_0xe630('0xc8')](_0x139293)[_0xe630('0xac')](loggerCatch('[originate][error]'));_0x34576a[_0xe630('0xc6')](_0x139293)[_0xe630('0xac')](loggerCatch('[originate][error]'))[_0xe630('0x1f')](function(){delete _0x34576a[_0xe630('0x28')][_0x4e5fbf];return _0x3a61c9(msgResponse(_0xe630('0x179'),_0xe630('0x1a4'),_0xe630('0x1a5')));});});});};Dialer[_0xe630('0x1c')]['syncOriginateResponse']=function(_0x11f860){var _0x5a3d0a=this[_0xe630('0x28')][_0x11f860[_0xe630('0x12a')]];if(_0x5a3d0a){delete this[_0xe630('0x28')][_0x11f860['actionid']];_0x5a3d0a[_0xe630('0x112')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));var _0x4c391a=_0x5a3d0a[_0xe630('0x4f')]===_0xe630('0x8f')?this[_0xe630('0x23')][_0x5a3d0a[_0xe630('0xaf')]]:this[_0xe630('0x22')][_0x5a3d0a[_0xe630('0x1a6')]()];if(!this[_0xe630('0x1a7')](_0x11f860[_0xe630('0x1a8')])){this[_0xe630('0xae')](_0x4c391a);return this[_0xe630('0x1a9')](_0x5a3d0a,_0x4c391a,_0x11f860)[_0xe630('0xac')](loggerCatch(_0xe630('0x1aa')));}this['uniqueId'][_0x11f860[_0xe630('0xdf')]]=_0x5a3d0a;}};Dialer['prototype']['checkRetriveMax']=function(_0x1e6a23,_0x28e88a,_0x4f6560){var _0x48d882=new History(_0x28e88a);if(_0x48d882['countbusyretry']+_0x48d882['countcongestionretry']+_0x48d882[_0xe630('0xee')]+_0x48d882['countnosuchnumberretry']+_0x48d882[_0xe630('0x116')]+_0x48d882[_0xe630('0xf0')]+_0x48d882[_0xe630('0xe9')]+_0x48d882['countagentrejectretry']>=_0x4f6560[_0xe630('0xf2')]-0x1){return!![];}switch(_0x1e6a23){case 0x3:if(_0x48d882[_0xe630('0xee')]>=_0x4f6560['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xe630('0xbd')]({'active':![],'countnoanswerretry':_0x48d882[_0xe630('0xee')]+=0x1,'scheduledat':moment()[_0xe630('0xf7')](_0x4f6560[_0xe630('0x1ab')],'minutes')[_0xe630('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48d882[_0xe630('0xd0')],'ListId':_0x48d882[_0xe630('0xfa')],'VoiceQueueId':_0x48d882['VoiceQueueId']||undefined,'CampaignId':_0x48d882[_0xe630('0xd3')]||undefined})['catch'](loggerCatch(_0xe630('0x1ac')));break;case 0x5:if(_0x48d882[_0xe630('0xec')]>=_0x4f6560[_0xe630('0x1ad')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x48d882[_0xe630('0xec')]+=0x1,'scheduledat':moment()[_0xe630('0xf7')](_0x4f6560['dialBusyRetryFrequency'],_0xe630('0xf8'))['format'](_0xe630('0xf9')),'ContactId':_0x48d882[_0xe630('0xd0')],'ListId':_0x48d882[_0xe630('0xfa')],'VoiceQueueId':_0x48d882[_0xe630('0xd2')]||undefined,'CampaignId':_0x48d882[_0xe630('0xd3')]||undefined})['catch'](loggerCatch(_0xe630('0x1ae')));break;case 0x8:if(_0x48d882[_0xe630('0xed')]>=_0x4f6560[_0xe630('0x1af')]-0x1){return!![];}this[_0xe630('0xbd')]({'active':![],'countcongestionretry':_0x48d882[_0xe630('0xed')]+=0x1,'scheduledat':moment()[_0xe630('0xf7')](_0x4f6560[_0xe630('0x1b0')],_0xe630('0xf8'))[_0xe630('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48d882[_0xe630('0xd0')],'ListId':_0x48d882[_0xe630('0xfa')],'VoiceQueueId':_0x48d882[_0xe630('0xd2')]||undefined,'CampaignId':_0x48d882[_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x1b1')));break;case 0x0:if(_0x48d882[_0xe630('0xef')]>=_0x4f6560[_0xe630('0x1b2')]-0x1){return!![];}else{this[_0xe630('0xbd')]({'active':![],'countnosuchnumberretry':_0x48d882[_0xe630('0xef')]+=0x1,'scheduledat':moment()[_0xe630('0xf7')](_0x4f6560[_0xe630('0x1b3')],_0xe630('0xf8'))[_0xe630('0x77')](_0xe630('0xf9')),'ContactId':_0x48d882[_0xe630('0xd0')],'ListId':_0x48d882['ListId'],'VoiceQueueId':_0x48d882[_0xe630('0xd2')]||undefined,'CampaignId':_0x48d882[_0xe630('0xd3')]||undefined})['catch'](loggerCatch(_0xe630('0x1b4')));}break;case 0xa:if(_0x48d882['countdropretry']>=_0x4f6560[_0xe630('0x119')]-0x1){return!![];}this[_0xe630('0xbd')]({'active':![],'countdropretry':_0x48d882[_0xe630('0x116')]+=0x1,'scheduledat':moment()[_0xe630('0xf7')](_0x4f6560[_0xe630('0x11b')],_0xe630('0xf8'))[_0xe630('0x77')](_0xe630('0xf9')),'ContactId':_0x48d882[_0xe630('0xd0')],'ListId':_0x48d882['ListId'],'VoiceQueueId':_0x48d882['VoiceQueueId']||undefined,'CampaignId':_0x48d882['CampaignId']||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x11c')));break;case 0xb:if(_0x48d882[_0xe630('0xf0')]>=_0x4f6560[_0xe630('0x125')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x48d882[_0xe630('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x4f6560[_0xe630('0x126')],_0xe630('0xf8'))[_0xe630('0x77')](_0xe630('0xf9')),'ContactId':_0x48d882[_0xe630('0xd0')],'ListId':_0x48d882[_0xe630('0xfa')],'VoiceQueueId':_0x48d882[_0xe630('0xd2')]||undefined,'CampaignId':_0x48d882[_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x127')));break;case 0x13:if(_0x48d882[_0xe630('0xe9')]>=_0x4f6560['dialMachineMaxRetry']-0x1){return!![];}this[_0xe630('0xbd')]({'active':![],'countmachineretry':_0x48d882[_0xe630('0xe9')]+=0x1,'scheduledat':moment()[_0xe630('0xf7')](_0x4f6560[_0xe630('0x100')],_0xe630('0xf8'))['format'](_0xe630('0xf9')),'ContactId':_0x48d882[_0xe630('0xd0')],'ListId':_0x48d882['ListId'],'VoiceQueueId':_0x48d882[_0xe630('0xd2')]||undefined,'CampaignId':_0x48d882[_0xe630('0xd3')]||undefined})['catch'](loggerCatch(_0xe630('0xfb')));break;case 0x14:if(_0x48d882['countagentrejectretry']>=_0x4f6560[_0xe630('0x1b5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x48d882[_0xe630('0xf1')]+=0x1,'scheduledat':moment()[_0xe630('0xf7')](_0x4f6560[_0xe630('0x1b6')],_0xe630('0xf8'))[_0xe630('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48d882['ContactId'],'ListId':_0x48d882[_0xe630('0xfa')],'VoiceQueueId':_0x48d882[_0xe630('0xd2')]||undefined,'CampaignId':_0x48d882[_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x1b7')));break;default:return!![];}};Dialer[_0xe630('0x1c')][_0xe630('0x1a9')]=function(_0x272a6b,_0x35922a,_0x58fe53){var _0x236871=this;var _0x1ab062=new History(_0x272a6b);var _0x2e89fc=![];var _0x2b2ca5;var _0x156cd9;return new BPromise(function(_0x2349b1,_0xe6be0f){if(_[_0xe630('0x80')](_0x35922a)&&typeof _0x35922a!=='object'){return _0xe6be0f(msgResponse('[callProgressDetecting]',_0xe630('0x14c'),_0xe630('0x1b8')));}if(_[_0xe630('0x80')](_0x58fe53)&&typeof _0x58fe53!==_0xe630('0x178')){return _0xe6be0f(msgResponse(_0xe630('0x1b9'),_0xe630('0x14c'),_0xe630('0x1ba')));}_0x236871['verifyAdditionalPhones'](_0x1ab062,_0x58fe53['reason'],_0x35922a)[_0xe630('0xb2')](function(_0x2852ac){if(_0x2852ac[_0xe630('0x118')]==0x1)_0x2e89fc=!![];switch(_0x58fe53[_0xe630('0x108')]){case'0':_0x35922a[_0xe630('0x64')]+=0x1;_0x1ab062[_0xe630('0xa7')]=0x0;_0x1ab062[_0xe630('0xe0')]=_0xe630('0x1bb');_0x1ab062[_0xe630('0xef')]+=0x1;_0x1ab062[_0xe630('0xea')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0xe630('0xe5')](_0x272a6b,_0xe630('0x1bc')));_0x2b2ca5=_0x35922a[_0xe630('0x1b3')];_0x156cd9=_0x35922a['callAdditionalPhoneAfterMin'];_0x236871[_0xe630('0xc8')](_0x1ab062)['catch'](loggerCatch(_0xe630('0xeb')));if(_0x236871[_0xe630('0x1bd')](0x0,_0x272a6b,_0x35922a)&&!_0x2e89fc){if(_0x1ab062[_0xe630('0xef')]>=_0x35922a[_0xe630('0x1b2')]){_0x236871[_0xe630('0xf5')](_0x1ab062,_0x2349b1,_0xe6be0f,'reason\x200\x20no\x20such\x20number....');}else{_0x236871[_0xe630('0xf3')](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1be'));}}break;case'3':_0x35922a[_0xe630('0x63')]+=0x1;_0x1ab062[_0xe630('0xa7')]=0x3;_0x1ab062[_0xe630('0xe0')]=_0xe630('0x1bf');_0x1ab062[_0xe630('0xee')]+=0x1;_0x1ab062[_0xe630('0xea')]+=0x1;ami[_0xe630('0x4e')]('custom:agentnoanswer',ut[_0xe630('0xe5')](_0x272a6b,_0xe630('0x1c0')));_0x2b2ca5=_0x35922a[_0xe630('0x1ab')];_0x156cd9=_0x35922a[_0xe630('0x117')];_0x236871[_0xe630('0xc8')](_0x1ab062)[_0xe630('0xac')](loggerCatch(_0xe630('0x1c1')));if(_0x236871[_0xe630('0x1bd')](0x3,_0x272a6b,_0x35922a)&&!_0x2e89fc){if(_0x1ab062[_0xe630('0xee')]>=_0x35922a['dialNoAnswerMaxRetry']){_0x236871['createStateFinal'](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1c2'));}else{_0x236871[_0xe630('0xf3')](_0x1ab062,_0x2349b1,_0xe6be0f,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x35922a[_0xe630('0x5f')]+=0x1;_0x1ab062[_0xe630('0xa7')]=0x5;_0x1ab062['statedesc']=_0xe630('0x1c3');_0x1ab062[_0xe630('0xec')]+=0x1;_0x1ab062[_0xe630('0xea')]+=0x1;ami[_0xe630('0x4e')](_0xe630('0x1c4'),ut[_0xe630('0xe5')](_0x272a6b,_0xe630('0x1c5')));_0x2b2ca5=_0x35922a[_0xe630('0x1c6')];_0x156cd9=_0x35922a[_0xe630('0x117')];_0x236871[_0xe630('0xc8')](_0x1ab062)[_0xe630('0xac')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x236871['checkRetriveMax'](0x5,_0x272a6b,_0x35922a)&&!_0x2e89fc){if(_0x1ab062[_0xe630('0xec')]>=_0x35922a[_0xe630('0x1ad')]){_0x236871['createStateFinal'](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1c7'));}else{_0x236871[_0xe630('0xf3')](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1c7'));}}break;case'8':_0x35922a[_0xe630('0x60')]+=0x1;_0x1ab062[_0xe630('0xa7')]=0x8;_0x1ab062['statedesc']=_0xe630('0x1c8');_0x1ab062[_0xe630('0xed')]+=0x1;_0x1ab062[_0xe630('0xea')]+=0x1;_0x2b2ca5=_0x35922a[_0xe630('0x1b0')];_0x156cd9=_0x35922a[_0xe630('0x117')];ami[_0xe630('0x4e')](_0xe630('0x1c9'),ut['buildObj'](_0x272a6b,_0xe630('0x1ca')));_0x236871[_0xe630('0xc8')](_0x1ab062)['catch'](loggerCatch(_0xe630('0x1cb')));if(_0x236871[_0xe630('0x1bd')](0x8,_0x272a6b,_0x35922a)&&!_0x2e89fc){if(_0x1ab062['countcongestionretry']>=_0x35922a[_0xe630('0x1af')]){_0x236871[_0xe630('0xf5')](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1cc'));}else{_0x236871['stateGlobal'](_0x1ab062,_0x2349b1,_0xe6be0f,'reason\x208\x20congestion');}}break;case'11':_0x35922a[_0xe630('0x1cd')]+=0x1;_0x1ab062[_0xe630('0xa7')]=0xb;_0x1ab062[_0xe630('0xe0')]=_0xe630('0x122');_0x1ab062[_0xe630('0xf0')]+=0x1;_0x1ab062['countglobal']+=0x1;_0x2b2ca5=_0x35922a[_0xe630('0x126')];_0x156cd9=_0x35922a[_0xe630('0x117')];_0x236871['createHistory'](_0x1ab062)[_0xe630('0xac')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x236871['checkRetriveMax'](0xb,_0x272a6b,_0x35922a)&&!_0x2e89fc){if(_0x1ab062[_0xe630('0xf0')]>=_0x35922a['dialAbandonedMaxRetry']){_0x236871['createStateFinal'](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1ce'));}else{_0x236871[_0xe630('0xf3')](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1ce'));}}break;case'20':_0x35922a['outboundRejectCallsDay']+=0x1;_0x1ab062['state']=0x14;_0x1ab062[_0xe630('0xe0')]='AgentReject';_0x1ab062[_0xe630('0xf1')]+=0x1;_0x1ab062[_0xe630('0xea')]+=0x1;_0x2b2ca5=_0x35922a[_0xe630('0x1b6')];_0x156cd9=_0x35922a[_0xe630('0x117')];ami[_0xe630('0x4e')]('custom:agentreject',ut[_0xe630('0xe5')](_0x272a6b,_0xe630('0x1cf')));_0x236871[_0xe630('0xc8')](_0x1ab062)[_0xe630('0xac')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x236871[_0xe630('0x1bd')](0x14,_0x272a6b,_0x35922a)&&!_0x2e89fc){if(_0x1ab062[_0xe630('0xf1')]>=_0x35922a[_0xe630('0x1b5')]){_0x236871[_0xe630('0xf5')](_0x1ab062,_0x2349b1,_0xe6be0f,_0xe630('0x1d0'));}else{_0x236871['stateGlobal'](_0x1ab062,_0x2349b1,_0xe6be0f,'reason\x2020\x20agentreject');}}break;default:_0x35922a[_0xe630('0x67')]+=0x1;_0x1ab062[_0xe630('0xa7')]=0xc;_0x1ab062['statedesc']=_0x58fe53['reason'];_0x2b2ca5=_0x35922a[_0xe630('0x1b6')];_0x156cd9=_0x35922a[_0xe630('0x117')];_0x236871[_0xe630('0xc8')](_0x1ab062)[_0xe630('0xac')](loggerCatch(_0xe630('0x1d1')));if(_0x236871[_0xe630('0x1bd')](_0x58fe53[_0xe630('0x108')],_0x272a6b,_0x35922a)&&!_0x2e89fc){if(_0x1ab062['countbusyretry']+_0x1ab062[_0xe630('0xed')]+_0x1ab062[_0xe630('0xee')]+_0x1ab062[_0xe630('0xef')]+_0x1ab062[_0xe630('0x116')]+_0x1ab062['countabandonedretry']+_0x1ab062[_0xe630('0xe9')]+_0x1ab062[_0xe630('0xf1')]>=_0x35922a['dialGlobalMaxRetry']){_0x236871['stateGlobal'](_0x1ab062,_0x2349b1,_0xe6be0f,_0x58fe53[_0xe630('0x108')]);}else{_0x236871[_0xe630('0xf5')](_0x1ab062,_0x2349b1,_0xe6be0f,_0x58fe53[_0xe630('0x108')]);}}}})[_0xe630('0xb2')](function(_0x500bdf){if(_0x2e89fc){_0x236871['swapAdditionalPhones'](_0x1ab062,_0x2b2ca5,_0x156cd9)[_0xe630('0xb2')](function(_0xc67cc3){return _0x2349b1(0x1);});}});});};Dialer[_0xe630('0x1c')][_0xe630('0xf3')]=function(_0x5d163b,_0xab2857,_0x15a1b7,_0x1d6b1c){var _0x5ee558=new Final(_0x5d163b);_0x5ee558['state']=0xf;_0x5ee558[_0xe630('0xe0')]=_0xe630('0x1d2');this[_0xe630('0xf5')](_0x5ee558,_0xab2857,_0x15a1b7,_0x1d6b1c);};Dialer[_0xe630('0x1c')]['createStateFinal']=function(_0x327f2a,_0x9feeaa,_0x19f60d,_0x5cac0b){this[_0xe630('0xc6')](_0x327f2a)[_0xe630('0xb2')](function(){return _0x9feeaa(msgResponse(_0xe630('0x1b9'),_0xe630('0xd5'),_0x5cac0b));})[_0xe630('0xac')](function(){return _0x19f60d(msgResponse('[moveContactManagedDialer][0]',_0xe630('0x14c'),'contact\x20not\x20moved'));});};Dialer[_0xe630('0x1c')][_0xe630('0x166')]=function(_0x59fcb9){var _0x1788e0=_0x59fcb9[_0xe630('0x1d3')]/0x64;var _0x58a096=_0x59fcb9['outboundDropCallsDayTimeout']/(_0x59fcb9[_0xe630('0x62')]+_0x59fcb9[_0xe630('0x5e')]);var _0x5ab9e7=Math[_0xe630('0x1d4')](_0x59fcb9[_0xe630('0x6e')]*(_0x59fcb9[_0xe630('0x1d5')]/0x64));var _0x21d78b=Math['round'](_0x59fcb9['predictiveIntervalAvailable']*(_0x59fcb9['predictiveIntervalMinThreshold']/0x64));var _0x4cf109=_0x59fcb9[_0xe630('0xa1')]+_0x59fcb9['talking'];var _0x11c5cd=Math[_0xe630('0x1d6')](_0x59fcb9['erlangCalls']*_0x59fcb9[_0xe630('0x88')]*_0x59fcb9[_0xe630('0x1d7')]*_0x59fcb9[_0xe630('0x6d')]);if(_[_0xe630('0x80')](_0x59fcb9['startProgressive'])){if(!_[_0xe630('0x80')](_0x59fcb9[_0xe630('0x8b')])){_0x59fcb9[_0xe630('0x8b')]=undefined;loggerPredictive[_0xe630('0x95')]('[startMethodPredictive][StartProgressive]',_0xe630('0x1d8'));}if(!_[_0xe630('0x80')](_0x59fcb9[_0xe630('0x8d')])){loggerPredictive[_0xe630('0x95')]('[startMethodPredictive][StartProgressive]',_0xe630('0x1d9'));clearInterval(_0x59fcb9[_0xe630('0x8d')]);_0x59fcb9['handlePredictive']=undefined;}_0x59fcb9[_0xe630('0x2c')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));loggerPredictive['info'](_0x59fcb9[_0xe630('0x42')],_0xe630('0x1da'),_0x59fcb9['startProgressive']);this[_0xe630('0x164')](_0x59fcb9,0x1);}else if(ifInterval(_0x59fcb9[_0xe630('0x1db')],_0x59fcb9[_0xe630('0x2c')])){this['handlePower'](_0x59fcb9,0x1);loggerPredictiveCalls[_0xe630('0x78')]('[startMethodPredictive][StartProgressive][Loop]',_0x59fcb9[_0xe630('0x2c')],_0x59fcb9['name']);_0x59fcb9[_0xe630('0x71')]=0x0;_0x59fcb9['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1788e0<_0x58a096&&_0x59fcb9[_0xe630('0x1dc')]===_0xe630('0x1dd')){freeVariablesPredictive(_0x59fcb9);loggerPredictive[_0xe630('0x78')](_0xe630('0x1de'),'Dropped\x20calls\x20day',_0x58a096,_0xe630('0x2c'),_0x59fcb9[_0xe630('0x42')]);}else if(_0x11c5cd<_0x59fcb9[_0xe630('0x6c')]&&_0x59fcb9[_0xe630('0x1dc')]===_0xe630('0x1dd')){freeVariablesPredictive(_0x59fcb9);loggerPredictive[_0xe630('0x78')](_0xe630('0x1df'),_0xe630('0x1e0'),_0x11c5cd,'Drop\x20in\x20this\x20interval',_0x59fcb9[_0xe630('0x6c')],'startProgressive',_0x59fcb9[_0xe630('0x42')]);}else if(!ifInterval(_0x59fcb9[_0xe630('0x1db')],_0x59fcb9[_0xe630('0x2c')])&&_['isUndefined'](_0x59fcb9[_0xe630('0x8b')])&&!_[_0xe630('0x80')](_0x59fcb9[_0xe630('0x2c')])){_0x59fcb9[_0xe630('0x8b')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));loggerPredictive[_0xe630('0x78')](_0x59fcb9[_0xe630('0x42')],'started\x20in\x20predictive\x20at',_0x59fcb9[_0xe630('0x8b')]);this[_0xe630('0xbb')](_0x59fcb9[_0xe630('0x1db')])[_0xe630('0xb2')](this[_0xe630('0x1e1')](_0x59fcb9))['then'](mergeDataErlangB(_0x59fcb9))[_0xe630('0xb2')](this[_0xe630('0x1e2')](_0x59fcb9))[_0xe630('0xac')](loggerCatchPredictive(_0xe630('0x1e3'),_0x59fcb9));}else if(!ifInterval(_0x59fcb9['dialPredictiveInterval'],_0x59fcb9[_0xe630('0x8b')])){_0x59fcb9[_0xe630('0x6c')]=0x0;_0x59fcb9[_0xe630('0x8b')]=moment()[_0xe630('0x77')](_0xe630('0xf9'));loggerPredictive[_0xe630('0x78')](_0x59fcb9[_0xe630('0x42')],_0xe630('0x1e4'),_0x59fcb9['startPredictive']);clearInterval(_0x59fcb9['handlePredictive']);_0x59fcb9[_0xe630('0x8d')]=undefined;this['averageHandleTime'](_0x59fcb9[_0xe630('0x1db')])[_0xe630('0xb2')](this[_0xe630('0x1e1')](_0x59fcb9))['then'](mergeDataErlangB(_0x59fcb9))['then'](this[_0xe630('0x1e2')](_0x59fcb9))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x59fcb9));}else if(_0x59fcb9[_0xe630('0x6e')]&&_0x4cf109<_0x59fcb9[_0xe630('0x6e')]-_0x21d78b){freeVariablesPredictive(_0x59fcb9);loggerPredictive['info'](_0x59fcb9[_0xe630('0x42')],_0xe630('0x1e5'),_0x4cf109,_0xe630('0x1e6'),_0x59fcb9[_0xe630('0x6e')],'-',_0x21d78b,'=',_0x59fcb9[_0xe630('0x6e')]-_0x21d78b,')');}else if(_0x59fcb9[_0xe630('0x6e')]&&_0x4cf109>_0x59fcb9['predictiveIntervalAvailable']+_0x5ab9e7){freeVariablesPredictive(_0x59fcb9);loggerPredictive[_0xe630('0x78')](_0x59fcb9[_0xe630('0x42')],_0xe630('0x1e5'),_0x4cf109,_0xe630('0x1e7'),_0x59fcb9[_0xe630('0x6e')],'+',_0x5ab9e7,'=',_0x59fcb9[_0xe630('0x6e')]+_0x5ab9e7,')');}};Dialer['prototype'][_0xe630('0x1e1')]=function(_0x501ba8){var _0x46b256=this;return function(_0x3565b7){return new BPromise(function(_0x493e3d,_0x192548){_[_0xe630('0x89')](_0x501ba8,_0x3565b7[0x0]);if(checkGetDataPredictive(_0x3565b7[0x0])){var _0x3cafaa=_0x501ba8[_0xe630('0x6e')]=_0x501ba8[_0xe630('0x1e8')]+_0x501ba8[_0xe630('0xa1')];var _0x10a608=_0x501ba8[_0xe630('0x1db')]*0x3c;var _0x3b90e5=_0x3565b7[0x0][_0xe630('0x69')]+_0x3565b7[0x0]['predictiveIntervalAvgHoldtime'];var _0xc53c7b=(_0x3565b7[0x0][_0xe630('0x7a')]+_0x3565b7[0x0][_0xe630('0x6b')]+_0x3565b7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3565b7[0x0]['predictiveIntervalTotalCalls'];_0x501ba8[_0xe630('0x1d7')]=_0xc53c7b>0x0?_0xc53c7b:0x1;switch(_0x501ba8['dialPredictiveOptimization']){case _0xe630('0x1dd'):var _0x586b2b=_0x501ba8[_0xe630('0x1d3')]/0x64;return _0x46b256[_0xe630('0x1e9')](_0x3cafaa,_0x10a608,_0x3b90e5,_0xc53c7b,_0x586b2b)[_0xe630('0xb2')](function(_0x24b792){return _0x493e3d(_0x24b792);});case _0xe630('0x1ea'):var _0x5f3ba8=_0x501ba8['dialPredictiveOptimizationPercentage']/0x64;return _0x46b256[_0xe630('0x1eb')](_0x3cafaa,_0x10a608,_0x3b90e5,_0xc53c7b,_0x5f3ba8)['then'](function(_0x1ed10a){return _0x493e3d(_0x1ed10a);});default:return _0x192548(msgResponse(_0xe630('0x1ec'),_0xe630('0x14c'),_0xe630('0x1ed')));}}else{return _0x192548(msgResponse(_0xe630('0x1ec'),_0xe630('0x14c'),_0xe630('0x1ee')));}});};};Dialer[_0xe630('0x1c')]['getDataPredictiveOld']=function(_0x3e73a5){var _0x1d4638=this;return function(_0xc8bf34){return new BPromise(function(_0x485a74,_0x48e1bb){_[_0xe630('0x89')](_0x3e73a5,_0xc8bf34[0x0]);if(checkGetDataPredictive(_0xc8bf34[0x0])){loggerPredictive[_0xe630('0x78')](JSON[_0xe630('0x130')](_0xc8bf34[0x0]));if(_0x3e73a5['dialPredictiveOptimization']===_0xe630('0x1dd')){return _0x1d4638[_0xe630('0xc4')](_0x3e73a5['id'])['then'](function(_0x29b3e7){var _0x26bd91=_0x3e73a5[_0xe630('0x16a')]-_0x29b3e7[0x0][_0xe630('0x1ef')];var _0x222af8=_0x3e73a5[_0xe630('0x1db')]*0x3c;var _0x46ab72=_0xc8bf34[0x0][_0xe630('0x69')]+_0xc8bf34[0x0][_0xe630('0x68')];var _0x4670af=(_0xc8bf34[0x0]['predictiveIntervalAnsweredCalls']+_0xc8bf34[0x0][_0xe630('0x6b')]+_0xc8bf34[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xc8bf34[0x0]['predictiveIntervalTotalCalls'];var _0x5a82fe=_0x3e73a5[_0xe630('0x1d3')]/0x64;_0x3e73a5['predictiveIntervalPauses']=_0x29b3e7[0x0][_0xe630('0x1ef')]||0x0;_0x3e73a5[_0xe630('0x1d7')]=_0x4670af>0x0?_0x4670af:0x1;return _0x1d4638[_0xe630('0x1e9')](_0x26bd91,_0x222af8,_0x46ab72,_0x4670af,_0x5a82fe);})[_0xe630('0xb2')](function(_0x148a1f){return _0x485a74(_0x148a1f);})[_0xe630('0xac')](function(_0x24df20){return _0x48e1bb(msgResponse(_0xe630('0x1f0'),'Failure',JSON[_0xe630('0x130')](_0x24df20)));});}if(_0x3e73a5[_0xe630('0x1dc')]===_0xe630('0x1ea')){return _0x1d4638['getVoiceQueueRtPauses'](_0x3e73a5['id'])[_0xe630('0xb2')](function(_0x284766){var _0x7647f3=_0x3e73a5[_0xe630('0x16a')]-_0x284766[0x0][_0xe630('0x1ef')];var _0x47ea68=_0x3e73a5[_0xe630('0x1db')]*0x3c;var _0x135a52=_0xc8bf34[0x0][_0xe630('0x69')]+_0xc8bf34[0x0][_0xe630('0x68')];var _0xa0dd77=(_0xc8bf34[0x0][_0xe630('0x7a')]+_0xc8bf34[0x0][_0xe630('0x6b')]+_0xc8bf34[0x0][_0xe630('0x6a')])/_0xc8bf34[0x0][_0xe630('0x6f')];var _0x22eead=_0x3e73a5[_0xe630('0x1d3')]/0x64;_0x3e73a5[_0xe630('0x1f1')]=_0x284766[0x0]['outboundQueuePauses']||0x0;_0x3e73a5['predictiveIntervalHitRate']=_0xa0dd77>0x0?_0xa0dd77:0x1;return _0x1d4638['busyFactor'](_0x7647f3,_0x47ea68,_0x135a52,_0xa0dd77,_0x22eead);})[_0xe630('0xb2')](function(_0x4667f0){return _0x485a74(_0x4667f0);})['catch'](function(_0x3615ba){return _0x48e1bb(msgResponse(_0xe630('0x1f0'),'Failure',JSON[_0xe630('0x130')](_0x3615ba)));});}}else{return _0x48e1bb(msgResponse(_0xe630('0x1ec'),_0xe630('0x14c'),_0xe630('0x1ee')));}});};};Dialer[_0xe630('0x1c')][_0xe630('0x1e2')]=function(_0x191024){var _0x5addfa=this;return function(){var _0x3c7c45=0x0;var _0x48bca3=Math[_0xe630('0x1d6')](_0x191024['erlangCallToSecond']*0x3e8);if(_0x48bca3>0x0){_0x48bca3=_0x48bca3<0x64?0x64:_0x48bca3;loggerPredictive[_0xe630('0x78')](_0x191024[_0xe630('0x42')],'one\x20call\x20every:',_0x48bca3,_0xe630('0x4b'));_0x191024['handlePredictive']=setInterval(function(){_0x5addfa[_0xe630('0x8d')](_0x191024);loggerPredictiveCalls[_0xe630('0x78')](_0xe630('0x1f2'),_0x3c7c45+=0x1);},_0x48bca3);}else{loggerPredictive[_0xe630('0x78')](_0x191024['name'],_0xe630('0x1f3'));}};};Dialer[_0xe630('0x1c')][_0xe630('0x1f4')]=function(_0x8fdcde,_0x248672){var _0x3b55a9=this;return function(_0x52118f){if(_[_0xe630('0x4a')](_0x52118f)){if(_[_0xe630('0xda')](_0x248672['UserId'])||!_0x248672['recallme']){if(_0x8fdcde[_0xe630('0x59')]===_0xe630('0x7')){_0x8fdcde['queueStatusComplete']=_[_0xe630('0x80')](_0x8fdcde[_0xe630('0x12d')])?!![]:_0x8fdcde[_0xe630('0x12d')];var _0x421795=uuid['v4']();_0x3b55a9[_0xe630('0x28')][_0x421795]=new Action(_0x8fdcde,_0x248672,_0x421795);loggerBooked[_0xe630('0x78')](_0xe630('0x1f5'),_0x421795,_0xe630('0x1f6'),JSON[_0xe630('0x130')](_0x8fdcde[_0xe630('0x12d')]),'Queue:\x20',_0x8fdcde[_0xe630('0x42')]);if(_0x8fdcde[_0xe630('0x12d')]){_0x8fdcde[_0xe630('0x12d')]=![];_0x3b55a9[_0xe630('0x2e')][_0x3b55a9[_0xe630('0x28')][_0x421795]['queue']]=[];ami[_0xe630('0x153')]({'actionid':_0x421795,'action':'queuestatus','queue':_0x8fdcde[_0xe630('0x42')]})[_0xe630('0xac')](function(){_0x3b55a9[_0xe630('0xae')](_0x8fdcde);_0x3b55a9[_0xe630('0xbd')]({'active':![],'ContactId':_0x3b55a9[_0xe630('0x28')][_0x421795][_0xe630('0xd0')],'ListId':_0x3b55a9[_0xe630('0x28')][_0x421795][_0xe630('0xfa')],'VoiceQueueId':_0x3b55a9[_0xe630('0x28')][_0x421795][_0xe630('0xd2')]||undefined,'CampaignId':_0x3b55a9[_0xe630('0x28')][_0x421795][_0xe630('0xd3')]||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x1f7')));delete _0x3b55a9[_0xe630('0x28')][_0x421795];});}else{loggerBooked[_0xe630('0x78')](_0xe630('0x1f8'),JSON[_0xe630('0x130')](_0x8fdcde[_0xe630('0x12d')]),'Queue:\x20',_0x8fdcde[_0xe630('0x42')]);_0x3b55a9[_0xe630('0xae')](_0x8fdcde);_0x3b55a9[_0xe630('0xbd')]({'active':![],'ContactId':_0x3b55a9[_0xe630('0x28')][_0x421795][_0xe630('0xd0')],'ListId':_0x3b55a9[_0xe630('0x28')][_0x421795]['ListId'],'VoiceQueueId':_0x3b55a9[_0xe630('0x28')][_0x421795][_0xe630('0xd2')]||undefined,'CampaignId':_0x3b55a9[_0xe630('0x28')][_0x421795]['CampaignId']||undefined})[_0xe630('0xac')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3b55a9[_0xe630('0x28')][_0x421795];}}else{return _0x3b55a9[_0xe630('0x1f9')](_0x8fdcde,_0x248672);}}else{if(getDiff(_0x248672[_0xe630('0x1fa')])<_0x8fdcde[_0xe630('0x1fb')]*0x3c){if(_0x248672[_0xe630('0x1fc')]&&!_0x248672[_0xe630('0x1fc')][_0xe630('0x1fd')]){_0x3b55a9[_0xe630('0x21')][_0xe630('0x131')](_0x248672['id'])[_0xe630('0x1f')](function(){_0x3b55a9['updateOriginated'](_0x8fdcde);});}else{_0x3b55a9[_0xe630('0xbf')]({'active':![]},_0x248672['id'],0x1)['finally'](function(){_0x3b55a9[_0xe630('0xae')](_0x8fdcde);});}}else{_0x8fdcde[_0xe630('0x65')]+=0x1;_0x3b55a9[_0xe630('0xae')](_0x8fdcde);if(_0x8fdcde['dialRecallInQueue']){_0x3b55a9[_0xe630('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x248672[_0xe630('0xd0')],'ListId':_0x248672[_0xe630('0xfa')],'VoiceQueueId':_0x248672[_0xe630('0xd2')]||undefined,'CampaignId':_0x248672['CampaignId']||undefined})[_0xe630('0xac')](loggerCatch(_0xe630('0x1fe')));_0x3b55a9[_0xe630('0xc8')](createObjHistory(_0x8fdcde,_0x248672,'RECALLINQUEUE',0x17,_0xe630('0x1ff')))[_0xe630('0xac')](loggerCatch(_0xe630('0x200')));}else{_0x3b55a9[_0xe630('0xce')](createObjHistory(_0x8fdcde,_0x248672,'RECALLFAILEDTIMEOUT',0x16,_0xe630('0x201')),'[Originate][HistoryRecallClose][historyCatch]',_0xe630('0x202'));}}}}else{_0x8fdcde['outboundBlacklistCallsDay']+=0x1;_0x3b55a9[_0xe630('0xce')](createObjHistory(_0x8fdcde,_0x248672,'BLACKLIST',0xd,'Blacklist'),'[Originate][historyBlacklist]',_0xe630('0x203'));throw _0xe630('0x204');}};};Dialer[_0xe630('0x1c')][_0xe630('0x205')]=function(_0x4e62c0){var _0x7e0dcd=this;var _0x3afcb8=_0x4e62c0['limitCalls']-_0x4e62c0['originated']-_0x4e62c0[_0xe630('0xc2')];emitCampaignSummary(_0x4e62c0);if(_0x3afcb8>0x0){if(_0x3afcb8>this[_0xe630('0x26')]){_0x3afcb8=this['maxNumberOriginate'];}_0x4e62c0[_0xe630('0xc2')]+=_0x3afcb8;this[_0xe630('0xc3')](_0x4e62c0['id'],_0x3afcb8,_0x4e62c0['dialOrderByScheduledAt'],_0x4e62c0)['then'](function(_0x42eca4){_0x4e62c0[_0xe630('0xc2')]-=_0x3afcb8;_0x4e62c0['temp']=_0x4e62c0[_0xe630('0xc2')]>0x0?_0x4e62c0[_0xe630('0xc2')]:0x0;if(!checkContactEmpty(_0x42eca4)){_0x4e62c0[_0xe630('0x40')]=_0xe630('0x9e');logger[_0xe630('0x78')](_0xe630('0x206')+_0x4e62c0['name']);}else{_0x4e62c0[_0xe630('0x70')]+=_0x42eca4['length'];_0x4e62c0['message']=_0xe630('0x207');for(var _0x34dc78=0x0;_0x34dc78<_0x42eca4[_0xe630('0x137')];_0x34dc78+=0x1){_0x4e62c0[_0xe630('0x208')]+=0x1;if(_['isNil'](_0x42eca4[_0x34dc78])||_[_0xe630('0xda')](_0x42eca4[_0x34dc78][_0xe630('0x191')])||_['isNil'](_0x42eca4[_0x34dc78][_0xe630('0x17b')])){_0x7e0dcd[_0xe630('0x209')]('[actionOriginate]\x20',_0x4e62c0,_0x42eca4[_0x34dc78]);}else{_0x7e0dcd[_0xe630('0xb9')](_[_0xe630('0xcf')](_0x42eca4[_0x34dc78],[_0xe630('0xd3'),'Contact.phone']))[_0xe630('0xb2')](_0x7e0dcd[_0xe630('0x1f4')](_0x4e62c0,_0x42eca4[_0x34dc78]))['catch'](_0x7e0dcd[_0xe630('0xcc')](_0xe630('0x20a'),_0x4e62c0));}}}})[_0xe630('0xac')](loggerGetContactDialer(_0xe630('0x20b'),_0x4e62c0,_0x3afcb8));}};Dialer[_0xe630('0x1c')][_0xe630('0x164')]=function(_0x5a977c,_0x106176){var _0x4e2a2a=this;var _0x39f034=[];var _0x55208d=_0x106176>=0x1?_0x106176:0x1;if(_0x5a977c['dialMethod']===_0xe630('0x7')){_0x55208d=0x1;}var _0x4aa904=Math['floor'](_0x5a977c[_0xe630('0xa1')]*_0x55208d)-_0x5a977c[_0xe630('0x70')]-_0x5a977c[_0xe630('0xc2')];emitVoiceQueueSummary(_0x5a977c);if(_0x5a977c['dialLimitQueue']>0x0){var _0x4f5b3c=_0x5a977c['dialLimitQueue']-_0x5a977c[_0xe630('0x70')]-_0x5a977c['talking']-_0x5a977c[_0xe630('0xc2')]-_0x5a977c[_0xe630('0xa0')];if(_0x4aa904>_0x4f5b3c){_0x4aa904=_0x4f5b3c;}}if(_0x4aa904>0x0){if(_0x5a977c[_0xe630('0x59')]===_0xe630('0x7')){_0x4aa904=0x1;}if(_0x4aa904>this[_0xe630('0x26')]){_0x4aa904=this[_0xe630('0x26')];}_0x5a977c[_0xe630('0xc2')]+=_0x4aa904;for(var _0x5b92b0 in this['agents']){if(typeof this['agents'][_0x5b92b0]!==_0xe630('0x97')){if(this[_0xe630('0x24')][_0x5b92b0][_0xe630('0xa7')]===_0xe630('0x20c')&&this['agents'][_0x5b92b0]['status']===_0xe630('0xd8')){_0x39f034[_0xe630('0x15a')](this['agents'][_0x5b92b0]['id']);}}}this[_0xe630('0xc1')](_0x5a977c['id'],_0x39f034,_0x4aa904,_0x5a977c[_0xe630('0x20d')],_0x5a977c)[_0xe630('0xb2')](function(_0xa9f1a4){_0x5a977c[_0xe630('0xc2')]-=_0x4aa904;_0x5a977c[_0xe630('0xc2')]=_0x5a977c[_0xe630('0xc2')]>0x0?_0x5a977c[_0xe630('0xc2')]:0x0;if(!checkContactEmpty(_0xa9f1a4)){_0x4e2a2a[_0xe630('0xb3')](_0x5a977c)[_0xe630('0xb2')](sendMessageReschedule(_0x5a977c))[_0xe630('0xac')](loggerCatch('[countReScheduled]\x20'));}else{_0x5a977c['originated']+=_0xa9f1a4[_0xe630('0x137')];_0x5a977c[_0xe630('0x40')]=_0x5a977c[_0xe630('0x59')]==='booked'?_0xe630('0x181'):_0xe630('0x207');for(var _0x3ecb5d=0x0;_0x3ecb5d<_0xa9f1a4[_0xe630('0x137')];_0x3ecb5d+=0x1){if(_['isNil'](_0xa9f1a4[_0x3ecb5d])||_[_0xe630('0xda')](_0xa9f1a4[_0x3ecb5d][_0xe630('0x191')])||_[_0xe630('0xda')](_0xa9f1a4[_0x3ecb5d][_0xe630('0x17b')])){_0x4e2a2a['emptyContact'](_0xe630('0x20e'),_0x5a977c,_0xa9f1a4[_0x3ecb5d]);}else{_0x4e2a2a[_0xe630('0x20f')](_['pick'](_0xa9f1a4[_0x3ecb5d],[_0xe630('0xd2'),'Contact.phone']))[_0xe630('0xb2')](_0x4e2a2a['checkContactBlack'](_0x5a977c,_0xa9f1a4[_0x3ecb5d]))[_0xe630('0xac')](_0x4e2a2a[_0xe630('0xcc')](_0xe630('0x20e'),_0x5a977c));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x5a977c,_0x4aa904));}};Dialer['prototype'][_0xe630('0x8d')]=function(_0x24e760){if(_0x24e760[_0xe630('0x210')]>0x0){var _0x32ed9b=_0x24e760['dialLimitQueue']-_0x24e760[_0xe630('0x70')]-_0x24e760[_0xe630('0x1e8')];if(_0x32ed9b>0x0){this[_0xe630('0x211')](_0x24e760);}else{loggerPredictiveCalls[_0xe630('0x78')](_0xe630('0x212'));}}else{this[_0xe630('0x211')](_0x24e760);}};Dialer[_0xe630('0x1c')][_0xe630('0x211')]=function(_0x4624cd){var _0x8e8a0d=this;var _0x53dfa9=[];_0x4624cd[_0xe630('0x70')]+=0x1;for(var _0xa3274d in this[_0xe630('0x24')]){if(typeof this['agents'][_0xa3274d]!=='undefined'){if(this[_0xe630('0x24')][_0xa3274d][_0xe630('0xa7')]===_0xe630('0x20c')&&this[_0xe630('0x24')][_0xa3274d][_0xe630('0xaa')]===_0xe630('0xd8')){_0x53dfa9['push'](this[_0xe630('0x24')][_0xa3274d]['id']);}}}this[_0xe630('0xc1')](_0x4624cd['id'],_0x53dfa9,0x1,_0x4624cd['dialOrderByScheduledAt'],_0x4624cd)[_0xe630('0xb2')](function(_0x45485c){if(!checkContactEmpty(_0x45485c)){checkContactLowerLimitOriginate(_0x4624cd,0x1,0x0);_0x8e8a0d['countReScheduled'](_0x4624cd)['then'](sendMessageReschedule(_0x4624cd))[_0xe630('0xac')](loggerCatch(_0xe630('0x213')));}else{_0x4624cd[_0xe630('0x40')]='RUNNING';if(_[_0xe630('0xda')](_0x45485c[0x0])||_[_0xe630('0xda')](_0x45485c[0x0]['Contact'])||_[_0xe630('0xda')](_0x45485c[0x0]['phone'])){_0x8e8a0d[_0xe630('0x209')]('[actionOriginate]\x20',_0x4624cd,_0x45485c[0x0]);}else{_0x8e8a0d[_0xe630('0x20f')](_[_0xe630('0xcf')](_0x45485c[0x0],[_0xe630('0xd2'),'Contact.phone']))[_0xe630('0xb2')](_0x8e8a0d[_0xe630('0x1f4')](_0x4624cd,_0x45485c[0x0]))['catch'](_0x8e8a0d[_0xe630('0xcc')](_0xe630('0x214'),_0x4624cd));}}})[_0xe630('0xac')](loggerGetContactDialer(_0xe630('0x215'),_0x4624cd,0x1));emitVoiceQueueSummary(_0x4624cd);};Dialer[_0xe630('0x1c')][_0xe630('0x1e9')]=function(_0x7cbcfe,_0x17c770,_0x4f2fc8,_0x48b1a2,_0x67a604,_0x23130d){loggerPredictive[_0xe630('0x78')](_0xe630('0x216'));loggerPredictive[_0xe630('0x78')]('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',_0x7cbcfe);loggerPredictive[_0xe630('0x78')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17c770);loggerPredictive[_0xe630('0x78')](_0xe630('0x217'),_0x4f2fc8);loggerPredictive['info'](_0xe630('0x218'),_0x48b1a2);loggerPredictive[_0xe630('0x78')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x67a604);loggerPredictive[_0xe630('0x78')](_0xe630('0x7f'));return new BPromise(function(_0x45317b,_0x4acca9){if(_0x7cbcfe<=0x0||isNaN(_0x7cbcfe)){return _0x4acca9(msgResponse('[abandonmentRate]','Error',_0xe630('0x219')+_0x7cbcfe));}if(_0x4f2fc8<=0x0||isNaN(_0x4f2fc8)){return _0x4acca9(msgResponse(_0xe630('0x21a'),_0xe630('0x1a4'),'Ts\x20=\x20'+_0x4f2fc8));}if(_0x48b1a2<=0x0||isNaN(_0x48b1a2)){return _0x4acca9(msgResponse(_0xe630('0x21a'),_0xe630('0x1a4'),_0xe630('0x21b')+_0x48b1a2));}if(_0x17c770<=0x0||isNaN(_0x17c770)){return _0x4acca9(msgResponse(_0xe630('0x21a'),_0xe630('0x1a4'),_0xe630('0x21c')+_0x17c770));}if(_0x67a604<=0x0||isNaN(_0x67a604)){return _0x4acca9(msgResponse(_0xe630('0x21a'),_0xe630('0x1a4'),_0xe630('0x21d')+_0x67a604));}_0x23130d=_0x23130d||0x0;var _0x2eb35f=0x1/_0x4f2fc8;var _0x389776=0x0;var _0x10dedb=0x0;var _0x4fc6d8=0x0;var _0x138ddc=0x0;for(var _0x4823e5=0x0;_0x4fc6d8<_0x67a604;_0x4823e5+=0x1){_0x10dedb=_0x4823e5/_0x17c770;_0x389776=(_0x48b1a2*_0x10dedb+_0x23130d)/_0x2eb35f;_0x4fc6d8=erlangb(_0x389776,_0x7cbcfe);_0x138ddc=_0x389776/_0x7cbcfe*(0x1-erlangb(_0x389776,_0x7cbcfe));}return _0x45317b({'erlangCalls':_0x4823e5,'erlangCallToSecond':_0x17c770/_0x4823e5,'erlangAbandonmentRate':_0x4fc6d8,'erlangBusyFactor':_0x138ddc});});};Dialer[_0xe630('0x1c')]['busyFactor']=function(_0x3b7a28,_0x86bb60,_0x4159af,_0x5e9c11,_0x2f44c1,_0x47ae91){loggerPredictive[_0xe630('0x78')](_0xe630('0x21e'));loggerPredictive[_0xe630('0x78')](_0xe630('0x21f'),_0x3b7a28);loggerPredictive[_0xe630('0x78')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x86bb60);loggerPredictive[_0xe630('0x78')](_0xe630('0x217'),_0x4159af);loggerPredictive[_0xe630('0x78')]('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',_0x5e9c11);loggerPredictive[_0xe630('0x78')](_0xe630('0x220'),_0x2f44c1);loggerPredictive[_0xe630('0x78')](_0xe630('0x7f'));return new BPromise(function(_0x1f9315,_0x4d2cff){if(_0x3b7a28<=0x0||isNaN(_0x3b7a28)){return _0x4d2cff(msgResponse('[busyFactor]',_0xe630('0x1a4'),'m\x20=\x20'+_0x3b7a28));}if(_0x4159af<=0x0||isNaN(_0x4159af)){return _0x4d2cff(msgResponse(_0xe630('0x221'),_0xe630('0x1a4'),_0xe630('0x222')+_0x4159af));}if(_0x5e9c11<=0x0||isNaN(_0x5e9c11)){return _0x4d2cff(msgResponse('[busyFactor]',_0xe630('0x1a4'),_0xe630('0x21b')+_0x5e9c11));}if(_0x86bb60<=0x0||isNaN(_0x86bb60)){return _0x4d2cff(msgResponse(_0xe630('0x221'),'Error',_0xe630('0x21c')+_0x86bb60));}if(_0x2f44c1<=0x0||isNaN(_0x2f44c1)){return _0x4d2cff(msgResponse(_0xe630('0x221'),'Error','Umin\x20=\x20'+_0x2f44c1));}_0x47ae91=_0x47ae91||0x0;var _0x4b8610=0x1/_0x4159af;var _0x14f641=0x0;var _0x2f1ec1=0x0;var _0x1815a3=0x0;var _0x3c4a7c=0x0;for(var _0x1fbcfb=0x0;_0x3c4a7c<_0x2f44c1;_0x1fbcfb+=0x1){_0x2f1ec1=_0x1fbcfb/_0x86bb60;_0x14f641=(_0x5e9c11*_0x2f1ec1+_0x47ae91)/_0x4b8610;_0x1815a3=erlangb(_0x14f641,_0x3b7a28);_0x3c4a7c=_0x14f641/_0x3b7a28*(0x1-erlangb(_0x14f641,_0x3b7a28));}return _0x1f9315({'erlangCalls':_0x1fbcfb,'erlangCallToSecond':_0x86bb60/_0x1fbcfb,'erlangAbandonmentRate':_0x1815a3,'erlangBusyFactor':_0x3c4a7c});});};module[_0xe630('0x223')]=Dialer; \ No newline at end of file +var _0xfb3f=['interval','content','indexOf','true','push','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','dialMethod','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','floor','erlangCalls','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','util','lodash','uuid','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/setting','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','diff','seconds','type','outbound','answered','available','pTalking','sumBillable','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','md5','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\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','startPredictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','clearZombieChannels','[uniqueid]','[actions]','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','SIP/%s','status','reachable','unmonitored','syncVarSet','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','uniqueid','outboundAnswerCallsDay','membername','AMD','emit','custom:amd','buildObj','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countglobal','amd','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','createStateFinal','reason\x2019\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countbusyretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','syncAgentComplete','agent','agiafterat','dialQueueProject2','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','endtime','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','actionid','strategy','paused','stateinterface','locked','queueBooked','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','_rr','[booked][RR]','Agent:\x20','unlockRR','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','INTERVAL_IS_NULL','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Failure','isArray','Action','command','iftime\x20%s,%s'];(function(_0x3e2ec1,_0x52e5f1){var _0x22eef8=function(_0x4b9555){while(--_0x4b9555){_0x3e2ec1['push'](_0x3e2ec1['shift']());}};_0x22eef8(++_0x52e5f1);}(_0xfb3f,0xd9));var _0xffb3=function(_0x534197,_0x553f50){_0x534197=_0x534197-0x0;var _0x4b8005=_0xfb3f[_0x534197];return _0x4b8005;};'use strict';var util=require(_0xffb3('0x0'));var _=require(_0xffb3('0x1'));var BPromise=require('bluebird');var uuid=require(_0xffb3('0x2'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0xffb3('0x3'));var ut=require('../preview/util/util');var config=require(_0xffb3('0x4'));var logger=require(_0xffb3('0x5'))(_0xffb3('0x6'));var loggerBooked=require(_0xffb3('0x5'))(_0xffb3('0x7'));var loggerPredictive=require(_0xffb3('0x5'))(_0xffb3('0x8'));var loggerPredictiveCalls=require(_0xffb3('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xffb3('0x5'))(_0xffb3('0x9'));var ami=require(_0xffb3('0xa'));config[_0xffb3('0xb')]=_[_0xffb3('0xc')](config['redis'],{'host':_0xffb3('0xd'),'port':0x18eb});var io=require(_0xffb3('0xe'))(new Redis(config[_0xffb3('0xb')]));var cmHopper=require(_0xffb3('0xf'));var cmHopperHistory=require(_0xffb3('0x10'));var cmHopperFinal=require(_0xffb3('0x11'));var cmHopperAdditionalPhone=require(_0xffb3('0x12'));var cmHopperBlack=require(_0xffb3('0x13'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xffb3('0x14'));var Action=require(_0xffb3('0x15'));var History=require('./history');var Final=require(_0xffb3('0x16'));var AgentComplete=require(_0xffb3('0x17'));var QueueCallerAbandon=require(_0xffb3('0x18'));var Hangup=require(_0xffb3('0x19'));var ipAgi=process[_0xffb3('0x1a')][_0xffb3('0x1b')]||_0xffb3('0x1c');var strategy={'rrmemory':_0xffb3('0x1d'),'roundrobin':_0xffb3('0x1e')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xffb3('0x1f')][_0xffb3('0x20')]=function(_0x2c3ef7){this['tail']=this[_0xffb3('0x21')]?this[_0xffb3('0x21')][_0xffb3('0x22')](_0x2c3ef7):_0x2c3ef7();};function Dialer(_0x5bfdca,_0x51f3bb){this[_0xffb3('0x23')]=new Sequence();this[_0xffb3('0x24')]=_0x51f3bb;this['voiceQueues']=_0x5bfdca[_0xffb3('0x25')];this[_0xffb3('0x26')]=_0x5bfdca[_0xffb3('0x26')];this['agents']=_0x5bfdca[_0xffb3('0x27')];this[_0xffb3('0x28')]=_0x5bfdca['trunks'];this[_0xffb3('0x29')]=config[_0xffb3('0x29')]||0x2;this[_0xffb3('0x2a')]={};this[_0xffb3('0x2b')]={};this[_0xffb3('0x2c')]={};this[_0xffb3('0x2d')]={};this[_0xffb3('0x2e')]={};this['startPredictive']={};this[_0xffb3('0x2f')]={};this[_0xffb3('0x30')]={};this['queueBooked']={};this[_0xffb3('0x31')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xffb3('0x32')](this));ami['on'](_0xffb3('0x33'),this[_0xffb3('0x34')][_0xffb3('0x32')](this));ami['on'](_0xffb3('0x35'),this[_0xffb3('0x36')]['bind'](this));ami['on'](_0xffb3('0x37'),this['syncAgentComplete'][_0xffb3('0x32')](this));ami['on'](_0xffb3('0x38'),this['syncQueueSummary'][_0xffb3('0x32')](this));ami['on']('custom:queuesummarycomplete',this[_0xffb3('0x39')][_0xffb3('0x32')](this));ami['on'](_0xffb3('0x3a'),this[_0xffb3('0x3b')]['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xffb3('0x3c'),this['syncVarSet'][_0xffb3('0x32')](this));ami['on'](_0xffb3('0x3d'),this[_0xffb3('0x3e')][_0xffb3('0x32')](this));ami['on']('queuestatuscomplete',this[_0xffb3('0x3f')][_0xffb3('0x32')](this));this['loopCampaigns']();this[_0xffb3('0x40')]();RpcSetting[_0xffb3('0x41')]()[_0xffb3('0x42')](function(_0x591764){previewRecallmeReminderInterval=_0x591764[_0xffb3('0x43')];});}function isNotNull(_0xa02fac){return _0xa02fac!==null&&!_[_0xffb3('0x44')](_0xa02fac);}function checkIsLoggedIn(_0x4b6b3d,_0x36126c){return function(){if(_0x36126c<=0x0){_0x4b6b3d[_0xffb3('0x45')]='AGENTS_NOT_LOGGED';throw _0x4b6b3d[_0xffb3('0x46')]+_0xffb3('0x47');}};}function isActive(_0x27ca2c){return _0x27ca2c;}function checkIsActive(_0x3937e8,_0x2d5469){return function(){if(!isActive(_0x2d5469)){_0x3937e8['message']=_0xffb3('0x48');throw _0x3937e8[_0xffb3('0x46')]+_0xffb3('0x49');}};}function checkInterval(_0x59f876){return function(){if(!isNotNull(_0x59f876[_0xffb3('0x4a')])){_0x59f876[_0xffb3('0x45')]='INTERVAL_IS_NULL';throw _0x59f876[_0xffb3('0x46')]+_0xffb3('0x4b');}if(!isNotNull(_0x59f876['Interval'][_0xffb3('0x4c')])){_0x59f876[_0xffb3('0x45')]='INTERVAL_IS_NULL';throw _0x59f876['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xffb3('0x4d')](_0x59f876[_0xffb3('0x4a')]['Intervals']))){_0x59f876[_0xffb3('0x45')]='INTERVAL_IS_NULL';throw _0x59f876[_0xffb3('0x46')]+_0xffb3('0x4b');}};}function msgResponse(_0x4b0ed3,_0xbe01ca,_0x562740){return{'action':_0x4b0ed3,'response':_0xbe01ca,'message':_0x562740,'stack':_0x562740};}function myreject(_0x20a558){return function(_0x45220a){return _0x20a558(msgResponse('[ifTime][Action]',_0xffb3('0x4e'),JSON[_0xffb3('0x4f')](_0x45220a)));};}function getSeconds(_0x2ff1b1,_0x153457){var _0x1a662e=moment(_0x2ff1b1)[_0xffb3('0x50')](0x0);var _0x19013d=moment(_0x153457)[_0xffb3('0x50')](0x0);return _0x1a662e[_0xffb3('0x51')](_0x19013d,_0xffb3('0x52'));}function emit(_0x43e529,_0x1ee135,_0x2f8bc0){io['to'](_0x43e529)['emit'](_0x1ee135,_0x2f8bc0);}function emitVoiceQueueSummary(_0x2f6a9a){if(_0x2f6a9a[_0xffb3('0x53')]===_0xffb3('0x54')){var _0x4d2d7c={'id':_0x2f6a9a['id'],'name':_0x2f6a9a[_0xffb3('0x46')],'strategy':_0x2f6a9a['strategy'],'answered':_0x2f6a9a[_0xffb3('0x55')],'available':_0x2f6a9a[_0xffb3('0x56')],'loggedIn':_0x2f6a9a['loggedIn'],'pTalking':_0x2f6a9a[_0xffb3('0x57')],'sumBillable':_0x2f6a9a[_0xffb3('0x58')],'sumDuration':_0x2f6a9a['sumDuration'],'sumHoldTime':_0x2f6a9a['sumHoldTime']||0x0,'talking':_0x2f6a9a[_0xffb3('0x59')],'total':_0x2f6a9a[_0xffb3('0x5a')],'type':_0x2f6a9a['type'],'unmanaged':_0x2f6a9a[_0xffb3('0x5b')],'abandoned':_0x2f6a9a[_0xffb3('0x5c')],'waiting':_0x2f6a9a[_0xffb3('0x5d')],'loggedInDb':_0x2f6a9a[_0xffb3('0x5e')],'dialActive':_0x2f6a9a[_0xffb3('0x5f')],'dialMethod':_0x2f6a9a['dialMethod'],'dialOriginateCallerIdName':_0x2f6a9a[_0xffb3('0x60')],'dialOriginateCallerIdNumber':_0x2f6a9a[_0xffb3('0x61')],'dialOriginateTimeout':_0x2f6a9a[_0xffb3('0x62')],'dialPrefix':_0x2f6a9a[_0xffb3('0x63')],'outboundAnswerAgiCallsDay':_0x2f6a9a[_0xffb3('0x64')],'outboundAnswerCallsDay':_0x2f6a9a['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2f6a9a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2f6a9a[_0xffb3('0x65')],'outboundCongestionCallsDay':_0x2f6a9a[_0xffb3('0x66')],'outboundDropCallsDayACS':_0x2f6a9a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2f6a9a[_0xffb3('0x67')],'outboundDropCallsDayTimeout':_0x2f6a9a[_0xffb3('0x68')],'outboundNoAnswerCallsDay':_0x2f6a9a[_0xffb3('0x69')],'outboundNoSuchCallsDay':_0x2f6a9a[_0xffb3('0x6a')],'outboundOriginateFailureCallsDay':_0x2f6a9a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2f6a9a['outboundReCallsDay'],'outboundRejectCallsDay':_0x2f6a9a[_0xffb3('0x6b')],'outboundUnknownCallsDay':_0x2f6a9a[_0xffb3('0x6c')],'predictiveIntervalAnsweredCalls':_0x2f6a9a[_0xffb3('0x6d')],'predictiveIntervalAvgHoldtime':_0x2f6a9a[_0xffb3('0x6e')],'predictiveIntervalAvgTalktime':_0x2f6a9a[_0xffb3('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x2f6a9a[_0xffb3('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x2f6a9a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2f6a9a[_0xffb3('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x2f6a9a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2f6a9a[_0xffb3('0x72')],'predictiveIntervalMultiplicativeFactor':_0x2f6a9a[_0xffb3('0x73')],'predictiveIntervalPauses':_0x2f6a9a[_0xffb3('0x74')],'predictiveIntervalAvailable':_0x2f6a9a[_0xffb3('0x75')],'predictiveIntervalTotalCalls':_0x2f6a9a['predictiveIntervalTotalCalls'],'message':_0x2f6a9a['message'],'originated':_0x2f6a9a[_0xffb3('0x76')],'erlangCalls':_0x2f6a9a['erlangCalls'],'erlangCallToSecond':_0x2f6a9a[_0xffb3('0x77')],'erlangAbandonmentRate':_0x2f6a9a[_0xffb3('0x78')],'erlangBusyFactor':_0x2f6a9a[_0xffb3('0x79')],'startPredictive':_0x2f6a9a['startPredictive'],'startProgressive':_0x2f6a9a[_0xffb3('0x2f')]};if(_0x2f6a9a[_0xffb3('0x7a')]){_0x4d2d7c[_0xffb3('0x7a')]={'id':_0x2f6a9a[_0xffb3('0x7a')]['id'],'name':_0x2f6a9a[_0xffb3('0x7a')]['name'],'active':_0x2f6a9a[_0xffb3('0x7a')][_0xffb3('0x7b')],'callerid':_0x2f6a9a[_0xffb3('0x7a')]['callerid']};}if(_0x2f6a9a[_0xffb3('0x4a')]){_0x4d2d7c[_0xffb3('0x4a')]={'id':_0x2f6a9a[_0xffb3('0x4a')]['id'],'name':_0x2f6a9a['Interval'][_0xffb3('0x46')]};}var _0x1f9a9e=md5(JSON[_0xffb3('0x4f')](_0x4d2d7c));if(_0x2f6a9a[_0xffb3('0x7c')]!==_0x1f9a9e){_0x2f6a9a['md5']=_0x1f9a9e;emit(util['format']('voice:queue:%s',_0x4d2d7c['name']),_0xffb3('0x7d'),_0x4d2d7c);}}}function emitCampaignSummary(_0x4aab8e){if(_0x4aab8e['type']===_0xffb3('0x7e')){emit(util[_0xffb3('0x7f')](_0xffb3('0x80'),_0x4aab8e[_0xffb3('0x46')]),_0xffb3('0x81'),_0x4aab8e);}}function checkGetDataPredictive(_0x6b0b72){if(isNotNull(_0x6b0b72)&&!_[_0xffb3('0x4d')](_0x6b0b72)){loggerPredictive['info'](_0xffb3('0x82'));loggerPredictive[_0xffb3('0x83')](_0xffb3('0x84'),_0x6b0b72[_0xffb3('0x85')]);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x86'),_0x6b0b72['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x87'),_0x6b0b72['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xffb3('0x88'),_0x6b0b72['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x89'),_0x6b0b72[_0xffb3('0x6e')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6b0b72['predictiveIntervalAvgTalktime']);loggerPredictive[_0xffb3('0x83')]('---------------------------');if(_0x6b0b72['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x6b0b72[_0xffb3('0x6f')])&&_0x6b0b72[_0xffb3('0x6f')]>0x0){return!![];}loggerPredictive[_0xffb3('0x83')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xffb3('0x44')](_0x6b0b72['predictiveIntervalAvgHoldtime'])&&_0x6b0b72[_0xffb3('0x6e')]>0x0){return!![];}loggerPredictive[_0xffb3('0x83')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xffb3('0x83')](_0xffb3('0x8a'));}}else{loggerPredictive[_0xffb3('0x83')](_0xffb3('0x8b'));}return![];}function mergeDataErlangB(_0x5bbe51){return function(_0x9c0fd){loggerPredictive[_0xffb3('0x83')](_0xffb3('0x8c'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9c0fd['erlangCalls']);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x8d'),_0x9c0fd['erlangCallToSecond']);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x8e'),_0x9c0fd['erlangAbandonmentRate']);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x8f'),_0x9c0fd[_0xffb3('0x79')]);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x8e'),_0x9c0fd['erlangAbandonmentRate']);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x90'));_[_0xffb3('0x91')](_0x5bbe51,_0x9c0fd);};}function getDiff(_0x4aac78){var _0x3fb9be=moment()[_0xffb3('0x50')](0x0);var _0x54a8d7=moment(_0x4aac78)[_0xffb3('0x50')](0x0);return _0x3fb9be[_0xffb3('0x51')](_0x54a8d7,'seconds');}function ifInterval(_0x599966,_0x335790){if(_['isUndefined'](_0x335790)){return![];}return getDiff(_0x335790)<_0x599966*0x3c;}function freeVariablesPredictive(_0x2307a0){if(isNotNull(_0x2307a0)){if(!_[_0xffb3('0x44')](_0x2307a0[_0xffb3('0x2f')])){_0x2307a0[_0xffb3('0x2f')]=undefined;loggerPredictive[_0xffb3('0x83')](_0x2307a0[_0xffb3('0x46')],_0xffb3('0x92'));}if(!_[_0xffb3('0x44')](_0x2307a0['startPredictive'])){_0x2307a0[_0xffb3('0x93')]=undefined;loggerPredictive[_0xffb3('0x83')](_0x2307a0['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xffb3('0x44')](_0x2307a0[_0xffb3('0x94')])){clearInterval(_0x2307a0[_0xffb3('0x94')]);_0x2307a0[_0xffb3('0x94')]=undefined;loggerPredictive['info'](_0x2307a0[_0xffb3('0x46')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4a1d7e,_0x3c3b61){if(_0x3c3b61===0x0){return 0x0;}var _0x506968=0x1;for(var _0x46935c=0x1;_0x46935c<=_0x3c3b61;_0x46935c+=0x1){_0x506968=0x1+_0x506968*_0x46935c/_0x4a1d7e;}return 0x1/_0x506968;}function isVoiceQueueOutbound(_0xe77f9f){return _0xe77f9f===_0xffb3('0x54');}function isNotPreview(_0x5c179d){return _0x5c179d!==_0xffb3('0x24');}function isCampaignIvr(_0x48d345){return _0x48d345===_0xffb3('0x7e');}function getCallerId(_0x28adc2,_0x330322,_0x4481a9){if(!_[_0xffb3('0x44')](_0x4481a9)&&typeof _0x4481a9===_0xffb3('0x95')&&!_[_0xffb3('0x4d')](_0x4481a9)){if(!_[_0xffb3('0x44')](_0x330322)&&typeof _0x330322===_0xffb3('0x95')&&!_[_0xffb3('0x4d')](_0x330322)){return util[_0xffb3('0x7f')]('\x22%s\x22\x20<%s>',_0x330322,_0x4481a9);}return util[_0xffb3('0x7f')](_0xffb3('0x96'),_0x4481a9,_0x4481a9);}if(!_[_0xffb3('0x44')](_0x28adc2)&&typeof _0x28adc2==='string'&&!_[_0xffb3('0x4d')](_0x28adc2)){return _0x28adc2;}return _0xffb3('0x97');}function loggerCatchQueueSummary(_0x518fc8,_0xe95111){return function(_0x405591){freeVariablesPredictive(_0xe95111);emitVoiceQueueSummary(_0xe95111);emitCampaignSummary(_0xe95111);loggerSyncQueueSummary[_0xffb3('0x98')](_0x518fc8,util['inspect'](_0x405591,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x518077,_0x1e8d47){return function(_0x194ce1){loggerPredictive[_0xffb3('0x99')](_0x1e8d47[_0xffb3('0x46')],_0x518077);loggerPredictive[_0xffb3('0x99')](_0x194ce1[_0xffb3('0x9a')]);freeVariablesPredictive(_0x1e8d47);};}function loggerCatch(_0x32161c){return function(_0x24a70e){logger[_0xffb3('0x99')](_0x32161c,util[_0xffb3('0x9b')](_0x24a70e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x993851){return _0x993851&&!_[_0xffb3('0x44')](_0x993851)&&_0x993851[_0xffb3('0x9c')]>0x0;}function decremetOriginate(_0x158091){if(!_[_0xffb3('0x44')](_0x158091)&&_0x158091!==null){if(typeof _0x158091[_0xffb3('0x76')]!==_0xffb3('0x9d')){if(_0x158091[_0xffb3('0x76')]>0x0){_0x158091[_0xffb3('0x76')]-=0x1;}else{logger[_0xffb3('0x99')](_0xffb3('0x9e'));}}}else{logger[_0xffb3('0x99')](_0xffb3('0x9f'));}}function checkContactLowerLimitOriginate(_0x8cd5f6,_0x186d35,_0x37c91c){if(_0x186d35>_0x37c91c){for(var _0x531f3e=0x0;_0x531f3e<_0x186d35-_0x37c91c;_0x531f3e+=0x1){decremetOriginate(_0x8cd5f6);}}}function loggerGetContactDialer(_0x524fe3,_0xa33be1,_0x22bd5e){return function(_0x574a5c){checkContactLowerLimitOriginate(_0xa33be1,_0x22bd5e,0x0);logger['error'](_0x524fe3,util[_0xffb3('0x9b')](_0x574a5c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x78baaf){return function(_0x481ada){if(isNotNull(_0x481ada)&&isNotNull(_0x481ada[0x0])){if(_0x481ada[0x0][_0xffb3('0xa0')]>0x0){_0x78baaf[_0xffb3('0x45')]='RESCHEDULED_CONTACTS';logger[_0xffb3('0x83')](_0xffb3('0xa1')+_0x78baaf[_0xffb3('0x46')],_0x481ada[0x0][_0xffb3('0xa0')],_0xffb3('0xa2'));}else{_0x78baaf[_0xffb3('0x45')]=_0xffb3('0xa3');logger['info']('[getContactDialer2][Empty]'+_0x78baaf[_0xffb3('0x46')]);}}};}function notSendMessagesQueue(_0x14b3b1){if(_0x14b3b1[_0xffb3('0xa4')]){freeVariablesPredictive(_0x14b3b1);if(_0x14b3b1[_0xffb3('0x76')]===0x0&&_0x14b3b1['talking']===0x0&&_0x14b3b1[_0xffb3('0x5d')]===0x0&&(_0x14b3b1[_0xffb3('0x57')]||0x0)===0x0){_0x14b3b1[_0xffb3('0xa4')]=![];_0x14b3b1[_0xffb3('0x56')]=0x0;_0x14b3b1['message']=_0xffb3('0x48');loggerSyncQueueSummary[_0xffb3('0x98')](_0xffb3('0xa5'),_0x14b3b1[_0xffb3('0x46')],'is\x20not\x20active');}else{_0x14b3b1[_0xffb3('0x45')]=_0xffb3('0xa6');loggerSyncQueueSummary[_0xffb3('0x98')](_0xffb3('0xa5'),_0x14b3b1['name'],_0xffb3('0xa7'));}emitVoiceQueueSummary(_0x14b3b1);}}function notSendMessagesCampaign(_0x29c0aa){if(_0x29c0aa[_0xffb3('0xa4')]){if(_0x29c0aa[_0xffb3('0x76')]===0x0){_0x29c0aa[_0xffb3('0xa4')]=![];_0x29c0aa['message']=_0xffb3('0x48');loggerSyncQueueSummary[_0xffb3('0x98')](_0xffb3('0xa8'),_0x29c0aa['name'],_0xffb3('0xa9'));}else{_0x29c0aa[_0xffb3('0x45')]=_0xffb3('0xa6');loggerSyncQueueSummary[_0xffb3('0x98')](_0xffb3('0xa8'),_0x29c0aa[_0xffb3('0x46')],_0xffb3('0xa7'));}emitCampaignSummary(_0x29c0aa);}}function createObjHistory(_0x2c03e1,_0x38c8fe,_0x16cb48,_0x371aeb,_0x1f2677){_0x2c03e1[_0xffb3('0x45')]=_0x16cb48;var _0x582ab4=new Action(_0x2c03e1,_0x38c8fe);var _0x1ead22=new History(_0x582ab4);_0x1ead22[_0xffb3('0xaa')]=_0x371aeb;_0x1ead22[_0xffb3('0xab')]=_0x1f2677;_0x1ead22['endtime']=_0x582ab4['starttime'];return _0x1ead22;}Dialer[_0xffb3('0x1f')][_0xffb3('0x40')]=function(){var _0x45359a=this;setInterval(function(){_0x45359a[_0xffb3('0xac')](_0x45359a[_0xffb3('0x2d')],_0xffb3('0xad'));_0x45359a['clearZombieChannels'](_0x45359a[_0xffb3('0x2b')],_0xffb3('0xae'));},0x32c8);};Dialer[_0xffb3('0x1f')][_0xffb3('0xac')]=function(_0x233abc,_0x1713a8){var _0x5d4d5d=this;for(var _0x56f73d in _0x233abc){if(typeof _0x233abc[_0x56f73d]!==_0xffb3('0x9d')){this['sequence'][_0xffb3('0x20')](function(){if(!_['isNil'](_0x233abc[_0x56f73d])){return ami['Action']({'action':'status','channel':_0x233abc[_0x56f73d][_0xffb3('0xaf')]})[_0xffb3('0xb0')](function(_0x31ea45){if(_0x31ea45['message']===_0xffb3('0xb1')){setTimeout(function(){if(_0x233abc[_0x56f73d]&&_0x233abc[_0x56f73d][_0xffb3('0x53')]!=='ivr'){_0x5d4d5d[_0xffb3('0xb2')](_0x5d4d5d['voiceQueues'][_0x233abc[_0x56f73d]['queue']]);logger[_0xffb3('0x99')](_0xffb3('0xb3'),_0x1713a8,_0x56f73d,_0x233abc[_0x56f73d]['queue']);delete _0x233abc[_0x56f73d];}if(_0x233abc[_0x56f73d]&&_0x233abc[_0x56f73d][_0xffb3('0x53')]===_0xffb3('0x7e')){_0x5d4d5d['updateOriginated'](_0x5d4d5d[_0xffb3('0x26')][_0x233abc[_0x56f73d][_0xffb3('0xb4')]]);logger[_0xffb3('0x99')](_0xffb3('0xb5'),_0x1713a8,_0x56f73d,_0x233abc[_0x56f73d]['queue']);delete _0x233abc[_0x56f73d];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x39accd){return BPromise[_0xffb3('0xb6')]()[_0xffb3('0x42')](cmHopper[_0xffb3('0xb7')](_0x39accd))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xb8')));};Dialer[_0xffb3('0x1f')][_0xffb3('0xb9')]=function(_0x36469c){return BPromise[_0xffb3('0xb6')]()['then'](cmHopperBlack[_0xffb3('0xb9')](_0x36469c))['catch'](loggerCatch(_0xffb3('0xba')));};Dialer[_0xffb3('0x1f')][_0xffb3('0xbb')]=function(_0x523461,_0x310747,_0x3ea5ec){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0xffb3('0xbb')](_0x523461,_0x310747,_0x3ea5ec))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xbc')));};Dialer[_0xffb3('0x1f')]['swapAdditionalPhones']=function(_0x1085c4,_0x32054a,_0x3efe05){return BPromise['resolve']()[_0xffb3('0x42')](cmHopperAdditionalPhone[_0xffb3('0xbd')](_0x1085c4,_0x32054a,_0x3efe05))['catch'](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer[_0xffb3('0x1f')]['checkIsBlackListIvr']=function(_0x343b4){return BPromise[_0xffb3('0xb6')]()[_0xffb3('0x42')](cmHopperBlack[_0xffb3('0xbe')](_0x343b4))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xbf')));};Dialer[_0xffb3('0x1f')][_0xffb3('0xc0')]=function(_0x46c20e){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x46c20e))[_0xffb3('0xb0')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype']['rescheduleContact']=function(_0x131193){return BPromise[_0xffb3('0xb6')]()[_0xffb3('0x42')](cmHopper[_0xffb3('0xc1')](_0x131193))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xc2')));};Dialer[_0xffb3('0x1f')][_0xffb3('0xc3')]=function(_0x3a2c77,_0xc1d356,_0x359e3c){return BPromise['resolve']()['then'](cmHopper[_0xffb3('0xc3')](_0x3a2c77,_0xc1d356,_0x359e3c))[_0xffb3('0xb0')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xffb3('0x1f')][_0xffb3('0xc4')]=function(_0x2dd83d,_0x1c87ad,_0x31d1cb,_0x4083e2,_0x45ee73){return BPromise[_0xffb3('0xb6')]()[_0xffb3('0x42')](cmHopper[_0xffb3('0xc4')](_0x2dd83d,_0x1c87ad,_0x31d1cb,_0x4083e2))['catch'](function(_0xcbe48c){_0x45ee73[_0xffb3('0xc5')]-=_0x31d1cb;_0x45ee73[_0xffb3('0xc5')]=_0x45ee73[_0xffb3('0xc5')]>0x0?_0x45ee73['temp']:0x0;loggerCatch(_0xffb3('0xc6'))(_0xcbe48c);});};Dialer[_0xffb3('0x1f')][_0xffb3('0xc7')]=function(_0x20f242,_0x3f5790,_0x3eaf7f,_0x34128d){return BPromise['resolve']()[_0xffb3('0x42')](cmHopper['getContactDialerIvr'](_0x20f242,_0x3f5790,_0x3eaf7f))['catch'](function(_0x1583c1){_0x34128d[_0xffb3('0xc5')]-=_0x3f5790;_0x34128d[_0xffb3('0xc5')]=_0x34128d[_0xffb3('0xc5')]>0x0?_0x34128d[_0xffb3('0xc5')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x1583c1);});};Dialer[_0xffb3('0x1f')][_0xffb3('0xc8')]=function(_0x14e93a){return BPromise[_0xffb3('0xb6')]()[_0xffb3('0x42')](voiceQueueRt['getVoiceQueueRtPauses'](_0x14e93a))['catch'](loggerCatch(_0xffb3('0xc9')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x18e869){return BPromise[_0xffb3('0xb6')]()[_0xffb3('0x42')](cmHopper[_0xffb3('0xca')](_0x18e869))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xcb')));};Dialer['prototype']['createHistory']=function(_0x21f31f){return BPromise[_0xffb3('0xb6')]()[_0xffb3('0x42')](cmHopperHistory[_0xffb3('0xcc')](_0x21f31f))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xcd')));};Dialer[_0xffb3('0x1f')]['updateOriginated']=function(_0x2ced09){if(!_[_0xffb3('0x44')](_0x2ced09)&&_0x2ced09!==null){if(typeof _0x2ced09['originated']!==_0xffb3('0x9d')){if(_0x2ced09[_0xffb3('0x76')]>0x0){_0x2ced09[_0xffb3('0x76')]-=0x1;}else{logger[_0xffb3('0x99')](_0xffb3('0xce'));}}}else{logger[_0xffb3('0x99')](_0xffb3('0xcf'));}};Dialer[_0xffb3('0x1f')]['loggerHandler']=function(_0x547aec,_0x153f00){var _0xf2c46=this;return function(_0x2a7ab3){_0xf2c46['updateOriginated'](_0x153f00);logger[_0xffb3('0x99')](_0x547aec,util[_0xffb3('0x9b')](_0x2a7ab3,{'showHidden':![],'depth':null}));};};Dialer[_0xffb3('0x1f')][_0xffb3('0xd0')]=function(_0x4b1ee6,_0x96e88,_0x45aa5e){var _0x320b18={'state':0x19,'statedesc':'notFound'};this[_0xffb3('0xb2')](_0x96e88);this[_0xffb3('0xd1')](_[_0xffb3('0x91')](_0x320b18,_[_0xffb3('0xd2')](_0x45aa5e,[_0xffb3('0xd3'),_0xffb3('0xd4'),_0xffb3('0xd5'),_0xffb3('0xd6'),'CampaignId'])),_0xffb3('0xd7'),_0xffb3('0xd8'));logger['error'](_0x4b1ee6);};Dialer[_0xffb3('0x1f')][_0xffb3('0xd9')]=function(_0x3c0097){return _0x3c0097==='Success';};Dialer['prototype']['isTrunkReachable']=function(_0x393a12){return!_[_0xffb3('0x44')](_0x393a12)&&_0x393a12&&!_[_0xffb3('0x44')](_0x393a12[_0xffb3('0x46')])&&!_[_0xffb3('0x44')](_0x393a12[_0xffb3('0x7b')])&&_0x393a12[_0xffb3('0x7b')]&&(this[_0xffb3('0x28')][util[_0xffb3('0x7f')](_0xffb3('0xda'),_0x393a12[_0xffb3('0x46')])][_0xffb3('0xdb')]===_0xffb3('0xdc')||this[_0xffb3('0x28')][util[_0xffb3('0x7f')](_0xffb3('0xda'),_0x393a12[_0xffb3('0x46')])][_0xffb3('0xdb')]===_0xffb3('0xdd'));};Dialer['prototype'][_0xffb3('0xd1')]=function(_0x484d13,_0x530912,_0x5e8b1d){this['createHistory'](_0x484d13)[_0xffb3('0xb0')](loggerCatch(_0x530912));this[_0xffb3('0xca')](_0x484d13)['catch'](loggerCatch(_0x5e8b1d));};Dialer[_0xffb3('0x1f')][_0xffb3('0xde')]=function(_0xb7dcd){var _0x1cd06b=this[_0xffb3('0x2d')][_0xb7dcd['uniqueid']];var _0x3de39c;if(!_[_0xffb3('0xdf')](_0xb7dcd)&&!_[_0xffb3('0xdf')](_0xb7dcd[_0xffb3('0xe0')])&&!_['isNil'](_0xb7dcd[_0xffb3('0xe0')][_0xffb3('0xe1')])&&_0xb7dcd[_0xffb3('0xe2')]==='xcally-motion-dialer'&&_0x1cd06b){if(_0x1cd06b[_0xffb3('0x53')]!==_0xffb3('0x7e')&&this[_0xffb3('0x25')][_0x1cd06b[_0xffb3('0xb4')]][_0xffb3('0xe3')]&&_0xb7dcd[_0xffb3('0xe4')]===_0xffb3('0xe5')){delete this[_0xffb3('0x2d')][_0xb7dcd[_0xffb3('0xe6')]];this[_0xffb3('0xb2')](this[_0xffb3('0x25')][_0x1cd06b[_0xffb3('0xb4')]]);this['voiceQueues'][_0x1cd06b['queue']][_0xffb3('0xe7')]+=0x1;this[_0xffb3('0x25')][_0x1cd06b[_0xffb3('0xb4')]][_0xffb3('0x64')]+=0x1;_0x3de39c=new Hangup(_0x1cd06b,_0xb7dcd);_0x3de39c['state']=0x12;_0x3de39c[_0xffb3('0xab')]='HangupInAMD';_0x3de39c[_0xffb3('0xe8')]=_0xffb3('0xe9');ami[_0xffb3('0xea')](_0xffb3('0xeb'),ut[_0xffb3('0xec')](_0x3de39c,'amd'));this[_0xffb3('0xd1')](_0x3de39c,_0xffb3('0xed'),'[syncHangupInAMD]');}if(_0x1cd06b['type']!==_0xffb3('0x7e')&&this[_0xffb3('0x25')][_0x1cd06b[_0xffb3('0xb4')]][_0xffb3('0xe3')]&&_0xb7dcd[_0xffb3('0xe4')]===_0xffb3('0xee')){var _0x24a163=this;return new BPromise(function(_0x1906dc,_0x4a3351){delete _0x24a163[_0xffb3('0x2d')][_0xb7dcd[_0xffb3('0xe6')]];_0x24a163[_0xffb3('0xb2')](_0x24a163['voiceQueues'][_0x1cd06b[_0xffb3('0xb4')]]);_0x24a163[_0xffb3('0x25')][_0x1cd06b[_0xffb3('0xb4')]][_0xffb3('0xe7')]+=0x1;_0x24a163[_0xffb3('0x25')][_0x1cd06b['queue']][_0xffb3('0x64')]+=0x1;var _0x99a09a=_0x24a163['voiceQueues'][_0x1cd06b[_0xffb3('0xb4')]];var _0xf6d2b4=new Hangup(_0x1cd06b,_0xb7dcd);_0xf6d2b4['state']=0x13;_0xf6d2b4['statedesc']=_0xffb3('0xef');_0xf6d2b4[_0xffb3('0xe8')]=_0xffb3('0xe9');_0xf6d2b4[_0xffb3('0xf0')]+=0x1;_0xf6d2b4[_0xffb3('0xf1')]+=0x1;_0xf6d2b4[_0xffb3('0xf2')]=!![];ami[_0xffb3('0xea')](_0xffb3('0xeb'),ut[_0xffb3('0xec')](_0xf6d2b4,_0xffb3('0xf2')));_0x24a163['createHistory'](_0xf6d2b4)[_0xffb3('0xb0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xf6d2b4['countbusyretry']+_0xf6d2b4[_0xffb3('0xf3')]+_0xf6d2b4[_0xffb3('0xf4')]+_0xf6d2b4[_0xffb3('0xf5')]+_0xf6d2b4[_0xffb3('0xf6')]+_0xf6d2b4[_0xffb3('0xf7')]+_0xf6d2b4[_0xffb3('0xf0')]+_0xf6d2b4[_0xffb3('0xf8')]>=_0x99a09a[_0xffb3('0xf9')]){_0x24a163['stateGlobal'](_0xf6d2b4,_0x1906dc,_0x4a3351,'reason19\x20machine....');}else{if(_0xf6d2b4[_0xffb3('0xf0')]>=_0x99a09a['dialMachineMaxRetry']){_0x24a163[_0xffb3('0xfa')](_0xf6d2b4,_0x1906dc,_0x4a3351,_0xffb3('0xfb'));}else{_0x24a163[_0xffb3('0xc1')]({'active':![],'countmachineretry':_0xf6d2b4[_0xffb3('0xf0')],'scheduledat':moment()[_0xffb3('0xfc')](_0x99a09a['dialMachineRetryFrequency'],'minutes')['format'](_0xffb3('0xfd')),'ContactId':_0xf6d2b4['ContactId'],'ListId':_0xf6d2b4['ListId'],'VoiceQueueId':_0xf6d2b4['VoiceQueueId']||undefined,'CampaignId':_0xf6d2b4[_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xff')));_0x1906dc({'reschedule':0x1});}}});}if(_0x1cd06b[_0xffb3('0x53')]===_0xffb3('0x7e')&&this[_0xffb3('0x26')][_0x1cd06b['queue']]['dialAMDActive']&&_0xb7dcd['value']==='HANGUP'){delete this['uniqueId'][_0xb7dcd[_0xffb3('0xe6')]];this[_0xffb3('0xb2')](this[_0xffb3('0x26')][_0x1cd06b[_0xffb3('0xb4')]]);_0x3de39c=new Hangup(_0x1cd06b,_0xb7dcd);_0x3de39c[_0xffb3('0xaa')]=0x12;_0x3de39c[_0xffb3('0xab')]=_0xffb3('0x100');_0x3de39c['membername']=_0xffb3('0xe9');ami[_0xffb3('0xea')](_0xffb3('0xeb'),ut[_0xffb3('0xec')](_0x3de39c,_0xffb3('0xf2')));this[_0xffb3('0xd1')](_0x3de39c,_0xffb3('0x101'),_0xffb3('0x102'));}if(_0x1cd06b[_0xffb3('0x53')]==='ivr'&&this['campaigns'][_0x1cd06b[_0xffb3('0xb4')]][_0xffb3('0xe3')]&&_0xb7dcd['value']===_0xffb3('0xee')){var _0x24a163=this;return new BPromise(function(_0x1f9ceb,_0x46f1fd){delete _0x24a163[_0xffb3('0x2d')][_0xb7dcd[_0xffb3('0xe6')]];_0x24a163[_0xffb3('0xb2')](_0x24a163[_0xffb3('0x26')][_0x1cd06b['queue']]);_0x24a163['campaigns'][_0x1cd06b[_0xffb3('0xb4')]][_0xffb3('0xe7')]+=0x1;_0x24a163[_0xffb3('0x26')][_0x1cd06b['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x57e67e=_0x24a163[_0xffb3('0x26')][_0x1cd06b[_0xffb3('0xb4')]];var _0x25c33b=new Hangup(_0x1cd06b,_0xb7dcd);_0x25c33b[_0xffb3('0xaa')]=0x13;_0x25c33b['statedesc']=_0xffb3('0xef');_0x25c33b[_0xffb3('0xe8')]='AMD';_0x25c33b[_0xffb3('0xf0')]+=0x1;_0x25c33b[_0xffb3('0xf1')]+=0x1;_0x25c33b[_0xffb3('0xf2')]=!![];ami[_0xffb3('0xea')]('custom:amd',ut[_0xffb3('0xec')](_0x25c33b,_0xffb3('0xf2')));_0x24a163['createHistory'](_0x25c33b)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x103')));if(_0x25c33b[_0xffb3('0x104')]+_0x25c33b['countcongestionretry']+_0x25c33b[_0xffb3('0xf4')]+_0x25c33b['countnosuchnumberretry']+_0x25c33b[_0xffb3('0xf6')]+_0x25c33b[_0xffb3('0xf7')]+_0x25c33b['countmachineretry']+_0x25c33b[_0xffb3('0xf8')]>=_0x57e67e[_0xffb3('0xf9')]){_0x24a163[_0xffb3('0x105')](_0x25c33b,_0x1f9ceb,_0x46f1fd,_0xffb3('0x106'));}else{if(_0x25c33b[_0xffb3('0xf0')]>=_0x57e67e[_0xffb3('0x107')]){_0x24a163[_0xffb3('0xfa')](_0x25c33b,_0x1f9ceb,_0x46f1fd,_0xffb3('0xfb'));}else{_0x24a163['rescheduleContact']({'active':![],'countmachineretry':_0x25c33b[_0xffb3('0xf0')],'scheduledat':moment()[_0xffb3('0xfc')](_0x57e67e[_0xffb3('0x108')],'minutes')[_0xffb3('0x7f')](_0xffb3('0xfd')),'ContactId':_0x25c33b[_0xffb3('0xd3')],'ListId':_0x25c33b['ListId'],'VoiceQueueId':_0x25c33b['VoiceQueueId']||undefined,'CampaignId':_0x25c33b[_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xff')));_0x1f9ceb({'reschedule':0x1});}}});}}};Dialer[_0xffb3('0x1f')][_0xffb3('0x3b')]=function(_0x3b1e69){var _0xbe5340=this[_0xffb3('0x2d')][_0x3b1e69[_0xffb3('0xe6')]];var _0x1bb126=this;var _0x578dc6;if(_0xbe5340&&_0xbe5340[_0xffb3('0x53')]===_0xffb3('0x7e')){delete this[_0xffb3('0x2d')][_0x3b1e69['uniqueid']];this['updateOriginated'](this[_0xffb3('0x26')][_0xbe5340[_0xffb3('0xb4')]]);this['campaigns'][_0xbe5340[_0xffb3('0xb4')]][_0xffb3('0x109')]+=0x1;_0x578dc6=new Hangup(_0xbe5340,_0x3b1e69);this[_0xffb3('0xcc')](_0x578dc6)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x10a')));this[_0xffb3('0xca')](_0x578dc6)['catch'](loggerCatch(_0xffb3('0x10b')));}if(_0xbe5340&&_0xbe5340[_0xffb3('0x53')]!==_0xffb3('0x7e')&&isNotNull(this[_0xffb3('0x25')][_0xbe5340[_0xffb3('0xb4')]][_0xffb3('0x10c')])){delete this['uniqueId'][_0x3b1e69['uniqueid']];this[_0xffb3('0xb2')](this['voiceQueues'][_0xbe5340[_0xffb3('0xb4')]]);this[_0xffb3('0x25')][_0xbe5340['queue']][_0xffb3('0xe7')]+=0x1;this[_0xffb3('0x25')][_0xbe5340[_0xffb3('0xb4')]][_0xffb3('0x64')]+=0x1;_0x578dc6=new Hangup(_0xbe5340,_0x3b1e69);_0x578dc6[_0xffb3('0xaa')]=0x10;_0x578dc6[_0xffb3('0xab')]=_0xffb3('0x10d');_0x578dc6['membername']=_0xffb3('0x10e');this[_0xffb3('0xcc')](_0x578dc6)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x10a')));this[_0xffb3('0xca')](_0x578dc6)['catch'](loggerCatch(_0xffb3('0x10b')));}if(_0xbe5340&&_0xbe5340[_0xffb3('0x53')]!==_0xffb3('0x7e')&&!isNotNull(this['voiceQueues'][_0xbe5340[_0xffb3('0xb4')]][_0xffb3('0x10c')])){delete this[_0xffb3('0x2d')][_0x3b1e69[_0xffb3('0xe6')]];this['updateOriginated'](this[_0xffb3('0x25')][_0xbe5340['queue']]);this[_0xffb3('0x25')][_0xbe5340['queue']][_0xffb3('0x6c')]+=0x1;_0x578dc6=new Hangup(_0xbe5340,_0x3b1e69);_0x578dc6['state']=0xc;_0x578dc6['statedesc']=_0x3b1e69[_0xffb3('0x10f')];_0x578dc6[_0xffb3('0xe8')]='Unknow';this[_0xffb3('0xcc')](_0x578dc6)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xffb3('0xca')](_0x578dc6)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x10b')));}};Dialer[_0xffb3('0x1f')][_0xffb3('0x110')]=function(_0x21f98e){var _0x444e4e=this[_0xffb3('0x2d')][_0x21f98e[_0xffb3('0xe6')]];var _0xfc45e3=this;if(this[_0xffb3('0x25')][_0x21f98e['queue']]){if(_0x444e4e&&_0x444e4e[_0xffb3('0x53')]!==_0xffb3('0x7e')){delete this[_0xffb3('0x2d')][_0x21f98e[_0xffb3('0xe6')]];this[_0xffb3('0x25')][_0x21f98e[_0xffb3('0xb4')]][_0xffb3('0xe7')]+=0x1;var _0x2ce194=new AgentComplete(_0x444e4e,_0x21f98e);if(_0x21f98e['reason']===_0xffb3('0x111')){_0x2ce194[_0xffb3('0x112')]=this[_0xffb3('0x25')][_0x21f98e[_0xffb3('0xb4')]][_0xffb3('0x113')]&&this[_0xffb3('0x25')][_0x21f98e[_0xffb3('0xb4')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xffb3('0xcc')](_0x2ce194)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xffb3('0xca')](_0x2ce194)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xffb3('0x1f')][_0xffb3('0x114')]=function(_0x3c8d2b){if(this['voiceQueues'][_0x3c8d2b[_0xffb3('0xb4')]]){if(this[_0xffb3('0x2d')][_0x3c8d2b[_0xffb3('0xe6')]]&&this[_0xffb3('0x2d')][_0x3c8d2b[_0xffb3('0xe6')]]['type']!==_0xffb3('0x7e')){this[_0xffb3('0xb2')](this[_0xffb3('0x25')][_0x3c8d2b['queue']]);this[_0xffb3('0x2d')][_0x3c8d2b[_0xffb3('0xe6')]][_0xffb3('0x115')]=moment()[_0xffb3('0x7f')](_0xffb3('0xfd'));}}};Dialer['prototype'][_0xffb3('0x116')]=function(_0x508114,_0x55bf1c){this['createHistory'](_0x508114)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x117')));if(_0x55bf1c==0x0){this['moveContactManagedDialer'](_0x508114)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x118')));}};Dialer[_0xffb3('0x1f')][_0xffb3('0x34')]=function(_0x31e964){var _0x144839=this[_0xffb3('0x2d')][_0x31e964[_0xffb3('0xe6')]];var _0x4a08b7=this;var _0x29a7d8=![];var _0x5df53b;var _0x5cbdb1;if(this['voiceQueues'][_0x31e964[_0xffb3('0xb4')]]){if(_0x144839&&_0x144839[_0xffb3('0x53')]!=='ivr'){delete this['uniqueId'][_0x31e964[_0xffb3('0xe6')]];this[_0xffb3('0xb2')](this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]]);_0x144839[_0xffb3('0x119')]=moment()[_0xffb3('0x7f')](_0xffb3('0xfd'));var _0x5f1527=new QueueCallerAbandon(_0x144839,_0x31e964);if(getSeconds(_0x144839[_0xffb3('0x119')],_0x144839[_0xffb3('0x11a')])>=_0x144839[_0xffb3('0x11b')]){this[_0xffb3('0x25')][_0x31e964['queue']][_0xffb3('0x11c')]+=0x1;this['voiceQueues'][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x68')]+=0x1;this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x11d')]+=0x1;_0x5f1527['state']=0xa;_0x5f1527['statedesc']=_0xffb3('0x11e');_0x5f1527[_0xffb3('0x11f')]=_0xffb3('0x120');_0x5f1527['agiafterat']=this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x113')]?moment()['format'](_0xffb3('0xfd')):undefined;_0x5f1527[_0xffb3('0xf6')]+=0x1;_0x5f1527[_0xffb3('0xf1')]+=0x1;_0x5df53b=this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x121')];_0x5cbdb1=this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x122')];_0x4a08b7['verifyAdditionalPhones'](_0x5f1527,_0x5f1527['state'],_0x144839[_0xffb3('0x123')])[_0xffb3('0x42')](function(_0x5cff2e){_0x29a7d8=_0x5cff2e[_0xffb3('0x124')]==0x1;if(_0x5f1527['countdropretry']>=_0x4a08b7[_0xffb3('0x25')][_0x31e964['queue']][_0xffb3('0x125')]){_0x4a08b7['queueCallerAbandonCreateState'](_0x5f1527,_0x5cff2e[_0xffb3('0x124')]);}else{_0x4a08b7[_0xffb3('0xc1')]({'active':![],'countdropretry':_0x5f1527[_0xffb3('0xf6')],'scheduledat':moment()[_0xffb3('0xfc')](_0x4a08b7[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x121')],'minutes')[_0xffb3('0x7f')](_0xffb3('0xfd')),'ContactId':_0x144839[_0xffb3('0xd3')],'ListId':_0x144839[_0xffb3('0xd4')],'VoiceQueueId':_0x144839['VoiceQueueId']||undefined,'CampaignId':_0x144839[_0xffb3('0xfe')]||undefined})['catch'](loggerCatch(_0xffb3('0x126')));var _0xb21477=new History(_0x5f1527);_0xb21477[_0xffb3('0xaa')]=0xa;_0xb21477['statedesc']='Drop';_0xb21477[_0xffb3('0x127')]=moment()[_0xffb3('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0xb21477[_0xffb3('0x128')]=_0xb21477[_0xffb3('0x127')];_0xb21477['calleridname']=_0x5f1527['calleridname'];_0xb21477[_0xffb3('0x129')]=_0x5f1527[_0xffb3('0x129')];_0x4a08b7[_0xffb3('0xcc')](_0xb21477)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x12a')));}})['then'](function(_0x191855){if(_0x29a7d8)_0x4a08b7[_0xffb3('0xbd')](_0x5f1527,_0x5df53b,_0x5cbdb1)[_0xffb3('0x42')](function(_0x4fb791){return 0x1;});});}else{this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x70')]+=0x1;this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5f1527['state']=0xb;_0x5f1527[_0xffb3('0xab')]=_0xffb3('0x12b');_0x5f1527['dropreason']=_0xffb3('0x12c');_0x5f1527[_0xffb3('0xf7')]+=0x1;_0x5f1527[_0xffb3('0xf1')]+=0x1;_0x5df53b=this[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x12d')];_0x5cbdb1=this['voiceQueues'][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x122')];_0x4a08b7['verifyAdditionalPhones'](_0x5f1527,_0x5f1527[_0xffb3('0xaa')],_0x144839[_0xffb3('0x123')])['then'](function(_0x7f83b3){if(_0x5f1527['countabandonedretry']>=_0x4a08b7[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x12e')]){_0x4a08b7['queueCallerAbandonCreateState'](_0x5f1527,_0x7f83b3[_0xffb3('0x124')]);}else{_0x4a08b7[_0xffb3('0xc1')]({'active':![],'countabandonedretry':_0x5f1527['countabandonedretry'],'scheduledat':moment()[_0xffb3('0xfc')](_0x4a08b7[_0xffb3('0x25')][_0x31e964[_0xffb3('0xb4')]][_0xffb3('0x12d')],_0xffb3('0x12f'))[_0xffb3('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x144839[_0xffb3('0xd3')],'ListId':_0x144839['ListId'],'VoiceQueueId':_0x144839['VoiceQueueId']||undefined,'CampaignId':_0x144839[_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x130')));var _0x1c5f3e=new History(_0x5f1527);_0x1c5f3e[_0xffb3('0xaa')]=0xb;_0x1c5f3e[_0xffb3('0xab')]='Abandoned';_0x1c5f3e[_0xffb3('0x127')]=moment()[_0xffb3('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c5f3e[_0xffb3('0x128')]=_0x1c5f3e[_0xffb3('0x127')];_0x1c5f3e[_0xffb3('0x131')]=_0x5f1527['calleridname'];_0x1c5f3e['calleridnum']=_0x5f1527[_0xffb3('0x129')];_0x4a08b7['createHistory'](_0x1c5f3e)['catch'](loggerCatch(_0xffb3('0x132')));}})[_0xffb3('0x42')](function(_0x4729e9){if(_0x29a7d8)_0x4a08b7['swapAdditionalPhones'](_0x5f1527,_0x5df53b,_0x5cbdb1)[_0xffb3('0x42')](function(_0x4f8881){return 0x1;});});}}}};Dialer[_0xffb3('0x1f')]['syncNewExten']=function(_0x326638){if(this['actions'][_0x326638[_0xffb3('0xe6')]]){this['actions'][_0x326638['uniqueid']]['channel']=_0x326638['channel'];}if(this[_0xffb3('0x2d')][_0x326638[_0xffb3('0xe6')]]){this[_0xffb3('0x2d')][_0x326638[_0xffb3('0xe6')]][_0xffb3('0xaf')]=_0x326638[_0xffb3('0xaf')];}};Dialer['prototype']['syncQueueMember']=function(_0x4ede44){if(strategy[this[_0xffb3('0x25')][this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]][_0xffb3('0xb4')]][_0xffb3('0x134')]]===_0xffb3('0x1e')){if(this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]]&&_[_0xffb3('0xdf')](this['actions'][_0x4ede44[_0xffb3('0x133')]]['locked'])&&_0x4ede44[_0xffb3('0xdb')]==='1'&&_0x4ede44[_0xffb3('0x135')]==='0'){if(this[_0xffb3('0x27')][_0x4ede44['stateinterface']]){if(!this[_0xffb3('0x27')][_0x4ede44['stateinterface']]['locked']){this[_0xffb3('0x27')][_0x4ede44[_0xffb3('0x136')]][_0xffb3('0x137')]=!![];this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]][_0xffb3('0x137')]=!![];this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]][_0xffb3('0x136')]=_0x4ede44[_0xffb3('0x136')];}}}}else if((strategy[this[_0xffb3('0x25')][this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]][_0xffb3('0xb4')]]['strategy']]||_0xffb3('0x1d'))===_0xffb3('0x1d')){if(this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]]){if(this[_0xffb3('0x27')][_0x4ede44[_0xffb3('0x136')]]){this['actions'][_0x4ede44[_0xffb3('0x133')]]['stateinterface']=_0x4ede44[_0xffb3('0x136')];if(_[_0xffb3('0xdf')](this[_0xffb3('0x138')][this[_0xffb3('0x2b')][_0x4ede44['actionid']][_0xffb3('0xb4')]])){this[_0xffb3('0x138')][this[_0xffb3('0x2b')][_0x4ede44['actionid']]['queue']]=[];}this[_0xffb3('0x138')][this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]][_0xffb3('0xb4')]]['push'](_['merge'](_[_0xffb3('0xd2')](this[_0xffb3('0x2b')][_0x4ede44[_0xffb3('0x133')]],[_0xffb3('0x139'),'stateinterface']),{'status':_0x4ede44['status'],'paused':_0x4ede44[_0xffb3('0x135')]}));}}}};function unlockQueueStatus(_0x2257b1,_0x5828b6){setTimeout(function(){if(_['isUndefined'](_0x2257b1[_0xffb3('0x13a')])){loggerBooked[_0xffb3('0x99')](_0xffb3('0x13b'),_0x5828b6);}_0x2257b1['queueStatusComplete']=!![];loggerBooked[_0xffb3('0x83')](_0xffb3('0x13c'),_0x5828b6,JSON[_0xffb3('0x4f')](_[_0xffb3('0xd2')](_0x2257b1,[_0xffb3('0x46'),_0xffb3('0x13a')])));},0x1f3);}Dialer['prototype'][_0xffb3('0x3f')]=function(_0xe58e81){var _0x58dc35=this;var _0x4d0684=_0x58dc35[_0xffb3('0x25')][_0x58dc35['actions'][_0xe58e81['actionid']][_0xffb3('0xb4')]];if(strategy[this['voiceQueues'][this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xb4')]][_0xffb3('0x134')]]===_0xffb3('0x1e')){if(this['actions'][_0xe58e81[_0xffb3('0x133')]]&&this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0x136')]){this[_0xffb3('0x24')][_0xffb3('0x13d')](this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0x139')],this['actions'][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0x136')])[_0xffb3('0xb0')](function(_0x421fdd){logger[_0xffb3('0x99')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xffb3('0x9b')](_0x421fdd,{'showHidden':![],'depth':null}));})[_0xffb3('0x22')](function(){_0x58dc35[_0xffb3('0xb2')](_0x58dc35[_0xffb3('0x25')][_0x58dc35[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xb4')]]);_0x58dc35['agents'][_0x58dc35[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0x136')]][_0xffb3('0x137')]=![];delete _0x58dc35[_0xffb3('0x2b')][_0xe58e81['actionid']];unlockQueueStatus(_0x4d0684);});}else{this[_0xffb3('0xb2')](this[_0xffb3('0x25')][this[_0xffb3('0x2b')][_0xe58e81['actionid']][_0xffb3('0xb4')]]);this[_0xffb3('0xc1')]({'active':![],'ContactId':this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xd3')],'ListId':this['actions'][_0xe58e81['actionid']]['ListId'],'VoiceQueueId':this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xd6')]||undefined,'CampaignId':this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xffb3('0x2b')][_0xe58e81['actionid']];unlockQueueStatus(_0x4d0684);}}else if((strategy[this[_0xffb3('0x25')][this[_0xffb3('0x2b')][_0xe58e81['actionid']][_0xffb3('0xb4')]][_0xffb3('0x134')]]||_0xffb3('0x1d'))===_0xffb3('0x1d')){var _0xde8769;if(this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]]&&!_[_0xffb3('0x4d')](this['queueBooked'][this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xb4')]])){if(this[_0xffb3('0x31')][_0x58dc35['actions'][_0xe58e81['actionid']][_0xffb3('0xb4')]]){this[_0xffb3('0x31')][_0x58dc35['actions'][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xb4')]]=this[_0xffb3('0x31')][this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]]['queue']]?this[_0xffb3('0x31')][this['actions'][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xb4')]]:this[_0xffb3('0x138')][this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xb4')]]?this[_0xffb3('0x138')][this[_0xffb3('0x2b')][_0xe58e81[_0xffb3('0x133')]][_0xffb3('0xb4')]]['_rr']||0x0:0x0;}this[_0xffb3('0x138')][this[_0xffb3('0x2b')][_0xe58e81['actionid']]['queue']][_0xffb3('0x13e')]=this[_0xffb3('0x31')][this[_0xffb3('0x2b')][_0xe58e81['actionid']][_0xffb3('0xb4')]];for(var _0x1f226a=0x0;_0x1f226a=0x0;})[_0xffb3('0xb0')](myreject(_0x2860de)));}}else{_0x1b0d12[_0xffb3('0x162')](ami[_0xffb3('0x15b')]({'action':_0xffb3('0x15c'),'command':util[_0xffb3('0x7f')](_0xffb3('0x15d'),_0x222512,!_[_0xffb3('0x44')](config['timezones'][_0x3a4d1d])?_0x3a4d1d:'')})['then'](function(_0x366825){return _0x366825[_0xffb3('0x15f')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x2860de)));}BPromise['all'](_0x1b0d12)[_0xffb3('0x42')](function(_0x2d6d9d){var _0x1aedc5=_[_0xffb3('0x163')](_0x2d6d9d);if(_0x1aedc5){return _0x4984d2(_0x1aedc5);}else{_0x35380c['message']=_0x12b815?_0xffb3('0x164'):_0xffb3('0x165');return _0x2860de(msgResponse(_0xffb3('0x166'),_0xffb3('0x159'),'Global:\x20'+_0x12b815+'\x20'+_0x581eb4+_0xffb3('0x167')+util[_0xffb3('0x9b')](_0x222512,{'showHidden':![],'depth':null})+_0xffb3('0x168')+_0x3a4d1d));}})[_0xffb3('0xb0')](function(_0x8ecdd){return _0x2860de(msgResponse(_0xffb3('0x151'),_0xffb3('0x159'),JSON[_0xffb3('0x4f')](_0x8ecdd)));});});};Dialer[_0xffb3('0x1f')]['checkDialMethod']=function(_0x242514){var _0x9c53c2=this;return function(){switch(_0x242514['dialMethod']){case _0xffb3('0x169'):freeVariablesPredictive(_0x242514);_0x9c53c2['handlePower'](_0x242514,0x1);break;case _0xffb3('0x16a'):freeVariablesPredictive(_0x242514);_0x9c53c2[_0xffb3('0x16b')](_0x242514,_0x242514['dialPowerLevel']);break;case _0xffb3('0x8'):_0x9c53c2[_0xffb3('0x8')](_0x242514);break;case _0xffb3('0x7'):freeVariablesPredictive(_0x242514);_0x9c53c2[_0xffb3('0x16b')](_0x242514,0x1);break;default:freeVariablesPredictive(_0x242514);logger[_0xffb3('0x99')](_0xffb3('0x16c'),_0x242514[_0xffb3('0x46')],_0xffb3('0x16d'));}};};Dialer[_0xffb3('0x1f')][_0xffb3('0x16e')]=function(_0x16dd78){var _0x4db122=this;return function(){_0x4db122['handleIvr'](_0x16dd78);};};Dialer[_0xffb3('0x1f')][_0xffb3('0x9')]=function(_0x5494ae){var _0x3a6211=this;if(isNotPreview(_0x5494ae[_0xffb3('0x16f')])){if(isVoiceQueueOutbound(_0x5494ae[_0xffb3('0x53')])&&isActive(_0x5494ae['dialActive'])){_0x5494ae[_0xffb3('0xa4')]=!![];BPromise[_0xffb3('0xb6')]()['then'](checkIsLoggedIn(_0x5494ae,_0x5494ae[_0xffb3('0x170')]))[_0xffb3('0x42')](checkIsActive(_0x5494ae,_0x5494ae['dialActive']))['then'](checkInterval(_0x5494ae))['then'](_0x3a6211[_0xffb3('0x14b')](_0x5494ae))[_0xffb3('0x42')](_0x3a6211[_0xffb3('0x150')](_0x5494ae[_0xffb3('0x171')],_0x5494ae[_0xffb3('0x172')],_0x5494ae['name'],_0x5494ae))['then'](_0x3a6211[_0xffb3('0x152')](_0x5494ae[_0xffb3('0x4a')],_0x5494ae[_0xffb3('0x172')],_0x5494ae[_0xffb3('0x46')],_0x5494ae))[_0xffb3('0x42')](_0x3a6211['checkDialMethod'](_0x5494ae))['catch'](loggerCatchQueueSummary(_0xffb3('0x173'),_0x5494ae));}else{notSendMessagesQueue(_0x5494ae);}}else{freeVariablesPredictive(_0x5494ae);}};Dialer[_0xffb3('0x1f')]['syncQueueSummaryComplete']=_[_0xffb3('0x174')](function(){var _0x4f45b3=_[_0xffb3('0x175')](this[_0xffb3('0x25')],function(_0x52424b){return _0x52424b[_0xffb3('0x176')];});var _0xc805a9=_[_0xffb3('0x175')](this[_0xffb3('0x27')],function(_0x14b8f4){return _0x14b8f4[_0xffb3('0x177')]&&_0x14b8f4[_0xffb3('0xdb')]===_0xffb3('0xdc');});if(_0x4f45b3['length']>0x0&&_0xc805a9[_0xffb3('0x9c')]>0x0){return BPromise[_0xffb3('0xb6')]()['then'](cmHopper[_0xffb3('0x178')](_['map'](_0x4f45b3,'id'),previewRecallmeReminderInterval,_[_0xffb3('0x179')](_0xc805a9,'id')))[_0xffb3('0x42')](function(_0x45563e){for(var _0x5cd6c7=0x0;_0x5cd6c7<_0x45563e[_0xffb3('0x9c')];_0x5cd6c7++){var _0x2de82a=_0x45563e[_0x5cd6c7][_0xffb3('0x17a')][_0xffb3('0x46')];if(_0x2de82a)io['to'](util['format'](_0xffb3('0x17b'),_0x2de82a))[_0xffb3('0xea')](_0xffb3('0x17c'),{'hopper':_0x45563e[_0x5cd6c7]});}})['catch'](function(_0x371ad5){logger[_0xffb3('0x99')](_0xffb3('0x17d'),_0x371ad5);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['syncCampaigns']=function(){var _0x7f4e7e=this;var _0x364705;for(var _0x47de0d in this[_0xffb3('0x26')]){if(typeof this[_0xffb3('0x26')][_0x47de0d]!==_0xffb3('0x9d')){_0x364705=this[_0xffb3('0x26')][_0x47de0d];if(isCampaignIvr(_0x364705[_0xffb3('0x53')])&&isActive(_0x364705[_0xffb3('0x7b')])){_0x364705[_0xffb3('0xa4')]=!![];BPromise[_0xffb3('0xb6')]()['then'](checkIsActive(_0x364705,_0x364705[_0xffb3('0x7b')]))[_0xffb3('0x42')](checkInterval(_0x364705))[_0xffb3('0x42')](_0x7f4e7e['checkIsTrunkReachable'](_0x364705))['then'](_0x7f4e7e[_0xffb3('0x150')](_0x364705[_0xffb3('0x171')],_0x364705[_0xffb3('0x172')],_0x364705['name'],_0x364705))['then'](_0x7f4e7e['checkIfTimeIntervals'](_0x364705[_0xffb3('0x4a')],_0x364705[_0xffb3('0x172')],_0x364705[_0xffb3('0x46')],_0x364705))[_0xffb3('0x42')](_0x7f4e7e[_0xffb3('0x16e')](_0x364705))[_0xffb3('0xb0')](loggerCatchQueueSummary(_0xffb3('0x17e'),_0x364705));}else{notSendMessagesCampaign(_0x364705);}}}};function getCallerIdRandom(_0x39024b,_0x2121ae){var _0x234d05;var _0x560f93;var _0x142480;if(_0x2121ae<=0x0){_0x2121ae=0x1;}_0x234d05=new RegExp(_0xffb3('0x17f')+_0x2121ae+'}$');_0x560f93=Math[_0xffb3('0x180')](0xa,_0x2121ae-0x1);_0x142480=Math[_0xffb3('0x180')](0xa,_0x2121ae)-0x1;return util[_0xffb3('0x7f')]('%s',_[_0xffb3('0x181')](_0x39024b,_0x234d05,_[_0xffb3('0x182')](_0x560f93,_0x142480)));}function extractCalleridName(_0x2d1a0f){var _0x259fb7=_0x2d1a0f['match'](/"(.*?)"/);return _0x259fb7?_0x259fb7[0x1]:_0x2d1a0f;}function extractCalleridNumber(_0xffbec9){var _0x4fb192=_0xffbec9[_0xffb3('0x183')](/<(.*?)>/);return _0x4fb192?_0x4fb192[0x1]:_0xffbec9;}Dialer[_0xffb3('0x1f')][_0xffb3('0x184')]=function(_0x37239b,_0x410691){var _0xc83dba=this;var _0x4a0980=uuid['v4']();this[_0xffb3('0x2b')][_0x4a0980]=new Action(_0x37239b,_0x410691,_0x4a0980);return new BPromise(function(_0x5ec087,_0x4e7960){if(_[_0xffb3('0x44')](_0x37239b)&&typeof _0x37239b!==_0xffb3('0x185')){return _0x4e7960(msgResponse(_0xffb3('0x186'),_0xffb3('0x159'),_0xffb3('0x187')));}if(_[_0xffb3('0x44')](_0x410691['phone'])||_0x410691[_0xffb3('0x188')]===null){return _0x4e7960(msgResponse(_0xffb3('0x186'),_0xffb3('0x159'),'contact\x20is\x20undefine'));}var _0x1ea494={'XMD-CALLERID':_0xc83dba[_0xffb3('0x2b')][_0x4a0980][_0xffb3('0x189')](),'XMD-AGI':_0x37239b[_0xffb3('0x10c')]?util[_0xffb3('0x7f')](_0xffb3('0x18a'),ipAgi,_0x37239b[_0xffb3('0x10c')]):_0xffb3('0x18b'),'XMD-AGIAFTER':_0x37239b[_0xffb3('0x113')]?util['format'](_0xffb3('0x18a'),ipAgi,_0x37239b[_0xffb3('0x113')]):_0xffb3('0x18b'),'XMD-QUEUE':_0x37239b[_0xffb3('0x53')]==='outbound'?util[_0xffb3('0x7f')](_0xffb3('0x18c'),_0x37239b[_0xffb3('0x46')],_0x37239b[_0xffb3('0x18d')]||'',_0x37239b[_0xffb3('0x18e')]?'c':'',_0x37239b[_0xffb3('0x11b')]||0x3):_0xffb3('0x18b'),'XMD-CONTACTID':_0x410691[_0xffb3('0xd3')],'XMD-CDRTYPE':_0xffb3('0x6'),'CALLERID(all)':_0xc83dba[_0xffb3('0x2b')][_0x4a0980]['getCaller'](),'XMD-AMD':_0x37239b[_0xffb3('0xe3')]?_0xffb3('0x18f'):_0xffb3('0x18b'),'XMD-DESTINATION':_0xffb3('0x190')};if(_0x37239b[_0xffb3('0xe3')]){_0x1ea494[_0xffb3('0x191')]=_0x37239b[_0xffb3('0x192')]||0x9c4;_0x1ea494['XMD-AMDGREETING']=_0x37239b[_0xffb3('0x193')]||0x5dc;_0x1ea494[_0xffb3('0x194')]=_0x37239b['dialAMDAfterGreetingSilence']||0x320;_0x1ea494['XMD-AMDTOTALANALYSISTIME']=_0x37239b[_0xffb3('0x195')]||0x1388;_0x1ea494[_0xffb3('0x196')]=_0x37239b[_0xffb3('0x197')]||0x64;_0x1ea494['XMD-AMDBETWEENWORDSSILENCE']=_0x37239b['dialAMDBetweenWordsSilence']||0x32;_0x1ea494[_0xffb3('0x198')]=_0x37239b['dialAMDMaximumNumberOfWords']||0x3;_0x1ea494[_0xffb3('0x199')]=_0x37239b[_0xffb3('0x19a')]||0x100;_0x1ea494[_0xffb3('0x19b')]=_0x37239b[_0xffb3('0x19c')]||0x1388;}if(_0x37239b['type']===_0xffb3('0x54')){_0x1ea494[_0xffb3('0x19d')]=_0x410691['VoiceQueueId'];}else{_0x1ea494[_0xffb3('0x19e')]=_0x410691[_0xffb3('0xfe')];}for(var _0x482cb8 in _0x410691['Contact']){if(typeof _0x410691[_0xffb3('0x19f')][_0x482cb8]!==_0xffb3('0x9d')){if(isNotNull(_0x410691['Contact'][_0x482cb8])&&_0x482cb8!=='id'&&_0x482cb8!==_0xffb3('0x1a0')&&_0x482cb8!==_0xffb3('0x1a1')&&_0x482cb8!==_0xffb3('0x1a2')){_0x1ea494[util[_0xffb3('0x7f')](_0xffb3('0x1a3'),_0xffb3('0x1a4'),_[_0xffb3('0x1a5')](_0x482cb8))]=_0x410691[_0xffb3('0x19f')][_0x482cb8];}}}var _0x54a710=_0xc83dba[_0xffb3('0x14c')](_0x37239b[_0xffb3('0x7a')])?getCallerId(_0x37239b['Trunk'][_0xffb3('0x1a6')],_0x37239b['dialOriginateCallerIdName'],_0x37239b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x37239b['dialOriginateCallerIdNumber'],_0x37239b['dialRandomLastDigitCallerIdNumber']):_0x37239b[_0xffb3('0x61')]):getCallerId(_[_0xffb3('0xdf')](_0x37239b[_0xffb3('0x14d')])?_0x37239b['Trunk'][_0xffb3('0x1a6')]:_0x37239b[_0xffb3('0x14d')][_0xffb3('0x1a6')],_0x37239b['dialOriginateCallerIdName'],_0x37239b[_0xffb3('0x1a7')]>0x0?getCallerIdRandom(_0x37239b[_0xffb3('0x61')],_0x37239b['dialRandomLastDigitCallerIdNumber']):_0x37239b[_0xffb3('0x61')]);if(_0x54a710){_0x1ea494[_0xffb3('0x1a8')]=_0xc83dba[_0xffb3('0x2b')][_0x4a0980]['originatecalleridname']=extractCalleridName(_0x54a710);_0x1ea494[_0xffb3('0x1a9')]=_0x410691[_0xffb3('0x188')];}return ami[_0xffb3('0x15b')]({'actionid':_0x4a0980,'action':_0xffb3('0x186'),'channel':_0xc83dba[_0xffb3('0x14c')](_0x37239b[_0xffb3('0x7a')])?util[_0xffb3('0x7f')](_0xffb3('0x1aa'),_0x37239b[_0xffb3('0x7a')][_0xffb3('0x46')],isNotNull(_0x37239b[_0xffb3('0x63')])?_0x37239b[_0xffb3('0x63')]['trim']()||'':'',_0x37239b[_0xffb3('0x1ab')]>0x0?_0x410691[_0xffb3('0x188')][_0xffb3('0x1ac')](_0x37239b['dialCutDigit']):_0x410691[_0xffb3('0x188')]):util[_0xffb3('0x7f')](_0xffb3('0x1aa'),_['isNil'](_0x37239b[_0xffb3('0x14d')])?_0x37239b[_0xffb3('0x7a')][_0xffb3('0x46')]:_0x37239b['TrunkBackup'][_0xffb3('0x46')],isNotNull(_0x37239b[_0xffb3('0x63')])?_0x37239b[_0xffb3('0x63')]['trim']()||'':'',_0x37239b[_0xffb3('0x1ab')]>0x0?_0x410691['phone']['substring'](_0x37239b[_0xffb3('0x1ab')]):_0x410691['phone']),'callerid':_0x54a710,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x1ea494,'timeout':(_0x37239b[_0xffb3('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4a0980})['then'](function(_0x5d0509){return _0x5ec087(_0x5d0509);})[_0xffb3('0xb0')](function(_0x30d2e8){_0x37239b[_0xffb3('0x1ad')]+=0x1;var _0x1dd3b3=new History(_0xc83dba[_0xffb3('0x2b')][_0x4a0980]);logger['error'](util[_0xffb3('0x7f')]('[originateError]:\x20%s',JSON[_0xffb3('0x4f')](_0x30d2e8)));_0x1dd3b3['state']=0xe;_0x1dd3b3['statedesc']=_0xffb3('0x1ae');_0x1dd3b3[_0xffb3('0x127')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1dd3b3[_0xffb3('0x128')]=_0x1dd3b3[_0xffb3('0x127')];_0xc83dba[_0xffb3('0xcc')](_0x1dd3b3)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x1af')));_0xc83dba[_0xffb3('0xca')](_0x1dd3b3)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x1af')))['finally'](function(){delete _0xc83dba[_0xffb3('0x2b')][_0x4a0980];return _0x4e7960(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xffb3('0x36')]=function(_0x3fe97b){var _0x1e18c6=this[_0xffb3('0x2b')][_0x3fe97b['actionid']];if(_0x1e18c6){delete this[_0xffb3('0x2b')][_0x3fe97b[_0xffb3('0x133')]];_0x1e18c6[_0xffb3('0x11a')]=moment()[_0xffb3('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');var _0x13c276=_0x1e18c6[_0xffb3('0x53')]===_0xffb3('0x7e')?this[_0xffb3('0x26')][_0x1e18c6[_0xffb3('0xb4')]]:this[_0xffb3('0x25')][_0x1e18c6[_0xffb3('0x1b0')]()];if(!this['isSuccess'](_0x3fe97b[_0xffb3('0x1b1')])){this[_0xffb3('0xb2')](_0x13c276);return this[_0xffb3('0x1b2')](_0x1e18c6,_0x13c276,_0x3fe97b)['catch'](loggerCatch(_0xffb3('0x1b3')));}this[_0xffb3('0x2d')][_0x3fe97b[_0xffb3('0xe6')]]=_0x1e18c6;}};Dialer[_0xffb3('0x1f')][_0xffb3('0x1b4')]=function(_0x4137e2,_0x2b9b77,_0x4c39db){var _0x4c67f2=new History(_0x2b9b77);if(_0x4c67f2[_0xffb3('0x104')]+_0x4c67f2[_0xffb3('0xf3')]+_0x4c67f2[_0xffb3('0xf4')]+_0x4c67f2[_0xffb3('0xf5')]+_0x4c67f2[_0xffb3('0xf6')]+_0x4c67f2['countabandonedretry']+_0x4c67f2[_0xffb3('0xf0')]+_0x4c67f2[_0xffb3('0xf8')]>=_0x4c39db['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4137e2){case 0x3:if(_0x4c67f2[_0xffb3('0xf4')]>=_0x4c39db[_0xffb3('0x1b5')]-0x1){return!![];}this[_0xffb3('0xc1')]({'active':![],'countnoanswerretry':_0x4c67f2[_0xffb3('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x4c39db[_0xffb3('0x1b6')],_0xffb3('0x12f'))[_0xffb3('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c67f2['ContactId'],'ListId':_0x4c67f2[_0xffb3('0xd4')],'VoiceQueueId':_0x4c67f2[_0xffb3('0xd6')]||undefined,'CampaignId':_0x4c67f2['CampaignId']||undefined})['catch'](loggerCatch(_0xffb3('0x1b7')));break;case 0x5:if(_0x4c67f2[_0xffb3('0x104')]>=_0x4c39db[_0xffb3('0x1b8')]-0x1){return!![];}this[_0xffb3('0xc1')]({'active':![],'countbusyretry':_0x4c67f2[_0xffb3('0x104')]+=0x1,'scheduledat':moment()['add'](_0x4c39db['dialBusyRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c67f2[_0xffb3('0xd3')],'ListId':_0x4c67f2[_0xffb3('0xd4')],'VoiceQueueId':_0x4c67f2[_0xffb3('0xd6')]||undefined,'CampaignId':_0x4c67f2[_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x1b9')));break;case 0x8:if(_0x4c67f2[_0xffb3('0xf3')]>=_0x4c39db[_0xffb3('0x1ba')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4c67f2[_0xffb3('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x4c39db[_0xffb3('0x1bb')],_0xffb3('0x12f'))[_0xffb3('0x7f')](_0xffb3('0xfd')),'ContactId':_0x4c67f2[_0xffb3('0xd3')],'ListId':_0x4c67f2[_0xffb3('0xd4')],'VoiceQueueId':_0x4c67f2[_0xffb3('0xd6')]||undefined,'CampaignId':_0x4c67f2[_0xffb3('0xfe')]||undefined})['catch'](loggerCatch(_0xffb3('0x1bc')));break;case 0x0:if(_0x4c67f2[_0xffb3('0xf5')]>=_0x4c39db[_0xffb3('0x1bd')]-0x1){return!![];}else{this[_0xffb3('0xc1')]({'active':![],'countnosuchnumberretry':_0x4c67f2[_0xffb3('0xf5')]+=0x1,'scheduledat':moment()[_0xffb3('0xfc')](_0x4c39db[_0xffb3('0x1be')],_0xffb3('0x12f'))[_0xffb3('0x7f')](_0xffb3('0xfd')),'ContactId':_0x4c67f2[_0xffb3('0xd3')],'ListId':_0x4c67f2['ListId'],'VoiceQueueId':_0x4c67f2['VoiceQueueId']||undefined,'CampaignId':_0x4c67f2[_0xffb3('0xfe')]||undefined})['catch'](loggerCatch(_0xffb3('0x1bf')));}break;case 0xa:if(_0x4c67f2[_0xffb3('0xf6')]>=_0x4c39db['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4c67f2[_0xffb3('0xf6')]+=0x1,'scheduledat':moment()[_0xffb3('0xfc')](_0x4c39db[_0xffb3('0x121')],_0xffb3('0x12f'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c67f2['ContactId'],'ListId':_0x4c67f2['ListId'],'VoiceQueueId':_0x4c67f2[_0xffb3('0xd6')]||undefined,'CampaignId':_0x4c67f2['CampaignId']||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x126')));break;case 0xb:if(_0x4c67f2[_0xffb3('0xf7')]>=_0x4c39db['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x4c67f2['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x4c39db[_0xffb3('0x12d')],_0xffb3('0x12f'))[_0xffb3('0x7f')](_0xffb3('0xfd')),'ContactId':_0x4c67f2[_0xffb3('0xd3')],'ListId':_0x4c67f2[_0xffb3('0xd4')],'VoiceQueueId':_0x4c67f2[_0xffb3('0xd6')]||undefined,'CampaignId':_0x4c67f2['CampaignId']||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x130')));break;case 0x13:if(_0x4c67f2[_0xffb3('0xf0')]>=_0x4c39db[_0xffb3('0x107')]-0x1){return!![];}this[_0xffb3('0xc1')]({'active':![],'countmachineretry':_0x4c67f2[_0xffb3('0xf0')]+=0x1,'scheduledat':moment()[_0xffb3('0xfc')](_0x4c39db[_0xffb3('0x108')],_0xffb3('0x12f'))[_0xffb3('0x7f')](_0xffb3('0xfd')),'ContactId':_0x4c67f2[_0xffb3('0xd3')],'ListId':_0x4c67f2['ListId'],'VoiceQueueId':_0x4c67f2[_0xffb3('0xd6')]||undefined,'CampaignId':_0x4c67f2[_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xff')));break;case 0x14:if(_0x4c67f2[_0xffb3('0xf8')]>=_0x4c39db[_0xffb3('0x1c0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x4c67f2[_0xffb3('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x4c39db['dialAgentRejectRetryFrequency'],_0xffb3('0x12f'))[_0xffb3('0x7f')](_0xffb3('0xfd')),'ContactId':_0x4c67f2[_0xffb3('0xd3')],'ListId':_0x4c67f2['ListId'],'VoiceQueueId':_0x4c67f2[_0xffb3('0xd6')]||undefined,'CampaignId':_0x4c67f2[_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xffb3('0x1f')][_0xffb3('0x1b2')]=function(_0x1f74a3,_0x2525b9,_0x7ee49c){var _0x345a87=this;var _0x54674c=new History(_0x1f74a3);var _0x1017bb=![];var _0x2bffed;var _0xf68c6f;return new BPromise(function(_0x1809ad,_0x4af688){if(_[_0xffb3('0x44')](_0x2525b9)&&typeof _0x2525b9!==_0xffb3('0x185')){return _0x4af688(msgResponse(_0xffb3('0x1c1'),'Failure',_0xffb3('0x1c2')));}if(_[_0xffb3('0x44')](_0x7ee49c)&&typeof _0x7ee49c!==_0xffb3('0x185')){return _0x4af688(msgResponse(_0xffb3('0x1c1'),_0xffb3('0x159'),_0xffb3('0x1c3')));}_0x345a87[_0xffb3('0xbb')](_0x54674c,_0x7ee49c['reason'],_0x2525b9)[_0xffb3('0x42')](function(_0x3c3b1b){if(_0x3c3b1b[_0xffb3('0x124')]==0x1)_0x1017bb=!![];switch(_0x7ee49c[_0xffb3('0x1c4')]){case'0':_0x2525b9[_0xffb3('0x6a')]+=0x1;_0x54674c[_0xffb3('0xaa')]=0x0;_0x54674c[_0xffb3('0xab')]=_0xffb3('0x1c5');_0x54674c[_0xffb3('0xf5')]+=0x1;_0x54674c[_0xffb3('0xf1')]+=0x1;ami[_0xffb3('0xea')]('custom:agentnosuchnumber',ut[_0xffb3('0xec')](_0x1f74a3,'nosuchnumber'));_0x2bffed=_0x2525b9[_0xffb3('0x1be')];_0xf68c6f=_0x2525b9['callAdditionalPhoneAfterMin'];_0x345a87[_0xffb3('0xcc')](_0x54674c)['catch'](loggerCatch(_0xffb3('0x103')));if(_0x345a87[_0xffb3('0x1b4')](0x0,_0x1f74a3,_0x2525b9)&&!_0x1017bb){if(_0x54674c[_0xffb3('0xf5')]>=_0x2525b9[_0xffb3('0x1bd')]){_0x345a87[_0xffb3('0xfa')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1c6'));}else{_0x345a87[_0xffb3('0x105')](_0x54674c,_0x1809ad,_0x4af688,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2525b9[_0xffb3('0x69')]+=0x1;_0x54674c[_0xffb3('0xaa')]=0x3;_0x54674c[_0xffb3('0xab')]=_0xffb3('0x1c7');_0x54674c[_0xffb3('0xf4')]+=0x1;_0x54674c[_0xffb3('0xf1')]+=0x1;ami['emit'](_0xffb3('0x1c8'),ut[_0xffb3('0xec')](_0x1f74a3,'noanswer'));_0x2bffed=_0x2525b9[_0xffb3('0x1b6')];_0xf68c6f=_0x2525b9['callAdditionalPhoneAfterMin'];_0x345a87['createHistory'](_0x54674c)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x1c9')));if(_0x345a87[_0xffb3('0x1b4')](0x3,_0x1f74a3,_0x2525b9)&&!_0x1017bb){if(_0x54674c['countnoanswerretry']>=_0x2525b9['dialNoAnswerMaxRetry']){_0x345a87[_0xffb3('0xfa')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1ca'));}else{_0x345a87[_0xffb3('0x105')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1ca'));}}break;case'5':_0x2525b9[_0xffb3('0x65')]+=0x1;_0x54674c[_0xffb3('0xaa')]=0x5;_0x54674c[_0xffb3('0xab')]='Busy';_0x54674c['countbusyretry']+=0x1;_0x54674c[_0xffb3('0xf1')]+=0x1;ami[_0xffb3('0xea')](_0xffb3('0x1cb'),ut[_0xffb3('0xec')](_0x1f74a3,'busy'));_0x2bffed=_0x2525b9['dialBusyRetryFrequency'];_0xf68c6f=_0x2525b9[_0xffb3('0x122')];_0x345a87[_0xffb3('0xcc')](_0x54674c)['catch'](loggerCatch(_0xffb3('0x1cc')));if(_0x345a87[_0xffb3('0x1b4')](0x5,_0x1f74a3,_0x2525b9)&&!_0x1017bb){if(_0x54674c['countbusyretry']>=_0x2525b9[_0xffb3('0x1b8')]){_0x345a87[_0xffb3('0xfa')](_0x54674c,_0x1809ad,_0x4af688,'reason\x205\x20busy');}else{_0x345a87[_0xffb3('0x105')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1cd'));}}break;case'8':_0x2525b9['outboundCongestionCallsDay']+=0x1;_0x54674c[_0xffb3('0xaa')]=0x8;_0x54674c[_0xffb3('0xab')]=_0xffb3('0x1ce');_0x54674c[_0xffb3('0xf3')]+=0x1;_0x54674c[_0xffb3('0xf1')]+=0x1;_0x2bffed=_0x2525b9[_0xffb3('0x1bb')];_0xf68c6f=_0x2525b9[_0xffb3('0x122')];ami['emit'](_0xffb3('0x1cf'),ut['buildObj'](_0x1f74a3,'congestion'));_0x345a87[_0xffb3('0xcc')](_0x54674c)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x1d0')));if(_0x345a87[_0xffb3('0x1b4')](0x8,_0x1f74a3,_0x2525b9)&&!_0x1017bb){if(_0x54674c[_0xffb3('0xf3')]>=_0x2525b9[_0xffb3('0x1ba')]){_0x345a87[_0xffb3('0xfa')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1d1'));}else{_0x345a87['stateGlobal'](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1d1'));}}break;case'11':_0x2525b9[_0xffb3('0x1d2')]+=0x1;_0x54674c['state']=0xb;_0x54674c[_0xffb3('0xab')]=_0xffb3('0x12b');_0x54674c[_0xffb3('0xf7')]+=0x1;_0x54674c[_0xffb3('0xf1')]+=0x1;_0x2bffed=_0x2525b9[_0xffb3('0x12d')];_0xf68c6f=_0x2525b9[_0xffb3('0x122')];_0x345a87[_0xffb3('0xcc')](_0x54674c)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x132')));if(_0x345a87['checkRetriveMax'](0xb,_0x1f74a3,_0x2525b9)&&!_0x1017bb){if(_0x54674c['countabandonedretry']>=_0x2525b9[_0xffb3('0x12e')]){_0x345a87[_0xffb3('0xfa')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1d3'));}else{_0x345a87[_0xffb3('0x105')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1d3'));}}break;case'20':_0x2525b9[_0xffb3('0x6b')]+=0x1;_0x54674c[_0xffb3('0xaa')]=0x14;_0x54674c['statedesc']=_0xffb3('0x1d4');_0x54674c[_0xffb3('0xf8')]+=0x1;_0x54674c[_0xffb3('0xf1')]+=0x1;_0x2bffed=_0x2525b9[_0xffb3('0x1d5')];_0xf68c6f=_0x2525b9['callAdditionalPhoneAfterMin'];ami[_0xffb3('0xea')](_0xffb3('0x1d6'),ut['buildObj'](_0x1f74a3,_0xffb3('0x1d7')));_0x345a87['createHistory'](_0x54674c)['catch'](loggerCatch(_0xffb3('0x1d8')));if(_0x345a87[_0xffb3('0x1b4')](0x14,_0x1f74a3,_0x2525b9)&&!_0x1017bb){if(_0x54674c['countagentrejectretry']>=_0x2525b9[_0xffb3('0x1c0')]){_0x345a87['createStateFinal'](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1d9'));}else{_0x345a87[_0xffb3('0x105')](_0x54674c,_0x1809ad,_0x4af688,_0xffb3('0x1d9'));}}break;default:_0x2525b9[_0xffb3('0x6c')]+=0x1;_0x54674c[_0xffb3('0xaa')]=0xc;_0x54674c['statedesc']=_0x7ee49c[_0xffb3('0x1c4')];_0x2bffed=_0x2525b9[_0xffb3('0x1d5')];_0xf68c6f=_0x2525b9[_0xffb3('0x122')];_0x345a87['createHistory'](_0x54674c)[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x1da')));if(_0x345a87['checkRetriveMax'](_0x7ee49c[_0xffb3('0x1c4')],_0x1f74a3,_0x2525b9)&&!_0x1017bb){if(_0x54674c[_0xffb3('0x104')]+_0x54674c[_0xffb3('0xf3')]+_0x54674c['countnoanswerretry']+_0x54674c[_0xffb3('0xf5')]+_0x54674c[_0xffb3('0xf6')]+_0x54674c['countabandonedretry']+_0x54674c['countmachineretry']+_0x54674c[_0xffb3('0xf8')]>=_0x2525b9['dialGlobalMaxRetry']){_0x345a87['stateGlobal'](_0x54674c,_0x1809ad,_0x4af688,_0x7ee49c['reason']);}else{_0x345a87[_0xffb3('0xfa')](_0x54674c,_0x1809ad,_0x4af688,_0x7ee49c['reason']);}}}})['then'](function(_0x12a554){if(_0x1017bb){_0x345a87[_0xffb3('0xbd')](_0x54674c,_0x2bffed,_0xf68c6f)['then'](function(_0x624534){return _0x1809ad(0x1);});}});});};Dialer[_0xffb3('0x1f')][_0xffb3('0x105')]=function(_0x4db90d,_0x2f207b,_0xc95b24,_0x217f31){var _0x4a9c4c=new Final(_0x4db90d);_0x4a9c4c['state']=0xf;_0x4a9c4c[_0xffb3('0xab')]=_0xffb3('0x1db');this[_0xffb3('0xfa')](_0x4a9c4c,_0x2f207b,_0xc95b24,_0x217f31);};Dialer[_0xffb3('0x1f')][_0xffb3('0xfa')]=function(_0x541e96,_0x172e5a,_0x1f7606,_0x153120){this['moveContactManagedDialer'](_0x541e96)['then'](function(){return _0x172e5a(msgResponse(_0xffb3('0x1c1'),_0xffb3('0x1dc'),_0x153120));})[_0xffb3('0xb0')](function(){return _0x1f7606(msgResponse(_0xffb3('0x1dd'),_0xffb3('0x159'),_0xffb3('0x1de')));});};Dialer['prototype'][_0xffb3('0x8')]=function(_0x2e5cdc){var _0x22a456=_0x2e5cdc['dialPredictiveOptimizationPercentage']/0x64;var _0x7e7618=_0x2e5cdc['outboundDropCallsDayTimeout']/(_0x2e5cdc[_0xffb3('0x68')]+_0x2e5cdc[_0xffb3('0xe7')]);var _0x42e878=Math[_0xffb3('0x1df')](_0x2e5cdc[_0xffb3('0x75')]*(_0x2e5cdc[_0xffb3('0x1e0')]/0x64));var _0x3828df=Math['round'](_0x2e5cdc[_0xffb3('0x75')]*(_0x2e5cdc['predictiveIntervalMinThreshold']/0x64));var _0x295d6c=_0x2e5cdc[_0xffb3('0x56')]+_0x2e5cdc['talking'];var _0xd99a6b=Math[_0xffb3('0x1e1')](_0x2e5cdc[_0xffb3('0x1e2')]*_0x2e5cdc[_0xffb3('0x78')]*_0x2e5cdc[_0xffb3('0x72')]*_0x2e5cdc[_0xffb3('0x73')]);if(_[_0xffb3('0x44')](_0x2e5cdc['startProgressive'])){if(!_[_0xffb3('0x44')](_0x2e5cdc[_0xffb3('0x93')])){_0x2e5cdc[_0xffb3('0x93')]=undefined;loggerPredictive[_0xffb3('0x99')]('[startMethodPredictive][StartProgressive]',_0xffb3('0x1e3'));}if(!_[_0xffb3('0x44')](_0x2e5cdc['handlePredictive'])){loggerPredictive[_0xffb3('0x99')](_0xffb3('0x1e4'),_0xffb3('0x1e5'));clearInterval(_0x2e5cdc['handlePredictive']);_0x2e5cdc[_0xffb3('0x94')]=undefined;}_0x2e5cdc[_0xffb3('0x2f')]=moment()[_0xffb3('0x7f')](_0xffb3('0xfd'));loggerPredictive[_0xffb3('0x83')](_0x2e5cdc[_0xffb3('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x2e5cdc[_0xffb3('0x2f')]);this[_0xffb3('0x16b')](_0x2e5cdc,0x1);}else if(ifInterval(_0x2e5cdc[_0xffb3('0x1e6')],_0x2e5cdc['startProgressive'])){this[_0xffb3('0x16b')](_0x2e5cdc,0x1);loggerPredictiveCalls[_0xffb3('0x83')](_0xffb3('0x1e7'),_0x2e5cdc[_0xffb3('0x2f')],_0x2e5cdc[_0xffb3('0x46')]);_0x2e5cdc[_0xffb3('0x1e2')]=0x0;_0x2e5cdc['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x22a456<_0x7e7618&&_0x2e5cdc[_0xffb3('0x1e8')]===_0xffb3('0x1e9')){freeVariablesPredictive(_0x2e5cdc);loggerPredictive[_0xffb3('0x83')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x7e7618,_0xffb3('0x2f'),_0x2e5cdc[_0xffb3('0x46')]);}else if(_0xd99a6b<_0x2e5cdc['predictiveIntervalErlangCallsDroppedCalls']&&_0x2e5cdc[_0xffb3('0x1e8')]==='dropRate'){freeVariablesPredictive(_0x2e5cdc);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x1ea'),_0xffb3('0x1eb'),_0xd99a6b,'Drop\x20in\x20this\x20interval',_0x2e5cdc['predictiveIntervalErlangCallsDroppedCalls'],_0xffb3('0x2f'),_0x2e5cdc[_0xffb3('0x46')]);}else if(!ifInterval(_0x2e5cdc[_0xffb3('0x1e6')],_0x2e5cdc[_0xffb3('0x2f')])&&_[_0xffb3('0x44')](_0x2e5cdc[_0xffb3('0x93')])&&!_[_0xffb3('0x44')](_0x2e5cdc[_0xffb3('0x2f')])){_0x2e5cdc[_0xffb3('0x93')]=moment()[_0xffb3('0x7f')](_0xffb3('0xfd'));loggerPredictive[_0xffb3('0x83')](_0x2e5cdc['name'],_0xffb3('0x1ec'),_0x2e5cdc[_0xffb3('0x93')]);this[_0xffb3('0xc0')](_0x2e5cdc[_0xffb3('0x1e6')])['then'](this[_0xffb3('0x1ed')](_0x2e5cdc))['then'](mergeDataErlangB(_0x2e5cdc))['then'](this[_0xffb3('0x1ee')](_0x2e5cdc))[_0xffb3('0xb0')](loggerCatchPredictive(_0xffb3('0x1ef'),_0x2e5cdc));}else if(!ifInterval(_0x2e5cdc['dialPredictiveInterval'],_0x2e5cdc['startPredictive'])){_0x2e5cdc[_0xffb3('0x11d')]=0x0;_0x2e5cdc['startPredictive']=moment()['format'](_0xffb3('0xfd'));loggerPredictive['info'](_0x2e5cdc[_0xffb3('0x46')],_0xffb3('0x1f0'),_0x2e5cdc[_0xffb3('0x93')]);clearInterval(_0x2e5cdc[_0xffb3('0x94')]);_0x2e5cdc[_0xffb3('0x94')]=undefined;this[_0xffb3('0xc0')](_0x2e5cdc[_0xffb3('0x1e6')])['then'](this[_0xffb3('0x1ed')](_0x2e5cdc))[_0xffb3('0x42')](mergeDataErlangB(_0x2e5cdc))[_0xffb3('0x42')](this[_0xffb3('0x1ee')](_0x2e5cdc))[_0xffb3('0xb0')](loggerCatchPredictive(_0xffb3('0x1f1'),_0x2e5cdc));}else if(_0x2e5cdc[_0xffb3('0x75')]&&_0x295d6c<_0x2e5cdc['predictiveIntervalAvailable']-_0x3828df){freeVariablesPredictive(_0x2e5cdc);loggerPredictive[_0xffb3('0x83')](_0x2e5cdc[_0xffb3('0x46')],_0xffb3('0x1f2'),_0x295d6c,_0xffb3('0x1f3'),_0x2e5cdc[_0xffb3('0x75')],'-',_0x3828df,'=',_0x2e5cdc[_0xffb3('0x75')]-_0x3828df,')');}else if(_0x2e5cdc[_0xffb3('0x75')]&&_0x295d6c>_0x2e5cdc[_0xffb3('0x75')]+_0x42e878){freeVariablesPredictive(_0x2e5cdc);loggerPredictive[_0xffb3('0x83')](_0x2e5cdc[_0xffb3('0x46')],_0xffb3('0x1f2'),_0x295d6c,_0xffb3('0x1f4'),_0x2e5cdc[_0xffb3('0x75')],'+',_0x42e878,'=',_0x2e5cdc['predictiveIntervalAvailable']+_0x42e878,')');}};Dialer[_0xffb3('0x1f')][_0xffb3('0x1ed')]=function(_0xc3d0a7){var _0x35e8ef=this;return function(_0x32cf57){return new BPromise(function(_0x5be4df,_0x16da80){_[_0xffb3('0x91')](_0xc3d0a7,_0x32cf57[0x0]);if(checkGetDataPredictive(_0x32cf57[0x0])){var _0xe0c3ee=_0xc3d0a7[_0xffb3('0x75')]=_0xc3d0a7[_0xffb3('0x59')]+_0xc3d0a7[_0xffb3('0x56')];var _0x21acb1=_0xc3d0a7[_0xffb3('0x1e6')]*0x3c;var _0x3db5a1=_0x32cf57[0x0]['predictiveIntervalAvgTalktime']+_0x32cf57[0x0][_0xffb3('0x6e')];var _0x37cf80=(_0x32cf57[0x0][_0xffb3('0x6d')]+_0x32cf57[0x0][_0xffb3('0x11c')]+_0x32cf57[0x0][_0xffb3('0x70')])/_0x32cf57[0x0][_0xffb3('0x85')];_0xc3d0a7[_0xffb3('0x72')]=_0x37cf80>0x0?_0x37cf80:0x1;switch(_0xc3d0a7['dialPredictiveOptimization']){case _0xffb3('0x1e9'):var _0x328903=_0xc3d0a7[_0xffb3('0x1f5')]/0x64;return _0x35e8ef[_0xffb3('0x1f6')](_0xe0c3ee,_0x21acb1,_0x3db5a1,_0x37cf80,_0x328903)[_0xffb3('0x42')](function(_0x5a707d){return _0x5be4df(_0x5a707d);});case _0xffb3('0x1f7'):var _0x43febb=_0xc3d0a7['dialPredictiveOptimizationPercentage']/0x64;return _0x35e8ef[_0xffb3('0x1f8')](_0xe0c3ee,_0x21acb1,_0x3db5a1,_0x37cf80,_0x43febb)[_0xffb3('0x42')](function(_0x57e0a6){return _0x5be4df(_0x57e0a6);});default:return _0x16da80(msgResponse(_0xffb3('0x1f9'),_0xffb3('0x159'),_0xffb3('0x1fa')));}}else{return _0x16da80(msgResponse('[getDataPredictive]','Failure',_0xffb3('0x1fb')));}});};};Dialer[_0xffb3('0x1f')][_0xffb3('0x1fc')]=function(_0x34f870){var _0x10cf9f=this;return function(_0x5dfe39){return new BPromise(function(_0x1b9a73,_0x149dfe){_[_0xffb3('0x91')](_0x34f870,_0x5dfe39[0x0]);if(checkGetDataPredictive(_0x5dfe39[0x0])){loggerPredictive[_0xffb3('0x83')](JSON[_0xffb3('0x4f')](_0x5dfe39[0x0]));if(_0x34f870[_0xffb3('0x1e8')]===_0xffb3('0x1e9')){return _0x10cf9f[_0xffb3('0xc8')](_0x34f870['id'])[_0xffb3('0x42')](function(_0x155986){var _0x312117=_0x34f870['loggedIn']-_0x155986[0x0]['outboundQueuePauses'];var _0x407f90=_0x34f870[_0xffb3('0x1e6')]*0x3c;var _0x2540ed=_0x5dfe39[0x0][_0xffb3('0x6f')]+_0x5dfe39[0x0]['predictiveIntervalAvgHoldtime'];var _0x25f146=(_0x5dfe39[0x0]['predictiveIntervalAnsweredCalls']+_0x5dfe39[0x0][_0xffb3('0x11c')]+_0x5dfe39[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5dfe39[0x0][_0xffb3('0x85')];var _0x54f301=_0x34f870['dialPredictiveOptimizationPercentage']/0x64;_0x34f870['predictiveIntervalPauses']=_0x155986[0x0][_0xffb3('0x1fd')]||0x0;_0x34f870['predictiveIntervalHitRate']=_0x25f146>0x0?_0x25f146:0x1;return _0x10cf9f[_0xffb3('0x1f6')](_0x312117,_0x407f90,_0x2540ed,_0x25f146,_0x54f301);})[_0xffb3('0x42')](function(_0xfb06ed){return _0x1b9a73(_0xfb06ed);})[_0xffb3('0xb0')](function(_0xdd47a4){return _0x149dfe(msgResponse(_0xffb3('0x1fe'),_0xffb3('0x159'),JSON[_0xffb3('0x4f')](_0xdd47a4)));});}if(_0x34f870[_0xffb3('0x1e8')]===_0xffb3('0x1f7')){return _0x10cf9f[_0xffb3('0xc8')](_0x34f870['id'])[_0xffb3('0x42')](function(_0x46c3c5){var _0x4cac84=_0x34f870[_0xffb3('0x170')]-_0x46c3c5[0x0]['outboundQueuePauses'];var _0x218158=_0x34f870[_0xffb3('0x1e6')]*0x3c;var _0x1e46ff=_0x5dfe39[0x0][_0xffb3('0x6f')]+_0x5dfe39[0x0][_0xffb3('0x6e')];var _0x1fbe06=(_0x5dfe39[0x0][_0xffb3('0x6d')]+_0x5dfe39[0x0][_0xffb3('0x11c')]+_0x5dfe39[0x0][_0xffb3('0x70')])/_0x5dfe39[0x0]['predictiveIntervalTotalCalls'];var _0x1b1e6c=_0x34f870[_0xffb3('0x1f5')]/0x64;_0x34f870[_0xffb3('0x74')]=_0x46c3c5[0x0]['outboundQueuePauses']||0x0;_0x34f870[_0xffb3('0x72')]=_0x1fbe06>0x0?_0x1fbe06:0x1;return _0x10cf9f['busyFactor'](_0x4cac84,_0x218158,_0x1e46ff,_0x1fbe06,_0x1b1e6c);})[_0xffb3('0x42')](function(_0x1e2540){return _0x1b9a73(_0x1e2540);})[_0xffb3('0xb0')](function(_0x5d8be7){return _0x149dfe(msgResponse('[CatchErlangB]',_0xffb3('0x159'),JSON[_0xffb3('0x4f')](_0x5d8be7)));});}}else{return _0x149dfe(msgResponse('[getDataPredictive]',_0xffb3('0x159'),_0xffb3('0x1fb')));}});};};Dialer[_0xffb3('0x1f')][_0xffb3('0x1ee')]=function(_0x36bcc8){var _0x23ac39=this;return function(){var _0x744a7e=0x0;var _0x5b72b7=Math[_0xffb3('0x1e1')](_0x36bcc8[_0xffb3('0x77')]*0x3e8);if(_0x5b72b7>0x0){_0x5b72b7=_0x5b72b7<0x64?0x64:_0x5b72b7;loggerPredictive['info'](_0x36bcc8['name'],_0xffb3('0x1ff'),_0x5b72b7,'milliseconds');_0x36bcc8['handlePredictive']=setInterval(function(){_0x23ac39[_0xffb3('0x94')](_0x36bcc8);loggerPredictiveCalls[_0xffb3('0x83')](_0xffb3('0x200'),_0x744a7e+=0x1);},_0x5b72b7);}else{loggerPredictive[_0xffb3('0x83')](_0x36bcc8['name'],_0xffb3('0x201'));}};};Dialer[_0xffb3('0x1f')][_0xffb3('0x202')]=function(_0x3e2d83,_0xecb83f){var _0x151769=this;return function(_0x3daf63){if(_[_0xffb3('0x4d')](_0x3daf63)){if(_[_0xffb3('0xdf')](_0xecb83f['UserId'])||!_0xecb83f[_0xffb3('0x203')]){if(_0x3e2d83[_0xffb3('0x16f')]==='booked'){_0x3e2d83[_0xffb3('0x13a')]=_[_0xffb3('0x44')](_0x3e2d83[_0xffb3('0x13a')])?!![]:_0x3e2d83[_0xffb3('0x13a')];var _0x42dfcc=uuid['v4']();_0x151769[_0xffb3('0x2b')][_0x42dfcc]=new Action(_0x3e2d83,_0xecb83f,_0x42dfcc);loggerBooked['info'](_0xffb3('0x204'),_0x42dfcc,_0xffb3('0x205'),JSON[_0xffb3('0x4f')](_0x3e2d83[_0xffb3('0x13a')]),'Queue:\x20',_0x3e2d83[_0xffb3('0x46')]);if(_0x3e2d83['queueStatusComplete']){_0x3e2d83[_0xffb3('0x13a')]=![];_0x151769[_0xffb3('0x138')][_0x151769['actions'][_0x42dfcc]['queue']]=[];ami[_0xffb3('0x15b')]({'actionid':_0x42dfcc,'action':'queuestatus','queue':_0x3e2d83[_0xffb3('0x46')]})[_0xffb3('0xb0')](function(){_0x151769[_0xffb3('0xb2')](_0x3e2d83);_0x151769[_0xffb3('0xc1')]({'active':![],'ContactId':_0x151769[_0xffb3('0x2b')][_0x42dfcc][_0xffb3('0xd3')],'ListId':_0x151769['actions'][_0x42dfcc][_0xffb3('0xd4')],'VoiceQueueId':_0x151769[_0xffb3('0x2b')][_0x42dfcc][_0xffb3('0xd6')]||undefined,'CampaignId':_0x151769[_0xffb3('0x2b')][_0x42dfcc][_0xffb3('0xfe')]||undefined})['catch'](loggerCatch(_0xffb3('0x206')));delete _0x151769[_0xffb3('0x2b')][_0x42dfcc];});}else{loggerBooked[_0xffb3('0x83')](_0xffb3('0x207'),JSON[_0xffb3('0x4f')](_0x3e2d83[_0xffb3('0x13a')]),'Queue:\x20',_0x3e2d83[_0xffb3('0x46')]);_0x151769['updateOriginated'](_0x3e2d83);_0x151769[_0xffb3('0xc1')]({'active':![],'ContactId':_0x151769[_0xffb3('0x2b')][_0x42dfcc][_0xffb3('0xd3')],'ListId':_0x151769[_0xffb3('0x2b')][_0x42dfcc][_0xffb3('0xd4')],'VoiceQueueId':_0x151769[_0xffb3('0x2b')][_0x42dfcc]['VoiceQueueId']||undefined,'CampaignId':_0x151769[_0xffb3('0x2b')][_0x42dfcc][_0xffb3('0xfe')]||undefined})[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x206')));delete _0x151769[_0xffb3('0x2b')][_0x42dfcc];}}else{return _0x151769[_0xffb3('0x184')](_0x3e2d83,_0xecb83f);}}else{if(getDiff(_0xecb83f[_0xffb3('0x208')])<_0x3e2d83[_0xffb3('0x209')]*0x3c){if(_0xecb83f['Agent']&&!_0xecb83f[_0xffb3('0x17a')][_0xffb3('0x20a')]){_0x151769[_0xffb3('0x24')][_0xffb3('0x13d')](_0xecb83f['id'])[_0xffb3('0x22')](function(){_0x151769[_0xffb3('0xb2')](_0x3e2d83);});}else{_0x151769[_0xffb3('0xc3')]({'active':![]},_0xecb83f['id'],0x1)[_0xffb3('0x22')](function(){_0x151769[_0xffb3('0xb2')](_0x3e2d83);});}}else{_0x3e2d83[_0xffb3('0x20b')]+=0x1;_0x151769[_0xffb3('0xb2')](_0x3e2d83);if(_0x3e2d83[_0xffb3('0x20c')]){_0x151769['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xecb83f[_0xffb3('0xd3')],'ListId':_0xecb83f[_0xffb3('0xd4')],'VoiceQueueId':_0xecb83f[_0xffb3('0xd6')]||undefined,'CampaignId':_0xecb83f['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x151769[_0xffb3('0xcc')](createObjHistory(_0x3e2d83,_0xecb83f,'RECALLINQUEUE',0x17,_0xffb3('0x20d')))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0x20e')));}else{_0x151769[_0xffb3('0xd1')](createObjHistory(_0x3e2d83,_0xecb83f,_0xffb3('0x20f'),0x16,_0xffb3('0x210')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x3e2d83[_0xffb3('0x211')]+=0x1;_0x151769['saveInDb'](createObjHistory(_0x3e2d83,_0xecb83f,_0xffb3('0x212'),0xd,_0xffb3('0x213')),_0xffb3('0x214'),_0xffb3('0x215'));throw _0xffb3('0x216');}};};Dialer[_0xffb3('0x1f')][_0xffb3('0x217')]=function(_0x4dd5e7){var _0x15844a=this;var _0x14d54f=_0x4dd5e7[_0xffb3('0x218')]-_0x4dd5e7['originated']-_0x4dd5e7[_0xffb3('0xc5')];emitCampaignSummary(_0x4dd5e7);if(_0x14d54f>0x0){if(_0x14d54f>this[_0xffb3('0x29')]){_0x14d54f=this[_0xffb3('0x29')];}_0x4dd5e7['temp']+=_0x14d54f;this['getContactDialerIvr'](_0x4dd5e7['id'],_0x14d54f,_0x4dd5e7[_0xffb3('0x219')],_0x4dd5e7)[_0xffb3('0x42')](function(_0x2cbd9f){_0x4dd5e7[_0xffb3('0xc5')]-=_0x14d54f;_0x4dd5e7['temp']=_0x4dd5e7[_0xffb3('0xc5')]>0x0?_0x4dd5e7[_0xffb3('0xc5')]:0x0;if(!checkContactEmpty(_0x2cbd9f)){_0x4dd5e7['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xffb3('0x83')](_0xffb3('0x21a')+_0x4dd5e7['name']);}else{_0x4dd5e7[_0xffb3('0x76')]+=_0x2cbd9f[_0xffb3('0x9c')];_0x4dd5e7[_0xffb3('0x45')]=_0xffb3('0x21b');for(var _0x190742=0x0;_0x190742<_0x2cbd9f['length'];_0x190742+=0x1){_0x4dd5e7[_0xffb3('0x21c')]+=0x1;if(_['isNil'](_0x2cbd9f[_0x190742])||_[_0xffb3('0xdf')](_0x2cbd9f[_0x190742][_0xffb3('0x19f')])||_[_0xffb3('0xdf')](_0x2cbd9f[_0x190742][_0xffb3('0x188')])){_0x15844a[_0xffb3('0xd0')](_0xffb3('0x21d'),_0x4dd5e7,_0x2cbd9f[_0x190742]);}else{_0x15844a[_0xffb3('0xbe')](_['pick'](_0x2cbd9f[_0x190742],[_0xffb3('0xfe'),'Contact.phone']))[_0xffb3('0x42')](_0x15844a['checkContactBlack'](_0x4dd5e7,_0x2cbd9f[_0x190742]))['catch'](_0x15844a[_0xffb3('0x21e')](_0xffb3('0x21f'),_0x4dd5e7));}}}})[_0xffb3('0xb0')](loggerGetContactDialer(_0xffb3('0x220'),_0x4dd5e7,_0x14d54f));}};Dialer[_0xffb3('0x1f')][_0xffb3('0x16b')]=function(_0x274bf5,_0x722d0a){var _0x3af56b=this;var _0x3abb7e=[];var _0x3c5067=_0x722d0a>=0x1?_0x722d0a:0x1;if(_0x274bf5[_0xffb3('0x16f')]==='booked'){_0x3c5067=0x1;}var _0x5e0450=Math[_0xffb3('0x1e1')](_0x274bf5[_0xffb3('0x56')]*_0x3c5067)-_0x274bf5[_0xffb3('0x76')]-_0x274bf5['temp'];emitVoiceQueueSummary(_0x274bf5);if(_0x274bf5['dialLimitQueue']>0x0){var _0x419819=_0x274bf5[_0xffb3('0x221')]-_0x274bf5[_0xffb3('0x76')]-_0x274bf5['talking']-_0x274bf5['temp']-_0x274bf5[_0xffb3('0x57')];if(_0x5e0450>_0x419819){_0x5e0450=_0x419819;}}if(_0x5e0450>0x0){if(_0x274bf5['dialMethod']==='booked'){_0x5e0450=0x1;}if(_0x5e0450>this[_0xffb3('0x29')]){_0x5e0450=this[_0xffb3('0x29')];}_0x274bf5[_0xffb3('0xc5')]+=_0x5e0450;for(var _0x4e1031 in this['agents']){if(typeof this[_0xffb3('0x27')][_0x4e1031]!==_0xffb3('0x9d')){if(this[_0xffb3('0x27')][_0x4e1031][_0xffb3('0xaa')]===_0xffb3('0x222')&&this[_0xffb3('0x27')][_0x4e1031][_0xffb3('0xdb')]==='reachable'){_0x3abb7e[_0xffb3('0x162')](this[_0xffb3('0x27')][_0x4e1031]['id']);}}}this['getContactDialer'](_0x274bf5['id'],_0x3abb7e,_0x5e0450,_0x274bf5['dialOrderByScheduledAt'],_0x274bf5)[_0xffb3('0x42')](function(_0x50ac67){_0x274bf5[_0xffb3('0xc5')]-=_0x5e0450;_0x274bf5[_0xffb3('0xc5')]=_0x274bf5[_0xffb3('0xc5')]>0x0?_0x274bf5[_0xffb3('0xc5')]:0x0;if(!checkContactEmpty(_0x50ac67)){_0x3af56b['countReScheduled'](_0x274bf5)['then'](sendMessageReschedule(_0x274bf5))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xb8')));}else{_0x274bf5[_0xffb3('0x76')]+=_0x50ac67[_0xffb3('0x9c')];_0x274bf5['message']=_0x274bf5[_0xffb3('0x16f')]==='booked'?'ACTIVE':_0xffb3('0x21b');for(var _0x5ec639=0x0;_0x5ec639<_0x50ac67[_0xffb3('0x9c')];_0x5ec639+=0x1){if(_[_0xffb3('0xdf')](_0x50ac67[_0x5ec639])||_[_0xffb3('0xdf')](_0x50ac67[_0x5ec639]['Contact'])||_[_0xffb3('0xdf')](_0x50ac67[_0x5ec639][_0xffb3('0x188')])){_0x3af56b[_0xffb3('0xd0')](_0xffb3('0x21d'),_0x274bf5,_0x50ac67[_0x5ec639]);}else{_0x3af56b[_0xffb3('0xb9')](_[_0xffb3('0xd2')](_0x50ac67[_0x5ec639],[_0xffb3('0xd6'),_0xffb3('0x223')]))[_0xffb3('0x42')](_0x3af56b['checkContactBlack'](_0x274bf5,_0x50ac67[_0x5ec639]))[_0xffb3('0xb0')](_0x3af56b['loggerHandler'](_0xffb3('0x21d'),_0x274bf5));}}}})[_0xffb3('0xb0')](loggerGetContactDialer(_0xffb3('0x224'),_0x274bf5,_0x5e0450));}};Dialer['prototype'][_0xffb3('0x94')]=function(_0x515122){if(_0x515122[_0xffb3('0x221')]>0x0){var _0x29c106=_0x515122['dialLimitQueue']-_0x515122[_0xffb3('0x76')]-_0x515122['talking'];if(_0x29c106>0x0){this[_0xffb3('0x225')](_0x515122);}else{loggerPredictiveCalls[_0xffb3('0x83')](_0xffb3('0x226'));}}else{this[_0xffb3('0x225')](_0x515122);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x4e3c43){var _0x101ad8=this;var _0x4e87f7=[];_0x4e3c43[_0xffb3('0x76')]+=0x1;for(var _0x88cd99 in this[_0xffb3('0x27')]){if(typeof this[_0xffb3('0x27')][_0x88cd99]!==_0xffb3('0x9d')){if(this['agents'][_0x88cd99][_0xffb3('0xaa')]===_0xffb3('0x222')&&this[_0xffb3('0x27')][_0x88cd99]['status']===_0xffb3('0xdc')){_0x4e87f7[_0xffb3('0x162')](this[_0xffb3('0x27')][_0x88cd99]['id']);}}}this['getContactDialer'](_0x4e3c43['id'],_0x4e87f7,0x1,_0x4e3c43[_0xffb3('0x219')],_0x4e3c43)[_0xffb3('0x42')](function(_0x123d4c){if(!checkContactEmpty(_0x123d4c)){checkContactLowerLimitOriginate(_0x4e3c43,0x1,0x0);_0x101ad8['countReScheduled'](_0x4e3c43)[_0xffb3('0x42')](sendMessageReschedule(_0x4e3c43))[_0xffb3('0xb0')](loggerCatch(_0xffb3('0xb8')));}else{_0x4e3c43[_0xffb3('0x45')]=_0xffb3('0x21b');if(_[_0xffb3('0xdf')](_0x123d4c[0x0])||_[_0xffb3('0xdf')](_0x123d4c[0x0][_0xffb3('0x19f')])||_[_0xffb3('0xdf')](_0x123d4c[0x0][_0xffb3('0x188')])){_0x101ad8[_0xffb3('0xd0')](_0xffb3('0x21d'),_0x4e3c43,_0x123d4c[0x0]);}else{_0x101ad8[_0xffb3('0xb9')](_[_0xffb3('0xd2')](_0x123d4c[0x0],['VoiceQueueId',_0xffb3('0x223')]))['then'](_0x101ad8[_0xffb3('0x202')](_0x4e3c43,_0x123d4c[0x0]))['catch'](_0x101ad8[_0xffb3('0x21e')](_0xffb3('0x227'),_0x4e3c43));}}})[_0xffb3('0xb0')](loggerGetContactDialer('[getContactDialerPredictive]',_0x4e3c43,0x1));emitVoiceQueueSummary(_0x4e3c43);};Dialer[_0xffb3('0x1f')][_0xffb3('0x1f6')]=function(_0x8ea3dd,_0x3ea03e,_0x341736,_0x15191d,_0x58e89e,_0x1003c7){loggerPredictive[_0xffb3('0x83')](_0xffb3('0x228'));loggerPredictive['info'](_0xffb3('0x229'),_0x8ea3dd);loggerPredictive[_0xffb3('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ea03e);loggerPredictive['info'](_0xffb3('0x22a'),_0x341736);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x22b'),_0x15191d);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x22c'),_0x58e89e);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x90'));return new BPromise(function(_0xf051ae,_0x293659){if(_0x8ea3dd<=0x0||isNaN(_0x8ea3dd)){return _0x293659(msgResponse(_0xffb3('0x22d'),_0xffb3('0x4e'),'m\x20=\x20'+_0x8ea3dd));}if(_0x341736<=0x0||isNaN(_0x341736)){return _0x293659(msgResponse(_0xffb3('0x22d'),'Error',_0xffb3('0x22e')+_0x341736));}if(_0x15191d<=0x0||isNaN(_0x15191d)){return _0x293659(msgResponse('[abandonmentRate]',_0xffb3('0x4e'),_0xffb3('0x22f')+_0x15191d));}if(_0x3ea03e<=0x0||isNaN(_0x3ea03e)){return _0x293659(msgResponse('[abandonmentRate]',_0xffb3('0x4e'),_0xffb3('0x230')+_0x3ea03e));}if(_0x58e89e<=0x0||isNaN(_0x58e89e)){return _0x293659(msgResponse(_0xffb3('0x22d'),'Error',_0xffb3('0x231')+_0x58e89e));}_0x1003c7=_0x1003c7||0x0;var _0x30bb13=0x1/_0x341736;var _0x499051=0x0;var _0x340001=0x0;var _0x3910f=0x0;var _0x41e962=0x0;for(var _0x3ece6e=0x0;_0x3910f<_0x58e89e;_0x3ece6e+=0x1){_0x340001=_0x3ece6e/_0x3ea03e;_0x499051=(_0x15191d*_0x340001+_0x1003c7)/_0x30bb13;_0x3910f=erlangb(_0x499051,_0x8ea3dd);_0x41e962=_0x499051/_0x8ea3dd*(0x1-erlangb(_0x499051,_0x8ea3dd));}return _0xf051ae({'erlangCalls':_0x3ece6e,'erlangCallToSecond':_0x3ea03e/_0x3ece6e,'erlangAbandonmentRate':_0x3910f,'erlangBusyFactor':_0x41e962});});};Dialer['prototype'][_0xffb3('0x1f8')]=function(_0x2a2977,_0x2a3fa5,_0x3c0f30,_0x4a1fd2,_0x318e39,_0x4403df){loggerPredictive[_0xffb3('0x83')](_0xffb3('0x232'));loggerPredictive[_0xffb3('0x83')](_0xffb3('0x229'),_0x2a2977);loggerPredictive[_0xffb3('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a3fa5);loggerPredictive[_0xffb3('0x83')]('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',_0x3c0f30);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x22b'),_0x4a1fd2);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x233'),_0x318e39);loggerPredictive[_0xffb3('0x83')](_0xffb3('0x90'));return new BPromise(function(_0x34ae51,_0xef6894){if(_0x2a2977<=0x0||isNaN(_0x2a2977)){return _0xef6894(msgResponse(_0xffb3('0x234'),_0xffb3('0x4e'),_0xffb3('0x235')+_0x2a2977));}if(_0x3c0f30<=0x0||isNaN(_0x3c0f30)){return _0xef6894(msgResponse('[busyFactor]',_0xffb3('0x4e'),_0xffb3('0x22e')+_0x3c0f30));}if(_0x4a1fd2<=0x0||isNaN(_0x4a1fd2)){return _0xef6894(msgResponse(_0xffb3('0x234'),_0xffb3('0x4e'),'p\x20=\x20'+_0x4a1fd2));}if(_0x2a3fa5<=0x0||isNaN(_0x2a3fa5)){return _0xef6894(msgResponse(_0xffb3('0x234'),_0xffb3('0x4e'),_0xffb3('0x230')+_0x2a3fa5));}if(_0x318e39<=0x0||isNaN(_0x318e39)){return _0xef6894(msgResponse(_0xffb3('0x234'),_0xffb3('0x4e'),_0xffb3('0x236')+_0x318e39));}_0x4403df=_0x4403df||0x0;var _0x849697=0x1/_0x3c0f30;var _0x31bb19=0x0;var _0x4c325f=0x0;var _0x40763f=0x0;var _0x38d09f=0x0;for(var _0x565282=0x0;_0x38d09f<_0x318e39;_0x565282+=0x1){_0x4c325f=_0x565282/_0x2a3fa5;_0x31bb19=(_0x4a1fd2*_0x4c325f+_0x4403df)/_0x849697;_0x40763f=erlangb(_0x31bb19,_0x2a2977);_0x38d09f=_0x31bb19/_0x2a2977*(0x1-erlangb(_0x31bb19,_0x2a2977));}return _0x34ae51({'erlangCalls':_0x565282,'erlangCallToSecond':_0x2a3fa5/_0x565282,'erlangAbandonmentRate':_0x40763f,'erlangBusyFactor':_0x38d09f});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 2e550e0..5a44131 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 _0xf01c=['connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','queue','membername'];(function(_0x1724f2,_0x2ec946){var _0x4e5725=function(_0x568cab){while(--_0x568cab){_0x1724f2['push'](_0x1724f2['shift']());}};_0x4e5725(++_0x2ec946);}(_0xf01c,0x165));var _0xcf01=function(_0x29e100,_0x4d7a2d){_0x29e100=_0x29e100-0x0;var _0x5cbc6c=_0xf01c[_0x29e100];return _0x5cbc6c;};'use strict';var util=require(_0xcf01('0x0'));var _=require(_0xcf01('0x1'));var moment=require(_0xcf01('0x2'));function getSeconds(_0x5bb9a9,_0x56db2a){var _0x6edc0c=moment(_0x5bb9a9)[_0xcf01('0x3')](0x0);var _0x32b072=moment(_0x56db2a)['milliseconds'](0x0);return _0x6edc0c[_0xcf01('0x4')](_0x32b072,_0xcf01('0x5'));}function QueueCallerAbandon(_0x2bcf01,_0x52d06e){this['scheduledat']=_0x2bcf01[_0xcf01('0x6')];this[_0xcf01('0x7')]=_0x2bcf01[_0xcf01('0x7')];this['campaigntype']=_0x2bcf01[_0xcf01('0x7')]==='outbound'?'queue':_0x2bcf01[_0xcf01('0x7')];this[_0xcf01('0x8')]=_0x2bcf01[_0xcf01('0x8')];this['countcongestionretry']=_0x2bcf01[_0xcf01('0x9')];this[_0xcf01('0xa')]=_0x2bcf01[_0xcf01('0xa')];this[_0xcf01('0xb')]=_0x2bcf01[_0xcf01('0x8')]+_0x2bcf01[_0xcf01('0x9')]+_0x2bcf01[_0xcf01('0xa')]+_0x2bcf01[_0xcf01('0xc')]+_0x2bcf01[_0xcf01('0xd')]+_0x2bcf01['countabandonedretry']+_0x2bcf01[_0xcf01('0xe')]+_0x2bcf01[_0xcf01('0xf')];this[_0xcf01('0xc')]=_0x2bcf01[_0xcf01('0xc')];this[_0xcf01('0xd')]=_0x2bcf01[_0xcf01('0xd')];this[_0xcf01('0x10')]=_0x2bcf01[_0xcf01('0x10')];this[_0xcf01('0xe')]=_0x2bcf01[_0xcf01('0xe')];this[_0xcf01('0xf')]=_0x2bcf01['countagentrejectretry'];this[_0xcf01('0x11')]=_0x52d06e['uniqueid'];this[_0xcf01('0x12')]=_0x2bcf01[_0xcf01('0x13')];this[_0xcf01('0x14')]=_0x2bcf01[_0xcf01('0x15')];this[_0xcf01('0x16')]=_0x2bcf01[_0xcf01('0x16')];this[_0xcf01('0x17')]=_0x2bcf01[_0xcf01('0x17')];this['droptime']=_0x2bcf01[_0xcf01('0x18')];this['endtime']=this[_0xcf01('0x18')];this[_0xcf01('0x19')]=getSeconds(_0x2bcf01[_0xcf01('0x17')],_0x2bcf01[_0xcf01('0x16')]);this[_0xcf01('0x1a')]=getSeconds(this[_0xcf01('0x18')],_0x2bcf01[_0xcf01('0x17')]);this[_0xcf01('0x1b')]=0x0;this[_0xcf01('0x1c')]=_0x52d06e[_0xcf01('0x1c')];this[_0xcf01('0x1d')]=_0x52d06e[_0xcf01('0x1e')];this[_0xcf01('0x1f')]=_0x52d06e[_0xcf01('0x1f')];this[_0xcf01('0x20')]=_0x2bcf01[_0xcf01('0x20')];this['callbackuniqueid']=_0x2bcf01['callbackuniqueid'];this[_0xcf01('0x21')]=_0x2bcf01[_0xcf01('0x21')];this[_0xcf01('0x22')]=_0x2bcf01[_0xcf01('0x22')];this[_0xcf01('0x23')]=_0x2bcf01[_0xcf01('0x23')];this['ListId']=_0x2bcf01[_0xcf01('0x24')];this[_0xcf01('0x25')]=_0x2bcf01[_0xcf01('0x25')];this['VoiceQueueId']=_0x2bcf01[_0xcf01('0x26')];this['CampaignId']=_0x2bcf01[_0xcf01('0x27')];this[_0xcf01('0x28')]=_0x2bcf01[_0xcf01('0x28')]||'';this[_0xcf01('0x29')]=_0x2bcf01['originatecalleridname']||'';}module[_0xcf01('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x1dfe=['calleridname','name','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x1dfe,0x69));var _0xe1df=function(_0x5bacf8,_0x7960e4){_0x5bacf8=_0x5bacf8-0x0;var _0xfdce24=_0x1dfe[_0x5bacf8];return _0xfdce24;};'use strict';var util=require(_0xe1df('0x0'));var _=require(_0xe1df('0x1'));var moment=require(_0xe1df('0x2'));function getSeconds(_0x3969ce,_0x4dba5a){var _0x58e46b=moment(_0x3969ce)[_0xe1df('0x3')](0x0);var _0xce53d8=moment(_0x4dba5a)['milliseconds'](0x0);return _0x58e46b[_0xe1df('0x4')](_0xce53d8,'seconds');}function QueueCallerAbandon(_0x4eacbe,_0x555e4b){this[_0xe1df('0x5')]=_0x4eacbe[_0xe1df('0x5')];this[_0xe1df('0x6')]=_0x4eacbe[_0xe1df('0x6')];this[_0xe1df('0x7')]=_0x4eacbe[_0xe1df('0x6')]==='outbound'?_0xe1df('0x8'):_0x4eacbe[_0xe1df('0x6')];this[_0xe1df('0x9')]=_0x4eacbe[_0xe1df('0x9')];this[_0xe1df('0xa')]=_0x4eacbe['countcongestionretry'];this[_0xe1df('0xb')]=_0x4eacbe[_0xe1df('0xb')];this['countglobal']=_0x4eacbe[_0xe1df('0x9')]+_0x4eacbe[_0xe1df('0xa')]+_0x4eacbe['countnoanswerretry']+_0x4eacbe[_0xe1df('0xc')]+_0x4eacbe[_0xe1df('0xd')]+_0x4eacbe[_0xe1df('0xe')]+_0x4eacbe[_0xe1df('0xf')]+_0x4eacbe[_0xe1df('0x10')];this[_0xe1df('0xc')]=_0x4eacbe[_0xe1df('0xc')];this[_0xe1df('0xd')]=_0x4eacbe['countdropretry'];this[_0xe1df('0xe')]=_0x4eacbe[_0xe1df('0xe')];this[_0xe1df('0xf')]=_0x4eacbe[_0xe1df('0xf')];this[_0xe1df('0x10')]=_0x4eacbe[_0xe1df('0x10')];this[_0xe1df('0x11')]=_0x555e4b[_0xe1df('0x11')];this[_0xe1df('0x12')]=_0x4eacbe[_0xe1df('0x13')];this['calleridnum']=_0x4eacbe['number'];this['starttime']=_0x4eacbe[_0xe1df('0x14')];this['responsetime']=_0x4eacbe[_0xe1df('0x15')];this['droptime']=_0x4eacbe[_0xe1df('0x16')];this[_0xe1df('0x17')]=this['droptime'];this[_0xe1df('0x18')]=getSeconds(_0x4eacbe[_0xe1df('0x15')],_0x4eacbe[_0xe1df('0x14')]);this[_0xe1df('0x19')]=getSeconds(this[_0xe1df('0x16')],_0x4eacbe[_0xe1df('0x15')]);this[_0xe1df('0x1a')]=0x0;this[_0xe1df('0x8')]=_0x555e4b[_0xe1df('0x8')];this['membername']=_0x555e4b[_0xe1df('0x1b')];this['reason']=_0x555e4b[_0xe1df('0x1c')];this[_0xe1df('0x1d')]=_0x4eacbe['callback'];this['callbackuniqueid']=_0x4eacbe[_0xe1df('0x1e')];this['callbackat']=_0x4eacbe[_0xe1df('0x1f')];this[_0xe1df('0x20')]=_0x4eacbe[_0xe1df('0x20')];this[_0xe1df('0x21')]=_0x4eacbe[_0xe1df('0x21')];this[_0xe1df('0x22')]=_0x4eacbe['ListId'];this['UserId']=_0x4eacbe[_0xe1df('0x23')];this[_0xe1df('0x24')]=_0x4eacbe['VoiceQueueId'];this[_0xe1df('0x25')]=_0x4eacbe[_0xe1df('0x25')];this[_0xe1df('0x26')]=_0x4eacbe['originatecalleridnum']||'';this['originatecalleridname']=_0x4eacbe[_0xe1df('0x27')]||'';}module[_0xe1df('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 078bae2..9cec9b5 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(_0x3df940,_0x1427c2){var _0x3537a7=function(_0x5924df){while(--_0x5924df){_0x3df940['push'](_0x3df940['shift']());}};_0x3537a7(++_0x1427c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x7844b9,_0x579e6a){var _0x4e9db6=function(_0x319afb){while(--_0x319afb){_0x7844b9['push'](_0x7844b9['shift']());}};_0x4e9db6(++_0x579e6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 94a9f10..14d6bb4 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 _0x3057=['addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','../../../config/logger','fax','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','hasOwnProperty','exten','uniqueid','channel','channels','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','catch','\x20notify\x20','\x20receiveFax\x20','stringify','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x3057,0xf8));var _0x7305=function(_0x5e76f9,_0x216784){_0x5e76f9=_0x5e76f9-0x0;var _0x44b2d9=_0x3057[_0x5e76f9];return _0x44b2d9;};'use strict';var util=require(_0x7305('0x0'));var _=require(_0x7305('0x1'));var BPromise=require(_0x7305('0x2'));var uuid=require(_0x7305('0x3'));var moment=require('moment');var path=require(_0x7305('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x7305('0x5'))(_0x7305('0x6'));var ami=require(_0x7305('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x7305('0x8'));var ut=require(_0x7305('0x9'));var Action=require('./action');var faxAccount=require(_0x7305('0xa'));var attachment=require(_0x7305('0xb'));var faxMessage=require(_0x7305('0xc'));function Fax(_0x5b7832){this['channels']={};this[_0x7305('0xd')]=_0x5b7832[_0x7305('0xd')];this[_0x7305('0xe')]=_0x5b7832['trunks'];this[_0x7305('0xf')]={};ami['on'](_0x7305('0x10'),this[_0x7305('0x11')]['bind'](this));ami['on'](_0x7305('0x12'),this[_0x7305('0x13')][_0x7305('0x14')](this));ami['on'](_0x7305('0x15'),this[_0x7305('0x16')][_0x7305('0x14')](this));ami['on'](_0x7305('0x17'),this[_0x7305('0x18')][_0x7305('0x14')](this));ami['on'](_0x7305('0x19'),this[_0x7305('0x1a')]['bind'](this));ami['on'](_0x7305('0x1b'),this[_0x7305('0x1c')]['bind'](this));ami['on'](_0x7305('0x1d'),this[_0x7305('0x1e')]['bind'](this));ami['on'](_0x7305('0x1f'),this['syncOriginateResponse'][_0x7305('0x14')](this));}Fax[_0x7305('0x20')][_0x7305('0x11')]=function(_0x614bb7){if(_0x614bb7[_0x7305('0x21')]==='from-voip-provider'){for(var _0x543b3e in this[_0x7305('0xd')]){if(this['faxAccounts'][_0x7305('0x22')](_0x543b3e)){if(_0x614bb7[_0x7305('0x23')]===this[_0x7305('0xd')][_0x543b3e]['localstationid']){this['channels'][_0x614bb7['uniqueid']]={};this['channels'][_0x614bb7[_0x7305('0x24')]]['channel']=_0x614bb7[_0x7305('0x25')];this[_0x7305('0x26')][_0x614bb7[_0x7305('0x24')]]['id']=this[_0x7305('0xd')][_0x543b3e]['id'];this['channels'][_0x614bb7['uniqueid']]['name']=this[_0x7305('0xd')][_0x543b3e][_0x7305('0x27')];logger[_0x7305('0x28')](_0x614bb7['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x7305('0xf')][_0x614bb7[_0x7305('0x24')]]){this['channels'][_0x614bb7[_0x7305('0x24')]]={};this[_0x7305('0x26')][_0x614bb7[_0x7305('0x24')]]['channel']=_0x614bb7[_0x7305('0x25')];logger['info'](_0x614bb7['uniqueid'],_0x7305('0x29'));}};Fax['prototype'][_0x7305('0x13')]=function(_0x4f76eb){if(this['channels'][_0x4f76eb['uniqueid']]){for(var _0x13ed00 in _0x4f76eb[_0x7305('0x2a')]){if(_0x4f76eb['variable'][_0x7305('0x22')](_0x13ed00)){this['channels'][_0x4f76eb['uniqueid']][_0x13ed00]=_0x4f76eb[_0x7305('0x2b')];}}}};Fax[_0x7305('0x20')][_0x7305('0x16')]=function(_0x1c7f58){if(this['channels'][_0x1c7f58[_0x7305('0x24')]]){this[_0x7305('0x26')][_0x1c7f58[_0x7305('0x24')]][_0x7305('0x2c')]=_0x1c7f58[_0x7305('0x2c')];this[_0x7305('0x26')][_0x1c7f58[_0x7305('0x24')]]['channelstatedesc']=_0x1c7f58[_0x7305('0x2d')];}};Fax['prototype'][_0x7305('0x18')]=function(_0x1d9a30){if(this[_0x7305('0x26')][_0x1d9a30[_0x7305('0x24')]]){for(var _0x14f25e in _0x1d9a30[_0x7305('0x2a')]){if(_0x1d9a30[_0x7305('0x2a')][_0x7305('0x22')](_0x14f25e)){this[_0x7305('0x26')][_0x1d9a30['uniqueid']][_0x14f25e]=_0x1d9a30[_0x7305('0x2b')];}}}};Fax[_0x7305('0x20')][_0x7305('0x1a')]=function(_0x213ce1){if(this[_0x7305('0x26')][_0x213ce1[_0x7305('0x24')]]){this[_0x7305('0x26')][_0x213ce1[_0x7305('0x24')]]['operation']=_0x213ce1[_0x7305('0x2e')];this[_0x7305('0x26')][_0x213ce1[_0x7305('0x24')]][_0x7305('0x2f')]=_0x213ce1['status'];this[_0x7305('0x26')][_0x213ce1['uniqueid']]['localstationid']=_0x213ce1[_0x7305('0x30')];this[_0x7305('0x26')][_0x213ce1[_0x7305('0x24')]][_0x7305('0x31')]=_0x213ce1['filename'];logger['info'](_0x213ce1[_0x7305('0x24')],_0x7305('0x32'));}};Fax[_0x7305('0x20')][_0x7305('0x1c')]=function(_0x4043c0){var _0x4b749f=this;if(this['channels'][_0x4043c0['uniqueid']]){var _0x4a0b8c=this[_0x7305('0x26')][_0x4043c0[_0x7305('0x24')]]['id'];this[_0x7305('0x26')][_0x4043c0[_0x7305('0x24')]][_0x7305('0x33')]=_0x4043c0[_0x7305('0x33')];this['channels'][_0x4043c0[_0x7305('0x24')]][_0x7305('0x34')]=_0x4043c0[_0x7305('0x34')];this[_0x7305('0x26')][_0x4043c0[_0x7305('0x24')]][_0x7305('0x30')]=_0x4043c0[_0x7305('0x30')];this[_0x7305('0x26')][_0x4043c0[_0x7305('0x24')]][_0x7305('0x35')]=_0x4043c0[_0x7305('0x35')];this[_0x7305('0x26')][_0x4043c0['uniqueid']][_0x7305('0x36')]=_0x4043c0['transferrate'];this[_0x7305('0x26')][_0x4043c0['uniqueid']][_0x7305('0x31')]=_0x4043c0[_0x7305('0x31')];this[_0x7305('0x26')][_0x4043c0['uniqueid']][_0x7305('0x37')]=_0x4043c0[_0x7305('0x37')];if(this[_0x7305('0x26')][_0x4043c0['uniqueid']][_0x7305('0x34')]>0x0){tiff2pdf(_0x4043c0[_0x7305('0x31')],_0x7305('0x38'),function(_0x399b1c){logger[_0x7305('0x28')](_0x4043c0[_0x7305('0x24')],_0x7305('0x39'),_0x399b1c[_0x7305('0x3a')]);attachment['create']({'name':path[_0x7305('0x3b')](_0x4043c0[_0x7305('0x31')])[_0x7305('0x27')],'basename':path[_0x7305('0x3b')](_0x4043c0[_0x7305('0x31')])['name']+'.pdf','type':_0x7305('0x3c')})[_0x7305('0x3d')](function(_0x59b2e2){faxAccount['notify'](_0x4a0b8c,{'from':_0x4043c0[_0x7305('0x37')],'mapKey':_0x7305('0x6'),'body':path[_0x7305('0x3b')](_0x4043c0[_0x7305('0x31')])[_0x7305('0x27')]+'.pdf','AttachmentId':_0x59b2e2['id']})[_0x7305('0x3e')](function(_0x2026e0){logger['error'](_0x4043c0[_0x7305('0x24')],_0x7305('0x3f'),JSON['stringify'](_0x2026e0));});})[_0x7305('0x3e')](function(_0x5123fd){logger['error'](_0x4043c0['uniqueid'],_0x7305('0x40'),JSON[_0x7305('0x41')](_0x5123fd));});});}logger['info'](_0x4043c0[_0x7305('0x24')],_0x7305('0x40'));}};Fax[_0x7305('0x20')]['syncOriginateResponse']=function(_0x38a66c){if(this[_0x7305('0xf')][_0x38a66c['uniqueid']]){_[_0x7305('0x42')](this['channels'][_0x38a66c['uniqueid']],_['pick'](_0x38a66c,['response',_0x7305('0x43')]));}};function updateStatus(_0x12a07a){if(_0x12a07a[_0x7305('0x44')]){faxMessage[_0x7305('0x45')](_0x12a07a['AttachmentId'],{'failMessage':_0x7305('0x46')})['then'](function(_0xa14585){ut[_0x7305('0x47')](_0x7305('0x48'),_0xa14585);})[_0x7305('0x3e')](function(_0xf4acfc){ut[_0x7305('0x47')]('[Fax][Message][Error][NoUpdate1]',_0xf4acfc);});}else{ut[_0x7305('0x47')](_0x7305('0x49'));}}Fax[_0x7305('0x20')][_0x7305('0x4a')]=function(_0x377516,_0x1a1446,_0xc9863b){var _0x13ead8=this;var _0x248b5c={};if(_0x1a1446){_0x248b5c={'read':_0x1a1446};}else{_0x248b5c={'failMessage':_0xc9863b};}if(this['actions'][_0x377516][_0x7305('0x44')]){faxMessage[_0x7305('0x45')](this[_0x7305('0xf')][_0x377516][_0x7305('0x44')],_0x248b5c)[_0x7305('0x3d')](function(_0x2c2bb2){ut[_0x7305('0x47')](_0x7305('0x4b'),_0x2c2bb2);})[_0x7305('0x3e')](function(_0x395bc8){ut[_0x7305('0x47')]('[Fax][Message][NoUpdate1]',_0x395bc8);})[_0x7305('0x4c')](function(){delete _0x13ead8[_0x7305('0x26')][_0x377516];delete _0x13ead8[_0x7305('0xf')][_0x377516];});}else{ut[_0x7305('0x47')](_0x7305('0x4d'));delete this['channels'][_0x377516];delete this[_0x7305('0xf')][_0x377516];}};Fax[_0x7305('0x20')]['syncHangup']=function(_0x401838){var _0x36742b=this;if(this[_0x7305('0x26')][_0x401838['uniqueid']]){if(this[_0x7305('0xf')][_0x401838[_0x7305('0x24')]]){this[_0x7305('0x26')][_0x401838[_0x7305('0x24')]]['id']=this[_0x7305('0xf')][_0x401838['uniqueid']]['id'];this[_0x7305('0x26')][_0x401838[_0x7305('0x24')]][_0x7305('0x27')]=this[_0x7305('0xf')][_0x401838[_0x7305('0x24')]][_0x7305('0x27')];}logger[_0x7305('0x28')](_0x401838[_0x7305('0x24')],this['actions'][_0x401838['uniqueid']]?_0x7305('0x4e'):_0x7305('0x4f'),JSON[_0x7305('0x41')](this[_0x7305('0x26')][_0x401838[_0x7305('0x24')]]));if(this['actions'][_0x401838[_0x7305('0x24')]]){if(this[_0x7305('0x26')][_0x401838['uniqueid']][_0x7305('0x50')]>0x0&&this[_0x7305('0x26')][_0x401838[_0x7305('0x24')]][_0x7305('0x19')]===_0x7305('0x51')){this[_0x7305('0x4a')](_0x401838[_0x7305('0x24')],!![]);}else{this['updateStatus'](_0x401838[_0x7305('0x24')],![],this[_0x7305('0x26')][_0x401838[_0x7305('0x24')]][_0x7305('0x52')]?'SENDING\x20FAILED:\x20'+this[_0x7305('0x26')][_0x401838[_0x7305('0x24')]][_0x7305('0x52')]:_0x7305('0x53'));}}}};Fax[_0x7305('0x20')][_0x7305('0x54')]=function(_0x515a5b){var _0x566f0e=this;return new BPromise(function(_0x49209f,_0x2c32db){_0x566f0e[_0x7305('0x55')](_0x515a5b,_0x566f0e[_0x7305('0xd')][_0x515a5b[_0x7305('0x56')]])[_0x7305('0x3d')](function(_0x21bfaf){ut['logger']('[Fax][execOriginate][success]',_0x21bfaf);_0x49209f(ut['message'](_0x7305('0x57')));})[_0x7305('0x3e')](function(_0x19245f){ut[_0x7305('0x47')](_0x7305('0x58'),_0x19245f);updateStatus(_0x515a5b);_0x2c32db(ut[_0x7305('0x3a')](_0x7305('0x59')));});});};Fax['prototype'][_0x7305('0x5a')]=function(_0x564267){var _0x5c90ee=this;return new BPromise(function(_0x7ad9b6,_0x2ef947){var _0x53f2ed=_0x5c90ee[_0x7305('0x5b')](_0x5c90ee[_0x7305('0xd')][_0x564267[_0x7305('0x56')]][_0x7305('0x5c')],_0x564267);if(_0x53f2ed[_0x7305('0x5d')]){_0x7ad9b6(ut[_0x7305('0x3a')](_0x7305('0x5e')));}else{_0x2ef947(ut['message'](_0x53f2ed[_0x7305('0x3a')]));}});};function originate(_0x5164cf,_0x2ee352,_0x5848c5){return new BPromise(function(_0x2ebd5b,_0x398750){if(_0x5848c5){var _0x35c39f=util[_0x7305('0x5f')](_0x7305('0x60'),path[_0x7305('0x3b')](_0x5164cf[_0x7305('0x4')])[_0x7305('0x27')],_0x5164cf[_0x7305('0x4')]);gs[_0x7305('0x61')](_0x35c39f)[_0x7305('0x3d')](function(){_0x5164cf[_0x7305('0x4')]=util['format']('%s/%s.tif',path[_0x7305('0x3b')](_0x5164cf[_0x7305('0x4')])[_0x7305('0x62')],path[_0x7305('0x3b')](_0x5164cf[_0x7305('0x4')])[_0x7305('0x27')]);_0x2ee352[_0x7305('0x63')]=_0x5164cf[_0x7305('0x4')];ut[_0x7305('0x47')](_0x7305('0x64'),'');ami[_0x7305('0x65')](ut[_0x7305('0x66')](_0x5164cf,_0x2ee352))[_0x7305('0x3d')](function(_0x21ecee){_0x2ebd5b(_0x21ecee);})['catch'](function(_0x281a5b){_0x398750(_0x281a5b);});})[_0x7305('0x3e')](function(_0xe662ca){_0x398750(_0xe662ca);});}else{ami[_0x7305('0x65')](ut[_0x7305('0x66')](_0x5164cf,_0x2ee352))[_0x7305('0x3d')](function(_0x4e6ae1){_0x2ebd5b(_0x4e6ae1);})[_0x7305('0x3e')](function(_0xc3bdb8){_0x398750(_0xc3bdb8);});}});}Fax['prototype']['execOriginate']=function(_0x15624c,_0x5ac0ab){var _0x1a7b13=this;return new BPromise(function(_0x2756ec,_0x123634){var _0x149ef4=uuid['v4']();var _0x4a9be4=ut[_0x7305('0x67')](_0x15624c,_0x5ac0ab);_0x1a7b13[_0x7305('0xf')][_0x149ef4]=new Action(_0x149ef4,_0x5ac0ab,_0x15624c);var _0x5a71ee=_0x1a7b13[_0x7305('0xf')][_0x149ef4];if(path[_0x7305('0x3b')](_0x15624c['path'])[_0x7305('0x68')]==='.pdf'){originate(_0x5a71ee,_0x4a9be4,!![])[_0x7305('0x3d')](function(_0x96fa58){_0x2756ec(_0x96fa58);})['catch'](function(_0x4592ab){_0x123634(_0x4592ab);});}else{originate(_0x5a71ee,_0x4a9be4,![])[_0x7305('0x3d')](function(_0x1288e4){_0x2756ec(_0x1288e4);})[_0x7305('0x3e')](function(_0x35721a){_0x123634(_0x35721a);});}});};Fax[_0x7305('0x20')]['isTrunkReachable']=function(_0x1c7f92){return!_[_0x7305('0x69')](_0x1c7f92)&&!_[_0x7305('0x69')](_0x1c7f92[_0x7305('0x27')])&&!_[_0x7305('0x69')](_0x1c7f92[_0x7305('0x6a')])&&_0x1c7f92[_0x7305('0x6a')]&&!_[_0x7305('0x69')](this[_0x7305('0xe')][util[_0x7305('0x5f')]('SIP/%s',_0x1c7f92['name'])])&&!_[_0x7305('0x69')](this[_0x7305('0xe')][util['format'](_0x7305('0x6b'),_0x1c7f92[_0x7305('0x27')])]['status'])&&(this['trunks'][util[_0x7305('0x5f')](_0x7305('0x6b'),_0x1c7f92['name'])][_0x7305('0x2f')]===_0x7305('0x6c')||this[_0x7305('0xe')][util[_0x7305('0x5f')](_0x7305('0x6b'),_0x1c7f92[_0x7305('0x27')])][_0x7305('0x2f')]==='unmonitored');};Fax[_0x7305('0x20')]['checkTrunk']=function(_0x495390,_0x34572f){if(!this[_0x7305('0x6d')](_0x495390)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x7305('0x69')](_0x495390)?'':_0x495390[_0x7305('0x27')]+_0x7305('0x6e'));return{'isValid':![],'message':_0x7305('0x6f')};}if(_[_0x7305('0x69')](_0x34572f['fax'])){ut[_0x7305('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x7305('0x41')](_0x34572f));return{'isValid':![],'message':_0x7305('0x70')};}if(_[_0x7305('0x69')](_0x34572f[_0x7305('0x4')])){ut['logger'](_0x7305('0x71'),JSON[_0x7305('0x41')](_0x34572f));return{'isValid':![],'message':_0x7305('0x72')};}return{'isValid':!![],'message':_0x7305('0x73')};};module[_0x7305('0x74')]=Fax; \ No newline at end of file +var _0xa978=['hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','prototype','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','variablesAction','Action','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus'];(function(_0x3e854b,_0xb4560){var _0x414b09=function(_0x400df3){while(--_0x400df3){_0x3e854b['push'](_0x3e854b['shift']());}};_0x414b09(++_0xb4560);}(_0xa978,0x145));var _0x8a97=function(_0x4a3c9a,_0x1e0184){_0x4a3c9a=_0x4a3c9a-0x0;var _0x4a7d51=_0xa978[_0x4a3c9a];return _0x4a7d51;};'use strict';var util=require(_0x8a97('0x0'));var _=require(_0x8a97('0x1'));var BPromise=require(_0x8a97('0x2'));var uuid=require(_0x8a97('0x3'));var moment=require('moment');var path=require(_0x8a97('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x8a97('0x5'));var logger=require(_0x8a97('0x6'))(_0x8a97('0x7'));var ami=require(_0x8a97('0x8'));var rpcDb=require(_0x8a97('0x9'));var Channel=require('./channel');var ut=require(_0x8a97('0xa'));var Action=require(_0x8a97('0xb'));var faxAccount=require(_0x8a97('0xc'));var attachment=require(_0x8a97('0xd'));var faxMessage=require(_0x8a97('0xe'));function Fax(_0x448baf){this[_0x8a97('0xf')]={};this['faxAccounts']=_0x448baf[_0x8a97('0x10')];this[_0x8a97('0x11')]=_0x448baf[_0x8a97('0x11')];this['actions']={};ami['on'](_0x8a97('0x12'),this[_0x8a97('0x13')][_0x8a97('0x14')](this));ami['on'](_0x8a97('0x15'),this[_0x8a97('0x16')][_0x8a97('0x14')](this));ami['on'](_0x8a97('0x17'),this[_0x8a97('0x18')][_0x8a97('0x14')](this));ami['on'](_0x8a97('0x19'),this[_0x8a97('0x1a')][_0x8a97('0x14')](this));ami['on'](_0x8a97('0x1b'),this[_0x8a97('0x1c')]['bind'](this));ami['on']('receivefax',this['syncReceiveFax'][_0x8a97('0x14')](this));ami['on'](_0x8a97('0x1d'),this[_0x8a97('0x1e')]['bind'](this));ami['on'](_0x8a97('0x1f'),this[_0x8a97('0x20')][_0x8a97('0x14')](this));}Fax['prototype']['syncNewchannel']=function(_0x38edc8){if(_0x38edc8['context']===_0x8a97('0x21')){for(var _0x52aad4 in this[_0x8a97('0x10')]){if(this[_0x8a97('0x10')][_0x8a97('0x22')](_0x52aad4)){if(_0x38edc8[_0x8a97('0x23')]===this[_0x8a97('0x10')][_0x52aad4][_0x8a97('0x24')]){this[_0x8a97('0xf')][_0x38edc8[_0x8a97('0x25')]]={};this[_0x8a97('0xf')][_0x38edc8[_0x8a97('0x25')]][_0x8a97('0x26')]=_0x38edc8[_0x8a97('0x26')];this[_0x8a97('0xf')][_0x38edc8[_0x8a97('0x25')]]['id']=this[_0x8a97('0x10')][_0x52aad4]['id'];this[_0x8a97('0xf')][_0x38edc8[_0x8a97('0x25')]][_0x8a97('0x27')]=this[_0x8a97('0x10')][_0x52aad4]['name'];logger[_0x8a97('0x28')](_0x38edc8[_0x8a97('0x25')],_0x8a97('0x29'));}}}}if(this[_0x8a97('0x2a')][_0x38edc8[_0x8a97('0x25')]]){this['channels'][_0x38edc8[_0x8a97('0x25')]]={};this[_0x8a97('0xf')][_0x38edc8[_0x8a97('0x25')]][_0x8a97('0x26')]=_0x38edc8[_0x8a97('0x26')];logger[_0x8a97('0x28')](_0x38edc8[_0x8a97('0x25')],_0x8a97('0x29'));}};Fax['prototype'][_0x8a97('0x16')]=function(_0x3d8bec){if(this[_0x8a97('0xf')][_0x3d8bec[_0x8a97('0x25')]]){for(var _0x54de30 in _0x3d8bec[_0x8a97('0x2b')]){if(_0x3d8bec[_0x8a97('0x2b')][_0x8a97('0x22')](_0x54de30)){this['channels'][_0x3d8bec[_0x8a97('0x25')]][_0x54de30]=_0x3d8bec[_0x8a97('0x2c')];}}}};Fax[_0x8a97('0x2d')][_0x8a97('0x18')]=function(_0x28d85d){if(this[_0x8a97('0xf')][_0x28d85d['uniqueid']]){this[_0x8a97('0xf')][_0x28d85d[_0x8a97('0x25')]][_0x8a97('0x2e')]=_0x28d85d['channelstate'];this[_0x8a97('0xf')][_0x28d85d[_0x8a97('0x25')]]['channelstatedesc']=_0x28d85d[_0x8a97('0x2f')];}};Fax[_0x8a97('0x2d')][_0x8a97('0x1a')]=function(_0x53b0ee){if(this[_0x8a97('0xf')][_0x53b0ee[_0x8a97('0x25')]]){for(var _0x4d0e3d in _0x53b0ee[_0x8a97('0x2b')]){if(_0x53b0ee[_0x8a97('0x2b')][_0x8a97('0x22')](_0x4d0e3d)){this[_0x8a97('0xf')][_0x53b0ee[_0x8a97('0x25')]][_0x4d0e3d]=_0x53b0ee[_0x8a97('0x2c')];}}}};Fax['prototype'][_0x8a97('0x1c')]=function(_0x1dc275){if(this[_0x8a97('0xf')][_0x1dc275[_0x8a97('0x25')]]){this[_0x8a97('0xf')][_0x1dc275[_0x8a97('0x25')]][_0x8a97('0x30')]=_0x1dc275['operation'];this[_0x8a97('0xf')][_0x1dc275[_0x8a97('0x25')]][_0x8a97('0x31')]=_0x1dc275[_0x8a97('0x31')];this[_0x8a97('0xf')][_0x1dc275[_0x8a97('0x25')]][_0x8a97('0x24')]=_0x1dc275[_0x8a97('0x24')];this[_0x8a97('0xf')][_0x1dc275['uniqueid']][_0x8a97('0x32')]=_0x1dc275['filename'];logger[_0x8a97('0x28')](_0x1dc275[_0x8a97('0x25')],_0x8a97('0x33'));}};Fax[_0x8a97('0x2d')]['syncReceiveFax']=function(_0x717de2){var _0x1871eb=this;if(this['channels'][_0x717de2[_0x8a97('0x25')]]){var _0x531be8=this[_0x8a97('0xf')][_0x717de2[_0x8a97('0x25')]]['id'];this[_0x8a97('0xf')][_0x717de2[_0x8a97('0x25')]][_0x8a97('0x34')]=_0x717de2[_0x8a97('0x34')];this['channels'][_0x717de2[_0x8a97('0x25')]][_0x8a97('0x35')]=_0x717de2[_0x8a97('0x35')];this['channels'][_0x717de2[_0x8a97('0x25')]]['localstationid']=_0x717de2[_0x8a97('0x24')];this[_0x8a97('0xf')][_0x717de2[_0x8a97('0x25')]][_0x8a97('0x36')]=_0x717de2[_0x8a97('0x36')];this[_0x8a97('0xf')][_0x717de2['uniqueid']][_0x8a97('0x37')]=_0x717de2[_0x8a97('0x37')];this['channels'][_0x717de2[_0x8a97('0x25')]][_0x8a97('0x32')]=_0x717de2[_0x8a97('0x32')];this['channels'][_0x717de2[_0x8a97('0x25')]][_0x8a97('0x38')]=_0x717de2[_0x8a97('0x38')];if(this['channels'][_0x717de2[_0x8a97('0x25')]][_0x8a97('0x35')]>0x0){tiff2pdf(_0x717de2[_0x8a97('0x32')],_0x8a97('0x39'),function(_0x421df8){logger[_0x8a97('0x28')](_0x717de2[_0x8a97('0x25')],_0x8a97('0x3a'),_0x421df8['message']);attachment[_0x8a97('0x3b')]({'name':path[_0x8a97('0x3c')](_0x717de2[_0x8a97('0x32')])[_0x8a97('0x27')],'basename':path['parse'](_0x717de2['filename'])['name']+_0x8a97('0x3d'),'type':_0x8a97('0x3e')})[_0x8a97('0x3f')](function(_0x5e24f3){faxAccount[_0x8a97('0x40')](_0x531be8,{'from':_0x717de2['calleridnum'],'mapKey':_0x8a97('0x7'),'body':path[_0x8a97('0x3c')](_0x717de2['filename'])['name']+_0x8a97('0x3d'),'AttachmentId':_0x5e24f3['id']})[_0x8a97('0x41')](function(_0x3a7adf){logger['error'](_0x717de2[_0x8a97('0x25')],_0x8a97('0x42'),JSON[_0x8a97('0x43')](_0x3a7adf));});})['catch'](function(_0x506705){logger['error'](_0x717de2[_0x8a97('0x25')],_0x8a97('0x44'),JSON[_0x8a97('0x43')](_0x506705));});});}logger['info'](_0x717de2[_0x8a97('0x25')],_0x8a97('0x44'));}};Fax[_0x8a97('0x2d')][_0x8a97('0x20')]=function(_0x4550e5){if(this['actions'][_0x4550e5['uniqueid']]){_[_0x8a97('0x45')](this[_0x8a97('0xf')][_0x4550e5[_0x8a97('0x25')]],_[_0x8a97('0x46')](_0x4550e5,['response',_0x8a97('0x47')]));}};function updateStatus(_0xc447e2){if(_0xc447e2[_0x8a97('0x48')]){faxMessage['update'](_0xc447e2[_0x8a97('0x48')],{'failMessage':_0x8a97('0x49')})[_0x8a97('0x3f')](function(_0x1730c0){ut[_0x8a97('0x4a')](_0x8a97('0x4b'),_0x1730c0);})[_0x8a97('0x41')](function(_0x2ab0f3){ut['logger'](_0x8a97('0x4c'),_0x2ab0f3);});}else{ut[_0x8a97('0x4a')](_0x8a97('0x4d'));}}Fax[_0x8a97('0x2d')][_0x8a97('0x4e')]=function(_0x535eec,_0x544c0d,_0x4c04bc){var _0x17f084=this;var _0x14a9a6={};if(_0x544c0d){_0x14a9a6={'read':_0x544c0d};}else{_0x14a9a6={'failMessage':_0x4c04bc};}if(this[_0x8a97('0x2a')][_0x535eec][_0x8a97('0x48')]){faxMessage['update'](this[_0x8a97('0x2a')][_0x535eec][_0x8a97('0x48')],_0x14a9a6)[_0x8a97('0x3f')](function(_0x6ea15f){ut[_0x8a97('0x4a')](_0x8a97('0x4f'),_0x6ea15f);})[_0x8a97('0x41')](function(_0x426fa9){ut[_0x8a97('0x4a')](_0x8a97('0x50'),_0x426fa9);})[_0x8a97('0x51')](function(){delete _0x17f084[_0x8a97('0xf')][_0x535eec];delete _0x17f084['actions'][_0x535eec];});}else{ut[_0x8a97('0x4a')]('[Fax][Message][NoUpdate2]');delete this[_0x8a97('0xf')][_0x535eec];delete this[_0x8a97('0x2a')][_0x535eec];}};Fax[_0x8a97('0x2d')][_0x8a97('0x1e')]=function(_0x64960){var _0x182f76=this;if(this[_0x8a97('0xf')][_0x64960['uniqueid']]){if(this['actions'][_0x64960[_0x8a97('0x25')]]){this[_0x8a97('0xf')][_0x64960[_0x8a97('0x25')]]['id']=this[_0x8a97('0x2a')][_0x64960[_0x8a97('0x25')]]['id'];this['channels'][_0x64960[_0x8a97('0x25')]][_0x8a97('0x27')]=this[_0x8a97('0x2a')][_0x64960['uniqueid']][_0x8a97('0x27')];}logger[_0x8a97('0x28')](_0x64960[_0x8a97('0x25')],this[_0x8a97('0x2a')][_0x64960[_0x8a97('0x25')]]?_0x8a97('0x52'):_0x8a97('0x53'),JSON[_0x8a97('0x43')](this[_0x8a97('0xf')][_0x64960['uniqueid']]));if(this[_0x8a97('0x2a')][_0x64960[_0x8a97('0x25')]]){if(this[_0x8a97('0xf')][_0x64960[_0x8a97('0x25')]]['faxpages']>0x0&&this[_0x8a97('0xf')][_0x64960[_0x8a97('0x25')]][_0x8a97('0x1b')]===_0x8a97('0x54')){this['updateStatus'](_0x64960[_0x8a97('0x25')],!![]);}else{this[_0x8a97('0x4e')](_0x64960[_0x8a97('0x25')],![],this[_0x8a97('0xf')][_0x64960[_0x8a97('0x25')]][_0x8a97('0x55')]?_0x8a97('0x56')+this['channels'][_0x64960['uniqueid']][_0x8a97('0x55')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x8a97('0x57')]=function(_0x3d1763){var _0x4f49ec=this;return new BPromise(function(_0x2cfea7,_0x4194b8){_0x4f49ec['execOriginate'](_0x3d1763,_0x4f49ec[_0x8a97('0x10')][_0x3d1763[_0x8a97('0x58')]])['then'](function(_0x26d873){ut[_0x8a97('0x4a')](_0x8a97('0x59'),_0x26d873);_0x2cfea7(ut[_0x8a97('0x5a')](_0x8a97('0x5b')));})['catch'](function(_0x569451){ut[_0x8a97('0x4a')](_0x8a97('0x5c'),_0x569451);updateStatus(_0x3d1763);_0x4194b8(ut[_0x8a97('0x5a')](_0x8a97('0x5d')));});});};Fax[_0x8a97('0x2d')]['checkAfterSend']=function(_0x848eb5){var _0x5fe514=this;return new BPromise(function(_0x1b1b23,_0x47fd62){var _0x2ba5a0=_0x5fe514[_0x8a97('0x5e')](_0x5fe514[_0x8a97('0x10')][_0x848eb5['FaxAccountId']][_0x8a97('0x5f')],_0x848eb5);if(_0x2ba5a0[_0x8a97('0x60')]){_0x1b1b23(ut[_0x8a97('0x5a')]('Trunk\x20Reachable'));}else{_0x47fd62(ut[_0x8a97('0x5a')](_0x2ba5a0[_0x8a97('0x5a')]));}});};function originate(_0x89a86e,_0xbfd60c,_0x2caa9d){return new BPromise(function(_0x5a3b6e,_0x46cfb4){if(_0x2caa9d){var _0x16c5dd=util[_0x8a97('0x61')](_0x8a97('0x62'),path[_0x8a97('0x3c')](_0x89a86e[_0x8a97('0x4')])[_0x8a97('0x27')],_0x89a86e['path']);gs[_0x8a97('0x63')](_0x16c5dd)[_0x8a97('0x3f')](function(){_0x89a86e[_0x8a97('0x4')]=util[_0x8a97('0x61')](_0x8a97('0x64'),path[_0x8a97('0x3c')](_0x89a86e['path'])[_0x8a97('0x65')],path[_0x8a97('0x3c')](_0x89a86e[_0x8a97('0x4')])[_0x8a97('0x27')]);_0xbfd60c[_0x8a97('0x66')]=_0x89a86e[_0x8a97('0x4')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x8a97('0x67')](_0x89a86e,_0xbfd60c))[_0x8a97('0x3f')](function(_0x4931fd){_0x5a3b6e(_0x4931fd);})[_0x8a97('0x41')](function(_0x641418){_0x46cfb4(_0x641418);});})[_0x8a97('0x41')](function(_0xfa6bab){_0x46cfb4(_0xfa6bab);});}else{ami[_0x8a97('0x68')](ut['variablesAction'](_0x89a86e,_0xbfd60c))[_0x8a97('0x3f')](function(_0x3a7ec7){_0x5a3b6e(_0x3a7ec7);})[_0x8a97('0x41')](function(_0x393d8d){_0x46cfb4(_0x393d8d);});}});}Fax[_0x8a97('0x2d')][_0x8a97('0x69')]=function(_0x4744b7,_0x704cd7){var _0x1e1d0a=this;return new BPromise(function(_0x130659,_0x131898){var _0x2a6df5=uuid['v4']();var _0x92e4e5=ut[_0x8a97('0x6a')](_0x4744b7,_0x704cd7);_0x1e1d0a['actions'][_0x2a6df5]=new Action(_0x2a6df5,_0x704cd7,_0x4744b7);var _0x2a8c12=_0x1e1d0a[_0x8a97('0x2a')][_0x2a6df5];if(path[_0x8a97('0x3c')](_0x4744b7[_0x8a97('0x4')])['ext']===_0x8a97('0x3d')){originate(_0x2a8c12,_0x92e4e5,!![])[_0x8a97('0x3f')](function(_0x5e3d56){_0x130659(_0x5e3d56);})[_0x8a97('0x41')](function(_0x40fb74){_0x131898(_0x40fb74);});}else{originate(_0x2a8c12,_0x92e4e5,![])[_0x8a97('0x3f')](function(_0x2118fa){_0x130659(_0x2118fa);})[_0x8a97('0x41')](function(_0x44edb4){_0x131898(_0x44edb4);});}});};Fax[_0x8a97('0x2d')][_0x8a97('0x6b')]=function(_0x2f843b){return!_[_0x8a97('0x6c')](_0x2f843b)&&!_['isNil'](_0x2f843b[_0x8a97('0x27')])&&!_[_0x8a97('0x6c')](_0x2f843b[_0x8a97('0x6d')])&&_0x2f843b['active']&&!_[_0x8a97('0x6c')](this[_0x8a97('0x11')][util[_0x8a97('0x61')](_0x8a97('0x6e'),_0x2f843b[_0x8a97('0x27')])])&&!_[_0x8a97('0x6c')](this[_0x8a97('0x11')][util['format'](_0x8a97('0x6e'),_0x2f843b[_0x8a97('0x27')])][_0x8a97('0x31')])&&(this[_0x8a97('0x11')][util[_0x8a97('0x61')](_0x8a97('0x6e'),_0x2f843b[_0x8a97('0x27')])][_0x8a97('0x31')]===_0x8a97('0x6f')||this['trunks'][util[_0x8a97('0x61')](_0x8a97('0x6e'),_0x2f843b[_0x8a97('0x27')])]['status']==='unmonitored');};Fax['prototype'][_0x8a97('0x5e')]=function(_0x3801f3,_0x1fbaa6){if(!this[_0x8a97('0x6b')](_0x3801f3)){ut[_0x8a97('0x4a')](_0x8a97('0x70'),_[_0x8a97('0x6c')](_0x3801f3)?'':_0x3801f3[_0x8a97('0x27')]+_0x8a97('0x71'));return{'isValid':![],'message':_0x8a97('0x72')};}if(_['isNil'](_0x1fbaa6['fax'])){ut[_0x8a97('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x8a97('0x43')](_0x1fbaa6));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x8a97('0x6c')](_0x1fbaa6[_0x8a97('0x4')])){ut[_0x8a97('0x4a')](_0x8a97('0x73'),JSON[_0x8a97('0x43')](_0x1fbaa6));return{'isValid':![],'message':_0x8a97('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x8a97('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 9ce7780..7bef620 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 _0x7784=['notify','resolve','catch','[Notify]\x20','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect'];(function(_0x5c6b6f,_0x4e3f76){var _0x1a1335=function(_0x267deb){while(--_0x267deb){_0x5c6b6f['push'](_0x5c6b6f['shift']());}};_0x1a1335(++_0x4e3f76);}(_0x7784,0xd3));var _0x4778=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7784[_0x3b380d];return _0x54502b;};'use strict';var util=require('util');var BPromise=require(_0x4778('0x0'));var logger=require(_0x4778('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x4778('0x2'));function loggerCatch(_0x5af9b9){return function(_0xcd7380){logger[_0x4778('0x3')](_0x5af9b9,util[_0x4778('0x4')](_0xcd7380,{'showHidden':![],'depth':null}));};}exports[_0x4778('0x5')]=function(_0x10e8b9,_0x2b0c79){return BPromise[_0x4778('0x6')]()['then'](faxAccount[_0x4778('0x5')](_0x10e8b9,_0x2b0c79))[_0x4778('0x7')](loggerCatch(_0x4778('0x8')));}; \ No newline at end of file +var _0x0db4=['resolve','then','notify','catch','[Notify]\x20','util','../../../config/logger','../rpc/faxAccount','error','inspect'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x0db4,0x18b));var _0x40db=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x0db4[_0x1caf6a];return _0x1bf493;};'use strict';var util=require(_0x40db('0x0'));var BPromise=require('bluebird');var logger=require(_0x40db('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x40db('0x2'));function loggerCatch(_0x3342d7){return function(_0x52e288){logger[_0x40db('0x3')](_0x3342d7,util[_0x40db('0x4')](_0x52e288,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x5e632d,_0x4290a9){return BPromise[_0x40db('0x5')]()[_0x40db('0x6')](faxAccount[_0x40db('0x7')](_0x5e632d,_0x4290a9))[_0x40db('0x8')](loggerCatch(_0x40db('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 5d4f10a..983a6b3 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 _0xe70b=['inspect','../../../../config/logger','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x150037,_0x1c7c0a){var _0x3cebe7=function(_0x46d9fe){while(--_0x46d9fe){_0x150037['push'](_0x150037['shift']());}};_0x3cebe7(++_0x1c7c0a);}(_0xe70b,0x76));var _0xbe70=function(_0x180a78,_0x572478){_0x180a78=_0x180a78-0x0;var _0x584a10=_0xe70b[_0x180a78];return _0x584a10;};'use strict';var util=require('util');var logger=require(_0xbe70('0x0'))('fax');var BPromise=require(_0xbe70('0x1'));var exec=require(_0xbe70('0x2'))[_0xbe70('0x3')];exports[_0xbe70('0x4')]=function(_0x493f3a){return new BPromise(function(_0x5ca306,_0xc60c3d){exec(_0x493f3a,function(_0x4c413e,_0x37e8a9,_0x5ac793){logger[_0xbe70('0x5')](_0xbe70('0x6'),_0x37e8a9);if(_0x4c413e){logger['info'](_0xbe70('0x6'),_0xbe70('0x7'),util[_0xbe70('0x8')](_0x4c413e,{'showHidden':![],'depth':null}),_0x37e8a9,_0x5ac793);_0xc60c3d(_0x4c413e);}_0x5ca306(_0x37e8a9);});});}; \ No newline at end of file +var _0x5fd0=['../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x2cb642,_0x248ad5){var _0x346dad=function(_0x1905fb){while(--_0x1905fb){_0x2cb642['push'](_0x2cb642['shift']());}};_0x346dad(++_0x248ad5);}(_0x5fd0,0x154));var _0x05fd=function(_0x273e0d,_0x57ced8){_0x273e0d=_0x273e0d-0x0;var _0x251355=_0x5fd0[_0x273e0d];return _0x251355;};'use strict';var util=require(_0x05fd('0x0'));var logger=require(_0x05fd('0x1'))(_0x05fd('0x2'));var BPromise=require(_0x05fd('0x3'));var exec=require(_0x05fd('0x4'))[_0x05fd('0x5')];exports[_0x05fd('0x6')]=function(_0x2ec7b3){return new BPromise(function(_0x1aaa7b,_0x23ae95){exec(_0x2ec7b3,function(_0x1a7315,_0x46cc05,_0x30c64f){logger[_0x05fd('0x7')]('Exec\x20gs',_0x46cc05);if(_0x1a7315){logger[_0x05fd('0x7')](_0x05fd('0x8'),_0x05fd('0x9'),util[_0x05fd('0xa')](_0x1a7315,{'showHidden':![],'depth':null}),_0x46cc05,_0x30c64f);_0x23ae95(_0x1a7315);}_0x1aaa7b(_0x46cc05);});});}; \ 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 cfd0941..60721af 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 _0x1339=['modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax','message','logger','info','inspect','headerinfo','minrate','maxrate'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x1339,0x1c4));var _0x9133=function(_0x3e881b,_0x11f8e7){_0x3e881b=_0x3e881b-0x0;var _0x5f297b=_0x1339[_0x3e881b];return _0x5f297b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9133('0x0'));var logger=require(_0x9133('0x1'))(_0x9133('0x2'));exports[_0x9133('0x3')]=function(_0x132413){return{'message':_0x132413};};exports[_0x9133('0x4')]=function(_0x43356e,_0x1f0e59){logger[_0x9133('0x5')](_0x43356e,util[_0x9133('0x6')](_0x1f0e59,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x515cbd,_0x13e99d){var _0x4bc453={'XMF-ECM':_0x13e99d['ecm'],'XMF-HEADERINFO':_0x13e99d[_0x9133('0x7')],'XMF-MINRATE':_0x13e99d[_0x9133('0x8')],'XMF-MAXRATE':_0x13e99d[_0x9133('0x9')],'XMF-MODEM':util['format']('\x22%s\x22',_0x13e99d[_0x9133('0xa')]),'XMF-GATEWAY':_0x13e99d[_0x9133('0xb')],'XMF-FAXDETECT':_0x13e99d[_0x9133('0xc')],'XMF-T38TIMEOUT':_0x13e99d[_0x9133('0xd')],'XMF-LOCALSTATIONID':_0x13e99d[_0x9133('0xe')],'XMF-PATH':_0x515cbd[_0x9133('0xf')]};return _0x4bc453;};exports['variablesAction']=function(_0x48d56f,_0x2c1575){return{'actionid':_0x48d56f[_0x9133('0x10')],'action':'originate','channel':_0x48d56f[_0x9133('0x11')],'Exten':_0x9133('0x12'),'Context':_0x9133('0x13'),'Priority':'1','callerid':util[_0x9133('0x14')](_0x9133('0x15'),_0x48d56f[_0x9133('0x7')]?_0x48d56f[_0x9133('0x7')]:'',_0x48d56f[_0x9133('0xe')]),'variable':_0x2c1575,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x48d56f[_0x9133('0x10')]};}; \ No newline at end of file +var _0xeecf=['maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','from-sip','\x22%s\x22\x20<%s>','moment','../../../../config/logger','message','logger','info','addVariables','ecm','headerinfo','minrate'];(function(_0x4166fe,_0x313c65){var _0x14d5bd=function(_0x5c55d3){while(--_0x5c55d3){_0x4166fe['push'](_0x4166fe['shift']());}};_0x14d5bd(++_0x313c65);}(_0xeecf,0x115));var _0xfeec=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeecf[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xfeec('0x0'));var logger=require(_0xfeec('0x1'))('fax');exports[_0xfeec('0x2')]=function(_0x38db0d){return{'message':_0x38db0d};};exports[_0xfeec('0x3')]=function(_0x1e2970,_0x24b6e4){logger[_0xfeec('0x4')](_0x1e2970,util['inspect'](_0x24b6e4,{'showHidden':![],'depth':null}));};exports[_0xfeec('0x5')]=function(_0x344f47,_0x13b323){var _0x2b5652={'XMF-ECM':_0x13b323[_0xfeec('0x6')],'XMF-HEADERINFO':_0x13b323[_0xfeec('0x7')],'XMF-MINRATE':_0x13b323[_0xfeec('0x8')],'XMF-MAXRATE':_0x13b323[_0xfeec('0x9')],'XMF-MODEM':util[_0xfeec('0xa')](_0xfeec('0xb'),_0x13b323[_0xfeec('0xc')]),'XMF-GATEWAY':_0x13b323[_0xfeec('0xd')],'XMF-FAXDETECT':_0x13b323['faxdetect'],'XMF-T38TIMEOUT':_0x13b323[_0xfeec('0xe')],'XMF-LOCALSTATIONID':_0x13b323[_0xfeec('0xf')],'XMF-PATH':_0x344f47[_0xfeec('0x10')]};return _0x2b5652;};exports[_0xfeec('0x11')]=function(_0x47b466,_0x2f5872){return{'actionid':_0x47b466[_0xfeec('0x12')],'action':_0xfeec('0x13'),'channel':_0x47b466['channel'],'Exten':'xcally-motion-fax','Context':_0xfeec('0x14'),'Priority':'1','callerid':util[_0xfeec('0xa')](_0xfeec('0x15'),_0x47b466[_0xfeec('0x7')]?_0x47b466['headerinfo']:'',_0x47b466[_0xfeec('0xf')]),'variable':_0x2f5872,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x47b466[_0xfeec('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 12f0163..bea8a16 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 _0xd941=['./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','[index.js][initParams]','inspect','sync','catch','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd941,0x1a4));var _0x1d94=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xd941[_0x5a4400];return _0xf9b532;};'use strict';var BPromise=require(_0x1d94('0x0'));var util=require('util');var moment=require(_0x1d94('0x1'));var server=require(_0x1d94('0x2'));var Realtime=require(_0x1d94('0x3'));var Report=require(_0x1d94('0x4'));var Acw=require('./acw');var Trigger=require(_0x1d94('0x5'));var Dialer=require(_0x1d94('0x6'));var Preview=require(_0x1d94('0x7'));var Fax=require(_0x1d94('0x8'));var user=require(_0x1d94('0x9'));var voiceQueue=require(_0x1d94('0xa'));var voiceQueueReport=require(_0x1d94('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x1d94('0xc'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x1d94('0xd'));var campaign=require(_0x1d94('0xe'));var voiceExtension=require(_0x1d94('0xf'));var faxAccount=require(_0x1d94('0x10'));var zendesk=require(_0x1d94('0x11'));var salesforce=require(_0x1d94('0x12'));var sugarcrm=require(_0x1d94('0x13'));var freshdesk=require(_0x1d94('0x14'));var desk=require(_0x1d94('0x15'));var zoho=require(_0x1d94('0x16'));var vtiger=require(_0x1d94('0x17'));var freshsales=require(_0x1d94('0x18'));var servicenow=require(_0x1d94('0x19'));var dynamics365=require(_0x1d94('0x1a'));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')(_0x1d94('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1d94('0x1c')](_0x1d94('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1d94('0x1c')](_0x1d94('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1d94('0x1e')]()['then'](user[_0x1d94('0x1f')]())[_0x1d94('0x20')](realtime[_0x1d94('0x21')]())[_0x1d94('0x20')](user[_0x1d94('0x22')]())[_0x1d94('0x20')](realtime['initTelephones']())['then'](trunk[_0x1d94('0x23')]())[_0x1d94('0x20')](realtime[_0x1d94('0x24')]())['then'](voiceQueue[_0x1d94('0x25')]())['then'](realtime[_0x1d94('0x26')]())['then'](trigger[_0x1d94('0x27')]())[_0x1d94('0x20')](realtime[_0x1d94('0x28')]())[_0x1d94('0x20')](template[_0x1d94('0x29')]())[_0x1d94('0x20')](realtime[_0x1d94('0x2a')]())['then'](zendesk[_0x1d94('0x2b')]())[_0x1d94('0x20')](realtime[_0x1d94('0x2c')]())[_0x1d94('0x20')](salesforce[_0x1d94('0x2d')]())[_0x1d94('0x20')](realtime[_0x1d94('0x2e')]())[_0x1d94('0x20')](sugarcrm[_0x1d94('0x2f')]())[_0x1d94('0x20')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x1d94('0x30')]())[_0x1d94('0x20')](realtime['initFreshdeskAccounts']())[_0x1d94('0x20')](desk[_0x1d94('0x31')]())[_0x1d94('0x20')](realtime[_0x1d94('0x32')]())['then'](zoho[_0x1d94('0x33')]())['then'](realtime[_0x1d94('0x34')]())[_0x1d94('0x20')](vtiger['getVtigerAccounts']())[_0x1d94('0x20')](realtime['initVtigerAccounts']())[_0x1d94('0x20')](freshsales[_0x1d94('0x35')]())[_0x1d94('0x20')](realtime['initFreshsalesAccounts']())[_0x1d94('0x20')](servicenow[_0x1d94('0x36')]())[_0x1d94('0x20')](realtime[_0x1d94('0x37')]())['then'](dynamics365[_0x1d94('0x38')]())['then'](realtime[_0x1d94('0x39')]())[_0x1d94('0x20')](campaign['getCampaigns']())[_0x1d94('0x20')](realtime[_0x1d94('0x3a')]())[_0x1d94('0x20')](voiceExtension[_0x1d94('0x3b')]())[_0x1d94('0x20')](realtime[_0x1d94('0x3c')]())[_0x1d94('0x20')](faxAccount[_0x1d94('0x3d')]())['then'](realtime['initFaxAccounts']())[_0x1d94('0x20')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x1d94('0x20')](voiceQueueReport[_0x1d94('0x3e')]())[_0x1d94('0x20')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x1d94('0x3f')]())[_0x1d94('0x20')](realtime[_0x1d94('0x40')]())[_0x1d94('0x20')](cmHopperHistory[_0x1d94('0x41')]())['then'](realtime[_0x1d94('0x42')]())[_0x1d94('0x20')](voiceCallReport['getVoiceCallReports']())[_0x1d94('0x20')](realtime[_0x1d94('0x43')]())['catch'](function(_0x15b2c2){logger[_0x1d94('0x44')](_0x1d94('0x45'),util[_0x1d94('0x46')](_0x15b2c2,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x1d94('0x20')](function(_0x3d5d0b){return initRealtime();})[_0x1d94('0x20')](function(){return initParams();})[_0x1d94('0x20')](function(){report[_0x1d94('0x47')]();setInterval(initRealtime,0x1388);})[_0x1d94('0x48')](function(_0x2e4fd1){logger[_0x1d94('0x44')]('[index.js][main]',util[_0x1d94('0x46')](_0x2e4fd1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x5fce=['./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueHopperHistory','initCampaignHopperHistory','catch','error','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./acw'];(function(_0x26eb8e,_0x4d7769){var _0x28f2eb=function(_0xc36800){while(--_0xc36800){_0x26eb8e['push'](_0x26eb8e['shift']());}};_0x28f2eb(++_0x4d7769);}(_0x5fce,0x1eb));var _0xe5fc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5fce[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xe5fc('0x0'));var util=require(_0xe5fc('0x1'));var moment=require(_0xe5fc('0x2'));var server=require(_0xe5fc('0x3'));var Realtime=require(_0xe5fc('0x4'));var Report=require('./report');var Acw=require(_0xe5fc('0x5'));var Trigger=require(_0xe5fc('0x6'));var Dialer=require(_0xe5fc('0x7'));var Preview=require('./preview');var Fax=require(_0xe5fc('0x8'));var user=require(_0xe5fc('0x9'));var voiceQueue=require(_0xe5fc('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xe5fc('0xb'));var trunk=require(_0xe5fc('0xc'));var trigger=require(_0xe5fc('0xd'));var template=require(_0xe5fc('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe5fc('0xf'));var faxAccount=require(_0xe5fc('0x10'));var zendesk=require(_0xe5fc('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe5fc('0x12'));var freshdesk=require(_0xe5fc('0x13'));var desk=require(_0xe5fc('0x14'));var zoho=require(_0xe5fc('0x15'));var vtiger=require(_0xe5fc('0x16'));var freshsales=require(_0xe5fc('0x17'));var servicenow=require(_0xe5fc('0x18'));var dynamics365=require(_0xe5fc('0x19'));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(_0xe5fc('0x1a'))(_0xe5fc('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe5fc('0x1c')](_0xe5fc('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe5fc('0x1c')](_0xe5fc('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe5fc('0x1e')]()[_0xe5fc('0x1f')](user[_0xe5fc('0x20')]())['then'](realtime['initAgents']())[_0xe5fc('0x1f')](user[_0xe5fc('0x21')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x22')]())['then'](trunk[_0xe5fc('0x23')]())[_0xe5fc('0x1f')](realtime['initTrunks']())[_0xe5fc('0x1f')](voiceQueue[_0xe5fc('0x24')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x25')]())[_0xe5fc('0x1f')](trigger[_0xe5fc('0x26')]())['then'](realtime[_0xe5fc('0x27')]())[_0xe5fc('0x1f')](template[_0xe5fc('0x28')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x29')]())[_0xe5fc('0x1f')](zendesk['getZendeskAccounts']())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x2a')]())['then'](salesforce[_0xe5fc('0x2b')]())[_0xe5fc('0x1f')](realtime['initSalesforceAccounts']())[_0xe5fc('0x1f')](sugarcrm[_0xe5fc('0x2c')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x2d')]())[_0xe5fc('0x1f')](freshdesk[_0xe5fc('0x2e')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x2f')]())[_0xe5fc('0x1f')](desk[_0xe5fc('0x30')]())['then'](realtime[_0xe5fc('0x31')]())[_0xe5fc('0x1f')](zoho[_0xe5fc('0x32')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x33')]())[_0xe5fc('0x1f')](vtiger[_0xe5fc('0x34')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x35')]())[_0xe5fc('0x1f')](freshsales['getFreshsalesAccounts']())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x36')]())[_0xe5fc('0x1f')](servicenow[_0xe5fc('0x37')]())['then'](realtime[_0xe5fc('0x38')]())[_0xe5fc('0x1f')](dynamics365[_0xe5fc('0x39')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x3a')]())[_0xe5fc('0x1f')](campaign['getCampaigns']())['then'](realtime[_0xe5fc('0x3b')]())[_0xe5fc('0x1f')](voiceExtension[_0xe5fc('0x3c')]())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x3d')]())['then'](faxAccount['getFaxAccounts']())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x3e')]())[_0xe5fc('0x1f')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xe5fc('0x1f')](voiceQueueReport['getVoiceQueueReports']())[_0xe5fc('0x1f')](realtime['initVoiceQueueReports']())[_0xe5fc('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x3f')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xe5fc('0x1f')](realtime[_0xe5fc('0x40')]())['then'](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0xe5fc('0x41')](function(_0x24ed32){logger[_0xe5fc('0x42')]('[index.js][initParams]',util[_0xe5fc('0x43')](_0x24ed32,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe5fc('0x44')](realtime,preview,fax)['then'](function(_0x529e68){return initRealtime();})[_0xe5fc('0x1f')](function(){return initParams();})[_0xe5fc('0x1f')](function(){report[_0xe5fc('0x45')]();setInterval(initRealtime,0x1388);})[_0xe5fc('0x41')](function(_0x26e1fd){logger['error'](_0xe5fc('0x46'),util[_0xe5fc('0x43')](_0x26e1fd,{'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 461d048..4e79e8e 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x543cc3,_0x4fc3f3){var _0x4b7821=function(_0x24423b){while(--_0x24423b){_0x543cc3['push'](_0x543cc3['shift']());}};_0x4b7821(++_0x4fc3f3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0xcb91[_0x176317];return _0xef2759;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x4fe83b,_0x4ad912){var _0x4a6f59=function(_0x5e8bfa){while(--_0x5e8bfa){_0x4fe83b['push'](_0x4fe83b['shift']());}};_0x4a6f59(++_0x4ad912);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xcb91[_0x34f545];return _0x1ff6b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index eda538c..7dfda7d 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 _0x7532=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x7532,0x98));var _0x2753=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7532[_0x298ed3];return _0x5aad28;};'use strict';function Campaign(_0x569d28){this['id']=_0x569d28['id']||0x0;this[_0x2753('0x0')]=_0x569d28['name']||'';this[_0x2753('0x1')]=_0x569d28[_0x2753('0x1')]||_0x2753('0x2');this[_0x2753('0x3')]=0x0;this[_0x2753('0x4')]=0x0;this[_0x2753('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x2753('0x6')]=!![];this['active']=_0x569d28[_0x2753('0x7')];this[_0x2753('0x8')]=_0x569d28['limitCalls'];this[_0x2753('0x9')]=_0x569d28[_0x2753('0x9')]||null;this[_0x2753('0xa')]=_0x569d28[_0x2753('0xa')]?_0x569d28[_0x2753('0xa')]:null;this[_0x2753('0xb')]=_0x569d28[_0x2753('0xb')];this['dialOriginateCallerIdNumber']=_0x569d28[_0x2753('0xc')];this[_0x2753('0xd')]=_0x569d28[_0x2753('0xd')]||0x1e;this[_0x2753('0xe')]=_0x569d28[_0x2753('0xe')];this[_0x2753('0xf')]=_0x569d28[_0x2753('0xf')];this[_0x2753('0x10')]=_0x569d28[_0x2753('0x10')];this[_0x2753('0x11')]=_0x569d28[_0x2753('0x11')];this[_0x2753('0x12')]=_0x569d28[_0x2753('0x12')];this[_0x2753('0x13')]=_0x569d28[_0x2753('0x13')];this[_0x2753('0x14')]=_0x569d28[_0x2753('0x14')];this[_0x2753('0x15')]=_0x569d28[_0x2753('0x15')]||0x3;this[_0x2753('0x16')]=_0x569d28['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x569d28[_0x2753('0x17')]||0x3;this['dialDropRetryFrequency']=_0x569d28['dialDropRetryFrequency']||0x96;this[_0x2753('0x18')]=_0x569d28[_0x2753('0x18')]||0x3;this[_0x2753('0x19')]=_0x569d28[_0x2753('0x19')]||0x96;this[_0x2753('0x1a')]=_0x569d28[_0x2753('0x1a')]||0x3;this[_0x2753('0x1b')]=_0x569d28[_0x2753('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x569d28[_0x2753('0x1c')]||0x3;this[_0x2753('0x1d')]=_0x569d28[_0x2753('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x569d28[_0x2753('0x1e')]||'DESC';this['dialPrefix']=_0x569d28['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x569d28[_0x2753('0x1f')]||undefined;this['dialCutDigit']=_0x569d28[_0x2753('0x20')]||undefined;this['TrunkBackup']=_0x569d28['TrunkBackup']?_0x569d28['TrunkBackup']:undefined;this[_0x2753('0x21')]=_0x569d28[_0x2753('0x21')]?_0x569d28[_0x2753('0x21')]:undefined;this[_0x2753('0x22')]=_0x569d28['Interval']?_0x569d28[_0x2753('0x22')]:undefined;this[_0x2753('0x23')]=_0x569d28[_0x2753('0x23')]?_0x569d28[_0x2753('0x23')]:undefined;this[_0x2753('0x24')]=_0x569d28[_0x2753('0x23')]?_0x569d28[_0x2753('0x23')][_0x2753('0x0')]:undefined;this[_0x2753('0x25')]=_0x569d28[_0x2753('0x25')]||![];this[_0x2753('0x26')]=_0x569d28[_0x2753('0x26')];this[_0x2753('0x27')]=_0x569d28[_0x2753('0x27')];this[_0x2753('0x28')]=_0x569d28['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x569d28[_0x2753('0x29')];this['dialAMDMinWordLength']=_0x569d28[_0x2753('0x2a')];this[_0x2753('0x2b')]=_0x569d28['dialAMDBetweenWordsSilence'];this[_0x2753('0x2c')]=_0x569d28[_0x2753('0x2c')];this[_0x2753('0x2d')]=_0x569d28['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x569d28[_0x2753('0x2e')];}module[_0x2753('0x2f')]=Campaign; \ No newline at end of file +var _0x50c5=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x35fc51,_0x102a3d){var _0x32d1c0=function(_0xc746d2){while(--_0xc746d2){_0x35fc51['push'](_0x35fc51['shift']());}};_0x32d1c0(++_0x102a3d);}(_0x50c5,0x7f));var _0x550c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50c5[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x307883){this['id']=_0x307883['id']||0x0;this[_0x550c('0x0')]=_0x307883[_0x550c('0x0')]||'';this['type']=_0x307883[_0x550c('0x1')]||_0x550c('0x2');this[_0x550c('0x3')]=0x0;this['temp']=0x0;this[_0x550c('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x550c('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x307883[_0x550c('0x6')];this[_0x550c('0x7')]=_0x307883['limitCalls'];this[_0x550c('0x8')]=_0x307883['dialTimezone']||null;this[_0x550c('0x9')]=_0x307883[_0x550c('0x9')]?_0x307883[_0x550c('0x9')]:null;this['dialOriginateCallerIdName']=_0x307883[_0x550c('0xa')];this[_0x550c('0xb')]=_0x307883[_0x550c('0xb')];this[_0x550c('0xc')]=_0x307883[_0x550c('0xc')]||0x1e;this[_0x550c('0xd')]=_0x307883[_0x550c('0xd')];this[_0x550c('0xe')]=_0x307883['dialCongestionRetryFrequency'];this[_0x550c('0xf')]=_0x307883[_0x550c('0xf')];this['dialBusyRetryFrequency']=_0x307883[_0x550c('0x10')];this[_0x550c('0x11')]=_0x307883[_0x550c('0x11')];this[_0x550c('0x12')]=_0x307883[_0x550c('0x12')];this['dialGlobalMaxRetry']=_0x307883[_0x550c('0x13')];this[_0x550c('0x14')]=_0x307883[_0x550c('0x14')]||0x3;this[_0x550c('0x15')]=_0x307883['dialNoSuchNumberRetryFrequency']||0x96;this[_0x550c('0x16')]=_0x307883[_0x550c('0x16')]||0x3;this[_0x550c('0x17')]=_0x307883[_0x550c('0x17')]||0x96;this[_0x550c('0x18')]=_0x307883[_0x550c('0x18')]||0x3;this[_0x550c('0x19')]=_0x307883[_0x550c('0x19')]||0x96;this[_0x550c('0x1a')]=_0x307883[_0x550c('0x1a')]||0x3;this[_0x550c('0x1b')]=_0x307883[_0x550c('0x1b')]||0x96;this[_0x550c('0x1c')]=_0x307883['dialAgentRejectMaxRetry']||0x3;this[_0x550c('0x1d')]=_0x307883[_0x550c('0x1d')]||0x96;this[_0x550c('0x1e')]=_0x307883['dialOrderByScheduledAt']||_0x550c('0x1f');this[_0x550c('0x20')]=_0x307883[_0x550c('0x20')]||undefined;this[_0x550c('0x21')]=_0x307883[_0x550c('0x21')]||undefined;this[_0x550c('0x22')]=_0x307883[_0x550c('0x22')]||undefined;this['TrunkBackup']=_0x307883[_0x550c('0x23')]?_0x307883[_0x550c('0x23')]:undefined;this[_0x550c('0x24')]=_0x307883['Trunk']?_0x307883['Trunk']:undefined;this[_0x550c('0x25')]=_0x307883[_0x550c('0x25')]?_0x307883[_0x550c('0x25')]:undefined;this[_0x550c('0x26')]=_0x307883[_0x550c('0x26')]?_0x307883[_0x550c('0x26')]:undefined;this[_0x550c('0x27')]=_0x307883['SquareProject']?_0x307883[_0x550c('0x26')][_0x550c('0x0')]:undefined;this[_0x550c('0x28')]=_0x307883['dialAMDActive']||![];this[_0x550c('0x29')]=_0x307883['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x307883[_0x550c('0x2a')];this[_0x550c('0x2b')]=_0x307883[_0x550c('0x2b')];this['dialAMDTotalAnalysisTime']=_0x307883[_0x550c('0x2c')];this[_0x550c('0x2d')]=_0x307883[_0x550c('0x2d')];this[_0x550c('0x2e')]=_0x307883[_0x550c('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x307883[_0x550c('0x2f')];this[_0x550c('0x30')]=_0x307883[_0x550c('0x30')];this['dialAMDMaximumWordLength']=_0x307883[_0x550c('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 729606d..6c7f817 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 _0x68bc=['abandoned','lastapplication','lastdata','duration','holdtime','type','tag','monitor','queue','monitors','transfercalleridnum','transferType','mohtime','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged'];(function(_0x214fa1,_0xf0b839){var _0x47c7a2=function(_0x4a80bf){while(--_0x4a80bf){_0x214fa1['push'](_0x214fa1['shift']());}};_0x47c7a2(++_0xf0b839);}(_0x68bc,0xbc));var _0xc68b=function(_0x361939,_0x2eab1e){_0x361939=_0x361939-0x0;var _0x3a6275=_0x68bc[_0x361939];return _0x3a6275;};'use strict';function Channel(){this[_0xc68b('0x0')]=null;this['channel']='';this[_0xc68b('0x1')]='';this['calleridnum']=0x0;this[_0xc68b('0x2')]='';this[_0xc68b('0x3')]=undefined;this[_0xc68b('0x4')]=undefined;this['accountcode']=0x0;this[_0xc68b('0x5')]='';this[_0xc68b('0x6')]=0x0;this[_0xc68b('0x7')]=0x0;this[_0xc68b('0x8')]=0x0;this['answered']=![];this[_0xc68b('0x9')]=null;this[_0xc68b('0xa')]=null;this[_0xc68b('0xb')]=![];this[_0xc68b('0xc')]=![];this[_0xc68b('0xd')]='';this[_0xc68b('0xe')]='';this[_0xc68b('0xf')]=0x0;this['billableseconds']=0x0;this[_0xc68b('0x10')]=0x0;this[_0xc68b('0x11')]=null;this[_0xc68b('0x12')]=null;this['disposition']=null;this[_0xc68b('0x13')]=![];this['monitorFilename']=null;this[_0xc68b('0x14')]=null;this[_0xc68b('0x15')]=[];this[_0xc68b('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc68b('0x17')]=undefined;this[_0xc68b('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xc6c0=['holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','billableseconds'];(function(_0x237db0,_0xcff0ed){var _0x590234=function(_0x8ebd91){while(--_0x8ebd91){_0x237db0['push'](_0x237db0['shift']());}};_0x590234(++_0xcff0ed);}(_0xc6c0,0x1b1));var _0x0c6c=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xc6c0[_0x65c50e];return _0x4573e7;};'use strict';function Channel(){this['starttime']=null;this[_0x0c6c('0x0')]='';this[_0x0c6c('0x1')]='';this[_0x0c6c('0x2')]=0x0;this[_0x0c6c('0x3')]='';this['connectedlinenum']=undefined;this[_0x0c6c('0x4')]=undefined;this[_0x0c6c('0x5')]=0x0;this[_0x0c6c('0x6')]='';this[_0x0c6c('0x7')]=0x0;this[_0x0c6c('0x8')]=0x0;this[_0x0c6c('0x9')]=0x0;this[_0x0c6c('0xa')]=![];this[_0x0c6c('0xb')]=null;this[_0x0c6c('0xc')]=null;this[_0x0c6c('0xd')]=![];this['abandoned']=![];this[_0x0c6c('0xe')]='';this[_0x0c6c('0xf')]='';this['duration']=0x0;this[_0x0c6c('0x10')]=0x0;this[_0x0c6c('0x11')]=0x0;this[_0x0c6c('0x12')]=null;this[_0x0c6c('0x13')]=null;this[_0x0c6c('0x14')]=null;this['monitor']=![];this[_0x0c6c('0x15')]=null;this['queue']=null;this[_0x0c6c('0x16')]=[];this[_0x0c6c('0x17')]=undefined;this[_0x0c6c('0x18')]=undefined;this['transferType']=undefined;this['mohtime']=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 1e4fec0..a8ef766 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 _0x1d42=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType'];(function(_0xfaa5a5,_0x4b26f3){var _0x58ceaf=function(_0x4430c0){while(--_0x4430c0){_0xfaa5a5['push'](_0xfaa5a5['shift']());}};_0x58ceaf(++_0x4b26f3);}(_0x1d42,0x68));var _0x21d4=function(_0xaf4af7,_0x6a8b6f){_0xaf4af7=_0xaf4af7-0x0;var _0x596009=_0x1d42[_0xaf4af7];return _0x596009;};'use strict';function DeskAccount(_0x4a7b3a){this['id']=_0x4a7b3a['id']||0x0;this[_0x21d4('0x0')]=_0x4a7b3a['name']||'';this[_0x21d4('0x1')]=_0x4a7b3a[_0x21d4('0x1')]||'';this[_0x21d4('0x2')]=_0x4a7b3a[_0x21d4('0x2')]||'';this[_0x21d4('0x3')]=_0x4a7b3a[_0x21d4('0x3')]||'';this[_0x21d4('0x4')]=_0x4a7b3a[_0x21d4('0x4')]||'';this[_0x21d4('0x5')]=_0x4a7b3a[_0x21d4('0x5')]||'';this['consumerSecret']=_0x4a7b3a[_0x21d4('0x6')]||'';this[_0x21d4('0x7')]=_0x4a7b3a['token']||'';this[_0x21d4('0x8')]=_0x4a7b3a[_0x21d4('0x8')]||'';this['type']=_0x4a7b3a[_0x21d4('0x9')]||'';this[_0x21d4('0xa')]=_0x4a7b3a[_0x21d4('0xa')]||'';this[_0x21d4('0xb')]=_0x4a7b3a[_0x21d4('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xb852=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x3f1b2d,_0xdf16e1){var _0x1bc16b=function(_0x72f4d3){while(--_0x72f4d3){_0x3f1b2d['push'](_0x3f1b2d['shift']());}};_0x1bc16b(++_0xdf16e1);}(_0xb852,0xac));var _0x2b85=function(_0x14787d,_0x51e53c){_0x14787d=_0x14787d-0x0;var _0x33f852=_0xb852[_0x14787d];return _0x33f852;};'use strict';function DeskAccount(_0x3d2d44){this['id']=_0x3d2d44['id']||0x0;this[_0x2b85('0x0')]=_0x3d2d44[_0x2b85('0x0')]||'';this[_0x2b85('0x1')]=_0x3d2d44[_0x2b85('0x1')]||'';this['remoteUri']=_0x3d2d44[_0x2b85('0x2')]||'';this[_0x2b85('0x3')]=_0x3d2d44[_0x2b85('0x3')]||'';this[_0x2b85('0x4')]=_0x3d2d44['password']||'';this[_0x2b85('0x5')]=_0x3d2d44[_0x2b85('0x5')]||'';this[_0x2b85('0x6')]=_0x3d2d44['consumerSecret']||'';this[_0x2b85('0x7')]=_0x3d2d44['token']||'';this[_0x2b85('0x8')]=_0x3d2d44[_0x2b85('0x8')]||'';this[_0x2b85('0x9')]=_0x3d2d44[_0x2b85('0x9')]||'';this['serverUrl']=_0x3d2d44[_0x2b85('0xa')]||'';this['Configurations']=_0x3d2d44[_0x2b85('0xb')]||{};}module[_0x2b85('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index bbe9621..d1d92ff 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 _0x8adf=['name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x1f483a,_0x10aaec){var _0x4e0c88=function(_0x5227a3){while(--_0x5227a3){_0x1f483a['push'](_0x1f483a['shift']());}};_0x4e0c88(++_0x10aaec);}(_0x8adf,0x168));var _0xf8ad=function(_0x357202,_0x18b11b){_0x357202=_0x357202-0x0;var _0x319634=_0x8adf[_0x357202];return _0x319634;};'use strict';function Dynamics365Account(_0x366f84){this['id']=_0x366f84['id']||0x0;this[_0xf8ad('0x0')]=_0x366f84[_0xf8ad('0x0')]||'';this['username']=_0x366f84['username']||'';this[_0xf8ad('0x1')]=_0x366f84['password']||'';this[_0xf8ad('0x2')]=_0x366f84[_0xf8ad('0x2')]||'';this[_0xf8ad('0x3')]=_0x366f84[_0xf8ad('0x3')]||'';this['clientId']=_0x366f84[_0xf8ad('0x4')]||'';this[_0xf8ad('0x5')]=_0x366f84[_0xf8ad('0x5')]||{};this[_0xf8ad('0x6')]=_0x366f84[_0xf8ad('0x6')]||'';this[_0xf8ad('0x7')]=_0x366f84['modernAuthentication']||![];this[_0xf8ad('0x8')]=_0x366f84[_0xf8ad('0x8')]||{};this[_0xf8ad('0x9')]=_0x366f84[_0xf8ad('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x127d=['CloudProvider','exports','name','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x127d,0x17e));var _0xd127=function(_0x40a2d9,_0x213d14){_0x40a2d9=_0x40a2d9-0x0;var _0x15ac11=_0x127d[_0x40a2d9];return _0x15ac11;};'use strict';function Dynamics365Account(_0x1a382b){this['id']=_0x1a382b['id']||0x0;this[_0xd127('0x0')]=_0x1a382b[_0xd127('0x0')]||'';this[_0xd127('0x1')]=_0x1a382b[_0xd127('0x1')]||'';this['password']=_0x1a382b['password']||'';this['remoteUri']=_0x1a382b[_0xd127('0x2')]||'';this[_0xd127('0x3')]=_0x1a382b[_0xd127('0x3')]||'';this[_0xd127('0x4')]=_0x1a382b[_0xd127('0x4')]||'';this[_0xd127('0x5')]=_0x1a382b[_0xd127('0x5')]||{};this['serverUrl']=_0x1a382b['serverUrl']||'';this[_0xd127('0x6')]=_0x1a382b[_0xd127('0x6')]||![];this[_0xd127('0x7')]=_0x1a382b['Configurations']||{};this['CloudProvider']=_0x1a382b[_0xd127('0x8')]||{};}module[_0xd127('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index db34629..4b87214 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 _0x2b09=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x318f47,_0x3c396f){var _0x101e3a=function(_0x10505f){while(--_0x10505f){_0x318f47['push'](_0x318f47['shift']());}};_0x101e3a(++_0x3c396f);}(_0x2b09,0x1bb));var _0x92b0=function(_0x18d469,_0x48eb85){_0x18d469=_0x18d469-0x0;var _0x26f438=_0x2b09[_0x18d469];return _0x26f438;};'use strict';function FaxAccount(_0x58c321){this['id']=_0x58c321['id']||0x0;this[_0x92b0('0x0')]=_0x58c321[_0x92b0('0x0')]||'';this[_0x92b0('0x1')]=_0x58c321['description'];this[_0x92b0('0x2')]=_0x58c321[_0x92b0('0x2')];this[_0x92b0('0x3')]=_0x58c321[_0x92b0('0x3')];this[_0x92b0('0x4')]=_0x58c321[_0x92b0('0x4')];this['minrate']=_0x58c321[_0x92b0('0x5')]||0x960;this['maxrate']=_0x58c321[_0x92b0('0x6')]||0x3840;this[_0x92b0('0x7')]=_0x58c321[_0x92b0('0x7')]||_0x92b0('0x8');this['gateway']=_0x58c321[_0x92b0('0x9')]||'no';this[_0x92b0('0xa')]=_0x58c321[_0x92b0('0xa')]||'no';this['t38timeout']=_0x58c321[_0x92b0('0xb')]||0x1388;this[_0x92b0('0xc')]=_0x58c321[_0x92b0('0xc')]||_0x92b0('0xd');this['Trunk']=_0x58c321[_0x92b0('0xe')]?_0x58c321[_0x92b0('0xe')]:undefined;this[_0x92b0('0xf')]=_0x58c321[_0x92b0('0xf')];this[_0x92b0('0x10')]=_0x58c321[_0x92b0('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x67bc=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x4201cc,_0x247989){var _0x48c127=function(_0x3216b9){while(--_0x3216b9){_0x4201cc['push'](_0x4201cc['shift']());}};_0x48c127(++_0x247989);}(_0x67bc,0xf3));var _0xc67b=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0x67bc[_0x228641];return _0x5d5d78;};'use strict';function FaxAccount(_0x255e53){this['id']=_0x255e53['id']||0x0;this['name']=_0x255e53[_0xc67b('0x0')]||'';this[_0xc67b('0x1')]=_0x255e53[_0xc67b('0x1')];this['ecm']=_0x255e53[_0xc67b('0x2')];this[_0xc67b('0x3')]=_0x255e53[_0xc67b('0x3')];this['localstationid']=_0x255e53[_0xc67b('0x4')];this['minrate']=_0x255e53[_0xc67b('0x5')]||0x960;this['maxrate']=_0x255e53['maxrate']||0x3840;this['modem']=_0x255e53['modem']||_0xc67b('0x6');this[_0xc67b('0x7')]=_0x255e53[_0xc67b('0x7')]||'no';this[_0xc67b('0x8')]=_0x255e53[_0xc67b('0x8')]||'no';this[_0xc67b('0x9')]=_0x255e53[_0xc67b('0x9')]||0x1388;this[_0xc67b('0xa')]=_0x255e53[_0xc67b('0xa')]||_0xc67b('0xb');this[_0xc67b('0xc')]=_0x255e53[_0xc67b('0xc')]?_0x255e53['Trunk']:undefined;this[_0xc67b('0xd')]=_0x255e53[_0xc67b('0xd')];this[_0xc67b('0xe')]=_0x255e53['key'];}module[_0xc67b('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 25c6a55..81e209a 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 _0x8559=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8559,0x133));var _0x9855=function(_0x38c408,_0x27e4f4){_0x38c408=_0x38c408-0x0;var _0x32e8b9=_0x8559[_0x38c408];return _0x32e8b9;};'use strict';function FreshdeskAccount(_0x15def2){this['id']=_0x15def2['id']||0x0;this['name']=_0x15def2[_0x9855('0x0')]||'';this[_0x9855('0x1')]=_0x15def2['username']||'';this[_0x9855('0x2')]=_0x15def2[_0x9855('0x3')]||'';this['remoteUri']=_0x15def2[_0x9855('0x4')]||'';this[_0x9855('0x5')]=_0x15def2[_0x9855('0x5')]||'';this[_0x9855('0x6')]=_0x15def2[_0x9855('0x6')]||{};}module[_0x9855('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x23ce=['token','remoteUri','serverUrl','exports','name','username'];(function(_0x3cde37,_0x1e70cc){var _0x1bb570=function(_0x18fa29){while(--_0x18fa29){_0x3cde37['push'](_0x3cde37['shift']());}};_0x1bb570(++_0x1e70cc);}(_0x23ce,0x1ea));var _0xe23c=function(_0x13d693,_0x943ecc){_0x13d693=_0x13d693-0x0;var _0x55f2ec=_0x23ce[_0x13d693];return _0x55f2ec;};'use strict';function FreshdeskAccount(_0x326669){this['id']=_0x326669['id']||0x0;this[_0xe23c('0x0')]=_0x326669[_0xe23c('0x0')]||'';this[_0xe23c('0x1')]=_0x326669[_0xe23c('0x1')]||'';this['apiKey']=_0x326669[_0xe23c('0x2')]||'';this['remoteUri']=_0x326669[_0xe23c('0x3')]||'';this['serverUrl']=_0x326669[_0xe23c('0x4')]||'';this['Configurations']=_0x326669['Configurations']||{};}module[_0xe23c('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7351072..88ec2b2 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 _0xafa5=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4b8e5d,_0x2f4f97){var _0x192286=function(_0x435997){while(--_0x435997){_0x4b8e5d['push'](_0x4b8e5d['shift']());}};_0x192286(++_0x2f4f97);}(_0xafa5,0x1af));var _0x5afa=function(_0xabd41e,_0x57cb0b){_0xabd41e=_0xabd41e-0x0;var _0x39c37b=_0xafa5[_0xabd41e];return _0x39c37b;};'use strict';function FreshsalesAccount(_0x3458cc){this['id']=_0x3458cc['id']||0x0;this[_0x5afa('0x0')]=_0x3458cc[_0x5afa('0x0')]||'';this[_0x5afa('0x1')]=_0x3458cc[_0x5afa('0x1')]||'';this[_0x5afa('0x2')]=_0x3458cc[_0x5afa('0x3')]||'';this[_0x5afa('0x4')]=_0x3458cc[_0x5afa('0x4')]||'';this[_0x5afa('0x5')]=_0x3458cc[_0x5afa('0x5')]||'';this[_0x5afa('0x6')]=_0x3458cc['Configurations']||{};}module[_0x5afa('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x49e5=['username','token','remoteUri','serverUrl','Configurations','name'];(function(_0x4cfa88,_0x47f1f7){var _0x497e2a=function(_0x533624){while(--_0x533624){_0x4cfa88['push'](_0x4cfa88['shift']());}};_0x497e2a(++_0x47f1f7);}(_0x49e5,0x71));var _0x549e=function(_0x1b1bd5,_0xf50a3){_0x1b1bd5=_0x1b1bd5-0x0;var _0x12bf17=_0x49e5[_0x1b1bd5];return _0x12bf17;};'use strict';function FreshsalesAccount(_0x3a1a4a){this['id']=_0x3a1a4a['id']||0x0;this[_0x549e('0x0')]=_0x3a1a4a[_0x549e('0x0')]||'';this[_0x549e('0x1')]=_0x3a1a4a[_0x549e('0x1')]||'';this['apiKey']=_0x3a1a4a[_0x549e('0x2')]||'';this[_0x549e('0x3')]=_0x3a1a4a[_0x549e('0x3')]||'';this[_0x549e('0x4')]=_0x3a1a4a[_0x549e('0x4')]||'';this['Configurations']=_0x3a1a4a[_0x549e('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 e09889c..74f2542 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 _0x8c0b=['variables','exports','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime'];(function(_0x243c32,_0x36d3b1){var _0x2d91ec=function(_0x58c9aa){while(--_0x58c9aa){_0x243c32['push'](_0x243c32['shift']());}};_0x2d91ec(++_0x36d3b1);}(_0x8c0b,0x1ba));var _0xb8c0=function(_0x2ad826,_0xec0ac3){_0x2ad826=_0x2ad826-0x0;var _0x2610bd=_0x8c0b[_0x2ad826];return _0x2610bd;};'use strict';function QueueReport(){this['type']='inbound';this[_0xb8c0('0x0')]='';this[_0xb8c0('0x1')]='';this[_0xb8c0('0x2')]='';this['queue']='';this[_0xb8c0('0x3')]=null;this[_0xb8c0('0x4')]=null;this['position']=0x1;this[_0xb8c0('0x5')]=0x1;this['queuecallerabandon']=![];this[_0xb8c0('0x6')]=null;this[_0xb8c0('0x7')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xb8c0('0x8')]=null;this[_0xb8c0('0x9')]=0x1;this[_0xb8c0('0xa')]='';this['connectedlinenum']='';this[_0xb8c0('0xb')]='';this['accountcode']='';this[_0xb8c0('0xc')]='';this[_0xb8c0('0xd')]='';this['priority']='';this[_0xb8c0('0xe')]=0x0;this[_0xb8c0('0xf')]=![];this[_0xb8c0('0x10')]='';this[_0xb8c0('0x11')]=_0xb8c0('0x12');this[_0xb8c0('0x13')]=0x0;this[_0xb8c0('0x14')]={};}module[_0xb8c0('0x15')]=QueueReport; \ No newline at end of file +var _0x0ea6=['count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','priority','holdtime','assigned','motionChannel','voice','variables','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','position'];(function(_0x383b57,_0x55680d){var _0x3477c6=function(_0x341e92){while(--_0x341e92){_0x383b57['push'](_0x383b57['shift']());}};_0x3477c6(++_0x55680d);}(_0x0ea6,0x1c8));var _0x60ea=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x0ea6[_0x4394b6];return _0x360244;};'use strict';function QueueReport(){this[_0x60ea('0x0')]='inbound';this[_0x60ea('0x1')]='';this[_0x60ea('0x2')]='';this[_0x60ea('0x3')]='';this['queue']='';this[_0x60ea('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x60ea('0x5')]=0x1;this[_0x60ea('0x6')]=0x1;this[_0x60ea('0x7')]=![];this[_0x60ea('0x8')]=null;this['queuecallercomplete']=![];this[_0x60ea('0x9')]=null;this[_0x60ea('0xa')]=![];this[_0x60ea('0xb')]=null;this[_0x60ea('0xc')]=0x1;this[_0x60ea('0xd')]='';this[_0x60ea('0xe')]='';this['connectedlinename']='';this['accountcode']='';this[_0x60ea('0xf')]='';this['exten']='';this[_0x60ea('0x10')]='';this[_0x60ea('0x11')]=0x0;this[_0x60ea('0x12')]=![];this['lastAssignedTo']='';this[_0x60ea('0x13')]=_0x60ea('0x14');this['mohtime']=0x0;this[_0x60ea('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 085b121..561bf3b 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 _0xd535=['exports','name','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x230b97,_0x2b9b02){var _0x31ae00=function(_0x38af1e){while(--_0x38af1e){_0x230b97['push'](_0x230b97['shift']());}};_0x31ae00(++_0x2b9b02);}(_0xd535,0x161));var _0x5d53=function(_0x5d4bbc,_0x3156ee){_0x5d4bbc=_0x5d4bbc-0x0;var _0x44a6b0=_0xd535[_0x5d4bbc];return _0x44a6b0;};'use strict';function SalesforceAccount(_0x23e89){this['id']=_0x23e89['id']||0x0;this[_0x5d53('0x0')]=_0x23e89['name']||'';this['username']=_0x23e89['username']||'';this[_0x5d53('0x1')]=_0x23e89['remoteUri']||'';this['password']=_0x23e89[_0x5d53('0x2')]||'';this[_0x5d53('0x3')]=_0x23e89[_0x5d53('0x3')]||'';this[_0x5d53('0x4')]=_0x23e89[_0x5d53('0x4')]||'';this[_0x5d53('0x5')]=_0x23e89[_0x5d53('0x5')]||'';this[_0x5d53('0x6')]=_0x23e89[_0x5d53('0x6')]||_0x5d53('0x7');this['serverUrl']=_0x23e89[_0x5d53('0x8')]||'';this['Configurations']=_0x23e89[_0x5d53('0x9')]||{};}module[_0x5d53('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x5323=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x4b47f1,_0x33f43c){var _0x47ef15=function(_0x50948a){while(--_0x50948a){_0x4b47f1['push'](_0x4b47f1['shift']());}};_0x47ef15(++_0x33f43c);}(_0x5323,0x88));var _0x3532=function(_0x526994,_0x2335bb){_0x526994=_0x526994-0x0;var _0x251f11=_0x5323[_0x526994];return _0x251f11;};'use strict';function SalesforceAccount(_0x2f14b1){this['id']=_0x2f14b1['id']||0x0;this[_0x3532('0x0')]=_0x2f14b1[_0x3532('0x0')]||'';this[_0x3532('0x1')]=_0x2f14b1[_0x3532('0x1')]||'';this['remoteUri']=_0x2f14b1[_0x3532('0x2')]||'';this[_0x3532('0x3')]=_0x2f14b1[_0x3532('0x3')]||'';this['clientId']=_0x2f14b1[_0x3532('0x4')]||'';this[_0x3532('0x5')]=_0x2f14b1[_0x3532('0x5')]||'';this['securityToken']=_0x2f14b1[_0x3532('0x6')]||'';this['type']=_0x2f14b1[_0x3532('0x7')]||'integrationTab';this[_0x3532('0x8')]=_0x2f14b1[_0x3532('0x8')]||'';this['Configurations']=_0x2f14b1[_0x3532('0x9')]||{};}module[_0x3532('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 6e8b273..3db9d2a 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 _0x27b8=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5c3eeb,_0x219217){var _0x5209db=function(_0x3fa3c9){while(--_0x3fa3c9){_0x5c3eeb['push'](_0x5c3eeb['shift']());}};_0x5209db(++_0x219217);}(_0x27b8,0x14b));var _0x827b=function(_0x15b4e4,_0xe8567c){_0x15b4e4=_0x15b4e4-0x0;var _0x443034=_0x27b8[_0x15b4e4];return _0x443034;};'use strict';function ServicenowAccount(_0x5728e5){this['id']=_0x5728e5['id']||0x0;this[_0x827b('0x0')]=_0x5728e5[_0x827b('0x0')]||'';this[_0x827b('0x1')]=_0x5728e5[_0x827b('0x1')]||'';this[_0x827b('0x2')]=_0x5728e5[_0x827b('0x2')]||'';this[_0x827b('0x3')]=_0x5728e5['remoteUri']||'';this[_0x827b('0x4')]=_0x5728e5[_0x827b('0x4')]||'';this[_0x827b('0x5')]=_0x5728e5[_0x827b('0x5')]||{};}module[_0x827b('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x32bc=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1be3bb,_0x2e7bb6){var _0x3b9455=function(_0x3bc48d){while(--_0x3bc48d){_0x1be3bb['push'](_0x1be3bb['shift']());}};_0x3b9455(++_0x2e7bb6);}(_0x32bc,0x1b0));var _0xc32b=function(_0x26e20c,_0x11234b){_0x26e20c=_0x26e20c-0x0;var _0x259e40=_0x32bc[_0x26e20c];return _0x259e40;};'use strict';function ServicenowAccount(_0x20b93d){this['id']=_0x20b93d['id']||0x0;this[_0xc32b('0x0')]=_0x20b93d[_0xc32b('0x0')]||'';this[_0xc32b('0x1')]=_0x20b93d['username']||'';this[_0xc32b('0x2')]=_0x20b93d[_0xc32b('0x2')]||'';this[_0xc32b('0x3')]=_0x20b93d[_0xc32b('0x3')]||'';this[_0xc32b('0x4')]=_0x20b93d[_0xc32b('0x4')]||'';this[_0xc32b('0x5')]=_0x20b93d['Configurations']||{};}module[_0xc32b('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 dc9e80f..d17e28e 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 _0xcffc=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0xcffc,0x1d1));var _0xccff=function(_0x1b2ba6,_0x214249){_0x1b2ba6=_0x1b2ba6-0x0;var _0x27ede8=_0xcffc[_0x1b2ba6];return _0x27ede8;};'use strict';function SugarcrmAccount(_0x7cf913){this['id']=_0x7cf913['id']||0x0;this[_0xccff('0x0')]=_0x7cf913[_0xccff('0x0')]||'';this[_0xccff('0x1')]=_0x7cf913[_0xccff('0x1')]||'';this[_0xccff('0x2')]=_0x7cf913['password']||'';this[_0xccff('0x3')]=_0x7cf913['remoteUri']||'';this[_0xccff('0x4')]=_0x7cf913[_0xccff('0x4')]||'';this[_0xccff('0x5')]=_0x7cf913['Configurations']||{};}module[_0xccff('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xf57c=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x3bac03,_0x27af82){var _0x1f5249=function(_0x5450dc){while(--_0x5450dc){_0x3bac03['push'](_0x3bac03['shift']());}};_0x1f5249(++_0x27af82);}(_0xf57c,0x18f));var _0xcf57=function(_0x26795a,_0x47eb4a){_0x26795a=_0x26795a-0x0;var _0x257b92=_0xf57c[_0x26795a];return _0x257b92;};'use strict';function SugarcrmAccount(_0x394b3b){this['id']=_0x394b3b['id']||0x0;this[_0xcf57('0x0')]=_0x394b3b['name']||'';this[_0xcf57('0x1')]=_0x394b3b[_0xcf57('0x1')]||'';this[_0xcf57('0x2')]=_0x394b3b[_0xcf57('0x2')]||'';this[_0xcf57('0x3')]=_0x394b3b[_0xcf57('0x3')]||'';this[_0xcf57('0x4')]=_0x394b3b[_0xcf57('0x4')]||'';this['Configurations']=_0x394b3b['Configurations']||{};}module[_0xcf57('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 2305690..52e6c96 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 _0xf990=['unknown','status','exports','name','accountcode','state'];(function(_0x4307ec,_0xd155b9){var _0xe25862=function(_0xf12c36){while(--_0xf12c36){_0x4307ec['push'](_0x4307ec['shift']());}};_0xe25862(++_0xd155b9);}(_0xf990,0x87));var _0x0f99=function(_0xb49d10,_0x103e8c){_0xb49d10=_0xb49d10-0x0;var _0x2a8e96=_0xf990[_0xb49d10];return _0x2a8e96;};'use strict';function Telephone(_0x385b23){this['id']=_0x385b23['id']||0x0;this['name']=_0x385b23[_0x0f99('0x0')]||'';this[_0x0f99('0x1')]=_0x385b23['accountcode']||'';this[_0x0f99('0x2')]=_0x0f99('0x3');this['stateTime']=0x0;this[_0x0f99('0x4')]=_0x0f99('0x3');this['address']='';}module[_0x0f99('0x5')]=Telephone; \ No newline at end of file +var _0xa521=['unknown','address','exports','name','accountcode','state','stateTime','status'];(function(_0x391072,_0x2288f2){var _0x5ca7c3=function(_0x245f8b){while(--_0x245f8b){_0x391072['push'](_0x391072['shift']());}};_0x5ca7c3(++_0x2288f2);}(_0xa521,0xeb));var _0x1a52=function(_0x3d1694,_0x18abd4){_0x3d1694=_0x3d1694-0x0;var _0x525a29=_0xa521[_0x3d1694];return _0x525a29;};'use strict';function Telephone(_0x1df222){this['id']=_0x1df222['id']||0x0;this[_0x1a52('0x0')]=_0x1df222['name']||'';this['accountcode']=_0x1df222[_0x1a52('0x1')]||'';this[_0x1a52('0x2')]='unknown';this[_0x1a52('0x3')]=0x0;this[_0x1a52('0x4')]=_0x1a52('0x5');this[_0x1a52('0x6')]='';}module[_0x1a52('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2b451cd..65e79b8 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(_0x3b3b31,_0x3766bb){var _0x523e8f=function(_0x8d55b9){while(--_0x8d55b9){_0x3b3b31['push'](_0x3b3b31['shift']());}};_0x523e8f(++_0x3766bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x448c5d,_0x500b3d){var _0x50d903=function(_0xab2285){while(--_0xab2285){_0x448c5d['push'](_0x448c5d['shift']());}};_0x50d903(++_0x500b3d);}(_0xb10b,0x12a));var _0xbb10=function(_0x120da6,_0x15f450){_0x120da6=_0x120da6-0x0;var _0x3d6c07=_0xb10b[_0x120da6];return _0x3d6c07;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 6dddb50..ba6effd 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x10e3ce,_0x5a9272){var _0x2cf532=function(_0x29f052){while(--_0x29f052){_0x10e3ce['push'](_0x10e3ce['shift']());}};_0x2cf532(++_0x5a9272);}(_0xda3f,0xec));var _0xfda3=function(_0x46fe0a,_0x4d9ac9){_0x46fe0a=_0x46fe0a-0x0;var _0x39e0da=_0xda3f[_0x46fe0a];return _0x39e0da;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 2cf884b..425e878 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 _0xc7f3=['domainport','refresh','address','defaultuser','active','name','unknown','stateTime','status','registry','split','host','port','domain'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xc7f3,0xd6));var _0x3c7f=function(_0x41cd93,_0x382eb8){_0x41cd93=_0x41cd93-0x0;var _0x58a7f8=_0xc7f3[_0x41cd93];return _0x58a7f8;};'use strict';function Trunk(_0x561808){this['id']=_0x561808['id']||0x0;this[_0x3c7f('0x0')]=_0x561808[_0x3c7f('0x0')]||![];this[_0x3c7f('0x1')]=_0x561808['name']||'';this['state']=_0x3c7f('0x2');this[_0x3c7f('0x3')]=0x0;this[_0x3c7f('0x4')]=_0x3c7f('0x2');this[_0x3c7f('0x5')]=_0x561808[_0x3c7f('0x5')]&&_0x561808[_0x3c7f('0x5')]['indexOf'](':')?_0x561808[_0x3c7f('0x5')][_0x3c7f('0x6')](':')[0x0]:'';this[_0x3c7f('0x7')]='';this[_0x3c7f('0x8')]='';this[_0x3c7f('0x9')]='';this[_0x3c7f('0xa')]='';this[_0x3c7f('0xb')]='';this['stateRegistry']=_0x3c7f('0x2');this['registrationtime']='';this[_0x3c7f('0xc')]='';this[_0x3c7f('0xd')]=_0x561808[_0x3c7f('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x4470=['stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry','address','exports','active','name','unknown'];(function(_0x226222,_0x4bb935){var _0x227508=function(_0x5398ee){while(--_0x5398ee){_0x226222['push'](_0x226222['shift']());}};_0x227508(++_0x4bb935);}(_0x4470,0xde));var _0x0447=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x4470[_0x521929];return _0x632436;};'use strict';function Trunk(_0x32b401){this['id']=_0x32b401['id']||0x0;this[_0x0447('0x0')]=_0x32b401['active']||![];this['name']=_0x32b401[_0x0447('0x1')]||'';this['state']=_0x0447('0x2');this[_0x0447('0x3')]=0x0;this[_0x0447('0x4')]=_0x0447('0x2');this[_0x0447('0x5')]=_0x32b401['registry']&&_0x32b401[_0x0447('0x5')][_0x0447('0x6')](':')?_0x32b401[_0x0447('0x5')][_0x0447('0x7')](':')[0x0]:'';this[_0x0447('0x8')]='';this['port']='';this[_0x0447('0x9')]='';this[_0x0447('0xa')]='';this[_0x0447('0xb')]='';this[_0x0447('0xc')]=_0x0447('0x2');this['registrationtime']='';this[_0x0447('0xd')]='';this['defaultuser']=_0x32b401['defaultuser']||'';}module[_0x0447('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 1f081a4..e27d868 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 _0x2c8f=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x450491,_0xd3d892){var _0x1b3602=function(_0x14d1d1){while(--_0x14d1d1){_0x450491['push'](_0x450491['shift']());}};_0x1b3602(++_0xd3d892);}(_0x2c8f,0xa9));var _0xf2c8=function(_0x19389d,_0x2f589a){_0x19389d=_0x19389d-0x0;var _0x2232f1=_0x2c8f[_0x19389d];return _0x2232f1;};'use strict';function voiceExtension(_0x76e0cf){this['id']=_0x76e0cf['id']||0x0;this[_0xf2c8('0x0')]=_0x76e0cf[_0xf2c8('0x0')]||'';this[_0xf2c8('0x1')]=_0x76e0cf['recordingFormat']||'none';this[_0xf2c8('0x2')]=_0x76e0cf[_0xf2c8('0x2')]||![];}module[_0xf2c8('0x3')]=voiceExtension; \ No newline at end of file +var _0xbe95=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbe95,0x1b4));var _0x5be9=function(_0x5db7b7,_0x5a6627){_0x5db7b7=_0x5db7b7-0x0;var _0x589ca3=_0xbe95[_0x5db7b7];return _0x589ca3;};'use strict';function voiceExtension(_0x1006c1){this['id']=_0x1006c1['id']||0x0;this[_0x5be9('0x0')]=_0x1006c1['exten']||'';this[_0x5be9('0x1')]=_0x1006c1['recordingFormat']||'none';this[_0x5be9('0x2')]=_0x1006c1['mandatoryDisposition']||![];}module[_0x5be9('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ffc9f7d..755e4c5 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 _0x0985=['pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','name','monitor_format','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0xf6cb23,_0x5caceb){var _0x48cb20=function(_0x562cc7){while(--_0x562cc7){_0xf6cb23['push'](_0xf6cb23['shift']());}};_0x48cb20(++_0x5caceb);}(_0x0985,0x11e));var _0x5098=function(_0x211bf3,_0x519f35){_0x211bf3=_0x211bf3-0x0;var _0x639c85=_0x0985[_0x211bf3];return _0x639c85;};'use strict';var statusDesc=['unknown',_0x5098('0x0'),_0x5098('0x1'),_0x5098('0x2'),'invalid',_0x5098('0x3'),_0x5098('0x4'),_0x5098('0x5'),_0x5098('0x6')];var monitorFormat={'wav':'wav','wav49':_0x5098('0x7'),'gsm':_0x5098('0x8')};var strategy={'rrmemory':_0x5098('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x30453f){this['id']=_0x30453f['id']||0x0;this[_0x5098('0xa')]=_0x30453f[_0x5098('0xa')]||'';this[_0x5098('0xb')]=_0x30453f[_0x5098('0xb')]||'';this['type']=_0x30453f['type']||'inbound';this[_0x5098('0xc')]=0x0;this['talking']=0x0;this[_0x5098('0xd')]=0x0;this[_0x5098('0xe')]=0x0;this[_0x5098('0xf')]=0x0;this[_0x5098('0x10')]=0x0;this['sumBillable']=0x0;this[_0x5098('0x11')]=0x0;this['abandoned']=0x0;this[_0x5098('0x12')]=0x0;this['available']=0x0;this[_0x5098('0x13')]=_0x30453f[_0x5098('0x13')]||![];this[_0x5098('0x14')]=_0x30453f['acwTimeout']||0xa;this[_0x5098('0x15')]=_0x30453f[_0x5098('0x15')]||'no';this[_0x5098('0x16')]=!![];this[_0x5098('0x17')]='';this[_0x5098('0x18')]=0x0;this[_0x5098('0x19')]=0x0;this[_0x5098('0x1a')]=_0x30453f[_0x5098('0x1a')]||null;this[_0x5098('0x1b')]=_0x30453f[_0x5098('0x1b')]?_0x30453f[_0x5098('0x1b')]:null;this[_0x5098('0x1c')]=_0x30453f[_0x5098('0x1c')];this[_0x5098('0x1d')]=_0x30453f[_0x5098('0x1d')]||_0x5098('0x1e');this[_0x5098('0x1f')]=_0x30453f[_0x5098('0x1f')]||0x0;this['dialLimitQueue']=_0x30453f['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x30453f[_0x5098('0x20')]||0x1;this[_0x5098('0x21')]=_0x30453f[_0x5098('0x21')]||_0x5098('0x22');this[_0x5098('0x23')]=_0x30453f[_0x5098('0x23')]||0.03;this[_0x5098('0x24')]=_0x30453f[_0x5098('0x24')]||0x258;this[_0x5098('0x25')]=_0x30453f[_0x5098('0x25')]||_0x5098('0x26');this[_0x5098('0x27')]=_0x30453f[_0x5098('0x27')]||_0x5098('0x26');this[_0x5098('0x28')]=_0x30453f[_0x5098('0x28')]||0x1e;this['dialQueueOptions']=_0x30453f[_0x5098('0x29')]||'tTxX';this[_0x5098('0x2a')]=_0x30453f[_0x5098('0x2a')]||0x3;this[_0x5098('0x2b')]=_0x30453f[_0x5098('0x2b')]||undefined;this[_0x5098('0x2c')]=_0x30453f['dialCongestionMaxRetry']||0x3;this[_0x5098('0x2d')]=_0x30453f[_0x5098('0x2d')]||0x96;this[_0x5098('0x2e')]=_0x30453f[_0x5098('0x2e')]||0x3;this[_0x5098('0x2f')]=_0x30453f[_0x5098('0x2f')]||0x96;this[_0x5098('0x30')]=_0x30453f[_0x5098('0x30')]||0x3;this[_0x5098('0x31')]=_0x30453f['dialNoAnswerRetryFrequency']||0x96;this[_0x5098('0x32')]=_0x30453f['dialNoSuchNumberMaxRetry']||0x3;this[_0x5098('0x33')]=_0x30453f[_0x5098('0x33')]||0x96;this[_0x5098('0x34')]=_0x30453f[_0x5098('0x34')]||0x3;this[_0x5098('0x35')]=_0x30453f['dialDropRetryFrequency']||0x96;this[_0x5098('0x36')]=_0x30453f[_0x5098('0x36')]||0x3;this[_0x5098('0x37')]=_0x30453f[_0x5098('0x37')]||0x96;this[_0x5098('0x38')]=_0x30453f['dialMachineMaxRetry']||0x3;this[_0x5098('0x39')]=_0x30453f[_0x5098('0x39')]||0x96;this[_0x5098('0x3a')]=_0x30453f['dialAgentRejectMaxRetry']||0x3;this[_0x5098('0x3b')]=_0x30453f[_0x5098('0x3b')]||0x96;this[_0x5098('0x3c')]=_0x30453f[_0x5098('0x3c')]||0x3;this[_0x5098('0x3d')]=_0x30453f[_0x5098('0x3d')]||0x4;this[_0x5098('0x3e')]=_0x30453f['Trunk']?_0x30453f['Trunk']:undefined;this[_0x5098('0x3f')]=_0x30453f[_0x5098('0x3f')]?_0x30453f[_0x5098('0x3f')]:undefined;this[_0x5098('0x40')]=_0x30453f['dialPrefix']||undefined;this[_0x5098('0x41')]=_0x30453f[_0x5098('0x41')]?_0x30453f[_0x5098('0x41')]:undefined;this[_0x5098('0x42')]=_0x30453f[_0x5098('0x42')]||_0x5098('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x30453f[_0x5098('0x44')]||undefined;this[_0x5098('0x45')]=_0x30453f[_0x5098('0x45')]||undefined;this[_0x5098('0x46')]=strategy[_0x30453f[_0x5098('0x46')]]||_0x5098('0x9');this['queueStatusComplete']=!![];this[_0x5098('0x47')]=_0x30453f[_0x5098('0x47')]||![];this[_0x5098('0x48')]=_0x30453f[_0x5098('0x48')];this[_0x5098('0x49')]=_0x30453f[_0x5098('0x49')];this['dialAMDAfterGreetingSilence']=_0x30453f['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x30453f[_0x5098('0x4a')];this[_0x5098('0x4b')]=_0x30453f[_0x5098('0x4b')];this[_0x5098('0x4c')]=_0x30453f[_0x5098('0x4c')];this[_0x5098('0x4d')]=_0x30453f[_0x5098('0x4d')];this[_0x5098('0x4e')]=_0x30453f['dialAMDSilenceThreshold'];this[_0x5098('0x4f')]=_0x30453f[_0x5098('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0x5098('0x50')]=0x0;this[_0x5098('0x51')]=_0x30453f[_0x5098('0x51')];this['outboundAnswerCallsDay']=0x0;this[_0x5098('0x52')]=0x0;this[_0x5098('0x53')]=0x0;this[_0x5098('0x54')]=0x0;this[_0x5098('0x55')]=0x0;this[_0x5098('0x56')]=0x0;this[_0x5098('0x57')]=0x0;this[_0x5098('0x58')]=0x0;this[_0x5098('0x59')]=0x0;this[_0x5098('0x5a')]=0x0;this[_0x5098('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x5098('0x5c')]=undefined;this[_0x5098('0x5d')]=undefined;this[_0x5098('0x5e')]=undefined;this[_0x5098('0x5f')]=1.05;this[_0x5098('0x60')]=0x0;this[_0x5098('0x61')]=0x0;this[_0x5098('0x62')]=0x0;this[_0x5098('0x63')]=0x0;this[_0x5098('0x64')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x5098('0x65')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x5098('0x66')]=_0x30453f[_0x5098('0x67')]||0x14;this[_0x5098('0x68')]=_0x30453f[_0x5098('0x67')]||0xa;this[_0x5098('0x69')]=0x0;this[_0x5098('0x6a')]=0x0;this[_0x5098('0x6b')]=0x1;this[_0x5098('0x6c')]=0x0;this[_0x5098('0x6d')]=0x0;this[_0x5098('0x6e')]=0x0;this[_0x5098('0x6f')]=0x0;this[_0x5098('0x70')]=_0x30453f[_0x5098('0x70')]||0x1e;this[_0x5098('0x71')]=_0x30453f[_0x5098('0x71')]||![];this[_0x5098('0x72')]=!!_0x30453f['dialPreviewAutoRecallMe']||![];this[_0x5098('0x73')]=!!_0x30453f[_0x5098('0x73')]||![];this[_0x5098('0x74')]=_0x30453f[_0x5098('0x74')]||undefined;this[_0x5098('0x75')]=_0x30453f['dialAgiAfterHangupClient']||![];this[_0x5098('0x76')]=_0x30453f['dialAgiAfterHangupAgent']||![];this[_0x5098('0xb')]=monitorFormat[_0x30453f['monitor_format']]?monitorFormat[_0x30453f[_0x5098('0xb')]]:undefined;this['mandatoryDisposition']=_0x30453f[_0x5098('0x77')]||![];this[_0x5098('0x78')]=_0x30453f[_0x5098('0x78')]?_0x30453f['mandatoryDispositionPause']:undefined;}module[_0x5098('0x79')]=VoiceQueue; \ No newline at end of file +var _0x7900=['dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','not_inuse','inuse','unavailable','ringing','ringinuse','onhold','wav','gsm','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x188be1,_0x20679b){var _0x308dda=function(_0x509bdc){while(--_0x509bdc){_0x188be1['push'](_0x188be1['shift']());}};_0x308dda(++_0x20679b);}(_0x7900,0x133));var _0x0790=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7900[_0x20a584];return _0x4b41a8;};'use strict';var statusDesc=['unknown',_0x0790('0x0'),_0x0790('0x1'),'busy','invalid',_0x0790('0x2'),_0x0790('0x3'),_0x0790('0x4'),_0x0790('0x5')];var monitorFormat={'wav':_0x0790('0x6'),'wav49':'wav49','gsm':_0x0790('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x220af3){this['id']=_0x220af3['id']||0x0;this[_0x0790('0x8')]=_0x220af3['name']||'';this[_0x0790('0x9')]=_0x220af3[_0x0790('0x9')]||'';this[_0x0790('0xa')]=_0x220af3[_0x0790('0xa')]||'inbound';this[_0x0790('0xb')]=0x0;this[_0x0790('0xc')]=0x0;this[_0x0790('0xd')]=0x0;this[_0x0790('0xe')]=0x0;this[_0x0790('0xf')]=0x0;this[_0x0790('0x10')]=0x0;this['sumBillable']=0x0;this[_0x0790('0x11')]=0x0;this[_0x0790('0x12')]=0x0;this[_0x0790('0x13')]=0x0;this[_0x0790('0x14')]=0x0;this['acw']=_0x220af3['acw']||![];this['acwTimeout']=_0x220af3[_0x0790('0x15')]||0xa;this[_0x0790('0x16')]=_0x220af3['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x0790('0x17')]=0x0;this[_0x0790('0x18')]=0x0;this[_0x0790('0x19')]=_0x220af3[_0x0790('0x19')]||null;this['dialGlobalInterval']=_0x220af3[_0x0790('0x1a')]?_0x220af3['dialGlobalInterval']:null;this[_0x0790('0x1b')]=_0x220af3['dialActive'];this['dialMethod']=_0x220af3[_0x0790('0x1c')]||_0x0790('0x1d');this['dialLimitChannel']=_0x220af3[_0x0790('0x1e')]||0x0;this[_0x0790('0x1f')]=_0x220af3[_0x0790('0x1f')]||0x0;this[_0x0790('0x20')]=_0x220af3[_0x0790('0x20')]||0x1;this['dialPredictiveOptimization']=_0x220af3[_0x0790('0x21')]||_0x0790('0x22');this[_0x0790('0x23')]=_0x220af3['dialPredictiveOptimizationPercentage']||0.03;this[_0x0790('0x24')]=_0x220af3['dialPredictiveInterval']||0x258;this[_0x0790('0x25')]=_0x220af3['dialOriginateCallerIdName']||_0x0790('0x26');this['dialOriginateCallerIdNumber']=_0x220af3[_0x0790('0x27')]||'anonymous';this[_0x0790('0x28')]=_0x220af3[_0x0790('0x28')]||0x1e;this[_0x0790('0x29')]=_0x220af3[_0x0790('0x29')]||'tTxX';this[_0x0790('0x2a')]=_0x220af3['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x220af3[_0x0790('0x2b')]||undefined;this[_0x0790('0x2c')]=_0x220af3[_0x0790('0x2c')]||0x3;this[_0x0790('0x2d')]=_0x220af3['dialCongestionRetryFrequency']||0x96;this[_0x0790('0x2e')]=_0x220af3[_0x0790('0x2e')]||0x3;this[_0x0790('0x2f')]=_0x220af3[_0x0790('0x2f')]||0x96;this[_0x0790('0x30')]=_0x220af3[_0x0790('0x30')]||0x3;this['dialNoAnswerRetryFrequency']=_0x220af3['dialNoAnswerRetryFrequency']||0x96;this[_0x0790('0x31')]=_0x220af3[_0x0790('0x31')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x220af3[_0x0790('0x32')]||0x96;this[_0x0790('0x33')]=_0x220af3[_0x0790('0x33')]||0x3;this[_0x0790('0x34')]=_0x220af3[_0x0790('0x34')]||0x96;this[_0x0790('0x35')]=_0x220af3[_0x0790('0x35')]||0x3;this[_0x0790('0x36')]=_0x220af3[_0x0790('0x36')]||0x96;this['dialMachineMaxRetry']=_0x220af3['dialMachineMaxRetry']||0x3;this[_0x0790('0x37')]=_0x220af3[_0x0790('0x37')]||0x96;this[_0x0790('0x38')]=_0x220af3[_0x0790('0x38')]||0x3;this['dialAgentRejectRetryFrequency']=_0x220af3['dialAgentRejectRetryFrequency']||0x96;this[_0x0790('0x39')]=_0x220af3['callAdditionalPhoneAfterMin']||0x3;this[_0x0790('0x3a')]=_0x220af3['dialGlobalMaxRetry']||0x4;this[_0x0790('0x3b')]=_0x220af3[_0x0790('0x3b')]?_0x220af3['Trunk']:undefined;this[_0x0790('0x3c')]=_0x220af3[_0x0790('0x3c')]?_0x220af3['TrunkBackup']:undefined;this[_0x0790('0x3d')]=_0x220af3[_0x0790('0x3d')]||undefined;this['Interval']=_0x220af3['Interval']?_0x220af3['Interval']:undefined;this[_0x0790('0x3e')]=_0x220af3[_0x0790('0x3e')]||_0x0790('0x3f');this[_0x0790('0x40')]=_0x220af3[_0x0790('0x40')]||undefined;this[_0x0790('0x41')]=_0x220af3[_0x0790('0x41')]||undefined;this['strategy']=strategy[_0x220af3[_0x0790('0x42')]]||_0x0790('0x43');this['queueStatusComplete']=!![];this[_0x0790('0x44')]=_0x220af3['dialAMDActive']||![];this[_0x0790('0x45')]=_0x220af3[_0x0790('0x45')];this['dialAMDGreeting']=_0x220af3[_0x0790('0x46')];this[_0x0790('0x47')]=_0x220af3[_0x0790('0x47')];this[_0x0790('0x48')]=_0x220af3[_0x0790('0x48')];this[_0x0790('0x49')]=_0x220af3['dialAMDMinWordLength'];this[_0x0790('0x4a')]=_0x220af3[_0x0790('0x4a')];this[_0x0790('0x4b')]=_0x220af3['dialAMDMaximumNumberOfWords'];this[_0x0790('0x4c')]=_0x220af3['dialAMDSilenceThreshold'];this[_0x0790('0x4d')]=_0x220af3[_0x0790('0x4d')];this[_0x0790('0x4e')]=0x0;this['pTalking']=0x0;this['timeout']=_0x220af3[_0x0790('0x4f')];this[_0x0790('0x50')]=0x0;this[_0x0790('0x51')]=0x0;this[_0x0790('0x52')]=0x0;this[_0x0790('0x53')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0790('0x54')]=0x0;this[_0x0790('0x55')]=0x0;this[_0x0790('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x0790('0x57')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x0790('0x58')]=0x0;this['outboundReCallsDay']=0x0;this[_0x0790('0x59')]=0x0;this[_0x0790('0x5a')]=undefined;this[_0x0790('0x5b')]=undefined;this[_0x0790('0x5c')]=undefined;this[_0x0790('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x0790('0x5e')]=0x0;this[_0x0790('0x5f')]=0x0;this[_0x0790('0x60')]=0x0;this[_0x0790('0x61')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x0790('0x62')]=0x0;this[_0x0790('0x63')]=0x0;this[_0x0790('0x64')]=_0x220af3[_0x0790('0x65')]||0x14;this[_0x0790('0x66')]=_0x220af3[_0x0790('0x65')]||0xa;this[_0x0790('0x67')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x0790('0x68')]=0x1;this['erlangCalls']=0x0;this[_0x0790('0x69')]=0x0;this[_0x0790('0x6a')]=0x0;this[_0x0790('0x6b')]=0x0;this[_0x0790('0x6c')]=_0x220af3[_0x0790('0x6c')]||0x1e;this[_0x0790('0x6d')]=_0x220af3[_0x0790('0x6d')]||![];this[_0x0790('0x6e')]=!!_0x220af3[_0x0790('0x6e')]||![];this[_0x0790('0x6f')]=!!_0x220af3[_0x0790('0x6f')]||![];this['dialQueueProject2']=_0x220af3['dialQueueProject2']||undefined;this[_0x0790('0x70')]=_0x220af3[_0x0790('0x70')]||![];this[_0x0790('0x71')]=_0x220af3['dialAgiAfterHangupAgent']||![];this[_0x0790('0x9')]=monitorFormat[_0x220af3[_0x0790('0x9')]]?monitorFormat[_0x220af3['monitor_format']]:undefined;this[_0x0790('0x72')]=_0x220af3['mandatoryDisposition']||![];this[_0x0790('0x73')]=_0x220af3['mandatoryDispositionPause']?_0x220af3[_0x0790('0x73')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 9498936..837765c 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 _0xad8f=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4aab38,_0x1b33b6){var _0xa927b7=function(_0x57d482){while(--_0x57d482){_0x4aab38['push'](_0x4aab38['shift']());}};_0xa927b7(++_0x1b33b6);}(_0xad8f,0xd9));var _0xfad8=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xad8f[_0x580576];return _0x3f55a0;};'use strict';function VtigerAccount(_0x503573){this['id']=_0x503573['id']||0x0;this[_0xfad8('0x0')]=_0x503573[_0xfad8('0x0')]||'';this[_0xfad8('0x1')]=_0x503573[_0xfad8('0x1')]||'';this[_0xfad8('0x2')]=_0x503573[_0xfad8('0x2')]||'';this[_0xfad8('0x3')]=_0x503573[_0xfad8('0x3')]||'';this['serverUrl']=_0x503573[_0xfad8('0x4')]||'';this[_0xfad8('0x5')]=_0x503573['Configurations']||{};}module[_0xfad8('0x6')]=VtigerAccount; \ No newline at end of file +var _0x7a8d=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x54d0fb,_0x317468){var _0x7e7c12=function(_0x49a5d2){while(--_0x49a5d2){_0x54d0fb['push'](_0x54d0fb['shift']());}};_0x7e7c12(++_0x317468);}(_0x7a8d,0x185));var _0xd7a8=function(_0x41c39d,_0x341818){_0x41c39d=_0x41c39d-0x0;var _0x2d7fde=_0x7a8d[_0x41c39d];return _0x2d7fde;};'use strict';function VtigerAccount(_0x1f08f0){this['id']=_0x1f08f0['id']||0x0;this[_0xd7a8('0x0')]=_0x1f08f0[_0xd7a8('0x0')]||'';this['username']=_0x1f08f0[_0xd7a8('0x1')]||'';this['accessKey']=_0x1f08f0[_0xd7a8('0x2')]||'';this[_0xd7a8('0x3')]=_0x1f08f0['remoteUri']||'';this[_0xd7a8('0x4')]=_0x1f08f0[_0xd7a8('0x4')]||'';this[_0xd7a8('0x5')]=_0x1f08f0[_0xd7a8('0x5')]||{};}module[_0xd7a8('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 c00b4d3..7a17d6c 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 _0x88e8=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','type','integrationTab'];(function(_0x1c676d,_0x4a62ea){var _0x287e93=function(_0x53b1b0){while(--_0x53b1b0){_0x1c676d['push'](_0x1c676d['shift']());}};_0x287e93(++_0x4a62ea);}(_0x88e8,0x85));var _0x888e=function(_0x2fbb8c,_0x15bc93){_0x2fbb8c=_0x2fbb8c-0x0;var _0x1005b4=_0x88e8[_0x2fbb8c];return _0x1005b4;};'use strict';function ZendeskAccount(_0x5395a9){this['id']=_0x5395a9['id']||0x0;this['name']=_0x5395a9[_0x888e('0x0')]||'';this['username']=_0x5395a9[_0x888e('0x1')]||'';this[_0x888e('0x2')]=_0x5395a9['password']||'';this[_0x888e('0x3')]=_0x5395a9[_0x888e('0x3')]||'';this[_0x888e('0x4')]=_0x5395a9[_0x888e('0x4')]||'';this['authType']=_0x5395a9['authType']||'';this[_0x888e('0x5')]=_0x5395a9[_0x888e('0x5')]||_0x888e('0x6');this[_0x888e('0x7')]=_0x5395a9[_0x888e('0x7')]||'';this[_0x888e('0x8')]=_0x5395a9['Configurations']||{};}module[_0x888e('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x318c=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','password','token'];(function(_0x58bcf8,_0x2559da){var _0x485a80=function(_0xe847c8){while(--_0xe847c8){_0x58bcf8['push'](_0x58bcf8['shift']());}};_0x485a80(++_0x2559da);}(_0x318c,0x130));var _0xc318=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x318c[_0x19e35c];return _0x3e1fe8;};'use strict';function ZendeskAccount(_0x3d3817){this['id']=_0x3d3817['id']||0x0;this['name']=_0x3d3817['name']||'';this['username']=_0x3d3817['username']||'';this[_0xc318('0x0')]=_0x3d3817[_0xc318('0x0')]||'';this['token']=_0x3d3817[_0xc318('0x1')]||'';this['remoteUri']=_0x3d3817[_0xc318('0x2')]||'';this[_0xc318('0x3')]=_0x3d3817[_0xc318('0x3')]||'';this[_0xc318('0x4')]=_0x3d3817['type']||_0xc318('0x5');this[_0xc318('0x6')]=_0x3d3817['serverUrl']||'';this[_0xc318('0x7')]=_0x3d3817[_0xc318('0x7')]||{};}module[_0xc318('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5b326ab..b758afa 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 _0x0f8f=['exports','name','description','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x448313,_0x2b5e0f){var _0x3740be=function(_0x130a0d){while(--_0x130a0d){_0x448313['push'](_0x448313['shift']());}};_0x3740be(++_0x2b5e0f);}(_0x0f8f,0x79));var _0xf0f8=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x0f8f[_0x5608a3];return _0x1ed50a;};'use strict';function ZohoAccount(_0x510eae){this['id']=_0x510eae['id']||0x0;this[_0xf0f8('0x0')]=_0x510eae[_0xf0f8('0x0')]||'';this[_0xf0f8('0x1')]=_0x510eae[_0xf0f8('0x1')]||'';this['host']=_0x510eae['host']||'';this[_0xf0f8('0x2')]=_0x510eae[_0xf0f8('0x2')]||'';this['clientId']=_0x510eae[_0xf0f8('0x3')]||'';this[_0xf0f8('0x4')]=_0x510eae['clientSecret']||'';this[_0xf0f8('0x5')]=_0x510eae[_0xf0f8('0x5')]||'';this[_0xf0f8('0x6')]=_0x510eae[_0xf0f8('0x6')]||'';this['refreshToken']=_0x510eae[_0xf0f8('0x7')]||'';this[_0xf0f8('0x8')]=_0x510eae[_0xf0f8('0x8')]||{};}module[_0xf0f8('0x9')]=ZohoAccount; \ No newline at end of file +var _0x79dd=['host','clientId','clientSecret','serverUrl','refreshToken','Configurations','exports','name','description'];(function(_0x42225b,_0x1f8819){var _0x29071e=function(_0x51bc0d){while(--_0x51bc0d){_0x42225b['push'](_0x42225b['shift']());}};_0x29071e(++_0x1f8819);}(_0x79dd,0xc4));var _0xd79d=function(_0x411dc3,_0x447538){_0x411dc3=_0x411dc3-0x0;var _0x3265f2=_0x79dd[_0x411dc3];return _0x3265f2;};'use strict';function ZohoAccount(_0x215350){this['id']=_0x215350['id']||0x0;this[_0xd79d('0x0')]=_0x215350[_0xd79d('0x0')]||'';this[_0xd79d('0x1')]=_0x215350[_0xd79d('0x1')]||'';this['host']=_0x215350[_0xd79d('0x2')]||'';this['zone']=_0x215350['zone']||'';this[_0xd79d('0x3')]=_0x215350[_0xd79d('0x3')]||'';this[_0xd79d('0x4')]=_0x215350['clientSecret']||'';this[_0xd79d('0x5')]=_0x215350['serverUrl']||'';this['code']=_0x215350['code']||'';this[_0xd79d('0x6')]=_0x215350['refreshToken']||'';this['Configurations']=_0x215350[_0xd79d('0x7')]||{};}module[_0xd79d('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f04457e..813d314 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 _0x2da6=['queue','type','campaigntype','membername','Agent','name','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0xa98eeb,_0x37cc88){var _0x3af6b7=function(_0x5a569b){while(--_0x5a569b){_0xa98eeb['push'](_0xa98eeb['shift']());}};_0x3af6b7(++_0x37cc88);}(_0x2da6,0x1dd));var _0x62da=function(_0x4c083f,_0x18edbe){_0x4c083f=_0x4c083f-0x0;var _0x2285b8=_0x2da6[_0x4c083f];return _0x2285b8;};'use strict';var util=require(_0x62da('0x0'));var _=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));function checkNameSurname(_0xbbb39b,_0xd62c5c,_0x12b8ad){var _0x19081e='';if(!_[_0x62da('0x3')](_0xd62c5c)&&'string'===typeof _0xd62c5c){_0x19081e+=_0xd62c5c;}if(!_['isNil'](_0x12b8ad)&&_0x62da('0x4')===typeof _0x12b8ad){_0x19081e+='\x20'+_0x12b8ad;}if(_0x19081e!==''){return _0x19081e;}return _0xbbb39b;}function Action(_0x3163df,_0x3a59f8,_0x30437f,_0x100e73,_0x9d9139){this[_0x62da('0x5')]=_0x30437f||undefined;this[_0x62da('0x6')]=_0x3163df['id'];this[_0x62da('0x7')]=_0x3a59f8['name'];this[_0x62da('0x8')]=_0x3a59f8[_0x62da('0x8')];this[_0x62da('0x9')]=_0x62da('0x7');this['dialAnswer']=![];this[_0x62da('0xa')]=_[_0x62da('0x3')](_0x3163df[_0x62da('0xb')])?undefined:_0x3163df[_0x62da('0xb')][_0x62da('0xc')];this['channelAgent']=this[_0x62da('0xa')]?util[_0x62da('0xd')](_0x62da('0xe'),this[_0x62da('0xa')]):_0x100e73||undefined;this[_0x62da('0xf')]=checkNameSurname(_0x3163df['Contact']['phone'],_0x3163df[_0x62da('0x10')][_0x62da('0x11')],_0x3163df[_0x62da('0x10')][_0x62da('0x12')]);this[_0x62da('0x13')]=_0x3163df[_0x62da('0x13')]||![];this[_0x62da('0x14')]=_0x3163df[_0x62da('0x15')];this[_0x62da('0x16')]=_0x3163df[_0x62da('0x16')];this[_0x62da('0x17')]=_0x3163df[_0x62da('0x17')]||0x0;this[_0x62da('0x18')]=_0x3163df[_0x62da('0x18')]||0x0;this['countnoanswerretry']=_0x3163df['countnoanswerretry']||0x0;this[_0x62da('0x19')]=(_0x3163df['countbusyretry']||0x0)+(_0x3163df[_0x62da('0x18')]||0x0)+(_0x3163df[_0x62da('0x1a')]||0x0)+(_0x3163df[_0x62da('0x1b')]||0x0)+(_0x3163df['countdropretry']||0x0)+(_0x3163df[_0x62da('0x1c')]||0x0)+(_0x3163df['countmachineretry']||0x0)+(_0x3163df[_0x62da('0x1d')]||0x0);this[_0x62da('0x1b')]=_0x3163df[_0x62da('0x1b')]||0x0;this[_0x62da('0x1e')]=_0x3163df[_0x62da('0x1e')]||0x0;this[_0x62da('0x1c')]=_0x3163df[_0x62da('0x1c')]||0x0;this[_0x62da('0x1f')]=_0x3163df[_0x62da('0x1f')]||0x0;this['countagentrejectretry']=_0x3163df[_0x62da('0x1d')]||0x0;this[_0x62da('0x20')]=_0x3163df[_0x62da('0x20')];this[_0x62da('0x21')]=_0x3163df[_0x62da('0x21')];this[_0x62da('0x22')]=_0x3163df[_0x62da('0x22')];this['recallme']=_0x3163df['recallme'];this['ContactId']=_0x3163df[_0x62da('0x23')];this[_0x62da('0x24')]=_0x3163df[_0x62da('0x24')];this[_0x62da('0x25')]=_['isNil'](_0x3163df[_0x62da('0xb')])?_0x3163df[_0x62da('0x25')]:_0x3163df['Agent']['id'];this[_0x62da('0x26')]=_0x3163df[_0x62da('0x26')];this[_0x62da('0x27')]='';this['originatecalleridname']='';}Action[_0x62da('0x28')][_0x62da('0x29')]=function(){return util[_0x62da('0xd')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x62da('0x2a')]);};module[_0x62da('0x2b')]=Action; \ No newline at end of file +var _0x8603=['prototype','getCaller','number','exports','lodash','moment','isNil','string','uniqueid','type','queue','dialAnswer','Agent','name','channelAgent','format','SIP/%s','membername','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x5e291f,_0x5be556){var _0x14c763=function(_0x24c7b9){while(--_0x24c7b9){_0x5e291f['push'](_0x5e291f['shift']());}};_0x14c763(++_0x5be556);}(_0x8603,0x190));var _0x3860=function(_0x198de8,_0x3e3308){_0x198de8=_0x198de8-0x0;var _0x404465=_0x8603[_0x198de8];return _0x404465;};'use strict';var util=require('util');var _=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));function checkNameSurname(_0x96d2bc,_0x51bfda,_0x4961d6){var _0x2ebe8b='';if(!_[_0x3860('0x2')](_0x51bfda)&&_0x3860('0x3')===typeof _0x51bfda){_0x2ebe8b+=_0x51bfda;}if(!_['isNil'](_0x4961d6)&&_0x3860('0x3')===typeof _0x4961d6){_0x2ebe8b+='\x20'+_0x4961d6;}if(_0x2ebe8b!==''){return _0x2ebe8b;}return _0x96d2bc;}function Action(_0x56f8c5,_0xb0fc24,_0x40739b,_0x1eca44,_0xd3ce26){this[_0x3860('0x4')]=_0x40739b||undefined;this['idContact']=_0x56f8c5['id'];this['queue']=_0xb0fc24['name'];this[_0x3860('0x5')]=_0xb0fc24[_0x3860('0x5')];this['campaigntype']=_0x3860('0x6');this[_0x3860('0x7')]=![];this['membername']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?undefined:_0x56f8c5['Agent'][_0x3860('0x9')];this[_0x3860('0xa')]=this['membername']?util[_0x3860('0xb')](_0x3860('0xc'),this[_0x3860('0xd')]):_0x1eca44||undefined;this[_0x3860('0xe')]=checkNameSurname(_0x56f8c5[_0x3860('0xf')][_0x3860('0x10')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x11')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x12')]);this['active']=_0x56f8c5[_0x3860('0x13')]||![];this[_0x3860('0x14')]=_0x56f8c5[_0x3860('0x10')];this[_0x3860('0x15')]=_0x56f8c5[_0x3860('0x15')];this[_0x3860('0x16')]=_0x56f8c5[_0x3860('0x16')]||0x0;this[_0x3860('0x17')]=_0x56f8c5[_0x3860('0x17')]||0x0;this[_0x3860('0x18')]=_0x56f8c5[_0x3860('0x18')]||0x0;this[_0x3860('0x19')]=(_0x56f8c5['countbusyretry']||0x0)+(_0x56f8c5['countcongestionretry']||0x0)+(_0x56f8c5[_0x3860('0x18')]||0x0)+(_0x56f8c5[_0x3860('0x1a')]||0x0)+(_0x56f8c5[_0x3860('0x1b')]||0x0)+(_0x56f8c5['countabandonedretry']||0x0)+(_0x56f8c5[_0x3860('0x1c')]||0x0)+(_0x56f8c5[_0x3860('0x1d')]||0x0);this[_0x3860('0x1a')]=_0x56f8c5[_0x3860('0x1a')]||0x0;this[_0x3860('0x1b')]=_0x56f8c5[_0x3860('0x1b')]||0x0;this[_0x3860('0x1e')]=_0x56f8c5[_0x3860('0x1e')]||0x0;this[_0x3860('0x1c')]=_0x56f8c5[_0x3860('0x1c')]||0x0;this[_0x3860('0x1d')]=_0x56f8c5[_0x3860('0x1d')]||0x0;this[_0x3860('0x1f')]=_0x56f8c5[_0x3860('0x1f')];this[_0x3860('0x20')]=_0x56f8c5['callbackuniqueid'];this[_0x3860('0x21')]=_0x56f8c5[_0x3860('0x21')];this[_0x3860('0x22')]=_0x56f8c5[_0x3860('0x22')];this[_0x3860('0x23')]=_0x56f8c5['ContactId'];this[_0x3860('0x24')]=_0x56f8c5['ListId'];this['UserId']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?_0x56f8c5['UserId']:_0x56f8c5['Agent']['id'];this['VoiceQueueId']=_0x56f8c5[_0x3860('0x25')];this[_0x3860('0x26')]='';this[_0x3860('0x27')]='';}Action[_0x3860('0x28')][_0x3860('0x29')]=function(){return util[_0x3860('0xb')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x3860('0x2a')]);};module[_0x3860('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 807fba5..ae700b8 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 _0x5fc3=['custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','isValid','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','isTrunkReachable','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','isFailure','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','keys','value','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','total','abandoned','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pTalking','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','size','clearZombieChannel','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','dialAnswer','[syncHangup][talking][increment]','uniqueid','\x20Queue'];(function(_0x16b55f,_0x301c6c){var _0x391c2f=function(_0x4f1941){while(--_0x4f1941){_0x16b55f['push'](_0x16b55f['shift']());}};_0x391c2f(++_0x301c6c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x5fc3[_0x34df4a];return _0x145c69;};'use strict';var util=require(_0x35fc('0x0'));var _=require(_0x35fc('0x1'));var BPromise=require('bluebird');var uuid=require(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var md5=require(_0x35fc('0x4'));var Redis=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../config/logger')(_0x35fc('0x7'));var loggerAction=require(_0x35fc('0x8'))(_0x35fc('0x9'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x35fc('0xa'));var Action=require('./action');var ut=require(_0x35fc('0xb'));config[_0x35fc('0xc')]=_[_0x35fc('0xd')](config[_0x35fc('0xc')],{'host':_0x35fc('0xe'),'port':0x18eb});var io=require(_0x35fc('0xf'))(new Redis(config[_0x35fc('0xc')]));var Sequence=function(){};Sequence['prototype'][_0x35fc('0x10')]=function(_0x2a1084){this['tail']=this[_0x35fc('0x11')]?this[_0x35fc('0x11')]['finally'](_0x2a1084):_0x2a1084();};function Preview(_0xda83fb){this[_0x35fc('0x12')]=new Sequence();this['campaignsPreview']=_0xda83fb['voiceQueues'];this[_0x35fc('0x13')]=_0xda83fb['trunks'];this[_0x35fc('0x14')]={};this[_0x35fc('0x15')]=_0xda83fb[_0x35fc('0x15')];this[_0x35fc('0x16')]=0x0;ami['on'](_0x35fc('0x17'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this['syncHangup'][_0x35fc('0x18')](this));ami['on'](_0x35fc('0x19'),this[_0x35fc('0x1a')][_0x35fc('0x18')](this));ami['on'](_0x35fc('0x1b'),this[_0x35fc('0x1c')]['bind'](this));ami['on'](_0x35fc('0x1d'),this[_0x35fc('0x1e')]['bind'](this));ami['on'](_0x35fc('0x1f'),this[_0x35fc('0x20')][_0x35fc('0x18')](this));ami['on']('attendedtransfer',this[_0x35fc('0x21')][_0x35fc('0x18')](this));ami['on'](_0x35fc('0x22'),this['syncBlindTransfer'][_0x35fc('0x18')](this));this[_0x35fc('0x23')](this[_0x35fc('0x24')]);}function emit(_0x251a1f,_0x20ffde,_0x21f1a9){io['to'](_0x251a1f)[_0x35fc('0x25')](_0x20ffde,_0x21f1a9);}function emitCampaignPreview(_0x3b05b0){if(_0x3b05b0[_0x35fc('0x26')]===_0x35fc('0x27')){var _0x5bd2b8={'id':_0x3b05b0['id'],'name':_0x3b05b0[_0x35fc('0x28')],'strategy':_0x3b05b0[_0x35fc('0x29')],'answered':_0x3b05b0[_0x35fc('0x2a')],'available':_0x3b05b0[_0x35fc('0x2b')],'loggedIn':_0x3b05b0[_0x35fc('0x2c')],'pTalking':_0x3b05b0['pTalking'],'sumBillable':_0x3b05b0[_0x35fc('0x2d')],'sumDuration':_0x3b05b0[_0x35fc('0x2e')],'sumHoldTime':_0x3b05b0['sumHoldTime']||0x0,'talking':_0x3b05b0[_0x35fc('0x2f')],'total':_0x3b05b0[_0x35fc('0x30')],'type':_0x3b05b0[_0x35fc('0x26')],'unmanaged':_0x3b05b0['unmanaged'],'abandoned':_0x3b05b0[_0x35fc('0x31')],'waiting':_0x3b05b0['waiting'],'loggedInDb':_0x3b05b0[_0x35fc('0x32')],'dialActive':_0x3b05b0[_0x35fc('0x33')],'dialMethod':_0x3b05b0['dialMethod'],'dialOriginateCallerIdName':_0x3b05b0['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3b05b0[_0x35fc('0x34')],'dialOriginateTimeout':_0x3b05b0['dialOriginateTimeout'],'dialPrefix':_0x3b05b0[_0x35fc('0x35')],'outboundAnswerAgiCallsDay':_0x3b05b0[_0x35fc('0x36')],'outboundAnswerCallsDay':_0x3b05b0['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3b05b0[_0x35fc('0x37')],'outboundBusyCallsDay':_0x3b05b0[_0x35fc('0x38')],'outboundCongestionCallsDay':_0x3b05b0[_0x35fc('0x39')],'outboundDropCallsDayACS':_0x3b05b0[_0x35fc('0x3a')],'outboundDropCallsDayCallersExit':_0x3b05b0[_0x35fc('0x3b')],'outboundDropCallsDayTimeout':_0x3b05b0[_0x35fc('0x3c')],'outboundNoAnswerCallsDay':_0x3b05b0[_0x35fc('0x3d')],'outboundNoSuchCallsDay':_0x3b05b0[_0x35fc('0x3e')],'outboundOriginateFailureCallsDay':_0x3b05b0['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3b05b0[_0x35fc('0x3f')],'outboundRejectCallsDay':_0x3b05b0[_0x35fc('0x40')],'outboundUnknownCallsDay':_0x3b05b0[_0x35fc('0x41')],'outboundAbandonedCallsDay':_0x3b05b0['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3b05b0[_0x35fc('0x42')],'predictiveIntervalAvgHoldtime':_0x3b05b0[_0x35fc('0x43')],'predictiveIntervalAvgTalktime':_0x3b05b0[_0x35fc('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x3b05b0[_0x35fc('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x3b05b0[_0x35fc('0x46')],'predictiveIntervalErlangCalls':_0x3b05b0[_0x35fc('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x3b05b0[_0x35fc('0x48')],'predictiveIntervalHitRate':_0x3b05b0[_0x35fc('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3b05b0[_0x35fc('0x4a')],'predictiveIntervalPauses':_0x3b05b0[_0x35fc('0x4b')],'predictiveIntervalAvailable':_0x3b05b0['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3b05b0['predictiveIntervalTotalCalls'],'message':_0x3b05b0[_0x35fc('0x4c')],'originated':_0x3b05b0['originated'],'erlangCalls':_0x3b05b0[_0x35fc('0x4d')],'erlangCallToSecond':_0x3b05b0[_0x35fc('0x4e')],'erlangAbandonmentRate':_0x3b05b0[_0x35fc('0x4f')],'erlangBusyFactor':_0x3b05b0[_0x35fc('0x50')],'startPredictive':_0x3b05b0[_0x35fc('0x51')],'startProgressive':_0x3b05b0[_0x35fc('0x52')]};if(_0x3b05b0['Trunk']){_0x5bd2b8[_0x35fc('0x53')]={'id':_0x3b05b0[_0x35fc('0x53')]['id'],'name':_0x3b05b0[_0x35fc('0x53')][_0x35fc('0x28')],'active':_0x3b05b0[_0x35fc('0x53')][_0x35fc('0x54')],'callerid':_0x3b05b0['Trunk'][_0x35fc('0x55')]};}if(_0x3b05b0[_0x35fc('0x56')]){_0x5bd2b8[_0x35fc('0x56')]={'id':_0x3b05b0['Interval']['id'],'name':_0x3b05b0[_0x35fc('0x56')]['name']};}var _0x2ecb2e=md5(JSON[_0x35fc('0x57')](_0x5bd2b8));if(_0x3b05b0[_0x35fc('0x4')]!==_0x2ecb2e){_0x3b05b0[_0x35fc('0x4')]=_0x2ecb2e;emit(util['format']('voice:queue:%s',_0x5bd2b8['name']),_0x35fc('0x58'),_0x5bd2b8);}}}function emitVoiceQueueChannelRemove(_0x56c06c){logger[_0x35fc('0x59')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x35fc('0x57')](_0x56c06c));emit(util[_0x35fc('0x5a')](_0x35fc('0x5b'),_0x56c06c[_0x35fc('0x28')]),_0x35fc('0x5c'),_0x56c06c);io[_0x35fc('0x25')](_0x35fc('0x5d'),_0x56c06c);}function notSendMessagesQueue(_0x4ec0dc){if(_0x4ec0dc[_0x35fc('0x5e')]){if(_0x4ec0dc[_0x35fc('0x5f')]===0x0&&_0x4ec0dc['pTalking']===0x0){_0x4ec0dc[_0x35fc('0x5e')]=![];_0x4ec0dc[_0x35fc('0x2b')]=0x0;_0x4ec0dc[_0x35fc('0x60')]=0x0;_0x4ec0dc[_0x35fc('0x4c')]=_0x35fc('0x61');ut[_0x35fc('0x62')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4ec0dc[_0x35fc('0x28')]+_0x35fc('0x63'));}else{_0x4ec0dc[_0x35fc('0x4c')]='DEACTIVATED';ut[_0x35fc('0x62')](_0x35fc('0x64'),_0x4ec0dc['name']+_0x35fc('0x65'));}emitCampaignPreview(_0x4ec0dc);}}Preview[_0x35fc('0x66')][_0x35fc('0x23')]=function(){var _0x41e199=this;setInterval(function(){_0x41e199[_0x35fc('0x67')]();},0x7cf);};Preview[_0x35fc('0x66')][_0x35fc('0x67')]=function(){var _0x3ec51f=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x210d5d in _0x3ec51f){if(_0x3ec51f[_0x35fc('0x68')](_0x210d5d)&&(_0x3ec51f[_0x210d5d]['dialMethod']==='preview'||_0x3ec51f[_0x210d5d]['dialMethod']===_0x35fc('0x69'))&&_0x3ec51f[_0x210d5d][_0x35fc('0x26')]==='outbound'){if(this[_0x35fc('0x16')]>0x7){this[_0x35fc('0x16')]=0x0;this[_0x35fc('0x6a')]();}}if(_0x3ec51f[_0x35fc('0x68')](_0x210d5d)&&_0x3ec51f[_0x210d5d]['dialMethod']==='preview'&&_0x3ec51f[_0x210d5d]['type']==='outbound'){if(_0x3ec51f[_0x210d5d]['dialActive']){this[_0x35fc('0x6b')](_0x3ec51f[_0x210d5d]);if(_0x3ec51f[_0x210d5d][_0x35fc('0x6c')])this['recallMe'](_0x3ec51f[_0x210d5d]);}else{notSendMessagesQueue(_0x3ec51f[_0x210d5d]);}}}};Preview[_0x35fc('0x66')]['clearZombieChannel']=function(_0x13d16c){var _0x40797d=this;this[_0x35fc('0x12')][_0x35fc('0x10')](function(){if(!_[_0x35fc('0x6d')](_0x40797d['actions'][_0x13d16c])){loggerAction[_0x35fc('0x59')](_0x35fc('0x6e'),_0x13d16c,'Queue',_0x40797d[_0x35fc('0x14')][_0x13d16c][_0x35fc('0x6f')],_0x35fc('0x70'),JSON[_0x35fc('0x57')](_0x40797d['campaignsPreview'][_0x40797d[_0x35fc('0x14')][_0x13d16c]['queue']]['originated']),_0x35fc('0x71'),JSON[_0x35fc('0x57')](_0x40797d[_0x35fc('0x24')][_0x40797d[_0x35fc('0x14')][_0x13d16c][_0x35fc('0x6f')]][_0x35fc('0x72')]),JSON[_0x35fc('0x57')](_0x40797d[_0x35fc('0x14')][_0x13d16c]['dialAnswer']),JSON[_0x35fc('0x57')](_[_0x35fc('0x73')](_0x40797d[_0x35fc('0x14')][_0x13d16c],[_0x35fc('0x74'),_0x35fc('0x75'),_0x35fc('0x76'),_0x35fc('0x77')])));return ami[_0x35fc('0x78')]({'action':_0x35fc('0x79'),'channel':_0x40797d[_0x35fc('0x14')][_0x13d16c][_0x35fc('0x7a')]})[_0x35fc('0x7b')](function(_0x221f6f){if(_0x221f6f[_0x35fc('0x4c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x40797d['actions'][_0x13d16c]){ut[_0x35fc('0x7c')](_0x40797d[_0x35fc('0x24')][_0x40797d[_0x35fc('0x14')][_0x13d16c][_0x35fc('0x6f')]],_0x35fc('0x7d'));if(_0x40797d[_0x35fc('0x14')][_0x13d16c]['dialAnswer']===!![]){ut['decrementTalkink'](_0x40797d[_0x35fc('0x24')][_0x40797d[_0x35fc('0x14')][_0x13d16c][_0x35fc('0x6f')]],_0x35fc('0x7d'));ut['loggerError'](_0x35fc('0x7e')+_0x13d16c,_0x40797d[_0x35fc('0x14')][_0x13d16c]['queue']);}ut[_0x35fc('0x7f')](_0x35fc('0x80')+_0x13d16c,_0x40797d['actions'][_0x13d16c][_0x35fc('0x6f')]);delete _0x40797d[_0x35fc('0x14')][_0x13d16c];}},0x2328);}});}});};Preview[_0x35fc('0x66')][_0x35fc('0x6a')]=function(){var _0x5e4018=this;loggerAction['info']('[action]',_[_0x35fc('0x81')](this[_0x35fc('0x14')]));for(var _0x5ce231 in this[_0x35fc('0x14')]){if(_0x5e4018[_0x35fc('0x14')][_0x35fc('0x68')](_0x5ce231)){_0x5e4018[_0x35fc('0x82')](_0x5ce231);}}};Preview[_0x35fc('0x66')]['recallMe']=function(_0x2d9d45){var _0x757aa6=this;rpcDb[_0x35fc('0x83')](_0x2d9d45['id'],ut['agentReadyId'](this[_0x35fc('0x15')]))[_0x35fc('0x84')](function(_0x47fb1a){if(!_[_0x35fc('0x6d')](_0x47fb1a)){for(var _0x164c7b=0x0;_0x164c7b<_0x47fb1a[_0x35fc('0x85')];_0x164c7b+=0x1){if(ut[_0x35fc('0x86')](_0x47fb1a[_0x164c7b][_0x35fc('0x87')])<_0x2d9d45[_0x35fc('0x88')]*0x3c){if(_0x47fb1a[_0x164c7b][_0x35fc('0x89')]&&!_0x47fb1a[_0x164c7b][_0x35fc('0x89')]['voicePause']){_0x757aa6[_0x35fc('0x8a')](_0x47fb1a[_0x164c7b]['id'])[_0x35fc('0x84')](ut[_0x35fc('0x8b')]('[RecallMe]'))[_0x35fc('0x7b')](ut['logger2']('[RecallMe]'));}else{rpcDb['disableContact'](_0x47fb1a[_0x164c7b]['id']);}}else{var _0x23b54f=new Action(_0x47fb1a[_0x164c7b],_0x2d9d45);_0x23b54f[_0x35fc('0x8c')]=moment()[_0x35fc('0x5a')](_0x35fc('0x8d'));_0x2d9d45[_0x35fc('0x3f')]+=0x1;ut['logCustomer'](_0x23b54f,0x17,'RecallInQueue');if(_0x2d9d45['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x47fb1a[_0x164c7b]));rpcDb[_0x35fc('0x8e')](_0x23b54f,_0x35fc('0x8f'));}else{ut[_0x35fc('0x90')](_0x23b54f,0x16,_0x35fc('0x91'));rpcDb['createCustomerHistory'](_0x23b54f,_0x35fc('0x92'));rpcDb[_0x35fc('0x93')](_0x23b54f,_0x35fc('0x92'));}}}}})[_0x35fc('0x7b')](ut[_0x35fc('0x8b')](_0x35fc('0x94')));};Preview[_0x35fc('0x66')][_0x35fc('0x6b')]=function(_0x462ceb){_0x462ceb['sendMessageOneNotActive']=!![];if(ut[_0x35fc('0x95')](_0x462ceb['loggedIn'])){_0x462ceb[_0x35fc('0x4c')]=_0x35fc('0x96');}else if(!ut[_0x35fc('0x97')](_0x462ceb[_0x35fc('0x33')])){_0x462ceb['message']=_0x35fc('0x61');}else if(!this['isTrunkReachable'](_0x462ceb['Trunk'])){if(!this['isTrunkReachable'](_0x462ceb[_0x35fc('0x98')])){_0x462ceb['message']=_0x35fc('0x99');}else{_0x462ceb['message']=_0x35fc('0x9a');}}else{_0x462ceb['message']=_0x35fc('0x9a');}emitCampaignPreview(_0x462ceb);};Preview[_0x35fc('0x66')][_0x35fc('0x9b')]=function(_0x1d81a5,_0x5c2ec0,_0x3d0ecc){var _0x1e2214=this;var _0x184057=this['actions'][_0x5c2ec0];var _0x3aa7fa=this[_0x35fc('0x24')][_0x184057[_0x35fc('0x6f')]];var _0x3c1b56;var _0x1e4e15=![];var _0x2c4309=0x2;var _0x2ee98b=0x3;if(_0x3aa7fa){switch(_0x3d0ecc){case'1':_0x3aa7fa[_0x35fc('0x3e')]+=0x1;_0x184057['countnosuchnumberretry']+=0x1;_0x184057[_0x35fc('0x9c')]=ut[_0x35fc('0x9d')](_0x184057);ut[_0x35fc('0x90')](_0x184057,0x0,'NoSuchNumber');ami[_0x35fc('0x25')](_0x35fc('0x9e'),ut['buildObj'](_0x184057,'nosuchnumber'));rpcDb[_0x35fc('0x8e')](_0x184057,'[callProgressDetectingCustomer][logNoSuch]');_0x1e2214[_0x35fc('0x9f')](_0x184057,'0',_0x3aa7fa)[_0x35fc('0x84')](function(_0x43638e){_0x1e4e15=_0x43638e[_0x35fc('0xa0')]==0x1;_0x2c4309=_0x3aa7fa[_0x35fc('0xa1')];_0x2ee98b=_0x3aa7fa[_0x35fc('0xa2')];if(!_0x1e4e15){if(ut[_0x35fc('0x9d')](_0x184057)>=_0x3aa7fa[_0x35fc('0xa3')]){_0x3c1b56=ut[_0x35fc('0xa4')](_0x184057,0xf,_0x35fc('0xa5'));rpcDb[_0x35fc('0x93')](_0x3c1b56,_0x35fc('0xa6'));}else{if(_0x184057[_0x35fc('0xa7')]>=_0x3aa7fa[_0x35fc('0xa8')]){rpcDb[_0x35fc('0x93')](_0x184057,_0x35fc('0xa6'));}else{rpcDb[_0x35fc('0xa9')](ut[_0x35fc('0xaa')](_0x184057,_0x35fc('0xa7'),_0x3aa7fa[_0x35fc('0xa1')]),_0x184057['unlockAgent'],_0x184057[_0x35fc('0xab')]);}}delete this['actions'][_0x1d81a5[_0x35fc('0xac')]];}else{_0x184057[_0x35fc('0xa7')]++;logger[_0x35fc('0x59')](_0x35fc('0xad'),_0x184057[_0x35fc('0xa7')]);logger[_0x35fc('0x59')]('id',_0x184057[_0x35fc('0xae')]);_0x1e2214[_0x35fc('0xaf')]({'id':_0x184057[_0x35fc('0xae')],'field':{'countnosuchnumberretry':_0x184057[_0x35fc('0xa7')]}})[_0x35fc('0x84')](function(){_0x1e2214['swapAdditionalPhones'](_0x184057,_0x2c4309,_0x2ee98b)[_0x35fc('0x84')](function(){});});}});break;case _0x35fc('0xb0'):var _0x2c1bd2=moment()[_0x35fc('0x5a')](_0x35fc('0x8d'));_0x184057[_0x35fc('0xb1')]=_0x2c1bd2;_0x184057['answertime']=_0x2c1bd2;_0x184057[_0x35fc('0xb2')]=!![];_0x3aa7fa[_0x35fc('0x72')]+=0x1;logger[_0x35fc('0x59')](_0x35fc('0xb3'),_0x184057[_0x35fc('0xb4')],_0x35fc('0xb5'),_0x3aa7fa[_0x35fc('0x28')],_0x35fc('0x71'),_0x3aa7fa[_0x35fc('0x72')]);ami['emit'](_0x35fc('0xb6'),ut['buildObj'](_0x184057,_0x35fc('0xb7'),this[_0x35fc('0x24')][_0x184057['queue']]));if(_0x3aa7fa[_0x35fc('0xb8')]){ami[_0x35fc('0x25')](_0x35fc('0xb9'),ut[_0x35fc('0xba')](_0x184057));}break;case'16':ami[_0x35fc('0x25')](_0x35fc('0xbb'),ut[_0x35fc('0xbc')](_0x184057,_0x35fc('0xbd'),this[_0x35fc('0x24')][_0x184057['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x184057,'complete'));_0x3aa7fa['outboundAnswerCallsDay']+=0x1;_0x3aa7fa[_0x35fc('0x30')]+=0x1;_0x3aa7fa[_0x35fc('0x2a')]+=0x1;ut[_0x35fc('0xbe')](_0x3aa7fa,_0x35fc('0xbf'));_0x184057[_0x35fc('0x9c')]=ut['totalGlobal'](_0x184057);ut[_0x35fc('0x90')](_0x184057,0x4,_0x35fc('0xc0'));rpcDb[_0x35fc('0x8e')](_0x184057,_0x35fc('0xc1'));rpcDb['createCustomerFinal'](_0x184057,_0x35fc('0xc2'));rpcDb[_0x35fc('0xc3')](_0x184057);_0x3aa7fa[_0x35fc('0x2e')]+=_0x184057['talktime'];_0x3aa7fa[_0x35fc('0x2d')]+=_0x184057[_0x35fc('0xc4')];logger[_0x35fc('0x59')](_0x35fc('0xc5'),_0x184057[_0x35fc('0xb4')],_0x35fc('0xb5'),_0x3aa7fa[_0x35fc('0x28')],_0x35fc('0x71'),_0x3aa7fa['pTalking']);delete this[_0x35fc('0x14')][_0x1d81a5[_0x35fc('0xac')]];break;case _0x35fc('0xc6'):_0x3aa7fa[_0x35fc('0x38')]+=0x1;_0x184057[_0x35fc('0xc7')]+=0x1;_0x184057[_0x35fc('0x9c')]=ut['totalGlobal'](_0x184057);ut[_0x35fc('0x90')](_0x184057,0x5,'Busy');_0x2c4309=_0x3aa7fa['dialBusyRetryFrequency'];_0x2ee98b=_0x3aa7fa[_0x35fc('0xa2')];ami['emit'](_0x35fc('0xc8'),ut[_0x35fc('0xbc')](_0x184057,_0x35fc('0xc9')));rpcDb['createCustomerHistory'](_0x184057,_0x35fc('0xca'));_0x1e2214[_0x35fc('0x9f')](_0x184057,'5',_0x3aa7fa)[_0x35fc('0x84')](function(_0x1beb46){_0x1e4e15=_0x1beb46[_0x35fc('0xa0')]==0x1;if(!_0x1e4e15){if(ut['totalGlobal'](_0x184057)>=_0x3aa7fa['dialGlobalMaxRetry']){_0x3c1b56=ut['cloneAction'](_0x184057,0xf,_0x35fc('0xa5'));rpcDb['createCustomerFinal'](_0x3c1b56,_0x35fc('0xcb'));}else{if(_0x184057[_0x35fc('0xc7')]>=_0x3aa7fa[_0x35fc('0xcc')]){rpcDb[_0x35fc('0x93')](_0x184057,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x35fc('0xa9')](ut[_0x35fc('0xaa')](_0x184057,_0x35fc('0xc7'),_0x3aa7fa['dialBusyRetryFrequency']),_0x184057[_0x35fc('0xcd')],_0x184057[_0x35fc('0xab')]);}}}else{_0x184057[_0x35fc('0xc7')]++;_0x1e2214['incrementPreviewCounters']({'id':_0x184057['idContact'],'field':{'countbusyretry':_0x184057['countbusyretry']}})[_0x35fc('0x84')](function(){_0x1e2214[_0x35fc('0xce')](_0x184057,_0x2c4309,_0x2ee98b)[_0x35fc('0x84')](function(){});});}});break;case _0x35fc('0xcf'):_0x3aa7fa['outboundNoAnswerCallsDay']+=0x1;_0x184057[_0x35fc('0xd0')]+=0x1;_0x184057[_0x35fc('0x9c')]=ut['totalGlobal'](_0x184057);ut['logCustomer'](_0x184057,0x3,_0x35fc('0xd1'));_0x2c4309=_0x3aa7fa[_0x35fc('0xd2')];_0x2ee98b=_0x3aa7fa[_0x35fc('0xa2')];ami['emit']('custom:agentnoanswer',ut[_0x35fc('0xbc')](_0x184057,_0x35fc('0xd3')));rpcDb['createCustomerHistory'](_0x184057,_0x35fc('0xd4'));_0x1e2214[_0x35fc('0x9f')](_0x184057,'3',_0x3aa7fa)[_0x35fc('0x84')](function(_0x4ef813){_0x1e4e15=_0x4ef813[_0x35fc('0xa0')]==0x1;if(!_0x1e4e15){if(ut[_0x35fc('0x9d')](_0x184057)>=_0x3aa7fa[_0x35fc('0xa3')]){_0x3c1b56=ut[_0x35fc('0xa4')](_0x184057,0xf,'Global');rpcDb[_0x35fc('0x93')](_0x3c1b56,_0x35fc('0xd5'));}else{if(_0x184057[_0x35fc('0xd0')]>=_0x3aa7fa['dialNoAnswerMaxRetry']){rpcDb[_0x35fc('0x93')](_0x184057,_0x35fc('0xd4'));}else{rpcDb[_0x35fc('0xa9')](ut['scheduledAt'](_0x184057,_0x35fc('0xd0'),_0x3aa7fa[_0x35fc('0xd2')]),_0x184057['unlockAgent'],_0x184057[_0x35fc('0xab')]);}}}else{_0x184057[_0x35fc('0xd0')]++;_0x1e2214[_0x35fc('0xaf')]({'id':_0x184057[_0x35fc('0xae')],'field':{'countnoanswerretry':_0x184057[_0x35fc('0xd0')]}})[_0x35fc('0x84')](function(){_0x1e2214[_0x35fc('0xce')](_0x184057,_0x2c4309,_0x2ee98b)[_0x35fc('0x84')](function(){});});}});break;case _0x35fc('0xd6'):_0x3aa7fa['outboundCongestionCallsDay']+=0x1;_0x184057[_0x35fc('0xd7')]+=0x1;_0x184057[_0x35fc('0x9c')]=ut[_0x35fc('0x9d')](_0x184057);ut[_0x35fc('0x90')](_0x184057,0x8,'Congestion');_0x2c4309=_0x3aa7fa[_0x35fc('0xd8')];_0x2ee98b=_0x3aa7fa[_0x35fc('0xa2')];ami[_0x35fc('0x25')](_0x35fc('0xd9'),ut[_0x35fc('0xbc')](_0x184057,_0x35fc('0xda')));rpcDb[_0x35fc('0x8e')](_0x184057,_0x35fc('0xdb'));_0x1e2214['verifyAdditionalPhones'](_0x184057,'8',_0x3aa7fa)['then'](function(_0x3ee301){_0x1e4e15=_0x3ee301[_0x35fc('0xa0')]==0x1;if(!_0x1e4e15){if(ut[_0x35fc('0x9d')](_0x184057)>=_0x3aa7fa['dialGlobalMaxRetry']){_0x3c1b56=ut[_0x35fc('0xa4')](_0x184057,0xf,_0x35fc('0xa5'));rpcDb[_0x35fc('0x93')](_0x3c1b56,_0x35fc('0xdc'));}else{if(_0x184057['countcongestionretry']>=_0x3aa7fa['dialCongestionMaxRetry']){rpcDb[_0x35fc('0x93')](_0x184057,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x35fc('0xa9')](ut[_0x35fc('0xaa')](_0x184057,'countcongestionretry',_0x3aa7fa['dialBusyRetryFrequency']),_0x184057[_0x35fc('0xcd')],_0x184057[_0x35fc('0xab')]);}}}else{_0x184057[_0x35fc('0xd7')]++;_0x1e2214['incrementPreviewCounters']({'id':_0x184057[_0x35fc('0xae')],'field':{'countcongestionretry':_0x184057[_0x35fc('0xd7')]}})[_0x35fc('0x84')](function(){_0x1e2214['swapAdditionalPhones'](_0x184057,_0x2c4309,_0x2ee98b)[_0x35fc('0x84')](function(){});});}});break;case _0x35fc('0xdd'):_0x3aa7fa[_0x35fc('0x40')]+=0x1;_0x184057[_0x35fc('0xde')]+=0x1;_0x184057['countglobal']=ut[_0x35fc('0x9d')](_0x184057);ut[_0x35fc('0x90')](_0x184057,0x14,_0x35fc('0xdf'));_0x2c4309=_0x3aa7fa[_0x35fc('0xe0')];_0x2ee98b=_0x3aa7fa[_0x35fc('0xa2')];ami[_0x35fc('0x25')]('custom:agentreject',ut[_0x35fc('0xbc')](_0x184057,_0x35fc('0xe1')));rpcDb['createCustomerHistory'](_0x184057,_0x35fc('0xe2'));_0x1e2214[_0x35fc('0x9f')](_0x184057,'20',_0x3aa7fa)['then'](function(_0x7c1b12){_0x1e4e15=_0x7c1b12[_0x35fc('0xa0')]==0x1;if(!_0x1e4e15){if(ut[_0x35fc('0x9d')](_0x184057)>=_0x3aa7fa[_0x35fc('0xa3')]){_0x3c1b56=ut[_0x35fc('0xa4')](_0x184057,0x14,'AgentReject');rpcDb[_0x35fc('0x93')](_0x3c1b56,_0x35fc('0xe3'));}else{if(_0x184057[_0x35fc('0xde')]>=_0x3aa7fa['dialAgentRejectMaxRetry']){rpcDb[_0x35fc('0x93')](_0x184057,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x35fc('0xaa')](_0x184057,_0x35fc('0xde'),_0x3aa7fa[_0x35fc('0xe0')]),_0x184057[_0x35fc('0xcd')],_0x184057[_0x35fc('0xab')]);}}}else{_0x184057['countnoanswerretry']++;_0x1e2214[_0x35fc('0xaf')]({'id':_0x184057[_0x35fc('0xae')],'field':{'countnoanswerretry':_0x184057[_0x35fc('0xd0')]}})['then'](function(){_0x1e2214[_0x35fc('0xce')](_0x184057,_0x2c4309,_0x2ee98b)[_0x35fc('0x84')](function(){});});}});break;case _0x35fc('0xe4'):_0x3aa7fa[_0x35fc('0xe5')]+=0x1;_0x184057[_0x35fc('0xe6')]+=0x1;_0x184057['countglobal']=ut[_0x35fc('0x9d')](_0x184057);ut[_0x35fc('0x90')](_0x184057,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x184057,_0x35fc('0xe7'));_0x1e2214[_0x35fc('0x9f')](_0x184057,'11',_0x3aa7fa)[_0x35fc('0x84')](function(_0x2b16b2){_0x1e4e15=_0x2b16b2[_0x35fc('0xa0')]==0x1;if(!_0x1e4e15){if(ut[_0x35fc('0x9d')](_0x184057)>=_0x3aa7fa[_0x35fc('0xa3')]){_0x3c1b56=ut['cloneAction'](_0x184057,0xf,'Global');rpcDb[_0x35fc('0x93')](_0x3c1b56,_0x35fc('0xe7'));}else{if(_0x184057[_0x35fc('0xe8')]>=_0x3aa7fa[_0x35fc('0xe9')]){rpcDb[_0x35fc('0x93')](_0x184057,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x35fc('0xaa')](_0x184057,_0x35fc('0xe6'),_0x3aa7fa[_0x35fc('0xea')]),_0x184057[_0x35fc('0xcd')],_0x184057['activeContact']);}}}else{_0x184057['countnoanswerretry']++;_0x1e2214[_0x35fc('0xaf')]({'id':_0x184057[_0x35fc('0xae')],'field':{'countnoanswerretry':_0x184057[_0x35fc('0xd0')]}})[_0x35fc('0x84')](function(){_0x1e2214['swapAdditionalPhones'](_0x184057,_0x2c4309,_0x2ee98b)['then'](function(){});});}});break;case'18':_0x3aa7fa[_0x35fc('0x41')]+=0x1;_0x184057[_0x35fc('0xeb')]+=0x1;_0x184057['countglobal']=ut[_0x35fc('0x9d')](_0x184057);ut[_0x35fc('0x90')](_0x184057,0x12,_0x1d81a5[_0x35fc('0xec')]||_0x1d81a5[_0x35fc('0xed')]);ami[_0x35fc('0x25')](_0x35fc('0xee'),ut[_0x35fc('0xbc')](_0x184057,_0x35fc('0xef')));rpcDb[_0x35fc('0x8e')](_0x184057,_0x35fc('0xf0'));_0x1e2214[_0x35fc('0x9f')](_0x184057,'18',_0x3aa7fa)[_0x35fc('0x84')](function(_0x3c31e0){_0x1e4e15=_0x3c31e0[_0x35fc('0xa0')]==0x1;if(!_0x1e4e15){if(ut[_0x35fc('0x9d')](_0x184057)>=_0x3aa7fa[_0x35fc('0xa3')]){_0x3c1b56=ut['cloneAction'](_0x184057,0x12,_0x35fc('0xa5'));rpcDb['createCustomerFinal'](_0x3c1b56,_0x35fc('0xf0'));}else{rpcDb['createCustomerFinal'](_0x184057,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x184057[_0x35fc('0xd0')]++;_0x1e2214[_0x35fc('0xaf')]({'id':_0x184057[_0x35fc('0xae')],'field':{'countnoanswerretry':_0x184057['countnoanswerretry']}})[_0x35fc('0x84')](function(){_0x1e2214[_0x35fc('0xce')](_0x184057,_0x2c4309,_0x2ee98b)[_0x35fc('0x84')](function(){});});}});delete this[_0x35fc('0x14')][_0x1d81a5[_0x35fc('0xac')]];break;case'19':_0x3aa7fa[_0x35fc('0x41')]+=0x1;_0x184057['countglobal']=ut['totalGlobal'](_0x184057);ut[_0x35fc('0x90')](_0x184057,0x13,_0x1d81a5['cause-txt']||_0x1d81a5['dialstatus']);ami[_0x35fc('0x25')]('custom:amd',ut['buildObj'](_0x184057,'amd'));rpcDb[_0x35fc('0x8e')](_0x184057,'[callProgressDetectingCustomer][machine]');_0x1e2214[_0x35fc('0x9f')](_0x184057,'18',_0x3aa7fa)[_0x35fc('0x84')](function(_0x406847){_0x1e4e15=_0x406847[_0x35fc('0xa0')]==0x1;if(!_0x1e4e15){if(ut[_0x35fc('0x9d')](_0x184057)>=_0x3aa7fa[_0x35fc('0xa3')]){_0x3c1b56=ut['cloneAction'](_0x184057,0xf,'Global');rpcDb[_0x35fc('0x93')](_0x3c1b56,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x35fc('0x93')](_0x184057,_0x35fc('0xf1'));}}else{_0x184057['countnoanswerretry']++;_0x1e2214['incrementPreviewCounters']({'id':_0x184057['idContact'],'field':{'countnoanswerretry':_0x184057[_0x35fc('0xd0')]}})[_0x35fc('0x84')](function(){_0x1e2214[_0x35fc('0xce')](_0x184057,_0x2c4309,_0x2ee98b)[_0x35fc('0x84')](function(){});});}});delete this[_0x35fc('0x14')][_0x1d81a5[_0x35fc('0xac')]];break;default:if(_0x184057[_0x35fc('0xb2')]){ut[_0x35fc('0xbe')](_0x3aa7fa,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3aa7fa['name'],_0x1d81a5);}_0x3aa7fa[_0x35fc('0x41')]+=0x1;_0x184057['countglobal']=ut[_0x35fc('0x9d')](_0x184057);ut['logCustomer'](_0x184057,0xc,_0x1d81a5[_0x35fc('0xec')]||_0x1d81a5[_0x35fc('0xed')]);_0x2c4309=_0x3aa7fa['dialAgentRejectRetryFrequency'];_0x2ee98b=_0x3aa7fa['callAdditionalPhoneAfterMin'];rpcDb[_0x35fc('0x8e')](_0x184057,_0x35fc('0xf2'));_0x1e2214[_0x35fc('0x9f')](_0x184057,'20',_0x3aa7fa)[_0x35fc('0x84')](function(_0x16628c){_0x1e4e15=_0x16628c['additional']==0x1;if(!_0x1e4e15){if(ut['totalGlobal'](_0x184057)>=_0x3aa7fa[_0x35fc('0xa3')]){_0x3c1b56=ut['cloneAction'](_0x184057,0xf,_0x35fc('0xa5'));rpcDb['createCustomerFinal'](_0x3c1b56,_0x35fc('0xf3'));}else{rpcDb[_0x35fc('0x93')](_0x184057,_0x35fc('0xf3'));}delete this[_0x35fc('0x14')][_0x1d81a5['linkedid']];}else{_0x1e2214[_0x35fc('0xce')](_0x184057,_0x2c4309,_0x2ee98b)['then'](function(_0x10a083){});}});}if(!(_0x184057['dialAnswer']&&_0x3d0ecc==='16')){ut['updateOriginated'](_0x3aa7fa,_0x35fc('0xf4'));logger['info'](_0x35fc('0xf5'),_0x184057[_0x35fc('0xb4')],_0x35fc('0xb5'),_0x3aa7fa[_0x35fc('0x28')],_0x35fc('0x70'),_0x3aa7fa[_0x35fc('0x5f')]);}if(_0x3d0ecc!==_0x35fc('0xb0')){delete this[_0x35fc('0x14')][_0x1d81a5[_0x35fc('0xac')]];delete this['actions'][_0x1d81a5[_0x35fc('0xf6')]];}}};Preview[_0x35fc('0x66')][_0x35fc('0xf7')]=function(_0x1eedc2,_0x1d1637,_0x1f4eeb){if(_[_0x35fc('0xf8')](_0x1d1637)&&_0x35fc('0xf9')!==typeof _0x1d1637){return;}if(_['isUndefined'](_0x1f4eeb)&&'object'!==typeof _0x1f4eeb){return;}switch(_0x1f4eeb['reason']){case'0':ut['logAgent'](_0x1eedc2,0x0,'NoSuchNumber');rpcDb[_0x35fc('0xfa')](_0x1eedc2,_0x35fc('0xfb'));break;case'3':ut[_0x35fc('0xfc')](_0x1eedc2,0x3,_0x35fc('0xd1'));rpcDb[_0x35fc('0xfa')](_0x1eedc2,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x35fc('0xfc')](_0x1eedc2,0x5,_0x35fc('0xfd'));rpcDb[_0x35fc('0xfa')](_0x1eedc2,_0x35fc('0xfe'));break;case'8':ut[_0x35fc('0xfc')](_0x1eedc2,0x8,'Congestion');rpcDb[_0x35fc('0xfa')](_0x1eedc2,_0x35fc('0xff'));break;case'22':ut[_0x35fc('0xfc')](_0x1eedc2,0x16,'AnswerAGI');rpcDb[_0x35fc('0xfa')](_0x1eedc2,_0x35fc('0x100'));break;default:ut[_0x35fc('0xfc')](_0x1eedc2,0xc,_0x1f4eeb[_0x35fc('0x101')]);rpcDb[_0x35fc('0xfa')](_0x1eedc2,_0x35fc('0xff'));}ut[_0x35fc('0x7c')](_0x1d1637,_0x35fc('0x102'));logger[_0x35fc('0x59')](_0x35fc('0x103'),_0x1eedc2[_0x35fc('0xb4')],_0x35fc('0xb5'),_0x1d1637[_0x35fc('0x28')],_0x35fc('0x70'),_0x1d1637[_0x35fc('0x5f')]);delete this['actions'][_0x1eedc2['uniqueid']];};Preview[_0x35fc('0x66')][_0x35fc('0x9f')]=function(_0x13f090,_0xb0550a,_0x219be6){return BPromise[_0x35fc('0x104')]()[_0x35fc('0x84')](cmHopperAdditionalPhone[_0x35fc('0x9f')](_0x13f090,_0xb0550a,_0x219be6))[_0x35fc('0x7b')](logger[_0x35fc('0x59')](_0x35fc('0x105')));};Preview[_0x35fc('0x66')][_0x35fc('0xce')]=function(_0x336c4a,_0x253ec2,_0x5824a0){return BPromise[_0x35fc('0x104')]()[_0x35fc('0x84')](cmHopperAdditionalPhone[_0x35fc('0xce')](_0x336c4a,_0x253ec2,_0x5824a0))[_0x35fc('0x7b')](logger[_0x35fc('0x59')](_0x35fc('0x106')));};Preview[_0x35fc('0x66')][_0x35fc('0xaf')]=function(_0x5e828f){return BPromise['resolve']()[_0x35fc('0x84')](cmHopperAdditionalPhone[_0x35fc('0xaf')](_0x5e828f))['catch'](logger[_0x35fc('0x59')](_0x35fc('0x107')));};Preview[_0x35fc('0x66')][_0x35fc('0x108')]=function(_0x56242f,_0x42912c,_0x41f4b9,_0x2d6801,_0x295a64){var _0x54f353=this;return new BPromise(function(_0x49ed6b,_0x2ff4ba){if(_['isNil'](_0x42912c)||_[_0x35fc('0x6d')](_0x42912c[_0x35fc('0x109')])||_[_0x35fc('0x6d')](_0x42912c['phone'])||_[_0x35fc('0x6d')](_0x42912c['VoiceQueueId'])){_0x2ff4ba(ut[_0x35fc('0x4c')](_0x35fc('0x10a'),_0x2d6801,_0x295a64));return;}var _0x4b6c11=uuid['v4']();var _0xa0dc64=_0x54f353[_0x35fc('0x24')][_0x42912c[_0x35fc('0x10b')][_0x35fc('0x28')]];var _0x316d37=_0x41f4b9?_0x54f353[_0x35fc('0x15')][_0x41f4b9]['id']:undefined;_0x54f353[_0x35fc('0x14')][_0x4b6c11]=new Action(_0x42912c,_0xa0dc64,_0x4b6c11,_0x41f4b9,_0x316d37);var _0x5e6a3b=_0x54f353['actions'][_0x4b6c11];_0x5e6a3b[_0x35fc('0xcd')]=_0x2d6801;_0x5e6a3b[_0x35fc('0xab')]=_0x295a64;_0x5e6a3b[_0x35fc('0x10c')]=_0x41f4b9;if(_[_0x35fc('0x10d')](_0x56242f)){_0x54f353[_0x35fc('0x10e')](_0x5e6a3b,_0xa0dc64,_0x42912c,_0x41f4b9)[_0x35fc('0x84')](function(_0x767c7b){logger['info'](_0x35fc('0x10f'),_0x35fc('0x110')+_0x5e6a3b[_0x35fc('0x6f')]+'\x20IdHopper:\x20'+_0x5e6a3b[_0x35fc('0xae')],JSON[_0x35fc('0x57')](_0x767c7b));ami[_0x35fc('0x25')](_0x35fc('0x111'),ut[_0x35fc('0xbc')](_0x5e6a3b,_0x35fc('0x112'),_0x54f353[_0x35fc('0x24')][_0x5e6a3b[_0x35fc('0x6f')]]));_0x49ed6b(ut[_0x35fc('0x4c')](_0x35fc('0x113')));})[_0x35fc('0x7b')](function(_0x137a4b){ut[_0x35fc('0x62')](_0x35fc('0x114'),_0x137a4b);_0x2ff4ba(ut[_0x35fc('0x4c')](_0x35fc('0x115'),_0x2d6801,_0x295a64));});}else{_0xa0dc64[_0x35fc('0x37')]+=0x1;ut[_0x35fc('0x116')](_0x5e6a3b);rpcDb[_0x35fc('0x117')](_0x5e6a3b,'[Blacklist][error]');delete _0x54f353[_0x35fc('0x14')][_0x4b6c11];_0x2ff4ba(ut['message'](_0x35fc('0x118'),_0x2d6801,_0x295a64));}});};Preview[_0x35fc('0x66')]['isTrunkReachable']=function(_0x1add46){return!_[_0x35fc('0x6d')](_0x1add46)&&!_[_0x35fc('0x6d')](_0x1add46[_0x35fc('0x28')])&&!_[_0x35fc('0x6d')](_0x1add46[_0x35fc('0x54')])&&_0x1add46[_0x35fc('0x54')]&&!_[_0x35fc('0x6d')](this['trunks'][util[_0x35fc('0x5a')](_0x35fc('0x119'),_0x1add46[_0x35fc('0x28')])])&&!_[_0x35fc('0x6d')](this['trunks'][util['format']('SIP/%s',_0x1add46['name'])][_0x35fc('0x79')])&&(this['trunks'][util[_0x35fc('0x5a')](_0x35fc('0x119'),_0x1add46[_0x35fc('0x28')])][_0x35fc('0x79')]===_0x35fc('0x11a')||this[_0x35fc('0x13')][util[_0x35fc('0x5a')](_0x35fc('0x119'),_0x1add46[_0x35fc('0x28')])][_0x35fc('0x79')]===_0x35fc('0x11b'));};Preview[_0x35fc('0x66')][_0x35fc('0x8a')]=function(_0x5ad3cb,_0x35f09b){var _0x3e8580=this;return new BPromise(function(_0x297528,_0x2064bd){_0x3e8580['execRun'](_0x5ad3cb,_0x35f09b)[_0x35fc('0x84')](function(_0x1641eb){_0x297528(_[_0x35fc('0x73')](_0x1641eb,[_0x35fc('0x4c')]));})[_0x35fc('0x7b')](function(_0x4136a1){if(_0x4136a1[_0x35fc('0x11c')]){rpcDb[_0x35fc('0x11d')](_0x5ad3cb);}if(_0x4136a1[_0x35fc('0x54')]){rpcDb[_0x35fc('0x11e')](_0x5ad3cb);}_0x2064bd(_[_0x35fc('0x73')](_0x4136a1,[_0x35fc('0x4c')]));});});};Preview[_0x35fc('0x66')][_0x35fc('0x11f')]=function(_0x464bd7,_0x1bcdd0){var _0x62255=this;return new BPromise(function(_0x153d51,_0xe521fc){var _0x1470e0,_0x3ddc55;rpcDb[_0x35fc('0x120')](_0x464bd7)['then'](function(_0x12238e){if(!_[_0x35fc('0x6d')](_0x12238e[0x0])){_0x3ddc55=_0x12238e[0x0][_0x35fc('0x121')]?![]:!![];_0x1470e0=_0x12238e[0x0][_0x35fc('0x121')]?!![]:![];_0x1470e0=_0x1bcdd0?!![]:_0x1470e0;}var _0x3b57d0=_0x62255['validateContact'](_0x12238e);if(_0x3b57d0[_0x35fc('0x122')]){rpcDb['checkIsBlackList'](_[_0x35fc('0x73')](_0x12238e[0x0],[_0x35fc('0x76'),_0x35fc('0x123')]))[_0x35fc('0x84')](function(_0x10885e){_0x62255[_0x35fc('0x108')](_0x10885e,_0x12238e[0x0],_0x1bcdd0,_0x3ddc55,_0x1470e0)[_0x35fc('0x84')](function(_0x3e1913){_0x153d51(_0x3e1913);})[_0x35fc('0x7b')](function(_0x41ac98){_0xe521fc(_0x41ac98);});})[_0x35fc('0x7b')](function(_0x1ef246){ut[_0x35fc('0x62')](_0x35fc('0x124'),_0x1ef246);_0xe521fc(ut[_0x35fc('0x4c')](_0x35fc('0x125'),_0x3ddc55,_0x1470e0));});}else{_0xe521fc(ut[_0x35fc('0x4c')](_0x3b57d0[_0x35fc('0x4c')],_0x3ddc55,_0x1470e0));}})[_0x35fc('0x7b')](function(_0xe5303a){ut['logger'](_0x35fc('0x126'),_0xe5303a);_0xe521fc(ut[_0x35fc('0x4c')](_0x35fc('0x125'),![],!![]));});});};Preview['prototype'][_0x35fc('0x127')]=function(_0x162858){if(_['isNil'](_0x162858)||_['isEmpty'](_0x162858)||!_['isNil'](_0x162858[0x0][_0x35fc('0x89')])&&_[_0x35fc('0x6d')](_0x162858[0x0]['Agent'][_0x35fc('0x28')])){ut[_0x35fc('0x62')](_0x35fc('0x128'),_0x162858);return{'isValid':![],'message':_0x35fc('0x129')};}var _0x26d561=this[_0x35fc('0x24')][_0x162858[0x0]['Queue'][_0x35fc('0x28')]];_0x26d561[_0x35fc('0x4c')]=_0x35fc('0x9a');if(_[_0x35fc('0x6d')](_0x26d561)){ut[_0x35fc('0x62')]('[Preview][validateContact][Empty\x20Campaign]',_0x26d561);return{'isValid':![],'message':_0x35fc('0x12a')};}if(!this[_0x35fc('0x12b')](_0x26d561['Trunk'])){ut[_0x35fc('0x62')](_0x35fc('0x12c'),_0x35fc('0x12d')+_0x26d561[_0x35fc('0x28')]+_0x35fc('0x12e'));if(!this[_0x35fc('0x12b')](_0x26d561[_0x35fc('0x98')])){ut[_0x35fc('0x62')](_0x35fc('0x12c'),_0x26d561['name']+_0x35fc('0x12f'));return{'isValid':![],'message':_0x35fc('0x130')};}}if(!ut['isActive'](_0x26d561[_0x35fc('0x33')])){ut['logger'](_0x35fc('0x131'),_0x26d561[_0x35fc('0x28')]+_0x35fc('0x132'));return{'isValid':![],'message':_0x35fc('0x12d')+_0x26d561[_0x35fc('0x28')]+_0x35fc('0x132')};}return{'isValid':!![],'message':_0x35fc('0x133')};};Preview[_0x35fc('0x66')]['execCall']=function(_0x2c42df,_0x5b1d93,_0x21a6c7,_0x1c00cf){var _0x142a76=this;return new BPromise(function(_0x3da024,_0x1e887d){var _0x27fd15=_0x2c42df[_0x35fc('0xb4')];var _0x2c0010=_0x142a76[_0x35fc('0x12b')](_0x5b1d93[_0x35fc('0x53')])?util[_0x35fc('0x5a')](_0x35fc('0x134'),_0x5b1d93[_0x35fc('0x53')][_0x35fc('0x28')],_[_0x35fc('0x6d')](_0x5b1d93['dialPrefix'])?'':_0x5b1d93[_0x35fc('0x35')][_0x35fc('0x135')]()||'',_0x5b1d93[_0x35fc('0x136')]>0x0?_0x21a6c7[_0x35fc('0x123')][_0x35fc('0x137')](_0x5b1d93[_0x35fc('0x136')]):_0x21a6c7[_0x35fc('0x123')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x5b1d93['TrunkBackup'])?_0x5b1d93[_0x35fc('0x53')]['name']:_0x5b1d93[_0x35fc('0x98')][_0x35fc('0x28')],_[_0x35fc('0x6d')](_0x5b1d93[_0x35fc('0x35')])?'':_0x5b1d93[_0x35fc('0x35')][_0x35fc('0x135')]()||'',_0x5b1d93['dialCutDigit']>0x0?_0x21a6c7[_0x35fc('0x123')]['substring'](_0x5b1d93[_0x35fc('0x136')]):_0x21a6c7['phone']);var _0x5e680a=_0x142a76[_0x35fc('0x12b')](_0x5b1d93[_0x35fc('0x53')])?ut[_0x35fc('0x138')](_0x5b1d93['Trunk']['callerid'],_0x5b1d93['dialOriginateCallerIdName'],_0x5b1d93['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x35fc('0x139')](_0x5b1d93[_0x35fc('0x34')],_0x5b1d93[_0x35fc('0x13a')]):_0x5b1d93[_0x35fc('0x34')]):ut[_0x35fc('0x138')](_[_0x35fc('0x6d')](_0x5b1d93[_0x35fc('0x98')])?_0x5b1d93[_0x35fc('0x53')][_0x35fc('0x55')]:_0x5b1d93['TrunkBackup']['callerid'],_0x5b1d93[_0x35fc('0x13b')],_0x5b1d93[_0x35fc('0x13a')]>0x0?ut[_0x35fc('0x139')](_0x5b1d93[_0x35fc('0x34')],_0x5b1d93[_0x35fc('0x13a')]):_0x5b1d93[_0x35fc('0x34')]);if(_0x5e680a){_0x2c42df['originatecalleridname']=ut[_0x35fc('0x13c')](_0x5e680a);_0x2c42df[_0x35fc('0x13d')]=ut[_0x35fc('0x13e')](_0x5e680a);}var _0x4f9a00=ut['addVariables'](_0x5b1d93,_0x21a6c7,_0x2c0010,_0x5e680a,_0x27fd15,_0x2c42df);_[_0x35fc('0x13f')](_0x2c42df,ut[_0x35fc('0x140')](_0x4f9a00));_0x2c42df[_0x35fc('0x8c')]=moment()['format'](_0x35fc('0x8d'));ami[_0x35fc('0x78')](ut[_0x35fc('0x141')](_0x2c42df,_0x5b1d93,_0x4f9a00,_0x2c42df['activeContact'],_0x1c00cf))[_0x35fc('0x84')](function(_0x546d2e){_0x5b1d93[_0x35fc('0x5f')]+=0x1;logger['info'](_0x35fc('0x142'),_0x27fd15,_0x35fc('0xb5'),_0x5b1d93['name'],_0x35fc('0x70'),_0x5b1d93[_0x35fc('0x5f')]);_0x3da024(_0x546d2e);})['catch'](function(_0x1aa496){ut[_0x35fc('0xfc')](_0x2c42df,0xe,_0x35fc('0x143'));rpcDb[_0x35fc('0xfa')](_0x2c42df,_0x35fc('0x144'));_0x1e887d(_0x1aa496);});});};Preview[_0x35fc('0x66')]['syncNewExten']=function(_0xb51665){if(this[_0x35fc('0x14')][_0xb51665[_0x35fc('0xac')]]){this[_0x35fc('0x14')][_0xb51665[_0x35fc('0xac')]]['channel']=_0xb51665[_0x35fc('0x7a')];}};Preview[_0x35fc('0x66')][_0x35fc('0x145')]=function(_0x21ef81){var _0x3bbbd8=this;var _0x2173bb=this[_0x35fc('0x14')][_0x21ef81[_0x35fc('0x146')]];if(_0x2173bb){if(_0x2173bb[_0x35fc('0x10c')]&&this['agents'][_0x2173bb[_0x35fc('0x10c')]]){ut[_0x35fc('0x147')](_0x2173bb,this[_0x35fc('0x15')][_0x2173bb['lookAgent']][_0x35fc('0x28')],this['agents'][_0x2173bb[_0x35fc('0x10c')]]['id']);}var _0x413a4b=_['clone'](_0x2173bb);_0x413a4b[_0x35fc('0xb1')]=moment()[_0x35fc('0x5a')](_0x35fc('0x8d'));var _0x256958=_0x3bbbd8[_0x35fc('0x24')][_0x2173bb[_0x35fc('0x6f')]];if(ut[_0x35fc('0x148')](_0x21ef81['response'])){if(_0x2173bb[_0x35fc('0xcd')]){rpcDb[_0x35fc('0x11d')](_0x2173bb[_0x35fc('0xae')]);}if(_0x2173bb['activeContact']){rpcDb['disableContact'](_0x2173bb[_0x35fc('0xae')]);}ami[_0x35fc('0x25')](_0x35fc('0x149'),ut[_0x35fc('0xbc')](_0x2173bb,_0x35fc('0x14a'),this[_0x35fc('0x24')][_0x2173bb[_0x35fc('0x6f')]]));this[_0x35fc('0xf7')](_0x413a4b,_0x256958,_0x21ef81);}else{_0x2173bb[_0x35fc('0x8c')]=moment()[_0x35fc('0x5a')](_0x35fc('0x8d'));ut[_0x35fc('0xfc')](_0x413a4b,0x4,_0x35fc('0xc0'));rpcDb[_0x35fc('0xfa')](_0x413a4b,_0x35fc('0x14b'));}}};Preview[_0x35fc('0x66')][_0x35fc('0x14c')]=function(_0x605f3b){var _0x43bb43=this;var _0x4aec92=this[_0x35fc('0x14')][_0x605f3b['linkedid']];var _0x541bb9;if(_0x4aec92){_0x541bb9=this[_0x35fc('0x24')][_0x4aec92[_0x35fc('0x6f')]];logger[_0x35fc('0x59')](_0x35fc('0x14d'),_0x605f3b[_0x35fc('0xac')],_0x35fc('0xb5'),_0x541bb9[_0x35fc('0x28')],_0x35fc('0x71'),_0x541bb9[_0x35fc('0x72')]);}if(this[_0x35fc('0x14')][_0x605f3b[_0x35fc('0xac')]]&&_0x605f3b[_0x35fc('0xac')]!==_0x605f3b[_0x35fc('0xb4')]){if(_0x605f3b[_0x35fc('0x14e')]==='16'&&this[_0x35fc('0x14')][_0x605f3b[_0x35fc('0xac')]][_0x35fc('0xb2')]){this[_0x35fc('0x9b')](_0x605f3b,_0x605f3b[_0x35fc('0xac')],_0x605f3b[_0x35fc('0x14e')]);}else if(this['actions'][_0x605f3b[_0x35fc('0xac')]][_0x35fc('0xb2')]){logger[_0x35fc('0x59')]('[syncHangup][talking][cause]',_0x605f3b[_0x35fc('0xac')],_0x605f3b[_0x35fc('0x14e')],_0x35fc('0xb5'),_0x541bb9['name'],_0x35fc('0x71'),_0x541bb9[_0x35fc('0x72')]);this[_0x35fc('0x9b')](_0x605f3b,_0x605f3b['linkedid'],_0x605f3b[_0x35fc('0x14e')]);}}else if(_0x4aec92&&_[_0x35fc('0x6d')](_0x4aec92['statedesc'])&&_0x541bb9[_0x35fc('0x14f')]&&_0x605f3b[_0x35fc('0xac')]===_0x605f3b[_0x35fc('0xb4')]&&_[_0x35fc('0x6d')](_0x605f3b['reason'])&&_0x605f3b['cause']==='16'&&_0x605f3b['channelstate']==='6'&&_[_0x35fc('0xf8')](_0x4aec92[_0x35fc('0x150')])){if(_0x4aec92['unlockAgent']){rpcDb[_0x35fc('0x11d')](_0x4aec92[_0x35fc('0xae')]);}if(_0x4aec92[_0x35fc('0xab')]){rpcDb[_0x35fc('0x11e')](_0x4aec92[_0x35fc('0xae')]);}_0x605f3b['reason']='22';this[_0x35fc('0xf7')](_0x4aec92,_0x541bb9,_0x605f3b);}else if(_0x4aec92&&_0x4aec92[_0x35fc('0x150')]){if(_0x605f3b['cause']==='16'&&this[_0x35fc('0x14')][_0x605f3b[_0x35fc('0xac')]][_0x35fc('0xb2')]){logger[_0x35fc('0x59')](_0x35fc('0x151'),_0x605f3b[_0x35fc('0xac')],_0x605f3b[_0x35fc('0x14e')],_0x35fc('0xb5'),_0x541bb9['name'],_0x35fc('0x71'),_0x541bb9['pTalking']);this[_0x35fc('0x9b')](_0x605f3b,_0x605f3b[_0x35fc('0xac')],_0x605f3b[_0x35fc('0x14e')]);}else if(this[_0x35fc('0x14')][_0x605f3b[_0x35fc('0xac')]][_0x35fc('0xb2')]){logger['info']('[syncHangup][talking][cause]',_0x605f3b['linkedid'],_0x605f3b[_0x35fc('0x14e')],_0x35fc('0xb5'),_0x541bb9[_0x35fc('0x28')],'pTalking:\x20',_0x541bb9[_0x35fc('0x72')]);this[_0x35fc('0x9b')](_0x605f3b,_0x605f3b[_0x35fc('0xac')],_0x605f3b[_0x35fc('0x14e')]);}}};Preview[_0x35fc('0x66')][_0x35fc('0x1c')]=function(_0x43f039){if(this[_0x35fc('0x14')][_0x43f039[_0x35fc('0xf6')]]&&_0x43f039[_0x35fc('0xf6')]!==_0x43f039[_0x35fc('0x152')]){this['callProgressDetectingCustomer'](_0x43f039,_0x43f039[_0x35fc('0xf6')],_0x43f039[_0x35fc('0xed')]);}};Preview['prototype'][_0x35fc('0x1a')]=function(_0x4314ce){if(this['actions'][_0x4314ce['linkedid']]&&_0x4314ce[_0x35fc('0xac')]!==_0x4314ce[_0x35fc('0xb4')]&&!this[_0x35fc('0x14')][_0x4314ce[_0x35fc('0xac')]][_0x35fc('0xb2')]){if(_0x4314ce[_0x35fc('0x14e')]==='1'){this[_0x35fc('0x9b')](_0x4314ce,_0x4314ce[_0x35fc('0xac')],_0x4314ce['cause']);}}};Preview[_0x35fc('0x66')][_0x35fc('0x153')]=function(_0x16debf,_0x581ae3,_0x1e0fe7){if(this['actions'][_0x16debf]){if(_[_0x35fc('0x6d')](this[_0x35fc('0x14')][_0x16debf][_0x35fc('0x154')])){this[_0x35fc('0x14')][_0x16debf][_0x35fc('0x154')]={};}this['actions'][_0x16debf][_0x35fc('0x154')][_0x581ae3]=_0x1e0fe7;}};Preview['prototype']['syncVarSet']=function(_0x38ec71){try{if(!_[_0x35fc('0x6d')](_0x38ec71)){if(ut[_0x35fc('0x155')](_['keys'](_0x38ec71[_0x35fc('0x156')])[0x0])){this[_0x35fc('0x153')](_0x38ec71[_0x35fc('0xb4')],_[_0x35fc('0x157')](_0x38ec71[_0x35fc('0x156')])[0x0],_0x38ec71[_0x35fc('0x158')]);}}}catch(_0x323077){logger['error']('[syncVarSet][Preview]',util[_0x35fc('0x159')](_0x323077,{'showHidden':![],'depth':null}));}};Preview[_0x35fc('0x66')]['syncAttendedTransfer']=function(_0x3280fe){if(_0x3280fe){if(this['actions'][_0x3280fe[_0x35fc('0x15a')]]){this[_0x35fc('0x14')][_0x3280fe[_0x35fc('0x15a')]][_0x35fc('0x150')]=!![];}}};Preview['prototype'][_0x35fc('0x15b')]=function(_0x55366d){if(_0x55366d){if(this[_0x35fc('0x14')][_0x55366d[_0x35fc('0x15c')]]){this[_0x35fc('0x14')][_0x55366d['transfererlinkedid']][_0x35fc('0x150')]=!![];}}};module[_0x35fc('0x15d')]=Preview; \ No newline at end of file +var _0x8d0e=['[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','disableContact','isValid','phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','syncNewExten','logLookAgent','clone','responsetime','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destlinkedid','destuniqueid','variables','filterKey','variable','addVariable','keys','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','preview','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','[clearZombieChannel]','loggerError','[action]','getContactRecallMe','agentReadyId','then','getDiff','dialRecallMeTimeout','Agent','run','logger2','catch','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NOANSWER','custom:agentnoanswer','noanswer'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x36cae5,_0x32392f){_0x36cae5=_0x36cae5-0x0;var _0x127b80=_0x8d0e[_0x36cae5];return _0x127b80;};'use strict';var util=require(_0xe8d0('0x0'));var _=require(_0xe8d0('0x1'));var BPromise=require(_0xe8d0('0x2'));var uuid=require(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var md5=require(_0xe8d0('0x5'));var Redis=require(_0xe8d0('0x6'));var config=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('preview');var loggerAction=require(_0xe8d0('0x8'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xe8d0('0x9'));var cmHopperAdditionalPhone=require(_0xe8d0('0xa'));var Action=require(_0xe8d0('0xb'));var ut=require(_0xe8d0('0xc'));config[_0xe8d0('0xd')]=_[_0xe8d0('0xe')](config[_0xe8d0('0xd')],{'host':_0xe8d0('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe8d0('0xd')]));var Sequence=function(){};Sequence[_0xe8d0('0x10')][_0xe8d0('0x11')]=function(_0x599bc3){this['tail']=this[_0xe8d0('0x12')]?this[_0xe8d0('0x12')][_0xe8d0('0x13')](_0x599bc3):_0x599bc3();};function Preview(_0x10b345){this[_0xe8d0('0x14')]=new Sequence();this[_0xe8d0('0x15')]=_0x10b345['voiceQueues'];this[_0xe8d0('0x16')]=_0x10b345[_0xe8d0('0x16')];this['actions']={};this[_0xe8d0('0x17')]=_0x10b345['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xe8d0('0x18'),this[_0xe8d0('0x19')][_0xe8d0('0x1a')](this));ami['on'](_0xe8d0('0x1b'),this[_0xe8d0('0x1c')][_0xe8d0('0x1a')](this));ami['on']('hanguprequest',this[_0xe8d0('0x1d')]['bind'](this));ami['on'](_0xe8d0('0x1e'),this[_0xe8d0('0x1f')][_0xe8d0('0x1a')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xe8d0('0x20'),this[_0xe8d0('0x21')][_0xe8d0('0x1a')](this));ami['on'](_0xe8d0('0x22'),this[_0xe8d0('0x23')]['bind'](this));ami['on'](_0xe8d0('0x24'),this[_0xe8d0('0x25')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x384a60,_0x35d131,_0x25363b){io['to'](_0x384a60)[_0xe8d0('0x26')](_0x35d131,_0x25363b);}function emitCampaignPreview(_0x25f764){if(_0x25f764[_0xe8d0('0x27')]===_0xe8d0('0x28')){var _0x28a6b5={'id':_0x25f764['id'],'name':_0x25f764[_0xe8d0('0x29')],'strategy':_0x25f764['strategy'],'answered':_0x25f764[_0xe8d0('0x2a')],'available':_0x25f764[_0xe8d0('0x2b')],'loggedIn':_0x25f764['loggedIn'],'pTalking':_0x25f764[_0xe8d0('0x2c')],'sumBillable':_0x25f764[_0xe8d0('0x2d')],'sumDuration':_0x25f764[_0xe8d0('0x2e')],'sumHoldTime':_0x25f764[_0xe8d0('0x2f')]||0x0,'talking':_0x25f764[_0xe8d0('0x30')],'total':_0x25f764[_0xe8d0('0x31')],'type':_0x25f764[_0xe8d0('0x27')],'unmanaged':_0x25f764[_0xe8d0('0x32')],'abandoned':_0x25f764[_0xe8d0('0x33')],'waiting':_0x25f764[_0xe8d0('0x34')],'loggedInDb':_0x25f764[_0xe8d0('0x35')],'dialActive':_0x25f764['dialActive'],'dialMethod':_0x25f764[_0xe8d0('0x36')],'dialOriginateCallerIdName':_0x25f764[_0xe8d0('0x37')],'dialOriginateCallerIdNumber':_0x25f764[_0xe8d0('0x38')],'dialOriginateTimeout':_0x25f764['dialOriginateTimeout'],'dialPrefix':_0x25f764[_0xe8d0('0x39')],'outboundAnswerAgiCallsDay':_0x25f764[_0xe8d0('0x3a')],'outboundAnswerCallsDay':_0x25f764['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x25f764[_0xe8d0('0x3b')],'outboundBusyCallsDay':_0x25f764[_0xe8d0('0x3c')],'outboundCongestionCallsDay':_0x25f764[_0xe8d0('0x3d')],'outboundDropCallsDayACS':_0x25f764[_0xe8d0('0x3e')],'outboundDropCallsDayCallersExit':_0x25f764[_0xe8d0('0x3f')],'outboundDropCallsDayTimeout':_0x25f764['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x25f764[_0xe8d0('0x40')],'outboundNoSuchCallsDay':_0x25f764['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x25f764['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x25f764['outboundReCallsDay'],'outboundRejectCallsDay':_0x25f764[_0xe8d0('0x41')],'outboundUnknownCallsDay':_0x25f764[_0xe8d0('0x42')],'outboundAbandonedCallsDay':_0x25f764[_0xe8d0('0x43')],'predictiveIntervalAnsweredCalls':_0x25f764['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x25f764['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x25f764[_0xe8d0('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x25f764['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x25f764[_0xe8d0('0x45')],'predictiveIntervalErlangCalls':_0x25f764[_0xe8d0('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x25f764[_0xe8d0('0x47')],'predictiveIntervalHitRate':_0x25f764[_0xe8d0('0x48')],'predictiveIntervalMultiplicativeFactor':_0x25f764[_0xe8d0('0x49')],'predictiveIntervalPauses':_0x25f764['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x25f764[_0xe8d0('0x4a')],'predictiveIntervalTotalCalls':_0x25f764[_0xe8d0('0x4b')],'message':_0x25f764[_0xe8d0('0x4c')],'originated':_0x25f764[_0xe8d0('0x4d')],'erlangCalls':_0x25f764['erlangCalls'],'erlangCallToSecond':_0x25f764[_0xe8d0('0x4e')],'erlangAbandonmentRate':_0x25f764[_0xe8d0('0x4f')],'erlangBusyFactor':_0x25f764['erlangBusyFactor'],'startPredictive':_0x25f764[_0xe8d0('0x50')],'startProgressive':_0x25f764['startProgressive']};if(_0x25f764[_0xe8d0('0x51')]){_0x28a6b5['Trunk']={'id':_0x25f764[_0xe8d0('0x51')]['id'],'name':_0x25f764['Trunk'][_0xe8d0('0x29')],'active':_0x25f764[_0xe8d0('0x51')][_0xe8d0('0x52')],'callerid':_0x25f764[_0xe8d0('0x51')]['callerid']};}if(_0x25f764[_0xe8d0('0x53')]){_0x28a6b5[_0xe8d0('0x53')]={'id':_0x25f764[_0xe8d0('0x53')]['id'],'name':_0x25f764['Interval'][_0xe8d0('0x29')]};}var _0xa02b8d=md5(JSON[_0xe8d0('0x54')](_0x28a6b5));if(_0x25f764[_0xe8d0('0x5')]!==_0xa02b8d){_0x25f764[_0xe8d0('0x5')]=_0xa02b8d;emit(util['format'](_0xe8d0('0x55'),_0x28a6b5[_0xe8d0('0x29')]),_0xe8d0('0x56'),_0x28a6b5);}}}function emitVoiceQueueChannelRemove(_0x3d76d5){logger[_0xe8d0('0x57')](_0xe8d0('0x58'),JSON[_0xe8d0('0x54')](_0x3d76d5));emit(util[_0xe8d0('0x59')]('voice:queue:%s',_0x3d76d5['name']),_0xe8d0('0x5a'),_0x3d76d5);io[_0xe8d0('0x26')](_0xe8d0('0x5b'),_0x3d76d5);}function notSendMessagesQueue(_0x377dc1){if(_0x377dc1[_0xe8d0('0x5c')]){if(_0x377dc1['originated']===0x0&&_0x377dc1[_0xe8d0('0x2c')]===0x0){_0x377dc1['sendMessageOneNotActive']=![];_0x377dc1[_0xe8d0('0x2b')]=0x0;_0x377dc1[_0xe8d0('0x5d')]=0x0;_0x377dc1[_0xe8d0('0x4c')]='NOT_ACTIVE';ut[_0xe8d0('0x5e')](_0xe8d0('0x5f'),_0x377dc1[_0xe8d0('0x29')]+_0xe8d0('0x60'));}else{_0x377dc1[_0xe8d0('0x4c')]='DEACTIVATED';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x377dc1['name']+_0xe8d0('0x61'));}emitCampaignPreview(_0x377dc1);}}Preview['prototype'][_0xe8d0('0x62')]=function(){var _0x1b0ef3=this;setInterval(function(){_0x1b0ef3[_0xe8d0('0x63')]();},0x7cf);};Preview[_0xe8d0('0x10')][_0xe8d0('0x63')]=function(){var _0x1156da=this[_0xe8d0('0x15')];this[_0xe8d0('0x64')]+=0x1;for(var _0x563c16 in _0x1156da){if(_0x1156da[_0xe8d0('0x65')](_0x563c16)&&(_0x1156da[_0x563c16][_0xe8d0('0x36')]==='preview'||_0x1156da[_0x563c16]['dialMethod']===_0xe8d0('0x66'))&&_0x1156da[_0x563c16][_0xe8d0('0x27')]===_0xe8d0('0x28')){if(this['clockClearZombieChannels']>0x7){this[_0xe8d0('0x64')]=0x0;this[_0xe8d0('0x67')]();}}if(_0x1156da['hasOwnProperty'](_0x563c16)&&_0x1156da[_0x563c16][_0xe8d0('0x36')]===_0xe8d0('0x68')&&_0x1156da[_0x563c16]['type']===_0xe8d0('0x28')){if(_0x1156da[_0x563c16][_0xe8d0('0x69')]){this[_0xe8d0('0x6a')](_0x1156da[_0x563c16]);if(_0x1156da[_0x563c16][_0xe8d0('0x6b')])this[_0xe8d0('0x6c')](_0x1156da[_0x563c16]);}else{notSendMessagesQueue(_0x1156da[_0x563c16]);}}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6d')]=function(_0x1ce97d){var _0x510f62=this;this[_0xe8d0('0x14')][_0xe8d0('0x11')](function(){if(!_[_0xe8d0('0x6e')](_0x510f62[_0xe8d0('0x6f')][_0x1ce97d])){loggerAction[_0xe8d0('0x57')](_0xe8d0('0x70'),_0x1ce97d,_0xe8d0('0x71'),_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')],_0xe8d0('0x73'),JSON[_0xe8d0('0x54')](_0x510f62[_0xe8d0('0x15')][_0x510f62['actions'][_0x1ce97d][_0xe8d0('0x72')]][_0xe8d0('0x4d')]),_0xe8d0('0x74'),JSON[_0xe8d0('0x54')](_0x510f62[_0xe8d0('0x15')][_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')]]['pTalking']),JSON[_0xe8d0('0x54')](_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x75')]),JSON[_0xe8d0('0x54')](_['pick'](_0x510f62[_0xe8d0('0x6f')][_0x1ce97d],['contactId',_0xe8d0('0x76'),_0xe8d0('0x77'),_0xe8d0('0x78')])));return ami[_0xe8d0('0x79')]({'action':_0xe8d0('0x7a'),'channel':_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x7b')]})['catch'](function(_0x137bc3){if(_0x137bc3['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x510f62[_0xe8d0('0x6f')][_0x1ce97d]){ut['updateOriginated'](_0x510f62[_0xe8d0('0x15')][_0x510f62['actions'][_0x1ce97d][_0xe8d0('0x72')]],_0xe8d0('0x7c'));if(_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x75')]===!![]){ut['decrementTalkink'](_0x510f62[_0xe8d0('0x15')][_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')]],_0xe8d0('0x7c'));ut[_0xe8d0('0x7d')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1ce97d,_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')]);}ut[_0xe8d0('0x7d')]('[Dialer][checkChannel][Preview]'+_0x1ce97d,_0x510f62[_0xe8d0('0x6f')][_0x1ce97d]['queue']);delete _0x510f62['actions'][_0x1ce97d];}},0x2328);}});}});};Preview[_0xe8d0('0x10')][_0xe8d0('0x67')]=function(){var _0x4e7b49=this;loggerAction[_0xe8d0('0x57')](_0xe8d0('0x7e'),_['size'](this[_0xe8d0('0x6f')]));for(var _0xe67928 in this[_0xe8d0('0x6f')]){if(_0x4e7b49[_0xe8d0('0x6f')]['hasOwnProperty'](_0xe67928)){_0x4e7b49[_0xe8d0('0x6d')](_0xe67928);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6c')]=function(_0x76316a){var _0x51930e=this;rpcDb[_0xe8d0('0x7f')](_0x76316a['id'],ut[_0xe8d0('0x80')](this[_0xe8d0('0x17')]))[_0xe8d0('0x81')](function(_0x1a74d0){if(!_[_0xe8d0('0x6e')](_0x1a74d0)){for(var _0x595b24=0x0;_0x595b24<_0x1a74d0['length'];_0x595b24+=0x1){if(ut[_0xe8d0('0x82')](_0x1a74d0[_0x595b24]['scheduledat'])<_0x76316a[_0xe8d0('0x83')]*0x3c){if(_0x1a74d0[_0x595b24][_0xe8d0('0x84')]&&!_0x1a74d0[_0x595b24]['Agent']['voicePause']){_0x51930e[_0xe8d0('0x85')](_0x1a74d0[_0x595b24]['id'])['then'](ut[_0xe8d0('0x86')]('[RecallMe]'))[_0xe8d0('0x87')](ut[_0xe8d0('0x86')](_0xe8d0('0x88')));}else{rpcDb['disableContact'](_0x1a74d0[_0x595b24]['id']);}}else{var _0x3091fb=new Action(_0x1a74d0[_0x595b24],_0x76316a);_0x3091fb[_0xe8d0('0x89')]=moment()['format'](_0xe8d0('0x8a'));_0x76316a['outboundReCallsDay']+=0x1;ut[_0xe8d0('0x8b')](_0x3091fb,0x17,'RecallInQueue');if(_0x76316a[_0xe8d0('0x8c')]){rpcDb[_0xe8d0('0x8d')](ut[_0xe8d0('0x8e')](_0x1a74d0[_0x595b24]));rpcDb[_0xe8d0('0x8f')](_0x3091fb,_0xe8d0('0x90'));}else{ut['logCustomer'](_0x3091fb,0x16,'RecallFailedTimeout');rpcDb[_0xe8d0('0x8f')](_0x3091fb,'[HistoryRecallClose]');rpcDb[_0xe8d0('0x91')](_0x3091fb,_0xe8d0('0x92'));}}}}})[_0xe8d0('0x87')](ut[_0xe8d0('0x86')](_0xe8d0('0x93')));};Preview[_0xe8d0('0x10')][_0xe8d0('0x6a')]=function(_0x20647d){_0x20647d[_0xe8d0('0x5c')]=!![];if(ut[_0xe8d0('0x94')](_0x20647d[_0xe8d0('0x95')])){_0x20647d[_0xe8d0('0x4c')]=_0xe8d0('0x96');}else if(!ut[_0xe8d0('0x97')](_0x20647d[_0xe8d0('0x69')])){_0x20647d['message']=_0xe8d0('0x98');}else if(!this[_0xe8d0('0x99')](_0x20647d[_0xe8d0('0x51')])){if(!this[_0xe8d0('0x99')](_0x20647d[_0xe8d0('0x9a')])){_0x20647d['message']=_0xe8d0('0x9b');}else{_0x20647d[_0xe8d0('0x4c')]=_0xe8d0('0x9c');}}else{_0x20647d[_0xe8d0('0x4c')]=_0xe8d0('0x9c');}emitCampaignPreview(_0x20647d);};Preview[_0xe8d0('0x10')][_0xe8d0('0x9d')]=function(_0x13ceb4,_0x40cb5c,_0x24be86){var _0x23955c=this;var _0xdb3e53=this['actions'][_0x40cb5c];var _0x4c4019=this[_0xe8d0('0x15')][_0xdb3e53['queue']];var _0x169047;var _0x209263=![];var _0x56761c=0x2;var _0x16a989=0x3;if(_0x4c4019){switch(_0x24be86){case'1':_0x4c4019[_0xe8d0('0x9e')]+=0x1;_0xdb3e53[_0xe8d0('0x9f')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x0,_0xe8d0('0xa2'));ami[_0xe8d0('0x26')](_0xe8d0('0xa3'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xa5')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xa6'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'0',_0x4c4019)[_0xe8d0('0x81')](function(_0x391510){_0x209263=_0x391510[_0xe8d0('0xa8')]==0x1;_0x56761c=_0x4c4019[_0xe8d0('0xa9')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];if(!_0x209263){if(ut['totalGlobal'](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb['createCustomerFinal'](_0x169047,_0xe8d0('0xae'));}else{if(_0xdb3e53['countnosuchnumberretry']>=_0x4c4019[_0xe8d0('0xaf')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xae'));}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xb0')](_0xdb3e53,_0xe8d0('0x9f'),_0x4c4019[_0xe8d0('0xa9')]),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}delete this['actions'][_0x13ceb4[_0xe8d0('0xb3')]];}else{_0xdb3e53[_0xe8d0('0x9f')]++;logger[_0xe8d0('0x57')](_0xe8d0('0xb4'),_0xdb3e53[_0xe8d0('0x9f')]);logger[_0xe8d0('0x57')]('id',_0xdb3e53[_0xe8d0('0xb5')]);_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53['idContact'],'field':{'countnosuchnumberretry':_0xdb3e53[_0xe8d0('0x9f')]}})[_0xe8d0('0x81')](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case'ANSWER':var _0x428b00=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));_0xdb3e53['responsetime']=_0x428b00;_0xdb3e53[_0xe8d0('0xb8')]=_0x428b00;_0xdb3e53['dialAnswer']=!![];_0x4c4019[_0xe8d0('0x2c')]+=0x1;logger['info'](_0xe8d0('0xb9'),_0xdb3e53[_0xe8d0('0xba')],_0xe8d0('0xbb'),_0x4c4019[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x4c4019[_0xe8d0('0x2c')]);ami[_0xe8d0('0x26')](_0xe8d0('0xbc'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xbd'),this[_0xe8d0('0x15')][_0xdb3e53[_0xe8d0('0x72')]]));if(_0x4c4019['acw']){ami[_0xe8d0('0x26')](_0xe8d0('0xbe'),ut[_0xe8d0('0xbf')](_0xdb3e53));}break;case'16':ami[_0xe8d0('0x26')](_0xe8d0('0xc0'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xc1'),this[_0xe8d0('0x15')][_0xdb3e53[_0xe8d0('0x72')]]));emitVoiceQueueChannelRemove(ut[_0xe8d0('0xa4')](_0xdb3e53,'complete'));_0x4c4019[_0xe8d0('0xc2')]+=0x1;_0x4c4019[_0xe8d0('0x31')]+=0x1;_0x4c4019[_0xe8d0('0x2a')]+=0x1;ut[_0xe8d0('0xc3')](_0x4c4019,_0xe8d0('0xc4'));_0xdb3e53['countglobal']=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x4,'Answer');rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xc5'));rpcDb[_0xe8d0('0x91')](_0xdb3e53,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xe8d0('0xc6')](_0xdb3e53);_0x4c4019['sumDuration']+=_0xdb3e53[_0xe8d0('0xc7')];_0x4c4019[_0xe8d0('0x2d')]+=_0xdb3e53[_0xe8d0('0xc7')];logger[_0xe8d0('0x57')](_0xe8d0('0xc8'),_0xdb3e53['uniqueid'],'\x20Queue',_0x4c4019[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x4c4019[_0xe8d0('0x2c')]);delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];break;case _0xe8d0('0xc9'):_0x4c4019[_0xe8d0('0x3c')]+=0x1;_0xdb3e53[_0xe8d0('0xca')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x5,_0xe8d0('0xcb'));_0x56761c=_0x4c4019[_0xe8d0('0xcc')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami['emit']('custom:agentbusy',ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xcd')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xce'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'5',_0x4c4019)[_0xe8d0('0x81')](function(_0x1a4129){_0x209263=_0x1a4129[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut['cloneAction'](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xcf'));}else{if(_0xdb3e53[_0xe8d0('0xca')]>=_0x4c4019[_0xe8d0('0xd0')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xce'));}else{rpcDb[_0xe8d0('0xd1')](ut[_0xe8d0('0xb0')](_0xdb3e53,'countbusyretry',_0x4c4019['dialBusyRetryFrequency']),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53['countbusyretry']++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countbusyretry':_0xdb3e53[_0xe8d0('0xca')]}})['then'](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case _0xe8d0('0xd2'):_0x4c4019[_0xe8d0('0x40')]+=0x1;_0xdb3e53['countnoanswerretry']+=0x1;_0xdb3e53['countglobal']=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x3,'NoAnswer');_0x56761c=_0x4c4019['dialNoAnswerRetryFrequency'];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami[_0xe8d0('0x26')](_0xe8d0('0xd3'),ut['buildObj'](_0xdb3e53,_0xe8d0('0xd4')));rpcDb['createCustomerHistory'](_0xdb3e53,'[callProgressDetectingCustomer][logNoAnswer]');_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'3',_0x4c4019)[_0xe8d0('0x81')](function(_0x1dad96){_0x209263=_0x1dad96[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019['dialGlobalMaxRetry']){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb['createCustomerFinal'](_0x169047,_0xe8d0('0xd5'));}else{if(_0xdb3e53[_0xe8d0('0xd6')]>=_0x4c4019[_0xe8d0('0xd7')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe8d0('0xd1')](ut[_0xe8d0('0xb0')](_0xdb3e53,_0xe8d0('0xd6'),_0x4c4019[_0xe8d0('0xd8')]),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53['idContact'],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})[_0xe8d0('0x81')](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)['then'](function(){});});}});break;case'CONGESTION':_0x4c4019['outboundCongestionCallsDay']+=0x1;_0xdb3e53[_0xe8d0('0xd9')]+=0x1;_0xdb3e53['countglobal']=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x8,'Congestion');_0x56761c=_0x4c4019[_0xe8d0('0xda')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami[_0xe8d0('0x26')](_0xe8d0('0xdb'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xdc')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xdd'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'8',_0x4c4019)[_0xe8d0('0x81')](function(_0x21e53d){_0x209263=_0x21e53d[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,'Global');rpcDb[_0xe8d0('0x91')](_0x169047,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xdb3e53[_0xe8d0('0xd9')]>=_0x4c4019[_0xe8d0('0xde')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xdd'));}else{rpcDb[_0xe8d0('0xd1')](ut[_0xe8d0('0xb0')](_0xdb3e53,_0xe8d0('0xd9'),_0x4c4019[_0xe8d0('0xcc')]),_0xdb3e53['unlockAgent'],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53[_0xe8d0('0xd9')]++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countcongestionretry':_0xdb3e53[_0xe8d0('0xd9')]}})['then'](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case _0xe8d0('0xdf'):_0x4c4019[_0xe8d0('0x41')]+=0x1;_0xdb3e53[_0xe8d0('0xe0')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x14,_0xe8d0('0xe1'));_0x56761c=_0x4c4019[_0xe8d0('0xe2')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami[_0xe8d0('0x26')](_0xe8d0('0xe3'),ut[_0xe8d0('0xa4')](_0xdb3e53,'agentreject'));rpcDb['createCustomerHistory'](_0xdb3e53,_0xe8d0('0xe4'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'20',_0x4c4019)[_0xe8d0('0x81')](function(_0x459264){_0x209263=_0x459264[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut['totalGlobal'](_0xdb3e53)>=_0x4c4019['dialGlobalMaxRetry']){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0x14,'AgentReject');rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xe5'));}else{if(_0xdb3e53[_0xe8d0('0xe0')]>=_0x4c4019[_0xe8d0('0xe6')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xe5'));}else{rpcDb[_0xe8d0('0xd1')](ut['scheduledAt'](_0xdb3e53,_0xe8d0('0xe0'),_0x4c4019[_0xe8d0('0xe2')]),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c['incrementPreviewCounters']({'id':_0xdb3e53['idContact'],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})['then'](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)['then'](function(){});});}});break;case _0xe8d0('0xe7'):_0x4c4019[_0xe8d0('0x43')]+=0x1;_0xdb3e53[_0xe8d0('0xe8')]+=0x1;_0xdb3e53['countglobal']=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0xb,'Abandoned');rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xe9'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'11',_0x4c4019)['then'](function(_0x5829b9){_0x209263=_0x5829b9[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut['cloneAction'](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb['createCustomerFinal'](_0x169047,_0xe8d0('0xe9'));}else{if(_0xdb3e53['countabandonedetry']>=_0x4c4019['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0xdb3e53,_0xe8d0('0xe9'));}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xb0')](_0xdb3e53,'countabandonedretry',_0x4c4019[_0xe8d0('0xea')]),_0xdb3e53['unlockAgent'],_0xdb3e53['activeContact']);}}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c['incrementPreviewCounters']({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})[_0xe8d0('0x81')](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case'18':_0x4c4019[_0xe8d0('0x42')]+=0x1;_0xdb3e53[_0xe8d0('0xeb')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x12,_0x13ceb4[_0xe8d0('0xec')]||_0x13ceb4[_0xe8d0('0xed')]);ami[_0xe8d0('0x26')]('custom:amd',ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xee')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xef'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'18',_0x4c4019)[_0xe8d0('0x81')](function(_0x3df7cb){_0x209263=_0x3df7cb['additional']==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0x12,_0xe8d0('0xad'));rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xef'));}else{rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xef'));}}else{_0xdb3e53['countnoanswerretry']++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countnoanswerretry':_0xdb3e53['countnoanswerretry']}})['then'](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];break;case'19':_0x4c4019[_0xe8d0('0x42')]+=0x1;_0xdb3e53['countglobal']=ut[_0xe8d0('0xa1')](_0xdb3e53);ut['logCustomer'](_0xdb3e53,0x13,_0x13ceb4['cause-txt']||_0x13ceb4[_0xe8d0('0xed')]);ami['emit']('custom:amd',ut[_0xe8d0('0xa4')](_0xdb3e53,'amd'));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xf0'));_0x23955c['verifyAdditionalPhones'](_0xdb3e53,'18',_0x4c4019)[_0xe8d0('0x81')](function(_0xc6fd9a){_0x209263=_0xc6fd9a['additional']==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xf0'));}else{rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xf0'));}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})[_0xe8d0('0x81')](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];break;default:if(_0xdb3e53[_0xe8d0('0x75')]){ut[_0xe8d0('0xc3')](_0x4c4019,_0xe8d0('0xf1'));ut[_0xe8d0('0x7d')](_0xe8d0('0xf2')+_0x4c4019[_0xe8d0('0x29')],_0x13ceb4);}_0x4c4019[_0xe8d0('0x42')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0xc,_0x13ceb4[_0xe8d0('0xec')]||_0x13ceb4[_0xe8d0('0xed')]);_0x56761c=_0x4c4019[_0xe8d0('0xe2')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xf3'));_0x23955c['verifyAdditionalPhones'](_0xdb3e53,'20',_0x4c4019)[_0xe8d0('0x81')](function(_0x3cdce4){_0x209263=_0x3cdce4['additional']==0x1;if(!_0x209263){if(ut['totalGlobal'](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut['cloneAction'](_0xdb3e53,0xf,'Global');rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xf4'));}else{rpcDb['createCustomerFinal'](_0xdb3e53,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];}else{_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(_0x12f775){});}});}if(!(_0xdb3e53['dialAnswer']&&_0x24be86==='16')){ut['updateOriginated'](_0x4c4019,_0xe8d0('0xf5'));logger[_0xe8d0('0x57')](_0xe8d0('0xf6'),_0xdb3e53[_0xe8d0('0xba')],_0xe8d0('0xbb'),_0x4c4019['name'],_0xe8d0('0x73'),_0x4c4019[_0xe8d0('0x4d')]);}if(_0x24be86!=='ANSWER'){delete this['actions'][_0x13ceb4[_0xe8d0('0xb3')]];delete this[_0xe8d0('0x6f')][_0x13ceb4['destlinkedid']];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0xf7')]=function(_0x54878e,_0x48bb3a,_0x20bfdb){if(_['isUndefined'](_0x48bb3a)&&_0xe8d0('0xf8')!==typeof _0x48bb3a){return;}if(_[_0xe8d0('0xf9')](_0x20bfdb)&&_0xe8d0('0xf8')!==typeof _0x20bfdb){return;}switch(_0x20bfdb[_0xe8d0('0xfa')]){case'0':ut['logAgent'](_0x54878e,0x0,_0xe8d0('0xa2'));rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0xfc'));break;case'3':ut['logAgent'](_0x54878e,0x3,'NoAnswer');rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0xfd'));break;case'5':ut[_0xe8d0('0xfe')](_0x54878e,0x5,_0xe8d0('0xcb'));rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0xff'));break;case'8':ut['logAgent'](_0x54878e,0x8,_0xe8d0('0x100'));rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0x101'));break;case'22':ut[_0xe8d0('0xfe')](_0x54878e,0x16,'AnswerAGI');rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0x102'));break;default:ut['logAgent'](_0x54878e,0xc,_0x20bfdb[_0xe8d0('0xfa')]);rpcDb['createAgentHistory'](_0x54878e,_0xe8d0('0x101'));}ut[_0xe8d0('0x103')](_0x48bb3a,_0xe8d0('0x104'));logger['info'](_0xe8d0('0x105'),_0x54878e[_0xe8d0('0xba')],_0xe8d0('0xbb'),_0x48bb3a[_0xe8d0('0x29')],'originated:\x20',_0x48bb3a[_0xe8d0('0x4d')]);delete this[_0xe8d0('0x6f')][_0x54878e[_0xe8d0('0xba')]];};Preview['prototype'][_0xe8d0('0xa7')]=function(_0x47b4bb,_0xa57cb9,_0x48cae3){return BPromise[_0xe8d0('0x106')]()['then'](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x47b4bb,_0xa57cb9,_0x48cae3))['catch'](logger[_0xe8d0('0x57')](_0xe8d0('0x107')));};Preview[_0xe8d0('0x10')][_0xe8d0('0xb7')]=function(_0x6ee9e3,_0x5314e7,_0xc73a2){return BPromise[_0xe8d0('0x106')]()[_0xe8d0('0x81')](cmHopperAdditionalPhone[_0xe8d0('0xb7')](_0x6ee9e3,_0x5314e7,_0xc73a2))[_0xe8d0('0x87')](logger[_0xe8d0('0x57')](_0xe8d0('0x108')));};Preview[_0xe8d0('0x10')][_0xe8d0('0xb6')]=function(_0x598287){return BPromise[_0xe8d0('0x106')]()['then'](cmHopperAdditionalPhone[_0xe8d0('0xb6')](_0x598287))['catch'](logger[_0xe8d0('0x57')](_0xe8d0('0x109')));};Preview[_0xe8d0('0x10')][_0xe8d0('0x10a')]=function(_0x38ab00,_0x4b92e6,_0x145714,_0x13b61b,_0xb05e5){var _0x48ac43=this;return new BPromise(function(_0x21d2f7,_0x152043){if(_[_0xe8d0('0x6e')](_0x4b92e6)||_[_0xe8d0('0x6e')](_0x4b92e6[_0xe8d0('0x10b')])||_['isNil'](_0x4b92e6['phone'])||_[_0xe8d0('0x6e')](_0x4b92e6['VoiceQueueId'])){_0x152043(ut[_0xe8d0('0x4c')](_0xe8d0('0x10c'),_0x13b61b,_0xb05e5));return;}var _0x32a704=uuid['v4']();var _0x25009f=_0x48ac43['campaignsPreview'][_0x4b92e6[_0xe8d0('0x71')][_0xe8d0('0x29')]];var _0xf18d16=_0x145714?_0x48ac43['agents'][_0x145714]['id']:undefined;_0x48ac43[_0xe8d0('0x6f')][_0x32a704]=new Action(_0x4b92e6,_0x25009f,_0x32a704,_0x145714,_0xf18d16);var _0x5420f5=_0x48ac43[_0xe8d0('0x6f')][_0x32a704];_0x5420f5[_0xe8d0('0xb1')]=_0x13b61b;_0x5420f5[_0xe8d0('0xb2')]=_0xb05e5;_0x5420f5[_0xe8d0('0x10d')]=_0x145714;if(_[_0xe8d0('0x10e')](_0x38ab00)){_0x48ac43[_0xe8d0('0x10f')](_0x5420f5,_0x25009f,_0x4b92e6,_0x145714)[_0xe8d0('0x81')](function(_0x182d06){logger[_0xe8d0('0x57')](_0xe8d0('0x110'),'Queue:\x20'+_0x5420f5[_0xe8d0('0x72')]+_0xe8d0('0x111')+_0x5420f5[_0xe8d0('0xb5')],JSON['stringify'](_0x182d06));ami['emit'](_0xe8d0('0x112'),ut[_0xe8d0('0xa4')](_0x5420f5,'called',_0x48ac43[_0xe8d0('0x15')][_0x5420f5['queue']]));_0x21d2f7(ut[_0xe8d0('0x4c')](_0xe8d0('0x113')));})[_0xe8d0('0x87')](function(_0x2489d3){ut[_0xe8d0('0x5e')]('[Preview][execCall][failure]',_0x2489d3);_0x152043(ut['message'](_0xe8d0('0x114'),_0x13b61b,_0xb05e5));});}else{_0x25009f[_0xe8d0('0x3b')]+=0x1;ut[_0xe8d0('0x115')](_0x5420f5);rpcDb[_0xe8d0('0x116')](_0x5420f5,_0xe8d0('0x117'));delete _0x48ac43['actions'][_0x32a704];_0x152043(ut[_0xe8d0('0x4c')](_0xe8d0('0x118'),_0x13b61b,_0xb05e5));}});};Preview[_0xe8d0('0x10')]['isTrunkReachable']=function(_0x31bfe){return!_['isNil'](_0x31bfe)&&!_[_0xe8d0('0x6e')](_0x31bfe['name'])&&!_[_0xe8d0('0x6e')](_0x31bfe['active'])&&_0x31bfe[_0xe8d0('0x52')]&&!_[_0xe8d0('0x6e')](this[_0xe8d0('0x16')][util['format']('SIP/%s',_0x31bfe[_0xe8d0('0x29')])])&&!_[_0xe8d0('0x6e')](this[_0xe8d0('0x16')][util[_0xe8d0('0x59')](_0xe8d0('0x119'),_0x31bfe[_0xe8d0('0x29')])][_0xe8d0('0x7a')])&&(this['trunks'][util['format'](_0xe8d0('0x119'),_0x31bfe[_0xe8d0('0x29')])]['status']===_0xe8d0('0x11a')||this['trunks'][util[_0xe8d0('0x59')]('SIP/%s',_0x31bfe['name'])][_0xe8d0('0x7a')]===_0xe8d0('0x11b'));};Preview['prototype']['run']=function(_0x38ab65,_0x5e47ae){var _0x2b8448=this;return new BPromise(function(_0x51a290,_0x348e6d){_0x2b8448[_0xe8d0('0x11c')](_0x38ab65,_0x5e47ae)[_0xe8d0('0x81')](function(_0x5a87ee){_0x51a290(_[_0xe8d0('0x11d')](_0x5a87ee,[_0xe8d0('0x4c')]));})['catch'](function(_0x2edc14){if(_0x2edc14[_0xe8d0('0x11e')]){rpcDb[_0xe8d0('0x11f')](_0x38ab65);}if(_0x2edc14[_0xe8d0('0x52')]){rpcDb[_0xe8d0('0x120')](_0x38ab65);}_0x348e6d(_[_0xe8d0('0x11d')](_0x2edc14,[_0xe8d0('0x4c')]));});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x11c')]=function(_0x5b4e24,_0x22cced){var _0x28691c=this;return new BPromise(function(_0x19385d,_0x512dd4){var _0x55dbfb,_0x26b24b;rpcDb['getContactPreview'](_0x5b4e24)[_0xe8d0('0x81')](function(_0x19f8c3){if(!_[_0xe8d0('0x6e')](_0x19f8c3[0x0])){_0x26b24b=_0x19f8c3[0x0]['recallme']?![]:!![];_0x55dbfb=_0x19f8c3[0x0]['recallme']?!![]:![];_0x55dbfb=_0x22cced?!![]:_0x55dbfb;}var _0x57a379=_0x28691c['validateContact'](_0x19f8c3);if(_0x57a379[_0xe8d0('0x121')]){rpcDb['checkIsBlackList'](_[_0xe8d0('0x11d')](_0x19f8c3[0x0],['VoiceQueueId',_0xe8d0('0x122')]))['then'](function(_0x347687){_0x28691c['checkInBlack'](_0x347687,_0x19f8c3[0x0],_0x22cced,_0x26b24b,_0x55dbfb)[_0xe8d0('0x81')](function(_0x168bd8){_0x19385d(_0x168bd8);})[_0xe8d0('0x87')](function(_0x284c03){_0x512dd4(_0x284c03);});})[_0xe8d0('0x87')](function(_0x587a0c){ut['logger'](_0xe8d0('0x123'),_0x587a0c);_0x512dd4(ut[_0xe8d0('0x4c')]('Call\x20unsuccessful',_0x26b24b,_0x55dbfb));});}else{_0x512dd4(ut['message'](_0x57a379['message'],_0x26b24b,_0x55dbfb));}})[_0xe8d0('0x87')](function(_0x41cffa){ut['logger'](_0xe8d0('0x124'),_0x41cffa);_0x512dd4(ut[_0xe8d0('0x4c')](_0xe8d0('0x125'),![],!![]));});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x126')]=function(_0x1d3953){if(_[_0xe8d0('0x6e')](_0x1d3953)||_[_0xe8d0('0x10e')](_0x1d3953)||!_[_0xe8d0('0x6e')](_0x1d3953[0x0]['Agent'])&&_[_0xe8d0('0x6e')](_0x1d3953[0x0]['Agent'][_0xe8d0('0x29')])){ut[_0xe8d0('0x5e')]('[Preview][validateContact][Empty\x20Contact]',_0x1d3953);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x56b23a=this[_0xe8d0('0x15')][_0x1d3953[0x0]['Queue'][_0xe8d0('0x29')]];_0x56b23a[_0xe8d0('0x4c')]='ACTIVE';if(_['isNil'](_0x56b23a)){ut[_0xe8d0('0x5e')]('[Preview][validateContact][Empty\x20Campaign]',_0x56b23a);return{'isValid':![],'message':_0xe8d0('0x127')};}if(!this[_0xe8d0('0x99')](_0x56b23a['Trunk'])){ut[_0xe8d0('0x5e')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xe8d0('0x128')+_0x56b23a[_0xe8d0('0x29')]+_0xe8d0('0x129'));if(!this['isTrunkReachable'](_0x56b23a[_0xe8d0('0x9a')])){ut[_0xe8d0('0x5e')](_0xe8d0('0x12a'),_0x56b23a['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe8d0('0x12b')};}}if(!ut['isActive'](_0x56b23a[_0xe8d0('0x69')])){ut[_0xe8d0('0x5e')](_0xe8d0('0x12c'),_0x56b23a[_0xe8d0('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe8d0('0x128')+_0x56b23a['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe8d0('0x10')][_0xe8d0('0x10f')]=function(_0x2b7530,_0x258265,_0x19f710,_0x5a90f3){var _0xf18e32=this;return new BPromise(function(_0x5b821d,_0x4af90e){var _0x12c494=_0x2b7530[_0xe8d0('0xba')];var _0x17ac52=_0xf18e32['isTrunkReachable'](_0x258265[_0xe8d0('0x51')])?util[_0xe8d0('0x59')](_0xe8d0('0x12d'),_0x258265[_0xe8d0('0x51')][_0xe8d0('0x29')],_['isNil'](_0x258265[_0xe8d0('0x39')])?'':_0x258265[_0xe8d0('0x39')][_0xe8d0('0x12e')]()||'',_0x258265[_0xe8d0('0x12f')]>0x0?_0x19f710[_0xe8d0('0x122')][_0xe8d0('0x130')](_0x258265[_0xe8d0('0x12f')]):_0x19f710[_0xe8d0('0x122')]):util[_0xe8d0('0x59')](_0xe8d0('0x12d'),_[_0xe8d0('0x6e')](_0x258265['TrunkBackup'])?_0x258265[_0xe8d0('0x51')]['name']:_0x258265['TrunkBackup'][_0xe8d0('0x29')],_[_0xe8d0('0x6e')](_0x258265[_0xe8d0('0x39')])?'':_0x258265['dialPrefix'][_0xe8d0('0x12e')]()||'',_0x258265[_0xe8d0('0x12f')]>0x0?_0x19f710[_0xe8d0('0x122')][_0xe8d0('0x130')](_0x258265[_0xe8d0('0x12f')]):_0x19f710[_0xe8d0('0x122')]);var _0x48fe46=_0xf18e32[_0xe8d0('0x99')](_0x258265[_0xe8d0('0x51')])?ut[_0xe8d0('0x131')](_0x258265[_0xe8d0('0x51')][_0xe8d0('0x132')],_0x258265[_0xe8d0('0x37')],_0x258265['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x258265[_0xe8d0('0x38')],_0x258265[_0xe8d0('0x133')]):_0x258265[_0xe8d0('0x38')]):ut[_0xe8d0('0x131')](_[_0xe8d0('0x6e')](_0x258265[_0xe8d0('0x9a')])?_0x258265['Trunk'][_0xe8d0('0x132')]:_0x258265[_0xe8d0('0x9a')][_0xe8d0('0x132')],_0x258265[_0xe8d0('0x37')],_0x258265[_0xe8d0('0x133')]>0x0?ut['getCallerIdRandom'](_0x258265[_0xe8d0('0x38')],_0x258265[_0xe8d0('0x133')]):_0x258265[_0xe8d0('0x38')]);if(_0x48fe46){_0x2b7530['originatecalleridname']=ut[_0xe8d0('0x134')](_0x48fe46);_0x2b7530[_0xe8d0('0x135')]=ut[_0xe8d0('0x136')](_0x48fe46);}var _0x19a76e=ut['addVariables'](_0x258265,_0x19f710,_0x17ac52,_0x48fe46,_0x12c494,_0x2b7530);_[_0xe8d0('0x137')](_0x2b7530,ut[_0xe8d0('0x138')](_0x19a76e));_0x2b7530[_0xe8d0('0x89')]=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));ami['Action'](ut[_0xe8d0('0x139')](_0x2b7530,_0x258265,_0x19a76e,_0x2b7530[_0xe8d0('0xb2')],_0x5a90f3))[_0xe8d0('0x81')](function(_0xf94727){_0x258265[_0xe8d0('0x4d')]+=0x1;logger[_0xe8d0('0x57')](_0xe8d0('0x13a'),_0x12c494,'\x20Queue',_0x258265[_0xe8d0('0x29')],'originated:\x20',_0x258265[_0xe8d0('0x4d')]);_0x5b821d(_0xf94727);})[_0xe8d0('0x87')](function(_0x2d1802){ut['logAgent'](_0x2b7530,0xe,_0xe8d0('0x13b'));rpcDb[_0xe8d0('0xfb')](_0x2b7530,'[originateFailure][logOriginateFailure]');_0x4af90e(_0x2d1802);});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x13c')]=function(_0x15b1bf){if(this[_0xe8d0('0x6f')][_0x15b1bf[_0xe8d0('0xb3')]]){this['actions'][_0x15b1bf[_0xe8d0('0xb3')]][_0xe8d0('0x7b')]=_0x15b1bf['channel'];}};Preview[_0xe8d0('0x10')]['syncOriginateResponse']=function(_0x4cace8){var _0x18a42b=this;var _0x1801fc=this[_0xe8d0('0x6f')][_0x4cace8['actionid']];if(_0x1801fc){if(_0x1801fc[_0xe8d0('0x10d')]&&this[_0xe8d0('0x17')][_0x1801fc['lookAgent']]){ut[_0xe8d0('0x13d')](_0x1801fc,this['agents'][_0x1801fc[_0xe8d0('0x10d')]][_0xe8d0('0x29')],this[_0xe8d0('0x17')][_0x1801fc['lookAgent']]['id']);}var _0x199369=_[_0xe8d0('0x13e')](_0x1801fc);_0x199369[_0xe8d0('0x13f')]=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));var _0x28d34f=_0x18a42b[_0xe8d0('0x15')][_0x1801fc[_0xe8d0('0x72')]];if(ut['isFailure'](_0x4cace8[_0xe8d0('0x140')])){if(_0x1801fc[_0xe8d0('0xb1')]){rpcDb[_0xe8d0('0x11f')](_0x1801fc[_0xe8d0('0xb5')]);}if(_0x1801fc[_0xe8d0('0xb2')]){rpcDb[_0xe8d0('0x120')](_0x1801fc['idContact']);}ami[_0xe8d0('0x26')](_0xe8d0('0x141'),ut[_0xe8d0('0xa4')](_0x1801fc,_0xe8d0('0x142'),this[_0xe8d0('0x15')][_0x1801fc[_0xe8d0('0x72')]]));this[_0xe8d0('0xf7')](_0x199369,_0x28d34f,_0x4cace8);}else{_0x1801fc[_0xe8d0('0x89')]=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));ut[_0xe8d0('0xfe')](_0x199369,0x4,'Answer');rpcDb[_0xe8d0('0xfb')](_0x199369,_0xe8d0('0x143'));}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x1c')]=function(_0x287704){var _0x4dd0d2=this;var _0x564361=this[_0xe8d0('0x6f')][_0x287704[_0xe8d0('0xb3')]];var _0x231f49;if(_0x564361){_0x231f49=this['campaignsPreview'][_0x564361['queue']];logger[_0xe8d0('0x57')](_0xe8d0('0x144'),_0x287704[_0xe8d0('0xb3')],_0xe8d0('0xbb'),_0x231f49[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x231f49['pTalking']);}if(this['actions'][_0x287704['linkedid']]&&_0x287704[_0xe8d0('0xb3')]!==_0x287704['uniqueid']){if(_0x287704['cause']==='16'&&this['actions'][_0x287704[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){this[_0xe8d0('0x9d')](_0x287704,_0x287704[_0xe8d0('0xb3')],_0x287704[_0xe8d0('0x145')]);}else if(this['actions'][_0x287704[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){logger[_0xe8d0('0x57')](_0xe8d0('0x146'),_0x287704[_0xe8d0('0xb3')],_0x287704['cause'],_0xe8d0('0xbb'),_0x231f49[_0xe8d0('0x29')],'pTalking:\x20',_0x231f49[_0xe8d0('0x2c')]);this[_0xe8d0('0x9d')](_0x287704,_0x287704['linkedid'],_0x287704[_0xe8d0('0x145')]);}}else if(_0x564361&&_['isNil'](_0x564361[_0xe8d0('0x147')])&&_0x231f49['dialQueueProject']&&_0x287704['linkedid']===_0x287704[_0xe8d0('0xba')]&&_[_0xe8d0('0x6e')](_0x287704[_0xe8d0('0xfa')])&&_0x287704[_0xe8d0('0x145')]==='16'&&_0x287704[_0xe8d0('0x148')]==='6'&&_[_0xe8d0('0xf9')](_0x564361['transfer'])){if(_0x564361[_0xe8d0('0xb1')]){rpcDb[_0xe8d0('0x11f')](_0x564361['idContact']);}if(_0x564361[_0xe8d0('0xb2')]){rpcDb[_0xe8d0('0x120')](_0x564361[_0xe8d0('0xb5')]);}_0x287704['reason']='22';this['callProgressDetectingAgent'](_0x564361,_0x231f49,_0x287704);}else if(_0x564361&&_0x564361['transfer']){if(_0x287704[_0xe8d0('0x145')]==='16'&&this['actions'][_0x287704['linkedid']]['dialAnswer']){logger[_0xe8d0('0x57')]('[syncHangup][talking][transfer]',_0x287704[_0xe8d0('0xb3')],_0x287704[_0xe8d0('0x145')],_0xe8d0('0xbb'),_0x231f49[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x231f49['pTalking']);this['callProgressDetectingCustomer'](_0x287704,_0x287704['linkedid'],_0x287704['cause']);}else if(this['actions'][_0x287704[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){logger['info'](_0xe8d0('0x146'),_0x287704[_0xe8d0('0xb3')],_0x287704[_0xe8d0('0x145')],_0xe8d0('0xbb'),_0x231f49['name'],_0xe8d0('0x74'),_0x231f49['pTalking']);this[_0xe8d0('0x9d')](_0x287704,_0x287704['linkedid'],_0x287704[_0xe8d0('0x145')]);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x1f')]=function(_0x264913){if(this[_0xe8d0('0x6f')][_0x264913[_0xe8d0('0x149')]]&&_0x264913['destlinkedid']!==_0x264913[_0xe8d0('0x14a')]){this[_0xe8d0('0x9d')](_0x264913,_0x264913[_0xe8d0('0x149')],_0x264913[_0xe8d0('0xed')]);}};Preview[_0xe8d0('0x10')]['syncHangupRequest']=function(_0x5a8c45){if(this[_0xe8d0('0x6f')][_0x5a8c45[_0xe8d0('0xb3')]]&&_0x5a8c45[_0xe8d0('0xb3')]!==_0x5a8c45[_0xe8d0('0xba')]&&!this['actions'][_0x5a8c45[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){if(_0x5a8c45[_0xe8d0('0x145')]==='1'){this[_0xe8d0('0x9d')](_0x5a8c45,_0x5a8c45[_0xe8d0('0xb3')],_0x5a8c45[_0xe8d0('0x145')]);}}};Preview[_0xe8d0('0x10')]['addVariable']=function(_0x4c221e,_0x2167ec,_0x31e850){if(this[_0xe8d0('0x6f')][_0x4c221e]){if(_[_0xe8d0('0x6e')](this[_0xe8d0('0x6f')][_0x4c221e]['variables'])){this['actions'][_0x4c221e][_0xe8d0('0x14b')]={};}this[_0xe8d0('0x6f')][_0x4c221e][_0xe8d0('0x14b')][_0x2167ec]=_0x31e850;}};Preview[_0xe8d0('0x10')]['syncVarSet']=function(_0x3dd1a3){try{if(!_[_0xe8d0('0x6e')](_0x3dd1a3)){if(ut[_0xe8d0('0x14c')](_['keys'](_0x3dd1a3[_0xe8d0('0x14d')])[0x0])){this[_0xe8d0('0x14e')](_0x3dd1a3[_0xe8d0('0xba')],_[_0xe8d0('0x14f')](_0x3dd1a3[_0xe8d0('0x14d')])[0x0],_0x3dd1a3['value']);}}}catch(_0x2e2793){logger[_0xe8d0('0x150')](_0xe8d0('0x151'),util[_0xe8d0('0x152')](_0x2e2793,{'showHidden':![],'depth':null}));}};Preview[_0xe8d0('0x10')][_0xe8d0('0x23')]=function(_0xc0f639){if(_0xc0f639){if(this[_0xe8d0('0x6f')][_0xc0f639[_0xe8d0('0x153')]]){this[_0xe8d0('0x6f')][_0xc0f639[_0xe8d0('0x153')]][_0xe8d0('0x154')]=!![];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x25')]=function(_0x162542){if(_0x162542){if(this['actions'][_0x162542[_0xe8d0('0x155')]]){this[_0xe8d0('0x6f')][_0x162542[_0xe8d0('0x155')]][_0xe8d0('0x154')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0dccc8a..90f2114 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 _0xd2da=['UserId','active','countReScheduled','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0xd2da,0x105));var _0xad2d=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xd2da[_0x5f3905];return _0x2923b1;};'use strict';var util=require('util');var BPromise=require(_0xad2d('0x0'));var logger=require(_0xad2d('0x1'))(_0xad2d('0x2'));var _=require(_0xad2d('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xad2d('0x4'));var cmHopperHistory=require(_0xad2d('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xad2d('0x6'));var agentReportPreview=require(_0xad2d('0x7'));var voiceQueueReport=require(_0xad2d('0x8'));function loggerCatch(_0x19d579){return function(_0x44fc5b){logger[_0xad2d('0x9')](_0x19d579,util[_0xad2d('0xa')](_0x44fc5b,{'showHidden':![],'depth':null}));};}function create(_0xfac41c){return BPromise[_0xad2d('0xb')]()['then'](cmHopperHistory[_0xad2d('0xc')](_0xfac41c))[_0xad2d('0xd')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xbed37f){return BPromise[_0xad2d('0xb')]()[_0xad2d('0xe')](agentReportPreview[_0xad2d('0xc')](_0xbed37f))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x316f3c){return BPromise['resolve']()[_0xad2d('0xe')](cmHopper[_0xad2d('0xf')](_0x316f3c,!![]))[_0xad2d('0xd')](loggerCatch(_0xad2d('0x10')));}exports[_0xad2d('0x11')]=function(_0x54d8aa){return BPromise['resolve']()[_0xad2d('0xe')](cmHopperBlack[_0xad2d('0x11')](_0x54d8aa))[_0xad2d('0xd')](loggerCatch(_0xad2d('0x12')));};exports[_0xad2d('0x13')]=function(_0x44ca51){return BPromise[_0xad2d('0xb')]()[_0xad2d('0xe')](cmHopper[_0xad2d('0x13')](_0x44ca51))[_0xad2d('0xd')](loggerCatch(_0xad2d('0x14')));};exports[_0xad2d('0xc')]=function(_0xdae46f,_0x304e66){create(_0xdae46f)['catch'](loggerCatch(_0x304e66));moveContact(_0xdae46f)['catch'](loggerCatch(_0x304e66));};exports[_0xad2d('0x15')]=function(_0x27ffc3,_0x51d2b5){createAgent(_0x27ffc3)[_0xad2d('0xd')](loggerCatch(_0x51d2b5));};exports[_0xad2d('0x16')]=function(_0x37126b,_0x1c788d){create(_0x37126b)[_0xad2d('0xd')](loggerCatch(_0x1c788d));};exports['createCustomerFinal']=function(_0x784e65,_0xdf649d){moveContact(_0x784e65)[_0xad2d('0xd')](loggerCatch(_0xdf649d));};exports[_0xad2d('0x17')]=function(_0xed3921,_0x1a1ad2,_0x305833){if(_0x1a1ad2){_0xed3921[_0xad2d('0x18')]=null;}if(_0x305833){_0xed3921[_0xad2d('0x19')]=![];}return BPromise[_0xad2d('0xb')]()[_0xad2d('0xe')](cmHopper['rescheduleContact'](_0xed3921))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xad2d('0x1a')]=function(_0x205303){return BPromise[_0xad2d('0xb')]()[_0xad2d('0xe')](cmHopper[_0xad2d('0x1a')](_0x205303))['catch'](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x32043d){return BPromise['resolve']()[_0xad2d('0xe')](cmHopper['unlockContact']({'UserId':null},_0x32043d,0x1))[_0xad2d('0xd')](loggerCatch(_0xad2d('0x1b')));};exports[_0xad2d('0x1c')]=function(_0x14eab3){return BPromise[_0xad2d('0xb')]()[_0xad2d('0xe')](cmHopper[_0xad2d('0x1d')]({'active':![]},_0x14eab3,0x1))[_0xad2d('0xd')](loggerCatch(_0xad2d('0x1e')));};exports[_0xad2d('0x1f')]=function(_0x4642a7){var _0x5018e9={};_0x5018e9[_0xad2d('0x20')]=_0x4642a7[_0xad2d('0x20')];_0x5018e9[_0xad2d('0x21')]=_0x4642a7[_0xad2d('0x21')];_0x5018e9[_0xad2d('0x22')]=_0x4642a7[_0xad2d('0x22')];_0x5018e9['calleridname']=_0x4642a7[_0xad2d('0x23')];_0x5018e9[_0xad2d('0x24')]=_0x4642a7['queue'];_0x5018e9[_0xad2d('0x25')]=_0x4642a7[_0xad2d('0x26')];_0x5018e9[_0xad2d('0x27')]=_0x4642a7[_0xad2d('0x26')];_0x5018e9[_0xad2d('0x28')]=0x1;_0x5018e9['queuecallercompleteAt']=_0x4642a7[_0xad2d('0x29')];_0x5018e9[_0xad2d('0x2a')]=_0x4642a7[_0xad2d('0x2b')];_0x5018e9[_0xad2d('0x2c')]=_0xad2d('0x2d');_0x5018e9[_0xad2d('0x2e')]='xcally-motion-preview';_0x5018e9[_0xad2d('0x2f')]=0x0;_0x5018e9[_0xad2d('0x30')]=0x1;_0x5018e9[_0xad2d('0x31')]=_0x4642a7['membername'];_0x5018e9[_0xad2d('0x32')]=_0xad2d('0x33');return BPromise[_0xad2d('0xb')]()[_0xad2d('0xe')](voiceQueueReport['create'](_0x5018e9))['catch'](loggerCatch(_0xad2d('0x34')));};exports[_0xad2d('0x35')]=function(_0x36a671,_0x4b1c18){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x36a671,_0x4b1c18))[_0xad2d('0xd')](loggerCatch(_0xad2d('0x36')));};exports[_0xad2d('0x37')]=function(_0x5685c3){return BPromise[_0xad2d('0xb')]()[_0xad2d('0xe')](cmHopper['rescheduleContact'](_0x5685c3,!![],!![]))[_0xad2d('0xd')](loggerCatch(_0xad2d('0x38')));}; \ No newline at end of file +var _0xcfd2=['countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','from-sip','holdtime','assigned','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20'];(function(_0x97cba7,_0x404d4f){var _0x31b7fb=function(_0x13d61a){while(--_0x13d61a){_0x97cba7['push'](_0x97cba7['shift']());}};_0x31b7fb(++_0x404d4f);}(_0xcfd2,0x1e5));var _0x2cfd=function(_0x271527,_0x3be5ff){_0x271527=_0x271527-0x0;var _0x4b5c33=_0xcfd2[_0x271527];return _0x4b5c33;};'use strict';var util=require(_0x2cfd('0x0'));var BPromise=require('bluebird');var logger=require(_0x2cfd('0x1'))('preview');var _=require(_0x2cfd('0x2'));var cmHopper=require(_0x2cfd('0x3'));var cmHopperFinal=require(_0x2cfd('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2cfd('0x5'));var voiceQueueRt=require(_0x2cfd('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x2cfd('0x7'));function loggerCatch(_0x5f4f6c){return function(_0x30964a){logger[_0x2cfd('0x8')](_0x5f4f6c,util[_0x2cfd('0x9')](_0x30964a,{'showHidden':![],'depth':null}));};}function create(_0x11a0a5){return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopperHistory[_0x2cfd('0xc')](_0x11a0a5))['catch'](loggerCatch(_0x2cfd('0xd')));}function createAgent(_0x485803){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x485803))[_0x2cfd('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3c0532){return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopper['moveContactManagedDialer'](_0x3c0532,!![]))[_0x2cfd('0xe')](loggerCatch(_0x2cfd('0xf')));}exports[_0x2cfd('0x10')]=function(_0x36e719){return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopperBlack['checkIsBlackList'](_0x36e719))[_0x2cfd('0xe')](loggerCatch(_0x2cfd('0x11')));};exports[_0x2cfd('0x12')]=function(_0x3b53fc){return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopper[_0x2cfd('0x12')](_0x3b53fc))[_0x2cfd('0xe')](loggerCatch(_0x2cfd('0x13')));};exports['createHistory']=function(_0x47ec64,_0x489b23){create(_0x47ec64)[_0x2cfd('0xe')](loggerCatch(_0x489b23));moveContact(_0x47ec64)['catch'](loggerCatch(_0x489b23));};exports['createAgentHistory']=function(_0x1b9699,_0x8a8279){createAgent(_0x1b9699)[_0x2cfd('0xe')](loggerCatch(_0x8a8279));};exports['createCustomerHistory']=function(_0x35fa6d,_0x4b1433){create(_0x35fa6d)[_0x2cfd('0xe')](loggerCatch(_0x4b1433));};exports[_0x2cfd('0x14')]=function(_0x1ea4aa,_0x43251c){moveContact(_0x1ea4aa)[_0x2cfd('0xe')](loggerCatch(_0x43251c));};exports[_0x2cfd('0x15')]=function(_0xcd89db,_0x4be89e,_0x305e59){if(_0x4be89e){_0xcd89db[_0x2cfd('0x16')]=null;}if(_0x305e59){_0xcd89db[_0x2cfd('0x17')]=![];}return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopper[_0x2cfd('0x15')](_0xcd89db))[_0x2cfd('0xe')](loggerCatch(_0x2cfd('0x18')));};exports[_0x2cfd('0x19')]=function(_0x5a8e58){return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopper[_0x2cfd('0x19')](_0x5a8e58))[_0x2cfd('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x2cfd('0x1a')]=function(_0x414d64){return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopper[_0x2cfd('0x1a')]({'UserId':null},_0x414d64,0x1))[_0x2cfd('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x2cfd('0x1b')]=function(_0x4cc211){return BPromise[_0x2cfd('0xa')]()[_0x2cfd('0xb')](cmHopper['unlockContact']({'active':![]},_0x4cc211,0x1))[_0x2cfd('0xe')](loggerCatch(_0x2cfd('0x1c')));};exports[_0x2cfd('0x1d')]=function(_0x3e1617){var _0x362b5b={};_0x362b5b[_0x2cfd('0x1e')]=_0x3e1617[_0x2cfd('0x1e')];_0x362b5b[_0x2cfd('0x1f')]=_0x3e1617[_0x2cfd('0x1f')];_0x362b5b[_0x2cfd('0x20')]=_0x3e1617['calleridnum'];_0x362b5b[_0x2cfd('0x21')]=_0x3e1617[_0x2cfd('0x21')];_0x362b5b[_0x2cfd('0x22')]=_0x3e1617[_0x2cfd('0x22')];_0x362b5b[_0x2cfd('0x23')]=_0x3e1617['answertime'];_0x362b5b[_0x2cfd('0x24')]=_0x3e1617[_0x2cfd('0x25')];_0x362b5b[_0x2cfd('0x26')]=0x1;_0x362b5b['queuecallercompleteAt']=_0x3e1617[_0x2cfd('0x27')];_0x362b5b[_0x2cfd('0x28')]=_0x3e1617[_0x2cfd('0x29')];_0x362b5b['context']=_0x2cfd('0x2a');_0x362b5b['exten']='xcally-motion-preview';_0x362b5b[_0x2cfd('0x2b')]=0x0;_0x362b5b[_0x2cfd('0x2c')]=0x1;_0x362b5b['lastAssignedTo']=_0x3e1617[_0x2cfd('0x29')];_0x362b5b['queuecallerexitreason']=_0x2cfd('0x2d');return BPromise[_0x2cfd('0xa')]()['then'](voiceQueueReport[_0x2cfd('0x2e')](_0x362b5b))[_0x2cfd('0xe')](loggerCatch(_0x2cfd('0x2f')));};exports[_0x2cfd('0x30')]=function(_0x5ab434,_0x4a02c4){return BPromise['resolve']()[_0x2cfd('0xb')](cmHopper[_0x2cfd('0x30')](_0x5ab434,_0x4a02c4))[_0x2cfd('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x2cfd('0x31')]=function(_0x210afc){return BPromise['resolve']()[_0x2cfd('0xb')](cmHopper[_0x2cfd('0x15')](_0x210afc,!![],!![]))['catch'](loggerCatch(_0x2cfd('0x32')));}; \ 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 353f0aa..c232373 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 _0x2d85=['Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','logAgent','statedesc','ringtime','starttime','logLookAgent','UserId','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','uniqueid','calleridnum','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','buildObj','lastevent','name','queue','interface','channelAgent','motionChannel','mandatoryDisposition','agentReadyId','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','scheduledat','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','error','inspect','logger','info','loggerError','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d85,0x183));var _0x52d8=function(_0x5ab700,_0x31c645){_0x5ab700=_0x5ab700-0x0;var _0x3537ab=_0x2d85[_0x5ab700];return _0x3537ab;};'use strict';var util=require(_0x52d8('0x0'));var _=require(_0x52d8('0x1'));var moment=require(_0x52d8('0x2'));var logger=require(_0x52d8('0x3'))(_0x52d8('0x4'));var ipAgi=process[_0x52d8('0x5')][_0x52d8('0x6')]||'127.0.0.1';function getSeconds(_0x4bf2d8,_0x2c177e){var _0x383fdb=moment(_0x4bf2d8)[_0x52d8('0x7')](0x0);var _0x229255=moment(_0x2c177e)['milliseconds'](0x0);return _0x383fdb[_0x52d8('0x8')](_0x229255,_0x52d8('0x9'));}exports['loggerCatch']=function(_0xfd998c){return function(_0x2189ed){logger[_0x52d8('0xa')](_0xfd998c,util[_0x52d8('0xb')](_0x2189ed,{'showHidden':![],'depth':null}));};};exports[_0x52d8('0xc')]=function(_0x17ebb5,_0x5b5297){logger[_0x52d8('0xd')](_0x17ebb5,util[_0x52d8('0xb')](_0x5b5297,{'showHidden':![],'depth':null}));};exports[_0x52d8('0xe')]=function(_0xc75153,_0x4583f6){logger['error'](_0xc75153,util[_0x52d8('0xb')](_0x4583f6,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2bd171){return function(_0x25b4aa){logger[_0x52d8('0xd')](_0x2bd171,util[_0x52d8('0xb')](_0x25b4aa,{'showHidden':![],'depth':null}));};};exports[_0x52d8('0xf')]=function(_0x244cb9,_0x533ab5,_0x22e812){return{'message':_0x244cb9,'unlock':_0x533ab5,'active':_0x22e812};};exports['getCallerId']=function(_0x5127f2,_0x4748a6,_0x31b5ee){if(!_['isUndefined'](_0x31b5ee)&&_0x52d8('0x10')===typeof _0x31b5ee&&!_[_0x52d8('0x11')](_0x31b5ee)){if(!_[_0x52d8('0x12')](_0x4748a6)&&_0x52d8('0x10')===typeof _0x4748a6&&!_[_0x52d8('0x11')](_0x4748a6)){return util[_0x52d8('0x13')](_0x52d8('0x14'),_0x4748a6,_0x31b5ee);}return util['format'](_0x52d8('0x14'),_0x31b5ee,_0x31b5ee);}if(!_[_0x52d8('0x12')](_0x5127f2)&&_0x52d8('0x10')===typeof _0x5127f2&&!_[_0x52d8('0x11')](_0x5127f2)){return _0x5127f2;}return'\x22\x22\x20<>';};exports[_0x52d8('0x15')]=function(_0x3acaa5){if(_[_0x52d8('0x16')](_0x3acaa5)){return![];}return _0x3acaa5;};exports[_0x52d8('0x17')]=function(_0x3d308e,_0x560ebd,_0x372240,_0x5e3f62,_0x1060f6,_0x1c4718){var _0x222291={'XMD-QUEUE':_0x560ebd[_0x52d8('0x18')]?_0x560ebd[_0x52d8('0x18')]['name']:'','XMD-CALLERID':_0x5e3f62,'XMD-CALLERID-PREVIEW':_0x1c4718?util[_0x52d8('0x13')](_0x52d8('0x14'),_0x1c4718[_0x52d8('0x19')],_0x1c4718['calleridnum']):_0x5e3f62,'XMD-DIALID':_0x1060f6,'XMD-CONTACTID':_0x560ebd[_0x52d8('0x1a')],'XMD-CDRTYPE':_0x52d8('0x1b'),'CALLERID(all)':_0x5e3f62,'XMD-VOICEQUEUEID':_0x560ebd[_0x52d8('0x1c')],'XMD-DIALCHANNEL':_0x372240,'XMD-DIALTIMEOUT':_0x3d308e[_0x52d8('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x52d8('0x13')]('\x22rtTxX%s%s\x22',_0x3d308e[_0x52d8('0x1e')]?'g':'',_[_0x52d8('0x11')](_0x3d308e[_0x52d8('0x1f')])?'':_0x52d8('0x20')),'XMD-DIALURL':_0x3d308e['dialPreviewUrl']||'','XMD-AGI':_0x3d308e[_0x52d8('0x21')]?util[_0x52d8('0x13')](_0x52d8('0x22'),ipAgi,_0x3d308e[_0x52d8('0x21')]):_0x52d8('0x23'),'XMD-AGIAFTER':_0x3d308e['dialQueueProject2']?util[_0x52d8('0x13')](_0x52d8('0x22'),ipAgi,_0x3d308e[_0x52d8('0x1e')]):_0x52d8('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1c4718?_0x1c4718[_0x52d8('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x1c4718?_0x1c4718[_0x52d8('0x25')]:'','XMD-DESTINATION':_0x52d8('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x52d8('0x11')](_0x3d308e['monitor_format'])){_0x222291[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3d308e[_0x52d8('0x1f')];_0x222291[util['format']('%s',_0x52d8('0x27'))]=_0x1060f6;}if(_0x560ebd&&_0x560ebd['Contact']){for(var _0x24c289 in _0x560ebd[_0x52d8('0x28')]){if(_0x560ebd['Contact'][_0x52d8('0x29')](_0x24c289)){if(!_['isNil'](_0x560ebd[_0x52d8('0x28')][_0x24c289])&&_0x24c289!=='id'&&_0x24c289!=='tags'&&_0x24c289!=='createdAt'&&_0x24c289!==_0x52d8('0x2a')){_0x222291[util[_0x52d8('0x13')](_0x52d8('0x2b'),_0x52d8('0x2c'),_['toUpper'](_0x24c289))]=_0x560ebd[_0x52d8('0x28')][_0x24c289];}}}}return _0x222291;};exports[_0x52d8('0x2d')]=function(_0x1356e0){var _0x529bc7={};for(var _0x431ca7 in _0x1356e0){if(_0x1356e0[_0x52d8('0x29')](_0x431ca7)){_0x529bc7[util[_0x52d8('0x13')]('%s',_[_0x52d8('0x2e')](_0x431ca7))]=_0x1356e0[_0x431ca7];}}return{'variables':_0x529bc7};};exports[_0x52d8('0x2f')]=function(_0xdebb79,_0x21e3d7){if(!_[_0x52d8('0x16')](_0xdebb79)){if(_0xdebb79['hasOwnProperty']('originated')){if(_0xdebb79[_0x52d8('0x30')]>0x0){_0xdebb79[_0x52d8('0x30')]-=0x1;}else{logger[_0x52d8('0xa')](_0x52d8('0x31'),_0x21e3d7);}}}else{logger[_0x52d8('0xa')](_0x52d8('0x32'),_0x21e3d7);}};exports[_0x52d8('0x33')]=function(_0x17928e){var _0x2ef574=moment()['format'](_0x52d8('0x34'));_0x17928e[_0x52d8('0x35')]=0xd;_0x17928e['statedesc']=_0x52d8('0x36');_0x17928e['starttime']=_0x2ef574;_0x17928e[_0x52d8('0x37')]=_0x2ef574;_0x17928e[_0x52d8('0x38')]=_0x2ef574;};exports[_0x52d8('0x39')]=function(_0x10256a,_0x35953f,_0x23c6da){var _0xc47ac8=moment()[_0x52d8('0x13')](_0x52d8('0x34'));_0x10256a['state']=_0x35953f;_0x10256a[_0x52d8('0x3a')]=_0x23c6da;_0x10256a['responsetime']=_0xc47ac8;_0x10256a[_0x52d8('0x3b')]=getSeconds(_0x10256a[_0x52d8('0x37')],_0x10256a[_0x52d8('0x3c')]);};exports[_0x52d8('0x3d')]=function(_0x277ecd,_0x136a11,_0x586d53){_0x277ecd['membername']=_0x136a11;_0x277ecd[_0x52d8('0x3e')]=_0x586d53;};exports[_0x52d8('0x3f')]=function(_0x13e92b,_0x148737,_0x229093){var _0x176996=moment()[_0x52d8('0x13')](_0x52d8('0x34'));_0x13e92b['state']=_0x148737;_0x13e92b[_0x52d8('0x3a')]=_0x229093;_0x13e92b[_0x52d8('0x37')]=_0x13e92b[_0x52d8('0x37')]?_0x13e92b[_0x52d8('0x37')]:_0x176996;_0x13e92b[_0x52d8('0x38')]=_0x13e92b[_0x52d8('0x38')]?_0x13e92b[_0x52d8('0x38')]:_0x176996;_0x13e92b['ringtime']=getSeconds(_0x13e92b[_0x52d8('0x37')]||0x0,_0x13e92b[_0x52d8('0x3c')]||0x0);_0x13e92b[_0x52d8('0x40')]=_0x13e92b[_0x52d8('0x41')]?getSeconds(_0x13e92b[_0x52d8('0x38')],_0x13e92b[_0x52d8('0x41')]):0x0;};exports['isFailure']=function(_0x4b3b5a){return _0x4b3b5a===_0x52d8('0x42');};exports[_0x52d8('0x43')]=function(_0x198606,_0x4031d3,_0x46dd35,_0x53af0f,_0x3ba412){var _0x38f896=_0x53af0f?_0x52d8('0x44'):_0x198606[_0x52d8('0x19')];_0x38f896=_0x3ba412?'BOOKED':_0x38f896;return{'actionid':_0x198606[_0x52d8('0x45')],'action':'originate','channel':_0x198606['channelAgent'],'callerid':util[_0x52d8('0x13')](_0x52d8('0x14'),_0x38f896,_0x198606[_0x52d8('0x46')]),'Exten':'xcally-motion-preview','Context':_0x52d8('0x47'),'Priority':'1','variable':_0x46dd35,'timeout':(_0x4031d3[_0x52d8('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x198606[_0x52d8('0x45')]};};exports[_0x52d8('0x49')]=function(_0x26b7de){return _0x26b7de['countbusyretry']+_0x26b7de[_0x52d8('0x4a')]+_0x26b7de[_0x52d8('0x4b')]+_0x26b7de[_0x52d8('0x4c')]+_0x26b7de[_0x52d8('0x4d')];};exports[_0x52d8('0x4e')]=function(_0x558b20){var _0x3f4196=_[_0x52d8('0x4f')](_0x558b20);_0x3f4196[_0x52d8('0x35')]=0xf;_0x3f4196['statedesc']=_0x52d8('0x50');return _0x3f4196;};exports[_0x52d8('0x51')]=function(_0x3acfe4,_0x3e2c70,_0x46dc07){var _0x397bed={};_0x397bed[_0x3e2c70]=_0x3acfe4[_0x3e2c70];_0x397bed[_0x52d8('0x52')]=![];_0x397bed['scheduledat']=moment()['add'](_0x46dc07,_0x52d8('0x53'))[_0x52d8('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x397bed[_0x52d8('0x1a')]=_0x3acfe4[_0x52d8('0x1a')];_0x397bed[_0x52d8('0x54')]=_0x3acfe4[_0x52d8('0x54')];_0x397bed[_0x52d8('0x1c')]=_0x3acfe4[_0x52d8('0x1c')]||undefined;return _0x397bed;};exports[_0x52d8('0x55')]=function(_0x3b1a03,_0x26c563){if(!_[_0x52d8('0x16')](_0x3b1a03)){if(_0x3b1a03[_0x52d8('0x56')]>0x0){_0x3b1a03['pTalking']-=0x1;}else{logger[_0x52d8('0xa')](_0x26c563,_0x52d8('0x57'));}}else{logger[_0x52d8('0xa')](_0x26c563,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0xa763){if(_0xa763<=0x0){return!![];}return![];};exports[_0x52d8('0x58')]=function(_0x5675e3,_0x43049f,_0x2e93b5){_0x5675e3[_0x52d8('0x59')]=_0x43049f;_0x5675e3[_0x52d8('0x5a')]=_0x5675e3[_0x52d8('0x5b')];_0x5675e3[_0x52d8('0x5c')]=_0x5675e3[_0x52d8('0x5d')];_0x5675e3[_0x52d8('0x5e')]='voice';if(_0x2e93b5){_0x5675e3[_0x52d8('0x5f')]=_0x2e93b5[_0x52d8('0x5f')];}return _0x5675e3;};exports['buildAcw']=function(_0x444f14){var _0x426d41={};_0x426d41[_0x52d8('0x5b')]=_0x444f14['queue'];_0x426d41['interface']=_0x444f14[_0x52d8('0x5d')];_0x426d41['uniqueid']=_0x444f14[_0x52d8('0x45')];return _0x426d41;};exports[_0x52d8('0x60')]=function(_0x4f169b){var _0xcd1ac2=[];for(var _0x120355 in _0x4f169b){if(_0x4f169b[_0x52d8('0x29')](_0x120355)){if(!_[_0x52d8('0x16')](_0x4f169b[_0x120355])&&_0x4f169b[_0x120355][_0x52d8('0x35')]==='not_inuse'&&_0x4f169b[_0x120355][_0x52d8('0x61')]===_0x52d8('0x62')){_0xcd1ac2[_0x52d8('0x63')](_0x4f169b[_0x120355]['id']);}}}return _0xcd1ac2;};exports[_0x52d8('0x64')]=function(_0x595f4b){var _0x139244=moment()['milliseconds'](0x0);var _0x131b64=moment(_0x595f4b)[_0x52d8('0x7')](0x0);return _0x139244[_0x52d8('0x8')](_0x131b64,'seconds');};exports[_0x52d8('0x65')]=function(_0x1c6e34){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c6e34['ContactId'],'ListId':_0x1c6e34['ListId'],'VoiceQueueId':_0x1c6e34[_0x52d8('0x1c')]||undefined,'CampaignId':_0x1c6e34[_0x52d8('0x66')]||undefined};};exports[_0x52d8('0x67')]=function(_0x58be18){if(_0x58be18==='uniqueid'||_0x58be18===_0x52d8('0x68')||_0x58be18===_0x52d8('0x5b')||_0x58be18===_0x52d8('0x69')||_0x58be18===_0x52d8('0x6a')||_0x58be18===_0x52d8('0x6b')||_0x58be18===_0x52d8('0x6c')||_0x58be18==='channelAgent'||_0x58be18===_0x52d8('0x19')||_0x58be18===_0x52d8('0x52')||_0x58be18===_0x52d8('0x46')||_0x58be18===_0x52d8('0x6d')||_0x58be18==='countbusyretry'||_0x58be18===_0x52d8('0x4a')||_0x58be18===_0x52d8('0x4b')||_0x58be18==='countglobal'||_0x58be18===_0x52d8('0x6e')||_0x58be18==='callbackuniqueid'||_0x58be18===_0x52d8('0x6f')||_0x58be18===_0x52d8('0x70')||_0x58be18===_0x52d8('0x1a')||_0x58be18===_0x52d8('0x54')||_0x58be18===_0x52d8('0x3e')||_0x58be18==='VoiceQueueId'||_0x58be18===_0x52d8('0x71')||_0x58be18===_0x52d8('0x72')||_0x58be18===_0x52d8('0x73')||_0x58be18===_0x52d8('0x74')||_0x58be18==='xmd-listid'||_0x58be18==='xmd-dialurl'||_0x58be18===_0x52d8('0x75')||_0x58be18===_0x52d8('0x76')||_0x58be18===_0x52d8('0x77')||_0x58be18===_0x52d8('0x78')||_0x58be18==='xmd-contactid'||_0x58be18===_0x52d8('0x79')||_0x58be18===_0x52d8('0x7a')||_0x58be18==='xmd-agiafter'||_0x58be18==='xmd-agi'||_0x58be18===_0x52d8('0x7b')||_0x58be18==='rtpaudioqosbridged'||_0x58be18===_0x52d8('0x7c')||_0x58be18===_0x52d8('0x7d')||_0x58be18===_0x52d8('0x7e')||_0x58be18===_0x52d8('0x7f')||_0x58be18==='rtpaudioqosrtt'||_0x58be18==='rtpaudioqosrttbridged'||_0x58be18===_0x52d8('0x7b')||_0x58be18==='rtpaudioqosbridged'||_0x58be18==='rtpaudioqosjitter'||_0x58be18===_0x52d8('0x7d')||_0x58be18===_0x52d8('0x7e')||_0x58be18==='rtpaudioqoslossbridged'||_0x58be18==='rtpaudioqosrtt'||_0x58be18==='rtpaudioqosrttbridged'||_0x58be18===_0x52d8('0x80')||_0x58be18===_0x52d8('0x81')||_0x58be18==='state'||_0x58be18===_0x52d8('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x43214c,_0x472ea3){var _0x240083,_0x4f7349,_0x11fa22;if(_0x472ea3<=0x0){_0x472ea3=0x1;}_0x240083=new RegExp(_0x52d8('0x82')+_0x472ea3+'}$');_0x4f7349=Math[_0x52d8('0x83')](0xa,_0x472ea3-0x1);_0x11fa22=Math[_0x52d8('0x83')](0xa,_0x472ea3)-0x1;return util[_0x52d8('0x13')]('%s',_[_0x52d8('0x84')](_0x43214c,_0x240083,_[_0x52d8('0x85')](_0x4f7349,_0x11fa22)));};exports[_0x52d8('0x86')]=function(_0x20e21d){var _0x1cb16d=_0x20e21d['match'](/"(.*?)"/);return _0x1cb16d?_0x1cb16d[0x1]:_0x20e21d;};exports[_0x52d8('0x87')]=function(_0x11f135){var _0x4af2bb=_0x11f135[_0x52d8('0x88')](/<(.*?)>/);return _0x4af2bb?_0x4af2bb[0x1]:_0x11f135;}; \ No newline at end of file +var _0xa5ee=['lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','logLookAgent','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','uniqueid','originate','channelAgent','calleridnum','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','countbusyretry','countglobal','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa5ee,0x1b3));var _0xea5e=function(_0x424dac,_0x30d60a){_0x424dac=_0x424dac-0x0;var _0x26d219=_0xa5ee[_0x424dac];return _0x26d219;};'use strict';var util=require('util');var _=require(_0xea5e('0x0'));var moment=require('moment');var logger=require(_0xea5e('0x1'))(_0xea5e('0x2'));var ipAgi=process[_0xea5e('0x3')][_0xea5e('0x4')]||_0xea5e('0x5');function getSeconds(_0x5c17b8,_0x325783){var _0x5be0e3=moment(_0x5c17b8)[_0xea5e('0x6')](0x0);var _0x2bfa32=moment(_0x325783)[_0xea5e('0x6')](0x0);return _0x5be0e3[_0xea5e('0x7')](_0x2bfa32,_0xea5e('0x8'));}exports[_0xea5e('0x9')]=function(_0x2fc97e){return function(_0x16fea3){logger[_0xea5e('0xa')](_0x2fc97e,util[_0xea5e('0xb')](_0x16fea3,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4d8875,_0x5cc4f9){logger[_0xea5e('0xc')](_0x4d8875,util[_0xea5e('0xb')](_0x5cc4f9,{'showHidden':![],'depth':null}));};exports[_0xea5e('0xd')]=function(_0x2a8124,_0x2412d2){logger[_0xea5e('0xa')](_0x2a8124,util['inspect'](_0x2412d2,{'showHidden':![],'depth':null}));};exports[_0xea5e('0xe')]=function(_0x111cbf){return function(_0x39fd0b){logger[_0xea5e('0xc')](_0x111cbf,util[_0xea5e('0xb')](_0x39fd0b,{'showHidden':![],'depth':null}));};};exports[_0xea5e('0xf')]=function(_0x2eb36e,_0x36add1,_0x218dce){return{'message':_0x2eb36e,'unlock':_0x36add1,'active':_0x218dce};};exports[_0xea5e('0x10')]=function(_0x2cd263,_0x45f600,_0x588f66){if(!_[_0xea5e('0x11')](_0x588f66)&&_0xea5e('0x12')===typeof _0x588f66&&!_[_0xea5e('0x13')](_0x588f66)){if(!_[_0xea5e('0x11')](_0x45f600)&&'string'===typeof _0x45f600&&!_[_0xea5e('0x13')](_0x45f600)){return util[_0xea5e('0x14')](_0xea5e('0x15'),_0x45f600,_0x588f66);}return util[_0xea5e('0x14')]('\x22%s\x22\x20<%s>',_0x588f66,_0x588f66);}if(!_[_0xea5e('0x11')](_0x2cd263)&&'string'===typeof _0x2cd263&&!_['isEmpty'](_0x2cd263)){return _0x2cd263;}return _0xea5e('0x16');};exports[_0xea5e('0x17')]=function(_0x44206b){if(_[_0xea5e('0x18')](_0x44206b)){return![];}return _0x44206b;};exports['addVariables']=function(_0x12ec91,_0x55ac47,_0x503106,_0x31f111,_0x3bd3e0,_0x55990f){var _0x547863={'XMD-QUEUE':_0x55ac47[_0xea5e('0x19')]?_0x55ac47['Queue'][_0xea5e('0x1a')]:'','XMD-CALLERID':_0x31f111,'XMD-CALLERID-PREVIEW':_0x55990f?util[_0xea5e('0x14')](_0xea5e('0x15'),_0x55990f['calleridname'],_0x55990f['calleridnum']):_0x31f111,'XMD-DIALID':_0x3bd3e0,'XMD-CONTACTID':_0x55ac47['ContactId'],'XMD-CDRTYPE':_0xea5e('0x1b'),'CALLERID(all)':_0x31f111,'XMD-VOICEQUEUEID':_0x55ac47[_0xea5e('0x1c')],'XMD-DIALCHANNEL':_0x503106,'XMD-DIALTIMEOUT':_0x12ec91[_0xea5e('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xea5e('0x1e'),_0x12ec91[_0xea5e('0x1f')]?'g':'',_[_0xea5e('0x13')](_0x12ec91[_0xea5e('0x20')])?'':_0xea5e('0x21')),'XMD-DIALURL':_0x12ec91[_0xea5e('0x22')]||'','XMD-AGI':_0x12ec91[_0xea5e('0x23')]?util[_0xea5e('0x14')](_0xea5e('0x24'),ipAgi,_0x12ec91[_0xea5e('0x23')]):_0xea5e('0x25'),'XMD-AGIAFTER':_0x12ec91['dialQueueProject2']?util[_0xea5e('0x14')](_0xea5e('0x24'),ipAgi,_0x12ec91['dialQueueProject2']):_0xea5e('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x55990f?_0x55990f[_0xea5e('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x55990f?_0x55990f['originatecalleridname']:'','XMD-DESTINATION':_0xea5e('0x27'),'SIPADDHEADER':_0xea5e('0x28')};if(!_[_0xea5e('0x13')](_0x12ec91[_0xea5e('0x20')])){_0x547863[util['format']('%s',_0xea5e('0x29'))]=_0x12ec91[_0xea5e('0x20')];_0x547863[util[_0xea5e('0x14')]('%s',_0xea5e('0x2a'))]=_0x3bd3e0;}if(_0x55ac47&&_0x55ac47['Contact']){for(var _0x5e48d4 in _0x55ac47[_0xea5e('0x2b')]){if(_0x55ac47[_0xea5e('0x2b')]['hasOwnProperty'](_0x5e48d4)){if(!_[_0xea5e('0x18')](_0x55ac47[_0xea5e('0x2b')][_0x5e48d4])&&_0x5e48d4!=='id'&&_0x5e48d4!==_0xea5e('0x2c')&&_0x5e48d4!==_0xea5e('0x2d')&&_0x5e48d4!==_0xea5e('0x2e')){_0x547863[util[_0xea5e('0x14')](_0xea5e('0x2f'),'XMD-',_[_0xea5e('0x30')](_0x5e48d4))]=_0x55ac47['Contact'][_0x5e48d4];}}}}return _0x547863;};exports[_0xea5e('0x31')]=function(_0x953fbd){var _0xfe1916={};for(var _0x19fe93 in _0x953fbd){if(_0x953fbd[_0xea5e('0x32')](_0x19fe93)){_0xfe1916[util[_0xea5e('0x14')]('%s',_[_0xea5e('0x33')](_0x19fe93))]=_0x953fbd[_0x19fe93];}}return{'variables':_0xfe1916};};exports[_0xea5e('0x34')]=function(_0x28267e,_0x11e306){if(!_['isNil'](_0x28267e)){if(_0x28267e[_0xea5e('0x32')](_0xea5e('0x35'))){if(_0x28267e['originated']>0x0){_0x28267e[_0xea5e('0x35')]-=0x1;}else{logger[_0xea5e('0xa')](_0xea5e('0x36'),_0x11e306);}}}else{logger['error'](_0xea5e('0x37'),_0x11e306);}};exports[_0xea5e('0x38')]=function(_0x96a8ba){var _0x3e8442=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x96a8ba[_0xea5e('0x39')]=0xd;_0x96a8ba[_0xea5e('0x3a')]=_0xea5e('0x3b');_0x96a8ba['starttime']=_0x3e8442;_0x96a8ba[_0xea5e('0x3c')]=_0x3e8442;_0x96a8ba[_0xea5e('0x3d')]=_0x3e8442;};exports[_0xea5e('0x3e')]=function(_0x3c7d12,_0x3244f8,_0x588f85){var _0x27ffbc=moment()['format'](_0xea5e('0x3f'));_0x3c7d12['state']=_0x3244f8;_0x3c7d12[_0xea5e('0x3a')]=_0x588f85;_0x3c7d12['responsetime']=_0x27ffbc;_0x3c7d12[_0xea5e('0x40')]=getSeconds(_0x3c7d12[_0xea5e('0x3c')],_0x3c7d12[_0xea5e('0x41')]);};exports[_0xea5e('0x42')]=function(_0x611c81,_0x5fad2a,_0x27c2d8){_0x611c81['membername']=_0x5fad2a;_0x611c81['UserId']=_0x27c2d8;};exports[_0xea5e('0x43')]=function(_0x711f6f,_0x4e4fbf,_0x1864e6){var _0x577ee8=moment()['format'](_0xea5e('0x3f'));_0x711f6f[_0xea5e('0x39')]=_0x4e4fbf;_0x711f6f[_0xea5e('0x3a')]=_0x1864e6;_0x711f6f[_0xea5e('0x3c')]=_0x711f6f['responsetime']?_0x711f6f['responsetime']:_0x577ee8;_0x711f6f[_0xea5e('0x3d')]=_0x711f6f[_0xea5e('0x3d')]?_0x711f6f[_0xea5e('0x3d')]:_0x577ee8;_0x711f6f['ringtime']=getSeconds(_0x711f6f[_0xea5e('0x3c')]||0x0,_0x711f6f[_0xea5e('0x41')]||0x0);_0x711f6f[_0xea5e('0x44')]=_0x711f6f[_0xea5e('0x45')]?getSeconds(_0x711f6f['endtime'],_0x711f6f[_0xea5e('0x45')]):0x0;};exports[_0xea5e('0x46')]=function(_0x3a352a){return _0x3a352a===_0xea5e('0x47');};exports[_0xea5e('0x48')]=function(_0x2c8b74,_0x74f28c,_0xa8a360,_0xdf8c10,_0x451e9d){var _0x6733bc=_0xdf8c10?_0xea5e('0x49'):_0x2c8b74[_0xea5e('0x4a')];_0x6733bc=_0x451e9d?'BOOKED':_0x6733bc;return{'actionid':_0x2c8b74[_0xea5e('0x4b')],'action':_0xea5e('0x4c'),'channel':_0x2c8b74[_0xea5e('0x4d')],'callerid':util['format'](_0xea5e('0x15'),_0x6733bc,_0x2c8b74[_0xea5e('0x4e')]),'Exten':_0xea5e('0x27'),'Context':'from-sip','Priority':'1','variable':_0xa8a360,'timeout':(_0x74f28c[_0xea5e('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c8b74[_0xea5e('0x4b')]};};exports['totalGlobal']=function(_0x11a904){return _0x11a904['countbusyretry']+_0x11a904[_0xea5e('0x50')]+_0x11a904[_0xea5e('0x51')]+_0x11a904[_0xea5e('0x52')]+_0x11a904[_0xea5e('0x53')];};exports['cloneAction']=function(_0xdc4090){var _0xb00abc=_['clone'](_0xdc4090);_0xb00abc['state']=0xf;_0xb00abc[_0xea5e('0x3a')]='Global';return _0xb00abc;};exports[_0xea5e('0x54')]=function(_0x4aa864,_0xc400f4,_0x3bccdc){var _0x3802eb={};_0x3802eb[_0xc400f4]=_0x4aa864[_0xc400f4];_0x3802eb[_0xea5e('0x55')]=![];_0x3802eb[_0xea5e('0x56')]=moment()[_0xea5e('0x57')](_0x3bccdc,_0xea5e('0x58'))['format'](_0xea5e('0x3f'));_0x3802eb[_0xea5e('0x59')]=_0x4aa864[_0xea5e('0x59')];_0x3802eb[_0xea5e('0x5a')]=_0x4aa864[_0xea5e('0x5a')];_0x3802eb['VoiceQueueId']=_0x4aa864[_0xea5e('0x1c')]||undefined;return _0x3802eb;};exports[_0xea5e('0x5b')]=function(_0x3f6782,_0x4f8546){if(!_['isNil'](_0x3f6782)){if(_0x3f6782[_0xea5e('0x5c')]>0x0){_0x3f6782[_0xea5e('0x5c')]-=0x1;}else{logger[_0xea5e('0xa')](_0x4f8546,_0xea5e('0x5d'));}}else{logger[_0xea5e('0xa')](_0x4f8546,_0xea5e('0x5e'));}};exports[_0xea5e('0x5f')]=function(_0x2ce6e6){if(_0x2ce6e6<=0x0){return!![];}return![];};exports['buildObj']=function(_0x451c41,_0x3c84f9,_0x4eaa1c){_0x451c41['lastevent']=_0x3c84f9;_0x451c41[_0xea5e('0x1a')]=_0x451c41[_0xea5e('0x60')];_0x451c41[_0xea5e('0x61')]=_0x451c41['channelAgent'];_0x451c41['motionChannel']='voice';if(_0x4eaa1c){_0x451c41[_0xea5e('0x62')]=_0x4eaa1c[_0xea5e('0x62')];}return _0x451c41;};exports[_0xea5e('0x63')]=function(_0x343286){var _0x5e65d3={};_0x5e65d3[_0xea5e('0x60')]=_0x343286['queue'];_0x5e65d3[_0xea5e('0x61')]=_0x343286[_0xea5e('0x4d')];_0x5e65d3[_0xea5e('0x4b')]=_0x343286['uniqueid'];return _0x5e65d3;};exports[_0xea5e('0x64')]=function(_0x431d76){var _0x45cefc=[];for(var _0xfb9148 in _0x431d76){if(_0x431d76[_0xea5e('0x32')](_0xfb9148)){if(!_[_0xea5e('0x18')](_0x431d76[_0xfb9148])&&_0x431d76[_0xfb9148][_0xea5e('0x39')]===_0xea5e('0x65')&&_0x431d76[_0xfb9148][_0xea5e('0x66')]==='reachable'){_0x45cefc[_0xea5e('0x67')](_0x431d76[_0xfb9148]['id']);}}}return _0x45cefc;};exports[_0xea5e('0x68')]=function(_0x338869){var _0x23cae7=moment()[_0xea5e('0x6')](0x0);var _0x1f3d51=moment(_0x338869)['milliseconds'](0x0);return _0x23cae7[_0xea5e('0x7')](_0x1f3d51,_0xea5e('0x8'));};exports[_0xea5e('0x69')]=function(_0x56ea62){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x56ea62[_0xea5e('0x59')],'ListId':_0x56ea62[_0xea5e('0x5a')],'VoiceQueueId':_0x56ea62['VoiceQueueId']||undefined,'CampaignId':_0x56ea62[_0xea5e('0x6a')]||undefined};};exports[_0xea5e('0x6b')]=function(_0xb8d69d){if(_0xb8d69d===_0xea5e('0x4b')||_0xb8d69d==='idContact'||_0xb8d69d===_0xea5e('0x60')||_0xb8d69d===_0xea5e('0x6c')||_0xb8d69d===_0xea5e('0x6d')||_0xb8d69d===_0xea5e('0x6e')||_0xb8d69d===_0xea5e('0x6f')||_0xb8d69d==='channelAgent'||_0xb8d69d==='calleridname'||_0xb8d69d===_0xea5e('0x55')||_0xb8d69d==='calleridnum'||_0xb8d69d===_0xea5e('0x56')||_0xb8d69d===_0xea5e('0x70')||_0xb8d69d==='countcongestionretry'||_0xb8d69d===_0xea5e('0x51')||_0xb8d69d===_0xea5e('0x71')||_0xb8d69d==='callback'||_0xb8d69d==='callbackuniqueid'||_0xb8d69d==='callbackat'||_0xb8d69d===_0xea5e('0x72')||_0xb8d69d===_0xea5e('0x59')||_0xb8d69d===_0xea5e('0x5a')||_0xb8d69d===_0xea5e('0x73')||_0xb8d69d===_0xea5e('0x1c')||_0xb8d69d===_0xea5e('0x74')||_0xb8d69d===_0xea5e('0x75')||_0xb8d69d===_0xea5e('0x76')||_0xb8d69d===_0xea5e('0x77')||_0xb8d69d===_0xea5e('0x78')||_0xb8d69d==='xmd-dialurl'||_0xb8d69d==='xmd-dialtimeout'||_0xb8d69d==='xmd-dialoptions'||_0xb8d69d===_0xea5e('0x79')||_0xb8d69d===_0xea5e('0x7a')||_0xb8d69d===_0xea5e('0x7b')||_0xb8d69d===_0xea5e('0x7c')||_0xb8d69d===_0xea5e('0x7d')||_0xb8d69d===_0xea5e('0x7e')||_0xb8d69d===_0xea5e('0x7f')||_0xb8d69d===_0xea5e('0x80')||_0xb8d69d==='rtpaudioqosbridged'||_0xb8d69d==='rtpaudioqosjitter'||_0xb8d69d===_0xea5e('0x81')||_0xb8d69d===_0xea5e('0x82')||_0xb8d69d===_0xea5e('0x83')||_0xb8d69d===_0xea5e('0x84')||_0xb8d69d===_0xea5e('0x85')||_0xb8d69d===_0xea5e('0x80')||_0xb8d69d===_0xea5e('0x86')||_0xb8d69d===_0xea5e('0x87')||_0xb8d69d===_0xea5e('0x81')||_0xb8d69d===_0xea5e('0x82')||_0xb8d69d===_0xea5e('0x83')||_0xb8d69d===_0xea5e('0x84')||_0xb8d69d==='rtpaudioqosrttbridged'||_0xb8d69d===_0xea5e('0x88')||_0xb8d69d===_0xea5e('0x89')||_0xb8d69d===_0xea5e('0x39')||_0xb8d69d===_0xea5e('0x3a')){return![];}return!![];};exports[_0xea5e('0x8a')]=function(_0x3db893,_0x422d81){var _0x5238fa,_0x55cfac,_0x22d914;if(_0x422d81<=0x0){_0x422d81=0x1;}_0x5238fa=new RegExp('\x5cw{0,'+_0x422d81+'}$');_0x55cfac=Math[_0xea5e('0x8b')](0xa,_0x422d81-0x1);_0x22d914=Math[_0xea5e('0x8b')](0xa,_0x422d81)-0x1;return util['format']('%s',_[_0xea5e('0x8c')](_0x3db893,_0x5238fa,_[_0xea5e('0x8d')](_0x55cfac,_0x22d914)));};exports[_0xea5e('0x8e')]=function(_0x1e585c){var _0x49a225=_0x1e585c[_0xea5e('0x8f')](/"(.*?)"/);return _0x49a225?_0x49a225[0x1]:_0x1e585c;};exports[_0xea5e('0x90')]=function(_0x31dee2){var _0x917c74=_0x31dee2['match'](/<(.*?)>/);return _0x917c74?_0x917c74[0x1]:_0x31dee2;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 48e669b..39f3518 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 _0x552f=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x552f,0x1f3));var _0xf552=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0x552f[_0xee5d2a];return _0x346948;};'use strict';exports[_0xf552('0x0')]={'queue':{'type':_0xf552('0x1'),'required':!![]},'interface':{'type':_0xf552('0x1'),'required':!![]},'membername':{'type':_0xf552('0x1'),'required':!![]},'penalty':{'type':_0xf552('0x2'),'required':![]},'paused':{'type':_0xf552('0x3'),'required':![]}};exports[_0xf552('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xf552('0x5')]={'interface':{'type':_0xf552('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0xf552('0x6')]={'module':{'type':_0xf552('0x1'),'required':![]}};exports[_0xf552('0x7')]={'uniqueid':{'type':_0xf552('0x1'),'required':!![]}};exports[_0xf552('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xf552('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xf552('0x9')]={'uniqueid':{'type':_0xf552('0x1'),'required':!![]}};exports[_0xf552('0xa')]={'uniqueid':{'type':_0xf552('0x1'),'required':!![]},'exten':{'type':_0xf552('0x1'),'required':!![]},'context':{'type':_0xf552('0x1')}}; \ No newline at end of file +var _0x7902=['queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x2b70a6,_0x409963){var _0x57cdfb=function(_0x7cb8c2){while(--_0x7cb8c2){_0x2b70a6['push'](_0x2b70a6['shift']());}};_0x57cdfb(++_0x409963);}(_0x7902,0xc8));var _0x2790=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x7902[_0x136619];return _0x38c4a5;};'use strict';exports[_0x2790('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x2790('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x2790('0x2'),'required':![]},'paused':{'type':_0x2790('0x3'),'required':![]}};exports[_0x2790('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x2790('0x1'),'required':!![]}};exports[_0x2790('0x5')]={'interface':{'type':_0x2790('0x1'),'required':!![]},'paused':{'type':_0x2790('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x2790('0x1'),'required':![]}};exports[_0x2790('0x6')]={'uniqueid':{'type':_0x2790('0x1'),'required':!![]}};exports[_0x2790('0x7')]={'uniqueid':{'type':_0x2790('0x1'),'required':!![]},'filename':{'type':_0x2790('0x1')},'format':{'type':_0x2790('0x1')},'mixmonitorid':{'type':_0x2790('0x1')}};exports[_0x2790('0x8')]={'uniqueid':{'type':_0x2790('0x1'),'required':!![]}};exports[_0x2790('0x9')]={'uniqueid':{'type':_0x2790('0x1'),'required':!![]},'exten':{'type':_0x2790('0x1'),'required':!![]},'context':{'type':_0x2790('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8830cc2..c16e21e 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 _0xf84f=['../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTrunks','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','diff','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','seconds','total','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','merge','initFaxAccounts','bluebird','util','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x5c0d61,_0x5f1874){var _0x36d2af=function(_0x5ac201){while(--_0x5ac201){_0x5c0d61['push'](_0x5c0d61['shift']());}};_0x36d2af(++_0x5f1874);}(_0xf84f,0x13e));var _0xff84=function(_0x3e4ebd,_0x53e2b8){_0x3e4ebd=_0x3e4ebd-0x0;var _0x5e920e=_0xf84f[_0x3e4ebd];return _0x5e920e;};'use strict';var BPromise=require(_0xff84('0x0'));var util=require(_0xff84('0x1'));var _=require('lodash');var moment=require(_0xff84('0x2'));var Agent=require('../model/agent');var Telephone=require(_0xff84('0x3'));var Trunk=require(_0xff84('0x4'));var VoiceQueue=require(_0xff84('0x5'));var Trigger=require(_0xff84('0x6'));var Template=require(_0xff84('0x7'));var Campaign=require(_0xff84('0x8'));var VoiceExtension=require(_0xff84('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xff84('0xa'));var FreshdeskAccount=require(_0xff84('0xb'));var SugarcrmAccount=require(_0xff84('0xc'));var ZohoAccount=require(_0xff84('0xd'));var DeskAccount=require(_0xff84('0xe'));var VtigerAccount=require(_0xff84('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xff84('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xff84('0x11'));var Realtime=function(){this[_0xff84('0x12')]={};this[_0xff84('0x13')]={};this[_0xff84('0x14')]={};this[_0xff84('0x15')]={};this['triggers']={};this[_0xff84('0x16')]={};this[_0xff84('0x17')]={};this[_0xff84('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xff84('0x19')]={};this[_0xff84('0x1a')]={};this[_0xff84('0x1b')]={};this[_0xff84('0x1c')]={};this[_0xff84('0x1d')]={};this['settings']={};this['zendeskAccounts']={};this[_0xff84('0x1e')]={};this[_0xff84('0x1f')]={};this[_0xff84('0x20')]={};this[_0xff84('0x21')]={};this[_0xff84('0x22')]={};this[_0xff84('0x23')]={};this[_0xff84('0x24')]={};this[_0xff84('0x25')]={};this[_0xff84('0x26')]={};this[_0xff84('0x27')]={};};function freeIsNotKey(_0x1af0b4,_0x4a85ff,_0x92dc47){var _0x434c0d=_['mapKeys'](_0x1af0b4,function(_0x85de6b,_0x54fab2){return _0x85de6b[_0x92dc47];});for(var _0x190a23 in _0x4a85ff){if(_0x4a85ff[_0xff84('0x28')](_0x190a23)){if(!_0x434c0d[_0x190a23]){delete _0x4a85ff[_0x190a23];}}}}function freeIsNotKeySip(_0x24ec22,_0xa2bc77){var _0x13bb80=_[_0xff84('0x29')](_0x24ec22,function(_0x301205,_0x5dc800){return util[_0xff84('0x2a')](_0xff84('0x2b'),_0x301205[_0xff84('0x2c')]);});for(var _0x217914 in _0xa2bc77){if(_0xa2bc77[_0xff84('0x28')](_0x217914)){if(!_0x13bb80[_0x217914]){delete _0xa2bc77[_0x217914];}}}}function freeIsNotKeyAgent(_0x58779b,_0x19347e){var _0x559b92=_['mapKeys'](_0x58779b,function(_0xd62841,_0x1642b4){var _0x4e8d0d=_['isNil'](_0xd62841[_0xff84('0x2d')])?util[_0xff84('0x2a')](_0xff84('0x2b'),_0xd62841[_0xff84('0x2c')]):_0xd62841[_0xff84('0x2d')];return _0x4e8d0d;});for(var _0x413db5 in _0x19347e){if(_0x19347e[_0xff84('0x28')](_0x413db5)){if(!_0x559b92[_0x413db5]){delete _0x19347e[_0x413db5];}}}}function clearVoiceCallReports(_0x125f76){_0x125f76['total']=0x0;_0x125f76[_0xff84('0x2e')]=0x0;_0x125f76['sumHoldTime']=0x0;_0x125f76[_0xff84('0x2f')]=0x0;_0x125f76[_0xff84('0x30')]=0x0;}function clearCampaigns(_0xbab4aa){if(!_[_0xff84('0x31')](_0xbab4aa)){for(var _0x4dc776 in _0xbab4aa){if(_0xbab4aa[_0xff84('0x28')](_0x4dc776)){_0xbab4aa[_0x4dc776][_0xff84('0x32')]=0x0;_0xbab4aa[_0x4dc776]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x17a7c9){if(!_[_0xff84('0x31')](_0x17a7c9)){for(var _0x8a3bac in _0x17a7c9){if(_0x17a7c9['hasOwnProperty'](_0x8a3bac)){_0x17a7c9[_0x8a3bac]['total']=0x0;_0x17a7c9[_0x8a3bac]['answered']=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x33')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x34')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x35')]=0x0;_0x17a7c9[_0x8a3bac]['sumDuration']=0x0;_0x17a7c9[_0x8a3bac]['sumBillable']=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x36')]=0x0;_0x17a7c9[_0x8a3bac]['outboundNoAnswerCallsDay']=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x37')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x38')]=0x0;_0x17a7c9[_0x8a3bac]['outboundNoSuchCallsDay']=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x39')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x3a')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x3b')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x3c')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x3d')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x3e')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x3f')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x36')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x40')]=0x0;_0x17a7c9[_0x8a3bac][_0xff84('0x41')]=!![];}}}}Realtime[_0xff84('0x42')][_0xff84('0x43')]=function(_0x2c0fdf,_0x11ab18){for(var _0x192f63 in _0x11ab18){if(_0x2c0fdf['hasOwnProperty'](_0x192f63)){_0x2c0fdf[_0x192f63]=_0x11ab18[_0x192f63];}}};Realtime[_0xff84('0x42')][_0xff84('0x44')]=function(){var _0x4e2455=this;return function(_0xedf093){if(_0xedf093){freeIsNotKeyAgent(_0xedf093,_0x4e2455[_0xff84('0x12')]);for(var _0x532515=0x0,_0x4b4402={},_0x5c384e={};_0x532515<_0xedf093[_0xff84('0x45')];_0x532515+=0x1){_0x4b4402=_0xedf093[_0x532515];var _0x510c93=_[_0xff84('0x46')](_0x4b4402[_0xff84('0x2d')])?util['format']('SIP/%s',_0x4b4402[_0xff84('0x2c')]):_0x4b4402[_0xff84('0x2d')];if(_[_0xff84('0x47')](_0x4e2455[_0xff84('0x12')][_0x510c93])){_0x4e2455[_0xff84('0x12')][_0x510c93]=new Agent(_0x4b4402);}else{_0x4e2455[_0xff84('0x43')](_0x4e2455[_0xff84('0x12')][_0x510c93],_0x4b4402);}}}return _0x4e2455[_0xff84('0x12')];};};Realtime[_0xff84('0x42')]['initTelephones']=function(){var _0x2911d3=this;return function(_0x15c939){if(_0x15c939){freeIsNotKeySip(_0x15c939,_0x2911d3[_0xff84('0x13')]);for(var _0x5ebcb5=0x0,_0x55fabb={},_0x34cc1e={};_0x5ebcb5<_0x15c939['length'];_0x5ebcb5+=0x1){_0x55fabb=_0x15c939[_0x5ebcb5];if(_[_0xff84('0x47')](_0x2911d3[_0xff84('0x13')][util[_0xff84('0x2a')](_0xff84('0x2b'),_0x55fabb[_0xff84('0x2c')])])){_0x2911d3['telephones'][util['format'](_0xff84('0x2b'),_0x55fabb[_0xff84('0x2c')])]=new Telephone(_0x55fabb);}else{_0x2911d3['mergeFromDatabase'](_0x2911d3[_0xff84('0x13')][util['format'](_0xff84('0x2b'),_0x55fabb['name'])],_0x55fabb);}}}return _0x2911d3[_0xff84('0x13')];};};Realtime['prototype'][_0xff84('0x48')]=function(){var _0x59af01=this;return function(_0x42edec){if(_0x42edec){freeIsNotKeySip(_0x42edec,_0x59af01['trunks']);for(var _0x45177e=0x0,_0x276527={},_0x115c94={};_0x45177e<_0x42edec[_0xff84('0x45')];_0x45177e+=0x1){_0x276527=_0x42edec[_0x45177e];if(_[_0xff84('0x47')](_0x59af01[_0xff84('0x14')][util['format'](_0xff84('0x2b'),_0x276527[_0xff84('0x2c')])])){_0x59af01[_0xff84('0x14')][util['format'](_0xff84('0x2b'),_0x276527[_0xff84('0x2c')])]=new Trunk(_0x276527);}else{_0x59af01['mergeFromDatabase'](_0x59af01[_0xff84('0x14')][util[_0xff84('0x2a')](_0xff84('0x2b'),_0x276527[_0xff84('0x2c')])],_0x276527);}}}return _0x59af01[_0xff84('0x14')];};};Realtime[_0xff84('0x42')][_0xff84('0x49')]=function(){var _0x308388=this;return function(_0x2dfbec){if(_0x2dfbec){freeIsNotKey(_0x2dfbec,_0x308388['voiceQueues'],_0xff84('0x2c'));for(var _0x27f5fa=0x0,_0x3972ec={},_0x5b58e0={};_0x27f5fa<_0x2dfbec[_0xff84('0x45')];_0x27f5fa+=0x1){_0x3972ec=_0x2dfbec[_0x27f5fa];if(_[_0xff84('0x47')](_0x308388['voiceQueues'][_0x3972ec[_0xff84('0x2c')]])){_0x308388[_0xff84('0x15')][_0x3972ec['name']]=new VoiceQueue(_0x3972ec);}else{_0x308388[_0xff84('0x43')](_0x308388[_0xff84('0x15')][_0x3972ec[_0xff84('0x2c')]],_0x3972ec);}}}return _0x308388[_0xff84('0x15')];};};Realtime[_0xff84('0x42')][_0xff84('0x4a')]=function(){var _0x51dca0=this;return function(_0x35f95b){if(_0x35f95b){freeIsNotKey(_0x35f95b,_0x51dca0[_0xff84('0x4b')],'id');for(var _0x5e87e4=0x0,_0xca5d23={},_0x1c315f={};_0x5e87e4<_0x35f95b[_0xff84('0x45')];_0x5e87e4+=0x1){_0xca5d23=_0x35f95b[_0x5e87e4];if(_[_0xff84('0x47')](_0x51dca0[_0xff84('0x4b')][_0xca5d23['id']])){_0x51dca0[_0xff84('0x4b')][_0xca5d23['id']]=new Trigger(_0xca5d23);}else{_0x51dca0['mergeFromDatabase'](_0x51dca0[_0xff84('0x4b')][_0xca5d23['id']],_0xca5d23);}}}return _0x51dca0[_0xff84('0x4b')];};};Realtime[_0xff84('0x42')]['initTemplates']=function(){var _0x37d8a0=this;return function(_0x2ed4fc){if(_0x2ed4fc){freeIsNotKey(_0x2ed4fc,_0x37d8a0[_0xff84('0x17')],'id');for(var _0x3ffba3=0x0,_0x1ddfbb={},_0x2b4a0b={};_0x3ffba3<_0x2ed4fc[_0xff84('0x45')];_0x3ffba3+=0x1){_0x1ddfbb=_0x2ed4fc[_0x3ffba3];if(_[_0xff84('0x47')](_0x37d8a0['templates'][_0x1ddfbb['id']])){_0x37d8a0['templates'][_0x1ddfbb['id']]=new Template(_0x1ddfbb);}else{_0x37d8a0[_0xff84('0x43')](_0x37d8a0[_0xff84('0x17')][_0x1ddfbb['id']],_0x1ddfbb);}}}return _0x37d8a0[_0xff84('0x17')];};};Realtime[_0xff84('0x42')][_0xff84('0x4c')]=function(){var _0x2c6a6b=this;return function(_0x55aeea){if(_0x55aeea){freeIsNotKey(_0x55aeea,_0x2c6a6b[_0xff84('0x4d')],'id');for(var _0x1b97b4=0x0,_0x44da6a={},_0x291224={};_0x1b97b4<_0x55aeea[_0xff84('0x45')];_0x1b97b4+=0x1){_0x44da6a=_0x55aeea[_0x1b97b4];if(_[_0xff84('0x47')](_0x2c6a6b['zendeskAccounts'][_0x44da6a['id']])){_0x2c6a6b[_0xff84('0x4d')][_0x44da6a['id']]=new ZendeskAccount(_0x44da6a);}else{_0x2c6a6b['mergeFromDatabase'](_0x2c6a6b[_0xff84('0x4d')][_0x44da6a['id']],_0x44da6a);}}}return _0x2c6a6b['zendeskAccounts'];};};Realtime[_0xff84('0x42')][_0xff84('0x4e')]=function(){var _0x26af30=this;return function(_0x293f1a){if(_0x293f1a){freeIsNotKey(_0x293f1a,_0x26af30['salesforceAccounts'],'id');for(var _0x40f5f2=0x0,_0x9e49c5={},_0x59b60a={};_0x40f5f2<_0x293f1a['length'];_0x40f5f2+=0x1){_0x9e49c5=_0x293f1a[_0x40f5f2];if(_[_0xff84('0x47')](_0x26af30[_0xff84('0x1e')][_0x9e49c5['id']])){_0x26af30[_0xff84('0x1e')][_0x9e49c5['id']]=new SalesforceAccount(_0x9e49c5);}else{_0x26af30[_0xff84('0x43')](_0x26af30[_0xff84('0x1e')][_0x9e49c5['id']],_0x9e49c5);}}}return _0x26af30['salesforceAccounts'];};};Realtime['prototype'][_0xff84('0x4f')]=function(){var _0x2feff6=this;return function(_0x42d4eb){if(_0x42d4eb){freeIsNotKey(_0x42d4eb,_0x2feff6['freshdeskAccounts'],'id');for(var _0x1ef9ce=0x0,_0x4056c8={},_0x3a80df={};_0x1ef9ce<_0x42d4eb[_0xff84('0x45')];_0x1ef9ce+=0x1){_0x4056c8=_0x42d4eb[_0x1ef9ce];if(_[_0xff84('0x47')](_0x2feff6[_0xff84('0x20')][_0x4056c8['id']])){_0x2feff6[_0xff84('0x20')][_0x4056c8['id']]=new FreshdeskAccount(_0x4056c8);}else{_0x2feff6['mergeFromDatabase'](_0x2feff6[_0xff84('0x20')][_0x4056c8['id']],_0x4056c8);}}}return _0x2feff6[_0xff84('0x20')];};};Realtime['prototype'][_0xff84('0x50')]=function(){var _0x4caab5=this;return function(_0x15eb78){if(_0x15eb78){freeIsNotKey(_0x15eb78,_0x4caab5[_0xff84('0x21')],'id');for(var _0x470d88=0x0,_0x37d58a={},_0x40b27c={};_0x470d88<_0x15eb78[_0xff84('0x45')];_0x470d88+=0x1){_0x37d58a=_0x15eb78[_0x470d88];if(_[_0xff84('0x47')](_0x4caab5[_0xff84('0x21')][_0x37d58a['id']])){_0x4caab5[_0xff84('0x21')][_0x37d58a['id']]=new ZohoAccount(_0x37d58a);}else{_0x4caab5[_0xff84('0x43')](_0x4caab5[_0xff84('0x21')][_0x37d58a['id']],_0x37d58a);}}}return _0x4caab5[_0xff84('0x21')];};};Realtime[_0xff84('0x42')][_0xff84('0x51')]=function(){var _0x283d49=this;return function(_0x776ee){if(_0x776ee){freeIsNotKey(_0x776ee,_0x283d49[_0xff84('0x22')],'id');for(var _0x50ccb3=0x0,_0x3126c2={},_0x4325b5={};_0x50ccb3<_0x776ee['length'];_0x50ccb3+=0x1){_0x3126c2=_0x776ee[_0x50ccb3];if(_[_0xff84('0x47')](_0x283d49[_0xff84('0x22')][_0x3126c2['id']])){_0x283d49['deskAccounts'][_0x3126c2['id']]=new DeskAccount(_0x3126c2);}else{_0x283d49[_0xff84('0x43')](_0x283d49['deskAccounts'][_0x3126c2['id']],_0x3126c2);}}}return _0x283d49[_0xff84('0x22')];};};Realtime[_0xff84('0x42')][_0xff84('0x52')]=function(){var _0x10db83=this;return function(_0x5705b3){if(_0x5705b3){freeIsNotKey(_0x5705b3,_0x10db83['sugarcrmAccounts'],'id');for(var _0x3217bc=0x0,_0x5b8de0={},_0x30cd8c={};_0x3217bc<_0x5705b3[_0xff84('0x45')];_0x3217bc+=0x1){_0x5b8de0=_0x5705b3[_0x3217bc];if(_[_0xff84('0x47')](_0x10db83[_0xff84('0x1f')][_0x5b8de0['id']])){_0x10db83[_0xff84('0x1f')][_0x5b8de0['id']]=new SugarcrmAccount(_0x5b8de0);}else{_0x10db83['mergeFromDatabase'](_0x10db83['sugarcrmAccounts'][_0x5b8de0['id']],_0x5b8de0);}}}return _0x10db83[_0xff84('0x1f')];};};Realtime[_0xff84('0x42')][_0xff84('0x53')]=function(){var _0x30c1f7=this;return function(_0x2852d3){if(_0x2852d3){freeIsNotKey(_0x2852d3,_0x30c1f7[_0xff84('0x23')],'id');for(var _0xfa2c0a=0x0,_0x4f1e5e={},_0xa9198={};_0xfa2c0a<_0x2852d3[_0xff84('0x45')];_0xfa2c0a+=0x1){_0x4f1e5e=_0x2852d3[_0xfa2c0a];if(_[_0xff84('0x47')](_0x30c1f7[_0xff84('0x23')][_0x4f1e5e['id']])){_0x30c1f7[_0xff84('0x23')][_0x4f1e5e['id']]=new VtigerAccount(_0x4f1e5e);}else{_0x30c1f7[_0xff84('0x43')](_0x30c1f7[_0xff84('0x23')][_0x4f1e5e['id']],_0x4f1e5e);}}}return _0x30c1f7[_0xff84('0x23')];};};Realtime[_0xff84('0x42')]['initServicenowAccounts']=function(){var _0x22603e=this;return function(_0x188a2b){if(_0x188a2b){freeIsNotKey(_0x188a2b,_0x22603e[_0xff84('0x24')],'id');for(var _0x5617a3=0x0,_0x232ebc={},_0x575827={};_0x5617a3<_0x188a2b[_0xff84('0x45')];_0x5617a3+=0x1){_0x232ebc=_0x188a2b[_0x5617a3];if(_['isUndefined'](_0x22603e[_0xff84('0x24')][_0x232ebc['id']])){_0x22603e[_0xff84('0x24')][_0x232ebc['id']]=new ServicenowAccount(_0x232ebc);}else{_0x22603e[_0xff84('0x43')](_0x22603e['servicenowAccounts'][_0x232ebc['id']],_0x232ebc);}}}return _0x22603e[_0xff84('0x24')];};};Realtime[_0xff84('0x42')][_0xff84('0x54')]=function(){var _0x42e524=this;return function(_0x269fa2){if(_0x269fa2){freeIsNotKey(_0x269fa2,_0x42e524[_0xff84('0x25')],'id');for(var _0xdc4608=0x0,_0x1d8c56={},_0x242784={};_0xdc4608<_0x269fa2[_0xff84('0x45')];_0xdc4608+=0x1){_0x1d8c56=_0x269fa2[_0xdc4608];if(_[_0xff84('0x47')](_0x42e524[_0xff84('0x25')][_0x1d8c56['id']])){_0x42e524[_0xff84('0x25')][_0x1d8c56['id']]=new Dynamics365Account(_0x1d8c56);}else{_0x42e524['mergeFromDatabase'](_0x42e524[_0xff84('0x25')][_0x1d8c56['id']],_0x1d8c56);}}}return _0x42e524[_0xff84('0x25')];};};Realtime[_0xff84('0x42')]['initFreshsalesAccounts']=function(){var _0x46a8ee=this;return function(_0x5cfd5c){if(_0x5cfd5c){freeIsNotKey(_0x5cfd5c,_0x46a8ee[_0xff84('0x26')],'id');for(var _0x1a7ff2=0x0,_0x57c21f={},_0x51d211={};_0x1a7ff2<_0x5cfd5c[_0xff84('0x45')];_0x1a7ff2+=0x1){_0x57c21f=_0x5cfd5c[_0x1a7ff2];if(_[_0xff84('0x47')](_0x46a8ee[_0xff84('0x26')][_0x57c21f['id']])){_0x46a8ee[_0xff84('0x26')][_0x57c21f['id']]=new FreshsalesAccount(_0x57c21f);}else{_0x46a8ee[_0xff84('0x43')](_0x46a8ee['freshsalesAccounts'][_0x57c21f['id']],_0x57c21f);}}}return _0x46a8ee[_0xff84('0x26')];};};Realtime['prototype'][_0xff84('0x55')]=function(){var _0x4ee879=this;return function(_0x18285e){for(var _0x1eeee7=0x0;_0x1eeee7<_0x18285e[_0xff84('0x45')];_0x1eeee7+=0x1){_['merge'](_0x4ee879['voiceQueues'][_0x18285e[_0x1eeee7][_0xff84('0x2c')]],_0x18285e[_0x1eeee7]);}return _0x4ee879[_0xff84('0x15')];};};Realtime['prototype'][_0xff84('0x56')]=function(){var _0x19b5df=this;return function(_0x542cee){clearVoiceQueues(_0x19b5df[_0xff84('0x15')]);if(_0x542cee){_0x542cee=_['groupBy'](_0x542cee,_0xff84('0x57'));for(var _0x2ac368 in _0x542cee){if(_0x542cee['hasOwnProperty'](_0x2ac368)){var _0x582fea={};for(var _0x5a6af4=0x0;_0x5a6af4<_0x542cee[_0x2ac368][_0xff84('0x45')];_0x5a6af4+=0x1){var _0x3204c4=_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x58')];if(_0x19b5df[_0xff84('0x15')][_0x3204c4]){if(_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x59')]){_0x19b5df[_0xff84('0x15')][_0x3204c4][_0xff84('0x33')]+=0x1;}if(_0x542cee[_0x2ac368][_0x5a6af4]['queuecallerabandon']){_0x19b5df[_0xff84('0x15')][_0x3204c4]['abandoned']+=0x1;}_0x19b5df[_0xff84('0x15')][_0x3204c4][_0xff84('0x35')]+=moment(_0x542cee[_0x2ac368][_0x5a6af4]['queuecallerleaveAt'])[_0xff84('0x5a')](moment(_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x5b')]),'seconds')||0x0;if(_0x5a6af4===_0x542cee[_0x2ac368][_0xff84('0x45')]-0x1){_0x19b5df[_0xff84('0x15')][_0x3204c4][_0xff84('0x2f')]+=moment(_0x542cee[_0x2ac368][_0x5a6af4]['queuecallercompleteAt']||_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x5c')]||_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x5d')])[_0xff84('0x5a')](moment(_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x5b')]),_0xff84('0x5e'))||0x0;_0x19b5df[_0xff84('0x15')][_0x3204c4][_0xff84('0x5f')]+=0x1;if(_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x60')]){_0x19b5df['voiceQueues'][_0x3204c4][_0xff84('0x2e')]+=0x1;_0x19b5df['voiceQueues'][_0x3204c4][_0xff84('0x30')]+=moment(_0x542cee[_0x2ac368][_0x5a6af4]['queuecallercompleteAt'])[_0xff84('0x5a')](moment(_0x542cee[_0x2ac368][_0x5a6af4][_0xff84('0x61')]),'seconds')||0x0;}}else{_0x19b5df['voiceQueues'][_0x3204c4]['sumDuration']+=_0x19b5df[_0xff84('0x15')][_0x3204c4][_0xff84('0x35')]||0x0;}}}}}}return _0x19b5df[_0xff84('0x15')];};};Realtime[_0xff84('0x42')][_0xff84('0x62')]=function(){var _0xe26c42=this;return function(_0x33d08d){clearVoiceCallReports(_0xe26c42[_0xff84('0x18')]);if(_0x33d08d){for(var _0x4beae2=0x0;_0x4beae2<_0x33d08d[_0xff84('0x45')];_0x4beae2+=0x1){_0xe26c42[_0xff84('0x18')][_0xff84('0x5f')]+=0x1;_0xe26c42[_0xff84('0x18')][_0xff84('0x2f')]+=_0x33d08d[_0x4beae2][_0xff84('0x63')];if(_0x33d08d[_0x4beae2][_0xff84('0x64')]===_0xff84('0x65')){_0xe26c42[_0xff84('0x18')]['answered']+=0x1;_0xe26c42[_0xff84('0x18')][_0xff84('0x35')]+=_0x33d08d[_0x4beae2][_0xff84('0x63')]-_0x33d08d[_0x4beae2][_0xff84('0x66')]||0x0;_0xe26c42[_0xff84('0x18')][_0xff84('0x30')]+=_0x33d08d[_0x4beae2][_0xff84('0x66')];}}}return _0xe26c42[_0xff84('0x18')];};};Realtime[_0xff84('0x42')][_0xff84('0x67')]=function(){var _0x5552c4=this;return function(_0x55e4c3){if(_0x55e4c3){freeIsNotKey(_0x55e4c3,_0x5552c4['campaigns'],_0xff84('0x2c'));for(var _0x10bdfc=0x0,_0x35b16b={};_0x10bdfc<_0x55e4c3[_0xff84('0x45')];_0x10bdfc+=0x1){_0x35b16b=_0x55e4c3[_0x10bdfc];if(_[_0xff84('0x47')](_0x5552c4[_0xff84('0x16')][_0x35b16b['name']])){_0x5552c4[_0xff84('0x16')][_0x35b16b[_0xff84('0x2c')]]=new Campaign(_0x35b16b);}else{_0x5552c4[_0xff84('0x43')](_0x5552c4[_0xff84('0x16')][_0x35b16b[_0xff84('0x2c')]],_0x35b16b);_0x5552c4[_0xff84('0x16')][_0x35b16b[_0xff84('0x2c')]][_0xff84('0x68')]=_0x35b16b[_0xff84('0x69')]?_0x35b16b[_0xff84('0x69')][_0xff84('0x2c')]:undefined;}}}return _0x5552c4[_0xff84('0x16')];};};Realtime['prototype'][_0xff84('0x6a')]=function(){var _0x42efa0=this;return function(_0x51e566){if(_0x51e566){freeIsNotKey(_0x51e566,_0x42efa0[_0xff84('0x19')],'id');for(var _0x4ae2f5=0x0,_0x982e96={};_0x4ae2f5<_0x51e566['length'];_0x4ae2f5+=0x1){_0x982e96=_0x51e566[_0x4ae2f5];if(_[_0xff84('0x47')](_0x42efa0[_0xff84('0x19')][_0x982e96['id']])){_0x42efa0[_0xff84('0x19')][_0x982e96['id']]=new VoiceExtension(_0x982e96);}else{_0x42efa0[_0xff84('0x43')](_0x42efa0['voiceExtensions'][_0x982e96['id']],_0x982e96);}}}return _0x42efa0[_0xff84('0x19')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x42db0f=this;return function(_0x38aba3){clearCampaigns(_0x42db0f[_0xff84('0x16')]);for(var _0x5e026f=0x0;_0x5e026f<_0x38aba3['length'];_0x5e026f+=0x1){_[_0xff84('0x6b')](_0x42db0f['campaigns'][_0x38aba3[_0x5e026f][_0xff84('0x2c')]],_0x38aba3[_0x5e026f]);}return _0x42db0f['campaigns'];};};Realtime['prototype'][_0xff84('0x6c')]=function(){var _0x19e25b=this;return function(_0x36c018){if(_0x36c018){freeIsNotKey(_0x36c018,_0x19e25b[_0xff84('0x27')],'id');for(var _0x3f74c9=0x0,_0x51512b={},_0x3d1a06={};_0x3f74c9<_0x36c018[_0xff84('0x45')];_0x3f74c9+=0x1){_0x51512b=_0x36c018[_0x3f74c9];if(_['isUndefined'](_0x19e25b[_0xff84('0x27')][_0x51512b['id']])){_0x19e25b[_0xff84('0x27')][_0x51512b['id']]=new FaxAccount(_0x51512b);}else{_0x19e25b['mergeFromDatabase'](_0x19e25b['faxAccounts'][_0x51512b['id']],_0x51512b);}}}return _0x19e25b[_0xff84('0x27')];};};module['exports']=Realtime; \ No newline at end of file +var _0xc96e=['../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','name','hasOwnProperty','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','mergeFromDatabase','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','initVoiceCallReports','outbound','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','bluebird','util','lodash','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account'];(function(_0x4627d7,_0x57799){var _0x4ff782=function(_0x15cd04){while(--_0x15cd04){_0x4627d7['push'](_0x4627d7['shift']());}};_0x4ff782(++_0x57799);}(_0xc96e,0x135));var _0xec96=function(_0x84bde6,_0x6c3acc){_0x84bde6=_0x84bde6-0x0;var _0x2b10b5=_0xc96e[_0x84bde6];return _0x2b10b5;};'use strict';var BPromise=require(_0xec96('0x0'));var util=require(_0xec96('0x1'));var _=require(_0xec96('0x2'));var moment=require('moment');var Agent=require(_0xec96('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xec96('0x4'));var VoiceQueue=require(_0xec96('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xec96('0x6'));var Campaign=require(_0xec96('0x7'));var VoiceExtension=require(_0xec96('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xec96('0x9'));var FreshdeskAccount=require(_0xec96('0xa'));var SugarcrmAccount=require(_0xec96('0xb'));var ZohoAccount=require(_0xec96('0xc'));var DeskAccount=require(_0xec96('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xec96('0xe'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xec96('0xf'));var Realtime=function(){this[_0xec96('0x10')]={};this[_0xec96('0x11')]={};this[_0xec96('0x12')]={};this[_0xec96('0x13')]={};this[_0xec96('0x14')]={};this[_0xec96('0x15')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0xec96('0x16')]={};this[_0xec96('0x17')]={};this[_0xec96('0x18')]={};this[_0xec96('0x19')]={};this[_0xec96('0x1a')]={};this[_0xec96('0x1b')]={};this['sugarcrmAccounts']={};this[_0xec96('0x1c')]={};this[_0xec96('0x1d')]={};this['deskAccounts']={};this[_0xec96('0x1e')]={};this[_0xec96('0x1f')]={};this[_0xec96('0x20')]={};this[_0xec96('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0xf66087,_0x49c898,_0x31e89b){var _0x3aded1=_['mapKeys'](_0xf66087,function(_0x5bfb08,_0xee907d){return _0x5bfb08[_0x31e89b];});for(var _0x4ca88a in _0x49c898){if(_0x49c898['hasOwnProperty'](_0x4ca88a)){if(!_0x3aded1[_0x4ca88a]){delete _0x49c898[_0x4ca88a];}}}}function freeIsNotKeySip(_0x40bf60,_0x13db36){var _0xbef6ee=_[_0xec96('0x22')](_0x40bf60,function(_0x38cd38,_0x469e54){return util[_0xec96('0x23')]('SIP/%s',_0x38cd38[_0xec96('0x24')]);});for(var _0x18d118 in _0x13db36){if(_0x13db36[_0xec96('0x25')](_0x18d118)){if(!_0xbef6ee[_0x18d118]){delete _0x13db36[_0x18d118];}}}}function freeIsNotKeyAgent(_0x45f108,_0x4bd330){var _0x3ad4be=_['mapKeys'](_0x45f108,function(_0x118503,_0x8d79be){var _0x5ddfd7=_[_0xec96('0x26')](_0x118503[_0xec96('0x27')])?util[_0xec96('0x23')](_0xec96('0x28'),_0x118503['name']):_0x118503[_0xec96('0x27')];return _0x5ddfd7;});for(var _0x36de17 in _0x4bd330){if(_0x4bd330[_0xec96('0x25')](_0x36de17)){if(!_0x3ad4be[_0x36de17]){delete _0x4bd330[_0x36de17];}}}}function clearVoiceCallReports(_0x1f8af2){_0x1f8af2[_0xec96('0x29')]=0x0;_0x1f8af2[_0xec96('0x2a')]=0x0;_0x1f8af2[_0xec96('0x2b')]=0x0;_0x1f8af2[_0xec96('0x2c')]=0x0;_0x1f8af2['sumBillable']=0x0;}function clearCampaigns(_0x5491f3){if(!_['isEmpty'](_0x5491f3)){for(var _0x191fa9 in _0x5491f3){if(_0x5491f3['hasOwnProperty'](_0x191fa9)){_0x5491f3[_0x191fa9][_0xec96('0x2d')]=0x0;_0x5491f3[_0x191fa9][_0xec96('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x209759){if(!_['isEmpty'](_0x209759)){for(var _0x71936f in _0x209759){if(_0x209759['hasOwnProperty'](_0x71936f)){_0x209759[_0x71936f][_0xec96('0x29')]=0x0;_0x209759[_0x71936f][_0xec96('0x2a')]=0x0;_0x209759[_0x71936f][_0xec96('0x2f')]=0x0;_0x209759[_0x71936f][_0xec96('0x30')]=0x0;_0x209759[_0x71936f][_0xec96('0x2b')]=0x0;_0x209759[_0x71936f][_0xec96('0x2c')]=0x0;_0x209759[_0x71936f][_0xec96('0x31')]=0x0;_0x209759[_0x71936f][_0xec96('0x32')]=0x0;_0x209759[_0x71936f][_0xec96('0x33')]=0x0;_0x209759[_0x71936f][_0xec96('0x34')]=0x0;_0x209759[_0x71936f]['outboundCongestionCallsDay']=0x0;_0x209759[_0x71936f][_0xec96('0x35')]=0x0;_0x209759[_0x71936f][_0xec96('0x36')]=0x0;_0x209759[_0x71936f][_0xec96('0x37')]=0x0;_0x209759[_0x71936f][_0xec96('0x38')]=0x0;_0x209759[_0x71936f]['outboundBlacklistCallsDay']=0x0;_0x209759[_0x71936f][_0xec96('0x39')]=0x0;_0x209759[_0x71936f][_0xec96('0x3a')]=0x0;_0x209759[_0x71936f][_0xec96('0x3b')]=0x0;_0x209759[_0x71936f]['outboundAnswerAgiCallsDay']=0x0;_0x209759[_0x71936f][_0xec96('0x3c')]=0x0;_0x209759[_0x71936f][_0xec96('0x3d')]=!![];}}}}Realtime[_0xec96('0x3e')]['mergeFromDatabase']=function(_0x15d743,_0x2caf80){for(var _0x5bef1f in _0x2caf80){if(_0x15d743[_0xec96('0x25')](_0x5bef1f)){_0x15d743[_0x5bef1f]=_0x2caf80[_0x5bef1f];}}};Realtime[_0xec96('0x3e')][_0xec96('0x3f')]=function(){var _0x446a9c=this;return function(_0x86dac6){if(_0x86dac6){freeIsNotKeyAgent(_0x86dac6,_0x446a9c[_0xec96('0x10')]);for(var _0x1f0892=0x0,_0x44e6b7={},_0x47db6d={};_0x1f0892<_0x86dac6[_0xec96('0x40')];_0x1f0892+=0x1){_0x44e6b7=_0x86dac6[_0x1f0892];var _0x268115=_[_0xec96('0x26')](_0x44e6b7[_0xec96('0x27')])?util[_0xec96('0x23')](_0xec96('0x28'),_0x44e6b7[_0xec96('0x24')]):_0x44e6b7[_0xec96('0x27')];if(_[_0xec96('0x41')](_0x446a9c['agents'][_0x268115])){_0x446a9c[_0xec96('0x10')][_0x268115]=new Agent(_0x44e6b7);}else{_0x446a9c['mergeFromDatabase'](_0x446a9c['agents'][_0x268115],_0x44e6b7);}}}return _0x446a9c[_0xec96('0x10')];};};Realtime[_0xec96('0x3e')][_0xec96('0x42')]=function(){var _0x22554a=this;return function(_0x4e302a){if(_0x4e302a){freeIsNotKeySip(_0x4e302a,_0x22554a[_0xec96('0x11')]);for(var _0x13d960=0x0,_0xec462c={},_0x55ca09={};_0x13d960<_0x4e302a[_0xec96('0x40')];_0x13d960+=0x1){_0xec462c=_0x4e302a[_0x13d960];if(_[_0xec96('0x41')](_0x22554a[_0xec96('0x11')][util[_0xec96('0x23')]('SIP/%s',_0xec462c[_0xec96('0x24')])])){_0x22554a[_0xec96('0x11')][util['format'](_0xec96('0x28'),_0xec462c[_0xec96('0x24')])]=new Telephone(_0xec462c);}else{_0x22554a['mergeFromDatabase'](_0x22554a[_0xec96('0x11')][util[_0xec96('0x23')]('SIP/%s',_0xec462c['name'])],_0xec462c);}}}return _0x22554a[_0xec96('0x11')];};};Realtime[_0xec96('0x3e')][_0xec96('0x43')]=function(){var _0x465bb7=this;return function(_0x173347){if(_0x173347){freeIsNotKeySip(_0x173347,_0x465bb7[_0xec96('0x12')]);for(var _0x55d9f3=0x0,_0x26be34={},_0x1360a1={};_0x55d9f3<_0x173347[_0xec96('0x40')];_0x55d9f3+=0x1){_0x26be34=_0x173347[_0x55d9f3];if(_[_0xec96('0x41')](_0x465bb7[_0xec96('0x12')][util[_0xec96('0x23')](_0xec96('0x28'),_0x26be34['name'])])){_0x465bb7[_0xec96('0x12')][util[_0xec96('0x23')]('SIP/%s',_0x26be34[_0xec96('0x24')])]=new Trunk(_0x26be34);}else{_0x465bb7['mergeFromDatabase'](_0x465bb7[_0xec96('0x12')][util[_0xec96('0x23')](_0xec96('0x28'),_0x26be34[_0xec96('0x24')])],_0x26be34);}}}return _0x465bb7[_0xec96('0x12')];};};Realtime[_0xec96('0x3e')][_0xec96('0x44')]=function(){var _0x3cd180=this;return function(_0x3b403e){if(_0x3b403e){freeIsNotKey(_0x3b403e,_0x3cd180[_0xec96('0x13')],_0xec96('0x24'));for(var _0x547ca0=0x0,_0x4907cf={},_0x3e3687={};_0x547ca0<_0x3b403e[_0xec96('0x40')];_0x547ca0+=0x1){_0x4907cf=_0x3b403e[_0x547ca0];if(_[_0xec96('0x41')](_0x3cd180[_0xec96('0x13')][_0x4907cf[_0xec96('0x24')]])){_0x3cd180['voiceQueues'][_0x4907cf[_0xec96('0x24')]]=new VoiceQueue(_0x4907cf);}else{_0x3cd180[_0xec96('0x45')](_0x3cd180[_0xec96('0x13')][_0x4907cf['name']],_0x4907cf);}}}return _0x3cd180[_0xec96('0x13')];};};Realtime[_0xec96('0x3e')][_0xec96('0x46')]=function(){var _0x506f87=this;return function(_0x410851){if(_0x410851){freeIsNotKey(_0x410851,_0x506f87[_0xec96('0x14')],'id');for(var _0x3027be=0x0,_0x700d7f={},_0x5369ca={};_0x3027be<_0x410851[_0xec96('0x40')];_0x3027be+=0x1){_0x700d7f=_0x410851[_0x3027be];if(_[_0xec96('0x41')](_0x506f87[_0xec96('0x14')][_0x700d7f['id']])){_0x506f87[_0xec96('0x14')][_0x700d7f['id']]=new Trigger(_0x700d7f);}else{_0x506f87['mergeFromDatabase'](_0x506f87[_0xec96('0x14')][_0x700d7f['id']],_0x700d7f);}}}return _0x506f87[_0xec96('0x14')];};};Realtime[_0xec96('0x3e')][_0xec96('0x47')]=function(){var _0x628d4c=this;return function(_0x1cb978){if(_0x1cb978){freeIsNotKey(_0x1cb978,_0x628d4c['templates'],'id');for(var _0x135214=0x0,_0x1353ca={},_0x68b71e={};_0x135214<_0x1cb978['length'];_0x135214+=0x1){_0x1353ca=_0x1cb978[_0x135214];if(_[_0xec96('0x41')](_0x628d4c[_0xec96('0x48')][_0x1353ca['id']])){_0x628d4c[_0xec96('0x48')][_0x1353ca['id']]=new Template(_0x1353ca);}else{_0x628d4c[_0xec96('0x45')](_0x628d4c[_0xec96('0x48')][_0x1353ca['id']],_0x1353ca);}}}return _0x628d4c[_0xec96('0x48')];};};Realtime['prototype'][_0xec96('0x49')]=function(){var _0x30dc0f=this;return function(_0x247ea7){if(_0x247ea7){freeIsNotKey(_0x247ea7,_0x30dc0f[_0xec96('0x1a')],'id');for(var _0x29e477=0x0,_0x54dfff={},_0x583d81={};_0x29e477<_0x247ea7['length'];_0x29e477+=0x1){_0x54dfff=_0x247ea7[_0x29e477];if(_[_0xec96('0x41')](_0x30dc0f['zendeskAccounts'][_0x54dfff['id']])){_0x30dc0f['zendeskAccounts'][_0x54dfff['id']]=new ZendeskAccount(_0x54dfff);}else{_0x30dc0f[_0xec96('0x45')](_0x30dc0f[_0xec96('0x1a')][_0x54dfff['id']],_0x54dfff);}}}return _0x30dc0f[_0xec96('0x1a')];};};Realtime[_0xec96('0x3e')][_0xec96('0x4a')]=function(){var _0x4a78eb=this;return function(_0x17356a){if(_0x17356a){freeIsNotKey(_0x17356a,_0x4a78eb[_0xec96('0x1b')],'id');for(var _0x2c8c60=0x0,_0x411a48={},_0x575414={};_0x2c8c60<_0x17356a[_0xec96('0x40')];_0x2c8c60+=0x1){_0x411a48=_0x17356a[_0x2c8c60];if(_['isUndefined'](_0x4a78eb[_0xec96('0x1b')][_0x411a48['id']])){_0x4a78eb[_0xec96('0x1b')][_0x411a48['id']]=new SalesforceAccount(_0x411a48);}else{_0x4a78eb[_0xec96('0x45')](_0x4a78eb[_0xec96('0x1b')][_0x411a48['id']],_0x411a48);}}}return _0x4a78eb['salesforceAccounts'];};};Realtime[_0xec96('0x3e')][_0xec96('0x4b')]=function(){var _0x2e784b=this;return function(_0x501128){if(_0x501128){freeIsNotKey(_0x501128,_0x2e784b[_0xec96('0x1c')],'id');for(var _0x4663dc=0x0,_0x4fbccf={},_0x3e69ce={};_0x4663dc<_0x501128[_0xec96('0x40')];_0x4663dc+=0x1){_0x4fbccf=_0x501128[_0x4663dc];if(_['isUndefined'](_0x2e784b[_0xec96('0x1c')][_0x4fbccf['id']])){_0x2e784b[_0xec96('0x1c')][_0x4fbccf['id']]=new FreshdeskAccount(_0x4fbccf);}else{_0x2e784b[_0xec96('0x45')](_0x2e784b[_0xec96('0x1c')][_0x4fbccf['id']],_0x4fbccf);}}}return _0x2e784b['freshdeskAccounts'];};};Realtime[_0xec96('0x3e')]['initZohoAccounts']=function(){var _0x2270c0=this;return function(_0x13d88b){if(_0x13d88b){freeIsNotKey(_0x13d88b,_0x2270c0[_0xec96('0x1d')],'id');for(var _0x2c8445=0x0,_0x12b333={},_0x17daaf={};_0x2c8445<_0x13d88b['length'];_0x2c8445+=0x1){_0x12b333=_0x13d88b[_0x2c8445];if(_[_0xec96('0x41')](_0x2270c0[_0xec96('0x1d')][_0x12b333['id']])){_0x2270c0[_0xec96('0x1d')][_0x12b333['id']]=new ZohoAccount(_0x12b333);}else{_0x2270c0[_0xec96('0x45')](_0x2270c0['zohoAccounts'][_0x12b333['id']],_0x12b333);}}}return _0x2270c0[_0xec96('0x1d')];};};Realtime['prototype'][_0xec96('0x4c')]=function(){var _0x5f0271=this;return function(_0x5a7668){if(_0x5a7668){freeIsNotKey(_0x5a7668,_0x5f0271[_0xec96('0x4d')],'id');for(var _0x5f2bee=0x0,_0x2ee7b2={},_0x3b25c2={};_0x5f2bee<_0x5a7668['length'];_0x5f2bee+=0x1){_0x2ee7b2=_0x5a7668[_0x5f2bee];if(_[_0xec96('0x41')](_0x5f0271[_0xec96('0x4d')][_0x2ee7b2['id']])){_0x5f0271['deskAccounts'][_0x2ee7b2['id']]=new DeskAccount(_0x2ee7b2);}else{_0x5f0271['mergeFromDatabase'](_0x5f0271[_0xec96('0x4d')][_0x2ee7b2['id']],_0x2ee7b2);}}}return _0x5f0271['deskAccounts'];};};Realtime[_0xec96('0x3e')]['initSugarcrmAccounts']=function(){var _0x5bb6a9=this;return function(_0x3b01cc){if(_0x3b01cc){freeIsNotKey(_0x3b01cc,_0x5bb6a9[_0xec96('0x4e')],'id');for(var _0x11dff3=0x0,_0x1cdad5={},_0x3b7afc={};_0x11dff3<_0x3b01cc[_0xec96('0x40')];_0x11dff3+=0x1){_0x1cdad5=_0x3b01cc[_0x11dff3];if(_[_0xec96('0x41')](_0x5bb6a9[_0xec96('0x4e')][_0x1cdad5['id']])){_0x5bb6a9[_0xec96('0x4e')][_0x1cdad5['id']]=new SugarcrmAccount(_0x1cdad5);}else{_0x5bb6a9[_0xec96('0x45')](_0x5bb6a9[_0xec96('0x4e')][_0x1cdad5['id']],_0x1cdad5);}}}return _0x5bb6a9[_0xec96('0x4e')];};};Realtime[_0xec96('0x3e')]['initVtigerAccounts']=function(){var _0x16e0d0=this;return function(_0x1d8b53){if(_0x1d8b53){freeIsNotKey(_0x1d8b53,_0x16e0d0['vtigerAccounts'],'id');for(var _0x1738d1=0x0,_0x354a7d={},_0x4f91e4={};_0x1738d1<_0x1d8b53[_0xec96('0x40')];_0x1738d1+=0x1){_0x354a7d=_0x1d8b53[_0x1738d1];if(_['isUndefined'](_0x16e0d0[_0xec96('0x1e')][_0x354a7d['id']])){_0x16e0d0[_0xec96('0x1e')][_0x354a7d['id']]=new VtigerAccount(_0x354a7d);}else{_0x16e0d0[_0xec96('0x45')](_0x16e0d0[_0xec96('0x1e')][_0x354a7d['id']],_0x354a7d);}}}return _0x16e0d0[_0xec96('0x1e')];};};Realtime[_0xec96('0x3e')][_0xec96('0x4f')]=function(){var _0xca8c05=this;return function(_0x43ec71){if(_0x43ec71){freeIsNotKey(_0x43ec71,_0xca8c05[_0xec96('0x1f')],'id');for(var _0x31a97b=0x0,_0x536a16={},_0x31df2c={};_0x31a97b<_0x43ec71[_0xec96('0x40')];_0x31a97b+=0x1){_0x536a16=_0x43ec71[_0x31a97b];if(_['isUndefined'](_0xca8c05['servicenowAccounts'][_0x536a16['id']])){_0xca8c05[_0xec96('0x1f')][_0x536a16['id']]=new ServicenowAccount(_0x536a16);}else{_0xca8c05['mergeFromDatabase'](_0xca8c05['servicenowAccounts'][_0x536a16['id']],_0x536a16);}}}return _0xca8c05['servicenowAccounts'];};};Realtime[_0xec96('0x3e')][_0xec96('0x50')]=function(){var _0x1ccf94=this;return function(_0x49357e){if(_0x49357e){freeIsNotKey(_0x49357e,_0x1ccf94[_0xec96('0x20')],'id');for(var _0x3be326=0x0,_0x25b2b8={},_0x47a8b0={};_0x3be326<_0x49357e[_0xec96('0x40')];_0x3be326+=0x1){_0x25b2b8=_0x49357e[_0x3be326];if(_[_0xec96('0x41')](_0x1ccf94[_0xec96('0x20')][_0x25b2b8['id']])){_0x1ccf94['dynamics365Accounts'][_0x25b2b8['id']]=new Dynamics365Account(_0x25b2b8);}else{_0x1ccf94[_0xec96('0x45')](_0x1ccf94[_0xec96('0x20')][_0x25b2b8['id']],_0x25b2b8);}}}return _0x1ccf94[_0xec96('0x20')];};};Realtime[_0xec96('0x3e')][_0xec96('0x51')]=function(){var _0x2ccd16=this;return function(_0x322ff5){if(_0x322ff5){freeIsNotKey(_0x322ff5,_0x2ccd16[_0xec96('0x21')],'id');for(var _0x4d15b5=0x0,_0x5ec678={},_0xae4d18={};_0x4d15b5<_0x322ff5[_0xec96('0x40')];_0x4d15b5+=0x1){_0x5ec678=_0x322ff5[_0x4d15b5];if(_[_0xec96('0x41')](_0x2ccd16[_0xec96('0x21')][_0x5ec678['id']])){_0x2ccd16[_0xec96('0x21')][_0x5ec678['id']]=new FreshsalesAccount(_0x5ec678);}else{_0x2ccd16['mergeFromDatabase'](_0x2ccd16[_0xec96('0x21')][_0x5ec678['id']],_0x5ec678);}}}return _0x2ccd16['freshsalesAccounts'];};};Realtime[_0xec96('0x3e')][_0xec96('0x52')]=function(){var _0x45f48f=this;return function(_0x1f051e){for(var _0x106c64=0x0;_0x106c64<_0x1f051e[_0xec96('0x40')];_0x106c64+=0x1){_[_0xec96('0x53')](_0x45f48f[_0xec96('0x13')][_0x1f051e[_0x106c64][_0xec96('0x24')]],_0x1f051e[_0x106c64]);}return _0x45f48f['voiceQueues'];};};Realtime[_0xec96('0x3e')][_0xec96('0x54')]=function(){var _0x771a4d=this;return function(_0x1835a2){clearVoiceQueues(_0x771a4d[_0xec96('0x13')]);if(_0x1835a2){_0x1835a2=_[_0xec96('0x55')](_0x1835a2,_0xec96('0x56'));for(var _0x524e06 in _0x1835a2){if(_0x1835a2[_0xec96('0x25')](_0x524e06)){var _0x4716f1={};for(var _0x34ca46=0x0;_0x34ca46<_0x1835a2[_0x524e06][_0xec96('0x40')];_0x34ca46+=0x1){var _0x3fbb6e=_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x57')];if(_0x771a4d[_0xec96('0x13')][_0x3fbb6e]){if(_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x58')]){_0x771a4d['voiceQueues'][_0x3fbb6e][_0xec96('0x2f')]+=0x1;}if(_0x1835a2[_0x524e06][_0x34ca46]['queuecallerabandon']){_0x771a4d['voiceQueues'][_0x3fbb6e][_0xec96('0x30')]+=0x1;}_0x771a4d[_0xec96('0x13')][_0x3fbb6e][_0xec96('0x2b')]+=moment(_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x59')])[_0xec96('0x5a')](moment(_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x5b')]),_0xec96('0x5c'))||0x0;if(_0x34ca46===_0x1835a2[_0x524e06][_0xec96('0x40')]-0x1){_0x771a4d[_0xec96('0x13')][_0x3fbb6e]['sumDuration']+=moment(_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x5d')]||_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x5e')]||_0x1835a2[_0x524e06][_0x34ca46]['queuecallerexitAt'])[_0xec96('0x5a')](moment(_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x5b')]),'seconds')||0x0;_0x771a4d[_0xec96('0x13')][_0x3fbb6e][_0xec96('0x29')]+=0x1;if(_0x1835a2[_0x524e06][_0x34ca46]['queuecallercomplete']){_0x771a4d[_0xec96('0x13')][_0x3fbb6e][_0xec96('0x2a')]+=0x1;_0x771a4d[_0xec96('0x13')][_0x3fbb6e][_0xec96('0x31')]+=moment(_0x1835a2[_0x524e06][_0x34ca46][_0xec96('0x5d')])[_0xec96('0x5a')](moment(_0x1835a2[_0x524e06][_0x34ca46]['queuecallerleaveAt']),_0xec96('0x5c'))||0x0;}}else{_0x771a4d[_0xec96('0x13')][_0x3fbb6e][_0xec96('0x2c')]+=_0x771a4d[_0xec96('0x13')][_0x3fbb6e]['sumHoldTime']||0x0;}}}}}}return _0x771a4d[_0xec96('0x13')];};};Realtime['prototype'][_0xec96('0x5f')]=function(){var _0xd52c42=this;return function(_0x295447){clearVoiceCallReports(_0xd52c42[_0xec96('0x60')]);if(_0x295447){for(var _0xc13df7=0x0;_0xc13df7<_0x295447[_0xec96('0x40')];_0xc13df7+=0x1){_0xd52c42[_0xec96('0x60')][_0xec96('0x29')]+=0x1;_0xd52c42[_0xec96('0x60')][_0xec96('0x2c')]+=_0x295447[_0xc13df7][_0xec96('0x61')];if(_0x295447[_0xc13df7][_0xec96('0x62')]==='ANSWERED'){_0xd52c42[_0xec96('0x60')][_0xec96('0x2a')]+=0x1;_0xd52c42[_0xec96('0x60')][_0xec96('0x2b')]+=_0x295447[_0xc13df7][_0xec96('0x61')]-_0x295447[_0xc13df7][_0xec96('0x63')]||0x0;_0xd52c42[_0xec96('0x60')][_0xec96('0x31')]+=_0x295447[_0xc13df7][_0xec96('0x63')];}}}return _0xd52c42['outbound'];};};Realtime[_0xec96('0x3e')][_0xec96('0x64')]=function(){var _0x4f6af9=this;return function(_0x516820){if(_0x516820){freeIsNotKey(_0x516820,_0x4f6af9[_0xec96('0x15')],_0xec96('0x24'));for(var _0xffd6ed=0x0,_0x4a376e={};_0xffd6ed<_0x516820['length'];_0xffd6ed+=0x1){_0x4a376e=_0x516820[_0xffd6ed];if(_[_0xec96('0x41')](_0x4f6af9[_0xec96('0x15')][_0x4a376e[_0xec96('0x24')]])){_0x4f6af9[_0xec96('0x15')][_0x4a376e['name']]=new Campaign(_0x4a376e);}else{_0x4f6af9['mergeFromDatabase'](_0x4f6af9['campaigns'][_0x4a376e[_0xec96('0x24')]],_0x4a376e);_0x4f6af9['campaigns'][_0x4a376e['name']][_0xec96('0x65')]=_0x4a376e[_0xec96('0x66')]?_0x4a376e[_0xec96('0x66')][_0xec96('0x24')]:undefined;}}}return _0x4f6af9[_0xec96('0x15')];};};Realtime[_0xec96('0x3e')][_0xec96('0x67')]=function(){var _0x2cc61b=this;return function(_0x96416){if(_0x96416){freeIsNotKey(_0x96416,_0x2cc61b['voiceExtensions'],'id');for(var _0x9313b1=0x0,_0x22e377={};_0x9313b1<_0x96416[_0xec96('0x40')];_0x9313b1+=0x1){_0x22e377=_0x96416[_0x9313b1];if(_[_0xec96('0x41')](_0x2cc61b[_0xec96('0x68')][_0x22e377['id']])){_0x2cc61b[_0xec96('0x68')][_0x22e377['id']]=new VoiceExtension(_0x22e377);}else{_0x2cc61b[_0xec96('0x45')](_0x2cc61b[_0xec96('0x68')][_0x22e377['id']],_0x22e377);}}}return _0x2cc61b[_0xec96('0x68')];};};Realtime[_0xec96('0x3e')][_0xec96('0x69')]=function(){var _0x47e0c3=this;return function(_0x561d58){clearCampaigns(_0x47e0c3[_0xec96('0x15')]);for(var _0x48eef7=0x0;_0x48eef7<_0x561d58[_0xec96('0x40')];_0x48eef7+=0x1){_[_0xec96('0x53')](_0x47e0c3[_0xec96('0x15')][_0x561d58[_0x48eef7][_0xec96('0x24')]],_0x561d58[_0x48eef7]);}return _0x47e0c3[_0xec96('0x15')];};};Realtime[_0xec96('0x3e')][_0xec96('0x6a')]=function(){var _0x27b28d=this;return function(_0x34ac29){if(_0x34ac29){freeIsNotKey(_0x34ac29,_0x27b28d['faxAccounts'],'id');for(var _0x51dd0e=0x0,_0x7ccc5d={},_0x200b27={};_0x51dd0e<_0x34ac29[_0xec96('0x40')];_0x51dd0e+=0x1){_0x7ccc5d=_0x34ac29[_0x51dd0e];if(_[_0xec96('0x41')](_0x27b28d[_0xec96('0x6b')][_0x7ccc5d['id']])){_0x27b28d[_0xec96('0x6b')][_0x7ccc5d['id']]=new FaxAccount(_0x7ccc5d);}else{_0x27b28d[_0xec96('0x45')](_0x27b28d[_0xec96('0x6b')][_0x7ccc5d['id']],_0x7ccc5d);}}}return _0x27b28d[_0xec96('0x6b')];};};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 33de1ab..e80a52c 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 _0x71d7=['voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','find','interface','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','internal','type','dialer','queue','context','from-voip-provider','destination','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','isNil','UserId','monitorFilename','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport'];(function(_0x36628f,_0x39c3d0){var _0x4d7fef=function(_0x4ed19c){while(--_0x4ed19c){_0x36628f['push'](_0x36628f['shift']());}};_0x4d7fef(++_0x39c3d0);}(_0x71d7,0x1bf));var _0x771d=function(_0x50f689,_0x12656c){_0x50f689=_0x50f689-0x0;var _0x5d95e7=_0x71d7[_0x50f689];return _0x5d95e7;};'use strict';var _=require(_0x771d('0x0'));var moment=require(_0x771d('0x1'));var util=require(_0x771d('0x2'));var config=require(_0x771d('0x3'));var ami=require(_0x771d('0x4'));var RpcVoiceAgentReport=require(_0x771d('0x5'));var RpcVoiceCallReport=require(_0x771d('0x6'));var RpcVoiceDialReport=require(_0x771d('0x7'));var RpcMemberReport=require(_0x771d('0x8'));var RpcVoiceQueueReport=require(_0x771d('0x9'));var RpcVoiceRecording=require(_0x771d('0xa'));var RpcVoiceTransferReport=require(_0x771d('0xb'));var VoiceQueueReport=require(_0x771d('0xc'));var VoiceCallReport=require(_0x771d('0xd'));var VoiceAgentReport=require(_0x771d('0xe'));var VoiceDialReport=require(_0x771d('0xf'));var UserReport=require(_0x771d('0x10'));function Report(_0x42639a){this[_0x771d('0x11')]=_0x42639a;this[_0x771d('0x12')]=_0x42639a[_0x771d('0x12')];this[_0x771d('0x13')]=_0x42639a[_0x771d('0x13')];}Report[_0x771d('0x14')][_0x771d('0x15')]=function(_0x3619db){var _0x2287db=new VoiceQueueReport(this['realtime']);var _0x42ff55=new VoiceAgentReport(this[_0x771d('0x11')]);var _0x568a1d=new VoiceDialReport(this[_0x771d('0x11')]);var _0x66d83a=new VoiceCallReport(this[_0x771d('0x11')]);var _0x5a5441=new UserReport(this[_0x771d('0x11')]);if(config[_0x771d('0x16')]&&config[_0x771d('0x16')][_0x771d('0x17')]){ami['on'](_0x771d('0x18'),this[_0x771d('0x19')][_0x771d('0x1a')](this));ami['on'](_0x771d('0x1b'),this[_0x771d('0x1c')][_0x771d('0x1a')](this));ami['on'](_0x771d('0x1d'),this[_0x771d('0x1e')]['bind'](this));ami['on'](_0x771d('0x1f'),this['voiceDialReport'][_0x771d('0x1a')](this));ami['on']('blindtransfer',this[_0x771d('0x20')][_0x771d('0x1a')](this));ami['on'](_0x771d('0x21'),this[_0x771d('0x22')][_0x771d('0x1a')](this));}};Report[_0x771d('0x14')][_0x771d('0x23')]=function(_0x3b00fb){var _0x2b889a;_0x2b889a=_['find'](this[_0x771d('0x12')],function(_0x5c6dea){return _0x5c6dea[_0x771d('0x24')]==_0x3b00fb||_0x5c6dea[_0x771d('0x25')]==_0x3b00fb;});if(_['isNil'](_0x2b889a)){var _0x214b52=_[_0x771d('0x26')](this[_0x771d('0x13')],function(_0x4504d9){return _0x4504d9[_0x771d('0x24')]==_0x3b00fb||_0x4504d9[_0x771d('0x25')]==_0x3b00fb;});if(_0x214b52){_0x2b889a=_['find'](this['agents'],function(_0x6f1901){return _0x6f1901[_0x771d('0x27')]==util['format'](_0x771d('0x28'),_0x214b52['name']);});}}return _0x2b889a;};Report[_0x771d('0x14')][_0x771d('0x19')]=function(_0xbd3dae){for(var _0x33e583=0x0;_0x33e583<_0xbd3dae[_0x771d('0x29')];_0x33e583+=0x1){var _0x28a6c6=this[_0x771d('0x23')](_0xbd3dae[_0x33e583][_0x771d('0x2a')]);if(_0x28a6c6){_0xbd3dae[_0x33e583][_0x771d('0x24')]=_0x28a6c6['accountcode'];_0xbd3dae[_0x33e583][_0x771d('0x2b')]=!![];_0xbd3dae[_0x33e583][_0x771d('0x2c')]=_0x28a6c6[_0x771d('0x25')];_0xbd3dae[_0x33e583][_0x771d('0x27')]=_['isNil'](_0x28a6c6[_0x771d('0x27')])?util[_0x771d('0x2d')](_0x771d('0x28'),_0x28a6c6['name']):_0x28a6c6[_0x771d('0x27')];if(_0xbd3dae[_0x33e583][_0x771d('0x2e')]){_0xbd3dae[_0x33e583]['queuecallercompleteAt']=moment()[_0x771d('0x2d')](_0x771d('0x2f'));}if(_0xbd3dae[_0x33e583]['queuecallerexit']){_0xbd3dae[_0x33e583][_0x771d('0x30')]=moment()['format'](_0x771d('0x2f'));}RpcMemberReport[_0x771d('0x19')](_0xbd3dae[_0x33e583]);}RpcVoiceQueueReport[_0x771d('0x31')](_0xbd3dae[_0x33e583]);}};function extractCalleridNumber(_0x17447c){var _0x46fd66=_0x17447c[_0x771d('0x32')](/<(.*?)>/);return _0x46fd66?_0x46fd66[0x1]:_0x17447c;}Report['prototype'][_0x771d('0x33')]=function(_0x3f45ce){for(var _0x18dbb5=0x0;_0x18dbb5','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','find','name','isNil','accountcode','interface','format','SIP/%s','voiceQueueReport','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','split','outbound','internal','destination'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x20a5,0xe4));var _0x520a=function(_0x32329c,_0x3e3863){_0x32329c=_0x32329c-0x0;var _0x11e469=_0x20a5[_0x32329c];return _0x11e469;};'use strict';var _=require(_0x520a('0x0'));var moment=require(_0x520a('0x1'));var util=require(_0x520a('0x2'));var config=require(_0x520a('0x3'));var ami=require(_0x520a('0x4'));var RpcVoiceAgentReport=require(_0x520a('0x5'));var RpcVoiceCallReport=require(_0x520a('0x6'));var RpcVoiceDialReport=require(_0x520a('0x7'));var RpcMemberReport=require(_0x520a('0x8'));var RpcVoiceQueueReport=require(_0x520a('0x9'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x520a('0xa'));var VoiceCallReport=require(_0x520a('0xb'));var VoiceAgentReport=require(_0x520a('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x4382a6){this[_0x520a('0xd')]=_0x4382a6;this[_0x520a('0xe')]=_0x4382a6['agents'];this['telephones']=_0x4382a6[_0x520a('0xf')];}Report[_0x520a('0x10')][_0x520a('0x11')]=function(_0x56ba48){var _0x55c991=new VoiceQueueReport(this[_0x520a('0xd')]);var _0x24767e=new VoiceAgentReport(this[_0x520a('0xd')]);var _0x36dc9e=new VoiceDialReport(this[_0x520a('0xd')]);var _0x49de66=new VoiceCallReport(this['realtime']);var _0x361e20=new UserReport(this[_0x520a('0xd')]);if(config[_0x520a('0x12')]&&config[_0x520a('0x12')][_0x520a('0x13')]){ami['on'](_0x520a('0x14'),this['voiceQueueReport'][_0x520a('0x15')](this));ami['on'](_0x520a('0x16'),this[_0x520a('0x17')][_0x520a('0x15')](this));ami['on'](_0x520a('0x18'),this[_0x520a('0x19')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x520a('0x1a')][_0x520a('0x15')](this));ami['on'](_0x520a('0x1b'),this[_0x520a('0x1c')][_0x520a('0x15')](this));ami['on']('attendedtransfer',this[_0x520a('0x1d')]['bind'](this));}};Report[_0x520a('0x10')]['findAgent']=function(_0x18fcf0){var _0x207baa;_0x207baa=_[_0x520a('0x1e')](this[_0x520a('0xe')],function(_0x23de8b){return _0x23de8b['accountcode']==_0x18fcf0||_0x23de8b[_0x520a('0x1f')]==_0x18fcf0;});if(_[_0x520a('0x20')](_0x207baa)){var _0x5170d1=_[_0x520a('0x1e')](this[_0x520a('0xf')],function(_0x370484){return _0x370484[_0x520a('0x21')]==_0x18fcf0||_0x370484['name']==_0x18fcf0;});if(_0x5170d1){_0x207baa=_[_0x520a('0x1e')](this[_0x520a('0xe')],function(_0x5a7b2f){return _0x5a7b2f[_0x520a('0x22')]==util[_0x520a('0x23')](_0x520a('0x24'),_0x5170d1[_0x520a('0x1f')]);});}}return _0x207baa;};Report[_0x520a('0x10')][_0x520a('0x25')]=function(_0x31d63d){for(var _0x39f23b=0x0;_0x39f23b<_0x31d63d[_0x520a('0x26')];_0x39f23b+=0x1){var _0x45c1e3=this[_0x520a('0x27')](_0x31d63d[_0x39f23b][_0x520a('0x28')]);if(_0x45c1e3){_0x31d63d[_0x39f23b][_0x520a('0x21')]=_0x45c1e3['accountcode'];_0x31d63d[_0x39f23b][_0x520a('0x29')]=!![];_0x31d63d[_0x39f23b][_0x520a('0x2a')]=_0x45c1e3[_0x520a('0x1f')];_0x31d63d[_0x39f23b][_0x520a('0x22')]=_[_0x520a('0x20')](_0x45c1e3['interface'])?util[_0x520a('0x23')](_0x520a('0x24'),_0x45c1e3[_0x520a('0x1f')]):_0x45c1e3[_0x520a('0x22')];if(_0x31d63d[_0x39f23b][_0x520a('0x2b')]){_0x31d63d[_0x39f23b]['queuecallercompleteAt']=moment()['format'](_0x520a('0x2c'));}if(_0x31d63d[_0x39f23b][_0x520a('0x2d')]){_0x31d63d[_0x39f23b][_0x520a('0x2e')]=moment()['format'](_0x520a('0x2c'));}RpcMemberReport[_0x520a('0x25')](_0x31d63d[_0x39f23b]);}RpcVoiceQueueReport['create'](_0x31d63d[_0x39f23b]);}};function extractCalleridNumber(_0x44dfde){var _0x25d590=_0x44dfde[_0x520a('0x2f')](/<(.*?)>/);return _0x25d590?_0x25d590[0x1]:_0x44dfde;}Report[_0x520a('0x10')][_0x520a('0x30')]=function(_0x2af3ea){for(var _0x32cf57=0x0;_0x32cf570x0?_0x57f0ba:0x0;this[_0xd6ec('0x11')][_0x1a326f[_0xd6ec('0x67')]][_0xd6ec('0x2e')]=this[_0xd6ec('0x11')][_0x1a326f['queue']]['talking']>_['toNumber'](_0x1a326f[_0xd6ec('0x6d')])?_[_0xd6ec('0x6b')](_0x1a326f[_0xd6ec('0x6d')]):this['voiceQueues'][_0x1a326f[_0xd6ec('0x67')]][_0xd6ec('0x2e')];this['emitVoiceQueueSummary'](this[_0xd6ec('0x11')][_0x1a326f[_0xd6ec('0x67')]],_0xd6ec('0x15'));}logger[_0xd6ec('0x43')](_0xd6ec('0x6e'),util[_0xd6ec('0x3b')](this[_0xd6ec('0x11')][_0x1a326f['queue']],{'showHidden':![],'depth':null}));ami[_0xd6ec('0x41')](_0xd6ec('0x6f'),this['voiceQueues'][_0x1a326f[_0xd6ec('0x67')]]);}}}catch(_0x275859){logger[_0xd6ec('0x3a')](_0xd6ec('0x70'),util['inspect'](_0x275859,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ec('0xa')][_0xd6ec('0x18')]=function(_0x40989e){logger[_0xd6ec('0x43')](_0xd6ec('0x71'),util['inspect'](_0x40989e,{'showHidden':![],'depth':null}));ami[_0xd6ec('0x41')](_0xd6ec('0x72'),{});this[_0xd6ec('0x12')]=!![];};VoiceQueueReport[_0xd6ec('0xa')][_0xd6ec('0x1a')]=function(_0x28d44c){try{if(this[_0xd6ec('0x65')](_0x28d44c)){logger['debug'](_0xd6ec('0x73'),_0x28d44c[_0xd6ec('0x45')],util[_0xd6ec('0x3b')](_0x28d44c,{'showHidden':![],'depth':null}));if(_[_0xd6ec('0x5f')](this[_0xd6ec('0x3c')][_0x28d44c[_0xd6ec('0x45')]]))this['queueReports'][_0x28d44c[_0xd6ec('0x45')]]=[];if(_[_0xd6ec('0x5f')](this[_0xd6ec('0x34')][_0x28d44c[_0xd6ec('0x45')]]))this[_0xd6ec('0x34')][_0x28d44c[_0xd6ec('0x45')]]={};var _0x4e9c25=new QueueReport();_0x4e9c25[_0xd6ec('0x48')]=_0x28d44c[_0xd6ec('0x67')];_0x4e9c25[_0xd6ec('0x4f')]=this['voiceQueues'][_0x4e9c25[_0xd6ec('0x48')]]&&this['voiceQueues'][_0x4e9c25[_0xd6ec('0x48')]][_0xd6ec('0x4f')]?this[_0xd6ec('0x11')][_0x4e9c25[_0xd6ec('0x48')]]['type']||'inbound':_0xd6ec('0x74');_0x4e9c25[_0xd6ec('0x67')]=_0x28d44c[_0xd6ec('0x67')];_0x4e9c25[_0xd6ec('0x75')]=moment()[_0xd6ec('0x46')](_0xd6ec('0x76'));_0x4e9c25[_0xd6ec('0x77')]=_0x28d44c[_0xd6ec('0x77')];_0x4e9c25[_0xd6ec('0x78')]=_0x28d44c[_0xd6ec('0x78')];_0x4e9c25[_0xd6ec('0x45')]=_0x28d44c[_0xd6ec('0x45')];_0x4e9c25['routealias']=this[_0xd6ec('0x34')][_0x28d44c[_0xd6ec('0x45')]]['routealias'];logger[_0xd6ec('0x79')](_0xd6ec('0x7a'),_0x4e9c25[_0xd6ec('0x48')],_0x4e9c25[_0xd6ec('0x4f')]);_[_0xd6ec('0x7b')](_0x4e9c25,_['pick'](_0x28d44c,_[_0xd6ec('0x7c')](_0x4e9c25)));this[_0xd6ec('0x3c')][_0x28d44c['uniqueid']][_0xd6ec('0x7d')](_0x4e9c25);this[_0xd6ec('0x34')][_0x28d44c[_0xd6ec('0x45')]]=_0x4e9c25;this[_0xd6ec('0x42')](_0x4e9c25,_0xd6ec('0x19'));}}catch(_0x4c942a){logger[_0xd6ec('0x3a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x28d44c[_0xd6ec('0x45')],util['inspect'](_0x4c942a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd6ec('0x1c')]=function(_0x322f6f){try{if(this[_0xd6ec('0x65')](_0x322f6f)){logger[_0xd6ec('0x43')](_0xd6ec('0x7e'),_0x322f6f[_0xd6ec('0x45')],util['inspect'](_0x322f6f,{'showHidden':![],'depth':null}));if(this[_0xd6ec('0x3c')][_0x322f6f[_0xd6ec('0x45')]]){var _0x1d2c26=_[_0xd6ec('0x7f')](this[_0xd6ec('0x3c')][_0x322f6f[_0xd6ec('0x45')]]);_0x1d2c26['queuecallercomplete']=![];_0x1d2c26[_0xd6ec('0x80')]=null;_0x1d2c26[_0xd6ec('0x81')]=_0x322f6f['holdtime'];_0x1d2c26[_0xd6ec('0x82')]=_0x322f6f[_0xd6ec('0x82')];_0x1d2c26[_0xd6ec('0x1b')]=!![];_0x1d2c26[_0xd6ec('0x83')]=moment()[_0xd6ec('0x46')](_0xd6ec('0x76'));_0x1d2c26[_0xd6ec('0x4b')]='ABANDONED';_0x1d2c26[_0xd6ec('0x84')]=null;logger[_0xd6ec('0x79')](_0xd6ec('0x85'),_0x1d2c26[_0xd6ec('0x48')],_0x1d2c26[_0xd6ec('0x4f')]);this['channels'][_0x322f6f[_0xd6ec('0x45')]]=_0x1d2c26;this[_0xd6ec('0x86')](_0x1d2c26,_0xd6ec('0x1b'));}}}catch(_0x3d8639){logger[_0xd6ec('0x3a')](_0xd6ec('0x7e'),_0x322f6f['uniqueid'],util[_0xd6ec('0x3b')](_0x3d8639,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd6ec('0x87')]=function(_0x255683){try{if(this[_0xd6ec('0x65')](_0x255683)){logger[_0xd6ec('0x43')](_0xd6ec('0x88'),_0x255683[_0xd6ec('0x45')],util[_0xd6ec('0x3b')](_0x255683,{'showHidden':![],'depth':null}));if(this[_0xd6ec('0x3c')][_0x255683[_0xd6ec('0x45')]]){var _0x39cc83=_[_0xd6ec('0x7f')](this[_0xd6ec('0x3c')][_0x255683[_0xd6ec('0x45')]]);_0x39cc83[_0xd6ec('0x89')]=moment()[_0xd6ec('0x46')](_0xd6ec('0x76'));_0x39cc83['connectedlinenum']=_0x255683[_0xd6ec('0x8a')];_0x39cc83['connectedlinename']=_0x255683[_0xd6ec('0x8b')];logger[_0xd6ec('0x79')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x39cc83[_0xd6ec('0x48')],_0x39cc83[_0xd6ec('0x4f')],_0x255683['connectedlinenum'],_0x255683['connectedlinename']);this['channels'][_0x255683[_0xd6ec('0x45')]]=_0x39cc83;this[_0xd6ec('0x42')](_0x39cc83,_0xd6ec('0x8c'));}}}catch(_0x46f60b){logger[_0xd6ec('0x3a')](_0xd6ec('0x88'),_0x255683[_0xd6ec('0x45')],util[_0xd6ec('0x3b')](_0x46f60b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ec('0xa')][_0xd6ec('0x8d')]=function(_0x563fc8){try{if(this[_0xd6ec('0x65')](_0x563fc8)){logger[_0xd6ec('0x43')](_0xd6ec('0x8e'),_0x563fc8['uniqueid'],util[_0xd6ec('0x3b')](_0x563fc8,{'showHidden':![],'depth':null}));if(this[_0xd6ec('0x3c')][_0x563fc8[_0xd6ec('0x45')]]){var _0x2f70a5=_[_0xd6ec('0x7f')](this[_0xd6ec('0x3c')][_0x563fc8[_0xd6ec('0x45')]]);_0x2f70a5['queuecallercomplete']=!![];_0x2f70a5[_0xd6ec('0x4b')]=_0xd6ec('0x8f');logger[_0xd6ec('0x79')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2f70a5[_0xd6ec('0x48')],_0x2f70a5[_0xd6ec('0x4f')]);}}}catch(_0x153710){logger[_0xd6ec('0x3a')](_0xd6ec('0x8e'),_0x563fc8['uniqueid'],util[_0xd6ec('0x3b')](_0x153710,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ec('0xa')]['syncAgentComplete']=function(_0x1598e2){try{if(this[_0xd6ec('0x65')](_0x1598e2)){logger['debug'](_0xd6ec('0x90'),_0x1598e2['uniqueid'],util['inspect'](_0x1598e2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1598e2[_0xd6ec('0x45')]]){var _0x417826=_[_0xd6ec('0x7f')](this[_0xd6ec('0x3c')][_0x1598e2[_0xd6ec('0x45')]]);_0x417826[_0xd6ec('0x1b')]=![];_0x417826[_0xd6ec('0x83')]=null;_0x417826['assigned']=!![];_0x417826[_0xd6ec('0x84')]=_0x1598e2[_0xd6ec('0x91')];_0x417826['holdtime']=_0x1598e2[_0xd6ec('0x81')];_0x417826[_0xd6ec('0x92')]=!![];_0x417826[_0xd6ec('0x93')]=![];_0x417826[_0xd6ec('0x94')]=null;if(!_0x417826['transfer']){if(_0x1598e2[_0xd6ec('0x95')]==_0xd6ec('0x96')){_0x417826['queuecallerexitreason']=_0xd6ec('0x97');logger[_0xd6ec('0x79')](_0xd6ec('0x98'),_0x417826[_0xd6ec('0x48')],_0x417826[_0xd6ec('0x4f')]);}else{if(_[_0xd6ec('0x99')](_0x1598e2['channel'][_0xd6ec('0x9a')](),_0xd6ec('0x9b'))){if(this['queueReports'][_0x1598e2['linkedid']]){var _0xaeccc5=_['last'](this['queueReports'][_0x1598e2[_0xd6ec('0x9c')]]);_0xaeccc5[_0xd6ec('0x92')]=![];_0xaeccc5[_0xd6ec('0x93')]=!![];_0xaeccc5[_0xd6ec('0x94')]=moment(_0x417826[_0xd6ec('0x75')])[_0xd6ec('0x9d')](_0x1598e2[_0xd6ec('0x81')],_0xd6ec('0x9e'))[_0xd6ec('0x46')](_0xd6ec('0x76'));_0xaeccc5[_0xd6ec('0x4b')]=_0xd6ec('0x9f');_0xaeccc5[_0xd6ec('0x96')]=!![];_0xaeccc5[_0xd6ec('0xa0')]=_0xd6ec('0xa1');_0xaeccc5[_0xd6ec('0xa2')]=_0x1598e2[_0xd6ec('0xa3')];_0xaeccc5[_0xd6ec('0xa4')]=_0x1598e2[_0xd6ec('0x45')];logger[_0xd6ec('0x79')](_0xd6ec('0xa5'),_0xaeccc5[_0xd6ec('0x48')],_0xaeccc5['type']);var _0x1cdb92=this[_0xd6ec('0x3c')][_0x1598e2[_0xd6ec('0x9c')]];this[_0xd6ec('0x3c')][_0x1598e2['linkedid']]=this[_0xd6ec('0x3c')][_0x1598e2[_0xd6ec('0x45')]];this[_0xd6ec('0x3c')][_0x1598e2[_0xd6ec('0x45')]]=_0x1cdb92;}}else{_0x417826[_0xd6ec('0x4b')]=_0xd6ec('0xa6')+_0x1598e2['reason'][_0xd6ec('0xa7')]();logger[_0xd6ec('0x79')](_0xd6ec('0xa8'),_0x417826['name'],_0x417826[_0xd6ec('0x4f')],_0x417826[_0xd6ec('0x4b')]);}}}this['channels'][_0x1598e2[_0xd6ec('0x45')]]=_0x417826;this[_0xd6ec('0x86')](_0x417826,_0xd6ec('0xa9'));}}}catch(_0x5738ce){logger[_0xd6ec('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x1598e2[_0xd6ec('0x45')],util[_0xd6ec('0x3b')](_0x5738ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ec('0xa')][_0xd6ec('0xaa')]=function(_0x1d6489){try{if(this[_0xd6ec('0x65')](_0x1d6489)){logger[_0xd6ec('0x43')](_0xd6ec('0xab'),_0x1d6489[_0xd6ec('0x45')],util[_0xd6ec('0x3b')](_0x1d6489,{'showHidden':![],'depth':null}));this[_0xd6ec('0xac')](_0x1d6489[_0xd6ec('0x45')],_[_0xd6ec('0x7c')](_0x1d6489[_0xd6ec('0xad')])[0x0],_0x1d6489[_0xd6ec('0xae')]);if(this[_0xd6ec('0x3c')][_0x1d6489[_0xd6ec('0x45')]]){var _0xa20b78=_[_0xd6ec('0x7f')](this[_0xd6ec('0x3c')][_0x1d6489[_0xd6ec('0x45')]]);if(_0xa20b78){if(this[_0xd6ec('0x65')](_0x1d6489['variable'])&&this[_0xd6ec('0x65')](_0x1d6489['variable'][_0xd6ec('0xaf')])){switch(_0x1d6489[_0xd6ec('0xae')]){case _0xd6ec('0xb0'):_0xa20b78[_0xd6ec('0x93')]=![];_0xa20b78[_0xd6ec('0x94')]=null;break;case'TIMEOUT':_0xa20b78[_0xd6ec('0xb1')]=_0xd6ec('0xb2');_0xa20b78[_0xd6ec('0x93')]=!![];_0xa20b78[_0xd6ec('0x94')]=moment()[_0xd6ec('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xa20b78[_0xd6ec('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd6ec('0x43')](_0xd6ec('0xb3'),_0x1d6489['uniqueid'],util['inspect'](_0xa20b78,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0xa20b78);break;default:_0xa20b78[_0xd6ec('0x93')]=!![];_0xa20b78[_0xd6ec('0x94')]=moment()[_0xd6ec('0x46')](_0xd6ec('0x76'));_0xa20b78[_0xd6ec('0x89')]=moment()[_0xd6ec('0x46')](_0xd6ec('0x76'));}_0xa20b78['queuecallerabandon']=![];_0xa20b78[_0xd6ec('0x83')]=null;_0xa20b78[_0xd6ec('0x4b')]=_0x1d6489[_0xd6ec('0xae')];this[_0xd6ec('0x34')][_0x1d6489[_0xd6ec('0x45')]]=_0xa20b78;this[_0xd6ec('0x86')](_0xa20b78,_0xd6ec('0x1f'));}else if(this['isNotNull'](_0x1d6489['variable'])&&this['isNotNull'](_0x1d6489[_0xd6ec('0xad')][_0xd6ec('0xb4')])){if(!_0xa20b78[_0xd6ec('0x1b')]){_0xa20b78[_0xd6ec('0x93')]=!![];_0xa20b78[_0xd6ec('0x94')]=moment()[_0xd6ec('0x46')](_0xd6ec('0x76'));_0xa20b78[_0xd6ec('0x4b')]=_0xd6ec('0xb5');_0xa20b78[_0xd6ec('0x89')]=moment()[_0xd6ec('0x46')](_0xd6ec('0x76'));this['channels'][_0x1d6489[_0xd6ec('0x45')]]=_0xa20b78;}}logger[_0xd6ec('0x79')](_0xd6ec('0xb6'),_0x1d6489[_0xd6ec('0x45')],_0xa20b78['name'],_0xa20b78[_0xd6ec('0x4f')],_[_0xd6ec('0x7c')](_0x1d6489['variable'])[0x0],_0x1d6489[_0xd6ec('0xae')]);_0xa20b78[_0xd6ec('0x14')]=this[_0xd6ec('0x14')][_0x1d6489[_0xd6ec('0x45')]];}}}}catch(_0x33c96b){logger['error']('[%s][voiceQueueReport][varset]',_0x1d6489['uniqueid'],util['inspect'](_0x33c96b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ec('0xa')]['addVariable']=function(_0x4cb8f6,_0x186263,_0x560175){var _0x49bf8e=[_0xd6ec('0xb7'),_0xd6ec('0xb8'),_0xd6ec('0xb9'),_0xd6ec('0xba'),_0xd6ec('0xbb'),_0xd6ec('0xbc'),_0xd6ec('0xbd'),_0xd6ec('0xbe'),'sipcallid',_0xd6ec('0xbf'),_0xd6ec('0xc0'),_0xd6ec('0xc1'),_0xd6ec('0xc2'),_0xd6ec('0xc3'),'memberinterface','memberlastcall',_0xd6ec('0x91'),_0xd6ec('0xc4'),_0xd6ec('0xc5')];if(!_[_0xd6ec('0x36')](_0x186263)&&!_[_0xd6ec('0xc6')](_0x49bf8e,_0x186263)){if(_[_0xd6ec('0x5f')](this[_0xd6ec('0x14')][_0x4cb8f6])){this['variables'][_0x4cb8f6]={};}this[_0xd6ec('0x14')][_0x4cb8f6][_0x186263]=_0x560175;}};VoiceQueueReport[_0xd6ec('0xa')][_0xd6ec('0xc7')]=function(_0x3a96fb,_0x468893,_0x1ee487){var _0x3fc50b={};for(var _0x59e205=0x0;_0x59e2050x0?_0x56357d:0x0;this[_0xba90('0x13')][_0x39a336[_0xba90('0x67')]][_0xba90('0x70')]=this[_0xba90('0x13')][_0x39a336['queue']][_0xba90('0x70')]>_[_0xba90('0x6d')](_0x39a336['loggedin'])?_[_0xba90('0x6d')](_0x39a336[_0xba90('0x6f')]):this[_0xba90('0x13')][_0x39a336[_0xba90('0x67')]][_0xba90('0x70')];this[_0xba90('0x71')](this[_0xba90('0x13')][_0x39a336[_0xba90('0x67')]],_0xba90('0x64'));}logger[_0xba90('0x5d')](_0xba90('0x72'),util[_0xba90('0x40')](this[_0xba90('0x13')][_0x39a336[_0xba90('0x67')]],{'showHidden':![],'depth':null}));ami[_0xba90('0x45')](_0xba90('0x73'),this[_0xba90('0x13')][_0x39a336[_0xba90('0x67')]]);}}}catch(_0x51aef2){logger['error'](_0xba90('0x66'),util[_0xba90('0x40')](_0x51aef2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xba90('0xb')][_0xba90('0x74')]=function(_0x2cbbd0){logger[_0xba90('0x5d')](_0xba90('0x75'),util['inspect'](_0x2cbbd0,{'showHidden':![],'depth':null}));ami[_0xba90('0x45')](_0xba90('0x76'),{});this[_0xba90('0x14')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2efc26){try{if(this[_0xba90('0x61')](_0x2efc26)){logger['debug'](_0xba90('0x77'),_0x2efc26[_0xba90('0x4b')],util['inspect'](_0x2efc26,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x2efc26['uniqueid']]))this[_0xba90('0x10')][_0x2efc26[_0xba90('0x4b')]]=[];if(_[_0xba90('0x62')](this[_0xba90('0x12')][_0x2efc26['uniqueid']]))this['channels'][_0x2efc26[_0xba90('0x4b')]]={};var _0x456b62=new QueueReport();_0x456b62[_0xba90('0x48')]=_0x2efc26[_0xba90('0x67')];_0x456b62[_0xba90('0x50')]=this[_0xba90('0x13')][_0x456b62[_0xba90('0x48')]]&&this[_0xba90('0x13')][_0x456b62[_0xba90('0x48')]][_0xba90('0x50')]?this[_0xba90('0x13')][_0x456b62[_0xba90('0x48')]]['type']||'inbound':_0xba90('0x51');_0x456b62[_0xba90('0x67')]=_0x2efc26['queue'];_0x456b62[_0xba90('0x78')]=moment()[_0xba90('0x4d')](_0xba90('0x79'));_0x456b62[_0xba90('0x7a')]=_0x2efc26[_0xba90('0x7a')];_0x456b62['count']=_0x2efc26['count'];_0x456b62[_0xba90('0x4b')]=_0x2efc26[_0xba90('0x4b')];_0x456b62[_0xba90('0x7b')]=this['channels'][_0x2efc26[_0xba90('0x4b')]][_0xba90('0x7b')];logger[_0xba90('0x69')](_0xba90('0x7c'),_0x456b62[_0xba90('0x48')],_0x456b62[_0xba90('0x50')]);_[_0xba90('0x7d')](_0x456b62,_[_0xba90('0x7e')](_0x2efc26,_[_0xba90('0x7f')](_0x456b62)));this['queueReports'][_0x2efc26[_0xba90('0x4b')]][_0xba90('0x80')](_0x456b62);this[_0xba90('0x12')][_0x2efc26[_0xba90('0x4b')]]=_0x456b62;this[_0xba90('0x81')](_0x456b62,_0xba90('0x1a'));}}catch(_0x4aebc6){logger[_0xba90('0x3e')](_0xba90('0x77'),_0x2efc26['uniqueid'],util['inspect'](_0x4aebc6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x353ab9){try{if(this[_0xba90('0x61')](_0x353ab9)){logger[_0xba90('0x5d')](_0xba90('0x82'),_0x353ab9[_0xba90('0x4b')],util[_0xba90('0x40')](_0x353ab9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x353ab9[_0xba90('0x4b')]]){var _0x562a9c=_['last'](this[_0xba90('0x10')][_0x353ab9[_0xba90('0x4b')]]);_0x562a9c[_0xba90('0x83')]=![];_0x562a9c[_0xba90('0x84')]=null;_0x562a9c[_0xba90('0x85')]=_0x353ab9[_0xba90('0x85')];_0x562a9c['originalposition']=_0x353ab9[_0xba90('0x86')];_0x562a9c[_0xba90('0x1c')]=!![];_0x562a9c[_0xba90('0x87')]=moment()[_0xba90('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x562a9c['queuecallerexitreason']='ABANDONED';_0x562a9c[_0xba90('0x88')]=null;logger[_0xba90('0x69')](_0xba90('0x89'),_0x562a9c[_0xba90('0x48')],_0x562a9c['type']);this['channels'][_0x353ab9[_0xba90('0x4b')]]=_0x562a9c;this[_0xba90('0x43')](_0x562a9c,_0xba90('0x1c'));}}}catch(_0x274215){logger[_0xba90('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x353ab9[_0xba90('0x4b')],util['inspect'](_0x274215,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xba90('0xb')]['syncQueueCallerLeave']=function(_0x49795b){try{if(this[_0xba90('0x61')](_0x49795b)){logger[_0xba90('0x5d')]('[%s][voiceQueueReport][queuecallerleave]',_0x49795b['uniqueid'],util[_0xba90('0x40')](_0x49795b,{'showHidden':![],'depth':null}));if(this[_0xba90('0x10')][_0x49795b[_0xba90('0x4b')]]){var _0x4c7545=_[_0xba90('0x8a')](this[_0xba90('0x10')][_0x49795b[_0xba90('0x4b')]]);_0x4c7545[_0xba90('0x8b')]=moment()[_0xba90('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c7545[_0xba90('0x8c')]=_0x49795b[_0xba90('0x8c')];_0x4c7545[_0xba90('0x8d')]=_0x49795b[_0xba90('0x8d')];logger[_0xba90('0x69')](_0xba90('0x8e'),_0x4c7545[_0xba90('0x48')],_0x4c7545[_0xba90('0x50')],_0x49795b[_0xba90('0x8c')],_0x49795b[_0xba90('0x8d')]);this['channels'][_0x49795b[_0xba90('0x4b')]]=_0x4c7545;this['emitVoiceQueueChannelSave'](_0x4c7545,_0xba90('0x1e'));}}}catch(_0x558724){logger[_0xba90('0x3e')](_0xba90('0x8f'),_0x49795b['uniqueid'],util[_0xba90('0x40')](_0x558724,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xba90('0xb')][_0xba90('0x22')]=function(_0x4c20d4){try{if(this[_0xba90('0x61')](_0x4c20d4)){logger[_0xba90('0x5d')](_0xba90('0x90'),_0x4c20d4['uniqueid'],util[_0xba90('0x40')](_0x4c20d4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4c20d4[_0xba90('0x4b')]]){var _0x47dbbe=_['last'](this[_0xba90('0x10')][_0x4c20d4[_0xba90('0x4b')]]);_0x47dbbe['queuecallercomplete']=!![];_0x47dbbe[_0xba90('0x91')]=_0xba90('0x92');logger[_0xba90('0x69')](_0xba90('0x93'),_0x47dbbe['name'],_0x47dbbe[_0xba90('0x50')]);}}}catch(_0x26d169){logger[_0xba90('0x3e')](_0xba90('0x90'),_0x4c20d4['uniqueid'],util[_0xba90('0x40')](_0x26d169,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xba90('0xb')][_0xba90('0x20')]=function(_0x346edb){try{if(this[_0xba90('0x61')](_0x346edb)){logger[_0xba90('0x5d')](_0xba90('0x94'),_0x346edb[_0xba90('0x4b')],util[_0xba90('0x40')](_0x346edb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x346edb[_0xba90('0x4b')]]){var _0x288283=_['last'](this[_0xba90('0x10')][_0x346edb['uniqueid']]);_0x288283[_0xba90('0x1c')]=![];_0x288283[_0xba90('0x87')]=null;_0x288283[_0xba90('0x95')]=!![];_0x288283[_0xba90('0x88')]=_0x346edb[_0xba90('0x96')];_0x288283[_0xba90('0x85')]=_0x346edb[_0xba90('0x85')];_0x288283[_0xba90('0x83')]=!![];_0x288283[_0xba90('0x97')]=![];_0x288283[_0xba90('0x98')]=null;if(!_0x288283['transfer']){if(_0x346edb[_0xba90('0x99')]=='transfer'){_0x288283[_0xba90('0x91')]=_0xba90('0x9a');logger[_0xba90('0x69')](_0xba90('0x9b'),_0x288283[_0xba90('0x48')],_0x288283[_0xba90('0x50')]);}else{if(_[_0xba90('0x9c')](_0x346edb[_0xba90('0x3b')][_0xba90('0x9d')](),_0xba90('0x9e'))){if(this[_0xba90('0x10')][_0x346edb[_0xba90('0x9f')]]){var _0x4abca0=_[_0xba90('0x8a')](this[_0xba90('0x10')][_0x346edb[_0xba90('0x9f')]]);_0x4abca0[_0xba90('0x83')]=![];_0x4abca0[_0xba90('0x97')]=!![];_0x4abca0['queuecallerexitAt']=moment(_0x288283[_0xba90('0x78')])['add'](_0x346edb[_0xba90('0x85')],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4abca0['queuecallerexitreason']=_0xba90('0xa0');_0x4abca0[_0xba90('0xa1')]=!![];_0x4abca0[_0xba90('0xa2')]='FORWARD';_0x4abca0[_0xba90('0xa3')]=_0x346edb[_0xba90('0xa4')];_0x4abca0[_0xba90('0xa5')]=_0x346edb['uniqueid'];logger['info'](_0xba90('0xa6'),_0x4abca0['name'],_0x4abca0[_0xba90('0x50')]);var _0x19258e=this['queueReports'][_0x346edb[_0xba90('0x9f')]];this[_0xba90('0x10')][_0x346edb[_0xba90('0x9f')]]=this[_0xba90('0x10')][_0x346edb['uniqueid']];this[_0xba90('0x10')][_0x346edb[_0xba90('0x4b')]]=_0x19258e;}}else{_0x288283[_0xba90('0x91')]=_0xba90('0xa7')+_0x346edb['reason'][_0xba90('0xa8')]();logger[_0xba90('0x69')](_0xba90('0xa9'),_0x288283[_0xba90('0x48')],_0x288283[_0xba90('0x50')],_0x288283[_0xba90('0x91')]);}}}this[_0xba90('0x12')][_0x346edb[_0xba90('0x4b')]]=_0x288283;this[_0xba90('0x43')](_0x288283,_0xba90('0x1f'));}}}catch(_0x41d334){logger[_0xba90('0x3e')](_0xba90('0x94'),_0x346edb[_0xba90('0x4b')],util[_0xba90('0x40')](_0x41d334,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xba90('0xb')][_0xba90('0x24')]=function(_0x39acee){try{if(this[_0xba90('0x61')](_0x39acee)){logger[_0xba90('0x5d')]('[%s][voiceQueueReport][varset]',_0x39acee['uniqueid'],util['inspect'](_0x39acee,{'showHidden':![],'depth':null}));this[_0xba90('0xaa')](_0x39acee[_0xba90('0x4b')],_[_0xba90('0x7f')](_0x39acee[_0xba90('0xab')])[0x0],_0x39acee[_0xba90('0xac')]);if(this['queueReports'][_0x39acee[_0xba90('0x4b')]]){var _0x1118e7=_[_0xba90('0x8a')](this[_0xba90('0x10')][_0x39acee[_0xba90('0x4b')]]);if(_0x1118e7){if(this[_0xba90('0x61')](_0x39acee[_0xba90('0xab')])&&this[_0xba90('0x61')](_0x39acee[_0xba90('0xab')][_0xba90('0xad')])){switch(_0x39acee[_0xba90('0xac')]){case'CONTINUE':_0x1118e7['queuecallerexit']=![];_0x1118e7[_0xba90('0x98')]=null;break;case _0xba90('0xae'):_0x1118e7[_0xba90('0xaf')]=_0xba90('0xb0');_0x1118e7[_0xba90('0x97')]=!![];_0x1118e7[_0xba90('0x98')]=moment()[_0xba90('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1118e7[_0xba90('0x8b')]=moment()['format'](_0xba90('0x79'));logger[_0xba90('0x5d')](_0xba90('0xb1'),_0x39acee[_0xba90('0x4b')],util['inspect'](_0x1118e7,{'showHidden':![],'depth':null}));ami[_0xba90('0x45')]('custom:timeout',_0x1118e7);break;default:_0x1118e7[_0xba90('0x97')]=!![];_0x1118e7[_0xba90('0x98')]=moment()['format'](_0xba90('0x79'));_0x1118e7[_0xba90('0x8b')]=moment()['format'](_0xba90('0x79'));}_0x1118e7['queuecallerabandon']=![];_0x1118e7['queuecallerabandonAt']=null;_0x1118e7[_0xba90('0x91')]=_0x39acee['value'];this[_0xba90('0x12')][_0x39acee['uniqueid']]=_0x1118e7;this[_0xba90('0x43')](_0x1118e7,_0xba90('0x23'));}else if(this['isNotNull'](_0x39acee[_0xba90('0xab')])&&this[_0xba90('0x61')](_0x39acee[_0xba90('0xab')][_0xba90('0xb2')])){if(!_0x1118e7['queuecallerabandon']){_0x1118e7[_0xba90('0x97')]=!![];_0x1118e7[_0xba90('0x98')]=moment()[_0xba90('0x4d')](_0xba90('0x79'));_0x1118e7[_0xba90('0x91')]=_0xba90('0xb3');_0x1118e7[_0xba90('0x8b')]=moment()[_0xba90('0x4d')](_0xba90('0x79'));this[_0xba90('0x12')][_0x39acee[_0xba90('0x4b')]]=_0x1118e7;}}logger[_0xba90('0x69')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x39acee[_0xba90('0x4b')],_0x1118e7['name'],_0x1118e7[_0xba90('0x50')],_['keys'](_0x39acee[_0xba90('0xab')])[0x0],_0x39acee[_0xba90('0xac')]);_0x1118e7[_0xba90('0x16')]=this[_0xba90('0x16')][_0x39acee[_0xba90('0x4b')]];}}}}catch(_0x50f9cf){logger['error'](_0xba90('0xb4'),_0x39acee[_0xba90('0x4b')],util[_0xba90('0x40')](_0x50f9cf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xba90('0xaa')]=function(_0x290fc0,_0x40ee31,_0x1abf5b){var _0x46a3a1=[_0xba90('0xb5'),_0xba90('0xb6'),'rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0xba90('0xb7'),_0xba90('0xb8'),_0xba90('0xb9'),'sipcallid',_0xba90('0xba'),_0xba90('0xbb'),'bridgepvtcallid',_0xba90('0xbc'),_0xba90('0xbd'),'memberinterface',_0xba90('0xbe'),_0xba90('0x96'),_0xba90('0xbf'),_0xba90('0xc0')];if(!_[_0xba90('0x38')](_0x40ee31)&&!_[_0xba90('0xc1')](_0x46a3a1,_0x40ee31)){if(_[_0xba90('0x62')](this[_0xba90('0x16')][_0x290fc0])){this[_0xba90('0x16')][_0x290fc0]={};}this[_0xba90('0x16')][_0x290fc0][_0x40ee31]=_0x1abf5b;}};VoiceQueueReport[_0xba90('0xb')]['handleHangup']=function(_0x107102,_0x53020f,_0x44b866){var _0x4cd62c={};for(var _0x4e0bc2=0x0;_0x4e0bc2=0x0?moment(_0x307513['endtime'])[_0xcabf('0xc')](_0x307513[_0xcabf('0x17')],_0xcabf('0xd')):null,'data1':_0xcabf('0x19'),'data2':_0x307513[_0xcabf('0x1a')],'data3':_0x307513['exten'],'data4':_0x307513['dialstring']||null,'role':_0xcabf('0x1b'),'internal':_0x307513[_0xcabf('0x1a')]?_[_0xcabf('0x11')](_0x307513[_0xcabf('0x1a')]):undefined,'uniqueid':_0x307513[_0xcabf('0x12')]},'log':_0xcabf('0x13')});}; \ No newline at end of file +var _0xc978=['voice','lastAssignedTo','isNil','interface','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','outbound','dialstring','moment','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport'];(function(_0x35e7f5,_0x505458){var _0x21327e=function(_0x24ee98){while(--_0x24ee98){_0x35e7f5['push'](_0x35e7f5['shift']());}};_0x21327e(++_0x505458);}(_0xc978,0x8e));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8c97('0x0'));var _=require('lodash');var util=require(_0x8c97('0x1'));var client=require(_0x8c97('0x2'));exports[_0x8c97('0x3')]=function(_0x2b7ee9){var _0x475d6a=_0x2b7ee9[_0x8c97('0x4')]||_0x2b7ee9[_0x8c97('0x5')];return client[_0x8c97('0x6')](_0x8c97('0x7'),{'body':{'channel':_0x8c97('0x8'),'membername':_0x2b7ee9[_0x8c97('0x9')],'interface':_[_0x8c97('0xa')](_0x2b7ee9[_0x8c97('0xb')])?util['format']('SIP/%s',_0x2b7ee9[_0x8c97('0x9')]):_0x2b7ee9['interface'],'type':'TALKING','enterAt':_0x2b7ee9[_0x8c97('0xc')],'exitAt':_0x475d6a,'duration':moment(_0x475d6a)[_0x8c97('0xd')](_0x2b7ee9['queuecallerleaveAt'],_0x8c97('0xe')),'data1':_0x8c97('0xf'),'data2':_0x2b7ee9[_0x8c97('0x10')],'data3':_0x2b7ee9[_0x8c97('0x11')],'data4':null,'data5':_0x2b7ee9[_0x8c97('0x12')],'role':_0x8c97('0x13'),'internal':_0x2b7ee9[_0x8c97('0x14')]?_[_0x8c97('0x15')](_0x2b7ee9[_0x8c97('0x14')]):undefined,'uniqueid':_0x2b7ee9[_0x8c97('0x16')]},'log':'CreateMemberReport'});};exports[_0x8c97('0x17')]=function(_0x5a424c){return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x5a424c[_0x8c97('0x18')],'interface':_0x5a424c['interface'],'type':_0x8c97('0x19'),'enterAt':_0x5a424c[_0x8c97('0x1a')],'exitAt':_0x5a424c[_0x8c97('0x1b')],'duration':moment(_0x5a424c[_0x8c97('0x1b')])[_0x8c97('0xd')](_0x5a424c[_0x8c97('0x1a')],_0x8c97('0xe'))>=0x0?moment(_0x5a424c[_0x8c97('0x1b')])[_0x8c97('0xd')](_0x5a424c['starttime'],_0x8c97('0xe')):null,'data1':_0x8c97('0x1c'),'data2':_0x5a424c[_0x8c97('0x14')],'data3':_0x5a424c['exten'],'data4':_0x5a424c[_0x8c97('0x1d')]||null,'role':'agent','internal':_0x5a424c['accountcode']?_['toNumber'](_0x5a424c[_0x8c97('0x14')]):undefined,'uniqueid':_0x5a424c[_0x8c97('0x16')]},'log':_0x8c97('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 097fa62..7343da9 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 _0x6b0e=['getSettings','Request','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x200891,_0x53ca1c){var _0x3b341f=function(_0x2306dc){while(--_0x2306dc){_0x200891['push'](_0x200891['shift']());}};_0x3b341f(++_0x53ca1c);}(_0x6b0e,0x185));var _0xe6b0=function(_0x15eafe,_0x159eac){_0x15eafe=_0x15eafe-0x0;var _0x58b619=_0x6b0e[_0x15eafe];return _0x58b619;};'use strict';var client=require(_0xe6b0('0x0'));exports[_0xe6b0('0x1')]=function(){return client[_0xe6b0('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe6b0('0x3'),'previewRecallmeReminderInterval']},'log':_0xe6b0('0x4')});}; \ No newline at end of file +var _0x97e7=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x97e7,0x1a1));var _0x797e=function(_0x7563c,_0x1e6e93){_0x7563c=_0x7563c-0x0;var _0x33a65f=_0x97e7[_0x7563c];return _0x33a65f;};'use strict';var client=require(_0x797e('0x0'));exports[_0x797e('0x1')]=function(){return client[_0x797e('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x797e('0x3'),_0x797e('0x4')]},'log':_0x797e('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2c4fe0a..461eb0c 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 _0x6ae8=['../client','Request','name','html','GetTemplate'];(function(_0x3adda4,_0x29794a){var _0x449d38=function(_0x4a8358){while(--_0x4a8358){_0x3adda4['push'](_0x3adda4['shift']());}};_0x449d38(++_0x29794a);}(_0x6ae8,0x190));var _0x86ae=function(_0x3d5fdc,_0x12bdfc){_0x3d5fdc=_0x3d5fdc-0x0;var _0x2a0a34=_0x6ae8[_0x3d5fdc];return _0x2a0a34;};'use strict';var client=require(_0x86ae('0x0'));exports['getTemplates']=function(_0x510b5d){return function(_0x8e5c63){return client[_0x86ae('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x86ae('0x2'),_0x86ae('0x3')]},'log':_0x86ae('0x4')});};}; \ No newline at end of file +var _0x4f34=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x4488db,_0xea7318){var _0x4f333b=function(_0x41d84f){while(--_0x41d84f){_0x4488db['push'](_0x4488db['shift']());}};_0x4f333b(++_0xea7318);}(_0x4f34,0xae));var _0x44f3=function(_0x528b5a,_0x419e6b){_0x528b5a=_0x528b5a-0x0;var _0x330446=_0x4f34[_0x528b5a];return _0x330446;};'use strict';var client=require(_0x44f3('0x0'));exports[_0x44f3('0x1')]=function(_0x20ebd6){return function(_0x39dd74){return client[_0x44f3('0x2')](_0x44f3('0x3'),{'options':{'raw':!![],'attributes':['id',_0x44f3('0x4'),_0x44f3('0x5')]},'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 222d0fd..4b194e1 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 _0x0de4=['data2','data5','../client','getTriggers','Request','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Actions','action'];(function(_0x30f97b,_0xd83ad4){var _0x1b820b=function(_0x548e20){while(--_0x548e20){_0x30f97b['push'](_0x30f97b['shift']());}};_0x1b820b(++_0xd83ad4);}(_0x0de4,0x82));var _0x40de=function(_0x1277f4,_0xa38b45){_0x1277f4=_0x1277f4-0x0;var _0x4ea289=_0x0de4[_0x1277f4];return _0x4ea289;};'use strict';var client=require(_0x40de('0x0'));exports[_0x40de('0x1')]=function(_0x1a5bf3){return function(_0x54f28f){return client[_0x40de('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x40de('0x3'),_0x40de('0x4'),_0x40de('0x5')],'include':[{'model':_0x40de('0x6'),'as':_0x40de('0x7'),'attributes':['id',_0x40de('0x8'),_0x40de('0x9'),_0x40de('0xa')]},{'model':_0x40de('0x6'),'as':_0x40de('0xb'),'attributes':['id',_0x40de('0x8'),_0x40de('0x9'),_0x40de('0xa')]},{'model':'Action','as':_0x40de('0xc'),'attributes':['id',_0x40de('0xd'),'data1',_0x40de('0xe'),'data3','data4',_0x40de('0xf'),'data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xfbdb=['data2','data6','../client','GetTrigger','name','Condition','AllConditions','AnyConditions','field','value','Action','action','data1'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfbdb,0xf9));var _0xbfbd=function(_0x2d4f4e,_0x43b3c2){_0x2d4f4e=_0x2d4f4e-0x0;var _0x5377b1=_0xfbdb[_0x2d4f4e];return _0x5377b1;};'use strict';var client=require(_0xbfbd('0x0'));exports['getTriggers']=function(_0x5c6976){return function(_0x4de8bd){return client['Request'](_0xbfbd('0x1'),{'options':{'raw':![],'attributes':['id',_0xbfbd('0x2'),'channel','status'],'include':[{'model':_0xbfbd('0x3'),'as':_0xbfbd('0x4'),'attributes':['id','field','operator','value']},{'model':_0xbfbd('0x3'),'as':_0xbfbd('0x5'),'attributes':['id',_0xbfbd('0x6'),'operator',_0xbfbd('0x7')]},{'model':_0xbfbd('0x8'),'as':'Actions','attributes':['id',_0xbfbd('0x9'),_0xbfbd('0xa'),_0xbfbd('0xb'),'data3','data4','data5',_0xbfbd('0xc'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1d42217..416e7c9 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 _0xfe60=['Request','GetTrunk','registry','defaultuser','getTrunks'];(function(_0x54c5b5,_0x1003e8){var _0x2a1825=function(_0x342c00){while(--_0x342c00){_0x54c5b5['push'](_0x54c5b5['shift']());}};_0x2a1825(++_0x1003e8);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x1cc66c,_0x11162c){_0x1cc66c=_0x1cc66c-0x0;var _0x19b537=_0xfe60[_0x1cc66c];return _0x19b537;};'use strict';var client=require('../client');exports[_0x0fe6('0x0')]=function(_0x55f382){return function(_0x31b64e){return client[_0x0fe6('0x1')](_0x0fe6('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x0fe6('0x3'),_0x0fe6('0x4')]},'log':_0x0fe6('0x2')});};}; \ No newline at end of file +var _0x1ef8=['name','registry','defaultuser','../client','GetTrunk'];(function(_0x122d50,_0x465835){var _0x390526=function(_0x4b37ee){while(--_0x4b37ee){_0x122d50['push'](_0x122d50['shift']());}};_0x390526(++_0x465835);}(_0x1ef8,0xd5));var _0x81ef=function(_0x5c8dce,_0x155f43){_0x5c8dce=_0x5c8dce-0x0;var _0x47f731=_0x1ef8[_0x5c8dce];return _0x47f731;};'use strict';var client=require(_0x81ef('0x0'));exports['getTrunks']=function(_0x5d7cb4){return function(_0x5637da){return client['Request'](_0x81ef('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x81ef('0x2'),_0x81ef('0x3'),_0x81ef('0x4')]},'log':_0x81ef('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index fb69a1f..e6e7c61 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x19fb39,_0x756511){var _0x4f6ca1=function(_0x5ab430){while(--_0x5ab430){_0x19fb39['push'](_0x19fb39['shift']());}};_0x4f6ca1(++_0x756511);}(_0xedd9,0xfc));var _0x9edd=function(_0x420a69,_0x1ce835){_0x420a69=_0x420a69-0x0;var _0x33d4f1=_0xedd9[_0x420a69];return _0x33d4f1;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _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(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe706,0xa3));var _0x6e70=function(_0x127c7e,_0x470192){_0x127c7e=_0x127c7e-0x0;var _0x45f955=_0xe706[_0x127c7e];return _0x45f955;};'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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 8c9c584..d4f0399 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 _0x6c08=['update','../client','create','Request','CreateVoiceAgentReport'];(function(_0x46ea77,_0x2fdae1){var _0x294b2b=function(_0x55f32f){while(--_0x55f32f){_0x46ea77['push'](_0x46ea77['shift']());}};_0x294b2b(++_0x2fdae1);}(_0x6c08,0x1be));var _0x86c0=function(_0x59a0ed,_0x265e09){_0x59a0ed=_0x59a0ed-0x0;var _0x486dc1=_0x6c08[_0x59a0ed];return _0x486dc1;};'use strict';var client=require(_0x86c0('0x0'));exports[_0x86c0('0x1')]=function(_0x14f9cf){return client[_0x86c0('0x2')](_0x86c0('0x3'),{'body':_0x14f9cf,'log':'CreateVoiceAgentReport'});};exports[_0x86c0('0x4')]=function(_0x313184,_0x284391,_0x341e43){return client[_0x86c0('0x2')]('UpdateVoiceAgentReport',{'body':_0x313184,'options':{'where':{'uniqueid':_0x284391,'interface':_0x341e43,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x85b8=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x20f8e2,_0x5c56a9){var _0x50cd43=function(_0x4f1d4c){while(--_0x4f1d4c){_0x20f8e2['push'](_0x20f8e2['shift']());}};_0x50cd43(++_0x5c56a9);}(_0x85b8,0x88));var _0x885b=function(_0x2e3378,_0x15e1c2){_0x2e3378=_0x2e3378-0x0;var _0x10438a=_0x85b8[_0x2e3378];return _0x10438a;};'use strict';var client=require(_0x885b('0x0'));exports[_0x885b('0x1')]=function(_0x52251f){return client[_0x885b('0x2')]('CreateVoiceAgentReport',{'body':_0x52251f,'log':_0x885b('0x3')});};exports[_0x885b('0x4')]=function(_0x3bf441,_0x2ce946,_0x1ee285){return client[_0x885b('0x2')](_0x885b('0x5'),{'body':_0x3bf441,'options':{'where':{'uniqueid':_0x2ce946,'interface':_0x1ee285,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0024080..5b089b0 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 _0xf049=['billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration'];(function(_0x1552ec,_0x250527){var _0x525473=function(_0x54b2b7){while(--_0x54b2b7){_0x1552ec['push'](_0x1552ec['shift']());}};_0x525473(++_0x250527);}(_0xf049,0x95));var _0x9f04=function(_0x3089da,_0x43a438){_0x3089da=_0x3089da-0x0;var _0x4225=_0xf049[_0x3089da];return _0x4225;};'use strict';var moment=require(_0x9f04('0x0'));var util=require(_0x9f04('0x1'));var _=require('lodash');var client=require(_0x9f04('0x2'));exports[_0x9f04('0x3')]=function(_0x5cb854){return client[_0x9f04('0x4')]('CreateVoiceCallReport',{'body':_['merge'](_0x5cb854,{'source':_0x5cb854[_0x9f04('0x5')],'destinationcontext':_0x5cb854[_0x9f04('0x6')],'callerid':_0x5cb854[_0x9f04('0x7')],'amaflags':_0x9f04('0x8')}),'log':_0x9f04('0x9')});};exports[_0x9f04('0xa')]=function(){return function(){return client[_0x9f04('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x9f04('0xb')],'createdAt':{'$between':[moment()[_0x9f04('0xc')](_0x9f04('0xd'))[_0x9f04('0xe')](_0x9f04('0xf')),moment()['endOf'](_0x9f04('0xd'))[_0x9f04('0xe')](_0x9f04('0xf'))]}},'attributes':[_0x9f04('0x10'),_0x9f04('0x11'),_0x9f04('0x12'),_0x9f04('0x13')]},'log':_0x9f04('0x14')});};}; \ No newline at end of file +var _0xa09a=['endOf','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xa09a,0x8b));var _0xaa09=function(_0x417d80,_0x1d3c16){_0x417d80=_0x417d80-0x0;var _0x429c46=_0xa09a[_0x417d80];return _0x429c46;};'use strict';var moment=require('moment');var util=require(_0xaa09('0x0'));var _=require('lodash');var client=require(_0xaa09('0x1'));exports[_0xaa09('0x2')]=function(_0x9cf753){return client[_0xaa09('0x3')](_0xaa09('0x4'),{'body':_[_0xaa09('0x5')](_0x9cf753,{'source':_0x9cf753[_0xaa09('0x6')],'destinationcontext':_0x9cf753['context'],'callerid':_0x9cf753['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0xaa09('0x7')]=function(){return function(){return client[_0xaa09('0x3')](_0xaa09('0x8'),{'options':{'where':{'type':[_0xaa09('0x9')],'createdAt':{'$between':[moment()[_0xaa09('0xa')](_0xaa09('0xb'))[_0xaa09('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xaa09('0xd')](_0xaa09('0xb'))[_0xaa09('0xc')](_0xaa09('0xe'))]}},'attributes':[_0xaa09('0xf'),'disposition',_0xaa09('0x10'),_0xaa09('0x11')]},'log':_0xaa09('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5102872..f6794ae 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 _0x0f37=['../client','Request','CreateVoiceDialReport'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x0f37,0x16e));var _0x70f3=function(_0x1390a0,_0x499668){_0x1390a0=_0x1390a0-0x0;var _0x359f67=_0x0f37[_0x1390a0];return _0x359f67;};'use strict';var client=require(_0x70f3('0x0'));exports['create']=function(_0x48400b){return client[_0x70f3('0x1')](_0x70f3('0x2'),{'body':_0x48400b,'log':_0x70f3('0x2')});}; \ No newline at end of file +var _0x2a5d=['CreateVoiceDialReport'];(function(_0x190419,_0x49cb98){var _0x2336f3=function(_0x1626ae){while(--_0x1626ae){_0x190419['push'](_0x190419['shift']());}};_0x2336f3(++_0x49cb98);}(_0x2a5d,0x177));var _0xd2a5=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2a5d[_0x5c2e3e];return _0x53f64a;};'use strict';var client=require('../client');exports['create']=function(_0x45370c){return client['Request'](_0xd2a5('0x0'),{'body':_0x45370c,'log':_0xd2a5('0x0')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b39836b..780f07e 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 _0xf72b=['recordingFormat','../client','Request','exten'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf72b,0x1d9));var _0xbf72=function(_0xd1a99,_0x10c425){_0xd1a99=_0xd1a99-0x0;var _0x4a8462=_0xf72b[_0xd1a99];return _0x4a8462;};'use strict';var client=require(_0xbf72('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xbf72('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xbf72('0x2'),_0xbf72('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x9d9b=['exten','getVoiceExtensions','Request'];(function(_0x132a9a,_0x4da489){var _0x9dd201=function(_0x20435d){while(--_0x20435d){_0x132a9a['push'](_0x132a9a['shift']());}};_0x9dd201(++_0x4da489);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x13ae73,_0x2c1439){_0x13ae73=_0x13ae73-0x0;var _0x216dd1=_0x9d9b[_0x13ae73];return _0x216dd1;};'use strict';var client=require('../client');exports[_0xb9d9('0x0')]=function(){return function(){return client[_0xb9d9('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xb9d9('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xb9d9('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 429d4cb..00a8f92 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 _0x0e82=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x0e82,0x169));var _0x20e8=function(_0x1013e3,_0xccc357){_0x1013e3=_0x1013e3-0x0;var _0x1b948c=_0x0e82[_0x1013e3];return _0x1b948c;};'use strict';var client=require(_0x20e8('0x0'));exports[_0x20e8('0x1')]=function(){return function(){return client['Request'](_0x20e8('0x2'),{'options':{'raw':![],'attributes':['id',_0x20e8('0x3'),_0x20e8('0x4'),'acwTimeout',_0x20e8('0x5'),_0x20e8('0x6'),_0x20e8('0x7'),'dialActive',_0x20e8('0x8'),_0x20e8('0x9'),'dialLimitQueue',_0x20e8('0xa'),'dialPredictiveOptimization',_0x20e8('0xb'),_0x20e8('0xc'),'dialOriginateCallerIdName',_0x20e8('0xd'),_0x20e8('0xe'),_0x20e8('0xf'),_0x20e8('0x10'),'dialQueueProject',_0x20e8('0x11'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x20e8('0x12'),'dialNoAnswerMaxRetry',_0x20e8('0x13'),_0x20e8('0x14'),'dialTimezone',_0x20e8('0x15'),_0x20e8('0x16'),_0x20e8('0x17'),_0x20e8('0x18'),_0x20e8('0x19'),_0x20e8('0x1a'),_0x20e8('0x1b'),_0x20e8('0x1c'),_0x20e8('0x1d'),_0x20e8('0x1e'),_0x20e8('0x1f'),_0x20e8('0x20'),_0x20e8('0x21'),'timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x20e8('0x22'),'monitor_format','strategy',_0x20e8('0x23'),'dialCutDigit',_0x20e8('0x24'),_0x20e8('0x25'),'dialDropMaxRetry',_0x20e8('0x26'),_0x20e8('0x27'),_0x20e8('0x28'),_0x20e8('0x29'),_0x20e8('0x2a'),_0x20e8('0x2b'),_0x20e8('0x2c'),_0x20e8('0x2d'),_0x20e8('0x2e'),_0x20e8('0x2f'),_0x20e8('0x30'),'dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':_0x20e8('0x31'),'as':_0x20e8('0x31'),'attributes':['id',_0x20e8('0x3'),_0x20e8('0x32'),_0x20e8('0x33')]},{'model':_0x20e8('0x34'),'as':_0x20e8('0x35'),'attributes':['id',_0x20e8('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x20e8('0x3'),_0x20e8('0x32'),'active']},{'model':_0x20e8('0x36'),'as':_0x20e8('0x36'),'attributes':['id',_0x20e8('0x3')],'include':[{'model':_0x20e8('0x36'),'as':'Intervals','attributes':['id',_0x20e8('0x3'),_0x20e8('0x37')]}]}]},'log':_0x20e8('0x1')});};}; \ No newline at end of file +var _0x4faa=['dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout'];(function(_0x285f58,_0x3835e6){var _0x12c062=function(_0x982c67){while(--_0x982c67){_0x285f58['push'](_0x285f58['shift']());}};_0x12c062(++_0x3835e6);}(_0x4faa,0xad));var _0xa4fa=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4faa[_0x4baae2];return _0x1a2285;};'use strict';var client=require(_0xa4fa('0x0'));exports[_0xa4fa('0x1')]=function(){return function(){return client[_0xa4fa('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xa4fa('0x3'),'acw',_0xa4fa('0x4'),_0xa4fa('0x5'),_0xa4fa('0x6'),_0xa4fa('0x7'),'dialActive',_0xa4fa('0x8'),_0xa4fa('0x9'),_0xa4fa('0xa'),'dialPowerLevel',_0xa4fa('0xb'),_0xa4fa('0xc'),_0xa4fa('0xd'),_0xa4fa('0xe'),_0xa4fa('0xf'),_0xa4fa('0x10'),_0xa4fa('0x11'),_0xa4fa('0x12'),_0xa4fa('0x13'),'dialCongestionMaxRetry',_0xa4fa('0x14'),_0xa4fa('0x15'),_0xa4fa('0x16'),_0xa4fa('0x17'),_0xa4fa('0x18'),_0xa4fa('0x19'),_0xa4fa('0x1a'),'dialGlobalInterval',_0xa4fa('0x1b'),_0xa4fa('0x1c'),_0xa4fa('0x1d'),'dialAMDInitialSilence','dialAMDGreeting',_0xa4fa('0x1e'),_0xa4fa('0x1f'),_0xa4fa('0x20'),_0xa4fa('0x21'),'dialAMDMaximumNumberOfWords',_0xa4fa('0x22'),_0xa4fa('0x23'),_0xa4fa('0x24'),'dialRecallMeTimeout',_0xa4fa('0x25'),_0xa4fa('0x26'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xa4fa('0x27'),_0xa4fa('0x6'),_0xa4fa('0x28'),_0xa4fa('0x29'),_0xa4fa('0x2a'),_0xa4fa('0x2b'),_0xa4fa('0x2c'),'dialDropMaxRetry',_0xa4fa('0x2d'),_0xa4fa('0x2e'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xa4fa('0x2f'),_0xa4fa('0x30'),_0xa4fa('0x31'),_0xa4fa('0x32'),_0xa4fa('0x33'),_0xa4fa('0x34'),_0xa4fa('0x35'),_0xa4fa('0x36'),_0xa4fa('0x37')],'include':[{'model':_0xa4fa('0x38'),'as':_0xa4fa('0x38'),'attributes':['id',_0xa4fa('0x3'),_0xa4fa('0x39'),_0xa4fa('0x3a')]},{'model':_0xa4fa('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0xa4fa('0x3')]},{'model':_0xa4fa('0x38'),'as':_0xa4fa('0x3c'),'attributes':['id',_0xa4fa('0x3'),'callerid','active']},{'model':_0xa4fa('0x3d'),'as':_0xa4fa('0x3d'),'attributes':['id',_0xa4fa('0x3')],'include':[{'model':_0xa4fa('0x3d'),'as':_0xa4fa('0x3e'),'attributes':['id',_0xa4fa('0x3'),_0xa4fa('0x3f')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 872114d..1e34884 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(_0x3e0084,_0x5c3266){var _0xef2c1c=function(_0x719f6f){while(--_0x719f6f){_0x3e0084['push'](_0x3e0084['shift']());}};_0xef2c1c(++_0x5c3266);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x278349,_0x22cad9){var _0x1c01b4=function(_0x2815ad){while(--_0x2815ad){_0x278349['push'](_0x278349['shift']());}};_0x1c01b4(++_0x22cad9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 2e4908f..1e4c0da 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 _0x87a9=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x38089d,_0x242e62){var _0x17532d=function(_0x5ca640){while(--_0x5ca640){_0x38089d['push'](_0x38089d['shift']());}};_0x17532d(++_0x242e62);}(_0x87a9,0x17d));var _0x987a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x87a9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x5d8f0a){return function(){return client[_0x987a('0x0')](_0x987a('0x1'),{'options':{'where':{'VoiceQueueId':_0x5d8f0a,'paused':!![]},'raw':!![]},'log':_0x987a('0x2')});};}; \ No newline at end of file +var _0x27af=['Request','../client','getVoiceQueueRtPauses'];(function(_0x32190a,_0x42c99d){var _0x23c4f2=function(_0x5cbc99){while(--_0x5cbc99){_0x32190a['push'](_0x32190a['shift']());}};_0x23c4f2(++_0x42c99d);}(_0x27af,0xa0));var _0xf27a=function(_0x8e5eef,_0xc7e7a6){_0x8e5eef=_0x8e5eef-0x0;var _0x9fc563=_0x27af[_0x8e5eef];return _0x9fc563;};'use strict';var client=require(_0xf27a('0x0'));exports[_0xf27a('0x1')]=function(_0x4e22e0){return function(){return client[_0xf27a('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4e22e0,'paused':!![]},'raw':!![]},'log':_0xf27a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fbe88e1..cd03e0e 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5d435c,_0x493f27){var _0x436b20=function(_0x1915f5){while(--_0x1915f5){_0x5d435c['push'](_0x5d435c['shift']());}};_0x436b20(++_0x493f27);}(_0x7a54,0x106));var _0x47a5=function(_0x2c09d3,_0x565c12){_0x2c09d3=_0x2c09d3-0x0;var _0x10d16c=_0x7a54[_0x2c09d3];return _0x10d16c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1e4dff,_0x245f55){var _0x221120=function(_0x198459){while(--_0x198459){_0x1e4dff['push'](_0x1e4dff['shift']());}};_0x221120(++_0x245f55);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 6d6fa64..ce845c2 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 _0xe12e=['transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel'];(function(_0x2f4c1b,_0x2c3964){var _0x5419cd=function(_0x2d69ec){while(--_0x2d69ec){_0x2f4c1b['push'](_0x2f4c1b['shift']());}};_0x5419cd(++_0x2c3964);}(_0xe12e,0x159));var _0xee12=function(_0x3cd330,_0x5ca015){_0x3cd330=_0x3cd330-0x0;var _0x6ec1b3=_0xe12e[_0x3cd330];return _0x6ec1b3;};'use strict';var client=require('../client');exports['transfers']={};exports[_0xee12('0x0')]=function(_0x52917e){return client[_0xee12('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x52917e[_0xee12('0x2')],'transfererchannel':_0x52917e[_0xee12('0x3')],'transferercalleridnum':_0x52917e[_0xee12('0x4')],'transferercalleridname':_0x52917e[_0xee12('0x5')],'transfererconnectedlinenum':_0x52917e[_0xee12('0x6')],'transfererconnectedlinename':_0x52917e[_0xee12('0x7')],'transfereraccountcode':_0x52917e[_0xee12('0x8')],'transferercontext':_0x52917e[_0xee12('0x9')],'transfererexten':_0x52917e[_0xee12('0xa')],'transfererlinkedid':_0x52917e[_0xee12('0xb')],'transfereechannel':_0x52917e['transfereechannel'],'transfereecalleridnum':_0x52917e[_0xee12('0xc')],'transfereecalleridname':_0x52917e[_0xee12('0xd')],'transfereeconnectedlinenum':_0x52917e[_0xee12('0xe')],'transfereeconnectedlinename':_0x52917e[_0xee12('0xf')],'transfereeaccountcode':_0x52917e[_0xee12('0x10')],'transfereecontext':_0x52917e[_0xee12('0x11')],'transfereeexten':_0x52917e[_0xee12('0x12')],'transfereelinkedid':_0x52917e[_0xee12('0x13')],'isexternal':_0x52917e['isexternal'],'context':_0x52917e[_0xee12('0x14')],'extension':_0x52917e[_0xee12('0x15')],'type':_0xee12('0x16')},'log':_0xee12('0x17')});};exports[_0xee12('0x18')]=function(_0x85a699){return client['Request'](_0xee12('0x17'),{'body':{'result':_0x85a699[_0xee12('0x2')],'transfererchannel':_0x85a699[_0xee12('0x19')],'transferercalleridnum':_0x85a699[_0xee12('0x1a')],'transferercalleridname':_0x85a699['origtransferercalleridname'],'transfererconnectedlinenum':_0x85a699[_0xee12('0x1b')],'transfererconnectedlinename':_0x85a699[_0xee12('0x1c')],'transfereraccountcode':_0x85a699[_0xee12('0x1d')],'transferercontext':_0x85a699[_0xee12('0x1e')],'transfererexten':_0x85a699['secondtransfererexten'],'transfererlinkedid':_0x85a699[_0xee12('0x1f')],'transfereechannel':_0x85a699[_0xee12('0x20')],'transfereecalleridnum':_0x85a699[_0xee12('0x21')],'transfereecalleridname':_0x85a699['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x85a699['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x85a699[_0xee12('0x22')],'transfereeaccountcode':_0x85a699[_0xee12('0x23')],'transfereecontext':_0x85a699['transfertargetcontext'],'transfereeexten':_0x85a699[_0xee12('0x24')],'transfereelinkedid':_0x85a699[_0xee12('0x25')],'isexternal':_0x85a699[_0xee12('0x26')],'context':_0x85a699[_0xee12('0x27')],'extension':_0x85a699[_0xee12('0x28')],'type':_0xee12('0x29')},'log':_0xee12('0x17')});}; \ No newline at end of file +var _0x394d=['transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum'];(function(_0x19aa54,_0x39115f){var _0x4ba9a3=function(_0x2fdad4){while(--_0x2fdad4){_0x19aa54['push'](_0x19aa54['shift']());}};_0x4ba9a3(++_0x39115f);}(_0x394d,0xac));var _0xd394=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x394d[_0x3070dc];return _0x431489;};'use strict';var client=require('../client');exports[_0xd394('0x0')]={};exports[_0xd394('0x1')]=function(_0x49dfc5){return client[_0xd394('0x2')](_0xd394('0x3'),{'body':{'result':_0x49dfc5[_0xd394('0x4')],'transfererchannel':_0x49dfc5['transfererchannel'],'transferercalleridnum':_0x49dfc5[_0xd394('0x5')],'transferercalleridname':_0x49dfc5[_0xd394('0x6')],'transfererconnectedlinenum':_0x49dfc5[_0xd394('0x7')],'transfererconnectedlinename':_0x49dfc5['transfererconnectedlinename'],'transfereraccountcode':_0x49dfc5[_0xd394('0x8')],'transferercontext':_0x49dfc5[_0xd394('0x9')],'transfererexten':_0x49dfc5[_0xd394('0xa')],'transfererlinkedid':_0x49dfc5['transfererlinkedid'],'transfereechannel':_0x49dfc5[_0xd394('0xb')],'transfereecalleridnum':_0x49dfc5[_0xd394('0xc')],'transfereecalleridname':_0x49dfc5['transfereecalleridname'],'transfereeconnectedlinenum':_0x49dfc5[_0xd394('0xd')],'transfereeconnectedlinename':_0x49dfc5[_0xd394('0xe')],'transfereeaccountcode':_0x49dfc5['transfereeaccountcode'],'transfereecontext':_0x49dfc5[_0xd394('0xf')],'transfereeexten':_0x49dfc5[_0xd394('0x10')],'transfereelinkedid':_0x49dfc5['transfereelinkedid'],'isexternal':_0x49dfc5[_0xd394('0x11')],'context':_0x49dfc5['context'],'extension':_0x49dfc5['extension'],'type':_0xd394('0x12')},'log':_0xd394('0x3')});};exports[_0xd394('0x13')]=function(_0x58abb9){return client[_0xd394('0x2')](_0xd394('0x3'),{'body':{'result':_0x58abb9['result'],'transfererchannel':_0x58abb9[_0xd394('0x14')],'transferercalleridnum':_0x58abb9[_0xd394('0x15')],'transferercalleridname':_0x58abb9[_0xd394('0x16')],'transfererconnectedlinenum':_0x58abb9[_0xd394('0x17')],'transfererconnectedlinename':_0x58abb9['secondtransfererconnectedlinename'],'transfereraccountcode':_0x58abb9[_0xd394('0x18')],'transferercontext':_0x58abb9[_0xd394('0x19')],'transfererexten':_0x58abb9[_0xd394('0x1a')],'transfererlinkedid':_0x58abb9[_0xd394('0x1b')],'transfereechannel':_0x58abb9['transfertargetchannel'],'transfereecalleridnum':_0x58abb9['transfertargetcalleridnum'],'transfereecalleridname':_0x58abb9[_0xd394('0x1c')],'transfereeconnectedlinenum':_0x58abb9[_0xd394('0x1d')],'transfereeconnectedlinename':_0x58abb9[_0xd394('0x1e')],'transfereeaccountcode':_0x58abb9['transfertargetaccountcode'],'transfereecontext':_0x58abb9[_0xd394('0x1f')],'transfereeexten':_0x58abb9[_0xd394('0x20')],'transfereelinkedid':_0x58abb9[_0xd394('0x21')],'isexternal':_0x58abb9['isexternal'],'context':_0x58abb9[_0xd394('0x22')],'extension':_0x58abb9['origtransfererexten'],'type':_0xd394('0x23')},'log':_0xd394('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 079dbb9..87f29d0 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 _0xdb8b=['Interval','push','length','omit','undefined','channels','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Redirect','exten','context','values','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','../../../config/environment','../ami','listen','format','SIP','name','timers','timer','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','then','message','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','available','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0xdaf99,_0x396b8e){_0xdaf99=_0xdaf99-0x0;var _0x48250c=_0xdb8b[_0xdaf99];return _0x48250c;};'use strict';var _=require('lodash');var util=require(_0xbdb8('0x0'));var jayson=require(_0xbdb8('0x1'));var schema=require(_0xbdb8('0x2'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0xbdb8('0x3'));var properties=require('../properties');var ami=require(_0xbdb8('0x4'));exports[_0xbdb8('0x5')]=function(_0x33b3d2,_0x2d74ff,_0x4c6bdb){return new BPromise(function(_0x7affe8,_0x482c12){var _0x387bb4={'QueuePause':function(_0x2f2825){return new Promise(function(_0x444d6,_0x227caa){var _0x2525e2=util[_0xbdb8('0x6')]('%s/%s',_0xbdb8('0x7'),_0x2f2825[_0xbdb8('0x8')]);if(_0x33b3d2[_0xbdb8('0x9')]&&_0x33b3d2[_0xbdb8('0x9')][_0x2525e2]&&_0x33b3d2[_0xbdb8('0x9')][_0x2525e2][_0xbdb8('0xa')]){_0x33b3d2[_0xbdb8('0x9')][_0x2525e2]['updateAcw']();}if(_0x33b3d2['agents'][_0x2525e2]){_0x33b3d2[_0xbdb8('0xb')][_0x2525e2]['updateStatusRealtime']({'statePause':_0x2f2825[_0xbdb8('0xc')]?!![]:![]});}_0x444d6({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3c520b){var _0x568205=this;return new Promise(function(_0xc13639,_0x1cdbb6){if(ami[_0xbdb8('0xd')]()==![]){return _0x1cdbb6(_0x568205[_0xbdb8('0xe')](0x1f4,[config[_0xbdb8('0xf')]['ip'],config[_0xbdb8('0xf')][_0xbdb8('0x10')],_0xbdb8('0x11')][_0xbdb8('0x12')]('\x20')));}_0x3c520b=_[_0xbdb8('0x13')](_0x3c520b,_[_0xbdb8('0x14')](properties[_0xbdb8('0x15')]));_0x3c520b[_0xbdb8('0x16')]='Reload';return ami[_0xbdb8('0x17')](_0x3c520b)[_0xbdb8('0x18')](function(_0x154036){_0xc13639({'code':0xc8,'message':_0x154036['message']});})['catch'](function(_0x133800){_0x1cdbb6(_0x568205['error'](0x1f5,_0x133800[_0xbdb8('0x19')]));});});},'Command':function(_0x303557){var _0xb496f8=this;return new Promise(function(_0x442393,_0x3a177d){if(ami[_0xbdb8('0xd')]()==![]){return _0x3a177d(_0xb496f8[_0xbdb8('0xe')](0x1f4,[config[_0xbdb8('0xf')]['ip'],config[_0xbdb8('0xf')][_0xbdb8('0x10')],_0xbdb8('0x11')][_0xbdb8('0x12')]('\x20')));}_0x303557=_[_0xbdb8('0x13')](_0x303557,_0xbdb8('0x1a'));_0x303557[_0xbdb8('0x16')]=_0xbdb8('0x1b');return ami[_0xbdb8('0x17')](_0x303557)[_0xbdb8('0x18')](function(_0x1e9398){_0x442393({'code':0xc8,'message':_0x1e9398[_0xbdb8('0x1c')]});})[_0xbdb8('0x1d')](function(_0x50c6db){_0x3a177d(_0xb496f8[_0xbdb8('0xe')](0x1f5,_0x50c6db['message']));});});},'VoiceQueues':function(_0x167edd){return new Promise(function(_0x2b3d5e,_0x4e9e42){var _0x1da624=[];for(var _0x38709a in _0x33b3d2['voiceQueues']){if(_0x33b3d2[_0xbdb8('0x1e')][_0xbdb8('0x1f')](_0x38709a)){var _0x1985d1=_0x33b3d2[_0xbdb8('0x1e')][_0x38709a];var _0x3dedcb={'id':_0x1985d1['id'],'name':_0x1985d1[_0xbdb8('0x8')],'strategy':_0x1985d1[_0xbdb8('0x20')],'answered':_0x1985d1['answered'],'available':_0x1985d1[_0xbdb8('0x21')],'loggedIn':_0x1985d1['loggedIn'],'pTalking':_0x1985d1['pTalking'],'sumBillable':_0x1985d1[_0xbdb8('0x22')],'sumDuration':_0x1985d1[_0xbdb8('0x23')],'sumHoldTime':_0x1985d1[_0xbdb8('0x24')]||0x0,'talking':_0x1985d1[_0xbdb8('0x25')],'total':_0x1985d1['total'],'type':_0x1985d1[_0xbdb8('0x26')],'unmanaged':_0x1985d1[_0xbdb8('0x27')],'abandoned':_0x1985d1[_0xbdb8('0x28')],'waiting':_0x1985d1[_0xbdb8('0x29')],'loggedInDb':_0x1985d1['loggedInDb']};if(_0x1985d1[_0xbdb8('0x26')]===_0xbdb8('0x2a')){_0x3dedcb[_0xbdb8('0x2b')]=_0x1985d1[_0xbdb8('0x2b')];_0x3dedcb[_0xbdb8('0x2c')]=_0x1985d1[_0xbdb8('0x2c')];_0x3dedcb[_0xbdb8('0x2d')]=_0x1985d1['dialOriginateCallerIdName'];_0x3dedcb[_0xbdb8('0x2e')]=_0x1985d1[_0xbdb8('0x2e')];_0x3dedcb['dialOriginateTimeout']=_0x1985d1['dialOriginateTimeout'];_0x3dedcb[_0xbdb8('0x2f')]=_0x1985d1[_0xbdb8('0x2f')];_0x3dedcb[_0xbdb8('0x30')]=_0x1985d1['temp'];_0x3dedcb[_0xbdb8('0x31')]=_0x1985d1[_0xbdb8('0x31')];_0x3dedcb[_0xbdb8('0x32')]=_0x1985d1[_0xbdb8('0x32')];_0x3dedcb['outboundBlacklistCallsDay']=_0x1985d1[_0xbdb8('0x33')];_0x3dedcb['outboundBusyCallsDay']=_0x1985d1['outboundBusyCallsDay'];_0x3dedcb[_0xbdb8('0x34')]=_0x1985d1[_0xbdb8('0x34')];_0x3dedcb['outboundDropCallsDayACS']=_0x1985d1[_0xbdb8('0x35')];_0x3dedcb['outboundDropCallsDayCallersExit']=_0x1985d1[_0xbdb8('0x36')];_0x3dedcb[_0xbdb8('0x37')]=_0x1985d1['outboundDropCallsDayTimeout'];_0x3dedcb[_0xbdb8('0x38')]=_0x1985d1[_0xbdb8('0x38')];_0x3dedcb[_0xbdb8('0x39')]=_0x1985d1[_0xbdb8('0x39')];_0x3dedcb['outboundOriginateFailureCallsDay']=_0x1985d1[_0xbdb8('0x3a')];_0x3dedcb[_0xbdb8('0x3b')]=_0x1985d1[_0xbdb8('0x3b')];_0x3dedcb['outboundRejectCallsDay']=_0x1985d1['outboundRejectCallsDay'];_0x3dedcb[_0xbdb8('0x3c')]=_0x1985d1[_0xbdb8('0x3c')];_0x3dedcb['predictiveIntervalAnsweredCalls']=_0x1985d1['predictiveIntervalAnsweredCalls'];_0x3dedcb['predictiveIntervalAvgHoldtime']=_0x1985d1[_0xbdb8('0x3d')];_0x3dedcb[_0xbdb8('0x3e')]=_0x1985d1[_0xbdb8('0x3e')];_0x3dedcb['predictiveIntervalDroppedCallsCallersExit']=_0x1985d1[_0xbdb8('0x3f')];_0x3dedcb[_0xbdb8('0x40')]=_0x1985d1['predictiveIntervalDroppedCallsTimeout'];_0x3dedcb['predictiveIntervalErlangCalls']=_0x1985d1[_0xbdb8('0x41')];_0x3dedcb[_0xbdb8('0x42')]=_0x1985d1[_0xbdb8('0x42')];_0x3dedcb[_0xbdb8('0x43')]=_0x1985d1['predictiveIntervalHitRate'];_0x3dedcb[_0xbdb8('0x44')]=_0x1985d1['predictiveIntervalMultiplicativeFactor'];_0x3dedcb[_0xbdb8('0x45')]=_0x1985d1['predictiveIntervalPauses'];_0x3dedcb[_0xbdb8('0x46')]=_0x1985d1[_0xbdb8('0x46')];_0x3dedcb['predictiveIntervalTotalCalls']=_0x1985d1['predictiveIntervalTotalCalls'];_0x3dedcb[_0xbdb8('0x19')]=_0x1985d1['message'];_0x3dedcb[_0xbdb8('0x47')]=_0x1985d1[_0xbdb8('0x47')];_0x3dedcb['erlangCalls']=_0x1985d1[_0xbdb8('0x48')];_0x3dedcb[_0xbdb8('0x49')]=_0x1985d1[_0xbdb8('0x49')];_0x3dedcb[_0xbdb8('0x4a')]=_0x1985d1[_0xbdb8('0x4a')];_0x3dedcb[_0xbdb8('0x4b')]=_0x1985d1[_0xbdb8('0x4b')];_0x3dedcb['startPredictive']=_0x1985d1['startPredictive'];_0x3dedcb[_0xbdb8('0x4c')]=_0x1985d1[_0xbdb8('0x4c')];}if(_0x1985d1[_0xbdb8('0x4d')]){_0x3dedcb['Trunk']={'id':_0x1985d1[_0xbdb8('0x4d')]['id'],'name':_0x1985d1[_0xbdb8('0x4d')][_0xbdb8('0x8')],'active':_0x1985d1[_0xbdb8('0x4d')][_0xbdb8('0x4e')],'callerid':_0x1985d1[_0xbdb8('0x4d')][_0xbdb8('0x4f')]};}if(_0x1985d1[_0xbdb8('0x50')]){_0x3dedcb['Interval']={'id':_0x1985d1[_0xbdb8('0x50')]['id'],'name':_0x1985d1[_0xbdb8('0x50')][_0xbdb8('0x8')]};}_0x1da624[_0xbdb8('0x51')](_0x3dedcb);}}_0x2b3d5e({'count':_0x1da624[_0xbdb8('0x52')],'rows':_0x1da624});});},'UpdateVoiceQueue':function(_0x56ef57){return new Promise(function(_0x20b5c2,_0x470b7f){var _0x36a9c8=_['find'](_0x33b3d2[_0xbdb8('0x1e')],{'id':parseInt(_0x56ef57['id'])});var _0x3139dc=_[_0xbdb8('0x53')](_0x56ef57,['id']);if(_0x36a9c8){for(var _0x517070 in _0x3139dc){if(typeof _0x3139dc[_0x517070]!==_0xbdb8('0x54')&&typeof _0x36a9c8[_0x517070]!==_0xbdb8('0x54')){_0x36a9c8[_0x517070]=_0x3139dc[_0x517070];}}_0x20b5c2(_0x36a9c8);}else{_0x470b7f();}});},'VoiceChannels':function(_0x434bac){return new Promise(function(_0x271b08,_0x514e4f){var _0x3c43c8=_['values'](_0x33b3d2[_0xbdb8('0x55')]);_0x271b08({'count':_0x3c43c8['length'],'rows':_0x3c43c8});});},'VoiceChannelMixMonitor':function(_0x2127e4){var _0x33f14b=this;return new Promise(function(_0x1314d3,_0x4104be){if(ami['isConnected']()==![]){return _0x4104be(_0x33f14b[_0xbdb8('0xe')](0x1f4,[config[_0xbdb8('0xf')]['ip'],config[_0xbdb8('0xf')][_0xbdb8('0x10')],_0xbdb8('0x11')]['join']('\x20')));}var _0x1881cf=schema(properties[_0xbdb8('0x56')])['validate'](_0x2127e4);if(_0x1881cf[_0xbdb8('0x52')]>0x0){return _0x4104be(_0x33f14b[_0xbdb8('0xe')](0x1f4,_[_0xbdb8('0x57')](_0x1881cf,'message')['join'](',\x20')));}var _0x9339db=_[_0xbdb8('0x58')](_0x33b3d2[_0xbdb8('0x55')],{'uniqueid':_0x2127e4[_0xbdb8('0x59')]});if(_0x9339db&&_0x9339db[_0xbdb8('0x5a')]){var _0x52e771=util[_0xbdb8('0x6')](_0xbdb8('0x5b'),_0x2127e4[_0xbdb8('0x5c')]||_0x2127e4[_0xbdb8('0x59')],_0x2127e4[_0xbdb8('0x6')]||_0xbdb8('0x5d'));return ami[_0xbdb8('0x17')]({'action':_0xbdb8('0x5e'),'channel':_0x9339db[_0xbdb8('0x5a')],'file':_0x52e771,'options':_0xbdb8('0x5f')})[_0xbdb8('0x18')](function(_0x3a5952){var _0x5f5cd1=_['find'](_0x9339db[_0xbdb8('0x60')],{'filename':_0xbdb8('0x61')+_0x52e771[_0xbdb8('0x62')]()});if(_[_0xbdb8('0x63')](_0x5f5cd1)){_0x9339db['monitors'][_0xbdb8('0x51')]({'filename':_0xbdb8('0x61')+_0x52e771['toLowerCase'](),'createdAt':moment()[_0xbdb8('0x6')](_0xbdb8('0x64')),'mixmonitorid':_0x3a5952[_0xbdb8('0x65')],'status':_0xbdb8('0x66')});}else{_0x5f5cd1[_0xbdb8('0x65')]=_0x3a5952[_0xbdb8('0x65')];_0x5f5cd1['status']=_0xbdb8('0x66');}_0x1314d3({'code':0xc8,'message':[_0x2127e4[_0xbdb8('0x59')],'MixMonitor\x20Success',_0x3a5952['mixmonitorid']][_0xbdb8('0x12')]('\x20'),'mixmonitorid':_0x3a5952[_0xbdb8('0x65')]});})[_0xbdb8('0x1d')](function(_0x5c34a6){_0x4104be(_0x33f14b[_0xbdb8('0xe')](0x1f5,[_0x2127e4['uniqueid'],_0x5c34a6[_0xbdb8('0x19')]['toLowerCase']()][_0xbdb8('0x12')]('\x20')));});}else{return _0x4104be(_0x33f14b[_0xbdb8('0xe')](0x1f5,_0xbdb8('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x3a6cd4){var _0x1aa728=this;return new Promise(function(_0x20a820,_0x487193){if(ami[_0xbdb8('0xd')]()==![]){return _0x487193(_0x1aa728['error'](0x1f4,[config['asterisk']['ip'],config[_0xbdb8('0xf')][_0xbdb8('0x10')],_0xbdb8('0x11')][_0xbdb8('0x12')]('\x20')));}var _0x45abb6=schema(properties[_0xbdb8('0x56')])[_0xbdb8('0x2')](_0x3a6cd4);if(_0x45abb6[_0xbdb8('0x52')]>0x0){return _0x487193(_0x1aa728['error'](0x1f4,_[_0xbdb8('0x57')](_0x45abb6,_0xbdb8('0x19'))['join'](',\x20')));}var _0x191752=_[_0xbdb8('0x58')](_0x33b3d2[_0xbdb8('0x55')],{'uniqueid':_0x3a6cd4[_0xbdb8('0x59')]});if(_0x191752){return BPromise[_0xbdb8('0x68')]()[_0xbdb8('0x18')](function(){if(_0x191752['channel']){return ami[_0xbdb8('0x17')]({'action':_0xbdb8('0x69'),'channel':_0x191752[_0xbdb8('0x5a')],'mixmonitorid':_0x3a6cd4[_0xbdb8('0x65')]})[_0xbdb8('0x1d')](function(_0x39c8bb){});}})['then'](function(){if(_0x191752[_0xbdb8('0x6a')]){return ami[_0xbdb8('0x17')]({'action':'StopMixMonitor','channel':_0x191752['destinationchannel'],'mixmonitorid':_0x3a6cd4[_0xbdb8('0x65')]})['catch'](function(_0x40916b){});}})['then'](function(_0x39bfeb){var _0x5cb447=_[_0xbdb8('0x58')](_0x191752[_0xbdb8('0x60')],{'mixmonitorid':_0x3a6cd4[_0xbdb8('0x65')]});if(_0x5cb447){_0x5cb447[_0xbdb8('0x6b')]=_0xbdb8('0x6c');}})[_0xbdb8('0x18')](function(){var _0x1f00ac=util['format'](_0xbdb8('0x5b'),_0x3a6cd4[_0xbdb8('0x5c')]||_0x3a6cd4['uniqueid'],_0x3a6cd4['format']||'wav');var _0x5919c1=_[_0xbdb8('0x58')](_0x191752[_0xbdb8('0x60')],{'filename':_0xbdb8('0x61')+_0x1f00ac[_0xbdb8('0x62')]()});if(_0x5919c1){_0x5919c1[_0xbdb8('0x6b')]='stop';}})[_0xbdb8('0x18')](function(){_0x20a820({'code':0xc8,'message':[_0x3a6cd4['uniqueid'],'StopMixMonitor\x20Success']['join']('\x20')});})['catch'](function(_0x4f35cd){_0x487193(_0x1aa728[_0xbdb8('0xe')](0x1f5,[_0x3a6cd4['uniqueid'],_0x4f35cd[_0xbdb8('0x19')][_0xbdb8('0x62')]()][_0xbdb8('0x12')]('\x20')));});}else{return _0x487193(_0x1aa728[_0xbdb8('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x36dfab){return new Promise(function(_0x5212e0,_0x23debc){var _0xdb5a28=_['values'](_0x33b3d2[_0xbdb8('0x6d')]);_0x5212e0({'count':_0xdb5a28[_0xbdb8('0x52')],'rows':_0xdb5a28});});},'VoiceQueuesChannel':function(_0x1454f1){var _0x287e90=this;return new Promise(function(_0x51b8d3,_0x1ccc6d){var _0x36491d=schema(properties[_0xbdb8('0x6e')])['validate'](_0x1454f1);if(_0x36491d[_0xbdb8('0x52')]>0x0){return _0x1ccc6d(_0x287e90[_0xbdb8('0xe')](0x1f4,_[_0xbdb8('0x57')](_0x36491d,_0xbdb8('0x19'))[_0xbdb8('0x12')](',\x20')));}var _0x28cc87=_[_0xbdb8('0x58')](_0x33b3d2[_0xbdb8('0x6d')],{'uniqueid':_0x1454f1[_0xbdb8('0x59')]});if(_0x28cc87){_0x51b8d3(_0x28cc87);}else{return _0x1ccc6d(_0x287e90[_0xbdb8('0xe')](0x1f5,_0xbdb8('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x1376b7){var _0x189cf3=this;return new Promise(function(_0x18fe76,_0x1563bd){if(ami[_0xbdb8('0xd')]()==![]){return _0x1563bd(_0x189cf3[_0xbdb8('0xe')](0x1f4,[config[_0xbdb8('0xf')]['ip'],config['asterisk'][_0xbdb8('0x10')],_0xbdb8('0x11')]['join']('\x20')));}var _0x279f98=schema(properties[_0xbdb8('0x6f')])[_0xbdb8('0x2')](_0x1376b7);if(_0x279f98[_0xbdb8('0x52')]>0x0){return _0x1563bd(_0x189cf3['error'](0x1f4,_[_0xbdb8('0x57')](_0x279f98,_0xbdb8('0x19'))[_0xbdb8('0x12')](',\x20')));}var _0x1b30e0=_[_0xbdb8('0x58')](_0x33b3d2['queueChannels'],{'uniqueid':_0x1376b7[_0xbdb8('0x59')]});if(_0x1b30e0&&_0x1b30e0[_0xbdb8('0x5a')]){return ami[_0xbdb8('0x17')]({'action':'Hangup','channel':_0x1b30e0[_0xbdb8('0x5a')]})[_0xbdb8('0x18')](function(_0x3e48f1){_0x18fe76({'code':0xc8,'message':[_0x1376b7[_0xbdb8('0x59')],_0x3e48f1[_0xbdb8('0x19')]['toLowerCase']()][_0xbdb8('0x12')]('\x20')});})['catch'](function(_0x6b0eae){_0x1563bd(_0x189cf3[_0xbdb8('0xe')](0x1f5,[_0x1376b7[_0xbdb8('0x59')],_0x6b0eae['message']['toLowerCase']()][_0xbdb8('0x12')]('\x20')));});}else{return _0x1563bd(_0x189cf3[_0xbdb8('0xe')](0x1f5,_0xbdb8('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x23c277){var _0x54f96d=this;return new Promise(function(_0x5a2004,_0x142c92){if(ami[_0xbdb8('0xd')]()==![]){return _0x142c92(_0x54f96d['error'](0x1f4,[config[_0xbdb8('0xf')]['ip'],config[_0xbdb8('0xf')][_0xbdb8('0x10')],'ami\x20disconnected'][_0xbdb8('0x12')]('\x20')));}var _0x566a02=schema(properties['voicequeuechannelredirect'])[_0xbdb8('0x2')](_0x23c277);if(_0x566a02[_0xbdb8('0x52')]>0x0){return _0x142c92(_0x54f96d[_0xbdb8('0xe')](0x1f4,_['map'](_0x566a02,'message')[_0xbdb8('0x12')](',\x20')));}var _0x4309f1=_[_0xbdb8('0x58')](_0x33b3d2[_0xbdb8('0x6d')],{'uniqueid':_0x23c277[_0xbdb8('0x59')]});if(_0x4309f1&&_0x4309f1['channel']){return ami[_0xbdb8('0x17')]({'action':_0xbdb8('0x70'),'channel':_0x4309f1['channel'],'exten':_0x23c277[_0xbdb8('0x71')],'context':_0x23c277[_0xbdb8('0x72')]||_0x4309f1[_0xbdb8('0x72')],'priority':0x1})[_0xbdb8('0x18')](function(_0x164fbe){_0x5a2004({'code':0xc8,'message':[_0x23c277[_0xbdb8('0x59')],_0x164fbe[_0xbdb8('0x19')][_0xbdb8('0x62')]()]['join']('\x20')});})[_0xbdb8('0x1d')](function(_0x36ee7d){_0x142c92(_0x54f96d[_0xbdb8('0xe')](0x1f5,[_0x23c277[_0xbdb8('0x59')],_0x36ee7d[_0xbdb8('0x19')]['toLowerCase']()][_0xbdb8('0x12')]('\x20')));});}else{return _0x142c92(_0x54f96d[_0xbdb8('0xe')](0x1f5,_0xbdb8('0x67')));}});},'Agents':function(_0x344125){return new Promise(function(_0x9091e2,_0x3a981f){var _0x4cdcf5=_[_0xbdb8('0x73')](_0x33b3d2['agents']);_0x9091e2({'count':_0x4cdcf5[_0xbdb8('0x52')],'rows':_0x4cdcf5});});},'Telephones':function(_0x3a5ef4){return new Promise(function(_0x425d2f,_0x52232e){var _0x5f3974=_[_0xbdb8('0x73')](_0x33b3d2[_0xbdb8('0x74')]);_0x425d2f({'count':_0x5f3974[_0xbdb8('0x52')],'rows':_0x5f3974});});},'Trunks':function(_0x340e3c){return new Promise(function(_0x32fe46,_0x2802f8){var _0x3dfebf=_[_0xbdb8('0x73')](_0x33b3d2[_0xbdb8('0x75')]);_0x32fe46({'count':_0x3dfebf[_0xbdb8('0x52')],'rows':_0x3dfebf});});},'OutboundChannels':function(_0x488607){return new Promise(function(_0x2e3e53,_0x2ace99){var _0x182e4e=_['values'](_0x33b3d2[_0xbdb8('0x76')]);_0x2e3e53({'count':_0x182e4e['length'],'rows':_0x182e4e});});},'Outbound':function(_0x5b3a60){return new Promise(function(_0x3f9e7a,_0x53bd12){_0x3f9e7a(_0x33b3d2[_0xbdb8('0x2a')]);});},'Campaigns':function(_0xc073bd){return new Promise(function(_0x105169,_0x1a9c17){var _0x5878f1=_['values'](_0x33b3d2[_0xbdb8('0x77')]);_0x105169({'count':_0x5878f1[_0xbdb8('0x52')],'rows':_0x5878f1});});},'VoiceQueuesPreview':function(_0x3383d6){var _0x506c98=this;return new Promise(function(_0x5d070b,_0x21e12e){_0x2d74ff[_0xbdb8('0x78')](_0x3383d6['id'])[_0xbdb8('0x18')](function(_0x561969){_0x5d070b({'code':0xc8,'message':_0x561969[_0xbdb8('0x19')]});})[_0xbdb8('0x1d')](function(_0x1a26be){_0x21e12e(_0x506c98[_0xbdb8('0xe')](0x1f4,_0x1a26be['message']));});});},'EventManager':function(_0x374004){var _0x4662b5=this;return new Promise(function(_0x4e114a,_0x427127){if(!_0x374004['event']){return _0x427127(_0x4662b5[_0xbdb8('0xe')](0x1f4,_0xbdb8('0x79')));}ami[_0xbdb8('0x7a')](_0xbdb8('0x7b')+_0x374004['event'],_0x374004['message']);_0x4e114a({'code':0xc8,'message':_0x374004});});},'FaxAccounts':function(_0x164fb6){return new Promise(function(_0x463c76,_0x3abb37){var _0x358024=_['values'](_0x33b3d2[_0xbdb8('0x7c')]);_0x463c76({'count':_0x358024[_0xbdb8('0x52')],'rows':_0x358024});});},'SendFax':function(_0x57173c){var _0x2abbd1=this;return new Promise(function(_0x31254e,_0x2f28c1){_0x4c6bdb[_0xbdb8('0x7d')](_0x57173c)[_0xbdb8('0x18')](function(_0x5b07c1){_0x31254e({'code':0xc8,'message':_0x5b07c1['message']});})[_0xbdb8('0x1d')](function(_0x5de32e){_0x2f28c1(_0x2abbd1[_0xbdb8('0xe')](0x1f4,_0x5de32e[_0xbdb8('0x19')]));});});},'CheckAfterSend':function(_0x57c2e9){var _0x34578c=this;return new Promise(function(_0xfc75c1,_0x45db73){_0x4c6bdb[_0xbdb8('0x7e')](_0x57c2e9)[_0xbdb8('0x18')](function(_0x7a559d){_0xfc75c1({'code':0xc8,'message':_0x7a559d[_0xbdb8('0x19')]});})[_0xbdb8('0x1d')](function(_0x35170c){_0x45db73(_0x34578c[_0xbdb8('0xe')](0x1f4,_0x35170c[_0xbdb8('0x19')]));});});}};var _0x141c87=jayson[_0xbdb8('0x7f')](_0x387bb4)[_0xbdb8('0x80')]();_0x141c87['on'](_0xbdb8('0xe'),function(_0x2a21d9){return _0x482c12(_0x2a21d9);});_0x141c87[_0xbdb8('0x5')](0x232a,_0xbdb8('0x81'),function(){console[_0xbdb8('0x82')](_0xbdb8('0x83'),0x232a);return _0x7affe8(_0xbdb8('0x84')+0x232a);});});}; \ No newline at end of file +var _0x1261=['predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','length','omit','undefined','channels','voicechannel','find','channel','filename','uniqueid','wav','MixMonitor','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','catch','map','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','module','action','Reload','then','error','join','command','Action','content','message','voiceQueues','answered','available','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x1d326a,_0x89b53){_0x1d326a=_0x1d326a-0x0;var _0x5804d5=_0x1261[_0x1d326a];return _0x5804d5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var jayson=require(_0x1126('0x1'));var schema=require(_0x1126('0x2'));var BPromise=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var config=require(_0x1126('0x5'));var properties=require(_0x1126('0x6'));var ami=require(_0x1126('0x7'));exports[_0x1126('0x8')]=function(_0x75a851,_0x5a2189,_0x5c68c8){return new BPromise(function(_0x40ba58,_0x907180){var _0x4f239c={'QueuePause':function(_0x17e5f0){return new Promise(function(_0x28772d,_0x245be9){var _0x3abb0b=util[_0x1126('0x9')]('%s/%s',_0x1126('0xa'),_0x17e5f0[_0x1126('0xb')]);if(_0x75a851[_0x1126('0xc')]&&_0x75a851['timers'][_0x3abb0b]&&_0x75a851[_0x1126('0xc')][_0x3abb0b]['timer']){_0x75a851['timers'][_0x3abb0b][_0x1126('0xd')]();}if(_0x75a851['agents'][_0x3abb0b]){_0x75a851[_0x1126('0xe')][_0x3abb0b][_0x1126('0xf')]({'statePause':_0x17e5f0[_0x1126('0x10')]?!![]:![]});}_0x28772d({'code':0xc8,'message':_0x1126('0x11')});});},'Reload':function(_0xca0355){var _0x3f10e9=this;return new Promise(function(_0xd8ca42,_0x2048ad){if(ami[_0x1126('0x12')]()==![]){return _0x2048ad(_0x3f10e9['error'](0x1f4,[config['asterisk']['ip'],config[_0x1126('0x13')][_0x1126('0x14')],_0x1126('0x15')]['join']('\x20')));}_0xca0355=_[_0x1126('0x16')](_0xca0355,_['keys'](properties[_0x1126('0x17')]));_0xca0355[_0x1126('0x18')]=_0x1126('0x19');return ami['Action'](_0xca0355)[_0x1126('0x1a')](function(_0x1695f6){_0xd8ca42({'code':0xc8,'message':_0x1695f6['message']});})['catch'](function(_0x22ae0b){_0x2048ad(_0x3f10e9[_0x1126('0x1b')](0x1f5,_0x22ae0b['message']));});});},'Command':function(_0x548359){var _0x4564c0=this;return new Promise(function(_0x58b109,_0x22ed37){if(ami[_0x1126('0x12')]()==![]){return _0x22ed37(_0x4564c0[_0x1126('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x1126('0x13')]['username'],'ami\x20disconnected'][_0x1126('0x1c')]('\x20')));}_0x548359=_[_0x1126('0x16')](_0x548359,_0x1126('0x1d'));_0x548359[_0x1126('0x18')]='Command';return ami[_0x1126('0x1e')](_0x548359)[_0x1126('0x1a')](function(_0x48a08d){_0x58b109({'code':0xc8,'message':_0x48a08d[_0x1126('0x1f')]});})['catch'](function(_0x529dd9){_0x22ed37(_0x4564c0['error'](0x1f5,_0x529dd9[_0x1126('0x20')]));});});},'VoiceQueues':function(_0x15bcc3){return new Promise(function(_0x329914,_0x34bcf1){var _0x566c09=[];for(var _0x1b07a7 in _0x75a851[_0x1126('0x21')]){if(_0x75a851[_0x1126('0x21')]['hasOwnProperty'](_0x1b07a7)){var _0x35eec3=_0x75a851[_0x1126('0x21')][_0x1b07a7];var _0xa293f4={'id':_0x35eec3['id'],'name':_0x35eec3['name'],'strategy':_0x35eec3['strategy'],'answered':_0x35eec3[_0x1126('0x22')],'available':_0x35eec3[_0x1126('0x23')],'loggedIn':_0x35eec3['loggedIn'],'pTalking':_0x35eec3[_0x1126('0x24')],'sumBillable':_0x35eec3[_0x1126('0x25')],'sumDuration':_0x35eec3['sumDuration'],'sumHoldTime':_0x35eec3[_0x1126('0x26')]||0x0,'talking':_0x35eec3['talking'],'total':_0x35eec3[_0x1126('0x27')],'type':_0x35eec3['type'],'unmanaged':_0x35eec3[_0x1126('0x28')],'abandoned':_0x35eec3['abandoned'],'waiting':_0x35eec3[_0x1126('0x29')],'loggedInDb':_0x35eec3['loggedInDb']};if(_0x35eec3['type']==='outbound'){_0xa293f4[_0x1126('0x2a')]=_0x35eec3[_0x1126('0x2a')];_0xa293f4[_0x1126('0x2b')]=_0x35eec3['dialMethod'];_0xa293f4[_0x1126('0x2c')]=_0x35eec3[_0x1126('0x2c')];_0xa293f4['dialOriginateCallerIdNumber']=_0x35eec3[_0x1126('0x2d')];_0xa293f4[_0x1126('0x2e')]=_0x35eec3[_0x1126('0x2e')];_0xa293f4[_0x1126('0x2f')]=_0x35eec3['dialPrefix'];_0xa293f4['temp']=_0x35eec3[_0x1126('0x30')];_0xa293f4[_0x1126('0x31')]=_0x35eec3[_0x1126('0x31')];_0xa293f4[_0x1126('0x32')]=_0x35eec3['outboundAnswerCallsDay'];_0xa293f4[_0x1126('0x33')]=_0x35eec3[_0x1126('0x33')];_0xa293f4[_0x1126('0x34')]=_0x35eec3[_0x1126('0x34')];_0xa293f4[_0x1126('0x35')]=_0x35eec3['outboundCongestionCallsDay'];_0xa293f4[_0x1126('0x36')]=_0x35eec3[_0x1126('0x36')];_0xa293f4[_0x1126('0x37')]=_0x35eec3[_0x1126('0x37')];_0xa293f4['outboundDropCallsDayTimeout']=_0x35eec3['outboundDropCallsDayTimeout'];_0xa293f4[_0x1126('0x38')]=_0x35eec3[_0x1126('0x38')];_0xa293f4['outboundNoSuchCallsDay']=_0x35eec3[_0x1126('0x39')];_0xa293f4[_0x1126('0x3a')]=_0x35eec3[_0x1126('0x3a')];_0xa293f4['outboundReCallsDay']=_0x35eec3['outboundReCallsDay'];_0xa293f4[_0x1126('0x3b')]=_0x35eec3[_0x1126('0x3b')];_0xa293f4[_0x1126('0x3c')]=_0x35eec3[_0x1126('0x3c')];_0xa293f4['predictiveIntervalAnsweredCalls']=_0x35eec3[_0x1126('0x3d')];_0xa293f4['predictiveIntervalAvgHoldtime']=_0x35eec3[_0x1126('0x3e')];_0xa293f4[_0x1126('0x3f')]=_0x35eec3[_0x1126('0x3f')];_0xa293f4[_0x1126('0x40')]=_0x35eec3[_0x1126('0x40')];_0xa293f4['predictiveIntervalDroppedCallsTimeout']=_0x35eec3[_0x1126('0x41')];_0xa293f4[_0x1126('0x42')]=_0x35eec3[_0x1126('0x42')];_0xa293f4[_0x1126('0x43')]=_0x35eec3[_0x1126('0x43')];_0xa293f4[_0x1126('0x44')]=_0x35eec3[_0x1126('0x44')];_0xa293f4['predictiveIntervalMultiplicativeFactor']=_0x35eec3[_0x1126('0x45')];_0xa293f4[_0x1126('0x46')]=_0x35eec3[_0x1126('0x46')];_0xa293f4[_0x1126('0x47')]=_0x35eec3[_0x1126('0x47')];_0xa293f4['predictiveIntervalTotalCalls']=_0x35eec3['predictiveIntervalTotalCalls'];_0xa293f4[_0x1126('0x20')]=_0x35eec3[_0x1126('0x20')];_0xa293f4[_0x1126('0x48')]=_0x35eec3[_0x1126('0x48')];_0xa293f4[_0x1126('0x49')]=_0x35eec3[_0x1126('0x49')];_0xa293f4['erlangCallToSecond']=_0x35eec3['erlangCallToSecond'];_0xa293f4['erlangAbandonmentRate']=_0x35eec3[_0x1126('0x4a')];_0xa293f4['erlangBusyFactor']=_0x35eec3[_0x1126('0x4b')];_0xa293f4[_0x1126('0x4c')]=_0x35eec3[_0x1126('0x4c')];_0xa293f4[_0x1126('0x4d')]=_0x35eec3['startProgressive'];}if(_0x35eec3['Trunk']){_0xa293f4[_0x1126('0x4e')]={'id':_0x35eec3[_0x1126('0x4e')]['id'],'name':_0x35eec3[_0x1126('0x4e')]['name'],'active':_0x35eec3[_0x1126('0x4e')]['active'],'callerid':_0x35eec3[_0x1126('0x4e')]['callerid']};}if(_0x35eec3[_0x1126('0x4f')]){_0xa293f4[_0x1126('0x4f')]={'id':_0x35eec3[_0x1126('0x4f')]['id'],'name':_0x35eec3['Interval'][_0x1126('0xb')]};}_0x566c09[_0x1126('0x50')](_0xa293f4);}}_0x329914({'count':_0x566c09[_0x1126('0x51')],'rows':_0x566c09});});},'UpdateVoiceQueue':function(_0x48c694){return new Promise(function(_0x58ff3a,_0x4dd7f5){var _0x6e78cf=_['find'](_0x75a851[_0x1126('0x21')],{'id':parseInt(_0x48c694['id'])});var _0x507568=_[_0x1126('0x52')](_0x48c694,['id']);if(_0x6e78cf){for(var _0x323499 in _0x507568){if(typeof _0x507568[_0x323499]!==_0x1126('0x53')&&typeof _0x6e78cf[_0x323499]!==_0x1126('0x53')){_0x6e78cf[_0x323499]=_0x507568[_0x323499];}}_0x58ff3a(_0x6e78cf);}else{_0x4dd7f5();}});},'VoiceChannels':function(_0xede3d8){return new Promise(function(_0x56732f,_0x198173){var _0x512f60=_['values'](_0x75a851[_0x1126('0x54')]);_0x56732f({'count':_0x512f60[_0x1126('0x51')],'rows':_0x512f60});});},'VoiceChannelMixMonitor':function(_0x575f79){var _0x5f6d73=this;return new Promise(function(_0x1ffa2b,_0x518e0a){if(ami[_0x1126('0x12')]()==![]){return _0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f4,[config[_0x1126('0x13')]['ip'],config['asterisk'][_0x1126('0x14')],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0x5878bb=schema(properties[_0x1126('0x55')])[_0x1126('0x2')](_0x575f79);if(_0x5878bb[_0x1126('0x51')]>0x0){return _0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f4,_['map'](_0x5878bb,_0x1126('0x20'))['join'](',\x20')));}var _0x40168e=_[_0x1126('0x56')](_0x75a851['channels'],{'uniqueid':_0x575f79['uniqueid']});if(_0x40168e&&_0x40168e[_0x1126('0x57')]){var _0x3c1d16=util[_0x1126('0x9')]('%s.%s',_0x575f79[_0x1126('0x58')]||_0x575f79[_0x1126('0x59')],_0x575f79[_0x1126('0x9')]||_0x1126('0x5a'));return ami['Action']({'action':_0x1126('0x5b'),'channel':_0x40168e[_0x1126('0x57')],'file':_0x3c1d16,'options':'ai(mixmonitorid)'})['then'](function(_0x4abb4d){var _0x526b07=_[_0x1126('0x56')](_0x40168e[_0x1126('0x5c')],{'filename':'/var/spool/asterisk/monitor/'+_0x3c1d16[_0x1126('0x5d')]()});if(_[_0x1126('0x5e')](_0x526b07)){_0x40168e[_0x1126('0x5c')][_0x1126('0x50')]({'filename':_0x1126('0x5f')+_0x3c1d16['toLowerCase'](),'createdAt':moment()[_0x1126('0x9')](_0x1126('0x60')),'mixmonitorid':_0x4abb4d['mixmonitorid'],'status':_0x1126('0x61')});}else{_0x526b07[_0x1126('0x62')]=_0x4abb4d[_0x1126('0x62')];_0x526b07[_0x1126('0x63')]=_0x1126('0x61');}_0x1ffa2b({'code':0xc8,'message':[_0x575f79['uniqueid'],_0x1126('0x64'),_0x4abb4d['mixmonitorid']][_0x1126('0x1c')]('\x20'),'mixmonitorid':_0x4abb4d[_0x1126('0x62')]});})[_0x1126('0x65')](function(_0x590bc2){_0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f5,[_0x575f79[_0x1126('0x59')],_0x590bc2['message'][_0x1126('0x5d')]()][_0x1126('0x1c')]('\x20')));});}else{return _0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2fe6dc){var _0x3377db=this;return new Promise(function(_0x22ab18,_0x308ee4){if(ami[_0x1126('0x12')]()==![]){return _0x308ee4(_0x3377db[_0x1126('0x1b')](0x1f4,[config[_0x1126('0x13')]['ip'],config[_0x1126('0x13')]['username'],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0xe8f195=schema(properties[_0x1126('0x55')])[_0x1126('0x2')](_0x2fe6dc);if(_0xe8f195['length']>0x0){return _0x308ee4(_0x3377db[_0x1126('0x1b')](0x1f4,_[_0x1126('0x66')](_0xe8f195,'message')[_0x1126('0x1c')](',\x20')));}var _0x5246aa=_[_0x1126('0x56')](_0x75a851[_0x1126('0x54')],{'uniqueid':_0x2fe6dc['uniqueid']});if(_0x5246aa){return BPromise[_0x1126('0x67')]()[_0x1126('0x1a')](function(){if(_0x5246aa[_0x1126('0x57')]){return ami['Action']({'action':_0x1126('0x68'),'channel':_0x5246aa['channel'],'mixmonitorid':_0x2fe6dc['mixmonitorid']})[_0x1126('0x65')](function(_0x40185f){});}})[_0x1126('0x1a')](function(){if(_0x5246aa[_0x1126('0x69')]){return ami[_0x1126('0x1e')]({'action':_0x1126('0x68'),'channel':_0x5246aa[_0x1126('0x69')],'mixmonitorid':_0x2fe6dc['mixmonitorid']})[_0x1126('0x65')](function(_0x43ec00){});}})[_0x1126('0x1a')](function(_0xc39c36){var _0x3f87aa=_[_0x1126('0x56')](_0x5246aa['monitors'],{'mixmonitorid':_0x2fe6dc['mixmonitorid']});if(_0x3f87aa){_0x3f87aa[_0x1126('0x63')]=_0x1126('0x6a');}})['then'](function(){var _0x5ee130=util['format']('%s.%s',_0x2fe6dc[_0x1126('0x58')]||_0x2fe6dc[_0x1126('0x59')],_0x2fe6dc[_0x1126('0x9')]||'wav');var _0x30e32f=_[_0x1126('0x56')](_0x5246aa[_0x1126('0x5c')],{'filename':_0x1126('0x5f')+_0x5ee130[_0x1126('0x5d')]()});if(_0x30e32f){_0x30e32f[_0x1126('0x63')]=_0x1126('0x6a');}})['then'](function(){_0x22ab18({'code':0xc8,'message':[_0x2fe6dc[_0x1126('0x59')],_0x1126('0x6b')][_0x1126('0x1c')]('\x20')});})[_0x1126('0x65')](function(_0x288b9b){_0x308ee4(_0x3377db['error'](0x1f5,[_0x2fe6dc['uniqueid'],_0x288b9b[_0x1126('0x20')][_0x1126('0x5d')]()]['join']('\x20')));});}else{return _0x308ee4(_0x3377db[_0x1126('0x1b')](0x1f5,_0x1126('0x6c')));}});},'VoiceQueuesChannels':function(_0x366675){return new Promise(function(_0x6a41c0,_0x2828d4){var _0x30d240=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x6e')]);_0x6a41c0({'count':_0x30d240[_0x1126('0x51')],'rows':_0x30d240});});},'VoiceQueuesChannel':function(_0x3d5e15){var _0x16e48a=this;return new Promise(function(_0x1228cf,_0x3dad39){var _0x592005=schema(properties[_0x1126('0x6f')])[_0x1126('0x2')](_0x3d5e15);if(_0x592005[_0x1126('0x51')]>0x0){return _0x3dad39(_0x16e48a['error'](0x1f4,_['map'](_0x592005,_0x1126('0x20'))[_0x1126('0x1c')](',\x20')));}var _0x1998f2=_[_0x1126('0x56')](_0x75a851['queueChannels'],{'uniqueid':_0x3d5e15['uniqueid']});if(_0x1998f2){_0x1228cf(_0x1998f2);}else{return _0x3dad39(_0x16e48a['error'](0x1f5,_0x1126('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x1b355f){var _0x3693b9=this;return new Promise(function(_0xdedb8f,_0x54a72e){if(ami[_0x1126('0x12')]()==![]){return _0x54a72e(_0x3693b9['error'](0x1f4,[config[_0x1126('0x13')]['ip'],config[_0x1126('0x13')][_0x1126('0x14')],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0x1e7c9a=schema(properties[_0x1126('0x70')])['validate'](_0x1b355f);if(_0x1e7c9a[_0x1126('0x51')]>0x0){return _0x54a72e(_0x3693b9['error'](0x1f4,_[_0x1126('0x66')](_0x1e7c9a,_0x1126('0x20'))['join'](',\x20')));}var _0x376175=_[_0x1126('0x56')](_0x75a851['queueChannels'],{'uniqueid':_0x1b355f[_0x1126('0x59')]});if(_0x376175&&_0x376175[_0x1126('0x57')]){return ami['Action']({'action':'Hangup','channel':_0x376175[_0x1126('0x57')]})[_0x1126('0x1a')](function(_0x21ea6e){_0xdedb8f({'code':0xc8,'message':[_0x1b355f['uniqueid'],_0x21ea6e['message']['toLowerCase']()][_0x1126('0x1c')]('\x20')});})['catch'](function(_0x4cfbed){_0x54a72e(_0x3693b9[_0x1126('0x1b')](0x1f5,[_0x1b355f['uniqueid'],_0x4cfbed[_0x1126('0x20')][_0x1126('0x5d')]()]['join']('\x20')));});}else{return _0x54a72e(_0x3693b9[_0x1126('0x1b')](0x1f5,_0x1126('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x161b88){var _0xc3bb7f=this;return new Promise(function(_0x1644fc,_0x5e9872){if(ami[_0x1126('0x12')]()==![]){return _0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x1126('0x13')][_0x1126('0x14')],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0x2598a7=schema(properties[_0x1126('0x71')])[_0x1126('0x2')](_0x161b88);if(_0x2598a7[_0x1126('0x51')]>0x0){return _0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f4,_[_0x1126('0x66')](_0x2598a7,_0x1126('0x20'))[_0x1126('0x1c')](',\x20')));}var _0x2010a9=_[_0x1126('0x56')](_0x75a851[_0x1126('0x6e')],{'uniqueid':_0x161b88[_0x1126('0x59')]});if(_0x2010a9&&_0x2010a9['channel']){return ami[_0x1126('0x1e')]({'action':_0x1126('0x72'),'channel':_0x2010a9[_0x1126('0x57')],'exten':_0x161b88[_0x1126('0x73')],'context':_0x161b88[_0x1126('0x74')]||_0x2010a9['context'],'priority':0x1})[_0x1126('0x1a')](function(_0x4bf54b){_0x1644fc({'code':0xc8,'message':[_0x161b88['uniqueid'],_0x4bf54b[_0x1126('0x20')][_0x1126('0x5d')]()]['join']('\x20')});})['catch'](function(_0xaada05){_0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f5,[_0x161b88[_0x1126('0x59')],_0xaada05[_0x1126('0x20')][_0x1126('0x5d')]()][_0x1126('0x1c')]('\x20')));});}else{return _0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f5,_0x1126('0x6c')));}});},'Agents':function(_0x4a29e1){return new Promise(function(_0x5644ea,_0x13bfe4){var _0x402e9a=_[_0x1126('0x6d')](_0x75a851[_0x1126('0xe')]);_0x5644ea({'count':_0x402e9a[_0x1126('0x51')],'rows':_0x402e9a});});},'Telephones':function(_0x336b4b){return new Promise(function(_0x482199,_0xadea7b){var _0x2cc4c8=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x75')]);_0x482199({'count':_0x2cc4c8[_0x1126('0x51')],'rows':_0x2cc4c8});});},'Trunks':function(_0x1796eb){return new Promise(function(_0x2418ca,_0x2d2dfc){var _0x38eac6=_[_0x1126('0x6d')](_0x75a851['trunks']);_0x2418ca({'count':_0x38eac6['length'],'rows':_0x38eac6});});},'OutboundChannels':function(_0x271d7c){return new Promise(function(_0x55496f,_0x3c5ea3){var _0x4bd50a=_[_0x1126('0x6d')](_0x75a851['outboundChannels']);_0x55496f({'count':_0x4bd50a[_0x1126('0x51')],'rows':_0x4bd50a});});},'Outbound':function(_0x4fbd44){return new Promise(function(_0x5c5044,_0x48c461){_0x5c5044(_0x75a851[_0x1126('0x76')]);});},'Campaigns':function(_0x31769a){return new Promise(function(_0x53f58b,_0x4ce12f){var _0x44325d=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x77')]);_0x53f58b({'count':_0x44325d['length'],'rows':_0x44325d});});},'VoiceQueuesPreview':function(_0x48f914){var _0x25f2e3=this;return new Promise(function(_0x546d32,_0x41679a){_0x5a2189[_0x1126('0x78')](_0x48f914['id'])[_0x1126('0x1a')](function(_0x29922a){_0x546d32({'code':0xc8,'message':_0x29922a[_0x1126('0x20')]});})['catch'](function(_0x591c75){_0x41679a(_0x25f2e3[_0x1126('0x1b')](0x1f4,_0x591c75[_0x1126('0x20')]));});});},'EventManager':function(_0xfc9fb4){var _0x3758fa=this;return new Promise(function(_0x1b8218,_0x23bd79){if(!_0xfc9fb4[_0x1126('0x79')]){return _0x23bd79(_0x3758fa[_0x1126('0x1b')](0x1f4,_0x1126('0x7a')));}ami[_0x1126('0x7b')](_0x1126('0x7c')+_0xfc9fb4['event'],_0xfc9fb4[_0x1126('0x20')]);_0x1b8218({'code':0xc8,'message':_0xfc9fb4});});},'FaxAccounts':function(_0x4e4a05){return new Promise(function(_0x99eb4e,_0x4ec8b9){var _0x4256e6=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x7d')]);_0x99eb4e({'count':_0x4256e6[_0x1126('0x51')],'rows':_0x4256e6});});},'SendFax':function(_0x59c04b){var _0x429183=this;return new Promise(function(_0x834360,_0x4b5d46){_0x5c68c8['send'](_0x59c04b)[_0x1126('0x1a')](function(_0x71b813){_0x834360({'code':0xc8,'message':_0x71b813[_0x1126('0x20')]});})['catch'](function(_0x8e044c){_0x4b5d46(_0x429183['error'](0x1f4,_0x8e044c[_0x1126('0x20')]));});});},'CheckAfterSend':function(_0x3a40c6){var _0x4d6bb2=this;return new Promise(function(_0x58607d,_0x315192){_0x5c68c8[_0x1126('0x7e')](_0x3a40c6)[_0x1126('0x1a')](function(_0x323d0a){_0x58607d({'code':0xc8,'message':_0x323d0a['message']});})[_0x1126('0x65')](function(_0x454a67){_0x315192(_0x4d6bb2[_0x1126('0x1b')](0x1f4,_0x454a67['message']));});});}};var _0x53fd91=jayson['server'](_0x4f239c)[_0x1126('0x7f')]();_0x53fd91['on'](_0x1126('0x1b'),function(_0x1a7c9b){return _0x907180(_0x1a7c9b);});_0x53fd91[_0x1126('0x8')](0x232a,'127.0.0.1',function(){console[_0x1126('0x80')](_0x1126('0x81'),0x232a);return _0x40ba58(_0x1126('0x82')+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 b3648cb..fbd7c7e 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 _0x9c10=['length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','lodash','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','routeId','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','getContacts','then','isEmpty'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x9c10,0x85));var _0x09c1=function(_0x406e34,_0x26444d){_0x406e34=_0x406e34-0x0;var _0x2512a4=_0x9c10[_0x406e34];return _0x2512a4;};'use strict';var _=require(_0x09c1('0x0'));var BPromise=require('bluebird');var Redis=require(_0x09c1('0x1'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x09c1('0x2'))(_0x09c1('0x3'));var cmContactRpc=require(_0x09c1('0x4'));config[_0x09c1('0x5')]=_['defaults'](config[_0x09c1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x09c1('0x6'))(new Redis(config[_0x09c1('0x5')]));function emit(_0x57036b,_0x3fcffb,_0x5cf7a2,_0x2f2b4e,_0x471b6a){logger[_0x09c1('0x7')](_0x09c1('0x8'),_0x57036b,_0x3fcffb['id'],_0x5cf7a2,_0x2f2b4e,JSON[_0x09c1('0x9')](_0x471b6a));io['to'](_0x5cf7a2)['emit'](_0x2f2b4e,_0x471b6a);}exports[_0x09c1('0xa')]=function(_0x5718ca,_0x1f397d,_0x99c08,_0x2d8601){var _0x37dcc1,_0xd32e7e;var _0xd776cc={};var _0x584f04;var _0x56c583=Number(_0x99c08['data1']);var _0x37a71c=_0x99c08[_0x09c1('0xb')]?Boolean(Number(_0x99c08[_0x09c1('0xb')])):![];var _0x5872d8;var _0x3ce410=![];if(!_[_0x09c1('0xc')](_0x99c08[_0x09c1('0xd')])){if(_0x99c08[_0x09c1('0xd')]=='1')_0x3ce410=!![];}if(!_0x3ce410){if(_0x2d8601['xmd-contactid']){_0xd776cc['id']=_0x2d8601[_0x09c1('0xe')];}}if(!_0xd776cc['id']){_0xd776cc[_0x09c1('0xf')]=_0x56c583;_0x5872d8=_0x99c08[_0x09c1('0x10')]&&_0x99c08[_0x09c1('0x10')]!=='0'?_0x99c08['data3'][_0x09c1('0x11')](','):[_0x09c1('0x12')];_0xd776cc[_0x09c1('0x13')]=_['map'](_0x5872d8,function(_0xa13ab0){var _0x8a454f={};_0x8a454f[_0xa13ab0]=_0x2d8601['routeId']?_0x2d8601[_0x09c1('0x14')]:_0x2d8601['calleridnum'];return _0x8a454f;});_0x584f04=_0x2d8601[_0x09c1('0x15')]?_0x2d8601[_0x09c1('0x14')]:_0x2d8601[_0x09c1('0x16')];}var _0x1cf37f=['id',_0x09c1('0x17'),_0x09c1('0x18'),_0x09c1('0x12'),'mobile',_0x09c1('0x19'),_0x09c1('0xf'),_0x09c1('0x1a'),_0x09c1('0x1b'),_0x09c1('0x1c')];var _0x55405a=_['union'](_0x1cf37f,_0x5872d8);BPromise['resolve']()['then'](cmContactRpc[_0x09c1('0x1d')]({'attributes':_0x55405a,'where':_0xd776cc,'phone':_0x584f04}))[_0x09c1('0x1e')](function(_0x3501e7){_0xd32e7e=_0x3501e7;if(!_[_0x09c1('0x1f')](_0xd32e7e)){if(_0xd32e7e[_0x09c1('0x20')]===0x1){_0x37dcc1=_0xd32e7e[0x0];logger[_0x09c1('0x7')](_0x09c1('0x21'),_0x2d8601[_0x09c1('0x22')],_0x1f397d['id'],_0x37dcc1['id']);}else{logger[_0x09c1('0x7')](_0x09c1('0x23'),_0x2d8601['uniqueid'],_0x1f397d['id'],_[_0x09c1('0x24')](_0xd32e7e,'id')[_0x09c1('0x25')](','));}return;}else{logger[_0x09c1('0x7')](_0x09c1('0x26'),_0x2d8601[_0x09c1('0x22')],_0x1f397d['id']);var _0x42b420={'ListId':_0x56c583};var _0x350eb7=_0x99c08['data4']&&_0x99c08[_0x09c1('0x27')]!=='0'?_0x99c08[_0x09c1('0x27')]:_0x09c1('0x12');if(_0x37a71c){logger[_0x09c1('0x7')](_0x09c1('0x28'),_0x2d8601[_0x09c1('0x22')],_0x1f397d['id']);_0x42b420[_0x350eb7]=_[_0x09c1('0xc')](_0x2d8601['routeId'])?_0x2d8601['calleridnum']:_0x2d8601[_0x09c1('0x14')];if(_[_0x09c1('0xc')](_0x2d8601['routeId'])){_0x42b420['firstName']=_0x2d8601[_0x09c1('0x29')]&&_0x2d8601['calleridname']!==_0x09c1('0x2a')?_0x2d8601[_0x09c1('0x29')]:_0x09c1('0x2b');}else{_0x42b420[_0x09c1('0x17')]=_0x2d8601['destcalleridname']&&_0x2d8601[_0x09c1('0x2c')]!==_0x09c1('0x2a')?_0x2d8601[_0x09c1('0x2c')]:_0x09c1('0x2b');}return BPromise[_0x09c1('0x2d')]()[_0x09c1('0x1e')](cmContactRpc[_0x09c1('0x2e')](_0x42b420))[_0x09c1('0x1e')](function(_0x14aa81){_0x37dcc1=_0x14aa81;_0xd32e7e[_0x09c1('0x2f')](_0x14aa81);if(_0x37dcc1){logger[_0x09c1('0x7')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2d8601[_0x09c1('0x22')],_0x1f397d['id'],_0x37dcc1['id']);}return;});}else{logger['info'](_0x09c1('0x30'),_0x2d8601[_0x09c1('0x22')],_0x1f397d['id']);_0x42b420[_0x350eb7]=_[_0x09c1('0xc')](_0x2d8601[_0x09c1('0x15')])?_0x2d8601[_0x09c1('0x16')]:_0x2d8601[_0x09c1('0x14')];if(_[_0x09c1('0xc')](_0x2d8601[_0x09c1('0x15')])){_0x42b420[_0x09c1('0x17')]=_0x2d8601[_0x09c1('0x29')]&&_0x2d8601[_0x09c1('0x29')]!==_0x09c1('0x2a')?_0x2d8601[_0x09c1('0x29')]:_0x09c1('0x2b');}else{_0x42b420[_0x09c1('0x17')]=_0x2d8601['destcalleridname']&&_0x2d8601[_0x09c1('0x2c')]!==''?_0x2d8601['destcalleridname']:_0x09c1('0x2b');}_0x37dcc1=_0x42b420;_0xd32e7e['push'](_0x42b420);return;}}})['then'](function(){if(_0x5718ca){emit(_0x2d8601['uniqueid'],_0x1f397d,util['format']('user:%s',_0x5718ca[_0x09c1('0x31')]),util[_0x09c1('0x32')](_0x09c1('0x33'),_0x99c08[_0x09c1('0x34')][_0x09c1('0x35')]()),{'evt':_[_0x09c1('0x36')](_0x2d8601,{'autoCreate':_0x37a71c}),'contact':_0x37dcc1===undefined?{}:_0x37dcc1,'contacts':_0xd32e7e[_0x09c1('0x20')]===0x0?undefined:_0xd32e7e});}});}; \ No newline at end of file +var _0x6262=['toLowerCase','merge','bluebird','util','../../../../config/environment','../../../../config/logger','defaults','localhost','redis','info','[CM][%s][%s]','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','destcalleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridnum','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s'];(function(_0x5a6f8a,_0x30081f){var _0x1be51f=function(_0x590e74){while(--_0x590e74){_0x5a6f8a['push'](_0x5a6f8a['shift']());}};_0x1be51f(++_0x30081f);}(_0x6262,0x72));var _0x2626=function(_0x5eb4bb,_0xbd4598){_0x5eb4bb=_0x5eb4bb-0x0;var _0x12d25b=_0x6262[_0x5eb4bb];return _0x12d25b;};'use strict';var _=require('lodash');var BPromise=require(_0x2626('0x0'));var Redis=require('ioredis');var util=require(_0x2626('0x1'));var config=require(_0x2626('0x2'));var logger=require(_0x2626('0x3'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x2626('0x4')](config['redis'],{'host':_0x2626('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2626('0x6')]));function emit(_0x573764,_0x4bddca,_0x2cf025,_0x43f99f,_0x2b9e97){logger[_0x2626('0x7')](_0x2626('0x8'),_0x573764,_0x4bddca['id'],_0x2cf025,_0x43f99f,JSON['stringify'](_0x2b9e97));io['to'](_0x2cf025)['emit'](_0x43f99f,_0x2b9e97);}exports[_0x2626('0x9')]=function(_0x340346,_0xbd0e60,_0x1b1c1d,_0xf6c2f5){var _0x59526a,_0x5991be;var _0x284368={};var _0x5d0a02;var _0x51bd80=Number(_0x1b1c1d['data1']);var _0xc8739e=_0x1b1c1d['data2']?Boolean(Number(_0x1b1c1d[_0x2626('0xa')])):![];var _0x344db2;var _0x524a4a=![];if(!_[_0x2626('0xb')](_0x1b1c1d[_0x2626('0xc')])){if(_0x1b1c1d[_0x2626('0xc')]=='1')_0x524a4a=!![];}if(!_0x524a4a){if(_0xf6c2f5[_0x2626('0xd')]){_0x284368['id']=_0xf6c2f5['xmd-contactid'];}}if(!_0x284368['id']){_0x284368[_0x2626('0xe')]=_0x51bd80;_0x344db2=_0x1b1c1d[_0x2626('0xf')]&&_0x1b1c1d[_0x2626('0xf')]!=='0'?_0x1b1c1d[_0x2626('0xf')][_0x2626('0x10')](','):['phone'];_0x284368[_0x2626('0x11')]=_['map'](_0x344db2,function(_0x29bccc){var _0x265637={};_0x265637[_0x29bccc]=_0xf6c2f5['routeId']?_0xf6c2f5[_0x2626('0x12')]:_0xf6c2f5['calleridnum'];return _0x265637;});_0x5d0a02=_0xf6c2f5['routeId']?_0xf6c2f5[_0x2626('0x12')]:_0xf6c2f5['calleridnum'];}var _0x38fc77=['id',_0x2626('0x13'),_0x2626('0x14'),_0x2626('0x15'),_0x2626('0x16'),_0x2626('0x17'),_0x2626('0xe'),_0x2626('0x18'),_0x2626('0x19'),_0x2626('0x1a')];var _0x4a281b=_[_0x2626('0x1b')](_0x38fc77,_0x344db2);BPromise[_0x2626('0x1c')]()[_0x2626('0x1d')](cmContactRpc[_0x2626('0x1e')]({'attributes':_0x4a281b,'where':_0x284368,'phone':_0x5d0a02}))[_0x2626('0x1d')](function(_0x44b30c){_0x5991be=_0x44b30c;if(!_[_0x2626('0x1f')](_0x5991be)){if(_0x5991be[_0x2626('0x20')]===0x1){_0x59526a=_0x5991be[0x0];logger[_0x2626('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0xf6c2f5[_0x2626('0x21')],_0xbd0e60['id'],_0x59526a['id']);}else{logger[_0x2626('0x7')](_0x2626('0x22'),_0xf6c2f5['uniqueid'],_0xbd0e60['id'],_[_0x2626('0x23')](_0x5991be,'id')[_0x2626('0x24')](','));}return;}else{logger['info'](_0x2626('0x25'),_0xf6c2f5[_0x2626('0x21')],_0xbd0e60['id']);var _0x3425e6={'ListId':_0x51bd80};var _0x4134b5=_0x1b1c1d[_0x2626('0x26')]&&_0x1b1c1d[_0x2626('0x26')]!=='0'?_0x1b1c1d['data4']:'phone';if(_0xc8739e){logger['info'](_0x2626('0x27'),_0xf6c2f5[_0x2626('0x21')],_0xbd0e60['id']);_0x3425e6[_0x4134b5]=_[_0x2626('0xb')](_0xf6c2f5[_0x2626('0x28')])?_0xf6c2f5[_0x2626('0x29')]:_0xf6c2f5[_0x2626('0x12')];if(_[_0x2626('0xb')](_0xf6c2f5[_0x2626('0x28')])){_0x3425e6[_0x2626('0x13')]=_0xf6c2f5[_0x2626('0x2a')]&&_0xf6c2f5[_0x2626('0x2a')]!==''?_0xf6c2f5['calleridname']:_0x2626('0x2b');}else{_0x3425e6[_0x2626('0x13')]=_0xf6c2f5[_0x2626('0x2c')]&&_0xf6c2f5['destcalleridname']!==_0x2626('0x2d')?_0xf6c2f5[_0x2626('0x2c')]:'Unknown';}return BPromise[_0x2626('0x1c')]()[_0x2626('0x1d')](cmContactRpc[_0x2626('0x2e')](_0x3425e6))['then'](function(_0x2fccd8){_0x59526a=_0x2fccd8;_0x5991be[_0x2626('0x2f')](_0x2fccd8);if(_0x59526a){logger[_0x2626('0x7')](_0x2626('0x30'),_0xf6c2f5[_0x2626('0x21')],_0xbd0e60['id'],_0x59526a['id']);}return;});}else{logger[_0x2626('0x7')](_0x2626('0x31'),_0xf6c2f5[_0x2626('0x21')],_0xbd0e60['id']);_0x3425e6[_0x4134b5]=_[_0x2626('0xb')](_0xf6c2f5['routeId'])?_0xf6c2f5[_0x2626('0x29')]:_0xf6c2f5[_0x2626('0x12')];if(_[_0x2626('0xb')](_0xf6c2f5[_0x2626('0x28')])){_0x3425e6[_0x2626('0x13')]=_0xf6c2f5['calleridname']&&_0xf6c2f5[_0x2626('0x2a')]!==_0x2626('0x2d')?_0xf6c2f5[_0x2626('0x2a')]:_0x2626('0x2b');}else{_0x3425e6[_0x2626('0x13')]=_0xf6c2f5['destcalleridname']&&_0xf6c2f5['destcalleridname']!==_0x2626('0x2d')?_0xf6c2f5[_0x2626('0x2c')]:'Unknown';}_0x59526a=_0x3425e6;_0x5991be['push'](_0x3425e6);return;}}})[_0x2626('0x1d')](function(){if(_0x340346){emit(_0xf6c2f5[_0x2626('0x21')],_0xbd0e60,util[_0x2626('0x32')](_0x2626('0x33'),_0x340346[_0x2626('0x34')]),util[_0x2626('0x32')](_0x2626('0x35'),_0x1b1c1d['action'][_0x2626('0x36')]()),{'evt':_[_0x2626('0x37')](_0xf6c2f5,{'autoCreate':_0xc8739e}),'contact':_0x59526a===undefined?{}:_0x59526a,'contacts':_0x5991be[_0x2626('0x20')]===0x0?undefined:_0x5991be});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e86d7d3..01fe082 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 _0xdc86=['length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','data2','render','data3','isNil','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winApplication','winArguments','user:%s','name','format','trigger:%s','exec','integration','accounts','voiceExtensions','routeId','urlforward','script','search','replace','channel','AllConditions','checkConditions','AnyConditions','some','field','chat','ChatWebsiteId','value','operator','AccountId','interaction','event','queue','membername','lastevent','offlineMessage','equals','lodash','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:closedinteraction','custom:substatus','custom:rejectmessage','emit','info','prototype','clone','motionChannel','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions'];(function(_0x49a9a6,_0x12c8c7){var _0x151734=function(_0x8a6c9a){while(--_0x8a6c9a){_0x49a9a6['push'](_0x49a9a6['shift']());}};_0x151734(++_0x12c8c7);}(_0xdc86,0x118));var _0x6dc8=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xdc86[_0x25d386];return _0x857f4a;};'use strict';var util=require('util');var _=require(_0x6dc8('0x0'));var url=require('url');var Mustache=require(_0x6dc8('0x1'));var Redis=require('ioredis');var urlforward=require(_0x6dc8('0x2'));var integration=require(_0x6dc8('0x3'));var cmContact=require(_0x6dc8('0x4'));var script=require(_0x6dc8('0x5'));var config=require(_0x6dc8('0x6'));var logger=require('../../../config/logger')(_0x6dc8('0x7'));var ami=require(_0x6dc8('0x8'));config[_0x6dc8('0x9')]=_[_0x6dc8('0xa')](config[_0x6dc8('0x9')],{'host':_0x6dc8('0xb'),'port':0x18eb});var io=require(_0x6dc8('0xc'))(new Redis(config[_0x6dc8('0x9')]));var operators={'equals':function(_0x4a4efe,_0x4583b7){return _0x4a4efe==_0x4583b7;},'not_equals':function(_0x58dfa6,_0x2f0692){return _0x58dfa6!=_0x2f0692;}};var barAndWebActions=[_0x6dc8('0xd'),_0x6dc8('0xe'),_0x6dc8('0xf')];function Trigger(_0x504a47){this[_0x6dc8('0x10')]=_0x504a47[_0x6dc8('0x10')];this[_0x6dc8('0x11')]=_0x504a47[_0x6dc8('0x11')];this[_0x6dc8('0x12')]=_0x504a47[_0x6dc8('0x12')];this['templates']=_0x504a47[_0x6dc8('0x13')];this['voiceExtensions']=_0x504a47['voiceExtensions'];this[_0x6dc8('0x14')]=_0x504a47[_0x6dc8('0x14')];this[_0x6dc8('0x15')]=_0x504a47['freshdeskAccounts'];this[_0x6dc8('0x16')]=_0x504a47[_0x6dc8('0x16')];this[_0x6dc8('0x17')]=_0x504a47[_0x6dc8('0x17')];this[_0x6dc8('0x18')]=_0x504a47[_0x6dc8('0x18')];this[_0x6dc8('0x19')]=_0x504a47[_0x6dc8('0x19')];this[_0x6dc8('0x1a')]=_0x504a47['vtigerAccounts'];this['servicenowAccounts']=_0x504a47[_0x6dc8('0x1b')];this[_0x6dc8('0x1c')]=_0x504a47[_0x6dc8('0x1c')];this[_0x6dc8('0x1d')]=_0x504a47[_0x6dc8('0x1d')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x6dc8('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6dc8('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x6dc8('0x1a')],'dynamics365':this[_0x6dc8('0x1c')],'freshsales':this[_0x6dc8('0x1d')],'servicenow':this[_0x6dc8('0x1b')]};ami['on'](_0x6dc8('0x1e'),this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x21'),this[_0x6dc8('0x1f')]['bind'](this));ami['on'](_0x6dc8('0x22'),this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on']('custom:agentcomplete',this[_0x6dc8('0x1f')]['bind'](this));ami['on'](_0x6dc8('0x23'),this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on']('custom:agentnoanswer',this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x24'),this['syncCustomEvent'][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x25'),this[_0x6dc8('0x1f')]['bind'](this));ami['on']('custom:agentreject',this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on']('custom:amd',this[_0x6dc8('0x1f')]['bind'](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x26'),this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x27'),this[_0x6dc8('0x28')][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x29'),this[_0x6dc8('0x28')][_0x6dc8('0x20')](this));ami['on']('custom:dialend',this[_0x6dc8('0x28')]['bind'](this));ami['on']('custom:newinteraction',this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x2a'),this[_0x6dc8('0x1f')]['bind'](this));ami['on'](_0x6dc8('0x2b'),this['syncCustomEvent'][_0x6dc8('0x20')](this));ami['on']('custom:incomingmessage',this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on']('custom:outgoingmessage',this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on']('custom:acceptmessage',this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on'](_0x6dc8('0x2c'),this[_0x6dc8('0x1f')][_0x6dc8('0x20')](this));ami['on']('custom:offlineMessage',this['syncCustomEvent'][_0x6dc8('0x20')](this));}Trigger['prototype'][_0x6dc8('0x2d')]=function(_0x1cf28f,_0x4b5695,_0x5d91df){logger[_0x6dc8('0x2e')](_0x1cf28f,_0x4b5695,JSON['stringify'](_0x5d91df));io['to'](_0x1cf28f)[_0x6dc8('0x2d')](_0x4b5695,_0x5d91df);};Trigger[_0x6dc8('0x2f')][_0x6dc8('0x1f')]=function(_0x41f5c1){var _0x16532b=_[_0x6dc8('0x30')](_0x41f5c1);if(typeof _0x16532b[_0x6dc8('0x31')]==='undefined'){_0x16532b[_0x6dc8('0x31')]=_0x6dc8('0x32');}this[_0x6dc8('0x33')](_0x16532b);};Trigger[_0x6dc8('0x2f')][_0x6dc8('0x28')]=function(_0x446eb6){if(this[_0x6dc8('0x11')][_0x446eb6[_0x6dc8('0x34')]]){this[_0x6dc8('0x1f')](_0x446eb6);}};Trigger['prototype']['checkTriggers']=function(_0x6cab90){var _0x3159c2;for(var _0x4ca5c4 in this[_0x6dc8('0x10')]){if(this[_0x6dc8('0x10')][_0x6dc8('0x35')](_0x4ca5c4)){if(this[_0x6dc8('0x10')][_0x4ca5c4][_0x6dc8('0x36')]){_0x3159c2=this[_0x6dc8('0x37')](this[_0x6dc8('0x10')][_0x4ca5c4],_0x6cab90);if(_0x3159c2){_[_0x6dc8('0x38')](_0x6cab90,_0x6cab90[_0x6dc8('0x39')]);for(var _0x60c16f=0x0,_0x151630,_0x253cc1,_0x33e04b;_0x60c16f0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x5288aa,_0x1f3cfe){_0x5288aa=_0x5288aa-0x0;var _0x4784d7=_0xe14b[_0x5288aa];return _0x4784d7;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ 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 0d6c55d..d9d0abc 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 _0xe5f0=['contacts?$select=','\x20eq\x20\x27','%2b','Bearer\x20','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','picklist','type','nameField','indexOf','content','incident','assign','getString','Descriptions','/contacts(','Fields','ticketType','/systemusers(','callDirection','queue','Subjects','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\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','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1'];(function(_0x5f5d0f,_0xf9c19f){var _0x2d6518=function(_0x4e0768){while(--_0x4e0768){_0x5f5d0f['push'](_0x5f5d0f['shift']());}};_0x2d6518(++_0xf9c19f);}(_0xe5f0,0x10f));var _0x0e5f=function(_0xf44777,_0x419161){_0xf44777=_0xf44777-0x0;var _0x4a38cc=_0xe5f0[_0xf44777];return _0x4a38cc;};'use strict';var _=require(_0x0e5f('0x0'));var rp=require(_0x0e5f('0x1'));var util=require('util');var intUtil=require(_0x0e5f('0x2'));var md5=require(_0x0e5f('0x3'));var Redis=require(_0x0e5f('0x4'));var logger=require('../../../../config/logger')(_0x0e5f('0x5'));var config=require(_0x0e5f('0x6'));config['redis']=_[_0x0e5f('0x7')](config[_0x0e5f('0x8')],{'host':_0x0e5f('0x9'),'port':0x18eb});var io=require(_0x0e5f('0xa'))(new Redis(config['redis']));function getAuthToken(_0x164e78,_0x82c3a4,_0x2b793a){if(_0x164e78[_0x0e5f('0xb')]){_0x164e78['remoteUri']=_0x164e78['CloudProvider']['data7'];_0x164e78['tenantId']=_0x164e78[_0x0e5f('0xc')][_0x0e5f('0xd')];return Promise[_0x0e5f('0xe')](_0x164e78[_0x0e5f('0xc')][_0x0e5f('0xf')]);}var _0x416ade={'method':_0x0e5f('0x10'),'uri':_0x82c3a4,'form':{'client_id':_0x164e78[_0x0e5f('0x11')],'resource':_0x164e78[_0x0e5f('0x12')],'username':_0x164e78[_0x0e5f('0x13')],'password':_0x164e78[_0x0e5f('0x14')],'grant_type':_0x0e5f('0x14'),'client_secret':_0x164e78[_0x0e5f('0x15')]},'json':!![]};return rp(_0x416ade)[_0x0e5f('0x16')](function(_0x5b340e){return _0x5b340e[_0x0e5f('0x17')];})[_0x0e5f('0x18')](function(_0x59fcaf){logger[_0x0e5f('0x19')]('['+[_0x2b793a[_0x0e5f('0x1a')]()]+_0x0e5f('0x1b'));return _0x59fcaf[_0x0e5f('0x1c')];});}function getUser(_0xf56450,_0x577528,_0x4efa13,_0x1bd3ac,_0x4b45b4,_0x4a58e3){return new Promise(function(_0x281571,_0x261924){return getAuthToken(_0x577528,_0x1bd3ac,_0x4a58e3)[_0x0e5f('0x16')](function(_0xdf9c0b){var _0x5f5d86={'method':_0x0e5f('0x1d'),'uri':_0x4b45b4+_0x0e5f('0x1e'),'headers':{'Authorization':'Bearer\x20'+_0xdf9c0b,'OData-Version':_0x0e5f('0x1f')},'json':!![]};return rp(_0x5f5d86);})[_0x0e5f('0x16')](function(_0x122703){var _0x1ae5dc=_0x122703[_0x0e5f('0x20')];var _0x2f1b7a=![];var _0x1ff495=null;if(!_[_0x0e5f('0x21')](_0x4efa13)){if(intUtil[_0x0e5f('0x22')](_0x4efa13[_0x0e5f('0x23')])){_0xf56450[_0x0e5f('0x24')]=_0x4efa13[_0x0e5f('0x23')];for(_0x1ff495=0x0;_0x1ff495<_0x1ae5dc[_0x0e5f('0x25')];_0x1ff495++){if(_0x1ae5dc[_0x1ff495][_0x0e5f('0x26')]===_0x4efa13[_0x0e5f('0x23')]&&!_0x1ae5dc[_0x1ff495][_0x0e5f('0x27')]){_0x2f1b7a=!![];logger['info']('['+[_0x4a58e3[_0x0e5f('0x1a')]()]+_0x0e5f('0x28')+_0x1ae5dc[_0x1ff495][_0x0e5f('0x29')]+'!');_0xf56450[_0x0e5f('0x2a')]=_0x1ae5dc[_0x1ff495][_0x0e5f('0x29')];}}}}if(!_0x2f1b7a){logger[_0x0e5f('0x2b')]('['+[_0x4a58e3[_0x0e5f('0x1a')]()]+_0x0e5f('0x2c'));_0xf56450[_0x0e5f('0x24')]=_0x577528['username'];for(_0x1ff495=0x0;_0x1ff495<_0x1ae5dc['length'];_0x1ff495++){if(_0x1ae5dc[_0x1ff495][_0x0e5f('0x26')]===_0x577528[_0x0e5f('0x13')]){_0xf56450[_0x0e5f('0x2a')]=_0x1ae5dc[_0x1ff495][_0x0e5f('0x29')];}}}_0x281571(_0xf56450);})[_0x0e5f('0x18')](function(_0x13850e){_0x261924(_0x13850e[_0x0e5f('0x1c')]);});});}function createEndUser(_0x202957,_0x1ed802,_0x427235,_0x57e791,_0x54dc49,_0x9abbb2,_0x504084){return new Promise(function(_0x15db0c,_0x27dfa2){return getAuthToken(_0x1ed802,_0x427235,_0x9abbb2)['then'](function(_0x56daf0){var _0x2468e1=_0x9abbb2[_0x0e5f('0x2d')]()===_0x0e5f('0x2e')?_0x54dc49[_0x0e5f('0x2f')]:_0x54dc49[_0x0e5f('0x30')];var _0xaa5f73={'method':_0x0e5f('0x10'),'uri':_0x57e791+_0x0e5f('0x31'),'body':{'fullname':_0x2468e1,'firstname':_0x2468e1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x202957[_0x0e5f('0x2a')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x56daf0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0xaa5f73[_0x0e5f('0x32')][_0x504084]=_0x2468e1;return rp(_0xaa5f73);})['then'](function(_0x251c56){var _0x1a4ae9=_0x251c56['headers'][_0x0e5f('0x33')];var _0x4a3efd=_0x1a4ae9[_0x0e5f('0x34')](_0x1a4ae9['lastIndexOf']('(')+0x1,_0x1a4ae9[_0x0e5f('0x35')](')'));_0x202957[_0x0e5f('0x36')]=_0x4a3efd;_0x15db0c(_0x202957);})[_0x0e5f('0x18')](function(_0xd1f973){_0x27dfa2(_0xd1f973[_0x0e5f('0x1c')]);});});}function getEndUser(_0x26f7c,_0xefa4b2,_0x33e1bb,_0x4e721a,_0x131256,_0x157547,_0x473add,_0xb2eec8){var _0x21c72c=_0x157547[_0x0e5f('0x2d')]()==='outbound'?_0x131256[_0x0e5f('0x2f')]:_0x131256[_0x0e5f('0x30')];return getAuthToken(_0xefa4b2,_0x33e1bb,_0x157547)[_0x0e5f('0x16')](function(_0xc8b143){_0xb2eec8=_0xb2eec8?_0xb2eec8:_0x0e5f('0x37');var _0x313497={'method':_0x0e5f('0x1d'),'uri':_0x4e721a+_0x0e5f('0x38')+_0xb2eec8+'&$filter='+_0xb2eec8+_0x0e5f('0x39')+_0x21c72c['replace']('+',_0x0e5f('0x3a'))+'\x27','headers':{'Authorization':_0x0e5f('0x3b')+_0xc8b143,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x313497);})[_0x0e5f('0x16')](function(_0xb85786){var _0x4485f4=![];if(!_0xb85786)return _0x4485f4;var _0x1ad01c=_0xb85786[_0x0e5f('0x20')];for(var _0x163133=0x0;_0x163133<_0x1ad01c[_0x0e5f('0x25')];_0x163133++){if(_0x1ad01c[_0x163133][_0xb2eec8]===_0x21c72c){_0x4485f4=!![];_0x26f7c[_0x0e5f('0x36')]=_0x1ad01c[_0x163133][_0x0e5f('0x3c')];}}return _0x4485f4;})[_0x0e5f('0x16')](function(_0x3c7b9a){if(_0x3c7b9a)return _0x26f7c;if(_0x473add===_0x0e5f('0x3d')){logger['info']('['+[_0x157547['toUpperCase']()]+_0x0e5f('0x3e'));return _0x26f7c;}return createEndUser(_0x26f7c,_0xefa4b2,_0x33e1bb,_0x4e721a,_0x131256,_0x157547,_0xb2eec8)['then'](function(_0x18ef94){logger[_0x0e5f('0x2b')]('['+[_0x157547[_0x0e5f('0x1a')]()]+_0x0e5f('0x3f'),_0x18ef94['enduserId']);return _0x18ef94;});});}function getCustomFields(_0x7688a8,_0x4206fe,_0x3b76b2){var _0x483a96={};if(_0x7688a8[_0x0e5f('0x25')]>0x0){_['forEach'](_0x7688a8,function(_0x2ff3cb){if(_['includes']([_0x0e5f('0x40'),_0x0e5f('0x41')],_0x2ff3cb[_0x0e5f('0x42')])&&_0x2ff3cb[_0x0e5f('0x43')]&&!_0x2ff3cb['customField']){var _0x39b99c=_0x2ff3cb['idField'][_0x0e5f('0x2d')]();var _0x3d1922=_0x39b99c[_0x0e5f('0x34')](0x0,_0x39b99c['indexOf']('_'));var _0x327c26=_0x39b99c[_0x0e5f('0x34')](_0x39b99c[_0x0e5f('0x44')]('_')+0x1);if(_0x3d1922===_0x3b76b2){_0x483a96[_0x327c26]=_0x2ff3cb[_0x0e5f('0x45')];}}});}return _0x483a96;}function getTicket(_0xd201d4,_0x2301ce,_0x4f7a54,_0x3493a4,_0x2ddb92,_0x27dd93,_0x480300){return new Promise(function(_0x30d375,_0x30e710){var _0x4281d0;return getAuthToken(_0x2301ce,_0x4f7a54,_0x480300)[_0x0e5f('0x16')](function(_0x5e1b92){if(_0x27dd93['ticketType']===_0x0e5f('0x46')){_0x4281d0={'method':_0x0e5f('0x10'),'uri':_0x3493a4+'incidents','body':Object[_0x0e5f('0x47')]({},{'title':intUtil[_0x0e5f('0x48')](_0x27dd93['Subjects'],_0x2ddb92,'\x20'),'description':intUtil[_0x0e5f('0x48')](_0x27dd93[_0x0e5f('0x49')],_0x2ddb92,'\x0a'),'customerid_contact@odata.bind':_0xd201d4[_0x0e5f('0x36')]?_0x0e5f('0x4a')+_0xd201d4[_0x0e5f('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xd201d4[_0x0e5f('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x27dd93[_0x0e5f('0x4b')],_0x2ddb92,_0x27dd93[_0x0e5f('0x4c')])),'headers':{'Authorization':'Bearer\x20'+_0x5e1b92,'OData-Version':_0x0e5f('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x27dd93[_0x0e5f('0x4c')]==='phonecall'){var _0x2f36f5=_0xd201d4[_0x0e5f('0x36')]?[{'partyid_systemuser@odata.bind':_0x0e5f('0x4d')+_0xd201d4['userId']+')','participationtypemask':_0xd201d4[_0x0e5f('0x4e')]===_0x0e5f('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x0e5f('0x4a')+_0xd201d4[_0x0e5f('0x36')]+')','participationtypemask':_0xd201d4['callDirection']===_0x0e5f('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xd201d4['userId']+')','participationtypemask':_0xd201d4[_0x0e5f('0x4e')]===_0x0e5f('0x4f')?0x2:0x1}];_0x4281d0={'method':'POST','uri':_0x3493a4+'phonecalls','body':Object[_0x0e5f('0x47')]({},{'subject':intUtil[_0x0e5f('0x48')](_0x27dd93[_0x0e5f('0x50')],_0x2ddb92,'\x20'),'phonenumber':String(_0x2ddb92['calleridnum']),'description':intUtil[_0x0e5f('0x48')](_0x27dd93[_0x0e5f('0x49')],_0x2ddb92,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd201d4[_0x0e5f('0x36')]?_0x0e5f('0x4a')+_0xd201d4[_0x0e5f('0x36')]+')':undefined,'ownerid@odata.bind':_0x0e5f('0x4d')+_0xd201d4[_0x0e5f('0x2a')]+')','directioncode':_0xd201d4['callDirection']===_0x0e5f('0x4f')?![]:!![],'phonecall_activity_parties':_0x2f36f5},getCustomFields(_0x27dd93['Fields'],_0x2ddb92,_0x27dd93[_0x0e5f('0x4c')])),'headers':{'Authorization':'Bearer\x20'+_0x5e1b92,'OData-Version':_0x0e5f('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4281d0);})[_0x0e5f('0x16')](function(_0x132762){var _0x3b81e7=_0x132762[_0x0e5f('0x51')][_0x0e5f('0x33')];var _0x2870f1=_0x3b81e7['substring'](_0x3b81e7[_0x0e5f('0x35')]('(')+0x1,_0x3b81e7[_0x0e5f('0x35')](')'));_0xd201d4['ticketId']=_0x2870f1;_0x30d375(_0xd201d4);})['catch'](function(_0x27b246){_0x30e710(_0x27b246[_0x0e5f('0x1c')]);});});}function emit(_0x38b58f,_0x2f0be9,_0x2e5cc9,_0x161df8){var _0x3060b8={'uri':util[_0x0e5f('0x52')](_0x0e5f('0x53'),_0x38b58f,_0x2e5cc9,_0x161df8)};io['to'](util[_0x0e5f('0x52')]('user:%s',_0x2f0be9))['emit'](_0x0e5f('0x54'),_0x3060b8);}exports['cs']=function(_0x13cfe7,_0x3eb72b,_0x4f0790,_0x32d183,_0x1976fc,_0x5cafa8,_0xb3d46b,_0x540b34){var _0x63e098={};_0x5cafa8[_0x0e5f('0x12')]=_0x5cafa8[_0x0e5f('0xb')]?intUtil[_0x0e5f('0x55')](_0x5cafa8[_0x0e5f('0xc')]['data7']):intUtil['stripTrailingSlash'](_0x5cafa8[_0x0e5f('0x12')]);_0x5cafa8[_0x0e5f('0x56')]=intUtil[_0x0e5f('0x55')](_0x5cafa8[_0x0e5f('0x56')]);_0x63e098[_0x0e5f('0x4e')]=_0x540b34===_0x0e5f('0x4f')||_0x540b34===_0x0e5f('0x57')?'queue':_0x0e5f('0x2e');var _0x188f67=_0x5cafa8[_0x0e5f('0xb')]?util[_0x0e5f('0x52')]('%s/api/data/v9.0/',_0x5cafa8[_0x0e5f('0xc')]['data7']):util[_0x0e5f('0x52')]('%s/api/data/v9.0/',_0x5cafa8[_0x0e5f('0x12')]);var _0x4a2334=util[_0x0e5f('0x52')](_0x0e5f('0x58'),_0x5cafa8[_0x0e5f('0x59')]);var _0x15d549=util[_0x0e5f('0x52')](_0x0e5f('0x5a'),_0x5cafa8[_0x0e5f('0x56')],_0x3eb72b[_0x0e5f('0x5b')],md5(_0x3eb72b['uniqueid']));if(_0x1976fc&&_0x1976fc['monitor_format']){logger['info']('[QUEUE]',_0x0e5f('0x5c'));_0x3eb72b[_0x0e5f('0x5d')]=_0x15d549;}else if(_0xb3d46b&&_0xb3d46b[_0x0e5f('0x5e')]&&_0xb3d46b[_0x0e5f('0x5e')]!==_0x0e5f('0x5f')){logger[_0x0e5f('0x2b')]('[OUTBOUND]',_0x0e5f('0x5c'));_0x3eb72b[_0x0e5f('0x5d')]=_0x15d549;}else{_0x3eb72b[_0x0e5f('0x5d')]='';}return getUser(_0x63e098,_0x5cafa8,_0x32d183,_0x4a2334,_0x188f67,_0x540b34)[_0x0e5f('0x16')](function(_0x459ca9){logger[_0x0e5f('0x2b')]('['+_0x540b34[_0x0e5f('0x1a')]()+_0x0e5f('0x60'),_0x459ca9[_0x0e5f('0x2a')]);logger[_0x0e5f('0x2b')]('['+_0x540b34['toUpperCase']()+_0x0e5f('0x61'),_0x459ca9['userEmail']);return getEndUser(_0x459ca9,_0x5cafa8,_0x4a2334,_0x188f67,_0x3eb72b,_0x540b34,_0x4f0790[_0x0e5f('0x62')],_0x4f0790[_0x0e5f('0x63')]);})[_0x0e5f('0x16')](function(_0x1a4a1e){logger[_0x0e5f('0x2b')]('['+_0x540b34[_0x0e5f('0x1a')]()+_0x0e5f('0x64'),_0x1a4a1e[_0x0e5f('0x36')]);logger[_0x0e5f('0x2b')]('['+_0x540b34['toUpperCase']()+_0x0e5f('0x65'),_0x3eb72b[_0x0e5f('0x30')]);return getTicket(_0x1a4a1e,_0x5cafa8,_0x4a2334,_0x188f67,_0x3eb72b,_0x4f0790,_0x540b34);})['then'](function(_0x254a58){logger[_0x0e5f('0x2b')](util[_0x0e5f('0x52')]('['+_0x540b34[_0x0e5f('0x1a')]()+_0x0e5f('0x66'),_0x4f0790[_0x0e5f('0x4c')],_0x254a58[_0x0e5f('0x67')]));logger[_0x0e5f('0x2b')](util['format']('['+_0x540b34[_0x0e5f('0x1a')]()+']\x20Call\x20direction:\x20%s',_0x540b34));if(_0x540b34!=='unmanaged'&&_0x4f0790[_0x0e5f('0x68')]){logger[_0x0e5f('0x2b')]('['+_0x540b34[_0x0e5f('0x1a')]()+']',_0x0e5f('0x69'));emit(_0x5cafa8[_0x0e5f('0x12')],_0x32d183[_0x0e5f('0x6a')],_0x4f0790[_0x0e5f('0x4c')],_0x254a58['ticketId']);}})[_0x0e5f('0x18')](function(_0x3f34cf){logger['error']('['+_0x540b34[_0x0e5f('0x1a')]()+_0x0e5f('0x6b'),_0x3f34cf['message']);console[_0x0e5f('0x19')](_0x0e5f('0x6c'),_0x3f34cf);});}; \ No newline at end of file +var _0x2dd4=['CloudProvider','data2','resolve','data5','POST','clientId','remoteUri','password','clientSecret','access_token','catch','error','toUpperCase','then','GET','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','enduserId','message','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','4.0','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','assign','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\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','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','./util','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','modernAuthentication','data7'];(function(_0x5ae1d5,_0x4d789b){var _0x404871=function(_0xde5df6){while(--_0xde5df6){_0x5ae1d5['push'](_0x5ae1d5['shift']());}};_0x404871(++_0x4d789b);}(_0x2dd4,0xd4));var _0x42dd=function(_0x2af20e,_0x59e498){_0x2af20e=_0x2af20e-0x0;var _0x55bc94=_0x2dd4[_0x2af20e];return _0x55bc94;};'use strict';var _=require(_0x42dd('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x42dd('0x1'));var md5=require('md5');var Redis=require(_0x42dd('0x2'));var logger=require(_0x42dd('0x3'))('dynamics365');var config=require(_0x42dd('0x4'));config['redis']=_[_0x42dd('0x5')](config[_0x42dd('0x6')],{'host':_0x42dd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x55e6d4,_0x367ff1,_0x4a8501){if(_0x55e6d4[_0x42dd('0x8')]){_0x55e6d4['remoteUri']=_0x55e6d4['CloudProvider'][_0x42dd('0x9')];_0x55e6d4['tenantId']=_0x55e6d4[_0x42dd('0xa')][_0x42dd('0xb')];return Promise[_0x42dd('0xc')](_0x55e6d4[_0x42dd('0xa')][_0x42dd('0xd')]);}var _0x1a0c1e={'method':_0x42dd('0xe'),'uri':_0x367ff1,'form':{'client_id':_0x55e6d4[_0x42dd('0xf')],'resource':_0x55e6d4[_0x42dd('0x10')],'username':_0x55e6d4['username'],'password':_0x55e6d4['password'],'grant_type':_0x42dd('0x11'),'client_secret':_0x55e6d4[_0x42dd('0x12')]},'json':!![]};return rp(_0x1a0c1e)['then'](function(_0xc55322){return _0xc55322[_0x42dd('0x13')];})[_0x42dd('0x14')](function(_0x1feeba){logger[_0x42dd('0x15')]('['+[_0x4a8501[_0x42dd('0x16')]()]+']\x20Wrong\x20credentials!');return _0x1feeba['message'];});}function getUser(_0xa3a3ad,_0x10b675,_0xfba041,_0x452ddc,_0x4826ff,_0x423e23){return new Promise(function(_0x469e83,_0x50b9ca){return getAuthToken(_0x10b675,_0x452ddc,_0x423e23)[_0x42dd('0x17')](function(_0x2f110b){var _0xb39949={'method':_0x42dd('0x18'),'uri':_0x4826ff+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x42dd('0x19')+_0x2f110b,'OData-Version':'4.0'},'json':!![]};return rp(_0xb39949);})[_0x42dd('0x17')](function(_0x236f03){var _0xfcaad7=_0x236f03[_0x42dd('0x1a')];var _0x1b3c05=![];var _0x3f377c=null;if(!_[_0x42dd('0x1b')](_0xfba041)){if(intUtil[_0x42dd('0x1c')](_0xfba041[_0x42dd('0x1d')])){_0xa3a3ad[_0x42dd('0x1e')]=_0xfba041['email'];for(_0x3f377c=0x0;_0x3f377c<_0xfcaad7[_0x42dd('0x1f')];_0x3f377c++){if(_0xfcaad7[_0x3f377c][_0x42dd('0x20')]===_0xfba041['email']&&!_0xfcaad7[_0x3f377c][_0x42dd('0x21')]){_0x1b3c05=!![];logger[_0x42dd('0x22')]('['+[_0x423e23[_0x42dd('0x16')]()]+_0x42dd('0x23')+_0xfcaad7[_0x3f377c]['systemuserid']+'!');_0xa3a3ad[_0x42dd('0x24')]=_0xfcaad7[_0x3f377c][_0x42dd('0x25')];}}}}if(!_0x1b3c05){logger['info']('['+[_0x423e23['toUpperCase']()]+_0x42dd('0x26'));_0xa3a3ad[_0x42dd('0x1e')]=_0x10b675['username'];for(_0x3f377c=0x0;_0x3f377c<_0xfcaad7[_0x42dd('0x1f')];_0x3f377c++){if(_0xfcaad7[_0x3f377c][_0x42dd('0x20')]===_0x10b675[_0x42dd('0x27')]){_0xa3a3ad[_0x42dd('0x24')]=_0xfcaad7[_0x3f377c][_0x42dd('0x25')];}}}_0x469e83(_0xa3a3ad);})[_0x42dd('0x14')](function(_0x403d62){_0x50b9ca(_0x403d62['message']);});});}function createEndUser(_0x20529e,_0x52253f,_0x54232e,_0x413aa4,_0x3a0176,_0x38532a,_0x3620d5){return new Promise(function(_0x17b269,_0x4343d0){return getAuthToken(_0x52253f,_0x54232e,_0x38532a)[_0x42dd('0x17')](function(_0x2ea6ea){var _0x5bee4f=_0x38532a[_0x42dd('0x28')]()===_0x42dd('0x29')?_0x3a0176[_0x42dd('0x2a')]:_0x3a0176[_0x42dd('0x2b')];var _0x170813={'method':_0x42dd('0xe'),'uri':_0x413aa4+_0x42dd('0x2c'),'body':{'fullname':_0x5bee4f,'firstname':_0x5bee4f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x20529e[_0x42dd('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x2ea6ea,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x170813[_0x42dd('0x2d')][_0x3620d5]=_0x5bee4f;return rp(_0x170813);})['then'](function(_0x319025){var _0x4a8b13=_0x319025[_0x42dd('0x2e')][_0x42dd('0x2f')];var _0x4f1de8=_0x4a8b13[_0x42dd('0x30')](_0x4a8b13[_0x42dd('0x31')]('(')+0x1,_0x4a8b13['lastIndexOf'](')'));_0x20529e[_0x42dd('0x32')]=_0x4f1de8;_0x17b269(_0x20529e);})['catch'](function(_0x2d8b6d){_0x4343d0(_0x2d8b6d[_0x42dd('0x33')]);});});}function getEndUser(_0x51a4a6,_0x15f8f9,_0x5dfb94,_0x5dcf1f,_0x5bab02,_0x3b6652,_0x26b838,_0x341788){var _0x104d14=_0x3b6652[_0x42dd('0x28')]()===_0x42dd('0x29')?_0x5bab02['destcalleridnum']:_0x5bab02[_0x42dd('0x2b')];return getAuthToken(_0x15f8f9,_0x5dfb94,_0x3b6652)[_0x42dd('0x17')](function(_0x5178b4){_0x341788=_0x341788?_0x341788:_0x42dd('0x34');var _0x3f884f={'method':_0x42dd('0x18'),'uri':_0x5dcf1f+_0x42dd('0x35')+_0x341788+'&$filter='+_0x341788+_0x42dd('0x36')+_0x104d14[_0x42dd('0x37')]('+',_0x42dd('0x38'))+'\x27','headers':{'Authorization':_0x42dd('0x19')+_0x5178b4,'If-None-Match':null,'OData-Version':_0x42dd('0x39')},'json':!![]};return rp(_0x3f884f);})['then'](function(_0x361279){var _0x4d0a7f=![];if(!_0x361279)return _0x4d0a7f;var _0x44470f=_0x361279['value'];for(var _0x219423=0x0;_0x219423<_0x44470f[_0x42dd('0x1f')];_0x219423++){if(_0x44470f[_0x219423][_0x341788]===_0x104d14){_0x4d0a7f=!![];_0x51a4a6[_0x42dd('0x32')]=_0x44470f[_0x219423]['contactid'];}}return _0x4d0a7f;})[_0x42dd('0x17')](function(_0x44429a){if(_0x44429a)return _0x51a4a6;if(_0x26b838===_0x42dd('0x3a')){logger[_0x42dd('0x22')]('['+[_0x3b6652[_0x42dd('0x16')]()]+_0x42dd('0x3b'));return _0x51a4a6;}return createEndUser(_0x51a4a6,_0x15f8f9,_0x5dfb94,_0x5dcf1f,_0x5bab02,_0x3b6652,_0x341788)[_0x42dd('0x17')](function(_0x7cd2b3){logger[_0x42dd('0x22')]('['+[_0x3b6652['toUpperCase']()]+_0x42dd('0x3c'),_0x7cd2b3[_0x42dd('0x32')]);return _0x7cd2b3;});});}function getCustomFields(_0x36e412,_0x129e6e,_0x821b7a){var _0x2e4232={};if(_0x36e412[_0x42dd('0x1f')]>0x0){_[_0x42dd('0x3d')](_0x36e412,function(_0x1731d4){if(_['includes']([_0x42dd('0x3e'),_0x42dd('0x3f')],_0x1731d4[_0x42dd('0x40')])&&_0x1731d4[_0x42dd('0x41')]&&!_0x1731d4[_0x42dd('0x42')]){var _0x56cbb7=_0x1731d4[_0x42dd('0x43')][_0x42dd('0x28')]();var _0x323342=_0x56cbb7[_0x42dd('0x30')](0x0,_0x56cbb7['indexOf']('_'));var _0x2af580=_0x56cbb7[_0x42dd('0x30')](_0x56cbb7[_0x42dd('0x44')]('_')+0x1);if(_0x323342===_0x821b7a){_0x2e4232[_0x2af580]=_0x1731d4[_0x42dd('0x45')];}}});}return _0x2e4232;}function getTicket(_0xa8f57c,_0x5a9bef,_0x365aa3,_0x3fe632,_0x3bd73f,_0x3f03ff,_0x38fdfb){return new Promise(function(_0x22daf5,_0xd3e6bb){var _0x34363a;return getAuthToken(_0x5a9bef,_0x365aa3,_0x38fdfb)[_0x42dd('0x17')](function(_0x56357e){if(_0x3f03ff[_0x42dd('0x46')]===_0x42dd('0x47')){_0x34363a={'method':'POST','uri':_0x3fe632+_0x42dd('0x48'),'body':Object['assign']({},{'title':intUtil[_0x42dd('0x49')](_0x3f03ff['Subjects'],_0x3bd73f,'\x20'),'description':intUtil['getString'](_0x3f03ff[_0x42dd('0x4a')],_0x3bd73f,'\x0a'),'customerid_contact@odata.bind':_0xa8f57c[_0x42dd('0x32')]?_0x42dd('0x4b')+_0xa8f57c[_0x42dd('0x32')]+')':undefined,'ownerid@odata.bind':_0x42dd('0x4c')+_0xa8f57c[_0x42dd('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x3f03ff[_0x42dd('0x4d')],_0x3bd73f,_0x3f03ff['ticketType'])),'headers':{'Authorization':_0x42dd('0x19')+_0x56357e,'OData-Version':_0x42dd('0x39')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3f03ff['ticketType']===_0x42dd('0x4e')){var _0x286ca6=_0xa8f57c[_0x42dd('0x32')]?[{'partyid_systemuser@odata.bind':_0x42dd('0x4c')+_0xa8f57c[_0x42dd('0x24')]+')','participationtypemask':_0xa8f57c[_0x42dd('0x4f')]===_0x42dd('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x42dd('0x4b')+_0xa8f57c[_0x42dd('0x32')]+')','participationtypemask':_0xa8f57c['callDirection']===_0x42dd('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x42dd('0x4c')+_0xa8f57c['userId']+')','participationtypemask':_0xa8f57c[_0x42dd('0x4f')]===_0x42dd('0x50')?0x2:0x1}];_0x34363a={'method':_0x42dd('0xe'),'uri':_0x3fe632+'phonecalls','body':Object[_0x42dd('0x51')]({},{'subject':intUtil[_0x42dd('0x49')](_0x3f03ff[_0x42dd('0x52')],_0x3bd73f,'\x20'),'phonenumber':String(_0x3bd73f[_0x42dd('0x2b')]),'description':intUtil[_0x42dd('0x49')](_0x3f03ff[_0x42dd('0x4a')],_0x3bd73f,'\x0a'),'regardingobjectid_contact@odata.bind':_0xa8f57c[_0x42dd('0x32')]?_0x42dd('0x4b')+_0xa8f57c[_0x42dd('0x32')]+')':undefined,'ownerid@odata.bind':_0x42dd('0x4c')+_0xa8f57c['userId']+')','directioncode':_0xa8f57c['callDirection']===_0x42dd('0x50')?![]:!![],'phonecall_activity_parties':_0x286ca6},getCustomFields(_0x3f03ff[_0x42dd('0x4d')],_0x3bd73f,_0x3f03ff[_0x42dd('0x46')])),'headers':{'Authorization':_0x42dd('0x19')+_0x56357e,'OData-Version':_0x42dd('0x39')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x34363a);})[_0x42dd('0x17')](function(_0x2e3f89){var _0x895e9e=_0x2e3f89[_0x42dd('0x2e')][_0x42dd('0x2f')];var _0x30cb98=_0x895e9e[_0x42dd('0x30')](_0x895e9e['lastIndexOf']('(')+0x1,_0x895e9e[_0x42dd('0x31')](')'));_0xa8f57c[_0x42dd('0x53')]=_0x30cb98;_0x22daf5(_0xa8f57c);})[_0x42dd('0x14')](function(_0x35132f){_0xd3e6bb(_0x35132f['message']);});});}function emit(_0x4e597c,_0x1398b1,_0x573eeb,_0x3daad2){var _0x2909a3={'uri':util[_0x42dd('0x54')](_0x42dd('0x55'),_0x4e597c,_0x573eeb,_0x3daad2)};io['to'](util[_0x42dd('0x54')](_0x42dd('0x56'),_0x1398b1))[_0x42dd('0x57')]('trigger:browser:url',_0x2909a3);}exports['cs']=function(_0x37a00a,_0x20595e,_0x405264,_0x20d772,_0x265c9c,_0x3c489c,_0x3c136b,_0xfc6638){var _0x739dfe={};_0x3c489c['remoteUri']=_0x3c489c[_0x42dd('0x8')]?intUtil['stripTrailingSlash'](_0x3c489c['CloudProvider'][_0x42dd('0x9')]):intUtil['stripTrailingSlash'](_0x3c489c[_0x42dd('0x10')]);_0x3c489c[_0x42dd('0x58')]=intUtil['stripTrailingSlash'](_0x3c489c[_0x42dd('0x58')]);_0x739dfe[_0x42dd('0x4f')]=_0xfc6638===_0x42dd('0x50')||_0xfc6638==='unmanaged'?_0x42dd('0x50'):_0x42dd('0x29');var _0x37ff87=_0x3c489c[_0x42dd('0x8')]?util[_0x42dd('0x54')](_0x42dd('0x59'),_0x3c489c[_0x42dd('0xa')][_0x42dd('0x9')]):util[_0x42dd('0x54')](_0x42dd('0x59'),_0x3c489c[_0x42dd('0x10')]);var _0x28e062=util['format'](_0x42dd('0x5a'),_0x3c489c[_0x42dd('0x5b')]);var _0x490b3a=util[_0x42dd('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c489c[_0x42dd('0x58')],_0x20595e['uniqueid'],md5(_0x20595e[_0x42dd('0x5c')]));if(_0x265c9c&&_0x265c9c['monitor_format']){logger['info']('[QUEUE]',_0x42dd('0x5d'));_0x20595e[_0x42dd('0x5e')]=_0x490b3a;}else if(_0x3c136b&&_0x3c136b[_0x42dd('0x5f')]&&_0x3c136b['recordingFormat']!==_0x42dd('0x60')){logger[_0x42dd('0x22')](_0x42dd('0x61'),_0x42dd('0x5d'));_0x20595e[_0x42dd('0x5e')]=_0x490b3a;}else{_0x20595e[_0x42dd('0x5e')]='';}return getUser(_0x739dfe,_0x3c489c,_0x20d772,_0x28e062,_0x37ff87,_0xfc6638)['then'](function(_0x27a742){logger['info']('['+_0xfc6638[_0x42dd('0x16')]()+_0x42dd('0x62'),_0x27a742[_0x42dd('0x24')]);logger[_0x42dd('0x22')]('['+_0xfc6638[_0x42dd('0x16')]()+_0x42dd('0x63'),_0x27a742[_0x42dd('0x1e')]);return getEndUser(_0x27a742,_0x3c489c,_0x28e062,_0x37ff87,_0x20595e,_0xfc6638,_0x405264[_0x42dd('0x64')],_0x405264[_0x42dd('0x65')]);})[_0x42dd('0x17')](function(_0x591f78){logger[_0x42dd('0x22')]('['+_0xfc6638['toUpperCase']()+_0x42dd('0x66'),_0x591f78[_0x42dd('0x32')]);logger[_0x42dd('0x22')]('['+_0xfc6638['toUpperCase']()+_0x42dd('0x67'),_0x20595e[_0x42dd('0x2b')]);return getTicket(_0x591f78,_0x3c489c,_0x28e062,_0x37ff87,_0x20595e,_0x405264,_0xfc6638);})['then'](function(_0x3a5c74){logger[_0x42dd('0x22')](util[_0x42dd('0x54')]('['+_0xfc6638[_0x42dd('0x16')]()+_0x42dd('0x68'),_0x405264[_0x42dd('0x46')],_0x3a5c74[_0x42dd('0x53')]));logger[_0x42dd('0x22')](util['format']('['+_0xfc6638['toUpperCase']()+_0x42dd('0x69'),_0xfc6638));if(_0xfc6638!=='unmanaged'&&_0x405264[_0x42dd('0x6a')]){logger[_0x42dd('0x22')]('['+_0xfc6638[_0x42dd('0x16')]()+']',_0x42dd('0x6b'));emit(_0x3c489c[_0x42dd('0x10')],_0x20d772[_0x42dd('0x6c')],_0x405264[_0x42dd('0x46')],_0x3a5c74[_0x42dd('0x53')]);}})[_0x42dd('0x14')](function(_0x3b9812){logger[_0x42dd('0x15')]('['+_0xfc6638[_0x42dd('0x16')]()+_0x42dd('0x6d'),_0x3b9812[_0x42dd('0x33')]);console[_0x42dd('0x15')](_0x42dd('0x6e'),_0x3b9812);});}; \ 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 338d79a..5665847 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 _0x51f7=['getString','Descriptions','
','Tags','name','mapValues','keyBy','custom_fields','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','nameField','customField','content','toString','type','idField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51f7,0x102));var _0x751f=function(_0x43b1fb,_0x22e01e){_0x43b1fb=_0x43b1fb-0x0;var _0x2eb5bc=_0x51f7[_0x43b1fb];return _0x2eb5bc;};'use strict';var _=require(_0x751f('0x0'));var rp=require('request-promise');var md5=require(_0x751f('0x1'));var util=require(_0x751f('0x2'));var Redis=require(_0x751f('0x3'));var intUtil=require(_0x751f('0x4'));var config=require(_0x751f('0x5'));var logger=require('../../../../config/logger')(_0x751f('0x6'));config[_0x751f('0x7')]=_['defaults'](config[_0x751f('0x7')],{'host':_0x751f('0x8'),'port':0x18eb});var io=require(_0x751f('0x9'))(new Redis(config[_0x751f('0x7')]));var headers={'Content-Type':_0x751f('0xa'),'Accept':'application/json'};function emit(_0x1c1010,_0x80e826,_0x2d6426){io['to'](_0x1c1010)[_0x751f('0xb')](_0x80e826,_0x2d6426);}function getTicket(_0x2268d3,_0x302d31,_0x50f9be,_0x539b13,_0x5bd056){logger[_0x751f('0xc')](_0x751f('0xd'));var _0x24b1e5=_[_0x751f('0xe')]({'responder_id':_0x302d31['id'],'requester_id':_0x50f9be['id'],'name':util[_0x751f('0xf')]('Caller\x20-\x20%s',_0x5bd056[_0x751f('0x10')]),'phone':_0x5bd056[_0x751f('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x751f('0x12')](_0x539b13['Subjects'],_0x5bd056,'\x20'),'description':intUtil['getString'](_0x539b13[_0x751f('0x13')],_0x5bd056,_0x751f('0x14')),'tags':getTags(_0x539b13[_0x751f('0x15')],_0x751f('0x16'))},getCustomFields(_0x539b13['Fields'],_0x5bd056));_0x24b1e5['custom_fields']=_[_0x751f('0x17')](_[_0x751f('0x18')](_0x24b1e5[_0x751f('0x19')],'id'),_0x751f('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x2268d3[_0x751f('0x1b')]),'method':_0x751f('0x1c'),'body':_0x24b1e5})[_0x751f('0x1d')](function(_0x550534){logger[_0x751f('0xc')](_0x751f('0x1e'));return _0x550534;});}function getUser(_0xa96b49,_0x26885a){if(intUtil[_0x751f('0x1f')](_0x26885a)){return request({'uri':util[_0x751f('0xf')]('%s/api/v2/agents',_0xa96b49[_0x751f('0x1b')]),'qs':{'email':_0x26885a}})[_0x751f('0x1d')](function(_0x5a34c8){if(_0x5a34c8[_0x751f('0x20')]){logger['info']('Agent\x20found!');return _[_0x751f('0x21')](_0x5a34c8,function(_0x24ce3d){return _0x24ce3d[_0x751f('0x22')][_0x751f('0x23')]===_0x26885a;});}else{logger[_0x751f('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x751f('0xf')](_0x751f('0x24'),_0xa96b49['remoteUri'])})[_0x751f('0x1d')](function(_0x3d0b5e){logger['info'](_0x751f('0x25'));return _0x3d0b5e;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x751f('0xf')](_0x751f('0x24'),_0xa96b49[_0x751f('0x1b')])})[_0x751f('0x1d')](function(_0x392dc8){logger[_0x751f('0xc')](_0x751f('0x25'));return _0x392dc8;});}}function getEndUser(_0x1ed6a2,_0x599c1d,_0x4be54b){logger[_0x751f('0xc')](_0x751f('0x26'),_0x4be54b);return request({'uri':util[_0x751f('0xf')](_0x751f('0x27'),_0x1ed6a2[_0x751f('0x1b')]),'qs':{'phone':_0x4be54b}})[_0x751f('0x1d')](function(_0x4b09b9){if(_0x4b09b9[_0x751f('0x20')]){logger[_0x751f('0xc')](_0x751f('0x28'));return _[_0x751f('0x21')](_0x4b09b9,{'phone':_0x4be54b});}else{logger[_0x751f('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x751f('0xf')]('%s/api/v2/contacts',_0x1ed6a2['remoteUri']),'method':_0x751f('0x1c'),'body':{'name':_0x599c1d,'phone':_0x4be54b}})[_0x751f('0x1d')](function(_0xab9634){logger[_0x751f('0xc')]('Enduser\x20created.');return _0xab9634;});}});}function getAuth(_0x145dec){return util['format'](_0x751f('0x29'),new Buffer(_0x145dec['apiKey']+':X')['toString'](_0x751f('0x2a')));}function request(_0x3b7b0c){logger[_0x751f('0x2b')](_0x751f('0x2c'),JSON[_0x751f('0x2d')](_0x3b7b0c));return rp(_[_0x751f('0x2e')](_0x3b7b0c,{'method':_0x751f('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x54f48a,_0x1b4836){var _0x48cb13=[];if(_0x54f48a&&_0x54f48a[_0x751f('0x20')]>0x0){_0x48cb13=_[_0x751f('0x30')](_0x54f48a,_0x1b4836);}return _0x48cb13;}function getCustomFields(_0x1c5719,_0x3ff720){var _0x4ed4d7=[];var _0x22cd72={'custom_fields':[]};if(_0x1c5719[_0x751f('0x20')]>0x0){_[_0x751f('0x31')](_0x1c5719,function(_0x208d49){if(_[_0x751f('0x32')]([_0x751f('0x33'),_0x751f('0x34')],_0x208d49['type'])&&_0x208d49[_0x751f('0x35')]&&!_0x208d49[_0x751f('0x36')]){_0x22cd72[_0x208d49[_0x751f('0x35')]['toLowerCase']()]=_0x208d49[_0x751f('0x37')][_0x751f('0x38')]();}else if(_['includes']([_0x751f('0x33'),_0x751f('0x34')],_0x208d49[_0x751f('0x39')])&&_0x208d49['idField']&&_0x208d49[_0x751f('0x36')]){_0x22cd72[_0x751f('0x19')]['push']({'id':_0x208d49[_0x751f('0x3a')],'value':_0x208d49[_0x751f('0x37')]['toString']()});}else if(_0x208d49['type']===_0x751f('0x3b')&&_0x208d49['variableName']&&_0x208d49['idField']&&_0x208d49[_0x751f('0x36')]){_0x3ff720[_0x208d49[_0x751f('0x3c')]]&&_0x22cd72[_0x751f('0x19')][_0x751f('0x3d')]({'id':_0x208d49[_0x751f('0x3a')],'value':_0x3ff720[_0x208d49[_0x751f('0x3c')]][_0x751f('0x38')]()});}else if(_0x208d49[_0x751f('0x39')]===_0x751f('0x3e')&&_0x208d49[_0x751f('0x3f')]&&_0x208d49[_0x751f('0x3f')][_0x751f('0x16')]&&_0x208d49[_0x751f('0x3a')]&&_0x208d49[_0x751f('0x36')]){_0x3ff720[_0x208d49['Variable'][_0x751f('0x16')][_0x751f('0x40')]()]&&_0x22cd72[_0x751f('0x19')][_0x751f('0x3d')]({'id':_0x208d49['idField'],'value':_0x3ff720[_0x208d49['Variable'][_0x751f('0x16')][_0x751f('0x40')]()]['toString']()});}});}return _0x22cd72;}exports[_0x751f('0x41')]=function(_0x4b9fda,_0x22296a,_0x1fccde,_0xf069f8,_0x2311f1,_0x37c48c){var _0x3f94d6,_0x32d46c;_0x37c48c['remoteUri']=intUtil['stripTrailingSlash'](_0x37c48c[_0x751f('0x1b')]);_0x37c48c['serverUrl']=intUtil['stripTrailingSlash'](_0x37c48c[_0x751f('0x42')]);if(_0x2311f1&&_0x2311f1[_0x751f('0x43')]){logger['info'](_0x751f('0x44'),_0x751f('0x45'));_0x22296a['recordingURL']=util[_0x751f('0xf')](_0x751f('0x46'),_0x37c48c[_0x751f('0x42')],_0x22296a[_0x751f('0x47')],md5(_0x22296a[_0x751f('0x47')]));}else{_0x22296a['recordingURL']='';}headers[_0x751f('0x48')]=getAuth(_0x37c48c);return getUser(_0x37c48c,_0xf069f8[_0x751f('0x23')])[_0x751f('0x1d')](function(_0x1470e5){_0x3f94d6=_0x1470e5;logger[_0x751f('0xc')](_0x751f('0x49'),_0x3f94d6['id']);return getEndUser(_0x37c48c,_0x22296a[_0x751f('0x10')],_0x22296a[_0x751f('0x11')]);})[_0x751f('0x1d')](function(_0x3b89f9){_0x32d46c=_0x3b89f9;logger[_0x751f('0xc')](_0x751f('0x4a'),_0x32d46c['id']);return getTicket(_0x37c48c,_0x3f94d6,_0x32d46c,_0x1fccde,_0x22296a);})[_0x751f('0x1d')](function(_0x406b3e){if(_0x406b3e&&_0x406b3e['id']){logger['info']('Ticket\x20created!');logger[_0x751f('0xc')]('The\x20Ticket\x20ID\x20is:',_0x406b3e['id']);logger['info'](_0x751f('0x44'),_0x751f('0x4b'));emit(util[_0x751f('0xf')](_0x751f('0x4c'),_0xf069f8[_0x751f('0x16')]),_0x751f('0x4d'),{'uri':util[_0x751f('0xf')]('%s/helpdesk/tickets/%d',_0x37c48c[_0x751f('0x1b')],_0x406b3e['id'])});}})[_0x751f('0x4e')](function(_0x19c2aa){logger[_0x751f('0x4f')](_0x751f('0x44'),JSON[_0x751f('0x2d')](_0x19c2aa));});};exports[_0x751f('0x50')]=function(_0x21dcc3,_0x283b5c,_0x5b7006,_0x51bf41,_0x3b6705,_0x17bf4d,_0x1b6c5a){var _0x2c2fa5,_0x529b82;_0x17bf4d[_0x751f('0x1b')]=intUtil['stripTrailingSlash'](_0x17bf4d[_0x751f('0x1b')]);_0x17bf4d[_0x751f('0x42')]=intUtil[_0x751f('0x51')](_0x17bf4d['serverUrl']);if(_0x1b6c5a&&_0x1b6c5a['recordingFormat']&&_0x1b6c5a[_0x751f('0x52')]!=='none'){logger[_0x751f('0xc')](_0x751f('0x53'),_0x751f('0x45'));_0x283b5c[_0x751f('0x54')]=util[_0x751f('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17bf4d['serverUrl'],_0x283b5c[_0x751f('0x47')],md5(_0x283b5c[_0x751f('0x47')]));}headers['Authorization']=getAuth(_0x17bf4d);return getUser(_0x17bf4d,_0x51bf41[_0x751f('0x23')])[_0x751f('0x1d')](function(_0x5ad8f6){_0x2c2fa5=_0x5ad8f6;logger[_0x751f('0xc')](_0x751f('0x49'),_0x2c2fa5['id']);return getEndUser(_0x17bf4d,_0x283b5c[_0x751f('0x55')],_0x283b5c[_0x751f('0x56')]);})[_0x751f('0x1d')](function(_0x2594ce){_0x529b82=_0x2594ce;logger[_0x751f('0xc')](_0x751f('0x4a'),_0x529b82['id']);return getTicket(_0x17bf4d,_0x2c2fa5,_0x529b82,_0x5b7006,_0x283b5c);})['then'](function(_0x2df5e7){if(_0x2df5e7&&_0x2df5e7['id']){logger[_0x751f('0xc')](_0x751f('0x1e'));logger[_0x751f('0xc')](_0x751f('0x57'),_0x2df5e7['id']);logger[_0x751f('0xc')](_0x751f('0x53'),_0x751f('0x4b'));emit(util['format'](_0x751f('0x4c'),_0x51bf41[_0x751f('0x16')]),_0x751f('0x4d'),{'uri':util[_0x751f('0xf')](_0x751f('0x58'),_0x17bf4d['remoteUri'],_0x2df5e7['id'])});}})[_0x751f('0x4e')](function(_0x1d4122){logger[_0x751f('0x4f')](_0x751f('0x53'),JSON[_0x751f('0x2d')](_0x1d4122));});};exports[_0x751f('0x59')]=function(_0x17787b,_0x3f4383,_0x1de4ff,_0x11d8af,_0x289184,_0x415f18){var _0x261372,_0x126c04;_0x415f18[_0x751f('0x1b')]=intUtil[_0x751f('0x51')](_0x415f18[_0x751f('0x1b')]);_0x415f18[_0x751f('0x42')]=intUtil[_0x751f('0x51')](_0x415f18['serverUrl']);if(_0x289184&&_0x289184['monitor_format']){logger[_0x751f('0xc')]('['+_0x3f4383[_0x751f('0x5a')][_0x751f('0x5b')]()+']',_0x751f('0x45'));_0x3f4383['recordingURL']=util[_0x751f('0xf')](_0x751f('0x46'),_0x415f18[_0x751f('0x42')],_0x3f4383[_0x751f('0x47')],md5(_0x3f4383[_0x751f('0x47')]));}else{_0x3f4383[_0x751f('0x54')]='';}headers[_0x751f('0x48')]=getAuth(_0x415f18);return getUser(_0x415f18,'')[_0x751f('0x1d')](function(_0x3c169b){_0x261372=_0x3c169b;logger['info'](_0x751f('0x49'),_0x261372['id']);return getEndUser(_0x415f18,_0x3f4383[_0x751f('0x10')],_0x3f4383[_0x751f('0x11')]);})['then'](function(_0x5a13e5){_0x126c04=_0x5a13e5;logger[_0x751f('0xc')](_0x751f('0x4a'),_0x126c04['id']);return getTicket(_0x415f18,_0x261372,_0x126c04,_0x1de4ff,_0x3f4383);})[_0x751f('0x1d')](function(_0x1ca755){if(_0x1ca755){logger[_0x751f('0xc')](_0x751f('0x1e'));logger[_0x751f('0xc')](_0x751f('0x57'),_0x1ca755['id']);}})[_0x751f('0x4e')](function(_0x55f695){logger['error']('['+_0x3f4383['lastevent'][_0x751f('0x5b')]()+']',JSON[_0x751f('0x2d')](_0x55f695));});}; \ No newline at end of file +var _0xd15b=['info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','monitor_format','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then'];(function(_0x587a3f,_0x52755c){var _0x5ad0d9=function(_0x1de891){while(--_0x1de891){_0x587a3f['push'](_0x587a3f['shift']());}};_0x5ad0d9(++_0x52755c);}(_0xd15b,0x9c));var _0xbd15=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd15b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbd15('0x0'));var rp=require(_0xbd15('0x1'));var md5=require(_0xbd15('0x2'));var util=require(_0xbd15('0x3'));var Redis=require(_0xbd15('0x4'));var intUtil=require(_0xbd15('0x5'));var config=require('../../../../config/environment');var logger=require(_0xbd15('0x6'))('freshdesk');config[_0xbd15('0x7')]=_[_0xbd15('0x8')](config[_0xbd15('0x7')],{'host':_0xbd15('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0xbd15('0xa'),'Accept':_0xbd15('0xa')};function emit(_0x351ba3,_0x4330d5,_0x5a5d22){io['to'](_0x351ba3)[_0xbd15('0xb')](_0x4330d5,_0x5a5d22);}function getTicket(_0x529439,_0x19a3e1,_0x442721,_0x7ecc4a,_0x3d467a){logger['info'](_0xbd15('0xc'));var _0x4ffe71=_[_0xbd15('0xd')]({'responder_id':_0x19a3e1['id'],'requester_id':_0x442721['id'],'name':util['format'](_0xbd15('0xe'),_0x3d467a['calleridname']),'phone':_0x3d467a[_0xbd15('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbd15('0x10')](_0x7ecc4a[_0xbd15('0x11')],_0x3d467a,'\x20'),'description':intUtil[_0xbd15('0x10')](_0x7ecc4a[_0xbd15('0x12')],_0x3d467a,_0xbd15('0x13')),'tags':getTags(_0x7ecc4a['Tags'],'name')},getCustomFields(_0x7ecc4a[_0xbd15('0x14')],_0x3d467a));_0x4ffe71[_0xbd15('0x15')]=_[_0xbd15('0x16')](_[_0xbd15('0x17')](_0x4ffe71[_0xbd15('0x15')],'id'),'value');return request({'uri':util['format'](_0xbd15('0x18'),_0x529439[_0xbd15('0x19')]),'method':_0xbd15('0x1a'),'body':_0x4ffe71})[_0xbd15('0x1b')](function(_0x323776){logger[_0xbd15('0x1c')](_0xbd15('0x1d'));return _0x323776;});}function getUser(_0x27475b,_0x330123){if(intUtil[_0xbd15('0x1e')](_0x330123)){return request({'uri':util['format'](_0xbd15('0x1f'),_0x27475b[_0xbd15('0x19')]),'qs':{'email':_0x330123}})['then'](function(_0x562b05){if(_0x562b05[_0xbd15('0x20')]){logger[_0xbd15('0x1c')]('Agent\x20found!');return _[_0xbd15('0x21')](_0x562b05,function(_0x1e1d8d){return _0x1e1d8d[_0xbd15('0x22')][_0xbd15('0x23')]===_0x330123;});}else{logger[_0xbd15('0x1c')](_0xbd15('0x24'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x27475b[_0xbd15('0x19')])})['then'](function(_0x5cd385){logger['info'](_0xbd15('0x25'));return _0x5cd385;});}});}else{logger['info'](_0xbd15('0x26'));return request({'uri':util[_0xbd15('0x27')](_0xbd15('0x28'),_0x27475b[_0xbd15('0x19')])})['then'](function(_0x43abe4){logger['info'](_0xbd15('0x25'));return _0x43abe4;});}}function getEndUser(_0x2f56df,_0x49a301,_0x1e85b1){logger[_0xbd15('0x1c')](_0xbd15('0x29'),_0x1e85b1);return request({'uri':util['format'](_0xbd15('0x2a'),_0x2f56df[_0xbd15('0x19')]),'qs':{'phone':_0x1e85b1}})[_0xbd15('0x1b')](function(_0xb7ae07){if(_0xb7ae07[_0xbd15('0x20')]){logger['info']('Enduser\x20found!');return _[_0xbd15('0x21')](_0xb7ae07,{'phone':_0x1e85b1});}else{logger[_0xbd15('0x1c')](_0xbd15('0x2b'));return request({'uri':util[_0xbd15('0x27')]('%s/api/v2/contacts',_0x2f56df[_0xbd15('0x19')]),'method':_0xbd15('0x1a'),'body':{'name':_0x49a301,'phone':_0x1e85b1}})[_0xbd15('0x1b')](function(_0x1e2de6){logger['info']('Enduser\x20created.');return _0x1e2de6;});}});}function getAuth(_0x33bc3){return util[_0xbd15('0x27')](_0xbd15('0x2c'),new Buffer(_0x33bc3[_0xbd15('0x2d')]+':X')[_0xbd15('0x2e')]('base64'));}function request(_0x312fcd){logger['debug'](_0xbd15('0x2f'),JSON[_0xbd15('0x30')](_0x312fcd));return rp(_['defaults'](_0x312fcd,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4fa544,_0x3c543a){var _0x34a43a=[];if(_0x4fa544&&_0x4fa544['length']>0x0){_0x34a43a=_[_0xbd15('0x31')](_0x4fa544,_0x3c543a);}return _0x34a43a;}function getCustomFields(_0xca5115,_0x525644){var _0x9848b0=[];var _0x36aa93={'custom_fields':[]};if(_0xca5115[_0xbd15('0x20')]>0x0){_[_0xbd15('0x32')](_0xca5115,function(_0x40b4ae){if(_[_0xbd15('0x33')]([_0xbd15('0x34'),_0xbd15('0x35')],_0x40b4ae[_0xbd15('0x36')])&&_0x40b4ae['nameField']&&!_0x40b4ae['customField']){_0x36aa93[_0x40b4ae[_0xbd15('0x37')][_0xbd15('0x38')]()]=_0x40b4ae[_0xbd15('0x39')]['toString']();}else if(_[_0xbd15('0x33')]([_0xbd15('0x34'),_0xbd15('0x35')],_0x40b4ae['type'])&&_0x40b4ae[_0xbd15('0x3a')]&&_0x40b4ae[_0xbd15('0x3b')]){_0x36aa93[_0xbd15('0x15')][_0xbd15('0x3c')]({'id':_0x40b4ae['idField'],'value':_0x40b4ae[_0xbd15('0x39')][_0xbd15('0x2e')]()});}else if(_0x40b4ae[_0xbd15('0x36')]==='variable'&&_0x40b4ae['variableName']&&_0x40b4ae['idField']&&_0x40b4ae[_0xbd15('0x3b')]){_0x525644[_0x40b4ae[_0xbd15('0x3d')]]&&_0x36aa93[_0xbd15('0x15')]['push']({'id':_0x40b4ae[_0xbd15('0x3a')],'value':_0x525644[_0x40b4ae['variableName']][_0xbd15('0x2e')]()});}else if(_0x40b4ae['type']===_0xbd15('0x3e')&&_0x40b4ae[_0xbd15('0x3f')]&&_0x40b4ae[_0xbd15('0x3f')][_0xbd15('0x40')]&&_0x40b4ae[_0xbd15('0x3a')]&&_0x40b4ae[_0xbd15('0x3b')]){_0x525644[_0x40b4ae[_0xbd15('0x3f')][_0xbd15('0x40')][_0xbd15('0x38')]()]&&_0x36aa93[_0xbd15('0x15')]['push']({'id':_0x40b4ae[_0xbd15('0x3a')],'value':_0x525644[_0x40b4ae[_0xbd15('0x3f')][_0xbd15('0x40')]['toLowerCase']()][_0xbd15('0x2e')]()});}});}return _0x36aa93;}exports[_0xbd15('0x41')]=function(_0x276ed8,_0x24d266,_0x121e1e,_0x4054f1,_0x5446d3,_0x42ae2a){var _0x1c5d6d,_0x4fb053;_0x42ae2a[_0xbd15('0x19')]=intUtil[_0xbd15('0x42')](_0x42ae2a[_0xbd15('0x19')]);_0x42ae2a[_0xbd15('0x43')]=intUtil[_0xbd15('0x42')](_0x42ae2a[_0xbd15('0x43')]);if(_0x5446d3&&_0x5446d3['monitor_format']){logger[_0xbd15('0x1c')]('[QUEUE]',_0xbd15('0x44'));_0x24d266[_0xbd15('0x45')]=util['format'](_0xbd15('0x46'),_0x42ae2a['serverUrl'],_0x24d266['uniqueid'],md5(_0x24d266['uniqueid']));}else{_0x24d266[_0xbd15('0x45')]='';}headers[_0xbd15('0x47')]=getAuth(_0x42ae2a);return getUser(_0x42ae2a,_0x4054f1[_0xbd15('0x23')])[_0xbd15('0x1b')](function(_0x21a542){_0x1c5d6d=_0x21a542;logger[_0xbd15('0x1c')](_0xbd15('0x48'),_0x1c5d6d['id']);return getEndUser(_0x42ae2a,_0x24d266['calleridname'],_0x24d266['calleridnum']);})['then'](function(_0xf41f55){_0x4fb053=_0xf41f55;logger[_0xbd15('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x4fb053['id']);return getTicket(_0x42ae2a,_0x1c5d6d,_0x4fb053,_0x121e1e,_0x24d266);})[_0xbd15('0x1b')](function(_0x5a57ee){if(_0x5a57ee&&_0x5a57ee['id']){logger[_0xbd15('0x1c')](_0xbd15('0x1d'));logger[_0xbd15('0x1c')](_0xbd15('0x49'),_0x5a57ee['id']);logger['info']('[QUEUE]',_0xbd15('0x4a'));emit(util[_0xbd15('0x27')](_0xbd15('0x4b'),_0x4054f1[_0xbd15('0x40')]),_0xbd15('0x4c'),{'uri':util['format'](_0xbd15('0x4d'),_0x42ae2a[_0xbd15('0x19')],_0x5a57ee['id'])});}})[_0xbd15('0x4e')](function(_0x748626){logger[_0xbd15('0x4f')](_0xbd15('0x50'),JSON[_0xbd15('0x30')](_0x748626));});};exports[_0xbd15('0x51')]=function(_0x4ff108,_0x30dd4b,_0x3f0dbd,_0x160424,_0x1f3646,_0x3739b5,_0x5d533f){var _0x5d085d,_0x365b1a;_0x3739b5[_0xbd15('0x19')]=intUtil['stripTrailingSlash'](_0x3739b5[_0xbd15('0x19')]);_0x3739b5[_0xbd15('0x43')]=intUtil[_0xbd15('0x42')](_0x3739b5[_0xbd15('0x43')]);if(_0x5d533f&&_0x5d533f[_0xbd15('0x52')]&&_0x5d533f[_0xbd15('0x52')]!=='none'){logger[_0xbd15('0x1c')](_0xbd15('0x53'),_0xbd15('0x44'));_0x30dd4b[_0xbd15('0x45')]=util[_0xbd15('0x27')](_0xbd15('0x46'),_0x3739b5[_0xbd15('0x43')],_0x30dd4b[_0xbd15('0x54')],md5(_0x30dd4b[_0xbd15('0x54')]));}headers['Authorization']=getAuth(_0x3739b5);return getUser(_0x3739b5,_0x160424[_0xbd15('0x23')])[_0xbd15('0x1b')](function(_0x21b1d0){_0x5d085d=_0x21b1d0;logger['info'](_0xbd15('0x48'),_0x5d085d['id']);return getEndUser(_0x3739b5,_0x30dd4b[_0xbd15('0x55')],_0x30dd4b[_0xbd15('0x56')]);})['then'](function(_0x4e9508){_0x365b1a=_0x4e9508;logger[_0xbd15('0x1c')](_0xbd15('0x57'),_0x365b1a['id']);return getTicket(_0x3739b5,_0x5d085d,_0x365b1a,_0x3f0dbd,_0x30dd4b);})[_0xbd15('0x1b')](function(_0x34e48d){if(_0x34e48d&&_0x34e48d['id']){logger[_0xbd15('0x1c')](_0xbd15('0x1d'));logger[_0xbd15('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x34e48d['id']);logger['info'](_0xbd15('0x53'),_0xbd15('0x4a'));emit(util['format'](_0xbd15('0x4b'),_0x160424[_0xbd15('0x40')]),_0xbd15('0x4c'),{'uri':util[_0xbd15('0x27')](_0xbd15('0x4d'),_0x3739b5[_0xbd15('0x19')],_0x34e48d['id'])});}})['catch'](function(_0x90d911){logger[_0xbd15('0x4f')](_0xbd15('0x53'),JSON[_0xbd15('0x30')](_0x90d911));});};exports[_0xbd15('0x58')]=function(_0x29743d,_0xe09037,_0x5718e9,_0x4cf7e6,_0x3837ce,_0x41c43a){var _0x2c24cb,_0x2a37d4;_0x41c43a[_0xbd15('0x19')]=intUtil[_0xbd15('0x42')](_0x41c43a[_0xbd15('0x19')]);_0x41c43a['serverUrl']=intUtil['stripTrailingSlash'](_0x41c43a['serverUrl']);if(_0x3837ce&&_0x3837ce[_0xbd15('0x59')]){logger[_0xbd15('0x1c')]('['+_0xe09037['lastevent'][_0xbd15('0x5a')]()+']','Recording\x20is\x20enabled!');_0xe09037[_0xbd15('0x45')]=util[_0xbd15('0x27')](_0xbd15('0x46'),_0x41c43a[_0xbd15('0x43')],_0xe09037[_0xbd15('0x54')],md5(_0xe09037[_0xbd15('0x54')]));}else{_0xe09037['recordingURL']='';}headers[_0xbd15('0x47')]=getAuth(_0x41c43a);return getUser(_0x41c43a,'')[_0xbd15('0x1b')](function(_0x757bb1){_0x2c24cb=_0x757bb1;logger[_0xbd15('0x1c')]('The\x20User\x20ID\x20is:',_0x2c24cb['id']);return getEndUser(_0x41c43a,_0xe09037[_0xbd15('0x5b')],_0xe09037['calleridnum']);})[_0xbd15('0x1b')](function(_0x503212){_0x2a37d4=_0x503212;logger[_0xbd15('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x2a37d4['id']);return getTicket(_0x41c43a,_0x2c24cb,_0x2a37d4,_0x5718e9,_0xe09037);})[_0xbd15('0x1b')](function(_0x17a9f5){if(_0x17a9f5){logger['info']('Ticket\x20created!');logger['info'](_0xbd15('0x49'),_0x17a9f5['id']);}})[_0xbd15('0x4e')](function(_0xf39fd6){logger[_0xbd15('0x4f')]('['+_0xe09037['lastevent'][_0xbd15('0x5a')]()+']',JSON['stringify'](_0xf39fd6));});}; \ 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 59fa30e..0f14889 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 _0x9dda=['Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','&entities=contact','find','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s'];(function(_0x1ebe2f,_0x523227){var _0xdeb06f=function(_0x2a6051){while(--_0x2a6051){_0x1ebe2f['push'](_0x1ebe2f['shift']());}};_0xdeb06f(++_0x523227);}(_0x9dda,0x1a2));var _0xa9dd=function(_0x28bf52,_0x6a0e8d){_0x28bf52=_0x28bf52-0x0;var _0x2b2cc9=_0x9dda[_0x28bf52];return _0x2b2cc9;};'use strict';var _=require(_0xa9dd('0x0'));var rp=require(_0xa9dd('0x1'));var md5=require('md5');var util=require(_0xa9dd('0x2'));var moment=require(_0xa9dd('0x3'));var Promise=require(_0xa9dd('0x4'));var Redis=require(_0xa9dd('0x5'));var intUtil=require(_0xa9dd('0x6'));var config=require(_0xa9dd('0x7'));var logger=require(_0xa9dd('0x8'))(_0xa9dd('0x9'));config['redis']=_[_0xa9dd('0xa')](config[_0xa9dd('0xb')],{'host':_0xa9dd('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0xdb9ee3,_0x3eecfd,_0x3cd7a9,_0x4ec824){return new Promise(function(_0x2f56d3,_0x4f9274){var _0x46ce28=![];var _0xfb8043={'method':_0xa9dd('0xd'),'uri':_0x4ec824+_0xa9dd('0xe'),'json':!![]};_0xfb8043[_0xa9dd('0xf')]=_0x3cd7a9;logger[_0xa9dd('0x10')](_0xa9dd('0x11'));return rp(_0xfb8043)[_0xa9dd('0x12')](function(_0x26d57c){if(_0x26d57c){var _0x5611e2=_0x26d57c[_0xa9dd('0x13')];var _0x3c5257=null;for(_0x3c5257=0x0;_0x3c5257<_0x5611e2[_0xa9dd('0x14')];_0x3c5257++){if(_0x5611e2[_0x3c5257]['email']===_0xdb9ee3[_0xa9dd('0x15')]){_0xdb9ee3[_0xa9dd('0x16')]=_0x5611e2[_0x3c5257]['id'];_0x46ce28=!![];}}if(_0x46ce28){logger[_0xa9dd('0x10')]('Admin\x20found:',_0xdb9ee3[_0xa9dd('0x16')]);_0x2f56d3(_0xdb9ee3);}else{_0x4f9274({'statusCode':0x194,'message':_0xa9dd('0x17')});}}else{_0x4f9274({'statusCode':0x194,'message':_0xa9dd('0x17')});}})[_0xa9dd('0x18')](function(_0x1088e0){logger[_0xa9dd('0x19')]('['+[_0x3eecfd[_0xa9dd('0x1a')]()]+']',_0x1088e0[_0xa9dd('0x1b')]);_0x4f9274(_0x1088e0);});});}function getUser(_0x40f83a,_0x2f7a1f,_0x152b4f){return function(_0x123b54){return new Promise(function(_0x412d06,_0x20a5bf){var _0x232b3d={'method':_0xa9dd('0xd'),'uri':_0x152b4f+_0xa9dd('0xe'),'json':!![]};_0x232b3d[_0xa9dd('0xf')]=_0x2f7a1f;logger[_0xa9dd('0x10')]('Getting\x20user\x20list');return rp(_0x232b3d)['then'](function(_0x1561b3){if(_0x1561b3){var _0x345c3d=_0x1561b3[_0xa9dd('0x13')];var _0x5e6851=![];var _0x22c70b=null;if(_0x123b54[_0xa9dd('0x1c')]!==null){logger[_0xa9dd('0x10')](_0xa9dd('0x1d'),_0x123b54[_0xa9dd('0x1c')]);_0x123b54[_0xa9dd('0x1e')]=_0x123b54[_0xa9dd('0x1c')];for(_0x22c70b=0x0;_0x22c70b<_0x345c3d[_0xa9dd('0x14')];_0x22c70b++){if(_0x345c3d[_0x22c70b][_0xa9dd('0x1f')]===_0x123b54['agentEmail']){_0x5e6851=!![];_0x123b54[_0xa9dd('0x20')]=_0x345c3d[_0x22c70b]['id'];logger[_0xa9dd('0x10')](_0xa9dd('0x21'),_0x123b54[_0xa9dd('0x20')]);}}}if(!_0x5e6851){logger[_0xa9dd('0x10')](_0xa9dd('0x22'));_0x123b54[_0xa9dd('0x1e')]=_0x123b54[_0xa9dd('0x15')];_0x123b54[_0xa9dd('0x20')]=_0x123b54[_0xa9dd('0x16')];_0x5e6851=!![];}if(_0x5e6851){_0x412d06(_0x123b54);}else{_0x20a5bf({'statusCode':0x194,'message':_0xa9dd('0x17')});}}else{_0x20a5bf({'statusCode':0x194,'message':_0xa9dd('0x17')});}})[_0xa9dd('0x18')](function(_0x2955b3){logger[_0xa9dd('0x19')]('['+[_0x40f83a[_0xa9dd('0x1a')]()]+']',_0x2955b3[_0xa9dd('0x1b')]);_0x20a5bf(_0x2955b3);});});};}function searchContact(_0x114ab1,_0x42ea9b,_0x1fae42,_0x39109f){return new Promise(function(_0x162c21,_0x40ddcc){var _0x43c2c7={'method':_0xa9dd('0xd'),'headers':_0x42ea9b,'uri':_0x114ab1+'/api/lookup?q='+_0x39109f+'&f='+_0x1fae42+_0xa9dd('0x23'),'json':!![]};rp(_0x43c2c7)[_0xa9dd('0x12')](function(_0x18ded2){var _0x5143cf=_[_0xa9dd('0x24')](_0x18ded2['contacts'][_0xa9dd('0x25')],[_0x1fae42,_0x39109f]);_0x162c21(_0x5143cf);})[_0xa9dd('0x18')](function(_0x14fe7e){_0x40ddcc(_0x14fe7e);});});}function getEndUser(_0x32f40b,_0x1051d4,_0x3f3aea){return function(_0x2d2d9f){return new Promise(function(_0x5e8517,_0x39550b){logger[_0xa9dd('0x10')](util[_0xa9dd('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2d2d9f[_0xa9dd('0x27')]));searchContact(_0x3f3aea,_0x1051d4,_0xa9dd('0x28'),_0x2d2d9f['contactNumber'])[_0xa9dd('0x12')](function(_0x3a9788){if(_0x3a9788){_0x2d2d9f['endUserId']=_0x3a9788['id'];logger[_0xa9dd('0x10')](_0xa9dd('0x29'),_0x2d2d9f[_0xa9dd('0x2a')]);return _0x5e8517(_0x2d2d9f);}searchContact(_0x3f3aea,_0x1051d4,_0xa9dd('0x2b'),_0x2d2d9f[_0xa9dd('0x27')])['then'](function(_0x4c00ca){if(_0x4c00ca){_0x2d2d9f[_0xa9dd('0x2a')]=_0x4c00ca['id'];logger[_0xa9dd('0x10')]('Contact\x20found\x20work_number:',_0x2d2d9f[_0xa9dd('0x2a')]);return _0x5e8517(_0x2d2d9f);}createEndUser(_0x2d2d9f,_0x32f40b,_0x1051d4,_0x3f3aea)[_0xa9dd('0x12')](function(_0x4be2ee){logger[_0xa9dd('0x10')](_0xa9dd('0x2c'),_0x4be2ee[_0xa9dd('0x2a')]);return _0x5e8517(_0x4be2ee);});});})[_0xa9dd('0x18')](function(_0x2df06e){_0x39550b(_0x2df06e);});});};}function createEndUser(_0x542438,_0x3f22b7,_0x2ff738,_0x5ca57b){return new Promise(function(_0x517cdc,_0x595865){var _0xbbd8e4=moment();var _0x22a829={'method':_0xa9dd('0x2d'),'uri':_0x5ca57b+_0xa9dd('0x2e'),'body':{'contact':{'last_name':_0x542438[_0xa9dd('0x27')],'work_number':_0x542438[_0xa9dd('0x27')],'mobile_number':_0x542438[_0xa9dd('0x27')],'owner_id':_0x542438[_0xa9dd('0x20')],'created_at':_0xbbd8e4[_0xa9dd('0x26')](_0xa9dd('0x2f'))}},'json':!![]};_0x22a829['headers']=_0x2ff738;logger[_0xa9dd('0x10')](_0xa9dd('0x30'));return rp(_0x22a829)[_0xa9dd('0x12')](function(_0x5c8dfd){_0x542438['endUserId']=_0x5c8dfd[_0xa9dd('0x31')]['id'];_0x517cdc(_0x542438);})[_0xa9dd('0x18')](function(_0x364a40){logger['error']('['+[_0x3f22b7[_0xa9dd('0x1a')]()]+']',_0x364a40['message']);_0x595865(_0x364a40[_0xa9dd('0x1b')]);});});}function getTicket(_0x5170d8,_0xa2e4ea,_0x231532,_0x48ffeb,_0x7c2299){return function(_0x4987a6){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x2d1eff,_0x4a0d58){var _0x394740=moment();var _0x771cef={'method':_0xa9dd('0x2d'),'uri':_0x231532+_0xa9dd('0x32'),'body':{'title':intUtil[_0xa9dd('0x33')](_0x48ffeb['Subjects'],_0x7c2299,'\x20'),'description':intUtil['getString'](_0x48ffeb[_0xa9dd('0x34')],_0x7c2299,'\x0a'),'owner_id':_0x4987a6[_0xa9dd('0x20')],'creater_id':_0x4987a6[_0xa9dd('0x16')],'targetable_id':_0x4987a6[_0xa9dd('0x2a')],'targetable_type':_0xa9dd('0x35'),'created_at':_0x394740[_0xa9dd('0x26')](_0xa9dd('0x2f')),'due_date':_0x394740[_0xa9dd('0x36')](0x1e,'m')[_0xa9dd('0x26')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x771cef[_0xa9dd('0xf')]=_0xa2e4ea;return rp(_0x771cef)['then'](function(_0x9cfa2a){_0x4987a6[_0xa9dd('0x37')]=_0x9cfa2a[_0xa9dd('0x38')]['id'];logger[_0xa9dd('0x10')](_0xa9dd('0x39'),_0x4987a6[_0xa9dd('0x37')]);_0x2d1eff(_0x4987a6);})['catch'](function(_0x1fc83e){logger[_0xa9dd('0x19')]('['+[_0x5170d8[_0xa9dd('0x1a')]()]+']',_0x1fc83e[_0xa9dd('0x1b')]);_0x4a0d58(_0x1fc83e[_0xa9dd('0x1b')]);});});};}function emit(_0x3f4d89,_0x5c2194,_0x57d8f4){var _0x190ba9={'uri':_0x3f4d89+_0xa9dd('0x3a')+_0x57d8f4};io['to'](util[_0xa9dd('0x26')](_0xa9dd('0x3b'),_0x5c2194))['emit'](_0xa9dd('0x3c'),_0x190ba9);}exports['cs']=function(_0x13c29d,_0xa2cb59,_0x57326b,_0x1c62d6,_0x27a117,_0x372642,_0x6432a6,_0x377b59){var _0x43a95b={};var _0xf1b1e4={'Authorization':_0xa9dd('0x3d')+_0x372642['apiKey']};_0x372642[_0xa9dd('0x3e')]=intUtil[_0xa9dd('0x3f')](_0x372642[_0xa9dd('0x3e')]);_0x372642[_0xa9dd('0x40')]=intUtil[_0xa9dd('0x3f')](_0x372642[_0xa9dd('0x40')]);var _0x12f5fc=_0x372642['remoteUri'];_0x43a95b[_0xa9dd('0x15')]=_0x372642['username'];_0x43a95b[_0xa9dd('0x27')]=_0x377b59[_0xa9dd('0x41')]()===_0xa9dd('0x42')?_0xa2cb59[_0xa9dd('0x43')]:_0xa2cb59[_0xa9dd('0x44')];_0x43a95b['callDirection']=_0x377b59===_0xa9dd('0x45')||_0x377b59===_0xa9dd('0x46')?_0xa9dd('0x45'):_0xa9dd('0x42');if(_0x1c62d6){_0x43a95b[_0xa9dd('0x1c')]=_0x1c62d6[_0xa9dd('0x1f')];}var _0x464734=util['format'](_0xa9dd('0x47'),_0x372642[_0xa9dd('0x40')],_0xa2cb59[_0xa9dd('0x48')],md5(_0xa2cb59[_0xa9dd('0x48')]));if(_0x27a117&&_0x27a117[_0xa9dd('0x49')]){logger[_0xa9dd('0x10')](_0xa9dd('0x4a'),_0xa9dd('0x4b'));_0xa2cb59[_0xa9dd('0x4c')]=_0x464734;}else if(_0x6432a6&&_0x6432a6[_0xa9dd('0x4d')]&&_0x6432a6[_0xa9dd('0x4d')]!=='none'){logger[_0xa9dd('0x10')](_0xa9dd('0x4e'),_0xa9dd('0x4b'));_0xa2cb59[_0xa9dd('0x4c')]=_0x464734;}else{_0xa2cb59[_0xa9dd('0x4c')]='';}return getAdminId(_0x43a95b,_0x377b59,_0xf1b1e4,_0x12f5fc)[_0xa9dd('0x12')](getUser(_0x377b59,_0xf1b1e4,_0x12f5fc))['then'](getEndUser(_0x377b59,_0xf1b1e4,_0x12f5fc))[_0xa9dd('0x12')](getTicket(_0x377b59,_0xf1b1e4,_0x12f5fc,_0x57326b,_0xa2cb59))[_0xa9dd('0x12')](function(_0x290761){logger[_0xa9dd('0x10')](util[_0xa9dd('0x26')](_0xa9dd('0x4f'),_0x290761[_0xa9dd('0x37')]));if(_0x377b59!=='unmanaged'){logger[_0xa9dd('0x10')]('['+[_0x377b59[_0xa9dd('0x1a')]()]+']',_0xa9dd('0x50'));emit(_0x12f5fc,_0x1c62d6[_0xa9dd('0x51')],_0x290761['endUserId']);}})[_0xa9dd('0x18')](function(_0x3e9325){logger[_0xa9dd('0x19')]('['+[_0x377b59[_0xa9dd('0x1a')]()]+_0xa9dd('0x52'),util['inspect'](_0x3e9325,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x37da=['trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','adminEmail','error','message','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Subjects','Descriptions','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit'];(function(_0x165b21,_0x5b695b){var _0x5bf0c0=function(_0x359ff3){while(--_0x359ff3){_0x165b21['push'](_0x165b21['shift']());}};_0x5bf0c0(++_0x5b695b);}(_0x37da,0x116));var _0xa37d=function(_0x2621b0,_0x4916b9){_0x2621b0=_0x2621b0-0x0;var _0x45beee=_0x37da[_0x2621b0];return _0x45beee;};'use strict';var _=require('lodash');var rp=require(_0xa37d('0x0'));var md5=require(_0xa37d('0x1'));var util=require('util');var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xa37d('0x2'));var config=require(_0xa37d('0x3'));var logger=require(_0xa37d('0x4'))(_0xa37d('0x5'));config[_0xa37d('0x6')]=_['defaults'](config[_0xa37d('0x6')],{'host':_0xa37d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa37d('0x6')]));function getAdminId(_0x165269,_0x57f915,_0x378b86,_0x230e21){return new Promise(function(_0x30fbf4,_0x5d2d14){var _0x439c5e=![];var _0x3ad307={'method':_0xa37d('0x8'),'uri':_0x230e21+_0xa37d('0x9'),'json':!![]};_0x3ad307[_0xa37d('0xa')]=_0x378b86;logger[_0xa37d('0xb')](_0xa37d('0xc'));return rp(_0x3ad307)['then'](function(_0x321df0){if(_0x321df0){var _0x48430d=_0x321df0[_0xa37d('0xd')];var _0x36aec3=null;for(_0x36aec3=0x0;_0x36aec3<_0x48430d[_0xa37d('0xe')];_0x36aec3++){if(_0x48430d[_0x36aec3]['email']===_0x165269['adminEmail']){_0x165269[_0xa37d('0xf')]=_0x48430d[_0x36aec3]['id'];_0x439c5e=!![];}}if(_0x439c5e){logger['info'](_0xa37d('0x10'),_0x165269[_0xa37d('0xf')]);_0x30fbf4(_0x165269);}else{_0x5d2d14({'statusCode':0x194,'message':_0xa37d('0x11')});}}else{_0x5d2d14({'statusCode':0x194,'message':_0xa37d('0x11')});}})[_0xa37d('0x12')](function(_0x1b3dc6){logger['error']('['+[_0x57f915[_0xa37d('0x13')]()]+']',_0x1b3dc6['message']);_0x5d2d14(_0x1b3dc6);});});}function getUser(_0x2b8b1c,_0x343a7f,_0x302df3){return function(_0x1dd989){return new Promise(function(_0x2f648e,_0x1afc9a){var _0x1916f6={'method':'GET','uri':_0x302df3+_0xa37d('0x9'),'json':!![]};_0x1916f6[_0xa37d('0xa')]=_0x343a7f;logger[_0xa37d('0xb')](_0xa37d('0x14'));return rp(_0x1916f6)[_0xa37d('0x15')](function(_0x4b9c4a){if(_0x4b9c4a){var _0x153c65=_0x4b9c4a[_0xa37d('0xd')];var _0x5a69e0=![];var _0x43a137=null;if(_0x1dd989[_0xa37d('0x16')]!==null){logger['info'](_0xa37d('0x17'),_0x1dd989[_0xa37d('0x16')]);_0x1dd989[_0xa37d('0x18')]=_0x1dd989['agentEmail'];for(_0x43a137=0x0;_0x43a137<_0x153c65[_0xa37d('0xe')];_0x43a137++){if(_0x153c65[_0x43a137][_0xa37d('0x19')]===_0x1dd989[_0xa37d('0x16')]){_0x5a69e0=!![];_0x1dd989[_0xa37d('0x1a')]=_0x153c65[_0x43a137]['id'];logger[_0xa37d('0xb')](_0xa37d('0x1b'),_0x1dd989['userId']);}}}if(!_0x5a69e0){logger[_0xa37d('0xb')](_0xa37d('0x1c'));_0x1dd989['userEmail']=_0x1dd989[_0xa37d('0x1d')];_0x1dd989[_0xa37d('0x1a')]=_0x1dd989[_0xa37d('0xf')];_0x5a69e0=!![];}if(_0x5a69e0){_0x2f648e(_0x1dd989);}else{_0x1afc9a({'statusCode':0x194,'message':_0xa37d('0x11')});}}else{_0x1afc9a({'statusCode':0x194,'message':_0xa37d('0x11')});}})['catch'](function(_0x315e65){logger[_0xa37d('0x1e')]('['+[_0x2b8b1c[_0xa37d('0x13')]()]+']',_0x315e65[_0xa37d('0x1f')]);_0x1afc9a(_0x315e65);});});};}function searchContact(_0x5f233b,_0x5b42e0,_0x1c3d3e,_0x2f020d){return new Promise(function(_0x3f6875,_0xc1b980){var _0x2e7014={'method':_0xa37d('0x8'),'headers':_0x5b42e0,'uri':_0x5f233b+_0xa37d('0x20')+_0x2f020d+'&f='+_0x1c3d3e+_0xa37d('0x21'),'json':!![]};rp(_0x2e7014)['then'](function(_0x4be73a){var _0x2a40a2=_['find'](_0x4be73a['contacts'][_0xa37d('0x22')],[_0x1c3d3e,_0x2f020d]);_0x3f6875(_0x2a40a2);})[_0xa37d('0x12')](function(_0x29ae34){_0xc1b980(_0x29ae34);});});}function getEndUser(_0x3c042b,_0x295f5c,_0x530575){return function(_0x3f4dea){return new Promise(function(_0x1a6bee,_0x139af8){logger[_0xa37d('0xb')](util[_0xa37d('0x23')](_0xa37d('0x24'),_0x3f4dea[_0xa37d('0x25')]));searchContact(_0x530575,_0x295f5c,_0xa37d('0x26'),_0x3f4dea[_0xa37d('0x25')])[_0xa37d('0x15')](function(_0x39058b){if(_0x39058b){_0x3f4dea[_0xa37d('0x27')]=_0x39058b['id'];logger[_0xa37d('0xb')](_0xa37d('0x28'),_0x3f4dea[_0xa37d('0x27')]);return _0x1a6bee(_0x3f4dea);}searchContact(_0x530575,_0x295f5c,'work_number',_0x3f4dea['contactNumber'])[_0xa37d('0x15')](function(_0x10efb6){if(_0x10efb6){_0x3f4dea['endUserId']=_0x10efb6['id'];logger[_0xa37d('0xb')](_0xa37d('0x29'),_0x3f4dea['endUserId']);return _0x1a6bee(_0x3f4dea);}createEndUser(_0x3f4dea,_0x3c042b,_0x295f5c,_0x530575)[_0xa37d('0x15')](function(_0x54ad03){logger[_0xa37d('0xb')](_0xa37d('0x2a'),_0x54ad03[_0xa37d('0x27')]);return _0x1a6bee(_0x54ad03);});});})[_0xa37d('0x12')](function(_0x5363e3){_0x139af8(_0x5363e3);});});};}function createEndUser(_0x785f23,_0x365ba1,_0x3d72e9,_0x3ac8e4){return new Promise(function(_0x4c119e,_0x1ba62b){var _0xc7b173=moment();var _0x28eda5={'method':_0xa37d('0x2b'),'uri':_0x3ac8e4+_0xa37d('0x2c'),'body':{'contact':{'last_name':_0x785f23['contactNumber'],'work_number':_0x785f23['contactNumber'],'mobile_number':_0x785f23[_0xa37d('0x25')],'owner_id':_0x785f23['userId'],'created_at':_0xc7b173[_0xa37d('0x23')](_0xa37d('0x2d'))}},'json':!![]};_0x28eda5['headers']=_0x3d72e9;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x28eda5)[_0xa37d('0x15')](function(_0x29bfb4){_0x785f23[_0xa37d('0x27')]=_0x29bfb4[_0xa37d('0x2e')]['id'];_0x4c119e(_0x785f23);})[_0xa37d('0x12')](function(_0x30a0ff){logger['error']('['+[_0x365ba1['toUpperCase']()]+']',_0x30a0ff[_0xa37d('0x1f')]);_0x1ba62b(_0x30a0ff['message']);});});}function getTicket(_0x2198a0,_0x3f76e8,_0x42ba47,_0x5a764b,_0x3a3279){return function(_0x16439a){logger[_0xa37d('0xb')]('Creating\x20new\x20task');return new Promise(function(_0xc44b2d,_0xe51542){var _0x43001d=moment();var _0x50ce25={'method':_0xa37d('0x2b'),'uri':_0x42ba47+_0xa37d('0x2f'),'body':{'title':intUtil[_0xa37d('0x30')](_0x5a764b[_0xa37d('0x31')],_0x3a3279,'\x20'),'description':intUtil[_0xa37d('0x30')](_0x5a764b[_0xa37d('0x32')],_0x3a3279,'\x0a'),'owner_id':_0x16439a['userId'],'creater_id':_0x16439a[_0xa37d('0xf')],'targetable_id':_0x16439a[_0xa37d('0x27')],'targetable_type':'Contact','created_at':_0x43001d[_0xa37d('0x23')](_0xa37d('0x2d')),'due_date':_0x43001d[_0xa37d('0x33')](0x1e,'m')[_0xa37d('0x23')](_0xa37d('0x2d'))},'json':!![]};_0x50ce25[_0xa37d('0xa')]=_0x3f76e8;return rp(_0x50ce25)[_0xa37d('0x15')](function(_0x18b7af){_0x16439a['ticketId']=_0x18b7af[_0xa37d('0x34')]['id'];logger[_0xa37d('0xb')](_0xa37d('0x35'),_0x16439a[_0xa37d('0x36')]);_0xc44b2d(_0x16439a);})[_0xa37d('0x12')](function(_0xba9c0f){logger[_0xa37d('0x1e')]('['+[_0x2198a0['toUpperCase']()]+']',_0xba9c0f['message']);_0xe51542(_0xba9c0f[_0xa37d('0x1f')]);});});};}function emit(_0x44e275,_0x39bb8d,_0xf37cfe){var _0x14f5fc={'uri':_0x44e275+_0xa37d('0x37')+_0xf37cfe};io['to'](util[_0xa37d('0x23')](_0xa37d('0x38'),_0x39bb8d))[_0xa37d('0x39')](_0xa37d('0x3a'),_0x14f5fc);}exports['cs']=function(_0x34c1c4,_0x43f9c2,_0x37bc08,_0x396400,_0x39efd3,_0x4ddd13,_0x409d44,_0x4c2ea8){var _0x57d874={};var _0x519b11={'Authorization':_0xa37d('0x3b')+_0x4ddd13[_0xa37d('0x3c')]};_0x4ddd13[_0xa37d('0x3d')]=intUtil['stripTrailingSlash'](_0x4ddd13[_0xa37d('0x3d')]);_0x4ddd13[_0xa37d('0x3e')]=intUtil[_0xa37d('0x3f')](_0x4ddd13[_0xa37d('0x3e')]);var _0x1679e9=_0x4ddd13[_0xa37d('0x3d')];_0x57d874[_0xa37d('0x1d')]=_0x4ddd13['username'];_0x57d874[_0xa37d('0x25')]=_0x4c2ea8[_0xa37d('0x40')]()===_0xa37d('0x41')?_0x43f9c2[_0xa37d('0x42')]:_0x43f9c2[_0xa37d('0x43')];_0x57d874[_0xa37d('0x44')]=_0x4c2ea8===_0xa37d('0x45')||_0x4c2ea8===_0xa37d('0x46')?_0xa37d('0x45'):_0xa37d('0x41');if(_0x396400){_0x57d874[_0xa37d('0x16')]=_0x396400[_0xa37d('0x19')];}var _0x466704=util[_0xa37d('0x23')](_0xa37d('0x47'),_0x4ddd13['serverUrl'],_0x43f9c2[_0xa37d('0x48')],md5(_0x43f9c2[_0xa37d('0x48')]));if(_0x39efd3&&_0x39efd3[_0xa37d('0x49')]){logger[_0xa37d('0xb')](_0xa37d('0x4a'),_0xa37d('0x4b'));_0x43f9c2[_0xa37d('0x4c')]=_0x466704;}else if(_0x409d44&&_0x409d44[_0xa37d('0x4d')]&&_0x409d44[_0xa37d('0x4d')]!=='none'){logger[_0xa37d('0xb')](_0xa37d('0x4e'),_0xa37d('0x4b'));_0x43f9c2['recordingURL']=_0x466704;}else{_0x43f9c2[_0xa37d('0x4c')]='';}return getAdminId(_0x57d874,_0x4c2ea8,_0x519b11,_0x1679e9)[_0xa37d('0x15')](getUser(_0x4c2ea8,_0x519b11,_0x1679e9))['then'](getEndUser(_0x4c2ea8,_0x519b11,_0x1679e9))[_0xa37d('0x15')](getTicket(_0x4c2ea8,_0x519b11,_0x1679e9,_0x37bc08,_0x43f9c2))[_0xa37d('0x15')](function(_0x2f19b9){logger[_0xa37d('0xb')](util[_0xa37d('0x23')](_0xa37d('0x4f'),_0x2f19b9[_0xa37d('0x36')]));if(_0x4c2ea8!=='unmanaged'){logger[_0xa37d('0xb')]('['+[_0x4c2ea8['toUpperCase']()]+']',_0xa37d('0x50'));emit(_0x1679e9,_0x396400[_0xa37d('0x51')],_0x2f19b9['endUserId']);}})[_0xa37d('0x12')](function(_0x3efcbf){logger[_0xa37d('0x1e')]('['+[_0x4c2ea8[_0xa37d('0x13')]()]+_0xa37d('0x52'),util[_0xa37d('0x53')](_0x3efcbf,{'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 ef5cd56..83dd5a0 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 _0x9c97=['[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','vtiger','servicenow','unknown\x20integration','../../../../config/logger','error'];(function(_0x2c8a17,_0x1841c4){var _0x126c37=function(_0x2b733d){while(--_0x2b733d){_0x2c8a17['push'](_0x2c8a17['shift']());}};_0x126c37(++_0x1841c4);}(_0x9c97,0xcf));var _0x79c9=function(_0x530af4,_0x2a4794){_0x530af4=_0x530af4-0x0;var _0x20e15a=_0x9c97[_0x530af4];return _0x20e15a;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x79c9('0x0'));var salesforce=require(_0x79c9('0x1'));var sugarcrm=require(_0x79c9('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x79c9('0x3'));var desk=require('./desk');var vtiger=require(_0x79c9('0x4'));var servicenow=require(_0x79c9('0x5'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x79c9('0x6'),_0x79c9('0x7'),_0x79c9('0x8'),_0x79c9('0x9'),_0x79c9('0xa'),_0x79c9('0xb'),'vtiger',_0x79c9('0xc'),_0x79c9('0xd'),'servicenow'];exports['exec']=function(_0x550c70,_0x35220a,_0x53e45a,_0x524a46,_0x288d7d,_0x10f07a){if(_0x53e45a){if(_[_0x79c9('0xe')](integrations,_0x550c70[_0x79c9('0xf')][_0x79c9('0x10')]())){try{var _0x5ce4cd=null;var _0xc54c1='';var _0x4272c4=_0x53e45a[_0x550c70[_0x79c9('0xf')][_0x79c9('0x10')]()];if(_0x4272c4){var _0x3e0c36=_0x4272c4[_0x550c70[_0x79c9('0x11')]];if(_0x3e0c36){var _0x25a229=_[_0x79c9('0x12')](_0x3e0c36[_0x79c9('0x13')],{'id':parseInt(_0x550c70[_0x79c9('0x14')],0xa)});if(_0x25a229){if(_0x524a46){if(_0x288d7d&&_0x35220a[_0x79c9('0x15')]){_0xc54c1=_0x79c9('0x15');}else if(_0x35220a[_0x79c9('0x16')]){_0xc54c1=_0x79c9('0x17');}else{console['log'](_0x79c9('0x18'),_0x35220a);}}else{_0xc54c1=_0x79c9('0x19');}switch(_0x550c70['data1'][_0x79c9('0x10')]()){case _0x79c9('0x6'):zendesk[_0xc54c1](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a);break;case'salesforce':salesforce[_0xc54c1](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a);break;case'sugarcrm':sugarcrm[_0xc54c1](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a);break;case _0x79c9('0x9'):freshdesk[_0xc54c1](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a);break;case'zoho':zoho[_0xc54c1](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a);break;case'desk':desk[_0xc54c1](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a);break;case _0x79c9('0x1a'):vtiger[_0xc54c1](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a);break;case _0x79c9('0xd'):freshsales['cs'](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a,_0xc54c1);break;case _0x79c9('0x1b'):servicenow['cs'](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a,_0xc54c1);break;case _0x79c9('0xc'):dynamics365['cs'](_0x550c70,_0x35220a,_0x25a229,_0x524a46,_0x288d7d,_0x3e0c36,_0x10f07a,_0xc54c1);break;default:console['log'](_0x79c9('0x1c'));}}else{_0x5ce4cd=require(_0x79c9('0x1d'))(_0x550c70[_0x79c9('0xf')][_0x79c9('0x10')]());_0x5ce4cd[_0x79c9('0x1e')](_0x79c9('0x1f'),util[_0x79c9('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x550c70['data1']['toLowerCase'](),_0x550c70['data3']));}}else{_0x5ce4cd=require(_0x79c9('0x1d'))(_0x550c70[_0x79c9('0xf')]['toLowerCase']());_0x5ce4cd[_0x79c9('0x1e')](_0x79c9('0x1f'),util[_0x79c9('0x20')](_0x79c9('0x21'),_0x550c70[_0x79c9('0xf')]['toLowerCase'](),_0x550c70[_0x79c9('0x11')]));}}else{}}catch(_0x1e88c0){console['error'](_0x1e88c0);}}}}; \ No newline at end of file +var _0xa793=['dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger'];(function(_0x5866ac,_0x57321f){var _0x2e59f3=function(_0x4e9a35){while(--_0x4e9a35){_0x5866ac['push'](_0x5866ac['shift']());}};_0x2e59f3(++_0x57321f);}(_0xa793,0x12f));var _0x3a79=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xa793[_0x173452];return _0xee3fd0;};'use strict';var _=require('lodash');var util=require(_0x3a79('0x0'));var zendesk=require(_0x3a79('0x1'));var salesforce=require(_0x3a79('0x2'));var sugarcrm=require(_0x3a79('0x3'));var freshdesk=require(_0x3a79('0x4'));var zoho=require(_0x3a79('0x5'));var desk=require(_0x3a79('0x6'));var vtiger=require(_0x3a79('0x7'));var servicenow=require(_0x3a79('0x8'));var dynamics365=require(_0x3a79('0x9'));var freshsales=require(_0x3a79('0xa'));var integrations=[_0x3a79('0xb'),'salesforce',_0x3a79('0xc'),_0x3a79('0xd'),_0x3a79('0xe'),_0x3a79('0xf'),_0x3a79('0x10'),_0x3a79('0x11'),_0x3a79('0x12'),_0x3a79('0x13')];exports['exec']=function(_0x1a452c,_0x474042,_0x58e8d0,_0x1740ce,_0x4e9e8b,_0x4d0d8b){if(_0x58e8d0){if(_[_0x3a79('0x14')](integrations,_0x1a452c['data1']['toLowerCase']())){try{var _0x3184f8=null;var _0x81a074='';var _0x47853d=_0x58e8d0[_0x1a452c[_0x3a79('0x15')][_0x3a79('0x16')]()];if(_0x47853d){var _0x506911=_0x47853d[_0x1a452c[_0x3a79('0x17')]];if(_0x506911){var _0x421064=_[_0x3a79('0x18')](_0x506911[_0x3a79('0x19')],{'id':parseInt(_0x1a452c[_0x3a79('0x1a')],0xa)});if(_0x421064){if(_0x1740ce){if(_0x4e9e8b&&_0x474042[_0x3a79('0x1b')]){_0x81a074=_0x3a79('0x1b');}else if(_0x474042[_0x3a79('0x1c')]){_0x81a074=_0x3a79('0x1d');}else{console[_0x3a79('0x1e')](_0x3a79('0x1f'),_0x474042);}}else{_0x81a074=_0x3a79('0x20');}switch(_0x1a452c[_0x3a79('0x15')][_0x3a79('0x16')]()){case _0x3a79('0xb'):zendesk[_0x81a074](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b);break;case _0x3a79('0x21'):salesforce[_0x81a074](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b);break;case _0x3a79('0xc'):sugarcrm[_0x81a074](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b);break;case _0x3a79('0xd'):freshdesk[_0x81a074](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b);break;case _0x3a79('0xe'):zoho[_0x81a074](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b);break;case _0x3a79('0xf'):desk[_0x81a074](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b);break;case _0x3a79('0x10'):vtiger[_0x81a074](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b);break;case _0x3a79('0x12'):freshsales['cs'](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b,_0x81a074);break;case _0x3a79('0x13'):servicenow['cs'](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b,_0x81a074);break;case _0x3a79('0x11'):dynamics365['cs'](_0x1a452c,_0x474042,_0x421064,_0x1740ce,_0x4e9e8b,_0x506911,_0x4d0d8b,_0x81a074);break;default:console['log']('unknown\x20integration');}}else{_0x3184f8=require(_0x3a79('0x22'))(_0x1a452c[_0x3a79('0x15')][_0x3a79('0x16')]());_0x3184f8[_0x3a79('0x23')](_0x3a79('0x24'),util['format'](_0x3a79('0x25'),_0x1a452c[_0x3a79('0x15')][_0x3a79('0x16')](),_0x1a452c[_0x3a79('0x1a')]));}}else{_0x3184f8=require(_0x3a79('0x22'))(_0x1a452c['data1'][_0x3a79('0x16')]());_0x3184f8[_0x3a79('0x23')](_0x3a79('0x24'),util[_0x3a79('0x26')](_0x3a79('0x27'),_0x1a452c['data1']['toLowerCase'](),_0x1a452c[_0x3a79('0x17')]));}}else{}}catch(_0x437566){console[_0x3a79('0x23')](_0x437566);}}}}; \ 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 f0bfdb1..76916da 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 _0xf5b4=['recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','outbound','trigger:salesforce:display','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/logger','defaults','redis','localhost','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','Case','contact','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','find','execute','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','cloneDeep','additionalSearchContact','Contact','length','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','$or','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Company','upperFirst','forEach','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','clientId','clientSecret','username','queue','serverUrl','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0xf5b4,0xfd));var _0x4f5b=function(_0x44d62d,_0x128717){_0x44d62d=_0x44d62d-0x0;var _0xd4383f=_0xf5b4[_0x44d62d];return _0xd4383f;};'use strict';var _=require(_0x4f5b('0x0'));var rp=require(_0x4f5b('0x1'));var moment=require(_0x4f5b('0x2'));var BPromise=require(_0x4f5b('0x3'));var md5=require('md5');var jsforce=require(_0x4f5b('0x4'));var util=require('util');var Redis=require(_0x4f5b('0x5'));var intUtil=require(_0x4f5b('0x6'));var config=require('../../../../config/environment');var logger=require(_0x4f5b('0x7'))('salesforce');config['redis']=_[_0x4f5b('0x8')](config[_0x4f5b('0x9')],{'host':_0x4f5b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f5b('0x9')]));function emit(_0x5a77f5,_0x14f083,_0x3fa037){io['to'](_0x5a77f5)['emit'](_0x14f083,_0x3fa037);}function getTicket(_0xf55272,_0x1e3cc1,_0x30f401,_0x82ce74,_0x199633,_0x300660,_0x267aeb,_0x1a24c4){var _0x2917e2=Object[_0x4f5b('0xb')]({},{'OwnerId':_0x1e3cc1['id'],'Subject':intUtil[_0x4f5b('0xc')](_0x82ce74[_0x4f5b('0xd')],_0x199633,'\x20'),'Description':intUtil['getString'](_0x82ce74['Descriptions'],_0x199633,'\x0a')},getCustomFields(_0x300660,_0x199633));if(_0x30f401){if(_0x82ce74[_0x4f5b('0xe')]===_0x4f5b('0xf')){_0x2917e2[_0x4f5b('0x10')]=moment[_0x4f5b('0x11')]();_0x2917e2[_0x4f5b('0x12')]=![];_0x2917e2[_0x4f5b('0x13')]=![];if(_0x30f401[_0x4f5b('0x14')]==='contact'||_0x30f401[_0x4f5b('0x14')]==='lead'){_0x2917e2[_0x4f5b('0x15')]=_0x30f401['id'];}else if(_0x30f401[_0x4f5b('0x14')]===_0x4f5b('0x16')){_0x2917e2[_0x4f5b('0x17')]=_0x30f401['id'];}}else if(_0x82ce74[_0x4f5b('0xe')]===_0x4f5b('0x18')){if(_0x30f401['endUserType']===_0x4f5b('0x19')){_0x2917e2['ContactId']=_0x30f401['id'];}else if(_0x30f401[_0x4f5b('0x14')]==='account'){_0x2917e2[_0x4f5b('0x1a')]=_0x30f401['id'];}else if(_0x30f401[_0x4f5b('0x14')]===_0x4f5b('0x1b')&&_0x82ce74[_0x4f5b('0x1c')]){_0x2917e2[_0x82ce74[_0x4f5b('0x1c')]]=_0x30f401['id'];}else{logger['info'](_0x4f5b('0x1d'));}}}return _0x267aeb[_0x4f5b('0x1e')](_0x82ce74[_0x4f5b('0xe')])[_0x4f5b('0x1f')](_0x2917e2);}function getUser(_0x28ca71,_0x3219cf,_0x2c1c7b){if(!_[_0x4f5b('0x20')](_0x3219cf)&&intUtil['validateEmail'](_0x3219cf)){var _0x5d3447={'Email':_0x3219cf};var _0x42d4df={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2c1c7b[_0x4f5b('0x1e')]('User')[_0x4f5b('0x21')](_0x5d3447,_0x42d4df)[_0x4f5b('0x22')]()[_0x4f5b('0x23')](function(_0x127995){if(_0x127995['length']){var _0x20ae20=_[_0x4f5b('0x21')](_0x127995,function(_0x3aec3c){return _0x3aec3c[_0x4f5b('0x24')]===_0x3219cf;});if(_0x20ae20){logger[_0x4f5b('0x25')](_0x4f5b('0x26'),_0x3219cf);return BPromise[_0x4f5b('0x27')]({'id':_0x20ae20['Id'],'name':_0x20ae20[_0x4f5b('0x28')]});}}else{logger[_0x4f5b('0x25')](_0x4f5b('0x29'),_0x3219cf);return _0x2c1c7b[_0x4f5b('0x2a')]()[_0x4f5b('0x23')](function(_0x518806){return BPromise['resolve']({'id':_0x518806['user_id'],'name':_0x518806[_0x4f5b('0x2b')]});});}});}else{logger[_0x4f5b('0x25')](_0x4f5b('0x29'),_0x3219cf);return _0x2c1c7b[_0x4f5b('0x2a')]()[_0x4f5b('0x23')](function(_0x72cbbf){return BPromise[_0x4f5b('0x27')]({'id':_0x72cbbf[_0x4f5b('0x2c')],'name':_0x72cbbf[_0x4f5b('0x2b')]});});}}function getEndUser(_0x4fe8b6,_0x20c600,_0x29fd5a,_0x5f0bb7,_0x364d39){var _0xe85a2f={'$or':{'Phone':_0x5f0bb7}};var _0x2b5db1={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4f5b('0x27')]()[_0x4f5b('0x23')](function(){logger[_0x4f5b('0x25')](_0x4f5b('0x2d'),_0x5f0bb7,_0x20c600['moduleSearch']);switch(_0x20c600['moduleSearch']){case'contact_lead':var _0x143063=_[_0x4f5b('0x2e')](_0xe85a2f);if(_0x20c600['additionalSearchContact']){var _0x1bc107={};_0x1bc107[_0x20c600[_0x4f5b('0x2f')]]=_0x5f0bb7;_['merge'](_0x143063['$or'],_0x1bc107);}return _0x364d39['sobject'](_0x4f5b('0x30'))['find'](_0x143063,_0x2b5db1)['execute']()[_0x4f5b('0x23')](function(_0x32b480){if(_0x32b480&&_0x32b480[_0x4f5b('0x31')]){return _0x32b480;}else{var _0x85f21c=_[_0x4f5b('0x2e')](_0xe85a2f);if(_0x20c600[_0x4f5b('0x32')]){var _0x5c72f={};_0x5c72f[_0x20c600[_0x4f5b('0x32')]]=_0x5f0bb7;_[_0x4f5b('0x33')](_0x85f21c['$or'],_0x5c72f);}return _0x364d39[_0x4f5b('0x1e')](_0x4f5b('0x34'))['find'](_0x85f21c,_0x2b5db1);}});case _0x4f5b('0x35'):var _0x17bef9=_['cloneDeep'](_0xe85a2f);if(_0x20c600['additionalSearchAccount']){var _0x1bc107={};_0x1bc107[_0x20c600[_0x4f5b('0x36')]]=_0x5f0bb7;_[_0x4f5b('0x33')](_0x17bef9[_0x4f5b('0x37')],_0x1bc107);}return _0x364d39[_0x4f5b('0x1e')](_0x4f5b('0x38'))[_0x4f5b('0x21')](_0x17bef9,_0x2b5db1)[_0x4f5b('0x22')]()[_0x4f5b('0x23')](function(_0x31a06b){if(_0x31a06b&&_0x31a06b[_0x4f5b('0x31')]){return _0x31a06b;}else{var _0x2da6d6=_['cloneDeep'](_0xe85a2f);if(_0x20c600[_0x4f5b('0x2f')]){var _0x3234af={};_0x3234af[_0x20c600[_0x4f5b('0x2f')]]=_0x5f0bb7;_[_0x4f5b('0x33')](_0x2da6d6[_0x4f5b('0x37')],_0x3234af);}return _0x364d39[_0x4f5b('0x1e')]('Contact')['find'](_0x2da6d6,_0x2b5db1)['then'](function(_0x597866){if(_0x597866&&_0x597866['length']){return _0x597866;}else{var _0x40c3bd=_[_0x4f5b('0x2e')](_0xe85a2f);if(_0x20c600[_0x4f5b('0x32')]){var _0xf8193b={};_0xf8193b[_0x20c600[_0x4f5b('0x32')]]=_0x5f0bb7;_[_0x4f5b('0x33')](_0x40c3bd[_0x4f5b('0x37')],_0xf8193b);}return _0x364d39[_0x4f5b('0x1e')](_0x4f5b('0x34'))[_0x4f5b('0x21')](_0x40c3bd,_0x2b5db1);}});}});case _0x4f5b('0x19'):var _0x143063=_[_0x4f5b('0x2e')](_0xe85a2f);if(_0x20c600[_0x4f5b('0x2f')]){var _0x1bc107={};_0x1bc107[_0x20c600['additionalSearchContact']]=_0x5f0bb7;_[_0x4f5b('0x33')](_0x143063[_0x4f5b('0x37')],_0x1bc107);}return _0x364d39[_0x4f5b('0x1e')]('Contact')[_0x4f5b('0x21')](_0x143063,_0x2b5db1)[_0x4f5b('0x22')]();case _0x4f5b('0x1b'):var _0x15b113=_[_0x4f5b('0x2e')](_0xe85a2f);if(_0x20c600[_0x4f5b('0x32')]){var _0x1bc107={};_0x1bc107[_0x20c600[_0x4f5b('0x32')]]=_0x5f0bb7;_[_0x4f5b('0x33')](_0x15b113[_0x4f5b('0x37')],_0x1bc107);}return _0x364d39[_0x4f5b('0x1e')](_0x4f5b('0x34'))[_0x4f5b('0x21')](_0x15b113,_0x2b5db1);case _0x4f5b('0x16'):var _0x17bef9=_['cloneDeep'](_0xe85a2f);if(_0x20c600['additionalSearchAccount']){var _0x1bc107={};_0x1bc107[_0x20c600[_0x4f5b('0x36')]]=_0x5f0bb7;_[_0x4f5b('0x33')](_0x17bef9[_0x4f5b('0x37')],_0x1bc107);}return _0x364d39[_0x4f5b('0x1e')](_0x4f5b('0x38'))[_0x4f5b('0x21')](_0x17bef9,_0x2b5db1);default:return null;}})[_0x4f5b('0x23')](function(_0x1694be){if(_0x1694be&&_0x1694be[_0x4f5b('0x31')]){var _0x2a0fb3=_[_0x4f5b('0x39')](_0x1694be);if(_0x2a0fb3){return BPromise[_0x4f5b('0x27')]({'id':_0x2a0fb3['Id'],'name':_0x2a0fb3['Name'],'phone':_0x2a0fb3[_0x4f5b('0x3a')],'endUserType':_0x2a0fb3[_0x4f5b('0x3b')][_0x4f5b('0x3c')][_0x4f5b('0x3d')]()});}}})[_0x4f5b('0x23')](function(_0x3b5165){if(_0x3b5165){logger[_0x4f5b('0x25')](_0x4f5b('0x3e'),_0x3b5165[_0x4f5b('0x14')],_0x5f0bb7);return BPromise['resolve'](_0x3b5165);}else{logger[_0x4f5b('0x25')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5f0bb7);var _0x134ab3={'Phone':_0x5f0bb7};if(_0x20c600[_0x4f5b('0x3f')]){if(_0x20c600['moduleCreate']==='contact'){logger[_0x4f5b('0x25')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5f0bb7,_0x20c600[_0x4f5b('0x3f')]);_0x134ab3['LastName']=_0x29fd5a!==_0x4f5b('0x40')?_0x29fd5a:util[_0x4f5b('0x41')](_0x4f5b('0x42'),_0x5f0bb7);}else if(_0x20c600['moduleCreate']===_0x4f5b('0x1b')){logger[_0x4f5b('0x25')](_0x4f5b('0x43'),_0x5f0bb7,_0x20c600['moduleCreate']);_0x134ab3[_0x4f5b('0x44')]=_0x29fd5a!==_0x4f5b('0x40')?_0x29fd5a:util[_0x4f5b('0x41')](_0x4f5b('0x42'),_0x5f0bb7);_0x134ab3[_0x4f5b('0x45')]='No\x20Company';}else if(_0x20c600[_0x4f5b('0x3f')]===_0x4f5b('0x16')){logger[_0x4f5b('0x25')](_0x4f5b('0x43'),_0x5f0bb7,_0x20c600[_0x4f5b('0x3f')]);_0x134ab3['Name']=_0x29fd5a!==_0x4f5b('0x40')?_0x29fd5a:util[_0x4f5b('0x41')]('Caller\x20-\x20%s',_0x5f0bb7);}else{return null;}}return _0x364d39[_0x4f5b('0x1e')](_[_0x4f5b('0x46')](_0x20c600[_0x4f5b('0x3f')]))['create'](_0x134ab3)[_0x4f5b('0x23')](function(_0x1c2b60){return BPromise[_0x4f5b('0x27')]({'id':_0x1c2b60['id'],'endUserType':_0x20c600[_0x4f5b('0x3f')]});});}});}function getCustomFields(_0x1be388,_0x5098c9){var _0x5a0753={};if(_0x1be388[_0x4f5b('0x31')]>0x0){_[_0x4f5b('0x47')](_0x1be388,function(_0x42067c){if(_['includes']([_0x4f5b('0x48'),_0x4f5b('0x49')],_0x42067c[_0x4f5b('0x3c')])&&_0x42067c[_0x4f5b('0x4a')]){_0x5a0753[_0x42067c[_0x4f5b('0x4a')]]=_0x42067c[_0x4f5b('0x4b')][_0x4f5b('0x4c')]();}else if(_0x42067c[_0x4f5b('0x3c')]==='variable'&&_0x42067c[_0x4f5b('0x4d')]&&_0x42067c[_0x4f5b('0x4a')]){_0x5098c9[_0x42067c[_0x4f5b('0x4d')]]&&(_0x5a0753[_0x42067c['idField']]=_0x5098c9[_0x42067c[_0x4f5b('0x4d')]][_0x4f5b('0x4c')]());}else if(_0x42067c['type']===_0x4f5b('0x4e')&&_0x42067c[_0x4f5b('0x4f')]&&_0x42067c[_0x4f5b('0x4f')][_0x4f5b('0x50')]&&_0x42067c[_0x4f5b('0x4a')]){_0x5098c9[_0x42067c[_0x4f5b('0x4f')][_0x4f5b('0x50')]['toLowerCase']()]&&(_0x5a0753[_0x42067c['idField']]=_0x5098c9[_0x42067c[_0x4f5b('0x4f')][_0x4f5b('0x50')][_0x4f5b('0x3d')]()][_0x4f5b('0x4c')]());}});}return _0x5a0753;}function getConnection(_0x5ec6ce){var _0x2a0a89=_0x5ec6ce[_0x4f5b('0x51')]['concat'](_0x5ec6ce[_0x4f5b('0x52')]);var _0x23c1f6=new jsforce[(_0x4f5b('0x53'))]({'oauth2':{'loginUrl':_0x5ec6ce[_0x4f5b('0x54')]||'https://login.salesforce.com','clientId':_0x5ec6ce[_0x4f5b('0x55')],'clientSecret':_0x5ec6ce[_0x4f5b('0x56')]}});return _0x23c1f6['login'](_0x5ec6ce[_0x4f5b('0x57')],_0x2a0a89)[_0x4f5b('0x23')](function(){logger['info']('Connection\x20established.');return _0x23c1f6;});}exports[_0x4f5b('0x58')]=function(_0x3ff4d7,_0x564d41,_0xb55ee2,_0x52935e,_0x177a62,_0x169983){var _0x6bad4a,_0x2d46f4,_0x48f4c6,_0x5f34d3;_0x169983[_0x4f5b('0x59')]=intUtil[_0x4f5b('0x5a')](_0x169983['serverUrl']);_0x169983[_0x4f5b('0x54')]=intUtil[_0x4f5b('0x5a')](_0x169983['remoteUri']);if(_0x177a62&&_0x177a62['monitor_format']){logger[_0x4f5b('0x25')](_0x4f5b('0x5b'),'Recording\x20is\x20enabled!');_0x564d41['recordingURL']=util[_0x4f5b('0x41')](_0x4f5b('0x5c'),_0x169983['serverUrl'],_0x564d41[_0x4f5b('0x5d')],md5(_0x564d41[_0x4f5b('0x5d')]));}else{_0x564d41[_0x4f5b('0x5e')]='';}return getConnection(_0x169983)[_0x4f5b('0x23')](function(_0x450b11){_0x5f34d3=_0x450b11;return getUser(_0x169983,_0x52935e[_0x4f5b('0x5f')],_0x5f34d3);})[_0x4f5b('0x23')](function(_0x2e8f1c){_0x6bad4a=_0x2e8f1c;return getEndUser(_0x169983,_0xb55ee2,_0x564d41[_0x4f5b('0x60')],_0x564d41['calleridnum'],_0x5f34d3);})[_0x4f5b('0x23')](function(_0x54ec57){_0x2d46f4=_0x54ec57;return getTicket(_0x169983,_0x6bad4a,_0x2d46f4,_0xb55ee2,_0x564d41,_0xb55ee2[_0x4f5b('0x61')],_0x5f34d3,_0x4f5b('0x58'));})['then'](function(_0x5510a4){_0x48f4c6=_0x5510a4;logger[_0x4f5b('0x25')](_0x4f5b('0x62'),_0x48f4c6['id']);logger[_0x4f5b('0x25')](_0x4f5b('0x63'),_0x48f4c6['id'],_0x52935e['name'],_0x169983[_0x4f5b('0x3c')]);switch(_0x169983['type']){case _0x4f5b('0x64'):emit(util['format'](_0x4f5b('0x65'),_0x52935e[_0x4f5b('0x50')]),'trigger:salesforce:display',{'recordId':_0x48f4c6['id']});break;case _0x4f5b('0x66'):emit(util[_0x4f5b('0x41')](_0x4f5b('0x65'),_0x52935e[_0x4f5b('0x50')]),_0x4f5b('0x67'),{'uri':util[_0x4f5b('0x41')]('%s/%s/e',_0x5f34d3['instanceUrl'],_0x48f4c6['id'])});break;default:logger[_0x4f5b('0x68')](_0x4f5b('0x69'));}})[_0x4f5b('0x6a')](function(_0x535f7b){logger[_0x4f5b('0x68')](_0x4f5b('0x5b'),_0x535f7b);});};exports['outbound']=function(_0x4e910a,_0x4f162d,_0x3fa1bb,_0x570cbe,_0xf707a7,_0x2ca4a7,_0x3a570e){var _0x432a4c,_0x2e39f1,_0x4e866c,_0xbb1cd;_0x2ca4a7[_0x4f5b('0x59')]=intUtil[_0x4f5b('0x5a')](_0x2ca4a7['serverUrl']);_0x2ca4a7['remoteUri']=intUtil[_0x4f5b('0x5a')](_0x2ca4a7[_0x4f5b('0x54')]);if(_0x3a570e&&_0x3a570e[_0x4f5b('0x6b')]&&_0x3a570e[_0x4f5b('0x6b')]!=='none'){logger[_0x4f5b('0x25')](_0x4f5b('0x6c'),_0x4f5b('0x6d'));_0x4f162d[_0x4f5b('0x5e')]=util[_0x4f5b('0x41')](_0x4f5b('0x5c'),_0x2ca4a7[_0x4f5b('0x59')],_0x4f162d['uniqueid'],md5(_0x4f162d[_0x4f5b('0x5d')]));}return getConnection(_0x2ca4a7)[_0x4f5b('0x23')](function(_0x52943e){_0xbb1cd=_0x52943e;return getUser(_0x2ca4a7,_0x570cbe[_0x4f5b('0x5f')],_0xbb1cd);})[_0x4f5b('0x23')](function(_0x362d7c){_0x432a4c=_0x362d7c;return getEndUser(_0x2ca4a7,_0x3fa1bb,_0x4f162d[_0x4f5b('0x6e')],_0x4f162d['destcalleridnum'],_0xbb1cd);})[_0x4f5b('0x23')](function(_0x203d8b){_0x2e39f1=_0x203d8b;return getTicket(_0x2ca4a7,_0x432a4c,_0x2e39f1,_0x3fa1bb,_0x4f162d,_0x3fa1bb['Fields'],_0xbb1cd,_0x4f5b('0x6f'));})[_0x4f5b('0x23')](function(_0x43d570){_0x4e866c=_0x43d570;logger[_0x4f5b('0x25')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4e866c['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4e866c['id'],_0x570cbe[_0x4f5b('0x50')],_0x2ca4a7['type']);switch(_0x2ca4a7[_0x4f5b('0x3c')]){case _0x4f5b('0x64'):emit(util[_0x4f5b('0x41')](_0x4f5b('0x65'),_0x570cbe['name']),_0x4f5b('0x70'),{'recordId':_0x4e866c['id']});break;case _0x4f5b('0x66'):emit(util[_0x4f5b('0x41')]('user:%s',_0x570cbe[_0x4f5b('0x50')]),_0x4f5b('0x67'),{'uri':util[_0x4f5b('0x41')]('%s/%s/e',_0xbb1cd[_0x4f5b('0x71')],_0x4e866c['id'])});break;default:logger[_0x4f5b('0x68')]('[OUTBOUND]',_0x4f5b('0x72'));}})[_0x4f5b('0x6a')](function(_0x2e02f7){logger[_0x4f5b('0x68')](_0x4f5b('0x6c'),_0x2e02f7);});};exports['unmanaged']=function(_0x919b60,_0x5a35dc,_0x100189,_0x1de6fc,_0x1ffa81,_0x26518c){var _0x45f103,_0x351860,_0x21b3eb,_0xecb28d;_0x26518c[_0x4f5b('0x59')]=intUtil[_0x4f5b('0x5a')](_0x26518c['serverUrl']);_0x26518c['remoteUri']=intUtil['stripTrailingSlash'](_0x26518c[_0x4f5b('0x54')]);if(_0x1ffa81&&_0x1ffa81['monitor_format']){logger[_0x4f5b('0x25')]('['+_0x5a35dc[_0x4f5b('0x73')][_0x4f5b('0x74')]()+']',_0x4f5b('0x6d'));_0x5a35dc[_0x4f5b('0x5e')]=util['format'](_0x4f5b('0x5c'),_0x26518c['serverUrl'],_0x5a35dc[_0x4f5b('0x5d')],md5(_0x5a35dc['uniqueid']));}else{_0x5a35dc[_0x4f5b('0x5e')]='';}return getConnection(_0x26518c)[_0x4f5b('0x23')](function(_0x55c646){_0xecb28d=_0x55c646;if(!_[_0x4f5b('0x20')](_0x1de6fc)){return getUser(_0x26518c,_0x1de6fc['name'],_0xecb28d);}else{return getUser(_0x26518c,null,_0xecb28d);}})[_0x4f5b('0x23')](function(_0x97f25c){_0x45f103=_0x97f25c;return getEndUser(_0x26518c,_0x100189,_0x5a35dc['calleridname'],_0x5a35dc[_0x4f5b('0x75')],_0xecb28d);})[_0x4f5b('0x23')](function(_0x19524f){_0x351860=_0x19524f;return getTicket(_0x26518c,_0x45f103,_0x351860,_0x100189,_0x5a35dc,_0x100189[_0x4f5b('0x61')],_0xecb28d);})[_0x4f5b('0x23')](function(_0x129d2c){_0x21b3eb=_0x129d2c;logger[_0x4f5b('0x25')]('['+_0x5a35dc[_0x4f5b('0x73')][_0x4f5b('0x74')]()+_0x4f5b('0x76'),_0x21b3eb['id']);logger[_0x4f5b('0x25')]('['+_0x5a35dc[_0x4f5b('0x73')]['toUpperCase']()+_0x4f5b('0x77'),_0x26518c[_0x4f5b('0x3c')]);})[_0x4f5b('0x6a')](function(_0x25cfbc){logger[_0x4f5b('0x68')]('['+_0x5a35dc[_0x4f5b('0x73')][_0x4f5b('0x74')]()+']',_0x25cfbc);});}; \ No newline at end of file +var _0x0b0e=['lodash','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','contact','endUserType','lead','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','execute','then','length','Agent\x20%s\x20found.','Name','identity','user_id','display_name','info','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','Lead','find','account_contact_lead','additionalSearchAccount','additionalSearchLead','account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','includes','string','picklist','idField','content','toString','variable','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','%s/%s/e','error','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.'];(function(_0x56a1f2,_0x32bd5e){var _0x3250e4=function(_0x482d1c){while(--_0x482d1c){_0x56a1f2['push'](_0x56a1f2['shift']());}};_0x3250e4(++_0x32bd5e);}(_0x0b0e,0x78));var _0xe0b0=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x0b0e[_0x623e7];return _0x121131;};'use strict';var _=require(_0xe0b0('0x0'));var rp=require(_0xe0b0('0x1'));var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var md5=require(_0xe0b0('0x4'));var jsforce=require('jsforce');var util=require(_0xe0b0('0x5'));var Redis=require(_0xe0b0('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xe0b0('0x7'))('salesforce');config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config['redis'],{'host':_0xe0b0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe0b0('0x8')]));function emit(_0x148f19,_0x4ff8ec,_0x17b3fd){io['to'](_0x148f19)['emit'](_0x4ff8ec,_0x17b3fd);}function getTicket(_0x41a1aa,_0x25ce3e,_0x424491,_0x5b2644,_0x2d844a,_0x3d33cf,_0x4aa771,_0x504e76){var _0x252037=Object[_0xe0b0('0xb')]({},{'OwnerId':_0x25ce3e['id'],'Subject':intUtil[_0xe0b0('0xc')](_0x5b2644['Subjects'],_0x2d844a,'\x20'),'Description':intUtil[_0xe0b0('0xc')](_0x5b2644[_0xe0b0('0xd')],_0x2d844a,'\x0a')},getCustomFields(_0x3d33cf,_0x2d844a));if(_0x424491){if(_0x5b2644[_0xe0b0('0xe')]===_0xe0b0('0xf')){_0x252037[_0xe0b0('0x10')]=moment[_0xe0b0('0x11')]();_0x252037[_0xe0b0('0x12')]=![];_0x252037['IsRecurrence']=![];if(_0x424491['endUserType']===_0xe0b0('0x13')||_0x424491[_0xe0b0('0x14')]===_0xe0b0('0x15')){_0x252037['WhoId']=_0x424491['id'];}else if(_0x424491[_0xe0b0('0x14')]==='account'){_0x252037['WhatId']=_0x424491['id'];}}else if(_0x5b2644[_0xe0b0('0xe')]==='Case'){if(_0x424491['endUserType']==='contact'){_0x252037[_0xe0b0('0x16')]=_0x424491['id'];}else if(_0x424491[_0xe0b0('0x14')]==='account'){_0x252037[_0xe0b0('0x17')]=_0x424491['id'];}else if(_0x424491['endUserType']===_0xe0b0('0x15')&&_0x5b2644[_0xe0b0('0x18')]){_0x252037[_0x5b2644['leadId']]=_0x424491['id'];}else{logger['info'](_0xe0b0('0x19'));}}}return _0x4aa771[_0xe0b0('0x1a')](_0x5b2644[_0xe0b0('0xe')])['create'](_0x252037);}function getUser(_0x5964ff,_0x504bcd,_0x2e4bf0){if(!_[_0xe0b0('0x1b')](_0x504bcd)&&intUtil[_0xe0b0('0x1c')](_0x504bcd)){var _0x385691={'Email':_0x504bcd};var _0x2de4a9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2e4bf0[_0xe0b0('0x1a')]('User')['find'](_0x385691,_0x2de4a9)[_0xe0b0('0x1d')]()[_0xe0b0('0x1e')](function(_0xe933e){if(_0xe933e[_0xe0b0('0x1f')]){var _0x3779ae=_['find'](_0xe933e,function(_0x43506d){return _0x43506d['Email']===_0x504bcd;});if(_0x3779ae){logger['info'](_0xe0b0('0x20'),_0x504bcd);return BPromise['resolve']({'id':_0x3779ae['Id'],'name':_0x3779ae[_0xe0b0('0x21')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x504bcd);return _0x2e4bf0[_0xe0b0('0x22')]()[_0xe0b0('0x1e')](function(_0x20bdd1){return BPromise['resolve']({'id':_0x20bdd1[_0xe0b0('0x23')],'name':_0x20bdd1[_0xe0b0('0x24')]});});}});}else{logger[_0xe0b0('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x504bcd);return _0x2e4bf0[_0xe0b0('0x22')]()['then'](function(_0xc5a778){return BPromise[_0xe0b0('0x26')]({'id':_0xc5a778['user_id'],'name':_0xc5a778['display_name']});});}}function getEndUser(_0x15ca5f,_0x1e2c53,_0x4686f6,_0x27b349,_0xe6c35c){var _0x390a2c={'$or':{'Phone':_0x27b349}};var _0x4b2630={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe0b0('0x26')]()['then'](function(){logger[_0xe0b0('0x25')](_0xe0b0('0x27'),_0x27b349,_0x1e2c53[_0xe0b0('0x28')]);switch(_0x1e2c53['moduleSearch']){case'contact_lead':var _0x2d0241=_[_0xe0b0('0x29')](_0x390a2c);if(_0x1e2c53[_0xe0b0('0x2a')]){var _0x577921={};_0x577921[_0x1e2c53[_0xe0b0('0x2a')]]=_0x27b349;_[_0xe0b0('0x2b')](_0x2d0241[_0xe0b0('0x2c')],_0x577921);}return _0xe6c35c[_0xe0b0('0x1a')](_0xe0b0('0x2d'))['find'](_0x2d0241,_0x4b2630)[_0xe0b0('0x1d')]()[_0xe0b0('0x1e')](function(_0x11c14c){if(_0x11c14c&&_0x11c14c[_0xe0b0('0x1f')]){return _0x11c14c;}else{var _0x35968a=_[_0xe0b0('0x29')](_0x390a2c);if(_0x1e2c53['additionalSearchLead']){var _0x46c671={};_0x46c671[_0x1e2c53['additionalSearchLead']]=_0x27b349;_[_0xe0b0('0x2b')](_0x35968a['$or'],_0x46c671);}return _0xe6c35c[_0xe0b0('0x1a')](_0xe0b0('0x2e'))[_0xe0b0('0x2f')](_0x35968a,_0x4b2630);}});case _0xe0b0('0x30'):var _0x3fb5f4=_['cloneDeep'](_0x390a2c);if(_0x1e2c53[_0xe0b0('0x31')]){var _0x577921={};_0x577921[_0x1e2c53['additionalSearchAccount']]=_0x27b349;_['merge'](_0x3fb5f4[_0xe0b0('0x2c')],_0x577921);}return _0xe6c35c['sobject']('Account')[_0xe0b0('0x2f')](_0x3fb5f4,_0x4b2630)[_0xe0b0('0x1d')]()[_0xe0b0('0x1e')](function(_0x1d8acb){if(_0x1d8acb&&_0x1d8acb[_0xe0b0('0x1f')]){return _0x1d8acb;}else{var _0x4218f5=_[_0xe0b0('0x29')](_0x390a2c);if(_0x1e2c53[_0xe0b0('0x2a')]){var _0x50ad67={};_0x50ad67[_0x1e2c53[_0xe0b0('0x2a')]]=_0x27b349;_[_0xe0b0('0x2b')](_0x4218f5[_0xe0b0('0x2c')],_0x50ad67);}return _0xe6c35c[_0xe0b0('0x1a')](_0xe0b0('0x2d'))['find'](_0x4218f5,_0x4b2630)[_0xe0b0('0x1e')](function(_0x34f5fa){if(_0x34f5fa&&_0x34f5fa[_0xe0b0('0x1f')]){return _0x34f5fa;}else{var _0x2ea87f=_['cloneDeep'](_0x390a2c);if(_0x1e2c53['additionalSearchLead']){var _0x15e340={};_0x15e340[_0x1e2c53[_0xe0b0('0x32')]]=_0x27b349;_[_0xe0b0('0x2b')](_0x2ea87f[_0xe0b0('0x2c')],_0x15e340);}return _0xe6c35c[_0xe0b0('0x1a')](_0xe0b0('0x2e'))[_0xe0b0('0x2f')](_0x2ea87f,_0x4b2630);}});}});case _0xe0b0('0x13'):var _0x2d0241=_[_0xe0b0('0x29')](_0x390a2c);if(_0x1e2c53[_0xe0b0('0x2a')]){var _0x577921={};_0x577921[_0x1e2c53['additionalSearchContact']]=_0x27b349;_[_0xe0b0('0x2b')](_0x2d0241['$or'],_0x577921);}return _0xe6c35c[_0xe0b0('0x1a')](_0xe0b0('0x2d'))[_0xe0b0('0x2f')](_0x2d0241,_0x4b2630)[_0xe0b0('0x1d')]();case'lead':var _0x350b4e=_['cloneDeep'](_0x390a2c);if(_0x1e2c53[_0xe0b0('0x32')]){var _0x577921={};_0x577921[_0x1e2c53[_0xe0b0('0x32')]]=_0x27b349;_[_0xe0b0('0x2b')](_0x350b4e[_0xe0b0('0x2c')],_0x577921);}return _0xe6c35c[_0xe0b0('0x1a')]('Lead')['find'](_0x350b4e,_0x4b2630);case _0xe0b0('0x33'):var _0x3fb5f4=_[_0xe0b0('0x29')](_0x390a2c);if(_0x1e2c53[_0xe0b0('0x31')]){var _0x577921={};_0x577921[_0x1e2c53['additionalSearchAccount']]=_0x27b349;_[_0xe0b0('0x2b')](_0x3fb5f4[_0xe0b0('0x2c')],_0x577921);}return _0xe6c35c['sobject']('Account')['find'](_0x3fb5f4,_0x4b2630);default:return null;}})['then'](function(_0x5c048d){if(_0x5c048d&&_0x5c048d[_0xe0b0('0x1f')]){var _0x1072ba=_[_0xe0b0('0x34')](_0x5c048d);if(_0x1072ba){return BPromise[_0xe0b0('0x26')]({'id':_0x1072ba['Id'],'name':_0x1072ba[_0xe0b0('0x21')],'phone':_0x1072ba[_0xe0b0('0x35')],'endUserType':_0x1072ba[_0xe0b0('0x36')][_0xe0b0('0x37')][_0xe0b0('0x38')]()});}}})[_0xe0b0('0x1e')](function(_0x2f8d5b){if(_0x2f8d5b){logger['info'](_0xe0b0('0x39'),_0x2f8d5b[_0xe0b0('0x14')],_0x27b349);return BPromise[_0xe0b0('0x26')](_0x2f8d5b);}else{logger[_0xe0b0('0x25')](_0xe0b0('0x3a'),_0x27b349);var _0x360cd6={'Phone':_0x27b349};if(_0x1e2c53['moduleCreate']){if(_0x1e2c53['moduleCreate']===_0xe0b0('0x13')){logger['info'](_0xe0b0('0x3b'),_0x27b349,_0x1e2c53[_0xe0b0('0x3c')]);_0x360cd6[_0xe0b0('0x3d')]=_0x4686f6!==_0xe0b0('0x3e')?_0x4686f6:util[_0xe0b0('0x3f')](_0xe0b0('0x40'),_0x27b349);}else if(_0x1e2c53[_0xe0b0('0x3c')]===_0xe0b0('0x15')){logger[_0xe0b0('0x25')](_0xe0b0('0x3b'),_0x27b349,_0x1e2c53[_0xe0b0('0x3c')]);_0x360cd6[_0xe0b0('0x3d')]=_0x4686f6!==_0xe0b0('0x3e')?_0x4686f6:util[_0xe0b0('0x3f')](_0xe0b0('0x40'),_0x27b349);_0x360cd6['Company']=_0xe0b0('0x41');}else if(_0x1e2c53[_0xe0b0('0x3c')]===_0xe0b0('0x33')){logger[_0xe0b0('0x25')](_0xe0b0('0x3b'),_0x27b349,_0x1e2c53[_0xe0b0('0x3c')]);_0x360cd6['Name']=_0x4686f6!==_0xe0b0('0x3e')?_0x4686f6:util[_0xe0b0('0x3f')](_0xe0b0('0x40'),_0x27b349);}else{return null;}}return _0xe6c35c[_0xe0b0('0x1a')](_[_0xe0b0('0x42')](_0x1e2c53[_0xe0b0('0x3c')]))['create'](_0x360cd6)[_0xe0b0('0x1e')](function(_0x20ae6a){return BPromise[_0xe0b0('0x26')]({'id':_0x20ae6a['id'],'endUserType':_0x1e2c53[_0xe0b0('0x3c')]});});}});}function getCustomFields(_0x31ab34,_0x8c56d0){var _0x41a7f6={};if(_0x31ab34['length']>0x0){_['forEach'](_0x31ab34,function(_0x42d866){if(_[_0xe0b0('0x43')]([_0xe0b0('0x44'),_0xe0b0('0x45')],_0x42d866['type'])&&_0x42d866[_0xe0b0('0x46')]){_0x41a7f6[_0x42d866[_0xe0b0('0x46')]]=_0x42d866[_0xe0b0('0x47')][_0xe0b0('0x48')]();}else if(_0x42d866[_0xe0b0('0x37')]===_0xe0b0('0x49')&&_0x42d866['variableName']&&_0x42d866[_0xe0b0('0x46')]){_0x8c56d0[_0x42d866['variableName']]&&(_0x41a7f6[_0x42d866[_0xe0b0('0x46')]]=_0x8c56d0[_0x42d866['variableName']][_0xe0b0('0x48')]());}else if(_0x42d866[_0xe0b0('0x37')]===_0xe0b0('0x4a')&&_0x42d866[_0xe0b0('0x4b')]&&_0x42d866['Variable'][_0xe0b0('0x4c')]&&_0x42d866[_0xe0b0('0x46')]){_0x8c56d0[_0x42d866['Variable'][_0xe0b0('0x4c')]['toLowerCase']()]&&(_0x41a7f6[_0x42d866[_0xe0b0('0x46')]]=_0x8c56d0[_0x42d866[_0xe0b0('0x4b')][_0xe0b0('0x4c')][_0xe0b0('0x38')]()][_0xe0b0('0x48')]());}});}return _0x41a7f6;}function getConnection(_0x5a900d){var _0x4aa414=_0x5a900d[_0xe0b0('0x4d')][_0xe0b0('0x4e')](_0x5a900d[_0xe0b0('0x4f')]);var _0x863ad8=new jsforce[(_0xe0b0('0x50'))]({'oauth2':{'loginUrl':_0x5a900d['remoteUri']||_0xe0b0('0x51'),'clientId':_0x5a900d['clientId'],'clientSecret':_0x5a900d[_0xe0b0('0x52')]}});return _0x863ad8[_0xe0b0('0x53')](_0x5a900d[_0xe0b0('0x54')],_0x4aa414)['then'](function(){logger[_0xe0b0('0x25')](_0xe0b0('0x55'));return _0x863ad8;});}exports[_0xe0b0('0x56')]=function(_0x17d321,_0x55244b,_0x488d3a,_0x3f3a7c,_0x1fbef0,_0x18653c){var _0x5919a9,_0x1928bc,_0x47b984,_0x591072;_0x18653c[_0xe0b0('0x57')]=intUtil[_0xe0b0('0x58')](_0x18653c[_0xe0b0('0x57')]);_0x18653c[_0xe0b0('0x59')]=intUtil[_0xe0b0('0x58')](_0x18653c[_0xe0b0('0x59')]);if(_0x1fbef0&&_0x1fbef0[_0xe0b0('0x5a')]){logger[_0xe0b0('0x25')](_0xe0b0('0x5b'),_0xe0b0('0x5c'));_0x55244b['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x18653c[_0xe0b0('0x57')],_0x55244b['uniqueid'],md5(_0x55244b[_0xe0b0('0x5d')]));}else{_0x55244b['recordingURL']='';}return getConnection(_0x18653c)[_0xe0b0('0x1e')](function(_0x466c33){_0x591072=_0x466c33;return getUser(_0x18653c,_0x3f3a7c[_0xe0b0('0x5e')],_0x591072);})[_0xe0b0('0x1e')](function(_0x157303){_0x5919a9=_0x157303;return getEndUser(_0x18653c,_0x488d3a,_0x55244b[_0xe0b0('0x5f')],_0x55244b[_0xe0b0('0x60')],_0x591072);})['then'](function(_0x5b1abd){_0x1928bc=_0x5b1abd;return getTicket(_0x18653c,_0x5919a9,_0x1928bc,_0x488d3a,_0x55244b,_0x488d3a[_0xe0b0('0x61')],_0x591072,_0xe0b0('0x56'));})[_0xe0b0('0x1e')](function(_0x1653f8){_0x47b984=_0x1653f8;logger[_0xe0b0('0x25')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x47b984['id']);logger[_0xe0b0('0x25')](_0xe0b0('0x62'),_0x47b984['id'],_0x3f3a7c[_0xe0b0('0x4c')],_0x18653c[_0xe0b0('0x37')]);switch(_0x18653c[_0xe0b0('0x37')]){case _0xe0b0('0x63'):emit(util[_0xe0b0('0x3f')](_0xe0b0('0x64'),_0x3f3a7c[_0xe0b0('0x4c')]),_0xe0b0('0x65'),{'recordId':_0x47b984['id']});break;case _0xe0b0('0x66'):emit(util[_0xe0b0('0x3f')](_0xe0b0('0x64'),_0x3f3a7c[_0xe0b0('0x4c')]),'trigger:browser:url',{'uri':util[_0xe0b0('0x3f')]('%s/%s/e',_0x591072['instanceUrl'],_0x47b984['id'])});break;default:logger['error'](_0xe0b0('0x67'));}})[_0xe0b0('0x68')](function(_0x3983e7){logger['error']('[QUEUE]',_0x3983e7);});};exports[_0xe0b0('0x69')]=function(_0x387e1f,_0x32804e,_0x381326,_0x377e3d,_0x1976a9,_0x4e7742,_0x261623){var _0x10ff92,_0x5bc00d,_0x5e5b87,_0x2bb073;_0x4e7742[_0xe0b0('0x57')]=intUtil['stripTrailingSlash'](_0x4e7742['serverUrl']);_0x4e7742['remoteUri']=intUtil['stripTrailingSlash'](_0x4e7742['remoteUri']);if(_0x261623&&_0x261623[_0xe0b0('0x6a')]&&_0x261623[_0xe0b0('0x6a')]!==_0xe0b0('0x6b')){logger[_0xe0b0('0x25')](_0xe0b0('0x6c'),_0xe0b0('0x5c'));_0x32804e[_0xe0b0('0x6d')]=util[_0xe0b0('0x3f')](_0xe0b0('0x6e'),_0x4e7742[_0xe0b0('0x57')],_0x32804e['uniqueid'],md5(_0x32804e[_0xe0b0('0x5d')]));}return getConnection(_0x4e7742)[_0xe0b0('0x1e')](function(_0x415cf6){_0x2bb073=_0x415cf6;return getUser(_0x4e7742,_0x377e3d['email'],_0x2bb073);})[_0xe0b0('0x1e')](function(_0x416d98){_0x10ff92=_0x416d98;return getEndUser(_0x4e7742,_0x381326,_0x32804e[_0xe0b0('0x6f')],_0x32804e['destcalleridnum'],_0x2bb073);})['then'](function(_0x23d809){_0x5bc00d=_0x23d809;return getTicket(_0x4e7742,_0x10ff92,_0x5bc00d,_0x381326,_0x32804e,_0x381326[_0xe0b0('0x61')],_0x2bb073,_0xe0b0('0x69'));})['then'](function(_0x2a1109){_0x5e5b87=_0x2a1109;logger[_0xe0b0('0x25')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5e5b87['id']);logger[_0xe0b0('0x25')](_0xe0b0('0x70'),_0x5e5b87['id'],_0x377e3d[_0xe0b0('0x4c')],_0x4e7742[_0xe0b0('0x37')]);switch(_0x4e7742[_0xe0b0('0x37')]){case _0xe0b0('0x63'):emit(util[_0xe0b0('0x3f')](_0xe0b0('0x64'),_0x377e3d[_0xe0b0('0x4c')]),'trigger:salesforce:display',{'recordId':_0x5e5b87['id']});break;case _0xe0b0('0x66'):emit(util['format']('user:%s',_0x377e3d[_0xe0b0('0x4c')]),_0xe0b0('0x71'),{'uri':util[_0xe0b0('0x3f')](_0xe0b0('0x72'),_0x2bb073['instanceUrl'],_0x5e5b87['id'])});break;default:logger[_0xe0b0('0x73')]('[OUTBOUND]',_0xe0b0('0x74'));}})[_0xe0b0('0x68')](function(_0x490d6b){logger[_0xe0b0('0x73')](_0xe0b0('0x6c'),_0x490d6b);});};exports['unmanaged']=function(_0x2558d8,_0x561e3f,_0x1e3a9f,_0x183e72,_0x32f597,_0x3238df){var _0x51b787,_0x220b87,_0x59c75c,_0x14b282;_0x3238df[_0xe0b0('0x57')]=intUtil[_0xe0b0('0x58')](_0x3238df[_0xe0b0('0x57')]);_0x3238df[_0xe0b0('0x59')]=intUtil[_0xe0b0('0x58')](_0x3238df[_0xe0b0('0x59')]);if(_0x32f597&&_0x32f597[_0xe0b0('0x5a')]){logger['info']('['+_0x561e3f[_0xe0b0('0x75')][_0xe0b0('0x76')]()+']',_0xe0b0('0x5c'));_0x561e3f['recordingURL']=util[_0xe0b0('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3238df['serverUrl'],_0x561e3f['uniqueid'],md5(_0x561e3f[_0xe0b0('0x5d')]));}else{_0x561e3f['recordingURL']='';}return getConnection(_0x3238df)[_0xe0b0('0x1e')](function(_0x3828ab){_0x14b282=_0x3828ab;if(!_[_0xe0b0('0x1b')](_0x183e72)){return getUser(_0x3238df,_0x183e72[_0xe0b0('0x4c')],_0x14b282);}else{return getUser(_0x3238df,null,_0x14b282);}})[_0xe0b0('0x1e')](function(_0x2cf890){_0x51b787=_0x2cf890;return getEndUser(_0x3238df,_0x1e3a9f,_0x561e3f[_0xe0b0('0x5f')],_0x561e3f['calleridnum'],_0x14b282);})[_0xe0b0('0x1e')](function(_0x9598a5){_0x220b87=_0x9598a5;return getTicket(_0x3238df,_0x51b787,_0x220b87,_0x1e3a9f,_0x561e3f,_0x1e3a9f[_0xe0b0('0x61')],_0x14b282);})['then'](function(_0x4a08c1){_0x59c75c=_0x4a08c1;logger[_0xe0b0('0x25')]('['+_0x561e3f['lastevent'][_0xe0b0('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x59c75c['id']);logger[_0xe0b0('0x25')]('['+_0x561e3f[_0xe0b0('0x75')][_0xe0b0('0x76')]()+_0xe0b0('0x77'),_0x3238df['type']);})[_0xe0b0('0x68')](function(_0x312058){logger[_0xe0b0('0x73')]('['+_0x561e3f[_0xe0b0('0x75')][_0xe0b0('0x76')]()+']',_0x312058);});}; \ 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 8d88a8a..bf3205b 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 _0x2b33=['],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','toString','includes','idField','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','user:%s','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail'];(function(_0x36ad4f,_0x43277e){var _0x1094e8=function(_0x55a216){while(--_0x55a216){_0x36ad4f['push'](_0x36ad4f['shift']());}};_0x1094e8(++_0x43277e);}(_0x2b33,0xb9));var _0x32b3=function(_0x5f1a0f,_0x3b7056){_0x5f1a0f=_0x5f1a0f-0x0;var _0xa2eaf8=_0x2b33[_0x5f1a0f];return _0xa2eaf8;};'use strict';var _=require(_0x32b3('0x0'));var Promise=require(_0x32b3('0x1'));var rp=require(_0x32b3('0x2'));var util=require(_0x32b3('0x3'));var md5=require('md5');var Redis=require(_0x32b3('0x4'));var intUtil=require(_0x32b3('0x5'));var config=require(_0x32b3('0x6'));var logger=require('../../../../config/logger')('servicenow');config[_0x32b3('0x7')]=_[_0x32b3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32b3('0x9'))(new Redis(config[_0x32b3('0x7')]));function getAdminUser(_0x1d6bac,_0xafdf2e,_0x5425e9,_0x154b08,_0xe7b63b,_0x34a75b){return new Promise(function(_0x295ed6,_0x449ea3){var _0x2f1ec1={'method':_0x32b3('0xa'),'uri':_0x154b08+_0x32b3('0xb')+'&'+_0xe7b63b+'&'+_0x34a75b,'auth':_0xafdf2e,'json':!![]};return rp(_0x2f1ec1)[_0x32b3('0xc')](function(_0x495157){if(_0x495157[_0x32b3('0xd')][_0x32b3('0xe')]>0x0){_0x5425e9[_0x32b3('0xf')]=_0x495157[_0x32b3('0xd')][0x0][_0x32b3('0x10')];}logger['info']('['+[_0x1d6bac[_0x32b3('0x11')]()]+'],\x20getAdminUser\x20crm',_0x5425e9);_0x295ed6(_0x5425e9);})[_0x32b3('0x12')](function(_0x395687){logger[_0x32b3('0x13')]('['+[_0x1d6bac[_0x32b3('0x11')]()]+']',_0x395687[_0x32b3('0x14')]);_0x449ea3(_0x395687[_0x32b3('0x14')]);});});}function getUser(_0x47fb27,_0x31cdab,_0x5ed014,_0x3deaab,_0x59ef0d){return function(_0x448638){logger[_0x32b3('0x15')]('['+[_0x47fb27[_0x32b3('0x11')]()]+_0x32b3('0x16'),_0x448638);return new Promise(function(_0x15db79,_0xd85ebd){if(intUtil[_0x32b3('0x17')](_0x448638[_0x32b3('0x18')])){var _0x1d512f={'method':'GET','uri':_0x5ed014+'sys_user?sysparm_query=email%3D'+_0x448638['userEmail']+'&'+_0x3deaab+'&'+_0x59ef0d,'auth':_0x31cdab,'json':!![]};logger[_0x32b3('0x15')]('['+[_0x47fb27[_0x32b3('0x11')]()]+_0x32b3('0x19'),_0x1d512f);return rp(_0x1d512f)[_0x32b3('0xc')](function(_0x3b34d6){logger[_0x32b3('0x15')]('['+[_0x47fb27[_0x32b3('0x11')]()]+_0x32b3('0x1a'),_0x3b34d6);if(_0x3b34d6['result'][_0x32b3('0xe')]>0x0&&String(_0x3b34d6[_0x32b3('0xd')][0x0][_0x32b3('0x1b')])===_0x32b3('0x1c')){_0x448638[_0x32b3('0x1d')]=_0x3b34d6[_0x32b3('0xd')][0x0][_0x32b3('0x10')];}else{_0x448638[_0x32b3('0x1d')]=_0x448638[_0x32b3('0xf')];_0x448638[_0x32b3('0x18')]=_0x448638['adminEmail'];}logger[_0x32b3('0x15')]('['+[_0x47fb27['toUpperCase']()]+_0x32b3('0x1e'),_0x448638);_0x15db79(_0x448638);})[_0x32b3('0x12')](function(_0x2d5a88){logger[_0x32b3('0x13')]('['+[_0x47fb27['toUpperCase']()]+']',_0x2d5a88[_0x32b3('0x14')]);_0xd85ebd(_0x2d5a88[_0x32b3('0x14')]);});}else{logger[_0x32b3('0x15')]('['+[_0x47fb27[_0x32b3('0x11')]()]+_0x32b3('0x1f'));_0x448638[_0x32b3('0x1d')]=_0x448638['adminId'];_0x448638['userEmail']=_0x448638[_0x32b3('0x20')];_0x15db79(_0x448638);}});};}function createEndUser(_0x1b106e,_0xea94ec,_0xcf397c,_0x166c17,_0x3448b6){logger['info']('['+[_0x1b106e[_0x32b3('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0xcf397c);return new Promise(function(_0x4be95e,_0x31262b){var _0x1b3bf8={'method':_0x32b3('0x21'),'uri':_0x166c17+_0x32b3('0x22')+_0x3448b6,'body':{'user_name':_0xcf397c[_0x32b3('0x23')],'roles':'user','first_name':_0xcf397c[_0x32b3('0x23')],'active':_0x32b3('0x1c'),'date_format':_0x32b3('0x24'),'phone':_0xcf397c[_0x32b3('0x23')]},'auth':_0xea94ec,'json':!![]};return rp(_0x1b3bf8)['then'](function(_0x5ca1a1){logger['info']('['+[_0x1b106e[_0x32b3('0x11')]()]+_0x32b3('0x25'),_0x5ca1a1[_0x32b3('0xd')]);_0xcf397c[_0x32b3('0x26')]=_0x5ca1a1[_0x32b3('0xd')]['sys_id'];_0x4be95e(_0xcf397c);})[_0x32b3('0x12')](function(_0x4eb55c){logger[_0x32b3('0x13')]('['+[_0x1b106e[_0x32b3('0x11')]()]+']',_0x4eb55c[_0x32b3('0x14')]);_0x31262b(_0x4eb55c[_0x32b3('0x14')]);});});}function getEndUser(_0x3f8cfa,_0xa74b7,_0xaea745,_0x50f462,_0x2c4845){return function(_0x36f857){logger['info']('['+[_0x3f8cfa[_0x32b3('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x36f857);return new Promise(function(_0x485537,_0x3ce94b){var _0x475597={'method':'GET','uri':_0xaea745+_0x32b3('0x27')+_0x36f857[_0x32b3('0x23')]+'&'+_0x50f462+'&'+_0x2c4845,'auth':_0xa74b7,'json':!![]};return rp(_0x475597)[_0x32b3('0xc')](function(_0x500ac8){if(_0x500ac8[_0x32b3('0xd')]['length']>0x0){_0x36f857['endUserId']=_0x500ac8[_0x32b3('0xd')][0x0][_0x32b3('0x10')];logger['info']('['+[_0x3f8cfa[_0x32b3('0x11')]()]+_0x32b3('0x28'),_0x36f857);_0x485537(_0x36f857);}else{return createEndUser(_0x3f8cfa,_0xa74b7,_0x36f857,_0xaea745,_0x50f462)['then'](function(_0x367286){logger[_0x32b3('0x15')]('['+[_0x3f8cfa[_0x32b3('0x11')]()]+_0x32b3('0x29'),_0x367286);_0x485537(_0x367286);});}})[_0x32b3('0x12')](function(_0x1ad3a0){logger[_0x32b3('0x13')]('['+[_0x3f8cfa[_0x32b3('0x11')]()]+']',_0x1ad3a0[_0x32b3('0x14')]);_0x3ce94b(_0x1ad3a0[_0x32b3('0x14')]);});});};}function getCustomFields(_0x3d8ac4,_0x18414f){var _0x44d3c5={};if(_0x3d8ac4[_0x32b3('0xe')]>0x0){_[_0x32b3('0x2a')](_0x3d8ac4,function(_0x25ac8b){if(_['includes']([_0x32b3('0x2b'),_0x32b3('0x2c')],_0x25ac8b[_0x32b3('0x2d')])&&_0x25ac8b[_0x32b3('0x2e')]&&!_0x25ac8b[_0x32b3('0x2f')]){_0x44d3c5[_0x25ac8b[_0x32b3('0x2e')][_0x32b3('0x30')]()]=_0x25ac8b['content'][_0x32b3('0x31')]();}else if(_[_0x32b3('0x32')]([_0x32b3('0x2b'),_0x32b3('0x2c')],_0x25ac8b['type'])&&_0x25ac8b['idField']&&_0x25ac8b['customField']){_0x44d3c5[_0x25ac8b[_0x32b3('0x33')][_0x32b3('0x30')]()]=_0x25ac8b['content'][_0x32b3('0x31')]();}else if(_0x25ac8b['type']===_0x32b3('0x34')&&_0x25ac8b[_0x32b3('0x35')]&&_0x25ac8b[_0x32b3('0x33')]&&_0x25ac8b[_0x32b3('0x2f')]){_0x44d3c5[_0x25ac8b[_0x32b3('0x33')][_0x32b3('0x30')]()]=_0x18414f[_0x25ac8b[_0x32b3('0x35')]]['toString']();}else if(_0x25ac8b['type']===_0x32b3('0x36')&&_0x25ac8b[_0x32b3('0x37')]&&_0x25ac8b[_0x32b3('0x37')][_0x32b3('0x38')]&&_0x25ac8b[_0x32b3('0x33')]&&_0x25ac8b[_0x32b3('0x2f')]){_0x44d3c5[_0x25ac8b[_0x32b3('0x33')][_0x32b3('0x30')]()]=_0x18414f[_0x25ac8b[_0x32b3('0x37')][_0x32b3('0x38')]['toLowerCase']()][_0x32b3('0x31')]();}});}return _0x44d3c5;}function getTicket(_0x15a54d,_0x5e767b,_0x4047d5,_0xafd543,_0xd25353,_0x2eb29){return function(_0x4c6c82){logger[_0x32b3('0x15')]('['+[_0x15a54d[_0x32b3('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x4c6c82);return new Promise(function(_0x202c8c,_0x341b49){var _0xe2ef6e=_0x15a54d[_0x32b3('0x30')]()===_0x32b3('0x39')?_0x4c6c82['userId']:_0x4c6c82[_0x32b3('0x26')];var _0x27c8a9={'method':_0x32b3('0x21'),'uri':_0x4047d5+_0x32b3('0x3a')+'?'+_0x2eb29,'body':Object[_0x32b3('0x3b')]({},{'active':_0x32b3('0x1c'),'caller_id':_0xe2ef6e,'assigned_to':_0x4c6c82['userId'],'short_description':intUtil[_0x32b3('0x3c')](_0xafd543[_0x32b3('0x3d')],_0xd25353,'\x20'),'description':intUtil[_0x32b3('0x3c')](_0xafd543[_0x32b3('0x3e')],_0xd25353,'\x0a')},getCustomFields(_0xafd543['Fields'],_0xd25353)),'auth':_0x5e767b,'json':!![]};return rp(_0x27c8a9)[_0x32b3('0xc')](function(_0x1a8604){logger[_0x32b3('0x15')]('['+[_0x15a54d['toUpperCase']()]+_0x32b3('0x3f'),_0x1a8604['result']);_0x4c6c82[_0x32b3('0x40')]=_0x1a8604[_0x32b3('0xd')][_0x32b3('0x10')];_0x4c6c82[_0x32b3('0x41')]=_0x1a8604['result'][_0x32b3('0x42')];logger['info']('['+[_0x15a54d[_0x32b3('0x11')]()]+']\x20getTicket\x20crm',_0x4c6c82);_0x202c8c(_0x4c6c82);})['catch'](function(_0x32469c){logger[_0x32b3('0x13')]('['+[_0x15a54d[_0x32b3('0x11')]()]+']',_0x32469c[_0x32b3('0x14')]);_0x341b49(_0x32469c[_0x32b3('0x14')]);});});};}function createRemoteTag(_0x2a0099,_0x3b2a32,_0x19caf7,_0x317905){return new Promise(function(_0x3caee0,_0x112c25){var _0x42a267={'method':_0x32b3('0x21'),'uri':_0x19caf7+'label'+'?'+_0x317905,'body':{'short_description':_0x2a0099,'global':!![],'active':!![],'name':_0x2a0099},'auth':_0x3b2a32,'json':!![]};return rp(_0x42a267)[_0x32b3('0xc')](function(_0x16ee80){var _0x2b0eae=_0x16ee80['result'][_0x32b3('0x10')];_0x3caee0(_0x2b0eae);});});}function getRemoteTag(_0x8e71d1,_0x3870db,_0x25d191,_0x49d28b,_0x263dbf){return new Promise(function(_0x352185,_0x1453be){var _0x24fbf9={'method':'GET','uri':_0x25d191+_0x32b3('0x43')+_0x32b3('0x44')+_0x8e71d1+'&'+_0x49d28b,'auth':_0x3870db,'json':!![]};return rp(_0x24fbf9)[_0x32b3('0xc')](function(_0x594bf2){if(_0x594bf2[_0x32b3('0xd')]['length']>0x0){var _0x38a1f5=_0x594bf2[_0x32b3('0xd')][0x0][_0x32b3('0x10')];_0x352185(_0x38a1f5);}else{return createRemoteTag(_0x8e71d1,_0x3870db,_0x25d191,_0x49d28b)[_0x32b3('0xc')](function(_0x3d147c){_0x352185(_0x3d147c);});}});});}function assignTagToIncident(_0x338bab,_0xb8e4e6,_0x55884a,_0x598ab7,_0x3bd97d){return new Promise(function(_0x1f08a4,_0x8976fa){var _0x11d31b={'method':'POST','uri':_0x55884a+_0x32b3('0x45')+'?'+_0x3bd97d,'body':{'label':_0x338bab,'table':_0x32b3('0x3a'),'id_type':_0x32b3('0x46'),'table_key':_0x598ab7[_0x32b3('0x40')],'title':_0x32b3('0x47')+_0x598ab7[_0x32b3('0x41')],'id_display':_0x598ab7[_0x32b3('0x41')]},'auth':_0xb8e4e6,'json':!![]};return rp(_0x11d31b)[_0x32b3('0xc')](function(_0x94504c){_0x1f08a4();})[_0x32b3('0x12')](function(){_0x1f08a4();});});}function manageTags(_0x91e5ad,_0x501e94,_0x2eabec,_0x50395f,_0x4d956f,_0x1c1013,_0x5c7dda){return new Promise(function(_0x4de7b1,_0x8970e5){var _0x83887a=[];_0x501e94[_0x32b3('0x2a')](function(_0x10f1fa){_0x83887a[_0x32b3('0x48')](getRemoteTag(_0x10f1fa,_0x2eabec,_0x50395f,_0x1c1013,_0x5c7dda));});return Promise[_0x32b3('0x49')](_0x83887a)[_0x32b3('0xc')](function(_0x3894ca){if(_0x3894ca['length']){logger['info']('['+[_0x91e5ad['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x3894ca);var _0x129782=[];_0x3894ca[_0x32b3('0x2a')](function(_0x1b0521){_0x129782[_0x32b3('0x48')](assignTagToIncident(_0x1b0521,_0x2eabec,_0x50395f,_0x4d956f,_0x1c1013));});return Promise[_0x32b3('0x49')](_0x129782)[_0x32b3('0xc')](function(){_0x4de7b1();})[_0x32b3('0x12')](function(){_0x4de7b1();});}else{_0x4de7b1();}});});}function getTags(_0x283add,_0x44bf8f,_0x375843,_0x88c780,_0x4ef3b2,_0x4f0f03){return function(_0x4904cb){return new Promise(function(_0x41ead2,_0x32e128){var _0x1c1734=[];var _0x5d198c=_0x88c780['Tags'];if(_0x5d198c&&_0x5d198c[_0x32b3('0xe')]>0x0){_0x1c1734=_[_0x32b3('0x4a')](_0x5d198c,_0x32b3('0x38'));}if(_0x1c1734['length']>0x0){return manageTags(_0x283add,_0x1c1734,_0x44bf8f,_0x375843,_0x4904cb,_0x4ef3b2,_0x4f0f03)[_0x32b3('0xc')](function(){_0x41ead2(_0x4904cb);});}else{_0x41ead2(_0x4904cb);}});};}function emit(_0xada5df,_0x2d4476,_0x459de4){var _0x889d54=_0x32b3('0x4b')+_0x32b3('0x4c')+_0x32b3('0x4d')+'%255EORDERBYDESCnumber';var _0x22f626={'uri':_0xada5df+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x459de4+_0x889d54};io['to'](util['format'](_0x32b3('0x4e'),_0x2d4476))['emit'](_0x32b3('0x4f'),_0x22f626);}exports['cs']=function(_0x4a9b7a,_0x35aef6,_0x583f80,_0xe0585a,_0x3477f9,_0xd05301,_0x28735d,_0x1b34f3){var _0x448386={};var _0x505f1b={'user':_0xd05301['username'],'pass':_0xd05301[_0x32b3('0x50')]};var _0x327c3a=_0x32b3('0x51');var _0x4b4ef2=_0x32b3('0x52');_0xd05301[_0x32b3('0x53')]=intUtil[_0x32b3('0x54')](_0xd05301[_0x32b3('0x53')]);_0xd05301[_0x32b3('0x55')]=intUtil[_0x32b3('0x54')](_0xd05301['serverUrl']);var _0x5436d3=util[_0x32b3('0x56')](_0x32b3('0x57'),_0xd05301[_0x32b3('0x53')]);_0x448386['userEmail']=!_['isNil'](_0xe0585a)?_0xe0585a[_0x32b3('0x58')]:null;_0x448386['adminEmail']=_0xd05301[_0x32b3('0x58')];_0x448386[_0x32b3('0x23')]=_0x1b34f3[_0x32b3('0x30')]()===_0x32b3('0x39')?_0x35aef6[_0x32b3('0x59')]:_0x35aef6[_0x32b3('0x5a')];_0x448386[_0x32b3('0x5b')]=_0x1b34f3===_0x32b3('0x5c')||_0x1b34f3===_0x32b3('0x5d')?_0x32b3('0x5c'):_0x32b3('0x39');var _0x4ab220=util[_0x32b3('0x56')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd05301[_0x32b3('0x55')],_0x35aef6[_0x32b3('0x5e')],md5(_0x35aef6[_0x32b3('0x5e')]));if(_0x3477f9&&_0x3477f9[_0x32b3('0x5f')]){logger[_0x32b3('0x15')]('[QUEUE]','Recording\x20is\x20enabled!');_0x35aef6[_0x32b3('0x60')]=_0x4ab220;}else if(_0x28735d&&_0x28735d[_0x32b3('0x61')]&&_0x28735d[_0x32b3('0x61')]!==_0x32b3('0x62')){logger['info'](_0x32b3('0x63'),'Recording\x20is\x20enabled!');_0x35aef6[_0x32b3('0x60')]=_0x4ab220;}else{_0x35aef6[_0x32b3('0x60')]='';}return getAdminUser(_0x1b34f3,_0x505f1b,_0x448386,_0x5436d3,_0x4b4ef2,_0x327c3a)[_0x32b3('0xc')](getUser(_0x1b34f3,_0x505f1b,_0x5436d3,_0x4b4ef2,_0x327c3a))[_0x32b3('0xc')](getEndUser(_0x1b34f3,_0x505f1b,_0x5436d3,_0x4b4ef2,_0x327c3a))[_0x32b3('0xc')](getTicket(_0x1b34f3,_0x505f1b,_0x5436d3,_0x583f80,_0x35aef6,_0x4b4ef2))[_0x32b3('0xc')](function(_0x20b84a){logger['info'](util[_0x32b3('0x56')](_0x32b3('0x64'),_0x20b84a[_0x32b3('0x40')]));logger[_0x32b3('0x15')](util[_0x32b3('0x56')](_0x32b3('0x65'),_0x1b34f3));if(_0x1b34f3!==_0x32b3('0x5d')){logger[_0x32b3('0x15')]('['+[_0x1b34f3[_0x32b3('0x11')]()]+']',_0x32b3('0x66'));emit(_0xd05301[_0x32b3('0x53')],_0xe0585a['name'],_0x20b84a[_0x32b3('0x40')]);}})['catch'](function(_0x2abd1d){logger[_0x32b3('0x13')]('['+[_0x1b34f3[_0x32b3('0x11')]()]+_0x32b3('0x67'),util[_0x32b3('0x68')](_0x2abd1d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb944=['customVariable','Variable','name','outbound','assign','Subjects','getString','Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20Error\x20running\x20ServiceNow\x20integration','request-promise','util','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','true','adminEmail','],\x20getUser\x20crm','userId','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName'];(function(_0x140463,_0x352243){var _0x57847c=function(_0xf473c1){while(--_0xf473c1){_0x140463['push'](_0x140463['shift']());}};_0x57847c(++_0x352243);}(_0xb944,0x168));var _0x4b94=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0xb944[_0x4ec9e3];return _0x2883ce;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x4b94('0x0'));var util=require(_0x4b94('0x1'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x4b94('0x2'));var config=require(_0x4b94('0x3'));var logger=require('../../../../config/logger')(_0x4b94('0x4'));config[_0x4b94('0x5')]=_[_0x4b94('0x6')](config[_0x4b94('0x5')],{'host':_0x4b94('0x7'),'port':0x18eb});var io=require(_0x4b94('0x8'))(new Redis(config['redis']));function getAdminUser(_0x7a7ca9,_0x20ca2e,_0x3263ba,_0x498fd1,_0x5bdc14,_0x703bc5){return new Promise(function(_0x571925,_0x2648c5){var _0x4937b8={'method':'GET','uri':_0x498fd1+_0x4b94('0x9')+'&'+_0x5bdc14+'&'+_0x703bc5,'auth':_0x20ca2e,'json':!![]};return rp(_0x4937b8)[_0x4b94('0xa')](function(_0x5c48d9){if(_0x5c48d9[_0x4b94('0xb')]['length']>0x0){_0x3263ba[_0x4b94('0xc')]=_0x5c48d9[_0x4b94('0xb')][0x0][_0x4b94('0xd')];}logger[_0x4b94('0xe')]('['+[_0x7a7ca9[_0x4b94('0xf')]()]+_0x4b94('0x10'),_0x3263ba);_0x571925(_0x3263ba);})[_0x4b94('0x11')](function(_0x52044a){logger[_0x4b94('0x12')]('['+[_0x7a7ca9['toUpperCase']()]+']',_0x52044a[_0x4b94('0x13')]);_0x2648c5(_0x52044a[_0x4b94('0x13')]);});});}function getUser(_0x368702,_0x558dc1,_0x191773,_0x3152b1,_0x59febd){return function(_0x5c6c13){logger['info']('['+[_0x368702['toUpperCase']()]+_0x4b94('0x14'),_0x5c6c13);return new Promise(function(_0x4e414a,_0x14a072){if(intUtil[_0x4b94('0x15')](_0x5c6c13[_0x4b94('0x16')])){var _0x15df8c={'method':_0x4b94('0x17'),'uri':_0x191773+_0x4b94('0x18')+_0x5c6c13[_0x4b94('0x16')]+'&'+_0x3152b1+'&'+_0x59febd,'auth':_0x558dc1,'json':!![]};logger[_0x4b94('0xe')]('['+[_0x368702[_0x4b94('0xf')]()]+_0x4b94('0x19'),_0x15df8c);return rp(_0x15df8c)[_0x4b94('0xa')](function(_0x90d6a3){logger[_0x4b94('0xe')]('['+[_0x368702[_0x4b94('0xf')]()]+'],\x20getUser\x20entity',_0x90d6a3);if(_0x90d6a3[_0x4b94('0xb')][_0x4b94('0x1a')]>0x0&&String(_0x90d6a3[_0x4b94('0xb')][0x0]['active'])===_0x4b94('0x1b')){_0x5c6c13['userId']=_0x90d6a3[_0x4b94('0xb')][0x0]['sys_id'];}else{_0x5c6c13['userId']=_0x5c6c13['adminId'];_0x5c6c13['userEmail']=_0x5c6c13[_0x4b94('0x1c')];}logger[_0x4b94('0xe')]('['+[_0x368702[_0x4b94('0xf')]()]+_0x4b94('0x1d'),_0x5c6c13);_0x4e414a(_0x5c6c13);})[_0x4b94('0x11')](function(_0x3b614b){logger[_0x4b94('0x12')]('['+[_0x368702[_0x4b94('0xf')]()]+']',_0x3b614b[_0x4b94('0x13')]);_0x14a072(_0x3b614b[_0x4b94('0x13')]);});}else{logger[_0x4b94('0xe')]('['+[_0x368702[_0x4b94('0xf')]()]+']\x20using\x20admin\x20profile');_0x5c6c13[_0x4b94('0x1e')]=_0x5c6c13[_0x4b94('0xc')];_0x5c6c13[_0x4b94('0x16')]=_0x5c6c13['adminEmail'];_0x4e414a(_0x5c6c13);}});};}function createEndUser(_0x2aa83f,_0xac05c1,_0x369f3f,_0x290aed,_0x4b440e){logger[_0x4b94('0xe')]('['+[_0x2aa83f['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x369f3f);return new Promise(function(_0x3cef86,_0x3a1691){var _0x1bd009={'method':_0x4b94('0x1f'),'uri':_0x290aed+'sys_user?'+_0x4b440e,'body':{'user_name':_0x369f3f[_0x4b94('0x20')],'roles':_0x4b94('0x21'),'first_name':_0x369f3f[_0x4b94('0x20')],'active':_0x4b94('0x1b'),'date_format':_0x4b94('0x22'),'phone':_0x369f3f[_0x4b94('0x20')]},'auth':_0xac05c1,'json':!![]};return rp(_0x1bd009)['then'](function(_0x268a8f){logger[_0x4b94('0xe')]('['+[_0x2aa83f[_0x4b94('0xf')]()]+_0x4b94('0x23'),_0x268a8f[_0x4b94('0xb')]);_0x369f3f[_0x4b94('0x24')]=_0x268a8f[_0x4b94('0xb')]['sys_id'];_0x3cef86(_0x369f3f);})[_0x4b94('0x11')](function(_0x6ebfdc){logger[_0x4b94('0x12')]('['+[_0x2aa83f[_0x4b94('0xf')]()]+']',_0x6ebfdc[_0x4b94('0x13')]);_0x3a1691(_0x6ebfdc[_0x4b94('0x13')]);});});}function getEndUser(_0x362b52,_0x590655,_0x56bd5c,_0x2698b0,_0x1e5cdf){return function(_0x404bcb){logger[_0x4b94('0xe')]('['+[_0x362b52[_0x4b94('0xf')]()]+_0x4b94('0x25'),_0x404bcb);return new Promise(function(_0x10d5d8,_0x4ae723){var _0x8da3bf={'method':_0x4b94('0x17'),'uri':_0x56bd5c+_0x4b94('0x26')+_0x404bcb['endUserNumber']+'&'+_0x2698b0+'&'+_0x1e5cdf,'auth':_0x590655,'json':!![]};return rp(_0x8da3bf)[_0x4b94('0xa')](function(_0x104eb1){if(_0x104eb1[_0x4b94('0xb')][_0x4b94('0x1a')]>0x0){_0x404bcb[_0x4b94('0x24')]=_0x104eb1[_0x4b94('0xb')][0x0][_0x4b94('0xd')];logger[_0x4b94('0xe')]('['+[_0x362b52[_0x4b94('0xf')]()]+_0x4b94('0x27'),_0x404bcb);_0x10d5d8(_0x404bcb);}else{return createEndUser(_0x362b52,_0x590655,_0x404bcb,_0x56bd5c,_0x2698b0)[_0x4b94('0xa')](function(_0x58738e){logger[_0x4b94('0xe')]('['+[_0x362b52[_0x4b94('0xf')]()]+'],\x20createEndUser\x20crm',_0x58738e);_0x10d5d8(_0x58738e);});}})[_0x4b94('0x11')](function(_0x38bc29){logger[_0x4b94('0x12')]('['+[_0x362b52['toUpperCase']()]+']',_0x38bc29['message']);_0x4ae723(_0x38bc29[_0x4b94('0x13')]);});});};}function getCustomFields(_0x507261,_0x3a836c){var _0x595944={};if(_0x507261[_0x4b94('0x1a')]>0x0){_[_0x4b94('0x28')](_0x507261,function(_0x5f0377){if(_[_0x4b94('0x29')]([_0x4b94('0x2a'),_0x4b94('0x2b')],_0x5f0377[_0x4b94('0x2c')])&&_0x5f0377[_0x4b94('0x2d')]&&!_0x5f0377[_0x4b94('0x2e')]){_0x595944[_0x5f0377[_0x4b94('0x2d')][_0x4b94('0x2f')]()]=_0x5f0377[_0x4b94('0x30')][_0x4b94('0x31')]();}else if(_['includes']([_0x4b94('0x2a'),_0x4b94('0x2b')],_0x5f0377['type'])&&_0x5f0377[_0x4b94('0x32')]&&_0x5f0377[_0x4b94('0x2e')]){_0x595944[_0x5f0377[_0x4b94('0x32')][_0x4b94('0x2f')]()]=_0x5f0377[_0x4b94('0x30')]['toString']();}else if(_0x5f0377[_0x4b94('0x2c')]==='variable'&&_0x5f0377[_0x4b94('0x33')]&&_0x5f0377[_0x4b94('0x32')]&&_0x5f0377[_0x4b94('0x2e')]){_0x595944[_0x5f0377['idField'][_0x4b94('0x2f')]()]=_0x3a836c[_0x5f0377['variableName']][_0x4b94('0x31')]();}else if(_0x5f0377[_0x4b94('0x2c')]===_0x4b94('0x34')&&_0x5f0377[_0x4b94('0x35')]&&_0x5f0377['Variable'][_0x4b94('0x36')]&&_0x5f0377[_0x4b94('0x32')]&&_0x5f0377[_0x4b94('0x2e')]){_0x595944[_0x5f0377[_0x4b94('0x32')][_0x4b94('0x2f')]()]=_0x3a836c[_0x5f0377[_0x4b94('0x35')][_0x4b94('0x36')][_0x4b94('0x2f')]()][_0x4b94('0x31')]();}});}return _0x595944;}function getTicket(_0x3ec4d9,_0x1f3378,_0x53ebec,_0x2eb428,_0x1ae8fe,_0x2844f9){return function(_0x26ab02){logger[_0x4b94('0xe')]('['+[_0x3ec4d9['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x26ab02);return new Promise(function(_0x4ddc45,_0x31420c){var _0x53cac8=_0x3ec4d9[_0x4b94('0x2f')]()===_0x4b94('0x37')?_0x26ab02[_0x4b94('0x1e')]:_0x26ab02['endUserId'];var _0x586d0d={'method':_0x4b94('0x1f'),'uri':_0x53ebec+'incident'+'?'+_0x2844f9,'body':Object[_0x4b94('0x38')]({},{'active':_0x4b94('0x1b'),'caller_id':_0x53cac8,'assigned_to':_0x26ab02[_0x4b94('0x1e')],'short_description':intUtil['getString'](_0x2eb428[_0x4b94('0x39')],_0x1ae8fe,'\x20'),'description':intUtil[_0x4b94('0x3a')](_0x2eb428[_0x4b94('0x3b')],_0x1ae8fe,'\x0a')},getCustomFields(_0x2eb428[_0x4b94('0x3c')],_0x1ae8fe)),'auth':_0x1f3378,'json':!![]};return rp(_0x586d0d)[_0x4b94('0xa')](function(_0x40d202){logger['info']('['+[_0x3ec4d9[_0x4b94('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x40d202[_0x4b94('0xb')]);_0x26ab02[_0x4b94('0x3d')]=_0x40d202[_0x4b94('0xb')]['sys_id'];_0x26ab02['ticketNumber']=_0x40d202[_0x4b94('0xb')][_0x4b94('0x3e')];logger[_0x4b94('0xe')]('['+[_0x3ec4d9[_0x4b94('0xf')]()]+_0x4b94('0x3f'),_0x26ab02);_0x4ddc45(_0x26ab02);})[_0x4b94('0x11')](function(_0x564622){logger['error']('['+[_0x3ec4d9['toUpperCase']()]+']',_0x564622[_0x4b94('0x13')]);_0x31420c(_0x564622['message']);});});};}function createRemoteTag(_0x106bc9,_0x37a5ff,_0x3444f8,_0x29721e){return new Promise(function(_0x5312a0,_0x527cbc){var _0x1b1b14={'method':_0x4b94('0x1f'),'uri':_0x3444f8+_0x4b94('0x40')+'?'+_0x29721e,'body':{'short_description':_0x106bc9,'global':!![],'active':!![],'name':_0x106bc9},'auth':_0x37a5ff,'json':!![]};return rp(_0x1b1b14)[_0x4b94('0xa')](function(_0x53c7f9){var _0x15865d=_0x53c7f9[_0x4b94('0xb')]['sys_id'];_0x5312a0(_0x15865d);});});}function getRemoteTag(_0x1bed19,_0x17275d,_0x298539,_0x219671,_0x23fd69){return new Promise(function(_0x5ca7b6,_0x2fb701){var _0x3a47ea={'method':_0x4b94('0x17'),'uri':_0x298539+_0x4b94('0x40')+'?sysparm_query=name%3D'+_0x1bed19+'&'+_0x219671,'auth':_0x17275d,'json':!![]};return rp(_0x3a47ea)[_0x4b94('0xa')](function(_0x3001d6){if(_0x3001d6[_0x4b94('0xb')]['length']>0x0){var _0x9091a=_0x3001d6[_0x4b94('0xb')][0x0][_0x4b94('0xd')];_0x5ca7b6(_0x9091a);}else{return createRemoteTag(_0x1bed19,_0x17275d,_0x298539,_0x219671)[_0x4b94('0xa')](function(_0x578e0b){_0x5ca7b6(_0x578e0b);});}});});}function assignTagToIncident(_0x182490,_0x589fc5,_0x5aa5c5,_0x5d515b,_0x227072){return new Promise(function(_0x15c752,_0x545e54){var _0x2e3b88={'method':_0x4b94('0x1f'),'uri':_0x5aa5c5+_0x4b94('0x41')+'?'+_0x227072,'body':{'label':_0x182490,'table':'incident','id_type':_0x4b94('0x42'),'table_key':_0x5d515b[_0x4b94('0x3d')],'title':_0x4b94('0x43')+_0x5d515b[_0x4b94('0x44')],'id_display':_0x5d515b[_0x4b94('0x44')]},'auth':_0x589fc5,'json':!![]};return rp(_0x2e3b88)[_0x4b94('0xa')](function(_0x5e653b){_0x15c752();})[_0x4b94('0x11')](function(){_0x15c752();});});}function manageTags(_0x26f864,_0x39b71b,_0x48c531,_0x402558,_0x197b9f,_0x54574a,_0x1a4c83){return new Promise(function(_0x4a6e4d,_0x20f772){var _0x5cb549=[];_0x39b71b['forEach'](function(_0x538b60){_0x5cb549[_0x4b94('0x45')](getRemoteTag(_0x538b60,_0x48c531,_0x402558,_0x54574a,_0x1a4c83));});return Promise[_0x4b94('0x46')](_0x5cb549)['then'](function(_0x3711ee){if(_0x3711ee[_0x4b94('0x1a')]){logger[_0x4b94('0xe')]('['+[_0x26f864[_0x4b94('0xf')]()]+_0x4b94('0x47'),_0x3711ee);var _0x5bf57d=[];_0x3711ee[_0x4b94('0x28')](function(_0x2797ae){_0x5bf57d[_0x4b94('0x45')](assignTagToIncident(_0x2797ae,_0x48c531,_0x402558,_0x197b9f,_0x54574a));});return Promise[_0x4b94('0x46')](_0x5bf57d)[_0x4b94('0xa')](function(){_0x4a6e4d();})[_0x4b94('0x11')](function(){_0x4a6e4d();});}else{_0x4a6e4d();}});});}function getTags(_0x148331,_0x53c571,_0x2299e9,_0x2ba094,_0x49c561,_0x35124c){return function(_0x2ff034){return new Promise(function(_0x35eed0,_0x4ab2f9){var _0x5a9177=[];var _0x279132=_0x2ba094[_0x4b94('0x48')];if(_0x279132&&_0x279132[_0x4b94('0x1a')]>0x0){_0x5a9177=_[_0x4b94('0x49')](_0x279132,_0x4b94('0x36'));}if(_0x5a9177[_0x4b94('0x1a')]>0x0){return manageTags(_0x148331,_0x5a9177,_0x53c571,_0x2299e9,_0x2ff034,_0x49c561,_0x35124c)[_0x4b94('0xa')](function(){_0x35eed0(_0x2ff034);});}else{_0x35eed0(_0x2ff034);}});};}function emit(_0x320888,_0x70280,_0x3aa8fd){var _0x34fd1a=_0x4b94('0x4a')+_0x4b94('0x4b')+_0x4b94('0x4c')+'%255EORDERBYDESCnumber';var _0x27e181={'uri':_0x320888+_0x4b94('0x4d')+_0x3aa8fd+_0x34fd1a};io['to'](util[_0x4b94('0x4e')]('user:%s',_0x70280))[_0x4b94('0x4f')](_0x4b94('0x50'),_0x27e181);}exports['cs']=function(_0xbe8990,_0x106731,_0x4df6e9,_0x942b86,_0x41f245,_0x15b456,_0x133a92,_0x533939){var _0x3eed8a={};var _0xfbb3ec={'user':_0x15b456[_0x4b94('0x51')],'pass':_0x15b456[_0x4b94('0x52')]};var _0x31135d=_0x4b94('0x53');var _0x44e7a5=_0x4b94('0x54');_0x15b456[_0x4b94('0x55')]=intUtil[_0x4b94('0x56')](_0x15b456[_0x4b94('0x55')]);_0x15b456['serverUrl']=intUtil[_0x4b94('0x56')](_0x15b456[_0x4b94('0x57')]);var _0x1ff881=util['format'](_0x4b94('0x58'),_0x15b456[_0x4b94('0x55')]);_0x3eed8a[_0x4b94('0x16')]=!_['isNil'](_0x942b86)?_0x942b86[_0x4b94('0x59')]:null;_0x3eed8a[_0x4b94('0x1c')]=_0x15b456[_0x4b94('0x59')];_0x3eed8a[_0x4b94('0x20')]=_0x533939[_0x4b94('0x2f')]()==='outbound'?_0x106731[_0x4b94('0x5a')]:_0x106731[_0x4b94('0x5b')];_0x3eed8a['callDirection']=_0x533939===_0x4b94('0x5c')||_0x533939===_0x4b94('0x5d')?'queue':_0x4b94('0x37');var _0x2725ea=util[_0x4b94('0x4e')](_0x4b94('0x5e'),_0x15b456['serverUrl'],_0x106731[_0x4b94('0x5f')],md5(_0x106731['uniqueid']));if(_0x41f245&&_0x41f245[_0x4b94('0x60')]){logger[_0x4b94('0xe')](_0x4b94('0x61'),_0x4b94('0x62'));_0x106731['recordingURL']=_0x2725ea;}else if(_0x133a92&&_0x133a92[_0x4b94('0x63')]&&_0x133a92[_0x4b94('0x63')]!==_0x4b94('0x64')){logger['info']('[OUTBOUND]',_0x4b94('0x62'));_0x106731[_0x4b94('0x65')]=_0x2725ea;}else{_0x106731['recordingURL']='';}return getAdminUser(_0x533939,_0xfbb3ec,_0x3eed8a,_0x1ff881,_0x44e7a5,_0x31135d)[_0x4b94('0xa')](getUser(_0x533939,_0xfbb3ec,_0x1ff881,_0x44e7a5,_0x31135d))[_0x4b94('0xa')](getEndUser(_0x533939,_0xfbb3ec,_0x1ff881,_0x44e7a5,_0x31135d))[_0x4b94('0xa')](getTicket(_0x533939,_0xfbb3ec,_0x1ff881,_0x4df6e9,_0x106731,_0x44e7a5))[_0x4b94('0xa')](function(_0x2c4f7f){logger[_0x4b94('0xe')](util[_0x4b94('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2c4f7f[_0x4b94('0x3d')]));logger[_0x4b94('0xe')](util[_0x4b94('0x4e')]('call\x20direction:\x20%s',_0x533939));if(_0x533939!=='unmanaged'){logger['info']('['+[_0x533939['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x15b456[_0x4b94('0x55')],_0x942b86[_0x4b94('0x36')],_0x2c4f7f[_0x4b94('0x3d')]);}})[_0x4b94('0x11')](function(_0x4043c5){logger[_0x4b94('0x12')]('['+[_0x533939[_0x4b94('0xf')]()]+_0x4b94('0x66'),util['inspect'](_0x4043c5,{'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 0fe1dd0..b44f7a5 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 _0x239f=['%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','Inbound','Ticket\x20created!','users','contacts','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','destcalleridnum','Fields','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','error','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','redis','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','Contacts','direction','length','variableName','push','idField','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','string','nameField','toLowerCase','content','type','customField','custom_fields','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri'];(function(_0x333548,_0x5cb2b1){var _0x1bfa9d=function(_0x5c8864){while(--_0x5c8864){_0x333548['push'](_0x333548['shift']());}};_0x1bfa9d(++_0x5cb2b1);}(_0x239f,0x18d));var _0xf239=function(_0xfe6fc1,_0x17fad6){_0xfe6fc1=_0xfe6fc1-0x0;var _0x205c78=_0x239f[_0xfe6fc1];return _0x205c78;};'use strict';var _=require('lodash');var rp=require(_0xf239('0x0'));var BPromise=require(_0xf239('0x1'));var md5=require(_0xf239('0x2'));var util=require(_0xf239('0x3'));var Redis=require(_0xf239('0x4'));var intUtil=require(_0xf239('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf239('0x6'))(_0xf239('0x7'));config['redis']=_[_0xf239('0x8')](config['redis'],{'host':_0xf239('0x9'),'port':0x18eb});var io=require(_0xf239('0xa'))(new Redis(config[_0xf239('0xb')]));var def={'method':'POST','json':!![]};function emit(_0x222ce1,_0x391a46,_0x1a2cb5){io['to'](_0x222ce1)['emit'](_0x391a46,_0x1a2cb5);}function getTicket(_0x5afa47,_0x13f296,_0x58ef25,_0x585548,_0x1ca631,_0x5cd59c,_0x5bb359,_0x1a9d9b){logger[_0xf239('0xc')](_0xf239('0xd'));var _0x4f2f73=new Date();var _0x330e86=[{'name':_0xf239('0xe'),'value':intUtil[_0xf239('0xf')](_0x585548[_0xf239('0x10')],_0x1ca631,'\x20')},{'name':_0xf239('0x11'),'value':_0x13f296['id']},{'name':_0xf239('0x12'),'value':_0x13f296['id']},{'name':_0xf239('0x13'),'value':intUtil[_0xf239('0xf')](_0x585548[_0xf239('0x14')],_0x1ca631,'\x0a')},{'name':_0xf239('0x15'),'value':_0x4f2f73[_0xf239('0x16')]()['slice'](0x0,0x13)[_0xf239('0x17')]('T','\x20')},{'name':_0xf239('0x18'),'value':'0'},{'name':_0xf239('0x19'),'value':'15'},{'name':'parent_id','value':_0x58ef25['id']},{'name':'parent_type','value':_0xf239('0x1a')},{'name':'parent_name','value':_0x58ef25[_0xf239('0xe')]},{'name':_0xf239('0x1b'),'value':_0x1a9d9b}];if(_0x5cd59c[_0xf239('0x1c')]){_['forEach'](_0x5cd59c,function(_0x39557e){if(_0x1ca631[_0x39557e[_0xf239('0x1d')]]){_0x330e86[_0xf239('0x1e')]({'name':_0x39557e[_0xf239('0x1f')],'value':_0x1ca631[_0x39557e[_0xf239('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xf239('0x20'),'response_type':_0xf239('0x20'),'rest_data':JSON[_0xf239('0x21')]({'session':_0x5bb359['id'],'module_name':_0xf239('0x22'),'name_value_list':_0x330e86})}});}function getAuth(_0x1840ef){return util['format'](_0xf239('0x23'),new Buffer(_0x1840ef[_0xf239('0x24')]+':X')[_0xf239('0x25')](_0xf239('0x26')));}function getServerInfo(_0x338d5a){return request({'form':{'method':_0xf239('0x27'),'input_type':_0xf239('0x20'),'response_type':_0xf239('0x20'),'rest_data':JSON['stringify']({'session':_0x338d5a['id']})}});}function getUser(_0x1bb86c,_0x5b33da,_0x25c18f){if(!_[_0xf239('0x28')](_0x5b33da)){logger[_0xf239('0xc')](_0xf239('0x29'),_0x5b33da);return request({'form':{'method':_0xf239('0x2a'),'input_type':_0xf239('0x20'),'response_type':_0xf239('0x20'),'rest_data':JSON['stringify']({'session':_0x25c18f['id'],'module_name':_0xf239('0x2b'),'query':util[_0xf239('0x2c')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5b33da),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf239('0x2d')](function(_0xb4b0c6){if(_0xb4b0c6[_0xf239('0x2e')]['length']){var _0x1901ec=_[_0xf239('0x2f')](_0xb4b0c6[_0xf239('0x2e')],function(_0x154924){return _0x154924[_0xf239('0x30')][_0xf239('0x31')][_0xf239('0x32')]===_0x5b33da;});if(_0x1901ec){logger[_0xf239('0xc')](_0xf239('0x33'));return BPromise['resolve']({'id':_0x1901ec['name_value_list']['id'][_0xf239('0x32')],'name':_0x1901ec[_0xf239('0x30')]['name'][_0xf239('0x32')]});}}logger[_0xf239('0xc')](_0xf239('0x34'));return BPromise['resolve']({'id':_0x25c18f[_0xf239('0x30')][_0xf239('0x35')][_0xf239('0x32')],'name':_0x25c18f[_0xf239('0x30')][_0xf239('0x31')][_0xf239('0x32')]});});}else{logger[_0xf239('0xc')](_0xf239('0x36'));return BPromise[_0xf239('0x37')]({'id':_0x25c18f[_0xf239('0x30')][_0xf239('0x35')][_0xf239('0x32')],'name':_0x25c18f[_0xf239('0x30')]['user_name'][_0xf239('0x32')]});}}function getEndUser(_0xe6482b,_0x145375,_0x5ab050,_0x717653){logger[_0xf239('0xc')]('Searching\x20enduser\x20with\x20phone',_0x5ab050);return request({'form':{'method':_0xf239('0x2a'),'input_type':_0xf239('0x20'),'response_type':_0xf239('0x20'),'rest_data':JSON[_0xf239('0x21')]({'session':_0x717653['id'],'module_name':_0xf239('0x1a'),'query':util[_0xf239('0x2c')](_0xf239('0x38'),_0x5ab050),'order_by':'','offset':'0','select_fields':['id',_0xf239('0xe'),_0xf239('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf239('0x2d')](function(_0x203ddb){if(_0x203ddb[_0xf239('0x2e')][_0xf239('0x1c')]){var _0x4e4aae=_['find'](_0x203ddb['entry_list'],function(_0x4a1941){return _0x4a1941[_0xf239('0x30')][_0xf239('0x39')][_0xf239('0x32')]===_0x5ab050;});if(_0x4e4aae){logger[_0xf239('0xc')](_0xf239('0x3a'));return BPromise['resolve']({'id':_0x4e4aae[_0xf239('0x30')]['id']['value'],'name':_0x4e4aae['name_value_list'][_0xf239('0xe')][_0xf239('0x32')],'phone':_0x4e4aae['name_value_list'][_0xf239('0x39')][_0xf239('0x32')]});}}else{logger['info'](_0xf239('0x3b'));return request({'form':{'method':_0xf239('0x3c'),'input_type':_0xf239('0x20'),'response_type':_0xf239('0x20'),'rest_data':JSON[_0xf239('0x21')]({'session':_0x717653['id'],'module_name':_0xf239('0x1a'),'name_value_list':[{'name':_0xf239('0x3d'),'value':_0x145375!==_0xf239('0x3e')?_0x145375:util[_0xf239('0x2c')]('Caller\x20-\x20%s',_0x5ab050)},{'name':_0xf239('0x39'),'value':_0x5ab050}]})}})[_0xf239('0x2d')](function(_0x15c7b5){logger[_0xf239('0xc')](_0xf239('0x3f'));return BPromise[_0xf239('0x37')]({'id':_0x15c7b5['id'],'name':_0x15c7b5[_0xf239('0x2e')][_0xf239('0x3d')]['value'],'phone':_0x15c7b5[_0xf239('0x2e')][_0xf239('0x39')]['value']});});}});}function request(_0x1dab2c){logger[_0xf239('0x40')](_0xf239('0x41'),JSON['stringify'](_0x1dab2c));return rp(_[_0xf239('0x42')](def,_0x1dab2c));}function getTags(_0xcd062,_0x261a60){var _0x2fffc5=[];if(_0xcd062&&_0xcd062[_0xf239('0x1c')]>0x0){_0x2fffc5=_[_0xf239('0x43')](_0xcd062,_0x261a60);}return _0x2fffc5;}function getCustomFields(_0x2ea682,_0x382a4){var _0xc33f8e=[];var _0x579503={'custom_fields':[]};if(_0x2ea682['length']>0x0){_[_0xf239('0x44')](_0x2ea682,function(_0x2997d6){if(_0x2997d6['type']===_0xf239('0x45')&&_0x2997d6[_0xf239('0x46')]&&!_0x2997d6['customField']){_0x579503[_0x2997d6[_0xf239('0x46')][_0xf239('0x47')]()]=_0x2997d6[_0xf239('0x48')][_0xf239('0x25')]();}else if(_0x2997d6[_0xf239('0x49')]===_0xf239('0x45')&&_0x2997d6[_0xf239('0x1f')]&&_0x2997d6[_0xf239('0x4a')]){_0x579503[_0xf239('0x4b')][_0xf239('0x1e')]({'id':_0x2997d6[_0xf239('0x1f')],'value':_0x2997d6['content'][_0xf239('0x25')]()});}else if(_0x2997d6[_0xf239('0x49')]==='variable'&&_0x2997d6[_0xf239('0x1d')]&&_0x2997d6['idField']&&_0x2997d6[_0xf239('0x4a')]){_0x382a4[_0x2997d6[_0xf239('0x1d')]]&&_0x579503['custom_fields'][_0xf239('0x1e')]({'id':_0x2997d6[_0xf239('0x1f')],'value':_0x382a4[_0x2997d6[_0xf239('0x1d')]][_0xf239('0x25')]()});}else if(_0x2997d6[_0xf239('0x49')]==='customVariable'&&_0x2997d6['Variable']&&_0x2997d6[_0xf239('0x4c')]['name']&&_0x2997d6[_0xf239('0x1f')]&&_0x2997d6[_0xf239('0x4a')]){_0x382a4[_0x2997d6[_0xf239('0x4c')][_0xf239('0xe')][_0xf239('0x47')]()]&&_0x579503[_0xf239('0x4b')]['push']({'id':_0x2997d6[_0xf239('0x1f')],'value':_0x382a4[_0x2997d6[_0xf239('0x4c')][_0xf239('0xe')][_0xf239('0x47')]()][_0xf239('0x25')]()});}});}return _0x579503;}function getConnection(_0x2be452){return request({'method':_0xf239('0x4d'),'form':{'method':_0xf239('0x4e'),'input_type':_0xf239('0x20'),'response_type':_0xf239('0x20'),'rest_data':JSON[_0xf239('0x21')]({'user_auth':{'user_name':_0x2be452[_0xf239('0x4f')],'password':_0x2be452[_0xf239('0x50')],'encryption':_0xf239('0x51')},'application':_0xf239('0x52')})}})['then'](function(_0x3db5f3){var _0x373b4c=_0x3db5f3;if(_0x373b4c['id']){def[_0xf239('0x53')]=_0x373b4c['id'];return BPromise[_0xf239('0x37')](_0x373b4c);}else{throw new Error(util[_0xf239('0x2c')](_0xf239('0x54'),_0x2be452['id']));}});}function setRelationship(_0xb84634,_0x52047c,_0x5d881b,_0x13b809){return request({'form':{'method':_0xf239('0x55'),'input_type':_0xf239('0x20'),'response_type':'JSON','rest_data':JSON[_0xf239('0x21')]({'session':_0xb84634['id'],'module_name':_0xf239('0x22'),'module_id':_0x5d881b['id'],'link_field_name':_0x13b809,'related_ids':[_0x52047c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf239('0x56')]=function(_0x2b3909,_0x5da774,_0x25a0ab,_0x4bed49,_0x4a3a5b,_0x5f2cfe){var _0x4f24fc,_0x15a673,_0x3b177b,_0x1ee9bb;_0x5f2cfe[_0xf239('0x57')]=intUtil[_0xf239('0x58')](_0x5f2cfe[_0xf239('0x57')]);_0x5f2cfe[_0xf239('0x59')]=intUtil[_0xf239('0x58')](_0x5f2cfe[_0xf239('0x59')]);def[_0xf239('0x5a')]=util[_0xf239('0x2c')](_0xf239('0x5b'),_0x5f2cfe[_0xf239('0x57')]);if(_0x4a3a5b&&_0x4a3a5b[_0xf239('0x5c')]){logger['info'](_0xf239('0x5d'),_0xf239('0x5e'));_0x5da774[_0xf239('0x5f')]=util['format'](_0xf239('0x60'),_0x5f2cfe[_0xf239('0x59')],_0x5da774[_0xf239('0x61')],md5(_0x5da774[_0xf239('0x61')]));}else{_0x5da774[_0xf239('0x5f')]='';}return getConnection(_0x5f2cfe)[_0xf239('0x2d')](function(_0x4f995f){_0x1ee9bb=_0x4f995f;return getUser(_0x5f2cfe,_0x4bed49[_0xf239('0xe')],_0x1ee9bb);})['then'](function(_0x56eb97){_0x4f24fc=_0x56eb97;logger['info'](_0xf239('0x62'),_0x4f24fc['id']);return getEndUser(_0x5f2cfe,_0x5da774[_0xf239('0x63')],_0x5da774[_0xf239('0x64')],_0x1ee9bb);})[_0xf239('0x2d')](function(_0xb66885){_0x15a673=_0xb66885;logger['info']('The\x20Enduser\x20ID\x20is:',_0x15a673['id']);return getTicket(_0x5f2cfe,_0x4f24fc,_0x15a673,_0x25a0ab,_0x5da774,_0x25a0ab['Fields'],_0x1ee9bb,_0xf239('0x65'));})[_0xf239('0x2d')](function(_0x38d156){_0x3b177b=_0x38d156;logger[_0xf239('0xc')](_0xf239('0x66'));logger[_0xf239('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3b177b['id']);return setRelationship(_0x1ee9bb,_0x4f24fc,_0x3b177b,_0xf239('0x67'));})['then'](function(){return setRelationship(_0x1ee9bb,_0x15a673,_0x3b177b,_0xf239('0x68'));})[_0xf239('0x2d')](function(){return getServerInfo(_0x1ee9bb);})[_0xf239('0x2d')](function(_0x494101){var _0x5cbe9a=parseInt(_0x494101[_0xf239('0x69')]['charAt'](0x0));var _0x43466b=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5f2cfe[_0xf239('0x57')],_0x3b177b['id']);if(_0x5cbe9a>0x6){_0x43466b=util[_0xf239('0x2c')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5f2cfe[_0xf239('0x57')],_0x3b177b['id']);}logger[_0xf239('0xc')](_0xf239('0x5d'),_0xf239('0x6a'));emit(util[_0xf239('0x2c')](_0xf239('0x6b'),_0x4bed49['name']),'trigger:browser:url',{'uri':_0x43466b});})[_0xf239('0x6c')](function(_0x495276){logger['error'](_0xf239('0x5d'),JSON['stringify'](_0x495276));});};exports[_0xf239('0x6d')]=function(_0x3c2417,_0x146375,_0x1fddc3,_0xbc09a1,_0x7bdd3c,_0x2d60d6,_0x18b059){var _0x549461,_0x41585e,_0x59f9fa,_0x455a15;_0x2d60d6['remoteUri']=intUtil[_0xf239('0x58')](_0x2d60d6[_0xf239('0x57')]);_0x2d60d6[_0xf239('0x59')]=intUtil[_0xf239('0x58')](_0x2d60d6[_0xf239('0x59')]);def[_0xf239('0x5a')]=util['format']('%s/service/v4_1/rest.php',_0x2d60d6['remoteUri']);if(_0x18b059&&_0x18b059[_0xf239('0x6e')]&&_0x18b059[_0xf239('0x6e')]!=='none'){logger[_0xf239('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x146375[_0xf239('0x5f')]=util[_0xf239('0x2c')](_0xf239('0x60'),_0x2d60d6[_0xf239('0x59')],_0x146375['uniqueid'],md5(_0x146375[_0xf239('0x61')]));}return getConnection(_0x2d60d6)[_0xf239('0x2d')](function(_0x471e79){_0x455a15=_0x471e79;return getUser(_0x2d60d6,_0xbc09a1['name'],_0x455a15);})[_0xf239('0x2d')](function(_0x32359b){_0x549461=_0x32359b;logger['info'](_0xf239('0x62'),_0x549461['id']);return getEndUser(_0x2d60d6,_0x146375['destcalleridname'],_0x146375[_0xf239('0x6f')],_0x455a15);})['then'](function(_0x4985ba){_0x41585e=_0x4985ba;logger[_0xf239('0xc')]('The\x20Enduser\x20ID\x20is:',_0x41585e['id']);return getTicket(_0x2d60d6,_0x549461,_0x41585e,_0x1fddc3,_0x146375,_0x1fddc3[_0xf239('0x70')],_0x455a15,'Outbound');})['then'](function(_0x2daa73){_0x59f9fa=_0x2daa73;logger[_0xf239('0xc')](_0xf239('0x66'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x59f9fa['id']);return setRelationship(_0x455a15,_0x549461,_0x59f9fa,'users');})[_0xf239('0x2d')](function(){return setRelationship(_0x455a15,_0x41585e,_0x59f9fa,_0xf239('0x68'));})['then'](function(){return getServerInfo(_0x455a15);})[_0xf239('0x2d')](function(_0x133829){var _0x5bfa7b=parseInt(_0x133829[_0xf239('0x69')][_0xf239('0x71')](0x0));var _0x5755b5=util[_0xf239('0x2c')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2d60d6[_0xf239('0x57')],_0x59f9fa['id']);if(_0x5bfa7b>0x6){_0x5755b5=util[_0xf239('0x2c')](_0xf239('0x72'),_0x2d60d6[_0xf239('0x57')],_0x59f9fa['id']);}logger[_0xf239('0xc')](_0xf239('0x73'),_0xf239('0x6a'));emit(util['format']('user:%s',_0xbc09a1[_0xf239('0xe')]),_0xf239('0x74'),{'uri':_0x5755b5});})[_0xf239('0x6c')](function(_0x109787){logger['error'](_0xf239('0x73'),JSON[_0xf239('0x21')](_0x109787));});};exports['unmanaged']=function(_0x14b7fa,_0x35aa9c,_0x33ac23,_0x23695e,_0x1c5543,_0x55c2df){var _0x14b2b6,_0x562aa5,_0x75739f,_0xc4c14b;_0x55c2df['remoteUri']=intUtil['stripTrailingSlash'](_0x55c2df[_0xf239('0x57')]);_0x55c2df['serverUrl']=intUtil[_0xf239('0x58')](_0x55c2df[_0xf239('0x59')]);def[_0xf239('0x5a')]=util[_0xf239('0x2c')](_0xf239('0x5b'),_0x55c2df[_0xf239('0x57')]);if(_0x1c5543&&_0x1c5543[_0xf239('0x5c')]){logger[_0xf239('0xc')]('['+_0x35aa9c[_0xf239('0x75')][_0xf239('0x76')]()+']','Recording\x20is\x20enabled!');_0x35aa9c[_0xf239('0x5f')]=util[_0xf239('0x2c')](_0xf239('0x60'),_0x55c2df[_0xf239('0x59')],_0x35aa9c[_0xf239('0x61')],md5(_0x35aa9c['uniqueid']));}else{_0x35aa9c[_0xf239('0x5f')]='';}return getConnection(_0x55c2df)['then'](function(_0x126ae8){_0xc4c14b=_0x126ae8;if(!_[_0xf239('0x28')](_0x23695e)){return getUser(_0x55c2df,_0x23695e[_0xf239('0xe')],_0xc4c14b);}else{return getUser(_0x55c2df,null,_0xc4c14b);}})[_0xf239('0x2d')](function(_0x48d935){_0x14b2b6=_0x48d935;logger['info'](_0xf239('0x62'),_0x14b2b6['id']);return getEndUser(_0x55c2df,_0x35aa9c['calleridname'],_0x35aa9c[_0xf239('0x64')],_0xc4c14b);})[_0xf239('0x2d')](function(_0x19eb2a){_0x562aa5=_0x19eb2a;logger[_0xf239('0xc')](_0xf239('0x77'),_0x562aa5['id']);return getTicket(_0x55c2df,_0x14b2b6,_0x562aa5,_0x33ac23,_0x35aa9c,_0x33ac23[_0xf239('0x70')],_0xc4c14b,'Inbound');})[_0xf239('0x2d')](function(_0x3931ca){_0x75739f=_0x3931ca;logger[_0xf239('0xc')](_0xf239('0x66'));logger[_0xf239('0xc')](_0xf239('0x78'),_0x75739f['id']);return setRelationship(_0xc4c14b,_0x14b2b6,_0x75739f,_0xf239('0x67'));})[_0xf239('0x2d')](function(){return setRelationship(_0xc4c14b,_0x562aa5,_0x75739f,'contacts');})['then'](function(){return getServerInfo(_0xc4c14b);})[_0xf239('0x6c')](function(_0x3722de){logger[_0xf239('0x79')]('['+_0x35aa9c[_0xf239('0x75')][_0xf239('0x76')]()+']',JSON[_0xf239('0x21')](_0x3722de));});}; \ No newline at end of file +var _0xea1d=['date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','set_entry','JSON','Calls','format','toString','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','stringify','','Enduser\x20created.','first_name','map','type','string','nameField','customField','toLowerCase','content','idField','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','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:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','Outbound','charAt','error','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','Inbound','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description'];(function(_0x92c9fe,_0x28124a){var _0x3452f9=function(_0xc3cfee){while(--_0xc3cfee){_0x92c9fe['push'](_0x92c9fe['shift']());}};_0x3452f9(++_0x28124a);}(_0xea1d,0xe2));var _0xdea1=function(_0x22eef7,_0x1774c9){_0x22eef7=_0x22eef7-0x0;var _0x57a4f0=_0xea1d[_0x22eef7];return _0x57a4f0;};'use strict';var _=require(_0xdea1('0x0'));var rp=require(_0xdea1('0x1'));var BPromise=require('bluebird');var md5=require(_0xdea1('0x2'));var util=require(_0xdea1('0x3'));var Redis=require(_0xdea1('0x4'));var intUtil=require(_0xdea1('0x5'));var config=require(_0xdea1('0x6'));var logger=require(_0xdea1('0x7'))(_0xdea1('0x8'));config[_0xdea1('0x9')]=_[_0xdea1('0xa')](config[_0xdea1('0x9')],{'host':_0xdea1('0xb'),'port':0x18eb});var io=require(_0xdea1('0xc'))(new Redis(config[_0xdea1('0x9')]));var def={'method':_0xdea1('0xd'),'json':!![]};function emit(_0x4d2872,_0x508e47,_0x4f9064){io['to'](_0x4d2872)[_0xdea1('0xe')](_0x508e47,_0x4f9064);}function getTicket(_0x3d4b52,_0x2565a1,_0x160bff,_0x2e7395,_0x5cf157,_0x3dc0c9,_0x5b817e,_0x5abfaf){logger[_0xdea1('0xf')]('Creating\x20new\x20ticket...');var _0x4ff285=new Date();var _0x4fc107=[{'name':_0xdea1('0x10'),'value':intUtil[_0xdea1('0x11')](_0x2e7395[_0xdea1('0x12')],_0x5cf157,'\x20')},{'name':_0xdea1('0x13'),'value':_0x2565a1['id']},{'name':_0xdea1('0x14'),'value':_0x2565a1['id']},{'name':_0xdea1('0x15'),'value':intUtil[_0xdea1('0x11')](_0x2e7395['Descriptions'],_0x5cf157,'\x0a')},{'name':_0xdea1('0x16'),'value':_0x4ff285[_0xdea1('0x17')]()['slice'](0x0,0x13)[_0xdea1('0x18')]('T','\x20')},{'name':_0xdea1('0x19'),'value':'0'},{'name':_0xdea1('0x1a'),'value':'15'},{'name':_0xdea1('0x1b'),'value':_0x160bff['id']},{'name':_0xdea1('0x1c'),'value':_0xdea1('0x1d')},{'name':_0xdea1('0x1e'),'value':_0x160bff['name']},{'name':_0xdea1('0x1f'),'value':_0x5abfaf}];if(_0x3dc0c9[_0xdea1('0x20')]){_[_0xdea1('0x21')](_0x3dc0c9,function(_0x1a5c2b){if(_0x5cf157[_0x1a5c2b[_0xdea1('0x22')]]){_0x4fc107[_0xdea1('0x23')]({'name':_0x1a5c2b['idField'],'value':_0x5cf157[_0x1a5c2b['variableName']]});}});}return request({'form':{'method':_0xdea1('0x24'),'input_type':_0xdea1('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5b817e['id'],'module_name':_0xdea1('0x26'),'name_value_list':_0x4fc107})}});}function getAuth(_0x24f000){return util[_0xdea1('0x27')]('Basic\x20%s',new Buffer(_0x24f000['apiKey']+':X')[_0xdea1('0x28')](_0xdea1('0x29')));}function getServerInfo(_0x4c271c){return request({'form':{'method':_0xdea1('0x2a'),'input_type':_0xdea1('0x25'),'response_type':_0xdea1('0x25'),'rest_data':JSON['stringify']({'session':_0x4c271c['id']})}});}function getUser(_0x30ba48,_0x3ce9f7,_0x38675d){if(!_[_0xdea1('0x2b')](_0x3ce9f7)){logger[_0xdea1('0xf')]('Getting\x20agent\x20with\x20name',_0x3ce9f7);return request({'form':{'method':_0xdea1('0x2c'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x38675d['id'],'module_name':_0xdea1('0x2d'),'query':util[_0xdea1('0x27')](_0xdea1('0x2e'),_0x3ce9f7),'order_by':'','offset':'0','select_fields':['id',_0xdea1('0x10'),_0xdea1('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2bd427){if(_0x2bd427[_0xdea1('0x30')]['length']){var _0x80addb=_[_0xdea1('0x31')](_0x2bd427[_0xdea1('0x30')],function(_0x1ce6e9){return _0x1ce6e9['name_value_list']['user_name'][_0xdea1('0x32')]===_0x3ce9f7;});if(_0x80addb){logger[_0xdea1('0xf')]('Agent\x20found!');return BPromise[_0xdea1('0x33')]({'id':_0x80addb[_0xdea1('0x34')]['id'][_0xdea1('0x32')],'name':_0x80addb[_0xdea1('0x34')][_0xdea1('0x10')][_0xdea1('0x32')]});}}logger[_0xdea1('0xf')](_0xdea1('0x35'));return BPromise[_0xdea1('0x33')]({'id':_0x38675d['name_value_list'][_0xdea1('0x36')][_0xdea1('0x32')],'name':_0x38675d[_0xdea1('0x34')][_0xdea1('0x2f')][_0xdea1('0x32')]});});}else{logger[_0xdea1('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xdea1('0x33')]({'id':_0x38675d[_0xdea1('0x34')]['user_id'][_0xdea1('0x32')],'name':_0x38675d[_0xdea1('0x34')][_0xdea1('0x2f')][_0xdea1('0x32')]});}}function getEndUser(_0x590080,_0x4a6858,_0x3ca0f4,_0x2bb28d){logger[_0xdea1('0xf')]('Searching\x20enduser\x20with\x20phone',_0x3ca0f4);return request({'form':{'method':_0xdea1('0x2c'),'input_type':_0xdea1('0x25'),'response_type':_0xdea1('0x25'),'rest_data':JSON['stringify']({'session':_0x2bb28d['id'],'module_name':_0xdea1('0x1d'),'query':util[_0xdea1('0x27')](_0xdea1('0x37'),_0x3ca0f4),'order_by':'','offset':'0','select_fields':['id',_0xdea1('0x10'),_0xdea1('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdea1('0x39')](function(_0x148299){if(_0x148299['entry_list'][_0xdea1('0x20')]){var _0x1f9bff=_['find'](_0x148299[_0xdea1('0x30')],function(_0x14e428){return _0x14e428[_0xdea1('0x34')]['phone_home'][_0xdea1('0x32')]===_0x3ca0f4;});if(_0x1f9bff){logger['info'](_0xdea1('0x3a'));return BPromise[_0xdea1('0x33')]({'id':_0x1f9bff[_0xdea1('0x34')]['id'][_0xdea1('0x32')],'name':_0x1f9bff['name_value_list'][_0xdea1('0x10')][_0xdea1('0x32')],'phone':_0x1f9bff['name_value_list'][_0xdea1('0x38')][_0xdea1('0x32')]});}}else{logger[_0xdea1('0xf')](_0xdea1('0x3b'));return request({'form':{'method':_0xdea1('0x24'),'input_type':_0xdea1('0x25'),'response_type':'JSON','rest_data':JSON[_0xdea1('0x3c')]({'session':_0x2bb28d['id'],'module_name':_0xdea1('0x1d'),'name_value_list':[{'name':'first_name','value':_0x4a6858!==_0xdea1('0x3d')?_0x4a6858:util['format']('Caller\x20-\x20%s',_0x3ca0f4)},{'name':_0xdea1('0x38'),'value':_0x3ca0f4}]})}})[_0xdea1('0x39')](function(_0x2534cf){logger['info'](_0xdea1('0x3e'));return BPromise[_0xdea1('0x33')]({'id':_0x2534cf['id'],'name':_0x2534cf[_0xdea1('0x30')][_0xdea1('0x3f')][_0xdea1('0x32')],'phone':_0x2534cf[_0xdea1('0x30')][_0xdea1('0x38')][_0xdea1('0x32')]});});}});}function request(_0xe17a9d){logger['debug']('[HTTP]',JSON[_0xdea1('0x3c')](_0xe17a9d));return rp(_['merge'](def,_0xe17a9d));}function getTags(_0x499ce8,_0x2d905b){var _0x3a3479=[];if(_0x499ce8&&_0x499ce8[_0xdea1('0x20')]>0x0){_0x3a3479=_[_0xdea1('0x40')](_0x499ce8,_0x2d905b);}return _0x3a3479;}function getCustomFields(_0x55cd7e,_0x2e4656){var _0x2a2baa=[];var _0x2dcd56={'custom_fields':[]};if(_0x55cd7e[_0xdea1('0x20')]>0x0){_[_0xdea1('0x21')](_0x55cd7e,function(_0x132593){if(_0x132593[_0xdea1('0x41')]===_0xdea1('0x42')&&_0x132593[_0xdea1('0x43')]&&!_0x132593[_0xdea1('0x44')]){_0x2dcd56[_0x132593[_0xdea1('0x43')][_0xdea1('0x45')]()]=_0x132593[_0xdea1('0x46')][_0xdea1('0x28')]();}else if(_0x132593[_0xdea1('0x41')]===_0xdea1('0x42')&&_0x132593[_0xdea1('0x47')]&&_0x132593[_0xdea1('0x44')]){_0x2dcd56['custom_fields'][_0xdea1('0x23')]({'id':_0x132593[_0xdea1('0x47')],'value':_0x132593[_0xdea1('0x46')]['toString']()});}else if(_0x132593[_0xdea1('0x41')]===_0xdea1('0x48')&&_0x132593[_0xdea1('0x22')]&&_0x132593['idField']&&_0x132593[_0xdea1('0x44')]){_0x2e4656[_0x132593[_0xdea1('0x22')]]&&_0x2dcd56[_0xdea1('0x49')][_0xdea1('0x23')]({'id':_0x132593[_0xdea1('0x47')],'value':_0x2e4656[_0x132593['variableName']][_0xdea1('0x28')]()});}else if(_0x132593[_0xdea1('0x41')]===_0xdea1('0x4a')&&_0x132593[_0xdea1('0x4b')]&&_0x132593[_0xdea1('0x4b')][_0xdea1('0x10')]&&_0x132593[_0xdea1('0x47')]&&_0x132593[_0xdea1('0x44')]){_0x2e4656[_0x132593[_0xdea1('0x4b')]['name'][_0xdea1('0x45')]()]&&_0x2dcd56[_0xdea1('0x49')]['push']({'id':_0x132593['idField'],'value':_0x2e4656[_0x132593['Variable'][_0xdea1('0x10')][_0xdea1('0x45')]()][_0xdea1('0x28')]()});}});}return _0x2dcd56;}function getConnection(_0x45298c){return request({'method':_0xdea1('0xd'),'form':{'method':_0xdea1('0x4c'),'input_type':_0xdea1('0x25'),'response_type':_0xdea1('0x25'),'rest_data':JSON[_0xdea1('0x3c')]({'user_auth':{'user_name':_0x45298c[_0xdea1('0x4d')],'password':_0x45298c[_0xdea1('0x4e')],'encryption':_0xdea1('0x4f')},'application':_0xdea1('0x50')})}})['then'](function(_0x5c1a15){var _0xba4d72=_0x5c1a15;if(_0xba4d72['id']){def[_0xdea1('0x51')]=_0xba4d72['id'];return BPromise[_0xdea1('0x33')](_0xba4d72);}else{throw new Error(util[_0xdea1('0x27')](_0xdea1('0x52'),_0x45298c['id']));}});}function setRelationship(_0xe6725a,_0x190a9c,_0x1bfc69,_0x119852){return request({'form':{'method':_0xdea1('0x53'),'input_type':_0xdea1('0x25'),'response_type':_0xdea1('0x25'),'rest_data':JSON[_0xdea1('0x3c')]({'session':_0xe6725a['id'],'module_name':'Calls','module_id':_0x1bfc69['id'],'link_field_name':_0x119852,'related_ids':[_0x190a9c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xdea1('0x54')]=function(_0x13e73b,_0x17844b,_0x3a3221,_0x350e22,_0x5915ec,_0xac6505){var _0x427fda,_0x1cd148,_0x264836,_0x1bdfea;_0xac6505[_0xdea1('0x55')]=intUtil['stripTrailingSlash'](_0xac6505[_0xdea1('0x55')]);_0xac6505[_0xdea1('0x56')]=intUtil[_0xdea1('0x57')](_0xac6505['serverUrl']);def[_0xdea1('0x58')]=util[_0xdea1('0x27')]('%s/service/v4_1/rest.php',_0xac6505[_0xdea1('0x55')]);if(_0x5915ec&&_0x5915ec[_0xdea1('0x59')]){logger['info'](_0xdea1('0x5a'),_0xdea1('0x5b'));_0x17844b[_0xdea1('0x5c')]=util[_0xdea1('0x27')](_0xdea1('0x5d'),_0xac6505['serverUrl'],_0x17844b[_0xdea1('0x5e')],md5(_0x17844b[_0xdea1('0x5e')]));}else{_0x17844b[_0xdea1('0x5c')]='';}return getConnection(_0xac6505)[_0xdea1('0x39')](function(_0x4aa4bc){_0x1bdfea=_0x4aa4bc;return getUser(_0xac6505,_0x350e22[_0xdea1('0x10')],_0x1bdfea);})[_0xdea1('0x39')](function(_0x32d1f0){_0x427fda=_0x32d1f0;logger[_0xdea1('0xf')](_0xdea1('0x5f'),_0x427fda['id']);return getEndUser(_0xac6505,_0x17844b[_0xdea1('0x60')],_0x17844b[_0xdea1('0x61')],_0x1bdfea);})['then'](function(_0x542aae){_0x1cd148=_0x542aae;logger[_0xdea1('0xf')](_0xdea1('0x62'),_0x1cd148['id']);return getTicket(_0xac6505,_0x427fda,_0x1cd148,_0x3a3221,_0x17844b,_0x3a3221['Fields'],_0x1bdfea,'Inbound');})[_0xdea1('0x39')](function(_0x1f8ec5){_0x264836=_0x1f8ec5;logger['info'](_0xdea1('0x63'));logger[_0xdea1('0xf')](_0xdea1('0x64'),_0x264836['id']);return setRelationship(_0x1bdfea,_0x427fda,_0x264836,_0xdea1('0x65'));})[_0xdea1('0x39')](function(){return setRelationship(_0x1bdfea,_0x1cd148,_0x264836,_0xdea1('0x66'));})['then'](function(){return getServerInfo(_0x1bdfea);})[_0xdea1('0x39')](function(_0x2b7cd9){var _0x1c1a26=parseInt(_0x2b7cd9[_0xdea1('0x67')]['charAt'](0x0));var _0x189c63=util['format'](_0xdea1('0x68'),_0xac6505['remoteUri'],_0x264836['id']);if(_0x1c1a26>0x6){_0x189c63=util[_0xdea1('0x27')](_0xdea1('0x69'),_0xac6505[_0xdea1('0x55')],_0x264836['id']);}logger[_0xdea1('0xf')](_0xdea1('0x5a'),_0xdea1('0x6a'));emit(util['format'](_0xdea1('0x6b'),_0x350e22[_0xdea1('0x10')]),_0xdea1('0x6c'),{'uri':_0x189c63});})[_0xdea1('0x6d')](function(_0x3f0aa9){logger['error'](_0xdea1('0x5a'),JSON['stringify'](_0x3f0aa9));});};exports[_0xdea1('0x6e')]=function(_0x104f54,_0x5ee1e4,_0x1c94eb,_0x459c52,_0x406fa1,_0x3d7974,_0x3feee5){var _0x17c4ad,_0x541943,_0x3b7d68,_0x571935;_0x3d7974[_0xdea1('0x55')]=intUtil[_0xdea1('0x57')](_0x3d7974['remoteUri']);_0x3d7974['serverUrl']=intUtil[_0xdea1('0x57')](_0x3d7974[_0xdea1('0x56')]);def[_0xdea1('0x58')]=util[_0xdea1('0x27')]('%s/service/v4_1/rest.php',_0x3d7974['remoteUri']);if(_0x3feee5&&_0x3feee5[_0xdea1('0x6f')]&&_0x3feee5[_0xdea1('0x6f')]!==_0xdea1('0x70')){logger[_0xdea1('0xf')](_0xdea1('0x71'),_0xdea1('0x5b'));_0x5ee1e4[_0xdea1('0x5c')]=util['format'](_0xdea1('0x5d'),_0x3d7974['serverUrl'],_0x5ee1e4[_0xdea1('0x5e')],md5(_0x5ee1e4[_0xdea1('0x5e')]));}return getConnection(_0x3d7974)[_0xdea1('0x39')](function(_0x54ee12){_0x571935=_0x54ee12;return getUser(_0x3d7974,_0x459c52[_0xdea1('0x10')],_0x571935);})['then'](function(_0x1df353){_0x17c4ad=_0x1df353;logger[_0xdea1('0xf')](_0xdea1('0x5f'),_0x17c4ad['id']);return getEndUser(_0x3d7974,_0x5ee1e4['destcalleridname'],_0x5ee1e4[_0xdea1('0x72')],_0x571935);})[_0xdea1('0x39')](function(_0xb2d7da){_0x541943=_0xb2d7da;logger['info']('The\x20Enduser\x20ID\x20is:',_0x541943['id']);return getTicket(_0x3d7974,_0x17c4ad,_0x541943,_0x1c94eb,_0x5ee1e4,_0x1c94eb[_0xdea1('0x73')],_0x571935,_0xdea1('0x74'));})[_0xdea1('0x39')](function(_0x3a89d5){_0x3b7d68=_0x3a89d5;logger[_0xdea1('0xf')](_0xdea1('0x63'));logger['info'](_0xdea1('0x64'),_0x3b7d68['id']);return setRelationship(_0x571935,_0x17c4ad,_0x3b7d68,_0xdea1('0x65'));})['then'](function(){return setRelationship(_0x571935,_0x541943,_0x3b7d68,'contacts');})[_0xdea1('0x39')](function(){return getServerInfo(_0x571935);})['then'](function(_0x100dfc){var _0x229e00=parseInt(_0x100dfc['version'][_0xdea1('0x75')](0x0));var _0x2ccc48=util[_0xdea1('0x27')](_0xdea1('0x68'),_0x3d7974[_0xdea1('0x55')],_0x3b7d68['id']);if(_0x229e00>0x6){_0x2ccc48=util[_0xdea1('0x27')](_0xdea1('0x69'),_0x3d7974[_0xdea1('0x55')],_0x3b7d68['id']);}logger['info'](_0xdea1('0x71'),_0xdea1('0x6a'));emit(util[_0xdea1('0x27')]('user:%s',_0x459c52[_0xdea1('0x10')]),_0xdea1('0x6c'),{'uri':_0x2ccc48});})['catch'](function(_0x4b582e){logger[_0xdea1('0x76')](_0xdea1('0x71'),JSON[_0xdea1('0x3c')](_0x4b582e));});};exports[_0xdea1('0x77')]=function(_0x348d76,_0x5dd251,_0x4bc5c4,_0x11ceab,_0x61438d,_0x3ba2e4){var _0x3fc0c2,_0x388be7,_0x2acb61,_0x19f1f0;_0x3ba2e4['remoteUri']=intUtil[_0xdea1('0x57')](_0x3ba2e4[_0xdea1('0x55')]);_0x3ba2e4[_0xdea1('0x56')]=intUtil[_0xdea1('0x57')](_0x3ba2e4['serverUrl']);def[_0xdea1('0x58')]=util[_0xdea1('0x27')](_0xdea1('0x78'),_0x3ba2e4[_0xdea1('0x55')]);if(_0x61438d&&_0x61438d[_0xdea1('0x59')]){logger[_0xdea1('0xf')]('['+_0x5dd251[_0xdea1('0x79')][_0xdea1('0x7a')]()+']',_0xdea1('0x5b'));_0x5dd251[_0xdea1('0x5c')]=util[_0xdea1('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ba2e4[_0xdea1('0x56')],_0x5dd251[_0xdea1('0x5e')],md5(_0x5dd251[_0xdea1('0x5e')]));}else{_0x5dd251[_0xdea1('0x5c')]='';}return getConnection(_0x3ba2e4)['then'](function(_0x39d435){_0x19f1f0=_0x39d435;if(!_['isNil'](_0x11ceab)){return getUser(_0x3ba2e4,_0x11ceab['name'],_0x19f1f0);}else{return getUser(_0x3ba2e4,null,_0x19f1f0);}})['then'](function(_0x165de9){_0x3fc0c2=_0x165de9;logger[_0xdea1('0xf')](_0xdea1('0x5f'),_0x3fc0c2['id']);return getEndUser(_0x3ba2e4,_0x5dd251[_0xdea1('0x60')],_0x5dd251['calleridnum'],_0x19f1f0);})[_0xdea1('0x39')](function(_0x40e150){_0x388be7=_0x40e150;logger['info'](_0xdea1('0x62'),_0x388be7['id']);return getTicket(_0x3ba2e4,_0x3fc0c2,_0x388be7,_0x4bc5c4,_0x5dd251,_0x4bc5c4[_0xdea1('0x73')],_0x19f1f0,_0xdea1('0x7b'));})[_0xdea1('0x39')](function(_0xad1ef8){_0x2acb61=_0xad1ef8;logger['info'](_0xdea1('0x63'));logger[_0xdea1('0xf')](_0xdea1('0x64'),_0x2acb61['id']);return setRelationship(_0x19f1f0,_0x3fc0c2,_0x2acb61,_0xdea1('0x65'));})[_0xdea1('0x39')](function(){return setRelationship(_0x19f1f0,_0x388be7,_0x2acb61,_0xdea1('0x66'));})[_0xdea1('0x39')](function(){return getServerInfo(_0x19f1f0);})['catch'](function(_0x4ac364){logger['error']('['+_0x5dd251[_0xdea1('0x79')][_0xdea1('0x7a')]()+']',JSON[_0xdea1('0x3c')](_0x4ac364));});}; \ 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 e4fa7bf..10494d3 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 _0x27d1=['type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','format','%s:\x20%s','key','keyType','join','substring','isNil','lodash','util','getString','length','sortBy'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x27d1,0x154));var _0x127d=function(_0x3e5f50,_0x4c9ded){_0x3e5f50=_0x3e5f50-0x0;var _0x5a2451=_0x27d1[_0x3e5f50];return _0x5a2451;};'use strict';var _=require(_0x127d('0x0'));var util=require(_0x127d('0x1'));exports[_0x127d('0x2')]=function(_0x1ddde5,_0x410722,_0x26df56){var _0x11711e=[];if(_0x1ddde5[_0x127d('0x3')]>0x0){var _0x44cd36=_[_0x127d('0x4')](_0x1ddde5,['id']);for(var _0x1ef622=0x0;_0x1ef622<_0x44cd36['length'];_0x1ef622++){var _0x582f30=_0x44cd36[_0x1ef622];if(_0x582f30[_0x127d('0x5')]===_0x127d('0x6')){_0x11711e[_0x127d('0x7')](_0x582f30['content']);}else if(_0x582f30[_0x127d('0x5')]===_0x127d('0x8')&&_0x582f30[_0x127d('0x9')]){_0x410722[_0x582f30[_0x127d('0x9')]]&&_0x11711e['push'](_0x410722[_0x582f30[_0x127d('0x9')]]['toString']());}else if(_0x582f30[_0x127d('0x5')]===_0x127d('0xa')&&_0x582f30[_0x127d('0xb')]&&_0x582f30['Variable'][_0x127d('0xc')]){_0x410722[_0x582f30[_0x127d('0xb')]['name'][_0x127d('0xd')]()]&&_0x11711e['push'](_0x410722[_0x582f30['Variable'][_0x127d('0xc')][_0x127d('0xd')]()][_0x127d('0xe')]());}else if(_0x582f30[_0x127d('0x5')]===_0x127d('0xf')){if(_0x582f30['keyType']===_0x127d('0x6')&&_0x582f30['key']){_0x11711e[_0x127d('0x7')](util[_0x127d('0x10')](_0x127d('0x11'),_0x582f30[_0x127d('0x12')],_0x582f30['keyContent']));}else if(_0x582f30[_0x127d('0x13')]===_0x127d('0x8')&&_0x582f30[_0x127d('0x9')]&&_0x582f30[_0x127d('0x12')]){_0x410722[_0x582f30[_0x127d('0x9')]]&&_0x11711e[_0x127d('0x7')](util[_0x127d('0x10')](_0x127d('0x11'),_0x582f30[_0x127d('0x12')],_0x410722[_0x582f30[_0x127d('0x9')]]));}else if(_0x582f30['keyType']===_0x127d('0xa')&&_0x582f30['Variable']&&_0x582f30[_0x127d('0xb')][_0x127d('0xc')]&&_0x582f30[_0x127d('0x12')]){_0x410722[_0x582f30['Variable'][_0x127d('0xc')][_0x127d('0xd')]()]&&_0x11711e[_0x127d('0x7')](util[_0x127d('0x10')]('%s:\x20%s',_0x582f30['key'],_0x410722[_0x582f30[_0x127d('0xb')][_0x127d('0xc')]['toLowerCase']()]));}}}}return _0x11711e[_0x127d('0x14')](_0x26df56);};exports['stripTrailingSlash']=function(_0x9122f){var _0x41facd=_0x9122f['slice'](-0x1);if(_0x41facd==='/'){_0x9122f=_0x9122f[_0x127d('0x15')](0x0,_0x9122f['lastIndexOf'](_0x41facd));}return _0x9122f;};exports['validateEmail']=function(_0x59867b){if(!_[_0x127d('0x16')](_0x59867b)&&_0x59867b!==''){var _0x54a6c6=/^(([^<>()\[\]\\.,;:\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 _0x54a6c6['test'](String(_0x59867b)[_0x127d('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x9d46=['push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','format','%s:\x20%s','key','keyContent','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','getString','length','sortBy','type'];(function(_0x1ed63e,_0x51057f){var _0x50aef1=function(_0x3042f6){while(--_0x3042f6){_0x1ed63e['push'](_0x1ed63e['shift']());}};_0x50aef1(++_0x51057f);}(_0x9d46,0xf7));var _0x69d4=function(_0x2c0fd2,_0x4d60e0){_0x2c0fd2=_0x2c0fd2-0x0;var _0x39b473=_0x9d46[_0x2c0fd2];return _0x39b473;};'use strict';var _=require(_0x69d4('0x0'));var util=require('util');exports[_0x69d4('0x1')]=function(_0x327b9c,_0x4e8f8c,_0x2bf61c){var _0xf6aa09=[];if(_0x327b9c[_0x69d4('0x2')]>0x0){var _0x43926b=_[_0x69d4('0x3')](_0x327b9c,['id']);for(var _0x355059=0x0;_0x355059<_0x43926b['length'];_0x355059++){var _0x3b717d=_0x43926b[_0x355059];if(_0x3b717d[_0x69d4('0x4')]==='string'){_0xf6aa09[_0x69d4('0x5')](_0x3b717d[_0x69d4('0x6')]);}else if(_0x3b717d[_0x69d4('0x4')]==='variable'&&_0x3b717d[_0x69d4('0x7')]){_0x4e8f8c[_0x3b717d['variableName']]&&_0xf6aa09[_0x69d4('0x5')](_0x4e8f8c[_0x3b717d[_0x69d4('0x7')]][_0x69d4('0x8')]());}else if(_0x3b717d[_0x69d4('0x4')]===_0x69d4('0x9')&&_0x3b717d[_0x69d4('0xa')]&&_0x3b717d['Variable'][_0x69d4('0xb')]){_0x4e8f8c[_0x3b717d['Variable'][_0x69d4('0xb')]['toLowerCase']()]&&_0xf6aa09['push'](_0x4e8f8c[_0x3b717d[_0x69d4('0xa')]['name'][_0x69d4('0xc')]()][_0x69d4('0x8')]());}else if(_0x3b717d[_0x69d4('0x4')]===_0x69d4('0xd')){if(_0x3b717d[_0x69d4('0xe')]===_0x69d4('0xf')&&_0x3b717d['key']){_0xf6aa09[_0x69d4('0x5')](util[_0x69d4('0x10')](_0x69d4('0x11'),_0x3b717d[_0x69d4('0x12')],_0x3b717d[_0x69d4('0x13')]));}else if(_0x3b717d['keyType']===_0x69d4('0x14')&&_0x3b717d[_0x69d4('0x7')]&&_0x3b717d[_0x69d4('0x12')]){_0x4e8f8c[_0x3b717d[_0x69d4('0x7')]]&&_0xf6aa09[_0x69d4('0x5')](util[_0x69d4('0x10')]('%s:\x20%s',_0x3b717d[_0x69d4('0x12')],_0x4e8f8c[_0x3b717d['variableName']]));}else if(_0x3b717d['keyType']===_0x69d4('0x9')&&_0x3b717d[_0x69d4('0xa')]&&_0x3b717d['Variable'][_0x69d4('0xb')]&&_0x3b717d[_0x69d4('0x12')]){_0x4e8f8c[_0x3b717d['Variable'][_0x69d4('0xb')][_0x69d4('0xc')]()]&&_0xf6aa09['push'](util[_0x69d4('0x10')](_0x69d4('0x11'),_0x3b717d[_0x69d4('0x12')],_0x4e8f8c[_0x3b717d[_0x69d4('0xa')][_0x69d4('0xb')][_0x69d4('0xc')]()]));}}}}return _0xf6aa09[_0x69d4('0x15')](_0x2bf61c);};exports[_0x69d4('0x16')]=function(_0x35aa46){var _0x566ca9=_0x35aa46[_0x69d4('0x17')](-0x1);if(_0x566ca9==='/'){_0x35aa46=_0x35aa46[_0x69d4('0x18')](0x0,_0x35aa46[_0x69d4('0x19')](_0x566ca9));}return _0x35aa46;};exports[_0x69d4('0x1a')]=function(_0x417741){if(!_['isNil'](_0x417741)&&_0x417741!==''){var _0x28465f=/^(([^<>()\[\]\\.,;:\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 _0x28465f[_0x69d4('0x1b')](String(_0x417741)[_0x69d4('0xc')]());}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 2989843..fd4f37b 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(_0x4ea75d,_0x3ea60b){var _0x39f0a6=function(_0x3ade9f){while(--_0x3ade9f){_0x4ea75d['push'](_0x4ea75d['shift']());}};_0x39f0a6(++_0x3ea60b);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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 _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(_0x5a820e,_0x1b3a4c){var _0x2aa5c0=function(_0x52bf5b){while(--_0x52bf5b){_0x5a820e['push'](_0x5a820e['shift']());}};_0x2aa5c0(++_0x1b3a4c);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index fbe46ef..3d99853 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 _0x2fe0=['toString','base64','stringify','defaults','GET','forEach','string','picklist','type','nameField','customField','content','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','serverUrl','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','POST','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s'];(function(_0x45eebe,_0x296d4f){var _0x4bff2d=function(_0x1db4d1){while(--_0x1db4d1){_0x45eebe['push'](_0x45eebe['shift']());}};_0x4bff2d(++_0x296d4f);}(_0x2fe0,0x111));var _0x02fe=function(_0x27cc12,_0x218915){_0x27cc12=_0x27cc12-0x0;var _0x4e947d=_0x2fe0[_0x27cc12];return _0x4e947d;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x02fe('0x0'));var util=require(_0x02fe('0x1'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x02fe('0x2'));var logger=require('../../../../config/logger')(_0x02fe('0x3'));config[_0x02fe('0x4')]=_['defaults'](config['redis'],{'host':_0x02fe('0x5'),'port':0x18eb});var io=require(_0x02fe('0x6'))(new Redis(config['redis']));function emit(_0x13e296,_0xa88638,_0x206f18){io['to'](_0x13e296)['emit'](_0xa88638,_0x206f18);}var headers={'Content-Type':_0x02fe('0x7'),'Accept':'application/json'};function getTicket(_0x5653aa,_0x3f48dc,_0x453a53,_0x3c41a8,_0x1d2617){logger[_0x02fe('0x8')](_0x02fe('0x9'));return request({'uri':util['format'](_0x02fe('0xa'),_0x5653aa['remoteUri']),'method':_0x02fe('0xb'),'body':{'ticket':_['merge']({'requester_id':_0x453a53['id'],'submitter_id':_0x3f48dc?_0x3f48dc['id']:undefined,'assignee_id':_0x3f48dc?_0x3f48dc['id']:undefined,'tags':getTags(_0x3c41a8[_0x02fe('0xc')],_0x02fe('0xd')),'subject':intUtil[_0x02fe('0xe')](_0x3c41a8[_0x02fe('0xf')],_0x1d2617,'\x20'),'description':intUtil[_0x02fe('0xe')](_0x3c41a8[_0x02fe('0x10')],_0x1d2617,'\x0a'),'comment':{'public':![],'body':intUtil[_0x02fe('0xe')](_0x3c41a8[_0x02fe('0x10')],_0x1d2617,'\x0a')}},getCustomFields(_0x3c41a8['Fields'],_0x1d2617))}})[_0x02fe('0x11')](function(_0x57ef9a){logger[_0x02fe('0x8')](_0x02fe('0x12'));return _0x57ef9a[_0x02fe('0x13')];});}function getUser(_0x54dc41,_0x305434){if(intUtil[_0x02fe('0x14')](_0x305434)){logger[_0x02fe('0x8')](_0x02fe('0x15'),_0x305434);return request({'uri':util[_0x02fe('0x16')](_0x02fe('0x17'),_0x54dc41[_0x02fe('0x18')]),'qs':{'query':util[_0x02fe('0x16')]('type:user\x20role:agent\x20email:%s',_0x305434)}})[_0x02fe('0x11')](function(_0x514101){if(_0x514101['count']){logger[_0x02fe('0x8')](_0x02fe('0x19'));return _[_0x02fe('0x1a')](_0x514101[_0x02fe('0x1b')],{'email':_0x305434,'role':_0x02fe('0x1c')});}else{logger[_0x02fe('0x8')](_0x02fe('0x1d'));return request({'uri':util[_0x02fe('0x16')]('%s/users/me.json',_0x54dc41[_0x02fe('0x18')])})[_0x02fe('0x11')](function(_0x5e7799){logger[_0x02fe('0x8')]('Admin\x20account\x20selected.');return _0x5e7799[_0x02fe('0x1e')];});}});}else{logger[_0x02fe('0x8')](_0x02fe('0x1d'));return request({'uri':util[_0x02fe('0x16')](_0x02fe('0x1f'),_0x54dc41['remoteUri'])})[_0x02fe('0x11')](function(_0x27fd55){logger['info'](_0x02fe('0x20'));return _0x27fd55[_0x02fe('0x1e')];});}}function getEndUser(_0x23c7fa,_0x5a0003,_0x4ef6ba){logger[_0x02fe('0x8')]('Searching\x20enduser\x20with\x20phone',_0x4ef6ba);return request({'uri':util[_0x02fe('0x16')]('%s/search.json',_0x23c7fa[_0x02fe('0x18')]),'qs':{'query':util[_0x02fe('0x16')]('type:user\x20role:end-user\x20phone:%s',_0x4ef6ba)}})[_0x02fe('0x11')](function(_0x2cc20e){var _0x515d7d;if(_0x2cc20e[_0x02fe('0x1b')][_0x02fe('0x21')]){_0x2cc20e['results']=_[_0x02fe('0x22')](_0x2cc20e['results'],{'suspended':![],'role':_0x02fe('0x23')});if(_0x2cc20e[_0x02fe('0x1b')]['length']){_0x515d7d=_[_0x02fe('0x24')](_0x2cc20e[_0x02fe('0x1b')]);}}if(_0x515d7d){logger[_0x02fe('0x8')](_0x02fe('0x25'));return _0x515d7d;}else{logger[_0x02fe('0x8')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x02fe('0x26'),_0x23c7fa[_0x02fe('0x18')]),'method':_0x02fe('0xb'),'body':{'user':{'role':_0x02fe('0x23'),'name':util['format'](_0x02fe('0x27'),_0x5a0003||_0x4ef6ba),'phone':_0x4ef6ba}}})['then'](function(_0x4489b8){logger['info'](_0x02fe('0x28'));return _0x4489b8[_0x02fe('0x1e')];});}});}function getAuth(_0x3c8e4d){var _0x26821c;if(_0x3c8e4d['authType']===_0x02fe('0x29')){_0x26821c=util[_0x02fe('0x16')](_0x02fe('0x2a'),_0x3c8e4d[_0x02fe('0x2b')],_0x3c8e4d['password']);}else if(_0x3c8e4d[_0x02fe('0x2c')]===_0x02fe('0x2d')){_0x26821c=util[_0x02fe('0x16')](_0x02fe('0x2e'),_0x3c8e4d['username'],_0x3c8e4d[_0x02fe('0x2d')]);}return util[_0x02fe('0x16')](_0x02fe('0x2f'),new Buffer(_0x26821c)[_0x02fe('0x30')](_0x02fe('0x31')));}function request(_0x1264d7){logger['debug']('[HTTP]',JSON[_0x02fe('0x32')](_0x1264d7));return rp(_[_0x02fe('0x33')](_0x1264d7,{'method':_0x02fe('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x5078d2,_0x11e213){var _0x21e779=[];if(_0x5078d2&&_0x5078d2['length']>0x0){_0x21e779=_['map'](_0x5078d2,_0x11e213);}return _0x21e779;}function getCustomFields(_0x4f754a,_0x1c9688){var _0x2fbae2=[];var _0x4dbfc9={'custom_fields':[]};if(_0x4f754a[_0x02fe('0x21')]>0x0){_[_0x02fe('0x35')](_0x4f754a,function(_0x2c96f3){if(_['includes']([_0x02fe('0x36'),_0x02fe('0x37')],_0x2c96f3[_0x02fe('0x38')])&&_0x2c96f3[_0x02fe('0x39')]&&!_0x2c96f3[_0x02fe('0x3a')]){_0x4dbfc9[_0x2c96f3[_0x02fe('0x39')]['toLowerCase']()]=_0x2c96f3[_0x02fe('0x3b')][_0x02fe('0x30')]();}else if(_['includes']([_0x02fe('0x36'),'picklist'],_0x2c96f3[_0x02fe('0x38')])&&_0x2c96f3['idField']&&_0x2c96f3[_0x02fe('0x3a')]){_0x4dbfc9[_0x02fe('0x3c')][_0x02fe('0x3d')]({'id':_0x2c96f3[_0x02fe('0x3e')],'value':_0x2c96f3[_0x02fe('0x3b')][_0x02fe('0x30')]()});}else if(_0x2c96f3['type']===_0x02fe('0x3f')&&_0x2c96f3[_0x02fe('0x40')]&&_0x2c96f3[_0x02fe('0x3e')]&&_0x2c96f3[_0x02fe('0x3a')]){_0x1c9688[_0x2c96f3[_0x02fe('0x40')]]&&_0x4dbfc9[_0x02fe('0x3c')][_0x02fe('0x3d')]({'id':_0x2c96f3[_0x02fe('0x3e')],'value':_0x1c9688[_0x2c96f3['variableName']][_0x02fe('0x30')]()});}else if(_0x2c96f3[_0x02fe('0x38')]===_0x02fe('0x41')&&_0x2c96f3[_0x02fe('0x42')]&&_0x2c96f3[_0x02fe('0x42')]['name']&&_0x2c96f3[_0x02fe('0x3e')]&&_0x2c96f3['customField']){_0x1c9688[_0x2c96f3[_0x02fe('0x42')][_0x02fe('0xd')][_0x02fe('0x43')]()]&&_0x4dbfc9['custom_fields'][_0x02fe('0x3d')]({'id':_0x2c96f3[_0x02fe('0x3e')],'value':_0x1c9688[_0x2c96f3[_0x02fe('0x42')][_0x02fe('0xd')][_0x02fe('0x43')]()][_0x02fe('0x30')]()});}});}return _0x4dbfc9;}exports[_0x02fe('0x44')]=function(_0x4ea25f,_0x253db0,_0x656db7,_0x2d5f92,_0x39b5a3,_0x235542){var _0x2704a9,_0x2812dd;_0x235542[_0x02fe('0x18')]=intUtil['stripTrailingSlash'](_0x235542[_0x02fe('0x18')]);_0x235542['serverUrl']=intUtil[_0x02fe('0x45')](_0x235542['serverUrl']);if(_0x39b5a3&&_0x39b5a3['monitor_format']){logger[_0x02fe('0x8')](_0x02fe('0x46'),_0x02fe('0x47'));_0x253db0['recordingURL']=util[_0x02fe('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x235542[_0x02fe('0x48')],_0x253db0[_0x02fe('0x49')],md5(_0x253db0[_0x02fe('0x49')]));}else{_0x253db0[_0x02fe('0x4a')]='';}headers[_0x02fe('0x4b')]=getAuth(_0x235542);return getUser(_0x235542,_0x2d5f92[_0x02fe('0x4c')])[_0x02fe('0x11')](function(_0x29cc42){_0x2704a9=_0x29cc42;logger[_0x02fe('0x8')](_0x02fe('0x4d'),_0x2704a9['id']);return getEndUser(_0x235542,_0x253db0[_0x02fe('0x4e')],_0x253db0['calleridnum']);})[_0x02fe('0x11')](function(_0x477394){_0x2812dd=_0x477394;logger[_0x02fe('0x8')](_0x02fe('0x4f'),_0x2812dd['id']);return getTicket(_0x235542,_0x2704a9,_0x2812dd,_0x656db7,_0x253db0);})['then'](function(_0x177c88){if(_0x177c88){logger[_0x02fe('0x8')](_0x02fe('0x50'),_0x177c88['id']);switch(_0x235542[_0x02fe('0x38')]){case _0x02fe('0x51'):logger[_0x02fe('0x8')](_0x02fe('0x46'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x02fe('0x16')](_0x02fe('0x52'),_0x235542[_0x02fe('0x18')],_0x2704a9['id'],_0x177c88['id']),'method':_0x02fe('0xb')});case _0x02fe('0x53'):logger[_0x02fe('0x8')](_0x02fe('0x46'),_0x02fe('0x54'));emit(util[_0x02fe('0x16')]('user:%s',_0x2d5f92['name']),_0x02fe('0x55'),{'uri':util[_0x02fe('0x16')](_0x02fe('0x56'),_0x235542[_0x02fe('0x18')][_0x02fe('0x57')](_0x02fe('0x58'),''),_0x177c88['id'])});break;default:logger[_0x02fe('0x59')](_0x02fe('0x46'),_0x02fe('0x5a'));}}})[_0x02fe('0x5b')](function(_0xdb4d48){logger[_0x02fe('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x02fe('0x5c')](_0xdb4d48,{'showHidden':!![],'depth':null}));});};exports[_0x02fe('0x5d')]=function(_0x519fb5,_0x2ca866,_0x5581cb,_0x2329b2,_0x140f04,_0x1e8a22,_0x9588a1){var _0x2a1445,_0x110ef8;_0x1e8a22['remoteUri']=intUtil[_0x02fe('0x45')](_0x1e8a22[_0x02fe('0x18')]);_0x1e8a22[_0x02fe('0x48')]=intUtil[_0x02fe('0x45')](_0x1e8a22[_0x02fe('0x48')]);if(_0x9588a1&&_0x9588a1['recordingFormat']&&_0x9588a1[_0x02fe('0x5e')]!==_0x02fe('0x5f')){logger['info'](_0x02fe('0x60'),_0x02fe('0x47'));_0x2ca866[_0x02fe('0x4a')]=util[_0x02fe('0x16')](_0x02fe('0x61'),_0x1e8a22[_0x02fe('0x48')],_0x2ca866['uniqueid'],md5(_0x2ca866[_0x02fe('0x49')]));}headers[_0x02fe('0x4b')]=getAuth(_0x1e8a22);return getUser(_0x1e8a22,_0x2329b2[_0x02fe('0x4c')])[_0x02fe('0x11')](function(_0x2845df){_0x2a1445=_0x2845df;logger[_0x02fe('0x8')](_0x02fe('0x4d'),_0x2a1445['id']);return getEndUser(_0x1e8a22,_0x2ca866[_0x02fe('0x62')],_0x2ca866[_0x02fe('0x63')]);})['then'](function(_0x499f29){_0x110ef8=_0x499f29;logger[_0x02fe('0x8')](_0x02fe('0x4f'),_0x110ef8['id']);return getTicket(_0x1e8a22,_0x2a1445,_0x110ef8,_0x5581cb,_0x2ca866);})[_0x02fe('0x11')](function(_0x5de802){if(_0x5de802){logger[_0x02fe('0x8')](_0x02fe('0x50'),_0x5de802['id']);switch(_0x1e8a22[_0x02fe('0x38')]){case'integrationTab':logger[_0x02fe('0x8')](_0x02fe('0x60'),_0x02fe('0x64'));return request({'uri':util['format'](_0x02fe('0x52'),_0x1e8a22[_0x02fe('0x18')],_0x2a1445['id'],_0x5de802['id']),'method':_0x02fe('0xb')});case _0x02fe('0x53'):logger[_0x02fe('0x8')]('[OUTBOUND]',_0x02fe('0x54'));emit(util[_0x02fe('0x16')](_0x02fe('0x65'),_0x2329b2[_0x02fe('0xd')]),'trigger:browser:url',{'uri':util[_0x02fe('0x16')](_0x02fe('0x56'),_0x1e8a22[_0x02fe('0x18')][_0x02fe('0x57')]('/api/v2',''),_0x5de802['id'])});break;default:logger['error'](_0x02fe('0x60'),_0x02fe('0x5a'));}}})[_0x02fe('0x5b')](function(_0x40a7cb){logger[_0x02fe('0x59')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x02fe('0x5c')](_0x40a7cb,{'showHidden':!![],'depth':null}));});};exports[_0x02fe('0x66')]=function(_0x3f6352,_0x18f1ef,_0x219961,_0x19e706,_0x275c76,_0x37f88a){var _0x15b6de,_0x56dc02;_0x37f88a[_0x02fe('0x18')]=intUtil[_0x02fe('0x45')](_0x37f88a['remoteUri']);_0x37f88a[_0x02fe('0x48')]=intUtil[_0x02fe('0x45')](_0x37f88a['serverUrl']);if(_0x275c76&&_0x275c76[_0x02fe('0x67')]){logger[_0x02fe('0x8')]('['+_0x18f1ef[_0x02fe('0x68')][_0x02fe('0x69')]()+']',_0x02fe('0x47'));_0x18f1ef['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x37f88a[_0x02fe('0x48')],_0x18f1ef[_0x02fe('0x49')],md5(_0x18f1ef['uniqueid']));}else{_0x18f1ef['recordingURL']='';}headers[_0x02fe('0x4b')]=getAuth(_0x37f88a);return getUser(_0x37f88a)[_0x02fe('0x11')](function(_0x6e59d0){_0x15b6de=_0x6e59d0;logger[_0x02fe('0x8')](_0x02fe('0x4d'),_0x15b6de['id']);return getEndUser(_0x37f88a,_0x18f1ef['calleridname'],_0x18f1ef['calleridnum']);})[_0x02fe('0x11')](function(_0x360bfe){_0x56dc02=_0x360bfe;logger[_0x02fe('0x8')](_0x02fe('0x4f'),_0x56dc02['id']);return getTicket(_0x37f88a,_0x15b6de,_0x56dc02,_0x219961,_0x18f1ef);})['then'](function(_0xd2cf47){if(_0xd2cf47){logger['info']('The\x20Ticket\x20ID\x20is:',_0xd2cf47['id']);}})[_0x02fe('0x5b')](function(_0x6c3af4){logger[_0x02fe('0x59')]('['+_0x18f1ef['lastevent'][_0x02fe('0x69')]()+']'+_0x02fe('0x6a'),util[_0x02fe('0x5c')](_0x6c3af4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd824=['nameField','toLowerCase','content','idField','customField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','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','none','[OUTBOUND]','destcalleridname','destcalleridnum','newTab','catch','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','application/json','format','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd824,0x111));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4d82('0x0'));var rp=require(_0x4d82('0x1'));var md5=require(_0x4d82('0x2'));var util=require(_0x4d82('0x3'));var Redis=require(_0x4d82('0x4'));var intUtil=require(_0x4d82('0x5'));var config=require(_0x4d82('0x6'));var logger=require(_0x4d82('0x7'))(_0x4d82('0x8'));config[_0x4d82('0x9')]=_[_0x4d82('0xa')](config[_0x4d82('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x26e072,_0x245a59,_0x4135d5){io['to'](_0x26e072)['emit'](_0x245a59,_0x4135d5);}var headers={'Content-Type':_0x4d82('0xb'),'Accept':_0x4d82('0xb')};function getTicket(_0x190e98,_0x259c47,_0x4693fe,_0x34508a,_0x57f573){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x4d82('0xc')]('%s/tickets.json',_0x190e98[_0x4d82('0xd')]),'method':_0x4d82('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x4693fe['id'],'submitter_id':_0x259c47?_0x259c47['id']:undefined,'assignee_id':_0x259c47?_0x259c47['id']:undefined,'tags':getTags(_0x34508a[_0x4d82('0xf')],_0x4d82('0x10')),'subject':intUtil[_0x4d82('0x11')](_0x34508a[_0x4d82('0x12')],_0x57f573,'\x20'),'description':intUtil[_0x4d82('0x11')](_0x34508a[_0x4d82('0x13')],_0x57f573,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4d82('0x11')](_0x34508a['Descriptions'],_0x57f573,'\x0a')}},getCustomFields(_0x34508a['Fields'],_0x57f573))}})['then'](function(_0x5223a9){logger['info']('Ticket\x20created!');return _0x5223a9[_0x4d82('0x14')];});}function getUser(_0x3291a2,_0x4fc6e2){if(intUtil[_0x4d82('0x15')](_0x4fc6e2)){logger[_0x4d82('0x16')](_0x4d82('0x17'),_0x4fc6e2);return request({'uri':util[_0x4d82('0xc')](_0x4d82('0x18'),_0x3291a2[_0x4d82('0xd')]),'qs':{'query':util[_0x4d82('0xc')](_0x4d82('0x19'),_0x4fc6e2)}})[_0x4d82('0x1a')](function(_0x4c50e2){if(_0x4c50e2['count']){logger['info'](_0x4d82('0x1b'));return _[_0x4d82('0x1c')](_0x4c50e2[_0x4d82('0x1d')],{'email':_0x4fc6e2,'role':'agent'});}else{logger[_0x4d82('0x16')](_0x4d82('0x1e'));return request({'uri':util[_0x4d82('0xc')](_0x4d82('0x1f'),_0x3291a2[_0x4d82('0xd')])})[_0x4d82('0x1a')](function(_0x14b02a){logger[_0x4d82('0x16')]('Admin\x20account\x20selected.');return _0x14b02a[_0x4d82('0x20')];});}});}else{logger[_0x4d82('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4d82('0xc')](_0x4d82('0x1f'),_0x3291a2[_0x4d82('0xd')])})['then'](function(_0x23cc14){logger['info'](_0x4d82('0x21'));return _0x23cc14[_0x4d82('0x20')];});}}function getEndUser(_0x1f4cc2,_0x5bcdaf,_0x2eac0c){logger[_0x4d82('0x16')](_0x4d82('0x22'),_0x2eac0c);return request({'uri':util[_0x4d82('0xc')](_0x4d82('0x18'),_0x1f4cc2[_0x4d82('0xd')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2eac0c)}})[_0x4d82('0x1a')](function(_0x28e638){var _0x2c2991;if(_0x28e638[_0x4d82('0x1d')][_0x4d82('0x23')]){_0x28e638['results']=_[_0x4d82('0x24')](_0x28e638[_0x4d82('0x1d')],{'suspended':![],'role':'end-user'});if(_0x28e638[_0x4d82('0x1d')][_0x4d82('0x23')]){_0x2c2991=_[_0x4d82('0x25')](_0x28e638['results']);}}if(_0x2c2991){logger[_0x4d82('0x16')](_0x4d82('0x26'));return _0x2c2991;}else{logger[_0x4d82('0x16')](_0x4d82('0x27'));return request({'uri':util[_0x4d82('0xc')]('%s/users.json',_0x1f4cc2[_0x4d82('0xd')]),'method':_0x4d82('0xe'),'body':{'user':{'role':_0x4d82('0x28'),'name':util[_0x4d82('0xc')](_0x4d82('0x29'),_0x5bcdaf||_0x2eac0c),'phone':_0x2eac0c}}})[_0x4d82('0x1a')](function(_0x2bad70){logger[_0x4d82('0x16')](_0x4d82('0x2a'));return _0x2bad70[_0x4d82('0x20')];});}});}function getAuth(_0x221161){var _0x316a59;if(_0x221161[_0x4d82('0x2b')]===_0x4d82('0x2c')){_0x316a59=util[_0x4d82('0xc')](_0x4d82('0x2d'),_0x221161[_0x4d82('0x2e')],_0x221161[_0x4d82('0x2c')]);}else if(_0x221161['authType']===_0x4d82('0x2f')){_0x316a59=util[_0x4d82('0xc')]('%s/token:%s',_0x221161[_0x4d82('0x2e')],_0x221161[_0x4d82('0x2f')]);}return util[_0x4d82('0xc')](_0x4d82('0x30'),new Buffer(_0x316a59)[_0x4d82('0x31')](_0x4d82('0x32')));}function request(_0x536ed3){logger[_0x4d82('0x33')](_0x4d82('0x34'),JSON[_0x4d82('0x35')](_0x536ed3));return rp(_['defaults'](_0x536ed3,{'method':_0x4d82('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x36421f,_0x12a0cc){var _0x4282d0=[];if(_0x36421f&&_0x36421f[_0x4d82('0x23')]>0x0){_0x4282d0=_[_0x4d82('0x37')](_0x36421f,_0x12a0cc);}return _0x4282d0;}function getCustomFields(_0x38e9ec,_0x250695){var _0x5f489c=[];var _0x2aad0c={'custom_fields':[]};if(_0x38e9ec[_0x4d82('0x23')]>0x0){_['forEach'](_0x38e9ec,function(_0x4ab6fa){if(_[_0x4d82('0x38')]([_0x4d82('0x39'),_0x4d82('0x3a')],_0x4ab6fa[_0x4d82('0x3b')])&&_0x4ab6fa[_0x4d82('0x3c')]&&!_0x4ab6fa['customField']){_0x2aad0c[_0x4ab6fa[_0x4d82('0x3c')][_0x4d82('0x3d')]()]=_0x4ab6fa[_0x4d82('0x3e')][_0x4d82('0x31')]();}else if(_[_0x4d82('0x38')](['string',_0x4d82('0x3a')],_0x4ab6fa['type'])&&_0x4ab6fa[_0x4d82('0x3f')]&&_0x4ab6fa[_0x4d82('0x40')]){_0x2aad0c[_0x4d82('0x41')][_0x4d82('0x42')]({'id':_0x4ab6fa[_0x4d82('0x3f')],'value':_0x4ab6fa[_0x4d82('0x3e')][_0x4d82('0x31')]()});}else if(_0x4ab6fa[_0x4d82('0x3b')]===_0x4d82('0x43')&&_0x4ab6fa[_0x4d82('0x44')]&&_0x4ab6fa[_0x4d82('0x3f')]&&_0x4ab6fa[_0x4d82('0x40')]){_0x250695[_0x4ab6fa[_0x4d82('0x44')]]&&_0x2aad0c['custom_fields'][_0x4d82('0x42')]({'id':_0x4ab6fa[_0x4d82('0x3f')],'value':_0x250695[_0x4ab6fa[_0x4d82('0x44')]]['toString']()});}else if(_0x4ab6fa[_0x4d82('0x3b')]==='customVariable'&&_0x4ab6fa[_0x4d82('0x45')]&&_0x4ab6fa[_0x4d82('0x45')][_0x4d82('0x10')]&&_0x4ab6fa[_0x4d82('0x3f')]&&_0x4ab6fa[_0x4d82('0x40')]){_0x250695[_0x4ab6fa[_0x4d82('0x45')][_0x4d82('0x10')][_0x4d82('0x3d')]()]&&_0x2aad0c[_0x4d82('0x41')][_0x4d82('0x42')]({'id':_0x4ab6fa[_0x4d82('0x3f')],'value':_0x250695[_0x4ab6fa['Variable'][_0x4d82('0x10')][_0x4d82('0x3d')]()][_0x4d82('0x31')]()});}});}return _0x2aad0c;}exports[_0x4d82('0x46')]=function(_0x13d852,_0x213439,_0x123662,_0x4a606b,_0x1fe062,_0x53c1e9){var _0x25d938,_0x430aae;_0x53c1e9[_0x4d82('0xd')]=intUtil[_0x4d82('0x47')](_0x53c1e9[_0x4d82('0xd')]);_0x53c1e9[_0x4d82('0x48')]=intUtil[_0x4d82('0x47')](_0x53c1e9[_0x4d82('0x48')]);if(_0x1fe062&&_0x1fe062['monitor_format']){logger[_0x4d82('0x16')]('[QUEUE]',_0x4d82('0x49'));_0x213439[_0x4d82('0x4a')]=util[_0x4d82('0xc')](_0x4d82('0x4b'),_0x53c1e9[_0x4d82('0x48')],_0x213439['uniqueid'],md5(_0x213439[_0x4d82('0x4c')]));}else{_0x213439[_0x4d82('0x4a')]='';}headers[_0x4d82('0x4d')]=getAuth(_0x53c1e9);return getUser(_0x53c1e9,_0x4a606b[_0x4d82('0x4e')])[_0x4d82('0x1a')](function(_0x260328){_0x25d938=_0x260328;logger[_0x4d82('0x16')](_0x4d82('0x4f'),_0x25d938['id']);return getEndUser(_0x53c1e9,_0x213439['calleridname'],_0x213439[_0x4d82('0x50')]);})[_0x4d82('0x1a')](function(_0x3618c4){_0x430aae=_0x3618c4;logger['info'](_0x4d82('0x51'),_0x430aae['id']);return getTicket(_0x53c1e9,_0x25d938,_0x430aae,_0x123662,_0x213439);})[_0x4d82('0x1a')](function(_0x1f5943){if(_0x1f5943){logger['info'](_0x4d82('0x52'),_0x1f5943['id']);switch(_0x53c1e9[_0x4d82('0x3b')]){case _0x4d82('0x53'):logger['info']('[QUEUE]',_0x4d82('0x54'));return request({'uri':util['format'](_0x4d82('0x55'),_0x53c1e9['remoteUri'],_0x25d938['id'],_0x1f5943['id']),'method':'POST'});case'newTab':logger[_0x4d82('0x16')](_0x4d82('0x56'),_0x4d82('0x57'));emit(util['format'](_0x4d82('0x58'),_0x4a606b['name']),_0x4d82('0x59'),{'uri':util[_0x4d82('0xc')](_0x4d82('0x5a'),_0x53c1e9[_0x4d82('0xd')][_0x4d82('0x5b')](_0x4d82('0x5c'),''),_0x1f5943['id'])});break;default:logger[_0x4d82('0x5d')]('[QUEUE]',_0x4d82('0x5e'));}}})['catch'](function(_0x41e371){logger[_0x4d82('0x5d')](_0x4d82('0x5f'),util[_0x4d82('0x60')](_0x41e371,{'showHidden':!![],'depth':null}));});};exports[_0x4d82('0x61')]=function(_0x41ee56,_0x5dc2d0,_0x434f40,_0x1ab196,_0x4fabbd,_0x53c170,_0x2101b4){var _0x1d4a94,_0x3ce6c8;_0x53c170['remoteUri']=intUtil['stripTrailingSlash'](_0x53c170[_0x4d82('0xd')]);_0x53c170[_0x4d82('0x48')]=intUtil['stripTrailingSlash'](_0x53c170[_0x4d82('0x48')]);if(_0x2101b4&&_0x2101b4[_0x4d82('0x62')]&&_0x2101b4[_0x4d82('0x62')]!==_0x4d82('0x63')){logger['info'](_0x4d82('0x64'),'Recording\x20is\x20enabled!');_0x5dc2d0[_0x4d82('0x4a')]=util[_0x4d82('0xc')](_0x4d82('0x4b'),_0x53c170[_0x4d82('0x48')],_0x5dc2d0[_0x4d82('0x4c')],md5(_0x5dc2d0[_0x4d82('0x4c')]));}headers[_0x4d82('0x4d')]=getAuth(_0x53c170);return getUser(_0x53c170,_0x1ab196[_0x4d82('0x4e')])[_0x4d82('0x1a')](function(_0x8919d7){_0x1d4a94=_0x8919d7;logger[_0x4d82('0x16')](_0x4d82('0x4f'),_0x1d4a94['id']);return getEndUser(_0x53c170,_0x5dc2d0[_0x4d82('0x65')],_0x5dc2d0[_0x4d82('0x66')]);})[_0x4d82('0x1a')](function(_0xbe2010){_0x3ce6c8=_0xbe2010;logger[_0x4d82('0x16')](_0x4d82('0x51'),_0x3ce6c8['id']);return getTicket(_0x53c170,_0x1d4a94,_0x3ce6c8,_0x434f40,_0x5dc2d0);})[_0x4d82('0x1a')](function(_0x101fec){if(_0x101fec){logger[_0x4d82('0x16')](_0x4d82('0x52'),_0x101fec['id']);switch(_0x53c170['type']){case _0x4d82('0x53'):logger[_0x4d82('0x16')](_0x4d82('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4d82('0xc')](_0x4d82('0x55'),_0x53c170[_0x4d82('0xd')],_0x1d4a94['id'],_0x101fec['id']),'method':_0x4d82('0xe')});case _0x4d82('0x67'):logger[_0x4d82('0x16')](_0x4d82('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4d82('0xc')](_0x4d82('0x58'),_0x1ab196[_0x4d82('0x10')]),_0x4d82('0x59'),{'uri':util['format'](_0x4d82('0x5a'),_0x53c170['remoteUri'][_0x4d82('0x5b')](_0x4d82('0x5c'),''),_0x101fec['id'])});break;default:logger['error'](_0x4d82('0x64'),_0x4d82('0x5e'));}}})[_0x4d82('0x68')](function(_0x479d96){logger[_0x4d82('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4d82('0x60')](_0x479d96,{'showHidden':!![],'depth':null}));});};exports[_0x4d82('0x69')]=function(_0x5121b1,_0x2fad60,_0x3a2876,_0x2eec2e,_0x524d00,_0x59ad23){var _0x8a31f0,_0x3210c6;_0x59ad23[_0x4d82('0xd')]=intUtil[_0x4d82('0x47')](_0x59ad23['remoteUri']);_0x59ad23['serverUrl']=intUtil[_0x4d82('0x47')](_0x59ad23[_0x4d82('0x48')]);if(_0x524d00&&_0x524d00[_0x4d82('0x6a')]){logger[_0x4d82('0x16')]('['+_0x2fad60['lastevent'][_0x4d82('0x6b')]()+']','Recording\x20is\x20enabled!');_0x2fad60[_0x4d82('0x4a')]=util[_0x4d82('0xc')](_0x4d82('0x4b'),_0x59ad23[_0x4d82('0x48')],_0x2fad60[_0x4d82('0x4c')],md5(_0x2fad60[_0x4d82('0x4c')]));}else{_0x2fad60['recordingURL']='';}headers['Authorization']=getAuth(_0x59ad23);return getUser(_0x59ad23)[_0x4d82('0x1a')](function(_0x3073a1){_0x8a31f0=_0x3073a1;logger[_0x4d82('0x16')](_0x4d82('0x4f'),_0x8a31f0['id']);return getEndUser(_0x59ad23,_0x2fad60[_0x4d82('0x6c')],_0x2fad60[_0x4d82('0x50')]);})[_0x4d82('0x1a')](function(_0x2c9584){_0x3210c6=_0x2c9584;logger[_0x4d82('0x16')](_0x4d82('0x51'),_0x3210c6['id']);return getTicket(_0x59ad23,_0x8a31f0,_0x3210c6,_0x3a2876,_0x2fad60);})[_0x4d82('0x1a')](function(_0x5e4102){if(_0x5e4102){logger[_0x4d82('0x16')](_0x4d82('0x52'),_0x5e4102['id']);}})[_0x4d82('0x68')](function(_0x36f65b){logger[_0x4d82('0x5d')]('['+_0x2fad60[_0x4d82('0x6d')][_0x4d82('0x6b')]()+']'+_0x4d82('0x6e'),util[_0x4d82('0x60')](_0x36f65b,{'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 a4fcb27..f3d581a 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 _0xab44=['error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','moduleCreate','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','profile','administrator','getString','Subjects','Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','connect','Call_Result','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','https://crm.','unmanaged','monitor_format','toUpperCase','lodash','request-promise','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','localhost','socket.io-emitter','redis','emit','[HTTP]','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xab44,0x1aa));var _0x4ab4=function(_0x1bbfb7,_0x1707e0){_0x1bbfb7=_0x1bbfb7-0x0;var _0x4306cf=_0xab44[_0x1bbfb7];return _0x4306cf;};'use strict';var _=require(_0x4ab4('0x0'));var rp=require(_0x4ab4('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x4ab4('0x2'));var moment=require(_0x4ab4('0x3'));var Redis=require(_0x4ab4('0x4'));var BPromise=require(_0x4ab4('0x5'));var config=require(_0x4ab4('0x6'));var logger=require(_0x4ab4('0x7'))(_0x4ab4('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x4ab4('0x9'),'port':0x18eb});var io=require(_0x4ab4('0xa'))(new Redis(config[_0x4ab4('0xb')]));function emit(_0x1b6d52,_0x2c5943,_0x33dc83){io['to'](_0x1b6d52)[_0x4ab4('0xc')](_0x2c5943,_0x33dc83);}function request(_0x16c058){logger['debug'](_0x4ab4('0xd'),JSON['stringify'](_0x16c058));return rp(_0x16c058);}function getCustomFields(_0x3fcea7,_0x374e4b){var _0x14b472={};if(_0x3fcea7[_0x4ab4('0xe')]>0x0){_[_0x4ab4('0xf')](_0x3fcea7,function(_0x515b83){if(_['includes']([_0x4ab4('0x10'),_0x4ab4('0x11')],_0x515b83[_0x4ab4('0x12')])&&_0x515b83[_0x4ab4('0x13')]){_0x14b472[_0x515b83['idField']]=_0x515b83[_0x4ab4('0x14')][_0x4ab4('0x15')]();}else if(_0x515b83[_0x4ab4('0x12')]===_0x4ab4('0x16')&&_0x515b83[_0x4ab4('0x17')]&&_0x515b83[_0x4ab4('0x13')]&&_0x374e4b[_0x515b83['variableName']]){_0x14b472[_0x515b83[_0x4ab4('0x13')]]=_0x374e4b[_0x515b83['variableName']][_0x4ab4('0x15')]();}else if(_0x515b83[_0x4ab4('0x12')]===_0x4ab4('0x18')&&_0x515b83[_0x4ab4('0x19')]&&_0x515b83[_0x4ab4('0x19')][_0x4ab4('0x1a')]&&_0x515b83['idField']&&_0x374e4b[_0x515b83[_0x4ab4('0x19')][_0x4ab4('0x1a')][_0x4ab4('0x1b')]()]){_0x14b472[_0x515b83['idField']]=_0x374e4b[_0x515b83[_0x4ab4('0x19')][_0x4ab4('0x1a')][_0x4ab4('0x1b')]()][_0x4ab4('0x15')]();}});}return _0x14b472;}function getName(_0x2a543c){if(_0x2a543c[_0x4ab4('0x1c')]('\x20')>0x0){var _0x228b45=_0x2a543c[_0x4ab4('0x1d')](/ (.+)/);if(_0x228b45[0x1]){return _0x228b45;}}return[_0x2a543c,_0x2a543c];}var accountsTokens={};function getAccessToken(_0x560efa){return new Promise(function(_0x3b69d5,_0x29726e){if(!_[_0x4ab4('0x1e')](accountsTokens[_0x560efa['id']])&&!_[_0x4ab4('0x1e')](accountsTokens[_0x560efa['id']][_0x4ab4('0x1f')])){if(moment()[_0x4ab4('0x20')](accountsTokens[_0x560efa['id']][_0x4ab4('0x21')])){_0x3b69d5(accountsTokens[_0x560efa['id']]['access_token']);}}var _0x521d6f;switch(_0x560efa[_0x4ab4('0x22')]){case'US':_0x521d6f=_0x4ab4('0x23');break;case'AU':_0x521d6f=_0x4ab4('0x24');break;case'EU':_0x521d6f=_0x4ab4('0x25');break;case'IN':_0x521d6f=_0x4ab4('0x26');break;case'CN':_0x521d6f=_0x4ab4('0x27');break;default:_0x521d6f=_0x4ab4('0x25');break;}var _0xb9198={'method':'POST','uri':_0x521d6f+_0x4ab4('0x28'),'qs':{'refresh_token':_0x560efa[_0x4ab4('0x29')],'client_id':_0x560efa[_0x4ab4('0x2a')],'client_secret':_0x560efa[_0x4ab4('0x2b')],'grant_type':_0x4ab4('0x2c')},'json':!![]};return rp(_0xb9198)[_0x4ab4('0x2d')](function(_0x446adc){accountsTokens[_0x560efa['id']]={'access_token':_0x446adc[_0x4ab4('0x1f')],'expires_in':moment()[_0x4ab4('0x2e')](_0x446adc[_0x4ab4('0x21')],_0x4ab4('0x2f'))};_0x3b69d5(_0x446adc[_0x4ab4('0x1f')]);})['catch'](function(_0x49d6d3){logger[_0x4ab4('0x30')]('Failing\x20creating\x20the\x20access_token',_0x49d6d3[_0x4ab4('0x31')]);_0x29726e(_0x49d6d3);});});}function getUser(_0xf2d47,_0x57dce4,_0x3b0392,_0x4e6e3e){logger[_0x4ab4('0x32')](_0x4ab4('0x33'));return request({'method':_0x4ab4('0x34'),'uri':util[_0x4ab4('0x35')](_0x4ab4('0x36'),_0x57dce4),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x4ab4('0x37')+_0xf2d47},'json':!![]})[_0x4ab4('0x2d')](function(_0x5aa23a){if(_0x5aa23a[_0x4ab4('0x38')]){var _0x37cbcc=-0x1;if(_[_0x4ab4('0x39')](_0x5aa23a[_0x4ab4('0x38')])){if(!_[_0x4ab4('0x1e')](_0x4e6e3e)){_0x37cbcc=_[_0x4ab4('0x3a')](_0x5aa23a[_0x4ab4('0x38')],function(_0x5a450c){return _0x5a450c[_0x4ab4('0x3b')]===_0x4e6e3e;});}if(_0x37cbcc>=0x0){logger[_0x4ab4('0x32')](_0x4ab4('0x3c'));}else{logger[_0x4ab4('0x32')]('Using\x20the\x20admin\x20account!');_0x37cbcc=_['findIndex'](_0x5aa23a['users'],function(_0x45fb9a){return _0x45fb9a['profile']['name']===_0x4ab4('0x3d');});}return _0x5aa23a['users'][_0x37cbcc];}else{if(_0x5aa23a[_0x4ab4('0x3e')]['profile'][_0x4ab4('0x1a')]===_0x4ab4('0x3d')){logger[_0x4ab4('0x32')](_0x4ab4('0x3f'));user=_0x5aa23a[_0x4ab4('0x3e')];return user;}else{logger[_0x4ab4('0x30')](_0x4ab4('0x40'),JSON[_0x4ab4('0x41')](_0x5aa23a));throw new Error(_0x4ab4('0x42')+JSON[_0x4ab4('0x41')](_0x5aa23a));}}}else{logger[_0x4ab4('0x30')](_0x4ab4('0x40'),JSON[_0x4ab4('0x41')](_0x5aa23a));throw new Error(_0x4ab4('0x42')+JSON[_0x4ab4('0x41')](_0x5aa23a));}})[_0x4ab4('0x43')](function(_0x2a6647){console[_0x4ab4('0x30')](_0x2a6647);});}function getZohoUser(_0x24cdb2,_0x1731b2){return new BPromise(function(_0x2c6b94,_0x369d87){request(_0x24cdb2)[_0x4ab4('0x2d')](function(_0x57a1fa){var _0x184d23=null;if(_0x57a1fa){_0x184d23=_0x57a1fa[_0x4ab4('0x44')][0x0];_0x184d23['enduserType']=_0x1731b2;}_0x2c6b94(_0x184d23);})[_0x4ab4('0x43')](function(_0x4e70a4){_0x369d87(_0x4e70a4);});});}function createEndUser(_0x209641,_0x25caf9,_0x4f1d72,_0x5905ff,_0x3e23b8,_0x52e574){var _0x4f1d72=getName(_0x4f1d72);return request({'method':_0x4ab4('0x45'),'uri':_0x4ab4('0x46')+_0x25caf9+_0x4ab4('0x47')+_[_0x4ab4('0x48')](_0x52e574['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4f1d72[0x1],'First_Name':_0x4f1d72[0x0],'Phone':_0x5905ff,'Owner':{'name':!_[_0x4ab4('0x1e')](_0x3e23b8[_0x4ab4('0x49')][_0x4ab4('0x1a')])?_0x3e23b8[_0x4ab4('0x49')][_0x4ab4('0x1a')]:!_[_0x4ab4('0x1e')](_0x3e23b8[_0x4ab4('0x4a')])?_0x3e23b8[_0x4ab4('0x4a')]+'\x20'+_0x3e23b8[_0x4ab4('0x4b')]:_0x3e23b8[_0x4ab4('0x4b')],'id':_0x3e23b8['id']}}]},'headers':{'Authorization':_0x4ab4('0x37')+_0x209641},'json':!![]})['then'](function(_0x519d6b){if(_0x519d6b&&_0x519d6b['data'][0x0][_0x4ab4('0x4c')]===_0x4ab4('0x4d')){var _0x2c32c3=_0x519d6b[_0x4ab4('0x44')][0x0]['details'];_0x2c32c3['enduserType']=_[_0x4ab4('0x48')](_0x52e574[_0x4ab4('0x4e')])+'s';return _0x2c32c3;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x4ab4('0x41')](data));throw new Error(_0x4ab4('0x4f')+JSON[_0x4ab4('0x41')](data));})['catch'](function(_0x1a37bd){console[_0x4ab4('0x50')](_0x4ab4('0x51'),_0x1a37bd);});}function getEndUser(_0x1e0fad,_0x2a5c4a,_0x5b79ee,_0x2490a1,_0x450cbe,_0x1e7df5,_0xf6eb4f){var _0x3001da={'method':_0x4ab4('0x34'),'uri':'','headers':{'Authorization':_0x4ab4('0x37')+_0x1e0fad},'json':!![]};switch(_0xf6eb4f['moduleSearch']){case'contact_lead':_0x3001da[_0x4ab4('0x52')]=_0x4ab4('0x46')+_0x2a5c4a+_0x4ab4('0x53')+_0x450cbe+'))';return getZohoUser(_0x3001da,_0x4ab4('0x54'))[_0x4ab4('0x2d')](function(_0x22112e){if(_0x22112e)return _0x22112e;_0x3001da[_0x4ab4('0x52')]='https://www.zohoapis.'+_0x2a5c4a+_0x4ab4('0x55')+_0x450cbe+'))';return getZohoUser(_0x3001da,_0x4ab4('0x56'))[_0x4ab4('0x2d')](function(_0x4cd454){if(_0x4cd454)return _0x4cd454;if(_0xf6eb4f[_0x4ab4('0x4e')]!=_0x4ab4('0x57')){return createEndUser(_0x1e0fad,_0x2a5c4a,_0x2490a1,_0x450cbe,_0x1e7df5,_0xf6eb4f);}else{return{};}});});break;case'contact':_0x3001da[_0x4ab4('0x52')]=_0x4ab4('0x46')+_0x2a5c4a+_0x4ab4('0x53')+_0x450cbe+'))';return getZohoUser(_0x3001da,_0x4ab4('0x54'))[_0x4ab4('0x2d')](function(_0x4c34d4){if(_0x4c34d4)return _0x4c34d4;if(_0xf6eb4f[_0x4ab4('0x4e')]!=_0x4ab4('0x57')){return createEndUser(_0x1e0fad,_0x2a5c4a,_0x2490a1,_0x450cbe,_0x1e7df5,_0xf6eb4f);}else{return{};}});break;case'lead':_0x3001da['uri']=_0x4ab4('0x46')+_0x2a5c4a+_0x4ab4('0x55')+_0x450cbe+'))';return getZohoUser(_0x3001da,_0x4ab4('0x56'))[_0x4ab4('0x2d')](function(_0x117895){if(_0x117895)return _0x117895;if(_0xf6eb4f[_0x4ab4('0x4e')]!='nothing'){return createEndUser(_0x1e0fad,_0x2a5c4a,_0x2490a1,_0x450cbe,_0x1e7df5,_0xf6eb4f);}else{return{};}});break;}}function getCall(_0x2ee426,_0x58ad89,_0x5ef41c,_0x1fcfeb,_0x30069c,_0x5731c5,_0x12c41c,_0x504c47){logger['info'](_0x4ab4('0x58'));var _0x5d544d={};_0x5d544d[_0x4ab4('0x59')]={'name':!_[_0x4ab4('0x1e')](_0x1fcfeb[_0x4ab4('0x49')][_0x4ab4('0x1a')])&&!_[_0x4ab4('0x1e')](_0x1fcfeb[_0x4ab4('0x5a')]['name'])&&_0x1fcfeb[_0x4ab4('0x5a')][_0x4ab4('0x1a')]===_0x4ab4('0x5b')?_0x1fcfeb['role'][_0x4ab4('0x1a')]:!_[_0x4ab4('0x1e')](_0x1fcfeb['first_name'])?_0x1fcfeb[_0x4ab4('0x4a')]+'\x20'+_0x1fcfeb[_0x4ab4('0x4b')]:_0x1fcfeb[_0x4ab4('0x4b')],'id':_0x1fcfeb['id']};_0x5d544d['Subject']=intUtil[_0x4ab4('0x5c')](_0x5731c5[_0x4ab4('0x5d')],_0x12c41c,'\x20');_0x5d544d[_0x4ab4('0x5e')]=intUtil['getString'](_0x5731c5[_0x4ab4('0x5f')],_0x12c41c,'\x0a');if(_0x30069c[_0x4ab4('0x60')]===_0x4ab4('0x54')){_0x5d544d[_0x4ab4('0x61')]={'name':!_[_0x4ab4('0x1e')](_0x30069c[_0x4ab4('0x62')])?_0x30069c[_0x4ab4('0x62')]:!_['isNil'](_0x30069c[_0x4ab4('0x63')])?_0x30069c['First_Name']+'\x20'+_0x30069c['Last_Name']:_0x30069c[_0x4ab4('0x64')],'id':_0x30069c['id']};}if(_0x30069c[_0x4ab4('0x60')]===_0x4ab4('0x56')){_0x5d544d[_0x4ab4('0x65')]={'name':!_[_0x4ab4('0x1e')](_0x30069c[_0x4ab4('0x62')])?_0x30069c['Full_Name']:!_['isNil'](_0x30069c[_0x4ab4('0x63')])?_0x30069c[_0x4ab4('0x63')]+'\x20'+_0x30069c['Last_Name']:_0x30069c['Last_Name'],'id':_0x30069c['id']};_0x5d544d[_0x4ab4('0x66')]=_[_0x4ab4('0x48')](_0x30069c[_0x4ab4('0x60')]);}if(_0x12c41c['talktime']){_0x5d544d[_0x4ab4('0x67')]=moment[_0x4ab4('0x68')](parseInt(_0x12c41c[_0x4ab4('0x69')])*0x3e8)[_0x4ab4('0x35')](_0x4ab4('0x6a'));}else if(_0x12c41c[_0x4ab4('0x6b')]&&_0x12c41c['endtime']){_0x5d544d['Call_Duration']=moment[_0x4ab4('0x68')](moment(_0x12c41c[_0x4ab4('0x6c')],_0x4ab4('0x6d'))[_0x4ab4('0x6e')](moment(_0x12c41c[_0x4ab4('0x6f')],_0x4ab4('0x6d'))))[_0x4ab4('0x35')](_0x4ab4('0x6a'));}switch(_0x12c41c[_0x4ab4('0x70')]){case _0x4ab4('0x71'):_0x5d544d['Call_Result']=_0x4ab4('0x72');break;case _0x4ab4('0x73'):case _0x4ab4('0x74'):_0x5d544d[_0x4ab4('0x75')]='Answered';break;case'rejected':_0x5d544d['Call_Result']=_0x4ab4('0x76');break;case'abandoned':_0x5d544d['Call_Result']=_0x4ab4('0x77');break;case _0x4ab4('0x78'):_0x5d544d['Call_Result']=_0x4ab4('0x79');default:}_0x5d544d[_0x4ab4('0x7a')]=(_0x504c47==='outbound'?moment(_0x12c41c['starttime'])[_0x4ab4('0x35')](_0x4ab4('0x6d')):moment(_0x12c41c[_0x4ab4('0x7b')])[_0x4ab4('0x35')](_0x4ab4('0x6d')))||moment()[_0x4ab4('0x35')](_0x4ab4('0x6d'));_0x5d544d[_0x4ab4('0x7c')]=_0x504c47||_0x4ab4('0x7d');_0x5d544d=_['merge'](_0x5d544d,getCustomFields(_0x5731c5[_0x4ab4('0x7e')],_0x12c41c));return request({'method':_0x4ab4('0x45'),'uri':_0x4ab4('0x46')+_0x58ad89+_0x4ab4('0x7f'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2ee426},'body':{'data':[_0x5d544d]},'json':!![]})[_0x4ab4('0x2d')](function(_0x1a1d62){if(_0x1a1d62&&_0x1a1d62[_0x4ab4('0x44')][0x0][_0x4ab4('0x4c')]===_0x4ab4('0x4d')){logger[_0x4ab4('0x32')](_0x4ab4('0x80'));return{'id':_0x1a1d62['data'][0x0]['details']['id']};}})[_0x4ab4('0x43')](function(_0x501f64){logger[_0x4ab4('0x32')](_0x4ab4('0x81'),_0x501f64[_0x4ab4('0x31')]);console[_0x4ab4('0x50')](_0x4ab4('0x81'),_0x501f64);});}exports['queue']=function(_0x37b5a0,_0x15353f,_0x3f283c,_0x289246,_0x20a216,_0x17977d){var _0x244c6a,_0x4b1612,_0x91b9d4;_0x17977d[_0x4ab4('0x82')]=intUtil[_0x4ab4('0x83')](_0x17977d[_0x4ab4('0x82')]);_0x17977d[_0x4ab4('0x84')]=intUtil[_0x4ab4('0x83')](_0x17977d['serverUrl']);if(_0x20a216&&_0x20a216['monitor_format']){logger[_0x4ab4('0x32')](_0x4ab4('0x85'),_0x4ab4('0x86'));_0x15353f[_0x4ab4('0x87')]=_0x17977d[_0x4ab4('0x84')]+'/api/voice/recordings/'+_0x15353f[_0x4ab4('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x15353f[_0x4ab4('0x88')]);}else{_0x15353f[_0x4ab4('0x87')]='';}var _0xef350c=_0x17977d[_0x4ab4('0x82')]===_0x4ab4('0x89')?'eu':_0x4ab4('0x8a');return getAccessToken(_0x17977d)[_0x4ab4('0x2d')](function(_0x3b8851){_0x91b9d4=_0x3b8851;return getUser(_0x91b9d4,_0xef350c,_0x17977d,_0x289246[_0x4ab4('0x3b')]);})[_0x4ab4('0x2d')](function(_0x652aa4){_0x244c6a=_0x652aa4;logger[_0x4ab4('0x32')](_0x4ab4('0x8b'),_0x244c6a['id']);return getEndUser(_0x91b9d4,_0xef350c,_0x17977d,_0x15353f[_0x4ab4('0x8c')],_0x15353f[_0x4ab4('0x8d')],_0x244c6a,_0x3f283c);})[_0x4ab4('0x2d')](function(_0x2bbf42){_0x4b1612=_0x2bbf42;return getCall(_0x91b9d4,_0xef350c,_0x17977d,_0x244c6a,_0x4b1612,_0x3f283c,_0x15353f,_0x4ab4('0x7d'));})[_0x4ab4('0x2d')](function(_0x110c68){if(_0x110c68){logger[_0x4ab4('0x32')](_0x4ab4('0x8e'),_0x110c68['id']);logger[_0x4ab4('0x32')](_0x4ab4('0x85'),_0x4ab4('0x8f'));emit(util[_0x4ab4('0x35')](_0x4ab4('0x90'),_0x289246[_0x4ab4('0x1a')]),_0x4ab4('0x91'),{'uri':'https://crm.'+_0x17977d[_0x4ab4('0x82')]+_0x4ab4('0x92')+_0x110c68['id']});}})[_0x4ab4('0x43')](function(_0x2e78a4){logger[_0x4ab4('0x30')](_0x4ab4('0x85'),JSON[_0x4ab4('0x41')](_0x2e78a4));});};exports[_0x4ab4('0x93')]=function(_0x10c080,_0x3200d6,_0x3306ea,_0xce9b6,_0x362ce4,_0xcf6c2c,_0x6216c){var _0x34ffe7,_0x2686b9,_0x4b191a;_0xcf6c2c['host']=intUtil[_0x4ab4('0x83')](_0xcf6c2c[_0x4ab4('0x82')]);_0xcf6c2c['serverUrl']=intUtil[_0x4ab4('0x83')](_0xcf6c2c[_0x4ab4('0x84')]);if(_0x6216c&&_0x6216c[_0x4ab4('0x94')]&&_0x6216c[_0x4ab4('0x94')]!=='none'){logger[_0x4ab4('0x32')](_0x4ab4('0x95'),_0x4ab4('0x86'));_0x3200d6[_0x4ab4('0x87')]=_0xcf6c2c['serverUrl']+_0x4ab4('0x96')+_0x3200d6['uniqueid']+_0x4ab4('0x97')+md5(_0x3200d6[_0x4ab4('0x88')]);}var _0x16d26f=_0xcf6c2c[_0x4ab4('0x82')]==='zoho.eu'?'eu':_0x4ab4('0x8a');return getAccessToken(_0xcf6c2c)[_0x4ab4('0x2d')](function(_0x36ad95){_0x4b191a=_0x36ad95;return getUser(_0x4b191a,_0x16d26f,_0xcf6c2c,_0xce9b6[_0x4ab4('0x3b')]);})['then'](function(_0x5144a0){_0x34ffe7=_0x5144a0;logger[_0x4ab4('0x32')](_0x4ab4('0x8b'),_0x34ffe7['id']);return getEndUser(_0x4b191a,_0x16d26f,_0xcf6c2c,_0x3200d6['destcalleridname'],_0x3200d6[_0x4ab4('0x98')],_0x34ffe7,_0x3306ea);})[_0x4ab4('0x2d')](function(_0x49d62f){_0x2686b9=_0x49d62f;return getCall(_0x4b191a,_0x16d26f,_0xcf6c2c,_0x34ffe7,_0x2686b9,_0x3306ea,_0x3200d6,_0x4ab4('0x99'));})['then'](function(_0x168ee7){if(_0x168ee7){logger[_0x4ab4('0x32')](_0x4ab4('0x8e'),_0x168ee7['id']);logger[_0x4ab4('0x32')](_0x4ab4('0x95'),_0x4ab4('0x8f'));emit(util[_0x4ab4('0x35')](_0x4ab4('0x90'),_0xce9b6[_0x4ab4('0x1a')]),'trigger:browser:url',{'uri':_0x4ab4('0x9a')+_0xcf6c2c[_0x4ab4('0x82')]+_0x4ab4('0x92')+_0x168ee7['id']});}})[_0x4ab4('0x43')](function(_0x31ed05){logger[_0x4ab4('0x30')]('[OUTBOUND]',JSON['stringify'](_0x31ed05));});};exports[_0x4ab4('0x9b')]=function(_0x11f236,_0x327638,_0x9c5c4c,_0x43a596,_0x34c1bf,_0x5b75fd){var _0x2a7b4a,_0x353411,_0x1cd5fa;_0x5b75fd[_0x4ab4('0x82')]=intUtil[_0x4ab4('0x83')](_0x5b75fd[_0x4ab4('0x82')]);_0x5b75fd[_0x4ab4('0x84')]=intUtil['stripTrailingSlash'](_0x5b75fd['serverUrl']);if(_0x34c1bf&&_0x34c1bf[_0x4ab4('0x9c')]){logger['info']('['+_0x327638['lastevent'][_0x4ab4('0x9d')]()+']','Recording\x20is\x20enabled!');_0x327638[_0x4ab4('0x87')]=_0x5b75fd[_0x4ab4('0x84')]+_0x4ab4('0x96')+_0x327638[_0x4ab4('0x88')]+_0x4ab4('0x97')+md5(_0x327638[_0x4ab4('0x88')]);}else{_0x327638[_0x4ab4('0x87')]='';}var _0x548988=_0x5b75fd['host']===_0x4ab4('0x89')?'eu':'com';return getAccessToken(_0x5b75fd)['then'](function(_0x5aeec1){_0x1cd5fa=_0x5aeec1;return getUser(_0x1cd5fa,_0x548988,_0x5b75fd);})[_0x4ab4('0x2d')](function(_0x13caa4){_0x2a7b4a=_0x13caa4;logger[_0x4ab4('0x32')](_0x4ab4('0x8b'),_0x2a7b4a['id']);return getEndUser(_0x1cd5fa,_0x548988,_0x5b75fd,_0x327638['calleridname'],_0x327638[_0x4ab4('0x8d')],_0x2a7b4a,_0x9c5c4c);})[_0x4ab4('0x2d')](function(_0x5c71d5){_0x353411=_0x5c71d5;return getCall(_0x1cd5fa,_0x548988,_0x5b75fd,_0x2a7b4a,_0x353411,_0x9c5c4c,_0x327638,_0x4ab4('0x7d'));})['then'](function(_0x18c55c){if(_0x18c55c){logger['info'](_0x4ab4('0x8e'),_0x18c55c['id']);}})[_0x4ab4('0x43')](function(_0x368bee){logger[_0x4ab4('0x30')]('['+_0x327638['lastevent']['toUpperCase']()+']',JSON[_0x4ab4('0x41')](_0x368bee));});}; \ No newline at end of file +var _0x9b7e=['moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','redis','emit','debug','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','details','moduleCreate','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','contact','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','merge','code','SUCCESS','Call\x20created!','stack','err','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','zoho.eu','Outbound','https://crm.','monitor_format','lastevent','toUpperCase','calleridnum','request-promise','md5','util','./util'];(function(_0x5d52ae,_0xc4ff47){var _0x1c868a=function(_0x228ebf){while(--_0x228ebf){_0x5d52ae['push'](_0x5d52ae['shift']());}};_0x1c868a(++_0xc4ff47);}(_0x9b7e,0x12e));var _0xe9b7=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x9b7e[_0x28f1de];return _0x5b5dad;};'use strict';var _=require('lodash');var rp=require(_0xe9b7('0x0'));var md5=require(_0xe9b7('0x1'));var util=require(_0xe9b7('0x2'));var intUtil=require(_0xe9b7('0x3'));var moment=require(_0xe9b7('0x4'));var Redis=require(_0xe9b7('0x5'));var BPromise=require(_0xe9b7('0x6'));var config=require(_0xe9b7('0x7'));var logger=require(_0xe9b7('0x8'))(_0xe9b7('0x9'));config['redis']=_[_0xe9b7('0xa')](config['redis'],{'host':_0xe9b7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe9b7('0xc')]));function emit(_0xce21a7,_0x46d7e6,_0x12aa52){io['to'](_0xce21a7)[_0xe9b7('0xd')](_0x46d7e6,_0x12aa52);}function request(_0x10b43e){logger[_0xe9b7('0xe')]('[HTTP]',JSON[_0xe9b7('0xf')](_0x10b43e));return rp(_0x10b43e);}function getCustomFields(_0x5e83e1,_0x5d605d){var _0x507207={};if(_0x5e83e1[_0xe9b7('0x10')]>0x0){_[_0xe9b7('0x11')](_0x5e83e1,function(_0x1725e0){if(_[_0xe9b7('0x12')]([_0xe9b7('0x13'),_0xe9b7('0x14')],_0x1725e0[_0xe9b7('0x15')])&&_0x1725e0[_0xe9b7('0x16')]){_0x507207[_0x1725e0[_0xe9b7('0x16')]]=_0x1725e0[_0xe9b7('0x17')][_0xe9b7('0x18')]();}else if(_0x1725e0[_0xe9b7('0x15')]==='variable'&&_0x1725e0[_0xe9b7('0x19')]&&_0x1725e0[_0xe9b7('0x16')]&&_0x5d605d[_0x1725e0[_0xe9b7('0x19')]]){_0x507207[_0x1725e0[_0xe9b7('0x16')]]=_0x5d605d[_0x1725e0[_0xe9b7('0x19')]][_0xe9b7('0x18')]();}else if(_0x1725e0['type']===_0xe9b7('0x1a')&&_0x1725e0[_0xe9b7('0x1b')]&&_0x1725e0[_0xe9b7('0x1b')][_0xe9b7('0x1c')]&&_0x1725e0[_0xe9b7('0x16')]&&_0x5d605d[_0x1725e0[_0xe9b7('0x1b')][_0xe9b7('0x1c')][_0xe9b7('0x1d')]()]){_0x507207[_0x1725e0['idField']]=_0x5d605d[_0x1725e0['Variable'][_0xe9b7('0x1c')][_0xe9b7('0x1d')]()][_0xe9b7('0x18')]();}});}return _0x507207;}function getName(_0x31de88){if(_0x31de88[_0xe9b7('0x1e')]('\x20')>0x0){var _0x3a3832=_0x31de88[_0xe9b7('0x1f')](/ (.+)/);if(_0x3a3832[0x1]){return _0x3a3832;}}return[_0x31de88,_0x31de88];}var accountsTokens={};function getAccessToken(_0xe1d64d){return new Promise(function(_0x303804,_0x11c1be){if(!_[_0xe9b7('0x20')](accountsTokens[_0xe1d64d['id']])&&!_[_0xe9b7('0x20')](accountsTokens[_0xe1d64d['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0xe1d64d['id']][_0xe9b7('0x21')])){_0x303804(accountsTokens[_0xe1d64d['id']][_0xe9b7('0x22')]);}}var _0x3e61d6;switch(_0xe1d64d[_0xe9b7('0x23')]){case'US':_0x3e61d6='https://accounts.zoho.com';break;case'AU':_0x3e61d6=_0xe9b7('0x24');break;case'EU':_0x3e61d6=_0xe9b7('0x25');break;case'IN':_0x3e61d6='https://accounts.zoho.in';break;case'CN':_0x3e61d6='https://accounts.zoho.com.cn';break;default:_0x3e61d6='https://accounts.zoho.eu';break;}var _0x179c17={'method':_0xe9b7('0x26'),'uri':_0x3e61d6+'/oauth/v2/token','qs':{'refresh_token':_0xe1d64d[_0xe9b7('0x27')],'client_id':_0xe1d64d[_0xe9b7('0x28')],'client_secret':_0xe1d64d[_0xe9b7('0x29')],'grant_type':_0xe9b7('0x2a')},'json':!![]};return rp(_0x179c17)[_0xe9b7('0x2b')](function(_0x34e70e){accountsTokens[_0xe1d64d['id']]={'access_token':_0x34e70e[_0xe9b7('0x22')],'expires_in':moment()['add'](_0x34e70e[_0xe9b7('0x21')],_0xe9b7('0x2c'))};_0x303804(_0x34e70e['access_token']);})[_0xe9b7('0x2d')](function(_0x567ebd){logger[_0xe9b7('0x2e')](_0xe9b7('0x2f'),_0x567ebd['stack']);_0x11c1be(_0x567ebd);});});}function getUser(_0x2b5f0e,_0x12fd60,_0x2bdd70,_0x183845){logger[_0xe9b7('0x30')]('Search\x20user');return request({'method':'GET','uri':util[_0xe9b7('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x12fd60),'qs':{'type':_0xe9b7('0x32')},'headers':{'Authorization':_0xe9b7('0x33')+_0x2b5f0e},'json':!![]})[_0xe9b7('0x2b')](function(_0x29446d){if(_0x29446d[_0xe9b7('0x34')]){var _0x567d00=-0x1;if(_[_0xe9b7('0x35')](_0x29446d[_0xe9b7('0x34')])){if(!_[_0xe9b7('0x20')](_0x183845)){_0x567d00=_[_0xe9b7('0x36')](_0x29446d['users'],function(_0x5ee09a){return _0x5ee09a[_0xe9b7('0x37')]===_0x183845;});}if(_0x567d00>=0x0){logger[_0xe9b7('0x30')](_0xe9b7('0x38'));}else{logger[_0xe9b7('0x30')](_0xe9b7('0x39'));_0x567d00=_[_0xe9b7('0x36')](_0x29446d[_0xe9b7('0x34')],function(_0x2a0619){return _0x2a0619['profile'][_0xe9b7('0x1c')]==='Administrator';});}return _0x29446d['users'][_0x567d00];}else{if(_0x29446d['user'][_0xe9b7('0x3a')]['name']===_0xe9b7('0x3b')){logger[_0xe9b7('0x30')]('Using\x20the\x20admin\x20account!');user=_0x29446d[_0xe9b7('0x3c')];return user;}else{logger[_0xe9b7('0x2e')](_0xe9b7('0x3d'),JSON[_0xe9b7('0xf')](_0x29446d));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x29446d));}}}else{logger['error'](_0xe9b7('0x3d'),JSON[_0xe9b7('0xf')](_0x29446d));throw new Error(_0xe9b7('0x3e')+JSON['stringify'](_0x29446d));}})['catch'](function(_0x145f89){console[_0xe9b7('0x2e')](_0x145f89);});}function getZohoUser(_0x513b9f,_0x9bc738){return new BPromise(function(_0x5f3530,_0xee9605){request(_0x513b9f)[_0xe9b7('0x2b')](function(_0x24451c){var _0x5ebd7a=null;if(_0x24451c){_0x5ebd7a=_0x24451c[_0xe9b7('0x3f')][0x0];_0x5ebd7a[_0xe9b7('0x40')]=_0x9bc738;}_0x5f3530(_0x5ebd7a);})['catch'](function(_0x5bc9b7){_0xee9605(_0x5bc9b7);});});}function createEndUser(_0x3a7b3a,_0x461f02,_0x1953a0,_0x273349,_0x4ac629,_0x1efda4){var _0x1953a0=getName(_0x1953a0);return request({'method':_0xe9b7('0x26'),'uri':_0xe9b7('0x41')+_0x461f02+_0xe9b7('0x42')+_[_0xe9b7('0x43')](_0x1efda4['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1953a0[0x1],'First_Name':_0x1953a0[0x0],'Phone':_0x273349,'Owner':{'name':!_[_0xe9b7('0x20')](_0x4ac629['role']['name'])?_0x4ac629[_0xe9b7('0x44')][_0xe9b7('0x1c')]:!_[_0xe9b7('0x20')](_0x4ac629[_0xe9b7('0x45')])?_0x4ac629[_0xe9b7('0x45')]+'\x20'+_0x4ac629[_0xe9b7('0x46')]:_0x4ac629[_0xe9b7('0x46')],'id':_0x4ac629['id']}}]},'headers':{'Authorization':_0xe9b7('0x33')+_0x3a7b3a},'json':!![]})[_0xe9b7('0x2b')](function(_0x236fe6){if(_0x236fe6&&_0x236fe6[_0xe9b7('0x3f')][0x0]['code']==='SUCCESS'){var _0xff7f58=_0x236fe6[_0xe9b7('0x3f')][0x0][_0xe9b7('0x47')];_0xff7f58[_0xe9b7('0x40')]=_[_0xe9b7('0x43')](_0x1efda4[_0xe9b7('0x48')])+'s';return _0xff7f58;}logger[_0xe9b7('0x2e')](_0xe9b7('0x3d'),JSON[_0xe9b7('0xf')](data));throw new Error(_0xe9b7('0x49')+JSON[_0xe9b7('0xf')](data));})[_0xe9b7('0x2d')](function(_0x3b220e){console[_0xe9b7('0x4a')]('CREATE\x20ERROR',_0x3b220e);});}function getEndUser(_0x1c002f,_0x3c8d90,_0x11d468,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6){var _0x1fb4d3={'method':_0xe9b7('0x4b'),'uri':'','headers':{'Authorization':_0xe9b7('0x33')+_0x1c002f},'json':!![]};switch(_0x2f5df6[_0xe9b7('0x4c')]){case _0xe9b7('0x4d'):_0x1fb4d3[_0xe9b7('0x4e')]=_0xe9b7('0x41')+_0x3c8d90+_0xe9b7('0x4f')+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,'Contacts')[_0xe9b7('0x2b')](function(_0x254291){if(_0x254291)return _0x254291;_0x1fb4d3[_0xe9b7('0x4e')]=_0xe9b7('0x41')+_0x3c8d90+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,_0xe9b7('0x50'))[_0xe9b7('0x2b')](function(_0x523a17){if(_0x523a17)return _0x523a17;if(_0x2f5df6[_0xe9b7('0x48')]!='nothing'){return createEndUser(_0x1c002f,_0x3c8d90,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6);}else{return{};}});});break;case _0xe9b7('0x51'):_0x1fb4d3[_0xe9b7('0x4e')]='https://www.zohoapis.'+_0x3c8d90+_0xe9b7('0x4f')+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,_0xe9b7('0x52'))[_0xe9b7('0x2b')](function(_0x37139b){if(_0x37139b)return _0x37139b;if(_0x2f5df6[_0xe9b7('0x48')]!='nothing'){return createEndUser(_0x1c002f,_0x3c8d90,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6);}else{return{};}});break;case'lead':_0x1fb4d3[_0xe9b7('0x4e')]=_0xe9b7('0x41')+_0x3c8d90+_0xe9b7('0x53')+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,'Leads')['then'](function(_0x4ba9f2){if(_0x4ba9f2)return _0x4ba9f2;if(_0x2f5df6[_0xe9b7('0x48')]!='nothing'){return createEndUser(_0x1c002f,_0x3c8d90,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6);}else{return{};}});break;}}function getCall(_0x34d4e2,_0x45b1a0,_0x2cca89,_0x9d862d,_0x40d60a,_0x507133,_0x5324a3,_0x1751b3){logger[_0xe9b7('0x30')](_0xe9b7('0x54'));var _0x636cd0={};_0x636cd0[_0xe9b7('0x55')]={'name':!_[_0xe9b7('0x20')](_0x9d862d[_0xe9b7('0x44')]['name'])&&!_[_0xe9b7('0x20')](_0x9d862d[_0xe9b7('0x3a')][_0xe9b7('0x1c')])&&_0x9d862d['profile'][_0xe9b7('0x1c')]===_0xe9b7('0x56')?_0x9d862d[_0xe9b7('0x44')][_0xe9b7('0x1c')]:!_[_0xe9b7('0x20')](_0x9d862d[_0xe9b7('0x45')])?_0x9d862d[_0xe9b7('0x45')]+'\x20'+_0x9d862d[_0xe9b7('0x46')]:_0x9d862d[_0xe9b7('0x46')],'id':_0x9d862d['id']};_0x636cd0[_0xe9b7('0x57')]=intUtil[_0xe9b7('0x58')](_0x507133[_0xe9b7('0x59')],_0x5324a3,'\x20');_0x636cd0['Description']=intUtil['getString'](_0x507133[_0xe9b7('0x5a')],_0x5324a3,'\x0a');if(_0x40d60a[_0xe9b7('0x40')]===_0xe9b7('0x52')){_0x636cd0['Who_Id']={'name':!_[_0xe9b7('0x20')](_0x40d60a['Full_Name'])?_0x40d60a['Full_Name']:!_[_0xe9b7('0x20')](_0x40d60a[_0xe9b7('0x5b')])?_0x40d60a[_0xe9b7('0x5b')]+'\x20'+_0x40d60a[_0xe9b7('0x5c')]:_0x40d60a['Last_Name'],'id':_0x40d60a['id']};}if(_0x40d60a[_0xe9b7('0x40')]===_0xe9b7('0x50')){_0x636cd0[_0xe9b7('0x5d')]={'name':!_[_0xe9b7('0x20')](_0x40d60a[_0xe9b7('0x5e')])?_0x40d60a[_0xe9b7('0x5e')]:!_['isNil'](_0x40d60a[_0xe9b7('0x5b')])?_0x40d60a[_0xe9b7('0x5b')]+'\x20'+_0x40d60a['Last_Name']:_0x40d60a[_0xe9b7('0x5c')],'id':_0x40d60a['id']};_0x636cd0[_0xe9b7('0x5f')]=_[_0xe9b7('0x43')](_0x40d60a[_0xe9b7('0x40')]);}if(_0x5324a3[_0xe9b7('0x60')]){_0x636cd0[_0xe9b7('0x61')]=moment[_0xe9b7('0x62')](parseInt(_0x5324a3[_0xe9b7('0x60')])*0x3e8)[_0xe9b7('0x31')](_0xe9b7('0x63'));}else if(_0x5324a3['answertime']&&_0x5324a3[_0xe9b7('0x64')]){_0x636cd0[_0xe9b7('0x61')]=moment[_0xe9b7('0x62')](moment(_0x5324a3[_0xe9b7('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xe9b7('0x65')](moment(_0x5324a3[_0xe9b7('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0xe9b7('0x31')](_0xe9b7('0x63'));}switch(_0x5324a3['lastevent']){case _0xe9b7('0x67'):_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x69');break;case _0xe9b7('0x6a'):case _0xe9b7('0x6b'):_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x6c');break;case _0xe9b7('0x6d'):_0x636cd0[_0xe9b7('0x68')]='Rejected';break;case _0xe9b7('0x6e'):_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x6f');break;case'timeout':_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x70');default:}_0x636cd0[_0xe9b7('0x71')]=(_0x1751b3==='outbound'?moment(_0x5324a3['starttime'])[_0xe9b7('0x31')](_0xe9b7('0x72')):moment(_0x5324a3[_0xe9b7('0x73')])['format'](_0xe9b7('0x72')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x636cd0[_0xe9b7('0x74')]=_0x1751b3||_0xe9b7('0x75');_0x636cd0=_[_0xe9b7('0x76')](_0x636cd0,getCustomFields(_0x507133['Fields'],_0x5324a3));return request({'method':_0xe9b7('0x26'),'uri':_0xe9b7('0x41')+_0x45b1a0+'/crm/v2/Calls','headers':{'Authorization':_0xe9b7('0x33')+_0x34d4e2},'body':{'data':[_0x636cd0]},'json':!![]})[_0xe9b7('0x2b')](function(_0xd70e2c){if(_0xd70e2c&&_0xd70e2c[_0xe9b7('0x3f')][0x0][_0xe9b7('0x77')]===_0xe9b7('0x78')){logger[_0xe9b7('0x30')](_0xe9b7('0x79'));return{'id':_0xd70e2c[_0xe9b7('0x3f')][0x0][_0xe9b7('0x47')]['id']};}})['catch'](function(_0x3c3675){logger[_0xe9b7('0x30')]('err',_0x3c3675[_0xe9b7('0x7a')]);console['log'](_0xe9b7('0x7b'),_0x3c3675);});}exports[_0xe9b7('0x7c')]=function(_0x150400,_0x3162bf,_0x1fd7b7,_0x2315c7,_0x41b8ce,_0x59fb73){var _0x3c0fea,_0x29be42,_0x4e5b51;_0x59fb73['host']=intUtil[_0xe9b7('0x7d')](_0x59fb73[_0xe9b7('0x7e')]);_0x59fb73[_0xe9b7('0x7f')]=intUtil[_0xe9b7('0x7d')](_0x59fb73[_0xe9b7('0x7f')]);if(_0x41b8ce&&_0x41b8ce['monitor_format']){logger[_0xe9b7('0x30')](_0xe9b7('0x80'),_0xe9b7('0x81'));_0x3162bf[_0xe9b7('0x82')]=_0x59fb73[_0xe9b7('0x7f')]+_0xe9b7('0x83')+_0x3162bf[_0xe9b7('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x3162bf['uniqueid']);}else{_0x3162bf[_0xe9b7('0x82')]='';}var _0x1d2b42=_0x59fb73[_0xe9b7('0x7e')]==='zoho.eu'?'eu':_0xe9b7('0x85');return getAccessToken(_0x59fb73)[_0xe9b7('0x2b')](function(_0x42d749){_0x4e5b51=_0x42d749;return getUser(_0x4e5b51,_0x1d2b42,_0x59fb73,_0x2315c7[_0xe9b7('0x37')]);})[_0xe9b7('0x2b')](function(_0x54aa95){_0x3c0fea=_0x54aa95;logger[_0xe9b7('0x30')](_0xe9b7('0x86'),_0x3c0fea['id']);return getEndUser(_0x4e5b51,_0x1d2b42,_0x59fb73,_0x3162bf[_0xe9b7('0x87')],_0x3162bf['calleridnum'],_0x3c0fea,_0x1fd7b7);})[_0xe9b7('0x2b')](function(_0x45d5b4){_0x29be42=_0x45d5b4;return getCall(_0x4e5b51,_0x1d2b42,_0x59fb73,_0x3c0fea,_0x29be42,_0x1fd7b7,_0x3162bf,_0xe9b7('0x75'));})[_0xe9b7('0x2b')](function(_0x136b3f){if(_0x136b3f){logger[_0xe9b7('0x30')](_0xe9b7('0x88'),_0x136b3f['id']);logger['info'](_0xe9b7('0x80'),_0xe9b7('0x89'));emit(util['format'](_0xe9b7('0x8a'),_0x2315c7['name']),_0xe9b7('0x8b'),{'uri':'https://crm.'+_0x59fb73[_0xe9b7('0x7e')]+_0xe9b7('0x8c')+_0x136b3f['id']});}})[_0xe9b7('0x2d')](function(_0x41ba85){logger[_0xe9b7('0x2e')](_0xe9b7('0x80'),JSON['stringify'](_0x41ba85));});};exports[_0xe9b7('0x8d')]=function(_0x2afc7b,_0x438db5,_0x593aa8,_0x3b85f2,_0x530d73,_0x1615ac,_0x40f6c8){var _0x39e682,_0x14c903,_0x101440;_0x1615ac[_0xe9b7('0x7e')]=intUtil[_0xe9b7('0x7d')](_0x1615ac[_0xe9b7('0x7e')]);_0x1615ac[_0xe9b7('0x7f')]=intUtil[_0xe9b7('0x7d')](_0x1615ac[_0xe9b7('0x7f')]);if(_0x40f6c8&&_0x40f6c8['recordingFormat']&&_0x40f6c8[_0xe9b7('0x8e')]!==_0xe9b7('0x8f')){logger[_0xe9b7('0x30')](_0xe9b7('0x90'),_0xe9b7('0x81'));_0x438db5[_0xe9b7('0x82')]=_0x1615ac[_0xe9b7('0x7f')]+'/api/voice/recordings/'+_0x438db5[_0xe9b7('0x84')]+_0xe9b7('0x91')+md5(_0x438db5[_0xe9b7('0x84')]);}var _0x2c04f9=_0x1615ac[_0xe9b7('0x7e')]===_0xe9b7('0x92')?'eu':'com';return getAccessToken(_0x1615ac)['then'](function(_0x22304b){_0x101440=_0x22304b;return getUser(_0x101440,_0x2c04f9,_0x1615ac,_0x3b85f2[_0xe9b7('0x37')]);})[_0xe9b7('0x2b')](function(_0x34c4fc){_0x39e682=_0x34c4fc;logger[_0xe9b7('0x30')]('The\x20User\x20ID\x20is:',_0x39e682['id']);return getEndUser(_0x101440,_0x2c04f9,_0x1615ac,_0x438db5['destcalleridname'],_0x438db5['destcalleridnum'],_0x39e682,_0x593aa8);})[_0xe9b7('0x2b')](function(_0x47c5b1){_0x14c903=_0x47c5b1;return getCall(_0x101440,_0x2c04f9,_0x1615ac,_0x39e682,_0x14c903,_0x593aa8,_0x438db5,_0xe9b7('0x93'));})[_0xe9b7('0x2b')](function(_0x4b2c64){if(_0x4b2c64){logger[_0xe9b7('0x30')]('The\x20Call\x20ID\x20is:',_0x4b2c64['id']);logger[_0xe9b7('0x30')](_0xe9b7('0x90'),_0xe9b7('0x89'));emit(util[_0xe9b7('0x31')]('user:%s',_0x3b85f2[_0xe9b7('0x1c')]),_0xe9b7('0x8b'),{'uri':_0xe9b7('0x94')+_0x1615ac[_0xe9b7('0x7e')]+_0xe9b7('0x8c')+_0x4b2c64['id']});}})[_0xe9b7('0x2d')](function(_0x1a8c3f){logger['error'](_0xe9b7('0x90'),JSON['stringify'](_0x1a8c3f));});};exports['unmanaged']=function(_0x598782,_0x3253a2,_0xd2b296,_0x27b701,_0x15f27b,_0x3948ee){var _0x2ec407,_0x518575,_0x615b99;_0x3948ee['host']=intUtil[_0xe9b7('0x7d')](_0x3948ee[_0xe9b7('0x7e')]);_0x3948ee[_0xe9b7('0x7f')]=intUtil['stripTrailingSlash'](_0x3948ee['serverUrl']);if(_0x15f27b&&_0x15f27b[_0xe9b7('0x95')]){logger[_0xe9b7('0x30')]('['+_0x3253a2[_0xe9b7('0x96')][_0xe9b7('0x97')]()+']',_0xe9b7('0x81'));_0x3253a2[_0xe9b7('0x82')]=_0x3948ee[_0xe9b7('0x7f')]+_0xe9b7('0x83')+_0x3253a2[_0xe9b7('0x84')]+_0xe9b7('0x91')+md5(_0x3253a2[_0xe9b7('0x84')]);}else{_0x3253a2[_0xe9b7('0x82')]='';}var _0x39d42d=_0x3948ee[_0xe9b7('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x3948ee)[_0xe9b7('0x2b')](function(_0x18d234){_0x615b99=_0x18d234;return getUser(_0x615b99,_0x39d42d,_0x3948ee);})[_0xe9b7('0x2b')](function(_0x40e0e9){_0x2ec407=_0x40e0e9;logger[_0xe9b7('0x30')]('The\x20User\x20ID\x20is:',_0x2ec407['id']);return getEndUser(_0x615b99,_0x39d42d,_0x3948ee,_0x3253a2['calleridname'],_0x3253a2[_0xe9b7('0x98')],_0x2ec407,_0xd2b296);})[_0xe9b7('0x2b')](function(_0x477e2e){_0x518575=_0x477e2e;return getCall(_0x615b99,_0x39d42d,_0x3948ee,_0x2ec407,_0x518575,_0xd2b296,_0x3253a2,_0xe9b7('0x75'));})['then'](function(_0x14d0b6){if(_0x14d0b6){logger[_0xe9b7('0x30')](_0xe9b7('0x88'),_0x14d0b6['id']);}})[_0xe9b7('0x2d')](function(_0xb385d){logger[_0xe9b7('0x2e')]('['+_0x3253a2[_0xe9b7('0x96')]['toUpperCase']()+']',JSON[_0xe9b7('0xf')](_0xb385d));});}; \ 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 182bed4..d5dbd2a 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 _0x66f4=['render','format','info','util','shelljs','mustache','../../../../config/logger','exec','data2','data3'];(function(_0x1d920f,_0x3ea306){var _0x4a5f6f=function(_0x5c9b48){while(--_0x5c9b48){_0x1d920f['push'](_0x1d920f['shift']());}};_0x4a5f6f(++_0x3ea306);}(_0x66f4,0x11b));var _0x466f=function(_0x259f77,_0x432422){_0x259f77=_0x259f77-0x0;var _0x319d33=_0x66f4[_0x259f77];return _0x319d33;};'use strict';var util=require(_0x466f('0x0'));var sh=require(_0x466f('0x1'));var Mustache=require(_0x466f('0x2'));var logger=require(_0x466f('0x3'))('trigger');exports[_0x466f('0x4')]=function(_0x12dcbc,_0x1bd966){var _0x5e9f06=_0x12dcbc[_0x466f('0x5')]?_0x12dcbc[_0x466f('0x5')]:'Script';var _0x40ab50=_0x12dcbc[_0x466f('0x6')]?Mustache[_0x466f('0x7')](_0x12dcbc[_0x466f('0x6')],_0x1bd966):_0x1bd966;sh[_0x466f('0x4')](_0x40ab50,function(_0x4370e1,_0x4716ee,_0x528949){if(_0x4370e1!==0x0){logger['error'](util[_0x466f('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x5e9f06,_0x40ab50,_0x4370e1,_0x528949));}else{logger[_0x466f('0x9')](util[_0x466f('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x5e9f06,_0x40ab50,_0x4716ee));}});}; \ No newline at end of file +var _0xe78f=['data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','data2','Script'];(function(_0x2054ab,_0x604913){var _0x2b6fd6=function(_0x2619d8){while(--_0x2619d8){_0x2054ab['push'](_0x2054ab['shift']());}};_0x2b6fd6(++_0x604913);}(_0xe78f,0x14b));var _0xfe78=function(_0x331f5e,_0x513d59){_0x331f5e=_0x331f5e-0x0;var _0x1ea01b=_0xe78f[_0x331f5e];return _0x1ea01b;};'use strict';var util=require(_0xfe78('0x0'));var sh=require(_0xfe78('0x1'));var Mustache=require(_0xfe78('0x2'));var logger=require(_0xfe78('0x3'))(_0xfe78('0x4'));exports['exec']=function(_0x527e73,_0x58d99b){var _0xf56e5c=_0x527e73[_0xfe78('0x5')]?_0x527e73[_0xfe78('0x5')]:_0xfe78('0x6');var _0xc80921=_0x527e73[_0xfe78('0x7')]?Mustache[_0xfe78('0x8')](_0x527e73[_0xfe78('0x7')],_0x58d99b):_0x58d99b;sh['exec'](_0xc80921,function(_0x1407fe,_0x3f6784,_0x44784b){if(_0x1407fe!==0x0){logger[_0xfe78('0x9')](util[_0xfe78('0xa')](_0xfe78('0xb'),_0xf56e5c,_0xc80921,_0x1407fe,_0x44784b));}else{logger['info'](util[_0xfe78('0xa')](_0xfe78('0xc'),_0xf56e5c,_0xc80921,_0x3f6784));}});}; \ 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 d2986f6..949bc95 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 _0xaab6=['stack','GET','DELETE','data7','parse','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','stringify','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6'];(function(_0x40c118,_0x1c7114){var _0x7c7f1e=function(_0x4be17b){while(--_0x4be17b){_0x40c118['push'](_0x40c118['shift']());}};_0x7c7f1e(++_0x1c7114);}(_0xaab6,0x75));var _0x6aab=function(_0x210f72,_0x47c505){_0x210f72=_0x210f72-0x0;var _0x222218=_0xaab6[_0x210f72];return _0x222218;};'use strict';var rp=require(_0x6aab('0x0'));var util=require(_0x6aab('0x1'));var _=require(_0x6aab('0x2'));var Mustache=require(_0x6aab('0x3'));var logger=require(_0x6aab('0x4'))(_0x6aab('0x5'));exports[_0x6aab('0x6')]=function(_0x36f9be,_0x6abc03){var _0x5d341d,_0x4d8cff;var _0x545f6e={'method':_0x36f9be[_0x6aab('0x7')][_0x6aab('0x8')](),'uri':Mustache[_0x6aab('0x9')](_0x36f9be[_0x6aab('0xa')],_0x6abc03),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x36f9be['data5'])===_0x6aab('0xb')&&parseInt(_0x36f9be[_0x6aab('0xc')])>=0x1&&parseInt(_0x36f9be[_0x6aab('0xc')])<=0xa?parseInt(_0x36f9be[_0x6aab('0xc')])*0x3e8:0x5*0x3e8};try{_0x545f6e[_0x6aab('0xd')]=_0x36f9be['data6']?JSON['parse'](Mustache[_0x6aab('0x9')](_0x36f9be[_0x6aab('0xe')],_0x6abc03)):{};}catch(_0x3c406f){logger['error'](_0x3c406f[_0x6aab('0xf')]);}switch(_0x36f9be[_0x6aab('0x7')][_0x6aab('0x8')]()){case _0x6aab('0x10'):case _0x6aab('0x11'):_0x5d341d=null;_0x545f6e['qs']=_0x6abc03;break;case'POST':case'PUT':if(_0x36f9be[_0x6aab('0x12')]){try{_0x5d341d=JSON[_0x6aab('0x13')](Mustache[_0x6aab('0x9')](_0x36f9be[_0x6aab('0x12')],_0x6abc03));_0x545f6e[_0x6aab('0x14')]=_0x5d341d;}catch(_0x92a029){logger[_0x6aab('0x15')](_0x92a029['stack']);logger[_0x6aab('0x15')](_0x6aab('0x16'));}}else{_0x5d341d=_0x6abc03;_0x545f6e[_0x6aab('0x14')]=_0x5d341d;}break;}logger['info'](util[_0x6aab('0x17')](_0x6aab('0x18'),_0x36f9be[_0x6aab('0x7')],_0x36f9be[_0x6aab('0xa')],JSON['stringify'](_0x545f6e)));rp(_0x545f6e)[_0x6aab('0x19')](function(_0x354b81){_0x5d341d=!_[_0x6aab('0x1a')](_0x5d341d)?_0x6aab('0x1b')+_0x5d341d:'';_0x4d8cff=typeof _0x354b81['body']==='object'?JSON[_0x6aab('0x1c')](_0x354b81[_0x6aab('0x14')]):_0x354b81[_0x6aab('0x14')];logger['info'](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x36f9be[_0x6aab('0x7')],_0x36f9be[_0x6aab('0xa')],_0x354b81[_0x6aab('0x1d')],_0x4d8cff));})[_0x6aab('0x1e')](function(_0x38833e){logger[_0x6aab('0x15')](util[_0x6aab('0x17')](_0x6aab('0x1f'),_0x36f9be[_0x6aab('0x7')],_0x36f9be[_0x6aab('0xa')],_0x38833e['statusCode'],_0x38833e[_0x6aab('0x20')],_0x38833e['message']));});}; \ No newline at end of file +var _0xc7fc=['data1','toUpperCase','GET','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','%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','name','message','request-promise','util','../../../../config/logger','exec','render','data5','headers','data6','parse','error','stack'];(function(_0x453e90,_0x92ca66){var _0x33c869=function(_0x22dadf){while(--_0x22dadf){_0x453e90['push'](_0x453e90['shift']());}};_0x33c869(++_0x92ca66);}(_0xc7fc,0xe5));var _0xcc7f=function(_0x4e9ad8,_0x3f31e8){_0x4e9ad8=_0x4e9ad8-0x0;var _0x1ca422=_0xc7fc[_0x4e9ad8];return _0x1ca422;};'use strict';var rp=require(_0xcc7f('0x0'));var util=require(_0xcc7f('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0xcc7f('0x2'))('trigger');exports[_0xcc7f('0x3')]=function(_0x5d82a8,_0x52dd3b){var _0x1fd162,_0x4f62b8;var _0x49a920={'method':_0x5d82a8['data1']['toUpperCase'](),'uri':Mustache[_0xcc7f('0x4')](_0x5d82a8['data2'],_0x52dd3b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5d82a8['data5'])==='number'&&parseInt(_0x5d82a8[_0xcc7f('0x5')])>=0x1&&parseInt(_0x5d82a8['data5'])<=0xa?parseInt(_0x5d82a8['data5'])*0x3e8:0x5*0x3e8};try{_0x49a920[_0xcc7f('0x6')]=_0x5d82a8[_0xcc7f('0x7')]?JSON[_0xcc7f('0x8')](Mustache[_0xcc7f('0x4')](_0x5d82a8['data6'],_0x52dd3b)):{};}catch(_0x44c853){logger[_0xcc7f('0x9')](_0x44c853[_0xcc7f('0xa')]);}switch(_0x5d82a8[_0xcc7f('0xb')][_0xcc7f('0xc')]()){case _0xcc7f('0xd'):case'DELETE':_0x1fd162=null;_0x49a920['qs']=_0x52dd3b;break;case'POST':case'PUT':if(_0x5d82a8[_0xcc7f('0xe')]){try{_0x1fd162=JSON['parse'](Mustache[_0xcc7f('0x4')](_0x5d82a8[_0xcc7f('0xe')],_0x52dd3b));_0x49a920[_0xcc7f('0xf')]=_0x1fd162;}catch(_0x30afd8){logger[_0xcc7f('0x9')](_0x30afd8[_0xcc7f('0xa')]);logger['error'](_0xcc7f('0x10'));}}else{_0x1fd162=_0x52dd3b;_0x49a920[_0xcc7f('0xf')]=_0x1fd162;}break;}logger[_0xcc7f('0x11')](util[_0xcc7f('0x12')](_0xcc7f('0x13'),_0x5d82a8[_0xcc7f('0xb')],_0x5d82a8[_0xcc7f('0x14')],JSON[_0xcc7f('0x15')](_0x49a920)));rp(_0x49a920)[_0xcc7f('0x16')](function(_0x459804){_0x1fd162=!_[_0xcc7f('0x17')](_0x1fd162)?_0xcc7f('0x18')+_0x1fd162:'';_0x4f62b8=typeof _0x459804[_0xcc7f('0xf')]==='object'?JSON['stringify'](_0x459804['body']):_0x459804[_0xcc7f('0xf')];logger[_0xcc7f('0x11')](util[_0xcc7f('0x12')](_0xcc7f('0x19'),_0x5d82a8['data1'],_0x5d82a8['data2'],_0x459804['statusCode'],_0x4f62b8));})[_0xcc7f('0x1a')](function(_0x276ab0){logger[_0xcc7f('0x9')](util[_0xcc7f('0x12')](_0xcc7f('0x1b'),_0x5d82a8[_0xcc7f('0xb')],_0x5d82a8[_0xcc7f('0x14')],_0x276ab0['statusCode'],_0x276ab0[_0xcc7f('0x1c')],_0x276ab0[_0xcc7f('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b6bbc63..7f32460 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 _0x2f68=['catch','../../config/logger','routing','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x235f7f,_0x4cc112){var _0x3bf31e=function(_0x618236){while(--_0x618236){_0x235f7f['push'](_0x235f7f['shift']());}};_0x3bf31e(++_0x4cc112);}(_0x2f68,0x91));var _0x82f6=function(_0x1a7db0,_0x24ec31){_0x1a7db0=_0x1a7db0-0x0;var _0x2f09c9=_0x2f68[_0x1a7db0];return _0x2f09c9;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x82f6('0x0'))(_0x82f6('0x1'));var client=jayson['client'][_0x82f6('0x2')]({'port':0x2329});client[_0x82f6('0x3')]=function(_0x25703c,_0x12280f){return new BPromise(function(_0x11ee28,_0x3629ad){return client[_0x82f6('0x4')](_0x25703c,_0x12280f)[_0x82f6('0x5')](function(_0x541575){logger[_0x82f6('0x6')](_0x82f6('0x7'),_0x82f6('0x1'),_0x25703c,_0x12280f,_0x541575);if(_0x541575['error']){logger[_0x82f6('0x8')](_0x82f6('0x7'),_0x82f6('0x1'),_0x25703c,_0x541575['error'][_0x82f6('0x9')],_0x12280f);return _0x3629ad(_0x541575['error'][_0x82f6('0x9')]);}else{return _0x11ee28(_0x541575[_0x82f6('0xa')]);}})[_0x82f6('0xb')](function(_0x4d3dfc){logger[_0x82f6('0x8')]('rpc','routing',_0x25703c,_0x4d3dfc,_0x12280f);return _0x3629ad(_0x4d3dfc);});});};module['exports']=client; \ No newline at end of file +var _0x082d=['debug','rpc','routing','error','message','result','exports','bluebird','../../config/logger','client','Request','request','then'];(function(_0x167117,_0x2dee70){var _0x387b70=function(_0x58f7e0){while(--_0x58f7e0){_0x167117['push'](_0x167117['shift']());}};_0x387b70(++_0x2dee70);}(_0x082d,0x89));var _0xd082=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x082d[_0x215e65];return _0xa85842;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd082('0x0'));var logger=require(_0xd082('0x1'))('routing');var client=jayson[_0xd082('0x2')]['http']({'port':0x2329});client[_0xd082('0x3')]=function(_0x6b94ed,_0x5e1405){return new BPromise(function(_0x19e673,_0x44969d){return client[_0xd082('0x4')](_0x6b94ed,_0x5e1405)[_0xd082('0x5')](function(_0x207743){logger[_0xd082('0x6')](_0xd082('0x7'),_0xd082('0x8'),_0x6b94ed,_0x5e1405,_0x207743);if(_0x207743['error']){logger['error'](_0xd082('0x7'),_0xd082('0x8'),_0x6b94ed,_0x207743[_0xd082('0x9')][_0xd082('0xa')],_0x5e1405);return _0x44969d(_0x207743[_0xd082('0x9')][_0xd082('0xa')]);}else{return _0x19e673(_0x207743[_0xd082('0xb')]);}})['catch'](function(_0x1f281d){logger[_0xd082('0x9')]('rpc','routing',_0x6b94ed,_0x1f281d,_0x5e1405);return _0x44969d(_0x1f281d);});});};module[_0xd082('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 145abf3..5cc28c6 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 _0x1ed2=['then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0x1ed2,0xfa));var _0x21ed=function(_0x205ef8,_0x21dd3a){_0x205ef8=_0x205ef8-0x0;var _0x6f359e=_0x1ed2[_0x205ef8];return _0x6f359e;};'use strict';var server=require('./server');var Realtime=require(_0x21ed('0x0'));var EmailChannel=require(_0x21ed('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x21ed('0x2'));var logger=require(_0x21ed('0x3'))(_0x21ed('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x21ed('0x5')]()['then'](mailAccount['getMailAccounts']())[_0x21ed('0x6')](realtime[_0x21ed('0x7')]())[_0x21ed('0x6')](function(){email[_0x21ed('0x8')](realtime[_0x21ed('0x9')]);return realtime;});}function main(){return server[_0x21ed('0xa')](realtime,email)[_0x21ed('0x6')](function(){return initRealtime();})[_0x21ed('0x6')](function(){return setting[_0x21ed('0xb')]();})['then'](function(_0x194019){return setInterval(initRealtime,_0x194019[_0x21ed('0xc')]*0x3e8);})[_0x21ed('0xd')](function(_0x46b6bc){logger[_0x21ed('0xe')](_0x21ed('0xf'),_0x46b6bc);});}main(); \ No newline at end of file +var _0xc087=['refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x27d526,_0x540511){var _0x26aadd=function(_0x5cd022){while(--_0x5cd022){_0x27d526['push'](_0x27d526['shift']());}};_0x26aadd(++_0x540511);}(_0xc087,0x106));var _0x7c08=function(_0x261d18,_0x13490f){_0x261d18=_0x261d18-0x0;var _0x3e7208=_0xc087[_0x261d18];return _0x3e7208;};'use strict';var server=require(_0x7c08('0x0'));var Realtime=require(_0x7c08('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x7c08('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x7c08('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7c08('0x4')]()[_0x7c08('0x5')](mailAccount[_0x7c08('0x6')]())[_0x7c08('0x5')](realtime[_0x7c08('0x7')]())['then'](function(){email[_0x7c08('0x8')](realtime[_0x7c08('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x7c08('0x5')](function(){return setting[_0x7c08('0xa')]();})[_0x7c08('0x5')](function(_0x3b7fa7){return setInterval(initRealtime,_0x3b7fa7[_0x7c08('0xb')]*0x3e8);})[_0x7c08('0xc')](function(_0x3a4114){logger[_0x7c08('0xd')](_0x7c08('0xe'),_0x3a4114);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1de8227..7c771fe 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 _0x6030=['bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','key','active','Imap','status','total','isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','sendMail','send','Smtp','lastSync','verify','verified','lodash','moment'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x6030,0x1c6));var _0x0603=function(_0x43cf16,_0x4464c1){_0x43cf16=_0x43cf16-0x0;var _0xba138e=_0x6030[_0x43cf16];return _0xba138e;};'use strict';var _=require(_0x0603('0x0'));var moment=require(_0x0603('0x1'));var BPromise=require(_0x0603('0x2'));var md5=require(_0x0603('0x3'));var Redis=require(_0x0603('0x4'));var config=require(_0x0603('0x5'));var logger=require('../../../config/logger')(_0x0603('0x6'));config[_0x0603('0x7')]=_[_0x0603('0x8')](config[_0x0603('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0603('0x9'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x0603('0xa'));var mailAccount=require(_0x0603('0xb'));var md5Accounts={};function EmailChannel(_0x42c062){logger[_0x0603('0xc')](_0x0603('0xd'));this['mailAccounts']=_0x42c062[_0x0603('0xe')];this[_0x0603('0xf')]={};this[_0x0603('0x10')]=new EmailSmtp();}EmailChannel[_0x0603('0x11')]['emit']=function(_0xda6f74){var _0x21cd61=this[_0x0603('0xe')][_0xda6f74];var _0x454614={'id':_0x21cd61['id'],'name':_0x21cd61['name'],'key':_0x21cd61[_0x0603('0x12')],'active':_0x21cd61[_0x0603('0x13')],'Imap':{'status':_0x21cd61[_0x0603('0x14')][_0x0603('0x15')],'messageStatus':_0x21cd61[_0x0603('0x14')]['messageStatus'],'total':_0x21cd61[_0x0603('0x14')][_0x0603('0x16')]}};if(_[_0x0603('0x17')](md5Accounts[_0xda6f74])){md5Accounts[_0xda6f74]={};}var _0x48c4df=md5(JSON[_0x0603('0x18')](_0x454614));if(md5Accounts[_0xda6f74][_0x0603('0x3')]!==_0x48c4df){md5Accounts[_0xda6f74]['md5']=_0x48c4df;io[_0x0603('0x19')](_0x0603('0x1a'),_0x454614);}};EmailChannel[_0x0603('0x11')][_0x0603('0x1b')]=function(_0x1a4f88){for(var _0x37037d in _0x1a4f88){if(_0x1a4f88[_0x0603('0x1c')](_0x37037d)){if(_0x1a4f88[_0x37037d][_0x0603('0x14')]&&_0x1a4f88[_0x37037d][_0x0603('0x13')]){var _0x4ae0e3=_0x1a4f88[_0x37037d][_0x0603('0x14')];if(!_0x4ae0e3[_0x0603('0x1d')]&&_0x1a4f88[_0x37037d][_0x0603('0x1e')]!==_0x0603('0x1f'))_0x4ae0e3[_0x0603('0x1d')]=_0x1a4f88[_0x37037d]['provider'];if(!this['imapAccounts'][_0x0603('0x1c')](_0x4ae0e3['id'])){this[_0x0603('0xf')][_0x4ae0e3['id']]=new EmailImap(_0x4ae0e3,_0x1a4f88[_0x37037d]['email']);this[_0x0603('0xf')][_0x4ae0e3['id']]['on'](_0x0603('0x20'),this[_0x0603('0x21')]['bind'](this,_0x37037d));this[_0x0603('0xf')][_0x4ae0e3['id']]['on'](_0x0603('0x6'),this[_0x0603('0x22')][_0x0603('0x23')](this,_0x37037d));this[_0x0603('0xf')][_0x4ae0e3['id']]['on'](_0x0603('0x24'),this[_0x0603('0x25')][_0x0603('0x23')](this,_0x37037d));this[_0x0603('0xf')][_0x4ae0e3['id']]['on'](_0x0603('0x26'),this[_0x0603('0x27')][_0x0603('0x23')](this,_0x37037d));}}else{if(_[_0x0603('0x17')](this[_0x0603('0xe')][_0x37037d][_0x0603('0x14')])){this[_0x0603('0xe')][_0x37037d][_0x0603('0x14')]={};}this[_0x0603('0xe')][_0x37037d][_0x0603('0x14')][_0x0603('0x15')]=_0x0603('0x28');this[_0x0603('0xe')][_0x37037d][_0x0603('0x14')][_0x0603('0x29')]='';this[_0x0603('0x19')](_0x37037d);}}}};EmailChannel[_0x0603('0x11')][_0x0603('0x21')]=function(_0x437116,_0x2334fe){if(this[_0x0603('0xe')][_0x437116]){this[_0x0603('0xe')][_0x437116][_0x0603('0x14')][_0x0603('0x15')]=_0x0603('0x2a');this[_0x0603('0xe')][_0x437116][_0x0603('0x14')][_0x0603('0x29')]=_0x2334fe['name'];if(_0x2334fe[_0x0603('0x2b')]){this[_0x0603('0xe')][_0x437116][_0x0603('0x14')]['total']=_0x2334fe[_0x0603('0x2b')][_0x0603('0x16')];}return this['emit'](_0x437116);}};EmailChannel[_0x0603('0x11')]['handleImapEmail']=function(_0x1b4046,_0x588e1d){logger[_0x0603('0xc')](_0x0603('0x2c'),_0x588e1d['firstName'],_0x588e1d[_0x0603('0x2d')],_0x588e1d[_0x0603('0x2e')],_0x1b4046);if(this[_0x0603('0xe')][_0x1b4046]){return mailAccount[_0x0603('0x2f')](_0x1b4046,_0x588e1d)[_0x0603('0x30')](function(_0x31adb0){if(_0x31adb0){logger['info'](_0x0603('0x31'));}})[_0x0603('0x32')](function(_0xa1595){logger[_0x0603('0x26')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x0603('0x18')](_0xa1595));});}};EmailChannel['prototype'][_0x0603('0x25')]=function(_0x64b4eb){if(this[_0x0603('0xe')][_0x64b4eb]&&this['mailAccounts'][_0x64b4eb][_0x0603('0x14')]){if(this[_0x0603('0xf')][this[_0x0603('0xe')][_0x64b4eb][_0x0603('0x14')]['id']]){delete this[_0x0603('0xf')][this[_0x0603('0xe')][_0x64b4eb][_0x0603('0x14')]['id']];}this[_0x0603('0xe')][_0x64b4eb][_0x0603('0x14')]['lastSync']=moment();this[_0x0603('0x19')](_0x64b4eb);}};EmailChannel[_0x0603('0x11')]['handleImapError']=function(_0x40c965,_0x192bce){if(this[_0x0603('0xe')][_0x40c965]){this[_0x0603('0xe')][_0x40c965][_0x0603('0x14')][_0x0603('0x15')]=_0x0603('0x26');this[_0x0603('0xe')][_0x40c965][_0x0603('0x14')][_0x0603('0x29')]=_0x192bce;return this[_0x0603('0x19')](_0x40c965);}};EmailChannel[_0x0603('0x11')][_0x0603('0x33')]=function(_0x434c4b,_0x20e9c8){return this[_0x0603('0x10')][_0x0603('0x34')](_0x434c4b,_0x20e9c8);};EmailChannel[_0x0603('0x11')]['verifySmtp']=function(_0x5df993){var _0x294035=this;if(this['mailAccounts'][_0x5df993['id']]){if(_['isNil'](this['mailAccounts'][_0x5df993['id']][_0x0603('0x35')])){this['mailAccounts'][_0x5df993['id']]['Smtp']={};}this[_0x0603('0xe')][_0x5df993['id']][_0x0603('0x35')][_0x0603('0x36')]=moment();return new BPromise(function(_0x303bc2,_0x15d1d4){return _0x294035[_0x0603('0x10')][_0x0603('0x37')](_0x5df993)[_0x0603('0x30')](function(_0x339e9a){_0x294035[_0x0603('0xe')][_0x5df993['id']][_0x0603('0x35')][_0x0603('0x15')]=_0x0603('0x38');_0x294035['mailAccounts'][_0x5df993['id']]['Smtp'][_0x0603('0x29')]='';_0x294035['emit'](_0x5df993['id']);_0x303bc2(_0x339e9a);})[_0x0603('0x32')](function(_0x89b0d6){_0x294035[_0x0603('0xe')][_0x5df993['id']][_0x0603('0x35')][_0x0603('0x15')]=_0x0603('0x26');_0x294035[_0x0603('0xe')][_0x5df993['id']][_0x0603('0x35')][_0x0603('0x29')]=_0x89b0d6;_0x294035[_0x0603('0x19')](_0x5df993['id']);_0x15d1d4(_0x89b0d6);});});}return this[_0x0603('0x10')][_0x0603('0x37')](_0x5df993);};module['exports']=EmailChannel; \ No newline at end of file +var _0x971c=['lastName','notify','then','Mail\x20accepted\x20from\x20routing','handleImapEnd','lastSync','smtp','send','Smtp','verify','verified','lodash','bluebird','md5','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','key','active','Imap','status','total','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','handleImapBox','bind','handleImapEmail','error','handleImapError','isNil','messageStatus','connected','name','messages','prototype','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName'];(function(_0x466d94,_0x514d65){var _0x3a8d02=function(_0xfd8812){while(--_0xfd8812){_0x466d94['push'](_0x466d94['shift']());}};_0x3a8d02(++_0x514d65);}(_0x971c,0x1ab));var _0xc971=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x971c[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xc971('0x0'));var moment=require('moment');var BPromise=require(_0xc971('0x1'));var md5=require(_0xc971('0x2'));var Redis=require('ioredis');var config=require(_0xc971('0x3'));var logger=require('../../../config/logger')(_0xc971('0x4'));config[_0xc971('0x5')]=_[_0xc971('0x6')](config[_0xc971('0x5')],{'host':_0xc971('0x7'),'port':0x18eb});var io=require(_0xc971('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xc971('0x9'));var EmailSmtp=require(_0xc971('0xa'));var mailAccount=require(_0xc971('0xb'));var md5Accounts={};function EmailChannel(_0x9d9b64){logger[_0xc971('0xc')](_0xc971('0xd'));this[_0xc971('0xe')]=_0x9d9b64['mailAccounts'];this[_0xc971('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xc971('0x10')]=function(_0x3831a8){var _0x3c4f09=this[_0xc971('0xe')][_0x3831a8];var _0x9b4b5d={'id':_0x3c4f09['id'],'name':_0x3c4f09['name'],'key':_0x3c4f09[_0xc971('0x11')],'active':_0x3c4f09[_0xc971('0x12')],'Imap':{'status':_0x3c4f09[_0xc971('0x13')][_0xc971('0x14')],'messageStatus':_0x3c4f09['Imap']['messageStatus'],'total':_0x3c4f09[_0xc971('0x13')][_0xc971('0x15')]}};if(_['isNil'](md5Accounts[_0x3831a8])){md5Accounts[_0x3831a8]={};}var _0x4ccaaf=md5(JSON[_0xc971('0x16')](_0x9b4b5d));if(md5Accounts[_0x3831a8]['md5']!==_0x4ccaaf){md5Accounts[_0x3831a8]['md5']=_0x4ccaaf;io[_0xc971('0x10')](_0xc971('0x17'),_0x9b4b5d);}};EmailChannel['prototype'][_0xc971('0x18')]=function(_0x394f85){for(var _0x52c756 in _0x394f85){if(_0x394f85[_0xc971('0x19')](_0x52c756)){if(_0x394f85[_0x52c756][_0xc971('0x13')]&&_0x394f85[_0x52c756][_0xc971('0x12')]){var _0x2558b8=_0x394f85[_0x52c756]['Imap'];if(!_0x2558b8['service']&&_0x394f85[_0x52c756]['provider']!=='custom')_0x2558b8[_0xc971('0x1a')]=_0x394f85[_0x52c756][_0xc971('0x1b')];if(!this['imapAccounts'][_0xc971('0x19')](_0x2558b8['id'])){this[_0xc971('0xf')][_0x2558b8['id']]=new EmailImap(_0x2558b8,_0x394f85[_0x52c756][_0xc971('0x4')]);this[_0xc971('0xf')][_0x2558b8['id']]['on']('box',this[_0xc971('0x1c')][_0xc971('0x1d')](this,_0x52c756));this[_0xc971('0xf')][_0x2558b8['id']]['on'](_0xc971('0x4'),this[_0xc971('0x1e')][_0xc971('0x1d')](this,_0x52c756));this[_0xc971('0xf')][_0x2558b8['id']]['on']('end',this['handleImapEnd']['bind'](this,_0x52c756));this[_0xc971('0xf')][_0x2558b8['id']]['on'](_0xc971('0x1f'),this[_0xc971('0x20')][_0xc971('0x1d')](this,_0x52c756));}}else{if(_[_0xc971('0x21')](this[_0xc971('0xe')][_0x52c756][_0xc971('0x13')])){this[_0xc971('0xe')][_0x52c756][_0xc971('0x13')]={};}this[_0xc971('0xe')][_0x52c756]['Imap'][_0xc971('0x14')]='disabled';this[_0xc971('0xe')][_0x52c756][_0xc971('0x13')][_0xc971('0x22')]='';this['emit'](_0x52c756);}}}};EmailChannel['prototype'][_0xc971('0x1c')]=function(_0x3abab3,_0x19d6f1){if(this[_0xc971('0xe')][_0x3abab3]){this[_0xc971('0xe')][_0x3abab3][_0xc971('0x13')][_0xc971('0x14')]=_0xc971('0x23');this['mailAccounts'][_0x3abab3][_0xc971('0x13')]['messageStatus']=_0x19d6f1[_0xc971('0x24')];if(_0x19d6f1[_0xc971('0x25')]){this[_0xc971('0xe')][_0x3abab3][_0xc971('0x13')]['total']=_0x19d6f1[_0xc971('0x25')][_0xc971('0x15')];}return this[_0xc971('0x10')](_0x3abab3);}};EmailChannel[_0xc971('0x26')][_0xc971('0x1e')]=function(_0x7ff0d2,_0x3dc686){logger[_0xc971('0xc')](_0xc971('0x27'),_0x3dc686[_0xc971('0x28')],_0x3dc686[_0xc971('0x29')],_0x3dc686['from'],_0x7ff0d2);if(this[_0xc971('0xe')][_0x7ff0d2]){return mailAccount[_0xc971('0x2a')](_0x7ff0d2,_0x3dc686)[_0xc971('0x2b')](function(_0x2cf705){if(_0x2cf705){logger[_0xc971('0xc')](_0xc971('0x2c'));}})['catch'](function(_0x14a41b){logger[_0xc971('0x1f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xc971('0x16')](_0x14a41b));});}};EmailChannel[_0xc971('0x26')][_0xc971('0x2d')]=function(_0x520844){if(this[_0xc971('0xe')][_0x520844]&&this[_0xc971('0xe')][_0x520844][_0xc971('0x13')]){if(this['imapAccounts'][this[_0xc971('0xe')][_0x520844][_0xc971('0x13')]['id']]){delete this[_0xc971('0xf')][this[_0xc971('0xe')][_0x520844][_0xc971('0x13')]['id']];}this[_0xc971('0xe')][_0x520844][_0xc971('0x13')][_0xc971('0x2e')]=moment();this[_0xc971('0x10')](_0x520844);}};EmailChannel[_0xc971('0x26')][_0xc971('0x20')]=function(_0x54dfcf,_0x21211a){if(this[_0xc971('0xe')][_0x54dfcf]){this['mailAccounts'][_0x54dfcf]['Imap'][_0xc971('0x14')]=_0xc971('0x1f');this[_0xc971('0xe')][_0x54dfcf][_0xc971('0x13')]['messageStatus']=_0x21211a;return this[_0xc971('0x10')](_0x54dfcf);}};EmailChannel[_0xc971('0x26')]['sendMail']=function(_0x518bdd,_0x1e6a22){return this[_0xc971('0x2f')][_0xc971('0x30')](_0x518bdd,_0x1e6a22);};EmailChannel[_0xc971('0x26')]['verifySmtp']=function(_0x44bcb2){var _0x48cc9d=this;if(this['mailAccounts'][_0x44bcb2['id']]){if(_[_0xc971('0x21')](this[_0xc971('0xe')][_0x44bcb2['id']][_0xc971('0x31')])){this[_0xc971('0xe')][_0x44bcb2['id']][_0xc971('0x31')]={};}this[_0xc971('0xe')][_0x44bcb2['id']][_0xc971('0x31')]['lastSync']=moment();return new BPromise(function(_0x5c5056,_0x48da94){return _0x48cc9d[_0xc971('0x2f')][_0xc971('0x32')](_0x44bcb2)[_0xc971('0x2b')](function(_0x2fc44a){_0x48cc9d['mailAccounts'][_0x44bcb2['id']][_0xc971('0x31')][_0xc971('0x14')]=_0xc971('0x33');_0x48cc9d[_0xc971('0xe')][_0x44bcb2['id']][_0xc971('0x31')][_0xc971('0x22')]='';_0x48cc9d[_0xc971('0x10')](_0x44bcb2['id']);_0x5c5056(_0x2fc44a);})['catch'](function(_0x3b1e9a){_0x48cc9d['mailAccounts'][_0x44bcb2['id']]['Smtp'][_0xc971('0x14')]=_0xc971('0x1f');_0x48cc9d[_0xc971('0xe')][_0x44bcb2['id']][_0xc971('0x31')]['messageStatus']=_0x3b1e9a;_0x48cc9d['emit'](_0x44bcb2['id']);_0x48da94(_0x3b1e9a);});});}return this[_0xc971('0x2f')][_0xc971('0x32')](_0x44bcb2);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 85754ea..c4475b0 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 _0xdb28=['attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','INBOX','account','getAccount','once','handleReady','bind','end','handleEnd','error','handleError','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','mailbox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody'];(function(_0x51b9cb,_0x3b2ea8){var _0x58ea7a=function(_0x4bb6d3){while(--_0x4bb6d3){_0x51b9cb['push'](_0x51b9cb['shift']());}};_0x58ea7a(++_0x3b2ea8);}(_0xdb28,0x106));var _0x8db2=function(_0x2a5238,_0x267b0a){_0x2a5238=_0x2a5238-0x0;var _0x1596dd=_0xdb28[_0x2a5238];return _0x1596dd;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var Imap=require(_0x8db2('0x2'));var simpleParser=require(_0x8db2('0x3'))['simpleParser'];var Iconv=require(_0x8db2('0x4'))[_0x8db2('0x5')];var EventEmitter=require(_0x8db2('0x6'))[_0x8db2('0x7')];var utils=require(_0x8db2('0x8'));var logger=require('../../../config/logger')(_0x8db2('0x9'));function EmailImap(_0x1d2dd3,_0x5f42ee){this['mailbox']=_0x8db2('0xa');this[_0x8db2('0xb')]=this[_0x8db2('0xc')](_0x1d2dd3,_0x5f42ee);this[_0x8db2('0x2')]=new Imap(this[_0x8db2('0xb')]);this[_0x8db2('0x2')][_0x8db2('0xd')]('ready',this[_0x8db2('0xe')][_0x8db2('0xf')](this));this[_0x8db2('0x2')]['once'](_0x8db2('0x10'),this[_0x8db2('0x11')]['bind'](this));this[_0x8db2('0x2')]['on'](_0x8db2('0x12'),this[_0x8db2('0x13')][_0x8db2('0xf')](this));this[_0x8db2('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x8db2('0x14')][_0x8db2('0xc')]=function(_0x350d61,_0x1d6a15){var _0x227355={'connTimeout':_0x350d61[_0x8db2('0x15')]?_0x350d61[_0x8db2('0x15')]*0x3e8:0x2710,'authTimeout':_0x350d61[_0x8db2('0x16')]?_0x350d61[_0x8db2('0x16')]*0x3e8:0x1388};if(_0x350d61[_0x8db2('0x17')]){_0x227355['user']=_0x350d61[_0x8db2('0x18')];_0x227355[_0x8db2('0x9')]=_0x1d6a15||_0x350d61['user']||_0x8db2('0x19');if(_0x350d61[_0x8db2('0x1a')]){_0x227355[_0x8db2('0x1b')]=utils[_0x8db2('0x1c')](_0x350d61[_0x8db2('0x1d')][_0x8db2('0x1e')],_0x350d61['user']);}else{_0x227355['password']=_0x350d61[_0x8db2('0x1f')];}}else{if(_0x350d61[_0x8db2('0x20')]){_0x227355[_0x8db2('0x18')]=_0x350d61[_0x8db2('0x18')];_0x227355['password']=_0x350d61[_0x8db2('0x1f')];}}_0x227355[_0x8db2('0x21')]=_0x350d61[_0x8db2('0x21')];_0x227355[_0x8db2('0x22')]=_0x350d61[_0x8db2('0x22')]||0x3e1;if(_0x350d61['tls']){_0x227355[_0x8db2('0x23')]=!![];}else{_0x227355[_0x8db2('0x23')]=![];_0x227355[_0x8db2('0x24')]=_0x8db2('0x25');}return _0x227355;};EmailImap[_0x8db2('0x14')][_0x8db2('0xe')]=function(){this[_0x8db2('0x2')]['openBox'](this[_0x8db2('0x26')],![],this['handleOpenBox']['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0xec8cd2,_0x29b5cd){if(_0xec8cd2){this[_0x8db2('0x13')](_0xec8cd2,!![]);}else{this[_0x8db2('0x27')](_0x8db2('0x28'),_0x29b5cd);this[_0x8db2('0x29')]();}};EmailImap['prototype'][_0x8db2('0x2a')]=function(_0x372311){if(_0x372311){this[_0x8db2('0x13')](_0x372311,!![]);}else{this[_0x8db2('0x2')]['end']();}};EmailImap[_0x8db2('0x14')][_0x8db2('0x29')]=function(){this[_0x8db2('0x2')][_0x8db2('0x2b')]([_0x8db2('0x2c')],this[_0x8db2('0x2d')][_0x8db2('0xf')](this));};EmailImap[_0x8db2('0x14')][_0x8db2('0x2d')]=function(_0x493cab,_0x4718ec){if(_0x493cab){this['handleError'](_0x493cab,!![]);}else{if(_0x4718ec['length']){try{var _0x302188=this[_0x8db2('0x2')][_0x8db2('0x2e')](_0x4718ec,{'bodies':'','markSeen':!![]});_0x302188['on']('message',this[_0x8db2('0x2f')]['bind'](this));_0x302188[_0x8db2('0xd')](_0x8db2('0x12'),this[_0x8db2('0x30')]['bind'](this));_0x302188['once'](_0x8db2('0x10'),this[_0x8db2('0x31')]['bind'](this));}catch(_0x516dcb){logger[_0x8db2('0x12')](_0x516dcb);}}else{this[_0x8db2('0x2')][_0x8db2('0x32')](!![],this[_0x8db2('0x2a')][_0x8db2('0xf')](this));}}};EmailImap[_0x8db2('0x14')][_0x8db2('0x2f')]=function(_0xae31b7){_0xae31b7['on'](_0x8db2('0x33'),this[_0x8db2('0x34')]['bind'](this));_0xae31b7[_0x8db2('0xd')](_0x8db2('0x35'),this['handleMessageAttributes'][_0x8db2('0xf')](this));_0xae31b7[_0x8db2('0xd')]('end',this['handleMessageEnd'][_0x8db2('0xf')](this));};EmailImap['prototype'][_0x8db2('0x34')]=function(_0x264696){simpleParser(_0x264696,{'Iconv':Iconv},this[_0x8db2('0x36')][_0x8db2('0xf')](this));};EmailImap['prototype'][_0x8db2('0x37')]=function(){};EmailImap['prototype'][_0x8db2('0x38')]=function(){};EmailImap[_0x8db2('0x14')][_0x8db2('0x36')]=function(_0x4599c3,_0x50e88a){if(_0x4599c3){logger['error'](_0x4599c3);}else{var _0x2acd1f=this;utils[_0x8db2('0x39')](this['account'],_0x50e88a,function(_0x2bac57){_0x2acd1f[_0x8db2('0x27')](_0x8db2('0x9'),_0x2bac57);});}};EmailImap['prototype'][_0x8db2('0x31')]=function(){this[_0x8db2('0x2')][_0x8db2('0x32')](!![],this[_0x8db2('0x2a')][_0x8db2('0xf')](this));};EmailImap[_0x8db2('0x14')][_0x8db2('0x30')]=function(_0x1575ea){this[_0x8db2('0x13')](_0x1575ea);this[_0x8db2('0x2')][_0x8db2('0x32')](!![],this[_0x8db2('0x2a')][_0x8db2('0xf')](this));};EmailImap['prototype'][_0x8db2('0x11')]=function(){this[_0x8db2('0x27')]('end');};EmailImap['prototype'][_0x8db2('0x13')]=function(_0x4f1a49,_0x130eb9){logger[_0x8db2('0x12')](_0x8db2('0x13'),this[_0x8db2('0xb')][_0x8db2('0x9')],JSON[_0x8db2('0x3a')](_0x4f1a49));var _0xa53fba='';if(_0x4f1a49){if(_0x4f1a49['textCode']){_0xa53fba=_0x4f1a49[_0x8db2('0x3b')];}else{for(var _0x3d44de in _0x4f1a49){if(_0x4f1a49[_0x8db2('0x3c')](_0x3d44de)){_0xa53fba+=_[_0x8db2('0x3d')](_0x3d44de)+':\x20'+_0x4f1a49[_0x3d44de]+'\x0a';}}}}if(_0x130eb9){this['imap'][_0x8db2('0x10')]();}else{this[_0x8db2('0x27')](_0x8db2('0x12'),_0xa53fba);this[_0x8db2('0x27')]('end');}};module[_0x8db2('0x3e')]=EmailImap; \ No newline at end of file +var _0x3d04=['handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','emit','hasOwnProperty','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','getAccount','account','once','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','generateXOAuth2Token','data5','password','authentication','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','error','handleFetchError'];(function(_0xb99ded,_0x3261c5){var _0x12847a=function(_0x35d97f){while(--_0x35d97f){_0xb99ded['push'](_0xb99ded['shift']());}};_0x12847a(++_0x3261c5);}(_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 Imap=require(_0x43d0('0x2'));var simpleParser=require(_0x43d0('0x3'))[_0x43d0('0x4')];var Iconv=require(_0x43d0('0x5'))[_0x43d0('0x6')];var EventEmitter=require(_0x43d0('0x7'))['EventEmitter'];var utils=require(_0x43d0('0x8'));var logger=require(_0x43d0('0x9'))(_0x43d0('0xa'));function EmailImap(_0x617bf,_0x5e284f){this['mailbox']='INBOX';this['account']=this[_0x43d0('0xb')](_0x617bf,_0x5e284f);this[_0x43d0('0x2')]=new Imap(this[_0x43d0('0xc')]);this[_0x43d0('0x2')][_0x43d0('0xd')]('ready',this['handleReady'][_0x43d0('0xe')](this));this['imap']['once'](_0x43d0('0xf'),this[_0x43d0('0x10')][_0x43d0('0xe')](this));this[_0x43d0('0x2')]['on']('error',this[_0x43d0('0x11')][_0x43d0('0xe')](this));this['imap'][_0x43d0('0x12')]();}util[_0x43d0('0x13')](EmailImap,EventEmitter);EmailImap[_0x43d0('0x14')]['getAccount']=function(_0xd262a8,_0x2454fa){var _0x436130={'connTimeout':_0xd262a8['connTimeout']?_0xd262a8[_0x43d0('0x15')]*0x3e8:0x2710,'authTimeout':_0xd262a8[_0x43d0('0x16')]?_0xd262a8[_0x43d0('0x16')]*0x3e8:0x1388};if(_0xd262a8[_0x43d0('0x17')]){_0x436130[_0x43d0('0x18')]=_0xd262a8['user'];_0x436130['email']=_0x2454fa||_0xd262a8[_0x43d0('0x18')]||_0x43d0('0x19');if(_0xd262a8[_0x43d0('0x1a')]){_0x436130['xoauth2']=utils[_0x43d0('0x1b')](_0xd262a8['CloudProvider'][_0x43d0('0x1c')],_0xd262a8[_0x43d0('0x18')]);}else{_0x436130[_0x43d0('0x1d')]=_0xd262a8['password'];}}else{if(_0xd262a8[_0x43d0('0x1e')]){_0x436130[_0x43d0('0x18')]=_0xd262a8['user'];_0x436130[_0x43d0('0x1d')]=_0xd262a8[_0x43d0('0x1d')];}}_0x436130[_0x43d0('0x1f')]=_0xd262a8[_0x43d0('0x1f')];_0x436130[_0x43d0('0x20')]=_0xd262a8[_0x43d0('0x20')]||0x3e1;if(_0xd262a8[_0x43d0('0x21')]){_0x436130[_0x43d0('0x21')]=!![];}else{_0x436130[_0x43d0('0x21')]=![];_0x436130[_0x43d0('0x22')]=_0x43d0('0x23');}return _0x436130;};EmailImap[_0x43d0('0x14')][_0x43d0('0x24')]=function(){this[_0x43d0('0x2')][_0x43d0('0x25')](this['mailbox'],![],this[_0x43d0('0x26')][_0x43d0('0xe')](this));};EmailImap['prototype'][_0x43d0('0x26')]=function(_0x5456ab,_0x29c111){if(_0x5456ab){this[_0x43d0('0x11')](_0x5456ab,!![]);}else{this['emit'](_0x43d0('0x27'),_0x29c111);this[_0x43d0('0x28')]();}};EmailImap['prototype'][_0x43d0('0x29')]=function(_0x4692bc){if(_0x4692bc){this[_0x43d0('0x11')](_0x4692bc,!![]);}else{this['imap'][_0x43d0('0xf')]();}};EmailImap[_0x43d0('0x14')][_0x43d0('0x28')]=function(){this[_0x43d0('0x2')][_0x43d0('0x2a')]([_0x43d0('0x2b')],this[_0x43d0('0x2c')]['bind'](this));};EmailImap[_0x43d0('0x14')][_0x43d0('0x2c')]=function(_0x6bc471,_0x5f3d38){if(_0x6bc471){this['handleError'](_0x6bc471,!![]);}else{if(_0x5f3d38['length']){try{var _0x3c1ea3=this[_0x43d0('0x2')][_0x43d0('0x2d')](_0x5f3d38,{'bodies':'','markSeen':!![]});_0x3c1ea3['on'](_0x43d0('0x2e'),this[_0x43d0('0x2f')][_0x43d0('0xe')](this));_0x3c1ea3['once'](_0x43d0('0x30'),this[_0x43d0('0x31')][_0x43d0('0xe')](this));_0x3c1ea3[_0x43d0('0xd')](_0x43d0('0xf'),this[_0x43d0('0x32')][_0x43d0('0xe')](this));}catch(_0x1bdd74){logger[_0x43d0('0x30')](_0x1bdd74);}}else{this[_0x43d0('0x2')][_0x43d0('0x33')](!![],this['handleCloseBox'][_0x43d0('0xe')](this));}}};EmailImap[_0x43d0('0x14')][_0x43d0('0x2f')]=function(_0x4058df){_0x4058df['on']('body',this[_0x43d0('0x34')]['bind'](this));_0x4058df[_0x43d0('0xd')](_0x43d0('0x35'),this['handleMessageAttributes'][_0x43d0('0xe')](this));_0x4058df[_0x43d0('0xd')](_0x43d0('0xf'),this[_0x43d0('0x36')][_0x43d0('0xe')](this));};EmailImap[_0x43d0('0x14')][_0x43d0('0x34')]=function(_0x21d26e){simpleParser(_0x21d26e,{'Iconv':Iconv},this[_0x43d0('0x37')][_0x43d0('0xe')](this));};EmailImap[_0x43d0('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0x43d0('0x14')][_0x43d0('0x36')]=function(){};EmailImap[_0x43d0('0x14')][_0x43d0('0x37')]=function(_0x294828,_0x201453){if(_0x294828){logger[_0x43d0('0x30')](_0x294828);}else{var _0xf5b750=this;utils[_0x43d0('0x38')](this[_0x43d0('0xc')],_0x201453,function(_0x235fb2){_0xf5b750[_0x43d0('0x39')](_0x43d0('0xa'),_0x235fb2);});}};EmailImap[_0x43d0('0x14')]['handleFetchEnd']=function(){this[_0x43d0('0x2')][_0x43d0('0x33')](!![],this[_0x43d0('0x29')][_0x43d0('0xe')](this));};EmailImap[_0x43d0('0x14')][_0x43d0('0x31')]=function(_0x420256){this[_0x43d0('0x11')](_0x420256);this['imap']['closeBox'](!![],this[_0x43d0('0x29')]['bind'](this));};EmailImap['prototype'][_0x43d0('0x10')]=function(){this['emit'](_0x43d0('0xf'));};EmailImap['prototype'][_0x43d0('0x11')]=function(_0x51a257,_0x41c002){logger[_0x43d0('0x30')](_0x43d0('0x11'),this['account'][_0x43d0('0xa')],JSON['stringify'](_0x51a257));var _0x19ff9a='';if(_0x51a257){if(_0x51a257['textCode']){_0x19ff9a=_0x51a257['textCode'];}else{for(var _0x32fdcd in _0x51a257){if(_0x51a257[_0x43d0('0x3a')](_0x32fdcd)){_0x19ff9a+=_['upperFirst'](_0x32fdcd)+':\x20'+_0x51a257[_0x32fdcd]+'\x0a';}}}}if(_0x41c002){this[_0x43d0('0x2')][_0x43d0('0xf')]();}else{this[_0x43d0('0x39')](_0x43d0('0x30'),_0x19ff9a);this[_0x43d0('0x39')]('end');}};module[_0x43d0('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8e46d4b..50432cd 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 _0xe62d=['exports','nodemailer','send','createTransport','use','compile','sendMail','prototype','verify'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0xe62d,0xeb));var _0xde62=function(_0x621bee,_0x58f8c0){_0x621bee=_0x621bee-0x0;var _0x3076c8=_0xe62d[_0x621bee];return _0x3076c8;};'use strict';var nodemailer=require(_0xde62('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xde62('0x1')]=function(_0x26f0f9,_0xaac8e4){return new Promise(function(_0xa0091e,_0x1497f8){var _0x2f2152=nodemailer[_0xde62('0x2')](_0x26f0f9);_0x2f2152[_0xde62('0x3')](_0xde62('0x4'),inlineBase64());_0x2f2152[_0xde62('0x5')](_0xaac8e4,function(_0x1a921e,_0x4d0cdc){if(_0x1a921e){_0x1497f8(_0x1a921e['toString']());}else{_0xa0091e(_0x4d0cdc);}});});};EmailSmtp[_0xde62('0x6')][_0xde62('0x7')]=function(_0x586608){return new Promise(function(_0x2ff68a,_0x27f491){var _0x48c67c=nodemailer['createTransport'](_0x586608);_0x48c67c[_0xde62('0x7')](function(_0x171c5f,_0xea0a07){if(_0x171c5f){_0x27f491(_0x171c5f['toString']());}else{if(_0xea0a07){_0x2ff68a(_0xea0a07);}else{_0x27f491('Not\x20verifired');}}});});};module[_0xde62('0x8')]=EmailSmtp; \ No newline at end of file +var _0x42d7=['verify','Not\x20verifired','exports','prototype','use','sendMail','toString','createTransport'];(function(_0x194897,_0x29cd4c){var _0x1ea0f8=function(_0x572c73){while(--_0x572c73){_0x194897['push'](_0x194897['shift']());}};_0x1ea0f8(++_0x29cd4c);}(_0x42d7,0xc3));var _0x742d=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x42d7[_0x251d9c];return _0x16ae64;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x742d('0x0')]['send']=function(_0x350e7c,_0x2b8fce){return new Promise(function(_0x5ed3ec,_0x5bf446){var _0x25034a=nodemailer['createTransport'](_0x350e7c);_0x25034a[_0x742d('0x1')]('compile',inlineBase64());_0x25034a[_0x742d('0x2')](_0x2b8fce,function(_0x14b17f,_0x505580){if(_0x14b17f){_0x5bf446(_0x14b17f[_0x742d('0x3')]());}else{_0x5ed3ec(_0x505580);}});});};EmailSmtp[_0x742d('0x0')]['verify']=function(_0x216db4){return new Promise(function(_0x549825,_0x253258){var _0xc48b57=nodemailer[_0x742d('0x4')](_0x216db4);_0xc48b57[_0x742d('0x5')](function(_0x36dd58,_0x31ef09){if(_0x36dd58){_0x253258(_0x36dd58[_0x742d('0x3')]());}else{if(_0x31ef09){_0x549825(_0x31ef09);}else{_0x253258(_0x742d('0x6'));}}});});};module[_0x742d('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 80425ce..22a9c13 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 _0xbd28=['Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments'];(function(_0x1ca6a2,_0x413e1a){var _0x3b55ba=function(_0x346463){while(--_0x346463){_0x1ca6a2['push'](_0x1ca6a2['shift']());}};_0x3b55ba(++_0x413e1a);}(_0xbd28,0xe9));var _0x8bd2=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xbd28[_0x2132a3];return _0x21890c;};'use strict';var _=require(_0x8bd2('0x0'));var moment=require(_0x8bd2('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x8bd2('0x2'));var util=require(_0x8bd2('0x3'));var tnef=require(_0x8bd2('0x4'));var logger=require(_0x8bd2('0x5'))(_0x8bd2('0x6'));var config=require(_0x8bd2('0x7'));function getAddress(_0x593fe1){var _0x1b432a=_['head'](_0x593fe1[_0x8bd2('0x8')]);return _0x1b432a&&_0x1b432a[_0x8bd2('0x9')]?_0x1b432a[_0x8bd2('0x9')]:_0x8bd2('0xa')+random[_0x8bd2('0xb')](0x6)+_0x8bd2('0xc');}function getFirstName(_0x4bdab8){var _0x154746=_[_0x8bd2('0xd')](_0x4bdab8[_0x8bd2('0x8')]);if(_0x154746&&_0x154746[_0x8bd2('0xe')]){if(_0x154746[_0x8bd2('0xe')]==_0x154746[_0x8bd2('0x9')]){return _0x154746[_0x8bd2('0xe')][_0x8bd2('0xf')](0x0,_0x154746[_0x8bd2('0xe')]['indexOf']('@'));}var _0x16eac3=_0x154746[_0x8bd2('0xe')][_0x8bd2('0x10')](/\s+/);return _0x16eac3[_0x8bd2('0x11')]>0x1?_0x16eac3[_0x8bd2('0x12')](0x0,-0x1)[_0x8bd2('0x13')]('\x20'):_0x154746[_0x8bd2('0xe')];}return _0x8bd2('0x14');}function getLastName(_0x166445){var _0x244283=_[_0x8bd2('0xd')](_0x166445[_0x8bd2('0x8')]);if(_0x244283&&_0x244283[_0x8bd2('0xe')]){var _0x39aebe=_0x244283[_0x8bd2('0xe')][_0x8bd2('0x10')](/\s+/);return _0x39aebe[_0x8bd2('0x11')]>0x1?_0x39aebe[_0x8bd2('0x15')]():'';}return'';}function getMails(_0x5c0025,_0x423411){var _0x425f5a='';for(var _0xe97eeb=0x0;_0xe97eeb<_0x423411[_0x8bd2('0x8')][_0x8bd2('0x11')];_0xe97eeb+=0x1){if(_0x423411[_0x8bd2('0x8')][_0xe97eeb][_0x8bd2('0x9')]!==_0x5c0025){if(!_[_0x8bd2('0x16')](_0x425f5a)){_0x425f5a+=',';}_0x425f5a+=_0x423411['value'][_0xe97eeb][_0x8bd2('0xe')]||_0x423411[_0x8bd2('0x8')][_0xe97eeb]['address']||'';_0x425f5a+='\x20<';_0x425f5a+=_0x423411[_0x8bd2('0x8')][_0xe97eeb][_0x8bd2('0x9')]?_0x423411[_0x8bd2('0x8')][_0xe97eeb][_0x8bd2('0x9')]:_0x8bd2('0xa')+random[_0x8bd2('0xb')](0x6)+'@xcally.com';_0x425f5a+='>';}}return _0x425f5a;}function parseEmail(_0x59b876,_0x199c6e,_0x56e294){if(_0x199c6e[_0x8bd2('0x17')]){var _0xf53414=/)<[^<]*)*<\/script>/gi;while(_0xf53414[_0x8bd2('0x18')](_0x199c6e[_0x8bd2('0x17')])){_0x199c6e[_0x8bd2('0x17')]=_0x199c6e[_0x8bd2('0x17')]['replace'](_0xf53414,'');}if(_0x199c6e[_0x8bd2('0x17')][_0x8bd2('0x19')](_0x8bd2('0x1a'))){var _0x72ae92=[];_0x199c6e['attachments']['forEach'](_0x3f366e=>{_0x72ae92[_0x8bd2('0x1b')](_0x3f366e['filename']);});var _0x39e615=/]+>/g;var _0x161175=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x466a3b=_0x199c6e[_0x8bd2('0x17')][_0x8bd2('0x1c')](_0x161175,'_SRC');var _0x213af6=_0x466a3b[_0x8bd2('0x1c')](_0x39e615,_0x8bd2('0x1d'));for(let _0x16d692=0x0;_0x16d692<_0x72ae92[_0x8bd2('0x11')];_0x16d692++){var _0x232268=_0x213af6[_0x8bd2('0x1c')]('_IMG',_0x8bd2('0x1e')+_0x72ae92[_0x16d692]+_0x8bd2('0x1f'));_0x213af6=_0x232268;}_0x199c6e[_0x8bd2('0x17')]=_0x213af6;}_0x56e294['body']=_0x199c6e[_0x8bd2('0x17')];}else{_0x56e294[_0x8bd2('0x20')]=_0x199c6e[_0x8bd2('0x21')];}if(_0x56e294[_0x8bd2('0x20')]){_0x56e294['body']=_0x56e294[_0x8bd2('0x20')][_0x8bd2('0x1c')](/0x0){var _0x3218ab=[_0x8bd2('0x30'),'X-Auto-Response-Suppress:\x20All',_0x8bd2('0x31')];for(var _0x1c441b=0x0;_0x1c441b<_0x199c6e[_0x8bd2('0x2f')][_0x8bd2('0x11')];_0x1c441b++){var _0x354f90=_[_0x8bd2('0x32')](_0x3218ab,_0x199c6e['headerLines'][_0x1c441b][_0x8bd2('0x33')]);if(_0x354f90>=0x0){_0x56e294[_0x8bd2('0x34')]=!![];}}}return _0x56e294;}exports[_0x8bd2('0x35')]=function(_0x34a5a3,_0x398fcf,_0x3d8d97){var _0x331f99={'from':getAddress(_0x398fcf[_0x8bd2('0x36')]),'firstName':getFirstName(_0x398fcf[_0x8bd2('0x36')]),'lastName':getLastName(_0x398fcf['from']),'mapKey':_0x8bd2('0x6'),'message':{'from':getMails(_0x34a5a3[_0x8bd2('0x6')],_0x398fcf[_0x8bd2('0x36')]),'to':_0x34a5a3[_0x8bd2('0x6')],'cc':'','subject':_0x398fcf[_0x8bd2('0x37')]||'','messageId':_0x398fcf[_0x8bd2('0x38')],'inReplyTo':_0x398fcf['inReplyTo'],'sentAt':moment(_0x398fcf[_0x8bd2('0x39')])[_0x8bd2('0x3a')](_0x8bd2('0x3b')),'attach':![],'attachments':[]}};if(!_0x398fcf[_0x8bd2('0x17')]&&!_0x398fcf[_0x8bd2('0x21')]){var _0x262aa9=_[_0x8bd2('0x3c')](_0x398fcf[_0x8bd2('0x28')],{'contentType':'application/ms-tnef'});if(_0x262aa9[_0x8bd2('0x11')]){logger[_0x8bd2('0x3d')](util[_0x8bd2('0x3a')](_0x8bd2('0x3e'),_0x398fcf['messageId']));tnef[_0x8bd2('0x3f')](_[_0x8bd2('0x40')](_0x262aa9)[_0x8bd2('0x2d')],function(_0x27c5b7,_0x55bd26){if(_0x55bd26){_0x398fcf[_0x8bd2('0x17')]=_0x55bd26['BodyHTML']||_0x8bd2('0x41');if(_0x55bd26[_0x8bd2('0x42')]){for(var _0x1052db=0x0;_0x1052db<_0x55bd26[_0x8bd2('0x42')]['length'];_0x1052db++){var _0x5c594f=_0x55bd26[_0x8bd2('0x42')][_0x1052db];_0x331f99[_0x8bd2('0x23')][_0x8bd2('0x28')][_0x8bd2('0x1b')]({'filename':_0x5c594f[_0x8bd2('0x43')],'content':Buffer['from'](_0x5c594f[_0x8bd2('0x44')])});}}}_0x3d8d97(parseEmail(_0x34a5a3,_0x398fcf,_0x331f99));});}else{_0x398fcf[_0x8bd2('0x17')]=_0x8bd2('0x41');_0x3d8d97(parseEmail(_0x34a5a3,_0x398fcf,_0x331f99));}}else{_0x3d8d97(parseEmail(_0x34a5a3,_0x398fcf,_0x331f99));}};exports[_0x8bd2('0x45')]=function(_0x15a305,_0x5c6b38){var _0x2f4111=[_0x8bd2('0x46')+(_0x5c6b38||''),_0x8bd2('0x47')+_0x15a305,'',''];return Buffer[_0x8bd2('0x36')](_0x2f4111[_0x8bd2('0x13')](''),_0x8bd2('0x48'))[_0x8bd2('0x49')](_0x8bd2('0x4a'));}; \ No newline at end of file +var _0x7806=['split','length','slice','Anonymous','isEmpty','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','generate','@xcally.com','name','substring'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7806,0x15f));var _0x6780=function(_0x465e42,_0x5b571b){_0x465e42=_0x465e42-0x0;var _0x2e2fa7=_0x7806[_0x465e42];return _0x2e2fa7;};'use strict';var _=require(_0x6780('0x0'));var moment=require('moment');var random=require(_0x6780('0x1'));var fs=require('fs');var path=require(_0x6780('0x2'));var util=require(_0x6780('0x3'));var tnef=require(_0x6780('0x4'));var logger=require(_0x6780('0x5'))(_0x6780('0x6'));var config=require('../../../config/environment');function getAddress(_0x301d5a){var _0x3a9527=_[_0x6780('0x7')](_0x301d5a[_0x6780('0x8')]);return _0x3a9527&&_0x3a9527[_0x6780('0x9')]?_0x3a9527['address']:'anonymous'+random[_0x6780('0xa')](0x6)+_0x6780('0xb');}function getFirstName(_0x356372){var _0x40a0f5=_[_0x6780('0x7')](_0x356372[_0x6780('0x8')]);if(_0x40a0f5&&_0x40a0f5[_0x6780('0xc')]){if(_0x40a0f5['name']==_0x40a0f5[_0x6780('0x9')]){return _0x40a0f5[_0x6780('0xc')][_0x6780('0xd')](0x0,_0x40a0f5[_0x6780('0xc')]['indexOf']('@'));}var _0x487062=_0x40a0f5[_0x6780('0xc')][_0x6780('0xe')](/\s+/);return _0x487062[_0x6780('0xf')]>0x1?_0x487062[_0x6780('0x10')](0x0,-0x1)['join']('\x20'):_0x40a0f5[_0x6780('0xc')];}return _0x6780('0x11');}function getLastName(_0x307485){var _0x346cf5=_[_0x6780('0x7')](_0x307485[_0x6780('0x8')]);if(_0x346cf5&&_0x346cf5['name']){var _0x4fbd44=_0x346cf5[_0x6780('0xc')]['split'](/\s+/);return _0x4fbd44[_0x6780('0xf')]>0x1?_0x4fbd44['pop']():'';}return'';}function getMails(_0x5e71df,_0x485830){var _0x1545f2='';for(var _0x34be4c=0x0;_0x34be4c<_0x485830[_0x6780('0x8')][_0x6780('0xf')];_0x34be4c+=0x1){if(_0x485830['value'][_0x34be4c][_0x6780('0x9')]!==_0x5e71df){if(!_[_0x6780('0x12')](_0x1545f2)){_0x1545f2+=',';}_0x1545f2+=_0x485830['value'][_0x34be4c][_0x6780('0xc')]||_0x485830['value'][_0x34be4c]['address']||'';_0x1545f2+='\x20<';_0x1545f2+=_0x485830[_0x6780('0x8')][_0x34be4c]['address']?_0x485830[_0x6780('0x8')][_0x34be4c][_0x6780('0x9')]:_0x6780('0x13')+random[_0x6780('0xa')](0x6)+_0x6780('0xb');_0x1545f2+='>';}}return _0x1545f2;}function parseEmail(_0x282fd3,_0x5b4fdb,_0x3c9959){if(_0x5b4fdb[_0x6780('0x14')]){var _0x558dc6=/)<[^<]*)*<\/script>/gi;while(_0x558dc6[_0x6780('0x15')](_0x5b4fdb[_0x6780('0x14')])){_0x5b4fdb[_0x6780('0x14')]=_0x5b4fdb[_0x6780('0x14')][_0x6780('0x16')](_0x558dc6,'');}if(_0x5b4fdb[_0x6780('0x14')][_0x6780('0x17')](_0x6780('0x18'))){var _0x373ddf=[];_0x5b4fdb[_0x6780('0x19')]['forEach'](_0x4efc55=>{_0x373ddf[_0x6780('0x1a')](_0x4efc55[_0x6780('0x1b')]);});var _0x4a69ae=/]+>/g;var _0x159825=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x333946=_0x5b4fdb[_0x6780('0x14')][_0x6780('0x16')](_0x159825,_0x6780('0x1c'));var _0x3e2d7d=_0x333946[_0x6780('0x16')](_0x4a69ae,_0x6780('0x1d'));for(let _0x28c901=0x0;_0x28c901<_0x373ddf[_0x6780('0xf')];_0x28c901++){var _0x1aab58=_0x3e2d7d['replace'](_0x6780('0x1d'),_0x6780('0x1e')+_0x373ddf[_0x28c901]+_0x6780('0x1f'));_0x3e2d7d=_0x1aab58;}_0x5b4fdb[_0x6780('0x14')]=_0x3e2d7d;}_0x3c9959[_0x6780('0x20')]=_0x5b4fdb[_0x6780('0x14')];}else{_0x3c9959['body']=_0x5b4fdb['textAsHtml'];}if(_0x3c9959['body']){_0x3c9959[_0x6780('0x20')]=_0x3c9959['body'][_0x6780('0x16')](/0x0){var _0x239347=[_0x6780('0x32'),'X-Auto-Response-Suppress:\x20All',_0x6780('0x33')];for(var _0x5daea9=0x0;_0x5daea9<_0x5b4fdb['headerLines'][_0x6780('0xf')];_0x5daea9++){var _0x302a87=_[_0x6780('0x34')](_0x239347,_0x5b4fdb[_0x6780('0x31')][_0x5daea9][_0x6780('0x35')]);if(_0x302a87>=0x0){_0x3c9959[_0x6780('0x36')]=!![];}}}return _0x3c9959;}exports[_0x6780('0x37')]=function(_0x133f7c,_0x4df9a0,_0x56561c){var _0x115d0e={'from':getAddress(_0x4df9a0[_0x6780('0x38')]),'firstName':getFirstName(_0x4df9a0[_0x6780('0x38')]),'lastName':getLastName(_0x4df9a0[_0x6780('0x38')]),'mapKey':_0x6780('0x6'),'message':{'from':getMails(_0x133f7c[_0x6780('0x6')],_0x4df9a0['from']),'to':_0x133f7c['email'],'cc':'','subject':_0x4df9a0[_0x6780('0x39')]||'','messageId':_0x4df9a0[_0x6780('0x3a')],'inReplyTo':_0x4df9a0['inReplyTo'],'sentAt':moment(_0x4df9a0[_0x6780('0x3b')])[_0x6780('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4df9a0[_0x6780('0x14')]&&!_0x4df9a0[_0x6780('0x3c')]){var _0x3666f6=_[_0x6780('0x3d')](_0x4df9a0[_0x6780('0x19')],{'contentType':'application/ms-tnef'});if(_0x3666f6['length']){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x4df9a0[_0x6780('0x3a')]));tnef['parseBuffer'](_['first'](_0x3666f6)[_0x6780('0x2f')],function(_0x56c3a4,_0x3dbbb1){if(_0x3dbbb1){_0x4df9a0[_0x6780('0x14')]=_0x3dbbb1[_0x6780('0x3e')]||_0x6780('0x3f');if(_0x3dbbb1[_0x6780('0x40')]){for(var _0x5663b3=0x0;_0x5663b3<_0x3dbbb1[_0x6780('0x40')][_0x6780('0xf')];_0x5663b3++){var _0x2ce125=_0x3dbbb1['Attachments'][_0x5663b3];_0x115d0e[_0x6780('0x23')][_0x6780('0x19')][_0x6780('0x1a')]({'filename':_0x2ce125[_0x6780('0x41')],'content':Buffer[_0x6780('0x38')](_0x2ce125[_0x6780('0x42')])});}}}_0x56561c(parseEmail(_0x133f7c,_0x4df9a0,_0x115d0e));});}else{_0x4df9a0[_0x6780('0x14')]='

Empty\x20message

';_0x56561c(parseEmail(_0x133f7c,_0x4df9a0,_0x115d0e));}}else{_0x56561c(parseEmail(_0x133f7c,_0x4df9a0,_0x115d0e));}};exports[_0x6780('0x43')]=function(_0x41b451,_0x410249){var _0xdb6cdc=[_0x6780('0x44')+(_0x410249||''),_0x6780('0x45')+_0x41b451,'',''];return Buffer['from'](_0xdb6cdc[_0x6780('0x2b')](''),_0x6780('0x46'))[_0x6780('0x47')](_0x6780('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e090957..6270a6c 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 _0x4f39=['Smtp','exports','lodash','name','Service','key','active','Imap'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x4f39,0x1c2));var _0x94f3=function(_0x5c2c9a,_0x320da7){_0x5c2c9a=_0x5c2c9a-0x0;var _0x1d5f91=_0x4f39[_0x5c2c9a];return _0x1d5f91;};'use strict';var _=require(_0x94f3('0x0'));function MailAccount(_0x5c285d){this['id']=_0x5c285d['id']||0x0;this[_0x94f3('0x1')]=_0x5c285d[_0x94f3('0x1')]||_0x94f3('0x2');this[_0x94f3('0x3')]=_0x5c285d[_0x94f3('0x3')]||'SERV';this[_0x94f3('0x4')]=_0x5c285d[_0x94f3('0x4')]||![];this[_0x94f3('0x5')]=_0x5c285d[_0x94f3('0x5')]||[];this['Smtp']=_0x5c285d[_0x94f3('0x6')]||[];}module[_0x94f3('0x7')]=MailAccount; \ No newline at end of file +var _0x56b6=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x56b6,0xbd));var _0x656b=function(_0x2af52c,_0x2e3e78){_0x2af52c=_0x2af52c-0x0;var _0x6a7536=_0x56b6[_0x2af52c];return _0x6a7536;};'use strict';var _=require(_0x656b('0x0'));function MailAccount(_0x3a9bcd){this['id']=_0x3a9bcd['id']||0x0;this[_0x656b('0x1')]=_0x3a9bcd[_0x656b('0x1')]||_0x656b('0x2');this['key']=_0x3a9bcd[_0x656b('0x3')]||_0x656b('0x4');this[_0x656b('0x5')]=_0x3a9bcd['active']||![];this[_0x656b('0x6')]=_0x3a9bcd[_0x656b('0x6')]||[];this[_0x656b('0x7')]=_0x3a9bcd[_0x656b('0x7')]||[];}module[_0x656b('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 85cb64d..654d737 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 _0x24a7=['initMailAccounts','merge','lodash','mailAccounts','mapKeys','prototype'];(function(_0x1ff958,_0x2bde8f){var _0x145204=function(_0x45e809){while(--_0x45e809){_0x1ff958['push'](_0x1ff958['shift']());}};_0x145204(++_0x2bde8f);}(_0x24a7,0x134));var _0x724a=function(_0x41172d,_0xdc95d9){_0x41172d=_0x41172d-0x0;var _0x3167b5=_0x24a7[_0x41172d];return _0x3167b5;};'use strict';var _=require(_0x724a('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x724a('0x1')]={};};function freeIsNotKey(_0xa0b515,_0x2c4f90,_0x4305d2){var _0x4385c4=_[_0x724a('0x2')](_0xa0b515,function(_0x2911e4,_0x553821){return _0x2911e4[_0x4305d2];});for(var _0x3a0e32 in _0x2c4f90){if(_0x2c4f90['hasOwnProperty'](_0x3a0e32)){if(!_0x4385c4[_0x3a0e32]){delete _0x2c4f90[_0x3a0e32];}}}}Realtime[_0x724a('0x3')]['mergeFromDatabase']=function(_0x55cd5e,_0x34a497){for(var _0x4000f7 in _0x34a497){if(_0x55cd5e['hasOwnProperty'](_0x4000f7)){_0x55cd5e[_0x4000f7]=_0x34a497[_0x4000f7];}}};Realtime[_0x724a('0x3')][_0x724a('0x4')]=function(){var _0x394161=this;return function(_0x327c66){if(_0x327c66){freeIsNotKey(_0x327c66,_0x394161[_0x724a('0x1')],'id');for(var _0x4ae7db=0x0,_0x1de0ed={},_0x581075={};_0x4ae7db<_0x327c66['length'];_0x4ae7db+=0x1){_0x1de0ed=_0x327c66[_0x4ae7db];if(_['isUndefined'](_0x394161[_0x724a('0x1')][_0x1de0ed['id']])){_0x394161[_0x724a('0x1')][_0x1de0ed['id']]=new MailAccount(_0x1de0ed);}else{_[_0x724a('0x5')](_0x394161[_0x724a('0x1')][_0x1de0ed['id']],_0x1de0ed);}}}return _0x394161[_0x724a('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0xf286=['mailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','initMailAccounts'];(function(_0xcb5dcc,_0x3429b6){var _0x3e1fdd=function(_0x25531c){while(--_0x25531c){_0xcb5dcc['push'](_0xcb5dcc['shift']());}};_0x3e1fdd(++_0x3429b6);}(_0xf286,0x19c));var _0x6f28=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xf286[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x6f28('0x0'));var MailAccount=require(_0x6f28('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2d21fb,_0x2ddd7e,_0x2bc31f){var _0x1fb61d=_[_0x6f28('0x2')](_0x2d21fb,function(_0xca3a60,_0x2d93d7){return _0xca3a60[_0x2bc31f];});for(var _0x310d8c in _0x2ddd7e){if(_0x2ddd7e[_0x6f28('0x3')](_0x310d8c)){if(!_0x1fb61d[_0x310d8c]){delete _0x2ddd7e[_0x310d8c];}}}}Realtime['prototype'][_0x6f28('0x4')]=function(_0x3b0f77,_0xe95268){for(var _0x12b320 in _0xe95268){if(_0x3b0f77[_0x6f28('0x3')](_0x12b320)){_0x3b0f77[_0x12b320]=_0xe95268[_0x12b320];}}};Realtime['prototype'][_0x6f28('0x5')]=function(){var _0x148d28=this;return function(_0x1bc6fa){if(_0x1bc6fa){freeIsNotKey(_0x1bc6fa,_0x148d28[_0x6f28('0x6')],'id');for(var _0x671c9d=0x0,_0x3e0c22={},_0x353d43={};_0x671c9d<_0x1bc6fa[_0x6f28('0x7')];_0x671c9d+=0x1){_0x3e0c22=_0x1bc6fa[_0x671c9d];if(_[_0x6f28('0x8')](_0x148d28['mailAccounts'][_0x3e0c22['id']])){_0x148d28[_0x6f28('0x6')][_0x3e0c22['id']]=new MailAccount(_0x3e0c22);}else{_[_0x6f28('0x9')](_0x148d28[_0x6f28('0x6')][_0x3e0c22['id']],_0x3e0c22);}}}return _0x148d28[_0x6f28('0x6')];};};module[_0x6f28('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index fb2959c..999bc8a 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 _0xfd16=['data5','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type'];(function(_0x394c5b,_0x3176fa){var _0x11569f=function(_0x2ab877){while(--_0x2ab877){_0x394c5b['push'](_0x394c5b['shift']());}};_0x11569f(++_0x3176fa);}(_0xfd16,0x113));var _0x6fd1=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xfd16[_0x45783c];return _0x1161da;};'use strict';var client=require(_0x6fd1('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x6fd1('0x1'),_0x6fd1('0x2'),_0x6fd1('0x3'),_0x6fd1('0x4'),_0x6fd1('0x5'),_0x6fd1('0x6'),_0x6fd1('0x7'),_0x6fd1('0x8')],'raw':![],'include':[{'model':_0x6fd1('0x9'),'as':_0x6fd1('0xa'),'include':[{'model':_0x6fd1('0xb'),'attributes':['id',_0x6fd1('0x1'),_0x6fd1('0x3'),_0x6fd1('0xc'),_0x6fd1('0xd')],'as':_0x6fd1('0xb')}]},{'model':_0x6fd1('0xe'),'as':_0x6fd1('0xf'),'include':[{'model':_0x6fd1('0xb'),'attributes':['id',_0x6fd1('0x1'),_0x6fd1('0x3'),_0x6fd1('0xc'),_0x6fd1('0xd')],'as':_0x6fd1('0xb')}]}]},'log':_0x6fd1('0x10')});};};exports['notify']=function(_0x533f46,_0x183558){return client['Request'](_0x6fd1('0x11'),{'account':{'id':_0x533f46},'body':_0x183558,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x7031=['Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service','email','key','ListId','MailServerIn','CloudProvider','data5','MailServerOut','type','getMailAccount','notify'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0x7031,0x19a));var _0x1703=function(_0x49f6ae,_0x2f75b6){_0x49f6ae=_0x49f6ae-0x0;var _0x3e4d37=_0x7031[_0x49f6ae];return _0x3e4d37;};'use strict';var client=require(_0x1703('0x0'));exports[_0x1703('0x1')]=function(){return function(){return client['Request'](_0x1703('0x2'),{'options':{'attributes':['id',_0x1703('0x3'),'provider',_0x1703('0x4'),_0x1703('0x5'),'active',_0x1703('0x6'),_0x1703('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x1703('0x8'),'as':'Imap','include':[{'model':_0x1703('0x9'),'attributes':['id',_0x1703('0x3'),_0x1703('0x4'),'type',_0x1703('0xa')],'as':_0x1703('0x9')}]},{'model':_0x1703('0xb'),'as':'Smtp','include':[{'model':_0x1703('0x9'),'attributes':['id',_0x1703('0x3'),_0x1703('0x4'),_0x1703('0xc'),_0x1703('0xa')],'as':_0x1703('0x9')}]}]},'log':_0x1703('0xd')});};};exports[_0x1703('0xe')]=function(_0x36d1fe,_0x2fa96c){return client[_0x1703('0xf')](_0x1703('0x10'),{'account':{'id':_0x36d1fe},'body':_0x2fa96c,'log':_0x1703('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 673c505..1ededeb 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 _0xc04b=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x329c02,_0x473691){var _0x5b94d3=function(_0x1e3db3){while(--_0x1e3db3){_0x329c02['push'](_0x329c02['shift']());}};_0x5b94d3(++_0x473691);}(_0xc04b,0xa5));var _0xbc04=function(_0x5ea09b,_0xab02a3){_0x5ea09b=_0x5ea09b-0x0;var _0x55535e=_0xc04b[_0x5ea09b];return _0x55535e;};'use strict';var client=require(_0xbc04('0x0'));exports[_0xbc04('0x1')]=function(){return client['Request'](_0xbc04('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbc04('0x3')]},'log':_0xbc04('0x4')});}; \ No newline at end of file +var _0x82e7=['loginMailFrequency','../client','getSettings','ShowSetting'];(function(_0x3fc1b0,_0x4115eb){var _0x1c72a2=function(_0x5eb6bd){while(--_0x5eb6bd){_0x3fc1b0['push'](_0x3fc1b0['shift']());}};_0x1c72a2(++_0x4115eb);}(_0x82e7,0x65));var _0x782e=function(_0x5d0b8a,_0x2c191){_0x5d0b8a=_0x5d0b8a-0x0;var _0x480785=_0x82e7[_0x5d0b8a];return _0x480785;};'use strict';var client=require(_0x782e('0x0'));exports[_0x782e('0x1')]=function(){return client['Request'](_0x782e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x782e('0x3')]},'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 56c216e..39cd279 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 8302939..05dc869 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 _0x9a7f=['http','sticky-session','ioredis','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash'];(function(_0x1080f4,_0x26877a){var _0x3eb591=function(_0x52b8dd){while(--_0x52b8dd){_0x1080f4['push'](_0x1080f4['shift']());}};_0x3eb591(++_0x26877a);}(_0x9a7f,0x7c));var _0xf9a7=function(_0x378d18,_0x17362b){_0x378d18=_0x378d18-0x0;var _0x52d233=_0x9a7f[_0x378d18];return _0x52d233;};'use strict';var _=require(_0xf9a7('0x0'));var http=require(_0xf9a7('0x1'));var express=require('express');var sticky=require(_0xf9a7('0x2'));var Redis=require(_0xf9a7('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xf9a7('0x4')](app);server[_0xf9a7('0x5')]=0xdbba0;if(sticky[_0xf9a7('0x6')](server,config[_0xf9a7('0x7')])){var socketio=require(_0xf9a7('0x8'))(server,{'transports':[_0xf9a7('0x9'),_0xf9a7('0xa')]});config[_0xf9a7('0xb')]=_[_0xf9a7('0xc')](config[_0xf9a7('0xb')],{'host':'localhost','port':0x18eb});socketio[_0xf9a7('0xd')](require(_0xf9a7('0xe'))({'pubClient':new Redis(config[_0xf9a7('0xb')]),'subClient':new Redis(config[_0xf9a7('0xb')])}));require(_0xf9a7('0xf'))[_0xf9a7('0x10')]();require(_0xf9a7('0x11'))[_0xf9a7('0x10')](socketio);require(_0xf9a7('0x12'))[_0xf9a7('0x10')](app);require(_0xf9a7('0x13'))[_0xf9a7('0x10')](app);}else{server[_0xf9a7('0x14')](_0xf9a7('0x15'),function(){console[_0xf9a7('0x16')](_0xf9a7('0x17'),config[_0xf9a7('0x7')]);});}exports=module[_0xf9a7('0x18')]=app; \ No newline at end of file +var _0x40ba=['lodash','http','express','ioredis','../../config/environment','createServer','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x3b06f1,_0x2c2f9a){var _0x1ab7fd=function(_0x3387c1){while(--_0x3387c1){_0x3b06f1['push'](_0x3b06f1['shift']());}};_0x1ab7fd(++_0x2c2f9a);}(_0x40ba,0x1c8));var _0xa40b=function(_0x39017c,_0x15f210){_0x39017c=_0x39017c-0x0;var _0x584624=_0x40ba[_0x39017c];return _0x584624;};'use strict';var _=require(_0xa40b('0x0'));var http=require(_0xa40b('0x1'));var express=require(_0xa40b('0x2'));var sticky=require('sticky-session');var Redis=require(_0xa40b('0x3'));var config=require(_0xa40b('0x4'));var app=express();var server=http[_0xa40b('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0xa40b('0x6')](server,config[_0xa40b('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0xa40b('0x8'),_0xa40b('0x9')]});config[_0xa40b('0xa')]=_[_0xa40b('0xb')](config[_0xa40b('0xa')],{'host':_0xa40b('0xc'),'port':0x18eb});socketio[_0xa40b('0xd')](require(_0xa40b('0xe'))({'pubClient':new Redis(config[_0xa40b('0xa')]),'subClient':new Redis(config[_0xa40b('0xa')])}));require(_0xa40b('0xf'))['default']();require(_0xa40b('0x10'))[_0xa40b('0x11')](socketio);require(_0xa40b('0x12'))['default'](app);require(_0xa40b('0x13'))[_0xa40b('0x11')](app);}else{server['once'](_0xa40b('0x14'),function(){console[_0xa40b('0x15')](_0xa40b('0x16'),config[_0xa40b('0x7')]);});}exports=module[_0xa40b('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d4fea04..c602391 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 _0x7cfd=['jayson/promise','../../config/logger','routing','client','http','request','debug','rpc','error','message','result'];(function(_0xe76208,_0x5d8d72){var _0x12a340=function(_0x56f983){while(--_0x56f983){_0xe76208['push'](_0xe76208['shift']());}};_0x12a340(++_0x5d8d72);}(_0x7cfd,0x176));var _0xd7cf=function(_0xde4963,_0x10bb89){_0xde4963=_0xde4963-0x0;var _0x257fda=_0x7cfd[_0xde4963];return _0x257fda;};'use strict';var jayson=require(_0xd7cf('0x0'));var BPromise=require('bluebird');var logger=require(_0xd7cf('0x1'))(_0xd7cf('0x2'));var client=jayson[_0xd7cf('0x3')][_0xd7cf('0x4')]({'port':0x2329});client['Request']=function(_0x206770,_0x4f68c4){return new BPromise(function(_0x537219,_0x54310d){return client[_0xd7cf('0x5')](_0x206770,_0x4f68c4)['then'](function(_0x58883d){logger[_0xd7cf('0x6')](_0xd7cf('0x7'),_0xd7cf('0x2'),_0x206770,_0x4f68c4,_0x58883d);if(_0x58883d[_0xd7cf('0x8')]){logger[_0xd7cf('0x8')](_0xd7cf('0x7'),'routing',_0x206770,_0x58883d[_0xd7cf('0x8')][_0xd7cf('0x9')],_0x4f68c4);return _0x54310d(_0x58883d[_0xd7cf('0x8')]['message']);}else{return _0x537219(_0x58883d[_0xd7cf('0xa')]);}})['catch'](function(_0x4d6a68){logger[_0xd7cf('0x8')](_0xd7cf('0x7'),_0xd7cf('0x2'),_0x206770,_0x4d6a68,_0x4f68c4);return _0x54310d(_0x4d6a68);});});};module['exports']=client; \ No newline at end of file +var _0x11f5=['http','then','debug','error','rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x11f5,0x18e));var _0x511f=function(_0x4b0b18,_0x2fb7e1){_0x4b0b18=_0x4b0b18-0x0;var _0x15aeca=_0x11f5[_0x4b0b18];return _0x15aeca;};'use strict';var jayson=require(_0x511f('0x0'));var BPromise=require(_0x511f('0x1'));var logger=require(_0x511f('0x2'))(_0x511f('0x3'));var client=jayson[_0x511f('0x4')][_0x511f('0x5')]({'port':0x2329});client['Request']=function(_0x460148,_0x5c217f){return new BPromise(function(_0x2a24b7,_0x1812ee){return client['request'](_0x460148,_0x5c217f)[_0x511f('0x6')](function(_0x47d36b){logger[_0x511f('0x7')]('rpc','routing',_0x460148,_0x5c217f,_0x47d36b);if(_0x47d36b[_0x511f('0x8')]){logger[_0x511f('0x8')](_0x511f('0x9'),_0x511f('0x3'),_0x460148,_0x47d36b[_0x511f('0x8')][_0x511f('0xa')],_0x5c217f);return _0x1812ee(_0x47d36b[_0x511f('0x8')][_0x511f('0xa')]);}else{return _0x2a24b7(_0x47d36b['result']);}})[_0x511f('0xb')](function(_0x1c3864){logger[_0x511f('0x8')](_0x511f('0x9'),_0x511f('0x3'),_0x460148,_0x1c3864,_0x5c217f);return _0x1812ee(_0x1c3864);});});};module[_0x511f('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 40ee4be..fc7787a 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 _0xd44c=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','log','bluebird','./server','./realtime'];(function(_0x343041,_0x174069){var _0x2f7e85=function(_0x5874bb){while(--_0x5874bb){_0x343041['push'](_0x343041['shift']());}};_0x2f7e85(++_0x174069);}(_0xd44c,0x84));var _0xcd44=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0xd44c[_0x5f0501];return _0x3c2c45;};'use strict';var BPromise=require(_0xcd44('0x0'));var server=require(_0xcd44('0x1'));var Realtime=require(_0xcd44('0x2'));var user=require(_0xcd44('0x3'));var interval=require(_0xcd44('0x4'));var openchannelQueue=require(_0xcd44('0x5'));var chatQueue=require(_0xcd44('0x6'));var smsQueue=require(_0xcd44('0x7'));var mailQueue=require(_0xcd44('0x8'));var faxQueue=require(_0xcd44('0x9'));var whatsappQueue=require(_0xcd44('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xcd44('0xb')]()['then'](user[_0xcd44('0xc')]())[_0xcd44('0xd')](realtime[_0xcd44('0xe')]())[_0xcd44('0xd')](interval[_0xcd44('0xf')]())['then'](realtime[_0xcd44('0x10')]())[_0xcd44('0xd')](openchannelQueue[_0xcd44('0x11')]())[_0xcd44('0xd')](realtime[_0xcd44('0x12')]())[_0xcd44('0xd')](chatQueue[_0xcd44('0x13')]())['then'](realtime[_0xcd44('0x14')]())['then'](smsQueue[_0xcd44('0x15')]())['then'](realtime['initSmsQueues']())[_0xcd44('0xd')](mailQueue[_0xcd44('0x16')]())[_0xcd44('0xd')](realtime[_0xcd44('0x17')]())[_0xcd44('0xd')](faxQueue['getFaxQueues']())[_0xcd44('0xd')](realtime[_0xcd44('0x18')]())[_0xcd44('0xd')](whatsappQueue[_0xcd44('0x19')]())['then'](realtime['initWhatsappQueues']())[_0xcd44('0xd')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xcd44('0xd')](function(_0x5f1d6f){return initRealtime();})[_0xcd44('0xd')](function(_0x1d013b){return setInterval(initRealtime,0x1388);})['catch'](function(_0x78e4d){console[_0xcd44('0x1a')](_0x78e4d);});}main(); \ No newline at end of file +var _0xd737=['initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues'];(function(_0x31b2a5,_0x2480b4){var _0x198fa4=function(_0x1414b9){while(--_0x1414b9){_0x31b2a5['push'](_0x31b2a5['shift']());}};_0x198fa4(++_0x2480b4);}(_0xd737,0x16c));var _0x7d73=function(_0x458edc,_0x9baf98){_0x458edc=_0x458edc-0x0;var _0x44af29=_0xd737[_0x458edc];return _0x44af29;};'use strict';var BPromise=require(_0x7d73('0x0'));var server=require(_0x7d73('0x1'));var Realtime=require(_0x7d73('0x2'));var user=require('./rpc/user');var interval=require(_0x7d73('0x3'));var openchannelQueue=require(_0x7d73('0x4'));var chatQueue=require(_0x7d73('0x5'));var smsQueue=require(_0x7d73('0x6'));var mailQueue=require(_0x7d73('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x7d73('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7d73('0x9')]()[_0x7d73('0xa')](user['getAgents']())[_0x7d73('0xa')](realtime[_0x7d73('0xb')]())[_0x7d73('0xa')](interval[_0x7d73('0xc')]())[_0x7d73('0xa')](realtime['initIntervals']())['then'](openchannelQueue[_0x7d73('0xd')]())['then'](realtime['initOpenchannelQueues']())[_0x7d73('0xa')](chatQueue['getChatQueues']())[_0x7d73('0xa')](realtime[_0x7d73('0xe')]())[_0x7d73('0xa')](smsQueue[_0x7d73('0xf')]())[_0x7d73('0xa')](realtime[_0x7d73('0x10')]())[_0x7d73('0xa')](mailQueue['getMailQueues']())[_0x7d73('0xa')](realtime[_0x7d73('0x11')]())['then'](faxQueue[_0x7d73('0x12')]())['then'](realtime['initFaxQueues']())[_0x7d73('0xa')](whatsappQueue[_0x7d73('0x13')]())[_0x7d73('0xa')](realtime[_0x7d73('0x14')]())[_0x7d73('0xa')](function(){return realtime;});}function main(){return server[_0x7d73('0x15')](realtime)[_0x7d73('0xa')](function(_0x2f8c6c){return initRealtime();})['then'](function(_0x3e29c3){return setInterval(initRealtime,0x1388);})[_0x7d73('0x16')](function(_0x589802){console[_0x7d73('0x17')](_0x589802);});}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 47a0fb5..13bd16b 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x1261[_0x4d7a61];return _0x186f73;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0xdf83f8,_0x6d913f){var _0x31ac9e=function(_0x3e0f1a){while(--_0x3e0f1a){_0xdf83f8['push'](_0xdf83f8['shift']());}};_0x31ac9e(++_0x6d913f);}(_0xe14b,0x93));var _0xbe14=function(_0x50980b,_0x187017){_0x50980b=_0x50980b-0x0;var _0xc8a37c=_0xe14b[_0x50980b];return _0xc8a37c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 1e7dd3a..08f410e 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 _0x1a01=['client','http','then','error','message','result','catch','SendMail','jayson/promise'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x1a01,0x11f));var _0x11a0=function(_0x4ffdc4,_0x34a28a){_0x4ffdc4=_0x4ffdc4-0x0;var _0x3b010c=_0x1a01[_0x4ffdc4];return _0x3b010c;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x11a0('0x0'));var client=jayson[_0x11a0('0x1')][_0x11a0('0x2')]({'port':0x232b});function request(_0x34109f,_0x515fe1){return new BPromise(function(_0x11337b,_0x292263){return client['request'](_0x34109f,_0x515fe1)[_0x11a0('0x3')](function(_0x33bba7){if(_0x33bba7[_0x11a0('0x4')]){return _0x292263(_0x33bba7['error'][_0x11a0('0x5')]);}else{return _0x11337b(_0x33bba7[_0x11a0('0x6')]);}})[_0x11a0('0x7')](function(_0x5d23aa){return _0x292263(_0x5d23aa);});});}exports['sendMailMessage']=function(_0x487cee,_0x26573f){return request(_0x11a0('0x8'),{'account':_0x487cee,'message':_0x26573f});}; \ No newline at end of file +var _0x3ac0=['message','catch','bluebird','jayson/promise','client','then','error'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x3ac0,0x121));var _0x03ac=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x3ac0[_0x20c9b2];return _0x2c6030;};'use strict';var BPromise=require(_0x03ac('0x0'));var jayson=require(_0x03ac('0x1'));var client=jayson[_0x03ac('0x2')]['http']({'port':0x232b});function request(_0x131af8,_0x25a2b0){return new BPromise(function(_0xdcb347,_0x2c9778){return client['request'](_0x131af8,_0x25a2b0)[_0x03ac('0x3')](function(_0x364702){if(_0x364702[_0x03ac('0x4')]){return _0x2c9778(_0x364702[_0x03ac('0x4')][_0x03ac('0x5')]);}else{return _0xdcb347(_0x364702['result']);}})[_0x03ac('0x6')](function(_0x7aaa5){return _0x2c9778(_0x7aaa5);});});}exports['sendMailMessage']=function(_0x378071,_0x20edd7){return request('SendMail',{'account':_0x378071,'message':_0x20edd7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 6c0e913..dfdd0a6 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 _0x62e4=['faxStatus','smsStatusTime','whatsappStatusTime','openchannelStatus','busy','busyQueue','stringify','emit','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCurrentCapacity','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','chat','fax','whatsapp','length','Status','StatusTime','toNumber','name','chatStatusTime','mailStatus'];(function(_0x1d64e5,_0x3d9403){var _0x42a7e5=function(_0x1c2bf8){while(--_0x1c2bf8){_0x1d64e5['push'](_0x1d64e5['shift']());}};_0x42a7e5(++_0x3d9403);}(_0x62e4,0x12b));var _0x462e=function(_0x475b6e,_0x421469){_0x475b6e=_0x475b6e-0x0;var _0x2581a5=_0x62e4[_0x475b6e];return _0x2581a5;};'use strict';var _=require(_0x462e('0x0'));var moment=require(_0x462e('0x1'));var md5=require(_0x462e('0x2'));var Redis=require('ioredis');var config=require(_0x462e('0x3'));config[_0x462e('0x4')]=_[_0x462e('0x5')](config[_0x462e('0x4')],{'host':_0x462e('0x6'),'port':0x18eb});var io=require(_0x462e('0x7'))(new Redis(config[_0x462e('0x4')]));function Agent(_0x3d42){this['id']=_0x3d42['id']||0x0;this['name']=_0x3d42['name']||'';this[_0x462e('0x8')]=_0x3d42[_0x462e('0x8')]||!![];this[_0x462e('0x9')]=_0x3d42[_0x462e('0x9')]||![];this[_0x462e('0xa')]=_0x3d42['chatPause']||![];this[_0x462e('0xb')]=_0x3d42['mailPause']||![];this[_0x462e('0xc')]=_0x3d42[_0x462e('0xc')]||![];this[_0x462e('0xd')]=_0x3d42[_0x462e('0xd')]||![];this[_0x462e('0xe')]=_0x3d42[_0x462e('0xe')]||![];this[_0x462e('0xf')]='unknown';this['chatStatusTime']=0x0;this[_0x462e('0x10')]=_0x3d42[_0x462e('0x10')]||0x0;this[_0x462e('0x11')]=0x0;this['mailStatus']='unknown';this[_0x462e('0x12')]=0x0;this['mailCapacity']=_0x3d42['mailCapacity']||0x0;this[_0x462e('0x13')]=0x0;this['faxStatus']=_0x462e('0x14');this[_0x462e('0x15')]=0x0;this[_0x462e('0x16')]=_0x3d42[_0x462e('0x16')]||0x0;this[_0x462e('0x17')]=0x0;this[_0x462e('0x18')]='unknown';this['smsStatusTime']=0x0;this[_0x462e('0x19')]=_0x3d42[_0x462e('0x19')]||0x0;this[_0x462e('0x1a')]=0x0;this[_0x462e('0x1b')]=_0x462e('0x14');this['whatsappStatusTime']=0x0;this[_0x462e('0x1c')]=_0x3d42[_0x462e('0x1c')]||0x0;this[_0x462e('0x1d')]=0x0;this['openchannelStatus']=_0x462e('0x14');this[_0x462e('0x1e')]=0x0;this['openchannelCapacity']=_0x3d42[_0x462e('0x1f')]||0x0;this[_0x462e('0x20')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x462e('0x2')]='';this[_0x462e('0x21')]();}Agent[_0x462e('0x22')]['getChannelStatus']=function(_0x57c3e0){if(this[_0x57c3e0+_0x462e('0x23')]>0x0){if(this[_0x57c3e0+_0x462e('0x24')]>0x0&&this[_0x57c3e0+_0x462e('0x23')]>=this[_0x57c3e0+'Capacity']){return'maxcapacity';}else{return _0x462e('0x25');}}else{return _0x462e('0x26');}};Agent[_0x462e('0x22')][_0x462e('0x21')]=function(){var _0x3214e6=['mail',_0x462e('0x27'),'openchannel',_0x462e('0x28'),'sms',_0x462e('0x29')];for(var _0x5499e4=0x0;_0x5499e4<_0x3214e6[_0x462e('0x2a')];_0x5499e4+=0x1){var _0x3d5cdf=this['getChannelStatus'](_0x3214e6[_0x5499e4]);if(this[_0x3214e6[_0x5499e4]+_0x462e('0x2b')]!==_0x3d5cdf){this[_0x3214e6[_0x5499e4]+_0x462e('0x2c')]=_[_0x462e('0x2d')](moment()['format']('x'));}this[_0x3214e6[_0x5499e4]+_0x462e('0x2b')]=_0x3d5cdf;}var _0x28d4e6={'id':this['id'],'name':this[_0x462e('0x2e')],'online':this[_0x462e('0x8')],'voicePause':this[_0x462e('0x9')],'chatPause':this[_0x462e('0xa')],'mailPause':this[_0x462e('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x462e('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x462e('0xf')],'chatStatusTime':this[_0x462e('0x2f')],'chatCapacity':this[_0x462e('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x462e('0x30')],'mailStatusTime':this[_0x462e('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x462e('0x13')],'faxStatus':this[_0x462e('0x31')],'faxStatusTime':this[_0x462e('0x15')],'faxCapacity':this[_0x462e('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x462e('0x18')],'smsStatusTime':this[_0x462e('0x32')],'smsCapacity':this[_0x462e('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x462e('0x33')],'whatsappCapacity':this[_0x462e('0x1c')],'whatsappCurrentCapacity':this[_0x462e('0x1d')],'openchannelStatus':this[_0x462e('0x34')],'openchannelStatusTime':this[_0x462e('0x1e')],'openchannelCapacity':this[_0x462e('0x1f')],'openchannelCurrentCapacity':this[_0x462e('0x20')],'busy':this[_0x462e('0x35')],'busyQueue':this[_0x462e('0x36')]};var _0x21cb7a=md5(JSON[_0x462e('0x37')](_0x28d4e6));if(this[_0x462e('0x2')]!==_0x21cb7a){this[_0x462e('0x2')]=_0x21cb7a;io[_0x462e('0x38')]('user:save',_0x28d4e6);}};module[_0x462e('0x39')]=Agent; \ No newline at end of file +var _0x2f68=['openchannel','sms','length','Status','StatusTime','format','name','openchannelPause','mailStatusTime','whatsappStatusTime','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','prototype','getChannelStatus','Capacity','working','idle','updateRealtime','chat'];(function(_0x266449,_0x3407b8){var _0x326011=function(_0x47cca3){while(--_0x47cca3){_0x266449['push'](_0x266449['shift']());}};_0x326011(++_0x3407b8);}(_0x2f68,0x12b));var _0x82f6=function(_0x42822f,_0x13965e){_0x42822f=_0x42822f-0x0;var _0x26b06e=_0x2f68[_0x42822f];return _0x26b06e;};'use strict';var _=require('lodash');var moment=require(_0x82f6('0x0'));var md5=require(_0x82f6('0x1'));var Redis=require(_0x82f6('0x2'));var config=require(_0x82f6('0x3'));config[_0x82f6('0x4')]=_['defaults'](config[_0x82f6('0x4')],{'host':_0x82f6('0x5'),'port':0x18eb});var io=require(_0x82f6('0x6'))(new Redis(config[_0x82f6('0x4')]));function Agent(_0x13996e){this['id']=_0x13996e['id']||0x0;this['name']=_0x13996e['name']||'';this[_0x82f6('0x7')]=_0x13996e['online']||!![];this[_0x82f6('0x8')]=_0x13996e[_0x82f6('0x8')]||![];this[_0x82f6('0x9')]=_0x13996e['chatPause']||![];this[_0x82f6('0xa')]=_0x13996e[_0x82f6('0xa')]||![];this[_0x82f6('0xb')]=_0x13996e[_0x82f6('0xb')]||![];this['smsPause']=_0x13996e[_0x82f6('0xc')]||![];this['openchannelPause']=_0x13996e['openchannelPause']||![];this[_0x82f6('0xd')]='unknown';this[_0x82f6('0xe')]=0x0;this[_0x82f6('0xf')]=_0x13996e['chatCapacity']||0x0;this[_0x82f6('0x10')]=0x0;this['mailStatus']=_0x82f6('0x11');this['mailStatusTime']=0x0;this['mailCapacity']=_0x13996e[_0x82f6('0x12')]||0x0;this[_0x82f6('0x13')]=0x0;this[_0x82f6('0x14')]=_0x82f6('0x11');this[_0x82f6('0x15')]=0x0;this[_0x82f6('0x16')]=_0x13996e[_0x82f6('0x16')]||0x0;this[_0x82f6('0x17')]=0x0;this[_0x82f6('0x18')]=_0x82f6('0x11');this[_0x82f6('0x19')]=0x0;this[_0x82f6('0x1a')]=_0x13996e[_0x82f6('0x1a')]||0x0;this[_0x82f6('0x1b')]=0x0;this[_0x82f6('0x1c')]=_0x82f6('0x11');this['whatsappStatusTime']=0x0;this[_0x82f6('0x1d')]=_0x13996e[_0x82f6('0x1d')]||0x0;this[_0x82f6('0x1e')]=0x0;this[_0x82f6('0x1f')]='unknown';this[_0x82f6('0x20')]=0x0;this[_0x82f6('0x21')]=_0x13996e[_0x82f6('0x21')]||0x0;this[_0x82f6('0x22')]=0x0;this['busy']=![];this[_0x82f6('0x23')]=undefined;this[_0x82f6('0x1')]='';this['updateRealtime']();}Agent[_0x82f6('0x24')][_0x82f6('0x25')]=function(_0x38e9e1){if(this[_0x38e9e1+'CurrentCapacity']>0x0){if(this[_0x38e9e1+_0x82f6('0x26')]>0x0&&this[_0x38e9e1+'CurrentCapacity']>=this[_0x38e9e1+_0x82f6('0x26')]){return'maxcapacity';}else{return _0x82f6('0x27');}}else{return _0x82f6('0x28');}};Agent[_0x82f6('0x24')][_0x82f6('0x29')]=function(){var _0x390681=['mail',_0x82f6('0x2a'),_0x82f6('0x2b'),'fax',_0x82f6('0x2c'),'whatsapp'];for(var _0x248c3b=0x0;_0x248c3b<_0x390681[_0x82f6('0x2d')];_0x248c3b+=0x1){var _0x15069b=this['getChannelStatus'](_0x390681[_0x248c3b]);if(this[_0x390681[_0x248c3b]+_0x82f6('0x2e')]!==_0x15069b){this[_0x390681[_0x248c3b]+_0x82f6('0x2f')]=_['toNumber'](moment()[_0x82f6('0x30')]('x'));}this[_0x390681[_0x248c3b]+_0x82f6('0x2e')]=_0x15069b;}var _0xa6977d={'id':this['id'],'name':this[_0x82f6('0x31')],'online':this[_0x82f6('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x82f6('0x9')],'mailPause':this[_0x82f6('0xa')],'smsPause':this[_0x82f6('0xc')],'faxPause':this[_0x82f6('0xb')],'openchannelPause':this[_0x82f6('0x32')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x82f6('0xe')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x82f6('0x10')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x82f6('0x33')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x82f6('0x13')],'faxStatus':this[_0x82f6('0x14')],'faxStatusTime':this[_0x82f6('0x15')],'faxCapacity':this[_0x82f6('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x82f6('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x82f6('0x1a')],'smsCurrentCapacity':this[_0x82f6('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x82f6('0x34')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x82f6('0x1e')],'openchannelStatus':this[_0x82f6('0x1f')],'openchannelStatusTime':this[_0x82f6('0x20')],'openchannelCapacity':this[_0x82f6('0x21')],'openchannelCurrentCapacity':this[_0x82f6('0x22')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x19e40e=md5(JSON[_0x82f6('0x35')](_0xa6977d));if(this[_0x82f6('0x1')]!==_0x19e40e){this[_0x82f6('0x1')]=_0x19e40e;io[_0x82f6('0x36')](_0x82f6('0x37'),_0xa6977d);}};module[_0x82f6('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0018379..839674b 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 _0x4244=['lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','chatPause','available','waiting','stringify','chat:queue:%s','emit','chat_queue:save','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4244,0xbd));var _0x4424=function(_0x9d1460,_0x100499){_0x9d1460=_0x9d1460-0x0;var _0x2130c1=_0x4244[_0x9d1460];return _0x2130c1;};'use strict';var _=require(_0x4424('0x0'));var md5=require(_0x4424('0x1'));var util=require('util');var Redis=require(_0x4424('0x2'));var config=require('../../../config/environment');config[_0x4424('0x3')]=_[_0x4424('0x4')](config[_0x4424('0x3')],{'host':_0x4424('0x5'),'port':0x18eb});var io=require(_0x4424('0x6'))(new Redis(config[_0x4424('0x3')]));function ChatQueue(_0x292a2d){this['id']=_0x292a2d['id']||0x0;this[_0x4424('0x7')]=_0x292a2d[_0x4424('0x7')]||'';this['timeout']=_0x292a2d['timeout']||0xa;this['strategy']=_0x292a2d[_0x4424('0x8')]||'beepall';this[_0x4424('0x9')]=_0x292a2d[_0x4424('0x9')];this[_0x4424('0xa')]={};this['waiting']=0x0;this[_0x4424('0x1')]='';this[_0x4424('0xb')]();this[_0x4424('0xc')]();}ChatQueue[_0x4424('0xd')][_0x4424('0xb')]=function(){var _0x327306=this[_0x4424('0xa')][_0x4424('0xe')];this[_0x4424('0xa')]=_[_0x4424('0xf')](this[_0x4424('0x9')],'id');this[_0x4424('0xa')][_0x4424('0xe')]=_0x327306;};ChatQueue[_0x4424('0xd')][_0x4424('0xc')]=function(){this[_0x4424('0x10')]=0x0;this[_0x4424('0x11')]=0x0;for(var _0x42cfb2=0x0;_0x42cfb2=0x0?this[_0x4424('0x14')]:0x0;var _0x2e586a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4424('0x10')],'name':this[_0x4424('0x7')],'paused':this[_0x4424('0x11')],'waiting':this[_0x4424('0x15')]};var _0x4b64e3=md5(JSON[_0x4424('0x16')](_0x2e586a));if(this[_0x4424('0x1')]!==_0x4b64e3){this[_0x4424('0x1')]=_0x4b64e3;io['to'](util['format'](_0x4424('0x17'),_0x2e586a[_0x4424('0x7')]))[_0x4424('0x18')](_0x4424('0x19'),_0x2e586a);}};module[_0x4424('0x1a')]=ChatQueue; \ No newline at end of file +var _0x9db2=['lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','map','_rr','loggedIn','length','online','chatPause','paused','available','stringify','format','emit'];(function(_0x371b0f,_0x4effeb){var _0x104c22=function(_0x52285e){while(--_0x52285e){_0x371b0f['push'](_0x371b0f['shift']());}};_0x104c22(++_0x4effeb);}(_0x9db2,0x134));var _0x29db=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x9db2[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x29db('0x0'));var md5=require(_0x29db('0x1'));var util=require(_0x29db('0x2'));var Redis=require(_0x29db('0x3'));var config=require(_0x29db('0x4'));config['redis']=_[_0x29db('0x5')](config['redis'],{'host':_0x29db('0x6'),'port':0x18eb});var io=require(_0x29db('0x7'))(new Redis(config['redis']));function ChatQueue(_0x5d204a){this['id']=_0x5d204a['id']||0x0;this[_0x29db('0x8')]=_0x5d204a[_0x29db('0x8')]||'';this[_0x29db('0x9')]=_0x5d204a[_0x29db('0x9')]||0xa;this[_0x29db('0xa')]=_0x5d204a[_0x29db('0xa')]||_0x29db('0xb');this[_0x29db('0xc')]=_0x5d204a['Agents'];this[_0x29db('0xd')]={};this[_0x29db('0xe')]=0x0;this[_0x29db('0x1')]='';this['updateRouting']();this[_0x29db('0xf')]();}ChatQueue[_0x29db('0x10')]['updateRouting']=function(){var _0x592535=this[_0x29db('0xd')]['_rr'];this['mapAgentsId']=_[_0x29db('0x11')](this[_0x29db('0xc')],'id');this[_0x29db('0xd')][_0x29db('0x12')]=_0x592535;};ChatQueue[_0x29db('0x10')][_0x29db('0xf')]=function(){this[_0x29db('0x13')]=0x0;this['paused']=0x0;for(var _0x5d1626=0x0;_0x5d1626=0x0?this[_0x29db('0x18')]:0x0;var _0x11baf8={'id':this['id'],'available':this[_0x29db('0x18')],'loggedIn':this[_0x29db('0x13')],'name':this[_0x29db('0x8')],'paused':this[_0x29db('0x17')],'waiting':this[_0x29db('0xe')]};var _0x3eaacb=md5(JSON[_0x29db('0x19')](_0x11baf8));if(this[_0x29db('0x1')]!==_0x3eaacb){this[_0x29db('0x1')]=_0x3eaacb;io['to'](util[_0x29db('0x1a')]('chat:queue:%s',_0x11baf8['name']))[_0x29db('0x1b')]('chat_queue:save',_0x11baf8);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 32c6ffe..e6268cf 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 _0x765b=['online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','loggedIn','paused','length'];(function(_0x4c4af2,_0x22ed01){var _0x3f91fa=function(_0x46d69b){while(--_0x46d69b){_0x4c4af2['push'](_0x4c4af2['shift']());}};_0x3f91fa(++_0x22ed01);}(_0x765b,0x1ef));var _0xb765=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x765b[_0x52a857];return _0x4e2aae;};'use strict';var _=require('lodash');var md5=require(_0xb765('0x0'));var util=require(_0xb765('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xb765('0x2')](config[_0xb765('0x3')],{'host':_0xb765('0x4'),'port':0x18eb});var io=require(_0xb765('0x5'))(new Redis(config[_0xb765('0x3')]));function FaxQueue(_0x1386ad){this['id']=_0x1386ad['id']||0x0;this[_0xb765('0x6')]=_0x1386ad[_0xb765('0x6')]||'';this[_0xb765('0x7')]=_0x1386ad['timeout']||0xa;this[_0xb765('0x8')]=_0x1386ad[_0xb765('0x8')]||'beepall';this[_0xb765('0x9')]=_0x1386ad[_0xb765('0x9')];this[_0xb765('0xa')]={};this[_0xb765('0xb')]=0x0;this[_0xb765('0x0')]='';this[_0xb765('0xc')]();this[_0xb765('0xd')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x3c9144=this['mapAgentsId']['_rr'];this[_0xb765('0xa')]=_['map'](this[_0xb765('0x9')],'id');this[_0xb765('0xa')][_0xb765('0xe')]=_0x3c9144;};FaxQueue['prototype'][_0xb765('0xd')]=function(){this[_0xb765('0xf')]=0x0;this[_0xb765('0x10')]=0x0;for(var _0x281146=0x0;_0x281146=0x0?this[_0xb765('0x14')]:0x0;var _0x4720e1={'id':this['id'],'available':this[_0xb765('0x14')],'loggedIn':this[_0xb765('0xf')],'name':this[_0xb765('0x6')],'paused':this[_0xb765('0x10')],'waiting':this[_0xb765('0xb')]};var _0x480daf=md5(JSON[_0xb765('0x15')](_0x4720e1));if(this['md5']!==_0x480daf){this[_0xb765('0x0')]=_0x480daf;io['to'](util[_0xb765('0x16')](_0xb765('0x17'),_0x4720e1[_0xb765('0x6')]))[_0xb765('0x18')](_0xb765('0x19'),_0x4720e1);}};module[_0xb765('0x1a')]=FaxQueue; \ No newline at end of file +var _0x762f=['updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','length','online','faxPause','available','paused','stringify','md5','fax:queue:%s','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x762f,0x14f));var _0xf762=function(_0x13e01c,_0x4422c6){_0x13e01c=_0x13e01c-0x0;var _0x31c757=_0x762f[_0x13e01c];return _0x31c757;};'use strict';var _=require(_0xf762('0x0'));var md5=require('md5');var util=require(_0xf762('0x1'));var Redis=require(_0xf762('0x2'));var config=require(_0xf762('0x3'));config[_0xf762('0x4')]=_['defaults'](config[_0xf762('0x4')],{'host':_0xf762('0x5'),'port':0x18eb});var io=require(_0xf762('0x6'))(new Redis(config[_0xf762('0x4')]));function FaxQueue(_0x3da5aa){this['id']=_0x3da5aa['id']||0x0;this[_0xf762('0x7')]=_0x3da5aa['name']||'';this[_0xf762('0x8')]=_0x3da5aa[_0xf762('0x8')]||0xa;this[_0xf762('0x9')]=_0x3da5aa['strategy']||'beepall';this[_0xf762('0xa')]=_0x3da5aa[_0xf762('0xa')];this['mapAgentsId']={};this[_0xf762('0xb')]=0x0;this['md5']='';this[_0xf762('0xc')]();this[_0xf762('0xd')]();}FaxQueue['prototype'][_0xf762('0xc')]=function(){var _0x353430=this[_0xf762('0xe')][_0xf762('0xf')];this['mapAgentsId']=_[_0xf762('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xf762('0xf')]=_0x353430;};FaxQueue[_0xf762('0x11')]['updateRealtime']=function(){this[_0xf762('0x12')]=0x0;this['paused']=0x0;for(var _0x1aca21=0x0;_0x1aca21=0x0?this['available']:0x0;var _0x2484f7={'id':this['id'],'available':this[_0xf762('0x16')],'loggedIn':this[_0xf762('0x12')],'name':this[_0xf762('0x7')],'paused':this[_0xf762('0x17')],'waiting':this[_0xf762('0xb')]};var _0x17fc3b=md5(JSON[_0xf762('0x18')](_0x2484f7));if(this[_0xf762('0x19')]!==_0x17fc3b){this[_0xf762('0x19')]=_0x17fc3b;io['to'](util['format'](_0xf762('0x1a'),_0x2484f7[_0xf762('0x7')]))['emit'](_0xf762('0x1b'),_0x2484f7);}};module[_0xf762('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index acdab3b..0ff3238 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 _0x2ba2=['exports','name','Intervals'];(function(_0x5a196d,_0x574069){var _0x28ecc6=function(_0x2d183d){while(--_0x2d183d){_0x5a196d['push'](_0x5a196d['shift']());}};_0x28ecc6(++_0x574069);}(_0x2ba2,0x172));var _0x22ba=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x2ba2[_0x3718b7];return _0xf8c91e;};'use strict';function Interval(_0x7accf){this['id']=_0x7accf['id']||0x0;this[_0x22ba('0x0')]=_0x7accf[_0x22ba('0x0')]||'';this['Intervals']=_0x7accf[_0x22ba('0x1')]||{};}module[_0x22ba('0x2')]=Interval; \ No newline at end of file +var _0x3412=['Intervals','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3412,0x122));var _0x2341=function(_0x5a66b7,_0x517636){_0x5a66b7=_0x5a66b7-0x0;var _0x5f56e3=_0x3412[_0x5a66b7];return _0x5f56e3;};'use strict';function Interval(_0x21b85d){this['id']=_0x21b85d['id']||0x0;this['name']=_0x21b85d[_0x2341('0x0')]||'';this[_0x2341('0x1')]=_0x21b85d[_0x2341('0x1')]||{};}module[_0x2341('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 0a07569..53a561f 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 _0x321c=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x321c,0xc7));var _0xc321=function(_0x497cd0,_0x2be60b){_0x497cd0=_0x497cd0-0x0;var _0x45ef73=_0x321c[_0x497cd0];return _0x45ef73;};'use strict';var _=require(_0xc321('0x0'));var md5=require(_0xc321('0x1'));var util=require(_0xc321('0x2'));var Redis=require(_0xc321('0x3'));var config=require('../../../config/environment');config[_0xc321('0x4')]=_[_0xc321('0x5')](config[_0xc321('0x4')],{'host':_0xc321('0x6'),'port':0x18eb});var io=require(_0xc321('0x7'))(new Redis(config['redis']));function MailQueue(_0x47c6fe){this['id']=_0x47c6fe['id']||0x0;this[_0xc321('0x8')]=_0x47c6fe[_0xc321('0x8')]||'';this[_0xc321('0x9')]=_0x47c6fe[_0xc321('0x9')]||0xa;this['strategy']=_0x47c6fe[_0xc321('0xa')]||_0xc321('0xb');this[_0xc321('0xc')]=_0x47c6fe[_0xc321('0xc')];this[_0xc321('0xd')]={};this['waiting']=0x0;this[_0xc321('0x1')]='';this[_0xc321('0xe')]();this[_0xc321('0xf')]();}MailQueue[_0xc321('0x10')][_0xc321('0xe')]=function(){var _0x5716e5=this['mapAgentsId'][_0xc321('0x11')];this['mapAgentsId']=_[_0xc321('0x12')](this[_0xc321('0xc')],'id');this[_0xc321('0xd')][_0xc321('0x11')]=_0x5716e5;};MailQueue['prototype'][_0xc321('0xf')]=function(){this[_0xc321('0x13')]=0x0;this[_0xc321('0x14')]=0x0;for(var _0x59020f=0x0;_0x59020f=0x0?this[_0xc321('0x17')]:0x0;var _0xb1b498={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc321('0x13')],'name':this[_0xc321('0x8')],'paused':this[_0xc321('0x14')],'waiting':this[_0xc321('0x18')]};var _0x197616=md5(JSON[_0xc321('0x19')](_0xb1b498));if(this[_0xc321('0x1')]!==_0x197616){this['md5']=_0x197616;io['to'](util[_0xc321('0x1a')]('mail:queue:%s',_0xb1b498[_0xc321('0x8')]))[_0xc321('0x1b')](_0xc321('0x1c'),_0xb1b498);}};module[_0xc321('0x1d')]=MailQueue; \ No newline at end of file +var _0xca9e=['strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','available','waiting','format','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','name'];(function(_0x526fb1,_0x1d0359){var _0x33582f=function(_0x2df327){while(--_0x2df327){_0x526fb1['push'](_0x526fb1['shift']());}};_0x33582f(++_0x1d0359);}(_0xca9e,0x12e));var _0xeca9=function(_0x5c04dd,_0x2865d8){_0x5c04dd=_0x5c04dd-0x0;var _0x5f1a29=_0xca9e[_0x5c04dd];return _0x5f1a29;};'use strict';var _=require(_0xeca9('0x0'));var md5=require(_0xeca9('0x1'));var util=require('util');var Redis=require(_0xeca9('0x2'));var config=require(_0xeca9('0x3'));config[_0xeca9('0x4')]=_['defaults'](config[_0xeca9('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeca9('0x4')]));function MailQueue(_0x52b573){this['id']=_0x52b573['id']||0x0;this[_0xeca9('0x5')]=_0x52b573[_0xeca9('0x5')]||'';this['timeout']=_0x52b573['timeout']||0xa;this[_0xeca9('0x6')]=_0x52b573[_0xeca9('0x6')]||'beepall';this[_0xeca9('0x7')]=_0x52b573['Agents'];this[_0xeca9('0x8')]={};this['waiting']=0x0;this['md5']='';this[_0xeca9('0x9')]();this['updateRealtime']();}MailQueue[_0xeca9('0xa')][_0xeca9('0x9')]=function(){var _0x457634=this[_0xeca9('0x8')][_0xeca9('0xb')];this[_0xeca9('0x8')]=_[_0xeca9('0xc')](this['Agents'],'id');this['mapAgentsId'][_0xeca9('0xb')]=_0x457634;};MailQueue[_0xeca9('0xa')][_0xeca9('0xd')]=function(){this[_0xeca9('0xe')]=0x0;this[_0xeca9('0xf')]=0x0;for(var _0x30379a=0x0;_0x30379a=0x0?this['available']:0x0;var _0x2842bd={'id':this['id'],'available':this[_0xeca9('0x10')],'loggedIn':this[_0xeca9('0xe')],'name':this[_0xeca9('0x5')],'paused':this['paused'],'waiting':this[_0xeca9('0x11')]};var _0x20dc94=md5(JSON['stringify'](_0x2842bd));if(this[_0xeca9('0x1')]!==_0x20dc94){this['md5']=_0x20dc94;io['to'](util[_0xeca9('0x12')]('mail:queue:%s',_0x2842bd[_0xeca9('0x5')]))[_0xeca9('0x13')](_0xeca9('0x14'),_0x2842bd);}};module[_0xeca9('0x15')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7bb2973..8ca6a40 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x2ef3,0xba));var _0x32ef=function(_0x135b23,_0x1e644e){_0x135b23=_0x135b23-0x0;var _0x1549a4=_0x2ef3[_0x135b23];return _0x1549a4;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x1a786f,_0x56b6d8){var _0x12c96a=function(_0x1f86f0){while(--_0x1f86f0){_0x1a786f['push'](_0x1a786f['shift']());}};_0x12c96a(++_0x56b6d8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x5fc3[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index be02b41..a01ac73 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 _0xb332=['map','loggedIn','length','online','smsPause','paused','available','stringify','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x4e6262,_0x40801f){var _0x13596e=function(_0x26efa2){while(--_0x26efa2){_0x4e6262['push'](_0x4e6262['shift']());}};_0x13596e(++_0x40801f);}(_0xb332,0xd9));var _0x2b33=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0xb332[_0x1d5400];return _0x21d9fe;};'use strict';var _=require(_0x2b33('0x0'));var md5=require('md5');var util=require(_0x2b33('0x1'));var Redis=require(_0x2b33('0x2'));var config=require('../../../config/environment');config[_0x2b33('0x3')]=_['defaults'](config[_0x2b33('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x2b33('0x4'))(new Redis(config['redis']));function SmsQueue(_0xf9b9c2){this['id']=_0xf9b9c2['id']||0x0;this[_0x2b33('0x5')]=_0xf9b9c2[_0x2b33('0x5')]||'';this[_0x2b33('0x6')]=_0xf9b9c2['timeout']||0xa;this['strategy']=_0xf9b9c2[_0x2b33('0x7')]||'beepall';this[_0x2b33('0x8')]=_0xf9b9c2[_0x2b33('0x8')];this[_0x2b33('0x9')]={};this[_0x2b33('0xa')]=0x0;this['md5']='';this[_0x2b33('0xb')]();this[_0x2b33('0xc')]();}SmsQueue[_0x2b33('0xd')][_0x2b33('0xb')]=function(){var _0x1989f3=this[_0x2b33('0x9')][_0x2b33('0xe')];this[_0x2b33('0x9')]=_[_0x2b33('0xf')](this[_0x2b33('0x8')],'id');this[_0x2b33('0x9')]['_rr']=_0x1989f3;};SmsQueue[_0x2b33('0xd')][_0x2b33('0xc')]=function(){this[_0x2b33('0x10')]=0x0;this['paused']=0x0;for(var _0x173c75=0x0;_0x173c75=0x0?this['available']:0x0;var _0x4041bd={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x2b33('0x5')],'paused':this[_0x2b33('0x14')],'waiting':this[_0x2b33('0xa')]};var _0x539c5f=md5(JSON[_0x2b33('0x16')](_0x4041bd));if(this['md5']!==_0x539c5f){this[_0x2b33('0x17')]=_0x539c5f;io['to'](util[_0x2b33('0x18')](_0x2b33('0x19'),_0x4041bd[_0x2b33('0x5')]))[_0x2b33('0x1a')](_0x2b33('0x1b'),_0x4041bd);}};module[_0x2b33('0x1c')]=SmsQueue; \ No newline at end of file +var _0xbb95=['redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','online','smsPause','available','loggedIn','stringify','format','sms:queue:%s','emit','exports','lodash','md5','../../../config/environment'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0xbb95,0x7f));var _0x5bb9=function(_0x7d0f83,_0x43b7e3){_0x7d0f83=_0x7d0f83-0x0;var _0x7e1b2e=_0xbb95[_0x7d0f83];return _0x7e1b2e;};'use strict';var _=require(_0x5bb9('0x0'));var md5=require(_0x5bb9('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5bb9('0x2'));config[_0x5bb9('0x3')]=_['defaults'](config[_0x5bb9('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x346d48){this['id']=_0x346d48['id']||0x0;this[_0x5bb9('0x4')]=_0x346d48['name']||'';this[_0x5bb9('0x5')]=_0x346d48[_0x5bb9('0x5')]||0xa;this[_0x5bb9('0x6')]=_0x346d48['strategy']||_0x5bb9('0x7');this[_0x5bb9('0x8')]=_0x346d48[_0x5bb9('0x8')];this[_0x5bb9('0x9')]={};this[_0x5bb9('0xa')]=0x0;this[_0x5bb9('0x1')]='';this[_0x5bb9('0xb')]();this[_0x5bb9('0xc')]();}SmsQueue[_0x5bb9('0xd')][_0x5bb9('0xb')]=function(){var _0x5bb2b7=this['mapAgentsId'][_0x5bb9('0xe')];this[_0x5bb9('0x9')]=_[_0x5bb9('0xf')](this[_0x5bb9('0x8')],'id');this[_0x5bb9('0x9')][_0x5bb9('0xe')]=_0x5bb2b7;};SmsQueue[_0x5bb9('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x5bb9('0x10')]=0x0;for(var _0x407a7b=0x0;_0x407a7b=0x0?this[_0x5bb9('0x13')]:0x0;var _0x56c337={'id':this['id'],'available':this[_0x5bb9('0x13')],'loggedIn':this[_0x5bb9('0x14')],'name':this[_0x5bb9('0x4')],'paused':this['paused'],'waiting':this[_0x5bb9('0xa')]};var _0x1c9b29=md5(JSON[_0x5bb9('0x15')](_0x56c337));if(this[_0x5bb9('0x1')]!==_0x1c9b29){this[_0x5bb9('0x1')]=_0x1c9b29;io['to'](util[_0x5bb9('0x16')](_0x5bb9('0x17'),_0x56c337[_0x5bb9('0x4')]))[_0x5bb9('0x18')]('sms_queue:save',_0x56c337);}};module[_0x5bb9('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1873972..4ba4201 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 _0x8076=['emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','whatsappPause','loggedIn','available','stringify','format'];(function(_0x111ccc,_0x4f5094){var _0x5bd2a5=function(_0x3a31dd){while(--_0x3a31dd){_0x111ccc['push'](_0x111ccc['shift']());}};_0x5bd2a5(++_0x4f5094);}(_0x8076,0x199));var _0x6807=function(_0x8a573c,_0x467f85){_0x8a573c=_0x8a573c-0x0;var _0x28672b=_0x8076[_0x8a573c];return _0x28672b;};'use strict';var _=require('lodash');var md5=require(_0x6807('0x0'));var util=require(_0x6807('0x1'));var Redis=require('ioredis');var config=require(_0x6807('0x2'));config[_0x6807('0x3')]=_[_0x6807('0x4')](config[_0x6807('0x3')],{'host':_0x6807('0x5'),'port':0x18eb});var io=require(_0x6807('0x6'))(new Redis(config[_0x6807('0x3')]));function WhatsappQueue(_0x2072b3){this['id']=_0x2072b3['id']||0x0;this[_0x6807('0x7')]=_0x2072b3['name']||'';this['timeout']=_0x2072b3[_0x6807('0x8')]||0xa;this['strategy']=_0x2072b3[_0x6807('0x9')]||_0x6807('0xa');this[_0x6807('0xb')]=_0x2072b3[_0x6807('0xb')];this[_0x6807('0xc')]={};this[_0x6807('0xd')]=0x0;this[_0x6807('0x0')]='';this[_0x6807('0xe')]();this[_0x6807('0xf')]();}WhatsappQueue[_0x6807('0x10')][_0x6807('0xe')]=function(){var _0x34cff7=this[_0x6807('0xc')][_0x6807('0x11')];this[_0x6807('0xc')]=_['map'](this[_0x6807('0xb')],'id');this[_0x6807('0xc')][_0x6807('0x11')]=_0x34cff7;};WhatsappQueue[_0x6807('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x6807('0x12')]=0x0;for(var _0x26f003=0x0;_0x26f003=0x0?this[_0x6807('0x17')]:0x0;var _0x160011={'id':this['id'],'available':this[_0x6807('0x17')],'loggedIn':this[_0x6807('0x16')],'name':this[_0x6807('0x7')],'paused':this[_0x6807('0x12')],'waiting':this[_0x6807('0xd')]};var _0xd8e157=md5(JSON[_0x6807('0x18')](_0x160011));if(this['md5']!==_0xd8e157){this[_0x6807('0x0')]=_0xd8e157;io['to'](util[_0x6807('0x19')]('whatsapp:queue:%s',_0x160011[_0x6807('0x7')]))[_0x6807('0x1a')](_0x6807('0x1b'),_0x160011);}};module[_0x6807('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xfbf4=['loggedIn','length','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x2c85a1,_0x56b3a2){var _0x3c6881=function(_0x1c145e){while(--_0x1c145e){_0x2c85a1['push'](_0x2c85a1['shift']());}};_0x3c6881(++_0x56b3a2);}(_0xfbf4,0x15a));var _0x4fbf=function(_0x3ba5b6,_0x148286){_0x3ba5b6=_0x3ba5b6-0x0;var _0x4d27a1=_0xfbf4[_0x3ba5b6];return _0x4d27a1;};'use strict';var _=require(_0x4fbf('0x0'));var md5=require(_0x4fbf('0x1'));var util=require(_0x4fbf('0x2'));var Redis=require(_0x4fbf('0x3'));var config=require('../../../config/environment');config[_0x4fbf('0x4')]=_[_0x4fbf('0x5')](config[_0x4fbf('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4fbf('0x6'))(new Redis(config[_0x4fbf('0x4')]));function WhatsappQueue(_0x260f18){this['id']=_0x260f18['id']||0x0;this[_0x4fbf('0x7')]=_0x260f18[_0x4fbf('0x7')]||'';this[_0x4fbf('0x8')]=_0x260f18['timeout']||0xa;this[_0x4fbf('0x9')]=_0x260f18[_0x4fbf('0x9')]||'beepall';this[_0x4fbf('0xa')]=_0x260f18[_0x4fbf('0xa')];this[_0x4fbf('0xb')]={};this[_0x4fbf('0xc')]=0x0;this['md5']='';this[_0x4fbf('0xd')]();this[_0x4fbf('0xe')]();}WhatsappQueue[_0x4fbf('0xf')][_0x4fbf('0xd')]=function(){var _0x3ef435=this[_0x4fbf('0xb')][_0x4fbf('0x10')];this[_0x4fbf('0xb')]=_[_0x4fbf('0x11')](this[_0x4fbf('0xa')],'id');this[_0x4fbf('0xb')]['_rr']=_0x3ef435;};WhatsappQueue[_0x4fbf('0xf')][_0x4fbf('0xe')]=function(){this[_0x4fbf('0x12')]=0x0;this['paused']=0x0;for(var _0x2c6841=0x0;_0x2c6841=0x0?this['available']:0x0;var _0x30cc76={'id':this['id'],'available':this[_0x4fbf('0x16')],'loggedIn':this[_0x4fbf('0x12')],'name':this[_0x4fbf('0x7')],'paused':this[_0x4fbf('0x15')],'waiting':this['waiting']};var _0x2d1a03=md5(JSON[_0x4fbf('0x17')](_0x30cc76));if(this['md5']!==_0x2d1a03){this[_0x4fbf('0x1')]=_0x2d1a03;io['to'](util[_0x4fbf('0x18')](_0x4fbf('0x19'),_0x30cc76[_0x4fbf('0x7')]))['emit']('whatsapp_queue:save',_0x30cc76);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c5ff793..eb77513 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x4856a2,_0x518cc3){var _0x3bb6a2=function(_0x32bdd9){while(--_0x32bdd9){_0x4856a2['push'](_0x4856a2['shift']());}};_0x3bb6a2(++_0x518cc3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f57e7,_0x31455f){_0x1f57e7=_0x1f57e7-0x0;var _0xc38613=_0xb10b[_0x1f57e7];return _0xc38613;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 c86f72e..dfbc1f4 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 _0x4503=['Request','updateChatInteraction','addTagsToChatInteraction','update'];(function(_0x53f122,_0x2cdeca){var _0x59a134=function(_0x41468d){while(--_0x41468d){_0x53f122['push'](_0x53f122['shift']());}};_0x59a134(++_0x2cdeca);}(_0x4503,0x9b));var _0x3450=function(_0x15ce62,_0x2e57b3){_0x15ce62=_0x15ce62-0x0;var _0x2714d5=_0x4503[_0x15ce62];return _0x2714d5;};'use strict';var client=require('../client');exports[_0x3450('0x0')]=function(_0x14d772,_0x4172c1){return client[_0x3450('0x1')]('UpdateChatInteraction',{'body':_0x4172c1,'options':{'where':{'id':_0x14d772}},'log':_0x3450('0x2')});};exports['addTags']=function(_0xd6a7e,_0x372810){return client[_0x3450('0x1')]('AddTagsToChatInteraction',{'body':_0x372810,'options':{'where':{'id':_0xd6a7e}},'log':_0x3450('0x3')});}; \ No newline at end of file +var _0x766e=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x766e,0x6f));var _0xe766=function(_0x50a9af,_0x24df09){_0x50a9af=_0x50a9af-0x0;var _0x3478f9=_0x766e[_0x50a9af];return _0x3478f9;};'use strict';var client=require(_0xe766('0x0'));exports[_0xe766('0x1')]=function(_0x34bb1a,_0x1c8640){return client[_0xe766('0x2')](_0xe766('0x3'),{'body':_0x1c8640,'options':{'where':{'id':_0x34bb1a}},'log':_0xe766('0x4')});};exports[_0xe766('0x5')]=function(_0x4cf56c,_0x4b86a0){return client[_0xe766('0x2')](_0xe766('0x6'),{'body':_0x4b86a0,'options':{'where':{'id':_0x4cf56c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index ac8be8d..926aeba 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 _0x7742=['Request','createChatMessage','../client','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7742,0x126));var _0x2774=function(_0x5f35ad,_0xce49c0){_0x5f35ad=_0x5f35ad-0x0;var _0x641ee0=_0x7742[_0x5f35ad];return _0x641ee0;};'use strict';var client=require(_0x2774('0x0'));exports[_0x2774('0x1')]=function(_0x34b386){return client[_0x2774('0x2')]('CreateChatMessage',{'body':_0x34b386,'log':_0x2774('0x3')});}; \ No newline at end of file +var _0xbd25=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xbd25,0x1d4));var _0x5bd2=function(_0x5aba07,_0x228253){_0x5aba07=_0x5aba07-0x0;var _0x315e20=_0xbd25[_0x5aba07];return _0x315e20;};'use strict';var client=require(_0x5bd2('0x0'));exports[_0x5bd2('0x1')]=function(_0x3c6552){return client[_0x5bd2('0x2')](_0x5bd2('0x3'),{'body':_0x3c6552,'log':_0x5bd2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 738d719..ff36fee 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 _0x029b=['GetChatQueue','name','strategy','User','online','chatPause','../client','getChatQueues'];(function(_0xdc882,_0x2858b9){var _0x1d8778=function(_0xd651f4){while(--_0xd651f4){_0xdc882['push'](_0xdc882['shift']());}};_0x1d8778(++_0x2858b9);}(_0x029b,0x66));var _0xb029=function(_0xac28a5,_0x5df4bc){_0xac28a5=_0xac28a5-0x0;var _0x5a56bb=_0x029b[_0xac28a5];return _0x5a56bb;};'use strict';var client=require(_0xb029('0x0'));exports[_0xb029('0x1')]=function(){return function(){return client['Request'](_0xb029('0x2'),{'options':{'raw':![],'attributes':['id',_0xb029('0x3'),'timeout',_0xb029('0x4')],'include':[{'model':_0xb029('0x5'),'as':'Agents','attributes':['id','name',_0xb029('0x6'),_0xb029('0x7')]}]},'log':_0xb029('0x1')});};}; \ No newline at end of file +var _0xe06f=['name','online','../client','getChatQueues','GetChatQueue','timeout','strategy','User','Agents'];(function(_0x5d92d3,_0x1f7f56){var _0x131e51=function(_0x1c374b){while(--_0x1c374b){_0x5d92d3['push'](_0x5d92d3['shift']());}};_0x131e51(++_0x1f7f56);}(_0xe06f,0x65));var _0xfe06=function(_0xfbbecb,_0x2a8ace){_0xfbbecb=_0xfbbecb-0x0;var _0x4304ee=_0xe06f[_0xfbbecb];return _0x4304ee;};'use strict';var client=require(_0xfe06('0x0'));exports[_0xfe06('0x1')]=function(){return function(){return client['Request'](_0xfe06('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xfe06('0x3'),_0xfe06('0x4')],'include':[{'model':_0xfe06('0x5'),'as':_0xfe06('0x6'),'attributes':['id',_0xfe06('0x7'),_0xfe06('0x8'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index cbc38bc..db84ea4 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 _0x6873=['UpdateChatQueueReport','DESC','Request','CreateChatQueueReport','update'];(function(_0x576465,_0x13ecd1){var _0x29ba21=function(_0x2aa1d4){while(--_0x2aa1d4){_0x576465['push'](_0x576465['shift']());}};_0x29ba21(++_0x13ecd1);}(_0x6873,0xac));var _0x3687=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x6873[_0x4f35f4];return _0x2e9a70;};'use strict';var client=require('../client');exports['create']=function(_0x319674){return client[_0x3687('0x0')](_0x3687('0x1'),{'body':_0x319674,'log':_0x3687('0x1')});};exports[_0x3687('0x2')]=function(_0x4bbecf,_0x247d96){return client['Request'](_0x3687('0x3'),{'body':_0x247d96,'options':{'where':{'uniqueid':_0x4bbecf},'order':[['id',_0x3687('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x2bd6=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x21ceaf,_0x35fd2c){var _0x50bb12=function(_0x3f4102){while(--_0x3f4102){_0x21ceaf['push'](_0x21ceaf['shift']());}};_0x50bb12(++_0x35fd2c);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x2bd6[_0x236d24];return _0x1574cf;};'use strict';var client=require(_0x62bd('0x0'));exports[_0x62bd('0x1')]=function(_0x469dda){return client[_0x62bd('0x2')](_0x62bd('0x3'),{'body':_0x469dda,'log':'CreateChatQueueReport'});};exports[_0x62bd('0x4')]=function(_0x1a8ed2,_0x23ba52){return client['Request'](_0x62bd('0x5'),{'body':_0x23ba52,'options':{'where':{'uniqueid':_0x1a8ed2},'order':[['id','DESC']],'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 c495b16..e166405 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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x7a54,0x106));var _0x47a5=function(_0x1b9e92,_0x1af120){_0x1b9e92=_0x1b9e92-0x0;var _0x41e428=_0x7a54[_0x1b9e92];return _0x41e428;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x3fb747,_0x7cfd3f){var _0x186807=function(_0x540c69){while(--_0x540c69){_0x3fb747['push'](_0x3fb747['shift']());}};_0x186807(++_0x7cfd3f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 4a2df0e..23c7aba 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 _0x2e05=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x31e695,_0x21704a){var _0x2b2d82=function(_0x3fba82){while(--_0x3fba82){_0x31e695['push'](_0x31e695['shift']());}};_0x2b2d82(++_0x21704a);}(_0x2e05,0x11b));var _0x52e0=function(_0x23e4cd,_0xf0e8f9){_0x23e4cd=_0x23e4cd-0x0;var _0x1d3581=_0x2e05[_0x23e4cd];return _0x1d3581;};'use strict';var client=require(_0x52e0('0x0'));exports[_0x52e0('0x1')]=function(_0x391605){return client[_0x52e0('0x2')](_0x52e0('0x3'),{'body':_0x391605,'log':_0x52e0('0x4')});}; \ No newline at end of file +var _0xf722=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x2483f6,_0x70bc75){var _0x44f7b9=function(_0x42aa04){while(--_0x42aa04){_0x2483f6['push'](_0x2483f6['shift']());}};_0x44f7b9(++_0x70bc75);}(_0xf722,0x176));var _0x2f72=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf722[_0x501510];return _0x1e6ee5;};'use strict';var client=require('../client');exports[_0x2f72('0x0')]=function(_0xe3465f){return client[_0x2f72('0x1')](_0x2f72('0x2'),{'body':_0xe3465f,'log':_0x2f72('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 34625e2..e4fa69c 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 _0x2025=['timeout','User','online','faxPause','../client','getFaxQueues','GetFaxQueue','name'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0x2025,0x1cc));var _0x5202=function(_0x31d5ff,_0x300f55){_0x31d5ff=_0x31d5ff-0x0;var _0x46d7b7=_0x2025[_0x31d5ff];return _0x46d7b7;};'use strict';var client=require(_0x5202('0x0'));exports[_0x5202('0x1')]=function(){return function(){return client['Request'](_0x5202('0x2'),{'options':{'raw':![],'attributes':['id',_0x5202('0x3'),_0x5202('0x4'),'strategy'],'include':[{'model':_0x5202('0x5'),'as':'Agents','attributes':['id',_0x5202('0x3'),_0x5202('0x6'),_0x5202('0x7')]}]},'log':_0x5202('0x1')});};}; \ No newline at end of file +var _0xce53=['faxPause','../client','getFaxQueues','Request','timeout','strategy','User','Agents','online'];(function(_0x14bdfd,_0x5becd2){var _0x1efdcd=function(_0x2857da){while(--_0x2857da){_0x14bdfd['push'](_0x14bdfd['shift']());}};_0x1efdcd(++_0x5becd2);}(_0xce53,0x17b));var _0x3ce5=function(_0x35a7d5,_0x28729e){_0x35a7d5=_0x35a7d5-0x0;var _0x41b790=_0xce53[_0x35a7d5];return _0x41b790;};'use strict';var client=require(_0x3ce5('0x0'));exports[_0x3ce5('0x1')]=function(){return function(){return client[_0x3ce5('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x3ce5('0x3'),_0x3ce5('0x4')],'include':[{'model':_0x3ce5('0x5'),'as':_0x3ce5('0x6'),'attributes':['id','name',_0x3ce5('0x7'),_0x3ce5('0x8')]}]},'log':_0x3ce5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7c46cae..926162c 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 _0x83fa=['Request','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update'];(function(_0x2db04c,_0x4b4233){var _0x1bbb72=function(_0x4c5971){while(--_0x4c5971){_0x2db04c['push'](_0x2db04c['shift']());}};_0x1bbb72(++_0x4b4233);}(_0x83fa,0x134));var _0xa83f=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x83fa[_0x373dee];return _0x46798f;};'use strict';var client=require(_0xa83f('0x0'));exports[_0xa83f('0x1')]=function(_0x560068){return client['Request'](_0xa83f('0x2'),{'body':_0x560068,'log':'CreateFaxQueueReport'});};exports[_0xa83f('0x3')]=function(_0x4f6c15,_0x33c951){return client[_0xa83f('0x4')](_0xa83f('0x5'),{'body':_0x33c951,'options':{'where':{'uniqueid':_0x4f6c15},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x2a58=['UpdateFaxQueueReport','../client','CreateFaxQueueReport','update'];(function(_0x565d0a,_0x4927cc){var _0x24c211=function(_0x18ae2b){while(--_0x18ae2b){_0x565d0a['push'](_0x565d0a['shift']());}};_0x24c211(++_0x4927cc);}(_0x2a58,0x199));var _0x82a5=function(_0x1815e6,_0x48e164){_0x1815e6=_0x1815e6-0x0;var _0x10e266=_0x2a58[_0x1815e6];return _0x10e266;};'use strict';var client=require(_0x82a5('0x0'));exports['create']=function(_0x2832fa){return client['Request'](_0x82a5('0x1'),{'body':_0x2832fa,'log':'CreateFaxQueueReport'});};exports[_0x82a5('0x2')]=function(_0x12af6e,_0x3a0667){return client['Request'](_0x82a5('0x3'),{'body':_0x3a0667,'options':{'where':{'uniqueid':_0x12af6e},'order':[['id','DESC']],'limit':0x1},'log':_0x82a5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d76ca9e..426c69e 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 _0xb577=['getIntervals','Request','name','Interval','Intervals'];(function(_0x4214da,_0x586705){var _0x64da0=function(_0x273e00){while(--_0x273e00){_0x4214da['push'](_0x4214da['shift']());}};_0x64da0(++_0x586705);}(_0xb577,0x1e5));var _0x7b57=function(_0x2e3cb8,_0x590443){_0x2e3cb8=_0x2e3cb8-0x0;var _0x486d78=_0xb577[_0x2e3cb8];return _0x486d78;};'use strict';var client=require('../client');exports[_0x7b57('0x0')]=function(){return function(){return client[_0x7b57('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7b57('0x2')],'include':[{'model':_0x7b57('0x3'),'as':_0x7b57('0x4'),'attributes':['id',_0x7b57('0x2'),'interval']}]},'log':_0x7b57('0x0')});};}; \ No newline at end of file +var _0xefb7=['GetInterval','name','Interval','interval','getIntervals','../client','Request'];(function(_0x285de7,_0x25332e){var _0x1acff2=function(_0x364ef7){while(--_0x364ef7){_0x285de7['push'](_0x285de7['shift']());}};_0x1acff2(++_0x25332e);}(_0xefb7,0xd7));var _0x7efb=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xefb7[_0x2c2980];return _0x2a20a9;};'use strict';var client=require(_0x7efb('0x0'));exports['getIntervals']=function(){return function(){return client[_0x7efb('0x1')](_0x7efb('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7efb('0x3')],'include':[{'model':_0x7efb('0x4'),'as':'Intervals','attributes':['id','name',_0x7efb('0x5')]}]},'log':_0x7efb('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c441b0b..bc70034 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 _0xaebd=['updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request','UpdateMailInteraction'];(function(_0x579fcc,_0x311458){var _0x4e93ee=function(_0x1cfcd7){while(--_0x1cfcd7){_0x579fcc['push'](_0x579fcc['shift']());}};_0x4e93ee(++_0x311458);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x14337b,_0x138760){_0x14337b=_0x14337b-0x0;var _0x98afb9=_0xaebd[_0x14337b];return _0x98afb9;};'use strict';var client=require(_0xdaeb('0x0'));exports['update']=function(_0x2e2d0c,_0xac84fd){return client[_0xdaeb('0x1')](_0xdaeb('0x2'),{'body':_0xac84fd,'options':{'where':{'id':_0x2e2d0c}},'log':_0xdaeb('0x3')});};exports['addTags']=function(_0x44e982,_0x1c617a){return client[_0xdaeb('0x1')](_0xdaeb('0x4'),{'body':_0x1c617a,'options':{'where':{'id':_0x44e982}},'log':_0xdaeb('0x5')});}; \ No newline at end of file +var _0xef0f=['../client','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xef0f,0x168));var _0xfef0=function(_0x51536e,_0x31ba57){_0x51536e=_0x51536e-0x0;var _0x3cd30f=_0xef0f[_0x51536e];return _0x3cd30f;};'use strict';var client=require(_0xfef0('0x0'));exports['update']=function(_0x74fc2,_0x22a6a3){return client[_0xfef0('0x1')]('UpdateMailInteraction',{'body':_0x22a6a3,'options':{'where':{'id':_0x74fc2}},'log':_0xfef0('0x2')});};exports[_0xfef0('0x3')]=function(_0x4618fb,_0x4e1af6){return client[_0xfef0('0x1')](_0xfef0('0x4'),{'body':_0x4e1af6,'options':{'where':{'id':_0x4618fb}},'log':_0xfef0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 4a153be..bd9d83c 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 _0xc8b1=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x447347,_0x29548b){var _0x29a403=function(_0x26683a){while(--_0x26683a){_0x447347['push'](_0x447347['shift']());}};_0x29a403(++_0x29548b);}(_0xc8b1,0x125));var _0x1c8b=function(_0x2a9916,_0x2c8cdf){_0x2a9916=_0x2a9916-0x0;var _0x4679da=_0xc8b1[_0x2a9916];return _0x4679da;};'use strict';var client=require(_0x1c8b('0x0'));exports[_0x1c8b('0x1')]=function(_0xa5566){return client[_0x1c8b('0x2')](_0x1c8b('0x3'),{'body':_0xa5566,'log':_0x1c8b('0x4')});}; \ No newline at end of file +var _0xc58f=['../client','CreateMailMessage'];(function(_0xce50ab,_0x4c503b){var _0x9432bb=function(_0x4827e7){while(--_0x4827e7){_0xce50ab['push'](_0xce50ab['shift']());}};_0x9432bb(++_0x4c503b);}(_0xc58f,0x124));var _0xfc58=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xc58f[_0x3f7598];return _0x51fb16;};'use strict';var client=require(_0xfc58('0x0'));exports['create']=function(_0x15f047){return client['Request'](_0xfc58('0x1'),{'body':_0x15f047,'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 6c104cc..46f321b 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 _0xc712=['mailPause','../client','getMailQueues','Request','strategy','User','Agents','online'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xc712,0x91));var _0x2c71=function(_0x4d4bfb,_0x363bed){_0x4d4bfb=_0x4d4bfb-0x0;var _0x32ef22=_0xc712[_0x4d4bfb];return _0x32ef22;};'use strict';var client=require(_0x2c71('0x0'));exports[_0x2c71('0x1')]=function(){return function(){return client[_0x2c71('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x2c71('0x3')],'include':[{'model':_0x2c71('0x4'),'as':_0x2c71('0x5'),'attributes':['id','name',_0x2c71('0x6'),_0x2c71('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xf249=['online','../client','getMailQueues','Request','GetMailQueue','name','strategy','User'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xf249,0xe9));var _0x9f24=function(_0x42c217,_0x19ea38){_0x42c217=_0x42c217-0x0;var _0x2ccf91=_0xf249[_0x42c217];return _0x2ccf91;};'use strict';var client=require(_0x9f24('0x0'));exports[_0x9f24('0x1')]=function(){return function(){return client[_0x9f24('0x2')](_0x9f24('0x3'),{'options':{'raw':![],'attributes':['id',_0x9f24('0x4'),'timeout',_0x9f24('0x5')],'include':[{'model':_0x9f24('0x6'),'as':'Agents','attributes':['id','name',_0x9f24('0x7'),'mailPause']}]},'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 ab42d51..63474b4 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 _0xdd1a=['UpdateMailQueueReport','../client','create','update','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdd1a,0xdd));var _0xadd1=function(_0x557bec,_0x90cf86){_0x557bec=_0x557bec-0x0;var _0x2e0ed8=_0xdd1a[_0x557bec];return _0x2e0ed8;};'use strict';var client=require(_0xadd1('0x0'));exports[_0xadd1('0x1')]=function(_0x27915d){return client['Request']('CreateMailQueueReport',{'body':_0x27915d,'log':'CreateMailQueueReport'});};exports[_0xadd1('0x2')]=function(_0x26e45a,_0x5b00a5){return client[_0xadd1('0x3')](_0xadd1('0x4'),{'body':_0x5b00a5,'options':{'where':{'uniqueid':_0x26e45a},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xef81=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xef81,0x1b1));var _0x1ef8=function(_0x121cb0,_0x1b42e9){_0x121cb0=_0x121cb0-0x0;var _0x5973d1=_0xef81[_0x121cb0];return _0x5973d1;};'use strict';var client=require(_0x1ef8('0x0'));exports[_0x1ef8('0x1')]=function(_0x49cd6f){return client[_0x1ef8('0x2')](_0x1ef8('0x3'),{'body':_0x49cd6f,'log':_0x1ef8('0x3')});};exports[_0x1ef8('0x4')]=function(_0x189d5d,_0x20e7d4){return client['Request'](_0x1ef8('0x5'),{'body':_0x20e7d4,'options':{'where':{'uniqueid':_0x189d5d},'order':[['id',_0x1ef8('0x6')]],'limit':0x1},'log':_0x1ef8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 0d70358..5d983b9 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 _0x1423=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x172a3a,_0x47e924){var _0x4a67d0=function(_0x3b4392){while(--_0x3b4392){_0x172a3a['push'](_0x172a3a['shift']());}};_0x4a67d0(++_0x47e924);}(_0x1423,0x183));var _0x3142=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1423[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x3142('0x0'));exports['update']=function(_0x499798,_0x2e52cc){return client[_0x3142('0x1')](_0x3142('0x2'),{'body':_0x2e52cc,'options':{'where':{'id':_0x499798}},'log':_0x3142('0x3')});};exports[_0x3142('0x4')]=function(_0x3e75ee,_0x26f439){return client[_0x3142('0x1')](_0x3142('0x5'),{'body':_0x26f439,'options':{'where':{'id':_0x3e75ee}},'log':_0x3142('0x6')});}; \ No newline at end of file +var _0x1ddc=['addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x3890f8,_0x1b39df){var _0x40713e=function(_0x4f7f3b){while(--_0x4f7f3b){_0x3890f8['push'](_0x3890f8['shift']());}};_0x40713e(++_0x1b39df);}(_0x1ddc,0x145));var _0xc1dd=function(_0x1a1de7,_0x1e414b){_0x1a1de7=_0x1a1de7-0x0;var _0x5e1416=_0x1ddc[_0x1a1de7];return _0x5e1416;};'use strict';var client=require('../client');exports[_0xc1dd('0x0')]=function(_0x11c516,_0x4a6f29){return client[_0xc1dd('0x1')](_0xc1dd('0x2'),{'body':_0x4a6f29,'options':{'where':{'id':_0x11c516}},'log':'updateOpenchannelInteraction'});};exports[_0xc1dd('0x3')]=function(_0x5e6bb0,_0x313257){return client[_0xc1dd('0x1')](_0xc1dd('0x4'),{'body':_0x313257,'options':{'where':{'id':_0x5e6bb0}},'log':_0xc1dd('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3735bb9..842b472 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 _0x5ff2=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x5ff2,0x8d));var _0x25ff=function(_0x5b5239,_0x111b9f){_0x5b5239=_0x5b5239-0x0;var _0x4c55f1=_0x5ff2[_0x5b5239];return _0x4c55f1;};'use strict';var client=require(_0x25ff('0x0'));exports[_0x25ff('0x1')]=function(_0x12e361){return client[_0x25ff('0x2')](_0x25ff('0x3'),{'body':_0x12e361,'log':_0x25ff('0x4')});}; \ No newline at end of file +var _0x99e5=['CreateOpenchannelMessage','create','Request'];(function(_0x49c77a,_0x58a137){var _0x2bfe90=function(_0x15169d){while(--_0x15169d){_0x49c77a['push'](_0x49c77a['shift']());}};_0x2bfe90(++_0x58a137);}(_0x99e5,0x178));var _0x599e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x99e5[_0x1cfa0d];return _0xe33279;};'use strict';var client=require('../client');exports[_0x599e('0x0')]=function(_0x45f0c7){return client[_0x599e('0x1')](_0x599e('0x2'),{'body':_0x45f0c7,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 238d899..37081d1 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 _0x4786=['User','Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name','strategy'];(function(_0x16bac8,_0xcac4c1){var _0x3f0257=function(_0x4a0483){while(--_0x4a0483){_0x16bac8['push'](_0x16bac8['shift']());}};_0x3f0257(++_0xcac4c1);}(_0x4786,0x74));var _0x6478=function(_0x4b8f0a,_0x5d6e6c){_0x4b8f0a=_0x4b8f0a-0x0;var _0x3034ba=_0x4786[_0x4b8f0a];return _0x3034ba;};'use strict';var client=require('../client');exports[_0x6478('0x0')]=function(){return function(){return client['Request'](_0x6478('0x1'),{'options':{'raw':![],'attributes':['id',_0x6478('0x2'),'timeout',_0x6478('0x3')],'include':[{'model':_0x6478('0x4'),'as':_0x6478('0x5'),'attributes':['id',_0x6478('0x2'),_0x6478('0x6'),_0x6478('0x7')]}]},'log':_0x6478('0x0')});};}; \ No newline at end of file +var _0x4f6b=['User','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4f6b,0x158));var _0xb4f6=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4f6b[_0x18ab2a];return _0x16dcee;};'use strict';var client=require(_0xb4f6('0x0'));exports[_0xb4f6('0x1')]=function(){return function(){return client['Request'](_0xb4f6('0x2'),{'options':{'raw':![],'attributes':['id',_0xb4f6('0x3'),_0xb4f6('0x4'),_0xb4f6('0x5')],'include':[{'model':_0xb4f6('0x6'),'as':_0xb4f6('0x7'),'attributes':['id',_0xb4f6('0x3'),_0xb4f6('0x8'),_0xb4f6('0x9')]}]},'log':_0xb4f6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a199b02..ef0c35f 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 _0x6400=['UpdateOpenchannelQueueReport','create','Request','CreateOpenchannelQueueReport','DESC'];(function(_0x48ee31,_0x15b628){var _0x1da5e0=function(_0x55d07a){while(--_0x55d07a){_0x48ee31['push'](_0x48ee31['shift']());}};_0x1da5e0(++_0x15b628);}(_0x6400,0x1af));var _0x0640=function(_0x5e3f0a,_0x539b4d){_0x5e3f0a=_0x5e3f0a-0x0;var _0x2b5920=_0x6400[_0x5e3f0a];return _0x2b5920;};'use strict';var client=require('../client');exports[_0x0640('0x0')]=function(_0x1270ac){return client[_0x0640('0x1')](_0x0640('0x2'),{'body':_0x1270ac,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x4c71ae,_0x264a4a){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x264a4a,'options':{'where':{'uniqueid':_0x4c71ae},'order':[['id',_0x0640('0x3')]],'limit':0x1},'log':_0x0640('0x4')});}; \ No newline at end of file +var _0x29c0=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x50d34e,_0x2436d7){var _0x371498=function(_0xdb32cc){while(--_0xdb32cc){_0x50d34e['push'](_0x50d34e['shift']());}};_0x371498(++_0x2436d7);}(_0x29c0,0x68));var _0x029c=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x29c0[_0x23e7c1];return _0x1add43;};'use strict';var client=require(_0x029c('0x0'));exports[_0x029c('0x1')]=function(_0x3571fd){return client[_0x029c('0x2')](_0x029c('0x3'),{'body':_0x3571fd,'log':_0x029c('0x3')});};exports[_0x029c('0x4')]=function(_0x3bcde8,_0x573f6a){return client[_0x029c('0x2')](_0x029c('0x5'),{'body':_0x573f6a,'options':{'where':{'uniqueid':_0x3bcde8},'order':[['id','DESC']],'limit':0x1},'log':_0x029c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e630993..4452e92 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 _0xe79f=['../client','Request'];(function(_0x42c6e5,_0x44c3b6){var _0x3475cc=function(_0x53860e){while(--_0x53860e){_0x42c6e5['push'](_0x42c6e5['shift']());}};_0x3475cc(++_0x44c3b6);}(_0xe79f,0x13a));var _0xfe79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe79f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xfe79('0x0'));exports['update']=function(_0x259811,_0x5b22f7){return client[_0xfe79('0x1')]('UpdateSmsInteraction',{'body':_0x5b22f7,'options':{'where':{'id':_0x259811}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x243f35,_0x3cfd2b){return client[_0xfe79('0x1')]('AddTagsToSmsInteraction',{'body':_0x3cfd2b,'options':{'where':{'id':_0x243f35}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xa276=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x553c78,_0x4656c2){var _0x2f68c5=function(_0x4b9fac){while(--_0x4b9fac){_0x553c78['push'](_0x553c78['shift']());}};_0x2f68c5(++_0x4656c2);}(_0xa276,0x9a));var _0x6a27=function(_0x42104f,_0x3b84c0){_0x42104f=_0x42104f-0x0;var _0x459b15=_0xa276[_0x42104f];return _0x459b15;};'use strict';var client=require('../client');exports[_0x6a27('0x0')]=function(_0xb34c4,_0x56200d){return client[_0x6a27('0x1')](_0x6a27('0x2'),{'body':_0x56200d,'options':{'where':{'id':_0xb34c4}},'log':'updateSmsInteraction'});};exports[_0x6a27('0x3')]=function(_0x431d9c,_0x18289f){return client['Request'](_0x6a27('0x4'),{'body':_0x18289f,'options':{'where':{'id':_0x431d9c}},'log':_0x6a27('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3d925ac..24346a9 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 _0x8447=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x183f92,_0x13326f){var _0x2be6f2=function(_0x430833){while(--_0x430833){_0x183f92['push'](_0x183f92['shift']());}};_0x2be6f2(++_0x13326f);}(_0x8447,0xca));var _0x7844=function(_0x5cbbab,_0x50a4dd){_0x5cbbab=_0x5cbbab-0x0;var _0x5791fd=_0x8447[_0x5cbbab];return _0x5791fd;};'use strict';var client=require(_0x7844('0x0'));exports[_0x7844('0x1')]=function(_0x22a928){return client['Request'](_0x7844('0x2'),{'body':_0x22a928,'log':_0x7844('0x3')});}; \ No newline at end of file +var _0x51cc=['Request','createSmsMessage','../client'];(function(_0x3b9ebc,_0x3920da){var _0x1ca0ea=function(_0xa9695a){while(--_0xa9695a){_0x3b9ebc['push'](_0x3b9ebc['shift']());}};_0x1ca0ea(++_0x3920da);}(_0x51cc,0xf5));var _0xc51c=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x51cc[_0xd1d19a];return _0x52a79d;};'use strict';var client=require(_0xc51c('0x0'));exports['create']=function(_0x591e41){return client[_0xc51c('0x1')]('CreateSmsMessage',{'body':_0x591e41,'log':_0xc51c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7347469..e82b4be 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x45ca3a,_0x4f54a7){var _0x4b19b6=function(_0x2b45cd){while(--_0x2b45cd){_0x45ca3a['push'](_0x45ca3a['shift']());}};_0x4b19b6(++_0x4f54a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x537d49,_0x3f3b91){var _0x49c622=function(_0x2b6b52){while(--_0x2b6b52){_0x537d49['push'](_0x537d49['shift']());}};_0x49c622(++_0x3f3b91);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xb7e7[_0x39d544];return _0x5a5ff2;};'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 19cf1cd..e2125f7 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x2d786a,_0x53847b){var _0x17b375=function(_0x98ee62){while(--_0x98ee62){_0x2d786a['push'](_0x2d786a['shift']());}};_0x17b375(++_0x53847b);}(_0x55ca,0x126));var _0xa55c=function(_0x1d2f68,_0x280a21){_0x1d2f68=_0x1d2f68-0x0;var _0x3cbf0a=_0x55ca[_0x1d2f68];return _0x3cbf0a;};'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 +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x274e84,_0x306f4e){var _0x3591b0=function(_0x59f1eb){while(--_0x59f1eb){_0x274e84['push'](_0x274e84['shift']());}};_0x3591b0(++_0x306f4e);}(_0x70e0,0x17b));var _0x070e=function(_0x3f7861,_0x28e197){_0x3f7861=_0x3f7861-0x0;var _0x48bff1=_0x70e0[_0x3f7861];return _0x48bff1;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b9c3a21..df0ca17 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(_0x5f18d7,_0x15b0dc){var _0x4f0f58=function(_0x313ccd){while(--_0x313ccd){_0x5f18d7['push'](_0x5f18d7['shift']());}};_0x4f0f58(++_0x15b0dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x461326,_0x3a6a58){var _0x206027=function(_0x23497c){while(--_0x23497c){_0x461326['push'](_0x461326['shift']());}};_0x206027(++_0x3a6a58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 4b0e4ee..43f4a5a 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 _0x27a0=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x19db4a,_0x39f04d){var _0x274fd4=function(_0x558813){while(--_0x558813){_0x19db4a['push'](_0x19db4a['shift']());}};_0x274fd4(++_0x39f04d);}(_0x27a0,0xbf));var _0x027a=function(_0xdd6280,_0x2d2e75){_0xdd6280=_0xdd6280-0x0;var _0x46611e=_0x27a0[_0xdd6280];return _0x46611e;};'use strict';var client=require('../client');exports[_0x027a('0x0')]=function(_0x3602cc,_0x290c21){return client[_0x027a('0x1')](_0x027a('0x2'),{'body':_0x290c21,'options':{'where':{'id':_0x3602cc}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x4e8d6b,_0x47cd65){return client[_0x027a('0x1')](_0x027a('0x3'),{'body':_0x47cd65,'options':{'where':{'id':_0x4e8d6b}},'log':_0x027a('0x4')});}; \ No newline at end of file +var _0xba0d=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','../client','Request'];(function(_0x398893,_0x3179f7){var _0x241519=function(_0x1ceb76){while(--_0x1ceb76){_0x398893['push'](_0x398893['shift']());}};_0x241519(++_0x3179f7);}(_0xba0d,0x8e));var _0xdba0=function(_0x19c67b,_0x43c6d5){_0x19c67b=_0x19c67b-0x0;var _0x54ad6f=_0xba0d[_0x19c67b];return _0x54ad6f;};'use strict';var client=require(_0xdba0('0x0'));exports['update']=function(_0x28e1e8,_0x43db19){return client[_0xdba0('0x1')]('UpdateWhatsappInteraction',{'body':_0x43db19,'options':{'where':{'id':_0x28e1e8}},'log':_0xdba0('0x2')});};exports['addTags']=function(_0xebb600,_0x426cac){return client[_0xdba0('0x1')](_0xdba0('0x3'),{'body':_0x426cac,'options':{'where':{'id':_0xebb600}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a23e4fb..3cddd0d 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 _0xe54d=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0xf7bf02,_0x13da13){var _0x4f263f=function(_0x3b5603){while(--_0x3b5603){_0xf7bf02['push'](_0xf7bf02['shift']());}};_0x4f263f(++_0x13da13);}(_0xe54d,0x149));var _0xde54=function(_0x531607,_0x73fa88){_0x531607=_0x531607-0x0;var _0x1b1fbb=_0xe54d[_0x531607];return _0x1b1fbb;};'use strict';var client=require(_0xde54('0x0'));exports[_0xde54('0x1')]=function(_0x21ce00){return client[_0xde54('0x2')](_0xde54('0x3'),{'body':_0x21ce00,'log':_0xde54('0x4')});}; \ No newline at end of file +var _0xeea3=['createWhatsappMessage','../client','create'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0xeea3,0x8e));var _0x3eea=function(_0x1628a1,_0x2c31e0){_0x1628a1=_0x1628a1-0x0;var _0x1d0e12=_0xeea3[_0x1628a1];return _0x1d0e12;};'use strict';var client=require(_0x3eea('0x0'));exports[_0x3eea('0x1')]=function(_0x5a1d76){return client['Request']('CreateWhatsappMessage',{'body':_0x5a1d76,'log':_0x3eea('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 32ecdbd..0e0a8ce 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 _0xb171=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x366e83,_0x306534){var _0x5f3fef=function(_0x401842){while(--_0x401842){_0x366e83['push'](_0x366e83['shift']());}};_0x5f3fef(++_0x306534);}(_0xb171,0x7c));var _0x1b17=function(_0x3c6533,_0x283ceb){_0x3c6533=_0x3c6533-0x0;var _0x5c9d71=_0xb171[_0x3c6533];return _0x5c9d71;};'use strict';var client=require(_0x1b17('0x0'));exports[_0x1b17('0x1')]=function(){return function(){return client[_0x1b17('0x2')](_0x1b17('0x3'),{'options':{'raw':![],'attributes':['id',_0x1b17('0x4'),_0x1b17('0x5'),_0x1b17('0x6')],'include':[{'model':_0x1b17('0x7'),'as':_0x1b17('0x8'),'attributes':['id',_0x1b17('0x4'),_0x1b17('0x9'),_0x1b17('0xa')]}]},'log':_0x1b17('0x1')});};}; \ No newline at end of file +var _0x0579=['online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','Agents'];(function(_0x4963c6,_0x13a5a1){var _0x15bf25=function(_0x58282f){while(--_0x58282f){_0x4963c6['push'](_0x4963c6['shift']());}};_0x15bf25(++_0x13a5a1);}(_0x0579,0x1a2));var _0x9057=function(_0x2fbdae,_0x595821){_0x2fbdae=_0x2fbdae-0x0;var _0x60a2ba=_0x0579[_0x2fbdae];return _0x60a2ba;};'use strict';var client=require('../client');exports[_0x9057('0x0')]=function(){return function(){return client[_0x9057('0x1')](_0x9057('0x2'),{'options':{'raw':![],'attributes':['id',_0x9057('0x3'),_0x9057('0x4'),'strategy'],'include':[{'model':'User','as':_0x9057('0x5'),'attributes':['id',_0x9057('0x3'),_0x9057('0x6'),_0x9057('0x7')]}]},'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 81e6eac..c3744da 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 _0xfe43=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x6c9c7e,_0x4fb1df){var _0x137375=function(_0x553b58){while(--_0x553b58){_0x6c9c7e['push'](_0x6c9c7e['shift']());}};_0x137375(++_0x4fb1df);}(_0xfe43,0x19a));var _0x3fe4=function(_0x2e2821,_0x245593){_0x2e2821=_0x2e2821-0x0;var _0x1a0965=_0xfe43[_0x2e2821];return _0x1a0965;};'use strict';var client=require(_0x3fe4('0x0'));exports[_0x3fe4('0x1')]=function(_0x428174){return client[_0x3fe4('0x2')](_0x3fe4('0x3'),{'body':_0x428174,'log':_0x3fe4('0x3')});};exports[_0x3fe4('0x4')]=function(_0x380f39,_0x2a4fc8){return client[_0x3fe4('0x2')](_0x3fe4('0x5'),{'body':_0x2a4fc8,'options':{'where':{'uniqueid':_0x380f39},'order':[['id','DESC']],'limit':0x1},'log':_0x3fe4('0x5')});}; \ No newline at end of file +var _0x5d3a=['update','Request','DESC','../client','create','CreateWhatsappQueueReport'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0x5d3a,0xb7));var _0xa5d3=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x5d3a[_0x4baae2];return _0x1a2285;};'use strict';var client=require(_0xa5d3('0x0'));exports[_0xa5d3('0x1')]=function(_0x8405e0){return client['Request'](_0xa5d3('0x2'),{'body':_0x8405e0,'log':_0xa5d3('0x2')});};exports[_0xa5d3('0x3')]=function(_0xcab0a8,_0x250e46){return client[_0xa5d3('0x4')]('UpdateWhatsappQueueReport',{'body':_0x250e46,'options':{'where':{'uniqueid':_0xcab0a8},'order':[['id',_0xa5d3('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 4607030..771ec91 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 _0x7cc7=['close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','message','join','stop','find','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7cc7,0x17d));var _0x77cc=function(_0x5776c1,_0x5f1a33){_0x5776c1=_0x5776c1-0x0;var _0x2c4a69=_0x7cc7[_0x5776c1];return _0x2c4a69;};'use strict';var schema=require(_0x77cc('0x0'));var _=require(_0x77cc('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x77cc('0x2'))(_0x77cc('0x3'));var strategy=require(_0x77cc('0x4'));var queue=schema({'name':{'type':_0x77cc('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x77cc('0x6'),'message':_0x77cc('0x7')}});function writeLog(_0x559b6c,_0x1736fb,_0x44fc20){return logger[_0x77cc('0x8')](util[_0x77cc('0x9')](_0x77cc('0xa'),_0x559b6c,_0x1736fb[_0x77cc('0xb')],_0x44fc20));}function handleFindAgent(_0x385e62){return function(_0x17defb){return _0x17defb[_0x77cc('0xb')][_0x77cc('0xc')]()===_0x385e62[_0x77cc('0xc')]();};}exports[_0x77cc('0xd')]=function(_0x2225d6,_0x406446,_0x5c7828,_0x4c1e29){return function(_0x2988fc){try{var _0x38d467={'name':_0x406446[0x0],'timeout':_0x406446[0x1]};var _0x3856c6=queue[_0x77cc('0x0')](_0x38d467,{'typecast':!![]});if(_0x3856c6[_0x77cc('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x2225d6,_[_0x77cc('0xf')](_0x3856c6,_0x77cc('0x10'))[_0x77cc('0x11')](',\x20'));_0x2988fc[_0x77cc('0x12')]();}else{var _0x2bcd42=_[_0x77cc('0x13')](_0x5c7828['agents'],handleFindAgent(_0x38d467[_0x77cc('0xb')]));if(_0x2bcd42){var _0x2fb4a8=(_0x38d467[_0x77cc('0x14')]||0xa)*0x3e8;var _0x43975,_0x2640ba;var _0x15698c=seqqueue['createQueue'](_0x2fb4a8);_0x15698c['id']=_0x2225d6;_0x15698c[_0x77cc('0x15')]=_0x2fb4a8;_0x15698c[_0x77cc('0x16')]=_0x4c1e29['channel'];writeLog(_0x2225d6,_0x2bcd42,util['format'](_0x77cc('0x17'),_0x2fb4a8));_0x5c7828[_0x77cc('0x18')][_0x2225d6]['on'](_0x77cc('0x19'),function(){logger[_0x77cc('0x8')](_0x77cc('0x1a'),_0x2225d6);clearTimeout(_0x2640ba);_0x2640ba=undefined;_0x15698c[_0x77cc('0x1b')]();if(_0x5c7828[_0x77cc('0x18')][_0x2225d6]){delete _0x5c7828['rules'][_0x2225d6];}_0x2988fc[_0x77cc('0x12')]();});_0x5c7828[_0x77cc('0x18')][_0x2225d6]['on']('complete',function(){if(_0x5c7828[_0x77cc('0x18')][_0x2225d6]){delete _0x5c7828['rules'][_0x2225d6];}});_0x2640ba=setTimeout(function(){logger[_0x77cc('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x2225d6);clearTimeout(_0x2640ba);_0x15698c[_0x77cc('0x1b')]();_0x2988fc[_0x77cc('0x1c')]();},_0x2fb4a8);strategy[_0x77cc('0x1d')](_0x15698c,_0x2bcd42,_0x5c7828,_0x4c1e29);}else{logger[_0x77cc('0x1e')](_0x77cc('0x1f'),_0x2225d6,_0x38d467[_0x77cc('0xb')]);_0x2988fc['stop']();}}}catch(_0x31b050){console[_0x77cc('0x20')](_0x31b050);logger[_0x77cc('0x1e')](_0x77cc('0x21'),_0x2225d6,_0x31b050['stack']);_0x2988fc[_0x77cc('0x12')]();}};}; \ No newline at end of file +var _0xcb42=['consequence','validate','length','message','stop','find','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x564801,_0x2ff0e2){var _0x10bb38=function(_0x14681a){while(--_0x14681a){_0x564801['push'](_0x564801['shift']());}};_0x10bb38(++_0x2ff0e2);}(_0xcb42,0xfc));var _0x2cb4=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0xcb42[_0x584291];return _0x4e7d08;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x2cb4('0x0'));var seqqueue=require(_0x2cb4('0x1'));var logger=require(_0x2cb4('0x2'))(_0x2cb4('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x2cb4('0x4'),'required':!![],'message':_0x2cb4('0x5')},'timeout':{'type':_0x2cb4('0x6'),'message':_0x2cb4('0x7')}});function writeLog(_0x2fc71e,_0xe2a0c1,_0x18cd83){return logger[_0x2cb4('0x8')](util['format'](_0x2cb4('0x9'),_0x2fc71e,_0xe2a0c1[_0x2cb4('0xa')],_0x18cd83));}function handleFindAgent(_0x43456b){return function(_0x3c88bc){return _0x3c88bc[_0x2cb4('0xa')][_0x2cb4('0xb')]()===_0x43456b[_0x2cb4('0xb')]();};}exports[_0x2cb4('0xc')]=function(_0x53c073,_0x5c1646,_0x20f5ef,_0x860f8a){return function(_0x99076c){try{var _0x45420f={'name':_0x5c1646[0x0],'timeout':_0x5c1646[0x1]};var _0x3e6f87=queue[_0x2cb4('0xd')](_0x45420f,{'typecast':!![]});if(_0x3e6f87[_0x2cb4('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x53c073,_['map'](_0x3e6f87,_0x2cb4('0xf'))['join'](',\x20'));_0x99076c[_0x2cb4('0x10')]();}else{var _0x8e512e=_[_0x2cb4('0x11')](_0x20f5ef['agents'],handleFindAgent(_0x45420f[_0x2cb4('0xa')]));if(_0x8e512e){var _0x4228da=(_0x45420f['timeout']||0xa)*0x3e8;var _0x5bfd8a,_0x5aeb63;var _0x5e3a1e=seqqueue['createQueue'](_0x4228da);_0x5e3a1e['id']=_0x53c073;_0x5e3a1e['atimeout']=_0x4228da;_0x5e3a1e[_0x2cb4('0x12')]=_0x860f8a[_0x2cb4('0x12')];writeLog(_0x53c073,_0x8e512e,util[_0x2cb4('0x13')](_0x2cb4('0x14'),_0x4228da));_0x20f5ef[_0x2cb4('0x15')][_0x53c073]['on'](_0x2cb4('0x16'),function(){logger[_0x2cb4('0x8')](_0x2cb4('0x17'),_0x53c073);clearTimeout(_0x5aeb63);_0x5aeb63=undefined;_0x5e3a1e[_0x2cb4('0x18')]();if(_0x20f5ef['rules'][_0x53c073]){delete _0x20f5ef['rules'][_0x53c073];}_0x99076c[_0x2cb4('0x10')]();});_0x20f5ef['rules'][_0x53c073]['on'](_0x2cb4('0x19'),function(){if(_0x20f5ef[_0x2cb4('0x15')][_0x53c073]){delete _0x20f5ef[_0x2cb4('0x15')][_0x53c073];}});_0x5aeb63=setTimeout(function(){logger[_0x2cb4('0x8')](_0x2cb4('0x1a'),_0x53c073);clearTimeout(_0x5aeb63);_0x5e3a1e[_0x2cb4('0x18')]();_0x99076c['next']();},_0x4228da);strategy[_0x2cb4('0x1b')](_0x5e3a1e,_0x8e512e,_0x20f5ef,_0x860f8a);}else{logger[_0x2cb4('0x1c')](_0x2cb4('0x1d'),_0x53c073,_0x45420f[_0x2cb4('0xa')]);_0x99076c['stop']();}}}catch(_0x148386){console[_0x2cb4('0x1e')](_0x148386);logger[_0x2cb4('0x1c')](_0x2cb4('0x1f'),_0x53c073,_0x148386[_0x2cb4('0x20')]);_0x99076c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index e971e9f..3db258f 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 _0x9716=['lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','providerName','amazonlex','providerResponse','create','Failed','stringify'];(function(_0x1f559a,_0x4b3497){var _0x47949d=function(_0x4daa66){while(--_0x4daa66){_0x1f559a['push'](_0x1f559a['shift']());}};_0x47949d(++_0x4b3497);}(_0x9716,0x1ea));var _0x6971=function(_0x5c92c7,_0x2bae59){_0x5c92c7=_0x5c92c7-0x0;var _0x1f64c0=_0x9716[_0x5c92c7];return _0x1f64c0;};'use strict';var _=require(_0x6971('0x0'));var moment=require(_0x6971('0x1'));var AWS=require(_0x6971('0x2'));var utils=require(_0x6971('0x3'));var logger=require('../../../../config/logger')(_0x6971('0x4'));var rpc={'chatMessage':require(_0x6971('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6971('0x6')),'smsMessage':require(_0x6971('0x7')),'faxMessage':require(_0x6971('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x6971('0x9')]=function(_0xa2c1fa,_0x4f86f2){return function(_0x120a3e){try{if(!_[_0x6971('0xa')](this[_0x6971('0xb')][_0x6971('0xc')])){logger[_0x6971('0xd')]('[%s][AMAZONLEX]\x20%s',_0xa2c1fa,_0x6971('0xe'));return _0x120a3e[_0x6971('0xf')]();}var _0x31009a={'ContactId':this[_0x6971('0x10')]['id'],'sentAt':moment()[_0x6971('0x11')](_0x6971('0x12')),'direction':'out'};if(this['channel']===_0x6971('0x13')||this[_0x6971('0x14')]===_0x6971('0x15')){_0x31009a[_0x6971('0x16')]=this['interaction']['phone'];}var _0x2f3d4b=this[_0x6971('0x14')];if(_0x2f3d4b==='chat'){_0x31009a[_0x6971('0x17')]=this[_0x6971('0x18')]['id'];}else{_0x31009a[_[_0x6971('0x19')](_0x2f3d4b)+_0x6971('0x1a')]=this[_0x6971('0x18')]['id'];}_0x31009a[_[_0x6971('0x19')](_0x2f3d4b)+_0x6971('0x1b')]=this['interaction']['id'];if(this[_0x6971('0xb')][_0x6971('0x1c')]){var _0x10eb51=_0x4f86f2[0x4];if(!_[_0x6971('0x1d')](_0x10eb51)){_0x31009a[_0x6971('0x1e')]=utils[_0x6971('0x1f')](_0x10eb51,this);return rpc[_0x2f3d4b+_0x6971('0x20')]['create'](_0x31009a)[_0x6971('0x21')](function(_0x4a806a){logger[_0x6971('0xd')](_0x6971('0x22'),_0xa2c1fa,_0x31009a[_0x6971('0x1e')]);})[_0x6971('0x23')](function(_0x3494ea){logger[_0x6971('0x24')](_0x6971('0x22'),_0xa2c1fa,JSON['stringify'](_0x3494ea));})['finally'](function(){logger[_0x6971('0xd')](_0x6971('0x25'),_0xa2c1fa);_0x120a3e[_0x6971('0x26')]();});}else{logger[_0x6971('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xa2c1fa);_0x120a3e['stop']();}}else{var _0x5baed2=this;var _0x5afe18=new AWS[(_0x6971('0x27'))]({'accessKeyId':_0x4f86f2[0x0],'secretAccessKey':_0x4f86f2[0x1],'region':_0x4f86f2[0x2]});var _0xad5952={'botAlias':_0x6971('0x28'),'botName':_0x4f86f2[0x3],'inputText':this[_0x6971('0x29')][_0x6971('0x1e')],'userId':this[_0x6971('0x14')]+':'+this['interaction']['id'][_0x6971('0x2a')]()};_0x5afe18['postText'](_0xad5952,function(_0x370d5b,_0x29d430){if(_0x370d5b){logger[_0x6971('0x24')](_0x6971('0x22'),_0xa2c1fa,_0x370d5b[_0x6971('0x29')]);_0x120a3e[_0x6971('0xf')]();}else if(_0x29d430&&_0x29d430[_0x6971('0x29')]){_0x5baed2['body']['amazonlex']=_0x29d430;_0x31009a['body']=_0x29d430['message'];_0x31009a[_0x6971('0x2b')]=_0x6971('0x2c');_0x31009a[_0x6971('0x2d')]=JSON['stringify'](_0x29d430);return rpc[_0x2f3d4b+_0x6971('0x20')][_0x6971('0x2e')](_0x31009a)[_0x6971('0x21')](function(_0xf6fcba){logger[_0x6971('0xd')]('[%s][AMAZONLEX]\x20%s',_0xa2c1fa,_0x31009a[_0x6971('0x1e')]);if(_0x29d430['dialogState']==_0x6971('0x2f')){_0x120a3e['next']();}else{_0x120a3e[_0x6971('0x26')]();}})[_0x6971('0x23')](function(_0x13c829){logger['error'](_0x6971('0x22'),_0xa2c1fa,JSON['stringify'](_0x13c829));_0x120a3e[_0x6971('0xf')]();});}else{_0x120a3e[_0x6971('0xf')]();}});}}catch(_0x4e80cf){logger[_0x6971('0x24')]('[%s][AMAZONLEX]\x20%s',_0xa2c1fa,JSON[_0x6971('0x30')](_0x4e80cf));_0x120a3e[_0x6971('0x26')]();}};}; \ No newline at end of file +var _0x40fe=['UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','sms','whatsapp','phone','interaction','chat','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','create','then','body','catch','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','next','amazonlex','providerResponse','dialogState','Failed','stop','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x40fe,0x14e));var _0xe40f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x40fe[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xe40f('0x0'));var moment=require('moment');var AWS=require(_0xe40f('0x1'));var utils=require(_0xe40f('0x2'));var logger=require(_0xe40f('0x3'))('routing');var rpc={'chatMessage':require(_0xe40f('0x4')),'openchannelMessage':require(_0xe40f('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe40f('0x6')),'whatsappMessage':require(_0xe40f('0x7'))};exports[_0xe40f('0x8')]=function(_0x4dc625,_0x4cf1e1){return function(_0x17428e){try{if(!_['isNil'](this['interaction'][_0xe40f('0x9')])){logger['info'](_0xe40f('0xa'),_0x4dc625,_0xe40f('0xb'));return _0x17428e['next']();}var _0xee2e58={'ContactId':this[_0xe40f('0xc')]['id'],'sentAt':moment()[_0xe40f('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe40f('0xe')};if(this[_0xe40f('0xf')]===_0xe40f('0x10')||this[_0xe40f('0xf')]===_0xe40f('0x11')){_0xee2e58[_0xe40f('0x12')]=this[_0xe40f('0x13')][_0xe40f('0x12')];}var _0x1828c2=this[_0xe40f('0xf')];if(_0x1828c2===_0xe40f('0x14')){_0xee2e58['ChatWebsiteId']=this[_0xe40f('0x15')]['id'];}else{_0xee2e58[_['upperFirst'](_0x1828c2)+_0xe40f('0x16')]=this['account']['id'];}_0xee2e58[_[_0xe40f('0x17')](_0x1828c2)+_0xe40f('0x18')]=this[_0xe40f('0x13')]['id'];if(this[_0xe40f('0x13')][_0xe40f('0x19')]){var _0x5a6e47=_0x4cf1e1[0x4];if(!_[_0xe40f('0x1a')](_0x5a6e47)){_0xee2e58['body']=utils['getMustacheRender'](_0x5a6e47,this);return rpc[_0x1828c2+_0xe40f('0x1b')][_0xe40f('0x1c')](_0xee2e58)[_0xe40f('0x1d')](function(_0x2a7f6c){logger['info'](_0xe40f('0xa'),_0x4dc625,_0xee2e58[_0xe40f('0x1e')]);})[_0xe40f('0x1f')](function(_0x296bf7){logger['error'](_0xe40f('0xa'),_0x4dc625,JSON[_0xe40f('0x20')](_0x296bf7));})[_0xe40f('0x21')](function(){logger[_0xe40f('0x22')](_0xe40f('0x23'),_0x4dc625);_0x17428e['stop']();});}else{logger[_0xe40f('0x22')](_0xe40f('0x24'),_0x4dc625);_0x17428e['stop']();}}else{var _0x12f0f5=this;var _0x5024ad=new AWS[(_0xe40f('0x25'))]({'accessKeyId':_0x4cf1e1[0x0],'secretAccessKey':_0x4cf1e1[0x1],'region':_0x4cf1e1[0x2]});var _0x180a4f={'botAlias':_0xe40f('0x26'),'botName':_0x4cf1e1[0x3],'inputText':this[_0xe40f('0x27')][_0xe40f('0x1e')],'userId':this[_0xe40f('0xf')]+':'+this[_0xe40f('0x13')]['id'][_0xe40f('0x28')]()};_0x5024ad[_0xe40f('0x29')](_0x180a4f,function(_0x1c1111,_0x584f20){if(_0x1c1111){logger[_0xe40f('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x4dc625,_0x1c1111[_0xe40f('0x27')]);_0x17428e[_0xe40f('0x2b')]();}else if(_0x584f20&&_0x584f20[_0xe40f('0x27')]){_0x12f0f5[_0xe40f('0x1e')][_0xe40f('0x2c')]=_0x584f20;_0xee2e58[_0xe40f('0x1e')]=_0x584f20['message'];_0xee2e58['providerName']=_0xe40f('0x2c');_0xee2e58[_0xe40f('0x2d')]=JSON[_0xe40f('0x20')](_0x584f20);return rpc[_0x1828c2+_0xe40f('0x1b')]['create'](_0xee2e58)[_0xe40f('0x1d')](function(_0x3133ef){logger[_0xe40f('0x22')]('[%s][AMAZONLEX]\x20%s',_0x4dc625,_0xee2e58[_0xe40f('0x1e')]);if(_0x584f20[_0xe40f('0x2e')]==_0xe40f('0x2f')){_0x17428e[_0xe40f('0x2b')]();}else{_0x17428e[_0xe40f('0x30')]();}})[_0xe40f('0x1f')](function(_0x53a7b5){logger['error'](_0xe40f('0xa'),_0x4dc625,JSON['stringify'](_0x53a7b5));_0x17428e['next']();});}else{_0x17428e['next']();}});}}catch(_0x1ecc61){logger[_0xe40f('0x2a')](_0xe40f('0xa'),_0x4dc625,JSON[_0xe40f('0x20')](_0x1ecc61));_0x17428e[_0xe40f('0x30')]();}};}; \ 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 990c4b7..73a0e36 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 _0x9a3c=['auto-replied','All','auto_reply','sendMailMessage','account','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','catch','error','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','Message','inReplyTo','html','','';_0x48d6e2['headers']={'Auto-Submitted':_0xc9a3('0x33'),'X-Auto-Response-Suppress':_0xc9a3('0x34'),'Precedence':_0xc9a3('0x35')};return mailRpc[_0xc9a3('0x36')](this[_0xc9a3('0x37')][_0xc9a3('0x38')],_0x48d6e2)[_0xc9a3('0x39')](function(_0x4a39f9){logger[_0xc9a3('0x12')](_0xc9a3('0x3a'),_0x922e36);_0x48d6e2[_0xc9a3('0x3b')]=_0x4a39f9[_0xc9a3('0x21')][_0xc9a3('0x3b')];return rpc[_0x1cdd17+'Message']['create'](_0x48d6e2);})[_0xc9a3('0x39')](function(_0x3c0744){logger[_0xc9a3('0x12')](_0xc9a3('0x13'),_0x922e36,JSON[_0xc9a3('0x3c')](_0x3c0744));})[_0xc9a3('0x3d')](function(_0x9c482e){logger[_0xc9a3('0x3e')]('[RPC][%s][AUTOREPLY]\x20%s',_0x922e36,JSON[_0xc9a3('0x3c')](_0x9c482e));})[_0xc9a3('0x3f')](function(){Promise[_0xc9a3('0x40')]()[_0xc9a3('0x39')](function(){if(_0x439156[0x0]!=='2'||_0x26d2da[_0xc9a3('0x19')])return;return rpc[_0x1cdd17+_0xc9a3('0x41')][_0xc9a3('0x42')](_0x26d2da['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4e8a1c){logger['info'](_0xc9a3('0x1a'),_0x922e36,JSON[_0xc9a3('0x3c')](_0x4e8a1c));})['catch'](function(_0x405b0d){logger[_0xc9a3('0x3e')](_0xc9a3('0x43'),_0x922e36,JSON[_0xc9a3('0x3c')](_0x405b0d));});})[_0xc9a3('0x39')](function(){_0x157d5e[_0xc9a3('0x14')]();});});}else{return rpc[this[_0xc9a3('0x1f')]+_0xc9a3('0x2d')][_0xc9a3('0x44')](_0x48d6e2)[_0xc9a3('0x39')](function(){logger[_0xc9a3('0x12')](_0xc9a3('0x13'),_0x922e36,_0x48d6e2[_0xc9a3('0x10')]);})[_0xc9a3('0x3d')](function(_0x8b533b){logger['error'](_0xc9a3('0x13'),_0x922e36,JSON[_0xc9a3('0x3c')](_0x8b533b));})[_0xc9a3('0x3f')](function(){Promise[_0xc9a3('0x40')]()[_0xc9a3('0x39')](function(){if(_0x439156[0x0]!=='2'||_0x26d2da[_0xc9a3('0x19')])return;return rpc[_0x1cdd17+'Interaction'][_0xc9a3('0x42')](_0x26d2da['id'],{'autoreplyExecuted':!![]})[_0xc9a3('0x39')](function(_0x3b789d){logger[_0xc9a3('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x922e36,JSON['stringify'](_0x3b789d));})[_0xc9a3('0x3d')](function(_0x36dc65){logger['error'](_0xc9a3('0x43'),_0x922e36,JSON[_0xc9a3('0x3c')](_0x36dc65));});})['then'](function(){_0x157d5e[_0xc9a3('0x14')]();});});}}}catch(_0x436c14){logger[_0xc9a3('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x922e36,JSON[_0xc9a3('0x3c')](_0x436c14));_0x157d5e[_0xc9a3('0x45')]();}};}; \ No newline at end of file +var _0x721a=['auto-replied','All','sendMailMessage','account','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','stringify','catch','error','finally','resolve','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','upperFirst','AccountId','InteractionId','inReplyTo','messageId','','replace','','headers'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x721a,0x117));var _0xa721=function(_0x2199d2,_0x1adb26){_0x2199d2=_0x2199d2-0x0;var _0x26aa00=_0x721a[_0x2199d2];return _0x26aa00;};'use strict';var _=require(_0xa721('0x0'));var moment=require(_0xa721('0x1'));var utils=require('./utils');var logger=require(_0xa721('0x2'))(_0xa721('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa721('0x4')),'mailMessage':require(_0xa721('0x5')),'smsMessage':require(_0xa721('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xa721('0x7')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xa721('0x8')),'whatsappInteraction':require(_0xa721('0x9'))};var mailRpc=require(_0xa721('0xa'));exports[_0xa721('0xb')]=function(_0x2d6ad6,_0x22b463,_0x11f368,_0x4f2ac2){return function(_0x2a9209){try{var _0x475cdf=this['channel'];if(_0x475cdf===_0xa721('0xc')&&_0x4f2ac2[_0xa721('0xd')][_0xa721('0xe')]){logger['info'](_0xa721('0xf'),_0x2d6ad6,_0xa721('0x10'));return _0x2a9209[_0xa721('0x11')]();}if(_0x22b463[0x0]==='1'&&(_[_0xa721('0x12')](this[_0xa721('0x13')][_0xa721('0x14')])||!this[_0xa721('0x13')][_0xa721('0x14')])){logger[_0xa721('0x15')](_0xa721('0xf'),_0x2d6ad6,_0xa721('0x16'));return _0x2a9209['next']();}if(_0x22b463[0x0]==='2'&&this[_0xa721('0x13')][_0xa721('0x17')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2d6ad6,_0xa721('0x18'));return _0x2a9209[_0xa721('0x11')]();}var _0x5771fe={'ContactId':this[_0xa721('0x19')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa721('0x1a')};if(this[_0xa721('0x1b')]===_0xa721('0xc')){_0x5771fe[_0xa721('0xd')]=utils[_0xa721('0x1c')](_0x22b463[0x2],this);}else{_0x5771fe[_0xa721('0xd')]=utils[_0xa721('0x1c')](_0x22b463[0x1],this);}if(this[_0xa721('0x1d')]){_0x5771fe['to']=this[_0xa721('0x1d')][_0xa721('0x1e')]||'';if(this[_0xa721('0x1b')]===_0xa721('0xc')&&_0x22b463[0x1]==='1'){_0x5771fe['cc']=this['message']['cc']||'';}_0x5771fe[_0xa721('0x1e')]=this['message']['to']||'';_0x5771fe[_0xa721('0x1f')]=this[_0xa721('0x1d')]['phone']||'';_0x5771fe[_0xa721('0x20')]=!![];if(this[_0xa721('0x1d')][_0xa721('0x21')]){_0x5771fe[_0xa721('0x21')]='';_0x5771fe[_0xa721('0x21')]+=_[_0xa721('0x22')](this[_0xa721('0x1d')][_0xa721('0x21')],'Re:')?'':'Re:\x20';_0x5771fe[_0xa721('0x21')]+=this['message']['subject'];}}if(this['channel']==='chat'){_0x5771fe['ChatWebsiteId']=this['account']['id'];}else{_0x5771fe[_[_0xa721('0x23')](this[_0xa721('0x1b')])+_0xa721('0x24')]=this['account']['id'];}_0x5771fe[_[_0xa721('0x23')](this['channel'])+_0xa721('0x25')]=this[_0xa721('0x13')]['id'];var _0x4dc7d6=this[_0xa721('0x13')];if(rpc[this[_0xa721('0x1b')]+'Message']){if(this[_0xa721('0x1b')]===_0xa721('0xc')){_0x5771fe[_0xa721('0x26')]=this[_0xa721('0x1d')][_0xa721('0x27')];_0x5771fe['html']=_0xa721('0x28')+_[_0xa721('0x29')](_0x5771fe[_0xa721('0xd')],_0xa721('0x2a'),_0xa721('0x2b'))+_0xa721('0x2c');_0x5771fe[_0xa721('0x2d')]={'Auto-Submitted':_0xa721('0x2e'),'X-Auto-Response-Suppress':_0xa721('0x2f'),'Precedence':'auto_reply'};return mailRpc[_0xa721('0x30')](this[_0xa721('0x31')][_0xa721('0x32')],_0x5771fe)['then'](function(_0x363ed5){logger[_0xa721('0x15')](_0xa721('0x33'),_0x2d6ad6);_0x5771fe[_0xa721('0x27')]=_0x363ed5['message']['messageId'];return rpc[_0x475cdf+_0xa721('0x34')][_0xa721('0x35')](_0x5771fe);})[_0xa721('0x36')](function(_0x48c24a){logger[_0xa721('0x15')](_0xa721('0xf'),_0x2d6ad6,JSON[_0xa721('0x37')](_0x48c24a));})[_0xa721('0x38')](function(_0x2900b1){logger[_0xa721('0x39')]('[RPC][%s][AUTOREPLY]\x20%s',_0x2d6ad6,JSON[_0xa721('0x37')](_0x2900b1));})[_0xa721('0x3a')](function(){Promise[_0xa721('0x3b')]()[_0xa721('0x36')](function(){if(_0x22b463[0x0]!=='2'||_0x4dc7d6[_0xa721('0x17')])return;return rpc[_0x475cdf+'Interaction'][_0xa721('0x3c')](_0x4dc7d6['id'],{'autoreplyExecuted':!![]})[_0xa721('0x36')](function(_0x12a126){logger[_0xa721('0x15')](_0xa721('0x3d'),_0x2d6ad6,JSON['stringify'](_0x12a126));})[_0xa721('0x38')](function(_0x2d6a1f){logger['error'](_0xa721('0x3e'),_0x2d6ad6,JSON[_0xa721('0x37')](_0x2d6a1f));});})['then'](function(){_0x2a9209[_0xa721('0x11')]();});});}else{return rpc[this[_0xa721('0x1b')]+_0xa721('0x34')][_0xa721('0x35')](_0x5771fe)[_0xa721('0x36')](function(){logger[_0xa721('0x15')](_0xa721('0xf'),_0x2d6ad6,_0x5771fe[_0xa721('0xd')]);})[_0xa721('0x38')](function(_0x5477a9){logger[_0xa721('0x39')](_0xa721('0xf'),_0x2d6ad6,JSON[_0xa721('0x37')](_0x5477a9));})[_0xa721('0x3a')](function(){Promise['resolve']()[_0xa721('0x36')](function(){if(_0x22b463[0x0]!=='2'||_0x4dc7d6[_0xa721('0x17')])return;return rpc[_0x475cdf+_0xa721('0x3f')][_0xa721('0x3c')](_0x4dc7d6['id'],{'autoreplyExecuted':!![]})[_0xa721('0x36')](function(_0x129c65){logger[_0xa721('0x15')](_0xa721('0x3d'),_0x2d6ad6,JSON[_0xa721('0x37')](_0x129c65));})[_0xa721('0x38')](function(_0x9ef0c6){logger[_0xa721('0x39')](_0xa721('0x3e'),_0x2d6ad6,JSON['stringify'](_0x9ef0c6));});})[_0xa721('0x36')](function(){_0x2a9209[_0xa721('0x11')]();});});}}}catch(_0x8107a9){logger[_0xa721('0x39')]('[%s][AUTOREPLY]\x20%s',_0x2d6ad6,JSON[_0xa721('0x37')](_0x8107a9));_0x2a9209[_0xa721('0x40')]();}};}; \ 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 f1d3b5d..60f2950 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 _0xd110=['../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x42f687,_0x558724){var _0x108838=function(_0x725814){while(--_0x725814){_0x42f687['push'](_0x42f687['shift']());}};_0x108838(++_0x558724);}(_0xd110,0xe3));var _0x0d11=function(_0x1d15cf,_0xafcc71){_0x1d15cf=_0x1d15cf-0x0;var _0x2214b8=_0xd110[_0x1d15cf];return _0x2214b8;};'use strict';var moment=require(_0x0d11('0x0'));var logger=require(_0x0d11('0x1'))(_0x0d11('0x2'));var rpc={'chatInteraction':require(_0x0d11('0x3')),'openchannelInteraction':require(_0x0d11('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0d11('0x5'))};exports[_0x0d11('0x6')]=function(_0x122d35,_0x21838c,_0x9dc3ce,_0x152f88){return function(_0x361f7d){try{logger[_0x0d11('0x7')](_0x0d11('0x8'),_0x122d35,_0x21838c[0x0]);var _0x5c3a52={'closed':0x1,'closedAt':moment()['format'](_0x0d11('0x9')),'closeReason':_0x0d11('0xa'),'disposition':_0x21838c[0x0]};if(rpc[_0x152f88[_0x0d11('0xb')]+_0x0d11('0xc')]){rpc[_0x152f88['channel']+_0x0d11('0xc')][_0x0d11('0xd')](_0x152f88[_0x0d11('0xe')]['id'],_0x5c3a52)[_0x0d11('0xf')](function(_0x593d7c){logger[_0x0d11('0x7')](_0x0d11('0x10'),_0x122d35,_0x152f88[_0x0d11('0xe')]['id']);})['catch'](function(_0x583efe){logger[_0x0d11('0x11')]('[%s][CLOSE]\x20%s',_0x122d35,JSON[_0x0d11('0x12')](_0x583efe));})['finally'](function(){_0x361f7d[_0x0d11('0x13')]();});}}catch(_0x4f1e57){logger[_0x0d11('0x11')](_0x0d11('0x14'),_0x122d35,JSON[_0x0d11('0x12')](_0x4f1e57));_0x361f7d['stop']();}};}; \ No newline at end of file +var _0xb35a=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction'];(function(_0x45ce0e,_0x2b78d9){var _0x5b68a0=function(_0x294e24){while(--_0x294e24){_0x45ce0e['push'](_0x45ce0e['shift']());}};_0x5b68a0(++_0x2b78d9);}(_0xb35a,0x13f));var _0xab35=function(_0x46e82f,_0x8ff37e){_0x46e82f=_0x46e82f-0x0;var _0x14323c=_0xb35a[_0x46e82f];return _0x14323c;};'use strict';var moment=require(_0xab35('0x0'));var logger=require('../../../../config/logger')(_0xab35('0x1'));var rpc={'chatInteraction':require(_0xab35('0x2')),'openchannelInteraction':require(_0xab35('0x3')),'smsInteraction':require(_0xab35('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xab35('0x5')),'whatsappInteraction':require(_0xab35('0x6'))};exports[_0xab35('0x7')]=function(_0x8f75b1,_0xcafe96,_0x175641,_0x1600a1){return function(_0x204a47){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x8f75b1,_0xcafe96[0x0]);var _0xabe8ab={'closed':0x1,'closedAt':moment()['format'](_0xab35('0x8')),'closeReason':_0xab35('0x9'),'disposition':_0xcafe96[0x0]};if(rpc[_0x1600a1[_0xab35('0xa')]+_0xab35('0xb')]){rpc[_0x1600a1[_0xab35('0xa')]+_0xab35('0xb')][_0xab35('0xc')](_0x1600a1[_0xab35('0xd')]['id'],_0xabe8ab)[_0xab35('0xe')](function(_0x358d18){logger[_0xab35('0xf')](_0xab35('0x10'),_0x8f75b1,_0x1600a1[_0xab35('0xd')]['id']);})[_0xab35('0x11')](function(_0x205429){logger[_0xab35('0x12')](_0xab35('0x13'),_0x8f75b1,JSON[_0xab35('0x14')](_0x205429));})[_0xab35('0x15')](function(){_0x204a47[_0xab35('0x16')]();});}}catch(_0x35028c){logger[_0xab35('0x12')](_0xab35('0x13'),_0x8f75b1,JSON['stringify'](_0x35028c));_0x204a47[_0xab35('0x16')]();}};}; \ 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 10c0691..605e7fa 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 _0xf1c6=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','body','Message','create','info','[%s][DIALOGFLOW]\x20%s','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','fulfillment','speech','providerName','providerResponse','metadata','endConversation','catch','stringify','stop','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger'];(function(_0x4a6ad2,_0x138fa0){var _0x25c163=function(_0x12e042){while(--_0x12e042){_0x4a6ad2['push'](_0x4a6ad2['shift']());}};_0x25c163(++_0x138fa0);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x491d42,_0x2f4090){_0x491d42=_0x491d42-0x0;var _0x2eb668=_0xf1c6[_0x491d42];return _0x2eb668;};'use strict';var _=require(_0x6f1c('0x0'));var moment=require(_0x6f1c('0x1'));var apiai=require(_0x6f1c('0x2'));var md5=require(_0x6f1c('0x3'));var utils=require(_0x6f1c('0x4'));var logger=require(_0x6f1c('0x5'))(_0x6f1c('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6f1c('0x7')),'mailMessage':require(_0x6f1c('0x8')),'smsMessage':require(_0x6f1c('0x9')),'faxMessage':require(_0x6f1c('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1a3460,_0x2d0f02){return function(_0x3f7b30){try{if(!_[_0x6f1c('0xb')](this[_0x6f1c('0xc')][_0x6f1c('0xd')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1a3460,_0x6f1c('0xe'));return _0x3f7b30[_0x6f1c('0xf')]();}var _0xed1cca={'ContactId':this[_0x6f1c('0x10')]['id'],'sentAt':moment()[_0x6f1c('0x11')](_0x6f1c('0x12')),'direction':'out'};if(this[_0x6f1c('0x13')]===_0x6f1c('0x14')||this['channel']===_0x6f1c('0x15')){_0xed1cca['phone']=this['interaction'][_0x6f1c('0x16')];}var _0x2d5956=this['channel'];if(_0x2d5956==='chat'){_0xed1cca[_0x6f1c('0x17')]=this['account']['id'];}else{_0xed1cca[_[_0x6f1c('0x18')](_0x2d5956)+_0x6f1c('0x19')]=this[_0x6f1c('0x1a')]['id'];}_0xed1cca[_[_0x6f1c('0x18')](_0x2d5956)+_0x6f1c('0x1b')]=this[_0x6f1c('0xc')]['id'];if(this[_0x6f1c('0xc')]['created']){var _0x2ca612=_0x2d0f02[0x2];if(!_['isEmpty'](_0x2ca612)){_0xed1cca[_0x6f1c('0x1c')]=utils['getMustacheRender'](_0x2ca612,this);return rpc[_0x2d5956+_0x6f1c('0x1d')][_0x6f1c('0x1e')](_0xed1cca)['then'](function(_0x5475d6){logger[_0x6f1c('0x1f')](_0x6f1c('0x20'),_0x1a3460,_0xed1cca[_0x6f1c('0x1c')]);})['catch'](function(_0x202aa9){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,JSON['stringify'](_0x202aa9));})[_0x6f1c('0x22')](function(){logger[_0x6f1c('0x1f')](_0x6f1c('0x23'),_0x1a3460);_0x3f7b30['stop']();});}else{logger[_0x6f1c('0x1f')](_0x6f1c('0x24'),_0x1a3460);_0x3f7b30['stop']();}}else{var _0x20fd66=this;var _0x1f7ac2=apiai(_0x2d0f02[0x0],{'language':_0x2d0f02[0x1]||'en'});return _0x1f7ac2[_0x6f1c('0x25')](this[_0x6f1c('0x26')]['body'],{'sessionId':md5(this[_0x6f1c('0xc')]['id'])})[_0x6f1c('0x27')](function(_0x235773){_0x20fd66[_0x6f1c('0x1c')][_0x6f1c('0x28')]=_0x235773;_0xed1cca[_0x6f1c('0x1c')]=_0x235773['result'][_0x6f1c('0x29')][_0x6f1c('0x2a')];_0xed1cca[_0x6f1c('0x2b')]=_0x6f1c('0x28');_0xed1cca[_0x6f1c('0x2c')]=JSON['stringify'](_0x235773);return rpc[_0x2d5956+_0x6f1c('0x1d')][_0x6f1c('0x1e')](_0xed1cca)[_0x6f1c('0x27')](function(_0x1faa4a){logger[_0x6f1c('0x1f')](_0x6f1c('0x20'),_0x1a3460,_0xed1cca['body']);if(_0x235773['result'][_0x6f1c('0x2d')][_0x6f1c('0x2e')]){_0x3f7b30[_0x6f1c('0xf')]();}else{_0x3f7b30['stop']();}})[_0x6f1c('0x2f')](function(_0x1e861c){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,JSON['stringify'](_0x1e861c));_0x3f7b30[_0x6f1c('0xf')]();});})[_0x6f1c('0x2f')](function(_0x5c09ba){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,_0x5c09ba[_0x6f1c('0x26')]);_0x3f7b30['next']();});}}catch(_0x477e37){logger['error'](_0x6f1c('0x20'),_0x1a3460,JSON[_0x6f1c('0x30')](_0x477e37));_0x3f7b30[_0x6f1c('0x31')]();}};}; \ No newline at end of file +var _0xf69c=['InteractionId','created','isEmpty','body','create','then','[%s][DIALOGFLOW]\x20%s','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','stringify','metadata','error','lodash','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','account'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xf69c,0x151));var _0xcf69=function(_0x44f9c0,_0x391085){_0x44f9c0=_0x44f9c0-0x0;var _0x241aa7=_0xf69c[_0x44f9c0];return _0x241aa7;};'use strict';var _=require(_0xcf69('0x0'));var moment=require('moment');var apiai=require(_0xcf69('0x1'));var md5=require(_0xcf69('0x2'));var utils=require('./utils');var logger=require(_0xcf69('0x3'))('routing');var rpc={'chatMessage':require(_0xcf69('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcf69('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xcf69('0x6')),'whatsappMessage':require(_0xcf69('0x7'))};exports[_0xcf69('0x8')]=function(_0x35aa67,_0x3b7608){return function(_0x5f1e98){try{if(!_[_0xcf69('0x9')](this[_0xcf69('0xa')][_0xcf69('0xb')])){logger[_0xcf69('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x35aa67,_0xcf69('0xd'));return _0x5f1e98[_0xcf69('0xe')]();}var _0x914e95={'ContactId':this[_0xcf69('0xf')]['id'],'sentAt':moment()[_0xcf69('0x10')](_0xcf69('0x11')),'direction':'out'};if(this[_0xcf69('0x12')]==='sms'||this[_0xcf69('0x12')]===_0xcf69('0x13')){_0x914e95[_0xcf69('0x14')]=this[_0xcf69('0xa')][_0xcf69('0x14')];}var _0x2981ab=this[_0xcf69('0x12')];if(_0x2981ab===_0xcf69('0x15')){_0x914e95['ChatWebsiteId']=this['account']['id'];}else{_0x914e95[_['upperFirst'](_0x2981ab)+'AccountId']=this[_0xcf69('0x16')]['id'];}_0x914e95[_['upperFirst'](_0x2981ab)+_0xcf69('0x17')]=this[_0xcf69('0xa')]['id'];if(this[_0xcf69('0xa')][_0xcf69('0x18')]){var _0x5691ec=_0x3b7608[0x2];if(!_[_0xcf69('0x19')](_0x5691ec)){_0x914e95[_0xcf69('0x1a')]=utils['getMustacheRender'](_0x5691ec,this);return rpc[_0x2981ab+'Message'][_0xcf69('0x1b')](_0x914e95)[_0xcf69('0x1c')](function(_0x39306a){logger[_0xcf69('0xc')](_0xcf69('0x1d'),_0x35aa67,_0x914e95[_0xcf69('0x1a')]);})[_0xcf69('0x1e')](function(_0x210630){logger['error'](_0xcf69('0x1d'),_0x35aa67,JSON['stringify'](_0x210630));})[_0xcf69('0x1f')](function(){logger[_0xcf69('0xc')](_0xcf69('0x20'),_0x35aa67);_0x5f1e98[_0xcf69('0x21')]();});}else{logger[_0xcf69('0xc')](_0xcf69('0x22'),_0x35aa67);_0x5f1e98[_0xcf69('0x21')]();}}else{var _0xdc66a=this;var _0x3a159f=apiai(_0x3b7608[0x0],{'language':_0x3b7608[0x1]||'en'});return _0x3a159f[_0xcf69('0x23')](this[_0xcf69('0x24')][_0xcf69('0x1a')],{'sessionId':md5(this[_0xcf69('0xa')]['id'])})[_0xcf69('0x1c')](function(_0x3ec2fb){_0xdc66a['body'][_0xcf69('0x25')]=_0x3ec2fb;_0x914e95[_0xcf69('0x1a')]=_0x3ec2fb[_0xcf69('0x26')][_0xcf69('0x27')][_0xcf69('0x28')];_0x914e95[_0xcf69('0x29')]='dialogflow';_0x914e95['providerResponse']=JSON[_0xcf69('0x2a')](_0x3ec2fb);return rpc[_0x2981ab+'Message'][_0xcf69('0x1b')](_0x914e95)[_0xcf69('0x1c')](function(_0xddec25){logger[_0xcf69('0xc')](_0xcf69('0x1d'),_0x35aa67,_0x914e95[_0xcf69('0x1a')]);if(_0x3ec2fb[_0xcf69('0x26')][_0xcf69('0x2b')]['endConversation']){_0x5f1e98['next']();}else{_0x5f1e98[_0xcf69('0x21')]();}})[_0xcf69('0x1e')](function(_0x3f4e30){logger[_0xcf69('0x2c')]('[%s][DIALOGFLOW]\x20%s',_0x35aa67,JSON[_0xcf69('0x2a')](_0x3f4e30));_0x5f1e98[_0xcf69('0xe')]();});})[_0xcf69('0x1e')](function(_0x477511){logger[_0xcf69('0x2c')](_0xcf69('0x1d'),_0x35aa67,_0x477511[_0xcf69('0x24')]);_0x5f1e98[_0xcf69('0xe')]();});}}catch(_0xcdb8c5){logger[_0xcf69('0x2c')]('[%s][DIALOGFLOW]\x20%s',_0x35aa67,JSON[_0xcf69('0x2a')](_0xcdb8c5));_0x5f1e98['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 3b49f27..a32eec1 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 _0x0806=['finally','info','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','push','fulfillmentText','all','next','message','lodash','dialogflow','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','getMustacheRender'];(function(_0x3d485b,_0x394ae4){var _0x1167f7=function(_0x2fbbcd){while(--_0x2fbbcd){_0x3d485b['push'](_0x3d485b['shift']());}};_0x1167f7(++_0x394ae4);}(_0x0806,0x1ef));var _0x6080=function(_0x15f4c2,_0x4bcdc6){_0x15f4c2=_0x15f4c2-0x0;var _0x5d0513=_0x0806[_0x15f4c2];return _0x5d0513;};'use strict';var _=require(_0x6080('0x0'));var dialogflow=require(_0x6080('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x6080('0x2'));var logger=require(_0x6080('0x3'))(_0x6080('0x4'));var utils=require(_0x6080('0x5'));var rpc={'chatMessage':require(_0x6080('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6080('0x7')),'smsMessage':require(_0x6080('0x8')),'faxMessage':require(_0x6080('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2e07de,_0x35aaa2,_0xc4faac,_0x5174dc){return new Promise(function(_0x474769,_0x262dbe){var _0x113667=_[_0x6080('0xa')](_0xc4faac);_0x113667[_0x6080('0xb')]=_0x5174dc;return rpc[_0x35aaa2+_0x6080('0xc')][_0x6080('0xd')](_0x113667)[_0x6080('0xe')](function(){logger['info'](_0x6080('0xf'),_0x2e07de,_0x113667[_0x6080('0xb')]);_0x474769();})[_0x6080('0x10')](function(_0x1dd11b){logger[_0x6080('0x11')](_0x6080('0xf'),_0x2e07de,JSON[_0x6080('0x12')](_0x1dd11b));_0x262dbe(_0x1dd11b);});});}exports[_0x6080('0x13')]=function(_0x44e87b,_0x7d40a4){return function(_0xbd1891){try{if(!_['isNil'](this[_0x6080('0x14')][_0x6080('0x15')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x44e87b,_0x6080('0x16'));return _0xbd1891['next']();}var _0x4d51a8={'ContactId':this[_0x6080('0x17')]['id'],'sentAt':moment()[_0x6080('0x18')](_0x6080('0x19')),'direction':_0x6080('0x1a')};if(this[_0x6080('0x1b')]===_0x6080('0x1c')||this[_0x6080('0x1b')]==='whatsapp'){_0x4d51a8[_0x6080('0x1d')]=this[_0x6080('0x14')]['phone'];}var _0x27336b=this[_0x6080('0x1b')];if(_0x27336b===_0x6080('0x1e')){_0x4d51a8[_0x6080('0x1f')]=this[_0x6080('0x20')]['id'];}else{_0x4d51a8[_[_0x6080('0x21')](_0x27336b)+_0x6080('0x22')]=this[_0x6080('0x20')]['id'];}_0x4d51a8[_[_0x6080('0x21')](_0x27336b)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x6080('0x23')]){var _0x22ca20=_0x7d40a4[0x4];if(!_['isEmpty'](_0x22ca20)){_0x4d51a8['body']=utils[_0x6080('0x24')](_0x22ca20,this);return rpc[_0x27336b+'Message'][_0x6080('0xd')](_0x4d51a8)[_0x6080('0xe')](function(_0x40a686){logger['info'](_0x6080('0xf'),_0x44e87b,_0x4d51a8[_0x6080('0xb')]);})['catch'](function(_0x4ae174){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x44e87b,JSON[_0x6080('0x12')](_0x4ae174));})[_0x6080('0x25')](function(){logger[_0x6080('0x26')](_0x6080('0x27'),_0x44e87b);_0xbd1891['stop']();});}else{logger['info'](_0x6080('0x28'),_0x44e87b);_0xbd1891[_0x6080('0x29')]();}}else{var _0xa872ba=this;var _0x5d88ae=_0x7d40a4[0x2][_0x6080('0x2a')](/\\n/g,'\x0a');var _0x555d51={'credentials':{'private_key':_0x5d88ae,'client_email':_0x7d40a4[0x1]}};var _0x536d01=new dialogflow[(_0x6080('0x2b'))](_0x555d51);var _0x506937=_0x536d01[_0x6080('0x2c')](_0x7d40a4[0x0],md5(_0xa872ba[_0x6080('0x14')]['id']));var _0x5398f1={'session':_0x506937,'queryInput':{'text':{'text':_0xa872ba['message']['body'],'languageCode':_0x7d40a4[0x3]||'en'}}};return _0x536d01[_0x6080('0x2d')](_0x5398f1)['then'](function(_0x941eb4){if(_0x941eb4&&_0x941eb4[_0x6080('0x2e')]){_0xa872ba[_0x6080('0xb')][_0x6080('0x2f')]=_0x941eb4;var _0x48ed86=_0x941eb4[0x0];var _0x23ead8=_0x48ed86[_0x6080('0x30')][_0x6080('0x31')]&&_0x48ed86[_0x6080('0x30')][_0x6080('0x31')]['fields']?_0x48ed86['queryResult'][_0x6080('0x31')][_0x6080('0x32')][_0x6080('0x33')][_0x6080('0x34')]:![];_0xa872ba[_0x6080('0xb')][_0x6080('0x35')]=_0x48ed86[_0x6080('0x30')][_0x6080('0x36')];_0xa872ba[_0x6080('0xb')][_0x6080('0x37')]=_0x48ed86[_0x6080('0x30')][_0x6080('0x38')];_0xa872ba[_0x6080('0xb')][_0x6080('0x39')]=_0x48ed86[_0x6080('0x30')]['diagnosticInfo']&&_0x48ed86[_0x6080('0x30')][_0x6080('0x31')][_0x6080('0x32')]?_0x48ed86['queryResult'][_0x6080('0x31')][_0x6080('0x32')][_0x6080('0x33')][_0x6080('0x34')]:![];_0xa872ba['body'][_0x6080('0x3a')]=_0x48ed86[_0x6080('0x30')][_0x6080('0x3b')][_0x6080('0x3c')];_0xa872ba[_0x6080('0xb')][_0x6080('0x3d')]=_0x48ed86[_0x6080('0x30')][_0x6080('0x3b')][_0x6080('0x3e')];_0xa872ba[_0x6080('0xb')][_0x6080('0x3f')]=_0x48ed86[_0x6080('0x30')]['intent'][_0x6080('0x40')];_0xa872ba[_0x6080('0xb')][_0x6080('0x41')]=_0x48ed86[_0x6080('0x30')]['languageCode'];_0xa872ba[_0x6080('0xb')][_0x6080('0x42')]=_0x48ed86[_0x6080('0x30')][_0x6080('0x43')];_0xa872ba[_0x6080('0xb')][_0x6080('0x44')]=_0x48ed86[_0x6080('0x30')][_0x6080('0x45')];_0x4d51a8['providerName']=_0x6080('0x2f');_0x4d51a8[_0x6080('0x46')]=JSON[_0x6080('0x12')](_0x941eb4);var _0x5663a6=[];for(var _0x44bd86=0x0;_0x44bd86<_0x941eb4[_0x6080('0x2e')];_0x44bd86++){var _0x110151=_0x941eb4[_0x44bd86];if(_0x110151&&_0x110151[_0x6080('0x30')]&&_0x110151[_0x6080('0x30')]['fulfillmentText']){_0x5663a6[_0x6080('0x47')](createMessage(_0x44e87b,_0x27336b,_0x4d51a8,_0x110151[_0x6080('0x30')][_0x6080('0x48')]));}}return Promise[_0x6080('0x49')](_0x5663a6)[_0x6080('0xe')](function(){if(_0x23ead8){_0xbd1891[_0x6080('0x4a')]();}else{_0xbd1891[_0x6080('0x29')]();}})['catch'](function(_0x5c1800){logger['error'](_0x6080('0xf'),_0x44e87b,JSON['stringify'](_0x5c1800));_0xbd1891[_0x6080('0x4a')]();});}})[_0x6080('0x10')](function(_0x424849){logger[_0x6080('0x11')](_0x6080('0xf'),_0x44e87b,_0x424849[_0x6080('0x4b')]);_0xbd1891[_0x6080('0x4a')]();});}}catch(_0x1b0a60){logger[_0x6080('0x11')](_0x6080('0xf'),_0x44e87b,JSON['stringify'](_0x1b0a60));_0xbd1891[_0x6080('0x29')]();}};}; \ No newline at end of file +var _0x4764=['upperFirst','AccountId','InteractionId','created','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','name','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','next','lodash','dialogflow','md5','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account'];(function(_0x17391f,_0x309150){var _0x4a3661=function(_0x43320c){while(--_0x43320c){_0x17391f['push'](_0x17391f['shift']());}};_0x4a3661(++_0x309150);}(_0x4764,0x14f));var _0x4476=function(_0x42a7dc,_0x50c834){_0x42a7dc=_0x42a7dc-0x0;var _0x5dc996=_0x4764[_0x42a7dc];return _0x5dc996;};'use strict';var _=require(_0x4476('0x0'));var dialogflow=require(_0x4476('0x1'));var md5=require(_0x4476('0x2'));var moment=require(_0x4476('0x3'));var Promise=require('bluebird');var logger=require(_0x4476('0x4'))(_0x4476('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0x4476('0x6')),'openchannelMessage':require(_0x4476('0x7')),'mailMessage':require(_0x4476('0x8')),'smsMessage':require(_0x4476('0x9')),'faxMessage':require(_0x4476('0xa')),'whatsappMessage':require(_0x4476('0xb'))};function createMessage(_0x52c0cb,_0x29e4a8,_0x8a5130,_0x5c0002){return new Promise(function(_0xe73367,_0x12c3ce){var _0x3166eb=_[_0x4476('0xc')](_0x8a5130);_0x3166eb[_0x4476('0xd')]=_0x5c0002;return rpc[_0x29e4a8+_0x4476('0xe')]['create'](_0x3166eb)[_0x4476('0xf')](function(){logger[_0x4476('0x10')](_0x4476('0x11'),_0x52c0cb,_0x3166eb[_0x4476('0xd')]);_0xe73367();})[_0x4476('0x12')](function(_0x587a03){logger['error'](_0x4476('0x11'),_0x52c0cb,JSON[_0x4476('0x13')](_0x587a03));_0x12c3ce(_0x587a03);});});}exports[_0x4476('0x14')]=function(_0x353db2,_0x48db4c){return function(_0x608c98){try{if(!_[_0x4476('0x15')](this[_0x4476('0x16')]['UserId'])){logger[_0x4476('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x353db2,_0x4476('0x17'));return _0x608c98['next']();}var _0x2c3a83={'ContactId':this[_0x4476('0x18')]['id'],'sentAt':moment()[_0x4476('0x19')](_0x4476('0x1a')),'direction':_0x4476('0x1b')};if(this[_0x4476('0x1c')]===_0x4476('0x1d')||this[_0x4476('0x1c')]===_0x4476('0x1e')){_0x2c3a83[_0x4476('0x1f')]=this['interaction'][_0x4476('0x1f')];}var _0x15ea6f=this[_0x4476('0x1c')];if(_0x15ea6f===_0x4476('0x20')){_0x2c3a83[_0x4476('0x21')]=this[_0x4476('0x22')]['id'];}else{_0x2c3a83[_[_0x4476('0x23')](_0x15ea6f)+_0x4476('0x24')]=this[_0x4476('0x22')]['id'];}_0x2c3a83[_[_0x4476('0x23')](_0x15ea6f)+_0x4476('0x25')]=this['interaction']['id'];if(this[_0x4476('0x16')][_0x4476('0x26')]){var _0xa4bc81=_0x48db4c[0x4];if(!_['isEmpty'](_0xa4bc81)){_0x2c3a83[_0x4476('0xd')]=utils[_0x4476('0x27')](_0xa4bc81,this);return rpc[_0x15ea6f+_0x4476('0xe')]['create'](_0x2c3a83)[_0x4476('0xf')](function(_0x29df4e){logger[_0x4476('0x10')](_0x4476('0x11'),_0x353db2,_0x2c3a83[_0x4476('0xd')]);})['catch'](function(_0x5e537f){logger[_0x4476('0x28')]('[%s][DIALOGFLOWV2]\x20%s',_0x353db2,JSON[_0x4476('0x13')](_0x5e537f));})[_0x4476('0x29')](function(){logger[_0x4476('0x10')](_0x4476('0x2a'),_0x353db2);_0x608c98[_0x4476('0x2b')]();});}else{logger['info'](_0x4476('0x2c'),_0x353db2);_0x608c98[_0x4476('0x2b')]();}}else{var _0x9f7bec=this;var _0x11a880=_0x48db4c[0x2][_0x4476('0x2d')](/\\n/g,'\x0a');var _0x5c37ad={'credentials':{'private_key':_0x11a880,'client_email':_0x48db4c[0x1]}};var _0x386560=new dialogflow[(_0x4476('0x2e'))](_0x5c37ad);var _0x3a05d8=_0x386560[_0x4476('0x2f')](_0x48db4c[0x0],md5(_0x9f7bec[_0x4476('0x16')]['id']));var _0x57ed6f={'session':_0x3a05d8,'queryInput':{'text':{'text':_0x9f7bec[_0x4476('0x30')]['body'],'languageCode':_0x48db4c[0x3]||'en'}}};return _0x386560[_0x4476('0x31')](_0x57ed6f)[_0x4476('0xf')](function(_0x574d3c){if(_0x574d3c&&_0x574d3c[_0x4476('0x32')]){_0x9f7bec[_0x4476('0xd')][_0x4476('0x33')]=_0x574d3c;var _0x3999bc=_0x574d3c[0x0];var _0x4a70da=_0x3999bc['queryResult'][_0x4476('0x34')]&&_0x3999bc[_0x4476('0x35')]['diagnosticInfo']['fields']?_0x3999bc[_0x4476('0x35')]['diagnosticInfo']['fields'][_0x4476('0x36')][_0x4476('0x37')]:![];_0x9f7bec['body'][_0x4476('0x38')]=_0x3999bc[_0x4476('0x35')]['action'];_0x9f7bec[_0x4476('0xd')][_0x4476('0x39')]=_0x3999bc[_0x4476('0x35')][_0x4476('0x3a')];_0x9f7bec[_0x4476('0xd')][_0x4476('0x3b')]=_0x3999bc['queryResult'][_0x4476('0x34')]&&_0x3999bc[_0x4476('0x35')][_0x4476('0x34')][_0x4476('0x3c')]?_0x3999bc[_0x4476('0x35')]['diagnosticInfo']['fields']['end_conversation'][_0x4476('0x37')]:![];_0x9f7bec[_0x4476('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x3999bc[_0x4476('0x35')]['intent'][_0x4476('0x3d')];_0x9f7bec[_0x4476('0xd')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3999bc[_0x4476('0x35')]['intent'][_0x4476('0x3e')];_0x9f7bec[_0x4476('0xd')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3999bc[_0x4476('0x35')]['intent'][_0x4476('0x3f')];_0x9f7bec[_0x4476('0xd')][_0x4476('0x40')]=_0x3999bc[_0x4476('0x35')][_0x4476('0x41')];_0x9f7bec[_0x4476('0xd')][_0x4476('0x42')]=_0x3999bc[_0x4476('0x35')][_0x4476('0x43')];_0x9f7bec[_0x4476('0xd')][_0x4476('0x44')]=_0x3999bc[_0x4476('0x35')]['intentDetectionConfidence'];_0x2c3a83[_0x4476('0x45')]=_0x4476('0x33');_0x2c3a83[_0x4476('0x46')]=JSON[_0x4476('0x13')](_0x574d3c);var _0x4a01ca=[];for(var _0x4082fe=0x0;_0x4082fe<_0x574d3c[_0x4476('0x32')];_0x4082fe++){var _0x4ce5a6=_0x574d3c[_0x4082fe];if(_0x4ce5a6&&_0x4ce5a6[_0x4476('0x35')]&&_0x4ce5a6[_0x4476('0x35')][_0x4476('0x47')]){_0x4a01ca[_0x4476('0x48')](createMessage(_0x353db2,_0x15ea6f,_0x2c3a83,_0x4ce5a6[_0x4476('0x35')][_0x4476('0x47')]));}}return Promise['all'](_0x4a01ca)['then'](function(){if(_0x4a70da){_0x608c98[_0x4476('0x49')]();}else{_0x608c98[_0x4476('0x2b')]();}})['catch'](function(_0x169b29){logger[_0x4476('0x28')](_0x4476('0x11'),_0x353db2,JSON['stringify'](_0x169b29));_0x608c98[_0x4476('0x49')]();});}})[_0x4476('0x12')](function(_0x2481ee){logger['error'](_0x4476('0x11'),_0x353db2,_0x2481ee[_0x4476('0x30')]);_0x608c98[_0x4476('0x49')]();});}}catch(_0x457d56){logger['error'](_0x4476('0x11'),_0x353db2,JSON[_0x4476('0x13')](_0x457d56));_0x608c98['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 9723079..5eb3f37 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 _0xb665=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error'];(function(_0x1ac3dd,_0x2751b3){var _0x3c3ec2=function(_0x570ff3){while(--_0x570ff3){_0x1ac3dd['push'](_0x1ac3dd['shift']());}};_0x3c3ec2(++_0x2751b3);}(_0xb665,0x1a2));var _0x5b66=function(_0x126eaf,_0x525848){_0x126eaf=_0x126eaf-0x0;var _0x58fc38=_0xb665[_0x126eaf];return _0x58fc38;};'use strict';var schema=require(_0x5b66('0x0'));var _=require(_0x5b66('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5b66('0x2'));var gotoif=schema({'condition':{'type':_0x5b66('0x3'),'required':!![],'message':_0x5b66('0x4')},'priorityTrue':{'type':_0x5b66('0x5'),'message':_0x5b66('0x6')},'priorityFalse':{'type':_0x5b66('0x5'),'message':_0x5b66('0x7')}});exports['consequence']=function(_0x5d2af9,_0x35a71a){return function(_0xe7de55){try{var _0x1339cd={'condition':htmlToText['fromString'](utils[_0x5b66('0x8')](_0x35a71a[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x35a71a[0x1],'priorityFalse':_0x35a71a[0x2]};var _0x12dfd6=gotoif[_0x5b66('0x0')](_0x1339cd,{'typecast':!![]});if(_0x12dfd6[_0x5b66('0x9')]){logger['error'](_0x5b66('0xa'),_0x5d2af9,_[_0x5b66('0xb')](_0x12dfd6,'message')[_0x5b66('0xc')](',\x20'));_0xe7de55[_0x5b66('0xd')]();}else{try{var _0x1b9249=eval('('+_0x1339cd[_0x5b66('0xe')]+')');var _0x41cced=_0x1b9249?_0x1339cd[_0x5b66('0xf')]:_0x1339cd[_0x5b66('0x10')];logger['info'](_0x5b66('0x11'),_0x5d2af9,_0x1339cd[_0x5b66('0xe')],_0x1b9249,_0x41cced||_0x5b66('0x12'));if(_0x41cced){var _0x1980f4=_[_0x5b66('0x13')](_0xe7de55['rules'](),{'p':_0x41cced});if(_0x1980f4>=0x0){logger[_0x5b66('0x14')](_0x5b66('0x15'),_0x5d2af9,_0x41cced||'next',_0x1980f4);_0xe7de55['next'](_0x1980f4);}else{logger['info'](_0x5b66('0x16'),_0x5d2af9,_0x41cced||_0x5b66('0x12'));_0xe7de55['stop']();}}else{_0xe7de55[_0x5b66('0x12')]();}}catch(_0x566bbe){logger[_0x5b66('0x17')](_0x5b66('0x18'),_0x5d2af9,_0x566bbe['message']);_0xe7de55[_0x5b66('0xd')]();}}}catch(_0x4b7e54){logger['error']('[%s][GOTOIF]\x20%s',_0x5d2af9,JSON[_0x5b66('0x19')](_0x4b7e54));_0xe7de55[_0x5b66('0xd')]();}};}; \ No newline at end of file +var _0xf3ca=['join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%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','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','replace','length','[%s][GOTOIF]\x20%s','message'];(function(_0x1048e7,_0xd98d9a){var _0x25dc51=function(_0xe9976b){while(--_0xe9976b){_0x1048e7['push'](_0x1048e7['shift']());}};_0x25dc51(++_0xd98d9a);}(_0xf3ca,0xe5));var _0xaf3c=function(_0x1d4c74,_0x3657c6){_0x1d4c74=_0x1d4c74-0x0;var _0x477a02=_0xf3ca[_0x1d4c74];return _0x477a02;};'use strict';var schema=require(_0xaf3c('0x0'));var _=require('lodash');var htmlToText=require(_0xaf3c('0x1'));var utils=require('./utils');var logger=require(_0xaf3c('0x2'))(_0xaf3c('0x3'));var gotoif=schema({'condition':{'type':_0xaf3c('0x4'),'required':!![],'message':_0xaf3c('0x5')},'priorityTrue':{'type':_0xaf3c('0x6'),'message':_0xaf3c('0x7')},'priorityFalse':{'type':_0xaf3c('0x6'),'message':_0xaf3c('0x8')}});exports[_0xaf3c('0x9')]=function(_0x37941c,_0x29942f){return function(_0x1f7608){try{var _0x405179={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x29942f[0x0],this),{'wordwrap':![]})[_0xaf3c('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x29942f[0x1],'priorityFalse':_0x29942f[0x2]};var _0x27ec71=gotoif['validate'](_0x405179,{'typecast':!![]});if(_0x27ec71[_0xaf3c('0xb')]){logger['error'](_0xaf3c('0xc'),_0x37941c,_['map'](_0x27ec71,_0xaf3c('0xd'))[_0xaf3c('0xe')](',\x20'));_0x1f7608[_0xaf3c('0xf')]();}else{try{var _0x2c74c7=eval('('+_0x405179[_0xaf3c('0x10')]+')');var _0x106402=_0x2c74c7?_0x405179[_0xaf3c('0x11')]:_0x405179[_0xaf3c('0x12')];logger[_0xaf3c('0x13')](_0xaf3c('0x14'),_0x37941c,_0x405179[_0xaf3c('0x10')],_0x2c74c7,_0x106402||_0xaf3c('0x15'));if(_0x106402){var _0x39db43=_['findIndex'](_0x1f7608['rules'](),{'p':_0x106402});if(_0x39db43>=0x0){logger['info'](_0xaf3c('0x16'),_0x37941c,_0x106402||'next',_0x39db43);_0x1f7608[_0xaf3c('0x15')](_0x39db43);}else{logger[_0xaf3c('0x13')](_0xaf3c('0x17'),_0x37941c,_0x106402||_0xaf3c('0x15'));_0x1f7608[_0xaf3c('0xf')]();}}else{_0x1f7608[_0xaf3c('0x15')]();}}catch(_0x56ec30){logger[_0xaf3c('0x18')](_0xaf3c('0x19'),_0x37941c,_0x56ec30[_0xaf3c('0xd')]);_0x1f7608['stop']();}}}catch(_0x2a9ba7){logger[_0xaf3c('0x18')](_0xaf3c('0xc'),_0x37941c,JSON[_0xaf3c('0x1a')](_0x2a9ba7));_0x1f7608['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 f2c99d3..e9b7a41 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 _0xc61b=['../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash'];(function(_0x289ab4,_0x2cfccd){var _0x1b0014=function(_0x3c1c1b){while(--_0x3c1c1b){_0x289ab4['push'](_0x289ab4['shift']());}};_0x1b0014(++_0x2cfccd);}(_0xc61b,0x83));var _0xbc61=function(_0x58345c,_0x4e662d){_0x58345c=_0x58345c-0x0;var _0x24da93=_0xc61b[_0x58345c];return _0x24da93;};'use strict';var schema=require(_0xbc61('0x0'));var _=require(_0xbc61('0x1'));var logger=require(_0xbc61('0x2'))(_0xbc61('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xbc61('0x4')}});exports['consequence']=function(_0x3c9866,_0x11c46e){return function(_0xcb18a0){try{var _0x40190a={'priority':_0x11c46e[0x0]};var _0x16fe4f=gotop['validate'](_0x40190a,{'typecast':!![]});if(_0x16fe4f['length']){logger[_0xbc61('0x5')](_0xbc61('0x6'),_0x3c9866,_[_0xbc61('0x7')](_0x16fe4f,_0xbc61('0x8'))[_0xbc61('0x9')](',\x20'));_0xcb18a0[_0xbc61('0xa')]();}else{logger[_0xbc61('0xb')](_0xbc61('0xc'),_0x3c9866,_0x40190a[_0xbc61('0xd')]);if(_0x40190a[_0xbc61('0xd')]){var _0x4b10e4=_[_0xbc61('0xe')](_0xcb18a0['rules'](),{'p':_0x40190a[_0xbc61('0xd')]});if(_0x4b10e4>=0x0){logger[_0xbc61('0xb')](_0xbc61('0xf'),_0x3c9866,_0x40190a[_0xbc61('0xd')]||_0xbc61('0x10'),_0x4b10e4);_0xcb18a0[_0xbc61('0x10')](_0x4b10e4);}else{logger[_0xbc61('0xb')](_0xbc61('0x11'),_0x3c9866,_0x40190a[_0xbc61('0xd')]||_0xbc61('0x10'));_0xcb18a0[_0xbc61('0xa')]();}}else{_0xcb18a0[_0xbc61('0x10')]();}}}catch(_0xb1eb7a){logger[_0xbc61('0x5')]('[%s][GOTOP]\x20%s',_0x3c9866,JSON[_0xbc61('0x12')](_0xb1eb7a));_0xcb18a0['stop']();}};}; \ No newline at end of file +var _0x74f5=['consequence','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x74f5,0x1cf));var _0x574f=function(_0x1dbb97,_0xc2e02f){_0x1dbb97=_0x1dbb97-0x0;var _0x57612f=_0x74f5[_0x1dbb97];return _0x57612f;};'use strict';var schema=require(_0x574f('0x0'));var _=require(_0x574f('0x1'));var logger=require('../../../../config/logger')(_0x574f('0x2'));var gotop=schema({'priority':{'type':_0x574f('0x3'),'required':!![],'message':_0x574f('0x4')}});exports[_0x574f('0x5')]=function(_0x31bb7a,_0x637b0c){return function(_0x40f16c){try{var _0x55b31b={'priority':_0x637b0c[0x0]};var _0x2d8d47=gotop[_0x574f('0x0')](_0x55b31b,{'typecast':!![]});if(_0x2d8d47['length']){logger[_0x574f('0x6')](_0x574f('0x7'),_0x31bb7a,_[_0x574f('0x8')](_0x2d8d47,_0x574f('0x9'))[_0x574f('0xa')](',\x20'));_0x40f16c[_0x574f('0xb')]();}else{logger[_0x574f('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x31bb7a,_0x55b31b[_0x574f('0xd')]);if(_0x55b31b[_0x574f('0xd')]){var _0x392651=_[_0x574f('0xe')](_0x40f16c['rules'](),{'p':_0x55b31b[_0x574f('0xd')]});if(_0x392651>=0x0){logger[_0x574f('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x31bb7a,_0x55b31b[_0x574f('0xd')]||_0x574f('0xf'),_0x392651);_0x40f16c['next'](_0x392651);}else{logger[_0x574f('0xc')](_0x574f('0x10'),_0x31bb7a,_0x55b31b[_0x574f('0xd')]||_0x574f('0xf'));_0x40f16c['stop']();}}else{_0x40f16c[_0x574f('0xf')]();}}}catch(_0x173385){logger[_0x574f('0x6')](_0x574f('0x7'),_0x31bb7a,JSON[_0x574f('0x11')](_0x173385));_0x40f16c['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 c11a5f7..81f52ad 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 _0x315c=['channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x315c,0xd5));var _0xc315=function(_0x4c8e16,_0x43c474){_0x4c8e16=_0x4c8e16-0x0;var _0x188831=_0x315c[_0x4c8e16];return _0x188831;};'use strict';var _=require(_0xc315('0x0'));var utils=require(_0xc315('0x1'));var logger=require(_0xc315('0x2'))('routing');var rpc={'chatMessage':require(_0xc315('0x3')),'openchannelMessage':require(_0xc315('0x4')),'mailMessage':require(_0xc315('0x5')),'smsMessage':require(_0xc315('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc315('0x7'))};exports[_0xc315('0x8')]=function(_0x1c51d0,_0xa41732){return function(_0xcd6b96){try{var _0x14fb12={'body':utils[_0xc315('0x9')](_0xa41732[0x0],this),'ContactId':this[_0xc315('0xa')]['id']};if(this[_0xc315('0xb')]===_0xc315('0xc')){_0x14fb12[_0xc315('0xd')]=this[_0xc315('0xe')]['id'];}else{_0x14fb12[_[_0xc315('0xf')](this[_0xc315('0xb')])+_0xc315('0x10')]=this['account']['id'];}_0x14fb12[_[_0xc315('0xf')](this[_0xc315('0xb')])+_0xc315('0x11')]=this['interaction']['id'];if(rpc[this['channel']+_0xc315('0x12')]){return rpc[this[_0xc315('0xb')]+_0xc315('0x12')][_0xc315('0x13')](_0x14fb12)[_0xc315('0x14')](function(_0x3b78a5){logger['info'](_0xc315('0x15'),_0x1c51d0,_0x14fb12[_0xc315('0x16')]);_0xcd6b96[_0xc315('0x17')]();})[_0xc315('0x18')](function(_0x3dd9a9){logger[_0xc315('0x19')](_0xc315('0x15'),_0x1c51d0,JSON[_0xc315('0x1a')](_0x3dd9a9));_0xcd6b96[_0xc315('0x1b')]();});}}catch(_0x3e51c4){logger['error'](_0xc315('0x15'),_0x1c51d0,JSON['stringify'](_0x3e51c4));_0xcd6b96[_0xc315('0x1b')]();}};}; \ No newline at end of file +var _0x5829=['stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x3b1e89,_0x2304cb){var _0x53abb2=function(_0x5a648e){while(--_0x5a648e){_0x3b1e89['push'](_0x3b1e89['shift']());}};_0x53abb2(++_0x2304cb);}(_0x5829,0xf4));var _0x9582=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x5829[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x9582('0x0'));var utils=require(_0x9582('0x1'));var logger=require(_0x9582('0x2'))('routing');var rpc={'chatMessage':require(_0x9582('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9582('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9582('0x5')),'whatsappMessage':require(_0x9582('0x6'))};exports[_0x9582('0x7')]=function(_0x20ecf3,_0x2e11f4){return function(_0x369671){try{var _0xba229f={'body':utils[_0x9582('0x8')](_0x2e11f4[0x0],this),'ContactId':this[_0x9582('0x9')]['id']};if(this[_0x9582('0xa')]===_0x9582('0xb')){_0xba229f['ChatWebsiteId']=this[_0x9582('0xc')]['id'];}else{_0xba229f[_['upperFirst'](this[_0x9582('0xa')])+'AccountId']=this['account']['id'];}_0xba229f[_[_0x9582('0xd')](this['channel'])+_0x9582('0xe')]=this[_0x9582('0xf')]['id'];if(rpc[this[_0x9582('0xa')]+'Message']){return rpc[this['channel']+_0x9582('0x10')][_0x9582('0x11')](_0xba229f)[_0x9582('0x12')](function(_0x4141f0){logger[_0x9582('0x13')](_0x9582('0x14'),_0x20ecf3,_0xba229f[_0x9582('0x15')]);_0x369671[_0x9582('0x16')]();})[_0x9582('0x17')](function(_0x82e6b8){logger[_0x9582('0x18')](_0x9582('0x14'),_0x20ecf3,JSON[_0x9582('0x19')](_0x82e6b8));_0x369671[_0x9582('0x1a')]();});}}catch(_0x5ade93){logger[_0x9582('0x18')](_0x9582('0x14'),_0x20ecf3,JSON[_0x9582('0x19')](_0x5ade93));_0x369671[_0x9582('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 9965312..882b81c 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 _0xe0cc=['getMustacheRender','next','error','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xe0cc,0xab));var _0xce0c=function(_0x139c47,_0x48de2c){_0x139c47=_0x139c47-0x0;var _0x1e124b=_0xe0cc[_0x139c47];return _0x1e124b;};'use strict';var utils=require(_0xce0c('0x0'));var logger=require('../../../../config/logger')(_0xce0c('0x1'));exports[_0xce0c('0x2')]=function(_0x930498,_0x5cdea3){return function(_0x2e0507){try{logger[_0xce0c('0x3')](_0xce0c('0x4'),_0x930498,utils[_0xce0c('0x5')](_0x5cdea3[0x0],this));_0x2e0507[_0xce0c('0x6')]();}catch(_0x396228){logger[_0xce0c('0x7')]('[%s][NOOP]\x20%s',_0x930498,JSON['stringify'](_0x396228));_0x2e0507['stop']();}};}; \ No newline at end of file +var _0x7529=['[%s][NOOP]\x20%s','stop','../../../../config/logger','consequence','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7529,0xb6));var _0x9752=function(_0x5ed932,_0x3d0b68){_0x5ed932=_0x5ed932-0x0;var _0x21b719=_0x7529[_0x5ed932];return _0x21b719;};'use strict';var utils=require('./utils');var logger=require(_0x9752('0x0'))('routing');exports[_0x9752('0x1')]=function(_0x203192,_0x32d46c){return function(_0x5ef68d){try{logger[_0x9752('0x2')]('[%s][NOOP]\x20%s',_0x203192,utils['getMustacheRender'](_0x32d46c[0x0],this));_0x5ef68d['next']();}catch(_0x170308){logger['error'](_0x9752('0x3'),_0x203192,JSON['stringify'](_0x170308));_0x5ef68d[_0x9752('0x4')]();}};}; \ 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 d587a35..b01190c 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 _0xf6b1=['routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','catch','error','update\x20queue\x20report','timeout','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0xf6b1,0x110));var _0x1f6b=function(_0x11d94e,_0x4db966){_0x11d94e=_0x11d94e-0x0;var _0x3e40c3=_0xf6b1[_0x11d94e];return _0x3e40c3;};'use strict';var schema=require(_0x1f6b('0x0'));var _=require(_0x1f6b('0x1'));var util=require(_0x1f6b('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x1f6b('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1f6b('0x4'));var strategy=require('./strategy');config[_0x1f6b('0x5')]=_[_0x1f6b('0x6')](config[_0x1f6b('0x5')],{'host':_0x1f6b('0x7'),'port':0x18eb});var io=require(_0x1f6b('0x8'))(new Redis(config['redis']));var attributes=['id',_0x1f6b('0x9'),_0x1f6b('0xa'),_0x1f6b('0xb'),_0x1f6b('0xc'),'joinAt'];function emit(_0x2becd6,_0x348bc3,_0x522335){io['to'](_0x2becd6)['emit'](_0x348bc3,_0x522335);}function emitChannelQueueInteraction(_0x6a1409,_0x3f2507,_0x1d7347,_0x51bea1,_0x2e7de9,_0x320c3a,_0x231731,_0x35f89a){var _0x32ac04=_['clone'](_0x1d7347);_0x32ac04[_0x1f6b('0x9')]=_0x35f89a;_0x32ac04['queue']=_0x3f2507;_0x32ac04['account']=_0x51bea1;_0x32ac04['id']=_0x2e7de9;if(_0x320c3a){_0x231731[util[_0x1f6b('0xd')](_0x1f6b('0xe'),_0x6a1409)][_0x2e7de9]=_[_0x1f6b('0xf')](_0x32ac04,attributes);}else{delete _0x231731[util[_0x1f6b('0xd')](_0x1f6b('0xe'),_0x6a1409)][_0x2e7de9];}emit(util['format'](_0x1f6b('0x10'),_0x6a1409,_0x3f2507),util['format'](_0x1f6b('0x11'),_0x6a1409,_0x320c3a?_0x1f6b('0x12'):'remove'),_[_0x1f6b('0xf')](_0x32ac04,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x1f6b('0x13')),'chatQueueReport':require(_0x1f6b('0x14')),'smsQueueReport':require(_0x1f6b('0x15')),'faxQueueReport':require(_0x1f6b('0x16')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x1f6b('0x17')},'timeout':{'type':_0x1f6b('0x18'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x27c435,_0x15b3b2,_0x37984d,_0x2d4515){if(_0x27c435&&_0x15b3b2&&_0x37984d){_0x15b3b2[_0x1f6b('0x19')]+=0x1;var _0x3f8467={'uniqueid':_0x27c435,'from':_0x37984d[_0x1f6b('0x1a')]?_0x37984d[_0x1f6b('0x1a')][_0x1f6b('0xc')]:'','joinAt':moment()[_0x1f6b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37984d['contact']?_0x37984d[_0x1f6b('0x1b')]['id']:null,'ListId':_0x37984d['list']?_0x37984d[_0x1f6b('0x1c')]['id']:null};_0x3f8467[_[_0x1f6b('0x1d')](_0x37984d[_0x1f6b('0x1e')])+_0x1f6b('0x1f')]=_0x15b3b2['id']||null;_0x3f8467[_[_0x1f6b('0x1d')](_0x37984d['channel'])+_0x1f6b('0x20')]=_0x37984d[_0x1f6b('0x21')]?_0x37984d['interaction']['id']:null;_0x3f8467[_[_0x1f6b('0x1d')](_0x37984d[_0x1f6b('0x1e')])+'MessageId']=_0x37984d[_0x1f6b('0x22')]?_0x37984d['message']['id']:null;_0x3f8467[_[_0x1f6b('0x1d')](_0x37984d[_0x1f6b('0x1e')])+(_0x37984d[_0x1f6b('0x1e')]!=='chat'?_0x1f6b('0x23'):_0x1f6b('0x24'))]=_0x37984d[_0x1f6b('0xa')]?_0x37984d['account']['id']:null;logger[_0x1f6b('0x25')](util['format'](_0x1f6b('0x26'),_0x27c435,_0x15b3b2['name']));emitChannelQueueInteraction(_0x37984d[_0x1f6b('0x1e')],_0x15b3b2[_0x1f6b('0x27')],_0x3f8467,_0x37984d[_0x1f6b('0xa')][_0x1f6b('0x27')],_0x37984d[_0x1f6b('0x22')]['id'],!![],_0x2d4515,_0x15b3b2['id']);if(rpc[_0x37984d[_0x1f6b('0x1e')]+_0x1f6b('0x28')]){return rpc[_0x37984d['channel']+_0x1f6b('0x28')][_0x1f6b('0x29')](_0x3f8467)['catch'](function(_0x11605f){logger['error'](_0x1f6b('0x2a'));});}}}function stopRouting(_0x112cc5,_0x3026ae,_0x34a9ab,_0x4d44e3){if(_0x112cc5&&_0x3026ae){_0x3026ae[_0x1f6b('0x19')]-=0x1;var _0x290cf2={'leaveAt':moment()[_0x1f6b('0xd')](_0x1f6b('0x2b')),'acceptAt':moment()['format'](_0x1f6b('0x2b')),'reason':_0x1f6b('0x2c')};logger['info'](util[_0x1f6b('0xd')](_0x1f6b('0x2d'),_0x112cc5,_0x3026ae[_0x1f6b('0x27')]));emitChannelQueueInteraction(_0x34a9ab[_0x1f6b('0x1e')],_0x3026ae['name'],_0x34a9ab[_0x1f6b('0x1a')],_0x34a9ab[_0x1f6b('0xa')][_0x1f6b('0x27')],_0x34a9ab[_0x1f6b('0x22')]['id'],![],_0x4d44e3,_0x3026ae['id']);if(rpc[_0x34a9ab[_0x1f6b('0x1e')]+_0x1f6b('0x28')]){return rpc[_0x34a9ab['channel']+'QueueReport']['update'](_0x112cc5,_0x290cf2)[_0x1f6b('0x2e')](function(_0x2730b9){logger[_0x1f6b('0x2f')](_0x1f6b('0x30'));});}}}function endRouting(_0x99034a,_0x50e3cd,_0x3c3514,_0xb1b60d){if(_0x99034a&&_0x50e3cd){_0x50e3cd[_0x1f6b('0x19')]-=0x1;var _0x58a13b={'leaveAt':moment()['format'](_0x1f6b('0x2b')),'exitAt':moment()[_0x1f6b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1f6b('0x31')};logger[_0x1f6b('0x25')](util[_0x1f6b('0xd')]('[%s][END:QUEUE][NAME:%s]',_0x99034a,_0x50e3cd[_0x1f6b('0x27')]));emitChannelQueueInteraction(_0x3c3514[_0x1f6b('0x1e')],_0x50e3cd[_0x1f6b('0x27')],_0x3c3514[_0x1f6b('0x1a')],_0x3c3514[_0x1f6b('0xa')][_0x1f6b('0x27')],_0x3c3514['message']['id'],![],_0xb1b60d);if(rpc[_0x3c3514[_0x1f6b('0x1e')]+'QueueReport']){return rpc[_0x3c3514['channel']+_0x1f6b('0x28')][_0x1f6b('0x32')](_0x99034a,_0x58a13b)[_0x1f6b('0x2e')](function(_0x40ef51){logger[_0x1f6b('0x2f')](_0x1f6b('0x30'));});}}}function handleFindQueue(_0x2609ac){return function(_0x424318){return _0x424318['name'][_0x1f6b('0x33')]()===_0x2609ac[_0x1f6b('0x33')]();};}exports[_0x1f6b('0x34')]=function(_0x2b7766,_0x247c60,_0x4621a4,_0x1f9b24){return function(_0x39c399){try{var _0x378802={'name':_0x247c60[0x0],'timeout':_0x247c60[0x1]};var _0x134ee4=queue[_0x1f6b('0x0')](_0x378802,{'typecast':!![]});if(_0x134ee4[_0x1f6b('0x35')]){logger[_0x1f6b('0x2f')](_0x1f6b('0x36'),_0x2b7766,_[_0x1f6b('0x37')](_0x134ee4,_0x1f6b('0x22'))['join'](',\x20'));_0x39c399[_0x1f6b('0x38')]();}else{var _0x362ae7=_[_0x1f6b('0x39')](_0x4621a4[_0x1f9b24['channel']+_0x1f6b('0x3a')],handleFindQueue(_0x378802['name']));if(_0x362ae7){startRouting(_0x2b7766,_0x362ae7,_0x1f9b24,_0x4621a4);var _0x188aeb=(_0x362ae7[_0x1f6b('0x31')]||0xa)*0x3e8;var _0x4d4146=(_0x378802[_0x1f6b('0x31')]||0x14)*0x3e8;var _0x4dad11,_0xa16ed3;if(_0x188aeb>_0x4d4146){_0x4d4146=_0x188aeb;}var _0xee9bef=seqqueue[_0x1f6b('0x3b')](_0x188aeb);_0xee9bef['id']=_0x2b7766;_0xee9bef['atimeout']=_0x188aeb;_0xee9bef['qtimeout']=_0x4d4146;_0xee9bef[_0x1f6b('0x1e')]=_0x1f9b24[_0x1f6b('0x1e')];_0x4621a4[_0x1f6b('0x3c')][_0x2b7766]['on'](_0x1f6b('0x3d'),function(){logger[_0x1f6b('0x25')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2b7766);stopRouting(_0x2b7766,_0x362ae7,_0x1f9b24,_0x4621a4);clearTimeout(_0x4dad11);_0x4dad11=undefined;_0xee9bef['close'](!![]);if(_0x4621a4[_0x1f6b('0x3c')][_0x2b7766]){delete _0x4621a4[_0x1f6b('0x3c')][_0x2b7766];}_0x39c399[_0x1f6b('0x38')]();});_0x4621a4[_0x1f6b('0x3c')][_0x2b7766]['on'](_0x1f6b('0x3e'),function(){if(_0x4621a4[_0x1f6b('0x3c')][_0x2b7766]){delete _0x4621a4[_0x1f6b('0x3c')][_0x2b7766];}});_0x4dad11=setTimeout(function(){logger[_0x1f6b('0x25')](_0x1f6b('0x3f'),_0x2b7766);endRouting(_0x2b7766,_0x362ae7,_0x1f9b24,_0x4621a4);clearTimeout(_0x4dad11);_0xee9bef['close'](!![]);_0x39c399[_0x1f6b('0x40')]();},_0x4d4146);switch(_0x362ae7['strategy']){case'rrmemory':strategy[_0x1f6b('0x41')](_0xee9bef,_0x362ae7,_0x4621a4,_0x1f9b24);break;default:strategy['beepall'](_0xee9bef,_0x362ae7,_0x4621a4,_0x1f9b24);}}else{logger[_0x1f6b('0x2f')](_0x1f6b('0x42'),_0x2b7766,_0x378802[_0x1f6b('0x27')]);_0x39c399[_0x1f6b('0x38')]();}}}catch(_0x2ca9be){console[_0x1f6b('0x43')](_0x2ca9be);logger['error'](_0x1f6b('0x36'),_0x2b7766,_0x2ca9be[_0x1f6b('0x44')]);_0x39c399[_0x1f6b('0x38')]();}};}; \ No newline at end of file +var _0x40ed=['body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','join','find','createQueue','atimeout','end','close','rules','stop','next','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','emit','%sQueuesWaitingInteractions','%s:queue:%s','format','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting'];(function(_0x19a5c9,_0x5c2e5c){var _0x5108b3=function(_0x1b2044){while(--_0x1b2044){_0x19a5c9['push'](_0x19a5c9['shift']());}};_0x5108b3(++_0x5c2e5c);}(_0x40ed,0xb3));var _0xd40e=function(_0x2b3b31,_0x475057){_0x2b3b31=_0x2b3b31-0x0;var _0x3c516b=_0x40ed[_0x2b3b31];return _0x3c516b;};'use strict';var schema=require(_0xd40e('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0xd40e('0x1'));var moment=require('moment');var Redis=require(_0xd40e('0x2'));var config=require(_0xd40e('0x3'));var logger=require(_0xd40e('0x4'))(_0xd40e('0x5'));var strategy=require(_0xd40e('0x6'));config[_0xd40e('0x7')]=_[_0xd40e('0x8')](config[_0xd40e('0x7')],{'host':_0xd40e('0x9'),'port':0x18eb});var io=require(_0xd40e('0xa'))(new Redis(config[_0xd40e('0x7')]));var attributes=['id',_0xd40e('0xb'),_0xd40e('0xc'),_0xd40e('0xd'),'from','joinAt'];function emit(_0x335226,_0x12589e,_0x5cbe3e){io['to'](_0x335226)[_0xd40e('0xe')](_0x12589e,_0x5cbe3e);}function emitChannelQueueInteraction(_0x4caaa3,_0x3c5caf,_0x9e7db1,_0x53e5c2,_0x3c15cf,_0x404de1,_0x35b3bf,_0x55d3a7){var _0x571e47=_['clone'](_0x9e7db1);_0x571e47[_0xd40e('0xb')]=_0x55d3a7;_0x571e47[_0xd40e('0xd')]=_0x3c5caf;_0x571e47['account']=_0x53e5c2;_0x571e47['id']=_0x3c15cf;if(_0x404de1){_0x35b3bf[util['format'](_0xd40e('0xf'),_0x4caaa3)][_0x3c15cf]=_['pick'](_0x571e47,attributes);}else{delete _0x35b3bf[util['format'](_0xd40e('0xf'),_0x4caaa3)][_0x3c15cf];}emit(util['format'](_0xd40e('0x10'),_0x4caaa3,_0x3c5caf),util[_0xd40e('0x11')]('%s_queue_waiting_interaction:%s',_0x4caaa3,_0x404de1?'save':_0xd40e('0x12')),_[_0xd40e('0x13')](_0x571e47,attributes));}var rpc={'openchannelQueueReport':require(_0xd40e('0x14')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xd40e('0x15')),'smsQueueReport':require(_0xd40e('0x16')),'faxQueueReport':require(_0xd40e('0x17')),'whatsappQueueReport':require(_0xd40e('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xd40e('0x19')},'timeout':{'type':_0xd40e('0x1a'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24f92b,_0x46d9f2,_0xcfe8c4,_0x1fc5d3){if(_0x24f92b&&_0x46d9f2&&_0xcfe8c4){_0x46d9f2[_0xd40e('0x1b')]+=0x1;var _0x36dc14={'uniqueid':_0x24f92b,'from':_0xcfe8c4[_0xd40e('0x1c')]?_0xcfe8c4[_0xd40e('0x1c')][_0xd40e('0x1d')]:'','joinAt':moment()[_0xd40e('0x11')](_0xd40e('0x1e')),'ContactId':_0xcfe8c4[_0xd40e('0x1f')]?_0xcfe8c4[_0xd40e('0x1f')]['id']:null,'ListId':_0xcfe8c4[_0xd40e('0x20')]?_0xcfe8c4[_0xd40e('0x20')]['id']:null};_0x36dc14[_[_0xd40e('0x21')](_0xcfe8c4['channel'])+_0xd40e('0x22')]=_0x46d9f2['id']||null;_0x36dc14[_[_0xd40e('0x21')](_0xcfe8c4[_0xd40e('0x23')])+_0xd40e('0x24')]=_0xcfe8c4['interaction']?_0xcfe8c4[_0xd40e('0x25')]['id']:null;_0x36dc14[_[_0xd40e('0x21')](_0xcfe8c4[_0xd40e('0x23')])+_0xd40e('0x26')]=_0xcfe8c4[_0xd40e('0x27')]?_0xcfe8c4[_0xd40e('0x27')]['id']:null;_0x36dc14[_[_0xd40e('0x21')](_0xcfe8c4[_0xd40e('0x23')])+(_0xcfe8c4[_0xd40e('0x23')]!==_0xd40e('0x28')?_0xd40e('0x29'):'WebsiteId')]=_0xcfe8c4[_0xd40e('0xc')]?_0xcfe8c4[_0xd40e('0xc')]['id']:null;logger[_0xd40e('0x2a')](util[_0xd40e('0x11')](_0xd40e('0x2b'),_0x24f92b,_0x46d9f2[_0xd40e('0x2c')]));emitChannelQueueInteraction(_0xcfe8c4[_0xd40e('0x23')],_0x46d9f2['name'],_0x36dc14,_0xcfe8c4[_0xd40e('0xc')]['name'],_0xcfe8c4[_0xd40e('0x27')]['id'],!![],_0x1fc5d3,_0x46d9f2['id']);if(rpc[_0xcfe8c4['channel']+'QueueReport']){return rpc[_0xcfe8c4[_0xd40e('0x23')]+_0xd40e('0x2d')]['create'](_0x36dc14)[_0xd40e('0x2e')](function(_0x594963){logger[_0xd40e('0x2f')](_0xd40e('0x30'));});}}}function stopRouting(_0xe6826c,_0x7896e,_0x5275bb,_0x4b8fba){if(_0xe6826c&&_0x7896e){_0x7896e[_0xd40e('0x1b')]-=0x1;var _0x7bb7={'leaveAt':moment()[_0xd40e('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xd40e('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd40e('0x31')};logger['info'](util[_0xd40e('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0xe6826c,_0x7896e['name']));emitChannelQueueInteraction(_0x5275bb[_0xd40e('0x23')],_0x7896e[_0xd40e('0x2c')],_0x5275bb['body'],_0x5275bb[_0xd40e('0xc')][_0xd40e('0x2c')],_0x5275bb[_0xd40e('0x27')]['id'],![],_0x4b8fba,_0x7896e['id']);if(rpc[_0x5275bb[_0xd40e('0x23')]+_0xd40e('0x2d')]){return rpc[_0x5275bb['channel']+'QueueReport'][_0xd40e('0x32')](_0xe6826c,_0x7bb7)[_0xd40e('0x2e')](function(_0x5066dc){logger[_0xd40e('0x2f')](_0xd40e('0x33'));});}}}function endRouting(_0x5e0c1f,_0x5171ad,_0x510a4a,_0x45f90d){if(_0x5e0c1f&&_0x5171ad){_0x5171ad[_0xd40e('0x1b')]-=0x1;var _0x400cd1={'leaveAt':moment()['format'](_0xd40e('0x1e')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd40e('0x34')};logger['info'](util['format'](_0xd40e('0x35'),_0x5e0c1f,_0x5171ad[_0xd40e('0x2c')]));emitChannelQueueInteraction(_0x510a4a['channel'],_0x5171ad[_0xd40e('0x2c')],_0x510a4a[_0xd40e('0x1c')],_0x510a4a['account'][_0xd40e('0x2c')],_0x510a4a['message']['id'],![],_0x45f90d);if(rpc[_0x510a4a[_0xd40e('0x23')]+'QueueReport']){return rpc[_0x510a4a[_0xd40e('0x23')]+_0xd40e('0x2d')][_0xd40e('0x32')](_0x5e0c1f,_0x400cd1)['catch'](function(_0x50c344){logger[_0xd40e('0x2f')](_0xd40e('0x33'));});}}}function handleFindQueue(_0x552e2b){return function(_0x53cbe8){return _0x53cbe8[_0xd40e('0x2c')][_0xd40e('0x36')]()===_0x552e2b['toLowerCase']();};}exports[_0xd40e('0x37')]=function(_0xdaf3b5,_0xe27825,_0x102ecc,_0x3427ff){return function(_0x4e0c8b){try{var _0x315b11={'name':_0xe27825[0x0],'timeout':_0xe27825[0x1]};var _0x431694=queue['validate'](_0x315b11,{'typecast':!![]});if(_0x431694['length']){logger['error']('[%s][QUEUE]\x20%s',_0xdaf3b5,_['map'](_0x431694,'message')[_0xd40e('0x38')](',\x20'));_0x4e0c8b['stop']();}else{var _0x156725=_[_0xd40e('0x39')](_0x102ecc[_0x3427ff[_0xd40e('0x23')]+'Queues'],handleFindQueue(_0x315b11[_0xd40e('0x2c')]));if(_0x156725){startRouting(_0xdaf3b5,_0x156725,_0x3427ff,_0x102ecc);var _0x81ddea=(_0x156725['timeout']||0xa)*0x3e8;var _0x12b48c=(_0x315b11['timeout']||0x14)*0x3e8;var _0x3adec5,_0x379504;if(_0x81ddea>_0x12b48c){_0x12b48c=_0x81ddea;}var _0x2268d7=seqqueue[_0xd40e('0x3a')](_0x81ddea);_0x2268d7['id']=_0xdaf3b5;_0x2268d7[_0xd40e('0x3b')]=_0x81ddea;_0x2268d7['qtimeout']=_0x12b48c;_0x2268d7['channel']=_0x3427ff['channel'];_0x102ecc['rules'][_0xdaf3b5]['on'](_0xd40e('0x3c'),function(){logger[_0xd40e('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xdaf3b5);stopRouting(_0xdaf3b5,_0x156725,_0x3427ff,_0x102ecc);clearTimeout(_0x3adec5);_0x3adec5=undefined;_0x2268d7[_0xd40e('0x3d')](!![]);if(_0x102ecc['rules'][_0xdaf3b5]){delete _0x102ecc[_0xd40e('0x3e')][_0xdaf3b5];}_0x4e0c8b[_0xd40e('0x3f')]();});_0x102ecc[_0xd40e('0x3e')][_0xdaf3b5]['on']('complete',function(){if(_0x102ecc[_0xd40e('0x3e')][_0xdaf3b5]){delete _0x102ecc[_0xd40e('0x3e')][_0xdaf3b5];}});_0x3adec5=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0xdaf3b5);endRouting(_0xdaf3b5,_0x156725,_0x3427ff,_0x102ecc);clearTimeout(_0x3adec5);_0x2268d7[_0xd40e('0x3d')](!![]);_0x4e0c8b[_0xd40e('0x40')]();},_0x12b48c);switch(_0x156725['strategy']){case'rrmemory':strategy['rrmemory'](_0x2268d7,_0x156725,_0x102ecc,_0x3427ff);break;default:strategy[_0xd40e('0x41')](_0x2268d7,_0x156725,_0x102ecc,_0x3427ff);}}else{logger[_0xd40e('0x2f')](_0xd40e('0x42'),_0xdaf3b5,_0x315b11[_0xd40e('0x2c')]);_0x4e0c8b['stop']();}}}catch(_0x10632c){console[_0xd40e('0x43')](_0x10632c);logger[_0xd40e('0x2f')](_0xd40e('0x44'),_0xdaf3b5,_0x10632c['stack']);_0x4e0c8b['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 3db2481..53ad9aa 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 _0xbaad=['forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0xfb7aba,_0x209028){var _0x1e8298=function(_0x2c2df1){while(--_0x2c2df1){_0xfb7aba['push'](_0xfb7aba['shift']());}};_0x1e8298(++_0x209028);}(_0xbaad,0x1c7));var _0xdbaa=function(_0xd83816,_0x4d4de9){_0xd83816=_0xd83816-0x0;var _0x3163b7=_0xbaad[_0xd83816];return _0x3163b7;};'use strict';var _=require(_0xdbaa('0x0'));var uuid=require(_0xdbaa('0x1'));var util=require(_0xdbaa('0x2'));var logger=require(_0xdbaa('0x3'))(_0xdbaa('0x4'));var Agent=function(_0x325284,_0x53f601,_0x17844a,_0x61ec45){this[_0xdbaa('0x5')]=uuid['v4']();this[_0xdbaa('0x6')]=_0x325284;this['agent']=_0x53f601;this[_0xdbaa('0x7')]=_0x17844a;this[_0xdbaa('0x4')]=_0x61ec45;this[_0xdbaa('0x6')][_0xdbaa('0x8')](this[_0xdbaa('0x9')][_0xdbaa('0xa')](this),this[_0xdbaa('0xb')][_0xdbaa('0xa')](this));this[_0xdbaa('0x6')]['on']('timeout',this[_0xdbaa('0xb')]['bind'](this));this['squeue']['on'](_0xdbaa('0xc'),this[_0xdbaa('0xd')][_0xdbaa('0xa')](this));};Agent['prototype'][_0xdbaa('0x8')]=function(){this[_0xdbaa('0x6')][_0xdbaa('0x8')](this[_0xdbaa('0x9')][_0xdbaa('0xa')](this),this['handleTimeout'][_0xdbaa('0xa')](this));};Agent[_0xdbaa('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xdbaa('0xe')]['handleRun']=function(){logger['debug'](_0xdbaa('0xf'),this[_0xdbaa('0x6')]['id'],this[_0xdbaa('0x10')]['id']);if(_[_0xdbaa('0x11')](this[_0xdbaa('0x7')][_0xdbaa('0x12')][this['agent']['id']])){logger[_0xdbaa('0x13')](_0xdbaa('0x14'),this[_0xdbaa('0x6')]['id'],this[_0xdbaa('0x10')]['id']);setTimeout(this[_0xdbaa('0x8')][_0xdbaa('0xa')](this),0x3e8);}else{if(this[_0xdbaa('0x4')][_0xdbaa('0x15')]||util[_0xdbaa('0x16')](this[_0xdbaa('0x6')]['id'],this['realtime'][_0xdbaa('0x12')][this[_0xdbaa('0x10')]['id']],this[_0xdbaa('0x6')][_0xdbaa('0x17')],![])){this[_0xdbaa('0x7')][_0xdbaa('0x12')][this[_0xdbaa('0x10')]['id']][_0xdbaa('0x18')]=!![];this['realtime']['agents'][this['agent']['id']][_0xdbaa('0x19')]=undefined;util[_0xdbaa('0x1a')](this['notificationId'],this[_0xdbaa('0x6')]['id'],this[_0xdbaa('0x7')]['agents'][this[_0xdbaa('0x10')]['id']],null,this[_0xdbaa('0x4')]);util[_0xdbaa('0x1b')](this['squeue']['id'],this[_0xdbaa('0x7')]['agents'][this[_0xdbaa('0x10')]['id']],_0xdbaa('0x1c')+(this[_0xdbaa('0x4')]['forcedOwnership']?_0xdbaa('0x1d'):''));}else{logger[_0xdbaa('0x13')](_0xdbaa('0x1e'),this['squeue']['id'],this[_0xdbaa('0x10')]['id']);setTimeout(this[_0xdbaa('0x8')][_0xdbaa('0xa')](this),0x3e8);}}};Agent[_0xdbaa('0xe')][_0xdbaa('0xb')]=function(_0xb89267){if(_[_0xdbaa('0x11')](this[_0xdbaa('0x7')]['agents'][this[_0xdbaa('0x10')]['id']])){return logger[_0xdbaa('0x13')](_0xdbaa('0x14'),this[_0xdbaa('0x6')]['id'],this['agent']['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xdbaa('0x6')]['id'],this[_0xdbaa('0x10')]['id']);util['hideNotification'](this[_0xdbaa('0x5')],this[_0xdbaa('0x6')]['id'],this[_0xdbaa('0x7')][_0xdbaa('0x12')][this[_0xdbaa('0x10')]['id']],null,this['routing']);this[_0xdbaa('0x7')][_0xdbaa('0x12')][this[_0xdbaa('0x10')]['id']]['busy']=![];this[_0xdbaa('0x7')][_0xdbaa('0x12')][this[_0xdbaa('0x10')]['id']][_0xdbaa('0x19')]=undefined;util['writeLog'](this[_0xdbaa('0x6')]['id'],this['realtime'][_0xdbaa('0x12')][this[_0xdbaa('0x10')]['id']],_0xb89267?_0xdbaa('0x1f'):_0xdbaa('0x20'));}if(!_0xb89267){setTimeout(this['push'][_0xdbaa('0xa')](this),0x3e8);}};function agent(_0x350eb1,_0x8dd93f,_0x62c06f,_0x4fdf2a){return new Agent(_0x350eb1,_0x8dd93f,_0x62c06f,_0x4fdf2a);}module[_0xdbaa('0x21')]=agent; \ No newline at end of file +var _0x4be5=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','debug','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','showNotification','RINGING'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4be5,0x106));var _0x54be=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x4be5[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x54be('0x0'));var uuid=require(_0x54be('0x1'));var util=require(_0x54be('0x2'));var logger=require(_0x54be('0x3'))(_0x54be('0x4'));var Agent=function(_0x549b5,_0x23a03b,_0x5db5a7,_0x1e6182){this[_0x54be('0x5')]=uuid['v4']();this[_0x54be('0x6')]=_0x549b5;this[_0x54be('0x7')]=_0x23a03b;this['realtime']=_0x5db5a7;this[_0x54be('0x4')]=_0x1e6182;this[_0x54be('0x6')][_0x54be('0x8')](this['handleRun'][_0x54be('0x9')](this),this[_0x54be('0xa')][_0x54be('0x9')](this));this['squeue']['on'](_0x54be('0xb'),this[_0x54be('0xa')][_0x54be('0x9')](this));this[_0x54be('0x6')]['on'](_0x54be('0xc'),this[_0x54be('0xd')]['bind'](this));};Agent[_0x54be('0xe')][_0x54be('0x8')]=function(){this['squeue'][_0x54be('0x8')](this[_0x54be('0xf')][_0x54be('0x9')](this),this[_0x54be('0xa')][_0x54be('0x9')](this));};Agent['prototype'][_0x54be('0xd')]=function(){this[_0x54be('0xa')](!![]);};Agent[_0x54be('0xe')][_0x54be('0xf')]=function(){logger[_0x54be('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x54be('0x6')]['id'],this['agent']['id']);if(_['isNil'](this[_0x54be('0x11')][_0x54be('0x12')][this[_0x54be('0x7')]['id']])){logger['debug'](_0x54be('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x54be('0x8')][_0x54be('0x9')](this),0x3e8);}else{if(this[_0x54be('0x4')][_0x54be('0x14')]||util[_0x54be('0x15')](this[_0x54be('0x6')]['id'],this[_0x54be('0x11')][_0x54be('0x12')][this[_0x54be('0x7')]['id']],this[_0x54be('0x6')][_0x54be('0x16')],![])){this['realtime'][_0x54be('0x12')][this[_0x54be('0x7')]['id']][_0x54be('0x17')]=!![];this[_0x54be('0x11')][_0x54be('0x12')][this[_0x54be('0x7')]['id']]['busyQueue']=undefined;util[_0x54be('0x18')](this[_0x54be('0x5')],this[_0x54be('0x6')]['id'],this[_0x54be('0x11')][_0x54be('0x12')][this[_0x54be('0x7')]['id']],null,this['routing']);util['writeLog'](this[_0x54be('0x6')]['id'],this[_0x54be('0x11')][_0x54be('0x12')][this[_0x54be('0x7')]['id']],_0x54be('0x19')+(this[_0x54be('0x4')][_0x54be('0x14')]?':FORCED':''));}else{logger['debug'](_0x54be('0x1a'),this[_0x54be('0x6')]['id'],this[_0x54be('0x7')]['id']);setTimeout(this[_0x54be('0x8')][_0x54be('0x9')](this),0x3e8);}}};Agent['prototype'][_0x54be('0xa')]=function(_0x19f16c){if(_[_0x54be('0x1b')](this['realtime']['agents'][this[_0x54be('0x7')]['id']])){return logger[_0x54be('0x10')](_0x54be('0x13'),this[_0x54be('0x6')]['id'],this['agent']['id']);}else{logger[_0x54be('0x10')](_0x54be('0x1c'),this['squeue']['id'],this[_0x54be('0x7')]['id']);util['hideNotification'](this[_0x54be('0x5')],this[_0x54be('0x6')]['id'],this[_0x54be('0x11')]['agents'][this[_0x54be('0x7')]['id']],null,this[_0x54be('0x4')]);this[_0x54be('0x11')][_0x54be('0x12')][this[_0x54be('0x7')]['id']][_0x54be('0x17')]=![];this['realtime'][_0x54be('0x12')][this[_0x54be('0x7')]['id']]['busyQueue']=undefined;util[_0x54be('0x1d')](this[_0x54be('0x6')]['id'],this[_0x54be('0x11')][_0x54be('0x12')][this[_0x54be('0x7')]['id']],_0x19f16c?_0x54be('0x1e'):_0x54be('0x1f'));}if(!_0x19f16c){setTimeout(this[_0x54be('0x8')][_0x54be('0x9')](this),0x3e8);}};function agent(_0x5e0447,_0x11bf4e,_0x451f6c,_0x1e1039){return new Agent(_0x5e0447,_0x11bf4e,_0x451f6c,_0x1e1039);}module['exports']=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 85cc35f..5ca8658 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 _0xfc65=['STOP','busy','lodash','uuid','./util','../../../../../config/logger','routing','queue','realtime','squeue','push','handleTimeout','bind','drained','handleDrained','prototype','handleRun','isNil','length','Agents','agents','debug','isAgentAvailable','channel','writeLog','busyQueue','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification'];(function(_0x1a14af,_0x3261d8){var _0x5e1b07=function(_0x5b174a){while(--_0x5b174a){_0x1a14af['push'](_0x1a14af['shift']());}};_0x5e1b07(++_0x3261d8);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x5e4f75,_0x508241){_0x5e4f75=_0x5e4f75-0x0;var _0x1d2715=_0xfc65[_0x5e4f75];return _0x1d2715;};'use strict';var _=require(_0x5fc6('0x0'));var uuid=require(_0x5fc6('0x1'));var util=require(_0x5fc6('0x2'));var logger=require(_0x5fc6('0x3'))(_0x5fc6('0x4'));var Beepall=function(_0x280cbb,_0x355810,_0x15af25,_0xe1ad23){this['notificationId']=uuid['v4']();this['squeue']=_0x280cbb;this[_0x5fc6('0x5')]=_0x355810;this[_0x5fc6('0x6')]=_0x15af25;this[_0x5fc6('0x4')]=_0xe1ad23;this[_0x5fc6('0x7')][_0x5fc6('0x8')](this['handleRun']['bind'](this),this[_0x5fc6('0x9')][_0x5fc6('0xa')](this));this[_0x5fc6('0x7')]['on']('timeout',this[_0x5fc6('0x9')][_0x5fc6('0xa')](this));this['squeue']['on'](_0x5fc6('0xb'),this[_0x5fc6('0xc')]['bind'](this));};Beepall['prototype'][_0x5fc6('0x8')]=function(){this[_0x5fc6('0x7')][_0x5fc6('0x8')](this['handleRun'][_0x5fc6('0xa')](this),this[_0x5fc6('0x9')][_0x5fc6('0xa')](this));};Beepall[_0x5fc6('0xd')][_0x5fc6('0xc')]=function(){this[_0x5fc6('0x9')](!![]);};Beepall['prototype'][_0x5fc6('0xe')]=function(){var _0x4ee120=!![];if(!_[_0x5fc6('0xf')](this[_0x5fc6('0x5')])&&!_[_0x5fc6('0xf')](this[_0x5fc6('0x5')]['Agents'])&&this[_0x5fc6('0x5')]['Agents'][_0x5fc6('0x10')]>0x0){for(var _0x585f13=0x0,_0x4f8b61;_0x585f130x0){for(var _0x396f3f=0x0,_0x36ee8a;_0x396f3f0x0&&_0x486de2[_0x396646+_0xaf2c('0x24')]>=_0x486de2[_0x396646+_0xaf2c('0x25')]){writeLog(_0x237318,_0x486de2,_0x396646[_0xaf2c('0x26')]()+_0xaf2c('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x29f8b0,_0x2051be,_0x36f37c,_0x410536,_0x4b7cf2){return sendNotification(!![],_0x29f8b0,_0x2051be,_0x36f37c,_0x410536,_0x4b7cf2);};exports[_0xaf2c('0x28')]=function(_0x589d47,_0x38db1b,_0x42f980,_0x15466b,_0x5d685a){return sendNotification(![],_0x589d47,_0x38db1b,_0x42f980,_0x15466b,_0x5d685a);};exports[_0xaf2c('0x29')]=writeLog; \ No newline at end of file +var _0x9957=['msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','format','save','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue'];(function(_0x7c5869,_0x25a8fd){var _0x3cb975=function(_0x1794dc){while(--_0x1794dc){_0x7c5869['push'](_0x7c5869['shift']());}};_0x3cb975(++_0x25a8fd);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var utils=require(_0x7995('0x2'));var Redis=require(_0x7995('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));config[_0x7995('0x6')]=_[_0x7995('0x7')](config['redis'],{'host':_0x7995('0x8'),'port':0x18eb});var io=require(_0x7995('0x9'))(new Redis(config[_0x7995('0x6')]));function sendNotification(_0x219534,_0xbda126,_0x326741,_0x4996ca,_0x465276,_0x1cad37){io['to'](util['format'](_0x7995('0xa'),_0x4996ca[_0x7995('0xb')]))[_0x7995('0xc')](_0x7995('0xd'),_0x4996ca);var _0x3c1d19=_0x1cad37||{};var _0x1e400a=_0x326741[_0x7995('0xe')]('.');var _0x524f7b={'uniqueid':_0xbda126,'channel':_0x1e400a[0x0],'id':_0x1e400a[0x1],'title':_0x1e400a[0x0]+_0x7995('0xf'),'interactionId':_0x1e400a[0x2],'queue':_0x465276?_0x465276[_0x7995('0xb')]:null,'sound':_0x3c1d19['account'][_0x7995('0x10')],'shake':_0x3c1d19[_0x7995('0x11')][_0x7995('0x12')]};try{if(!_0x3c1d19[_0x7995('0x13')]){_0x3c1d19[_0x7995('0x13')]={};}if(_0x465276){_0x3c1d19[_0x7995('0x13')][_0x7995('0x14')]=_0x465276;}else if(_0x3c1d19['body']['queue']){delete _0x3c1d19[_0x7995('0x13')][_0x7995('0x14')];}_0x524f7b[_0x7995('0x15')]=utils[_0x7995('0x16')](_0x3c1d19[_0x7995('0x11')][_0x7995('0x17')],_0x3c1d19);}catch(_0x2202ce){_0x524f7b[_0x7995('0x15')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x7995('0x18')](util['format'](_0x7995('0x19'),_0xbda126,_0x2202ce[_0x7995('0x1a')]));}io['to'](util[_0x7995('0x1b')](_0x7995('0xa'),_0x4996ca[_0x7995('0xb')]))[_0x7995('0xc')](util['format']('notification:%s',_0x219534?_0x7995('0x1c'):'remove'),_0x524f7b);}function writeLog(_0x555f74,_0x3ec178,_0x3d463e){return logger['debug'](util[_0x7995('0x1b')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x555f74,_0x3ec178['name'],_0x3d463e));}exports[_0x7995('0x1d')]=function(_0x327b1f,_0x350fd9,_0x1a8568,_0x460924){if(_0x350fd9[_0x7995('0x1e')]){writeLog(_0x327b1f,_0x350fd9,'BUSY');return![];}if(!_0x350fd9[_0x7995('0x1f')]){writeLog(_0x327b1f,_0x350fd9,_0x7995('0x20'));return![];}if(_0x350fd9[_0x1a8568+_0x7995('0x21')]){writeLog(_0x327b1f,_0x350fd9,_0x7995('0x22'));return![];}if(_0x460924&&_0x350fd9[_0x7995('0x23')](_0x1a8568+_0x7995('0x24'))&&_0x350fd9[_0x7995('0x23')](_0x1a8568+_0x7995('0x25'))){if(_0x350fd9[_0x1a8568+'Capacity']>0x0&&_0x350fd9[_0x1a8568+_0x7995('0x25')]>=_0x350fd9[_0x1a8568+_0x7995('0x24')]){writeLog(_0x327b1f,_0x350fd9,_0x1a8568[_0x7995('0x26')]()+_0x7995('0x27'));return![];}}return!![];};exports[_0x7995('0x28')]=function(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3,_0x229742){return sendNotification(!![],_0x2a307e,_0x56691a,_0x47625f,_0x5911c3,_0x229742);};exports[_0x7995('0x29')]=function(_0xf16cc2,_0x132a42,_0x11c1eb,_0x4b6f99,_0x9b2a15){return sendNotification(![],_0xf16cc2,_0x132a42,_0x11c1eb,_0x4b6f99,_0x9b2a15);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index a27cbe8..c1e8624 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 _0x0534=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','next','validate','shelljs','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x27380a,_0x11b4db){var _0x49557d=function(_0x11984a){while(--_0x11984a){_0x27380a['push'](_0x27380a['shift']());}};_0x49557d(++_0x11b4db);}(_0x0534,0x190));var _0x4053=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x0534[_0x2d3ab3];return _0x321f9e;};'use strict';var schema=require(_0x4053('0x0'));var sh=require(_0x4053('0x1'));var _=require('lodash');var utils=require(_0x4053('0x2'));var logger=require('../../../../config/logger')(_0x4053('0x3'));var system=schema({'command':{'type':_0x4053('0x4'),'required':!![],'message':_0x4053('0x5')}});exports[_0x4053('0x6')]=function(_0x1ed727,_0x507c6b){return function(_0x269164){try{var _0x3bdcc3={'command':_0x507c6b[0x0]};var _0x2cf4d4=system[_0x4053('0x0')](_0x3bdcc3,{'typecast':!![]});if(_0x2cf4d4['length']){logger[_0x4053('0x7')](_0x4053('0x8'),_0x1ed727,_[_0x4053('0x9')](_0x2cf4d4,_0x4053('0xa'))[_0x4053('0xb')](',\x20'));logger[_0x4053('0xc')](_0x4053('0xd'),_0x1ed727);_0x269164['next']();}else{var _0x35d3fe=this;var _0x235efc=utils[_0x4053('0xe')](_0x507c6b[0x0],this);logger[_0x4053('0xc')](_0x4053('0xf'),_0x1ed727,_0x235efc);sh[_0x4053('0x10')](_[_0x4053('0x11')](_0x235efc),function(_0x4f671e,_0x5630e7){logger[_0x4053('0xc')](_0x4053('0x12'),_0x1ed727,_0x4f671e);if(_0x4f671e==0x0){var _0x453274=_0x5630e7[_0x4053('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x507c6b[0x1])||_[_0x4053('0x14')](_0x507c6b[0x1])){logger['info'](_0x4053('0x15'),_0x1ed727);_0x35d3fe[_0x4053('0x16')][_0x507c6b[0x1]]=_0x453274;}else{logger[_0x4053('0xc')](_0x4053('0x17'),_0x1ed727,_0x507c6b[0x1],_0x453274);_0x35d3fe['body'][_0x507c6b[0x1]]=_0x453274;}}_0x269164['next']();});}}catch(_0x258bd1){logger['error']('[%s][SYSTEM]\x20%s',_0x1ed727,_[_0x4053('0x18')](_0x258bd1)?JSON['stringify'](_0x258bd1):_0x258bd1);logger[_0x4053('0xc')](_0x4053('0xd'),_0x1ed727);_0x269164[_0x4053('0x19')]();}};}; \ No newline at end of file +var _0x33a8=['next','getMustacheRender','info','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x3bfd9a,_0x5c5a47){var _0x34ae7c=function(_0x30349d){while(--_0x30349d){_0x3bfd9a['push'](_0x3bfd9a['shift']());}};_0x34ae7c(++_0x5c5a47);}(_0x33a8,0xd1));var _0x833a=function(_0x2aa470,_0x25a93a){_0x2aa470=_0x2aa470-0x0;var _0x493bc7=_0x33a8[_0x2aa470];return _0x493bc7;};'use strict';var schema=require(_0x833a('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x833a('0x1'));var logger=require(_0x833a('0x2'))(_0x833a('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x833a('0x4')}});exports[_0x833a('0x5')]=function(_0x151512,_0x5ca89b){return function(_0x504e32){try{var _0x32e90b={'command':_0x5ca89b[0x0]};var _0x1ffe6b=system['validate'](_0x32e90b,{'typecast':!![]});if(_0x1ffe6b[_0x833a('0x6')]){logger[_0x833a('0x7')](_0x833a('0x8'),_0x151512,_['map'](_0x1ffe6b,_0x833a('0x9'))['join'](',\x20'));logger['info'](_0x833a('0xa'),_0x151512);_0x504e32[_0x833a('0xb')]();}else{var _0x42451c=this;var _0x10f3c8=utils[_0x833a('0xc')](_0x5ca89b[0x0],this);logger[_0x833a('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x151512,_0x10f3c8);sh['exec'](_[_0x833a('0xe')](_0x10f3c8),function(_0x2ee888,_0x559064){logger['info'](_0x833a('0xf'),_0x151512,_0x2ee888);if(_0x2ee888==0x0){var _0x6c8162=_0x559064[_0x833a('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x833a('0x11')](_0x5ca89b[0x1])||_['isEmpty'](_0x5ca89b[0x1])){logger[_0x833a('0xd')](_0x833a('0x12'),_0x151512);_0x42451c[_0x833a('0x13')][_0x5ca89b[0x1]]=_0x6c8162;}else{logger[_0x833a('0xd')](_0x833a('0x14'),_0x151512,_0x5ca89b[0x1],_0x6c8162);_0x42451c[_0x833a('0x13')][_0x5ca89b[0x1]]=_0x6c8162;}}_0x504e32[_0x833a('0xb')]();});}}catch(_0x546022){logger[_0x833a('0x7')]('[%s][SYSTEM]\x20%s',_0x151512,_[_0x833a('0x15')](_0x546022)?JSON['stringify'](_0x546022):_0x546022);logger[_0x833a('0xd')](_0x833a('0xa'),_0x151512);_0x504e32[_0x833a('0xb')]();}};}; \ 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 e4f927d..89b5516 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 _0x2553=['error','[%s][TAG]\x20%s','join','info','next','Interaction','channel','addTags','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x2553,0x1db));var _0x3255=function(_0x41de3c,_0x284168){_0x41de3c=_0x41de3c-0x0;var _0x468351=_0x2553[_0x41de3c];return _0x468351;};'use strict';var schema=require(_0x3255('0x0'));var _=require(_0x3255('0x1'));var rpc={'chatInteraction':require(_0x3255('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x3255('0x3')),'faxInteraction':require(_0x3255('0x4')),'whatsappInteraction':require(_0x3255('0x5'))};var logger=require(_0x3255('0x6'))(_0x3255('0x7'));var tag=schema({'tag':{'type':_0x3255('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x51b165,_0x59e010,_0x4f949f,_0x5e2731){return function(_0x2161e7){try{var _0x8a3a1e={'tag':_0x59e010[0x0]};var _0x4ffefd=tag['validate'](_0x8a3a1e,{'typecast':!![]});if(_0x4ffefd['length']){logger[_0x3255('0x9')](_0x3255('0xa'),_0x51b165,_['map'](_0x4ffefd,'message')[_0x3255('0xb')](',\x20'));logger[_0x3255('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x51b165);_0x2161e7[_0x3255('0xd')]();}else{var _0x39500e={'ids':[_0x59e010[0x0]]};if(rpc[_0x5e2731['channel']+_0x3255('0xe')]){rpc[_0x5e2731[_0x3255('0xf')]+_0x3255('0xe')][_0x3255('0x10')](_0x5e2731[_0x3255('0x11')]['id'],_0x39500e)['then'](function(_0x45bc72){logger[_0x3255('0xc')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x51b165,_0x59e010[0x1],_0x5e2731[_0x3255('0xf')],_0x5e2731[_0x3255('0x11')]['id']);})[_0x3255('0x12')](function(_0x2b4f61){logger[_0x3255('0x9')](_0x3255('0xa'),_0x51b165,JSON[_0x3255('0x13')](_0x2b4f61));logger[_0x3255('0xc')](_0x3255('0x14'),_0x51b165);})[_0x3255('0x15')](function(){_0x2161e7[_0x3255('0xd')]();});}}}catch(_0x224b7a){logger[_0x3255('0x9')](_0x3255('0xa'),_0x51b165,_['isObject'](_0x224b7a)?JSON['stringify'](_0x224b7a):_0x224b7a);logger[_0x3255('0xc')](_0x3255('0x14'),_0x51b165);_0x2161e7['next']();}};}; \ No newline at end of file +var _0x3b66=['catch','stringify','finally','lodash','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction'];(function(_0x5f2cb8,_0x56a6d0){var _0x3cdd8a=function(_0x242683){while(--_0x242683){_0x5f2cb8['push'](_0x5f2cb8['shift']());}};_0x3cdd8a(++_0x56a6d0);}(_0x3b66,0x193));var _0x63b6=function(_0x1bcae7,_0x4feb25){_0x1bcae7=_0x1bcae7-0x0;var _0x342834=_0x3b66[_0x1bcae7];return _0x342834;};'use strict';var schema=require('validate');var _=require(_0x63b6('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x63b6('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x63b6('0x2')),'faxInteraction':require(_0x63b6('0x3')),'whatsappInteraction':require(_0x63b6('0x4'))};var logger=require(_0x63b6('0x5'))(_0x63b6('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x63b6('0x7')}});exports['consequence']=function(_0x22938b,_0x1166d8,_0x223439,_0x2c0bc5){return function(_0x3fd16b){try{var _0x3780eb={'tag':_0x1166d8[0x0]};var _0x1363a8=tag[_0x63b6('0x8')](_0x3780eb,{'typecast':!![]});if(_0x1363a8[_0x63b6('0x9')]){logger[_0x63b6('0xa')](_0x63b6('0xb'),_0x22938b,_[_0x63b6('0xc')](_0x1363a8,'message')['join'](',\x20'));logger[_0x63b6('0xd')](_0x63b6('0xe'),_0x22938b);_0x3fd16b[_0x63b6('0xf')]();}else{var _0x5dfdc4={'ids':[_0x1166d8[0x0]]};if(rpc[_0x2c0bc5[_0x63b6('0x10')]+_0x63b6('0x11')]){rpc[_0x2c0bc5[_0x63b6('0x10')]+_0x63b6('0x11')][_0x63b6('0x12')](_0x2c0bc5['interaction']['id'],_0x5dfdc4)[_0x63b6('0x13')](function(_0x2573fd){logger['info'](_0x63b6('0x14'),_0x22938b,_0x1166d8[0x1],_0x2c0bc5['channel'],_0x2c0bc5[_0x63b6('0x15')]['id']);})[_0x63b6('0x16')](function(_0x104a0d){logger[_0x63b6('0xa')](_0x63b6('0xb'),_0x22938b,JSON[_0x63b6('0x17')](_0x104a0d));logger[_0x63b6('0xd')](_0x63b6('0xe'),_0x22938b);})[_0x63b6('0x18')](function(){_0x3fd16b[_0x63b6('0xf')]();});}}}catch(_0x3484d7){logger['error']('[%s][TAG]\x20%s',_0x22938b,_['isObject'](_0x3484d7)?JSON[_0x63b6('0x17')](_0x3484d7):_0x3484d7);logger['info'](_0x63b6('0xe'),_0x22938b);_0x3fd16b['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 ac8095d..c309b22 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 _0x1da5=['&serviceId=','&data=','stringify','info','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','params','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x18f9e2,_0x306c4e){var _0x5a5e6e=function(_0x4abce9){while(--_0x4abce9){_0x18f9e2['push'](_0x18f9e2['shift']());}};_0x5a5e6e(++_0x306c4e);}(_0x1da5,0x13f));var _0x51da=function(_0x471860,_0x19b4c6){_0x471860=_0x471860-0x0;var _0x48f9ba=_0x1da5[_0x471860];return _0x48f9ba;};'use strict';var rp=require(_0x51da('0x0'));var logger=require(_0x51da('0x1'))(_0x51da('0x2'));var _=require(_0x51da('0x3'));var arr=[];exports[_0x51da('0x4')]=function(_0x54b486,_0x54ad21){return function(_0x10e58a){var _0x23cfac=_0x54ad21[0xa];var _0x4343a6=_0x54ad21[0xb];var _0x2443fd=_0x54ad21[0xc];var _0x37039d=_0x54ad21[0xd];var _0x373370=_0x54ad21[0xe];var _0x20ad9e=_0x54ad21[0xf]['replace'](/\n/g,_0x51da('0x5'));var _0x571dc6=_0x54ad21[0x10][_0x51da('0x6')](/\n/g,'\x20');if(!arr[_0x51da('0x7')](_0x4343a6)){arr[_0x51da('0x8')](_0x4343a6);var _0xa7a208=_0x54ad21[0x3];var _0xb2f9ed=_0x54ad21[0x4];var _0x2d271c=_0x54ad21[0x1];var _0x18e3b2=_0x54ad21[0x0];var _0x5f0b1e={};_0x5f0b1e[_0x51da('0x9')]=_0x54ad21[0x8]+_0x51da('0xa')+_0x2443fd+'|'+_0x23cfac+'|'+_0x37039d+'|'+_0x4343a6+'|'+_0x373370;_0x5f0b1e[_0x51da('0xb')]=_0x54ad21[0x7]+_0x51da('0xa')+_0x2443fd+'|'+_0x23cfac+'|'+_0x37039d+'|'+_0x4343a6+'|'+_0x373370+'|'+_0x20ad9e+'|'+_0x571dc6;_0x5f0b1e[_0x51da('0xc')]=_0x54ad21[0x9];var _0x2b8319={};_0x2b8319['jsonrpc']=_0x51da('0xd');_0x2b8319[_0x51da('0xe')]=_0x51da('0xf');var _0x1828fe=[];_0x1828fe[_0x51da('0x8')](_0x54ad21[0x2]);_0x1828fe[_0x51da('0x8')](_0x54ad21[0x5]);_0x1828fe[_0x51da('0x8')](_0x54ad21[0x6]);_0x2b8319[_0x51da('0x10')]=_0x1828fe;_0x2b8319['id']=0x1;var _0x496ffa=JSON['stringify'](_0x2b8319);var _0x28f45f={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0xa7a208,'headers':{'Content-Type':_0x51da('0x11')},'body':_0x496ffa};return rp(_0x28f45f)[_0x51da('0x12')](function(_0x272a25){const _0x485637=JSON[_0x51da('0x13')](_0x272a25);if(!_0x485637['result'][_0x51da('0x14')]){throw new Error(_0x51da('0x15'));}var _0xd50ad0=_0x4343a6;var _0x9aa13d='channelId='+_0x2d271c+_0x51da('0x16')+_0x18e3b2+'&sessionId='+_0xd50ad0+_0x51da('0x17')+JSON[_0x51da('0x18')](_0x5f0b1e);var _0x2d5433=_0xb2f9ed+'?'+_0x9aa13d;return rp(_0x2d5433);})[_0x51da('0x12')](function(_0x375fab){logger[_0x51da('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x54b486,_0x375fab);_0x10e58a['stop']();})[_0x51da('0x1a')](function(_0x12bcf7){logger[_0x51da('0x1b')](_0x51da('0x1c'),_0x54b486,_[_0x51da('0x1d')](_0x12bcf7)?JSON['stringify'](_0x12bcf7):_0x12bcf7);_0x10e58a['stop']();});}else{logger[_0x51da('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x54b486);_0x10e58a[_0x51da('0x1e')]();}};}; \ No newline at end of file +var _0xa76e=['params','stringify','utf8','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','login','push'];(function(_0x33d039,_0x42faac){var _0x52d755=function(_0x2950ae){while(--_0x2950ae){_0x33d039['push'](_0x33d039['shift']());}};_0x52d755(++_0x42faac);}(_0xa76e,0x172));var _0xea76=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xa76e[_0x72a33d];return _0x2621d5;};'use strict';var rp=require('request-promise');var logger=require(_0xea76('0x0'))(_0xea76('0x1'));var _=require(_0xea76('0x2'));var arr=[];exports[_0xea76('0x3')]=function(_0x55b8e7,_0x3715c1){return function(_0x4b3000){var _0x1f30ba=_0x3715c1[0xa];var _0x4ae1c6=_0x3715c1[0xb];var _0x2b9975=_0x3715c1[0xc];var _0x57885b=_0x3715c1[0xd];var _0x1d0a80=_0x3715c1[0xe];var _0x3e6918=_0x3715c1[0xf][_0xea76('0x4')](/\n/g,_0xea76('0x5'));var _0x1acfac=_0x3715c1[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xea76('0x6')](_0x4ae1c6)){arr['push'](_0x4ae1c6);var _0x494744=_0x3715c1[0x3];var _0x2645bd=_0x3715c1[0x4];var _0x479a56=_0x3715c1[0x1];var _0x217a79=_0x3715c1[0x0];var _0x4ae634={};_0x4ae634[_0xea76('0x7')]=_0x3715c1[0x8]+_0xea76('0x8')+_0x2b9975+'|'+_0x1f30ba+'|'+_0x57885b+'|'+_0x4ae1c6+'|'+_0x1d0a80;_0x4ae634[_0xea76('0x9')]=_0x3715c1[0x7]+'?params='+_0x2b9975+'|'+_0x1f30ba+'|'+_0x57885b+'|'+_0x4ae1c6+'|'+_0x1d0a80+'|'+_0x3e6918+'|'+_0x1acfac;_0x4ae634[_0xea76('0xa')]=_0x3715c1[0x9];var _0xff274d={};_0xff274d[_0xea76('0xb')]=_0xea76('0xc');_0xff274d['method']=_0xea76('0xd');var _0x15067b=[];_0x15067b['push'](_0x3715c1[0x2]);_0x15067b[_0xea76('0xe')](_0x3715c1[0x5]);_0x15067b[_0xea76('0xe')](_0x3715c1[0x6]);_0xff274d[_0xea76('0xf')]=_0x15067b;_0xff274d['id']=0x1;var _0x3ce1e8=JSON[_0xea76('0x10')](_0xff274d);var _0x5c864c={'encoding':_0xea76('0x11'),'method':'POST','timeout':0x2710,'url':_0x494744,'headers':{'Content-Type':_0xea76('0x12')},'body':_0x3ce1e8};return rp(_0x5c864c)[_0xea76('0x13')](function(_0x2131e7){const _0x105d16=JSON['parse'](_0x2131e7);if(!_0x105d16[_0xea76('0x14')][_0xea76('0x15')]){throw new Error(_0xea76('0x16'));}var _0x13a142=_0x4ae1c6;var _0x2b732b=_0xea76('0x17')+_0x479a56+_0xea76('0x18')+_0x217a79+_0xea76('0x19')+_0x13a142+_0xea76('0x1a')+JSON['stringify'](_0x4ae634);var _0x393880=_0x2645bd+'?'+_0x2b732b;return rp(_0x393880);})['then'](function(_0x3f5795){logger[_0xea76('0x1b')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x55b8e7,_0x3f5795);_0x4b3000[_0xea76('0x1c')]();})[_0xea76('0x1d')](function(_0x35ac04){logger[_0xea76('0x1e')](_0xea76('0x1f'),_0x55b8e7,_[_0xea76('0x20')](_0x35ac04)?JSON['stringify'](_0x35ac04):_0x35ac04);_0x4b3000[_0xea76('0x1c')]();});}else{logger['info'](_0xea76('0x21'),_0x55b8e7);_0x4b3000[_0xea76('0x22')]();}};}; \ 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 734ef34..953c801 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x35b53e,_0x5e8798){var _0x4520dd=function(_0x4ba850){while(--_0x4ba850){_0x35b53e['push'](_0x35b53e['shift']());}};_0x4520dd(++_0x5e8798);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x225965,_0x206ec3){var _0x26afb5=function(_0x2609fe){while(--_0x2609fe){_0x225965['push'](_0x225965['shift']());}};_0x26afb5(++_0x206ec3);}(_0xe706,0xa3));var _0x6e70=function(_0x2f430a,_0x46d370){_0x2f430a=_0x2f430a-0x0;var _0x10def3=_0xe706[_0x2f430a];return _0x10def3;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 1543606..c272f78 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 _0x0269=['./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','stringify','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x0269,0x135));var _0x9026=function(_0x518b67,_0x2b4c37){_0x518b67=_0x518b67-0x0;var _0x33f04e=_0x0269[_0x518b67];return _0x33f04e;};'use strict';var _=require(_0x9026('0x0'));var util=require('util');var path=require(_0x9026('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x9026('0x2'));var uuid=require('uuid');var utils=require(_0x9026('0x3'));var config=require(_0x9026('0x4'));var logger=require(_0x9026('0x5'))(_0x9026('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x9026('0x7')),'chatQueueReport':require(_0x9026('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x9026('0x9'))};var RuleEngine=require(_0x9026('0xa'));function getId(_0x1149ad,_0xd97c29,_0x55f4df){return util[_0x9026('0xb')](_0x9026('0xc'),_0x1149ad,_0xd97c29||0x0,_0x55f4df||0x0);}function getIntervals(_0x1706bf,_0x4b7d1f){var _0x388ccb=[];if(!_[_0x9026('0xd')](_0x4b7d1f[_0x9026('0xe')])&&!_['isNil'](_0x1706bf[_0x4b7d1f[_0x9026('0xe')]])&&!_['isNil'](_0x1706bf[_0x4b7d1f[_0x9026('0xe')]][_0x9026('0xf')])){_0x388ccb=_[_0x9026('0x10')](_0x1706bf[_0x4b7d1f[_0x9026('0xe')]][_0x9026('0xf')],_0x9026('0x11'));}else if(!_[_0x9026('0xd')](_0x4b7d1f['interval'])){_0x388ccb=[_0x4b7d1f[_0x9026('0x11')]];}return _0x388ccb;}exports['listen']=function(_0x385afc){_0x385afc[_0x9026('0x12')]={};return new BPromise(function(_0xd2473f,_0xe7b66a){var _0x11c0d1={'Start':function(_0x421ee2){var _0x142465=this;return new Promise(function(_0x1eb679,_0x5d5053){if(_0x421ee2){try{var _0x401438=[];var _0x2b9834=getId(_0x421ee2['channel'],_0x421ee2[_0x9026('0x13')]?_0x421ee2[_0x9026('0x13')]['id']:0x0,_0x421ee2[_0x9026('0x14')]?_0x421ee2[_0x9026('0x14')]['id']:0x0);if(_0x421ee2[_0x9026('0x15')]&&_[_0x9026('0x16')](_0x421ee2[_0x9026('0x15')])&&_0x421ee2[_0x9026('0x15')]['length']){for(var _0x7985=0x0;_0x7985<_0x421ee2['applications'][_0x9026('0x17')];_0x7985+=0x1){var _0x5e6c46=_0x421ee2[_0x9026('0x15')][_0x7985];if(fs[_0x9026('0x18')](path[_0x9026('0x19')](__dirname,_0x9026('0x15'),_0x5e6c46[_0x9026('0x1a')]+_0x9026('0x1b')))){var _0x71a263=[];switch(_0x5e6c46[_0x9026('0x1a')][_0x9026('0x1c')]()){case'autoreply':var _0x5c6e39=_0x5e6c46[_0x9026('0x1d')][_0x9026('0x1e')](',');if(_0x421ee2[_0x9026('0x1f')]===_0x9026('0x20')){_0x71a263[_0x9026('0x21')](_0x5c6e39[0x0]);_0x71a263[_0x9026('0x21')](_0x5c6e39[0x1]);_0x71a263[_0x9026('0x21')](_0x5c6e39[_0x9026('0x22')](0x2,_0x5c6e39[_0x9026('0x17')])[_0x9026('0x19')](','));}else{_0x71a263[_0x9026('0x21')](_0x5c6e39[0x0]);_0x71a263[_0x9026('0x21')](_0x5c6e39[_0x9026('0x22')](0x1,_0x5c6e39[_0x9026('0x17')])[_0x9026('0x19')](','));}break;case _0x9026('0x23'):var _0x1f431b=_0x5e6c46[_0x9026('0x1d')][_0x9026('0x1e')](',');_0x71a263['push'](_0x1f431b[0x0]);_0x71a263[_0x9026('0x21')](_0x1f431b[0x1]);_0x71a263[_0x9026('0x21')](_0x1f431b[_0x9026('0x22')](0x2,_0x1f431b[_0x9026('0x17')])[_0x9026('0x19')](','));break;case _0x9026('0x24'):var _0x23cf05=_0x5e6c46[_0x9026('0x1d')][_0x9026('0x1e')](',');_0x71a263[_0x9026('0x21')](_0x23cf05[0x0]);_0x71a263[_0x9026('0x21')](_0x23cf05[0x1]);_0x71a263['push'](_0x23cf05[0x2]);_0x71a263[_0x9026('0x21')](_0x23cf05[0x3]);_0x71a263[_0x9026('0x21')](_0x23cf05[_0x9026('0x22')](0x4,_0x23cf05[_0x9026('0x17')])[_0x9026('0x19')](','));break;case _0x9026('0x25'):var _0x275f2a=_0x5e6c46['appdata'][_0x9026('0x1e')](',');_0x71a263['push'](_0x275f2a[0x0]);_0x71a263[_0x9026('0x21')](_0x275f2a[0x1]);_0x71a263[_0x9026('0x21')](_0x275f2a[0x2]);_0x71a263[_0x9026('0x21')](_0x275f2a[0x3]);_0x71a263[_0x9026('0x21')](_0x275f2a[_0x9026('0x22')](0x4,_0x275f2a[_0x9026('0x17')])['join'](','));break;case _0x9026('0x13'):_0x71a263[_0x9026('0x21')](_0x5e6c46[_0x9026('0x1d')]);break;case _0x9026('0x26'):_0x71a263['push'](_0x5e6c46[_0x9026('0x27')]);_0x71a263[_0x9026('0x21')](_0x5e6c46['appdata']);break;case _0x9026('0x28'):var _0x258301=utils[_0x9026('0x29')](_0x421ee2[_0x9026('0x2a')][_0x9026('0x2b')],_0x421ee2);var _0x7943af=_0x5e6c46[_0x9026('0x1d')][_0x9026('0x1e')](',');_0x71a263['push'](_0x7943af[0x0]);_0x71a263[_0x9026('0x21')](_0x7943af[0x1]);_0x71a263[_0x9026('0x21')](_0x7943af[0x2]);_0x71a263['push'](_0x7943af[0x3]);_0x71a263[_0x9026('0x21')](_0x7943af[0x4]);_0x71a263[_0x9026('0x21')](_0x7943af[0x5]);_0x71a263[_0x9026('0x21')](_0x7943af[0x6]);_0x71a263[_0x9026('0x21')](_0x7943af[0x7]);_0x71a263[_0x9026('0x21')](_0x7943af[0x8]);_0x71a263[_0x9026('0x21')](_0x7943af[0x9]);_0x71a263[_0x9026('0x21')](_0x7943af[0xa]);_0x71a263[_0x9026('0x21')](_0x421ee2['interaction']['id']);_0x71a263[_0x9026('0x21')](_0x421ee2[_0x9026('0x13')]['id']);_0x71a263[_0x9026('0x21')](_0x5e6c46[_0x9026('0x2c')]);_0x71a263[_0x9026('0x21')](_0x421ee2[_0x9026('0x14')][_0x9026('0x2d')]);_0x71a263['push'](_0x421ee2[_0x9026('0x2e')]['body']);_0x71a263[_0x9026('0x21')](_0x258301);break;default:_0x71a263=_[_0x9026('0xd')](_0x5e6c46[_0x9026('0x1d')])?[]:_0x5e6c46[_0x9026('0x1d')]['split'](',');}var _0x58cce0={'id':util[_0x9026('0xb')](_0x9026('0x2f'),_0x2b9834,_0x5e6c46['id'],_0x5e6c46['app']),'condition':require('./interval')['condition'](_0x2b9834,getIntervals(_0x385afc[_0x9026('0x30')],_0x5e6c46),_0x385afc),'consequence':require(_0x9026('0x31')+_0x5e6c46['app'])[_0x9026('0x32')](_0x2b9834,_0x71a263,_0x385afc,_0x421ee2),'p':_0x5e6c46[_0x9026('0x33')]||0x0};logger[_0x9026('0x34')](_0x9026('0x35'),_0x58cce0['id'],_0x9026('0x36'),getIntervals(_0x385afc[_0x9026('0x30')],_0x5e6c46)[_0x9026('0x19')](_0x9026('0x37')));_0x401438['push'](_0x58cce0);}else{logger[_0x9026('0x38')](_0x9026('0x39'),path['join'](__dirname,'applications',_0x5e6c46['app']+_0x9026('0x1b')));}}_0x385afc[_0x9026('0x12')][_0x2b9834]=new RuleEngine(_0x401438);_0x385afc[_0x9026('0x12')][_0x2b9834][_0x9026('0x3a')](_0x421ee2,function(_0xa3f7fe){logger['info'](_0x9026('0x3b'),JSON['stringify'](_0xa3f7fe[_0x9026('0x3c')]));if(_0x385afc[_0x9026('0x12')][_0x2b9834]){_0x385afc[_0x9026('0x12')][_0x2b9834][_0x9026('0x3d')]('complete');}});return _0x1eb679({'code':0xc8,'message':_0x421ee2});}else{logger['info'](_0x9026('0x3e'));return _0x1eb679({'code':0xc8,'message':_0x421ee2});}}catch(_0x46c50f){logger[_0x9026('0x38')](_0x46c50f[_0x9026('0x3f')]);return _0x5d5053(_0x142465[_0x9026('0x38')](0x1f4,_0x46c50f));}}return _0x5d5053(_0x9026('0x40'));});},'AcceptMessage':function(_0x4bf94e){var _0x52a242=this;return new Promise(function(_0x58ed98,_0x324fd9){if(_0x4bf94e[_0x9026('0x41')]&&_0x4bf94e['agent']['id']){if(_0x385afc[_0x9026('0x42')][_0x4bf94e['agent']['id']]){_0x385afc[_0x9026('0x42')][_0x4bf94e['agent']['id']][_0x9026('0x43')]=![];_0x385afc['agents'][_0x4bf94e['agent']['id']][_0x9026('0x44')]=undefined;}}if(_0x4bf94e[_0x9026('0x13')]&&_0x4bf94e[_0x9026('0x13')]['id']){try{var _0x4d9051=getId(_0x4bf94e[_0x9026('0x1f')],_0x4bf94e[_0x9026('0x13')]?_0x4bf94e[_0x9026('0x13')]['id']:0x0,_0x4bf94e[_0x9026('0x14')]?_0x4bf94e[_0x9026('0x14')]['id']:0x0);if(_0x385afc['rules'][_0x4d9051]){_0x385afc[_0x9026('0x12')][_0x4d9051][_0x9026('0x3d')](_0x9026('0x45'));if(rpc[_0x4bf94e[_0x9026('0x1f')]+_0x9026('0x46')]){rpc[_0x4bf94e[_0x9026('0x1f')]+'QueueReport'][_0x9026('0x47')](_0x4d9051,{'UserId':_0x4bf94e['message'][_0x9026('0x48')]})[_0x9026('0x49')](function(_0x50d424){logger[_0x9026('0x38')](_0x9026('0x4a'));});}}return _0x58ed98({'code':0xc8,'message':_0x4bf94e});}catch(_0x37f65c){logger[_0x9026('0x38')](_0x37f65c[_0x9026('0x3f')]);return _0x324fd9(_0x52a242[_0x9026('0x38')](0x1f4,_0x37f65c));}}logger[_0x9026('0x38')](_0x9026('0x4b'));return _0x324fd9(_0x52a242[_0x9026('0x38')](0x1f4,_0x9026('0x4b')));});},'RejectMessage':function(_0x5af878){var _0x207ab6=this;return new Promise(function(_0x24aa21,_0x4ad73e){if(_0x5af878[_0x9026('0x41')]&&_0x5af878[_0x9026('0x41')]['id']){try{if(_0x385afc[_0x9026('0x42')][_0x5af878[_0x9026('0x41')]['id']]){_0x385afc[_0x9026('0x42')][_0x5af878[_0x9026('0x41')]['id']]['busy']=![];_0x385afc[_0x9026('0x42')][_0x5af878['agent']['id']][_0x9026('0x44')]=undefined;}return _0x24aa21({'code':0xc8,'message':_0x5af878});}catch(_0x4212df){logger[_0x9026('0x38')](_0x4212df['stack']);return _0x4ad73e(_0x207ab6['error'](0x1f4,_0x4212df));}}logger[_0x9026('0x38')](_0x9026('0x4b'));return _0x4ad73e(_0x207ab6[_0x9026('0x38')](0x1f4,_0x9026('0x4b')));});},'AbandonInteraction':function(_0x3a4a30){var _0x401c11=this;return new Promise(function(_0x2eeefd,_0x29a769){if(_0x3a4a30[_0x9026('0x1f')]&&_0x3a4a30[_0x9026('0x14')]&&_0x3a4a30['interaction']['id']){try{var _0x56c18a=getId(_0x3a4a30[_0x9026('0x1f')],_0x3a4a30[_0x9026('0x13')]?_0x3a4a30[_0x9026('0x13')]['id']:0x0,_0x3a4a30[_0x9026('0x14')]?_0x3a4a30[_0x9026('0x14')]['id']:0x0);if(_0x385afc[_0x9026('0x12')][_0x56c18a]){_0x385afc[_0x9026('0x12')][_0x56c18a]['emit'](_0x9026('0x45'));}return _0x2eeefd({'code':0xc8,'message':_0x3a4a30});}catch(_0x499371){logger[_0x9026('0x38')](_0x499371[_0x9026('0x3f')]);return _0x29a769(_0x401c11['error'](0x1f4,_0x499371));}}logger[_0x9026('0x38')](_0x9026('0x4b'));return _0x29a769(_0x401c11[_0x9026('0x38')](0x1f4,_0x9026('0x4b')));});},'AgentCapacity':function(_0x4c3236){var _0x3a1b5e=this;return new Promise(function(_0x1cffb4,_0x538fe6){if(_0x385afc['agents'][_0x9026('0x4c')](_0x4c3236['id'])){for(var _0x57b601 in _0x4c3236[_0x9026('0x4d')]){if(_0x4c3236[_0x9026('0x4d')]['hasOwnProperty'](_0x57b601)){if(_0x385afc[_0x9026('0x42')][_0x4c3236['id']][_0x9026('0x4c')](_0x57b601+_0x9026('0x4e'))){_0x385afc[_0x9026('0x42')][_0x4c3236['id']][_0x57b601+_0x9026('0x4e')]=parseInt(_0x4c3236[_0x9026('0x4d')][_0x57b601],0xa);}}}_0x385afc[_0x9026('0x42')][_0x4c3236['id']][_0x9026('0x4f')]();return _0x1cffb4({'code':0xc8,'message':_0x385afc['agents'][_0x4c3236['id']]});}else{return _0x538fe6(_0x3a1b5e[_0x9026('0x38')](0x1f4,_0x9026('0x50')));}});},'Agents':function(_0xefd4df){return new Promise(function(_0x142589,_0x27dfd1){var _0x46cab9=_[_0x9026('0x51')](_0x385afc[_0x9026('0x42')]);_0x142589({'count':_0x46cab9[_0x9026('0x17')],'rows':_0x46cab9});});},'ChatQueues':function(_0x31f06f){return new Promise(function(_0x4bbe90,_0x23c380){var _0x5ea8b9=[];for(var _0x47fbab in _0x385afc[_0x9026('0x52')]){if(_0x385afc[_0x9026('0x52')][_0x9026('0x4c')](_0x47fbab)){var _0x500b28=_0x385afc[_0x9026('0x52')][_0x47fbab];var _0x56837e={'id':_0x500b28['id'],'available':_0x500b28[_0x9026('0x53')],'loggedIn':_0x500b28[_0x9026('0x54')],'name':_0x500b28['name'],'paused':_0x500b28[_0x9026('0x55')],'waiting':_0x500b28['waiting']};_0x5ea8b9[_0x9026('0x21')](_0x56837e);}}_0x4bbe90({'count':_0x5ea8b9[_0x9026('0x17')],'rows':_0x5ea8b9});});},'MailQueues':function(_0x2d46b8){return new Promise(function(_0x33a27d,_0x114d59){var _0x36a3e9=[];for(var _0x59512c in _0x385afc['mailQueues']){if(_0x385afc[_0x9026('0x56')][_0x9026('0x4c')](_0x59512c)){var _0x333b85=_0x385afc[_0x9026('0x56')][_0x59512c];var _0x1c19e3={'id':_0x333b85['id'],'available':_0x333b85[_0x9026('0x53')],'loggedIn':_0x333b85['loggedIn'],'name':_0x333b85[_0x9026('0x57')],'paused':_0x333b85[_0x9026('0x55')],'waiting':_0x333b85[_0x9026('0x58')]};_0x36a3e9['push'](_0x1c19e3);}}_0x33a27d({'count':_0x36a3e9[_0x9026('0x17')],'rows':_0x36a3e9});});},'OpenchannelQueues':function(_0x336b6f){return new Promise(function(_0x288140,_0x2e1e72){var _0x19de68=[];for(var _0x208753 in _0x385afc['openchannelQueues']){if(_0x385afc['openchannelQueues'][_0x9026('0x4c')](_0x208753)){var _0x15e1a9=_0x385afc[_0x9026('0x59')][_0x208753];var _0x5e8faa={'id':_0x15e1a9['id'],'available':_0x15e1a9[_0x9026('0x53')],'loggedIn':_0x15e1a9['loggedIn'],'name':_0x15e1a9[_0x9026('0x57')],'paused':_0x15e1a9[_0x9026('0x55')],'waiting':_0x15e1a9[_0x9026('0x58')]};_0x19de68[_0x9026('0x21')](_0x5e8faa);}}_0x288140({'count':_0x19de68[_0x9026('0x17')],'rows':_0x19de68});});},'SmsQueues':function(_0x52456a){return new Promise(function(_0x40c0fb,_0xeec780){var _0x39a885=[];for(var _0x1d5fc7 in _0x385afc[_0x9026('0x5a')]){if(_0x385afc['smsQueues'][_0x9026('0x4c')](_0x1d5fc7)){var _0x55b23d=_0x385afc[_0x9026('0x5a')][_0x1d5fc7];var _0x4e79f4={'id':_0x55b23d['id'],'available':_0x55b23d['available'],'loggedIn':_0x55b23d[_0x9026('0x54')],'name':_0x55b23d['name'],'paused':_0x55b23d[_0x9026('0x55')],'waiting':_0x55b23d[_0x9026('0x58')]};_0x39a885[_0x9026('0x21')](_0x4e79f4);}}_0x40c0fb({'count':_0x39a885[_0x9026('0x17')],'rows':_0x39a885});});},'FaxQueues':function(_0x23967e){return new Promise(function(_0xf4607f,_0xb6bbdf){var _0x581987=[];for(var _0x4d0e51 in _0x385afc[_0x9026('0x5b')]){if(_0x385afc[_0x9026('0x5b')][_0x9026('0x4c')](_0x4d0e51)){var _0x53c535=_0x385afc[_0x9026('0x5b')][_0x4d0e51];var _0x2f82a7={'id':_0x53c535['id'],'available':_0x53c535[_0x9026('0x53')],'loggedIn':_0x53c535['loggedIn'],'name':_0x53c535[_0x9026('0x57')],'paused':_0x53c535[_0x9026('0x55')],'waiting':_0x53c535[_0x9026('0x58')]};_0x581987[_0x9026('0x21')](_0x2f82a7);}}_0xf4607f({'count':_0x581987[_0x9026('0x17')],'rows':_0x581987});});},'WhatsappQueues':function(_0x18813e){return new Promise(function(_0x5da133,_0x19f6ba){var _0x50bff8=[];for(var _0x8e7e5c in _0x385afc['whatsappQueues']){if(_0x385afc[_0x9026('0x5c')][_0x9026('0x4c')](_0x8e7e5c)){var _0x2ed333=_0x385afc[_0x9026('0x5c')][_0x8e7e5c];var _0x4d3fec={'id':_0x2ed333['id'],'available':_0x2ed333[_0x9026('0x53')],'loggedIn':_0x2ed333[_0x9026('0x54')],'name':_0x2ed333[_0x9026('0x57')],'paused':_0x2ed333[_0x9026('0x55')],'waiting':_0x2ed333[_0x9026('0x58')]};_0x50bff8['push'](_0x4d3fec);}}_0x5da133({'count':_0x50bff8['length'],'rows':_0x50bff8});});},'ChatQueuesWaitingInteractions':function(_0x4d49c2){return new Promise(function(_0x582f99,_0x57c590){var _0x3519b5=_[_0x9026('0x51')](_0x385afc[_0x9026('0x5d')]);_0x582f99({'count':_0x3519b5[_0x9026('0x17')],'rows':_0x3519b5});});},'MailQueuesWaitingInteractions':function(_0x46d10c){return new Promise(function(_0x4e5d5b,_0x422118){var _0x143886=_[_0x9026('0x51')](_0x385afc[_0x9026('0x5e')]);_0x4e5d5b({'count':_0x143886[_0x9026('0x17')],'rows':_0x143886});});},'OpenchannelQueuesWaitingInteractions':function(_0x3e391b){return new Promise(function(_0x138ed,_0x29698a){var _0x272e78=_[_0x9026('0x51')](_0x385afc[_0x9026('0x5f')]);_0x138ed({'count':_0x272e78[_0x9026('0x17')],'rows':_0x272e78});});},'SmsQueuesWaitingInteractions':function(_0x47f264){return new Promise(function(_0x3ba9cd,_0x1158b4){var _0x2de7c8=_[_0x9026('0x51')](_0x385afc[_0x9026('0x60')]);_0x3ba9cd({'count':_0x2de7c8['length'],'rows':_0x2de7c8});});},'FaxQueuesWaitingInteractions':function(_0x2a7b11){return new Promise(function(_0x51060b,_0xd16e08){var _0x20155c=_[_0x9026('0x51')](_0x385afc[_0x9026('0x61')]);_0x51060b({'count':_0x20155c[_0x9026('0x17')],'rows':_0x20155c});});},'WhatsappQueuesWaitingInteractions':function(_0x578ea5){return new Promise(function(_0x2705f5,_0x248586){var _0x31f8a7=_[_0x9026('0x51')](_0x385afc['whatsappQueuesWaitingInteractions']);_0x2705f5({'count':_0x31f8a7['length'],'rows':_0x31f8a7});});}};var _0x176564=jayson[_0x9026('0x62')](_0x11c0d1)['http']();_0x176564['on']('error',function(_0x31cfd2){logger['error'](JSON[_0x9026('0x63')](_0x31cfd2));return _0xe7b66a(_0x31cfd2);});_0x176564[_0x9026('0x64')](0x232c,_0x9026('0x65'),function(){console['log'](_0x9026('0x66'),0x232c);return _0xd2473f(_0x9026('0x67')+0x232c);});});}; \ No newline at end of file +var _0xceb0=['amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','agent','agents','busy','busyQueue','end','QueueReport','update','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','bluebird','./applications/utils','../../../config/environment','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','channel','message','interaction','applications','isArray','length','existsSync','app','.js','autoreply','appdata','split','push','slice','dialogflow','join','dialogflowv2'];(function(_0xb7654d,_0x597a77){var _0x533474=function(_0x5c730e){while(--_0x5c730e){_0xb7654d['push'](_0xb7654d['shift']());}};_0x533474(++_0x597a77);}(_0xceb0,0x173));var _0x0ceb=function(_0x182cce,_0x24d039){_0x182cce=_0x182cce-0x0;var _0x21c88f=_0xceb0[_0x182cce];return _0x21c88f;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x0ceb('0x0'));var uuid=require('uuid');var utils=require(_0x0ceb('0x1'));var config=require(_0x0ceb('0x2'));var logger=require(_0x0ceb('0x3'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x0ceb('0x4')),'chatQueueReport':require(_0x0ceb('0x5')),'smsQueueReport':require(_0x0ceb('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0ceb('0x7'))};var RuleEngine=require(_0x0ceb('0x8'));function getId(_0x4ec03a,_0x9e53b7,_0x579edd){return util[_0x0ceb('0x9')](_0x0ceb('0xa'),_0x4ec03a,_0x9e53b7||0x0,_0x579edd||0x0);}function getIntervals(_0x376790,_0x5cf8a1){var _0x57d22a=[];if(!_[_0x0ceb('0xb')](_0x5cf8a1[_0x0ceb('0xc')])&&!_[_0x0ceb('0xb')](_0x376790[_0x5cf8a1[_0x0ceb('0xc')]])&&!_[_0x0ceb('0xb')](_0x376790[_0x5cf8a1[_0x0ceb('0xc')]]['Intervals'])){_0x57d22a=_[_0x0ceb('0xd')](_0x376790[_0x5cf8a1[_0x0ceb('0xc')]][_0x0ceb('0xe')],_0x0ceb('0xf'));}else if(!_[_0x0ceb('0xb')](_0x5cf8a1[_0x0ceb('0xf')])){_0x57d22a=[_0x5cf8a1[_0x0ceb('0xf')]];}return _0x57d22a;}exports['listen']=function(_0x416fbb){_0x416fbb['rules']={};return new BPromise(function(_0x55620b,_0x440f0e){var _0x2e6128={'Start':function(_0x218d6e){var _0x536bdd=this;return new Promise(function(_0x33a190,_0xc02d04){if(_0x218d6e){try{var _0x58d580=[];var _0x1dc6f5=getId(_0x218d6e[_0x0ceb('0x10')],_0x218d6e[_0x0ceb('0x11')]?_0x218d6e[_0x0ceb('0x11')]['id']:0x0,_0x218d6e[_0x0ceb('0x12')]?_0x218d6e[_0x0ceb('0x12')]['id']:0x0);if(_0x218d6e[_0x0ceb('0x13')]&&_[_0x0ceb('0x14')](_0x218d6e[_0x0ceb('0x13')])&&_0x218d6e[_0x0ceb('0x13')][_0x0ceb('0x15')]){for(var _0x18f845=0x0;_0x18f845<_0x218d6e[_0x0ceb('0x13')][_0x0ceb('0x15')];_0x18f845+=0x1){var _0x1d1478=_0x218d6e[_0x0ceb('0x13')][_0x18f845];if(fs[_0x0ceb('0x16')](path['join'](__dirname,'applications',_0x1d1478[_0x0ceb('0x17')]+_0x0ceb('0x18')))){var _0x5d1235=[];switch(_0x1d1478[_0x0ceb('0x17')]['toLowerCase']()){case _0x0ceb('0x19'):var _0xc2b85c=_0x1d1478[_0x0ceb('0x1a')][_0x0ceb('0x1b')](',');if(_0x218d6e[_0x0ceb('0x10')]==='mail'){_0x5d1235['push'](_0xc2b85c[0x0]);_0x5d1235['push'](_0xc2b85c[0x1]);_0x5d1235[_0x0ceb('0x1c')](_0xc2b85c['slice'](0x2,_0xc2b85c[_0x0ceb('0x15')])['join'](','));}else{_0x5d1235[_0x0ceb('0x1c')](_0xc2b85c[0x0]);_0x5d1235[_0x0ceb('0x1c')](_0xc2b85c[_0x0ceb('0x1d')](0x1,_0xc2b85c[_0x0ceb('0x15')])['join'](','));}break;case _0x0ceb('0x1e'):var _0x9246e1=_0x1d1478[_0x0ceb('0x1a')][_0x0ceb('0x1b')](',');_0x5d1235[_0x0ceb('0x1c')](_0x9246e1[0x0]);_0x5d1235['push'](_0x9246e1[0x1]);_0x5d1235[_0x0ceb('0x1c')](_0x9246e1[_0x0ceb('0x1d')](0x2,_0x9246e1[_0x0ceb('0x15')])[_0x0ceb('0x1f')](','));break;case _0x0ceb('0x20'):var _0x16265d=_0x1d1478['appdata'][_0x0ceb('0x1b')](',');_0x5d1235[_0x0ceb('0x1c')](_0x16265d[0x0]);_0x5d1235[_0x0ceb('0x1c')](_0x16265d[0x1]);_0x5d1235[_0x0ceb('0x1c')](_0x16265d[0x2]);_0x5d1235[_0x0ceb('0x1c')](_0x16265d[0x3]);_0x5d1235[_0x0ceb('0x1c')](_0x16265d[_0x0ceb('0x1d')](0x4,_0x16265d[_0x0ceb('0x15')])[_0x0ceb('0x1f')](','));break;case _0x0ceb('0x21'):var _0x5196ad=_0x1d1478[_0x0ceb('0x1a')][_0x0ceb('0x1b')](',');_0x5d1235['push'](_0x5196ad[0x0]);_0x5d1235[_0x0ceb('0x1c')](_0x5196ad[0x1]);_0x5d1235[_0x0ceb('0x1c')](_0x5196ad[0x2]);_0x5d1235[_0x0ceb('0x1c')](_0x5196ad[0x3]);_0x5d1235['push'](_0x5196ad[_0x0ceb('0x1d')](0x4,_0x5196ad[_0x0ceb('0x15')])[_0x0ceb('0x1f')](','));break;case _0x0ceb('0x11'):_0x5d1235[_0x0ceb('0x1c')](_0x1d1478[_0x0ceb('0x1a')]);break;case _0x0ceb('0x22'):_0x5d1235[_0x0ceb('0x1c')](_0x1d1478[_0x0ceb('0x23')]);_0x5d1235[_0x0ceb('0x1c')](_0x1d1478[_0x0ceb('0x1a')]);break;case _0x0ceb('0x24'):var _0x40b21e=utils['getMustacheRender'](_0x218d6e[_0x0ceb('0x25')][_0x0ceb('0x26')],_0x218d6e);var _0x802661=_0x1d1478[_0x0ceb('0x1a')][_0x0ceb('0x1b')](',');_0x5d1235[_0x0ceb('0x1c')](_0x802661[0x0]);_0x5d1235['push'](_0x802661[0x1]);_0x5d1235[_0x0ceb('0x1c')](_0x802661[0x2]);_0x5d1235['push'](_0x802661[0x3]);_0x5d1235['push'](_0x802661[0x4]);_0x5d1235['push'](_0x802661[0x5]);_0x5d1235[_0x0ceb('0x1c')](_0x802661[0x6]);_0x5d1235['push'](_0x802661[0x7]);_0x5d1235[_0x0ceb('0x1c')](_0x802661[0x8]);_0x5d1235[_0x0ceb('0x1c')](_0x802661[0x9]);_0x5d1235['push'](_0x802661[0xa]);_0x5d1235[_0x0ceb('0x1c')](_0x218d6e[_0x0ceb('0x12')]['id']);_0x5d1235[_0x0ceb('0x1c')](_0x218d6e['message']['id']);_0x5d1235[_0x0ceb('0x1c')](_0x1d1478[_0x0ceb('0x27')]);_0x5d1235[_0x0ceb('0x1c')](_0x218d6e[_0x0ceb('0x12')][_0x0ceb('0x28')]);_0x5d1235[_0x0ceb('0x1c')](_0x218d6e[_0x0ceb('0x29')][_0x0ceb('0x29')]);_0x5d1235[_0x0ceb('0x1c')](_0x40b21e);break;default:_0x5d1235=_[_0x0ceb('0xb')](_0x1d1478[_0x0ceb('0x1a')])?[]:_0x1d1478[_0x0ceb('0x1a')][_0x0ceb('0x1b')](',');}var _0x44099a={'id':util[_0x0ceb('0x9')](_0x0ceb('0x2a'),_0x1dc6f5,_0x1d1478['id'],_0x1d1478[_0x0ceb('0x17')]),'condition':require(_0x0ceb('0x2b'))[_0x0ceb('0x2c')](_0x1dc6f5,getIntervals(_0x416fbb[_0x0ceb('0x2d')],_0x1d1478),_0x416fbb),'consequence':require(_0x0ceb('0x2e')+_0x1d1478[_0x0ceb('0x17')])[_0x0ceb('0x2f')](_0x1dc6f5,_0x5d1235,_0x416fbb,_0x218d6e),'p':_0x1d1478[_0x0ceb('0x30')]||0x0};logger[_0x0ceb('0x31')](_0x0ceb('0x32'),_0x44099a['id'],_0x0ceb('0x33'),getIntervals(_0x416fbb[_0x0ceb('0x2d')],_0x1d1478)['join'](_0x0ceb('0x34')));_0x58d580['push'](_0x44099a);}else{logger['error'](_0x0ceb('0x35'),path[_0x0ceb('0x1f')](__dirname,_0x0ceb('0x13'),_0x1d1478['app']+'.js'));}}_0x416fbb[_0x0ceb('0x36')][_0x1dc6f5]=new RuleEngine(_0x58d580);_0x416fbb[_0x0ceb('0x36')][_0x1dc6f5][_0x0ceb('0x37')](_0x218d6e,function(_0x17ab4a){logger[_0x0ceb('0x31')](_0x0ceb('0x38'),JSON[_0x0ceb('0x39')](_0x17ab4a[_0x0ceb('0x3a')]));if(_0x416fbb[_0x0ceb('0x36')][_0x1dc6f5]){_0x416fbb['rules'][_0x1dc6f5][_0x0ceb('0x3b')](_0x0ceb('0x3c'));}});return _0x33a190({'code':0xc8,'message':_0x218d6e});}else{logger[_0x0ceb('0x31')](_0x0ceb('0x3d'));return _0x33a190({'code':0xc8,'message':_0x218d6e});}}catch(_0x55d310){logger[_0x0ceb('0x3e')](_0x55d310['stack']);return _0xc02d04(_0x536bdd[_0x0ceb('0x3e')](0x1f4,_0x55d310));}}return _0xc02d04('routing\x20is\x20empty');});},'AcceptMessage':function(_0x22c8e8){var _0x22c6d8=this;return new Promise(function(_0x20e067,_0x2eccc0){if(_0x22c8e8[_0x0ceb('0x3f')]&&_0x22c8e8[_0x0ceb('0x3f')]['id']){if(_0x416fbb[_0x0ceb('0x40')][_0x22c8e8[_0x0ceb('0x3f')]['id']]){_0x416fbb['agents'][_0x22c8e8[_0x0ceb('0x3f')]['id']][_0x0ceb('0x41')]=![];_0x416fbb['agents'][_0x22c8e8[_0x0ceb('0x3f')]['id']][_0x0ceb('0x42')]=undefined;}}if(_0x22c8e8[_0x0ceb('0x11')]&&_0x22c8e8[_0x0ceb('0x11')]['id']){try{var _0x135514=getId(_0x22c8e8['channel'],_0x22c8e8[_0x0ceb('0x11')]?_0x22c8e8[_0x0ceb('0x11')]['id']:0x0,_0x22c8e8[_0x0ceb('0x12')]?_0x22c8e8[_0x0ceb('0x12')]['id']:0x0);if(_0x416fbb[_0x0ceb('0x36')][_0x135514]){_0x416fbb[_0x0ceb('0x36')][_0x135514][_0x0ceb('0x3b')](_0x0ceb('0x43'));if(rpc[_0x22c8e8[_0x0ceb('0x10')]+'QueueReport']){rpc[_0x22c8e8[_0x0ceb('0x10')]+_0x0ceb('0x44')][_0x0ceb('0x45')](_0x135514,{'UserId':_0x22c8e8[_0x0ceb('0x11')]['UserId']})['catch'](function(_0x34a427){logger[_0x0ceb('0x3e')](_0x0ceb('0x46'));});}}return _0x20e067({'code':0xc8,'message':_0x22c8e8});}catch(_0x1631b9){logger[_0x0ceb('0x3e')](_0x1631b9['stack']);return _0x2eccc0(_0x22c6d8[_0x0ceb('0x3e')](0x1f4,_0x1631b9));}}logger[_0x0ceb('0x3e')]('message\x20is\x20empty');return _0x2eccc0(_0x22c6d8['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x348381){var _0x33a79b=this;return new Promise(function(_0x13fa76,_0x47c4d6){if(_0x348381[_0x0ceb('0x3f')]&&_0x348381[_0x0ceb('0x3f')]['id']){try{if(_0x416fbb['agents'][_0x348381[_0x0ceb('0x3f')]['id']]){_0x416fbb[_0x0ceb('0x40')][_0x348381[_0x0ceb('0x3f')]['id']]['busy']=![];_0x416fbb[_0x0ceb('0x40')][_0x348381['agent']['id']][_0x0ceb('0x42')]=undefined;}return _0x13fa76({'code':0xc8,'message':_0x348381});}catch(_0x1b1231){logger[_0x0ceb('0x3e')](_0x1b1231[_0x0ceb('0x47')]);return _0x47c4d6(_0x33a79b[_0x0ceb('0x3e')](0x1f4,_0x1b1231));}}logger['error'](_0x0ceb('0x48'));return _0x47c4d6(_0x33a79b[_0x0ceb('0x3e')](0x1f4,_0x0ceb('0x48')));});},'AbandonInteraction':function(_0x2e720e){var _0xf27696=this;return new Promise(function(_0x17369d,_0x179535){if(_0x2e720e[_0x0ceb('0x10')]&&_0x2e720e[_0x0ceb('0x12')]&&_0x2e720e[_0x0ceb('0x12')]['id']){try{var _0x5a8e86=getId(_0x2e720e[_0x0ceb('0x10')],_0x2e720e[_0x0ceb('0x11')]?_0x2e720e[_0x0ceb('0x11')]['id']:0x0,_0x2e720e[_0x0ceb('0x12')]?_0x2e720e[_0x0ceb('0x12')]['id']:0x0);if(_0x416fbb[_0x0ceb('0x36')][_0x5a8e86]){_0x416fbb[_0x0ceb('0x36')][_0x5a8e86]['emit'](_0x0ceb('0x43'));}return _0x17369d({'code':0xc8,'message':_0x2e720e});}catch(_0x391e2e){logger[_0x0ceb('0x3e')](_0x391e2e[_0x0ceb('0x47')]);return _0x179535(_0xf27696[_0x0ceb('0x3e')](0x1f4,_0x391e2e));}}logger[_0x0ceb('0x3e')](_0x0ceb('0x48'));return _0x179535(_0xf27696[_0x0ceb('0x3e')](0x1f4,_0x0ceb('0x48')));});},'AgentCapacity':function(_0x1d672c){var _0x42a084=this;return new Promise(function(_0x4d363e,_0x21ad16){if(_0x416fbb[_0x0ceb('0x40')][_0x0ceb('0x49')](_0x1d672c['id'])){for(var _0x1609c3 in _0x1d672c[_0x0ceb('0x4a')]){if(_0x1d672c['capacity'][_0x0ceb('0x49')](_0x1609c3)){if(_0x416fbb[_0x0ceb('0x40')][_0x1d672c['id']]['hasOwnProperty'](_0x1609c3+_0x0ceb('0x4b'))){_0x416fbb['agents'][_0x1d672c['id']][_0x1609c3+_0x0ceb('0x4b')]=parseInt(_0x1d672c[_0x0ceb('0x4a')][_0x1609c3],0xa);}}}_0x416fbb[_0x0ceb('0x40')][_0x1d672c['id']][_0x0ceb('0x4c')]();return _0x4d363e({'code':0xc8,'message':_0x416fbb[_0x0ceb('0x40')][_0x1d672c['id']]});}else{return _0x21ad16(_0x42a084['error'](0x1f4,_0x0ceb('0x4d')));}});},'Agents':function(_0x458f74){return new Promise(function(_0x41bfba,_0x1a7afd){var _0x4412f0=_[_0x0ceb('0x4e')](_0x416fbb['agents']);_0x41bfba({'count':_0x4412f0[_0x0ceb('0x15')],'rows':_0x4412f0});});},'ChatQueues':function(_0x11c6c8){return new Promise(function(_0x1d224c,_0x2b688f){var _0x500a70=[];for(var _0x5e53f8 in _0x416fbb[_0x0ceb('0x4f')]){if(_0x416fbb[_0x0ceb('0x4f')][_0x0ceb('0x49')](_0x5e53f8)){var _0x1cea3a=_0x416fbb[_0x0ceb('0x4f')][_0x5e53f8];var _0x27bc5e={'id':_0x1cea3a['id'],'available':_0x1cea3a[_0x0ceb('0x50')],'loggedIn':_0x1cea3a['loggedIn'],'name':_0x1cea3a[_0x0ceb('0x51')],'paused':_0x1cea3a[_0x0ceb('0x52')],'waiting':_0x1cea3a[_0x0ceb('0x53')]};_0x500a70[_0x0ceb('0x1c')](_0x27bc5e);}}_0x1d224c({'count':_0x500a70[_0x0ceb('0x15')],'rows':_0x500a70});});},'MailQueues':function(_0x187fe5){return new Promise(function(_0x1ad3b6,_0x193d66){var _0x14931f=[];for(var _0x397a12 in _0x416fbb[_0x0ceb('0x54')]){if(_0x416fbb['mailQueues'][_0x0ceb('0x49')](_0x397a12)){var _0x3ebfa0=_0x416fbb[_0x0ceb('0x54')][_0x397a12];var _0x12ea30={'id':_0x3ebfa0['id'],'available':_0x3ebfa0[_0x0ceb('0x50')],'loggedIn':_0x3ebfa0[_0x0ceb('0x55')],'name':_0x3ebfa0[_0x0ceb('0x51')],'paused':_0x3ebfa0['paused'],'waiting':_0x3ebfa0[_0x0ceb('0x53')]};_0x14931f[_0x0ceb('0x1c')](_0x12ea30);}}_0x1ad3b6({'count':_0x14931f[_0x0ceb('0x15')],'rows':_0x14931f});});},'OpenchannelQueues':function(_0x53025d){return new Promise(function(_0x3f5c74,_0x25903d){var _0x363b23=[];for(var _0x126a03 in _0x416fbb[_0x0ceb('0x56')]){if(_0x416fbb[_0x0ceb('0x56')][_0x0ceb('0x49')](_0x126a03)){var _0x107171=_0x416fbb[_0x0ceb('0x56')][_0x126a03];var _0x22ee40={'id':_0x107171['id'],'available':_0x107171['available'],'loggedIn':_0x107171[_0x0ceb('0x55')],'name':_0x107171[_0x0ceb('0x51')],'paused':_0x107171[_0x0ceb('0x52')],'waiting':_0x107171['waiting']};_0x363b23[_0x0ceb('0x1c')](_0x22ee40);}}_0x3f5c74({'count':_0x363b23[_0x0ceb('0x15')],'rows':_0x363b23});});},'SmsQueues':function(_0x1de261){return new Promise(function(_0x47df3f,_0x1f03b8){var _0x162b6a=[];for(var _0x2ecd82 in _0x416fbb[_0x0ceb('0x57')]){if(_0x416fbb[_0x0ceb('0x57')]['hasOwnProperty'](_0x2ecd82)){var _0x5e5505=_0x416fbb['smsQueues'][_0x2ecd82];var _0x1d4db7={'id':_0x5e5505['id'],'available':_0x5e5505['available'],'loggedIn':_0x5e5505[_0x0ceb('0x55')],'name':_0x5e5505[_0x0ceb('0x51')],'paused':_0x5e5505[_0x0ceb('0x52')],'waiting':_0x5e5505[_0x0ceb('0x53')]};_0x162b6a['push'](_0x1d4db7);}}_0x47df3f({'count':_0x162b6a[_0x0ceb('0x15')],'rows':_0x162b6a});});},'FaxQueues':function(_0x646746){return new Promise(function(_0x58e5a4,_0x21aa6a){var _0x5926ab=[];for(var _0x443763 in _0x416fbb[_0x0ceb('0x58')]){if(_0x416fbb[_0x0ceb('0x58')][_0x0ceb('0x49')](_0x443763)){var _0x5da5f6=_0x416fbb[_0x0ceb('0x58')][_0x443763];var _0x35c39f={'id':_0x5da5f6['id'],'available':_0x5da5f6[_0x0ceb('0x50')],'loggedIn':_0x5da5f6['loggedIn'],'name':_0x5da5f6[_0x0ceb('0x51')],'paused':_0x5da5f6['paused'],'waiting':_0x5da5f6[_0x0ceb('0x53')]};_0x5926ab[_0x0ceb('0x1c')](_0x35c39f);}}_0x58e5a4({'count':_0x5926ab[_0x0ceb('0x15')],'rows':_0x5926ab});});},'WhatsappQueues':function(_0x43dd7b){return new Promise(function(_0x2e1fff,_0x45a8c4){var _0x4a38da=[];for(var _0x1f95d4 in _0x416fbb[_0x0ceb('0x59')]){if(_0x416fbb[_0x0ceb('0x59')][_0x0ceb('0x49')](_0x1f95d4)){var _0x1b1b76=_0x416fbb[_0x0ceb('0x59')][_0x1f95d4];var _0x3b1e33={'id':_0x1b1b76['id'],'available':_0x1b1b76[_0x0ceb('0x50')],'loggedIn':_0x1b1b76['loggedIn'],'name':_0x1b1b76[_0x0ceb('0x51')],'paused':_0x1b1b76[_0x0ceb('0x52')],'waiting':_0x1b1b76[_0x0ceb('0x53')]};_0x4a38da['push'](_0x3b1e33);}}_0x2e1fff({'count':_0x4a38da[_0x0ceb('0x15')],'rows':_0x4a38da});});},'ChatQueuesWaitingInteractions':function(_0x30d683){return new Promise(function(_0x4702b9,_0x4e9de7){var _0x1f2afa=_['values'](_0x416fbb['chatQueuesWaitingInteractions']);_0x4702b9({'count':_0x1f2afa[_0x0ceb('0x15')],'rows':_0x1f2afa});});},'MailQueuesWaitingInteractions':function(_0x3b38d4){return new Promise(function(_0x47e287,_0x317b46){var _0x86891b=_['values'](_0x416fbb[_0x0ceb('0x5a')]);_0x47e287({'count':_0x86891b[_0x0ceb('0x15')],'rows':_0x86891b});});},'OpenchannelQueuesWaitingInteractions':function(_0x517162){return new Promise(function(_0x5efd29,_0x147f95){var _0x4322a2=_[_0x0ceb('0x4e')](_0x416fbb[_0x0ceb('0x5b')]);_0x5efd29({'count':_0x4322a2[_0x0ceb('0x15')],'rows':_0x4322a2});});},'SmsQueuesWaitingInteractions':function(_0x3b952a){return new Promise(function(_0x3023f0,_0x271056){var _0x5304ff=_[_0x0ceb('0x4e')](_0x416fbb[_0x0ceb('0x5c')]);_0x3023f0({'count':_0x5304ff[_0x0ceb('0x15')],'rows':_0x5304ff});});},'FaxQueuesWaitingInteractions':function(_0x31b748){return new Promise(function(_0xa1385,_0x37c7a9){var _0xeb7b18=_['values'](_0x416fbb[_0x0ceb('0x5d')]);_0xa1385({'count':_0xeb7b18[_0x0ceb('0x15')],'rows':_0xeb7b18});});},'WhatsappQueuesWaitingInteractions':function(_0xe5bdbf){return new Promise(function(_0x30b2b8,_0x2ce10c){var _0x1dde84=_['values'](_0x416fbb[_0x0ceb('0x5e')]);_0x30b2b8({'count':_0x1dde84[_0x0ceb('0x15')],'rows':_0x1dde84});});}};var _0x337ddf=jayson[_0x0ceb('0x5f')](_0x2e6128)[_0x0ceb('0x60')]();_0x337ddf['on'](_0x0ceb('0x3e'),function(_0x51cf8d){logger[_0x0ceb('0x3e')](JSON[_0x0ceb('0x39')](_0x51cf8d));return _0x440f0e(_0x51cf8d);});_0x337ddf[_0x0ceb('0x61')](0x232c,_0x0ceb('0x62'),function(){console[_0x0ceb('0x63')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x55620b(_0x0ceb('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 726d56b..3bb51ba 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 _0xc9c6=['bluebird','lodash','../../../config/logger','routing','client','request','then','error','rules','info','stop','push','Command','format','iftime\x20%s','message','true','catch','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xc9c6,0x186));var _0x6c9c=function(_0x4c6f66,_0x22e45a){_0x4c6f66=_0x4c6f66-0x0;var _0x1daea9=_0xc9c6[_0x4c6f66];return _0x1daea9;};'use strict';var util=require('util');var BPromise=require(_0x6c9c('0x0'));var jayson=require('jayson/promise');var _=require(_0x6c9c('0x1'));var logger=require(_0x6c9c('0x2'))(_0x6c9c('0x3'));var client=jayson[_0x6c9c('0x4')]['http']({'port':0x232a});function request(_0x39cd3b,_0x568621){return new BPromise(function(_0x240799,_0x1a1f47){return client[_0x6c9c('0x5')](_0x39cd3b,_0x568621)[_0x6c9c('0x6')](function(_0x1e7185){if(_0x1e7185[_0x6c9c('0x7')]){return _0x1a1f47(_0x1e7185[_0x6c9c('0x7')]['message']);}else{return _0x240799(_0x1e7185['result']);}})['catch'](function(_0x31c03c){return _0x1a1f47(_0x31c03c);});});}exports['condition']=function(_0x5cd506,_0x578d22,_0x42530c){return function(_0x2de9bc){if(_0x42530c[_0x6c9c('0x8')]&&!_0x42530c[_0x6c9c('0x8')][_0x5cd506]){logger[_0x6c9c('0x9')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5cd506);return _0x2de9bc[_0x6c9c('0xa')]();}var _0x2cf3c3=[];for(var _0x5b515e=0x0;_0x5b515e<_0x578d22['length'];_0x5b515e+=0x1){_0x2cf3c3[_0x6c9c('0xb')](request(_0x6c9c('0xc'),{'command':util[_0x6c9c('0xd')](_0x6c9c('0xe'),_0x578d22[_0x5b515e])})[_0x6c9c('0x6')](function(_0x1ad534){return _0x1ad534&&_0x1ad534[_0x6c9c('0xf')]&&_0x1ad534['message']['indexOf'](_0x6c9c('0x10'))>=0x0?!![]:![];})[_0x6c9c('0x11')](function(_0x5be079){logger[_0x6c9c('0x7')]('[%s][INTERVAL]\x20%s',_0x5cd506,_0x578d22[_0x5b515e]);}));}BPromise[_0x6c9c('0x12')](_0x2cf3c3)['then'](function(_0x3cfb50){var _0x5525d0=_[_0x6c9c('0x13')](_0x3cfb50);logger[_0x6c9c('0x9')](_0x6c9c('0x14'),_0x5cd506,_0x578d22[_0x6c9c('0x15')](_0x6c9c('0x16')),_0x5525d0);_0x2de9bc[_0x6c9c('0x17')](_0x5525d0);})[_0x6c9c('0x11')](function(_0x3cfe86){console[_0x6c9c('0x18')](_0x3cfe86);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x5cd506,_0x578d22[_0x6c9c('0x15')](_0x6c9c('0x16')),_0x3cfe86[_0x6c9c('0x19')]);_0x2de9bc['stop']();});};}; \ No newline at end of file +var _0x5afa=['when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','format','iftime\x20%s','true','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20'];(function(_0x258e3b,_0x21189e){var _0x53c455=function(_0x2c14cc){while(--_0x2c14cc){_0x258e3b['push'](_0x258e3b['shift']());}};_0x53c455(++_0x21189e);}(_0x5afa,0x137));var _0xa5af=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5afa[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0xa5af('0x0'));var BPromise=require(_0xa5af('0x1'));var jayson=require(_0xa5af('0x2'));var _=require(_0xa5af('0x3'));var logger=require(_0xa5af('0x4'))(_0xa5af('0x5'));var client=jayson[_0xa5af('0x6')][_0xa5af('0x7')]({'port':0x232a});function request(_0x47250c,_0x57fc3b){return new BPromise(function(_0x2f1bd3,_0x3e174d){return client[_0xa5af('0x8')](_0x47250c,_0x57fc3b)[_0xa5af('0x9')](function(_0x2c43cc){if(_0x2c43cc['error']){return _0x3e174d(_0x2c43cc[_0xa5af('0xa')][_0xa5af('0xb')]);}else{return _0x2f1bd3(_0x2c43cc['result']);}})[_0xa5af('0xc')](function(_0x10927d){return _0x3e174d(_0x10927d);});});}exports['condition']=function(_0x48de50,_0x14691c,_0x764241){return function(_0x300377){if(_0x764241['rules']&&!_0x764241[_0xa5af('0xd')][_0x48de50]){logger[_0xa5af('0xe')](_0xa5af('0xf'),_0x48de50);return _0x300377[_0xa5af('0x10')]();}var _0xac21b2=[];for(var _0x11bbc2=0x0;_0x11bbc2<_0x14691c['length'];_0x11bbc2+=0x1){_0xac21b2['push'](request(_0xa5af('0x11'),{'command':util[_0xa5af('0x12')](_0xa5af('0x13'),_0x14691c[_0x11bbc2])})[_0xa5af('0x9')](function(_0x199714){return _0x199714&&_0x199714[_0xa5af('0xb')]&&_0x199714['message']['indexOf'](_0xa5af('0x14'))>=0x0?!![]:![];})[_0xa5af('0xc')](function(_0x4a4109){logger[_0xa5af('0xa')]('[%s][INTERVAL]\x20%s',_0x48de50,_0x14691c[_0x11bbc2]);}));}BPromise[_0xa5af('0x15')](_0xac21b2)[_0xa5af('0x9')](function(_0x149890){var _0x25d209=_['some'](_0x149890);logger[_0xa5af('0xe')](_0xa5af('0x16'),_0x48de50,_0x14691c[_0xa5af('0x17')](_0xa5af('0x18')),_0x25d209);_0x300377[_0xa5af('0x19')](_0x25d209);})[_0xa5af('0xc')](function(_0x226fc2){console[_0xa5af('0x1a')](_0x226fc2);logger[_0xa5af('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0x48de50,_0x14691c[_0xa5af('0x17')]('\x20|\x20'),_0x226fc2[_0xa5af('0x1b')]);_0x300377[_0xa5af('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 58a88ce..f955e01 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 _0xa902=['agentringnoanswerAt','now','timeout','holdtime','ringtime','push','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','talktime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','format','channel','queue','membername','interface','calleridnum','connectedlinenum','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','destuniqueid','debug','agentcalledAt','lastevent','called','connectedlinename','info','uniqueid','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout'];(function(_0x3c7e43,_0xaca4e5){var _0x3bb5c5=function(_0x20aacc){while(--_0x20aacc){_0x3c7e43['push'](_0x3c7e43['shift']());}};_0x3bb5c5(++_0xaca4e5);}(_0xa902,0x8d));var _0x2a90=function(_0x11fde2,_0x118c3f){_0x11fde2=_0x11fde2-0x0;var _0x250972=_0xa902[_0x11fde2];return _0x250972;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var utils=require(_0x2a90('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3a1839,_0x1b4117){utils['info'](util[_0x2a90('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3a1839['uniqueid'],_0x3a1839[_0x2a90('0x4')],_0x3a1839[_0x2a90('0x5')],_0x3a1839[_0x2a90('0x6')],_0x3a1839[_0x2a90('0x7')],_0x3a1839[_0x2a90('0x8')],_0x3a1839[_0x2a90('0x9')],_0x3a1839['lastevent']));if(_0x3a1839[_0x2a90('0x5')]){utils['getVoiceQueueByName'](_0x3a1839['queue'])[_0x2a90('0xa')](function(_0x3dfc8f){if(_0x3dfc8f){_0x3a1839[_0x2a90('0xb')]=_0x3dfc8f[_0x2a90('0xb')];_0x3a1839[_0x2a90('0xc')]=_0x3a1839['agentcomplete']?_0x3dfc8f[_0x2a90('0xd')]:![];_0x3a1839[_0x2a90('0xe')]=_0x3a1839[_0x2a90('0xc')]?_0x3dfc8f[_0x2a90('0xf')]:0x0;}utils['request'](_0x2a90('0x10'),_0x3a1839);});}else{utils['request'](_0x2a90('0x10'),_0x3a1839);}if(_0x1b4117){delete transfers[_0x3a1839['uniqueid']];}else{delete agents[_0x3a1839[_0x2a90('0x11')]];}}exports['agentcalled']=function(_0x407ce5){try{utils[_0x2a90('0x12')](util[_0x2a90('0x3')]('[%s][agents][agentcalled]',_0x407ce5['uniqueid']),_0x407ce5);agents[_0x407ce5['destuniqueid']]=_0x407ce5;agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x13')]=utils['now']();agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x15');agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x9')]=null;agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x16')]=null;utils[_0x2a90('0x17')](util[_0x2a90('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x407ce5[_0x2a90('0x18')],agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x6')],_0x407ce5['destuniqueid']));}catch(_0x1facfb){utils[_0x2a90('0x19')](util[_0x2a90('0x3')](_0x2a90('0x1a'),_0x407ce5[_0x2a90('0x18')]),_0x1facfb);}};exports[_0x2a90('0x1b')]=function(_0x312cd5){try{if(!_[_0x2a90('0x1c')](agents[_0x312cd5[_0x2a90('0x11')]])){utils[_0x2a90('0x12')](util[_0x2a90('0x3')](_0x2a90('0x1d'),_0x312cd5['uniqueid']),_0x312cd5);utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x1e'),_0x312cd5[_0x2a90('0x18')],agents[_0x312cd5['destuniqueid']][_0x2a90('0x6')],_0x312cd5[_0x2a90('0x11')]));agents[_0x312cd5['destuniqueid']][_0x2a90('0x1b')]=!![];agents[_0x312cd5[_0x2a90('0x11')]][_0x2a90('0x1f')]=utils[_0x2a90('0x20')]();agents[_0x312cd5[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x21');agents[_0x312cd5[_0x2a90('0x11')]]['reason']=_0x2a90('0x21');agents[_0x312cd5[_0x2a90('0x11')]][_0x2a90('0x22')]=_0x312cd5[_0x2a90('0x23')]?parseInt(_0x312cd5[_0x2a90('0x23')])/0x3e8:0x0;agents[_0x312cd5['destuniqueid']]['talktime']=0x0;unanswered[_0x2a90('0x24')](_0x312cd5['destuniqueid']);}}catch(_0x53391e){utils['error'](util[_0x2a90('0x3')](_0x2a90('0x1d'),_0x312cd5['uniqueid']),_0x53391e);}};exports['queuecallerabandon']=function(_0x1add9a){try{_['forIn'](agents,function(_0x35570e,_0x6892e1){if(_0x35570e[_0x2a90('0x18')]==_0x1add9a[_0x2a90('0x18')]&&!_[_0x2a90('0x25')](unanswered,_0x35570e[_0x2a90('0x11')])){utils[_0x2a90('0x12')](util['format'](_0x2a90('0x26'),_0x1add9a[_0x2a90('0x18')]),_0x1add9a);utils[_0x2a90('0x17')](util['format'](_0x2a90('0x27'),_0x1add9a[_0x2a90('0x18')],_0x35570e[_0x2a90('0x6')],_0x35570e[_0x2a90('0x11')]));_0x35570e['agentringnoanswer']=!![];_0x35570e[_0x2a90('0x1f')]=utils[_0x2a90('0x20')]();_0x35570e[_0x2a90('0x14')]=_0x2a90('0x28');_0x35570e[_0x2a90('0x29')]=_0x2a90('0x28');_0x35570e['holdtime']=_0x1add9a[_0x2a90('0x22')];_0x35570e[_0x2a90('0x2a')]=0x0;writeDB(_0x35570e);}});}catch(_0x1bdebf){utils[_0x2a90('0x19')](util['format'](_0x2a90('0x26'),_0x1add9a[_0x2a90('0x18')]),_0x1bdebf);}};exports['agentconnect']=function(_0x3e5002){try{if(agents[_0x3e5002[_0x2a90('0x11')]]){utils['debug'](util['format'](_0x2a90('0x2b'),_0x3e5002[_0x2a90('0x18')]),_0x3e5002);utils[_0x2a90('0x17')](util['format'](_0x2a90('0x2c'),_0x3e5002['uniqueid'],agents[_0x3e5002[_0x2a90('0x11')]]['membername'],_0x3e5002[_0x2a90('0x11')]));agents[_0x3e5002['destuniqueid']]['agentconnectAt']=utils[_0x2a90('0x20')]();agents[_0x3e5002['destuniqueid']][_0x2a90('0x9')]=_0x3e5002[_0x2a90('0x9')];agents[_0x3e5002[_0x2a90('0x11')]]['connectedlinename']=_0x3e5002[_0x2a90('0x16')];agents[_0x3e5002[_0x2a90('0x11')]][_0x2a90('0x22')]=_0x3e5002['ringtime'];agents[_0x3e5002[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x2d');_['forIn'](agents,function(_0x1aa096,_0x1db9d8){if(_0x1aa096['destuniqueid']!=_0x3e5002[_0x2a90('0x11')]&&_0x1aa096[_0x2a90('0x18')]==_0x3e5002[_0x2a90('0x18')]){_0x1aa096[_0x2a90('0x2a')]=0x0;_0x1aa096[_0x2a90('0x22')]=_0x3e5002[_0x2a90('0x23')];_0x1aa096[_0x2a90('0x1b')]=!![];_0x1aa096[_0x2a90('0x1f')]=utils[_0x2a90('0x20')]();_0x1aa096[_0x2a90('0x14')]=_0x2a90('0x2e');_0x1aa096[_0x2a90('0x29')]=_0x2a90('0x2e');_0x1aa096[_0x2a90('0x2f')]=_0x3e5002['destuniqueid'];_0x1aa096[_0x2a90('0x30')]=_0x3e5002[_0x2a90('0x6')];writeDB(_0x1aa096);}});}}catch(_0x528b41){utils[_0x2a90('0x19')](util[_0x2a90('0x3')](_0x2a90('0x2b'),_0x3e5002[_0x2a90('0x18')]),_0x528b41);}};exports[_0x2a90('0x31')]=function(_0x54b290){try{if(!_[_0x2a90('0x1c')](agents[_0x54b290['destuniqueid']])){utils[_0x2a90('0x12')](util['format'](_0x2a90('0x32'),_0x54b290[_0x2a90('0x18')]),_0x54b290);utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x33'),_0x54b290[_0x2a90('0x18')],agents[_0x54b290[_0x2a90('0x11')]]['membername'],_0x54b290['destuniqueid']));agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x31')]=!![];agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x34')]=utils[_0x2a90('0x20')]();agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x2a')]=utils[_0x2a90('0x35')](agents[_0x54b290['destuniqueid']][_0x2a90('0x34')],agents[_0x54b290['destuniqueid']][_0x2a90('0x36')]);agents[_0x54b290[_0x2a90('0x11')]]['reason']=_0x54b290[_0x2a90('0x29')];agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x37');writeDB(agents[_0x54b290[_0x2a90('0x11')]]);}}catch(_0x43a931){utils[_0x2a90('0x19')](util['format']('[%s][agents][agentcomplete]',_0x54b290[_0x2a90('0x18')]),_0x43a931);}};exports[_0x2a90('0x38')]=function(_0x42c890){try{if(!_[_0x2a90('0x1c')](agents[_0x42c890[_0x2a90('0x39')]])){utils['debug'](util['format'](_0x2a90('0x3a'),_0x42c890[_0x2a90('0x18')]),_0x42c890);utils['info'](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x42c890[_0x2a90('0x18')],agents[_0x42c890['transfereruniqueid']][_0x2a90('0x6')],agents[_0x42c890[_0x2a90('0x39')]][_0x2a90('0x18')]));agents[_0x42c890[_0x2a90('0x39')]][_0x2a90('0x3b')]=!![];agents[_0x42c890[_0x2a90('0x39')]]['transfertype']=_0x2a90('0x3c');agents[_0x42c890[_0x2a90('0x39')]]['transferexten']=_0x42c890[_0x2a90('0x3d')];agents[_0x42c890['transfereruniqueid']]['transferuniqueid']=agents[_0x42c890[_0x2a90('0x39')]][_0x2a90('0x18')];}}catch(_0x5819ab){utils['error'](util[_0x2a90('0x3')]('[%s][agents][blindtransfer]',_0x42c890[_0x2a90('0x18')]),_0x5819ab);}};exports[_0x2a90('0x3e')]=function(_0x561bae){try{utils[_0x2a90('0x12')](util[_0x2a90('0x3')](_0x2a90('0x3f'),_0x561bae['origtransfereruniqueid']),_0x561bae);if(_0x561bae[_0x2a90('0x40')]==_0x561bae[_0x2a90('0x41')]){if(!_['isNil'](agents[_0x561bae['secondtransfereruniqueid']])){utils[_0x2a90('0x17')](util[_0x2a90('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x561bae[_0x2a90('0x40')],agents[_0x561bae['secondtransfereruniqueid']][_0x2a90('0x6')]));agents[_0x561bae['secondtransfereruniqueid']][_0x2a90('0x3b')]=!![];agents[_0x561bae[_0x2a90('0x42')]][_0x2a90('0x43')]='ATTENDED';agents[_0x561bae['secondtransfereruniqueid']]['transferexten']=_0x561bae[_0x2a90('0x44')];agents[_0x561bae[_0x2a90('0x42')]][_0x2a90('0x45')]=_0x561bae[_0x2a90('0x40')];}if(_0x561bae[_0x2a90('0x46')]&&agents[_0x561bae[_0x2a90('0x46')]]){agents[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x47')]=0x1;transfers[_0x561bae[_0x2a90('0x46')]]=_[_0x2a90('0x48')](agents[_0x561bae[_0x2a90('0x46')]]);transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x8')]=agents[_0x561bae['secondtransfereruniqueid']]['calleridnum'];transfers[_0x561bae['transfereeuniqueid']][_0x2a90('0x49')]=agents[_0x561bae[_0x2a90('0x42')]][_0x2a90('0x49')];transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x13')]=utils[_0x2a90('0x20')]();transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x36')]=utils[_0x2a90('0x20')]();transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x22')]=0x0;transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x47')]=0x2;}}else if(_0x561bae[_0x2a90('0x42')]==_0x561bae[_0x2a90('0x4a')]){if(!_[_0x2a90('0x1c')](agents[_0x561bae['origtransfereruniqueid']])){utils[_0x2a90('0x17')](util['format'](_0x2a90('0x4b'),_0x561bae[_0x2a90('0x40')],agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x6')]));agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x3b')]=!![];agents[_0x561bae[_0x2a90('0x40')]]['transfertype']=_0x2a90('0x4c');agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x4d')]=_0x561bae['secondtransfererexten'];agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x45')]=_0x561bae[_0x2a90('0x42')];}if(_0x561bae[_0x2a90('0x4e')]&&agents[_0x561bae['transfertargetuniqueid']]){agents[_0x561bae[_0x2a90('0x4e')]]['agententerreason']=0x1;transfers[_0x561bae[_0x2a90('0x4e')]]=_[_0x2a90('0x48')](agents[_0x561bae[_0x2a90('0x4e')]]);transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x8')]=agents[_0x561bae[_0x2a90('0x40')]]['calleridnum'];transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x49')]=agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x49')];transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x13')]=utils[_0x2a90('0x20')]();transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x36')]=utils['now']();transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x22')]=0x0;transfers[_0x561bae[_0x2a90('0x4e')]]['agententerreason']=0x2;}}}catch(_0x4404c1){utils[_0x2a90('0x19')](util[_0x2a90('0x3')](_0x2a90('0x3f'),_0x561bae[_0x2a90('0x40')]),_0x4404c1);}};exports['hangup']=function(_0x1bf94c){try{utils['debug'](util['format'](_0x2a90('0x4f'),_0x1bf94c['uniqueid']),_0x1bf94c);if(agents[_0x1bf94c['uniqueid']]&&agents[_0x1bf94c[_0x2a90('0x18')]]['reason']===_0x2a90('0x21')){if(_0x1bf94c[_0x2a90('0x50')]==='21'){agents[_0x1bf94c['uniqueid']]['reason']=_0x2a90('0x51');agents[_0x1bf94c['uniqueid']]['lastevent']=_0x2a90('0x51');}utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x52'),_0x1bf94c['uniqueid'],agents[_0x1bf94c['uniqueid']][_0x2a90('0x6')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x14')]));writeDB(agents[_0x1bf94c[_0x2a90('0x18')]]);var _0x3f4d12=unanswered[_0x2a90('0x53')](_0x1bf94c[_0x2a90('0x18')]);if(_0x3f4d12>-0x1){unanswered[_0x2a90('0x54')](_0x3f4d12,0x1);}}if(transfers[_0x1bf94c[_0x2a90('0x18')]]){transfers[_0x1bf94c[_0x2a90('0x18')]]['agentcomplete']=!![];transfers[_0x1bf94c[_0x2a90('0x18')]]['agentcompleteAt']=utils[_0x2a90('0x20')]();transfers[_0x1bf94c['uniqueid']][_0x2a90('0x2a')]=utils['diffTime'](transfers[_0x1bf94c['uniqueid']][_0x2a90('0x34')],transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x36')]);transfers[_0x1bf94c[_0x2a90('0x18')]]['reason']='agent';transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x14')]=_0x2a90('0x37');utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x52'),_0x1bf94c[_0x2a90('0x18')],transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x6')],transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')],transfers[_0x1bf94c[_0x2a90('0x18')]]['lastevent']));writeDB(transfers[_0x1bf94c[_0x2a90('0x18')]],!![]);}if(agents[_0x1bf94c[_0x2a90('0x18')]]&&agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x36')]){agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x31')]=!![];agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x34')]=utils['now']();agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x2a')]=utils['diffTime'](agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x34')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x36')]);agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')]=agents[_0x1bf94c['uniqueid']][_0x2a90('0x3b')]?_0x2a90('0x3b'):_0x2a90('0x55');agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x14')]=_0x2a90('0x37');utils[_0x2a90('0x17')](util[_0x2a90('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1bf94c[_0x2a90('0x18')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x6')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')],agents[_0x1bf94c[_0x2a90('0x18')]]['lastevent']));writeDB(agents[_0x1bf94c[_0x2a90('0x18')]]);}}catch(_0x44ce8d){utils[_0x2a90('0x19')](util['format'](_0x2a90('0x4f'),_0x1bf94c[_0x2a90('0x18')]),_0x44ce8d);}}; \ No newline at end of file +var _0x6f7a=['indexOf','splice','agent','complete','diffTime','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','error','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcomplete','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x6d3e1a,_0x2c8dcb){_0x6d3e1a=_0x6d3e1a-0x0;var _0x46d3b5=_0x6f7a[_0x6d3e1a];return _0x46d3b5;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var utils=require(_0xa6f7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x982062,_0x4dd99d){utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')](_0xa6f7('0x5'),_0x982062[_0xa6f7('0x6')],_0x982062[_0xa6f7('0x7')],_0x982062[_0xa6f7('0x8')],_0x982062[_0xa6f7('0x9')],_0x982062[_0xa6f7('0xa')],_0x982062[_0xa6f7('0xb')],_0x982062[_0xa6f7('0xc')],_0x982062[_0xa6f7('0xd')]));if(_0x982062['queue']){utils['getVoiceQueueByName'](_0x982062[_0xa6f7('0x8')])[_0xa6f7('0xe')](function(_0x397020){if(_0x397020){_0x982062[_0xa6f7('0xf')]=_0x397020[_0xa6f7('0xf')];_0x982062['agentacw']=_0x982062['agentcomplete']?_0x397020[_0xa6f7('0x10')]:![];_0x982062[_0xa6f7('0x11')]=_0x982062['agentacw']?_0x397020[_0xa6f7('0x12')]:0x0;}utils['request'](_0xa6f7('0x13'),_0x982062);});}else{utils[_0xa6f7('0x14')](_0xa6f7('0x13'),_0x982062);}if(_0x4dd99d){delete transfers[_0x982062[_0xa6f7('0x6')]];}else{delete agents[_0x982062['destuniqueid']];}}exports[_0xa6f7('0x15')]=function(_0x532352){try{utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')](_0xa6f7('0x17'),_0x532352['uniqueid']),_0x532352);agents[_0x532352[_0xa6f7('0x18')]]=_0x532352;agents[_0x532352['destuniqueid']][_0xa6f7('0x19')]=utils['now']();agents[_0x532352[_0xa6f7('0x18')]][_0xa6f7('0xd')]=_0xa6f7('0x1a');agents[_0x532352['destuniqueid']][_0xa6f7('0xc')]=null;agents[_0x532352[_0xa6f7('0x18')]][_0xa6f7('0x1b')]=null;utils[_0xa6f7('0x3')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x532352[_0xa6f7('0x6')],agents[_0x532352['destuniqueid']][_0xa6f7('0x9')],_0x532352[_0xa6f7('0x18')]));}catch(_0x5d16d0){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x17'),_0x532352[_0xa6f7('0x6')]),_0x5d16d0);}};exports[_0xa6f7('0x1d')]=function(_0x1aa8dc){try{if(!_['isNil'](agents[_0x1aa8dc[_0xa6f7('0x18')]])){utils[_0xa6f7('0x16')](util['format']('[%s][agents][agentringnoanswer]',_0x1aa8dc['uniqueid']),_0x1aa8dc);utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1aa8dc['uniqueid'],agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0x9')],_0x1aa8dc[_0xa6f7('0x18')]));agents[_0x1aa8dc[_0xa6f7('0x18')]]['agentringnoanswer']=!![];agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0x1e')]=utils['now']();agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0xd')]='timeout';agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x1f')]=_0xa6f7('0x20');agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x21')]=_0x1aa8dc['ringtime']?parseInt(_0x1aa8dc['ringtime'])/0x3e8:0x0;agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x22')]=0x0;unanswered['push'](_0x1aa8dc[_0xa6f7('0x18')]);}}catch(_0x27babb){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x23'),_0x1aa8dc[_0xa6f7('0x6')]),_0x27babb);}};exports[_0xa6f7('0x24')]=function(_0x54f72c){try{_[_0xa6f7('0x25')](agents,function(_0x3dee2e,_0x40b0f8){if(_0x3dee2e[_0xa6f7('0x6')]==_0x54f72c['uniqueid']&&!_[_0xa6f7('0x26')](unanswered,_0x3dee2e[_0xa6f7('0x18')])){utils['debug'](util[_0xa6f7('0x4')](_0xa6f7('0x27'),_0x54f72c['uniqueid']),_0x54f72c);utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x28'),_0x54f72c[_0xa6f7('0x6')],_0x3dee2e[_0xa6f7('0x9')],_0x3dee2e[_0xa6f7('0x18')]));_0x3dee2e['agentringnoanswer']=!![];_0x3dee2e['agentringnoanswerAt']=utils[_0xa6f7('0x29')]();_0x3dee2e['lastevent']=_0xa6f7('0x2a');_0x3dee2e[_0xa6f7('0x1f')]=_0xa6f7('0x2a');_0x3dee2e[_0xa6f7('0x21')]=_0x54f72c[_0xa6f7('0x21')];_0x3dee2e[_0xa6f7('0x22')]=0x0;writeDB(_0x3dee2e);}});}catch(_0x4d2d38){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x27'),_0x54f72c['uniqueid']),_0x4d2d38);}};exports[_0xa6f7('0x2b')]=function(_0x5ab03d){try{if(agents[_0x5ab03d[_0xa6f7('0x18')]]){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][agentconnect]',_0x5ab03d[_0xa6f7('0x6')]),_0x5ab03d);utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')](_0xa6f7('0x2c'),_0x5ab03d[_0xa6f7('0x6')],agents[_0x5ab03d[_0xa6f7('0x18')]]['membername'],_0x5ab03d[_0xa6f7('0x18')]));agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0x2d')]=utils[_0xa6f7('0x29')]();agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0xc')]=_0x5ab03d[_0xa6f7('0xc')];agents[_0x5ab03d[_0xa6f7('0x18')]]['connectedlinename']=_0x5ab03d[_0xa6f7('0x1b')];agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0x21')]=_0x5ab03d['ringtime'];agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0xd')]='connect';_[_0xa6f7('0x25')](agents,function(_0x13c7c4,_0x3ecb88){if(_0x13c7c4[_0xa6f7('0x18')]!=_0x5ab03d[_0xa6f7('0x18')]&&_0x13c7c4['uniqueid']==_0x5ab03d[_0xa6f7('0x6')]){_0x13c7c4[_0xa6f7('0x22')]=0x0;_0x13c7c4[_0xa6f7('0x21')]=_0x5ab03d[_0xa6f7('0x2e')];_0x13c7c4[_0xa6f7('0x1d')]=!![];_0x13c7c4[_0xa6f7('0x1e')]=utils[_0xa6f7('0x29')]();_0x13c7c4[_0xa6f7('0xd')]='answered_elsewhere';_0x13c7c4['reason']=_0xa6f7('0x2f');_0x13c7c4[_0xa6f7('0x30')]=_0x5ab03d[_0xa6f7('0x18')];_0x13c7c4[_0xa6f7('0x31')]=_0x5ab03d[_0xa6f7('0x9')];writeDB(_0x13c7c4);}});}}catch(_0x387714){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x32'),_0x5ab03d[_0xa6f7('0x6')]),_0x387714);}};exports['agentcomplete']=function(_0x41917c){try{if(!_[_0xa6f7('0x33')](agents[_0x41917c['destuniqueid']])){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')](_0xa6f7('0x34'),_0x41917c[_0xa6f7('0x6')]),_0x41917c);utils['info'](util[_0xa6f7('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x41917c['uniqueid'],agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x9')],_0x41917c[_0xa6f7('0x18')]));agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x35')]=!![];agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x36')]=utils['now']();agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x22')]=utils['diffTime'](agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x36')],agents[_0x41917c[_0xa6f7('0x18')]]['agentconnectAt']);agents[_0x41917c[_0xa6f7('0x18')]]['reason']=_0x41917c[_0xa6f7('0x1f')];agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0xd')]='complete';writeDB(agents[_0x41917c['destuniqueid']]);}}catch(_0x2b06b5){utils['error'](util[_0xa6f7('0x4')]('[%s][agents][agentcomplete]',_0x41917c['uniqueid']),_0x2b06b5);}};exports[_0xa6f7('0x37')]=function(_0x2e3a04){try{if(!_[_0xa6f7('0x33')](agents[_0x2e3a04[_0xa6f7('0x38')]])){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][blindtransfer]',_0x2e3a04[_0xa6f7('0x6')]),_0x2e3a04);utils[_0xa6f7('0x3')](util['format'](_0xa6f7('0x39'),_0x2e3a04['uniqueid'],agents[_0x2e3a04[_0xa6f7('0x38')]]['membername'],agents[_0x2e3a04['transfereruniqueid']][_0xa6f7('0x6')]));agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3a')]=!![];agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3b')]='blind';agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3c')]=_0x2e3a04['extension'];agents[_0x2e3a04[_0xa6f7('0x38')]]['transferuniqueid']=agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x6')];}}catch(_0x134dd7){utils['error'](util[_0xa6f7('0x4')]('[%s][agents][blindtransfer]',_0x2e3a04[_0xa6f7('0x6')]),_0x134dd7);}};exports[_0xa6f7('0x3d')]=function(_0x236372){try{utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][attendedtransfer]',_0x236372['origtransfereruniqueid']),_0x236372);if(_0x236372[_0xa6f7('0x3e')]==_0x236372[_0xa6f7('0x3f')]){if(!_[_0xa6f7('0x33')](agents[_0x236372[_0xa6f7('0x40')]])){utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x41'),_0x236372[_0xa6f7('0x3e')],agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x9')]));agents[_0x236372[_0xa6f7('0x40')]]['transfer']=!![];agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x3b')]=_0xa6f7('0x42');agents[_0x236372['secondtransfereruniqueid']][_0xa6f7('0x3c')]=_0x236372[_0xa6f7('0x43')];agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x44')]=_0x236372['origtransfereruniqueid'];}if(_0x236372['transfereeuniqueid']&&agents[_0x236372[_0xa6f7('0x45')]]){agents[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x46')]=0x1;transfers[_0x236372[_0xa6f7('0x45')]]=_[_0xa6f7('0x47')](agents[_0x236372[_0xa6f7('0x45')]]);transfers[_0x236372[_0xa6f7('0x45')]]['calleridnum']=agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0xb')];transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x48')]=agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x48')];transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x19')]=utils[_0xa6f7('0x29')]();transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x2d')]=utils['now']();transfers[_0x236372[_0xa6f7('0x45')]]['holdtime']=0x0;transfers[_0x236372[_0xa6f7('0x45')]]['agententerreason']=0x2;}}else if(_0x236372[_0xa6f7('0x40')]==_0x236372[_0xa6f7('0x49')]){if(!_['isNil'](agents[_0x236372[_0xa6f7('0x3e')]])){utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x236372[_0xa6f7('0x3e')],agents[_0x236372['origtransfereruniqueid']][_0xa6f7('0x9')]));agents[_0x236372[_0xa6f7('0x3e')]]['transfer']=!![];agents[_0x236372[_0xa6f7('0x3e')]]['transfertype']=_0xa6f7('0x42');agents[_0x236372['origtransfereruniqueid']][_0xa6f7('0x3c')]=_0x236372[_0xa6f7('0x4a')];agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0x44')]=_0x236372[_0xa6f7('0x40')];}if(_0x236372[_0xa6f7('0x4b')]&&agents[_0x236372[_0xa6f7('0x4b')]]){agents[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x46')]=0x1;transfers[_0x236372[_0xa6f7('0x4b')]]=_[_0xa6f7('0x47')](agents[_0x236372[_0xa6f7('0x4b')]]);transfers[_0x236372['transfertargetuniqueid']][_0xa6f7('0xb')]=agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0xb')];transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x48')]=agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0x48')];transfers[_0x236372[_0xa6f7('0x4b')]]['agentcalledAt']=utils[_0xa6f7('0x29')]();transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x2d')]=utils['now']();transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x21')]=0x0;transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x46')]=0x2;}}}catch(_0x1a1055){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x4c'),_0x236372['origtransfereruniqueid']),_0x1a1055);}};exports['hangup']=function(_0x265194){try{utils[_0xa6f7('0x16')](util['format'](_0xa6f7('0x4d'),_0x265194[_0xa6f7('0x6')]),_0x265194);if(agents[_0x265194[_0xa6f7('0x6')]]&&agents[_0x265194['uniqueid']][_0xa6f7('0x1f')]==='timeout'){if(_0x265194['cause']==='21'){agents[_0x265194['uniqueid']]['reason']='rejected';agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]=_0xa6f7('0x4e');}utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x4f'),_0x265194[_0xa6f7('0x6')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]));writeDB(agents[_0x265194[_0xa6f7('0x6')]]);var _0x55ad6b=unanswered[_0xa6f7('0x50')](_0x265194[_0xa6f7('0x6')]);if(_0x55ad6b>-0x1){unanswered[_0xa6f7('0x51')](_0x55ad6b,0x1);}}if(transfers[_0x265194[_0xa6f7('0x6')]]){transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x35')]=!![];transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x36')]=utils[_0xa6f7('0x29')]();transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x22')]=utils['diffTime'](transfers[_0x265194['uniqueid']][_0xa6f7('0x36')],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]);transfers[_0x265194['uniqueid']][_0xa6f7('0x1f')]=_0xa6f7('0x52');transfers[_0x265194['uniqueid']][_0xa6f7('0xd')]=_0xa6f7('0x53');utils['info'](util['format'](_0xa6f7('0x4f'),_0x265194['uniqueid'],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],transfers[_0x265194['uniqueid']]['reason'],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]));writeDB(transfers[_0x265194[_0xa6f7('0x6')]],!![]);}if(agents[_0x265194['uniqueid']]&&agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]){agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x35')]=!![];agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x36')]=utils[_0xa6f7('0x29')]();agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x22')]=utils[_0xa6f7('0x54')](agents[_0x265194[_0xa6f7('0x6')]]['agentcompleteAt'],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]);agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')]=agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x3a')]?'transfer':_0xa6f7('0x52');agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]=_0xa6f7('0x53');utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x265194['uniqueid'],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')],agents[_0x265194[_0xa6f7('0x6')]]['lastevent']));writeDB(agents[_0x265194[_0xa6f7('0x6')]]);}}catch(_0x4c7383){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')]('[%s][agents][hangup]',_0x265194['uniqueid']),_0x4c7383);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index eed90b0..d4ca2ae 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 _0x0023=['origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','appdata','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','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','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','linkedid','OutgoingSpoolFailed','exten','calleridnum','context','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','billableseconds','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]'];(function(_0x309363,_0x58b7c4){var _0x411fa2=function(_0x4e001a){while(--_0x4e001a){_0x309363['push'](_0x309363['shift']());}};_0x411fa2(++_0x58b7c4);}(_0x0023,0x10a));var _0x3002=function(_0x280efe,_0x1c7333){_0x280efe=_0x280efe-0x0;var _0x4808d1=_0x0023[_0x280efe];return _0x4808d1;};'use strict';var _=require(_0x3002('0x0'));var util=require('util');var utils=require(_0x3002('0x1'));var transfers=require(_0x3002('0x2'));var dispositions=[_0x3002('0x3'),_0x3002('0x4'),'FAILED',_0x3002('0x3'),_0x3002('0x3'),'NO\x20ANSWER',_0x3002('0x5'),'BUSY',_0x3002('0x4'),_0x3002('0x4'),_0x3002('0x4')];var channels={};function writeDB(_0x77f084){var _0x1f7523;if(transfers[_0x3002('0x6')][_0x77f084['uniqueid']]){_0x1f7523=_0x77f084[_0x3002('0x7')];_0x77f084['uniqueid']=transfers[_0x3002('0x6')][_0x77f084[_0x3002('0x7')]][_0x3002('0x8')];}utils[_0x3002('0x9')](util[_0x3002('0xa')](_0x3002('0xb'),_0x77f084['uniqueid'],_0x77f084[_0x3002('0xc')],_0x77f084[_0x3002('0xd')],_0x77f084[_0x3002('0xe')],_0x77f084[_0x3002('0xf')],_0x77f084['calleridnum'],_0x77f084[_0x3002('0x10')],_0x77f084[_0x3002('0x11')]));if(_0x77f084[_0x3002('0x12')]){utils[_0x3002('0x13')](_0x77f084[_0x3002('0x12')])[_0x3002('0x14')](function(_0x2148b6){if(_0x2148b6){_0x77f084[_0x3002('0x15')]=_0x2148b6['id'];}utils[_0x3002('0x16')](_0x3002('0x17'),_0x77f084);});}else{utils[_0x3002('0x16')](_0x3002('0x17'),_0x77f084);}if(channels[_0x77f084['uniqueid']]){delete channels[_0x77f084[_0x3002('0x7')]];}else if(_0x1f7523&&channels[_0x1f7523]){if(!transfers['blinds'][_0x1f7523][_0x3002('0x18')])delete transfers['blinds'][_0x1f7523];delete channels[_0x1f7523];}}exports['newchannel']=function(_0x3628f9){try{utils['debug'](util[_0x3002('0xa')]('[%s][calls][newchannel]',_0x3628f9['uniqueid']),_0x3628f9);if(_0x3628f9[_0x3002('0x7')]==_0x3628f9[_0x3002('0x19')]&&_0x3628f9[_0x3002('0xc')]!=_0x3002('0x1a')){utils[_0x3002('0x9')](util[_0x3002('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3628f9[_0x3002('0x7')],_0x3628f9['context'],_0x3628f9[_0x3002('0x1b')]));channels[_0x3628f9[_0x3002('0x7')]]={'uniqueid':_0x3628f9[_0x3002('0x7')],'accountcode':_0x3628f9['accountcode'],'source':_0x3628f9[_0x3002('0x1c')],'destination':_0x3628f9[_0x3002('0x1b')],'destinationcontext':_0x3628f9[_0x3002('0x1d')],'channel':_0x3628f9['channel'],'starttime':utils[_0x3002('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3002('0x3'),'amaflags':_0x3002('0x1f')};}}catch(_0xe953f9){utils['error'](util[_0x3002('0xa')](_0x3002('0x20'),_0x3628f9[_0x3002('0x7')]),_0xe953f9);}};exports[_0x3002('0x21')]=function(_0x14cdb4){try{utils[_0x3002('0x22')](util[_0x3002('0xa')](_0x3002('0x23'),_0x14cdb4[_0x3002('0x7')]),_0x14cdb4);if(!_['isNil'](channels[_0x14cdb4[_0x3002('0x7')]])&&_0x14cdb4[_0x3002('0x24')]==0x6){utils[_0x3002('0x9')](util[_0x3002('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x14cdb4[_0x3002('0x7')],_0x14cdb4[_0x3002('0x1d')],_0x14cdb4[_0x3002('0xc')]));if(_[_0x3002('0x25')](channels[_0x14cdb4[_0x3002('0x7')]][_0x3002('0x26')])){channels[_0x14cdb4['uniqueid']][_0x3002('0x26')]=utils[_0x3002('0x1e')]();}}else if(!_[_0x3002('0x25')](channels[_0x14cdb4[_0x3002('0x19')]])&&_0x14cdb4[_0x3002('0x24')]==0x6&&_0x14cdb4['context']!=_0x3002('0x27')){utils['info'](util['format'](_0x3002('0x28'),_0x14cdb4[_0x3002('0x7')],_0x14cdb4[_0x3002('0x19')],_0x14cdb4[_0x3002('0x1d')],_0x14cdb4[_0x3002('0xc')]));channels[_0x14cdb4[_0x3002('0x19')]][_0x3002('0x12')]=_0x14cdb4['accountcode'];channels[_0x14cdb4[_0x3002('0x19')]][_0x3002('0x29')]=_0x14cdb4['channel'];if(_[_0x3002('0x25')](channels[_0x14cdb4['linkedid']][_0x3002('0x2a')])){channels[_0x14cdb4[_0x3002('0x19')]][_0x3002('0x2a')]=utils[_0x3002('0x1e')]();}channels[_0x14cdb4['linkedid']][_0x3002('0x2b')]=dispositions[_[_0x3002('0x2c')](_0x14cdb4[_0x3002('0x24')])]||_0x3002('0x5');}}catch(_0x1822d6){utils['error'](util[_0x3002('0xa')](_0x3002('0x23'),_0x14cdb4[_0x3002('0x7')]),_0x1822d6);}};exports[_0x3002('0x2d')]=function(_0x52e27c){try{if(!_[_0x3002('0x25')](channels[_0x52e27c['uniqueid']])){utils[_0x3002('0x22')](util[_0x3002('0xa')](_0x3002('0x2e'),_0x52e27c['uniqueid']),_0x52e27c);if(_['isNil'](channels[_0x52e27c[_0x3002('0x7')]][_0x3002('0x2f')])){channels[_0x52e27c[_0x3002('0x7')]][_0x3002('0x2f')]=_0x52e27c[_0x3002('0x30')]+'\x20<'+_0x52e27c[_0x3002('0x1c')]+'>';}utils['info'](util[_0x3002('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x52e27c[_0x3002('0x7')],channels[_0x52e27c[_0x3002('0x7')]][_0x3002('0x2f')],_0x52e27c[_0x3002('0x31')]));channels[_0x52e27c[_0x3002('0x7')]][_0x3002('0x32')]=utils[_0x3002('0x1e')]();channels[_0x52e27c[_0x3002('0x7')]][_0x3002('0x33')]=utils[_0x3002('0x34')](channels[_0x52e27c['uniqueid']][_0x3002('0x32')],channels[_0x52e27c[_0x3002('0x7')]]['starttime']);channels[_0x52e27c[_0x3002('0x7')]][_0x3002('0x35')]=channels[_0x52e27c[_0x3002('0x7')]]['answertime']?utils[_0x3002('0x34')](channels[_0x52e27c[_0x3002('0x7')]][_0x3002('0x32')],channels[_0x52e27c[_0x3002('0x7')]]['answertime']):0x0;writeDB(channels[_0x52e27c[_0x3002('0x7')]]);}}catch(_0x40c899){utils[_0x3002('0x36')](util[_0x3002('0xa')](_0x3002('0x2e'),_0x52e27c[_0x3002('0x7')]),_0x40c899);}};exports[_0x3002('0x37')]=function(_0x3cbf07){try{if(!_['isNil'](channels[_0x3cbf07[_0x3002('0x38')]])){utils[_0x3002('0x22')](util[_0x3002('0xa')](_0x3002('0x39'),_0x3cbf07[_0x3002('0x3a')]),_0x3cbf07);if(channels[_0x3cbf07[_0x3002('0x38')]][_0x3002('0xc')]==_0x3cbf07[_0x3002('0x3b')]){utils[_0x3002('0x9')](util[_0x3002('0xa')](_0x3002('0x3c'),_0x3cbf07[_0x3002('0x3a')],_0x3cbf07[_0x3002('0x38')],_0x3cbf07[_0x3002('0x3d')]));channels[_0x3cbf07[_0x3002('0x38')]][_0x3002('0x29')]=_0x3cbf07[_0x3002('0x3d')];channels[_0x3cbf07[_0x3002('0x38')]][_0x3002('0x3e')]=_0x3002('0x3f');}else if(channels[_0x3cbf07[_0x3002('0x38')]][_0x3002('0xc')]=_0x3cbf07['transfertargetchannel']){utils[_0x3002('0x9')](util[_0x3002('0xa')](_0x3002('0x3c'),_0x3cbf07[_0x3002('0x3a')],_0x3cbf07[_0x3002('0x38')],_0x3cbf07['origtransfererchannel']));channels[_0x3cbf07[_0x3002('0x38')]]['destinationchannel']=_0x3cbf07[_0x3002('0x40')];channels[_0x3cbf07['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x265d73){utils['error'](util[_0x3002('0xa')](_0x3002('0x39'),_0x3cbf07[_0x3002('0x3a')]),_0x265d73);}};exports['musiconholdstart']=function(_0x550755){try{if(!_[_0x3002('0x25')](channels[_0x550755[_0x3002('0x7')]])){utils[_0x3002('0x22')](util[_0x3002('0xa')](_0x3002('0x41'),_0x550755[_0x3002('0x7')]),_0x550755);channels[_0x550755[_0x3002('0x7')]][_0x3002('0x42')]=utils[_0x3002('0x1e')]();utils['info'](util['format'](_0x3002('0x43'),_0x550755[_0x3002('0x7')],channels[_0x550755[_0x3002('0x7')]][_0x3002('0x42')]));}}catch(_0x2af362){utils['error'](util[_0x3002('0xa')]('[%s][calls][musiconholdstart]',_0x550755[_0x3002('0x7')]),_0x2af362);}};exports['musiconholdstop']=function(_0x653622){try{if(!_[_0x3002('0x25')](channels[_0x653622['uniqueid']])){utils[_0x3002('0x22')](util['format']('[%s][calls][musiconholdstop]',_0x653622[_0x3002('0x7')]),_0x653622);if(!_[_0x3002('0x25')](channels[_0x653622[_0x3002('0x7')]]['musiconholdstartAt'])){channels[_0x653622[_0x3002('0x7')]][_0x3002('0x44')]+=utils[_0x3002('0x34')](utils['now'](),channels[_0x653622['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x3002('0xa')](_0x3002('0x45'),_0x653622[_0x3002('0x7')],channels[_0x653622[_0x3002('0x7')]][_0x3002('0x44')]));delete channels[_0x653622[_0x3002('0x7')]]['musiconholdstartAt'];}}}catch(_0x32838b){utils['error'](util[_0x3002('0xa')](_0x3002('0x46'),_0x653622[_0x3002('0x7')]),_0x32838b);}};exports['varset']=function(_0x349c38){try{if(!_[_0x3002('0x25')](channels[_0x349c38[_0x3002('0x7')]])){utils[_0x3002('0x22')](util['format'](_0x3002('0x47'),_0x349c38[_0x3002('0x7')]),_0x349c38);if(!_['isNil'](_0x349c38['variable']['xmd-originatecalleridnum'])){utils[_0x3002('0x9')](util[_0x3002('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x349c38[_0x3002('0x7')],_0x349c38['value']));channels[_0x349c38[_0x3002('0x7')]][_0x3002('0x48')]=_0x349c38[_0x3002('0x49')];}if(!_['isNil'](_0x349c38['variable'][_0x3002('0x4a')])){utils[_0x3002('0x9')](util['format'](_0x3002('0x4b'),_0x349c38[_0x3002('0x7')],_0x349c38[_0x3002('0x49')]));channels[_0x349c38[_0x3002('0x7')]][_0x3002('0x4c')]=_0x349c38['value'];channels[_0x349c38[_0x3002('0x7')]]['callerid']='\x22'+_0x349c38['value']+_0x3002('0x4d')+_0x349c38['value']+'>';}if(!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')][_0x3002('0x4f')])||!_[_0x3002('0x25')](_0x349c38['variable']['xmd-callerid'])){utils[_0x3002('0x9')](util[_0x3002('0xa')](_0x3002('0x50'),_0x349c38[_0x3002('0x7')],!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')]['xmd-callerid-preview'])?_0x3002('0x4f'):_0x3002('0x51'),_0x349c38[_0x3002('0x49')]));channels[_0x349c38[_0x3002('0x7')]][_0x3002('0x2f')]=_0x349c38['value'];}if(!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')][_0x3002('0x52')])||!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')][_0x3002('0x53')])){utils[_0x3002('0x9')](util[_0x3002('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x349c38[_0x3002('0x7')],!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')][_0x3002('0x52')])?_0x3002('0x52'):_0x3002('0x53'),_0x349c38['value']));channels[_0x349c38[_0x3002('0x7')]]['lastapplication']=_0x3002('0x54');channels[_0x349c38['uniqueid']][_0x3002('0x55')]=_0x349c38[_0x3002('0x49')];channels[_0x349c38[_0x3002('0x7')]][_0x3002('0xd')]=!![];}if(!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')][_0x3002('0x56')])){utils[_0x3002('0x9')](util[_0x3002('0xa')](_0x3002('0x57'),_0x349c38[_0x3002('0x7')],_0x349c38['value']));channels[_0x349c38['uniqueid']][_0x3002('0x58')]=_0x349c38[_0x3002('0x49')];}if(!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')][_0x3002('0x59')])){utils[_0x3002('0x9')](util[_0x3002('0xa')](_0x3002('0x5a'),_0x349c38[_0x3002('0x7')],_0x349c38[_0x3002('0x49')]));channels[_0x349c38[_0x3002('0x7')]][_0x3002('0x5b')]=_0x349c38[_0x3002('0x49')];}if(!_[_0x3002('0x25')](_0x349c38['variable'][_0x3002('0x5c')])){utils[_0x3002('0x9')](util[_0x3002('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x349c38['uniqueid'],_0x349c38['value']));channels[_0x349c38[_0x3002('0x7')]][_0x3002('0x5d')]=_0x349c38['value'];}if(!_[_0x3002('0x25')](_0x349c38[_0x3002('0x4e')]['sipcallid'])){utils[_0x3002('0x9')](util[_0x3002('0xa')](_0x3002('0x5e'),_0x349c38[_0x3002('0x7')],_0x349c38[_0x3002('0x49')]));channels[_0x349c38['uniqueid']][_0x3002('0x5f')]=_0x349c38['value'];}}}catch(_0x4dbd4c){utils[_0x3002('0x36')](util[_0x3002('0xa')](_0x3002('0x47'),_0x349c38[_0x3002('0x7')]),_0x4dbd4c);}};exports['newexten']=function(_0x5f32fd){try{if(!_[_0x3002('0x25')](channels[_0x5f32fd[_0x3002('0x7')]])){utils[_0x3002('0x22')](util['format'](_0x3002('0x60'),_0x5f32fd[_0x3002('0x7')]),_0x5f32fd);utils['info'](util['format'](_0x3002('0x61'),_0x5f32fd[_0x3002('0x7')],_0x5f32fd[_0x3002('0x62')],_0x5f32fd['appdata']));if(_0x5f32fd[_0x3002('0x62')][_0x3002('0x63')]()=='set'&&_['startsWith'](_0x5f32fd[_0x3002('0x64')][_0x3002('0x63')](),'cdr')){var _0x19dc51=_0x5f32fd[_0x3002('0x64')]['split']('=');var _0x1ebc14=_0x19dc51[0x0][_0x3002('0x65')](_0x19dc51[0x0][_0x3002('0x66')]('(')+0x1,_0x19dc51[0x0]['lastIndexOf'](')'));var _0x183256=_0x19dc51[0x1];channels[_0x5f32fd[_0x3002('0x7')]][_0x1ebc14]=_0x183256;}if(!_[_0x3002('0x67')](['hangup',_0x3002('0x68'),_0x3002('0x69'),_0x3002('0x6a'),_0x3002('0x6b')],_0x5f32fd[_0x3002('0x62')][_0x3002('0x63')]())){channels[_0x5f32fd['uniqueid']]['lastapplication']=_0x5f32fd[_0x3002('0x62')];channels[_0x5f32fd['uniqueid']][_0x3002('0x55')]=_0x5f32fd[_0x3002('0x64')];}}}catch(_0x5b62bf){utils[_0x3002('0x36')](util['format'](_0x3002('0x60'),_0x5f32fd[_0x3002('0x7')]),_0x5b62bf);}}; \ No newline at end of file +var _0xd76a=['attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','split','substring','lastIndexOf','noop','execif','gotoif','[%s][calls][newexten]','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','calleridnum','lastevent','accountcode','then','UserId','request','[%s][calls][newchannel]','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','debug','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','linkedid','transfer','destinationchannel','answertime','toNumber','error','[%s][calls][newstate]','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','[%s][calls][hangup]'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0xd76a,0x105));var _0xad76=function(_0x116df9,_0x2d8bd4){_0x116df9=_0x116df9-0x0;var _0x2976c4=_0xd76a[_0x116df9];return _0x2976c4;};'use strict';var _=require(_0xad76('0x0'));var util=require('util');var utils=require(_0xad76('0x1'));var transfers=require(_0xad76('0x2'));var dispositions=[_0xad76('0x3'),_0xad76('0x4'),_0xad76('0x4'),'NO\x20ANSWER',_0xad76('0x3'),_0xad76('0x3'),_0xad76('0x5'),_0xad76('0x6'),_0xad76('0x4'),_0xad76('0x4'),_0xad76('0x4')];var channels={};function writeDB(_0x3db8b2){var _0x308130;if(transfers[_0xad76('0x7')][_0x3db8b2['uniqueid']]){_0x308130=_0x3db8b2['uniqueid'];_0x3db8b2[_0xad76('0x8')]=transfers['blinds'][_0x3db8b2['uniqueid']][_0xad76('0x9')];}utils['info'](util[_0xad76('0xa')](_0xad76('0xb'),_0x3db8b2['uniqueid'],_0x3db8b2[_0xad76('0xc')],_0x3db8b2['queue'],_0x3db8b2[_0xad76('0xd')],_0x3db8b2['interface'],_0x3db8b2[_0xad76('0xe')],_0x3db8b2['connectedlinenum'],_0x3db8b2[_0xad76('0xf')]));if(_0x3db8b2[_0xad76('0x10')]){utils['getUserByInternal'](_0x3db8b2[_0xad76('0x10')])[_0xad76('0x11')](function(_0x5a7b73){if(_0x5a7b73){_0x3db8b2[_0xad76('0x12')]=_0x5a7b73['id'];}utils[_0xad76('0x13')]('CreateVoiceCallReport',_0x3db8b2);});}else{utils[_0xad76('0x13')]('CreateVoiceCallReport',_0x3db8b2);}if(channels[_0x3db8b2[_0xad76('0x8')]]){delete channels[_0x3db8b2[_0xad76('0x8')]];}else if(_0x308130&&channels[_0x308130]){if(!transfers[_0xad76('0x7')][_0x308130]['recording'])delete transfers[_0xad76('0x7')][_0x308130];delete channels[_0x308130];}}exports['newchannel']=function(_0x54b428){try{utils['debug'](util[_0xad76('0xa')](_0xad76('0x14'),_0x54b428[_0xad76('0x8')]),_0x54b428);if(_0x54b428[_0xad76('0x8')]==_0x54b428['linkedid']&&_0x54b428[_0xad76('0xc')]!='OutgoingSpoolFailed'){utils[_0xad76('0x15')](util[_0xad76('0xa')](_0xad76('0x16'),_0x54b428[_0xad76('0x8')],_0x54b428[_0xad76('0x17')],_0x54b428[_0xad76('0x18')]));channels[_0x54b428['uniqueid']]={'uniqueid':_0x54b428[_0xad76('0x8')],'accountcode':_0x54b428['accountcode'],'source':_0x54b428['calleridnum'],'destination':_0x54b428[_0xad76('0x18')],'destinationcontext':_0x54b428['context'],'channel':_0x54b428[_0xad76('0xc')],'starttime':utils[_0xad76('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xad76('0x3'),'amaflags':_0xad76('0x1a')};}}catch(_0x14bf5c){utils['error'](util[_0xad76('0xa')](_0xad76('0x14'),_0x54b428[_0xad76('0x8')]),_0x14bf5c);}};exports[_0xad76('0x1b')]=function(_0x35b680){try{utils[_0xad76('0x1c')](util[_0xad76('0xa')]('[%s][calls][newstate]',_0x35b680[_0xad76('0x8')]),_0x35b680);if(!_['isNil'](channels[_0x35b680[_0xad76('0x8')]])&&_0x35b680[_0xad76('0x1d')]==0x6){utils['info'](util[_0xad76('0xa')](_0xad76('0x1e'),_0x35b680[_0xad76('0x8')],_0x35b680[_0xad76('0x17')],_0x35b680['channel']));if(_[_0xad76('0x1f')](channels[_0x35b680[_0xad76('0x8')]][_0xad76('0x20')])){channels[_0x35b680['uniqueid']]['systemanswertime']=utils[_0xad76('0x19')]();}}else if(!_['isNil'](channels[_0x35b680[_0xad76('0x21')]])&&_0x35b680[_0xad76('0x1d')]==0x6&&_0x35b680[_0xad76('0x17')]!=_0xad76('0x22')){utils[_0xad76('0x15')](util[_0xad76('0xa')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x35b680[_0xad76('0x8')],_0x35b680[_0xad76('0x21')],_0x35b680[_0xad76('0x17')],_0x35b680['channel']));channels[_0x35b680['linkedid']]['accountcode']=_0x35b680['accountcode'];channels[_0x35b680['linkedid']][_0xad76('0x23')]=_0x35b680[_0xad76('0xc')];if(_[_0xad76('0x1f')](channels[_0x35b680[_0xad76('0x21')]][_0xad76('0x24')])){channels[_0x35b680['linkedid']][_0xad76('0x24')]=utils['now']();}channels[_0x35b680['linkedid']]['disposition']=dispositions[_[_0xad76('0x25')](_0x35b680[_0xad76('0x1d')])]||_0xad76('0x5');}}catch(_0x544f8d){utils[_0xad76('0x26')](util[_0xad76('0xa')](_0xad76('0x27'),_0x35b680[_0xad76('0x8')]),_0x544f8d);}};exports[_0xad76('0x28')]=function(_0x164093){try{if(!_[_0xad76('0x1f')](channels[_0x164093['uniqueid']])){utils[_0xad76('0x1c')](util[_0xad76('0xa')]('[%s][calls][hangup]',_0x164093[_0xad76('0x8')]),_0x164093);if(_[_0xad76('0x1f')](channels[_0x164093['uniqueid']][_0xad76('0x29')])){channels[_0x164093[_0xad76('0x8')]]['callerid']=_0x164093[_0xad76('0x2a')]+'\x20<'+_0x164093[_0xad76('0xe')]+'>';}utils[_0xad76('0x15')](util[_0xad76('0xa')](_0xad76('0x2b'),_0x164093[_0xad76('0x8')],channels[_0x164093[_0xad76('0x8')]][_0xad76('0x29')],_0x164093['cause-txt']));channels[_0x164093['uniqueid']][_0xad76('0x2c')]=utils[_0xad76('0x19')]();channels[_0x164093[_0xad76('0x8')]][_0xad76('0x2d')]=utils['diffTime'](channels[_0x164093[_0xad76('0x8')]][_0xad76('0x2c')],channels[_0x164093[_0xad76('0x8')]][_0xad76('0x2e')]);channels[_0x164093[_0xad76('0x8')]]['billableseconds']=channels[_0x164093['uniqueid']][_0xad76('0x24')]?utils['diffTime'](channels[_0x164093[_0xad76('0x8')]][_0xad76('0x2c')],channels[_0x164093[_0xad76('0x8')]][_0xad76('0x24')]):0x0;writeDB(channels[_0x164093[_0xad76('0x8')]]);}}catch(_0x42fdfe){utils[_0xad76('0x26')](util['format'](_0xad76('0x2f'),_0x164093[_0xad76('0x8')]),_0x42fdfe);}};exports[_0xad76('0x30')]=function(_0x1a68a2){try{if(!_['isNil'](channels[_0x1a68a2[_0xad76('0x31')]])){utils[_0xad76('0x1c')](util[_0xad76('0xa')](_0xad76('0x32'),_0x1a68a2[_0xad76('0x33')]),_0x1a68a2);if(channels[_0x1a68a2[_0xad76('0x31')]][_0xad76('0xc')]==_0x1a68a2[_0xad76('0x34')]){utils[_0xad76('0x15')](util['format'](_0xad76('0x35'),_0x1a68a2['origtransfereruniqueid'],_0x1a68a2[_0xad76('0x31')],_0x1a68a2[_0xad76('0x36')]));channels[_0x1a68a2[_0xad76('0x31')]][_0xad76('0x23')]=_0x1a68a2[_0xad76('0x36')];channels[_0x1a68a2['localtwolinkedid']]['userfield']=_0xad76('0x37');}else if(channels[_0x1a68a2['localtwolinkedid']]['channel']=_0x1a68a2[_0xad76('0x38')]){utils[_0xad76('0x15')](util['format'](_0xad76('0x35'),_0x1a68a2['origtransfereruniqueid'],_0x1a68a2[_0xad76('0x31')],_0x1a68a2[_0xad76('0x39')]));channels[_0x1a68a2['localtwolinkedid']][_0xad76('0x23')]=_0x1a68a2[_0xad76('0x39')];channels[_0x1a68a2[_0xad76('0x31')]]['userfield']=_0xad76('0x37');}}}catch(_0x4521ff){utils['error'](util[_0xad76('0xa')](_0xad76('0x32'),_0x1a68a2[_0xad76('0x33')]),_0x4521ff);}};exports[_0xad76('0x3a')]=function(_0x1fe659){try{if(!_['isNil'](channels[_0x1fe659['uniqueid']])){utils[_0xad76('0x1c')](util[_0xad76('0xa')]('[%s][calls][musiconholdstart]',_0x1fe659['uniqueid']),_0x1fe659);channels[_0x1fe659[_0xad76('0x8')]][_0xad76('0x3b')]=utils[_0xad76('0x19')]();utils[_0xad76('0x15')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1fe659['uniqueid'],channels[_0x1fe659[_0xad76('0x8')]]['musiconholdstartAt']));}}catch(_0x13b8af){utils['error'](util[_0xad76('0xa')](_0xad76('0x3c'),_0x1fe659['uniqueid']),_0x13b8af);}};exports[_0xad76('0x3d')]=function(_0x1a6d67){try{if(!_['isNil'](channels[_0x1a6d67[_0xad76('0x8')]])){utils[_0xad76('0x1c')](util['format'](_0xad76('0x3e'),_0x1a6d67[_0xad76('0x8')]),_0x1a6d67);if(!_[_0xad76('0x1f')](channels[_0x1a6d67[_0xad76('0x8')]][_0xad76('0x3b')])){channels[_0x1a6d67[_0xad76('0x8')]][_0xad76('0x3f')]+=utils[_0xad76('0x40')](utils[_0xad76('0x19')](),channels[_0x1a6d67[_0xad76('0x8')]][_0xad76('0x3b')]);utils['info'](util[_0xad76('0xa')](_0xad76('0x41'),_0x1a6d67[_0xad76('0x8')],channels[_0x1a6d67[_0xad76('0x8')]][_0xad76('0x3f')]));delete channels[_0x1a6d67['uniqueid']]['musiconholdstartAt'];}}}catch(_0x1cd18b){utils[_0xad76('0x26')](util[_0xad76('0xa')](_0xad76('0x3e'),_0x1a6d67[_0xad76('0x8')]),_0x1cd18b);}};exports[_0xad76('0x42')]=function(_0xb8937e){try{if(!_[_0xad76('0x1f')](channels[_0xb8937e[_0xad76('0x8')]])){utils[_0xad76('0x1c')](util[_0xad76('0xa')](_0xad76('0x43'),_0xb8937e[_0xad76('0x8')]),_0xb8937e);if(!_[_0xad76('0x1f')](_0xb8937e['variable'][_0xad76('0x44')])){utils[_0xad76('0x15')](util[_0xad76('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0xb8937e[_0xad76('0x8')],_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e[_0xad76('0x8')]][_0xad76('0x46')]=_0xb8937e[_0xad76('0x45')];}if(!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')][_0xad76('0x48')])){utils[_0xad76('0x15')](util[_0xad76('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xb8937e[_0xad76('0x8')],_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e[_0xad76('0x8')]]['destination']=_0xb8937e[_0xad76('0x45')];channels[_0xb8937e['uniqueid']][_0xad76('0x29')]='\x22'+_0xb8937e[_0xad76('0x45')]+_0xad76('0x49')+_0xb8937e[_0xad76('0x45')]+'>';}if(!_[_0xad76('0x1f')](_0xb8937e['variable'][_0xad76('0x4a')])||!_['isNil'](_0xb8937e['variable'][_0xad76('0x4b')])){utils[_0xad76('0x15')](util[_0xad76('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xb8937e[_0xad76('0x8')],!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')][_0xad76('0x4a')])?_0xad76('0x4a'):'xmd-callerid',_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e['uniqueid']][_0xad76('0x29')]=_0xb8937e[_0xad76('0x45')];}if(!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')][_0xad76('0x4c')])||!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')][_0xad76('0x4d')])){utils['info'](util['format'](_0xad76('0x4e'),_0xb8937e[_0xad76('0x8')],!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')]['xmd-queue'])?_0xad76('0x4c'):_0xad76('0x4d'),_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e['uniqueid']][_0xad76('0x4f')]=_0xad76('0x50');channels[_0xb8937e[_0xad76('0x8')]][_0xad76('0x51')]=_0xb8937e[_0xad76('0x45')];channels[_0xb8937e['uniqueid']][_0xad76('0x52')]=!![];}if(!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')]['xmd-contactid'])){utils[_0xad76('0x15')](util['format'](_0xad76('0x53'),_0xb8937e[_0xad76('0x8')],_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e['uniqueid']]['ContactId']=_0xb8937e['value'];}if(!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')][_0xad76('0x54')])){utils[_0xad76('0x15')](util[_0xad76('0xa')](_0xad76('0x55'),_0xb8937e[_0xad76('0x8')],_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e['uniqueid']]['type']=_0xb8937e['value'];}if(!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')]['outboundrouteid'])){utils['info'](util[_0xad76('0xa')](_0xad76('0x56'),_0xb8937e[_0xad76('0x8')],_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e['uniqueid']][_0xad76('0x57')]=_0xb8937e['value'];}if(!_[_0xad76('0x1f')](_0xb8937e[_0xad76('0x47')][_0xad76('0x58')])){utils[_0xad76('0x15')](util[_0xad76('0xa')](_0xad76('0x59'),_0xb8937e[_0xad76('0x8')],_0xb8937e[_0xad76('0x45')]));channels[_0xb8937e[_0xad76('0x8')]][_0xad76('0x58')]=_0xb8937e[_0xad76('0x45')];}}}catch(_0xc39ed2){utils[_0xad76('0x26')](util['format'](_0xad76('0x43'),_0xb8937e[_0xad76('0x8')]),_0xc39ed2);}};exports['newexten']=function(_0x4a75e6){try{if(!_['isNil'](channels[_0x4a75e6[_0xad76('0x8')]])){utils[_0xad76('0x1c')](util[_0xad76('0xa')]('[%s][calls][newexten]',_0x4a75e6['uniqueid']),_0x4a75e6);utils[_0xad76('0x15')](util[_0xad76('0xa')](_0xad76('0x5a'),_0x4a75e6[_0xad76('0x8')],_0x4a75e6['application'],_0x4a75e6[_0xad76('0x5b')]));if(_0x4a75e6[_0xad76('0x5c')]['toLowerCase']()==_0xad76('0x5d')&&_[_0xad76('0x5e')](_0x4a75e6['appdata'][_0xad76('0x5f')](),'cdr')){var _0x4f5046=_0x4a75e6[_0xad76('0x5b')][_0xad76('0x60')]('=');var _0x5e7db1=_0x4f5046[0x0][_0xad76('0x61')](_0x4f5046[0x0][_0xad76('0x62')]('(')+0x1,_0x4f5046[0x0][_0xad76('0x62')](')'));var _0x1540c5=_0x4f5046[0x1];channels[_0x4a75e6[_0xad76('0x8')]][_0x5e7db1]=_0x1540c5;}if(!_['includes']([_0xad76('0x28'),_0xad76('0x63'),_0xad76('0x64'),_0xad76('0x5d'),_0xad76('0x65')],_0x4a75e6[_0xad76('0x5c')]['toLowerCase']())){channels[_0x4a75e6[_0xad76('0x8')]][_0xad76('0x4f')]=_0x4a75e6[_0xad76('0x5c')];channels[_0x4a75e6[_0xad76('0x8')]][_0xad76('0x51')]=_0x4a75e6[_0xad76('0x5b')];}}}catch(_0x4159b8){utils[_0xad76('0x26')](util[_0xad76('0xa')](_0xad76('0x66'),_0x4a75e6[_0xad76('0x8')]),_0x4159b8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8654818..476146c 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 _0x8b2d=['error','[core]\x20error','close','[core]\x20close','managerevent','info','shutdown','fullybooted'];(function(_0x46930d,_0x2ec7c7){var _0x4108c1=function(_0x249a58){while(--_0x249a58){_0x46930d['push'](_0x46930d['shift']());}};_0x4108c1(++_0x2ec7c7);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x34a923,_0x3ce38d){_0x34a923=_0x34a923-0x0;var _0x46442b=_0x8b2d[_0x34a923];return _0x46442b;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xd8b2('0x0')]('[core]\x20connected');};exports[_0xd8b2('0x1')]=function(){utils[_0xd8b2('0x0')]('[core]\x20shutdown');};exports[_0xd8b2('0x2')]=function(){utils[_0xd8b2('0x0')]('[core]\x20fullybooted');};exports[_0xd8b2('0x3')]=function(_0x21772e){utils[_0xd8b2('0x3')](_0xd8b2('0x4'),_0x21772e);};exports[_0xd8b2('0x5')]=function(){utils[_0xd8b2('0x0')](_0xd8b2('0x6'));};exports[_0xd8b2('0x7')]=function(_0x138995){}; \ No newline at end of file +var _0x13c6=['close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x13c6,0xb2));var _0x613c=function(_0x2bfe57,_0x583291){_0x2bfe57=_0x2bfe57-0x0;var _0x30d6b4=_0x13c6[_0x2bfe57];return _0x30d6b4;};'use strict';var utils=require(_0x613c('0x0'));exports[_0x613c('0x1')]=function(){utils[_0x613c('0x2')](_0x613c('0x3'));};exports[_0x613c('0x4')]=function(){utils[_0x613c('0x2')](_0x613c('0x5'));};exports[_0x613c('0x6')]=function(){utils['info'](_0x613c('0x7'));};exports['error']=function(_0x443040){utils['error'](_0x613c('0x8'),_0x443040);};exports[_0x613c('0x9')]=function(){utils[_0x613c('0x2')]('[core]\x20close');};exports[_0x613c('0xa')]=function(_0x459378){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2a4ee19..24fd0f7 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 _0xe2f4=['diffTime','endtime','holdtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','startsWith','toLowerCase','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','dialstatus','ANSWER','connect','[%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','complete'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe2f4,0x90));var _0x4e2f=function(_0x44fdb4,_0x21b0ad){_0x44fdb4=_0x44fdb4-0x0;var _0xf10dd4=_0xe2f4[_0x44fdb4];return _0xf10dd4;};'use strict';var _=require(_0x4e2f('0x0'));var util=require(_0x4e2f('0x1'));var utils=require(_0x4e2f('0x2'));var dials={};function writeDB(_0x28c02e){utils[_0x4e2f('0x3')](util[_0x4e2f('0x4')](_0x4e2f('0x5'),_0x28c02e['uniqueid'],_0x28c02e[_0x4e2f('0x6')],_0x28c02e[_0x4e2f('0x7')],_0x28c02e['calleridnum'],_0x28c02e['connectedlinenum'],_0x28c02e['dialstatus']));utils[_0x4e2f('0x8')](_0x4e2f('0x9'),_0x28c02e);delete dials[_0x28c02e['uniqueid']];}exports[_0x4e2f('0xa')]=function(_0x537520){try{utils[_0x4e2f('0xb')](util[_0x4e2f('0x4')](_0x4e2f('0xc'),_0x537520[_0x4e2f('0xd')]),_0x537520);utils[_0x4e2f('0x3')](util[_0x4e2f('0x4')](_0x4e2f('0xe'),_0x537520['uniqueid'],_0x537520['application'],_0x537520[_0x4e2f('0xf')]));if(_0x537520['application']['toLowerCase']()=='set'&&_[_0x4e2f('0x10')](_0x537520['appdata'][_0x4e2f('0x11')](),'cdr(routeid)')){var _0x23cdce=_0x537520['appdata']['split']('=');dials[_0x537520[_0x4e2f('0xd')]]={'routeId':_0x23cdce[0x1]};}}catch(_0x3d7dde){utils[_0x4e2f('0x12')](util[_0x4e2f('0x4')]('[%s][dials][newexten]',_0x537520[_0x4e2f('0xd')]),_0x3d7dde);}};exports[_0x4e2f('0x13')]=function(_0x331dea){try{utils[_0x4e2f('0xb')](util[_0x4e2f('0x4')](_0x4e2f('0x14'),_0x331dea[_0x4e2f('0xd')]),_0x331dea);if(!_[_0x4e2f('0x15')](_0x331dea['variable'][_0x4e2f('0x16')])){utils['info'](util[_0x4e2f('0x4')](_0x4e2f('0x17'),_0x331dea[_0x4e2f('0xd')],_0x331dea[_0x4e2f('0x18')]));dials[_0x331dea[_0x4e2f('0xd')]]={'routeId':_0x331dea[_0x4e2f('0x18')]};}}catch(_0x3abfd7){utils['error'](util[_0x4e2f('0x4')](_0x4e2f('0x14'),_0x331dea[_0x4e2f('0xd')]),_0x3abfd7);}};exports['dialbegin']=function(_0xdb8a09){try{if(!_[_0x4e2f('0x15')](dials[_0xdb8a09[_0x4e2f('0xd')]])){utils[_0x4e2f('0xb')](util[_0x4e2f('0x4')]('[%s][dials][dialbegin]',_0xdb8a09[_0x4e2f('0xd')]),_0xdb8a09);dials[_0xdb8a09[_0x4e2f('0xd')]]=_[_0x4e2f('0x19')](dials[_0xdb8a09['uniqueid']],_0xdb8a09);dials[_0xdb8a09[_0x4e2f('0xd')]][_0x4e2f('0x1a')]=utils[_0x4e2f('0x1b')]();dials[_0xdb8a09[_0x4e2f('0xd')]][_0x4e2f('0x1c')]=_0x4e2f('0x1d');utils[_0x4e2f('0x3')](util[_0x4e2f('0x4')](_0x4e2f('0x1e'),_0xdb8a09[_0x4e2f('0xd')],dials[_0xdb8a09['uniqueid']][_0x4e2f('0x1a')]));}}catch(_0x4a59e5){utils[_0x4e2f('0x12')](util[_0x4e2f('0x4')](_0x4e2f('0x1f'),_0xdb8a09[_0x4e2f('0xd')]),_0x4a59e5);}};exports['dialend']=function(_0x2dfafe){try{if(!_[_0x4e2f('0x15')](dials[_0x2dfafe['uniqueid']])){utils[_0x4e2f('0xb')](util[_0x4e2f('0x4')](_0x4e2f('0x20'),_0x2dfafe[_0x4e2f('0xd')]),_0x2dfafe);dials[_0x2dfafe[_0x4e2f('0xd')]][_0x4e2f('0x21')]=_0x2dfafe['dialstatus'];if(_0x2dfafe[_0x4e2f('0x21')]==_0x4e2f('0x22')){dials[_0x2dfafe[_0x4e2f('0xd')]]=_[_0x4e2f('0x19')](dials[_0x2dfafe[_0x4e2f('0xd')]],_0x2dfafe);dials[_0x2dfafe[_0x4e2f('0xd')]]['answertime']=utils[_0x4e2f('0x1b')]();dials[_0x2dfafe[_0x4e2f('0xd')]]['lastevent']=_0x4e2f('0x23');utils[_0x4e2f('0x3')](util[_0x4e2f('0x4')](_0x4e2f('0x24'),_0x2dfafe[_0x4e2f('0xd')],_0x2dfafe[_0x4e2f('0x21')],dials[_0x2dfafe['uniqueid']][_0x4e2f('0x25')]));}else{utils[_0x4e2f('0x3')](util[_0x4e2f('0x4')](_0x4e2f('0x26'),_0x2dfafe[_0x4e2f('0xd')],_0x2dfafe[_0x4e2f('0x21')]));}}}catch(_0x21bdbf){utils[_0x4e2f('0x12')](util['format'](_0x4e2f('0x20'),_0x2dfafe['uniqueid']),_0x21bdbf);}};exports[_0x4e2f('0x27')]=function(_0x5a0fd0){try{if(!_[_0x4e2f('0x15')](dials[_0x5a0fd0['uniqueid']])){utils[_0x4e2f('0xb')](util[_0x4e2f('0x4')](_0x4e2f('0x28'),_0x5a0fd0[_0x4e2f('0xd')]),_0x5a0fd0);utils[_0x4e2f('0x3')](util[_0x4e2f('0x4')](_0x4e2f('0x29'),_0x5a0fd0[_0x4e2f('0xd')],_0x5a0fd0[_0x4e2f('0x2a')],_0x5a0fd0['calleridname'],_0x5a0fd0['cause-txt']));dials[_0x5a0fd0[_0x4e2f('0xd')]]=_['assign'](dials[_0x5a0fd0['uniqueid']],{'endtime':utils[_0x4e2f('0x1b')](),'lastevent':_0x4e2f('0x2b')});dials[_0x5a0fd0['uniqueid']]['duration']=utils[_0x4e2f('0x2c')](dials[_0x5a0fd0[_0x4e2f('0xd')]][_0x4e2f('0x2d')],dials[_0x5a0fd0[_0x4e2f('0xd')]][_0x4e2f('0x1a')]);dials[_0x5a0fd0[_0x4e2f('0xd')]][_0x4e2f('0x2e')]=utils[_0x4e2f('0x2c')](dials[_0x5a0fd0['uniqueid']]['answertime']||dials[_0x5a0fd0[_0x4e2f('0xd')]][_0x4e2f('0x2d')],dials[_0x5a0fd0[_0x4e2f('0xd')]][_0x4e2f('0x1a')]);dials[_0x5a0fd0[_0x4e2f('0xd')]]['billableseconds']=dials[_0x5a0fd0[_0x4e2f('0xd')]][_0x4e2f('0x25')]?utils[_0x4e2f('0x2c')](dials[_0x5a0fd0[_0x4e2f('0xd')]][_0x4e2f('0x2d')],dials[_0x5a0fd0[_0x4e2f('0xd')]]['answertime']):0x0;writeDB(dials[_0x5a0fd0[_0x4e2f('0xd')]]);}}catch(_0x263a50){utils[_0x4e2f('0x12')](util[_0x4e2f('0x4')]('[%s][dials][hangup]',_0x5a0fd0[_0x4e2f('0xd')]),_0x263a50);}}; \ No newline at end of file +var _0x569c=['application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%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','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x2b6087,_0x4c566b){var _0x354f3b=function(_0x779944){while(--_0x779944){_0x2b6087['push'](_0x2b6087['shift']());}};_0x354f3b(++_0x4c566b);}(_0x569c,0x1b2));var _0xc569=function(_0x28b830,_0x1b27be){_0x28b830=_0x28b830-0x0;var _0x478d5d=_0x569c[_0x28b830];return _0x478d5d;};'use strict';var _=require(_0xc569('0x0'));var util=require(_0xc569('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x4929b0){utils[_0xc569('0x2')](util[_0xc569('0x3')](_0xc569('0x4'),_0x4929b0[_0xc569('0x5')],_0x4929b0[_0xc569('0x6')],_0x4929b0[_0xc569('0x7')],_0x4929b0[_0xc569('0x8')],_0x4929b0[_0xc569('0x9')],_0x4929b0[_0xc569('0xa')]));utils[_0xc569('0xb')]('CreateVoiceDialReport',_0x4929b0);delete dials[_0x4929b0[_0xc569('0x5')]];}exports[_0xc569('0xc')]=function(_0x54bd55){try{utils[_0xc569('0xd')](util['format'](_0xc569('0xe'),_0x54bd55[_0xc569('0x5')]),_0x54bd55);utils[_0xc569('0x2')](util[_0xc569('0x3')](_0xc569('0xf'),_0x54bd55[_0xc569('0x5')],_0x54bd55[_0xc569('0x10')],_0x54bd55[_0xc569('0x11')]));if(_0x54bd55[_0xc569('0x10')][_0xc569('0x12')]()==_0xc569('0x13')&&_[_0xc569('0x14')](_0x54bd55[_0xc569('0x11')]['toLowerCase'](),_0xc569('0x15'))){var _0x54c2dd=_0x54bd55[_0xc569('0x11')][_0xc569('0x16')]('=');dials[_0x54bd55[_0xc569('0x5')]]={'routeId':_0x54c2dd[0x1]};}}catch(_0x50161a){utils['error'](util[_0xc569('0x3')](_0xc569('0xe'),_0x54bd55[_0xc569('0x5')]),_0x50161a);}};exports['varset']=function(_0x114134){try{utils[_0xc569('0xd')](util[_0xc569('0x3')](_0xc569('0x17'),_0x114134[_0xc569('0x5')]),_0x114134);if(!_[_0xc569('0x18')](_0x114134[_0xc569('0x19')][_0xc569('0x1a')])){utils[_0xc569('0x2')](util[_0xc569('0x3')](_0xc569('0x1b'),_0x114134['uniqueid'],_0x114134[_0xc569('0x1c')]));dials[_0x114134[_0xc569('0x5')]]={'routeId':_0x114134[_0xc569('0x1c')]};}}catch(_0x2717d9){utils[_0xc569('0x1d')](util['format'](_0xc569('0x17'),_0x114134['uniqueid']),_0x2717d9);}};exports['dialbegin']=function(_0x4ff873){try{if(!_[_0xc569('0x18')](dials[_0x4ff873[_0xc569('0x5')]])){utils[_0xc569('0xd')](util[_0xc569('0x3')](_0xc569('0x1e'),_0x4ff873[_0xc569('0x5')]),_0x4ff873);dials[_0x4ff873[_0xc569('0x5')]]=_[_0xc569('0x1f')](dials[_0x4ff873[_0xc569('0x5')]],_0x4ff873);dials[_0x4ff873[_0xc569('0x5')]][_0xc569('0x20')]=utils[_0xc569('0x21')]();dials[_0x4ff873[_0xc569('0x5')]][_0xc569('0x22')]=_0xc569('0x23');utils[_0xc569('0x2')](util['format'](_0xc569('0x24'),_0x4ff873[_0xc569('0x5')],dials[_0x4ff873['uniqueid']][_0xc569('0x20')]));}}catch(_0x3a11da){utils[_0xc569('0x1d')](util[_0xc569('0x3')]('[%s][dials][dialbegin]',_0x4ff873[_0xc569('0x5')]),_0x3a11da);}};exports['dialend']=function(_0x5c2a4d){try{if(!_[_0xc569('0x18')](dials[_0x5c2a4d[_0xc569('0x5')]])){utils[_0xc569('0xd')](util[_0xc569('0x3')](_0xc569('0x25'),_0x5c2a4d[_0xc569('0x5')]),_0x5c2a4d);dials[_0x5c2a4d[_0xc569('0x5')]][_0xc569('0xa')]=_0x5c2a4d['dialstatus'];if(_0x5c2a4d['dialstatus']==_0xc569('0x26')){dials[_0x5c2a4d[_0xc569('0x5')]]=_[_0xc569('0x1f')](dials[_0x5c2a4d[_0xc569('0x5')]],_0x5c2a4d);dials[_0x5c2a4d[_0xc569('0x5')]]['answertime']=utils['now']();dials[_0x5c2a4d[_0xc569('0x5')]][_0xc569('0x22')]='connect';utils[_0xc569('0x2')](util[_0xc569('0x3')](_0xc569('0x27'),_0x5c2a4d['uniqueid'],_0x5c2a4d[_0xc569('0xa')],dials[_0x5c2a4d[_0xc569('0x5')]][_0xc569('0x28')]));}else{utils['info'](util[_0xc569('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x5c2a4d[_0xc569('0x5')],_0x5c2a4d[_0xc569('0xa')]));}}}catch(_0x5ecc36){utils['error'](util[_0xc569('0x3')](_0xc569('0x25'),_0x5c2a4d[_0xc569('0x5')]),_0x5ecc36);}};exports[_0xc569('0x29')]=function(_0x11e411){try{if(!_[_0xc569('0x18')](dials[_0x11e411['uniqueid']])){utils[_0xc569('0xd')](util[_0xc569('0x3')](_0xc569('0x2a'),_0x11e411[_0xc569('0x5')]),_0x11e411);utils[_0xc569('0x2')](util[_0xc569('0x3')](_0xc569('0x2b'),_0x11e411[_0xc569('0x5')],_0x11e411[_0xc569('0x8')],_0x11e411[_0xc569('0x2c')],_0x11e411['cause-txt']));dials[_0x11e411[_0xc569('0x5')]]=_[_0xc569('0x1f')](dials[_0x11e411[_0xc569('0x5')]],{'endtime':utils[_0xc569('0x21')](),'lastevent':_0xc569('0x2d')});dials[_0x11e411[_0xc569('0x5')]][_0xc569('0x2e')]=utils[_0xc569('0x2f')](dials[_0x11e411[_0xc569('0x5')]]['endtime'],dials[_0x11e411[_0xc569('0x5')]][_0xc569('0x20')]);dials[_0x11e411[_0xc569('0x5')]]['holdtime']=utils[_0xc569('0x2f')](dials[_0x11e411['uniqueid']][_0xc569('0x28')]||dials[_0x11e411['uniqueid']][_0xc569('0x30')],dials[_0x11e411[_0xc569('0x5')]][_0xc569('0x20')]);dials[_0x11e411[_0xc569('0x5')]][_0xc569('0x31')]=dials[_0x11e411[_0xc569('0x5')]][_0xc569('0x28')]?utils[_0xc569('0x2f')](dials[_0x11e411[_0xc569('0x5')]][_0xc569('0x30')],dials[_0x11e411[_0xc569('0x5')]]['answertime']):0x0;writeDB(dials[_0x11e411[_0xc569('0x5')]]);}}catch(_0x48e16c){utils[_0xc569('0x1d')](util[_0xc569('0x3')](_0xc569('0x2a'),_0x11e411['uniqueid']),_0x48e16c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d5d97b5..6272f8d 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 _0x7bc0=['[%s][index][dialend]','asterisk-manager','xdr','disabled','production','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','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'];(function(_0x5b4b22,_0x1191e3){var _0x2febc0=function(_0x1287e3){while(--_0x1287e3){_0x5b4b22['push'](_0x5b4b22['shift']());}};_0x2febc0(++_0x1191e3);}(_0x7bc0,0x89));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0x07bc('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require('util');var isXDREnabled=config['xdr']&&config[_0x07bc('0x1')][_0x07bc('0x2')]?!config[_0x07bc('0x1')][_0x07bc('0x2')]:!![];var isProduction=config['env']===_0x07bc('0x3')||![];var isLocalAsterisk=config['xdr']&&config[_0x07bc('0x1')][_0x07bc('0x4')]===!![]||![];var ami=new AsteriskManager(config[_0x07bc('0x5')]['port'],config[_0x07bc('0x5')]['ip'],config[_0x07bc('0x5')][_0x07bc('0x6')],config[_0x07bc('0x5')][_0x07bc('0x7')],!![]);ami[_0x07bc('0x8')]();if(!isXDREnabled){utils[_0x07bc('0x9')](_0x07bc('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x07bc('0x9')](_0x07bc('0xb'));}else{var agents=require(_0x07bc('0xc'));var calls=require(_0x07bc('0xd'));var queues=require('./queues.controller');var recordings=require(_0x07bc('0xe'));var members=require('./members.controller');var dials=require(_0x07bc('0xf'));var transfers=require(_0x07bc('0x10'));var core=require(_0x07bc('0x11'));ami['on']('connect',core[_0x07bc('0x12')]);ami['on'](_0x07bc('0x13'),core[_0x07bc('0x13')]);ami['on']('fullybooted',core[_0x07bc('0x14')]);ami['on'](_0x07bc('0x15'),core[_0x07bc('0x15')]);ami['on'](_0x07bc('0x16'),core[_0x07bc('0x16')]);ami['on'](_0x07bc('0x17'),core[_0x07bc('0x17')]);ami['on']('devicestatechange',function(_0x1ca4f1){try{utils[_0x07bc('0x18')](util['format'](_0x07bc('0x19'),_0x1ca4f1[_0x07bc('0x1a')]),_0x1ca4f1);members['devicestatechange'](_0x1ca4f1);}catch(_0x4e4907){utils['error'](util[_0x07bc('0x1b')](_0x07bc('0x19'),_0x1ca4f1[_0x07bc('0x1a')]),_0x4e4907);}});ami['on'](_0x07bc('0x1c'),function(_0x37b7a2){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x1d'),_0x37b7a2[_0x07bc('0x1e')]),_0x37b7a2);agents['agentcalled'](_0x37b7a2);}catch(_0x5d2ed0){utils['error'](util[_0x07bc('0x1b')](_0x07bc('0x1d'),_0x37b7a2['uniqueid']),_0x5d2ed0);}});ami['on'](_0x07bc('0x1f'),function(_0x11c88e){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')]('[%s][index][agentringnoanswer]',_0x11c88e['uniqueid']),_0x11c88e);agents[_0x07bc('0x1f')](_0x11c88e);}catch(_0x296bf6){utils['error'](util[_0x07bc('0x1b')](_0x07bc('0x20'),_0x11c88e[_0x07bc('0x1e')]),_0x296bf6);}});ami['on']('agentconnect',function(_0x15c73f){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x21'),_0x15c73f[_0x07bc('0x1e')]),_0x15c73f);agents[_0x07bc('0x22')](_0x15c73f);queues[_0x07bc('0x22')](_0x15c73f);}catch(_0x45fabb){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')](_0x07bc('0x21'),_0x15c73f[_0x07bc('0x1e')]),_0x45fabb);}});ami['on'](_0x07bc('0x23'),function(_0x114363){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x24'),_0x114363[_0x07bc('0x1e')]),_0x114363);agents[_0x07bc('0x23')](_0x114363);queues['agentcomplete'](_0x114363);members[_0x07bc('0x23')](_0x114363);}catch(_0x35f3cc){utils['error'](util[_0x07bc('0x1b')](_0x07bc('0x24'),_0x114363[_0x07bc('0x1e')]),_0x35f3cc);}});ami['on'](_0x07bc('0x25'),function(_0xc63303){try{utils['debug'](util[_0x07bc('0x1b')](_0x07bc('0x26'),_0xc63303[_0x07bc('0x1e')]),_0xc63303);agents[_0x07bc('0x25')](_0xc63303);queues[_0x07bc('0x25')](_0xc63303);}catch(_0x24fc67){utils[_0x07bc('0x15')](util['format'](_0x07bc('0x26'),_0xc63303['uniqueid']),_0x24fc67);}});ami['on'](_0x07bc('0x27'),function(_0x2f607b){try{utils['debug'](util[_0x07bc('0x1b')](_0x07bc('0x28'),_0x2f607b[_0x07bc('0x1e')]),_0x2f607b);queues['queuecallerjoin'](_0x2f607b);recordings[_0x07bc('0x27')](_0x2f607b);}catch(_0x4f4de9){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')]('[%s][index][queuecallerjoin]',_0x2f607b[_0x07bc('0x1e')]),_0x4f4de9);}});ami['on'](_0x07bc('0x29'),function(_0x2fc65a){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')]('[%s][index][queuecallerleave]',_0x2fc65a[_0x07bc('0x1e')]),_0x2fc65a);queues[_0x07bc('0x29')](_0x2fc65a);}catch(_0x1bd50f){utils['error'](util[_0x07bc('0x1b')](_0x07bc('0x2a'),_0x2fc65a[_0x07bc('0x1e')]),_0x1bd50f);}});ami['on'](_0x07bc('0x2b'),function(_0x237f9f){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x2c'),_0x237f9f[_0x07bc('0x1e')]),_0x237f9f);queues['musiconholdstart'](_0x237f9f);calls[_0x07bc('0x2b')](_0x237f9f);}catch(_0x2b6fa6){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')](_0x07bc('0x2c'),_0x237f9f['uniqueid']),_0x2b6fa6);}});ami['on'](_0x07bc('0x2d'),function(_0xb7c58c){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x2e'),_0xb7c58c[_0x07bc('0x1e')]),_0xb7c58c);queues[_0x07bc('0x2d')](_0xb7c58c);calls[_0x07bc('0x2d')](_0xb7c58c);}catch(_0x16871d){utils['error'](util[_0x07bc('0x1b')]('[%s][index][musiconholdstop]',_0xb7c58c[_0x07bc('0x1e')]),_0x16871d);}});ami['on'](_0x07bc('0x2f'),function(_0x2ca140){try{utils['debug'](util[_0x07bc('0x1b')]('[%s][index][newstate]',_0x2ca140['uniqueid']),_0x2ca140);calls[_0x07bc('0x2f')](_0x2ca140);recordings[_0x07bc('0x2f')](_0x2ca140);}catch(_0x24de5a){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')]('[%s][index][newstate]',_0x2ca140['uniqueid']),_0x24de5a);}});ami['on']('hangup',function(_0x295fed){try{utils[_0x07bc('0x18')](util['format'](_0x07bc('0x30'),_0x295fed[_0x07bc('0x1e')]),_0x295fed);calls[_0x07bc('0x31')](_0x295fed);recordings[_0x07bc('0x31')](_0x295fed);dials['hangup'](_0x295fed);agents[_0x07bc('0x31')](_0x295fed);queues['hangup'](_0x295fed);}catch(_0x47462b){utils[_0x07bc('0x15')](util['format']('[%s][index][hangup]',_0x295fed['uniqueid']),_0x47462b);}});ami['on'](_0x07bc('0x32'),function(_0x2f9f85){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')]('[%s][index][cdr]',_0x2f9f85[_0x07bc('0x1e')]),_0x2f9f85);members[_0x07bc('0x32')](_0x2f9f85);}catch(_0x532af6){utils['error'](util['format'](_0x07bc('0x33'),_0x2f9f85[_0x07bc('0x1e')]),_0x532af6);}});ami['on'](_0x07bc('0x34'),function(_0x16b1df){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')]('[%s][index][blindtransfer]',_0x16b1df['uniqueid']),_0x16b1df);queues[_0x07bc('0x34')](_0x16b1df);agents['blindtransfer'](_0x16b1df);transfers[_0x07bc('0x34')](_0x16b1df);recordings[_0x07bc('0x34')](_0x16b1df);}catch(_0x498fb5){utils['error'](util['format'](_0x07bc('0x35'),_0x16b1df[_0x07bc('0x1e')]),_0x498fb5);}});ami['on'](_0x07bc('0x36'),function(_0x29b19d){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x37'),_0x29b19d['origtransfereruniqueid']),_0x29b19d);queues['attendedtransfer'](_0x29b19d);transfers[_0x07bc('0x36')](_0x29b19d);agents[_0x07bc('0x36')](_0x29b19d);calls[_0x07bc('0x36')](_0x29b19d);}catch(_0x37e3e4){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')](_0x07bc('0x37'),_0x29b19d[_0x07bc('0x38')]),_0x37e3e4);}});ami['on'](_0x07bc('0x39'),function(_0x521d5b){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x3a'),_0x521d5b[_0x07bc('0x1e')]),_0x521d5b);queues[_0x07bc('0x39')](_0x521d5b);recordings[_0x07bc('0x39')](_0x521d5b);calls[_0x07bc('0x39')](_0x521d5b);dials[_0x07bc('0x39')](_0x521d5b);}catch(_0x140bb6){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')]('[%s][index][varset]',_0x521d5b[_0x07bc('0x1e')]),_0x140bb6);}});ami['on'](_0x07bc('0x3b'),function(_0x2a8278){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x3c'),_0x2a8278['uniqueid']),_0x2a8278);calls[_0x07bc('0x3b')](_0x2a8278);recordings[_0x07bc('0x3b')](_0x2a8278);dials['newexten'](_0x2a8278);}catch(_0x1cd601){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')]('[%s][index][newexten]',_0x2a8278[_0x07bc('0x1e')]),_0x1cd601);}});ami['on'](_0x07bc('0x3d'),function(_0x54b7e4){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')]('[%s][index][newchannel]',_0x54b7e4[_0x07bc('0x1e')]),_0x54b7e4);calls[_0x07bc('0x3d')](_0x54b7e4);recordings[_0x07bc('0x3d')](_0x54b7e4);}catch(_0x41dcb6){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')](_0x07bc('0x3e'),_0x54b7e4['uniqueid']),_0x41dcb6);}});ami['on'](_0x07bc('0x3f'),function(_0x251e3f){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x40'),_0x251e3f['uniqueid']),_0x251e3f);dials['dialbegin'](_0x251e3f);}catch(_0x4e00bd){utils[_0x07bc('0x15')](util[_0x07bc('0x1b')](_0x07bc('0x41'),_0x251e3f[_0x07bc('0x1e')]),_0x4e00bd);}});ami['on'](_0x07bc('0x42'),function(_0x167cb1){try{utils[_0x07bc('0x18')](util[_0x07bc('0x1b')](_0x07bc('0x43'),_0x167cb1[_0x07bc('0x1e')]),_0x167cb1);dials[_0x07bc('0x42')](_0x167cb1);}catch(_0x15632e){utils['error'](util[_0x07bc('0x1b')](_0x07bc('0x43'),_0x167cb1[_0x07bc('0x1e')]),_0x15632e);}});} \ No newline at end of file +var _0x6aad=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x479792,_0x796fcd){var _0x14076c=function(_0x1ac827){while(--_0x1ac827){_0x479792['push'](_0x479792['shift']());}};_0x14076c(++_0x796fcd);}(_0x6aad,0xf0));var _0xd6aa=function(_0x17a92f,_0x382958){_0x17a92f=_0x17a92f-0x0;var _0x302de5=_0x6aad[_0x17a92f];return _0x302de5;};var AsteriskManager=require(_0xd6aa('0x0'));var config=require(_0xd6aa('0x1'));var utils=require(_0xd6aa('0x2'));var util=require(_0xd6aa('0x3'));var isXDREnabled=config[_0xd6aa('0x4')]&&config['xdr'][_0xd6aa('0x5')]?!config['xdr'][_0xd6aa('0x5')]:!![];var isProduction=config[_0xd6aa('0x6')]===_0xd6aa('0x7')||![];var isLocalAsterisk=config[_0xd6aa('0x4')]&&config[_0xd6aa('0x4')][_0xd6aa('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xd6aa('0x9')][_0xd6aa('0xa')],config[_0xd6aa('0x9')]['ip'],config['asterisk'][_0xd6aa('0xb')],config['asterisk'][_0xd6aa('0xc')],!![]);ami[_0xd6aa('0xd')]();if(!isXDREnabled){utils[_0xd6aa('0xe')](_0xd6aa('0xf'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xd6aa('0xe')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xd6aa('0x10'));var calls=require('./calls.controller');var queues=require(_0xd6aa('0x11'));var recordings=require(_0xd6aa('0x12'));var members=require(_0xd6aa('0x13'));var dials=require(_0xd6aa('0x14'));var transfers=require(_0xd6aa('0x15'));var core=require(_0xd6aa('0x16'));ami['on'](_0xd6aa('0x17'),core[_0xd6aa('0x17')]);ami['on'](_0xd6aa('0x18'),core[_0xd6aa('0x18')]);ami['on'](_0xd6aa('0x19'),core['fullybooted']);ami['on'](_0xd6aa('0x1a'),core[_0xd6aa('0x1a')]);ami['on'](_0xd6aa('0x1b'),core[_0xd6aa('0x1b')]);ami['on']('managerevent',core[_0xd6aa('0x1c')]);ami['on'](_0xd6aa('0x1d'),function(_0x41c181){try{utils[_0xd6aa('0x1e')](util['format'](_0xd6aa('0x1f'),_0x41c181[_0xd6aa('0x20')]),_0x41c181);members[_0xd6aa('0x1d')](_0x41c181);}catch(_0x24a381){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')]('[%s][index][devicestatechange]',_0x41c181[_0xd6aa('0x20')]),_0x24a381);}});ami['on'](_0xd6aa('0x22'),function(_0x13ff2e){try{utils['debug'](util[_0xd6aa('0x21')](_0xd6aa('0x23'),_0x13ff2e['uniqueid']),_0x13ff2e);agents[_0xd6aa('0x22')](_0x13ff2e);}catch(_0x232def){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')]('[%s][index][agentcalled]',_0x13ff2e[_0xd6aa('0x24')]),_0x232def);}});ami['on']('agentringnoanswer',function(_0x34e861){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')]('[%s][index][agentringnoanswer]',_0x34e861[_0xd6aa('0x24')]),_0x34e861);agents['agentringnoanswer'](_0x34e861);}catch(_0x40da65){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x25'),_0x34e861['uniqueid']),_0x40da65);}});ami['on'](_0xd6aa('0x26'),function(_0x2e11d9){try{utils['debug'](util[_0xd6aa('0x21')](_0xd6aa('0x27'),_0x2e11d9['uniqueid']),_0x2e11d9);agents[_0xd6aa('0x26')](_0x2e11d9);queues[_0xd6aa('0x26')](_0x2e11d9);}catch(_0x567504){utils[_0xd6aa('0x1a')](util['format']('[%s][index][agentconnect]',_0x2e11d9[_0xd6aa('0x24')]),_0x567504);}});ami['on'](_0xd6aa('0x28'),function(_0x5f1e80){try{utils['debug'](util[_0xd6aa('0x21')](_0xd6aa('0x29'),_0x5f1e80['uniqueid']),_0x5f1e80);agents[_0xd6aa('0x28')](_0x5f1e80);queues[_0xd6aa('0x28')](_0x5f1e80);members[_0xd6aa('0x28')](_0x5f1e80);}catch(_0xaf4b58){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x29'),_0x5f1e80[_0xd6aa('0x24')]),_0xaf4b58);}});ami['on'](_0xd6aa('0x2a'),function(_0x56b402){try{utils['debug'](util['format'](_0xd6aa('0x2b'),_0x56b402[_0xd6aa('0x24')]),_0x56b402);agents[_0xd6aa('0x2a')](_0x56b402);queues[_0xd6aa('0x2a')](_0x56b402);}catch(_0x4ae160){utils['error'](util[_0xd6aa('0x21')](_0xd6aa('0x2b'),_0x56b402[_0xd6aa('0x24')]),_0x4ae160);}});ami['on'](_0xd6aa('0x2c'),function(_0x5a4bdc){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')](_0xd6aa('0x2d'),_0x5a4bdc[_0xd6aa('0x24')]),_0x5a4bdc);queues[_0xd6aa('0x2c')](_0x5a4bdc);recordings['queuecallerjoin'](_0x5a4bdc);}catch(_0x294dc1){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x2d'),_0x5a4bdc['uniqueid']),_0x294dc1);}});ami['on'](_0xd6aa('0x2e'),function(_0x113410){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')](_0xd6aa('0x2f'),_0x113410[_0xd6aa('0x24')]),_0x113410);queues['queuecallerleave'](_0x113410);}catch(_0x2724af){utils[_0xd6aa('0x1a')](util['format'](_0xd6aa('0x2f'),_0x113410[_0xd6aa('0x24')]),_0x2724af);}});ami['on'](_0xd6aa('0x30'),function(_0x55386b){try{utils[_0xd6aa('0x1e')](util['format'](_0xd6aa('0x31'),_0x55386b[_0xd6aa('0x24')]),_0x55386b);queues['musiconholdstart'](_0x55386b);calls['musiconholdstart'](_0x55386b);}catch(_0x18b8f3){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x31'),_0x55386b['uniqueid']),_0x18b8f3);}});ami['on'](_0xd6aa('0x32'),function(_0x30b876){try{utils[_0xd6aa('0x1e')](util['format']('[%s][index][musiconholdstop]',_0x30b876[_0xd6aa('0x24')]),_0x30b876);queues[_0xd6aa('0x32')](_0x30b876);calls[_0xd6aa('0x32')](_0x30b876);}catch(_0x139e7f){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')]('[%s][index][musiconholdstop]',_0x30b876[_0xd6aa('0x24')]),_0x139e7f);}});ami['on'](_0xd6aa('0x33'),function(_0x9ed694){try{utils['debug'](util[_0xd6aa('0x21')](_0xd6aa('0x34'),_0x9ed694[_0xd6aa('0x24')]),_0x9ed694);calls[_0xd6aa('0x33')](_0x9ed694);recordings[_0xd6aa('0x33')](_0x9ed694);}catch(_0x3a119e){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x34'),_0x9ed694['uniqueid']),_0x3a119e);}});ami['on'](_0xd6aa('0x35'),function(_0xf97cdf){try{utils[_0xd6aa('0x1e')](util['format'](_0xd6aa('0x36'),_0xf97cdf[_0xd6aa('0x24')]),_0xf97cdf);calls[_0xd6aa('0x35')](_0xf97cdf);recordings['hangup'](_0xf97cdf);dials[_0xd6aa('0x35')](_0xf97cdf);agents[_0xd6aa('0x35')](_0xf97cdf);queues[_0xd6aa('0x35')](_0xf97cdf);}catch(_0x37a29f){utils[_0xd6aa('0x1a')](util['format']('[%s][index][hangup]',_0xf97cdf[_0xd6aa('0x24')]),_0x37a29f);}});ami['on'](_0xd6aa('0x37'),function(_0x12f845){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')](_0xd6aa('0x38'),_0x12f845[_0xd6aa('0x24')]),_0x12f845);members[_0xd6aa('0x37')](_0x12f845);}catch(_0x1dc53b){utils['error'](util[_0xd6aa('0x21')](_0xd6aa('0x38'),_0x12f845[_0xd6aa('0x24')]),_0x1dc53b);}});ami['on']('blindtransfer',function(_0x2ee8f7){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')]('[%s][index][blindtransfer]',_0x2ee8f7['uniqueid']),_0x2ee8f7);queues[_0xd6aa('0x39')](_0x2ee8f7);agents[_0xd6aa('0x39')](_0x2ee8f7);transfers[_0xd6aa('0x39')](_0x2ee8f7);recordings[_0xd6aa('0x39')](_0x2ee8f7);}catch(_0x5560b){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')]('[%s][index][blindtransfer]',_0x2ee8f7[_0xd6aa('0x24')]),_0x5560b);}});ami['on'](_0xd6aa('0x3a'),function(_0x5f45f5){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')](_0xd6aa('0x3b'),_0x5f45f5['origtransfereruniqueid']),_0x5f45f5);queues[_0xd6aa('0x3a')](_0x5f45f5);transfers[_0xd6aa('0x3a')](_0x5f45f5);agents[_0xd6aa('0x3a')](_0x5f45f5);calls['attendedtransfer'](_0x5f45f5);}catch(_0x2dc8ec){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x3b'),_0x5f45f5[_0xd6aa('0x3c')]),_0x2dc8ec);}});ami['on'](_0xd6aa('0x3d'),function(_0x5da910){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')]('[%s][index][varset]',_0x5da910[_0xd6aa('0x24')]),_0x5da910);queues['varset'](_0x5da910);recordings[_0xd6aa('0x3d')](_0x5da910);calls[_0xd6aa('0x3d')](_0x5da910);dials[_0xd6aa('0x3d')](_0x5da910);}catch(_0x3e9433){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x3e'),_0x5da910[_0xd6aa('0x24')]),_0x3e9433);}});ami['on'](_0xd6aa('0x3f'),function(_0x1a217b){try{utils[_0xd6aa('0x1e')](util['format']('[%s][index][newexten]',_0x1a217b[_0xd6aa('0x24')]),_0x1a217b);calls[_0xd6aa('0x3f')](_0x1a217b);recordings[_0xd6aa('0x3f')](_0x1a217b);dials['newexten'](_0x1a217b);}catch(_0x414525){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x40'),_0x1a217b['uniqueid']),_0x414525);}});ami['on'](_0xd6aa('0x41'),function(_0x24b072){try{utils['debug'](util[_0xd6aa('0x21')]('[%s][index][newchannel]',_0x24b072['uniqueid']),_0x24b072);calls[_0xd6aa('0x41')](_0x24b072);recordings[_0xd6aa('0x41')](_0x24b072);}catch(_0x226941){utils['error'](util[_0xd6aa('0x21')](_0xd6aa('0x42'),_0x24b072[_0xd6aa('0x24')]),_0x226941);}});ami['on'](_0xd6aa('0x43'),function(_0x34b5fb){try{utils[_0xd6aa('0x1e')](util[_0xd6aa('0x21')](_0xd6aa('0x44'),_0x34b5fb[_0xd6aa('0x24')]),_0x34b5fb);dials[_0xd6aa('0x43')](_0x34b5fb);}catch(_0x3bb43a){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x45'),_0x34b5fb['uniqueid']),_0x3bb43a);}});ami['on'](_0xd6aa('0x46'),function(_0x2d4a03){try{utils['debug'](util[_0xd6aa('0x21')](_0xd6aa('0x47'),_0x2d4a03[_0xd6aa('0x24')]),_0x2d4a03);dials[_0xd6aa('0x46')](_0x2d4a03);}catch(_0x18a611){utils[_0xd6aa('0x1a')](util[_0xd6aa('0x21')](_0xd6aa('0x47'),_0x2d4a03[_0xd6aa('0x24')]),_0x18a611);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d69fec8..906504f 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 _0x4e4d=['data1','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','enterAt','error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','channel','assign','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s'];(function(_0x31dcf5,_0x36f8c3){var _0x3fee26=function(_0x5e2baa){while(--_0x5e2baa){_0x31dcf5['push'](_0x31dcf5['shift']());}};_0x3fee26(++_0x36f8c3);}(_0x4e4d,0xd7));var _0xd4e4=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x4e4d[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require(_0xd4e4('0x0'));var util=require(_0xd4e4('0x1'));var utils=require(_0xd4e4('0x2'));var members={};var exclude=[_0xd4e4('0x3'),_0xd4e4('0x4')];function writeDB(_0x73b50c){utils[_0xd4e4('0x5')](util[_0xd4e4('0x6')](_0xd4e4('0x7'),_0x73b50c[_0xd4e4('0x8')],_0x73b50c[_0xd4e4('0x9')],_0x73b50c['channel'],_0x73b50c[_0xd4e4('0xa')],_0x73b50c[_0xd4e4('0xb')],_0x73b50c['type']));if(_0x73b50c[_0xd4e4('0x9')]){utils[_0xd4e4('0xc')](_0x73b50c[_0xd4e4('0x9')])['then'](function(_0x5ee44a){if(_0x5ee44a){_0x73b50c[_0xd4e4('0xb')]=_0x5ee44a[_0xd4e4('0xd')];_0x73b50c[_0xd4e4('0xe')]=_0x5ee44a[_0xd4e4('0xe')];utils[_0xd4e4('0xf')](_0xd4e4('0x10'),_0x73b50c);}else{utils[_0xd4e4('0x11')](_0x73b50c[_0xd4e4('0x9')][_0xd4e4('0x12')]('/')[0x1])[_0xd4e4('0x13')](function(_0x492b4a){if(_0x492b4a){_0x73b50c[_0xd4e4('0xb')]=_0x492b4a[_0xd4e4('0xd')];_0x73b50c[_0xd4e4('0xe')]=_0x492b4a[_0xd4e4('0xe')];utils['request']('CreateMemberReport',_0x73b50c);}});}})[_0xd4e4('0x14')](function(_0xbb8f3f){utils['error'](util['format']('[%s][members][writeDB]',_0x73b50c[_0xd4e4('0x8')]),_0xbb8f3f);});}delete members[_0x73b50c[_0xd4e4('0x9')]];}function startsWith(_0x5097d9,_0x1efac0){return _[_0xd4e4('0x15')](_0x5097d9,function(_0x2af259){return _[_0xd4e4('0x16')](_0x1efac0,_0x2af259);});}exports[_0xd4e4('0x17')]=function(_0x497e00){try{utils[_0xd4e4('0x18')](util['format'](_0xd4e4('0x19'),members[_0x497e00['device']]?members[_0x497e00[_0xd4e4('0x1a')]][_0xd4e4('0x8')]:_0x497e00[_0xd4e4('0x1a')]),_0x497e00);utils[_0xd4e4('0x5')](util[_0xd4e4('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x497e00[_0xd4e4('0x1a')]]?members[_0x497e00[_0xd4e4('0x1a')]][_0xd4e4('0x8')]:_0x497e00[_0xd4e4('0x1a')],_0x497e00[_0xd4e4('0x1b')],_0x497e00['device']));switch(_0x497e00[_0xd4e4('0x1b')]){case _0xd4e4('0x1c'):case _0xd4e4('0x1d'):if(!startsWith(exclude,_0x497e00[_0xd4e4('0x1a')])){members[_0x497e00['device']]={'channel':_0xd4e4('0x1e'),'interface':_0x497e00[_0xd4e4('0x1a')],'type':_0xd4e4('0x1f'),'enterAt':utils[_0xd4e4('0x20')](),'role':'agent'};}break;case _0xd4e4('0x21'):if(!_[_0xd4e4('0x22')](members[_0x497e00['device']])){members[_0x497e00[_0xd4e4('0x1a')]][_0xd4e4('0x23')]=utils[_0xd4e4('0x20')]();members[_0x497e00[_0xd4e4('0x1a')]][_0xd4e4('0x24')]=utils['diffTime'](members[_0x497e00[_0xd4e4('0x1a')]][_0xd4e4('0x23')],members[_0x497e00[_0xd4e4('0x1a')]][_0xd4e4('0x25')]);if(members[_0x497e00[_0xd4e4('0x1a')]]['uniqueid']){writeDB(members[_0x497e00[_0xd4e4('0x1a')]]);}}break;default:break;}}catch(_0x5264dc){utils[_0xd4e4('0x26')](util[_0xd4e4('0x6')](_0xd4e4('0x19'),members[_0x497e00[_0xd4e4('0x1a')]]?members[_0x497e00[_0xd4e4('0x1a')]][_0xd4e4('0x8')]:_0x497e00[_0xd4e4('0x1a')]),_0x5264dc);}};exports[_0xd4e4('0x27')]=function(_0x147f9a){try{if(!_['isNil'](members[_0x147f9a[_0xd4e4('0x9')]])){utils['debug'](util[_0xd4e4('0x6')]('[%s][members][agentcomplete]',_0x147f9a[_0xd4e4('0x8')]),_0x147f9a);utils[_0xd4e4('0x5')](util[_0xd4e4('0x6')](_0xd4e4('0x28'),_0x147f9a[_0xd4e4('0x8')],_0x147f9a[_0xd4e4('0x9')],_0x147f9a[_0xd4e4('0x29')]));members[_0x147f9a['interface']]=_['assign'](members[_0x147f9a[_0xd4e4('0x9')]],{'data4':_0x147f9a[_0xd4e4('0x29')],'uniqueid':_0x147f9a['uniqueid']});}}catch(_0xb63755){utils[_0xd4e4('0x26')](util[_0xd4e4('0x6')]('[%s][members][agentcomplete]',_0x147f9a[_0xd4e4('0x8')]),_0xb63755);}};exports[_0xd4e4('0x2a')]=function(_0x5270b4){try{utils[_0xd4e4('0x18')](util[_0xd4e4('0x6')]('[%s][members][cdr]',_0x5270b4[_0xd4e4('0x8')]),_0x5270b4);if(_0x5270b4[_0xd4e4('0x2b')]){var _0x509f39=_0x5270b4[_0xd4e4('0x2b')][_0xd4e4('0x12')]('-')[0x0];if(!_[_0xd4e4('0x22')](members[_0x509f39])){members[_0x509f39]=_[_0xd4e4('0x2c')](members[_0x509f39],{'data1':members[_0x509f39]['data1']||_0x5270b4[_0xd4e4('0x2d')],'data2':members[_0x509f39][_0xd4e4('0xa')]||_0x5270b4[_0xd4e4('0x2e')],'data3':members[_0x509f39][_0xd4e4('0x2f')]||_0x5270b4[_0xd4e4('0x30')],'uniqueid':members[_0x509f39][_0xd4e4('0x8')]||_0x5270b4[_0xd4e4('0x8')]});utils[_0xd4e4('0x5')](util[_0xd4e4('0x6')](_0xd4e4('0x31'),_0x5270b4['uniqueid'],members[_0x509f39][_0xd4e4('0x32')],members[_0x509f39][_0xd4e4('0xa')],members[_0x509f39][_0xd4e4('0x2f')]));if(members[_0x509f39][_0xd4e4('0x23')]){writeDB(members[_0x509f39]);}}}if(_0x5270b4[_0xd4e4('0x33')]){var _0x208197=_0x5270b4[_0xd4e4('0x33')][_0xd4e4('0x12')]('-')[0x0];if(!_[_0xd4e4('0x22')](members[_0x208197])){members[_0x208197]=_[_0xd4e4('0x2c')](members[_0x208197],{'data1':members[_0x208197]['data1']||_0x5270b4[_0xd4e4('0x2d')],'data2':members[_0x208197]['data2']||_0x5270b4[_0xd4e4('0x2e')],'data3':members[_0x208197][_0xd4e4('0x2f')]||_0x5270b4[_0xd4e4('0x30')],'uniqueid':members[_0x208197][_0xd4e4('0x8')]||_0x5270b4[_0xd4e4('0x8')]});utils[_0xd4e4('0x5')](util[_0xd4e4('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5270b4[_0xd4e4('0x8')],members[_0x208197][_0xd4e4('0x32')],members[_0x208197][_0xd4e4('0xa')],members[_0x208197]['data3']));if(members[_0x208197][_0xd4e4('0x23')]){writeDB(members[_0x208197]);}}}}catch(_0x2278eb){utils[_0xd4e4('0x26')](util[_0xd4e4('0x6')](_0xd4e4('0x34'),_0x5270b4[_0xd4e4('0x8')]),_0x2278eb);}}; \ No newline at end of file +var _0x5b96=['membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','error','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','channel','data1','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0x5b96,0xbc));var _0x65b9=function(_0x26447e,_0x2e9c94){_0x26447e=_0x26447e-0x0;var _0x38cc1a=_0x5b96[_0x26447e];return _0x38cc1a;};'use strict';var _=require(_0x65b9('0x0'));var util=require('util');var utils=require(_0x65b9('0x1'));var members={};var exclude=[_0x65b9('0x2'),'Queue:'];function writeDB(_0x13a0ff){utils[_0x65b9('0x3')](util[_0x65b9('0x4')](_0x65b9('0x5'),_0x13a0ff[_0x65b9('0x6')],_0x13a0ff[_0x65b9('0x7')],_0x13a0ff['channel'],_0x13a0ff['data2'],_0x13a0ff[_0x65b9('0x8')],_0x13a0ff[_0x65b9('0x9')]));if(_0x13a0ff[_0x65b9('0x7')]){utils[_0x65b9('0xa')](_0x13a0ff['interface'])[_0x65b9('0xb')](function(_0x421031){if(_0x421031){_0x13a0ff[_0x65b9('0x8')]=_0x421031[_0x65b9('0xc')];_0x13a0ff[_0x65b9('0xd')]=_0x421031['internal'];utils['request'](_0x65b9('0xe'),_0x13a0ff);}else{utils[_0x65b9('0xf')](_0x13a0ff[_0x65b9('0x7')][_0x65b9('0x10')]('/')[0x1])[_0x65b9('0xb')](function(_0x48556a){if(_0x48556a){_0x13a0ff[_0x65b9('0x8')]=_0x48556a[_0x65b9('0xc')];_0x13a0ff[_0x65b9('0xd')]=_0x48556a['internal'];utils[_0x65b9('0x11')](_0x65b9('0xe'),_0x13a0ff);}});}})['catch'](function(_0x574cbe){utils[_0x65b9('0x12')](util[_0x65b9('0x4')]('[%s][members][writeDB]',_0x13a0ff['uniqueid']),_0x574cbe);});}delete members[_0x13a0ff[_0x65b9('0x7')]];}function startsWith(_0x4846dc,_0x339f2d){return _['some'](_0x4846dc,function(_0x3e3064){return _[_0x65b9('0x13')](_0x339f2d,_0x3e3064);});}exports[_0x65b9('0x14')]=function(_0x34e3e2){try{utils['debug'](util[_0x65b9('0x4')](_0x65b9('0x15'),members[_0x34e3e2[_0x65b9('0x16')]]?members[_0x34e3e2[_0x65b9('0x16')]][_0x65b9('0x6')]:_0x34e3e2[_0x65b9('0x16')]),_0x34e3e2);utils[_0x65b9('0x3')](util[_0x65b9('0x4')](_0x65b9('0x17'),members[_0x34e3e2['device']]?members[_0x34e3e2[_0x65b9('0x16')]][_0x65b9('0x6')]:_0x34e3e2[_0x65b9('0x16')],_0x34e3e2[_0x65b9('0x18')],_0x34e3e2[_0x65b9('0x16')]));switch(_0x34e3e2[_0x65b9('0x18')]){case _0x65b9('0x19'):case _0x65b9('0x1a'):if(!startsWith(exclude,_0x34e3e2[_0x65b9('0x16')])){members[_0x34e3e2[_0x65b9('0x16')]]={'channel':'voice','interface':_0x34e3e2[_0x65b9('0x16')],'type':_0x65b9('0x1b'),'enterAt':utils[_0x65b9('0x1c')](),'role':'agent'};}break;case _0x65b9('0x1d'):if(!_[_0x65b9('0x1e')](members[_0x34e3e2[_0x65b9('0x16')]])){members[_0x34e3e2[_0x65b9('0x16')]][_0x65b9('0x1f')]=utils[_0x65b9('0x1c')]();members[_0x34e3e2[_0x65b9('0x16')]]['duration']=utils[_0x65b9('0x20')](members[_0x34e3e2['device']][_0x65b9('0x1f')],members[_0x34e3e2[_0x65b9('0x16')]][_0x65b9('0x21')]);if(members[_0x34e3e2['device']][_0x65b9('0x6')]){writeDB(members[_0x34e3e2[_0x65b9('0x16')]]);}}break;default:break;}}catch(_0x197f27){utils[_0x65b9('0x12')](util[_0x65b9('0x4')](_0x65b9('0x15'),members[_0x34e3e2['device']]?members[_0x34e3e2[_0x65b9('0x16')]][_0x65b9('0x6')]:_0x34e3e2['device']),_0x197f27);}};exports[_0x65b9('0x22')]=function(_0x491777){try{if(!_[_0x65b9('0x1e')](members[_0x491777[_0x65b9('0x7')]])){utils[_0x65b9('0x23')](util[_0x65b9('0x4')](_0x65b9('0x24'),_0x491777[_0x65b9('0x6')]),_0x491777);utils[_0x65b9('0x3')](util[_0x65b9('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x491777['uniqueid'],_0x491777['interface'],_0x491777[_0x65b9('0x25')]));members[_0x491777[_0x65b9('0x7')]]=_[_0x65b9('0x26')](members[_0x491777['interface']],{'data4':_0x491777[_0x65b9('0x25')],'uniqueid':_0x491777[_0x65b9('0x6')]});}}catch(_0x3d854f){utils[_0x65b9('0x12')](util[_0x65b9('0x4')](_0x65b9('0x24'),_0x491777[_0x65b9('0x6')]),_0x3d854f);}};exports[_0x65b9('0x27')]=function(_0x26e9bc){try{utils['debug'](util[_0x65b9('0x4')](_0x65b9('0x28'),_0x26e9bc['uniqueid']),_0x26e9bc);if(_0x26e9bc[_0x65b9('0x29')]){var _0x22721d=_0x26e9bc[_0x65b9('0x29')][_0x65b9('0x10')]('-')[0x0];if(!_['isNil'](members[_0x22721d])){members[_0x22721d]=_[_0x65b9('0x26')](members[_0x22721d],{'data1':members[_0x22721d][_0x65b9('0x2a')]||_0x26e9bc['type'],'data2':members[_0x22721d][_0x65b9('0x2b')]||_0x26e9bc['source'],'data3':members[_0x22721d][_0x65b9('0x2c')]||_0x26e9bc[_0x65b9('0x2d')],'uniqueid':members[_0x22721d][_0x65b9('0x6')]||_0x26e9bc[_0x65b9('0x6')]});utils[_0x65b9('0x3')](util[_0x65b9('0x4')](_0x65b9('0x2e'),_0x26e9bc[_0x65b9('0x6')],members[_0x22721d][_0x65b9('0x2a')],members[_0x22721d][_0x65b9('0x2b')],members[_0x22721d]['data3']));if(members[_0x22721d][_0x65b9('0x1f')]){writeDB(members[_0x22721d]);}}}if(_0x26e9bc[_0x65b9('0x2f')]){var _0x5c85af=_0x26e9bc[_0x65b9('0x2f')][_0x65b9('0x10')]('-')[0x0];if(!_[_0x65b9('0x1e')](members[_0x5c85af])){members[_0x5c85af]=_[_0x65b9('0x26')](members[_0x5c85af],{'data1':members[_0x5c85af][_0x65b9('0x2a')]||_0x26e9bc[_0x65b9('0x9')],'data2':members[_0x5c85af][_0x65b9('0x2b')]||_0x26e9bc[_0x65b9('0x30')],'data3':members[_0x5c85af][_0x65b9('0x2c')]||_0x26e9bc[_0x65b9('0x2d')],'uniqueid':members[_0x5c85af][_0x65b9('0x6')]||_0x26e9bc[_0x65b9('0x6')]});utils[_0x65b9('0x3')](util[_0x65b9('0x4')](_0x65b9('0x2e'),_0x26e9bc[_0x65b9('0x6')],members[_0x5c85af][_0x65b9('0x2a')],members[_0x5c85af][_0x65b9('0x2b')],members[_0x5c85af][_0x65b9('0x2c')]));if(members[_0x5c85af][_0x65b9('0x1f')]){writeDB(members[_0x5c85af]);}}}}catch(_0x32e81a){utils[_0x65b9('0x12')](util['format'](_0x65b9('0x28'),_0x26e9bc[_0x65b9('0x6')]),_0x32e81a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c867f0c..0faaf74 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 _0xb106=['musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','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','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transferuniqueid','transfertargetlinkedid'];(function(_0x41570c,_0x59a329){var _0x44eb13=function(_0x53c182){while(--_0x53c182){_0x41570c['push'](_0x41570c['shift']());}};_0x44eb13(++_0x59a329);}(_0xb106,0x1a1));var _0x6b10=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xb106[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0x6b10('0x0'));var util=require('util');var utils=require(_0x6b10('0x1'));var queues={};function writeDB(_0x52ae7b){utils[_0x6b10('0x2')](util[_0x6b10('0x3')](_0x6b10('0x4'),_0x52ae7b[_0x6b10('0x5')],_0x52ae7b['channel'],_0x52ae7b['queue'],_0x52ae7b[_0x6b10('0x6')],_0x52ae7b[_0x6b10('0x7')],_0x52ae7b[_0x6b10('0x8')],_0x52ae7b['queuecallerexitreason']));if(_0x52ae7b[_0x6b10('0x9')]){utils[_0x6b10('0xa')](_0x52ae7b['queue'])[_0x6b10('0xb')](function(_0x457068){if(_0x457068){_0x52ae7b['type']=_0x457068[_0x6b10('0xc')];}utils[_0x6b10('0xd')]('CreateVoiceQueueReport',_0x52ae7b);});}else{utils[_0x6b10('0xd')](_0x6b10('0xe'),_0x52ae7b);}if(_0x52ae7b[_0x6b10('0xf')]){delete queues[_0x52ae7b['transfereduniqueid']];}else{delete queues[_0x52ae7b[_0x6b10('0x5')]];}}exports[_0x6b10('0x10')]=function(_0x2cc670){try{utils['debug'](util['format'](_0x6b10('0x11'),_0x2cc670[_0x6b10('0x5')]),_0x2cc670);utils['info'](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x2cc670[_0x6b10('0x5')],_0x2cc670[_0x6b10('0x9')],_0x2cc670[_0x6b10('0x12')]));queues[_0x2cc670[_0x6b10('0x5')]]=_[_0x6b10('0x13')](_0x2cc670,{'originalposition':_0x2cc670[_0x6b10('0x12')],'queuecallerjoinAt':utils[_0x6b10('0x14')](),'mohtime':0x0});}catch(_0xda5600){utils[_0x6b10('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x2cc670[_0x6b10('0x5')]),_0xda5600);}};exports[_0x6b10('0x16')]=function(_0x216060){try{if(!_[_0x6b10('0x17')](queues[_0x216060[_0x6b10('0x5')]])){utils[_0x6b10('0x18')](util['format'](_0x6b10('0x19'),_0x216060[_0x6b10('0x5')]),_0x216060);if(queues[_0x216060['uniqueid']][_0x6b10('0x1a')]){if(!queues[_0x216060[_0x6b10('0x5')]][_0x6b10('0x1b')]&&!queues[_0x216060['uniqueid']][_0x6b10('0x1c')]){queues[_0x216060[_0x6b10('0x5')]][_0x6b10('0x1d')]=!![];queues[_0x216060[_0x6b10('0x5')]][_0x6b10('0x1e')]=utils[_0x6b10('0x14')]();queues[_0x216060[_0x6b10('0x5')]][_0x6b10('0x1f')]='COMPLETEDBYAGENT';}utils['info'](util[_0x6b10('0x3')](_0x6b10('0x20'),_0x216060[_0x6b10('0x5')],queues[_0x216060[_0x6b10('0x5')]]['name'],queues[_0x216060[_0x6b10('0x5')]][_0x6b10('0x1f')]));writeDB(queues[_0x216060[_0x6b10('0x5')]]);}else if(queues[_0x216060[_0x6b10('0x5')]]['transfereduniqueid']){utils[_0x6b10('0x2')](util['format'](_0x6b10('0x21'),_0x216060[_0x6b10('0x5')],queues[_0x216060[_0x6b10('0x5')]][_0x6b10('0x22')],queues[_0x216060['uniqueid']][_0x6b10('0xf')]));queues[queues[_0x216060['uniqueid']][_0x6b10('0xf')]]=queues[_0x216060[_0x6b10('0x5')]];queues[queues[_0x216060[_0x6b10('0x5')]][_0x6b10('0xf')]][_0x6b10('0x23')]=0x2;delete queues[_0x216060[_0x6b10('0x5')]];}}}catch(_0x4baf7f){utils[_0x6b10('0x15')](util[_0x6b10('0x3')](_0x6b10('0x19'),_0x216060[_0x6b10('0x5')]),_0x4baf7f);}};exports[_0x6b10('0x24')]=function(_0x3fc77f){try{utils[_0x6b10('0x18')](util[_0x6b10('0x3')](_0x6b10('0x25'),_0x3fc77f['uniqueid']),_0x3fc77f);if(!_['isNil'](_0x3fc77f[_0x6b10('0x26')][_0x6b10('0x27')])&&_0x3fc77f[_0x6b10('0x28')][_0x6b10('0x29')]()!==_0x6b10('0x2a')){if(!_['isNil'](queues[_0x3fc77f[_0x6b10('0x5')]])){queues[_0x3fc77f['uniqueid']][_0x6b10('0x1b')]=![];queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x2b')]=null;queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x1c')]=!![];queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x2c')]=utils[_0x6b10('0x14')]();queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x1f')]=_0x3fc77f['value'][_0x6b10('0x29')]();utils[_0x6b10('0x2')](util[_0x6b10('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3fc77f[_0x6b10('0x5')],queues[_0x3fc77f['uniqueid']][_0x6b10('0x22')],_0x3fc77f['value'],queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x1f')]));writeDB(queues[_0x3fc77f[_0x6b10('0x5')]]);}}else if(!_['isNil'](_0x3fc77f[_0x6b10('0x26')]['queueposition'])){if(!_['isNil'](queues[_0x3fc77f[_0x6b10('0x5')]])&&!queues[_0x3fc77f[_0x6b10('0x5')]]['queuecallerabandon']){queues[_0x3fc77f[_0x6b10('0x5')]]['queuecallerabandon']=![];queues[_0x3fc77f[_0x6b10('0x5')]]['queuecallerabandonAt']=null;queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x1c')]=!![];queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x2c')]=utils['now']();queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x1f')]=_0x6b10('0x2d');utils[_0x6b10('0x2')](util[_0x6b10('0x3')](_0x6b10('0x2e'),_0x3fc77f['uniqueid'],queues[_0x3fc77f['uniqueid']][_0x6b10('0x22')],_0x3fc77f[_0x6b10('0x28')],queues[_0x3fc77f[_0x6b10('0x5')]][_0x6b10('0x1f')]));}}}catch(_0x16870d){utils['error'](util[_0x6b10('0x3')](_0x6b10('0x25'),_0x3fc77f[_0x6b10('0x5')]),_0x16870d);}};exports['queuecallerabandon']=function(_0x25b237){try{if(!_[_0x6b10('0x17')](queues[_0x25b237[_0x6b10('0x5')]])){utils['debug'](util['format'](_0x6b10('0x2f'),_0x25b237['uniqueid']),_0x25b237);queues[_0x25b237[_0x6b10('0x5')]][_0x6b10('0x1c')]=![];queues[_0x25b237[_0x6b10('0x5')]][_0x6b10('0x2c')]=null;queues[_0x25b237[_0x6b10('0x5')]][_0x6b10('0x1b')]=!![];queues[_0x25b237[_0x6b10('0x5')]][_0x6b10('0x2b')]=utils[_0x6b10('0x14')]();queues[_0x25b237[_0x6b10('0x5')]][_0x6b10('0x1f')]=_0x6b10('0x30');utils[_0x6b10('0x2')](util[_0x6b10('0x3')](_0x6b10('0x31'),_0x25b237[_0x6b10('0x5')],queues[_0x25b237[_0x6b10('0x5')]][_0x6b10('0x22')],queues[_0x25b237[_0x6b10('0x5')]]['queuecallerexitreason']));}}catch(_0x52a066){utils[_0x6b10('0x15')](util[_0x6b10('0x3')](_0x6b10('0x2f'),_0x25b237['uniqueid']),_0x52a066);}};exports[_0x6b10('0x32')]=function(_0x15e991){try{if(!_[_0x6b10('0x17')](queues[_0x15e991[_0x6b10('0x5')]])){utils[_0x6b10('0x18')](util[_0x6b10('0x3')](_0x6b10('0x33'),_0x15e991[_0x6b10('0x5')]),_0x15e991);utils[_0x6b10('0x2')](util['format'](_0x6b10('0x34'),_0x15e991[_0x6b10('0x5')],queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x22')],_0x15e991['connectedlinenum'],_0x15e991['connectedlinename']));queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x32')]=!![];queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x1a')]=utils[_0x6b10('0x14')]();queues[_0x15e991['uniqueid']][_0x6b10('0x35')]=utils[_0x6b10('0x36')](queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x1a')],queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x37')]);queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x12')]=_0x15e991[_0x6b10('0x12')];queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x38')]=_0x15e991[_0x6b10('0x38')];queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x39')]=_0x15e991[_0x6b10('0x39')];queues[_0x15e991[_0x6b10('0x5')]][_0x6b10('0x3a')]=_0x15e991[_0x6b10('0x3a')];}}catch(_0x27f906){utils['error'](util[_0x6b10('0x3')](_0x6b10('0x33'),_0x15e991['uniqueid']),_0x27f906);}};exports[_0x6b10('0x3b')]=function(_0x204822){try{if(!_[_0x6b10('0x17')](queues[_0x204822[_0x6b10('0x5')]])){utils[_0x6b10('0x18')](util['format'](_0x6b10('0x3c'),_0x204822['uniqueid']),_0x204822);utils[_0x6b10('0x2')](util[_0x6b10('0x3')](_0x6b10('0x3d'),_0x204822[_0x6b10('0x5')],queues[_0x204822[_0x6b10('0x5')]][_0x6b10('0x22')],_0x204822[_0x6b10('0x3e')],_0x204822['destaccountcode']));queues[_0x204822[_0x6b10('0x5')]]['queuecallerabandon']=![];queues[_0x204822[_0x6b10('0x5')]][_0x6b10('0x1b')]=![];queues[_0x204822[_0x6b10('0x5')]][_0x6b10('0x2b')]=null;queues[_0x204822[_0x6b10('0x5')]]['queuecallerexit']=![];queues[_0x204822['uniqueid']][_0x6b10('0x1f')]=null;queues[_0x204822[_0x6b10('0x5')]][_0x6b10('0x2c')]=null;queues[_0x204822[_0x6b10('0x5')]][_0x6b10('0x3f')]=!![];queues[_0x204822['uniqueid']][_0x6b10('0x8')]=_0x204822[_0x6b10('0x40')];queues[_0x204822[_0x6b10('0x5')]][_0x6b10('0x6')]=_0x204822[_0x6b10('0x3e')];}}catch(_0x4a4be2){utils[_0x6b10('0x15')](util[_0x6b10('0x3')]('[%s][queues][agentconnect]',_0x204822[_0x6b10('0x5')]),_0x4a4be2);}};exports[_0x6b10('0x41')]=function(_0x42eda1){try{if(!_[_0x6b10('0x17')](queues[_0x42eda1[_0x6b10('0x5')]])){if(queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x1a')]){utils['debug'](util[_0x6b10('0x3')]('[%s][queues][agentcomplete]',_0x42eda1[_0x6b10('0x5')]),_0x42eda1);queues[_0x42eda1[_0x6b10('0x5')]]['queuecallerabandon']=![];queues[_0x42eda1[_0x6b10('0x5')]]['queuecallerabandon']=![];queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x2b')]=null;queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x1c')]=![];queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x2c')]=null;queues[_0x42eda1[_0x6b10('0x5')]]['assigned']=!![];queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x6')]=_0x42eda1[_0x6b10('0x3e')];queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x1d')]=!![];queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x1e')]=utils[_0x6b10('0x14')]();if(_0x42eda1[_0x6b10('0x42')]==_0x6b10('0x43')){if(!queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x43')]){queues[_0x42eda1[_0x6b10('0x5')]]['queuecallerexitreason']=_0x6b10('0x44');}}else{queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x1f')]='COMPLETEDBY'+_0x42eda1[_0x6b10('0x42')][_0x6b10('0x29')]();}utils[_0x6b10('0x2')](util[_0x6b10('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x42eda1[_0x6b10('0x5')],queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x22')],_0x42eda1[_0x6b10('0x3e')],queues[_0x42eda1[_0x6b10('0x5')]][_0x6b10('0x1f')]));writeDB(queues[_0x42eda1['uniqueid']]);}}}catch(_0x50e487){utils[_0x6b10('0x15')](util[_0x6b10('0x3')](_0x6b10('0x45'),_0x42eda1['uniqueid']),_0x50e487);}};exports[_0x6b10('0x46')]=function(_0x3fef12){try{if(!_[_0x6b10('0x17')](queues[_0x3fef12[_0x6b10('0x47')]])){utils[_0x6b10('0x18')](util['format'](_0x6b10('0x48'),_0x3fef12[_0x6b10('0x5')]),_0x3fef12);queues[_0x3fef12[_0x6b10('0x47')]]['transfer']=!![];queues[_0x3fef12['transfereeuniqueid']][_0x6b10('0x49')]=_0x6b10('0x4a');queues[_0x3fef12['transfereeuniqueid']][_0x6b10('0x4b')]=_0x3fef12['extension'];queues[_0x3fef12[_0x6b10('0x47')]]['transferuniqueid']=_0x3fef12[_0x6b10('0x47')];queues[_0x3fef12[_0x6b10('0x47')]]['queuecallerexitreason']=_0x6b10('0x4c');utils['info'](util[_0x6b10('0x3')](_0x6b10('0x4d'),_0x3fef12[_0x6b10('0x5')],queues[_0x3fef12[_0x6b10('0x47')]][_0x6b10('0x22')],_0x3fef12['transfereeuniqueid'],_0x3fef12['extension']));}}catch(_0x8d0d43){utils[_0x6b10('0x15')](util[_0x6b10('0x3')](_0x6b10('0x48'),_0x3fef12[_0x6b10('0x5')]),_0x8d0d43);}};exports[_0x6b10('0x4e')]=function(_0x58cfd5){try{utils[_0x6b10('0x18')](util[_0x6b10('0x3')](_0x6b10('0x4f'),_0x58cfd5[_0x6b10('0x50')]),_0x58cfd5);if(_0x58cfd5[_0x6b10('0x50')]==_0x58cfd5[_0x6b10('0x51')]){if(!_[_0x6b10('0x17')](queues[_0x58cfd5[_0x6b10('0x52')]])){utils[_0x6b10('0x2')](util[_0x6b10('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x58cfd5[_0x6b10('0x50')],queues[_0x58cfd5[_0x6b10('0x52')]][_0x6b10('0x22')],_0x58cfd5['origtransfererexten']));queues[_0x58cfd5[_0x6b10('0x52')]]['transfer']=!![];queues[_0x58cfd5[_0x6b10('0x52')]][_0x6b10('0x49')]=_0x6b10('0x53');queues[_0x58cfd5['secondtransfererlinkedid']]['transferexten']=_0x58cfd5[_0x6b10('0x54')];queues[_0x58cfd5['secondtransfererlinkedid']]['transferuniqueid']=_0x58cfd5[_0x6b10('0x50')];queues[_0x58cfd5[_0x6b10('0x52')]]['queuecallerexitreason']=_0x6b10('0x55');}if(!_[_0x6b10('0x17')](queues[_0x58cfd5[_0x6b10('0x51')]])){if(_0x58cfd5['transfereelinkedid']&&queues[_0x58cfd5[_0x6b10('0x56')]]){queues[_0x58cfd5[_0x6b10('0x56')]][_0x6b10('0x23')]=0x1;queues[_0x58cfd5[_0x6b10('0x47')]]=_[_0x6b10('0x57')](queues[_0x58cfd5[_0x6b10('0x56')]]);queues[_0x58cfd5[_0x6b10('0x47')]][_0x6b10('0xf')]=_0x58cfd5[_0x6b10('0x58')];queues[_0x58cfd5['transfereeuniqueid']][_0x6b10('0x23')]=0x2;queues[_0x58cfd5['transfereeuniqueid']]['calleridnum']=queues[_0x58cfd5[_0x6b10('0x52')]]['calleridnum'];queues[_0x58cfd5[_0x6b10('0x47')]]['calleridname']=queues[_0x58cfd5['secondtransfererlinkedid']][_0x6b10('0x59')];queues[_0x58cfd5['transfereeuniqueid']][_0x6b10('0x37')]=utils[_0x6b10('0x14')]();queues[_0x58cfd5['transfereeuniqueid']][_0x6b10('0x1a')]=utils['now']();queues[_0x58cfd5['transfereeuniqueid']][_0x6b10('0x35')]=0x0;queues[_0x58cfd5[_0x6b10('0x47')]][_0x6b10('0x5a')]=0x0;utils[_0x6b10('0x2')](util[_0x6b10('0x3')](_0x6b10('0x5b'),_0x58cfd5[_0x6b10('0x50')],queues[_0x58cfd5[_0x6b10('0x47')]][_0x6b10('0x22')],queues[_0x58cfd5[_0x6b10('0x47')]][_0x6b10('0x7')],queues[_0x58cfd5[_0x6b10('0x47')]][_0x6b10('0x59')]));}else{utils['info'](util['format'](_0x6b10('0x5c'),_0x58cfd5['origtransfereruniqueid'],queues[_0x58cfd5['origtransfererlinkedid']][_0x6b10('0x22')],_0x58cfd5[_0x6b10('0x52')]));queues[_0x58cfd5['origtransfererlinkedid']][_0x6b10('0xf')]=_0x58cfd5[_0x6b10('0x52')];}}}else if(_0x58cfd5['secondtransfereruniqueid']==_0x58cfd5[_0x6b10('0x52')]){if(!_['isNil'](queues[_0x58cfd5[_0x6b10('0x51')]])){utils[_0x6b10('0x2')](util['format'](_0x6b10('0x5d'),_0x58cfd5[_0x6b10('0x50')],queues[_0x58cfd5[_0x6b10('0x51')]][_0x6b10('0x22')],_0x58cfd5[_0x6b10('0x5e')],_0x58cfd5[_0x6b10('0x5f')]));queues[_0x58cfd5['origtransfererlinkedid']][_0x6b10('0x43')]=!![];queues[_0x58cfd5[_0x6b10('0x51')]][_0x6b10('0x49')]=_0x6b10('0x53');queues[_0x58cfd5['origtransfererlinkedid']]['transferexten']=_0x58cfd5[_0x6b10('0x5f')];queues[_0x58cfd5['origtransfererlinkedid']][_0x6b10('0x60')]=_0x58cfd5[_0x6b10('0x5e')];queues[_0x58cfd5[_0x6b10('0x51')]][_0x6b10('0x1f')]=_0x6b10('0x55');}if(!_['isNil'](queues[_0x58cfd5[_0x6b10('0x52')]])){if(_0x58cfd5[_0x6b10('0x61')]&&queues[_0x58cfd5[_0x6b10('0x61')]]){queues[_0x58cfd5['transfertargetlinkedid']][_0x6b10('0x23')]=0x1;queues[_0x58cfd5[_0x6b10('0x58')]]=_['clone'](queues[_0x58cfd5[_0x6b10('0x61')]]);queues[_0x58cfd5['transfertargetuniqueid']][_0x6b10('0xf')]=_0x58cfd5[_0x6b10('0x58')];queues[_0x58cfd5['transfertargetuniqueid']][_0x6b10('0x23')]=0x2;queues[_0x58cfd5[_0x6b10('0x58')]][_0x6b10('0x7')]=queues[_0x58cfd5['origtransfererlinkedid']][_0x6b10('0x7')];queues[_0x58cfd5[_0x6b10('0x58')]][_0x6b10('0x59')]=queues[_0x58cfd5['origtransfererlinkedid']][_0x6b10('0x59')];queues[_0x58cfd5['transfertargetuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x58cfd5[_0x6b10('0x58')]][_0x6b10('0x1a')]=utils[_0x6b10('0x14')]();queues[_0x58cfd5['transfertargetuniqueid']][_0x6b10('0x35')]=0x0;queues[_0x58cfd5[_0x6b10('0x58')]]['mohtime']=0x0;utils[_0x6b10('0x2')](util[_0x6b10('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x58cfd5[_0x6b10('0x50')],queues[_0x58cfd5['transfertargetuniqueid']][_0x6b10('0x22')],queues[_0x58cfd5['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x58cfd5['transfertargetuniqueid']]['calleridnum'],queues[_0x58cfd5[_0x6b10('0x58')]][_0x6b10('0x59')]));}else{utils[_0x6b10('0x2')](util[_0x6b10('0x3')](_0x6b10('0x5c'),_0x58cfd5[_0x6b10('0x50')],queues[_0x58cfd5['secondtransfererlinkedid']][_0x6b10('0x22')],_0x58cfd5[_0x6b10('0x51')]));queues[_0x58cfd5[_0x6b10('0x52')]][_0x6b10('0xf')]=_0x58cfd5['origtransfererlinkedid'];}}}}catch(_0x9adc5e){utils[_0x6b10('0x15')](util[_0x6b10('0x3')]('[%s][queues][attendedtransfer]',_0x58cfd5[_0x6b10('0x50')]),_0x9adc5e);}};exports[_0x6b10('0x62')]=function(_0x15386f){try{if(!_[_0x6b10('0x17')](queues[_0x15386f[_0x6b10('0x5')]])){utils['debug'](util[_0x6b10('0x3')]('[%s][queues][musiconholdstart]',_0x15386f[_0x6b10('0x5')]),_0x15386f);queues[_0x15386f[_0x6b10('0x5')]]['musiconholdstartAt']=utils[_0x6b10('0x14')]();utils[_0x6b10('0x2')](util[_0x6b10('0x3')](_0x6b10('0x63'),_0x15386f['uniqueid'],queues[_0x15386f[_0x6b10('0x5')]][_0x6b10('0x22')],queues[_0x15386f['uniqueid']][_0x6b10('0x64')]));}}catch(_0x51ee15){utils[_0x6b10('0x15')](util[_0x6b10('0x3')]('[%s][queues][musiconholdstart]',_0x15386f['uniqueid']),_0x51ee15);}};exports[_0x6b10('0x65')]=function(_0x71b654){try{if(!_[_0x6b10('0x17')](queues[_0x71b654[_0x6b10('0x5')]])){if(!_[_0x6b10('0x17')](queues[_0x71b654[_0x6b10('0x5')]][_0x6b10('0x64')])){utils[_0x6b10('0x18')](util[_0x6b10('0x3')](_0x6b10('0x66'),_0x71b654['uniqueid']),_0x71b654);queues[_0x71b654[_0x6b10('0x5')]]['mohtime']+=utils[_0x6b10('0x36')](utils[_0x6b10('0x14')](),queues[_0x71b654['uniqueid']][_0x6b10('0x64')]);utils[_0x6b10('0x2')](util[_0x6b10('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x71b654['uniqueid'],queues[_0x71b654['uniqueid']][_0x6b10('0x22')],queues[_0x71b654['uniqueid']]['mohtime']));delete queues[_0x71b654[_0x6b10('0x5')]]['musiconholdstartAt'];}}}catch(_0x2d6a90){utils[_0x6b10('0x15')](util['format'](_0x6b10('0x66'),_0x71b654['uniqueid']),_0x2d6a90);}}; \ No newline at end of file +var _0xea86=['./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','position','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','isNil','queuestatus','toUpperCase','CONTINUE','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','variable','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfer','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','secondtransfererexten','transfertargetlinkedid','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash'];(function(_0x48b4a1,_0x3c2bf4){var _0x2df379=function(_0x5962c1){while(--_0x5962c1){_0x48b4a1['push'](_0x48b4a1['shift']());}};_0x2df379(++_0x3c2bf4);}(_0xea86,0xcd));var _0x6ea8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea86[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6ea8('0x0'));var util=require('util');var utils=require(_0x6ea8('0x1'));var queues={};function writeDB(_0x3a6e88){utils[_0x6ea8('0x2')](util['format'](_0x6ea8('0x3'),_0x3a6e88[_0x6ea8('0x4')],_0x3a6e88[_0x6ea8('0x5')],_0x3a6e88[_0x6ea8('0x6')],_0x3a6e88[_0x6ea8('0x7')],_0x3a6e88['calleridnum'],_0x3a6e88[_0x6ea8('0x8')],_0x3a6e88[_0x6ea8('0x9')]));if(_0x3a6e88['queue']){utils[_0x6ea8('0xa')](_0x3a6e88[_0x6ea8('0x6')])[_0x6ea8('0xb')](function(_0x5d7534){if(_0x5d7534){_0x3a6e88[_0x6ea8('0xc')]=_0x5d7534[_0x6ea8('0xc')];}utils[_0x6ea8('0xd')](_0x6ea8('0xe'),_0x3a6e88);});}else{utils[_0x6ea8('0xd')](_0x6ea8('0xe'),_0x3a6e88);}if(_0x3a6e88[_0x6ea8('0xf')]){delete queues[_0x3a6e88[_0x6ea8('0xf')]];}else{delete queues[_0x3a6e88[_0x6ea8('0x4')]];}}exports[_0x6ea8('0x10')]=function(_0xe03c50){try{utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')]('[%s][queues][queuecallerjoin]',_0xe03c50[_0x6ea8('0x4')]),_0xe03c50);utils['info'](util[_0x6ea8('0x12')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xe03c50[_0x6ea8('0x4')],_0xe03c50[_0x6ea8('0x6')],_0xe03c50['position']));queues[_0xe03c50[_0x6ea8('0x4')]]=_['assign'](_0xe03c50,{'originalposition':_0xe03c50[_0x6ea8('0x13')],'queuecallerjoinAt':utils[_0x6ea8('0x14')](),'mohtime':0x0});}catch(_0x535fef){utils[_0x6ea8('0x15')](util['format'](_0x6ea8('0x16'),_0xe03c50[_0x6ea8('0x4')]),_0x535fef);}};exports[_0x6ea8('0x17')]=function(_0x357d70){try{if(!_['isNil'](queues[_0x357d70[_0x6ea8('0x4')]])){utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')](_0x6ea8('0x18'),_0x357d70['uniqueid']),_0x357d70);if(queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0x19')]){if(!queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0x1a')]&&!queues[_0x357d70['uniqueid']][_0x6ea8('0x1b')]){queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0x1c')]=!![];queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0x1d')]=utils[_0x6ea8('0x14')]();queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0x9')]=_0x6ea8('0x1e');}utils['info'](util[_0x6ea8('0x12')](_0x6ea8('0x1f'),_0x357d70[_0x6ea8('0x4')],queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0x20')],queues[_0x357d70[_0x6ea8('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x357d70[_0x6ea8('0x4')]]);}else if(queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0xf')]){utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x357d70['uniqueid'],queues[_0x357d70['uniqueid']][_0x6ea8('0x20')],queues[_0x357d70[_0x6ea8('0x4')]]['transfereduniqueid']));queues[queues[_0x357d70['uniqueid']][_0x6ea8('0xf')]]=queues[_0x357d70[_0x6ea8('0x4')]];queues[queues[_0x357d70[_0x6ea8('0x4')]][_0x6ea8('0xf')]][_0x6ea8('0x21')]=0x2;delete queues[_0x357d70['uniqueid']];}}}catch(_0x5094a7){utils[_0x6ea8('0x15')](util[_0x6ea8('0x12')]('[%s][queues][hangup]',_0x357d70[_0x6ea8('0x4')]),_0x5094a7);}};exports[_0x6ea8('0x22')]=function(_0xd49249){try{utils['debug'](util[_0x6ea8('0x12')]('[%s][queues][varset]',_0xd49249[_0x6ea8('0x4')]),_0xd49249);if(!_[_0x6ea8('0x23')](_0xd49249['variable'][_0x6ea8('0x24')])&&_0xd49249['value'][_0x6ea8('0x25')]()!==_0x6ea8('0x26')){if(!_[_0x6ea8('0x23')](queues[_0xd49249[_0x6ea8('0x4')]])){queues[_0xd49249['uniqueid']][_0x6ea8('0x1a')]=![];queues[_0xd49249[_0x6ea8('0x4')]]['queuecallerabandonAt']=null;queues[_0xd49249[_0x6ea8('0x4')]][_0x6ea8('0x1b')]=!![];queues[_0xd49249['uniqueid']]['queuecallerexitAt']=utils[_0x6ea8('0x14')]();queues[_0xd49249[_0x6ea8('0x4')]][_0x6ea8('0x9')]=_0xd49249['value'][_0x6ea8('0x25')]();utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x27'),_0xd49249['uniqueid'],queues[_0xd49249[_0x6ea8('0x4')]][_0x6ea8('0x20')],_0xd49249[_0x6ea8('0x28')],queues[_0xd49249[_0x6ea8('0x4')]]['queuecallerexitreason']));writeDB(queues[_0xd49249['uniqueid']]);}}else if(!_[_0x6ea8('0x23')](_0xd49249[_0x6ea8('0x29')]['queueposition'])){if(!_[_0x6ea8('0x23')](queues[_0xd49249['uniqueid']])&&!queues[_0xd49249['uniqueid']][_0x6ea8('0x1a')]){queues[_0xd49249['uniqueid']][_0x6ea8('0x1a')]=![];queues[_0xd49249['uniqueid']][_0x6ea8('0x2a')]=null;queues[_0xd49249[_0x6ea8('0x4')]]['queuecallerexit']=!![];queues[_0xd49249[_0x6ea8('0x4')]][_0x6ea8('0x2b')]=utils[_0x6ea8('0x14')]();queues[_0xd49249[_0x6ea8('0x4')]][_0x6ea8('0x9')]=_0x6ea8('0x2c');utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x2d'),_0xd49249['uniqueid'],queues[_0xd49249['uniqueid']]['name'],_0xd49249[_0x6ea8('0x28')],queues[_0xd49249[_0x6ea8('0x4')]][_0x6ea8('0x9')]));}}}catch(_0x39f1cd){utils[_0x6ea8('0x15')](util[_0x6ea8('0x12')]('[%s][queues][varset]',_0xd49249['uniqueid']),_0x39f1cd);}};exports['queuecallerabandon']=function(_0x23789b){try{if(!_[_0x6ea8('0x23')](queues[_0x23789b[_0x6ea8('0x4')]])){utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')](_0x6ea8('0x2e'),_0x23789b[_0x6ea8('0x4')]),_0x23789b);queues[_0x23789b[_0x6ea8('0x4')]][_0x6ea8('0x1b')]=![];queues[_0x23789b[_0x6ea8('0x4')]]['queuecallerexitAt']=null;queues[_0x23789b[_0x6ea8('0x4')]][_0x6ea8('0x1a')]=!![];queues[_0x23789b['uniqueid']][_0x6ea8('0x2a')]=utils[_0x6ea8('0x14')]();queues[_0x23789b[_0x6ea8('0x4')]]['queuecallerexitreason']=_0x6ea8('0x2f');utils[_0x6ea8('0x2')](util['format'](_0x6ea8('0x30'),_0x23789b[_0x6ea8('0x4')],queues[_0x23789b[_0x6ea8('0x4')]][_0x6ea8('0x20')],queues[_0x23789b[_0x6ea8('0x4')]][_0x6ea8('0x9')]));}}catch(_0x750587){utils[_0x6ea8('0x15')](util[_0x6ea8('0x12')]('[%s][queues][queuecallerabandon]',_0x23789b[_0x6ea8('0x4')]),_0x750587);}};exports['queuecallerleave']=function(_0x81e7c1){try{if(!_[_0x6ea8('0x23')](queues[_0x81e7c1['uniqueid']])){utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')]('[%s][queues][queuecallerleave]',_0x81e7c1[_0x6ea8('0x4')]),_0x81e7c1);utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x31'),_0x81e7c1['uniqueid'],queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x20')],_0x81e7c1[_0x6ea8('0x32')],_0x81e7c1[_0x6ea8('0x33')]));queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x34')]=!![];queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x19')]=utils['now']();queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x35')]=utils[_0x6ea8('0x36')](queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x19')],queues[_0x81e7c1[_0x6ea8('0x4')]]['queuecallerjoinAt']);queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x13')]=_0x81e7c1[_0x6ea8('0x13')];queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x37')]=_0x81e7c1['count'];queues[_0x81e7c1['uniqueid']][_0x6ea8('0x32')]=_0x81e7c1['connectedlinenum'];queues[_0x81e7c1[_0x6ea8('0x4')]][_0x6ea8('0x33')]=_0x81e7c1[_0x6ea8('0x33')];}}catch(_0x3a35db){utils[_0x6ea8('0x15')](util[_0x6ea8('0x12')](_0x6ea8('0x38'),_0x81e7c1[_0x6ea8('0x4')]),_0x3a35db);}};exports['agentconnect']=function(_0x464889){try{if(!_['isNil'](queues[_0x464889[_0x6ea8('0x4')]])){utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')](_0x6ea8('0x39'),_0x464889[_0x6ea8('0x4')]),_0x464889);utils[_0x6ea8('0x2')](util['format'](_0x6ea8('0x3a'),_0x464889['uniqueid'],queues[_0x464889[_0x6ea8('0x4')]]['name'],_0x464889[_0x6ea8('0x3b')],_0x464889[_0x6ea8('0x3c')]));queues[_0x464889[_0x6ea8('0x4')]][_0x6ea8('0x1a')]=![];queues[_0x464889[_0x6ea8('0x4')]][_0x6ea8('0x1a')]=![];queues[_0x464889[_0x6ea8('0x4')]][_0x6ea8('0x2a')]=null;queues[_0x464889[_0x6ea8('0x4')]]['queuecallerexit']=![];queues[_0x464889['uniqueid']][_0x6ea8('0x9')]=null;queues[_0x464889[_0x6ea8('0x4')]][_0x6ea8('0x2b')]=null;queues[_0x464889[_0x6ea8('0x4')]]['assigned']=!![];queues[_0x464889[_0x6ea8('0x4')]][_0x6ea8('0x8')]=_0x464889[_0x6ea8('0x3c')];queues[_0x464889[_0x6ea8('0x4')]][_0x6ea8('0x7')]=_0x464889['membername'];}}catch(_0x380a6d){utils[_0x6ea8('0x15')](util['format']('[%s][queues][agentconnect]',_0x464889[_0x6ea8('0x4')]),_0x380a6d);}};exports[_0x6ea8('0x3d')]=function(_0x410157){try{if(!_[_0x6ea8('0x23')](queues[_0x410157[_0x6ea8('0x4')]])){if(queues[_0x410157['uniqueid']]['queuecallerleaveAt']){utils[_0x6ea8('0x11')](util['format'](_0x6ea8('0x3e'),_0x410157[_0x6ea8('0x4')]),_0x410157);queues[_0x410157[_0x6ea8('0x4')]]['queuecallerabandon']=![];queues[_0x410157[_0x6ea8('0x4')]][_0x6ea8('0x1a')]=![];queues[_0x410157['uniqueid']][_0x6ea8('0x2a')]=null;queues[_0x410157[_0x6ea8('0x4')]][_0x6ea8('0x1b')]=![];queues[_0x410157['uniqueid']]['queuecallerexitAt']=null;queues[_0x410157[_0x6ea8('0x4')]]['assigned']=!![];queues[_0x410157['uniqueid']][_0x6ea8('0x7')]=_0x410157['membername'];queues[_0x410157[_0x6ea8('0x4')]][_0x6ea8('0x1c')]=!![];queues[_0x410157[_0x6ea8('0x4')]][_0x6ea8('0x1d')]=utils[_0x6ea8('0x14')]();if(_0x410157[_0x6ea8('0x3f')]=='transfer'){if(!queues[_0x410157['uniqueid']]['transfer']){queues[_0x410157[_0x6ea8('0x4')]][_0x6ea8('0x9')]=_0x6ea8('0x40');}}else{queues[_0x410157['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x410157[_0x6ea8('0x3f')][_0x6ea8('0x25')]();}utils[_0x6ea8('0x2')](util['format'](_0x6ea8('0x41'),_0x410157[_0x6ea8('0x4')],queues[_0x410157[_0x6ea8('0x4')]]['name'],_0x410157[_0x6ea8('0x3b')],queues[_0x410157[_0x6ea8('0x4')]][_0x6ea8('0x9')]));writeDB(queues[_0x410157[_0x6ea8('0x4')]]);}}}catch(_0x22a35e){utils['error'](util[_0x6ea8('0x12')]('[%s][queues][agentcomplete]',_0x410157[_0x6ea8('0x4')]),_0x22a35e);}};exports['blindtransfer']=function(_0xb2be6f){try{if(!_[_0x6ea8('0x23')](queues[_0xb2be6f[_0x6ea8('0x42')]])){utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')](_0x6ea8('0x43'),_0xb2be6f[_0x6ea8('0x4')]),_0xb2be6f);queues[_0xb2be6f[_0x6ea8('0x42')]][_0x6ea8('0x44')]=!![];queues[_0xb2be6f[_0x6ea8('0x42')]][_0x6ea8('0x45')]=_0x6ea8('0x46');queues[_0xb2be6f['transfereeuniqueid']][_0x6ea8('0x47')]=_0xb2be6f['extension'];queues[_0xb2be6f[_0x6ea8('0x42')]][_0x6ea8('0x48')]=_0xb2be6f[_0x6ea8('0x42')];queues[_0xb2be6f[_0x6ea8('0x42')]][_0x6ea8('0x9')]=_0x6ea8('0x49');utils[_0x6ea8('0x2')](util['format'](_0x6ea8('0x4a'),_0xb2be6f['uniqueid'],queues[_0xb2be6f[_0x6ea8('0x42')]][_0x6ea8('0x20')],_0xb2be6f[_0x6ea8('0x42')],_0xb2be6f['extension']));}}catch(_0x3d7d4a){utils[_0x6ea8('0x15')](util['format'](_0x6ea8('0x43'),_0xb2be6f['uniqueid']),_0x3d7d4a);}};exports[_0x6ea8('0x4b')]=function(_0x782f2a){try{utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')](_0x6ea8('0x4c'),_0x782f2a[_0x6ea8('0x4d')]),_0x782f2a);if(_0x782f2a[_0x6ea8('0x4d')]==_0x782f2a[_0x6ea8('0x4e')]){if(!_[_0x6ea8('0x23')](queues[_0x782f2a[_0x6ea8('0x4f')]])){utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x50'),_0x782f2a['origtransfereruniqueid'],queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0x20')],_0x782f2a['origtransfererexten']));queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0x44')]=!![];queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0x45')]='ATTENDED';queues[_0x782f2a['secondtransfererlinkedid']]['transferexten']=_0x782f2a[_0x6ea8('0x51')];queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0x48')]=_0x782f2a[_0x6ea8('0x4d')];queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x6ea8('0x23')](queues[_0x782f2a[_0x6ea8('0x4e')]])){if(_0x782f2a[_0x6ea8('0x52')]&&queues[_0x782f2a[_0x6ea8('0x52')]]){queues[_0x782f2a[_0x6ea8('0x52')]][_0x6ea8('0x21')]=0x1;queues[_0x782f2a['transfereeuniqueid']]=_[_0x6ea8('0x53')](queues[_0x782f2a[_0x6ea8('0x52')]]);queues[_0x782f2a['transfereeuniqueid']]['transfereduniqueid']=_0x782f2a[_0x6ea8('0x54')];queues[_0x782f2a[_0x6ea8('0x42')]][_0x6ea8('0x21')]=0x2;queues[_0x782f2a[_0x6ea8('0x42')]][_0x6ea8('0x55')]=queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0x55')];queues[_0x782f2a['transfereeuniqueid']]['calleridname']=queues[_0x782f2a[_0x6ea8('0x4f')]]['calleridname'];queues[_0x782f2a[_0x6ea8('0x42')]]['queuecallerjoinAt']=utils['now']();queues[_0x782f2a[_0x6ea8('0x42')]][_0x6ea8('0x19')]=utils[_0x6ea8('0x14')]();queues[_0x782f2a['transfereeuniqueid']][_0x6ea8('0x35')]=0x0;queues[_0x782f2a['transfereeuniqueid']]['mohtime']=0x0;utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x56'),_0x782f2a['origtransfereruniqueid'],queues[_0x782f2a[_0x6ea8('0x42')]]['name'],queues[_0x782f2a[_0x6ea8('0x42')]][_0x6ea8('0x55')],queues[_0x782f2a[_0x6ea8('0x42')]][_0x6ea8('0x57')]));}else{utils[_0x6ea8('0x2')](util['format'](_0x6ea8('0x58'),_0x782f2a[_0x6ea8('0x4d')],queues[_0x782f2a[_0x6ea8('0x4e')]][_0x6ea8('0x20')],_0x782f2a['secondtransfererlinkedid']));queues[_0x782f2a[_0x6ea8('0x4e')]][_0x6ea8('0xf')]=_0x782f2a['secondtransfererlinkedid'];}}}else if(_0x782f2a[_0x6ea8('0x59')]==_0x782f2a[_0x6ea8('0x4f')]){if(!_[_0x6ea8('0x23')](queues[_0x782f2a[_0x6ea8('0x4e')]])){utils['info'](util['format'](_0x6ea8('0x5a'),_0x782f2a[_0x6ea8('0x4d')],queues[_0x782f2a[_0x6ea8('0x4e')]]['name'],_0x782f2a[_0x6ea8('0x59')],_0x782f2a['secondtransfererexten']));queues[_0x782f2a[_0x6ea8('0x4e')]][_0x6ea8('0x44')]=!![];queues[_0x782f2a[_0x6ea8('0x4e')]]['transfertype']=_0x6ea8('0x5b');queues[_0x782f2a[_0x6ea8('0x4e')]]['transferexten']=_0x782f2a[_0x6ea8('0x5c')];queues[_0x782f2a[_0x6ea8('0x4e')]][_0x6ea8('0x48')]=_0x782f2a[_0x6ea8('0x59')];queues[_0x782f2a[_0x6ea8('0x4e')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x6ea8('0x23')](queues[_0x782f2a[_0x6ea8('0x4f')]])){if(_0x782f2a[_0x6ea8('0x5d')]&&queues[_0x782f2a[_0x6ea8('0x5d')]]){queues[_0x782f2a[_0x6ea8('0x5d')]][_0x6ea8('0x21')]=0x1;queues[_0x782f2a['transfertargetuniqueid']]=_[_0x6ea8('0x53')](queues[_0x782f2a[_0x6ea8('0x5d')]]);queues[_0x782f2a['transfertargetuniqueid']][_0x6ea8('0xf')]=_0x782f2a[_0x6ea8('0x54')];queues[_0x782f2a[_0x6ea8('0x54')]]['queuecallerenterreason']=0x2;queues[_0x782f2a['transfertargetuniqueid']][_0x6ea8('0x55')]=queues[_0x782f2a[_0x6ea8('0x4e')]][_0x6ea8('0x55')];queues[_0x782f2a[_0x6ea8('0x54')]][_0x6ea8('0x57')]=queues[_0x782f2a[_0x6ea8('0x4e')]][_0x6ea8('0x57')];queues[_0x782f2a[_0x6ea8('0x54')]][_0x6ea8('0x5e')]=utils['now']();queues[_0x782f2a[_0x6ea8('0x54')]][_0x6ea8('0x19')]=utils[_0x6ea8('0x14')]();queues[_0x782f2a['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x782f2a['transfertargetuniqueid']][_0x6ea8('0x5f')]=0x0;utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x60'),_0x782f2a[_0x6ea8('0x4d')],queues[_0x782f2a[_0x6ea8('0x54')]][_0x6ea8('0x20')],queues[_0x782f2a[_0x6ea8('0x54')]][_0x6ea8('0xf')],queues[_0x782f2a[_0x6ea8('0x54')]][_0x6ea8('0x55')],queues[_0x782f2a['transfertargetuniqueid']][_0x6ea8('0x57')]));}else{utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x58'),_0x782f2a['origtransfereruniqueid'],queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0x20')],_0x782f2a[_0x6ea8('0x4e')]));queues[_0x782f2a[_0x6ea8('0x4f')]][_0x6ea8('0xf')]=_0x782f2a[_0x6ea8('0x4e')];}}}}catch(_0x3fea9e){utils[_0x6ea8('0x15')](util['format']('[%s][queues][attendedtransfer]',_0x782f2a[_0x6ea8('0x4d')]),_0x3fea9e);}};exports[_0x6ea8('0x61')]=function(_0xac8f98){try{if(!_[_0x6ea8('0x23')](queues[_0xac8f98[_0x6ea8('0x4')]])){utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')](_0x6ea8('0x62'),_0xac8f98[_0x6ea8('0x4')]),_0xac8f98);queues[_0xac8f98['uniqueid']]['musiconholdstartAt']=utils[_0x6ea8('0x14')]();utils[_0x6ea8('0x2')](util['format'](_0x6ea8('0x63'),_0xac8f98['uniqueid'],queues[_0xac8f98[_0x6ea8('0x4')]]['name'],queues[_0xac8f98[_0x6ea8('0x4')]]['musiconholdstartAt']));}}catch(_0x1b4990){utils[_0x6ea8('0x15')](util[_0x6ea8('0x12')]('[%s][queues][musiconholdstart]',_0xac8f98['uniqueid']),_0x1b4990);}};exports['musiconholdstop']=function(_0x138a7a){try{if(!_[_0x6ea8('0x23')](queues[_0x138a7a[_0x6ea8('0x4')]])){if(!_[_0x6ea8('0x23')](queues[_0x138a7a[_0x6ea8('0x4')]][_0x6ea8('0x64')])){utils[_0x6ea8('0x11')](util[_0x6ea8('0x12')](_0x6ea8('0x65'),_0x138a7a['uniqueid']),_0x138a7a);queues[_0x138a7a[_0x6ea8('0x4')]]['mohtime']+=utils[_0x6ea8('0x36')](utils[_0x6ea8('0x14')](),queues[_0x138a7a['uniqueid']][_0x6ea8('0x64')]);utils[_0x6ea8('0x2')](util[_0x6ea8('0x12')](_0x6ea8('0x66'),_0x138a7a[_0x6ea8('0x4')],queues[_0x138a7a[_0x6ea8('0x4')]][_0x6ea8('0x20')],queues[_0x138a7a['uniqueid']][_0x6ea8('0x5f')]));delete queues[_0x138a7a[_0x6ea8('0x4')]][_0x6ea8('0x64')];}}}catch(_0x168902){utils[_0x6ea8('0x15')](util[_0x6ea8('0x12')](_0x6ea8('0x65'),_0x138a7a[_0x6ea8('0x4')]),_0x168902);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 01adf94..fd00310 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 _0x8926=['channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten'];(function(_0x3bd982,_0x111b09){var _0x2f15ca=function(_0x434fb6){while(--_0x434fb6){_0x3bd982['push'](_0x3bd982['shift']());}};_0x2f15ca(++_0x111b09);}(_0x8926,0x1b3));var _0x6892=function(_0x5cc01a,_0x410834){_0x5cc01a=_0x5cc01a-0x0;var _0x128feb=_0x8926[_0x5cc01a];return _0x128feb;};'use strict';var _=require(_0x6892('0x0'));var util=require(_0x6892('0x1'));var utils=require('./utils');var transfers=require(_0x6892('0x2'));var recordings={};function writeDB(_0x57f49e){var _0x4d8aac;utils[_0x6892('0x3')](util[_0x6892('0x4')](_0x6892('0x5'),_0x57f49e[_0x6892('0x6')]));if(transfers[_0x6892('0x7')][_0x57f49e['uniqueid']]){_0x4d8aac=_0x57f49e[_0x6892('0x6')];_0x57f49e['uniqueid']=transfers[_0x6892('0x7')][_0x57f49e['uniqueid']]['transfereeuniqueid'];}if(_0x57f49e[_0x6892('0x8')]){utils[_0x6892('0x9')](_0x57f49e[_0x6892('0x8')])[_0x6892('0xa')](function(_0x258c86){if(_0x258c86){_0x57f49e['membername']=_0x258c86['name'];_0x57f49e[_0x6892('0xb')]=_0x258c86['id'];}utils[_0x6892('0xc')](_0x6892('0xd'),_0x57f49e);});}else{utils[_0x6892('0xc')](_0x6892('0xd'),_0x57f49e);}if(_0x4d8aac)delete transfers[_0x6892('0x7')][_0x4d8aac];}exports[_0x6892('0xe')]=function(_0x24a1fb){try{utils[_0x6892('0xf')](util[_0x6892('0x4')](_0x6892('0x10'),_0x24a1fb[_0x6892('0x6')]),_0x24a1fb);if(_0x24a1fb[_0x6892('0x6')]==_0x24a1fb[_0x6892('0x11')]){utils[_0x6892('0x3')](util[_0x6892('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x24a1fb[_0x6892('0x6')],_0x24a1fb[_0x6892('0x12')],_0x24a1fb[_0x6892('0x13')]));recordings[_0x24a1fb[_0x6892('0x6')]]={'uniqueid':_0x24a1fb[_0x6892('0x6')],'accountcode':_0x24a1fb['accountcode'],'exten':_0x24a1fb[_0x6892('0x13')],'context':_0x24a1fb[_0x6892('0x12')],'channel':_0x24a1fb[_0x6892('0x14')],'monitors':[]};}}catch(_0x5e3e90){utils[_0x6892('0x15')](util[_0x6892('0x4')]('[%s][recordings][newchannel]',_0x24a1fb[_0x6892('0x6')]),_0x5e3e90);}};exports[_0x6892('0x16')]=function(_0x5daf01){try{utils[_0x6892('0xf')](util[_0x6892('0x4')](_0x6892('0x17'),_0x5daf01[_0x6892('0x6')]),_0x5daf01);if(!_['isNil'](recordings[_0x5daf01[_0x6892('0x6')]])&&_0x5daf01[_0x6892('0x18')]==0x6){utils[_0x6892('0x3')](util[_0x6892('0x4')](_0x6892('0x19'),_0x5daf01[_0x6892('0x6')],_0x5daf01['context'],_0x5daf01['channel']));}else if(!_[_0x6892('0x1a')](recordings[_0x5daf01['linkedid']])&&_0x5daf01[_0x6892('0x18')]==0x6&&_0x5daf01['context']!='transfer'){utils['info'](util[_0x6892('0x4')](_0x6892('0x1b'),_0x5daf01['uniqueid'],_0x5daf01[_0x6892('0x11')],_0x5daf01['context'],_0x5daf01[_0x6892('0x14')]));recordings[_0x5daf01[_0x6892('0x11')]][_0x6892('0x8')]=_0x5daf01[_0x6892('0x8')];}}catch(_0x2d0b78){utils[_0x6892('0x15')](util[_0x6892('0x4')](_0x6892('0x17'),_0x5daf01[_0x6892('0x6')]),_0x2d0b78);}};exports['varset']=function(_0x235d13){try{if(!_[_0x6892('0x1a')](_0x235d13[_0x6892('0x1c')])&&!_[_0x6892('0x1a')](_0x235d13[_0x6892('0x1c')][_0x6892('0x1d')])){utils[_0x6892('0xf')](util['format']('[%s][recordings][varset]',_0x235d13[_0x6892('0x6')]),_0x235d13);utils['info'](util[_0x6892('0x4')](_0x6892('0x1e'),_0x235d13['uniqueid'],_0x235d13['variable'],_0x235d13[_0x6892('0x1f')]));if(_['endsWith'](_0x235d13[_0x6892('0x1f')],'.wav49')){_0x235d13[_0x6892('0x1f')]=_0x235d13[_0x6892('0x1f')][_0x6892('0x20')](_0x6892('0x21'),_0x6892('0x22'));}if(recordings[_0x235d13[_0x6892('0x11')]]){var _0x26a3ee=_[_0x6892('0x23')](recordings[_0x235d13['linkedid']][_0x6892('0x24')],{'value':_0x235d13['value']});if(_['isNil'](_0x26a3ee)){recordings[_0x235d13[_0x6892('0x11')]][_0x6892('0x24')][_0x6892('0x25')]({'value':_0x235d13[_0x6892('0x1f')]});}}}}catch(_0x447f22){utils['error'](util['format']('[%s][recordings][varset]',_0x235d13[_0x6892('0x6')]),_0x447f22);}};exports[_0x6892('0x26')]=function(_0x37f9e9){try{if(!_[_0x6892('0x1a')](recordings[_0x37f9e9['uniqueid']])){utils['debug'](util['format'](_0x6892('0x27'),_0x37f9e9[_0x6892('0x6')]),_0x37f9e9);utils['info'](util[_0x6892('0x4')](_0x6892('0x28'),_0x37f9e9[_0x6892('0x6')],_0x37f9e9['calleridnum'],_0x37f9e9['calleridname'],_0x37f9e9[_0x6892('0x29')]));recordings[_0x37f9e9[_0x6892('0x6')]]['calleridnum']=_0x37f9e9['calleridnum'];recordings[_0x37f9e9['uniqueid']][_0x6892('0x2a')]=_0x37f9e9[_0x6892('0x2a')];recordings[_0x37f9e9['uniqueid']][_0x6892('0x2b')]=_0x37f9e9[_0x6892('0x2b')];recordings[_0x37f9e9[_0x6892('0x6')]][_0x6892('0x2c')]=_0x37f9e9[_0x6892('0x2c')];if(recordings[_0x37f9e9[_0x6892('0x6')]][_0x6892('0x2d')]==_0x6892('0x2e')&&recordings[_0x37f9e9[_0x6892('0x6')]]['accountcode']){recordings[_0x37f9e9['uniqueid']]['connectedlinenum']=recordings[_0x37f9e9[_0x6892('0x6')]][_0x6892('0x8')];recordings[_0x37f9e9['uniqueid']][_0x6892('0x2c')]='';}recordings[_0x37f9e9[_0x6892('0x6')]][_0x6892('0x24')]['forEach'](function(_0x470fd3){var _0xc87178=_['clone'](recordings[_0x37f9e9[_0x6892('0x6')]]);_0xc87178['value']=_0x470fd3[_0x6892('0x1f')];writeDB(_0xc87178);});delete recordings[_0x37f9e9[_0x6892('0x6')]];}}catch(_0x24558d){utils[_0x6892('0x15')](util[_0x6892('0x4')]('[%s][recordings][hangup]',_0x37f9e9[_0x6892('0x6')]),_0x24558d);}};exports[_0x6892('0x2f')]=function(_0x6601cb){try{if(!_['isNil'](recordings[_0x6601cb['uniqueid']])){utils[_0x6892('0xf')](util[_0x6892('0x4')](_0x6892('0x30'),_0x6601cb['uniqueid']),_0x6601cb);utils[_0x6892('0x3')](util[_0x6892('0x4')](_0x6892('0x31'),_0x6601cb['uniqueid'],_0x6601cb[_0x6892('0x32')],_0x6601cb[_0x6892('0x33')]));if(_0x6601cb[_0x6892('0x32')][_0x6892('0x34')]()==_0x6892('0x35')&&_[_0x6892('0x36')](_0x6601cb[_0x6892('0x33')][_0x6892('0x34')](),_0x6892('0x37'))){var _0x1b517a=_0x6601cb[_0x6892('0x33')]['split']('=');var _0x345b33=_0x1b517a[0x0][_0x6892('0x38')](_0x1b517a[0x0]['lastIndexOf']('(')+0x1,_0x1b517a[0x0][_0x6892('0x39')](')'));var _0x1e3c17=_0x1b517a[0x1];recordings[_0x6601cb[_0x6892('0x6')]][_0x345b33]=_0x1e3c17;}}}catch(_0x3fb523){utils[_0x6892('0x15')](util[_0x6892('0x4')]('[%s][recordings][newexten]',_0x6601cb[_0x6892('0x6')]),_0x3fb523);}};exports['queuecallerjoin']=function(_0x4ba169){try{if(!_[_0x6892('0x1a')](recordings[_0x4ba169[_0x6892('0x6')]])){utils[_0x6892('0xf')](util[_0x6892('0x4')]('[%s][recordings][queuecallerjoin]',_0x4ba169[_0x6892('0x6')]),_0x4ba169);utils[_0x6892('0x3')](util[_0x6892('0x4')](_0x6892('0x3a'),_0x4ba169['uniqueid'],_0x4ba169[_0x6892('0x3b')]));recordings[_0x4ba169[_0x6892('0x6')]][_0x6892('0x3b')]=_0x4ba169[_0x6892('0x3b')];}}catch(_0x4c56de){utils['error'](util[_0x6892('0x4')]('[%s][recordings][queuecallerjoin]',_0x4ba169[_0x6892('0x6')]),_0x4c56de);}};exports['blindtransfer']=function(_0x1108dc){try{utils[_0x6892('0xf')](util[_0x6892('0x4')](_0x6892('0x3c'),_0x1108dc[_0x6892('0x6')]),_0x1108dc);utils[_0x6892('0x3')](util[_0x6892('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1108dc[_0x6892('0x6')],_0x1108dc[_0x6892('0x3d')],_0x1108dc['transferercalleridname'],_0x1108dc[_0x6892('0x3e')],_0x1108dc[_0x6892('0x3f')]));if(recordings[_0x1108dc[_0x6892('0x40')]]&&transfers[_0x6892('0x7')][_0x1108dc[_0x6892('0x40')]]){transfers[_0x6892('0x7')][_0x1108dc[_0x6892('0x40')]]['recording']=!![];}}catch(_0x38ced5){utils[_0x6892('0x15')](util['format'](_0x6892('0x3c'),_0x1108dc[_0x6892('0x6')]),_0x38ced5);}}; \ No newline at end of file +var _0xbc34=['.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','UserId','CreateVoiceRecording','request','newchannel','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace'];(function(_0x2d088c,_0x539a1b){var _0x4b9713=function(_0x32b1f6){while(--_0x32b1f6){_0x2d088c['push'](_0x2d088c['shift']());}};_0x4b9713(++_0x539a1b);}(_0xbc34,0xf6));var _0x4bc3=function(_0x209541,_0x20fd8f){_0x209541=_0x209541-0x0;var _0x48165f=_0xbc34[_0x209541];return _0x48165f;};'use strict';var _=require(_0x4bc3('0x0'));var util=require(_0x4bc3('0x1'));var utils=require(_0x4bc3('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x5a65ce){var _0x4bdb87;utils['info'](util[_0x4bc3('0x3')](_0x4bc3('0x4'),_0x5a65ce[_0x4bc3('0x5')]));if(transfers['blinds'][_0x5a65ce['uniqueid']]){_0x4bdb87=_0x5a65ce[_0x4bc3('0x5')];_0x5a65ce[_0x4bc3('0x5')]=transfers[_0x4bc3('0x6')][_0x5a65ce['uniqueid']][_0x4bc3('0x7')];}if(_0x5a65ce[_0x4bc3('0x8')]){utils[_0x4bc3('0x9')](_0x5a65ce[_0x4bc3('0x8')])[_0x4bc3('0xa')](function(_0x1a50a5){if(_0x1a50a5){_0x5a65ce[_0x4bc3('0xb')]=_0x1a50a5['name'];_0x5a65ce[_0x4bc3('0xc')]=_0x1a50a5['id'];}utils['request'](_0x4bc3('0xd'),_0x5a65ce);});}else{utils[_0x4bc3('0xe')](_0x4bc3('0xd'),_0x5a65ce);}if(_0x4bdb87)delete transfers[_0x4bc3('0x6')][_0x4bdb87];}exports[_0x4bc3('0xf')]=function(_0x718929){try{utils['debug'](util[_0x4bc3('0x3')]('[%s][recordings][newchannel]',_0x718929['uniqueid']),_0x718929);if(_0x718929[_0x4bc3('0x5')]==_0x718929[_0x4bc3('0x10')]){utils[_0x4bc3('0x11')](util['format'](_0x4bc3('0x12'),_0x718929[_0x4bc3('0x5')],_0x718929[_0x4bc3('0x13')],_0x718929[_0x4bc3('0x14')]));recordings[_0x718929[_0x4bc3('0x5')]]={'uniqueid':_0x718929['uniqueid'],'accountcode':_0x718929[_0x4bc3('0x8')],'exten':_0x718929[_0x4bc3('0x14')],'context':_0x718929[_0x4bc3('0x13')],'channel':_0x718929[_0x4bc3('0x15')],'monitors':[]};}}catch(_0x55735a){utils['error'](util[_0x4bc3('0x3')](_0x4bc3('0x16'),_0x718929[_0x4bc3('0x5')]),_0x55735a);}};exports[_0x4bc3('0x17')]=function(_0x332ed5){try{utils[_0x4bc3('0x18')](util[_0x4bc3('0x3')](_0x4bc3('0x19'),_0x332ed5['uniqueid']),_0x332ed5);if(!_['isNil'](recordings[_0x332ed5['uniqueid']])&&_0x332ed5[_0x4bc3('0x1a')]==0x6){utils['info'](util['format'](_0x4bc3('0x1b'),_0x332ed5[_0x4bc3('0x5')],_0x332ed5[_0x4bc3('0x13')],_0x332ed5[_0x4bc3('0x15')]));}else if(!_[_0x4bc3('0x1c')](recordings[_0x332ed5[_0x4bc3('0x10')]])&&_0x332ed5[_0x4bc3('0x1a')]==0x6&&_0x332ed5[_0x4bc3('0x13')]!=_0x4bc3('0x1d')){utils[_0x4bc3('0x11')](util[_0x4bc3('0x3')](_0x4bc3('0x1e'),_0x332ed5[_0x4bc3('0x5')],_0x332ed5['linkedid'],_0x332ed5[_0x4bc3('0x13')],_0x332ed5['channel']));recordings[_0x332ed5[_0x4bc3('0x10')]]['accountcode']=_0x332ed5['accountcode'];}}catch(_0x475011){utils[_0x4bc3('0x1f')](util[_0x4bc3('0x3')](_0x4bc3('0x19'),_0x332ed5['uniqueid']),_0x475011);}};exports[_0x4bc3('0x20')]=function(_0x1039a9){try{if(!_[_0x4bc3('0x1c')](_0x1039a9[_0x4bc3('0x21')])&&!_[_0x4bc3('0x1c')](_0x1039a9[_0x4bc3('0x21')]['mixmonitor_filename'])){utils['debug'](util[_0x4bc3('0x3')]('[%s][recordings][varset]',_0x1039a9[_0x4bc3('0x5')]),_0x1039a9);utils[_0x4bc3('0x11')](util[_0x4bc3('0x3')](_0x4bc3('0x22'),_0x1039a9['uniqueid'],_0x1039a9[_0x4bc3('0x21')],_0x1039a9[_0x4bc3('0x23')]));if(_[_0x4bc3('0x24')](_0x1039a9[_0x4bc3('0x23')],'.wav49')){_0x1039a9[_0x4bc3('0x23')]=_0x1039a9[_0x4bc3('0x23')][_0x4bc3('0x25')](_0x4bc3('0x26'),'.WAV');}if(recordings[_0x1039a9[_0x4bc3('0x10')]]){var _0xa31503=_[_0x4bc3('0x27')](recordings[_0x1039a9['linkedid']]['monitors'],{'value':_0x1039a9[_0x4bc3('0x23')]});if(_[_0x4bc3('0x1c')](_0xa31503)){recordings[_0x1039a9[_0x4bc3('0x10')]][_0x4bc3('0x28')][_0x4bc3('0x29')]({'value':_0x1039a9[_0x4bc3('0x23')]});}}}}catch(_0x5b78a4){utils[_0x4bc3('0x1f')](util[_0x4bc3('0x3')]('[%s][recordings][varset]',_0x1039a9['uniqueid']),_0x5b78a4);}};exports[_0x4bc3('0x2a')]=function(_0x5f2af9){try{if(!_[_0x4bc3('0x1c')](recordings[_0x5f2af9[_0x4bc3('0x5')]])){utils[_0x4bc3('0x18')](util['format'](_0x4bc3('0x2b'),_0x5f2af9['uniqueid']),_0x5f2af9);utils[_0x4bc3('0x11')](util[_0x4bc3('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5f2af9[_0x4bc3('0x5')],_0x5f2af9[_0x4bc3('0x2c')],_0x5f2af9[_0x4bc3('0x2d')],_0x5f2af9[_0x4bc3('0x2e')]));recordings[_0x5f2af9[_0x4bc3('0x5')]]['calleridnum']=_0x5f2af9[_0x4bc3('0x2c')];recordings[_0x5f2af9[_0x4bc3('0x5')]]['calleridname']=_0x5f2af9[_0x4bc3('0x2d')];recordings[_0x5f2af9[_0x4bc3('0x5')]][_0x4bc3('0x2f')]=_0x5f2af9[_0x4bc3('0x2f')];recordings[_0x5f2af9[_0x4bc3('0x5')]][_0x4bc3('0x30')]=_0x5f2af9[_0x4bc3('0x30')];if(recordings[_0x5f2af9[_0x4bc3('0x5')]][_0x4bc3('0x31')]=='outbound'&&recordings[_0x5f2af9['uniqueid']][_0x4bc3('0x8')]){recordings[_0x5f2af9[_0x4bc3('0x5')]][_0x4bc3('0x2f')]=recordings[_0x5f2af9[_0x4bc3('0x5')]][_0x4bc3('0x8')];recordings[_0x5f2af9[_0x4bc3('0x5')]][_0x4bc3('0x30')]='';}recordings[_0x5f2af9['uniqueid']]['monitors'][_0x4bc3('0x32')](function(_0x262151){var _0x5c585c=_[_0x4bc3('0x33')](recordings[_0x5f2af9[_0x4bc3('0x5')]]);_0x5c585c[_0x4bc3('0x23')]=_0x262151[_0x4bc3('0x23')];writeDB(_0x5c585c);});delete recordings[_0x5f2af9[_0x4bc3('0x5')]];}}catch(_0x43e7eb){utils[_0x4bc3('0x1f')](util[_0x4bc3('0x3')](_0x4bc3('0x2b'),_0x5f2af9[_0x4bc3('0x5')]),_0x43e7eb);}};exports[_0x4bc3('0x34')]=function(_0x5a2014){try{if(!_[_0x4bc3('0x1c')](recordings[_0x5a2014[_0x4bc3('0x5')]])){utils[_0x4bc3('0x18')](util['format']('[%s][recordings][newexten]',_0x5a2014[_0x4bc3('0x5')]),_0x5a2014);utils[_0x4bc3('0x11')](util['format'](_0x4bc3('0x35'),_0x5a2014[_0x4bc3('0x5')],_0x5a2014[_0x4bc3('0x36')],_0x5a2014[_0x4bc3('0x37')]));if(_0x5a2014[_0x4bc3('0x36')][_0x4bc3('0x38')]()==_0x4bc3('0x39')&&_[_0x4bc3('0x3a')](_0x5a2014[_0x4bc3('0x37')][_0x4bc3('0x38')](),_0x4bc3('0x3b'))){var _0x234397=_0x5a2014[_0x4bc3('0x37')][_0x4bc3('0x3c')]('=');var _0x417367=_0x234397[0x0]['substring'](_0x234397[0x0]['lastIndexOf']('(')+0x1,_0x234397[0x0][_0x4bc3('0x3d')](')'));var _0x49756e=_0x234397[0x1];recordings[_0x5a2014[_0x4bc3('0x5')]][_0x417367]=_0x49756e;}}}catch(_0x409594){utils[_0x4bc3('0x1f')](util[_0x4bc3('0x3')]('[%s][recordings][newexten]',_0x5a2014[_0x4bc3('0x5')]),_0x409594);}};exports[_0x4bc3('0x3e')]=function(_0x4f0684){try{if(!_['isNil'](recordings[_0x4f0684[_0x4bc3('0x5')]])){utils[_0x4bc3('0x18')](util[_0x4bc3('0x3')](_0x4bc3('0x3f'),_0x4f0684[_0x4bc3('0x5')]),_0x4f0684);utils['info'](util[_0x4bc3('0x3')](_0x4bc3('0x40'),_0x4f0684[_0x4bc3('0x5')],_0x4f0684['queue']));recordings[_0x4f0684[_0x4bc3('0x5')]]['queue']=_0x4f0684[_0x4bc3('0x41')];}}catch(_0x2f3866){utils['error'](util[_0x4bc3('0x3')](_0x4bc3('0x3f'),_0x4f0684['uniqueid']),_0x2f3866);}};exports[_0x4bc3('0x42')]=function(_0x1dd65f){try{utils[_0x4bc3('0x18')](util[_0x4bc3('0x3')](_0x4bc3('0x43'),_0x1dd65f['uniqueid']),_0x1dd65f);utils['info'](util[_0x4bc3('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1dd65f[_0x4bc3('0x5')],_0x1dd65f['transferercalleridnum'],_0x1dd65f['transferercalleridname'],_0x1dd65f[_0x4bc3('0x44')],_0x1dd65f['transfereecalleridname']));if(recordings[_0x1dd65f[_0x4bc3('0x45')]]&&transfers['blinds'][_0x1dd65f[_0x4bc3('0x45')]]){transfers[_0x4bc3('0x6')][_0x1dd65f[_0x4bc3('0x45')]][_0x4bc3('0x46')]=!![];}}catch(_0x274298){utils[_0x4bc3('0x1f')](util[_0x4bc3('0x3')]('[%s][recordings][blindtransfer]',_0x1dd65f[_0x4bc3('0x5')]),_0x274298);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f7d8f55..d486b95 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 _0xec1a=['origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x405dcd,_0x16576a){var _0x28dd3c=function(_0x59ca46){while(--_0x59ca46){_0x405dcd['push'](_0x405dcd['shift']());}};_0x28dd3c(++_0x16576a);}(_0xec1a,0x1d2));var _0xaec1=function(_0x533bb5,_0x4c6ec0){_0x533bb5=_0x533bb5-0x0;var _0x160711=_0xec1a[_0x533bb5];return _0x160711;};'use strict';var _=require(_0xaec1('0x0'));var util=require('util');var utils=require(_0xaec1('0x1'));function writeDB(_0x2dadd6){utils[_0xaec1('0x2')](util[_0xaec1('0x3')](_0xaec1('0x4'),_0x2dadd6['type']===_0xaec1('0x5')?_0x2dadd6[_0xaec1('0x6')]:_0x2dadd6[_0xaec1('0x7')],_0x2dadd6['type']));utils[_0xaec1('0x8')](_0xaec1('0x9'),_0x2dadd6);}exports[_0xaec1('0xa')]={};exports[_0xaec1('0xb')]=function(_0x382b1e){try{utils['debug'](util['format'](_0xaec1('0xc'),_0x382b1e['uniqueid']),_0x382b1e);utils['info'](util[_0xaec1('0x3')](_0xaec1('0xd'),_0x382b1e[_0xaec1('0x7')],_0x382b1e['transferercalleridnum'],_0x382b1e[_0xaec1('0xe')],_0x382b1e[_0xaec1('0xf')],_0x382b1e['transfereecalleridname']));_0x382b1e['type']=_0xaec1('0x10');exports[_0xaec1('0xa')][_0x382b1e[_0xaec1('0x11')]]=_0x382b1e;writeDB(_0x382b1e);}catch(_0x52205e){utils[_0xaec1('0x12')](util[_0xaec1('0x3')](_0xaec1('0xc'),_0x382b1e[_0xaec1('0x7')]),_0x52205e);}};exports[_0xaec1('0x13')]=function(_0x2cd52e){try{utils[_0xaec1('0x14')](util['format'](_0xaec1('0x15'),_0x2cd52e[_0xaec1('0x6')]),_0x2cd52e);utils[_0xaec1('0x2')](util[_0xaec1('0x3')](_0xaec1('0x16'),_0x2cd52e[_0xaec1('0x6')],_0x2cd52e[_0xaec1('0x17')],_0x2cd52e['origtransferercalleridname'],_0x2cd52e[_0xaec1('0x18')],_0x2cd52e[_0xaec1('0x19')]));_0x2cd52e=_['assign'](_0x2cd52e,{'transfererchannel':_0x2cd52e[_0xaec1('0x1a')],'transferercalleridnum':_0x2cd52e[_0xaec1('0x17')],'transferercalleridname':_0x2cd52e[_0xaec1('0x1b')],'transfererconnectedlinenum':_0x2cd52e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2cd52e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2cd52e[_0xaec1('0x1c')],'transferercontext':_0x2cd52e[_0xaec1('0x1d')],'transfererexten':_0x2cd52e[_0xaec1('0x1e')],'transfererlinkedid':_0x2cd52e[_0xaec1('0x1f')],'context':_0x2cd52e[_0xaec1('0x20')],'extension':_0x2cd52e[_0xaec1('0x21')],'type':_0xaec1('0x5')});if(_[_0xaec1('0x22')](_0x2cd52e[_0xaec1('0x23')])){_0x2cd52e=_[_0xaec1('0x24')](_0x2cd52e,{'transfereechannel':_0x2cd52e[_0xaec1('0x25')],'transfereecalleridnum':_0x2cd52e[_0xaec1('0x18')],'transfereecalleridname':_0x2cd52e[_0xaec1('0x19')],'transfereeconnectedlinenum':_0x2cd52e[_0xaec1('0x26')],'transfereeconnectedlinename':_0x2cd52e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2cd52e[_0xaec1('0x27')],'transfereecontext':_0x2cd52e['transfertargetcontext'],'transfereeexten':_0x2cd52e['transfertargetexten'],'transfereelinkedid':_0x2cd52e[_0xaec1('0x28')]});}writeDB(_0x2cd52e);}catch(_0x152222){utils[_0xaec1('0x12')](util[_0xaec1('0x3')](_0xaec1('0x15'),_0x2cd52e[_0xaec1('0x6')]),_0x152222);}}; \ No newline at end of file +var _0x3d35=['transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','lodash','util','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil'];(function(_0xd5e781,_0x4cc1cd){var _0x304703=function(_0x1a4f66){while(--_0x1a4f66){_0xd5e781['push'](_0xd5e781['shift']());}};_0x304703(++_0x4cc1cd);}(_0x3d35,0xf5));var _0x53d3=function(_0x3f2375,_0x592da7){_0x3f2375=_0x3f2375-0x0;var _0x540804=_0x3d35[_0x3f2375];return _0x540804;};'use strict';var _=require(_0x53d3('0x0'));var util=require(_0x53d3('0x1'));var utils=require(_0x53d3('0x2'));function writeDB(_0x3f6037){utils[_0x53d3('0x3')](util[_0x53d3('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x3f6037[_0x53d3('0x5')]===_0x53d3('0x6')?_0x3f6037[_0x53d3('0x7')]:_0x3f6037[_0x53d3('0x8')],_0x3f6037[_0x53d3('0x5')]));utils[_0x53d3('0x9')](_0x53d3('0xa'),_0x3f6037);}exports[_0x53d3('0xb')]={};exports[_0x53d3('0xc')]=function(_0x53ddaf){try{utils['debug'](util[_0x53d3('0x4')](_0x53d3('0xd'),_0x53ddaf['uniqueid']),_0x53ddaf);utils[_0x53d3('0x3')](util[_0x53d3('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x53ddaf[_0x53d3('0x8')],_0x53ddaf['transferercalleridnum'],_0x53ddaf[_0x53d3('0xe')],_0x53ddaf[_0x53d3('0xf')],_0x53ddaf['transfereecalleridname']));_0x53ddaf[_0x53d3('0x5')]='blind';exports[_0x53d3('0xb')][_0x53ddaf[_0x53d3('0x10')]]=_0x53ddaf;writeDB(_0x53ddaf);}catch(_0x195f1c){utils[_0x53d3('0x11')](util[_0x53d3('0x4')]('[%s][transfers][blindtransfer]',_0x53ddaf['uniqueid']),_0x195f1c);}};exports[_0x53d3('0x12')]=function(_0x2a2cce){try{utils[_0x53d3('0x13')](util['format'](_0x53d3('0x14'),_0x2a2cce[_0x53d3('0x7')]),_0x2a2cce);utils[_0x53d3('0x3')](util[_0x53d3('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2a2cce[_0x53d3('0x7')],_0x2a2cce[_0x53d3('0x15')],_0x2a2cce[_0x53d3('0x16')],_0x2a2cce[_0x53d3('0x17')],_0x2a2cce[_0x53d3('0x18')]));_0x2a2cce=_[_0x53d3('0x19')](_0x2a2cce,{'transfererchannel':_0x2a2cce[_0x53d3('0x1a')],'transferercalleridnum':_0x2a2cce[_0x53d3('0x15')],'transferercalleridname':_0x2a2cce[_0x53d3('0x16')],'transfererconnectedlinenum':_0x2a2cce[_0x53d3('0x1b')],'transfererconnectedlinename':_0x2a2cce[_0x53d3('0x1c')],'transfereraccountcode':_0x2a2cce[_0x53d3('0x1d')],'transferercontext':_0x2a2cce[_0x53d3('0x1e')],'transfererexten':_0x2a2cce[_0x53d3('0x1f')],'transfererlinkedid':_0x2a2cce[_0x53d3('0x20')],'context':_0x2a2cce['origtransferercontext'],'extension':_0x2a2cce[_0x53d3('0x21')],'type':_0x53d3('0x6')});if(_[_0x53d3('0x22')](_0x2a2cce[_0x53d3('0x23')])){_0x2a2cce=_['assign'](_0x2a2cce,{'transfereechannel':_0x2a2cce[_0x53d3('0x24')],'transfereecalleridnum':_0x2a2cce[_0x53d3('0x17')],'transfereecalleridname':_0x2a2cce[_0x53d3('0x18')],'transfereeconnectedlinenum':_0x2a2cce[_0x53d3('0x25')],'transfereeconnectedlinename':_0x2a2cce[_0x53d3('0x26')],'transfereeaccountcode':_0x2a2cce['transfertargetaccountcode'],'transfereecontext':_0x2a2cce['transfertargetcontext'],'transfereeexten':_0x2a2cce[_0x53d3('0x27')],'transfereelinkedid':_0x2a2cce['transfertargetlinkedid']});}writeDB(_0x2a2cce);}catch(_0x30b17a){utils[_0x53d3('0x11')](util[_0x53d3('0x4')](_0x53d3('0x14'),_0x2a2cce[_0x53d3('0x7')]),_0x30b17a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c799e2c..5342903 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 _0x3004=['add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]','[utils][getUserByName]','getVoiceQueueByName','[utils][getVoiceQueueByName]\x20name:%s','length','addTime'];(function(_0x20fea1,_0x3352b8){var _0x5cd341=function(_0x569a1b){while(--_0x569a1b){_0x20fea1['push'](_0x20fea1['shift']());}};_0x5cd341(++_0x3352b8);}(_0x3004,0x123));var _0x4300=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3004[_0x53ccf2];return _0x5a2964;};'use strict';var BPromise=require(_0x4300('0x0'));var jayson=require(_0x4300('0x1'));var moment=require(_0x4300('0x2'));var util=require(_0x4300('0x3'));var client=jayson[_0x4300('0x4')]['http']({'port':0x2329});var logger=require(_0x4300('0x5'))(_0x4300('0x6'));exports['info']=function(_0x1766fc,_0x49f517){logger[_0x4300('0x7')](_0x1766fc,_0x49f517?util[_0x4300('0x8')](_0x49f517,{'showHidden':![],'depth':null}):'');};exports[_0x4300('0x9')]=function(_0x594702,_0x3d8d55){logger['debug'](_0x594702,_0x3d8d55?util[_0x4300('0x8')](_0x3d8d55,{'showHidden':![],'depth':null}):'');};exports[_0x4300('0xa')]=function(_0xa94d8a,_0xf35cf7){logger[_0x4300('0xa')](_0xa94d8a,_0xf35cf7?util[_0x4300('0x8')](_0xf35cf7,{'showHidden':![],'depth':null}):'');};exports[_0x4300('0xb')]=function(_0x9d77ad,_0x56b017){return client['request'](_0x9d77ad,{'body':_0x56b017})[_0x4300('0xc')](function(_0x4c5c44){logger[_0x4300('0x9')](_0x4300('0xd'),_0x9d77ad,_0x4c5c44?util[_0x4300('0x8')](_0x4c5c44,{'showHidden':![],'depth':null}):'');})[_0x4300('0xe')](function(_0x41c5af){logger[_0x4300('0xa')](_0x4300('0xd'),_0x9d77ad,_0x41c5af?util[_0x4300('0x8')](_0x41c5af,{'showHidden':![],'depth':null}):'');});};function getUser(_0x41aa4b){return client[_0x4300('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x4300('0xf'),'name','interface'],'where':_0x41aa4b,'limit':0x1}})[_0x4300('0xc')](function(_0x173fa9){logger[_0x4300('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x4300('0x10')](_0x41aa4b),_0x173fa9?util['inspect'](_0x173fa9,{'showHidden':![],'depth':null}):'');return _0x173fa9[_0x4300('0x11')]['length']?_0x173fa9[_0x4300('0x11')][0x0]:null;});}exports[_0x4300('0x12')]=function(_0x43c61f){return new BPromise(function(_0x5a8218,_0x4c072a){if(_0x43c61f){return getUser({'internal':_0x43c61f})[_0x4300('0xc')](function(_0xbe9a5a){logger['info'](_0x4300('0x13'),_0x43c61f,_0xbe9a5a?_0x4300('0x14'):_0x4300('0x15'));return _0x5a8218(_0xbe9a5a);})[_0x4300('0xe')](function(_0x4df848){logger[_0x4300('0xa')](_0x4300('0x16'),_0x4df848?util[_0x4300('0x8')](_0x4df848,{'showHidden':![],'depth':null}):'');return _0x5a8218(null);});}return _0x5a8218(null);});};exports['getUserByInterface']=function(_0x3bf2cf){return new BPromise(function(_0x3250e9,_0x49248a){if(_0x3bf2cf){return getUser({'interface':_0x3bf2cf})['then'](function(_0x267cd4){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x3bf2cf,_0x267cd4?_0x4300('0x14'):_0x4300('0x15'));return _0x3250e9(_0x267cd4);})[_0x4300('0xe')](function(_0x491d71){logger[_0x4300('0xa')](_0x4300('0x17'),_0x491d71?util[_0x4300('0x8')](_0x491d71,{'showHidden':![],'depth':null}):'');return _0x3250e9(null);});}return _0x3250e9(null);});};exports['getUserByName']=function(_0x51c802){return new BPromise(function(_0x4a61b0,_0xc86874){if(_0x51c802){return getUser({'name':_0x51c802})[_0x4300('0xc')](function(_0xfc05fc){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x51c802,_0xfc05fc?'found':_0x4300('0x15'));return _0x4a61b0(_0xfc05fc);})[_0x4300('0xe')](function(_0x5480d4){logger[_0x4300('0xa')](_0x4300('0x18'),_0x5480d4?util[_0x4300('0x8')](_0x5480d4,{'showHidden':![],'depth':null}):'');return _0x4a61b0(null);});}return _0x4a61b0(null);});};exports[_0x4300('0x19')]=function(_0x14d4e9){return new BPromise(function(_0x356a38,_0x27578){if(_0x14d4e9){return client[_0x4300('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name','type','acw','acwTimeout'],'where':{'name':_0x14d4e9},'limit':0x1}})[_0x4300('0xc')](function(_0x4a3b70){logger[_0x4300('0x9')](_0x4300('0x1a'),_0x14d4e9,_0x4a3b70?util['inspect'](_0x4a3b70,{'showHidden':![],'depth':null}):'');logger[_0x4300('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x14d4e9,_0x4a3b70?_0x4300('0x14'):_0x4300('0x15'));return _0x356a38(_0x4a3b70[_0x4300('0x11')][_0x4300('0x1b')]?_0x4a3b70[_0x4300('0x11')][0x0]:null);})[_0x4300('0xe')](function(_0xa6fd44){logger[_0x4300('0xa')]('[utils][getVoiceQueueByName]',_0xa6fd44?util[_0x4300('0x8')](_0xa6fd44,{'showHidden':![],'depth':null}):'');return _0x356a38(null);});}return _0x356a38(null);});};exports[_0x4300('0x1c')]=function(_0x44510f,_0x1fa96b){return moment(_0x44510f)[_0x4300('0x1d')](_0x1fa96b,_0x4300('0x1e'))[_0x4300('0x1f')](_0x4300('0x20'));};exports[_0x4300('0x21')]=function(_0x1140c5,_0x579f26){return moment(_0x1140c5)[_0x4300('0x22')](_0x579f26,'seconds')[_0x4300('0x1f')](_0x4300('0x20'));};exports[_0x4300('0x23')]=function(_0x431407,_0x1a3a44){return moment(_0x431407)[_0x4300('0x24')](moment(_0x1a3a44),_0x4300('0x1e'));};exports[_0x4300('0x25')]=function(_0x41220a,_0x2aa918){return parseInt(_0x41220a,0xa)+parseInt(_0x2aa918,0xa);};exports['now']=function(){return moment()['format'](_0x4300('0x20'));};exports[_0x4300('0x26')]=function(_0x5b033f,_0x2c524d){if(_0x2c524d){return moment(_0x5b033f)['isAfter'](_0x2c524d);}return!![];};exports[_0x4300('0x27')]=function(_0x760d4,_0x2d1edb){if(_0x2d1edb){return moment(_0x760d4)[_0x4300('0x27')](_0x2d1edb);}else if(_0x760d4){return!![];}return![];}; \ No newline at end of file +var _0xbf57=['internal','[utils][getUser]\x20where:%s','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','sumTime','now','isAfter','isBefore','jayson/promise','util','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0xbf57,0x1bf));var _0x7bf5=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0xbf57[_0x15f27e];return _0x18da4f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7bf5('0x0'));var moment=require('moment');var util=require(_0x7bf5('0x1'));var client=jayson[_0x7bf5('0x2')][_0x7bf5('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x7bf5('0x4'));exports[_0x7bf5('0x5')]=function(_0x58974b,_0x595fd9){logger[_0x7bf5('0x5')](_0x58974b,_0x595fd9?util[_0x7bf5('0x6')](_0x595fd9,{'showHidden':![],'depth':null}):'');};exports[_0x7bf5('0x7')]=function(_0x5a488f,_0x4faa96){logger[_0x7bf5('0x7')](_0x5a488f,_0x4faa96?util['inspect'](_0x4faa96,{'showHidden':![],'depth':null}):'');};exports[_0x7bf5('0x8')]=function(_0x2d0fc6,_0x2d572c){logger[_0x7bf5('0x8')](_0x2d0fc6,_0x2d572c?util[_0x7bf5('0x6')](_0x2d572c,{'showHidden':![],'depth':null}):'');};exports[_0x7bf5('0x9')]=function(_0x8dfcff,_0x4a8859){return client[_0x7bf5('0x9')](_0x8dfcff,{'body':_0x4a8859})[_0x7bf5('0xa')](function(_0x5c342e){logger['debug'](_0x7bf5('0xb'),_0x8dfcff,_0x5c342e?util[_0x7bf5('0x6')](_0x5c342e,{'showHidden':![],'depth':null}):'');})[_0x7bf5('0xc')](function(_0x8b73d){logger['error']('[utils][request]\x20name:%s',_0x8dfcff,_0x8b73d?util['inspect'](_0x8b73d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x125d57){return client[_0x7bf5('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x7bf5('0xd'),'name','interface'],'where':_0x125d57,'limit':0x1}})['then'](function(_0x36b70c){logger['debug'](_0x7bf5('0xe'),JSON['stringify'](_0x125d57),_0x36b70c?util[_0x7bf5('0x6')](_0x36b70c,{'showHidden':![],'depth':null}):'');return _0x36b70c[_0x7bf5('0xf')]['length']?_0x36b70c[_0x7bf5('0xf')][0x0]:null;});}exports[_0x7bf5('0x10')]=function(_0x563b4a){return new BPromise(function(_0x529f13,_0x1c1992){if(_0x563b4a){return getUser({'internal':_0x563b4a})['then'](function(_0x3c3f5a){logger['info'](_0x7bf5('0x11'),_0x563b4a,_0x3c3f5a?_0x7bf5('0x12'):'notfound');return _0x529f13(_0x3c3f5a);})[_0x7bf5('0xc')](function(_0x3c7cc2){logger['error'](_0x7bf5('0x13'),_0x3c7cc2?util['inspect'](_0x3c7cc2,{'showHidden':![],'depth':null}):'');return _0x529f13(null);});}return _0x529f13(null);});};exports['getUserByInterface']=function(_0x2d6c7b){return new BPromise(function(_0x20171f,_0x43e485){if(_0x2d6c7b){return getUser({'interface':_0x2d6c7b})['then'](function(_0x332515){logger['info'](_0x7bf5('0x14'),_0x2d6c7b,_0x332515?_0x7bf5('0x12'):'notfound');return _0x20171f(_0x332515);})[_0x7bf5('0xc')](function(_0x55e817){logger[_0x7bf5('0x8')](_0x7bf5('0x15'),_0x55e817?util[_0x7bf5('0x6')](_0x55e817,{'showHidden':![],'depth':null}):'');return _0x20171f(null);});}return _0x20171f(null);});};exports[_0x7bf5('0x16')]=function(_0x509912){return new BPromise(function(_0xb41867,_0x567466){if(_0x509912){return getUser({'name':_0x509912})[_0x7bf5('0xa')](function(_0x56a80e){logger['info'](_0x7bf5('0x17'),_0x509912,_0x56a80e?_0x7bf5('0x12'):_0x7bf5('0x18'));return _0xb41867(_0x56a80e);})[_0x7bf5('0xc')](function(_0x5ca18d){logger['error'](_0x7bf5('0x19'),_0x5ca18d?util['inspect'](_0x5ca18d,{'showHidden':![],'depth':null}):'');return _0xb41867(null);});}return _0xb41867(null);});};exports[_0x7bf5('0x1a')]=function(_0x644f6a){return new BPromise(function(_0x467b68,_0x29f0af){if(_0x644f6a){return client[_0x7bf5('0x9')](_0x7bf5('0x1b'),{'options':{'raw':!![],'attributes':['id','name',_0x7bf5('0x1c'),_0x7bf5('0x1d'),_0x7bf5('0x1e')],'where':{'name':_0x644f6a},'limit':0x1}})[_0x7bf5('0xa')](function(_0x141bc6){logger[_0x7bf5('0x7')](_0x7bf5('0x1f'),_0x644f6a,_0x141bc6?util[_0x7bf5('0x6')](_0x141bc6,{'showHidden':![],'depth':null}):'');logger['info'](_0x7bf5('0x20'),_0x644f6a,_0x141bc6?'found':'notfound');return _0x467b68(_0x141bc6['result'][_0x7bf5('0x21')]?_0x141bc6[_0x7bf5('0xf')][0x0]:null);})['catch'](function(_0x229485){logger[_0x7bf5('0x8')](_0x7bf5('0x22'),_0x229485?util['inspect'](_0x229485,{'showHidden':![],'depth':null}):'');return _0x467b68(null);});}return _0x467b68(null);});};exports[_0x7bf5('0x23')]=function(_0x57deed,_0x383b90){return moment(_0x57deed)[_0x7bf5('0x24')](_0x383b90,_0x7bf5('0x25'))[_0x7bf5('0x26')](_0x7bf5('0x27'));};exports[_0x7bf5('0x28')]=function(_0x3e45d5,_0x2a9c0a){return moment(_0x3e45d5)[_0x7bf5('0x29')](_0x2a9c0a,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x57c6c0,_0x2988e5){return moment(_0x57c6c0)['diff'](moment(_0x2988e5),_0x7bf5('0x25'));};exports[_0x7bf5('0x2a')]=function(_0x3cf797,_0x9ac44e){return parseInt(_0x3cf797,0xa)+parseInt(_0x9ac44e,0xa);};exports[_0x7bf5('0x2b')]=function(){return moment()[_0x7bf5('0x26')](_0x7bf5('0x27'));};exports[_0x7bf5('0x2c')]=function(_0x5c9998,_0x2429f2){if(_0x2429f2){return moment(_0x5c9998)[_0x7bf5('0x2c')](_0x2429f2);}return!![];};exports[_0x7bf5('0x2d')]=function(_0x268263,_0x5ae961){if(_0x5ae961){return moment(_0x268263)[_0x7bf5('0x2d')](_0x5ae961);}else if(_0x268263){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 6a725d1..dec9627 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 _0x92ba=['remoteAddress','url','statusCode','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','path','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','client','name','ensureDir','then','catch','user','error','api','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection'];(function(_0x1e25ef,_0x426cc7){var _0x1aa61f=function(_0x46e8a6){while(--_0x46e8a6){_0x1e25ef['push'](_0x1e25ef['shift']());}};_0x1aa61f(++_0x426cc7);}(_0x92ba,0x1b2));var _0xa92b=function(_0x3cfe3a,_0x1d6202){_0x3cfe3a=_0x3cfe3a-0x0;var _0x3cf53e=_0x92ba[_0x3cfe3a];return _0x3cf53e;};var fs=require(_0xa92b('0x0'));var _=require(_0xa92b('0x1'));var ewinston=require('express-winston');var path=require(_0xa92b('0x2'));var util=require('util');var fileLogger=require(_0xa92b('0x3'))['fileLogger'];var safeTemplate=require(_0xa92b('0x4'))[_0xa92b('0x5')];var maskSensitiveData=require(_0xa92b('0x6'))[_0xa92b('0x7')];function ClientSideLogger(){function _0x5b3bbf(_0x48c75c){var _0x286e99=path['join']('/var','log','xcally');var _0x80f1bd=path[_0xa92b('0x8')](_0xa92b('0x9'),_0x48c75c['role']+'-'+_0x48c75c[_0xa92b('0xa')]);return fs[_0xa92b('0xb')](path[_0xa92b('0x8')](_0x286e99,_0x80f1bd))[_0xa92b('0xc')](function(){var _0xd39028=fileLogger(_0xa92b('0x9'),path[_0xa92b('0x8')](_0x286e99,_0x80f1bd));return _0xd39028;})[_0xa92b('0xd')](function(_0x2b80a5){throw _0x2b80a5;});}this['log']=function(_0x5e32c9,_0x1baf24,_0x5e8d35,_0x520c69){return _0x5b3bbf(_0x5e32c9[_0xa92b('0xe')])['then'](function(_0xbf7b52){var _0xec3334=_0xbf7b52[_0x1baf24];return _0xec3334;})[_0xa92b('0xc')](function(_0x18ca86){var _0x3c6585=_0x5e32c9[_0xa92b('0xe')]?_0x5e32c9['user']['id']:'no-user';var _0x39c0f4=_0x520c69['data'];var _0x42e0bd=_0x520c69['timestamp'];var _0x1c1a3f=new Date(Number(_0x42e0bd));return _0x18ca86(_0x3c6585,_0x1c1a3f,_0x5e8d35,_0x39c0f4);})[_0xa92b('0xd')](function(_0x41d364){fileLogger(_0xa92b('0x9'))[_0xa92b('0xf')](_0x41d364);});};}function setupLoggers(_0x549930){return new Promise(function(_0x458baf){var _0x31edce=new ClientSideLogger();var _0x7a03a7=fileLogger(_0xa92b('0x10'));var _0x2bd819=fileLogger('auth');_0x549930['set'](_0xa92b('0x11'),_0x31edce);_0x549930[_0xa92b('0x12')](ewinston['logger']({'winstonInstance':_0x7a03a7,'meta':![],'statusLevels':!![],'msg':function(_0x4a6dcd,_0x2b5816){var _0x1c9231=_0xa92b('0x13');if(!_[_0xa92b('0x14')](_0x4a6dcd[_0xa92b('0x15')])){_0x1c9231+=_0xa92b('0x16');var _0x41df1f=_0x4a6dcd[_0xa92b('0x15')];maskSensitiveData(_0x41df1f);}return safeTemplate(util[_0xa92b('0x17')](_0x1c9231,_0x4a6dcd[_0xa92b('0x18')],_0x4a6dcd[_0xa92b('0x19')][_0xa92b('0x1a')]?_0x4a6dcd[_0xa92b('0x19')][_0xa92b('0x1a')]:_0x4a6dcd[_0xa92b('0x1b')][_0xa92b('0x1c')]||_0x4a6dcd['ip'],_0x4a6dcd[_0xa92b('0x1d')],_0x2b5816[_0xa92b('0x1e')],_0x2b5816['responseTime'],_0x4a6dcd['user']?_0x4a6dcd[_0xa92b('0xe')]['id']:null,_0x4a6dcd['user']?_0x4a6dcd['user'][_0xa92b('0xa')]:null,_0x4a6dcd[_0xa92b('0xe')]?_0x4a6dcd[_0xa92b('0xe')][_0xa92b('0x1f')]:null,_0x41df1f?util[_0xa92b('0x20')](_0x41df1f,![],null):''));}}));_0x549930['use'](ewinston[_0xa92b('0x21')]({'winstonInstance':_0x2bd819,'meta':![],'statusLevels':!![],'msg':function(_0x10cff5,_0x338b6a){var _0x2ae7ad=_0xa92b('0x22');if(_0x10cff5[_0xa92b('0x15')]&&_0x10cff5['body'][_0xa92b('0x23')]&&_0x10cff5[_0xa92b('0x15')][_0xa92b('0x24')]){_0x2ae7ad='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2ae7ad,_0x10cff5[_0xa92b('0x18')],_0x10cff5[_0xa92b('0x19')][_0xa92b('0x1a')]?_0x10cff5[_0xa92b('0x19')][_0xa92b('0x1a')]:_0x10cff5[_0xa92b('0x1b')][_0xa92b('0x1c')]||_0x10cff5['ip'],_0x10cff5[_0xa92b('0x1d')],_0x338b6a[_0xa92b('0x1e')],_0x338b6a[_0xa92b('0x25')],_0x10cff5[_0xa92b('0xe')]?_0x10cff5[_0xa92b('0xe')]['id']:null,_0x10cff5['user']?_0x10cff5['user']['name']:null,_0x10cff5[_0xa92b('0xe')]?_0x10cff5[_0xa92b('0xe')][_0xa92b('0x1f')]:null,_0x10cff5['body']&&_0x10cff5[_0xa92b('0x15')][_0xa92b('0x23')]?_0x10cff5[_0xa92b('0x15')]['device']:_0xa92b('0x26'),_0x10cff5[_0xa92b('0x15')]&&_0x10cff5[_0xa92b('0x15')][_0xa92b('0x24')]?_0x10cff5[_0xa92b('0x15')][_0xa92b('0x24')]:'',_0x10cff5[_0xa92b('0x15')]&&_0x10cff5[_0xa92b('0x15')][_0xa92b('0x27')]?_0x10cff5[_0xa92b('0x15')]['agent_name']:'');},'ignoreRoute':function(_0xa34acb){var _0x901cab=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x901cab[_0xa92b('0x28')](_0xa34acb['url']);}}));return _0x458baf();});}exports[_0xa92b('0x29')]=setupLoggers; \ No newline at end of file +var _0xf0b7=['./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','role','name','ensureDir','then','client','user','timestamp','catch','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xf0b7,0x8a));var _0x7f0b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf0b7[_0x17d9e3];return _0x14192d;};var fs=require(_0x7f0b('0x0'));var _=require(_0x7f0b('0x1'));var ewinston=require(_0x7f0b('0x2'));var path=require(_0x7f0b('0x3'));var util=require(_0x7f0b('0x4'));var fileLogger=require('./loggers')[_0x7f0b('0x5')];var safeTemplate=require(_0x7f0b('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x7f0b('0x7'))[_0x7f0b('0x8')];function ClientSideLogger(){function _0x5255f8(_0x18f0d0){var _0x4636cb=path[_0x7f0b('0x9')](_0x7f0b('0xa'),_0x7f0b('0xb'),_0x7f0b('0xc'));var _0x24fb0f=path[_0x7f0b('0x9')]('client',_0x18f0d0[_0x7f0b('0xd')]+'-'+_0x18f0d0[_0x7f0b('0xe')]);return fs[_0x7f0b('0xf')](path[_0x7f0b('0x9')](_0x4636cb,_0x24fb0f))[_0x7f0b('0x10')](function(){var _0x42e146=fileLogger(_0x7f0b('0x11'),path[_0x7f0b('0x9')](_0x4636cb,_0x24fb0f));return _0x42e146;})['catch'](function(_0xeaeefe){throw _0xeaeefe;});}this[_0x7f0b('0xb')]=function(_0x4ae612,_0x4b05b2,_0x108374,_0x2b9988){return _0x5255f8(_0x4ae612[_0x7f0b('0x12')])[_0x7f0b('0x10')](function(_0x1a4c12){var _0x5ba978=_0x1a4c12[_0x4b05b2];return _0x5ba978;})[_0x7f0b('0x10')](function(_0x16278f){var _0x26b5c3=_0x4ae612[_0x7f0b('0x12')]?_0x4ae612['user']['id']:'no-user';var _0x76cf0f=_0x2b9988['data'];var _0x4b4ebd=_0x2b9988[_0x7f0b('0x13')];var _0x15c82e=new Date(Number(_0x4b4ebd));return _0x16278f(_0x26b5c3,_0x15c82e,_0x108374,_0x76cf0f);})[_0x7f0b('0x14')](function(_0x20cb91){fileLogger(_0x7f0b('0x11'))[_0x7f0b('0x15')](_0x20cb91);});};}function setupLoggers(_0x587136){return new Promise(function(_0x207298){var _0x558402=new ClientSideLogger();var _0xb5a99d=fileLogger(_0x7f0b('0x16'));var _0xcdee96=fileLogger(_0x7f0b('0x17'));_0x587136[_0x7f0b('0x18')](_0x7f0b('0x19'),_0x558402);_0x587136[_0x7f0b('0x1a')](ewinston[_0x7f0b('0x1b')]({'winstonInstance':_0xb5a99d,'meta':![],'statusLevels':!![],'msg':function(_0x3a9371,_0x278f55){var _0x1c4947=_0x7f0b('0x1c');if(!_[_0x7f0b('0x1d')](_0x3a9371['body'])){_0x1c4947+='\x20body=%s';var _0x2a1f7f=_0x3a9371[_0x7f0b('0x1e')];maskSensitiveData(_0x2a1f7f);}return safeTemplate(util[_0x7f0b('0x1f')](_0x1c4947,_0x3a9371[_0x7f0b('0x20')],_0x3a9371[_0x7f0b('0x21')][_0x7f0b('0x22')]?_0x3a9371[_0x7f0b('0x21')]['x-forwarded-for']:_0x3a9371[_0x7f0b('0x23')][_0x7f0b('0x24')]||_0x3a9371['ip'],_0x3a9371[_0x7f0b('0x25')],_0x278f55['statusCode'],_0x278f55[_0x7f0b('0x26')],_0x3a9371[_0x7f0b('0x12')]?_0x3a9371['user']['id']:null,_0x3a9371[_0x7f0b('0x12')]?_0x3a9371[_0x7f0b('0x12')][_0x7f0b('0xe')]:null,_0x3a9371[_0x7f0b('0x12')]?_0x3a9371[_0x7f0b('0x12')]['role']:null,_0x2a1f7f?util[_0x7f0b('0x27')](_0x2a1f7f,![],null):''));}}));_0x587136[_0x7f0b('0x1a')](ewinston['logger']({'winstonInstance':_0xcdee96,'meta':![],'statusLevels':!![],'msg':function(_0x2a8560,_0x1ad7fc){var _0x4ea281='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2a8560[_0x7f0b('0x1e')]&&_0x2a8560['body'][_0x7f0b('0x28')]&&_0x2a8560['body']['agent_id']){_0x4ea281=_0x7f0b('0x29');}return util[_0x7f0b('0x1f')](_0x4ea281,_0x2a8560['method'],_0x2a8560[_0x7f0b('0x21')][_0x7f0b('0x22')]?_0x2a8560[_0x7f0b('0x21')][_0x7f0b('0x22')]:_0x2a8560['connection'][_0x7f0b('0x24')]||_0x2a8560['ip'],_0x2a8560['url'],_0x1ad7fc[_0x7f0b('0x2a')],_0x1ad7fc['responseTime'],_0x2a8560[_0x7f0b('0x12')]?_0x2a8560['user']['id']:null,_0x2a8560['user']?_0x2a8560['user'][_0x7f0b('0xe')]:null,_0x2a8560[_0x7f0b('0x12')]?_0x2a8560[_0x7f0b('0x12')][_0x7f0b('0xd')]:null,_0x2a8560[_0x7f0b('0x1e')]&&_0x2a8560[_0x7f0b('0x1e')][_0x7f0b('0x28')]?_0x2a8560['body'][_0x7f0b('0x28')]:_0x7f0b('0x2b'),_0x2a8560[_0x7f0b('0x1e')]&&_0x2a8560['body'][_0x7f0b('0x2c')]?_0x2a8560[_0x7f0b('0x1e')][_0x7f0b('0x2c')]:'',_0x2a8560[_0x7f0b('0x1e')]&&_0x2a8560[_0x7f0b('0x1e')][_0x7f0b('0x2d')]?_0x2a8560[_0x7f0b('0x1e')][_0x7f0b('0x2d')]:'');},'ignoreRoute':function(_0x579bb2){var _0x1869aa=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1869aa[_0x7f0b('0x2e')](_0x579bb2['url']);}}));return _0x207298();});}exports[_0x7f0b('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index dbe606d..8392d9d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7625=['replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','join','format','%s-%s.log','message'];(function(_0x11cb12,_0x363aeb){var _0x33d570=function(_0x5975d1){while(--_0x5975d1){_0x11cb12['push'](_0x11cb12['shift']());}};_0x33d570(++_0x363aeb);}(_0x7625,0xb1));var _0x5762=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x7625[_0x12fc8d];return _0x3f9d04;};'use strict';var path=require(_0x5762('0x0'));var util=require(_0x5762('0x1'));var moment=require(_0x5762('0x2'));var winston=require(_0x5762('0x3'));var config=require(_0x5762('0x4'));var debugLevel=config[_0x5762('0x5')]?config['debugLevel']['toLowerCase']():_0x5762('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':'redBG\x20white','error':'red','warn':_0x5762('0x7'),'info':'white','print':_0x5762('0x8'),'success':_0x5762('0x9'),'http':_0x5762('0xa'),'verbose':'bold\x20magenta','debug':_0x5762('0xb'),'silly':_0x5762('0xc')};winston[_0x5762('0xd')](XC_LOG_COLORS);function getLogFileName(_0x13e49d,_0x12bc94,_0x19613d){var _0x8d4d00=_0x13e49d||'/var/log/xcally';return path[_0x5762('0xe')](_0x8d4d00,util[_0x5762('0xf')](_0x5762('0x10'),_0x12bc94,_0x19613d));}function formatter(_0x54409a,_0x41b578){_0x41b578['message']=_0x41b578[_0x5762('0x11')][_0x5762('0x12')](/@@{/g,_0x5762('0x13'))[_0x5762('0x12')](/}@@/g,_0x5762('0x14'))[_0x5762('0x12')](/@{/g,'{{')[_0x5762('0x12')](/}@/g,'}}');return util[_0x5762('0xf')](_0x5762('0x15'),moment()[_0x5762('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x41b578[_0x5762('0x16')][_0x5762('0x17')](),_0x54409a,_0x41b578[_0x5762('0x11')]);}function fileFormat(_0xb6d392,_0x3815d5){_0x3815d5['message']=_0x3815d5['message'][_0x5762('0x12')](/@@{/g,_0x5762('0x13'))[_0x5762('0x12')](/}@@/g,_0x5762('0x14'))['replace'](/@{/g,'{{')[_0x5762('0x12')](/}@/g,'}}');var _0x90c7c9=_0x3815d5[_0x5762('0x18')]&&Object[_0x5762('0x19')](_0x3815d5[_0x5762('0x18')])[_0x5762('0x1a')]?'\x0a\x09'+JSON[_0x5762('0x1b')](_0x3815d5['meta']):'';return util['format'](_0x5762('0x1c'),moment()[_0x5762('0xf')](_0x5762('0x1d')),_0x3815d5[_0x5762('0x16')][_0x5762('0x17')](),_0xb6d392,_0x3815d5[_0x5762('0x11')],_0x90c7c9);}function consoleLogger(){var _0x3916ed=new winston[(_0x5762('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5762('0x1f'))][(_0x5762('0x20'))]({'level':_0x5762('0x21'),'json':![],'formatter':function(_0x580977){return formatter('',_0x580977);}})]});return _0x3916ed;}function fileLogger(_0x4c2760,_0x3cb307){var _0xf087e9=new winston[(_0x5762('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5762('0x1f'))][(_0x5762('0x22'))]({'name':util[_0x5762('0xf')](_0x5762('0x23'),_0x4c2760,_0x5762('0x24')),'filename':getLogFileName(_0x3cb307,_0x4c2760,_0x5762('0x24')),'level':_0x5762('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28d278){return fileFormat(_0x4c2760,_0x28d278);}}),new winston[(_0x5762('0x1f'))][(_0x5762('0x22'))]({'name':util['format'](_0x5762('0x23'),_0x4c2760,debugLevel),'filename':getLogFileName(_0x3cb307,_0x4c2760,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2aca27){return fileFormat(_0x4c2760,_0x2aca27);}}),new winston['transports'][(_0x5762('0x20'))]({'level':_0x5762('0x21'),'json':![],'formatter':function(_0x25db05){return fileFormat(_0x4c2760,_0x25db05);}})]});return _0xf087e9;}exports[_0x5762('0x25')]=consoleLogger;exports[_0x5762('0x26')]=fileLogger; \ No newline at end of file +var _0xf3b1=['consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','level','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','File','%s-%s','error'];(function(_0x5492c7,_0x3c65e4){var _0x1e20d9=function(_0x5e1f4a){while(--_0x5e1f4a){_0x5492c7['push'](_0x5492c7['shift']());}};_0x1e20d9(++_0x3c65e4);}(_0xf3b1,0x160));var _0x1f3b=function(_0x25eae6,_0x60b88c){_0x25eae6=_0x25eae6-0x0;var _0x481b73=_0xf3b1[_0x25eae6];return _0x481b73;};'use strict';var path=require(_0x1f3b('0x0'));var util=require(_0x1f3b('0x1'));var moment=require(_0x1f3b('0x2'));var winston=require(_0x1f3b('0x3'));var config=require('../config/environment');var debugLevel=config[_0x1f3b('0x4')]?config[_0x1f3b('0x4')][_0x1f3b('0x5')]():_0x1f3b('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':'redBG\x20white','error':_0x1f3b('0x7'),'warn':_0x1f3b('0x8'),'info':_0x1f3b('0x9'),'print':_0x1f3b('0xa'),'success':'bold\x20green','http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0x1f3b('0xb')](XC_LOG_COLORS);function getLogFileName(_0x3360c0,_0x491327,_0x539db0){var _0xdff99=_0x3360c0||'/var/log/xcally';return path[_0x1f3b('0xc')](_0xdff99,util[_0x1f3b('0xd')](_0x1f3b('0xe'),_0x491327,_0x539db0));}function formatter(_0x334b12,_0x22e153){_0x22e153['message']=_0x22e153[_0x1f3b('0xf')][_0x1f3b('0x10')](/@@{/g,_0x1f3b('0x11'))[_0x1f3b('0x10')](/}@@/g,_0x1f3b('0x12'))['replace'](/@{/g,'{{')[_0x1f3b('0x10')](/}@/g,'}}');return util[_0x1f3b('0xd')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x1f3b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x22e153[_0x1f3b('0x13')][_0x1f3b('0x14')](),_0x334b12,_0x22e153[_0x1f3b('0xf')]);}function fileFormat(_0x33c66f,_0x5736d5){_0x5736d5[_0x1f3b('0xf')]=_0x5736d5[_0x1f3b('0xf')][_0x1f3b('0x10')](/@@{/g,'{{{')[_0x1f3b('0x10')](/}@@/g,'}}}')[_0x1f3b('0x10')](/@{/g,'{{')[_0x1f3b('0x10')](/}@/g,'}}');var _0x56cb3d=_0x5736d5[_0x1f3b('0x15')]&&Object[_0x1f3b('0x16')](_0x5736d5[_0x1f3b('0x15')])['length']?'\x0a\x09'+JSON[_0x1f3b('0x17')](_0x5736d5[_0x1f3b('0x15')]):'';return util['format'](_0x1f3b('0x18'),moment()[_0x1f3b('0xd')](_0x1f3b('0x19')),_0x5736d5[_0x1f3b('0x13')][_0x1f3b('0x14')](),_0x33c66f,_0x5736d5[_0x1f3b('0xf')],_0x56cb3d);}function consoleLogger(){var _0x5dbb29=new winston[(_0x1f3b('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1f3b('0x1b'))][(_0x1f3b('0x1c'))]({'level':_0x1f3b('0x1d'),'json':![],'formatter':function(_0x570cf0){return formatter('',_0x570cf0);}})]});return _0x5dbb29;}function fileLogger(_0x36a48b,_0x57f491){var _0x39cc86=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1f3b('0x1e'))]({'name':util['format'](_0x1f3b('0x1f'),_0x36a48b,_0x1f3b('0x20')),'filename':getLogFileName(_0x57f491,_0x36a48b,_0x1f3b('0x20')),'level':_0x1f3b('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e3f2b){return fileFormat(_0x36a48b,_0x1e3f2b);}}),new winston['transports'][(_0x1f3b('0x1e'))]({'name':util[_0x1f3b('0xd')](_0x1f3b('0x1f'),_0x36a48b,debugLevel),'filename':getLogFileName(_0x57f491,_0x36a48b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x136125){return fileFormat(_0x36a48b,_0x136125);}}),new winston['transports'][(_0x1f3b('0x1c'))]({'level':_0x1f3b('0x1d'),'json':![],'formatter':function(_0x111e24){return fileFormat(_0x36a48b,_0x111e24);}})]});return _0x39cc86;}exports[_0x1f3b('0x21')]=consoleLogger;exports[_0x1f3b('0x22')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 4f9f0d7..c126506 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 _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x1967,0x173));var _0x7196=function(_0x59ef28,_0x19a82f){_0x59ef28=_0x59ef28-0x0;var _0x5a4334=_0x1967[_0x59ef28];return _0x5a4334;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x1aa049,_0x9ae13c){var _0x357f29=function(_0xfd2f83){while(--_0xfd2f83){_0x1aa049['push'](_0x1aa049['shift']());}};_0x357f29(++_0x9ae13c);}(_0x2ef3,0xba));var _0x32ef=function(_0x520628,_0x2489a4){_0x520628=_0x520628-0x0;var _0x441418=_0x2ef3[_0x520628];return _0x441418;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 7bf9fb9..bb4c544 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 _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xda2d,0x102));var _0xdda2=function(_0x3ff9cd,_0x1451f1){_0x3ff9cd=_0x3ff9cd-0x0;var _0x115eaa=_0xda2d[_0x3ff9cd];return _0x115eaa;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file +var _0x9ffd=['{\x20{\x20','string','replace','map','keys','reduce','exports','safeTemplate','lodash'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1f6cec,_0x1c9022){_0x1f6cec=_0x1f6cec-0x0;var _0xc98519=_0x9ffd[_0x1f6cec];return _0xc98519;};var _=require(_0xd9ff('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x413161){return _0x413161==='{{'?_0xd9ff('0x1'):'\x20}\x20}';}function safeTemplate(_0x3480c0){var _0x1530b1=_0x3480c0;if(typeof _0x3480c0===_0xd9ff('0x2')){_0x1530b1=_0x3480c0[_0xd9ff('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x3480c0)){_0x1530b1=_0x3480c0[_0xd9ff('0x4')](function(_0x111697){return safeTemplate(_0x111697);});}else if(_['isPlainObject'](_0x3480c0)){_0x1530b1=Object[_0xd9ff('0x5')](_0x3480c0)[_0xd9ff('0x6')](function(_0x13ea8c,_0x270eb2){_0x13ea8c[_0x270eb2]=safeTemplate(_0x3480c0[_0x270eb2]);return _0x13ea8c;},{});}return _0x1530b1;}module[_0xd9ff('0x7')][_0xd9ff('0x8')]=safeTemplate; \ No newline at end of file